From: support Date: Thu, 13 Oct 2022 08:45:49 +0000 (+0000) Subject: Built motion from commit 27ba07f1.|2.6.19 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png//%22%27?a=commitdiff_plain;h=6098f1f2050e950836f0192b02a349e4166b72a9;p=motion2.git Built motion from commit 27ba07f1.|2.6.19 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 7369ba8..f190067 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-13T07:01:45.264Z", + "time": "2022-10-13T08:38:28.443Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e2811f6..54fa1dd 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-13T07:01:45.264Z", + "time": "2022-10-13T08:38:28.443Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index d68db68..8328022 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 _0xe437=['STRING','contactManager','integration','motionbar','jscripty','urlForward','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]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action'];(function(_0x3f3c3c,_0x5244df){var _0x2f3422=function(_0x3c8b81){while(--_0x3c8b81){_0x3f3c3c['push'](_0x3f3c3c['shift']());}};_0x2f3422(++_0x5244df);}(_0xe437,0x69));var _0x7e43=function(_0x2d4a97,_0x1ae413){_0x2d4a97=_0x2d4a97-0x0;var _0x4dd50=_0xe437[_0x2d4a97];return _0x4dd50;};'use strict';var Sequelize=require(_0x7e43('0x0'));module[_0x7e43('0x1')]={'name':{'type':Sequelize[_0x7e43('0x2')],'get':function(_0x5f282f){return this[_0x7e43('0x3')](_0x7e43('0x4'));}},'action':{'type':Sequelize[_0x7e43('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7e43('0x6'),_0x7e43('0x7'),_0x7e43('0x8'),_0x7e43('0x9'),_0x7e43('0xa'),'browser',_0x7e43('0xb'),_0x7e43('0xc')]],'msg':_0x7e43('0xd')}},'comment':_0x7e43('0xd')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x7e43('0xe')},'data2':{'type':Sequelize[_0x7e43('0x5')](0x1000),'comment':_0x7e43('0xf')},'data3':{'type':Sequelize[_0x7e43('0x5')](0x1000),'comment':_0x7e43('0x10')},'data4':{'type':Sequelize[_0x7e43('0x5')](0x1000),'comments':_0x7e43('0x11')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x7e43('0x12')},'data6':{'type':Sequelize[_0x7e43('0x5')],'comments':_0x7e43('0x13')},'data7':{'type':Sequelize[_0x7e43('0x14')],'comments':_0x7e43('0x15')}}; \ No newline at end of file +var _0x0890=['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)]','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','getDataValue','integration'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x0890,0x1e6));var _0x0089=function(_0x27fd1d,_0x2c7271){_0x27fd1d=_0x27fd1d-0x0;var _0x41b9af=_0x0890[_0x27fd1d];return _0x41b9af;};'use strict';var Sequelize=require(_0x0089('0x0'));module[_0x0089('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1304dc){return this[_0x0089('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x0089('0x3'),'motionbar','jscripty','urlForward','browser',_0x0089('0x4'),_0x0089('0x5')]],'msg':_0x0089('0x6')}},'comment':_0x0089('0x6')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x0089('0x7')},'data2':{'type':Sequelize[_0x0089('0x8')](0x1000),'comment':_0x0089('0x9')},'data3':{'type':Sequelize[_0x0089('0x8')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x0089('0xa')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x0089('0xb')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x0089('0xc')],'comments':_0x0089('0xd')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index f2aaed4..f13640d 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 _0x6440=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','body','Action','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0xc555fd,_0x33ab7e){var _0x176871=function(_0x1427e1){while(--_0x1427e1){_0xc555fd['push'](_0xc555fd['shift']());}};_0x176871(++_0x33ab7e);}(_0x6440,0x1e5));var _0x0644=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x6440[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x0644('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0644('0x1'));var jsonpatch=require(_0x0644('0x2'));var rp=require(_0x0644('0x3'));var moment=require('moment');var BPromise=require(_0x0644('0x4'));var Mustache=require(_0x0644('0x5'));var util=require(_0x0644('0x6'));var path=require(_0x0644('0x7'));var sox=require('sox');var csv=require(_0x0644('0x8'));var ejs=require(_0x0644('0x9'));var fs=require('fs');var fs_extra=require(_0x0644('0xa'));var _=require(_0x0644('0xb'));var squel=require(_0x0644('0xc'));var crypto=require('crypto');var jsforce=require(_0x0644('0xd'));var deskjs=require(_0x0644('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0644('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0644('0x10'));var qs=require(_0x0644('0x11'));var as=require(_0x0644('0x12'));var hardwareService=require(_0x0644('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0644('0x14'));var config=require(_0x0644('0x15'));var licenseUtil=require(_0x0644('0x16'));var db=require(_0x0644('0x17'))['db'];function respondWithStatusCode(_0xf35fcd,_0x27ef07){_0x27ef07=_0x27ef07||0xcc;return function(_0x586545){if(_0x586545){return _0xf35fcd['sendStatus'](_0x27ef07);}return _0xf35fcd[_0x0644('0x18')](_0x27ef07)[_0x0644('0x19')]();};}function respondWithResult(_0x67c5fd,_0x4e389e){_0x4e389e=_0x4e389e||0xc8;return function(_0x41fc3b){if(_0x41fc3b){return _0x67c5fd['status'](_0x4e389e)[_0x0644('0x1a')](_0x41fc3b);}};}function respondWithFilteredResult(_0x1bd6ac,_0x158d96){return function(_0x51403f){if(_0x51403f){var _0x343bb0=typeof _0x158d96[_0x0644('0x1b')]==='undefined'&&typeof _0x158d96[_0x0644('0x1c')]===_0x0644('0x1d');var _0x2e228f=_0x51403f[_0x0644('0x1e')];var _0x2a1d5f=_0x343bb0?0x0:_0x158d96[_0x0644('0x1b')];var _0x13e747=_0x343bb0?_0x51403f[_0x0644('0x1e')]:_0x158d96[_0x0644('0x1b')]+_0x158d96['limit'];var _0x2fc67f;if(_0x13e747>=_0x2e228f){_0x13e747=_0x2e228f;_0x2fc67f=0xc8;}else{_0x2fc67f=0xce;}_0x1bd6ac[_0x0644('0x18')](_0x2fc67f);return _0x1bd6ac[_0x0644('0x1f')](_0x0644('0x20'),_0x2a1d5f+'-'+_0x13e747+'/'+_0x2e228f)[_0x0644('0x1a')](_0x51403f);}return null;};}function patchUpdates(_0xd608f3){return function(_0x4103ce){try{jsonpatch[_0x0644('0x21')](_0x4103ce,_0xd608f3,!![]);}catch(_0x58747a){return BPromise[_0x0644('0x22')](_0x58747a);}return _0x4103ce['save']();};}function saveUpdates(_0x438329,_0x4519e5){return function(_0x224e7d){if(_0x224e7d){return _0x224e7d[_0x0644('0x23')](_0x438329)[_0x0644('0x24')](function(_0xa327d3){return _0xa327d3;});}return null;};}function removeEntity(_0x264068,_0x26dd8d){return function(_0x4c92ab){if(_0x4c92ab){return _0x4c92ab[_0x0644('0x25')]()['then'](function(){_0x264068['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x281a2f,_0x429a44){return function(_0x55625b){if(!_0x55625b){_0x281a2f['sendStatus'](0x194);}return _0x55625b;};}function handleError(_0x352ffa,_0x5c4c50){_0x5c4c50=_0x5c4c50||0x1f4;return function(_0xd37081){logger['error'](_0xd37081[_0x0644('0x26')]);if(_0xd37081['name']){delete _0xd37081[_0x0644('0x27')];}_0x352ffa['status'](_0x5c4c50)[_0x0644('0x28')](_0xd37081);};}exports['update']=function(_0x9a4673,_0x4dda7e){if(_0x9a4673[_0x0644('0x29')]['id']){delete _0x9a4673[_0x0644('0x29')]['id'];}return db[_0x0644('0x2a')][_0x0644('0x2b')]({'where':{'id':_0x9a4673[_0x0644('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4dda7e,null))[_0x0644('0x24')](saveUpdates(_0x9a4673[_0x0644('0x29')],null))['then'](respondWithResult(_0x4dda7e,null))[_0x0644('0x2d')](handleError(_0x4dda7e,null));};exports[_0x0644('0x25')]=function(_0x32d4c4,_0x5ad806){return db[_0x0644('0x2a')][_0x0644('0x2b')]({'where':{'id':_0x32d4c4[_0x0644('0x2c')]['id']}})[_0x0644('0x24')](handleEntityNotFound(_0x5ad806,null))[_0x0644('0x24')](removeEntity(_0x5ad806,null))[_0x0644('0x2d')](handleError(_0x5ad806,null));}; \ No newline at end of file +var _0x30bf=['fs-extra','lodash','squel','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','save','then','destroy','end','error','name','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x8f567d,_0x34cd99){var _0x16992c=function(_0xd0d8ae){while(--_0xd0d8ae){_0x8f567d['push'](_0x8f567d['shift']());}};_0x16992c(++_0x34cd99);}(_0x30bf,0x153));var _0xf30b=function(_0x362ade,_0x3514c3){_0x362ade=_0x362ade-0x0;var _0x56efed=_0x30bf[_0x362ade];return _0x56efed;};'use strict';var emlformat=require(_0xf30b('0x0'));var rimraf=require(_0xf30b('0x1'));var zipdir=require(_0xf30b('0x2'));var jsonpatch=require(_0xf30b('0x3'));var rp=require(_0xf30b('0x4'));var moment=require(_0xf30b('0x5'));var BPromise=require(_0xf30b('0x6'));var Mustache=require(_0xf30b('0x7'));var util=require(_0xf30b('0x8'));var path=require(_0xf30b('0x9'));var sox=require(_0xf30b('0xa'));var csv=require(_0xf30b('0xb'));var ejs=require(_0xf30b('0xc'));var fs=require('fs');var fs_extra=require(_0xf30b('0xd'));var _=require(_0xf30b('0xe'));var squel=require(_0xf30b('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf30b('0xb'));var querystring=require('querystring');var Papa=require(_0xf30b('0x10'));var Redis=require(_0xf30b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf30b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf30b('0x13'))(_0xf30b('0x14'));var utils=require('../../config/utils');var config=require(_0xf30b('0x15'));var licenseUtil=require(_0xf30b('0x16'));var db=require(_0xf30b('0x17'))['db'];function respondWithStatusCode(_0x3e72c4,_0x18bfcb){_0x18bfcb=_0x18bfcb||0xcc;return function(_0x17ce5a){if(_0x17ce5a){return _0x3e72c4[_0xf30b('0x18')](_0x18bfcb);}return _0x3e72c4[_0xf30b('0x19')](_0x18bfcb)['end']();};}function respondWithResult(_0x5433c9,_0x1620e6){_0x1620e6=_0x1620e6||0xc8;return function(_0x225bf5){if(_0x225bf5){return _0x5433c9['status'](_0x1620e6)[_0xf30b('0x1a')](_0x225bf5);}};}function respondWithFilteredResult(_0x4c6e1e,_0x591efe){return function(_0x48e1db){if(_0x48e1db){var _0x110d5d=typeof _0x591efe[_0xf30b('0x1b')]===_0xf30b('0x1c')&&typeof _0x591efe[_0xf30b('0x1d')]===_0xf30b('0x1c');var _0xbe558e=_0x48e1db['count'];var _0x3d7410=_0x110d5d?0x0:_0x591efe[_0xf30b('0x1b')];var _0x35f38a=_0x110d5d?_0x48e1db['count']:_0x591efe[_0xf30b('0x1b')]+_0x591efe['limit'];var _0x25e5f7;if(_0x35f38a>=_0xbe558e){_0x35f38a=_0xbe558e;_0x25e5f7=0xc8;}else{_0x25e5f7=0xce;}_0x4c6e1e[_0xf30b('0x19')](_0x25e5f7);return _0x4c6e1e[_0xf30b('0x1e')](_0xf30b('0x1f'),_0x3d7410+'-'+_0x35f38a+'/'+_0xbe558e)[_0xf30b('0x1a')](_0x48e1db);}return null;};}function patchUpdates(_0x57273d){return function(_0x4371c6){try{jsonpatch['apply'](_0x4371c6,_0x57273d,!![]);}catch(_0x5c34f9){return BPromise['reject'](_0x5c34f9);}return _0x4371c6[_0xf30b('0x20')]();};}function saveUpdates(_0x1999a9,_0x45b047){return function(_0x17a211){if(_0x17a211){return _0x17a211['update'](_0x1999a9)[_0xf30b('0x21')](function(_0x1adfcd){return _0x1adfcd;});}return null;};}function removeEntity(_0x1c1c00,_0x24ecbc){return function(_0x42ea4e){if(_0x42ea4e){return _0x42ea4e[_0xf30b('0x22')]()[_0xf30b('0x21')](function(){_0x1c1c00[_0xf30b('0x19')](0xcc)[_0xf30b('0x23')]();});}};}function handleEntityNotFound(_0x443297,_0x2cebb7){return function(_0x5c57ed){if(!_0x5c57ed){_0x443297[_0xf30b('0x18')](0x194);}return _0x5c57ed;};}function handleError(_0x431578,_0x2aefca){_0x2aefca=_0x2aefca||0x1f4;return function(_0x53281e){logger[_0xf30b('0x24')](_0x53281e['stack']);if(_0x53281e['name']){delete _0x53281e[_0xf30b('0x25')];}_0x431578[_0xf30b('0x19')](_0x2aefca)['send'](_0x53281e);};}exports[_0xf30b('0x26')]=function(_0x3e6f08,_0x132f90){if(_0x3e6f08[_0xf30b('0x27')]['id']){delete _0x3e6f08[_0xf30b('0x27')]['id'];}return db[_0xf30b('0x28')][_0xf30b('0x29')]({'where':{'id':_0x3e6f08[_0xf30b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x132f90,null))[_0xf30b('0x21')](saveUpdates(_0x3e6f08[_0xf30b('0x27')],null))['then'](respondWithResult(_0x132f90,null))[_0xf30b('0x2b')](handleError(_0x132f90,null));};exports[_0xf30b('0x22')]=function(_0x317faf,_0x40dacb){return db[_0xf30b('0x28')]['find']({'where':{'id':_0x317faf[_0xf30b('0x2a')]['id']}})[_0xf30b('0x21')](handleEntityNotFound(_0x40dacb,null))['then'](removeEntity(_0x40dacb,null))['catch'](handleError(_0x40dacb,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 6da0b15..186d68b 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 _0x803f=['tools_actions','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Action'];(function(_0x2b9ae3,_0xd6d709){var _0x4e18a2=function(_0x397406){while(--_0x397406){_0x2b9ae3['push'](_0x2b9ae3['shift']());}};_0x4e18a2(++_0xd6d709);}(_0x803f,0x64));var _0xf803=function(_0xaac2bb,_0x5829a4){_0xaac2bb=_0xaac2bb-0x0;var _0x226c65=_0x803f[_0xaac2bb];return _0x226c65;};'use strict';var _=require(_0xf803('0x0'));var util=require('util');var logger=require(_0xf803('0x1'))(_0xf803('0x2'));var moment=require('moment');var BPromise=require(_0xf803('0x3'));var rp=require(_0xf803('0x4'));var fs=require('fs');var path=require(_0xf803('0x5'));var rimraf=require(_0xf803('0x6'));var config=require(_0xf803('0x7'));var attributes=require('./action.attributes');module[_0xf803('0x8')]=function(_0x2ba12f,_0x1d3a79){return _0x2ba12f['define'](_0xf803('0x9'),attributes,{'tableName':_0xf803('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35f9=['bluebird','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35f9,0x8b));var _0x935f=function(_0x6a0894,_0xf1b17f){_0x6a0894=_0x6a0894-0x0;var _0x1a888a=_0x35f9[_0x6a0894];return _0x1a888a;};'use strict';var _=require(_0x935f('0x0'));var util=require('util');var logger=require(_0x935f('0x1'))(_0x935f('0x2'));var moment=require(_0x935f('0x3'));var BPromise=require(_0x935f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x935f('0x5'));var rimraf=require(_0x935f('0x6'));var config=require(_0x935f('0x7'));var attributes=require(_0x935f('0x8'));module[_0x935f('0x9')]=function(_0x9b8919,_0x387d5d){return _0x9b8919[_0x935f('0xa')](_0x935f('0xb'),attributes,{'tableName':_0x935f('0xc'),'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 96da2b6..3376b01 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(_0x406e46,_0x5799cb){var _0x4a3742=function(_0x1fa435){while(--_0x1fa435){_0x406e46['push'](_0x406e46['shift']());}};_0x4a3742(++_0x5799cb);}(_0xf494,0x1c6));var _0x4f49=function(_0x1e9f6b,_0x2cc09a){_0x1e9f6b=_0x1e9f6b-0x0;var _0x5c2a4f=_0xf494[_0x1e9f6b];return _0x5c2a4f;};'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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x85953f,_0x2decd2){var _0x35a9c5=function(_0x474e91){while(--_0x474e91){_0x85953f['push'](_0x85953f['shift']());}};_0x35a9c5(++_0x2decd2);}(_0x5fab,0x177));var _0xb5fa=function(_0x2c5ec9,_0x4d69fe){_0x2c5ec9=_0x2c5ec9-0x0;var _0x460637=_0x5fab[_0x2c5ec9];return _0x460637;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index a3a2d48..38337ce 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 _0x0b95=['util','path','express','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x4f7523,_0x4f57e8){var _0x2262cb=function(_0x3f4988){while(--_0x3f4988){_0x4f7523['push'](_0x4f7523['shift']());}};_0x2262cb(++_0x4f57e8);}(_0x0b95,0xa4));var _0x50b9=function(_0x26ec70,_0x5631ac){_0x26ec70=_0x26ec70-0x0;var _0x5d0e13=_0x0b95[_0x26ec70];return _0x5d0e13;};'use strict';var multer=require(_0x50b9('0x0'));var util=require(_0x50b9('0x1'));var path=require(_0x50b9('0x2'));var timeout=require('connect-timeout');var express=require(_0x50b9('0x3'));var router=express['Router']();var fs_extra=require(_0x50b9('0x4'));var auth=require(_0x50b9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x50b9('0x6'));var controller=require(_0x50b9('0x7'));router[_0x50b9('0x8')](_0x50b9('0x9'),auth[_0x50b9('0xa')](),controller[_0x50b9('0xb')]);router[_0x50b9('0xc')]('/:id',auth[_0x50b9('0xa')](),controller[_0x50b9('0xd')]);module[_0x50b9('0xe')]=router; \ No newline at end of file +var _0x9685=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated','update','delete','destroy','util','path','express'];(function(_0x441f69,_0x146a2c){var _0x1d1c2d=function(_0xf3cb0d){while(--_0xf3cb0d){_0x441f69['push'](_0x441f69['shift']());}};_0x1d1c2d(++_0x146a2c);}(_0x9685,0x8c));var _0x5968=function(_0x42708d,_0x251f79){_0x42708d=_0x42708d-0x0;var _0xcff127=_0x9685[_0x42708d];return _0xcff127;};'use strict';var multer=require('multer');var util=require(_0x5968('0x0'));var path=require(_0x5968('0x1'));var timeout=require('connect-timeout');var express=require(_0x5968('0x2'));var router=express[_0x5968('0x3')]();var fs_extra=require(_0x5968('0x4'));var auth=require(_0x5968('0x5'));var interaction=require(_0x5968('0x6'));var config=require('../../config/environment');var controller=require(_0x5968('0x7'));router['put'](_0x5968('0x8'),auth[_0x5968('0x9')](),controller[_0x5968('0xa')]);router[_0x5968('0xb')](_0x5968('0x8'),auth[_0x5968('0x9')](),controller[_0x5968('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 39b47d9..84c630c 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 _0xae24=['sequelize','STRING'];(function(_0x3381f1,_0x12cc1e){var _0x365d98=function(_0x2d82e6){while(--_0x2d82e6){_0x3381f1['push'](_0x3381f1['shift']());}};_0x365d98(++_0x12cc1e);}(_0xae24,0x182));var _0x4ae2=function(_0x4e2fd7,_0x58b30b){_0x4e2fd7=_0x4e2fd7-0x0;var _0x616b03=_0xae24[_0x4e2fd7];return _0x616b03;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6f47=['TEXT','exports','STRING'];(function(_0x4b619d,_0x5d0687){var _0x20c504=function(_0x291c23){while(--_0x291c23){_0x4b619d['push'](_0x4b619d['shift']());}};_0x20c504(++_0x5d0687);}(_0x6f47,0xc7));var _0x76f4=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x6f47[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1cda681..5c74988 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 _0xdd37=['filter','options','AnalyticCustomReport','include','findAll','rows','show','params','includeAll','find','catch','create','body','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','field','function','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','format','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','toString','SELECT','join','SUM(%s)','COUNT(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','IS\x20NOT\x20NULL','getFields','from','clone','web','fullPath','generate','output','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','runReport','Sequelize','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','save','update','then','get','CustomReports','name','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge'];(function(_0x5aa04c,_0x453a5e){var _0xe2999c=function(_0x5662c2){while(--_0x5662c2){_0x5aa04c['push'](_0x5aa04c['shift']());}};_0xe2999c(++_0x453a5e);}(_0xdd37,0x109));var _0x7dd3=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xdd37[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x7dd3('0x0'));var rimraf=require(_0x7dd3('0x1'));var zipdir=require(_0x7dd3('0x2'));var jsonpatch=require(_0x7dd3('0x3'));var rp=require('request-promise');var moment=require(_0x7dd3('0x4'));var BPromise=require(_0x7dd3('0x5'));var Mustache=require(_0x7dd3('0x6'));var util=require(_0x7dd3('0x7'));var path=require(_0x7dd3('0x8'));var sox=require(_0x7dd3('0x9'));var csv=require(_0x7dd3('0xa'));var ejs=require(_0x7dd3('0xb'));var fs=require('fs');var fs_extra=require(_0x7dd3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7dd3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7dd3('0xe'));var toCsv=require(_0x7dd3('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7dd3('0xf'));var qs=require(_0x7dd3('0x10'));var as=require(_0x7dd3('0x11'));var hardwareService=require(_0x7dd3('0x12'));var logger=require(_0x7dd3('0x13'))(_0x7dd3('0x14'));var utils=require(_0x7dd3('0x15'));var config=require(_0x7dd3('0x16'));var licenseUtil=require(_0x7dd3('0x17'));var db=require(_0x7dd3('0x18'))['db'];var dbH=require(_0x7dd3('0x18'))['dbH'];function respondWithStatusCode(_0x8168f5,_0x58a536){_0x58a536=_0x58a536||0xcc;return function(_0x2a76cd){if(_0x2a76cd){return _0x8168f5[_0x7dd3('0x19')](_0x58a536);}return _0x8168f5[_0x7dd3('0x1a')](_0x58a536)[_0x7dd3('0x1b')]();};}function respondWithResult(_0x12f8e4,_0x4c1b67){_0x4c1b67=_0x4c1b67||0xc8;return function(_0x1643ac){if(_0x1643ac){return _0x12f8e4[_0x7dd3('0x1a')](_0x4c1b67)['json'](_0x1643ac);}};}function respondWithFilteredResult(_0xa1caad,_0x2c29a6){return function(_0x47abe4){if(_0x47abe4){var _0x15b378=typeof _0x2c29a6[_0x7dd3('0x1c')]==='undefined'&&typeof _0x2c29a6['limit']===_0x7dd3('0x1d');var _0x16bc84=_0x47abe4[_0x7dd3('0x1e')];var _0x55428e=_0x15b378?0x0:_0x2c29a6[_0x7dd3('0x1c')];var _0x53d6f1=_0x15b378?_0x47abe4['count']:_0x2c29a6['offset']+_0x2c29a6[_0x7dd3('0x1f')];var _0x30eeac;if(_0x53d6f1>=_0x16bc84){_0x53d6f1=_0x16bc84;_0x30eeac=0xc8;}else{_0x30eeac=0xce;}_0xa1caad[_0x7dd3('0x1a')](_0x30eeac);return _0xa1caad[_0x7dd3('0x20')]('Content-Range',_0x55428e+'-'+_0x53d6f1+'/'+_0x16bc84)['json'](_0x47abe4);}return null;};}function patchUpdates(_0xe9db82){return function(_0x2f1f3c){try{jsonpatch[_0x7dd3('0x21')](_0x2f1f3c,_0xe9db82,!![]);}catch(_0x3d1770){return BPromise['reject'](_0x3d1770);}return _0x2f1f3c[_0x7dd3('0x22')]();};}function saveUpdates(_0x2fb419,_0x37a2b8){return function(_0x4b2643){if(_0x4b2643){return _0x4b2643[_0x7dd3('0x23')](_0x2fb419)[_0x7dd3('0x24')](function(_0x47b1b2){return _0x47b1b2;});}return null;};}function removeEntity(_0x1c59bd,_0x1e6fd4){return function(_0x5d3e79){if(_0x5d3e79){return _0x5d3e79['destroy']()['then'](function(){var _0x325eb6=_0x5d3e79[_0x7dd3('0x25')]({'plain':!![]});var _0x39ebd7=_0x7dd3('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x39ebd7,'resourceId':_0x325eb6['id']}})['then'](function(){return _0x5d3e79;});})[_0x7dd3('0x24')](function(){_0x1c59bd[_0x7dd3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa5b4,_0x4094c2){return function(_0x1e44f9){if(!_0x1e44f9){_0x4aa5b4[_0x7dd3('0x19')](0x194);}return _0x1e44f9;};}function handleError(_0xfeca8e,_0x315233){_0x315233=_0x315233||0x1f4;return function(_0x41784d){logger['error'](_0x41784d['stack']);if(_0x41784d[_0x7dd3('0x27')]){delete _0x41784d['name'];}_0xfeca8e[_0x7dd3('0x1a')](_0x315233)['send'](_0x41784d);};}exports['index']=function(_0x5e19dc,_0x26647b){var _0x4fb695={},_0x43471d={},_0x4dbbe0={'count':0x0,'rows':[]};var _0x9eb73e=_[_0x7dd3('0x28')](db['AnalyticCustomReport'][_0x7dd3('0x29')],function(_0x516675){return{'name':_0x516675['fieldName'],'type':_0x516675[_0x7dd3('0x2a')][_0x7dd3('0x2b')]};});_0x43471d[_0x7dd3('0x2c')]=_['map'](_0x9eb73e,_0x7dd3('0x27'));_0x43471d[_0x7dd3('0x2d')]=_[_0x7dd3('0x2e')](_0x5e19dc[_0x7dd3('0x2d')]);_0x43471d[_0x7dd3('0x2f')]=_['intersection'](_0x43471d[_0x7dd3('0x2c')],_0x43471d['query']);_0x4fb695[_0x7dd3('0x30')]=_[_0x7dd3('0x31')](_0x43471d[_0x7dd3('0x2c')],qs['fields'](_0x5e19dc[_0x7dd3('0x2d')][_0x7dd3('0x32')]));_0x4fb695[_0x7dd3('0x30')]=_0x4fb695['attributes']['length']?_0x4fb695[_0x7dd3('0x30')]:_0x43471d[_0x7dd3('0x2c')];if(!_0x5e19dc[_0x7dd3('0x2d')]['hasOwnProperty'](_0x7dd3('0x33'))){_0x4fb695['limit']=qs[_0x7dd3('0x1f')](_0x5e19dc[_0x7dd3('0x2d')][_0x7dd3('0x1f')]);_0x4fb695[_0x7dd3('0x1c')]=qs[_0x7dd3('0x1c')](_0x5e19dc[_0x7dd3('0x2d')][_0x7dd3('0x1c')]);}_0x4fb695[_0x7dd3('0x34')]=qs[_0x7dd3('0x35')](_0x5e19dc[_0x7dd3('0x2d')][_0x7dd3('0x35')]);_0x4fb695[_0x7dd3('0x36')]=qs['filters'](_[_0x7dd3('0x37')](_0x5e19dc['query'],_0x43471d['filters']),_0x9eb73e);if(_0x5e19dc[_0x7dd3('0x2d')]['filter']){_0x4fb695[_0x7dd3('0x36')]=_[_0x7dd3('0x38')](_0x4fb695[_0x7dd3('0x36')],{'$or':_[_0x7dd3('0x28')](_0x9eb73e,function(_0x1736ff){if(_0x1736ff[_0x7dd3('0x2a')]!=='VIRTUAL'){var _0x3c57ac={};_0x3c57ac[_0x1736ff[_0x7dd3('0x27')]]={'$like':'%'+_0x5e19dc[_0x7dd3('0x2d')][_0x7dd3('0x39')]+'%'};return _0x3c57ac;}})});}_0x4fb695=_[_0x7dd3('0x38')]({},_0x4fb695,_0x5e19dc[_0x7dd3('0x3a')]);var _0x5ef611={'where':_0x4fb695[_0x7dd3('0x36')]};return db[_0x7dd3('0x3b')]['count'](_0x5ef611)['then'](function(_0x4ecbfb){_0x4dbbe0['count']=_0x4ecbfb;if(_0x5e19dc[_0x7dd3('0x2d')]['includeAll']){_0x4fb695[_0x7dd3('0x3c')]=[{'all':!![]}];}return db[_0x7dd3('0x3b')][_0x7dd3('0x3d')](_0x4fb695);})['then'](function(_0x105f81){_0x4dbbe0[_0x7dd3('0x3e')]=_0x105f81;return _0x4dbbe0;})['then'](respondWithFilteredResult(_0x26647b,_0x4fb695))['catch'](handleError(_0x26647b,null));};exports[_0x7dd3('0x3f')]=function(_0x576314,_0x1777d9){var _0x130c5d={'raw':![],'where':{'id':_0x576314[_0x7dd3('0x40')]['id']}},_0x3984b2={};_0x3984b2[_0x7dd3('0x2c')]=_[_0x7dd3('0x2e')](db[_0x7dd3('0x3b')][_0x7dd3('0x29')]);_0x3984b2['query']=_[_0x7dd3('0x2e')](_0x576314[_0x7dd3('0x2d')]);_0x3984b2[_0x7dd3('0x2f')]=_[_0x7dd3('0x31')](_0x3984b2[_0x7dd3('0x2c')],_0x3984b2['query']);_0x130c5d['attributes']=_[_0x7dd3('0x31')](_0x3984b2[_0x7dd3('0x2c')],qs[_0x7dd3('0x32')](_0x576314[_0x7dd3('0x2d')]['fields']));_0x130c5d['attributes']=_0x130c5d['attributes']['length']?_0x130c5d[_0x7dd3('0x30')]:_0x3984b2[_0x7dd3('0x2c')];if(_0x576314[_0x7dd3('0x2d')][_0x7dd3('0x41')]){_0x130c5d[_0x7dd3('0x3c')]=[{'all':!![]}];}_0x130c5d=_[_0x7dd3('0x38')]({},_0x130c5d,_0x576314[_0x7dd3('0x3a')]);return db[_0x7dd3('0x3b')][_0x7dd3('0x42')](_0x130c5d)[_0x7dd3('0x24')](handleEntityNotFound(_0x1777d9,null))['then'](respondWithResult(_0x1777d9,null))[_0x7dd3('0x43')](handleError(_0x1777d9,null));};exports['create']=function(_0x508755,_0x1bb0a4){return db['AnalyticCustomReport'][_0x7dd3('0x44')](_0x508755[_0x7dd3('0x45')],{})[_0x7dd3('0x24')](function(_0xc42ea){var _0x313215=_0x508755['user'][_0x7dd3('0x25')]({'plain':!![]});if(!_0x313215)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x313215[_0x7dd3('0x46')]===_0x7dd3('0x47')){var _0x4ffdcc=_0xc42ea[_0x7dd3('0x25')]({'plain':!![]});var _0x3f4baf=_0x7dd3('0x48');return db[_0x7dd3('0x49')][_0x7dd3('0x42')]({'where':{'name':_0x3f4baf,'userProfileId':_0x313215[_0x7dd3('0x4a')]},'raw':!![]})[_0x7dd3('0x24')](function(_0x315c53){if(_0x315c53&&_0x315c53[_0x7dd3('0x4b')]===0x0){return db[_0x7dd3('0x4c')][_0x7dd3('0x44')]({'name':_0x4ffdcc['name'],'resourceId':_0x4ffdcc['id'],'type':_0x7dd3('0x26'),'sectionId':_0x315c53['id']},{})['then'](function(){return _0xc42ea;});}else{return _0xc42ea;}})[_0x7dd3('0x43')](function(_0x41a53e){logger[_0x7dd3('0x4d')](_0x7dd3('0x4e'),_0x41a53e);throw _0x41a53e;});}return _0xc42ea;})[_0x7dd3('0x24')](respondWithResult(_0x1bb0a4,0xc9))['catch'](handleError(_0x1bb0a4,null));};exports[_0x7dd3('0x23')]=function(_0x1c6e2a,_0x5e3fbb){if(_0x1c6e2a[_0x7dd3('0x45')]['id']){delete _0x1c6e2a[_0x7dd3('0x45')]['id'];}return db[_0x7dd3('0x3b')][_0x7dd3('0x42')]({'where':{'id':_0x1c6e2a['params']['id']}})['then'](handleEntityNotFound(_0x5e3fbb,null))[_0x7dd3('0x24')](saveUpdates(_0x1c6e2a[_0x7dd3('0x45')],null))[_0x7dd3('0x24')](respondWithResult(_0x5e3fbb,null))[_0x7dd3('0x43')](handleError(_0x5e3fbb,null));};exports['destroy']=function(_0x2933f8,_0x27c07a){return db[_0x7dd3('0x3b')]['find']({'where':{'id':_0x2933f8[_0x7dd3('0x40')]['id']}})[_0x7dd3('0x24')](handleEntityNotFound(_0x27c07a,null))[_0x7dd3('0x24')](removeEntity(_0x27c07a,null))[_0x7dd3('0x43')](handleError(_0x27c07a,null));};exports[_0x7dd3('0x4f')]=function(_0x3d9469,_0x2f399c){var _0x3acff5=0xa;var _0x33a84c=['join',_0x7dd3('0x50'),_0x7dd3('0x51'),_0x7dd3('0x52')];var _0x426f43={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7dd3('0x53'),'MAX':_0x7dd3('0x54'),'MIN':_0x7dd3('0x55'),'AVG':_0x7dd3('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7dd3('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34a401={'SEC_TO_TIME':_0x7dd3('0x58'),'DATE':'DATE(%s)','HOUR':_0x7dd3('0x59'),'ROUND':_0x7dd3('0x5a'),'UNIX_TIMESTAMP':_0x7dd3('0x5b')};var _0x621713=function(_0x2ec1d0){return!_[_0x7dd3('0x5c')]([_0x7dd3('0x5d'),'IS\x20NOT\x20NULL',_0x7dd3('0x5e'),_0x7dd3('0x5f')],_0x2ec1d0);};var _0x24cbd3=function(_0x4b4888){if(!_0x4b4888||!_0x4b4888['rules']['length']){return'';}for(var _0x57e6c9='(',_0x139b6b=0x0;_0x139b6b<_0x4b4888[_0x7dd3('0x60')][_0x7dd3('0x61')];_0x139b6b+=0x1){_0x139b6b>0x0&&(_0x57e6c9+='\x20'+_0x4b4888['operator']+'\x20');_0x57e6c9+=_0x4b4888[_0x7dd3('0x60')][_0x139b6b][_0x7dd3('0x62')]?_0x24cbd3(_0x4b4888[_0x7dd3('0x60')][_0x139b6b][_0x7dd3('0x62')]):_0x4b4888[_0x7dd3('0x60')][_0x139b6b]['field']+'\x20'+_0x4b4888[_0x7dd3('0x60')][_0x139b6b][_0x7dd3('0x63')]+(_0x621713(_0x4b4888[_0x7dd3('0x60')][_0x139b6b][_0x7dd3('0x63')])?'\x20'+_0x4b4888['rules'][_0x139b6b][_0x7dd3('0x64')]:'');}return _0x57e6c9+')';};var _0x27db37={'where':{'id':_0x3d9469['params']['id']}},_0x13dd97,_0x57ce20,_0x2a54ad,_0x249e49,_0x2ca749;_0x27db37=_[_0x7dd3('0x38')]({},_0x27db37,_0x3d9469[_0x7dd3('0x3a')]);return db['AnalyticCustomReport'][_0x7dd3('0x42')](_0x27db37)['then'](function(_0x38cf42){if(_0x38cf42){_0x13dd97=_0x38cf42;return _0x38cf42['getFields']();}return null;})['then'](function(_0x2d5a2e){if(_0x2d5a2e){if(!_0x2d5a2e['length']){throw new db['Sequelize'][(_0x7dd3('0x65'))](_0x7dd3('0x66'),0x193);}_0x57ce20=_0x2d5a2e;return db[_0x7dd3('0x67')][_0x7dd3('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x59da97){if(_0x59da97){_0x2a54ad=_[_0x7dd3('0x68')](_0x59da97,'id');var _0x3b9d2e;var _0x404a13=squel[_0x7dd3('0x69')]();_0x404a13['from'](_0x13dd97[_0x7dd3('0x6a')]);for(var _0x1a260f=0x0;_0x1a260f<_0x57ce20['length'];_0x1a260f+=0x1){_0x3b9d2e=_0x57ce20[_0x1a260f][_0x7dd3('0x6b')]?_0x2a54ad[_0x57ce20[_0x1a260f][_0x7dd3('0x6b')]][_0x7dd3('0x6c')]:_0x57ce20[_0x1a260f][_0x7dd3('0x6d')];_0x3b9d2e=_0x57ce20[_0x1a260f][_0x7dd3('0x6e')]?_[_0x7dd3('0x6f')](_0x426f43[_0x57ce20[_0x1a260f][_0x7dd3('0x6e')]],'%s',_0x3b9d2e):_0x3b9d2e;_0x3b9d2e=_0x57ce20[_0x1a260f]['format']?_[_0x7dd3('0x6f')](_0x34a401[_0x57ce20[_0x1a260f]['format']],'%s',_0x3b9d2e):_0x3b9d2e;if(_0x57ce20[_0x1a260f][_0x7dd3('0x70')]){_0x404a13[_0x7dd3('0x62')](_0x3b9d2e);}_0x57ce20[_0x1a260f][_0x7dd3('0x71')]&&_0x404a13[_0x7dd3('0x34')](_0x3b9d2e,_0x57ce20[_0x1a260f][_0x7dd3('0x71')]===_0x7dd3('0x72')?![]:!![]);_0x404a13[_0x7dd3('0x6d')](_0x3b9d2e,_0x57ce20[_0x1a260f][_0x7dd3('0x73')]||_0x3b9d2e);}if(_0x13dd97[_0x7dd3('0x74')]){_0x13dd97[_0x7dd3('0x74')]=JSON[_0x7dd3('0x75')](_0x13dd97[_0x7dd3('0x74')]);for(var _0x45400d=0x0;_0x45400d<_0x13dd97[_0x7dd3('0x74')][_0x7dd3('0x61')];_0x45400d+=0x1){if(_0x13dd97[_0x7dd3('0x74')][_0x45400d]['type']&&_['includes'](_0x33a84c,_0x13dd97[_0x7dd3('0x74')][_0x45400d]['type'])&&_0x13dd97['joins'][_0x45400d][_0x7dd3('0x76')]&&_0x13dd97[_0x7dd3('0x74')][_0x45400d]['foreignTable']&&_0x13dd97[_0x7dd3('0x74')][_0x45400d][_0x7dd3('0x77')]){_0x404a13[_0x13dd97[_0x7dd3('0x74')][_0x45400d][_0x7dd3('0x2a')]](_0x13dd97['joins'][_0x45400d][_0x7dd3('0x78')],null,util[_0x7dd3('0x79')](_0x7dd3('0x7a'),_0x13dd97['table'],_0x13dd97[_0x7dd3('0x74')][_0x45400d]['parentKey'],_0x13dd97[_0x7dd3('0x74')][_0x45400d][_0x7dd3('0x78')],_0x13dd97[_0x7dd3('0x74')][_0x45400d][_0x7dd3('0x77')]));}}}if(_0x13dd97[_0x7dd3('0x7b')]){_0x13dd97[_0x7dd3('0x7b')]=JSON['parse'](_0x13dd97[_0x7dd3('0x7b')]);_0x404a13[_0x7dd3('0x36')](_0x24cbd3(_0x13dd97['conditions']['group']));}_0x2ca749=_0x404a13['clone']();_0x404a13[_0x7dd3('0x1f')](_0x3acff5);_0x404a13[_0x7dd3('0x1c')](0x0);logger[_0x7dd3('0x7c')](_0x7dd3('0x7d'),_0x404a13['toString']());return dbH[_0x7dd3('0x7e')]['query'](_0x404a13[_0x7dd3('0x7f')](),{'type':dbH[_0x7dd3('0x7e')]['QueryTypes'][_0x7dd3('0x80')]});}})[_0x7dd3('0x24')](respondWithResult(_0x2f399c,null))[_0x7dd3('0x43')](handleError(_0x2f399c,null));};function runReport(_0x565800,_0x40f9a3,_0x6ea5fa){var _0x4cdc1f=_0x40f9a3[_0x7dd3('0x27')];var _0xbc018a=0xa;var _0x3d1a0e=[_0x7dd3('0x81'),_0x7dd3('0x50'),_0x7dd3('0x51'),_0x7dd3('0x52')];var _0x53a931={'SUM':_0x7dd3('0x82'),'COUNT':_0x7dd3('0x83'),'COUNT DISTINCT':_0x7dd3('0x53'),'MAX':_0x7dd3('0x54'),'MIN':'MIN(%s)','AVG':_0x7dd3('0x56'),'GROUP_CONCAT':_0x7dd3('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7dd3('0x85')};var _0x1059ea={'SEC_TO_TIME':_0x7dd3('0x58'),'DATE':_0x7dd3('0x86'),'HOUR':_0x7dd3('0x59'),'ROUND':_0x7dd3('0x5a'),'UNIX_TIMESTAMP':_0x7dd3('0x5b')};var _0xcd013e=function(_0x2bbe44){return!_[_0x7dd3('0x5c')](['IS\x20NULL',_0x7dd3('0x87'),'IS\x20EMPTY',_0x7dd3('0x5f')],_0x2bbe44);};var _0xbb3166=function(_0x2feffb){if(!_0x2feffb||!_0x2feffb[_0x7dd3('0x60')][_0x7dd3('0x61')]){return'';}for(var _0x53b2c9='(',_0x2053ea=0x0;_0x2053ea<_0x2feffb['rules'][_0x7dd3('0x61')];_0x2053ea+=0x1){_0x2053ea>0x0&&(_0x53b2c9+='\x20'+_0x2feffb['operator']+'\x20');_0x53b2c9+=_0x2feffb['rules'][_0x2053ea][_0x7dd3('0x62')]?_0xbb3166(_0x2feffb[_0x7dd3('0x60')][_0x2053ea]['group']):_0x2feffb[_0x7dd3('0x60')][_0x2053ea]['field']+'\x20'+_0x2feffb[_0x7dd3('0x60')][_0x2053ea]['condition']+(_0xcd013e(_0x2feffb[_0x7dd3('0x60')][_0x2053ea][_0x7dd3('0x63')])?'\x20'+_0x2feffb['rules'][_0x2053ea][_0x7dd3('0x64')]:'');}return _0x53b2c9+')';};var _0x344236={'where':{'id':_0x565800['id']}},_0xea372f,_0x2dc88a,_0x224cfe,_0x33a828,_0x57c97b;_0x344236=_[_0x7dd3('0x38')]({},_0x344236,_0x6ea5fa);return db[_0x7dd3('0x3b')][_0x7dd3('0x42')](_0x344236)['then'](function(_0x34f144){if(_0x34f144){_0xea372f=_0x34f144;return _0x34f144[_0x7dd3('0x88')]();}return null;})['then'](function(_0x3b5abc){if(_0x3b5abc){if(!_0x3b5abc[_0x7dd3('0x61')]){throw new db['Sequelize'][(_0x7dd3('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2dc88a=_0x3b5abc;return db[_0x7dd3('0x67')][_0x7dd3('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x1e7e48){if(_0x1e7e48){_0x224cfe=_[_0x7dd3('0x68')](_0x1e7e48,'id');var _0x11c7ee;var _0x3cc4e1=squel[_0x7dd3('0x69')]();_0x3cc4e1[_0x7dd3('0x89')](_0xea372f['table']);for(var _0x579ff0=0x0;_0x579ff0<_0x2dc88a[_0x7dd3('0x61')];_0x579ff0+=0x1){_0x11c7ee=_0x2dc88a[_0x579ff0][_0x7dd3('0x6b')]?_0x224cfe[_0x2dc88a[_0x579ff0][_0x7dd3('0x6b')]][_0x7dd3('0x6c')]:_0x2dc88a[_0x579ff0][_0x7dd3('0x6d')];_0x11c7ee=_0x2dc88a[_0x579ff0]['function']?_[_0x7dd3('0x6f')](_0x53a931[_0x2dc88a[_0x579ff0][_0x7dd3('0x6e')]],'%s',_0x11c7ee):_0x11c7ee;_0x11c7ee=_0x2dc88a[_0x579ff0]['format']?_['replace'](_0x1059ea[_0x2dc88a[_0x579ff0][_0x7dd3('0x79')]],'%s',_0x11c7ee):_0x11c7ee;if(_0x2dc88a[_0x579ff0][_0x7dd3('0x70')]){_0x3cc4e1[_0x7dd3('0x62')](_0x11c7ee);}_0x2dc88a[_0x579ff0]['orderBy']&&_0x3cc4e1[_0x7dd3('0x34')](_0x11c7ee,_0x2dc88a[_0x579ff0][_0x7dd3('0x71')]===_0x7dd3('0x72')?![]:!![]);_0x3cc4e1[_0x7dd3('0x6d')](_0x11c7ee,_0x2dc88a[_0x579ff0]['alias']||_0x11c7ee);}if(_0xea372f[_0x7dd3('0x74')]){_0xea372f[_0x7dd3('0x74')]=JSON[_0x7dd3('0x75')](_0xea372f[_0x7dd3('0x74')]);for(var _0x424ce2=0x0;_0x424ce2<_0xea372f['joins'][_0x7dd3('0x61')];_0x424ce2+=0x1){if(_0xea372f[_0x7dd3('0x74')][_0x424ce2]['type']&&_['includes'](_0x3d1a0e,_0xea372f[_0x7dd3('0x74')][_0x424ce2][_0x7dd3('0x2a')])&&_0xea372f[_0x7dd3('0x74')][_0x424ce2][_0x7dd3('0x76')]&&_0xea372f[_0x7dd3('0x74')][_0x424ce2][_0x7dd3('0x78')]&&_0xea372f[_0x7dd3('0x74')][_0x424ce2]['foreignKey']){_0x3cc4e1[_0xea372f[_0x7dd3('0x74')][_0x424ce2][_0x7dd3('0x2a')]](_0xea372f[_0x7dd3('0x74')][_0x424ce2][_0x7dd3('0x78')],null,util[_0x7dd3('0x79')](_0x7dd3('0x7a'),_0xea372f[_0x7dd3('0x6a')],_0xea372f[_0x7dd3('0x74')][_0x424ce2][_0x7dd3('0x76')],_0xea372f['joins'][_0x424ce2][_0x7dd3('0x78')],_0xea372f[_0x7dd3('0x74')][_0x424ce2][_0x7dd3('0x77')]));}}}if(_0xea372f[_0x7dd3('0x7b')]){_0xea372f['conditions']=JSON[_0x7dd3('0x75')](_0xea372f[_0x7dd3('0x7b')]);_0x3cc4e1[_0x7dd3('0x36')](_0xbb3166(_0xea372f['conditions']['group']));}_0x57c97b=_0x3cc4e1[_0x7dd3('0x8a')]();_0x3cc4e1[_0x7dd3('0x1f')](_0xbc018a);_0x3cc4e1[_0x7dd3('0x1c')](0x0);return;}})[_0x7dd3('0x24')](function(){if(_0x40f9a3['output']===_0x7dd3('0x8b')){return null;}var _0x3f9265=_[_0x7dd3('0x38')](_0x40f9a3,{'name':_0x40f9a3[_0x7dd3('0x8c')]||_0x40f9a3[_0x7dd3('0x27')]||_0xea372f[_0x7dd3('0x27')],'basename':_0x4cdc1f,'savename':util[_0x7dd3('0x79')]('%s-%s.%s',_0x40f9a3[_0x7dd3('0x27')]||_0xea372f[_0x7dd3('0x27')],require('randomstring')[_0x7dd3('0x8d')](0x4),_0x40f9a3[_0x7dd3('0x8e')]||_0x7dd3('0x8f')),'reportId':_0xea372f['id'],'reportType':_0x7dd3('0x90')});return db['AnalyticExtractedReport'][_0x7dd3('0x44')](_0x3f9265,{'raw':!![]});})[_0x7dd3('0x24')](function(_0x325e5e){if(_0xea372f[_0x7dd3('0x6a')]===_0x7dd3('0x91')){_0x57c97b[_0x7dd3('0x36')](_0xea372f[_0x7dd3('0x6a')]+_0x7dd3('0x92'),_0x40f9a3['startDate'],_0x40f9a3[_0x7dd3('0x93')]);}else{_0x57c97b['where'](_0xea372f[_0x7dd3('0x6a')]+_0x7dd3('0x94'),_0x40f9a3[_0x7dd3('0x95')],_0x40f9a3['endDate']);}if(_0x325e5e){logger[_0x7dd3('0x96')]('Run\x20Query:',_0x57c97b[_0x7dd3('0x7f')]());require(_0x7dd3('0x97'))[_0x7dd3('0x98')](path[_0x7dd3('0x81')](__dirname,_0x7dd3('0x99'),_0x325e5e[_0x7dd3('0x8e')]),[_0x325e5e['id'],_0x57c97b[_0x7dd3('0x7f')](),path[_0x7dd3('0x81')](__dirname,_0x7dd3('0x9a'),_0x325e5e[_0x7dd3('0x9b')]),_0x4cdc1f]);return _0x325e5e;}else{var _0x541fd2=squel['select']();_0x541fd2[_0x7dd3('0x89')]('('+_0x57c97b['toString']()+')',_0x7dd3('0x9c'));_0x541fd2[_0x7dd3('0x6d')](_0x7dd3('0x9d'),_0x7dd3('0x1e'));_0x57c97b['limit'](_0x40f9a3[_0x7dd3('0x1f')]||_0xbc018a);_0x57c97b[_0x7dd3('0x1c')](_0x40f9a3[_0x7dd3('0x1c')]||0x0);return dbH['sequelize'][_0x7dd3('0x2d')](_0x541fd2[_0x7dd3('0x7f')](),{'type':dbH[_0x7dd3('0x7e')][_0x7dd3('0x9e')][_0x7dd3('0x80')]})[_0x7dd3('0x24')](function(_0x483978){if(!_0x483978[_0x7dd3('0x61')]){_0x33a828=0x0;}else{_0x33a828=_0x483978[0x0][_0x7dd3('0x1e')]||0x0;}return dbH[_0x7dd3('0x7e')][_0x7dd3('0x2d')](_0x57c97b[_0x7dd3('0x7f')](),{'type':dbH[_0x7dd3('0x7e')][_0x7dd3('0x9e')][_0x7dd3('0x80')]});})[_0x7dd3('0x24')](function(_0x46e237){return{'rows':_0x46e237||[],'count':_0x33a828};});}});}exports['run']=function(_0x154c91,_0x4820b3){return runReport(_0x154c91[_0x7dd3('0x40')],_0x154c91['query'],_0x154c91[_0x7dd3('0x3a')])[_0x7dd3('0x24')](respondWithResult(_0x4820b3,null))[_0x7dd3('0x43')](handleError(_0x4820b3,null));};exports[_0x7dd3('0x9f')]=runReport;exports[_0x7dd3('0x2d')]=function(_0x38f646,_0x1c0486){var _0x2387f3=0xa;var _0x4f35ff=['join',_0x7dd3('0x50'),_0x7dd3('0x51'),_0x7dd3('0x52')];var _0x45b2f5={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7dd3('0x53'),'MAX':_0x7dd3('0x54'),'MIN':_0x7dd3('0x55'),'AVG':_0x7dd3('0x56'),'GROUP_CONCAT':_0x7dd3('0x84'),'GROUP_CONCAT ASC':_0x7dd3('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x170496={'SEC_TO_TIME':_0x7dd3('0x58'),'DATE':_0x7dd3('0x86'),'HOUR':_0x7dd3('0x59'),'ROUND':_0x7dd3('0x5a'),'UNIX_TIMESTAMP':_0x7dd3('0x5b')};var _0x141e79=function(_0x524bfd){return!_[_0x7dd3('0x5c')]([_0x7dd3('0x5d'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x7dd3('0x5f')],_0x524bfd);};var _0x466fdc=function(_0x5c95c4){if(!_0x5c95c4||!_0x5c95c4[_0x7dd3('0x60')][_0x7dd3('0x61')]){return'';}for(var _0x36d706='(',_0x3c5dff=0x0;_0x3c5dff<_0x5c95c4[_0x7dd3('0x60')][_0x7dd3('0x61')];_0x3c5dff+=0x1){_0x3c5dff>0x0&&(_0x36d706+='\x20'+_0x5c95c4['operator']+'\x20');_0x36d706+=_0x5c95c4[_0x7dd3('0x60')][_0x3c5dff][_0x7dd3('0x62')]?_0x466fdc(_0x5c95c4[_0x7dd3('0x60')][_0x3c5dff]['group']):_0x5c95c4[_0x7dd3('0x60')][_0x3c5dff][_0x7dd3('0x6d')]+'\x20'+_0x5c95c4['rules'][_0x3c5dff][_0x7dd3('0x63')]+(_0x141e79(_0x5c95c4[_0x7dd3('0x60')][_0x3c5dff][_0x7dd3('0x63')])?'\x20'+_0x5c95c4[_0x7dd3('0x60')][_0x3c5dff]['value']:'');}return _0x36d706+')';};var _0x173785={'where':{'id':_0x38f646['params']['id']}},_0x496631,_0x55e084,_0x571dfc,_0x306062,_0x3e8e3d;_0x173785=_[_0x7dd3('0x38')]({},_0x173785,_0x38f646[_0x7dd3('0x3a')]);return db['AnalyticCustomReport']['find'](_0x173785)[_0x7dd3('0x24')](function(_0x3dde2f){if(_0x3dde2f){_0x496631=_0x3dde2f;return _0x3dde2f[_0x7dd3('0x88')]();}return null;})['then'](function(_0x2e41a3){if(_0x2e41a3){if(!_0x2e41a3['length']){throw new db[(_0x7dd3('0xa0'))]['ValidationErrorItem'](_0x7dd3('0x66'),0x193);}_0x55e084=_0x2e41a3;return db[_0x7dd3('0x67')]['findAll']({'raw':!![]});}return null;})[_0x7dd3('0x24')](function(_0x30f466){if(_0x30f466){_0x571dfc=_[_0x7dd3('0x68')](_0x30f466,'id');var _0x11c79f;var _0x3ac04c=squel[_0x7dd3('0x69')]();_0x3ac04c['from'](_0x496631[_0x7dd3('0x6a')]);for(var _0x584766=0x0;_0x584766<_0x55e084[_0x7dd3('0x61')];_0x584766+=0x1){_0x11c79f=_0x55e084[_0x584766][_0x7dd3('0x6b')]?_0x571dfc[_0x55e084[_0x584766]['MetricId']][_0x7dd3('0x6c')]:_0x55e084[_0x584766]['field'];_0x11c79f=_0x55e084[_0x584766]['function']?_['replace'](_0x45b2f5[_0x55e084[_0x584766]['function']],'%s',_0x11c79f):_0x11c79f;_0x11c79f=_0x55e084[_0x584766]['format']?_[_0x7dd3('0x6f')](_0x170496[_0x55e084[_0x584766][_0x7dd3('0x79')]],'%s',_0x11c79f):_0x11c79f;if(_0x55e084[_0x584766]['groupBy']){_0x3ac04c[_0x7dd3('0x62')](_0x11c79f);}_0x55e084[_0x584766]['orderBy']&&_0x3ac04c[_0x7dd3('0x34')](_0x11c79f,_0x55e084[_0x584766][_0x7dd3('0x71')]==='DESC'?![]:!![]);_0x3ac04c[_0x7dd3('0x6d')](_0x11c79f,_0x55e084[_0x584766]['alias']||_0x11c79f);}if(_0x496631['joins']){_0x496631[_0x7dd3('0x74')]=JSON['parse'](_0x496631[_0x7dd3('0x74')]);for(var _0x58be70=0x0;_0x58be70<_0x496631[_0x7dd3('0x74')][_0x7dd3('0x61')];_0x58be70+=0x1){if(_0x496631[_0x7dd3('0x74')][_0x58be70][_0x7dd3('0x2a')]&&_['includes'](_0x4f35ff,_0x496631[_0x7dd3('0x74')][_0x58be70][_0x7dd3('0x2a')])&&_0x496631[_0x7dd3('0x74')][_0x58be70][_0x7dd3('0x76')]&&_0x496631[_0x7dd3('0x74')][_0x58be70][_0x7dd3('0x78')]&&_0x496631[_0x7dd3('0x74')][_0x58be70][_0x7dd3('0x77')]){_0x3ac04c[_0x496631['joins'][_0x58be70][_0x7dd3('0x2a')]](_0x496631[_0x7dd3('0x74')][_0x58be70][_0x7dd3('0x78')],null,util['format'](_0x7dd3('0x7a'),_0x496631[_0x7dd3('0x6a')],_0x496631[_0x7dd3('0x74')][_0x58be70][_0x7dd3('0x76')],_0x496631[_0x7dd3('0x74')][_0x58be70]['foreignTable'],_0x496631[_0x7dd3('0x74')][_0x58be70][_0x7dd3('0x77')]));}}}if(_0x496631[_0x7dd3('0x7b')]){_0x496631[_0x7dd3('0x7b')]=JSON['parse'](_0x496631[_0x7dd3('0x7b')]);_0x3ac04c[_0x7dd3('0x36')](_0x466fdc(_0x496631['conditions'][_0x7dd3('0x62')]));}_0x3e8e3d=_0x3ac04c[_0x7dd3('0x8a')]();_0x3ac04c[_0x7dd3('0x1f')](_0x2387f3);_0x3ac04c[_0x7dd3('0x1c')](0x0);logger['debug'](_0x7dd3('0x7d'),_0x3ac04c['toString']());return dbH[_0x7dd3('0x7e')]['query'](_0x3ac04c['toString'](),{'type':dbH[_0x7dd3('0x7e')][_0x7dd3('0x9e')]['SELECT']});}})['then'](function(){return{'sql':_0x3e8e3d['toString']()};})[_0x7dd3('0x24')](respondWithResult(_0x1c0486,null))[_0x7dd3('0x43')](handleError(_0x1c0486,null));}; \ No newline at end of file +var _0xc402=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','AnalyticCustomReport','includeAll','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','groupBy','order','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','cross_join','COUNT(DISTINCT\x20%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20EMPTY','keyBy','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','output','savename','COUNT(*)','run','runReport','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x5d0724,_0x461b86){var _0x87f49=function(_0x1b3f9c){while(--_0x1b3f9c){_0x5d0724['push'](_0x5d0724['shift']());}};_0x87f49(++_0x461b86);}(_0xc402,0x1dc));var _0x2c40=function(_0x3b0652,_0x552c3c){_0x3b0652=_0x3b0652-0x0;var _0x15becc=_0xc402[_0x3b0652];return _0x15becc;};'use strict';var emlformat=require(_0x2c40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c40('0x1'));var jsonpatch=require(_0x2c40('0x2'));var rp=require(_0x2c40('0x3'));var moment=require(_0x2c40('0x4'));var BPromise=require(_0x2c40('0x5'));var Mustache=require(_0x2c40('0x6'));var util=require(_0x2c40('0x7'));var path=require(_0x2c40('0x8'));var sox=require(_0x2c40('0x9'));var csv=require(_0x2c40('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c40('0xb'));var _=require(_0x2c40('0xc'));var squel=require(_0x2c40('0xd'));var crypto=require(_0x2c40('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2c40('0xa'));var querystring=require(_0x2c40('0xf'));var Papa=require(_0x2c40('0x10'));var Redis=require(_0x2c40('0x11'));var authService=require(_0x2c40('0x12'));var qs=require(_0x2c40('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c40('0x14'));var logger=require('../../config/logger')(_0x2c40('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2c40('0x16'));var db=require(_0x2c40('0x17'))['db'];var dbH=require(_0x2c40('0x17'))[_0x2c40('0x18')];function respondWithStatusCode(_0x339fcd,_0x3713d9){_0x3713d9=_0x3713d9||0xcc;return function(_0x4366f8){if(_0x4366f8){return _0x339fcd[_0x2c40('0x19')](_0x3713d9);}return _0x339fcd[_0x2c40('0x1a')](_0x3713d9)['end']();};}function respondWithResult(_0x50bdbc,_0x1ff9b8){_0x1ff9b8=_0x1ff9b8||0xc8;return function(_0x3d7917){if(_0x3d7917){return _0x50bdbc[_0x2c40('0x1a')](_0x1ff9b8)[_0x2c40('0x1b')](_0x3d7917);}};}function respondWithFilteredResult(_0x5aee00,_0x291c56){return function(_0x331660){if(_0x331660){var _0x9ef50c=typeof _0x291c56[_0x2c40('0x1c')]===_0x2c40('0x1d')&&typeof _0x291c56[_0x2c40('0x1e')]==='undefined';var _0x2b6852=_0x331660[_0x2c40('0x1f')];var _0x5d9cf7=_0x9ef50c?0x0:_0x291c56['offset'];var _0x1b09ad=_0x9ef50c?_0x331660['count']:_0x291c56[_0x2c40('0x1c')]+_0x291c56[_0x2c40('0x1e')];var _0x489dbb;if(_0x1b09ad>=_0x2b6852){_0x1b09ad=_0x2b6852;_0x489dbb=0xc8;}else{_0x489dbb=0xce;}_0x5aee00[_0x2c40('0x1a')](_0x489dbb);return _0x5aee00[_0x2c40('0x20')](_0x2c40('0x21'),_0x5d9cf7+'-'+_0x1b09ad+'/'+_0x2b6852)[_0x2c40('0x1b')](_0x331660);}return null;};}function patchUpdates(_0x24effd){return function(_0x1a39b4){try{jsonpatch[_0x2c40('0x22')](_0x1a39b4,_0x24effd,!![]);}catch(_0x281ce9){return BPromise[_0x2c40('0x23')](_0x281ce9);}return _0x1a39b4[_0x2c40('0x24')]();};}function saveUpdates(_0xf54667,_0x60f65c){return function(_0x151c1e){if(_0x151c1e){return _0x151c1e[_0x2c40('0x25')](_0xf54667)[_0x2c40('0x26')](function(_0xf0ef2){return _0xf0ef2;});}return null;};}function removeEntity(_0x1b9228,_0x51eaf7){return function(_0x576ce6){if(_0x576ce6){return _0x576ce6[_0x2c40('0x27')]()['then'](function(){var _0x3e8546=_0x576ce6[_0x2c40('0x28')]({'plain':!![]});var _0x28a91b='CustomReports';return db[_0x2c40('0x29')]['destroy']({'where':{'type':_0x28a91b,'resourceId':_0x3e8546['id']}})['then'](function(){return _0x576ce6;});})[_0x2c40('0x26')](function(){_0x1b9228[_0x2c40('0x1a')](0xcc)[_0x2c40('0x2a')]();});}};}function handleEntityNotFound(_0x353049,_0x5c34eb){return function(_0x3b5557){if(!_0x3b5557){_0x353049[_0x2c40('0x19')](0x194);}return _0x3b5557;};}function handleError(_0x20695d,_0x4ea462){_0x4ea462=_0x4ea462||0x1f4;return function(_0x29a985){logger[_0x2c40('0x2b')](_0x29a985[_0x2c40('0x2c')]);if(_0x29a985['name']){delete _0x29a985[_0x2c40('0x2d')];}_0x20695d[_0x2c40('0x1a')](_0x4ea462)['send'](_0x29a985);};}exports[_0x2c40('0x2e')]=function(_0x145faf,_0x3fa9e8){var _0x3a0877={},_0x363129={},_0x5aeae4={'count':0x0,'rows':[]};var _0x1a7ac2=_[_0x2c40('0x2f')](db['AnalyticCustomReport'][_0x2c40('0x30')],function(_0x207520){return{'name':_0x207520['fieldName'],'type':_0x207520[_0x2c40('0x31')]['key']};});_0x363129[_0x2c40('0x32')]=_[_0x2c40('0x2f')](_0x1a7ac2,_0x2c40('0x2d'));_0x363129[_0x2c40('0x33')]=_[_0x2c40('0x34')](_0x145faf[_0x2c40('0x33')]);_0x363129[_0x2c40('0x35')]=_[_0x2c40('0x36')](_0x363129['model'],_0x363129['query']);_0x3a0877[_0x2c40('0x37')]=_[_0x2c40('0x36')](_0x363129[_0x2c40('0x32')],qs[_0x2c40('0x38')](_0x145faf[_0x2c40('0x33')][_0x2c40('0x38')]));_0x3a0877[_0x2c40('0x37')]=_0x3a0877[_0x2c40('0x37')][_0x2c40('0x39')]?_0x3a0877[_0x2c40('0x37')]:_0x363129['model'];if(!_0x145faf['query'][_0x2c40('0x3a')](_0x2c40('0x3b'))){_0x3a0877[_0x2c40('0x1e')]=qs[_0x2c40('0x1e')](_0x145faf[_0x2c40('0x33')][_0x2c40('0x1e')]);_0x3a0877[_0x2c40('0x1c')]=qs[_0x2c40('0x1c')](_0x145faf[_0x2c40('0x33')][_0x2c40('0x1c')]);}_0x3a0877['order']=qs[_0x2c40('0x3c')](_0x145faf[_0x2c40('0x33')][_0x2c40('0x3c')]);_0x3a0877[_0x2c40('0x3d')]=qs[_0x2c40('0x35')](_[_0x2c40('0x3e')](_0x145faf[_0x2c40('0x33')],_0x363129[_0x2c40('0x35')]),_0x1a7ac2);if(_0x145faf[_0x2c40('0x33')][_0x2c40('0x3f')]){_0x3a0877['where']=_[_0x2c40('0x40')](_0x3a0877[_0x2c40('0x3d')],{'$or':_[_0x2c40('0x2f')](_0x1a7ac2,function(_0x25805e){if(_0x25805e[_0x2c40('0x31')]!=='VIRTUAL'){var _0x5ce6ed={};_0x5ce6ed[_0x25805e[_0x2c40('0x2d')]]={'$like':'%'+_0x145faf[_0x2c40('0x33')][_0x2c40('0x3f')]+'%'};return _0x5ce6ed;}})});}_0x3a0877=_[_0x2c40('0x40')]({},_0x3a0877,_0x145faf['options']);var _0x23f956={'where':_0x3a0877[_0x2c40('0x3d')]};return db[_0x2c40('0x41')][_0x2c40('0x1f')](_0x23f956)['then'](function(_0x3f03e2){_0x5aeae4['count']=_0x3f03e2;if(_0x145faf['query'][_0x2c40('0x42')]){_0x3a0877['include']=[{'all':!![]}];}return db[_0x2c40('0x41')][_0x2c40('0x43')](_0x3a0877);})[_0x2c40('0x26')](function(_0x5bb618){_0x5aeae4['rows']=_0x5bb618;return _0x5aeae4;})[_0x2c40('0x26')](respondWithFilteredResult(_0x3fa9e8,_0x3a0877))[_0x2c40('0x44')](handleError(_0x3fa9e8,null));};exports[_0x2c40('0x45')]=function(_0x4d1d4b,_0x2e466c){var _0x504372={'raw':![],'where':{'id':_0x4d1d4b[_0x2c40('0x46')]['id']}},_0x211732={};_0x211732[_0x2c40('0x32')]=_[_0x2c40('0x34')](db['AnalyticCustomReport'][_0x2c40('0x30')]);_0x211732[_0x2c40('0x33')]=_[_0x2c40('0x34')](_0x4d1d4b[_0x2c40('0x33')]);_0x211732['filters']=_[_0x2c40('0x36')](_0x211732[_0x2c40('0x32')],_0x211732['query']);_0x504372[_0x2c40('0x37')]=_[_0x2c40('0x36')](_0x211732[_0x2c40('0x32')],qs['fields'](_0x4d1d4b[_0x2c40('0x33')][_0x2c40('0x38')]));_0x504372['attributes']=_0x504372[_0x2c40('0x37')][_0x2c40('0x39')]?_0x504372[_0x2c40('0x37')]:_0x211732[_0x2c40('0x32')];if(_0x4d1d4b['query'][_0x2c40('0x42')]){_0x504372[_0x2c40('0x47')]=[{'all':!![]}];}_0x504372=_[_0x2c40('0x40')]({},_0x504372,_0x4d1d4b[_0x2c40('0x48')]);return db[_0x2c40('0x41')][_0x2c40('0x49')](_0x504372)[_0x2c40('0x26')](handleEntityNotFound(_0x2e466c,null))[_0x2c40('0x26')](respondWithResult(_0x2e466c,null))[_0x2c40('0x44')](handleError(_0x2e466c,null));};exports['create']=function(_0xc2c6c1,_0x2724a1){return db[_0x2c40('0x41')][_0x2c40('0x4a')](_0xc2c6c1[_0x2c40('0x4b')],{})[_0x2c40('0x26')](function(_0x49e3df){var _0x2bff45=_0xc2c6c1[_0x2c40('0x4c')][_0x2c40('0x28')]({'plain':!![]});if(!_0x2bff45)throw new Error(_0x2c40('0x4d'));if(_0x2bff45[_0x2c40('0x4e')]===_0x2c40('0x4c')){var _0x4b795f=_0x49e3df['get']({'plain':!![]});var _0x4561be='Reports';return db[_0x2c40('0x4f')][_0x2c40('0x49')]({'where':{'name':_0x4561be,'userProfileId':_0x2bff45['userProfileId']},'raw':!![]})[_0x2c40('0x26')](function(_0x3bba0e){if(_0x3bba0e&&_0x3bba0e[_0x2c40('0x50')]===0x0){return db[_0x2c40('0x29')][_0x2c40('0x4a')]({'name':_0x4b795f[_0x2c40('0x2d')],'resourceId':_0x4b795f['id'],'type':_0x2c40('0x51'),'sectionId':_0x3bba0e['id']},{})[_0x2c40('0x26')](function(){return _0x49e3df;});}else{return _0x49e3df;}})[_0x2c40('0x44')](function(_0x269243){logger[_0x2c40('0x2b')](_0x2c40('0x52'),_0x269243);throw _0x269243;});}return _0x49e3df;})['then'](respondWithResult(_0x2724a1,0xc9))[_0x2c40('0x44')](handleError(_0x2724a1,null));};exports[_0x2c40('0x25')]=function(_0x13c1b0,_0x37d4cf){if(_0x13c1b0[_0x2c40('0x4b')]['id']){delete _0x13c1b0['body']['id'];}return db[_0x2c40('0x41')]['find']({'where':{'id':_0x13c1b0[_0x2c40('0x46')]['id']}})[_0x2c40('0x26')](handleEntityNotFound(_0x37d4cf,null))[_0x2c40('0x26')](saveUpdates(_0x13c1b0[_0x2c40('0x4b')],null))['then'](respondWithResult(_0x37d4cf,null))[_0x2c40('0x44')](handleError(_0x37d4cf,null));};exports['destroy']=function(_0x36ad67,_0x4e332f){return db[_0x2c40('0x41')][_0x2c40('0x49')]({'where':{'id':_0x36ad67[_0x2c40('0x46')]['id']}})[_0x2c40('0x26')](handleEntityNotFound(_0x4e332f,null))['then'](removeEntity(_0x4e332f,null))['catch'](handleError(_0x4e332f,null));};exports['preview']=function(_0x4e4471,_0x3fcc4d){var _0x2535ac=0xa;var _0xa6480f=['join','left_join',_0x2c40('0x53'),'cross_join'];var _0x2c8bd3={'SUM':_0x2c40('0x54'),'COUNT':_0x2c40('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2c40('0x56'),'MIN':_0x2c40('0x57'),'AVG':_0x2c40('0x58'),'GROUP_CONCAT':_0x2c40('0x59'),'GROUP_CONCAT ASC':_0x2c40('0x5a'),'GROUP_CONCAT DESC':_0x2c40('0x5b')};var _0x190408={'SEC_TO_TIME':_0x2c40('0x5c'),'DATE':_0x2c40('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2c40('0x5e')};var _0x3db312=function(_0x51aff9){return!_[_0x2c40('0x5f')]([_0x2c40('0x60'),_0x2c40('0x61'),_0x2c40('0x62'),'IS\x20NOT\x20EMPTY'],_0x51aff9);};var _0x5b79b4=function(_0x71fe3d){if(!_0x71fe3d||!_0x71fe3d['rules'][_0x2c40('0x39')]){return'';}for(var _0x535bb9='(',_0x1a7a1c=0x0;_0x1a7a1c<_0x71fe3d['rules'][_0x2c40('0x39')];_0x1a7a1c+=0x1){_0x1a7a1c>0x0&&(_0x535bb9+='\x20'+_0x71fe3d[_0x2c40('0x63')]+'\x20');_0x535bb9+=_0x71fe3d['rules'][_0x1a7a1c]['group']?_0x5b79b4(_0x71fe3d[_0x2c40('0x64')][_0x1a7a1c][_0x2c40('0x65')]):_0x71fe3d[_0x2c40('0x64')][_0x1a7a1c][_0x2c40('0x66')]+'\x20'+_0x71fe3d['rules'][_0x1a7a1c][_0x2c40('0x67')]+(_0x3db312(_0x71fe3d[_0x2c40('0x64')][_0x1a7a1c][_0x2c40('0x67')])?'\x20'+_0x71fe3d[_0x2c40('0x64')][_0x1a7a1c][_0x2c40('0x68')]:'');}return _0x535bb9+')';};var _0x13e6b5={'where':{'id':_0x4e4471[_0x2c40('0x46')]['id']}},_0x15fe55,_0x3c3bee,_0x1f7238,_0x79624c,_0xf49641;_0x13e6b5=_[_0x2c40('0x40')]({},_0x13e6b5,_0x4e4471[_0x2c40('0x48')]);return db[_0x2c40('0x41')]['find'](_0x13e6b5)[_0x2c40('0x26')](function(_0x5c6f97){if(_0x5c6f97){_0x15fe55=_0x5c6f97;return _0x5c6f97[_0x2c40('0x69')]();}return null;})[_0x2c40('0x26')](function(_0x25c64b){if(_0x25c64b){if(!_0x25c64b[_0x2c40('0x39')]){throw new db[(_0x2c40('0x6a'))][(_0x2c40('0x6b'))](_0x2c40('0x6c'),0x193);}_0x3c3bee=_0x25c64b;return db[_0x2c40('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2c40('0x26')](function(_0x6e81bd){if(_0x6e81bd){_0x1f7238=_['keyBy'](_0x6e81bd,'id');var _0x43faac;var _0x4050f9=squel[_0x2c40('0x6e')]();_0x4050f9[_0x2c40('0x6f')](_0x15fe55[_0x2c40('0x70')]);for(var _0x1d4c73=0x0;_0x1d4c73<_0x3c3bee['length'];_0x1d4c73+=0x1){_0x43faac=_0x3c3bee[_0x1d4c73][_0x2c40('0x71')]?_0x1f7238[_0x3c3bee[_0x1d4c73][_0x2c40('0x71')]][_0x2c40('0x72')]:_0x3c3bee[_0x1d4c73]['field'];_0x43faac=_0x3c3bee[_0x1d4c73][_0x2c40('0x73')]?_[_0x2c40('0x74')](_0x2c8bd3[_0x3c3bee[_0x1d4c73][_0x2c40('0x73')]],'%s',_0x43faac):_0x43faac;_0x43faac=_0x3c3bee[_0x1d4c73]['format']?_[_0x2c40('0x74')](_0x190408[_0x3c3bee[_0x1d4c73][_0x2c40('0x75')]],'%s',_0x43faac):_0x43faac;if(_0x3c3bee[_0x1d4c73][_0x2c40('0x76')]){_0x4050f9['group'](_0x43faac);}_0x3c3bee[_0x1d4c73]['orderBy']&&_0x4050f9[_0x2c40('0x77')](_0x43faac,_0x3c3bee[_0x1d4c73][_0x2c40('0x78')]===_0x2c40('0x79')?![]:!![]);_0x4050f9[_0x2c40('0x66')](_0x43faac,_0x3c3bee[_0x1d4c73][_0x2c40('0x7a')]||_0x43faac);}if(_0x15fe55[_0x2c40('0x7b')]){_0x15fe55[_0x2c40('0x7b')]=JSON[_0x2c40('0x7c')](_0x15fe55['joins']);for(var _0x1080b1=0x0;_0x1080b1<_0x15fe55['joins'][_0x2c40('0x39')];_0x1080b1+=0x1){if(_0x15fe55['joins'][_0x1080b1][_0x2c40('0x31')]&&_[_0x2c40('0x5f')](_0xa6480f,_0x15fe55[_0x2c40('0x7b')][_0x1080b1]['type'])&&_0x15fe55[_0x2c40('0x7b')][_0x1080b1][_0x2c40('0x7d')]&&_0x15fe55[_0x2c40('0x7b')][_0x1080b1][_0x2c40('0x7e')]&&_0x15fe55[_0x2c40('0x7b')][_0x1080b1][_0x2c40('0x7f')]){_0x4050f9[_0x15fe55[_0x2c40('0x7b')][_0x1080b1][_0x2c40('0x31')]](_0x15fe55[_0x2c40('0x7b')][_0x1080b1][_0x2c40('0x7e')],null,util[_0x2c40('0x75')](_0x2c40('0x80'),_0x15fe55[_0x2c40('0x70')],_0x15fe55['joins'][_0x1080b1][_0x2c40('0x7d')],_0x15fe55['joins'][_0x1080b1][_0x2c40('0x7e')],_0x15fe55[_0x2c40('0x7b')][_0x1080b1][_0x2c40('0x7f')]));}}}if(_0x15fe55['conditions']){_0x15fe55[_0x2c40('0x81')]=JSON[_0x2c40('0x7c')](_0x15fe55[_0x2c40('0x81')]);_0x4050f9[_0x2c40('0x3d')](_0x5b79b4(_0x15fe55['conditions']['group']));}_0xf49641=_0x4050f9[_0x2c40('0x82')]();_0x4050f9[_0x2c40('0x1e')](_0x2535ac);_0x4050f9[_0x2c40('0x1c')](0x0);logger[_0x2c40('0x83')](_0x2c40('0x84'),_0x4050f9['toString']());return dbH[_0x2c40('0x85')][_0x2c40('0x33')](_0x4050f9[_0x2c40('0x86')](),{'type':dbH['sequelize'][_0x2c40('0x87')][_0x2c40('0x88')]});}})[_0x2c40('0x26')](respondWithResult(_0x3fcc4d,null))[_0x2c40('0x44')](handleError(_0x3fcc4d,null));};function runReport(_0x23e477,_0x1c8109,_0x545d81){var _0x1f8f4d=_0x1c8109['name'];var _0x40681b=0xa;var _0x356d28=[_0x2c40('0x89'),'left_join',_0x2c40('0x53'),_0x2c40('0x8a')];var _0x99daa8={'SUM':_0x2c40('0x54'),'COUNT':_0x2c40('0x55'),'COUNT DISTINCT':_0x2c40('0x8b'),'MAX':_0x2c40('0x56'),'MIN':_0x2c40('0x57'),'AVG':_0x2c40('0x58'),'GROUP_CONCAT':_0x2c40('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2c40('0x5b')};var _0x174a3f={'SEC_TO_TIME':_0x2c40('0x5c'),'DATE':_0x2c40('0x5d'),'HOUR':_0x2c40('0x8c'),'ROUND':_0x2c40('0x8d'),'UNIX_TIMESTAMP':_0x2c40('0x5e')};var _0x19ec78=function(_0x2135e6){return!_[_0x2c40('0x5f')]([_0x2c40('0x60'),'IS\x20NOT\x20NULL',_0x2c40('0x62'),_0x2c40('0x8e')],_0x2135e6);};var _0x10cca6=function(_0x385596){if(!_0x385596||!_0x385596[_0x2c40('0x64')][_0x2c40('0x39')]){return'';}for(var _0x38fec9='(',_0x3c89d5=0x0;_0x3c89d5<_0x385596['rules']['length'];_0x3c89d5+=0x1){_0x3c89d5>0x0&&(_0x38fec9+='\x20'+_0x385596['operator']+'\x20');_0x38fec9+=_0x385596[_0x2c40('0x64')][_0x3c89d5][_0x2c40('0x65')]?_0x10cca6(_0x385596[_0x2c40('0x64')][_0x3c89d5][_0x2c40('0x65')]):_0x385596[_0x2c40('0x64')][_0x3c89d5][_0x2c40('0x66')]+'\x20'+_0x385596[_0x2c40('0x64')][_0x3c89d5][_0x2c40('0x67')]+(_0x19ec78(_0x385596[_0x2c40('0x64')][_0x3c89d5][_0x2c40('0x67')])?'\x20'+_0x385596['rules'][_0x3c89d5][_0x2c40('0x68')]:'');}return _0x38fec9+')';};var _0x23b51d={'where':{'id':_0x23e477['id']}},_0x52ccde,_0xfe3444,_0x366feb,_0x4d0bc7,_0x476d95;_0x23b51d=_['merge']({},_0x23b51d,_0x545d81);return db[_0x2c40('0x41')][_0x2c40('0x49')](_0x23b51d)['then'](function(_0x22f9e5){if(_0x22f9e5){_0x52ccde=_0x22f9e5;return _0x22f9e5[_0x2c40('0x69')]();}return null;})['then'](function(_0x36c0af){if(_0x36c0af){if(!_0x36c0af['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x2c40('0x6c'),0x193);}_0xfe3444=_0x36c0af;return db[_0x2c40('0x6d')][_0x2c40('0x43')]({'raw':!![]});}return null;})['then'](function(_0x4ee62d){if(_0x4ee62d){_0x366feb=_[_0x2c40('0x8f')](_0x4ee62d,'id');var _0x4916b6;var _0x4ac5ee=squel[_0x2c40('0x6e')]();_0x4ac5ee['from'](_0x52ccde[_0x2c40('0x70')]);for(var _0xfed303=0x0;_0xfed303<_0xfe3444[_0x2c40('0x39')];_0xfed303+=0x1){_0x4916b6=_0xfe3444[_0xfed303]['MetricId']?_0x366feb[_0xfe3444[_0xfed303][_0x2c40('0x71')]]['metric']:_0xfe3444[_0xfed303][_0x2c40('0x66')];_0x4916b6=_0xfe3444[_0xfed303]['function']?_['replace'](_0x99daa8[_0xfe3444[_0xfed303][_0x2c40('0x73')]],'%s',_0x4916b6):_0x4916b6;_0x4916b6=_0xfe3444[_0xfed303][_0x2c40('0x75')]?_['replace'](_0x174a3f[_0xfe3444[_0xfed303]['format']],'%s',_0x4916b6):_0x4916b6;if(_0xfe3444[_0xfed303]['groupBy']){_0x4ac5ee[_0x2c40('0x65')](_0x4916b6);}_0xfe3444[_0xfed303][_0x2c40('0x78')]&&_0x4ac5ee[_0x2c40('0x77')](_0x4916b6,_0xfe3444[_0xfed303][_0x2c40('0x78')]===_0x2c40('0x79')?![]:!![]);_0x4ac5ee['field'](_0x4916b6,_0xfe3444[_0xfed303]['alias']||_0x4916b6);}if(_0x52ccde['joins']){_0x52ccde['joins']=JSON[_0x2c40('0x7c')](_0x52ccde[_0x2c40('0x7b')]);for(var _0x542c97=0x0;_0x542c97<_0x52ccde[_0x2c40('0x7b')][_0x2c40('0x39')];_0x542c97+=0x1){if(_0x52ccde[_0x2c40('0x7b')][_0x542c97][_0x2c40('0x31')]&&_[_0x2c40('0x5f')](_0x356d28,_0x52ccde['joins'][_0x542c97][_0x2c40('0x31')])&&_0x52ccde[_0x2c40('0x7b')][_0x542c97][_0x2c40('0x7d')]&&_0x52ccde[_0x2c40('0x7b')][_0x542c97][_0x2c40('0x7e')]&&_0x52ccde[_0x2c40('0x7b')][_0x542c97][_0x2c40('0x7f')]){_0x4ac5ee[_0x52ccde[_0x2c40('0x7b')][_0x542c97][_0x2c40('0x31')]](_0x52ccde[_0x2c40('0x7b')][_0x542c97][_0x2c40('0x7e')],null,util[_0x2c40('0x75')](_0x2c40('0x80'),_0x52ccde[_0x2c40('0x70')],_0x52ccde[_0x2c40('0x7b')][_0x542c97][_0x2c40('0x7d')],_0x52ccde[_0x2c40('0x7b')][_0x542c97]['foreignTable'],_0x52ccde[_0x2c40('0x7b')][_0x542c97]['foreignKey']));}}}if(_0x52ccde['conditions']){_0x52ccde[_0x2c40('0x81')]=JSON[_0x2c40('0x7c')](_0x52ccde[_0x2c40('0x81')]);_0x4ac5ee[_0x2c40('0x3d')](_0x10cca6(_0x52ccde[_0x2c40('0x81')]['group']));}_0x476d95=_0x4ac5ee['clone']();_0x4ac5ee[_0x2c40('0x1e')](_0x40681b);_0x4ac5ee[_0x2c40('0x1c')](0x0);return;}})['then'](function(){if(_0x1c8109['output']===_0x2c40('0x90')){return null;}var _0x3fc9a8=_[_0x2c40('0x40')](_0x1c8109,{'name':_0x1c8109[_0x2c40('0x91')]||_0x1c8109['name']||_0x52ccde[_0x2c40('0x2d')],'basename':_0x1f8f4d,'savename':util[_0x2c40('0x75')](_0x2c40('0x92'),_0x1c8109[_0x2c40('0x2d')]||_0x52ccde[_0x2c40('0x2d')],require('randomstring')[_0x2c40('0x93')](0x4),_0x1c8109['output']||_0x2c40('0x94')),'reportId':_0x52ccde['id'],'reportType':'custom'});return db[_0x2c40('0x95')]['create'](_0x3fc9a8,{'raw':!![]});})[_0x2c40('0x26')](function(_0x1c5bc8){if(_0x52ccde[_0x2c40('0x70')]===_0x2c40('0x96')){_0x476d95[_0x2c40('0x3d')](_0x52ccde[_0x2c40('0x70')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1c8109[_0x2c40('0x97')],_0x1c8109[_0x2c40('0x98')]);}else{_0x476d95['where'](_0x52ccde[_0x2c40('0x70')]+_0x2c40('0x99'),_0x1c8109[_0x2c40('0x97')],_0x1c8109[_0x2c40('0x98')]);}if(_0x1c5bc8){logger['info'](_0x2c40('0x9a'),_0x476d95[_0x2c40('0x86')]());require('child_process')['fork'](path['join'](__dirname,'../../components/export/',_0x1c5bc8[_0x2c40('0x9b')]),[_0x1c5bc8['id'],_0x476d95[_0x2c40('0x86')](),path[_0x2c40('0x89')](__dirname,'../../files/reports',_0x1c5bc8[_0x2c40('0x9c')]),_0x1f8f4d]);return _0x1c5bc8;}else{var _0x54d88b=squel['select']();_0x54d88b[_0x2c40('0x6f')]('('+_0x476d95[_0x2c40('0x86')]()+')','countTable');_0x54d88b[_0x2c40('0x66')](_0x2c40('0x9d'),_0x2c40('0x1f'));_0x476d95[_0x2c40('0x1e')](_0x1c8109[_0x2c40('0x1e')]||_0x40681b);_0x476d95['offset'](_0x1c8109[_0x2c40('0x1c')]||0x0);return dbH['sequelize'][_0x2c40('0x33')](_0x54d88b[_0x2c40('0x86')](),{'type':dbH[_0x2c40('0x85')][_0x2c40('0x87')][_0x2c40('0x88')]})['then'](function(_0x40f91d){if(!_0x40f91d['length']){_0x4d0bc7=0x0;}else{_0x4d0bc7=_0x40f91d[0x0][_0x2c40('0x1f')]||0x0;}return dbH[_0x2c40('0x85')][_0x2c40('0x33')](_0x476d95[_0x2c40('0x86')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x2c40('0x26')](function(_0x279283){return{'rows':_0x279283||[],'count':_0x4d0bc7};});}});}exports[_0x2c40('0x9e')]=function(_0x5f3e08,_0x518192){return runReport(_0x5f3e08[_0x2c40('0x46')],_0x5f3e08[_0x2c40('0x33')],_0x5f3e08['options'])[_0x2c40('0x26')](respondWithResult(_0x518192,null))[_0x2c40('0x44')](handleError(_0x518192,null));};exports[_0x2c40('0x9f')]=runReport;exports['query']=function(_0x2b29fd,_0x3b0618){var _0x115311=0xa;var _0x173ff8=[_0x2c40('0x89'),'left_join',_0x2c40('0x53'),'cross_join'];var _0x45255b={'SUM':'SUM(%s)','COUNT':_0x2c40('0x55'),'COUNT DISTINCT':_0x2c40('0x8b'),'MAX':_0x2c40('0x56'),'MIN':_0x2c40('0x57'),'AVG':_0x2c40('0x58'),'GROUP_CONCAT':_0x2c40('0x59'),'GROUP_CONCAT ASC':_0x2c40('0x5a'),'GROUP_CONCAT DESC':_0x2c40('0x5b')};var _0x35041d={'SEC_TO_TIME':_0x2c40('0x5c'),'DATE':'DATE(%s)','HOUR':_0x2c40('0x8c'),'ROUND':_0x2c40('0x8d'),'UNIX_TIMESTAMP':_0x2c40('0x5e')};var _0x2c0f0d=function(_0x9ef501){return!_[_0x2c40('0x5f')]([_0x2c40('0x60'),'IS\x20NOT\x20NULL',_0x2c40('0x62'),_0x2c40('0x8e')],_0x9ef501);};var _0xb3e825=function(_0x45bc63){if(!_0x45bc63||!_0x45bc63[_0x2c40('0x64')]['length']){return'';}for(var _0x3b03d='(',_0x5af77e=0x0;_0x5af77e<_0x45bc63[_0x2c40('0x64')][_0x2c40('0x39')];_0x5af77e+=0x1){_0x5af77e>0x0&&(_0x3b03d+='\x20'+_0x45bc63[_0x2c40('0x63')]+'\x20');_0x3b03d+=_0x45bc63['rules'][_0x5af77e][_0x2c40('0x65')]?_0xb3e825(_0x45bc63[_0x2c40('0x64')][_0x5af77e]['group']):_0x45bc63['rules'][_0x5af77e][_0x2c40('0x66')]+'\x20'+_0x45bc63[_0x2c40('0x64')][_0x5af77e][_0x2c40('0x67')]+(_0x2c0f0d(_0x45bc63['rules'][_0x5af77e][_0x2c40('0x67')])?'\x20'+_0x45bc63[_0x2c40('0x64')][_0x5af77e][_0x2c40('0x68')]:'');}return _0x3b03d+')';};var _0x5bed6b={'where':{'id':_0x2b29fd[_0x2c40('0x46')]['id']}},_0x22164f,_0x35898a,_0x297d10,_0x3609b2,_0x39156b;_0x5bed6b=_[_0x2c40('0x40')]({},_0x5bed6b,_0x2b29fd[_0x2c40('0x48')]);return db[_0x2c40('0x41')]['find'](_0x5bed6b)[_0x2c40('0x26')](function(_0x3baa01){if(_0x3baa01){_0x22164f=_0x3baa01;return _0x3baa01['getFields']();}return null;})[_0x2c40('0x26')](function(_0x1d124e){if(_0x1d124e){if(!_0x1d124e[_0x2c40('0x39')]){throw new db[(_0x2c40('0x6a'))][(_0x2c40('0x6b'))](_0x2c40('0x6c'),0x193);}_0x35898a=_0x1d124e;return db[_0x2c40('0x6d')][_0x2c40('0x43')]({'raw':!![]});}return null;})['then'](function(_0x5b484a){if(_0x5b484a){_0x297d10=_[_0x2c40('0x8f')](_0x5b484a,'id');var _0x42be29;var _0x33b241=squel[_0x2c40('0x6e')]();_0x33b241[_0x2c40('0x6f')](_0x22164f['table']);for(var _0x4b75fe=0x0;_0x4b75fe<_0x35898a[_0x2c40('0x39')];_0x4b75fe+=0x1){_0x42be29=_0x35898a[_0x4b75fe]['MetricId']?_0x297d10[_0x35898a[_0x4b75fe][_0x2c40('0x71')]][_0x2c40('0x72')]:_0x35898a[_0x4b75fe][_0x2c40('0x66')];_0x42be29=_0x35898a[_0x4b75fe][_0x2c40('0x73')]?_[_0x2c40('0x74')](_0x45255b[_0x35898a[_0x4b75fe][_0x2c40('0x73')]],'%s',_0x42be29):_0x42be29;_0x42be29=_0x35898a[_0x4b75fe][_0x2c40('0x75')]?_['replace'](_0x35041d[_0x35898a[_0x4b75fe][_0x2c40('0x75')]],'%s',_0x42be29):_0x42be29;if(_0x35898a[_0x4b75fe]['groupBy']){_0x33b241[_0x2c40('0x65')](_0x42be29);}_0x35898a[_0x4b75fe]['orderBy']&&_0x33b241[_0x2c40('0x77')](_0x42be29,_0x35898a[_0x4b75fe][_0x2c40('0x78')]===_0x2c40('0x79')?![]:!![]);_0x33b241['field'](_0x42be29,_0x35898a[_0x4b75fe][_0x2c40('0x7a')]||_0x42be29);}if(_0x22164f[_0x2c40('0x7b')]){_0x22164f[_0x2c40('0x7b')]=JSON[_0x2c40('0x7c')](_0x22164f['joins']);for(var _0x4c26e2=0x0;_0x4c26e2<_0x22164f['joins']['length'];_0x4c26e2+=0x1){if(_0x22164f[_0x2c40('0x7b')][_0x4c26e2][_0x2c40('0x31')]&&_[_0x2c40('0x5f')](_0x173ff8,_0x22164f['joins'][_0x4c26e2]['type'])&&_0x22164f[_0x2c40('0x7b')][_0x4c26e2][_0x2c40('0x7d')]&&_0x22164f[_0x2c40('0x7b')][_0x4c26e2][_0x2c40('0x7e')]&&_0x22164f[_0x2c40('0x7b')][_0x4c26e2][_0x2c40('0x7f')]){_0x33b241[_0x22164f['joins'][_0x4c26e2][_0x2c40('0x31')]](_0x22164f['joins'][_0x4c26e2][_0x2c40('0x7e')],null,util[_0x2c40('0x75')](_0x2c40('0x80'),_0x22164f['table'],_0x22164f[_0x2c40('0x7b')][_0x4c26e2][_0x2c40('0x7d')],_0x22164f[_0x2c40('0x7b')][_0x4c26e2][_0x2c40('0x7e')],_0x22164f[_0x2c40('0x7b')][_0x4c26e2][_0x2c40('0x7f')]));}}}if(_0x22164f['conditions']){_0x22164f[_0x2c40('0x81')]=JSON[_0x2c40('0x7c')](_0x22164f[_0x2c40('0x81')]);_0x33b241[_0x2c40('0x3d')](_0xb3e825(_0x22164f[_0x2c40('0x81')][_0x2c40('0x65')]));}_0x39156b=_0x33b241[_0x2c40('0x82')]();_0x33b241[_0x2c40('0x1e')](_0x115311);_0x33b241[_0x2c40('0x1c')](0x0);logger['debug'](_0x2c40('0x84'),_0x33b241[_0x2c40('0x86')]());return dbH[_0x2c40('0x85')]['query'](_0x33b241['toString'](),{'type':dbH[_0x2c40('0x85')]['QueryTypes'][_0x2c40('0x88')]});}})[_0x2c40('0x26')](function(){return{'sql':_0x39156b[_0x2c40('0x86')]()};})[_0x2c40('0x26')](respondWithResult(_0x3b0618,null))['catch'](handleError(_0x3b0618,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5fd2f3e..ef2d18a 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 _0x4e1e=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x463cba,_0xd60dbf){var _0x5f2734=function(_0x526fed){while(--_0x526fed){_0x463cba['push'](_0x463cba['shift']());}};_0x5f2734(++_0xd60dbf);}(_0x4e1e,0x1cb));var _0xe4e1=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x4e1e[_0x311f44];return _0x46f1e6;};'use strict';var _=require(_0xe4e1('0x0'));var util=require(_0xe4e1('0x1'));var logger=require(_0xe4e1('0x2'))('api');var moment=require(_0xe4e1('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4e1('0x4'));var fs=require('fs');var path=require(_0xe4e1('0x5'));var rimraf=require(_0xe4e1('0x6'));var config=require(_0xe4e1('0x7'));var attributes=require(_0xe4e1('0x8'));module[_0xe4e1('0x9')]=function(_0x3c9f9c,_0x110b76){return _0x3c9f9c[_0xe4e1('0xa')](_0xe4e1('0xb'),attributes,{'tableName':_0xe4e1('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12f7=['./analyticCustomReport.attributes','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2ac5b6,_0x101bb4){var _0x50c1ea=function(_0x214224){while(--_0x214224){_0x2ac5b6['push'](_0x2ac5b6['shift']());}};_0x50c1ea(++_0x101bb4);}(_0x12f7,0x10a));var _0x712f=function(_0x5f1d6b,_0x206dab){_0x5f1d6b=_0x5f1d6b-0x0;var _0x47e381=_0x12f7[_0x5f1d6b];return _0x47e381;};'use strict';var _=require(_0x712f('0x0'));var util=require(_0x712f('0x1'));var logger=require(_0x712f('0x2'))(_0x712f('0x3'));var moment=require(_0x712f('0x4'));var BPromise=require(_0x712f('0x5'));var rp=require(_0x712f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x712f('0x7'));var config=require(_0x712f('0x8'));var attributes=require(_0x712f('0x9'));module['exports']=function(_0x42530d,_0x22fb6a){return _0x42530d['define']('AnalyticCustomReport',attributes,{'tableName':_0x712f('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index b281752..607417e 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 _0xa1d1=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x577b29,_0x2fe3aa){var _0x561e18=function(_0x4b7743){while(--_0x4b7743){_0x577b29['push'](_0x577b29['shift']());}};_0x561e18(++_0x2fe3aa);}(_0xa1d1,0x8d));var _0x1a1d=function(_0x5cf8df,_0x378952){_0x5cf8df=_0x5cf8df-0x0;var _0x308625=_0xa1d1[_0x5cf8df];return _0x308625;};'use strict';var _=require(_0x1a1d('0x0'));var util=require(_0x1a1d('0x1'));var moment=require(_0x1a1d('0x2'));var BPromise=require(_0x1a1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a1d('0x4'));var db=require(_0x1a1d('0x5'))['db'];var utils=require(_0x1a1d('0x6'));var logger=require(_0x1a1d('0x7'))(_0x1a1d('0x8'));var config=require(_0x1a1d('0x9'));var jayson=require(_0x1a1d('0xa'));var client=jayson[_0x1a1d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x115610,_0x4d0880,_0x29eeea){return new BPromise(function(_0x3c55b0,_0x349186){return client['request'](_0x115610,_0x29eeea)[_0x1a1d('0xc')](function(_0x1249c2){logger['info'](_0x1a1d('0xd'),_0x4d0880,_0x1a1d('0xe'));logger[_0x1a1d('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4d0880,_0x1a1d('0xe'),JSON['stringify'](_0x1249c2));if(_0x1249c2[_0x1a1d('0x10')]){if(_0x1249c2[_0x1a1d('0x10')]['code']===0x1f4){logger[_0x1a1d('0x10')](_0x1a1d('0xd'),_0x4d0880,_0x1249c2[_0x1a1d('0x10')]['message']);return _0x349186(_0x1249c2['error'][_0x1a1d('0x11')]);}logger[_0x1a1d('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4d0880,_0x1249c2[_0x1a1d('0x10')][_0x1a1d('0x11')]);return _0x3c55b0(_0x1249c2['error'][_0x1a1d('0x11')]);}else{logger['info'](_0x1a1d('0xd'),_0x4d0880,_0x1a1d('0xe'));_0x3c55b0(_0x1249c2[_0x1a1d('0x12')][_0x1a1d('0x11')]);}})[_0x1a1d('0x13')](function(_0x4d975c){logger['error'](_0x1a1d('0xd'),_0x4d0880,_0x4d975c);_0x349186(_0x4d975c);});});} \ No newline at end of file +var _0x98c3=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','AnalyticCustomReport,\x20%s,\x20%s','error','message','info','result','catch'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x98c3,0x18f));var _0x398c=function(_0x43b784,_0x477ceb){_0x43b784=_0x43b784-0x0;var _0x511f61=_0x98c3[_0x43b784];return _0x511f61;};'use strict';var _=require('lodash');var util=require(_0x398c('0x0'));var moment=require(_0x398c('0x1'));var BPromise=require('bluebird');var rs=require(_0x398c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x398c('0x3'))['db'];var utils=require(_0x398c('0x4'));var logger=require('../../config/logger')(_0x398c('0x5'));var config=require(_0x398c('0x6'));var jayson=require(_0x398c('0x7'));var client=jayson[_0x398c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26a075,_0x146e91,_0x4c6d66){return new BPromise(function(_0x2f1a82,_0x530902){return client[_0x398c('0x9')](_0x26a075,_0x4c6d66)['then'](function(_0x5b23b6){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x146e91,_0x398c('0xa'));logger[_0x398c('0xb')](_0x398c('0xc'),_0x146e91,_0x398c('0xa'),JSON[_0x398c('0xd')](_0x5b23b6));if(_0x5b23b6['error']){if(_0x5b23b6['error'][_0x398c('0xe')]===0x1f4){logger['error'](_0x398c('0xf'),_0x146e91,_0x5b23b6[_0x398c('0x10')][_0x398c('0x11')]);return _0x530902(_0x5b23b6[_0x398c('0x10')][_0x398c('0x11')]);}logger[_0x398c('0x10')](_0x398c('0xf'),_0x146e91,_0x5b23b6[_0x398c('0x10')][_0x398c('0x11')]);return _0x2f1a82(_0x5b23b6[_0x398c('0x10')]['message']);}else{logger[_0x398c('0x12')](_0x398c('0xf'),_0x146e91,_0x398c('0xa'));_0x2f1a82(_0x5b23b6[_0x398c('0x13')]['message']);}})[_0x398c('0x14')](function(_0xd32805){logger['error'](_0x398c('0xf'),_0x146e91,_0xd32805);_0x530902(_0xd32805);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index f6f5f42..59e2532 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 _0x45c8=['fs-extra','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','/:id/run','/:id/query','query','put','/:id','delete','multer','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45c8,0x140));var _0x845c=function(_0x5f40f8,_0x4871c9){_0x5f40f8=_0x5f40f8-0x0;var _0x3f3403=_0x45c8[_0x5f40f8];return _0x3f3403;};'use strict';var multer=require(_0x845c('0x0'));var util=require('util');var path=require(_0x845c('0x1'));var timeout=require('connect-timeout');var express=require(_0x845c('0x2'));var router=express[_0x845c('0x3')]();var fs_extra=require(_0x845c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x845c('0x5'));var config=require('../../config/environment');var controller=require(_0x845c('0x6'));router[_0x845c('0x7')]('/',auth[_0x845c('0x8')](),controller[_0x845c('0x9')]);router['get']('/:id',auth[_0x845c('0x8')](),controller[_0x845c('0xa')]);router[_0x845c('0x7')](_0x845c('0xb'),auth['isAuthenticated'](),controller['preview']);router['get'](_0x845c('0xc'),auth[_0x845c('0x8')](),controller['run']);router[_0x845c('0x7')](_0x845c('0xd'),auth['isAuthenticated'](),controller[_0x845c('0xe')]);router['post']('/',auth[_0x845c('0x8')](),controller['create']);router[_0x845c('0xf')](_0x845c('0x10'),auth[_0x845c('0x8')](),controller['update']);router[_0x845c('0x11')](_0x845c('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9709=['query','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run','run','/:id/query'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9709,0xf7));var _0x9970=function(_0x4f3af4,_0x2d048c){_0x4f3af4=_0x4f3af4-0x0;var _0x557e86=_0x9709[_0x4f3af4];return _0x557e86;};'use strict';var multer=require(_0x9970('0x0'));var util=require(_0x9970('0x1'));var path=require('path');var timeout=require(_0x9970('0x2'));var express=require(_0x9970('0x3'));var router=express[_0x9970('0x4')]();var fs_extra=require(_0x9970('0x5'));var auth=require(_0x9970('0x6'));var interaction=require(_0x9970('0x7'));var config=require('../../config/environment');var controller=require(_0x9970('0x8'));router[_0x9970('0x9')]('/',auth[_0x9970('0xa')](),controller[_0x9970('0xb')]);router[_0x9970('0x9')](_0x9970('0xc'),auth[_0x9970('0xa')](),controller['show']);router[_0x9970('0x9')]('/:id/preview',auth[_0x9970('0xa')](),controller[_0x9970('0xd')]);router[_0x9970('0x9')](_0x9970('0xe'),auth[_0x9970('0xa')](),controller[_0x9970('0xf')]);router['get'](_0x9970('0x10'),auth[_0x9970('0xa')](),controller[_0x9970('0x11')]);router[_0x9970('0x12')]('/',auth[_0x9970('0xa')](),controller[_0x9970('0x13')]);router['put']('/:id',auth[_0x9970('0xa')](),controller[_0x9970('0x14')]);router[_0x9970('0x15')](_0x9970('0xc'),auth[_0x9970('0xa')](),controller[_0x9970('0x16')]);module[_0x9970('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 77039dc..d8d2dc2 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['STRING','TEXT','sequelize','exports'];(function(_0x615b9,_0x154b98){var _0x5d6038=function(_0x4805f9){while(--_0x4805f9){_0x615b9['push'](_0x615b9['shift']());}};_0x5d6038(++_0x154b98);}(_0x53ec,0x192));var _0xc53e=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x53ec[_0x22e9fe];return _0x47cd19;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc53e('0x2')]},'parent':{'type':Sequelize[_0xc53e('0x2')]},'table':{'type':Sequelize[_0xc53e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc53e('0x3')]}}; \ No newline at end of file +var _0x326f=['STRING','TEXT','sequelize'];(function(_0x2c30dd,_0xbabadf){var _0x1aa67f=function(_0x23d3df){while(--_0x23d3df){_0x2c30dd['push'](_0x2c30dd['shift']());}};_0x1aa67f(++_0xbabadf);}(_0x326f,0xd1));var _0xf326=function(_0x5bbafd,_0x281420){_0x5bbafd=_0x5bbafd-0x0;var _0x4a2dfb=_0x326f[_0x5bbafd];return _0x4a2dfb;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 48f8ec7..f6181f5 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 _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','SUM(%s)','COUNT(%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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x1389ae,_0x1caf91){var _0x1514d4=function(_0x41bb97){while(--_0x41bb97){_0x1389ae['push'](_0x1389ae['shift']());}};_0x1514d4(++_0x1caf91);}(_0x4819,0xcd));var _0x9481=function(_0x4def98,_0x421f3f){_0x4def98=_0x4def98-0x0;var _0x40f8cc=_0x4819[_0x4def98];return _0x40f8cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file +var _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x1c2243,_0x7d2db0){var _0x1c4556=function(_0x12517a){while(--_0x12517a){_0x1c2243['push'](_0x1c2243['shift']());}};_0x1c4556(++_0x7d2db0);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'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 _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index af1893d..1abf49b 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 _0xfe1e=['./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x213b1f,_0x359b58){var _0x4a2dae=function(_0x355938){while(--_0x355938){_0x213b1f['push'](_0x213b1f['shift']());}};_0x4a2dae(++_0x359b58);}(_0xfe1e,0x1bf));var _0xefe1=function(_0x14632b,_0x541b79){_0x14632b=_0x14632b-0x0;var _0x5bdbbc=_0xfe1e[_0x14632b];return _0x5bdbbc;};'use strict';var _=require(_0xefe1('0x0'));var util=require(_0xefe1('0x1'));var logger=require(_0xefe1('0x2'))(_0xefe1('0x3'));var moment=require(_0xefe1('0x4'));var BPromise=require(_0xefe1('0x5'));var rp=require(_0xefe1('0x6'));var fs=require('fs');var path=require(_0xefe1('0x7'));var rimraf=require(_0xefe1('0x8'));var config=require('../../config/environment');var attributes=require(_0xefe1('0x9'));module['exports']=function(_0x94ccd5,_0x55c816){return _0x94ccd5[_0xefe1('0xa')](_0xefe1('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e8=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x46c786,_0xee423a){var _0x45b68b=function(_0x45ac39){while(--_0x45ac39){_0x46c786['push'](_0x46c786['shift']());}};_0x45b68b(++_0xee423a);}(_0xf2e8,0xaf));var _0x8f2e=function(_0x4a582c,_0x5b116b){_0x4a582c=_0x4a582c-0x0;var _0x55cc83=_0xf2e8[_0x4a582c];return _0x55cc83;};'use strict';var _=require(_0x8f2e('0x0'));var util=require(_0x8f2e('0x1'));var logger=require(_0x8f2e('0x2'))(_0x8f2e('0x3'));var moment=require(_0x8f2e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f2e('0x5'));var config=require(_0x8f2e('0x6'));var attributes=require(_0x8f2e('0x7'));module[_0x8f2e('0x8')]=function(_0xa9f3,_0x4f2b2d){return _0xa9f3[_0x8f2e('0x9')](_0x8f2e('0xa'),attributes,{'tableName':_0x8f2e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 88b5279..f5a1882 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 _0x46c8=['message','AnalyticDefaultReport,\x20%s,\x20%s','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x46c8,0xe7));var _0x846c=function(_0x4726fd,_0xf8419e){_0x4726fd=_0x4726fd-0x0;var _0x95047f=_0x46c8[_0x4726fd];return _0x95047f;};'use strict';var _=require('lodash');var util=require(_0x846c('0x0'));var moment=require(_0x846c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x846c('0x2'));var db=require(_0x846c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x846c('0x4'))(_0x846c('0x5'));var config=require('../../config/environment');var jayson=require(_0x846c('0x6'));var client=jayson[_0x846c('0x7')][_0x846c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b7b3d,_0x3731a0,_0x4afd0f){return new BPromise(function(_0x1490b8,_0xf005c7){return client[_0x846c('0x9')](_0x5b7b3d,_0x4afd0f)[_0x846c('0xa')](function(_0x1aabcc){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3731a0,_0x846c('0xb'));logger['debug'](_0x846c('0xc'),_0x3731a0,'request\x20sent',JSON[_0x846c('0xd')](_0x1aabcc));if(_0x1aabcc[_0x846c('0xe')]){if(_0x1aabcc[_0x846c('0xe')][_0x846c('0xf')]===0x1f4){logger[_0x846c('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3731a0,_0x1aabcc[_0x846c('0xe')][_0x846c('0x10')]);return _0xf005c7(_0x1aabcc['error'][_0x846c('0x10')]);}logger[_0x846c('0xe')](_0x846c('0x11'),_0x3731a0,_0x1aabcc[_0x846c('0xe')][_0x846c('0x10')]);return _0x1490b8(_0x1aabcc[_0x846c('0xe')][_0x846c('0x10')]);}else{logger['info'](_0x846c('0x11'),_0x3731a0,'request\x20sent');_0x1490b8(_0x1aabcc['result'][_0x846c('0x10')]);}})[_0x846c('0x12')](function(_0x26b431){logger['error'](_0x846c('0x11'),_0x3731a0,_0x26b431);_0xf005c7(_0x26b431);});});} \ No newline at end of file +var _0x10c7=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x10c7,0x103));var _0x710c=function(_0x6b1e6a,_0x15f84a){_0x6b1e6a=_0x6b1e6a-0x0;var _0x4e65bc=_0x10c7[_0x6b1e6a];return _0x4e65bc;};'use strict';var _=require(_0x710c('0x0'));var util=require(_0x710c('0x1'));var moment=require(_0x710c('0x2'));var BPromise=require(_0x710c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x710c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x710c('0x5'))(_0x710c('0x6'));var config=require(_0x710c('0x7'));var jayson=require(_0x710c('0x8'));var client=jayson[_0x710c('0x9')][_0x710c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6a4e54,_0x3b62a8,_0x28c4cd){return new BPromise(function(_0x25876c,_0x2fdf3e){return client[_0x710c('0xb')](_0x6a4e54,_0x28c4cd)['then'](function(_0x4fcd3f){logger[_0x710c('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3b62a8,_0x710c('0xd'));logger[_0x710c('0xe')](_0x710c('0xf'),_0x3b62a8,_0x710c('0xd'),JSON['stringify'](_0x4fcd3f));if(_0x4fcd3f[_0x710c('0x10')]){if(_0x4fcd3f[_0x710c('0x10')][_0x710c('0x11')]===0x1f4){logger[_0x710c('0x10')](_0x710c('0x12'),_0x3b62a8,_0x4fcd3f[_0x710c('0x10')]['message']);return _0x2fdf3e(_0x4fcd3f['error']['message']);}logger[_0x710c('0x10')](_0x710c('0x12'),_0x3b62a8,_0x4fcd3f[_0x710c('0x10')][_0x710c('0x13')]);return _0x25876c(_0x4fcd3f['error'][_0x710c('0x13')]);}else{logger['info'](_0x710c('0x12'),_0x3b62a8,'request\x20sent');_0x25876c(_0x4fcd3f[_0x710c('0x14')][_0x710c('0x13')]);}})['catch'](function(_0x7813c8){logger[_0x710c('0x10')](_0x710c('0x12'),_0x3b62a8,_0x7813c8);_0x2fdf3e(_0x7813c8);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index dc8e10a..0f69a5b 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 _0x3cd5=['../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','put','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x293dcf,_0x49bb88){var _0x1460dc=function(_0x1ca62d){while(--_0x1ca62d){_0x293dcf['push'](_0x293dcf['shift']());}};_0x1460dc(++_0x49bb88);}(_0x3cd5,0x1c8));var _0x53cd=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x3cd5[_0x58efa6];return _0x5d643c;};'use strict';var multer=require(_0x53cd('0x0'));var util=require('util');var path=require(_0x53cd('0x1'));var timeout=require('connect-timeout');var express=require(_0x53cd('0x2'));var router=express['Router']();var fs_extra=require(_0x53cd('0x3'));var auth=require(_0x53cd('0x4'));var interaction=require(_0x53cd('0x5'));var config=require(_0x53cd('0x6'));var controller=require(_0x53cd('0x7'));router[_0x53cd('0x8')]('/',auth[_0x53cd('0x9')](),controller[_0x53cd('0xa')]);router[_0x53cd('0x8')](_0x53cd('0xb'),auth[_0x53cd('0x9')](),controller[_0x53cd('0xc')]);router[_0x53cd('0x8')](_0x53cd('0xd'),auth['isAuthenticated'](),controller[_0x53cd('0xe')]);router['get'](_0x53cd('0xf'),auth['isAuthenticated'](),controller[_0x53cd('0x10')]);router[_0x53cd('0x8')]('/:id/query',auth['isAuthenticated'](),controller[_0x53cd('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x53cd('0x12')]('/:id',auth[_0x53cd('0x9')](),controller['update']);router['delete']('/:id',auth[_0x53cd('0x9')](),controller[_0x53cd('0x13')]);module[_0x53cd('0x14')]=router; \ No newline at end of file +var _0x8c1e=['preview','run','/:id/query','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview'];(function(_0x136ae9,_0x1c0239){var _0x2f0262=function(_0xf67bb0){while(--_0xf67bb0){_0x136ae9['push'](_0x136ae9['shift']());}};_0x2f0262(++_0x1c0239);}(_0x8c1e,0x14c));var _0xe8c1=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x8c1e[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe8c1('0x0'));var express=require(_0xe8c1('0x1'));var router=express[_0xe8c1('0x2')]();var fs_extra=require(_0xe8c1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe8c1('0x4'));var config=require(_0xe8c1('0x5'));var controller=require(_0xe8c1('0x6'));router[_0xe8c1('0x7')]('/',auth['isAuthenticated'](),controller[_0xe8c1('0x8')]);router[_0xe8c1('0x7')](_0xe8c1('0x9'),auth[_0xe8c1('0xa')](),controller[_0xe8c1('0xb')]);router[_0xe8c1('0x7')](_0xe8c1('0xc'),auth[_0xe8c1('0xa')](),controller[_0xe8c1('0xd')]);router[_0xe8c1('0x7')]('/:id/run',auth[_0xe8c1('0xa')](),controller[_0xe8c1('0xe')]);router[_0xe8c1('0x7')](_0xe8c1('0xf'),auth[_0xe8c1('0xa')](),controller['query']);router[_0xe8c1('0x10')]('/',auth['isAuthenticated'](),controller[_0xe8c1('0x11')]);router[_0xe8c1('0x12')](_0xe8c1('0x9'),auth['isAuthenticated'](),controller[_0xe8c1('0x13')]);router[_0xe8c1('0x14')](_0xe8c1('0x9'),auth[_0xe8c1('0xa')](),controller[_0xe8c1('0x15')]);module[_0xe8c1('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e0c4388..7d09a84 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 _0x7ee3=['ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','moment','STRING'];(function(_0x311ba7,_0xb36a6f){var _0xc1a63c=function(_0x53b2d8){while(--_0x53b2d8){_0x311ba7['push'](_0x311ba7['shift']());}};_0xc1a63c(++_0xb36a6f);}(_0x7ee3,0x1e2));var _0x37ee=function(_0x473b87,_0x3fb8d3){_0x473b87=_0x473b87-0x0;var _0x41e241=_0x7ee3[_0x473b87];return _0x41e241;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x37ee('0x0'));module['exports']={'name':{'type':Sequelize[_0x37ee('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x37ee('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x37ee('0x2')](_0x37ee('0x3'),_0x37ee('0x4'),_0x37ee('0x5')),'allowNull':![],'defaultValue':_0x37ee('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x37ee('0x6')]},'endDate':{'type':Sequelize[_0x37ee('0x6')]},'status':{'type':Sequelize[_0x37ee('0x1')],'defaultValue':_0x37ee('0x7')},'type':{'type':Sequelize[_0x37ee('0x2')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x37ee('0x8')},'reportId':{'type':Sequelize[_0x37ee('0x9')](0xb)[_0x37ee('0xa')]},'reportType':{'type':Sequelize[_0x37ee('0x1')]}}; \ No newline at end of file +var _0x1dee=['moment','STRING','xlsx','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x304bbb,_0x2a70fc){var _0x1439ea=function(_0x4d247e){while(--_0x4d247e){_0x304bbb['push'](_0x304bbb['shift']());}};_0x1439ea(++_0x2a70fc);}(_0x1dee,0x186));var _0xe1de=function(_0xaa11d9,_0x2ac64b){_0xaa11d9=_0xaa11d9-0x0;var _0x323cb5=_0x1dee[_0xaa11d9];return _0x323cb5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe1de('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xe1de('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf',_0xe1de('0x2')),'allowNull':![],'defaultValue':_0xe1de('0x3')},'savename':{'type':Sequelize[_0xe1de('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe1de('0x4')]},'endDate':{'type':Sequelize[_0xe1de('0x4')]},'status':{'type':Sequelize[_0xe1de('0x1')],'defaultValue':_0xe1de('0x5')},'type':{'type':Sequelize['ENUM'](_0xe1de('0x6'),_0xe1de('0x7')),'allowNull':![],'defaultValue':_0xe1de('0x6')},'reportId':{'type':Sequelize[_0xe1de('0x8')](0xb)[_0xe1de('0x9')]},'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 c4eb0ca..f9a23da 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 _0xa25d=['sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x98a02d,_0x45cd5f){var _0x5d8ca2=function(_0x436893){while(--_0x436893){_0x98a02d['push'](_0x98a02d['shift']());}};_0x5d8ca2(++_0x45cd5f);}(_0xa25d,0x1cc));var _0xda25=function(_0x34882f,_0x601a99){_0x34882f=_0x34882f-0x0;var _0x455929=_0xa25d[_0x34882f];return _0x455929;};'use strict';var emlformat=require(_0xda25('0x0'));var rimraf=require(_0xda25('0x1'));var zipdir=require(_0xda25('0x2'));var jsonpatch=require(_0xda25('0x3'));var rp=require(_0xda25('0x4'));var moment=require(_0xda25('0x5'));var BPromise=require(_0xda25('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda25('0x7'));var _=require(_0xda25('0x8'));var squel=require('squel');var crypto=require(_0xda25('0x9'));var jsforce=require(_0xda25('0xa'));var deskjs=require(_0xda25('0xb'));var toCsv=require(_0xda25('0xc'));var querystring=require(_0xda25('0xd'));var Papa=require(_0xda25('0xe'));var Redis=require(_0xda25('0xf'));var authService=require(_0xda25('0x10'));var qs=require(_0xda25('0x11'));var as=require(_0xda25('0x12'));var hardwareService=require(_0xda25('0x13'));var logger=require(_0xda25('0x14'))(_0xda25('0x15'));var utils=require(_0xda25('0x16'));var config=require(_0xda25('0x17'));var licenseUtil=require(_0xda25('0x18'));var db=require(_0xda25('0x19'))['db'];function respondWithStatusCode(_0x5cf6b4,_0x2db139){_0x2db139=_0x2db139||0xcc;return function(_0x2aec59){if(_0x2aec59){return _0x5cf6b4[_0xda25('0x1a')](_0x2db139);}return _0x5cf6b4[_0xda25('0x1b')](_0x2db139)[_0xda25('0x1c')]();};}function respondWithResult(_0x207f55,_0x3b92ac){_0x3b92ac=_0x3b92ac||0xc8;return function(_0x194889){if(_0x194889){return _0x207f55['status'](_0x3b92ac)[_0xda25('0x1d')](_0x194889);}};}function respondWithFilteredResult(_0x4153bc,_0x457c88){return function(_0x412b7e){if(_0x412b7e){var _0x4a156d=typeof _0x457c88[_0xda25('0x1e')]===_0xda25('0x1f')&&typeof _0x457c88['limit']===_0xda25('0x1f');var _0x1d046e=_0x412b7e[_0xda25('0x20')];var _0x94d4ff=_0x4a156d?0x0:_0x457c88[_0xda25('0x1e')];var _0x4c3312=_0x4a156d?_0x412b7e[_0xda25('0x20')]:_0x457c88[_0xda25('0x1e')]+_0x457c88[_0xda25('0x21')];var _0x3eb7fc;if(_0x4c3312>=_0x1d046e){_0x4c3312=_0x1d046e;_0x3eb7fc=0xc8;}else{_0x3eb7fc=0xce;}_0x4153bc[_0xda25('0x1b')](_0x3eb7fc);return _0x4153bc[_0xda25('0x22')](_0xda25('0x23'),_0x94d4ff+'-'+_0x4c3312+'/'+_0x1d046e)[_0xda25('0x1d')](_0x412b7e);}return null;};}function patchUpdates(_0x12ff0e){return function(_0x309d3e){try{jsonpatch[_0xda25('0x24')](_0x309d3e,_0x12ff0e,!![]);}catch(_0x475318){return BPromise[_0xda25('0x25')](_0x475318);}return _0x309d3e[_0xda25('0x26')]();};}function saveUpdates(_0x3093fb,_0x2fe132){return function(_0x4dcaf6){if(_0x4dcaf6){return _0x4dcaf6[_0xda25('0x27')](_0x3093fb)[_0xda25('0x28')](function(_0x5564c6){return _0x5564c6;});}return null;};}function removeEntity(_0x234ca8,_0x2ecc80){return function(_0x4cbbe9){if(_0x4cbbe9){return _0x4cbbe9[_0xda25('0x29')]()[_0xda25('0x28')](function(){var _0x537c05=_0x4cbbe9[_0xda25('0x2a')]({'plain':!![]});var _0x47fdd5=_0xda25('0x2b');return db['UserProfileResource'][_0xda25('0x29')]({'where':{'type':_0x47fdd5,'resourceId':_0x537c05['id']}})['then'](function(){return _0x4cbbe9;});})['then'](function(){_0x234ca8[_0xda25('0x1b')](0xcc)[_0xda25('0x1c')]();});}};}function handleEntityNotFound(_0x25b840,_0x195c88){return function(_0x38fe4f){if(!_0x38fe4f){_0x25b840[_0xda25('0x1a')](0x194);}return _0x38fe4f;};}function handleError(_0x33a3dc,_0x487444){_0x487444=_0x487444||0x1f4;return function(_0x4cdf89){logger[_0xda25('0x2c')](_0x4cdf89[_0xda25('0x2d')]);if(_0x4cdf89[_0xda25('0x2e')]){delete _0x4cdf89[_0xda25('0x2e')];}_0x33a3dc[_0xda25('0x1b')](_0x487444)['send'](_0x4cdf89);};}exports[_0xda25('0x2f')]=function(_0xa257e9,_0x19642f){var _0x5f45aa={},_0x110a6e={},_0x4c84c8={'count':0x0,'rows':[]};var _0x24a451=_[_0xda25('0x30')](db[_0xda25('0x31')][_0xda25('0x32')],function(_0x51c28a){return{'name':_0x51c28a[_0xda25('0x33')],'type':_0x51c28a[_0xda25('0x34')][_0xda25('0x35')]};});_0x110a6e[_0xda25('0x36')]=_[_0xda25('0x30')](_0x24a451,'name');_0x110a6e[_0xda25('0x37')]=_[_0xda25('0x38')](_0xa257e9[_0xda25('0x37')]);_0x110a6e[_0xda25('0x39')]=_[_0xda25('0x3a')](_0x110a6e[_0xda25('0x36')],_0x110a6e[_0xda25('0x37')]);_0x5f45aa[_0xda25('0x3b')]=_[_0xda25('0x3a')](_0x110a6e[_0xda25('0x36')],qs[_0xda25('0x3c')](_0xa257e9[_0xda25('0x37')][_0xda25('0x3c')]));_0x5f45aa[_0xda25('0x3b')]=_0x5f45aa[_0xda25('0x3b')][_0xda25('0x3d')]?_0x5f45aa[_0xda25('0x3b')]:_0x110a6e[_0xda25('0x36')];if(!_0xa257e9[_0xda25('0x37')][_0xda25('0x3e')](_0xda25('0x3f'))){_0x5f45aa[_0xda25('0x21')]=qs[_0xda25('0x21')](_0xa257e9[_0xda25('0x37')][_0xda25('0x21')]);_0x5f45aa[_0xda25('0x1e')]=qs[_0xda25('0x1e')](_0xa257e9[_0xda25('0x37')][_0xda25('0x1e')]);}_0x5f45aa[_0xda25('0x40')]=qs[_0xda25('0x41')](_0xa257e9['query'][_0xda25('0x41')]);_0x5f45aa['where']=qs[_0xda25('0x39')](_[_0xda25('0x42')](_0xa257e9['query'],_0x110a6e['filters']),_0x24a451);if(_0xa257e9['query'][_0xda25('0x43')]){_0x5f45aa[_0xda25('0x44')]=_['merge'](_0x5f45aa[_0xda25('0x44')],{'$or':_[_0xda25('0x30')](_0x24a451,function(_0x350a3a){if(_0x350a3a[_0xda25('0x34')]!==_0xda25('0x45')){var _0x1f904c={};_0x1f904c[_0x350a3a[_0xda25('0x2e')]]={'$like':'%'+_0xa257e9[_0xda25('0x37')][_0xda25('0x43')]+'%'};return _0x1f904c;}})});}_0x5f45aa=_['merge']({},_0x5f45aa,_0xa257e9[_0xda25('0x46')]);var _0x2d8b5e={'where':_0x5f45aa['where']};return db[_0xda25('0x31')]['count'](_0x2d8b5e)['then'](function(_0x4a8e74){_0x4c84c8[_0xda25('0x20')]=_0x4a8e74;if(_0xa257e9[_0xda25('0x37')][_0xda25('0x47')]){_0x5f45aa['include']=[{'all':!![]}];}return db[_0xda25('0x31')][_0xda25('0x48')](_0x5f45aa);})[_0xda25('0x28')](function(_0x37080a){_0x4c84c8[_0xda25('0x49')]=_0x37080a;return _0x4c84c8;})[_0xda25('0x28')](respondWithFilteredResult(_0x19642f,_0x5f45aa))[_0xda25('0x4a')](handleError(_0x19642f,null));};exports[_0xda25('0x4b')]=function(_0x178b90,_0x46e8c2){var _0x359883={'raw':!![],'where':{'id':_0x178b90[_0xda25('0x4c')]['id']}},_0x50e124={};_0x50e124[_0xda25('0x36')]=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x50e124['query']=_[_0xda25('0x38')](_0x178b90['query']);_0x50e124[_0xda25('0x39')]=_[_0xda25('0x3a')](_0x50e124['model'],_0x50e124[_0xda25('0x37')]);_0x359883[_0xda25('0x3b')]=_[_0xda25('0x3a')](_0x50e124['model'],qs['fields'](_0x178b90[_0xda25('0x37')]['fields']));_0x359883['attributes']=_0x359883[_0xda25('0x3b')][_0xda25('0x3d')]?_0x359883[_0xda25('0x3b')]:_0x50e124[_0xda25('0x36')];if(_0x178b90['query'][_0xda25('0x47')]){_0x359883[_0xda25('0x4d')]=[{'all':!![]}];}_0x359883=_[_0xda25('0x4e')]({},_0x359883,_0x178b90[_0xda25('0x46')]);return db[_0xda25('0x31')]['find'](_0x359883)[_0xda25('0x28')](handleEntityNotFound(_0x46e8c2,null))[_0xda25('0x28')](respondWithResult(_0x46e8c2,null))[_0xda25('0x4a')](handleError(_0x46e8c2,null));};exports[_0xda25('0x4f')]=function(_0x5f329d,_0x31a16d){return db['AnalyticExtractedReport'][_0xda25('0x4f')](_0x5f329d[_0xda25('0x50')],{})[_0xda25('0x28')](function(_0x127917){var _0x1680f3=_0x5f329d[_0xda25('0x51')][_0xda25('0x2a')]({'plain':!![]});if(!_0x1680f3)throw new Error(_0xda25('0x52'));if(_0x1680f3[_0xda25('0x53')]==='user'){var _0x4089e6=_0x127917['get']({'plain':!![]});var _0x8ada84=_0xda25('0x2b');return db[_0xda25('0x54')][_0xda25('0x55')]({'where':{'name':_0x8ada84,'userProfileId':_0x1680f3[_0xda25('0x56')]},'raw':!![]})['then'](function(_0x141814){if(_0x141814&&_0x141814[_0xda25('0x57')]===0x0){return db[_0xda25('0x58')][_0xda25('0x4f')]({'name':_0x4089e6[_0xda25('0x2e')],'resourceId':_0x4089e6['id'],'type':_0x141814[_0xda25('0x2e')],'sectionId':_0x141814['id']},{})[_0xda25('0x28')](function(){return _0x127917;});}else{return _0x127917;}})[_0xda25('0x4a')](function(_0x194455){logger[_0xda25('0x2c')](_0xda25('0x59'),_0x194455);throw _0x194455;});}return _0x127917;})[_0xda25('0x28')](respondWithResult(_0x31a16d,0xc9))[_0xda25('0x4a')](handleError(_0x31a16d,null));};exports['update']=function(_0x53dc99,_0x679b4){if(_0x53dc99[_0xda25('0x50')]['id']){delete _0x53dc99['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x53dc99[_0xda25('0x4c')]['id']}})[_0xda25('0x28')](handleEntityNotFound(_0x679b4,null))[_0xda25('0x28')](saveUpdates(_0x53dc99[_0xda25('0x50')],null))[_0xda25('0x28')](respondWithResult(_0x679b4,null))[_0xda25('0x4a')](handleError(_0x679b4,null));};exports[_0xda25('0x29')]=function(_0x11ab6b,_0x56f573){return db[_0xda25('0x31')][_0xda25('0x55')]({'where':{'id':_0x11ab6b[_0xda25('0x4c')]['id']}})[_0xda25('0x28')](handleEntityNotFound(_0x56f573,null))[_0xda25('0x28')](removeEntity(_0x56f573,null))['catch'](handleError(_0x56f573,null));};exports[_0xda25('0x5a')]=function(_0x5a98cc,_0x455210,_0x5ea74e){return db[_0xda25('0x31')]['find']({'where':{'id':_0x5a98cc['params']['id']},'attributes':[_0xda25('0x2e'),_0xda25('0x5b'),_0xda25('0x5c'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x455210,null))[_0xda25('0x28')](function(_0x3dd87f){if(_0x3dd87f){if(!fs[_0xda25('0x5d')](path[_0xda25('0x5e')](config[_0xda25('0x5f')],_0xda25('0x60'),_0x3dd87f['savename']))){throw new db[(_0xda25('0x61'))][(_0xda25('0x62'))](_0xda25('0x63'));}if(_0x5a98cc['query'][_0xda25('0x64')]){return _0x455210[_0xda25('0x1a')](0xc8);}return _0x455210[_0xda25('0x5a')](path[_0xda25('0x5e')](config['root'],_0xda25('0x60'),_0x3dd87f[_0xda25('0x5c')]),util[_0xda25('0x65')](_0xda25('0x66'),_0x3dd87f[_0xda25('0x5b')]||_0x3dd87f['name'],_0x3dd87f[_0xda25('0x67')][_0xda25('0x68')]()));}})[_0xda25('0x4a')](handleError(_0x455210,null));}; \ No newline at end of file +var _0x5195=['params','create','body','user','get','role','ExtractedReports','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','exists','sendStatus','download','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','UserProfileResource','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','map','merge','options','AnalyticExtractedReport','includeAll','include','findAll','rows','show'];(function(_0x2170ba,_0x3186b1){var _0x312652=function(_0x1d89bc){while(--_0x1d89bc){_0x2170ba['push'](_0x2170ba['shift']());}};_0x312652(++_0x3186b1);}(_0x5195,0x142));var _0x5519=function(_0x867c03,_0x5f532d){_0x867c03=_0x867c03-0x0;var _0x760969=_0x5195[_0x867c03];return _0x760969;};'use strict';var emlformat=require(_0x5519('0x0'));var rimraf=require(_0x5519('0x1'));var zipdir=require(_0x5519('0x2'));var jsonpatch=require(_0x5519('0x3'));var rp=require(_0x5519('0x4'));var moment=require(_0x5519('0x5'));var BPromise=require(_0x5519('0x6'));var Mustache=require(_0x5519('0x7'));var util=require(_0x5519('0x8'));var path=require(_0x5519('0x9'));var sox=require(_0x5519('0xa'));var csv=require(_0x5519('0xb'));var ejs=require(_0x5519('0xc'));var fs=require('fs');var fs_extra=require(_0x5519('0xd'));var _=require(_0x5519('0xe'));var squel=require('squel');var crypto=require(_0x5519('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5519('0x10'));var toCsv=require(_0x5519('0xb'));var querystring=require('querystring');var Papa=require(_0x5519('0x11'));var Redis=require(_0x5519('0x12'));var authService=require(_0x5519('0x13'));var qs=require(_0x5519('0x14'));var as=require(_0x5519('0x15'));var hardwareService=require(_0x5519('0x16'));var logger=require(_0x5519('0x17'))(_0x5519('0x18'));var utils=require('../../config/utils');var config=require(_0x5519('0x19'));var licenseUtil=require(_0x5519('0x1a'));var db=require(_0x5519('0x1b'))['db'];function respondWithStatusCode(_0x367209,_0x48496f){_0x48496f=_0x48496f||0xcc;return function(_0x435fe4){if(_0x435fe4){return _0x367209['sendStatus'](_0x48496f);}return _0x367209[_0x5519('0x1c')](_0x48496f)['end']();};}function respondWithResult(_0x34ab8b,_0x398f1e){_0x398f1e=_0x398f1e||0xc8;return function(_0xc3ad3b){if(_0xc3ad3b){return _0x34ab8b['status'](_0x398f1e)['json'](_0xc3ad3b);}};}function respondWithFilteredResult(_0x380ef0,_0x26d783){return function(_0x3fea5a){if(_0x3fea5a){var _0x58427e=typeof _0x26d783[_0x5519('0x1d')]===_0x5519('0x1e')&&typeof _0x26d783[_0x5519('0x1f')]==='undefined';var _0x340d4d=_0x3fea5a[_0x5519('0x20')];var _0x53d4cf=_0x58427e?0x0:_0x26d783[_0x5519('0x1d')];var _0x284f04=_0x58427e?_0x3fea5a['count']:_0x26d783[_0x5519('0x1d')]+_0x26d783['limit'];var _0x288bc2;if(_0x284f04>=_0x340d4d){_0x284f04=_0x340d4d;_0x288bc2=0xc8;}else{_0x288bc2=0xce;}_0x380ef0['status'](_0x288bc2);return _0x380ef0[_0x5519('0x21')](_0x5519('0x22'),_0x53d4cf+'-'+_0x284f04+'/'+_0x340d4d)[_0x5519('0x23')](_0x3fea5a);}return null;};}function patchUpdates(_0x2a48c2){return function(_0x2d5d73){try{jsonpatch[_0x5519('0x24')](_0x2d5d73,_0x2a48c2,!![]);}catch(_0x33af7b){return BPromise[_0x5519('0x25')](_0x33af7b);}return _0x2d5d73['save']();};}function saveUpdates(_0x1bbb43,_0x71c0ac){return function(_0x3b168e){if(_0x3b168e){return _0x3b168e[_0x5519('0x26')](_0x1bbb43)['then'](function(_0x3d9eb9){return _0x3d9eb9;});}return null;};}function removeEntity(_0x31cf43,_0x3d54d9){return function(_0x4953fb){if(_0x4953fb){return _0x4953fb[_0x5519('0x27')]()[_0x5519('0x28')](function(){var _0x11348e=_0x4953fb['get']({'plain':!![]});var _0x2659d3='ExtractedReports';return db[_0x5519('0x29')][_0x5519('0x27')]({'where':{'type':_0x2659d3,'resourceId':_0x11348e['id']}})[_0x5519('0x28')](function(){return _0x4953fb;});})[_0x5519('0x28')](function(){_0x31cf43[_0x5519('0x1c')](0xcc)[_0x5519('0x2a')]();});}};}function handleEntityNotFound(_0x4e21bb,_0x5477bf){return function(_0x2346b8){if(!_0x2346b8){_0x4e21bb['sendStatus'](0x194);}return _0x2346b8;};}function handleError(_0x1d5312,_0x1f3921){_0x1f3921=_0x1f3921||0x1f4;return function(_0xdf2727){logger['error'](_0xdf2727[_0x5519('0x2b')]);if(_0xdf2727[_0x5519('0x2c')]){delete _0xdf2727[_0x5519('0x2c')];}_0x1d5312['status'](_0x1f3921)[_0x5519('0x2d')](_0xdf2727);};}exports[_0x5519('0x2e')]=function(_0x37276e,_0x414181){var _0x3c2202={},_0x468099={},_0x430882={'count':0x0,'rows':[]};var _0x49982b=_['map'](db['AnalyticExtractedReport'][_0x5519('0x2f')],function(_0x55036a){return{'name':_0x55036a[_0x5519('0x30')],'type':_0x55036a[_0x5519('0x31')][_0x5519('0x32')]};});_0x468099[_0x5519('0x33')]=_['map'](_0x49982b,'name');_0x468099[_0x5519('0x34')]=_[_0x5519('0x35')](_0x37276e[_0x5519('0x34')]);_0x468099[_0x5519('0x36')]=_[_0x5519('0x37')](_0x468099['model'],_0x468099[_0x5519('0x34')]);_0x3c2202[_0x5519('0x38')]=_[_0x5519('0x37')](_0x468099['model'],qs[_0x5519('0x39')](_0x37276e[_0x5519('0x34')][_0x5519('0x39')]));_0x3c2202[_0x5519('0x38')]=_0x3c2202[_0x5519('0x38')][_0x5519('0x3a')]?_0x3c2202[_0x5519('0x38')]:_0x468099[_0x5519('0x33')];if(!_0x37276e[_0x5519('0x34')][_0x5519('0x3b')](_0x5519('0x3c'))){_0x3c2202['limit']=qs[_0x5519('0x1f')](_0x37276e[_0x5519('0x34')]['limit']);_0x3c2202[_0x5519('0x1d')]=qs['offset'](_0x37276e['query'][_0x5519('0x1d')]);}_0x3c2202[_0x5519('0x3d')]=qs['sort'](_0x37276e[_0x5519('0x34')]['sort']);_0x3c2202[_0x5519('0x3e')]=qs[_0x5519('0x36')](_[_0x5519('0x3f')](_0x37276e[_0x5519('0x34')],_0x468099[_0x5519('0x36')]),_0x49982b);if(_0x37276e[_0x5519('0x34')][_0x5519('0x40')]){_0x3c2202['where']=_['merge'](_0x3c2202[_0x5519('0x3e')],{'$or':_[_0x5519('0x41')](_0x49982b,function(_0x124c79){if(_0x124c79[_0x5519('0x31')]!=='VIRTUAL'){var _0x4c8f7e={};_0x4c8f7e[_0x124c79['name']]={'$like':'%'+_0x37276e[_0x5519('0x34')]['filter']+'%'};return _0x4c8f7e;}})});}_0x3c2202=_[_0x5519('0x42')]({},_0x3c2202,_0x37276e[_0x5519('0x43')]);var _0xdfde4={'where':_0x3c2202['where']};return db[_0x5519('0x44')][_0x5519('0x20')](_0xdfde4)[_0x5519('0x28')](function(_0x42e536){_0x430882['count']=_0x42e536;if(_0x37276e['query'][_0x5519('0x45')]){_0x3c2202[_0x5519('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x5519('0x47')](_0x3c2202);})[_0x5519('0x28')](function(_0x3b7993){_0x430882[_0x5519('0x48')]=_0x3b7993;return _0x430882;})[_0x5519('0x28')](respondWithFilteredResult(_0x414181,_0x3c2202))['catch'](handleError(_0x414181,null));};exports[_0x5519('0x49')]=function(_0x144c23,_0x5e9026){var _0x5429ee={'raw':!![],'where':{'id':_0x144c23[_0x5519('0x4a')]['id']}},_0x447748={};_0x447748[_0x5519('0x33')]=_[_0x5519('0x35')](db['AnalyticExtractedReport'][_0x5519('0x2f')]);_0x447748[_0x5519('0x34')]=_[_0x5519('0x35')](_0x144c23[_0x5519('0x34')]);_0x447748[_0x5519('0x36')]=_[_0x5519('0x37')](_0x447748[_0x5519('0x33')],_0x447748[_0x5519('0x34')]);_0x5429ee['attributes']=_['intersection'](_0x447748['model'],qs[_0x5519('0x39')](_0x144c23['query'][_0x5519('0x39')]));_0x5429ee[_0x5519('0x38')]=_0x5429ee['attributes'][_0x5519('0x3a')]?_0x5429ee['attributes']:_0x447748['model'];if(_0x144c23['query'][_0x5519('0x45')]){_0x5429ee[_0x5519('0x46')]=[{'all':!![]}];}_0x5429ee=_['merge']({},_0x5429ee,_0x144c23[_0x5519('0x43')]);return db[_0x5519('0x44')]['find'](_0x5429ee)[_0x5519('0x28')](handleEntityNotFound(_0x5e9026,null))['then'](respondWithResult(_0x5e9026,null))['catch'](handleError(_0x5e9026,null));};exports['create']=function(_0x1eeb69,_0x64ac6a){return db[_0x5519('0x44')][_0x5519('0x4b')](_0x1eeb69[_0x5519('0x4c')],{})[_0x5519('0x28')](function(_0x5e2f3a){var _0x2c547b=_0x1eeb69[_0x5519('0x4d')][_0x5519('0x4e')]({'plain':!![]});if(!_0x2c547b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c547b[_0x5519('0x4f')]===_0x5519('0x4d')){var _0x11682b=_0x5e2f3a['get']({'plain':!![]});var _0x25ae74=_0x5519('0x50');return db['UserProfileSection'][_0x5519('0x51')]({'where':{'name':_0x25ae74,'userProfileId':_0x2c547b[_0x5519('0x52')]},'raw':!![]})[_0x5519('0x28')](function(_0x4d1786){if(_0x4d1786&&_0x4d1786[_0x5519('0x53')]===0x0){return db[_0x5519('0x29')]['create']({'name':_0x11682b[_0x5519('0x2c')],'resourceId':_0x11682b['id'],'type':_0x4d1786[_0x5519('0x2c')],'sectionId':_0x4d1786['id']},{})[_0x5519('0x28')](function(){return _0x5e2f3a;});}else{return _0x5e2f3a;}})[_0x5519('0x54')](function(_0x4408f2){logger['error'](_0x5519('0x55'),_0x4408f2);throw _0x4408f2;});}return _0x5e2f3a;})[_0x5519('0x28')](respondWithResult(_0x64ac6a,0xc9))['catch'](handleError(_0x64ac6a,null));};exports[_0x5519('0x26')]=function(_0xea04a5,_0x3b8665){if(_0xea04a5[_0x5519('0x4c')]['id']){delete _0xea04a5[_0x5519('0x4c')]['id'];}return db[_0x5519('0x44')][_0x5519('0x51')]({'where':{'id':_0xea04a5[_0x5519('0x4a')]['id']}})[_0x5519('0x28')](handleEntityNotFound(_0x3b8665,null))['then'](saveUpdates(_0xea04a5['body'],null))[_0x5519('0x28')](respondWithResult(_0x3b8665,null))['catch'](handleError(_0x3b8665,null));};exports[_0x5519('0x27')]=function(_0x3139ea,_0x579ecb){return db[_0x5519('0x44')][_0x5519('0x51')]({'where':{'id':_0x3139ea['params']['id']}})[_0x5519('0x28')](handleEntityNotFound(_0x579ecb,null))['then'](removeEntity(_0x579ecb,null))[_0x5519('0x54')](handleError(_0x579ecb,null));};exports['download']=function(_0x1b8187,_0x291aa2,_0x293d4c){return db['AnalyticExtractedReport'][_0x5519('0x51')]({'where':{'id':_0x1b8187[_0x5519('0x4a')]['id']},'attributes':['name',_0x5519('0x56'),'savename',_0x5519('0x57')],'raw':!![]})[_0x5519('0x28')](handleEntityNotFound(_0x291aa2,null))['then'](function(_0xebdf0f){if(_0xebdf0f){if(!fs[_0x5519('0x58')](path[_0x5519('0x59')](config[_0x5519('0x5a')],_0x5519('0x5b'),_0xebdf0f[_0x5519('0x5c')]))){throw new db[(_0x5519('0x5d'))][(_0x5519('0x5e'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x1b8187[_0x5519('0x34')][_0x5519('0x5f')]){return _0x291aa2[_0x5519('0x60')](0xc8);}return _0x291aa2[_0x5519('0x61')](path[_0x5519('0x59')](config[_0x5519('0x5a')],_0x5519('0x5b'),_0xebdf0f[_0x5519('0x5c')]),util['format'](_0x5519('0x62'),_0xebdf0f[_0x5519('0x56')]||_0xebdf0f[_0x5519('0x2c')],_0xebdf0f[_0x5519('0x57')]['toLowerCase']()));}})[_0x5519('0x54')](handleError(_0x291aa2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9140197..24fb81f 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 _0x1e1d=['define','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x4746fb,_0x3c530a){var _0x3ff7ec=function(_0x5c5cef){while(--_0x5c5cef){_0x4746fb['push'](_0x4746fb['shift']());}};_0x3ff7ec(++_0x3c530a);}(_0x1e1d,0x11a));var _0xd1e1=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x1e1d[_0x411017];return _0x2adeea;};'use strict';var _=require(_0xd1e1('0x0'));var util=require(_0xd1e1('0x1'));var logger=require(_0xd1e1('0x2'))(_0xd1e1('0x3'));var moment=require(_0xd1e1('0x4'));var BPromise=require(_0xd1e1('0x5'));var rp=require(_0xd1e1('0x6'));var fs=require('fs');var path=require(_0xd1e1('0x7'));var rimraf=require(_0xd1e1('0x8'));var config=require(_0xd1e1('0x9'));var attributes=require(_0xd1e1('0xa'));module[_0xd1e1('0xb')]=function(_0x1faca0,_0xc2ee14){return _0x1faca0[_0xd1e1('0xc')](_0xd1e1('0xd'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1366=['api','moment','bluebird','path','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x1366,0x1ab));var _0x6136=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1366[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6136('0x0'));var util=require(_0x6136('0x1'));var logger=require('../../config/logger')(_0x6136('0x2'));var moment=require(_0x6136('0x3'));var BPromise=require(_0x6136('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6136('0x5'));var rimraf=require('rimraf');var config=require(_0x6136('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x6136('0x7')]=function(_0x30fd42,_0x2703b9){return _0x30fd42[_0x6136('0x8')](_0x6136('0x9'),attributes,{'tableName':_0x6136('0xa'),'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 9826662..e37e485 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 _0xccfe=['jayson/promise','client','http','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xccfe,0x186));var _0xeccf=function(_0x5cbeae,_0x391ad3){_0x5cbeae=_0x5cbeae-0x0;var _0x4c9cfa=_0xccfe[_0x5cbeae];return _0x4c9cfa;};'use strict';var _=require(_0xeccf('0x0'));var util=require(_0xeccf('0x1'));var moment=require(_0xeccf('0x2'));var BPromise=require(_0xeccf('0x3'));var rs=require(_0xeccf('0x4'));var fs=require('fs');var Redis=require(_0xeccf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeccf('0x6'));var logger=require(_0xeccf('0x7'))('rpc');var config=require(_0xeccf('0x8'));var jayson=require(_0xeccf('0x9'));var client=jayson[_0xeccf('0xa')][_0xeccf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aa916,_0x5237c3,_0x176da2){return new BPromise(function(_0x55ead3,_0x158f1f){return client['request'](_0x2aa916,_0x176da2)['then'](function(_0x20b4c1){logger['info'](_0xeccf('0xc'),_0x5237c3,'request\x20sent');logger[_0xeccf('0xd')](_0xeccf('0xe'),_0x5237c3,_0xeccf('0xf'),JSON[_0xeccf('0x10')](_0x20b4c1));if(_0x20b4c1['error']){if(_0x20b4c1['error'][_0xeccf('0x11')]===0x1f4){logger[_0xeccf('0x12')](_0xeccf('0xc'),_0x5237c3,_0x20b4c1[_0xeccf('0x12')][_0xeccf('0x13')]);return _0x158f1f(_0x20b4c1[_0xeccf('0x12')][_0xeccf('0x13')]);}logger[_0xeccf('0x12')](_0xeccf('0xc'),_0x5237c3,_0x20b4c1['error']['message']);return _0x55ead3(_0x20b4c1[_0xeccf('0x12')][_0xeccf('0x13')]);}else{logger['info'](_0xeccf('0xc'),_0x5237c3,_0xeccf('0xf'));_0x55ead3(_0x20b4c1['result'][_0xeccf('0x13')]);}})[_0xeccf('0x14')](function(_0x8440a6){logger[_0xeccf('0x12')](_0xeccf('0xc'),_0x5237c3,_0x8440a6);_0x158f1f(_0x8440a6);});});} \ No newline at end of file +var _0x4784=['client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x7c80d,_0xef5ac5){var _0x3c2bc7=function(_0x4cb002){while(--_0x4cb002){_0x7c80d['push'](_0x7c80d['shift']());}};_0x3c2bc7(++_0xef5ac5);}(_0x4784,0x1ee));var _0x4478=function(_0xc22c7c,_0x350d46){_0xc22c7c=_0xc22c7c-0x0;var _0x1204cb=_0x4784[_0xc22c7c];return _0x1204cb;};'use strict';var _=require(_0x4478('0x0'));var util=require(_0x4478('0x1'));var moment=require(_0x4478('0x2'));var BPromise=require(_0x4478('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4478('0x4'));var db=require(_0x4478('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4478('0x6'))(_0x4478('0x7'));var config=require(_0x4478('0x8'));var jayson=require(_0x4478('0x9'));var client=jayson[_0x4478('0xa')][_0x4478('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x886c69,_0x2b5fde,_0x1f889e){return new BPromise(function(_0x3851fd,_0x13150e){return client[_0x4478('0xc')](_0x886c69,_0x1f889e)[_0x4478('0xd')](function(_0x38a678){logger[_0x4478('0xe')](_0x4478('0xf'),_0x2b5fde,'request\x20sent');logger[_0x4478('0x10')](_0x4478('0x11'),_0x2b5fde,'request\x20sent',JSON[_0x4478('0x12')](_0x38a678));if(_0x38a678[_0x4478('0x13')]){if(_0x38a678[_0x4478('0x13')][_0x4478('0x14')]===0x1f4){logger[_0x4478('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2b5fde,_0x38a678[_0x4478('0x13')][_0x4478('0x15')]);return _0x13150e(_0x38a678[_0x4478('0x13')][_0x4478('0x15')]);}logger[_0x4478('0x13')](_0x4478('0xf'),_0x2b5fde,_0x38a678[_0x4478('0x13')][_0x4478('0x15')]);return _0x3851fd(_0x38a678[_0x4478('0x13')]['message']);}else{logger[_0x4478('0xe')](_0x4478('0xf'),_0x2b5fde,'request\x20sent');_0x3851fd(_0x38a678[_0x4478('0x16')]['message']);}})[_0x4478('0x17')](function(_0xa88981){logger[_0x4478('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2b5fde,_0xa88981);_0x13150e(_0xa88981);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 7857667..07627de 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 _0x6249=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index','get','show','/:id/download','download','post','put'];(function(_0x32e38e,_0x34d0e8){var _0x38de02=function(_0x1c0c26){while(--_0x1c0c26){_0x32e38e['push'](_0x32e38e['shift']());}};_0x38de02(++_0x34d0e8);}(_0x6249,0x107));var _0x9624=function(_0x2e8c7c,_0xee1eee){_0x2e8c7c=_0x2e8c7c-0x0;var _0x46b58e=_0x6249[_0x2e8c7c];return _0x46b58e;};'use strict';var multer=require(_0x9624('0x0'));var util=require(_0x9624('0x1'));var path=require(_0x9624('0x2'));var timeout=require(_0x9624('0x3'));var express=require(_0x9624('0x4'));var router=express[_0x9624('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9624('0x6'));var interaction=require(_0x9624('0x7'));var config=require('../../config/environment');var controller=require(_0x9624('0x8'));router['get']('/',auth[_0x9624('0x9')](),controller[_0x9624('0xa')]);router[_0x9624('0xb')]('/:id',auth[_0x9624('0x9')](),controller[_0x9624('0xc')]);router[_0x9624('0xb')](_0x9624('0xd'),auth['isAuthenticated'](),controller[_0x9624('0xe')]);router[_0x9624('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9624('0x10')]('/:id',auth[_0x9624('0x9')](),controller[_0x9624('0x11')]);router[_0x9624('0x12')]('/:id',auth[_0x9624('0x9')](),controller[_0x9624('0x13')]);module['exports']=router; \ No newline at end of file +var _0xba3a=['fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','put','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x59de9a,_0xb41e63){var _0x2b3691=function(_0x280ff6){while(--_0x280ff6){_0x59de9a['push'](_0x59de9a['shift']());}};_0x2b3691(++_0xb41e63);}(_0xba3a,0x164));var _0xaba3=function(_0x430b22,_0x36200b){_0x430b22=_0x430b22-0x0;var _0x50d4e1=_0xba3a[_0x430b22];return _0x50d4e1;};'use strict';var multer=require(_0xaba3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaba3('0x1'));var express=require(_0xaba3('0x2'));var router=express[_0xaba3('0x3')]();var fs_extra=require(_0xaba3('0x4'));var auth=require(_0xaba3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaba3('0x6'));var controller=require(_0xaba3('0x7'));router[_0xaba3('0x8')]('/',auth['isAuthenticated'](),controller[_0xaba3('0x9')]);router[_0xaba3('0x8')](_0xaba3('0xa'),auth[_0xaba3('0xb')](),controller[_0xaba3('0xc')]);router[_0xaba3('0x8')](_0xaba3('0xd'),auth['isAuthenticated'](),controller[_0xaba3('0xe')]);router[_0xaba3('0xf')]('/',auth[_0xaba3('0xb')](),controller['create']);router[_0xaba3('0x10')]('/:id',auth[_0xaba3('0xb')](),controller['update']);router[_0xaba3('0x11')](_0xaba3('0xa'),auth[_0xaba3('0xb')](),controller[_0xaba3('0x12')]);module[_0xaba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e7669fa..bea2f47 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 _0x13f2=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x23bea4,_0x38a38){var _0xb54789=function(_0x2a5608){while(--_0x2a5608){_0x23bea4['push'](_0x23bea4['shift']());}};_0xb54789(++_0x38a38);}(_0x13f2,0x132));var _0x213f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13f2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x213f('0x0'));module[_0x213f('0x1')]={'field':{'type':Sequelize[_0x213f('0x2')]},'alias':{'type':Sequelize[_0x213f('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x213f('0x3')]},'groupBy':{'type':Sequelize[_0x213f('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x213f('0x3')]},'custom':{'type':Sequelize[_0x213f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc62b=['STRING','BOOLEAN','exports','TEXT'];(function(_0xbd1313,_0x44278c){var _0x3fde85=function(_0x228855){while(--_0x228855){_0xbd1313['push'](_0xbd1313['shift']());}};_0x3fde85(++_0x44278c);}(_0xc62b,0xda));var _0xbc62=function(_0x208fbc,_0x313285){_0x208fbc=_0x208fbc-0x0;var _0x4e8e10=_0xc62b[_0x208fbc];return _0x4e8e10;};'use strict';var Sequelize=require('sequelize');module[_0xbc62('0x0')]={'field':{'type':Sequelize[_0xbc62('0x1')]},'alias':{'type':Sequelize[_0xbc62('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xbc62('0x2')]},'groupBy':{'type':Sequelize[_0xbc62('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xbc62('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 d29b967..af6fdc1 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 _0x2125=['ids','addFields','AnalyticCustomReport','sequelize','transaction','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','save','update','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','show','params','AnalyticFieldReport','find','catch','create','body','bulkCreate'];(function(_0x3f823a,_0x29330a){var _0x440e40=function(_0x317e5f){while(--_0x317e5f){_0x3f823a['push'](_0x3f823a['shift']());}};_0x440e40(++_0x29330a);}(_0x2125,0x181));var _0x5212=function(_0x1560ca,_0x382325){_0x1560ca=_0x1560ca-0x0;var _0x460a22=_0x2125[_0x1560ca];return _0x460a22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5212('0x0'));var zipdir=require(_0x5212('0x1'));var jsonpatch=require(_0x5212('0x2'));var rp=require('request-promise');var moment=require(_0x5212('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5212('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5212('0x5'));var csv=require(_0x5212('0x6'));var ejs=require(_0x5212('0x7'));var fs=require('fs');var fs_extra=require(_0x5212('0x8'));var _=require('lodash');var squel=require(_0x5212('0x9'));var crypto=require(_0x5212('0xa'));var jsforce=require(_0x5212('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5212('0x6'));var querystring=require(_0x5212('0xc'));var Papa=require(_0x5212('0xd'));var Redis=require('ioredis');var authService=require(_0x5212('0xe'));var qs=require(_0x5212('0xf'));var as=require(_0x5212('0x10'));var hardwareService=require(_0x5212('0x11'));var logger=require(_0x5212('0x12'))(_0x5212('0x13'));var utils=require(_0x5212('0x14'));var config=require(_0x5212('0x15'));var licenseUtil=require(_0x5212('0x16'));var db=require(_0x5212('0x17'))['db'];function respondWithStatusCode(_0x211da1,_0x3eb126){_0x3eb126=_0x3eb126||0xcc;return function(_0x5a0c90){if(_0x5a0c90){return _0x211da1[_0x5212('0x18')](_0x3eb126);}return _0x211da1[_0x5212('0x19')](_0x3eb126)['end']();};}function respondWithResult(_0x19ad62,_0x31058e){_0x31058e=_0x31058e||0xc8;return function(_0x4ac7cf){if(_0x4ac7cf){return _0x19ad62[_0x5212('0x19')](_0x31058e)['json'](_0x4ac7cf);}};}function respondWithFilteredResult(_0x10255d,_0x371910){return function(_0x108462){if(_0x108462){var _0x1737c1=typeof _0x371910[_0x5212('0x1a')]===_0x5212('0x1b')&&typeof _0x371910[_0x5212('0x1c')]===_0x5212('0x1b');var _0x3d36e5=_0x108462[_0x5212('0x1d')];var _0x4794a8=_0x1737c1?0x0:_0x371910[_0x5212('0x1a')];var _0x1cadb9=_0x1737c1?_0x108462[_0x5212('0x1d')]:_0x371910['offset']+_0x371910[_0x5212('0x1c')];var _0x3b3466;if(_0x1cadb9>=_0x3d36e5){_0x1cadb9=_0x3d36e5;_0x3b3466=0xc8;}else{_0x3b3466=0xce;}_0x10255d[_0x5212('0x19')](_0x3b3466);return _0x10255d['set'](_0x5212('0x1e'),_0x4794a8+'-'+_0x1cadb9+'/'+_0x3d36e5)['json'](_0x108462);}return null;};}function patchUpdates(_0x122e63){return function(_0x3fb199){try{jsonpatch['apply'](_0x3fb199,_0x122e63,!![]);}catch(_0x17565a){return BPromise['reject'](_0x17565a);}return _0x3fb199[_0x5212('0x1f')]();};}function saveUpdates(_0x3caf0c,_0x41bdf3){return function(_0x41c323){if(_0x41c323){return _0x41c323[_0x5212('0x20')](_0x3caf0c)['then'](function(_0x479643){return _0x479643;});}return null;};}function removeEntity(_0x3259f7,_0x284909){return function(_0x59f420){if(_0x59f420){return _0x59f420[_0x5212('0x21')]()['then'](function(){_0x3259f7[_0x5212('0x19')](0xcc)[_0x5212('0x22')]();});}};}function handleEntityNotFound(_0x184cd6,_0x19cc3f){return function(_0x575749){if(!_0x575749){_0x184cd6[_0x5212('0x18')](0x194);}return _0x575749;};}function handleError(_0x94f089,_0x184e34){_0x184e34=_0x184e34||0x1f4;return function(_0x58a4a2){logger[_0x5212('0x23')](_0x58a4a2[_0x5212('0x24')]);if(_0x58a4a2[_0x5212('0x25')]){delete _0x58a4a2['name'];}_0x94f089[_0x5212('0x19')](_0x184e34)[_0x5212('0x26')](_0x58a4a2);};}exports[_0x5212('0x27')]=function(_0x1a806e,_0x3986fc){var _0x477b95={},_0x5333ea={},_0x12a470={'count':0x0,'rows':[]};var _0x5640fd=_[_0x5212('0x28')](db['AnalyticFieldReport'][_0x5212('0x29')],function(_0x3c3179){return{'name':_0x3c3179['fieldName'],'type':_0x3c3179[_0x5212('0x2a')][_0x5212('0x2b')]};});_0x5333ea[_0x5212('0x2c')]=_[_0x5212('0x28')](_0x5640fd,_0x5212('0x25'));_0x5333ea['query']=_[_0x5212('0x2d')](_0x1a806e[_0x5212('0x2e')]);_0x5333ea[_0x5212('0x2f')]=_[_0x5212('0x30')](_0x5333ea['model'],_0x5333ea[_0x5212('0x2e')]);_0x477b95['attributes']=_['intersection'](_0x5333ea[_0x5212('0x2c')],qs['fields'](_0x1a806e[_0x5212('0x2e')][_0x5212('0x31')]));_0x477b95[_0x5212('0x32')]=_0x477b95['attributes'][_0x5212('0x33')]?_0x477b95[_0x5212('0x32')]:_0x5333ea[_0x5212('0x2c')];if(!_0x1a806e[_0x5212('0x2e')]['hasOwnProperty']('nolimit')){_0x477b95[_0x5212('0x1c')]=qs[_0x5212('0x1c')](_0x1a806e[_0x5212('0x2e')][_0x5212('0x1c')]);_0x477b95['offset']=qs['offset'](_0x1a806e[_0x5212('0x2e')][_0x5212('0x1a')]);}_0x477b95['order']=qs[_0x5212('0x34')](_0x1a806e[_0x5212('0x2e')][_0x5212('0x34')]);_0x477b95[_0x5212('0x35')]=qs['filters'](_[_0x5212('0x36')](_0x1a806e[_0x5212('0x2e')],_0x5333ea[_0x5212('0x2f')]),_0x5640fd);if(_0x1a806e[_0x5212('0x2e')][_0x5212('0x37')]){_0x477b95[_0x5212('0x35')]=_[_0x5212('0x38')](_0x477b95[_0x5212('0x35')],{'$or':_[_0x5212('0x28')](_0x5640fd,function(_0x12843d){if(_0x12843d[_0x5212('0x2a')]!=='VIRTUAL'){var _0x5a3a8f={};_0x5a3a8f[_0x12843d[_0x5212('0x25')]]={'$like':'%'+_0x1a806e[_0x5212('0x2e')]['filter']+'%'};return _0x5a3a8f;}})});}_0x477b95=_[_0x5212('0x38')]({},_0x477b95,_0x1a806e[_0x5212('0x39')]);var _0x21acb4={'where':_0x477b95[_0x5212('0x35')]};return db['AnalyticFieldReport'][_0x5212('0x1d')](_0x21acb4)[_0x5212('0x3a')](function(_0x5a928a){_0x12a470[_0x5212('0x1d')]=_0x5a928a;if(_0x1a806e[_0x5212('0x2e')][_0x5212('0x3b')]){_0x477b95[_0x5212('0x3c')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x5212('0x3d')](_0x477b95);})[_0x5212('0x3a')](function(_0x27aa44){_0x12a470[_0x5212('0x3e')]=_0x27aa44;return _0x12a470;})[_0x5212('0x3a')](respondWithFilteredResult(_0x3986fc,_0x477b95))['catch'](handleError(_0x3986fc,null));};exports[_0x5212('0x3f')]=function(_0x273753,_0x24191e){var _0x2830ba={'raw':![],'where':{'id':_0x273753[_0x5212('0x40')]['id']}},_0xa16130={};_0xa16130[_0x5212('0x2c')]=_[_0x5212('0x2d')](db[_0x5212('0x41')][_0x5212('0x29')]);_0xa16130[_0x5212('0x2e')]=_[_0x5212('0x2d')](_0x273753['query']);_0xa16130['filters']=_[_0x5212('0x30')](_0xa16130[_0x5212('0x2c')],_0xa16130[_0x5212('0x2e')]);_0x2830ba[_0x5212('0x32')]=_[_0x5212('0x30')](_0xa16130[_0x5212('0x2c')],qs['fields'](_0x273753[_0x5212('0x2e')]['fields']));_0x2830ba[_0x5212('0x32')]=_0x2830ba[_0x5212('0x32')][_0x5212('0x33')]?_0x2830ba[_0x5212('0x32')]:_0xa16130[_0x5212('0x2c')];if(_0x273753[_0x5212('0x2e')][_0x5212('0x3b')]){_0x2830ba['include']=[{'all':!![]}];}_0x2830ba=_[_0x5212('0x38')]({},_0x2830ba,_0x273753[_0x5212('0x39')]);return db[_0x5212('0x41')][_0x5212('0x42')](_0x2830ba)[_0x5212('0x3a')](handleEntityNotFound(_0x24191e,null))[_0x5212('0x3a')](respondWithResult(_0x24191e,null))[_0x5212('0x43')](handleError(_0x24191e,null));};exports[_0x5212('0x44')]=function(_0x58b965,_0x532f5e){return db[_0x5212('0x41')][_0x5212('0x44')](_0x58b965[_0x5212('0x45')],{})[_0x5212('0x3a')](respondWithResult(_0x532f5e,0xc9))[_0x5212('0x43')](handleError(_0x532f5e,null));};exports[_0x5212('0x46')]=function(_0x55efd6,_0x884677){return db[_0x5212('0x41')][_0x5212('0x46')](_0x55efd6[_0x5212('0x45')],{'raw':![],'individualHooks':!![]})[_0x5212('0x3a')](respondWithResult(_0x884677,0xc9))['catch'](handleError(_0x884677,null));};exports[_0x5212('0x20')]=function(_0x25a804,_0x15e358){if(_0x25a804[_0x5212('0x45')]['id']){delete _0x25a804[_0x5212('0x45')]['id'];}return db[_0x5212('0x41')][_0x5212('0x42')]({'where':{'id':_0x25a804[_0x5212('0x40')]['id']}})[_0x5212('0x3a')](handleEntityNotFound(_0x15e358,null))[_0x5212('0x3a')](saveUpdates(_0x25a804[_0x5212('0x45')],null))[_0x5212('0x3a')](respondWithResult(_0x15e358,null))[_0x5212('0x43')](handleError(_0x15e358,null));};exports[_0x5212('0x21')]=function(_0x1484c9,_0x40856d){return db[_0x5212('0x41')][_0x5212('0x42')]({'where':{'id':_0x1484c9['params']['id']}})[_0x5212('0x3a')](handleEntityNotFound(_0x40856d,null))[_0x5212('0x3a')](removeEntity(_0x40856d,null))[_0x5212('0x43')](handleError(_0x40856d,null));};exports['bulkDestroy']=function(_0x51a703,_0x33cfa7){return db[_0x5212('0x41')][_0x5212('0x21')]({'where':{'id':_0x51a703[_0x5212('0x2e')][_0x5212('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x5212('0x3a')](respondWithResult(_0x33cfa7,0xcc))[_0x5212('0x43')](handleError(_0x33cfa7,null));};exports[_0x5212('0x48')]=function(_0x51ae94,_0x5b2006,_0x320cc2){return db[_0x5212('0x49')]['findOne']({'where':{'id':_0x51ae94[_0x5212('0x40')]['id']}})[_0x5212('0x3a')](handleEntityNotFound(_0x5b2006,null))[_0x5212('0x3a')](function(_0x37579b){if(_0x37579b){return db[_0x5212('0x4a')][_0x5212('0x4b')](function(_0x3532d5){return db['AnalyticFieldReport'][_0x5212('0x21')]({'where':{'CustomReportId':_0x51ae94[_0x5212('0x40')]['id']},'transaction':_0x3532d5})['then'](function(_0x20d17a){var _0xd7e84d=_['map'](_0x51ae94[_0x5212('0x45')],function(_0x25a69d){delete _0x25a69d['id'];_0x25a69d['CustomReportId']=_0x51ae94[_0x5212('0x40')]['id'];return _0x25a69d;});return db['AnalyticFieldReport'][_0x5212('0x46')](_0xd7e84d,{'transaction':_0x3532d5});});})[_0x5212('0x3a')](function(){return db['AnalyticFieldReport'][_0x5212('0x3d')]({'where':{'CustomReportId':_0x51ae94[_0x5212('0x40')]['id']}});});}})[_0x5212('0x3a')](respondWithResult(_0x5b2006,null))[_0x5212('0x43')](handleError(_0x5b2006,null));}; \ No newline at end of file +var _0xabdb=['sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','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','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','name','send','index','map','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','request-promise','moment','bluebird','util','path'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xabdb,0x14d));var _0xbabd=function(_0x154f21,_0x3c7f37){_0x154f21=_0x154f21-0x0;var _0x5ae16f=_0xabdb[_0x154f21];return _0x5ae16f;};'use strict';var emlformat=require(_0xbabd('0x0'));var rimraf=require(_0xbabd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbabd('0x2'));var moment=require(_0xbabd('0x3'));var BPromise=require(_0xbabd('0x4'));var Mustache=require('mustache');var util=require(_0xbabd('0x5'));var path=require(_0xbabd('0x6'));var sox=require(_0xbabd('0x7'));var csv=require('to-csv');var ejs=require(_0xbabd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbabd('0x9'));var squel=require(_0xbabd('0xa'));var crypto=require(_0xbabd('0xb'));var jsforce=require(_0xbabd('0xc'));var deskjs=require(_0xbabd('0xd'));var toCsv=require(_0xbabd('0xe'));var querystring=require(_0xbabd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbabd('0x10'));var qs=require(_0xbabd('0x11'));var as=require(_0xbabd('0x12'));var hardwareService=require(_0xbabd('0x13'));var logger=require(_0xbabd('0x14'))(_0xbabd('0x15'));var utils=require(_0xbabd('0x16'));var config=require(_0xbabd('0x17'));var licenseUtil=require(_0xbabd('0x18'));var db=require(_0xbabd('0x19'))['db'];function respondWithStatusCode(_0x2a7a68,_0x37f991){_0x37f991=_0x37f991||0xcc;return function(_0x60735b){if(_0x60735b){return _0x2a7a68['sendStatus'](_0x37f991);}return _0x2a7a68[_0xbabd('0x1a')](_0x37f991)[_0xbabd('0x1b')]();};}function respondWithResult(_0x18eec5,_0x44416d){_0x44416d=_0x44416d||0xc8;return function(_0x1d46dd){if(_0x1d46dd){return _0x18eec5[_0xbabd('0x1a')](_0x44416d)[_0xbabd('0x1c')](_0x1d46dd);}};}function respondWithFilteredResult(_0x2cfa1f,_0x527b02){return function(_0xe69da3){if(_0xe69da3){var _0x42bb84=typeof _0x527b02['offset']==='undefined'&&typeof _0x527b02[_0xbabd('0x1d')]===_0xbabd('0x1e');var _0x1139df=_0xe69da3[_0xbabd('0x1f')];var _0x2ef610=_0x42bb84?0x0:_0x527b02[_0xbabd('0x20')];var _0x364c76=_0x42bb84?_0xe69da3[_0xbabd('0x1f')]:_0x527b02['offset']+_0x527b02['limit'];var _0x44589e;if(_0x364c76>=_0x1139df){_0x364c76=_0x1139df;_0x44589e=0xc8;}else{_0x44589e=0xce;}_0x2cfa1f['status'](_0x44589e);return _0x2cfa1f[_0xbabd('0x21')](_0xbabd('0x22'),_0x2ef610+'-'+_0x364c76+'/'+_0x1139df)[_0xbabd('0x1c')](_0xe69da3);}return null;};}function patchUpdates(_0x290e3d){return function(_0x42448d){try{jsonpatch[_0xbabd('0x23')](_0x42448d,_0x290e3d,!![]);}catch(_0xe95b6f){return BPromise[_0xbabd('0x24')](_0xe95b6f);}return _0x42448d[_0xbabd('0x25')]();};}function saveUpdates(_0x3d9d2d,_0x1f87fb){return function(_0x1ac2f8){if(_0x1ac2f8){return _0x1ac2f8['update'](_0x3d9d2d)['then'](function(_0x4dd99d){return _0x4dd99d;});}return null;};}function removeEntity(_0x2a4452,_0x191512){return function(_0x26af56){if(_0x26af56){return _0x26af56[_0xbabd('0x26')]()[_0xbabd('0x27')](function(){_0x2a4452[_0xbabd('0x1a')](0xcc)[_0xbabd('0x1b')]();});}};}function handleEntityNotFound(_0x87ddef,_0x239450){return function(_0x53f018){if(!_0x53f018){_0x87ddef[_0xbabd('0x28')](0x194);}return _0x53f018;};}function handleError(_0x47c1ef,_0x306b78){_0x306b78=_0x306b78||0x1f4;return function(_0x458c55){logger['error'](_0x458c55[_0xbabd('0x29')]);if(_0x458c55[_0xbabd('0x2a')]){delete _0x458c55[_0xbabd('0x2a')];}_0x47c1ef[_0xbabd('0x1a')](_0x306b78)[_0xbabd('0x2b')](_0x458c55);};}exports[_0xbabd('0x2c')]=function(_0x35fe6f,_0x5dbbe8){var _0x393c88={},_0x4a0b1e={},_0x4bb500={'count':0x0,'rows':[]};var _0x913939=_[_0xbabd('0x2d')](db['AnalyticFieldReport']['rawAttributes'],function(_0x8d1ae4){return{'name':_0x8d1ae4['fieldName'],'type':_0x8d1ae4[_0xbabd('0x2e')][_0xbabd('0x2f')]};});_0x4a0b1e[_0xbabd('0x30')]=_[_0xbabd('0x2d')](_0x913939,_0xbabd('0x2a'));_0x4a0b1e[_0xbabd('0x31')]=_[_0xbabd('0x32')](_0x35fe6f['query']);_0x4a0b1e['filters']=_[_0xbabd('0x33')](_0x4a0b1e[_0xbabd('0x30')],_0x4a0b1e[_0xbabd('0x31')]);_0x393c88['attributes']=_[_0xbabd('0x33')](_0x4a0b1e[_0xbabd('0x30')],qs[_0xbabd('0x34')](_0x35fe6f[_0xbabd('0x31')][_0xbabd('0x34')]));_0x393c88[_0xbabd('0x35')]=_0x393c88[_0xbabd('0x35')]['length']?_0x393c88['attributes']:_0x4a0b1e[_0xbabd('0x30')];if(!_0x35fe6f[_0xbabd('0x31')]['hasOwnProperty'](_0xbabd('0x36'))){_0x393c88[_0xbabd('0x1d')]=qs[_0xbabd('0x1d')](_0x35fe6f[_0xbabd('0x31')][_0xbabd('0x1d')]);_0x393c88[_0xbabd('0x20')]=qs['offset'](_0x35fe6f['query'][_0xbabd('0x20')]);}_0x393c88[_0xbabd('0x37')]=qs[_0xbabd('0x38')](_0x35fe6f[_0xbabd('0x31')][_0xbabd('0x38')]);_0x393c88[_0xbabd('0x39')]=qs[_0xbabd('0x3a')](_[_0xbabd('0x3b')](_0x35fe6f[_0xbabd('0x31')],_0x4a0b1e[_0xbabd('0x3a')]),_0x913939);if(_0x35fe6f[_0xbabd('0x31')]['filter']){_0x393c88['where']=_['merge'](_0x393c88[_0xbabd('0x39')],{'$or':_[_0xbabd('0x2d')](_0x913939,function(_0x19de9d){if(_0x19de9d[_0xbabd('0x2e')]!=='VIRTUAL'){var _0x583d76={};_0x583d76[_0x19de9d['name']]={'$like':'%'+_0x35fe6f['query'][_0xbabd('0x3c')]+'%'};return _0x583d76;}})});}_0x393c88=_[_0xbabd('0x3d')]({},_0x393c88,_0x35fe6f[_0xbabd('0x3e')]);var _0xb676c8={'where':_0x393c88[_0xbabd('0x39')]};return db[_0xbabd('0x3f')][_0xbabd('0x1f')](_0xb676c8)['then'](function(_0x45261b){_0x4bb500[_0xbabd('0x1f')]=_0x45261b;if(_0x35fe6f[_0xbabd('0x31')][_0xbabd('0x40')]){_0x393c88[_0xbabd('0x41')]=[{'all':!![]}];}return db[_0xbabd('0x3f')][_0xbabd('0x42')](_0x393c88);})[_0xbabd('0x27')](function(_0x586565){_0x4bb500[_0xbabd('0x43')]=_0x586565;return _0x4bb500;})[_0xbabd('0x27')](respondWithFilteredResult(_0x5dbbe8,_0x393c88))[_0xbabd('0x44')](handleError(_0x5dbbe8,null));};exports[_0xbabd('0x45')]=function(_0x3eb9fe,_0x215786){var _0x4cff71={'raw':![],'where':{'id':_0x3eb9fe[_0xbabd('0x46')]['id']}},_0x45e6df={};_0x45e6df['model']=_[_0xbabd('0x32')](db[_0xbabd('0x3f')][_0xbabd('0x47')]);_0x45e6df[_0xbabd('0x31')]=_[_0xbabd('0x32')](_0x3eb9fe['query']);_0x45e6df[_0xbabd('0x3a')]=_['intersection'](_0x45e6df[_0xbabd('0x30')],_0x45e6df[_0xbabd('0x31')]);_0x4cff71[_0xbabd('0x35')]=_[_0xbabd('0x33')](_0x45e6df[_0xbabd('0x30')],qs['fields'](_0x3eb9fe[_0xbabd('0x31')][_0xbabd('0x34')]));_0x4cff71['attributes']=_0x4cff71[_0xbabd('0x35')][_0xbabd('0x48')]?_0x4cff71[_0xbabd('0x35')]:_0x45e6df[_0xbabd('0x30')];if(_0x3eb9fe[_0xbabd('0x31')][_0xbabd('0x40')]){_0x4cff71[_0xbabd('0x41')]=[{'all':!![]}];}_0x4cff71=_[_0xbabd('0x3d')]({},_0x4cff71,_0x3eb9fe['options']);return db[_0xbabd('0x3f')][_0xbabd('0x49')](_0x4cff71)[_0xbabd('0x27')](handleEntityNotFound(_0x215786,null))[_0xbabd('0x27')](respondWithResult(_0x215786,null))[_0xbabd('0x44')](handleError(_0x215786,null));};exports['create']=function(_0x5aa0e5,_0x10ceca){return db[_0xbabd('0x3f')][_0xbabd('0x4a')](_0x5aa0e5['body'],{})['then'](respondWithResult(_0x10ceca,0xc9))[_0xbabd('0x44')](handleError(_0x10ceca,null));};exports[_0xbabd('0x4b')]=function(_0x5a0941,_0x5b7ca2){return db[_0xbabd('0x3f')]['bulkCreate'](_0x5a0941[_0xbabd('0x4c')],{'raw':![],'individualHooks':!![]})[_0xbabd('0x27')](respondWithResult(_0x5b7ca2,0xc9))['catch'](handleError(_0x5b7ca2,null));};exports['update']=function(_0x29abf7,_0x3a0ed5){if(_0x29abf7[_0xbabd('0x4c')]['id']){delete _0x29abf7[_0xbabd('0x4c')]['id'];}return db[_0xbabd('0x3f')]['find']({'where':{'id':_0x29abf7[_0xbabd('0x46')]['id']}})[_0xbabd('0x27')](handleEntityNotFound(_0x3a0ed5,null))[_0xbabd('0x27')](saveUpdates(_0x29abf7[_0xbabd('0x4c')],null))[_0xbabd('0x27')](respondWithResult(_0x3a0ed5,null))[_0xbabd('0x44')](handleError(_0x3a0ed5,null));};exports[_0xbabd('0x26')]=function(_0x3e5022,_0x477549){return db['AnalyticFieldReport'][_0xbabd('0x49')]({'where':{'id':_0x3e5022['params']['id']}})[_0xbabd('0x27')](handleEntityNotFound(_0x477549,null))['then'](removeEntity(_0x477549,null))['catch'](handleError(_0x477549,null));};exports[_0xbabd('0x4d')]=function(_0xa78bef,_0x2b0c9f){return db[_0xbabd('0x3f')]['destroy']({'where':{'id':_0xa78bef[_0xbabd('0x31')][_0xbabd('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xbabd('0x27')](respondWithResult(_0x2b0c9f,0xcc))[_0xbabd('0x44')](handleError(_0x2b0c9f,null));};exports[_0xbabd('0x4f')]=function(_0x2f0a55,_0x52d777,_0x556bad){return db[_0xbabd('0x50')][_0xbabd('0x51')]({'where':{'id':_0x2f0a55['params']['id']}})[_0xbabd('0x27')](handleEntityNotFound(_0x52d777,null))[_0xbabd('0x27')](function(_0xa10ad1){if(_0xa10ad1){return db[_0xbabd('0x52')][_0xbabd('0x53')](function(_0x1a05f8){return db['AnalyticFieldReport'][_0xbabd('0x26')]({'where':{'CustomReportId':_0x2f0a55[_0xbabd('0x46')]['id']},'transaction':_0x1a05f8})[_0xbabd('0x27')](function(_0x47917d){var _0x5918d5=_['map'](_0x2f0a55[_0xbabd('0x4c')],function(_0x3db028){delete _0x3db028['id'];_0x3db028[_0xbabd('0x54')]=_0x2f0a55['params']['id'];return _0x3db028;});return db[_0xbabd('0x3f')][_0xbabd('0x4b')](_0x5918d5,{'transaction':_0x1a05f8});});})[_0xbabd('0x27')](function(){return db[_0xbabd('0x3f')]['findAll']({'where':{'CustomReportId':_0x2f0a55[_0xbabd('0x46')]['id']}});});}})[_0xbabd('0x27')](respondWithResult(_0x52d777,null))[_0xbabd('0x44')](handleError(_0x52d777,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 1e14d57..535619d 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 _0x45a6=['util','api','request-promise','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x45a6,0xfc));var _0x645a=function(_0x3d49b7,_0x376c6e){_0x3d49b7=_0x3d49b7-0x0;var _0x1d7447=_0x45a6[_0x3d49b7];return _0x1d7447;};'use strict';var _=require('lodash');var util=require(_0x645a('0x0'));var logger=require('../../config/logger')(_0x645a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x645a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x645a('0x3'));var config=require('../../config/environment');var attributes=require(_0x645a('0x4'));module[_0x645a('0x5')]=function(_0x453a0f,_0x2f22fd){return _0x453a0f[_0x645a('0x6')](_0x645a('0x7'),attributes,{'tableName':_0x645a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd44=['rimraf','../../config/environment','define','AnalyticFieldReport','analytics_report_fields','util','api','moment','path'];(function(_0x5ca901,_0x415d5f){var _0x2ca8d2=function(_0x20e9f6){while(--_0x20e9f6){_0x5ca901['push'](_0x5ca901['shift']());}};_0x2ca8d2(++_0x415d5f);}(_0xcd44,0xef));var _0x4cd4=function(_0x5a3720,_0x572724){_0x5a3720=_0x5a3720-0x0;var _0x53e3d7=_0xcd44[_0x5a3720];return _0x53e3d7;};'use strict';var _=require('lodash');var util=require(_0x4cd4('0x0'));var logger=require('../../config/logger')(_0x4cd4('0x1'));var moment=require(_0x4cd4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4cd4('0x3'));var rimraf=require(_0x4cd4('0x4'));var config=require(_0x4cd4('0x5'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x3037aa,_0x351d45){return _0x3037aa[_0x4cd4('0x6')](_0x4cd4('0x7'),attributes,{'tableName':_0x4cd4('0x8'),'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 9a26b86..4e303ae 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 _0x9f8c=['util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash'];(function(_0x37bee6,_0xa58df8){var _0x1bfcf9=function(_0x4d0e3e){while(--_0x4d0e3e){_0x37bee6['push'](_0x37bee6['shift']());}};_0x1bfcf9(++_0xa58df8);}(_0x9f8c,0x1f3));var _0xc9f8=function(_0x4aab59,_0x570466){_0x4aab59=_0x4aab59-0x0;var _0x613336=_0x9f8c[_0x4aab59];return _0x613336;};'use strict';var _=require(_0xc9f8('0x0'));var util=require(_0xc9f8('0x1'));var moment=require(_0xc9f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9f8('0x4'));var logger=require(_0xc9f8('0x5'))('rpc');var config=require(_0xc9f8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc9f8('0x7')][_0xc9f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b29bc,_0x8050f9,_0xb85696){return new BPromise(function(_0x796660,_0x870cb2){return client[_0xc9f8('0x9')](_0x4b29bc,_0xb85696)[_0xc9f8('0xa')](function(_0x2a498b){logger[_0xc9f8('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x8050f9,_0xc9f8('0xc'));logger[_0xc9f8('0xd')](_0xc9f8('0xe'),_0x8050f9,'request\x20sent',JSON['stringify'](_0x2a498b));if(_0x2a498b[_0xc9f8('0xf')]){if(_0x2a498b['error'][_0xc9f8('0x10')]===0x1f4){logger[_0xc9f8('0xf')](_0xc9f8('0x11'),_0x8050f9,_0x2a498b[_0xc9f8('0xf')][_0xc9f8('0x12')]);return _0x870cb2(_0x2a498b[_0xc9f8('0xf')][_0xc9f8('0x12')]);}logger[_0xc9f8('0xf')](_0xc9f8('0x11'),_0x8050f9,_0x2a498b['error'][_0xc9f8('0x12')]);return _0x796660(_0x2a498b[_0xc9f8('0xf')][_0xc9f8('0x12')]);}else{logger['info'](_0xc9f8('0x11'),_0x8050f9,_0xc9f8('0xc'));_0x796660(_0x2a498b['result'][_0xc9f8('0x12')]);}})[_0xc9f8('0x13')](function(_0x231031){logger['error'](_0xc9f8('0x11'),_0x8050f9,_0x231031);_0x870cb2(_0x231031);});});} \ No newline at end of file +var _0xf3b3=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then'];(function(_0x3ec92e,_0x5b1813){var _0x4a6eb4=function(_0x41354f){while(--_0x41354f){_0x3ec92e['push'](_0x3ec92e['shift']());}};_0x4a6eb4(++_0x5b1813);}(_0xf3b3,0xa9));var _0x3f3b=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xf3b3[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0x3f3b('0x0'));var moment=require(_0x3f3b('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f3b('0x2'));var fs=require('fs');var Redis=require(_0x3f3b('0x3'));var db=require(_0x3f3b('0x4'))['db'];var utils=require(_0x3f3b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3f3b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3f3b('0x7')][_0x3f3b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34b8f5,_0x198737,_0x5e8c81){return new BPromise(function(_0x38c4ac,_0x2da262){return client[_0x3f3b('0x9')](_0x34b8f5,_0x5e8c81)[_0x3f3b('0xa')](function(_0x58ed82){logger['info'](_0x3f3b('0xb'),_0x198737,_0x3f3b('0xc'));logger[_0x3f3b('0xd')](_0x3f3b('0xe'),_0x198737,_0x3f3b('0xc'),JSON[_0x3f3b('0xf')](_0x58ed82));if(_0x58ed82[_0x3f3b('0x10')]){if(_0x58ed82['error']['code']===0x1f4){logger[_0x3f3b('0x10')](_0x3f3b('0xb'),_0x198737,_0x58ed82[_0x3f3b('0x10')][_0x3f3b('0x11')]);return _0x2da262(_0x58ed82[_0x3f3b('0x10')]['message']);}logger[_0x3f3b('0x10')](_0x3f3b('0xb'),_0x198737,_0x58ed82[_0x3f3b('0x10')][_0x3f3b('0x11')]);return _0x38c4ac(_0x58ed82[_0x3f3b('0x10')]['message']);}else{logger['info'](_0x3f3b('0xb'),_0x198737,_0x3f3b('0xc'));_0x38c4ac(_0x58ed82[_0x3f3b('0x12')][_0x3f3b('0x11')]);}})[_0x3f3b('0x13')](function(_0x2d6687){logger[_0x3f3b('0x10')](_0x3f3b('0xb'),_0x198737,_0x2d6687);_0x2da262(_0x2d6687);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 902211c..194cbb4 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(_0x5032ca,_0x2352a9){var _0x1663a7=function(_0x61a79){while(--_0x61a79){_0x5032ca['push'](_0x5032ca['shift']());}};_0x1663a7(++_0x2352a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x431f8,_0x6ec1b8){var _0x18e7d4=function(_0x500150){while(--_0x500150){_0x431f8['push'](_0x431f8['shift']());}};_0x18e7d4(++_0x6ec1b8);}(_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['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 a11260d..b8e75aa 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 _0x8a9a=['name','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8a9a,0x193));var _0xa8a9=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x8a9a[_0x279d37];return _0x530173;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa8a9('0x0')],'allowNull':![],'unique':_0xa8a9('0x1')},'table':{'type':Sequelize[_0xa8a9('0x0')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xa8a9('0x0')]}}; \ No newline at end of file +var _0xa887=['TEXT','sequelize','STRING','name'];(function(_0x1d8c3b,_0x2ef56c){var _0x3b2999=function(_0x266883){while(--_0x266883){_0x1d8c3b['push'](_0x1d8c3b['shift']());}};_0x3b2999(++_0x2ef56c);}(_0xa887,0x89));var _0x7a88=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa887[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x7a88('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a88('0x1')],'allowNull':![],'unique':_0x7a88('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x7a88('0x3')]},'description':{'type':Sequelize[_0x7a88('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 07eb9bc..c5d1f63 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 _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x291a8a,_0x19a965){var _0x231d36=function(_0x346bea){while(--_0x346bea){_0x291a8a['push'](_0x291a8a['shift']());}};_0x231d36(++_0x19a965);}(_0x24ca,0x1bc));var _0xa24c=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0x24ca[_0x19babd];return _0x314eaf;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file +var _0x425d=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','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','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge'];(function(_0x2960db,_0x5ae62d){var _0x5359ea=function(_0x34a683){while(--_0x34a683){_0x2960db['push'](_0x2960db['shift']());}};_0x5359ea(++_0x5ae62d);}(_0x425d,0x1e0));var _0xd425=function(_0x3797ba,_0x2478f2){_0x3797ba=_0x3797ba-0x0;var _0x55c7fd=_0x425d[_0x3797ba];return _0x55c7fd;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){var _0x264b0e=_0x40e84b[_0xd425('0x2b')]({'plain':!![]});var _0x1908a5=_0xd425('0x2c');return db[_0xd425('0x2d')][_0xd425('0x2e')]({'where':{'type':_0x1908a5,'resourceId':_0x264b0e['id']}})['then'](function(){return _0x40e84b;});})[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x57c950,_0x27ef8a){return function(_0x3ad9bd){if(!_0x3ad9bd){_0x57c950[_0xd425('0x1d')](0x194);}return _0x3ad9bd;};}function handleError(_0x999fb9,_0x27d29a){_0x27d29a=_0x27d29a||0x1f4;return function(_0x185d7e){logger[_0xd425('0x2f')](_0x185d7e[_0xd425('0x30')]);if(_0x185d7e[_0xd425('0x31')]){delete _0x185d7e[_0xd425('0x31')];}_0x999fb9['status'](_0x27d29a)[_0xd425('0x32')](_0x185d7e);};}exports[_0xd425('0x33')]=function(_0x298602,_0x3695dd){var _0x3275b1={},_0x1abf33={},_0x47405f={'count':0x0,'rows':[]};var _0x40c392=_[_0xd425('0x34')](db[_0xd425('0x35')][_0xd425('0x36')],function(_0x5f3dab){return{'name':_0x5f3dab[_0xd425('0x37')],'type':_0x5f3dab[_0xd425('0x38')][_0xd425('0x39')]};});_0x1abf33[_0xd425('0x3a')]=_[_0xd425('0x34')](_0x40c392,'name');_0x1abf33[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x298602['query']);_0x1abf33['filters']=_['intersection'](_0x1abf33[_0xd425('0x3a')],_0x1abf33[_0xd425('0x3b')]);_0x3275b1[_0xd425('0x3d')]=_[_0xd425('0x3e')](_0x1abf33['model'],qs[_0xd425('0x3f')](_0x298602[_0xd425('0x3b')][_0xd425('0x3f')]));_0x3275b1[_0xd425('0x3d')]=_0x3275b1[_0xd425('0x3d')][_0xd425('0x40')]?_0x3275b1[_0xd425('0x3d')]:_0x1abf33['model'];if(!_0x298602[_0xd425('0x3b')]['hasOwnProperty'](_0xd425('0x41'))){_0x3275b1[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x298602['query'][_0xd425('0x23')]);_0x3275b1[_0xd425('0x21')]=qs[_0xd425('0x21')](_0x298602[_0xd425('0x3b')]['offset']);}_0x3275b1[_0xd425('0x42')]=qs[_0xd425('0x43')](_0x298602['query']['sort']);_0x3275b1['where']=qs[_0xd425('0x44')](_[_0xd425('0x45')](_0x298602[_0xd425('0x3b')],_0x1abf33['filters']),_0x40c392);if(_0x298602['query']['filter']){_0x3275b1[_0xd425('0x46')]=_[_0xd425('0x47')](_0x3275b1[_0xd425('0x46')],{'$or':_[_0xd425('0x34')](_0x40c392,function(_0xa9fd7c){if(_0xa9fd7c[_0xd425('0x38')]!==_0xd425('0x48')){var _0x4b922f={};_0x4b922f[_0xa9fd7c[_0xd425('0x31')]]={'$like':'%'+_0x298602[_0xd425('0x3b')][_0xd425('0x49')]+'%'};return _0x4b922f;}})});}_0x3275b1=_['merge']({},_0x3275b1,_0x298602[_0xd425('0x4a')]);var _0x2dffc7={'where':_0x3275b1[_0xd425('0x46')]};return db['AnalyticMetric'][_0xd425('0x24')](_0x2dffc7)[_0xd425('0x2a')](function(_0x1c5ba6){_0x47405f[_0xd425('0x24')]=_0x1c5ba6;if(_0x298602['query'][_0xd425('0x4b')]){_0x3275b1[_0xd425('0x4c')]=[{'all':!![]}];}return db[_0xd425('0x35')][_0xd425('0x4d')](_0x3275b1);})[_0xd425('0x2a')](function(_0x2f6bf7){_0x47405f[_0xd425('0x4e')]=_0x2f6bf7;return _0x47405f;})['then'](respondWithFilteredResult(_0x3695dd,_0x3275b1))[_0xd425('0x4f')](handleError(_0x3695dd,null));};exports[_0xd425('0x50')]=function(_0x5b65fe,_0x1a44a8){var _0x491c51={'raw':!![],'where':{'id':_0x5b65fe[_0xd425('0x51')]['id']}},_0x5e12bf={};_0x5e12bf['model']=_[_0xd425('0x3c')](db['AnalyticMetric'][_0xd425('0x36')]);_0x5e12bf[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x5b65fe[_0xd425('0x3b')]);_0x5e12bf[_0xd425('0x44')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],_0x5e12bf['query']);_0x491c51[_0xd425('0x3d')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],qs[_0xd425('0x3f')](_0x5b65fe[_0xd425('0x3b')][_0xd425('0x3f')]));_0x491c51[_0xd425('0x3d')]=_0x491c51['attributes'][_0xd425('0x40')]?_0x491c51[_0xd425('0x3d')]:_0x5e12bf[_0xd425('0x3a')];if(_0x5b65fe[_0xd425('0x3b')][_0xd425('0x4b')]){_0x491c51['include']=[{'all':!![]}];}_0x491c51=_[_0xd425('0x47')]({},_0x491c51,_0x5b65fe[_0xd425('0x4a')]);return db[_0xd425('0x35')][_0xd425('0x52')](_0x491c51)[_0xd425('0x2a')](handleEntityNotFound(_0x1a44a8,null))[_0xd425('0x2a')](respondWithResult(_0x1a44a8,null))['catch'](handleError(_0x1a44a8,null));};exports[_0xd425('0x53')]=function(_0x128cb3,_0x5bfac6){return db[_0xd425('0x35')][_0xd425('0x53')](_0x128cb3[_0xd425('0x54')],{})[_0xd425('0x2a')](function(_0x5c0219){var _0x54f1d=_0x128cb3[_0xd425('0x55')][_0xd425('0x2b')]({'plain':!![]});if(!_0x54f1d)throw new Error(_0xd425('0x56'));if(_0x54f1d[_0xd425('0x57')]==='user'){var _0x4be6fa=_0x5c0219[_0xd425('0x2b')]({'plain':!![]});var _0x5496d8=_0xd425('0x2c');return db[_0xd425('0x58')]['find']({'where':{'name':_0x5496d8,'userProfileId':_0x54f1d[_0xd425('0x59')]},'raw':!![]})['then'](function(_0x48d5b8){if(_0x48d5b8&&_0x48d5b8[_0xd425('0x5a')]===0x0){return db[_0xd425('0x2d')][_0xd425('0x53')]({'name':_0x4be6fa[_0xd425('0x31')],'resourceId':_0x4be6fa['id'],'type':_0x48d5b8[_0xd425('0x31')],'sectionId':_0x48d5b8['id']},{})[_0xd425('0x2a')](function(){return _0x5c0219;});}else{return _0x5c0219;}})[_0xd425('0x4f')](function(_0x4118fe){logger['error'](_0xd425('0x5b'),_0x4118fe);throw _0x4118fe;});}return _0x5c0219;})[_0xd425('0x2a')](respondWithResult(_0x5bfac6,0xc9))[_0xd425('0x4f')](handleError(_0x5bfac6,null));};exports[_0xd425('0x29')]=function(_0x7b1080,_0x1c80c2){if(_0x7b1080[_0xd425('0x54')]['id']){delete _0x7b1080[_0xd425('0x54')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x7b1080['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x1c80c2,null))[_0xd425('0x2a')](saveUpdates(_0x7b1080[_0xd425('0x54')],null))[_0xd425('0x2a')](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['destroy']=function(_0x499a60,_0x5e1294){return db[_0xd425('0x35')][_0xd425('0x52')]({'where':{'id':_0x499a60['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5e1294,null))[_0xd425('0x2a')](removeEntity(_0x5e1294,null))[_0xd425('0x4f')](handleError(_0x5e1294,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 1fa8b3f..d7baf28 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 _0x644f=['define','AnalyticMetric','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x41fcea,_0x83311b){var _0x465542=function(_0x5ebf9d){while(--_0x5ebf9d){_0x41fcea['push'](_0x41fcea['shift']());}};_0x465542(++_0x83311b);}(_0x644f,0xc2));var _0xf644=function(_0x4dd479,_0x26d87a){_0x4dd479=_0x4dd479-0x0;var _0x1b6807=_0x644f[_0x4dd479];return _0x1b6807;};'use strict';var _=require(_0xf644('0x0'));var util=require(_0xf644('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf644('0x2'));var BPromise=require(_0xf644('0x3'));var rp=require(_0xf644('0x4'));var fs=require('fs');var path=require(_0xf644('0x5'));var rimraf=require(_0xf644('0x6'));var config=require(_0xf644('0x7'));var attributes=require(_0xf644('0x8'));module[_0xf644('0x9')]=function(_0x9938ed,_0x1a6cbb){return _0x9938ed[_0xf644('0xa')](_0xf644('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa63f=['request-promise','path','rimraf','../../config/environment','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e0560,_0x5d5797){var _0x4cdeea=function(_0x52e3c9){while(--_0x52e3c9){_0x3e0560['push'](_0x3e0560['shift']());}};_0x4cdeea(++_0x5d5797);}(_0xa63f,0x1b6));var _0xfa63=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0xa63f[_0x273f77];return _0x71e147;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var logger=require(_0xfa63('0x2'))(_0xfa63('0x3'));var moment=require(_0xfa63('0x4'));var BPromise=require(_0xfa63('0x5'));var rp=require(_0xfa63('0x6'));var fs=require('fs');var path=require(_0xfa63('0x7'));var rimraf=require(_0xfa63('0x8'));var config=require(_0xfa63('0x9'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x20d4f6,_0x41efce){return _0x20d4f6[_0xfa63('0xa')](_0xfa63('0xb'),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 e0f596d..778c721 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 _0x6c06=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x425cde,_0x34321c){var _0x56480d=function(_0x4ab356){while(--_0x4ab356){_0x425cde['push'](_0x425cde['shift']());}};_0x56480d(++_0x34321c);}(_0x6c06,0x17c));var _0x66c0=function(_0x2ba2a2,_0x43696a){_0x2ba2a2=_0x2ba2a2-0x0;var _0x3c5d0c=_0x6c06[_0x2ba2a2];return _0x3c5d0c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x66c0('0x0'));var BPromise=require(_0x66c0('0x1'));var rs=require(_0x66c0('0x2'));var fs=require('fs');var Redis=require(_0x66c0('0x3'));var db=require(_0x66c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x66c0('0x5'))('rpc');var config=require(_0x66c0('0x6'));var jayson=require(_0x66c0('0x7'));var client=jayson[_0x66c0('0x8')][_0x66c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4db4a0,_0x3963b8,_0x1bfc8a){return new BPromise(function(_0x36c4b6,_0x13946e){return client[_0x66c0('0xa')](_0x4db4a0,_0x1bfc8a)['then'](function(_0x2ea4ff){logger[_0x66c0('0xb')](_0x66c0('0xc'),_0x3963b8,'request\x20sent');logger[_0x66c0('0xd')](_0x66c0('0xe'),_0x3963b8,'request\x20sent',JSON[_0x66c0('0xf')](_0x2ea4ff));if(_0x2ea4ff[_0x66c0('0x10')]){if(_0x2ea4ff[_0x66c0('0x10')]['code']===0x1f4){logger[_0x66c0('0x10')](_0x66c0('0xc'),_0x3963b8,_0x2ea4ff[_0x66c0('0x10')]['message']);return _0x13946e(_0x2ea4ff[_0x66c0('0x10')][_0x66c0('0x11')]);}logger[_0x66c0('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3963b8,_0x2ea4ff[_0x66c0('0x10')]['message']);return _0x36c4b6(_0x2ea4ff[_0x66c0('0x10')][_0x66c0('0x11')]);}else{logger[_0x66c0('0xb')](_0x66c0('0xc'),_0x3963b8,_0x66c0('0x12'));_0x36c4b6(_0x2ea4ff[_0x66c0('0x13')][_0x66c0('0x11')]);}})[_0x66c0('0x14')](function(_0x22efeb){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3963b8,_0x22efeb);_0x13946e(_0x22efeb);});});} \ No newline at end of file +var _0x0bd6=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14b800,_0x50df46){var _0x276bd1=function(_0x51ca98){while(--_0x51ca98){_0x14b800['push'](_0x14b800['shift']());}};_0x276bd1(++_0x50df46);}(_0x0bd6,0x15c));var _0x60bd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0bd6[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x60bd('0x0'));var util=require(_0x60bd('0x1'));var moment=require('moment');var BPromise=require(_0x60bd('0x2'));var rs=require(_0x60bd('0x3'));var fs=require('fs');var Redis=require(_0x60bd('0x4'));var db=require(_0x60bd('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x60bd('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x60bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a9ef6,_0x8e27b3,_0xfc9f87){return new BPromise(function(_0x81eb0c,_0x23ab61){return client['request'](_0x5a9ef6,_0xfc9f87)[_0x60bd('0x8')](function(_0x5a6063){logger[_0x60bd('0x9')](_0x60bd('0xa'),_0x8e27b3,_0x60bd('0xb'));logger[_0x60bd('0xc')](_0x60bd('0xd'),_0x8e27b3,_0x60bd('0xb'),JSON[_0x60bd('0xe')](_0x5a6063));if(_0x5a6063[_0x60bd('0xf')]){if(_0x5a6063[_0x60bd('0xf')]['code']===0x1f4){logger[_0x60bd('0xf')](_0x60bd('0xa'),_0x8e27b3,_0x5a6063['error'][_0x60bd('0x10')]);return _0x23ab61(_0x5a6063[_0x60bd('0xf')]['message']);}logger[_0x60bd('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x8e27b3,_0x5a6063[_0x60bd('0xf')][_0x60bd('0x10')]);return _0x81eb0c(_0x5a6063[_0x60bd('0xf')][_0x60bd('0x10')]);}else{logger[_0x60bd('0x9')](_0x60bd('0xa'),_0x8e27b3,'request\x20sent');_0x81eb0c(_0x5a6063[_0x60bd('0x11')][_0x60bd('0x10')]);}})[_0x60bd('0x12')](function(_0x55ccef){logger[_0x60bd('0xf')](_0x60bd('0xa'),_0x8e27b3,_0x55ccef);_0x23ab61(_0x55ccef);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8cd324e..edb755c 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 _0x44ff=['show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x19e57f,_0x4ae750){var _0x469556=function(_0xf6968b){while(--_0xf6968b){_0x19e57f['push'](_0x19e57f['shift']());}};_0x469556(++_0x4ae750);}(_0x44ff,0x1c3));var _0xf44f=function(_0x30eefa,_0x31c8e3){_0x30eefa=_0x30eefa-0x0;var _0x33d130=_0x44ff[_0x30eefa];return _0x33d130;};'use strict';var multer=require('multer');var util=require(_0xf44f('0x0'));var path=require(_0xf44f('0x1'));var timeout=require(_0xf44f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf44f('0x3'));var config=require(_0xf44f('0x4'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xf44f('0x5')](),controller[_0xf44f('0x6')]);router[_0xf44f('0x7')]('/:id',auth[_0xf44f('0x5')](),controller[_0xf44f('0x8')]);router[_0xf44f('0x9')]('/',auth['isAuthenticated'](),controller[_0xf44f('0xa')]);router[_0xf44f('0xb')](_0xf44f('0xc'),auth[_0xf44f('0x5')](),controller[_0xf44f('0xd')]);router[_0xf44f('0xe')](_0xf44f('0xc'),auth[_0xf44f('0x5')](),controller[_0xf44f('0xf')]);module[_0xf44f('0x10')]=router; \ No newline at end of file +var _0xf987=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','path','connect-timeout'];(function(_0x3da07e,_0x543814){var _0x34b5cc=function(_0x4aa1de){while(--_0x4aa1de){_0x3da07e['push'](_0x3da07e['shift']());}};_0x34b5cc(++_0x543814);}(_0xf987,0x18a));var _0x7f98=function(_0x1c97e7,_0xd3c158){_0x1c97e7=_0x1c97e7-0x0;var _0x4c9be4=_0xf987[_0x1c97e7];return _0x4c9be4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f98('0x0'));var timeout=require(_0x7f98('0x1'));var express=require('express');var router=express[_0x7f98('0x2')]();var fs_extra=require(_0x7f98('0x3'));var auth=require(_0x7f98('0x4'));var interaction=require(_0x7f98('0x5'));var config=require(_0x7f98('0x6'));var controller=require(_0x7f98('0x7'));router[_0x7f98('0x8')]('/',auth[_0x7f98('0x9')](),controller[_0x7f98('0xa')]);router[_0x7f98('0x8')](_0x7f98('0xb'),auth[_0x7f98('0x9')](),controller['show']);router[_0x7f98('0xc')]('/',auth[_0x7f98('0x9')](),controller[_0x7f98('0xd')]);router[_0x7f98('0xe')](_0x7f98('0xb'),auth['isAuthenticated'](),controller[_0x7f98('0xf')]);router['delete']('/:id',auth[_0x7f98('0x9')](),controller[_0x7f98('0x10')]);module[_0x7f98('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 77b0688..a06b4ab 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 _0x3cfe=['TEXT','sequelize','exports'];(function(_0x485aa6,_0x82cc72){var _0x36bade=function(_0x4d346c){while(--_0x4d346c){_0x485aa6['push'](_0x485aa6['shift']());}};_0x36bade(++_0x82cc72);}(_0x3cfe,0x1d5));var _0xe3cf=function(_0xc8238f,_0x2ae3a9){_0xc8238f=_0xc8238f-0x0;var _0x4c8b78=_0x3cfe[_0xc8238f];return _0x4c8b78;};'use strict';var Sequelize=require(_0xe3cf('0x0'));module[_0xe3cf('0x1')]={'tree':{'type':Sequelize[_0xe3cf('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xba4b=['TEXT','sequelize'];(function(_0x20d212,_0x2abbc4){var _0x124125=function(_0x50d95f){while(--_0x50d95f){_0x20d212['push'](_0x20d212['shift']());}};_0x124125(++_0x2abbc4);}(_0xba4b,0xef));var _0xbba4=function(_0x1f6e3e,_0x41ef50){_0x1f6e3e=_0x1f6e3e-0x0;var _0x504425=_0xba4b[_0x1f6e3e];return _0x504425;};'use strict';var Sequelize=require(_0xbba4('0x0'));module['exports']={'tree':{'type':Sequelize[_0xbba4('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index f26b370..c4ee3e4 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 _0x2fcc=['crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','error','send','index','map','AnalyticTreeReport','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2fcc,0x89));var _0xc2fc=function(_0x17f7e2,_0x4db75d){_0x17f7e2=_0x17f7e2-0x0;var _0x3c2a3b=_0x2fcc[_0x17f7e2];return _0x3c2a3b;};'use strict';var emlformat=require(_0xc2fc('0x0'));var rimraf=require(_0xc2fc('0x1'));var zipdir=require(_0xc2fc('0x2'));var jsonpatch=require(_0xc2fc('0x3'));var rp=require(_0xc2fc('0x4'));var moment=require(_0xc2fc('0x5'));var BPromise=require(_0xc2fc('0x6'));var Mustache=require(_0xc2fc('0x7'));var util=require(_0xc2fc('0x8'));var path=require(_0xc2fc('0x9'));var sox=require(_0xc2fc('0xa'));var csv=require(_0xc2fc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2fc('0xc'));var _=require(_0xc2fc('0xd'));var squel=require(_0xc2fc('0xe'));var crypto=require(_0xc2fc('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc2fc('0xb'));var querystring=require(_0xc2fc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc2fc('0x11'));var qs=require(_0xc2fc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2fc('0x13'))(_0xc2fc('0x14'));var utils=require(_0xc2fc('0x15'));var config=require(_0xc2fc('0x16'));var licenseUtil=require(_0xc2fc('0x17'));var db=require(_0xc2fc('0x18'))['db'];function respondWithStatusCode(_0x34a5fa,_0x4602fb){_0x4602fb=_0x4602fb||0xcc;return function(_0x5810ad){if(_0x5810ad){return _0x34a5fa[_0xc2fc('0x19')](_0x4602fb);}return _0x34a5fa[_0xc2fc('0x1a')](_0x4602fb)[_0xc2fc('0x1b')]();};}function respondWithResult(_0x2ae2c2,_0x5b2aaa){_0x5b2aaa=_0x5b2aaa||0xc8;return function(_0x275e9f){if(_0x275e9f){return _0x2ae2c2[_0xc2fc('0x1a')](_0x5b2aaa)[_0xc2fc('0x1c')](_0x275e9f);}};}function respondWithFilteredResult(_0x15a182,_0xed8efe){return function(_0x5a8e44){if(_0x5a8e44){var _0x576919=typeof _0xed8efe[_0xc2fc('0x1d')]==='undefined'&&typeof _0xed8efe[_0xc2fc('0x1e')]===_0xc2fc('0x1f');var _0x25373a=_0x5a8e44[_0xc2fc('0x20')];var _0xc0163=_0x576919?0x0:_0xed8efe[_0xc2fc('0x1d')];var _0x2c6d1b=_0x576919?_0x5a8e44[_0xc2fc('0x20')]:_0xed8efe[_0xc2fc('0x1d')]+_0xed8efe['limit'];var _0x3a00e8;if(_0x2c6d1b>=_0x25373a){_0x2c6d1b=_0x25373a;_0x3a00e8=0xc8;}else{_0x3a00e8=0xce;}_0x15a182[_0xc2fc('0x1a')](_0x3a00e8);return _0x15a182[_0xc2fc('0x21')](_0xc2fc('0x22'),_0xc0163+'-'+_0x2c6d1b+'/'+_0x25373a)[_0xc2fc('0x1c')](_0x5a8e44);}return null;};}function patchUpdates(_0x2ff989){return function(_0x1992f3){try{jsonpatch['apply'](_0x1992f3,_0x2ff989,!![]);}catch(_0x2ad071){return BPromise[_0xc2fc('0x23')](_0x2ad071);}return _0x1992f3[_0xc2fc('0x24')]();};}function saveUpdates(_0xf9852c,_0x4d3525){return function(_0x5a53fa){if(_0x5a53fa){return _0x5a53fa['update'](_0xf9852c)['then'](function(_0x8a293e){return _0x8a293e;});}return null;};}function removeEntity(_0x5e37d6,_0x5e56e7){return function(_0x5aa4b1){if(_0x5aa4b1){return _0x5aa4b1[_0xc2fc('0x25')]()[_0xc2fc('0x26')](function(){_0x5e37d6[_0xc2fc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53a4e4,_0x52e7ca){return function(_0x550c93){if(!_0x550c93){_0x53a4e4[_0xc2fc('0x19')](0x194);}return _0x550c93;};}function handleError(_0x4628ef,_0x17eff4){_0x17eff4=_0x17eff4||0x1f4;return function(_0x5eea7a){logger[_0xc2fc('0x27')](_0x5eea7a['stack']);if(_0x5eea7a['name']){delete _0x5eea7a['name'];}_0x4628ef[_0xc2fc('0x1a')](_0x17eff4)[_0xc2fc('0x28')](_0x5eea7a);};}exports[_0xc2fc('0x29')]=function(_0x294e71,_0x416a72){var _0x56ec02={},_0x5f20a4={},_0x3429be={'count':0x0,'rows':[]};var _0x548300=_[_0xc2fc('0x2a')](db[_0xc2fc('0x2b')]['rawAttributes'],function(_0x4afb9a){return{'name':_0x4afb9a['fieldName'],'type':_0x4afb9a['type'][_0xc2fc('0x2c')]};});_0x5f20a4[_0xc2fc('0x2d')]=_[_0xc2fc('0x2a')](_0x548300,_0xc2fc('0x2e'));_0x5f20a4['query']=_[_0xc2fc('0x2f')](_0x294e71['query']);_0x5f20a4[_0xc2fc('0x30')]=_[_0xc2fc('0x31')](_0x5f20a4[_0xc2fc('0x2d')],_0x5f20a4[_0xc2fc('0x32')]);_0x56ec02[_0xc2fc('0x33')]=_[_0xc2fc('0x31')](_0x5f20a4[_0xc2fc('0x2d')],qs[_0xc2fc('0x34')](_0x294e71[_0xc2fc('0x32')][_0xc2fc('0x34')]));_0x56ec02['attributes']=_0x56ec02[_0xc2fc('0x33')][_0xc2fc('0x35')]?_0x56ec02['attributes']:_0x5f20a4['model'];if(!_0x294e71[_0xc2fc('0x32')][_0xc2fc('0x36')](_0xc2fc('0x37'))){_0x56ec02[_0xc2fc('0x1e')]=qs[_0xc2fc('0x1e')](_0x294e71[_0xc2fc('0x32')][_0xc2fc('0x1e')]);_0x56ec02[_0xc2fc('0x1d')]=qs[_0xc2fc('0x1d')](_0x294e71[_0xc2fc('0x32')]['offset']);}_0x56ec02[_0xc2fc('0x38')]=qs['sort'](_0x294e71['query'][_0xc2fc('0x39')]);_0x56ec02[_0xc2fc('0x3a')]=qs[_0xc2fc('0x30')](_[_0xc2fc('0x3b')](_0x294e71['query'],_0x5f20a4[_0xc2fc('0x30')]),_0x548300);if(_0x294e71[_0xc2fc('0x32')]['filter']){_0x56ec02[_0xc2fc('0x3a')]=_[_0xc2fc('0x3c')](_0x56ec02['where'],{'$or':_[_0xc2fc('0x2a')](_0x548300,function(_0xf5df2e){if(_0xf5df2e['type']!==_0xc2fc('0x3d')){var _0x5b1cfe={};_0x5b1cfe[_0xf5df2e[_0xc2fc('0x2e')]]={'$like':'%'+_0x294e71[_0xc2fc('0x32')][_0xc2fc('0x3e')]+'%'};return _0x5b1cfe;}})});}_0x56ec02=_[_0xc2fc('0x3c')]({},_0x56ec02,_0x294e71[_0xc2fc('0x3f')]);var _0xb62073={'where':_0x56ec02[_0xc2fc('0x3a')]};return db[_0xc2fc('0x2b')][_0xc2fc('0x20')](_0xb62073)[_0xc2fc('0x26')](function(_0x5c5202){_0x3429be[_0xc2fc('0x20')]=_0x5c5202;if(_0x294e71['query'][_0xc2fc('0x40')]){_0x56ec02[_0xc2fc('0x41')]=[{'all':!![]}];}return db[_0xc2fc('0x2b')][_0xc2fc('0x42')](_0x56ec02);})['then'](function(_0x26e4b8){_0x3429be[_0xc2fc('0x43')]=_0x26e4b8;return _0x3429be;})[_0xc2fc('0x26')](respondWithFilteredResult(_0x416a72,_0x56ec02))['catch'](handleError(_0x416a72,null));};exports[_0xc2fc('0x44')]=function(_0x293603,_0x20746b){var _0x5dc2b4={'raw':!![],'where':{'id':_0x293603[_0xc2fc('0x45')]['id']}},_0x346c4d={};_0x346c4d[_0xc2fc('0x2d')]=_[_0xc2fc('0x2f')](db[_0xc2fc('0x2b')][_0xc2fc('0x46')]);_0x346c4d[_0xc2fc('0x32')]=_[_0xc2fc('0x2f')](_0x293603[_0xc2fc('0x32')]);_0x346c4d[_0xc2fc('0x30')]=_[_0xc2fc('0x31')](_0x346c4d[_0xc2fc('0x2d')],_0x346c4d['query']);_0x5dc2b4[_0xc2fc('0x33')]=_[_0xc2fc('0x31')](_0x346c4d[_0xc2fc('0x2d')],qs['fields'](_0x293603[_0xc2fc('0x32')]['fields']));_0x5dc2b4[_0xc2fc('0x33')]=_0x5dc2b4[_0xc2fc('0x33')]['length']?_0x5dc2b4[_0xc2fc('0x33')]:_0x346c4d[_0xc2fc('0x2d')];if(_0x293603['query'][_0xc2fc('0x40')]){_0x5dc2b4[_0xc2fc('0x41')]=[{'all':!![]}];}_0x5dc2b4=_[_0xc2fc('0x3c')]({},_0x5dc2b4,_0x293603[_0xc2fc('0x3f')]);return db['AnalyticTreeReport'][_0xc2fc('0x47')](_0x5dc2b4)[_0xc2fc('0x26')](handleEntityNotFound(_0x20746b,null))[_0xc2fc('0x26')](respondWithResult(_0x20746b,null))[_0xc2fc('0x48')](handleError(_0x20746b,null));};exports[_0xc2fc('0x49')]=function(_0x41204a,_0x4fb714){return db[_0xc2fc('0x2b')][_0xc2fc('0x49')](_0x41204a[_0xc2fc('0x4a')],{})[_0xc2fc('0x26')](respondWithResult(_0x4fb714,0xc9))[_0xc2fc('0x48')](handleError(_0x4fb714,null));};exports[_0xc2fc('0x4b')]=function(_0x301ed,_0x44f787){if(_0x301ed['body']['id']){delete _0x301ed[_0xc2fc('0x4a')]['id'];}return db[_0xc2fc('0x2b')][_0xc2fc('0x47')]({'where':{'id':_0x301ed[_0xc2fc('0x45')]['id']}})[_0xc2fc('0x26')](handleEntityNotFound(_0x44f787,null))[_0xc2fc('0x26')](saveUpdates(_0x301ed['body'],null))[_0xc2fc('0x26')](respondWithResult(_0x44f787,null))[_0xc2fc('0x48')](handleError(_0x44f787,null));};exports['destroy']=function(_0x4eddcd,_0x6164e2){return db[_0xc2fc('0x2b')][_0xc2fc('0x47')]({'where':{'id':_0x4eddcd[_0xc2fc('0x45')]['id']}})[_0xc2fc('0x26')](handleEntityNotFound(_0x6164e2,null))[_0xc2fc('0x26')](removeEntity(_0x6164e2,null))[_0xc2fc('0x48')](handleError(_0x6164e2,null));}; \ No newline at end of file +var _0x3368=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','name','send','index','AnalyticTreeReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','then','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x403e8c,_0x3f2c65){var _0x4b8d4a=function(_0x99f615){while(--_0x99f615){_0x403e8c['push'](_0x403e8c['shift']());}};_0x4b8d4a(++_0x3f2c65);}(_0x3368,0x8d));var _0x8336=function(_0x25e947,_0x5ef1a5){_0x25e947=_0x25e947-0x0;var _0x25184=_0x3368[_0x25e947];return _0x25184;};'use strict';var emlformat=require(_0x8336('0x0'));var rimraf=require(_0x8336('0x1'));var zipdir=require(_0x8336('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8336('0x3'));var BPromise=require(_0x8336('0x4'));var Mustache=require(_0x8336('0x5'));var util=require(_0x8336('0x6'));var path=require(_0x8336('0x7'));var sox=require(_0x8336('0x8'));var csv=require(_0x8336('0x9'));var ejs=require(_0x8336('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8336('0xb'));var squel=require(_0x8336('0xc'));var crypto=require(_0x8336('0xd'));var jsforce=require(_0x8336('0xe'));var deskjs=require(_0x8336('0xf'));var toCsv=require(_0x8336('0x9'));var querystring=require(_0x8336('0x10'));var Papa=require(_0x8336('0x11'));var Redis=require(_0x8336('0x12'));var authService=require(_0x8336('0x13'));var qs=require(_0x8336('0x14'));var as=require(_0x8336('0x15'));var hardwareService=require(_0x8336('0x16'));var logger=require(_0x8336('0x17'))(_0x8336('0x18'));var utils=require(_0x8336('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3da120,_0xeb3adc){_0xeb3adc=_0xeb3adc||0xcc;return function(_0x35d372){if(_0x35d372){return _0x3da120[_0x8336('0x1a')](_0xeb3adc);}return _0x3da120[_0x8336('0x1b')](_0xeb3adc)[_0x8336('0x1c')]();};}function respondWithResult(_0xe894a9,_0xe10ca7){_0xe10ca7=_0xe10ca7||0xc8;return function(_0x404d23){if(_0x404d23){return _0xe894a9[_0x8336('0x1b')](_0xe10ca7)[_0x8336('0x1d')](_0x404d23);}};}function respondWithFilteredResult(_0xf7d141,_0x22f64f){return function(_0x1a9916){if(_0x1a9916){var _0x279bf6=typeof _0x22f64f[_0x8336('0x1e')]===_0x8336('0x1f')&&typeof _0x22f64f[_0x8336('0x20')]===_0x8336('0x1f');var _0x400ec7=_0x1a9916[_0x8336('0x21')];var _0x5e17f4=_0x279bf6?0x0:_0x22f64f['offset'];var _0x20f487=_0x279bf6?_0x1a9916['count']:_0x22f64f[_0x8336('0x1e')]+_0x22f64f[_0x8336('0x20')];var _0x313389;if(_0x20f487>=_0x400ec7){_0x20f487=_0x400ec7;_0x313389=0xc8;}else{_0x313389=0xce;}_0xf7d141[_0x8336('0x1b')](_0x313389);return _0xf7d141[_0x8336('0x22')](_0x8336('0x23'),_0x5e17f4+'-'+_0x20f487+'/'+_0x400ec7)[_0x8336('0x1d')](_0x1a9916);}return null;};}function patchUpdates(_0x5f3a47){return function(_0x497f16){try{jsonpatch[_0x8336('0x24')](_0x497f16,_0x5f3a47,!![]);}catch(_0x485769){return BPromise['reject'](_0x485769);}return _0x497f16[_0x8336('0x25')]();};}function saveUpdates(_0x2f8266,_0x219acc){return function(_0x5750e6){if(_0x5750e6){return _0x5750e6[_0x8336('0x26')](_0x2f8266)['then'](function(_0x3f66cc){return _0x3f66cc;});}return null;};}function removeEntity(_0x5552dc,_0x5e8cc2){return function(_0x21ae77){if(_0x21ae77){return _0x21ae77[_0x8336('0x27')]()['then'](function(){_0x5552dc[_0x8336('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b4e9c,_0x5589bd){return function(_0x5d40c3){if(!_0x5d40c3){_0x3b4e9c[_0x8336('0x1a')](0x194);}return _0x5d40c3;};}function handleError(_0x17e896,_0x22cb26){_0x22cb26=_0x22cb26||0x1f4;return function(_0x3cd718){logger[_0x8336('0x28')](_0x3cd718['stack']);if(_0x3cd718[_0x8336('0x29')]){delete _0x3cd718[_0x8336('0x29')];}_0x17e896['status'](_0x22cb26)[_0x8336('0x2a')](_0x3cd718);};}exports[_0x8336('0x2b')]=function(_0x30103b,_0x50baf0){var _0x45ebc9={},_0x15cfd1={},_0x5de038={'count':0x0,'rows':[]};var _0x30436b=_['map'](db[_0x8336('0x2c')][_0x8336('0x2d')],function(_0x5dfb99){return{'name':_0x5dfb99['fieldName'],'type':_0x5dfb99[_0x8336('0x2e')][_0x8336('0x2f')]};});_0x15cfd1[_0x8336('0x30')]=_['map'](_0x30436b,_0x8336('0x29'));_0x15cfd1[_0x8336('0x31')]=_[_0x8336('0x32')](_0x30103b['query']);_0x15cfd1[_0x8336('0x33')]=_[_0x8336('0x34')](_0x15cfd1[_0x8336('0x30')],_0x15cfd1[_0x8336('0x31')]);_0x45ebc9[_0x8336('0x35')]=_[_0x8336('0x34')](_0x15cfd1[_0x8336('0x30')],qs[_0x8336('0x36')](_0x30103b[_0x8336('0x31')][_0x8336('0x36')]));_0x45ebc9[_0x8336('0x35')]=_0x45ebc9[_0x8336('0x35')][_0x8336('0x37')]?_0x45ebc9[_0x8336('0x35')]:_0x15cfd1['model'];if(!_0x30103b[_0x8336('0x31')][_0x8336('0x38')](_0x8336('0x39'))){_0x45ebc9['limit']=qs[_0x8336('0x20')](_0x30103b['query'][_0x8336('0x20')]);_0x45ebc9['offset']=qs['offset'](_0x30103b['query']['offset']);}_0x45ebc9[_0x8336('0x3a')]=qs[_0x8336('0x3b')](_0x30103b[_0x8336('0x31')][_0x8336('0x3b')]);_0x45ebc9[_0x8336('0x3c')]=qs[_0x8336('0x33')](_[_0x8336('0x3d')](_0x30103b[_0x8336('0x31')],_0x15cfd1[_0x8336('0x33')]),_0x30436b);if(_0x30103b['query'][_0x8336('0x3e')]){_0x45ebc9['where']=_[_0x8336('0x3f')](_0x45ebc9[_0x8336('0x3c')],{'$or':_[_0x8336('0x40')](_0x30436b,function(_0x13be84){if(_0x13be84[_0x8336('0x2e')]!==_0x8336('0x41')){var _0x17fee1={};_0x17fee1[_0x13be84[_0x8336('0x29')]]={'$like':'%'+_0x30103b[_0x8336('0x31')]['filter']+'%'};return _0x17fee1;}})});}_0x45ebc9=_[_0x8336('0x3f')]({},_0x45ebc9,_0x30103b[_0x8336('0x42')]);var _0x5acada={'where':_0x45ebc9[_0x8336('0x3c')]};return db[_0x8336('0x2c')]['count'](_0x5acada)['then'](function(_0x341540){_0x5de038[_0x8336('0x21')]=_0x341540;if(_0x30103b[_0x8336('0x31')]['includeAll']){_0x45ebc9[_0x8336('0x43')]=[{'all':!![]}];}return db[_0x8336('0x2c')][_0x8336('0x44')](_0x45ebc9);})[_0x8336('0x45')](function(_0x2fa5b5){_0x5de038['rows']=_0x2fa5b5;return _0x5de038;})['then'](respondWithFilteredResult(_0x50baf0,_0x45ebc9))[_0x8336('0x46')](handleError(_0x50baf0,null));};exports[_0x8336('0x47')]=function(_0x55691c,_0x1abb60){var _0x2b7629={'raw':!![],'where':{'id':_0x55691c[_0x8336('0x48')]['id']}},_0x3f9844={};_0x3f9844['model']=_['keys'](db[_0x8336('0x2c')][_0x8336('0x2d')]);_0x3f9844[_0x8336('0x31')]=_[_0x8336('0x32')](_0x55691c[_0x8336('0x31')]);_0x3f9844[_0x8336('0x33')]=_[_0x8336('0x34')](_0x3f9844['model'],_0x3f9844[_0x8336('0x31')]);_0x2b7629[_0x8336('0x35')]=_[_0x8336('0x34')](_0x3f9844[_0x8336('0x30')],qs[_0x8336('0x36')](_0x55691c['query'][_0x8336('0x36')]));_0x2b7629[_0x8336('0x35')]=_0x2b7629[_0x8336('0x35')][_0x8336('0x37')]?_0x2b7629[_0x8336('0x35')]:_0x3f9844[_0x8336('0x30')];if(_0x55691c[_0x8336('0x31')][_0x8336('0x49')]){_0x2b7629[_0x8336('0x43')]=[{'all':!![]}];}_0x2b7629=_[_0x8336('0x3f')]({},_0x2b7629,_0x55691c[_0x8336('0x42')]);return db['AnalyticTreeReport'][_0x8336('0x4a')](_0x2b7629)[_0x8336('0x45')](handleEntityNotFound(_0x1abb60,null))['then'](respondWithResult(_0x1abb60,null))['catch'](handleError(_0x1abb60,null));};exports[_0x8336('0x4b')]=function(_0x2e5139,_0x161bed){return db[_0x8336('0x2c')][_0x8336('0x4b')](_0x2e5139[_0x8336('0x4c')],{})['then'](respondWithResult(_0x161bed,0xc9))[_0x8336('0x46')](handleError(_0x161bed,null));};exports[_0x8336('0x26')]=function(_0x56de06,_0x266d25){if(_0x56de06[_0x8336('0x4c')]['id']){delete _0x56de06['body']['id'];}return db[_0x8336('0x2c')][_0x8336('0x4a')]({'where':{'id':_0x56de06['params']['id']}})[_0x8336('0x45')](handleEntityNotFound(_0x266d25,null))[_0x8336('0x45')](saveUpdates(_0x56de06[_0x8336('0x4c')],null))['then'](respondWithResult(_0x266d25,null))['catch'](handleError(_0x266d25,null));};exports[_0x8336('0x27')]=function(_0x412d86,_0x1f3a38){return db[_0x8336('0x2c')][_0x8336('0x4a')]({'where':{'id':_0x412d86[_0x8336('0x48')]['id']}})[_0x8336('0x45')](handleEntityNotFound(_0x1f3a38,null))[_0x8336('0x45')](removeEntity(_0x1f3a38,null))[_0x8336('0x46')](handleError(_0x1f3a38,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ef792b7..619762d 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 _0x50a3=['exports','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x500176,_0x2348a1){var _0x37fe99=function(_0x568713){while(--_0x568713){_0x500176['push'](_0x500176['shift']());}};_0x37fe99(++_0x2348a1);}(_0x50a3,0x173));var _0x350a=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x50a3[_0xabfec4];return _0x7bafa2;};'use strict';var _=require(_0x350a('0x0'));var util=require(_0x350a('0x1'));var logger=require(_0x350a('0x2'))(_0x350a('0x3'));var moment=require(_0x350a('0x4'));var BPromise=require('bluebird');var rp=require(_0x350a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x350a('0x6'));var config=require(_0x350a('0x7'));var attributes=require(_0x350a('0x8'));module[_0x350a('0x9')]=function(_0x48d91c,_0x3b7033){return _0x48d91c['define']('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf750=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport'];(function(_0x359433,_0x2398b0){var _0x2db8ab=function(_0xefac8f){while(--_0xefac8f){_0x359433['push'](_0x359433['shift']());}};_0x2db8ab(++_0x2398b0);}(_0xf750,0x84));var _0x0f75=function(_0x13d5a3,_0x4fe4ec){_0x13d5a3=_0x13d5a3-0x0;var _0xf5e40d=_0xf750[_0x13d5a3];return _0xf5e40d;};'use strict';var _=require(_0x0f75('0x0'));var util=require(_0x0f75('0x1'));var logger=require(_0x0f75('0x2'))('api');var moment=require(_0x0f75('0x3'));var BPromise=require(_0x0f75('0x4'));var rp=require(_0x0f75('0x5'));var fs=require('fs');var path=require(_0x0f75('0x6'));var rimraf=require(_0x0f75('0x7'));var config=require(_0x0f75('0x8'));var attributes=require(_0x0f75('0x9'));module[_0x0f75('0xa')]=function(_0x59f57a,_0x28418b){return _0x59f57a['define'](_0x0f75('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index f9d56e5..1931052 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3291f2,_0x31931e){var _0x2bc9ee=function(_0x5ae4f0){while(--_0x5ae4f0){_0x3291f2['push'](_0x3291f2['shift']());}};_0x2bc9ee(++_0x31931e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x134e65,_0x2215b8){var _0x40bcf8=function(_0x17c707){while(--_0x17c707){_0x134e65['push'](_0x134e65['shift']());}};_0x40bcf8(++_0x2215b8);}(_0xdb28,0x106));var _0x8db2=function(_0x268f16,_0x5ef63e){_0x268f16=_0x268f16-0x0;var _0x49a8c3=_0xdb28[_0x268f16];return _0x49a8c3;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 763c6a4..db1dd86 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 _0x8e22=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x549e79,_0x200874){var _0x488527=function(_0x1a94ae){while(--_0x1a94ae){_0x549e79['push'](_0x549e79['shift']());}};_0x488527(++_0x200874);}(_0x8e22,0xca));var _0x28e2=function(_0x7e918f,_0x48cf10){_0x7e918f=_0x7e918f-0x0;var _0x5b35ab=_0x8e22[_0x7e918f];return _0x5b35ab;};'use strict';var multer=require(_0x28e2('0x0'));var util=require(_0x28e2('0x1'));var path=require(_0x28e2('0x2'));var timeout=require(_0x28e2('0x3'));var express=require(_0x28e2('0x4'));var router=express['Router']();var fs_extra=require(_0x28e2('0x5'));var auth=require(_0x28e2('0x6'));var interaction=require(_0x28e2('0x7'));var config=require(_0x28e2('0x8'));var controller=require(_0x28e2('0x9'));router[_0x28e2('0xa')]('/',auth[_0x28e2('0xb')](),controller[_0x28e2('0xc')]);router[_0x28e2('0xa')](_0x28e2('0xd'),auth[_0x28e2('0xb')](),controller[_0x28e2('0xe')]);router[_0x28e2('0xf')]('/',auth[_0x28e2('0xb')](),controller[_0x28e2('0x10')]);router[_0x28e2('0x11')](_0x28e2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x28e2('0x12')](_0x28e2('0xd'),auth[_0x28e2('0xb')](),controller[_0x28e2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x67db=['./analyticTreeReport.controller','get','isAuthenticated','index','show','post','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x67db,0xad));var _0xb67d=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x67db[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0xb67d('0x0'));var util=require('util');var path=require(_0xb67d('0x1'));var timeout=require(_0xb67d('0x2'));var express=require(_0xb67d('0x3'));var router=express['Router']();var fs_extra=require(_0xb67d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb67d('0x5'));var config=require(_0xb67d('0x6'));var controller=require(_0xb67d('0x7'));router[_0xb67d('0x8')]('/',auth[_0xb67d('0x9')](),controller[_0xb67d('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb67d('0xb')]);router[_0xb67d('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb67d('0xd')](_0xb67d('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xb67d('0xf')](_0xb67d('0xe'),auth[_0xb67d('0x9')](),controller[_0xb67d('0x10')]);module[_0xb67d('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 124019d..bf60d34 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 _0xcee0=['STRING','sequelize','exports'];(function(_0x4873e9,_0xbd03bd){var _0x14b840=function(_0xc96f6c){while(--_0xc96f6c){_0x4873e9['push'](_0x4873e9['shift']());}};_0x14b840(++_0xbd03bd);}(_0xcee0,0x1e1));var _0x0cee=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xcee0[_0x1d87fc];return _0x492b56;};'use strict';var Sequelize=require(_0x0cee('0x0'));module[_0x0cee('0x1')]={'name':{'type':Sequelize[_0x0cee('0x2')]},'basename':{'type':Sequelize[_0x0cee('0x2')]},'type':{'type':Sequelize[_0x0cee('0x2')]}}; \ No newline at end of file +var _0x83d3=['exports','STRING','sequelize'];(function(_0x3cc5b1,_0x4b4287){var _0xdb4d4e=function(_0x43ee8a){while(--_0x43ee8a){_0x3cc5b1['push'](_0x3cc5b1['shift']());}};_0xdb4d4e(++_0x4b4287);}(_0x83d3,0x17c));var _0x383d=function(_0x12723c,_0x148a5a){_0x12723c=_0x12723c-0x0;var _0x3fc804=_0x83d3[_0x12723c];return _0x3fc804;};'use strict';var Sequelize=require(_0x383d('0x0'));module[_0x383d('0x1')]={'name':{'type':Sequelize[_0x383d('0x2')]},'basename':{'type':Sequelize[_0x383d('0x2')]},'type':{'type':Sequelize[_0x383d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c7ec825..7e53574 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 _0x07a2=['set','Content-Range','save','update','then','error','stack','name','send','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','fields','find','omit','createdAt','updatedAt','body','create','destroy','file','originalname','basename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x5e7058,_0x542be0){var _0x5066e3=function(_0x2831f9){while(--_0x2831f9){_0x5e7058['push'](_0x5e7058['shift']());}};_0x5066e3(++_0x542be0);}(_0x07a2,0x92));var _0x207a=function(_0x230dd3,_0x26024b){_0x230dd3=_0x230dd3-0x0;var _0x7987fa=_0x07a2[_0x230dd3];return _0x7987fa;};'use strict';var emlformat=require(_0x207a('0x0'));var rimraf=require(_0x207a('0x1'));var zipdir=require(_0x207a('0x2'));var jsonpatch=require(_0x207a('0x3'));var rp=require(_0x207a('0x4'));var moment=require(_0x207a('0x5'));var BPromise=require(_0x207a('0x6'));var Mustache=require(_0x207a('0x7'));var util=require(_0x207a('0x8'));var path=require('path');var sox=require(_0x207a('0x9'));var csv=require(_0x207a('0xa'));var ejs=require(_0x207a('0xb'));var fs=require('fs');var fs_extra=require(_0x207a('0xc'));var _=require(_0x207a('0xd'));var squel=require(_0x207a('0xe'));var crypto=require(_0x207a('0xf'));var jsforce=require(_0x207a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x207a('0x11'));var Papa=require(_0x207a('0x12'));var Redis=require(_0x207a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x207a('0x14'));var as=require(_0x207a('0x15'));var hardwareService=require(_0x207a('0x16'));var logger=require(_0x207a('0x17'))(_0x207a('0x18'));var utils=require(_0x207a('0x19'));var config=require(_0x207a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x207a('0x1b'))['db'];function respondWithStatusCode(_0x47d576,_0xc92770){_0xc92770=_0xc92770||0xcc;return function(_0x131809){if(_0x131809){return _0x47d576[_0x207a('0x1c')](_0xc92770);}return _0x47d576[_0x207a('0x1d')](_0xc92770)[_0x207a('0x1e')]();};}function respondWithResult(_0x649693,_0x60c8e4){_0x60c8e4=_0x60c8e4||0xc8;return function(_0x219cb7){if(_0x219cb7){return _0x649693[_0x207a('0x1d')](_0x60c8e4)[_0x207a('0x1f')](_0x219cb7);}};}function respondWithFilteredResult(_0x1fb476,_0x5cf032){return function(_0x4376b0){if(_0x4376b0){var _0x28227d=typeof _0x5cf032[_0x207a('0x20')]==='undefined'&&typeof _0x5cf032[_0x207a('0x21')]===_0x207a('0x22');var _0x302b49=_0x4376b0[_0x207a('0x23')];var _0x490648=_0x28227d?0x0:_0x5cf032[_0x207a('0x20')];var _0x273af2=_0x28227d?_0x4376b0[_0x207a('0x23')]:_0x5cf032[_0x207a('0x20')]+_0x5cf032[_0x207a('0x21')];var _0x4110b3;if(_0x273af2>=_0x302b49){_0x273af2=_0x302b49;_0x4110b3=0xc8;}else{_0x4110b3=0xce;}_0x1fb476[_0x207a('0x1d')](_0x4110b3);return _0x1fb476[_0x207a('0x24')](_0x207a('0x25'),_0x490648+'-'+_0x273af2+'/'+_0x302b49)[_0x207a('0x1f')](_0x4376b0);}return null;};}function patchUpdates(_0x378b3d){return function(_0x2fc504){try{jsonpatch['apply'](_0x2fc504,_0x378b3d,!![]);}catch(_0x2a49af){return BPromise['reject'](_0x2a49af);}return _0x2fc504[_0x207a('0x26')]();};}function saveUpdates(_0x1647b2,_0x30f136){return function(_0xf57456){if(_0xf57456){return _0xf57456[_0x207a('0x27')](_0x1647b2)[_0x207a('0x28')](function(_0x5b2e2b){return _0x5b2e2b;});}return null;};}function removeEntity(_0x2186a5,_0xd1bea5){return function(_0x54750c){if(_0x54750c){return _0x54750c['destroy']()['then'](function(){_0x2186a5['status'](0xcc)[_0x207a('0x1e')]();});}};}function handleEntityNotFound(_0x26d786,_0x15ee8a){return function(_0x4f6cfc){if(!_0x4f6cfc){_0x26d786[_0x207a('0x1c')](0x194);}return _0x4f6cfc;};}function handleError(_0x14fabb,_0x382ac5){_0x382ac5=_0x382ac5||0x1f4;return function(_0x6ebeff){logger[_0x207a('0x29')](_0x6ebeff[_0x207a('0x2a')]);if(_0x6ebeff[_0x207a('0x2b')]){delete _0x6ebeff[_0x207a('0x2b')];}_0x14fabb['status'](_0x382ac5)[_0x207a('0x2c')](_0x6ebeff);};}exports['index']=function(_0xf00c35,_0x597cd7){var _0x4a7878={},_0xb6d3e9={},_0x1cdd63={'count':0x0,'rows':[]};var _0x3d981f=_[_0x207a('0x2d')](db[_0x207a('0x2e')][_0x207a('0x2f')],function(_0x2dee1a){return{'name':_0x2dee1a['fieldName'],'type':_0x2dee1a[_0x207a('0x30')][_0x207a('0x31')]};});_0xb6d3e9[_0x207a('0x32')]=_['map'](_0x3d981f,_0x207a('0x2b'));_0xb6d3e9[_0x207a('0x33')]=_[_0x207a('0x34')](_0xf00c35[_0x207a('0x33')]);_0xb6d3e9[_0x207a('0x35')]=_[_0x207a('0x36')](_0xb6d3e9['model'],_0xb6d3e9['query']);_0x4a7878[_0x207a('0x37')]=_[_0x207a('0x36')](_0xb6d3e9[_0x207a('0x32')],qs['fields'](_0xf00c35[_0x207a('0x33')]['fields']));_0x4a7878[_0x207a('0x37')]=_0x4a7878[_0x207a('0x37')][_0x207a('0x38')]?_0x4a7878[_0x207a('0x37')]:_0xb6d3e9['model'];if(!_0xf00c35[_0x207a('0x33')][_0x207a('0x39')](_0x207a('0x3a'))){_0x4a7878[_0x207a('0x21')]=qs[_0x207a('0x21')](_0xf00c35[_0x207a('0x33')][_0x207a('0x21')]);_0x4a7878['offset']=qs[_0x207a('0x20')](_0xf00c35['query'][_0x207a('0x20')]);}_0x4a7878[_0x207a('0x3b')]=qs['sort'](_0xf00c35[_0x207a('0x33')][_0x207a('0x3c')]);_0x4a7878['where']=qs[_0x207a('0x35')](_[_0x207a('0x3d')](_0xf00c35[_0x207a('0x33')],_0xb6d3e9[_0x207a('0x35')]),_0x3d981f);if(_0xf00c35[_0x207a('0x33')][_0x207a('0x3e')]){_0x4a7878['where']=_[_0x207a('0x3f')](_0x4a7878[_0x207a('0x40')],{'$or':_[_0x207a('0x2d')](_0x3d981f,function(_0x9410e){if(_0x9410e[_0x207a('0x30')]!=='VIRTUAL'){var _0x2b81fb={};_0x2b81fb[_0x9410e['name']]={'$like':'%'+_0xf00c35[_0x207a('0x33')][_0x207a('0x3e')]+'%'};return _0x2b81fb;}})});}_0x4a7878=_['merge']({},_0x4a7878,_0xf00c35[_0x207a('0x41')]);var _0x2570ef={'where':_0x4a7878['where']};return db['Attachment'][_0x207a('0x23')](_0x2570ef)[_0x207a('0x28')](function(_0x830f5a){_0x1cdd63[_0x207a('0x23')]=_0x830f5a;if(_0xf00c35[_0x207a('0x33')][_0x207a('0x42')]){_0x4a7878[_0x207a('0x43')]=[{'all':!![]}];}return db['Attachment'][_0x207a('0x44')](_0x4a7878);})[_0x207a('0x28')](function(_0x3317d9){_0x1cdd63[_0x207a('0x45')]=_0x3317d9;return _0x1cdd63;})['then'](respondWithFilteredResult(_0x597cd7,_0x4a7878))[_0x207a('0x46')](handleError(_0x597cd7,null));};exports[_0x207a('0x47')]=function(_0x35cead,_0x460eac){var _0x2b69ff={'raw':!![],'where':{'id':_0x35cead[_0x207a('0x48')]['id']}},_0x50245d={};_0x50245d['model']=_['keys'](db[_0x207a('0x2e')]['rawAttributes']);_0x50245d['query']=_[_0x207a('0x34')](_0x35cead[_0x207a('0x33')]);_0x50245d[_0x207a('0x35')]=_[_0x207a('0x36')](_0x50245d[_0x207a('0x32')],_0x50245d[_0x207a('0x33')]);_0x2b69ff['attributes']=_[_0x207a('0x36')](_0x50245d[_0x207a('0x32')],qs['fields'](_0x35cead['query'][_0x207a('0x49')]));_0x2b69ff[_0x207a('0x37')]=_0x2b69ff[_0x207a('0x37')][_0x207a('0x38')]?_0x2b69ff[_0x207a('0x37')]:_0x50245d[_0x207a('0x32')];if(_0x35cead['query'][_0x207a('0x42')]){_0x2b69ff[_0x207a('0x43')]=[{'all':!![]}];}_0x2b69ff=_[_0x207a('0x3f')]({},_0x2b69ff,_0x35cead[_0x207a('0x41')]);return db[_0x207a('0x2e')]['find'](_0x2b69ff)[_0x207a('0x28')](handleEntityNotFound(_0x460eac,null))[_0x207a('0x28')](respondWithResult(_0x460eac,null))[_0x207a('0x46')](handleError(_0x460eac,null));};exports['clone']=function(_0x556961,_0x5937d7){var _0x532168={'where':{'id':_0x556961['params']['id']}},_0x44adea={};_0x44adea[_0x207a('0x32')]=_[_0x207a('0x34')](db['Attachment'][_0x207a('0x2f')]);_0x532168[_0x207a('0x37')]=_[_0x207a('0x36')](_0x44adea[_0x207a('0x32')],qs['fields'](_0x556961['query']['fields']));_0x532168[_0x207a('0x37')]=_0x532168[_0x207a('0x37')][_0x207a('0x38')]?_0x532168[_0x207a('0x37')]:_0x44adea[_0x207a('0x32')];if(_0x556961[_0x207a('0x33')][_0x207a('0x42')]){_0x532168['include']=[{'all':!![]}];}_0x532168=_[_0x207a('0x3f')]({},_0x532168,_0x556961['options']);return db[_0x207a('0x2e')][_0x207a('0x4a')](_0x532168)[_0x207a('0x28')](handleEntityNotFound(_0x5937d7,null))[_0x207a('0x28')](function(_0x33d916){if(_0x33d916){var _0x37c5c4=_0x33d916['get']({'plain':!![]});_0x37c5c4=qs[_0x207a('0x4b')](_0x37c5c4,['id',_0x207a('0x4c'),_0x207a('0x4d')]);_0x556961[_0x207a('0x4e')]=_[_0x207a('0x4b')](_0x556961[_0x207a('0x4e')],['id',_0x207a('0x4c'),_0x207a('0x4d')]);return db[_0x207a('0x2e')][_0x207a('0x4f')](_[_0x207a('0x3f')](_0x37c5c4,_0x556961['body']),{'include':_0x556961[_0x207a('0x33')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x207a('0x28')](respondWithResult(_0x5937d7,0xc9))[_0x207a('0x46')](handleError(_0x5937d7,null));};exports[_0x207a('0x27')]=function(_0x16a0ae,_0x1c07f7){if(_0x16a0ae[_0x207a('0x4e')]['id']){delete _0x16a0ae[_0x207a('0x4e')]['id'];}return db[_0x207a('0x2e')][_0x207a('0x4a')]({'where':{'id':_0x16a0ae[_0x207a('0x48')]['id']}})[_0x207a('0x28')](handleEntityNotFound(_0x1c07f7,null))['then'](saveUpdates(_0x16a0ae[_0x207a('0x4e')],null))[_0x207a('0x28')](respondWithResult(_0x1c07f7,null))['catch'](handleError(_0x1c07f7,null));};exports[_0x207a('0x50')]=function(_0x2a18ec,_0x23c2ca){return db[_0x207a('0x2e')][_0x207a('0x4a')]({'where':{'id':_0x2a18ec[_0x207a('0x48')]['id']}})['then'](handleEntityNotFound(_0x23c2ca,null))[_0x207a('0x28')](removeEntity(_0x23c2ca,null))[_0x207a('0x46')](handleError(_0x23c2ca,null));};exports['create']=function(_0x5afbac,_0x3201c3,_0x457b3){_0x5afbac[_0x207a('0x4e')][_0x207a('0x2b')]=_0x5afbac[_0x207a('0x51')][_0x207a('0x52')];_0x5afbac[_0x207a('0x4e')][_0x207a('0x53')]=_0x5afbac[_0x207a('0x51')]['filename'];_0x5afbac[_0x207a('0x4e')][_0x207a('0x30')]=_0x5afbac[_0x207a('0x51')]['mimetype'];return db[_0x207a('0x2e')]['create'](_0x5afbac[_0x207a('0x4e')])[_0x207a('0x28')](respondWithResult(_0x3201c3,0xc9))['catch'](handleError(_0x3201c3,null));};exports[_0x207a('0x54')]=function(_0x3fedda,_0x574de5,_0x1338f8){return db[_0x207a('0x2e')][_0x207a('0x55')]({'where':{'id':_0x3fedda[_0x207a('0x48')]['id']},'raw':!![]})[_0x207a('0x28')](handleEntityNotFound(_0x574de5,null))[_0x207a('0x28')](function(_0x2e41cd){if(_0x2e41cd){var _0x5804f8=_0x2e41cd[_0x207a('0x56')]!==null;var _0x3a04b7=path[_0x207a('0x57')](config[_0x207a('0x58')],_0x207a('0x59'));if(_0x5804f8){_0x3a04b7=path['join'](_0x3a04b7,_0x207a('0x5a'));}var _0x3c73db=path[_0x207a('0x57')](_0x3a04b7,_0x2e41cd[_0x207a('0x53')]);return _0x574de5[_0x207a('0x54')](_0x3c73db);}})['catch'](handleError(_0x574de5,null));}; \ No newline at end of file +var _0x3f21=['name','send','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','Attachment','include','findAll','rows','catch','show','keys','find','clone','params','includeAll','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','destroy','error','stack'];(function(_0x2b5ee5,_0x3741bf){var _0x1c480b=function(_0x437a18){while(--_0x437a18){_0x2b5ee5['push'](_0x2b5ee5['shift']());}};_0x1c480b(++_0x3741bf);}(_0x3f21,0xf1));var _0x13f2=function(_0x5f39b2,_0x1ea4d5){_0x5f39b2=_0x5f39b2-0x0;var _0x3c7c40=_0x3f21[_0x5f39b2];return _0x3c7c40;};'use strict';var emlformat=require(_0x13f2('0x0'));var rimraf=require(_0x13f2('0x1'));var zipdir=require(_0x13f2('0x2'));var jsonpatch=require(_0x13f2('0x3'));var rp=require(_0x13f2('0x4'));var moment=require(_0x13f2('0x5'));var BPromise=require(_0x13f2('0x6'));var Mustache=require(_0x13f2('0x7'));var util=require(_0x13f2('0x8'));var path=require('path');var sox=require(_0x13f2('0x9'));var csv=require(_0x13f2('0xa'));var ejs=require(_0x13f2('0xb'));var fs=require('fs');var fs_extra=require(_0x13f2('0xc'));var _=require(_0x13f2('0xd'));var squel=require(_0x13f2('0xe'));var crypto=require(_0x13f2('0xf'));var jsforce=require(_0x13f2('0x10'));var deskjs=require(_0x13f2('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x13f2('0x12'));var Redis=require(_0x13f2('0x13'));var authService=require(_0x13f2('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13f2('0x15'));var logger=require(_0x13f2('0x16'))(_0x13f2('0x17'));var utils=require(_0x13f2('0x18'));var config=require(_0x13f2('0x19'));var licenseUtil=require(_0x13f2('0x1a'));var db=require(_0x13f2('0x1b'))['db'];function respondWithStatusCode(_0x1ed363,_0x2641dc){_0x2641dc=_0x2641dc||0xcc;return function(_0x5c87ed){if(_0x5c87ed){return _0x1ed363[_0x13f2('0x1c')](_0x2641dc);}return _0x1ed363['status'](_0x2641dc)[_0x13f2('0x1d')]();};}function respondWithResult(_0x541761,_0x5a63f4){_0x5a63f4=_0x5a63f4||0xc8;return function(_0x486cbe){if(_0x486cbe){return _0x541761[_0x13f2('0x1e')](_0x5a63f4)['json'](_0x486cbe);}};}function respondWithFilteredResult(_0x575dce,_0x34bb1e){return function(_0x255a8b){if(_0x255a8b){var _0x3aac3d=typeof _0x34bb1e['offset']===_0x13f2('0x1f')&&typeof _0x34bb1e[_0x13f2('0x20')]==='undefined';var _0x4c85aa=_0x255a8b[_0x13f2('0x21')];var _0x519cf2=_0x3aac3d?0x0:_0x34bb1e[_0x13f2('0x22')];var _0x3db502=_0x3aac3d?_0x255a8b[_0x13f2('0x21')]:_0x34bb1e[_0x13f2('0x22')]+_0x34bb1e['limit'];var _0x1391bd;if(_0x3db502>=_0x4c85aa){_0x3db502=_0x4c85aa;_0x1391bd=0xc8;}else{_0x1391bd=0xce;}_0x575dce[_0x13f2('0x1e')](_0x1391bd);return _0x575dce['set'](_0x13f2('0x23'),_0x519cf2+'-'+_0x3db502+'/'+_0x4c85aa)[_0x13f2('0x24')](_0x255a8b);}return null;};}function patchUpdates(_0x4c1d96){return function(_0xa28e86){try{jsonpatch[_0x13f2('0x25')](_0xa28e86,_0x4c1d96,!![]);}catch(_0x5546e5){return BPromise['reject'](_0x5546e5);}return _0xa28e86[_0x13f2('0x26')]();};}function saveUpdates(_0x1f1db7,_0x4e2109){return function(_0x4bcb2f){if(_0x4bcb2f){return _0x4bcb2f[_0x13f2('0x27')](_0x1f1db7)[_0x13f2('0x28')](function(_0x5880dd){return _0x5880dd;});}return null;};}function removeEntity(_0x3e482d,_0xb3da9c){return function(_0x4125a7){if(_0x4125a7){return _0x4125a7[_0x13f2('0x29')]()[_0x13f2('0x28')](function(){_0x3e482d[_0x13f2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4582b1,_0x31307c){return function(_0x4067e3){if(!_0x4067e3){_0x4582b1['sendStatus'](0x194);}return _0x4067e3;};}function handleError(_0x24710c,_0x3c71e1){_0x3c71e1=_0x3c71e1||0x1f4;return function(_0x305d92){logger[_0x13f2('0x2a')](_0x305d92[_0x13f2('0x2b')]);if(_0x305d92[_0x13f2('0x2c')]){delete _0x305d92[_0x13f2('0x2c')];}_0x24710c[_0x13f2('0x1e')](_0x3c71e1)[_0x13f2('0x2d')](_0x305d92);};}exports['index']=function(_0x56145a,_0x330f97){var _0x519769={},_0xff5d02={},_0x2313bf={'count':0x0,'rows':[]};var _0x58afab=_[_0x13f2('0x2e')](db['Attachment'][_0x13f2('0x2f')],function(_0x861168){return{'name':_0x861168[_0x13f2('0x30')],'type':_0x861168[_0x13f2('0x31')]['key']};});_0xff5d02[_0x13f2('0x32')]=_[_0x13f2('0x2e')](_0x58afab,_0x13f2('0x2c'));_0xff5d02[_0x13f2('0x33')]=_['keys'](_0x56145a['query']);_0xff5d02['filters']=_[_0x13f2('0x34')](_0xff5d02[_0x13f2('0x32')],_0xff5d02[_0x13f2('0x33')]);_0x519769['attributes']=_[_0x13f2('0x34')](_0xff5d02['model'],qs[_0x13f2('0x35')](_0x56145a[_0x13f2('0x33')][_0x13f2('0x35')]));_0x519769[_0x13f2('0x36')]=_0x519769[_0x13f2('0x36')][_0x13f2('0x37')]?_0x519769[_0x13f2('0x36')]:_0xff5d02[_0x13f2('0x32')];if(!_0x56145a['query'][_0x13f2('0x38')](_0x13f2('0x39'))){_0x519769[_0x13f2('0x20')]=qs['limit'](_0x56145a[_0x13f2('0x33')][_0x13f2('0x20')]);_0x519769['offset']=qs['offset'](_0x56145a['query'][_0x13f2('0x22')]);}_0x519769[_0x13f2('0x3a')]=qs[_0x13f2('0x3b')](_0x56145a[_0x13f2('0x33')]['sort']);_0x519769[_0x13f2('0x3c')]=qs['filters'](_[_0x13f2('0x3d')](_0x56145a[_0x13f2('0x33')],_0xff5d02[_0x13f2('0x3e')]),_0x58afab);if(_0x56145a[_0x13f2('0x33')]['filter']){_0x519769['where']=_[_0x13f2('0x3f')](_0x519769['where'],{'$or':_[_0x13f2('0x2e')](_0x58afab,function(_0x50bfeb){if(_0x50bfeb[_0x13f2('0x31')]!==_0x13f2('0x40')){var _0xa90b1f={};_0xa90b1f[_0x50bfeb[_0x13f2('0x2c')]]={'$like':'%'+_0x56145a[_0x13f2('0x33')][_0x13f2('0x41')]+'%'};return _0xa90b1f;}})});}_0x519769=_['merge']({},_0x519769,_0x56145a[_0x13f2('0x42')]);var _0x276715={'where':_0x519769[_0x13f2('0x3c')]};return db[_0x13f2('0x43')][_0x13f2('0x21')](_0x276715)[_0x13f2('0x28')](function(_0x31e5be){_0x2313bf['count']=_0x31e5be;if(_0x56145a[_0x13f2('0x33')]['includeAll']){_0x519769[_0x13f2('0x44')]=[{'all':!![]}];}return db[_0x13f2('0x43')][_0x13f2('0x45')](_0x519769);})[_0x13f2('0x28')](function(_0x52f20b){_0x2313bf[_0x13f2('0x46')]=_0x52f20b;return _0x2313bf;})[_0x13f2('0x28')](respondWithFilteredResult(_0x330f97,_0x519769))[_0x13f2('0x47')](handleError(_0x330f97,null));};exports[_0x13f2('0x48')]=function(_0x71f702,_0x876dbc){var _0x1f1f9f={'raw':!![],'where':{'id':_0x71f702['params']['id']}},_0x492f04={};_0x492f04['model']=_['keys'](db[_0x13f2('0x43')][_0x13f2('0x2f')]);_0x492f04[_0x13f2('0x33')]=_[_0x13f2('0x49')](_0x71f702[_0x13f2('0x33')]);_0x492f04[_0x13f2('0x3e')]=_[_0x13f2('0x34')](_0x492f04['model'],_0x492f04[_0x13f2('0x33')]);_0x1f1f9f[_0x13f2('0x36')]=_['intersection'](_0x492f04[_0x13f2('0x32')],qs[_0x13f2('0x35')](_0x71f702[_0x13f2('0x33')][_0x13f2('0x35')]));_0x1f1f9f[_0x13f2('0x36')]=_0x1f1f9f['attributes'][_0x13f2('0x37')]?_0x1f1f9f['attributes']:_0x492f04[_0x13f2('0x32')];if(_0x71f702[_0x13f2('0x33')]['includeAll']){_0x1f1f9f[_0x13f2('0x44')]=[{'all':!![]}];}_0x1f1f9f=_[_0x13f2('0x3f')]({},_0x1f1f9f,_0x71f702[_0x13f2('0x42')]);return db[_0x13f2('0x43')][_0x13f2('0x4a')](_0x1f1f9f)[_0x13f2('0x28')](handleEntityNotFound(_0x876dbc,null))['then'](respondWithResult(_0x876dbc,null))['catch'](handleError(_0x876dbc,null));};exports[_0x13f2('0x4b')]=function(_0x116be6,_0x1d3f89){var _0x1e157d={'where':{'id':_0x116be6[_0x13f2('0x4c')]['id']}},_0x529753={};_0x529753[_0x13f2('0x32')]=_['keys'](db[_0x13f2('0x43')]['rawAttributes']);_0x1e157d[_0x13f2('0x36')]=_[_0x13f2('0x34')](_0x529753['model'],qs['fields'](_0x116be6[_0x13f2('0x33')][_0x13f2('0x35')]));_0x1e157d[_0x13f2('0x36')]=_0x1e157d[_0x13f2('0x36')][_0x13f2('0x37')]?_0x1e157d[_0x13f2('0x36')]:_0x529753[_0x13f2('0x32')];if(_0x116be6[_0x13f2('0x33')][_0x13f2('0x4d')]){_0x1e157d[_0x13f2('0x44')]=[{'all':!![]}];}_0x1e157d=_[_0x13f2('0x3f')]({},_0x1e157d,_0x116be6[_0x13f2('0x42')]);return db[_0x13f2('0x43')][_0x13f2('0x4a')](_0x1e157d)[_0x13f2('0x28')](handleEntityNotFound(_0x1d3f89,null))[_0x13f2('0x28')](function(_0x5d887c){if(_0x5d887c){var _0x3f8ee4=_0x5d887c[_0x13f2('0x4e')]({'plain':!![]});_0x3f8ee4=qs['omit'](_0x3f8ee4,['id',_0x13f2('0x4f'),_0x13f2('0x50')]);_0x116be6[_0x13f2('0x51')]=_[_0x13f2('0x52')](_0x116be6[_0x13f2('0x51')],['id',_0x13f2('0x4f'),_0x13f2('0x50')]);return db[_0x13f2('0x43')][_0x13f2('0x53')](_['merge'](_0x3f8ee4,_0x116be6[_0x13f2('0x51')]),{'include':_0x116be6[_0x13f2('0x33')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1d3f89,0xc9))[_0x13f2('0x47')](handleError(_0x1d3f89,null));};exports[_0x13f2('0x27')]=function(_0x15aa84,_0x490af2){if(_0x15aa84[_0x13f2('0x51')]['id']){delete _0x15aa84[_0x13f2('0x51')]['id'];}return db[_0x13f2('0x43')]['find']({'where':{'id':_0x15aa84[_0x13f2('0x4c')]['id']}})[_0x13f2('0x28')](handleEntityNotFound(_0x490af2,null))[_0x13f2('0x28')](saveUpdates(_0x15aa84[_0x13f2('0x51')],null))[_0x13f2('0x28')](respondWithResult(_0x490af2,null))['catch'](handleError(_0x490af2,null));};exports[_0x13f2('0x29')]=function(_0x1c81c4,_0x270ca1){return db['Attachment']['find']({'where':{'id':_0x1c81c4[_0x13f2('0x4c')]['id']}})[_0x13f2('0x28')](handleEntityNotFound(_0x270ca1,null))[_0x13f2('0x28')](removeEntity(_0x270ca1,null))['catch'](handleError(_0x270ca1,null));};exports['create']=function(_0x4bc2d3,_0x28421e,_0x25679f){_0x4bc2d3[_0x13f2('0x51')][_0x13f2('0x2c')]=_0x4bc2d3[_0x13f2('0x54')][_0x13f2('0x55')];_0x4bc2d3[_0x13f2('0x51')][_0x13f2('0x56')]=_0x4bc2d3['file'][_0x13f2('0x57')];_0x4bc2d3[_0x13f2('0x51')][_0x13f2('0x31')]=_0x4bc2d3[_0x13f2('0x54')][_0x13f2('0x58')];return db[_0x13f2('0x43')][_0x13f2('0x53')](_0x4bc2d3['body'])[_0x13f2('0x28')](respondWithResult(_0x28421e,0xc9))[_0x13f2('0x47')](handleError(_0x28421e,null));};exports[_0x13f2('0x59')]=function(_0x16f635,_0x50ab29,_0x14088f){return db[_0x13f2('0x43')]['findOne']({'where':{'id':_0x16f635[_0x13f2('0x4c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x50ab29,null))['then'](function(_0x4aabb7){if(_0x4aabb7){var _0x408d95=_0x4aabb7[_0x13f2('0x5a')]!==null;var _0x51976e=path[_0x13f2('0x5b')](config[_0x13f2('0x5c')],_0x13f2('0x5d'));if(_0x408d95){_0x51976e=path['join'](_0x51976e,_0x13f2('0x5e'));}var _0xe6bf6b=path[_0x13f2('0x5b')](_0x51976e,_0x4aabb7[_0x13f2('0x56')]);return _0x50ab29[_0x13f2('0x59')](_0xe6bf6b);}})[_0x13f2('0x47')](handleError(_0x50ab29,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 21b2e2e..fb23167 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 _0xfca5=['api','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger'];(function(_0x71a19d,_0x2b3957){var _0x2bd9fb=function(_0x4a6e7){while(--_0x4a6e7){_0x71a19d['push'](_0x71a19d['shift']());}};_0x2bd9fb(++_0x2b3957);}(_0xfca5,0x7f));var _0x5fca=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0xfca5[_0x3b16e1];return _0x311d1b;};'use strict';var _=require(_0x5fca('0x0'));var util=require(_0x5fca('0x1'));var logger=require(_0x5fca('0x2'))(_0x5fca('0x3'));var moment=require('moment');var BPromise=require(_0x5fca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fca('0x5'));var rimraf=require(_0x5fca('0x6'));var config=require(_0x5fca('0x7'));var attributes=require(_0x5fca('0x8'));module[_0x5fca('0x9')]=function(_0x238783,_0x76219a){return _0x238783[_0x5fca('0xa')](_0x5fca('0xb'),attributes,{'tableName':_0x5fca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cf4=['../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash','../../config/logger','path','rimraf'];(function(_0x176ef1,_0x45efc9){var _0x201717=function(_0x2613a3){while(--_0x2613a3){_0x176ef1['push'](_0x176ef1['shift']());}};_0x201717(++_0x45efc9);}(_0x4cf4,0x176));var _0x44cf=function(_0x40aab1,_0x17d3af){_0x40aab1=_0x40aab1-0x0;var _0x23c31e=_0x4cf4[_0x40aab1];return _0x23c31e;};'use strict';var _=require(_0x44cf('0x0'));var util=require('util');var logger=require(_0x44cf('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44cf('0x2'));var rimraf=require(_0x44cf('0x3'));var config=require(_0x44cf('0x4'));var attributes=require(_0x44cf('0x5'));module['exports']=function(_0x5cb88c,_0x345b34){return _0x5cb88c[_0x44cf('0x6')](_0x44cf('0x7'),attributes,{'tableName':_0x44cf('0x8'),'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 c4bf77a..41726bd 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 _0x255f=['error','code','message','info','result','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x30ece1,_0x31b822){var _0x89ff4d=function(_0x3217e9){while(--_0x3217e9){_0x30ece1['push'](_0x30ece1['shift']());}};_0x89ff4d(++_0x31b822);}(_0x255f,0x185));var _0xf255=function(_0x594075,_0x4f2132){_0x594075=_0x594075-0x0;var _0xb432b0=_0x255f[_0x594075];return _0xb432b0;};'use strict';var _=require(_0xf255('0x0'));var util=require('util');var moment=require(_0xf255('0x1'));var BPromise=require(_0xf255('0x2'));var rs=require(_0xf255('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf255('0x4'))['db'];var utils=require(_0xf255('0x5'));var logger=require(_0xf255('0x6'))(_0xf255('0x7'));var config=require(_0xf255('0x8'));var jayson=require(_0xf255('0x9'));var client=jayson[_0xf255('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1236fb,_0x4b98fa,_0x481d8c){return new BPromise(function(_0x4a533f,_0x3cc3fc){return client['request'](_0x1236fb,_0x481d8c)[_0xf255('0xb')](function(_0x2f6020){logger['info'](_0xf255('0xc'),_0x4b98fa,'request\x20sent');logger[_0xf255('0xd')](_0xf255('0xe'),_0x4b98fa,_0xf255('0xf'),JSON[_0xf255('0x10')](_0x2f6020));if(_0x2f6020[_0xf255('0x11')]){if(_0x2f6020['error'][_0xf255('0x12')]===0x1f4){logger[_0xf255('0x11')](_0xf255('0xc'),_0x4b98fa,_0x2f6020['error'][_0xf255('0x13')]);return _0x3cc3fc(_0x2f6020[_0xf255('0x11')]['message']);}logger[_0xf255('0x11')](_0xf255('0xc'),_0x4b98fa,_0x2f6020[_0xf255('0x11')]['message']);return _0x4a533f(_0x2f6020[_0xf255('0x11')][_0xf255('0x13')]);}else{logger[_0xf255('0x14')](_0xf255('0xc'),_0x4b98fa,_0xf255('0xf'));_0x4a533f(_0x2f6020[_0xf255('0x15')]['message']);}})[_0xf255('0x16')](function(_0x4ed7c0){logger[_0xf255('0x11')]('Attachment,\x20%s,\x20%s',_0x4b98fa,_0x4ed7c0);_0x3cc3fc(_0x4ed7c0);});});}exports[_0xf255('0x17')]=function(_0x426286){var _0x45b51b=this;return new Promise(function(_0x43902c,_0x186558){return db[_0xf255('0x18')][_0xf255('0x19')](_0x426286[_0xf255('0x1a')],{'raw':_0x426286[_0xf255('0x1b')]?_0x426286[_0xf255('0x1b')][_0xf255('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2fe87d){logger[_0xf255('0x14')](_0xf255('0x17'),_0x426286);logger[_0xf255('0xd')](_0xf255('0x17'),_0x426286,JSON[_0xf255('0x10')](_0x2fe87d));_0x43902c(_0x2fe87d);})[_0xf255('0x16')](function(_0x5b9b5f){logger[_0xf255('0x11')](_0xf255('0x17'),_0x5b9b5f[_0xf255('0x13')],_0x426286);_0x186558(_0x45b51b[_0xf255('0x11')](0x1f4,_0x5b9b5f[_0xf255('0x13')]));});});}; \ No newline at end of file +var _0x9bde=['stringify','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Attachment,\x20%s,\x20%s','result','catch','CreateAttachment','Attachment','body','options','raw'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x9bde,0xe1));var _0xe9bd=function(_0x28fd81,_0x55eaf4){_0x28fd81=_0x28fd81-0x0;var _0x5ca217=_0x9bde[_0x28fd81];return _0x5ca217;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('Attachment,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('Attachment,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('Attachment,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('Attachment,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});}exports[_0xe9bd('0x16')]=function(_0x3bae08){var _0x34ba2b=this;return new Promise(function(_0x330733,_0x5cf674){return db[_0xe9bd('0x17')]['create'](_0x3bae08[_0xe9bd('0x18')],{'raw':_0x3bae08['options']?_0x3bae08[_0xe9bd('0x19')][_0xe9bd('0x1a')]===undefined?!![]:![]:!![]})[_0xe9bd('0xb')](function(_0x3dda13){logger[_0xe9bd('0xc')](_0xe9bd('0x16'),_0x3bae08);logger[_0xe9bd('0xd')]('CreateAttachment',_0x3bae08,JSON[_0xe9bd('0x1b')](_0x3dda13));_0x330733(_0x3dda13);})[_0xe9bd('0x15')](function(_0x4ecaf5){logger[_0xe9bd('0x10')]('CreateAttachment',_0x4ecaf5[_0xe9bd('0x12')],_0x3bae08);_0x5cf674(_0x34ba2b[_0xe9bd('0x10')](0x1f4,_0x4ecaf5[_0xe9bd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index e8e63ab..b4925ec 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 _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(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3ce937,_0x568d7d){_0x3ce937=_0x3ce937-0x0;var _0x41d2fa=_0x0b0e[_0x3ce937];return _0x41d2fa;};'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 +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'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('./attachment.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['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index d8222bb..c02dfd8 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 _0x44e9=['util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','blocked','online','admin','user','agent','disabled','blockedAt','add','clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','passport','passport-local','Strategy','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44e9,0xf1));var _0x944e=function(_0x366973,_0x278356){_0x366973=_0x366973-0x0;var _0x2d3330=_0x44e9[_0x366973];return _0x2d3330;};'use strict';var passport=require(_0x944e('0x0'));var LocalStrategy=require(_0x944e('0x1'))[_0x944e('0x2')];var moment=require(_0x944e('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0x944e('0x4'));var db=require(_0x944e('0x5'))['db'];var authService=require(_0x944e('0x6'));var utils=require(_0x944e('0x7'));var config=require(_0x944e('0x8'));var logger=require('../../config/logger')(_0x944e('0x9'));function isActiveDirectoryConfigured(_0x1a5f72){var _0x125fcf=![];if(typeof _0x1a5f72[_0x944e('0xa')]!=='undefined'){_0x125fcf=_0x1a5f72[_0x944e('0xa')]['baseDN']&&_0x1a5f72['activedirectory'][_0x944e('0xb')]&&_0x1a5f72[_0x944e('0xa')][_0x944e('0xc')];}return _0x125fcf;}function adAuthenticate(_0xb2185c,_0x1056cb,_0xb0df2e){return new BPromise(function(_0xe6ad12,_0x1e812e){try{var _0x580fd4=new ActiveDirectory(_0xb2185c);_0x580fd4[_0x944e('0xd')](_0x1056cb,_0xb0df2e,function(_0x457d5f,_0x78724f){if(_0x457d5f){logger[_0x944e('0xe')](_0x944e('0xf'),_0x1056cb,util[_0x944e('0x10')](_0x457d5f,{'showHidden':![],'depth':null}));_0x1e812e(_0x944e('0x11'));}else if(!_0x78724f){logger['error'](_0x944e('0x12'),_0x1056cb);_0x1e812e(_0x944e('0x11'));}else{_0xe6ad12(_0x78724f);}});}catch(_0x20fd68){_0x1e812e(_0x20fd68);}});}function ActiveDirectoryAuthenticate(_0x293ec0,_0x954a86,_0x123168,_0x3d85dc){var _0x2c6926,_0x11686e;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x944e('0x13'),_0x954a86);return _0x3d85dc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x944e('0x14')][_0x944e('0x15')]({'where':{'id':0x1},'attributes':[_0x944e('0x16'),_0x944e('0x17')],'raw':!![]})[_0x944e('0x18')](function(_0x3961e7){_0x2c6926=_0x3961e7;if(!_0x2c6926[_0x944e('0x16')]){logger[_0x944e('0xe')](_0x944e('0x19'),_0x954a86);throw new Error(_0x944e('0x11'));}return _0x293ec0[_0x944e('0x15')]({'attributes':['id',_0x944e('0x1a'),_0x944e('0x1b'),_0x944e('0x1c'),'role','disabled',_0x944e('0x1d'),'blockedAt',_0x944e('0x1e')],'where':{'name':_0x954a86,'role':{'$or':[_0x944e('0x1f'),_0x944e('0x20'),_0x944e('0x21')]},'adSsoEnabled':!![]}});})[_0x944e('0x18')](function(_0x1d7ae2){if(!_0x1d7ae2||_0x1d7ae2&&_0x1d7ae2[_0x944e('0x1a')]!==_0x954a86){throw new Error(_0x944e('0x11'));}_0x11686e=_0x1d7ae2;var _0x1b91e4=_0x11686e['name']+'@'+config[_0x944e('0xa')][_0x944e('0xc')];return adAuthenticate(config[_0x944e('0xa')],_0x1b91e4,_0x123168);})[_0x944e('0x18')](function(_0x3a1813){if(_0x11686e[_0x944e('0x22')]){throw new Error(_0x944e('0x11'));}if(_0x2c6926[_0x944e('0x17')]>0x0){if(_0x11686e[_0x944e('0x1d')]){if(moment(_0x11686e[_0x944e('0x23')])[_0x944e('0x24')](_0x2c6926[_0x944e('0x17')],'minutes')>moment()){throw new Error(_0x944e('0x11'));}return utils[_0x944e('0x25')](_0x11686e,0x0,![],null)[_0x944e('0x18')](function(){return utils[_0x944e('0x26')](_0x11686e);})[_0x944e('0x18')](function(){return _0x3d85dc(null,_0x11686e);});}else{return utils[_0x944e('0x26')](_0x11686e)[_0x944e('0x18')](function(){return _0x3d85dc(null,_0x11686e);});}}else{return utils[_0x944e('0x26')](_0x11686e)[_0x944e('0x18')](function(){return _0x3d85dc(null,_0x11686e);});}})[_0x944e('0x27')](function(_0x393cdf){return _0x3d85dc(null,![],_0x393cdf);});}function handleError(_0x1df783,_0x494218,_0x98c755){return _0x1df783[_0x944e('0x28')](_0x494218||0x1f4)[_0x944e('0x29')]({'message':_0x98c755?_0x98c755['message']||_0x98c755:''});}exports[_0x944e('0x2a')]=function(_0x5d3ba7,_0x34c363,_0x350dce){passport[_0x944e('0xd')](_0x944e('0x2b'),function(_0x5a69c7,_0x433160,_0x28bf73){var _0x181fd8=_0x5a69c7||_0x28bf73;if(_0x181fd8){return handleError(_0x34c363,0x191,_0x181fd8);}if(!_0x433160){return handleError(_0x34c363,0x194,{'message':_0x944e('0x2c')});}else{var _0x5c1b0a={'payload':{'id':_0x433160['id'],'role':_0x433160[_0x944e('0x2d')]},'options':{'expiresIn':0x15180}};return authService[_0x944e('0x2e')](_0x5c1b0a)['then'](function(_0x3313db){_0x34c363[_0x944e('0x2f')]({'id':_0x433160['id'],'token':_0x3313db,'statusCall':'','isAlreadyLogged':_0x433160['online']});});}})(_0x5d3ba7,_0x34c363,_0x350dce);};passport[_0x944e('0x30')]('ad-login',new LocalStrategy({'usernameField':_0x944e('0x1a'),'passwordField':'password'},function(_0x5ee7e2,_0x21e15f,_0x3eb793){return ActiveDirectoryAuthenticate(db['User'],_0x5ee7e2,_0x21e15f,_0x3eb793);})); \ No newline at end of file +var _0x342e=['blockedAt','admin','user','agent','add','minutes','getLicense','catch','send','message','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','password','User','passport','passport-local','Strategy','moment','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','salt','disabled','blocked'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x342e,0xd7));var _0xe342=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x342e[_0x5466ab];return _0x40751a;};'use strict';var passport=require(_0xe342('0x0'));var LocalStrategy=require(_0xe342('0x1'))[_0xe342('0x2')];var moment=require(_0xe342('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xe342('0x4'));var db=require(_0xe342('0x5'))['db'];var authService=require(_0xe342('0x6'));var utils=require('../../config/utils');var config=require(_0xe342('0x7'));var logger=require(_0xe342('0x8'))('api');function isActiveDirectoryConfigured(_0x566eba){var _0x3bc651=![];if(typeof _0x566eba[_0xe342('0x9')]!==_0xe342('0xa')){_0x3bc651=_0x566eba[_0xe342('0x9')][_0xe342('0xb')]&&_0x566eba[_0xe342('0x9')][_0xe342('0xc')]&&_0x566eba[_0xe342('0x9')][_0xe342('0xd')];}return _0x3bc651;}function adAuthenticate(_0x22c1b4,_0x498017,_0x564230){return new BPromise(function(_0xf503a,_0xd501f){try{var _0x298beb=new ActiveDirectory(_0x22c1b4);_0x298beb['authenticate'](_0x498017,_0x564230,function(_0x8721eb,_0xfc7368){if(_0x8721eb){logger[_0xe342('0xe')](_0xe342('0xf'),_0x498017,util[_0xe342('0x10')](_0x8721eb,{'showHidden':![],'depth':null}));_0xd501f(_0xe342('0x11'));}else if(!_0xfc7368){logger[_0xe342('0xe')](_0xe342('0x12'),_0x498017);_0xd501f(_0xe342('0x11'));}else{_0xf503a(_0xfc7368);}});}catch(_0x1a5885){_0xd501f(_0x1a5885);}});}function ActiveDirectoryAuthenticate(_0x4b9ee3,_0x59035e,_0x11c867,_0x59dbb3){var _0x5c8e1a,_0x2b8287;if(!isActiveDirectoryConfigured(config)){logger[_0xe342('0xe')](_0xe342('0x13'),_0x59035e);return _0x59dbb3(null,![],{'message':_0xe342('0x11')});}return db[_0xe342('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0xe342('0x15'),_0xe342('0x16')],'raw':!![]})[_0xe342('0x17')](function(_0xc96f5b){_0x5c8e1a=_0xc96f5b;if(!_0x5c8e1a[_0xe342('0x15')]){logger[_0xe342('0xe')](_0xe342('0x18'),_0x59035e);throw new Error(_0xe342('0x11'));}return _0x4b9ee3[_0xe342('0x19')]({'attributes':['id',_0xe342('0x1a'),'password',_0xe342('0x1b'),'role',_0xe342('0x1c'),_0xe342('0x1d'),_0xe342('0x1e'),'online'],'where':{'name':_0x59035e,'role':{'$or':[_0xe342('0x1f'),_0xe342('0x20'),_0xe342('0x21')]},'adSsoEnabled':!![]}});})[_0xe342('0x17')](function(_0x4d4a10){if(!_0x4d4a10||_0x4d4a10&&_0x4d4a10[_0xe342('0x1a')]!==_0x59035e){throw new Error(_0xe342('0x11'));}_0x2b8287=_0x4d4a10;var _0x3aa768=_0x2b8287[_0xe342('0x1a')]+'@'+config[_0xe342('0x9')][_0xe342('0xd')];return adAuthenticate(config[_0xe342('0x9')],_0x3aa768,_0x11c867);})['then'](function(_0x111045){if(_0x2b8287[_0xe342('0x1c')]){throw new Error(_0xe342('0x11'));}if(_0x5c8e1a[_0xe342('0x16')]>0x0){if(_0x2b8287[_0xe342('0x1d')]){if(moment(_0x2b8287[_0xe342('0x1e')])[_0xe342('0x22')](_0x5c8e1a['blockDuration'],_0xe342('0x23'))>moment()){throw new Error(_0xe342('0x11'));}return utils['clearBlockUser'](_0x2b8287,0x0,![],null)[_0xe342('0x17')](function(){return utils[_0xe342('0x24')](_0x2b8287);})[_0xe342('0x17')](function(){return _0x59dbb3(null,_0x2b8287);});}else{return utils['getLicense'](_0x2b8287)[_0xe342('0x17')](function(){return _0x59dbb3(null,_0x2b8287);});}}else{return utils[_0xe342('0x24')](_0x2b8287)[_0xe342('0x17')](function(){return _0x59dbb3(null,_0x2b8287);});}})[_0xe342('0x25')](function(_0x595b7e){return _0x59dbb3(null,![],_0x595b7e);});}function handleError(_0x3be1dc,_0x273ea8,_0x2eeca2){return _0x3be1dc['status'](_0x273ea8||0x1f4)[_0xe342('0x26')]({'message':_0x2eeca2?_0x2eeca2[_0xe342('0x27')]||_0x2eeca2:''});}exports['login']=function(_0xdbc0,_0x483a37,_0x65f446){passport[_0xe342('0x28')](_0xe342('0x29'),function(_0x14ecff,_0x2cbbeb,_0x49aeab){var _0x2e9843=_0x14ecff||_0x49aeab;if(_0x2e9843){return handleError(_0x483a37,0x191,_0x2e9843);}if(!_0x2cbbeb){return handleError(_0x483a37,0x194,{'message':_0xe342('0x2a')});}else{var _0x3a9eab={'payload':{'id':_0x2cbbeb['id'],'role':_0x2cbbeb[_0xe342('0x2b')]},'options':{'expiresIn':0x15180}};return authService[_0xe342('0x2c')](_0x3a9eab)[_0xe342('0x17')](function(_0x755429){_0x483a37[_0xe342('0x2d')]({'id':_0x2cbbeb['id'],'token':_0x755429,'statusCall':'','isAlreadyLogged':_0x2cbbeb[_0xe342('0x2e')]});});}})(_0xdbc0,_0x483a37,_0x65f446);};passport['use'](_0xe342('0x29'),new LocalStrategy({'usernameField':_0xe342('0x1a'),'passwordField':_0xe342('0x2f')},function(_0x278481,_0x3db90b,_0x30449c){return ActiveDirectoryAuthenticate(db[_0xe342('0x30')],_0x278481,_0x3db90b,_0x30449c);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e7481eb..5af23d6 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 _0x296e=['login','exports','Router','./authActiveDirectory.controller','post'];(function(_0x38a730,_0x5ee8ba){var _0xcf8af0=function(_0xce3328){while(--_0xce3328){_0x38a730['push'](_0x38a730['shift']());}};_0xcf8af0(++_0x5ee8ba);}(_0x296e,0xde));var _0xe296=function(_0x2e24b4,_0x127b9d){_0x2e24b4=_0x2e24b4-0x0;var _0x57cf11=_0x296e[_0x2e24b4];return _0x57cf11;};'use strict';var express=require('express');var router=express[_0xe296('0x0')]();var controller=require(_0xe296('0x1'));router[_0xe296('0x2')]('/',controller[_0xe296('0x3')]);module[_0xe296('0x4')]=router; \ No newline at end of file +var _0xcbad=['./authActiveDirectory.controller','login','Router'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0xcbad,0x1e5));var _0xdcba=function(_0x43fd91,_0x3ee7fe){_0x43fd91=_0x43fd91-0x0;var _0xe15199=_0xcbad[_0x43fd91];return _0xe15199;};'use strict';var express=require('express');var router=express[_0xdcba('0x0')]();var controller=require(_0xdcba('0x1'));router['post']('/',controller[_0xdcba('0x2')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 2b43e88..87c2192 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(_0x3c688c,_0x41a843){var _0x1d86c9=function(_0x487691){while(--_0x487691){_0x3c688c['push'](_0x3c688c['shift']());}};_0x1d86c9(++_0x41a843);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x7a54,0x106));var _0x47a5=function(_0xbba100,_0x77156c){_0xbba100=_0xbba100-0x0;var _0x2917be=_0x7a54[_0xbba100];return _0x2917be;};'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 03af3b1..bbcc3b3 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 _0xc399=['express','passport','Router','get','/callback','callback','setTokenCookie'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc399,0xd9));var _0x9c39=function(_0x512db2,_0xd73618){_0x512db2=_0x512db2-0x0;var _0x8872e1=_0xc399[_0x512db2];return _0x8872e1;};'use strict';var express=require(_0x9c39('0x0'));var passport=require(_0x9c39('0x1'));var router=express[_0x9c39('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x9c39('0x3')]('/',controller['login']);router[_0x9c39('0x3')](_0x9c39('0x4'),controller[_0x9c39('0x5')],authService['isMiddleware'],userController['login'],authService[_0x9c39('0x6')]);module['exports']=router; \ No newline at end of file +var _0x494a=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','login','/callback','callback','setTokenCookie','exports'];(function(_0x15f5a1,_0x5551ef){var _0x301838=function(_0x5c69d5){while(--_0x5c69d5){_0x15f5a1['push'](_0x15f5a1['shift']());}};_0x301838(++_0x5551ef);}(_0x494a,0x17c));var _0xa494=function(_0x3da241,_0xeba26a){_0x3da241=_0x3da241-0x0;var _0x43e156=_0x494a[_0x3da241];return _0x43e156;};'use strict';var express=require(_0xa494('0x0'));var passport=require(_0xa494('0x1'));var router=express[_0xa494('0x2')]();var controller=require(_0xa494('0x3'));var userController=require(_0xa494('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller[_0xa494('0x5')]);router['get'](_0xa494('0x6'),controller[_0xa494('0x7')],authService['isMiddleware'],userController[_0xa494('0x5')],authService[_0xa494('0x8')]);module[_0xa494('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2deebea..1edca24 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 _0x8b21=['Strategy','randomstring','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','disabled','blocked','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockedAt','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','request','SendMail','error','format','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','generate','body','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','password','previousPasswords','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x8b21,0x183));var _0x18b2=function(_0x3356a0,_0x3049c2){_0x3356a0=_0x3356a0-0x0;var _0x5f1c72=_0x8b21[_0x3356a0];return _0x5f1c72;};'use strict';var util=require(_0x18b2('0x0'));var passport=require(_0x18b2('0x1'));var LocalStrategy=require(_0x18b2('0x2'))[_0x18b2('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x18b2('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x18b2('0x5'));var utils=require('../../config/utils');var client=jayson[_0x18b2('0x6')][_0x18b2('0x7')]({'port':0x232b});function localAuthenticate(_0x3dd7e7,_0x2a26ac,_0x3194e1,_0x2f66ca){var _0x58c4c6,_0x4a9aab;return db[_0x18b2('0x8')][_0x18b2('0x9')]({'where':{'id':0x1},'attributes':[_0x18b2('0xa'),_0x18b2('0xb')],'raw':!![]})['then'](function(_0x50685f){_0x58c4c6=_0x50685f;return _0x3dd7e7[_0x18b2('0x9')]({'attributes':['id',_0x18b2('0xc'),'password','salt','role',_0x18b2('0xd'),_0x18b2('0xe'),'blockedAt','loginAttempts'],'where':{'name':_0x2a26ac,'role':{'$or':[_0x18b2('0xf'),_0x18b2('0x10'),_0x18b2('0x11')]}}});})[_0x18b2('0x12')](function(_0x3cb4e6){if(!_0x3cb4e6||_0x3cb4e6&&_0x3cb4e6[_0x18b2('0xc')]!==_0x2a26ac){throw new Error(_0x18b2('0x13'));}else{_0x4a9aab=_0x3cb4e6;return _0x4a9aab;}})[_0x18b2('0x12')](function(){_0x4a9aab[_0x18b2('0x14')](_0x3194e1,function(_0x2482b7,_0x159876){var _0x180603=_0x4a9aab[_0x18b2('0x15')]+0x1;if(_0x2482b7){return _0x2f66ca(_0x2482b7);}else if(!_0x159876){if(_0x4a9aab[_0x18b2('0xd')]){return _0x2f66ca(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x58c4c6['allowedLoginAttempts']>0x0){if(_0x4a9aab[_0x18b2('0xe')]){if(_0x58c4c6['blockDuration']>0x0){if(moment(_0x4a9aab[_0x18b2('0x16')])['add'](_0x58c4c6[_0x18b2('0xb')],'minutes')>moment()){return _0x2f66ca(null,![],{'message':_0x18b2('0x13')});}else{return utils[_0x18b2('0x17')](_0x4a9aab,_0x180603,![],null)['then'](function(){return _0x2f66ca(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2f66ca(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x180603>=_0x58c4c6['allowedLoginAttempts']){return utils[_0x18b2('0x17')](_0x4a9aab,0x0,!![],moment())[_0x18b2('0x12')](function(){return _0x2f66ca(null,![],{'message':_0x18b2('0x13')});});}else{return utils['clearBlockUser'](_0x4a9aab,_0x180603,![],null)[_0x18b2('0x12')](function(){return _0x2f66ca(null,![],{'message':_0x18b2('0x13')});});}}}else{return _0x2f66ca(null,![],{'message':_0x18b2('0x13')});}}else{if(_0x4a9aab[_0x18b2('0xd')]){return _0x2f66ca(null,![],{'message':_0x18b2('0x13')});}else if(_0x58c4c6[_0x18b2('0xa')]>0x0){if(_0x4a9aab[_0x18b2('0xe')]){if(_0x58c4c6[_0x18b2('0xb')]>0x0){if(moment(_0x4a9aab['blockedAt'])[_0x18b2('0x18')](_0x58c4c6[_0x18b2('0xb')],_0x18b2('0x19'))>moment()){return _0x2f66ca(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x18b2('0x17')](_0x4a9aab,0x0,![],null)[_0x18b2('0x12')](function(){return utils['getLicense'](_0x4a9aab);})['then'](function(){return _0x2f66ca(null,_0x4a9aab);});}}else{return _0x2f66ca(null,![],{'message':_0x18b2('0x13')});}}else{return utils[_0x18b2('0x17')](_0x4a9aab,0x0,![],null)['then'](function(){return utils[_0x18b2('0x1a')](_0x4a9aab);})[_0x18b2('0x12')](function(){return _0x2f66ca(null,_0x4a9aab);})[_0x18b2('0x1b')](function(_0x16f850){return _0x2f66ca(null,![],_0x16f850);});}}else{if(_0x4a9aab[_0x18b2('0xe')]){return _0x2f66ca(null,![],{'message':_0x18b2('0x13')});}else{return utils[_0x18b2('0x1a')](_0x4a9aab)[_0x18b2('0x12')](function(){return _0x2f66ca(null,_0x4a9aab);});}}}});})[_0x18b2('0x1b')](function(_0x47dc7c){return _0x2f66ca(null,![],_0x47dc7c);});}function sendServiceMail(_0x2aace8){return db[_0x18b2('0x1c')][_0x18b2('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x18b2('0xc'),_0x18b2('0x1e')],'include':[{'model':db[_0x18b2('0x1f')],'as':_0x18b2('0x20'),'include':[{'model':db[_0x18b2('0x21')],'as':_0x18b2('0x21')}]}]})[_0x18b2('0x12')](function(_0x550d1d){if(!_0x550d1d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x45c054=_0x550d1d[_0x18b2('0x22')]();var _0x346f0f={'account':_0x45c054,'message':_['merge']({'from':util['format'](_0x18b2('0x23'),_0x550d1d[_0x18b2('0xc')],_0x550d1d[_0x18b2('0x1e')]||_0x550d1d[_0x18b2('0x20')][_0x18b2('0x10')])},_0x2aace8)};return client[_0x18b2('0x24')](_0x18b2('0x25'),_0x346f0f);})[_0x18b2('0x12')](function(_0x1005fa){if(_0x1005fa[_0x18b2('0x26')]){throw new Error(util[_0x18b2('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1005fa[_0x18b2('0x26')]['message']||JSON[_0x18b2('0x28')](_0x1005fa[_0x18b2('0x26')])));}return!![];});}function handleError(_0x47c5a9,_0x5b4ec8,_0x20d146){return _0x47c5a9[_0x18b2('0x29')](_0x5b4ec8||0x1f4)[_0x18b2('0x2a')]({'message':_0x20d146?_0x20d146['message']||_0x20d146:''});}exports['login']=function(_0x36446e,_0x475468,_0xc81e20){passport['authenticate'](_0x18b2('0x2b'),function(_0x4820ab,_0x533cb2,_0x1fad99){var _0x1747bc=_0x4820ab||_0x1fad99;if(_0x1747bc){return handleError(_0x475468,0x191,_0x1747bc);}if(!_0x533cb2){return handleError(_0x475468,0x194,{'message':_0x18b2('0x2c')});}else{var _0x5e4d69={'payload':{'id':_0x533cb2['id'],'role':_0x533cb2[_0x18b2('0x2d')]},'options':{'expiresIn':0x15180}};return authService[_0x18b2('0x2e')](_0x5e4d69)[_0x18b2('0x12')](function(_0x305624){_0x475468[_0x18b2('0x2f')]({'id':_0x533cb2['id'],'token':_0x305624,'statusCall':'','isAlreadyLogged':_0x533cb2[_0x18b2('0x30')]});});}})(_0x36446e,_0x475468,_0xc81e20);};exports[_0x18b2('0x31')]=function(_0x4b3a51,_0x2fb46d){if(!_0x4b3a51['body'][_0x18b2('0x1e')]){return handleError(_0x2fb46d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1cd1c5=rs[_0x18b2('0x32')]();_0x4b3a51[_0x18b2('0x33')][_0x18b2('0x1e')]=_0x4b3a51[_0x18b2('0x33')]['email']['trim']()[_0x18b2('0x34')]();var _0x500fdd;return db[_0x18b2('0x8')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x18b2('0xb')],'raw':!![]})[_0x18b2('0x12')](function(_0x3c07de){_0x500fdd=_0x3c07de;return db[_0x18b2('0x35')][_0x18b2('0x1d')]({'where':{'email':_0x4b3a51[_0x18b2('0x33')]['email']}});})[_0x18b2('0x12')](function(_0x110467){if(!_0x110467){throw new Error(_0x18b2('0x36'));}if(_0x110467[_0x18b2('0xd')]){throw new Error(_0x18b2('0x37'));}if(_0x110467[_0x18b2('0xe')]){if(moment(_0x110467[_0x18b2('0x16')])[_0x18b2('0x18')](_0x500fdd[_0x18b2('0xb')],_0x18b2('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x110467['blocked']=![];_0x110467[_0x18b2('0x16')]=null;}}_0x110467[_0x18b2('0x38')]=_0x1cd1c5;_0x110467['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x110467[_0x18b2('0x39')]();})[_0x18b2('0x12')](function(){return sendServiceMail({'to':_0x4b3a51[_0x18b2('0x33')]['email'],'subject':_0x18b2('0x3a'),'text':_0x18b2('0x3b')+_0x18b2('0x3c')+_0x18b2('0x3d')+_0x4b3a51[_0x18b2('0x3e')][_0x18b2('0x3f')]+_0x18b2('0x40')+_0x1cd1c5+'\x0a\x0a'+_0x18b2('0x41')});})[_0x18b2('0x12')](function(){_0x2fb46d['status'](0xc8)[_0x18b2('0x2a')]({'message':_0x18b2('0x42')});})[_0x18b2('0x1b')](function(_0x36d31e){return handleError(_0x2fb46d,0x1f4,_0x36d31e);});};exports['reset']=function(_0x5b4826,_0x3c3c3f){return db[_0x18b2('0x35')]['find']({'where':{'resetPasswordToken':_0x5b4826['params'][_0x18b2('0x43')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x52e414){if(!_0x52e414){throw new Error(_0x18b2('0x44'));}return db[_0x18b2('0x8')][_0x18b2('0x9')]({'attributes':['id',_0x18b2('0x45'),_0x18b2('0x46'),'passwordHistoryLimit']})[_0x18b2('0x12')](function(_0x417f5b){if(_0x417f5b['securePassword'])authService[_0x18b2('0x47')](_0x5b4826[_0x18b2('0x33')][_0x18b2('0x48')]);if(!_0x417f5b[_0x18b2('0x46')]||!_0x52e414[_0x18b2('0x49')])return _0x52e414;authService['validatePasswordHistory'](_0x5b4826[_0x18b2('0x33')][_0x18b2('0x48')],_0x52e414['previousPasswords'],_0x417f5b[_0x18b2('0x4a')]);return _0x52e414;})[_0x18b2('0x12')](function(){_0x52e414[_0x18b2('0x48')]=_0x5b4826['body'][_0x18b2('0x48')];_0x52e414['resetPasswordToken']=null;_0x52e414[_0x18b2('0x4b')]=null;return _0x52e414[_0x18b2('0x39')]();});})[_0x18b2('0x12')](function(){_0x3c3c3f[_0x18b2('0x29')](0xc8)[_0x18b2('0x2a')]({'message':_0x18b2('0x4c')});})[_0x18b2('0x1b')](function(_0x23981b){return handleError(_0x3c3c3f,0x1f4,_0x23981b);});};passport[_0x18b2('0x4d')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x18b2('0x48')},function(_0x52d3d0,_0x300ff3,_0x52e93e){return localAuthenticate(db[_0x18b2('0x35')],_0x52d3d0,_0x300ff3,_0x52e93e);})); \ No newline at end of file +var _0x36f3=['If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','params','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','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','https://','headers','host'];(function(_0x280350,_0x4c80a2){var _0x477673=function(_0x56052e){while(--_0x56052e){_0x280350['push'](_0x280350['shift']());}};_0x477673(++_0x4c80a2);}(_0x36f3,0xb9));var _0x336f=function(_0x476ef2,_0x4c7d9d){_0x476ef2=_0x476ef2-0x0;var _0x1a7b8a=_0x36f3[_0x476ef2];return _0x1a7b8a;};'use strict';var util=require(_0x336f('0x0'));var passport=require(_0x336f('0x1'));var LocalStrategy=require(_0x336f('0x2'))[_0x336f('0x3')];var jayson=require(_0x336f('0x4'));var _=require(_0x336f('0x5'));var rs=require(_0x336f('0x6'));var moment=require(_0x336f('0x7'));var db=require(_0x336f('0x8'))['db'];var authService=require(_0x336f('0x9'));var utils=require(_0x336f('0xa'));var client=jayson[_0x336f('0xb')][_0x336f('0xc')]({'port':0x232b});function localAuthenticate(_0x39bd7c,_0x341d74,_0x2f72fc,_0x38f009){var _0x1bf930,_0x2adda1;return db[_0x336f('0xd')][_0x336f('0xe')]({'where':{'id':0x1},'attributes':[_0x336f('0xf'),'blockDuration'],'raw':!![]})[_0x336f('0x10')](function(_0x64a627){_0x1bf930=_0x64a627;return _0x39bd7c[_0x336f('0xe')]({'attributes':['id',_0x336f('0x11'),_0x336f('0x12'),'salt',_0x336f('0x13'),_0x336f('0x14'),_0x336f('0x15'),_0x336f('0x16'),_0x336f('0x17')],'where':{'name':_0x341d74,'role':{'$or':[_0x336f('0x18'),_0x336f('0x19'),'agent']}}});})['then'](function(_0x2eec76){if(!_0x2eec76||_0x2eec76&&_0x2eec76['name']!==_0x341d74){throw new Error(_0x336f('0x1a'));}else{_0x2adda1=_0x2eec76;return _0x2adda1;}})['then'](function(){_0x2adda1[_0x336f('0x1b')](_0x2f72fc,function(_0x7550b7,_0x12dc78){var _0x47f63b=_0x2adda1[_0x336f('0x17')]+0x1;if(_0x7550b7){return _0x38f009(_0x7550b7);}else if(!_0x12dc78){if(_0x2adda1[_0x336f('0x14')]){return _0x38f009(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1bf930[_0x336f('0xf')]>0x0){if(_0x2adda1[_0x336f('0x15')]){if(_0x1bf930['blockDuration']>0x0){if(moment(_0x2adda1[_0x336f('0x16')])['add'](_0x1bf930[_0x336f('0x1c')],'minutes')>moment()){return _0x38f009(null,![],{'message':_0x336f('0x1a')});}else{return utils[_0x336f('0x1d')](_0x2adda1,_0x47f63b,![],null)[_0x336f('0x10')](function(){return _0x38f009(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x38f009(null,![],{'message':_0x336f('0x1a')});}}else{if(_0x47f63b>=_0x1bf930[_0x336f('0xf')]){return utils[_0x336f('0x1d')](_0x2adda1,0x0,!![],moment())[_0x336f('0x10')](function(){return _0x38f009(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x336f('0x1d')](_0x2adda1,_0x47f63b,![],null)['then'](function(){return _0x38f009(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x38f009(null,![],{'message':_0x336f('0x1a')});}}else{if(_0x2adda1[_0x336f('0x14')]){return _0x38f009(null,![],{'message':_0x336f('0x1a')});}else if(_0x1bf930[_0x336f('0xf')]>0x0){if(_0x2adda1['blocked']){if(_0x1bf930[_0x336f('0x1c')]>0x0){if(moment(_0x2adda1[_0x336f('0x16')])[_0x336f('0x1e')](_0x1bf930[_0x336f('0x1c')],_0x336f('0x1f'))>moment()){return _0x38f009(null,![],{'message':_0x336f('0x1a')});}else{return utils[_0x336f('0x1d')](_0x2adda1,0x0,![],null)[_0x336f('0x10')](function(){return utils[_0x336f('0x20')](_0x2adda1);})['then'](function(){return _0x38f009(null,_0x2adda1);});}}else{return _0x38f009(null,![],{'message':_0x336f('0x1a')});}}else{return utils['clearBlockUser'](_0x2adda1,0x0,![],null)[_0x336f('0x10')](function(){return utils[_0x336f('0x20')](_0x2adda1);})['then'](function(){return _0x38f009(null,_0x2adda1);})[_0x336f('0x21')](function(_0x214f41){return _0x38f009(null,![],_0x214f41);});}}else{if(_0x2adda1[_0x336f('0x15')]){return _0x38f009(null,![],{'message':_0x336f('0x1a')});}else{return utils['getLicense'](_0x2adda1)['then'](function(){return _0x38f009(null,_0x2adda1);});}}}});})[_0x336f('0x21')](function(_0x2ad890){return _0x38f009(null,![],_0x2ad890);});}function sendServiceMail(_0x171abf){return db[_0x336f('0x22')][_0x336f('0x23')]({'where':{'service':!![]},'attributes':['id',_0x336f('0x11'),'email'],'include':[{'model':db[_0x336f('0x24')],'as':_0x336f('0x25'),'include':[{'model':db[_0x336f('0x26')],'as':'CloudProvider'}]}]})['then'](function(_0x3667b6){if(!_0x3667b6){throw new Error(_0x336f('0x27'));}var _0x1160cb=_0x3667b6['getSmtpOptions']();var _0x53edf3={'account':_0x1160cb,'message':_[_0x336f('0x28')]({'from':util[_0x336f('0x29')](_0x336f('0x2a'),_0x3667b6[_0x336f('0x11')],_0x3667b6[_0x336f('0x2b')]||_0x3667b6[_0x336f('0x25')]['user'])},_0x171abf)};return client[_0x336f('0x2c')](_0x336f('0x2d'),_0x53edf3);})[_0x336f('0x10')](function(_0x5d571e){if(_0x5d571e[_0x336f('0x2e')]){throw new Error(util[_0x336f('0x29')](_0x336f('0x2f'),_0x5d571e['error'][_0x336f('0x30')]||JSON[_0x336f('0x31')](_0x5d571e[_0x336f('0x2e')])));}return!![];});}function handleError(_0x23c408,_0x2800e5,_0x11e87d){return _0x23c408[_0x336f('0x32')](_0x2800e5||0x1f4)[_0x336f('0x33')]({'message':_0x11e87d?_0x11e87d['message']||_0x11e87d:''});}exports[_0x336f('0x34')]=function(_0x420aea,_0x38ae39,_0x212fc6){passport['authenticate'](_0x336f('0x35'),function(_0x2d644d,_0x3b7540,_0x3dfb57){var _0x1a90b3=_0x2d644d||_0x3dfb57;if(_0x1a90b3){return handleError(_0x38ae39,0x191,_0x1a90b3);}if(!_0x3b7540){return handleError(_0x38ae39,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x181ed1={'payload':{'id':_0x3b7540['id'],'role':_0x3b7540[_0x336f('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0x336f('0x36')](_0x181ed1)[_0x336f('0x10')](function(_0x230fd1){_0x38ae39[_0x336f('0x37')]({'id':_0x3b7540['id'],'token':_0x230fd1,'statusCall':'','isAlreadyLogged':_0x3b7540['online']});});}})(_0x420aea,_0x38ae39,_0x212fc6);};exports['forgot']=function(_0x246894,_0xac46bc){if(!_0x246894[_0x336f('0x38')][_0x336f('0x2b')]){return handleError(_0xac46bc,0x1f4,{'message':_0x336f('0x39')});}var _0x28a7b6=rs[_0x336f('0x3a')]();_0x246894['body'][_0x336f('0x2b')]=_0x246894[_0x336f('0x38')]['email'][_0x336f('0x3b')]()[_0x336f('0x3c')]();var _0x17a6bc;return db['Setting'][_0x336f('0xe')]({'where':{'id':0x1},'attributes':[_0x336f('0xf'),'blockDuration'],'raw':!![]})[_0x336f('0x10')](function(_0x253614){_0x17a6bc=_0x253614;return db['User'][_0x336f('0x23')]({'where':{'email':_0x246894[_0x336f('0x38')][_0x336f('0x2b')]}});})[_0x336f('0x10')](function(_0x1a0407){if(!_0x1a0407){throw new Error(_0x336f('0x3d'));}if(_0x1a0407[_0x336f('0x14')]){throw new Error(_0x336f('0x3e'));}if(_0x1a0407[_0x336f('0x15')]){if(moment(_0x1a0407[_0x336f('0x16')])[_0x336f('0x1e')](_0x17a6bc[_0x336f('0x1c')],_0x336f('0x1f'))>moment()){throw new Error(_0x336f('0x3f'));}else{_0x1a0407[_0x336f('0x15')]=![];_0x1a0407[_0x336f('0x16')]=null;}}_0x1a0407[_0x336f('0x40')]=_0x28a7b6;_0x1a0407[_0x336f('0x41')]=Date[_0x336f('0x42')]()+0x36ee80;return _0x1a0407[_0x336f('0x43')]();})[_0x336f('0x10')](function(){return sendServiceMail({'to':_0x246894['body']['email'],'subject':_0x336f('0x44'),'text':_0x336f('0x45')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x336f('0x46')+_0x246894[_0x336f('0x47')][_0x336f('0x48')]+'/reset/'+_0x28a7b6+'\x0a\x0a'+_0x336f('0x49')});})['then'](function(){_0xac46bc['status'](0xc8)[_0x336f('0x33')]({'message':_0x336f('0x4a')});})[_0x336f('0x21')](function(_0x1fe30b){return handleError(_0xac46bc,0x1f4,_0x1fe30b);});};exports['reset']=function(_0x5a5927,_0x1fb5a4){return db[_0x336f('0x4b')][_0x336f('0x23')]({'where':{'resetPasswordToken':_0x5a5927[_0x336f('0x4c')][_0x336f('0x4d')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x336f('0x10')](function(_0x3eeaf0){if(!_0x3eeaf0){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id','securePassword',_0x336f('0x4e'),_0x336f('0x4f')]})[_0x336f('0x10')](function(_0x1601fa){if(_0x1601fa[_0x336f('0x50')])authService[_0x336f('0x51')](_0x5a5927[_0x336f('0x38')][_0x336f('0x12')]);if(!_0x1601fa[_0x336f('0x4e')]||!_0x3eeaf0[_0x336f('0x52')])return _0x3eeaf0;authService[_0x336f('0x53')](_0x5a5927[_0x336f('0x38')][_0x336f('0x12')],_0x3eeaf0[_0x336f('0x52')],_0x1601fa[_0x336f('0x4f')]);return _0x3eeaf0;})[_0x336f('0x10')](function(){_0x3eeaf0[_0x336f('0x12')]=_0x5a5927[_0x336f('0x38')][_0x336f('0x12')];_0x3eeaf0[_0x336f('0x40')]=null;_0x3eeaf0['resetPasswordExpires']=null;return _0x3eeaf0[_0x336f('0x43')]();});})[_0x336f('0x10')](function(){_0x1fb5a4[_0x336f('0x32')](0xc8)[_0x336f('0x33')]({'message':_0x336f('0x54')});})[_0x336f('0x21')](function(_0xb79feb){return handleError(_0x1fb5a4,0x1f4,_0xb79feb);});};passport[_0x336f('0x55')](_0x336f('0x35'),new LocalStrategy({'usernameField':_0x336f('0x11'),'passwordField':_0x336f('0x12')},function(_0x5c1c50,_0x553e7d,_0x434714){return localAuthenticate(db[_0x336f('0x4b')],_0x5c1c50,_0x553e7d,_0x434714);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 065bad5..4ce37c3 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 _0x5c34=['post','/forgot','forgot','/reset/:token','exports','Router','./authLocal.controller'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5c34,0x67));var _0x45c3=function(_0x44dbaf,_0x1a251c){_0x44dbaf=_0x44dbaf-0x0;var _0x17269a=_0x5c34[_0x44dbaf];return _0x17269a;};'use strict';var express=require('express');var router=express[_0x45c3('0x0')]();var controller=require(_0x45c3('0x1'));router[_0x45c3('0x2')]('/',controller['login']);router['post'](_0x45c3('0x3'),controller[_0x45c3('0x4')]);router[_0x45c3('0x2')](_0x45c3('0x5'),controller['reset']);module[_0x45c3('0x6')]=router; \ No newline at end of file +var _0x83ec=['./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0xaf9c6f,_0x1400dc){var _0x3ff689=function(_0x2a78e2){while(--_0x2a78e2){_0xaf9c6f['push'](_0xaf9c6f['shift']());}};_0x3ff689(++_0x1400dc);}(_0x83ec,0xb2));var _0xc83e=function(_0x5ca851,_0x40b743){_0x5ca851=_0x5ca851-0x0;var _0x263e92=_0x83ec[_0x5ca851];return _0x263e92;};'use strict';var express=require(_0xc83e('0x0'));var router=express[_0xc83e('0x1')]();var controller=require(_0xc83e('0x2'));router[_0xc83e('0x3')]('/',controller[_0xc83e('0x4')]);router[_0xc83e('0x3')](_0xc83e('0x5'),controller[_0xc83e('0x6')]);router['post'](_0xc83e('0x7'),controller[_0xc83e('0x8')]);module[_0xc83e('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index bb2265c..49b86ff 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 _0x947f=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x24fa2a,_0x23b22b){var _0xf18812=function(_0x4fba3c){while(--_0x4fba3c){_0x24fa2a['push'](_0x24fa2a['shift']());}};_0xf18812(++_0x23b22b);}(_0x947f,0x1cd));var _0xf947=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x947f[_0x1bd323];return _0x13097b;};'use strict';var Sequelize=require(_0xf947('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xf947('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xf947('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf947('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xea6e=['exports','STRING','INTEGER','sequelize'];(function(_0x664964,_0x51c565){var _0x542af4=function(_0x168eff){while(--_0x168eff){_0x664964['push'](_0x664964['shift']());}};_0x542af4(++_0x51c565);}(_0xea6e,0x18b));var _0xeea6=function(_0x4a973b,_0x4f9200){_0x4a973b=_0x4a973b-0x0;var _0x3e75fe=_0xea6e[_0x4a973b];return _0x3e75fe;};'use strict';var Sequelize=require(_0xeea6('0x0'));module[_0xeea6('0x1')]={'name':{'type':Sequelize[_0xeea6('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xeea6('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xeea6('0x3')],'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 0a82a54..ee31e4d 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 _0x45b1=['getConditions','addActions','Action','omit','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','rows','show','length','find','catch','create','update','body','params','addConditions','ids'];(function(_0x131e11,_0x3856a5){var _0x237bc4=function(_0x248ede){while(--_0x248ede){_0x131e11['push'](_0x131e11['shift']());}};_0x237bc4(++_0x3856a5);}(_0x45b1,0xf2));var _0x145b=function(_0x15bc33,_0x1b6d43){_0x15bc33=_0x15bc33-0x0;var _0x445057=_0x45b1[_0x15bc33];return _0x445057;};'use strict';var emlformat=require(_0x145b('0x0'));var rimraf=require(_0x145b('0x1'));var zipdir=require(_0x145b('0x2'));var jsonpatch=require(_0x145b('0x3'));var rp=require(_0x145b('0x4'));var moment=require(_0x145b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x145b('0x6'));var util=require('util');var path=require(_0x145b('0x7'));var sox=require(_0x145b('0x8'));var csv=require(_0x145b('0x9'));var ejs=require(_0x145b('0xa'));var fs=require('fs');var fs_extra=require(_0x145b('0xb'));var _=require(_0x145b('0xc'));var squel=require('squel');var crypto=require(_0x145b('0xd'));var jsforce=require(_0x145b('0xe'));var deskjs=require(_0x145b('0xf'));var toCsv=require(_0x145b('0x9'));var querystring=require(_0x145b('0x10'));var Papa=require('papaparse');var Redis=require(_0x145b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x145b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x145b('0x13'));var config=require(_0x145b('0x14'));var licenseUtil=require(_0x145b('0x15'));var db=require(_0x145b('0x16'))['db'];function respondWithStatusCode(_0x35f2b9,_0x324be8){_0x324be8=_0x324be8||0xcc;return function(_0x1a7da8){if(_0x1a7da8){return _0x35f2b9[_0x145b('0x17')](_0x324be8);}return _0x35f2b9[_0x145b('0x18')](_0x324be8)[_0x145b('0x19')]();};}function respondWithResult(_0x14dcfb,_0x5d9d4c){_0x5d9d4c=_0x5d9d4c||0xc8;return function(_0x3545d3){if(_0x3545d3){return _0x14dcfb[_0x145b('0x18')](_0x5d9d4c)['json'](_0x3545d3);}};}function respondWithFilteredResult(_0x3362bb,_0x38bfcb){return function(_0x542b39){if(_0x542b39){var _0x45e02c=typeof _0x38bfcb[_0x145b('0x1a')]===_0x145b('0x1b')&&typeof _0x38bfcb[_0x145b('0x1c')]==='undefined';var _0x2d09e6=_0x542b39[_0x145b('0x1d')];var _0x2e1ff7=_0x45e02c?0x0:_0x38bfcb[_0x145b('0x1a')];var _0x4e7649=_0x45e02c?_0x542b39['count']:_0x38bfcb['offset']+_0x38bfcb['limit'];var _0x141d2a;if(_0x4e7649>=_0x2d09e6){_0x4e7649=_0x2d09e6;_0x141d2a=0xc8;}else{_0x141d2a=0xce;}_0x3362bb[_0x145b('0x18')](_0x141d2a);return _0x3362bb[_0x145b('0x1e')]('Content-Range',_0x2e1ff7+'-'+_0x4e7649+'/'+_0x2d09e6)[_0x145b('0x1f')](_0x542b39);}return null;};}function patchUpdates(_0x44b38c){return function(_0xd7c9d6){try{jsonpatch[_0x145b('0x20')](_0xd7c9d6,_0x44b38c,!![]);}catch(_0x5ba9a5){return BPromise[_0x145b('0x21')](_0x5ba9a5);}return _0xd7c9d6[_0x145b('0x22')]();};}function saveUpdates(_0x5724ef,_0x30b9f5){return function(_0x49f3c3){if(_0x49f3c3){return _0x49f3c3['update'](_0x5724ef)[_0x145b('0x23')](function(_0xd02f02){return _0xd02f02;});}return null;};}function removeEntity(_0x52a295,_0x5d3962){return function(_0x2ae099){if(_0x2ae099){return _0x2ae099['destroy']()[_0x145b('0x23')](function(){_0x52a295['status'](0xcc)[_0x145b('0x19')]();});}};}function handleEntityNotFound(_0x45764f,_0x3132d5){return function(_0x4a03df){if(!_0x4a03df){_0x45764f[_0x145b('0x17')](0x194);}return _0x4a03df;};}function handleError(_0x528682,_0x36f278){_0x36f278=_0x36f278||0x1f4;return function(_0x457c76){logger[_0x145b('0x24')](_0x457c76[_0x145b('0x25')]);if(_0x457c76['name']){delete _0x457c76[_0x145b('0x26')];}_0x528682[_0x145b('0x18')](_0x36f278)['send'](_0x457c76);};}exports[_0x145b('0x27')]=function(_0x25a80f,_0x47dce4){var _0x53ff71={},_0x1f2071={},_0x3ed4ad={'count':0x0,'rows':[]};var _0x3689ed=_[_0x145b('0x28')](db[_0x145b('0x29')][_0x145b('0x2a')],function(_0x1ab580){return{'name':_0x1ab580[_0x145b('0x2b')],'type':_0x1ab580[_0x145b('0x2c')]['key']};});_0x1f2071[_0x145b('0x2d')]=_[_0x145b('0x28')](_0x3689ed,_0x145b('0x26'));_0x1f2071[_0x145b('0x2e')]=_[_0x145b('0x2f')](_0x25a80f[_0x145b('0x2e')]);_0x1f2071['filters']=_['intersection'](_0x1f2071['model'],_0x1f2071['query']);_0x53ff71['attributes']=_[_0x145b('0x30')](_0x1f2071['model'],qs[_0x145b('0x31')](_0x25a80f[_0x145b('0x2e')][_0x145b('0x31')]));_0x53ff71[_0x145b('0x32')]=_0x53ff71[_0x145b('0x32')]['length']?_0x53ff71['attributes']:_0x1f2071[_0x145b('0x2d')];if(!_0x25a80f[_0x145b('0x2e')][_0x145b('0x33')](_0x145b('0x34'))){_0x53ff71['limit']=qs['limit'](_0x25a80f[_0x145b('0x2e')][_0x145b('0x1c')]);_0x53ff71[_0x145b('0x1a')]=qs[_0x145b('0x1a')](_0x25a80f['query'][_0x145b('0x1a')]);}_0x53ff71[_0x145b('0x35')]=qs[_0x145b('0x36')](_0x25a80f[_0x145b('0x2e')][_0x145b('0x36')]);_0x53ff71['where']=qs[_0x145b('0x37')](_[_0x145b('0x38')](_0x25a80f[_0x145b('0x2e')],_0x1f2071[_0x145b('0x37')]),_0x3689ed);if(_0x25a80f['query'][_0x145b('0x39')]){_0x53ff71[_0x145b('0x3a')]=_[_0x145b('0x3b')](_0x53ff71[_0x145b('0x3a')],{'$or':_[_0x145b('0x28')](_0x3689ed,function(_0x5df57f){if(_0x5df57f[_0x145b('0x2c')]!==_0x145b('0x3c')){var _0xb32f39={};_0xb32f39[_0x5df57f[_0x145b('0x26')]]={'$like':'%'+_0x25a80f[_0x145b('0x2e')][_0x145b('0x39')]+'%'};return _0xb32f39;}})});}_0x53ff71=_[_0x145b('0x3b')]({},_0x53ff71,_0x25a80f[_0x145b('0x3d')]);var _0x28f351={'where':_0x53ff71[_0x145b('0x3a')]};return db[_0x145b('0x29')][_0x145b('0x1d')](_0x28f351)['then'](function(_0x18dd16){_0x3ed4ad[_0x145b('0x1d')]=_0x18dd16;if(_0x25a80f[_0x145b('0x2e')]['includeAll']){_0x53ff71[_0x145b('0x3e')]=[{'all':!![]}];}return db[_0x145b('0x29')]['findAll'](_0x53ff71);})['then'](function(_0x1b0b70){_0x3ed4ad[_0x145b('0x3f')]=_0x1b0b70;return _0x3ed4ad;})[_0x145b('0x23')](respondWithFilteredResult(_0x47dce4,_0x53ff71))['catch'](handleError(_0x47dce4,null));};exports[_0x145b('0x40')]=function(_0x422472,_0x11d52f){var _0x488902={'raw':![],'where':{'id':_0x422472['params']['id']}},_0xf5e21f={};_0xf5e21f[_0x145b('0x2d')]=_[_0x145b('0x2f')](db[_0x145b('0x29')]['rawAttributes']);_0xf5e21f['query']=_[_0x145b('0x2f')](_0x422472[_0x145b('0x2e')]);_0xf5e21f[_0x145b('0x37')]=_[_0x145b('0x30')](_0xf5e21f[_0x145b('0x2d')],_0xf5e21f[_0x145b('0x2e')]);_0x488902['attributes']=_[_0x145b('0x30')](_0xf5e21f[_0x145b('0x2d')],qs[_0x145b('0x31')](_0x422472[_0x145b('0x2e')][_0x145b('0x31')]));_0x488902[_0x145b('0x32')]=_0x488902['attributes'][_0x145b('0x41')]?_0x488902['attributes']:_0xf5e21f[_0x145b('0x2d')];if(_0x422472['query']['includeAll']){_0x488902['include']=[{'all':!![]}];}_0x488902=_[_0x145b('0x3b')]({},_0x488902,_0x422472[_0x145b('0x3d')]);return db[_0x145b('0x29')][_0x145b('0x42')](_0x488902)[_0x145b('0x23')](handleEntityNotFound(_0x11d52f,null))[_0x145b('0x23')](respondWithResult(_0x11d52f,null))[_0x145b('0x43')](handleError(_0x11d52f,null));};exports[_0x145b('0x44')]=function(_0x5350a9,_0x567755){return db[_0x145b('0x29')][_0x145b('0x44')](_0x5350a9['body'],{})[_0x145b('0x23')](respondWithResult(_0x567755,0xc9))[_0x145b('0x43')](handleError(_0x567755,null));};exports[_0x145b('0x45')]=function(_0x222bfb,_0x21a344){if(_0x222bfb[_0x145b('0x46')]['id']){delete _0x222bfb['body']['id'];}return db[_0x145b('0x29')][_0x145b('0x42')]({'where':{'id':_0x222bfb[_0x145b('0x47')]['id']}})[_0x145b('0x23')](handleEntityNotFound(_0x21a344,null))[_0x145b('0x23')](saveUpdates(_0x222bfb[_0x145b('0x46')],null))[_0x145b('0x23')](respondWithResult(_0x21a344,null))['catch'](handleError(_0x21a344,null));};exports['destroy']=function(_0x6cb422,_0x563dfb){return db[_0x145b('0x29')][_0x145b('0x42')]({'where':{'id':_0x6cb422[_0x145b('0x47')]['id']}})[_0x145b('0x23')](handleEntityNotFound(_0x563dfb,null))[_0x145b('0x23')](removeEntity(_0x563dfb,null))[_0x145b('0x43')](handleError(_0x563dfb,null));};exports[_0x145b('0x48')]=function(_0x290d49,_0x101b9e,_0x16b14f){return db['Condition'][_0x145b('0x42')]({'where':{'id':_0x290d49['params']['id']}})[_0x145b('0x23')](handleEntityNotFound(_0x101b9e,null))[_0x145b('0x23')](function(_0x10e445){if(_0x10e445){return _0x10e445['addConditions'](_0x290d49['body'][_0x145b('0x49')],_['omit'](_0x290d49[_0x145b('0x46')],[_0x145b('0x49'),'id'])||{});}})['then'](respondWithResult(_0x101b9e,null))[_0x145b('0x43')](handleError(_0x101b9e,null));};exports[_0x145b('0x4a')]=function(_0x4b47e9,_0x14a741,_0x351caf){var _0x12cc53={};var _0x2c7166={};var _0x33c1d8;var _0x17cd44;return db[_0x145b('0x29')]['findOne']({'where':{'id':_0x4b47e9[_0x145b('0x47')]['id']}})[_0x145b('0x23')](handleEntityNotFound(_0x14a741,null))[_0x145b('0x23')](function(_0x4ccd61){if(_0x4ccd61){_0x33c1d8=_0x4ccd61;_0x2c7166[_0x145b('0x2d')]=_[_0x145b('0x2f')](db['Condition']['rawAttributes']);_0x2c7166[_0x145b('0x2e')]=_[_0x145b('0x2f')](_0x4b47e9['query']);_0x2c7166[_0x145b('0x37')]=_[_0x145b('0x30')](_0x2c7166['model'],_0x2c7166[_0x145b('0x2e')]);_0x12cc53['attributes']=_[_0x145b('0x30')](_0x2c7166[_0x145b('0x2d')],qs[_0x145b('0x31')](_0x4b47e9['query']['fields']));_0x12cc53[_0x145b('0x32')]=_0x12cc53[_0x145b('0x32')][_0x145b('0x41')]?_0x12cc53[_0x145b('0x32')]:_0x2c7166[_0x145b('0x2d')];_0x12cc53['order']=qs[_0x145b('0x36')](_0x4b47e9[_0x145b('0x2e')][_0x145b('0x36')]);_0x12cc53[_0x145b('0x3a')]=qs['filters'](_['pick'](_0x4b47e9[_0x145b('0x2e')],_0x2c7166[_0x145b('0x37')]));if(_0x4b47e9[_0x145b('0x2e')][_0x145b('0x39')]){_0x12cc53[_0x145b('0x3a')]=_[_0x145b('0x3b')](_0x12cc53['where'],{'$or':_[_0x145b('0x28')](_0x12cc53[_0x145b('0x32')],function(_0x49357e){var _0x5732fe={};_0x5732fe[_0x49357e]={'$like':'%'+_0x4b47e9['query'][_0x145b('0x39')]+'%'};return _0x5732fe;})});}_0x12cc53=_['merge']({},_0x12cc53,_0x4b47e9[_0x145b('0x3d')]);return _0x33c1d8[_0x145b('0x4a')](_0x12cc53);}})['then'](function(_0x4f385d){if(_0x4f385d){_0x17cd44=_0x4f385d[_0x145b('0x41')];if(!_0x4b47e9['query'][_0x145b('0x33')](_0x145b('0x34'))){_0x12cc53[_0x145b('0x1c')]=qs[_0x145b('0x1c')](_0x4b47e9['query'][_0x145b('0x1c')]);_0x12cc53['offset']=qs['offset'](_0x4b47e9[_0x145b('0x2e')][_0x145b('0x1a')]);}return _0x33c1d8['getConditions'](_0x12cc53);}})[_0x145b('0x23')](function(_0x3b1fd6){if(_0x3b1fd6){return _0x3b1fd6?{'count':_0x17cd44,'rows':_0x3b1fd6}:null;}})[_0x145b('0x23')](respondWithResult(_0x14a741,null))[_0x145b('0x43')](handleError(_0x14a741,null));};exports[_0x145b('0x4b')]=function(_0x1827e1,_0x13f2e4,_0x129bde){return db[_0x145b('0x4c')][_0x145b('0x42')]({'where':{'id':_0x1827e1[_0x145b('0x47')]['id']}})[_0x145b('0x23')](handleEntityNotFound(_0x13f2e4,null))[_0x145b('0x23')](function(_0x3ce9b5){if(_0x3ce9b5){return _0x3ce9b5[_0x145b('0x4b')](_0x1827e1[_0x145b('0x46')][_0x145b('0x49')],_[_0x145b('0x4d')](_0x1827e1[_0x145b('0x46')],[_0x145b('0x49'),'id'])||{});}})[_0x145b('0x23')](respondWithResult(_0x13f2e4,null))[_0x145b('0x43')](handleError(_0x13f2e4,null));};exports['getActions']=function(_0x39a194,_0x41c8b9,_0xb70c24){var _0x5acc3a={};var _0xda5dfa={};var _0x237f27;var _0x544f7e;return db[_0x145b('0x29')]['findOne']({'where':{'id':_0x39a194[_0x145b('0x47')]['id']}})[_0x145b('0x23')](handleEntityNotFound(_0x41c8b9,null))['then'](function(_0x51e6e0){if(_0x51e6e0){_0x237f27=_0x51e6e0;_0xda5dfa[_0x145b('0x2d')]=_['keys'](db[_0x145b('0x4c')][_0x145b('0x2a')]);_0xda5dfa['query']=_[_0x145b('0x2f')](_0x39a194[_0x145b('0x2e')]);_0xda5dfa['filters']=_[_0x145b('0x30')](_0xda5dfa[_0x145b('0x2d')],_0xda5dfa[_0x145b('0x2e')]);_0x5acc3a[_0x145b('0x32')]=_[_0x145b('0x30')](_0xda5dfa[_0x145b('0x2d')],qs[_0x145b('0x31')](_0x39a194['query'][_0x145b('0x31')]));_0x5acc3a['attributes']=_0x5acc3a[_0x145b('0x32')][_0x145b('0x41')]?_0x5acc3a['attributes']:_0xda5dfa[_0x145b('0x2d')];_0x5acc3a[_0x145b('0x35')]=qs[_0x145b('0x36')](_0x39a194[_0x145b('0x2e')][_0x145b('0x36')]);_0x5acc3a[_0x145b('0x3a')]=qs[_0x145b('0x37')](_[_0x145b('0x38')](_0x39a194[_0x145b('0x2e')],_0xda5dfa[_0x145b('0x37')]));if(_0x39a194['query'][_0x145b('0x39')]){_0x5acc3a[_0x145b('0x3a')]=_[_0x145b('0x3b')](_0x5acc3a[_0x145b('0x3a')],{'$or':_[_0x145b('0x28')](_0x5acc3a['attributes'],function(_0x4aa704){var _0x159271={};_0x159271[_0x4aa704]={'$like':'%'+_0x39a194[_0x145b('0x2e')]['filter']+'%'};return _0x159271;})});}_0x5acc3a=_['merge']({},_0x5acc3a,_0x39a194[_0x145b('0x3d')]);return _0x237f27[_0x145b('0x4e')](_0x5acc3a);}})['then'](function(_0x115076){if(_0x115076){_0x544f7e=_0x115076[_0x145b('0x41')];if(!_0x39a194[_0x145b('0x2e')][_0x145b('0x33')](_0x145b('0x34'))){_0x5acc3a[_0x145b('0x1c')]=qs[_0x145b('0x1c')](_0x39a194[_0x145b('0x2e')][_0x145b('0x1c')]);_0x5acc3a['offset']=qs[_0x145b('0x1a')](_0x39a194['query']['offset']);}return _0x237f27['getActions'](_0x5acc3a);}})[_0x145b('0x23')](function(_0x47b0f7){if(_0x47b0f7){return _0x47b0f7?{'count':_0x544f7e,'rows':_0x47b0f7}:null;}})[_0x145b('0x23')](respondWithResult(_0x41c8b9,null))[_0x145b('0x43')](handleError(_0x41c8b9,null));}; \ No newline at end of file +var _0x1c36=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','fieldName','type','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','Automation','includeAll','include','rows','catch','params','rawAttributes','length','options','find','create','body','destroy','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x1b6485,_0x17c295){var _0x4789a2=function(_0x8343ef){while(--_0x8343ef){_0x1b6485['push'](_0x1b6485['shift']());}};_0x4789a2(++_0x17c295);}(_0x1c36,0x13a));var _0x61c3=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x1c36[_0x11ce46];return _0x368a1e;};'use strict';var emlformat=require(_0x61c3('0x0'));var rimraf=require(_0x61c3('0x1'));var zipdir=require(_0x61c3('0x2'));var jsonpatch=require(_0x61c3('0x3'));var rp=require(_0x61c3('0x4'));var moment=require('moment');var BPromise=require(_0x61c3('0x5'));var Mustache=require(_0x61c3('0x6'));var util=require(_0x61c3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x61c3('0x8'));var ejs=require(_0x61c3('0x9'));var fs=require('fs');var fs_extra=require(_0x61c3('0xa'));var _=require(_0x61c3('0xb'));var squel=require(_0x61c3('0xc'));var crypto=require(_0x61c3('0xd'));var jsforce=require(_0x61c3('0xe'));var deskjs=require(_0x61c3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61c3('0x10'));var Redis=require('ioredis');var authService=require(_0x61c3('0x11'));var qs=require(_0x61c3('0x12'));var as=require(_0x61c3('0x13'));var hardwareService=require(_0x61c3('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x61c3('0x15'));var licenseUtil=require(_0x61c3('0x16'));var db=require(_0x61c3('0x17'))['db'];function respondWithStatusCode(_0x387aab,_0x3e9c14){_0x3e9c14=_0x3e9c14||0xcc;return function(_0x416555){if(_0x416555){return _0x387aab['sendStatus'](_0x3e9c14);}return _0x387aab[_0x61c3('0x18')](_0x3e9c14)[_0x61c3('0x19')]();};}function respondWithResult(_0x33a6f2,_0x3d96c1){_0x3d96c1=_0x3d96c1||0xc8;return function(_0x1f426e){if(_0x1f426e){return _0x33a6f2[_0x61c3('0x18')](_0x3d96c1)[_0x61c3('0x1a')](_0x1f426e);}};}function respondWithFilteredResult(_0x424b43,_0x3ca3ef){return function(_0x2a2cc0){if(_0x2a2cc0){var _0x58245f=typeof _0x3ca3ef[_0x61c3('0x1b')]===_0x61c3('0x1c')&&typeof _0x3ca3ef[_0x61c3('0x1d')]===_0x61c3('0x1c');var _0x31fd20=_0x2a2cc0['count'];var _0x18efeb=_0x58245f?0x0:_0x3ca3ef[_0x61c3('0x1b')];var _0x165f63=_0x58245f?_0x2a2cc0[_0x61c3('0x1e')]:_0x3ca3ef['offset']+_0x3ca3ef[_0x61c3('0x1d')];var _0x28475a;if(_0x165f63>=_0x31fd20){_0x165f63=_0x31fd20;_0x28475a=0xc8;}else{_0x28475a=0xce;}_0x424b43['status'](_0x28475a);return _0x424b43['set'](_0x61c3('0x1f'),_0x18efeb+'-'+_0x165f63+'/'+_0x31fd20)[_0x61c3('0x1a')](_0x2a2cc0);}return null;};}function patchUpdates(_0xa68697){return function(_0x2787ab){try{jsonpatch[_0x61c3('0x20')](_0x2787ab,_0xa68697,!![]);}catch(_0x156bde){return BPromise[_0x61c3('0x21')](_0x156bde);}return _0x2787ab[_0x61c3('0x22')]();};}function saveUpdates(_0x598d0d,_0x580b43){return function(_0xa69a9c){if(_0xa69a9c){return _0xa69a9c[_0x61c3('0x23')](_0x598d0d)[_0x61c3('0x24')](function(_0xc84cf9){return _0xc84cf9;});}return null;};}function removeEntity(_0x181a1a,_0x4871e7){return function(_0x2287e6){if(_0x2287e6){return _0x2287e6['destroy']()[_0x61c3('0x24')](function(){_0x181a1a[_0x61c3('0x18')](0xcc)[_0x61c3('0x19')]();});}};}function handleEntityNotFound(_0x40ea43,_0x18ceff){return function(_0x43e15e){if(!_0x43e15e){_0x40ea43[_0x61c3('0x25')](0x194);}return _0x43e15e;};}function handleError(_0x2607cf,_0x38fc86){_0x38fc86=_0x38fc86||0x1f4;return function(_0x3e7a03){logger[_0x61c3('0x26')](_0x3e7a03[_0x61c3('0x27')]);if(_0x3e7a03[_0x61c3('0x28')]){delete _0x3e7a03[_0x61c3('0x28')];}_0x2607cf[_0x61c3('0x18')](_0x38fc86)[_0x61c3('0x29')](_0x3e7a03);};}exports[_0x61c3('0x2a')]=function(_0x37af51,_0x3a923c){var _0x51f21f={},_0x5ce8e4={},_0x484834={'count':0x0,'rows':[]};var _0x1ab6a3=_['map'](db['Automation']['rawAttributes'],function(_0x114ceb){return{'name':_0x114ceb[_0x61c3('0x2b')],'type':_0x114ceb[_0x61c3('0x2c')]['key']};});_0x5ce8e4[_0x61c3('0x2d')]=_['map'](_0x1ab6a3,_0x61c3('0x28'));_0x5ce8e4['query']=_[_0x61c3('0x2e')](_0x37af51['query']);_0x5ce8e4[_0x61c3('0x2f')]=_[_0x61c3('0x30')](_0x5ce8e4[_0x61c3('0x2d')],_0x5ce8e4['query']);_0x51f21f[_0x61c3('0x31')]=_[_0x61c3('0x30')](_0x5ce8e4[_0x61c3('0x2d')],qs[_0x61c3('0x32')](_0x37af51[_0x61c3('0x33')]['fields']));_0x51f21f['attributes']=_0x51f21f[_0x61c3('0x31')]['length']?_0x51f21f[_0x61c3('0x31')]:_0x5ce8e4[_0x61c3('0x2d')];if(!_0x37af51[_0x61c3('0x33')][_0x61c3('0x34')](_0x61c3('0x35'))){_0x51f21f['limit']=qs['limit'](_0x37af51[_0x61c3('0x33')][_0x61c3('0x1d')]);_0x51f21f[_0x61c3('0x1b')]=qs[_0x61c3('0x1b')](_0x37af51[_0x61c3('0x33')]['offset']);}_0x51f21f[_0x61c3('0x36')]=qs[_0x61c3('0x37')](_0x37af51[_0x61c3('0x33')][_0x61c3('0x37')]);_0x51f21f[_0x61c3('0x38')]=qs['filters'](_[_0x61c3('0x39')](_0x37af51[_0x61c3('0x33')],_0x5ce8e4[_0x61c3('0x2f')]),_0x1ab6a3);if(_0x37af51[_0x61c3('0x33')][_0x61c3('0x3a')]){_0x51f21f[_0x61c3('0x38')]=_['merge'](_0x51f21f[_0x61c3('0x38')],{'$or':_[_0x61c3('0x3b')](_0x1ab6a3,function(_0xf69840){if(_0xf69840[_0x61c3('0x2c')]!=='VIRTUAL'){var _0xc788bd={};_0xc788bd[_0xf69840[_0x61c3('0x28')]]={'$like':'%'+_0x37af51[_0x61c3('0x33')][_0x61c3('0x3a')]+'%'};return _0xc788bd;}})});}_0x51f21f=_[_0x61c3('0x3c')]({},_0x51f21f,_0x37af51['options']);var _0xbcdfaf={'where':_0x51f21f[_0x61c3('0x38')]};return db[_0x61c3('0x3d')][_0x61c3('0x1e')](_0xbcdfaf)[_0x61c3('0x24')](function(_0x164175){_0x484834[_0x61c3('0x1e')]=_0x164175;if(_0x37af51[_0x61c3('0x33')][_0x61c3('0x3e')]){_0x51f21f[_0x61c3('0x3f')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x51f21f);})[_0x61c3('0x24')](function(_0x58a2a7){_0x484834[_0x61c3('0x40')]=_0x58a2a7;return _0x484834;})[_0x61c3('0x24')](respondWithFilteredResult(_0x3a923c,_0x51f21f))[_0x61c3('0x41')](handleError(_0x3a923c,null));};exports['show']=function(_0x139a21,_0xca512a){var _0x4fb05a={'raw':![],'where':{'id':_0x139a21[_0x61c3('0x42')]['id']}},_0x9732d5={};_0x9732d5[_0x61c3('0x2d')]=_[_0x61c3('0x2e')](db['Automation'][_0x61c3('0x43')]);_0x9732d5[_0x61c3('0x33')]=_['keys'](_0x139a21[_0x61c3('0x33')]);_0x9732d5['filters']=_[_0x61c3('0x30')](_0x9732d5[_0x61c3('0x2d')],_0x9732d5[_0x61c3('0x33')]);_0x4fb05a[_0x61c3('0x31')]=_['intersection'](_0x9732d5[_0x61c3('0x2d')],qs[_0x61c3('0x32')](_0x139a21['query']['fields']));_0x4fb05a[_0x61c3('0x31')]=_0x4fb05a[_0x61c3('0x31')][_0x61c3('0x44')]?_0x4fb05a[_0x61c3('0x31')]:_0x9732d5['model'];if(_0x139a21[_0x61c3('0x33')][_0x61c3('0x3e')]){_0x4fb05a[_0x61c3('0x3f')]=[{'all':!![]}];}_0x4fb05a=_[_0x61c3('0x3c')]({},_0x4fb05a,_0x139a21[_0x61c3('0x45')]);return db[_0x61c3('0x3d')][_0x61c3('0x46')](_0x4fb05a)[_0x61c3('0x24')](handleEntityNotFound(_0xca512a,null))[_0x61c3('0x24')](respondWithResult(_0xca512a,null))[_0x61c3('0x41')](handleError(_0xca512a,null));};exports[_0x61c3('0x47')]=function(_0x44db6e,_0x1f580e){return db[_0x61c3('0x3d')][_0x61c3('0x47')](_0x44db6e[_0x61c3('0x48')],{})[_0x61c3('0x24')](respondWithResult(_0x1f580e,0xc9))['catch'](handleError(_0x1f580e,null));};exports[_0x61c3('0x23')]=function(_0x3407ff,_0x4c2b8f){if(_0x3407ff['body']['id']){delete _0x3407ff[_0x61c3('0x48')]['id'];}return db[_0x61c3('0x3d')][_0x61c3('0x46')]({'where':{'id':_0x3407ff[_0x61c3('0x42')]['id']}})[_0x61c3('0x24')](handleEntityNotFound(_0x4c2b8f,null))[_0x61c3('0x24')](saveUpdates(_0x3407ff[_0x61c3('0x48')],null))[_0x61c3('0x24')](respondWithResult(_0x4c2b8f,null))[_0x61c3('0x41')](handleError(_0x4c2b8f,null));};exports[_0x61c3('0x49')]=function(_0x87ecf7,_0x1c7ca9){return db[_0x61c3('0x3d')][_0x61c3('0x46')]({'where':{'id':_0x87ecf7[_0x61c3('0x42')]['id']}})[_0x61c3('0x24')](handleEntityNotFound(_0x1c7ca9,null))[_0x61c3('0x24')](removeEntity(_0x1c7ca9,null))['catch'](handleError(_0x1c7ca9,null));};exports['addConditions']=function(_0x5b326a,_0x3dc029,_0x219b52){return db[_0x61c3('0x4a')][_0x61c3('0x46')]({'where':{'id':_0x5b326a[_0x61c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x3dc029,null))[_0x61c3('0x24')](function(_0xc803a8){if(_0xc803a8){return _0xc803a8['addConditions'](_0x5b326a[_0x61c3('0x48')][_0x61c3('0x4b')],_[_0x61c3('0x4c')](_0x5b326a[_0x61c3('0x48')],['ids','id'])||{});}})[_0x61c3('0x24')](respondWithResult(_0x3dc029,null))['catch'](handleError(_0x3dc029,null));};exports[_0x61c3('0x4d')]=function(_0x34ca02,_0xfec55,_0x189986){var _0x2e0dc5={};var _0x5f862e={};var _0x16c51b;var _0x3c987e;return db[_0x61c3('0x3d')][_0x61c3('0x4e')]({'where':{'id':_0x34ca02[_0x61c3('0x42')]['id']}})[_0x61c3('0x24')](handleEntityNotFound(_0xfec55,null))[_0x61c3('0x24')](function(_0x4acbdc){if(_0x4acbdc){_0x16c51b=_0x4acbdc;_0x5f862e['model']=_[_0x61c3('0x2e')](db[_0x61c3('0x4a')][_0x61c3('0x43')]);_0x5f862e[_0x61c3('0x33')]=_[_0x61c3('0x2e')](_0x34ca02[_0x61c3('0x33')]);_0x5f862e[_0x61c3('0x2f')]=_[_0x61c3('0x30')](_0x5f862e[_0x61c3('0x2d')],_0x5f862e['query']);_0x2e0dc5[_0x61c3('0x31')]=_[_0x61c3('0x30')](_0x5f862e[_0x61c3('0x2d')],qs[_0x61c3('0x32')](_0x34ca02[_0x61c3('0x33')][_0x61c3('0x32')]));_0x2e0dc5[_0x61c3('0x31')]=_0x2e0dc5[_0x61c3('0x31')][_0x61c3('0x44')]?_0x2e0dc5[_0x61c3('0x31')]:_0x5f862e[_0x61c3('0x2d')];_0x2e0dc5['order']=qs[_0x61c3('0x37')](_0x34ca02[_0x61c3('0x33')][_0x61c3('0x37')]);_0x2e0dc5[_0x61c3('0x38')]=qs[_0x61c3('0x2f')](_[_0x61c3('0x39')](_0x34ca02[_0x61c3('0x33')],_0x5f862e[_0x61c3('0x2f')]));if(_0x34ca02[_0x61c3('0x33')][_0x61c3('0x3a')]){_0x2e0dc5['where']=_[_0x61c3('0x3c')](_0x2e0dc5['where'],{'$or':_[_0x61c3('0x3b')](_0x2e0dc5[_0x61c3('0x31')],function(_0x3de1db){var _0x2b69e0={};_0x2b69e0[_0x3de1db]={'$like':'%'+_0x34ca02[_0x61c3('0x33')][_0x61c3('0x3a')]+'%'};return _0x2b69e0;})});}_0x2e0dc5=_['merge']({},_0x2e0dc5,_0x34ca02['options']);return _0x16c51b[_0x61c3('0x4d')](_0x2e0dc5);}})['then'](function(_0x20be0f){if(_0x20be0f){_0x3c987e=_0x20be0f['length'];if(!_0x34ca02[_0x61c3('0x33')]['hasOwnProperty'](_0x61c3('0x35'))){_0x2e0dc5[_0x61c3('0x1d')]=qs[_0x61c3('0x1d')](_0x34ca02[_0x61c3('0x33')][_0x61c3('0x1d')]);_0x2e0dc5['offset']=qs[_0x61c3('0x1b')](_0x34ca02[_0x61c3('0x33')][_0x61c3('0x1b')]);}return _0x16c51b[_0x61c3('0x4d')](_0x2e0dc5);}})[_0x61c3('0x24')](function(_0x110db5){if(_0x110db5){return _0x110db5?{'count':_0x3c987e,'rows':_0x110db5}:null;}})[_0x61c3('0x24')](respondWithResult(_0xfec55,null))[_0x61c3('0x41')](handleError(_0xfec55,null));};exports[_0x61c3('0x4f')]=function(_0x3f3f6c,_0x1408c0,_0x3239a4){return db[_0x61c3('0x50')]['find']({'where':{'id':_0x3f3f6c[_0x61c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x1408c0,null))[_0x61c3('0x24')](function(_0x3826e3){if(_0x3826e3){return _0x3826e3[_0x61c3('0x4f')](_0x3f3f6c[_0x61c3('0x48')][_0x61c3('0x4b')],_['omit'](_0x3f3f6c[_0x61c3('0x48')],[_0x61c3('0x4b'),'id'])||{});}})[_0x61c3('0x24')](respondWithResult(_0x1408c0,null))['catch'](handleError(_0x1408c0,null));};exports['getActions']=function(_0x26bdda,_0x3d9153,_0x16928b){var _0x4504dd={};var _0x3edc40={};var _0x5b776c;var _0xbf6b43;return db[_0x61c3('0x3d')][_0x61c3('0x4e')]({'where':{'id':_0x26bdda[_0x61c3('0x42')]['id']}})[_0x61c3('0x24')](handleEntityNotFound(_0x3d9153,null))[_0x61c3('0x24')](function(_0x31c9ad){if(_0x31c9ad){_0x5b776c=_0x31c9ad;_0x3edc40[_0x61c3('0x2d')]=_[_0x61c3('0x2e')](db[_0x61c3('0x50')][_0x61c3('0x43')]);_0x3edc40[_0x61c3('0x33')]=_[_0x61c3('0x2e')](_0x26bdda[_0x61c3('0x33')]);_0x3edc40['filters']=_[_0x61c3('0x30')](_0x3edc40[_0x61c3('0x2d')],_0x3edc40[_0x61c3('0x33')]);_0x4504dd[_0x61c3('0x31')]=_[_0x61c3('0x30')](_0x3edc40['model'],qs[_0x61c3('0x32')](_0x26bdda[_0x61c3('0x33')]['fields']));_0x4504dd[_0x61c3('0x31')]=_0x4504dd['attributes']['length']?_0x4504dd[_0x61c3('0x31')]:_0x3edc40['model'];_0x4504dd['order']=qs[_0x61c3('0x37')](_0x26bdda[_0x61c3('0x33')][_0x61c3('0x37')]);_0x4504dd['where']=qs[_0x61c3('0x2f')](_[_0x61c3('0x39')](_0x26bdda['query'],_0x3edc40[_0x61c3('0x2f')]));if(_0x26bdda[_0x61c3('0x33')][_0x61c3('0x3a')]){_0x4504dd[_0x61c3('0x38')]=_[_0x61c3('0x3c')](_0x4504dd[_0x61c3('0x38')],{'$or':_[_0x61c3('0x3b')](_0x4504dd[_0x61c3('0x31')],function(_0x35d924){var _0x4c141f={};_0x4c141f[_0x35d924]={'$like':'%'+_0x26bdda[_0x61c3('0x33')]['filter']+'%'};return _0x4c141f;})});}_0x4504dd=_['merge']({},_0x4504dd,_0x26bdda['options']);return _0x5b776c[_0x61c3('0x51')](_0x4504dd);}})[_0x61c3('0x24')](function(_0x10360e){if(_0x10360e){_0xbf6b43=_0x10360e[_0x61c3('0x44')];if(!_0x26bdda[_0x61c3('0x33')][_0x61c3('0x34')](_0x61c3('0x35'))){_0x4504dd[_0x61c3('0x1d')]=qs[_0x61c3('0x1d')](_0x26bdda[_0x61c3('0x33')]['limit']);_0x4504dd[_0x61c3('0x1b')]=qs[_0x61c3('0x1b')](_0x26bdda[_0x61c3('0x33')][_0x61c3('0x1b')]);}return _0x5b776c[_0x61c3('0x51')](_0x4504dd);}})[_0x61c3('0x24')](function(_0xd3cbc8){if(_0xd3cbc8){return _0xd3cbc8?{'count':_0xbf6b43,'rows':_0xd3cbc8}:null;}})[_0x61c3('0x24')](respondWithResult(_0x3d9153,null))['catch'](handleError(_0x3d9153,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 52d88e9..ed25392 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 _0x99da=['moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x38aa39,_0x563f65){var _0x1ff3a5=function(_0x49213c){while(--_0x49213c){_0x38aa39['push'](_0x38aa39['shift']());}};_0x1ff3a5(++_0x563f65);}(_0x99da,0x8d));var _0xa99d=function(_0x4d9f63,_0x115c88){_0x4d9f63=_0x4d9f63-0x0;var _0xa6dcfe=_0x99da[_0x4d9f63];return _0xa6dcfe;};'use strict';var _=require(_0xa99d('0x0'));var util=require(_0xa99d('0x1'));var logger=require(_0xa99d('0x2'))('api');var moment=require(_0xa99d('0x3'));var BPromise=require(_0xa99d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa99d('0x5'));var config=require(_0xa99d('0x6'));var attributes=require(_0xa99d('0x7'));module[_0xa99d('0x8')]=function(_0x3b4f96,_0x545978){return _0x3b4f96[_0xa99d('0x9')](_0xa99d('0xa'),attributes,{'tableName':_0xa99d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6206=['tools_automations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation'];(function(_0x10a6af,_0x4ba30e){var _0x172a4e=function(_0x329fef){while(--_0x329fef){_0x10a6af['push'](_0x10a6af['shift']());}};_0x172a4e(++_0x4ba30e);}(_0x6206,0x146));var _0x6620=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x6206[_0x26f702];return _0x11417d;};'use strict';var _=require('lodash');var util=require(_0x6620('0x0'));var logger=require(_0x6620('0x1'))(_0x6620('0x2'));var moment=require(_0x6620('0x3'));var BPromise=require(_0x6620('0x4'));var rp=require(_0x6620('0x5'));var fs=require('fs');var path=require(_0x6620('0x6'));var rimraf=require(_0x6620('0x7'));var config=require(_0x6620('0x8'));var attributes=require(_0x6620('0x9'));module[_0x6620('0xa')]=function(_0x1631b1,_0x33419f){return _0x1631b1['define'](_0x6620('0xb'),attributes,{'tableName':_0x6620('0xc'),'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 02a9b23..7192926 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 _0x40ac=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','debug','request\x20sent','error','code','Automation,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x40ac,0x1de));var _0xc40a=function(_0x13e17f,_0x89b33c){_0x13e17f=_0x13e17f-0x0;var _0x1eaa46=_0x40ac[_0x13e17f];return _0x1eaa46;};'use strict';var _=require(_0xc40a('0x0'));var util=require('util');var moment=require(_0xc40a('0x1'));var BPromise=require(_0xc40a('0x2'));var rs=require(_0xc40a('0x3'));var fs=require('fs');var Redis=require(_0xc40a('0x4'));var db=require(_0xc40a('0x5'))['db'];var utils=require(_0xc40a('0x6'));var logger=require(_0xc40a('0x7'))('rpc');var config=require(_0xc40a('0x8'));var jayson=require(_0xc40a('0x9'));var client=jayson[_0xc40a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b77c,_0x3f323e,_0x28b55d){return new BPromise(function(_0x5bb1e8,_0xecfe01){return client[_0xc40a('0xb')](_0x59b77c,_0x28b55d)[_0xc40a('0xc')](function(_0x35e0c6){logger['info']('Automation,\x20%s,\x20%s',_0x3f323e,'request\x20sent');logger[_0xc40a('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x3f323e,_0xc40a('0xe'),JSON['stringify'](_0x35e0c6));if(_0x35e0c6['error']){if(_0x35e0c6[_0xc40a('0xf')][_0xc40a('0x10')]===0x1f4){logger[_0xc40a('0xf')](_0xc40a('0x11'),_0x3f323e,_0x35e0c6[_0xc40a('0xf')][_0xc40a('0x12')]);return _0xecfe01(_0x35e0c6[_0xc40a('0xf')][_0xc40a('0x12')]);}logger['error'](_0xc40a('0x11'),_0x3f323e,_0x35e0c6[_0xc40a('0xf')]['message']);return _0x5bb1e8(_0x35e0c6[_0xc40a('0xf')]['message']);}else{logger[_0xc40a('0x13')](_0xc40a('0x11'),_0x3f323e,_0xc40a('0xe'));_0x5bb1e8(_0x35e0c6[_0xc40a('0x14')][_0xc40a('0x12')]);}})['catch'](function(_0x3d1502){logger[_0xc40a('0xf')](_0xc40a('0x11'),_0x3f323e,_0x3d1502);_0xecfe01(_0x3d1502);});});} \ No newline at end of file +var _0x3af5=['stringify','error','code','message','info','request\x20sent','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','request','then','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3af5,0x1d3));var _0x53af=function(_0xa0be1c,_0x152d5d){_0xa0be1c=_0xa0be1c-0x0;var _0x546eec=_0x3af5[_0xa0be1c];return _0x546eec;};'use strict';var _=require(_0x53af('0x0'));var util=require(_0x53af('0x1'));var moment=require('moment');var BPromise=require(_0x53af('0x2'));var rs=require(_0x53af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x53af('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x53af('0x5'));var jayson=require(_0x53af('0x6'));var client=jayson['client'][_0x53af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eb461,_0x3aefaf,_0x27eed3){return new BPromise(function(_0x2875ab,_0x22c0cb){return client[_0x53af('0x8')](_0x4eb461,_0x27eed3)[_0x53af('0x9')](function(_0x56751b){logger['info'](_0x53af('0xa'),_0x3aefaf,'request\x20sent');logger[_0x53af('0xb')](_0x53af('0xc'),_0x3aefaf,'request\x20sent',JSON[_0x53af('0xd')](_0x56751b));if(_0x56751b[_0x53af('0xe')]){if(_0x56751b['error'][_0x53af('0xf')]===0x1f4){logger[_0x53af('0xe')](_0x53af('0xa'),_0x3aefaf,_0x56751b['error'][_0x53af('0x10')]);return _0x22c0cb(_0x56751b['error'][_0x53af('0x10')]);}logger[_0x53af('0xe')](_0x53af('0xa'),_0x3aefaf,_0x56751b[_0x53af('0xe')][_0x53af('0x10')]);return _0x2875ab(_0x56751b[_0x53af('0xe')][_0x53af('0x10')]);}else{logger[_0x53af('0x11')](_0x53af('0xa'),_0x3aefaf,_0x53af('0x12'));_0x2875ab(_0x56751b['result'][_0x53af('0x10')]);}})[_0x53af('0x13')](function(_0x29bb86){logger[_0x53af('0xe')](_0x53af('0xa'),_0x3aefaf,_0x29bb86);_0x22c0cb(_0x29bb86);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e2430f5..edc1621 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 _0x6a39=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','/:id/actions','getActions','post','create','put','update','delete','destroy','multer','util'];(function(_0x192ad0,_0xe2c0){var _0x56a648=function(_0xeebc14){while(--_0xeebc14){_0x192ad0['push'](_0x192ad0['shift']());}};_0x56a648(++_0xe2c0);}(_0x6a39,0x140));var _0x96a3=function(_0x33ccaf,_0x192235){_0x33ccaf=_0x33ccaf-0x0;var _0x30abf6=_0x6a39[_0x33ccaf];return _0x30abf6;};'use strict';var multer=require(_0x96a3('0x0'));var util=require(_0x96a3('0x1'));var path=require(_0x96a3('0x2'));var timeout=require(_0x96a3('0x3'));var express=require(_0x96a3('0x4'));var router=express[_0x96a3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x96a3('0x6'));var interaction=require(_0x96a3('0x7'));var config=require(_0x96a3('0x8'));var controller=require(_0x96a3('0x9'));router[_0x96a3('0xa')]('/',auth[_0x96a3('0xb')](),controller[_0x96a3('0xc')]);router[_0x96a3('0xa')](_0x96a3('0xd'),auth[_0x96a3('0xb')](),controller['show']);router[_0x96a3('0xa')](_0x96a3('0xe'),auth[_0x96a3('0xb')](),controller['getConditions']);router[_0x96a3('0xa')](_0x96a3('0xf'),auth[_0x96a3('0xb')](),controller[_0x96a3('0x10')]);router[_0x96a3('0x11')]('/',auth[_0x96a3('0xb')](),controller[_0x96a3('0x12')]);router[_0x96a3('0x11')](_0x96a3('0xe'),auth[_0x96a3('0xb')](),controller['addConditions']);router[_0x96a3('0x11')]('/:id/actions',auth[_0x96a3('0xb')](),controller['addActions']);router[_0x96a3('0x13')]('/:id',auth[_0x96a3('0xb')](),controller[_0x96a3('0x14')]);router[_0x96a3('0x15')]('/:id',auth[_0x96a3('0xb')](),controller[_0x96a3('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb87c=['getConditions','/:id/actions','getActions','post','create','addConditions','addActions','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions'];(function(_0x10f328,_0x464bc1){var _0x44dff1=function(_0x253ee5){while(--_0x253ee5){_0x10f328['push'](_0x10f328['shift']());}};_0x44dff1(++_0x464bc1);}(_0xb87c,0x1d7));var _0xcb87=function(_0x539445,_0xb45c){_0x539445=_0x539445-0x0;var _0x2d607e=_0xb87c[_0x539445];return _0x2d607e;};'use strict';var multer=require('multer');var util=require(_0xcb87('0x0'));var path=require(_0xcb87('0x1'));var timeout=require(_0xcb87('0x2'));var express=require(_0xcb87('0x3'));var router=express[_0xcb87('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb87('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcb87('0x6'));router[_0xcb87('0x7')]('/',auth[_0xcb87('0x8')](),controller[_0xcb87('0x9')]);router[_0xcb87('0x7')](_0xcb87('0xa'),auth['isAuthenticated'](),controller[_0xcb87('0xb')]);router[_0xcb87('0x7')](_0xcb87('0xc'),auth[_0xcb87('0x8')](),controller[_0xcb87('0xd')]);router['get'](_0xcb87('0xe'),auth[_0xcb87('0x8')](),controller[_0xcb87('0xf')]);router[_0xcb87('0x10')]('/',auth[_0xcb87('0x8')](),controller[_0xcb87('0x11')]);router['post'](_0xcb87('0xc'),auth[_0xcb87('0x8')](),controller[_0xcb87('0x12')]);router[_0xcb87('0x10')]('/:id/actions',auth[_0xcb87('0x8')](),controller[_0xcb87('0x13')]);router['put'](_0xcb87('0xa'),auth['isAuthenticated'](),controller[_0xcb87('0x14')]);router['delete'](_0xcb87('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xcb87('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index daa1dcc..c3cc3f1 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 _0xa3af=['#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa3af,0x1ae));var _0xfa3a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa3af[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xfa3a('0x0'));module[_0xfa3a('0x1')]={'name':{'type':Sequelize[_0xfa3a('0x2')],'unique':_0xfa3a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xfa3a('0x4')](_0xfa3a('0x5')),'allowNull':![],'defaultValue':_0xfa3a('0x5')},'description':{'type':Sequelize[_0xfa3a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfa3a('0x6')},'limitCalls':{'type':Sequelize[_0xfa3a('0x7')](0x4)[_0xfa3a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xfa3a('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfa3a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfa3a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xfa3a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa3a('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfa3a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa3a('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfa3a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa3a('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xfa3a('0x7')](0x3)[_0xfa3a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa3a('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfa3a('0x7')](0x5)[_0xfa3a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa3a('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xfa3a('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfa3a('0x7')](0x5)[_0xfa3a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa3a('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfa3a('0x7')](0x3)[_0xfa3a('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfa3a('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfa3a('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xfa3a('0x4')]('always','never','onlyIfOpen'),'defaultValue':_0xfa3a('0x12')},'dialAMDActive':{'type':Sequelize[_0xfa3a('0x13')],'defaultValue':0x0,'comment':_0xfa3a('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xfa3a('0x7')](0x9)[_0xfa3a('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xfa3a('0x7')](0x9)[_0xfa3a('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfa3a('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfa3a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfa3a('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xfa3a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfa3a('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xfa3a('0x7')](0x9)[_0xfa3a('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfa3a('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfa3a('0x7')](0x9)[_0xfa3a('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfa3a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfa3a('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfa3a('0x7')](0x5)[_0xfa3a('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfa3a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfa3a('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xfa3a('0x4')](_0xfa3a('0x1b'),_0xfa3a('0x1c')),'defaultValue':_0xfa3a('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfa3a('0x7')](0x3)[_0xfa3a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xfa3a('0x7')](0x3)[_0xfa3a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfa3a('0x7')](0x3)[_0xfa3a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa3a('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfa3a('0x7')](0x5)[_0xfa3a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xfa3a('0x7')](0x3)[_0xfa3a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa3a('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xfa3a('0x7')](0x5)[_0xfa3a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa3a('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfa3a('0x7')](0x3)[_0xfa3a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa3a('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfa3a('0x7')](0x5)[_0xfa3a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa3a('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfa3a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa3a('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xfa3a('0x7')](0x5)[_0xfa3a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa3a('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfa3a('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfa3a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfa3a('0x25')}}; \ No newline at end of file +var _0xa5dd=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\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,*,*,*','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x152d6c,_0x11f0ea){var _0x4b7d1b=function(_0x10ee8d){while(--_0x10ee8d){_0x152d6c['push'](_0x152d6c['shift']());}};_0x4b7d1b(++_0x11f0ea);}(_0xa5dd,0x101));var _0xda5d=function(_0x413d0a,_0x4362a5){_0x413d0a=_0x413d0a-0x0;var _0x57eb66=_0xa5dd[_0x413d0a];return _0x57eb66;};'use strict';var Sequelize=require(_0xda5d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xda5d('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xda5d('0x2')](_0xda5d('0x3')),'allowNull':![],'defaultValue':_0xda5d('0x3')},'description':{'type':Sequelize[_0xda5d('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xda5d('0x5')},'limitCalls':{'type':Sequelize[_0xda5d('0x6')](0x4)[_0xda5d('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xda5d('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda5d('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda5d('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xda5d('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xda5d('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xda5d('0x6')](0x5)[_0xda5d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'defaultValue':0x3,'comment':_0xda5d('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda5d('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xda5d('0xc')},'dialTimezone':{'type':Sequelize[_0xda5d('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xda5d('0x4')],'defaultValue':_0xda5d('0xd')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xda5d('0xe')],'defaultValue':0x0,'comment':_0xda5d('0xf')},'dialAMDInitialSilence':{'type':Sequelize[_0xda5d('0x6')](0x9)[_0xda5d('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xda5d('0x10')},'dialAMDGreeting':{'type':Sequelize[_0xda5d('0x6')](0x9)[_0xda5d('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xda5d('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xda5d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xda5d('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xda5d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xda5d('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xda5d('0x6')](0x9)[_0xda5d('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xda5d('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xda5d('0x6')](0x9)[_0xda5d('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xda5d('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xda5d('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xda5d('0x6')](0x5)[_0xda5d('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xda5d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xda5d('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0xda5d('0x2')](_0xda5d('0x17'),_0xda5d('0x18')),'defaultValue':_0xda5d('0x17')},'dialPrefix':{'type':Sequelize[_0xda5d('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xda5d('0x19')},'dialCutDigit':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xda5d('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda5d('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xda5d('0x6')](0x5)[_0xda5d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda5d('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda5d('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xda5d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda5d('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda5d('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xda5d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda5d('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xda5d('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda5d('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xda5d('0x6')](0x3)[_0xda5d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xda5d('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 31db0f9..e89399c 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 _0x617f=['updatedAt','role','autoAssociation','params','getHoppers','findOne','CmHopper','CampaignId','order','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','select','field','NOW()','ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','ListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','map','Campaign','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','rows','catch','show','rawAttributes','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt'];(function(_0x5cf47b,_0x522d99){var _0x40d3d7=function(_0x44f99f){while(--_0x44f99f){_0x5cf47b['push'](_0x5cf47b['shift']());}};_0x40d3d7(++_0x522d99);}(_0x617f,0x15e));var _0xf617=function(_0x5d14fb,_0x5a53ac){_0x5d14fb=_0x5d14fb-0x0;var _0x2c0da3=_0x617f[_0x5d14fb];return _0x2c0da3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf617('0x0'));var zipdir=require(_0xf617('0x1'));var jsonpatch=require(_0xf617('0x2'));var rp=require(_0xf617('0x3'));var moment=require('moment');var BPromise=require(_0xf617('0x4'));var Mustache=require(_0xf617('0x5'));var util=require(_0xf617('0x6'));var path=require(_0xf617('0x7'));var sox=require(_0xf617('0x8'));var csv=require(_0xf617('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf617('0xa'));var _=require('lodash');var squel=require(_0xf617('0xb'));var crypto=require(_0xf617('0xc'));var jsforce=require(_0xf617('0xd'));var deskjs=require(_0xf617('0xe'));var toCsv=require(_0xf617('0x9'));var querystring=require(_0xf617('0xf'));var Papa=require(_0xf617('0x10'));var Redis=require(_0xf617('0x11'));var authService=require(_0xf617('0x12'));var qs=require(_0xf617('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf617('0x14'));var logger=require(_0xf617('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf617('0x16'));var licenseUtil=require(_0xf617('0x17'));var db=require(_0xf617('0x18'))['db'];function respondWithStatusCode(_0x4e217a,_0x58aafc){_0x58aafc=_0x58aafc||0xcc;return function(_0x1076d7){if(_0x1076d7){return _0x4e217a[_0xf617('0x19')](_0x58aafc);}return _0x4e217a[_0xf617('0x1a')](_0x58aafc)[_0xf617('0x1b')]();};}function respondWithResult(_0x14ce7c,_0x376e75){_0x376e75=_0x376e75||0xc8;return function(_0x5a2e20){if(_0x5a2e20){return _0x14ce7c[_0xf617('0x1a')](_0x376e75)['json'](_0x5a2e20);}};}function respondWithFilteredResult(_0x50a575,_0x32af0b){return function(_0x498cc4){if(_0x498cc4){var _0x636d9d=typeof _0x32af0b[_0xf617('0x1c')]===_0xf617('0x1d')&&typeof _0x32af0b[_0xf617('0x1e')]==='undefined';var _0x1e3503=_0x498cc4[_0xf617('0x1f')];var _0x5b51f6=_0x636d9d?0x0:_0x32af0b[_0xf617('0x1c')];var _0x3a2d2d=_0x636d9d?_0x498cc4['count']:_0x32af0b[_0xf617('0x1c')]+_0x32af0b[_0xf617('0x1e')];var _0x313637;if(_0x3a2d2d>=_0x1e3503){_0x3a2d2d=_0x1e3503;_0x313637=0xc8;}else{_0x313637=0xce;}_0x50a575[_0xf617('0x1a')](_0x313637);return _0x50a575[_0xf617('0x20')]('Content-Range',_0x5b51f6+'-'+_0x3a2d2d+'/'+_0x1e3503)['json'](_0x498cc4);}return null;};}function patchUpdates(_0x1c9f8c){return function(_0x3bdfbe){try{jsonpatch['apply'](_0x3bdfbe,_0x1c9f8c,!![]);}catch(_0x126ccc){return BPromise[_0xf617('0x21')](_0x126ccc);}return _0x3bdfbe[_0xf617('0x22')]();};}function saveUpdates(_0x1903c2,_0x4c7320){return function(_0x275a3d){if(_0x275a3d){return _0x275a3d[_0xf617('0x23')](_0x1903c2)[_0xf617('0x24')](function(_0x6608a){return _0x6608a;});}return null;};}function removeEntity(_0x2f271f,_0x3dc19e){return function(_0x5da6e1){if(_0x5da6e1){return _0x5da6e1[_0xf617('0x25')]()[_0xf617('0x24')](function(){var _0x5687a9=_0x5da6e1[_0xf617('0x26')]({'plain':!![]});var _0x4882b9=_0xf617('0x27');return db[_0xf617('0x28')][_0xf617('0x25')]({'where':{'type':_0x4882b9,'resourceId':_0x5687a9['id']}})[_0xf617('0x24')](function(){return _0x5da6e1;});})[_0xf617('0x24')](function(){_0x2f271f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13235b,_0x482ce8){return function(_0x332fb8){if(!_0x332fb8){_0x13235b['sendStatus'](0x194);}return _0x332fb8;};}function handleError(_0x3091b2,_0x3a423f){_0x3a423f=_0x3a423f||0x1f4;return function(_0x3c6e95){logger[_0xf617('0x29')](_0x3c6e95[_0xf617('0x2a')]);if(_0x3c6e95[_0xf617('0x2b')]){delete _0x3c6e95[_0xf617('0x2b')];}_0x3091b2[_0xf617('0x1a')](_0x3a423f)[_0xf617('0x2c')](_0x3c6e95);};}exports['index']=function(_0x229b46,_0x46b8da){var _0x41a2d4={},_0x3b228b={},_0x2cb1aa={'count':0x0,'rows':[]};var _0x1e437c=_[_0xf617('0x2d')](db[_0xf617('0x2e')]['rawAttributes'],function(_0x3507a4){return{'name':_0x3507a4[_0xf617('0x2f')],'type':_0x3507a4['type']['key']};});_0x3b228b[_0xf617('0x30')]=_[_0xf617('0x2d')](_0x1e437c,_0xf617('0x2b'));_0x3b228b[_0xf617('0x31')]=_[_0xf617('0x32')](_0x229b46['query']);_0x3b228b[_0xf617('0x33')]=_[_0xf617('0x34')](_0x3b228b[_0xf617('0x30')],_0x3b228b[_0xf617('0x31')]);_0x41a2d4['attributes']=_[_0xf617('0x34')](_0x3b228b[_0xf617('0x30')],qs[_0xf617('0x35')](_0x229b46['query'][_0xf617('0x35')]));_0x41a2d4[_0xf617('0x36')]=_0x41a2d4[_0xf617('0x36')]['length']?_0x41a2d4['attributes']:_0x3b228b['model'];if(!_0x229b46[_0xf617('0x31')][_0xf617('0x37')](_0xf617('0x38'))){_0x41a2d4[_0xf617('0x1e')]=qs['limit'](_0x229b46[_0xf617('0x31')]['limit']);_0x41a2d4['offset']=qs['offset'](_0x229b46[_0xf617('0x31')][_0xf617('0x1c')]);}_0x41a2d4['order']=qs['sort'](_0x229b46[_0xf617('0x31')][_0xf617('0x39')]);_0x41a2d4[_0xf617('0x3a')]=qs[_0xf617('0x33')](_[_0xf617('0x3b')](_0x229b46[_0xf617('0x31')],_0x3b228b[_0xf617('0x33')]),_0x1e437c);if(_0x229b46[_0xf617('0x31')][_0xf617('0x3c')]){_0x41a2d4[_0xf617('0x3a')]=_['merge'](_0x41a2d4['where'],{'$or':_[_0xf617('0x2d')](_0x1e437c,function(_0x7999d0){if(_0x7999d0[_0xf617('0x3d')]!=='VIRTUAL'){var _0x5e22cd={};_0x5e22cd[_0x7999d0[_0xf617('0x2b')]]={'$like':'%'+_0x229b46[_0xf617('0x31')][_0xf617('0x3c')]+'%'};return _0x5e22cd;}})});}_0x41a2d4=_[_0xf617('0x3e')]({},_0x41a2d4,_0x229b46[_0xf617('0x3f')]);var _0x3fbc06={'where':_0x41a2d4[_0xf617('0x3a')]};return db[_0xf617('0x2e')][_0xf617('0x1f')](_0x3fbc06)[_0xf617('0x24')](function(_0x315cb9){_0x2cb1aa[_0xf617('0x1f')]=_0x315cb9;if(_0x229b46[_0xf617('0x31')]['includeAll']){_0x41a2d4['include']=[{'all':!![]}];}return db['Campaign']['findAll'](_0x41a2d4);})[_0xf617('0x24')](function(_0x1ff0c8){_0x2cb1aa[_0xf617('0x40')]=_0x1ff0c8;return _0x2cb1aa;})[_0xf617('0x24')](respondWithFilteredResult(_0x46b8da,_0x41a2d4))[_0xf617('0x41')](handleError(_0x46b8da,null));};exports[_0xf617('0x42')]=function(_0x4100a2,_0x14dec8){var _0x2d624a={'raw':![],'where':{'id':_0x4100a2['params']['id']}},_0x4adcb4={};_0x4adcb4[_0xf617('0x30')]=_[_0xf617('0x32')](db['Campaign'][_0xf617('0x43')]);_0x4adcb4['query']=_[_0xf617('0x32')](_0x4100a2['query']);_0x4adcb4[_0xf617('0x33')]=_[_0xf617('0x34')](_0x4adcb4[_0xf617('0x30')],_0x4adcb4[_0xf617('0x31')]);_0x2d624a[_0xf617('0x36')]=_[_0xf617('0x34')](_0x4adcb4[_0xf617('0x30')],qs[_0xf617('0x35')](_0x4100a2[_0xf617('0x31')][_0xf617('0x35')]));_0x2d624a['attributes']=_0x2d624a[_0xf617('0x36')][_0xf617('0x44')]?_0x2d624a['attributes']:_0x4adcb4[_0xf617('0x30')];if(_0x4100a2[_0xf617('0x31')][_0xf617('0x45')]){_0x2d624a[_0xf617('0x46')]=[{'all':!![]}];}_0x2d624a=_[_0xf617('0x3e')]({},_0x2d624a,_0x4100a2[_0xf617('0x3f')]);return db[_0xf617('0x2e')][_0xf617('0x47')](_0x2d624a)[_0xf617('0x24')](handleEntityNotFound(_0x14dec8,null))[_0xf617('0x24')](respondWithResult(_0x14dec8,null))['catch'](handleError(_0x14dec8,null));};exports[_0xf617('0x48')]=function(_0x50839c,_0x5b2e54){return db[_0xf617('0x2e')][_0xf617('0x48')](_0x50839c[_0xf617('0x49')],{})[_0xf617('0x24')](function(_0x3e4001){var _0x7e882d=_0x50839c[_0xf617('0x4a')][_0xf617('0x26')]({'plain':!![]});if(!_0x7e882d)throw new Error(_0xf617('0x4b'));if(_0x7e882d['role']===_0xf617('0x4a')){var _0x14b2d3=_0x3e4001[_0xf617('0x26')]({'plain':!![]});var _0x54c84e=_0xf617('0x27');return db[_0xf617('0x4c')][_0xf617('0x47')]({'where':{'name':_0x54c84e,'userProfileId':_0x7e882d[_0xf617('0x4d')]},'raw':!![]})[_0xf617('0x24')](function(_0x8b2a06){if(_0x8b2a06&&_0x8b2a06['autoAssociation']===0x0){return db[_0xf617('0x28')]['create']({'name':_0x14b2d3[_0xf617('0x2b')],'resourceId':_0x14b2d3['id'],'type':_0x8b2a06['name'],'sectionId':_0x8b2a06['id']},{})['then'](function(){return _0x3e4001;});}else{return _0x3e4001;}})['catch'](function(_0x4ae37a){logger[_0xf617('0x29')](_0xf617('0x4e'),_0x4ae37a);throw _0x4ae37a;});}return _0x3e4001;})[_0xf617('0x24')](respondWithResult(_0x5b2e54,0xc9))[_0xf617('0x41')](handleError(_0x5b2e54,null));};exports[_0xf617('0x4f')]=function(_0x4010e5,_0x2c1060){var _0x22f17c={'where':{'id':_0x4010e5['params']['id']}},_0x1e3924={};_0x1e3924[_0xf617('0x30')]=_[_0xf617('0x32')](db['Campaign'][_0xf617('0x43')]);_0x22f17c[_0xf617('0x36')]=_[_0xf617('0x34')](_0x1e3924[_0xf617('0x30')],qs[_0xf617('0x35')](_0x4010e5['query'][_0xf617('0x35')]));_0x22f17c['attributes']=_0x22f17c['attributes'][_0xf617('0x44')]?_0x22f17c[_0xf617('0x36')]:_0x1e3924[_0xf617('0x30')];if(_0x4010e5['query']['includeAll']){_0x22f17c[_0xf617('0x46')]=[{'all':!![]}];}_0x22f17c=_[_0xf617('0x3e')]({},_0x22f17c,_0x4010e5[_0xf617('0x3f')]);return db[_0xf617('0x2e')][_0xf617('0x47')](_0x22f17c)[_0xf617('0x24')](handleEntityNotFound(_0x2c1060,null))[_0xf617('0x24')](function(_0x3a4294){if(_0x3a4294){var _0x24f160=_0x3a4294['get']({'plain':!![]});_0x24f160=qs[_0xf617('0x50')](_0x24f160,['id',_0xf617('0x51'),'updatedAt']);_0x4010e5[_0xf617('0x49')]=_[_0xf617('0x50')](_0x4010e5[_0xf617('0x49')],['id',_0xf617('0x51'),_0xf617('0x52')]);return db['Campaign'][_0xf617('0x48')](_[_0xf617('0x3e')](_0x24f160,_0x4010e5[_0xf617('0x49')]),{'include':_0x4010e5[_0xf617('0x31')][_0xf617('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x5a6425){var _0x2e8b4e=_0x4010e5[_0xf617('0x4a')][_0xf617('0x26')]({'plain':!![]});if(!_0x2e8b4e)throw new Error(_0xf617('0x4b'));if(_0x2e8b4e[_0xf617('0x53')]===_0xf617('0x4a')){var _0x11d662=_0x5a6425['get']({'plain':!![]});var _0x48578f=_0xf617('0x27');return db['UserProfileSection'][_0xf617('0x47')]({'where':{'name':_0x48578f,'userProfileId':_0x2e8b4e[_0xf617('0x4d')]},'raw':!![]})[_0xf617('0x24')](function(_0x4f8508){if(_0x4f8508&&_0x4f8508[_0xf617('0x54')]===0x0){return db['UserProfileResource'][_0xf617('0x48')]({'name':_0x11d662[_0xf617('0x2b')],'resourceId':_0x11d662['id'],'type':_0x4f8508[_0xf617('0x2b')],'sectionId':_0x4f8508['id']},{})['then'](function(){return _0x5a6425;});}else{return _0x5a6425;}})[_0xf617('0x41')](function(_0x2dd639){logger[_0xf617('0x29')](_0xf617('0x4e'),_0x2dd639);throw _0x2dd639;});}return _0x5a6425;});}})[_0xf617('0x24')](respondWithResult(_0x2c1060,0xc9))[_0xf617('0x41')](handleError(_0x2c1060,null));};exports[_0xf617('0x23')]=function(_0x3bcf7f,_0x2bca5f){if(_0x3bcf7f[_0xf617('0x49')]['id']){delete _0x3bcf7f[_0xf617('0x49')]['id'];}return db[_0xf617('0x2e')][_0xf617('0x47')]({'where':{'id':_0x3bcf7f[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x2bca5f,null))['then'](saveUpdates(_0x3bcf7f[_0xf617('0x49')],null))[_0xf617('0x24')](respondWithResult(_0x2bca5f,null))[_0xf617('0x41')](handleError(_0x2bca5f,null));};exports[_0xf617('0x25')]=function(_0x5ea2b7,_0x1f39c1){return db[_0xf617('0x2e')][_0xf617('0x47')]({'where':{'id':_0x5ea2b7[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x1f39c1,null))[_0xf617('0x24')](removeEntity(_0x1f39c1,null))[_0xf617('0x41')](handleError(_0x1f39c1,null));};exports[_0xf617('0x56')]=function(_0x45e768,_0x9f17bf,_0x42ca2b){var _0x1ff1c7={'raw':!![],'where':{}};var _0x261747={};var _0xd09a7e={'count':0x0,'rows':[]};return db[_0xf617('0x2e')][_0xf617('0x57')]({'where':{'id':_0x45e768[_0xf617('0x55')]['id']}})['then'](handleEntityNotFound(_0x9f17bf,null))[_0xf617('0x24')](function(_0x1f9e27){if(_0x1f9e27){_0x261747[_0xf617('0x30')]=_[_0xf617('0x32')](db[_0xf617('0x58')][_0xf617('0x43')]);_0x261747[_0xf617('0x31')]=_[_0xf617('0x32')](_0x45e768[_0xf617('0x31')]);_0x261747[_0xf617('0x33')]=_['intersection'](_0x261747[_0xf617('0x30')],_0x261747[_0xf617('0x31')]);_0x1ff1c7['attributes']=_[_0xf617('0x34')](_0x261747[_0xf617('0x30')],qs['fields'](_0x45e768[_0xf617('0x31')][_0xf617('0x35')]));_0x1ff1c7['attributes']=_0x1ff1c7['attributes']['length']?_0x1ff1c7[_0xf617('0x36')]:_0x261747[_0xf617('0x30')];if(!_0x45e768['query'][_0xf617('0x37')](_0xf617('0x38'))){_0x1ff1c7[_0xf617('0x1e')]=qs[_0xf617('0x1e')](_0x45e768[_0xf617('0x31')][_0xf617('0x1e')]);_0x1ff1c7[_0xf617('0x1c')]=qs[_0xf617('0x1c')](_0x45e768['query']['offset']);}_0x1ff1c7['order']=qs[_0xf617('0x39')](_0x45e768[_0xf617('0x31')][_0xf617('0x39')]);_0x1ff1c7[_0xf617('0x3a')]=qs[_0xf617('0x33')](_['pick'](_0x45e768['query'],_0x261747['filters']));_0x1ff1c7['where'][_0xf617('0x59')]=_0x1f9e27['id'];if(_0x45e768['query'][_0xf617('0x3c')]){_0x1ff1c7['where']=_['merge'](_0x1ff1c7['where'],{'$or':_[_0xf617('0x2d')](_0x1ff1c7[_0xf617('0x36')],function(_0x3907fb){var _0x51bcd8={};_0x51bcd8[_0x3907fb]={'$like':'%'+_0x45e768[_0xf617('0x31')]['filter']+'%'};return _0x51bcd8;})});}_0x1ff1c7=_['merge']({},_0x1ff1c7,_0x45e768[_0xf617('0x3f')]);return db['CmHopper'][_0xf617('0x1f')]({'where':_0x1ff1c7[_0xf617('0x3a')]})[_0xf617('0x24')](function(_0xb9bf61){_0xd09a7e[_0xf617('0x1f')]=_0xb9bf61;if(_0x45e768[_0xf617('0x31')][_0xf617('0x45')]){_0x1ff1c7[_0xf617('0x46')]=[{'all':!![]}];}return db[_0xf617('0x58')]['findAll'](_0x1ff1c7);})['then'](function(_0x40023f){_0xd09a7e['rows']=_0x40023f;return _0xd09a7e;});}})[_0xf617('0x24')](respondWithFilteredResult(_0x9f17bf,_0x1ff1c7))[_0xf617('0x41')](handleError(_0x9f17bf,null));};exports['getHopperHistories']=function(_0x328e48,_0x1acc5e,_0x34a502){var _0x2f08f5={'raw':!![],'where':{}};var _0x1666a6={};var _0x13a232={'count':0x0,'rows':[]};return db[_0xf617('0x2e')][_0xf617('0x57')]({'where':{'id':_0x328e48[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x1acc5e,null))['then'](function(_0x4d4f52){if(_0x4d4f52){_0x1666a6[_0xf617('0x30')]=_[_0xf617('0x32')](db['CmHopperHistory'][_0xf617('0x43')]);_0x1666a6[_0xf617('0x31')]=_[_0xf617('0x32')](_0x328e48[_0xf617('0x31')]);_0x1666a6[_0xf617('0x33')]=_[_0xf617('0x34')](_0x1666a6[_0xf617('0x30')],_0x1666a6['query']);_0x2f08f5[_0xf617('0x36')]=_[_0xf617('0x34')](_0x1666a6[_0xf617('0x30')],qs[_0xf617('0x35')](_0x328e48[_0xf617('0x31')][_0xf617('0x35')]));_0x2f08f5['attributes']=_0x2f08f5['attributes'][_0xf617('0x44')]?_0x2f08f5['attributes']:_0x1666a6['model'];if(!_0x328e48['query'][_0xf617('0x37')](_0xf617('0x38'))){_0x2f08f5[_0xf617('0x1e')]=qs['limit'](_0x328e48[_0xf617('0x31')]['limit']);_0x2f08f5[_0xf617('0x1c')]=qs[_0xf617('0x1c')](_0x328e48[_0xf617('0x31')][_0xf617('0x1c')]);}_0x2f08f5[_0xf617('0x5a')]=qs[_0xf617('0x39')](_0x328e48[_0xf617('0x31')][_0xf617('0x39')]);_0x2f08f5[_0xf617('0x3a')]=qs[_0xf617('0x33')](_[_0xf617('0x3b')](_0x328e48[_0xf617('0x31')],_0x1666a6['filters']));_0x2f08f5[_0xf617('0x3a')][_0xf617('0x59')]=_0x4d4f52['id'];if(_0x328e48['query'][_0xf617('0x3c')]){_0x2f08f5[_0xf617('0x3a')]=_[_0xf617('0x3e')](_0x2f08f5[_0xf617('0x3a')],{'$or':_[_0xf617('0x2d')](_0x2f08f5[_0xf617('0x36')],function(_0x222d35){var _0x55b52b={};_0x55b52b[_0x222d35]={'$like':'%'+_0x328e48[_0xf617('0x31')][_0xf617('0x3c')]+'%'};return _0x55b52b;})});}_0x2f08f5=_[_0xf617('0x3e')]({},_0x2f08f5,_0x328e48[_0xf617('0x3f')]);return db['CmHopperHistory'][_0xf617('0x1f')]({'where':_0x2f08f5['where']})[_0xf617('0x24')](function(_0x3c50d8){_0x13a232[_0xf617('0x1f')]=_0x3c50d8;if(_0x328e48[_0xf617('0x31')][_0xf617('0x45')]){_0x2f08f5[_0xf617('0x46')]=[{'all':!![]}];}return db[_0xf617('0x5b')][_0xf617('0x5c')](_0x2f08f5);})['then'](function(_0x10ed4b){_0x13a232[_0xf617('0x40')]=_0x10ed4b;return _0x13a232;});}})[_0xf617('0x24')](respondWithFilteredResult(_0x1acc5e,_0x2f08f5))[_0xf617('0x41')](handleError(_0x1acc5e,null));};exports[_0xf617('0x5d')]=function(_0x589545,_0x4e6b9f,_0x10f340){var _0x22b173={'raw':!![],'where':{}};var _0x4227fb={};var _0x43a8f1={'count':0x0,'rows':[]};return db[_0xf617('0x2e')][_0xf617('0x57')]({'where':{'id':_0x589545[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x4e6b9f,null))[_0xf617('0x24')](function(_0x298007){if(_0x298007){_0x4227fb[_0xf617('0x30')]=_[_0xf617('0x32')](db[_0xf617('0x5e')]['rawAttributes']);_0x4227fb[_0xf617('0x31')]=_['keys'](_0x589545[_0xf617('0x31')]);_0x4227fb[_0xf617('0x33')]=_[_0xf617('0x34')](_0x4227fb[_0xf617('0x30')],_0x4227fb['query']);_0x22b173[_0xf617('0x36')]=_[_0xf617('0x34')](_0x4227fb[_0xf617('0x30')],qs[_0xf617('0x35')](_0x589545[_0xf617('0x31')]['fields']));_0x22b173[_0xf617('0x36')]=_0x22b173[_0xf617('0x36')][_0xf617('0x44')]?_0x22b173['attributes']:_0x4227fb[_0xf617('0x30')];if(!_0x589545[_0xf617('0x31')][_0xf617('0x37')](_0xf617('0x38'))){_0x22b173[_0xf617('0x1e')]=qs[_0xf617('0x1e')](_0x589545[_0xf617('0x31')][_0xf617('0x1e')]);_0x22b173[_0xf617('0x1c')]=qs[_0xf617('0x1c')](_0x589545['query'][_0xf617('0x1c')]);}_0x22b173[_0xf617('0x5a')]=qs[_0xf617('0x39')](_0x589545['query']['sort']);_0x22b173['where']=qs[_0xf617('0x33')](_[_0xf617('0x3b')](_0x589545['query'],_0x4227fb['filters']));_0x22b173[_0xf617('0x3a')][_0xf617('0x59')]=_0x298007['id'];if(_0x589545[_0xf617('0x31')][_0xf617('0x3c')]){_0x22b173[_0xf617('0x3a')]=_[_0xf617('0x3e')](_0x22b173[_0xf617('0x3a')],{'$or':_[_0xf617('0x2d')](_0x22b173[_0xf617('0x36')],function(_0x59aaff){var _0x3b763f={};_0x3b763f[_0x59aaff]={'$like':'%'+_0x589545['query']['filter']+'%'};return _0x3b763f;})});}_0x22b173=_[_0xf617('0x3e')]({},_0x22b173,_0x589545[_0xf617('0x3f')]);return db[_0xf617('0x5e')][_0xf617('0x1f')]({'where':_0x22b173[_0xf617('0x3a')]})[_0xf617('0x24')](function(_0x2f26e9){_0x43a8f1[_0xf617('0x1f')]=_0x2f26e9;if(_0x589545[_0xf617('0x31')]['includeAll']){_0x22b173[_0xf617('0x46')]=[{'all':!![]}];}return db[_0xf617('0x5e')][_0xf617('0x5c')](_0x22b173);})['then'](function(_0x43c921){_0x43a8f1[_0xf617('0x40')]=_0x43c921;return _0x43a8f1;});}})[_0xf617('0x24')](respondWithFilteredResult(_0x4e6b9f,_0x22b173))[_0xf617('0x41')](handleError(_0x4e6b9f,null));};exports['getHopperBlacks']=function(_0x6f181e,_0x5f24,_0x45bd77){var _0x4fa12f={'raw':!![],'where':{}};var _0x21f44a={};var _0x1d1f50={'count':0x0,'rows':[]};return db[_0xf617('0x2e')][_0xf617('0x57')]({'where':{'id':_0x6f181e[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x5f24,null))[_0xf617('0x24')](function(_0x1754e5){if(_0x1754e5){_0x21f44a[_0xf617('0x30')]=_['keys'](db[_0xf617('0x5f')][_0xf617('0x43')]);_0x21f44a['query']=_['keys'](_0x6f181e[_0xf617('0x31')]);_0x21f44a[_0xf617('0x33')]=_[_0xf617('0x34')](_0x21f44a[_0xf617('0x30')],_0x21f44a[_0xf617('0x31')]);_0x4fa12f['attributes']=_[_0xf617('0x34')](_0x21f44a[_0xf617('0x30')],qs[_0xf617('0x35')](_0x6f181e[_0xf617('0x31')]['fields']));_0x4fa12f[_0xf617('0x36')]=_0x4fa12f[_0xf617('0x36')][_0xf617('0x44')]?_0x4fa12f['attributes']:_0x21f44a[_0xf617('0x30')];if(!_0x6f181e[_0xf617('0x31')][_0xf617('0x37')]('nolimit')){_0x4fa12f['limit']=qs['limit'](_0x6f181e[_0xf617('0x31')][_0xf617('0x1e')]);_0x4fa12f['offset']=qs[_0xf617('0x1c')](_0x6f181e[_0xf617('0x31')][_0xf617('0x1c')]);}_0x4fa12f[_0xf617('0x5a')]=qs['sort'](_0x6f181e[_0xf617('0x31')][_0xf617('0x39')]);_0x4fa12f[_0xf617('0x3a')]=qs[_0xf617('0x33')](_[_0xf617('0x3b')](_0x6f181e[_0xf617('0x31')],_0x21f44a['filters']));_0x4fa12f['where']['CampaignId']=_0x1754e5['id'];if(_0x6f181e[_0xf617('0x31')][_0xf617('0x3c')]){_0x4fa12f[_0xf617('0x3a')]=_[_0xf617('0x3e')](_0x4fa12f['where'],{'$or':_[_0xf617('0x2d')](_0x4fa12f[_0xf617('0x36')],function(_0x31148b){var _0x5a9d5e={};_0x5a9d5e[_0x31148b]={'$like':'%'+_0x6f181e[_0xf617('0x31')][_0xf617('0x3c')]+'%'};return _0x5a9d5e;})});}_0x4fa12f=_[_0xf617('0x3e')]({},_0x4fa12f,_0x6f181e[_0xf617('0x3f')]);return db[_0xf617('0x5f')]['count']({'where':_0x4fa12f['where']})['then'](function(_0x12b459){_0x1d1f50[_0xf617('0x1f')]=_0x12b459;if(_0x6f181e['query']['includeAll']){_0x4fa12f[_0xf617('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xf617('0x5c')](_0x4fa12f);})[_0xf617('0x24')](function(_0x9afc63){_0x1d1f50[_0xf617('0x40')]=_0x9afc63;return _0x1d1f50;});}})[_0xf617('0x24')](respondWithFilteredResult(_0x5f24,_0x4fa12f))[_0xf617('0x41')](handleError(_0x5f24,null));};exports['getLists']=function(_0x3d5c02,_0x25a747,_0x4d1b89){var _0x4ccfc1={};var _0x66d7aa={};var _0x1b5d02;var _0x21c1d6;return db['Campaign'][_0xf617('0x57')]({'where':{'id':_0x3d5c02[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x25a747,null))[_0xf617('0x24')](function(_0x5c893c){if(_0x5c893c){_0x1b5d02=_0x5c893c;_0x66d7aa['model']=_[_0xf617('0x32')](db[_0xf617('0x60')][_0xf617('0x43')]);_0x66d7aa[_0xf617('0x31')]=_[_0xf617('0x32')](_0x3d5c02[_0xf617('0x31')]);_0x66d7aa[_0xf617('0x33')]=_[_0xf617('0x34')](_0x66d7aa[_0xf617('0x30')],_0x66d7aa[_0xf617('0x31')]);_0x4ccfc1[_0xf617('0x36')]=_[_0xf617('0x34')](_0x66d7aa[_0xf617('0x30')],qs[_0xf617('0x35')](_0x3d5c02[_0xf617('0x31')][_0xf617('0x35')]));_0x4ccfc1[_0xf617('0x36')]=_0x4ccfc1['attributes'][_0xf617('0x44')]?_0x4ccfc1['attributes']:_0x66d7aa[_0xf617('0x30')];_0x4ccfc1[_0xf617('0x5a')]=qs[_0xf617('0x39')](_0x3d5c02[_0xf617('0x31')][_0xf617('0x39')]);_0x4ccfc1[_0xf617('0x3a')]=qs[_0xf617('0x33')](_[_0xf617('0x3b')](_0x3d5c02[_0xf617('0x31')],_0x66d7aa['filters']));if(_0x3d5c02[_0xf617('0x31')][_0xf617('0x3c')]){_0x4ccfc1[_0xf617('0x3a')]=_['merge'](_0x4ccfc1[_0xf617('0x3a')],{'$or':_[_0xf617('0x2d')](_0x4ccfc1[_0xf617('0x36')],function(_0x6ca8f5){var _0x263765={};_0x263765[_0x6ca8f5]={'$like':'%'+_0x3d5c02[_0xf617('0x31')][_0xf617('0x3c')]+'%'};return _0x263765;})});}_0x4ccfc1=_[_0xf617('0x3e')]({},_0x4ccfc1,_0x3d5c02['options']);return _0x1b5d02[_0xf617('0x61')](_0x4ccfc1);}})[_0xf617('0x24')](function(_0x29e613){if(_0x29e613){_0x21c1d6=_0x29e613['length'];if(!_0x3d5c02[_0xf617('0x31')]['hasOwnProperty'](_0xf617('0x38'))){_0x4ccfc1[_0xf617('0x1e')]=qs['limit'](_0x3d5c02[_0xf617('0x31')]['limit']);_0x4ccfc1['offset']=qs[_0xf617('0x1c')](_0x3d5c02[_0xf617('0x31')][_0xf617('0x1c')]);}return _0x1b5d02[_0xf617('0x61')](_0x4ccfc1);}})[_0xf617('0x24')](function(_0x4d10ec){if(_0x4d10ec){return _0x4d10ec?{'count':_0x21c1d6,'rows':_0x4d10ec}:null;}})['then'](respondWithResult(_0x25a747,null))[_0xf617('0x41')](handleError(_0x25a747,null));};exports[_0xf617('0x62')]=function(_0x44ea92,_0x58486b,_0x22999f){var _0x1c4603,_0x3c4b3c;var _0x3f6ee1=[];var _0x1df431=moment()[_0xf617('0x63')](_0xf617('0x64'));return db[_0xf617('0x2e')][_0xf617('0x47')]({'where':{'id':_0x44ea92[_0xf617('0x55')]['id']}})['then'](handleEntityNotFound(_0x58486b,null))[_0xf617('0x24')](function(_0xb946d1){if(_0xb946d1){_0x3c4b3c=_0xb946d1;return _0xb946d1[_0xf617('0x62')](_0x44ea92[_0xf617('0x49')]['ids'],_[_0xf617('0x50')](_0x44ea92['body'],[_0xf617('0x65'),'id'])||{});}return null;})[_0xf617('0x66')](function(_0x804353){var _0x229431;var _0x90c3b6;_0x1c4603=_0x804353||[];var _0x1d4a09=[];if(_0x804353){for(var _0x2c1178=0x0;_0x2c1178<_0x804353[_0xf617('0x44')];_0x2c1178+=0x1){var _0x428875=_0x804353[_0x2c1178][_0xf617('0x26')]({'plain':!![]});_0x3c4b3c[_0xf617('0x67')]=_0x44ea92['body'][_0xf617('0x67')]?_0x44ea92[_0xf617('0x49')]['dialCheckDuplicateType']:_0x3c4b3c['dialCheckDuplicateType'];switch(_0x3c4b3c['dialCheckDuplicateType']){case _0xf617('0x68'):_0x229431=squel['insert']()[_0xf617('0x69')](_0xf617('0x6a'))[_0xf617('0x6b')]([_0xf617('0x6c'),_0xf617('0x6d'),'ContactId','ListId',_0xf617('0x59'),_0xf617('0x51'),'updatedAt'],squel[_0xf617('0x6e')]()[_0xf617('0x6f')]('phone',_0xf617('0x6c'))['field'](_0xf617('0x70'),_0xf617('0x6d'))[_0xf617('0x6f')]('id',_0xf617('0x71'))[_0xf617('0x6f')](_0x428875['CmListId'][_0xf617('0x72')](),'ListId')[_0xf617('0x6f')](_0x44ea92[_0xf617('0x55')]['id'][_0xf617('0x72')](),_0xf617('0x59'))[_0xf617('0x6f')]('\x27'+_0x1df431+'\x27',_0xf617('0x51'))[_0xf617('0x6f')]('\x27'+_0x1df431+'\x27',_0xf617('0x52'))[_0xf617('0x73')](_0xf617('0x74'))[_0xf617('0x3a')](_0xf617('0x75'))[_0xf617('0x3a')](_0xf617('0x76'),_0x428875[_0xf617('0x77')][_0xf617('0x72')]())[_0xf617('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0xf617('0x3a')](_0xf617('0x78'),squel[_0xf617('0x6e')]()['field'](_0xf617('0x79'))['from']('cm_hopper_final')['where'](_0xf617('0x7a'),_0x44ea92['params']['id'][_0xf617('0x72')]()))[_0xf617('0x3a')](_0xf617('0x78'),squel[_0xf617('0x6e')]()[_0xf617('0x6f')]('COALESCE(phone,\x27\x27)')[_0xf617('0x73')](_0xf617('0x6a'))[_0xf617('0x3a')]('CampaignId\x20=\x20?',_0x44ea92['params']['id'][_0xf617('0x72')]())))[_0xf617('0x72')]();break;case _0xf617('0x7b'):_0x229431=squel[_0xf617('0x7c')]()[_0xf617('0x69')](_0xf617('0x6a'))[_0xf617('0x6b')](['phone','scheduledAt','ContactId',_0xf617('0x7d'),_0xf617('0x59'),_0xf617('0x51'),'updatedAt'],squel[_0xf617('0x6e')]()[_0xf617('0x6f')](_0xf617('0x6c'),_0xf617('0x6c'))[_0xf617('0x6f')](_0xf617('0x70'),_0xf617('0x6d'))[_0xf617('0x6f')]('id',_0xf617('0x71'))[_0xf617('0x6f')](_0x428875['CmListId'][_0xf617('0x72')](),_0xf617('0x7d'))[_0xf617('0x6f')](_0x44ea92[_0xf617('0x55')]['id'][_0xf617('0x72')](),_0xf617('0x59'))['field']('\x27'+_0x1df431+'\x27',_0xf617('0x51'))[_0xf617('0x6f')]('\x27'+_0x1df431+'\x27',_0xf617('0x52'))['from'](_0xf617('0x74'))[_0xf617('0x3a')](_0xf617('0x75'))['where'](_0xf617('0x76'),_0x428875['CmListId'][_0xf617('0x72')]())['where'](_0xf617('0x7e'))[_0xf617('0x3a')](_0xf617('0x78'),squel[_0xf617('0x6e')]()[_0xf617('0x6f')]('COALESCE(phone,\x27\x27)')[_0xf617('0x73')](_0xf617('0x6a'))[_0xf617('0x3a')](_0xf617('0x7a'),_0x44ea92[_0xf617('0x55')]['id']['toString']())))[_0xf617('0x72')]();break;default:_0x229431=squel[_0xf617('0x7c')]()['into'](_0xf617('0x6a'))['fromQuery']([_0xf617('0x6c'),_0xf617('0x6d'),_0xf617('0x71'),'ListId',_0xf617('0x59'),_0xf617('0x51'),'updatedAt'],squel['select']()[_0xf617('0x6f')](_0xf617('0x6c'),_0xf617('0x6c'))[_0xf617('0x6f')](_0xf617('0x70'),_0xf617('0x6d'))['field']('id',_0xf617('0x71'))[_0xf617('0x6f')](_0x428875[_0xf617('0x77')]['toString'](),_0xf617('0x7d'))[_0xf617('0x6f')](_0x44ea92['params']['id'][_0xf617('0x72')](),_0xf617('0x59'))['field']('\x27'+_0x1df431+'\x27',_0xf617('0x51'))[_0xf617('0x6f')]('\x27'+_0x1df431+'\x27',_0xf617('0x52'))[_0xf617('0x73')](_0xf617('0x74'))['where']('deletedAt\x20IS\x20NULL')[_0xf617('0x3a')]('ListId\x20=\x20?',_0x428875['CmListId']['toString']())[_0xf617('0x3a')](_0xf617('0x7e')))['toString']();}_0x90c3b6=squel[_0xf617('0x7c')]()[_0xf617('0x69')](_0xf617('0x7f'))['fromQuery']([_0xf617('0x80'),_0xf617('0x6d'),'phone',_0xf617('0x81'),'createdAt','updatedAt'],squel[_0xf617('0x6e')]()['field'](_0xf617('0x82'),'id')['field'](_0xf617('0x70'),_0xf617('0x6d'))['field'](_0xf617('0x83'),_0xf617('0x6c'))['field'](_0xf617('0x84'),_0xf617('0x81'))[_0xf617('0x6f')]('\x27'+_0x1df431+'\x27','createdAt')[_0xf617('0x6f')]('\x27'+_0x1df431+'\x27',_0xf617('0x52'))['from']('cm_contact_has_items','ci')[_0xf617('0x85')]('cm_hopper','h',_0xf617('0x86'))[_0xf617('0x3a')]('h.ListId\x20=\x20?',_0x428875[_0xf617('0x77')]['toString']())['where']('h.CampaignId=?',_0x44ea92['params']['id']['toString']())[_0xf617('0x3a')](_0xf617('0x87'),_0x1df431))[_0xf617('0x72')]();_0x1d4a09[_0xf617('0x88')](db[_0xf617('0x89')][_0xf617('0x31')](_0x229431));_0x3f6ee1[_0xf617('0x88')](db[_0xf617('0x89')][_0xf617('0x31')](_0x90c3b6));}return BPromise[_0xf617('0x8a')](_0x1d4a09);}})[_0xf617('0x24')](function(){return BPromise[_0xf617('0x8a')](_0x3f6ee1);})[_0xf617('0x24')](function(){return _0x1c4603;})[_0xf617('0x24')](respondWithResult(_0x58486b,null))[_0xf617('0x41')](handleError(_0x58486b,null));};exports[_0xf617('0x8b')]=function(_0x1a0f8d,_0x23202e,_0x33d5a8){return db[_0xf617('0x2e')][_0xf617('0x47')]({'where':{'id':_0x1a0f8d[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x23202e,null))[_0xf617('0x24')](function(_0x2e2895){if(_0x2e2895){return _0x2e2895['removeLists'](_0x1a0f8d[_0xf617('0x31')][_0xf617('0x65')]);}})[_0xf617('0x24')](function(_0x3cfe3e){if(_0x3cfe3e){return db[_0xf617('0x58')][_0xf617('0x25')]({'where':{'ListId':_0x1a0f8d[_0xf617('0x31')]['ids'],'CampaignId':_0x1a0f8d['params']['id']}})[_0xf617('0x24')](function(){return _0x3cfe3e;});}})[_0xf617('0x24')](respondWithStatusCode(_0x23202e,null))[_0xf617('0x41')](handleError(_0x23202e,null));};exports[_0xf617('0x8c')]=function(_0x4c0955,_0x4d90b3,_0x262c05){var _0x372ed4={};var _0x12c83a={};var _0x3c09ae;var _0xdf6ebe;return db[_0xf617('0x2e')][_0xf617('0x57')]({'where':{'id':_0x4c0955[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x4d90b3,null))['then'](function(_0x5d5103){if(_0x5d5103){_0x3c09ae=_0x5d5103;_0x12c83a['model']=_[_0xf617('0x32')](db[_0xf617('0x60')]['rawAttributes']);_0x12c83a[_0xf617('0x31')]=_[_0xf617('0x32')](_0x4c0955[_0xf617('0x31')]);_0x12c83a[_0xf617('0x33')]=_[_0xf617('0x34')](_0x12c83a[_0xf617('0x30')],_0x12c83a[_0xf617('0x31')]);_0x372ed4['attributes']=_['intersection'](_0x12c83a['model'],qs['fields'](_0x4c0955['query'][_0xf617('0x35')]));_0x372ed4[_0xf617('0x36')]=_0x372ed4[_0xf617('0x36')][_0xf617('0x44')]?_0x372ed4[_0xf617('0x36')]:_0x12c83a[_0xf617('0x30')];_0x372ed4[_0xf617('0x5a')]=qs['sort'](_0x4c0955[_0xf617('0x31')][_0xf617('0x39')]);_0x372ed4[_0xf617('0x3a')]=qs[_0xf617('0x33')](_[_0xf617('0x3b')](_0x4c0955[_0xf617('0x31')],_0x12c83a['filters']));if(_0x4c0955[_0xf617('0x31')][_0xf617('0x3c')]){_0x372ed4[_0xf617('0x3a')]=_[_0xf617('0x3e')](_0x372ed4[_0xf617('0x3a')],{'$or':_['map'](_0x372ed4[_0xf617('0x36')],function(_0xdb7e84){var _0x5a99ed={};_0x5a99ed[_0xdb7e84]={'$like':'%'+_0x4c0955[_0xf617('0x31')]['filter']+'%'};return _0x5a99ed;})});}_0x372ed4=_[_0xf617('0x3e')]({},_0x372ed4,_0x4c0955[_0xf617('0x3f')]);return _0x3c09ae[_0xf617('0x8c')](_0x372ed4);}})[_0xf617('0x24')](function(_0x58d56b){if(_0x58d56b){_0xdf6ebe=_0x58d56b[_0xf617('0x44')];if(!_0x4c0955[_0xf617('0x31')][_0xf617('0x37')](_0xf617('0x38'))){_0x372ed4[_0xf617('0x1e')]=qs[_0xf617('0x1e')](_0x4c0955[_0xf617('0x31')][_0xf617('0x1e')]);_0x372ed4[_0xf617('0x1c')]=qs[_0xf617('0x1c')](_0x4c0955[_0xf617('0x31')][_0xf617('0x1c')]);}return _0x3c09ae[_0xf617('0x8c')](_0x372ed4);}})[_0xf617('0x24')](function(_0x544a62){if(_0x544a62){return _0x544a62?{'count':_0xdf6ebe,'rows':_0x544a62}:null;}})[_0xf617('0x24')](respondWithResult(_0x4d90b3,null))[_0xf617('0x41')](handleError(_0x4d90b3,null));};exports[_0xf617('0x8d')]=function(_0x15b90b,_0x23c044,_0x1aaf9b){var _0x3035ea,_0x16f4f0;var _0x106bd6=[];var _0x523df4=moment()[_0xf617('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xf617('0x2e')]['find']({'where':{'id':_0x15b90b[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x23c044,null))[_0xf617('0x24')](function(_0x48999e){if(_0x48999e){_0x16f4f0=_0x48999e;return _0x48999e['addBlackLists'](_0x15b90b['body'][_0xf617('0x65')],_[_0xf617('0x50')](_0x15b90b['body'],[_0xf617('0x65'),'id'])||{});}return null;})[_0xf617('0x66')](function(_0x58b6ae){var _0x1ec43b;var _0xb3ffc8;_0x3035ea=_0x58b6ae||[];var _0x4f649c=[];if(_0x58b6ae){for(var _0x991dae=0x0;_0x991dae<_0x58b6ae[_0xf617('0x44')];_0x991dae+=0x1){var _0x41e837=_0x58b6ae[_0x991dae]['get']({'plain':!![]});_0x1ec43b=squel['insert']()[_0xf617('0x69')](_0xf617('0x8e'))[_0xf617('0x6b')]([_0xf617('0x6c'),_0xf617('0x71'),_0xf617('0x7d'),'CampaignId',_0xf617('0x51'),_0xf617('0x52')],squel[_0xf617('0x6e')]()['field'](_0xf617('0x6c'),_0xf617('0x6c'))[_0xf617('0x6f')]('id',_0xf617('0x71'))[_0xf617('0x6f')](_0x41e837[_0xf617('0x77')][_0xf617('0x72')](),_0xf617('0x7d'))['field'](_0x15b90b[_0xf617('0x55')]['id'][_0xf617('0x72')](),_0xf617('0x59'))[_0xf617('0x6f')](_0xf617('0x70'),_0xf617('0x51'))[_0xf617('0x6f')](_0xf617('0x70'),_0xf617('0x52'))[_0xf617('0x73')]('cm_contacts')[_0xf617('0x3a')](_0xf617('0x75'))[_0xf617('0x3a')](_0xf617('0x76'),_0x41e837[_0xf617('0x77')]['toString']())[_0xf617('0x3a')](_0xf617('0x7e')))[_0xf617('0x72')]();_0x4f649c['push'](db[_0xf617('0x89')][_0xf617('0x31')](_0x1ec43b));}return BPromise['all'](_0x4f649c);}})[_0xf617('0x24')](function(){return _0x3035ea;})['then'](respondWithResult(_0x23c044,null))[_0xf617('0x41')](handleError(_0x23c044,null));};exports[_0xf617('0x8f')]=function(_0x2bb211,_0x19f7da,_0x3c9615){return db['Campaign'][_0xf617('0x47')]({'where':{'id':_0x2bb211[_0xf617('0x55')]['id']}})[_0xf617('0x24')](handleEntityNotFound(_0x19f7da,null))[_0xf617('0x24')](function(_0x31a9d2){if(_0x31a9d2){return _0x31a9d2[_0xf617('0x8f')](_0x2bb211[_0xf617('0x31')]['ids']);}})['then'](function(_0x17eb81){if(_0x17eb81){return db[_0xf617('0x5f')][_0xf617('0x25')]({'where':{'ListId':_0x2bb211[_0xf617('0x31')][_0xf617('0x65')],'CampaignId':_0x2bb211[_0xf617('0x55')]['id']}})[_0xf617('0x24')](function(){return _0x17eb81;});}})[_0xf617('0x24')](respondWithStatusCode(_0x19f7da,null))[_0xf617('0x41')](handleError(_0x19f7da,null));}; \ No newline at end of file +var _0x74f0=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','findAll','show','params','merge','catch','create','body','user','get','role','IvrCampaigns','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','getHoppers','findOne','CmHopper','nolimit','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','cm_hopper_additional_phones','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','phone\x20IS\x20NOT\x20NULL','removeBlackLists','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0xe2df50,_0x1aded4){var _0x261c1e=function(_0x2defa1){while(--_0x2defa1){_0xe2df50['push'](_0xe2df50['shift']());}};_0x261c1e(++_0x1aded4);}(_0x74f0,0xf3));var _0x074f=function(_0x2a6501,_0x9c5a0e){_0x2a6501=_0x2a6501-0x0;var _0x34d3ae=_0x74f0[_0x2a6501];return _0x34d3ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x074f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x074f('0x1'));var moment=require(_0x074f('0x2'));var BPromise=require(_0x074f('0x3'));var Mustache=require(_0x074f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x074f('0x5'));var csv=require(_0x074f('0x6'));var ejs=require(_0x074f('0x7'));var fs=require('fs');var fs_extra=require(_0x074f('0x8'));var _=require(_0x074f('0x9'));var squel=require(_0x074f('0xa'));var crypto=require(_0x074f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x074f('0xc'));var toCsv=require(_0x074f('0x6'));var querystring=require('querystring');var Papa=require(_0x074f('0xd'));var Redis=require(_0x074f('0xe'));var authService=require(_0x074f('0xf'));var qs=require(_0x074f('0x10'));var as=require(_0x074f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x074f('0x12'));var utils=require(_0x074f('0x13'));var config=require(_0x074f('0x14'));var licenseUtil=require(_0x074f('0x15'));var db=require(_0x074f('0x16'))['db'];function respondWithStatusCode(_0x2416e0,_0x1d3304){_0x1d3304=_0x1d3304||0xcc;return function(_0x46cea0){if(_0x46cea0){return _0x2416e0[_0x074f('0x17')](_0x1d3304);}return _0x2416e0['status'](_0x1d3304)[_0x074f('0x18')]();};}function respondWithResult(_0x59f78a,_0x12ed92){_0x12ed92=_0x12ed92||0xc8;return function(_0x3bf07f){if(_0x3bf07f){return _0x59f78a[_0x074f('0x19')](_0x12ed92)[_0x074f('0x1a')](_0x3bf07f);}};}function respondWithFilteredResult(_0x2d7c55,_0x237960){return function(_0x7e19fe){if(_0x7e19fe){var _0x1edf9c=typeof _0x237960[_0x074f('0x1b')]===_0x074f('0x1c')&&typeof _0x237960[_0x074f('0x1d')]==='undefined';var _0x111e1f=_0x7e19fe[_0x074f('0x1e')];var _0x200e43=_0x1edf9c?0x0:_0x237960[_0x074f('0x1b')];var _0x315e7d=_0x1edf9c?_0x7e19fe[_0x074f('0x1e')]:_0x237960['offset']+_0x237960['limit'];var _0x1d241d;if(_0x315e7d>=_0x111e1f){_0x315e7d=_0x111e1f;_0x1d241d=0xc8;}else{_0x1d241d=0xce;}_0x2d7c55['status'](_0x1d241d);return _0x2d7c55['set'](_0x074f('0x1f'),_0x200e43+'-'+_0x315e7d+'/'+_0x111e1f)[_0x074f('0x1a')](_0x7e19fe);}return null;};}function patchUpdates(_0x1563f3){return function(_0x5feafd){try{jsonpatch[_0x074f('0x20')](_0x5feafd,_0x1563f3,!![]);}catch(_0x210221){return BPromise[_0x074f('0x21')](_0x210221);}return _0x5feafd[_0x074f('0x22')]();};}function saveUpdates(_0x1acf0a,_0x2c3b23){return function(_0x335170){if(_0x335170){return _0x335170[_0x074f('0x23')](_0x1acf0a)[_0x074f('0x24')](function(_0x2fc5b0){return _0x2fc5b0;});}return null;};}function removeEntity(_0x39e502,_0x1bd2c7){return function(_0xdfa2d8){if(_0xdfa2d8){return _0xdfa2d8[_0x074f('0x25')]()[_0x074f('0x24')](function(){var _0x8b8e98=_0xdfa2d8['get']({'plain':!![]});var _0x4ee6ac='IvrCampaigns';return db[_0x074f('0x26')][_0x074f('0x25')]({'where':{'type':_0x4ee6ac,'resourceId':_0x8b8e98['id']}})[_0x074f('0x24')](function(){return _0xdfa2d8;});})[_0x074f('0x24')](function(){_0x39e502['status'](0xcc)[_0x074f('0x18')]();});}};}function handleEntityNotFound(_0x339370,_0x3fb202){return function(_0x312119){if(!_0x312119){_0x339370[_0x074f('0x17')](0x194);}return _0x312119;};}function handleError(_0xb9722a,_0x508db2){_0x508db2=_0x508db2||0x1f4;return function(_0x1bf574){logger[_0x074f('0x27')](_0x1bf574[_0x074f('0x28')]);if(_0x1bf574['name']){delete _0x1bf574[_0x074f('0x29')];}_0xb9722a['status'](_0x508db2)['send'](_0x1bf574);};}exports[_0x074f('0x2a')]=function(_0x4b540c,_0x4aa96f){var _0x214611={},_0x3d6bc1={},_0x177d53={'count':0x0,'rows':[]};var _0x5526b7=_[_0x074f('0x2b')](db[_0x074f('0x2c')][_0x074f('0x2d')],function(_0x50314d){return{'name':_0x50314d[_0x074f('0x2e')],'type':_0x50314d[_0x074f('0x2f')][_0x074f('0x30')]};});_0x3d6bc1[_0x074f('0x31')]=_[_0x074f('0x2b')](_0x5526b7,'name');_0x3d6bc1[_0x074f('0x32')]=_[_0x074f('0x33')](_0x4b540c['query']);_0x3d6bc1[_0x074f('0x34')]=_[_0x074f('0x35')](_0x3d6bc1[_0x074f('0x31')],_0x3d6bc1['query']);_0x214611[_0x074f('0x36')]=_[_0x074f('0x35')](_0x3d6bc1['model'],qs[_0x074f('0x37')](_0x4b540c[_0x074f('0x32')][_0x074f('0x37')]));_0x214611[_0x074f('0x36')]=_0x214611[_0x074f('0x36')][_0x074f('0x38')]?_0x214611[_0x074f('0x36')]:_0x3d6bc1[_0x074f('0x31')];if(!_0x4b540c[_0x074f('0x32')][_0x074f('0x39')]('nolimit')){_0x214611[_0x074f('0x1d')]=qs[_0x074f('0x1d')](_0x4b540c['query'][_0x074f('0x1d')]);_0x214611[_0x074f('0x1b')]=qs[_0x074f('0x1b')](_0x4b540c[_0x074f('0x32')][_0x074f('0x1b')]);}_0x214611[_0x074f('0x3a')]=qs[_0x074f('0x3b')](_0x4b540c['query'][_0x074f('0x3b')]);_0x214611[_0x074f('0x3c')]=qs[_0x074f('0x34')](_[_0x074f('0x3d')](_0x4b540c[_0x074f('0x32')],_0x3d6bc1[_0x074f('0x34')]),_0x5526b7);if(_0x4b540c['query'][_0x074f('0x3e')]){_0x214611[_0x074f('0x3c')]=_['merge'](_0x214611[_0x074f('0x3c')],{'$or':_[_0x074f('0x2b')](_0x5526b7,function(_0x61f8c9){if(_0x61f8c9['type']!=='VIRTUAL'){var _0x5f39e5={};_0x5f39e5[_0x61f8c9[_0x074f('0x29')]]={'$like':'%'+_0x4b540c[_0x074f('0x32')][_0x074f('0x3e')]+'%'};return _0x5f39e5;}})});}_0x214611=_['merge']({},_0x214611,_0x4b540c[_0x074f('0x3f')]);var _0x2a0340={'where':_0x214611['where']};return db[_0x074f('0x2c')][_0x074f('0x1e')](_0x2a0340)[_0x074f('0x24')](function(_0x46ca91){_0x177d53[_0x074f('0x1e')]=_0x46ca91;if(_0x4b540c[_0x074f('0x32')][_0x074f('0x40')]){_0x214611[_0x074f('0x41')]=[{'all':!![]}];}return db[_0x074f('0x2c')][_0x074f('0x42')](_0x214611);})['then'](function(_0x1bee97){_0x177d53['rows']=_0x1bee97;return _0x177d53;})[_0x074f('0x24')](respondWithFilteredResult(_0x4aa96f,_0x214611))['catch'](handleError(_0x4aa96f,null));};exports[_0x074f('0x43')]=function(_0x4c59ec,_0x1f70c5){var _0x4b9244={'raw':![],'where':{'id':_0x4c59ec[_0x074f('0x44')]['id']}},_0x654e6e={};_0x654e6e[_0x074f('0x31')]=_[_0x074f('0x33')](db[_0x074f('0x2c')][_0x074f('0x2d')]);_0x654e6e[_0x074f('0x32')]=_['keys'](_0x4c59ec[_0x074f('0x32')]);_0x654e6e[_0x074f('0x34')]=_[_0x074f('0x35')](_0x654e6e[_0x074f('0x31')],_0x654e6e['query']);_0x4b9244[_0x074f('0x36')]=_['intersection'](_0x654e6e[_0x074f('0x31')],qs[_0x074f('0x37')](_0x4c59ec[_0x074f('0x32')]['fields']));_0x4b9244[_0x074f('0x36')]=_0x4b9244['attributes'][_0x074f('0x38')]?_0x4b9244[_0x074f('0x36')]:_0x654e6e['model'];if(_0x4c59ec[_0x074f('0x32')]['includeAll']){_0x4b9244[_0x074f('0x41')]=[{'all':!![]}];}_0x4b9244=_[_0x074f('0x45')]({},_0x4b9244,_0x4c59ec['options']);return db['Campaign']['find'](_0x4b9244)['then'](handleEntityNotFound(_0x1f70c5,null))[_0x074f('0x24')](respondWithResult(_0x1f70c5,null))[_0x074f('0x46')](handleError(_0x1f70c5,null));};exports[_0x074f('0x47')]=function(_0xdd3709,_0x53b1e5){return db[_0x074f('0x2c')][_0x074f('0x47')](_0xdd3709[_0x074f('0x48')],{})[_0x074f('0x24')](function(_0xb66ad7){var _0x42ab64=_0xdd3709[_0x074f('0x49')][_0x074f('0x4a')]({'plain':!![]});if(!_0x42ab64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42ab64[_0x074f('0x4b')]===_0x074f('0x49')){var _0x2ff3ab=_0xb66ad7[_0x074f('0x4a')]({'plain':!![]});var _0x522777=_0x074f('0x4c');return db[_0x074f('0x4d')]['find']({'where':{'name':_0x522777,'userProfileId':_0x42ab64['userProfileId']},'raw':!![]})[_0x074f('0x24')](function(_0x423393){if(_0x423393&&_0x423393[_0x074f('0x4e')]===0x0){return db[_0x074f('0x26')]['create']({'name':_0x2ff3ab['name'],'resourceId':_0x2ff3ab['id'],'type':_0x423393[_0x074f('0x29')],'sectionId':_0x423393['id']},{})[_0x074f('0x24')](function(){return _0xb66ad7;});}else{return _0xb66ad7;}})[_0x074f('0x46')](function(_0x32684a){logger[_0x074f('0x27')](_0x074f('0x4f'),_0x32684a);throw _0x32684a;});}return _0xb66ad7;})[_0x074f('0x24')](respondWithResult(_0x53b1e5,0xc9))[_0x074f('0x46')](handleError(_0x53b1e5,null));};exports[_0x074f('0x50')]=function(_0x5bda95,_0x24d267){var _0x3aa992={'where':{'id':_0x5bda95[_0x074f('0x44')]['id']}},_0x21dbc7={};_0x21dbc7[_0x074f('0x31')]=_[_0x074f('0x33')](db['Campaign'][_0x074f('0x2d')]);_0x3aa992[_0x074f('0x36')]=_['intersection'](_0x21dbc7[_0x074f('0x31')],qs[_0x074f('0x37')](_0x5bda95[_0x074f('0x32')][_0x074f('0x37')]));_0x3aa992[_0x074f('0x36')]=_0x3aa992[_0x074f('0x36')][_0x074f('0x38')]?_0x3aa992[_0x074f('0x36')]:_0x21dbc7[_0x074f('0x31')];if(_0x5bda95[_0x074f('0x32')]['includeAll']){_0x3aa992[_0x074f('0x41')]=[{'all':!![]}];}_0x3aa992=_['merge']({},_0x3aa992,_0x5bda95['options']);return db[_0x074f('0x2c')]['find'](_0x3aa992)['then'](handleEntityNotFound(_0x24d267,null))[_0x074f('0x24')](function(_0x183c51){if(_0x183c51){var _0x668a47=_0x183c51[_0x074f('0x4a')]({'plain':!![]});_0x668a47=qs[_0x074f('0x51')](_0x668a47,['id',_0x074f('0x52'),_0x074f('0x53')]);_0x5bda95[_0x074f('0x48')]=_['omit'](_0x5bda95['body'],['id',_0x074f('0x52'),_0x074f('0x53')]);return db[_0x074f('0x2c')]['create'](_[_0x074f('0x45')](_0x668a47,_0x5bda95[_0x074f('0x48')]),{'include':_0x5bda95['query']['includeAll']?[{'all':!![]}]:undefined})[_0x074f('0x24')](function(_0x4e06cb){var _0x76c609=_0x5bda95[_0x074f('0x49')]['get']({'plain':!![]});if(!_0x76c609)throw new Error(_0x074f('0x54'));if(_0x76c609[_0x074f('0x4b')]===_0x074f('0x49')){var _0x2f36d4=_0x4e06cb[_0x074f('0x4a')]({'plain':!![]});var _0x9fe79e=_0x074f('0x4c');return db[_0x074f('0x4d')][_0x074f('0x55')]({'where':{'name':_0x9fe79e,'userProfileId':_0x76c609[_0x074f('0x56')]},'raw':!![]})[_0x074f('0x24')](function(_0x4556d0){if(_0x4556d0&&_0x4556d0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2f36d4[_0x074f('0x29')],'resourceId':_0x2f36d4['id'],'type':_0x4556d0['name'],'sectionId':_0x4556d0['id']},{})[_0x074f('0x24')](function(){return _0x4e06cb;});}else{return _0x4e06cb;}})['catch'](function(_0x30296f){logger[_0x074f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30296f);throw _0x30296f;});}return _0x4e06cb;});}})[_0x074f('0x24')](respondWithResult(_0x24d267,0xc9))[_0x074f('0x46')](handleError(_0x24d267,null));};exports[_0x074f('0x23')]=function(_0xfb52ca,_0x183bbf){if(_0xfb52ca[_0x074f('0x48')]['id']){delete _0xfb52ca[_0x074f('0x48')]['id'];}return db['Campaign'][_0x074f('0x55')]({'where':{'id':_0xfb52ca[_0x074f('0x44')]['id']}})['then'](handleEntityNotFound(_0x183bbf,null))[_0x074f('0x24')](saveUpdates(_0xfb52ca[_0x074f('0x48')],null))[_0x074f('0x24')](respondWithResult(_0x183bbf,null))[_0x074f('0x46')](handleError(_0x183bbf,null));};exports['destroy']=function(_0x5a938e,_0x110fa1){return db[_0x074f('0x2c')]['find']({'where':{'id':_0x5a938e['params']['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x110fa1,null))[_0x074f('0x24')](removeEntity(_0x110fa1,null))[_0x074f('0x46')](handleError(_0x110fa1,null));};exports[_0x074f('0x57')]=function(_0x31d5e8,_0x515ce8,_0x44c4ed){var _0x5b140c={'raw':!![],'where':{}};var _0x21d997={};var _0x7eb0e2={'count':0x0,'rows':[]};return db[_0x074f('0x2c')][_0x074f('0x58')]({'where':{'id':_0x31d5e8[_0x074f('0x44')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x515ce8,null))[_0x074f('0x24')](function(_0x2941a4){if(_0x2941a4){_0x21d997[_0x074f('0x31')]=_[_0x074f('0x33')](db[_0x074f('0x59')]['rawAttributes']);_0x21d997[_0x074f('0x32')]=_[_0x074f('0x33')](_0x31d5e8['query']);_0x21d997['filters']=_['intersection'](_0x21d997[_0x074f('0x31')],_0x21d997[_0x074f('0x32')]);_0x5b140c[_0x074f('0x36')]=_[_0x074f('0x35')](_0x21d997[_0x074f('0x31')],qs['fields'](_0x31d5e8['query'][_0x074f('0x37')]));_0x5b140c['attributes']=_0x5b140c[_0x074f('0x36')]['length']?_0x5b140c[_0x074f('0x36')]:_0x21d997['model'];if(!_0x31d5e8['query'][_0x074f('0x39')](_0x074f('0x5a'))){_0x5b140c[_0x074f('0x1d')]=qs[_0x074f('0x1d')](_0x31d5e8['query'][_0x074f('0x1d')]);_0x5b140c['offset']=qs[_0x074f('0x1b')](_0x31d5e8[_0x074f('0x32')]['offset']);}_0x5b140c[_0x074f('0x3a')]=qs[_0x074f('0x3b')](_0x31d5e8[_0x074f('0x32')]['sort']);_0x5b140c['where']=qs[_0x074f('0x34')](_[_0x074f('0x3d')](_0x31d5e8[_0x074f('0x32')],_0x21d997[_0x074f('0x34')]));_0x5b140c[_0x074f('0x3c')][_0x074f('0x5b')]=_0x2941a4['id'];if(_0x31d5e8[_0x074f('0x32')]['filter']){_0x5b140c[_0x074f('0x3c')]=_[_0x074f('0x45')](_0x5b140c[_0x074f('0x3c')],{'$or':_['map'](_0x5b140c[_0x074f('0x36')],function(_0x49da9e){var _0x322daf={};_0x322daf[_0x49da9e]={'$like':'%'+_0x31d5e8[_0x074f('0x32')][_0x074f('0x3e')]+'%'};return _0x322daf;})});}_0x5b140c=_[_0x074f('0x45')]({},_0x5b140c,_0x31d5e8[_0x074f('0x3f')]);return db['CmHopper'][_0x074f('0x1e')]({'where':_0x5b140c[_0x074f('0x3c')]})['then'](function(_0x4ffd05){_0x7eb0e2['count']=_0x4ffd05;if(_0x31d5e8[_0x074f('0x32')]['includeAll']){_0x5b140c[_0x074f('0x41')]=[{'all':!![]}];}return db[_0x074f('0x59')][_0x074f('0x42')](_0x5b140c);})[_0x074f('0x24')](function(_0x208881){_0x7eb0e2[_0x074f('0x5c')]=_0x208881;return _0x7eb0e2;});}})['then'](respondWithFilteredResult(_0x515ce8,_0x5b140c))[_0x074f('0x46')](handleError(_0x515ce8,null));};exports[_0x074f('0x5d')]=function(_0x40bc6a,_0x2d3df5,_0x1af053){var _0x17fa9c={'raw':!![],'where':{}};var _0x2cb44c={};var _0x41776a={'count':0x0,'rows':[]};return db[_0x074f('0x2c')][_0x074f('0x58')]({'where':{'id':_0x40bc6a['params']['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x2d3df5,null))[_0x074f('0x24')](function(_0x13f361){if(_0x13f361){_0x2cb44c[_0x074f('0x31')]=_['keys'](db['CmHopperHistory'][_0x074f('0x2d')]);_0x2cb44c[_0x074f('0x32')]=_[_0x074f('0x33')](_0x40bc6a[_0x074f('0x32')]);_0x2cb44c['filters']=_[_0x074f('0x35')](_0x2cb44c[_0x074f('0x31')],_0x2cb44c[_0x074f('0x32')]);_0x17fa9c[_0x074f('0x36')]=_[_0x074f('0x35')](_0x2cb44c[_0x074f('0x31')],qs[_0x074f('0x37')](_0x40bc6a['query'][_0x074f('0x37')]));_0x17fa9c[_0x074f('0x36')]=_0x17fa9c[_0x074f('0x36')][_0x074f('0x38')]?_0x17fa9c['attributes']:_0x2cb44c[_0x074f('0x31')];if(!_0x40bc6a[_0x074f('0x32')][_0x074f('0x39')](_0x074f('0x5a'))){_0x17fa9c[_0x074f('0x1d')]=qs[_0x074f('0x1d')](_0x40bc6a[_0x074f('0x32')]['limit']);_0x17fa9c[_0x074f('0x1b')]=qs[_0x074f('0x1b')](_0x40bc6a[_0x074f('0x32')]['offset']);}_0x17fa9c[_0x074f('0x3a')]=qs[_0x074f('0x3b')](_0x40bc6a['query'][_0x074f('0x3b')]);_0x17fa9c['where']=qs[_0x074f('0x34')](_[_0x074f('0x3d')](_0x40bc6a[_0x074f('0x32')],_0x2cb44c[_0x074f('0x34')]));_0x17fa9c[_0x074f('0x3c')]['CampaignId']=_0x13f361['id'];if(_0x40bc6a[_0x074f('0x32')]['filter']){_0x17fa9c[_0x074f('0x3c')]=_['merge'](_0x17fa9c['where'],{'$or':_[_0x074f('0x2b')](_0x17fa9c[_0x074f('0x36')],function(_0x5f3c40){var _0x5a7fdf={};_0x5a7fdf[_0x5f3c40]={'$like':'%'+_0x40bc6a['query'][_0x074f('0x3e')]+'%'};return _0x5a7fdf;})});}_0x17fa9c=_['merge']({},_0x17fa9c,_0x40bc6a[_0x074f('0x3f')]);return db[_0x074f('0x5e')][_0x074f('0x1e')]({'where':_0x17fa9c[_0x074f('0x3c')]})[_0x074f('0x24')](function(_0x2f815a){_0x41776a[_0x074f('0x1e')]=_0x2f815a;if(_0x40bc6a[_0x074f('0x32')][_0x074f('0x40')]){_0x17fa9c[_0x074f('0x41')]=[{'all':!![]}];}return db[_0x074f('0x5e')][_0x074f('0x42')](_0x17fa9c);})[_0x074f('0x24')](function(_0x239bd1){_0x41776a[_0x074f('0x5c')]=_0x239bd1;return _0x41776a;});}})[_0x074f('0x24')](respondWithFilteredResult(_0x2d3df5,_0x17fa9c))[_0x074f('0x46')](handleError(_0x2d3df5,null));};exports[_0x074f('0x5f')]=function(_0x438747,_0x22721a,_0x30cdbb){var _0x125672={'raw':!![],'where':{}};var _0x1c8a30={};var _0x58e92e={'count':0x0,'rows':[]};return db[_0x074f('0x2c')][_0x074f('0x58')]({'where':{'id':_0x438747[_0x074f('0x44')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x22721a,null))['then'](function(_0x5299fb){if(_0x5299fb){_0x1c8a30['model']=_[_0x074f('0x33')](db['CmHopperFinal'][_0x074f('0x2d')]);_0x1c8a30[_0x074f('0x32')]=_[_0x074f('0x33')](_0x438747[_0x074f('0x32')]);_0x1c8a30[_0x074f('0x34')]=_[_0x074f('0x35')](_0x1c8a30[_0x074f('0x31')],_0x1c8a30[_0x074f('0x32')]);_0x125672[_0x074f('0x36')]=_[_0x074f('0x35')](_0x1c8a30[_0x074f('0x31')],qs[_0x074f('0x37')](_0x438747[_0x074f('0x32')][_0x074f('0x37')]));_0x125672[_0x074f('0x36')]=_0x125672['attributes'][_0x074f('0x38')]?_0x125672[_0x074f('0x36')]:_0x1c8a30[_0x074f('0x31')];if(!_0x438747['query']['hasOwnProperty'](_0x074f('0x5a'))){_0x125672['limit']=qs[_0x074f('0x1d')](_0x438747[_0x074f('0x32')][_0x074f('0x1d')]);_0x125672[_0x074f('0x1b')]=qs[_0x074f('0x1b')](_0x438747[_0x074f('0x32')]['offset']);}_0x125672[_0x074f('0x3a')]=qs[_0x074f('0x3b')](_0x438747['query']['sort']);_0x125672['where']=qs[_0x074f('0x34')](_[_0x074f('0x3d')](_0x438747[_0x074f('0x32')],_0x1c8a30[_0x074f('0x34')]));_0x125672['where'][_0x074f('0x5b')]=_0x5299fb['id'];if(_0x438747[_0x074f('0x32')][_0x074f('0x3e')]){_0x125672[_0x074f('0x3c')]=_[_0x074f('0x45')](_0x125672[_0x074f('0x3c')],{'$or':_['map'](_0x125672[_0x074f('0x36')],function(_0x4ae7b9){var _0x2075ef={};_0x2075ef[_0x4ae7b9]={'$like':'%'+_0x438747[_0x074f('0x32')][_0x074f('0x3e')]+'%'};return _0x2075ef;})});}_0x125672=_[_0x074f('0x45')]({},_0x125672,_0x438747[_0x074f('0x3f')]);return db[_0x074f('0x60')][_0x074f('0x1e')]({'where':_0x125672[_0x074f('0x3c')]})[_0x074f('0x24')](function(_0x2f4897){_0x58e92e[_0x074f('0x1e')]=_0x2f4897;if(_0x438747[_0x074f('0x32')][_0x074f('0x40')]){_0x125672[_0x074f('0x41')]=[{'all':!![]}];}return db[_0x074f('0x60')][_0x074f('0x42')](_0x125672);})[_0x074f('0x24')](function(_0x1c53be){_0x58e92e[_0x074f('0x5c')]=_0x1c53be;return _0x58e92e;});}})[_0x074f('0x24')](respondWithFilteredResult(_0x22721a,_0x125672))[_0x074f('0x46')](handleError(_0x22721a,null));};exports[_0x074f('0x61')]=function(_0x510a6a,_0x2f8766,_0x235dba){var _0x6e049={'raw':!![],'where':{}};var _0x20c958={};var _0x3d754e={'count':0x0,'rows':[]};return db[_0x074f('0x2c')][_0x074f('0x58')]({'where':{'id':_0x510a6a[_0x074f('0x44')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x2f8766,null))[_0x074f('0x24')](function(_0x5ccf30){if(_0x5ccf30){_0x20c958[_0x074f('0x31')]=_[_0x074f('0x33')](db[_0x074f('0x62')][_0x074f('0x2d')]);_0x20c958[_0x074f('0x32')]=_['keys'](_0x510a6a[_0x074f('0x32')]);_0x20c958[_0x074f('0x34')]=_[_0x074f('0x35')](_0x20c958[_0x074f('0x31')],_0x20c958['query']);_0x6e049[_0x074f('0x36')]=_['intersection'](_0x20c958['model'],qs[_0x074f('0x37')](_0x510a6a[_0x074f('0x32')][_0x074f('0x37')]));_0x6e049[_0x074f('0x36')]=_0x6e049[_0x074f('0x36')]['length']?_0x6e049[_0x074f('0x36')]:_0x20c958[_0x074f('0x31')];if(!_0x510a6a[_0x074f('0x32')][_0x074f('0x39')]('nolimit')){_0x6e049['limit']=qs[_0x074f('0x1d')](_0x510a6a['query'][_0x074f('0x1d')]);_0x6e049[_0x074f('0x1b')]=qs[_0x074f('0x1b')](_0x510a6a[_0x074f('0x32')][_0x074f('0x1b')]);}_0x6e049[_0x074f('0x3a')]=qs['sort'](_0x510a6a[_0x074f('0x32')][_0x074f('0x3b')]);_0x6e049[_0x074f('0x3c')]=qs[_0x074f('0x34')](_[_0x074f('0x3d')](_0x510a6a[_0x074f('0x32')],_0x20c958[_0x074f('0x34')]));_0x6e049['where'][_0x074f('0x5b')]=_0x5ccf30['id'];if(_0x510a6a[_0x074f('0x32')]['filter']){_0x6e049['where']=_[_0x074f('0x45')](_0x6e049[_0x074f('0x3c')],{'$or':_['map'](_0x6e049[_0x074f('0x36')],function(_0xb339e0){var _0x430af3={};_0x430af3[_0xb339e0]={'$like':'%'+_0x510a6a[_0x074f('0x32')][_0x074f('0x3e')]+'%'};return _0x430af3;})});}_0x6e049=_[_0x074f('0x45')]({},_0x6e049,_0x510a6a['options']);return db['CmHopperBlack'][_0x074f('0x1e')]({'where':_0x6e049[_0x074f('0x3c')]})['then'](function(_0x44859d){_0x3d754e[_0x074f('0x1e')]=_0x44859d;if(_0x510a6a[_0x074f('0x32')][_0x074f('0x40')]){_0x6e049['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x074f('0x42')](_0x6e049);})['then'](function(_0x2bfb0d){_0x3d754e['rows']=_0x2bfb0d;return _0x3d754e;});}})['then'](respondWithFilteredResult(_0x2f8766,_0x6e049))[_0x074f('0x46')](handleError(_0x2f8766,null));};exports[_0x074f('0x63')]=function(_0x5c98b3,_0x351391,_0x5e9552){var _0xed10f5={};var _0x210ab4={};var _0x9702d;var _0xc40751;return db['Campaign'][_0x074f('0x58')]({'where':{'id':_0x5c98b3[_0x074f('0x44')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x351391,null))[_0x074f('0x24')](function(_0x4ae328){if(_0x4ae328){_0x9702d=_0x4ae328;_0x210ab4[_0x074f('0x31')]=_[_0x074f('0x33')](db['CmList'][_0x074f('0x2d')]);_0x210ab4[_0x074f('0x32')]=_[_0x074f('0x33')](_0x5c98b3['query']);_0x210ab4[_0x074f('0x34')]=_[_0x074f('0x35')](_0x210ab4[_0x074f('0x31')],_0x210ab4['query']);_0xed10f5[_0x074f('0x36')]=_['intersection'](_0x210ab4[_0x074f('0x31')],qs[_0x074f('0x37')](_0x5c98b3[_0x074f('0x32')][_0x074f('0x37')]));_0xed10f5[_0x074f('0x36')]=_0xed10f5[_0x074f('0x36')][_0x074f('0x38')]?_0xed10f5['attributes']:_0x210ab4[_0x074f('0x31')];_0xed10f5['order']=qs[_0x074f('0x3b')](_0x5c98b3[_0x074f('0x32')][_0x074f('0x3b')]);_0xed10f5[_0x074f('0x3c')]=qs[_0x074f('0x34')](_['pick'](_0x5c98b3['query'],_0x210ab4['filters']));if(_0x5c98b3['query'][_0x074f('0x3e')]){_0xed10f5[_0x074f('0x3c')]=_['merge'](_0xed10f5[_0x074f('0x3c')],{'$or':_[_0x074f('0x2b')](_0xed10f5[_0x074f('0x36')],function(_0x5f5379){var _0x5ce3e4={};_0x5ce3e4[_0x5f5379]={'$like':'%'+_0x5c98b3[_0x074f('0x32')][_0x074f('0x3e')]+'%'};return _0x5ce3e4;})});}_0xed10f5=_['merge']({},_0xed10f5,_0x5c98b3[_0x074f('0x3f')]);return _0x9702d[_0x074f('0x63')](_0xed10f5);}})[_0x074f('0x24')](function(_0x238181){if(_0x238181){_0xc40751=_0x238181[_0x074f('0x38')];if(!_0x5c98b3[_0x074f('0x32')][_0x074f('0x39')](_0x074f('0x5a'))){_0xed10f5[_0x074f('0x1d')]=qs[_0x074f('0x1d')](_0x5c98b3[_0x074f('0x32')][_0x074f('0x1d')]);_0xed10f5[_0x074f('0x1b')]=qs['offset'](_0x5c98b3[_0x074f('0x32')][_0x074f('0x1b')]);}return _0x9702d[_0x074f('0x63')](_0xed10f5);}})[_0x074f('0x24')](function(_0x209429){if(_0x209429){return _0x209429?{'count':_0xc40751,'rows':_0x209429}:null;}})['then'](respondWithResult(_0x351391,null))['catch'](handleError(_0x351391,null));};exports[_0x074f('0x64')]=function(_0x25de56,_0x30fcca,_0x4a2dd5){var _0xfea046,_0x41824a;var _0x19cb53=[];var _0x54bec5=moment()[_0x074f('0x65')](_0x074f('0x66'));return db[_0x074f('0x2c')][_0x074f('0x55')]({'where':{'id':_0x25de56[_0x074f('0x44')]['id']}})['then'](handleEntityNotFound(_0x30fcca,null))[_0x074f('0x24')](function(_0x473e32){if(_0x473e32){_0x41824a=_0x473e32;return _0x473e32[_0x074f('0x64')](_0x25de56[_0x074f('0x48')][_0x074f('0x67')],_[_0x074f('0x51')](_0x25de56[_0x074f('0x48')],[_0x074f('0x67'),'id'])||{});}return null;})[_0x074f('0x68')](function(_0x25eb0c){var _0x4aa1e4;var _0x13ac97;_0xfea046=_0x25eb0c||[];var _0x55ac29=[];if(_0x25eb0c){for(var _0x2670f4=0x0;_0x2670f4<_0x25eb0c[_0x074f('0x38')];_0x2670f4+=0x1){var _0x53a59f=_0x25eb0c[_0x2670f4][_0x074f('0x4a')]({'plain':!![]});_0x41824a[_0x074f('0x69')]=_0x25de56[_0x074f('0x48')][_0x074f('0x69')]?_0x25de56[_0x074f('0x48')][_0x074f('0x69')]:_0x41824a[_0x074f('0x69')];switch(_0x41824a[_0x074f('0x69')]){case _0x074f('0x6a'):_0x4aa1e4=squel[_0x074f('0x6b')]()[_0x074f('0x6c')](_0x074f('0x6d'))[_0x074f('0x6e')](['phone',_0x074f('0x6f'),_0x074f('0x70'),_0x074f('0x71'),'CampaignId',_0x074f('0x52'),_0x074f('0x53')],squel['select']()[_0x074f('0x72')]('phone',_0x074f('0x73'))[_0x074f('0x72')](_0x074f('0x74'),'scheduledAt')[_0x074f('0x72')]('id',_0x074f('0x70'))[_0x074f('0x72')](_0x53a59f[_0x074f('0x75')][_0x074f('0x76')](),_0x074f('0x71'))['field'](_0x25de56[_0x074f('0x44')]['id'][_0x074f('0x76')](),'CampaignId')[_0x074f('0x72')]('\x27'+_0x54bec5+'\x27',_0x074f('0x52'))[_0x074f('0x72')]('\x27'+_0x54bec5+'\x27','updatedAt')[_0x074f('0x77')](_0x074f('0x78'))[_0x074f('0x3c')](_0x074f('0x79'))[_0x074f('0x3c')]('ListId\x20=\x20?',_0x53a59f[_0x074f('0x75')][_0x074f('0x76')]())[_0x074f('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x074f('0x3c')](_0x074f('0x7a'),squel[_0x074f('0x7b')]()[_0x074f('0x72')](_0x074f('0x7c'))['from'](_0x074f('0x7d'))[_0x074f('0x3c')](_0x074f('0x7e'),_0x25de56[_0x074f('0x44')]['id'][_0x074f('0x76')]()))[_0x074f('0x3c')](_0x074f('0x7a'),squel[_0x074f('0x7b')]()[_0x074f('0x72')](_0x074f('0x7f'))['from'](_0x074f('0x6d'))['where'](_0x074f('0x7e'),_0x25de56['params']['id'][_0x074f('0x76')]())))[_0x074f('0x76')]();break;case _0x074f('0x80'):_0x4aa1e4=squel[_0x074f('0x6b')]()[_0x074f('0x6c')]('cm_hopper')[_0x074f('0x6e')]([_0x074f('0x73'),_0x074f('0x6f'),_0x074f('0x70'),_0x074f('0x71'),'CampaignId',_0x074f('0x52'),_0x074f('0x53')],squel[_0x074f('0x7b')]()[_0x074f('0x72')](_0x074f('0x73'),_0x074f('0x73'))['field'](_0x074f('0x74'),_0x074f('0x6f'))['field']('id',_0x074f('0x70'))[_0x074f('0x72')](_0x53a59f[_0x074f('0x75')][_0x074f('0x76')](),_0x074f('0x71'))[_0x074f('0x72')](_0x25de56[_0x074f('0x44')]['id']['toString'](),_0x074f('0x5b'))[_0x074f('0x72')]('\x27'+_0x54bec5+'\x27',_0x074f('0x52'))[_0x074f('0x72')]('\x27'+_0x54bec5+'\x27',_0x074f('0x53'))['from'](_0x074f('0x78'))['where']('deletedAt\x20IS\x20NULL')[_0x074f('0x3c')](_0x074f('0x81'),_0x53a59f[_0x074f('0x75')]['toString']())[_0x074f('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x074f('0x3c')](_0x074f('0x7a'),squel[_0x074f('0x7b')]()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x074f('0x3c')]('CampaignId\x20=\x20?',_0x25de56[_0x074f('0x44')]['id'][_0x074f('0x76')]())))['toString']();break;default:_0x4aa1e4=squel['insert']()[_0x074f('0x6c')](_0x074f('0x6d'))['fromQuery']([_0x074f('0x73'),_0x074f('0x6f'),_0x074f('0x70'),_0x074f('0x71'),'CampaignId',_0x074f('0x52'),_0x074f('0x53')],squel['select']()[_0x074f('0x72')](_0x074f('0x73'),_0x074f('0x73'))[_0x074f('0x72')]('NOW()','scheduledAt')[_0x074f('0x72')]('id',_0x074f('0x70'))['field'](_0x53a59f[_0x074f('0x75')][_0x074f('0x76')](),'ListId')['field'](_0x25de56[_0x074f('0x44')]['id']['toString'](),_0x074f('0x5b'))['field']('\x27'+_0x54bec5+'\x27',_0x074f('0x52'))[_0x074f('0x72')]('\x27'+_0x54bec5+'\x27',_0x074f('0x53'))[_0x074f('0x77')](_0x074f('0x78'))['where'](_0x074f('0x79'))[_0x074f('0x3c')]('ListId\x20=\x20?',_0x53a59f['CmListId'][_0x074f('0x76')]())[_0x074f('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x074f('0x76')]();}_0x13ac97=squel[_0x074f('0x6b')]()[_0x074f('0x6c')](_0x074f('0x82'))['fromQuery'](['cmHopperId',_0x074f('0x6f'),_0x074f('0x73'),_0x074f('0x83'),_0x074f('0x52'),'updatedAt'],squel[_0x074f('0x7b')]()[_0x074f('0x72')](_0x074f('0x84'),'id')[_0x074f('0x72')]('NOW()',_0x074f('0x6f'))[_0x074f('0x72')](_0x074f('0x85'),_0x074f('0x73'))[_0x074f('0x72')]('ci.OrderBY','OrderBy')[_0x074f('0x72')]('\x27'+_0x54bec5+'\x27',_0x074f('0x52'))['field']('\x27'+_0x54bec5+'\x27','updatedAt')[_0x074f('0x77')](_0x074f('0x86'),'ci')[_0x074f('0x87')](_0x074f('0x6d'),'h',_0x074f('0x88'))[_0x074f('0x3c')](_0x074f('0x89'),_0x53a59f['CmListId'][_0x074f('0x76')]())[_0x074f('0x3c')]('h.CampaignId=?',_0x25de56['params']['id'][_0x074f('0x76')]())[_0x074f('0x3c')](_0x074f('0x8a'),_0x54bec5))['toString']();_0x55ac29[_0x074f('0x8b')](db[_0x074f('0x8c')][_0x074f('0x32')](_0x4aa1e4));_0x19cb53['push'](db[_0x074f('0x8c')]['query'](_0x13ac97));}return BPromise[_0x074f('0x8d')](_0x55ac29);}})[_0x074f('0x24')](function(){return BPromise['all'](_0x19cb53);})['then'](function(){return _0xfea046;})[_0x074f('0x24')](respondWithResult(_0x30fcca,null))['catch'](handleError(_0x30fcca,null));};exports[_0x074f('0x8e')]=function(_0x32f193,_0x3e0bd2,_0x15513a){return db[_0x074f('0x2c')]['find']({'where':{'id':_0x32f193[_0x074f('0x44')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x3e0bd2,null))[_0x074f('0x24')](function(_0x2556f8){if(_0x2556f8){return _0x2556f8['removeLists'](_0x32f193['query']['ids']);}})[_0x074f('0x24')](function(_0x3308bd){if(_0x3308bd){return db['CmHopper'][_0x074f('0x25')]({'where':{'ListId':_0x32f193[_0x074f('0x32')][_0x074f('0x67')],'CampaignId':_0x32f193['params']['id']}})[_0x074f('0x24')](function(){return _0x3308bd;});}})[_0x074f('0x24')](respondWithStatusCode(_0x3e0bd2,null))[_0x074f('0x46')](handleError(_0x3e0bd2,null));};exports[_0x074f('0x8f')]=function(_0x51097b,_0x4fbebb,_0x5602f0){var _0x2409bc={};var _0x3dd667={};var _0x36c0a8;var _0x14c303;return db['Campaign'][_0x074f('0x58')]({'where':{'id':_0x51097b[_0x074f('0x44')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x4fbebb,null))['then'](function(_0x5a5cc5){if(_0x5a5cc5){_0x36c0a8=_0x5a5cc5;_0x3dd667[_0x074f('0x31')]=_['keys'](db[_0x074f('0x90')][_0x074f('0x2d')]);_0x3dd667[_0x074f('0x32')]=_['keys'](_0x51097b[_0x074f('0x32')]);_0x3dd667[_0x074f('0x34')]=_[_0x074f('0x35')](_0x3dd667[_0x074f('0x31')],_0x3dd667['query']);_0x2409bc[_0x074f('0x36')]=_[_0x074f('0x35')](_0x3dd667[_0x074f('0x31')],qs[_0x074f('0x37')](_0x51097b[_0x074f('0x32')][_0x074f('0x37')]));_0x2409bc[_0x074f('0x36')]=_0x2409bc[_0x074f('0x36')][_0x074f('0x38')]?_0x2409bc[_0x074f('0x36')]:_0x3dd667[_0x074f('0x31')];_0x2409bc['order']=qs['sort'](_0x51097b[_0x074f('0x32')][_0x074f('0x3b')]);_0x2409bc[_0x074f('0x3c')]=qs[_0x074f('0x34')](_[_0x074f('0x3d')](_0x51097b[_0x074f('0x32')],_0x3dd667[_0x074f('0x34')]));if(_0x51097b[_0x074f('0x32')]['filter']){_0x2409bc[_0x074f('0x3c')]=_['merge'](_0x2409bc[_0x074f('0x3c')],{'$or':_[_0x074f('0x2b')](_0x2409bc[_0x074f('0x36')],function(_0xd989d6){var _0x2000fe={};_0x2000fe[_0xd989d6]={'$like':'%'+_0x51097b[_0x074f('0x32')][_0x074f('0x3e')]+'%'};return _0x2000fe;})});}_0x2409bc=_['merge']({},_0x2409bc,_0x51097b['options']);return _0x36c0a8[_0x074f('0x8f')](_0x2409bc);}})[_0x074f('0x24')](function(_0x469654){if(_0x469654){_0x14c303=_0x469654['length'];if(!_0x51097b[_0x074f('0x32')][_0x074f('0x39')](_0x074f('0x5a'))){_0x2409bc[_0x074f('0x1d')]=qs[_0x074f('0x1d')](_0x51097b[_0x074f('0x32')][_0x074f('0x1d')]);_0x2409bc[_0x074f('0x1b')]=qs[_0x074f('0x1b')](_0x51097b['query'][_0x074f('0x1b')]);}return _0x36c0a8[_0x074f('0x8f')](_0x2409bc);}})[_0x074f('0x24')](function(_0x42c8e5){if(_0x42c8e5){return _0x42c8e5?{'count':_0x14c303,'rows':_0x42c8e5}:null;}})[_0x074f('0x24')](respondWithResult(_0x4fbebb,null))[_0x074f('0x46')](handleError(_0x4fbebb,null));};exports[_0x074f('0x91')]=function(_0x4d568f,_0x436da4,_0x4d77ac){var _0x5d48f0,_0x17592a;var _0x19f515=[];var _0x1a725c=moment()[_0x074f('0x65')](_0x074f('0x66'));return db[_0x074f('0x2c')][_0x074f('0x55')]({'where':{'id':_0x4d568f[_0x074f('0x44')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x436da4,null))[_0x074f('0x24')](function(_0xf77fe0){if(_0xf77fe0){_0x17592a=_0xf77fe0;return _0xf77fe0[_0x074f('0x91')](_0x4d568f[_0x074f('0x48')]['ids'],_[_0x074f('0x51')](_0x4d568f[_0x074f('0x48')],[_0x074f('0x67'),'id'])||{});}return null;})['spread'](function(_0x5ed2ce){var _0x3497df;var _0x3e0772;_0x5d48f0=_0x5ed2ce||[];var _0x50aed7=[];if(_0x5ed2ce){for(var _0x364890=0x0;_0x364890<_0x5ed2ce['length'];_0x364890+=0x1){var _0x4bd56b=_0x5ed2ce[_0x364890]['get']({'plain':!![]});_0x3497df=squel[_0x074f('0x6b')]()[_0x074f('0x6c')]('cm_hopper_black')[_0x074f('0x6e')]([_0x074f('0x73'),'ContactId',_0x074f('0x71'),_0x074f('0x5b'),_0x074f('0x52'),'updatedAt'],squel[_0x074f('0x7b')]()['field'](_0x074f('0x73'),'phone')[_0x074f('0x72')]('id','ContactId')[_0x074f('0x72')](_0x4bd56b[_0x074f('0x75')][_0x074f('0x76')](),'ListId')['field'](_0x4d568f[_0x074f('0x44')]['id'][_0x074f('0x76')](),_0x074f('0x5b'))[_0x074f('0x72')]('NOW()','createdAt')[_0x074f('0x72')](_0x074f('0x74'),_0x074f('0x53'))[_0x074f('0x77')](_0x074f('0x78'))[_0x074f('0x3c')]('deletedAt\x20IS\x20NULL')[_0x074f('0x3c')]('ListId\x20=\x20?',_0x4bd56b[_0x074f('0x75')][_0x074f('0x76')]())[_0x074f('0x3c')](_0x074f('0x92')))[_0x074f('0x76')]();_0x50aed7[_0x074f('0x8b')](db[_0x074f('0x8c')][_0x074f('0x32')](_0x3497df));}return BPromise[_0x074f('0x8d')](_0x50aed7);}})[_0x074f('0x24')](function(){return _0x5d48f0;})[_0x074f('0x24')](respondWithResult(_0x436da4,null))[_0x074f('0x46')](handleError(_0x436da4,null));};exports[_0x074f('0x93')]=function(_0x19e23f,_0x4d8803,_0x25121a){return db['Campaign'][_0x074f('0x55')]({'where':{'id':_0x19e23f[_0x074f('0x44')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x4d8803,null))['then'](function(_0x45462f){if(_0x45462f){return _0x45462f[_0x074f('0x93')](_0x19e23f[_0x074f('0x32')]['ids']);}})['then'](function(_0x44a685){if(_0x44a685){return db[_0x074f('0x62')]['destroy']({'where':{'ListId':_0x19e23f[_0x074f('0x32')][_0x074f('0x67')],'CampaignId':_0x19e23f[_0x074f('0x44')]['id']}})[_0x074f('0x24')](function(){return _0x44a685;});}})['then'](respondWithStatusCode(_0x4d8803,null))[_0x074f('0x46')](handleError(_0x4d8803,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d77da38..c0eee96 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2b076b,_0x455a17){var _0x98ef20=function(_0x54706e){while(--_0x54706e){_0x2b076b['push'](_0x2b076b['shift']());}};_0x98ef20(++_0x455a17);}(_0x7a54,0x106));var _0x47a5=function(_0x55600e,_0x44b731){_0x55600e=_0x55600e-0x0;var _0x31e6bc=_0x7a54[_0x55600e];return _0x31e6bc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 4974419..96dac0e 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 _0x5e14=['debug','error','code','message','GetCampaign','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var moment=require(_0x45e1('0x2'));var BPromise=require(_0x45e1('0x3'));var rs=require(_0x45e1('0x4'));var fs=require('fs');var Redis=require(_0x45e1('0x5'));var db=require(_0x45e1('0x6'))['db'];var utils=require(_0x45e1('0x7'));var logger=require(_0x45e1('0x8'))(_0x45e1('0x9'));var config=require(_0x45e1('0xa'));var jayson=require(_0x45e1('0xb'));var client=jayson[_0x45e1('0xc')][_0x45e1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26ee2e,_0xff82a2,_0x111f7c){return new BPromise(function(_0x4062de,_0x2296b3){return client[_0x45e1('0xe')](_0x26ee2e,_0x111f7c)[_0x45e1('0xf')](function(_0x1c57cf){logger['info'](_0x45e1('0x10'),_0xff82a2,_0x45e1('0x11'));logger[_0x45e1('0x12')]('Campaign,\x20%s,\x20%s,\x20%s',_0xff82a2,_0x45e1('0x11'),JSON['stringify'](_0x1c57cf));if(_0x1c57cf[_0x45e1('0x13')]){if(_0x1c57cf[_0x45e1('0x13')][_0x45e1('0x14')]===0x1f4){logger[_0x45e1('0x13')](_0x45e1('0x10'),_0xff82a2,_0x1c57cf[_0x45e1('0x13')][_0x45e1('0x15')]);return _0x2296b3(_0x1c57cf['error'][_0x45e1('0x15')]);}logger[_0x45e1('0x13')](_0x45e1('0x10'),_0xff82a2,_0x1c57cf[_0x45e1('0x13')][_0x45e1('0x15')]);return _0x4062de(_0x1c57cf[_0x45e1('0x13')][_0x45e1('0x15')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0xff82a2,_0x45e1('0x11'));_0x4062de(_0x1c57cf['result']['message']);}})['catch'](function(_0x1f8e39){logger[_0x45e1('0x13')](_0x45e1('0x10'),_0xff82a2,_0x1f8e39);_0x2296b3(_0x1f8e39);});});}exports[_0x45e1('0x16')]=function(_0xa8bbf9){var _0xb67f34=this;return new Promise(function(_0x4aea60,_0x22d927){return db['Campaign'][_0x45e1('0x17')]({'raw':_0xa8bbf9['options']?_0xa8bbf9[_0x45e1('0x18')][_0x45e1('0x19')]===undefined?!![]:![]:!![],'where':_0xa8bbf9[_0x45e1('0x18')]?_0xa8bbf9[_0x45e1('0x18')][_0x45e1('0x1a')]||null:null,'attributes':_0xa8bbf9['options']?_0xa8bbf9[_0x45e1('0x18')][_0x45e1('0x1b')]||null:null,'limit':_0xa8bbf9[_0x45e1('0x18')]?_0xa8bbf9[_0x45e1('0x18')][_0x45e1('0x1c')]||null:null,'include':_0xa8bbf9[_0x45e1('0x18')]?_0xa8bbf9[_0x45e1('0x18')][_0x45e1('0x1d')]?_[_0x45e1('0x1e')](_0xa8bbf9[_0x45e1('0x18')][_0x45e1('0x1d')],function(_0x51fb60){return{'model':db[_0x51fb60[_0x45e1('0x1f')]],'as':_0x51fb60['as'],'attributes':_0x51fb60[_0x45e1('0x1b')],'include':_0x51fb60[_0x45e1('0x1d')]?_[_0x45e1('0x1e')](_0x51fb60[_0x45e1('0x1d')],function(_0x103b7a){return{'model':db[_0x103b7a[_0x45e1('0x1f')]],'as':_0x103b7a['as'],'attributes':_0x103b7a[_0x45e1('0x1b')],'include':_0x103b7a[_0x45e1('0x1d')]?_[_0x45e1('0x1e')](_0x103b7a[_0x45e1('0x1d')],function(_0x668f14){return{'model':db[_0x668f14[_0x45e1('0x1f')]],'as':_0x668f14['as'],'attributes':_0x668f14[_0x45e1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x45e1('0xf')](function(_0x371cf5){logger[_0x45e1('0x20')](_0x45e1('0x16'),_0xa8bbf9);logger['debug'](_0x45e1('0x16'),_0xa8bbf9,JSON['stringify'](_0x371cf5));_0x4aea60(_0x371cf5);})[_0x45e1('0x21')](function(_0x1b97ff){logger['error'](_0x45e1('0x16'),_0x1b97ff[_0x45e1('0x15')],_0xa8bbf9);_0x22d927(_0xb67f34[_0x45e1('0x13')](0x1f4,_0x1b97ff[_0x45e1('0x15')]));});});}; \ No newline at end of file +var _0xe57e=['catch','GetCampaign','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Campaign','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x4b3290,_0x5a5293){var _0x5f208e=function(_0x18e887){while(--_0x18e887){_0x4b3290['push'](_0x4b3290['shift']());}};_0x5f208e(++_0x5a5293);}(_0xe57e,0xf2));var _0xee57=function(_0x44dc79,_0x4f3577){_0x44dc79=_0x44dc79-0x0;var _0x279850=_0xe57e[_0x44dc79];return _0x279850;};'use strict';var _=require(_0xee57('0x0'));var util=require('util');var moment=require(_0xee57('0x1'));var BPromise=require(_0xee57('0x2'));var rs=require(_0xee57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee57('0x4'));var logger=require('../../config/logger')(_0xee57('0x5'));var config=require(_0xee57('0x6'));var jayson=require(_0xee57('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x408fef,_0x319905,_0x1ad277){return new BPromise(function(_0x342a62,_0x237efe){return client[_0xee57('0x8')](_0x408fef,_0x1ad277)[_0xee57('0x9')](function(_0x51db0c){logger['info'](_0xee57('0xa'),_0x319905,_0xee57('0xb'));logger[_0xee57('0xc')](_0xee57('0xd'),_0x319905,_0xee57('0xb'),JSON[_0xee57('0xe')](_0x51db0c));if(_0x51db0c[_0xee57('0xf')]){if(_0x51db0c['error']['code']===0x1f4){logger[_0xee57('0xf')](_0xee57('0xa'),_0x319905,_0x51db0c[_0xee57('0xf')][_0xee57('0x10')]);return _0x237efe(_0x51db0c[_0xee57('0xf')]['message']);}logger[_0xee57('0xf')]('Campaign,\x20%s,\x20%s',_0x319905,_0x51db0c[_0xee57('0xf')]['message']);return _0x342a62(_0x51db0c[_0xee57('0xf')]['message']);}else{logger['info'](_0xee57('0xa'),_0x319905,_0xee57('0xb'));_0x342a62(_0x51db0c[_0xee57('0x11')][_0xee57('0x10')]);}})['catch'](function(_0x40d08f){logger[_0xee57('0xf')]('Campaign,\x20%s,\x20%s',_0x319905,_0x40d08f);_0x237efe(_0x40d08f);});});}exports['GetCampaign']=function(_0x49656a){var _0x41e018=this;return new Promise(function(_0x558acc,_0x9a6461){return db[_0xee57('0x12')][_0xee57('0x13')]({'raw':_0x49656a[_0xee57('0x14')]?_0x49656a[_0xee57('0x14')][_0xee57('0x15')]===undefined?!![]:![]:!![],'where':_0x49656a['options']?_0x49656a[_0xee57('0x14')][_0xee57('0x16')]||null:null,'attributes':_0x49656a[_0xee57('0x14')]?_0x49656a['options']['attributes']||null:null,'limit':_0x49656a[_0xee57('0x14')]?_0x49656a['options'][_0xee57('0x17')]||null:null,'include':_0x49656a[_0xee57('0x14')]?_0x49656a['options'][_0xee57('0x18')]?_[_0xee57('0x19')](_0x49656a[_0xee57('0x14')][_0xee57('0x18')],function(_0x54a70b){return{'model':db[_0x54a70b[_0xee57('0x1a')]],'as':_0x54a70b['as'],'attributes':_0x54a70b[_0xee57('0x1b')],'include':_0x54a70b[_0xee57('0x18')]?_[_0xee57('0x19')](_0x54a70b[_0xee57('0x18')],function(_0x52d2f9){return{'model':db[_0x52d2f9[_0xee57('0x1a')]],'as':_0x52d2f9['as'],'attributes':_0x52d2f9[_0xee57('0x1b')],'include':_0x52d2f9['include']?_[_0xee57('0x19')](_0x52d2f9['include'],function(_0x5505c2){return{'model':db[_0x5505c2[_0xee57('0x1a')]],'as':_0x5505c2['as'],'attributes':_0x5505c2[_0xee57('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee57('0x9')](function(_0x2cb540){logger['info']('GetCampaign',_0x49656a);logger[_0xee57('0xc')]('GetCampaign',_0x49656a,JSON[_0xee57('0xe')](_0x2cb540));_0x558acc(_0x2cb540);})[_0xee57('0x1c')](function(_0x1c7079){logger[_0xee57('0xf')](_0xee57('0x1d'),_0x1c7079['message'],_0x49656a);_0x9a6461(_0x41e018[_0xee57('0xf')](0x1f4,_0x1c7079[_0xee57('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 01bfef4..0a46ad9 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 _0x4aca=['fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','addLists','addBlackLists','destroy','removeLists','delete','removeBlackLists','exports','util','connect-timeout','express'];(function(_0x2ea87d,_0x1d3534){var _0x1a97a9=function(_0x3beb73){while(--_0x3beb73){_0x2ea87d['push'](_0x2ea87d['shift']());}};_0x1a97a9(++_0x1d3534);}(_0x4aca,0x1dd));var _0xa4ac=function(_0x4657ed,_0x410884){_0x4657ed=_0x4657ed-0x0;var _0x206327=_0x4aca[_0x4657ed];return _0x206327;};'use strict';var multer=require('multer');var util=require(_0xa4ac('0x0'));var path=require('path');var timeout=require(_0xa4ac('0x1'));var express=require(_0xa4ac('0x2'));var router=express['Router']();var fs_extra=require(_0xa4ac('0x3'));var auth=require(_0xa4ac('0x4'));var interaction=require(_0xa4ac('0x5'));var config=require('../../config/environment');var controller=require(_0xa4ac('0x6'));router[_0xa4ac('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa4ac('0x7')](_0xa4ac('0x8'),auth[_0xa4ac('0x9')](),controller[_0xa4ac('0xa')]);router[_0xa4ac('0x7')]('/:id/hoppers',auth[_0xa4ac('0x9')](),controller[_0xa4ac('0xb')]);router[_0xa4ac('0x7')](_0xa4ac('0xc'),auth[_0xa4ac('0x9')](),controller[_0xa4ac('0xd')]);router['get'](_0xa4ac('0xe'),auth[_0xa4ac('0x9')](),controller[_0xa4ac('0xf')]);router['get'](_0xa4ac('0x10'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xa4ac('0x7')](_0xa4ac('0x11'),auth['isAuthenticated'](),controller[_0xa4ac('0x12')]);router['get'](_0xa4ac('0x13'),auth[_0xa4ac('0x9')](),controller[_0xa4ac('0x14')]);router['post']('/',auth[_0xa4ac('0x9')](),controller['create']);router[_0xa4ac('0x15')](_0xa4ac('0x16'),auth[_0xa4ac('0x9')](),controller['clone']);router[_0xa4ac('0x15')](_0xa4ac('0x11'),auth[_0xa4ac('0x9')](),controller[_0xa4ac('0x17')]);router[_0xa4ac('0x15')](_0xa4ac('0x13'),auth[_0xa4ac('0x9')](),controller[_0xa4ac('0x18')]);router['put'](_0xa4ac('0x8'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xa4ac('0x9')](),controller[_0xa4ac('0x19')]);router['delete'](_0xa4ac('0x11'),auth[_0xa4ac('0x9')](),controller[_0xa4ac('0x1a')]);router[_0xa4ac('0x1b')]('/:id/blacklists',auth[_0xa4ac('0x9')](),controller[_0xa4ac('0x1c')]);module[_0xa4ac('0x1d')]=router; \ No newline at end of file +var _0x793c=['create','/:id/clone','addLists','addBlackLists','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','index','/:id','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x793c,0x99));var _0xc793=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x793c[_0x4a53d];return _0x27410e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc793('0x0'));var timeout=require(_0xc793('0x1'));var express=require(_0xc793('0x2'));var router=express[_0xc793('0x3')]();var fs_extra=require(_0xc793('0x4'));var auth=require(_0xc793('0x5'));var interaction=require(_0xc793('0x6'));var config=require('../../config/environment');var controller=require(_0xc793('0x7'));router[_0xc793('0x8')]('/',auth['isAuthenticated'](),controller[_0xc793('0x9')]);router[_0xc793('0x8')](_0xc793('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc793('0x8')](_0xc793('0xb'),auth[_0xc793('0xc')](),controller[_0xc793('0xd')]);router[_0xc793('0x8')](_0xc793('0xe'),auth[_0xc793('0xc')](),controller['getHopperHistories']);router[_0xc793('0x8')](_0xc793('0xf'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xc793('0x8')]('/:id/hopper_black',auth[_0xc793('0xc')](),controller[_0xc793('0x10')]);router[_0xc793('0x8')](_0xc793('0x11'),auth[_0xc793('0xc')](),controller[_0xc793('0x12')]);router[_0xc793('0x8')](_0xc793('0x13'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xc793('0x14')]('/',auth[_0xc793('0xc')](),controller[_0xc793('0x15')]);router[_0xc793('0x14')](_0xc793('0x16'),auth[_0xc793('0xc')](),controller['clone']);router[_0xc793('0x14')](_0xc793('0x11'),auth[_0xc793('0xc')](),controller[_0xc793('0x17')]);router[_0xc793('0x14')](_0xc793('0x13'),auth[_0xc793('0xc')](),controller[_0xc793('0x18')]);router['put'](_0xc793('0xa'),auth[_0xc793('0xc')](),controller[_0xc793('0x19')]);router[_0xc793('0x1a')](_0xc793('0xa'),auth[_0xc793('0xc')](),controller[_0xc793('0x1b')]);router['delete'](_0xc793('0x11'),auth[_0xc793('0xc')](),controller['removeLists']);router['delete'](_0xc793('0x13'),auth[_0xc793('0xc')](),controller['removeBlackLists']);module[_0xc793('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 053722d..c6ff23e 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 _0x8b0d=['getDataValue','key','sequelize','exports','STRING','TEXT','medium','VIRTUAL'];(function(_0x31ce0d,_0x3588fe){var _0x328b03=function(_0x40f8a9){while(--_0x40f8a9){_0x31ce0d['push'](_0x31ce0d['shift']());}};_0x328b03(++_0x3588fe);}(_0x8b0d,0x182));var _0xd8b0=function(_0x54c006,_0x1b6c40){_0x54c006=_0x54c006-0x0;var _0x39ed48=_0x8b0d[_0x54c006];return _0x39ed48;};'use strict';var Sequelize=require(_0xd8b0('0x0'));module[_0xd8b0('0x1')]={'key':{'type':Sequelize[_0xd8b0('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xd8b0('0x3')],'length':_0xd8b0('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xd8b0('0x2')]},'name':{'type':Sequelize[_0xd8b0('0x5')],'get':function(){return this[_0xd8b0('0x6')](_0xd8b0('0x7'));}}}; \ No newline at end of file +var _0xf48f=['getDataValue','sequelize','exports','STRING'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xf48f,0xc1));var _0xff48=function(_0x13f66f,_0x350ce6){_0x13f66f=_0x13f66f-0x0;var _0x24d508=_0xf48f[_0x13f66f];return _0x24d508;};'use strict';var Sequelize=require(_0xff48('0x0'));module[_0xff48('0x1')]={'key':{'type':Sequelize[_0xff48('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0xff48('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xff48('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 4d564c6..834fab3 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 _0xb726=['fs-extra','crypto','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','then','end','error','name','index','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs'];(function(_0x11f0e5,_0x34eb10){var _0xca9f88=function(_0x2dfb8a){while(--_0x2dfb8a){_0x11f0e5['push'](_0x11f0e5['shift']());}};_0xca9f88(++_0x34eb10);}(_0xb726,0x182));var _0x6b72=function(_0x3636eb,_0x4ab525){_0x3636eb=_0x3636eb-0x0;var _0x2a74b1=_0xb726[_0x3636eb];return _0x2a74b1;};'use strict';var emlformat=require(_0x6b72('0x0'));var rimraf=require(_0x6b72('0x1'));var zipdir=require(_0x6b72('0x2'));var jsonpatch=require(_0x6b72('0x3'));var rp=require('request-promise');var moment=require(_0x6b72('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6b72('0x5'));var util=require('util');var path=require(_0x6b72('0x6'));var sox=require('sox');var csv=require(_0x6b72('0x7'));var ejs=require(_0x6b72('0x8'));var fs=require('fs');var fs_extra=require(_0x6b72('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b72('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6b72('0x7'));var querystring=require(_0x6b72('0xb'));var Papa=require(_0x6b72('0xc'));var Redis=require(_0x6b72('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b72('0xe'))('api');var utils=require(_0x6b72('0xf'));var config=require(_0x6b72('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b72('0x11'))['db'];function respondWithStatusCode(_0x18abd1,_0x228eaf){_0x228eaf=_0x228eaf||0xcc;return function(_0x4d9d07){if(_0x4d9d07){return _0x18abd1[_0x6b72('0x12')](_0x228eaf);}return _0x18abd1[_0x6b72('0x13')](_0x228eaf)['end']();};}function respondWithResult(_0x212f8a,_0xd5db2d){_0xd5db2d=_0xd5db2d||0xc8;return function(_0xaaa88a){if(_0xaaa88a){return _0x212f8a[_0x6b72('0x13')](_0xd5db2d)[_0x6b72('0x14')](_0xaaa88a);}};}function respondWithFilteredResult(_0x42572c,_0x3f554d){return function(_0x4703bb){if(_0x4703bb){var _0x18f211=typeof _0x3f554d['offset']===_0x6b72('0x15')&&typeof _0x3f554d[_0x6b72('0x16')]===_0x6b72('0x15');var _0x377a4e=_0x4703bb[_0x6b72('0x17')];var _0x321af8=_0x18f211?0x0:_0x3f554d['offset'];var _0x35e0c9=_0x18f211?_0x4703bb[_0x6b72('0x17')]:_0x3f554d[_0x6b72('0x18')]+_0x3f554d['limit'];var _0x4c9b26;if(_0x35e0c9>=_0x377a4e){_0x35e0c9=_0x377a4e;_0x4c9b26=0xc8;}else{_0x4c9b26=0xce;}_0x42572c[_0x6b72('0x13')](_0x4c9b26);return _0x42572c[_0x6b72('0x19')]('Content-Range',_0x321af8+'-'+_0x35e0c9+'/'+_0x377a4e)[_0x6b72('0x14')](_0x4703bb);}return null;};}function patchUpdates(_0xaba54e){return function(_0x9919ba){try{jsonpatch[_0x6b72('0x1a')](_0x9919ba,_0xaba54e,!![]);}catch(_0x5ee5e2){return BPromise[_0x6b72('0x1b')](_0x5ee5e2);}return _0x9919ba[_0x6b72('0x1c')]();};}function saveUpdates(_0x3a771b,_0x5e8d19){return function(_0xb34e56){if(_0xb34e56){return _0xb34e56[_0x6b72('0x1d')](_0x3a771b)['then'](function(_0x289e74){return _0x289e74;});}return null;};}function removeEntity(_0x18be49,_0x323c0b){return function(_0x32049e){if(_0x32049e){return _0x32049e[_0x6b72('0x1e')]()['then'](function(){var _0x580cb2=_0x32049e[_0x6b72('0x1f')]({'plain':!![]});var _0x585243='CannedAnswers';return db['UserProfileResource']['destroy']({'where':{'type':_0x585243,'resourceId':_0x580cb2['id']}})['then'](function(){return _0x32049e;});})[_0x6b72('0x20')](function(){_0x18be49['status'](0xcc)[_0x6b72('0x21')]();});}};}function handleEntityNotFound(_0x551214,_0x5657d1){return function(_0x4081f6){if(!_0x4081f6){_0x551214[_0x6b72('0x12')](0x194);}return _0x4081f6;};}function handleError(_0x18cce5,_0x397828){_0x397828=_0x397828||0x1f4;return function(_0x5808ed){logger[_0x6b72('0x22')](_0x5808ed['stack']);if(_0x5808ed['name']){delete _0x5808ed[_0x6b72('0x23')];}_0x18cce5[_0x6b72('0x13')](_0x397828)['send'](_0x5808ed);};}exports[_0x6b72('0x24')]=function(_0x3d9636,_0x230622){var _0x5c66ef={},_0x50e5e3={},_0x4d62dd={'count':0x0,'rows':[]};var _0x3bfeea=_['map'](db['CannedAnswer']['rawAttributes'],function(_0x2457f7){return{'name':_0x2457f7['fieldName'],'type':_0x2457f7[_0x6b72('0x25')][_0x6b72('0x26')]};});_0x50e5e3[_0x6b72('0x27')]=_['map'](_0x3bfeea,_0x6b72('0x23'));_0x50e5e3[_0x6b72('0x28')]=_[_0x6b72('0x29')](_0x3d9636[_0x6b72('0x28')]);_0x50e5e3[_0x6b72('0x2a')]=_['intersection'](_0x50e5e3[_0x6b72('0x27')],_0x50e5e3[_0x6b72('0x28')]);_0x5c66ef[_0x6b72('0x2b')]=_[_0x6b72('0x2c')](_0x50e5e3[_0x6b72('0x27')],qs[_0x6b72('0x2d')](_0x3d9636[_0x6b72('0x28')][_0x6b72('0x2d')]));_0x5c66ef[_0x6b72('0x2b')]=_0x5c66ef['attributes']['length']?_0x5c66ef['attributes']:_0x50e5e3[_0x6b72('0x27')];if(!_0x3d9636['query']['hasOwnProperty'](_0x6b72('0x2e'))){_0x5c66ef[_0x6b72('0x16')]=qs[_0x6b72('0x16')](_0x3d9636[_0x6b72('0x28')][_0x6b72('0x16')]);_0x5c66ef[_0x6b72('0x18')]=qs[_0x6b72('0x18')](_0x3d9636[_0x6b72('0x28')]['offset']);}_0x5c66ef[_0x6b72('0x2f')]=qs[_0x6b72('0x30')](_0x3d9636[_0x6b72('0x28')]['sort']);_0x5c66ef[_0x6b72('0x31')]=qs[_0x6b72('0x2a')](_['pick'](_0x3d9636[_0x6b72('0x28')],_0x50e5e3[_0x6b72('0x2a')]),_0x3bfeea);if(_0x3d9636[_0x6b72('0x28')][_0x6b72('0x32')]){_0x5c66ef[_0x6b72('0x31')]=_[_0x6b72('0x33')](_0x5c66ef[_0x6b72('0x31')],{'$or':[{'key':{'$like':'%'+_0x3d9636[_0x6b72('0x28')][_0x6b72('0x32')]+'%'}},{'value':{'$like':'%'+_0x3d9636[_0x6b72('0x28')]['filter']+'%'}}]});}_0x5c66ef=_[_0x6b72('0x33')]({},_0x5c66ef,_0x3d9636[_0x6b72('0x34')]);var _0x38ef17={'where':_0x5c66ef[_0x6b72('0x31')]};return db[_0x6b72('0x35')][_0x6b72('0x17')](_0x38ef17)['then'](function(_0x1679f9){_0x4d62dd[_0x6b72('0x17')]=_0x1679f9;if(_0x3d9636[_0x6b72('0x28')][_0x6b72('0x36')]){_0x5c66ef[_0x6b72('0x37')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6b72('0x38')](_0x5c66ef);})[_0x6b72('0x20')](function(_0x28bc92){_0x4d62dd[_0x6b72('0x39')]=_0x28bc92;return _0x4d62dd;})['then'](respondWithFilteredResult(_0x230622,_0x5c66ef))['catch'](handleError(_0x230622,null));};exports[_0x6b72('0x3a')]=function(_0x2b685e,_0xe9850f){var _0x18ff11={'raw':!![],'where':{'id':_0x2b685e[_0x6b72('0x3b')]['id']}},_0xf164d9={};_0xf164d9['model']=_['keys'](db[_0x6b72('0x35')][_0x6b72('0x3c')]);_0xf164d9[_0x6b72('0x28')]=_[_0x6b72('0x29')](_0x2b685e[_0x6b72('0x28')]);_0xf164d9[_0x6b72('0x2a')]=_['intersection'](_0xf164d9[_0x6b72('0x27')],_0xf164d9['query']);_0x18ff11[_0x6b72('0x2b')]=_['intersection'](_0xf164d9['model'],qs[_0x6b72('0x2d')](_0x2b685e[_0x6b72('0x28')][_0x6b72('0x2d')]));_0x18ff11['attributes']=_0x18ff11['attributes'][_0x6b72('0x3d')]?_0x18ff11[_0x6b72('0x2b')]:_0xf164d9[_0x6b72('0x27')];if(_0x2b685e[_0x6b72('0x28')]['includeAll']){_0x18ff11[_0x6b72('0x37')]=[{'all':!![]}];}_0x18ff11=_[_0x6b72('0x33')]({},_0x18ff11,_0x2b685e[_0x6b72('0x34')]);return db[_0x6b72('0x35')][_0x6b72('0x3e')](_0x18ff11)[_0x6b72('0x20')](handleEntityNotFound(_0xe9850f,null))[_0x6b72('0x20')](respondWithResult(_0xe9850f,null))[_0x6b72('0x3f')](handleError(_0xe9850f,null));};exports[_0x6b72('0x1d')]=function(_0x16073d,_0x2a1362){if(_0x16073d[_0x6b72('0x40')]['id']){delete _0x16073d['body']['id'];}return db[_0x6b72('0x35')][_0x6b72('0x3e')]({'where':{'id':_0x16073d[_0x6b72('0x3b')]['id']}})[_0x6b72('0x20')](handleEntityNotFound(_0x2a1362,null))[_0x6b72('0x20')](saveUpdates(_0x16073d[_0x6b72('0x40')],null))['then'](respondWithResult(_0x2a1362,null))[_0x6b72('0x3f')](handleError(_0x2a1362,null));};exports[_0x6b72('0x1e')]=function(_0x372ed3,_0x268d32){return db['CannedAnswer'][_0x6b72('0x3e')]({'where':{'id':_0x372ed3[_0x6b72('0x3b')]['id']}})[_0x6b72('0x20')](handleEntityNotFound(_0x268d32,null))[_0x6b72('0x20')](removeEntity(_0x268d32,null))[_0x6b72('0x3f')](handleError(_0x268d32,null));};exports[_0x6b72('0x41')]=function(_0x5ba5aa,_0xb293f8){var _0x3e3364={'key':_0x5ba5aa['body'][_0x6b72('0x26')]};if(_0x5ba5aa[_0x6b72('0x40')]['MailAccountId']){_0x3e3364[_0x6b72('0x42')]=_0x5ba5aa[_0x6b72('0x40')][_0x6b72('0x42')];}else if(_0x5ba5aa[_0x6b72('0x40')][_0x6b72('0x43')]){_0x3e3364[_0x6b72('0x43')]=_0x5ba5aa[_0x6b72('0x40')][_0x6b72('0x43')];}else if(_0x5ba5aa[_0x6b72('0x40')][_0x6b72('0x44')]){_0x3e3364[_0x6b72('0x44')]=_0x5ba5aa['body']['OpenchannelAccountId'];}else if(_0x5ba5aa[_0x6b72('0x40')][_0x6b72('0x45')]){_0x3e3364[_0x6b72('0x45')]=_0x5ba5aa[_0x6b72('0x40')][_0x6b72('0x45')];}return db[_0x6b72('0x35')][_0x6b72('0x3e')]({'where':_0x3e3364})[_0x6b72('0x20')](function(_0x2c607f){if(_0x2c607f){throw new db[(_0x6b72('0x46'))]['ValidationError'](_0x6b72('0x47'));}return db[_0x6b72('0x35')][_0x6b72('0x41')](_0x5ba5aa['body']);})['then'](function(_0x4753f1){var _0x34104a=_0x5ba5aa[_0x6b72('0x48')][_0x6b72('0x1f')]({'plain':!![]});if(!_0x34104a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34104a[_0x6b72('0x49')]===_0x6b72('0x48')){var _0x27065a=_0x4753f1[_0x6b72('0x1f')]({'plain':!![]});return db[_0x6b72('0x4a')][_0x6b72('0x3e')]({'where':{'name':_0x6b72('0x4b'),'userProfileId':_0x34104a[_0x6b72('0x4c')]},'raw':!![]})['then'](function(_0x351974){if(_0x351974&&_0x351974[_0x6b72('0x4d')]===0x0){return db[_0x6b72('0x4e')]['create']({'name':_0x27065a[_0x6b72('0x23')],'resourceId':_0x27065a['id'],'type':_0x351974[_0x6b72('0x23')],'sectionId':_0x351974['id']},{})[_0x6b72('0x20')](function(){return _0x4753f1;});}else{return _0x4753f1;}})[_0x6b72('0x3f')](function(_0x1cc8b0){logger[_0x6b72('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cc8b0);throw _0x1cc8b0;});}return _0x4753f1;})[_0x6b72('0x20')](respondWithResult(_0xb293f8,0xc9))[_0x6b72('0x3f')](handleError(_0xb293f8,null));}; \ No newline at end of file +var _0x0d79=['type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','CannedAnswer','findAll','rows','update','find','params','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','map','rawAttributes'];(function(_0x3db893,_0xe169ee){var _0x1a9c14=function(_0x58f71f){while(--_0x58f71f){_0x3db893['push'](_0x3db893['shift']());}};_0x1a9c14(++_0xe169ee);}(_0x0d79,0x1e0));var _0x90d7=function(_0x23c9a6,_0x5b2afa){_0x23c9a6=_0x23c9a6-0x0;var _0x5cfbb3=_0x0d79[_0x23c9a6];return _0x5cfbb3;};'use strict';var emlformat=require(_0x90d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x90d7('0x2'));var BPromise=require(_0x90d7('0x3'));var Mustache=require(_0x90d7('0x4'));var util=require(_0x90d7('0x5'));var path=require(_0x90d7('0x6'));var sox=require(_0x90d7('0x7'));var csv=require('to-csv');var ejs=require(_0x90d7('0x8'));var fs=require('fs');var fs_extra=require(_0x90d7('0x9'));var _=require(_0x90d7('0xa'));var squel=require(_0x90d7('0xb'));var crypto=require(_0x90d7('0xc'));var jsforce=require(_0x90d7('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x90d7('0xe'));var Papa=require(_0x90d7('0xf'));var Redis=require(_0x90d7('0x10'));var authService=require(_0x90d7('0x11'));var qs=require(_0x90d7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90d7('0x13'));var logger=require(_0x90d7('0x14'))(_0x90d7('0x15'));var utils=require(_0x90d7('0x16'));var config=require(_0x90d7('0x17'));var licenseUtil=require(_0x90d7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21ce0f,_0xb537c7){_0xb537c7=_0xb537c7||0xcc;return function(_0x15ee98){if(_0x15ee98){return _0x21ce0f[_0x90d7('0x19')](_0xb537c7);}return _0x21ce0f[_0x90d7('0x1a')](_0xb537c7)[_0x90d7('0x1b')]();};}function respondWithResult(_0xb36acd,_0x41e5e4){_0x41e5e4=_0x41e5e4||0xc8;return function(_0x31c7db){if(_0x31c7db){return _0xb36acd[_0x90d7('0x1a')](_0x41e5e4)[_0x90d7('0x1c')](_0x31c7db);}};}function respondWithFilteredResult(_0x231a4e,_0x1ed0c1){return function(_0x5330b8){if(_0x5330b8){var _0x25125e=typeof _0x1ed0c1['offset']==='undefined'&&typeof _0x1ed0c1[_0x90d7('0x1d')]===_0x90d7('0x1e');var _0x151a8c=_0x5330b8[_0x90d7('0x1f')];var _0x40987d=_0x25125e?0x0:_0x1ed0c1[_0x90d7('0x20')];var _0x59472c=_0x25125e?_0x5330b8[_0x90d7('0x1f')]:_0x1ed0c1['offset']+_0x1ed0c1[_0x90d7('0x1d')];var _0xea32a5;if(_0x59472c>=_0x151a8c){_0x59472c=_0x151a8c;_0xea32a5=0xc8;}else{_0xea32a5=0xce;}_0x231a4e['status'](_0xea32a5);return _0x231a4e[_0x90d7('0x21')]('Content-Range',_0x40987d+'-'+_0x59472c+'/'+_0x151a8c)[_0x90d7('0x1c')](_0x5330b8);}return null;};}function patchUpdates(_0x47b213){return function(_0x4acbca){try{jsonpatch[_0x90d7('0x22')](_0x4acbca,_0x47b213,!![]);}catch(_0x5b0d58){return BPromise[_0x90d7('0x23')](_0x5b0d58);}return _0x4acbca[_0x90d7('0x24')]();};}function saveUpdates(_0x1a1b12,_0x4df613){return function(_0x49058f){if(_0x49058f){return _0x49058f['update'](_0x1a1b12)[_0x90d7('0x25')](function(_0x126290){return _0x126290;});}return null;};}function removeEntity(_0x117ec7,_0x4457dc){return function(_0x45aa74){if(_0x45aa74){return _0x45aa74[_0x90d7('0x26')]()['then'](function(){var _0x140271=_0x45aa74[_0x90d7('0x27')]({'plain':!![]});var _0x50b66a=_0x90d7('0x28');return db[_0x90d7('0x29')]['destroy']({'where':{'type':_0x50b66a,'resourceId':_0x140271['id']}})[_0x90d7('0x25')](function(){return _0x45aa74;});})[_0x90d7('0x25')](function(){_0x117ec7[_0x90d7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c6cd,_0x3e79b2){return function(_0x400973){if(!_0x400973){_0x51c6cd[_0x90d7('0x19')](0x194);}return _0x400973;};}function handleError(_0x196406,_0x3e058e){_0x3e058e=_0x3e058e||0x1f4;return function(_0x23972a){logger[_0x90d7('0x2a')](_0x23972a[_0x90d7('0x2b')]);if(_0x23972a['name']){delete _0x23972a[_0x90d7('0x2c')];}_0x196406['status'](_0x3e058e)[_0x90d7('0x2d')](_0x23972a);};}exports['index']=function(_0x7bd528,_0x195f81){var _0x50eb42={},_0x448c6c={},_0x39600b={'count':0x0,'rows':[]};var _0x3e56a4=_[_0x90d7('0x2e')](db['CannedAnswer'][_0x90d7('0x2f')],function(_0x5cbc3b){return{'name':_0x5cbc3b['fieldName'],'type':_0x5cbc3b[_0x90d7('0x30')]['key']};});_0x448c6c[_0x90d7('0x31')]=_[_0x90d7('0x2e')](_0x3e56a4,_0x90d7('0x2c'));_0x448c6c[_0x90d7('0x32')]=_[_0x90d7('0x33')](_0x7bd528[_0x90d7('0x32')]);_0x448c6c[_0x90d7('0x34')]=_['intersection'](_0x448c6c[_0x90d7('0x31')],_0x448c6c[_0x90d7('0x32')]);_0x50eb42['attributes']=_[_0x90d7('0x35')](_0x448c6c['model'],qs[_0x90d7('0x36')](_0x7bd528[_0x90d7('0x32')]['fields']));_0x50eb42[_0x90d7('0x37')]=_0x50eb42[_0x90d7('0x37')][_0x90d7('0x38')]?_0x50eb42[_0x90d7('0x37')]:_0x448c6c[_0x90d7('0x31')];if(!_0x7bd528[_0x90d7('0x32')]['hasOwnProperty'](_0x90d7('0x39'))){_0x50eb42[_0x90d7('0x1d')]=qs['limit'](_0x7bd528[_0x90d7('0x32')]['limit']);_0x50eb42[_0x90d7('0x20')]=qs[_0x90d7('0x20')](_0x7bd528[_0x90d7('0x32')][_0x90d7('0x20')]);}_0x50eb42['order']=qs[_0x90d7('0x3a')](_0x7bd528[_0x90d7('0x32')][_0x90d7('0x3a')]);_0x50eb42[_0x90d7('0x3b')]=qs[_0x90d7('0x34')](_[_0x90d7('0x3c')](_0x7bd528[_0x90d7('0x32')],_0x448c6c[_0x90d7('0x34')]),_0x3e56a4);if(_0x7bd528[_0x90d7('0x32')][_0x90d7('0x3d')]){_0x50eb42[_0x90d7('0x3b')]=_[_0x90d7('0x3e')](_0x50eb42[_0x90d7('0x3b')],{'$or':[{'key':{'$like':'%'+_0x7bd528['query'][_0x90d7('0x3d')]+'%'}},{'value':{'$like':'%'+_0x7bd528['query'][_0x90d7('0x3d')]+'%'}}]});}_0x50eb42=_[_0x90d7('0x3e')]({},_0x50eb42,_0x7bd528[_0x90d7('0x3f')]);var _0x515aec={'where':_0x50eb42['where']};return db['CannedAnswer'][_0x90d7('0x1f')](_0x515aec)[_0x90d7('0x25')](function(_0x22d42f){_0x39600b[_0x90d7('0x1f')]=_0x22d42f;if(_0x7bd528[_0x90d7('0x32')][_0x90d7('0x40')]){_0x50eb42[_0x90d7('0x41')]=[{'all':!![]}];}return db[_0x90d7('0x42')][_0x90d7('0x43')](_0x50eb42);})[_0x90d7('0x25')](function(_0x5b4091){_0x39600b[_0x90d7('0x44')]=_0x5b4091;return _0x39600b;})[_0x90d7('0x25')](respondWithFilteredResult(_0x195f81,_0x50eb42))['catch'](handleError(_0x195f81,null));};exports['show']=function(_0x11cddb,_0x541aab){var _0x2320c8={'raw':!![],'where':{'id':_0x11cddb['params']['id']}},_0x2ec2cb={};_0x2ec2cb['model']=_['keys'](db[_0x90d7('0x42')][_0x90d7('0x2f')]);_0x2ec2cb[_0x90d7('0x32')]=_[_0x90d7('0x33')](_0x11cddb[_0x90d7('0x32')]);_0x2ec2cb['filters']=_[_0x90d7('0x35')](_0x2ec2cb[_0x90d7('0x31')],_0x2ec2cb[_0x90d7('0x32')]);_0x2320c8[_0x90d7('0x37')]=_[_0x90d7('0x35')](_0x2ec2cb['model'],qs[_0x90d7('0x36')](_0x11cddb[_0x90d7('0x32')][_0x90d7('0x36')]));_0x2320c8[_0x90d7('0x37')]=_0x2320c8[_0x90d7('0x37')]['length']?_0x2320c8[_0x90d7('0x37')]:_0x2ec2cb[_0x90d7('0x31')];if(_0x11cddb[_0x90d7('0x32')][_0x90d7('0x40')]){_0x2320c8['include']=[{'all':!![]}];}_0x2320c8=_['merge']({},_0x2320c8,_0x11cddb[_0x90d7('0x3f')]);return db[_0x90d7('0x42')]['find'](_0x2320c8)[_0x90d7('0x25')](handleEntityNotFound(_0x541aab,null))[_0x90d7('0x25')](respondWithResult(_0x541aab,null))['catch'](handleError(_0x541aab,null));};exports[_0x90d7('0x45')]=function(_0x3e179f,_0x4f98d9){if(_0x3e179f['body']['id']){delete _0x3e179f['body']['id'];}return db[_0x90d7('0x42')][_0x90d7('0x46')]({'where':{'id':_0x3e179f[_0x90d7('0x47')]['id']}})[_0x90d7('0x25')](handleEntityNotFound(_0x4f98d9,null))[_0x90d7('0x25')](saveUpdates(_0x3e179f[_0x90d7('0x48')],null))[_0x90d7('0x25')](respondWithResult(_0x4f98d9,null))['catch'](handleError(_0x4f98d9,null));};exports[_0x90d7('0x26')]=function(_0x1e4d73,_0x1c826f){return db[_0x90d7('0x42')][_0x90d7('0x46')]({'where':{'id':_0x1e4d73[_0x90d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c826f,null))[_0x90d7('0x25')](removeEntity(_0x1c826f,null))[_0x90d7('0x49')](handleError(_0x1c826f,null));};exports[_0x90d7('0x4a')]=function(_0x47958a,_0x27eea1){var _0x2939e6={'key':_0x47958a[_0x90d7('0x48')]['key']};if(_0x47958a[_0x90d7('0x48')]['MailAccountId']){_0x2939e6[_0x90d7('0x4b')]=_0x47958a[_0x90d7('0x48')][_0x90d7('0x4b')];}else if(_0x47958a[_0x90d7('0x48')][_0x90d7('0x4c')]){_0x2939e6[_0x90d7('0x4c')]=_0x47958a[_0x90d7('0x48')]['SmsAccountId'];}else if(_0x47958a[_0x90d7('0x48')][_0x90d7('0x4d')]){_0x2939e6['OpenchannelAccountId']=_0x47958a[_0x90d7('0x48')][_0x90d7('0x4d')];}else if(_0x47958a[_0x90d7('0x48')][_0x90d7('0x4e')]){_0x2939e6[_0x90d7('0x4e')]=_0x47958a[_0x90d7('0x48')][_0x90d7('0x4e')];}return db[_0x90d7('0x42')][_0x90d7('0x46')]({'where':_0x2939e6})[_0x90d7('0x25')](function(_0x3cc2bd){if(_0x3cc2bd){throw new db[(_0x90d7('0x4f'))][(_0x90d7('0x50'))](_0x90d7('0x51'));}return db['CannedAnswer'][_0x90d7('0x4a')](_0x47958a[_0x90d7('0x48')]);})[_0x90d7('0x25')](function(_0x355c65){var _0x5bd66f=_0x47958a[_0x90d7('0x52')]['get']({'plain':!![]});if(!_0x5bd66f)throw new Error(_0x90d7('0x53'));if(_0x5bd66f[_0x90d7('0x54')]===_0x90d7('0x52')){var _0x1bc5f6=_0x355c65[_0x90d7('0x27')]({'plain':!![]});return db[_0x90d7('0x55')][_0x90d7('0x46')]({'where':{'name':_0x90d7('0x28'),'userProfileId':_0x5bd66f[_0x90d7('0x56')]},'raw':!![]})[_0x90d7('0x25')](function(_0xa4d59b){if(_0xa4d59b&&_0xa4d59b[_0x90d7('0x57')]===0x0){return db[_0x90d7('0x29')][_0x90d7('0x4a')]({'name':_0x1bc5f6[_0x90d7('0x2c')],'resourceId':_0x1bc5f6['id'],'type':_0xa4d59b[_0x90d7('0x2c')],'sectionId':_0xa4d59b['id']},{})[_0x90d7('0x25')](function(){return _0x355c65;});}else{return _0x355c65;}})['catch'](function(_0x297f77){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x297f77);throw _0x297f77;});}return _0x355c65;})[_0x90d7('0x25')](respondWithResult(_0x27eea1,0xc9))['catch'](handleError(_0x27eea1,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 427e18d..8797762 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 _0xa6ec=['../../config/environment','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3612fd,_0x1c9364){var _0x11929a=function(_0x1092ea){while(--_0x1092ea){_0x3612fd['push'](_0x3612fd['shift']());}};_0x11929a(++_0x1c9364);}(_0xa6ec,0xa0));var _0xca6e=function(_0xe6113b,_0x105e0e){_0xe6113b=_0xe6113b-0x0;var _0x251eed=_0xa6ec[_0xe6113b];return _0x251eed;};'use strict';var _=require(_0xca6e('0x0'));var util=require('util');var logger=require(_0xca6e('0x1'))(_0xca6e('0x2'));var moment=require(_0xca6e('0x3'));var BPromise=require(_0xca6e('0x4'));var rp=require(_0xca6e('0x5'));var fs=require('fs');var path=require(_0xca6e('0x6'));var rimraf=require(_0xca6e('0x7'));var config=require(_0xca6e('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0xca6e('0x9')]=function(_0x273d76,_0x5d1004){return _0x273d76[_0xca6e('0xa')](_0xca6e('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca6e('0xc'),'collate':_0xca6e('0xd')});}; \ No newline at end of file +var _0xfccf=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x52fecb,_0x17fbe2){var _0x19f93a=function(_0x17df97){while(--_0x17df97){_0x52fecb['push'](_0x52fecb['shift']());}};_0x19f93a(++_0x17fbe2);}(_0xfccf,0xaa));var _0xffcc=function(_0x2dd737,_0x34a69e){_0x2dd737=_0x2dd737-0x0;var _0x308df5=_0xfccf[_0x2dd737];return _0x308df5;};'use strict';var _=require(_0xffcc('0x0'));var util=require(_0xffcc('0x1'));var logger=require(_0xffcc('0x2'))(_0xffcc('0x3'));var moment=require(_0xffcc('0x4'));var BPromise=require(_0xffcc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xffcc('0x6'));var config=require(_0xffcc('0x7'));var attributes=require(_0xffcc('0x8'));module[_0xffcc('0x9')]=function(_0x319285,_0xe0432e){return _0x319285[_0xffcc('0xa')](_0xffcc('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xffcc('0xc'),'collate':_0xffcc('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 434f9b3..872b8aa 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(_0x2f9a2d,_0x178f1c){var _0x1c1c41=function(_0x15ccd2){while(--_0x15ccd2){_0x2f9a2d['push'](_0x2f9a2d['shift']());}};_0x1c1c41(++_0x178f1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x3f4bb7,_0x2cda3b){var _0x655726=function(_0x286229){while(--_0x286229){_0x3f4bb7['push'](_0x3f4bb7['shift']());}};_0x655726(++_0x2cda3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 845a9c0..5c9ac03 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 _0x11fa=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x20e1af,_0x3ebe95){var _0x572b6c=function(_0x5a3a32){while(--_0x5a3a32){_0x20e1af['push'](_0x20e1af['shift']());}};_0x572b6c(++_0x3ebe95);}(_0x11fa,0x155));var _0xa11f=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x11fa[_0x26462c];return _0x509a42;};'use strict';var multer=require('multer');var util=require(_0xa11f('0x0'));var path=require(_0xa11f('0x1'));var timeout=require(_0xa11f('0x2'));var express=require(_0xa11f('0x3'));var router=express[_0xa11f('0x4')]();var fs_extra=require(_0xa11f('0x5'));var auth=require(_0xa11f('0x6'));var interaction=require(_0xa11f('0x7'));var config=require(_0xa11f('0x8'));var controller=require(_0xa11f('0x9'));router[_0xa11f('0xa')]('/',auth[_0xa11f('0xb')](),controller[_0xa11f('0xc')]);router[_0xa11f('0xa')](_0xa11f('0xd'),auth[_0xa11f('0xb')](),controller['show']);router[_0xa11f('0xe')]('/',auth[_0xa11f('0xb')](),controller[_0xa11f('0xf')]);router[_0xa11f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa11f('0x11')]);router[_0xa11f('0x12')](_0xa11f('0xd'),auth['isAuthenticated'](),controller[_0xa11f('0x13')]);module[_0xa11f('0x14')]=router; \ No newline at end of file +var _0x70bf=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x416273,_0x5b1054){var _0x3c00e4=function(_0xedca6a){while(--_0xedca6a){_0x416273['push'](_0x416273['shift']());}};_0x3c00e4(++_0x5b1054);}(_0x70bf,0x14c));var _0xf70b=function(_0x62a6ba,_0x5506b3){_0x62a6ba=_0x62a6ba-0x0;var _0x30c69a=_0x70bf[_0x62a6ba];return _0x30c69a;};'use strict';var multer=require(_0xf70b('0x0'));var util=require(_0xf70b('0x1'));var path=require('path');var timeout=require(_0xf70b('0x2'));var express=require(_0xf70b('0x3'));var router=express[_0xf70b('0x4')]();var fs_extra=require(_0xf70b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf70b('0x6'));var config=require(_0xf70b('0x7'));var controller=require(_0xf70b('0x8'));router[_0xf70b('0x9')]('/',auth[_0xf70b('0xa')](),controller[_0xf70b('0xb')]);router['get'](_0xf70b('0xc'),auth[_0xf70b('0xa')](),controller[_0xf70b('0xd')]);router[_0xf70b('0xe')]('/',auth[_0xf70b('0xa')](),controller[_0xf70b('0xf')]);router[_0xf70b('0x10')](_0xf70b('0xc'),auth[_0xf70b('0xa')](),controller[_0xf70b('0x11')]);router[_0xf70b('0x12')](_0xf70b('0xc'),auth[_0xf70b('0xa')](),controller[_0xf70b('0x13')]);module[_0xf70b('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4c3017c..cfe8bed 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 _0xc3b0=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x1459e5,_0x2009e0){var _0x598767=function(_0x4b7e33){while(--_0x4b7e33){_0x1459e5['push'](_0x1459e5['shift']());}};_0x598767(++_0x2009e0);}(_0xc3b0,0x166));var _0x0c3b=function(_0x5b4725,_0x40dec6){_0x5b4725=_0x5b4725-0x0;var _0x5984db=_0xc3b0[_0x5b4725];return _0x5984db;};'use strict';var Sequelize=require(_0x0c3b('0x0'));module[_0x0c3b('0x1')]={'calldate':{'type':Sequelize[_0x0c3b('0x2')],'allowNull':![],'defaultValue':_0x0c3b('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x0c3b('0x4')]},'dcontext':{'type':Sequelize[_0x0c3b('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x0c3b('0x4')]},'lastapp':{'type':Sequelize[_0x0c3b('0x4')]},'lastdata':{'type':Sequelize[_0x0c3b('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0c3b('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0c3b('0x4')]},'amaflags':{'type':Sequelize[_0x0c3b('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x0c3b('0x4')]},'sequence':{'type':Sequelize[_0x0c3b('0x4')]},'peeraccount':{'type':Sequelize[_0x0c3b('0x4')]},'type':{'type':Sequelize[_0x0c3b('0x4')]},'tag':{'type':Sequelize[_0x0c3b('0x4')]}}; \ No newline at end of file +var _0x949d=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x5c3b99,_0x3a24d0){var _0x2b174c=function(_0x43bcca){while(--_0x43bcca){_0x5c3b99['push'](_0x5c3b99['shift']());}};_0x2b174c(++_0x3a24d0);}(_0x949d,0x162));var _0xd949=function(_0x287e3f,_0x461c24){_0x287e3f=_0x287e3f-0x0;var _0x11e075=_0x949d[_0x287e3f];return _0x11e075;};'use strict';var Sequelize=require(_0xd949('0x0'));module[_0xd949('0x1')]={'calldate':{'type':Sequelize[_0xd949('0x2')],'allowNull':![],'defaultValue':_0xd949('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xd949('0x4')]},'dcontext':{'type':Sequelize[_0xd949('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xd949('0x4')]},'lastapp':{'type':Sequelize[_0xd949('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xd949('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd949('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd949('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd949('0x4')]},'userfield':{'type':Sequelize[_0xd949('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xd949('0x4')]},'peeraccount':{'type':Sequelize[_0xd949('0x4')]},'type':{'type':Sequelize[_0xd949('0x4')]},'tag':{'type':Sequelize[_0xd949('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 04d1f55..6a8a5a7 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 _0xef17=['key','map','intersection','model','attributes','fields','length','query','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','offset','json','apply','reject','save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','fieldName'];(function(_0xff7d8a,_0x21f8b3){var _0x331ddd=function(_0x5c5b3b){while(--_0x5c5b3b){_0xff7d8a['push'](_0xff7d8a['shift']());}};_0x331ddd(++_0x21f8b3);}(_0xef17,0x136));var _0x7ef1=function(_0x21fdae,_0x30633b){_0x21fdae=_0x21fdae-0x0;var _0x4ca806=_0xef17[_0x21fdae];return _0x4ca806;};'use strict';var emlformat=require(_0x7ef1('0x0'));var rimraf=require(_0x7ef1('0x1'));var zipdir=require(_0x7ef1('0x2'));var jsonpatch=require(_0x7ef1('0x3'));var rp=require(_0x7ef1('0x4'));var moment=require(_0x7ef1('0x5'));var BPromise=require(_0x7ef1('0x6'));var Mustache=require(_0x7ef1('0x7'));var util=require(_0x7ef1('0x8'));var path=require('path');var sox=require(_0x7ef1('0x9'));var csv=require('to-csv');var ejs=require(_0x7ef1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ef1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ef1('0xc'));var deskjs=require(_0x7ef1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7ef1('0xe'));var Papa=require(_0x7ef1('0xf'));var Redis=require(_0x7ef1('0x10'));var authService=require(_0x7ef1('0x11'));var qs=require(_0x7ef1('0x12'));var as=require(_0x7ef1('0x13'));var hardwareService=require(_0x7ef1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7ef1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x122c8a,_0x51e226){_0x51e226=_0x51e226||0xcc;return function(_0x36ddf9){if(_0x36ddf9){return _0x122c8a[_0x7ef1('0x16')](_0x51e226);}return _0x122c8a[_0x7ef1('0x17')](_0x51e226)[_0x7ef1('0x18')]();};}function respondWithResult(_0x39ea9c,_0x317125){_0x317125=_0x317125||0xc8;return function(_0x26e9fb){if(_0x26e9fb){return _0x39ea9c[_0x7ef1('0x17')](_0x317125)['json'](_0x26e9fb);}};}function respondWithFilteredResult(_0x4de80f,_0x267f0e){return function(_0x5d0499){if(_0x5d0499){var _0x20b843=typeof _0x267f0e[_0x7ef1('0x19')]==='undefined'&&typeof _0x267f0e['limit']==='undefined';var _0x300645=_0x5d0499['count'];var _0x3a5835=_0x20b843?0x0:_0x267f0e['offset'];var _0x5a7b2b=_0x20b843?_0x5d0499['count']:_0x267f0e[_0x7ef1('0x19')]+_0x267f0e['limit'];var _0x38c5a7;if(_0x5a7b2b>=_0x300645){_0x5a7b2b=_0x300645;_0x38c5a7=0xc8;}else{_0x38c5a7=0xce;}_0x4de80f[_0x7ef1('0x17')](_0x38c5a7);return _0x4de80f['set']('Content-Range',_0x3a5835+'-'+_0x5a7b2b+'/'+_0x300645)[_0x7ef1('0x1a')](_0x5d0499);}return null;};}function patchUpdates(_0x5490b9){return function(_0x458459){try{jsonpatch[_0x7ef1('0x1b')](_0x458459,_0x5490b9,!![]);}catch(_0x2f8164){return BPromise[_0x7ef1('0x1c')](_0x2f8164);}return _0x458459[_0x7ef1('0x1d')]();};}function saveUpdates(_0xf24942,_0x20887b){return function(_0xd71594){if(_0xd71594){return _0xd71594['update'](_0xf24942)[_0x7ef1('0x1e')](function(_0x3b118f){return _0x3b118f;});}return null;};}function removeEntity(_0x3f26fb,_0x3324d4){return function(_0x31b5bf){if(_0x31b5bf){return _0x31b5bf[_0x7ef1('0x1f')]()[_0x7ef1('0x1e')](function(){_0x3f26fb[_0x7ef1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1ace,_0x33e008){return function(_0x12ef5a){if(!_0x12ef5a){_0x4b1ace[_0x7ef1('0x16')](0x194);}return _0x12ef5a;};}function handleError(_0xcfce5e,_0x19c2c2){_0x19c2c2=_0x19c2c2||0x1f4;return function(_0x4cfa16){logger[_0x7ef1('0x20')](_0x4cfa16[_0x7ef1('0x21')]);if(_0x4cfa16[_0x7ef1('0x22')]){delete _0x4cfa16[_0x7ef1('0x22')];}_0xcfce5e[_0x7ef1('0x17')](_0x19c2c2)[_0x7ef1('0x23')](_0x4cfa16);};}exports[_0x7ef1('0x24')]=function(_0x58e7ee,_0x2e8f1b){var _0x4b0380={},_0x3306b0={},_0x2546bf={'count':0x0,'rows':[]};var _0x4b5fde=_['map'](db[_0x7ef1('0x25')][_0x7ef1('0x26')],function(_0x5ab3a5){return{'name':_0x5ab3a5[_0x7ef1('0x27')],'type':_0x5ab3a5['type'][_0x7ef1('0x28')]};});_0x3306b0['model']=_[_0x7ef1('0x29')](_0x4b5fde,_0x7ef1('0x22'));_0x3306b0['query']=_['keys'](_0x58e7ee['query']);_0x3306b0['filters']=_[_0x7ef1('0x2a')](_0x3306b0[_0x7ef1('0x2b')],_0x3306b0['query']);_0x4b0380[_0x7ef1('0x2c')]=_['intersection'](_0x3306b0['model'],qs[_0x7ef1('0x2d')](_0x58e7ee['query'][_0x7ef1('0x2d')]));_0x4b0380[_0x7ef1('0x2c')]=_0x4b0380[_0x7ef1('0x2c')][_0x7ef1('0x2e')]?_0x4b0380['attributes']:_0x3306b0[_0x7ef1('0x2b')];if(!_0x58e7ee[_0x7ef1('0x2f')]['hasOwnProperty']('nolimit')){_0x4b0380['limit']=qs['limit'](_0x58e7ee[_0x7ef1('0x2f')]['limit']);_0x4b0380[_0x7ef1('0x19')]=qs[_0x7ef1('0x19')](_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x19')]);}_0x4b0380[_0x7ef1('0x30')]=qs[_0x7ef1('0x31')](_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x31')]);_0x4b0380[_0x7ef1('0x32')]=qs[_0x7ef1('0x33')](_[_0x7ef1('0x34')](_0x58e7ee['query'],_0x3306b0[_0x7ef1('0x33')]),_0x4b5fde);if(_0x58e7ee[_0x7ef1('0x2f')]['filter']){_0x4b0380[_0x7ef1('0x32')]=_[_0x7ef1('0x35')](_0x4b0380[_0x7ef1('0x32')],{'$or':_[_0x7ef1('0x29')](_0x4b5fde,function(_0x8ef5b3){if(_0x8ef5b3['type']!==_0x7ef1('0x36')){var _0x1ccbfb={};_0x1ccbfb[_0x8ef5b3[_0x7ef1('0x22')]]={'$like':'%'+_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x37')]+'%'};return _0x1ccbfb;}})});}_0x4b0380=_[_0x7ef1('0x35')]({},_0x4b0380,_0x58e7ee[_0x7ef1('0x38')]);var _0x238aa7={'where':_0x4b0380[_0x7ef1('0x32')]};return db[_0x7ef1('0x25')][_0x7ef1('0x39')](_0x238aa7)[_0x7ef1('0x1e')](function(_0x2da912){_0x2546bf[_0x7ef1('0x39')]=_0x2da912;if(_0x58e7ee[_0x7ef1('0x2f')]['includeAll']){_0x4b0380[_0x7ef1('0x3a')]=[{'all':!![]}];}return db[_0x7ef1('0x25')][_0x7ef1('0x3b')](_0x4b0380);})[_0x7ef1('0x1e')](function(_0x3889d7){_0x2546bf[_0x7ef1('0x3c')]=_0x3889d7;return _0x2546bf;})[_0x7ef1('0x1e')](respondWithFilteredResult(_0x2e8f1b,_0x4b0380))[_0x7ef1('0x3d')](handleError(_0x2e8f1b,null));};exports[_0x7ef1('0x3e')]=function(_0x1cff0b,_0x3e5ecd){var _0x374bf5={'raw':!![],'where':{'id':_0x1cff0b['params']['id']}},_0x2fb6c4={};_0x2fb6c4[_0x7ef1('0x2b')]=_[_0x7ef1('0x3f')](db[_0x7ef1('0x25')][_0x7ef1('0x26')]);_0x2fb6c4[_0x7ef1('0x2f')]=_[_0x7ef1('0x3f')](_0x1cff0b['query']);_0x2fb6c4[_0x7ef1('0x33')]=_[_0x7ef1('0x2a')](_0x2fb6c4[_0x7ef1('0x2b')],_0x2fb6c4[_0x7ef1('0x2f')]);_0x374bf5[_0x7ef1('0x2c')]=_[_0x7ef1('0x2a')](_0x2fb6c4['model'],qs[_0x7ef1('0x2d')](_0x1cff0b[_0x7ef1('0x2f')][_0x7ef1('0x2d')]));_0x374bf5[_0x7ef1('0x2c')]=_0x374bf5['attributes'][_0x7ef1('0x2e')]?_0x374bf5['attributes']:_0x2fb6c4['model'];if(_0x1cff0b[_0x7ef1('0x2f')]['includeAll']){_0x374bf5[_0x7ef1('0x3a')]=[{'all':!![]}];}_0x374bf5=_['merge']({},_0x374bf5,_0x1cff0b[_0x7ef1('0x38')]);return db[_0x7ef1('0x25')][_0x7ef1('0x40')](_0x374bf5)[_0x7ef1('0x1e')](handleEntityNotFound(_0x3e5ecd,null))[_0x7ef1('0x1e')](respondWithResult(_0x3e5ecd,null))[_0x7ef1('0x3d')](handleError(_0x3e5ecd,null));};exports[_0x7ef1('0x41')]=function(_0x106096,_0x49e089){return db['Cdr'][_0x7ef1('0x41')](_0x106096[_0x7ef1('0x42')],{})['then'](respondWithResult(_0x49e089,0xc9))[_0x7ef1('0x3d')](handleError(_0x49e089,null));};exports[_0x7ef1('0x43')]=function(_0xd06ca9,_0x5ce876){if(_0xd06ca9['body']['id']){delete _0xd06ca9[_0x7ef1('0x42')]['id'];}return db['Cdr']['find']({'where':{'id':_0xd06ca9[_0x7ef1('0x44')]['id']}})[_0x7ef1('0x1e')](handleEntityNotFound(_0x5ce876,null))[_0x7ef1('0x1e')](saveUpdates(_0xd06ca9[_0x7ef1('0x42')],null))[_0x7ef1('0x1e')](respondWithResult(_0x5ce876,null))['catch'](handleError(_0x5ce876,null));};exports[_0x7ef1('0x1f')]=function(_0x4e425b,_0x350dde){return db['Cdr'][_0x7ef1('0x40')]({'where':{'id':_0x4e425b['params']['id']}})['then'](handleEntityNotFound(_0x350dde,null))[_0x7ef1('0x1e')](removeEntity(_0x350dde,null))['catch'](handleError(_0x350dde,null));};exports[_0x7ef1('0x45')]=function(_0x30a4ce,_0x54a0bb){return db[_0x7ef1('0x25')][_0x7ef1('0x45')]()[_0x7ef1('0x1e')](respondWithResult(_0x54a0bb,null))['catch'](handleError(_0x54a0bb,null));}; \ No newline at end of file +var _0x9c5a=['order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','Cdr','rows','catch','params','find','create','body','destroy','describe','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','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x4995f6,_0x35d3d4){var _0x41be8f=function(_0x10bebb){while(--_0x10bebb){_0x4995f6['push'](_0x4995f6['shift']());}};_0x41be8f(++_0x35d3d4);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x739498,_0x502604){_0x739498=_0x739498-0x0;var _0x138b47=_0x9c5a[_0x739498];return _0x138b47;};'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['Cdr'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['map'](_0x4f6e70,_0xa9c5('0x26'));_0x185eb8[_0xa9c5('0x2d')]=_[_0xa9c5('0x2e')](_0x413edf[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2f')]=_[_0xa9c5('0x30')](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8['query']);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x30')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x32')](_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x32')]));_0x198cdf[_0xa9c5('0x31')]=_0x198cdf[_0xa9c5('0x31')]['length']?_0x198cdf['attributes']:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x33')](_0xa9c5('0x34'))){_0x198cdf[_0xa9c5('0x1c')]=qs[_0xa9c5('0x1c')](_0x413edf['query']['limit']);_0x198cdf['offset']=qs[_0xa9c5('0x1e')](_0x413edf[_0xa9c5('0x2d')]['offset']);}_0x198cdf[_0xa9c5('0x35')]=qs['sort'](_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x36')]);_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x2f')](_['pick'](_0x413edf[_0xa9c5('0x2d')],_0x185eb8[_0xa9c5('0x2f')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x38')]){_0x198cdf[_0xa9c5('0x37')]=_[_0xa9c5('0x39')](_0x198cdf[_0xa9c5('0x37')],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x573fc0){if(_0x573fc0[_0xa9c5('0x3a')]!==_0xa9c5('0x3b')){var _0x841c18={};_0x841c18[_0x573fc0[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x38')]+'%'};return _0x841c18;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3c')]);var _0x5b7a0a={'where':_0x198cdf[_0xa9c5('0x37')]};return db['Cdr'][_0xa9c5('0x1d')](_0x5b7a0a)[_0xa9c5('0x24')](function(_0x37fb1b){_0x325c65['count']=_0x37fb1b;if(_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x3d')]){_0x198cdf[_0xa9c5('0x3e')]=[{'all':!![]}];}return db[_0xa9c5('0x3f')]['findAll'](_0x198cdf);})[_0xa9c5('0x24')](function(_0x97803f){_0x325c65[_0xa9c5('0x40')]=_0x97803f;return _0x325c65;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x41')](handleError(_0x32baf9,null));};exports['show']=function(_0x2a1138,_0x566b60){var _0x1de605={'raw':!![],'where':{'id':_0x2a1138[_0xa9c5('0x42')]['id']}},_0x397614={};_0x397614[_0xa9c5('0x2c')]=_[_0xa9c5('0x2e')](db[_0xa9c5('0x3f')][_0xa9c5('0x29')]);_0x397614[_0xa9c5('0x2d')]=_[_0xa9c5('0x2e')](_0x2a1138[_0xa9c5('0x2d')]);_0x397614['filters']=_[_0xa9c5('0x30')](_0x397614[_0xa9c5('0x2c')],_0x397614[_0xa9c5('0x2d')]);_0x1de605[_0xa9c5('0x31')]=_[_0xa9c5('0x30')](_0x397614[_0xa9c5('0x2c')],qs['fields'](_0x2a1138[_0xa9c5('0x2d')][_0xa9c5('0x32')]));_0x1de605['attributes']=_0x1de605['attributes']['length']?_0x1de605['attributes']:_0x397614['model'];if(_0x2a1138[_0xa9c5('0x2d')][_0xa9c5('0x3d')]){_0x1de605[_0xa9c5('0x3e')]=[{'all':!![]}];}_0x1de605=_[_0xa9c5('0x39')]({},_0x1de605,_0x2a1138[_0xa9c5('0x3c')]);return db[_0xa9c5('0x3f')][_0xa9c5('0x43')](_0x1de605)[_0xa9c5('0x24')](handleEntityNotFound(_0x566b60,null))[_0xa9c5('0x24')](respondWithResult(_0x566b60,null))[_0xa9c5('0x41')](handleError(_0x566b60,null));};exports[_0xa9c5('0x44')]=function(_0x2c3dbf,_0x1c2ccf){return db['Cdr'][_0xa9c5('0x44')](_0x2c3dbf['body'],{})[_0xa9c5('0x24')](respondWithResult(_0x1c2ccf,0xc9))[_0xa9c5('0x41')](handleError(_0x1c2ccf,null));};exports['update']=function(_0x5cbd33,_0xf00970){if(_0x5cbd33[_0xa9c5('0x45')]['id']){delete _0x5cbd33[_0xa9c5('0x45')]['id'];}return db['Cdr']['find']({'where':{'id':_0x5cbd33[_0xa9c5('0x42')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0xf00970,null))['then'](saveUpdates(_0x5cbd33[_0xa9c5('0x45')],null))[_0xa9c5('0x24')](respondWithResult(_0xf00970,null))[_0xa9c5('0x41')](handleError(_0xf00970,null));};exports[_0xa9c5('0x46')]=function(_0x34020f,_0xb369da){return db['Cdr']['find']({'where':{'id':_0x34020f['params']['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0xb369da,null))[_0xa9c5('0x24')](removeEntity(_0xb369da,null))[_0xa9c5('0x41')](handleError(_0xb369da,null));};exports[_0xa9c5('0x47')]=function(_0x380266,_0x15d044){return db['Cdr'][_0xa9c5('0x47')]()[_0xa9c5('0x24')](respondWithResult(_0x15d044,null))[_0xa9c5('0x41')](handleError(_0x15d044,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index cb0c520..a174e4d 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(_0x3d200f,_0x38ec4a){var _0x42c02a=function(_0x19ded2){while(--_0x19ded2){_0x3d200f['push'](_0x3d200f['shift']());}};_0x42c02a(++_0x38ec4a);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x55c1be,_0x5b4b3e){var _0x1f1114=function(_0x362456){while(--_0x362456){_0x55c1be['push'](_0x55c1be['shift']());}};_0x1f1114(++_0x5b4b3e);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ff7679d..e2a22b9 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 _0x85a0=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x85a0,0x8f));var _0x085a=function(_0x4530be,_0x67f622){_0x4530be=_0x4530be-0x0;var _0x27509e=_0x85a0[_0x4530be];return _0x27509e;};'use strict';var _=require(_0x085a('0x0'));var util=require(_0x085a('0x1'));var moment=require('moment');var BPromise=require(_0x085a('0x2'));var rs=require(_0x085a('0x3'));var fs=require('fs');var Redis=require(_0x085a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x085a('0x5'));var logger=require(_0x085a('0x6'))('rpc');var config=require(_0x085a('0x7'));var jayson=require(_0x085a('0x8'));var client=jayson[_0x085a('0x9')][_0x085a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x687ffb,_0x17bba1,_0x2e920d){return new BPromise(function(_0x59d0bd,_0x2773f1){return client[_0x085a('0xb')](_0x687ffb,_0x2e920d)[_0x085a('0xc')](function(_0x4dc204){logger[_0x085a('0xd')](_0x085a('0xe'),_0x17bba1,_0x085a('0xf'));logger[_0x085a('0x10')](_0x085a('0x11'),_0x17bba1,_0x085a('0xf'),JSON[_0x085a('0x12')](_0x4dc204));if(_0x4dc204[_0x085a('0x13')]){if(_0x4dc204[_0x085a('0x13')][_0x085a('0x14')]===0x1f4){logger[_0x085a('0x13')](_0x085a('0xe'),_0x17bba1,_0x4dc204[_0x085a('0x13')][_0x085a('0x15')]);return _0x2773f1(_0x4dc204[_0x085a('0x13')][_0x085a('0x15')]);}logger[_0x085a('0x13')]('Cdr,\x20%s,\x20%s',_0x17bba1,_0x4dc204[_0x085a('0x13')][_0x085a('0x15')]);return _0x59d0bd(_0x4dc204[_0x085a('0x13')][_0x085a('0x15')]);}else{logger['info'](_0x085a('0xe'),_0x17bba1,_0x085a('0xf'));_0x59d0bd(_0x4dc204['result'][_0x085a('0x15')]);}})[_0x085a('0x16')](function(_0x303638){logger[_0x085a('0x13')]('Cdr,\x20%s,\x20%s',_0x17bba1,_0x303638);_0x2773f1(_0x303638);});});} \ No newline at end of file +var _0x7753=['../../config/utils','rpc','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7753,0xed));var _0x3775=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0x7753[_0x45ae0d];return _0x371826;};'use strict';var _=require(_0x3775('0x0'));var util=require(_0x3775('0x1'));var moment=require(_0x3775('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3775('0x3'));var db=require(_0x3775('0x4'))['db'];var utils=require(_0x3775('0x5'));var logger=require('../../config/logger')(_0x3775('0x6'));var config=require('../../config/environment');var jayson=require(_0x3775('0x7'));var client=jayson[_0x3775('0x8')][_0x3775('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45ed24,_0x1fcaca,_0x4c88a4){return new BPromise(function(_0x48d7db,_0x4b5299){return client[_0x3775('0xa')](_0x45ed24,_0x4c88a4)[_0x3775('0xb')](function(_0x727d63){logger['info'](_0x3775('0xc'),_0x1fcaca,_0x3775('0xd'));logger[_0x3775('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x1fcaca,_0x3775('0xd'),JSON[_0x3775('0xf')](_0x727d63));if(_0x727d63[_0x3775('0x10')]){if(_0x727d63[_0x3775('0x10')][_0x3775('0x11')]===0x1f4){logger[_0x3775('0x10')](_0x3775('0xc'),_0x1fcaca,_0x727d63[_0x3775('0x10')][_0x3775('0x12')]);return _0x4b5299(_0x727d63[_0x3775('0x10')][_0x3775('0x12')]);}logger['error'](_0x3775('0xc'),_0x1fcaca,_0x727d63[_0x3775('0x10')][_0x3775('0x12')]);return _0x48d7db(_0x727d63[_0x3775('0x10')][_0x3775('0x12')]);}else{logger[_0x3775('0x13')]('Cdr,\x20%s,\x20%s',_0x1fcaca,_0x3775('0xd'));_0x48d7db(_0x727d63[_0x3775('0x14')][_0x3775('0x12')]);}})[_0x3775('0x15')](function(_0x4b21bf){logger[_0x3775('0x10')]('Cdr,\x20%s,\x20%s',_0x1fcaca,_0x4b21bf);_0x4b5299(_0x4b21bf);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c17507d..0d86b8c 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2c98f5,_0x3505bd){var _0x1d5794=function(_0x4b511b){while(--_0x4b511b){_0x2c98f5['push'](_0x2c98f5['shift']());}};_0x1d5794(++_0x3505bd);}(_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('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a8b93ef..151ce2f 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 _0x226f=['noop','TEXT','exports','INTEGER','STRING'];(function(_0x4b6a43,_0x5a2620){var _0x58527a=function(_0x369a22){while(--_0x369a22){_0x4b6a43['push'](_0x4b6a43['shift']());}};_0x58527a(++_0x5a2620);}(_0x226f,0x66));var _0xf226=function(_0x5431f0,_0x580383){_0x5431f0=_0x5431f0-0x0;var _0x1166b8=_0x226f[_0x5431f0];return _0x1166b8;};'use strict';var Sequelize=require('sequelize');module[_0xf226('0x0')]={'priority':{'type':Sequelize[_0xf226('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf226('0x2')],'allowNull':![],'defaultValue':_0xf226('0x3')},'appdata':{'type':Sequelize[_0xf226('0x4')]()},'description':{'type':Sequelize[_0xf226('0x2')]},'interval':{'type':Sequelize[_0xf226('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x96ff=['INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x14640e,_0xb8aebd){var _0x58ff10=function(_0x535148){while(--_0x535148){_0x14640e['push'](_0x14640e['shift']());}};_0x58ff10(++_0xb8aebd);}(_0x96ff,0xd8));var _0xf96f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x96ff[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xf96f('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf96f('0x1')]()},'description':{'type':Sequelize[_0xf96f('0x2')]},'interval':{'type':Sequelize[_0xf96f('0x2')],'defaultValue':_0xf96f('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5574bdd..e0c2fb6 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 _0x6170=['Content-Range','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0x6170,0x17d));var _0x0617=function(_0x1542de,_0x515aaf){_0x1542de=_0x1542de-0x0;var _0x567a16=_0x6170[_0x1542de];return _0x567a16;};'use strict';var emlformat=require(_0x0617('0x0'));var rimraf=require(_0x0617('0x1'));var zipdir=require(_0x0617('0x2'));var jsonpatch=require(_0x0617('0x3'));var rp=require('request-promise');var moment=require(_0x0617('0x4'));var BPromise=require(_0x0617('0x5'));var Mustache=require(_0x0617('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0617('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0617('0x8'));var _=require(_0x0617('0x9'));var squel=require(_0x0617('0xa'));var crypto=require(_0x0617('0xb'));var jsforce=require(_0x0617('0xc'));var deskjs=require(_0x0617('0xd'));var toCsv=require(_0x0617('0x7'));var querystring=require(_0x0617('0xe'));var Papa=require(_0x0617('0xf'));var Redis=require(_0x0617('0x10'));var authService=require(_0x0617('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0617('0x12'));var hardwareService=require(_0x0617('0x13'));var logger=require(_0x0617('0x14'))('api');var utils=require(_0x0617('0x15'));var config=require(_0x0617('0x16'));var licenseUtil=require(_0x0617('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf05fec,_0x3235d9){_0x3235d9=_0x3235d9||0xcc;return function(_0x39436e){if(_0x39436e){return _0xf05fec[_0x0617('0x18')](_0x3235d9);}return _0xf05fec[_0x0617('0x19')](_0x3235d9)[_0x0617('0x1a')]();};}function respondWithResult(_0x9229fc,_0x530072){_0x530072=_0x530072||0xc8;return function(_0x221fb4){if(_0x221fb4){return _0x9229fc['status'](_0x530072)['json'](_0x221fb4);}};}function respondWithFilteredResult(_0x1825b5,_0x16e870){return function(_0x188b26){if(_0x188b26){var _0x8de1e2=typeof _0x16e870[_0x0617('0x1b')]==='undefined'&&typeof _0x16e870['limit']===_0x0617('0x1c');var _0x368cb7=_0x188b26[_0x0617('0x1d')];var _0x3177d3=_0x8de1e2?0x0:_0x16e870[_0x0617('0x1b')];var _0x186655=_0x8de1e2?_0x188b26[_0x0617('0x1d')]:_0x16e870[_0x0617('0x1b')]+_0x16e870[_0x0617('0x1e')];var _0x5605be;if(_0x186655>=_0x368cb7){_0x186655=_0x368cb7;_0x5605be=0xc8;}else{_0x5605be=0xce;}_0x1825b5[_0x0617('0x19')](_0x5605be);return _0x1825b5[_0x0617('0x1f')](_0x0617('0x20'),_0x3177d3+'-'+_0x186655+'/'+_0x368cb7)['json'](_0x188b26);}return null;};}function patchUpdates(_0x1c1e6f){return function(_0x2c1c79){try{jsonpatch['apply'](_0x2c1c79,_0x1c1e6f,!![]);}catch(_0xd33c73){return BPromise[_0x0617('0x21')](_0xd33c73);}return _0x2c1c79['save']();};}function saveUpdates(_0x212191,_0x32e10a){return function(_0x552594){if(_0x552594){return _0x552594[_0x0617('0x22')](_0x212191)[_0x0617('0x23')](function(_0x1cb0bb){return _0x1cb0bb;});}return null;};}function removeEntity(_0x475aaf,_0x5a3ad8){return function(_0x5989b8){if(_0x5989b8){return _0x5989b8[_0x0617('0x24')]()[_0x0617('0x23')](function(){_0x475aaf['status'](0xcc)[_0x0617('0x1a')]();});}};}function handleEntityNotFound(_0x40df17,_0x5bc350){return function(_0x36ac08){if(!_0x36ac08){_0x40df17['sendStatus'](0x194);}return _0x36ac08;};}function handleError(_0x2c0148,_0x45f00d){_0x45f00d=_0x45f00d||0x1f4;return function(_0xaba0f8){logger[_0x0617('0x25')](_0xaba0f8[_0x0617('0x26')]);if(_0xaba0f8[_0x0617('0x27')]){delete _0xaba0f8[_0x0617('0x27')];}_0x2c0148[_0x0617('0x19')](_0x45f00d)[_0x0617('0x28')](_0xaba0f8);};}exports[_0x0617('0x29')]=function(_0x5204e0,_0x2c92c6){var _0x242417={'raw':!![],'where':{'id':_0x5204e0[_0x0617('0x2a')]['id']}},_0x1ff68e={};_0x1ff68e[_0x0617('0x2b')]=_[_0x0617('0x2c')](db['ChatApplication'][_0x0617('0x2d')]);_0x1ff68e[_0x0617('0x2e')]=_['keys'](_0x5204e0['query']);_0x1ff68e[_0x0617('0x2f')]=_[_0x0617('0x30')](_0x1ff68e[_0x0617('0x2b')],_0x1ff68e[_0x0617('0x2e')]);_0x242417['attributes']=_['intersection'](_0x1ff68e['model'],qs[_0x0617('0x31')](_0x5204e0[_0x0617('0x2e')][_0x0617('0x31')]));_0x242417[_0x0617('0x32')]=_0x242417[_0x0617('0x32')][_0x0617('0x33')]?_0x242417['attributes']:_0x1ff68e[_0x0617('0x2b')];if(_0x5204e0[_0x0617('0x2e')][_0x0617('0x34')]){_0x242417[_0x0617('0x35')]=[{'all':!![]}];}_0x242417=_[_0x0617('0x36')]({},_0x242417,_0x5204e0['options']);return db[_0x0617('0x37')][_0x0617('0x38')](_0x242417)['then'](handleEntityNotFound(_0x2c92c6,null))[_0x0617('0x23')](respondWithResult(_0x2c92c6,null))[_0x0617('0x39')](handleError(_0x2c92c6,null));};exports[_0x0617('0x22')]=function(_0x400fc6,_0x103a4d){if(_0x400fc6[_0x0617('0x3a')]['id']){delete _0x400fc6['body']['id'];}return db['ChatApplication'][_0x0617('0x38')]({'where':{'id':_0x400fc6[_0x0617('0x2a')]['id']}})[_0x0617('0x23')](handleEntityNotFound(_0x103a4d,null))['then'](saveUpdates(_0x400fc6[_0x0617('0x3a')],null))[_0x0617('0x23')](respondWithResult(_0x103a4d,null))['catch'](handleError(_0x103a4d,null));};exports['destroy']=function(_0x1cfd47,_0xf7562){return db[_0x0617('0x37')]['find']({'where':{'id':_0x1cfd47[_0x0617('0x2a')]['id']}})['then'](handleEntityNotFound(_0xf7562,null))[_0x0617('0x23')](removeEntity(_0xf7562,null))[_0x0617('0x39')](handleError(_0xf7562,null));}; \ No newline at end of file +var _0x78f0=['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','count','limit','set','apply','reject','save','update','then','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x3b5112,_0x5ee333){var _0x3c2895=function(_0x460a16){while(--_0x460a16){_0x3b5112['push'](_0x3b5112['shift']());}};_0x3c2895(++_0x5ee333);}(_0x78f0,0x15d));var _0x078f=function(_0x153fea,_0x1bc774){_0x153fea=_0x153fea-0x0;var _0x4ced58=_0x78f0[_0x153fea];return _0x4ced58;};'use strict';var emlformat=require(_0x078f('0x0'));var rimraf=require(_0x078f('0x1'));var zipdir=require(_0x078f('0x2'));var jsonpatch=require(_0x078f('0x3'));var rp=require(_0x078f('0x4'));var moment=require(_0x078f('0x5'));var BPromise=require(_0x078f('0x6'));var Mustache=require(_0x078f('0x7'));var util=require('util');var path=require(_0x078f('0x8'));var sox=require(_0x078f('0x9'));var csv=require(_0x078f('0xa'));var ejs=require(_0x078f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x078f('0xc'));var squel=require(_0x078f('0xd'));var crypto=require('crypto');var jsforce=require(_0x078f('0xe'));var deskjs=require(_0x078f('0xf'));var toCsv=require(_0x078f('0xa'));var querystring=require(_0x078f('0x10'));var Papa=require(_0x078f('0x11'));var Redis=require(_0x078f('0x12'));var authService=require(_0x078f('0x13'));var qs=require(_0x078f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x078f('0x15'));var logger=require(_0x078f('0x16'))('api');var utils=require(_0x078f('0x17'));var config=require(_0x078f('0x18'));var licenseUtil=require(_0x078f('0x19'));var db=require(_0x078f('0x1a'))['db'];function respondWithStatusCode(_0x5b6b5a,_0x5de876){_0x5de876=_0x5de876||0xcc;return function(_0xe740c0){if(_0xe740c0){return _0x5b6b5a[_0x078f('0x1b')](_0x5de876);}return _0x5b6b5a[_0x078f('0x1c')](_0x5de876)[_0x078f('0x1d')]();};}function respondWithResult(_0x5df646,_0x36670d){_0x36670d=_0x36670d||0xc8;return function(_0x2d29f8){if(_0x2d29f8){return _0x5df646['status'](_0x36670d)[_0x078f('0x1e')](_0x2d29f8);}};}function respondWithFilteredResult(_0x1a44f1,_0x21fc72){return function(_0x363dfd){if(_0x363dfd){var _0x247de9=typeof _0x21fc72[_0x078f('0x1f')]==='undefined'&&typeof _0x21fc72['limit']===_0x078f('0x20');var _0x1e32c0=_0x363dfd[_0x078f('0x21')];var _0x19a182=_0x247de9?0x0:_0x21fc72[_0x078f('0x1f')];var _0x25bb2d=_0x247de9?_0x363dfd[_0x078f('0x21')]:_0x21fc72[_0x078f('0x1f')]+_0x21fc72[_0x078f('0x22')];var _0x276442;if(_0x25bb2d>=_0x1e32c0){_0x25bb2d=_0x1e32c0;_0x276442=0xc8;}else{_0x276442=0xce;}_0x1a44f1[_0x078f('0x1c')](_0x276442);return _0x1a44f1[_0x078f('0x23')]('Content-Range',_0x19a182+'-'+_0x25bb2d+'/'+_0x1e32c0)[_0x078f('0x1e')](_0x363dfd);}return null;};}function patchUpdates(_0x52c74f){return function(_0x567d26){try{jsonpatch[_0x078f('0x24')](_0x567d26,_0x52c74f,!![]);}catch(_0x3c70c2){return BPromise[_0x078f('0x25')](_0x3c70c2);}return _0x567d26[_0x078f('0x26')]();};}function saveUpdates(_0x712d52,_0x2c6db4){return function(_0x104eeb){if(_0x104eeb){return _0x104eeb[_0x078f('0x27')](_0x712d52)[_0x078f('0x28')](function(_0x4b8d12){return _0x4b8d12;});}return null;};}function removeEntity(_0x1f6b98,_0x14ad5c){return function(_0x363cce){if(_0x363cce){return _0x363cce['destroy']()['then'](function(){_0x1f6b98[_0x078f('0x1c')](0xcc)[_0x078f('0x1d')]();});}};}function handleEntityNotFound(_0x3d9d08,_0x240fb4){return function(_0x25fe4f){if(!_0x25fe4f){_0x3d9d08[_0x078f('0x1b')](0x194);}return _0x25fe4f;};}function handleError(_0x186fe3,_0x4e738b){_0x4e738b=_0x4e738b||0x1f4;return function(_0x1f6596){logger[_0x078f('0x29')](_0x1f6596['stack']);if(_0x1f6596[_0x078f('0x2a')]){delete _0x1f6596[_0x078f('0x2a')];}_0x186fe3[_0x078f('0x1c')](_0x4e738b)[_0x078f('0x2b')](_0x1f6596);};}exports[_0x078f('0x2c')]=function(_0xd57307,_0x1a8530){var _0xe41e2e={'raw':!![],'where':{'id':_0xd57307[_0x078f('0x2d')]['id']}},_0x1f0ad6={};_0x1f0ad6[_0x078f('0x2e')]=_[_0x078f('0x2f')](db[_0x078f('0x30')][_0x078f('0x31')]);_0x1f0ad6[_0x078f('0x32')]=_[_0x078f('0x2f')](_0xd57307[_0x078f('0x32')]);_0x1f0ad6[_0x078f('0x33')]=_['intersection'](_0x1f0ad6[_0x078f('0x2e')],_0x1f0ad6['query']);_0xe41e2e['attributes']=_[_0x078f('0x34')](_0x1f0ad6[_0x078f('0x2e')],qs[_0x078f('0x35')](_0xd57307[_0x078f('0x32')]['fields']));_0xe41e2e[_0x078f('0x36')]=_0xe41e2e[_0x078f('0x36')][_0x078f('0x37')]?_0xe41e2e[_0x078f('0x36')]:_0x1f0ad6[_0x078f('0x2e')];if(_0xd57307['query'][_0x078f('0x38')]){_0xe41e2e[_0x078f('0x39')]=[{'all':!![]}];}_0xe41e2e=_['merge']({},_0xe41e2e,_0xd57307['options']);return db[_0x078f('0x30')][_0x078f('0x3a')](_0xe41e2e)['then'](handleEntityNotFound(_0x1a8530,null))[_0x078f('0x28')](respondWithResult(_0x1a8530,null))[_0x078f('0x3b')](handleError(_0x1a8530,null));};exports[_0x078f('0x27')]=function(_0x5165e4,_0x2dfad1){if(_0x5165e4[_0x078f('0x3c')]['id']){delete _0x5165e4[_0x078f('0x3c')]['id'];}return db[_0x078f('0x30')][_0x078f('0x3a')]({'where':{'id':_0x5165e4[_0x078f('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2dfad1,null))[_0x078f('0x28')](saveUpdates(_0x5165e4[_0x078f('0x3c')],null))[_0x078f('0x28')](respondWithResult(_0x2dfad1,null))[_0x078f('0x3b')](handleError(_0x2dfad1,null));};exports['destroy']=function(_0x474a46,_0x2b1e0f){return db[_0x078f('0x30')][_0x078f('0x3a')]({'where':{'id':_0x474a46[_0x078f('0x2d')]['id']}})[_0x078f('0x28')](handleEntityNotFound(_0x2b1e0f,null))[_0x078f('0x28')](removeEntity(_0x2b1e0f,null))[_0x078f('0x3b')](handleError(_0x2b1e0f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index dd37cbb..dcb53eb 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 _0x0a6d=['../../config/environment','./chatApplication.attributes','exports','chat_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x4040a4,_0xf979fc){var _0x3241e4=function(_0x239b9b){while(--_0x239b9b){_0x4040a4['push'](_0x4040a4['shift']());}};_0x3241e4(++_0xf979fc);}(_0x0a6d,0xd1));var _0xd0a6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0a6d[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd0a6('0x0'));var util=require(_0xd0a6('0x1'));var logger=require('../../config/logger')(_0xd0a6('0x2'));var moment=require(_0xd0a6('0x3'));var BPromise=require(_0xd0a6('0x4'));var rp=require(_0xd0a6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0a6('0x6'));var config=require(_0xd0a6('0x7'));var attributes=require(_0xd0a6('0x8'));module[_0xd0a6('0x9')]=function(_0x1f22f0,_0x58d7cb){return _0x1f22f0['define']('ChatApplication',attributes,{'tableName':_0xd0a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd0a6('0xb')});}; \ No newline at end of file +var _0x9bee=['exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x1d326d,_0x55777d){var _0xf07c2f=function(_0x5b9610){while(--_0x5b9610){_0x1d326d['push'](_0x1d326d['shift']());}};_0xf07c2f(++_0x55777d);}(_0x9bee,0xf4));var _0xe9be=function(_0x4c14f6,_0x4cd149){_0x4c14f6=_0x4c14f6-0x0;var _0x318258=_0x9bee[_0x4c14f6];return _0x318258;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe9be('0x0'))(_0xe9be('0x1'));var moment=require('moment');var BPromise=require(_0xe9be('0x2'));var rp=require(_0xe9be('0x3'));var fs=require('fs');var path=require(_0xe9be('0x4'));var rimraf=require(_0xe9be('0x5'));var config=require(_0xe9be('0x6'));var attributes=require(_0xe9be('0x7'));module[_0xe9be('0x8')]=function(_0x1d5c7a,_0x5bbaad){return _0x1d5c7a[_0xe9be('0x9')](_0xe9be('0xa'),attributes,{'tableName':_0xe9be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe9be('0xc'),'collate':_0xe9be('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f5d6f06..84088f4 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 _0x848a=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x19b969,_0x2589bc){var _0x4ae3ff=function(_0x11c462){while(--_0x11c462){_0x19b969['push'](_0x19b969['shift']());}};_0x4ae3ff(++_0x2589bc);}(_0x848a,0xa1));var _0xa848=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0x848a[_0x215e65];return _0xa85842;};'use strict';var _=require('lodash');var util=require(_0xa848('0x0'));var moment=require(_0xa848('0x1'));var BPromise=require(_0xa848('0x2'));var rs=require(_0xa848('0x3'));var fs=require('fs');var Redis=require(_0xa848('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa848('0x5'));var logger=require('../../config/logger')(_0xa848('0x6'));var config=require('../../config/environment');var jayson=require(_0xa848('0x7'));var client=jayson['client'][_0xa848('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40bf14,_0x43a4b1,_0x40834a){return new BPromise(function(_0x29fee6,_0x3b9b39){return client[_0xa848('0x9')](_0x40bf14,_0x40834a)[_0xa848('0xa')](function(_0x44ca51){logger[_0xa848('0xb')](_0xa848('0xc'),_0x43a4b1,_0xa848('0xd'));logger['debug'](_0xa848('0xe'),_0x43a4b1,_0xa848('0xd'),JSON['stringify'](_0x44ca51));if(_0x44ca51[_0xa848('0xf')]){if(_0x44ca51[_0xa848('0xf')][_0xa848('0x10')]===0x1f4){logger[_0xa848('0xf')]('ChatApplication,\x20%s,\x20%s',_0x43a4b1,_0x44ca51[_0xa848('0xf')]['message']);return _0x3b9b39(_0x44ca51[_0xa848('0xf')][_0xa848('0x11')]);}logger[_0xa848('0xf')](_0xa848('0xc'),_0x43a4b1,_0x44ca51[_0xa848('0xf')]['message']);return _0x29fee6(_0x44ca51[_0xa848('0xf')][_0xa848('0x11')]);}else{logger[_0xa848('0xb')](_0xa848('0xc'),_0x43a4b1,'request\x20sent');_0x29fee6(_0x44ca51[_0xa848('0x12')]['message']);}})[_0xa848('0x13')](function(_0x5802e0){logger[_0xa848('0xf')](_0xa848('0xc'),_0x43a4b1,_0x5802e0);_0x3b9b39(_0x5802e0);});});} \ No newline at end of file +var _0x211b=['error','code','message','result','catch','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c364b,_0x15698c){var _0x41d1c3=function(_0x5db8d9){while(--_0x5db8d9){_0x4c364b['push'](_0x4c364b['shift']());}};_0x41d1c3(++_0x15698c);}(_0x211b,0x8d));var _0xb211=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x211b[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xb211('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb211('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb211('0x2'));var logger=require(_0xb211('0x3'))(_0xb211('0x4'));var config=require(_0xb211('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb211('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xc287c2,_0x1191f1,_0xeb65ff){return new BPromise(function(_0xb2ebde,_0x287502){return client[_0xb211('0x7')](_0xc287c2,_0xeb65ff)['then'](function(_0x29e355){logger[_0xb211('0x8')](_0xb211('0x9'),_0x1191f1,_0xb211('0xa'));logger[_0xb211('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x1191f1,_0xb211('0xa'),JSON['stringify'](_0x29e355));if(_0x29e355[_0xb211('0xc')]){if(_0x29e355['error'][_0xb211('0xd')]===0x1f4){logger[_0xb211('0xc')]('ChatApplication,\x20%s,\x20%s',_0x1191f1,_0x29e355[_0xb211('0xc')][_0xb211('0xe')]);return _0x287502(_0x29e355['error'][_0xb211('0xe')]);}logger[_0xb211('0xc')](_0xb211('0x9'),_0x1191f1,_0x29e355[_0xb211('0xc')][_0xb211('0xe')]);return _0xb2ebde(_0x29e355[_0xb211('0xc')][_0xb211('0xe')]);}else{logger[_0xb211('0x8')](_0xb211('0x9'),_0x1191f1,_0xb211('0xa'));_0xb2ebde(_0x29e355[_0xb211('0xf')][_0xb211('0xe')]);}})[_0xb211('0x10')](function(_0x3d6b76){logger[_0xb211('0xc')](_0xb211('0x9'),_0x1191f1,_0x3d6b76);_0x287502(_0x3d6b76);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index be9e6ac..6ede6ec 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 _0xbf94=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated','show','put','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x17b48a,_0x567f4e){var _0x55d811=function(_0x3fb4ba){while(--_0x3fb4ba){_0x17b48a['push'](_0x17b48a['shift']());}};_0x55d811(++_0x567f4e);}(_0xbf94,0x91));var _0x4bf9=function(_0x4816c5,_0x3be3b2){_0x4816c5=_0x4816c5-0x0;var _0x3a89ca=_0xbf94[_0x4816c5];return _0x3a89ca;};'use strict';var multer=require(_0x4bf9('0x0'));var util=require(_0x4bf9('0x1'));var path=require(_0x4bf9('0x2'));var timeout=require(_0x4bf9('0x3'));var express=require('express');var router=express[_0x4bf9('0x4')]();var fs_extra=require(_0x4bf9('0x5'));var auth=require(_0x4bf9('0x6'));var interaction=require(_0x4bf9('0x7'));var config=require('../../config/environment');var controller=require(_0x4bf9('0x8'));router['get'](_0x4bf9('0x9'),auth[_0x4bf9('0xa')](),controller[_0x4bf9('0xb')]);router[_0x4bf9('0xc')](_0x4bf9('0x9'),auth[_0x4bf9('0xa')](),controller[_0x4bf9('0xd')]);router['delete']('/:id',auth[_0x4bf9('0xa')](),controller['destroy']);module[_0x4bf9('0xe')]=router; \ No newline at end of file +var _0x64aa=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','show','put','update','delete'];(function(_0x1692fb,_0x192cf0){var _0x2381e2=function(_0x14d295){while(--_0x14d295){_0x1692fb['push'](_0x1692fb['shift']());}};_0x2381e2(++_0x192cf0);}(_0x64aa,0x10f));var _0xa64a=function(_0x1dc337,_0x163446){_0x1dc337=_0x1dc337-0x0;var _0x2c4d04=_0x64aa[_0x1dc337];return _0x2c4d04;};'use strict';var multer=require(_0xa64a('0x0'));var util=require(_0xa64a('0x1'));var path=require(_0xa64a('0x2'));var timeout=require(_0xa64a('0x3'));var express=require('express');var router=express[_0xa64a('0x4')]();var fs_extra=require(_0xa64a('0x5'));var auth=require(_0xa64a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa64a('0x7'));var controller=require('./chatApplication.controller');router['get'](_0xa64a('0x8'),auth[_0xa64a('0x9')](),controller[_0xa64a('0xa')]);router[_0xa64a('0xb')](_0xa64a('0x8'),auth[_0xa64a('0x9')](),controller[_0xa64a('0xc')]);router[_0xa64a('0xd')](_0xa64a('0x8'),auth['isAuthenticated'](),controller[_0xa64a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d3f271e..5ae7293 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 _0x1842=['exports','STRING','BOOLEAN','sequelize'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x1842,0xab));var _0x2184=function(_0x53f197,_0x10265a){_0x53f197=_0x53f197-0x0;var _0x299ab4=_0x1842[_0x53f197];return _0x299ab4;};'use strict';var Sequelize=require(_0x2184('0x0'));module[_0x2184('0x1')]={'name':{'type':Sequelize[_0x2184('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2184('0x2')]},'write':{'type':Sequelize[_0x2184('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd087=['exports','STRING','BOOLEAN','sequelize'];(function(_0x26a82d,_0x1366be){var _0x34b41f=function(_0x5f48e0){while(--_0x5f48e0){_0x26a82d['push'](_0x26a82d['shift']());}};_0x34b41f(++_0x1366be);}(_0xd087,0x6f));var _0x7d08=function(_0xdb4955,_0x145b00){_0xdb4955=_0xdb4955-0x0;var _0x39daf9=_0xd087[_0xdb4955];return _0x39daf9;};'use strict';var Sequelize=require(_0x7d08('0x0'));module[_0x7d08('0x1')]={'name':{'type':Sequelize[_0x7d08('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x7d08('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 55a773e..86bb1f1 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 _0xcaf8=['omit','ids','findOne','User','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','keys','intersection','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers'];(function(_0x4fe56b,_0x53d094){var _0x238f05=function(_0x381c45){while(--_0x381c45){_0x4fe56b['push'](_0x4fe56b['shift']());}};_0x238f05(++_0x53d094);}(_0xcaf8,0xd1));var _0x8caf=function(_0x12fe0e,_0x2cab83){_0x12fe0e=_0x12fe0e-0x0;var _0x21f7fd=_0xcaf8[_0x12fe0e];return _0x21f7fd;};'use strict';var emlformat=require(_0x8caf('0x0'));var rimraf=require(_0x8caf('0x1'));var zipdir=require(_0x8caf('0x2'));var jsonpatch=require(_0x8caf('0x3'));var rp=require('request-promise');var moment=require(_0x8caf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8caf('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8caf('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8caf('0x7'));var _=require(_0x8caf('0x8'));var squel=require(_0x8caf('0x9'));var crypto=require(_0x8caf('0xa'));var jsforce=require(_0x8caf('0xb'));var deskjs=require(_0x8caf('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8caf('0xd'));var Redis=require(_0x8caf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8caf('0xf'));var as=require(_0x8caf('0x10'));var hardwareService=require(_0x8caf('0x11'));var logger=require(_0x8caf('0x12'))(_0x8caf('0x13'));var utils=require('../../config/utils');var config=require(_0x8caf('0x14'));var licenseUtil=require(_0x8caf('0x15'));var db=require(_0x8caf('0x16'))['db'];config[_0x8caf('0x17')]=_[_0x8caf('0x18')](config[_0x8caf('0x17')],{'host':_0x8caf('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8caf('0x1a'))['register'](socket);function respondWithStatusCode(_0x494aff,_0x4b0431){_0x4b0431=_0x4b0431||0xcc;return function(_0x4a00cb){if(_0x4a00cb){return _0x494aff[_0x8caf('0x1b')](_0x4b0431);}return _0x494aff[_0x8caf('0x1c')](_0x4b0431)[_0x8caf('0x1d')]();};}function respondWithResult(_0x237361,_0x2091d2){_0x2091d2=_0x2091d2||0xc8;return function(_0x51a94d){if(_0x51a94d){return _0x237361[_0x8caf('0x1c')](_0x2091d2)[_0x8caf('0x1e')](_0x51a94d);}};}function respondWithFilteredResult(_0x1a61da,_0x100a60){return function(_0x1a190d){if(_0x1a190d){var _0x2f2ad9=typeof _0x100a60[_0x8caf('0x1f')]==='undefined'&&typeof _0x100a60[_0x8caf('0x20')]===_0x8caf('0x21');var _0x58eee0=_0x1a190d[_0x8caf('0x22')];var _0x2d014f=_0x2f2ad9?0x0:_0x100a60[_0x8caf('0x1f')];var _0x435ffe=_0x2f2ad9?_0x1a190d[_0x8caf('0x22')]:_0x100a60['offset']+_0x100a60['limit'];var _0x244be2;if(_0x435ffe>=_0x58eee0){_0x435ffe=_0x58eee0;_0x244be2=0xc8;}else{_0x244be2=0xce;}_0x1a61da[_0x8caf('0x1c')](_0x244be2);return _0x1a61da[_0x8caf('0x23')](_0x8caf('0x24'),_0x2d014f+'-'+_0x435ffe+'/'+_0x58eee0)[_0x8caf('0x1e')](_0x1a190d);}return null;};}function patchUpdates(_0x4a9e7c){return function(_0xb86750){try{jsonpatch[_0x8caf('0x25')](_0xb86750,_0x4a9e7c,!![]);}catch(_0x410f3e){return BPromise[_0x8caf('0x26')](_0x410f3e);}return _0xb86750[_0x8caf('0x27')]();};}function saveUpdates(_0x166db7,_0x830785){return function(_0x320b3f){if(_0x320b3f){return _0x320b3f[_0x8caf('0x28')](_0x166db7)[_0x8caf('0x29')](function(_0xc30ccf){return _0xc30ccf;});}return null;};}function removeEntity(_0x1c05b2,_0x3c3a67){return function(_0xa3f312){if(_0xa3f312){return _0xa3f312[_0x8caf('0x2a')]()[_0x8caf('0x29')](function(){_0x1c05b2[_0x8caf('0x1c')](0xcc)[_0x8caf('0x1d')]();});}};}function handleEntityNotFound(_0x5b1484,_0x719ddf){return function(_0x39cec4){if(!_0x39cec4){_0x5b1484[_0x8caf('0x1b')](0x194);}return _0x39cec4;};}function handleError(_0x2046e6,_0x2160f3){_0x2160f3=_0x2160f3||0x1f4;return function(_0x27d7e5){logger[_0x8caf('0x2b')](_0x27d7e5[_0x8caf('0x2c')]);if(_0x27d7e5['name']){delete _0x27d7e5[_0x8caf('0x2d')];}_0x2046e6[_0x8caf('0x1c')](_0x2160f3)[_0x8caf('0x2e')](_0x27d7e5);};}exports[_0x8caf('0x2f')]=function(_0x36bae5,_0x35fa52){var _0x486368={},_0x2b69be={},_0x45a61a={'count':0x0,'rows':[]};var _0x58575e=_[_0x8caf('0x30')](db[_0x8caf('0x31')][_0x8caf('0x32')],function(_0x525c90){return{'name':_0x525c90[_0x8caf('0x33')],'type':_0x525c90['type'][_0x8caf('0x34')]};});_0x2b69be[_0x8caf('0x35')]=_[_0x8caf('0x30')](_0x58575e,_0x8caf('0x2d'));_0x2b69be[_0x8caf('0x36')]=_['keys'](_0x36bae5[_0x8caf('0x36')]);_0x2b69be[_0x8caf('0x37')]=_['intersection'](_0x2b69be[_0x8caf('0x35')],_0x2b69be[_0x8caf('0x36')]);_0x486368[_0x8caf('0x38')]=_['intersection'](_0x2b69be[_0x8caf('0x35')],qs['fields'](_0x36bae5[_0x8caf('0x36')][_0x8caf('0x39')]));_0x486368['attributes']=_0x486368[_0x8caf('0x38')][_0x8caf('0x3a')]?_0x486368['attributes']:_0x2b69be[_0x8caf('0x35')];if(!_0x36bae5[_0x8caf('0x36')]['hasOwnProperty'](_0x8caf('0x3b'))){_0x486368['limit']=qs[_0x8caf('0x20')](_0x36bae5['query'][_0x8caf('0x20')]);_0x486368[_0x8caf('0x1f')]=qs['offset'](_0x36bae5[_0x8caf('0x36')][_0x8caf('0x1f')]);}_0x486368[_0x8caf('0x3c')]=qs[_0x8caf('0x3d')](_0x36bae5[_0x8caf('0x36')]['sort']);_0x486368[_0x8caf('0x3e')]=qs[_0x8caf('0x37')](_[_0x8caf('0x3f')](_0x36bae5[_0x8caf('0x36')],_0x2b69be[_0x8caf('0x37')]),_0x58575e);if(_0x36bae5[_0x8caf('0x36')]['filter']){_0x486368[_0x8caf('0x3e')]=_[_0x8caf('0x40')](_0x486368[_0x8caf('0x3e')],{'$or':_[_0x8caf('0x30')](_0x58575e,function(_0x4f8f23){if(_0x4f8f23[_0x8caf('0x41')]!==_0x8caf('0x42')){var _0x1fcdd6={};_0x1fcdd6[_0x4f8f23['name']]={'$like':'%'+_0x36bae5['query'][_0x8caf('0x43')]+'%'};return _0x1fcdd6;}})});}_0x486368=_[_0x8caf('0x40')]({},_0x486368,_0x36bae5[_0x8caf('0x44')]);var _0x387da4={'where':_0x486368[_0x8caf('0x3e')]};return db[_0x8caf('0x31')][_0x8caf('0x22')](_0x387da4)['then'](function(_0x2b0d3f){_0x45a61a[_0x8caf('0x22')]=_0x2b0d3f;if(_0x36bae5['query'][_0x8caf('0x45')]){_0x486368[_0x8caf('0x46')]=[{'all':!![]}];}return db[_0x8caf('0x31')]['findAll'](_0x486368);})[_0x8caf('0x29')](function(_0x1ead43){_0x45a61a[_0x8caf('0x47')]=_0x1ead43;return _0x45a61a;})[_0x8caf('0x29')](respondWithFilteredResult(_0x35fa52,_0x486368))[_0x8caf('0x48')](handleError(_0x35fa52,null));};exports['show']=function(_0x98242a,_0x5c4299){var _0x43049b={'raw':!![],'where':{'id':_0x98242a['params']['id']}},_0x357a3d={};_0x357a3d[_0x8caf('0x35')]=_[_0x8caf('0x49')](db[_0x8caf('0x31')][_0x8caf('0x32')]);_0x357a3d[_0x8caf('0x36')]=_[_0x8caf('0x49')](_0x98242a[_0x8caf('0x36')]);_0x357a3d[_0x8caf('0x37')]=_['intersection'](_0x357a3d['model'],_0x357a3d[_0x8caf('0x36')]);_0x43049b[_0x8caf('0x38')]=_[_0x8caf('0x4a')](_0x357a3d[_0x8caf('0x35')],qs[_0x8caf('0x39')](_0x98242a[_0x8caf('0x36')][_0x8caf('0x39')]));_0x43049b[_0x8caf('0x38')]=_0x43049b[_0x8caf('0x38')][_0x8caf('0x3a')]?_0x43049b['attributes']:_0x357a3d['model'];if(_0x98242a[_0x8caf('0x36')][_0x8caf('0x45')]){_0x43049b[_0x8caf('0x46')]=[{'all':!![]}];}_0x43049b=_[_0x8caf('0x40')]({},_0x43049b,_0x98242a[_0x8caf('0x44')]);return db[_0x8caf('0x31')][_0x8caf('0x4b')](_0x43049b)[_0x8caf('0x29')](handleEntityNotFound(_0x5c4299,null))[_0x8caf('0x29')](respondWithResult(_0x5c4299,null))['catch'](handleError(_0x5c4299,null));};exports[_0x8caf('0x4c')]=function(_0x327f03,_0x52738d){return db[_0x8caf('0x31')][_0x8caf('0x4c')](_0x327f03['body'],{})[_0x8caf('0x29')](respondWithResult(_0x52738d,0xc9))[_0x8caf('0x48')](handleError(_0x52738d,null));};exports[_0x8caf('0x28')]=function(_0x57c871,_0x3f7bd9){if(_0x57c871[_0x8caf('0x4d')]['id']){delete _0x57c871[_0x8caf('0x4d')]['id'];}return db[_0x8caf('0x31')][_0x8caf('0x4b')]({'where':{'id':_0x57c871[_0x8caf('0x4e')]['id']}})[_0x8caf('0x29')](handleEntityNotFound(_0x3f7bd9,null))[_0x8caf('0x29')](saveUpdates(_0x57c871[_0x8caf('0x4d')],null))[_0x8caf('0x29')](respondWithResult(_0x3f7bd9,null))[_0x8caf('0x48')](handleError(_0x3f7bd9,null));};exports[_0x8caf('0x2a')]=function(_0x384c4a,_0x5903bd){return db['ChatGroup'][_0x8caf('0x4b')]({'where':{'id':_0x384c4a[_0x8caf('0x4e')]['id']}})[_0x8caf('0x29')](handleEntityNotFound(_0x5903bd,null))[_0x8caf('0x29')](removeEntity(_0x5903bd,null))[_0x8caf('0x48')](handleError(_0x5903bd,null));};exports['describe']=function(_0x2d90c5,_0x3576c6){return db[_0x8caf('0x31')][_0x8caf('0x4f')]()[_0x8caf('0x29')](respondWithResult(_0x3576c6,null))[_0x8caf('0x48')](handleError(_0x3576c6,null));};exports[_0x8caf('0x50')]=function(_0x13e3e7,_0xd32c4e,_0x4f2284){return db[_0x8caf('0x51')][_0x8caf('0x22')]({'where':{'ChatGroupId':_0x13e3e7['params']['id'],'ToId':_0x13e3e7[_0x8caf('0x52')]['id'],'read':![]}})['then'](function(_0xe4a333){return{'id':_[_0x8caf('0x53')](_0x13e3e7['params']['id']),'count':_0xe4a333};})[_0x8caf('0x29')](respondWithResult(_0xd32c4e,null))['catch'](handleError(_0xd32c4e,null));};exports[_0x8caf('0x54')]=function(_0x5790dd,_0x453454,_0x1e104b){return db[_0x8caf('0x31')][_0x8caf('0x4b')]({'where':{'id':_0x5790dd[_0x8caf('0x4e')]['id']}})[_0x8caf('0x29')](handleEntityNotFound(_0x453454,null))['then'](function(_0x15ddbc){if(_0x15ddbc){return _0x15ddbc[_0x8caf('0x54')](_0x5790dd[_0x8caf('0x4d')]['ids'],_[_0x8caf('0x55')](_0x5790dd[_0x8caf('0x4d')],[_0x8caf('0x56'),'id'])||{});}})[_0x8caf('0x29')](respondWithResult(_0x453454,null))[_0x8caf('0x48')](handleError(_0x453454,null));};exports['getMembers']=function(_0x54c584,_0x7f0d3b,_0x5bdcc0){var _0x5ea2e2={};var _0x1af5c8={};var _0x4c3875;var _0x232a20;return db[_0x8caf('0x31')][_0x8caf('0x57')]({'where':{'id':_0x54c584['params']['id']}})[_0x8caf('0x29')](handleEntityNotFound(_0x7f0d3b,null))['then'](function(_0xfaef6b){if(_0xfaef6b){_0x4c3875=_0xfaef6b;_0x1af5c8[_0x8caf('0x35')]=_[_0x8caf('0x49')](db[_0x8caf('0x58')][_0x8caf('0x32')]);_0x1af5c8[_0x8caf('0x36')]=_[_0x8caf('0x49')](_0x54c584[_0x8caf('0x36')]);_0x1af5c8[_0x8caf('0x37')]=_[_0x8caf('0x4a')](_0x1af5c8['model'],_0x1af5c8['query']);_0x5ea2e2[_0x8caf('0x38')]=_[_0x8caf('0x4a')](_0x1af5c8[_0x8caf('0x35')],qs[_0x8caf('0x39')](_0x54c584[_0x8caf('0x36')][_0x8caf('0x39')]));_0x5ea2e2['attributes']=_0x5ea2e2[_0x8caf('0x38')][_0x8caf('0x3a')]?_0x5ea2e2[_0x8caf('0x38')]:_0x1af5c8['model'];_0x5ea2e2[_0x8caf('0x3c')]=qs[_0x8caf('0x3d')](_0x54c584[_0x8caf('0x36')][_0x8caf('0x3d')]);_0x5ea2e2[_0x8caf('0x3e')]=qs['filters'](_[_0x8caf('0x3f')](_0x54c584['query'],_0x1af5c8[_0x8caf('0x37')]));if(_0x54c584[_0x8caf('0x36')][_0x8caf('0x43')]){_0x5ea2e2[_0x8caf('0x3e')]=_[_0x8caf('0x40')](_0x5ea2e2[_0x8caf('0x3e')],{'$or':_[_0x8caf('0x30')](_0x5ea2e2['attributes'],function(_0x4899e7){var _0x2d58f9={};_0x2d58f9[_0x4899e7]={'$like':'%'+_0x54c584[_0x8caf('0x36')][_0x8caf('0x43')]+'%'};return _0x2d58f9;})});}_0x5ea2e2=_[_0x8caf('0x40')]({},_0x5ea2e2,_0x54c584['options']);return _0x4c3875[_0x8caf('0x59')](_0x5ea2e2);}})['then'](function(_0x427e81){if(_0x427e81){_0x232a20=_0x427e81['length'];if(!_0x54c584[_0x8caf('0x36')][_0x8caf('0x5a')]('nolimit')){_0x5ea2e2[_0x8caf('0x20')]=qs[_0x8caf('0x20')](_0x54c584[_0x8caf('0x36')]['limit']);_0x5ea2e2[_0x8caf('0x1f')]=qs['offset'](_0x54c584['query'][_0x8caf('0x1f')]);}return _0x4c3875[_0x8caf('0x59')](_0x5ea2e2);}})[_0x8caf('0x29')](function(_0x193e4c){if(_0x193e4c){return _0x193e4c?{'count':_0x232a20,'rows':_0x193e4c}:null;}})[_0x8caf('0x29')](respondWithResult(_0x7f0d3b,null))[_0x8caf('0x48')](handleError(_0x7f0d3b,null));};exports[_0x8caf('0x5b')]=function(_0x6935fc,_0x3e6b92,_0x283ec8){return db[_0x8caf('0x31')]['find']({'where':{'id':_0x6935fc['params']['id']}})['then'](handleEntityNotFound(_0x3e6b92,null))['then'](function(_0x8fde48){if(_0x8fde48){return _0x8fde48['removeMembers'](_0x6935fc[_0x8caf('0x36')][_0x8caf('0x56')]);}})['then'](respondWithStatusCode(_0x3e6b92,null))[_0x8caf('0x48')](handleError(_0x3e6b92,null));};exports[_0x8caf('0x5c')]=function(_0x5d30e6,_0x20d2df,_0xbdfd52){if(_0x5d30e6[_0x8caf('0x4d')]['id']){delete _0x5d30e6['body']['id'];}return db[_0x8caf('0x31')][_0x8caf('0x4b')]({'where':{'id':_0x5d30e6[_0x8caf('0x4e')]['id']}})[_0x8caf('0x29')](handleEntityNotFound(_0x20d2df,null))[_0x8caf('0x29')](function(_0x34ca8c){if(_0x34ca8c){_0x5d30e6['body'][_0x8caf('0x5d')]=_0x34ca8c['id'];return db[_0x8caf('0x51')][_0x8caf('0x4c')](_0x5d30e6[_0x8caf('0x4d')]);}})[_0x8caf('0x29')](respondWithResult(_0x20d2df,null))['catch'](handleError(_0x20d2df,null));};exports[_0x8caf('0x5e')]=function(_0x59af11,_0x2aec7c,_0x180e81){var _0x27d53e={};var _0x50e7a1={};var _0x45cecd;var _0x26a84a;return db['ChatGroup'][_0x8caf('0x57')]({'where':{'id':_0x59af11[_0x8caf('0x4e')]['id']}})[_0x8caf('0x29')](handleEntityNotFound(_0x2aec7c,null))['then'](function(_0x232b15){if(_0x232b15){_0x45cecd=_0x232b15;_0x50e7a1[_0x8caf('0x35')]=_[_0x8caf('0x49')](db[_0x8caf('0x51')][_0x8caf('0x32')]);_0x50e7a1[_0x8caf('0x36')]=_[_0x8caf('0x49')](_0x59af11[_0x8caf('0x36')]);_0x50e7a1[_0x8caf('0x37')]=_[_0x8caf('0x4a')](_0x50e7a1['model'],_0x50e7a1['query']);_0x27d53e['attributes']=_[_0x8caf('0x4a')](_0x50e7a1['model'],qs[_0x8caf('0x39')](_0x59af11[_0x8caf('0x36')][_0x8caf('0x39')]));_0x27d53e['attributes']=_0x27d53e['attributes'][_0x8caf('0x3a')]?_0x27d53e['attributes']:_0x50e7a1[_0x8caf('0x35')];_0x27d53e['order']=qs['sort'](_0x59af11[_0x8caf('0x36')][_0x8caf('0x3d')]);_0x27d53e[_0x8caf('0x3e')]=qs['filters'](_[_0x8caf('0x3f')](_0x59af11['query'],_0x50e7a1[_0x8caf('0x37')]));if(_0x59af11[_0x8caf('0x36')][_0x8caf('0x43')]){_0x27d53e[_0x8caf('0x3e')]=_[_0x8caf('0x40')](_0x27d53e['where'],{'$or':_[_0x8caf('0x30')](_0x27d53e[_0x8caf('0x38')],function(_0x54d86b){var _0x4266ad={};_0x4266ad[_0x54d86b]={'$like':'%'+_0x59af11[_0x8caf('0x36')]['filter']+'%'};return _0x4266ad;})});}if(_0x59af11[_0x8caf('0x36')][_0x8caf('0x5f')]){var _0x5c9b30=_0x59af11[_0x8caf('0x36')][_0x8caf('0x5f')][_0x8caf('0x60')](',');var _0x318beb={};_0x318beb[_0x5c9b30[0x0]]={'$gte':moment(_0x5c9b30[0x1])['format'](_0x8caf('0x61'))};_0x27d53e['where']=_[_0x8caf('0x40')](_0x27d53e[_0x8caf('0x3e')],_0x318beb);}_0x27d53e=_['merge']({},_0x27d53e,_0x59af11['options']);return _0x45cecd[_0x8caf('0x5e')](_0x27d53e);}})[_0x8caf('0x29')](function(_0x3eb685){if(_0x3eb685){_0x26a84a=_0x3eb685[_0x8caf('0x3a')];if(!_0x59af11[_0x8caf('0x36')][_0x8caf('0x5a')](_0x8caf('0x3b'))){_0x27d53e[_0x8caf('0x20')]=qs['limit'](_0x59af11['query'][_0x8caf('0x20')]);_0x27d53e[_0x8caf('0x1f')]=qs[_0x8caf('0x1f')](_0x59af11[_0x8caf('0x36')]['offset']);}return _0x45cecd[_0x8caf('0x5e')](_0x27d53e);}})[_0x8caf('0x29')](function(_0x1c335a){if(_0x1c335a){return _0x1c335a?{'count':_0x26a84a,'rows':_0x1c335a}:null;}})[_0x8caf('0x29')](respondWithResult(_0x2aec7c,null))[_0x8caf('0x48')](handleError(_0x2aec7c,null));}; \ No newline at end of file +var _0x52d2=['filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','destroy','describe','getUnread','ChatInternalMessage','user','addMembers','omit','ids','getMembers','findOne','User','removeMembers','addMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','error','stack','name','send','map','ChatGroup','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2e3de5,_0x26da33){var _0x37e13c=function(_0x248390){while(--_0x248390){_0x2e3de5['push'](_0x2e3de5['shift']());}};_0x37e13c(++_0x26da33);}(_0x52d2,0xe9));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x252d('0x0'));var rimraf=require(_0x252d('0x1'));var zipdir=require(_0x252d('0x2'));var jsonpatch=require(_0x252d('0x3'));var rp=require(_0x252d('0x4'));var moment=require(_0x252d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x252d('0x6'));var util=require(_0x252d('0x7'));var path=require(_0x252d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x252d('0x9'));var _=require('lodash');var squel=require(_0x252d('0xa'));var crypto=require(_0x252d('0xb'));var jsforce=require(_0x252d('0xc'));var deskjs=require(_0x252d('0xd'));var toCsv=require(_0x252d('0xe'));var querystring=require(_0x252d('0xf'));var Papa=require(_0x252d('0x10'));var Redis=require(_0x252d('0x11'));var authService=require(_0x252d('0x12'));var qs=require(_0x252d('0x13'));var as=require(_0x252d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x252d('0x15'))(_0x252d('0x16'));var utils=require(_0x252d('0x17'));var config=require(_0x252d('0x18'));var licenseUtil=require(_0x252d('0x19'));var db=require(_0x252d('0x1a'))['db'];config[_0x252d('0x1b')]=_[_0x252d('0x1c')](config[_0x252d('0x1b')],{'host':_0x252d('0x1d'),'port':0x18eb});var socket=require(_0x252d('0x1e'))(new Redis(config[_0x252d('0x1b')]));require(_0x252d('0x1f'))[_0x252d('0x20')](socket);function respondWithStatusCode(_0x7068b4,_0x669922){_0x669922=_0x669922||0xcc;return function(_0x9de19e){if(_0x9de19e){return _0x7068b4[_0x252d('0x21')](_0x669922);}return _0x7068b4[_0x252d('0x22')](_0x669922)[_0x252d('0x23')]();};}function respondWithResult(_0x4fb123,_0x3e6521){_0x3e6521=_0x3e6521||0xc8;return function(_0xa3203e){if(_0xa3203e){return _0x4fb123[_0x252d('0x22')](_0x3e6521)[_0x252d('0x24')](_0xa3203e);}};}function respondWithFilteredResult(_0x4cae3b,_0x76f840){return function(_0x595dc4){if(_0x595dc4){var _0x28bec0=typeof _0x76f840['offset']===_0x252d('0x25')&&typeof _0x76f840[_0x252d('0x26')]===_0x252d('0x25');var _0xe2b578=_0x595dc4[_0x252d('0x27')];var _0x162dba=_0x28bec0?0x0:_0x76f840[_0x252d('0x28')];var _0x1a8159=_0x28bec0?_0x595dc4[_0x252d('0x27')]:_0x76f840['offset']+_0x76f840[_0x252d('0x26')];var _0x3b1178;if(_0x1a8159>=_0xe2b578){_0x1a8159=_0xe2b578;_0x3b1178=0xc8;}else{_0x3b1178=0xce;}_0x4cae3b['status'](_0x3b1178);return _0x4cae3b[_0x252d('0x29')]('Content-Range',_0x162dba+'-'+_0x1a8159+'/'+_0xe2b578)[_0x252d('0x24')](_0x595dc4);}return null;};}function patchUpdates(_0x4f5aed){return function(_0x26c698){try{jsonpatch[_0x252d('0x2a')](_0x26c698,_0x4f5aed,!![]);}catch(_0x1eb27b){return BPromise[_0x252d('0x2b')](_0x1eb27b);}return _0x26c698['save']();};}function saveUpdates(_0x4cf7ac,_0x392bc4){return function(_0x4ccebd){if(_0x4ccebd){return _0x4ccebd[_0x252d('0x2c')](_0x4cf7ac)[_0x252d('0x2d')](function(_0xa6798c){return _0xa6798c;});}return null;};}function removeEntity(_0xbae0eb,_0x17e11c){return function(_0x3fbaef){if(_0x3fbaef){return _0x3fbaef['destroy']()[_0x252d('0x2d')](function(){_0xbae0eb[_0x252d('0x22')](0xcc)[_0x252d('0x23')]();});}};}function handleEntityNotFound(_0xaba061,_0x4a96e1){return function(_0x28a256){if(!_0x28a256){_0xaba061[_0x252d('0x21')](0x194);}return _0x28a256;};}function handleError(_0x2f2b80,_0x261331){_0x261331=_0x261331||0x1f4;return function(_0x16be93){logger[_0x252d('0x2e')](_0x16be93[_0x252d('0x2f')]);if(_0x16be93[_0x252d('0x30')]){delete _0x16be93[_0x252d('0x30')];}_0x2f2b80[_0x252d('0x22')](_0x261331)[_0x252d('0x31')](_0x16be93);};}exports['index']=function(_0x2cbf85,_0x50e93e){var _0x439e8f={},_0x3236a4={},_0xd5cca6={'count':0x0,'rows':[]};var _0xb672d0=_[_0x252d('0x32')](db[_0x252d('0x33')]['rawAttributes'],function(_0x1576d3){return{'name':_0x1576d3[_0x252d('0x34')],'type':_0x1576d3['type']['key']};});_0x3236a4[_0x252d('0x35')]=_[_0x252d('0x32')](_0xb672d0,_0x252d('0x30'));_0x3236a4[_0x252d('0x36')]=_[_0x252d('0x37')](_0x2cbf85[_0x252d('0x36')]);_0x3236a4['filters']=_['intersection'](_0x3236a4[_0x252d('0x35')],_0x3236a4['query']);_0x439e8f[_0x252d('0x38')]=_[_0x252d('0x39')](_0x3236a4[_0x252d('0x35')],qs[_0x252d('0x3a')](_0x2cbf85[_0x252d('0x36')][_0x252d('0x3a')]));_0x439e8f[_0x252d('0x38')]=_0x439e8f[_0x252d('0x38')][_0x252d('0x3b')]?_0x439e8f[_0x252d('0x38')]:_0x3236a4[_0x252d('0x35')];if(!_0x2cbf85[_0x252d('0x36')][_0x252d('0x3c')](_0x252d('0x3d'))){_0x439e8f[_0x252d('0x26')]=qs[_0x252d('0x26')](_0x2cbf85['query'][_0x252d('0x26')]);_0x439e8f['offset']=qs[_0x252d('0x28')](_0x2cbf85[_0x252d('0x36')][_0x252d('0x28')]);}_0x439e8f[_0x252d('0x3e')]=qs['sort'](_0x2cbf85[_0x252d('0x36')][_0x252d('0x3f')]);_0x439e8f['where']=qs[_0x252d('0x40')](_[_0x252d('0x41')](_0x2cbf85[_0x252d('0x36')],_0x3236a4[_0x252d('0x40')]),_0xb672d0);if(_0x2cbf85[_0x252d('0x36')][_0x252d('0x42')]){_0x439e8f[_0x252d('0x43')]=_[_0x252d('0x44')](_0x439e8f[_0x252d('0x43')],{'$or':_['map'](_0xb672d0,function(_0x39c5a9){if(_0x39c5a9[_0x252d('0x45')]!==_0x252d('0x46')){var _0x28a1d7={};_0x28a1d7[_0x39c5a9[_0x252d('0x30')]]={'$like':'%'+_0x2cbf85[_0x252d('0x36')][_0x252d('0x42')]+'%'};return _0x28a1d7;}})});}_0x439e8f=_['merge']({},_0x439e8f,_0x2cbf85[_0x252d('0x47')]);var _0x48b854={'where':_0x439e8f[_0x252d('0x43')]};return db[_0x252d('0x33')]['count'](_0x48b854)['then'](function(_0x4d5a6b){_0xd5cca6[_0x252d('0x27')]=_0x4d5a6b;if(_0x2cbf85['query'][_0x252d('0x48')]){_0x439e8f[_0x252d('0x49')]=[{'all':!![]}];}return db[_0x252d('0x33')]['findAll'](_0x439e8f);})[_0x252d('0x2d')](function(_0x4ed9eb){_0xd5cca6[_0x252d('0x4a')]=_0x4ed9eb;return _0xd5cca6;})[_0x252d('0x2d')](respondWithFilteredResult(_0x50e93e,_0x439e8f))[_0x252d('0x4b')](handleError(_0x50e93e,null));};exports['show']=function(_0x59ad07,_0x48e47f){var _0x830cf7={'raw':!![],'where':{'id':_0x59ad07[_0x252d('0x4c')]['id']}},_0x58f725={};_0x58f725[_0x252d('0x35')]=_[_0x252d('0x37')](db[_0x252d('0x33')][_0x252d('0x4d')]);_0x58f725['query']=_[_0x252d('0x37')](_0x59ad07['query']);_0x58f725[_0x252d('0x40')]=_['intersection'](_0x58f725[_0x252d('0x35')],_0x58f725[_0x252d('0x36')]);_0x830cf7[_0x252d('0x38')]=_[_0x252d('0x39')](_0x58f725[_0x252d('0x35')],qs['fields'](_0x59ad07['query'][_0x252d('0x3a')]));_0x830cf7[_0x252d('0x38')]=_0x830cf7[_0x252d('0x38')][_0x252d('0x3b')]?_0x830cf7[_0x252d('0x38')]:_0x58f725[_0x252d('0x35')];if(_0x59ad07[_0x252d('0x36')][_0x252d('0x48')]){_0x830cf7[_0x252d('0x49')]=[{'all':!![]}];}_0x830cf7=_[_0x252d('0x44')]({},_0x830cf7,_0x59ad07['options']);return db[_0x252d('0x33')][_0x252d('0x4e')](_0x830cf7)[_0x252d('0x2d')](handleEntityNotFound(_0x48e47f,null))[_0x252d('0x2d')](respondWithResult(_0x48e47f,null))[_0x252d('0x4b')](handleError(_0x48e47f,null));};exports[_0x252d('0x4f')]=function(_0x3a8699,_0x40eac3){return db[_0x252d('0x33')][_0x252d('0x4f')](_0x3a8699['body'],{})['then'](respondWithResult(_0x40eac3,0xc9))[_0x252d('0x4b')](handleError(_0x40eac3,null));};exports[_0x252d('0x2c')]=function(_0x26300e,_0x492cc4){if(_0x26300e[_0x252d('0x50')]['id']){delete _0x26300e[_0x252d('0x50')]['id'];}return db[_0x252d('0x33')]['find']({'where':{'id':_0x26300e[_0x252d('0x4c')]['id']}})[_0x252d('0x2d')](handleEntityNotFound(_0x492cc4,null))[_0x252d('0x2d')](saveUpdates(_0x26300e[_0x252d('0x50')],null))[_0x252d('0x2d')](respondWithResult(_0x492cc4,null))[_0x252d('0x4b')](handleError(_0x492cc4,null));};exports[_0x252d('0x51')]=function(_0x12aff1,_0x3738de){return db['ChatGroup']['find']({'where':{'id':_0x12aff1[_0x252d('0x4c')]['id']}})[_0x252d('0x2d')](handleEntityNotFound(_0x3738de,null))['then'](removeEntity(_0x3738de,null))[_0x252d('0x4b')](handleError(_0x3738de,null));};exports[_0x252d('0x52')]=function(_0xeee5ba,_0x4622de){return db[_0x252d('0x33')]['describe']()[_0x252d('0x2d')](respondWithResult(_0x4622de,null))[_0x252d('0x4b')](handleError(_0x4622de,null));};exports[_0x252d('0x53')]=function(_0x12968f,_0x145eb9,_0x580bb8){return db[_0x252d('0x54')]['count']({'where':{'ChatGroupId':_0x12968f[_0x252d('0x4c')]['id'],'ToId':_0x12968f[_0x252d('0x55')]['id'],'read':![]}})['then'](function(_0x26cee6){return{'id':_['toInteger'](_0x12968f[_0x252d('0x4c')]['id']),'count':_0x26cee6};})[_0x252d('0x2d')](respondWithResult(_0x145eb9,null))[_0x252d('0x4b')](handleError(_0x145eb9,null));};exports[_0x252d('0x56')]=function(_0x57b43c,_0x368cff,_0xb89bb){return db[_0x252d('0x33')][_0x252d('0x4e')]({'where':{'id':_0x57b43c[_0x252d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x368cff,null))[_0x252d('0x2d')](function(_0x20b2aa){if(_0x20b2aa){return _0x20b2aa[_0x252d('0x56')](_0x57b43c[_0x252d('0x50')]['ids'],_[_0x252d('0x57')](_0x57b43c[_0x252d('0x50')],[_0x252d('0x58'),'id'])||{});}})[_0x252d('0x2d')](respondWithResult(_0x368cff,null))[_0x252d('0x4b')](handleError(_0x368cff,null));};exports[_0x252d('0x59')]=function(_0x397f47,_0x21e0e2,_0x11d698){var _0x7327cc={};var _0x241963={};var _0x25361d;var _0xc2ec;return db['ChatGroup'][_0x252d('0x5a')]({'where':{'id':_0x397f47[_0x252d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x21e0e2,null))['then'](function(_0x253dc2){if(_0x253dc2){_0x25361d=_0x253dc2;_0x241963[_0x252d('0x35')]=_[_0x252d('0x37')](db[_0x252d('0x5b')][_0x252d('0x4d')]);_0x241963['query']=_['keys'](_0x397f47['query']);_0x241963['filters']=_[_0x252d('0x39')](_0x241963[_0x252d('0x35')],_0x241963[_0x252d('0x36')]);_0x7327cc['attributes']=_[_0x252d('0x39')](_0x241963[_0x252d('0x35')],qs[_0x252d('0x3a')](_0x397f47[_0x252d('0x36')][_0x252d('0x3a')]));_0x7327cc[_0x252d('0x38')]=_0x7327cc[_0x252d('0x38')][_0x252d('0x3b')]?_0x7327cc[_0x252d('0x38')]:_0x241963[_0x252d('0x35')];_0x7327cc[_0x252d('0x3e')]=qs[_0x252d('0x3f')](_0x397f47['query'][_0x252d('0x3f')]);_0x7327cc['where']=qs[_0x252d('0x40')](_[_0x252d('0x41')](_0x397f47[_0x252d('0x36')],_0x241963[_0x252d('0x40')]));if(_0x397f47[_0x252d('0x36')][_0x252d('0x42')]){_0x7327cc[_0x252d('0x43')]=_[_0x252d('0x44')](_0x7327cc[_0x252d('0x43')],{'$or':_['map'](_0x7327cc[_0x252d('0x38')],function(_0x2e6ee1){var _0x2663fe={};_0x2663fe[_0x2e6ee1]={'$like':'%'+_0x397f47[_0x252d('0x36')][_0x252d('0x42')]+'%'};return _0x2663fe;})});}_0x7327cc=_['merge']({},_0x7327cc,_0x397f47[_0x252d('0x47')]);return _0x25361d[_0x252d('0x59')](_0x7327cc);}})['then'](function(_0x3e9196){if(_0x3e9196){_0xc2ec=_0x3e9196[_0x252d('0x3b')];if(!_0x397f47[_0x252d('0x36')][_0x252d('0x3c')]('nolimit')){_0x7327cc[_0x252d('0x26')]=qs[_0x252d('0x26')](_0x397f47[_0x252d('0x36')]['limit']);_0x7327cc[_0x252d('0x28')]=qs[_0x252d('0x28')](_0x397f47[_0x252d('0x36')][_0x252d('0x28')]);}return _0x25361d[_0x252d('0x59')](_0x7327cc);}})[_0x252d('0x2d')](function(_0x414272){if(_0x414272){return _0x414272?{'count':_0xc2ec,'rows':_0x414272}:null;}})[_0x252d('0x2d')](respondWithResult(_0x21e0e2,null))['catch'](handleError(_0x21e0e2,null));};exports['removeMembers']=function(_0x4555b3,_0x2c36b3,_0x7c7cb2){return db[_0x252d('0x33')][_0x252d('0x4e')]({'where':{'id':_0x4555b3[_0x252d('0x4c')]['id']}})[_0x252d('0x2d')](handleEntityNotFound(_0x2c36b3,null))['then'](function(_0xb73888){if(_0xb73888){return _0xb73888[_0x252d('0x5c')](_0x4555b3['query']['ids']);}})[_0x252d('0x2d')](respondWithStatusCode(_0x2c36b3,null))['catch'](handleError(_0x2c36b3,null));};exports[_0x252d('0x5d')]=function(_0x47cfcd,_0x21272c,_0x2e0f23){if(_0x47cfcd[_0x252d('0x50')]['id']){delete _0x47cfcd[_0x252d('0x50')]['id'];}return db[_0x252d('0x33')]['find']({'where':{'id':_0x47cfcd[_0x252d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x21272c,null))[_0x252d('0x2d')](function(_0x14ba0a){if(_0x14ba0a){_0x47cfcd[_0x252d('0x50')]['ChatGroupId']=_0x14ba0a['id'];return db[_0x252d('0x54')][_0x252d('0x4f')](_0x47cfcd[_0x252d('0x50')]);}})[_0x252d('0x2d')](respondWithResult(_0x21272c,null))['catch'](handleError(_0x21272c,null));};exports['getMessages']=function(_0x27a49b,_0x2e48a8,_0x3a192c){var _0x407768={};var _0x35ee1f={};var _0x2c83d9;var _0x32577b;return db[_0x252d('0x33')][_0x252d('0x5a')]({'where':{'id':_0x27a49b[_0x252d('0x4c')]['id']}})[_0x252d('0x2d')](handleEntityNotFound(_0x2e48a8,null))[_0x252d('0x2d')](function(_0x1b3256){if(_0x1b3256){_0x2c83d9=_0x1b3256;_0x35ee1f[_0x252d('0x35')]=_[_0x252d('0x37')](db['ChatInternalMessage'][_0x252d('0x4d')]);_0x35ee1f[_0x252d('0x36')]=_[_0x252d('0x37')](_0x27a49b[_0x252d('0x36')]);_0x35ee1f['filters']=_['intersection'](_0x35ee1f[_0x252d('0x35')],_0x35ee1f[_0x252d('0x36')]);_0x407768[_0x252d('0x38')]=_['intersection'](_0x35ee1f[_0x252d('0x35')],qs[_0x252d('0x3a')](_0x27a49b[_0x252d('0x36')][_0x252d('0x3a')]));_0x407768[_0x252d('0x38')]=_0x407768[_0x252d('0x38')][_0x252d('0x3b')]?_0x407768[_0x252d('0x38')]:_0x35ee1f[_0x252d('0x35')];_0x407768['order']=qs[_0x252d('0x3f')](_0x27a49b[_0x252d('0x36')]['sort']);_0x407768[_0x252d('0x43')]=qs[_0x252d('0x40')](_[_0x252d('0x41')](_0x27a49b[_0x252d('0x36')],_0x35ee1f[_0x252d('0x40')]));if(_0x27a49b[_0x252d('0x36')][_0x252d('0x42')]){_0x407768[_0x252d('0x43')]=_[_0x252d('0x44')](_0x407768['where'],{'$or':_['map'](_0x407768['attributes'],function(_0x3a3334){var _0x106eae={};_0x106eae[_0x3a3334]={'$like':'%'+_0x27a49b[_0x252d('0x36')]['filter']+'%'};return _0x106eae;})});}if(_0x27a49b[_0x252d('0x36')][_0x252d('0x5e')]){var _0x1ab5a8=_0x27a49b[_0x252d('0x36')][_0x252d('0x5e')][_0x252d('0x5f')](',');var _0x5286bb={};_0x5286bb[_0x1ab5a8[0x0]]={'$gte':moment(_0x1ab5a8[0x1])[_0x252d('0x60')](_0x252d('0x61'))};_0x407768['where']=_[_0x252d('0x44')](_0x407768['where'],_0x5286bb);}_0x407768=_[_0x252d('0x44')]({},_0x407768,_0x27a49b['options']);return _0x2c83d9[_0x252d('0x62')](_0x407768);}})[_0x252d('0x2d')](function(_0x3cdca6){if(_0x3cdca6){_0x32577b=_0x3cdca6[_0x252d('0x3b')];if(!_0x27a49b[_0x252d('0x36')]['hasOwnProperty'](_0x252d('0x3d'))){_0x407768[_0x252d('0x26')]=qs[_0x252d('0x26')](_0x27a49b[_0x252d('0x36')][_0x252d('0x26')]);_0x407768[_0x252d('0x28')]=qs[_0x252d('0x28')](_0x27a49b[_0x252d('0x36')]['offset']);}return _0x2c83d9[_0x252d('0x62')](_0x407768);}})[_0x252d('0x2d')](function(_0x28396b){if(_0x28396b){return _0x28396b?{'count':_0x32577b,'rows':_0x28396b}:null;}})['then'](respondWithResult(_0x2e48a8,null))[_0x252d('0x4b')](handleError(_0x2e48a8,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 85ec491..9e49a70 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 _0x442b=['ChatGroup','save','update','remove','emit','hook','exports','events'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x442b,0x6f));var _0xb442=function(_0x3bb171,_0x577ac5){_0x3bb171=_0x3bb171-0x0;var _0x18d9fb=_0x442b[_0x3bb171];return _0x18d9fb;};'use strict';var EventEmitter=require(_0xb442('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xb442('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb442('0x2'),'afterUpdate':_0xb442('0x3'),'afterDestroy':_0xb442('0x4')};function emitEvent(_0x4ce07e){return function(_0x5c02d3,_0x3278d4,_0xc91d1c){ChatGroupEvents['emit'](_0x4ce07e+':'+_0x5c02d3['id'],_0x5c02d3);ChatGroupEvents[_0xb442('0x5')](_0x4ce07e,_0x5c02d3);_0xc91d1c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xb442('0x6')](e,emitEvent(event));}}module[_0xb442('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x65d2=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2201d5,_0x995af2){var _0x445e2c=function(_0x287d93){while(--_0x287d93){_0x2201d5['push'](_0x2201d5['shift']());}};_0x445e2c(++_0x995af2);}(_0x65d2,0x1f3));var _0x265d=function(_0x22b818,_0x3247d0){_0x22b818=_0x22b818-0x0;var _0x4691d5=_0x65d2[_0x22b818];return _0x4691d5;};'use strict';var EventEmitter=require(_0x265d('0x0'));var ChatGroup=require(_0x265d('0x1'))['db'][_0x265d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x265d('0x3')](0x0);var events={'afterCreate':_0x265d('0x4'),'afterUpdate':_0x265d('0x5'),'afterDestroy':_0x265d('0x6')};function emitEvent(_0x1b7ec6){return function(_0x2e4711,_0x1ab8e7,_0x43d3fd){ChatGroupEvents[_0x265d('0x7')](_0x1b7ec6+':'+_0x2e4711['id'],_0x2e4711);ChatGroupEvents[_0x265d('0x7')](_0x1b7ec6,_0x2e4711);_0x43d3fd(null);};}for(var e in events){if(events[_0x265d('0x8')](e)){var event=events[e];ChatGroup[_0x265d('0x9')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 545a160..58c9683 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 _0x576e=['ChatGroup','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x4d7356,_0x1e969c){var _0x2c7051=function(_0x313d8d){while(--_0x313d8d){_0x4d7356['push'](_0x4d7356['shift']());}};_0x2c7051(++_0x1e969c);}(_0x576e,0xa1));var _0xe576=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0x576e[_0x337748];return _0x3bb03f;};'use strict';var _=require('lodash');var util=require(_0xe576('0x0'));var logger=require(_0xe576('0x1'))(_0xe576('0x2'));var moment=require(_0xe576('0x3'));var BPromise=require(_0xe576('0x4'));var rp=require(_0xe576('0x5'));var fs=require('fs');var path=require(_0xe576('0x6'));var rimraf=require('rimraf');var config=require(_0xe576('0x7'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x57e6ce,_0x22a024){return _0x57e6ce[_0xe576('0x8')](_0xe576('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a2=['../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5997e7,_0x11bc4c){var _0x4dd885=function(_0x25e1d8){while(--_0x25e1d8){_0x5997e7['push'](_0x5997e7['shift']());}};_0x4dd885(++_0x11bc4c);}(_0x14a2,0x164));var _0x214a=function(_0x57f490,_0x41fd02){_0x57f490=_0x57f490-0x0;var _0x28c22d=_0x14a2[_0x57f490];return _0x28c22d;};'use strict';var _=require(_0x214a('0x0'));var util=require(_0x214a('0x1'));var logger=require(_0x214a('0x2'))('api');var moment=require(_0x214a('0x3'));var BPromise=require(_0x214a('0x4'));var rp=require(_0x214a('0x5'));var fs=require('fs');var path=require(_0x214a('0x6'));var rimraf=require(_0x214a('0x7'));var config=require(_0x214a('0x8'));var attributes=require(_0x214a('0x9'));module[_0x214a('0xa')]=function(_0x4c8289,_0xdfa0bb){return _0x4c8289[_0x214a('0xb')]('ChatGroup',attributes,{'tableName':_0x214a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index fc303d8..4734d6d 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 _0x2af3=['localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','defaults','redis'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2af3,0xbc));var _0x32af=function(_0x4eaf7e,_0x2afb74){_0x4eaf7e=_0x4eaf7e-0x0;var _0x31cb6a=_0x2af3[_0x4eaf7e];return _0x31cb6a;};'use strict';var _=require(_0x32af('0x0'));var util=require('util');var moment=require(_0x32af('0x1'));var BPromise=require(_0x32af('0x2'));var rs=require(_0x32af('0x3'));var fs=require('fs');var Redis=require(_0x32af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x32af('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x32af('0x6'));var client=jayson[_0x32af('0x7')]['http']({'port':0x232a});config['redis']=_[_0x32af('0x8')](config[_0x32af('0x9')],{'host':_0x32af('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x32af('0xb'))[_0x32af('0xc')](socket);function respondWithRpcPromise(_0xe28a65,_0x45bc32,_0x185e1c){return new BPromise(function(_0x4be29a,_0x567842){return client[_0x32af('0xd')](_0xe28a65,_0x185e1c)[_0x32af('0xe')](function(_0x32354c){logger[_0x32af('0xf')](_0x32af('0x10'),_0x45bc32,_0x32af('0x11'));logger['debug'](_0x32af('0x12'),_0x45bc32,_0x32af('0x11'),JSON['stringify'](_0x32354c));if(_0x32354c[_0x32af('0x13')]){if(_0x32354c[_0x32af('0x13')][_0x32af('0x14')]===0x1f4){logger['error'](_0x32af('0x10'),_0x45bc32,_0x32354c['error']['message']);return _0x567842(_0x32354c[_0x32af('0x13')]['message']);}logger[_0x32af('0x13')](_0x32af('0x10'),_0x45bc32,_0x32354c[_0x32af('0x13')]['message']);return _0x4be29a(_0x32354c[_0x32af('0x13')][_0x32af('0x15')]);}else{logger[_0x32af('0xf')](_0x32af('0x10'),_0x45bc32,_0x32af('0x11'));_0x4be29a(_0x32354c['result']['message']);}})['catch'](function(_0x5e524c){logger['error'](_0x32af('0x10'),_0x45bc32,_0x5e524c);_0x567842(_0x5e524c);});});} \ No newline at end of file +var _0x275d=['defaults','localhost','./chatGroup.socket','register','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','redis'];(function(_0x5b474c,_0x53a6e5){var _0x6f3112=function(_0x245c03){while(--_0x245c03){_0x5b474c['push'](_0x5b474c['shift']());}};_0x6f3112(++_0x53a6e5);}(_0x275d,0x1a6));var _0xd275=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x275d[_0x28509b];return _0x1e0b6;};'use strict';var _=require(_0xd275('0x0'));var util=require(_0xd275('0x1'));var moment=require(_0xd275('0x2'));var BPromise=require(_0xd275('0x3'));var rs=require(_0xd275('0x4'));var fs=require('fs');var Redis=require(_0xd275('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd275('0x6'));var logger=require('../../config/logger')(_0xd275('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd275('0x8')]['http']({'port':0x232a});config[_0xd275('0x9')]=_[_0xd275('0xa')](config['redis'],{'host':_0xd275('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd275('0x9')]));require(_0xd275('0xc'))[_0xd275('0xd')](socket);function respondWithRpcPromise(_0x5778cb,_0x4b9a77,_0x1a6590){return new BPromise(function(_0x77e9d9,_0x3cd9a2){return client['request'](_0x5778cb,_0x1a6590)['then'](function(_0x45f072){logger[_0xd275('0xe')]('ChatGroup,\x20%s,\x20%s',_0x4b9a77,_0xd275('0xf'));logger[_0xd275('0x10')](_0xd275('0x11'),_0x4b9a77,_0xd275('0xf'),JSON[_0xd275('0x12')](_0x45f072));if(_0x45f072[_0xd275('0x13')]){if(_0x45f072['error']['code']===0x1f4){logger[_0xd275('0x13')](_0xd275('0x14'),_0x4b9a77,_0x45f072['error'][_0xd275('0x15')]);return _0x3cd9a2(_0x45f072[_0xd275('0x13')][_0xd275('0x15')]);}logger[_0xd275('0x13')]('ChatGroup,\x20%s,\x20%s',_0x4b9a77,_0x45f072[_0xd275('0x13')][_0xd275('0x15')]);return _0x77e9d9(_0x45f072['error'][_0xd275('0x15')]);}else{logger[_0xd275('0xe')]('ChatGroup,\x20%s,\x20%s',_0x4b9a77,_0xd275('0xf'));_0x77e9d9(_0x45f072[_0xd275('0x16')][_0xd275('0x15')]);}})[_0xd275('0x17')](function(_0x1976d8){logger[_0xd275('0x13')](_0xd275('0x14'),_0x4b9a77,_0x1976d8);_0x3cd9a2(_0x1976d8);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index a2b06ea..6895769 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 _0x7838=['chatGroup:','./chatGroup.events','save','remove','emit','removeListener','register','length'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7838,0x1c1));var _0x8783=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7838[_0x5447fd];return _0x15b28a;};'use strict';var ChatGroupEvents=require(_0x8783('0x0'));var events=[_0x8783('0x1'),_0x8783('0x2'),'update'];function createListener(_0x369ec0,_0x2afbad){return function(_0x2053dc){_0x2afbad[_0x8783('0x3')](_0x369ec0,_0x2053dc);};}function removeListener(_0x19d2af,_0x4522de){return function(){ChatGroupEvents[_0x8783('0x4')](_0x19d2af,_0x4522de);};}exports[_0x8783('0x5')]=function(_0x1007e0){for(var _0x4ffc8e=0x0,_0x5e3eee=events[_0x8783('0x6')];_0x4ffc8e<_0x5e3eee;_0x4ffc8e++){var _0x25654=events[_0x4ffc8e];var _0xc19195=createListener(_0x8783('0x7')+_0x25654,_0x1007e0);ChatGroupEvents['on'](_0x25654,_0xc19195);}}; \ No newline at end of file +var _0xd191=['./chatGroup.events','save','update','emit','removeListener','register','length','chatGroup:'];(function(_0x3ddf82,_0x208b32){var _0xcd211c=function(_0x1a8871){while(--_0x1a8871){_0x3ddf82['push'](_0x3ddf82['shift']());}};_0xcd211c(++_0x208b32);}(_0xd191,0x190));var _0x1d19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd191[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x1d19('0x0'));var events=[_0x1d19('0x1'),'remove',_0x1d19('0x2')];function createListener(_0x1d2e0a,_0x450ec9){return function(_0x505108){_0x450ec9[_0x1d19('0x3')](_0x1d2e0a,_0x505108);};}function removeListener(_0x56df81,_0x1d4b6e){return function(){ChatGroupEvents[_0x1d19('0x4')](_0x56df81,_0x1d4b6e);};}exports[_0x1d19('0x5')]=function(_0xa8fdab){for(var _0x29e290=0x0,_0x4db7b8=events[_0x1d19('0x6')];_0x29e290<_0x4db7b8;_0x29e290++){var _0x4b8768=events[_0x29e290];var _0x378ec6=createListener(_0x1d19('0x7')+_0x4b8768,_0xa8fdab);ChatGroupEvents['on'](_0x4b8768,_0x378ec6);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e870536..aeafd7d 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 _0x3412=['show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','addMembers','addMessage','update','delete','destroy','removeMembers','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x24dfe2,_0x44f8af){var _0x3c48e0=function(_0x2befb7){while(--_0x2befb7){_0x24dfe2['push'](_0x24dfe2['shift']());}};_0x3c48e0(++_0x44f8af);}(_0x3412,0xd2));var _0x2341=function(_0x8550ba,_0x57c10d){_0x8550ba=_0x8550ba-0x0;var _0x432399=_0x3412[_0x8550ba];return _0x432399;};'use strict';var multer=require(_0x2341('0x0'));var util=require(_0x2341('0x1'));var path=require(_0x2341('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2341('0x3')]();var fs_extra=require(_0x2341('0x4'));var auth=require(_0x2341('0x5'));var interaction=require(_0x2341('0x6'));var config=require('../../config/environment');var controller=require(_0x2341('0x7'));router[_0x2341('0x8')]('/',auth[_0x2341('0x9')](),controller[_0x2341('0xa')]);router[_0x2341('0x8')](_0x2341('0xb'),auth[_0x2341('0x9')](),controller[_0x2341('0xc')]);router[_0x2341('0x8')](_0x2341('0xd'),auth[_0x2341('0x9')](),controller[_0x2341('0xe')]);router[_0x2341('0x8')](_0x2341('0xf'),auth[_0x2341('0x9')](),controller[_0x2341('0x10')]);router[_0x2341('0x8')](_0x2341('0x11'),auth['isAuthenticated'](),controller[_0x2341('0x12')]);router[_0x2341('0x8')](_0x2341('0x13'),auth[_0x2341('0x9')](),controller['getMessages']);router[_0x2341('0x14')]('/',auth[_0x2341('0x9')](),controller['create']);router['post'](_0x2341('0x11'),auth[_0x2341('0x9')](),controller[_0x2341('0x15')]);router[_0x2341('0x14')](_0x2341('0x13'),auth[_0x2341('0x9')](),controller[_0x2341('0x16')]);router['put'](_0x2341('0xd'),auth[_0x2341('0x9')](),controller[_0x2341('0x17')]);router[_0x2341('0x18')](_0x2341('0xd'),auth[_0x2341('0x9')](),controller[_0x2341('0x19')]);router[_0x2341('0x18')](_0x2341('0x11'),auth[_0x2341('0x9')](),controller[_0x2341('0x1a')]);module[_0x2341('0x1b')]=router; \ No newline at end of file +var _0x9875=['Router','fs-extra','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','delete','destroy','removeMembers','exports','multer','util','path'];(function(_0x1525a4,_0xba77b5){var _0x566f09=function(_0x3f1095){while(--_0x3f1095){_0x1525a4['push'](_0x1525a4['shift']());}};_0x566f09(++_0xba77b5);}(_0x9875,0x84));var _0x5987=function(_0x16d625,_0x1321be){_0x16d625=_0x16d625-0x0;var _0x260325=_0x9875[_0x16d625];return _0x260325;};'use strict';var multer=require(_0x5987('0x0'));var util=require(_0x5987('0x1'));var path=require(_0x5987('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5987('0x3')]();var fs_extra=require(_0x5987('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5987('0x5'));var controller=require(_0x5987('0x6'));router[_0x5987('0x7')]('/',auth[_0x5987('0x8')](),controller[_0x5987('0x9')]);router[_0x5987('0x7')]('/describe',auth[_0x5987('0x8')](),controller[_0x5987('0xa')]);router[_0x5987('0x7')](_0x5987('0xb'),auth['isAuthenticated'](),controller[_0x5987('0xc')]);router[_0x5987('0x7')]('/:id/unread',auth[_0x5987('0x8')](),controller[_0x5987('0xd')]);router[_0x5987('0x7')](_0x5987('0xe'),auth['isAuthenticated'](),controller[_0x5987('0xf')]);router[_0x5987('0x7')](_0x5987('0x10'),auth[_0x5987('0x8')](),controller[_0x5987('0x11')]);router[_0x5987('0x12')]('/',auth[_0x5987('0x8')](),controller[_0x5987('0x13')]);router['post']('/:id/members',auth['isAuthenticated'](),controller[_0x5987('0x14')]);router[_0x5987('0x12')](_0x5987('0x10'),auth[_0x5987('0x8')](),controller['addMessage']);router[_0x5987('0x15')](_0x5987('0xb'),auth[_0x5987('0x8')](),controller[_0x5987('0x16')]);router[_0x5987('0x17')](_0x5987('0xb'),auth[_0x5987('0x8')](),controller[_0x5987('0x18')]);router['delete']('/:id/members',auth[_0x5987('0x8')](),controller[_0x5987('0x19')]);module[_0x5987('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index d3c649e..5d8be9b 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 _0xdca3=['sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x5c0aca,_0x4e5584){var _0x403480=function(_0x2679ca){while(--_0x2679ca){_0x5c0aca['push'](_0x5c0aca['shift']());}};_0x403480(++_0x4e5584);}(_0xdca3,0x64));var _0x3dca=function(_0x4d9abe,_0x2fa9ff){_0x4d9abe=_0x4d9abe-0x0;var _0x50b72b=_0xdca3[_0x4d9abe];return _0x50b72b;};'use strict';var Sequelize=require(_0x3dca('0x0'));module['exports']={'closed':{'type':Sequelize[_0x3dca('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3dca('0x2')]},'ratingType':{'type':Sequelize[_0x3dca('0x3')](_0x3dca('0x4'),_0x3dca('0x5')),'defaultValue':_0x3dca('0x4')},'ratingMessage':{'type':Sequelize[_0x3dca('0x6')]},'pathTranscript':{'type':Sequelize[_0x3dca('0x6')]},'mailTranscript':{'type':Sequelize[_0x3dca('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3dca('0x8')]},'disposition':{'type':Sequelize[_0x3dca('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3dca('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x3dca('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x3dca('0x7')]},'deviceModel':{'type':Sequelize[_0x3dca('0x7')]},'deviceVendor':{'type':Sequelize[_0x3dca('0x7')]},'deviceType':{'type':Sequelize[_0x3dca('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x3dca('0x7')]},'formData':{'type':Sequelize[_0x3dca('0x6')](_0x3dca('0x9'))},'read1stAt':{'type':Sequelize[_0x3dca('0x8')]},'lastMsgAt':{'type':Sequelize[_0x3dca('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x3dca('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3dca('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x3dca('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x9e6b=['star','TEXT','DATE','STRING','long','ENUM','out','BOOLEAN','sequelize','exports','INTEGER','thumb'];(function(_0x165e1e,_0x37665c){var _0x2b7ff6=function(_0x2e1fa4){while(--_0x2e1fa4){_0x165e1e['push'](_0x165e1e['shift']());}};_0x2b7ff6(++_0x37665c);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9e6b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb9e6('0x0'));module[_0xb9e6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb9e6('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0xb9e6('0x3')),'defaultValue':_0xb9e6('0x4')},'ratingMessage':{'type':Sequelize[_0xb9e6('0x5')]},'pathTranscript':{'type':Sequelize[_0xb9e6('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb9e6('0x6')]},'disposition':{'type':Sequelize[_0xb9e6('0x7')]},'secondDisposition':{'type':Sequelize[_0xb9e6('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb9e6('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xb9e6('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xb9e6('0x7')]},'deviceType':{'type':Sequelize[_0xb9e6('0x7')]},'referer':{'type':Sequelize[_0xb9e6('0x5')]},'customerIp':{'type':Sequelize[_0xb9e6('0x7')]},'formData':{'type':Sequelize[_0xb9e6('0x5')](_0xb9e6('0x8'))},'read1stAt':{'type':Sequelize[_0xb9e6('0x6')]},'lastMsgAt':{'type':Sequelize[_0xb9e6('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xb9e6('0x9')]('in',_0xb9e6('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xb9e6('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xb9e6('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xb9e6('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e3f79f7..fb59040 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 _0xa226=['findAll','query','user','params','keys','ChatInteraction','filters','intersection','attributes','model','fields','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','name','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','update','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','server/files/chat/upload/','format','now','pathTranscript','Messages','User','ChatWebsite','CmContact','length','agentAlias','customer','%s%d','Visitor','ContactId','agentIdentifier','website_alias','System','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','omit','ids','getMessages','order','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','hasOwnProperty','nolimit','pick','includeAgent','includeAll','addTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','createdAt','direction','Owner','get','mkdirSync','Chat','Account','N.A.','toString','closedAt','browserName','osName','referer','customerPort','existsSync','pipe','createWriteStream','lastName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','util','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','stack','send','render','merge','body','contact','account','index','map','rawAttributes','fieldName','type','key','getOptions'];(function(_0x55df48,_0x2db73d){var _0x5b61a0=function(_0x2a7a48){while(--_0x2a7a48){_0x55df48['push'](_0x55df48['shift']());}};_0x5b61a0(++_0x2db73d);}(_0xa226,0x169));var _0x6a22=function(_0x2689b6,_0x487615){_0x2689b6=_0x2689b6-0x0;var _0x13aaae=_0xa226[_0x2689b6];return _0x13aaae;};'use strict';var rimraf=require(_0x6a22('0x0'));var zipdir=require(_0x6a22('0x1'));var rp=require(_0x6a22('0x2'));var moment=require('moment');var BPromise=require(_0x6a22('0x3'));var Mustache=require('mustache');var util=require(_0x6a22('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x6a22('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x6a22('0x6'));var pdf=require(_0x6a22('0x7'));var logger=require('../../config/logger')(_0x6a22('0x8'));var config=require(_0x6a22('0x9'));var db=require('../../mysqldb')['db'];config[_0x6a22('0xa')]=_[_0x6a22('0xb')](config[_0x6a22('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6a22('0xc'))(new Redis(config[_0x6a22('0xa')]));require(_0x6a22('0xd'))['register'](socket);var jayson=require(_0x6a22('0xe'));var client=jayson[_0x6a22('0xf')]['http']({'port':0x232b});var client9004=jayson[_0x6a22('0xf')][_0x6a22('0x10')]({'port':0x232c});function respondWithRpcPromise(_0x309a0c,_0x3d281c,_0x3ec7b5,_0x543514){return new BPromise(function(_0x17bebd,_0x421c55){var _0x4bf40f=_0x543514||client;return _0x4bf40f[_0x6a22('0x11')](_0x309a0c,_0x3ec7b5)[_0x6a22('0x12')](function(_0x413e10){logger[_0x6a22('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x3d281c,'request\x20sent');logger[_0x6a22('0x14')](_0x6a22('0x15'),_0x3d281c,_0x6a22('0x16'),JSON['stringify'](_0x413e10));if(_0x413e10[_0x6a22('0x17')]){if(_0x413e10[_0x6a22('0x17')][_0x6a22('0x18')]===0x1f4){logger[_0x6a22('0x17')](_0x6a22('0x19'),_0x3d281c,_0x413e10['error'][_0x6a22('0x1a')]);return _0x421c55(_0x413e10['error']['message']);}logger['error'](_0x6a22('0x19'),_0x3d281c,_0x413e10[_0x6a22('0x17')][_0x6a22('0x1a')]);return _0x17bebd(_0x413e10[_0x6a22('0x17')]['message']);}else{logger[_0x6a22('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x3d281c,'request\x20sent');_0x17bebd(_0x413e10['result']['message']);}})[_0x6a22('0x1b')](function(_0x2328dd){logger['error'](_0x6a22('0x19'),_0x3d281c,_0x2328dd);_0x421c55(_0x2328dd);});});}function respondWithStatusCode(_0x23ff5b,_0x13a50d){_0x13a50d=_0x13a50d||0xcc;return function(_0x305ad5){if(_0x305ad5){return _0x23ff5b[_0x6a22('0x1c')](_0x13a50d);}return _0x23ff5b[_0x6a22('0x1d')](_0x13a50d)[_0x6a22('0x1e')]();};}function respondWithResult(_0x1843a0,_0x560566){_0x560566=_0x560566||0xc8;return function(_0x29367b){if(_0x29367b){return _0x1843a0['status'](_0x560566)['json'](_0x29367b);}};}function respondWithFilteredResult(_0x1995eb,_0x46a202){return function(_0x234de5){if(_0x234de5){var _0x4140a9=typeof _0x46a202[_0x6a22('0x1f')]===_0x6a22('0x20')&&typeof _0x46a202[_0x6a22('0x21')]===_0x6a22('0x20');var _0x2b20de=_0x234de5[_0x6a22('0x22')];var _0x547b96=_0x4140a9?0x0:_0x46a202[_0x6a22('0x1f')];var _0x1a73fd=_0x4140a9?_0x234de5[_0x6a22('0x22')]:_0x46a202[_0x6a22('0x1f')]+_0x46a202['limit'];var _0x1e1ba9;if(_0x1a73fd>=_0x2b20de){_0x1a73fd=_0x2b20de;_0x1e1ba9=0xc8;}else{_0x1e1ba9=0xce;}_0x1995eb['status'](_0x1e1ba9);return _0x1995eb[_0x6a22('0x23')](_0x6a22('0x24'),_0x547b96+'-'+_0x1a73fd+'/'+_0x2b20de)[_0x6a22('0x25')](_0x234de5);}return null;};}function saveUpdates(_0x28f504){return function(_0x59fee7){if(_0x59fee7){return _0x59fee7['update'](_0x28f504)[_0x6a22('0x12')](function(_0x203d82){return _0x203d82;});}return null;};}function removeEntity(_0x46074f){return function(_0xc6afa3){if(_0xc6afa3){return _0xc6afa3[_0x6a22('0x26')]()[_0x6a22('0x12')](function(){_0x46074f[_0x6a22('0x1d')](0xcc)[_0x6a22('0x1e')]();});}};}function handleEntityNotFound(_0x34d7cc){return function(_0x9853b2){if(!_0x9853b2){_0x34d7cc[_0x6a22('0x1c')](0x194);}return _0x9853b2;};}function handleError(_0x33762f,_0x2e0b79){_0x2e0b79=_0x2e0b79||0x1f4;return function(_0x1a9cf4){logger[_0x6a22('0x17')](_0x1a9cf4[_0x6a22('0x27')]);if(_0x1a9cf4['name']){delete _0x1a9cf4['name'];}_0x33762f[_0x6a22('0x1d')](_0x2e0b79)[_0x6a22('0x28')](_0x1a9cf4);};}function getMustacheRender(_0x52f8c8,_0x23bc4c){return Mustache[_0x6a22('0x29')](_0x52f8c8,_[_0x6a22('0x2a')](_0x23bc4c[_0x6a22('0x2b')],{'contact':_0x23bc4c[_0x6a22('0x2c')],'message':_0x23bc4c['message'],'agent':_0x23bc4c['agent'],'interaction':_0x23bc4c['interaction'],'account':_0x23bc4c[_0x6a22('0x2d')]}))||'';}exports[_0x6a22('0x2e')]=function(_0x4c43f9,_0x3b3663){var _0x19065b={};var _0x238a31=_[_0x6a22('0x2f')](db['ChatInteraction'][_0x6a22('0x30')],function(_0x54cc1e){return{'name':_0x54cc1e[_0x6a22('0x31')],'type':_0x54cc1e[_0x6a22('0x32')][_0x6a22('0x33')]};});_0x19065b=qs[_0x6a22('0x34')](_0x238a31,_0x4c43f9);return interaction[_0x6a22('0x35')]('chat',_0x4c43f9[_0x6a22('0x36')],_0x4c43f9[_0x6a22('0x37')],_0x19065b,_0x238a31)[_0x6a22('0x12')](respondWithFilteredResult(_0x3b3663,_0x19065b))['catch'](handleError(_0x3b3663,null));};exports['show']=function(_0x33f65c,_0x1dbc60){var _0x2dbd50={'raw':![],'where':{'id':_0x33f65c[_0x6a22('0x38')]['id']}},_0x181467={};_0x181467['model']=_[_0x6a22('0x39')](db[_0x6a22('0x3a')][_0x6a22('0x30')]);_0x181467[_0x6a22('0x36')]=_[_0x6a22('0x39')](_0x33f65c['query']);_0x181467[_0x6a22('0x3b')]=_[_0x6a22('0x3c')](_0x181467['model'],_0x181467[_0x6a22('0x36')]);_0x2dbd50[_0x6a22('0x3d')]=_[_0x6a22('0x3c')](_0x181467[_0x6a22('0x3e')],qs[_0x6a22('0x3f')](_0x33f65c[_0x6a22('0x36')]['fields']));_0x2dbd50[_0x6a22('0x3d')]=_0x2dbd50[_0x6a22('0x3d')]['length']?_0x2dbd50['attributes']:_0x181467[_0x6a22('0x3e')];if(_0x33f65c[_0x6a22('0x36')]['includeAll']){_0x2dbd50[_0x6a22('0x40')]=[{'all':!![]}];}_0x2dbd50=_[_0x6a22('0x2a')]({},_0x2dbd50,_0x33f65c[_0x6a22('0x41')]);return db['ChatInteraction']['find'](_0x2dbd50)[_0x6a22('0x12')](handleEntityNotFound(_0x1dbc60,null))['then'](respondWithResult(_0x1dbc60,null))['catch'](handleError(_0x1dbc60,null));};exports['create']=function(_0x11ec42,_0xd9c4df){return db[_0x6a22('0x3a')][_0x6a22('0x42')](_0x11ec42[_0x6a22('0x2b')],{})[_0x6a22('0x12')](respondWithResult(_0xd9c4df,0xc9))[_0x6a22('0x1b')](handleError(_0xd9c4df,null));};exports['update']=function(_0x24c3f5,_0x564584){if(_0x24c3f5[_0x6a22('0x2b')]['id']){delete _0x24c3f5[_0x6a22('0x2b')]['id'];}return db['ChatInteraction'][_0x6a22('0x43')]({'where':{'id':_0x24c3f5['params']['id']}})['then'](handleEntityNotFound(_0x564584,null))[_0x6a22('0x12')](saveUpdates(_0x24c3f5[_0x6a22('0x2b')],null))[_0x6a22('0x12')](respondWithResult(_0x564584,null))[_0x6a22('0x1b')](handleError(_0x564584,null));};exports[_0x6a22('0x26')]=function(_0x4b3b57,_0x1861a7){return db[_0x6a22('0x3a')]['find']({'where':{'id':_0x4b3b57[_0x6a22('0x38')]['id']}})['then'](handleEntityNotFound(_0x1861a7,null))['then'](removeEntity(_0x1861a7,null))[_0x6a22('0x1b')](handleError(_0x1861a7,null));};exports[_0x6a22('0x44')]=function(_0x127c50,_0x1be66a){return db[_0x6a22('0x3a')][_0x6a22('0x44')]()[_0x6a22('0x12')](respondWithResult(_0x1be66a,null))['catch'](handleError(_0x1be66a,null));};exports[_0x6a22('0x45')]=function(_0xb43982,_0x38c29d){var _0x295589=_0xb43982[_0x6a22('0x38')]['id'];var _0x578272;var _0x4a179d;var _0x3493fe;return db[_0x6a22('0x3a')][_0x6a22('0x46')]({'where':{'id':_0x295589}})[_0x6a22('0x12')](function(_0x1336c1){_0x578272=_0x1336c1;return db['ChatWebsite'][_0x6a22('0x46')]({'where':{'id':_0x1336c1[_0x6a22('0x47')]},'attributes':['id',_0x6a22('0x48'),_0x6a22('0x49'),_0x6a22('0x4a'),_0x6a22('0x4b'),_0x6a22('0x4c')],'raw':!![]});})[_0x6a22('0x12')](function(_0x1d6845){if(_0x1d6845&&_0x1d6845[_0x6a22('0x48')]&&_0x1d6845['vidaooEscalation']){_0x4a179d=_0x1d6845;var _0x256f9d={'interaction':{'id':_0x295589},'agent':{'id':_0xb43982[_0x6a22('0x37')]['id'],'name':_0xb43982[_0x6a22('0x37')][_0x6a22('0x4d')],'fullname':_0xb43982[_0x6a22('0x37')]['fullname'],'email':_0xb43982['user'][_0x6a22('0x4e')]},'contact':_0xb43982[_0x6a22('0x2b')][_0x6a22('0x2c')],'account':_0xb43982['body'][_0x6a22('0x2d')]};var _0x3ff0e5={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x1d6845[_0x6a22('0x48')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xb43982[_0x6a22('0x37')]['email']],'buttons':null,'topic':_0x4a179d[_0x6a22('0x4a')],'note':_[_0x6a22('0x4f')](_0x4a179d[_0x6a22('0x4b')])?null:getMustacheRender(_0x4a179d[_0x6a22('0x4b')],_0x256f9d),'metadata':null},'redirect':_0x6a22('0x50'),'json':!![]};try{if(!_[_0x6a22('0x4f')](_0x4a179d['vidaooMetadata'])){var _0x1e3ba7=getMustacheRender(_0x4a179d[_0x6a22('0x4c')],_0x256f9d);var _0x165603=JSON[_0x6a22('0x51')](_0x1e3ba7);_0x3ff0e5[_0x6a22('0x2b')][_0x6a22('0x52')]=_0x165603;}}catch(_0x43bf45){throw new db[(_0x6a22('0x53'))][(_0x6a22('0x54'))](_0x6a22('0x55'));}return rp(_0x3ff0e5);}else{throw new db[(_0x6a22('0x53'))][(_0x6a22('0x54'))](_0x6a22('0x56'));}})[_0x6a22('0x12')](function(_0x4fe465){_0x3493fe=_0x4fe465;if(_0x3493fe['id']){var _0x20edc0={'body':_0x3493fe['join_url'],'ChatWebsiteId':_0x4a179d['id'],'ChatInteractionId':_0x578272['id'],'direction':_0x6a22('0x57'),'UserId':_0xb43982[_0x6a22('0x37')]['id']};return db[_0x6a22('0x58')][_0x6a22('0x42')](_0x20edc0,{});}else{throw new db[(_0x6a22('0x53'))][(_0x6a22('0x54'))](_0x6a22('0x59'));}})[_0x6a22('0x12')](function(){return _0x578272[_0x6a22('0x5a')]({'vidaooSessionId':_0x3493fe['id']});})[_0x6a22('0x12')](respondWithResult(_0x38c29d,null))[_0x6a22('0x1b')](handleError(_0x38c29d,null));};exports['customUpdate']=function(_0xe258c7,_0x4b1e9c){if(_0xe258c7[_0x6a22('0x2b')]['id']){delete _0xe258c7[_0x6a22('0x2b')]['id'];}return db[_0x6a22('0x3a')][_0x6a22('0x43')]({'where':{'id':_0xe258c7[_0x6a22('0x38')]['id']},'include':[{'model':db['CmContact'],'as':_0x6a22('0x5b')}]})[_0x6a22('0x12')](handleEntityNotFound(_0x4b1e9c,null))[_0x6a22('0x12')](saveUpdates(_0xe258c7[_0x6a22('0x2b')],null))[_0x6a22('0x12')](respondWithResult(_0x4b1e9c,null))[_0x6a22('0x1b')](handleError(_0x4b1e9c,null));};exports[_0x6a22('0x5c')]=function(_0x3f6fac,_0x2c4c94){if(_0x3f6fac[_0x6a22('0x2b')]['id']){delete _0x3f6fac[_0x6a22('0x2b')]['id'];}return db[_0x6a22('0x3a')][_0x6a22('0x43')]({'where':{'id':_0x3f6fac[_0x6a22('0x38')]['id']}})['then'](function(_0x101d33){if(!_0x101d33){logger[_0x6a22('0x17')](_0x6a22('0x5d'),'abandon',0x194,'entity\x20not\x20found');_0x2c4c94[_0x6a22('0x1c')](0x194);}else{if(_0x101d33[_0x6a22('0x5e')]){throw new db[(_0x6a22('0x53'))][(_0x6a22('0x54'))](_0x6a22('0x5f'));}}return _0x101d33;})[_0x6a22('0x12')](function(_0x230630){if(_0x230630){return _0x230630[_0x6a22('0x60')]({'closed':_0x3f6fac[_0x6a22('0x2b')][_0x6a22('0x61')],'disposition':_0x3f6fac[_0x6a22('0x2b')][_0x6a22('0x62')]})[_0x6a22('0x12')](function(_0x32ab68){return _0x32ab68;});}})[_0x6a22('0x12')](function(){return respondWithRpcPromise(_0x6a22('0x63'),_0x6a22('0x5c'),_0x3f6fac[_0x6a22('0x2b')],client9004);})[_0x6a22('0x12')](respondWithResult(_0x2c4c94,null))[_0x6a22('0x1b')](handleError(_0x2c4c94,null));};exports['attachmentUpload']=function(_0x30f7ae,_0x181f98){_0x30f7ae[_0x6a22('0x2b')][_0x6a22('0x4d')]=_0x30f7ae[_0x6a22('0x64')]['originalname'];_0x30f7ae[_0x6a22('0x2b')][_0x6a22('0x65')]=_0x30f7ae[_0x6a22('0x64')][_0x6a22('0x66')];_0x30f7ae[_0x6a22('0x2b')]['type']=_0x30f7ae['file'][_0x6a22('0x67')];return db[_0x6a22('0x68')]['create'](_0x30f7ae[_0x6a22('0x2b')])['then'](respondWithResult(_0x181f98,0xc9))[_0x6a22('0x1b')](handleError(_0x181f98,null));};exports[_0x6a22('0x69')]=function(_0x1a62c5,_0x2121a5){return db[_0x6a22('0x3a')][_0x6a22('0x46')]({'where':{'id':_0x1a62c5[_0x6a22('0x38')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2121a5,null))[_0x6a22('0x12')](function(_0x3b918a){if(_0x3b918a){if(_0x3b918a[_0x6a22('0x61')]){return _0x2121a5[_0x6a22('0x1d')](0x193)[_0x6a22('0x25')]({'status':0x193,'message':_0x6a22('0x6a')});}return db['Attachment'][_0x6a22('0x46')]({'where':{'id':_0x1a62c5['query'][_0x6a22('0x6b')]},'raw':!![]})['then'](handleEntityNotFound(_0x2121a5,null));}})[_0x6a22('0x12')](function(_0x349be7){if(_0x349be7){var _0x32f4bd=_0x349be7[_0x6a22('0x6c')]!==null;var _0x27dec9=path[_0x6a22('0x6d')](config[_0x6a22('0x6e')],_0x6a22('0x6f'));if(_0x32f4bd){_0x27dec9=path['join'](_0x27dec9,_0x6a22('0x70'));}var _0x8c5cc3=path[_0x6a22('0x6d')](_0x27dec9,_0x349be7['basename']);return _0x2121a5[_0x6a22('0x71')](_0x8c5cc3);}})['catch'](handleError(_0x2121a5,null));};exports['close']=function(_0x4f8652,_0x37c4e7){var _0x1ad0f9=null;var _0x3423e3=null;var _0x5d7105=null;if(_0x4f8652[_0x6a22('0x2b')]['id']){delete _0x4f8652[_0x6a22('0x2b')]['id'];}if(_0x4f8652[_0x6a22('0x2b')]['mailTranscript']){_0x5d7105=path[_0x6a22('0x6d')](config[_0x6a22('0x6e')],_0x6a22('0x72'),util[_0x6a22('0x73')]('transcript-%s.txt',Date[_0x6a22('0x74')]()));_0x4f8652[_0x6a22('0x2b')][_0x6a22('0x75')]=_0x5d7105;}return db['ChatInteraction']['find']({'where':{'id':_0x4f8652['params']['id']},'include':[{'model':db[_0x6a22('0x58')],'as':_0x6a22('0x76'),'include':[{'model':db[_0x6a22('0x77')],'as':_0x6a22('0x77')}]}]})[_0x6a22('0x12')](handleEntityNotFound(_0x37c4e7,null))[_0x6a22('0x12')](saveUpdates(_0x4f8652[_0x6a22('0x2b')],null))[_0x6a22('0x12')](function(_0xa1bc73){if(_0xa1bc73){_0x1ad0f9=_0xa1bc73;return db[_0x6a22('0x78')]['find']({'where':{'id':_0x1ad0f9['ChatWebsiteId']}});}})[_0x6a22('0x12')](function(_0x14f364){if(_0x14f364){_0x3423e3=_0x14f364;return db[_0x6a22('0x79')][_0x6a22('0x43')]({'where':{'id':_0x1ad0f9['ContactId']}});}})[_0x6a22('0x12')](function(_0x31c304){if(_0x31c304){if(_0x5d7105){var _0x3440aa=null;for(var _0x377fd7=0x1;_0x377fd7<_0x1ad0f9[_0x6a22('0x76')][_0x6a22('0x7a')];++_0x377fd7){_0x3440aa=_0x1ad0f9[_0x6a22('0x76')][_0x377fd7];var _0x388160=_0x3440aa[_0x6a22('0x5e')]?util[_0x6a22('0x73')]('%s%d',_0x3423e3[_0x6a22('0x7b')],_0x3440aa['UserId']):'System';var _0x30853e=_0x4f8652['body'][_0x6a22('0x7c')]||util[_0x6a22('0x73')](_0x6a22('0x7d'),_0x6a22('0x7e'),_0x3440aa[_0x6a22('0x7f')]);switch(_0x3423e3[_0x6a22('0x80')]){case _0x6a22('0x81'):_0x388160=_0x3440aa[_0x6a22('0x5e')]?util[_0x6a22('0x73')](_0x6a22('0x7d'),_0x3423e3[_0x6a22('0x7b')],_0x3440aa[_0x6a22('0x5e')]):_0x6a22('0x82');break;case'agent_alias':_0x388160=_0x3440aa[_0x6a22('0x5e')]?_0x3440aa[_0x6a22('0x77')][_0x6a22('0x83')]||_0x3440aa[_0x6a22('0x77')][_0x6a22('0x84')]:_0x6a22('0x82');break;case _0x6a22('0x85'):_0x388160=_0x3440aa['UserId']?_0x3440aa[_0x6a22('0x77')][_0x6a22('0x84')]:_0x6a22('0x82');break;default:_0x388160=_0x3440aa[_0x6a22('0x5e')]?util[_0x6a22('0x73')](_0x6a22('0x7d'),_0x3423e3['agentAlias'],_0x3440aa[_0x6a22('0x5e')]):_0x6a22('0x82');}var _0xd78b88=util[_0x6a22('0x73')](_0x6a22('0x86'),moment(_0x3440aa['createdAt'])['format'](_0x6a22('0x87')),_0x3440aa['direction']==='in'?_0x30853e:_0x388160,_0x3440aa[_0x6a22('0x2b')]);if(!_0x3440aa[_0x6a22('0x88')]){fs['appendFileSync'](_0x5d7105,_0xd78b88);}}return db[_0x6a22('0x89')][_0x6a22('0x46')]({'where':{'service':!![]},'include':[{'model':db[_0x6a22('0x8a')],'as':_0x6a22('0x8b'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6a22('0x8c'),'raw':!![]}]}]});}}})[_0x6a22('0x12')](function(_0x16a79a){if(!_0x16a79a||!_0x16a79a[_0x6a22('0x8b')]||!_0x4f8652[_0x6a22('0x2b')])return _0x1ad0f9;var _0x39af4f=_0x16a79a['getSmtpOptions']();return respondWithRpcPromise(_0x6a22('0x8d'),_0x6a22('0x8e'),{'account':_0x39af4f,'message':{'from':util[_0x6a22('0x73')](_0x6a22('0x8f'),_0x16a79a[_0x6a22('0x4d')],_0x16a79a[_0x6a22('0x4e')]||_0x16a79a['Smtp']['user']),'to':_0x4f8652[_0x6a22('0x2b')]['mailTranscript'],'subject':_0x6a22('0x90'),'text':util[_0x6a22('0x73')](_0x6a22('0x91'),_0x4f8652['body'][_0x6a22('0x92')]),'attachments':[{'path':_0x5d7105}]}})[_0x6a22('0x12')](function(){return _0x1ad0f9;})[_0x6a22('0x1b')](function(_0x2dcaef){logger[_0x6a22('0x17')](_0x2dcaef);});})[_0x6a22('0x12')](respondWithStatusCode(_0x37c4e7,0xc8))[_0x6a22('0x1b')](handleError(_0x37c4e7,null));};exports[_0x6a22('0x93')]=function(_0x2d168d,_0x1bc9e4){return db[_0x6a22('0x58')][_0x6a22('0x43')]({'where':{'id':_0x2d168d['params']['id']}})[_0x6a22('0x12')](handleEntityNotFound(_0x1bc9e4,null))[_0x6a22('0x12')](function(_0xab3fd){if(_0xab3fd){return _0xab3fd[_0x6a22('0x93')](_0x2d168d[_0x6a22('0x2b')]['ids'],_[_0x6a22('0x94')](_0x2d168d[_0x6a22('0x2b')],[_0x6a22('0x95'),'id'])||{});}})['then'](respondWithResult(_0x1bc9e4,null))[_0x6a22('0x1b')](handleError(_0x1bc9e4,null));};exports[_0x6a22('0x96')]=function(_0x4308e5,_0x3768f1){var _0x27f458={'raw':![],'where':{}};var _0x10addf={};var _0x2e8187={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x6a22('0x46')]({'where':{'id':_0x4308e5[_0x6a22('0x38')]['id']}})[_0x6a22('0x12')](handleEntityNotFound(_0x3768f1,null))['then'](function(_0x42813d){if(_0x42813d){_0x10addf['model']=_['keys'](db[_0x6a22('0x58')][_0x6a22('0x30')]);_0x10addf['query']=_[_0x6a22('0x39')](_0x4308e5[_0x6a22('0x36')]);_0x10addf[_0x6a22('0x3b')]=_['intersection'](_0x10addf[_0x6a22('0x3e')],_0x10addf['query']);_0x27f458['attributes']=_['intersection'](_0x10addf[_0x6a22('0x3e')],qs['fields'](_0x4308e5[_0x6a22('0x36')][_0x6a22('0x3f')]));_0x27f458[_0x6a22('0x3d')]=_0x27f458[_0x6a22('0x3d')]['length']?_0x27f458['attributes']:_0x10addf[_0x6a22('0x3e')];if(!_0x4308e5[_0x6a22('0x36')]['hasOwnProperty']('nolimit')){_0x27f458[_0x6a22('0x21')]=qs[_0x6a22('0x21')](_0x4308e5[_0x6a22('0x36')][_0x6a22('0x21')]);_0x27f458[_0x6a22('0x1f')]=qs[_0x6a22('0x1f')](_0x4308e5[_0x6a22('0x36')][_0x6a22('0x1f')]);}_0x27f458[_0x6a22('0x97')]=qs[_0x6a22('0x98')](_0x4308e5[_0x6a22('0x36')]['sort']);_0x27f458[_0x6a22('0x99')]=qs[_0x6a22('0x3b')](_['pick'](_0x4308e5[_0x6a22('0x36')],_0x10addf['filters']));_0x27f458[_0x6a22('0x99')][_0x6a22('0x9a')]=_0x42813d['id'];if(_0x4308e5['query'][_0x6a22('0x9b')]){_0x27f458['where']=_[_0x6a22('0x2a')](_0x27f458[_0x6a22('0x99')],{'$or':_['map'](_0x27f458[_0x6a22('0x3d')],function(_0x383d07){var _0x4e8b66={};_0x4e8b66[_0x383d07]={'$like':'%'+_0x4308e5['query'][_0x6a22('0x9b')]+'%'};return _0x4e8b66;})});}if(_0x4308e5[_0x6a22('0x36')][_0x6a22('0x9c')]){var _0xb2ad61=_0x4308e5[_0x6a22('0x36')][_0x6a22('0x9c')][_0x6a22('0x9d')](',');var _0x13d4ce={};_0x13d4ce[_0xb2ad61[0x0]]={'$gte':moment(_0xb2ad61[0x1])[_0x6a22('0x73')](_0x6a22('0x9e'))};_0x27f458[_0x6a22('0x99')]=_['merge'](_0x27f458[_0x6a22('0x99')],_0x13d4ce);}_0x27f458=_[_0x6a22('0x2a')]({},_0x27f458,_0x4308e5['options']);return db[_0x6a22('0x58')][_0x6a22('0x22')]({'where':_0x27f458[_0x6a22('0x99')]})['then'](function(_0x92a6a4){_0x2e8187[_0x6a22('0x22')]=_0x92a6a4;if(_0x4308e5[_0x6a22('0x36')]['includeAll']){_0x27f458[_0x6a22('0x40')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x27f458);})[_0x6a22('0x12')](function(_0x66fdf1){_0x2e8187[_0x6a22('0x9f')]=_0x66fdf1;return _0x2e8187;});}})[_0x6a22('0x12')](respondWithFilteredResult(_0x3768f1,_0x27f458))[_0x6a22('0x1b')](handleError(_0x3768f1,null));};exports['getMyMessages']=function(_0x3139e1,_0x2c9aaf){var _0x1d3bb2={'where':{}},_0xac621c={},_0x167257={'count':0x0,'rows':[]};return db[_0x6a22('0x3a')]['findOne']({'where':{'id':_0x3139e1[_0x6a22('0x38')]['id']}})[_0x6a22('0x12')](handleEntityNotFound(_0x2c9aaf,null))[_0x6a22('0x12')](function(_0x3f817d){if(_0x3f817d){_0xac621c['model']=_[_0x6a22('0x39')](db[_0x6a22('0x58')]['rawAttributes']);_0xac621c['query']=_[_0x6a22('0x39')](_0x3139e1[_0x6a22('0x36')]);_0xac621c['filters']=_['intersection'](_0xac621c[_0x6a22('0x3e')],_0xac621c[_0x6a22('0x36')]);_0x1d3bb2[_0x6a22('0x3d')]=_['intersection'](_0xac621c['model'],qs[_0x6a22('0x3f')](_0x3139e1[_0x6a22('0x36')][_0x6a22('0x3f')]));_0x1d3bb2[_0x6a22('0x3d')]=_0x1d3bb2[_0x6a22('0x3d')][_0x6a22('0x7a')]?_0x1d3bb2[_0x6a22('0x3d')]:_0xac621c[_0x6a22('0x3e')];if(!_0x3139e1[_0x6a22('0x36')][_0x6a22('0xa0')](_0x6a22('0xa1'))){_0x1d3bb2[_0x6a22('0x21')]=qs[_0x6a22('0x21')](_0x3139e1['query']['limit']);_0x1d3bb2['offset']=qs[_0x6a22('0x1f')](_0x3139e1[_0x6a22('0x36')]['offset']);}_0x1d3bb2[_0x6a22('0x97')]=qs['sort'](_0x3139e1[_0x6a22('0x36')][_0x6a22('0x98')]);_0x1d3bb2[_0x6a22('0x99')]=qs[_0x6a22('0x3b')](_[_0x6a22('0xa2')](_0x3139e1[_0x6a22('0x36')],_0xac621c[_0x6a22('0x3b')]));_0x1d3bb2[_0x6a22('0x99')]['ChatInteractionId']=_0x3f817d['id'];if(_0x3139e1['query'][_0x6a22('0x9b')]){_0x1d3bb2[_0x6a22('0x99')]=_['merge'](_0x1d3bb2[_0x6a22('0x99')],{'$or':_[_0x6a22('0x2f')](_0x1d3bb2[_0x6a22('0x3d')],function(_0x162022){var _0xbf2fbd={};_0xbf2fbd[_0x162022]={'$like':'%'+_0x3139e1[_0x6a22('0x36')]['filter']+'%'};return _0xbf2fbd;})});}_0x1d3bb2['where'][_0x6a22('0x88')]=![];if(_0x3139e1[_0x6a22('0x36')]['id']){_0x1d3bb2[_0x6a22('0x99')]['id']={'$gt':_0x3139e1[_0x6a22('0x36')]['id']};}_0x1d3bb2=_[_0x6a22('0x2a')]({},_0x1d3bb2,_0x3139e1[_0x6a22('0x41')]);return db[_0x6a22('0x58')][_0x6a22('0x22')]({'where':_0x1d3bb2[_0x6a22('0x99')]})[_0x6a22('0x12')](function(_0xbf9568){_0x167257[_0x6a22('0x22')]=_0xbf9568;_0x1d3bb2[_0x6a22('0x40')]=[];if(_0x3139e1[_0x6a22('0x36')][_0x6a22('0xa3')]){_0x1d3bb2[_0x6a22('0x40')]['push']({'model':db[_0x6a22('0x77')],'as':_0x6a22('0x77'),'attributes':['id','fullname',_0x6a22('0x83')]});}if(_0x3139e1[_0x6a22('0x36')][_0x6a22('0xa4')]){_0x1d3bb2[_0x6a22('0x40')]=[{'all':!![]}];}return db[_0x6a22('0x58')][_0x6a22('0x35')](_0x1d3bb2);})[_0x6a22('0x12')](function(_0x2530a1){_0x167257[_0x6a22('0x9f')]=_0x2530a1;return _0x167257;});}})['then'](respondWithFilteredResult(_0x2c9aaf,_0x1d3bb2))[_0x6a22('0x1b')](handleError(_0x2c9aaf,null));};exports[_0x6a22('0xa5')]=function(_0x2d8118,_0xafa76d){return db[_0x6a22('0x3a')]['find']({'where':{'id':_0x2d8118[_0x6a22('0x38')]['id']}})['then'](handleEntityNotFound(_0xafa76d,null))['then'](function(_0x34575b){if(_0x34575b){return _0x34575b['setTags'](_0x2d8118[_0x6a22('0x2b')]['ids'],_[_0x6a22('0x94')](_0x2d8118[_0x6a22('0x2b')],[_0x6a22('0x95'),'id'])||{})[_0x6a22('0xa6')](function(){return db[_0x6a22('0xa7')][_0x6a22('0x35')]({'attributes':['id','name',_0x6a22('0xa8')],'where':{'id':_0x2d8118[_0x6a22('0x2b')]['ids']}});})[_0x6a22('0x12')](function(_0x5059ee){socket[_0x6a22('0xa9')](_0x6a22('0xaa'),{'id':Number(_0x2d8118['params']['id']),'tags':_0x5059ee||[]});return{'id':Number(_0x2d8118['params']['id']),'tags':_0x5059ee||[]};});}})[_0x6a22('0x12')](respondWithResult(_0xafa76d,null))[_0x6a22('0x1b')](handleError(_0xafa76d,null));};exports['removeTags']=function(_0x4793df,_0x2074e3){return db['ChatInteraction'][_0x6a22('0x43')]({'where':{'id':_0x4793df[_0x6a22('0x38')]['id']}})[_0x6a22('0x12')](handleEntityNotFound(_0x2074e3,null))['then'](function(_0x5745d5){if(_0x5745d5){return _0x5745d5[_0x6a22('0xab')](_0x4793df[_0x6a22('0x36')][_0x6a22('0x95')]);}})['then'](respondWithStatusCode(_0x2074e3,null))[_0x6a22('0x1b')](handleError(_0x2074e3,null));};exports[_0x6a22('0x71')]=function(_0x4d19ac,_0x52b140){var _0x2a998a=moment()[_0x6a22('0xac')]()['toString']();var _0x33509a=path[_0x6a22('0x6d')](config[_0x6a22('0x6e')],_0x6a22('0xad'),_0x6a22('0xae'),_0x6a22('0xaf'));var _0x2ee160=path[_0x6a22('0x6d')](config[_0x6a22('0x6e')],_0x6a22('0xad'),_0x6a22('0xae'),_0x6a22('0xb0'));var _0x162c7f=path[_0x6a22('0x6d')](_0x33509a,_0x2a998a);var _0x5f3cd2=util[_0x6a22('0x73')](_0x6a22('0xb1'),_0x4d19ac[_0x6a22('0x38')]['id'],_0x2a998a);var _0x2848ae=path[_0x6a22('0x6d')](_0x33509a,_0x5f3cd2);var _0x113fc1=[];_0x113fc1[_0x6a22('0xb2')]({'model':db[_0x6a22('0x77')],'as':_0x6a22('0x77'),'attributes':['id',_0x6a22('0x84')],'raw':!![]});_0x113fc1[_0x6a22('0xb2')]({'model':db[_0x6a22('0x79')],'as':_0x6a22('0x5b'),'attributes':['id',_0x6a22('0xb3'),'lastName'],'raw':!![]});if(_0x4d19ac['query']['attachments']){_0x113fc1['push']({'model':db[_0x6a22('0x68')],'as':'Attachment','raw':!![]});}var _0x121919=[{'model':db['ChatMessage'],'as':_0x6a22('0x76'),'attributes':['id','body',_0x6a22('0xb4'),_0x6a22('0xb5'),_0x6a22('0x88'),'read'],'include':_0x113fc1}];_0x121919[_0x6a22('0xb2')]({'model':db[_0x6a22('0x78')],'as':'Account','attributes':['id','name']});_0x121919[_0x6a22('0xb2')]({'model':db[_0x6a22('0x77')],'as':_0x6a22('0xb6'),'attributes':['id',_0x6a22('0x84')]});return db[_0x6a22('0x3a')][_0x6a22('0x43')]({'where':{'id':_0x4d19ac[_0x6a22('0x38')]['id']},'include':_0x121919})[_0x6a22('0x12')](handleEntityNotFound(_0x52b140,null))[_0x6a22('0x12')](function(_0x54d908){if(_0x54d908){var _0x39c57d=_0x54d908[_0x6a22('0xb7')]({'plain':!![]});fs[_0x6a22('0xb8')](_0x162c7f);var _0x30c890={'channel':_0x6a22('0xb9'),'account':_0x39c57d[_0x6a22('0xba')][_0x6a22('0x4d')],'agent':_0x39c57d[_0x6a22('0xb6')]?_0x39c57d[_0x6a22('0xb6')][_0x6a22('0x84')]:_0x6a22('0xbb'),'createdAt':moment(_0x39c57d[_0x6a22('0xb4')])[_0x6a22('0x73')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6a22('0xbc')](),'closedAt':_0x39c57d[_0x6a22('0x61')]?moment(_0x39c57d[_0x6a22('0xbd')])[_0x6a22('0x73')](_0x6a22('0x9e'))['toString']():'','disposition':_0x39c57d['disposition'],'chatInfo':{'browser':_0x39c57d[_0x6a22('0xbe')],'os':_0x39c57d[_0x6a22('0xbf')],'referer':_0x39c57d[_0x6a22('0xc0')],'customerIp':_0x39c57d['customerIp'],'customerPort':_0x39c57d[_0x6a22('0xc1')]?_0x39c57d[_0x6a22('0xc1')]:_0x6a22('0xbb')},'messages':_(_0x39c57d[_0x6a22('0x76')])['tail']()[_0x6a22('0x9b')]({'secret':![]})[_0x6a22('0x2f')](function(_0x333a93){if(_0x333a93[_0x6a22('0x68')]){var _0x186691=path['join'](_0x2ee160,_0x333a93[_0x6a22('0x68')][_0x6a22('0x65')]);if(fs[_0x6a22('0xc2')](_0x186691)){fs['createReadStream'](_0x186691)[_0x6a22('0xc3')](fs[_0x6a22('0xc4')](path['join'](_0x162c7f,_0x333a93[_0x6a22('0x68')][_0x6a22('0x65')])));}}return{'date':moment(_0x333a93['createdAt'])[_0x6a22('0x73')](_0x6a22('0x9e'))[_0x6a22('0xbc')](),'sender':_0x333a93[_0x6a22('0xb5')]===_0x6a22('0x57')?_0x333a93[_0x6a22('0x77')]?_0x333a93[_0x6a22('0x77')]['fullname']:_0x6a22('0x82'):_0x333a93[_0x6a22('0x5b')][_0x6a22('0xb3')]+(_0x333a93[_0x6a22('0x5b')][_0x6a22('0xc5')]?'\x20'+_0x333a93['Contact'][_0x6a22('0xc5')]:''),'body':_0x333a93[_0x6a22('0x68')]?_0x333a93[_0x6a22('0x68')][_0x6a22('0x65')]:_0x333a93[_0x6a22('0x2b')],'direction':_0x333a93[_0x6a22('0xb5')]==='out'?'A':'C','secret':_0x333a93[_0x6a22('0x88')],'read':_0x333a93[_0x6a22('0xc6')],'attachment':_0x333a93[_0x6a22('0x68')]};})[_0x6a22('0xc7')]()};return ejs[_0x6a22('0xc8')](path[_0x6a22('0x6d')](config[_0x6a22('0x6e')],_0x6a22('0xad'),_0x6a22('0xc9'),_0x6a22('0xca')),{'interaction':_0x30c890})[_0x6a22('0x12')](function(_0xdcfc36){var _0x2291da=path[_0x6a22('0x6d')](_0x162c7f,_0x6a22('0xcb')+_0x39c57d['id']+'-'+_0x2a998a+'.pdf');var _0xe749fb={'path':_0x2291da,'channel':_0x6a22('0xb9'),'interactionId':_0x39c57d['id']};return pdf[_0x6a22('0xcc')](_0xdcfc36,_0xe749fb);})[_0x6a22('0x12')](function(){return new Promise(function(_0x19338c,_0x186002){zipdir(_0x162c7f,{'saveTo':_0x2848ae},function(_0x3f2a31,_0x557c81){if(_0x3f2a31)return _0x186002(_0x3f2a31);return _0x19338c(_0x557c81);});})[_0x6a22('0x12')](function(){return new BPromise(function(_0x5b17f4,_0x37077b){rimraf(_0x162c7f,function(_0x1f6080){if(_0x1f6080)_0x37077b(_0x1f6080);return _0x5b17f4();});});})[_0x6a22('0x12')](function(){return _0x52b140[_0x6a22('0x71')](_0x2848ae,_0x5f3cd2,function(_0x18bfaf){if(_0x18bfaf){logger['error'](_0x6a22('0xcd'),_0x18bfaf);}else{fs[_0x6a22('0xce')](_0x2848ae);}});});});}else{return _0x52b140[_0x6a22('0x1c')](0xc8);}})[_0x6a22('0x1b')](handleError(_0x52b140,null));}; \ No newline at end of file +var _0x1171=['includeAll','include','options','find','catch','create','body','params','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','findOne','attachId','root','join','offline-chat/','close','server/files/chat/upload/','now','pathTranscript','Messages','User','ContactId','UserId','format','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','intersection','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','order','includeAgent','push','alias','addTags','setTags','spread','Tag','findAll','color','emit','chatInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','read','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','referer','customerIp','customerPort','N.A.','tail','existsSync','out','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','client','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','stack','name','send','merge','contact','interaction','account','index','map','ChatInteraction','type','getOptions','query','user','show','model','keys','rawAttributes','filters','fields','attributes','length'];(function(_0x439696,_0x54d595){var _0x1ebad2=function(_0x5126f8){while(--_0x5126f8){_0x439696['push'](_0x439696['shift']());}};_0x1ebad2(++_0x54d595);}(_0x1171,0x15f));var _0x1117=function(_0x569a45,_0x2da15b){_0x569a45=_0x569a45-0x0;var _0x1a5ef8=_0x1171[_0x569a45];return _0x1a5ef8;};'use strict';var rimraf=require(_0x1117('0x0'));var zipdir=require(_0x1117('0x1'));var rp=require(_0x1117('0x2'));var moment=require(_0x1117('0x3'));var BPromise=require(_0x1117('0x4'));var Mustache=require(_0x1117('0x5'));var util=require(_0x1117('0x6'));var path=require(_0x1117('0x7'));var ejs=require(_0x1117('0x8'));var fs=require('fs');var _=require(_0x1117('0x9'));var Redis=require('ioredis');var interaction=require(_0x1117('0xa'));var qs=require(_0x1117('0xb'));var pdf=require(_0x1117('0xc'));var logger=require(_0x1117('0xd'))('api');var config=require(_0x1117('0xe'));var db=require(_0x1117('0xf'))['db'];config['redis']=_['defaults'](config[_0x1117('0x10')],{'host':_0x1117('0x11'),'port':0x18eb});var socket=require(_0x1117('0x12'))(new Redis(config[_0x1117('0x10')]));require('./chatInteraction.socket')[_0x1117('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1117('0x14')]['http']({'port':0x232b});var client9004=jayson[_0x1117('0x14')]['http']({'port':0x232c});function respondWithRpcPromise(_0x72c483,_0x5e0e8c,_0x4f6cc9,_0x19e013){return new BPromise(function(_0x48302f,_0x1d01c5){var _0x30423b=_0x19e013||client;return _0x30423b['request'](_0x72c483,_0x4f6cc9)[_0x1117('0x15')](function(_0x212b1d){logger['info'](_0x1117('0x16'),_0x5e0e8c,_0x1117('0x17'));logger['debug'](_0x1117('0x18'),_0x5e0e8c,'request\x20sent',JSON[_0x1117('0x19')](_0x212b1d));if(_0x212b1d[_0x1117('0x1a')]){if(_0x212b1d['error']['code']===0x1f4){logger['error'](_0x1117('0x16'),_0x5e0e8c,_0x212b1d[_0x1117('0x1a')][_0x1117('0x1b')]);return _0x1d01c5(_0x212b1d[_0x1117('0x1a')][_0x1117('0x1b')]);}logger['error'](_0x1117('0x16'),_0x5e0e8c,_0x212b1d[_0x1117('0x1a')][_0x1117('0x1b')]);return _0x48302f(_0x212b1d['error'][_0x1117('0x1b')]);}else{logger['info'](_0x1117('0x16'),_0x5e0e8c,'request\x20sent');_0x48302f(_0x212b1d[_0x1117('0x1c')]['message']);}})['catch'](function(_0x5e1392){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5e0e8c,_0x5e1392);_0x1d01c5(_0x5e1392);});});}function respondWithStatusCode(_0x5a377a,_0x4dec7d){_0x4dec7d=_0x4dec7d||0xcc;return function(_0x2ba62d){if(_0x2ba62d){return _0x5a377a[_0x1117('0x1d')](_0x4dec7d);}return _0x5a377a[_0x1117('0x1e')](_0x4dec7d)[_0x1117('0x1f')]();};}function respondWithResult(_0x4494f5,_0x540aa6){_0x540aa6=_0x540aa6||0xc8;return function(_0x420670){if(_0x420670){return _0x4494f5[_0x1117('0x1e')](_0x540aa6)[_0x1117('0x20')](_0x420670);}};}function respondWithFilteredResult(_0x33a69e,_0x4bced6){return function(_0x105f42){if(_0x105f42){var _0x49b652=typeof _0x4bced6[_0x1117('0x21')]===_0x1117('0x22')&&typeof _0x4bced6['limit']===_0x1117('0x22');var _0x30dbe7=_0x105f42[_0x1117('0x23')];var _0x5e160c=_0x49b652?0x0:_0x4bced6[_0x1117('0x21')];var _0x50dbd8=_0x49b652?_0x105f42[_0x1117('0x23')]:_0x4bced6[_0x1117('0x21')]+_0x4bced6[_0x1117('0x24')];var _0xedefc3;if(_0x50dbd8>=_0x30dbe7){_0x50dbd8=_0x30dbe7;_0xedefc3=0xc8;}else{_0xedefc3=0xce;}_0x33a69e[_0x1117('0x1e')](_0xedefc3);return _0x33a69e[_0x1117('0x25')](_0x1117('0x26'),_0x5e160c+'-'+_0x50dbd8+'/'+_0x30dbe7)[_0x1117('0x20')](_0x105f42);}return null;};}function saveUpdates(_0x103d4e){return function(_0x39f356){if(_0x39f356){return _0x39f356[_0x1117('0x27')](_0x103d4e)[_0x1117('0x15')](function(_0x45b55a){return _0x45b55a;});}return null;};}function removeEntity(_0x222f85){return function(_0x451533){if(_0x451533){return _0x451533[_0x1117('0x28')]()[_0x1117('0x15')](function(){_0x222f85[_0x1117('0x1e')](0xcc)[_0x1117('0x1f')]();});}};}function handleEntityNotFound(_0x2f8dca){return function(_0xbb4654){if(!_0xbb4654){_0x2f8dca[_0x1117('0x1d')](0x194);}return _0xbb4654;};}function handleError(_0x2c5c0d,_0x67ef2e){_0x67ef2e=_0x67ef2e||0x1f4;return function(_0x50d24a){logger[_0x1117('0x1a')](_0x50d24a[_0x1117('0x29')]);if(_0x50d24a[_0x1117('0x2a')]){delete _0x50d24a[_0x1117('0x2a')];}_0x2c5c0d['status'](_0x67ef2e)[_0x1117('0x2b')](_0x50d24a);};}function getMustacheRender(_0xdbfb80,_0x11569f){return Mustache['render'](_0xdbfb80,_[_0x1117('0x2c')](_0x11569f['body'],{'contact':_0x11569f[_0x1117('0x2d')],'message':_0x11569f[_0x1117('0x1b')],'agent':_0x11569f['agent'],'interaction':_0x11569f[_0x1117('0x2e')],'account':_0x11569f[_0x1117('0x2f')]}))||'';}exports[_0x1117('0x30')]=function(_0x3a4c79,_0x54fb00){var _0x40fbf3={};var _0x52e649=_[_0x1117('0x31')](db[_0x1117('0x32')]['rawAttributes'],function(_0x37e8b7){return{'name':_0x37e8b7['fieldName'],'type':_0x37e8b7[_0x1117('0x33')]['key']};});_0x40fbf3=qs[_0x1117('0x34')](_0x52e649,_0x3a4c79);return interaction['findAll']('chat',_0x3a4c79[_0x1117('0x35')],_0x3a4c79[_0x1117('0x36')],_0x40fbf3,_0x52e649)[_0x1117('0x15')](respondWithFilteredResult(_0x54fb00,_0x40fbf3))['catch'](handleError(_0x54fb00,null));};exports[_0x1117('0x37')]=function(_0x324395,_0x1c3cd6){var _0x1770e4={'raw':![],'where':{'id':_0x324395['params']['id']}},_0x4d223c={};_0x4d223c[_0x1117('0x38')]=_[_0x1117('0x39')](db[_0x1117('0x32')][_0x1117('0x3a')]);_0x4d223c[_0x1117('0x35')]=_[_0x1117('0x39')](_0x324395[_0x1117('0x35')]);_0x4d223c[_0x1117('0x3b')]=_['intersection'](_0x4d223c[_0x1117('0x38')],_0x4d223c[_0x1117('0x35')]);_0x1770e4['attributes']=_['intersection'](_0x4d223c[_0x1117('0x38')],qs[_0x1117('0x3c')](_0x324395[_0x1117('0x35')][_0x1117('0x3c')]));_0x1770e4['attributes']=_0x1770e4[_0x1117('0x3d')][_0x1117('0x3e')]?_0x1770e4[_0x1117('0x3d')]:_0x4d223c[_0x1117('0x38')];if(_0x324395['query'][_0x1117('0x3f')]){_0x1770e4[_0x1117('0x40')]=[{'all':!![]}];}_0x1770e4=_['merge']({},_0x1770e4,_0x324395[_0x1117('0x41')]);return db['ChatInteraction'][_0x1117('0x42')](_0x1770e4)['then'](handleEntityNotFound(_0x1c3cd6,null))[_0x1117('0x15')](respondWithResult(_0x1c3cd6,null))[_0x1117('0x43')](handleError(_0x1c3cd6,null));};exports[_0x1117('0x44')]=function(_0x3f8cfb,_0x1c00d7){return db[_0x1117('0x32')][_0x1117('0x44')](_0x3f8cfb[_0x1117('0x45')],{})[_0x1117('0x15')](respondWithResult(_0x1c00d7,0xc9))[_0x1117('0x43')](handleError(_0x1c00d7,null));};exports[_0x1117('0x27')]=function(_0xfa965,_0x368e96){if(_0xfa965[_0x1117('0x45')]['id']){delete _0xfa965[_0x1117('0x45')]['id'];}return db[_0x1117('0x32')][_0x1117('0x42')]({'where':{'id':_0xfa965[_0x1117('0x46')]['id']}})[_0x1117('0x15')](handleEntityNotFound(_0x368e96,null))['then'](saveUpdates(_0xfa965['body'],null))[_0x1117('0x15')](respondWithResult(_0x368e96,null))[_0x1117('0x43')](handleError(_0x368e96,null));};exports['destroy']=function(_0x580161,_0x1458f8){return db[_0x1117('0x32')]['find']({'where':{'id':_0x580161[_0x1117('0x46')]['id']}})['then'](handleEntityNotFound(_0x1458f8,null))[_0x1117('0x15')](removeEntity(_0x1458f8,null))[_0x1117('0x43')](handleError(_0x1458f8,null));};exports['describe']=function(_0x233e8a,_0x2457dc){return db[_0x1117('0x32')][_0x1117('0x47')]()['then'](respondWithResult(_0x2457dc,null))[_0x1117('0x43')](handleError(_0x2457dc,null));};exports[_0x1117('0x48')]=function(_0x3a78b0,_0x1eff3c){var _0x4764a7=_0x3a78b0[_0x1117('0x46')]['id'];var _0x9229a4;var _0x3af897;var _0x4c78e7;return db[_0x1117('0x32')]['findOne']({'where':{'id':_0x4764a7}})[_0x1117('0x15')](function(_0x192cf1){_0x9229a4=_0x192cf1;return db[_0x1117('0x49')]['findOne']({'where':{'id':_0x192cf1[_0x1117('0x4a')]},'attributes':['id',_0x1117('0x4b'),_0x1117('0x4c'),_0x1117('0x4d'),_0x1117('0x4e'),_0x1117('0x4f')],'raw':!![]});})[_0x1117('0x15')](function(_0x2b7b93){if(_0x2b7b93&&_0x2b7b93[_0x1117('0x4b')]&&_0x2b7b93['vidaooEscalation']){_0x3af897=_0x2b7b93;var _0x1380dc={'interaction':{'id':_0x4764a7},'agent':{'id':_0x3a78b0[_0x1117('0x36')]['id'],'name':_0x3a78b0[_0x1117('0x36')][_0x1117('0x2a')],'fullname':_0x3a78b0['user'][_0x1117('0x50')],'email':_0x3a78b0[_0x1117('0x36')][_0x1117('0x51')]},'contact':_0x3a78b0[_0x1117('0x45')][_0x1117('0x2d')],'account':_0x3a78b0[_0x1117('0x45')]['account']};var _0x572e2f={'rejectUnauthorized':![],'method':_0x1117('0x52'),'url':_0x1117('0x53'),'headers':{'X-APIKEY':_0x2b7b93[_0x1117('0x4b')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3a78b0['user'][_0x1117('0x51')]],'buttons':null,'topic':_0x3af897[_0x1117('0x4d')],'note':_[_0x1117('0x54')](_0x3af897[_0x1117('0x4e')])?null:getMustacheRender(_0x3af897['vidaooNote'],_0x1380dc),'metadata':null},'redirect':_0x1117('0x55'),'json':!![]};try{if(!_[_0x1117('0x54')](_0x3af897[_0x1117('0x4f')])){var _0x12a7b6=getMustacheRender(_0x3af897[_0x1117('0x4f')],_0x1380dc);var _0x332d21=JSON[_0x1117('0x56')](_0x12a7b6);_0x572e2f[_0x1117('0x45')]['metadata']=_0x332d21;}}catch(_0x378878){throw new db[(_0x1117('0x57'))][(_0x1117('0x58'))](_0x1117('0x59'));}return rp(_0x572e2f);}else{throw new db[(_0x1117('0x57'))]['ValidationError'](_0x1117('0x5a'));}})[_0x1117('0x15')](function(_0x9d05b2){_0x4c78e7=_0x9d05b2;if(_0x4c78e7['id']){var _0x325adc={'body':_0x4c78e7[_0x1117('0x5b')],'ChatWebsiteId':_0x3af897['id'],'ChatInteractionId':_0x9229a4['id'],'direction':'out','UserId':_0x3a78b0[_0x1117('0x36')]['id']};return db[_0x1117('0x5c')][_0x1117('0x44')](_0x325adc,{});}else{throw new db[(_0x1117('0x57'))][(_0x1117('0x58'))](_0x1117('0x5d'));}})['then'](function(){return _0x9229a4['updateAttributes']({'vidaooSessionId':_0x4c78e7['id']});})['then'](respondWithResult(_0x1eff3c,null))[_0x1117('0x43')](handleError(_0x1eff3c,null));};exports[_0x1117('0x5e')]=function(_0x2c5896,_0x122230){if(_0x2c5896[_0x1117('0x45')]['id']){delete _0x2c5896['body']['id'];}return db['ChatInteraction'][_0x1117('0x42')]({'where':{'id':_0x2c5896[_0x1117('0x46')]['id']},'include':[{'model':db[_0x1117('0x5f')],'as':_0x1117('0x60')}]})[_0x1117('0x15')](handleEntityNotFound(_0x122230,null))[_0x1117('0x15')](saveUpdates(_0x2c5896['body'],null))[_0x1117('0x15')](respondWithResult(_0x122230,null))[_0x1117('0x43')](handleError(_0x122230,null));};exports[_0x1117('0x61')]=function(_0x47141b,_0x4e4113){if(_0x47141b[_0x1117('0x45')]['id']){delete _0x47141b['body']['id'];}return db['ChatInteraction'][_0x1117('0x42')]({'where':{'id':_0x47141b[_0x1117('0x46')]['id']}})[_0x1117('0x15')](function(_0x5994c9){if(!_0x5994c9){logger[_0x1117('0x1a')](_0x1117('0x62'),_0x1117('0x61'),0x194,_0x1117('0x63'));_0x4e4113[_0x1117('0x1d')](0x194);}else{if(_0x5994c9['UserId']){throw new db[(_0x1117('0x57'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x5994c9;})[_0x1117('0x15')](function(_0x42285f){if(_0x42285f){return _0x42285f['update']({'closed':_0x47141b['body'][_0x1117('0x64')],'disposition':_0x47141b[_0x1117('0x45')][_0x1117('0x65')]})[_0x1117('0x15')](function(_0x549f46){return _0x549f46;});}})['then'](function(){return respondWithRpcPromise(_0x1117('0x66'),_0x1117('0x61'),_0x47141b[_0x1117('0x45')],client9004);})[_0x1117('0x15')](respondWithResult(_0x4e4113,null))[_0x1117('0x43')](handleError(_0x4e4113,null));};exports[_0x1117('0x67')]=function(_0x2871c9,_0x5376a1){_0x2871c9[_0x1117('0x45')][_0x1117('0x2a')]=_0x2871c9[_0x1117('0x68')][_0x1117('0x69')];_0x2871c9['body'][_0x1117('0x6a')]=_0x2871c9['file'][_0x1117('0x6b')];_0x2871c9[_0x1117('0x45')][_0x1117('0x33')]=_0x2871c9['file'][_0x1117('0x6c')];return db['Attachment'][_0x1117('0x44')](_0x2871c9[_0x1117('0x45')])['then'](respondWithResult(_0x5376a1,0xc9))['catch'](handleError(_0x5376a1,null));};exports[_0x1117('0x6d')]=function(_0x229c42,_0xeb3845){return db['ChatInteraction']['findOne']({'where':{'id':_0x229c42[_0x1117('0x46')]['id']},'raw':!![]})[_0x1117('0x15')](handleEntityNotFound(_0xeb3845,null))[_0x1117('0x15')](function(_0xf7647){if(_0xf7647){if(_0xf7647[_0x1117('0x64')]){return _0xeb3845['status'](0x193)['json']({'status':0x193,'message':_0x1117('0x6e')});}return db['Attachment'][_0x1117('0x6f')]({'where':{'id':_0x229c42['query'][_0x1117('0x70')]},'raw':!![]})[_0x1117('0x15')](handleEntityNotFound(_0xeb3845,null));}})[_0x1117('0x15')](function(_0x207f34){if(_0x207f34){var _0x267816=_0x207f34['ChatOfflineMessageId']!==null;var _0x3192b3=path['join'](config[_0x1117('0x71')],'server/files/attachments/');if(_0x267816){_0x3192b3=path[_0x1117('0x72')](_0x3192b3,_0x1117('0x73'));}var _0x26eec1=path[_0x1117('0x72')](_0x3192b3,_0x207f34[_0x1117('0x6a')]);return _0xeb3845['download'](_0x26eec1);}})[_0x1117('0x43')](handleError(_0xeb3845,null));};exports[_0x1117('0x74')]=function(_0x775160,_0x204c47){var _0x53e6a4=null;var _0x16261b=null;var _0x49693f=null;if(_0x775160[_0x1117('0x45')]['id']){delete _0x775160[_0x1117('0x45')]['id'];}if(_0x775160[_0x1117('0x45')]['mailTranscript']){_0x49693f=path[_0x1117('0x72')](config[_0x1117('0x71')],_0x1117('0x75'),util['format']('transcript-%s.txt',Date[_0x1117('0x76')]()));_0x775160[_0x1117('0x45')][_0x1117('0x77')]=_0x49693f;}return db[_0x1117('0x32')][_0x1117('0x42')]({'where':{'id':_0x775160['params']['id']},'include':[{'model':db[_0x1117('0x5c')],'as':_0x1117('0x78'),'include':[{'model':db[_0x1117('0x79')],'as':_0x1117('0x79')}]}]})['then'](handleEntityNotFound(_0x204c47,null))[_0x1117('0x15')](saveUpdates(_0x775160[_0x1117('0x45')],null))[_0x1117('0x15')](function(_0x5b1582){if(_0x5b1582){_0x53e6a4=_0x5b1582;return db[_0x1117('0x49')]['find']({'where':{'id':_0x53e6a4[_0x1117('0x4a')]}});}})['then'](function(_0xbec521){if(_0xbec521){_0x16261b=_0xbec521;return db[_0x1117('0x5f')]['find']({'where':{'id':_0x53e6a4[_0x1117('0x7a')]}});}})['then'](function(_0x57b176){if(_0x57b176){if(_0x49693f){var _0xf0a6f9=null;for(var _0x482aa2=0x1;_0x482aa2<_0x53e6a4[_0x1117('0x78')][_0x1117('0x3e')];++_0x482aa2){_0xf0a6f9=_0x53e6a4[_0x1117('0x78')][_0x482aa2];var _0x1739cc=_0xf0a6f9[_0x1117('0x7b')]?util[_0x1117('0x7c')]('%s%d',_0x16261b['agentAlias'],_0xf0a6f9[_0x1117('0x7b')]):_0x1117('0x7d');var _0x18513c=_0x775160[_0x1117('0x45')][_0x1117('0x7e')]||util[_0x1117('0x7c')]('%s%d',_0x1117('0x7f'),_0xf0a6f9[_0x1117('0x7a')]);switch(_0x16261b[_0x1117('0x80')]){case _0x1117('0x81'):_0x1739cc=_0xf0a6f9[_0x1117('0x7b')]?util[_0x1117('0x7c')]('%s%d',_0x16261b[_0x1117('0x82')],_0xf0a6f9['UserId']):_0x1117('0x7d');break;case _0x1117('0x83'):_0x1739cc=_0xf0a6f9[_0x1117('0x7b')]?_0xf0a6f9['User']['alias']||_0xf0a6f9[_0x1117('0x79')][_0x1117('0x50')]:_0x1117('0x7d');break;case _0x1117('0x84'):_0x1739cc=_0xf0a6f9[_0x1117('0x7b')]?_0xf0a6f9[_0x1117('0x79')][_0x1117('0x50')]:_0x1117('0x7d');break;default:_0x1739cc=_0xf0a6f9[_0x1117('0x7b')]?util[_0x1117('0x7c')]('%s%d',_0x16261b[_0x1117('0x82')],_0xf0a6f9[_0x1117('0x7b')]):_0x1117('0x7d');}var _0x5d8c5c=util[_0x1117('0x7c')](_0x1117('0x85'),moment(_0xf0a6f9[_0x1117('0x86')])[_0x1117('0x7c')]('MM/DD/YYYY\x20HH:mm:ss'),_0xf0a6f9[_0x1117('0x87')]==='in'?_0x18513c:_0x1739cc,_0xf0a6f9[_0x1117('0x45')]);if(!_0xf0a6f9[_0x1117('0x88')]){fs[_0x1117('0x89')](_0x49693f,_0x5d8c5c);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x1117('0x8a')],'as':_0x1117('0x8b'),'raw':!![],'include':[{'model':db[_0x1117('0x8c')],'as':_0x1117('0x8c'),'raw':!![]}]}]});}}})[_0x1117('0x15')](function(_0x258182){if(!_0x258182||!_0x258182['Smtp']||!_0x775160[_0x1117('0x45')])return _0x53e6a4;var _0xcbc43a=_0x258182['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x1117('0x8d'),{'account':_0xcbc43a,'message':{'from':util[_0x1117('0x7c')](_0x1117('0x8e'),_0x258182[_0x1117('0x2a')],_0x258182['email']||_0x258182[_0x1117('0x8b')]['user']),'to':_0x775160['body']['mailTranscript'],'subject':_0x1117('0x8f'),'text':util[_0x1117('0x7c')](_0x1117('0x90'),_0x775160[_0x1117('0x45')]['mailTranscript']),'attachments':[{'path':_0x49693f}]}})[_0x1117('0x15')](function(){return _0x53e6a4;})[_0x1117('0x43')](function(_0x104582){logger[_0x1117('0x1a')](_0x104582);});})[_0x1117('0x15')](respondWithStatusCode(_0x204c47,0xc8))[_0x1117('0x43')](handleError(_0x204c47,null));};exports[_0x1117('0x91')]=function(_0xf3b7a1,_0x20020b){return db[_0x1117('0x5c')][_0x1117('0x42')]({'where':{'id':_0xf3b7a1[_0x1117('0x46')]['id']}})[_0x1117('0x15')](handleEntityNotFound(_0x20020b,null))[_0x1117('0x15')](function(_0x396f47){if(_0x396f47){return _0x396f47[_0x1117('0x91')](_0xf3b7a1[_0x1117('0x45')][_0x1117('0x92')],_[_0x1117('0x93')](_0xf3b7a1['body'],[_0x1117('0x92'),'id'])||{});}})[_0x1117('0x15')](respondWithResult(_0x20020b,null))[_0x1117('0x43')](handleError(_0x20020b,null));};exports['getMessages']=function(_0x3c2a6a,_0x2c1672){var _0x1f02b0={'raw':![],'where':{}};var _0x36d2c1={};var _0x2028b3={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x1117('0x6f')]({'where':{'id':_0x3c2a6a[_0x1117('0x46')]['id']}})[_0x1117('0x15')](handleEntityNotFound(_0x2c1672,null))['then'](function(_0x5a12a1){if(_0x5a12a1){_0x36d2c1[_0x1117('0x38')]=_[_0x1117('0x39')](db[_0x1117('0x5c')][_0x1117('0x3a')]);_0x36d2c1[_0x1117('0x35')]=_['keys'](_0x3c2a6a[_0x1117('0x35')]);_0x36d2c1[_0x1117('0x3b')]=_[_0x1117('0x94')](_0x36d2c1[_0x1117('0x38')],_0x36d2c1[_0x1117('0x35')]);_0x1f02b0[_0x1117('0x3d')]=_['intersection'](_0x36d2c1[_0x1117('0x38')],qs[_0x1117('0x3c')](_0x3c2a6a[_0x1117('0x35')]['fields']));_0x1f02b0[_0x1117('0x3d')]=_0x1f02b0[_0x1117('0x3d')][_0x1117('0x3e')]?_0x1f02b0['attributes']:_0x36d2c1[_0x1117('0x38')];if(!_0x3c2a6a[_0x1117('0x35')][_0x1117('0x95')](_0x1117('0x96'))){_0x1f02b0[_0x1117('0x24')]=qs[_0x1117('0x24')](_0x3c2a6a['query'][_0x1117('0x24')]);_0x1f02b0['offset']=qs['offset'](_0x3c2a6a[_0x1117('0x35')][_0x1117('0x21')]);}_0x1f02b0['order']=qs[_0x1117('0x97')](_0x3c2a6a[_0x1117('0x35')]['sort']);_0x1f02b0[_0x1117('0x98')]=qs[_0x1117('0x3b')](_[_0x1117('0x99')](_0x3c2a6a[_0x1117('0x35')],_0x36d2c1[_0x1117('0x3b')]));_0x1f02b0[_0x1117('0x98')][_0x1117('0x9a')]=_0x5a12a1['id'];if(_0x3c2a6a[_0x1117('0x35')]['filter']){_0x1f02b0[_0x1117('0x98')]=_[_0x1117('0x2c')](_0x1f02b0['where'],{'$or':_[_0x1117('0x31')](_0x1f02b0[_0x1117('0x3d')],function(_0x16db2a){var _0x3afe3f={};_0x3afe3f[_0x16db2a]={'$like':'%'+_0x3c2a6a[_0x1117('0x35')][_0x1117('0x9b')]+'%'};return _0x3afe3f;})});}if(_0x3c2a6a['query'][_0x1117('0x9c')]){var _0x29240f=_0x3c2a6a[_0x1117('0x35')][_0x1117('0x9c')][_0x1117('0x9d')](',');var _0x30b201={};_0x30b201[_0x29240f[0x0]]={'$gte':moment(_0x29240f[0x1])['format'](_0x1117('0x9e'))};_0x1f02b0[_0x1117('0x98')]=_[_0x1117('0x2c')](_0x1f02b0['where'],_0x30b201);}_0x1f02b0=_['merge']({},_0x1f02b0,_0x3c2a6a[_0x1117('0x41')]);return db['ChatMessage'][_0x1117('0x23')]({'where':_0x1f02b0[_0x1117('0x98')]})[_0x1117('0x15')](function(_0x410fb8){_0x2028b3[_0x1117('0x23')]=_0x410fb8;if(_0x3c2a6a['query'][_0x1117('0x3f')]){_0x1f02b0['include']=[{'all':!![]}];}return db[_0x1117('0x5c')]['findAll'](_0x1f02b0);})[_0x1117('0x15')](function(_0x59c686){_0x2028b3[_0x1117('0x9f')]=_0x59c686;return _0x2028b3;});}})[_0x1117('0x15')](respondWithFilteredResult(_0x2c1672,_0x1f02b0))[_0x1117('0x43')](handleError(_0x2c1672,null));};exports[_0x1117('0xa0')]=function(_0x1e13e9,_0x27f8b6){var _0x35db6e={'where':{}},_0x1d5fd3={},_0x2207ec={'count':0x0,'rows':[]};return db[_0x1117('0x32')][_0x1117('0x6f')]({'where':{'id':_0x1e13e9[_0x1117('0x46')]['id']}})[_0x1117('0x15')](handleEntityNotFound(_0x27f8b6,null))[_0x1117('0x15')](function(_0x4db41b){if(_0x4db41b){_0x1d5fd3[_0x1117('0x38')]=_['keys'](db[_0x1117('0x5c')]['rawAttributes']);_0x1d5fd3[_0x1117('0x35')]=_['keys'](_0x1e13e9['query']);_0x1d5fd3[_0x1117('0x3b')]=_[_0x1117('0x94')](_0x1d5fd3[_0x1117('0x38')],_0x1d5fd3[_0x1117('0x35')]);_0x35db6e[_0x1117('0x3d')]=_[_0x1117('0x94')](_0x1d5fd3[_0x1117('0x38')],qs[_0x1117('0x3c')](_0x1e13e9['query'][_0x1117('0x3c')]));_0x35db6e[_0x1117('0x3d')]=_0x35db6e[_0x1117('0x3d')][_0x1117('0x3e')]?_0x35db6e[_0x1117('0x3d')]:_0x1d5fd3[_0x1117('0x38')];if(!_0x1e13e9[_0x1117('0x35')][_0x1117('0x95')](_0x1117('0x96'))){_0x35db6e['limit']=qs['limit'](_0x1e13e9['query']['limit']);_0x35db6e[_0x1117('0x21')]=qs[_0x1117('0x21')](_0x1e13e9[_0x1117('0x35')][_0x1117('0x21')]);}_0x35db6e[_0x1117('0xa1')]=qs[_0x1117('0x97')](_0x1e13e9['query'][_0x1117('0x97')]);_0x35db6e['where']=qs[_0x1117('0x3b')](_[_0x1117('0x99')](_0x1e13e9[_0x1117('0x35')],_0x1d5fd3[_0x1117('0x3b')]));_0x35db6e[_0x1117('0x98')][_0x1117('0x9a')]=_0x4db41b['id'];if(_0x1e13e9['query'][_0x1117('0x9b')]){_0x35db6e['where']=_['merge'](_0x35db6e[_0x1117('0x98')],{'$or':_[_0x1117('0x31')](_0x35db6e[_0x1117('0x3d')],function(_0x340e33){var _0x269d65={};_0x269d65[_0x340e33]={'$like':'%'+_0x1e13e9['query'][_0x1117('0x9b')]+'%'};return _0x269d65;})});}_0x35db6e[_0x1117('0x98')][_0x1117('0x88')]=![];if(_0x1e13e9[_0x1117('0x35')]['id']){_0x35db6e['where']['id']={'$gt':_0x1e13e9['query']['id']};}_0x35db6e=_[_0x1117('0x2c')]({},_0x35db6e,_0x1e13e9['options']);return db[_0x1117('0x5c')][_0x1117('0x23')]({'where':_0x35db6e[_0x1117('0x98')]})[_0x1117('0x15')](function(_0xf4ea38){_0x2207ec[_0x1117('0x23')]=_0xf4ea38;_0x35db6e[_0x1117('0x40')]=[];if(_0x1e13e9[_0x1117('0x35')][_0x1117('0xa2')]){_0x35db6e[_0x1117('0x40')][_0x1117('0xa3')]({'model':db[_0x1117('0x79')],'as':'User','attributes':['id',_0x1117('0x50'),_0x1117('0xa4')]});}if(_0x1e13e9[_0x1117('0x35')][_0x1117('0x3f')]){_0x35db6e[_0x1117('0x40')]=[{'all':!![]}];}return db[_0x1117('0x5c')]['findAll'](_0x35db6e);})[_0x1117('0x15')](function(_0x5ed6a3){_0x2207ec[_0x1117('0x9f')]=_0x5ed6a3;return _0x2207ec;});}})['then'](respondWithFilteredResult(_0x27f8b6,_0x35db6e))[_0x1117('0x43')](handleError(_0x27f8b6,null));};exports[_0x1117('0xa5')]=function(_0x5daf4e,_0x49e786){return db[_0x1117('0x32')][_0x1117('0x42')]({'where':{'id':_0x5daf4e[_0x1117('0x46')]['id']}})[_0x1117('0x15')](handleEntityNotFound(_0x49e786,null))[_0x1117('0x15')](function(_0xe47276){if(_0xe47276){return _0xe47276[_0x1117('0xa6')](_0x5daf4e[_0x1117('0x45')][_0x1117('0x92')],_[_0x1117('0x93')](_0x5daf4e[_0x1117('0x45')],[_0x1117('0x92'),'id'])||{})[_0x1117('0xa7')](function(){return db[_0x1117('0xa8')][_0x1117('0xa9')]({'attributes':['id','name',_0x1117('0xaa')],'where':{'id':_0x5daf4e[_0x1117('0x45')][_0x1117('0x92')]}});})[_0x1117('0x15')](function(_0x38125c){socket[_0x1117('0xab')](_0x1117('0xac'),{'id':Number(_0x5daf4e[_0x1117('0x46')]['id']),'tags':_0x38125c||[]});return{'id':Number(_0x5daf4e[_0x1117('0x46')]['id']),'tags':_0x38125c||[]};});}})[_0x1117('0x15')](respondWithResult(_0x49e786,null))[_0x1117('0x43')](handleError(_0x49e786,null));};exports[_0x1117('0xad')]=function(_0x52b829,_0x5a3157){return db[_0x1117('0x32')][_0x1117('0x42')]({'where':{'id':_0x52b829[_0x1117('0x46')]['id']}})[_0x1117('0x15')](handleEntityNotFound(_0x5a3157,null))[_0x1117('0x15')](function(_0x5a05dd){if(_0x5a05dd){return _0x5a05dd[_0x1117('0xad')](_0x52b829[_0x1117('0x35')][_0x1117('0x92')]);}})['then'](respondWithStatusCode(_0x5a3157,null))[_0x1117('0x43')](handleError(_0x5a3157,null));};exports[_0x1117('0xae')]=function(_0xcf98fa,_0x44e929){var _0x27e4cc=moment()[_0x1117('0xaf')]()[_0x1117('0xb0')]();var _0xb35633=path[_0x1117('0x72')](config['root'],_0x1117('0xb1'),_0x1117('0xb2'),_0x1117('0xb3'));var _0x7b4faf=path['join'](config[_0x1117('0x71')],_0x1117('0xb1'),_0x1117('0xb2'),_0x1117('0xb4'));var _0x348a8e=path[_0x1117('0x72')](_0xb35633,_0x27e4cc);var _0x5ab7e2=util['format'](_0x1117('0xb5'),_0xcf98fa[_0x1117('0x46')]['id'],_0x27e4cc);var _0x10f95b=path[_0x1117('0x72')](_0xb35633,_0x5ab7e2);var _0x3d6e4a=[];_0x3d6e4a[_0x1117('0xa3')]({'model':db[_0x1117('0x79')],'as':_0x1117('0x79'),'attributes':['id',_0x1117('0x50')],'raw':!![]});_0x3d6e4a[_0x1117('0xa3')]({'model':db[_0x1117('0x5f')],'as':'Contact','attributes':['id',_0x1117('0xb6'),_0x1117('0xb7')],'raw':!![]});if(_0xcf98fa[_0x1117('0x35')][_0x1117('0xb4')]){_0x3d6e4a[_0x1117('0xa3')]({'model':db[_0x1117('0xb8')],'as':_0x1117('0xb8'),'raw':!![]});}var _0x3f8fbc=[{'model':db['ChatMessage'],'as':_0x1117('0x78'),'attributes':['id',_0x1117('0x45'),'createdAt','direction','secret',_0x1117('0xb9')],'include':_0x3d6e4a}];_0x3f8fbc[_0x1117('0xa3')]({'model':db['ChatWebsite'],'as':_0x1117('0xba'),'attributes':['id',_0x1117('0x2a')]});_0x3f8fbc['push']({'model':db[_0x1117('0x79')],'as':_0x1117('0xbb'),'attributes':['id',_0x1117('0x50')]});return db['ChatInteraction'][_0x1117('0x42')]({'where':{'id':_0xcf98fa[_0x1117('0x46')]['id']},'include':_0x3f8fbc})['then'](handleEntityNotFound(_0x44e929,null))[_0x1117('0x15')](function(_0x38645a){if(_0x38645a){var _0x585f4e=_0x38645a[_0x1117('0xbc')]({'plain':!![]});fs[_0x1117('0xbd')](_0x348a8e);var _0x124ec7={'channel':_0x1117('0xbe'),'account':_0x585f4e[_0x1117('0xba')][_0x1117('0x2a')],'agent':_0x585f4e[_0x1117('0xbb')]?_0x585f4e[_0x1117('0xbb')][_0x1117('0x50')]:'N.A.','createdAt':moment(_0x585f4e[_0x1117('0x86')])[_0x1117('0x7c')](_0x1117('0x9e'))[_0x1117('0xb0')](),'closedAt':_0x585f4e['closed']?moment(_0x585f4e[_0x1117('0xbf')])[_0x1117('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1117('0xb0')]():'','disposition':_0x585f4e[_0x1117('0x65')],'chatInfo':{'browser':_0x585f4e[_0x1117('0xc0')],'os':_0x585f4e['osName'],'referer':_0x585f4e[_0x1117('0xc1')],'customerIp':_0x585f4e[_0x1117('0xc2')],'customerPort':_0x585f4e[_0x1117('0xc3')]?_0x585f4e[_0x1117('0xc3')]:_0x1117('0xc4')},'messages':_(_0x585f4e[_0x1117('0x78')])[_0x1117('0xc5')]()['filter']({'secret':![]})[_0x1117('0x31')](function(_0x355e76){if(_0x355e76[_0x1117('0xb8')]){var _0x49b20d=path[_0x1117('0x72')](_0x7b4faf,_0x355e76['Attachment']['basename']);if(fs[_0x1117('0xc6')](_0x49b20d)){fs['createReadStream'](_0x49b20d)['pipe'](fs['createWriteStream'](path[_0x1117('0x72')](_0x348a8e,_0x355e76[_0x1117('0xb8')][_0x1117('0x6a')])));}}return{'date':moment(_0x355e76['createdAt'])[_0x1117('0x7c')](_0x1117('0x9e'))[_0x1117('0xb0')](),'sender':_0x355e76[_0x1117('0x87')]===_0x1117('0xc7')?_0x355e76[_0x1117('0x79')]?_0x355e76[_0x1117('0x79')][_0x1117('0x50')]:_0x1117('0x7d'):_0x355e76[_0x1117('0x60')][_0x1117('0xb6')]+(_0x355e76[_0x1117('0x60')][_0x1117('0xb7')]?'\x20'+_0x355e76[_0x1117('0x60')]['lastName']:''),'body':_0x355e76[_0x1117('0xb8')]?_0x355e76['Attachment'][_0x1117('0x6a')]:_0x355e76[_0x1117('0x45')],'direction':_0x355e76[_0x1117('0x87')]===_0x1117('0xc7')?'A':'C','secret':_0x355e76[_0x1117('0x88')],'read':_0x355e76[_0x1117('0xb9')],'attachment':_0x355e76[_0x1117('0xb8')]};})[_0x1117('0xc8')]()};return ejs[_0x1117('0xc9')](path[_0x1117('0x72')](config['root'],'server','views',_0x1117('0xca')),{'interaction':_0x124ec7})[_0x1117('0x15')](function(_0x1ac621){var _0x20cbcf=path[_0x1117('0x72')](_0x348a8e,_0x1117('0xcb')+_0x585f4e['id']+'-'+_0x27e4cc+_0x1117('0xcc'));var _0x147f89={'path':_0x20cbcf,'channel':'Chat','interactionId':_0x585f4e['id']};return pdf[_0x1117('0xcd')](_0x1ac621,_0x147f89);})[_0x1117('0x15')](function(){return new Promise(function(_0x564e93,_0x337427){zipdir(_0x348a8e,{'saveTo':_0x10f95b},function(_0xf414cf,_0x21aaf2){if(_0xf414cf)return _0x337427(_0xf414cf);return _0x564e93(_0x21aaf2);});})[_0x1117('0x15')](function(){return new BPromise(function(_0x45a0e2,_0x34c9ed){rimraf(_0x348a8e,function(_0x1839ff){if(_0x1839ff)_0x34c9ed(_0x1839ff);return _0x45a0e2();});});})['then'](function(){return _0x44e929['download'](_0x10f95b,_0x5ab7e2,function(_0x539e00){if(_0x539e00){logger[_0x1117('0x1a')](_0x1117('0xce'),_0x539e00);}else{fs['unlinkSync'](_0x10f95b);}});});});}else{return _0x44e929[_0x1117('0x1d')](0xc8);}})[_0x1117('0x43')](handleError(_0x44e929,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f9cb1ed..a7381a3 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 _0xa821=['Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','update','remove','then','setDataValue'];(function(_0x635c51,_0x5727fc){var _0x2e5152=function(_0x51ce7e){while(--_0x51ce7e){_0x635c51['push'](_0x635c51['shift']());}};_0x2e5152(++_0x5727fc);}(_0xa821,0x1a0));var _0x1a82=function(_0x11c93e,_0x3edb7d){_0x11c93e=_0x11c93e-0x0;var _0x4e8cdc=_0xa821[_0x11c93e];return _0x4e8cdc;};'use strict';var EventEmitter=require(_0x1a82('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x1a82('0x1')];var ChatMessage=require(_0x1a82('0x2'))['db'][_0x1a82('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1a82('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a82('0x5'),'afterDestroy':_0x1a82('0x6')};function emitEvent(_0xf3ae9c){return function(_0x2531bf,_0x5f1839,_0xed7a71){_0x2531bf['getUsers']({'attributes':['id'],'raw':!![]})[_0x1a82('0x7')](function(_0x48faeb){_0x2531bf[_0x1a82('0x8')](_0x1a82('0x9'),_0x48faeb[_0x1a82('0xa')](function(_0x5f04eb){return{'id':_0x5f04eb['id']};}));return ChatMessage[_0x1a82('0xb')]({'where':{'ChatInteractionId':_0x2531bf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1a82('0x7')](function(_0x1e6966){_0x2531bf[_0x1a82('0x8')](_0x1a82('0xc'),_0x1e6966[_0x1a82('0xd')]);ChatInteractionEvents[_0x1a82('0xe')](_0xf3ae9c+':'+_0x2531bf['id'],_0x2531bf);ChatInteractionEvents['emit'](_0xf3ae9c,_0x2531bf);_0xed7a71(null);})['catch'](_0xed7a71(null));};}for(var e in events){if(events[_0x1a82('0xf')](e)){var event=events[e];ChatInteraction[_0x1a82('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x1928=['../../mysqldb','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','catch','hasOwnProperty','hook','exports','events'];(function(_0x4f278f,_0x4a3235){var _0x18d4ae=function(_0x539e95){while(--_0x539e95){_0x4f278f['push'](_0x4f278f['shift']());}};_0x18d4ae(++_0x4a3235);}(_0x1928,0x15f));var _0x8192=function(_0x2f1ee4,_0x3a3f91){_0x2f1ee4=_0x2f1ee4-0x0;var _0x12beb9=_0x1928[_0x2f1ee4];return _0x12beb9;};'use strict';var EventEmitter=require(_0x8192('0x0'));var ChatInteraction=require(_0x8192('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x8192('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8192('0x2')](0x0);var events={'afterCreate':_0x8192('0x3'),'afterUpdate':_0x8192('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1f197f){return function(_0xcf11a0,_0xc6bce4,_0xb259be){_0xcf11a0[_0x8192('0x5')]({'attributes':['id'],'raw':!![]})[_0x8192('0x6')](function(_0x59ff85){_0xcf11a0[_0x8192('0x7')](_0x8192('0x8'),_0x59ff85[_0x8192('0x9')](function(_0x3be764){return{'id':_0x3be764['id']};}));return ChatMessage[_0x8192('0xa')]({'where':{'ChatInteractionId':_0xcf11a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8192('0x6')](function(_0x26a1c3){_0xcf11a0['setDataValue'](_0x8192('0xb'),_0x26a1c3['length']);ChatInteractionEvents['emit'](_0x1f197f+':'+_0xcf11a0['id'],_0xcf11a0);ChatInteractionEvents['emit'](_0x1f197f,_0xcf11a0);_0xb259be(null);})[_0x8192('0xc')](_0xb259be(null));};}for(var e in events){if(events[_0x8192('0xd')](e)){var event=events[e];ChatInteraction[_0x8192('0xe')](e,emitEvent(event));}}module[_0x8192('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index eae0e1a..634b42d 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 _0x5681=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','chat_interactions','changed'];(function(_0x44e866,_0x17ce18){var _0x50eb6a=function(_0x75b5ea){while(--_0x75b5ea){_0x44e866['push'](_0x44e866['shift']());}};_0x50eb6a(++_0x17ce18);}(_0x5681,0x137));var _0x1568=function(_0xb433a3,_0x2b0137){_0xb433a3=_0xb433a3-0x0;var _0x367bac=_0x5681[_0xb433a3];return _0x367bac;};'use strict';var _=require(_0x1568('0x0'));var util=require('util');var logger=require(_0x1568('0x1'))('api');var moment=require(_0x1568('0x2'));var BPromise=require(_0x1568('0x3'));var rp=require(_0x1568('0x4'));var fs=require('fs');var path=require(_0x1568('0x5'));var rimraf=require(_0x1568('0x6'));var config=require(_0x1568('0x7'));var attributes=require(_0x1568('0x8'));module['exports']=function(_0x220e18,_0x5426c5){return _0x220e18[_0x1568('0x9')]('ChatInteraction',attributes,{'tableName':_0x1568('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8be2bc,_0x3d84b2,_0xc87c40){if(_0x8be2bc[_0x1568('0xb')]('closed')){_0x8be2bc[_0x1568('0xc')]=moment()[_0x1568('0xd')](_0x1568('0xe'));}_0xc87c40(null,_0x8be2bc);}},'charset':_0x1568('0xf'),'collate':_0x1568('0x10')});}; \ No newline at end of file +var _0x687e=['define','ChatInteraction','chat_interactions','changed','closed','format','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports'];(function(_0x3aa95e,_0x1224b9){var _0x433ffd=function(_0x1df756){while(--_0x1df756){_0x3aa95e['push'](_0x3aa95e['shift']());}};_0x433ffd(++_0x1224b9);}(_0x687e,0xbb));var _0xe687=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x687e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe687('0x0'));var util=require(_0xe687('0x1'));var logger=require(_0xe687('0x2'))(_0xe687('0x3'));var moment=require(_0xe687('0x4'));var BPromise=require('bluebird');var rp=require(_0xe687('0x5'));var fs=require('fs');var path=require(_0xe687('0x6'));var rimraf=require(_0xe687('0x7'));var config=require(_0xe687('0x8'));var attributes=require(_0xe687('0x9'));module[_0xe687('0xa')]=function(_0x13941f,_0x12f15e){return _0x13941f[_0xe687('0xb')](_0xe687('0xc'),attributes,{'tableName':_0xe687('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d7d4f,_0x56b4ce,_0x17f712){if(_0x4d7d4f[_0xe687('0xe')](_0xe687('0xf'))){_0x4d7d4f['closedAt']=moment()[_0xe687('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x17f712(null,_0x4d7d4f);}},'charset':'utf8mb4','collate':_0xe687('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b56e316..1808fc7 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 _0x5229=['update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction'];(function(_0x91745a,_0x349855){var _0x398c51=function(_0x2a7f16){while(--_0x2a7f16){_0x91745a['push'](_0x91745a['shift']());}};_0x398c51(++_0x349855);}(_0x5229,0x199));var _0x9522=function(_0x2e0480,_0xc5c0c9){_0x2e0480=_0x2e0480-0x0;var _0x4afef2=_0x5229[_0x2e0480];return _0x4afef2;};'use strict';var _=require(_0x9522('0x0'));var util=require(_0x9522('0x1'));var moment=require(_0x9522('0x2'));var BPromise=require(_0x9522('0x3'));var rs=require(_0x9522('0x4'));var fs=require('fs');var Redis=require(_0x9522('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9522('0x6'));var logger=require(_0x9522('0x7'))('rpc');var config=require(_0x9522('0x8'));var jayson=require(_0x9522('0x9'));var client=jayson[_0x9522('0xa')][_0x9522('0xb')]({'port':0x232a});config[_0x9522('0xc')]=_[_0x9522('0xd')](config[_0x9522('0xc')],{'host':_0x9522('0xe'),'port':0x18eb});var socket=require(_0x9522('0xf'))(new Redis(config['redis']));require(_0x9522('0x10'))['register'](socket);function respondWithRpcPromise(_0x4a271b,_0x748e5d,_0x2bbfe4){return new BPromise(function(_0x42b8d8,_0x5e26b2){return client[_0x9522('0x11')](_0x4a271b,_0x2bbfe4)[_0x9522('0x12')](function(_0x514123){logger[_0x9522('0x13')](_0x9522('0x14'),_0x748e5d,_0x9522('0x15'));logger[_0x9522('0x16')](_0x9522('0x17'),_0x748e5d,'request\x20sent',JSON[_0x9522('0x18')](_0x514123));if(_0x514123[_0x9522('0x19')]){if(_0x514123[_0x9522('0x19')]['code']===0x1f4){logger[_0x9522('0x19')](_0x9522('0x14'),_0x748e5d,_0x514123['error'][_0x9522('0x1a')]);return _0x5e26b2(_0x514123[_0x9522('0x19')][_0x9522('0x1a')]);}logger[_0x9522('0x19')](_0x9522('0x14'),_0x748e5d,_0x514123[_0x9522('0x19')][_0x9522('0x1a')]);return _0x42b8d8(_0x514123[_0x9522('0x19')][_0x9522('0x1a')]);}else{logger[_0x9522('0x13')](_0x9522('0x14'),_0x748e5d,_0x9522('0x15'));_0x42b8d8(_0x514123[_0x9522('0x1b')][_0x9522('0x1a')]);}})[_0x9522('0x1c')](function(_0x340b69){logger[_0x9522('0x19')](_0x9522('0x14'),_0x748e5d,_0x340b69);_0x5e26b2(_0x340b69);});});}exports[_0x9522('0x1d')]=function(_0x4ab175){var _0x37515b=this;return new Promise(function(_0x21563b,_0x4394f0){return db[_0x9522('0x1e')][_0x9522('0x1f')](_0x4ab175[_0x9522('0x20')],{'raw':_0x4ab175[_0x9522('0x21')]?_0x4ab175['options'][_0x9522('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ab175[_0x9522('0x21')]?_0x4ab175['options'][_0x9522('0x23')]||null:null,'attributes':_0x4ab175['options']?_0x4ab175[_0x9522('0x21')][_0x9522('0x24')]||null:null,'limit':_0x4ab175['options']?_0x4ab175[_0x9522('0x21')][_0x9522('0x25')]||null:null})[_0x9522('0x12')](function(_0x30939a){logger[_0x9522('0x13')](_0x9522('0x1d'),_0x4ab175);logger[_0x9522('0x16')](_0x9522('0x1d'),_0x4ab175,JSON[_0x9522('0x18')](_0x30939a));_0x21563b(_0x30939a);})[_0x9522('0x1c')](function(_0x26346e){logger[_0x9522('0x19')](_0x9522('0x1d'),_0x26346e[_0x9522('0x1a')],_0x4ab175);_0x4394f0(_0x37515b[_0x9522('0x19')](0x1f4,_0x26346e['message']));});});};exports['AddTagsToChatInteraction']=function(_0x224416){return new Promise(function(_0x33eff1,_0x4d8e07){return db[_0x9522('0x1e')][_0x9522('0x26')]({'where':_0x224416[_0x9522('0x21')]?_0x224416[_0x9522('0x21')][_0x9522('0x23')]||null:null})[_0x9522('0x12')](function(_0x165728){if(_0x165728){return _0x165728[_0x9522('0x27')](_0x224416['body'][_0x9522('0x28')],_[_0x9522('0x29')](_0x224416['body'],[_0x9522('0x28'),'id'])||{});}})[_0x9522('0x2a')](function(_0x482efa){logger[_0x9522('0x13')](_0x9522('0x2b'),_0x224416);logger[_0x9522('0x16')](_0x9522('0x2b'),_0x224416,JSON['stringify'](_0x482efa));_0x33eff1(_0x482efa);})['catch'](function(_0x26a70c){logger[_0x9522('0x19')](_0x9522('0x2b'),_0x26a70c[_0x9522('0x1a')],_0x224416);_0x4d8e07(_this['error'](0x1f4,_0x26a70c[_0x9522('0x1a')]));});});}; \ No newline at end of file +var _0xc7c9=['options','raw','where','limit','then','catch','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateChatInteraction','update','body'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xc7c9,0x134));var _0x9c7c=function(_0x5370c1,_0x39ee43){_0x5370c1=_0x5370c1-0x0;var _0xe6e5da=_0xc7c9[_0x5370c1];return _0xe6e5da;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9c7c('0x0'));var BPromise=require(_0x9c7c('0x1'));var rs=require(_0x9c7c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c7c('0x3'))['db'];var utils=require(_0x9c7c('0x4'));var logger=require('../../config/logger')(_0x9c7c('0x5'));var config=require('../../config/environment');var jayson=require(_0x9c7c('0x6'));var client=jayson[_0x9c7c('0x7')]['http']({'port':0x232a});config['redis']=_[_0x9c7c('0x8')](config['redis'],{'host':_0x9c7c('0x9'),'port':0x18eb});var socket=require(_0x9c7c('0xa'))(new Redis(config[_0x9c7c('0xb')]));require(_0x9c7c('0xc'))[_0x9c7c('0xd')](socket);function respondWithRpcPromise(_0x221b2e,_0x241ac6,_0x1d7442){return new BPromise(function(_0xa28c1b,_0x4bc3bf){return client[_0x9c7c('0xe')](_0x221b2e,_0x1d7442)['then'](function(_0x3b449c){logger[_0x9c7c('0xf')](_0x9c7c('0x10'),_0x241ac6,'request\x20sent');logger[_0x9c7c('0x11')](_0x9c7c('0x12'),_0x241ac6,_0x9c7c('0x13'),JSON[_0x9c7c('0x14')](_0x3b449c));if(_0x3b449c[_0x9c7c('0x15')]){if(_0x3b449c['error'][_0x9c7c('0x16')]===0x1f4){logger[_0x9c7c('0x15')](_0x9c7c('0x10'),_0x241ac6,_0x3b449c[_0x9c7c('0x15')][_0x9c7c('0x17')]);return _0x4bc3bf(_0x3b449c[_0x9c7c('0x15')][_0x9c7c('0x17')]);}logger[_0x9c7c('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x241ac6,_0x3b449c[_0x9c7c('0x15')][_0x9c7c('0x17')]);return _0xa28c1b(_0x3b449c['error'][_0x9c7c('0x17')]);}else{logger[_0x9c7c('0xf')](_0x9c7c('0x10'),_0x241ac6,_0x9c7c('0x13'));_0xa28c1b(_0x3b449c[_0x9c7c('0x18')][_0x9c7c('0x17')]);}})['catch'](function(_0x366ad5){logger['error'](_0x9c7c('0x10'),_0x241ac6,_0x366ad5);_0x4bc3bf(_0x366ad5);});});}exports[_0x9c7c('0x19')]=function(_0x390a54){var _0x30e483=this;return new Promise(function(_0x407de5,_0x10c7b5){return db['ChatInteraction'][_0x9c7c('0x1a')](_0x390a54[_0x9c7c('0x1b')],{'raw':_0x390a54[_0x9c7c('0x1c')]?_0x390a54[_0x9c7c('0x1c')][_0x9c7c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x390a54[_0x9c7c('0x1c')]?_0x390a54[_0x9c7c('0x1c')][_0x9c7c('0x1e')]||null:null,'attributes':_0x390a54[_0x9c7c('0x1c')]?_0x390a54['options']['attributes']||null:null,'limit':_0x390a54['options']?_0x390a54['options'][_0x9c7c('0x1f')]||null:null})[_0x9c7c('0x20')](function(_0x196eb1){logger['info'](_0x9c7c('0x19'),_0x390a54);logger[_0x9c7c('0x11')](_0x9c7c('0x19'),_0x390a54,JSON[_0x9c7c('0x14')](_0x196eb1));_0x407de5(_0x196eb1);})[_0x9c7c('0x21')](function(_0x4cf795){logger[_0x9c7c('0x15')](_0x9c7c('0x19'),_0x4cf795[_0x9c7c('0x17')],_0x390a54);_0x10c7b5(_0x30e483['error'](0x1f4,_0x4cf795[_0x9c7c('0x17')]));});});};exports[_0x9c7c('0x22')]=function(_0x1701f8){return new Promise(function(_0x17558a,_0x3c3da1){return db[_0x9c7c('0x23')][_0x9c7c('0x24')]({'where':_0x1701f8[_0x9c7c('0x1c')]?_0x1701f8[_0x9c7c('0x1c')][_0x9c7c('0x1e')]||null:null})[_0x9c7c('0x20')](function(_0x474c16){if(_0x474c16){return _0x474c16[_0x9c7c('0x25')](_0x1701f8['body'][_0x9c7c('0x26')],_[_0x9c7c('0x27')](_0x1701f8[_0x9c7c('0x1b')],['ids','id'])||{});}})[_0x9c7c('0x28')](function(_0x5958f1){logger[_0x9c7c('0xf')](_0x9c7c('0x29'),_0x1701f8);logger[_0x9c7c('0x11')]('AddTags',_0x1701f8,JSON[_0x9c7c('0x14')](_0x5958f1));_0x17558a(_0x5958f1);})['catch'](function(_0x14afe1){logger[_0x9c7c('0x15')](_0x9c7c('0x29'),_0x14afe1['message'],_0x1701f8);_0x3c3da1(_this[_0x9c7c('0x15')](0x1f4,_0x14afe1[_0x9c7c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 3c83d42..bc25839 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 _0xfb67=['remove','removeListener','register','./chatInteraction.events','save'];(function(_0x4107f5,_0x40cd40){var _0x29d363=function(_0x2fc188){while(--_0x2fc188){_0x4107f5['push'](_0x4107f5['shift']());}};_0x29d363(++_0x40cd40);}(_0xfb67,0x1f2));var _0x7fb6=function(_0x383b65,_0x490f6a){_0x383b65=_0x383b65-0x0;var _0x441a42=_0xfb67[_0x383b65];return _0x441a42;};'use strict';var ChatInteractionEvents=require(_0x7fb6('0x0'));var events=[_0x7fb6('0x1'),_0x7fb6('0x2'),'update'];function createListener(_0x77c630,_0x1bb662){return function(_0x5c758c){_0x1bb662['emit'](_0x77c630,_0x5c758c);};}function removeListener(_0x33e396,_0x54f797){return function(){ChatInteractionEvents[_0x7fb6('0x3')](_0x33e396,_0x54f797);};}exports[_0x7fb6('0x4')]=function(_0x5a9177){for(var _0x249818=0x0,_0x24f150=events['length'];_0x249818<_0x24f150;_0x249818++){var _0x2cf98c=events[_0x249818];var _0x470189=createListener('chatInteraction:'+_0x2cf98c,_0x5a9177);ChatInteractionEvents['on'](_0x2cf98c,_0x470189);}}; \ No newline at end of file +var _0xa82a=['save','remove','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x5aaa4b,_0x541486){var _0x195ef0=function(_0x4b579d){while(--_0x4b579d){_0x5aaa4b['push'](_0x5aaa4b['shift']());}};_0x195ef0(++_0x541486);}(_0xa82a,0x1e7));var _0xaa82=function(_0x2cfe49,_0x5b5d6d){_0x2cfe49=_0x2cfe49-0x0;var _0x569f94=_0xa82a[_0x2cfe49];return _0x569f94;};'use strict';var ChatInteractionEvents=require(_0xaa82('0x0'));var events=[_0xaa82('0x1'),_0xaa82('0x2'),_0xaa82('0x3')];function createListener(_0xd4a815,_0x2d3f69){return function(_0x45b23a){_0x2d3f69[_0xaa82('0x4')](_0xd4a815,_0x45b23a);};}function removeListener(_0x5e470d,_0xaaab88){return function(){ChatInteractionEvents[_0xaa82('0x5')](_0x5e470d,_0xaaab88);};}exports[_0xaa82('0x6')]=function(_0x313fd4){for(var _0x19dd6a=0x0,_0x33f73e=events['length'];_0x19dd6a<_0x33f73e;_0x19dd6a++){var _0x3120ff=events[_0x19dd6a];var _0x1fc51f=createListener(_0xaa82('0x7')+_0x3120ff,_0x313fd4);ChatInteractionEvents['on'](_0x3120ff,_0x1fc51f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 528842e..3b2feb7 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 _0xb5a9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','download','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','now','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0x1ed229,_0x50c086){var _0x2b18b9=function(_0x1ffc76){while(--_0x1ffc76){_0x1ed229['push'](_0x1ed229['shift']());}};_0x2b18b9(++_0x50c086);}(_0xb5a9,0x1a9));var _0x9b5a=function(_0x439737,_0x557795){_0x439737=_0x439737-0x0;var _0x56e95d=_0xb5a9[_0x439737];return _0x56e95d;};'use strict';var multer=require(_0x9b5a('0x0'));var util=require(_0x9b5a('0x1'));var path=require(_0x9b5a('0x2'));var timeout=require(_0x9b5a('0x3'));var express=require(_0x9b5a('0x4'));var router=express[_0x9b5a('0x5')]();var fs_extra=require(_0x9b5a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9b5a('0x7'));var controller=require(_0x9b5a('0x8'));router[_0x9b5a('0x9')]('/',auth[_0x9b5a('0xa')](),controller[_0x9b5a('0xb')]);router['get'](_0x9b5a('0xc'),auth[_0x9b5a('0xa')](),controller[_0x9b5a('0xd')]);router[_0x9b5a('0x9')](_0x9b5a('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x9b5a('0xf')]);router[_0x9b5a('0x9')](_0x9b5a('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x9b5a('0x11')]);router[_0x9b5a('0x9')]('/:id/messages',auth[_0x9b5a('0xa')](),controller[_0x9b5a('0x12')]);router['get'](_0x9b5a('0x13'),auth[_0x9b5a('0x14')](),controller[_0x9b5a('0x15')]);router['get']('/:id/download',auth[_0x9b5a('0xa')](),controller[_0x9b5a('0x16')]);router['post']('/',auth[_0x9b5a('0xa')](),controller['create']);router[_0x9b5a('0x17')](_0x9b5a('0x18'),auth['isAuthenticated'](),controller[_0x9b5a('0x19')]);var upload=multer({'storage':multer[_0x9b5a('0x1a')]({'destination':function(_0x366de6,_0x583a9a,_0x182aa2){_0x182aa2(null,path['join'](config[_0x9b5a('0x1b')],_0x9b5a('0x1c')));},'filename':function(_0x5df7bb,_0x481bd4,_0x3c63a0){_0x3c63a0(null,util[_0x9b5a('0x1d')]('%s-%s',Date[_0x9b5a('0x1e')](),_0x481bd4['originalname'][_0x9b5a('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9b5a('0x17')](_0x9b5a('0x20'),upload[_0x9b5a('0x21')](_0x9b5a('0x22')),controller[_0x9b5a('0x23')]);router[_0x9b5a('0x17')](_0x9b5a('0x24'),auth[_0x9b5a('0x14')](),controller[_0x9b5a('0x25')]);router[_0x9b5a('0x17')]('/:id/tags',auth[_0x9b5a('0xa')](),interaction['tracked'](_0x9b5a('0x26'),_0x9b5a('0x27')),controller[_0x9b5a('0x28')]);router[_0x9b5a('0x29')](_0x9b5a('0xe'),auth[_0x9b5a('0xa')](),interaction[_0x9b5a('0x2a')](_0x9b5a('0x26'),_0x9b5a('0x2b')),controller[_0x9b5a('0x2c')]);router[_0x9b5a('0x29')](_0x9b5a('0x2d'),controller['customUpdate']);router[_0x9b5a('0x29')]('/:id/abandon',auth[_0x9b5a('0x14')](),controller['abandon']);router[_0x9b5a('0x29')]('/:id/close',controller[_0x9b5a('0x2e')]);router[_0x9b5a('0x2f')](_0x9b5a('0xe'),auth['isAuthenticated'](),interaction[_0x9b5a('0x2a')](_0x9b5a('0x26'),_0x9b5a('0x30')),controller[_0x9b5a('0x31')]);router[_0x9b5a('0x2f')](_0x9b5a('0x32'),auth[_0x9b5a('0xa')](),controller[_0x9b5a('0x33')]);module[_0x9b5a('0x34')]=router; \ No newline at end of file +var _0x78dc=['getMyMessages','/:id/download','download','post','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages'];(function(_0x57da9c,_0x30c20a){var _0x27b9e0=function(_0x2350b5){while(--_0x2350b5){_0x57da9c['push'](_0x57da9c['shift']());}};_0x27b9e0(++_0x30c20a);}(_0x78dc,0x179));var _0xc78d=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x78dc[_0x2085f3];return _0x384e3c;};'use strict';var multer=require(_0xc78d('0x0'));var util=require(_0xc78d('0x1'));var path=require(_0xc78d('0x2'));var timeout=require(_0xc78d('0x3'));var express=require(_0xc78d('0x4'));var router=express[_0xc78d('0x5')]();var fs_extra=require(_0xc78d('0x6'));var auth=require(_0xc78d('0x7'));var interaction=require(_0xc78d('0x8'));var config=require('../../config/environment');var controller=require(_0xc78d('0x9'));router[_0xc78d('0xa')]('/',auth[_0xc78d('0xb')](),controller[_0xc78d('0xc')]);router['get'](_0xc78d('0xd'),auth[_0xc78d('0xb')](),controller[_0xc78d('0xe')]);router[_0xc78d('0xa')](_0xc78d('0xf'),auth[_0xc78d('0x10')](),controller[_0xc78d('0x11')]);router[_0xc78d('0xa')](_0xc78d('0x12'),auth[_0xc78d('0x10')](),controller[_0xc78d('0x13')]);router[_0xc78d('0xa')](_0xc78d('0x14'),auth[_0xc78d('0xb')](),controller[_0xc78d('0x15')]);router[_0xc78d('0xa')]('/:id/my_messages',auth[_0xc78d('0x10')](),controller[_0xc78d('0x16')]);router[_0xc78d('0xa')](_0xc78d('0x17'),auth[_0xc78d('0xb')](),controller[_0xc78d('0x18')]);router[_0xc78d('0x19')]('/',auth[_0xc78d('0xb')](),controller['create']);router[_0xc78d('0x19')](_0xc78d('0x1a'),auth[_0xc78d('0xb')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xc78d('0x1b')]({'destination':function(_0x3115d6,_0x180fa7,_0x24b48d){_0x24b48d(null,path[_0xc78d('0x1c')](config[_0xc78d('0x1d')],_0xc78d('0x1e')));},'filename':function(_0x398dae,_0x3ae75f,_0x3248dd){_0x3248dd(null,util[_0xc78d('0x1f')](_0xc78d('0x20'),Date[_0xc78d('0x21')](),_0x3ae75f[_0xc78d('0x22')][_0xc78d('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc78d('0x19')](_0xc78d('0x24'),upload[_0xc78d('0x25')](_0xc78d('0x26')),controller[_0xc78d('0x27')]);router['post'](_0xc78d('0x14'),auth['isChatInteractionAuthorized'](),controller[_0xc78d('0x28')]);router[_0xc78d('0x19')]('/:id/tags',auth[_0xc78d('0xb')](),interaction[_0xc78d('0x29')](_0xc78d('0x2a'),_0xc78d('0x2b')),controller[_0xc78d('0x2c')]);router[_0xc78d('0x2d')]('/:id',auth['isAuthenticated'](),interaction['tracked']('chat','chatinteraction:update'),controller[_0xc78d('0x2e')]);router[_0xc78d('0x2d')](_0xc78d('0x2f'),controller[_0xc78d('0x30')]);router[_0xc78d('0x2d')](_0xc78d('0x31'),auth[_0xc78d('0x10')](),controller[_0xc78d('0x32')]);router['put'](_0xc78d('0x33'),controller[_0xc78d('0x34')]);router[_0xc78d('0x35')](_0xc78d('0xf'),auth[_0xc78d('0xb')](),interaction[_0xc78d('0x29')](_0xc78d('0x2a'),_0xc78d('0x36')),controller['destroy']);router[_0xc78d('0x35')](_0xc78d('0x37'),auth[_0xc78d('0xb')](),controller['removeTags']);module[_0xc78d('0x38')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 1187383..ba10b6b 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 _0xe1b9=['TEXT','medium','BOOLEAN','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe1b9,0x143));var _0x9e1b=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xe1b9[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0x9e1b('0x0'));module[_0x9e1b('0x1')]={'body':{'type':Sequelize[_0x9e1b('0x2')](_0x9e1b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9e1b('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb6f6=['medium','exports','TEXT'];(function(_0x5d1f49,_0x316373){var _0xa9dadc=function(_0xa2efb0){while(--_0xa2efb0){_0x5d1f49['push'](_0x5d1f49['shift']());}};_0xa9dadc(++_0x316373);}(_0xb6f6,0x82));var _0x6b6f=function(_0x2bab33,_0x2c7c8a){_0x2bab33=_0x2bab33-0x0;var _0x5df787=_0xb6f6[_0x2bab33];return _0x5df787;};'use strict';var Sequelize=require('sequelize');module[_0x6b6f('0x0')]={'body':{'type':Sequelize[_0x6b6f('0x1')](_0x6b6f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1c3643f..1d329ca 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 _0x8286=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','status','end','json','undefined','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','filter','push','FromId','-createdAt','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1c43aa,_0xff2696){var _0x514c3c=function(_0x3afbf0){while(--_0x3afbf0){_0x1c43aa['push'](_0x1c43aa['shift']());}};_0x514c3c(++_0xff2696);}(_0x8286,0x1a9));var _0x6828=function(_0x31cfdd,_0x2f5224){_0x31cfdd=_0x31cfdd-0x0;var _0x16bbe8=_0x8286[_0x31cfdd];return _0x16bbe8;};'use strict';var emlformat=require(_0x6828('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6828('0x1'));var jsonpatch=require(_0x6828('0x2'));var rp=require(_0x6828('0x3'));var moment=require(_0x6828('0x4'));var BPromise=require(_0x6828('0x5'));var Mustache=require(_0x6828('0x6'));var util=require(_0x6828('0x7'));var path=require(_0x6828('0x8'));var sox=require(_0x6828('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6828('0xa'));var squel=require('squel');var crypto=require(_0x6828('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6828('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6828('0xd'));var Papa=require('papaparse');var Redis=require(_0x6828('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6828('0xf'));var as=require(_0x6828('0x10'));var hardwareService=require(_0x6828('0x11'));var logger=require(_0x6828('0x12'))(_0x6828('0x13'));var utils=require(_0x6828('0x14'));var config=require(_0x6828('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6828('0x16'))['db'];config[_0x6828('0x17')]=_[_0x6828('0x18')](config[_0x6828('0x17')],{'host':_0x6828('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6828('0x17')]));require(_0x6828('0x1a'))[_0x6828('0x1b')](socket);function respondWithStatusCode(_0x126596,_0x339fef){_0x339fef=_0x339fef||0xcc;return function(_0x11873f){if(_0x11873f){return _0x126596['sendStatus'](_0x339fef);}return _0x126596[_0x6828('0x1c')](_0x339fef)[_0x6828('0x1d')]();};}function respondWithResult(_0x585ce0,_0x287fcd){_0x287fcd=_0x287fcd||0xc8;return function(_0x5d16f3){if(_0x5d16f3){return _0x585ce0[_0x6828('0x1c')](_0x287fcd)[_0x6828('0x1e')](_0x5d16f3);}};}function respondWithFilteredResult(_0x1510bf,_0x3125aa){return function(_0x42bc47){if(_0x42bc47){var _0x2caea8=typeof _0x3125aa['offset']===_0x6828('0x1f')&&typeof _0x3125aa['limit']===_0x6828('0x1f');var _0x18d995=_0x42bc47['count'];var _0x1a774e=_0x2caea8?0x0:_0x3125aa['offset'];var _0x3be38d=_0x2caea8?_0x42bc47['count']:_0x3125aa['offset']+_0x3125aa['limit'];var _0x59d55c;if(_0x3be38d>=_0x18d995){_0x3be38d=_0x18d995;_0x59d55c=0xc8;}else{_0x59d55c=0xce;}_0x1510bf[_0x6828('0x1c')](_0x59d55c);return _0x1510bf[_0x6828('0x20')](_0x6828('0x21'),_0x1a774e+'-'+_0x3be38d+'/'+_0x18d995)[_0x6828('0x1e')](_0x42bc47);}return null;};}function patchUpdates(_0x10995f){return function(_0x3ceb4c){try{jsonpatch[_0x6828('0x22')](_0x3ceb4c,_0x10995f,!![]);}catch(_0x4af97e){return BPromise['reject'](_0x4af97e);}return _0x3ceb4c[_0x6828('0x23')]();};}function saveUpdates(_0x3a9c90,_0x3f8a0c){return function(_0x50153e){if(_0x50153e){return _0x50153e[_0x6828('0x24')](_0x3a9c90)[_0x6828('0x25')](function(_0x324f34){return _0x324f34;});}return null;};}function removeEntity(_0x1df3d5,_0x22cbe0){return function(_0x4d0c73){if(_0x4d0c73){return _0x4d0c73[_0x6828('0x26')]()[_0x6828('0x25')](function(){_0x1df3d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a365d,_0x51c851){return function(_0x3edcf3){if(!_0x3edcf3){_0x1a365d[_0x6828('0x27')](0x194);}return _0x3edcf3;};}function handleError(_0x159ae9,_0x2a1860){_0x2a1860=_0x2a1860||0x1f4;return function(_0x3014a8){logger[_0x6828('0x28')](_0x3014a8['stack']);if(_0x3014a8['name']){delete _0x3014a8['name'];}_0x159ae9[_0x6828('0x1c')](_0x2a1860)[_0x6828('0x29')](_0x3014a8);};}exports[_0x6828('0x2a')]=function(_0x255314,_0x14807f){var _0x2827bb={},_0x4ecf7f={},_0x318ab5={'count':0x0,'rows':[]};var _0x35259c=_[_0x6828('0x2b')](db[_0x6828('0x2c')][_0x6828('0x2d')],function(_0x35c7d2){return{'name':_0x35c7d2[_0x6828('0x2e')],'type':_0x35c7d2[_0x6828('0x2f')][_0x6828('0x30')]};});_0x4ecf7f[_0x6828('0x31')]=_[_0x6828('0x2b')](_0x35259c,_0x6828('0x32'));_0x4ecf7f[_0x6828('0x33')]=_[_0x6828('0x34')](_0x255314['query']);_0x4ecf7f[_0x6828('0x35')]=_[_0x6828('0x36')](_0x4ecf7f[_0x6828('0x31')],_0x4ecf7f[_0x6828('0x33')]);_0x2827bb[_0x6828('0x37')]=_['intersection'](_0x4ecf7f[_0x6828('0x31')],qs[_0x6828('0x38')](_0x255314['query'][_0x6828('0x38')]));_0x2827bb['attributes']=_0x2827bb[_0x6828('0x37')]['length']?_0x2827bb['attributes']:_0x4ecf7f['model'];if(!_0x255314[_0x6828('0x33')]['hasOwnProperty'](_0x6828('0x39'))){_0x2827bb[_0x6828('0x3a')]=qs[_0x6828('0x3a')](_0x255314[_0x6828('0x33')][_0x6828('0x3a')]);_0x2827bb[_0x6828('0x3b')]=qs[_0x6828('0x3b')](_0x255314[_0x6828('0x33')][_0x6828('0x3b')]);}_0x2827bb[_0x6828('0x3c')]=qs[_0x6828('0x3d')](_0x255314['query'][_0x6828('0x3d')]);_0x2827bb['where']=qs[_0x6828('0x35')](_[_0x6828('0x3e')](_0x255314[_0x6828('0x33')],_0x4ecf7f[_0x6828('0x35')]),_0x35259c);if(_0x255314[_0x6828('0x33')]['filter']){_0x2827bb['where']=_[_0x6828('0x3f')](_0x2827bb[_0x6828('0x40')],{'$or':_[_0x6828('0x2b')](_0x35259c,function(_0x48ecdf){if(_0x48ecdf['type']!==_0x6828('0x41')){var _0x323894={};_0x323894[_0x48ecdf['name']]={'$like':'%'+_0x255314['query']['filter']+'%'};return _0x323894;}})});}_0x2827bb=_['merge']({},_0x2827bb,_0x255314[_0x6828('0x42')]);var _0x43cf3a={'where':_0x2827bb[_0x6828('0x40')]};return db[_0x6828('0x2c')][_0x6828('0x43')](_0x43cf3a)['then'](function(_0x1fe500){_0x318ab5['count']=_0x1fe500;if(_0x255314[_0x6828('0x33')][_0x6828('0x44')]){_0x2827bb[_0x6828('0x45')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x6828('0x46')](_0x2827bb);})['then'](function(_0x56fc7f){_0x318ab5[_0x6828('0x47')]=_0x56fc7f;return _0x318ab5;})[_0x6828('0x25')](respondWithFilteredResult(_0x14807f,_0x2827bb))[_0x6828('0x48')](handleError(_0x14807f,null));};exports[_0x6828('0x49')]=function(_0x25e734,_0x674f89){var _0x24bb1c={'raw':!![],'where':{'id':_0x25e734[_0x6828('0x4a')]['id']}},_0x480069={};_0x480069[_0x6828('0x31')]=_[_0x6828('0x34')](db[_0x6828('0x2c')][_0x6828('0x2d')]);_0x480069[_0x6828('0x33')]=_[_0x6828('0x34')](_0x25e734[_0x6828('0x33')]);_0x480069['filters']=_['intersection'](_0x480069['model'],_0x480069['query']);_0x24bb1c[_0x6828('0x37')]=_['intersection'](_0x480069[_0x6828('0x31')],qs[_0x6828('0x38')](_0x25e734[_0x6828('0x33')][_0x6828('0x38')]));_0x24bb1c[_0x6828('0x37')]=_0x24bb1c[_0x6828('0x37')][_0x6828('0x4b')]?_0x24bb1c[_0x6828('0x37')]:_0x480069[_0x6828('0x31')];if(_0x25e734['query'][_0x6828('0x44')]){_0x24bb1c[_0x6828('0x45')]=[{'all':!![]}];}_0x24bb1c=_[_0x6828('0x3f')]({},_0x24bb1c,_0x25e734[_0x6828('0x42')]);return db['ChatInternalMessage'][_0x6828('0x4c')](_0x24bb1c)[_0x6828('0x25')](handleEntityNotFound(_0x674f89,null))[_0x6828('0x25')](respondWithResult(_0x674f89,null))[_0x6828('0x48')](handleError(_0x674f89,null));};exports[_0x6828('0x4d')]=function(_0x1f5a21,_0x288aa4){return db[_0x6828('0x2c')][_0x6828('0x4d')](_0x1f5a21[_0x6828('0x4e')],{})[_0x6828('0x25')](respondWithResult(_0x288aa4,0xc9))[_0x6828('0x48')](handleError(_0x288aa4,null));};exports[_0x6828('0x24')]=function(_0x1174f7,_0x1f0114){if(_0x1174f7[_0x6828('0x4e')]['id']){delete _0x1174f7[_0x6828('0x4e')]['id'];}return db[_0x6828('0x2c')][_0x6828('0x4c')]({'where':{'id':_0x1174f7[_0x6828('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f0114,null))['then'](saveUpdates(_0x1174f7[_0x6828('0x4e')],null))[_0x6828('0x25')](respondWithResult(_0x1f0114,null))['catch'](handleError(_0x1f0114,null));};exports['destroy']=function(_0x13a762,_0x37aeb7){return db[_0x6828('0x2c')][_0x6828('0x4c')]({'where':{'id':_0x13a762['params']['id']}})[_0x6828('0x25')](handleEntityNotFound(_0x37aeb7,null))[_0x6828('0x25')](removeEntity(_0x37aeb7,null))['catch'](handleError(_0x37aeb7,null));};exports[_0x6828('0x4f')]=function(_0x144a95,_0x9b222e){return db[_0x6828('0x2c')]['describe']()[_0x6828('0x25')](respondWithResult(_0x9b222e,null))[_0x6828('0x48')](handleError(_0x9b222e,null));};function wrapUser(_0x45a037){return function(_0x431a0c){var _0x5a85ff=_0x45a037[_0x6828('0x50')]({'plain':!![]});_0x5a85ff[_0x6828('0x51')]=[];if(_0x431a0c){_0x5a85ff[_0x6828('0x52')]=_0x431a0c[_0x6828('0x53')];_0x5a85ff[_0x6828('0x54')]=_0x431a0c;}else{_0x5a85ff[_0x6828('0x52')]=moment(0x0)[_0x6828('0x55')](_0x6828('0x56'));_0x5a85ff[_0x6828('0x54')]={};}return _0x5a85ff;};}exports[_0x6828('0x57')]=function(_0x2c2f2b,_0x42fd63,_0x51a2dc){var _0x1c807c=[];return db[_0x6828('0x58')][_0x6828('0x46')]({'where':{'role':[_0x6828('0x59'),_0x6828('0x5a'),_0x6828('0x5b')]},'attributes':['id',_0x6828('0x5c'),_0x6828('0x32'),_0x6828('0x5d'),_0x6828('0x5e'),'internal',_0x6828('0x5f'),'lastLoginAt',_0x6828('0x60'),_0x6828('0x61')],'order':qs[_0x6828('0x3d')](_0x6828('0x62')),'include':[{'model':db[_0x6828('0x63')],'as':_0x6828('0x64'),'attributes':['id',_0x6828('0x32'),'type'],'through':{'attributes':[]}}]})[_0x6828('0x25')](function(_0x47f0bf){if(_0x47f0bf){var _0x3e21cc=_0x2c2f2b[_0x6828('0x5b')][_0x6828('0x50')]({'plain':!![]});if(!_0x3e21cc)throw new Error(_0x6828('0x65'));if(_0x3e21cc[_0x6828('0x5d')]===_0x6828('0x5b')){return db[_0x6828('0x66')]['find']({'where':{'name':_0x6828('0x67'),'userProfileId':_0x3e21cc[_0x6828('0x68')]},'raw':!![]})['then'](function(_0x36dab3){if(_0x36dab3){if(_0x36dab3[_0x6828('0x69')]===0x0){return db[_0x6828('0x6a')]['findAll']({'where':{'sectionId':_0x36dab3['id']},'raw':!![]})['then'](function(_0x31065a){var _0xc83154=[];if(_['isEmpty'](_0x31065a)){_0xc83154=_[_0x6828('0x6b')](_0x47f0bf,function(_0x400047){if(_0x400047[_0x6828('0x5d')]!==_0x6828('0x59')){return _0x400047;}});return _0xc83154;}else{for(var _0x407fb7=0x0;_0x407fb7<_0x47f0bf['length'];_0x407fb7++){var _0x3116e1=_0x47f0bf[_0x407fb7];if(_0x3116e1[_0x6828('0x5d')]===_0x6828('0x59')){var _0x531f9b=_[_0x6828('0x4c')](_0x31065a,function(_0xa74f06){return _0xa74f06['resourceId']===_0x3116e1['id'];});if(_0x531f9b)_0xc83154['push'](_0x3116e1);}else{_0xc83154[_0x6828('0x6c')](_0x3116e1);}}return _0xc83154;}});}else{return _0x47f0bf;}}else{var _0x4f0d28=_[_0x6828('0x6b')](_0x47f0bf,function(_0x198bb8){if(_0x198bb8[_0x6828('0x5d')]!==_0x6828('0x59')){return _0x198bb8;}});return _0x4f0d28;}});}else{return _0x47f0bf;}}})['then'](function(_0x1ad6e1){var _0x3ae1bc=[];if(_0x1ad6e1){_0x1c807c=_0x1ad6e1;for(var _0xed0bd6=0x0;_0xed0bd6<_0x1ad6e1[_0x6828('0x4b')];_0xed0bd6+=0x1){_0x1c807c[_0xed0bd6][_0x6828('0x51')]=[];_0x3ae1bc[_0x6828('0x6c')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x2c2f2b['user']['id'],_0x1ad6e1[_0xed0bd6]['id']],'ToId':[_0x2c2f2b[_0x6828('0x5b')]['id'],_0x1ad6e1[_0xed0bd6]['id']],'ChatGroupId':null},'attributes':['id',_0x6828('0x53'),_0x6828('0x6d'),'ToId','read','body'],'order':qs[_0x6828('0x3d')](_0x6828('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x1ad6e1[_0xed0bd6])));}return BPromise['all'](_0x3ae1bc);}return[];})[_0x6828('0x25')](function(_0x187476){return{'rows':_0x187476,'count':_0x187476[_0x6828('0x4b')]};})['then'](respondWithResult(_0x42fd63,null))['catch'](handleError(_0x42fd63,null));}; \ No newline at end of file +var _0x792a=['ejs','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','messages','createdAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','userpic','online','lastLoginAt','showWebBar','-online','VoiceQueue','get','UserProfileSection','Agents','UserProfileResource','isEmpty','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x313a25,_0x35eacd){var _0xfdd34c=function(_0x5d23e2){while(--_0x5d23e2){_0x313a25['push'](_0x313a25['shift']());}};_0xfdd34c(++_0x35eacd);}(_0x792a,0x145));var _0xa792=function(_0x4dbe95,_0x178478){_0x4dbe95=_0x4dbe95-0x0;var _0x250e59=_0x792a[_0x4dbe95];return _0x250e59;};'use strict';var emlformat=require(_0xa792('0x0'));var rimraf=require(_0xa792('0x1'));var zipdir=require(_0xa792('0x2'));var jsonpatch=require(_0xa792('0x3'));var rp=require(_0xa792('0x4'));var moment=require(_0xa792('0x5'));var BPromise=require(_0xa792('0x6'));var Mustache=require('mustache');var util=require(_0xa792('0x7'));var path=require(_0xa792('0x8'));var sox=require(_0xa792('0x9'));var csv=require(_0xa792('0xa'));var ejs=require(_0xa792('0xb'));var fs=require('fs');var fs_extra=require(_0xa792('0xc'));var _=require(_0xa792('0xd'));var squel=require(_0xa792('0xe'));var crypto=require(_0xa792('0xf'));var jsforce=require(_0xa792('0x10'));var deskjs=require(_0xa792('0x11'));var toCsv=require(_0xa792('0xa'));var querystring=require(_0xa792('0x12'));var Papa=require(_0xa792('0x13'));var Redis=require(_0xa792('0x14'));var authService=require(_0xa792('0x15'));var qs=require(_0xa792('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa792('0x17'));var logger=require(_0xa792('0x18'))('api');var utils=require(_0xa792('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa792('0x1a'));var db=require(_0xa792('0x1b'))['db'];config[_0xa792('0x1c')]=_[_0xa792('0x1d')](config[_0xa792('0x1c')],{'host':_0xa792('0x1e'),'port':0x18eb});var socket=require(_0xa792('0x1f'))(new Redis(config[_0xa792('0x1c')]));require(_0xa792('0x20'))[_0xa792('0x21')](socket);function respondWithStatusCode(_0x5cf126,_0x3f1a68){_0x3f1a68=_0x3f1a68||0xcc;return function(_0x4b014e){if(_0x4b014e){return _0x5cf126['sendStatus'](_0x3f1a68);}return _0x5cf126[_0xa792('0x22')](_0x3f1a68)[_0xa792('0x23')]();};}function respondWithResult(_0x176996,_0x29db8c){_0x29db8c=_0x29db8c||0xc8;return function(_0x148285){if(_0x148285){return _0x176996['status'](_0x29db8c)[_0xa792('0x24')](_0x148285);}};}function respondWithFilteredResult(_0x14d329,_0x4cc8f4){return function(_0x5858c0){if(_0x5858c0){var _0x1b47ba=typeof _0x4cc8f4[_0xa792('0x25')]==='undefined'&&typeof _0x4cc8f4[_0xa792('0x26')]===_0xa792('0x27');var _0x298ff9=_0x5858c0[_0xa792('0x28')];var _0x484624=_0x1b47ba?0x0:_0x4cc8f4[_0xa792('0x25')];var _0x5e769f=_0x1b47ba?_0x5858c0[_0xa792('0x28')]:_0x4cc8f4['offset']+_0x4cc8f4[_0xa792('0x26')];var _0x3f9554;if(_0x5e769f>=_0x298ff9){_0x5e769f=_0x298ff9;_0x3f9554=0xc8;}else{_0x3f9554=0xce;}_0x14d329['status'](_0x3f9554);return _0x14d329[_0xa792('0x29')](_0xa792('0x2a'),_0x484624+'-'+_0x5e769f+'/'+_0x298ff9)['json'](_0x5858c0);}return null;};}function patchUpdates(_0x546519){return function(_0x1a17e9){try{jsonpatch[_0xa792('0x2b')](_0x1a17e9,_0x546519,!![]);}catch(_0x5e2bda){return BPromise['reject'](_0x5e2bda);}return _0x1a17e9['save']();};}function saveUpdates(_0x1ec568,_0x15f06e){return function(_0x1d3882){if(_0x1d3882){return _0x1d3882[_0xa792('0x2c')](_0x1ec568)[_0xa792('0x2d')](function(_0x38e66c){return _0x38e66c;});}return null;};}function removeEntity(_0x4601da,_0x440e51){return function(_0x42a284){if(_0x42a284){return _0x42a284[_0xa792('0x2e')]()[_0xa792('0x2d')](function(){_0x4601da[_0xa792('0x22')](0xcc)[_0xa792('0x23')]();});}};}function handleEntityNotFound(_0x248ac2,_0x2cc352){return function(_0x1fda65){if(!_0x1fda65){_0x248ac2[_0xa792('0x2f')](0x194);}return _0x1fda65;};}function handleError(_0x12ce64,_0x503768){_0x503768=_0x503768||0x1f4;return function(_0x50dbe9){logger[_0xa792('0x30')](_0x50dbe9[_0xa792('0x31')]);if(_0x50dbe9['name']){delete _0x50dbe9[_0xa792('0x32')];}_0x12ce64[_0xa792('0x22')](_0x503768)[_0xa792('0x33')](_0x50dbe9);};}exports[_0xa792('0x34')]=function(_0x52e0d3,_0xd23adc){var _0x4661c4={},_0xa2a51c={},_0x1eac6d={'count':0x0,'rows':[]};var _0x4a3cbb=_[_0xa792('0x35')](db[_0xa792('0x36')][_0xa792('0x37')],function(_0x23af7c){return{'name':_0x23af7c[_0xa792('0x38')],'type':_0x23af7c[_0xa792('0x39')]['key']};});_0xa2a51c[_0xa792('0x3a')]=_[_0xa792('0x35')](_0x4a3cbb,_0xa792('0x32'));_0xa2a51c['query']=_[_0xa792('0x3b')](_0x52e0d3[_0xa792('0x3c')]);_0xa2a51c[_0xa792('0x3d')]=_['intersection'](_0xa2a51c[_0xa792('0x3a')],_0xa2a51c[_0xa792('0x3c')]);_0x4661c4[_0xa792('0x3e')]=_[_0xa792('0x3f')](_0xa2a51c[_0xa792('0x3a')],qs[_0xa792('0x40')](_0x52e0d3['query']['fields']));_0x4661c4[_0xa792('0x3e')]=_0x4661c4['attributes'][_0xa792('0x41')]?_0x4661c4[_0xa792('0x3e')]:_0xa2a51c[_0xa792('0x3a')];if(!_0x52e0d3[_0xa792('0x3c')][_0xa792('0x42')](_0xa792('0x43'))){_0x4661c4[_0xa792('0x26')]=qs[_0xa792('0x26')](_0x52e0d3['query'][_0xa792('0x26')]);_0x4661c4[_0xa792('0x25')]=qs[_0xa792('0x25')](_0x52e0d3['query'][_0xa792('0x25')]);}_0x4661c4[_0xa792('0x44')]=qs[_0xa792('0x45')](_0x52e0d3[_0xa792('0x3c')][_0xa792('0x45')]);_0x4661c4[_0xa792('0x46')]=qs['filters'](_['pick'](_0x52e0d3[_0xa792('0x3c')],_0xa2a51c[_0xa792('0x3d')]),_0x4a3cbb);if(_0x52e0d3['query'][_0xa792('0x47')]){_0x4661c4[_0xa792('0x46')]=_[_0xa792('0x48')](_0x4661c4[_0xa792('0x46')],{'$or':_[_0xa792('0x35')](_0x4a3cbb,function(_0x4b43ac){if(_0x4b43ac[_0xa792('0x39')]!==_0xa792('0x49')){var _0x38016a={};_0x38016a[_0x4b43ac[_0xa792('0x32')]]={'$like':'%'+_0x52e0d3[_0xa792('0x3c')][_0xa792('0x47')]+'%'};return _0x38016a;}})});}_0x4661c4=_['merge']({},_0x4661c4,_0x52e0d3[_0xa792('0x4a')]);var _0xeeed03={'where':_0x4661c4['where']};return db[_0xa792('0x36')][_0xa792('0x28')](_0xeeed03)[_0xa792('0x2d')](function(_0x680c6b){_0x1eac6d[_0xa792('0x28')]=_0x680c6b;if(_0x52e0d3['query'][_0xa792('0x4b')]){_0x4661c4[_0xa792('0x4c')]=[{'all':!![]}];}return db[_0xa792('0x36')][_0xa792('0x4d')](_0x4661c4);})[_0xa792('0x2d')](function(_0x1ed5be){_0x1eac6d[_0xa792('0x4e')]=_0x1ed5be;return _0x1eac6d;})['then'](respondWithFilteredResult(_0xd23adc,_0x4661c4))[_0xa792('0x4f')](handleError(_0xd23adc,null));};exports[_0xa792('0x50')]=function(_0x22335a,_0x889357){var _0xd5dbaa={'raw':!![],'where':{'id':_0x22335a[_0xa792('0x51')]['id']}},_0x5f282d={};_0x5f282d[_0xa792('0x3a')]=_[_0xa792('0x3b')](db[_0xa792('0x36')][_0xa792('0x37')]);_0x5f282d['query']=_[_0xa792('0x3b')](_0x22335a['query']);_0x5f282d['filters']=_[_0xa792('0x3f')](_0x5f282d[_0xa792('0x3a')],_0x5f282d[_0xa792('0x3c')]);_0xd5dbaa[_0xa792('0x3e')]=_[_0xa792('0x3f')](_0x5f282d['model'],qs['fields'](_0x22335a[_0xa792('0x3c')][_0xa792('0x40')]));_0xd5dbaa[_0xa792('0x3e')]=_0xd5dbaa[_0xa792('0x3e')]['length']?_0xd5dbaa['attributes']:_0x5f282d[_0xa792('0x3a')];if(_0x22335a[_0xa792('0x3c')]['includeAll']){_0xd5dbaa[_0xa792('0x4c')]=[{'all':!![]}];}_0xd5dbaa=_[_0xa792('0x48')]({},_0xd5dbaa,_0x22335a[_0xa792('0x4a')]);return db['ChatInternalMessage'][_0xa792('0x52')](_0xd5dbaa)[_0xa792('0x2d')](handleEntityNotFound(_0x889357,null))[_0xa792('0x2d')](respondWithResult(_0x889357,null))[_0xa792('0x4f')](handleError(_0x889357,null));};exports[_0xa792('0x53')]=function(_0x1e5084,_0x427390){return db['ChatInternalMessage'][_0xa792('0x53')](_0x1e5084[_0xa792('0x54')],{})[_0xa792('0x2d')](respondWithResult(_0x427390,0xc9))['catch'](handleError(_0x427390,null));};exports[_0xa792('0x2c')]=function(_0x4bf929,_0x3dadf9){if(_0x4bf929[_0xa792('0x54')]['id']){delete _0x4bf929[_0xa792('0x54')]['id'];}return db[_0xa792('0x36')][_0xa792('0x52')]({'where':{'id':_0x4bf929['params']['id']}})[_0xa792('0x2d')](handleEntityNotFound(_0x3dadf9,null))[_0xa792('0x2d')](saveUpdates(_0x4bf929[_0xa792('0x54')],null))[_0xa792('0x2d')](respondWithResult(_0x3dadf9,null))[_0xa792('0x4f')](handleError(_0x3dadf9,null));};exports[_0xa792('0x2e')]=function(_0x517929,_0xc47dc9){return db['ChatInternalMessage'][_0xa792('0x52')]({'where':{'id':_0x517929['params']['id']}})[_0xa792('0x2d')](handleEntityNotFound(_0xc47dc9,null))[_0xa792('0x2d')](removeEntity(_0xc47dc9,null))[_0xa792('0x4f')](handleError(_0xc47dc9,null));};exports[_0xa792('0x55')]=function(_0x2c8334,_0x1dff92){return db[_0xa792('0x36')][_0xa792('0x55')]()[_0xa792('0x2d')](respondWithResult(_0x1dff92,null))[_0xa792('0x4f')](handleError(_0x1dff92,null));};function wrapUser(_0x36f648){return function(_0x470ad4){var _0x16414a=_0x36f648['get']({'plain':!![]});_0x16414a[_0xa792('0x56')]=[];if(_0x470ad4){_0x16414a['lastMessageAt']=_0x470ad4[_0xa792('0x57')];_0x16414a['lastMessage']=_0x470ad4;}else{_0x16414a['lastMessageAt']=moment(0x0)['format'](_0xa792('0x58'));_0x16414a[_0xa792('0x59')]={};}return _0x16414a;};}exports[_0xa792('0x5a')]=function(_0x5127e5,_0x1b42f1,_0x3bbad7){var _0x31415c=[];return db['User']['findAll']({'where':{'role':[_0xa792('0x5b'),_0xa792('0x5c'),_0xa792('0x5d')]},'attributes':['id',_0xa792('0x5e'),'name',_0xa792('0x5f'),_0xa792('0x60'),'internal',_0xa792('0x61'),_0xa792('0x62'),'allowmessenger',_0xa792('0x63')],'order':qs[_0xa792('0x45')](_0xa792('0x64')),'include':[{'model':db[_0xa792('0x65')],'as':'VoiceQueues','attributes':['id','name',_0xa792('0x39')],'through':{'attributes':[]}}]})[_0xa792('0x2d')](function(_0x3e1e25){if(_0x3e1e25){var _0x1f655a=_0x5127e5[_0xa792('0x5d')][_0xa792('0x66')]({'plain':!![]});if(!_0x1f655a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f655a[_0xa792('0x5f')]===_0xa792('0x5d')){return db[_0xa792('0x67')][_0xa792('0x52')]({'where':{'name':_0xa792('0x68'),'userProfileId':_0x1f655a['userProfileId']},'raw':!![]})[_0xa792('0x2d')](function(_0x4a99aa){if(_0x4a99aa){if(_0x4a99aa['autoAssociation']===0x0){return db[_0xa792('0x69')][_0xa792('0x4d')]({'where':{'sectionId':_0x4a99aa['id']},'raw':!![]})[_0xa792('0x2d')](function(_0xf6d370){var _0x4c8d74=[];if(_[_0xa792('0x6a')](_0xf6d370)){_0x4c8d74=_[_0xa792('0x47')](_0x3e1e25,function(_0x247c68){if(_0x247c68['role']!=='agent'){return _0x247c68;}});return _0x4c8d74;}else{for(var _0xa47960=0x0;_0xa47960<_0x3e1e25[_0xa792('0x41')];_0xa47960++){var _0x2c350f=_0x3e1e25[_0xa47960];if(_0x2c350f[_0xa792('0x5f')]===_0xa792('0x5b')){var _0x5bc8e7=_[_0xa792('0x52')](_0xf6d370,function(_0x553618){return _0x553618['resourceId']===_0x2c350f['id'];});if(_0x5bc8e7)_0x4c8d74[_0xa792('0x6b')](_0x2c350f);}else{_0x4c8d74[_0xa792('0x6b')](_0x2c350f);}}return _0x4c8d74;}});}else{return _0x3e1e25;}}else{var _0x54abad=_[_0xa792('0x47')](_0x3e1e25,function(_0x54d38f){if(_0x54d38f[_0xa792('0x5f')]!=='agent'){return _0x54d38f;}});return _0x54abad;}});}else{return _0x3e1e25;}}})[_0xa792('0x2d')](function(_0x4dfdd7){var _0x78c6ba=[];if(_0x4dfdd7){_0x31415c=_0x4dfdd7;for(var _0x14db6e=0x0;_0x14db6e<_0x4dfdd7[_0xa792('0x41')];_0x14db6e+=0x1){_0x31415c[_0x14db6e][_0xa792('0x56')]=[];_0x78c6ba[_0xa792('0x6b')](db[_0xa792('0x36')]['find']({'where':{'FromId':[_0x5127e5[_0xa792('0x5d')]['id'],_0x4dfdd7[_0x14db6e]['id']],'ToId':[_0x5127e5[_0xa792('0x5d')]['id'],_0x4dfdd7[_0x14db6e]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xa792('0x6c'),_0xa792('0x6d'),_0xa792('0x6e'),_0xa792('0x54')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa792('0x2d')](wrapUser(_0x4dfdd7[_0x14db6e])));}return BPromise[_0xa792('0x6f')](_0x78c6ba);}return[];})['then'](function(_0x163416){return{'rows':_0x163416,'count':_0x163416[_0xa792('0x41')]};})['then'](respondWithResult(_0x1b42f1,null))['catch'](handleError(_0x1b42f1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 91c87a0..ab0752a 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 _0x7e14=['hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x12cdaf,_0x433bc7){var _0x487aca=function(_0x2ceb9f){while(--_0x2ceb9f){_0x12cdaf['push'](_0x12cdaf['shift']());}};_0x487aca(++_0x433bc7);}(_0x7e14,0x174));var _0x47e1=function(_0x34b2a3,_0x2c0313){_0x34b2a3=_0x34b2a3-0x0;var _0x3a1383=_0x7e14[_0x34b2a3];return _0x3a1383;};'use strict';var EventEmitter=require(_0x47e1('0x0'));var ChatInternalMessage=require(_0x47e1('0x1'))['db'][_0x47e1('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x47e1('0x3')](0x0);var events={'afterCreate':_0x47e1('0x4'),'afterUpdate':'update','afterDestroy':_0x47e1('0x5')};function emitEvent(_0x31ea5e){return function(_0x3ae82d,_0x194179,_0x5d2178){ChatInternalMessageEvents['emit'](_0x31ea5e+':'+_0x3ae82d['id'],_0x3ae82d);ChatInternalMessageEvents[_0x47e1('0x6')](_0x31ea5e,_0x3ae82d);_0x5d2178(null);};}for(var e in events){if(events[_0x47e1('0x7')](e)){var event=events[e];ChatInternalMessage[_0x47e1('0x8')](e,emitEvent(event));}}module[_0x47e1('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x11e9=['ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3e2d71,_0x5106ca){var _0x5433a9=function(_0x14670c){while(--_0x14670c){_0x3e2d71['push'](_0x3e2d71['shift']());}};_0x5433a9(++_0x5106ca);}(_0x11e9,0xb3));var _0x911e=function(_0x301dca,_0xa17b6c){_0x301dca=_0x301dca-0x0;var _0x180ccd=_0x11e9[_0x301dca];return _0x180ccd;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x911e('0x0'))['db'][_0x911e('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x911e('0x2')](0x0);var events={'afterCreate':_0x911e('0x3'),'afterUpdate':_0x911e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2971c9){return function(_0x3faf08,_0x49fb66,_0x3395a3){ChatInternalMessageEvents[_0x911e('0x5')](_0x2971c9+':'+_0x3faf08['id'],_0x3faf08);ChatInternalMessageEvents[_0x911e('0x5')](_0x2971c9,_0x3faf08);_0x3395a3(null);};}for(var e in events){if(events[_0x911e('0x6')](e)){var event=events[e];ChatInternalMessage[_0x911e('0x7')](e,emitEvent(event));}}module[_0x911e('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 975aa4a..88c0220 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 _0xc7a5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xc7a5,0x65));var _0x5c7a=function(_0x3a99ca,_0x5bde97){_0x3a99ca=_0x3a99ca-0x0;var _0x1ecbcf=_0xc7a5[_0x3a99ca];return _0x1ecbcf;};'use strict';var _=require(_0x5c7a('0x0'));var util=require(_0x5c7a('0x1'));var logger=require(_0x5c7a('0x2'))(_0x5c7a('0x3'));var moment=require(_0x5c7a('0x4'));var BPromise=require(_0x5c7a('0x5'));var rp=require(_0x5c7a('0x6'));var fs=require('fs');var path=require(_0x5c7a('0x7'));var rimraf=require(_0x5c7a('0x8'));var config=require(_0x5c7a('0x9'));var attributes=require(_0x5c7a('0xa'));module['exports']=function(_0x1ed8a4,_0x1a63a1){return _0x1ed8a4[_0x5c7a('0xb')](_0x5c7a('0xc'),attributes,{'tableName':_0x5c7a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5c7a('0xe')});}; \ No newline at end of file +var _0xedd0=['util','moment','bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2e73c9,_0x35018b){var _0x686af1=function(_0x5d4181){while(--_0x5d4181){_0x2e73c9['push'](_0x2e73c9['shift']());}};_0x686af1(++_0x35018b);}(_0xedd0,0x160));var _0x0edd=function(_0x572b37,_0x400373){_0x572b37=_0x572b37-0x0;var _0x571d9d=_0xedd0[_0x572b37];return _0x571d9d;};'use strict';var _=require('lodash');var util=require(_0x0edd('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0edd('0x1'));var BPromise=require(_0x0edd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0edd('0x3'));var config=require(_0x0edd('0x4'));var attributes=require(_0x0edd('0x5'));module[_0x0edd('0x6')]=function(_0x277feb,_0x39e69a){return _0x277feb[_0x0edd('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0edd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0edd('0x9'),'collate':_0x0edd('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b2d1464..0f6e453 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 _0x9bf9=['./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x317e9b,_0x4fd2c2){var _0x5176ab=function(_0x512207){while(--_0x512207){_0x317e9b['push'](_0x317e9b['shift']());}};_0x5176ab(++_0x4fd2c2);}(_0x9bf9,0xe5));var _0x99bf=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x9bf9[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x99bf('0x0'));var util=require('util');var moment=require(_0x99bf('0x1'));var BPromise=require(_0x99bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99bf('0x3'));var db=require(_0x99bf('0x4'))['db'];var utils=require(_0x99bf('0x5'));var logger=require(_0x99bf('0x6'))(_0x99bf('0x7'));var config=require(_0x99bf('0x8'));var jayson=require(_0x99bf('0x9'));var client=jayson[_0x99bf('0xa')][_0x99bf('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x99bf('0xc')],{'host':_0x99bf('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x99bf('0xe'))['register'](socket);function respondWithRpcPromise(_0x51610a,_0x4a237c,_0x45fa05){return new BPromise(function(_0xe93275,_0x21bc83){return client[_0x99bf('0xf')](_0x51610a,_0x45fa05)[_0x99bf('0x10')](function(_0x274e7c){logger[_0x99bf('0x11')](_0x99bf('0x12'),_0x4a237c,_0x99bf('0x13'));logger[_0x99bf('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4a237c,_0x99bf('0x13'),JSON[_0x99bf('0x15')](_0x274e7c));if(_0x274e7c['error']){if(_0x274e7c['error'][_0x99bf('0x16')]===0x1f4){logger[_0x99bf('0x17')](_0x99bf('0x12'),_0x4a237c,_0x274e7c[_0x99bf('0x17')]['message']);return _0x21bc83(_0x274e7c['error'][_0x99bf('0x18')]);}logger[_0x99bf('0x17')](_0x99bf('0x12'),_0x4a237c,_0x274e7c[_0x99bf('0x17')]['message']);return _0xe93275(_0x274e7c[_0x99bf('0x17')]['message']);}else{logger[_0x99bf('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4a237c,_0x99bf('0x13'));_0xe93275(_0x274e7c[_0x99bf('0x19')][_0x99bf('0x18')]);}})[_0x99bf('0x1a')](function(_0x550068){logger[_0x99bf('0x17')](_0x99bf('0x12'),_0x4a237c,_0x550068);_0x21bc83(_0x550068);});});} \ No newline at end of file +var _0x7132=['code','message','info','catch','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x498e3c,_0x2455c4){var _0x1e5f5f=function(_0x1d981b){while(--_0x1d981b){_0x498e3c['push'](_0x498e3c['shift']());}};_0x1e5f5f(++_0x2455c4);}(_0x7132,0x1cf));var _0x2713=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0x7132[_0x53b594];return _0x1e616f;};'use strict';var _=require('lodash');var util=require(_0x2713('0x0'));var moment=require(_0x2713('0x1'));var BPromise=require(_0x2713('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2713('0x3'));var logger=require('../../config/logger')(_0x2713('0x4'));var config=require(_0x2713('0x5'));var jayson=require(_0x2713('0x6'));var client=jayson[_0x2713('0x7')][_0x2713('0x8')]({'port':0x232a});config[_0x2713('0x9')]=_[_0x2713('0xa')](config['redis'],{'host':_0x2713('0xb'),'port':0x18eb});var socket=require(_0x2713('0xc'))(new Redis(config[_0x2713('0x9')]));require(_0x2713('0xd'))[_0x2713('0xe')](socket);function respondWithRpcPromise(_0x3d4df0,_0x1c7009,_0x33825b){return new BPromise(function(_0x59551c,_0x11bad8){return client[_0x2713('0xf')](_0x3d4df0,_0x33825b)[_0x2713('0x10')](function(_0x56b498){logger['info'](_0x2713('0x11'),_0x1c7009,'request\x20sent');logger[_0x2713('0x12')](_0x2713('0x13'),_0x1c7009,_0x2713('0x14'),JSON[_0x2713('0x15')](_0x56b498));if(_0x56b498['error']){if(_0x56b498[_0x2713('0x16')][_0x2713('0x17')]===0x1f4){logger[_0x2713('0x16')](_0x2713('0x11'),_0x1c7009,_0x56b498[_0x2713('0x16')][_0x2713('0x18')]);return _0x11bad8(_0x56b498['error']['message']);}logger['error'](_0x2713('0x11'),_0x1c7009,_0x56b498['error'][_0x2713('0x18')]);return _0x59551c(_0x56b498['error'][_0x2713('0x18')]);}else{logger[_0x2713('0x19')](_0x2713('0x11'),_0x1c7009,_0x2713('0x14'));_0x59551c(_0x56b498['result'][_0x2713('0x18')]);}})[_0x2713('0x1a')](function(_0x31ba88){logger[_0x2713('0x16')](_0x2713('0x11'),_0x1c7009,_0x31ba88);_0x11bad8(_0x31ba88);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 1dd819a..639e5f5 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 _0xad6a=['length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','register'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xad6a,0xfa));var _0xaad6=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xad6a[_0x45d3f0];return _0x314b79;};'use strict';var ChatInternalMessageEvents=require(_0xaad6('0x0'));var events=[_0xaad6('0x1'),_0xaad6('0x2'),_0xaad6('0x3')];function createListener(_0x339af5,_0x17c09c){return function(_0x5bb81d){_0x17c09c[_0xaad6('0x4')](_0x339af5,_0x5bb81d);};}function removeListener(_0x32d082,_0x46fc2d){return function(){ChatInternalMessageEvents['removeListener'](_0x32d082,_0x46fc2d);};}exports[_0xaad6('0x5')]=function(_0x215454){for(var _0x3996b3=0x0,_0x3b323e=events[_0xaad6('0x6')];_0x3996b3<_0x3b323e;_0x3996b3++){var _0x1843dd=events[_0x3996b3];var _0x5a1b93=createListener(_0xaad6('0x7')+_0x1843dd,_0x215454);ChatInternalMessageEvents['on'](_0x1843dd,_0x5a1b93);}}; \ No newline at end of file +var _0x4dba=['save','remove','update','emit','removeListener','register','length'];(function(_0x380a17,_0x459940){var _0x17ebd8=function(_0x1f4a94){while(--_0x1f4a94){_0x380a17['push'](_0x380a17['shift']());}};_0x17ebd8(++_0x459940);}(_0x4dba,0x18f));var _0xa4db=function(_0x4e731c,_0x504968){_0x4e731c=_0x4e731c-0x0;var _0x528003=_0x4dba[_0x4e731c];return _0x528003;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xa4db('0x0'),_0xa4db('0x1'),_0xa4db('0x2')];function createListener(_0x1c2a53,_0x2e37b2){return function(_0x507206){_0x2e37b2[_0xa4db('0x3')](_0x1c2a53,_0x507206);};}function removeListener(_0x3e5eb0,_0x28df2c){return function(){ChatInternalMessageEvents[_0xa4db('0x4')](_0x3e5eb0,_0x28df2c);};}exports[_0xa4db('0x5')]=function(_0x2797f4){for(var _0x163b02=0x0,_0x2f3833=events[_0xa4db('0x6')];_0x163b02<_0x2f3833;_0x163b02++){var _0x21af1c=events[_0x163b02];var _0x129f09=createListener('chatInternalMessage:'+_0x21af1c,_0x2797f4);ChatInternalMessageEvents['on'](_0x21af1c,_0x129f09);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7cfcc9c..57b6aa2 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 _0x75bd=['getUsers','/:id','post','create','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/users'];(function(_0x51df3a,_0x429f31){var _0x2948e1=function(_0x1d85b0){while(--_0x1d85b0){_0x51df3a['push'](_0x51df3a['shift']());}};_0x2948e1(++_0x429f31);}(_0x75bd,0x6c));var _0xd75b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x75bd[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xd75b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd75b('0x1'));var express=require(_0xd75b('0x2'));var router=express[_0xd75b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd75b('0x4'));var config=require(_0xd75b('0x5'));var controller=require('./chatInternalMessage.controller');router[_0xd75b('0x6')]('/',auth[_0xd75b('0x7')](),controller[_0xd75b('0x8')]);router[_0xd75b('0x6')](_0xd75b('0x9'),auth['isAuthenticated'](),controller[_0xd75b('0xa')]);router[_0xd75b('0x6')](_0xd75b('0xb'),auth[_0xd75b('0x7')](),controller[_0xd75b('0xc')]);router[_0xd75b('0x6')](_0xd75b('0xd'),auth[_0xd75b('0x7')](),controller['show']);router[_0xd75b('0xe')]('/',auth['isAuthenticated'](),controller[_0xd75b('0xf')]);router[_0xd75b('0x10')](_0xd75b('0xd'),controller[_0xd75b('0x11')]);router[_0xd75b('0x12')](_0xd75b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd75b('0x13')]=router; \ No newline at end of file +var _0xc68b=['/describe','get','/users','getUsers','/:id','show','post','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc68b,0x15d));var _0xbc68=function(_0x404578,_0x1be786){_0x404578=_0x404578-0x0;var _0x142678=_0xc68b[_0x404578];return _0x142678;};'use strict';var multer=require(_0xbc68('0x0'));var util=require('util');var path=require(_0xbc68('0x1'));var timeout=require(_0xbc68('0x2'));var express=require(_0xbc68('0x3'));var router=express['Router']();var fs_extra=require(_0xbc68('0x4'));var auth=require(_0xbc68('0x5'));var interaction=require(_0xbc68('0x6'));var config=require(_0xbc68('0x7'));var controller=require(_0xbc68('0x8'));router['get']('/',auth[_0xbc68('0x9')](),controller[_0xbc68('0xa')]);router['get'](_0xbc68('0xb'),auth[_0xbc68('0x9')](),controller['describe']);router[_0xbc68('0xc')](_0xbc68('0xd'),auth[_0xbc68('0x9')](),controller[_0xbc68('0xe')]);router['get'](_0xbc68('0xf'),auth[_0xbc68('0x9')](),controller[_0xbc68('0x10')]);router[_0xbc68('0x11')]('/',auth[_0xbc68('0x9')](),controller['create']);router['put'](_0xbc68('0xf'),controller[_0xbc68('0x12')]);router['delete'](_0xbc68('0xf'),auth[_0xbc68('0x9')](),controller['destroy']);module[_0xbc68('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index d16d11e..618c385 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 _0xd4a2=['sequelize','medium','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0xd4a2,0x173));var _0x2d4a=function(_0x311c5c,_0x50624e){_0x311c5c=_0x311c5c-0x0;var _0x361ea0=_0xd4a2[_0x311c5c];return _0x361ea0;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2d4a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2d4a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2d4a('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x2d4a('0x4')]},'providerName':{'type':Sequelize[_0x2d4a('0x5')]},'providerResponse':{'type':Sequelize[_0x2d4a('0x6')]}}; \ No newline at end of file +var _0x8603=['medium','ENUM','out','STRING','exports','TEXT'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x8603,0x190));var _0x3860=function(_0x332741,_0x2ab38c){_0x332741=_0x332741-0x0;var _0x4a803a=_0x8603[_0x332741];return _0x4a803a;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'body':{'type':Sequelize[_0x3860('0x1')](_0x3860('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3860('0x3')]('in',_0x3860('0x4')),'defaultValue':_0x3860('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3860('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8078deb..916381f 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 _0xc9e2=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','ChatMessage','include','findAll','rows','show','params','includeAll','find','create','body','describe','chat-interactions','chat','readAt','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','agent','fullname','email','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','formData','reject','role','RejectMessage','rejectMessage','Sequelize','rejectmessage','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','end','stack','name','send','map','rawAttributes','fieldName','type','key','model'];(function(_0x2627f8,_0x3c372c){var _0x573bf3=function(_0x501da6){while(--_0x501da6){_0x2627f8['push'](_0x2627f8['shift']());}};_0x573bf3(++_0x3c372c);}(_0xc9e2,0x1c0));var _0x2c9e=function(_0x27b800,_0x574575){_0x27b800=_0x27b800-0x0;var _0x492ba5=_0xc9e2[_0x27b800];return _0x492ba5;};'use strict';var emlformat=require(_0x2c9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c9e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c9e('0x2'));var moment=require(_0x2c9e('0x3'));var BPromise=require(_0x2c9e('0x4'));var Mustache=require(_0x2c9e('0x5'));var util=require('util');var path=require(_0x2c9e('0x6'));var sox=require('sox');var csv=require(_0x2c9e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c9e('0x8'));var squel=require(_0x2c9e('0x9'));var crypto=require(_0x2c9e('0xa'));var jsforce=require(_0x2c9e('0xb'));var deskjs=require(_0x2c9e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2c9e('0xd'));var Papa=require(_0x2c9e('0xe'));var Redis=require(_0x2c9e('0xf'));var authService=require(_0x2c9e('0x10'));var qs=require(_0x2c9e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c9e('0x12'));var logger=require(_0x2c9e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2c9e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c9e('0x15'))['db'];config[_0x2c9e('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2c9e('0x17'))(new Redis(config[_0x2c9e('0x16')]));require(_0x2c9e('0x18'))[_0x2c9e('0x19')](socket);var jayson=require(_0x2c9e('0x1a'));var client=jayson['client'][_0x2c9e('0x1b')]({'port':0x232c});var client9002=jayson[_0x2c9e('0x1c')][_0x2c9e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x531ea1,_0x385f77,_0x16c7d9,_0x1a9f7a){return new BPromise(function(_0xb93223,_0x37e904){var _0x2da2e3=_0x1a9f7a||client;return _0x2da2e3[_0x2c9e('0x1d')](_0x531ea1,_0x16c7d9)[_0x2c9e('0x1e')](function(_0x3c8a37){logger[_0x2c9e('0x1f')](_0x2c9e('0x20'),_0x385f77,_0x2c9e('0x21'));logger[_0x2c9e('0x22')](_0x2c9e('0x23'),_0x385f77,_0x2c9e('0x21'),JSON[_0x2c9e('0x24')](_0x3c8a37));if(_0x3c8a37['error']){if(_0x3c8a37[_0x2c9e('0x25')][_0x2c9e('0x26')]===0x1f4){logger['error'](_0x2c9e('0x20'),_0x385f77,_0x3c8a37[_0x2c9e('0x25')][_0x2c9e('0x27')]);return _0x37e904(_0x3c8a37[_0x2c9e('0x25')]['message']);}logger['error'](_0x2c9e('0x20'),_0x385f77,_0x3c8a37[_0x2c9e('0x25')][_0x2c9e('0x27')]);return _0xb93223(_0x3c8a37[_0x2c9e('0x25')][_0x2c9e('0x27')]);}else{logger[_0x2c9e('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x385f77,_0x2c9e('0x21'));_0xb93223(_0x3c8a37[_0x2c9e('0x28')][_0x2c9e('0x27')]);}})[_0x2c9e('0x29')](function(_0x44646){logger[_0x2c9e('0x25')](_0x2c9e('0x20'),_0x385f77,_0x44646);_0x37e904(_0x44646);});});}function respondWithStatusCode(_0x1c89cb,_0x479275){_0x479275=_0x479275||0xcc;return function(_0x1c82ce){if(_0x1c82ce){return _0x1c89cb[_0x2c9e('0x2a')](_0x479275);}return _0x1c89cb['status'](_0x479275)['end']();};}function respondWithResult(_0x5a55ad,_0x3d028c){_0x3d028c=_0x3d028c||0xc8;return function(_0x3079ee){if(_0x3079ee){return _0x5a55ad[_0x2c9e('0x2b')](_0x3d028c)[_0x2c9e('0x2c')](_0x3079ee);}};}function respondWithFilteredResult(_0x277674,_0x439ae6){return function(_0x3900d2){if(_0x3900d2){var _0x5a70db=typeof _0x439ae6['offset']===_0x2c9e('0x2d')&&typeof _0x439ae6[_0x2c9e('0x2e')]===_0x2c9e('0x2d');var _0x2ed9ae=_0x3900d2['count'];var _0x2a26d7=_0x5a70db?0x0:_0x439ae6['offset'];var _0x6ba0c7=_0x5a70db?_0x3900d2[_0x2c9e('0x2f')]:_0x439ae6[_0x2c9e('0x30')]+_0x439ae6[_0x2c9e('0x2e')];var _0x4068e6;if(_0x6ba0c7>=_0x2ed9ae){_0x6ba0c7=_0x2ed9ae;_0x4068e6=0xc8;}else{_0x4068e6=0xce;}_0x277674[_0x2c9e('0x2b')](_0x4068e6);return _0x277674[_0x2c9e('0x31')](_0x2c9e('0x32'),_0x2a26d7+'-'+_0x6ba0c7+'/'+_0x2ed9ae)['json'](_0x3900d2);}return null;};}function patchUpdates(_0x5b8548){return function(_0x1a21f8){try{jsonpatch[_0x2c9e('0x33')](_0x1a21f8,_0x5b8548,!![]);}catch(_0x395d54){return BPromise['reject'](_0x395d54);}return _0x1a21f8['save']();};}function saveUpdates(_0x3b8bab,_0x2cf8a1){return function(_0x231f8d){if(_0x231f8d){return _0x231f8d[_0x2c9e('0x34')](_0x3b8bab)[_0x2c9e('0x1e')](function(_0x4bfd3b){return _0x4bfd3b;});}return null;};}function removeEntity(_0x3ff9ca,_0x5b4893){return function(_0x4c513f){if(_0x4c513f){return _0x4c513f[_0x2c9e('0x35')]()[_0x2c9e('0x1e')](function(){_0x3ff9ca[_0x2c9e('0x2b')](0xcc)[_0x2c9e('0x36')]();});}};}function handleEntityNotFound(_0xaa217,_0x140501){return function(_0x1cd1eb){if(!_0x1cd1eb){_0xaa217[_0x2c9e('0x2a')](0x194);}return _0x1cd1eb;};}function handleError(_0xdccd59,_0x49b562){_0x49b562=_0x49b562||0x1f4;return function(_0x3ebdcc){logger[_0x2c9e('0x25')](_0x3ebdcc[_0x2c9e('0x37')]);if(_0x3ebdcc[_0x2c9e('0x38')]){delete _0x3ebdcc[_0x2c9e('0x38')];}_0xdccd59[_0x2c9e('0x2b')](_0x49b562)[_0x2c9e('0x39')](_0x3ebdcc);};}exports['index']=function(_0xece679,_0x419a31){var _0x2de41d={},_0x2cb72d={},_0x340c1a={'count':0x0,'rows':[]};var _0x37fa4f=_[_0x2c9e('0x3a')](db['ChatMessage'][_0x2c9e('0x3b')],function(_0x3a688d){return{'name':_0x3a688d[_0x2c9e('0x3c')],'type':_0x3a688d[_0x2c9e('0x3d')][_0x2c9e('0x3e')]};});_0x2cb72d[_0x2c9e('0x3f')]=_[_0x2c9e('0x3a')](_0x37fa4f,_0x2c9e('0x38'));_0x2cb72d[_0x2c9e('0x40')]=_[_0x2c9e('0x41')](_0xece679[_0x2c9e('0x40')]);_0x2cb72d[_0x2c9e('0x42')]=_[_0x2c9e('0x43')](_0x2cb72d[_0x2c9e('0x3f')],_0x2cb72d[_0x2c9e('0x40')]);_0x2de41d[_0x2c9e('0x44')]=_[_0x2c9e('0x43')](_0x2cb72d[_0x2c9e('0x3f')],qs[_0x2c9e('0x45')](_0xece679['query'][_0x2c9e('0x45')]));_0x2de41d[_0x2c9e('0x44')]=_0x2de41d[_0x2c9e('0x44')][_0x2c9e('0x46')]?_0x2de41d[_0x2c9e('0x44')]:_0x2cb72d[_0x2c9e('0x3f')];if(!_0xece679[_0x2c9e('0x40')][_0x2c9e('0x47')]('nolimit')){_0x2de41d['limit']=qs[_0x2c9e('0x2e')](_0xece679['query'][_0x2c9e('0x2e')]);_0x2de41d[_0x2c9e('0x30')]=qs[_0x2c9e('0x30')](_0xece679['query']['offset']);}_0x2de41d['order']=qs[_0x2c9e('0x48')](_0xece679[_0x2c9e('0x40')]['sort']);_0x2de41d[_0x2c9e('0x49')]=qs[_0x2c9e('0x42')](_['pick'](_0xece679[_0x2c9e('0x40')],_0x2cb72d[_0x2c9e('0x42')]),_0x37fa4f);if(_0xece679[_0x2c9e('0x40')][_0x2c9e('0x4a')]){_0x2de41d[_0x2c9e('0x49')]=_[_0x2c9e('0x4b')](_0x2de41d[_0x2c9e('0x49')],{'$or':_[_0x2c9e('0x3a')](_0x37fa4f,function(_0x3b9a0c){if(_0x3b9a0c[_0x2c9e('0x3d')]!==_0x2c9e('0x4c')){var _0xdd7677={};_0xdd7677[_0x3b9a0c[_0x2c9e('0x38')]]={'$like':'%'+_0xece679['query']['filter']+'%'};return _0xdd7677;}})});}_0x2de41d=_[_0x2c9e('0x4b')]({},_0x2de41d,_0xece679[_0x2c9e('0x4d')]);var _0x475a5b={'where':_0x2de41d[_0x2c9e('0x49')]};return db[_0x2c9e('0x4e')][_0x2c9e('0x2f')](_0x475a5b)[_0x2c9e('0x1e')](function(_0x1aa943){_0x340c1a['count']=_0x1aa943;if(_0xece679['query']['includeAll']){_0x2de41d[_0x2c9e('0x4f')]=[{'all':!![]}];}return db['ChatMessage'][_0x2c9e('0x50')](_0x2de41d);})[_0x2c9e('0x1e')](function(_0x486e7e){_0x340c1a[_0x2c9e('0x51')]=_0x486e7e;return _0x340c1a;})[_0x2c9e('0x1e')](respondWithFilteredResult(_0x419a31,_0x2de41d))['catch'](handleError(_0x419a31,null));};exports[_0x2c9e('0x52')]=function(_0x517697,_0x480590){var _0x5283e8={'raw':!![],'where':{'id':_0x517697[_0x2c9e('0x53')]['id']}},_0x2fc3f4={};_0x2fc3f4[_0x2c9e('0x3f')]=_[_0x2c9e('0x41')](db[_0x2c9e('0x4e')][_0x2c9e('0x3b')]);_0x2fc3f4['query']=_[_0x2c9e('0x41')](_0x517697['query']);_0x2fc3f4[_0x2c9e('0x42')]=_[_0x2c9e('0x43')](_0x2fc3f4[_0x2c9e('0x3f')],_0x2fc3f4['query']);_0x5283e8['attributes']=_[_0x2c9e('0x43')](_0x2fc3f4[_0x2c9e('0x3f')],qs['fields'](_0x517697[_0x2c9e('0x40')][_0x2c9e('0x45')]));_0x5283e8[_0x2c9e('0x44')]=_0x5283e8[_0x2c9e('0x44')]['length']?_0x5283e8['attributes']:_0x2fc3f4[_0x2c9e('0x3f')];if(_0x517697[_0x2c9e('0x40')][_0x2c9e('0x54')]){_0x5283e8[_0x2c9e('0x4f')]=[{'all':!![]}];}_0x5283e8=_[_0x2c9e('0x4b')]({},_0x5283e8,_0x517697[_0x2c9e('0x4d')]);return db[_0x2c9e('0x4e')][_0x2c9e('0x55')](_0x5283e8)['then'](handleEntityNotFound(_0x480590,null))[_0x2c9e('0x1e')](respondWithResult(_0x480590,null))[_0x2c9e('0x29')](handleError(_0x480590,null));};exports['create']=function(_0x115cac,_0x1cfd82){return db[_0x2c9e('0x4e')][_0x2c9e('0x56')](_0x115cac[_0x2c9e('0x57')],{})[_0x2c9e('0x1e')](respondWithResult(_0x1cfd82,0xc9))[_0x2c9e('0x29')](handleError(_0x1cfd82,null));};exports['update']=function(_0x1fd230,_0x5200d3){if(_0x1fd230[_0x2c9e('0x57')]['id']){delete _0x1fd230[_0x2c9e('0x57')]['id'];}return db['ChatMessage'][_0x2c9e('0x55')]({'where':{'id':_0x1fd230['params']['id']}})[_0x2c9e('0x1e')](handleEntityNotFound(_0x5200d3,null))[_0x2c9e('0x1e')](saveUpdates(_0x1fd230[_0x2c9e('0x57')],null))[_0x2c9e('0x1e')](respondWithResult(_0x5200d3,null))[_0x2c9e('0x29')](handleError(_0x5200d3,null));};exports[_0x2c9e('0x35')]=function(_0x2867e5,_0x5e0354){return db[_0x2c9e('0x4e')][_0x2c9e('0x55')]({'where':{'id':_0x2867e5[_0x2c9e('0x53')]['id']}})[_0x2c9e('0x1e')](handleEntityNotFound(_0x5e0354,null))[_0x2c9e('0x1e')](removeEntity(_0x5e0354,null))[_0x2c9e('0x29')](handleError(_0x5e0354,null));};exports['describe']=function(_0x484997,_0x20c401){return db['ChatMessage'][_0x2c9e('0x58')]()[_0x2c9e('0x1e')](respondWithResult(_0x20c401,null))[_0x2c9e('0x29')](handleError(_0x20c401,null));};var interaction_log=require(_0x2c9e('0x13'))(_0x2c9e('0x59'));exports['accept']=function(_0xaebd48,_0x3131e2,_0x44c40e){var _0x14fc57={'agent':{},'channel':_0x2c9e('0x5a')};if(_0xaebd48[_0x2c9e('0x57')]['id']){delete _0xaebd48[_0x2c9e('0x57')]['id'];}_0xaebd48['body']['read']=!![];_0xaebd48[_0x2c9e('0x57')][_0x2c9e('0x5b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xaebd48['body'][_0x2c9e('0x5c')]=_0xaebd48[_0x2c9e('0x57')]['UserId']||_0xaebd48[_0x2c9e('0x5d')]['id'];_0x14fc57['agent']['id']=_0xaebd48[_0x2c9e('0x57')]['UserId'];return db[_0x2c9e('0x4e')][_0x2c9e('0x55')]({'where':{'id':_0xaebd48[_0x2c9e('0x53')]['id'],'UserId':null}})[_0x2c9e('0x1e')](handleEntityNotFound(_0x3131e2,null))['then'](saveUpdates(_0xaebd48[_0x2c9e('0x57')],null))[_0x2c9e('0x1e')](function(_0x3f13b6){if(_0x3f13b6){_0x14fc57[_0x2c9e('0x27')]=_0x3f13b6[_0x2c9e('0x5e')]({'plain':!![]});return db[_0x2c9e('0x5f')][_0x2c9e('0x55')]({'where':{'id':_0x3f13b6[_0x2c9e('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x3131e2,null))[_0x2c9e('0x1e')](function(_0x268bf5){if(_0x268bf5){return _0x268bf5[_0x2c9e('0x34')]({'UserId':_0xaebd48[_0x2c9e('0x57')][_0x2c9e('0x5c')],'read1stAt':_['isNil'](_0x268bf5[_0x2c9e('0x61')])?moment()[_0x2c9e('0x62')](_0x2c9e('0x63')):undefined});}return null;})[_0x2c9e('0x1e')](function(_0x3eb535){if(_0x3eb535){_0x14fc57[_0x2c9e('0x64')]=_0x3eb535[_0x2c9e('0x5e')]({'plain':!![]});interaction_log[_0x2c9e('0x1f')](_0x2c9e('0x65'),_0xaebd48['user']['id'],_0xaebd48[_0x2c9e('0x5d')][_0x2c9e('0x38')],_0xaebd48['user']['role'],_0x14fc57[_0x2c9e('0x64')]['id'],_0xaebd48[_0x2c9e('0x57')]?JSON[_0x2c9e('0x24')](_0xaebd48[_0x2c9e('0x57')]):_0x2c9e('0x66'));return respondWithRpcPromise(_0x2c9e('0x67'),'acceptMessage',_0x14fc57);}return null;})['then'](function(_0x27a854){var _0x166b1d=_0x2c9e('0x68')+_0x27a854['message'][_0x2c9e('0x69')];return db[_0x2c9e('0x6a')][_0x2c9e('0x40')](_0x166b1d,{'type':db['Sequelize'][_0x2c9e('0x6b')][_0x2c9e('0x6c')],'raw':!![]})[_0x2c9e('0x1e')](function(_0x16d81c){return _0x16d81c;});})[_0x2c9e('0x1e')](function(_0x26838c){if(_0x26838c){_0x14fc57[_0x2c9e('0x27')][_0x2c9e('0x6d')]=_0x26838c[0x0];if(!_0xaebd48['body'][_0x2c9e('0x5c')])return;return db['User'][_0x2c9e('0x55')]({'where':{'id':_0xaebd48[_0x2c9e('0x57')][_0x2c9e('0x5c')],'role':_0x2c9e('0x6e')},'attributes':['id',_0x2c9e('0x38'),_0x2c9e('0x6f'),_0x2c9e('0x70'),'internal'],'raw':!![]});}return null;})[_0x2c9e('0x1e')](function(_0x15e8b2){if(!_0x15e8b2)return null;_0x14fc57[_0x2c9e('0x27')][_0x2c9e('0x6e')]=_0x15e8b2;return _0x14fc57;})['then'](function(_0x14b0b6){if(_0x14b0b6){if(_0xaebd48[_0x2c9e('0x57')][_0x2c9e('0x71')]){_0x14fc57[_0x2c9e('0x27')]['interface']=util[_0x2c9e('0x62')](_0x2c9e('0x72'),_0xaebd48[_0x2c9e('0x5d')]['name']);_0x14fc57['message'][_0x2c9e('0x73')]=_0x14fc57['channel'];_0x14fc57['message'][_0x2c9e('0x74')]=_0x14fc57['channel'];_0x14fc57[_0x2c9e('0x27')][_0x2c9e('0x75')]=_0x2c9e('0x76');return respondWithRpcPromise(_0x2c9e('0x77'),_0x2c9e('0x77'),{'event':_0x2c9e('0x78'),'message':_[_0x2c9e('0x4b')](_0x14fc57[_0x2c9e('0x27')],JSON['parse'](_0x14fc57['interaction'][_0x2c9e('0x79')]))},client9002)[_0x2c9e('0x1e')](function(){return _0x14fc57;});}return _0x14fc57;}return null;})[_0x2c9e('0x1e')](respondWithResult(_0x3131e2,null))[_0x2c9e('0x29')](handleError(_0x3131e2,null));};var interaction_log=require(_0x2c9e('0x13'))('chat-interactions');exports[_0x2c9e('0x7a')]=function(_0x3ed2b5,_0x311dff,_0x237609){var _0x9cb56={'agent':{},'channel':_0x2c9e('0x5a')};if(_0x3ed2b5[_0x2c9e('0x57')]['id']){delete _0x3ed2b5[_0x2c9e('0x57')]['id'];}_0x3ed2b5[_0x2c9e('0x57')][_0x2c9e('0x5c')]=_0x3ed2b5[_0x2c9e('0x57')][_0x2c9e('0x5c')]||_0x3ed2b5[_0x2c9e('0x5d')]['id'];_0x9cb56[_0x2c9e('0x6e')]['id']=_0x3ed2b5[_0x2c9e('0x57')][_0x2c9e('0x5c')];return db[_0x2c9e('0x4e')][_0x2c9e('0x55')]({'where':{'id':_0x3ed2b5[_0x2c9e('0x53')]['id'],'UserId':null}})[_0x2c9e('0x1e')](handleEntityNotFound(_0x311dff,null))[_0x2c9e('0x1e')](function(_0x4e4944){if(_0x4e4944){_0x9cb56[_0x2c9e('0x27')]=_0x4e4944[_0x2c9e('0x5e')]({'plain':!![]});return db[_0x2c9e('0x5f')][_0x2c9e('0x55')]({'where':{'id':_0x4e4944[_0x2c9e('0x60')]}});}return null;})[_0x2c9e('0x1e')](handleEntityNotFound(_0x311dff,null))[_0x2c9e('0x1e')](function(_0x18a930){if(_0x18a930){_0x9cb56[_0x2c9e('0x64')]=_0x18a930[_0x2c9e('0x5e')]({'plain':!![]});interaction_log[_0x2c9e('0x1f')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ed2b5['user']['id'],_0x3ed2b5['user']['name'],_0x3ed2b5[_0x2c9e('0x5d')][_0x2c9e('0x7b')],_0x9cb56[_0x2c9e('0x64')]['id'],_0x3ed2b5[_0x2c9e('0x57')]?JSON[_0x2c9e('0x24')](_0x3ed2b5[_0x2c9e('0x57')]):_0x2c9e('0x66'));return respondWithRpcPromise(_0x2c9e('0x7c'),_0x2c9e('0x7d'),_0x9cb56);}return null;})[_0x2c9e('0x1e')](function(_0xa593a1){var _0x2dba85='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa593a1[_0x2c9e('0x27')][_0x2c9e('0x69')];return db[_0x2c9e('0x6a')][_0x2c9e('0x40')](_0x2dba85,{'type':db[_0x2c9e('0x7e')]['QueryTypes'][_0x2c9e('0x6c')],'raw':!![]})['then'](function(_0x490d12){return _0x490d12;});})[_0x2c9e('0x1e')](function(_0x41acfa){if(_0x41acfa){_0x9cb56[_0x2c9e('0x27')]['contact']=_0x41acfa[0x0];if(!_0x3ed2b5[_0x2c9e('0x57')][_0x2c9e('0x5c')])return;return db['User']['find']({'where':{'id':_0x3ed2b5[_0x2c9e('0x57')][_0x2c9e('0x5c')],'role':'agent'},'attributes':['id',_0x2c9e('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x2c9e('0x1e')](function(_0x245a8b){if(!_0x245a8b)return null;_0x9cb56['message'][_0x2c9e('0x6e')]=_0x245a8b;return _0x9cb56;})[_0x2c9e('0x1e')](function(_0x263264){if(_0x263264){_0x263264[_0x2c9e('0x27')]['interface']=util[_0x2c9e('0x62')](_0x2c9e('0x72'),_0x3ed2b5[_0x2c9e('0x5d')][_0x2c9e('0x38')]);_0x263264[_0x2c9e('0x27')][_0x2c9e('0x73')]=_0x9cb56[_0x2c9e('0x73')];_0x263264[_0x2c9e('0x27')]['motionChannel']=_0x9cb56['channel'];_0x263264[_0x2c9e('0x27')][_0x2c9e('0x75')]=_0x2c9e('0x7a');respondWithRpcPromise(_0x2c9e('0x77'),_0x2c9e('0x77'),{'event':_0x2c9e('0x7f'),'message':_[_0x2c9e('0x4b')](_0x9cb56[_0x2c9e('0x27')],JSON['parse'](_0x9cb56[_0x2c9e('0x64')][_0x2c9e('0x79')]))},client9002);return _0x9cb56;}return null;})[_0x2c9e('0x1e')](respondWithResult(_0x311dff,null))[_0x2c9e('0x29')](handleError(_0x311dff,null));}; \ No newline at end of file +var _0x9feb=['defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','chat-interactions','accept','chat','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','manual','interface','channel','EventManager','acceptmessage','parse','formData','RejectMessage','rejectMessage','Sequelize','User','email','internal','SIP/%s','motionChannel','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x20f996,_0x2f8997){var _0x313162=function(_0x242270){while(--_0x242270){_0x20f996['push'](_0x20f996['shift']());}};_0x313162(++_0x2f8997);}(_0x9feb,0x6e));var _0xb9fe=function(_0x7fcad0,_0x3e75ae){_0x7fcad0=_0x7fcad0-0x0;var _0x4123fd=_0x9feb[_0x7fcad0];return _0x4123fd;};'use strict';var emlformat=require(_0xb9fe('0x0'));var rimraf=require(_0xb9fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9fe('0x2'));var rp=require(_0xb9fe('0x3'));var moment=require(_0xb9fe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb9fe('0x5'));var util=require(_0xb9fe('0x6'));var path=require(_0xb9fe('0x7'));var sox=require('sox');var csv=require(_0xb9fe('0x8'));var ejs=require(_0xb9fe('0x9'));var fs=require('fs');var fs_extra=require(_0xb9fe('0xa'));var _=require(_0xb9fe('0xb'));var squel=require(_0xb9fe('0xc'));var crypto=require(_0xb9fe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb9fe('0xe'));var toCsv=require(_0xb9fe('0x8'));var querystring=require('querystring');var Papa=require(_0xb9fe('0xf'));var Redis=require(_0xb9fe('0x10'));var authService=require(_0xb9fe('0x11'));var qs=require(_0xb9fe('0x12'));var as=require(_0xb9fe('0x13'));var hardwareService=require(_0xb9fe('0x14'));var logger=require(_0xb9fe('0x15'))(_0xb9fe('0x16'));var utils=require(_0xb9fe('0x17'));var config=require(_0xb9fe('0x18'));var licenseUtil=require(_0xb9fe('0x19'));var db=require(_0xb9fe('0x1a'))['db'];config[_0xb9fe('0x1b')]=_[_0xb9fe('0x1c')](config[_0xb9fe('0x1b')],{'host':_0xb9fe('0x1d'),'port':0x18eb});var socket=require(_0xb9fe('0x1e'))(new Redis(config[_0xb9fe('0x1b')]));require('./chatMessage.socket')[_0xb9fe('0x1f')](socket);var jayson=require(_0xb9fe('0x20'));var client=jayson[_0xb9fe('0x21')][_0xb9fe('0x22')]({'port':0x232c});var client9002=jayson[_0xb9fe('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b20a9,_0x18ea2b,_0x2a5d6a,_0x2a603c){return new BPromise(function(_0x51fb87,_0x41a6fa){var _0x477804=_0x2a603c||client;return _0x477804[_0xb9fe('0x23')](_0x4b20a9,_0x2a5d6a)[_0xb9fe('0x24')](function(_0x60a588){logger[_0xb9fe('0x25')](_0xb9fe('0x26'),_0x18ea2b,'request\x20sent');logger[_0xb9fe('0x27')](_0xb9fe('0x28'),_0x18ea2b,_0xb9fe('0x29'),JSON[_0xb9fe('0x2a')](_0x60a588));if(_0x60a588['error']){if(_0x60a588['error'][_0xb9fe('0x2b')]===0x1f4){logger[_0xb9fe('0x2c')](_0xb9fe('0x26'),_0x18ea2b,_0x60a588[_0xb9fe('0x2c')][_0xb9fe('0x2d')]);return _0x41a6fa(_0x60a588['error'][_0xb9fe('0x2d')]);}logger[_0xb9fe('0x2c')](_0xb9fe('0x26'),_0x18ea2b,_0x60a588[_0xb9fe('0x2c')]['message']);return _0x51fb87(_0x60a588[_0xb9fe('0x2c')][_0xb9fe('0x2d')]);}else{logger[_0xb9fe('0x25')](_0xb9fe('0x26'),_0x18ea2b,_0xb9fe('0x29'));_0x51fb87(_0x60a588[_0xb9fe('0x2e')][_0xb9fe('0x2d')]);}})['catch'](function(_0x4b38a0){logger[_0xb9fe('0x2c')]('ChatMessage,\x20%s,\x20%s',_0x18ea2b,_0x4b38a0);_0x41a6fa(_0x4b38a0);});});}function respondWithStatusCode(_0x5f55a9,_0x28745a){_0x28745a=_0x28745a||0xcc;return function(_0x4f57b2){if(_0x4f57b2){return _0x5f55a9[_0xb9fe('0x2f')](_0x28745a);}return _0x5f55a9[_0xb9fe('0x30')](_0x28745a)[_0xb9fe('0x31')]();};}function respondWithResult(_0x4eb939,_0x21014b){_0x21014b=_0x21014b||0xc8;return function(_0x1cb73d){if(_0x1cb73d){return _0x4eb939[_0xb9fe('0x30')](_0x21014b)[_0xb9fe('0x32')](_0x1cb73d);}};}function respondWithFilteredResult(_0x6316fe,_0x185ec4){return function(_0x243098){if(_0x243098){var _0x478328=typeof _0x185ec4[_0xb9fe('0x33')]==='undefined'&&typeof _0x185ec4[_0xb9fe('0x34')]==='undefined';var _0x2583f2=_0x243098[_0xb9fe('0x35')];var _0xf6e67b=_0x478328?0x0:_0x185ec4[_0xb9fe('0x33')];var _0x56f7e0=_0x478328?_0x243098[_0xb9fe('0x35')]:_0x185ec4['offset']+_0x185ec4['limit'];var _0x4df309;if(_0x56f7e0>=_0x2583f2){_0x56f7e0=_0x2583f2;_0x4df309=0xc8;}else{_0x4df309=0xce;}_0x6316fe[_0xb9fe('0x30')](_0x4df309);return _0x6316fe['set'](_0xb9fe('0x36'),_0xf6e67b+'-'+_0x56f7e0+'/'+_0x2583f2)['json'](_0x243098);}return null;};}function patchUpdates(_0x3387d7){return function(_0x3e3034){try{jsonpatch['apply'](_0x3e3034,_0x3387d7,!![]);}catch(_0x5a121e){return BPromise[_0xb9fe('0x37')](_0x5a121e);}return _0x3e3034[_0xb9fe('0x38')]();};}function saveUpdates(_0x28d307,_0xc2bfab){return function(_0x365cd1){if(_0x365cd1){return _0x365cd1[_0xb9fe('0x39')](_0x28d307)[_0xb9fe('0x24')](function(_0x201cfe){return _0x201cfe;});}return null;};}function removeEntity(_0x368140,_0x1ce3b5){return function(_0x110806){if(_0x110806){return _0x110806[_0xb9fe('0x3a')]()['then'](function(){_0x368140['status'](0xcc)[_0xb9fe('0x31')]();});}};}function handleEntityNotFound(_0x5abd82,_0x43fddc){return function(_0x138e9b){if(!_0x138e9b){_0x5abd82['sendStatus'](0x194);}return _0x138e9b;};}function handleError(_0x5ddccc,_0x4c4fdf){_0x4c4fdf=_0x4c4fdf||0x1f4;return function(_0x4c4c77){logger[_0xb9fe('0x2c')](_0x4c4c77[_0xb9fe('0x3b')]);if(_0x4c4c77['name']){delete _0x4c4c77[_0xb9fe('0x3c')];}_0x5ddccc[_0xb9fe('0x30')](_0x4c4fdf)['send'](_0x4c4c77);};}exports[_0xb9fe('0x3d')]=function(_0x3558d1,_0x151def){var _0x3332b1={},_0x45a4a5={},_0x1a65cf={'count':0x0,'rows':[]};var _0x4db009=_[_0xb9fe('0x3e')](db[_0xb9fe('0x3f')][_0xb9fe('0x40')],function(_0x27606f){return{'name':_0x27606f[_0xb9fe('0x41')],'type':_0x27606f[_0xb9fe('0x42')][_0xb9fe('0x43')]};});_0x45a4a5[_0xb9fe('0x44')]=_[_0xb9fe('0x3e')](_0x4db009,_0xb9fe('0x3c'));_0x45a4a5[_0xb9fe('0x45')]=_['keys'](_0x3558d1['query']);_0x45a4a5['filters']=_[_0xb9fe('0x46')](_0x45a4a5[_0xb9fe('0x44')],_0x45a4a5['query']);_0x3332b1[_0xb9fe('0x47')]=_[_0xb9fe('0x46')](_0x45a4a5['model'],qs[_0xb9fe('0x48')](_0x3558d1['query'][_0xb9fe('0x48')]));_0x3332b1[_0xb9fe('0x47')]=_0x3332b1[_0xb9fe('0x47')][_0xb9fe('0x49')]?_0x3332b1[_0xb9fe('0x47')]:_0x45a4a5[_0xb9fe('0x44')];if(!_0x3558d1[_0xb9fe('0x45')][_0xb9fe('0x4a')]('nolimit')){_0x3332b1[_0xb9fe('0x34')]=qs[_0xb9fe('0x34')](_0x3558d1[_0xb9fe('0x45')]['limit']);_0x3332b1[_0xb9fe('0x33')]=qs[_0xb9fe('0x33')](_0x3558d1[_0xb9fe('0x45')][_0xb9fe('0x33')]);}_0x3332b1['order']=qs[_0xb9fe('0x4b')](_0x3558d1['query'][_0xb9fe('0x4b')]);_0x3332b1[_0xb9fe('0x4c')]=qs[_0xb9fe('0x4d')](_[_0xb9fe('0x4e')](_0x3558d1['query'],_0x45a4a5[_0xb9fe('0x4d')]),_0x4db009);if(_0x3558d1['query'][_0xb9fe('0x4f')]){_0x3332b1[_0xb9fe('0x4c')]=_[_0xb9fe('0x50')](_0x3332b1['where'],{'$or':_[_0xb9fe('0x3e')](_0x4db009,function(_0x1adc1b){if(_0x1adc1b[_0xb9fe('0x42')]!==_0xb9fe('0x51')){var _0xa093e0={};_0xa093e0[_0x1adc1b['name']]={'$like':'%'+_0x3558d1['query'][_0xb9fe('0x4f')]+'%'};return _0xa093e0;}})});}_0x3332b1=_[_0xb9fe('0x50')]({},_0x3332b1,_0x3558d1[_0xb9fe('0x52')]);var _0x192d6e={'where':_0x3332b1[_0xb9fe('0x4c')]};return db[_0xb9fe('0x3f')][_0xb9fe('0x35')](_0x192d6e)[_0xb9fe('0x24')](function(_0x40b9c6){_0x1a65cf[_0xb9fe('0x35')]=_0x40b9c6;if(_0x3558d1[_0xb9fe('0x45')][_0xb9fe('0x53')]){_0x3332b1[_0xb9fe('0x54')]=[{'all':!![]}];}return db[_0xb9fe('0x3f')][_0xb9fe('0x55')](_0x3332b1);})[_0xb9fe('0x24')](function(_0x1fc42c){_0x1a65cf[_0xb9fe('0x56')]=_0x1fc42c;return _0x1a65cf;})[_0xb9fe('0x24')](respondWithFilteredResult(_0x151def,_0x3332b1))[_0xb9fe('0x57')](handleError(_0x151def,null));};exports[_0xb9fe('0x58')]=function(_0x2b2b77,_0x56df7a){var _0x807c06={'raw':!![],'where':{'id':_0x2b2b77[_0xb9fe('0x59')]['id']}},_0x2e8ab3={};_0x2e8ab3[_0xb9fe('0x44')]=_[_0xb9fe('0x5a')](db[_0xb9fe('0x3f')][_0xb9fe('0x40')]);_0x2e8ab3[_0xb9fe('0x45')]=_['keys'](_0x2b2b77[_0xb9fe('0x45')]);_0x2e8ab3[_0xb9fe('0x4d')]=_[_0xb9fe('0x46')](_0x2e8ab3[_0xb9fe('0x44')],_0x2e8ab3['query']);_0x807c06['attributes']=_['intersection'](_0x2e8ab3[_0xb9fe('0x44')],qs['fields'](_0x2b2b77[_0xb9fe('0x45')]['fields']));_0x807c06[_0xb9fe('0x47')]=_0x807c06[_0xb9fe('0x47')]['length']?_0x807c06[_0xb9fe('0x47')]:_0x2e8ab3[_0xb9fe('0x44')];if(_0x2b2b77[_0xb9fe('0x45')]['includeAll']){_0x807c06[_0xb9fe('0x54')]=[{'all':!![]}];}_0x807c06=_[_0xb9fe('0x50')]({},_0x807c06,_0x2b2b77[_0xb9fe('0x52')]);return db['ChatMessage'][_0xb9fe('0x5b')](_0x807c06)[_0xb9fe('0x24')](handleEntityNotFound(_0x56df7a,null))[_0xb9fe('0x24')](respondWithResult(_0x56df7a,null))[_0xb9fe('0x57')](handleError(_0x56df7a,null));};exports[_0xb9fe('0x5c')]=function(_0x1929ad,_0x4ac536){return db[_0xb9fe('0x3f')][_0xb9fe('0x5c')](_0x1929ad[_0xb9fe('0x5d')],{})[_0xb9fe('0x24')](respondWithResult(_0x4ac536,0xc9))[_0xb9fe('0x57')](handleError(_0x4ac536,null));};exports[_0xb9fe('0x39')]=function(_0x5be136,_0x3b981d){if(_0x5be136[_0xb9fe('0x5d')]['id']){delete _0x5be136[_0xb9fe('0x5d')]['id'];}return db[_0xb9fe('0x3f')][_0xb9fe('0x5b')]({'where':{'id':_0x5be136[_0xb9fe('0x59')]['id']}})[_0xb9fe('0x24')](handleEntityNotFound(_0x3b981d,null))[_0xb9fe('0x24')](saveUpdates(_0x5be136[_0xb9fe('0x5d')],null))[_0xb9fe('0x24')](respondWithResult(_0x3b981d,null))[_0xb9fe('0x57')](handleError(_0x3b981d,null));};exports[_0xb9fe('0x3a')]=function(_0x24054e,_0x57badc){return db[_0xb9fe('0x3f')][_0xb9fe('0x5b')]({'where':{'id':_0x24054e['params']['id']}})['then'](handleEntityNotFound(_0x57badc,null))[_0xb9fe('0x24')](removeEntity(_0x57badc,null))[_0xb9fe('0x57')](handleError(_0x57badc,null));};exports[_0xb9fe('0x5e')]=function(_0x133c29,_0x37dcae){return db[_0xb9fe('0x3f')][_0xb9fe('0x5e')]()[_0xb9fe('0x24')](respondWithResult(_0x37dcae,null))[_0xb9fe('0x57')](handleError(_0x37dcae,null));};var interaction_log=require('../../config/logger')(_0xb9fe('0x5f'));exports[_0xb9fe('0x60')]=function(_0x5b52c1,_0x4ba4b8,_0x5d3c21){var _0x151520={'agent':{},'channel':_0xb9fe('0x61')};if(_0x5b52c1[_0xb9fe('0x5d')]['id']){delete _0x5b52c1[_0xb9fe('0x5d')]['id'];}_0x5b52c1[_0xb9fe('0x5d')]['read']=!![];_0x5b52c1[_0xb9fe('0x5d')]['readAt']=moment()[_0xb9fe('0x62')](_0xb9fe('0x63'));_0x5b52c1['body'][_0xb9fe('0x64')]=_0x5b52c1[_0xb9fe('0x5d')][_0xb9fe('0x64')]||_0x5b52c1[_0xb9fe('0x65')]['id'];_0x151520[_0xb9fe('0x66')]['id']=_0x5b52c1[_0xb9fe('0x5d')][_0xb9fe('0x64')];return db[_0xb9fe('0x3f')][_0xb9fe('0x5b')]({'where':{'id':_0x5b52c1['params']['id'],'UserId':null}})[_0xb9fe('0x24')](handleEntityNotFound(_0x4ba4b8,null))[_0xb9fe('0x24')](saveUpdates(_0x5b52c1[_0xb9fe('0x5d')],null))[_0xb9fe('0x24')](function(_0x4ee329){if(_0x4ee329){_0x151520[_0xb9fe('0x2d')]=_0x4ee329['get']({'plain':!![]});return db[_0xb9fe('0x67')][_0xb9fe('0x5b')]({'where':{'id':_0x4ee329[_0xb9fe('0x68')]}});}return null;})[_0xb9fe('0x24')](handleEntityNotFound(_0x4ba4b8,null))[_0xb9fe('0x24')](function(_0x249b2c){if(_0x249b2c){return _0x249b2c[_0xb9fe('0x39')]({'UserId':_0x5b52c1[_0xb9fe('0x5d')][_0xb9fe('0x64')],'read1stAt':_[_0xb9fe('0x69')](_0x249b2c[_0xb9fe('0x6a')])?moment()[_0xb9fe('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb9fe('0x24')](function(_0x1324f9){if(_0x1324f9){_0x151520[_0xb9fe('0x6b')]=_0x1324f9[_0xb9fe('0x6c')]({'plain':!![]});interaction_log[_0xb9fe('0x25')](_0xb9fe('0x6d'),_0x5b52c1[_0xb9fe('0x65')]['id'],_0x5b52c1['user'][_0xb9fe('0x3c')],_0x5b52c1[_0xb9fe('0x65')][_0xb9fe('0x6e')],_0x151520[_0xb9fe('0x6b')]['id'],_0x5b52c1[_0xb9fe('0x5d')]?JSON[_0xb9fe('0x2a')](_0x5b52c1[_0xb9fe('0x5d')]):_0xb9fe('0x6f'));return respondWithRpcPromise(_0xb9fe('0x70'),_0xb9fe('0x71'),_0x151520);}return null;})[_0xb9fe('0x24')](function(_0x3670ee){var _0x5160d4=_0xb9fe('0x72')+_0x3670ee[_0xb9fe('0x2d')][_0xb9fe('0x73')];return db[_0xb9fe('0x74')]['query'](_0x5160d4,{'type':db['Sequelize'][_0xb9fe('0x75')][_0xb9fe('0x76')],'raw':!![]})[_0xb9fe('0x24')](function(_0x202a66){return _0x202a66;});})['then'](function(_0x562df5){if(_0x562df5){_0x151520['message'][_0xb9fe('0x77')]=_0x562df5[0x0];if(!_0x5b52c1[_0xb9fe('0x5d')][_0xb9fe('0x64')])return;return db['User']['find']({'where':{'id':_0x5b52c1[_0xb9fe('0x5d')][_0xb9fe('0x64')],'role':'agent'},'attributes':['id','name',_0xb9fe('0x78'),'email','internal'],'raw':!![]});}return null;})[_0xb9fe('0x24')](function(_0x39d870){if(!_0x39d870)return null;_0x151520[_0xb9fe('0x2d')]['agent']=_0x39d870;return _0x151520;})['then'](function(_0x3fef73){if(_0x3fef73){if(_0x5b52c1[_0xb9fe('0x5d')][_0xb9fe('0x79')]){_0x151520[_0xb9fe('0x2d')][_0xb9fe('0x7a')]=util[_0xb9fe('0x62')]('SIP/%s',_0x5b52c1['user']['name']);_0x151520['message'][_0xb9fe('0x7b')]=_0x151520['channel'];_0x151520['message']['motionChannel']=_0x151520['channel'];_0x151520['message']['event']=_0xb9fe('0x60');return respondWithRpcPromise(_0xb9fe('0x7c'),_0xb9fe('0x7c'),{'event':_0xb9fe('0x7d'),'message':_[_0xb9fe('0x50')](_0x151520[_0xb9fe('0x2d')],JSON[_0xb9fe('0x7e')](_0x151520[_0xb9fe('0x6b')][_0xb9fe('0x7f')]))},client9002)[_0xb9fe('0x24')](function(){return _0x151520;});}return _0x151520;}return null;})[_0xb9fe('0x24')](respondWithResult(_0x4ba4b8,null))[_0xb9fe('0x57')](handleError(_0x4ba4b8,null));};var interaction_log=require(_0xb9fe('0x15'))('chat-interactions');exports[_0xb9fe('0x37')]=function(_0x4729c5,_0xa900d8,_0x29eb3f){var _0x2e018b={'agent':{},'channel':'chat'};if(_0x4729c5[_0xb9fe('0x5d')]['id']){delete _0x4729c5[_0xb9fe('0x5d')]['id'];}_0x4729c5[_0xb9fe('0x5d')][_0xb9fe('0x64')]=_0x4729c5['body'][_0xb9fe('0x64')]||_0x4729c5[_0xb9fe('0x65')]['id'];_0x2e018b[_0xb9fe('0x66')]['id']=_0x4729c5[_0xb9fe('0x5d')]['UserId'];return db[_0xb9fe('0x3f')][_0xb9fe('0x5b')]({'where':{'id':_0x4729c5[_0xb9fe('0x59')]['id'],'UserId':null}})[_0xb9fe('0x24')](handleEntityNotFound(_0xa900d8,null))[_0xb9fe('0x24')](function(_0x73d7f){if(_0x73d7f){_0x2e018b[_0xb9fe('0x2d')]=_0x73d7f['get']({'plain':!![]});return db[_0xb9fe('0x67')][_0xb9fe('0x5b')]({'where':{'id':_0x73d7f[_0xb9fe('0x68')]}});}return null;})[_0xb9fe('0x24')](handleEntityNotFound(_0xa900d8,null))[_0xb9fe('0x24')](function(_0x4c80bd){if(_0x4c80bd){_0x2e018b[_0xb9fe('0x6b')]=_0x4c80bd[_0xb9fe('0x6c')]({'plain':!![]});interaction_log[_0xb9fe('0x25')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4729c5[_0xb9fe('0x65')]['id'],_0x4729c5[_0xb9fe('0x65')][_0xb9fe('0x3c')],_0x4729c5[_0xb9fe('0x65')][_0xb9fe('0x6e')],_0x2e018b['interaction']['id'],_0x4729c5['body']?JSON[_0xb9fe('0x2a')](_0x4729c5[_0xb9fe('0x5d')]):_0xb9fe('0x6f'));return respondWithRpcPromise(_0xb9fe('0x80'),_0xb9fe('0x81'),_0x2e018b);}return null;})[_0xb9fe('0x24')](function(_0xc9aa8b){var _0x4089a7=_0xb9fe('0x72')+_0xc9aa8b['message'][_0xb9fe('0x73')];return db[_0xb9fe('0x74')][_0xb9fe('0x45')](_0x4089a7,{'type':db[_0xb9fe('0x82')][_0xb9fe('0x75')]['SELECT'],'raw':!![]})[_0xb9fe('0x24')](function(_0x1b4b0b){return _0x1b4b0b;});})[_0xb9fe('0x24')](function(_0x12649b){if(_0x12649b){_0x2e018b[_0xb9fe('0x2d')][_0xb9fe('0x77')]=_0x12649b[0x0];if(!_0x4729c5['body']['UserId'])return;return db[_0xb9fe('0x83')][_0xb9fe('0x5b')]({'where':{'id':_0x4729c5['body'][_0xb9fe('0x64')],'role':_0xb9fe('0x66')},'attributes':['id',_0xb9fe('0x3c'),'fullname',_0xb9fe('0x84'),_0xb9fe('0x85')],'raw':!![]});}return null;})['then'](function(_0x554e5d){if(!_0x554e5d)return null;_0x2e018b[_0xb9fe('0x2d')][_0xb9fe('0x66')]=_0x554e5d;return _0x2e018b;})[_0xb9fe('0x24')](function(_0x4246c8){if(_0x4246c8){_0x4246c8[_0xb9fe('0x2d')][_0xb9fe('0x7a')]=util['format'](_0xb9fe('0x86'),_0x4729c5[_0xb9fe('0x65')][_0xb9fe('0x3c')]);_0x4246c8['message'][_0xb9fe('0x7b')]=_0x2e018b['channel'];_0x4246c8['message'][_0xb9fe('0x87')]=_0x2e018b['channel'];_0x4246c8['message'][_0xb9fe('0x88')]='reject';respondWithRpcPromise('EventManager',_0xb9fe('0x7c'),{'event':_0xb9fe('0x89'),'message':_[_0xb9fe('0x50')](_0x2e018b[_0xb9fe('0x2d')],JSON[_0xb9fe('0x7e')](_0x2e018b[_0xb9fe('0x6b')]['formData']))},client9002);return _0x2e018b;}return null;})[_0xb9fe('0x24')](respondWithResult(_0xa900d8,null))[_0xb9fe('0x57')](handleError(_0xa900d8,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 492e8b1..a03eba4 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 _0x2263=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x2263,0x195));var _0x3226=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x2263[_0x1558ab];return _0x53b64a;};'use strict';var EventEmitter=require(_0x3226('0x0'));var ChatMessage=require(_0x3226('0x1'))['db'][_0x3226('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3226('0x3')](0x0);var events={'afterCreate':_0x3226('0x4'),'afterUpdate':_0x3226('0x5'),'afterDestroy':'remove'};function emitEvent(_0x109971){return function(_0x39f05e,_0x5c43b5,_0x28c34f){ChatMessageEvents[_0x3226('0x6')](_0x109971+':'+_0x39f05e['id'],_0x39f05e);ChatMessageEvents[_0x3226('0x6')](_0x109971,_0x39f05e);_0x28c34f(null);};}for(var e in events){if(events[_0x3226('0x7')](e)){var event=events[e];ChatMessage[_0x3226('0x8')](e,emitEvent(event));}}module[_0x3226('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xef06=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5484e4,_0x249d0f){var _0x10fa69=function(_0x21556b){while(--_0x21556b){_0x5484e4['push'](_0x5484e4['shift']());}};_0x10fa69(++_0x249d0f);}(_0xef06,0x119));var _0x6ef0=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0xef06[_0x178856];return _0x3c7fe7;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x6ef0('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6ef0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ef0('0x2'),'afterDestroy':_0x6ef0('0x3')};function emitEvent(_0x168522){return function(_0x549aff,_0x4837c7,_0x3429a0){ChatMessageEvents[_0x6ef0('0x4')](_0x168522+':'+_0x549aff['id'],_0x549aff);ChatMessageEvents[_0x6ef0('0x4')](_0x168522,_0x549aff);_0x3429a0(null);};}for(var e in events){if(events[_0x6ef0('0x5')](e)){var event=events[e];ChatMessage[_0x6ef0('0x6')](e,emitEvent(event));}}module[_0x6ef0('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1190e24..f371918 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 _0xf98a=['catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','findOne','createdAt'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf98a,0x162));var _0xaf98=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0xf98a[_0x1460f6];return _0x46ce94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf98('0x0'))(_0xaf98('0x1'));var moment=require(_0xaf98('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf98('0x3'));var rimraf=require('rimraf');var config=require(_0xaf98('0x4'));var attributes=require(_0xaf98('0x5'));module[_0xaf98('0x6')]=function(_0x20d54a,_0x1b846c){return _0x20d54a[_0xaf98('0x7')](_0xaf98('0x8'),attributes,{'tableName':_0xaf98('0x9'),'paranoid':![],'indexes':[{'name':_0xaf98('0xa'),'fields':[_0xaf98('0xb')],'type':_0xaf98('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e61a5,_0x2f3d88,_0x593ad7){var _0x2f8621=_0x20d54a['models'];var _0xddcc4f=_0x3e61a5[_0xaf98('0xd')]({'plain':!![]});if(_0xddcc4f[_0xaf98('0xe')][_0xaf98('0xf')]()==='in'||_0xddcc4f[_0xaf98('0xe')][_0xaf98('0xf')]()===_0xaf98('0x10')&&!_0xddcc4f['secret']&&!_[_0xaf98('0x11')](_0xddcc4f[_0xaf98('0x12')])){_0x2f8621['ChatInteraction'][_0xaf98('0x13')]({'where':{'id':_0xddcc4f['ChatInteractionId']}})['then'](function(_0x5391a4){if(_0x5391a4){_0x5391a4['update']({'lastMsgAt':_0xddcc4f[_0xaf98('0x14')],'lastMsgDirection':_0xddcc4f['direction'][_0xaf98('0xf')]()});}})[_0xaf98('0x15')](function(_0x29f233){console[_0xaf98('0x16')](_0x29f233);});}_0x593ad7();}},'charset':_0xaf98('0x17'),'collate':_0xaf98('0x18')});}; \ No newline at end of file +var _0x2aba=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteractionId','then','createdAt','catch','error','utf8mb4'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2aba,0xeb));var _0xa2ab=function(_0xc9a333,_0x44a6c8){_0xc9a333=_0xc9a333-0x0;var _0x1e75c3=_0x2aba[_0xc9a333];return _0x1e75c3;};'use strict';var _=require(_0xa2ab('0x0'));var util=require('util');var logger=require(_0xa2ab('0x1'))(_0xa2ab('0x2'));var moment=require(_0xa2ab('0x3'));var BPromise=require('bluebird');var rp=require(_0xa2ab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa2ab('0x5'));var config=require(_0xa2ab('0x6'));var attributes=require('./chatMessage.attributes');module[_0xa2ab('0x7')]=function(_0x3e2287,_0x5959df){return _0x3e2287['define'](_0xa2ab('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xa2ab('0x9'),'fields':[_0xa2ab('0xa')],'type':_0xa2ab('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bf400,_0x28e235,_0xc3da28){var _0x456335=_0x3e2287[_0xa2ab('0xc')];var _0x24e8d5=_0x3bf400[_0xa2ab('0xd')]({'plain':!![]});if(_0x24e8d5[_0xa2ab('0xe')][_0xa2ab('0xf')]()==='in'||_0x24e8d5[_0xa2ab('0xe')]['toLowerCase']()===_0xa2ab('0x10')&&!_0x24e8d5[_0xa2ab('0x11')]&&!_['isNil'](_0x24e8d5[_0xa2ab('0x12')])){_0x456335['ChatInteraction']['findOne']({'where':{'id':_0x24e8d5[_0xa2ab('0x13')]}})[_0xa2ab('0x14')](function(_0x2f7aec){if(_0x2f7aec){_0x2f7aec['update']({'lastMsgAt':_0x24e8d5[_0xa2ab('0x15')],'lastMsgDirection':_0x24e8d5[_0xa2ab('0xe')][_0xa2ab('0xf')]()});}})[_0xa2ab('0x16')](function(_0x39610b){console[_0xa2ab('0x17')](_0x39610b);});}_0xc3da28();}},'charset':_0xa2ab('0x18'),'collate':_0xa2ab('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index edb85fd..d7565b9 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 _0x61e2=['./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x61e2,0x19e));var _0x261e=function(_0x2b67e0,_0x5d4a4a){_0x2b67e0=_0x2b67e0-0x0;var _0x4a4eca=_0x61e2[_0x2b67e0];return _0x4a4eca;};'use strict';var _=require('lodash');var util=require(_0x261e('0x0'));var moment=require(_0x261e('0x1'));var BPromise=require(_0x261e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x261e('0x3'));var db=require(_0x261e('0x4'))['db'];var utils=require(_0x261e('0x5'));var logger=require(_0x261e('0x6'))(_0x261e('0x7'));var config=require(_0x261e('0x8'));var jayson=require(_0x261e('0x9'));var client=jayson[_0x261e('0xa')][_0x261e('0xb')]({'port':0x232a});config[_0x261e('0xc')]=_[_0x261e('0xd')](config[_0x261e('0xc')],{'host':_0x261e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x261e('0xc')]));require(_0x261e('0xf'))[_0x261e('0x10')](socket);function respondWithRpcPromise(_0xae4453,_0x14cd59,_0x127509){return new BPromise(function(_0x396404,_0x9f0100){return client[_0x261e('0x11')](_0xae4453,_0x127509)[_0x261e('0x12')](function(_0x4d45bb){logger[_0x261e('0x13')](_0x261e('0x14'),_0x14cd59,_0x261e('0x15'));logger[_0x261e('0x16')](_0x261e('0x17'),_0x14cd59,'request\x20sent',JSON[_0x261e('0x18')](_0x4d45bb));if(_0x4d45bb[_0x261e('0x19')]){if(_0x4d45bb[_0x261e('0x19')]['code']===0x1f4){logger[_0x261e('0x19')](_0x261e('0x14'),_0x14cd59,_0x4d45bb[_0x261e('0x19')][_0x261e('0x1a')]);return _0x9f0100(_0x4d45bb[_0x261e('0x19')][_0x261e('0x1a')]);}logger[_0x261e('0x19')](_0x261e('0x14'),_0x14cd59,_0x4d45bb['error'][_0x261e('0x1a')]);return _0x396404(_0x4d45bb['error']['message']);}else{logger[_0x261e('0x13')](_0x261e('0x14'),_0x14cd59,'request\x20sent');_0x396404(_0x4d45bb[_0x261e('0x1b')][_0x261e('0x1a')]);}})[_0x261e('0x1c')](function(_0x467dec){logger[_0x261e('0x19')]('ChatMessage,\x20%s,\x20%s',_0x14cd59,_0x467dec);_0x9f0100(_0x467dec);});});}exports[_0x261e('0x1d')]=function(_0x1a8bb1){var _0x3fe365=this;return new Promise(function(_0x15e32d,_0x235afe){return db[_0x261e('0x1e')][_0x261e('0x1f')](_0x1a8bb1['body'],{'raw':_0x1a8bb1['options']?_0x1a8bb1[_0x261e('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x261e('0x12')](function(_0x50b9d4){logger[_0x261e('0x13')](_0x261e('0x1d'),_0x1a8bb1);logger[_0x261e('0x16')](_0x261e('0x1d'),_0x1a8bb1,JSON['stringify'](_0x50b9d4));_0x15e32d(_0x50b9d4);})[_0x261e('0x1c')](function(_0x975c91){logger[_0x261e('0x19')](_0x261e('0x1d'),_0x975c91[_0x261e('0x1a')],_0x1a8bb1);_0x235afe(_0x3fe365[_0x261e('0x19')](0x1f4,_0x975c91[_0x261e('0x1a')]));});});}; \ No newline at end of file +var _0x55cf=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','CreateChatMessage','ChatMessage','body','options','raw'];(function(_0x56ef0e,_0x5c1b73){var _0x22e164=function(_0x51d143){while(--_0x51d143){_0x56ef0e['push'](_0x56ef0e['shift']());}};_0x22e164(++_0x5c1b73);}(_0x55cf,0x69));var _0xf55c=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x55cf[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require(_0xf55c('0x0'));var util=require(_0xf55c('0x1'));var moment=require(_0xf55c('0x2'));var BPromise=require(_0xf55c('0x3'));var rs=require(_0xf55c('0x4'));var fs=require('fs');var Redis=require(_0xf55c('0x5'));var db=require(_0xf55c('0x6'))['db'];var utils=require(_0xf55c('0x7'));var logger=require('../../config/logger')(_0xf55c('0x8'));var config=require(_0xf55c('0x9'));var jayson=require(_0xf55c('0xa'));var client=jayson['client'][_0xf55c('0xb')]({'port':0x232a});config[_0xf55c('0xc')]=_[_0xf55c('0xd')](config['redis'],{'host':_0xf55c('0xe'),'port':0x18eb});var socket=require(_0xf55c('0xf'))(new Redis(config[_0xf55c('0xc')]));require(_0xf55c('0x10'))[_0xf55c('0x11')](socket);function respondWithRpcPromise(_0x1c0dc8,_0x1db623,_0x1e8bb6){return new BPromise(function(_0x2011ee,_0x247350){return client[_0xf55c('0x12')](_0x1c0dc8,_0x1e8bb6)[_0xf55c('0x13')](function(_0x58256f){logger['info'](_0xf55c('0x14'),_0x1db623,_0xf55c('0x15'));logger[_0xf55c('0x16')](_0xf55c('0x17'),_0x1db623,_0xf55c('0x15'),JSON[_0xf55c('0x18')](_0x58256f));if(_0x58256f['error']){if(_0x58256f['error'][_0xf55c('0x19')]===0x1f4){logger['error'](_0xf55c('0x14'),_0x1db623,_0x58256f[_0xf55c('0x1a')][_0xf55c('0x1b')]);return _0x247350(_0x58256f[_0xf55c('0x1a')][_0xf55c('0x1b')]);}logger[_0xf55c('0x1a')](_0xf55c('0x14'),_0x1db623,_0x58256f[_0xf55c('0x1a')]['message']);return _0x2011ee(_0x58256f['error'][_0xf55c('0x1b')]);}else{logger[_0xf55c('0x1c')](_0xf55c('0x14'),_0x1db623,_0xf55c('0x15'));_0x2011ee(_0x58256f[_0xf55c('0x1d')][_0xf55c('0x1b')]);}})['catch'](function(_0x134232){logger[_0xf55c('0x1a')](_0xf55c('0x14'),_0x1db623,_0x134232);_0x247350(_0x134232);});});}exports[_0xf55c('0x1e')]=function(_0x55450d){var _0x5a8982=this;return new Promise(function(_0x296a36,_0x5ce708){return db[_0xf55c('0x1f')]['create'](_0x55450d[_0xf55c('0x20')],{'raw':_0x55450d[_0xf55c('0x21')]?_0x55450d[_0xf55c('0x21')][_0xf55c('0x22')]===undefined?!![]:![]:!![]})[_0xf55c('0x13')](function(_0x499b7c){logger['info']('CreateChatMessage',_0x55450d);logger[_0xf55c('0x16')](_0xf55c('0x1e'),_0x55450d,JSON[_0xf55c('0x18')](_0x499b7c));_0x296a36(_0x499b7c);})['catch'](function(_0x4f8d66){logger[_0xf55c('0x1a')]('CreateChatMessage',_0x4f8d66[_0xf55c('0x1b')],_0x55450d);_0x5ce708(_0x5a8982[_0xf55c('0x1a')](0x1f4,_0x4f8d66[_0xf55c('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ba79926..3e6735f 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 _0xa23f=['save','emit','register','chatMessage:','./chatMessage.events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa23f,0x7c));var _0xfa23=function(_0x1fe510,_0x17db63){_0x1fe510=_0x1fe510-0x0;var _0x506661=_0xa23f[_0x1fe510];return _0x506661;};'use strict';var ChatMessageEvents=require(_0xfa23('0x0'));var events=[_0xfa23('0x1'),'remove','update'];function createListener(_0xb81edf,_0x3f714c){return function(_0x1c85a9){_0x3f714c[_0xfa23('0x2')](_0xb81edf,_0x1c85a9);};}function removeListener(_0x5643b1,_0x86778e){return function(){ChatMessageEvents['removeListener'](_0x5643b1,_0x86778e);};}exports[_0xfa23('0x3')]=function(_0x2df2f5){for(var _0x4c3f4=0x0,_0x3696ef=events['length'];_0x4c3f4<_0x3696ef;_0x4c3f4++){var _0x5a7882=events[_0x4c3f4];var _0x59d53e=createListener(_0xfa23('0x4')+_0x5a7882,_0x2df2f5);ChatMessageEvents['on'](_0x5a7882,_0x59d53e);}}; \ No newline at end of file +var _0x8ce1=['./chatMessage.events','save','remove','update','emit','removeListener','register','length','chatMessage:'];(function(_0x4c8430,_0x2ce9ea){var _0x3ff8fa=function(_0x198db6){while(--_0x198db6){_0x4c8430['push'](_0x4c8430['shift']());}};_0x3ff8fa(++_0x2ce9ea);}(_0x8ce1,0x183));var _0x18ce=function(_0x5b310a,_0x20461e){_0x5b310a=_0x5b310a-0x0;var _0x287dde=_0x8ce1[_0x5b310a];return _0x287dde;};'use strict';var ChatMessageEvents=require(_0x18ce('0x0'));var events=[_0x18ce('0x1'),_0x18ce('0x2'),_0x18ce('0x3')];function createListener(_0x202f93,_0x22b196){return function(_0x211dc4){_0x22b196[_0x18ce('0x4')](_0x202f93,_0x211dc4);};}function removeListener(_0x1d842c,_0x15f55e){return function(){ChatMessageEvents[_0x18ce('0x5')](_0x1d842c,_0x15f55e);};}exports[_0x18ce('0x6')]=function(_0x13ff9d){for(var _0x36f8db=0x0,_0x682d4b=events[_0x18ce('0x7')];_0x36f8db<_0x682d4b;_0x36f8db++){var _0x4ebf82=events[_0x36f8db];var _0x1a60c5=createListener(_0x18ce('0x8')+_0x4ebf82,_0x13ff9d);ChatMessageEvents['on'](_0x4ebf82,_0x1a60c5);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 749da3e..14d497d 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 _0x7630=['isAuthenticated','/describe','describe','show','post','tracked','chat','create','/:id','update','put','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','get'];(function(_0x2f6629,_0x1b013c){var _0x317739=function(_0xc44c27){while(--_0xc44c27){_0x2f6629['push'](_0x2f6629['shift']());}};_0x317739(++_0x1b013c);}(_0x7630,0x1a0));var _0x0763=function(_0x371db3,_0x268daa){_0x371db3=_0x371db3-0x0;var _0xb81bda=_0x7630[_0x371db3];return _0xb81bda;};'use strict';var multer=require(_0x0763('0x0'));var util=require('util');var path=require(_0x0763('0x1'));var timeout=require(_0x0763('0x2'));var express=require(_0x0763('0x3'));var router=express[_0x0763('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0763('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0763('0x6'));var controller=require(_0x0763('0x7'));router[_0x0763('0x8')]('/',auth[_0x0763('0x9')](),controller['index']);router[_0x0763('0x8')](_0x0763('0xa'),auth[_0x0763('0x9')](),controller[_0x0763('0xb')]);router[_0x0763('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0763('0xc')]);router[_0x0763('0xd')]('/',auth['isAuthenticated'](),interaction[_0x0763('0xe')](_0x0763('0xf'),'chatmessage:create'),controller[_0x0763('0x10')]);router['put'](_0x0763('0x11'),controller[_0x0763('0x12')]);router[_0x0763('0x13')](_0x0763('0x14'),auth[_0x0763('0x9')](),controller[_0x0763('0x15')]);router['put']('/:id/reject',auth[_0x0763('0x9')](),controller['reject']);router[_0x0763('0x16')](_0x0763('0x11'),auth[_0x0763('0x9')](),controller[_0x0763('0x17')]);module[_0x0763('0x18')]=router; \ No newline at end of file +var _0x1cd0=['chat','chatmessage:create','put','/:id','/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','show','post','tracked'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1cd0,0x171));var _0x01cd=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x1cd0[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x01cd('0x0'));var util=require(_0x01cd('0x1'));var path=require(_0x01cd('0x2'));var timeout=require(_0x01cd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x01cd('0x4'));var auth=require(_0x01cd('0x5'));var interaction=require(_0x01cd('0x6'));var config=require(_0x01cd('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0x01cd('0x8')](),controller[_0x01cd('0x9')]);router['get'](_0x01cd('0xa'),auth[_0x01cd('0x8')](),controller['describe']);router[_0x01cd('0xb')]('/:id',auth[_0x01cd('0x8')](),controller[_0x01cd('0xc')]);router[_0x01cd('0xd')]('/',auth[_0x01cd('0x8')](),interaction[_0x01cd('0xe')](_0x01cd('0xf'),_0x01cd('0x10')),controller['create']);router[_0x01cd('0x11')](_0x01cd('0x12'),controller['update']);router[_0x01cd('0x11')](_0x01cd('0x13'),auth[_0x01cd('0x8')](),controller[_0x01cd('0x14')]);router[_0x01cd('0x11')](_0x01cd('0x15'),auth[_0x01cd('0x8')](),controller[_0x01cd('0x16')]);router['delete']('/:id',auth[_0x01cd('0x8')](),controller['destroy']);module[_0x01cd('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index aa5a5fb..009b663 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0x34ac7c,_0x46b73f){var _0x31552b=function(_0x3fdf80){while(--_0x3fdf80){_0x34ac7c['push'](_0x34ac7c['shift']());}};_0x31552b(++_0x46b73f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x251fa4,_0x3d5860){var _0x453047=function(_0x337a6f){while(--_0x337a6f){_0x251fa4['push'](_0x251fa4['shift']());}};_0x453047(++_0x3d5860);}(_0x2032,0xd9));var _0x2203=function(_0x184468,_0x539926){_0x184468=_0x184468-0x0;var _0x978b1c=_0x2032[_0x184468];return _0x978b1c;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index bed4762..14b2339 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(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x150a68,_0xaf00bf){_0x150a68=_0x150a68-0x0;var _0x1e1ac6=_0x7a54[_0x150a68];return _0x1e1ac6;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x355d0a,_0x1f524a){_0x355d0a=_0x355d0a-0x0;var _0x31742f=_0x7a54[_0x355d0a];return _0x31742f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 92b9f8f..00e7ce0 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 _0x9f01=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','ChatOfflineMessage'];(function(_0x1b7efc,_0x54fba0){var _0x251b54=function(_0x96879d){while(--_0x96879d){_0x1b7efc['push'](_0x1b7efc['shift']());}};_0x251b54(++_0x54fba0);}(_0x9f01,0x19c));var _0x19f0=function(_0x2fa7f2,_0x5ef8fc){_0x2fa7f2=_0x2fa7f2-0x0;var _0x4f2380=_0x9f01[_0x2fa7f2];return _0x4f2380;};'use strict';var EventEmitter=require(_0x19f0('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x19f0('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x19f0('0x2')](0x0);var events={'afterCreate':_0x19f0('0x3'),'afterUpdate':_0x19f0('0x4'),'afterDestroy':_0x19f0('0x5')};function emitEvent(_0x48af7a){return function(_0x1b0a46,_0x3886b0,_0x47247c){ChatOfflineMessageEvents[_0x19f0('0x6')](_0x48af7a+':'+_0x1b0a46['id'],_0x1b0a46);ChatOfflineMessageEvents[_0x19f0('0x6')](_0x48af7a,_0x1b0a46);_0x47247c(null);};}for(var e in events){if(events[_0x19f0('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x19f0('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x53eb=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x273072,_0x15f470){var _0x15eb9e=function(_0x5ecafe){while(--_0x5ecafe){_0x273072['push'](_0x273072['shift']());}};_0x15eb9e(++_0x15f470);}(_0x53eb,0x14b));var _0xb53e=function(_0xe9807f,_0x32d9b2){_0xe9807f=_0xe9807f-0x0;var _0x37b826=_0x53eb[_0xe9807f];return _0x37b826;};'use strict';var EventEmitter=require(_0xb53e('0x0'));var ChatOfflineMessage=require(_0xb53e('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xb53e('0x2')](0x0);var events={'afterCreate':_0xb53e('0x3'),'afterUpdate':_0xb53e('0x4'),'afterDestroy':_0xb53e('0x5')};function emitEvent(_0x224463){return function(_0x3c9da8,_0x3c3add,_0x778f){ChatOfflineMessageEvents[_0xb53e('0x6')](_0x224463+':'+_0x3c9da8['id'],_0x3c9da8);ChatOfflineMessageEvents[_0xb53e('0x6')](_0x224463,_0x3c9da8);_0x778f(null);};}for(var e in events){if(events[_0xb53e('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xb53e('0x8')](e,emitEvent(event));}}module[_0xb53e('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 5aee2fa..a38965b 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 _0xd535=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd535,0x13d));var _0x5d53=function(_0x3c33c6,_0x649a87){_0x3c33c6=_0x3c33c6-0x0;var _0x2d949f=_0xd535[_0x3c33c6];return _0x2d949f;};'use strict';var attributes=require(_0x5d53('0x0'));module['exports']=function(_0x3f6636){return _0x3f6636[_0x5d53('0x1')](_0x5d53('0x2'),attributes,{'tableName':_0x5d53('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d53('0x4'),'collate':_0x5d53('0x5')});}; \ No newline at end of file +var _0x8d9c=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x4a8f16,_0x38082d){var _0xeabeb1=function(_0x19af1a){while(--_0x19af1a){_0x4a8f16['push'](_0x4a8f16['shift']());}};_0xeabeb1(++_0x38082d);}(_0x8d9c,0x13b));var _0xc8d9=function(_0x5bd8ff,_0x22a057){_0x5bd8ff=_0x5bd8ff-0x0;var _0x151ae8=_0x8d9c[_0x5bd8ff];return _0x151ae8;};'use strict';var attributes=require(_0xc8d9('0x0'));module[_0xc8d9('0x1')]=function(_0x3bb4e3){return _0x3bb4e3[_0xc8d9('0x2')](_0xc8d9('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8d9('0x4'),'collate':_0xc8d9('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8d9fe96..bd533c0 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 _0x271d=['ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x36aad0,_0x3d2e17){var _0x31e987=function(_0x2d0fe4){while(--_0x2d0fe4){_0x36aad0['push'](_0x36aad0['shift']());}};_0x31e987(++_0x3d2e17);}(_0x271d,0xc4));var _0xd271=function(_0x14c3de,_0x33ede3){_0x14c3de=_0x14c3de-0x0;var _0x4ee07f=_0x271d[_0x14c3de];return _0x4ee07f;};'use strict';var _=require(_0xd271('0x0'));var util=require(_0xd271('0x1'));var moment=require('moment');var BPromise=require(_0xd271('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd271('0x3'));var db=require(_0xd271('0x4'))['db'];var utils=require(_0xd271('0x5'));var logger=require(_0xd271('0x6'))(_0xd271('0x7'));var config=require(_0xd271('0x8'));var jayson=require(_0xd271('0x9'));var client=jayson[_0xd271('0xa')][_0xd271('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9a32d7,_0x2d40ff,_0x1820c0){return new BPromise(function(_0x5bdca5,_0x20760a){return client[_0xd271('0xc')](_0x9a32d7,_0x1820c0)[_0xd271('0xd')](function(_0xadd55a){logger[_0xd271('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d40ff,_0xd271('0xf'));logger[_0xd271('0x10')](_0xd271('0x11'),_0x2d40ff,'request\x20sent',JSON[_0xd271('0x12')](_0xadd55a));if(_0xadd55a[_0xd271('0x13')]){if(_0xadd55a[_0xd271('0x13')]['code']===0x1f4){logger[_0xd271('0x13')](_0xd271('0x14'),_0x2d40ff,_0xadd55a[_0xd271('0x13')][_0xd271('0x15')]);return _0x20760a(_0xadd55a[_0xd271('0x13')][_0xd271('0x15')]);}logger[_0xd271('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d40ff,_0xadd55a[_0xd271('0x13')]['message']);return _0x5bdca5(_0xadd55a[_0xd271('0x13')][_0xd271('0x15')]);}else{logger[_0xd271('0xe')](_0xd271('0x14'),_0x2d40ff,_0xd271('0xf'));_0x5bdca5(_0xadd55a[_0xd271('0x16')][_0xd271('0x15')]);}})[_0xd271('0x17')](function(_0x4c3a06){logger[_0xd271('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d40ff,_0x4c3a06);_0x20760a(_0x4c3a06);});});} \ No newline at end of file +var _0x631b=['code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x410982,_0x23dc53){var _0x16b7d2=function(_0x4a9268){while(--_0x4a9268){_0x410982['push'](_0x410982['shift']());}};_0x16b7d2(++_0x23dc53);}(_0x631b,0x72));var _0xb631=function(_0x3e186f,_0x2eb7be){_0x3e186f=_0x3e186f-0x0;var _0x3595bf=_0x631b[_0x3e186f];return _0x3595bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb631('0x0'));var BPromise=require(_0xb631('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb631('0x2'));var db=require(_0xb631('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb631('0x4'))(_0xb631('0x5'));var config=require('../../config/environment');var jayson=require(_0xb631('0x6'));var client=jayson[_0xb631('0x7')][_0xb631('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b782e,_0x11622e,_0x2091f2){return new BPromise(function(_0x4c9cc7,_0x8eb299){return client[_0xb631('0x9')](_0x4b782e,_0x2091f2)[_0xb631('0xa')](function(_0x45752e){logger[_0xb631('0xb')](_0xb631('0xc'),_0x11622e,_0xb631('0xd'));logger[_0xb631('0xe')](_0xb631('0xf'),_0x11622e,_0xb631('0xd'),JSON[_0xb631('0x10')](_0x45752e));if(_0x45752e[_0xb631('0x11')]){if(_0x45752e['error'][_0xb631('0x12')]===0x1f4){logger['error'](_0xb631('0xc'),_0x11622e,_0x45752e[_0xb631('0x11')]['message']);return _0x8eb299(_0x45752e[_0xb631('0x11')][_0xb631('0x13')]);}logger[_0xb631('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x11622e,_0x45752e[_0xb631('0x11')][_0xb631('0x13')]);return _0x4c9cc7(_0x45752e['error'][_0xb631('0x13')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x11622e,'request\x20sent');_0x4c9cc7(_0x45752e[_0xb631('0x14')][_0xb631('0x13')]);}})[_0xb631('0x15')](function(_0x1b9901){logger[_0xb631('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x11622e,_0x1b9901);_0x8eb299(_0x1b9901);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e82286c..d90317e 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 _0xae2c=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','describe','/:id','show','create','put','update','destroy'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xae2c,0xf1));var _0xcae2=function(_0x34ab65,_0x18f624){_0x34ab65=_0x34ab65-0x0;var _0x4cdab4=_0xae2c[_0x34ab65];return _0x4cdab4;};'use strict';var multer=require(_0xcae2('0x0'));var util=require('util');var path=require(_0xcae2('0x1'));var timeout=require('connect-timeout');var express=require(_0xcae2('0x2'));var router=express[_0xcae2('0x3')]();var fs_extra=require(_0xcae2('0x4'));var auth=require(_0xcae2('0x5'));var interaction=require(_0xcae2('0x6'));var config=require(_0xcae2('0x7'));var controller=require(_0xcae2('0x8'));router['get']('/',auth[_0xcae2('0x9')](),controller[_0xcae2('0xa')]);router[_0xcae2('0xb')]('/describe',auth[_0xcae2('0x9')](),controller[_0xcae2('0xc')]);router[_0xcae2('0xb')](_0xcae2('0xd'),auth['isAuthenticated'](),controller[_0xcae2('0xe')]);router['post']('/',auth[_0xcae2('0x9')](),controller[_0xcae2('0xf')]);router[_0xcae2('0x10')](_0xcae2('0xd'),auth['isAuthenticated'](),controller[_0xcae2('0x11')]);router['delete'](_0xcae2('0xd'),auth['isAuthenticated'](),controller[_0xcae2('0x12')]);module[_0xcae2('0x13')]=router; \ No newline at end of file +var _0x262e=['describe','show','post','put','update','delete','/:id','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x268572,_0xe33f16){var _0x1fd2ee=function(_0xb4187c){while(--_0xb4187c){_0x268572['push'](_0x268572['shift']());}};_0x1fd2ee(++_0xe33f16);}(_0x262e,0x1eb));var _0xe262=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x262e[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0xe262('0x0'));var util=require('util');var path=require(_0xe262('0x1'));var timeout=require('connect-timeout');var express=require(_0xe262('0x2'));var router=express[_0xe262('0x3')]();var fs_extra=require(_0xe262('0x4'));var auth=require(_0xe262('0x5'));var interaction=require(_0xe262('0x6'));var config=require(_0xe262('0x7'));var controller=require(_0xe262('0x8'));router[_0xe262('0x9')]('/',auth[_0xe262('0xa')](),controller[_0xe262('0xb')]);router[_0xe262('0x9')](_0xe262('0xc'),auth[_0xe262('0xa')](),controller[_0xe262('0xd')]);router[_0xe262('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe262('0xe')]);router[_0xe262('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe262('0x10')]('/:id',auth[_0xe262('0xa')](),controller[_0xe262('0x11')]);router[_0xe262('0x12')](_0xe262('0x13'),auth[_0xe262('0xa')](),controller[_0xe262('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 9eb4daf..66358a4 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 _0xdfc2=['STRING','ENUM','timeout','mouseOver','sequelize','exports'];(function(_0x5ed005,_0x5e5602){var _0x1dc88a=function(_0x4beac0){while(--_0x4beac0){_0x5ed005['push'](_0x5ed005['shift']());}};_0x1dc88a(++_0x5e5602);}(_0xdfc2,0xa0));var _0x2dfc=function(_0x2e0ffa,_0x451f12){_0x2e0ffa=_0x2e0ffa-0x0;var _0x24d627=_0xdfc2[_0x2e0ffa];return _0x24d627;};'use strict';var Sequelize=require(_0x2dfc('0x0'));module[_0x2dfc('0x1')]={'name':{'type':Sequelize[_0x2dfc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2dfc('0x3')]('mouseOver',_0x2dfc('0x4')),'defaultValue':_0x2dfc('0x5')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa401=['sequelize','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x29147b,_0x44cab1){var _0x404518=function(_0x5e3793){while(--_0x5e3793){_0x29147b['push'](_0x29147b['shift']());}};_0x404518(++_0x44cab1);}(_0xa401,0x1e0));var _0x1a40=function(_0x360120,_0x5d2d82){_0x360120=_0x360120-0x0;var _0x34be8e=_0xa401[_0x360120];return _0x34be8e;};'use strict';var Sequelize=require(_0x1a40('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a40('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1a40('0x2')](_0x1a40('0x3'),_0x1a40('0x4')),'defaultValue':_0x1a40('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1a40('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e2c4799..0651180 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 _0x295f=['merge','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','intersection','query','fields','attributes','length','includeAll','include'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x295f,0x168));var _0xf295=function(_0x45a1b4,_0x379571){_0x45a1b4=_0x45a1b4-0x0;var _0x669ff8=_0x295f[_0x45a1b4];return _0x669ff8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf295('0x0'));var zipdir=require(_0xf295('0x1'));var jsonpatch=require(_0xf295('0x2'));var rp=require('request-promise');var moment=require(_0xf295('0x3'));var BPromise=require(_0xf295('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf295('0x5'));var sox=require(_0xf295('0x6'));var csv=require(_0xf295('0x7'));var ejs=require(_0xf295('0x8'));var fs=require('fs');var fs_extra=require(_0xf295('0x9'));var _=require('lodash');var squel=require(_0xf295('0xa'));var crypto=require(_0xf295('0xb'));var jsforce=require(_0xf295('0xc'));var deskjs=require(_0xf295('0xd'));var toCsv=require(_0xf295('0x7'));var querystring=require(_0xf295('0xe'));var Papa=require(_0xf295('0xf'));var Redis=require(_0xf295('0x10'));var authService=require(_0xf295('0x11'));var qs=require(_0xf295('0x12'));var as=require(_0xf295('0x13'));var hardwareService=require(_0xf295('0x14'));var logger=require('../../config/logger')(_0xf295('0x15'));var utils=require(_0xf295('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf295('0x17'));var db=require(_0xf295('0x18'))['db'];function respondWithStatusCode(_0x3be98e,_0x416d04){_0x416d04=_0x416d04||0xcc;return function(_0x11063a){if(_0x11063a){return _0x3be98e[_0xf295('0x19')](_0x416d04);}return _0x3be98e[_0xf295('0x1a')](_0x416d04)[_0xf295('0x1b')]();};}function respondWithResult(_0x32d3d1,_0x3f0981){_0x3f0981=_0x3f0981||0xc8;return function(_0x1724d0){if(_0x1724d0){return _0x32d3d1[_0xf295('0x1a')](_0x3f0981)[_0xf295('0x1c')](_0x1724d0);}};}function respondWithFilteredResult(_0x26a3d5,_0x11f3b0){return function(_0x1d31e6){if(_0x1d31e6){var _0xa42735=typeof _0x11f3b0[_0xf295('0x1d')]==='undefined'&&typeof _0x11f3b0['limit']===_0xf295('0x1e');var _0x129a9e=_0x1d31e6['count'];var _0x3e0a44=_0xa42735?0x0:_0x11f3b0['offset'];var _0x30ad22=_0xa42735?_0x1d31e6['count']:_0x11f3b0['offset']+_0x11f3b0[_0xf295('0x1f')];var _0x458d55;if(_0x30ad22>=_0x129a9e){_0x30ad22=_0x129a9e;_0x458d55=0xc8;}else{_0x458d55=0xce;}_0x26a3d5['status'](_0x458d55);return _0x26a3d5['set'](_0xf295('0x20'),_0x3e0a44+'-'+_0x30ad22+'/'+_0x129a9e)[_0xf295('0x1c')](_0x1d31e6);}return null;};}function patchUpdates(_0x320d3c){return function(_0x28fa70){try{jsonpatch[_0xf295('0x21')](_0x28fa70,_0x320d3c,!![]);}catch(_0x158f6){return BPromise['reject'](_0x158f6);}return _0x28fa70['save']();};}function saveUpdates(_0x26cecb,_0x5154b0){return function(_0x2ef08a){if(_0x2ef08a){return _0x2ef08a[_0xf295('0x22')](_0x26cecb)[_0xf295('0x23')](function(_0x50a368){return _0x50a368;});}return null;};}function removeEntity(_0x3c1be4,_0x2e079e){return function(_0x493aed){if(_0x493aed){return _0x493aed[_0xf295('0x24')]()[_0xf295('0x23')](function(){_0x3c1be4[_0xf295('0x1a')](0xcc)[_0xf295('0x1b')]();});}};}function handleEntityNotFound(_0x111449,_0x490cc3){return function(_0x615ded){if(!_0x615ded){_0x111449[_0xf295('0x19')](0x194);}return _0x615ded;};}function handleError(_0x4b845e,_0x4b7850){_0x4b7850=_0x4b7850||0x1f4;return function(_0x1ba1dd){logger[_0xf295('0x25')](_0x1ba1dd[_0xf295('0x26')]);if(_0x1ba1dd[_0xf295('0x27')]){delete _0x1ba1dd[_0xf295('0x27')];}_0x4b845e[_0xf295('0x1a')](_0x4b7850)[_0xf295('0x28')](_0x1ba1dd);};}exports[_0xf295('0x29')]=function(_0x13fe67,_0x5dae12){var _0x1f5a89={'raw':!![],'where':{'id':_0x13fe67[_0xf295('0x2a')]['id']}},_0x19ec3a={};_0x19ec3a[_0xf295('0x2b')]=_[_0xf295('0x2c')](db[_0xf295('0x2d')]['rawAttributes']);_0x19ec3a['query']=_['keys'](_0x13fe67['query']);_0x19ec3a['filters']=_[_0xf295('0x2e')](_0x19ec3a[_0xf295('0x2b')],_0x19ec3a[_0xf295('0x2f')]);_0x1f5a89['attributes']=_[_0xf295('0x2e')](_0x19ec3a['model'],qs[_0xf295('0x30')](_0x13fe67['query']['fields']));_0x1f5a89[_0xf295('0x31')]=_0x1f5a89[_0xf295('0x31')][_0xf295('0x32')]?_0x1f5a89['attributes']:_0x19ec3a[_0xf295('0x2b')];if(_0x13fe67[_0xf295('0x2f')][_0xf295('0x33')]){_0x1f5a89[_0xf295('0x34')]=[{'all':!![]}];}_0x1f5a89=_[_0xf295('0x35')]({},_0x1f5a89,_0x13fe67[_0xf295('0x36')]);return db['ChatProactiveAction'][_0xf295('0x37')](_0x1f5a89)[_0xf295('0x23')](handleEntityNotFound(_0x5dae12,null))[_0xf295('0x23')](respondWithResult(_0x5dae12,null))[_0xf295('0x38')](handleError(_0x5dae12,null));};exports[_0xf295('0x39')]=function(_0x4c4efa,_0xcbe742){return db[_0xf295('0x2d')]['create'](_0x4c4efa[_0xf295('0x3a')],{})[_0xf295('0x23')](respondWithResult(_0xcbe742,0xc9))[_0xf295('0x38')](handleError(_0xcbe742,null));};exports['update']=function(_0x343457,_0x3096f6){if(_0x343457[_0xf295('0x3a')]['id']){delete _0x343457[_0xf295('0x3a')]['id'];}return db[_0xf295('0x2d')][_0xf295('0x37')]({'where':{'id':_0x343457[_0xf295('0x2a')]['id']}})[_0xf295('0x23')](handleEntityNotFound(_0x3096f6,null))[_0xf295('0x23')](saveUpdates(_0x343457[_0xf295('0x3a')],null))[_0xf295('0x23')](respondWithResult(_0x3096f6,null))[_0xf295('0x38')](handleError(_0x3096f6,null));};exports[_0xf295('0x24')]=function(_0x4ae17a,_0x13dade){return db[_0xf295('0x2d')][_0xf295('0x37')]({'where':{'id':_0x4ae17a[_0xf295('0x2a')]['id']}})[_0xf295('0x23')](handleEntityNotFound(_0x13dade,null))[_0xf295('0x23')](removeEntity(_0x13dade,null))['catch'](handleError(_0x13dade,null));}; \ No newline at end of file +var _0xceae=['find','create','body','catch','params','eml-format','rimraf','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','limit','count','set','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','length','includeAll','include','options'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0xceae,0x122));var _0xecea=function(_0x6cf622,_0x146e67){_0x6cf622=_0x6cf622-0x0;var _0x1887fe=_0xceae[_0x6cf622];return _0x1887fe;};'use strict';var emlformat=require(_0xecea('0x0'));var rimraf=require(_0xecea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xecea('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xecea('0x3'));var path=require(_0xecea('0x4'));var sox=require(_0xecea('0x5'));var csv=require(_0xecea('0x6'));var ejs=require(_0xecea('0x7'));var fs=require('fs');var fs_extra=require(_0xecea('0x8'));var _=require(_0xecea('0x9'));var squel=require(_0xecea('0xa'));var crypto=require(_0xecea('0xb'));var jsforce=require(_0xecea('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xecea('0x6'));var querystring=require('querystring');var Papa=require(_0xecea('0xd'));var Redis=require(_0xecea('0xe'));var authService=require(_0xecea('0xf'));var qs=require(_0xecea('0x10'));var as=require(_0xecea('0x11'));var hardwareService=require(_0xecea('0x12'));var logger=require(_0xecea('0x13'))(_0xecea('0x14'));var utils=require(_0xecea('0x15'));var config=require(_0xecea('0x16'));var licenseUtil=require(_0xecea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x536e98,_0x5438d7){_0x5438d7=_0x5438d7||0xcc;return function(_0x115dab){if(_0x115dab){return _0x536e98['sendStatus'](_0x5438d7);}return _0x536e98[_0xecea('0x18')](_0x5438d7)[_0xecea('0x19')]();};}function respondWithResult(_0x23d248,_0x64d1ed){_0x64d1ed=_0x64d1ed||0xc8;return function(_0x18f8d1){if(_0x18f8d1){return _0x23d248[_0xecea('0x18')](_0x64d1ed)['json'](_0x18f8d1);}};}function respondWithFilteredResult(_0x32561f,_0x3245c2){return function(_0x675f0f){if(_0x675f0f){var _0x5db7f0=typeof _0x3245c2[_0xecea('0x1a')]==='undefined'&&typeof _0x3245c2[_0xecea('0x1b')]==='undefined';var _0x2d3aa6=_0x675f0f[_0xecea('0x1c')];var _0x2eb5a9=_0x5db7f0?0x0:_0x3245c2[_0xecea('0x1a')];var _0x439f83=_0x5db7f0?_0x675f0f[_0xecea('0x1c')]:_0x3245c2[_0xecea('0x1a')]+_0x3245c2[_0xecea('0x1b')];var _0x4f6cf8;if(_0x439f83>=_0x2d3aa6){_0x439f83=_0x2d3aa6;_0x4f6cf8=0xc8;}else{_0x4f6cf8=0xce;}_0x32561f[_0xecea('0x18')](_0x4f6cf8);return _0x32561f[_0xecea('0x1d')]('Content-Range',_0x2eb5a9+'-'+_0x439f83+'/'+_0x2d3aa6)[_0xecea('0x1e')](_0x675f0f);}return null;};}function patchUpdates(_0x509eaa){return function(_0x12971a){try{jsonpatch[_0xecea('0x1f')](_0x12971a,_0x509eaa,!![]);}catch(_0x48bb6c){return BPromise['reject'](_0x48bb6c);}return _0x12971a[_0xecea('0x20')]();};}function saveUpdates(_0x22c169,_0x4c0eff){return function(_0x23c3e5){if(_0x23c3e5){return _0x23c3e5[_0xecea('0x21')](_0x22c169)[_0xecea('0x22')](function(_0x5bc4d9){return _0x5bc4d9;});}return null;};}function removeEntity(_0x4dace3,_0x3cc1fa){return function(_0x187d43){if(_0x187d43){return _0x187d43[_0xecea('0x23')]()[_0xecea('0x22')](function(){_0x4dace3['status'](0xcc)[_0xecea('0x19')]();});}};}function handleEntityNotFound(_0x1b4063,_0x36a3e5){return function(_0x2c089d){if(!_0x2c089d){_0x1b4063[_0xecea('0x24')](0x194);}return _0x2c089d;};}function handleError(_0x3c74a6,_0x13b3b3){_0x13b3b3=_0x13b3b3||0x1f4;return function(_0x22f053){logger[_0xecea('0x25')](_0x22f053[_0xecea('0x26')]);if(_0x22f053['name']){delete _0x22f053[_0xecea('0x27')];}_0x3c74a6[_0xecea('0x18')](_0x13b3b3)[_0xecea('0x28')](_0x22f053);};}exports['show']=function(_0x14827d,_0x13cd59){var _0x536d8a={'raw':!![],'where':{'id':_0x14827d['params']['id']}},_0x19df1d={};_0x19df1d[_0xecea('0x29')]=_[_0xecea('0x2a')](db[_0xecea('0x2b')][_0xecea('0x2c')]);_0x19df1d[_0xecea('0x2d')]=_['keys'](_0x14827d[_0xecea('0x2d')]);_0x19df1d['filters']=_[_0xecea('0x2e')](_0x19df1d[_0xecea('0x29')],_0x19df1d[_0xecea('0x2d')]);_0x536d8a['attributes']=_[_0xecea('0x2e')](_0x19df1d[_0xecea('0x29')],qs['fields'](_0x14827d[_0xecea('0x2d')]['fields']));_0x536d8a[_0xecea('0x2f')]=_0x536d8a[_0xecea('0x2f')][_0xecea('0x30')]?_0x536d8a[_0xecea('0x2f')]:_0x19df1d[_0xecea('0x29')];if(_0x14827d['query'][_0xecea('0x31')]){_0x536d8a[_0xecea('0x32')]=[{'all':!![]}];}_0x536d8a=_['merge']({},_0x536d8a,_0x14827d[_0xecea('0x33')]);return db[_0xecea('0x2b')][_0xecea('0x34')](_0x536d8a)[_0xecea('0x22')](handleEntityNotFound(_0x13cd59,null))[_0xecea('0x22')](respondWithResult(_0x13cd59,null))['catch'](handleError(_0x13cd59,null));};exports['create']=function(_0x36f08,_0x542f6a){return db[_0xecea('0x2b')][_0xecea('0x35')](_0x36f08[_0xecea('0x36')],{})[_0xecea('0x22')](respondWithResult(_0x542f6a,0xc9))[_0xecea('0x37')](handleError(_0x542f6a,null));};exports[_0xecea('0x21')]=function(_0x349000,_0x5040d0){if(_0x349000[_0xecea('0x36')]['id']){delete _0x349000[_0xecea('0x36')]['id'];}return db[_0xecea('0x2b')][_0xecea('0x34')]({'where':{'id':_0x349000[_0xecea('0x38')]['id']}})[_0xecea('0x22')](handleEntityNotFound(_0x5040d0,null))[_0xecea('0x22')](saveUpdates(_0x349000[_0xecea('0x36')],null))[_0xecea('0x22')](respondWithResult(_0x5040d0,null))['catch'](handleError(_0x5040d0,null));};exports['destroy']=function(_0x53e184,_0x48e614){return db[_0xecea('0x2b')]['find']({'where':{'id':_0x53e184[_0xecea('0x38')]['id']}})['then'](handleEntityNotFound(_0x48e614,null))[_0xecea('0x22')](removeEntity(_0x48e614,null))['catch'](handleError(_0x48e614,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 13790e6..8182a30 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 _0x2567=['chat_proactive_actions','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x19f4ef,_0x51eabd){var _0x1ca86a=function(_0x3db12b){while(--_0x3db12b){_0x19f4ef['push'](_0x19f4ef['shift']());}};_0x1ca86a(++_0x51eabd);}(_0x2567,0x1a3));var _0x7256=function(_0x7eb670,_0x5356ed){_0x7eb670=_0x7eb670-0x0;var _0x21427f=_0x2567[_0x7eb670];return _0x21427f;};'use strict';var _=require(_0x7256('0x0'));var util=require(_0x7256('0x1'));var logger=require(_0x7256('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7256('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7256('0x4'));var config=require(_0x7256('0x5'));var attributes=require(_0x7256('0x6'));module[_0x7256('0x7')]=function(_0x5cf64f,_0x4db498){return _0x5cf64f[_0x7256('0x8')](_0x7256('0x9'),attributes,{'tableName':_0x7256('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfae6=['moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfae6,0x168));var _0x6fae=function(_0x2fd59c,_0x519e07){_0x2fd59c=_0x2fd59c-0x0;var _0x3df5d9=_0xfae6[_0x2fd59c];return _0x3df5d9;};'use strict';var _=require(_0x6fae('0x0'));var util=require(_0x6fae('0x1'));var logger=require(_0x6fae('0x2'))(_0x6fae('0x3'));var moment=require(_0x6fae('0x4'));var BPromise=require(_0x6fae('0x5'));var rp=require(_0x6fae('0x6'));var fs=require('fs');var path=require(_0x6fae('0x7'));var rimraf=require('rimraf');var config=require(_0x6fae('0x8'));var attributes=require(_0x6fae('0x9'));module[_0x6fae('0xa')]=function(_0x2467e0,_0xd04106){return _0x2467e0[_0x6fae('0xb')](_0x6fae('0xc'),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 ff23346..86b1aa2 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 _0x5083=['request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x392f82,_0x4dc713){var _0x3ad0b8=function(_0x29da4b){while(--_0x29da4b){_0x392f82['push'](_0x392f82['shift']());}};_0x3ad0b8(++_0x4dc713);}(_0x5083,0x157));var _0x3508=function(_0x1074c1,_0x2768a9){_0x1074c1=_0x1074c1-0x0;var _0x1e5a0e=_0x5083[_0x1074c1];return _0x1e5a0e;};'use strict';var _=require('lodash');var util=require(_0x3508('0x0'));var moment=require(_0x3508('0x1'));var BPromise=require('bluebird');var rs=require(_0x3508('0x2'));var fs=require('fs');var Redis=require(_0x3508('0x3'));var db=require(_0x3508('0x4'))['db'];var utils=require(_0x3508('0x5'));var logger=require('../../config/logger')(_0x3508('0x6'));var config=require(_0x3508('0x7'));var jayson=require(_0x3508('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36142f,_0x48b58b,_0x5b53f9){return new BPromise(function(_0x1ecdf3,_0x32b921){return client[_0x3508('0x9')](_0x36142f,_0x5b53f9)['then'](function(_0x112ef5){logger[_0x3508('0xa')](_0x3508('0xb'),_0x48b58b,_0x3508('0xc'));logger['debug'](_0x3508('0xd'),_0x48b58b,_0x3508('0xc'),JSON['stringify'](_0x112ef5));if(_0x112ef5[_0x3508('0xe')]){if(_0x112ef5[_0x3508('0xe')]['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x48b58b,_0x112ef5[_0x3508('0xe')][_0x3508('0xf')]);return _0x32b921(_0x112ef5['error'][_0x3508('0xf')]);}logger['error'](_0x3508('0xb'),_0x48b58b,_0x112ef5[_0x3508('0xe')]['message']);return _0x1ecdf3(_0x112ef5[_0x3508('0xe')][_0x3508('0xf')]);}else{logger[_0x3508('0xa')](_0x3508('0xb'),_0x48b58b,_0x3508('0xc'));_0x1ecdf3(_0x112ef5['result'][_0x3508('0xf')]);}})['catch'](function(_0x13b59c){logger[_0x3508('0xe')](_0x3508('0xb'),_0x48b58b,_0x13b59c);_0x32b921(_0x13b59c);});});} \ No newline at end of file +var _0xe0b2=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0xe503ab,_0x3b8df2){var _0x516749=function(_0x4932aa){while(--_0x4932aa){_0xe503ab['push'](_0xe503ab['shift']());}};_0x516749(++_0x3b8df2);}(_0xe0b2,0xec));var _0x2e0b=function(_0x435732,_0x52a485){_0x435732=_0x435732-0x0;var _0x57253c=_0xe0b2[_0x435732];return _0x57253c;};'use strict';var _=require('lodash');var util=require(_0x2e0b('0x0'));var moment=require(_0x2e0b('0x1'));var BPromise=require(_0x2e0b('0x2'));var rs=require(_0x2e0b('0x3'));var fs=require('fs');var Redis=require(_0x2e0b('0x4'));var db=require(_0x2e0b('0x5'))['db'];var utils=require(_0x2e0b('0x6'));var logger=require('../../config/logger')(_0x2e0b('0x7'));var config=require(_0x2e0b('0x8'));var jayson=require(_0x2e0b('0x9'));var client=jayson[_0x2e0b('0xa')][_0x2e0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x264319,_0x4b62b7,_0x2e1e40){return new BPromise(function(_0x504ea6,_0x1afd43){return client[_0x2e0b('0xc')](_0x264319,_0x2e1e40)[_0x2e0b('0xd')](function(_0x3078eb){logger[_0x2e0b('0xe')](_0x2e0b('0xf'),_0x4b62b7,_0x2e0b('0x10'));logger[_0x2e0b('0x11')](_0x2e0b('0x12'),_0x4b62b7,'request\x20sent',JSON[_0x2e0b('0x13')](_0x3078eb));if(_0x3078eb[_0x2e0b('0x14')]){if(_0x3078eb['error']['code']===0x1f4){logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x1afd43(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x504ea6(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x4b62b7,'request\x20sent');_0x504ea6(_0x3078eb[_0x2e0b('0x16')]['message']);}})[_0x2e0b('0x17')](function(_0x426879){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4b62b7,_0x426879);_0x1afd43(_0x426879);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8be87f0..219b4fd 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 _0x4819=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x16ce30,_0x3a957b){var _0x2de58b=function(_0x18fb4b){while(--_0x18fb4b){_0x16ce30['push'](_0x16ce30['shift']());}};_0x2de58b(++_0x3a957b);}(_0x4819,0xcd));var _0x9481=function(_0x213f3d,_0x31c31f){_0x213f3d=_0x213f3d-0x0;var _0x238251=_0x4819[_0x213f3d];return _0x238251;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get'](_0x9481('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9481('0xb')]('/',auth[_0x9481('0xc')](),controller[_0x9481('0xd')]);router[_0x9481('0xe')](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['delete'](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);module[_0x9481('0x11')]=router; \ No newline at end of file +var _0x5d17=['create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post'];(function(_0x594b8d,_0x303118){var _0x5d213e=function(_0x4f4306){while(--_0x4f4306){_0x594b8d['push'](_0x594b8d['shift']());}};_0x5d213e(++_0x303118);}(_0x5d17,0x114));var _0x75d1=function(_0x49988d,_0x15dae4){_0x49988d=_0x49988d-0x0;var _0x2259f7=_0x5d17[_0x49988d];return _0x2259f7;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/:id',auth[_0x75d1('0x9')](),controller[_0x75d1('0xa')]);router[_0x75d1('0xb')]('/',auth[_0x75d1('0x9')](),controller[_0x75d1('0xc')]);router[_0x75d1('0xd')](_0x75d1('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x75d1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x75d1('0x10')]);module[_0x75d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 619a5a1..178af9a 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 _0x944b=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4e4505,_0x53320d){var _0x5ba35d=function(_0x51507a){while(--_0x51507a){_0x4e4505['push'](_0x4e4505['shift']());}};_0x5ba35d(++_0x53320d);}(_0x944b,0xae));var _0xb944=function(_0x4dbfe4,_0x66f312){_0x4dbfe4=_0x4dbfe4-0x0;var _0x359ebd=_0x944b[_0x4dbfe4];return _0x359ebd;};'use strict';var Sequelize=require(_0xb944('0x0'));module[_0xb944('0x1')]={'name':{'type':Sequelize[_0xb944('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb944('0x2')]},'timeout':{'type':Sequelize[_0xb944('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb944('0x4')](_0xb944('0x5'),_0xb944('0x6'),_0xb944('0x7'))}}; \ No newline at end of file +var _0x89eb=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x89eb,0x178));var _0xb89e=function(_0xca08da,_0x574f1c){_0xca08da=_0xca08da-0x0;var _0x2fb4ba=_0x89eb[_0xca08da];return _0x2fb4ba;};'use strict';var Sequelize=require(_0xb89e('0x0'));module[_0xb89e('0x1')]={'name':{'type':Sequelize[_0xb89e('0x2')],'unique':_0xb89e('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb89e('0x2')]},'timeout':{'type':Sequelize[_0xb89e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb89e('0x5')](_0xb89e('0x6'),_0xb89e('0x7'),_0xb89e('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 75ab111..65e38cc 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 _0x7a98=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','User','online','flatMap','Agents','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','./chatQueue.socket','register','client','http','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','destroy','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','keys','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','intersection','find','create','body','get'];(function(_0x382c3c,_0x21b9e3){var _0xe6aa8c=function(_0x1794f2){while(--_0x1794f2){_0x382c3c['push'](_0x382c3c['shift']());}};_0xe6aa8c(++_0x21b9e3);}(_0x7a98,0x15d));var _0x87a9=function(_0x4e644c,_0x408e47){_0x4e644c=_0x4e644c-0x0;var _0x1def41=_0x7a98[_0x4e644c];return _0x1def41;};'use strict';var emlformat=require(_0x87a9('0x0'));var rimraf=require(_0x87a9('0x1'));var zipdir=require(_0x87a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x87a9('0x3'));var path=require(_0x87a9('0x4'));var sox=require(_0x87a9('0x5'));var csv=require(_0x87a9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87a9('0x7'));var _=require(_0x87a9('0x8'));var squel=require(_0x87a9('0x9'));var crypto=require(_0x87a9('0xa'));var jsforce=require(_0x87a9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x87a9('0xc'));var Redis=require(_0x87a9('0xd'));var authService=require(_0x87a9('0xe'));var qs=require(_0x87a9('0xf'));var as=require(_0x87a9('0x10'));var hardwareService=require(_0x87a9('0x11'));var logger=require('../../config/logger')(_0x87a9('0x12'));var utils=require(_0x87a9('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x87a9('0x14'))['db'];config['redis']=_[_0x87a9('0x15')](config[_0x87a9('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x87a9('0x17'))(new Redis(config['redis']));require(_0x87a9('0x18'))[_0x87a9('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x87a9('0x1a')][_0x87a9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3f2bd3,_0x42d6a4,_0x1f0159,_0x24b748){return new BPromise(function(_0x5e3f65,_0x5f380c){var _0x32f399=_0x24b748||client;return _0x32f399[_0x87a9('0x1c')](_0x3f2bd3,_0x1f0159)[_0x87a9('0x1d')](function(_0x22d31e){logger[_0x87a9('0x1e')]('ChatQueue,\x20%s,\x20%s',_0x42d6a4,_0x87a9('0x1f'));logger[_0x87a9('0x20')](_0x87a9('0x21'),_0x42d6a4,'request\x20sent',JSON[_0x87a9('0x22')](_0x22d31e));if(_0x22d31e[_0x87a9('0x23')]){if(_0x22d31e[_0x87a9('0x23')][_0x87a9('0x24')]===0x1f4){logger[_0x87a9('0x23')](_0x87a9('0x25'),_0x42d6a4,_0x22d31e[_0x87a9('0x23')][_0x87a9('0x26')]);return _0x5f380c(_0x22d31e[_0x87a9('0x23')][_0x87a9('0x26')]);}logger['error'](_0x87a9('0x25'),_0x42d6a4,_0x22d31e[_0x87a9('0x23')]['message']);return _0x5e3f65(_0x22d31e[_0x87a9('0x23')][_0x87a9('0x26')]);}else{logger[_0x87a9('0x1e')]('ChatQueue,\x20%s,\x20%s',_0x42d6a4,_0x87a9('0x1f'));_0x5e3f65(_0x22d31e['result'][_0x87a9('0x26')]);}})[_0x87a9('0x27')](function(_0x209538){logger[_0x87a9('0x23')](_0x87a9('0x25'),_0x42d6a4,_0x209538);_0x5f380c(_0x209538);});});}function respondWithStatusCode(_0x56e6ac,_0x4bfe7a){_0x4bfe7a=_0x4bfe7a||0xcc;return function(_0x465283){if(_0x465283){return _0x56e6ac[_0x87a9('0x28')](_0x4bfe7a);}return _0x56e6ac[_0x87a9('0x29')](_0x4bfe7a)[_0x87a9('0x2a')]();};}function respondWithResult(_0x1b7045,_0x2ce505){_0x2ce505=_0x2ce505||0xc8;return function(_0x24e4cc){if(_0x24e4cc){return _0x1b7045[_0x87a9('0x29')](_0x2ce505)[_0x87a9('0x2b')](_0x24e4cc);}};}function respondWithFilteredResult(_0x164b49,_0x2c2c97){return function(_0x3eee84){if(_0x3eee84){var _0x29415a=typeof _0x2c2c97['offset']===_0x87a9('0x2c')&&typeof _0x2c2c97[_0x87a9('0x2d')]===_0x87a9('0x2c');var _0x4ec6fd=_0x3eee84['count'];var _0x55df5f=_0x29415a?0x0:_0x2c2c97['offset'];var _0x259d48=_0x29415a?_0x3eee84['count']:_0x2c2c97[_0x87a9('0x2e')]+_0x2c2c97[_0x87a9('0x2d')];var _0x5bbc9d;if(_0x259d48>=_0x4ec6fd){_0x259d48=_0x4ec6fd;_0x5bbc9d=0xc8;}else{_0x5bbc9d=0xce;}_0x164b49[_0x87a9('0x29')](_0x5bbc9d);return _0x164b49[_0x87a9('0x2f')](_0x87a9('0x30'),_0x55df5f+'-'+_0x259d48+'/'+_0x4ec6fd)[_0x87a9('0x2b')](_0x3eee84);}return null;};}function patchUpdates(_0xe9bb1b){return function(_0x8eac1){try{jsonpatch[_0x87a9('0x31')](_0x8eac1,_0xe9bb1b,!![]);}catch(_0x4469c4){return BPromise[_0x87a9('0x32')](_0x4469c4);}return _0x8eac1['save']();};}function saveUpdates(_0x4c1e49,_0x168c5f){return function(_0x38dfd6){if(_0x38dfd6){return _0x38dfd6[_0x87a9('0x33')](_0x4c1e49)[_0x87a9('0x1d')](function(_0x5d6656){return _0x5d6656;});}return null;};}function removeEntity(_0x2eb21c,_0x4a1d53){return function(_0x1013c0){if(_0x1013c0){return _0x1013c0[_0x87a9('0x34')]()[_0x87a9('0x1d')](function(){var _0x442487=_0x1013c0['get']({'plain':!![]});var _0x2ff85d='ChatQueues';return db[_0x87a9('0x35')]['destroy']({'where':{'type':_0x2ff85d,'resourceId':_0x442487['id']}})[_0x87a9('0x1d')](function(){return _0x1013c0;});})[_0x87a9('0x1d')](function(){_0x2eb21c[_0x87a9('0x29')](0xcc)[_0x87a9('0x2a')]();});}};}function handleEntityNotFound(_0x176a94,_0x4ceb51){return function(_0x4f2f8){if(!_0x4f2f8){_0x176a94['sendStatus'](0x194);}return _0x4f2f8;};}function handleError(_0x2fdf55,_0x5206ab){_0x5206ab=_0x5206ab||0x1f4;return function(_0x4fe68f){logger[_0x87a9('0x23')](_0x4fe68f[_0x87a9('0x36')]);if(_0x4fe68f[_0x87a9('0x37')]){delete _0x4fe68f[_0x87a9('0x37')];}_0x2fdf55[_0x87a9('0x29')](_0x5206ab)[_0x87a9('0x38')](_0x4fe68f);};}exports[_0x87a9('0x39')]=function(_0x493e03,_0x1e2af2){var _0x4b8eba={},_0x47bbb0={},_0x426589={'count':0x0,'rows':[]};var _0x544537=_[_0x87a9('0x3a')](db[_0x87a9('0x3b')][_0x87a9('0x3c')],function(_0x1a2cf5){return{'name':_0x1a2cf5['fieldName'],'type':_0x1a2cf5['type']['key']};});_0x47bbb0['model']=_[_0x87a9('0x3a')](_0x544537,_0x87a9('0x37'));_0x47bbb0['query']=_[_0x87a9('0x3d')](_0x493e03[_0x87a9('0x3e')]);_0x47bbb0['filters']=_['intersection'](_0x47bbb0[_0x87a9('0x3f')],_0x47bbb0[_0x87a9('0x3e')]);_0x4b8eba[_0x87a9('0x40')]=_['intersection'](_0x47bbb0[_0x87a9('0x3f')],qs[_0x87a9('0x41')](_0x493e03['query'][_0x87a9('0x41')]));_0x4b8eba[_0x87a9('0x40')]=_0x4b8eba[_0x87a9('0x40')][_0x87a9('0x42')]?_0x4b8eba[_0x87a9('0x40')]:_0x47bbb0[_0x87a9('0x3f')];if(!_0x493e03[_0x87a9('0x3e')][_0x87a9('0x43')](_0x87a9('0x44'))){_0x4b8eba[_0x87a9('0x2d')]=qs[_0x87a9('0x2d')](_0x493e03[_0x87a9('0x3e')][_0x87a9('0x2d')]);_0x4b8eba[_0x87a9('0x2e')]=qs['offset'](_0x493e03[_0x87a9('0x3e')][_0x87a9('0x2e')]);}_0x4b8eba[_0x87a9('0x45')]=qs[_0x87a9('0x46')](_0x493e03[_0x87a9('0x3e')][_0x87a9('0x46')]);_0x4b8eba[_0x87a9('0x47')]=qs[_0x87a9('0x48')](_[_0x87a9('0x49')](_0x493e03[_0x87a9('0x3e')],_0x47bbb0[_0x87a9('0x48')]),_0x544537);if(_0x493e03[_0x87a9('0x3e')][_0x87a9('0x4a')]){_0x4b8eba[_0x87a9('0x47')]=_[_0x87a9('0x4b')](_0x4b8eba[_0x87a9('0x47')],{'$or':_[_0x87a9('0x3a')](_0x544537,function(_0x27c821){if(_0x27c821['type']!==_0x87a9('0x4c')){var _0x228a62={};_0x228a62[_0x27c821[_0x87a9('0x37')]]={'$like':'%'+_0x493e03['query'][_0x87a9('0x4a')]+'%'};return _0x228a62;}})});}_0x4b8eba=_[_0x87a9('0x4b')]({},_0x4b8eba,_0x493e03[_0x87a9('0x4d')]);var _0x546175={'where':_0x4b8eba['where']};return db['ChatQueue'][_0x87a9('0x4e')](_0x546175)['then'](function(_0x9135d4){_0x426589[_0x87a9('0x4e')]=_0x9135d4;if(_0x493e03[_0x87a9('0x3e')][_0x87a9('0x4f')]){_0x4b8eba[_0x87a9('0x50')]=[{'all':!![]}];}return db[_0x87a9('0x3b')][_0x87a9('0x51')](_0x4b8eba);})[_0x87a9('0x1d')](function(_0x40a359){_0x426589[_0x87a9('0x52')]=_0x40a359;return _0x426589;})[_0x87a9('0x1d')](respondWithFilteredResult(_0x1e2af2,_0x4b8eba))['catch'](handleError(_0x1e2af2,null));};exports['show']=function(_0x234834,_0x33bfd7){var _0x51e89a={'raw':!![],'where':{'id':_0x234834[_0x87a9('0x53')]['id']}},_0x54783b={};_0x54783b[_0x87a9('0x3f')]=_[_0x87a9('0x3d')](db[_0x87a9('0x3b')]['rawAttributes']);_0x54783b[_0x87a9('0x3e')]=_['keys'](_0x234834[_0x87a9('0x3e')]);_0x54783b[_0x87a9('0x48')]=_[_0x87a9('0x54')](_0x54783b[_0x87a9('0x3f')],_0x54783b[_0x87a9('0x3e')]);_0x51e89a[_0x87a9('0x40')]=_[_0x87a9('0x54')](_0x54783b[_0x87a9('0x3f')],qs[_0x87a9('0x41')](_0x234834['query']['fields']));_0x51e89a[_0x87a9('0x40')]=_0x51e89a[_0x87a9('0x40')]['length']?_0x51e89a[_0x87a9('0x40')]:_0x54783b[_0x87a9('0x3f')];if(_0x234834[_0x87a9('0x3e')][_0x87a9('0x4f')]){_0x51e89a[_0x87a9('0x50')]=[{'all':!![]}];}_0x51e89a=_[_0x87a9('0x4b')]({},_0x51e89a,_0x234834[_0x87a9('0x4d')]);return db[_0x87a9('0x3b')][_0x87a9('0x55')](_0x51e89a)[_0x87a9('0x1d')](handleEntityNotFound(_0x33bfd7,null))['then'](respondWithResult(_0x33bfd7,null))[_0x87a9('0x27')](handleError(_0x33bfd7,null));};exports[_0x87a9('0x56')]=function(_0x3d5c35,_0x226316){return db['ChatQueue'][_0x87a9('0x56')](_0x3d5c35[_0x87a9('0x57')],{})[_0x87a9('0x1d')](function(_0x41ed5a){var _0x49a3a1=_0x3d5c35['user'][_0x87a9('0x58')]({'plain':!![]});if(!_0x49a3a1)throw new Error(_0x87a9('0x59'));if(_0x49a3a1[_0x87a9('0x5a')]===_0x87a9('0x5b')){var _0x22d158=_0x41ed5a[_0x87a9('0x58')]({'plain':!![]});var _0x5172c8=_0x87a9('0x5c');return db['UserProfileSection'][_0x87a9('0x55')]({'where':{'name':_0x5172c8,'userProfileId':_0x49a3a1[_0x87a9('0x5d')]},'raw':!![]})['then'](function(_0x506484){if(_0x506484&&_0x506484[_0x87a9('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x22d158['name'],'resourceId':_0x22d158['id'],'type':_0x506484[_0x87a9('0x37')],'sectionId':_0x506484['id']},{})['then'](function(){return _0x41ed5a;});}else{return _0x41ed5a;}})[_0x87a9('0x27')](function(_0x39ac46){logger[_0x87a9('0x23')](_0x87a9('0x5f'),_0x39ac46);throw _0x39ac46;});}return _0x41ed5a;})[_0x87a9('0x1d')](respondWithResult(_0x226316,0xc9))[_0x87a9('0x27')](handleError(_0x226316,null));};exports[_0x87a9('0x33')]=function(_0x542d5f,_0x453963){if(_0x542d5f['body']['id']){delete _0x542d5f[_0x87a9('0x57')]['id'];}return db[_0x87a9('0x3b')][_0x87a9('0x55')]({'where':{'id':_0x542d5f['params']['id']}})[_0x87a9('0x1d')](handleEntityNotFound(_0x453963,null))[_0x87a9('0x1d')](saveUpdates(_0x542d5f['body'],null))[_0x87a9('0x1d')](respondWithResult(_0x453963,null))[_0x87a9('0x27')](handleError(_0x453963,null));};exports[_0x87a9('0x34')]=function(_0x1e6643,_0x2c7b85){return db['ChatQueue'][_0x87a9('0x55')]({'where':{'id':_0x1e6643[_0x87a9('0x53')]['id']}})[_0x87a9('0x1d')](handleEntityNotFound(_0x2c7b85,null))['then'](removeEntity(_0x2c7b85,null))[_0x87a9('0x27')](handleError(_0x2c7b85,null));};exports[_0x87a9('0x60')]=function(_0x1547dc,_0x515c62){return db[_0x87a9('0x3b')][_0x87a9('0x60')]()[_0x87a9('0x1d')](respondWithResult(_0x515c62,null))[_0x87a9('0x27')](handleError(_0x515c62,null));};exports[_0x87a9('0x61')]=function(_0x27e480,_0x43fc07,_0x550224){var _0x312f8c={'raw':!![],'where':{}},_0x3aba77={},_0x58bfd4;return db[_0x87a9('0x3b')][_0x87a9('0x62')]({'where':{'id':_0x27e480['params']['id']}})[_0x87a9('0x1d')](handleEntityNotFound(_0x43fc07,null))[_0x87a9('0x1d')](function(_0x3ce4ca){if(_0x3ce4ca){_0x58bfd4=_0x3ce4ca['get']({'plain':!![]});_0x3aba77['model']=_[_0x87a9('0x3d')](db[_0x87a9('0x63')]['rawAttributes']);_0x3aba77[_0x87a9('0x3e')]=_[_0x87a9('0x3d')](_0x27e480[_0x87a9('0x3e')]);_0x3aba77[_0x87a9('0x48')]=_[_0x87a9('0x54')](_0x3aba77[_0x87a9('0x3f')],_0x3aba77[_0x87a9('0x3e')]);_0x312f8c[_0x87a9('0x40')]=_[_0x87a9('0x54')](_0x3aba77['model'],qs[_0x87a9('0x41')](_0x27e480[_0x87a9('0x3e')][_0x87a9('0x41')]));_0x312f8c[_0x87a9('0x40')]=_0x312f8c[_0x87a9('0x40')][_0x87a9('0x42')]?_0x312f8c['attributes']:_0x3aba77[_0x87a9('0x3f')];if(!_0x27e480[_0x87a9('0x3e')][_0x87a9('0x43')](_0x87a9('0x44'))){_0x312f8c[_0x87a9('0x2d')]=qs[_0x87a9('0x2d')](_0x27e480[_0x87a9('0x3e')][_0x87a9('0x2d')]);_0x312f8c[_0x87a9('0x2e')]=qs['offset'](_0x27e480[_0x87a9('0x3e')]['offset']);}_0x312f8c[_0x87a9('0x45')]=qs[_0x87a9('0x46')](_0x27e480[_0x87a9('0x3e')][_0x87a9('0x46')]);_0x312f8c[_0x87a9('0x47')]=qs[_0x87a9('0x48')](_[_0x87a9('0x49')](_0x27e480['query'],_0x3aba77['filters']));_0x312f8c[_0x87a9('0x47')]['ChatQueueId']=_0x3ce4ca['id'];if(_0x27e480[_0x87a9('0x3e')][_0x87a9('0x4a')]){_0x312f8c[_0x87a9('0x47')]=_[_0x87a9('0x4b')](_0x312f8c[_0x87a9('0x47')],{'$or':_[_0x87a9('0x3a')](_0x312f8c[_0x87a9('0x40')],function(_0x6391d8){var _0x322ad3={};_0x322ad3[_0x6391d8]={'$like':'%'+_0x27e480[_0x87a9('0x3e')][_0x87a9('0x4a')]+'%'};return _0x322ad3;})});}_0x312f8c=_[_0x87a9('0x4b')]({},_0x312f8c,_0x27e480[_0x87a9('0x4d')]);return db['UserChatQueue'][_0x87a9('0x51')](_0x312f8c);}})[_0x87a9('0x1d')](function(_0x5b9c02){if(_0x5b9c02){return db['User'][_0x87a9('0x64')]({'where':{'id':_[_0x87a9('0x3a')](_0x5b9c02,'UserId'),'role':_0x87a9('0x65')},'attributes':['id',_0x87a9('0x37'),_0x87a9('0x66'),_0x87a9('0x67'),_0x87a9('0x68')]});}})[_0x87a9('0x1d')](function(_0x447d45){if(_0x447d45){return{'count':_0x447d45['count'],'rows':_[_0x87a9('0x3a')](_0x447d45[_0x87a9('0x52')],function(_0x5b77e1){return{'membername':_0x5b77e1['name'],'UserId':_0x5b77e1['id'],'queue_name':_0x58bfd4[_0x87a9('0x37')],'ChatQueueId':_0x58bfd4['id'],'interface':util['format'](_0x87a9('0x69'),_0x87a9('0x6a'),_0x5b77e1[_0x87a9('0x37')]),'penalty':0x0,'paused':_0x5b77e1[_0x87a9('0x66')],'createdAt':_0x5b77e1[_0x87a9('0x68')],'updatedAt':_0x5b77e1[_0x87a9('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x87a9('0x1d')](respondWithFilteredResult(_0x43fc07,_0x312f8c))['catch'](handleError(_0x43fc07,null));};exports[_0x87a9('0x6b')]=function(_0x3fbb90,_0x7ce432,_0x2b237b){var _0x2cde03={};var _0x30be34={};var _0xf7b4aa;var _0x9dd8fe;return db[_0x87a9('0x3b')]['findOne']({'where':{'id':_0x3fbb90['params']['id']}})[_0x87a9('0x1d')](handleEntityNotFound(_0x7ce432,null))['then'](function(_0x51599d){if(_0x51599d){_0xf7b4aa=_0x51599d;_0x30be34[_0x87a9('0x3f')]=_[_0x87a9('0x3d')](db[_0x87a9('0x6c')][_0x87a9('0x3c')]);_0x30be34['query']=_[_0x87a9('0x3d')](_0x3fbb90[_0x87a9('0x3e')]);_0x30be34['filters']=_[_0x87a9('0x54')](_0x30be34[_0x87a9('0x3f')],_0x30be34[_0x87a9('0x3e')]);_0x2cde03[_0x87a9('0x40')]=_['intersection'](_0x30be34['model'],qs[_0x87a9('0x41')](_0x3fbb90[_0x87a9('0x3e')][_0x87a9('0x41')]));_0x2cde03[_0x87a9('0x40')]=_0x2cde03[_0x87a9('0x40')][_0x87a9('0x42')]?_0x2cde03[_0x87a9('0x40')]:_0x30be34[_0x87a9('0x3f')];_0x2cde03[_0x87a9('0x45')]=qs[_0x87a9('0x46')](_0x3fbb90[_0x87a9('0x3e')][_0x87a9('0x46')]);_0x2cde03[_0x87a9('0x47')]=qs[_0x87a9('0x48')](_[_0x87a9('0x49')](_0x3fbb90[_0x87a9('0x3e')],_0x30be34[_0x87a9('0x48')]));if(_0x3fbb90['query']['filter']){_0x2cde03['where']=_[_0x87a9('0x4b')](_0x2cde03['where'],{'$or':_[_0x87a9('0x3a')](_0x2cde03['attributes'],function(_0x4179b5){var _0xf1e676={};_0xf1e676[_0x4179b5]={'$like':'%'+_0x3fbb90['query']['filter']+'%'};return _0xf1e676;})});}_0x2cde03=_['merge']({},_0x2cde03,_0x3fbb90[_0x87a9('0x4d')]);return _0xf7b4aa['getTeams'](_0x2cde03);}})['then'](function(_0x48886a){if(_0x48886a){_0x9dd8fe=_0x48886a[_0x87a9('0x42')];if(!_0x3fbb90[_0x87a9('0x3e')]['hasOwnProperty']('nolimit')){_0x2cde03[_0x87a9('0x2d')]=qs[_0x87a9('0x2d')](_0x3fbb90['query'][_0x87a9('0x2d')]);_0x2cde03[_0x87a9('0x2e')]=qs[_0x87a9('0x2e')](_0x3fbb90['query']['offset']);}return _0xf7b4aa[_0x87a9('0x6b')](_0x2cde03);}})[_0x87a9('0x1d')](function(_0x1c3c6b){if(_0x1c3c6b){return _0x1c3c6b?{'count':_0x9dd8fe,'rows':_0x1c3c6b}:null;}})[_0x87a9('0x1d')](respondWithResult(_0x7ce432,null))[_0x87a9('0x27')](handleError(_0x7ce432,null));};exports[_0x87a9('0x6d')]=function(_0xcd913b,_0x163104,_0x568316){var _0x79806e=_0xcd913b[_0x87a9('0x57')][_0x87a9('0x6e')];return db[_0x87a9('0x6c')][_0x87a9('0x51')]({'where':{'id':_0x79806e},'attributes':['id'],'include':[{'model':db[_0x87a9('0x6f')],'as':'Agents','attributes':['id',_0x87a9('0x37'),_0x87a9('0x70'),'voicePause','interface'],'raw':!![]}]})[_0x87a9('0x1d')](function(_0x41a2cc){if(_0x41a2cc){var _0x4751e6=_[_0x87a9('0x71')](_0x41a2cc,function(_0x1d76a7){var _0x178cd2=_0x1d76a7[_0x87a9('0x58')]({'plain':!![]});return _0x178cd2[_0x87a9('0x72')];});return db[_0x87a9('0x3b')][_0x87a9('0x55')]({'where':{'id':_0xcd913b[_0x87a9('0x53')]['id']}})[_0x87a9('0x1d')](function(_0x2ce368){return db['sequelize'][_0x87a9('0x73')](function(_0xca9b14){return _0x2ce368[_0x87a9('0x6d')](_0x79806e,{'transaction':_0xca9b14})[_0x87a9('0x1d')](function(){return BPromise['each'](_0x4751e6,function(_0x457b24){return db[_0x87a9('0x63')][_0x87a9('0x74')]({'where':{'UserId':_0x457b24['id'],'ChatQueueId':_0xcd913b[_0x87a9('0x53')]['id']},'transaction':_0xca9b14});});})[_0x87a9('0x1d')](function(){_0x4751e6[_0x87a9('0x75')](function(_0x5bc1b2){socket[_0x87a9('0x76')](_0x87a9('0x77'),{'UserId':_0x5bc1b2['id'],'ChatQueueId':_0x2ce368['id']});});});});});}})[_0x87a9('0x1d')](respondWithStatusCode(_0x163104,null))[_0x87a9('0x27')](handleError(_0x163104,null));};exports[_0x87a9('0x78')]=function(_0x4c1236,_0x4760e8,_0x2f5280){return db['Team']['findAll']({'where':{'id':_0x4c1236['query'][_0x87a9('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x87a9('0x6f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x87a9('0x1d')](handleEntityNotFound(_0x4760e8,null))[_0x87a9('0x1d')](function(_0x2e5f16){var _0x316a9b=_[_0x87a9('0x3a')](_0x2e5f16,'id');var _0x173226=[];var _0x1cd9e=[];var _0x32648a=squel[_0x87a9('0x79')]();_0x32648a[_0x87a9('0x7a')]('tq.TeamId')['from'](_0x87a9('0x7b'),'tq')[_0x87a9('0x7c')](_0x87a9('0x7d'),'ut',_0x87a9('0x7e'))[_0x87a9('0x47')]('ChatQueueId\x20=\x20?',_0x4c1236[_0x87a9('0x53')]['id']);for(var _0xea412f=0x0;_0xea412f<_0x2e5f16[_0x87a9('0x42')];_0xea412f+=0x1){let _0x36297b=_0x2e5f16[_0xea412f];for(var _0x3fa8f8=0x0;_0x3fa8f8<_0x36297b[_0x87a9('0x72')]['length'];_0x3fa8f8+=0x1){let _0x4f94b2=_0x36297b[_0x87a9('0x72')][_0x3fa8f8];var _0x4f1917=_0x32648a[_0x87a9('0x7f')]();_0x4f1917[_0x87a9('0x47')](_0x87a9('0x80'),_0x4f94b2['id']);_0x1cd9e[_0x87a9('0x81')](db[_0x87a9('0x82')][_0x87a9('0x3e')](_0x4f1917[_0x87a9('0x83')](),{'type':db[_0x87a9('0x82')][_0x87a9('0x84')][_0x87a9('0x85')]})[_0x87a9('0x1d')](function(_0x41efd7){if(_0x41efd7[_0x87a9('0x42')]===0x1){return _0x4f94b2['id'];}else{var _0x3991a1=_['every'](_[_0x87a9('0x3a')](_0x41efd7,_0x87a9('0x86')),function(_0x1334a6){return _[_0x87a9('0x87')](_0x316a9b,_0x1334a6);});if(_0x3991a1){return _0x4f94b2['id'];}}}));}}return BPromise[_0x87a9('0x88')](_0x1cd9e)['then'](function(_0x15a419){_0x173226=_(_0x173226)[_0x87a9('0x89')](_0x15a419)['compact']()['value']();return db[_0x87a9('0x3b')][_0x87a9('0x55')]({'where':{'id':_0x4c1236[_0x87a9('0x53')]['id']}})[_0x87a9('0x1d')](function(_0x2060d1){return db['sequelize'][_0x87a9('0x73')](function(_0x10dce9){return _0x2060d1[_0x87a9('0x78')](_0x4c1236[_0x87a9('0x3e')][_0x87a9('0x6e')],{'transaction':_0x10dce9})['then'](function(){if(!_[_0x87a9('0x8a')](_0x173226)){return _0x2060d1[_0x87a9('0x8b')](_0x173226,{'transaction':_0x10dce9});}})[_0x87a9('0x1d')](function(){_0x173226[_0x87a9('0x75')](function(_0x378e62){socket[_0x87a9('0x76')](_0x87a9('0x8c'),{'UserId':_0x378e62,'ChatQueueId':_0x2060d1['id']});});});});});});})[_0x87a9('0x1d')](respondWithStatusCode(_0x4760e8,null))[_0x87a9('0x27')](handleError(_0x4760e8,null));};exports['addAgents']=function(_0x4fd73d,_0x1c1671,_0x5acba){return db[_0x87a9('0x3b')][_0x87a9('0x55')]({'where':{'id':_0x4fd73d['params']['id']}})[_0x87a9('0x1d')](handleEntityNotFound(_0x1c1671,null))['then'](function(_0x384fc0){if(_0x384fc0){return _0x384fc0[_0x87a9('0x8d')](_0x4fd73d[_0x87a9('0x57')][_0x87a9('0x6e')],_[_0x87a9('0x8e')](_0x4fd73d[_0x87a9('0x57')],['ids','id'])||{})[_0x87a9('0x8f')](function(_0x3836a5){for(var _0x15440f=0x0;_0x15440f<_0x4fd73d[_0x87a9('0x57')][_0x87a9('0x6e')][_0x87a9('0x42')];_0x15440f+=0x1){socket[_0x87a9('0x76')]('userChatQueue:save',{'UserId':Number(_0x4fd73d[_0x87a9('0x57')][_0x87a9('0x6e')][_0x15440f]),'ChatQueueId':Number(_0x4fd73d['params']['id'])});}return _0x3836a5;});}})[_0x87a9('0x1d')](respondWithResult(_0x1c1671,null))[_0x87a9('0x27')](handleError(_0x1c1671,null));};exports['removeAgents']=function(_0x4b7d4c,_0x3e8f84,_0x2b3653){return db[_0x87a9('0x3b')]['find']({'where':{'id':_0x4b7d4c['params']['id']}})[_0x87a9('0x1d')](handleEntityNotFound(_0x3e8f84,null))[_0x87a9('0x1d')](function(_0x161475){if(_0x161475){return _0x161475[_0x87a9('0x8b')](_0x4b7d4c[_0x87a9('0x3e')][_0x87a9('0x6e')])[_0x87a9('0x1d')](function(){if(_[_0x87a9('0x90')](_0x4b7d4c['query'][_0x87a9('0x6e')])){for(var _0x2a06d4=0x0;_0x2a06d4<_0x4b7d4c[_0x87a9('0x3e')][_0x87a9('0x6e')][_0x87a9('0x42')];_0x2a06d4+=0x1){socket[_0x87a9('0x76')](_0x87a9('0x8c'),{'UserId':Number(_0x4b7d4c[_0x87a9('0x3e')][_0x87a9('0x6e')][_0x2a06d4]),'ChatQueueId':Number(_0x4b7d4c['params']['id'])});}}else{socket[_0x87a9('0x76')](_0x87a9('0x8c'),{'UserId':Number(_0x4b7d4c[_0x87a9('0x3e')][_0x87a9('0x6e')]),'ChatQueueId':Number(_0x4b7d4c[_0x87a9('0x53')]['id'])});}});}})[_0x87a9('0x1d')](respondWithStatusCode(_0x3e8f84,null))[_0x87a9('0x27')](handleError(_0x3e8f84,null));};exports[_0x87a9('0x91')]=function(_0x6f37a7,_0x3160c1,_0x1936d4){var _0xf809dd={};var _0x1bb1b6={};var _0x5e9815;var _0x40b1c7;return db[_0x87a9('0x3b')][_0x87a9('0x62')]({'where':{'id':_0x6f37a7[_0x87a9('0x53')]['id']}})[_0x87a9('0x1d')](handleEntityNotFound(_0x3160c1,null))[_0x87a9('0x1d')](function(_0x3a573e){if(_0x3a573e){_0x5e9815=_0x3a573e;_0x1bb1b6[_0x87a9('0x3f')]=_[_0x87a9('0x3d')](db[_0x87a9('0x6f')][_0x87a9('0x3c')]);_0x1bb1b6[_0x87a9('0x3e')]=_[_0x87a9('0x3d')](_0x6f37a7['query']);_0x1bb1b6[_0x87a9('0x48')]=_[_0x87a9('0x54')](_0x1bb1b6[_0x87a9('0x3f')],_0x1bb1b6[_0x87a9('0x3e')]);_0xf809dd[_0x87a9('0x40')]=_['intersection'](_0x1bb1b6[_0x87a9('0x3f')],qs['fields'](_0x6f37a7[_0x87a9('0x3e')][_0x87a9('0x41')]));_0xf809dd[_0x87a9('0x40')]=_0xf809dd[_0x87a9('0x40')][_0x87a9('0x42')]?_0xf809dd[_0x87a9('0x40')]:_0x1bb1b6[_0x87a9('0x3f')];_0xf809dd[_0x87a9('0x45')]=qs['sort'](_0x6f37a7[_0x87a9('0x3e')][_0x87a9('0x46')]);_0xf809dd[_0x87a9('0x47')]=qs[_0x87a9('0x48')](_['pick'](_0x6f37a7[_0x87a9('0x3e')],_0x1bb1b6[_0x87a9('0x48')]));if(_0x6f37a7[_0x87a9('0x3e')]['filter']){_0xf809dd[_0x87a9('0x47')]=_['merge'](_0xf809dd['where'],{'$or':_[_0x87a9('0x3a')](_0xf809dd[_0x87a9('0x40')],function(_0x324e01){var _0x529406={};_0x529406[_0x324e01]={'$like':'%'+_0x6f37a7[_0x87a9('0x3e')][_0x87a9('0x4a')]+'%'};return _0x529406;})});}_0xf809dd=_[_0x87a9('0x4b')]({},_0xf809dd,_0x6f37a7['options']);return _0x5e9815['getAgents'](_0xf809dd);}})[_0x87a9('0x1d')](function(_0x1c0a25){if(_0x1c0a25){_0x40b1c7=_0x1c0a25[_0x87a9('0x42')];if(!_0x6f37a7[_0x87a9('0x3e')][_0x87a9('0x43')](_0x87a9('0x44'))){_0xf809dd[_0x87a9('0x2d')]=qs[_0x87a9('0x2d')](_0x6f37a7[_0x87a9('0x3e')]['limit']);_0xf809dd[_0x87a9('0x2e')]=qs[_0x87a9('0x2e')](_0x6f37a7['query'][_0x87a9('0x2e')]);}return _0x5e9815[_0x87a9('0x91')](_0xf809dd);}})['then'](function(_0x5896b1){if(_0x5896b1){return _0x5896b1?{'count':_0x40b1c7,'rows':_0x5896b1}:null;}})[_0x87a9('0x1d')](respondWithResult(_0x3160c1,null))[_0x87a9('0x27')](handleError(_0x3160c1,null));}; \ No newline at end of file +var _0x6fdf=['getTeams','Team','addTeams','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','ids','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','ChatQueue','includeAll','include','findAll','rows','show','params','options','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','hasOwnProperty','pick','ChatQueueId','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause'];(function(_0x27ed98,_0x39a628){var _0x173b64=function(_0x1fd6e2){while(--_0x1fd6e2){_0x27ed98['push'](_0x27ed98['shift']());}};_0x173b64(++_0x39a628);}(_0x6fdf,0x168));var _0xf6fd=function(_0x59c1b6,_0x5552c8){_0x59c1b6=_0x59c1b6-0x0;var _0x58d7e8=_0x6fdf[_0x59c1b6];return _0x58d7e8;};'use strict';var emlformat=require(_0xf6fd('0x0'));var rimraf=require(_0xf6fd('0x1'));var zipdir=require(_0xf6fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6fd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf6fd('0x4'));var util=require(_0xf6fd('0x5'));var path=require(_0xf6fd('0x6'));var sox=require(_0xf6fd('0x7'));var csv=require(_0xf6fd('0x8'));var ejs=require(_0xf6fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6fd('0xa'));var squel=require('squel');var crypto=require(_0xf6fd('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6fd('0x8'));var querystring=require(_0xf6fd('0xc'));var Papa=require(_0xf6fd('0xd'));var Redis=require('ioredis');var authService=require(_0xf6fd('0xe'));var qs=require(_0xf6fd('0xf'));var as=require(_0xf6fd('0x10'));var hardwareService=require(_0xf6fd('0x11'));var logger=require(_0xf6fd('0x12'))(_0xf6fd('0x13'));var utils=require(_0xf6fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf6fd('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf6fd('0x16')](config[_0xf6fd('0x17')],{'host':_0xf6fd('0x18'),'port':0x18eb});var socket=require(_0xf6fd('0x19'))(new Redis(config[_0xf6fd('0x17')]));require(_0xf6fd('0x1a'))[_0xf6fd('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf6fd('0x1c')][_0xf6fd('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x29b86c,_0x2488a0,_0x45683a,_0x21aaca){return new BPromise(function(_0x5b36e0,_0x554fff){var _0x3629e3=_0x21aaca||client;return _0x3629e3[_0xf6fd('0x1e')](_0x29b86c,_0x45683a)[_0xf6fd('0x1f')](function(_0x3e849c){logger['info']('ChatQueue,\x20%s,\x20%s',_0x2488a0,_0xf6fd('0x20'));logger[_0xf6fd('0x21')](_0xf6fd('0x22'),_0x2488a0,'request\x20sent',JSON[_0xf6fd('0x23')](_0x3e849c));if(_0x3e849c[_0xf6fd('0x24')]){if(_0x3e849c[_0xf6fd('0x24')][_0xf6fd('0x25')]===0x1f4){logger[_0xf6fd('0x24')](_0xf6fd('0x26'),_0x2488a0,_0x3e849c[_0xf6fd('0x24')][_0xf6fd('0x27')]);return _0x554fff(_0x3e849c['error'][_0xf6fd('0x27')]);}logger[_0xf6fd('0x24')](_0xf6fd('0x26'),_0x2488a0,_0x3e849c[_0xf6fd('0x24')][_0xf6fd('0x27')]);return _0x5b36e0(_0x3e849c[_0xf6fd('0x24')][_0xf6fd('0x27')]);}else{logger[_0xf6fd('0x28')](_0xf6fd('0x26'),_0x2488a0,_0xf6fd('0x20'));_0x5b36e0(_0x3e849c[_0xf6fd('0x29')][_0xf6fd('0x27')]);}})[_0xf6fd('0x2a')](function(_0x4d440e){logger[_0xf6fd('0x24')](_0xf6fd('0x26'),_0x2488a0,_0x4d440e);_0x554fff(_0x4d440e);});});}function respondWithStatusCode(_0x576fa0,_0x304575){_0x304575=_0x304575||0xcc;return function(_0x34f92c){if(_0x34f92c){return _0x576fa0[_0xf6fd('0x2b')](_0x304575);}return _0x576fa0[_0xf6fd('0x2c')](_0x304575)[_0xf6fd('0x2d')]();};}function respondWithResult(_0x168ae8,_0x53a855){_0x53a855=_0x53a855||0xc8;return function(_0x729342){if(_0x729342){return _0x168ae8[_0xf6fd('0x2c')](_0x53a855)[_0xf6fd('0x2e')](_0x729342);}};}function respondWithFilteredResult(_0x2c0658,_0x565569){return function(_0x400b7a){if(_0x400b7a){var _0x267725=typeof _0x565569[_0xf6fd('0x2f')]==='undefined'&&typeof _0x565569[_0xf6fd('0x30')]===_0xf6fd('0x31');var _0x4605d2=_0x400b7a[_0xf6fd('0x32')];var _0x268487=_0x267725?0x0:_0x565569[_0xf6fd('0x2f')];var _0x2d874f=_0x267725?_0x400b7a[_0xf6fd('0x32')]:_0x565569[_0xf6fd('0x2f')]+_0x565569[_0xf6fd('0x30')];var _0x42e6d6;if(_0x2d874f>=_0x4605d2){_0x2d874f=_0x4605d2;_0x42e6d6=0xc8;}else{_0x42e6d6=0xce;}_0x2c0658[_0xf6fd('0x2c')](_0x42e6d6);return _0x2c0658[_0xf6fd('0x33')](_0xf6fd('0x34'),_0x268487+'-'+_0x2d874f+'/'+_0x4605d2)['json'](_0x400b7a);}return null;};}function patchUpdates(_0x4162eb){return function(_0x2f2df5){try{jsonpatch[_0xf6fd('0x35')](_0x2f2df5,_0x4162eb,!![]);}catch(_0x4a2c51){return BPromise[_0xf6fd('0x36')](_0x4a2c51);}return _0x2f2df5[_0xf6fd('0x37')]();};}function saveUpdates(_0x1db0cf,_0x444e94){return function(_0x3fa6a6){if(_0x3fa6a6){return _0x3fa6a6[_0xf6fd('0x38')](_0x1db0cf)[_0xf6fd('0x1f')](function(_0x446621){return _0x446621;});}return null;};}function removeEntity(_0x31f4d6,_0x26d0d2){return function(_0x59de42){if(_0x59de42){return _0x59de42[_0xf6fd('0x39')]()[_0xf6fd('0x1f')](function(){var _0x1052d7=_0x59de42[_0xf6fd('0x3a')]({'plain':!![]});var _0x1c33cf=_0xf6fd('0x3b');return db[_0xf6fd('0x3c')][_0xf6fd('0x39')]({'where':{'type':_0x1c33cf,'resourceId':_0x1052d7['id']}})[_0xf6fd('0x1f')](function(){return _0x59de42;});})[_0xf6fd('0x1f')](function(){_0x31f4d6[_0xf6fd('0x2c')](0xcc)[_0xf6fd('0x2d')]();});}};}function handleEntityNotFound(_0x42c86d,_0x395abc){return function(_0x2baacc){if(!_0x2baacc){_0x42c86d[_0xf6fd('0x2b')](0x194);}return _0x2baacc;};}function handleError(_0x52ffd1,_0x38a3f6){_0x38a3f6=_0x38a3f6||0x1f4;return function(_0x659b14){logger['error'](_0x659b14['stack']);if(_0x659b14[_0xf6fd('0x3d')]){delete _0x659b14[_0xf6fd('0x3d')];}_0x52ffd1['status'](_0x38a3f6)[_0xf6fd('0x3e')](_0x659b14);};}exports[_0xf6fd('0x3f')]=function(_0x4a0d91,_0x59bb9b){var _0x27d5bc={},_0x41e22c={},_0x576bcf={'count':0x0,'rows':[]};var _0x24e0dd=_[_0xf6fd('0x40')](db['ChatQueue'][_0xf6fd('0x41')],function(_0x34795a){return{'name':_0x34795a[_0xf6fd('0x42')],'type':_0x34795a[_0xf6fd('0x43')][_0xf6fd('0x44')]};});_0x41e22c[_0xf6fd('0x45')]=_[_0xf6fd('0x40')](_0x24e0dd,_0xf6fd('0x3d'));_0x41e22c[_0xf6fd('0x46')]=_[_0xf6fd('0x47')](_0x4a0d91[_0xf6fd('0x46')]);_0x41e22c[_0xf6fd('0x48')]=_[_0xf6fd('0x49')](_0x41e22c[_0xf6fd('0x45')],_0x41e22c[_0xf6fd('0x46')]);_0x27d5bc[_0xf6fd('0x4a')]=_[_0xf6fd('0x49')](_0x41e22c[_0xf6fd('0x45')],qs[_0xf6fd('0x4b')](_0x4a0d91[_0xf6fd('0x46')][_0xf6fd('0x4b')]));_0x27d5bc['attributes']=_0x27d5bc[_0xf6fd('0x4a')][_0xf6fd('0x4c')]?_0x27d5bc[_0xf6fd('0x4a')]:_0x41e22c[_0xf6fd('0x45')];if(!_0x4a0d91[_0xf6fd('0x46')]['hasOwnProperty'](_0xf6fd('0x4d'))){_0x27d5bc[_0xf6fd('0x30')]=qs[_0xf6fd('0x30')](_0x4a0d91['query'][_0xf6fd('0x30')]);_0x27d5bc['offset']=qs[_0xf6fd('0x2f')](_0x4a0d91['query'][_0xf6fd('0x2f')]);}_0x27d5bc[_0xf6fd('0x4e')]=qs[_0xf6fd('0x4f')](_0x4a0d91[_0xf6fd('0x46')][_0xf6fd('0x4f')]);_0x27d5bc[_0xf6fd('0x50')]=qs['filters'](_['pick'](_0x4a0d91[_0xf6fd('0x46')],_0x41e22c[_0xf6fd('0x48')]),_0x24e0dd);if(_0x4a0d91[_0xf6fd('0x46')][_0xf6fd('0x51')]){_0x27d5bc[_0xf6fd('0x50')]=_[_0xf6fd('0x52')](_0x27d5bc[_0xf6fd('0x50')],{'$or':_[_0xf6fd('0x40')](_0x24e0dd,function(_0xeb2998){if(_0xeb2998['type']!=='VIRTUAL'){var _0x3b96a9={};_0x3b96a9[_0xeb2998[_0xf6fd('0x3d')]]={'$like':'%'+_0x4a0d91[_0xf6fd('0x46')][_0xf6fd('0x51')]+'%'};return _0x3b96a9;}})});}_0x27d5bc=_[_0xf6fd('0x52')]({},_0x27d5bc,_0x4a0d91['options']);var _0x3109dc={'where':_0x27d5bc['where']};return db[_0xf6fd('0x53')]['count'](_0x3109dc)[_0xf6fd('0x1f')](function(_0x3be696){_0x576bcf['count']=_0x3be696;if(_0x4a0d91['query'][_0xf6fd('0x54')]){_0x27d5bc[_0xf6fd('0x55')]=[{'all':!![]}];}return db['ChatQueue'][_0xf6fd('0x56')](_0x27d5bc);})[_0xf6fd('0x1f')](function(_0x27ff20){_0x576bcf[_0xf6fd('0x57')]=_0x27ff20;return _0x576bcf;})[_0xf6fd('0x1f')](respondWithFilteredResult(_0x59bb9b,_0x27d5bc))[_0xf6fd('0x2a')](handleError(_0x59bb9b,null));};exports[_0xf6fd('0x58')]=function(_0x39309b,_0x4ca7e6){var _0x42219b={'raw':!![],'where':{'id':_0x39309b[_0xf6fd('0x59')]['id']}},_0x24dc37={};_0x24dc37[_0xf6fd('0x45')]=_['keys'](db[_0xf6fd('0x53')][_0xf6fd('0x41')]);_0x24dc37[_0xf6fd('0x46')]=_['keys'](_0x39309b['query']);_0x24dc37[_0xf6fd('0x48')]=_[_0xf6fd('0x49')](_0x24dc37[_0xf6fd('0x45')],_0x24dc37[_0xf6fd('0x46')]);_0x42219b[_0xf6fd('0x4a')]=_[_0xf6fd('0x49')](_0x24dc37['model'],qs[_0xf6fd('0x4b')](_0x39309b[_0xf6fd('0x46')][_0xf6fd('0x4b')]));_0x42219b[_0xf6fd('0x4a')]=_0x42219b[_0xf6fd('0x4a')]['length']?_0x42219b[_0xf6fd('0x4a')]:_0x24dc37['model'];if(_0x39309b['query']['includeAll']){_0x42219b['include']=[{'all':!![]}];}_0x42219b=_[_0xf6fd('0x52')]({},_0x42219b,_0x39309b[_0xf6fd('0x5a')]);return db[_0xf6fd('0x53')][_0xf6fd('0x5b')](_0x42219b)[_0xf6fd('0x1f')](handleEntityNotFound(_0x4ca7e6,null))[_0xf6fd('0x1f')](respondWithResult(_0x4ca7e6,null))['catch'](handleError(_0x4ca7e6,null));};exports['create']=function(_0x118518,_0x5c5159){return db[_0xf6fd('0x53')][_0xf6fd('0x5c')](_0x118518[_0xf6fd('0x5d')],{})[_0xf6fd('0x1f')](function(_0x13af1d){var _0x370d0a=_0x118518['user']['get']({'plain':!![]});if(!_0x370d0a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x370d0a[_0xf6fd('0x5e')]===_0xf6fd('0x5f')){var _0x402eff=_0x13af1d[_0xf6fd('0x3a')]({'plain':!![]});var _0x116dc4='ChatQueues';return db[_0xf6fd('0x60')][_0xf6fd('0x5b')]({'where':{'name':_0x116dc4,'userProfileId':_0x370d0a['userProfileId']},'raw':!![]})['then'](function(_0x178657){if(_0x178657&&_0x178657[_0xf6fd('0x61')]===0x0){return db[_0xf6fd('0x3c')][_0xf6fd('0x5c')]({'name':_0x402eff[_0xf6fd('0x3d')],'resourceId':_0x402eff['id'],'type':_0x178657[_0xf6fd('0x3d')],'sectionId':_0x178657['id']},{})[_0xf6fd('0x1f')](function(){return _0x13af1d;});}else{return _0x13af1d;}})[_0xf6fd('0x2a')](function(_0x3b9e19){logger[_0xf6fd('0x24')](_0xf6fd('0x62'),_0x3b9e19);throw _0x3b9e19;});}return _0x13af1d;})[_0xf6fd('0x1f')](respondWithResult(_0x5c5159,0xc9))[_0xf6fd('0x2a')](handleError(_0x5c5159,null));};exports[_0xf6fd('0x38')]=function(_0x2aae6e,_0x4a5c77){if(_0x2aae6e[_0xf6fd('0x5d')]['id']){delete _0x2aae6e[_0xf6fd('0x5d')]['id'];}return db[_0xf6fd('0x53')][_0xf6fd('0x5b')]({'where':{'id':_0x2aae6e[_0xf6fd('0x59')]['id']}})[_0xf6fd('0x1f')](handleEntityNotFound(_0x4a5c77,null))[_0xf6fd('0x1f')](saveUpdates(_0x2aae6e[_0xf6fd('0x5d')],null))[_0xf6fd('0x1f')](respondWithResult(_0x4a5c77,null))['catch'](handleError(_0x4a5c77,null));};exports[_0xf6fd('0x39')]=function(_0x1cb996,_0x20614e){return db['ChatQueue'][_0xf6fd('0x5b')]({'where':{'id':_0x1cb996['params']['id']}})[_0xf6fd('0x1f')](handleEntityNotFound(_0x20614e,null))[_0xf6fd('0x1f')](removeEntity(_0x20614e,null))[_0xf6fd('0x2a')](handleError(_0x20614e,null));};exports[_0xf6fd('0x63')]=function(_0x164942,_0x3235c1){return db[_0xf6fd('0x53')]['describe']()['then'](respondWithResult(_0x3235c1,null))[_0xf6fd('0x2a')](handleError(_0x3235c1,null));};exports['getMembers']=function(_0xac6455,_0x424403,_0xfed96c){var _0x2f3363={'raw':!![],'where':{}},_0x57def6={},_0x2c0a95;return db[_0xf6fd('0x53')][_0xf6fd('0x64')]({'where':{'id':_0xac6455[_0xf6fd('0x59')]['id']}})[_0xf6fd('0x1f')](handleEntityNotFound(_0x424403,null))['then'](function(_0x3c67c6){if(_0x3c67c6){_0x2c0a95=_0x3c67c6[_0xf6fd('0x3a')]({'plain':!![]});_0x57def6[_0xf6fd('0x45')]=_[_0xf6fd('0x47')](db[_0xf6fd('0x65')]['rawAttributes']);_0x57def6['query']=_[_0xf6fd('0x47')](_0xac6455[_0xf6fd('0x46')]);_0x57def6[_0xf6fd('0x48')]=_[_0xf6fd('0x49')](_0x57def6[_0xf6fd('0x45')],_0x57def6[_0xf6fd('0x46')]);_0x2f3363[_0xf6fd('0x4a')]=_[_0xf6fd('0x49')](_0x57def6['model'],qs['fields'](_0xac6455[_0xf6fd('0x46')][_0xf6fd('0x4b')]));_0x2f3363[_0xf6fd('0x4a')]=_0x2f3363[_0xf6fd('0x4a')]['length']?_0x2f3363['attributes']:_0x57def6[_0xf6fd('0x45')];if(!_0xac6455[_0xf6fd('0x46')][_0xf6fd('0x66')]('nolimit')){_0x2f3363['limit']=qs[_0xf6fd('0x30')](_0xac6455[_0xf6fd('0x46')]['limit']);_0x2f3363['offset']=qs['offset'](_0xac6455['query'][_0xf6fd('0x2f')]);}_0x2f3363[_0xf6fd('0x4e')]=qs[_0xf6fd('0x4f')](_0xac6455['query'][_0xf6fd('0x4f')]);_0x2f3363[_0xf6fd('0x50')]=qs[_0xf6fd('0x48')](_[_0xf6fd('0x67')](_0xac6455[_0xf6fd('0x46')],_0x57def6[_0xf6fd('0x48')]));_0x2f3363['where'][_0xf6fd('0x68')]=_0x3c67c6['id'];if(_0xac6455[_0xf6fd('0x46')]['filter']){_0x2f3363[_0xf6fd('0x50')]=_[_0xf6fd('0x52')](_0x2f3363['where'],{'$or':_[_0xf6fd('0x40')](_0x2f3363[_0xf6fd('0x4a')],function(_0x2f6143){var _0x49f640={};_0x49f640[_0x2f6143]={'$like':'%'+_0xac6455[_0xf6fd('0x46')][_0xf6fd('0x51')]+'%'};return _0x49f640;})});}_0x2f3363=_[_0xf6fd('0x52')]({},_0x2f3363,_0xac6455[_0xf6fd('0x5a')]);return db[_0xf6fd('0x65')][_0xf6fd('0x56')](_0x2f3363);}})[_0xf6fd('0x1f')](function(_0x574151){if(_0x574151){return db[_0xf6fd('0x69')]['findAndCountAll']({'where':{'id':_['map'](_0x574151,_0xf6fd('0x6a')),'role':_0xf6fd('0x6b')},'attributes':['id',_0xf6fd('0x3d'),'chatPause',_0xf6fd('0x6c'),_0xf6fd('0x6d')]});}})[_0xf6fd('0x1f')](function(_0x5a669d){if(_0x5a669d){return{'count':_0x5a669d['count'],'rows':_[_0xf6fd('0x40')](_0x5a669d[_0xf6fd('0x57')],function(_0x36cfde){return{'membername':_0x36cfde[_0xf6fd('0x3d')],'UserId':_0x36cfde['id'],'queue_name':_0x2c0a95[_0xf6fd('0x3d')],'ChatQueueId':_0x2c0a95['id'],'interface':util[_0xf6fd('0x6e')](_0xf6fd('0x6f'),_0xf6fd('0x70'),_0x36cfde[_0xf6fd('0x3d')]),'penalty':0x0,'paused':_0x36cfde[_0xf6fd('0x71')],'createdAt':_0x36cfde[_0xf6fd('0x6d')],'updatedAt':_0x36cfde[_0xf6fd('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf6fd('0x1f')](respondWithFilteredResult(_0x424403,_0x2f3363))['catch'](handleError(_0x424403,null));};exports[_0xf6fd('0x72')]=function(_0x1e5f1c,_0x2efe76,_0x2c8a85){var _0x3e54f9={};var _0x31c73b={};var _0x47ebc9;var _0x2400ec;return db['ChatQueue'][_0xf6fd('0x64')]({'where':{'id':_0x1e5f1c[_0xf6fd('0x59')]['id']}})['then'](handleEntityNotFound(_0x2efe76,null))['then'](function(_0x22328a){if(_0x22328a){_0x47ebc9=_0x22328a;_0x31c73b[_0xf6fd('0x45')]=_[_0xf6fd('0x47')](db[_0xf6fd('0x73')][_0xf6fd('0x41')]);_0x31c73b['query']=_[_0xf6fd('0x47')](_0x1e5f1c[_0xf6fd('0x46')]);_0x31c73b['filters']=_[_0xf6fd('0x49')](_0x31c73b['model'],_0x31c73b[_0xf6fd('0x46')]);_0x3e54f9['attributes']=_[_0xf6fd('0x49')](_0x31c73b['model'],qs['fields'](_0x1e5f1c[_0xf6fd('0x46')][_0xf6fd('0x4b')]));_0x3e54f9[_0xf6fd('0x4a')]=_0x3e54f9[_0xf6fd('0x4a')][_0xf6fd('0x4c')]?_0x3e54f9[_0xf6fd('0x4a')]:_0x31c73b['model'];_0x3e54f9[_0xf6fd('0x4e')]=qs['sort'](_0x1e5f1c[_0xf6fd('0x46')][_0xf6fd('0x4f')]);_0x3e54f9['where']=qs[_0xf6fd('0x48')](_[_0xf6fd('0x67')](_0x1e5f1c[_0xf6fd('0x46')],_0x31c73b[_0xf6fd('0x48')]));if(_0x1e5f1c[_0xf6fd('0x46')]['filter']){_0x3e54f9[_0xf6fd('0x50')]=_[_0xf6fd('0x52')](_0x3e54f9['where'],{'$or':_['map'](_0x3e54f9[_0xf6fd('0x4a')],function(_0x3872a1){var _0x365e51={};_0x365e51[_0x3872a1]={'$like':'%'+_0x1e5f1c['query'][_0xf6fd('0x51')]+'%'};return _0x365e51;})});}_0x3e54f9=_['merge']({},_0x3e54f9,_0x1e5f1c[_0xf6fd('0x5a')]);return _0x47ebc9['getTeams'](_0x3e54f9);}})['then'](function(_0x4a7a8f){if(_0x4a7a8f){_0x2400ec=_0x4a7a8f[_0xf6fd('0x4c')];if(!_0x1e5f1c[_0xf6fd('0x46')]['hasOwnProperty'](_0xf6fd('0x4d'))){_0x3e54f9[_0xf6fd('0x30')]=qs['limit'](_0x1e5f1c[_0xf6fd('0x46')][_0xf6fd('0x30')]);_0x3e54f9[_0xf6fd('0x2f')]=qs[_0xf6fd('0x2f')](_0x1e5f1c[_0xf6fd('0x46')][_0xf6fd('0x2f')]);}return _0x47ebc9[_0xf6fd('0x72')](_0x3e54f9);}})[_0xf6fd('0x1f')](function(_0x2b69bd){if(_0x2b69bd){return _0x2b69bd?{'count':_0x2400ec,'rows':_0x2b69bd}:null;}})['then'](respondWithResult(_0x2efe76,null))['catch'](handleError(_0x2efe76,null));};exports[_0xf6fd('0x74')]=function(_0xe5744,_0x4e474a,_0x376155){var _0x3d1f51=_0xe5744[_0xf6fd('0x5d')]['ids'];return db[_0xf6fd('0x73')][_0xf6fd('0x56')]({'where':{'id':_0x3d1f51},'attributes':['id'],'include':[{'model':db[_0xf6fd('0x69')],'as':_0xf6fd('0x75'),'attributes':['id',_0xf6fd('0x3d'),'online',_0xf6fd('0x76'),_0xf6fd('0x77')],'raw':!![]}]})[_0xf6fd('0x1f')](function(_0x5843be){if(_0x5843be){var _0x451abb=_[_0xf6fd('0x78')](_0x5843be,function(_0x33dc57){var _0x21c605=_0x33dc57[_0xf6fd('0x3a')]({'plain':!![]});return _0x21c605[_0xf6fd('0x75')];});return db['ChatQueue'][_0xf6fd('0x5b')]({'where':{'id':_0xe5744[_0xf6fd('0x59')]['id']}})[_0xf6fd('0x1f')](function(_0x3cb3bf){return db[_0xf6fd('0x79')]['transaction'](function(_0xfb92d0){return _0x3cb3bf[_0xf6fd('0x74')](_0x3d1f51,{'transaction':_0xfb92d0})[_0xf6fd('0x1f')](function(){return BPromise[_0xf6fd('0x7a')](_0x451abb,function(_0x15c80e){return db[_0xf6fd('0x65')][_0xf6fd('0x7b')]({'where':{'UserId':_0x15c80e['id'],'ChatQueueId':_0xe5744[_0xf6fd('0x59')]['id']},'transaction':_0xfb92d0});});})[_0xf6fd('0x1f')](function(){_0x451abb['forEach'](function(_0x46575d){socket[_0xf6fd('0x7c')](_0xf6fd('0x7d'),{'UserId':_0x46575d['id'],'ChatQueueId':_0x3cb3bf['id']});});});});});}})[_0xf6fd('0x1f')](respondWithStatusCode(_0x4e474a,null))['catch'](handleError(_0x4e474a,null));};exports[_0xf6fd('0x7e')]=function(_0x2cd993,_0x9e585a,_0xddd008){return db[_0xf6fd('0x73')][_0xf6fd('0x56')]({'where':{'id':_0x2cd993[_0xf6fd('0x46')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf6fd('0x69')],'as':_0xf6fd('0x75'),'attributes':['id'],'raw':!![]}]})[_0xf6fd('0x1f')](handleEntityNotFound(_0x9e585a,null))['then'](function(_0x248728){var _0x3b5640=_[_0xf6fd('0x40')](_0x248728,'id');var _0x1eaccd=[];var _0x16175a=[];var _0x5dd918=squel[_0xf6fd('0x7f')]();_0x5dd918[_0xf6fd('0x80')](_0xf6fd('0x81'))[_0xf6fd('0x82')](_0xf6fd('0x83'),'tq')[_0xf6fd('0x84')](_0xf6fd('0x85'),'ut',_0xf6fd('0x86'))[_0xf6fd('0x50')](_0xf6fd('0x87'),_0x2cd993['params']['id']);for(var _0x39e822=0x0;_0x39e822<_0x248728[_0xf6fd('0x4c')];_0x39e822+=0x1){let _0x26cdd0=_0x248728[_0x39e822];for(var _0x10b7ed=0x0;_0x10b7ed<_0x26cdd0[_0xf6fd('0x75')][_0xf6fd('0x4c')];_0x10b7ed+=0x1){let _0x1ea5db=_0x26cdd0[_0xf6fd('0x75')][_0x10b7ed];var _0x11e6dc=_0x5dd918[_0xf6fd('0x88')]();_0x11e6dc['where'](_0xf6fd('0x89'),_0x1ea5db['id']);_0x16175a[_0xf6fd('0x8a')](db[_0xf6fd('0x79')]['query'](_0x11e6dc[_0xf6fd('0x8b')](),{'type':db[_0xf6fd('0x79')][_0xf6fd('0x8c')][_0xf6fd('0x8d')]})[_0xf6fd('0x1f')](function(_0x16f443){if(_0x16f443['length']===0x1){return _0x1ea5db['id'];}else{var _0x55d827=_[_0xf6fd('0x8e')](_['map'](_0x16f443,_0xf6fd('0x8f')),function(_0x13d7f7){return _[_0xf6fd('0x90')](_0x3b5640,_0x13d7f7);});if(_0x55d827){return _0x1ea5db['id'];}}}));}}return BPromise['all'](_0x16175a)[_0xf6fd('0x1f')](function(_0x4b5010){_0x1eaccd=_(_0x1eaccd)[_0xf6fd('0x91')](_0x4b5010)[_0xf6fd('0x92')]()[_0xf6fd('0x93')]();return db[_0xf6fd('0x53')]['find']({'where':{'id':_0x2cd993[_0xf6fd('0x59')]['id']}})[_0xf6fd('0x1f')](function(_0x8425ea){return db[_0xf6fd('0x79')]['transaction'](function(_0xf0ab9f){return _0x8425ea[_0xf6fd('0x7e')](_0x2cd993[_0xf6fd('0x46')][_0xf6fd('0x94')],{'transaction':_0xf0ab9f})[_0xf6fd('0x1f')](function(){if(!_[_0xf6fd('0x95')](_0x1eaccd)){return _0x8425ea[_0xf6fd('0x96')](_0x1eaccd,{'transaction':_0xf0ab9f});}})[_0xf6fd('0x1f')](function(){_0x1eaccd[_0xf6fd('0x97')](function(_0x1e670c){socket[_0xf6fd('0x7c')](_0xf6fd('0x98'),{'UserId':_0x1e670c,'ChatQueueId':_0x8425ea['id']});});});});});});})[_0xf6fd('0x1f')](respondWithStatusCode(_0x9e585a,null))['catch'](handleError(_0x9e585a,null));};exports[_0xf6fd('0x99')]=function(_0x4ef386,_0x1af676,_0x2216cd){return db[_0xf6fd('0x53')][_0xf6fd('0x5b')]({'where':{'id':_0x4ef386[_0xf6fd('0x59')]['id']}})[_0xf6fd('0x1f')](handleEntityNotFound(_0x1af676,null))[_0xf6fd('0x1f')](function(_0x4f9c8a){if(_0x4f9c8a){return _0x4f9c8a[_0xf6fd('0x99')](_0x4ef386[_0xf6fd('0x5d')]['ids'],_[_0xf6fd('0x9a')](_0x4ef386[_0xf6fd('0x5d')],[_0xf6fd('0x94'),'id'])||{})[_0xf6fd('0x9b')](function(_0x5d3181){for(var _0x34dac5=0x0;_0x34dac5<_0x4ef386[_0xf6fd('0x5d')][_0xf6fd('0x94')][_0xf6fd('0x4c')];_0x34dac5+=0x1){socket[_0xf6fd('0x7c')]('userChatQueue:save',{'UserId':Number(_0x4ef386[_0xf6fd('0x5d')][_0xf6fd('0x94')][_0x34dac5]),'ChatQueueId':Number(_0x4ef386[_0xf6fd('0x59')]['id'])});}return _0x5d3181;});}})['then'](respondWithResult(_0x1af676,null))[_0xf6fd('0x2a')](handleError(_0x1af676,null));};exports[_0xf6fd('0x96')]=function(_0xdc2659,_0x72569e,_0x3c5273){return db['ChatQueue'][_0xf6fd('0x5b')]({'where':{'id':_0xdc2659[_0xf6fd('0x59')]['id']}})['then'](handleEntityNotFound(_0x72569e,null))['then'](function(_0x100e0a){if(_0x100e0a){return _0x100e0a[_0xf6fd('0x96')](_0xdc2659['query']['ids'])[_0xf6fd('0x1f')](function(){if(_[_0xf6fd('0x9c')](_0xdc2659[_0xf6fd('0x46')][_0xf6fd('0x94')])){for(var _0x2a072d=0x0;_0x2a072d<_0xdc2659[_0xf6fd('0x46')][_0xf6fd('0x94')][_0xf6fd('0x4c')];_0x2a072d+=0x1){socket[_0xf6fd('0x7c')]('userChatQueue:remove',{'UserId':Number(_0xdc2659[_0xf6fd('0x46')]['ids'][_0x2a072d]),'ChatQueueId':Number(_0xdc2659[_0xf6fd('0x59')]['id'])});}}else{socket[_0xf6fd('0x7c')](_0xf6fd('0x98'),{'UserId':Number(_0xdc2659[_0xf6fd('0x46')][_0xf6fd('0x94')]),'ChatQueueId':Number(_0xdc2659['params']['id'])});}});}})[_0xf6fd('0x1f')](respondWithStatusCode(_0x72569e,null))['catch'](handleError(_0x72569e,null));};exports[_0xf6fd('0x9d')]=function(_0x2d5135,_0x5cc35d,_0x14da98){var _0x2317a2={};var _0x48f21e={};var _0x6fd3a2;var _0x244c1b;return db[_0xf6fd('0x53')][_0xf6fd('0x64')]({'where':{'id':_0x2d5135[_0xf6fd('0x59')]['id']}})['then'](handleEntityNotFound(_0x5cc35d,null))[_0xf6fd('0x1f')](function(_0x5e3236){if(_0x5e3236){_0x6fd3a2=_0x5e3236;_0x48f21e[_0xf6fd('0x45')]=_[_0xf6fd('0x47')](db[_0xf6fd('0x69')][_0xf6fd('0x41')]);_0x48f21e[_0xf6fd('0x46')]=_[_0xf6fd('0x47')](_0x2d5135[_0xf6fd('0x46')]);_0x48f21e['filters']=_[_0xf6fd('0x49')](_0x48f21e[_0xf6fd('0x45')],_0x48f21e[_0xf6fd('0x46')]);_0x2317a2[_0xf6fd('0x4a')]=_[_0xf6fd('0x49')](_0x48f21e[_0xf6fd('0x45')],qs['fields'](_0x2d5135['query'][_0xf6fd('0x4b')]));_0x2317a2['attributes']=_0x2317a2[_0xf6fd('0x4a')][_0xf6fd('0x4c')]?_0x2317a2['attributes']:_0x48f21e[_0xf6fd('0x45')];_0x2317a2[_0xf6fd('0x4e')]=qs[_0xf6fd('0x4f')](_0x2d5135['query'][_0xf6fd('0x4f')]);_0x2317a2[_0xf6fd('0x50')]=qs[_0xf6fd('0x48')](_[_0xf6fd('0x67')](_0x2d5135[_0xf6fd('0x46')],_0x48f21e[_0xf6fd('0x48')]));if(_0x2d5135[_0xf6fd('0x46')]['filter']){_0x2317a2[_0xf6fd('0x50')]=_[_0xf6fd('0x52')](_0x2317a2['where'],{'$or':_['map'](_0x2317a2[_0xf6fd('0x4a')],function(_0x578897){var _0x1606d8={};_0x1606d8[_0x578897]={'$like':'%'+_0x2d5135[_0xf6fd('0x46')][_0xf6fd('0x51')]+'%'};return _0x1606d8;})});}_0x2317a2=_['merge']({},_0x2317a2,_0x2d5135[_0xf6fd('0x5a')]);return _0x6fd3a2[_0xf6fd('0x9d')](_0x2317a2);}})[_0xf6fd('0x1f')](function(_0x3ff0f5){if(_0x3ff0f5){_0x244c1b=_0x3ff0f5[_0xf6fd('0x4c')];if(!_0x2d5135[_0xf6fd('0x46')]['hasOwnProperty'](_0xf6fd('0x4d'))){_0x2317a2[_0xf6fd('0x30')]=qs['limit'](_0x2d5135[_0xf6fd('0x46')]['limit']);_0x2317a2[_0xf6fd('0x2f')]=qs[_0xf6fd('0x2f')](_0x2d5135[_0xf6fd('0x46')]['offset']);}return _0x6fd3a2[_0xf6fd('0x9d')](_0x2317a2);}})[_0xf6fd('0x1f')](function(_0x23a343){if(_0x23a343){return _0x23a343?{'count':_0x244c1b,'rows':_0x23a343}:null;}})['then'](respondWithResult(_0x5cc35d,null))[_0xf6fd('0x2a')](handleError(_0x5cc35d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1e110ba..1654c3f 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 _0x7b3a=['events','ChatQueue','save','emit','hasOwnProperty','hook','exports'];(function(_0x31fb11,_0x4ddc04){var _0x2cda78=function(_0x835a04){while(--_0x835a04){_0x31fb11['push'](_0x31fb11['shift']());}};_0x2cda78(++_0x4ddc04);}(_0x7b3a,0x93));var _0xa7b3=function(_0x43120a,_0x534db4){_0x43120a=_0x43120a-0x0;var _0x547155=_0x7b3a[_0x43120a];return _0x547155;};'use strict';var EventEmitter=require(_0xa7b3('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xa7b3('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa7b3('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49f6f4){return function(_0x28af8b,_0x444e13,_0x16cc6a){ChatQueueEvents[_0xa7b3('0x3')](_0x49f6f4+':'+_0x28af8b['id'],_0x28af8b);ChatQueueEvents['emit'](_0x49f6f4,_0x28af8b);_0x16cc6a(null);};}for(var e in events){if(events[_0xa7b3('0x4')](e)){var event=events[e];ChatQueue[_0xa7b3('0x5')](e,emitEvent(event));}}module[_0xa7b3('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x195d=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x16daee,_0xaf8850){var _0x436115=function(_0x2ba0d9){while(--_0x2ba0d9){_0x16daee['push'](_0x16daee['shift']());}};_0x436115(++_0xaf8850);}(_0x195d,0x100));var _0xd195=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0x195d[_0x187279];return _0x3da59d;};'use strict';var EventEmitter=require(_0xd195('0x0'));var ChatQueue=require(_0xd195('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd195('0x2')](0x0);var events={'afterCreate':_0xd195('0x3'),'afterUpdate':_0xd195('0x4'),'afterDestroy':_0xd195('0x5')};function emitEvent(_0x1a83ef){return function(_0x110089,_0x4221e8,_0x11ee49){ChatQueueEvents['emit'](_0x1a83ef+':'+_0x110089['id'],_0x110089);ChatQueueEvents[_0xd195('0x6')](_0x1a83ef,_0x110089);_0x11ee49(null);};}for(var e in events){if(events[_0xd195('0x7')](e)){var event=events[e];ChatQueue[_0xd195('0x8')](e,emitEvent(event));}}module[_0xd195('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 563831d..0bb118a 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 _0xafd8=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','ChatQueue','chat_queues','lodash'];(function(_0x9ea913,_0x3b0dba){var _0x4cfd1a=function(_0x130d13){while(--_0x130d13){_0x9ea913['push'](_0x9ea913['shift']());}};_0x4cfd1a(++_0x3b0dba);}(_0xafd8,0x196));var _0x8afd=function(_0x9e6e8c,_0x6ed498){_0x9e6e8c=_0x9e6e8c-0x0;var _0x120e48=_0xafd8[_0x9e6e8c];return _0x120e48;};'use strict';var _=require(_0x8afd('0x0'));var util=require(_0x8afd('0x1'));var logger=require(_0x8afd('0x2'))('api');var moment=require(_0x8afd('0x3'));var BPromise=require(_0x8afd('0x4'));var rp=require(_0x8afd('0x5'));var fs=require('fs');var path=require(_0x8afd('0x6'));var rimraf=require('rimraf');var config=require(_0x8afd('0x7'));var attributes=require('./chatQueue.attributes');module[_0x8afd('0x8')]=function(_0x2642eb,_0x84dcc9){return _0x2642eb['define'](_0x8afd('0x9'),attributes,{'tableName':_0x8afd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcedb=['bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment'];(function(_0xdd5f90,_0x39278f){var _0x1df94d=function(_0x4c51ca){while(--_0x4c51ca){_0xdd5f90['push'](_0xdd5f90['shift']());}};_0x1df94d(++_0x39278f);}(_0xcedb,0x1f4));var _0xbced=function(_0x227e39,_0x482d65){_0x227e39=_0x227e39-0x0;var _0x546c40=_0xcedb[_0x227e39];return _0x546c40;};'use strict';var _=require(_0xbced('0x0'));var util=require(_0xbced('0x1'));var logger=require(_0xbced('0x2'))('api');var moment=require(_0xbced('0x3'));var BPromise=require(_0xbced('0x4'));var rp=require(_0xbced('0x5'));var fs=require('fs');var path=require(_0xbced('0x6'));var rimraf=require('rimraf');var config=require(_0xbced('0x7'));var attributes=require(_0xbced('0x8'));module['exports']=function(_0x2b7665,_0x262c0a){return _0x2b7665[_0xbced('0x9')](_0xbced('0xa'),attributes,{'tableName':_0xbced('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 9dd6f23..2ee00a7 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 _0x316b=['attributes','ShowChatQueue','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','limit','include','map','model'];(function(_0x5baa68,_0x441410){var _0x7dfd49=function(_0x30bc75){while(--_0x30bc75){_0x5baa68['push'](_0x5baa68['shift']());}};_0x7dfd49(++_0x441410);}(_0x316b,0x17e));var _0xb316=function(_0xd8aad0,_0x4da2cd){_0xd8aad0=_0xd8aad0-0x0;var _0x570860=_0x316b[_0xd8aad0];return _0x570860;};'use strict';var _=require(_0xb316('0x0'));var util=require('util');var moment=require(_0xb316('0x1'));var BPromise=require('bluebird');var rs=require(_0xb316('0x2'));var fs=require('fs');var Redis=require(_0xb316('0x3'));var db=require(_0xb316('0x4'))['db'];var utils=require(_0xb316('0x5'));var logger=require(_0xb316('0x6'))(_0xb316('0x7'));var config=require(_0xb316('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb316('0x9')][_0xb316('0xa')]({'port':0x232a});config[_0xb316('0xb')]=_[_0xb316('0xc')](config['redis'],{'host':_0xb316('0xd'),'port':0x18eb});var socket=require(_0xb316('0xe'))(new Redis(config['redis']));require(_0xb316('0xf'))[_0xb316('0x10')](socket);function respondWithRpcPromise(_0x23dda9,_0x337c5c,_0x58d622){return new BPromise(function(_0x1d376c,_0xba6dd6){return client[_0xb316('0x11')](_0x23dda9,_0x58d622)[_0xb316('0x12')](function(_0x7d3df7){logger[_0xb316('0x13')](_0xb316('0x14'),_0x337c5c,_0xb316('0x15'));logger[_0xb316('0x16')](_0xb316('0x17'),_0x337c5c,'request\x20sent',JSON[_0xb316('0x18')](_0x7d3df7));if(_0x7d3df7[_0xb316('0x19')]){if(_0x7d3df7['error'][_0xb316('0x1a')]===0x1f4){logger[_0xb316('0x19')](_0xb316('0x14'),_0x337c5c,_0x7d3df7[_0xb316('0x19')]['message']);return _0xba6dd6(_0x7d3df7[_0xb316('0x19')][_0xb316('0x1b')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x337c5c,_0x7d3df7['error'][_0xb316('0x1b')]);return _0x1d376c(_0x7d3df7['error'][_0xb316('0x1b')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x337c5c,_0xb316('0x15'));_0x1d376c(_0x7d3df7['result']['message']);}})[_0xb316('0x1c')](function(_0x515543){logger['error'](_0xb316('0x14'),_0x337c5c,_0x515543);_0xba6dd6(_0x515543);});});}exports[_0xb316('0x1d')]=function(_0xbbd51a){var _0x4df491=this;return new Promise(function(_0x4b9b83,_0x3f0c08){return db[_0xb316('0x1e')][_0xb316('0x1f')]({'raw':_0xbbd51a[_0xb316('0x20')]?_0xbbd51a[_0xb316('0x20')][_0xb316('0x21')]===undefined?!![]:![]:!![],'where':_0xbbd51a['options']?_0xbbd51a[_0xb316('0x20')]['where']||null:null,'attributes':_0xbbd51a[_0xb316('0x20')]?_0xbbd51a[_0xb316('0x20')]['attributes']||null:null,'limit':_0xbbd51a['options']?_0xbbd51a['options'][_0xb316('0x22')]||null:null,'include':_0xbbd51a['options']?_0xbbd51a[_0xb316('0x20')][_0xb316('0x23')]?_[_0xb316('0x24')](_0xbbd51a[_0xb316('0x20')][_0xb316('0x23')],function(_0x2ddcf8){return{'model':db[_0x2ddcf8[_0xb316('0x25')]],'as':_0x2ddcf8['as'],'attributes':_0x2ddcf8[_0xb316('0x26')],'include':_0x2ddcf8[_0xb316('0x23')]?_[_0xb316('0x24')](_0x2ddcf8['include'],function(_0x152686){return{'model':db[_0x152686['model']],'as':_0x152686['as'],'attributes':_0x152686[_0xb316('0x26')],'include':_0x152686[_0xb316('0x23')]?_[_0xb316('0x24')](_0x152686[_0xb316('0x23')],function(_0x1dc996){return{'model':db[_0x1dc996['model']],'as':_0x1dc996['as'],'attributes':_0x1dc996[_0xb316('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23fe76){logger['info']('GetChatQueue',_0xbbd51a);logger['debug']('GetChatQueue',_0xbbd51a,JSON[_0xb316('0x18')](_0x23fe76));_0x4b9b83(_0x23fe76);})['catch'](function(_0xd51317){logger[_0xb316('0x19')](_0xb316('0x1d'),_0xd51317['message'],_0xbbd51a);_0x3f0c08(_0x4df491['error'](0x1f4,_0xd51317[_0xb316('0x1b')]));});});};exports[_0xb316('0x27')]=function(_0xbea147){var _0xcea573=this;return new Promise(function(_0x46ee17,_0xc41882){return db[_0xb316('0x1e')][_0xb316('0x28')]({'raw':_0xbea147[_0xb316('0x20')]?_0xbea147['options'][_0xb316('0x21')]===undefined?!![]:![]:!![],'where':_0xbea147[_0xb316('0x20')]?_0xbea147['options'][_0xb316('0x29')]||null:null,'attributes':_0xbea147[_0xb316('0x20')]?_0xbea147[_0xb316('0x20')]['attributes']||null:null,'include':_0xbea147[_0xb316('0x20')]?_0xbea147[_0xb316('0x20')][_0xb316('0x23')]?_[_0xb316('0x24')](_0xbea147['options'][_0xb316('0x23')],function(_0x57b51d){return{'model':db[_0x57b51d[_0xb316('0x25')]],'as':_0x57b51d['as'],'attributes':_0x57b51d[_0xb316('0x26')],'include':_0x57b51d['include']?_[_0xb316('0x24')](_0x57b51d['include'],function(_0x44beb7){return{'model':db[_0x44beb7[_0xb316('0x25')]],'as':_0x44beb7['as'],'attributes':_0x44beb7[_0xb316('0x26')],'include':_0x44beb7[_0xb316('0x23')]?_[_0xb316('0x24')](_0x44beb7[_0xb316('0x23')],function(_0x2f7e73){return{'model':db[_0x2f7e73[_0xb316('0x25')]],'as':_0x2f7e73['as'],'attributes':_0x2f7e73[_0xb316('0x26')]};}):[]};}):[]};}):[]:[]})[_0xb316('0x12')](function(_0x30767f){logger[_0xb316('0x13')](_0xb316('0x27'),_0xbea147);logger['debug'](_0xb316('0x27'),_0xbea147,JSON[_0xb316('0x18')](_0x30767f));_0x46ee17(_0x30767f);})[_0xb316('0x1c')](function(_0x599c86){logger[_0xb316('0x19')](_0xb316('0x27'),_0x599c86['message'],_0xbea147);_0xc41882(_0xcea573[_0xb316('0x19')](0x1f4,_0x599c86[_0xb316('0x1b')]));});});}; \ No newline at end of file +var _0x90d0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','findAll','options','raw','attributes','include','map','model','ChatQueue','where','ShowChatQueue','lodash','util','moment','bluebird'];(function(_0x4d9c59,_0x18da2d){var _0x27efbd=function(_0x3c4e77){while(--_0x3c4e77){_0x4d9c59['push'](_0x4d9c59['shift']());}};_0x27efbd(++_0x18da2d);}(_0x90d0,0x10d));var _0x090d=function(_0x425036,_0x39bebc){_0x425036=_0x425036-0x0;var _0x7fc880=_0x90d0[_0x425036];return _0x7fc880;};'use strict';var _=require(_0x090d('0x0'));var util=require(_0x090d('0x1'));var moment=require(_0x090d('0x2'));var BPromise=require(_0x090d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x090d('0x4'));var db=require(_0x090d('0x5'))['db'];var utils=require(_0x090d('0x6'));var logger=require(_0x090d('0x7'))(_0x090d('0x8'));var config=require(_0x090d('0x9'));var jayson=require(_0x090d('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x090d('0xb')]=_[_0x090d('0xc')](config[_0x090d('0xb')],{'host':_0x090d('0xd'),'port':0x18eb});var socket=require(_0x090d('0xe'))(new Redis(config['redis']));require(_0x090d('0xf'))['register'](socket);function respondWithRpcPromise(_0x52b891,_0x28ddfc,_0x53d137){return new BPromise(function(_0x319004,_0x457bd7){return client[_0x090d('0x10')](_0x52b891,_0x53d137)[_0x090d('0x11')](function(_0x1cc889){logger[_0x090d('0x12')](_0x090d('0x13'),_0x28ddfc,_0x090d('0x14'));logger[_0x090d('0x15')](_0x090d('0x16'),_0x28ddfc,_0x090d('0x14'),JSON[_0x090d('0x17')](_0x1cc889));if(_0x1cc889[_0x090d('0x18')]){if(_0x1cc889[_0x090d('0x18')]['code']===0x1f4){logger[_0x090d('0x18')]('ChatQueue,\x20%s,\x20%s',_0x28ddfc,_0x1cc889['error'][_0x090d('0x19')]);return _0x457bd7(_0x1cc889[_0x090d('0x18')][_0x090d('0x19')]);}logger['error'](_0x090d('0x13'),_0x28ddfc,_0x1cc889[_0x090d('0x18')][_0x090d('0x19')]);return _0x319004(_0x1cc889['error'][_0x090d('0x19')]);}else{logger[_0x090d('0x12')](_0x090d('0x13'),_0x28ddfc,'request\x20sent');_0x319004(_0x1cc889[_0x090d('0x1a')][_0x090d('0x19')]);}})[_0x090d('0x1b')](function(_0x218a57){logger['error'](_0x090d('0x13'),_0x28ddfc,_0x218a57);_0x457bd7(_0x218a57);});});}exports[_0x090d('0x1c')]=function(_0x2fe906){var _0x519eee=this;return new Promise(function(_0x230dd3,_0x29f7c4){return db['ChatQueue'][_0x090d('0x1d')]({'raw':_0x2fe906[_0x090d('0x1e')]?_0x2fe906[_0x090d('0x1e')][_0x090d('0x1f')]===undefined?!![]:![]:!![],'where':_0x2fe906[_0x090d('0x1e')]?_0x2fe906[_0x090d('0x1e')]['where']||null:null,'attributes':_0x2fe906[_0x090d('0x1e')]?_0x2fe906[_0x090d('0x1e')][_0x090d('0x20')]||null:null,'limit':_0x2fe906[_0x090d('0x1e')]?_0x2fe906[_0x090d('0x1e')]['limit']||null:null,'include':_0x2fe906['options']?_0x2fe906[_0x090d('0x1e')][_0x090d('0x21')]?_[_0x090d('0x22')](_0x2fe906[_0x090d('0x1e')][_0x090d('0x21')],function(_0x338e95){return{'model':db[_0x338e95[_0x090d('0x23')]],'as':_0x338e95['as'],'attributes':_0x338e95[_0x090d('0x20')],'include':_0x338e95[_0x090d('0x21')]?_[_0x090d('0x22')](_0x338e95[_0x090d('0x21')],function(_0x28bac8){return{'model':db[_0x28bac8[_0x090d('0x23')]],'as':_0x28bac8['as'],'attributes':_0x28bac8['attributes'],'include':_0x28bac8[_0x090d('0x21')]?_[_0x090d('0x22')](_0x28bac8[_0x090d('0x21')],function(_0x509198){return{'model':db[_0x509198['model']],'as':_0x509198['as'],'attributes':_0x509198['attributes']};}):[]};}):[]};}):[]:[]})[_0x090d('0x11')](function(_0x48c9ec){logger[_0x090d('0x12')](_0x090d('0x1c'),_0x2fe906);logger[_0x090d('0x15')](_0x090d('0x1c'),_0x2fe906,JSON[_0x090d('0x17')](_0x48c9ec));_0x230dd3(_0x48c9ec);})['catch'](function(_0x10dbc7){logger['error']('GetChatQueue',_0x10dbc7[_0x090d('0x19')],_0x2fe906);_0x29f7c4(_0x519eee['error'](0x1f4,_0x10dbc7['message']));});});};exports['ShowChatQueue']=function(_0x2b8e21){var _0x58c0e2=this;return new Promise(function(_0x35bbb0,_0xe14ce9){return db[_0x090d('0x24')]['find']({'raw':_0x2b8e21[_0x090d('0x1e')]?_0x2b8e21[_0x090d('0x1e')][_0x090d('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b8e21[_0x090d('0x1e')]?_0x2b8e21['options'][_0x090d('0x25')]||null:null,'attributes':_0x2b8e21[_0x090d('0x1e')]?_0x2b8e21['options']['attributes']||null:null,'include':_0x2b8e21[_0x090d('0x1e')]?_0x2b8e21[_0x090d('0x1e')][_0x090d('0x21')]?_['map'](_0x2b8e21[_0x090d('0x1e')][_0x090d('0x21')],function(_0x4661c8){return{'model':db[_0x4661c8[_0x090d('0x23')]],'as':_0x4661c8['as'],'attributes':_0x4661c8[_0x090d('0x20')],'include':_0x4661c8[_0x090d('0x21')]?_[_0x090d('0x22')](_0x4661c8['include'],function(_0x3e8541){return{'model':db[_0x3e8541['model']],'as':_0x3e8541['as'],'attributes':_0x3e8541[_0x090d('0x20')],'include':_0x3e8541[_0x090d('0x21')]?_['map'](_0x3e8541[_0x090d('0x21')],function(_0x51b4b5){return{'model':db[_0x51b4b5[_0x090d('0x23')]],'as':_0x51b4b5['as'],'attributes':_0x51b4b5['attributes']};}):[]};}):[]};}):[]:[]})[_0x090d('0x11')](function(_0x2a991b){logger[_0x090d('0x12')]('ShowChatQueue',_0x2b8e21);logger[_0x090d('0x15')](_0x090d('0x26'),_0x2b8e21,JSON[_0x090d('0x17')](_0x2a991b));_0x35bbb0(_0x2a991b);})[_0x090d('0x1b')](function(_0x2860b2){logger[_0x090d('0x18')](_0x090d('0x26'),_0x2860b2[_0x090d('0x19')],_0x2b8e21);_0xe14ce9(_0x58c0e2[_0x090d('0x18')](0x1f4,_0x2860b2[_0x090d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d79f0bd..a78b457 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 _0xf109=['remove','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf109,0xce));var _0x9f10=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xf109[_0x36ed3c];return _0x52a2e0;};'use strict';var ChatQueueEvents=require(_0x9f10('0x0'));var events=[_0x9f10('0x1'),_0x9f10('0x2'),'update'];function createListener(_0x5b381d,_0x4cbc7a){return function(_0x3659ce){_0x4cbc7a[_0x9f10('0x3')](_0x5b381d,_0x3659ce);};}function removeListener(_0x74d0ee,_0x26f01c){return function(){ChatQueueEvents[_0x9f10('0x4')](_0x74d0ee,_0x26f01c);};}exports[_0x9f10('0x5')]=function(_0x408fe8){for(var _0xd3137b=0x0,_0x227a29=events[_0x9f10('0x6')];_0xd3137b<_0x227a29;_0xd3137b++){var _0x3fd82f=events[_0xd3137b];var _0x5c8719=createListener(_0x9f10('0x7')+_0x3fd82f,_0x408fe8);ChatQueueEvents['on'](_0x3fd82f,_0x5c8719);}}; \ No newline at end of file +var _0x57d4=['length','./chatQueue.events','save','update','emit','removeListener','register'];(function(_0x24fc23,_0x2e9832){var _0x3aa017=function(_0x4b1e48){while(--_0x4b1e48){_0x24fc23['push'](_0x24fc23['shift']());}};_0x3aa017(++_0x2e9832);}(_0x57d4,0x78));var _0x457d=function(_0x2bfcac,_0xf04556){_0x2bfcac=_0x2bfcac-0x0;var _0x32a7d7=_0x57d4[_0x2bfcac];return _0x32a7d7;};'use strict';var ChatQueueEvents=require(_0x457d('0x0'));var events=[_0x457d('0x1'),'remove',_0x457d('0x2')];function createListener(_0xa408c8,_0x1e26ab){return function(_0x30a25c){_0x1e26ab[_0x457d('0x3')](_0xa408c8,_0x30a25c);};}function removeListener(_0x3c89b2,_0x3e2239){return function(){ChatQueueEvents[_0x457d('0x4')](_0x3c89b2,_0x3e2239);};}exports[_0x457d('0x5')]=function(_0x247ec7){for(var _0x3fd867=0x0,_0x5c6816=events[_0x457d('0x6')];_0x3fd867<_0x5c6816;_0x3fd867++){var _0x381e22=events[_0x3fd867];var _0x4e32c0=createListener('chatQueue:'+_0x381e22,_0x247ec7);ChatQueueEvents['on'](_0x381e22,_0x4e32c0);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a8eeabc..784896d 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0xa49712,_0x376818){var _0x4fe0ed=function(_0x6de094){while(--_0x6de094){_0xa49712['push'](_0xa49712['shift']());}};_0x4fe0ed(++_0x376818);}(_0x814b,0x1a2));var _0xb814=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0x814b[_0x1c6ef2];return _0x404b8c;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5ef9bb,_0x38d3c5){var _0x477d4e=function(_0x2c3ffa){while(--_0x2c3ffa){_0x5ef9bb['push'](_0x5ef9bb['shift']());}};_0x477d4e(++_0x38d3c5);}(_0x7217,0x19e));var _0x7721=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x7217[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index db9c4ed..a030a33 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 _0xc8e8=['DATE','moment','sequelize','exports','STRING'];(function(_0x51fdfa,_0xc613c){var _0x111234=function(_0x51308a){while(--_0x51308a){_0x51fdfa['push'](_0x51fdfa['shift']());}};_0x111234(++_0xc613c);}(_0xc8e8,0x173));var _0x8c8e=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xc8e8[_0x3df9dd];return _0x4f11e4;};'use strict';var moment=require(_0x8c8e('0x0'));var Sequelize=require(_0x8c8e('0x1'));module[_0x8c8e('0x2')]={'uniqueid':{'type':Sequelize[_0x8c8e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8c8e('0x3')]},'joinAt':{'type':Sequelize[_0x8c8e('0x4')]},'leaveAt':{'type':Sequelize[_0x8c8e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8c8e('0x4')]},'reason':{'type':Sequelize[_0x8c8e('0x3')]}}; \ No newline at end of file +var _0x6b7a=['sequelize','exports','STRING','DATE','moment'];(function(_0x4d8fd6,_0xe40880){var _0x295d8d=function(_0xb5c482){while(--_0xb5c482){_0x4d8fd6['push'](_0x4d8fd6['shift']());}};_0x295d8d(++_0xe40880);}(_0x6b7a,0x77));var _0xa6b7=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0x6b7a[_0x1655bb];return _0x5e2020;};'use strict';var moment=require(_0xa6b7('0x0'));var Sequelize=require(_0xa6b7('0x1'));module[_0xa6b7('0x2')]={'uniqueid':{'type':Sequelize[_0xa6b7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa6b7('0x3')]},'joinAt':{'type':Sequelize[_0xa6b7('0x4')]},'leaveAt':{'type':Sequelize[_0xa6b7('0x4')]},'acceptAt':{'type':Sequelize[_0xa6b7('0x4')]},'exitAt':{'type':Sequelize[_0xa6b7('0x4')]},'reason':{'type':Sequelize[_0xa6b7('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index e5e94a8..6b1ff74 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 _0x1c63=['merge','options','ChatQueueReport','findAll','rows','keys','includeAll','include','find','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','then','destroy','map','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter'];(function(_0x11c258,_0x34cbc4){var _0x2ceb45=function(_0x224bed){while(--_0x224bed){_0x11c258['push'](_0x11c258['shift']());}};_0x2ceb45(++_0x34cbc4);}(_0x1c63,0xdc));var _0x31c6=function(_0x2250da,_0xdb9fe6){_0x2250da=_0x2250da-0x0;var _0x573dc5=_0x1c63[_0x2250da];return _0x573dc5;};'use strict';var emlformat=require(_0x31c6('0x0'));var rimraf=require(_0x31c6('0x1'));var zipdir=require(_0x31c6('0x2'));var jsonpatch=require(_0x31c6('0x3'));var rp=require('request-promise');var moment=require(_0x31c6('0x4'));var BPromise=require(_0x31c6('0x5'));var Mustache=require(_0x31c6('0x6'));var util=require('util');var path=require(_0x31c6('0x7'));var sox=require(_0x31c6('0x8'));var csv=require(_0x31c6('0x9'));var ejs=require(_0x31c6('0xa'));var fs=require('fs');var fs_extra=require(_0x31c6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x31c6('0xc'));var jsforce=require(_0x31c6('0xd'));var deskjs=require(_0x31c6('0xe'));var toCsv=require(_0x31c6('0x9'));var querystring=require(_0x31c6('0xf'));var Papa=require('papaparse');var Redis=require(_0x31c6('0x10'));var authService=require(_0x31c6('0x11'));var qs=require(_0x31c6('0x12'));var as=require(_0x31c6('0x13'));var hardwareService=require(_0x31c6('0x14'));var logger=require('../../config/logger')(_0x31c6('0x15'));var utils=require('../../config/utils');var config=require(_0x31c6('0x16'));var licenseUtil=require(_0x31c6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53c23d,_0x3424f0){_0x3424f0=_0x3424f0||0xcc;return function(_0x12f99c){if(_0x12f99c){return _0x53c23d[_0x31c6('0x18')](_0x3424f0);}return _0x53c23d[_0x31c6('0x19')](_0x3424f0)[_0x31c6('0x1a')]();};}function respondWithResult(_0x4d1710,_0x11e6a4){_0x11e6a4=_0x11e6a4||0xc8;return function(_0x3995cc){if(_0x3995cc){return _0x4d1710[_0x31c6('0x19')](_0x11e6a4)[_0x31c6('0x1b')](_0x3995cc);}};}function respondWithFilteredResult(_0x7a8c46,_0x5f1d49){return function(_0x5f2c85){if(_0x5f2c85){var _0x497264=typeof _0x5f1d49['offset']===_0x31c6('0x1c')&&typeof _0x5f1d49['limit']===_0x31c6('0x1c');var _0x2a4780=_0x5f2c85[_0x31c6('0x1d')];var _0xf352af=_0x497264?0x0:_0x5f1d49[_0x31c6('0x1e')];var _0x4c7f34=_0x497264?_0x5f2c85[_0x31c6('0x1d')]:_0x5f1d49[_0x31c6('0x1e')]+_0x5f1d49['limit'];var _0x593d2b;if(_0x4c7f34>=_0x2a4780){_0x4c7f34=_0x2a4780;_0x593d2b=0xc8;}else{_0x593d2b=0xce;}_0x7a8c46['status'](_0x593d2b);return _0x7a8c46[_0x31c6('0x1f')](_0x31c6('0x20'),_0xf352af+'-'+_0x4c7f34+'/'+_0x2a4780)[_0x31c6('0x1b')](_0x5f2c85);}return null;};}function patchUpdates(_0x24602f){return function(_0x4f17e5){try{jsonpatch['apply'](_0x4f17e5,_0x24602f,!![]);}catch(_0x4070f6){return BPromise[_0x31c6('0x21')](_0x4070f6);}return _0x4f17e5['save']();};}function saveUpdates(_0x339588,_0x1c6fda){return function(_0x392723){if(_0x392723){return _0x392723[_0x31c6('0x22')](_0x339588)[_0x31c6('0x23')](function(_0x509bed){return _0x509bed;});}return null;};}function removeEntity(_0x287c59,_0x536e57){return function(_0x8773d4){if(_0x8773d4){return _0x8773d4[_0x31c6('0x24')]()['then'](function(){_0x287c59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x412a8a,_0x250ab1){return function(_0x551291){if(!_0x551291){_0x412a8a[_0x31c6('0x18')](0x194);}return _0x551291;};}function handleError(_0x44bf50,_0x2c9d78){_0x2c9d78=_0x2c9d78||0x1f4;return function(_0x2fb5f3){logger['error'](_0x2fb5f3['stack']);if(_0x2fb5f3['name']){delete _0x2fb5f3['name'];}_0x44bf50[_0x31c6('0x19')](_0x2c9d78)['send'](_0x2fb5f3);};}exports['index']=function(_0x1e24fa,_0x2034cc){var _0x5e3ed0={},_0x41100c={},_0x47a0cd={'count':0x0,'rows':[]};var _0x1d5ab5=_[_0x31c6('0x25')](db['ChatQueueReport'][_0x31c6('0x26')],function(_0x3840de){return{'name':_0x3840de[_0x31c6('0x27')],'type':_0x3840de[_0x31c6('0x28')][_0x31c6('0x29')]};});_0x41100c[_0x31c6('0x2a')]=_['map'](_0x1d5ab5,_0x31c6('0x2b'));_0x41100c[_0x31c6('0x2c')]=_['keys'](_0x1e24fa[_0x31c6('0x2c')]);_0x41100c[_0x31c6('0x2d')]=_['intersection'](_0x41100c['model'],_0x41100c['query']);_0x5e3ed0[_0x31c6('0x2e')]=_[_0x31c6('0x2f')](_0x41100c['model'],qs[_0x31c6('0x30')](_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x30')]));_0x5e3ed0[_0x31c6('0x2e')]=_0x5e3ed0[_0x31c6('0x2e')]['length']?_0x5e3ed0[_0x31c6('0x2e')]:_0x41100c[_0x31c6('0x2a')];if(!_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x31')](_0x31c6('0x32'))){_0x5e3ed0[_0x31c6('0x33')]=qs[_0x31c6('0x33')](_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x33')]);_0x5e3ed0['offset']=qs[_0x31c6('0x1e')](_0x1e24fa[_0x31c6('0x2c')]['offset']);}_0x5e3ed0[_0x31c6('0x34')]=qs[_0x31c6('0x35')](_0x1e24fa['query'][_0x31c6('0x35')]);_0x5e3ed0[_0x31c6('0x36')]=qs[_0x31c6('0x2d')](_['pick'](_0x1e24fa[_0x31c6('0x2c')],_0x41100c['filters']),_0x1d5ab5);if(_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x37')]){_0x5e3ed0[_0x31c6('0x36')]=_['merge'](_0x5e3ed0[_0x31c6('0x36')],{'$or':_[_0x31c6('0x25')](_0x1d5ab5,function(_0xdf5348){if(_0xdf5348[_0x31c6('0x28')]!=='VIRTUAL'){var _0x506491={};_0x506491[_0xdf5348[_0x31c6('0x2b')]]={'$like':'%'+_0x1e24fa[_0x31c6('0x2c')][_0x31c6('0x37')]+'%'};return _0x506491;}})});}_0x5e3ed0=_[_0x31c6('0x38')]({},_0x5e3ed0,_0x1e24fa[_0x31c6('0x39')]);var _0xeed7d7={'where':_0x5e3ed0[_0x31c6('0x36')]};return db[_0x31c6('0x3a')][_0x31c6('0x1d')](_0xeed7d7)[_0x31c6('0x23')](function(_0x4dba99){_0x47a0cd[_0x31c6('0x1d')]=_0x4dba99;if(_0x1e24fa[_0x31c6('0x2c')]['includeAll']){_0x5e3ed0['include']=[{'all':!![]}];}return db[_0x31c6('0x3a')][_0x31c6('0x3b')](_0x5e3ed0);})[_0x31c6('0x23')](function(_0xd85393){_0x47a0cd[_0x31c6('0x3c')]=_0xd85393;return _0x47a0cd;})[_0x31c6('0x23')](respondWithFilteredResult(_0x2034cc,_0x5e3ed0))['catch'](handleError(_0x2034cc,null));};exports['show']=function(_0x31c919,_0x5195b0){var _0x2c2129={'raw':!![],'where':{'id':_0x31c919['params']['id']}},_0x1f0b73={};_0x1f0b73[_0x31c6('0x2a')]=_[_0x31c6('0x3d')](db[_0x31c6('0x3a')][_0x31c6('0x26')]);_0x1f0b73[_0x31c6('0x2c')]=_[_0x31c6('0x3d')](_0x31c919['query']);_0x1f0b73[_0x31c6('0x2d')]=_[_0x31c6('0x2f')](_0x1f0b73[_0x31c6('0x2a')],_0x1f0b73[_0x31c6('0x2c')]);_0x2c2129[_0x31c6('0x2e')]=_['intersection'](_0x1f0b73[_0x31c6('0x2a')],qs[_0x31c6('0x30')](_0x31c919[_0x31c6('0x2c')][_0x31c6('0x30')]));_0x2c2129['attributes']=_0x2c2129[_0x31c6('0x2e')]['length']?_0x2c2129[_0x31c6('0x2e')]:_0x1f0b73[_0x31c6('0x2a')];if(_0x31c919[_0x31c6('0x2c')][_0x31c6('0x3e')]){_0x2c2129[_0x31c6('0x3f')]=[{'all':!![]}];}_0x2c2129=_['merge']({},_0x2c2129,_0x31c919[_0x31c6('0x39')]);return db[_0x31c6('0x3a')][_0x31c6('0x40')](_0x2c2129)[_0x31c6('0x23')](handleEntityNotFound(_0x5195b0,null))[_0x31c6('0x23')](respondWithResult(_0x5195b0,null))[_0x31c6('0x41')](handleError(_0x5195b0,null));};exports['create']=function(_0x36fc66,_0x52d06d){return db[_0x31c6('0x3a')]['create'](_0x36fc66['body'],{})[_0x31c6('0x23')](respondWithResult(_0x52d06d,0xc9))[_0x31c6('0x41')](handleError(_0x52d06d,null));};exports['update']=function(_0xf33b6c,_0x129197){if(_0xf33b6c[_0x31c6('0x42')]['id']){delete _0xf33b6c['body']['id'];}return db['ChatQueueReport'][_0x31c6('0x40')]({'where':{'id':_0xf33b6c[_0x31c6('0x43')]['id']}})[_0x31c6('0x23')](handleEntityNotFound(_0x129197,null))[_0x31c6('0x23')](saveUpdates(_0xf33b6c[_0x31c6('0x42')],null))[_0x31c6('0x23')](respondWithResult(_0x129197,null))[_0x31c6('0x41')](handleError(_0x129197,null));};exports[_0x31c6('0x24')]=function(_0x21ead7,_0x10f5b1){return db[_0x31c6('0x3a')][_0x31c6('0x40')]({'where':{'id':_0x21ead7['params']['id']}})['then'](handleEntityNotFound(_0x10f5b1,null))['then'](removeEntity(_0x10f5b1,null))[_0x31c6('0x41')](handleError(_0x10f5b1,null));};exports[_0x31c6('0x44')]=function(_0x1b0999,_0x433a63){return db[_0x31c6('0x3a')][_0x31c6('0x44')]()[_0x31c6('0x23')](respondWithResult(_0x433a63,null))['catch'](handleError(_0x433a63,null));}; \ No newline at end of file +var _0x229c=['rimraf','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','end','error','stack','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','describe'];(function(_0x3c51cd,_0x27f7dd){var _0x65e93a=function(_0x27aae9){while(--_0x27aae9){_0x3c51cd['push'](_0x3c51cd['shift']());}};_0x65e93a(++_0x27f7dd);}(_0x229c,0xcf));var _0xc229=function(_0x58d581,_0x13ba5e){_0x58d581=_0x58d581-0x0;var _0x1ba648=_0x229c[_0x58d581];return _0x1ba648;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc229('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc229('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc229('0x2'));var util=require('util');var path=require(_0xc229('0x3'));var sox=require(_0xc229('0x4'));var csv=require(_0xc229('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc229('0x6'));var _=require('lodash');var squel=require(_0xc229('0x7'));var crypto=require(_0xc229('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc229('0x9'));var toCsv=require(_0xc229('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc229('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc229('0xb'));var hardwareService=require(_0xc229('0xc'));var logger=require(_0xc229('0xd'))(_0xc229('0xe'));var utils=require(_0xc229('0xf'));var config=require(_0xc229('0x10'));var licenseUtil=require(_0xc229('0x11'));var db=require(_0xc229('0x12'))['db'];function respondWithStatusCode(_0xf7cd15,_0x337ae0){_0x337ae0=_0x337ae0||0xcc;return function(_0x1faf37){if(_0x1faf37){return _0xf7cd15[_0xc229('0x13')](_0x337ae0);}return _0xf7cd15[_0xc229('0x14')](_0x337ae0)['end']();};}function respondWithResult(_0x36cfb4,_0x53ba7a){_0x53ba7a=_0x53ba7a||0xc8;return function(_0x6dd4c2){if(_0x6dd4c2){return _0x36cfb4[_0xc229('0x14')](_0x53ba7a)[_0xc229('0x15')](_0x6dd4c2);}};}function respondWithFilteredResult(_0x1cc8ed,_0x1d9efd){return function(_0x7b71c3){if(_0x7b71c3){var _0x292f30=typeof _0x1d9efd[_0xc229('0x16')]===_0xc229('0x17')&&typeof _0x1d9efd[_0xc229('0x18')]===_0xc229('0x17');var _0x11771e=_0x7b71c3[_0xc229('0x19')];var _0x4cae05=_0x292f30?0x0:_0x1d9efd[_0xc229('0x16')];var _0x10339a=_0x292f30?_0x7b71c3[_0xc229('0x19')]:_0x1d9efd[_0xc229('0x16')]+_0x1d9efd[_0xc229('0x18')];var _0x14ef5e;if(_0x10339a>=_0x11771e){_0x10339a=_0x11771e;_0x14ef5e=0xc8;}else{_0x14ef5e=0xce;}_0x1cc8ed[_0xc229('0x14')](_0x14ef5e);return _0x1cc8ed['set']('Content-Range',_0x4cae05+'-'+_0x10339a+'/'+_0x11771e)[_0xc229('0x15')](_0x7b71c3);}return null;};}function patchUpdates(_0x53dbba){return function(_0x46b7b0){try{jsonpatch[_0xc229('0x1a')](_0x46b7b0,_0x53dbba,!![]);}catch(_0x55691a){return BPromise['reject'](_0x55691a);}return _0x46b7b0[_0xc229('0x1b')]();};}function saveUpdates(_0x40d549,_0x3a9957){return function(_0x3b20af){if(_0x3b20af){return _0x3b20af[_0xc229('0x1c')](_0x40d549)[_0xc229('0x1d')](function(_0x6e7910){return _0x6e7910;});}return null;};}function removeEntity(_0x50fd02,_0x5cb52f){return function(_0x8c4f83){if(_0x8c4f83){return _0x8c4f83[_0xc229('0x1e')]()['then'](function(){_0x50fd02['status'](0xcc)[_0xc229('0x1f')]();});}};}function handleEntityNotFound(_0x30c711,_0x12a5b8){return function(_0x190e58){if(!_0x190e58){_0x30c711[_0xc229('0x13')](0x194);}return _0x190e58;};}function handleError(_0x268546,_0x5a05b3){_0x5a05b3=_0x5a05b3||0x1f4;return function(_0x103d43){logger[_0xc229('0x20')](_0x103d43[_0xc229('0x21')]);if(_0x103d43['name']){delete _0x103d43['name'];}_0x268546[_0xc229('0x14')](_0x5a05b3)['send'](_0x103d43);};}exports[_0xc229('0x22')]=function(_0x2a6e38,_0x2c5fbf){var _0x1a94ac={},_0xfa1ba2={},_0x34d258={'count':0x0,'rows':[]};var _0x1928b8=_[_0xc229('0x23')](db[_0xc229('0x24')][_0xc229('0x25')],function(_0x195be7){return{'name':_0x195be7[_0xc229('0x26')],'type':_0x195be7[_0xc229('0x27')][_0xc229('0x28')]};});_0xfa1ba2[_0xc229('0x29')]=_[_0xc229('0x23')](_0x1928b8,_0xc229('0x2a'));_0xfa1ba2[_0xc229('0x2b')]=_[_0xc229('0x2c')](_0x2a6e38[_0xc229('0x2b')]);_0xfa1ba2[_0xc229('0x2d')]=_['intersection'](_0xfa1ba2[_0xc229('0x29')],_0xfa1ba2['query']);_0x1a94ac[_0xc229('0x2e')]=_[_0xc229('0x2f')](_0xfa1ba2['model'],qs[_0xc229('0x30')](_0x2a6e38[_0xc229('0x2b')][_0xc229('0x30')]));_0x1a94ac[_0xc229('0x2e')]=_0x1a94ac[_0xc229('0x2e')][_0xc229('0x31')]?_0x1a94ac['attributes']:_0xfa1ba2[_0xc229('0x29')];if(!_0x2a6e38[_0xc229('0x2b')][_0xc229('0x32')](_0xc229('0x33'))){_0x1a94ac[_0xc229('0x18')]=qs[_0xc229('0x18')](_0x2a6e38[_0xc229('0x2b')][_0xc229('0x18')]);_0x1a94ac[_0xc229('0x16')]=qs[_0xc229('0x16')](_0x2a6e38[_0xc229('0x2b')]['offset']);}_0x1a94ac[_0xc229('0x34')]=qs[_0xc229('0x35')](_0x2a6e38[_0xc229('0x2b')]['sort']);_0x1a94ac[_0xc229('0x36')]=qs[_0xc229('0x2d')](_['pick'](_0x2a6e38['query'],_0xfa1ba2[_0xc229('0x2d')]),_0x1928b8);if(_0x2a6e38['query']['filter']){_0x1a94ac['where']=_[_0xc229('0x37')](_0x1a94ac['where'],{'$or':_['map'](_0x1928b8,function(_0x19b4a8){if(_0x19b4a8['type']!==_0xc229('0x38')){var _0x3f0008={};_0x3f0008[_0x19b4a8[_0xc229('0x2a')]]={'$like':'%'+_0x2a6e38[_0xc229('0x2b')][_0xc229('0x39')]+'%'};return _0x3f0008;}})});}_0x1a94ac=_['merge']({},_0x1a94ac,_0x2a6e38[_0xc229('0x3a')]);var _0x4f9912={'where':_0x1a94ac[_0xc229('0x36')]};return db[_0xc229('0x24')][_0xc229('0x19')](_0x4f9912)[_0xc229('0x1d')](function(_0x2c352b){_0x34d258[_0xc229('0x19')]=_0x2c352b;if(_0x2a6e38['query'][_0xc229('0x3b')]){_0x1a94ac[_0xc229('0x3c')]=[{'all':!![]}];}return db[_0xc229('0x24')][_0xc229('0x3d')](_0x1a94ac);})[_0xc229('0x1d')](function(_0x48e504){_0x34d258['rows']=_0x48e504;return _0x34d258;})[_0xc229('0x1d')](respondWithFilteredResult(_0x2c5fbf,_0x1a94ac))[_0xc229('0x3e')](handleError(_0x2c5fbf,null));};exports[_0xc229('0x3f')]=function(_0x1deb7b,_0x553386){var _0x109b37={'raw':!![],'where':{'id':_0x1deb7b[_0xc229('0x40')]['id']}},_0x192f0d={};_0x192f0d[_0xc229('0x29')]=_[_0xc229('0x2c')](db[_0xc229('0x24')][_0xc229('0x25')]);_0x192f0d['query']=_['keys'](_0x1deb7b[_0xc229('0x2b')]);_0x192f0d[_0xc229('0x2d')]=_[_0xc229('0x2f')](_0x192f0d[_0xc229('0x29')],_0x192f0d[_0xc229('0x2b')]);_0x109b37[_0xc229('0x2e')]=_[_0xc229('0x2f')](_0x192f0d[_0xc229('0x29')],qs[_0xc229('0x30')](_0x1deb7b[_0xc229('0x2b')]['fields']));_0x109b37[_0xc229('0x2e')]=_0x109b37['attributes'][_0xc229('0x31')]?_0x109b37[_0xc229('0x2e')]:_0x192f0d[_0xc229('0x29')];if(_0x1deb7b['query'][_0xc229('0x3b')]){_0x109b37['include']=[{'all':!![]}];}_0x109b37=_[_0xc229('0x37')]({},_0x109b37,_0x1deb7b[_0xc229('0x3a')]);return db[_0xc229('0x24')]['find'](_0x109b37)[_0xc229('0x1d')](handleEntityNotFound(_0x553386,null))[_0xc229('0x1d')](respondWithResult(_0x553386,null))[_0xc229('0x3e')](handleError(_0x553386,null));};exports[_0xc229('0x41')]=function(_0x2f3cc,_0x7d7799){return db[_0xc229('0x24')][_0xc229('0x41')](_0x2f3cc[_0xc229('0x42')],{})[_0xc229('0x1d')](respondWithResult(_0x7d7799,0xc9))[_0xc229('0x3e')](handleError(_0x7d7799,null));};exports[_0xc229('0x1c')]=function(_0x13f449,_0x41d94c){if(_0x13f449[_0xc229('0x42')]['id']){delete _0x13f449[_0xc229('0x42')]['id'];}return db[_0xc229('0x24')][_0xc229('0x43')]({'where':{'id':_0x13f449[_0xc229('0x40')]['id']}})[_0xc229('0x1d')](handleEntityNotFound(_0x41d94c,null))['then'](saveUpdates(_0x13f449['body'],null))[_0xc229('0x1d')](respondWithResult(_0x41d94c,null))[_0xc229('0x3e')](handleError(_0x41d94c,null));};exports[_0xc229('0x1e')]=function(_0x442dbe,_0x5c043c){return db['ChatQueueReport'][_0xc229('0x43')]({'where':{'id':_0x442dbe['params']['id']}})[_0xc229('0x1d')](handleEntityNotFound(_0x5c043c,null))['then'](removeEntity(_0x5c043c,null))[_0xc229('0x3e')](handleError(_0x5c043c,null));};exports[_0xc229('0x44')]=function(_0x47fd5c,_0x3df335){return db[_0xc229('0x24')][_0xc229('0x44')]()['then'](respondWithResult(_0x3df335,null))[_0xc229('0x3e')](handleError(_0x3df335,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b73be8e..8a6885d 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4418e3,_0x5712ac){var _0x330e3d=function(_0x29a0f4){while(--_0x29a0f4){_0x4418e3['push'](_0x4418e3['shift']());}};_0x330e3d(++_0x5712ac);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x6e9a01,_0x41ab36){var _0x238469=function(_0x4811e){while(--_0x4811e){_0x6e9a01['push'](_0x6e9a01['shift']());}};_0x238469(++_0x41ab36);}(_0xe706,0xa3));var _0x6e70=function(_0x584513,_0x37c6c9){_0x584513=_0x584513-0x0;var _0xe4a14e=_0xe706[_0x584513];return _0xe4a14e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 63ec1be..178fecd 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 _0xf45e=['code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3d0177,_0x5c98b1){var _0x47e974=function(_0x37b219){while(--_0x37b219){_0x3d0177['push'](_0x3d0177['shift']());}};_0x47e974(++_0x5c98b1);}(_0xf45e,0x115));var _0xef45=function(_0x1b766d,_0x466c05){_0x1b766d=_0x1b766d-0x0;var _0x572823=_0xf45e[_0x1b766d];return _0x572823;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['ChatQueueReport'][_0xef45('0x1a')](_0x219778[_0xef45('0x1b')],{'raw':_0x219778[_0xef45('0x1c')]?_0x219778[_0xef45('0x1c')][_0xef45('0x1d')]===undefined?!![]:![]:!![]})[_0xef45('0xd')](function(_0x375cbd){logger['info'](_0xef45('0x19'),_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x375cbd));_0x258785(_0x375cbd);})[_0xef45('0x18')](function(_0x5205bf){logger[_0xef45('0x13')]('CreateChatQueueReport',_0x5205bf['message'],_0x219778);_0x4ca902(_0x3ba1f4[_0xef45('0x13')](0x1f4,_0x5205bf[_0xef45('0x16')]));});});};exports[_0xef45('0x1e')]=function(_0x7817d0){var _0x839eff=this;return new Promise(function(_0xcf1add,_0x315777){return db['ChatQueueReport'][_0xef45('0x1f')](_0x7817d0['body'],{'raw':_0x7817d0[_0xef45('0x1c')]?_0x7817d0[_0xef45('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7817d0[_0xef45('0x1c')]?_0x7817d0[_0xef45('0x1c')]['where']||null:null,'attributes':_0x7817d0[_0xef45('0x1c')]?_0x7817d0['options']['attributes']||null:null,'limit':_0x7817d0['options']?_0x7817d0['options'][_0xef45('0x20')]||null:null})[_0xef45('0xd')](function(_0x217e8d){logger[_0xef45('0xe')]('UpdateChatQueueReport',_0x7817d0);logger[_0xef45('0x10')]('UpdateChatQueueReport',_0x7817d0,JSON[_0xef45('0x12')](_0x217e8d));_0xcf1add(_0x217e8d);})['catch'](function(_0x3e6922){logger['error']('UpdateChatQueueReport',_0x3e6922[_0xef45('0x16')],_0x7817d0);_0x315777(_0x839eff[_0xef45('0x13')](0x1f4,_0x3e6922[_0xef45('0x16')]));});});}; \ No newline at end of file +var _0xec64=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','debug','UpdateChatQueueReport','update','raw','where','attributes'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0xec64,0x88));var _0x4ec6=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xec64[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x4ec6('0x0'));var util=require('util');var moment=require(_0x4ec6('0x1'));var BPromise=require(_0x4ec6('0x2'));var rs=require(_0x4ec6('0x3'));var fs=require('fs');var Redis=require(_0x4ec6('0x4'));var db=require(_0x4ec6('0x5'))['db'];var utils=require(_0x4ec6('0x6'));var logger=require(_0x4ec6('0x7'))('rpc');var config=require(_0x4ec6('0x8'));var jayson=require(_0x4ec6('0x9'));var client=jayson[_0x4ec6('0xa')][_0x4ec6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x186591,_0x184ae9,_0x1a99b5){return new BPromise(function(_0x138e56,_0x5407c9){return client[_0x4ec6('0xc')](_0x186591,_0x1a99b5)[_0x4ec6('0xd')](function(_0x4d5e51){logger[_0x4ec6('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x184ae9,_0x4ec6('0xf'));logger['debug'](_0x4ec6('0x10'),_0x184ae9,_0x4ec6('0xf'),JSON[_0x4ec6('0x11')](_0x4d5e51));if(_0x4d5e51[_0x4ec6('0x12')]){if(_0x4d5e51['error'][_0x4ec6('0x13')]===0x1f4){logger[_0x4ec6('0x12')](_0x4ec6('0x14'),_0x184ae9,_0x4d5e51['error'][_0x4ec6('0x15')]);return _0x5407c9(_0x4d5e51[_0x4ec6('0x12')]['message']);}logger[_0x4ec6('0x12')](_0x4ec6('0x14'),_0x184ae9,_0x4d5e51[_0x4ec6('0x12')][_0x4ec6('0x15')]);return _0x138e56(_0x4d5e51[_0x4ec6('0x12')][_0x4ec6('0x15')]);}else{logger[_0x4ec6('0xe')](_0x4ec6('0x14'),_0x184ae9,_0x4ec6('0xf'));_0x138e56(_0x4d5e51['result'][_0x4ec6('0x15')]);}})[_0x4ec6('0x16')](function(_0x22be11){logger['error'](_0x4ec6('0x14'),_0x184ae9,_0x22be11);_0x5407c9(_0x22be11);});});}exports[_0x4ec6('0x17')]=function(_0x3f992f){var _0x5e211c=this;return new Promise(function(_0x1b2fed,_0x5cfc6c){return db[_0x4ec6('0x18')][_0x4ec6('0x19')](_0x3f992f[_0x4ec6('0x1a')],{'raw':_0x3f992f[_0x4ec6('0x1b')]?_0x3f992f['options']['raw']===undefined?!![]:![]:!![]})[_0x4ec6('0xd')](function(_0x537b23){logger[_0x4ec6('0xe')](_0x4ec6('0x17'),_0x3f992f);logger[_0x4ec6('0x1c')](_0x4ec6('0x17'),_0x3f992f,JSON[_0x4ec6('0x11')](_0x537b23));_0x1b2fed(_0x537b23);})['catch'](function(_0x40401e){logger[_0x4ec6('0x12')](_0x4ec6('0x17'),_0x40401e[_0x4ec6('0x15')],_0x3f992f);_0x5cfc6c(_0x5e211c[_0x4ec6('0x12')](0x1f4,_0x40401e[_0x4ec6('0x15')]));});});};exports[_0x4ec6('0x1d')]=function(_0x36f69c){var _0x1fbf66=this;return new Promise(function(_0xe4996f,_0xcc2225){return db[_0x4ec6('0x18')][_0x4ec6('0x1e')](_0x36f69c[_0x4ec6('0x1a')],{'raw':_0x36f69c[_0x4ec6('0x1b')]?_0x36f69c[_0x4ec6('0x1b')][_0x4ec6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36f69c[_0x4ec6('0x1b')]?_0x36f69c[_0x4ec6('0x1b')][_0x4ec6('0x20')]||null:null,'attributes':_0x36f69c[_0x4ec6('0x1b')]?_0x36f69c['options'][_0x4ec6('0x21')]||null:null,'limit':_0x36f69c[_0x4ec6('0x1b')]?_0x36f69c[_0x4ec6('0x1b')]['limit']||null:null})['then'](function(_0x41a2c5){logger['info'](_0x4ec6('0x1d'),_0x36f69c);logger['debug'](_0x4ec6('0x1d'),_0x36f69c,JSON[_0x4ec6('0x11')](_0x41a2c5));_0xe4996f(_0x41a2c5);})['catch'](function(_0x4d89ef){logger[_0x4ec6('0x12')](_0x4ec6('0x1d'),_0x4d89ef['message'],_0x36f69c);_0xcc2225(_0x1fbf66[_0x4ec6('0x12')](0x1f4,_0x4d89ef[_0x4ec6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c370484..4badfd0 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 _0x9c3d=['create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x256027,_0x572634){var _0xf4cfa2=function(_0x1eec7a){while(--_0x1eec7a){_0x256027['push'](_0x256027['shift']());}};_0xf4cfa2(++_0x572634);}(_0x9c3d,0x8a));var _0xd9c3=function(_0x40b9d0,_0x3537da){_0x40b9d0=_0x40b9d0-0x0;var _0x144b8d=_0x9c3d[_0x40b9d0];return _0x144b8d;};'use strict';var multer=require('multer');var util=require(_0xd9c3('0x0'));var path=require(_0xd9c3('0x1'));var timeout=require(_0xd9c3('0x2'));var express=require(_0xd9c3('0x3'));var router=express[_0xd9c3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd9c3('0x5'));var interaction=require(_0xd9c3('0x6'));var config=require('../../config/environment');var controller=require(_0xd9c3('0x7'));router[_0xd9c3('0x8')]('/',auth[_0xd9c3('0x9')](),controller[_0xd9c3('0xa')]);router['get'](_0xd9c3('0xb'),auth[_0xd9c3('0x9')](),controller[_0xd9c3('0xc')]);router[_0xd9c3('0x8')](_0xd9c3('0xd'),auth[_0xd9c3('0x9')](),controller['show']);router['post']('/',auth[_0xd9c3('0x9')](),controller[_0xd9c3('0xe')]);router[_0xd9c3('0xf')](_0xd9c3('0xd'),auth['isAuthenticated'](),controller[_0xd9c3('0x10')]);router[_0xd9c3('0x11')](_0xd9c3('0xd'),auth['isAuthenticated'](),controller[_0xd9c3('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd0e2=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0xd0e2,0x1d5));var _0x2d0e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd0e2[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2d0e('0x0'));var util=require(_0x2d0e('0x1'));var path=require(_0x2d0e('0x2'));var timeout=require(_0x2d0e('0x3'));var express=require(_0x2d0e('0x4'));var router=express[_0x2d0e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2d0e('0x6'));var interaction=require(_0x2d0e('0x7'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x2d0e('0x8')]('/',auth[_0x2d0e('0x9')](),controller[_0x2d0e('0xa')]);router[_0x2d0e('0x8')](_0x2d0e('0xb'),auth[_0x2d0e('0x9')](),controller[_0x2d0e('0xc')]);router[_0x2d0e('0x8')]('/:id',auth[_0x2d0e('0x9')](),controller[_0x2d0e('0xd')]);router['post']('/',auth[_0x2d0e('0x9')](),controller[_0x2d0e('0xe')]);router[_0x2d0e('0xf')](_0x2d0e('0x10'),auth[_0x2d0e('0x9')](),controller[_0x2d0e('0x11')]);router[_0x2d0e('0x12')](_0x2d0e('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 72ed16c..1385af3 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x51f53a,_0x172b43){var _0xec41b7=function(_0x5eb725){while(--_0x5eb725){_0x51f53a['push'](_0x51f53a['shift']());}};_0xec41b7(++_0x172b43);}(_0xaa88,0x137));var _0x8aa8=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0xaa88[_0x3e8270];return _0x1ccde9;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x20432d,_0x162aef){var _0x3d47db=function(_0x463525){while(--_0x463525){_0x20432d['push'](_0x20432d['shift']());}};_0x3d47db(++_0x162aef);}(_0x008c,0x188));var _0xc008=function(_0x186222,_0x3bdfb0){_0x186222=_0x186222-0x0;var _0x226a38=_0x008c[_0x186222];return _0x226a38;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index bfb268e..614e68a 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 _0xd601=['desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','include','findAll','catch','show','length','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto'];(function(_0x3692d7,_0x5d47a0){var _0x4dfa55=function(_0xb6fed7){while(--_0xb6fed7){_0x3692d7['push'](_0x3692d7['shift']());}};_0x4dfa55(++_0x5d47a0);}(_0xd601,0xc9));var _0x1d60=function(_0x7700d0,_0x6bea95){_0x7700d0=_0x7700d0-0x0;var _0x460621=_0xd601[_0x7700d0];return _0x460621;};'use strict';var emlformat=require(_0x1d60('0x0'));var rimraf=require(_0x1d60('0x1'));var zipdir=require(_0x1d60('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d60('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1d60('0x4'));var util=require(_0x1d60('0x5'));var path=require(_0x1d60('0x6'));var sox=require(_0x1d60('0x7'));var csv=require('to-csv');var ejs=require(_0x1d60('0x8'));var fs=require('fs');var fs_extra=require(_0x1d60('0x9'));var _=require('lodash');var squel=require(_0x1d60('0xa'));var crypto=require(_0x1d60('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1d60('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1d60('0xd'));var Papa=require(_0x1d60('0xe'));var Redis=require(_0x1d60('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d60('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1d60('0x11'));var licenseUtil=require(_0x1d60('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x294b5d,_0x4d0340){_0x4d0340=_0x4d0340||0xcc;return function(_0x466cf0){if(_0x466cf0){return _0x294b5d[_0x1d60('0x13')](_0x4d0340);}return _0x294b5d[_0x1d60('0x14')](_0x4d0340)[_0x1d60('0x15')]();};}function respondWithResult(_0x497d7b,_0x19a5e8){_0x19a5e8=_0x19a5e8||0xc8;return function(_0x38af49){if(_0x38af49){return _0x497d7b[_0x1d60('0x14')](_0x19a5e8)[_0x1d60('0x16')](_0x38af49);}};}function respondWithFilteredResult(_0x4985a5,_0x16936c){return function(_0x50bd2d){if(_0x50bd2d){var _0x2ce40e=typeof _0x16936c[_0x1d60('0x17')]===_0x1d60('0x18')&&typeof _0x16936c[_0x1d60('0x19')]===_0x1d60('0x18');var _0x51df7e=_0x50bd2d['count'];var _0x31c266=_0x2ce40e?0x0:_0x16936c[_0x1d60('0x17')];var _0x45118b=_0x2ce40e?_0x50bd2d[_0x1d60('0x1a')]:_0x16936c[_0x1d60('0x17')]+_0x16936c['limit'];var _0x33adb8;if(_0x45118b>=_0x51df7e){_0x45118b=_0x51df7e;_0x33adb8=0xc8;}else{_0x33adb8=0xce;}_0x4985a5[_0x1d60('0x14')](_0x33adb8);return _0x4985a5[_0x1d60('0x1b')](_0x1d60('0x1c'),_0x31c266+'-'+_0x45118b+'/'+_0x51df7e)[_0x1d60('0x16')](_0x50bd2d);}return null;};}function patchUpdates(_0x5b6adb){return function(_0x313e40){try{jsonpatch[_0x1d60('0x1d')](_0x313e40,_0x5b6adb,!![]);}catch(_0xaafff9){return BPromise[_0x1d60('0x1e')](_0xaafff9);}return _0x313e40[_0x1d60('0x1f')]();};}function saveUpdates(_0x182dda,_0xaa597e){return function(_0xb2db24){if(_0xb2db24){return _0xb2db24[_0x1d60('0x20')](_0x182dda)[_0x1d60('0x21')](function(_0x53dfc6){return _0x53dfc6;});}return null;};}function removeEntity(_0x46640a,_0x39b5d4){return function(_0x4b5ac9){if(_0x4b5ac9){return _0x4b5ac9[_0x1d60('0x22')]()[_0x1d60('0x21')](function(){_0x46640a[_0x1d60('0x14')](0xcc)[_0x1d60('0x15')]();});}};}function handleEntityNotFound(_0x16ae76,_0x3947d2){return function(_0x1b1e39){if(!_0x1b1e39){_0x16ae76[_0x1d60('0x13')](0x194);}return _0x1b1e39;};}function handleError(_0xc58f02,_0x5c5bc3){_0x5c5bc3=_0x5c5bc3||0x1f4;return function(_0x56c7d0){logger[_0x1d60('0x23')](_0x56c7d0['stack']);if(_0x56c7d0[_0x1d60('0x24')]){delete _0x56c7d0[_0x1d60('0x24')];}_0xc58f02['status'](_0x5c5bc3)[_0x1d60('0x25')](_0x56c7d0);};}exports[_0x1d60('0x26')]=function(_0x4487a8,_0xfd94f6){var _0x2b8eec={},_0x4dd2eb={},_0x212f4f={'count':0x0,'rows':[]};var _0x137a7a=_[_0x1d60('0x27')](db[_0x1d60('0x28')][_0x1d60('0x29')],function(_0x5cde04){return{'name':_0x5cde04[_0x1d60('0x2a')],'type':_0x5cde04[_0x1d60('0x2b')]['key']};});_0x4dd2eb[_0x1d60('0x2c')]=_['map'](_0x137a7a,_0x1d60('0x24'));_0x4dd2eb[_0x1d60('0x2d')]=_[_0x1d60('0x2e')](_0x4487a8[_0x1d60('0x2d')]);_0x4dd2eb[_0x1d60('0x2f')]=_[_0x1d60('0x30')](_0x4dd2eb[_0x1d60('0x2c')],_0x4dd2eb[_0x1d60('0x2d')]);_0x2b8eec[_0x1d60('0x31')]=_[_0x1d60('0x30')](_0x4dd2eb[_0x1d60('0x2c')],qs[_0x1d60('0x32')](_0x4487a8['query'][_0x1d60('0x32')]));_0x2b8eec[_0x1d60('0x31')]=_0x2b8eec[_0x1d60('0x31')]['length']?_0x2b8eec['attributes']:_0x4dd2eb['model'];if(!_0x4487a8[_0x1d60('0x2d')][_0x1d60('0x33')](_0x1d60('0x34'))){_0x2b8eec[_0x1d60('0x19')]=qs[_0x1d60('0x19')](_0x4487a8[_0x1d60('0x2d')][_0x1d60('0x19')]);_0x2b8eec[_0x1d60('0x17')]=qs[_0x1d60('0x17')](_0x4487a8[_0x1d60('0x2d')][_0x1d60('0x17')]);}_0x2b8eec[_0x1d60('0x35')]=qs['sort'](_0x4487a8[_0x1d60('0x2d')][_0x1d60('0x36')]);_0x2b8eec['where']=qs['filters'](_[_0x1d60('0x37')](_0x4487a8[_0x1d60('0x2d')],_0x4dd2eb['filters']),_0x137a7a);if(_0x4487a8[_0x1d60('0x2d')]['filter']){_0x2b8eec[_0x1d60('0x38')]=_[_0x1d60('0x39')](_0x2b8eec[_0x1d60('0x38')],{'$or':_[_0x1d60('0x27')](_0x137a7a,function(_0x3f5372){if(_0x3f5372[_0x1d60('0x2b')]!=='VIRTUAL'){var _0x445efe={};_0x445efe[_0x3f5372['name']]={'$like':'%'+_0x4487a8[_0x1d60('0x2d')][_0x1d60('0x3a')]+'%'};return _0x445efe;}})});}_0x2b8eec=_[_0x1d60('0x39')]({},_0x2b8eec,_0x4487a8[_0x1d60('0x3b')]);var _0xfa601a={'where':_0x2b8eec[_0x1d60('0x38')]};return db[_0x1d60('0x28')][_0x1d60('0x1a')](_0xfa601a)[_0x1d60('0x21')](function(_0x20814d){_0x212f4f['count']=_0x20814d;if(_0x4487a8[_0x1d60('0x2d')]['includeAll']){_0x2b8eec[_0x1d60('0x3c')]=[{'all':!![]}];}return db[_0x1d60('0x28')][_0x1d60('0x3d')](_0x2b8eec);})[_0x1d60('0x21')](function(_0x16beb0){_0x212f4f['rows']=_0x16beb0;return _0x212f4f;})['then'](respondWithFilteredResult(_0xfd94f6,_0x2b8eec))[_0x1d60('0x3e')](handleError(_0xfd94f6,null));};exports[_0x1d60('0x3f')]=function(_0xc79a80,_0x515040){var _0x526909={'raw':!![],'where':{'id':_0xc79a80['params']['id']}},_0x58c8b4={};_0x58c8b4[_0x1d60('0x2c')]=_[_0x1d60('0x2e')](db['ChatTransferReport'][_0x1d60('0x29')]);_0x58c8b4[_0x1d60('0x2d')]=_['keys'](_0xc79a80[_0x1d60('0x2d')]);_0x58c8b4[_0x1d60('0x2f')]=_[_0x1d60('0x30')](_0x58c8b4['model'],_0x58c8b4[_0x1d60('0x2d')]);_0x526909[_0x1d60('0x31')]=_[_0x1d60('0x30')](_0x58c8b4[_0x1d60('0x2c')],qs[_0x1d60('0x32')](_0xc79a80[_0x1d60('0x2d')][_0x1d60('0x32')]));_0x526909['attributes']=_0x526909[_0x1d60('0x31')][_0x1d60('0x40')]?_0x526909[_0x1d60('0x31')]:_0x58c8b4[_0x1d60('0x2c')];if(_0xc79a80[_0x1d60('0x2d')][_0x1d60('0x41')]){_0x526909[_0x1d60('0x3c')]=[{'all':!![]}];}_0x526909=_['merge']({},_0x526909,_0xc79a80[_0x1d60('0x3b')]);return db[_0x1d60('0x28')][_0x1d60('0x42')](_0x526909)['then'](handleEntityNotFound(_0x515040,null))[_0x1d60('0x21')](respondWithResult(_0x515040,null))['catch'](handleError(_0x515040,null));};exports[_0x1d60('0x43')]=function(_0x256217,_0x353454){return db[_0x1d60('0x28')]['create'](_0x256217[_0x1d60('0x44')],{})[_0x1d60('0x21')](respondWithResult(_0x353454,0xc9))[_0x1d60('0x3e')](handleError(_0x353454,null));};exports[_0x1d60('0x20')]=function(_0x5a19e0,_0x2ed90d){if(_0x5a19e0[_0x1d60('0x44')]['id']){delete _0x5a19e0[_0x1d60('0x44')]['id'];}return db[_0x1d60('0x28')][_0x1d60('0x42')]({'where':{'id':_0x5a19e0[_0x1d60('0x45')]['id']}})[_0x1d60('0x21')](handleEntityNotFound(_0x2ed90d,null))[_0x1d60('0x21')](saveUpdates(_0x5a19e0[_0x1d60('0x44')],null))[_0x1d60('0x21')](respondWithResult(_0x2ed90d,null))[_0x1d60('0x3e')](handleError(_0x2ed90d,null));};exports[_0x1d60('0x22')]=function(_0x41ee75,_0xc86171){return db[_0x1d60('0x28')][_0x1d60('0x42')]({'where':{'id':_0x41ee75[_0x1d60('0x45')]['id']}})['then'](handleEntityNotFound(_0xc86171,null))[_0x1d60('0x21')](removeEntity(_0xc86171,null))[_0x1d60('0x3e')](handleError(_0xc86171,null));};exports['describe']=function(_0xab68be,_0x4fd8e5){return db[_0x1d60('0x28')][_0x1d60('0x46')]()[_0x1d60('0x21')](respondWithResult(_0x4fd8e5,null))['catch'](handleError(_0x4fd8e5,null));}; \ No newline at end of file +var _0x2206=['map','ChatTransferReport','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','include','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','index'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x2206,0xb4));var _0x6220=function(_0x4f7a06,_0x374bc5){_0x4f7a06=_0x4f7a06-0x0;var _0x5bb53e=_0x2206[_0x4f7a06];return _0x5bb53e;};'use strict';var emlformat=require(_0x6220('0x0'));var rimraf=require(_0x6220('0x1'));var zipdir=require(_0x6220('0x2'));var jsonpatch=require(_0x6220('0x3'));var rp=require('request-promise');var moment=require(_0x6220('0x4'));var BPromise=require(_0x6220('0x5'));var Mustache=require(_0x6220('0x6'));var util=require(_0x6220('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6220('0x8'));var ejs=require(_0x6220('0x9'));var fs=require('fs');var fs_extra=require(_0x6220('0xa'));var _=require(_0x6220('0xb'));var squel=require(_0x6220('0xc'));var crypto=require(_0x6220('0xd'));var jsforce=require(_0x6220('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6220('0x8'));var querystring=require('querystring');var Papa=require(_0x6220('0xf'));var Redis=require(_0x6220('0x10'));var authService=require(_0x6220('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6220('0x12'));var logger=require('../../config/logger')(_0x6220('0x13'));var utils=require('../../config/utils');var config=require(_0x6220('0x14'));var licenseUtil=require(_0x6220('0x15'));var db=require(_0x6220('0x16'))['db'];function respondWithStatusCode(_0x4b5fa4,_0x10a383){_0x10a383=_0x10a383||0xcc;return function(_0x5ceba9){if(_0x5ceba9){return _0x4b5fa4['sendStatus'](_0x10a383);}return _0x4b5fa4[_0x6220('0x17')](_0x10a383)[_0x6220('0x18')]();};}function respondWithResult(_0x2e5c7a,_0x257aed){_0x257aed=_0x257aed||0xc8;return function(_0x2cc6bc){if(_0x2cc6bc){return _0x2e5c7a[_0x6220('0x17')](_0x257aed)[_0x6220('0x19')](_0x2cc6bc);}};}function respondWithFilteredResult(_0x56bcbb,_0x4086ee){return function(_0x41a2ca){if(_0x41a2ca){var _0x4abd1b=typeof _0x4086ee[_0x6220('0x1a')]===_0x6220('0x1b')&&typeof _0x4086ee[_0x6220('0x1c')]===_0x6220('0x1b');var _0x5aa89c=_0x41a2ca[_0x6220('0x1d')];var _0x58aaa2=_0x4abd1b?0x0:_0x4086ee['offset'];var _0x1360a1=_0x4abd1b?_0x41a2ca[_0x6220('0x1d')]:_0x4086ee['offset']+_0x4086ee[_0x6220('0x1c')];var _0x2431ce;if(_0x1360a1>=_0x5aa89c){_0x1360a1=_0x5aa89c;_0x2431ce=0xc8;}else{_0x2431ce=0xce;}_0x56bcbb[_0x6220('0x17')](_0x2431ce);return _0x56bcbb[_0x6220('0x1e')](_0x6220('0x1f'),_0x58aaa2+'-'+_0x1360a1+'/'+_0x5aa89c)['json'](_0x41a2ca);}return null;};}function patchUpdates(_0x21a52e){return function(_0x4b3c86){try{jsonpatch['apply'](_0x4b3c86,_0x21a52e,!![]);}catch(_0x2feba1){return BPromise[_0x6220('0x20')](_0x2feba1);}return _0x4b3c86[_0x6220('0x21')]();};}function saveUpdates(_0x2cf352,_0x13dbb1){return function(_0xa96300){if(_0xa96300){return _0xa96300[_0x6220('0x22')](_0x2cf352)[_0x6220('0x23')](function(_0x328a97){return _0x328a97;});}return null;};}function removeEntity(_0x242f06,_0x49f4cc){return function(_0x17a1cc){if(_0x17a1cc){return _0x17a1cc[_0x6220('0x24')]()[_0x6220('0x23')](function(){_0x242f06[_0x6220('0x17')](0xcc)[_0x6220('0x18')]();});}};}function handleEntityNotFound(_0x4f4c8e,_0xe3b8b8){return function(_0x5be76e){if(!_0x5be76e){_0x4f4c8e[_0x6220('0x25')](0x194);}return _0x5be76e;};}function handleError(_0x46b017,_0x3cdd76){_0x3cdd76=_0x3cdd76||0x1f4;return function(_0x3ba14f){logger[_0x6220('0x26')](_0x3ba14f['stack']);if(_0x3ba14f[_0x6220('0x27')]){delete _0x3ba14f[_0x6220('0x27')];}_0x46b017[_0x6220('0x17')](_0x3cdd76)[_0x6220('0x28')](_0x3ba14f);};}exports[_0x6220('0x29')]=function(_0x50f87f,_0x498f88){var _0x56d7d5={},_0x3e0e31={},_0x16646d={'count':0x0,'rows':[]};var _0x1777f5=_[_0x6220('0x2a')](db[_0x6220('0x2b')][_0x6220('0x2c')],function(_0x4024c5){return{'name':_0x4024c5['fieldName'],'type':_0x4024c5[_0x6220('0x2d')][_0x6220('0x2e')]};});_0x3e0e31['model']=_['map'](_0x1777f5,_0x6220('0x27'));_0x3e0e31[_0x6220('0x2f')]=_[_0x6220('0x30')](_0x50f87f[_0x6220('0x2f')]);_0x3e0e31[_0x6220('0x31')]=_['intersection'](_0x3e0e31['model'],_0x3e0e31[_0x6220('0x2f')]);_0x56d7d5[_0x6220('0x32')]=_[_0x6220('0x33')](_0x3e0e31[_0x6220('0x34')],qs['fields'](_0x50f87f[_0x6220('0x2f')][_0x6220('0x35')]));_0x56d7d5[_0x6220('0x32')]=_0x56d7d5[_0x6220('0x32')][_0x6220('0x36')]?_0x56d7d5['attributes']:_0x3e0e31[_0x6220('0x34')];if(!_0x50f87f['query'][_0x6220('0x37')]('nolimit')){_0x56d7d5[_0x6220('0x1c')]=qs[_0x6220('0x1c')](_0x50f87f[_0x6220('0x2f')][_0x6220('0x1c')]);_0x56d7d5[_0x6220('0x1a')]=qs[_0x6220('0x1a')](_0x50f87f[_0x6220('0x2f')][_0x6220('0x1a')]);}_0x56d7d5['order']=qs[_0x6220('0x38')](_0x50f87f[_0x6220('0x2f')][_0x6220('0x38')]);_0x56d7d5['where']=qs[_0x6220('0x31')](_[_0x6220('0x39')](_0x50f87f['query'],_0x3e0e31[_0x6220('0x31')]),_0x1777f5);if(_0x50f87f[_0x6220('0x2f')][_0x6220('0x3a')]){_0x56d7d5['where']=_[_0x6220('0x3b')](_0x56d7d5['where'],{'$or':_[_0x6220('0x2a')](_0x1777f5,function(_0x5cf6c1){if(_0x5cf6c1[_0x6220('0x2d')]!==_0x6220('0x3c')){var _0x34746c={};_0x34746c[_0x5cf6c1['name']]={'$like':'%'+_0x50f87f['query'][_0x6220('0x3a')]+'%'};return _0x34746c;}})});}_0x56d7d5=_[_0x6220('0x3b')]({},_0x56d7d5,_0x50f87f[_0x6220('0x3d')]);var _0x38d597={'where':_0x56d7d5[_0x6220('0x3e')]};return db[_0x6220('0x2b')][_0x6220('0x1d')](_0x38d597)[_0x6220('0x23')](function(_0x5b691f){_0x16646d[_0x6220('0x1d')]=_0x5b691f;if(_0x50f87f['query'][_0x6220('0x3f')]){_0x56d7d5['include']=[{'all':!![]}];}return db[_0x6220('0x2b')][_0x6220('0x40')](_0x56d7d5);})['then'](function(_0x1ab5ef){_0x16646d[_0x6220('0x41')]=_0x1ab5ef;return _0x16646d;})[_0x6220('0x23')](respondWithFilteredResult(_0x498f88,_0x56d7d5))['catch'](handleError(_0x498f88,null));};exports[_0x6220('0x42')]=function(_0x5391a5,_0x39983f){var _0x5b5b7e={'raw':!![],'where':{'id':_0x5391a5['params']['id']}},_0x1da18b={};_0x1da18b[_0x6220('0x34')]=_[_0x6220('0x30')](db['ChatTransferReport'][_0x6220('0x2c')]);_0x1da18b['query']=_[_0x6220('0x30')](_0x5391a5[_0x6220('0x2f')]);_0x1da18b[_0x6220('0x31')]=_[_0x6220('0x33')](_0x1da18b[_0x6220('0x34')],_0x1da18b[_0x6220('0x2f')]);_0x5b5b7e['attributes']=_['intersection'](_0x1da18b[_0x6220('0x34')],qs[_0x6220('0x35')](_0x5391a5[_0x6220('0x2f')][_0x6220('0x35')]));_0x5b5b7e[_0x6220('0x32')]=_0x5b5b7e['attributes']['length']?_0x5b5b7e[_0x6220('0x32')]:_0x1da18b[_0x6220('0x34')];if(_0x5391a5[_0x6220('0x2f')][_0x6220('0x3f')]){_0x5b5b7e[_0x6220('0x43')]=[{'all':!![]}];}_0x5b5b7e=_[_0x6220('0x3b')]({},_0x5b5b7e,_0x5391a5['options']);return db['ChatTransferReport'][_0x6220('0x44')](_0x5b5b7e)['then'](handleEntityNotFound(_0x39983f,null))[_0x6220('0x23')](respondWithResult(_0x39983f,null))['catch'](handleError(_0x39983f,null));};exports[_0x6220('0x45')]=function(_0x44c9e2,_0x3c97fc){return db[_0x6220('0x2b')][_0x6220('0x45')](_0x44c9e2[_0x6220('0x46')],{})['then'](respondWithResult(_0x3c97fc,0xc9))[_0x6220('0x47')](handleError(_0x3c97fc,null));};exports[_0x6220('0x22')]=function(_0x38a941,_0x34b837){if(_0x38a941[_0x6220('0x46')]['id']){delete _0x38a941[_0x6220('0x46')]['id'];}return db[_0x6220('0x2b')][_0x6220('0x44')]({'where':{'id':_0x38a941['params']['id']}})[_0x6220('0x23')](handleEntityNotFound(_0x34b837,null))['then'](saveUpdates(_0x38a941[_0x6220('0x46')],null))[_0x6220('0x23')](respondWithResult(_0x34b837,null))[_0x6220('0x47')](handleError(_0x34b837,null));};exports[_0x6220('0x24')]=function(_0x386e38,_0x1a529a){return db[_0x6220('0x2b')][_0x6220('0x44')]({'where':{'id':_0x386e38[_0x6220('0x48')]['id']}})[_0x6220('0x23')](handleEntityNotFound(_0x1a529a,null))[_0x6220('0x23')](removeEntity(_0x1a529a,null))['catch'](handleError(_0x1a529a,null));};exports['describe']=function(_0x34f192,_0x4a9d4c){return db[_0x6220('0x2b')][_0x6220('0x49')]()[_0x6220('0x23')](respondWithResult(_0x4a9d4c,null))[_0x6220('0x47')](handleError(_0x4a9d4c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 844fee3..1d065fd 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 _0xa2ed=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','ChatTransferReport'];(function(_0x440388,_0x2f834f){var _0x51aec1=function(_0x3c6be3){while(--_0x3c6be3){_0x440388['push'](_0x440388['shift']());}};_0x51aec1(++_0x2f834f);}(_0xa2ed,0x160));var _0xda2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2ed[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda2e('0x0'));var util=require(_0xda2e('0x1'));var logger=require(_0xda2e('0x2'))(_0xda2e('0x3'));var moment=require(_0xda2e('0x4'));var BPromise=require(_0xda2e('0x5'));var rp=require(_0xda2e('0x6'));var fs=require('fs');var path=require(_0xda2e('0x7'));var rimraf=require(_0xda2e('0x8'));var config=require(_0xda2e('0x9'));var attributes=require(_0xda2e('0xa'));module['exports']=function(_0x3efef8,_0x204257){return _0x3efef8['define'](_0xda2e('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xda2e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5309=['uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5309,0x194));var _0x9530=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0x5309[_0x152121];return _0x592a85;};'use strict';var _=require(_0x9530('0x0'));var util=require('util');var logger=require(_0x9530('0x1'))('api');var moment=require(_0x9530('0x2'));var BPromise=require(_0x9530('0x3'));var rp=require(_0x9530('0x4'));var fs=require('fs');var path=require(_0x9530('0x5'));var rimraf=require(_0x9530('0x6'));var config=require(_0x9530('0x7'));var attributes=require(_0x9530('0x8'));module[_0x9530('0x9')]=function(_0x2866b8,_0x8be154){return _0x2866b8[_0x9530('0xa')](_0x9530('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9530('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index d5769fa..a75993c 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 _0xe7b5=['then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0xe7b5,0x181));var _0x5e7b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe7b5[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5e7b('0x0'));var util=require(_0x5e7b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5e7b('0x2'));var fs=require('fs');var Redis=require(_0x5e7b('0x3'));var db=require(_0x5e7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e7b('0x5'))(_0x5e7b('0x6'));var config=require(_0x5e7b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5e7b('0x8')][_0x5e7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xced639,_0x20803e,_0x2eb302){return new BPromise(function(_0x4feb49,_0x1266b0){return client[_0x5e7b('0xa')](_0xced639,_0x2eb302)[_0x5e7b('0xb')](function(_0x2ab0fc){logger[_0x5e7b('0xc')](_0x5e7b('0xd'),_0x20803e,_0x5e7b('0xe'));logger['debug'](_0x5e7b('0xf'),_0x20803e,_0x5e7b('0xe'),JSON[_0x5e7b('0x10')](_0x2ab0fc));if(_0x2ab0fc[_0x5e7b('0x11')]){if(_0x2ab0fc['error'][_0x5e7b('0x12')]===0x1f4){logger[_0x5e7b('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x20803e,_0x2ab0fc[_0x5e7b('0x11')][_0x5e7b('0x13')]);return _0x1266b0(_0x2ab0fc[_0x5e7b('0x11')][_0x5e7b('0x13')]);}logger[_0x5e7b('0x11')](_0x5e7b('0xd'),_0x20803e,_0x2ab0fc[_0x5e7b('0x11')][_0x5e7b('0x13')]);return _0x4feb49(_0x2ab0fc['error'][_0x5e7b('0x13')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x20803e,_0x5e7b('0xe'));_0x4feb49(_0x2ab0fc[_0x5e7b('0x14')][_0x5e7b('0x13')]);}})[_0x5e7b('0x15')](function(_0x1c3e8a){logger[_0x5e7b('0x11')](_0x5e7b('0xd'),_0x20803e,_0x1c3e8a);_0x1266b0(_0x1c3e8a);});});} \ No newline at end of file +var _0x4a5a=['result','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','request\x20sent','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info'];(function(_0x706386,_0x331fc5){var _0xe84508=function(_0x4c4ea8){while(--_0x4c4ea8){_0x706386['push'](_0x706386['shift']());}};_0xe84508(++_0x331fc5);}(_0x4a5a,0xab));var _0xa4a5=function(_0x26711c,_0x27c8a2){_0x26711c=_0x26711c-0x0;var _0x10c844=_0x4a5a[_0x26711c];return _0x10c844;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa4a5('0x0'));var BPromise=require(_0xa4a5('0x1'));var rs=require(_0xa4a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4a5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4a5('0x4'))(_0xa4a5('0x5'));var config=require('../../config/environment');var jayson=require(_0xa4a5('0x6'));var client=jayson['client'][_0xa4a5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cea64,_0x266d58,_0x2aa1cb){return new BPromise(function(_0x598775,_0x56cc75){return client[_0xa4a5('0x8')](_0x5cea64,_0x2aa1cb)['then'](function(_0x2fee3a){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x266d58,_0xa4a5('0x9'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x266d58,_0xa4a5('0x9'),JSON[_0xa4a5('0xa')](_0x2fee3a));if(_0x2fee3a['error']){if(_0x2fee3a[_0xa4a5('0xb')][_0xa4a5('0xc')]===0x1f4){logger['error'](_0xa4a5('0xd'),_0x266d58,_0x2fee3a[_0xa4a5('0xb')][_0xa4a5('0xe')]);return _0x56cc75(_0x2fee3a[_0xa4a5('0xb')]['message']);}logger['error'](_0xa4a5('0xd'),_0x266d58,_0x2fee3a[_0xa4a5('0xb')][_0xa4a5('0xe')]);return _0x598775(_0x2fee3a[_0xa4a5('0xb')][_0xa4a5('0xe')]);}else{logger[_0xa4a5('0xf')](_0xa4a5('0xd'),_0x266d58,_0xa4a5('0x9'));_0x598775(_0x2fee3a[_0xa4a5('0x10')][_0xa4a5('0xe')]);}})['catch'](function(_0x151e6b){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x266d58,_0x151e6b);_0x56cc75(_0x151e6b);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 14154ab..e4d1303 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 _0xb2eb=['isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0xb2eb,0x15f));var _0xbb2e=function(_0x3af62e,_0x2d5e42){_0x3af62e=_0x3af62e-0x0;var _0x46e8ad=_0xb2eb[_0x3af62e];return _0x46e8ad;};'use strict';var multer=require(_0xbb2e('0x0'));var util=require(_0xbb2e('0x1'));var path=require(_0xbb2e('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb2e('0x3'));var router=express['Router']();var fs_extra=require(_0xbb2e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb2e('0x5'));var config=require(_0xbb2e('0x6'));var controller=require(_0xbb2e('0x7'));router[_0xbb2e('0x8')]('/',auth[_0xbb2e('0x9')](),controller[_0xbb2e('0xa')]);router[_0xbb2e('0x8')]('/describe',auth[_0xbb2e('0x9')](),controller[_0xbb2e('0xb')]);router[_0xbb2e('0x8')](_0xbb2e('0xc'),auth[_0xbb2e('0x9')](),controller[_0xbb2e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb2e('0xe')]);router[_0xbb2e('0xf')](_0xbb2e('0xc'),auth[_0xbb2e('0x9')](),controller[_0xbb2e('0x10')]);router[_0xbb2e('0x11')](_0xbb2e('0xc'),auth['isAuthenticated'](),controller[_0xbb2e('0x12')]);module[_0xbb2e('0x13')]=router; \ No newline at end of file +var _0x1587=['isAuthenticated','index','get','/describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1587,0x186));var _0x7158=function(_0xeb6b6d,_0x4b60e2){_0xeb6b6d=_0xeb6b6d-0x0;var _0x4bc246=_0x1587[_0xeb6b6d];return _0x4bc246;};'use strict';var multer=require(_0x7158('0x0'));var util=require(_0x7158('0x1'));var path=require(_0x7158('0x2'));var timeout=require(_0x7158('0x3'));var express=require('express');var router=express[_0x7158('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7158('0x5'));var interaction=require(_0x7158('0x6'));var config=require(_0x7158('0x7'));var controller=require(_0x7158('0x8'));router['get']('/',auth[_0x7158('0x9')](),controller[_0x7158('0xa')]);router[_0x7158('0xb')](_0x7158('0xc'),auth[_0x7158('0x9')](),controller['describe']);router[_0x7158('0xb')]('/:id',auth[_0x7158('0x9')](),controller[_0x7158('0xd')]);router[_0x7158('0xe')]('/',auth[_0x7158('0x9')](),controller[_0x7158('0xf')]);router['put'](_0x7158('0x10'),auth['isAuthenticated'](),controller[_0x7158('0x11')]);router[_0x7158('0x12')]('/:id',auth[_0x7158('0x9')](),controller[_0x7158('0x13')]);module[_0x7158('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index f6bd08d..736756c 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 _0x3c81=['bottom_right','alternate','#fafafa','System','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','input','parse','getDataValue','setDataValue','onlineForm','textarea','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias'];(function(_0x27e3a8,_0x2254ce){var _0x52f610=function(_0x45c553){while(--_0x45c553){_0x27e3a8['push'](_0x27e3a8['shift']());}};_0x52f610(++_0x2254ce);}(_0x3c81,0x102));var _0x13c8=function(_0x472d63,_0x176a93){_0x472d63=_0x472d63-0x0;var _0x281cc7=_0x3c81[_0x472d63];return _0x281cc7;};'use strict';var Sequelize=require(_0x13c8('0x0'));var rs=require(_0x13c8('0x1'));module['exports']={'name':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x3')},'key':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x4')},'customerAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x13c8('0x2')]},'animation':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x13c8('0x8')](_0x13c8('0x9'),_0x13c8('0xa')),'defaultValue':_0x13c8('0x9')},'header_online':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xb')},'start_chat_button':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xc')},'header_offline':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x13c8('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x11')},'placeholderMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x12')},'closingMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x13')},'closingMessageButton':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xc')},'skipMessageButton':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x14')},'conditionAgreement':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x13c8('0x16'),_0x13c8('0x17')),'defaultValue':_0x13c8('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':function(){return JSON[_0x13c8('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x13c8('0x19'),'type':_0x13c8('0x1a'),'required':!![]},'props':{'title':_0x13c8('0x19'),'helpText':''}},{'type':_0x13c8('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x13c8('0x3'),'type':_0x13c8('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x13c8('0x1c')](this[_0x13c8('0x1d')]('onlineForm')):{};},'set':function(_0x5ad0dc){return this[_0x13c8('0x1e')](_0x13c8('0x1f'),JSON['stringify'](_0x5ad0dc));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x13c8('0x18')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x13c8('0x3'),'type':_0x13c8('0x3')},'variable':null},{'type':_0x13c8('0x20'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x13c8('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x13c8('0x1d')](_0x13c8('0x22'))?JSON[_0x13c8('0x1c')](this[_0x13c8('0x1d')](_0x13c8('0x22'))):{};},'set':function(_0x343080){return this['setDataValue'](_0x13c8('0x22'),JSON[_0x13c8('0x18')](_0x343080));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x13c8('0x2')]},'forwardOffline':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x23')},'waitingMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x25')},'offlineMessageBody':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x27')},'skipUnmanaged':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x13c8('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x13c8('0x2')]},'notificationTemplate':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':function(){return _0x13c8('0x28');}},'notificationSound':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x2a')},'verticalAlignment':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x2b')},'defaultTitle':{'type':Sequelize[_0x13c8('0x2')]},'customerAvatar':{'type':Sequelize[_0x13c8('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x13c8('0x6')],'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[_0x13c8('0x2')],'defaultValue':_0x13c8('0x2d')},'systemAvatar':{'type':Sequelize[_0x13c8('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x13c8('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x343dba){if(!_0x343dba)this[_0x13c8('0x1e')](_0x13c8('0x2e'),null);this[_0x13c8('0x1e')](_0x13c8('0x2f'),_0x343dba);}},'vidaooEscalation':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x13c8('0x2')]},'vidaooTopic':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x30')},'vidaooNote':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':function(){return _0x13c8('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x13c8('0xe')]}}; \ No newline at end of file +var _0xec56=['#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','name','text','input','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#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}}','sequelize','STRING','address','email','Agent'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xec56,0x1bd));var _0x6ec5=function(_0x10dfc1,_0x35aa54){_0x10dfc1=_0x10dfc1-0x0;var _0x56cab4=_0xec56[_0x10dfc1];return _0x56cab4;};'use strict';var Sequelize=require(_0x6ec5('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'unique':_0x6ec5('0x2')},'description':{'type':Sequelize[_0x6ec5('0x1')]},'mapKey':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x3')},'mapKeyOffline':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x3')},'key':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x4')},'customerAlias':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':_0x6ec5('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':_0x6ec5('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':_0x6ec5('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6ec5('0x1')]},'animation':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6ec5('0x9')](_0x6ec5('0xa'),_0x6ec5('0xb')),'defaultValue':_0x6ec5('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x6ec5('0xc')},'start_chat_button':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xd')},'offline_chat_button':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xe')},'header_offline':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xf')},'download_transcript':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6ec5('0x10')]},'closingQuestion':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x12')},'noteTitle':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x13')},'placeholderMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x14')},'closingMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x15')},'closingMessageButton':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xe')},'skipMessageButton':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x16')},'conditionAgreement':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x6ec5('0x9')](_0x6ec5('0x17'),_0x6ec5('0x18')),'defaultValue':_0x6ec5('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6ec5('0x10')],'defaultValue':function(){return JSON[_0x6ec5('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6ec5('0x1a'),'type':_0x6ec5('0x1b'),'required':!![]},'props':{'title':_0x6ec5('0x1a'),'helpText':''}},{'type':_0x6ec5('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x6ec5('0x3'),'type':_0x6ec5('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x6ec5('0x1d'))?JSON[_0x6ec5('0x1e')](this[_0x6ec5('0x1f')]('onlineForm')):{};},'set':function(_0x1b779a){return this[_0x6ec5('0x20')](_0x6ec5('0x1d'),JSON[_0x6ec5('0x19')](_0x1b779a));}},'offlineForm':{'type':Sequelize[_0x6ec5('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x6ec5('0x1c'),'props':{'title':_0x6ec5('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6ec5('0x3')},'variable':null},{'type':_0x6ec5('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0x6ec5('0x22'),'helpText':_0x6ec5('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x6ec5('0x1f')](_0x6ec5('0x24'))?JSON[_0x6ec5('0x1e')](this['getDataValue'](_0x6ec5('0x24'))):{};},'set':function(_0x179f57){return this[_0x6ec5('0x20')](_0x6ec5('0x24'),JSON[_0x6ec5('0x19')](_0x179f57));}},'token':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':function(){return rs[_0x6ec5('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6ec5('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6ec5('0x1')]},'waitingTitle':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6ec5('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x28')},'skipUnmanaged':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x16')},'sendUnmanaged':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6ec5('0x10')],'defaultValue':function(){return _0x6ec5('0x29');}},'notificationSound':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ec5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x2b')},'verticalAlignment':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x6ec5('0x1')]},'customerAvatar':{'type':Sequelize[_0x6ec5('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![],'defaultValue':_0x6ec5('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6ec5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':_0x6ec5('0x2d')},'systemAvatar':{'type':Sequelize[_0x6ec5('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ec5('0x7')],'comment':_0x6ec5('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![],'comment':_0x6ec5('0x2f'),'set':function(_0x53dcd8){if(!_0x53dcd8)this[_0x6ec5('0x20')]('mandatoryDispositionPauseId',null);this[_0x6ec5('0x20')]('mandatoryDisposition',_0x53dcd8);}},'vidaooEscalation':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6ec5('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6ec5('0x30')},'vidaooNote':{'type':Sequelize[_0x6ec5('0x1')],'defaultValue':function(){return _0x6ec5('0x31');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6ec5('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6ec5('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 845fe66..78562bf 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 _0x2c54=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','List','account','list','applications','orderBy','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','push','close','ChatMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','CompanyId','mapKeyOffline','send','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','Contact','User','fullname','internal','Tag','Tags','tag','getProactiveActions','virtual','License','increment','server/files/chat/iframe.ejs','URL','address','origin','3.2.0','remote','x-real-ip','connection','replace','render','alignment','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','bulkCreate','priority','stack','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','url','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','update','destroy','name','Command','getSnippet','format','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','map','Interval','all','some','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','includeAll','include','findAll','rows','show','keys','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ChatWebsites','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','pick','ChatWebsiteId','removeDispositions','addAnswer','CannedAnswer','removeAnswers','addLogo','filename','addAvatar','agentAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','sitepic','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','download','getSystemAvatar','notify','chat','CmContact','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x558156,_0x544275){var _0x56773e=function(_0x4eb18c){while(--_0x4eb18c){_0x558156['push'](_0x558156['shift']());}};_0x56773e(++_0x544275);}(_0x2c54,0x1bd));var _0x42c5=function(_0x7bd4f5,_0x3a109c){_0x7bd4f5=_0x7bd4f5-0x0;var _0x5a670a=_0x2c54[_0x7bd4f5];return _0x5a670a;};'use strict';var Mustache=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var path=require(_0x42c5('0x2'));var ejs=require(_0x42c5('0x3'));var fs=require('fs');var fs_extra=require(_0x42c5('0x4'));var _=require(_0x42c5('0x5'));var querystring=require(_0x42c5('0x6'));var htmlToText=require(_0x42c5('0x7'));var Redis=require(_0x42c5('0x8'));var jayson=require('jayson/promise');var url=require(_0x42c5('0x9'));var qs=require(_0x42c5('0xa'));var logger=require(_0x42c5('0xb'))(_0x42c5('0xc'));var config=require(_0x42c5('0xd'));var APIOutOfIntervalError=require(_0x42c5('0xe'))[_0x42c5('0xf')];var APINotFoundError=require(_0x42c5('0xe'))[_0x42c5('0x10')];var APIHandleError=require(_0x42c5('0xe'))['handleError'];var db=require(_0x42c5('0x11'))['db'];config[_0x42c5('0x12')]=_[_0x42c5('0x13')](config[_0x42c5('0x12')],{'host':_0x42c5('0x14'),'port':0x18eb});var socket=require(_0x42c5('0x15'))(new Redis(config['redis']));require(_0x42c5('0x16'))[_0x42c5('0x17')](socket);var client=jayson[_0x42c5('0x18')]['http']({'port':0x232c});var client9002=jayson[_0x42c5('0x18')][_0x42c5('0x19')]({'port':0x232a});var client9003=jayson[_0x42c5('0x18')][_0x42c5('0x19')]({'port':0x232b});var client9001=jayson[_0x42c5('0x18')][_0x42c5('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x43aaca,_0x35bdac,_0x2b74f4,_0x3042f2){return new Promise(function(_0x24cc02,_0x3af725){var _0x13ac0a=_0x3042f2||client;return _0x13ac0a[_0x42c5('0x1a')](_0x43aaca,_0x2b74f4)[_0x42c5('0x1b')](function(_0x3b4294){logger[_0x42c5('0x1c')](_0x42c5('0x1d'),_0x35bdac,_0x42c5('0x1e'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x35bdac,_0x42c5('0x1e'),JSON[_0x42c5('0x1f')](_0x3b4294));if(_0x3b4294[_0x42c5('0x20')]){if(_0x3b4294[_0x42c5('0x20')]['code']===0x1f4){logger[_0x42c5('0x20')]('ChatWebsite,\x20%s,\x20%s',_0x35bdac,_0x3b4294['error']['message']);return _0x3af725(_0x3b4294[_0x42c5('0x20')][_0x42c5('0x21')]);}logger[_0x42c5('0x20')](_0x42c5('0x1d'),_0x35bdac,_0x3b4294[_0x42c5('0x20')][_0x42c5('0x21')]);return _0x24cc02(_0x3b4294['error']['message']);}else{logger[_0x42c5('0x1c')](_0x42c5('0x1d'),_0x35bdac,_0x42c5('0x1e'));_0x24cc02(_0x3b4294[_0x42c5('0x22')][_0x42c5('0x21')]);}})[_0x42c5('0x23')](function(_0x1bd7ae){logger[_0x42c5('0x20')](_0x42c5('0x1d'),_0x35bdac,_0x1bd7ae);_0x3af725(_0x1bd7ae);});});}function respondWithStatusCode(_0x37cc80,_0x5eaee7){_0x5eaee7=_0x5eaee7||0xcc;return function(_0xb71ac6){if(_0xb71ac6){return _0x37cc80[_0x42c5('0x24')](_0x5eaee7);}return _0x37cc80[_0x42c5('0x25')](_0x5eaee7)[_0x42c5('0x26')]();};}function respondWithResult(_0x419b0c,_0x18c78e){_0x18c78e=_0x18c78e||0xc8;return function(_0x33811e){if(_0x33811e){return _0x419b0c[_0x42c5('0x25')](_0x18c78e)[_0x42c5('0x27')](_0x33811e);}};}function respondWithFilteredResult(_0x4f44e1,_0x1f92c5){return function(_0x38c3d6){if(_0x38c3d6){var _0x5ee432=typeof _0x1f92c5[_0x42c5('0x28')]==='undefined'&&typeof _0x1f92c5[_0x42c5('0x29')]===_0x42c5('0x2a');var _0x431321=_0x38c3d6[_0x42c5('0x2b')];var _0x556abb=_0x5ee432?0x0:_0x1f92c5[_0x42c5('0x28')];var _0x1794a1=_0x5ee432?_0x38c3d6[_0x42c5('0x2b')]:_0x1f92c5[_0x42c5('0x28')]+_0x1f92c5[_0x42c5('0x29')];var _0x49d196;if(_0x1794a1>=_0x431321){_0x1794a1=_0x431321;_0x49d196=0xc8;}else{_0x49d196=0xce;}_0x4f44e1[_0x42c5('0x25')](_0x49d196);return _0x4f44e1[_0x42c5('0x2c')]('Content-Range',_0x556abb+'-'+_0x1794a1+'/'+_0x431321)['json'](_0x38c3d6);}return null;};}function saveUpdates(_0x5416ed){return function(_0x5e2e95){if(_0x5e2e95){return _0x5e2e95[_0x42c5('0x2d')](_0x5416ed)[_0x42c5('0x1b')](function(_0x2da63d){return _0x2da63d;});}return null;};}function removeEntity(_0x51dc9e){return function(_0x5edb05){if(_0x5edb05){return _0x5edb05[_0x42c5('0x2e')]()[_0x42c5('0x1b')](function(){var _0x1665ff=_0x5edb05['get']({'plain':!![]});var _0x32c2be='ChatWebsites';return db['UserProfileResource']['destroy']({'where':{'type':_0x32c2be,'resourceId':_0x1665ff['id']}})['then'](function(){return _0x5edb05;});})['then'](function(){_0x51dc9e[_0x42c5('0x25')](0xcc)[_0x42c5('0x26')]();});}};}function handleEntityNotFound(_0x40aa6e){return function(_0x5cad40){if(!_0x5cad40){_0x40aa6e[_0x42c5('0x24')](0x194);}return _0x5cad40;};}function handleError(_0x31ab8d,_0x35fe98){_0x35fe98=_0x35fe98||0x1f4;return function(_0x2763ac){logger[_0x42c5('0x20')](_0x2763ac['stack']);if(_0x2763ac[_0x42c5('0x2f')]){delete _0x2763ac[_0x42c5('0x2f')];}_0x31ab8d[_0x42c5('0x25')](_0x35fe98)['send'](_0x2763ac);};}function iftimePromise(_0xcd2c5,_0x342ae5){return respondWithRpcPromise(_0x42c5('0x30'),_0x42c5('0x31'),{'command':_0x342ae5['timezone']?util[_0x42c5('0x32')]('iftime\x20%s,%s',_0xcd2c5[_0x42c5('0x33')],_0x342ae5['timezone']):util['format'](_0x42c5('0x34'),_0xcd2c5[_0x42c5('0x33')])},client9002)[_0x42c5('0x1b')](function(_0x286769){var _0x84236a=_0x286769&&_0x286769['indexOf']('true')>=0x0?!![]:![];logger['info'](_0x42c5('0x35'),_0x342ae5['id'],_0xcd2c5['id'],_0xcd2c5[_0x42c5('0x33')],_0x84236a?_0x42c5('0x36'):_0x42c5('0x37'),_0x342ae5[_0x42c5('0x38')]?_0x342ae5[_0x42c5('0x38')]:_0x42c5('0x39'));return _0x84236a;})[_0x42c5('0x23')](function(_0x4accc3){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x342ae5['id'],_0xcd2c5['id'],_0xcd2c5[_0x42c5('0x33')],util[_0x42c5('0x3a')](_0x4accc3,{'showHidden':![],'depth':null}),_0x342ae5[_0x42c5('0x38')]?_0x342ae5['timezone']:_0x42c5('0x39'));return![];});}function checkWebsiteIntervals(_0x438a7c){var _0x1c21a0=_[_0x42c5('0x3b')](_0x438a7c[_0x42c5('0x3c')]['Intervals'],function(_0x573cb2){var _0x259348=_0x573cb2['get']({'plain':!![]});return iftimePromise(_0x259348,_0x438a7c);});return Promise[_0x42c5('0x3d')](_0x1c21a0)[_0x42c5('0x1b')](function(_0x370fc7){return _[_0x42c5('0x3e')](_0x370fc7);});}function createInteractionObject(_0x5a131c,_0x2f11be,_0x105886,_0x2ff203){var _0x3c73ae=require(_0x42c5('0x3f'));var _0x27f1b1=new _0x3c73ae();var _0x519d10=_0x27f1b1[_0x42c5('0x40')](_0x105886[_0x42c5('0x41')])[_0x42c5('0x42')]();var _0x4ce959=_0x2f11be[_0x42c5('0x43')];if(_0x105886[_0x42c5('0x44')]){_0x4ce959=_0x105886[_0x42c5('0x44')];}else if(_0x105886[_0x42c5('0x45')]){_0x4ce959=_[_0x42c5('0x46')](_0x105886[_0x42c5('0x45')][_0x42c5('0x47')](','));}return{'ContactId':_0x2ff203['id'],'ChatWebsiteId':_0x5a131c,'from':(_0x2ff203[_0x42c5('0x48')]||'')+'\x20'+(_0x2ff203[_0x42c5('0x49')]||''),'customerIp':_0x4ce959,'customerPort':_0x105886['x-real-port']?_0x105886[_0x42c5('0x4a')]:null,'referer':_0x2f11be[_0x42c5('0x4b')],'browserName':_0x519d10[_0x42c5('0x4c')]['name']&&_0x519d10[_0x42c5('0x4c')][_0x42c5('0x4d')]?util[_0x42c5('0x32')](_0x42c5('0x4e'),_0x519d10[_0x42c5('0x4c')]['name'],_0x519d10[_0x42c5('0x4c')]['version']):'unknown','browserVersion':_0x519d10[_0x42c5('0x4c')]['version']||'unknown','osName':util['format'](_0x42c5('0x4e'),_0x519d10['os'][_0x42c5('0x2f')],_0x519d10['os'][_0x42c5('0x4d')]),'osVersion':_0x519d10['os']['version'],'deviceModel':_0x519d10[_0x42c5('0x4f')][_0x42c5('0x50')]&&_0x519d10['device'][_0x42c5('0x51')]?util[_0x42c5('0x32')](_0x42c5('0x52'),_0x519d10[_0x42c5('0x4f')]['model'],_0x519d10[_0x42c5('0x4f')][_0x42c5('0x51')],_0x519d10['device']['type']):null,'deviceVendor':_0x519d10[_0x42c5('0x4f')][_0x42c5('0x51')],'deviceType':_0x519d10[_0x42c5('0x4f')][_0x42c5('0x53')],'formData':JSON[_0x42c5('0x1f')](_0x2f11be)};}exports['index']=function(_0x293831,_0x2d9986){var _0x5f099e={'include':[{'model':db[_0x42c5('0x54')],'as':_0x42c5('0x55')}]},_0x4146dd={},_0x517451={'count':0x0,'rows':[]};var _0x1caa0f=_[_0x42c5('0x3b')](db[_0x42c5('0x56')][_0x42c5('0x57')],function(_0x35ada3){return{'name':_0x35ada3[_0x42c5('0x58')],'type':_0x35ada3['type'][_0x42c5('0x59')]};});_0x4146dd[_0x42c5('0x50')]=_[_0x42c5('0x3b')](_0x1caa0f,_0x42c5('0x2f'));_0x4146dd[_0x42c5('0x5a')]=_['keys'](_0x293831['query']);_0x4146dd[_0x42c5('0x5b')]=_[_0x42c5('0x5c')](_0x4146dd[_0x42c5('0x50')],_0x4146dd[_0x42c5('0x5a')]);_0x5f099e[_0x42c5('0x5d')]=_[_0x42c5('0x5c')](_0x4146dd[_0x42c5('0x50')],qs[_0x42c5('0x5e')](_0x293831[_0x42c5('0x5a')][_0x42c5('0x5e')]));_0x5f099e[_0x42c5('0x5d')]=_0x5f099e['attributes'][_0x42c5('0x5f')]?_0x5f099e[_0x42c5('0x5d')]:_0x4146dd[_0x42c5('0x50')];if(!_0x293831[_0x42c5('0x5a')]['hasOwnProperty'](_0x42c5('0x60'))){_0x5f099e[_0x42c5('0x29')]=qs[_0x42c5('0x29')](_0x293831[_0x42c5('0x5a')][_0x42c5('0x29')]);_0x5f099e[_0x42c5('0x28')]=qs[_0x42c5('0x28')](_0x293831[_0x42c5('0x5a')][_0x42c5('0x28')]);}_0x5f099e[_0x42c5('0x61')]=qs[_0x42c5('0x62')](_0x293831[_0x42c5('0x5a')][_0x42c5('0x62')]);_0x5f099e[_0x42c5('0x63')]=qs[_0x42c5('0x5b')](_['pick'](_0x293831[_0x42c5('0x5a')],_0x4146dd[_0x42c5('0x5b')]),_0x1caa0f);if(_0x293831[_0x42c5('0x5a')][_0x42c5('0x64')]){_0x5f099e[_0x42c5('0x63')]=_['merge'](_0x5f099e[_0x42c5('0x63')],{'$or':_[_0x42c5('0x3b')](_0x1caa0f,function(_0x46a16e){if(_0x46a16e[_0x42c5('0x53')]!=='VIRTUAL'){var _0x2fad45={};_0x2fad45[_0x46a16e[_0x42c5('0x2f')]]={'$like':'%'+_0x293831[_0x42c5('0x5a')]['filter']+'%'};return _0x2fad45;}})});}_0x5f099e=_['merge']({},_0x5f099e,_0x293831['options']);var _0x1d9dc1={'where':_0x5f099e['where']};return db[_0x42c5('0x56')]['count'](_0x1d9dc1)[_0x42c5('0x1b')](function(_0x4f64b4){_0x517451[_0x42c5('0x2b')]=_0x4f64b4;if(_0x293831[_0x42c5('0x5a')][_0x42c5('0x65')]){_0x5f099e[_0x42c5('0x66')]=[{'all':!![]}];}return db[_0x42c5('0x56')][_0x42c5('0x67')](_0x5f099e);})[_0x42c5('0x1b')](function(_0x1844ea){_0x517451[_0x42c5('0x68')]=_0x1844ea;return _0x517451;})['then'](respondWithFilteredResult(_0x2d9986,_0x5f099e))[_0x42c5('0x23')](handleError(_0x2d9986,null));};exports[_0x42c5('0x69')]=function(_0x132429,_0x1d4771){var _0x2c0bc5={'raw':![],'where':{'id':_0x132429['params']['id']},'include':[{'model':db[_0x42c5('0x54')],'as':_0x42c5('0x55')}]},_0x2f60e1={};_0x2f60e1['model']=_[_0x42c5('0x6a')](db[_0x42c5('0x56')][_0x42c5('0x57')]);_0x2f60e1[_0x42c5('0x5a')]=_[_0x42c5('0x6a')](_0x132429[_0x42c5('0x5a')]);_0x2f60e1['filters']=_[_0x42c5('0x5c')](_0x2f60e1[_0x42c5('0x50')],_0x2f60e1['query']);_0x2c0bc5[_0x42c5('0x5d')]=_['intersection'](_0x2f60e1[_0x42c5('0x50')],qs[_0x42c5('0x5e')](_0x132429[_0x42c5('0x5a')]['fields']));_0x2c0bc5['attributes']=_0x2c0bc5[_0x42c5('0x5d')]['length']?_0x2c0bc5[_0x42c5('0x5d')]:_0x2f60e1[_0x42c5('0x50')];if(_0x132429[_0x42c5('0x5a')]['includeAll']){_0x2c0bc5[_0x42c5('0x66')]=[{'all':!![]}];}_0x2c0bc5=_[_0x42c5('0x6b')]({},_0x2c0bc5,_0x132429[_0x42c5('0x6c')]);return db[_0x42c5('0x56')][_0x42c5('0x6d')](_0x2c0bc5)[_0x42c5('0x1b')](handleEntityNotFound(_0x1d4771,null))['then'](respondWithResult(_0x1d4771,null))['catch'](handleError(_0x1d4771,null));};exports[_0x42c5('0x6e')]=function(_0x47d3fc,_0xeb8f0a){return db[_0x42c5('0x56')][_0x42c5('0x6e')](_0x47d3fc['body'],{})[_0x42c5('0x1b')](function(_0x225309){var _0x36abca=_0x47d3fc[_0x42c5('0x6f')]['get']({'plain':!![]});if(!_0x36abca)throw new Error(_0x42c5('0x70'));if(_0x36abca[_0x42c5('0x71')]===_0x42c5('0x6f')){var _0x4d915e=_0x225309[_0x42c5('0x72')]({'plain':!![]});var _0x1ea9c7=_0x42c5('0x73');return db['UserProfileSection'][_0x42c5('0x6d')]({'where':{'name':_0x1ea9c7,'userProfileId':_0x36abca[_0x42c5('0x74')]},'raw':!![]})[_0x42c5('0x1b')](function(_0x328615){if(_0x328615&&_0x328615[_0x42c5('0x75')]===0x0){return db[_0x42c5('0x76')][_0x42c5('0x6e')]({'name':_0x4d915e[_0x42c5('0x2f')],'resourceId':_0x4d915e['id'],'type':_0x328615[_0x42c5('0x2f')],'sectionId':_0x328615['id']},{})['then'](function(){return _0x225309;});}else{return _0x225309;}})[_0x42c5('0x23')](function(_0x52fb99){logger[_0x42c5('0x20')](_0x42c5('0x77'),_0x52fb99);throw _0x52fb99;});}return _0x225309;})[_0x42c5('0x1b')](respondWithResult(_0xeb8f0a,0xc9))[_0x42c5('0x23')](handleError(_0xeb8f0a,null));};exports[_0x42c5('0x2d')]=function(_0x289eee,_0x539d71){if(_0x289eee[_0x42c5('0x78')]['id']){delete _0x289eee['body']['id'];}return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x289eee[_0x42c5('0x79')]['id']},'include':[{'model':db[_0x42c5('0x54')],'as':'mandatoryDispositionPause'}]})[_0x42c5('0x1b')](handleEntityNotFound(_0x539d71,null))[_0x42c5('0x1b')](saveUpdates(_0x289eee['body'],null))[_0x42c5('0x1b')](respondWithResult(_0x539d71,null))[_0x42c5('0x23')](handleError(_0x539d71,null));};exports[_0x42c5('0x2e')]=function(_0x2484f0,_0x22901b){return db[_0x42c5('0x56')]['find']({'where':{'id':_0x2484f0[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x22901b,null))[_0x42c5('0x1b')](removeEntity(_0x22901b,null))[_0x42c5('0x23')](handleError(_0x22901b,null));};exports[_0x42c5('0x7a')]=function(_0x49444f,_0x5e0286){return db[_0x42c5('0x56')][_0x42c5('0x7a')]()[_0x42c5('0x1b')](respondWithResult(_0x5e0286,null))['catch'](handleError(_0x5e0286,null));};exports[_0x42c5('0x7b')]=function(_0x479627,_0x504af4){if(_0x479627[_0x42c5('0x78')]['id']){delete _0x479627['body']['id'];}return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x479627[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x504af4,null))[_0x42c5('0x1b')](function(_0x2b7244){if(_0x2b7244){_0x479627[_0x42c5('0x78')]['ChatWebsiteId']=_0x2b7244['id'];return db[_0x42c5('0x7c')][_0x42c5('0x6e')](_0x479627[_0x42c5('0x78')]);}})['then'](respondWithResult(_0x504af4,null))[_0x42c5('0x23')](handleError(_0x504af4,null));};exports[_0x42c5('0x7d')]=function(_0x4bc4a9,_0x536be0){var _0x526ae9={'raw':![],'where':{}};var _0x3dd09d={};var _0x40e192={'count':0x0,'rows':[]};return db[_0x42c5('0x56')][_0x42c5('0x7e')]({'where':{'id':_0x4bc4a9[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x536be0,null))[_0x42c5('0x1b')](function(_0xd74cda){if(_0xd74cda){_0x3dd09d[_0x42c5('0x50')]=_[_0x42c5('0x6a')](db[_0x42c5('0x7c')]['rawAttributes']);_0x3dd09d[_0x42c5('0x5a')]=_[_0x42c5('0x6a')](_0x4bc4a9['query']);_0x3dd09d[_0x42c5('0x5b')]=_[_0x42c5('0x5c')](_0x3dd09d['model'],_0x3dd09d[_0x42c5('0x5a')]);_0x526ae9[_0x42c5('0x5d')]=_[_0x42c5('0x5c')](_0x3dd09d[_0x42c5('0x50')],qs['fields'](_0x4bc4a9[_0x42c5('0x5a')]['fields']));_0x526ae9['attributes']=_0x526ae9[_0x42c5('0x5d')][_0x42c5('0x5f')]?_0x526ae9['attributes']:_0x3dd09d[_0x42c5('0x50')];if(!_0x4bc4a9['query'][_0x42c5('0x7f')](_0x42c5('0x60'))){_0x526ae9[_0x42c5('0x29')]=qs[_0x42c5('0x29')](_0x4bc4a9[_0x42c5('0x5a')][_0x42c5('0x29')]);_0x526ae9[_0x42c5('0x28')]=qs[_0x42c5('0x28')](_0x4bc4a9[_0x42c5('0x5a')]['offset']);}_0x526ae9[_0x42c5('0x61')]=qs['sort'](_0x4bc4a9['query'][_0x42c5('0x62')]);_0x526ae9['where']=qs[_0x42c5('0x5b')](_[_0x42c5('0x80')](_0x4bc4a9[_0x42c5('0x5a')],_0x3dd09d['filters']));_0x526ae9[_0x42c5('0x63')][_0x42c5('0x81')]=_0xd74cda['id'];if(_0x4bc4a9[_0x42c5('0x5a')][_0x42c5('0x64')]){_0x526ae9[_0x42c5('0x63')]=_[_0x42c5('0x6b')](_0x526ae9[_0x42c5('0x63')],{'$or':_[_0x42c5('0x3b')](_0x526ae9[_0x42c5('0x5d')],function(_0x5abf7c){var _0x424d68={};_0x424d68[_0x5abf7c]={'$like':'%'+_0x4bc4a9[_0x42c5('0x5a')][_0x42c5('0x64')]+'%'};return _0x424d68;})});}_0x526ae9=_[_0x42c5('0x6b')]({},_0x526ae9,_0x4bc4a9[_0x42c5('0x6c')]);return db['Disposition'][_0x42c5('0x2b')]({'where':_0x526ae9[_0x42c5('0x63')]})[_0x42c5('0x1b')](function(_0x3fa047){_0x40e192[_0x42c5('0x2b')]=_0x3fa047;if(_0x4bc4a9['query'][_0x42c5('0x65')]){_0x526ae9[_0x42c5('0x66')]=[{'all':!![]}];}return db[_0x42c5('0x7c')][_0x42c5('0x67')](_0x526ae9);})[_0x42c5('0x1b')](function(_0x30a9fb){_0x40e192['rows']=_0x30a9fb;return _0x40e192;});}})[_0x42c5('0x1b')](respondWithFilteredResult(_0x536be0,_0x526ae9))[_0x42c5('0x23')](handleError(_0x536be0,null));};exports[_0x42c5('0x82')]=function(_0x3659dc,_0x3ed78e){return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x3659dc[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x3ed78e,null))[_0x42c5('0x1b')](function(_0x429ec8){if(_0x429ec8){return _0x429ec8['removeDispositions'](_0x3659dc[_0x42c5('0x5a')]['ids']);}})[_0x42c5('0x1b')](respondWithStatusCode(_0x3ed78e,null))[_0x42c5('0x23')](handleError(_0x3ed78e,null));};exports[_0x42c5('0x83')]=function(_0x5a7274,_0x32da5d){if(_0x5a7274[_0x42c5('0x78')]['id']){delete _0x5a7274[_0x42c5('0x78')]['id'];}return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x5a7274['params']['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x32da5d,null))[_0x42c5('0x1b')](function(_0x43183c){if(_0x43183c){_0x5a7274['body'][_0x42c5('0x81')]=_0x43183c['id'];return db['CannedAnswer'][_0x42c5('0x6e')](_0x5a7274[_0x42c5('0x78')]);}})[_0x42c5('0x1b')](respondWithResult(_0x32da5d,null))['catch'](handleError(_0x32da5d,null));};exports['getAnswers']=function(_0x348cda,_0x2bf79f){var _0x489506={'raw':![],'where':{}};var _0x4fe323={};var _0x1e9cbc={'count':0x0,'rows':[]};return db[_0x42c5('0x56')][_0x42c5('0x7e')]({'where':{'id':_0x348cda[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x2bf79f,null))[_0x42c5('0x1b')](function(_0x2f7040){if(_0x2f7040){_0x4fe323[_0x42c5('0x50')]=_[_0x42c5('0x6a')](db[_0x42c5('0x84')][_0x42c5('0x57')]);_0x4fe323[_0x42c5('0x5a')]=_[_0x42c5('0x6a')](_0x348cda[_0x42c5('0x5a')]);_0x4fe323[_0x42c5('0x5b')]=_[_0x42c5('0x5c')](_0x4fe323[_0x42c5('0x50')],_0x4fe323[_0x42c5('0x5a')]);_0x489506[_0x42c5('0x5d')]=_[_0x42c5('0x5c')](_0x4fe323['model'],qs[_0x42c5('0x5e')](_0x348cda[_0x42c5('0x5a')]['fields']));_0x489506[_0x42c5('0x5d')]=_0x489506['attributes'][_0x42c5('0x5f')]?_0x489506[_0x42c5('0x5d')]:_0x4fe323[_0x42c5('0x50')];if(!_0x348cda[_0x42c5('0x5a')][_0x42c5('0x7f')](_0x42c5('0x60'))){_0x489506[_0x42c5('0x29')]=qs[_0x42c5('0x29')](_0x348cda[_0x42c5('0x5a')][_0x42c5('0x29')]);_0x489506[_0x42c5('0x28')]=qs['offset'](_0x348cda[_0x42c5('0x5a')][_0x42c5('0x28')]);}_0x489506[_0x42c5('0x61')]=qs[_0x42c5('0x62')](_0x348cda['query'][_0x42c5('0x62')]);_0x489506['where']=qs['filters'](_['pick'](_0x348cda[_0x42c5('0x5a')],_0x4fe323['filters']));_0x489506[_0x42c5('0x63')][_0x42c5('0x81')]=_0x2f7040['id'];if(_0x348cda['query'][_0x42c5('0x64')]){_0x489506['where']=_['merge'](_0x489506[_0x42c5('0x63')],{'$or':_[_0x42c5('0x3b')](_0x489506[_0x42c5('0x5d')],function(_0x4600cc){var _0x5db471={};_0x5db471[_0x4600cc]={'$like':'%'+_0x348cda[_0x42c5('0x5a')][_0x42c5('0x64')]+'%'};return _0x5db471;})});}_0x489506=_[_0x42c5('0x6b')]({},_0x489506,_0x348cda['options']);return db[_0x42c5('0x84')][_0x42c5('0x2b')]({'where':_0x489506['where']})[_0x42c5('0x1b')](function(_0x246f5b){_0x1e9cbc[_0x42c5('0x2b')]=_0x246f5b;if(_0x348cda[_0x42c5('0x5a')][_0x42c5('0x65')]){_0x489506[_0x42c5('0x66')]=[{'all':!![]}];}return db[_0x42c5('0x84')]['findAll'](_0x489506);})[_0x42c5('0x1b')](function(_0xe145c4){_0x1e9cbc[_0x42c5('0x68')]=_0xe145c4;return _0x1e9cbc;});}})[_0x42c5('0x1b')](respondWithFilteredResult(_0x2bf79f,_0x489506))[_0x42c5('0x23')](handleError(_0x2bf79f,null));};exports['removeAnswers']=function(_0x2fabd8,_0x48ea65){return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x2fabd8[_0x42c5('0x79')]['id']}})['then'](handleEntityNotFound(_0x48ea65,null))[_0x42c5('0x1b')](function(_0x28a4a2){if(_0x28a4a2){return _0x28a4a2[_0x42c5('0x85')](_0x2fabd8['query']['ids']);}})[_0x42c5('0x1b')](respondWithStatusCode(_0x48ea65,null))['catch'](handleError(_0x48ea65,null));};exports[_0x42c5('0x86')]=function(_0x5a6d48,_0xdd0dfa){_0x5a6d48[_0x42c5('0x78')]['sitepic']=_0x5a6d48['file'][_0x42c5('0x87')];return db['ChatWebsite'][_0x42c5('0x6d')]({'where':{'id':_0x5a6d48[_0x42c5('0x79')]['id']}})['then'](handleEntityNotFound(_0xdd0dfa,null))[_0x42c5('0x1b')](saveUpdates(_0x5a6d48[_0x42c5('0x78')],null))[_0x42c5('0x1b')](respondWithResult(_0xdd0dfa,null))['catch'](handleError(_0xdd0dfa,null));};exports[_0x42c5('0x88')]=function(_0x5b1b22,_0x523c46){_0x5b1b22[_0x42c5('0x78')][_0x42c5('0x89')]=_0x5b1b22[_0x42c5('0x8a')]['filename'];return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x5b1b22[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x523c46,null))[_0x42c5('0x1b')](saveUpdates(_0x5b1b22[_0x42c5('0x78')],null))[_0x42c5('0x1b')](respondWithResult(_0x523c46,null))[_0x42c5('0x23')](handleError(_0x523c46,null));};exports['addCustomerAvatar']=function(_0x385320,_0x19a2c9){_0x385320[_0x42c5('0x78')][_0x42c5('0x8b')]=_0x385320[_0x42c5('0x8a')][_0x42c5('0x87')];return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x385320[_0x42c5('0x79')]['id']}})['then'](handleEntityNotFound(_0x19a2c9,null))[_0x42c5('0x1b')](saveUpdates(_0x385320[_0x42c5('0x78')],null))[_0x42c5('0x1b')](respondWithResult(_0x19a2c9,null))['catch'](handleError(_0x19a2c9,null));};exports[_0x42c5('0x8c')]=function(_0x2df3a2,_0x2d1833){_0x2df3a2[_0x42c5('0x78')][_0x42c5('0x8d')]=_0x2df3a2[_0x42c5('0x8a')][_0x42c5('0x87')];return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x2df3a2[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x2d1833,null))[_0x42c5('0x1b')](saveUpdates(_0x2df3a2[_0x42c5('0x78')],null))[_0x42c5('0x1b')](respondWithResult(_0x2d1833,null))[_0x42c5('0x23')](handleError(_0x2d1833,null));};exports[_0x42c5('0x8e')]=function(_0x336403,_0x18ebcc){var _0x547ecf=path[_0x42c5('0x8f')](config[_0x42c5('0x90')],'server/files/images/logos/default_logo.svg');var _0x384b78={'where':{'id':_0x336403[_0x42c5('0x79')]['id']},'attributes':['id',_0x42c5('0x91')],'raw':!![]};var _0x39e9b7=![];return require(_0x42c5('0x92'))[_0x42c5('0x93')]()[_0x42c5('0x1b')](function(_0x692143){if(_0x692143){_0x39e9b7=_0x692143[_0x42c5('0x94')];}})['then'](function(){return db[_0x42c5('0x56')][_0x42c5('0x6d')](_0x384b78);})[_0x42c5('0x1b')](handleEntityNotFound(_0x18ebcc,null))[_0x42c5('0x1b')](function(_0x5af578){if(_0x5af578){if(!_[_0x42c5('0x95')](_0x5af578[_0x42c5('0x91')])){if(fs['existsSync'](path[_0x42c5('0x8f')](config[_0x42c5('0x90')],_0x42c5('0x96'),_0x5af578[_0x42c5('0x91')]))&&_0x39e9b7){_0x547ecf=path[_0x42c5('0x8f')](config[_0x42c5('0x90')],_0x42c5('0x96'),_0x5af578[_0x42c5('0x91')]);}}return _0x18ebcc['download'](_0x547ecf);}})[_0x42c5('0x23')](handleError(_0x18ebcc,null));};exports[_0x42c5('0x97')]=function(_0x413395,_0x449da4){var _0x5e4c3d=path[_0x42c5('0x8f')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x29a58b={'where':{'id':_0x413395['params']['id']},'attributes':['id',_0x42c5('0x89')],'raw':!![]};return db[_0x42c5('0x56')][_0x42c5('0x6d')](_0x29a58b)[_0x42c5('0x1b')](handleEntityNotFound(_0x449da4,null))[_0x42c5('0x1b')](function(_0x368c2){if(_0x368c2){if(!_['isNil'](_0x368c2[_0x42c5('0x89')])){if(fs['existsSync'](path[_0x42c5('0x8f')](config[_0x42c5('0x90')],_0x42c5('0x98'),_0x368c2[_0x42c5('0x89')]))){_0x5e4c3d=path['join'](config[_0x42c5('0x90')],_0x42c5('0x98'),_0x368c2[_0x42c5('0x89')]);}}return _0x449da4['download'](_0x5e4c3d);}})['catch'](handleError(_0x449da4,null));};exports[_0x42c5('0x99')]=function(_0x790554,_0x42e108){var _0x285977=path[_0x42c5('0x8f')](config[_0x42c5('0x90')],_0x42c5('0x9a'));var _0x30a6ab={'where':{'id':_0x790554['params']['id']},'attributes':['id',_0x42c5('0x8b'),_0x42c5('0x9b')],'raw':!![]};return db[_0x42c5('0x56')]['find'](_0x30a6ab)[_0x42c5('0x1b')](handleEntityNotFound(_0x42e108,null))['then'](function(_0xbf1389){if(_0xbf1389){if(!_[_0x42c5('0x95')](_0xbf1389['customerAvatar'])){if(fs[_0x42c5('0x9c')](path[_0x42c5('0x8f')](config[_0x42c5('0x90')],_0x42c5('0x98'),_0xbf1389[_0x42c5('0x8b')]))&&_0xbf1389[_0x42c5('0x9b')]){_0x285977=path[_0x42c5('0x8f')](config['root'],_0x42c5('0x98'),_0xbf1389[_0x42c5('0x8b')]);}}return _0x42e108[_0x42c5('0x9d')](_0x285977);}})[_0x42c5('0x23')](handleError(_0x42e108,null));};exports[_0x42c5('0x9e')]=function(_0x37df0c,_0xb23a1b){var _0x5f10ea=path['join'](config['root'],'server/files/images/avatars/system_avatar.png');var _0xe6fbb3={'where':{'id':_0x37df0c[_0x42c5('0x79')]['id']},'attributes':['id',_0x42c5('0x8d')],'raw':!![]};return db['ChatWebsite'][_0x42c5('0x6d')](_0xe6fbb3)['then'](handleEntityNotFound(_0xb23a1b,null))[_0x42c5('0x1b')](function(_0x2a8a6b){if(_0x2a8a6b){if(!_[_0x42c5('0x95')](_0x2a8a6b['systemAvatar'])){if(fs[_0x42c5('0x9c')](path['join'](config[_0x42c5('0x90')],_0x42c5('0x98'),_0x2a8a6b[_0x42c5('0x8d')]))){_0x5f10ea=path['join'](config[_0x42c5('0x90')],'server/files/images/avatars/',_0x2a8a6b['systemAvatar']);}}return _0xb23a1b[_0x42c5('0x9d')](_0x5f10ea);}})[_0x42c5('0x23')](handleError(_0xb23a1b,null));};exports[_0x42c5('0x9f')]=function(_0x2fdf3f,_0x2e7274){var _0x311b43={'body':_0x2fdf3f[_0x42c5('0x78')],'channel':_0x42c5('0xa0')};var _0x2e3aeb=[];var _0xca7adf=[];var _0x59a573={};var _0x444c37=![];return db[_0x42c5('0xa1')][_0x42c5('0x7a')]()[_0x42c5('0x1b')](function(_0x4facb6){if(!_0x4facb6){throw new db[(_0x42c5('0xa2'))]['ValidationError'](_0x42c5('0xa3'));}_0x2e3aeb=_['difference'](_[_0x42c5('0x6a')](_0x4facb6),[_0x42c5('0xa4'),'updatedAt']);_0xca7adf=_[_0x42c5('0xa5')](_[_0x42c5('0x6a')](_0x4facb6),[_0x42c5('0xa4'),_0x42c5('0xa6'),'CompanyId',_0x42c5('0xa7')]);if(_0x2fdf3f[_0x42c5('0x78')]['id']){delete _0x2fdf3f[_0x42c5('0x78')]['id'];}if(_['isNil'](_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xa8')])){throw new db['Sequelize'][(_0x42c5('0xa9'))](_0x42c5('0xaa'));}if(_['isNil'](_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0x78')])||_0x2fdf3f['body']['body']===''){throw new db[(_0x42c5('0xa2'))][(_0x42c5('0xa9'))](_0x42c5('0xab'));}if(_[_0x42c5('0x95')](_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xac')])){throw new db[(_0x42c5('0xa2'))][(_0x42c5('0xa9'))](_0x42c5('0xad')+_0xca7adf);}if(!_[_0x42c5('0xae')](_0xca7adf,_0x2fdf3f[_0x42c5('0x78')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x42c5('0xaf')+_0xca7adf);}_0x59a573[_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xac')]]=_0x2fdf3f['body'][_0x42c5('0xa8')];})[_0x42c5('0x1b')](function(){return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x2fdf3f[_0x42c5('0x79')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x42c5('0xa1')],'as':_0x42c5('0xb0'),'where':_0x59a573,'limit':0x1,'order':[['updatedAt',_0x42c5('0xb1')]]}]},{'model':db[_0x42c5('0xb2')],'as':_0x42c5('0xb3')},{'model':db[_0x42c5('0x3c')],'as':_0x42c5('0x3c'),'include':[{'model':db[_0x42c5('0x3c')],'as':_0x42c5('0xb4'),'attributes':['id',_0x42c5('0x33')],'raw':!![]}]}]});})[_0x42c5('0x1b')](function(_0xc5d1bc){if(!_0xc5d1bc)throw new APINotFoundError(util[_0x42c5('0x32')](_0x42c5('0xb5'),_0x2fdf3f[_0x42c5('0x79')]['id']));if(!_0xc5d1bc[_0x42c5('0x3c')]||!_0xc5d1bc['Interval']['Intervals'])return[_0xc5d1bc,!![]];return[_0xc5d1bc,checkWebsiteIntervals(_0xc5d1bc)];})[_0x42c5('0xb6')](function(_0xa075b0,_0x348caf){if(!_0x348caf)throw new APIOutOfIntervalError();if(!_0xa075b0[_0x42c5('0xb7')])return;_0x311b43[_0x42c5('0xb8')]=_0xa075b0;_0x311b43[_0x42c5('0xb9')]=_0xa075b0[_0x42c5('0xb7')];_0x311b43[_0x42c5('0xba')]=_[_0x42c5('0xbb')](_0xa075b0[_0x42c5('0xb3')],['priority'],['asc']);if(_0x311b43['account'][_0x42c5('0xb3')]){delete _0x311b43[_0x42c5('0xb8')][_0x42c5('0xb3')];}if(_0x311b43[_0x42c5('0xb8')]['List']&&_0x311b43[_0x42c5('0xb8')]['List'][_0x42c5('0xb0')][_0x42c5('0x5f')]){return _0x311b43[_0x42c5('0xb8')]['List'][_0x42c5('0xb0')][0x0];}var _0x28c3b7=_[_0x42c5('0x13')](_0x2fdf3f[_0x42c5('0x78')],{'firstName':_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xa8')],'ListId':_0xa075b0['ListId']});_0x28c3b7[_0x2fdf3f['body'][_0x42c5('0xac')]]=_0x2fdf3f[_0x42c5('0x78')]['from'];return db[_0x42c5('0xa1')][_0x42c5('0x6e')](_0x28c3b7,{'fields':_0x2e3aeb,'raw':!![]});})[_0x42c5('0x1b')](function(_0x77934d){_0x311b43['contact']=_0x77934d;var _0x2efaa8=createInteractionObject(_0x2fdf3f['params']['id'],_0x2fdf3f[_0x42c5('0x78')],_0x2fdf3f[_0x42c5('0xbc')],_0x77934d);var _0x3dae4b={'ChatWebsiteId':_0x2fdf3f['params']['id'],'closed':![]};if(_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xbd')]){_0x3dae4b[_0x42c5('0xbd')]=_0x2fdf3f[_0x42c5('0x78')]['threadId'];return db[_0x42c5('0xbe')][_0x42c5('0x6d')]({'where':_0x3dae4b})[_0x42c5('0x1b')](function(_0x2f9ddc){if(_0x2f9ddc){_0x444c37=!![];return _0x2f9ddc;}_0x2efaa8[_0x42c5('0xbd')]=_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xbd')];_0x2efaa8[_0x42c5('0xbf')]=_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xbf')];return db[_0x42c5('0xbe')][_0x42c5('0x6e')](_0x2efaa8);});}_0x3dae4b[_0x42c5('0xc0')]=_0x77934d['id'];if(_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xc1')]&&_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xc1')]['id']){_0x3dae4b['id']=_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xc1')]['id'];return db[_0x42c5('0xbe')][_0x42c5('0x6d')]({'where':_0x3dae4b})['then'](function(_0x39bf5e){if(_0x39bf5e){_0x444c37=!![];return _0x39bf5e;}return db[_0x42c5('0xbe')][_0x42c5('0x6e')](_0x2efaa8);});}return db[_0x42c5('0xbe')][_0x42c5('0x6e')](_0x2efaa8);})[_0x42c5('0x1b')](function(_0x26a9bb){if(!_0x444c37)return _0x26a9bb;var _0x560da7={'from':(_0x311b43[_0x42c5('0xc2')][_0x42c5('0x48')]||'')+'\x20'+(_0x311b43[_0x42c5('0xc2')][_0x42c5('0x49')]||'')};if(_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xbd')]&&_0x2fdf3f[_0x42c5('0x78')]['messageId']&&_0x2fdf3f[_0x42c5('0x78')]['threadId']!=_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0xc3')]){_0x560da7[_0x42c5('0xbd')]=_0x2fdf3f[_0x42c5('0x78')]['messageId'];}return _0x26a9bb[_0x42c5('0x2d')](_0x560da7);})[_0x42c5('0x1b')](function(_0xa820c8){_0x311b43[_0x42c5('0xc1')]=_0xa820c8[_0x42c5('0x72')]({'plain':!![]});_0x311b43[_0x42c5('0xc1')][_0x42c5('0xc4')]=!_0x444c37;if(_0x311b43[_0x42c5('0xc1')]['created']){if(_0x311b43['account'][_0x42c5('0xc5')]){_0x311b43[_0x42c5('0xba')][_0x42c5('0xc6')]({'id':0x0,'priority':_0x311b43['applications'][_0x42c5('0x5f')]+0x1,'app':_0x42c5('0xc7'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x42c5('0xc8')][_0x42c5('0x6e')]({'body':_0x2fdf3f[_0x42c5('0x78')][_0x42c5('0x78')],'ChatWebsiteId':_0x2fdf3f['params']['id'],'ChatInteractionId':_0xa820c8['id'],'direction':'in','ContactId':_0x311b43[_0x42c5('0xc2')]['id'],'AttachmentId':_0x2fdf3f[_0x42c5('0x78')]['AttachmentId']});})[_0x42c5('0x1b')](function(_0x2e072e){_0x311b43['message']=_0x2e072e;if(_0x311b43['interaction']['UserId']){return db['User'][_0x42c5('0x6d')]({'attributes':['id','name'],'where':{'id':_0x311b43['interaction'][_0x42c5('0xc9')]}})[_0x42c5('0x1b')](function(_0x5d2aef){if(_0x5d2aef){_0x311b43[_0x42c5('0xba')][_0x42c5('0xca')]({'id':0x0,'priority':0x0,'app':_0x42c5('0xcb'),'appdata':_0x5d2aef[_0x42c5('0x2f')]+','+(_0x311b43[_0x42c5('0xb8')][_0x42c5('0xcc')]||0xa),'interval':'*,*,*,*'});_0x311b43['forcedOwnership']=!![];}return respondWithRpcPromise(_0x42c5('0xcd'),_0x42c5('0xce'),_0x311b43);});}return respondWithRpcPromise(_0x42c5('0xcd'),'startRouting',_0x311b43);})[_0x42c5('0x1b')](function(_0x321726){respondWithRpcPromise(_0x42c5('0xcf'),'EventManager',{'event':_0x42c5('0x9f'),'message':_0x321726},client9002);return _0x321726;})[_0x42c5('0x1b')](respondWithResult(_0x2e7274,null))['catch'](APIHandleError(_0x2e7274));};exports[_0x42c5('0xd0')]=function(_0x2e91ba,_0x2940c2){var _0x2bc718,_0x110c12,_0x340213;var _0x58542f=[];var _0x2bc710={};var _0x2d20e8=_0x2e91ba['files']||[];var _0x8298e1=[];var _0x117d18;return db[_0x42c5('0xa1')][_0x42c5('0x7a')]()['then'](function(_0x220da5){if(!_0x220da5){throw new db[(_0x42c5('0xa2'))][(_0x42c5('0xa9'))]('no\x20available\x20attributes');}_0x58542f=_['difference'](_[_0x42c5('0x6a')](_0x220da5),[_0x42c5('0xa4'),_0x42c5('0xa6'),_0x42c5('0xd1'),_0x42c5('0xa7')]);if(_0x2e91ba[_0x42c5('0x78')]['id']){delete _0x2e91ba[_0x42c5('0x78')]['id'];}if(_[_0x42c5('0x95')](_0x2e91ba['body'][_0x42c5('0xa8')])){throw _0x2940c2[_0x42c5('0x25')](0x1f4)['send'](new db[(_0x42c5('0xa2'))][(_0x42c5('0xa9'))](_0x42c5('0xaa')));}if(_[_0x42c5('0x95')](_0x2e91ba['body'][_0x42c5('0x78')])||_0x2e91ba['body'][_0x42c5('0x78')]===''){throw _0x2940c2[_0x42c5('0x25')](0x1f4)['send'](new db['Sequelize'][(_0x42c5('0xa9'))](_0x42c5('0xab')));}if(_['isNil'](_0x2e91ba[_0x42c5('0x78')][_0x42c5('0xd2')])){throw _0x2940c2[_0x42c5('0x25')](0x1f4)[_0x42c5('0xd3')](new db['Sequelize'][(_0x42c5('0xa9'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58542f));}if(!_[_0x42c5('0xae')](_0x58542f,_0x2e91ba[_0x42c5('0x78')]['mapKeyOffline'])){throw _0x2940c2[_0x42c5('0x25')](0x1f4)[_0x42c5('0xd3')](new db[(_0x42c5('0xa2'))][(_0x42c5('0xa9'))](_0x42c5('0xd4')+_0x58542f));}_0x2bc710[_0x2e91ba[_0x42c5('0x78')][_0x42c5('0xd2')]]=_0x2e91ba[_0x42c5('0x78')][_0x42c5('0xa8')];})[_0x42c5('0x1b')](function(){return db['ChatWebsite'][_0x42c5('0x6d')]({'where':{'id':_0x2e91ba[_0x42c5('0x79')]['id']},'include':[{'model':db[_0x42c5('0xd5')],'as':'List'},{'model':db['MailAccount'],'as':_0x42c5('0xd6')}]});})['then'](handleEntityNotFound(_0x2940c2,null))[_0x42c5('0x1b')](function(_0x4c6b2d){if(_0x4c6b2d&&_0x4c6b2d[_0x42c5('0xb7')]){_0x110c12=_0x4c6b2d;var _0x23280f=_[_0x42c5('0x13')](_0x2e91ba['body'],{'firstName':_0x2e91ba[_0x42c5('0x78')][_0x42c5('0xa8')],'phone':_0x2e91ba[_0x42c5('0x78')][_0x42c5('0xa8')],'ListId':_0x4c6b2d[_0x42c5('0xa7')]});_0x23280f[_0x2e91ba[_0x42c5('0x78')][_0x42c5('0xd2')]]=_0x2e91ba['body'][_0x42c5('0xa8')];return db[_0x42c5('0xa1')][_0x42c5('0xd7')]({'where':_0x2bc710,'defaults':_0x23280f});}})['spread'](function(_0x1db233){if(_0x1db233){_0x340213=_0x1db233;var _0x325eff=fs[_0x42c5('0xd8')](path[_0x42c5('0x8f')](config[_0x42c5('0x90')],_0x42c5('0xd9')),_0x42c5('0xda'));var _0x40e840=ejs['render'](_0x325eff,{'body':_[_0x42c5('0xdb')](_0x2e91ba['body'][_0x42c5('0x78')]),'bodyTitle':_0x110c12[_0x42c5('0xdc')]});return db[_0x42c5('0xdd')][_0x42c5('0x6e')]({'body':_0x40e840,'plainBody':htmlToText[_0x42c5('0xde')](_0x40e840),'ContactId':_0x1db233['id'],'ChatWebsiteId':_0x110c12['id']});}})[_0x42c5('0x1b')](function(_0x50025c){_0x117d18=_0x50025c;if(_0x2d20e8[_0x42c5('0x5f')]){var _0x49e1d1=_0x2d20e8[_0x42c5('0x3b')](function(_0x3ab503){return{'name':_0x3ab503['originalname'],'basename':_0x3ab503[_0x42c5('0x87')],'type':_0x3ab503[_0x42c5('0xdf')],'ChatOfflineMessageId':_0x50025c['id']};});_0x8298e1=_0x49e1d1['map'](_0x1532cf=>{var _0xcc701c={'filename':_0x1532cf['name'],'path':path['join'](config[_0x42c5('0x90')],_0x42c5('0xe0'),_0x42c5('0xe1'),_0x42c5('0xe2'),_0x42c5('0xe3'),_0x1532cf['basename'])};return _0xcc701c;});if(!_0x110c12[_0x42c5('0xe4')]){return db[_0x42c5('0xe5')][_0x42c5('0xe6')](function(_0x2c8175){return db['Attachment']['bulkCreate'](_0x49e1d1,{'transaction':_0x2c8175});});}}})[_0x42c5('0x1b')](function(){if(_0x117d18){_0x2bc718=_0x117d18;return db[_0x42c5('0xd6')][_0x42c5('0x7e')]({'where':{'service':!![]},'include':[{'model':db[_0x42c5('0xe7')],'as':_0x42c5('0xe8'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x42c5('0xe9'),'raw':!![]}]}]});}})[_0x42c5('0x1b')](function(_0x2bdf8d){if(_0x2bdf8d&&_0x2bdf8d[_0x42c5('0xe8')]&&_0x110c12[_0x42c5('0xea')]&&_0x110c12['forwardOfflineAddress']){var _0x4ac770=_0x2bdf8d[_0x42c5('0xeb')]();return respondWithRpcPromise(_0x42c5('0xec'),_0x42c5('0xed'),{'account':_0x4ac770,'message':{'from':util[_0x42c5('0x32')](_0x42c5('0xee'),_0x2bdf8d[_0x42c5('0x2f')],_0x2bdf8d['email']||_0x2bdf8d['Smtp']['user']),'to':_0x110c12['forwardOfflineAddress'],'subject':_0x110c12[_0x42c5('0xef')],'html':_0x2bc718[_0x42c5('0x78')],'attachments':_0x8298e1}},client9003)[_0x42c5('0x1b')](function(){return _0x2bc718;})['catch'](function(_0x3f1db9){logger['error'](_0x3f1db9);});}})[_0x42c5('0x1b')](function(){if(_0x110c12&&_0x110c12['openNewInteraction']&&_0x110c12[_0x42c5('0xf0')]){var _0xf002a5=[];if(_0x2d20e8[_0x42c5('0x5f')]){_0xf002a5=_0x2d20e8[_0x42c5('0x3b')](function(_0x7b1e36){return{'name':_0x7b1e36[_0x42c5('0xf1')],'basename':_0x7b1e36['filename'],'type':_0x7b1e36[_0x42c5('0xdf')],'ChatOfflineMessageId':_0x117d18['id']};});}var _0x4ae285;if(!_[_0x42c5('0x95')](_0x110c12[_0x42c5('0xf2')])){var _0x81d280=_[_0x42c5('0x3b')](_0x2e91ba['body'],function(_0x2f12eb){return _0x2f12eb;});var _0x41ae90=_[_0x42c5('0xf3')](_0x81d280)[0x0];var _0x100034=_[_0x42c5('0xf4')](_0x41ae90,function(_0x19ebc6){return _0x19ebc6;});_0x4ae285=_0x100034[0x1][_0x110c12[_0x42c5('0xf2')]];}var _0x2f447e={'from':_0x340213[_0x42c5('0xf5')],'firstName':_0x340213[_0x42c5('0x48')],'lastName':_0x340213['lastName'],'mapKey':_0x42c5('0xf5'),'message':{'from':_0x340213[_0x42c5('0xf5')],'to':_0x110c12[_0x42c5('0xd6')]['email'],'cc':'','subject':_[_0x42c5('0x95')](_0x4ae285)?_0x110c12[_0x42c5('0xef')]:_0x4ae285,'messageId':'','sentAt':new Date(),'attach':_0xf002a5['length'],'attachments':_0xf002a5,'originChannel':_0x42c5('0xf6'),'ChatWebsiteId':_0x110c12['id'],'ChatOfflineMessageId':_0x2bc718['id'],'originTo':_0x110c12[_0x42c5('0xd6')]['email']},'body':_0x2bc718[_0x42c5('0x78')]};var _0x1d94ee={'account':{'id':_0x110c12[_0x42c5('0xf0')]},'body':_0x2f447e,'log':_0x42c5('0xf7')};return respondWithRpcPromise(_0x42c5('0xf7'),_0x42c5('0xf8'),_0x1d94ee,client9001)[_0x42c5('0x1b')](function(){return _0x2bc718;})[_0x42c5('0x23')](function(_0x53990a){logger[_0x42c5('0x20')](_0x53990a);});}return;})['then'](function(){if(_0x2bc718){return _0x2bc718;}})[_0x42c5('0x1b')](respondWithResult(_0x2940c2,null))[_0x42c5('0x23')](function(){for(var _0x515283 of _0x2d20e8){var _0x17d8d2=path['join'](config[_0x42c5('0x90')],_0x42c5('0xe0'),_0x42c5('0xe1'),_0x42c5('0xe2'),_0x42c5('0xe3'),_0x515283[_0x42c5('0x87')]);fs_extra['remove'](_0x17d8d2)[_0x42c5('0x23')](function(_0x167295){logger[_0x42c5('0x20')](_0x42c5('0xf9'),_0x17d8d2,_0x167295);});}});};exports['addInteraction']=function(_0x54d53a,_0x3b55fe){return db[_0x42c5('0xbe')][_0x42c5('0x6d')]({'where':{'id':_0x54d53a[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x3b55fe,null))[_0x42c5('0x1b')](function(_0x49383c){if(_0x49383c){return _0x49383c[_0x42c5('0xfa')](_0x54d53a[_0x42c5('0x78')][_0x42c5('0xfb')],_['omit'](_0x54d53a['body'],['ids','id'])||{});}})[_0x42c5('0x1b')](respondWithResult(_0x3b55fe,null))[_0x42c5('0x23')](handleError(_0x3b55fe,null));};exports['getInteractions']=function(_0x127d64,_0x19e6c3){var _0x32248c={'raw':![],'where':{}};var _0x140589={};var _0x35682c={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x127d64['params']['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x19e6c3,null))[_0x42c5('0x1b')](function(_0x3e84b3){if(_0x3e84b3){_0x140589[_0x42c5('0x50')]=_[_0x42c5('0x6a')](db[_0x42c5('0xbe')][_0x42c5('0x57')]);_0x140589[_0x42c5('0x5a')]=_['keys'](_0x127d64['query']);_0x140589[_0x42c5('0x5b')]=_[_0x42c5('0x5c')](_0x140589[_0x42c5('0x50')],_0x140589[_0x42c5('0x5a')]);_0x32248c[_0x42c5('0x5d')]=_[_0x42c5('0x5c')](_0x140589[_0x42c5('0x50')],qs['fields'](_0x127d64[_0x42c5('0x5a')][_0x42c5('0x5e')]));_0x32248c[_0x42c5('0x5d')]=_0x32248c['attributes'][_0x42c5('0x5f')]?_0x32248c[_0x42c5('0x5d')]:_0x140589['model'];if(!_0x127d64[_0x42c5('0x5a')][_0x42c5('0x7f')]('nolimit')){_0x32248c[_0x42c5('0x29')]=qs[_0x42c5('0x29')](_0x127d64['query'][_0x42c5('0x29')]);_0x32248c[_0x42c5('0x28')]=qs[_0x42c5('0x28')](_0x127d64[_0x42c5('0x5a')][_0x42c5('0x28')]);}_0x32248c[_0x42c5('0x61')]=qs[_0x42c5('0x62')](_0x127d64[_0x42c5('0x5a')][_0x42c5('0x62')]);_0x32248c['where']=qs[_0x42c5('0x5b')](_[_0x42c5('0x80')](_0x127d64[_0x42c5('0x5a')],_0x140589[_0x42c5('0x5b')]));_0x32248c[_0x42c5('0x63')]['ChatWebsiteId']=_0x3e84b3['id'];if(_0x127d64[_0x42c5('0x5a')][_0x42c5('0x64')]){_0x32248c['where']=_['merge'](_0x32248c['where'],{'$or':_['map'](_0x32248c[_0x42c5('0x5d')],function(_0x3ec9a4){var _0x4c024d={};_0x4c024d[_0x3ec9a4]={'$like':'%'+_0x127d64[_0x42c5('0x5a')]['filter']+'%'};return _0x4c024d;})});}_0x32248c=_[_0x42c5('0x6b')]({},_0x32248c,_0x127d64['options']);return db[_0x42c5('0xbe')][_0x42c5('0x2b')]({'where':_0x32248c[_0x42c5('0x63')]})[_0x42c5('0x1b')](function(_0x29ae1b){_0x35682c[_0x42c5('0x2b')]=_0x29ae1b;if(_0x127d64[_0x42c5('0x5a')][_0x42c5('0x65')]){_0x32248c[_0x42c5('0x66')]=[{'model':db[_0x42c5('0xa1')],'as':_0x42c5('0xfc'),'required':![]},{'model':db[_0x42c5('0xfd')],'as':'Owner','attributes':['name',_0x42c5('0xfe'),_0x42c5('0xff')],'required':![]},{'model':db[_0x42c5('0x100')],'as':_0x42c5('0x101'),'attributes':['id',_0x42c5('0x2f'),'color'],'where':_0x127d64[_0x42c5('0x5a')]['tag']?{'id':_0x127d64['query'][_0x42c5('0x102')]}:undefined,'required':_0x127d64[_0x42c5('0x5a')][_0x42c5('0x102')]?!![]:![]}];}return db[_0x42c5('0xbe')][_0x42c5('0x67')](_0x32248c);})['then'](function(_0x56917d){_0x35682c[_0x42c5('0x68')]=_0x56917d;return _0x35682c;});}})[_0x42c5('0x1b')](respondWithFilteredResult(_0x19e6c3,_0x32248c))[_0x42c5('0x23')](handleError(_0x19e6c3,null));};exports[_0x42c5('0x31')]=function(_0x116d39,_0x52def0){var _0xa2fb91=0x0;var _0x1f4447=0x0;var _0x137097=![];var _0x2f281a;var _0xa9a09a;return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x116d39['params']['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x42c5('0x33')]}]}]})[_0x42c5('0x1b')](handleEntityNotFound(_0x52def0,null))['then'](function(_0x26d199){if(_0x26d199){_0x2f281a=_0x26d199;return _0x26d199[_0x42c5('0x103')]({'raw':!![]});}})[_0x42c5('0x1b')](function(_0x3dd106){if(_0x2f281a){if(_0x3dd106){_0xa9a09a=_0x3dd106;}}return require(_0x42c5('0x92'))[_0x42c5('0x93')]();})[_0x42c5('0x1b')](function(_0x179b6d){if(_0x179b6d){_0x1f4447=_0x179b6d[_0x42c5('0x104')];_0x137097=_0x179b6d['custom'];}})[_0x42c5('0x1b')](function(){return db[_0x42c5('0xbe')][_0x42c5('0x2b')]({'where':{'closed':![]}});})[_0x42c5('0x1b')](function(_0x557de7){_0xa2fb91=_0x557de7;if(_0x1f4447&&_0x557de7>_0x1f4447){return db[_0x42c5('0x105')][_0x42c5('0x7e')]({'where':{'id':0x1}})[_0x42c5('0x1b')](function(_0x88c98c){if(_0x88c98c){_0x88c98c[_0x42c5('0x106')]('chatLicenseExceeded');}});}})[_0x42c5('0x1b')](function(){if(!_0x2f281a['Interval']||!_0x2f281a[_0x42c5('0x3c')][_0x42c5('0xb4')])return!![];return checkWebsiteIntervals(_0x2f281a);})[_0x42c5('0x1b')](function(_0x58258f){var _0x3e22e8=fs[_0x42c5('0xd8')](path[_0x42c5('0x8f')](config[_0x42c5('0x90')],_0x42c5('0x107')),_0x42c5('0xda'));var _0x5358ff=new url[(_0x42c5('0x108'))](_0x2f281a[_0x42c5('0x109')])[_0x42c5('0x10a')];var _0x4622c8=_0x42c5('0x10b');var _0x45fd0d=![];var _0x3d1727={'chatVersion':_0x4622c8,'chatWebsiteAddressOrigin':_0x5358ff,'remote':_0x2f281a[_0x42c5('0x10c')],'query':querystring[_0x42c5('0x1f')](_[_0x42c5('0x6b')](_0x2f281a[_0x42c5('0x72')]({'plain':!![]}),{'customerIp':_0x116d39[_0x42c5('0xbc')][_0x42c5('0x45')]||_0x116d39[_0x42c5('0xbc')][_0x42c5('0x10d')]||_0x116d39[_0x42c5('0x10e')]['remoteAddress']||_0x116d39['ip'],'referer':_0x116d39[_0x42c5('0xbc')][_0x42c5('0x4b')],'openedInteractions':_0xa2fb91,'maxInteractions':_0x1f4447,'virtual':_0x137097[_0x42c5('0x104')],'online':_0x58258f,'custom':_0x137097}))[_0x42c5('0x10f')](/'/g,'\x5c\x27')};_0x52def0['send'](ejs[_0x42c5('0x110')](Mustache[_0x42c5('0x110')](_0x3e22e8,_0x3d1727),{'proactiveActions':_0xa9a09a,'alignment':_0x2f281a[_0x42c5('0x111')],'verticalAlignment':_0x2f281a[_0x42c5('0x112')],'div_color':_0x2f281a[_0x42c5('0x113')],'labelText':_0x2f281a[_0x42c5('0x114')],'text_color':_0x2f281a[_0x42c5('0x115')],'text_button_color':_0x2f281a[_0x42c5('0x116')],'button_color':_0x2f281a[_0x42c5('0x117')],'background_color':_0x2f281a[_0x42c5('0x118')],'hideWhenOffline':_0x2f281a[_0x42c5('0x119')],'intervalId':_0x2f281a[_0x42c5('0x11a')],'isDevelopment':_0x45fd0d,'chatVersion':_0x4622c8}));})[_0x42c5('0x23')](handleError(_0x52def0,null));};exports['addApplications']=function(_0x15e9fc,_0x2fd9d2){var _0x94fefd=_0x15e9fc[_0x42c5('0x79')]['id'];var _0x684873=_0x15e9fc['body'];var _0x5dc200=0xc8;var _0x349d81=null;return db[_0x42c5('0xe5')][_0x42c5('0xe6')]({'isolationLevel':db[_0x42c5('0xe5')][_0x42c5('0x11b')][_0x42c5('0x11c')]['READ_COMMITTED']},function(_0x198ad0){return db['ChatWebsite']['findOne']({'where':{'id':_0x94fefd},'transaction':_0x198ad0})['then'](function(_0x577f12){if(_0x577f12){return db[_0x42c5('0xb2')]['destroy']({'where':{'ChatWebsiteId':_0x94fefd},'transaction':_0x198ad0})[_0x42c5('0x1b')](function(){var _0x355199=_[_0x42c5('0x3b')](_0x684873,function(_0x2a045b){_0x2a045b['ChatWebsiteId']=_0x94fefd;return _0x2a045b;});return db['ChatApplication'][_0x42c5('0x11d')](_0x355199,{'transaction':_0x198ad0});});}else{_0x5dc200=0x194;_0x349d81=[];}});})[_0x42c5('0x1b')](function(){if(_0x5dc200!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x94fefd},'order':_0x42c5('0x11e')})[_0x42c5('0x1b')](function(_0x5d4910){_0x349d81=_0x5d4910;});}})[_0x42c5('0x23')](function(_0x3f6aad){_0x5dc200=0x1f4;logger[_0x42c5('0x20')](_0x3f6aad[_0x42c5('0x11f')]);if(_0x3f6aad[_0x42c5('0x2f')]){delete _0x3f6aad['name'];}_0x349d81=_0x3f6aad;})[_0x42c5('0x120')](function(){if(_0x349d81===null){_0x2fd9d2[_0x42c5('0x24')](_0x5dc200);}else{if(_0x5dc200===0x1f4){_0x2fd9d2[_0x42c5('0x25')](_0x5dc200)[_0x42c5('0xd3')](_0x349d81);}else{_0x2fd9d2[_0x42c5('0x25')](_0x5dc200)[_0x42c5('0x27')](_0x349d81);}}});};exports[_0x42c5('0x121')]=function(_0x3c1f51,_0x20c132){var _0x332ae7={};var _0x2c1d46={};var _0x54916b;var _0x575acd;return db[_0x42c5('0x56')][_0x42c5('0x7e')]({'where':{'id':_0x3c1f51[_0x42c5('0x79')]['id']}})['then'](handleEntityNotFound(_0x20c132,null))['then'](function(_0x4dcb25){if(_0x4dcb25){_0x54916b=_0x4dcb25;_0x2c1d46['model']=_[_0x42c5('0x6a')](db[_0x42c5('0xb2')][_0x42c5('0x57')]);_0x2c1d46[_0x42c5('0x5a')]=_[_0x42c5('0x6a')](_0x3c1f51[_0x42c5('0x5a')]);_0x2c1d46[_0x42c5('0x5b')]=_[_0x42c5('0x5c')](_0x2c1d46['model'],_0x2c1d46[_0x42c5('0x5a')]);_0x332ae7[_0x42c5('0x5d')]=_[_0x42c5('0x5c')](_0x2c1d46['model'],qs[_0x42c5('0x5e')](_0x3c1f51[_0x42c5('0x5a')][_0x42c5('0x5e')]));_0x332ae7['attributes']=_0x332ae7[_0x42c5('0x5d')]['length']?_0x332ae7[_0x42c5('0x5d')]:_0x2c1d46[_0x42c5('0x50')];_0x332ae7[_0x42c5('0x61')]=qs[_0x42c5('0x62')](_0x3c1f51[_0x42c5('0x5a')][_0x42c5('0x62')]);_0x332ae7[_0x42c5('0x63')]=qs[_0x42c5('0x5b')](_['pick'](_0x3c1f51['query'],_0x2c1d46['filters']));if(_0x3c1f51['query']['filter']){_0x332ae7[_0x42c5('0x63')]=_[_0x42c5('0x6b')](_0x332ae7[_0x42c5('0x63')],{'$or':_['map'](_0x332ae7[_0x42c5('0x5d')],function(_0x13d144){var _0x3fd1b7={};_0x3fd1b7[_0x13d144]={'$like':'%'+_0x3c1f51['query'][_0x42c5('0x64')]+'%'};return _0x3fd1b7;})});}_0x332ae7=_[_0x42c5('0x6b')]({},_0x332ae7,_0x3c1f51['options']);return _0x54916b[_0x42c5('0x121')](_0x332ae7);}})['then'](function(_0x1d2c05){if(_0x1d2c05){_0x575acd=_0x1d2c05[_0x42c5('0x5f')];if(!_0x3c1f51[_0x42c5('0x5a')][_0x42c5('0x7f')]('nolimit')){_0x332ae7['limit']=qs['limit'](_0x3c1f51[_0x42c5('0x5a')][_0x42c5('0x29')]);_0x332ae7[_0x42c5('0x28')]=qs['offset'](_0x3c1f51[_0x42c5('0x5a')][_0x42c5('0x28')]);}return _0x54916b['getApplications'](_0x332ae7);}})[_0x42c5('0x1b')](function(_0x8638b){if(_0x8638b){return _0x8638b?{'count':_0x575acd,'rows':_0x8638b}:null;}})[_0x42c5('0x1b')](respondWithResult(_0x20c132,null))[_0x42c5('0x23')](handleError(_0x20c132,null));};exports[_0x42c5('0x122')]=function(_0x4de406,_0x39d2ae){return db[_0x42c5('0x123')]['find']({'where':{'id':_0x4de406['params']['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x39d2ae,null))[_0x42c5('0x1b')](function(_0x56dfd7){if(_0x56dfd7){return _0x56dfd7['addProactiveActions'](_0x4de406[_0x42c5('0x78')][_0x42c5('0xfb')],_[_0x42c5('0x124')](_0x4de406[_0x42c5('0x78')],[_0x42c5('0xfb'),'id'])||{});}})[_0x42c5('0x1b')](respondWithResult(_0x39d2ae,null))['catch'](handleError(_0x39d2ae,null));};exports[_0x42c5('0x103')]=function(_0x14f48e,_0x4eeda0){var _0x27f50f={};var _0x59127b={};var _0x1ac21a;var _0x2b1d42;return db[_0x42c5('0x56')][_0x42c5('0x7e')]({'where':{'id':_0x14f48e[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x4eeda0,null))['then'](function(_0x5199f7){if(_0x5199f7){_0x1ac21a=_0x5199f7;_0x59127b['model']=_[_0x42c5('0x6a')](db[_0x42c5('0x125')][_0x42c5('0x57')]);_0x59127b[_0x42c5('0x5a')]=_[_0x42c5('0x6a')](_0x14f48e[_0x42c5('0x5a')]);_0x59127b[_0x42c5('0x5b')]=_[_0x42c5('0x5c')](_0x59127b[_0x42c5('0x50')],_0x59127b[_0x42c5('0x5a')]);_0x27f50f['attributes']=_['intersection'](_0x59127b[_0x42c5('0x50')],qs[_0x42c5('0x5e')](_0x14f48e['query'][_0x42c5('0x5e')]));_0x27f50f[_0x42c5('0x5d')]=_0x27f50f[_0x42c5('0x5d')][_0x42c5('0x5f')]?_0x27f50f['attributes']:_0x59127b[_0x42c5('0x50')];_0x27f50f[_0x42c5('0x61')]=qs[_0x42c5('0x62')](_0x14f48e[_0x42c5('0x5a')][_0x42c5('0x62')]);_0x27f50f['where']=qs['filters'](_['pick'](_0x14f48e['query'],_0x59127b[_0x42c5('0x5b')]));if(_0x14f48e[_0x42c5('0x5a')][_0x42c5('0x64')]){_0x27f50f[_0x42c5('0x63')]=_[_0x42c5('0x6b')](_0x27f50f[_0x42c5('0x63')],{'$or':_['map'](_0x27f50f[_0x42c5('0x5d')],function(_0x59d650){var _0x57fcef={};_0x57fcef[_0x59d650]={'$like':'%'+_0x14f48e[_0x42c5('0x5a')][_0x42c5('0x64')]+'%'};return _0x57fcef;})});}_0x27f50f=_['merge']({},_0x27f50f,_0x14f48e['options']);return _0x1ac21a[_0x42c5('0x103')](_0x27f50f);}})['then'](function(_0x52f537){if(_0x52f537){_0x2b1d42=_0x52f537['length'];if(!_0x14f48e['query'][_0x42c5('0x7f')](_0x42c5('0x60'))){_0x27f50f[_0x42c5('0x29')]=qs[_0x42c5('0x29')](_0x14f48e[_0x42c5('0x5a')]['limit']);_0x27f50f[_0x42c5('0x28')]=qs[_0x42c5('0x28')](_0x14f48e['query'][_0x42c5('0x28')]);}return _0x1ac21a[_0x42c5('0x103')](_0x27f50f);}})[_0x42c5('0x1b')](function(_0x1458e3){if(_0x1458e3){return _0x1458e3?{'count':_0x2b1d42,'rows':_0x1458e3}:null;}})[_0x42c5('0x1b')](respondWithResult(_0x4eeda0,null))[_0x42c5('0x23')](handleError(_0x4eeda0,null));};exports[_0x42c5('0x126')]=function(_0x3a34ad,_0x452419){var _0x4d5f34=_0x3a34ad['query'][_0x42c5('0x127')]==='false'?_0x42c5('0x128'):_0x42c5('0x129');return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'attributes':['id',_0x4d5f34],'where':{'id':_0x3a34ad[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x452419,null))[_0x42c5('0x1b')](function(_0x572e05){if(_0x572e05){var _0x249b8d=_0x572e05[_0x4d5f34];var _0x127eac=_0x249b8d&&_0x249b8d['items']?_0x249b8d[_0x42c5('0x12a')]:[];_0x452419[_0x42c5('0xd3')]({'fromKey':_[_0x42c5('0x95')](_0x249b8d[_0x42c5('0x12b')])?undefined:_0x249b8d[_0x42c5('0x12b')],'count':_0x127eac[_0x42c5('0x5f')],'rows':_0x127eac});}})[_0x42c5('0x23')](handleError(_0x452419,null));};exports[_0x42c5('0x12c')]=function(_0x12c3de,_0x22f6ff){var _0x2c9bf6={'raw':![],'where':{}};var _0x55aab6={};var _0x582b11={'count':0x0,'rows':[]};return db[_0x42c5('0x56')][_0x42c5('0x7e')]({'where':{'id':_0x12c3de['params']['id']}})['then'](handleEntityNotFound(_0x22f6ff,null))['then'](function(_0x54f531){if(_0x54f531){_0x55aab6[_0x42c5('0x50')]=_[_0x42c5('0x6a')](db['ChatOfflineMessage'][_0x42c5('0x57')]);_0x55aab6[_0x42c5('0x5a')]=_['keys'](_0x12c3de[_0x42c5('0x5a')]);_0x55aab6[_0x42c5('0x5b')]=_[_0x42c5('0x5c')](_0x55aab6[_0x42c5('0x50')],_0x55aab6[_0x42c5('0x5a')]);_0x2c9bf6[_0x42c5('0x5d')]=_[_0x42c5('0x5c')](_0x55aab6[_0x42c5('0x50')],qs[_0x42c5('0x5e')](_0x12c3de[_0x42c5('0x5a')][_0x42c5('0x5e')]));_0x2c9bf6[_0x42c5('0x5d')]=_0x2c9bf6[_0x42c5('0x5d')][_0x42c5('0x5f')]?_0x2c9bf6[_0x42c5('0x5d')]:_0x55aab6[_0x42c5('0x50')];if(!_0x12c3de['query']['hasOwnProperty'](_0x42c5('0x60'))){_0x2c9bf6['limit']=qs[_0x42c5('0x29')](_0x12c3de[_0x42c5('0x5a')][_0x42c5('0x29')]);_0x2c9bf6['offset']=qs[_0x42c5('0x28')](_0x12c3de[_0x42c5('0x5a')][_0x42c5('0x28')]);}_0x2c9bf6[_0x42c5('0x61')]=qs[_0x42c5('0x62')](_0x12c3de[_0x42c5('0x5a')][_0x42c5('0x62')]);_0x2c9bf6[_0x42c5('0x63')]=qs[_0x42c5('0x5b')](_[_0x42c5('0x80')](_0x12c3de[_0x42c5('0x5a')],_0x55aab6[_0x42c5('0x5b')]));_0x2c9bf6[_0x42c5('0x63')]['ChatWebsiteId']=_0x54f531['id'];if(_0x12c3de[_0x42c5('0x5a')][_0x42c5('0x64')]){_0x2c9bf6['where']=_[_0x42c5('0x6b')](_0x2c9bf6[_0x42c5('0x63')],{'$or':_[_0x42c5('0x3b')](_0x2c9bf6[_0x42c5('0x5d')],function(_0x359789){var _0x263bf0={};_0x263bf0[_0x359789]={'$like':'%'+_0x12c3de[_0x42c5('0x5a')][_0x42c5('0x64')]+'%'};return _0x263bf0;})});}_0x2c9bf6=_[_0x42c5('0x6b')]({},_0x2c9bf6,_0x12c3de[_0x42c5('0x6c')]);return db['ChatOfflineMessage'][_0x42c5('0x2b')]({'where':_0x2c9bf6['where']})[_0x42c5('0x1b')](function(_0x3b97d7){_0x582b11[_0x42c5('0x2b')]=_0x3b97d7;if(_0x12c3de[_0x42c5('0x5a')][_0x42c5('0x65')]){_0x2c9bf6['include']=[{'all':!![]}];}else{_0x2c9bf6[_0x42c5('0x66')]=[{'model':db[_0x42c5('0xa1')],'as':_0x42c5('0xfc'),'required':![]},{'model':db[_0x42c5('0x12d')],'as':_0x42c5('0x12e'),'required':![]}];}return db[_0x42c5('0xdd')][_0x42c5('0x67')](_0x2c9bf6);})['then'](function(_0x3387c6){_0x582b11[_0x42c5('0x68')]=_0x3387c6;return _0x582b11;});}})['then'](respondWithFilteredResult(_0x22f6ff,_0x2c9bf6))['catch'](handleError(_0x22f6ff,null));};exports[_0x42c5('0x12f')]=function(_0x525425,_0x4507ad){return db[_0x42c5('0x56')][_0x42c5('0x6d')]({'where':{'id':_0x525425[_0x42c5('0x79')]['id']}})[_0x42c5('0x1b')](handleEntityNotFound(_0x4507ad,null))[_0x42c5('0x1b')](function(_0x12e852){if(_0x12e852){return _0x12e852[_0x42c5('0x12f')](_0x525425['body'][_0x42c5('0xfb')],_[_0x42c5('0x124')](_0x525425['body'],[_0x42c5('0xfb'),'id'])||{})['spread'](function(_0xe909af){for(var _0x35ea44=0x0;_0x35ea44<_0x525425[_0x42c5('0x78')]['ids'][_0x42c5('0x5f')];_0x35ea44+=0x1){socket['emit'](_0x42c5('0x130'),{'UserId':Number(_0x525425['body']['ids'][_0x35ea44]),'ChatWebsiteId':Number(_0x525425[_0x42c5('0x79')]['id'])});}return _0xe909af;});}})['then'](respondWithResult(_0x4507ad,null))[_0x42c5('0x23')](handleError(_0x4507ad,null));};exports[_0x42c5('0x131')]=function(_0x247a56,_0x2f3403){return db['ChatWebsite'][_0x42c5('0x6d')]({'where':{'id':_0x247a56[_0x42c5('0x79')]['id']}})['then'](handleEntityNotFound(_0x2f3403,null))[_0x42c5('0x1b')](function(_0x282f79){if(_0x282f79){return _0x282f79['removeAgents'](_0x247a56[_0x42c5('0x5a')][_0x42c5('0xfb')])['then'](function(){if(_['isArray'](_0x247a56[_0x42c5('0x5a')][_0x42c5('0xfb')])){for(var _0x49798a=0x0;_0x49798a<_0x247a56[_0x42c5('0x5a')][_0x42c5('0xfb')]['length'];_0x49798a+=0x1){socket[_0x42c5('0x132')](_0x42c5('0x133'),{'UserId':Number(_0x247a56[_0x42c5('0x5a')][_0x42c5('0xfb')][_0x49798a]),'ChatWebsiteId':Number(_0x247a56[_0x42c5('0x79')]['id'])});}}else{socket[_0x42c5('0x132')](_0x42c5('0x133'),{'UserId':Number(_0x247a56[_0x42c5('0x5a')][_0x42c5('0xfb')]),'ChatWebsiteId':Number(_0x247a56[_0x42c5('0x79')]['id'])});}});}})[_0x42c5('0x1b')](respondWithStatusCode(_0x2f3403,null))[_0x42c5('0x23')](handleError(_0x2f3403,null));};exports[_0x42c5('0x134')]=function(_0x415412,_0xe8679e){var _0x2145b3={};var _0x55a0fa={};var _0x110a16;var _0x5d884e;return db[_0x42c5('0x56')][_0x42c5('0x7e')]({'where':{'id':_0x415412[_0x42c5('0x79')]['id']}})['then'](handleEntityNotFound(_0xe8679e,null))[_0x42c5('0x1b')](function(_0x5b42ac){if(_0x5b42ac){_0x110a16=_0x5b42ac;_0x55a0fa[_0x42c5('0x50')]=_[_0x42c5('0x6a')](db[_0x42c5('0xfd')][_0x42c5('0x57')]);_0x55a0fa[_0x42c5('0x5a')]=_[_0x42c5('0x6a')](_0x415412['query']);_0x55a0fa[_0x42c5('0x5b')]=_[_0x42c5('0x5c')](_0x55a0fa[_0x42c5('0x50')],_0x55a0fa[_0x42c5('0x5a')]);_0x2145b3[_0x42c5('0x5d')]=_[_0x42c5('0x5c')](_0x55a0fa[_0x42c5('0x50')],qs[_0x42c5('0x5e')](_0x415412[_0x42c5('0x5a')]['fields']));_0x2145b3['attributes']=_0x2145b3[_0x42c5('0x5d')][_0x42c5('0x5f')]?_0x2145b3[_0x42c5('0x5d')]:_0x55a0fa['model'];_0x2145b3[_0x42c5('0x61')]=qs[_0x42c5('0x62')](_0x415412[_0x42c5('0x5a')][_0x42c5('0x62')]);_0x2145b3[_0x42c5('0x63')]=qs[_0x42c5('0x5b')](_[_0x42c5('0x80')](_0x415412[_0x42c5('0x5a')],_0x55a0fa[_0x42c5('0x5b')]));if(_0x415412['query']['filter']){_0x2145b3['where']=_['merge'](_0x2145b3[_0x42c5('0x63')],{'$or':_[_0x42c5('0x3b')](_0x2145b3[_0x42c5('0x5d')],function(_0x3459b9){var _0x2e76f8={};_0x2e76f8[_0x3459b9]={'$like':'%'+_0x415412[_0x42c5('0x5a')][_0x42c5('0x64')]+'%'};return _0x2e76f8;})});}_0x2145b3=_[_0x42c5('0x6b')]({},_0x2145b3,_0x415412[_0x42c5('0x6c')]);return _0x110a16['getAgents'](_0x2145b3);}})[_0x42c5('0x1b')](function(_0x5ce23f){if(_0x5ce23f){_0x5d884e=_0x5ce23f['length'];if(!_0x415412[_0x42c5('0x5a')]['hasOwnProperty'](_0x42c5('0x60'))){_0x2145b3[_0x42c5('0x29')]=qs[_0x42c5('0x29')](_0x415412[_0x42c5('0x5a')][_0x42c5('0x29')]);_0x2145b3[_0x42c5('0x28')]=qs[_0x42c5('0x28')](_0x415412[_0x42c5('0x5a')][_0x42c5('0x28')]);}return _0x110a16[_0x42c5('0x134')](_0x2145b3);}})[_0x42c5('0x1b')](function(_0x289758){if(_0x289758){return _0x289758?{'count':_0x5d884e,'rows':_0x289758}:null;}})['then'](respondWithResult(_0xe8679e,null))[_0x42c5('0x23')](handleError(_0xe8679e,null));}; \ No newline at end of file +var _0x8c9a=['customerAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','sitepic','existsSync','root','server/files/images/logos/','getAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','isNil','download','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','contact','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','unknown','version','device','vendor','threadId','externalUrl','ChatInteraction','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','forcedOwnership','Start','EventManager','offline','files','CompanyId','ListId','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','virtual','increment','all','some','readFileSync','utf8','address','3.2.0','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','online','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','include','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ChatWebsiteId','Disposition','findOne','hasOwnProperty','where','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','findAll','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c9a,0x1f1));var _0xa8c9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c9a[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xa8c9('0x0'));var Mustache=require(_0xa8c9('0x1'));var util=require(_0xa8c9('0x2'));var path=require('path');var ejs=require(_0xa8c9('0x3'));var fs=require('fs');var fs_extra=require(_0xa8c9('0x4'));var _=require(_0xa8c9('0x5'));var querystring=require(_0xa8c9('0x6'));var Redis=require(_0xa8c9('0x7'));var qs=require(_0xa8c9('0x8'));var logger=require(_0xa8c9('0x9'))(_0xa8c9('0xa'));var config=require(_0xa8c9('0xb'));var url=require(_0xa8c9('0xc'));var db=require(_0xa8c9('0xd'))['db'];config['redis']=_['defaults'](config[_0xa8c9('0xe')],{'host':_0xa8c9('0xf'),'port':0x18eb});var socket=require(_0xa8c9('0x10'))(new Redis(config[_0xa8c9('0xe')]));require(_0xa8c9('0x11'))[_0xa8c9('0x12')](socket);var htmlToText=require(_0xa8c9('0x13'));var jayson=require(_0xa8c9('0x14'));var client=jayson[_0xa8c9('0x15')][_0xa8c9('0x16')]({'port':0x232c});var client9002=jayson[_0xa8c9('0x15')][_0xa8c9('0x16')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0xa8c9('0x15')][_0xa8c9('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x3d82cc,_0x377351,_0x33fc73,_0x4c5834){return new BPromise(function(_0x3e17dc,_0x15f833){var _0x412de2=_0x4c5834||client;return _0x412de2[_0xa8c9('0x17')](_0x3d82cc,_0x33fc73)[_0xa8c9('0x18')](function(_0x190d2a){logger[_0xa8c9('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x377351,_0xa8c9('0x1a'));logger[_0xa8c9('0x1b')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x377351,_0xa8c9('0x1a'),JSON[_0xa8c9('0x1c')](_0x190d2a));if(_0x190d2a[_0xa8c9('0x1d')]){if(_0x190d2a[_0xa8c9('0x1d')][_0xa8c9('0x1e')]===0x1f4){logger[_0xa8c9('0x1d')](_0xa8c9('0x1f'),_0x377351,_0x190d2a[_0xa8c9('0x1d')]['message']);return _0x15f833(_0x190d2a[_0xa8c9('0x1d')][_0xa8c9('0x20')]);}logger['error'](_0xa8c9('0x1f'),_0x377351,_0x190d2a[_0xa8c9('0x1d')][_0xa8c9('0x20')]);return _0x3e17dc(_0x190d2a['error'][_0xa8c9('0x20')]);}else{logger[_0xa8c9('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x377351,_0xa8c9('0x1a'));_0x3e17dc(_0x190d2a[_0xa8c9('0x21')][_0xa8c9('0x20')]);}})[_0xa8c9('0x22')](function(_0x4a30c5){logger[_0xa8c9('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x377351,_0x4a30c5);_0x15f833(_0x4a30c5);});});}function respondWithStatusCode(_0x1c7c93,_0x159e83){_0x159e83=_0x159e83||0xcc;return function(_0x5c2a07){if(_0x5c2a07){return _0x1c7c93['sendStatus'](_0x159e83);}return _0x1c7c93[_0xa8c9('0x23')](_0x159e83)[_0xa8c9('0x24')]();};}function respondWithResult(_0x19ef1f,_0x12b677){_0x12b677=_0x12b677||0xc8;return function(_0x152013){if(_0x152013){return _0x19ef1f['status'](_0x12b677)[_0xa8c9('0x25')](_0x152013);}};}function respondWithFilteredResult(_0x4e71a8,_0x16aa57){return function(_0x4ca767){if(_0x4ca767){var _0x4a90de=typeof _0x16aa57['offset']===_0xa8c9('0x26')&&typeof _0x16aa57['limit']===_0xa8c9('0x26');var _0x18b0a1=_0x4ca767[_0xa8c9('0x27')];var _0x35e148=_0x4a90de?0x0:_0x16aa57[_0xa8c9('0x28')];var _0xcb0c1d=_0x4a90de?_0x4ca767[_0xa8c9('0x27')]:_0x16aa57[_0xa8c9('0x28')]+_0x16aa57[_0xa8c9('0x29')];var _0x6d136c;if(_0xcb0c1d>=_0x18b0a1){_0xcb0c1d=_0x18b0a1;_0x6d136c=0xc8;}else{_0x6d136c=0xce;}_0x4e71a8['status'](_0x6d136c);return _0x4e71a8[_0xa8c9('0x2a')](_0xa8c9('0x2b'),_0x35e148+'-'+_0xcb0c1d+'/'+_0x18b0a1)[_0xa8c9('0x25')](_0x4ca767);}return null;};}function saveUpdates(_0x43eba8){return function(_0x10e92f){if(_0x10e92f){return _0x10e92f['update'](_0x43eba8)['then'](function(_0x85de59){return _0x85de59;});}return null;};}function removeEntity(_0x29f7ca){return function(_0x410da3){if(_0x410da3){return _0x410da3[_0xa8c9('0x2c')]()[_0xa8c9('0x18')](function(){var _0x3f451b=_0x410da3[_0xa8c9('0x2d')]({'plain':!![]});var _0x4162f5=_0xa8c9('0x2e');return db[_0xa8c9('0x2f')][_0xa8c9('0x2c')]({'where':{'type':_0x4162f5,'resourceId':_0x3f451b['id']}})['then'](function(){return _0x410da3;});})['then'](function(){_0x29f7ca[_0xa8c9('0x23')](0xcc)[_0xa8c9('0x24')]();});}};}function handleEntityNotFound(_0x59f605){return function(_0x52fddd){if(!_0x52fddd){_0x59f605[_0xa8c9('0x30')](0x194);}return _0x52fddd;};}function handleError(_0x596261,_0x61d9f6){_0x61d9f6=_0x61d9f6||0x1f4;return function(_0x16ec45){logger[_0xa8c9('0x1d')](_0x16ec45[_0xa8c9('0x31')]);if(_0x16ec45[_0xa8c9('0x32')]){delete _0x16ec45['name'];}_0x596261[_0xa8c9('0x23')](_0x61d9f6)['send'](_0x16ec45);};}exports[_0xa8c9('0x33')]=function(_0x4c3349,_0x463f03){var _0x4ce7ff={'include':[{'model':db[_0xa8c9('0x34')],'as':_0xa8c9('0x35')}]},_0x47dd16={},_0x5dcefa={'count':0x0,'rows':[]};var _0x4e10ab=_[_0xa8c9('0x36')](db[_0xa8c9('0x37')][_0xa8c9('0x38')],function(_0x5e1f93){return{'name':_0x5e1f93['fieldName'],'type':_0x5e1f93[_0xa8c9('0x39')][_0xa8c9('0x3a')]};});_0x47dd16[_0xa8c9('0x3b')]=_[_0xa8c9('0x36')](_0x4e10ab,'name');_0x47dd16[_0xa8c9('0x3c')]=_[_0xa8c9('0x3d')](_0x4c3349[_0xa8c9('0x3c')]);_0x47dd16['filters']=_[_0xa8c9('0x3e')](_0x47dd16[_0xa8c9('0x3b')],_0x47dd16['query']);_0x4ce7ff[_0xa8c9('0x3f')]=_[_0xa8c9('0x3e')](_0x47dd16[_0xa8c9('0x3b')],qs[_0xa8c9('0x40')](_0x4c3349['query'][_0xa8c9('0x40')]));_0x4ce7ff[_0xa8c9('0x3f')]=_0x4ce7ff[_0xa8c9('0x3f')][_0xa8c9('0x41')]?_0x4ce7ff[_0xa8c9('0x3f')]:_0x47dd16[_0xa8c9('0x3b')];if(!_0x4c3349[_0xa8c9('0x3c')]['hasOwnProperty'](_0xa8c9('0x42'))){_0x4ce7ff['limit']=qs[_0xa8c9('0x29')](_0x4c3349[_0xa8c9('0x3c')]['limit']);_0x4ce7ff[_0xa8c9('0x28')]=qs[_0xa8c9('0x28')](_0x4c3349[_0xa8c9('0x3c')][_0xa8c9('0x28')]);}_0x4ce7ff['order']=qs[_0xa8c9('0x43')](_0x4c3349['query'][_0xa8c9('0x43')]);_0x4ce7ff['where']=qs[_0xa8c9('0x44')](_[_0xa8c9('0x45')](_0x4c3349[_0xa8c9('0x3c')],_0x47dd16['filters']),_0x4e10ab);if(_0x4c3349[_0xa8c9('0x3c')][_0xa8c9('0x46')]){_0x4ce7ff['where']=_[_0xa8c9('0x47')](_0x4ce7ff['where'],{'$or':_[_0xa8c9('0x36')](_0x4e10ab,function(_0x5e3461){if(_0x5e3461[_0xa8c9('0x39')]!=='VIRTUAL'){var _0x679c96={};_0x679c96[_0x5e3461['name']]={'$like':'%'+_0x4c3349[_0xa8c9('0x3c')][_0xa8c9('0x46')]+'%'};return _0x679c96;}})});}_0x4ce7ff=_[_0xa8c9('0x47')]({},_0x4ce7ff,_0x4c3349['options']);var _0x110239={'where':_0x4ce7ff['where']};return db[_0xa8c9('0x37')][_0xa8c9('0x27')](_0x110239)[_0xa8c9('0x18')](function(_0x2e8be1){_0x5dcefa['count']=_0x2e8be1;if(_0x4c3349[_0xa8c9('0x3c')]['includeAll']){_0x4ce7ff[_0xa8c9('0x48')]=[{'all':!![]}];}return db[_0xa8c9('0x37')]['findAll'](_0x4ce7ff);})[_0xa8c9('0x18')](function(_0x382ebb){_0x5dcefa['rows']=_0x382ebb;return _0x5dcefa;})['then'](respondWithFilteredResult(_0x463f03,_0x4ce7ff))[_0xa8c9('0x22')](handleError(_0x463f03,null));};exports[_0xa8c9('0x49')]=function(_0x4dac5a,_0x53bf88){var _0x21f674={'raw':![],'where':{'id':_0x4dac5a['params']['id']},'include':[{'model':db['Pause'],'as':_0xa8c9('0x35')}]},_0x1e513f={};_0x1e513f[_0xa8c9('0x3b')]=_[_0xa8c9('0x3d')](db[_0xa8c9('0x37')][_0xa8c9('0x38')]);_0x1e513f[_0xa8c9('0x3c')]=_[_0xa8c9('0x3d')](_0x4dac5a[_0xa8c9('0x3c')]);_0x1e513f['filters']=_[_0xa8c9('0x3e')](_0x1e513f[_0xa8c9('0x3b')],_0x1e513f[_0xa8c9('0x3c')]);_0x21f674[_0xa8c9('0x3f')]=_[_0xa8c9('0x3e')](_0x1e513f[_0xa8c9('0x3b')],qs[_0xa8c9('0x40')](_0x4dac5a[_0xa8c9('0x3c')][_0xa8c9('0x40')]));_0x21f674[_0xa8c9('0x3f')]=_0x21f674['attributes'][_0xa8c9('0x41')]?_0x21f674[_0xa8c9('0x3f')]:_0x1e513f[_0xa8c9('0x3b')];if(_0x4dac5a[_0xa8c9('0x3c')]['includeAll']){_0x21f674[_0xa8c9('0x48')]=[{'all':!![]}];}_0x21f674=_[_0xa8c9('0x47')]({},_0x21f674,_0x4dac5a[_0xa8c9('0x4a')]);return db[_0xa8c9('0x37')][_0xa8c9('0x4b')](_0x21f674)[_0xa8c9('0x18')](handleEntityNotFound(_0x53bf88,null))[_0xa8c9('0x18')](respondWithResult(_0x53bf88,null))[_0xa8c9('0x22')](handleError(_0x53bf88,null));};exports[_0xa8c9('0x4c')]=function(_0x289dbf,_0xd03479){return db['ChatWebsite'][_0xa8c9('0x4c')](_0x289dbf[_0xa8c9('0x4d')],{})[_0xa8c9('0x18')](function(_0x5ece68){var _0x2e5041=_0x289dbf['user'][_0xa8c9('0x2d')]({'plain':!![]});if(!_0x2e5041)throw new Error(_0xa8c9('0x4e'));if(_0x2e5041['role']==='user'){var _0x3571d5=_0x5ece68[_0xa8c9('0x2d')]({'plain':!![]});var _0x413552='ChatWebsites';return db[_0xa8c9('0x4f')][_0xa8c9('0x4b')]({'where':{'name':_0x413552,'userProfileId':_0x2e5041['userProfileId']},'raw':!![]})['then'](function(_0x54e87d){if(_0x54e87d&&_0x54e87d['autoAssociation']===0x0){return db[_0xa8c9('0x2f')][_0xa8c9('0x4c')]({'name':_0x3571d5[_0xa8c9('0x32')],'resourceId':_0x3571d5['id'],'type':_0x54e87d[_0xa8c9('0x32')],'sectionId':_0x54e87d['id']},{})[_0xa8c9('0x18')](function(){return _0x5ece68;});}else{return _0x5ece68;}})['catch'](function(_0x26831e){logger['error'](_0xa8c9('0x50'),_0x26831e);throw _0x26831e;});}return _0x5ece68;})[_0xa8c9('0x18')](respondWithResult(_0xd03479,0xc9))[_0xa8c9('0x22')](handleError(_0xd03479,null));};exports[_0xa8c9('0x51')]=function(_0x3dda52,_0x35dbc5){if(_0x3dda52[_0xa8c9('0x4d')]['id']){delete _0x3dda52[_0xa8c9('0x4d')]['id'];}return db[_0xa8c9('0x37')]['find']({'where':{'id':_0x3dda52[_0xa8c9('0x52')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xa8c9('0x18')](handleEntityNotFound(_0x35dbc5,null))[_0xa8c9('0x18')](saveUpdates(_0x3dda52[_0xa8c9('0x4d')],null))[_0xa8c9('0x18')](respondWithResult(_0x35dbc5,null))['catch'](handleError(_0x35dbc5,null));};exports['destroy']=function(_0x4ea831,_0x547bd3){return db[_0xa8c9('0x37')][_0xa8c9('0x4b')]({'where':{'id':_0x4ea831[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x547bd3,null))[_0xa8c9('0x18')](removeEntity(_0x547bd3,null))[_0xa8c9('0x22')](handleError(_0x547bd3,null));};exports[_0xa8c9('0x53')]=function(_0x617860,_0x1582c3){return db[_0xa8c9('0x37')]['describe']()[_0xa8c9('0x18')](respondWithResult(_0x1582c3,null))['catch'](handleError(_0x1582c3,null));};exports['addDisposition']=function(_0x16ca53,_0x35363f){if(_0x16ca53['body']['id']){delete _0x16ca53[_0xa8c9('0x4d')]['id'];}return db[_0xa8c9('0x37')]['find']({'where':{'id':_0x16ca53[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x35363f,null))['then'](function(_0x6ac613){if(_0x6ac613){_0x16ca53['body'][_0xa8c9('0x54')]=_0x6ac613['id'];return db[_0xa8c9('0x55')]['create'](_0x16ca53[_0xa8c9('0x4d')]);}})['then'](respondWithResult(_0x35363f,null))[_0xa8c9('0x22')](handleError(_0x35363f,null));};exports['getDispositions']=function(_0x9c8965,_0x368e9f){var _0x349243={'raw':![],'where':{}};var _0x9c5d8a={};var _0x40cb94={'count':0x0,'rows':[]};return db[_0xa8c9('0x37')][_0xa8c9('0x56')]({'where':{'id':_0x9c8965['params']['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x368e9f,null))['then'](function(_0x5785cd){if(_0x5785cd){_0x9c5d8a[_0xa8c9('0x3b')]=_[_0xa8c9('0x3d')](db['Disposition'][_0xa8c9('0x38')]);_0x9c5d8a['query']=_[_0xa8c9('0x3d')](_0x9c8965['query']);_0x9c5d8a[_0xa8c9('0x44')]=_[_0xa8c9('0x3e')](_0x9c5d8a[_0xa8c9('0x3b')],_0x9c5d8a[_0xa8c9('0x3c')]);_0x349243['attributes']=_[_0xa8c9('0x3e')](_0x9c5d8a[_0xa8c9('0x3b')],qs['fields'](_0x9c8965[_0xa8c9('0x3c')][_0xa8c9('0x40')]));_0x349243[_0xa8c9('0x3f')]=_0x349243[_0xa8c9('0x3f')][_0xa8c9('0x41')]?_0x349243[_0xa8c9('0x3f')]:_0x9c5d8a[_0xa8c9('0x3b')];if(!_0x9c8965[_0xa8c9('0x3c')][_0xa8c9('0x57')](_0xa8c9('0x42'))){_0x349243[_0xa8c9('0x29')]=qs[_0xa8c9('0x29')](_0x9c8965[_0xa8c9('0x3c')][_0xa8c9('0x29')]);_0x349243['offset']=qs['offset'](_0x9c8965[_0xa8c9('0x3c')][_0xa8c9('0x28')]);}_0x349243['order']=qs[_0xa8c9('0x43')](_0x9c8965[_0xa8c9('0x3c')][_0xa8c9('0x43')]);_0x349243['where']=qs[_0xa8c9('0x44')](_[_0xa8c9('0x45')](_0x9c8965[_0xa8c9('0x3c')],_0x9c5d8a[_0xa8c9('0x44')]));_0x349243[_0xa8c9('0x58')][_0xa8c9('0x54')]=_0x5785cd['id'];if(_0x9c8965['query'][_0xa8c9('0x46')]){_0x349243['where']=_['merge'](_0x349243[_0xa8c9('0x58')],{'$or':_[_0xa8c9('0x36')](_0x349243[_0xa8c9('0x3f')],function(_0x288e6d){var _0x320ae8={};_0x320ae8[_0x288e6d]={'$like':'%'+_0x9c8965['query'][_0xa8c9('0x46')]+'%'};return _0x320ae8;})});}_0x349243=_['merge']({},_0x349243,_0x9c8965[_0xa8c9('0x4a')]);return db[_0xa8c9('0x55')][_0xa8c9('0x27')]({'where':_0x349243[_0xa8c9('0x58')]})['then'](function(_0x47fe5d){_0x40cb94[_0xa8c9('0x27')]=_0x47fe5d;if(_0x9c8965['query'][_0xa8c9('0x59')]){_0x349243[_0xa8c9('0x48')]=[{'all':!![]}];}return db[_0xa8c9('0x55')]['findAll'](_0x349243);})['then'](function(_0x41a727){_0x40cb94[_0xa8c9('0x5a')]=_0x41a727;return _0x40cb94;});}})[_0xa8c9('0x18')](respondWithFilteredResult(_0x368e9f,_0x349243))[_0xa8c9('0x22')](handleError(_0x368e9f,null));};exports[_0xa8c9('0x5b')]=function(_0x45bbd9,_0x1ef915){return db['ChatWebsite'][_0xa8c9('0x4b')]({'where':{'id':_0x45bbd9['params']['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x1ef915,null))['then'](function(_0xd3af91){if(_0xd3af91){return _0xd3af91[_0xa8c9('0x5b')](_0x45bbd9[_0xa8c9('0x3c')][_0xa8c9('0x5c')]);}})[_0xa8c9('0x18')](respondWithStatusCode(_0x1ef915,null))[_0xa8c9('0x22')](handleError(_0x1ef915,null));};exports[_0xa8c9('0x5d')]=function(_0x4fef92,_0x578a35){if(_0x4fef92['body']['id']){delete _0x4fef92['body']['id'];}return db['ChatWebsite'][_0xa8c9('0x4b')]({'where':{'id':_0x4fef92[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x578a35,null))[_0xa8c9('0x18')](function(_0x562e6e){if(_0x562e6e){_0x4fef92['body'][_0xa8c9('0x54')]=_0x562e6e['id'];return db[_0xa8c9('0x5e')][_0xa8c9('0x4c')](_0x4fef92[_0xa8c9('0x4d')]);}})[_0xa8c9('0x18')](respondWithResult(_0x578a35,null))['catch'](handleError(_0x578a35,null));};exports[_0xa8c9('0x5f')]=function(_0x3a6112,_0x572490){var _0x55d5b4={'raw':![],'where':{}};var _0x51fe28={};var _0x303a8f={'count':0x0,'rows':[]};return db[_0xa8c9('0x37')]['findOne']({'where':{'id':_0x3a6112[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x572490,null))[_0xa8c9('0x18')](function(_0x472530){if(_0x472530){_0x51fe28[_0xa8c9('0x3b')]=_['keys'](db['CannedAnswer'][_0xa8c9('0x38')]);_0x51fe28['query']=_[_0xa8c9('0x3d')](_0x3a6112[_0xa8c9('0x3c')]);_0x51fe28[_0xa8c9('0x44')]=_[_0xa8c9('0x3e')](_0x51fe28[_0xa8c9('0x3b')],_0x51fe28[_0xa8c9('0x3c')]);_0x55d5b4['attributes']=_['intersection'](_0x51fe28[_0xa8c9('0x3b')],qs[_0xa8c9('0x40')](_0x3a6112[_0xa8c9('0x3c')][_0xa8c9('0x40')]));_0x55d5b4['attributes']=_0x55d5b4['attributes'][_0xa8c9('0x41')]?_0x55d5b4[_0xa8c9('0x3f')]:_0x51fe28[_0xa8c9('0x3b')];if(!_0x3a6112['query'][_0xa8c9('0x57')](_0xa8c9('0x42'))){_0x55d5b4[_0xa8c9('0x29')]=qs[_0xa8c9('0x29')](_0x3a6112[_0xa8c9('0x3c')]['limit']);_0x55d5b4[_0xa8c9('0x28')]=qs[_0xa8c9('0x28')](_0x3a6112['query'][_0xa8c9('0x28')]);}_0x55d5b4[_0xa8c9('0x60')]=qs['sort'](_0x3a6112[_0xa8c9('0x3c')][_0xa8c9('0x43')]);_0x55d5b4[_0xa8c9('0x58')]=qs[_0xa8c9('0x44')](_[_0xa8c9('0x45')](_0x3a6112['query'],_0x51fe28['filters']));_0x55d5b4[_0xa8c9('0x58')][_0xa8c9('0x54')]=_0x472530['id'];if(_0x3a6112[_0xa8c9('0x3c')]['filter']){_0x55d5b4[_0xa8c9('0x58')]=_['merge'](_0x55d5b4[_0xa8c9('0x58')],{'$or':_[_0xa8c9('0x36')](_0x55d5b4[_0xa8c9('0x3f')],function(_0x49a07c){var _0x553883={};_0x553883[_0x49a07c]={'$like':'%'+_0x3a6112['query'][_0xa8c9('0x46')]+'%'};return _0x553883;})});}_0x55d5b4=_[_0xa8c9('0x47')]({},_0x55d5b4,_0x3a6112[_0xa8c9('0x4a')]);return db[_0xa8c9('0x5e')][_0xa8c9('0x27')]({'where':_0x55d5b4[_0xa8c9('0x58')]})[_0xa8c9('0x18')](function(_0x50f24b){_0x303a8f[_0xa8c9('0x27')]=_0x50f24b;if(_0x3a6112[_0xa8c9('0x3c')][_0xa8c9('0x59')]){_0x55d5b4[_0xa8c9('0x48')]=[{'all':!![]}];}return db[_0xa8c9('0x5e')][_0xa8c9('0x61')](_0x55d5b4);})['then'](function(_0xc63274){_0x303a8f[_0xa8c9('0x5a')]=_0xc63274;return _0x303a8f;});}})[_0xa8c9('0x18')](respondWithFilteredResult(_0x572490,_0x55d5b4))['catch'](handleError(_0x572490,null));};exports[_0xa8c9('0x62')]=function(_0x320ba6,_0x2b774b){return db[_0xa8c9('0x37')][_0xa8c9('0x4b')]({'where':{'id':_0x320ba6[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x2b774b,null))[_0xa8c9('0x18')](function(_0x5204f6){if(_0x5204f6){return _0x5204f6['removeAnswers'](_0x320ba6[_0xa8c9('0x3c')][_0xa8c9('0x5c')]);}})[_0xa8c9('0x18')](respondWithStatusCode(_0x2b774b,null))[_0xa8c9('0x22')](handleError(_0x2b774b,null));};exports[_0xa8c9('0x63')]=function(_0x331f51,_0x3a1506){_0x331f51[_0xa8c9('0x4d')]['sitepic']=_0x331f51[_0xa8c9('0x64')][_0xa8c9('0x65')];return db[_0xa8c9('0x37')][_0xa8c9('0x4b')]({'where':{'id':_0x331f51['params']['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x3a1506,null))[_0xa8c9('0x18')](saveUpdates(_0x331f51['body'],null))[_0xa8c9('0x18')](respondWithResult(_0x3a1506,null))[_0xa8c9('0x22')](handleError(_0x3a1506,null));};exports[_0xa8c9('0x66')]=function(_0x21ae45,_0x3fe3d7){_0x21ae45[_0xa8c9('0x4d')][_0xa8c9('0x67')]=_0x21ae45[_0xa8c9('0x64')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x21ae45[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x3fe3d7,null))[_0xa8c9('0x18')](saveUpdates(_0x21ae45[_0xa8c9('0x4d')],null))[_0xa8c9('0x18')](respondWithResult(_0x3fe3d7,null))[_0xa8c9('0x22')](handleError(_0x3fe3d7,null));};exports[_0xa8c9('0x68')]=function(_0x1b926c,_0x1d81a9){_0x1b926c[_0xa8c9('0x4d')][_0xa8c9('0x69')]=_0x1b926c[_0xa8c9('0x64')][_0xa8c9('0x65')];return db[_0xa8c9('0x37')][_0xa8c9('0x4b')]({'where':{'id':_0x1b926c[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x1d81a9,null))[_0xa8c9('0x18')](saveUpdates(_0x1b926c[_0xa8c9('0x4d')],null))[_0xa8c9('0x18')](respondWithResult(_0x1d81a9,null))[_0xa8c9('0x22')](handleError(_0x1d81a9,null));};exports['addSystemAvatar']=function(_0x3b9234,_0x4c4c9b){_0x3b9234[_0xa8c9('0x4d')][_0xa8c9('0x6a')]=_0x3b9234[_0xa8c9('0x64')][_0xa8c9('0x65')];return db[_0xa8c9('0x37')]['find']({'where':{'id':_0x3b9234[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x4c4c9b,null))[_0xa8c9('0x18')](saveUpdates(_0x3b9234['body'],null))[_0xa8c9('0x18')](respondWithResult(_0x4c4c9b,null))[_0xa8c9('0x22')](handleError(_0x4c4c9b,null));};exports[_0xa8c9('0x6b')]=function(_0x1e2260,_0x3b0e31){var _0x3302a6=path[_0xa8c9('0x6c')](config['root'],_0xa8c9('0x6d'));var _0x393c4d={'where':{'id':_0x1e2260[_0xa8c9('0x52')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0xc79361=![];return require(_0xa8c9('0x6e'))[_0xa8c9('0x6f')]()[_0xa8c9('0x18')](function(_0x29264e){if(_0x29264e){_0xc79361=_0x29264e[_0xa8c9('0x70')];}})[_0xa8c9('0x18')](function(){return db[_0xa8c9('0x37')][_0xa8c9('0x4b')](_0x393c4d);})[_0xa8c9('0x18')](handleEntityNotFound(_0x3b0e31,null))[_0xa8c9('0x18')](function(_0x5c56f4){if(_0x5c56f4){if(!_['isNil'](_0x5c56f4[_0xa8c9('0x71')])){if(fs[_0xa8c9('0x72')](path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],_0xa8c9('0x74'),_0x5c56f4[_0xa8c9('0x71')]))&&_0xc79361){_0x3302a6=path['join'](config[_0xa8c9('0x73')],_0xa8c9('0x74'),_0x5c56f4['sitepic']);}}return _0x3b0e31['download'](_0x3302a6);}})[_0xa8c9('0x22')](handleError(_0x3b0e31,null));};exports[_0xa8c9('0x75')]=function(_0x2c63d,_0x4facaa){var _0x2fad33=path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],'server/files/images/avatars/default_avatar.png');var _0x47d3b4={'where':{'id':_0x2c63d['params']['id']},'attributes':['id',_0xa8c9('0x67')],'raw':!![]};return db[_0xa8c9('0x37')]['find'](_0x47d3b4)[_0xa8c9('0x18')](handleEntityNotFound(_0x4facaa,null))['then'](function(_0x57af4d){if(_0x57af4d){if(!_['isNil'](_0x57af4d[_0xa8c9('0x67')])){if(fs[_0xa8c9('0x72')](path[_0xa8c9('0x6c')](config['root'],_0xa8c9('0x76'),_0x57af4d['agentAvatar']))){_0x2fad33=path['join'](config['root'],_0xa8c9('0x76'),_0x57af4d[_0xa8c9('0x67')]);}}return _0x4facaa['download'](_0x2fad33);}})[_0xa8c9('0x22')](handleError(_0x4facaa,null));};exports[_0xa8c9('0x77')]=function(_0x4e697d,_0x18682b){var _0x5c4fb5=path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],'server/files/images/avatars/customer_avatar.png');var _0x266fd7={'where':{'id':_0x4e697d[_0xa8c9('0x52')]['id']},'attributes':['id',_0xa8c9('0x69'),'showCustomerAvatar'],'raw':!![]};return db[_0xa8c9('0x37')][_0xa8c9('0x4b')](_0x266fd7)[_0xa8c9('0x18')](handleEntityNotFound(_0x18682b,null))[_0xa8c9('0x18')](function(_0x4bf016){if(_0x4bf016){if(!_['isNil'](_0x4bf016['customerAvatar'])){if(fs['existsSync'](path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],'server/files/images/avatars/',_0x4bf016[_0xa8c9('0x69')]))&&_0x4bf016[_0xa8c9('0x78')]){_0x5c4fb5=path['join'](config[_0xa8c9('0x73')],_0xa8c9('0x76'),_0x4bf016[_0xa8c9('0x69')]);}}return _0x18682b['download'](_0x5c4fb5);}})[_0xa8c9('0x22')](handleError(_0x18682b,null));};exports[_0xa8c9('0x79')]=function(_0x3bfe52,_0xd7e243){var _0x43504b=path[_0xa8c9('0x6c')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x53fd19={'where':{'id':_0x3bfe52[_0xa8c9('0x52')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xa8c9('0x37')]['find'](_0x53fd19)[_0xa8c9('0x18')](handleEntityNotFound(_0xd7e243,null))[_0xa8c9('0x18')](function(_0x5de6d3){if(_0x5de6d3){if(!_[_0xa8c9('0x7a')](_0x5de6d3[_0xa8c9('0x6a')])){if(fs[_0xa8c9('0x72')](path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],'server/files/images/avatars/',_0x5de6d3['systemAvatar']))){_0x43504b=path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],'server/files/images/avatars/',_0x5de6d3[_0xa8c9('0x6a')]);}}return _0xd7e243[_0xa8c9('0x7b')](_0x43504b);}})['catch'](handleError(_0xd7e243,null));};exports[_0xa8c9('0x7c')]=function(_0x381509,_0x54aae1){var _0x28ccce=require(_0xa8c9('0x7d'));var _0x2f74ba=new _0x28ccce();var _0x1c0513=_0x2f74ba[_0xa8c9('0x7e')](_0x381509[_0xa8c9('0x7f')][_0xa8c9('0x80')])[_0xa8c9('0x81')]();var _0x242277={'body':_0x381509[_0xa8c9('0x4d')],'channel':'chat'};var _0x293dbc=[];var _0x48a380=[];var _0x15b3e0={};var _0x1908d9=![];return db[_0xa8c9('0x82')][_0xa8c9('0x53')]()['then'](function(_0x255dfa){if(!_0x255dfa){throw new db[(_0xa8c9('0x83'))][(_0xa8c9('0x84'))](_0xa8c9('0x85'));}_0x293dbc=_[_0xa8c9('0x86')](_[_0xa8c9('0x3d')](_0x255dfa),[_0xa8c9('0x87'),_0xa8c9('0x88')]);_0x48a380=_[_0xa8c9('0x86')](_[_0xa8c9('0x3d')](_0x255dfa),['createdAt','updatedAt','CompanyId','ListId']);if(_0x381509[_0xa8c9('0x4d')]['id']){delete _0x381509[_0xa8c9('0x4d')]['id'];}if(_[_0xa8c9('0x7a')](_0x381509['body'][_0xa8c9('0x89')])){throw new db[(_0xa8c9('0x83'))][(_0xa8c9('0x84'))]('from\x20is\x20mandatory');}if(_[_0xa8c9('0x7a')](_0x381509[_0xa8c9('0x4d')][_0xa8c9('0x4d')])||_0x381509[_0xa8c9('0x4d')]['body']===''){throw new db[(_0xa8c9('0x83'))]['ValidationError'](_0xa8c9('0x8a'));}if(_[_0xa8c9('0x7a')](_0x381509['body'][_0xa8c9('0x8b')])){throw new db['Sequelize'][(_0xa8c9('0x84'))](_0xa8c9('0x8c')+_0x48a380);}if(!_[_0xa8c9('0x8d')](_0x48a380,_0x381509['body']['mapKey'])){throw new db[(_0xa8c9('0x83'))][(_0xa8c9('0x84'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x48a380);}_0x15b3e0[_0x381509[_0xa8c9('0x4d')]['mapKey']]=_0x381509[_0xa8c9('0x4d')][_0xa8c9('0x89')];})[_0xa8c9('0x18')](function(){return db[_0xa8c9('0x37')][_0xa8c9('0x4b')]({'where':{'id':_0x381509['params']['id']},'include':[{'model':db[_0xa8c9('0x8e')],'as':_0xa8c9('0x8f'),'include':[{'model':db[_0xa8c9('0x82')],'as':_0xa8c9('0x90'),'where':_0x15b3e0,'limit':0x1,'order':[[_0xa8c9('0x88'),'DESC']]}]},{'model':db[_0xa8c9('0x91')],'as':_0xa8c9('0x92')}]});})[_0xa8c9('0x18')](handleEntityNotFound(_0x54aae1,null))[_0xa8c9('0x18')](function(_0x415090){if(_0x415090&&_0x415090[_0xa8c9('0x8f')]){_0x242277[_0xa8c9('0x93')]=_0x415090;_0x242277[_0xa8c9('0x94')]=_0x415090[_0xa8c9('0x92')];_0x242277[_0xa8c9('0x95')]=_0x415090[_0xa8c9('0x8f')];_0x242277[_0xa8c9('0x94')]=_[_0xa8c9('0x96')](_0x242277['applications'],[_0xa8c9('0x97')],[_0xa8c9('0x98')]);if(_0x242277[_0xa8c9('0x93')]['Applications']){delete _0x242277[_0xa8c9('0x93')]['Applications'];}if(_0x242277[_0xa8c9('0x93')][_0xa8c9('0x8f')]&&_0x242277[_0xa8c9('0x93')][_0xa8c9('0x8f')][_0xa8c9('0x90')][_0xa8c9('0x41')]){return _0x242277[_0xa8c9('0x93')]['List'][_0xa8c9('0x90')][0x0];}var _0x4e253c=_[_0xa8c9('0x99')](_0x381509[_0xa8c9('0x4d')],{'firstName':_0x381509[_0xa8c9('0x4d')]['from'],'ListId':_0x415090['ListId']});_0x4e253c[_0x381509[_0xa8c9('0x4d')][_0xa8c9('0x8b')]]=_0x381509[_0xa8c9('0x4d')][_0xa8c9('0x89')];return db[_0xa8c9('0x82')][_0xa8c9('0x4c')](_0x4e253c,{'fields':_0x293dbc,'raw':!![]});}})[_0xa8c9('0x18')](handleEntityNotFound(_0x54aae1,null))[_0xa8c9('0x18')](function(_0x4d8d61){_0x242277[_0xa8c9('0x9a')]=_0x4d8d61;var _0x27ecc6=_0x381509['body']['customerIp'];if(_0x381509['headers'][_0xa8c9('0x9b')]){_0x27ecc6=_0x381509[_0xa8c9('0x7f')][_0xa8c9('0x9b')];}else if(_0x381509[_0xa8c9('0x7f')][_0xa8c9('0x9c')]){_0x27ecc6=_[_0xa8c9('0x9d')](_0x381509[_0xa8c9('0x7f')][_0xa8c9('0x9c')][_0xa8c9('0x9e')](','));}if(_0x4d8d61){var _0xc73cfe={'ContactId':_0x4d8d61['id'],'ChatWebsiteId':_0x381509[_0xa8c9('0x52')]['id'],'from':(_0x4d8d61[_0xa8c9('0x9f')]||'')+'\x20'+(_0x4d8d61[_0xa8c9('0xa0')]||''),'customerIp':_0x27ecc6,'customerPort':_0x381509[_0xa8c9('0x7f')][_0xa8c9('0xa1')]?_0x381509[_0xa8c9('0x7f')][_0xa8c9('0xa1')]:null,'referer':_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xa2')],'browserName':_0x1c0513[_0xa8c9('0xa3')][_0xa8c9('0x32')]&&_0x1c0513[_0xa8c9('0xa3')]['version']?util[_0xa8c9('0xa4')](_0xa8c9('0xa5'),_0x1c0513['browser']['name'],_0x1c0513[_0xa8c9('0xa3')]['version']):_0xa8c9('0xa6'),'browserVersion':_0x1c0513['browser']['version']||_0xa8c9('0xa6'),'osName':util[_0xa8c9('0xa4')]('%s\x20%s',_0x1c0513['os']['name'],_0x1c0513['os'][_0xa8c9('0xa7')]),'osVersion':_0x1c0513['os'][_0xa8c9('0xa7')],'deviceModel':_0x1c0513[_0xa8c9('0xa8')]['model']&&_0x1c0513[_0xa8c9('0xa8')]['vendor']?util['format']('%s\x20%s\x20%s',_0x1c0513[_0xa8c9('0xa8')]['model'],_0x1c0513[_0xa8c9('0xa8')][_0xa8c9('0xa9')],_0x1c0513['device']['type']):null,'deviceVendor':_0x1c0513['device'][_0xa8c9('0xa9')],'deviceType':_0x1c0513[_0xa8c9('0xa8')][_0xa8c9('0x39')],'formData':JSON[_0xa8c9('0x1c')](_0x381509[_0xa8c9('0x4d')])};var _0xb55d29={'ChatWebsiteId':_0x381509[_0xa8c9('0x52')]['id'],'closed':![]};if(_0x381509[_0xa8c9('0x4d')]['threadId']){_0xb55d29['threadId']=_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xaa')];return db['ChatInteraction'][_0xa8c9('0x4b')]({'where':_0xb55d29})[_0xa8c9('0x18')](function(_0x54954b){if(_0x54954b){return[_0x54954b,![]];}_0xc73cfe[_0xa8c9('0xaa')]=_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xaa')];_0xc73cfe[_0xa8c9('0xab')]=_0x381509['body'][_0xa8c9('0xab')];return db[_0xa8c9('0xac')][_0xa8c9('0x4c')](_0xc73cfe)[_0xa8c9('0x18')](function(_0x20b5f9){return[_0x20b5f9,!![]];});});}_0xb55d29['ContactId']=_0x4d8d61['id'];if(_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xad')]&&_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xad')]['id']){_0xb55d29['id']=_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xad')]['id'];return db[_0xa8c9('0xac')][_0xa8c9('0x4b')]({'where':_0xb55d29})[_0xa8c9('0x18')](function(_0x5155df){if(_0x5155df){return[_0x5155df,![]];}return db[_0xa8c9('0xac')][_0xa8c9('0x4c')](_0xc73cfe)['then'](function(_0x5be0c0){return[_0x5be0c0,!![]];});});}return db[_0xa8c9('0xac')]['create'](_0xc73cfe)[_0xa8c9('0x18')](function(_0x1f6d61){return[_0x1f6d61,!![]];});}})[_0xa8c9('0xae')](function(_0x137b95,_0x5abba2){if(_0x137b95){_0x1908d9=_0x5abba2;if(!_0x5abba2){var _0x5e60aa={'from':(_0x242277[_0xa8c9('0x9a')][_0xa8c9('0x9f')]||'')+'\x20'+(_0x242277[_0xa8c9('0x9a')][_0xa8c9('0xa0')]||'')};if(_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xaa')]&&_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xaf')]&&_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xaa')]!=_0x381509[_0xa8c9('0x4d')]['messageId']){_0x5e60aa[_0xa8c9('0xaa')]=_0x381509[_0xa8c9('0x4d')][_0xa8c9('0xaf')];}return _0x137b95[_0xa8c9('0x51')](_0x5e60aa);}else{return _0x137b95;}}})[_0xa8c9('0x18')](function(_0x135545){_0x242277[_0xa8c9('0xad')]=_0x135545[_0xa8c9('0x2d')]({'plain':!![]});_0x242277['interaction'][_0xa8c9('0xb0')]=_0x1908d9;if(_0x242277[_0xa8c9('0xad')][_0xa8c9('0xb0')]){if(_0x242277[_0xa8c9('0x93')][_0xa8c9('0xb1')]){_0x242277['applications'][_0xa8c9('0xb2')]({'id':0x0,'priority':_0x242277[_0xa8c9('0x94')][_0xa8c9('0x41')]+0x1,'app':'close','appdata':_0xa8c9('0xb3'),'interval':_0xa8c9('0xb4')});}}return db[_0xa8c9('0xb5')][_0xa8c9('0x4c')]({'body':_0x381509[_0xa8c9('0x4d')][_0xa8c9('0x4d')],'ChatWebsiteId':_0x381509[_0xa8c9('0x52')]['id'],'ChatInteractionId':_0x135545['id'],'direction':'in','ContactId':_0x242277[_0xa8c9('0x9a')]['id'],'AttachmentId':_0x381509[_0xa8c9('0x4d')]['AttachmentId']});})[_0xa8c9('0x18')](function(_0xf7dc4f){_0x242277[_0xa8c9('0x20')]=_0xf7dc4f;if(_0x242277[_0xa8c9('0xad')][_0xa8c9('0xb6')]){return db[_0xa8c9('0xb7')][_0xa8c9('0x4b')]({'attributes':['id','name'],'where':{'id':_0x242277[_0xa8c9('0xad')][_0xa8c9('0xb6')]}})[_0xa8c9('0x18')](function(_0x36a384){if(_0x36a384){_0x242277[_0xa8c9('0x94')][_0xa8c9('0xb8')]({'id':0x0,'priority':0x0,'app':_0xa8c9('0xb9'),'appdata':_0x36a384[_0xa8c9('0x32')]+','+(_0x242277[_0xa8c9('0x93')]['waitForTheAssignedAgent']||0xa),'interval':_0xa8c9('0xb4')});_0x242277[_0xa8c9('0xba')]=!![];}return respondWithRpcPromise(_0xa8c9('0xbb'),'startRouting',_0x242277);});}return respondWithRpcPromise(_0xa8c9('0xbb'),'startRouting',_0x242277);})[_0xa8c9('0x18')](function(_0x3dc39c){respondWithRpcPromise(_0xa8c9('0xbc'),_0xa8c9('0xbc'),{'event':'notify','message':_0x3dc39c},client9002);return _0x3dc39c;})[_0xa8c9('0x18')](respondWithResult(_0x54aae1,null))[_0xa8c9('0x22')](handleError(_0x54aae1,null));};exports[_0xa8c9('0xbd')]=function(_0x2e3c44,_0x54d3a8){var _0x4d471a,_0x1f1b1b,_0x301874;var _0x5eb82f=[];var _0x32b64d={};var _0x156238=_0x2e3c44[_0xa8c9('0xbe')]||[];var _0x40dc39=[];var _0x19680b;return db[_0xa8c9('0x82')][_0xa8c9('0x53')]()[_0xa8c9('0x18')](function(_0x19631d){if(!_0x19631d){throw new db['Sequelize'][(_0xa8c9('0x84'))]('no\x20available\x20attributes');}_0x5eb82f=_[_0xa8c9('0x86')](_['keys'](_0x19631d),[_0xa8c9('0x87'),_0xa8c9('0x88'),_0xa8c9('0xbf'),_0xa8c9('0xc0')]);if(_0x2e3c44['body']['id']){delete _0x2e3c44[_0xa8c9('0x4d')]['id'];}if(_[_0xa8c9('0x7a')](_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0x89')])){throw _0x54d3a8[_0xa8c9('0x23')](0x1f4)[_0xa8c9('0xc1')](new db[(_0xa8c9('0x83'))][(_0xa8c9('0x84'))](_0xa8c9('0xc2')));}if(_[_0xa8c9('0x7a')](_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0x4d')])||_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0x4d')]===''){throw _0x54d3a8[_0xa8c9('0x23')](0x1f4)[_0xa8c9('0xc1')](new db['Sequelize'][(_0xa8c9('0x84'))](_0xa8c9('0x8a')));}if(_[_0xa8c9('0x7a')](_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0xc3')])){throw _0x54d3a8[_0xa8c9('0x23')](0x1f4)[_0xa8c9('0xc1')](new db[(_0xa8c9('0x83'))][(_0xa8c9('0x84'))](_0xa8c9('0xc4')+_0x5eb82f));}if(!_[_0xa8c9('0x8d')](_0x5eb82f,_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0xc3')])){throw _0x54d3a8[_0xa8c9('0x23')](0x1f4)[_0xa8c9('0xc1')](new db[(_0xa8c9('0x83'))][(_0xa8c9('0x84'))](_0xa8c9('0xc5')+_0x5eb82f));}_0x32b64d[_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0xc3')]]=_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0x89')];})[_0xa8c9('0x18')](function(){return db['ChatWebsite'][_0xa8c9('0x4b')]({'where':{'id':_0x2e3c44[_0xa8c9('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0xa8c9('0x8f')},{'model':db[_0xa8c9('0xc6')],'as':_0xa8c9('0xc6')}]});})[_0xa8c9('0x18')](handleEntityNotFound(_0x54d3a8,null))[_0xa8c9('0x18')](function(_0x346245){if(_0x346245&&_0x346245[_0xa8c9('0x8f')]){_0x1f1b1b=_0x346245;var _0x3e91ab=_[_0xa8c9('0x99')](_0x2e3c44[_0xa8c9('0x4d')],{'firstName':_0x2e3c44[_0xa8c9('0x4d')]['from'],'phone':_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0x89')],'ListId':_0x346245[_0xa8c9('0xc0')]});_0x3e91ab[_0x2e3c44['body'][_0xa8c9('0xc3')]]=_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0x89')];return db[_0xa8c9('0x82')][_0xa8c9('0xc7')]({'where':_0x32b64d,'defaults':_0x3e91ab});}})[_0xa8c9('0xae')](function(_0x37e66e){if(_0x37e66e){_0x301874=_0x37e66e;var _0x4cd6dc=fs['readFileSync'](path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],_0xa8c9('0xc8')),'utf8');var _0x4026fd=ejs[_0xa8c9('0xc9')](_0x4cd6dc,{'body':_[_0xa8c9('0xca')](_0x2e3c44[_0xa8c9('0x4d')][_0xa8c9('0x4d')]),'bodyTitle':_0x1f1b1b[_0xa8c9('0xcb')]});return db[_0xa8c9('0xcc')][_0xa8c9('0x4c')]({'body':_0x4026fd,'plainBody':htmlToText[_0xa8c9('0xcd')](_0x4026fd),'ContactId':_0x37e66e['id'],'ChatWebsiteId':_0x1f1b1b['id']});}})[_0xa8c9('0x18')](function(_0x20d2c5){_0x19680b=_0x20d2c5;if(_0x156238['length']){var _0x1aa8a1=_0x156238['map'](function(_0x1e5979){return{'name':_0x1e5979[_0xa8c9('0xce')],'basename':_0x1e5979['filename'],'type':_0x1e5979[_0xa8c9('0xcf')],'ChatOfflineMessageId':_0x20d2c5['id']};});_0x40dc39=_0x1aa8a1[_0xa8c9('0x36')](_0x5ab64c=>{var _0x5ce5d3={'filename':_0x5ab64c['name'],'path':path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],_0xa8c9('0xd0'),_0xa8c9('0xbe'),'attachments',_0xa8c9('0xd1'),_0x5ab64c['basename'])};return _0x5ce5d3;});if(!_0x1f1b1b[_0xa8c9('0xd2')]){return db[_0xa8c9('0xd3')][_0xa8c9('0xd4')](function(_0x3178a4){return db[_0xa8c9('0xd5')][_0xa8c9('0xd6')](_0x1aa8a1,{'transaction':_0x3178a4});});}}})[_0xa8c9('0x18')](function(){if(_0x19680b){_0x4d471a=_0x19680b;return db['MailAccount'][_0xa8c9('0x56')]({'where':{'service':!![]},'include':[{'model':db[_0xa8c9('0xd7')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa8c9('0xd8'),'raw':!![]}]}]});}})[_0xa8c9('0x18')](function(_0x4b42dc){if(_0x4b42dc&&_0x4b42dc[_0xa8c9('0xd9')]&&_0x1f1b1b[_0xa8c9('0xda')]&&_0x1f1b1b[_0xa8c9('0xdb')]){var _0x2016fe=_0x4b42dc['getSmtpOptions']();return respondWithRpcPromise(_0xa8c9('0xdc'),_0xa8c9('0xdd'),{'account':_0x2016fe,'message':{'from':util[_0xa8c9('0xa4')](_0xa8c9('0xde'),_0x4b42dc['name'],_0x4b42dc[_0xa8c9('0xdf')]||_0x4b42dc[_0xa8c9('0xd9')]['user']),'to':_0x1f1b1b['forwardOfflineAddress'],'subject':_0x1f1b1b[_0xa8c9('0xe0')],'html':_0x4d471a[_0xa8c9('0x4d')],'attachments':_0x40dc39}},client9003)['then'](function(){return _0x4d471a;})[_0xa8c9('0x22')](function(_0x10f47c){logger[_0xa8c9('0x1d')](_0x10f47c);});}})[_0xa8c9('0x18')](function(){if(_0x1f1b1b&&_0x1f1b1b['openNewInteraction']&&_0x1f1b1b[_0xa8c9('0xe1')]){var _0x313206=[];if(_0x156238[_0xa8c9('0x41')]){_0x313206=_0x156238[_0xa8c9('0x36')](function(_0x34eb6a){return{'name':_0x34eb6a[_0xa8c9('0xce')],'basename':_0x34eb6a[_0xa8c9('0x65')],'type':_0x34eb6a['mimetype'],'ChatOfflineMessageId':_0x19680b['id']};});}var _0x4b1a87;if(!_['isNil'](_0x1f1b1b['subjectOffline'])){var _0x2596c7=_[_0xa8c9('0x36')](_0x2e3c44[_0xa8c9('0x4d')],function(_0x19a76d){return _0x19a76d;});var _0x91ee24=_[_0xa8c9('0xe2')](_0x2596c7)[0x0];var _0x2acb67=_[_0xa8c9('0xe3')](_0x91ee24,function(_0x5ced52){return _0x5ced52;});_0x4b1a87=_0x2acb67[0x1][_0x1f1b1b[_0xa8c9('0xe4')]];}var _0x279465={'from':_0x301874[_0xa8c9('0xdf')],'firstName':_0x301874[_0xa8c9('0x9f')],'lastName':_0x301874[_0xa8c9('0xa0')],'mapKey':_0xa8c9('0xdf'),'message':{'from':_0x301874[_0xa8c9('0xdf')],'to':_0x1f1b1b[_0xa8c9('0xc6')][_0xa8c9('0xdf')],'cc':'','subject':_[_0xa8c9('0x7a')](_0x4b1a87)?_0x1f1b1b[_0xa8c9('0xe0')]:_0x4b1a87,'messageId':'','sentAt':new Date(),'attach':_0x313206['length'],'attachments':_0x313206,'originChannel':_0xa8c9('0xe5'),'ChatWebsiteId':_0x1f1b1b['id'],'ChatOfflineMessageId':_0x4d471a['id'],'originTo':_0x1f1b1b[_0xa8c9('0xc6')]['email']},'body':_0x4d471a['body']};var _0x17fb2f={'account':{'id':_0x1f1b1b['MailAccountId']},'body':_0x279465,'log':_0xa8c9('0xe6')};return respondWithRpcPromise(_0xa8c9('0xe6'),_0xa8c9('0xe7'),_0x17fb2f,client9001)[_0xa8c9('0x18')](function(){return _0x4d471a;})['catch'](function(_0x3be817){logger[_0xa8c9('0x1d')](_0x3be817);});}return;})['then'](function(){if(_0x4d471a){return _0x4d471a;}})[_0xa8c9('0x18')](respondWithResult(_0x54d3a8,null))[_0xa8c9('0x22')](function(_0x319829){logger[_0xa8c9('0x1d')](_0xa8c9('0x22'),_0x319829);for(var _0x42524d of _0x156238){var _0x50315c=path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],'server','files','attachments','offline-chat',_0x42524d[_0xa8c9('0x65')]);fs_extra[_0xa8c9('0xe8')](_0x50315c)[_0xa8c9('0x22')](function(_0x3adeac){logger[_0xa8c9('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0x50315c,_0x3adeac);});}});};exports[_0xa8c9('0xe9')]=function(_0x5c92c1,_0x2410bd){return db[_0xa8c9('0xac')][_0xa8c9('0x4b')]({'where':{'id':_0x5c92c1[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x2410bd,null))[_0xa8c9('0x18')](function(_0x2e4cd1){if(_0x2e4cd1){return _0x2e4cd1[_0xa8c9('0xe9')](_0x5c92c1[_0xa8c9('0x4d')]['ids'],_[_0xa8c9('0xea')](_0x5c92c1[_0xa8c9('0x4d')],[_0xa8c9('0x5c'),'id'])||{});}})[_0xa8c9('0x18')](respondWithResult(_0x2410bd,null))[_0xa8c9('0x22')](handleError(_0x2410bd,null));};exports[_0xa8c9('0xeb')]=function(_0x3e2ac9,_0xedd867){var _0x39b409={'raw':![],'where':{}};var _0x16e3c1={};var _0x2992a9={'count':0x0,'rows':[]};return db[_0xa8c9('0x37')][_0xa8c9('0x56')]({'where':{'id':_0x3e2ac9[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0xedd867,null))['then'](function(_0x6ea6ea){if(_0x6ea6ea){_0x16e3c1[_0xa8c9('0x3b')]=_[_0xa8c9('0x3d')](db[_0xa8c9('0xac')][_0xa8c9('0x38')]);_0x16e3c1[_0xa8c9('0x3c')]=_[_0xa8c9('0x3d')](_0x3e2ac9['query']);_0x16e3c1[_0xa8c9('0x44')]=_[_0xa8c9('0x3e')](_0x16e3c1[_0xa8c9('0x3b')],_0x16e3c1['query']);_0x39b409['attributes']=_['intersection'](_0x16e3c1[_0xa8c9('0x3b')],qs['fields'](_0x3e2ac9['query'][_0xa8c9('0x40')]));_0x39b409[_0xa8c9('0x3f')]=_0x39b409[_0xa8c9('0x3f')][_0xa8c9('0x41')]?_0x39b409['attributes']:_0x16e3c1[_0xa8c9('0x3b')];if(!_0x3e2ac9['query'][_0xa8c9('0x57')](_0xa8c9('0x42'))){_0x39b409[_0xa8c9('0x29')]=qs[_0xa8c9('0x29')](_0x3e2ac9[_0xa8c9('0x3c')]['limit']);_0x39b409['offset']=qs[_0xa8c9('0x28')](_0x3e2ac9['query']['offset']);}_0x39b409['order']=qs[_0xa8c9('0x43')](_0x3e2ac9[_0xa8c9('0x3c')][_0xa8c9('0x43')]);_0x39b409[_0xa8c9('0x58')]=qs[_0xa8c9('0x44')](_['pick'](_0x3e2ac9[_0xa8c9('0x3c')],_0x16e3c1[_0xa8c9('0x44')]));_0x39b409['where']['ChatWebsiteId']=_0x6ea6ea['id'];if(_0x3e2ac9['query'][_0xa8c9('0x46')]){_0x39b409[_0xa8c9('0x58')]=_[_0xa8c9('0x47')](_0x39b409[_0xa8c9('0x58')],{'$or':_['map'](_0x39b409[_0xa8c9('0x3f')],function(_0x33f814){var _0x2c09fa={};_0x2c09fa[_0x33f814]={'$like':'%'+_0x3e2ac9[_0xa8c9('0x3c')][_0xa8c9('0x46')]+'%'};return _0x2c09fa;})});}_0x39b409=_[_0xa8c9('0x47')]({},_0x39b409,_0x3e2ac9[_0xa8c9('0x4a')]);return db['ChatInteraction'][_0xa8c9('0x27')]({'where':_0x39b409[_0xa8c9('0x58')]})[_0xa8c9('0x18')](function(_0x58bfc){_0x2992a9[_0xa8c9('0x27')]=_0x58bfc;if(_0x3e2ac9[_0xa8c9('0x3c')][_0xa8c9('0x59')]){_0x39b409[_0xa8c9('0x48')]=[{'model':db[_0xa8c9('0x82')],'as':_0xa8c9('0xec'),'required':![]},{'model':db[_0xa8c9('0xb7')],'as':_0xa8c9('0xed'),'attributes':[_0xa8c9('0x32'),_0xa8c9('0xee'),_0xa8c9('0xef')],'required':![]},{'model':db[_0xa8c9('0xf0')],'as':_0xa8c9('0xf1'),'attributes':['id','name',_0xa8c9('0xf2')],'where':_0x3e2ac9[_0xa8c9('0x3c')][_0xa8c9('0xf3')]?{'id':_0x3e2ac9[_0xa8c9('0x3c')][_0xa8c9('0xf3')]}:undefined,'required':_0x3e2ac9['query'][_0xa8c9('0xf3')]?!![]:![]}];}return db[_0xa8c9('0xac')][_0xa8c9('0x61')](_0x39b409);})[_0xa8c9('0x18')](function(_0x21daf7){_0x2992a9[_0xa8c9('0x5a')]=_0x21daf7;return _0x2992a9;});}})[_0xa8c9('0x18')](respondWithFilteredResult(_0xedd867,_0x39b409))['catch'](handleError(_0xedd867,null));};function iftimePromise(_0x365820,_0x238b5c){return respondWithRpcPromise(_0xa8c9('0xf4'),_0xa8c9('0xf5'),{'command':_0x238b5c[_0xa8c9('0xf6')]?util[_0xa8c9('0xa4')](_0xa8c9('0xf7'),_0x365820[_0xa8c9('0xf8')],_0x238b5c[_0xa8c9('0xf6')]):util['format'](_0xa8c9('0xf9'),_0x365820[_0xa8c9('0xf8')])},client9002)['then'](function(_0x4864dd){var _0x46204a=_0x4864dd&&_0x4864dd[_0xa8c9('0xfa')](_0xa8c9('0xfb'))>=0x0?!![]:![];logger[_0xa8c9('0x19')](_0xa8c9('0xfc'),_0x238b5c['id'],_0x365820['id'],_0x365820[_0xa8c9('0xf8')],_0x46204a?_0xa8c9('0xfd'):'OFFLINE',_0x238b5c[_0xa8c9('0xf6')]?_0x238b5c[_0xa8c9('0xf6')]:_0xa8c9('0xfe'));return _0x46204a;})['catch'](function(_0x1deca1){logger[_0xa8c9('0x1d')](_0xa8c9('0xfc'),_0x238b5c['id'],_0x365820['id'],_0x365820[_0xa8c9('0xf8')],util[_0xa8c9('0xff')](_0x1deca1,{'showHidden':![],'depth':null}),_0x238b5c[_0xa8c9('0xf6')]?_0x238b5c[_0xa8c9('0xf6')]:_0xa8c9('0xfe'));return![];});}exports[_0xa8c9('0xf5')]=function(_0x5a8d58,_0x35c010){var _0x5bba2b=0x0;var _0x2c33d7=0x0;var _0x3386c2=![];var _0x5d6efd;var _0x31912b;return db[_0xa8c9('0x37')][_0xa8c9('0x4b')]({'where':{'id':_0x5a8d58['params']['id']},'include':[{'model':db[_0xa8c9('0x100')],'as':_0xa8c9('0x100'),'include':[{'model':db['Interval'],'as':_0xa8c9('0x101'),'attributes':['id',_0xa8c9('0xf8')],'raw':!![]}]}]})[_0xa8c9('0x18')](handleEntityNotFound(_0x35c010,null))[_0xa8c9('0x18')](function(_0x4a0120){if(_0x4a0120){_0x5d6efd=_0x4a0120;return _0x4a0120['getProactiveActions']({'raw':!![]});}})['then'](function(_0x19be3d){if(_0x5d6efd){if(_0x19be3d){_0x31912b=_0x19be3d;}}return require(_0xa8c9('0x6e'))[_0xa8c9('0x6f')]();})[_0xa8c9('0x18')](function(_0x185da3){if(_0x185da3){_0x2c33d7=_0x185da3[_0xa8c9('0x102')];_0x3386c2=_0x185da3['custom'];}})[_0xa8c9('0x18')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xa8c9('0x18')](function(_0x1e9e34){_0x5bba2b=_0x1e9e34;if(_0x2c33d7&&_0x1e9e34>_0x2c33d7){return db['License'][_0xa8c9('0x56')]({'where':{'id':0x1}})[_0xa8c9('0x18')](function(_0x159712){if(_0x159712){_0x159712[_0xa8c9('0x103')]('chatLicenseExceeded');}});}})[_0xa8c9('0x18')](function(){if(_0x5d6efd[_0xa8c9('0x100')]&&_0x5d6efd[_0xa8c9('0x100')][_0xa8c9('0x101')]){var _0x27ac91=[];for(var _0x451409=0x0;_0x451409<_0x5d6efd[_0xa8c9('0x100')]['Intervals'][_0xa8c9('0x41')];_0x451409++){var _0x5477a2=_0x5d6efd[_0xa8c9('0x100')][_0xa8c9('0x101')][_0x451409][_0xa8c9('0x2d')]({'plain':!![]});_0x27ac91[_0xa8c9('0xb2')](iftimePromise(_0x5477a2,_0x5d6efd));}return BPromise[_0xa8c9('0x104')](_0x27ac91)['then'](function(_0x438530){return _[_0xa8c9('0x105')](_0x438530);});}else{return!![];}})['then'](function(_0x51f426){var _0x53a6b1=fs[_0xa8c9('0x106')](path[_0xa8c9('0x6c')](config[_0xa8c9('0x73')],'server/files/chat/iframe.ejs'),_0xa8c9('0x107'));var _0x46e7c2=new url['URL'](_0x5d6efd[_0xa8c9('0x108')])['origin'];var _0x5d90de=_0xa8c9('0x109');var _0x3d369=![];var _0x138312={'chatVersion':_0x5d90de,'chatWebsiteAddressOrigin':_0x46e7c2,'remote':_0x5d6efd[_0xa8c9('0x10a')],'query':querystring['stringify'](_['merge'](_0x5d6efd[_0xa8c9('0x2d')]({'plain':!![]}),{'customerIp':_0x5a8d58[_0xa8c9('0x7f')][_0xa8c9('0x9c')]||_0x5a8d58['headers'][_0xa8c9('0x10b')]||_0x5a8d58[_0xa8c9('0x10c')][_0xa8c9('0x10d')]||_0x5a8d58['ip'],'referer':_0x5a8d58['headers'][_0xa8c9('0xa2')],'openedInteractions':_0x5bba2b,'maxInteractions':_0x2c33d7,'virtual':_0x3386c2[_0xa8c9('0x102')],'online':_0x51f426,'custom':_0x3386c2}))[_0xa8c9('0x10e')](/'/g,'\x5c\x27')};_0x35c010[_0xa8c9('0xc1')](ejs[_0xa8c9('0xc9')](Mustache[_0xa8c9('0xc9')](_0x53a6b1,_0x138312),{'proactiveActions':_0x31912b,'alignment':_0x5d6efd[_0xa8c9('0x10f')],'verticalAlignment':_0x5d6efd[_0xa8c9('0x110')],'div_color':_0x5d6efd[_0xa8c9('0xf2')],'labelText':_0x5d6efd[_0xa8c9('0x111')],'text_color':_0x5d6efd[_0xa8c9('0x112')],'text_button_color':_0x5d6efd['textButtonColor'],'button_color':_0x5d6efd[_0xa8c9('0x113')],'background_color':_0x5d6efd[_0xa8c9('0x114')],'hideWhenOffline':_0x5d6efd[_0xa8c9('0x115')],'intervalId':_0x5d6efd[_0xa8c9('0x116')],'isDevelopment':_0x3d369,'chatVersion':_0x5d90de}));})[_0xa8c9('0x22')](handleError(_0x35c010,null));};exports['addApplications']=function(_0x2a6958,_0x533276){var _0x586c45=_0x2a6958[_0xa8c9('0x52')]['id'];var _0x111c84=_0x2a6958[_0xa8c9('0x4d')];var _0x4292c2=0xc8;var _0x3266b0=null;return db[_0xa8c9('0xd3')][_0xa8c9('0xd4')]({'isolationLevel':db[_0xa8c9('0xd3')][_0xa8c9('0x117')][_0xa8c9('0x118')][_0xa8c9('0x119')]},function(_0x5dc58c){return db[_0xa8c9('0x37')][_0xa8c9('0x56')]({'where':{'id':_0x586c45},'transaction':_0x5dc58c})[_0xa8c9('0x18')](function(_0x1d7721){if(_0x1d7721){return db['ChatApplication'][_0xa8c9('0x2c')]({'where':{'ChatWebsiteId':_0x586c45},'transaction':_0x5dc58c})['then'](function(){var _0x5353ff=_['map'](_0x111c84,function(_0x36d630){_0x36d630[_0xa8c9('0x54')]=_0x586c45;return _0x36d630;});return db['ChatApplication']['bulkCreate'](_0x5353ff,{'transaction':_0x5dc58c});});}else{_0x4292c2=0x194;_0x3266b0=[];}});})[_0xa8c9('0x18')](function(){if(_0x4292c2!==0x194){return db[_0xa8c9('0x91')][_0xa8c9('0x11a')]({'where':{'ChatWebsiteId':_0x586c45},'order':_0xa8c9('0x97')})[_0xa8c9('0x18')](function(_0x5451c3){_0x3266b0=_0x5451c3;});}})[_0xa8c9('0x22')](function(_0x3a2ea3){_0x4292c2=0x1f4;logger['error'](_0x3a2ea3[_0xa8c9('0x31')]);if(_0x3a2ea3[_0xa8c9('0x32')]){delete _0x3a2ea3[_0xa8c9('0x32')];}_0x3266b0=_0x3a2ea3;})[_0xa8c9('0x11b')](function(){if(_0x3266b0===null){_0x533276[_0xa8c9('0x30')](_0x4292c2);}else{if(_0x4292c2===0x1f4){_0x533276[_0xa8c9('0x23')](_0x4292c2)[_0xa8c9('0xc1')](_0x3266b0);}else{_0x533276[_0xa8c9('0x23')](_0x4292c2)['json'](_0x3266b0);}}});};exports[_0xa8c9('0x11c')]=function(_0x344bbc,_0x39c8f5){var _0x374995={};var _0x50f1e2={};var _0x124669;var _0x5087f8;return db[_0xa8c9('0x37')][_0xa8c9('0x56')]({'where':{'id':_0x344bbc['params']['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x39c8f5,null))['then'](function(_0x435ff8){if(_0x435ff8){_0x124669=_0x435ff8;_0x50f1e2[_0xa8c9('0x3b')]=_[_0xa8c9('0x3d')](db['ChatApplication'][_0xa8c9('0x38')]);_0x50f1e2['query']=_[_0xa8c9('0x3d')](_0x344bbc[_0xa8c9('0x3c')]);_0x50f1e2[_0xa8c9('0x44')]=_[_0xa8c9('0x3e')](_0x50f1e2[_0xa8c9('0x3b')],_0x50f1e2[_0xa8c9('0x3c')]);_0x374995['attributes']=_[_0xa8c9('0x3e')](_0x50f1e2[_0xa8c9('0x3b')],qs['fields'](_0x344bbc['query']['fields']));_0x374995['attributes']=_0x374995[_0xa8c9('0x3f')][_0xa8c9('0x41')]?_0x374995[_0xa8c9('0x3f')]:_0x50f1e2['model'];_0x374995[_0xa8c9('0x60')]=qs['sort'](_0x344bbc[_0xa8c9('0x3c')]['sort']);_0x374995['where']=qs[_0xa8c9('0x44')](_['pick'](_0x344bbc[_0xa8c9('0x3c')],_0x50f1e2['filters']));if(_0x344bbc[_0xa8c9('0x3c')]['filter']){_0x374995[_0xa8c9('0x58')]=_[_0xa8c9('0x47')](_0x374995[_0xa8c9('0x58')],{'$or':_[_0xa8c9('0x36')](_0x374995[_0xa8c9('0x3f')],function(_0x298274){var _0x1a8532={};_0x1a8532[_0x298274]={'$like':'%'+_0x344bbc[_0xa8c9('0x3c')][_0xa8c9('0x46')]+'%'};return _0x1a8532;})});}_0x374995=_[_0xa8c9('0x47')]({},_0x374995,_0x344bbc[_0xa8c9('0x4a')]);return _0x124669[_0xa8c9('0x11c')](_0x374995);}})['then'](function(_0x147438){if(_0x147438){_0x5087f8=_0x147438[_0xa8c9('0x41')];if(!_0x344bbc[_0xa8c9('0x3c')][_0xa8c9('0x57')](_0xa8c9('0x42'))){_0x374995[_0xa8c9('0x29')]=qs[_0xa8c9('0x29')](_0x344bbc[_0xa8c9('0x3c')][_0xa8c9('0x29')]);_0x374995[_0xa8c9('0x28')]=qs[_0xa8c9('0x28')](_0x344bbc['query'][_0xa8c9('0x28')]);}return _0x124669[_0xa8c9('0x11c')](_0x374995);}})[_0xa8c9('0x18')](function(_0x4ee2b0){if(_0x4ee2b0){return _0x4ee2b0?{'count':_0x5087f8,'rows':_0x4ee2b0}:null;}})[_0xa8c9('0x18')](respondWithResult(_0x39c8f5,null))[_0xa8c9('0x22')](handleError(_0x39c8f5,null));};exports['addProactiveActions']=function(_0x1c4c34,_0x3bbd5){return db['chatProactiveAction'][_0xa8c9('0x4b')]({'where':{'id':_0x1c4c34['params']['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x3bbd5,null))['then'](function(_0x44e355){if(_0x44e355){return _0x44e355[_0xa8c9('0x11d')](_0x1c4c34[_0xa8c9('0x4d')][_0xa8c9('0x5c')],_[_0xa8c9('0xea')](_0x1c4c34[_0xa8c9('0x4d')],[_0xa8c9('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x3bbd5,null))[_0xa8c9('0x22')](handleError(_0x3bbd5,null));};exports[_0xa8c9('0x11e')]=function(_0xd04104,_0x38ba28){var _0x3f5ef7={};var _0x5537f7={};var _0x3d7c16;var _0x3802c9;return db[_0xa8c9('0x37')]['findOne']({'where':{'id':_0xd04104[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x38ba28,null))[_0xa8c9('0x18')](function(_0x2c528e){if(_0x2c528e){_0x3d7c16=_0x2c528e;_0x5537f7[_0xa8c9('0x3b')]=_[_0xa8c9('0x3d')](db[_0xa8c9('0x11f')][_0xa8c9('0x38')]);_0x5537f7[_0xa8c9('0x3c')]=_['keys'](_0xd04104[_0xa8c9('0x3c')]);_0x5537f7['filters']=_[_0xa8c9('0x3e')](_0x5537f7[_0xa8c9('0x3b')],_0x5537f7[_0xa8c9('0x3c')]);_0x3f5ef7[_0xa8c9('0x3f')]=_['intersection'](_0x5537f7[_0xa8c9('0x3b')],qs[_0xa8c9('0x40')](_0xd04104[_0xa8c9('0x3c')][_0xa8c9('0x40')]));_0x3f5ef7[_0xa8c9('0x3f')]=_0x3f5ef7['attributes'][_0xa8c9('0x41')]?_0x3f5ef7['attributes']:_0x5537f7[_0xa8c9('0x3b')];_0x3f5ef7[_0xa8c9('0x60')]=qs[_0xa8c9('0x43')](_0xd04104[_0xa8c9('0x3c')][_0xa8c9('0x43')]);_0x3f5ef7[_0xa8c9('0x58')]=qs[_0xa8c9('0x44')](_[_0xa8c9('0x45')](_0xd04104[_0xa8c9('0x3c')],_0x5537f7['filters']));if(_0xd04104[_0xa8c9('0x3c')]['filter']){_0x3f5ef7[_0xa8c9('0x58')]=_[_0xa8c9('0x47')](_0x3f5ef7[_0xa8c9('0x58')],{'$or':_[_0xa8c9('0x36')](_0x3f5ef7[_0xa8c9('0x3f')],function(_0x3f2782){var _0x2fffc2={};_0x2fffc2[_0x3f2782]={'$like':'%'+_0xd04104['query']['filter']+'%'};return _0x2fffc2;})});}_0x3f5ef7=_[_0xa8c9('0x47')]({},_0x3f5ef7,_0xd04104[_0xa8c9('0x4a')]);return _0x3d7c16[_0xa8c9('0x11e')](_0x3f5ef7);}})[_0xa8c9('0x18')](function(_0x1a8786){if(_0x1a8786){_0x3802c9=_0x1a8786[_0xa8c9('0x41')];if(!_0xd04104[_0xa8c9('0x3c')]['hasOwnProperty'](_0xa8c9('0x42'))){_0x3f5ef7[_0xa8c9('0x29')]=qs[_0xa8c9('0x29')](_0xd04104[_0xa8c9('0x3c')]['limit']);_0x3f5ef7['offset']=qs[_0xa8c9('0x28')](_0xd04104[_0xa8c9('0x3c')][_0xa8c9('0x28')]);}return _0x3d7c16['getProactiveActions'](_0x3f5ef7);}})[_0xa8c9('0x18')](function(_0x4fd2a5){if(_0x4fd2a5){return _0x4fd2a5?{'count':_0x3802c9,'rows':_0x4fd2a5}:null;}})['then'](respondWithResult(_0x38ba28,null))['catch'](handleError(_0x38ba28,null));};exports['getFields']=function(_0x9e22a9,_0x128a4f){var _0x4312c8=_0x9e22a9['query'][_0xa8c9('0x120')]===_0xa8c9('0x121')?'offlineForm':_0xa8c9('0x122');return db[_0xa8c9('0x37')][_0xa8c9('0x4b')]({'attributes':['id',_0x4312c8],'where':{'id':_0x9e22a9[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x128a4f,null))[_0xa8c9('0x18')](function(_0xbd03e){if(_0xbd03e){var _0x30a1d0=_0xbd03e[_0x4312c8];var _0x37c188=_0x30a1d0&&_0x30a1d0['items']?_0x30a1d0[_0xa8c9('0x123')]:[];_0x128a4f[_0xa8c9('0xc1')]({'fromKey':_[_0xa8c9('0x7a')](_0x30a1d0['fromKey'])?undefined:_0x30a1d0[_0xa8c9('0x124')],'count':_0x37c188[_0xa8c9('0x41')],'rows':_0x37c188});}})[_0xa8c9('0x22')](handleError(_0x128a4f,null));};exports[_0xa8c9('0x125')]=function(_0x4e794c,_0x5bfa2f){var _0x4288a2={'raw':![],'where':{}};var _0x34a8b7={};var _0x3a16d4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa8c9('0x56')]({'where':{'id':_0x4e794c[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x5bfa2f,null))[_0xa8c9('0x18')](function(_0x3621df){if(_0x3621df){_0x34a8b7[_0xa8c9('0x3b')]=_[_0xa8c9('0x3d')](db['ChatOfflineMessage']['rawAttributes']);_0x34a8b7[_0xa8c9('0x3c')]=_['keys'](_0x4e794c[_0xa8c9('0x3c')]);_0x34a8b7['filters']=_['intersection'](_0x34a8b7[_0xa8c9('0x3b')],_0x34a8b7['query']);_0x4288a2[_0xa8c9('0x3f')]=_[_0xa8c9('0x3e')](_0x34a8b7[_0xa8c9('0x3b')],qs['fields'](_0x4e794c[_0xa8c9('0x3c')]['fields']));_0x4288a2[_0xa8c9('0x3f')]=_0x4288a2[_0xa8c9('0x3f')][_0xa8c9('0x41')]?_0x4288a2['attributes']:_0x34a8b7[_0xa8c9('0x3b')];if(!_0x4e794c[_0xa8c9('0x3c')]['hasOwnProperty'](_0xa8c9('0x42'))){_0x4288a2[_0xa8c9('0x29')]=qs[_0xa8c9('0x29')](_0x4e794c[_0xa8c9('0x3c')][_0xa8c9('0x29')]);_0x4288a2['offset']=qs[_0xa8c9('0x28')](_0x4e794c[_0xa8c9('0x3c')][_0xa8c9('0x28')]);}_0x4288a2[_0xa8c9('0x60')]=qs[_0xa8c9('0x43')](_0x4e794c[_0xa8c9('0x3c')][_0xa8c9('0x43')]);_0x4288a2['where']=qs[_0xa8c9('0x44')](_[_0xa8c9('0x45')](_0x4e794c[_0xa8c9('0x3c')],_0x34a8b7[_0xa8c9('0x44')]));_0x4288a2['where'][_0xa8c9('0x54')]=_0x3621df['id'];if(_0x4e794c[_0xa8c9('0x3c')][_0xa8c9('0x46')]){_0x4288a2[_0xa8c9('0x58')]=_['merge'](_0x4288a2[_0xa8c9('0x58')],{'$or':_[_0xa8c9('0x36')](_0x4288a2[_0xa8c9('0x3f')],function(_0x3b46da){var _0x3ede78={};_0x3ede78[_0x3b46da]={'$like':'%'+_0x4e794c['query'][_0xa8c9('0x46')]+'%'};return _0x3ede78;})});}_0x4288a2=_['merge']({},_0x4288a2,_0x4e794c[_0xa8c9('0x4a')]);return db[_0xa8c9('0xcc')][_0xa8c9('0x27')]({'where':_0x4288a2[_0xa8c9('0x58')]})[_0xa8c9('0x18')](function(_0x5e476f){_0x3a16d4[_0xa8c9('0x27')]=_0x5e476f;if(_0x4e794c['query'][_0xa8c9('0x59')]){_0x4288a2['include']=[{'all':!![]}];}else{_0x4288a2[_0xa8c9('0x48')]=[{'model':db[_0xa8c9('0x82')],'as':'Contact','required':![]},{'model':db[_0xa8c9('0xd5')],'as':'Attachments','required':![]}];}return db[_0xa8c9('0xcc')][_0xa8c9('0x61')](_0x4288a2);})[_0xa8c9('0x18')](function(_0x1ff9c2){_0x3a16d4[_0xa8c9('0x5a')]=_0x1ff9c2;return _0x3a16d4;});}})[_0xa8c9('0x18')](respondWithFilteredResult(_0x5bfa2f,_0x4288a2))[_0xa8c9('0x22')](handleError(_0x5bfa2f,null));};exports[_0xa8c9('0x126')]=function(_0x454607,_0x2c8a2b){return db[_0xa8c9('0x37')][_0xa8c9('0x4b')]({'where':{'id':_0x454607[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x2c8a2b,null))[_0xa8c9('0x18')](function(_0x98bb00){if(_0x98bb00){return _0x98bb00[_0xa8c9('0x126')](_0x454607[_0xa8c9('0x4d')]['ids'],_[_0xa8c9('0xea')](_0x454607[_0xa8c9('0x4d')],[_0xa8c9('0x5c'),'id'])||{})[_0xa8c9('0xae')](function(_0x314677){for(var _0x257d72=0x0;_0x257d72<_0x454607[_0xa8c9('0x4d')][_0xa8c9('0x5c')][_0xa8c9('0x41')];_0x257d72+=0x1){socket['emit'](_0xa8c9('0x127'),{'UserId':Number(_0x454607[_0xa8c9('0x4d')][_0xa8c9('0x5c')][_0x257d72]),'ChatWebsiteId':Number(_0x454607[_0xa8c9('0x52')]['id'])});}return _0x314677;});}})[_0xa8c9('0x18')](respondWithResult(_0x2c8a2b,null))['catch'](handleError(_0x2c8a2b,null));};exports[_0xa8c9('0x128')]=function(_0x3c0557,_0x56d4af){return db['ChatWebsite']['find']({'where':{'id':_0x3c0557[_0xa8c9('0x52')]['id']}})['then'](handleEntityNotFound(_0x56d4af,null))[_0xa8c9('0x18')](function(_0xe30668){if(_0xe30668){return _0xe30668[_0xa8c9('0x128')](_0x3c0557['query'][_0xa8c9('0x5c')])[_0xa8c9('0x18')](function(){if(_[_0xa8c9('0x129')](_0x3c0557['query'][_0xa8c9('0x5c')])){for(var _0x2cdf30=0x0;_0x2cdf30<_0x3c0557['query'][_0xa8c9('0x5c')][_0xa8c9('0x41')];_0x2cdf30+=0x1){socket[_0xa8c9('0x12a')](_0xa8c9('0x12b'),{'UserId':Number(_0x3c0557[_0xa8c9('0x3c')][_0xa8c9('0x5c')][_0x2cdf30]),'ChatWebsiteId':Number(_0x3c0557[_0xa8c9('0x52')]['id'])});}}else{socket[_0xa8c9('0x12a')](_0xa8c9('0x12b'),{'UserId':Number(_0x3c0557[_0xa8c9('0x3c')]['ids']),'ChatWebsiteId':Number(_0x3c0557[_0xa8c9('0x52')]['id'])});}});}})[_0xa8c9('0x18')](respondWithStatusCode(_0x56d4af,null))[_0xa8c9('0x22')](handleError(_0x56d4af,null));};exports[_0xa8c9('0x12c')]=function(_0x1f919e,_0x255ef2){var _0x171026={};var _0x481d84={};var _0x1aae71;var _0x4b0633;return db['ChatWebsite'][_0xa8c9('0x56')]({'where':{'id':_0x1f919e[_0xa8c9('0x52')]['id']}})[_0xa8c9('0x18')](handleEntityNotFound(_0x255ef2,null))[_0xa8c9('0x18')](function(_0x31547f){if(_0x31547f){_0x1aae71=_0x31547f;_0x481d84['model']=_[_0xa8c9('0x3d')](db[_0xa8c9('0xb7')]['rawAttributes']);_0x481d84[_0xa8c9('0x3c')]=_[_0xa8c9('0x3d')](_0x1f919e[_0xa8c9('0x3c')]);_0x481d84[_0xa8c9('0x44')]=_['intersection'](_0x481d84['model'],_0x481d84[_0xa8c9('0x3c')]);_0x171026[_0xa8c9('0x3f')]=_[_0xa8c9('0x3e')](_0x481d84['model'],qs[_0xa8c9('0x40')](_0x1f919e[_0xa8c9('0x3c')][_0xa8c9('0x40')]));_0x171026['attributes']=_0x171026[_0xa8c9('0x3f')][_0xa8c9('0x41')]?_0x171026['attributes']:_0x481d84[_0xa8c9('0x3b')];_0x171026['order']=qs[_0xa8c9('0x43')](_0x1f919e[_0xa8c9('0x3c')][_0xa8c9('0x43')]);_0x171026[_0xa8c9('0x58')]=qs[_0xa8c9('0x44')](_[_0xa8c9('0x45')](_0x1f919e[_0xa8c9('0x3c')],_0x481d84[_0xa8c9('0x44')]));if(_0x1f919e[_0xa8c9('0x3c')][_0xa8c9('0x46')]){_0x171026['where']=_['merge'](_0x171026[_0xa8c9('0x58')],{'$or':_['map'](_0x171026['attributes'],function(_0x4d22b4){var _0x167194={};_0x167194[_0x4d22b4]={'$like':'%'+_0x1f919e[_0xa8c9('0x3c')][_0xa8c9('0x46')]+'%'};return _0x167194;})});}_0x171026=_[_0xa8c9('0x47')]({},_0x171026,_0x1f919e[_0xa8c9('0x4a')]);return _0x1aae71[_0xa8c9('0x12c')](_0x171026);}})['then'](function(_0x45ceb3){if(_0x45ceb3){_0x4b0633=_0x45ceb3['length'];if(!_0x1f919e[_0xa8c9('0x3c')]['hasOwnProperty'](_0xa8c9('0x42'))){_0x171026[_0xa8c9('0x29')]=qs['limit'](_0x1f919e[_0xa8c9('0x3c')]['limit']);_0x171026['offset']=qs[_0xa8c9('0x28')](_0x1f919e['query'][_0xa8c9('0x28')]);}return _0x1aae71[_0xa8c9('0x12c')](_0x171026);}})[_0xa8c9('0x18')](function(_0x98e23){if(_0x98e23){return _0x98e23?{'count':_0x4b0633,'rows':_0x98e23}:null;}})[_0xa8c9('0x18')](respondWithResult(_0x255ef2,null))[_0xa8c9('0x22')](handleError(_0x255ef2,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 09e1234..f2cd767 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 _0x47c7=['emit','hasOwnProperty','exports','events','ChatWebsite','setMaxListeners','update','remove'];(function(_0x1366e3,_0x226913){var _0x1e1420=function(_0x10eeba){while(--_0x10eeba){_0x1366e3['push'](_0x1366e3['shift']());}};_0x1e1420(++_0x226913);}(_0x47c7,0x1ab));var _0x747c=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x47c7[_0xfbdff6];return _0x4cb9be;};'use strict';var EventEmitter=require(_0x747c('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x747c('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x747c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x747c('0x3'),'afterDestroy':_0x747c('0x4')};function emitEvent(_0x51f4bc){return function(_0x3313cd,_0x3c0c0,_0x4661c3){ChatWebsiteEvents[_0x747c('0x5')](_0x51f4bc+':'+_0x3313cd['id'],_0x3313cd);ChatWebsiteEvents['emit'](_0x51f4bc,_0x3313cd);_0x4661c3(null);};}for(var e in events){if(events[_0x747c('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x747c('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x25b0=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x430d0d,_0x8bd739){var _0x1fae57=function(_0x4ef890){while(--_0x4ef890){_0x430d0d['push'](_0x430d0d['shift']());}};_0x1fae57(++_0x8bd739);}(_0x25b0,0x140));var _0x025b=function(_0x158ab3,_0x4b5908){_0x158ab3=_0x158ab3-0x0;var _0x302830=_0x25b0[_0x158ab3];return _0x302830;};'use strict';var EventEmitter=require(_0x025b('0x0'));var ChatWebsite=require(_0x025b('0x1'))['db'][_0x025b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x025b('0x3')](0x0);var events={'afterCreate':_0x025b('0x4'),'afterUpdate':_0x025b('0x5'),'afterDestroy':_0x025b('0x6')};function emitEvent(_0x1c2c48){return function(_0x86752b,_0x286601,_0x516a8d){ChatWebsiteEvents[_0x025b('0x7')](_0x1c2c48+':'+_0x86752b['id'],_0x86752b);ChatWebsiteEvents[_0x025b('0x7')](_0x1c2c48,_0x86752b);_0x516a8d(null);};}for(var e in events){if(events[_0x025b('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x025b('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index df51314..4283e13 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 _0x880a=['ChatWebsite','chat_websites','util','../../config/logger','bluebird','path','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x3af3ad,_0x2aff88){var _0x29a413=function(_0x30a9a5){while(--_0x30a9a5){_0x3af3ad['push'](_0x3af3ad['shift']());}};_0x29a413(++_0x2aff88);}(_0x880a,0x84));var _0xa880=function(_0x12690b,_0x1dfb58){_0x12690b=_0x12690b-0x0;var _0x228b3b=_0x880a[_0x12690b];return _0x228b3b;};'use strict';var _=require('lodash');var util=require(_0xa880('0x0'));var logger=require(_0xa880('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa880('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa880('0x3'));var rimraf=require('rimraf');var config=require(_0xa880('0x4'));var attributes=require(_0xa880('0x5'));module[_0xa880('0x6')]=function(_0x5f11d9,_0x3870b5){return _0x5f11d9[_0xa880('0x7')](_0xa880('0x8'),attributes,{'tableName':_0xa880('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80a5=['chat_websites','lodash','util','api','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x4b891e,_0x1a29cf){var _0x375694=function(_0x45d2a7){while(--_0x45d2a7){_0x4b891e['push'](_0x4b891e['shift']());}};_0x375694(++_0x1a29cf);}(_0x80a5,0x9b));var _0x580a=function(_0x2ccc97,_0x163aa9){_0x2ccc97=_0x2ccc97-0x0;var _0x1b4007=_0x80a5[_0x2ccc97];return _0x1b4007;};'use strict';var _=require(_0x580a('0x0'));var util=require(_0x580a('0x1'));var logger=require('../../config/logger')(_0x580a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x580a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x580a('0x4'));var config=require(_0x580a('0x5'));var attributes=require(_0x580a('0x6'));module[_0x580a('0x7')]=function(_0x363275,_0x5b775b){return _0x363275[_0x580a('0x8')](_0x580a('0x9'),attributes,{'tableName':_0x580a('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 268d062..b5facef 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 _0x0dd0=['request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x375c32,_0x1589be){var _0x922369=function(_0x4fe03e){while(--_0x4fe03e){_0x375c32['push'](_0x375c32['shift']());}};_0x922369(++_0x1589be);}(_0x0dd0,0x12f));var _0x00dd=function(_0x279095,_0x15f37e){_0x279095=_0x279095-0x0;var _0x5a5cdb=_0x0dd0[_0x279095];return _0x5a5cdb;};'use strict';var _=require(_0x00dd('0x0'));var util=require(_0x00dd('0x1'));var moment=require(_0x00dd('0x2'));var BPromise=require(_0x00dd('0x3'));var rs=require(_0x00dd('0x4'));var fs=require('fs');var Redis=require(_0x00dd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x00dd('0x6'));var logger=require(_0x00dd('0x7'))('rpc');var config=require(_0x00dd('0x8'));var jayson=require(_0x00dd('0x9'));var client=jayson[_0x00dd('0xa')][_0x00dd('0xb')]({'port':0x232a});config[_0x00dd('0xc')]=_[_0x00dd('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x00dd('0xe'))(new Redis(config[_0x00dd('0xc')]));require(_0x00dd('0xf'))[_0x00dd('0x10')](socket);function respondWithRpcPromise(_0x77335e,_0x3e5072,_0x30ee0f){return new BPromise(function(_0x1857fb,_0x3a249f){return client[_0x00dd('0x11')](_0x77335e,_0x30ee0f)[_0x00dd('0x12')](function(_0x1fa1c1){logger[_0x00dd('0x13')](_0x00dd('0x14'),_0x3e5072,_0x00dd('0x15'));logger['debug'](_0x00dd('0x16'),_0x3e5072,_0x00dd('0x15'),JSON[_0x00dd('0x17')](_0x1fa1c1));if(_0x1fa1c1[_0x00dd('0x18')]){if(_0x1fa1c1[_0x00dd('0x18')][_0x00dd('0x19')]===0x1f4){logger[_0x00dd('0x18')](_0x00dd('0x14'),_0x3e5072,_0x1fa1c1[_0x00dd('0x18')][_0x00dd('0x1a')]);return _0x3a249f(_0x1fa1c1[_0x00dd('0x18')]['message']);}logger[_0x00dd('0x18')](_0x00dd('0x14'),_0x3e5072,_0x1fa1c1[_0x00dd('0x18')]['message']);return _0x1857fb(_0x1fa1c1['error'][_0x00dd('0x1a')]);}else{logger[_0x00dd('0x13')](_0x00dd('0x14'),_0x3e5072,_0x00dd('0x15'));_0x1857fb(_0x1fa1c1['result'][_0x00dd('0x1a')]);}})['catch'](function(_0x10eceb){logger[_0x00dd('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x3e5072,_0x10eceb);_0x3a249f(_0x10eceb);});});} \ No newline at end of file +var _0x0e99=['register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatWebsite.socket'];(function(_0x51e740,_0x112a65){var _0x56d4bb=function(_0x464282){while(--_0x464282){_0x51e740['push'](_0x51e740['shift']());}};_0x56d4bb(++_0x112a65);}(_0x0e99,0x137));var _0x90e9=function(_0x11ce46,_0x7a1715){_0x11ce46=_0x11ce46-0x0;var _0x272001=_0x0e99[_0x11ce46];return _0x272001;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x90e9('0x0'));var rs=require(_0x90e9('0x1'));var fs=require('fs');var Redis=require(_0x90e9('0x2'));var db=require(_0x90e9('0x3'))['db'];var utils=require(_0x90e9('0x4'));var logger=require(_0x90e9('0x5'))(_0x90e9('0x6'));var config=require(_0x90e9('0x7'));var jayson=require(_0x90e9('0x8'));var client=jayson[_0x90e9('0x9')]['http']({'port':0x232a});config[_0x90e9('0xa')]=_['defaults'](config[_0x90e9('0xa')],{'host':_0x90e9('0xb'),'port':0x18eb});var socket=require(_0x90e9('0xc'))(new Redis(config[_0x90e9('0xa')]));require(_0x90e9('0xd'))[_0x90e9('0xe')](socket);function respondWithRpcPromise(_0x25271a,_0x5c63e7,_0x5d656f){return new BPromise(function(_0x814eba,_0xb688fb){return client[_0x90e9('0xf')](_0x25271a,_0x5d656f)[_0x90e9('0x10')](function(_0x3be270){logger['info'](_0x90e9('0x11'),_0x5c63e7,_0x90e9('0x12'));logger[_0x90e9('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5c63e7,'request\x20sent',JSON[_0x90e9('0x14')](_0x3be270));if(_0x3be270[_0x90e9('0x15')]){if(_0x3be270[_0x90e9('0x15')][_0x90e9('0x16')]===0x1f4){logger[_0x90e9('0x15')](_0x90e9('0x11'),_0x5c63e7,_0x3be270[_0x90e9('0x15')][_0x90e9('0x17')]);return _0xb688fb(_0x3be270[_0x90e9('0x15')][_0x90e9('0x17')]);}logger['error'](_0x90e9('0x11'),_0x5c63e7,_0x3be270['error'][_0x90e9('0x17')]);return _0x814eba(_0x3be270[_0x90e9('0x15')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5c63e7,_0x90e9('0x12'));_0x814eba(_0x3be270['result'][_0x90e9('0x17')]);}})[_0x90e9('0x18')](function(_0x25da77){logger[_0x90e9('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x5c63e7,_0x25da77);_0xb688fb(_0x25da77);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d56c8b7..76f0d22 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 _0x729f=['remove','update','removeListener','length','chatWebsite:','save'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x729f,0xf5));var _0xf729=function(_0x478027,_0xade4bc){_0x478027=_0x478027-0x0;var _0x1cfcf7=_0x729f[_0x478027];return _0x1cfcf7;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xf729('0x0'),_0xf729('0x1'),_0xf729('0x2')];function createListener(_0x22987d,_0xa96121){return function(_0xfdf13b){_0xa96121['emit'](_0x22987d,_0xfdf13b);};}function removeListener(_0x4e9d93,_0x1e563b){return function(){ChatWebsiteEvents[_0xf729('0x3')](_0x4e9d93,_0x1e563b);};}exports['register']=function(_0x1248eb){for(var _0x131a6b=0x0,_0x3727f1=events[_0xf729('0x4')];_0x131a6b<_0x3727f1;_0x131a6b++){var _0x29137f=events[_0x131a6b];var _0x34e062=createListener(_0xf729('0x5')+_0x29137f,_0x1248eb);ChatWebsiteEvents['on'](_0x29137f,_0x34e062);}}; \ No newline at end of file +var _0xd2fc=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','update'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xd2fc,0x1d2));var _0xcd2f=function(_0x46f3fe,_0x33bf84){_0x46f3fe=_0x46f3fe-0x0;var _0x29b1bc=_0xd2fc[_0x46f3fe];return _0x29b1bc;};'use strict';var ChatWebsiteEvents=require(_0xcd2f('0x0'));var events=[_0xcd2f('0x1'),'remove',_0xcd2f('0x2')];function createListener(_0x18fd1b,_0x144c1d){return function(_0x4c49a2){_0x144c1d['emit'](_0x18fd1b,_0x4c49a2);};}function removeListener(_0x404945,_0x3a756b){return function(){ChatWebsiteEvents[_0xcd2f('0x3')](_0x404945,_0x3a756b);};}exports[_0xcd2f('0x4')]=function(_0x95ac78){for(var _0xabf0a7=0x0,_0x105ddc=events[_0xcd2f('0x5')];_0xabf0a7<_0x105ddc;_0xabf0a7++){var _0x2aa892=events[_0xabf0a7];var _0x249bdd=createListener(_0xcd2f('0x6')+_0x2aa892,_0x95ac78);ChatWebsiteEvents['on'](_0x2aa892,_0x249bdd);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index d6b73c9..ad6a3fd 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 _0x0bd9=['util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','originalname','single','file','server/files/images/avatars/','now','addAvatar','join','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','replace','extname','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','/:id','destroy','delete','removeDispositions','removeAnswers','removeAgents'];(function(_0x304a62,_0xabfa3d){var _0x3a88fd=function(_0x17c256){while(--_0x17c256){_0x304a62['push'](_0x304a62['shift']());}};_0x3a88fd(++_0xabfa3d);}(_0x0bd9,0xcc));var _0x90bd=function(_0x5b952e,_0x26158d){_0x5b952e=_0x5b952e-0x0;var _0x34d8f1=_0x0bd9[_0x5b952e];return _0x34d8f1;};'use strict';var multer=require('multer');var util=require(_0x90bd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x90bd('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90bd('0x2'));var interaction=require(_0x90bd('0x3'));var config=require(_0x90bd('0x4'));var controller=require('./chatWebsite.controller');router[_0x90bd('0x5')]('/',auth[_0x90bd('0x6')](),controller[_0x90bd('0x7')]);router[_0x90bd('0x5')](_0x90bd('0x8'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x9')]);router[_0x90bd('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x90bd('0xa')]);router[_0x90bd('0x5')](_0x90bd('0xb'),auth[_0x90bd('0x6')](),controller[_0x90bd('0xc')]);router[_0x90bd('0x5')](_0x90bd('0xd'),auth[_0x90bd('0x6')](),controller[_0x90bd('0xe')]);router[_0x90bd('0x5')](_0x90bd('0xf'),controller[_0x90bd('0x10')]);router[_0x90bd('0x5')](_0x90bd('0x11'),controller[_0x90bd('0x12')]);router[_0x90bd('0x5')](_0x90bd('0x13'),controller[_0x90bd('0x14')]);router[_0x90bd('0x5')](_0x90bd('0x15'),controller[_0x90bd('0x16')]);router[_0x90bd('0x5')](_0x90bd('0x17'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x18')]);router['get'](_0x90bd('0x19'),controller[_0x90bd('0x1a')]);router[_0x90bd('0x5')](_0x90bd('0x1b'),auth['isAuthenticated'](),controller['getApplications']);router[_0x90bd('0x5')](_0x90bd('0x1c'),auth[_0x90bd('0x6')](),controller['getProactiveActions']);router[_0x90bd('0x5')](_0x90bd('0x1d'),controller['getFields']);router['get'](_0x90bd('0x1e'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x1f')]);router['get']('/:id/users',auth[_0x90bd('0x6')](),controller[_0x90bd('0x20')]);router[_0x90bd('0x21')]('/',auth['isAuthenticated'](),controller[_0x90bd('0x22')]);router[_0x90bd('0x21')](_0x90bd('0xb'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x23')]);router[_0x90bd('0x21')](_0x90bd('0xd'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x24')]);var upload=multer({'storage':multer[_0x90bd('0x25')]({'destination':function(_0x25eaf9,_0x2e4d6d,_0x4cfd63){_0x4cfd63(null,path['join'](config[_0x90bd('0x26')],_0x90bd('0x27')));},'filename':function(_0x4313a7,_0x4f1e44,_0x25b63e){_0x25b63e(null,util[_0x90bd('0x28')]('%s-%s',Date['now'](),_0x4f1e44[_0x90bd('0x29')]));}})});router[_0x90bd('0x21')](_0x90bd('0xf'),upload[_0x90bd('0x2a')](_0x90bd('0x2b')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5299ef,_0x10dae8,_0xb7bd8){_0xb7bd8(null,path['join'](config[_0x90bd('0x26')],_0x90bd('0x2c')));},'filename':function(_0x56b9b9,_0x2000e9,_0x160d50){_0x160d50(null,util[_0x90bd('0x28')]('%s-%s',Date[_0x90bd('0x2d')](),_0x2000e9[_0x90bd('0x29')]));}})});router[_0x90bd('0x21')](_0x90bd('0x11'),upload['single'](_0x90bd('0x2b')),controller[_0x90bd('0x2e')]);var upload=multer({'storage':multer[_0x90bd('0x25')]({'destination':function(_0xa26b8f,_0x580916,_0x5bc93e){_0x5bc93e(null,path[_0x90bd('0x2f')](config[_0x90bd('0x26')],_0x90bd('0x2c')));},'filename':function(_0x5a3523,_0x4f04f6,_0x3eee4b){_0x3eee4b(null,util[_0x90bd('0x28')]('%s-%s',Date['now'](),_0x4f04f6[_0x90bd('0x29')]));}})});router[_0x90bd('0x21')](_0x90bd('0x13'),upload[_0x90bd('0x2a')](_0x90bd('0x2b')),controller[_0x90bd('0x30')]);var upload=multer({'storage':multer[_0x90bd('0x25')]({'destination':function(_0xa2fe54,_0x2eb982,_0xbf4185){_0xbf4185(null,path[_0x90bd('0x2f')](config[_0x90bd('0x26')],'server/files/images/avatars/'));},'filename':function(_0x83088e,_0x20674c,_0x44e57c){_0x44e57c(null,util[_0x90bd('0x28')]('%s-%s',Date['now'](),_0x20674c[_0x90bd('0x29')]));}})});router[_0x90bd('0x21')]('/:id/system_avatar',upload[_0x90bd('0x2a')](_0x90bd('0x2b')),controller[_0x90bd('0x31')]);router[_0x90bd('0x21')]('/:id/notify',controller[_0x90bd('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0x90bd('0x25')]({'destination':function(_0x1f02b6,_0x503b0b,_0x5e7130){const _0x270278=path[_0x90bd('0x2f')](config[_0x90bd('0x26')],_0x90bd('0x33'),_0x90bd('0x34'),'offline-chat');fs_extra['ensureDir'](_0x270278,function(){_0x5e7130(null,_0x270278);});},'filename':function(_0x28dcce,_0x4a1726,_0x143999){const _0x21d8c7=_0x4a1726[_0x90bd('0x29')][_0x90bd('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x525984=path[_0x90bd('0x36')](_0x21d8c7);const _0x2a390a=Date[_0x90bd('0x2d')]()+'-'+_0x21d8c7[_0x90bd('0x35')](_0x525984,'')+_0x525984;_0x143999(null,_0x2a390a);}})});router[_0x90bd('0x21')]('/:id/offline',offlineUploadMulter[_0x90bd('0x37')](),controller[_0x90bd('0x38')]);router['post'](_0x90bd('0x17'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x39')]);router['post'](_0x90bd('0x1b'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x3a')]);router[_0x90bd('0x21')](_0x90bd('0x1c'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x3b')]);router['post'](_0x90bd('0x3c'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x3d')]);router['put'](_0x90bd('0x3e'),auth[_0x90bd('0x6')](),controller['update']);router['delete'](_0x90bd('0x3e'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x3f')]);router[_0x90bd('0x40')](_0x90bd('0xb'),auth['isAuthenticated'](),controller[_0x90bd('0x41')]);router[_0x90bd('0x40')](_0x90bd('0xd'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x42')]);router[_0x90bd('0x40')](_0x90bd('0x3c'),auth[_0x90bd('0x6')](),controller[_0x90bd('0x43')]);module['exports']=router; \ No newline at end of file +var _0x0b51=['/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','originalname','file','addLogo','root','server/files/images/avatars/','now','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet'];(function(_0x386197,_0x29727a){var _0x299e6c=function(_0x462479){while(--_0x462479){_0x386197['push'](_0x386197['shift']());}};_0x299e6c(++_0x29727a);}(_0x0b51,0x1f1));var _0x10b5=function(_0x11c7b8,_0x248cc2){_0x11c7b8=_0x11c7b8-0x0;var _0x54d1d6=_0x0b51[_0x11c7b8];return _0x54d1d6;};'use strict';var multer=require(_0x10b5('0x0'));var util=require(_0x10b5('0x1'));var path=require('path');var timeout=require(_0x10b5('0x2'));var express=require(_0x10b5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x10b5('0x4'));var interaction=require(_0x10b5('0x5'));var config=require(_0x10b5('0x6'));var controller=require(_0x10b5('0x7'));router[_0x10b5('0x8')]('/',auth[_0x10b5('0x9')](),controller[_0x10b5('0xa')]);router[_0x10b5('0x8')](_0x10b5('0xb'),auth[_0x10b5('0x9')](),controller[_0x10b5('0xc')]);router[_0x10b5('0x8')](_0x10b5('0xd'),auth[_0x10b5('0x9')](),controller[_0x10b5('0xe')]);router[_0x10b5('0x8')](_0x10b5('0xf'),auth[_0x10b5('0x9')](),controller[_0x10b5('0x10')]);router['get']('/:id/canned_answers',auth[_0x10b5('0x9')](),controller[_0x10b5('0x11')]);router['get'](_0x10b5('0x12'),controller[_0x10b5('0x13')]);router[_0x10b5('0x8')](_0x10b5('0x14'),controller['getAvatar']);router['get'](_0x10b5('0x15'),controller[_0x10b5('0x16')]);router[_0x10b5('0x8')](_0x10b5('0x17'),controller[_0x10b5('0x18')]);router[_0x10b5('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x10b5('0x19')]);router['get'](_0x10b5('0x1a'),controller[_0x10b5('0x1b')]);router[_0x10b5('0x8')](_0x10b5('0x1c'),auth[_0x10b5('0x9')](),controller['getApplications']);router['get'](_0x10b5('0x1d'),auth['isAuthenticated'](),controller[_0x10b5('0x1e')]);router[_0x10b5('0x8')](_0x10b5('0x1f'),controller[_0x10b5('0x20')]);router['get']('/:id/offline_messages',auth[_0x10b5('0x9')](),controller[_0x10b5('0x21')]);router['get']('/:id/users',auth[_0x10b5('0x9')](),controller[_0x10b5('0x22')]);router['post']('/',auth[_0x10b5('0x9')](),controller[_0x10b5('0x23')]);router[_0x10b5('0x24')](_0x10b5('0xf'),auth['isAuthenticated'](),controller[_0x10b5('0x25')]);router[_0x10b5('0x24')](_0x10b5('0x26'),auth[_0x10b5('0x9')](),controller[_0x10b5('0x27')]);var upload=multer({'storage':multer[_0x10b5('0x28')]({'destination':function(_0x2b3db3,_0x3ce6d0,_0x4eb54a){_0x4eb54a(null,path[_0x10b5('0x29')](config['root'],_0x10b5('0x2a')));},'filename':function(_0x3f4134,_0x26f02f,_0x39eef3){_0x39eef3(null,util[_0x10b5('0x2b')](_0x10b5('0x2c'),Date['now'](),_0x26f02f[_0x10b5('0x2d')]));}})});router['post']('/:id/logo',upload['single'](_0x10b5('0x2e')),controller[_0x10b5('0x2f')]);var upload=multer({'storage':multer[_0x10b5('0x28')]({'destination':function(_0x2110f6,_0x3c1581,_0x3e9e83){_0x3e9e83(null,path['join'](config[_0x10b5('0x30')],_0x10b5('0x31')));},'filename':function(_0x5217bf,_0x43fe7b,_0x321f7a){_0x321f7a(null,util[_0x10b5('0x2b')](_0x10b5('0x2c'),Date[_0x10b5('0x32')](),_0x43fe7b[_0x10b5('0x2d')]));}})});router[_0x10b5('0x24')]('/:id/avatar',upload[_0x10b5('0x33')](_0x10b5('0x2e')),controller[_0x10b5('0x34')]);var upload=multer({'storage':multer[_0x10b5('0x28')]({'destination':function(_0x484824,_0x48ee6c,_0x47d6d7){_0x47d6d7(null,path[_0x10b5('0x29')](config['root'],_0x10b5('0x31')));},'filename':function(_0x342d39,_0xca99f8,_0x80c867){_0x80c867(null,util[_0x10b5('0x2b')]('%s-%s',Date[_0x10b5('0x32')](),_0xca99f8[_0x10b5('0x2d')]));}})});router['post'](_0x10b5('0x15'),upload[_0x10b5('0x33')]('file'),controller[_0x10b5('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1810d1,_0x24ea8e,_0x3e7123){_0x3e7123(null,path[_0x10b5('0x29')](config['root'],_0x10b5('0x31')));},'filename':function(_0x4b661a,_0x541304,_0x3dbc92){_0x3dbc92(null,util[_0x10b5('0x2b')]('%s-%s',Date[_0x10b5('0x32')](),_0x541304[_0x10b5('0x2d')]));}})});router['post'](_0x10b5('0x17'),upload[_0x10b5('0x33')](_0x10b5('0x2e')),controller[_0x10b5('0x36')]);router[_0x10b5('0x24')](_0x10b5('0x37'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x10b5('0x28')]({'destination':function(_0x1dfe90,_0x298d89,_0x5f3f6d){const _0x417c84=path[_0x10b5('0x29')](config[_0x10b5('0x30')],_0x10b5('0x38'),_0x10b5('0x39'),_0x10b5('0x3a'));fs_extra['ensureDir'](_0x417c84,function(){_0x5f3f6d(null,_0x417c84);});},'filename':function(_0x33e65a,_0x1e8ffd,_0x4296b4){const _0x6c6f40=_0x1e8ffd[_0x10b5('0x2d')][_0x10b5('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xbb7596=path['extname'](_0x6c6f40);const _0x35aa7d=Date[_0x10b5('0x32')]()+'-'+_0x6c6f40[_0x10b5('0x3b')](_0xbb7596,'')+_0xbb7596;_0x4296b4(null,_0x35aa7d);}})});router[_0x10b5('0x24')](_0x10b5('0x3c'),offlineUploadMulter[_0x10b5('0x3d')](),controller[_0x10b5('0x3e')]);router[_0x10b5('0x24')](_0x10b5('0x3f'),auth[_0x10b5('0x9')](),controller[_0x10b5('0x40')]);router['post'](_0x10b5('0x1c'),auth[_0x10b5('0x9')](),controller[_0x10b5('0x41')]);router[_0x10b5('0x24')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x10b5('0x42')]);router[_0x10b5('0x24')](_0x10b5('0x43'),auth['isAuthenticated'](),controller[_0x10b5('0x44')]);router['put'](_0x10b5('0xd'),auth[_0x10b5('0x9')](),controller[_0x10b5('0x45')]);router['delete'](_0x10b5('0xd'),auth[_0x10b5('0x9')](),controller[_0x10b5('0x46')]);router[_0x10b5('0x47')](_0x10b5('0xf'),auth[_0x10b5('0x9')](),controller['removeDispositions']);router['delete'](_0x10b5('0x26'),auth['isAuthenticated'](),controller[_0x10b5('0x48')]);router[_0x10b5('0x47')]('/:id/users',auth[_0x10b5('0x9')](),controller[_0x10b5('0x49')]);module[_0x10b5('0x4a')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 57e3414..1af9fa6 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 _0x45f0=['exports','beaver-logger/server','express','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated'];(function(_0x381748,_0x5396f6){var _0x187b6c=function(_0x159aaf){while(--_0x159aaf){_0x381748['push'](_0x381748['shift']());}};_0x187b6c(++_0x5396f6);}(_0x45f0,0x119));var _0x045f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x45f0[_0x3dd15e];return _0x231fd0;};var beaverLogger=require(_0x045f('0x0'));var express=require(_0x045f('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express['Router']();var isProduction=config['env']===_0x045f('0x2')||![];function clientSideLogs(_0x393c29,_0x352184,_0x1b89cf){var _0x42d0df=_0x393c29[_0x045f('0x3')][_0x045f('0x4')](_0x045f('0x5'));if(!_0x42d0df){throw new Error(_0x045f('0x6'));}return beaverLogger[_0x045f('0x7')]({'uri':'/client-logs','logger':_0x42d0df,'enableCors':!isProduction})(_0x393c29,_0x352184,_0x1b89cf);}router['use'](auth[_0x045f('0x8')](),clientSideLogs);module[_0x045f('0x9')]=router; \ No newline at end of file +var _0xea03=['../components/auth/service','../config/environment','Router','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','exports','express'];(function(_0x17eca5,_0x2b44ae){var _0x4657c5=function(_0x566af4){while(--_0x566af4){_0x17eca5['push'](_0x17eca5['shift']());}};_0x4657c5(++_0x2b44ae);}(_0xea03,0x6d));var _0x3ea0=function(_0x270323,_0x72160){_0x270323=_0x270323-0x0;var _0x48a027=_0xea03[_0x270323];return _0x48a027;};var beaverLogger=require('beaver-logger/server');var express=require(_0x3ea0('0x0'));var auth=require(_0x3ea0('0x1'));var config=require(_0x3ea0('0x2'));var router=express[_0x3ea0('0x3')]();var isProduction=config['env']===_0x3ea0('0x4')||![];function clientSideLogs(_0x13eb9d,_0x1ba30c,_0x47f865){var _0xc937f3=_0x13eb9d[_0x3ea0('0x5')]['get'](_0x3ea0('0x6'));if(!_0xc937f3){throw new Error(_0x3ea0('0x7'));}return beaverLogger[_0x3ea0('0x8')]({'uri':_0x3ea0('0x9'),'logger':_0xc937f3,'enableCors':!isProduction})(_0x13eb9d,_0x1ba30c,_0x47f865);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x3ea0('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 0ecc579..b2fe595 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 _0xf039=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf039,0xf6));var _0x9f03=function(_0x52a0bb,_0x4135e4){_0x52a0bb=_0x52a0bb-0x0;var _0x5bc186=_0xf039[_0x52a0bb];return _0x5bc186;};'use strict';var Sequelize=require(_0x9f03('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f03('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9f03('0x2')](_0x9f03('0x3'),_0x9f03('0x4'),_0x9f03('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9f03('0x2')](_0x9f03('0x6'),_0x9f03('0x7'))},'data1':{'type':Sequelize[_0x9f03('0x1')],'comment':_0x9f03('0x8')},'data2':{'type':Sequelize[_0x9f03('0x1')],'comment':_0x9f03('0x9')},'data3':{'type':Sequelize[_0x9f03('0x1')],'comment':_0x9f03('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0x9f03('0xb')},'data5':{'type':Sequelize[_0x9f03('0xc')],'comment':_0x9f03('0xd')},'data6':{'type':Sequelize[_0x9f03('0xc')],'comment':_0x9f03('0xe')},'data7':{'type':Sequelize['TEXT'],'comment':_0x9f03('0xf')}}; \ No newline at end of file +var _0x5695=['MicrosoftAzure\x20=>\x20access_token','sequelize','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x5695,0x69));var _0x5569=function(_0x444e8b,_0x3524cc){_0x444e8b=_0x444e8b-0x0;var _0x35eb37=_0x5695[_0x444e8b];return _0x35eb37;};'use strict';var Sequelize=require(_0x5569('0x0'));module['exports']={'name':{'type':Sequelize[_0x5569('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x5569('0x2'),_0x5569('0x3'),_0x5569('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5569('0x5')](_0x5569('0x6'),_0x5569('0x7'))},'data1':{'type':Sequelize[_0x5569('0x1')],'comment':_0x5569('0x8')},'data2':{'type':Sequelize[_0x5569('0x1')],'comment':_0x5569('0x9')},'data3':{'type':Sequelize[_0x5569('0x1')],'comment':_0x5569('0xa')},'data4':{'type':Sequelize[_0x5569('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x5569('0xb')],'comment':_0x5569('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x5569('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 5e162c1..932d6dd 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 _0xd8a8=['map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','CloudProvider','findAll','service','MicrosoftAzure','decryptString','data3','params','keys','include','find','catch','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','state','parse','from','base64','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data6','refresh_token','data5','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','error','stack','send','padEnd','slice','index'];(function(_0x2369b4,_0x20c248){var _0xc66c64=function(_0x4f1b83){while(--_0x4f1b83){_0x2369b4['push'](_0x2369b4['shift']());}};_0xc66c64(++_0x20c248);}(_0xd8a8,0x1af));var _0x8d8a=function(_0x31fb3e,_0x309a7e){_0x31fb3e=_0x31fb3e-0x0;var _0x281161=_0xd8a8[_0x31fb3e];return _0x281161;};'use strict';var _=require(_0x8d8a('0x0'));var Redis=require(_0x8d8a('0x1'));var qs=require(_0x8d8a('0x2'));var encryptor=require(_0x8d8a('0x3'));var config=require(_0x8d8a('0x4'));var logger=require('../../config/logger')(_0x8d8a('0x5'));var db=require(_0x8d8a('0x6'))['db'];var oauth=require(_0x8d8a('0x7'));config['redis']=_[_0x8d8a('0x8')](config[_0x8d8a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d8a('0xa'))(new Redis(config[_0x8d8a('0x9')]));var redis=new Redis(config[_0x8d8a('0x9')]);function respondWithStatusCode(_0x35e49d,_0x32ef04){_0x32ef04=_0x32ef04||0xcc;return function(_0x5b3b3c){if(_0x5b3b3c){return _0x35e49d[_0x8d8a('0xb')](_0x32ef04);}return _0x35e49d[_0x8d8a('0xc')](_0x32ef04)[_0x8d8a('0xd')]();};}function respondWithResult(_0x18438e,_0x22fbfc){_0x22fbfc=_0x22fbfc||0xc8;return function(_0x54743c){if(_0x54743c){return _0x18438e['status'](_0x22fbfc)[_0x8d8a('0xe')](_0x54743c);}};}function respondWithFilteredResult(_0x2be8d3,_0x1c7275){return function(_0x4e9730){if(_0x4e9730){var _0x32dce2=typeof _0x1c7275[_0x8d8a('0xf')]===_0x8d8a('0x10')&&typeof _0x1c7275['limit']===_0x8d8a('0x10');var _0x388e60=_0x4e9730[_0x8d8a('0x11')];var _0x737ab5=_0x32dce2?0x0:_0x1c7275[_0x8d8a('0xf')];var _0x59475b=_0x32dce2?_0x4e9730[_0x8d8a('0x11')]:_0x1c7275[_0x8d8a('0xf')]+_0x1c7275[_0x8d8a('0x12')];var _0x496cc5;if(_0x59475b>=_0x388e60){_0x59475b=_0x388e60;_0x496cc5=0xc8;}else{_0x496cc5=0xce;}_0x2be8d3[_0x8d8a('0xc')](_0x496cc5);return _0x2be8d3['set'](_0x8d8a('0x13'),_0x737ab5+'-'+_0x59475b+'/'+_0x388e60)['json'](_0x4e9730);}return null;};}function saveUpdates(_0x7a525a){return function(_0x52fda2){if(_0x52fda2){return _0x52fda2[_0x8d8a('0x14')](_0x7a525a)[_0x8d8a('0x15')](function(_0x3ad848){return _0x3ad848;});}return null;};}function removeEntity(_0x1fb5d6){return function(_0x965162){if(_0x965162){return _0x965162[_0x8d8a('0x16')]()[_0x8d8a('0x15')](function(){_0x1fb5d6[_0x8d8a('0xc')](0xcc)[_0x8d8a('0xd')]();});}};}function handleEntityNotFound(_0xc72c09){return function(_0xa62510){if(!_0xa62510){_0xc72c09[_0x8d8a('0xb')](0x194);}return _0xa62510;};}function handleError(_0x2e81b3,_0x5d504f){_0x5d504f=_0x5d504f||0x1f4;return function(_0x38dd74){logger[_0x8d8a('0x17')](_0x38dd74[_0x8d8a('0x18')]);if(_0x38dd74['name']){delete _0x38dd74['name'];}_0x2e81b3['status'](_0x5d504f)[_0x8d8a('0x19')](_0x38dd74);};}function maskClientSecret(_0x57eaad){return _[_0x8d8a('0x1a')](_0x57eaad[_0x8d8a('0x1b')](0x0,0x3),0x14,'*');}exports[_0x8d8a('0x1c')]=function(_0x7b27d1,_0x28b144){var _0xaa9b08={},_0x1e4ca8={},_0x595b2d={'count':0x0,'rows':[]};var _0x3bc6fd=_[_0x8d8a('0x1d')](db['CloudProvider'][_0x8d8a('0x1e')],function(_0x1cf0a8){return{'name':_0x1cf0a8[_0x8d8a('0x1f')],'type':_0x1cf0a8[_0x8d8a('0x20')][_0x8d8a('0x21')]};});_0x1e4ca8[_0x8d8a('0x22')]=_[_0x8d8a('0x1d')](_0x3bc6fd,'name');_0x1e4ca8[_0x8d8a('0x23')]=_['keys'](_0x7b27d1[_0x8d8a('0x23')]);_0x1e4ca8[_0x8d8a('0x24')]=_[_0x8d8a('0x25')](_0x1e4ca8[_0x8d8a('0x22')],_0x1e4ca8[_0x8d8a('0x23')]);_0xaa9b08[_0x8d8a('0x26')]=_[_0x8d8a('0x25')](_0x1e4ca8[_0x8d8a('0x22')],qs['fields'](_0x7b27d1[_0x8d8a('0x23')][_0x8d8a('0x27')]));_0xaa9b08[_0x8d8a('0x26')]=_0xaa9b08['attributes'][_0x8d8a('0x28')]?_0xaa9b08[_0x8d8a('0x26')]:_0x1e4ca8['model'];if(!_0x7b27d1[_0x8d8a('0x23')][_0x8d8a('0x29')](_0x8d8a('0x2a'))){_0xaa9b08[_0x8d8a('0x12')]=qs[_0x8d8a('0x12')](_0x7b27d1[_0x8d8a('0x23')]['limit']);_0xaa9b08[_0x8d8a('0xf')]=qs[_0x8d8a('0xf')](_0x7b27d1['query'][_0x8d8a('0xf')]);}_0xaa9b08['order']=qs[_0x8d8a('0x2b')](_0x7b27d1[_0x8d8a('0x23')]['sort']);_0xaa9b08[_0x8d8a('0x2c')]=qs[_0x8d8a('0x24')](_[_0x8d8a('0x2d')](_0x7b27d1['query'],_0x1e4ca8[_0x8d8a('0x24')]),_0x3bc6fd);if(_0x7b27d1[_0x8d8a('0x23')][_0x8d8a('0x2e')]){_0xaa9b08[_0x8d8a('0x2c')]=_[_0x8d8a('0x2f')](_0xaa9b08[_0x8d8a('0x2c')],{'$or':_[_0x8d8a('0x1d')](_0x3bc6fd,function(_0x34e0ed){if(_0x34e0ed[_0x8d8a('0x20')]!==_0x8d8a('0x30')){var _0x236711={};_0x236711[_0x34e0ed[_0x8d8a('0x31')]]={'$like':'%'+_0x7b27d1[_0x8d8a('0x23')][_0x8d8a('0x2e')]+'%'};return _0x236711;}})});}_0xaa9b08=_['merge']({},_0xaa9b08,_0x7b27d1[_0x8d8a('0x32')]);var _0x50d140={'where':_0xaa9b08['where']};return db[_0x8d8a('0x33')][_0x8d8a('0x11')](_0x50d140)[_0x8d8a('0x15')](function(_0x2e6c44){_0x595b2d[_0x8d8a('0x11')]=_0x2e6c44;if(_0x7b27d1[_0x8d8a('0x23')]['includeAll']){_0xaa9b08['include']=[{'all':!![]}];}return db[_0x8d8a('0x33')][_0x8d8a('0x34')](_0xaa9b08);})[_0x8d8a('0x15')](function(_0x2df8fe){_0x595b2d['rows']=_[_0x8d8a('0x1d')](_0x2df8fe,function(_0x395a76){if(_0x395a76[_0x8d8a('0x35')]===_0x8d8a('0x36')){var _0x55e817=encryptor[_0x8d8a('0x37')](_0x395a76['data3']);_0x395a76[_0x8d8a('0x38')]=maskClientSecret(_0x55e817);}return _0x395a76;});return _0x595b2d;})[_0x8d8a('0x15')](respondWithFilteredResult(_0x28b144,_0xaa9b08))['catch'](handleError(_0x28b144,null));};exports['show']=function(_0x527189,_0x53210a){var _0x30899c={'raw':!![],'where':{'id':_0x527189[_0x8d8a('0x39')]['id']}},_0x2c5a99={};_0x2c5a99[_0x8d8a('0x22')]=_[_0x8d8a('0x3a')](db['CloudProvider']['rawAttributes']);_0x2c5a99['query']=_[_0x8d8a('0x3a')](_0x527189[_0x8d8a('0x23')]);_0x2c5a99[_0x8d8a('0x24')]=_['intersection'](_0x2c5a99['model'],_0x2c5a99[_0x8d8a('0x23')]);_0x30899c['attributes']=_[_0x8d8a('0x25')](_0x2c5a99[_0x8d8a('0x22')],qs[_0x8d8a('0x27')](_0x527189[_0x8d8a('0x23')][_0x8d8a('0x27')]));_0x30899c['attributes']=_0x30899c[_0x8d8a('0x26')][_0x8d8a('0x28')]?_0x30899c[_0x8d8a('0x26')]:_0x2c5a99[_0x8d8a('0x22')];if(_0x527189[_0x8d8a('0x23')]['includeAll']){_0x30899c[_0x8d8a('0x3b')]=[{'all':!![]}];}_0x30899c=_[_0x8d8a('0x2f')]({},_0x30899c,_0x527189[_0x8d8a('0x32')]);return db[_0x8d8a('0x33')][_0x8d8a('0x3c')](_0x30899c)[_0x8d8a('0x15')](handleEntityNotFound(_0x53210a,null))[_0x8d8a('0x15')](function(_0x335751){if(_0x335751[_0x8d8a('0x35')]===_0x8d8a('0x36')){var _0x3ffbae=encryptor[_0x8d8a('0x37')](_0x335751[_0x8d8a('0x38')]);_0x335751[_0x8d8a('0x38')]=maskClientSecret(_0x3ffbae);}return _0x335751;})[_0x8d8a('0x15')](respondWithResult(_0x53210a,null))[_0x8d8a('0x3d')](handleError(_0x53210a,null));};exports['create']=function(_0x49f542,_0x277180){if(!_0x49f542['body']['name'])throw new Error(_0x8d8a('0x3e'));if(!_0x49f542[_0x8d8a('0x3f')][_0x8d8a('0x35')])throw new Error(_0x8d8a('0x40'));var _0x330e52=db[_0x8d8a('0x33')][_0x8d8a('0x1e')][_0x8d8a('0x35')][_0x8d8a('0x41')];if(!_0x330e52[_0x8d8a('0x42')](_0x49f542[_0x8d8a('0x3f')][_0x8d8a('0x35')]))throw new Error(_0x8d8a('0x43')+_0x330e52['join'](',\x20'));if(_0x49f542[_0x8d8a('0x3f')][_0x8d8a('0x35')]===_0x8d8a('0x36')&&_0x49f542['body'][_0x8d8a('0x38')]){_0x49f542[_0x8d8a('0x3f')][_0x8d8a('0x38')]=encryptor[_0x8d8a('0x44')](_0x49f542[_0x8d8a('0x3f')]['data3']);}return db[_0x8d8a('0x33')][_0x8d8a('0x45')](_0x49f542[_0x8d8a('0x3f')],{})['then'](respondWithResult(_0x277180,0xc9))['catch'](handleError(_0x277180,null));};exports['update']=function(_0x215f95,_0x9e6946){if(_0x215f95[_0x8d8a('0x3f')]['id']){delete _0x215f95['body']['id'];}return db[_0x8d8a('0x33')][_0x8d8a('0x3c')]({'where':{'id':_0x215f95['params']['id']}})[_0x8d8a('0x15')](handleEntityNotFound(_0x9e6946,null))[_0x8d8a('0x15')](function(_0x43b32d){if(_0x43b32d['service']==='MicrosoftAzure'&&_0x215f95[_0x8d8a('0x3f')][_0x8d8a('0x38')]){_0x215f95[_0x8d8a('0x3f')][_0x8d8a('0x38')]=encryptor['encryptString'](_0x215f95[_0x8d8a('0x3f')][_0x8d8a('0x38')]);}return _0x43b32d;})[_0x8d8a('0x15')](saveUpdates(_0x215f95[_0x8d8a('0x3f')],null))['then'](respondWithResult(_0x9e6946,null))[_0x8d8a('0x3d')](handleError(_0x9e6946,null));};exports[_0x8d8a('0x16')]=function(_0x379265,_0x29470c){return db[_0x8d8a('0x33')][_0x8d8a('0x3c')]({'where':{'id':_0x379265[_0x8d8a('0x39')]['id']}})['then'](handleEntityNotFound(_0x29470c,null))[_0x8d8a('0x15')](removeEntity(_0x29470c,null))['catch'](handleError(_0x29470c,null));};exports[_0x8d8a('0x46')]=function(_0x43d8b5,_0x408d6f){return db[_0x8d8a('0x33')][_0x8d8a('0x47')]({'where':{'id':_0x43d8b5[_0x8d8a('0x39')]['id']},'raw':!![]})[_0x8d8a('0x15')](function(_0x24ab46){if(!_0x24ab46)return _0x408d6f[_0x8d8a('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x24ab46,_0x43d8b5[_0x8d8a('0x48')]['id'])};})['then'](respondWithResult(_0x408d6f,null))['catch'](handleError(_0x408d6f,null));};exports[_0x8d8a('0x49')]=function(_0x3c31e2,_0x3fb0c4){var _0x53e3f5=_0x3c31e2[_0x8d8a('0x3f')];var _0x3b126a;var _0x549710;if(_0x53e3f5[_0x8d8a('0x17')])throw _0x53e3f5;redis['get'](_0x53e3f5[_0x8d8a('0x4a')])['then'](function(_0x342c5e){if(!_0x342c5e)throw new Error('Invalid\x20state\x20parameter');_0x3b126a=JSON[_0x8d8a('0x4b')](_0x342c5e);var _0x4a82a2=Buffer[_0x8d8a('0x4c')](_0x53e3f5[_0x8d8a('0x4a')],_0x8d8a('0x4d'))['toString']('ascii');_0x549710=JSON[_0x8d8a('0x4b')](_0x4a82a2);if(!oauth['isValidIdToken'](_0x53e3f5[_0x8d8a('0x4e')],_0x3b126a['oauth2Claims']))throw new Error(_0x8d8a('0x4f'));redis[_0x8d8a('0x50')](_0x53e3f5[_0x8d8a('0x4a')]);return oauth[_0x8d8a('0x51')](_0x53e3f5[_0x8d8a('0x52')],_0x3b126a);})[_0x8d8a('0x15')](function(_0x41db8e){_0x3b126a['data5']=_0x41db8e['access_token'];_0x3b126a[_0x8d8a('0x53')]=_0x41db8e[_0x8d8a('0x54')];return db[_0x8d8a('0x33')][_0x8d8a('0x14')]({'data5':_0x3b126a[_0x8d8a('0x55')],'data6':_0x3b126a['data6']},{'where':{'id':_0x3b126a['id']}});})[_0x8d8a('0x15')](function(){oauth['startRefreshInterval'](_0x3b126a);socket[_0x8d8a('0x56')]('microsoftAuthorization:success',{'id':_0x549710['id']});return;})[_0x8d8a('0x15')](respondWithStatusCode(_0x3fb0c4,null))[_0x8d8a('0x3d')](function(_0x35d52){if(_0x549710){socket[_0x8d8a('0x56')](_0x8d8a('0x57'),{'id':_0x549710['id']});}if(!_0x3b126a){logger[_0x8d8a('0x17')](_0x8d8a('0x58'),_0x35d52);return _0x3fb0c4[_0x8d8a('0xc')](0x1f4)[_0x8d8a('0x19')](_0x35d52[_0x8d8a('0x59')]);}logger['error'](_0x8d8a('0x5a'),_0x3b126a['id'],JSON[_0x8d8a('0x5b')](_0x35d52));});}; \ No newline at end of file +var _0x72c3=['where','filter','merge','VIRTUAL','CloudProvider','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','params','options','find','catch','create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','user','error','get','state','Invalid\x20state\x20parameter','parse','base64','ascii','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','access_token','data6','refresh_token','data5','startRefreshInterval','emit','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','count','limit','Content-Range','update','then','destroy','sendStatus','name','send','padEnd','slice','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x50576c,_0x502d9c){var _0x22c1ef=function(_0x4067e7){while(--_0x4067e7){_0x50576c['push'](_0x50576c['shift']());}};_0x22c1ef(++_0x502d9c);}(_0x72c3,0xe3));var _0x372c=function(_0x458d03,_0x4d7fbc){_0x458d03=_0x458d03-0x0;var _0x3f7cb0=_0x72c3[_0x458d03];return _0x3f7cb0;};'use strict';var _=require(_0x372c('0x0'));var Redis=require(_0x372c('0x1'));var qs=require(_0x372c('0x2'));var encryptor=require(_0x372c('0x3'));var config=require(_0x372c('0x4'));var logger=require(_0x372c('0x5'))(_0x372c('0x6'));var db=require(_0x372c('0x7'))['db'];var oauth=require(_0x372c('0x8'));config[_0x372c('0x9')]=_[_0x372c('0xa')](config[_0x372c('0x9')],{'host':_0x372c('0xb'),'port':0x18eb});var socket=require(_0x372c('0xc'))(new Redis(config['redis']));var redis=new Redis(config[_0x372c('0x9')]);function respondWithStatusCode(_0x43a175,_0x30a40b){_0x30a40b=_0x30a40b||0xcc;return function(_0x2fd475){if(_0x2fd475){return _0x43a175['sendStatus'](_0x30a40b);}return _0x43a175[_0x372c('0xd')](_0x30a40b)[_0x372c('0xe')]();};}function respondWithResult(_0x384a8a,_0x5887b8){_0x5887b8=_0x5887b8||0xc8;return function(_0x49b6cd){if(_0x49b6cd){return _0x384a8a['status'](_0x5887b8)[_0x372c('0xf')](_0x49b6cd);}};}function respondWithFilteredResult(_0x207c24,_0x15b9e0){return function(_0xa12327){if(_0xa12327){var _0x367853=typeof _0x15b9e0[_0x372c('0x10')]==='undefined'&&typeof _0x15b9e0['limit']==='undefined';var _0x51bb98=_0xa12327[_0x372c('0x11')];var _0x56616e=_0x367853?0x0:_0x15b9e0[_0x372c('0x10')];var _0x50f074=_0x367853?_0xa12327[_0x372c('0x11')]:_0x15b9e0[_0x372c('0x10')]+_0x15b9e0[_0x372c('0x12')];var _0x3cad48;if(_0x50f074>=_0x51bb98){_0x50f074=_0x51bb98;_0x3cad48=0xc8;}else{_0x3cad48=0xce;}_0x207c24['status'](_0x3cad48);return _0x207c24['set'](_0x372c('0x13'),_0x56616e+'-'+_0x50f074+'/'+_0x51bb98)[_0x372c('0xf')](_0xa12327);}return null;};}function saveUpdates(_0x4b80b6){return function(_0x36bf6e){if(_0x36bf6e){return _0x36bf6e[_0x372c('0x14')](_0x4b80b6)[_0x372c('0x15')](function(_0x3a0837){return _0x3a0837;});}return null;};}function removeEntity(_0x29d9d2){return function(_0xd629cc){if(_0xd629cc){return _0xd629cc[_0x372c('0x16')]()[_0x372c('0x15')](function(){_0x29d9d2[_0x372c('0xd')](0xcc)[_0x372c('0xe')]();});}};}function handleEntityNotFound(_0x5d5b78){return function(_0x33437e){if(!_0x33437e){_0x5d5b78[_0x372c('0x17')](0x194);}return _0x33437e;};}function handleError(_0x15b446,_0x524cb0){_0x524cb0=_0x524cb0||0x1f4;return function(_0x48f32a){logger['error'](_0x48f32a['stack']);if(_0x48f32a[_0x372c('0x18')]){delete _0x48f32a[_0x372c('0x18')];}_0x15b446[_0x372c('0xd')](_0x524cb0)[_0x372c('0x19')](_0x48f32a);};}function maskClientSecret(_0x596e7d){return _[_0x372c('0x1a')](_0x596e7d[_0x372c('0x1b')](0x0,0x3),0x14,'*');}exports[_0x372c('0x1c')]=function(_0xa6f3c6,_0x13b0bf){var _0x456fa2={},_0x2e47d7={},_0x3db1af={'count':0x0,'rows':[]};var _0x55f138=_[_0x372c('0x1d')](db['CloudProvider'][_0x372c('0x1e')],function(_0x4723d6){return{'name':_0x4723d6['fieldName'],'type':_0x4723d6['type'][_0x372c('0x1f')]};});_0x2e47d7[_0x372c('0x20')]=_[_0x372c('0x1d')](_0x55f138,_0x372c('0x18'));_0x2e47d7[_0x372c('0x21')]=_[_0x372c('0x22')](_0xa6f3c6[_0x372c('0x21')]);_0x2e47d7[_0x372c('0x23')]=_[_0x372c('0x24')](_0x2e47d7[_0x372c('0x20')],_0x2e47d7[_0x372c('0x21')]);_0x456fa2['attributes']=_[_0x372c('0x24')](_0x2e47d7[_0x372c('0x20')],qs[_0x372c('0x25')](_0xa6f3c6[_0x372c('0x21')][_0x372c('0x25')]));_0x456fa2['attributes']=_0x456fa2[_0x372c('0x26')][_0x372c('0x27')]?_0x456fa2[_0x372c('0x26')]:_0x2e47d7['model'];if(!_0xa6f3c6[_0x372c('0x21')][_0x372c('0x28')](_0x372c('0x29'))){_0x456fa2[_0x372c('0x12')]=qs[_0x372c('0x12')](_0xa6f3c6[_0x372c('0x21')][_0x372c('0x12')]);_0x456fa2[_0x372c('0x10')]=qs[_0x372c('0x10')](_0xa6f3c6['query'][_0x372c('0x10')]);}_0x456fa2['order']=qs[_0x372c('0x2a')](_0xa6f3c6[_0x372c('0x21')][_0x372c('0x2a')]);_0x456fa2[_0x372c('0x2b')]=qs[_0x372c('0x23')](_['pick'](_0xa6f3c6[_0x372c('0x21')],_0x2e47d7[_0x372c('0x23')]),_0x55f138);if(_0xa6f3c6[_0x372c('0x21')][_0x372c('0x2c')]){_0x456fa2[_0x372c('0x2b')]=_[_0x372c('0x2d')](_0x456fa2['where'],{'$or':_[_0x372c('0x1d')](_0x55f138,function(_0x57b8e7){if(_0x57b8e7['type']!==_0x372c('0x2e')){var _0x1bd932={};_0x1bd932[_0x57b8e7[_0x372c('0x18')]]={'$like':'%'+_0xa6f3c6[_0x372c('0x21')][_0x372c('0x2c')]+'%'};return _0x1bd932;}})});}_0x456fa2=_[_0x372c('0x2d')]({},_0x456fa2,_0xa6f3c6['options']);var _0x162b18={'where':_0x456fa2['where']};return db[_0x372c('0x2f')]['count'](_0x162b18)['then'](function(_0x331a9e){_0x3db1af[_0x372c('0x11')]=_0x331a9e;if(_0xa6f3c6[_0x372c('0x21')]['includeAll']){_0x456fa2[_0x372c('0x30')]=[{'all':!![]}];}return db[_0x372c('0x2f')][_0x372c('0x31')](_0x456fa2);})[_0x372c('0x15')](function(_0x3ce108){_0x3db1af[_0x372c('0x32')]=_['map'](_0x3ce108,function(_0x694402){if(_0x694402[_0x372c('0x33')]===_0x372c('0x34')){var _0x14fa2e=encryptor[_0x372c('0x35')](_0x694402[_0x372c('0x36')]);_0x694402[_0x372c('0x36')]=maskClientSecret(_0x14fa2e);}return _0x694402;});return _0x3db1af;})[_0x372c('0x15')](respondWithFilteredResult(_0x13b0bf,_0x456fa2))['catch'](handleError(_0x13b0bf,null));};exports[_0x372c('0x37')]=function(_0x56384e,_0x5449c9){var _0x2711b4={'raw':!![],'where':{'id':_0x56384e[_0x372c('0x38')]['id']}},_0x272ebd={};_0x272ebd[_0x372c('0x20')]=_[_0x372c('0x22')](db[_0x372c('0x2f')][_0x372c('0x1e')]);_0x272ebd[_0x372c('0x21')]=_[_0x372c('0x22')](_0x56384e[_0x372c('0x21')]);_0x272ebd[_0x372c('0x23')]=_['intersection'](_0x272ebd['model'],_0x272ebd['query']);_0x2711b4[_0x372c('0x26')]=_['intersection'](_0x272ebd['model'],qs[_0x372c('0x25')](_0x56384e[_0x372c('0x21')][_0x372c('0x25')]));_0x2711b4[_0x372c('0x26')]=_0x2711b4[_0x372c('0x26')][_0x372c('0x27')]?_0x2711b4[_0x372c('0x26')]:_0x272ebd[_0x372c('0x20')];if(_0x56384e[_0x372c('0x21')]['includeAll']){_0x2711b4[_0x372c('0x30')]=[{'all':!![]}];}_0x2711b4=_['merge']({},_0x2711b4,_0x56384e[_0x372c('0x39')]);return db[_0x372c('0x2f')][_0x372c('0x3a')](_0x2711b4)[_0x372c('0x15')](handleEntityNotFound(_0x5449c9,null))[_0x372c('0x15')](function(_0x218ba3){if(_0x218ba3['service']===_0x372c('0x34')){var _0x3f2d1d=encryptor[_0x372c('0x35')](_0x218ba3[_0x372c('0x36')]);_0x218ba3[_0x372c('0x36')]=maskClientSecret(_0x3f2d1d);}return _0x218ba3;})[_0x372c('0x15')](respondWithResult(_0x5449c9,null))[_0x372c('0x3b')](handleError(_0x5449c9,null));};exports[_0x372c('0x3c')]=function(_0xf6714b,_0x27af13){if(!_0xf6714b[_0x372c('0x3d')]['name'])throw new Error(_0x372c('0x3e'));if(!_0xf6714b['body'][_0x372c('0x33')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x2a0e5e=db[_0x372c('0x2f')][_0x372c('0x1e')]['service'][_0x372c('0x3f')];if(!_0x2a0e5e[_0x372c('0x40')](_0xf6714b[_0x372c('0x3d')][_0x372c('0x33')]))throw new Error(_0x372c('0x41')+_0x2a0e5e[_0x372c('0x42')](',\x20'));if(_0xf6714b[_0x372c('0x3d')][_0x372c('0x33')]===_0x372c('0x34')&&_0xf6714b[_0x372c('0x3d')]['data3']){_0xf6714b[_0x372c('0x3d')][_0x372c('0x36')]=encryptor[_0x372c('0x43')](_0xf6714b['body']['data3']);}return db['CloudProvider'][_0x372c('0x3c')](_0xf6714b[_0x372c('0x3d')],{})[_0x372c('0x15')](respondWithResult(_0x27af13,0xc9))[_0x372c('0x3b')](handleError(_0x27af13,null));};exports['update']=function(_0x3f7461,_0x58651){if(_0x3f7461['body']['id']){delete _0x3f7461[_0x372c('0x3d')]['id'];}return db[_0x372c('0x2f')][_0x372c('0x3a')]({'where':{'id':_0x3f7461[_0x372c('0x38')]['id']}})[_0x372c('0x15')](handleEntityNotFound(_0x58651,null))[_0x372c('0x15')](function(_0x35e0bb){if(_0x35e0bb[_0x372c('0x33')]===_0x372c('0x34')&&_0x3f7461[_0x372c('0x3d')]['data3']){_0x3f7461[_0x372c('0x3d')]['data3']=encryptor[_0x372c('0x43')](_0x3f7461[_0x372c('0x3d')][_0x372c('0x36')]);}return _0x35e0bb;})[_0x372c('0x15')](saveUpdates(_0x3f7461['body'],null))['then'](respondWithResult(_0x58651,null))[_0x372c('0x3b')](handleError(_0x58651,null));};exports[_0x372c('0x16')]=function(_0x3a40de,_0x4bb77c){return db[_0x372c('0x2f')][_0x372c('0x3a')]({'where':{'id':_0x3a40de[_0x372c('0x38')]['id']}})['then'](handleEntityNotFound(_0x4bb77c,null))['then'](removeEntity(_0x4bb77c,null))[_0x372c('0x3b')](handleError(_0x4bb77c,null));};exports[_0x372c('0x44')]=function(_0x6d3c74,_0x59d0ef){return db[_0x372c('0x2f')]['findOne']({'where':{'id':_0x6d3c74['params']['id']},'raw':!![]})['then'](function(_0x21573c){if(!_0x21573c)return _0x59d0ef[_0x372c('0x17')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x21573c,_0x6d3c74[_0x372c('0x45')]['id'])};})[_0x372c('0x15')](respondWithResult(_0x59d0ef,null))[_0x372c('0x3b')](handleError(_0x59d0ef,null));};exports['oauth2MicrosoftCallback']=function(_0x334210,_0x1a650c){var _0xa61474=_0x334210[_0x372c('0x3d')];var _0x3132dc;var _0x38baeb;if(_0xa61474[_0x372c('0x46')])throw _0xa61474;redis[_0x372c('0x47')](_0xa61474[_0x372c('0x48')])[_0x372c('0x15')](function(_0x44dcf7){if(!_0x44dcf7)throw new Error(_0x372c('0x49'));_0x3132dc=JSON[_0x372c('0x4a')](_0x44dcf7);var _0x25f621=Buffer['from'](_0xa61474['state'],_0x372c('0x4b'))['toString'](_0x372c('0x4c'));_0x38baeb=JSON[_0x372c('0x4a')](_0x25f621);if(!oauth[_0x372c('0x4d')](_0xa61474[_0x372c('0x4e')],_0x3132dc[_0x372c('0x4f')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x372c('0x50')](_0xa61474[_0x372c('0x48')]);return oauth[_0x372c('0x51')](_0xa61474['code'],_0x3132dc);})['then'](function(_0x13c2c9){_0x3132dc['data5']=_0x13c2c9[_0x372c('0x52')];_0x3132dc[_0x372c('0x53')]=_0x13c2c9[_0x372c('0x54')];return db[_0x372c('0x2f')][_0x372c('0x14')]({'data5':_0x3132dc[_0x372c('0x55')],'data6':_0x3132dc[_0x372c('0x53')]},{'where':{'id':_0x3132dc['id']}});})['then'](function(){oauth[_0x372c('0x56')](_0x3132dc);socket['emit']('microsoftAuthorization:success',{'id':_0x38baeb['id']});return;})['then'](respondWithStatusCode(_0x1a650c,null))[_0x372c('0x3b')](function(_0x4d8c8e){if(_0x38baeb){socket[_0x372c('0x57')]('microsoftAuthorization:error',{'id':_0x38baeb['id']});}if(!_0x3132dc){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x4d8c8e);return _0x1a650c[_0x372c('0xd')](0x1f4)['send'](_0x4d8c8e[_0x372c('0x58')]);}logger['error'](_0x372c('0x59'),_0x3132dc['id'],JSON['stringify'](_0x4d8c8e));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6ab3a9a..ea735a7 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 _0x8c47=['moment','bluebird','request-promise','path','rimraf','exports','define','CloudProvider','util','../../config/logger','api'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x8c47,0xc3));var _0x78c4=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8c47[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require(_0x78c4('0x0'));var logger=require(_0x78c4('0x1'))(_0x78c4('0x2'));var moment=require(_0x78c4('0x3'));var BPromise=require(_0x78c4('0x4'));var rp=require(_0x78c4('0x5'));var fs=require('fs');var path=require(_0x78c4('0x6'));var rimraf=require(_0x78c4('0x7'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x78c4('0x8')]=function(_0x52bcdd,_0x21d135){return _0x52bcdd[_0x78c4('0x9')](_0x78c4('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc26c=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','util','../../config/logger'];(function(_0x176df,_0x49ffb0){var _0x4e441c=function(_0x5e5e5c){while(--_0x5e5e5c){_0x176df['push'](_0x176df['shift']());}};_0x4e441c(++_0x49ffb0);}(_0xc26c,0x169));var _0xcc26=function(_0x35b810,_0x444a87){_0x35b810=_0x35b810-0x0;var _0x240025=_0xc26c[_0x35b810];return _0x240025;};'use strict';var _=require('lodash');var util=require(_0xcc26('0x0'));var logger=require(_0xcc26('0x1'))(_0xcc26('0x2'));var moment=require('moment');var BPromise=require(_0xcc26('0x3'));var rp=require(_0xcc26('0x4'));var fs=require('fs');var path=require(_0xcc26('0x5'));var rimraf=require(_0xcc26('0x6'));var config=require(_0xcc26('0x7'));var attributes=require(_0xcc26('0x8'));module['exports']=function(_0x399558,_0x2d4d62){return _0x399558[_0xcc26('0x9')](_0xcc26('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 298d6fb..40ac099 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 _0x2790=['../../mysqldb','redis','defaults','localhost','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','oauth2Claims','oauth2/','decode','payload','issuer','aud','audience','isAfter','unix','data3','findOne','then','refresh_token','data6','decryptString','POST','data5','access_token','CloudProvider','update','catch','error','authorization_code','{TENANT_ID}','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','util','../../config/environment','../../config/logger','api'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2790,0x1d1));var _0x0279=function(_0x470d13,_0x3f22fa){_0x470d13=_0x470d13-0x0;var _0x18cc32=_0x2790[_0x470d13];return _0x18cc32;};'use strict';var _=require(_0x0279('0x0'));var crypto=require(_0x0279('0x1'));var jwt=require(_0x0279('0x2'));var moment=require(_0x0279('0x3'));var Redis=require(_0x0279('0x4'));var rp=require('request-promise');var util=require(_0x0279('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0x0279('0x6'));var logger=require(_0x0279('0x7'))(_0x0279('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x0279('0x9'))['db'];config[_0x0279('0xa')]=_[_0x0279('0xb')](config['redis'],{'host':_0x0279('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x0279('0xd'),'profile',_0x0279('0xe'),'offline_access',_0x0279('0xf'),_0x0279('0x10'),_0x0279('0x11')],'Dynamics365':[_0x0279('0xd'),_0x0279('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x0279('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x0279('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x196f9f){var _0x4dcaa6=_[_0x0279('0x15')](AZURE_AUTH_SCOPES[_0x196f9f['type']]);if(_0x196f9f[_0x0279('0x16')]===_0x0279('0x17'))_0x4dcaa6[_0x0279('0x18')](_0x196f9f[_0x0279('0x19')]+_0x0279('0x1a'));return _0x4dcaa6[_0x0279('0x1b')]('\x20');}function getAccessTokenScope(_0x2174d7){if(_0x2174d7[_0x0279('0x16')]===_0x0279('0x1c'))return _0x0279('0xf');if(_0x2174d7[_0x0279('0x16')]===_0x0279('0x17'))return _0x2174d7['data7']+_0x0279('0x1a');}function generateMicrosoftAuthorizationUrl(_0xfa550d,_0x272577){var _0x52c66d=MICROSOFT_AUTH_URL[_0x0279('0x1d')]('{TENANT_ID}',_0xfa550d[_0x0279('0x1e')]);var _0x2315f6=[_0x0279('0x1f'),_0x0279('0x20')];var _0xfd56e=Buffer[_0x0279('0x21')](JSON[_0x0279('0x22')]({'id':_0x272577}))[_0x0279('0x23')](_0x0279('0x24'));var _0x45f1ed=crypto[_0x0279('0x25')](0x10)[_0x0279('0x23')](_0x0279('0x26'));var _0x3e674e=getAuthorizationScopes(_0xfa550d);var _0x2f4927=[{'key':_0x0279('0x27'),'value':_0xfa550d[_0x0279('0x28')]},{'key':'response_type','value':encodeURIComponent(_0x2315f6['join']('\x20'))},{'key':'redirect_uri','value':_0xfa550d[_0x0279('0x29')]},{'key':_0x0279('0x2a'),'value':_0x0279('0x2b')},{'key':_0x0279('0x2c'),'value':encodeURIComponent(_0x3e674e)},{'key':_0x0279('0x2d'),'value':_0xfd56e},{'key':_0x0279('0x2e'),'value':_0x45f1ed},{'key':_0x0279('0x2f'),'value':_0x0279('0x30')}];var _0x11c5e4=_0x52c66d+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x0279('0x15')](_0x2f4927,function(_0x5a6125){return _0x5a6125[_0x0279('0x31')]+'='+_0x5a6125['value'];})[_0x0279('0x1b')]('&');_0xfa550d[_0x0279('0x32')]={'issuer':_0x52c66d['replace'](_0x0279('0x33'),''),'audience':_0xfa550d[_0x0279('0x28')],'state':_0xfd56e,'nonce':_0x45f1ed};redis['set'](_0xfd56e,JSON[_0x0279('0x22')](_0xfa550d));return _0x11c5e4;}function isValidIdToken(_0xba5138,_0x3af4bf){try{var _0x3c44a0=jwt[_0x0279('0x34')](_0xba5138,{'complete':!![]});var _0x1fba6c=_0x3c44a0[_0x0279('0x35')];if(_0x1fba6c['iss']!==_0x3af4bf[_0x0279('0x36')])return![];if(_0x1fba6c[_0x0279('0x37')]!==_0x3af4bf[_0x0279('0x38')])return![];if(_0x1fba6c[_0x0279('0x2e')]!==_0x3af4bf['nonce'])return![];if(moment()[_0x0279('0x39')](moment[_0x0279('0x3a')](_0x1fba6c['exp'])))return![];return!![];}catch(_0x516289){throw _0x516289;}}function refreshOauth2MicrosoftAccessToken(_0x344a5e){return Promise['resolve']()['then'](function(){if(_0x344a5e[_0x0279('0x3b')])return _0x344a5e;return db['CloudProvider'][_0x0279('0x3c')]({'where':{'id':_0x344a5e['id']},'raw':!![]});})[_0x0279('0x3d')](function(_0x5e2ce6){var _0x5b26dc={'grant_type':_0x0279('0x3e'),'refresh_token':_0x5e2ce6[_0x0279('0x3f')],'scope':getAccessTokenScope(_0x5e2ce6),'redirect_uri':_0x5e2ce6[_0x0279('0x29')],'client_id':_0x5e2ce6[_0x0279('0x28')],'client_secret':encryptor[_0x0279('0x40')](_0x5e2ce6['data3'])};var _0x2fd55a={'method':_0x0279('0x41'),'uri':MICROSOFT_AUTH_URL[_0x0279('0x1d')]('{TENANT_ID}',_0x5e2ce6[_0x0279('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5b26dc,'json':!![]};return rp(_0x2fd55a);})[_0x0279('0x3d')](function(_0x28b6ec){_0x344a5e[_0x0279('0x42')]=_0x28b6ec[_0x0279('0x43')];_0x344a5e[_0x0279('0x3f')]=_0x28b6ec[_0x0279('0x3e')];return db[_0x0279('0x44')][_0x0279('0x45')]({'data5':_0x344a5e[_0x0279('0x42')],'data6':_0x344a5e[_0x0279('0x3f')]},{'where':{'id':_0x344a5e['id']}});})[_0x0279('0x3d')](function(){return _0x344a5e;})[_0x0279('0x46')](function(_0x34646c){logger[_0x0279('0x47')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x344a5e['id'],_0x34646c);});}function getOauth2MicrosoftAccessToken(_0x57799f,_0x2a1198){var _0x3b1130={'grant_type':_0x0279('0x48'),'code':_0x57799f,'scope':getAccessTokenScope(_0x2a1198),'redirect_uri':_0x2a1198[_0x0279('0x29')],'client_id':_0x2a1198[_0x0279('0x28')],'client_secret':encryptor[_0x0279('0x40')](_0x2a1198[_0x0279('0x3b')])};var _0x1f9972={'method':_0x0279('0x41'),'uri':MICROSOFT_AUTH_URL[_0x0279('0x1d')](_0x0279('0x49'),_0x2a1198[_0x0279('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3b1130,'json':!![]};return rp(_0x1f9972);}function startRefreshInterval(_0x48a6bd){var _0x4466f3=schedule[_0x0279('0x4a')];if(_0x4466f3[_0x48a6bd['id']])clearInterval(_0x4466f3[_0x48a6bd['id']]);_0x4466f3[_0x48a6bd['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x48a6bd['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x0279('0x4a')]=_0x4466f3;}function startAllRefreshIntervals(){return db[_0x0279('0x44')][_0x0279('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x0279('0x3d')](function(_0x23862f){var _0x153423=_0x23862f[_0x0279('0x15')](function(_0x4c694b){return refreshOauth2MicrosoftAccessToken(_0x4c694b)[_0x0279('0x3d')](function(_0x3f4fb1){startRefreshInterval(_0x3f4fb1);});});return Promise[_0x0279('0x4c')](_0x153423);})[_0x0279('0x46')](function(_0x1ea3dd){var _0x4f38b4=_0x1ea3dd?util[_0x0279('0x4d')](_0x1ea3dd,{'showHidden':![],'depth':null}):'';logger['error'](_0x0279('0x4e'),_0x4f38b4);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x6282=['audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','access_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','bind','intervals','map','all','inspect','exports','crypto','util','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','openid','type','/.default','Outlook365','Dynamics365','data7','replace','{TENANT_ID}','data2','code','id_token','stringify','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','key','value','join','oauth2Claims','oauth2/','payload','iss','issuer','aud'];(function(_0x358a0a,_0x4cffea){var _0x41a6ad=function(_0x3f78c0){while(--_0x3f78c0){_0x358a0a['push'](_0x358a0a['shift']());}};_0x41a6ad(++_0x4cffea);}(_0x6282,0x1d6));var _0x2628=function(_0xf9ad24,_0x411644){_0xf9ad24=_0xf9ad24-0x0;var _0x11d9ff=_0x6282[_0xf9ad24];return _0x11d9ff;};'use strict';var _=require('lodash');var crypto=require(_0x2628('0x0'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x2628('0x1'));var encryptor=require(_0x2628('0x2'));var config=require('../../config/environment');var logger=require(_0x2628('0x3'))(_0x2628('0x4'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x2628('0x5'))['db'];config[_0x2628('0x6')]=_[_0x2628('0x7')](config[_0x2628('0x6')],{'host':_0x2628('0x8'),'port':0x18eb});var redis=new Redis(config[_0x2628('0x6')]);var MICROSOFT_AUTH_URL=_0x2628('0x9');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x2628('0xa'),_0x2628('0xb'),_0x2628('0xc'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x2628('0xd'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x2628('0xe'),_0x2628('0xc')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x197d32){var _0x3dd0ee=_['map'](AZURE_AUTH_SCOPES[_0x197d32[_0x2628('0xf')]]);if(_0x197d32[_0x2628('0xf')]==='Dynamics365')_0x3dd0ee['push'](_0x197d32['data7']+_0x2628('0x10'));return _0x3dd0ee['join']('\x20');}function getAccessTokenScope(_0x156a64){if(_0x156a64[_0x2628('0xf')]===_0x2628('0x11'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x156a64[_0x2628('0xf')]===_0x2628('0x12'))return _0x156a64[_0x2628('0x13')]+_0x2628('0x10');}function generateMicrosoftAuthorizationUrl(_0x420af6,_0x4d1caa){var _0x499542=MICROSOFT_AUTH_URL[_0x2628('0x14')](_0x2628('0x15'),_0x420af6[_0x2628('0x16')]);var _0x559c4c=[_0x2628('0x17'),_0x2628('0x18')];var _0x2c44ee=Buffer['from'](JSON[_0x2628('0x19')]({'id':_0x4d1caa}))['toString']('base64');var _0x57fbf2=crypto['randomBytes'](0x10)[_0x2628('0x1a')](_0x2628('0x1b'));var _0x291b62=getAuthorizationScopes(_0x420af6);var _0x4f0da7=[{'key':_0x2628('0x1c'),'value':_0x420af6[_0x2628('0x1d')]},{'key':_0x2628('0x1e'),'value':encodeURIComponent(_0x559c4c['join']('\x20'))},{'key':_0x2628('0x1f'),'value':_0x420af6[_0x2628('0x20')]},{'key':_0x2628('0x21'),'value':_0x2628('0x22')},{'key':_0x2628('0x23'),'value':encodeURIComponent(_0x291b62)},{'key':_0x2628('0x24'),'value':_0x2c44ee},{'key':_0x2628('0x25'),'value':_0x57fbf2},{'key':_0x2628('0x26'),'value':'login'}];var _0x5b59d8=_0x499542+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x4f0da7,function(_0x5e8a54){return _0x5e8a54[_0x2628('0x27')]+'='+_0x5e8a54[_0x2628('0x28')];})[_0x2628('0x29')]('&');_0x420af6[_0x2628('0x2a')]={'issuer':_0x499542[_0x2628('0x14')](_0x2628('0x2b'),''),'audience':_0x420af6['data1'],'state':_0x2c44ee,'nonce':_0x57fbf2};redis['set'](_0x2c44ee,JSON[_0x2628('0x19')](_0x420af6));return _0x5b59d8;}function isValidIdToken(_0x413cfb,_0x3ef89b){try{var _0x4db6ad=jwt['decode'](_0x413cfb,{'complete':!![]});var _0x3edac5=_0x4db6ad[_0x2628('0x2c')];if(_0x3edac5[_0x2628('0x2d')]!==_0x3ef89b[_0x2628('0x2e')])return![];if(_0x3edac5[_0x2628('0x2f')]!==_0x3ef89b[_0x2628('0x30')])return![];if(_0x3edac5[_0x2628('0x25')]!==_0x3ef89b[_0x2628('0x25')])return![];if(moment()[_0x2628('0x31')](moment[_0x2628('0x32')](_0x3edac5[_0x2628('0x33')])))return![];return!![];}catch(_0x4a4661){throw _0x4a4661;}}function refreshOauth2MicrosoftAccessToken(_0x4d68da){return Promise[_0x2628('0x34')]()[_0x2628('0x35')](function(){if(_0x4d68da[_0x2628('0x36')])return _0x4d68da;return db[_0x2628('0x37')][_0x2628('0x38')]({'where':{'id':_0x4d68da['id']},'raw':!![]});})[_0x2628('0x35')](function(_0xc809a5){var _0x2f8ef2={'grant_type':_0x2628('0x39'),'refresh_token':_0xc809a5[_0x2628('0x3a')],'scope':getAccessTokenScope(_0xc809a5),'redirect_uri':_0xc809a5['data4'],'client_id':_0xc809a5['data1'],'client_secret':encryptor[_0x2628('0x3b')](_0xc809a5[_0x2628('0x36')])};var _0x4c6ae8={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x2628('0x14')]('{TENANT_ID}',_0xc809a5[_0x2628('0x16')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2f8ef2,'json':!![]};return rp(_0x4c6ae8);})[_0x2628('0x35')](function(_0x3bed3e){_0x4d68da['data5']=_0x3bed3e[_0x2628('0x3c')];_0x4d68da[_0x2628('0x3a')]=_0x3bed3e[_0x2628('0x39')];return db[_0x2628('0x37')][_0x2628('0x3d')]({'data5':_0x4d68da[_0x2628('0x3e')],'data6':_0x4d68da['data6']},{'where':{'id':_0x4d68da['id']}});})[_0x2628('0x35')](function(){return _0x4d68da;})[_0x2628('0x3f')](function(_0x12342a){logger[_0x2628('0x40')](_0x2628('0x41'),_0x4d68da['id'],_0x12342a);});}function getOauth2MicrosoftAccessToken(_0x13e4e0,_0x1cff34){var _0x2961a5={'grant_type':_0x2628('0x42'),'code':_0x13e4e0,'scope':getAccessTokenScope(_0x1cff34),'redirect_uri':_0x1cff34[_0x2628('0x20')],'client_id':_0x1cff34['data1'],'client_secret':encryptor[_0x2628('0x3b')](_0x1cff34[_0x2628('0x36')])};var _0x3f7256={'method':_0x2628('0x43'),'uri':MICROSOFT_AUTH_URL[_0x2628('0x14')](_0x2628('0x15'),_0x1cff34[_0x2628('0x16')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2961a5,'json':!![]};return rp(_0x3f7256);}function startRefreshInterval(_0x5ac17c){var _0x581323=schedule['intervals'];if(_0x581323[_0x5ac17c['id']])clearInterval(_0x581323[_0x5ac17c['id']]);_0x581323[_0x5ac17c['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x2628('0x44')](this,{'id':_0x5ac17c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x2628('0x45')]=_0x581323;}function startAllRefreshIntervals(){return db[_0x2628('0x37')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x2628('0x35')](function(_0x5bc95a){var _0x8cc441=_0x5bc95a[_0x2628('0x46')](function(_0x56929a){return refreshOauth2MicrosoftAccessToken(_0x56929a)['then'](function(_0x3c0844){startRefreshInterval(_0x3c0844);});});return Promise[_0x2628('0x47')](_0x8cc441);})[_0x2628('0x3f')](function(_0x21dfb2){var _0x14070e=_0x21dfb2?util[_0x2628('0x48')](_0x21dfb2,{'showHidden':![],'depth':null}):'';logger[_0x2628('0x40')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x14070e);});}module[_0x2628('0x49')]={'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 af5fe15..9153304 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 _0x30fc=['CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x572b6c,_0x123973){var _0xe0d4cd=function(_0x274504){while(--_0x274504){_0x572b6c['push'](_0x572b6c['shift']());}};_0xe0d4cd(++_0x123973);}(_0x30fc,0x64));var _0xc30f=function(_0x185605,_0x24d5f0){_0x185605=_0x185605-0x0;var _0xf35638=_0x30fc[_0x185605];return _0xf35638;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var moment=require('moment');var BPromise=require(_0xc30f('0x2'));var rs=require(_0xc30f('0x3'));var fs=require('fs');var Redis=require(_0xc30f('0x4'));var db=require(_0xc30f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc30f('0x6'))(_0xc30f('0x7'));var config=require(_0xc30f('0x8'));var jayson=require(_0xc30f('0x9'));var client=jayson[_0xc30f('0xa')][_0xc30f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c174,_0x23528c,_0x325a64){return new BPromise(function(_0x33a769,_0x3d2167){return client[_0xc30f('0xc')](_0x54c174,_0x325a64)[_0xc30f('0xd')](function(_0x436059){logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,'request\x20sent');logger[_0xc30f('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x23528c,_0xc30f('0x11'),JSON[_0xc30f('0x12')](_0x436059));if(_0x436059[_0xc30f('0x13')]){if(_0x436059[_0xc30f('0x13')][_0xc30f('0x14')]===0x1f4){logger[_0xc30f('0x13')]('CloudProvider,\x20%s,\x20%s',_0x23528c,_0x436059['error'][_0xc30f('0x15')]);return _0x3d2167(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}logger[_0xc30f('0x13')]('CloudProvider,\x20%s,\x20%s',_0x23528c,_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);return _0x33a769(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}else{logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,_0xc30f('0x11'));_0x33a769(_0x436059['result']['message']);}})[_0xc30f('0x16')](function(_0x1b02c5){logger[_0xc30f('0x13')](_0xc30f('0xf'),_0x23528c,_0x1b02c5);_0x3d2167(_0x1b02c5);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x794f5b,_0x55a44e){var _0x5043e3=function(_0x4a3aa8){while(--_0x4a3aa8){_0x794f5b['push'](_0x794f5b['shift']());}};_0x5043e3(++_0x55a44e);}(_0xd943,0x15d));var _0x3d94=function(_0xa25f2a,_0x46fd07){_0xa25f2a=_0xa25f2a-0x0;var _0x5d3653=_0xd943[_0xa25f2a];return _0x5d3653;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('CloudProvider,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index dc0a337..36bb760 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(_0x1221d4,_0x3f5657){var _0x198009=function(_0x583726){while(--_0x583726){_0x1221d4['push'](_0x1221d4['shift']());}};_0x198009(++_0x3f5657);}(_0x2ef3,0xba));var _0x32ef=function(_0x309e63,_0x18b56f){_0x309e63=_0x309e63-0x0;var _0x492eeb=_0x2ef3[_0x309e63];return _0x492eeb;};'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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x1261,0x144));var _0x1126=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x1261[_0x3b150c];return _0x5cd414;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 08f272d..25943f9 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 _0x183e=['sequelize','exports','STRING','name'];(function(_0x7c54df,_0x174de8){var _0x1f883f=function(_0x3b996a){while(--_0x3b996a){_0x7c54df['push'](_0x7c54df['shift']());}};_0x1f883f(++_0x174de8);}(_0x183e,0xfc));var _0xe183=function(_0xa1397f,_0x4d102c){_0xa1397f=_0xa1397f-0x0;var _0x38313c=_0x183e[_0xa1397f];return _0x38313c;};'use strict';var Sequelize=require(_0xe183('0x0'));module[_0xe183('0x1')]={'name':{'type':Sequelize[_0xe183('0x2')],'unique':_0xe183('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe183('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe183('0x2')]},'fax':{'type':Sequelize[_0xe183('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xe183('0x2')]},'city':{'type':Sequelize[_0xe183('0x2')]},'country':{'type':Sequelize[_0xe183('0x2')]},'email':{'type':Sequelize[_0xe183('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe183('0x2')]},'sStreet':{'type':Sequelize[_0xe183('0x2')]},'sPostalCode':{'type':Sequelize[_0xe183('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xe183('0x2')]},'description':{'type':Sequelize[_0xe183('0x2')]}}; \ No newline at end of file +var _0xfa20=['name','sequelize','exports','STRING'];(function(_0xbeeda0,_0x509824){var _0x2930fa=function(_0x3d9141){while(--_0x3d9141){_0xbeeda0['push'](_0xbeeda0['shift']());}};_0x2930fa(++_0x509824);}(_0xfa20,0x1d9));var _0x0fa2=function(_0x845fcc,_0x518cfb){_0x845fcc=_0x845fcc-0x0;var _0x3a0e79=_0xfa20[_0x845fcc];return _0x3a0e79;};'use strict';var Sequelize=require(_0x0fa2('0x0'));module[_0x0fa2('0x1')]={'name':{'type':Sequelize[_0x0fa2('0x2')],'unique':_0x0fa2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x0fa2('0x2')]},'website':{'type':Sequelize[_0x0fa2('0x2')]},'phone':{'type':Sequelize[_0x0fa2('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x0fa2('0x2')]},'postalCode':{'type':Sequelize[_0x0fa2('0x2')]},'city':{'type':Sequelize[_0x0fa2('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0fa2('0x2')]},'sStreet':{'type':Sequelize[_0x0fa2('0x2')]},'sPostalCode':{'type':Sequelize[_0x0fa2('0x2')]},'sCity':{'type':Sequelize[_0x0fa2('0x2')]},'sCountry':{'type':Sequelize[_0x0fa2('0x2')]},'description':{'type':Sequelize[_0x0fa2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 31ea308..bd70ba8 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 _0x3a3c=['where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','error','body','addContacts','CmContact','omit','ids','getContacts','rawAttributes','map','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x37a03b,_0x36eead){var _0x1e534b=function(_0x2f5b4a){while(--_0x2f5b4a){_0x37a03b['push'](_0x37a03b['shift']());}};_0x1e534b(++_0x36eead);}(_0x3a3c,0x1c7));var _0xc3a3=function(_0x2b4f11,_0x38e2de){_0x2b4f11=_0x2b4f11-0x0;var _0x32324d=_0x3a3c[_0x2b4f11];return _0x32324d;};'use strict';var emlformat=require(_0xc3a3('0x0'));var rimraf=require(_0xc3a3('0x1'));var zipdir=require(_0xc3a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3a3('0x3'));var moment=require(_0xc3a3('0x4'));var BPromise=require(_0xc3a3('0x5'));var Mustache=require('mustache');var util=require(_0xc3a3('0x6'));var path=require(_0xc3a3('0x7'));var sox=require(_0xc3a3('0x8'));var csv=require(_0xc3a3('0x9'));var ejs=require(_0xc3a3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3a3('0xb'));var squel=require(_0xc3a3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc3a3('0xd'));var toCsv=require(_0xc3a3('0x9'));var querystring=require(_0xc3a3('0xe'));var Papa=require(_0xc3a3('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3a3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3a3('0x11'));var logger=require(_0xc3a3('0x12'))(_0xc3a3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc3a3('0x14'));var db=require(_0xc3a3('0x15'))['db'];function respondWithStatusCode(_0x225121,_0x162181){_0x162181=_0x162181||0xcc;return function(_0x6a1e9e){if(_0x6a1e9e){return _0x225121[_0xc3a3('0x16')](_0x162181);}return _0x225121[_0xc3a3('0x17')](_0x162181)[_0xc3a3('0x18')]();};}function respondWithResult(_0x41fd63,_0xa502d0){_0xa502d0=_0xa502d0||0xc8;return function(_0x5cd4b1){if(_0x5cd4b1){return _0x41fd63[_0xc3a3('0x17')](_0xa502d0)[_0xc3a3('0x19')](_0x5cd4b1);}};}function respondWithFilteredResult(_0x3cf612,_0x39bfdc){return function(_0x3e86be){if(_0x3e86be){var _0x1ffd83=typeof _0x39bfdc[_0xc3a3('0x1a')]===_0xc3a3('0x1b')&&typeof _0x39bfdc[_0xc3a3('0x1c')]===_0xc3a3('0x1b');var _0x57417b=_0x3e86be[_0xc3a3('0x1d')];var _0x12aa44=_0x1ffd83?0x0:_0x39bfdc[_0xc3a3('0x1a')];var _0x162bcb=_0x1ffd83?_0x3e86be[_0xc3a3('0x1d')]:_0x39bfdc['offset']+_0x39bfdc[_0xc3a3('0x1c')];var _0x53fdbb;if(_0x162bcb>=_0x57417b){_0x162bcb=_0x57417b;_0x53fdbb=0xc8;}else{_0x53fdbb=0xce;}_0x3cf612[_0xc3a3('0x17')](_0x53fdbb);return _0x3cf612['set'](_0xc3a3('0x1e'),_0x12aa44+'-'+_0x162bcb+'/'+_0x57417b)[_0xc3a3('0x19')](_0x3e86be);}return null;};}function patchUpdates(_0x15a5fa){return function(_0x221fa8){try{jsonpatch[_0xc3a3('0x1f')](_0x221fa8,_0x15a5fa,!![]);}catch(_0x974bbd){return BPromise[_0xc3a3('0x20')](_0x974bbd);}return _0x221fa8['save']();};}function saveUpdates(_0x4bb8f0,_0x40fb4c){return function(_0x2d4538){if(_0x2d4538){return _0x2d4538[_0xc3a3('0x21')](_0x4bb8f0)['then'](function(_0x1de3bf){return _0x1de3bf;});}return null;};}function removeEntity(_0x48336b,_0x37a2ec){return function(_0x1854b1){if(_0x1854b1){return _0x1854b1[_0xc3a3('0x22')]()[_0xc3a3('0x23')](function(){var _0x37cf31=_0x1854b1['get']({'plain':!![]});var _0x2cccc8=_0xc3a3('0x24');return db[_0xc3a3('0x25')][_0xc3a3('0x22')]({'where':{'type':_0x2cccc8,'resourceId':_0x37cf31['id']}})['then'](function(){return _0x1854b1;});})[_0xc3a3('0x23')](function(){_0x48336b[_0xc3a3('0x17')](0xcc)[_0xc3a3('0x18')]();});}};}function handleEntityNotFound(_0x1f47e9,_0x4a4e58){return function(_0x2da3ad){if(!_0x2da3ad){_0x1f47e9[_0xc3a3('0x16')](0x194);}return _0x2da3ad;};}function handleError(_0x337ba2,_0x4d3f23){_0x4d3f23=_0x4d3f23||0x1f4;return function(_0x281ff8){logger['error'](_0x281ff8[_0xc3a3('0x26')]);if(_0x281ff8[_0xc3a3('0x27')]){delete _0x281ff8[_0xc3a3('0x27')];}_0x337ba2[_0xc3a3('0x17')](_0x4d3f23)[_0xc3a3('0x28')](_0x281ff8);};}exports[_0xc3a3('0x29')]=function(_0x3db768,_0x3d1092){var _0x1a4241={},_0x2e3639={},_0x263540={'count':0x0,'rows':[]};return db[_0xc3a3('0x2a')][_0xc3a3('0x2b')]()['then'](function(_0x2ff47e){_0x2e3639[_0xc3a3('0x2c')]=_[_0xc3a3('0x2d')](_0x2ff47e);_0x2e3639[_0xc3a3('0x2e')]=_[_0xc3a3('0x2d')](_0x3db768[_0xc3a3('0x2e')]);_0x2e3639[_0xc3a3('0x2f')]=_[_0xc3a3('0x30')](_0x2e3639[_0xc3a3('0x2c')],_0x2e3639[_0xc3a3('0x2e')]);_0x1a4241[_0xc3a3('0x31')]=_['intersection'](_0x2e3639[_0xc3a3('0x2c')],qs[_0xc3a3('0x32')](_0x3db768[_0xc3a3('0x2e')][_0xc3a3('0x32')]));_0x1a4241['attributes']=_0x1a4241['attributes'][_0xc3a3('0x33')]?_0x1a4241['attributes']:_0x2e3639[_0xc3a3('0x2c')];if(!_0x3db768['query'][_0xc3a3('0x34')]('nolimit')){_0x1a4241['limit']=qs['limit'](_0x3db768[_0xc3a3('0x2e')][_0xc3a3('0x1c')]);_0x1a4241[_0xc3a3('0x1a')]=qs[_0xc3a3('0x1a')](_0x3db768[_0xc3a3('0x2e')][_0xc3a3('0x1a')]);}_0x1a4241[_0xc3a3('0x35')]=qs[_0xc3a3('0x36')](_0x3db768[_0xc3a3('0x2e')]['sort']);_0x1a4241[_0xc3a3('0x37')]=qs[_0xc3a3('0x2f')](_[_0xc3a3('0x38')](_0x3db768[_0xc3a3('0x2e')],_0x2e3639[_0xc3a3('0x2f')]),_0x2ff47e);if(_0x3db768[_0xc3a3('0x2e')][_0xc3a3('0x39')]){_0x1a4241[_0xc3a3('0x37')]=_[_0xc3a3('0x3a')](_0x1a4241[_0xc3a3('0x37')],{'$or':_['map'](_0x1a4241[_0xc3a3('0x31')],function(_0x183036){var _0x3c5a64={};_0x3c5a64[_0x183036]={'$like':'%'+_0x3db768[_0xc3a3('0x2e')]['filter']+'%'};return _0x3c5a64;})});}_0x1a4241=_[_0xc3a3('0x3a')]({},_0x1a4241,_0x3db768[_0xc3a3('0x3b')]);var _0x5bfdd6={'where':_0x1a4241['where']};return db[_0xc3a3('0x2a')][_0xc3a3('0x1d')](_0x5bfdd6)[_0xc3a3('0x23')](function(_0x11f928){_0x263540[_0xc3a3('0x1d')]=_0x11f928;if(_0x3db768[_0xc3a3('0x2e')][_0xc3a3('0x3c')]){_0x1a4241[_0xc3a3('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xc3a3('0x3e')](_0x1a4241);})[_0xc3a3('0x23')](function(_0x337b26){_0x263540[_0xc3a3('0x3f')]=_0x337b26;return _0x263540;})[_0xc3a3('0x23')](respondWithFilteredResult(_0x3d1092,_0x1a4241))[_0xc3a3('0x40')](handleError(_0x3d1092,null));})['catch'](handleError(_0x3d1092,null));};exports[_0xc3a3('0x41')]=function(_0x154eb3,_0x3f730c){var _0xd4a315={'raw':![],'where':{'id':_0x154eb3[_0xc3a3('0x42')]['id']}},_0x452680={};_0x452680[_0xc3a3('0x2c')]=_[_0xc3a3('0x2d')](db[_0xc3a3('0x2a')]['rawAttributes']);_0x452680[_0xc3a3('0x2e')]=_[_0xc3a3('0x2d')](_0x154eb3[_0xc3a3('0x2e')]);_0x452680[_0xc3a3('0x2f')]=_['intersection'](_0x452680[_0xc3a3('0x2c')],_0x452680['query']);_0xd4a315['attributes']=_['intersection'](_0x452680[_0xc3a3('0x2c')],qs[_0xc3a3('0x32')](_0x154eb3['query']['fields']));_0xd4a315['attributes']=_0xd4a315[_0xc3a3('0x31')][_0xc3a3('0x33')]?_0xd4a315['attributes']:_0x452680['model'];if(_0x154eb3[_0xc3a3('0x2e')][_0xc3a3('0x3c')]){_0xd4a315[_0xc3a3('0x3d')]=[{'all':!![]}];}_0xd4a315=_[_0xc3a3('0x3a')]({},_0xd4a315,_0x154eb3['options']);return db[_0xc3a3('0x2a')]['find'](_0xd4a315)[_0xc3a3('0x23')](handleEntityNotFound(_0x3f730c,null))[_0xc3a3('0x23')](respondWithResult(_0x3f730c,null))[_0xc3a3('0x40')](handleError(_0x3f730c,null));};exports[_0xc3a3('0x43')]=function(_0x2e95ab,_0x20334c){return db[_0xc3a3('0x2a')][_0xc3a3('0x43')](_0x2e95ab['body'],{})[_0xc3a3('0x23')](function(_0x4d25bb){var _0x1ea2d0=_0x2e95ab[_0xc3a3('0x44')]['get']({'plain':!![]});if(!_0x1ea2d0)throw new Error(_0xc3a3('0x45'));if(_0x1ea2d0[_0xc3a3('0x46')]==='user'){var _0x374117=_0x4d25bb[_0xc3a3('0x47')]({'plain':!![]});var _0x4118ed=_0xc3a3('0x24');return db['UserProfileSection'][_0xc3a3('0x48')]({'where':{'name':_0x4118ed,'userProfileId':_0x1ea2d0[_0xc3a3('0x49')]},'raw':!![]})[_0xc3a3('0x23')](function(_0x4c6a83){if(_0x4c6a83&&_0x4c6a83[_0xc3a3('0x4a')]===0x0){return db[_0xc3a3('0x25')][_0xc3a3('0x43')]({'name':_0x374117[_0xc3a3('0x27')],'resourceId':_0x374117['id'],'type':_0x4c6a83[_0xc3a3('0x27')],'sectionId':_0x4c6a83['id']},{})[_0xc3a3('0x23')](function(){return _0x4d25bb;});}else{return _0x4d25bb;}})[_0xc3a3('0x40')](function(_0x4e08a5){logger[_0xc3a3('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e08a5);throw _0x4e08a5;});}return _0x4d25bb;})[_0xc3a3('0x23')](respondWithResult(_0x20334c,0xc9))[_0xc3a3('0x40')](handleError(_0x20334c,null));};exports['update']=function(_0x265f12,_0x51af1c){if(_0x265f12['body']['id']){delete _0x265f12[_0xc3a3('0x4c')]['id'];}return db[_0xc3a3('0x2a')]['find']({'where':{'id':_0x265f12[_0xc3a3('0x42')]['id']}})['then'](handleEntityNotFound(_0x51af1c,null))[_0xc3a3('0x23')](saveUpdates(_0x265f12[_0xc3a3('0x4c')],null))[_0xc3a3('0x23')](respondWithResult(_0x51af1c,null))[_0xc3a3('0x40')](handleError(_0x51af1c,null));};exports[_0xc3a3('0x22')]=function(_0x50c935,_0x89ec89){return db[_0xc3a3('0x2a')][_0xc3a3('0x48')]({'where':{'id':_0x50c935['params']['id']}})[_0xc3a3('0x23')](handleEntityNotFound(_0x89ec89,null))['then'](removeEntity(_0x89ec89,null))['catch'](handleError(_0x89ec89,null));};exports[_0xc3a3('0x2b')]=function(_0x4c5bba,_0x2b8bff){return db['CmCompany'][_0xc3a3('0x2b')]()[_0xc3a3('0x23')](respondWithResult(_0x2b8bff,null))['catch'](handleError(_0x2b8bff,null));};exports[_0xc3a3('0x4d')]=function(_0x3f405e,_0x392173,_0x41bc97){return db[_0xc3a3('0x4e')]['find']({'where':{'id':_0x3f405e[_0xc3a3('0x42')]['id']}})[_0xc3a3('0x23')](handleEntityNotFound(_0x392173,null))['then'](function(_0x4eaa96){if(_0x4eaa96){return _0x4eaa96[_0xc3a3('0x4d')](_0x3f405e['body']['ids'],_[_0xc3a3('0x4f')](_0x3f405e[_0xc3a3('0x4c')],[_0xc3a3('0x50'),'id'])||{});}})[_0xc3a3('0x23')](respondWithResult(_0x392173,null))['catch'](handleError(_0x392173,null));};exports[_0xc3a3('0x51')]=function(_0x5eb8c9,_0x12a962,_0xedab3c){var _0x23534c={};var _0x59a47d={};var _0x2039be;var _0x550b84;return db['CmCompany']['findOne']({'where':{'id':_0x5eb8c9['params']['id']}})[_0xc3a3('0x23')](handleEntityNotFound(_0x12a962,null))[_0xc3a3('0x23')](function(_0x29df62){if(_0x29df62){_0x2039be=_0x29df62;_0x59a47d[_0xc3a3('0x2c')]=_['keys'](db[_0xc3a3('0x4e')][_0xc3a3('0x52')]);_0x59a47d[_0xc3a3('0x2e')]=_[_0xc3a3('0x2d')](_0x5eb8c9[_0xc3a3('0x2e')]);_0x59a47d[_0xc3a3('0x2f')]=_[_0xc3a3('0x30')](_0x59a47d[_0xc3a3('0x2c')],_0x59a47d['query']);_0x23534c[_0xc3a3('0x31')]=_[_0xc3a3('0x30')](_0x59a47d[_0xc3a3('0x2c')],qs[_0xc3a3('0x32')](_0x5eb8c9['query']['fields']));_0x23534c[_0xc3a3('0x31')]=_0x23534c[_0xc3a3('0x31')][_0xc3a3('0x33')]?_0x23534c['attributes']:_0x59a47d[_0xc3a3('0x2c')];_0x23534c[_0xc3a3('0x35')]=qs[_0xc3a3('0x36')](_0x5eb8c9[_0xc3a3('0x2e')]['sort']);_0x23534c['where']=qs[_0xc3a3('0x2f')](_['pick'](_0x5eb8c9[_0xc3a3('0x2e')],_0x59a47d[_0xc3a3('0x2f')]));if(_0x5eb8c9[_0xc3a3('0x2e')]['filter']){_0x23534c['where']=_['merge'](_0x23534c['where'],{'$or':_[_0xc3a3('0x53')](_0x23534c[_0xc3a3('0x31')],function(_0x245041){var _0x3bd473={};_0x3bd473[_0x245041]={'$like':'%'+_0x5eb8c9[_0xc3a3('0x2e')][_0xc3a3('0x39')]+'%'};return _0x3bd473;})});}_0x23534c=_[_0xc3a3('0x3a')]({},_0x23534c,_0x5eb8c9[_0xc3a3('0x3b')]);return _0x2039be['getContacts'](_0x23534c);}})[_0xc3a3('0x23')](function(_0x4b9707){if(_0x4b9707){_0x550b84=_0x4b9707[_0xc3a3('0x33')];if(!_0x5eb8c9[_0xc3a3('0x2e')][_0xc3a3('0x34')](_0xc3a3('0x54'))){_0x23534c[_0xc3a3('0x1c')]=qs[_0xc3a3('0x1c')](_0x5eb8c9[_0xc3a3('0x2e')][_0xc3a3('0x1c')]);_0x23534c[_0xc3a3('0x1a')]=qs['offset'](_0x5eb8c9[_0xc3a3('0x2e')][_0xc3a3('0x1a')]);}return _0x2039be[_0xc3a3('0x51')](_0x23534c);}})[_0xc3a3('0x23')](function(_0x4b20b6){if(_0x4b20b6){return _0x4b20b6?{'count':_0x550b84,'rows':_0x4b20b6}:null;}})[_0xc3a3('0x23')](respondWithResult(_0x12a962,null))[_0xc3a3('0x40')](handleError(_0x12a962,null));}; \ No newline at end of file +var _0xd05c=['zip-dir','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','Companies','UserProfileResource','sendStatus','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','map','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','addContacts','CmContact','ids','omit','getContacts','hasOwnProperty','eml-format'];(function(_0x381f31,_0x2f2e39){var _0x7659e=function(_0x464220){while(--_0x464220){_0x381f31['push'](_0x381f31['shift']());}};_0x7659e(++_0x2f2e39);}(_0xd05c,0x1d9));var _0xcd05=function(_0x40eba2,_0x3466a3){_0x40eba2=_0x40eba2-0x0;var _0x366b17=_0xd05c[_0x40eba2];return _0x366b17;};'use strict';var emlformat=require(_0xcd05('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd05('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd05('0x2'));var moment=require('moment');var BPromise=require(_0xcd05('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcd05('0x4'));var sox=require(_0xcd05('0x5'));var csv=require('to-csv');var ejs=require(_0xcd05('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd05('0x7'));var squel=require(_0xcd05('0x8'));var crypto=require(_0xcd05('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcd05('0xa'));var querystring=require(_0xcd05('0xb'));var Papa=require(_0xcd05('0xc'));var Redis=require('ioredis');var authService=require(_0xcd05('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcd05('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd05('0xf'))('api');var utils=require(_0xcd05('0x10'));var config=require(_0xcd05('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53d719,_0x9256f8){_0x9256f8=_0x9256f8||0xcc;return function(_0x579c77){if(_0x579c77){return _0x53d719['sendStatus'](_0x9256f8);}return _0x53d719[_0xcd05('0x12')](_0x9256f8)[_0xcd05('0x13')]();};}function respondWithResult(_0x37d724,_0x470877){_0x470877=_0x470877||0xc8;return function(_0x1355bb){if(_0x1355bb){return _0x37d724[_0xcd05('0x12')](_0x470877)['json'](_0x1355bb);}};}function respondWithFilteredResult(_0x3c5db2,_0x8c29c2){return function(_0x4528fc){if(_0x4528fc){var _0xdee2be=typeof _0x8c29c2[_0xcd05('0x14')]===_0xcd05('0x15')&&typeof _0x8c29c2[_0xcd05('0x16')]===_0xcd05('0x15');var _0x3c0274=_0x4528fc[_0xcd05('0x17')];var _0x57a537=_0xdee2be?0x0:_0x8c29c2[_0xcd05('0x14')];var _0x285633=_0xdee2be?_0x4528fc[_0xcd05('0x17')]:_0x8c29c2[_0xcd05('0x14')]+_0x8c29c2[_0xcd05('0x16')];var _0x330368;if(_0x285633>=_0x3c0274){_0x285633=_0x3c0274;_0x330368=0xc8;}else{_0x330368=0xce;}_0x3c5db2[_0xcd05('0x12')](_0x330368);return _0x3c5db2[_0xcd05('0x18')](_0xcd05('0x19'),_0x57a537+'-'+_0x285633+'/'+_0x3c0274)[_0xcd05('0x1a')](_0x4528fc);}return null;};}function patchUpdates(_0x1046d5){return function(_0x17152e){try{jsonpatch['apply'](_0x17152e,_0x1046d5,!![]);}catch(_0x3d0381){return BPromise[_0xcd05('0x1b')](_0x3d0381);}return _0x17152e[_0xcd05('0x1c')]();};}function saveUpdates(_0x15cf48,_0x53124f){return function(_0x10ab2d){if(_0x10ab2d){return _0x10ab2d[_0xcd05('0x1d')](_0x15cf48)[_0xcd05('0x1e')](function(_0x277669){return _0x277669;});}return null;};}function removeEntity(_0xa59826,_0x2fe90a){return function(_0x289549){if(_0x289549){return _0x289549[_0xcd05('0x1f')]()['then'](function(){var _0x465e82=_0x289549['get']({'plain':!![]});var _0x439d36=_0xcd05('0x20');return db[_0xcd05('0x21')][_0xcd05('0x1f')]({'where':{'type':_0x439d36,'resourceId':_0x465e82['id']}})[_0xcd05('0x1e')](function(){return _0x289549;});})[_0xcd05('0x1e')](function(){_0xa59826[_0xcd05('0x12')](0xcc)[_0xcd05('0x13')]();});}};}function handleEntityNotFound(_0x1ee899,_0xf11307){return function(_0x467543){if(!_0x467543){_0x1ee899[_0xcd05('0x22')](0x194);}return _0x467543;};}function handleError(_0xd5e33f,_0x495427){_0x495427=_0x495427||0x1f4;return function(_0x5becd8){logger[_0xcd05('0x23')](_0x5becd8[_0xcd05('0x24')]);if(_0x5becd8[_0xcd05('0x25')]){delete _0x5becd8[_0xcd05('0x25')];}_0xd5e33f['status'](_0x495427)['send'](_0x5becd8);};}exports[_0xcd05('0x26')]=function(_0x33ceb6,_0x2a825c){var _0x36e63c={},_0x5a41e0={},_0x422012={'count':0x0,'rows':[]};return db[_0xcd05('0x27')][_0xcd05('0x28')]()[_0xcd05('0x1e')](function(_0x3ce5f4){_0x5a41e0[_0xcd05('0x29')]=_[_0xcd05('0x2a')](_0x3ce5f4);_0x5a41e0[_0xcd05('0x2b')]=_['keys'](_0x33ceb6['query']);_0x5a41e0[_0xcd05('0x2c')]=_[_0xcd05('0x2d')](_0x5a41e0[_0xcd05('0x29')],_0x5a41e0[_0xcd05('0x2b')]);_0x36e63c['attributes']=_[_0xcd05('0x2d')](_0x5a41e0[_0xcd05('0x29')],qs[_0xcd05('0x2e')](_0x33ceb6['query']['fields']));_0x36e63c[_0xcd05('0x2f')]=_0x36e63c[_0xcd05('0x2f')][_0xcd05('0x30')]?_0x36e63c[_0xcd05('0x2f')]:_0x5a41e0[_0xcd05('0x29')];if(!_0x33ceb6['query']['hasOwnProperty'](_0xcd05('0x31'))){_0x36e63c[_0xcd05('0x16')]=qs[_0xcd05('0x16')](_0x33ceb6[_0xcd05('0x2b')][_0xcd05('0x16')]);_0x36e63c['offset']=qs[_0xcd05('0x14')](_0x33ceb6[_0xcd05('0x2b')][_0xcd05('0x14')]);}_0x36e63c[_0xcd05('0x32')]=qs[_0xcd05('0x33')](_0x33ceb6[_0xcd05('0x2b')][_0xcd05('0x33')]);_0x36e63c['where']=qs['filters'](_[_0xcd05('0x34')](_0x33ceb6['query'],_0x5a41e0[_0xcd05('0x2c')]),_0x3ce5f4);if(_0x33ceb6[_0xcd05('0x2b')]['filter']){_0x36e63c[_0xcd05('0x35')]=_[_0xcd05('0x36')](_0x36e63c[_0xcd05('0x35')],{'$or':_[_0xcd05('0x37')](_0x36e63c[_0xcd05('0x2f')],function(_0x261057){var _0x5ee838={};_0x5ee838[_0x261057]={'$like':'%'+_0x33ceb6[_0xcd05('0x2b')][_0xcd05('0x38')]+'%'};return _0x5ee838;})});}_0x36e63c=_['merge']({},_0x36e63c,_0x33ceb6[_0xcd05('0x39')]);var _0x4369a4={'where':_0x36e63c[_0xcd05('0x35')]};return db[_0xcd05('0x27')][_0xcd05('0x17')](_0x4369a4)['then'](function(_0x29b4aa){_0x422012['count']=_0x29b4aa;if(_0x33ceb6[_0xcd05('0x2b')][_0xcd05('0x3a')]){_0x36e63c[_0xcd05('0x3b')]=[{'all':!![]}];}return db[_0xcd05('0x27')][_0xcd05('0x3c')](_0x36e63c);})[_0xcd05('0x1e')](function(_0x13763c){_0x422012[_0xcd05('0x3d')]=_0x13763c;return _0x422012;})[_0xcd05('0x1e')](respondWithFilteredResult(_0x2a825c,_0x36e63c))[_0xcd05('0x3e')](handleError(_0x2a825c,null));})[_0xcd05('0x3e')](handleError(_0x2a825c,null));};exports['show']=function(_0x533bb2,_0x3531c2){var _0x1bd55e={'raw':![],'where':{'id':_0x533bb2[_0xcd05('0x3f')]['id']}},_0x58fd62={};_0x58fd62[_0xcd05('0x29')]=_[_0xcd05('0x2a')](db['CmCompany'][_0xcd05('0x40')]);_0x58fd62[_0xcd05('0x2b')]=_['keys'](_0x533bb2['query']);_0x58fd62[_0xcd05('0x2c')]=_[_0xcd05('0x2d')](_0x58fd62['model'],_0x58fd62['query']);_0x1bd55e[_0xcd05('0x2f')]=_[_0xcd05('0x2d')](_0x58fd62['model'],qs[_0xcd05('0x2e')](_0x533bb2['query'][_0xcd05('0x2e')]));_0x1bd55e[_0xcd05('0x2f')]=_0x1bd55e[_0xcd05('0x2f')][_0xcd05('0x30')]?_0x1bd55e[_0xcd05('0x2f')]:_0x58fd62[_0xcd05('0x29')];if(_0x533bb2[_0xcd05('0x2b')][_0xcd05('0x3a')]){_0x1bd55e[_0xcd05('0x3b')]=[{'all':!![]}];}_0x1bd55e=_[_0xcd05('0x36')]({},_0x1bd55e,_0x533bb2[_0xcd05('0x39')]);return db['CmCompany'][_0xcd05('0x41')](_0x1bd55e)['then'](handleEntityNotFound(_0x3531c2,null))['then'](respondWithResult(_0x3531c2,null))[_0xcd05('0x3e')](handleError(_0x3531c2,null));};exports[_0xcd05('0x42')]=function(_0xb8cc7e,_0x8433ed){return db['CmCompany'][_0xcd05('0x42')](_0xb8cc7e['body'],{})['then'](function(_0x3a6e04){var _0x1e0fc4=_0xb8cc7e['user'][_0xcd05('0x43')]({'plain':!![]});if(!_0x1e0fc4)throw new Error(_0xcd05('0x44'));if(_0x1e0fc4[_0xcd05('0x45')]==='user'){var _0x4be713=_0x3a6e04[_0xcd05('0x43')]({'plain':!![]});var _0x3cb93a='Companies';return db[_0xcd05('0x46')][_0xcd05('0x41')]({'where':{'name':_0x3cb93a,'userProfileId':_0x1e0fc4['userProfileId']},'raw':!![]})[_0xcd05('0x1e')](function(_0x21a073){if(_0x21a073&&_0x21a073[_0xcd05('0x47')]===0x0){return db[_0xcd05('0x21')][_0xcd05('0x42')]({'name':_0x4be713[_0xcd05('0x25')],'resourceId':_0x4be713['id'],'type':_0x21a073['name'],'sectionId':_0x21a073['id']},{})[_0xcd05('0x1e')](function(){return _0x3a6e04;});}else{return _0x3a6e04;}})['catch'](function(_0x8cbbf1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8cbbf1);throw _0x8cbbf1;});}return _0x3a6e04;})[_0xcd05('0x1e')](respondWithResult(_0x8433ed,0xc9))[_0xcd05('0x3e')](handleError(_0x8433ed,null));};exports['update']=function(_0x5606a2,_0x210ff3){if(_0x5606a2['body']['id']){delete _0x5606a2['body']['id'];}return db['CmCompany'][_0xcd05('0x41')]({'where':{'id':_0x5606a2[_0xcd05('0x3f')]['id']}})[_0xcd05('0x1e')](handleEntityNotFound(_0x210ff3,null))['then'](saveUpdates(_0x5606a2[_0xcd05('0x48')],null))[_0xcd05('0x1e')](respondWithResult(_0x210ff3,null))[_0xcd05('0x3e')](handleError(_0x210ff3,null));};exports[_0xcd05('0x1f')]=function(_0x18301a,_0x5b7d9b){return db[_0xcd05('0x27')]['find']({'where':{'id':_0x18301a[_0xcd05('0x3f')]['id']}})[_0xcd05('0x1e')](handleEntityNotFound(_0x5b7d9b,null))[_0xcd05('0x1e')](removeEntity(_0x5b7d9b,null))[_0xcd05('0x3e')](handleError(_0x5b7d9b,null));};exports['describe']=function(_0x58bf5c,_0x84624f){return db[_0xcd05('0x27')]['describe']()[_0xcd05('0x1e')](respondWithResult(_0x84624f,null))[_0xcd05('0x3e')](handleError(_0x84624f,null));};exports[_0xcd05('0x49')]=function(_0x2373e8,_0x7cab80,_0x4fd4ba){return db[_0xcd05('0x4a')][_0xcd05('0x41')]({'where':{'id':_0x2373e8[_0xcd05('0x3f')]['id']}})['then'](handleEntityNotFound(_0x7cab80,null))[_0xcd05('0x1e')](function(_0x14356f){if(_0x14356f){return _0x14356f[_0xcd05('0x49')](_0x2373e8[_0xcd05('0x48')][_0xcd05('0x4b')],_[_0xcd05('0x4c')](_0x2373e8[_0xcd05('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x7cab80,null))[_0xcd05('0x3e')](handleError(_0x7cab80,null));};exports[_0xcd05('0x4d')]=function(_0x199413,_0x38014d,_0x476ac7){var _0x57def2={};var _0x78184b={};var _0x45615b;var _0x11fb7a;return db[_0xcd05('0x27')]['findOne']({'where':{'id':_0x199413[_0xcd05('0x3f')]['id']}})[_0xcd05('0x1e')](handleEntityNotFound(_0x38014d,null))['then'](function(_0x48f7cc){if(_0x48f7cc){_0x45615b=_0x48f7cc;_0x78184b[_0xcd05('0x29')]=_['keys'](db[_0xcd05('0x4a')][_0xcd05('0x40')]);_0x78184b[_0xcd05('0x2b')]=_[_0xcd05('0x2a')](_0x199413['query']);_0x78184b[_0xcd05('0x2c')]=_[_0xcd05('0x2d')](_0x78184b[_0xcd05('0x29')],_0x78184b[_0xcd05('0x2b')]);_0x57def2[_0xcd05('0x2f')]=_[_0xcd05('0x2d')](_0x78184b[_0xcd05('0x29')],qs[_0xcd05('0x2e')](_0x199413['query'][_0xcd05('0x2e')]));_0x57def2[_0xcd05('0x2f')]=_0x57def2[_0xcd05('0x2f')]['length']?_0x57def2[_0xcd05('0x2f')]:_0x78184b[_0xcd05('0x29')];_0x57def2[_0xcd05('0x32')]=qs[_0xcd05('0x33')](_0x199413[_0xcd05('0x2b')]['sort']);_0x57def2[_0xcd05('0x35')]=qs[_0xcd05('0x2c')](_[_0xcd05('0x34')](_0x199413[_0xcd05('0x2b')],_0x78184b[_0xcd05('0x2c')]));if(_0x199413[_0xcd05('0x2b')][_0xcd05('0x38')]){_0x57def2['where']=_['merge'](_0x57def2[_0xcd05('0x35')],{'$or':_[_0xcd05('0x37')](_0x57def2[_0xcd05('0x2f')],function(_0x509e92){var _0x408237={};_0x408237[_0x509e92]={'$like':'%'+_0x199413[_0xcd05('0x2b')][_0xcd05('0x38')]+'%'};return _0x408237;})});}_0x57def2=_[_0xcd05('0x36')]({},_0x57def2,_0x199413['options']);return _0x45615b[_0xcd05('0x4d')](_0x57def2);}})['then'](function(_0x251982){if(_0x251982){_0x11fb7a=_0x251982['length'];if(!_0x199413[_0xcd05('0x2b')][_0xcd05('0x4e')]('nolimit')){_0x57def2[_0xcd05('0x16')]=qs[_0xcd05('0x16')](_0x199413[_0xcd05('0x2b')][_0xcd05('0x16')]);_0x57def2[_0xcd05('0x14')]=qs[_0xcd05('0x14')](_0x199413[_0xcd05('0x2b')][_0xcd05('0x14')]);}return _0x45615b[_0xcd05('0x4d')](_0x57def2);}})['then'](function(_0x4dd91f){if(_0x4dd91f){return _0x4dd91f?{'count':_0x11fb7a,'rows':_0x4dd91f}:null;}})[_0xcd05('0x1e')](respondWithResult(_0x38014d,null))[_0xcd05('0x3e')](handleError(_0x38014d,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 462224c..605e240 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 _0x200f=['../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3d2dbb,_0x422dc3){var _0x4b4af5=function(_0x8674b1){while(--_0x8674b1){_0x3d2dbb['push'](_0x3d2dbb['shift']());}};_0x4b4af5(++_0x422dc3);}(_0x200f,0x13d));var _0xf200=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0x200f[_0x15f3c0];return _0x1adfe0;};'use strict';var _=require(_0xf200('0x0'));var util=require(_0xf200('0x1'));var logger=require('../../config/logger')(_0xf200('0x2'));var moment=require(_0xf200('0x3'));var BPromise=require(_0xf200('0x4'));var rp=require(_0xf200('0x5'));var fs=require('fs');var path=require(_0xf200('0x6'));var rimraf=require(_0xf200('0x7'));var config=require(_0xf200('0x8'));var attributes=require('./cmCompany.attributes');module[_0xf200('0x9')]=function(_0x4c2853,_0x18c800){return _0x4c2853[_0xf200('0xa')](_0xf200('0xb'),attributes,{'tableName':_0xf200('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x035c=['api','moment','bluebird','path','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util'];(function(_0x24c2b6,_0x3d6e3c){var _0x5ad5b1=function(_0x239547){while(--_0x239547){_0x24c2b6['push'](_0x24c2b6['shift']());}};_0x5ad5b1(++_0x3d6e3c);}(_0x035c,0x106));var _0xc035=function(_0x34bbc5,_0x462e17){_0x34bbc5=_0x34bbc5-0x0;var _0x3f3db9=_0x035c[_0x34bbc5];return _0x3f3db9;};'use strict';var _=require(_0xc035('0x0'));var util=require(_0xc035('0x1'));var logger=require('../../config/logger')(_0xc035('0x2'));var moment=require(_0xc035('0x3'));var BPromise=require(_0xc035('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc035('0x5'));var rimraf=require('rimraf');var config=require(_0xc035('0x6'));var attributes=require(_0xc035('0x7'));module[_0xc035('0x8')]=function(_0x5cc23c,_0x937341){return _0x5cc23c['define'](_0xc035('0x9'),attributes,{'tableName':_0xc035('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index c6fe27b..01a4388 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 _0x3e23=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x3fd4b3,_0x17d3ef){var _0x2979a3=function(_0x4fa13c){while(--_0x4fa13c){_0x3fd4b3['push'](_0x3fd4b3['shift']());}};_0x2979a3(++_0x17d3ef);}(_0x3e23,0x194));var _0x33e2=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x3e23[_0x2d91c6];return _0x3a8d19;};'use strict';var _=require(_0x33e2('0x0'));var util=require(_0x33e2('0x1'));var moment=require(_0x33e2('0x2'));var BPromise=require(_0x33e2('0x3'));var rs=require(_0x33e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33e2('0x5'))['db'];var utils=require(_0x33e2('0x6'));var logger=require('../../config/logger')(_0x33e2('0x7'));var config=require('../../config/environment');var jayson=require(_0x33e2('0x8'));var client=jayson[_0x33e2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36d365,_0x1d1ea7,_0x885f14){return new BPromise(function(_0x1f09a5,_0x16d476){return client[_0x33e2('0xa')](_0x36d365,_0x885f14)['then'](function(_0x341e86){logger[_0x33e2('0xb')](_0x33e2('0xc'),_0x1d1ea7,_0x33e2('0xd'));logger[_0x33e2('0xe')](_0x33e2('0xf'),_0x1d1ea7,'request\x20sent',JSON[_0x33e2('0x10')](_0x341e86));if(_0x341e86[_0x33e2('0x11')]){if(_0x341e86[_0x33e2('0x11')]['code']===0x1f4){logger[_0x33e2('0x11')]('CmCompany,\x20%s,\x20%s',_0x1d1ea7,_0x341e86['error'][_0x33e2('0x12')]);return _0x16d476(_0x341e86[_0x33e2('0x11')][_0x33e2('0x12')]);}logger[_0x33e2('0x11')](_0x33e2('0xc'),_0x1d1ea7,_0x341e86[_0x33e2('0x11')]['message']);return _0x1f09a5(_0x341e86['error'][_0x33e2('0x12')]);}else{logger['info'](_0x33e2('0xc'),_0x1d1ea7,_0x33e2('0xd'));_0x1f09a5(_0x341e86[_0x33e2('0x13')][_0x33e2('0x12')]);}})[_0x33e2('0x14')](function(_0xeaf148){logger[_0x33e2('0x11')]('CmCompany,\x20%s,\x20%s',_0x1d1ea7,_0xeaf148);_0x16d476(_0xeaf148);});});} \ No newline at end of file +var _0x8b2a=['http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b2a,0xdd));var _0xa8b2=function(_0x337c33,_0x508d9a){_0x337c33=_0x337c33-0x0;var _0x23f2da=_0x8b2a[_0x337c33];return _0x23f2da;};'use strict';var _=require(_0xa8b2('0x0'));var util=require(_0xa8b2('0x1'));var moment=require(_0xa8b2('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8b2('0x3'));var fs=require('fs');var Redis=require(_0xa8b2('0x4'));var db=require(_0xa8b2('0x5'))['db'];var utils=require(_0xa8b2('0x6'));var logger=require('../../config/logger')(_0xa8b2('0x7'));var config=require(_0xa8b2('0x8'));var jayson=require(_0xa8b2('0x9'));var client=jayson['client'][_0xa8b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54863f,_0x1b7811,_0x297888){return new BPromise(function(_0x43c862,_0x442d70){return client[_0xa8b2('0xb')](_0x54863f,_0x297888)['then'](function(_0x22b715){logger[_0xa8b2('0xc')](_0xa8b2('0xd'),_0x1b7811,_0xa8b2('0xe'));logger[_0xa8b2('0xf')](_0xa8b2('0x10'),_0x1b7811,'request\x20sent',JSON[_0xa8b2('0x11')](_0x22b715));if(_0x22b715[_0xa8b2('0x12')]){if(_0x22b715['error']['code']===0x1f4){logger[_0xa8b2('0x12')]('CmCompany,\x20%s,\x20%s',_0x1b7811,_0x22b715[_0xa8b2('0x12')][_0xa8b2('0x13')]);return _0x442d70(_0x22b715['error'][_0xa8b2('0x13')]);}logger[_0xa8b2('0x12')](_0xa8b2('0xd'),_0x1b7811,_0x22b715[_0xa8b2('0x12')][_0xa8b2('0x13')]);return _0x43c862(_0x22b715[_0xa8b2('0x12')][_0xa8b2('0x13')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x1b7811,_0xa8b2('0xe'));_0x43c862(_0x22b715['result']['message']);}})[_0xa8b2('0x14')](function(_0x19e4e7){logger[_0xa8b2('0x12')]('CmCompany,\x20%s,\x20%s',_0x1b7811,_0x19e4e7);_0x442d70(_0x19e4e7);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 50cf122..b7ef5c7 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 _0x85d0=['update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put'];(function(_0x1d5452,_0x25e20e){var _0x35240a=function(_0x4b21df){while(--_0x4b21df){_0x1d5452['push'](_0x1d5452['shift']());}};_0x35240a(++_0x25e20e);}(_0x85d0,0x145));var _0x085d=function(_0x10a004,_0x187616){_0x10a004=_0x10a004-0x0;var _0x3eba28=_0x85d0[_0x10a004];return _0x3eba28;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x085d('0x0'));var timeout=require(_0x085d('0x1'));var express=require('express');var router=express[_0x085d('0x2')]();var fs_extra=require(_0x085d('0x3'));var auth=require(_0x085d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x085d('0x5'));var controller=require(_0x085d('0x6'));router[_0x085d('0x7')]('/',auth[_0x085d('0x8')](),controller[_0x085d('0x9')]);router['get'](_0x085d('0xa'),auth[_0x085d('0x8')](),controller[_0x085d('0xb')]);router[_0x085d('0x7')](_0x085d('0xc'),auth[_0x085d('0x8')](),controller[_0x085d('0xd')]);router[_0x085d('0x7')](_0x085d('0xe'),auth[_0x085d('0x8')](),controller[_0x085d('0xf')]);router[_0x085d('0x10')]('/',auth[_0x085d('0x8')](),controller[_0x085d('0x11')]);router[_0x085d('0x10')](_0x085d('0xe'),auth[_0x085d('0x8')](),controller[_0x085d('0x12')]);router[_0x085d('0x13')]('/:id',auth[_0x085d('0x8')](),controller[_0x085d('0x14')]);router[_0x085d('0x15')](_0x085d('0xc'),auth[_0x085d('0x8')](),controller[_0x085d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2009=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/contacts','getContacts','post','create','addContacts','put'];(function(_0x4ef96c,_0x1b0ac0){var _0x49db41=function(_0xba9867){while(--_0xba9867){_0x4ef96c['push'](_0x4ef96c['shift']());}};_0x49db41(++_0x1b0ac0);}(_0x2009,0x67));var _0x9200=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2009[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9200('0x0'));var util=require(_0x9200('0x1'));var path=require(_0x9200('0x2'));var timeout=require(_0x9200('0x3'));var express=require(_0x9200('0x4'));var router=express['Router']();var fs_extra=require(_0x9200('0x5'));var auth=require(_0x9200('0x6'));var interaction=require(_0x9200('0x7'));var config=require('../../config/environment');var controller=require(_0x9200('0x8'));router[_0x9200('0x9')]('/',auth['isAuthenticated'](),controller[_0x9200('0xa')]);router['get'](_0x9200('0xb'),auth['isAuthenticated'](),controller[_0x9200('0xc')]);router[_0x9200('0x9')](_0x9200('0xd'),auth[_0x9200('0xe')](),controller[_0x9200('0xf')]);router[_0x9200('0x9')](_0x9200('0x10'),auth['isAuthenticated'](),controller[_0x9200('0x11')]);router[_0x9200('0x12')]('/',auth['isAuthenticated'](),controller[_0x9200('0x13')]);router['post'](_0x9200('0x10'),auth[_0x9200('0xe')](),controller[_0x9200('0x14')]);router[_0x9200('0x15')](_0x9200('0xd'),auth[_0x9200('0xe')](),controller['update']);router[_0x9200('0x16')](_0x9200('0xd'),auth[_0x9200('0xe')](),controller[_0x9200('0x17')]);module[_0x9200('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 5ab30e5..1b2d865 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 _0x1f04=['DATE','NOW','lodash','sequelize','exports','STRING','INTEGER'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x1f04,0xbf));var _0x41f0=function(_0x231830,_0x42b340){_0x231830=_0x231830-0x0;var _0x3b2b51=_0x1f04[_0x231830];return _0x3b2b51;};'use strict';var _=require(_0x41f0('0x0'));var Sequelize=require(_0x41f0('0x1'));module[_0x41f0('0x2')]={'firstName':{'type':Sequelize[_0x41f0('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x41f0('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x41f0('0x3')]},'city':{'type':Sequelize[_0x41f0('0x3')]},'country':{'type':Sequelize[_0x41f0('0x3')]},'dateOfBirth':{'type':Sequelize[_0x41f0('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x41f0('0x3')]},'mobile':{'type':Sequelize[_0x41f0('0x3')]},'fax':{'type':Sequelize[_0x41f0('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x41f0('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x41f0('0x3')]},'teams':{'type':Sequelize[_0x41f0('0x3')]},'viber':{'type':Sequelize[_0x41f0('0x3')]},'line':{'type':Sequelize[_0x41f0('0x3')]},'wechat':{'type':Sequelize[_0x41f0('0x3')]},'telegram':{'type':Sequelize[_0x41f0('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x41f0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x41f0('0x5')],'defaultValue':Sequelize[_0x41f0('0x6')]},'dialTimezone':{'type':Sequelize[_0x41f0('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xedaf=['DATE','NOW','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xedaf,0x1d0));var _0xfeda=function(_0x49e7fb,_0x2e92bf){_0x49e7fb=_0x49e7fb-0x0;var _0xc912a3=_0xedaf[_0x49e7fb];return _0xc912a3;};'use strict';var _=require(_0xfeda('0x0'));var Sequelize=require(_0xfeda('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xfeda('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xfeda('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xfeda('0x2')]},'city':{'type':Sequelize[_0xfeda('0x2')]},'country':{'type':Sequelize[_0xfeda('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfeda('0x3')]},'phone':{'type':Sequelize[_0xfeda('0x2')]},'mobile':{'type':Sequelize[_0xfeda('0x2')]},'fax':{'type':Sequelize[_0xfeda('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xfeda('0x2')]},'facebook':{'type':Sequelize[_0xfeda('0x2')]},'fb_data':{'type':Sequelize[_0xfeda('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xfeda('0x2')]},'teams':{'type':Sequelize[_0xfeda('0x2')]},'viber':{'type':Sequelize[_0xfeda('0x2')]},'line':{'type':Sequelize[_0xfeda('0x2')]},'wechat':{'type':Sequelize[_0xfeda('0x2')]},'telegram':{'type':Sequelize[_0xfeda('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfeda('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfeda('0x5')],'defaultValue':Sequelize[_0xfeda('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xfeda('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 2ce767e..7bcab3b 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 _0x3c83=['User','agent','binding','child_process','stringify','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','message','getJourney','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','secondDisposition','thirdDisposition','Owner','Tags','DESC','browserName','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','referer','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','slice','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','update','end','sendStatus','error','stack','name','send','index','describe','then','getOptions','query','catch','destroy','CmContact','length','cf_','columnName','displayName','analytics','CmCustomField','findAll','alias','custom','info','keys','forEach','hasOwnProperty','body','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','spread','contact','all','show','tag','params','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','omit','map','cf_%d','dialTimezone','find','$and','pickBy','startsWith','format','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','text','values','phone','findOne','Tag','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','merge','nolimit','getTags','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','item','PHONE','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','includeAll','rows','getHopperHistories','options','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','fork','../../components/import/cm/csv','CompanyId','pid','createReadStream','parse','meta'];(function(_0x3235d2,_0x382a82){var _0x199eef=function(_0x471c3b){while(--_0x471c3b){_0x3235d2['push'](_0x3235d2['shift']());}};_0x199eef(++_0x382a82);}(_0x3c83,0x14a));var _0x33c8=function(_0x22a279,_0x203265){_0x22a279=_0x22a279-0x0;var _0x2bd1c4=_0x3c83[_0x22a279];return _0x2bd1c4;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x33c8('0x0'));var path=require(_0x33c8('0x1'));var fs=require('fs');var _=require(_0x33c8('0x2'));var squel=require(_0x33c8('0x3'));var Papa=require(_0x33c8('0x4'));var Redis=require(_0x33c8('0x5'));var contacts=require(_0x33c8('0x6'));var qs=require(_0x33c8('0x7'));var logger=require(_0x33c8('0x8'))(_0x33c8('0x9'));var config=require('../../config/environment');var shared=require(_0x33c8('0xa'));var db=require(_0x33c8('0xb'))['db'];config[_0x33c8('0xc')]=_[_0x33c8('0xd')](config[_0x33c8('0xc')],{'host':_0x33c8('0xe'),'port':0x18eb});var socket=require(_0x33c8('0xf'))(new Redis(config[_0x33c8('0xc')]));require(_0x33c8('0x10'))[_0x33c8('0x11')](socket);function respondWithResult(_0x5e6c7b,_0x48782d){_0x48782d=_0x48782d||0xc8;return function(_0x373ca5){if(_0x373ca5){return _0x5e6c7b[_0x33c8('0x12')](_0x48782d)[_0x33c8('0x13')](_0x373ca5);}};}function respondWithFilteredResult(_0x421ff8,_0x597c22){return function(_0x4cbc11){if(_0x4cbc11){var _0x436986=typeof _0x597c22[_0x33c8('0x14')]===_0x33c8('0x15')&&typeof _0x597c22[_0x33c8('0x16')]===_0x33c8('0x15');var _0x21e0a0=_0x4cbc11[_0x33c8('0x17')];var _0x129baf=_0x436986?0x0:_0x597c22['offset'];var _0x349769=_0x436986?_0x4cbc11[_0x33c8('0x17')]:_0x597c22['offset']+_0x597c22[_0x33c8('0x16')];var _0xf01e92;if(_0x349769>=_0x21e0a0){_0x349769=_0x21e0a0;_0xf01e92=0xc8;}else{_0xf01e92=0xce;}_0x421ff8[_0x33c8('0x12')](_0xf01e92);return _0x421ff8[_0x33c8('0x18')]('Content-Range',_0x129baf+'-'+_0x349769+'/'+_0x21e0a0)[_0x33c8('0x13')](_0x4cbc11);}return null;};}function saveUpdates(_0x10b46b){return function(_0xdb3e8e){if(_0xdb3e8e){return _0xdb3e8e[_0x33c8('0x19')](_0x10b46b)['then'](function(_0x3d9baa){return _0x3d9baa;});}return null;};}function removeEntity(_0xc20aeb){return function(_0x3880f7){if(_0x3880f7){return _0x3880f7['destroy']()['then'](function(){_0xc20aeb[_0x33c8('0x12')](0xcc)[_0x33c8('0x1a')]();});}};}function handleEntityNotFound(_0x28a246){return function(_0x4d66dc){if(!_0x4d66dc){_0x28a246[_0x33c8('0x1b')](0x194);}return _0x4d66dc;};}function handleError(_0x2340c5,_0x24937e){_0x24937e=_0x24937e||0x1f4;return function(_0x156e96){logger[_0x33c8('0x1c')](_0x156e96[_0x33c8('0x1d')]);if(_0x156e96['name']){delete _0x156e96[_0x33c8('0x1e')];}_0x2340c5[_0x33c8('0x12')](_0x24937e)[_0x33c8('0x1f')](_0x156e96);};}exports[_0x33c8('0x20')]=function(_0x1c2366,_0x2178f7){var _0x50c0fa={};return contacts[_0x33c8('0x21')]()[_0x33c8('0x22')](function(_0x2f5328){_0x50c0fa=qs[_0x33c8('0x23')](_0x2f5328,_0x1c2366);return contacts['findAll'](_0x1c2366[_0x33c8('0x24')],_0x1c2366['user'],_0x50c0fa,_0x2f5328);})['then'](respondWithFilteredResult(_0x2178f7,_0x50c0fa))[_0x33c8('0x25')](handleError(_0x2178f7,null));};exports[_0x33c8('0x26')]=function(_0x54c1b1,_0x427bdd){return db[_0x33c8('0x27')]['find']({'where':{'id':_0x54c1b1['params']['id']}})['then'](handleEntityNotFound(_0x427bdd,null))[_0x33c8('0x22')](removeEntity(_0x427bdd,null))['catch'](handleError(_0x427bdd,null));};exports['describe']=function(_0x3a2fdd,_0x20fa5f){return db['CmContact']['describe']()['then'](function(_0x4b74d3){delete _0x4b74d3['tags'];for(var _0x165981=0x0;_0x1659810x0){return new Promise(function(_0x3f3cf7){var _0x3a8e3b=[];for(var _0x18ac9d=0x0;_0x18ac9d<_0x3a046f[_0x33c8('0x28')];_0x18ac9d++){_0x3a8e3b[_0x33c8('0x5e')](insertAdditionalPhones(_0x3a046f[_0x18ac9d][_0x33c8('0x61')],_0x3a046f[_0x18ac9d][_0x33c8('0x59')]));}Promise[_0x33c8('0x62')](_0x3a8e3b)[_0x33c8('0x22')](function(){_0x3f3cf7(0x1);});})['then'](function(){return{'success':_0x483e2a,'failure':_0x19b588,'duplicates':_0xc7702a};});}else{return{'success':_0x483e2a,'failure':_0x19b588,'duplicates':_0xc7702a};}}})[_0x33c8('0x22')](respondWithResult(_0x387633,0xc9))[_0x33c8('0x25')](handleError(_0x387633,null));};exports[_0x33c8('0x63')]=function(_0x4f4f92,_0x1d5933){var _0x11ca05;return db[_0x33c8('0x27')][_0x33c8('0x21')]()[_0x33c8('0x22')](function(_0x4dad8b){return db[_0x33c8('0x27')]['find']({'where':{'id':_0x4f4f92['params']['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x33c8('0x1e'),'color'],'required':_0x4f4f92['query'][_0x33c8('0x64')]?!![]:![]},{'model':db[_0x33c8('0x49')],'as':'Phones','where':{'CmContactId':_0x4f4f92[_0x33c8('0x65')]['id']},'required':![],'include':[{'model':db[_0x33c8('0x66')],'as':_0x33c8('0x67')}]}],'order':[db[_0x33c8('0x68')][_0x33c8('0x69')](_0x33c8('0x6a'))],'attributes':_[_0x33c8('0x32')](_0x4dad8b)});})[_0x33c8('0x22')](function(_0x5151ab){if(!_[_0x33c8('0x56')](_0x5151ab)){_0x11ca05=_0x5151ab[_0x33c8('0x36')]({'plain':!![]});var _0x22bcd6={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5151ab&&_0x5151ab[_0x33c8('0x5f')]){if(_0x5151ab['ListId']){_0x22bcd6[_0x33c8('0x5c')]['$and']['push']({'ListId':{'$ne':_0x5151ab['ListId']}});}}return db[_0x33c8('0x2d')]['findAll'](_0x22bcd6);}})[_0x33c8('0x22')](function(_0x3017c6){if(!_[_0x33c8('0x56')](_0x3017c6)){return _[_0x33c8('0x6b')](_0x11ca05,_[_0x33c8('0x6c')](_0x3017c6,function(_0xdfb9f9){return util['format'](_0x33c8('0x6d'),_0xdfb9f9['id']);}));}})[_0x33c8('0x22')](handleEntityNotFound(_0x1d5933,null))[_0x33c8('0x22')](respondWithResult(_0x1d5933,null))[_0x33c8('0x25')](handleError(_0x1d5933,null));};exports[_0x33c8('0x19')]=function(_0x3ab5b2,_0x40cab7){var _0x1cad81;if(_0x3ab5b2[_0x33c8('0x35')]['id']){delete _0x3ab5b2[_0x33c8('0x35')]['id'];}if(!_['isNil'](_0x3ab5b2[_0x33c8('0x35')][_0x33c8('0x6e')])){var _0x11b4cc=_0x3ab5b2[_0x33c8('0x35')]['dialTimezone'];if(!_[_0x33c8('0x56')](shared[_0x33c8('0x57')][_0x11b4cc]))_0x3ab5b2[_0x33c8('0x35')][_0x33c8('0x58')]=shared[_0x33c8('0x57')][_0x11b4cc][_0x33c8('0x58')];}return db[_0x33c8('0x27')][_0x33c8('0x6f')]({'where':{'id':_0x3ab5b2[_0x33c8('0x65')]['id']}})[_0x33c8('0x22')](handleEntityNotFound(_0x40cab7,null))[_0x33c8('0x22')](saveUpdates(_0x3ab5b2['body'],null))[_0x33c8('0x22')](function(_0x38dd6f){_0x1cad81=_0x38dd6f;var _0x5d1738={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x38dd6f&&_0x38dd6f[_0x33c8('0x5f')]){if(_0x38dd6f[_0x33c8('0x5f')]){_0x5d1738['where'][_0x33c8('0x70')][_0x33c8('0x5e')]({'ListId':{'$ne':_0x38dd6f['ListId']}});}}return db['CmCustomField'][_0x33c8('0x2e')](_0x5d1738);})['then'](function(_0x778999){if(_0x778999){return _[_0x33c8('0x6b')](_[_0x33c8('0x71')](_0x3ab5b2[_0x33c8('0x35')],function(_0x48c9ef,_0x56bb69){return _[_0x33c8('0x72')](_0x56bb69,_0x33c8('0x29'));}),_['map'](_0x778999,function(_0xbf4a2e){return util[_0x33c8('0x73')](_0x33c8('0x6d'),_0xbf4a2e['id']);}));}})[_0x33c8('0x22')](function(_0x528f9a){if(_0x528f9a&&!_[_0x33c8('0x74')](_0x528f9a)){var _0x4fe316=squel[_0x33c8('0x19')]()[_0x33c8('0x75')](_0x33c8('0x76'))['setFields'](_0x528f9a)[_0x33c8('0x5c')](_0x33c8('0x77'),_0x3ab5b2[_0x33c8('0x65')]['id'])[_0x33c8('0x78')]();return db[_0x33c8('0x68')][_0x33c8('0x24')](_0x4fe316[_0x33c8('0x79')],{'replacements':_0x4fe316[_0x33c8('0x7a')]});}})['then'](function(){if(_0x3ab5b2['body'][_0x33c8('0x7b')]&&_0x1cad81){return db[_0x33c8('0x3d')][_0x33c8('0x19')]({'phone':_0x3ab5b2[_0x33c8('0x35')][_0x33c8('0x7b')],'OrderBy':0x0},{'where':{'ContactId':_0x1cad81['id']}});}})[_0x33c8('0x22')](function(){return _0x1cad81;})[_0x33c8('0x22')](respondWithResult(_0x40cab7,null))['catch'](handleError(_0x40cab7,null));};exports['getTags']=function(_0x15e08e,_0x2ffe86){var _0x1b2aaa={};var _0x40385e={};var _0x10132a;var _0x2404dc;return db[_0x33c8('0x27')][_0x33c8('0x7c')]({'where':{'id':_0x15e08e[_0x33c8('0x65')]['id']}})['then'](handleEntityNotFound(_0x2ffe86,null))['then'](function(_0x1f2aa2){if(_0x1f2aa2){_0x10132a=_0x1f2aa2;_0x40385e['model']=_[_0x33c8('0x32')](db[_0x33c8('0x7d')][_0x33c8('0x7e')]);_0x40385e[_0x33c8('0x24')]=_[_0x33c8('0x32')](_0x15e08e[_0x33c8('0x24')]);_0x40385e[_0x33c8('0x7f')]=_[_0x33c8('0x80')](_0x40385e[_0x33c8('0x81')],_0x40385e[_0x33c8('0x24')]);_0x1b2aaa[_0x33c8('0x82')]=_[_0x33c8('0x80')](_0x40385e[_0x33c8('0x81')],qs[_0x33c8('0x83')](_0x15e08e['query']['fields']));_0x1b2aaa[_0x33c8('0x82')]=_0x1b2aaa[_0x33c8('0x82')][_0x33c8('0x28')]?_0x1b2aaa[_0x33c8('0x82')]:_0x40385e[_0x33c8('0x81')];_0x1b2aaa[_0x33c8('0x84')]=qs[_0x33c8('0x85')](_0x15e08e['query'][_0x33c8('0x85')]);_0x1b2aaa[_0x33c8('0x5c')]=qs[_0x33c8('0x7f')](_[_0x33c8('0x86')](_0x15e08e[_0x33c8('0x24')],_0x40385e['filters']));if(_0x15e08e['query'][_0x33c8('0x87')]){_0x1b2aaa[_0x33c8('0x5c')]=_[_0x33c8('0x88')](_0x1b2aaa[_0x33c8('0x5c')],{'$or':_[_0x33c8('0x6c')](_0x1b2aaa[_0x33c8('0x82')],function(_0x3c65a5){var _0x46475c={};_0x46475c[_0x3c65a5]={'$like':'%'+_0x15e08e['query']['filter']+'%'};return _0x46475c;})});}_0x1b2aaa=_[_0x33c8('0x88')]({},_0x1b2aaa,_0x15e08e['options']);return _0x10132a['getTags'](_0x1b2aaa);}})[_0x33c8('0x22')](function(_0x54dafe){if(_0x54dafe){_0x2404dc=_0x54dafe['length'];if(!_0x15e08e[_0x33c8('0x24')][_0x33c8('0x34')](_0x33c8('0x89'))){_0x1b2aaa['limit']=qs[_0x33c8('0x16')](_0x15e08e[_0x33c8('0x24')][_0x33c8('0x16')]);_0x1b2aaa[_0x33c8('0x14')]=qs['offset'](_0x15e08e[_0x33c8('0x24')][_0x33c8('0x14')]);}return _0x10132a[_0x33c8('0x8a')](_0x1b2aaa);}})[_0x33c8('0x22')](function(_0x3f7a9a){if(_0x3f7a9a){return _0x3f7a9a?{'count':_0x2404dc,'rows':_0x3f7a9a}:null;}})[_0x33c8('0x22')](respondWithResult(_0x2ffe86,null))[_0x33c8('0x25')](handleError(_0x2ffe86,null));};exports[_0x33c8('0x8b')]=function(_0xb5c3e7,_0x474065){if(_0xb5c3e7['body']['id']){delete _0xb5c3e7[_0x33c8('0x35')]['id'];}return db[_0x33c8('0x27')][_0x33c8('0x7c')]({'where':{'id':_0xb5c3e7[_0x33c8('0x65')]['id']}})[_0x33c8('0x22')](handleEntityNotFound(_0x474065,null))['then'](function(_0x5cff25){if(_0x5cff25){return _0x5cff25[_0x33c8('0x8b')](_0xb5c3e7[_0x33c8('0x35')][_0x33c8('0x8c')]||[]);}return null;})[_0x33c8('0x22')](respondWithResult(_0x474065,null))[_0x33c8('0x25')](handleError(_0x474065,null));};exports['setAdditionalPhones']=function(_0x31884f,_0x38de13){var _0x56a6c4=[];_0x56a6c4[_0x33c8('0x5e')](addAdditionalPhones(_0x31884f[_0x33c8('0x35')]));Promise[_0x33c8('0x62')](_0x56a6c4)[_0x33c8('0x22')](function(){_0x56a6c4=[];_0x56a6c4[_0x33c8('0x5e')](deleteCmHopperPhones(_0x31884f['body']['id']));_0x56a6c4[_0x33c8('0x5e')](addCmHopperPhones(_0x31884f[_0x33c8('0x35')]['id']));Promise['all'](_0x56a6c4)[_0x33c8('0x22')](function(){return[0x1];})[_0x33c8('0x22')](respondWithResult(_0x38de13,null));});};function addAdditionalPhones(_0x1d0791){var _0x45fa18;return new Promise(function(_0x2db472){return db[_0x33c8('0x49')]['destroy']({'where':{'CmContactId':_0x1d0791['id']}})[_0x33c8('0x22')](function(){db[_0x33c8('0x66')][_0x33c8('0x2e')]({'raw':!![],'attributes':['id',_0x33c8('0x8d')]})[_0x33c8('0x22')](function(_0x5e634a){var _0x4c2546=[];for(var _0x3c9f14=0x0;_0x3c9f14<_0x1d0791[_0x33c8('0x8e')][_0x33c8('0x28')];_0x3c9f14++){var _0x2c2fd4=_0x1d0791[_0x33c8('0x8f')]?_[_0x33c8('0x56')](_0x1d0791[_0x33c8('0x8f')][_0x3c9f14])?'':_0x1d0791['item_types'][_0x3c9f14]:_0x1d0791['items'][_0x3c9f14][_0x33c8('0x90')]?_0x1d0791[_0x33c8('0x8e')][_0x3c9f14][_0x33c8('0x90')]:'';var _0x4e156b=_[_0x33c8('0x56')](_0x1d0791['items'][_0x3c9f14][_0x33c8('0x91')])?'':_0x1d0791['items'][_0x3c9f14][_0x33c8('0x91')];var _0x811fd2=_0x2c2fd4+':'+_0x1d0791[_0x33c8('0x8e')][_0x3c9f14][_0x33c8('0x7b')]+'§'+_0x4e156b;if(_[_0x33c8('0x56')](_0x45fa18))_0x45fa18=_0x811fd2;else _0x45fa18+=';'+_0x811fd2;var _0xa48dbf=null;var _0x3f59b4=null;if(_0x1d0791[_0x33c8('0x8f')]){if(!_['isNil'](_0x1d0791[_0x33c8('0x8f')][_0x3c9f14])){_0x3f59b4=_[_0x33c8('0x6f')](_0x5e634a,function(_0x58d194){return _0x58d194['id']===_0x1d0791[_0x33c8('0x8f')][_0x3c9f14];});if(!_['isNil'](_0x3f59b4)){_0xa48dbf=_0x3f59b4[_0x33c8('0x8d')];}}}else{if(!_[_0x33c8('0x56')](_0x1d0791[_0x33c8('0x8e')][_0x3c9f14])){_0x3f59b4=_[_0x33c8('0x6f')](_0x5e634a,function(_0x642789){return _0x642789['id']===_0x1d0791['items'][_0x3c9f14]['ItemTypeId'];});if(!_[_0x33c8('0x56')](_0x3f59b4)){_0xa48dbf=_0x3c9f14;}}}if(_[_0x33c8('0x56')](_0xa48dbf)){_0xa48dbf=0x64;}_0x4c2546[_0x33c8('0x5e')](addAdditionalPhone(_0x1d0791['id'],_0x1d0791[_0x33c8('0x8e')][_0x3c9f14][_0x33c8('0x7b')],_0x1d0791[_0x33c8('0x8f')]?_[_0x33c8('0x56')](_0x1d0791[_0x33c8('0x8f')][_0x3c9f14])?null:_0x1d0791[_0x33c8('0x8f')][_0x3c9f14]:_0x1d0791['items'][_0x3c9f14][_0x33c8('0x90')]?_0x1d0791['items'][_0x3c9f14]['ItemTypeId']:null,_0xa48dbf,_0x4e156b));}Promise[_0x33c8('0x62')](_0x4c2546)['then'](function(){db[_0x33c8('0x27')][_0x33c8('0x19')]({'AdditionalPhones':_0x45fa18},{'where':{'id':_0x1d0791['id']}})[_0x33c8('0x22')](function(){_0x2db472(0x1);});});});});});}function addAdditionalPhone(_0x5dd6ea,_0x578248,_0x3f9557,_0x5e1b99,_0x247e69){return db['CmContactHasItem'][_0x33c8('0x6f')]({'where':{'CmContactId':_0x5dd6ea,'item':_0x578248}})[_0x33c8('0x22')](function(_0x265f10){if(_0x265f10)logger[_0x33c8('0x31')](_0x33c8('0x92'),_0x265f10);else{db[_0x33c8('0x49')][_0x33c8('0x40')]({'CmContactId':_0x5dd6ea,'item':_0x578248,'ItemTypeId':_0x3f9557,'OrderBy':_0x5e1b99,'ItemClass':'PHONE','description':_0x247e69});}});}function deleteCmHopperPhones(_0x2dc9d4){return new Promise(function(_0x260c55){return db['CmHopper'][_0x33c8('0x2e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2dc9d4}})['then'](function(_0x386aa2){db['CmHopperAdditionalPhone'][_0x33c8('0x26')]({'where':{'CmHopperId':{'$in':_[_0x33c8('0x6c')](_0x386aa2,'id')}}});})[_0x33c8('0x22')](function(){_0x260c55(0x1);});});}function addCmHopperPhones(_0x6e2bab){return new Promise(function(_0x183e9d){return db[_0x33c8('0x3d')][_0x33c8('0x2e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x6e2bab}})['then'](function(_0x414d45){var _0x42d5d5=[];_['map'](_0x414d45,function(_0x283519){_0x42d5d5['push'](createCmHopperPhone(_0x6e2bab,_0x283519['id']));});Promise[_0x33c8('0x62')](_0x42d5d5)['then'](function(){_0x183e9d(0x1);});});});}function createCmHopperPhone(_0x1520d7,_0x3f0e5f){return new Promise(function(_0xd623c2){db[_0x33c8('0x49')][_0x33c8('0x2e')]({'raw':!![],'attributes':[_0x33c8('0x93'),_0x33c8('0x8d')],'where':{'CmContactId':_0x1520d7,'ItemClass':_0x33c8('0x94')},'include':[{'model':db[_0x33c8('0x66')],'attributes':[_0x33c8('0x8d')],'as':_0x33c8('0x67')}],'order':[_0x33c8('0x8d'),db[_0x33c8('0x68')][_0x33c8('0x69')](_0x33c8('0x95'))]})[_0x33c8('0x22')](function(_0x569f5e){var _0x34b239=0x1;var _0x2bb3a8=_['map'](_0x569f5e,function(_0x4ee6dd){_0x4ee6dd[_0x33c8('0x96')]=_0x3f0e5f;_0x4ee6dd['phone']=_0x4ee6dd[_0x33c8('0x93')];_0x4ee6dd[_0x33c8('0x8d')]=_0x34b239;delete _0x4ee6dd[_0x33c8('0x97')];_0x34b239=_0x34b239+0x1;return _0x4ee6dd;});return db[_0x33c8('0x98')][_0x33c8('0x5a')](_0x2bb3a8,{});})[_0x33c8('0x22')](function(){_0xd623c2(0x1);});});}function insertAdditionalPhones(_0xfb6155,_0x4f6de1){return new Promise(function(_0x4379bd){var _0x2d9916=[];for(var _0x180e74=0x0;_0x180e74<_0x4f6de1[_0x33c8('0x28')];_0x180e74++){var _0x5764b9=_0x4f6de1[_0x180e74];_0x2d9916[_0x33c8('0x5e')](parseContactItemType(_0x5764b9));}Promise['all'](_0x2d9916)[_0x33c8('0x22')](function(){var _0x2446e9={'id':_0xfb6155['id'],'items':_0x4f6de1};return addAdditionalPhones(_0x2446e9)[_0x33c8('0x22')](function(){return addCmHopperPhones(_0xfb6155['id']);});})[_0x33c8('0x22')](function(){_0x4379bd(_0xfb6155);});});}function parseContactItemType(_0x5adac0){return new Promise(function(_0x12add6){if(_0x5adac0[_0x33c8('0x34')](_0x33c8('0x90'))){_0x12add6(_0x5adac0);}else{return db[_0x33c8('0x66')][_0x33c8('0x6f')]({'where':{'name':_0x5adac0['ItemType']}})[_0x33c8('0x22')](function(_0x487ba5){if(_['isNil'](_0x487ba5))_0x5adac0[_0x33c8('0x90')]=null;else _0x5adac0[_0x33c8('0x90')]=_0x487ba5['id'];_0x12add6(_0x5adac0);});}});}exports[_0x33c8('0x99')]=function(_0x4a5c08,_0x3400ef){return db[_0x33c8('0x49')]['findAll']({'raw':!![],'where':{'CmContactId':_0x4a5c08[_0x33c8('0x65')]['id'],'ItemClass':_0x33c8('0x94')},'include':[{'model':db['ContactItemType'],'as':_0x33c8('0x67')}],'order':[['OrderBy'],[db['sequelize']['literal'](_0x33c8('0x95'))]]})['then'](function(_0x57a98e){return _0x57a98e;})[_0x33c8('0x22')](respondWithResult(_0x3400ef,null))[_0x33c8('0x25')](handleError(_0x3400ef,null));};exports[_0x33c8('0x9a')]=function(_0x5bfed5,_0x39fa2d){return db[_0x33c8('0x49')][_0x33c8('0x2e')]({'raw':!![],'where':{'CmContactId':_0x5bfed5[_0x33c8('0x35')][_0x33c8('0x9b')]}})[_0x33c8('0x22')](function(_0x359387){var _0x324551=_[_0x33c8('0x6c')](_0x359387,function(_0x36aabe){_0x36aabe[_0x33c8('0x9c')]=_0x5bfed5[_0x33c8('0x35')][_0x33c8('0x9d')];return _0x36aabe;});return db[_0x33c8('0x49')][_0x33c8('0x5a')](_0x324551,{});})[_0x33c8('0x22')](function(){return addCmHopperPhones(_0x5bfed5[_0x33c8('0x35')][_0x33c8('0x9d')]);})[_0x33c8('0x22')](function(){return['ok'];})[_0x33c8('0x22')](respondWithResult(_0x39fa2d,null))[_0x33c8('0x25')](handleError(_0x39fa2d,null));};exports[_0x33c8('0x9e')]=function(_0x1b62b1,_0x1efc2a){var _0x45c430=[];_0x45c430[_0x33c8('0x5e')](createCmHopperPhone(_0x1b62b1[_0x33c8('0x35')]['id'],_0x1b62b1[_0x33c8('0x35')]['hopperId']));Promise[_0x33c8('0x62')](_0x45c430)[_0x33c8('0x22')](function(){return[0x1];})[_0x33c8('0x22')](respondWithResult(_0x1efc2a,null));};exports['getHoppers']=function(_0x4c1c5f,_0x3b40b1){var _0x2d3616={'raw':![],'where':{}};var _0x355dff={};var _0x429c89={'count':0x0,'rows':[]};return db[_0x33c8('0x27')][_0x33c8('0x7c')]({'where':{'id':_0x4c1c5f[_0x33c8('0x65')]['id']}})[_0x33c8('0x22')](handleEntityNotFound(_0x3b40b1,null))[_0x33c8('0x22')](function(_0x457cd9){if(_0x457cd9){_0x355dff[_0x33c8('0x81')]=_[_0x33c8('0x32')](db['CmHopper'][_0x33c8('0x7e')]);_0x355dff[_0x33c8('0x24')]=_['keys'](_0x4c1c5f[_0x33c8('0x24')]);_0x355dff[_0x33c8('0x7f')]=_[_0x33c8('0x80')](_0x355dff[_0x33c8('0x81')],_0x355dff[_0x33c8('0x24')]);_0x2d3616['attributes']=_[_0x33c8('0x80')](_0x355dff['model'],qs[_0x33c8('0x83')](_0x4c1c5f[_0x33c8('0x24')][_0x33c8('0x83')]));_0x2d3616[_0x33c8('0x82')]=_0x2d3616['attributes'][_0x33c8('0x28')]?_0x2d3616[_0x33c8('0x82')]:_0x355dff[_0x33c8('0x81')];if(!_0x4c1c5f[_0x33c8('0x24')][_0x33c8('0x34')](_0x33c8('0x89'))){_0x2d3616['limit']=qs[_0x33c8('0x16')](_0x4c1c5f[_0x33c8('0x24')][_0x33c8('0x16')]);_0x2d3616[_0x33c8('0x14')]=qs[_0x33c8('0x14')](_0x4c1c5f['query'][_0x33c8('0x14')]);}_0x2d3616['order']=qs[_0x33c8('0x85')](_0x4c1c5f[_0x33c8('0x24')][_0x33c8('0x85')]);_0x2d3616[_0x33c8('0x5c')]=qs[_0x33c8('0x7f')](_[_0x33c8('0x86')](_0x4c1c5f[_0x33c8('0x24')],_0x355dff[_0x33c8('0x7f')]));_0x2d3616['where'][_0x33c8('0x9f')]=_0x457cd9['id'];if(_0x4c1c5f['query'][_0x33c8('0x87')]){_0x2d3616[_0x33c8('0x5c')]=_[_0x33c8('0x88')](_0x2d3616[_0x33c8('0x5c')],{'$or':_[_0x33c8('0x6c')](_0x2d3616['attributes'],function(_0x422b42){var _0xfe1276={};_0xfe1276[_0x422b42]={'$like':'%'+_0x4c1c5f[_0x33c8('0x24')][_0x33c8('0x87')]+'%'};return _0xfe1276;})});}_0x2d3616=_['merge']({},_0x2d3616,_0x4c1c5f['options']);return db[_0x33c8('0x3d')][_0x33c8('0x17')]({'where':_0x2d3616[_0x33c8('0x5c')]})[_0x33c8('0x22')](function(_0x4bbec7){_0x429c89[_0x33c8('0x17')]=_0x4bbec7;if(_0x4c1c5f[_0x33c8('0x24')][_0x33c8('0xa0')]){_0x2d3616['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x2d3616);})[_0x33c8('0x22')](function(_0x55eede){_0x429c89[_0x33c8('0xa1')]=_0x55eede;return _0x429c89;});}})[_0x33c8('0x22')](respondWithFilteredResult(_0x3b40b1,_0x2d3616))[_0x33c8('0x25')](handleError(_0x3b40b1,null));};exports[_0x33c8('0xa2')]=function(_0x1146eb,_0x1f8ac5){var _0x4c3d34={'raw':!![],'where':{}};var _0x24b240={};var _0x593273={'count':0x0,'rows':[]};return db[_0x33c8('0x27')][_0x33c8('0x7c')]({'where':{'id':_0x1146eb[_0x33c8('0x65')]['id']}})[_0x33c8('0x22')](handleEntityNotFound(_0x1f8ac5,null))[_0x33c8('0x22')](function(_0x3fd45e){if(_0x3fd45e){_0x24b240[_0x33c8('0x81')]=_[_0x33c8('0x32')](db['CmHopperHistory'][_0x33c8('0x7e')]);_0x24b240[_0x33c8('0x24')]=_['keys'](_0x1146eb['query']);_0x24b240['filters']=_[_0x33c8('0x80')](_0x24b240['model'],_0x24b240[_0x33c8('0x24')]);_0x4c3d34['attributes']=_[_0x33c8('0x80')](_0x24b240[_0x33c8('0x81')],qs[_0x33c8('0x83')](_0x1146eb[_0x33c8('0x24')][_0x33c8('0x83')]));_0x4c3d34['attributes']=_0x4c3d34[_0x33c8('0x82')][_0x33c8('0x28')]?_0x4c3d34[_0x33c8('0x82')]:_0x24b240[_0x33c8('0x81')];if(!_0x1146eb[_0x33c8('0x24')]['hasOwnProperty']('nolimit')){_0x4c3d34[_0x33c8('0x16')]=qs['limit'](_0x1146eb['query']['limit']);_0x4c3d34['offset']=qs[_0x33c8('0x14')](_0x1146eb[_0x33c8('0x24')][_0x33c8('0x14')]);}_0x4c3d34['order']=qs[_0x33c8('0x85')](_0x1146eb[_0x33c8('0x24')][_0x33c8('0x85')]);_0x4c3d34[_0x33c8('0x5c')]=qs[_0x33c8('0x7f')](_[_0x33c8('0x86')](_0x1146eb[_0x33c8('0x24')],_0x24b240[_0x33c8('0x7f')]));_0x4c3d34[_0x33c8('0x5c')][_0x33c8('0x9f')]=_0x3fd45e['id'];if(_0x1146eb[_0x33c8('0x24')][_0x33c8('0x87')]){_0x4c3d34[_0x33c8('0x5c')]=_[_0x33c8('0x88')](_0x4c3d34['where'],{'$or':_[_0x33c8('0x6c')](_0x4c3d34[_0x33c8('0x82')],function(_0x16ff6a){var _0x359cd9={};_0x359cd9[_0x16ff6a]={'$like':'%'+_0x1146eb[_0x33c8('0x24')][_0x33c8('0x87')]+'%'};return _0x359cd9;})});}_0x4c3d34=_[_0x33c8('0x88')]({},_0x4c3d34,_0x1146eb[_0x33c8('0xa3')]);return db[_0x33c8('0x4b')][_0x33c8('0x17')]({'where':_0x4c3d34['where']})[_0x33c8('0x22')](function(_0x1d27fa){_0x593273['count']=_0x1d27fa;if(_0x1146eb[_0x33c8('0x24')]['includeAll']){_0x4c3d34[_0x33c8('0xa4')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x33c8('0x2e')](_0x4c3d34);})[_0x33c8('0x22')](function(_0xeee827){_0x593273[_0x33c8('0xa1')]=_0xeee827;return _0x593273;});}})[_0x33c8('0x22')](respondWithFilteredResult(_0x1f8ac5,_0x4c3d34))['catch'](handleError(_0x1f8ac5,null));};exports['getHopperFinals']=function(_0x537930,_0x33c865){var _0x50bf28={'raw':!![],'where':{}};var _0x1bf019={};var _0x54cbfa={'count':0x0,'rows':[]};return db[_0x33c8('0x27')][_0x33c8('0x7c')]({'where':{'id':_0x537930['params']['id']}})[_0x33c8('0x22')](handleEntityNotFound(_0x33c865,null))[_0x33c8('0x22')](function(_0x2adc98){if(_0x2adc98){_0x1bf019['model']=_[_0x33c8('0x32')](db[_0x33c8('0x4a')][_0x33c8('0x7e')]);_0x1bf019['query']=_[_0x33c8('0x32')](_0x537930[_0x33c8('0x24')]);_0x1bf019[_0x33c8('0x7f')]=_[_0x33c8('0x80')](_0x1bf019['model'],_0x1bf019[_0x33c8('0x24')]);_0x50bf28[_0x33c8('0x82')]=_[_0x33c8('0x80')](_0x1bf019[_0x33c8('0x81')],qs[_0x33c8('0x83')](_0x537930[_0x33c8('0x24')][_0x33c8('0x83')]));_0x50bf28['attributes']=_0x50bf28['attributes']['length']?_0x50bf28[_0x33c8('0x82')]:_0x1bf019[_0x33c8('0x81')];if(!_0x537930[_0x33c8('0x24')][_0x33c8('0x34')](_0x33c8('0x89'))){_0x50bf28['limit']=qs[_0x33c8('0x16')](_0x537930[_0x33c8('0x24')][_0x33c8('0x16')]);_0x50bf28[_0x33c8('0x14')]=qs[_0x33c8('0x14')](_0x537930[_0x33c8('0x24')]['offset']);}_0x50bf28[_0x33c8('0x84')]=qs[_0x33c8('0x85')](_0x537930[_0x33c8('0x24')][_0x33c8('0x85')]);_0x50bf28[_0x33c8('0x5c')]=qs['filters'](_[_0x33c8('0x86')](_0x537930[_0x33c8('0x24')],_0x1bf019['filters']));_0x50bf28['where'][_0x33c8('0x9f')]=_0x2adc98['id'];if(_0x537930['query'][_0x33c8('0x87')]){_0x50bf28[_0x33c8('0x5c')]=_[_0x33c8('0x88')](_0x50bf28[_0x33c8('0x5c')],{'$or':_[_0x33c8('0x6c')](_0x50bf28[_0x33c8('0x82')],function(_0x3e3a2e){var _0x809ae2={};_0x809ae2[_0x3e3a2e]={'$like':'%'+_0x537930['query']['filter']+'%'};return _0x809ae2;})});}_0x50bf28=_[_0x33c8('0x88')]({},_0x50bf28,_0x537930[_0x33c8('0xa3')]);return db[_0x33c8('0x4a')][_0x33c8('0x17')]({'where':_0x50bf28[_0x33c8('0x5c')]})['then'](function(_0x1b7e36){_0x54cbfa[_0x33c8('0x17')]=_0x1b7e36;if(_0x537930[_0x33c8('0x24')][_0x33c8('0xa0')]){_0x50bf28[_0x33c8('0xa4')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x33c8('0x2e')](_0x50bf28);})[_0x33c8('0x22')](function(_0x3265bf){_0x54cbfa[_0x33c8('0xa1')]=_0x3265bf;return _0x54cbfa;});}})['then'](respondWithFilteredResult(_0x33c865,_0x50bf28))[_0x33c8('0x25')](handleError(_0x33c865,null));};exports[_0x33c8('0xa5')]=function(_0x512091,_0x2b14c1){var _0x3af5b2={'raw':!![],'where':{}};var _0x27af72={};var _0x53f8b2={'count':0x0,'rows':[]};return db[_0x33c8('0x27')][_0x33c8('0x7c')]({'where':{'id':_0x512091[_0x33c8('0x65')]['id']}})[_0x33c8('0x22')](handleEntityNotFound(_0x2b14c1,null))[_0x33c8('0x22')](function(_0xcf054e){if(_0xcf054e){_0x27af72[_0x33c8('0x81')]=_[_0x33c8('0x32')](db[_0x33c8('0x52')]['rawAttributes']);_0x27af72['query']=_['keys'](_0x512091[_0x33c8('0x24')]);_0x27af72[_0x33c8('0x7f')]=_[_0x33c8('0x80')](_0x27af72[_0x33c8('0x81')],_0x27af72[_0x33c8('0x24')]);_0x3af5b2[_0x33c8('0x82')]=_[_0x33c8('0x80')](_0x27af72['model'],qs[_0x33c8('0x83')](_0x512091[_0x33c8('0x24')][_0x33c8('0x83')]));_0x3af5b2[_0x33c8('0x82')]=_0x3af5b2[_0x33c8('0x82')][_0x33c8('0x28')]?_0x3af5b2['attributes']:_0x27af72[_0x33c8('0x81')];if(!_0x512091[_0x33c8('0x24')]['hasOwnProperty']('nolimit')){_0x3af5b2['limit']=qs['limit'](_0x512091['query']['limit']);_0x3af5b2[_0x33c8('0x14')]=qs[_0x33c8('0x14')](_0x512091[_0x33c8('0x24')][_0x33c8('0x14')]);}_0x3af5b2[_0x33c8('0x84')]=qs[_0x33c8('0x85')](_0x512091[_0x33c8('0x24')][_0x33c8('0x85')]);_0x3af5b2['where']=qs['filters'](_['pick'](_0x512091[_0x33c8('0x24')],_0x27af72[_0x33c8('0x7f')]));_0x3af5b2[_0x33c8('0x5c')][_0x33c8('0x9f')]=_0xcf054e['id'];if(_0x512091[_0x33c8('0x24')][_0x33c8('0x87')]){_0x3af5b2[_0x33c8('0x5c')]=_['merge'](_0x3af5b2['where'],{'$or':_[_0x33c8('0x6c')](_0x3af5b2[_0x33c8('0x82')],function(_0x2d968e){var _0x267d1b={};_0x267d1b[_0x2d968e]={'$like':'%'+_0x512091[_0x33c8('0x24')][_0x33c8('0x87')]+'%'};return _0x267d1b;})});}_0x3af5b2=_[_0x33c8('0x88')]({},_0x3af5b2,_0x512091[_0x33c8('0xa3')]);return db['JscriptySessionReport'][_0x33c8('0x17')]({'where':_0x3af5b2[_0x33c8('0x5c')]})['then'](function(_0x14a471){_0x53f8b2[_0x33c8('0x17')]=_0x14a471;if(_0x512091['query'][_0x33c8('0xa0')]){_0x3af5b2['include']=[{'all':!![]}];}return db[_0x33c8('0x52')]['findAll'](_0x3af5b2);})['then'](function(_0x2886e9){_0x53f8b2['rows']=_0x2886e9;return _0x53f8b2;});}})[_0x33c8('0x22')](respondWithFilteredResult(_0x2b14c1,_0x3af5b2))[_0x33c8('0x25')](handleError(_0x2b14c1,null));};exports[_0x33c8('0xa6')]=function(_0x324037,_0x5217f0){try{if(!_0x324037[_0x33c8('0x35')]['ListId']){throw new Error(_0x33c8('0xa7'));}if(!_0x324037[_0x33c8('0x35')][_0x33c8('0xa8')]){throw new Error(_0x33c8('0xa9'));}if(!_0x324037[_0x33c8('0x35')]['binding_values']){throw new Error(_0x33c8('0xaa'));}if(!_0x324037['body'][_0x33c8('0xab')]){throw new Error(_0x33c8('0xac'));}var _0x1dbc37=_0x324037[_0x33c8('0x35')][_0x33c8('0xa8')][_0x33c8('0xad')](',');var _0x4f63bd=_0x324037[_0x33c8('0x35')][_0x33c8('0xae')][_0x33c8('0xad')](',');if(!_0x1dbc37[_0x33c8('0x28')]||!_0x4f63bd['length']||_0x1dbc37[_0x33c8('0x28')]!==_0x4f63bd[_0x33c8('0x28')]){throw new Error(_0x33c8('0xaf'));}_0x324037['body'][_0x33c8('0x83')]=_[_0x33c8('0xb0')](_0x1dbc37,_0x4f63bd);if(!_0x324037[_0x33c8('0x35')][_0x33c8('0x83')][_0x33c8('0x7b')]){throw new Error(_0x33c8('0xb1'));}if(!_0x324037['body']['fields'][_0x33c8('0xb2')]){throw new Error(_0x33c8('0xb3'));}var _0xf08675=path[_0x33c8('0x3a')](config[_0x33c8('0xb4')],_0x33c8('0xb5'),_0x324037[_0x33c8('0xb6')][_0x33c8('0xb7')]);fs['chmodSync'](_0xf08675,parseInt(_0x33c8('0xb8'),0x8));var _0x11e7b9=require('child_process')[_0x33c8('0xb9')](path[_0x33c8('0x3a')](__dirname,_0x33c8('0xba')),[_0xf08675,_0x324037['body'][_0x33c8('0xa8')],_0x324037[_0x33c8('0x35')]['binding_values'],_0x324037['body']['ListId'],_0x324037[_0x33c8('0x35')][_0x33c8('0xbb')],_0x324037[_0x33c8('0x35')]['duplicates'],_0x324037[_0x33c8('0x35')][_0x33c8('0xab')]]);return _0x5217f0['status'](0xc8)[_0x33c8('0x13')]({'message':'File\x20uploaded\x20correctly!','pid':_0x11e7b9[_0x33c8('0xbc')]});}catch(_0x35c86c){return _0x5217f0[_0x33c8('0x12')](0x1f4)[_0x33c8('0x1f')](_0x35c86c);}};exports['upload']=function(_0x5f2717,_0x25a055){var _0x43d77c=fs[_0x33c8('0xbd')](_0x5f2717[_0x33c8('0xb6')]['path']);Papa[_0x33c8('0xbe')](_0x43d77c,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x549bff){return _0x25a055[_0x33c8('0x12')](0xc8)[_0x33c8('0x13')]({'file':_0x5f2717[_0x33c8('0xb6')],'fields':_0x549bff[_0x33c8('0xbf')][_0x33c8('0x83')]});}});};exports['import']=function(_0x4c1b2e,_0x55579b){return db[_0x33c8('0xc0')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x33c8('0xc1')}})['then'](function(_0x239b9a){var _0x2f896f=![];if(!_0x4c1b2e['body'][_0x33c8('0x5f')]){throw new Error(_0x33c8('0xa7'));}if(!_0x4c1b2e[_0x33c8('0x35')][_0x33c8('0xc2')]['phone']){throw new Error(_0x33c8('0xb1'));}if(!_0x4c1b2e[_0x33c8('0x35')][_0x33c8('0xc2')][_0x33c8('0xb2')]){throw new Error(_0x33c8('0xb3'));}if(!_0x4c1b2e[_0x33c8('0x35')][_0x33c8('0xab')]){throw new Error(_0x33c8('0xac'));}var _0xecab0a=require(_0x33c8('0xc3'))[_0x33c8('0xb9')](path[_0x33c8('0x3a')](__dirname,'../../components/import/cm/csv2'),[_0x4c1b2e[_0x33c8('0x65')]['id'],JSON[_0x33c8('0xc4')](_0x4c1b2e['body']),JSON[_0x33c8('0xc4')](_0x239b9a)]);_0xecab0a['on']('message',function(){_0x2f896f=!![];return _0x55579b[_0x33c8('0x12')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0xecab0a[_0x33c8('0xbc')]});});_0xecab0a['on'](_0x33c8('0xc5'),function(_0x464a29){if(_0x464a29&&!_0x2f896f){return _0x55579b[_0x33c8('0x12')](0x1f4)[_0x33c8('0x13')]({'message':_0x33c8('0xc6'),'pid':_0xecab0a['pid']});}});})['catch'](handleError(_0x55579b,null));};exports[_0x33c8('0xc7')]=function(_0x40ce09,_0x40c33c){return db[_0x33c8('0xc0')][_0x33c8('0x2e')]({'raw':!![],'attributes':['id'],'where':{'role':_0x33c8('0xc1')}})[_0x33c8('0x22')](function(_0x33243e){var _0x5d0eb2=![];if(!_0x40ce09['body']['ListId']){throw new Error(_0x33c8('0xa7'));}if(!_0x40ce09[_0x33c8('0x35')][_0x33c8('0xc2')][_0x33c8('0x7b')]){throw new Error(_0x33c8('0xb1'));}if(!_0x40ce09[_0x33c8('0x35')]['binding']['firstName']){throw new Error(_0x33c8('0xb3'));}if(!_0x40ce09[_0x33c8('0x35')][_0x33c8('0xab')]){throw new Error(_0x33c8('0xac'));}var _0x14ff15=require('child_process')[_0x33c8('0xb9')](path[_0x33c8('0x3a')](__dirname,_0x33c8('0xc8')),[_0x40ce09[_0x33c8('0x65')]['id'],JSON[_0x33c8('0xc4')](_0x40ce09[_0x33c8('0x35')]),JSON['stringify'](_0x33243e)]);_0x14ff15['on'](_0x33c8('0xc9'),function(){_0x5d0eb2=!![];return _0x40c33c[_0x33c8('0x12')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x14ff15[_0x33c8('0xbc')]});});_0x14ff15['on'](_0x33c8('0xc5'),function(_0x51537f){if(_0x51537f&&!_0x5d0eb2){return _0x40c33c['status'](0x1f4)[_0x33c8('0x13')]({'message':_0x33c8('0xc6'),'pid':_0x14ff15[_0x33c8('0xbc')]});}});})['catch'](handleError(_0x40c33c,null));};exports[_0x33c8('0xca')]=function(_0x48462a,_0x810cfa){var _0x193fbd=[_0x33c8('0xcb'),'chat',_0x33c8('0xcc'),_0x33c8('0xcd'),_0x33c8('0xce'),_0x33c8('0xcf'),_0x33c8('0xd0')];var _0xf39da5={'offset':0x0,'order':qs[_0x33c8('0x85')](_0x33c8('0xd1'))},_0x4a4d20={'count':0x0,'rows':[]};Promise[_0x33c8('0xd2')]()[_0x33c8('0x22')](function(){if(_0x48462a[_0x33c8('0x24')][_0x33c8('0xd3')]){if(!_[_0x33c8('0xd4')](_0x193fbd,_0x48462a[_0x33c8('0x24')]['channel'][_0x33c8('0xd5')]())){throw new Error(_0x33c8('0xd6'));}_0x193fbd=[_0x48462a[_0x33c8('0x24')][_0x33c8('0xd3')][_0x33c8('0xd5')]()];}if(_0x48462a[_0x33c8('0x24')]['range']){try{var _0x4b51d3=JSON[_0x33c8('0xbe')](_0x48462a['query'][_0x33c8('0xd7')]);if(!moment(_0x4b51d3['from'])[_0x33c8('0xd8')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x4b51d3['to'])[_0x33c8('0xd8')]()){throw new Error(_0x33c8('0xd9'));}}catch(_0x3aa9a1){throw new Error(_0x33c8('0xda'));}}if(!_0x48462a[_0x33c8('0x24')][_0x33c8('0x34')](_0x33c8('0x89'))){_0xf39da5[_0x33c8('0x16')]=qs['limit'](_0x48462a[_0x33c8('0x24')][_0x33c8('0x16')]||0xa);_0xf39da5[_0x33c8('0x14')]=qs[_0x33c8('0x14')](_0x48462a[_0x33c8('0x24')][_0x33c8('0x14')]);}var _0x4d1ca3=_0x193fbd[_0x33c8('0x6c')](function(_0x6027cd){if(_0x6027cd===_0x33c8('0xd0')){var _0x3a7592={'attributes':['id',_0x33c8('0xdb'),_0x33c8('0xdc'),'source',_0x33c8('0xdd'),_0x33c8('0xde'),_0x33c8('0xdf'),'endtime',_0x33c8('0xe0'),_0x33c8('0xe1'),_0x33c8('0xe2'),_0x33c8('0xe3'),_0x33c8('0xe4'),_0x33c8('0xe5'),_0x33c8('0xe6')],'where':{'ContactId':_0x48462a[_0x33c8('0x65')]['id']},'include':[{'model':db[_0x33c8('0xc0')],'as':_0x33c8('0xc0'),'attributes':['id',_0x33c8('0x1e'),_0x33c8('0xe7'),_0x33c8('0x2f')]}],'order':[['createdAt','DESC']]};if(_0x48462a[_0x33c8('0x24')][_0x33c8('0xd7')]){_0x3a7592[_0x33c8('0x5c')][_0x33c8('0xe2')]={'$gte':_0x4b51d3[_0x33c8('0x3c')],'$lte':_0x4b51d3['to']};}return db['VoiceCallReport'][_0x33c8('0xe8')](_0x3a7592)[_0x33c8('0x22')](function(_0x253c28){_0x4a4d20[_0x33c8('0x17')]+=_0x253c28[_0x33c8('0x17')];return _['map'](_0x253c28[_0x33c8('0xa1')],function(_0x1181bb){var _0x232169=_0x1181bb[_0x33c8('0x36')]({'plain':!![]});_0x232169[_0x33c8('0xd3')]=_0x6027cd;if(_0x232169[_0x33c8('0xc0')]){_0x232169['User']={'id':_0x232169[_0x33c8('0xc0')]['id'],'name':_0x232169[_0x33c8('0xc0')]['name'],'fullname':_0x232169[_0x33c8('0xc0')][_0x33c8('0xe7')],'alias':_0x232169[_0x33c8('0xc0')][_0x33c8('0x2f')]};}return _0x232169;});});}else{var _0x2c5f1e=_[_0x33c8('0xe9')](_0x6027cd)+(_0x6027cd===_0x33c8('0xea')?_0x33c8('0xeb'):_0x33c8('0xec'));var _0x78aad0={'attributes':['id',_0x33c8('0xed'),_0x33c8('0xee'),'createdAt',_0x33c8('0xe1'),'disposition',_0x33c8('0xef'),_0x33c8('0xf0'),_0x33c8('0xe6'),_0x2c5f1e+'Id'],'where':{'ContactId':_0x48462a[_0x33c8('0x65')]['id']},'include':[{'model':db[_0x2c5f1e],'as':'Account','attributes':['id',_0x33c8('0x1e'),'key']},{'model':db[_0x33c8('0xc0')],'as':_0x33c8('0xf1'),'attributes':['id',_0x33c8('0x1e'),_0x33c8('0xe7')]},{'model':db[_0x33c8('0x7d')],'as':_0x33c8('0xf2'),'attributes':['id',_0x33c8('0x1e'),'color'],'through':{'attributes':[]}}],'order':[[_0x33c8('0xe2'),_0x33c8('0xf3')]]};if(_0x48462a[_0x33c8('0x24')][_0x33c8('0xd7')]){_0x78aad0[_0x33c8('0x5c')]['createdAt']={'$gte':_0x4b51d3[_0x33c8('0x3c')],'$lte':_0x4b51d3['to']};}switch(_0x6027cd){case'chat':_0x78aad0[_0x33c8('0x82')][_0x33c8('0x5e')](_0x33c8('0xf4'),_0x33c8('0xf5'),_0x33c8('0xf6'),_0x33c8('0xf7'),_0x33c8('0xf8'),'ratingMessage',_0x33c8('0xf9'),_0x33c8('0xfa'),_0x33c8('0xfb'));break;case _0x33c8('0xcb'):_0x78aad0['attributes'][_0x33c8('0x5e')]('subject',_0x33c8('0xfc'));break;case _0x33c8('0xcd'):_0x78aad0[_0x33c8('0x82')][_0x33c8('0x5e')](_0x33c8('0xfd'),_0x33c8('0xfe'));break;}return db[_['startCase'](_0x6027cd)+_0x33c8('0xff')]['findAndCountAll'](_0x78aad0)['then'](function(_0x594cc2){_0x4a4d20[_0x33c8('0x17')]+=_0x594cc2[_0x33c8('0x17')];return _[_0x33c8('0x6c')](_0x594cc2['rows'],function(_0x18bb50){var _0x131777=_0x18bb50[_0x33c8('0x36')]({'plain':!![]});_0x131777[_0x33c8('0xd3')]=_0x6027cd;if(_0x131777[_0x33c8('0xf1')]){_0x131777[_0x33c8('0xf1')]={'id':_0x131777[_0x33c8('0xf1')]['id'],'name':_0x131777[_0x33c8('0xf1')]['name'],'fullname':_0x131777[_0x33c8('0xf1')][_0x33c8('0xe7')]};}return _0x131777;});});}});return Promise[_0x33c8('0x62')](_0x4d1ca3);})[_0x33c8('0x22')](function(_0x4f222c){return _(_0x4f222c)[_0x33c8('0x100')]()[_0x33c8('0x101')](_0x33c8('0xe2'))[_0x33c8('0x102')]()[_0x33c8('0x103')]();})[_0x33c8('0x22')](function(_0x3b304a){_0x4a4d20['rows']=_0xf39da5['limit']?_0x3b304a[_0x33c8('0x104')](_0xf39da5[_0x33c8('0x14')],_0xf39da5['offset']+_0xf39da5[_0x33c8('0x16')]):_0x3b304a;return _0x4a4d20;})[_0x33c8('0x22')](respondWithFilteredResult(_0x810cfa,_0xf39da5))['catch'](handleError(_0x810cfa,null));}; \ No newline at end of file +var _0xde97=['customerPort','deviceModel','osName','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','flatten','reverse','slice','moment','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','offset','undefined','limit','count','status','set','Content-Range','json','then','destroy','sendStatus','name','send','describe','getOptions','findAll','query','user','params','catch','CmContact','tags','keys','length','startsWith','cf_','columnName','analytics','CmCustomField','displayName','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','update','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','additionalPhones','each','duplicates','$or','push','where','ListId','all','show','find','Tag','Tags','tag','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','omit','map','cf_%d','timezones','$and','format','table','id\x20=\x20?','text','phone','CmHopper','getTags','findOne','model','filters','intersection','fields','attributes','order','sort','filter','options','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','hopperId','getHoppers','rawAttributes','nolimit','pick','ContactId','rows','include','getHopperFinals','includeAll','getJscriptySessions','JscriptySessionReport','uploadCsv','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','binding_values','split','firstName','root','server/files/tmp','filename','chmodSync','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','meta','import','User','No\x20ListId\x20specified','binding','No\x20phone\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','child_process','../../components/import/cm/csvUpdates','message','exit','getJourney','mail','chat','openchannel','voice','-createdAt','channel','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','callerid','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','VoiceCallReport','findAndCountAll','alias','startCase','Website','Account','closed','closedAt','note','disposition','secondDisposition','thirdDisposition','DESC','browserName','customerIp'];(function(_0x116380,_0x624e55){var _0x218b4d=function(_0x2a3265){while(--_0x2a3265){_0x116380['push'](_0x116380['shift']());}};_0x218b4d(++_0x624e55);}(_0xde97,0x101));var _0x7de9=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xde97[_0x16b1a5];return _0x475e25;};'use strict';var moment=require(_0x7de9('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x7de9('0x1'));var fs=require('fs');var _=require(_0x7de9('0x2'));var squel=require(_0x7de9('0x3'));var Papa=require(_0x7de9('0x4'));var Redis=require(_0x7de9('0x5'));var contacts=require(_0x7de9('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x7de9('0x7'))(_0x7de9('0x8'));var config=require(_0x7de9('0x9'));var shared=require(_0x7de9('0xa'));var db=require(_0x7de9('0xb'))['db'];config[_0x7de9('0xc')]=_[_0x7de9('0xd')](config[_0x7de9('0xc')],{'host':_0x7de9('0xe'),'port':0x18eb});var socket=require(_0x7de9('0xf'))(new Redis(config[_0x7de9('0xc')]));require('./cmContact.socket')[_0x7de9('0x10')](socket);function respondWithResult(_0x217516,_0xfddd95){_0xfddd95=_0xfddd95||0xc8;return function(_0x53040f){if(_0x53040f){return _0x217516['status'](_0xfddd95)['json'](_0x53040f);}};}function respondWithFilteredResult(_0x225371,_0x165910){return function(_0x187162){if(_0x187162){var _0x27355b=typeof _0x165910[_0x7de9('0x11')]===_0x7de9('0x12')&&typeof _0x165910[_0x7de9('0x13')]===_0x7de9('0x12');var _0x3fa40b=_0x187162[_0x7de9('0x14')];var _0x49c22c=_0x27355b?0x0:_0x165910[_0x7de9('0x11')];var _0x31a4ff=_0x27355b?_0x187162[_0x7de9('0x14')]:_0x165910[_0x7de9('0x11')]+_0x165910[_0x7de9('0x13')];var _0x2e1fb2;if(_0x31a4ff>=_0x3fa40b){_0x31a4ff=_0x3fa40b;_0x2e1fb2=0xc8;}else{_0x2e1fb2=0xce;}_0x225371[_0x7de9('0x15')](_0x2e1fb2);return _0x225371[_0x7de9('0x16')](_0x7de9('0x17'),_0x49c22c+'-'+_0x31a4ff+'/'+_0x3fa40b)[_0x7de9('0x18')](_0x187162);}return null;};}function saveUpdates(_0x55d9f4){return function(_0x4fc50d){if(_0x4fc50d){return _0x4fc50d['update'](_0x55d9f4)[_0x7de9('0x19')](function(_0x3f95c3){return _0x3f95c3;});}return null;};}function removeEntity(_0x54edbc){return function(_0x3fabf5){if(_0x3fabf5){return _0x3fabf5[_0x7de9('0x1a')]()[_0x7de9('0x19')](function(){_0x54edbc[_0x7de9('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1b2c){return function(_0x53ad5a){if(!_0x53ad5a){_0x3f1b2c[_0x7de9('0x1b')](0x194);}return _0x53ad5a;};}function handleError(_0xd53779,_0x6d1803){_0x6d1803=_0x6d1803||0x1f4;return function(_0x4a8233){logger['error'](_0x4a8233['stack']);if(_0x4a8233[_0x7de9('0x1c')]){delete _0x4a8233['name'];}_0xd53779[_0x7de9('0x15')](_0x6d1803)[_0x7de9('0x1d')](_0x4a8233);};}exports['index']=function(_0x4bee88,_0x25e945){var _0x45cace={};return contacts[_0x7de9('0x1e')]()['then'](function(_0xf52501){_0x45cace=qs[_0x7de9('0x1f')](_0xf52501,_0x4bee88);return contacts[_0x7de9('0x20')](_0x4bee88[_0x7de9('0x21')],_0x4bee88[_0x7de9('0x22')],_0x45cace,_0xf52501);})[_0x7de9('0x19')](respondWithFilteredResult(_0x25e945,_0x45cace))['catch'](handleError(_0x25e945,null));};exports[_0x7de9('0x1a')]=function(_0x3c6f68,_0x3cd9d9){return db['CmContact']['find']({'where':{'id':_0x3c6f68[_0x7de9('0x23')]['id']}})[_0x7de9('0x19')](handleEntityNotFound(_0x3cd9d9,null))['then'](removeEntity(_0x3cd9d9,null))[_0x7de9('0x24')](handleError(_0x3cd9d9,null));};exports[_0x7de9('0x1e')]=function(_0x4e17df,_0x9ae6bb){return db[_0x7de9('0x25')]['describe']()[_0x7de9('0x19')](function(_0x58f6fc){delete _0x58f6fc[_0x7de9('0x26')];for(var _0xa48576=0x0;_0xa485760x0){return new Promise(function(_0x388051){var _0x37f1b5=[];for(var _0x36aa6b=0x0;_0x36aa6b<_0x35d651[_0x7de9('0x28')];_0x36aa6b++){_0x37f1b5[_0x7de9('0x58')](insertAdditionalPhones(_0x35d651[_0x36aa6b]['contact'],_0x35d651[_0x36aa6b][_0x7de9('0x54')]));}Promise[_0x7de9('0x5b')](_0x37f1b5)[_0x7de9('0x19')](function(){_0x388051(0x1);});})[_0x7de9('0x19')](function(){return{'success':_0x3fb616,'failure':_0x328336,'duplicates':_0x5459bb};});}else{return{'success':_0x3fb616,'failure':_0x328336,'duplicates':_0x5459bb};}}})[_0x7de9('0x19')](respondWithResult(_0x1e2881,0xc9))[_0x7de9('0x24')](handleError(_0x1e2881,null));};exports[_0x7de9('0x5c')]=function(_0x348fc3,_0x55b628){var _0x143741;return db['CmContact'][_0x7de9('0x1e')]()[_0x7de9('0x19')](function(_0x2b0b12){return db[_0x7de9('0x25')][_0x7de9('0x5d')]({'where':{'id':_0x348fc3[_0x7de9('0x23')]['id']},'include':[{'model':db[_0x7de9('0x5e')],'as':_0x7de9('0x5f'),'attributes':['id',_0x7de9('0x1c'),'color'],'required':_0x348fc3[_0x7de9('0x21')][_0x7de9('0x60')]?!![]:![]},{'model':db[_0x7de9('0x47')],'as':'Phones','where':{'CmContactId':_0x348fc3[_0x7de9('0x23')]['id']},'required':![],'include':[{'model':db[_0x7de9('0x61')],'as':_0x7de9('0x62')}]}],'order':[db[_0x7de9('0x63')][_0x7de9('0x64')](_0x7de9('0x65'))],'attributes':_['keys'](_0x2b0b12)});})[_0x7de9('0x19')](function(_0x53f90d){if(!_[_0x7de9('0x51')](_0x53f90d)){_0x143741=_0x53f90d[_0x7de9('0x38')]({'plain':!![]});var _0x20cb4a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x53f90d&&_0x53f90d[_0x7de9('0x5a')]){if(_0x53f90d['ListId']){_0x20cb4a[_0x7de9('0x59')]['$and']['push']({'ListId':{'$ne':_0x53f90d[_0x7de9('0x5a')]}});}}return db[_0x7de9('0x2d')][_0x7de9('0x20')](_0x20cb4a);}})[_0x7de9('0x19')](function(_0x24ae2a){if(!_['isNil'](_0x24ae2a)){return _[_0x7de9('0x66')](_0x143741,_[_0x7de9('0x67')](_0x24ae2a,function(_0x599611){return util['format'](_0x7de9('0x68'),_0x599611['id']);}));}})[_0x7de9('0x19')](handleEntityNotFound(_0x55b628,null))[_0x7de9('0x19')](respondWithResult(_0x55b628,null))[_0x7de9('0x24')](handleError(_0x55b628,null));};exports[_0x7de9('0x3f')]=function(_0x8d292a,_0x546c62){var _0x506da1;if(_0x8d292a[_0x7de9('0x36')]['id']){delete _0x8d292a[_0x7de9('0x36')]['id'];}if(!_[_0x7de9('0x51')](_0x8d292a[_0x7de9('0x36')]['dialTimezone'])){var _0x8d57cb=_0x8d292a[_0x7de9('0x36')]['dialTimezone'];if(!_['isNil'](shared[_0x7de9('0x69')][_0x8d57cb]))_0x8d292a[_0x7de9('0x36')]['utcOffset']=shared[_0x7de9('0x69')][_0x8d57cb][_0x7de9('0x53')];}return db[_0x7de9('0x25')][_0x7de9('0x5d')]({'where':{'id':_0x8d292a[_0x7de9('0x23')]['id']}})[_0x7de9('0x19')](handleEntityNotFound(_0x546c62,null))[_0x7de9('0x19')](saveUpdates(_0x8d292a[_0x7de9('0x36')],null))[_0x7de9('0x19')](function(_0x2f3083){_0x506da1=_0x2f3083;var _0xd720b7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2f3083&&_0x2f3083['ListId']){if(_0x2f3083['ListId']){_0xd720b7[_0x7de9('0x59')][_0x7de9('0x6a')][_0x7de9('0x58')]({'ListId':{'$ne':_0x2f3083['ListId']}});}}return db['CmCustomField'][_0x7de9('0x20')](_0xd720b7);})[_0x7de9('0x19')](function(_0x2aa920){if(_0x2aa920){return _['omit'](_['pickBy'](_0x8d292a[_0x7de9('0x36')],function(_0xd06be9,_0x41b294){return _[_0x7de9('0x29')](_0x41b294,'cf_');}),_[_0x7de9('0x67')](_0x2aa920,function(_0x507d48){return util[_0x7de9('0x6b')]('cf_%d',_0x507d48['id']);}));}})[_0x7de9('0x19')](function(_0x18657e){if(_0x18657e&&!_['isEmpty'](_0x18657e)){var _0x73dc80=squel[_0x7de9('0x3f')]()[_0x7de9('0x6c')]('cm_contacts')['setFields'](_0x18657e)['where'](_0x7de9('0x6d'),_0x8d292a['params']['id'])['toParam']();return db[_0x7de9('0x63')]['query'](_0x73dc80[_0x7de9('0x6e')],{'replacements':_0x73dc80['values']});}})[_0x7de9('0x19')](function(){if(_0x8d292a[_0x7de9('0x36')][_0x7de9('0x6f')]&&_0x506da1){return db[_0x7de9('0x70')][_0x7de9('0x3f')]({'phone':_0x8d292a[_0x7de9('0x36')][_0x7de9('0x6f')],'OrderBy':0x0},{'where':{'ContactId':_0x506da1['id']}});}})[_0x7de9('0x19')](function(){return _0x506da1;})[_0x7de9('0x19')](respondWithResult(_0x546c62,null))['catch'](handleError(_0x546c62,null));};exports[_0x7de9('0x71')]=function(_0x325d54,_0x786be2){var _0x310655={};var _0x32ff87={};var _0x236deb;var _0xf46f79;return db[_0x7de9('0x25')][_0x7de9('0x72')]({'where':{'id':_0x325d54[_0x7de9('0x23')]['id']}})[_0x7de9('0x19')](handleEntityNotFound(_0x786be2,null))[_0x7de9('0x19')](function(_0x5c0004){if(_0x5c0004){_0x236deb=_0x5c0004;_0x32ff87[_0x7de9('0x73')]=_['keys'](db[_0x7de9('0x5e')]['rawAttributes']);_0x32ff87[_0x7de9('0x21')]=_[_0x7de9('0x27')](_0x325d54[_0x7de9('0x21')]);_0x32ff87[_0x7de9('0x74')]=_[_0x7de9('0x75')](_0x32ff87[_0x7de9('0x73')],_0x32ff87[_0x7de9('0x21')]);_0x310655['attributes']=_[_0x7de9('0x75')](_0x32ff87['model'],qs[_0x7de9('0x76')](_0x325d54['query'][_0x7de9('0x76')]));_0x310655[_0x7de9('0x77')]=_0x310655['attributes'][_0x7de9('0x28')]?_0x310655['attributes']:_0x32ff87[_0x7de9('0x73')];_0x310655[_0x7de9('0x78')]=qs['sort'](_0x325d54['query'][_0x7de9('0x79')]);_0x310655['where']=qs['filters'](_['pick'](_0x325d54[_0x7de9('0x21')],_0x32ff87[_0x7de9('0x74')]));if(_0x325d54[_0x7de9('0x21')][_0x7de9('0x7a')]){_0x310655[_0x7de9('0x59')]=_[_0x7de9('0x35')](_0x310655[_0x7de9('0x59')],{'$or':_[_0x7de9('0x67')](_0x310655[_0x7de9('0x77')],function(_0x1d5e94){var _0x1d1eac={};_0x1d1eac[_0x1d5e94]={'$like':'%'+_0x325d54[_0x7de9('0x21')][_0x7de9('0x7a')]+'%'};return _0x1d1eac;})});}_0x310655=_['merge']({},_0x310655,_0x325d54[_0x7de9('0x7b')]);return _0x236deb[_0x7de9('0x71')](_0x310655);}})[_0x7de9('0x19')](function(_0x3a12b9){if(_0x3a12b9){_0xf46f79=_0x3a12b9[_0x7de9('0x28')];if(!_0x325d54[_0x7de9('0x21')][_0x7de9('0x34')]('nolimit')){_0x310655[_0x7de9('0x13')]=qs[_0x7de9('0x13')](_0x325d54['query'][_0x7de9('0x13')]);_0x310655[_0x7de9('0x11')]=qs['offset'](_0x325d54['query']['offset']);}return _0x236deb[_0x7de9('0x71')](_0x310655);}})[_0x7de9('0x19')](function(_0x387c50){if(_0x387c50){return _0x387c50?{'count':_0xf46f79,'rows':_0x387c50}:null;}})[_0x7de9('0x19')](respondWithResult(_0x786be2,null))[_0x7de9('0x24')](handleError(_0x786be2,null));};exports[_0x7de9('0x7c')]=function(_0x29fb51,_0x25a8da){if(_0x29fb51[_0x7de9('0x36')]['id']){delete _0x29fb51[_0x7de9('0x36')]['id'];}return db[_0x7de9('0x25')]['findOne']({'where':{'id':_0x29fb51[_0x7de9('0x23')]['id']}})[_0x7de9('0x19')](handleEntityNotFound(_0x25a8da,null))['then'](function(_0x8a20a2){if(_0x8a20a2){return _0x8a20a2[_0x7de9('0x7c')](_0x29fb51[_0x7de9('0x36')][_0x7de9('0x7d')]||[]);}return null;})[_0x7de9('0x19')](respondWithResult(_0x25a8da,null))[_0x7de9('0x24')](handleError(_0x25a8da,null));};exports[_0x7de9('0x7e')]=function(_0x2b4c4f,_0x41b019){var _0x418f72=[];_0x418f72['push'](addAdditionalPhones(_0x2b4c4f[_0x7de9('0x36')]));Promise[_0x7de9('0x5b')](_0x418f72)[_0x7de9('0x19')](function(){_0x418f72=[];_0x418f72[_0x7de9('0x58')](deleteCmHopperPhones(_0x2b4c4f['body']['id']));_0x418f72[_0x7de9('0x58')](addCmHopperPhones(_0x2b4c4f[_0x7de9('0x36')]['id']));Promise[_0x7de9('0x5b')](_0x418f72)[_0x7de9('0x19')](function(){return[0x1];})[_0x7de9('0x19')](respondWithResult(_0x41b019,null));});};function addAdditionalPhones(_0x4f2926){var _0x515e34;return new Promise(function(_0x1fd77a){return db[_0x7de9('0x47')][_0x7de9('0x1a')]({'where':{'CmContactId':_0x4f2926['id']}})[_0x7de9('0x19')](function(){db['ContactItemType'][_0x7de9('0x20')]({'raw':!![],'attributes':['id',_0x7de9('0x7f')]})[_0x7de9('0x19')](function(_0x3081d6){var _0x584d78=[];for(var _0x2f1e27=0x0;_0x2f1e27<_0x4f2926[_0x7de9('0x80')][_0x7de9('0x28')];_0x2f1e27++){var _0x10f55e=_0x4f2926[_0x7de9('0x81')]?_[_0x7de9('0x51')](_0x4f2926[_0x7de9('0x81')][_0x2f1e27])?'':_0x4f2926[_0x7de9('0x81')][_0x2f1e27]:_0x4f2926[_0x7de9('0x80')][_0x2f1e27][_0x7de9('0x82')]?_0x4f2926[_0x7de9('0x80')][_0x2f1e27][_0x7de9('0x82')]:'';var _0x1f3f8d=_['isNil'](_0x4f2926[_0x7de9('0x80')][_0x2f1e27][_0x7de9('0x83')])?'':_0x4f2926[_0x7de9('0x80')][_0x2f1e27][_0x7de9('0x83')];var _0x122180=_0x10f55e+':'+_0x4f2926[_0x7de9('0x80')][_0x2f1e27][_0x7de9('0x6f')]+'§'+_0x1f3f8d;if(_[_0x7de9('0x51')](_0x515e34))_0x515e34=_0x122180;else _0x515e34+=';'+_0x122180;var _0x4219a2=null;var _0xa2f20a=null;if(_0x4f2926[_0x7de9('0x81')]){if(!_[_0x7de9('0x51')](_0x4f2926[_0x7de9('0x81')][_0x2f1e27])){_0xa2f20a=_[_0x7de9('0x5d')](_0x3081d6,function(_0x13833e){return _0x13833e['id']===_0x4f2926['item_types'][_0x2f1e27];});if(!_[_0x7de9('0x51')](_0xa2f20a)){_0x4219a2=_0xa2f20a['OrderBy'];}}}else{if(!_['isNil'](_0x4f2926[_0x7de9('0x80')][_0x2f1e27])){_0xa2f20a=_[_0x7de9('0x5d')](_0x3081d6,function(_0x2f3875){return _0x2f3875['id']===_0x4f2926['items'][_0x2f1e27]['ItemTypeId'];});if(!_[_0x7de9('0x51')](_0xa2f20a)){_0x4219a2=_0x2f1e27;}}}if(_[_0x7de9('0x51')](_0x4219a2)){_0x4219a2=0x64;}_0x584d78[_0x7de9('0x58')](addAdditionalPhone(_0x4f2926['id'],_0x4f2926[_0x7de9('0x80')][_0x2f1e27][_0x7de9('0x6f')],_0x4f2926[_0x7de9('0x81')]?_[_0x7de9('0x51')](_0x4f2926[_0x7de9('0x81')][_0x2f1e27])?null:_0x4f2926['item_types'][_0x2f1e27]:_0x4f2926['items'][_0x2f1e27][_0x7de9('0x82')]?_0x4f2926[_0x7de9('0x80')][_0x2f1e27][_0x7de9('0x82')]:null,_0x4219a2,_0x1f3f8d));}Promise[_0x7de9('0x5b')](_0x584d78)[_0x7de9('0x19')](function(){db[_0x7de9('0x25')][_0x7de9('0x3f')]({'AdditionalPhones':_0x515e34},{'where':{'id':_0x4f2926['id']}})[_0x7de9('0x19')](function(){_0x1fd77a(0x1);});});});});});}function addAdditionalPhone(_0x466825,_0x1ecf33,_0x64178b,_0x4ba5d7,_0xee238){return db[_0x7de9('0x47')]['find']({'where':{'CmContactId':_0x466825,'item':_0x1ecf33}})[_0x7de9('0x19')](function(_0x1703f6){if(_0x1703f6)logger[_0x7de9('0x31')]('contact\x20phone\x20exists',_0x1703f6);else{db[_0x7de9('0x47')]['create']({'CmContactId':_0x466825,'item':_0x1ecf33,'ItemTypeId':_0x64178b,'OrderBy':_0x4ba5d7,'ItemClass':_0x7de9('0x84'),'description':_0xee238});}});}function deleteCmHopperPhones(_0x1056a7){return new Promise(function(_0x3d4230){return db[_0x7de9('0x70')][_0x7de9('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1056a7}})['then'](function(_0x5f1dc2){db[_0x7de9('0x85')]['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x5f1dc2,'id')}}});})[_0x7de9('0x19')](function(){_0x3d4230(0x1);});});}function addCmHopperPhones(_0xedc9e0){return new Promise(function(_0x596706){return db['CmHopper'][_0x7de9('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xedc9e0}})[_0x7de9('0x19')](function(_0x46f658){var _0x3c8d8f=[];_['map'](_0x46f658,function(_0x138c8d){_0x3c8d8f[_0x7de9('0x58')](createCmHopperPhone(_0xedc9e0,_0x138c8d['id']));});Promise[_0x7de9('0x5b')](_0x3c8d8f)['then'](function(){_0x596706(0x1);});});});}function createCmHopperPhone(_0x4f0c4f,_0x10319a){return new Promise(function(_0x19549a){db['CmContactHasItem'][_0x7de9('0x20')]({'raw':!![],'attributes':[_0x7de9('0x86'),_0x7de9('0x7f')],'where':{'CmContactId':_0x4f0c4f,'ItemClass':_0x7de9('0x84')},'include':[{'model':db[_0x7de9('0x61')],'attributes':[_0x7de9('0x7f')],'as':_0x7de9('0x62')}],'order':['OrderBy',db[_0x7de9('0x63')]['literal'](_0x7de9('0x87'))]})['then'](function(_0x1f35df){var _0x12b122=0x1;var _0x5b7971=_[_0x7de9('0x67')](_0x1f35df,function(_0x2c2b3b){_0x2c2b3b[_0x7de9('0x88')]=_0x10319a;_0x2c2b3b[_0x7de9('0x6f')]=_0x2c2b3b[_0x7de9('0x86')];_0x2c2b3b['OrderBy']=_0x12b122;delete _0x2c2b3b[_0x7de9('0x89')];_0x12b122=_0x12b122+0x1;return _0x2c2b3b;});return db[_0x7de9('0x85')][_0x7de9('0x8a')](_0x5b7971,{});})[_0x7de9('0x19')](function(){_0x19549a(0x1);});});}function insertAdditionalPhones(_0xbe7279,_0x2395e1){return new Promise(function(_0x134878){var _0x4929d4=[];for(var _0x389ed4=0x0;_0x389ed4<_0x2395e1['length'];_0x389ed4++){var _0x2174a1=_0x2395e1[_0x389ed4];_0x4929d4[_0x7de9('0x58')](parseContactItemType(_0x2174a1));}Promise[_0x7de9('0x5b')](_0x4929d4)[_0x7de9('0x19')](function(){var _0x26655a={'id':_0xbe7279['id'],'items':_0x2395e1};return addAdditionalPhones(_0x26655a)[_0x7de9('0x19')](function(){return addCmHopperPhones(_0xbe7279['id']);});})[_0x7de9('0x19')](function(){_0x134878(_0xbe7279);});});}function parseContactItemType(_0x4057be){return new Promise(function(_0x31a78d){if(_0x4057be[_0x7de9('0x34')](_0x7de9('0x82'))){_0x31a78d(_0x4057be);}else{return db[_0x7de9('0x61')]['find']({'where':{'name':_0x4057be[_0x7de9('0x62')]}})['then'](function(_0x56b345){if(_[_0x7de9('0x51')](_0x56b345))_0x4057be[_0x7de9('0x82')]=null;else _0x4057be[_0x7de9('0x82')]=_0x56b345['id'];_0x31a78d(_0x4057be);});}});}exports[_0x7de9('0x8b')]=function(_0x259814,_0x102eb1){return db[_0x7de9('0x47')][_0x7de9('0x20')]({'raw':!![],'where':{'CmContactId':_0x259814[_0x7de9('0x23')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x7de9('0x61')],'as':'ItemType'}],'order':[[_0x7de9('0x7f')],[db[_0x7de9('0x63')][_0x7de9('0x64')](_0x7de9('0x87'))]]})[_0x7de9('0x19')](function(_0x35e1f1){return _0x35e1f1;})[_0x7de9('0x19')](respondWithResult(_0x102eb1,null))['catch'](handleError(_0x102eb1,null));};exports[_0x7de9('0x8c')]=function(_0x5e40f3,_0x529e5c){return db[_0x7de9('0x47')][_0x7de9('0x20')]({'raw':!![],'where':{'CmContactId':_0x5e40f3[_0x7de9('0x36')]['fromContactId']}})[_0x7de9('0x19')](function(_0x5ac6a9){var _0x4d497e=_[_0x7de9('0x67')](_0x5ac6a9,function(_0x4925a9){_0x4925a9[_0x7de9('0x8d')]=_0x5e40f3[_0x7de9('0x36')]['toContactId'];return _0x4925a9;});return db[_0x7de9('0x47')][_0x7de9('0x8a')](_0x4d497e,{});})['then'](function(){return addCmHopperPhones(_0x5e40f3[_0x7de9('0x36')][_0x7de9('0x8e')]);})[_0x7de9('0x19')](function(){return['ok'];})[_0x7de9('0x19')](respondWithResult(_0x529e5c,null))[_0x7de9('0x24')](handleError(_0x529e5c,null));};exports['rescheduleAdditionalPhones']=function(_0xedeacd,_0xbb221b){var _0x418a69=[];_0x418a69[_0x7de9('0x58')](createCmHopperPhone(_0xedeacd['body']['id'],_0xedeacd['body'][_0x7de9('0x8f')]));Promise[_0x7de9('0x5b')](_0x418a69)['then'](function(){return[0x1];})[_0x7de9('0x19')](respondWithResult(_0xbb221b,null));};exports[_0x7de9('0x90')]=function(_0x223bdf,_0xde535d){var _0x256a91={'raw':![],'where':{}};var _0x4c0cfd={};var _0x271b84={'count':0x0,'rows':[]};return db[_0x7de9('0x25')]['findOne']({'where':{'id':_0x223bdf[_0x7de9('0x23')]['id']}})['then'](handleEntityNotFound(_0xde535d,null))['then'](function(_0x36a40c){if(_0x36a40c){_0x4c0cfd['model']=_['keys'](db[_0x7de9('0x70')][_0x7de9('0x91')]);_0x4c0cfd[_0x7de9('0x21')]=_['keys'](_0x223bdf[_0x7de9('0x21')]);_0x4c0cfd[_0x7de9('0x74')]=_[_0x7de9('0x75')](_0x4c0cfd[_0x7de9('0x73')],_0x4c0cfd[_0x7de9('0x21')]);_0x256a91[_0x7de9('0x77')]=_[_0x7de9('0x75')](_0x4c0cfd['model'],qs[_0x7de9('0x76')](_0x223bdf[_0x7de9('0x21')][_0x7de9('0x76')]));_0x256a91[_0x7de9('0x77')]=_0x256a91[_0x7de9('0x77')]['length']?_0x256a91[_0x7de9('0x77')]:_0x4c0cfd[_0x7de9('0x73')];if(!_0x223bdf['query'][_0x7de9('0x34')](_0x7de9('0x92'))){_0x256a91[_0x7de9('0x13')]=qs['limit'](_0x223bdf[_0x7de9('0x21')][_0x7de9('0x13')]);_0x256a91['offset']=qs[_0x7de9('0x11')](_0x223bdf[_0x7de9('0x21')][_0x7de9('0x11')]);}_0x256a91[_0x7de9('0x78')]=qs['sort'](_0x223bdf[_0x7de9('0x21')]['sort']);_0x256a91['where']=qs[_0x7de9('0x74')](_[_0x7de9('0x93')](_0x223bdf[_0x7de9('0x21')],_0x4c0cfd[_0x7de9('0x74')]));_0x256a91[_0x7de9('0x59')][_0x7de9('0x94')]=_0x36a40c['id'];if(_0x223bdf['query']['filter']){_0x256a91[_0x7de9('0x59')]=_[_0x7de9('0x35')](_0x256a91[_0x7de9('0x59')],{'$or':_[_0x7de9('0x67')](_0x256a91[_0x7de9('0x77')],function(_0x9df0a0){var _0x523a72={};_0x523a72[_0x9df0a0]={'$like':'%'+_0x223bdf[_0x7de9('0x21')][_0x7de9('0x7a')]+'%'};return _0x523a72;})});}_0x256a91=_[_0x7de9('0x35')]({},_0x256a91,_0x223bdf[_0x7de9('0x7b')]);return db[_0x7de9('0x70')]['count']({'where':_0x256a91['where']})['then'](function(_0x34fc61){_0x271b84[_0x7de9('0x14')]=_0x34fc61;if(_0x223bdf[_0x7de9('0x21')]['includeAll']){_0x256a91['include']=[{'all':!![]}];}return db[_0x7de9('0x70')][_0x7de9('0x20')](_0x256a91);})[_0x7de9('0x19')](function(_0x236262){_0x271b84[_0x7de9('0x95')]=_0x236262;return _0x271b84;});}})['then'](respondWithFilteredResult(_0xde535d,_0x256a91))[_0x7de9('0x24')](handleError(_0xde535d,null));};exports['getHopperHistories']=function(_0x24e4e1,_0x84d49f){var _0x2fcbd2={'raw':!![],'where':{}};var _0x43d6da={};var _0x58be59={'count':0x0,'rows':[]};return db[_0x7de9('0x25')][_0x7de9('0x72')]({'where':{'id':_0x24e4e1['params']['id']}})[_0x7de9('0x19')](handleEntityNotFound(_0x84d49f,null))['then'](function(_0x1a49f1){if(_0x1a49f1){_0x43d6da['model']=_[_0x7de9('0x27')](db[_0x7de9('0x49')][_0x7de9('0x91')]);_0x43d6da[_0x7de9('0x21')]=_[_0x7de9('0x27')](_0x24e4e1['query']);_0x43d6da[_0x7de9('0x74')]=_[_0x7de9('0x75')](_0x43d6da[_0x7de9('0x73')],_0x43d6da[_0x7de9('0x21')]);_0x2fcbd2[_0x7de9('0x77')]=_[_0x7de9('0x75')](_0x43d6da[_0x7de9('0x73')],qs[_0x7de9('0x76')](_0x24e4e1['query'][_0x7de9('0x76')]));_0x2fcbd2['attributes']=_0x2fcbd2[_0x7de9('0x77')][_0x7de9('0x28')]?_0x2fcbd2[_0x7de9('0x77')]:_0x43d6da[_0x7de9('0x73')];if(!_0x24e4e1['query']['hasOwnProperty']('nolimit')){_0x2fcbd2[_0x7de9('0x13')]=qs[_0x7de9('0x13')](_0x24e4e1[_0x7de9('0x21')][_0x7de9('0x13')]);_0x2fcbd2[_0x7de9('0x11')]=qs[_0x7de9('0x11')](_0x24e4e1[_0x7de9('0x21')][_0x7de9('0x11')]);}_0x2fcbd2[_0x7de9('0x78')]=qs[_0x7de9('0x79')](_0x24e4e1['query']['sort']);_0x2fcbd2['where']=qs[_0x7de9('0x74')](_[_0x7de9('0x93')](_0x24e4e1['query'],_0x43d6da['filters']));_0x2fcbd2[_0x7de9('0x59')]['ContactId']=_0x1a49f1['id'];if(_0x24e4e1[_0x7de9('0x21')]['filter']){_0x2fcbd2['where']=_[_0x7de9('0x35')](_0x2fcbd2[_0x7de9('0x59')],{'$or':_['map'](_0x2fcbd2[_0x7de9('0x77')],function(_0x150838){var _0xb2bcd={};_0xb2bcd[_0x150838]={'$like':'%'+_0x24e4e1['query'][_0x7de9('0x7a')]+'%'};return _0xb2bcd;})});}_0x2fcbd2=_['merge']({},_0x2fcbd2,_0x24e4e1[_0x7de9('0x7b')]);return db[_0x7de9('0x49')][_0x7de9('0x14')]({'where':_0x2fcbd2['where']})[_0x7de9('0x19')](function(_0x19ff51){_0x58be59[_0x7de9('0x14')]=_0x19ff51;if(_0x24e4e1['query']['includeAll']){_0x2fcbd2[_0x7de9('0x96')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7de9('0x20')](_0x2fcbd2);})[_0x7de9('0x19')](function(_0x382eb9){_0x58be59[_0x7de9('0x95')]=_0x382eb9;return _0x58be59;});}})[_0x7de9('0x19')](respondWithFilteredResult(_0x84d49f,_0x2fcbd2))[_0x7de9('0x24')](handleError(_0x84d49f,null));};exports[_0x7de9('0x97')]=function(_0x4814f2,_0x472abe){var _0x16581a={'raw':!![],'where':{}};var _0x5788b6={};var _0x28f469={'count':0x0,'rows':[]};return db['CmContact'][_0x7de9('0x72')]({'where':{'id':_0x4814f2[_0x7de9('0x23')]['id']}})[_0x7de9('0x19')](handleEntityNotFound(_0x472abe,null))[_0x7de9('0x19')](function(_0x1fe601){if(_0x1fe601){_0x5788b6[_0x7de9('0x73')]=_['keys'](db['CmHopperFinal'][_0x7de9('0x91')]);_0x5788b6[_0x7de9('0x21')]=_[_0x7de9('0x27')](_0x4814f2[_0x7de9('0x21')]);_0x5788b6[_0x7de9('0x74')]=_[_0x7de9('0x75')](_0x5788b6['model'],_0x5788b6[_0x7de9('0x21')]);_0x16581a[_0x7de9('0x77')]=_[_0x7de9('0x75')](_0x5788b6[_0x7de9('0x73')],qs[_0x7de9('0x76')](_0x4814f2['query'][_0x7de9('0x76')]));_0x16581a[_0x7de9('0x77')]=_0x16581a[_0x7de9('0x77')][_0x7de9('0x28')]?_0x16581a[_0x7de9('0x77')]:_0x5788b6[_0x7de9('0x73')];if(!_0x4814f2[_0x7de9('0x21')]['hasOwnProperty'](_0x7de9('0x92'))){_0x16581a[_0x7de9('0x13')]=qs[_0x7de9('0x13')](_0x4814f2[_0x7de9('0x21')][_0x7de9('0x13')]);_0x16581a[_0x7de9('0x11')]=qs['offset'](_0x4814f2[_0x7de9('0x21')][_0x7de9('0x11')]);}_0x16581a[_0x7de9('0x78')]=qs[_0x7de9('0x79')](_0x4814f2[_0x7de9('0x21')]['sort']);_0x16581a[_0x7de9('0x59')]=qs[_0x7de9('0x74')](_[_0x7de9('0x93')](_0x4814f2['query'],_0x5788b6[_0x7de9('0x74')]));_0x16581a[_0x7de9('0x59')][_0x7de9('0x94')]=_0x1fe601['id'];if(_0x4814f2['query']['filter']){_0x16581a[_0x7de9('0x59')]=_[_0x7de9('0x35')](_0x16581a[_0x7de9('0x59')],{'$or':_[_0x7de9('0x67')](_0x16581a[_0x7de9('0x77')],function(_0x419612){var _0x5b4f66={};_0x5b4f66[_0x419612]={'$like':'%'+_0x4814f2[_0x7de9('0x21')][_0x7de9('0x7a')]+'%'};return _0x5b4f66;})});}_0x16581a=_[_0x7de9('0x35')]({},_0x16581a,_0x4814f2['options']);return db[_0x7de9('0x48')][_0x7de9('0x14')]({'where':_0x16581a[_0x7de9('0x59')]})[_0x7de9('0x19')](function(_0x2b2b3f){_0x28f469['count']=_0x2b2b3f;if(_0x4814f2[_0x7de9('0x21')][_0x7de9('0x98')]){_0x16581a[_0x7de9('0x96')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7de9('0x20')](_0x16581a);})['then'](function(_0x249926){_0x28f469[_0x7de9('0x95')]=_0x249926;return _0x28f469;});}})[_0x7de9('0x19')](respondWithFilteredResult(_0x472abe,_0x16581a))[_0x7de9('0x24')](handleError(_0x472abe,null));};exports[_0x7de9('0x99')]=function(_0x4c0412,_0x352e97){var _0x39e140={'raw':!![],'where':{}};var _0xc2fc83={};var _0x4b2312={'count':0x0,'rows':[]};return db[_0x7de9('0x25')][_0x7de9('0x72')]({'where':{'id':_0x4c0412[_0x7de9('0x23')]['id']}})[_0x7de9('0x19')](handleEntityNotFound(_0x352e97,null))[_0x7de9('0x19')](function(_0x4174b5){if(_0x4174b5){_0xc2fc83[_0x7de9('0x73')]=_[_0x7de9('0x27')](db[_0x7de9('0x9a')]['rawAttributes']);_0xc2fc83[_0x7de9('0x21')]=_[_0x7de9('0x27')](_0x4c0412['query']);_0xc2fc83['filters']=_['intersection'](_0xc2fc83[_0x7de9('0x73')],_0xc2fc83['query']);_0x39e140[_0x7de9('0x77')]=_[_0x7de9('0x75')](_0xc2fc83[_0x7de9('0x73')],qs['fields'](_0x4c0412[_0x7de9('0x21')]['fields']));_0x39e140[_0x7de9('0x77')]=_0x39e140[_0x7de9('0x77')][_0x7de9('0x28')]?_0x39e140[_0x7de9('0x77')]:_0xc2fc83[_0x7de9('0x73')];if(!_0x4c0412[_0x7de9('0x21')][_0x7de9('0x34')](_0x7de9('0x92'))){_0x39e140[_0x7de9('0x13')]=qs['limit'](_0x4c0412[_0x7de9('0x21')][_0x7de9('0x13')]);_0x39e140['offset']=qs[_0x7de9('0x11')](_0x4c0412['query'][_0x7de9('0x11')]);}_0x39e140[_0x7de9('0x78')]=qs[_0x7de9('0x79')](_0x4c0412[_0x7de9('0x21')]['sort']);_0x39e140[_0x7de9('0x59')]=qs[_0x7de9('0x74')](_[_0x7de9('0x93')](_0x4c0412[_0x7de9('0x21')],_0xc2fc83[_0x7de9('0x74')]));_0x39e140[_0x7de9('0x59')][_0x7de9('0x94')]=_0x4174b5['id'];if(_0x4c0412[_0x7de9('0x21')][_0x7de9('0x7a')]){_0x39e140[_0x7de9('0x59')]=_[_0x7de9('0x35')](_0x39e140['where'],{'$or':_[_0x7de9('0x67')](_0x39e140[_0x7de9('0x77')],function(_0x2066f4){var _0x28ce8b={};_0x28ce8b[_0x2066f4]={'$like':'%'+_0x4c0412['query'][_0x7de9('0x7a')]+'%'};return _0x28ce8b;})});}_0x39e140=_[_0x7de9('0x35')]({},_0x39e140,_0x4c0412['options']);return db['JscriptySessionReport']['count']({'where':_0x39e140[_0x7de9('0x59')]})[_0x7de9('0x19')](function(_0x108c4d){_0x4b2312[_0x7de9('0x14')]=_0x108c4d;if(_0x4c0412[_0x7de9('0x21')][_0x7de9('0x98')]){_0x39e140[_0x7de9('0x96')]=[{'all':!![]}];}return db[_0x7de9('0x9a')]['findAll'](_0x39e140);})[_0x7de9('0x19')](function(_0x4a4156){_0x4b2312[_0x7de9('0x95')]=_0x4a4156;return _0x4b2312;});}})[_0x7de9('0x19')](respondWithFilteredResult(_0x352e97,_0x39e140))['catch'](handleError(_0x352e97,null));};exports[_0x7de9('0x9b')]=function(_0xe774b3,_0x3eec9a){try{if(!_0xe774b3[_0x7de9('0x36')][_0x7de9('0x5a')]){throw new Error('No\x20ListId\x20specified');}if(!_0xe774b3[_0x7de9('0x36')][_0x7de9('0x9c')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0xe774b3[_0x7de9('0x36')]['binding_values']){throw new Error(_0x7de9('0x9d'));}if(!_0xe774b3['body'][_0x7de9('0x9e')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x19cf4b=_0xe774b3['body'][_0x7de9('0x9c')]['split'](',');var _0x55ce93=_0xe774b3[_0x7de9('0x36')][_0x7de9('0x9f')][_0x7de9('0xa0')](',');if(!_0x19cf4b[_0x7de9('0x28')]||!_0x55ce93['length']||_0x19cf4b[_0x7de9('0x28')]!==_0x55ce93[_0x7de9('0x28')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0xe774b3['body']['fields']=_['zipObject'](_0x19cf4b,_0x55ce93);if(!_0xe774b3[_0x7de9('0x36')][_0x7de9('0x76')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xe774b3['body'][_0x7de9('0x76')][_0x7de9('0xa1')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x403533=path[_0x7de9('0x3b')](config[_0x7de9('0xa2')],_0x7de9('0xa3'),_0xe774b3['file'][_0x7de9('0xa4')]);fs[_0x7de9('0xa5')](_0x403533,parseInt('0777',0x8));var _0x20260d=require('child_process')[_0x7de9('0xa6')](path[_0x7de9('0x3b')](__dirname,_0x7de9('0xa7')),[_0x403533,_0xe774b3[_0x7de9('0x36')][_0x7de9('0x9c')],_0xe774b3[_0x7de9('0x36')][_0x7de9('0x9f')],_0xe774b3[_0x7de9('0x36')][_0x7de9('0x5a')],_0xe774b3[_0x7de9('0x36')]['CompanyId'],_0xe774b3[_0x7de9('0x36')][_0x7de9('0x56')],_0xe774b3[_0x7de9('0x36')][_0x7de9('0x9e')]]);return _0x3eec9a[_0x7de9('0x15')](0xc8)[_0x7de9('0x18')]({'message':_0x7de9('0xa8'),'pid':_0x20260d[_0x7de9('0xa9')]});}catch(_0x50186a){return _0x3eec9a[_0x7de9('0x15')](0x1f4)['send'](_0x50186a);}};exports[_0x7de9('0xaa')]=function(_0x589f32,_0x339bb4){var _0x3104e7=fs[_0x7de9('0xab')](_0x589f32[_0x7de9('0xac')]['path']);Papa[_0x7de9('0xad')](_0x3104e7,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x598f8b){return _0x339bb4['status'](0xc8)[_0x7de9('0x18')]({'file':_0x589f32['file'],'fields':_0x598f8b[_0x7de9('0xae')]['fields']});}});};exports[_0x7de9('0xaf')]=function(_0x5929f0,_0x31f459){return db[_0x7de9('0xb0')][_0x7de9('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x29d32d){var _0x2a5ba2=![];if(!_0x5929f0[_0x7de9('0x36')][_0x7de9('0x5a')]){throw new Error(_0x7de9('0xb1'));}if(!_0x5929f0['body'][_0x7de9('0xb2')][_0x7de9('0x6f')]){throw new Error(_0x7de9('0xb3'));}if(!_0x5929f0[_0x7de9('0x36')][_0x7de9('0xb2')][_0x7de9('0xa1')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x5929f0[_0x7de9('0x36')]['socket_timestamp']){throw new Error(_0x7de9('0xb4'));}var _0x19129e=require('child_process')[_0x7de9('0xa6')](path[_0x7de9('0x3b')](__dirname,_0x7de9('0xb5')),[_0x5929f0[_0x7de9('0x23')]['id'],JSON[_0x7de9('0xb6')](_0x5929f0[_0x7de9('0x36')]),JSON[_0x7de9('0xb6')](_0x29d32d)]);_0x19129e['on']('message',function(){_0x2a5ba2=!![];return _0x31f459[_0x7de9('0x15')](0xc8)[_0x7de9('0x18')]({'message':_0x7de9('0xb7'),'pid':_0x19129e[_0x7de9('0xa9')]});});_0x19129e['on']('exit',function(_0x5b4417){if(_0x5b4417&&!_0x2a5ba2){return _0x31f459[_0x7de9('0x15')](0x1f4)[_0x7de9('0x18')]({'message':_0x7de9('0xb8'),'pid':_0x19129e[_0x7de9('0xa9')]});}});})['catch'](handleError(_0x31f459,null));};exports[_0x7de9('0xb9')]=function(_0x38233b,_0x5aae95){return db[_0x7de9('0xb0')][_0x7de9('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x2c53bf){var _0x8eb050=![];if(!_0x38233b[_0x7de9('0x36')][_0x7de9('0x5a')]){throw new Error(_0x7de9('0xb1'));}if(!_0x38233b[_0x7de9('0x36')][_0x7de9('0xb2')][_0x7de9('0x6f')]){throw new Error(_0x7de9('0xb3'));}if(!_0x38233b['body'][_0x7de9('0xb2')][_0x7de9('0xa1')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x38233b['body'][_0x7de9('0x9e')]){throw new Error(_0x7de9('0xb4'));}var _0x17ce54=require(_0x7de9('0xba'))[_0x7de9('0xa6')](path[_0x7de9('0x3b')](__dirname,_0x7de9('0xbb')),[_0x38233b[_0x7de9('0x23')]['id'],JSON[_0x7de9('0xb6')](_0x38233b['body']),JSON[_0x7de9('0xb6')](_0x2c53bf)]);_0x17ce54['on'](_0x7de9('0xbc'),function(){_0x8eb050=!![];return _0x5aae95[_0x7de9('0x15')](0xc8)[_0x7de9('0x18')]({'message':_0x7de9('0xb7'),'pid':_0x17ce54['pid']});});_0x17ce54['on'](_0x7de9('0xbd'),function(_0x2b4db4){if(_0x2b4db4&&!_0x8eb050){return _0x5aae95[_0x7de9('0x15')](0x1f4)[_0x7de9('0x18')]({'message':_0x7de9('0xb8'),'pid':_0x17ce54[_0x7de9('0xa9')]});}});})[_0x7de9('0x24')](handleError(_0x5aae95,null));};exports[_0x7de9('0xbe')]=function(_0xe4537c,_0x137ebd){var _0x41506e=[_0x7de9('0xbf'),_0x7de9('0xc0'),'sms',_0x7de9('0xc1'),'fax','whatsapp',_0x7de9('0xc2')];var _0x476821={'offset':0x0,'order':qs[_0x7de9('0x79')](_0x7de9('0xc3'))},_0x1e9af7={'count':0x0,'rows':[]};Promise['resolve']()[_0x7de9('0x19')](function(){if(_0xe4537c[_0x7de9('0x21')][_0x7de9('0xc4')]){if(!_['includes'](_0x41506e,_0xe4537c['query'][_0x7de9('0xc4')][_0x7de9('0xc5')]())){throw new Error('Invalid\x20channel');}_0x41506e=[_0xe4537c[_0x7de9('0x21')][_0x7de9('0xc4')][_0x7de9('0xc5')]()];}if(_0xe4537c[_0x7de9('0x21')][_0x7de9('0xc6')]){try{var _0x35e99d=JSON[_0x7de9('0xad')](_0xe4537c['query'][_0x7de9('0xc6')]);if(!moment(_0x35e99d[_0x7de9('0x37')])['isValid']()){throw new Error(_0x7de9('0xc7'));}if(!moment(_0x35e99d['to'])[_0x7de9('0xc8')]()){throw new Error(_0x7de9('0xc9'));}}catch(_0x1c8f6e){throw new Error(_0x7de9('0xca'));}}if(!_0xe4537c[_0x7de9('0x21')]['hasOwnProperty'](_0x7de9('0x92'))){_0x476821[_0x7de9('0x13')]=qs[_0x7de9('0x13')](_0xe4537c[_0x7de9('0x21')][_0x7de9('0x13')]||0xa);_0x476821[_0x7de9('0x11')]=qs[_0x7de9('0x11')](_0xe4537c[_0x7de9('0x21')]['offset']);}var _0x1e6e85=_0x41506e[_0x7de9('0x67')](function(_0x3da6c6){if(_0x3da6c6===_0x7de9('0xc2')){var _0x5af7dd={'attributes':['id',_0x7de9('0xcb'),_0x7de9('0x30'),'source','destination',_0x7de9('0xcc'),_0x7de9('0xcd'),_0x7de9('0xce'),_0x7de9('0xcf'),'note',_0x7de9('0xd0'),_0x7de9('0xd1'),_0x7de9('0xd2'),_0x7de9('0xd3'),_0x7de9('0xd4')],'where':{'ContactId':_0xe4537c[_0x7de9('0x23')]['id']},'include':[{'model':db[_0x7de9('0xb0')],'as':_0x7de9('0xb0'),'attributes':['id',_0x7de9('0x1c'),_0x7de9('0xd5'),'alias']}],'order':[[_0x7de9('0xd0'),'DESC']]};if(_0xe4537c[_0x7de9('0x21')]['range']){_0x5af7dd[_0x7de9('0x59')][_0x7de9('0xd0')]={'$gte':_0x35e99d['from'],'$lte':_0x35e99d['to']};}return db[_0x7de9('0xd6')][_0x7de9('0xd7')](_0x5af7dd)['then'](function(_0x2583a4){_0x1e9af7[_0x7de9('0x14')]+=_0x2583a4[_0x7de9('0x14')];return _[_0x7de9('0x67')](_0x2583a4['rows'],function(_0x27758f){var _0x3bff46=_0x27758f['get']({'plain':!![]});_0x3bff46[_0x7de9('0xc4')]=_0x3da6c6;if(_0x3bff46['User']){_0x3bff46['User']={'id':_0x3bff46[_0x7de9('0xb0')]['id'],'name':_0x3bff46['User'][_0x7de9('0x1c')],'fullname':_0x3bff46[_0x7de9('0xb0')]['fullname'],'alias':_0x3bff46[_0x7de9('0xb0')][_0x7de9('0xd8')]};}return _0x3bff46;});});}else{var _0x3b3b01=_[_0x7de9('0xd9')](_0x3da6c6)+(_0x3da6c6==='chat'?_0x7de9('0xda'):_0x7de9('0xdb'));var _0x46b3b1={'attributes':['id',_0x7de9('0xdc'),_0x7de9('0xdd'),_0x7de9('0xd0'),_0x7de9('0xde'),_0x7de9('0xdf'),_0x7de9('0xe0'),_0x7de9('0xe1'),_0x7de9('0xd4'),_0x3b3b01+'Id'],'where':{'ContactId':_0xe4537c['params']['id']},'include':[{'model':db[_0x3b3b01],'as':_0x7de9('0xdb'),'attributes':['id',_0x7de9('0x1c'),'key']},{'model':db[_0x7de9('0xb0')],'as':'Owner','attributes':['id',_0x7de9('0x1c'),_0x7de9('0xd5')]},{'model':db['Tag'],'as':_0x7de9('0x5f'),'attributes':['id',_0x7de9('0x1c'),'color'],'through':{'attributes':[]}}],'order':[[_0x7de9('0xd0'),_0x7de9('0xe2')]]};if(_0xe4537c[_0x7de9('0x21')][_0x7de9('0xc6')]){_0x46b3b1['where'][_0x7de9('0xd0')]={'$gte':_0x35e99d['from'],'$lte':_0x35e99d['to']};}switch(_0x3da6c6){case _0x7de9('0xc0'):_0x46b3b1['attributes']['push'](_0x7de9('0xe3'),_0x7de9('0xe4'),_0x7de9('0xe5'),_0x7de9('0xe6'),_0x7de9('0xe7'),'ratingMessage','ratingType',_0x7de9('0xe8'),_0x7de9('0xe9'));break;case _0x7de9('0xbf'):_0x46b3b1['attributes'][_0x7de9('0x58')](_0x7de9('0xea'),_0x7de9('0xeb'));break;case _0x7de9('0xc1'):_0x46b3b1[_0x7de9('0x77')][_0x7de9('0x58')](_0x7de9('0xec'),_0x7de9('0xed'));break;}return db[_[_0x7de9('0xd9')](_0x3da6c6)+_0x7de9('0xee')][_0x7de9('0xd7')](_0x46b3b1)['then'](function(_0x18e9c0){_0x1e9af7[_0x7de9('0x14')]+=_0x18e9c0['count'];return _[_0x7de9('0x67')](_0x18e9c0['rows'],function(_0x2fc74a){var _0x38f35b=_0x2fc74a[_0x7de9('0x38')]({'plain':!![]});_0x38f35b['channel']=_0x3da6c6;if(_0x38f35b[_0x7de9('0xef')]){_0x38f35b[_0x7de9('0xef')]={'id':_0x38f35b['Owner']['id'],'name':_0x38f35b['Owner']['name'],'fullname':_0x38f35b[_0x7de9('0xef')][_0x7de9('0xd5')]};}return _0x38f35b;});});}});return Promise[_0x7de9('0x5b')](_0x1e6e85);})['then'](function(_0x17ebeb){return _(_0x17ebeb)[_0x7de9('0xf0')]()['sortBy']('createdAt')[_0x7de9('0xf1')]()['value']();})[_0x7de9('0x19')](function(_0x4dc77e){_0x1e9af7[_0x7de9('0x95')]=_0x476821[_0x7de9('0x13')]?_0x4dc77e[_0x7de9('0xf2')](_0x476821[_0x7de9('0x11')],_0x476821[_0x7de9('0x11')]+_0x476821[_0x7de9('0x13')]):_0x4dc77e;return _0x1e9af7;})['then'](respondWithFilteredResult(_0x137ebd,_0x476821))[_0x7de9('0x24')](handleError(_0x137ebd,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 0e68613..dc5b7a5 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 _0xe0e4=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x1cee4e,_0x4eda85){var _0x246bf2=function(_0xfa625d){while(--_0xfa625d){_0x1cee4e['push'](_0x1cee4e['shift']());}};_0x246bf2(++_0x4eda85);}(_0xe0e4,0x6c));var _0x4e0e=function(_0x5415d3,_0x3e4bbe){_0x5415d3=_0x5415d3-0x0;var _0x290a46=_0xe0e4[_0x5415d3];return _0x290a46;};'use strict';var EventEmitter=require(_0x4e0e('0x0'));var CmContact=require(_0x4e0e('0x1'))['db'][_0x4e0e('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x4e0e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4e0e('0x4')};function emitEvent(_0x2c2618){return function(_0x2f31aa,_0xcb2588,_0x4d51c3){CmContactEvents[_0x4e0e('0x5')](_0x2c2618+':'+_0x2f31aa['id'],_0x2f31aa);CmContactEvents['emit'](_0x2c2618,_0x2f31aa);_0x4d51c3(null);};}for(var e in events){if(events[_0x4e0e('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x4e0e('0x7')]=CmContactEvents; \ No newline at end of file +var _0x02e7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','remove'];(function(_0x14150a,_0x29890e){var _0x17170f=function(_0x36fbb8){while(--_0x36fbb8){_0x14150a['push'](_0x14150a['shift']());}};_0x17170f(++_0x29890e);}(_0x02e7,0x138));var _0x702e=function(_0x1125ab,_0x458a46){_0x1125ab=_0x1125ab-0x0;var _0x51db4f=_0x02e7[_0x1125ab];return _0x51db4f;};'use strict';var EventEmitter=require(_0x702e('0x0'));var CmContact=require(_0x702e('0x1'))['db'][_0x702e('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x702e('0x3')](0x0);var events={'afterCreate':_0x702e('0x4'),'afterUpdate':_0x702e('0x5'),'afterDestroy':_0x702e('0x6')};function emitEvent(_0x2eceb5){return function(_0x4e46b5,_0x3606fc,_0x486fe9){CmContactEvents[_0x702e('0x7')](_0x2eceb5+':'+_0x4e46b5['id'],_0x4e46b5);CmContactEvents[_0x702e('0x7')](_0x2eceb5,_0x4e46b5);_0x486fe9(null);};}for(var e in events){if(events[_0x702e('0x8')](e)){var event=events[e];CmContact[_0x702e('0x9')](e,emitEvent(event));}}module[_0x702e('0xa')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 323551e..6d7b16c 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 _0x87c5=['cmContact','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','BlackLists','length','CmHopperBlack','message','Campaign','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','mobile','email','FULLTEXT','utf8mb4_unicode_ci','models','error','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','utcOffset','minutes','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','format','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20'];(function(_0x26fa08,_0x2bfb58){var _0x40c774=function(_0x497e5d){while(--_0x497e5d){_0x26fa08['push'](_0x26fa08['shift']());}};_0x40c774(++_0x2bfb58);}(_0x87c5,0x64));var _0x587c=function(_0x2c3127,_0x5200ca){_0x2c3127=_0x2c3127-0x0;var _0xdd3355=_0x87c5[_0x2c3127];return _0xdd3355;};'use strict';var _=require(_0x587c('0x0'));var util=require(_0x587c('0x1'));var logger=require(_0x587c('0x2'))(_0x587c('0x3'));var moment=require(_0x587c('0x4'));var BPromise=require(_0x587c('0x5'));var rp=require(_0x587c('0x6'));var fs=require('fs');var path=require(_0x587c('0x7'));var rimraf=require(_0x587c('0x8'));var config=require(_0x587c('0x9'));var shared=require(_0x587c('0xa'));var attributes=require('./cmContact.attributes');module[_0x587c('0xb')]=function(_0x4216ef,_0x18ce04){return _0x4216ef[_0x587c('0xc')]('CmContact',attributes,{'tableName':_0x587c('0xd'),'paranoid':!![],'indexes':[{'name':_0x587c('0xe'),'fields':[_0x587c('0xe')]},{'name':_0x587c('0xf'),'fields':[_0x587c('0x10'),'lastName',_0x587c('0xe'),_0x587c('0x11'),'fax',_0x587c('0x12')],'type':_0x587c('0x13')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x587c('0x14'),'hooks':{'afterCreate':function(_0x41b6c2,_0x15a58c,_0x3cbbf4){var _0x32489c=_0x4216ef[_0x587c('0x15')];var _0x109b20=_0x41b6c2['get']({'plain':!![]});function _0x2f64a9(){return function(_0x4cfd4f){logger[_0x587c('0x16')]('cmContact',_0x587c('0x17'),util[_0x587c('0x18')](_0x4cfd4f,{'showHidden':![],'depth':null}));};}function _0x57966e(_0x1cf6af,_0x295d23){var _0x2f866e=_0x295d23[_0x587c('0x19')]?_0x295d23[_0x587c('0x19')]:moment()['format'](_0x587c('0x1a'));return new BPromise(function(_0x1f0052,_0x4b71e7){if(_[_0x587c('0x1b')](_0x295d23[_0x587c('0x1c')])){_0x1f0052({'ret':_0x2f866e});}else{_0x32489c[_0x587c('0x1d')][_0x587c('0x1e')]({'where':{'id':_0x1cf6af['id']}})[_0x587c('0x1f')](function(_0x2baff9){if(!_[_0x587c('0x1b')](_0x2baff9)){var _0x332d76=_0x2baff9[_0x587c('0x1c')];if(!_['isNil'](_0x332d76)){var _0x1a29b2=shared['timezones'];var _0x22daeb=_0x1a29b2[_0x332d76];var _0x4b9ce5=_0x1a29b2[_0x295d23[_0x587c('0x1c')]];if(!_[_0x587c('0x1b')](_0x22daeb)&&!_[_0x587c('0x1b')](_0x4b9ce5)){var _0x1f9f68=_0x22daeb[_0x587c('0x20')]-_0x4b9ce5[_0x587c('0x20')];_0x2f866e=_0x295d23[_0x587c('0x19')]?_0x295d23[_0x587c('0x19')]:moment();var _0x4b355b=moment(_0x2f866e)['add'](_0x1f9f68,_0x587c('0x21'));_0x1f0052({'ret':_0x4b355b['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x1f0052({'ret':_0x2f866e});}else _0x1f0052({'ret':_0x2f866e});}else{_0x1f0052({'ret':_0x2f866e});}});}});return 0xa;}var _0x1d9242=function(_0x140a97){return new BPromise(function(_0x15843e,_0x58599c){_0x57966e(_0x140a97,_0x109b20)[_0x587c('0x1f')](function(_0x585bba){_0x109b20[_0x587c('0x19')]=_0x585bba['ret'];_0x32489c[_0x587c('0x22')]['findOne']({'where':{'phone':_0x109b20[_0x587c('0xe')],'VoiceQueueId':_0x140a97['id']}})['then'](function(_0x16bbde){if(!_[_0x587c('0x1b')](_0x16bbde)){throw new Error(_0x587c('0x23')+_0x109b20[_0x587c('0xe')]+_0x587c('0x24')+_0x140a97['id']);}return _0x32489c[_0x587c('0x22')][_0x587c('0x25')]({'phone':_0x109b20[_0x587c('0xe')],'ContactId':_0x109b20['id'],'ListId':_0x109b20[_0x587c('0x26')],'priority':_0x109b20[_0x587c('0x27')]?_0x109b20[_0x587c('0x27')]:0x2,'scheduledat':_0x109b20[_0x587c('0x19')]?_0x109b20[_0x587c('0x19')]:moment()[_0x587c('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x109b20[_0x587c('0x29')]?!![]:![],'callbackuniqueid':_0x109b20[_0x587c('0x29')]?_0x109b20[_0x587c('0x29')]:undefined,'callbackat':_0x109b20[_0x587c('0x29')]?moment()['format'](_0x587c('0x1a')):undefined,'VoiceQueueId':_0x140a97['id']});})[_0x587c('0x2a')](function(_0x1adf00){_0x58599c(_0x1adf00);});});});};var _0x11d998=function(_0x306002){return new BPromise(function(_0x24af2a,_0x1e9fe3){_0x57966e(_0x306002,_0x109b20)[_0x587c('0x1f')](function(_0x36febd){_0x109b20[_0x587c('0x19')]=_0x36febd[_0x587c('0x2b')];_0x32489c['CmHopper'][_0x587c('0x1e')]({'where':{'phone':_0x109b20['phone'],'VoiceQueueId':_0x306002['id']}})[_0x587c('0x1f')](function(_0x189d96){if(!_[_0x587c('0x1b')](_0x189d96)){throw new Error(_0x587c('0x23')+_0x109b20[_0x587c('0xe')]+_0x587c('0x2c')+_0x306002['id']);}return _0x32489c['CmHopperFinal'][_0x587c('0x1e')]({'where':{'calleridnum':_0x109b20[_0x587c('0xe')],'VoiceQueueId':_0x306002['id']}});})[_0x587c('0x1f')](function(_0x50acd0){if(!_[_0x587c('0x1b')](_0x50acd0)){throw new Error(_0x587c('0x2d')+_0x109b20['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x306002['id']);}return _0x32489c['CmHopper'][_0x587c('0x25')]({'phone':_0x109b20['phone'],'ContactId':_0x109b20['id'],'ListId':_0x109b20[_0x587c('0x26')],'priority':_0x109b20[_0x587c('0x27')]?_0x109b20[_0x587c('0x27')]:0x2,'scheduledat':_0x109b20[_0x587c('0x19')]?_0x109b20[_0x587c('0x19')]:moment()[_0x587c('0x28')](_0x587c('0x1a')),'callback':_0x109b20[_0x587c('0x29')]?!![]:![],'callbackuniqueid':_0x109b20[_0x587c('0x29')]?_0x109b20[_0x587c('0x29')]:undefined,'callbackat':_0x109b20['callbackUniqueid']?moment()[_0x587c('0x28')](_0x587c('0x1a')):undefined,'VoiceQueueId':_0x306002['id']});})[_0x587c('0x2a')](function(_0x263650){_0x1e9fe3(_0x263650);});});});};function _0x38f4e4(){return function(_0x358689){logger['error'](_0x587c('0x2e'),_0x587c('0x17'),util[_0x587c('0x18')](_0x358689,{'showHidden':![],'depth':null}));};}function _0x3577f8(_0x4be4d1,_0x5c002c){var _0x25c4fe=_0x5c002c['scheduledat']?_0x5c002c[_0x587c('0x19')]:moment()['format'](_0x587c('0x1a'));return new BPromise(function(_0x368212,_0x4d74de){if(_[_0x587c('0x1b')](_0x5c002c['dialTimezone'])){_0x368212({'ret':_0x25c4fe});}else{_0x32489c['Campaign'][_0x587c('0x1e')]({'where':{'id':_0x4be4d1['id']}})[_0x587c('0x1f')](function(_0x19b42e){if(!_[_0x587c('0x1b')](_0x19b42e)){var _0x3ae654=_0x19b42e[_0x587c('0x1c')];if(!_[_0x587c('0x1b')](_0x3ae654)){var _0xe5f3e4=shared['timezones'];var _0x5e36da=_0xe5f3e4[_0x3ae654];var _0x22c326=_0xe5f3e4[_0x5c002c[_0x587c('0x1c')]];if(!_[_0x587c('0x1b')](_0x5e36da)&&!_['isNil'](_0x22c326)){var _0x4d3265=_0x5e36da[_0x587c('0x20')]-_0x22c326[_0x587c('0x20')];_0x25c4fe=_0x5c002c[_0x587c('0x19')]?_0x5c002c[_0x587c('0x19')]:moment();var _0x1f81be=moment(_0x25c4fe)[_0x587c('0x2f')](_0x4d3265,_0x587c('0x21'));_0x368212({'ret':_0x1f81be['format'](_0x587c('0x1a'))});}else _0x368212({'ret':_0x25c4fe});}else _0x368212({'ret':_0x25c4fe});}else{_0x368212({'ret':_0x25c4fe});}});}});return 0xa;}var _0x5b9c75=function(_0x1eabba){return new BPromise(function(_0x38b8e6,_0x3717b9){_0x3577f8(_0x1eabba,_0x109b20)['then'](function(_0x16e990){_0x109b20[_0x587c('0x19')]=_0x16e990[_0x587c('0x2b')];_0x32489c[_0x587c('0x22')][_0x587c('0x1e')]({'where':{'phone':_0x109b20[_0x587c('0xe')],'CampaignId':_0x1eabba['id']}})[_0x587c('0x1f')](function(_0x2e8cd3){if(!_[_0x587c('0x1b')](_0x2e8cd3)){throw new Error('cmContact,\x20afterCreate\x20'+_0x109b20[_0x587c('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x1eabba['id']);}return _0x32489c['CmHopper'][_0x587c('0x25')]({'phone':_0x109b20[_0x587c('0xe')],'ContactId':_0x109b20['id'],'ListId':_0x109b20[_0x587c('0x26')],'priority':_0x109b20['priority']?_0x109b20[_0x587c('0x27')]:0x2,'scheduledat':_0x109b20[_0x587c('0x19')]?_0x109b20['scheduledat']:moment()[_0x587c('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x109b20[_0x587c('0x29')]?!![]:![],'callbackuniqueid':_0x109b20[_0x587c('0x29')]?_0x109b20['callbackUniqueid']:undefined,'callbackat':_0x109b20['callbackUniqueid']?moment()[_0x587c('0x28')](_0x587c('0x1a')):undefined,'CampaignId':_0x1eabba['id']});})[_0x587c('0x2a')](function(_0x528472){_0x3717b9(_0x528472);});});});};var _0x11fafd=function(_0x7d2a50){return new BPromise(function(_0x3f4aca,_0x3038e0){_0x3577f8(_0x7d2a50,_0x109b20)[_0x587c('0x1f')](function(_0x263c41){_0x109b20['scheduledat']=_0x263c41['ret'];_0x32489c[_0x587c('0x22')][_0x587c('0x1e')]({'where':{'phone':_0x109b20[_0x587c('0xe')],'CampaignId':_0x7d2a50['id']}})[_0x587c('0x1f')](function(_0x379ea5){if(!_[_0x587c('0x1b')](_0x379ea5)){throw new Error(_0x587c('0x23')+_0x109b20[_0x587c('0xe')]+_0x587c('0x30')+_0x7d2a50['id']);}return _0x32489c[_0x587c('0x31')]['findOne']({'where':{'calleridnum':_0x109b20[_0x587c('0xe')],'CampaignId':_0x7d2a50['id']}});})[_0x587c('0x1f')](function(_0x46e3b3){if(!_['isNil'](_0x46e3b3)){throw new Error(_0x587c('0x2d')+_0x109b20['phone']+_0x587c('0x32')+_0x7d2a50['id']);}return _0x32489c[_0x587c('0x22')][_0x587c('0x25')]({'phone':_0x109b20[_0x587c('0xe')],'ContactId':_0x109b20['id'],'ListId':_0x109b20[_0x587c('0x26')],'priority':_0x109b20[_0x587c('0x27')]?_0x109b20['priority']:0x2,'scheduledat':_0x109b20[_0x587c('0x19')]?_0x109b20[_0x587c('0x19')]:moment()['format'](_0x587c('0x1a')),'callback':_0x109b20[_0x587c('0x29')]?!![]:![],'callbackuniqueid':_0x109b20['callbackUniqueid']?_0x109b20[_0x587c('0x29')]:undefined,'callbackat':_0x109b20['callbackUniqueid']?moment()[_0x587c('0x28')](_0x587c('0x1a')):undefined,'CampaignId':_0x7d2a50['id']});})['catch'](function(_0x49f841){_0x3038e0(_0x49f841);});});});};if(_0x109b20[_0x587c('0x26')]){_0x32489c['VoiceQueue'][_0x587c('0x33')]({'where':{'type':_0x587c('0x34')},'attributes':['id',_0x587c('0x35'),_0x587c('0x1c')],'include':[{'model':_0x32489c[_0x587c('0x36')],'as':_0x587c('0x37'),'where':{'id':_0x109b20['ListId']}}]})['then'](function(_0x37933f){if(_0x37933f){var _0x141e23=[];for(var _0x2907a4=0x0,_0x4abc65;_0x2907a4<_0x37933f['length'];_0x2907a4+=0x1){_0x4abc65=_0x37933f[_0x2907a4][_0x587c('0x38')]({'plain':!![]});switch(_0x4abc65[_0x587c('0x35')]){case _0x587c('0x39'):_0x11d998(_0x4abc65)['catch'](_0x2f64a9());break;case'onlyIfOpen':_0x1d9242(_0x4abc65)[_0x587c('0x2a')](_0x2f64a9());break;default:_0x3577f8(_0x4abc65,_0x109b20)[_0x587c('0x1f')](function(_0x3be2e3){_0x109b20[_0x587c('0x19')]=_0x3be2e3[_0x587c('0x2b')];_0x32489c[_0x587c('0x22')]['create']({'phone':_0x109b20[_0x587c('0xe')],'ContactId':_0x109b20['id'],'ListId':_0x109b20[_0x587c('0x26')],'scheduledat':_0x109b20[_0x587c('0x19')]?_0x109b20[_0x587c('0x19')]:moment()[_0x587c('0x28')](_0x587c('0x1a')),'priority':_0x109b20['priority']?_0x109b20[_0x587c('0x27')]:0x2,'callback':_0x109b20[_0x587c('0x29')]?!![]:![],'callbackuniqueid':_0x109b20[_0x587c('0x29')]?_0x109b20[_0x587c('0x29')]:undefined,'callbackat':_0x109b20[_0x587c('0x29')]?moment()[_0x587c('0x28')](_0x587c('0x1a')):undefined,'VoiceQueueId':_0x4abc65['id']})['catch'](_0x2f64a9());});}}}})['then'](function(){return _0x32489c[_0x587c('0x1d')][_0x587c('0x33')]({'where':{'type':_0x587c('0x34')},'attributes':['id'],'include':[{'model':_0x32489c['CmList'],'as':_0x587c('0x3a'),'where':{'id':_0x109b20[_0x587c('0x26')]}}]})[_0x587c('0x1f')](function(_0x4ed98c){if(_0x4ed98c){var _0x96c74e=[];for(var _0x7c83e2=0x0,_0xb1be7c;_0x7c83e2<_0x4ed98c[_0x587c('0x3b')];_0x7c83e2+=0x1){_0xb1be7c=_0x4ed98c[_0x7c83e2][_0x587c('0x38')]({'plain':!![]});_0x32489c[_0x587c('0x3c')]['create']({'phone':_0x109b20[_0x587c('0xe')],'ContactId':_0x109b20['id'],'ListId':_0x109b20[_0x587c('0x26')],'VoiceQueueId':_0xb1be7c['id']})[_0x587c('0x2a')](function(_0x1b2aad){logger[_0x587c('0x16')]('cmContact,\x20%s,\x20%s',_0x587c('0x17'),_0x1b2aad[_0x587c('0x3d')]);});}}});})[_0x587c('0x1f')](function(){return _0x32489c[_0x587c('0x3e')][_0x587c('0x33')]({'attributes':['id','dialCheckDuplicateType',_0x587c('0x1c')],'include':[{'model':_0x32489c[_0x587c('0x36')],'as':_0x587c('0x37'),'where':{'id':_0x109b20['ListId']}}]})[_0x587c('0x1f')](function(_0x1394e4){if(_0x1394e4){var _0x5de13e=[];for(var _0x48d9d8=0x0,_0x9571cb;_0x48d9d8<_0x1394e4[_0x587c('0x3b')];_0x48d9d8+=0x1){_0x9571cb=_0x1394e4[_0x48d9d8][_0x587c('0x38')]({'plain':!![]});switch(_0x9571cb['dialCheckDuplicateType']){case _0x587c('0x39'):_0x11fafd(_0x9571cb)[_0x587c('0x2a')](_0x38f4e4());break;case'onlyIfOpen':_0x5b9c75(_0x9571cb)[_0x587c('0x2a')](_0x38f4e4());break;default:_0x32489c[_0x587c('0x22')]['create']({'phone':_0x109b20[_0x587c('0xe')],'ContactId':_0x109b20['id'],'ListId':_0x109b20[_0x587c('0x26')],'scheduledat':_0x109b20[_0x587c('0x19')]?_0x109b20[_0x587c('0x19')]:moment()[_0x587c('0x28')](_0x587c('0x1a')),'priority':_0x109b20[_0x587c('0x27')]?_0x109b20[_0x587c('0x27')]:0x2,'callback':_0x109b20['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x109b20[_0x587c('0x29')]?_0x109b20[_0x587c('0x29')]:undefined,'callbackat':_0x109b20[_0x587c('0x29')]?moment()['format'](_0x587c('0x1a')):undefined,'CampaignId':_0x9571cb['id']})[_0x587c('0x2a')](_0x38f4e4());}}}});})['then'](function(){return _0x32489c[_0x587c('0x3e')][_0x587c('0x33')]({'attributes':['id'],'include':[{'model':_0x32489c[_0x587c('0x36')],'as':_0x587c('0x3a'),'where':{'id':_0x109b20['ListId']}}]})[_0x587c('0x1f')](function(_0x57f7d4){if(_0x57f7d4){var _0x5ec5a5=[];for(var _0xc360c7=0x0,_0x54387b;_0xc360c7<_0x57f7d4[_0x587c('0x3b')];_0xc360c7+=0x1){_0x54387b=_0x57f7d4[_0xc360c7][_0x587c('0x38')]({'plain':!![]});_0x32489c[_0x587c('0x3c')]['create']({'phone':_0x109b20[_0x587c('0xe')],'ContactId':_0x109b20['id'],'ListId':_0x109b20[_0x587c('0x26')],'CampaignId':_0x54387b['id']})['catch'](function(_0x2675b7){logger[_0x587c('0x16')](_0x587c('0x3f'),'afterCreate',_0x2675b7[_0x587c('0x3d')]);});}}});})[_0x587c('0x1f')](function(){_0x3cbbf4();})['catch'](function(_0x24a3a7){logger[_0x587c('0x16')]('cmContact,\x20%s,\x20%s','afterCreate',_0x24a3a7[_0x587c('0x3d')]);_0x3cbbf4(_0x24a3a7);});}else{_0x3cbbf4(new Error(_0x587c('0x40')));}},'afterDestroy':function(_0x373055,_0xb20808,_0x3aba46){var _0x25c98c=_0x4216ef[_0x587c('0x15')];var _0x5107aa=_0x373055['get']({'plain':!![]});return _0x25c98c[_0x587c('0x22')][_0x587c('0x33')]({'raw':!![],'where':{'ListId':_0x5107aa[_0x587c('0x26')],'ContactId':_0x5107aa['id']}})[_0x587c('0x1f')](function(_0x1936b6){if(!_[_0x587c('0x41')](_0x1936b6)){var _0x214a79=[];for(var _0x221616=0x0;_0x221616<_0x1936b6[_0x587c('0x3b')];_0x221616+=0x1){var _0x1906e=_0x25c98c[_0x587c('0x22')]['destroy']({'where':{'ListId':_0x1936b6[_0x221616][_0x587c('0x26')],'ContactId':_0x1936b6[_0x221616]['ContactId'],'VoiceQueueId':_0x1936b6[_0x221616][_0x587c('0x42')],'CampaignId':_0x1936b6[_0x221616][_0x587c('0x43')]}});_0x214a79[_0x587c('0x44')](_0x1906e);}return BPromise[_0x587c('0x45')](_0x214a79);}})[_0x587c('0x1f')](function(_0xa664ae){logger[_0x587c('0x46')](_0x587c('0x47'),util[_0x587c('0x18')](_0xa664ae,{'showHidden':![],'depth':null}));_0x3aba46();})[_0x587c('0x2a')](function(_0x1e2f63){logger[_0x587c('0x16')](_0x587c('0x48'),util[_0x587c('0x18')](_0x1e2f63,{'showHidden':![],'depth':null}));_0x3aba46(_0x1e2f63);});}}});}; \ No newline at end of file +var _0x3aaa=['fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','timezones','utcOffset','add','minutes','then','ret','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','findAll','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','CmContact','phone'];(function(_0x42670a,_0xb30029){var _0x32951c=function(_0x3a78df){while(--_0x3a78df){_0x42670a['push'](_0x42670a['shift']());}};_0x32951c(++_0xb30029);}(_0x3aaa,0xd1));var _0xa3aa=function(_0xcc603e,_0x23fa76){_0xcc603e=_0xcc603e-0x0;var _0x479d07=_0x3aaa[_0xcc603e];return _0x479d07;};'use strict';var _=require(_0xa3aa('0x0'));var util=require('util');var logger=require(_0xa3aa('0x1'))(_0xa3aa('0x2'));var moment=require(_0xa3aa('0x3'));var BPromise=require(_0xa3aa('0x4'));var rp=require(_0xa3aa('0x5'));var fs=require('fs');var path=require(_0xa3aa('0x6'));var rimraf=require(_0xa3aa('0x7'));var config=require(_0xa3aa('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0xa3aa('0x9'));module[_0xa3aa('0xa')]=function(_0xe5222e,_0x5abc85){return _0xe5222e['define'](_0xa3aa('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0xa3aa('0xc')]},{'name':_0xa3aa('0xd'),'fields':[_0xa3aa('0xe'),'lastName',_0xa3aa('0xc'),_0xa3aa('0xf'),_0xa3aa('0x10'),_0xa3aa('0x11')],'type':_0xa3aa('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xf3ec95,_0x1d98a5,_0x1fefd3){var _0x2d56d7=_0xe5222e['models'];var _0x4d9f7a=_0xf3ec95[_0xa3aa('0x13')]({'plain':!![]});function _0x314df2(){return function(_0x330e2d){logger[_0xa3aa('0x14')]('cmContact',_0xa3aa('0x15'),util[_0xa3aa('0x16')](_0x330e2d,{'showHidden':![],'depth':null}));};}function _0x1a4dd0(_0x32ab80,_0x3a5e27){var _0x551228=_0x3a5e27[_0xa3aa('0x17')]?_0x3a5e27[_0xa3aa('0x17')]:moment()[_0xa3aa('0x18')](_0xa3aa('0x19'));return new BPromise(function(_0x4937fc,_0x2e6f01){if(_[_0xa3aa('0x1a')](_0x3a5e27[_0xa3aa('0x1b')])){_0x4937fc({'ret':_0x551228});}else{_0x2d56d7[_0xa3aa('0x1c')]['findOne']({'where':{'id':_0x32ab80['id']}})['then'](function(_0x54f6c8){if(!_[_0xa3aa('0x1a')](_0x54f6c8)){var _0x1cc7a2=_0x54f6c8[_0xa3aa('0x1b')];if(!_[_0xa3aa('0x1a')](_0x1cc7a2)){var _0x1c1af1=shared[_0xa3aa('0x1d')];var _0x1eefc5=_0x1c1af1[_0x1cc7a2];var _0x44f1d1=_0x1c1af1[_0x3a5e27[_0xa3aa('0x1b')]];if(!_['isNil'](_0x1eefc5)&&!_[_0xa3aa('0x1a')](_0x44f1d1)){var _0x90a63b=_0x1eefc5[_0xa3aa('0x1e')]-_0x44f1d1[_0xa3aa('0x1e')];_0x551228=_0x3a5e27[_0xa3aa('0x17')]?_0x3a5e27[_0xa3aa('0x17')]:moment();var _0x238c1c=moment(_0x551228)[_0xa3aa('0x1f')](_0x90a63b,_0xa3aa('0x20'));_0x4937fc({'ret':_0x238c1c['format'](_0xa3aa('0x19'))});}else _0x4937fc({'ret':_0x551228});}else _0x4937fc({'ret':_0x551228});}else{_0x4937fc({'ret':_0x551228});}});}});return 0xa;}var _0x23b06b=function(_0x3eeb71){return new BPromise(function(_0x53cef6,_0x1820ff){_0x1a4dd0(_0x3eeb71,_0x4d9f7a)[_0xa3aa('0x21')](function(_0x52373d){_0x4d9f7a[_0xa3aa('0x17')]=_0x52373d[_0xa3aa('0x22')];_0x2d56d7['CmHopper'][_0xa3aa('0x23')]({'where':{'phone':_0x4d9f7a[_0xa3aa('0xc')],'VoiceQueueId':_0x3eeb71['id']}})[_0xa3aa('0x21')](function(_0x187bc0){if(!_[_0xa3aa('0x1a')](_0x187bc0)){throw new Error(_0xa3aa('0x24')+_0x4d9f7a[_0xa3aa('0xc')]+_0xa3aa('0x25')+_0x3eeb71['id']);}return _0x2d56d7[_0xa3aa('0x26')][_0xa3aa('0x27')]({'phone':_0x4d9f7a[_0xa3aa('0xc')],'ContactId':_0x4d9f7a['id'],'ListId':_0x4d9f7a[_0xa3aa('0x28')],'priority':_0x4d9f7a[_0xa3aa('0x29')]?_0x4d9f7a[_0xa3aa('0x29')]:0x2,'scheduledat':_0x4d9f7a[_0xa3aa('0x17')]?_0x4d9f7a['scheduledat']:moment()['format'](_0xa3aa('0x19')),'callback':_0x4d9f7a[_0xa3aa('0x2a')]?!![]:![],'callbackuniqueid':_0x4d9f7a[_0xa3aa('0x2a')]?_0x4d9f7a[_0xa3aa('0x2a')]:undefined,'callbackat':_0x4d9f7a[_0xa3aa('0x2a')]?moment()[_0xa3aa('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3eeb71['id']});})[_0xa3aa('0x2b')](function(_0x5db88e){_0x1820ff(_0x5db88e);});});});};var _0x11e060=function(_0x389ec1){return new BPromise(function(_0x4120f5,_0x30d2d0){_0x1a4dd0(_0x389ec1,_0x4d9f7a)['then'](function(_0xe8a1b7){_0x4d9f7a[_0xa3aa('0x17')]=_0xe8a1b7[_0xa3aa('0x22')];_0x2d56d7[_0xa3aa('0x26')][_0xa3aa('0x23')]({'where':{'phone':_0x4d9f7a[_0xa3aa('0xc')],'VoiceQueueId':_0x389ec1['id']}})[_0xa3aa('0x21')](function(_0x4945a9){if(!_[_0xa3aa('0x1a')](_0x4945a9)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4d9f7a[_0xa3aa('0xc')]+_0xa3aa('0x2c')+_0x389ec1['id']);}return _0x2d56d7[_0xa3aa('0x2d')]['findOne']({'where':{'calleridnum':_0x4d9f7a[_0xa3aa('0xc')],'VoiceQueueId':_0x389ec1['id']}});})[_0xa3aa('0x21')](function(_0x55a219){if(!_[_0xa3aa('0x1a')](_0x55a219)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4d9f7a['phone']+_0xa3aa('0x2e')+_0x389ec1['id']);}return _0x2d56d7[_0xa3aa('0x26')][_0xa3aa('0x27')]({'phone':_0x4d9f7a[_0xa3aa('0xc')],'ContactId':_0x4d9f7a['id'],'ListId':_0x4d9f7a[_0xa3aa('0x28')],'priority':_0x4d9f7a['priority']?_0x4d9f7a['priority']:0x2,'scheduledat':_0x4d9f7a[_0xa3aa('0x17')]?_0x4d9f7a[_0xa3aa('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4d9f7a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4d9f7a[_0xa3aa('0x2a')]?_0x4d9f7a['callbackUniqueid']:undefined,'callbackat':_0x4d9f7a[_0xa3aa('0x2a')]?moment()[_0xa3aa('0x18')](_0xa3aa('0x19')):undefined,'VoiceQueueId':_0x389ec1['id']});})[_0xa3aa('0x2b')](function(_0x594eb4){_0x30d2d0(_0x594eb4);});});});};function _0x32c3c1(){return function(_0x1ebb7e){logger['error']('cmContact',_0xa3aa('0x15'),util[_0xa3aa('0x16')](_0x1ebb7e,{'showHidden':![],'depth':null}));};}function _0x432d55(_0xdb91d5,_0x49cf83){var _0x529f9a=_0x49cf83['scheduledat']?_0x49cf83['scheduledat']:moment()[_0xa3aa('0x18')](_0xa3aa('0x19'));return new BPromise(function(_0x45f715,_0x218a0c){if(_[_0xa3aa('0x1a')](_0x49cf83['dialTimezone'])){_0x45f715({'ret':_0x529f9a});}else{_0x2d56d7[_0xa3aa('0x2f')][_0xa3aa('0x23')]({'where':{'id':_0xdb91d5['id']}})[_0xa3aa('0x21')](function(_0x58d4aa){if(!_[_0xa3aa('0x1a')](_0x58d4aa)){var _0x416efe=_0x58d4aa[_0xa3aa('0x1b')];if(!_[_0xa3aa('0x1a')](_0x416efe)){var _0x595fd9=shared[_0xa3aa('0x1d')];var _0x58fd58=_0x595fd9[_0x416efe];var _0x48f0c3=_0x595fd9[_0x49cf83[_0xa3aa('0x1b')]];if(!_[_0xa3aa('0x1a')](_0x58fd58)&&!_['isNil'](_0x48f0c3)){var _0x29a02a=_0x58fd58[_0xa3aa('0x1e')]-_0x48f0c3[_0xa3aa('0x1e')];_0x529f9a=_0x49cf83[_0xa3aa('0x17')]?_0x49cf83['scheduledat']:moment();var _0x289c0b=moment(_0x529f9a)[_0xa3aa('0x1f')](_0x29a02a,_0xa3aa('0x20'));_0x45f715({'ret':_0x289c0b[_0xa3aa('0x18')](_0xa3aa('0x19'))});}else _0x45f715({'ret':_0x529f9a});}else _0x45f715({'ret':_0x529f9a});}else{_0x45f715({'ret':_0x529f9a});}});}});return 0xa;}var _0xec8d80=function(_0x263eb4){return new BPromise(function(_0xf58707,_0x4e4d71){_0x432d55(_0x263eb4,_0x4d9f7a)[_0xa3aa('0x21')](function(_0x5ec7e0){_0x4d9f7a[_0xa3aa('0x17')]=_0x5ec7e0[_0xa3aa('0x22')];_0x2d56d7['CmHopper'][_0xa3aa('0x23')]({'where':{'phone':_0x4d9f7a[_0xa3aa('0xc')],'CampaignId':_0x263eb4['id']}})[_0xa3aa('0x21')](function(_0x59581e){if(!_['isNil'](_0x59581e)){throw new Error(_0xa3aa('0x24')+_0x4d9f7a[_0xa3aa('0xc')]+_0xa3aa('0x30')+_0x263eb4['id']);}return _0x2d56d7[_0xa3aa('0x26')][_0xa3aa('0x27')]({'phone':_0x4d9f7a['phone'],'ContactId':_0x4d9f7a['id'],'ListId':_0x4d9f7a['ListId'],'priority':_0x4d9f7a['priority']?_0x4d9f7a[_0xa3aa('0x29')]:0x2,'scheduledat':_0x4d9f7a[_0xa3aa('0x17')]?_0x4d9f7a[_0xa3aa('0x17')]:moment()[_0xa3aa('0x18')](_0xa3aa('0x19')),'callback':_0x4d9f7a[_0xa3aa('0x2a')]?!![]:![],'callbackuniqueid':_0x4d9f7a['callbackUniqueid']?_0x4d9f7a[_0xa3aa('0x2a')]:undefined,'callbackat':_0x4d9f7a['callbackUniqueid']?moment()[_0xa3aa('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x263eb4['id']});})[_0xa3aa('0x2b')](function(_0x18c332){_0x4e4d71(_0x18c332);});});});};var _0xbfb132=function(_0x481ecc){return new BPromise(function(_0x547782,_0x182d1e){_0x432d55(_0x481ecc,_0x4d9f7a)[_0xa3aa('0x21')](function(_0x5e369c){_0x4d9f7a['scheduledat']=_0x5e369c[_0xa3aa('0x22')];_0x2d56d7[_0xa3aa('0x26')]['findOne']({'where':{'phone':_0x4d9f7a[_0xa3aa('0xc')],'CampaignId':_0x481ecc['id']}})[_0xa3aa('0x21')](function(_0x39bc9b){if(!_[_0xa3aa('0x1a')](_0x39bc9b)){throw new Error(_0xa3aa('0x24')+_0x4d9f7a[_0xa3aa('0xc')]+_0xa3aa('0x31')+_0x481ecc['id']);}return _0x2d56d7[_0xa3aa('0x2d')][_0xa3aa('0x23')]({'where':{'calleridnum':_0x4d9f7a[_0xa3aa('0xc')],'CampaignId':_0x481ecc['id']}});})[_0xa3aa('0x21')](function(_0x12ef46){if(!_[_0xa3aa('0x1a')](_0x12ef46)){throw new Error(_0xa3aa('0x32')+_0x4d9f7a[_0xa3aa('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x481ecc['id']);}return _0x2d56d7[_0xa3aa('0x26')][_0xa3aa('0x27')]({'phone':_0x4d9f7a[_0xa3aa('0xc')],'ContactId':_0x4d9f7a['id'],'ListId':_0x4d9f7a['ListId'],'priority':_0x4d9f7a[_0xa3aa('0x29')]?_0x4d9f7a[_0xa3aa('0x29')]:0x2,'scheduledat':_0x4d9f7a[_0xa3aa('0x17')]?_0x4d9f7a[_0xa3aa('0x17')]:moment()[_0xa3aa('0x18')](_0xa3aa('0x19')),'callback':_0x4d9f7a[_0xa3aa('0x2a')]?!![]:![],'callbackuniqueid':_0x4d9f7a[_0xa3aa('0x2a')]?_0x4d9f7a[_0xa3aa('0x2a')]:undefined,'callbackat':_0x4d9f7a[_0xa3aa('0x2a')]?moment()[_0xa3aa('0x18')](_0xa3aa('0x19')):undefined,'CampaignId':_0x481ecc['id']});})[_0xa3aa('0x2b')](function(_0x5b0468){_0x182d1e(_0x5b0468);});});});};if(_0x4d9f7a[_0xa3aa('0x28')]){_0x2d56d7[_0xa3aa('0x1c')]['findAll']({'where':{'type':_0xa3aa('0x33')},'attributes':['id',_0xa3aa('0x34'),'dialTimezone'],'include':[{'model':_0x2d56d7[_0xa3aa('0x35')],'as':_0xa3aa('0x36'),'where':{'id':_0x4d9f7a[_0xa3aa('0x28')]}}]})['then'](function(_0xd06747){if(_0xd06747){var _0x3efe23=[];for(var _0x49acbd=0x0,_0x5f1ba7;_0x49acbd<_0xd06747[_0xa3aa('0x37')];_0x49acbd+=0x1){_0x5f1ba7=_0xd06747[_0x49acbd][_0xa3aa('0x13')]({'plain':!![]});switch(_0x5f1ba7[_0xa3aa('0x34')]){case _0xa3aa('0x38'):_0x11e060(_0x5f1ba7)['catch'](_0x314df2());break;case _0xa3aa('0x39'):_0x23b06b(_0x5f1ba7)[_0xa3aa('0x2b')](_0x314df2());break;default:_0x432d55(_0x5f1ba7,_0x4d9f7a)['then'](function(_0x3aaa89){_0x4d9f7a[_0xa3aa('0x17')]=_0x3aaa89[_0xa3aa('0x22')];_0x2d56d7[_0xa3aa('0x26')][_0xa3aa('0x27')]({'phone':_0x4d9f7a[_0xa3aa('0xc')],'ContactId':_0x4d9f7a['id'],'ListId':_0x4d9f7a[_0xa3aa('0x28')],'scheduledat':_0x4d9f7a[_0xa3aa('0x17')]?_0x4d9f7a['scheduledat']:moment()[_0xa3aa('0x18')](_0xa3aa('0x19')),'priority':_0x4d9f7a['priority']?_0x4d9f7a['priority']:0x2,'callback':_0x4d9f7a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4d9f7a['callbackUniqueid']?_0x4d9f7a[_0xa3aa('0x2a')]:undefined,'callbackat':_0x4d9f7a[_0xa3aa('0x2a')]?moment()[_0xa3aa('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5f1ba7['id']})['catch'](_0x314df2());});}}}})[_0xa3aa('0x21')](function(){return _0x2d56d7[_0xa3aa('0x1c')][_0xa3aa('0x3a')]({'where':{'type':_0xa3aa('0x33')},'attributes':['id'],'include':[{'model':_0x2d56d7['CmList'],'as':_0xa3aa('0x3b'),'where':{'id':_0x4d9f7a[_0xa3aa('0x28')]}}]})[_0xa3aa('0x21')](function(_0x416cb1){if(_0x416cb1){var _0x1e119c=[];for(var _0x12de7a=0x0,_0x351dd2;_0x12de7a<_0x416cb1[_0xa3aa('0x37')];_0x12de7a+=0x1){_0x351dd2=_0x416cb1[_0x12de7a][_0xa3aa('0x13')]({'plain':!![]});_0x2d56d7[_0xa3aa('0x3c')][_0xa3aa('0x27')]({'phone':_0x4d9f7a[_0xa3aa('0xc')],'ContactId':_0x4d9f7a['id'],'ListId':_0x4d9f7a[_0xa3aa('0x28')],'VoiceQueueId':_0x351dd2['id']})[_0xa3aa('0x2b')](function(_0x25cbd0){logger['error'](_0xa3aa('0x3d'),'afterCreate',_0x25cbd0[_0xa3aa('0x3e')]);});}}});})['then'](function(){return _0x2d56d7[_0xa3aa('0x2f')]['findAll']({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x2d56d7[_0xa3aa('0x35')],'as':'Lists','where':{'id':_0x4d9f7a[_0xa3aa('0x28')]}}]})['then'](function(_0x90ae98){if(_0x90ae98){var _0x326c2e=[];for(var _0x497a77=0x0,_0x368cdc;_0x497a77<_0x90ae98[_0xa3aa('0x37')];_0x497a77+=0x1){_0x368cdc=_0x90ae98[_0x497a77][_0xa3aa('0x13')]({'plain':!![]});switch(_0x368cdc[_0xa3aa('0x34')]){case _0xa3aa('0x38'):_0xbfb132(_0x368cdc)['catch'](_0x32c3c1());break;case _0xa3aa('0x39'):_0xec8d80(_0x368cdc)[_0xa3aa('0x2b')](_0x32c3c1());break;default:_0x2d56d7[_0xa3aa('0x26')][_0xa3aa('0x27')]({'phone':_0x4d9f7a[_0xa3aa('0xc')],'ContactId':_0x4d9f7a['id'],'ListId':_0x4d9f7a['ListId'],'scheduledat':_0x4d9f7a[_0xa3aa('0x17')]?_0x4d9f7a[_0xa3aa('0x17')]:moment()['format'](_0xa3aa('0x19')),'priority':_0x4d9f7a['priority']?_0x4d9f7a['priority']:0x2,'callback':_0x4d9f7a[_0xa3aa('0x2a')]?!![]:![],'callbackuniqueid':_0x4d9f7a[_0xa3aa('0x2a')]?_0x4d9f7a['callbackUniqueid']:undefined,'callbackat':_0x4d9f7a[_0xa3aa('0x2a')]?moment()['format'](_0xa3aa('0x19')):undefined,'CampaignId':_0x368cdc['id']})[_0xa3aa('0x2b')](_0x32c3c1());}}}});})[_0xa3aa('0x21')](function(){return _0x2d56d7[_0xa3aa('0x2f')][_0xa3aa('0x3a')]({'attributes':['id'],'include':[{'model':_0x2d56d7[_0xa3aa('0x35')],'as':'BlackLists','where':{'id':_0x4d9f7a[_0xa3aa('0x28')]}}]})['then'](function(_0x1fff32){if(_0x1fff32){var _0x310843=[];for(var _0x1eb659=0x0,_0x38b257;_0x1eb659<_0x1fff32[_0xa3aa('0x37')];_0x1eb659+=0x1){_0x38b257=_0x1fff32[_0x1eb659][_0xa3aa('0x13')]({'plain':!![]});_0x2d56d7[_0xa3aa('0x3c')][_0xa3aa('0x27')]({'phone':_0x4d9f7a[_0xa3aa('0xc')],'ContactId':_0x4d9f7a['id'],'ListId':_0x4d9f7a[_0xa3aa('0x28')],'CampaignId':_0x38b257['id']})[_0xa3aa('0x2b')](function(_0x27f964){logger[_0xa3aa('0x14')]('cmContact,\x20%s,\x20%s',_0xa3aa('0x15'),_0x27f964[_0xa3aa('0x3e')]);});}}});})[_0xa3aa('0x21')](function(){_0x1fefd3();})[_0xa3aa('0x2b')](function(_0x395087){logger['error'](_0xa3aa('0x3d'),_0xa3aa('0x15'),_0x395087[_0xa3aa('0x3e')]);_0x1fefd3(_0x395087);});}else{_0x1fefd3(new Error(_0xa3aa('0x3f')));}},'afterDestroy':function(_0x4c0ea7,_0x314229,_0x7df6d4){var _0x57c7d0=_0xe5222e[_0xa3aa('0x40')];var _0x2f2bfb=_0x4c0ea7[_0xa3aa('0x13')]({'plain':!![]});return _0x57c7d0['CmHopper'][_0xa3aa('0x3a')]({'raw':!![],'where':{'ListId':_0x2f2bfb[_0xa3aa('0x28')],'ContactId':_0x2f2bfb['id']}})[_0xa3aa('0x21')](function(_0x408dcc){if(!_[_0xa3aa('0x41')](_0x408dcc)){var _0x392420=[];for(var _0x2dc209=0x0;_0x2dc209<_0x408dcc[_0xa3aa('0x37')];_0x2dc209+=0x1){var _0x4a8420=_0x57c7d0[_0xa3aa('0x26')][_0xa3aa('0x42')]({'where':{'ListId':_0x408dcc[_0x2dc209][_0xa3aa('0x28')],'ContactId':_0x408dcc[_0x2dc209][_0xa3aa('0x43')],'VoiceQueueId':_0x408dcc[_0x2dc209][_0xa3aa('0x44')],'CampaignId':_0x408dcc[_0x2dc209][_0xa3aa('0x45')]}});_0x392420[_0xa3aa('0x46')](_0x4a8420);}return BPromise[_0xa3aa('0x47')](_0x392420);}})[_0xa3aa('0x21')](function(_0x1a1589){logger[_0xa3aa('0x48')](_0xa3aa('0x49'),util[_0xa3aa('0x16')](_0x1a1589,{'showHidden':![],'depth':null}));_0x7df6d4();})[_0xa3aa('0x2b')](function(_0x5cc623){logger[_0xa3aa('0x14')]('[CmContact][afterDestroy][Error]',util['inspect'](_0x5cc623,{'showHidden':![],'depth':null}));_0x7df6d4(_0x5cc623);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 87feb49..06e013c 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 _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x25fe9d,_0x3336d0){var _0x54f5db=function(_0x401f79){while(--_0x401f79){_0x25fe9d['push'](_0x25fe9d['shift']());}};_0x54f5db(++_0x3336d0);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\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(_0x44ff9c,_0x1627d9){var _0x3bc3f0=function(_0x4204cc){while(--_0x4204cc){_0x44ff9c['push'](_0x44ff9c['shift']());}};_0x3bc3f0(++_0x1627d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 477b69e..bc1364a 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 _0x81a4=['INTEGER','STRING','sequelize','exports'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x81a4,0x1a6));var _0x481a=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x81a4[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x481a('0x0'));module[_0x481a('0x1')]={'CmContactId':{'type':Sequelize[_0x481a('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x481a('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x481a('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x481a('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x481a('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x6c63=['INTEGER','STRING','sequelize','exports'];(function(_0x374144,_0x2ce797){var _0xe0a234=function(_0x4b0c5e){while(--_0x4b0c5e){_0x374144['push'](_0x374144['shift']());}};_0xe0a234(++_0x2ce797);}(_0x6c63,0x1ee));var _0x36c6=function(_0x219390,_0x2a7297){_0x219390=_0x219390-0x0;var _0x94a3e7=_0x6c63[_0x219390];return _0x94a3e7;};'use strict';var Sequelize=require(_0x36c6('0x0'));module[_0x36c6('0x1')]={'CmContactId':{'type':Sequelize[_0x36c6('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x36c6('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x36c6('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x36c6('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x36c6('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x36c6('0x3')],'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 b5dcfe6..dab38f3 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 _0xd16b=['ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox'];(function(_0x49b020,_0x341f5c){var _0x23ddca=function(_0x820d60){while(--_0x820d60){_0x49b020['push'](_0x49b020['shift']());}};_0x23ddca(++_0x341f5c);}(_0xd16b,0x1d1));var _0xbd16=function(_0x11a4d8,_0xb83290){_0x11a4d8=_0x11a4d8-0x0;var _0x7e9b04=_0xd16b[_0x11a4d8];return _0x7e9b04;};'use strict';var emlformat=require(_0xbd16('0x0'));var rimraf=require(_0xbd16('0x1'));var zipdir=require(_0xbd16('0x2'));var jsonpatch=require(_0xbd16('0x3'));var rp=require(_0xbd16('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd16('0x5'));var util=require(_0xbd16('0x6'));var path=require(_0xbd16('0x7'));var sox=require(_0xbd16('0x8'));var csv=require('to-csv');var ejs=require(_0xbd16('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd16('0xa'));var squel=require('squel');var crypto=require(_0xbd16('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbd16('0xc'));var toCsv=require(_0xbd16('0xd'));var querystring=require(_0xbd16('0xe'));var Papa=require(_0xbd16('0xf'));var Redis=require(_0xbd16('0x10'));var authService=require(_0xbd16('0x11'));var qs=require(_0xbd16('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd16('0x13'))(_0xbd16('0x14'));var utils=require('../../config/utils');var config=require(_0xbd16('0x15'));var licenseUtil=require(_0xbd16('0x16'));var db=require(_0xbd16('0x17'))['db'];function respondWithStatusCode(_0x397954,_0x4edb6c){_0x4edb6c=_0x4edb6c||0xcc;return function(_0x53ba26){if(_0x53ba26){return _0x397954[_0xbd16('0x18')](_0x4edb6c);}return _0x397954[_0xbd16('0x19')](_0x4edb6c)[_0xbd16('0x1a')]();};}function respondWithResult(_0x5a60ec,_0x4a5195){_0x4a5195=_0x4a5195||0xc8;return function(_0x1e5341){if(_0x1e5341){return _0x5a60ec[_0xbd16('0x19')](_0x4a5195)[_0xbd16('0x1b')](_0x1e5341);}};}function respondWithFilteredResult(_0x168055,_0x27e7e5){return function(_0x391090){if(_0x391090){var _0x12decf=typeof _0x27e7e5['offset']==='undefined'&&typeof _0x27e7e5[_0xbd16('0x1c')]==='undefined';var _0x54ca2d=_0x391090[_0xbd16('0x1d')];var _0x9047ca=_0x12decf?0x0:_0x27e7e5[_0xbd16('0x1e')];var _0x1e0b0f=_0x12decf?_0x391090[_0xbd16('0x1d')]:_0x27e7e5[_0xbd16('0x1e')]+_0x27e7e5['limit'];var _0x487035;if(_0x1e0b0f>=_0x54ca2d){_0x1e0b0f=_0x54ca2d;_0x487035=0xc8;}else{_0x487035=0xce;}_0x168055[_0xbd16('0x19')](_0x487035);return _0x168055['set'](_0xbd16('0x1f'),_0x9047ca+'-'+_0x1e0b0f+'/'+_0x54ca2d)['json'](_0x391090);}return null;};}function patchUpdates(_0x11a45d){return function(_0x2b9b08){try{jsonpatch[_0xbd16('0x20')](_0x2b9b08,_0x11a45d,!![]);}catch(_0x4a84e4){return BPromise[_0xbd16('0x21')](_0x4a84e4);}return _0x2b9b08[_0xbd16('0x22')]();};}function saveUpdates(_0x479379,_0x4cc2ab){return function(_0x286ab6){if(_0x286ab6){return _0x286ab6[_0xbd16('0x23')](_0x479379)[_0xbd16('0x24')](function(_0x7c931a){return _0x7c931a;});}return null;};}function removeEntity(_0x4c87d0,_0x362d78){return function(_0x3f5dd5){if(_0x3f5dd5){return _0x3f5dd5[_0xbd16('0x25')]()[_0xbd16('0x24')](function(){var _0x5e3d73=_0x3f5dd5['get']({'plain':!![]});var _0x40b3e2=_0xbd16('0x26');return db[_0xbd16('0x27')][_0xbd16('0x25')]({'where':{'type':_0x40b3e2,'resourceId':_0x5e3d73['id']}})[_0xbd16('0x24')](function(){return _0x3f5dd5;});})[_0xbd16('0x24')](function(){_0x4c87d0[_0xbd16('0x19')](0xcc)[_0xbd16('0x1a')]();});}};}function handleEntityNotFound(_0x2329d8,_0x4bdbbc){return function(_0x39276c){if(!_0x39276c){_0x2329d8[_0xbd16('0x18')](0x194);}return _0x39276c;};}function handleError(_0x589f68,_0xf9f1c1){_0xf9f1c1=_0xf9f1c1||0x1f4;return function(_0x1b24e6){logger[_0xbd16('0x28')](_0x1b24e6[_0xbd16('0x29')]);if(_0x1b24e6[_0xbd16('0x2a')]){delete _0x1b24e6[_0xbd16('0x2a')];}_0x589f68['status'](_0xf9f1c1)[_0xbd16('0x2b')](_0x1b24e6);};}exports['index']=function(_0x16987a,_0xea7315){var _0x4a3f53={},_0x1ebeff={},_0x31b9c9={'count':0x0,'rows':[]};var _0x19238d=_[_0xbd16('0x2c')](db[_0xbd16('0x2d')][_0xbd16('0x2e')],function(_0x1637be){return{'name':_0x1637be[_0xbd16('0x2f')],'type':_0x1637be[_0xbd16('0x30')][_0xbd16('0x31')]};});_0x1ebeff[_0xbd16('0x32')]=_['map'](_0x19238d,_0xbd16('0x2a'));_0x1ebeff[_0xbd16('0x33')]=_[_0xbd16('0x34')](_0x16987a[_0xbd16('0x33')]);_0x1ebeff[_0xbd16('0x35')]=_['intersection'](_0x1ebeff[_0xbd16('0x32')],_0x1ebeff['query']);_0x4a3f53[_0xbd16('0x36')]=_[_0xbd16('0x37')](_0x1ebeff[_0xbd16('0x32')],qs[_0xbd16('0x38')](_0x16987a[_0xbd16('0x33')][_0xbd16('0x38')]));_0x4a3f53[_0xbd16('0x36')]=_0x4a3f53[_0xbd16('0x36')][_0xbd16('0x39')]?_0x4a3f53[_0xbd16('0x36')]:_0x1ebeff['model'];if(!_0x16987a[_0xbd16('0x33')]['hasOwnProperty']('nolimit')){_0x4a3f53['limit']=qs[_0xbd16('0x1c')](_0x16987a[_0xbd16('0x33')][_0xbd16('0x1c')]);_0x4a3f53[_0xbd16('0x1e')]=qs[_0xbd16('0x1e')](_0x16987a[_0xbd16('0x33')]['offset']);}_0x4a3f53['order']=qs['sort'](_0x16987a[_0xbd16('0x33')]['sort']);_0x4a3f53[_0xbd16('0x3a')]=qs[_0xbd16('0x35')](_[_0xbd16('0x3b')](_0x16987a['query'],_0x1ebeff[_0xbd16('0x35')]),_0x19238d);if(_0x16987a[_0xbd16('0x33')][_0xbd16('0x3c')]){_0x4a3f53[_0xbd16('0x3a')]=_[_0xbd16('0x3d')](_0x4a3f53[_0xbd16('0x3a')],{'$or':_[_0xbd16('0x2c')](_0x19238d,function(_0x88ab79){if(_0x88ab79[_0xbd16('0x30')]!==_0xbd16('0x3e')){var _0x327287={};_0x327287[_0x88ab79[_0xbd16('0x2a')]]={'$like':'%'+_0x16987a[_0xbd16('0x33')]['filter']+'%'};return _0x327287;}})});}_0x4a3f53=_[_0xbd16('0x3d')]({},_0x4a3f53,_0x16987a[_0xbd16('0x3f')]);var _0x55e6e8={'where':_0x4a3f53[_0xbd16('0x3a')]};return db[_0xbd16('0x2d')][_0xbd16('0x1d')](_0x55e6e8)[_0xbd16('0x24')](function(_0x2cb36f){_0x31b9c9['count']=_0x2cb36f;if(_0x16987a[_0xbd16('0x33')][_0xbd16('0x40')]){_0x4a3f53[_0xbd16('0x41')]=[{'all':!![]}];}return db[_0xbd16('0x2d')][_0xbd16('0x42')](_0x4a3f53);})[_0xbd16('0x24')](function(_0x6dffbe){_0x31b9c9[_0xbd16('0x43')]=_0x6dffbe;return _0x31b9c9;})[_0xbd16('0x24')](respondWithFilteredResult(_0xea7315,_0x4a3f53))[_0xbd16('0x44')](handleError(_0xea7315,null));};exports[_0xbd16('0x45')]=function(_0x2ed254,_0x4b623e){var _0x332616={'raw':!![],'where':{'id':_0x2ed254['params']['id']}},_0x3ee345={};_0x3ee345[_0xbd16('0x32')]=_[_0xbd16('0x34')](db[_0xbd16('0x2d')][_0xbd16('0x2e')]);_0x3ee345['query']=_[_0xbd16('0x34')](_0x2ed254[_0xbd16('0x33')]);_0x3ee345[_0xbd16('0x35')]=_[_0xbd16('0x37')](_0x3ee345[_0xbd16('0x32')],_0x3ee345['query']);_0x332616[_0xbd16('0x36')]=_[_0xbd16('0x37')](_0x3ee345['model'],qs['fields'](_0x2ed254['query'][_0xbd16('0x38')]));_0x332616[_0xbd16('0x36')]=_0x332616[_0xbd16('0x36')][_0xbd16('0x39')]?_0x332616[_0xbd16('0x36')]:_0x3ee345['model'];if(_0x2ed254[_0xbd16('0x33')][_0xbd16('0x40')]){_0x332616['include']=[{'all':!![]}];}_0x332616=_[_0xbd16('0x3d')]({},_0x332616,_0x2ed254[_0xbd16('0x3f')]);return db[_0xbd16('0x2d')][_0xbd16('0x46')](_0x332616)[_0xbd16('0x24')](handleEntityNotFound(_0x4b623e,null))['then'](respondWithResult(_0x4b623e,null))['catch'](handleError(_0x4b623e,null));};exports['create']=function(_0x2f3bcd,_0x12beac){return db[_0xbd16('0x2d')][_0xbd16('0x47')](_0x2f3bcd[_0xbd16('0x48')],{})[_0xbd16('0x24')](function(_0x1c35ed){var _0x394aae=_0x2f3bcd[_0xbd16('0x49')][_0xbd16('0x4a')]({'plain':!![]});if(!_0x394aae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x394aae['role']===_0xbd16('0x49')){var _0xbf0031=_0x1c35ed['get']({'plain':!![]});var _0x560e90=_0xbd16('0x26');return db[_0xbd16('0x4b')][_0xbd16('0x46')]({'where':{'name':_0x560e90,'userProfileId':_0x394aae[_0xbd16('0x4c')]},'raw':!![]})[_0xbd16('0x24')](function(_0x453114){if(_0x453114&&_0x453114[_0xbd16('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0xbf0031[_0xbd16('0x2a')],'resourceId':_0xbf0031['id'],'type':_0x453114[_0xbd16('0x2a')],'sectionId':_0x453114['id']},{})[_0xbd16('0x24')](function(){return _0x1c35ed;});}else{return _0x1c35ed;}})[_0xbd16('0x44')](function(_0x2e82ce){logger['error'](_0xbd16('0x4e'),_0x2e82ce);throw _0x2e82ce;});}return _0x1c35ed;})[_0xbd16('0x24')](respondWithResult(_0x12beac,0xc9))[_0xbd16('0x44')](handleError(_0x12beac,null));};exports[_0xbd16('0x23')]=function(_0x2ff7e7,_0x912a82){if(_0x2ff7e7[_0xbd16('0x48')]['id']){delete _0x2ff7e7[_0xbd16('0x48')]['id'];}return db[_0xbd16('0x2d')][_0xbd16('0x46')]({'where':{'id':_0x2ff7e7['params']['id']}})[_0xbd16('0x24')](handleEntityNotFound(_0x912a82,null))[_0xbd16('0x24')](saveUpdates(_0x2ff7e7[_0xbd16('0x48')],null))[_0xbd16('0x24')](respondWithResult(_0x912a82,null))[_0xbd16('0x44')](handleError(_0x912a82,null));};exports['destroy']=function(_0x43c490,_0x4204aa){return db['CmContactHasItem'][_0xbd16('0x46')]({'where':{'id':_0x43c490['params']['id']}})[_0xbd16('0x24')](handleEntityNotFound(_0x4204aa,null))[_0xbd16('0x24')](removeEntity(_0x4204aa,null))[_0xbd16('0x44')](handleError(_0x4204aa,null));}; \ No newline at end of file +var _0xd86a=['model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','end','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xd86a,0x1ce));var _0xad86=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xd86a[_0x2f71f6];return _0x2b23ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad86('0x0'));var zipdir=require(_0xad86('0x1'));var jsonpatch=require(_0xad86('0x2'));var rp=require(_0xad86('0x3'));var moment=require(_0xad86('0x4'));var BPromise=require(_0xad86('0x5'));var Mustache=require(_0xad86('0x6'));var util=require(_0xad86('0x7'));var path=require('path');var sox=require(_0xad86('0x8'));var csv=require(_0xad86('0x9'));var ejs=require(_0xad86('0xa'));var fs=require('fs');var fs_extra=require(_0xad86('0xb'));var _=require('lodash');var squel=require(_0xad86('0xc'));var crypto=require(_0xad86('0xd'));var jsforce=require(_0xad86('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xad86('0x9'));var querystring=require(_0xad86('0xf'));var Papa=require(_0xad86('0x10'));var Redis=require('ioredis');var authService=require(_0xad86('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xad86('0x12'));var hardwareService=require(_0xad86('0x13'));var logger=require(_0xad86('0x14'))(_0xad86('0x15'));var utils=require(_0xad86('0x16'));var config=require(_0xad86('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xad86('0x18'))['db'];function respondWithStatusCode(_0x269393,_0x4c72d6){_0x4c72d6=_0x4c72d6||0xcc;return function(_0x34485c){if(_0x34485c){return _0x269393[_0xad86('0x19')](_0x4c72d6);}return _0x269393[_0xad86('0x1a')](_0x4c72d6)['end']();};}function respondWithResult(_0x7cddc5,_0x3cdbff){_0x3cdbff=_0x3cdbff||0xc8;return function(_0x24e9c6){if(_0x24e9c6){return _0x7cddc5[_0xad86('0x1a')](_0x3cdbff)[_0xad86('0x1b')](_0x24e9c6);}};}function respondWithFilteredResult(_0x8fb8b7,_0x454209){return function(_0x3b9359){if(_0x3b9359){var _0x3ef226=typeof _0x454209[_0xad86('0x1c')]===_0xad86('0x1d')&&typeof _0x454209['limit']===_0xad86('0x1d');var _0x4f6ad0=_0x3b9359[_0xad86('0x1e')];var _0x3af5ae=_0x3ef226?0x0:_0x454209['offset'];var _0x41bb38=_0x3ef226?_0x3b9359[_0xad86('0x1e')]:_0x454209[_0xad86('0x1c')]+_0x454209[_0xad86('0x1f')];var _0x35e18d;if(_0x41bb38>=_0x4f6ad0){_0x41bb38=_0x4f6ad0;_0x35e18d=0xc8;}else{_0x35e18d=0xce;}_0x8fb8b7['status'](_0x35e18d);return _0x8fb8b7[_0xad86('0x20')](_0xad86('0x21'),_0x3af5ae+'-'+_0x41bb38+'/'+_0x4f6ad0)['json'](_0x3b9359);}return null;};}function patchUpdates(_0x3ca2b3){return function(_0x36ae99){try{jsonpatch[_0xad86('0x22')](_0x36ae99,_0x3ca2b3,!![]);}catch(_0x21a8b9){return BPromise['reject'](_0x21a8b9);}return _0x36ae99[_0xad86('0x23')]();};}function saveUpdates(_0x458fa3,_0x94ca5b){return function(_0x12e1e4){if(_0x12e1e4){return _0x12e1e4[_0xad86('0x24')](_0x458fa3)[_0xad86('0x25')](function(_0x17a027){return _0x17a027;});}return null;};}function removeEntity(_0x566723,_0x8f1894){return function(_0x2020b6){if(_0x2020b6){return _0x2020b6[_0xad86('0x26')]()['then'](function(){var _0x487ae5=_0x2020b6[_0xad86('0x27')]({'plain':!![]});var _0x8efc29=_0xad86('0x28');return db[_0xad86('0x29')]['destroy']({'where':{'type':_0x8efc29,'resourceId':_0x487ae5['id']}})[_0xad86('0x25')](function(){return _0x2020b6;});})['then'](function(){_0x566723[_0xad86('0x1a')](0xcc)[_0xad86('0x2a')]();});}};}function handleEntityNotFound(_0x4d382b,_0x4d4f3e){return function(_0xfa932a){if(!_0xfa932a){_0x4d382b['sendStatus'](0x194);}return _0xfa932a;};}function handleError(_0x5bdf77,_0x5e1548){_0x5e1548=_0x5e1548||0x1f4;return function(_0x2f754a){logger[_0xad86('0x2b')](_0x2f754a[_0xad86('0x2c')]);if(_0x2f754a[_0xad86('0x2d')]){delete _0x2f754a[_0xad86('0x2d')];}_0x5bdf77[_0xad86('0x1a')](_0x5e1548)[_0xad86('0x2e')](_0x2f754a);};}exports[_0xad86('0x2f')]=function(_0x581a19,_0x26ab0f){var _0x550acf={},_0x355243={},_0x253e89={'count':0x0,'rows':[]};var _0x46d46b=_[_0xad86('0x30')](db[_0xad86('0x31')][_0xad86('0x32')],function(_0x285fb5){return{'name':_0x285fb5[_0xad86('0x33')],'type':_0x285fb5[_0xad86('0x34')][_0xad86('0x35')]};});_0x355243[_0xad86('0x36')]=_['map'](_0x46d46b,_0xad86('0x2d'));_0x355243['query']=_[_0xad86('0x37')](_0x581a19[_0xad86('0x38')]);_0x355243[_0xad86('0x39')]=_[_0xad86('0x3a')](_0x355243['model'],_0x355243['query']);_0x550acf[_0xad86('0x3b')]=_[_0xad86('0x3a')](_0x355243['model'],qs['fields'](_0x581a19['query'][_0xad86('0x3c')]));_0x550acf[_0xad86('0x3b')]=_0x550acf[_0xad86('0x3b')]['length']?_0x550acf[_0xad86('0x3b')]:_0x355243['model'];if(!_0x581a19[_0xad86('0x38')][_0xad86('0x3d')](_0xad86('0x3e'))){_0x550acf[_0xad86('0x1f')]=qs[_0xad86('0x1f')](_0x581a19[_0xad86('0x38')][_0xad86('0x1f')]);_0x550acf[_0xad86('0x1c')]=qs[_0xad86('0x1c')](_0x581a19[_0xad86('0x38')]['offset']);}_0x550acf[_0xad86('0x3f')]=qs[_0xad86('0x40')](_0x581a19['query'][_0xad86('0x40')]);_0x550acf[_0xad86('0x41')]=qs[_0xad86('0x39')](_['pick'](_0x581a19[_0xad86('0x38')],_0x355243[_0xad86('0x39')]),_0x46d46b);if(_0x581a19[_0xad86('0x38')][_0xad86('0x42')]){_0x550acf[_0xad86('0x41')]=_[_0xad86('0x43')](_0x550acf['where'],{'$or':_[_0xad86('0x30')](_0x46d46b,function(_0x31c351){if(_0x31c351[_0xad86('0x34')]!==_0xad86('0x44')){var _0x17937d={};_0x17937d[_0x31c351[_0xad86('0x2d')]]={'$like':'%'+_0x581a19[_0xad86('0x38')]['filter']+'%'};return _0x17937d;}})});}_0x550acf=_[_0xad86('0x43')]({},_0x550acf,_0x581a19[_0xad86('0x45')]);var _0x111db3={'where':_0x550acf[_0xad86('0x41')]};return db[_0xad86('0x31')][_0xad86('0x1e')](_0x111db3)[_0xad86('0x25')](function(_0x4b00cf){_0x253e89[_0xad86('0x1e')]=_0x4b00cf;if(_0x581a19['query'][_0xad86('0x46')]){_0x550acf[_0xad86('0x47')]=[{'all':!![]}];}return db[_0xad86('0x31')][_0xad86('0x48')](_0x550acf);})[_0xad86('0x25')](function(_0x1fd277){_0x253e89[_0xad86('0x49')]=_0x1fd277;return _0x253e89;})[_0xad86('0x25')](respondWithFilteredResult(_0x26ab0f,_0x550acf))[_0xad86('0x4a')](handleError(_0x26ab0f,null));};exports[_0xad86('0x4b')]=function(_0xfe52cf,_0x1f14a8){var _0x267c28={'raw':!![],'where':{'id':_0xfe52cf['params']['id']}},_0x5f436={};_0x5f436[_0xad86('0x36')]=_[_0xad86('0x37')](db['CmContactHasItem']['rawAttributes']);_0x5f436['query']=_[_0xad86('0x37')](_0xfe52cf[_0xad86('0x38')]);_0x5f436[_0xad86('0x39')]=_[_0xad86('0x3a')](_0x5f436[_0xad86('0x36')],_0x5f436[_0xad86('0x38')]);_0x267c28['attributes']=_[_0xad86('0x3a')](_0x5f436[_0xad86('0x36')],qs[_0xad86('0x3c')](_0xfe52cf['query'][_0xad86('0x3c')]));_0x267c28[_0xad86('0x3b')]=_0x267c28[_0xad86('0x3b')][_0xad86('0x4c')]?_0x267c28[_0xad86('0x3b')]:_0x5f436[_0xad86('0x36')];if(_0xfe52cf[_0xad86('0x38')][_0xad86('0x46')]){_0x267c28[_0xad86('0x47')]=[{'all':!![]}];}_0x267c28=_[_0xad86('0x43')]({},_0x267c28,_0xfe52cf[_0xad86('0x45')]);return db['CmContactHasItem'][_0xad86('0x4d')](_0x267c28)[_0xad86('0x25')](handleEntityNotFound(_0x1f14a8,null))[_0xad86('0x25')](respondWithResult(_0x1f14a8,null))[_0xad86('0x4a')](handleError(_0x1f14a8,null));};exports[_0xad86('0x4e')]=function(_0x3be074,_0x2fbdba){return db[_0xad86('0x31')][_0xad86('0x4e')](_0x3be074[_0xad86('0x4f')],{})[_0xad86('0x25')](function(_0x452869){var _0x2dfa4=_0x3be074[_0xad86('0x50')][_0xad86('0x27')]({'plain':!![]});if(!_0x2dfa4)throw new Error(_0xad86('0x51'));if(_0x2dfa4[_0xad86('0x52')]==='user'){var _0x4983e6=_0x452869[_0xad86('0x27')]({'plain':!![]});var _0xd1137e=_0xad86('0x28');return db[_0xad86('0x53')][_0xad86('0x4d')]({'where':{'name':_0xd1137e,'userProfileId':_0x2dfa4[_0xad86('0x54')]},'raw':!![]})[_0xad86('0x25')](function(_0x31fd21){if(_0x31fd21&&_0x31fd21['autoAssociation']===0x0){return db[_0xad86('0x29')]['create']({'name':_0x4983e6['name'],'resourceId':_0x4983e6['id'],'type':_0x31fd21[_0xad86('0x2d')],'sectionId':_0x31fd21['id']},{})[_0xad86('0x25')](function(){return _0x452869;});}else{return _0x452869;}})[_0xad86('0x4a')](function(_0x17fcd3){logger[_0xad86('0x2b')](_0xad86('0x55'),_0x17fcd3);throw _0x17fcd3;});}return _0x452869;})['then'](respondWithResult(_0x2fbdba,0xc9))['catch'](handleError(_0x2fbdba,null));};exports[_0xad86('0x24')]=function(_0x4dffdd,_0x2fc176){if(_0x4dffdd[_0xad86('0x4f')]['id']){delete _0x4dffdd[_0xad86('0x4f')]['id'];}return db[_0xad86('0x31')][_0xad86('0x4d')]({'where':{'id':_0x4dffdd['params']['id']}})[_0xad86('0x25')](handleEntityNotFound(_0x2fc176,null))[_0xad86('0x25')](saveUpdates(_0x4dffdd['body'],null))['then'](respondWithResult(_0x2fc176,null))[_0xad86('0x4a')](handleError(_0x2fc176,null));};exports['destroy']=function(_0x194458,_0x11fc16){return db[_0xad86('0x31')][_0xad86('0x4d')]({'where':{'id':_0x194458['params']['id']}})[_0xad86('0x25')](handleEntityNotFound(_0x11fc16,null))[_0xad86('0x25')](removeEntity(_0x11fc16,null))[_0xad86('0x4a')](handleError(_0x11fc16,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index e368629..657f3cd 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 _0xd7b2=['exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x4fb504,_0x1d6a5d){var _0x33846b=function(_0x493352){while(--_0x493352){_0x4fb504['push'](_0x4fb504['shift']());}};_0x33846b(++_0x1d6a5d);}(_0xd7b2,0x154));var _0x2d7b=function(_0x20f441,_0x537196){_0x20f441=_0x20f441-0x0;var _0x1874ac=_0xd7b2[_0x20f441];return _0x1874ac;};'use strict';var _=require(_0x2d7b('0x0'));var util=require('util');var logger=require(_0x2d7b('0x1'))(_0x2d7b('0x2'));var moment=require(_0x2d7b('0x3'));var BPromise=require(_0x2d7b('0x4'));var rp=require(_0x2d7b('0x5'));var fs=require('fs');var path=require(_0x2d7b('0x6'));var rimraf=require(_0x2d7b('0x7'));var config=require(_0x2d7b('0x8'));var attributes=require(_0x2d7b('0x9'));module[_0x2d7b('0xa')]=function(_0x10fc4e,_0x414f9b){return _0x10fc4e[_0x2d7b('0xb')](_0x2d7b('0xc'),attributes,{'tableName':_0x2d7b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cc2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','CmContactHasItem','cm_contact_has_items','util'];(function(_0x194494,_0x57c76e){var _0x45acaf=function(_0x37e62f){while(--_0x37e62f){_0x194494['push'](_0x194494['shift']());}};_0x45acaf(++_0x57c76e);}(_0x3cc2,0x173));var _0x23cc=function(_0x1a7569,_0x5ca637){_0x1a7569=_0x1a7569-0x0;var _0x3cb051=_0x3cc2[_0x1a7569];return _0x3cb051;};'use strict';var _=require('lodash');var util=require(_0x23cc('0x0'));var logger=require(_0x23cc('0x1'))(_0x23cc('0x2'));var moment=require(_0x23cc('0x3'));var BPromise=require(_0x23cc('0x4'));var rp=require(_0x23cc('0x5'));var fs=require('fs');var path=require(_0x23cc('0x6'));var rimraf=require(_0x23cc('0x7'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x23cc('0x8')]=function(_0x1fb2a7,_0x255b84){return _0x1fb2a7[_0x23cc('0x9')](_0x23cc('0xa'),attributes,{'tableName':_0x23cc('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 872a776..901b2f3 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 _0x5dce=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x3d4864,_0x10ff93){var _0x489010=function(_0x577f25){while(--_0x577f25){_0x3d4864['push'](_0x3d4864['shift']());}};_0x489010(++_0x10ff93);}(_0x5dce,0x1c5));var _0xe5dc=function(_0x451cb9,_0xe9c73a){_0x451cb9=_0x451cb9-0x0;var _0x3f7912=_0x5dce[_0x451cb9];return _0x3f7912;};'use strict';var _=require(_0xe5dc('0x0'));var util=require(_0xe5dc('0x1'));var moment=require('moment');var BPromise=require(_0xe5dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5dc('0x3'));var db=require(_0xe5dc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5dc('0x5'))(_0xe5dc('0x6'));var config=require(_0xe5dc('0x7'));var jayson=require(_0xe5dc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4179,_0x4a30a5,_0x324ae7){return new BPromise(function(_0x270d68,_0x166800){return client[_0xe5dc('0x9')](_0x1d4179,_0x324ae7)['then'](function(_0x1cf0de){logger[_0xe5dc('0xa')](_0xe5dc('0xb'),_0x4a30a5,_0xe5dc('0xc'));logger[_0xe5dc('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x4a30a5,_0xe5dc('0xc'),JSON[_0xe5dc('0xe')](_0x1cf0de));if(_0x1cf0de[_0xe5dc('0xf')]){if(_0x1cf0de[_0xe5dc('0xf')]['code']===0x1f4){logger[_0xe5dc('0xf')](_0xe5dc('0xb'),_0x4a30a5,_0x1cf0de[_0xe5dc('0xf')][_0xe5dc('0x10')]);return _0x166800(_0x1cf0de[_0xe5dc('0xf')][_0xe5dc('0x10')]);}logger['error'](_0xe5dc('0xb'),_0x4a30a5,_0x1cf0de[_0xe5dc('0xf')][_0xe5dc('0x10')]);return _0x270d68(_0x1cf0de[_0xe5dc('0xf')]['message']);}else{logger[_0xe5dc('0xa')](_0xe5dc('0xb'),_0x4a30a5,_0xe5dc('0xc'));_0x270d68(_0x1cf0de[_0xe5dc('0x11')][_0xe5dc('0x10')]);}})[_0xe5dc('0x12')](function(_0x1730b2){logger[_0xe5dc('0xf')](_0xe5dc('0xb'),_0x4a30a5,_0x1730b2);_0x166800(_0x1730b2);});});} \ No newline at end of file +var _0xf32b=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4cc087,_0x999a0b){var _0xba0339=function(_0x418c02){while(--_0x418c02){_0x4cc087['push'](_0x4cc087['shift']());}};_0xba0339(++_0x999a0b);}(_0xf32b,0xdc));var _0xbf32=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xf32b[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0xbf32('0x0'));var moment=require(_0xbf32('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf32('0x2'));var fs=require('fs');var Redis=require(_0xbf32('0x3'));var db=require(_0xbf32('0x4'))['db'];var utils=require(_0xbf32('0x5'));var logger=require('../../config/logger')(_0xbf32('0x6'));var config=require('../../config/environment');var jayson=require(_0xbf32('0x7'));var client=jayson[_0xbf32('0x8')][_0xbf32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a7595,_0xca8608,_0x56a6a3){return new BPromise(function(_0x1ce028,_0x4deaf2){return client[_0xbf32('0xa')](_0x1a7595,_0x56a6a3)[_0xbf32('0xb')](function(_0x18a256){logger[_0xbf32('0xc')](_0xbf32('0xd'),_0xca8608,_0xbf32('0xe'));logger[_0xbf32('0xf')](_0xbf32('0x10'),_0xca8608,_0xbf32('0xe'),JSON[_0xbf32('0x11')](_0x18a256));if(_0x18a256[_0xbf32('0x12')]){if(_0x18a256[_0xbf32('0x12')][_0xbf32('0x13')]===0x1f4){logger[_0xbf32('0x12')](_0xbf32('0xd'),_0xca8608,_0x18a256[_0xbf32('0x12')]['message']);return _0x4deaf2(_0x18a256[_0xbf32('0x12')][_0xbf32('0x14')]);}logger[_0xbf32('0x12')](_0xbf32('0xd'),_0xca8608,_0x18a256[_0xbf32('0x12')][_0xbf32('0x14')]);return _0x1ce028(_0x18a256[_0xbf32('0x12')][_0xbf32('0x14')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0xca8608,'request\x20sent');_0x1ce028(_0x18a256['result'][_0xbf32('0x14')]);}})[_0xbf32('0x15')](function(_0x53320a){logger[_0xbf32('0x12')](_0xbf32('0xd'),_0xca8608,_0x53320a);_0x4deaf2(_0x53320a);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 9d2d473..80234fe 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 _0x46f0=['put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x39c0a1,_0x1e0ab9){var _0x55e1b0=function(_0x39e124){while(--_0x39e124){_0x39c0a1['push'](_0x39c0a1['shift']());}};_0x55e1b0(++_0x1e0ab9);}(_0x46f0,0x1a7));var _0x046f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x46f0[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require(_0x046f('0x0'));var path=require(_0x046f('0x1'));var timeout=require(_0x046f('0x2'));var express=require(_0x046f('0x3'));var router=express['Router']();var fs_extra=require(_0x046f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x046f('0x5'));var config=require(_0x046f('0x6'));var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0x046f('0x7')](),controller[_0x046f('0x8')]);router[_0x046f('0x9')](_0x046f('0xa'),auth['isAuthenticated'](),controller[_0x046f('0xb')]);router[_0x046f('0xc')]('/',auth[_0x046f('0x7')](),controller[_0x046f('0xd')]);router[_0x046f('0xe')](_0x046f('0xa'),auth[_0x046f('0x7')](),controller[_0x046f('0xf')]);router[_0x046f('0x10')](_0x046f('0xa'),auth[_0x046f('0x7')](),controller[_0x046f('0x11')]);module[_0x046f('0x12')]=router; \ No newline at end of file +var _0xf6d5=['/:id','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','get','index','show','post','isAuthenticated','create'];(function(_0xee8ecf,_0x428de6){var _0x1884c4=function(_0x346bfb){while(--_0x346bfb){_0xee8ecf['push'](_0xee8ecf['shift']());}};_0x1884c4(++_0x428de6);}(_0xf6d5,0x15d));var _0x5f6d=function(_0x32af67,_0xd5da7b){_0x32af67=_0x32af67-0x0;var _0x82acc6=_0xf6d5[_0x32af67];return _0x82acc6;};'use strict';var multer=require(_0x5f6d('0x0'));var util=require(_0x5f6d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5f6d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5f6d('0x3'));var interaction=require(_0x5f6d('0x4'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0x5f6d('0x5')]('/',auth['isAuthenticated'](),controller[_0x5f6d('0x6')]);router[_0x5f6d('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x5f6d('0x7')]);router[_0x5f6d('0x8')]('/',auth[_0x5f6d('0x9')](),controller[_0x5f6d('0xa')]);router['put'](_0x5f6d('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5f6d('0xc')](_0x5f6d('0xb'),auth[_0x5f6d('0x9')](),controller[_0x5f6d('0xd')]);module[_0x5f6d('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 88a3f6d..aabe94f 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 _0xffe0=['select','values','isArray','BOOLEAN','ENUM','voice','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type'];(function(_0x4eeee5,_0x18be46){var _0x389ed6=function(_0x3a0097){while(--_0x3a0097){_0x4eeee5['push'](_0x4eeee5['shift']());}};_0x389ed6(++_0x18be46);}(_0xffe0,0xf6));var _0x0ffe=function(_0x507f16,_0x43521e){_0x507f16=_0x507f16-0x0;var _0x22fbee=_0xffe0[_0x507f16];return _0x22fbee;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x0ffe('0x0')]={'name':{'type':Sequelize[_0x0ffe('0x1')],'get':function(_0x4fdafc){return this[_0x0ffe('0x2')](_0x0ffe('0x3'));}},'alias':{'type':Sequelize[_0x0ffe('0x4')],'allowNull':![],'set':function(_0x4d23d8){this[_0x0ffe('0x5')](_0x0ffe('0x3'),_0x4d23d8?_0x4d23d8:this['getDataValue'](_0x0ffe('0x6')));}},'type':{'type':Sequelize[_0x0ffe('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x0ffe('0x7')](_0x0ffe('0x8')),'get':function(){if(this[_0x0ffe('0x2')](_0x0ffe('0x9'))===_0x0ffe('0xa')){return JSON['parse'](this[_0x0ffe('0x2')](_0x0ffe('0xb')));}else{return this['getDataValue']('values');}},'set':function(_0x3f144f){if(Array[_0x0ffe('0xc')](_0x3f144f)){this[_0x0ffe('0x5')]('values',JSON['stringify'](_0x3f144f));}else{this[_0x0ffe('0x5')]('values',_0x3f144f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x0ffe('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0ffe('0xe')](_0x0ffe('0xf'))}}; \ No newline at end of file +var _0x2c40=['select','parse','values','isArray','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','long','type'];(function(_0x2da7b7,_0x29afea){var _0x1d31ed=function(_0x285cf2){while(--_0x285cf2){_0x2da7b7['push'](_0x2da7b7['shift']());}};_0x1d31ed(++_0x29afea);}(_0x2c40,0x1e3));var _0x02c4=function(_0x549092,_0x2691aa){_0x549092=_0x549092-0x0;var _0x2a6de8=_0x2c40[_0x549092];return _0x2a6de8;};'use strict';var Sequelize=require('sequelize');var _=require(_0x02c4('0x0'));module[_0x02c4('0x1')]={'name':{'type':Sequelize[_0x02c4('0x2')],'get':function(_0x2d38d1){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x02c4('0x3')],'allowNull':![],'set':function(_0x547ed1){this[_0x02c4('0x4')](_0x02c4('0x5'),_0x547ed1?_0x547ed1:this[_0x02c4('0x6')](_0x02c4('0x7')));}},'type':{'type':Sequelize[_0x02c4('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x02c4('0x8')),'get':function(){if(this[_0x02c4('0x6')](_0x02c4('0x9'))===_0x02c4('0xa')){return JSON[_0x02c4('0xb')](this[_0x02c4('0x6')](_0x02c4('0xc')));}else{return this[_0x02c4('0x6')](_0x02c4('0xc'));}},'set':function(_0x2b94de){if(Array[_0x02c4('0xd')](_0x2b94de)){this[_0x02c4('0x4')](_0x02c4('0xc'),JSON['stringify'](_0x2b94de));}else{this[_0x02c4('0x4')](_0x02c4('0xc'),_0x2b94de);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x02c4('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x02c4('0xf')](_0x02c4('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1a6c9dd..aefbd85 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 _0x8bf1=['model','differenceBy','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','options','CmCustomField','includeAll','findAll','catch','show','params','include','find','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type'];(function(_0x6f5942,_0x59d379){var _0x409265=function(_0x510b8d){while(--_0x510b8d){_0x6f5942['push'](_0x6f5942['shift']());}};_0x409265(++_0x59d379);}(_0x8bf1,0xd5));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x18bf('0x0'));var rimraf=require(_0x18bf('0x1'));var zipdir=require(_0x18bf('0x2'));var jsonpatch=require(_0x18bf('0x3'));var rp=require(_0x18bf('0x4'));var moment=require(_0x18bf('0x5'));var BPromise=require(_0x18bf('0x6'));var Mustache=require('mustache');var util=require(_0x18bf('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x18bf('0x8'));var ejs=require(_0x18bf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18bf('0xa'));var squel=require(_0x18bf('0xb'));var crypto=require(_0x18bf('0xc'));var jsforce=require(_0x18bf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x18bf('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x18bf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x18bf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x18bf('0x10'))(_0x18bf('0x11'));var utils=require(_0x18bf('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x18bf('0x13'));var db=require(_0x18bf('0x14'))['db'];function respondWithStatusCode(_0x556d75,_0x43bf79){_0x43bf79=_0x43bf79||0xcc;return function(_0x5536f2){if(_0x5536f2){return _0x556d75['sendStatus'](_0x43bf79);}return _0x556d75[_0x18bf('0x15')](_0x43bf79)['end']();};}function respondWithResult(_0x16d258,_0x37bfc0){_0x37bfc0=_0x37bfc0||0xc8;return function(_0x26a20a){if(_0x26a20a){return _0x16d258['status'](_0x37bfc0)[_0x18bf('0x16')](_0x26a20a);}};}function respondWithFilteredResult(_0x37a650,_0x23d37c){return function(_0x13e21e){if(_0x13e21e){var _0x5bc4ee=typeof _0x23d37c['offset']===_0x18bf('0x17')&&typeof _0x23d37c[_0x18bf('0x18')]===_0x18bf('0x17');var _0x339d02=_0x13e21e[_0x18bf('0x19')];var _0x545ebb=_0x5bc4ee?0x0:_0x23d37c[_0x18bf('0x1a')];var _0x410ba6=_0x5bc4ee?_0x13e21e[_0x18bf('0x19')]:_0x23d37c['offset']+_0x23d37c[_0x18bf('0x18')];var _0x1d5a53;if(_0x410ba6>=_0x339d02){_0x410ba6=_0x339d02;_0x1d5a53=0xc8;}else{_0x1d5a53=0xce;}_0x37a650['status'](_0x1d5a53);return _0x37a650[_0x18bf('0x1b')](_0x18bf('0x1c'),_0x545ebb+'-'+_0x410ba6+'/'+_0x339d02)[_0x18bf('0x16')](_0x13e21e);}return null;};}function patchUpdates(_0xf513e6){return function(_0x522644){try{jsonpatch[_0x18bf('0x1d')](_0x522644,_0xf513e6,!![]);}catch(_0x1cfb20){return BPromise[_0x18bf('0x1e')](_0x1cfb20);}return _0x522644[_0x18bf('0x1f')]();};}function saveUpdates(_0x5a6884,_0x334f2b){return function(_0x29ae8e){if(_0x29ae8e){return _0x29ae8e[_0x18bf('0x20')](_0x5a6884)[_0x18bf('0x21')](function(_0x3eaaa5){return _0x3eaaa5;});}return null;};}function removeEntity(_0x181510,_0x364d9f){return function(_0x4b8607){if(_0x4b8607){return _0x4b8607[_0x18bf('0x22')]()[_0x18bf('0x21')](function(){_0x181510[_0x18bf('0x15')](0xcc)[_0x18bf('0x23')]();});}};}function handleEntityNotFound(_0x155ed3,_0x2f5d88){return function(_0x8f604c){if(!_0x8f604c){_0x155ed3[_0x18bf('0x24')](0x194);}return _0x8f604c;};}function handleError(_0x2da1bf,_0x174b69){_0x174b69=_0x174b69||0x1f4;return function(_0x2d4d79){logger[_0x18bf('0x25')](_0x2d4d79[_0x18bf('0x26')]);if(_0x2d4d79[_0x18bf('0x27')]){delete _0x2d4d79[_0x18bf('0x27')];}_0x2da1bf[_0x18bf('0x15')](_0x174b69)[_0x18bf('0x28')](_0x2d4d79);};}exports[_0x18bf('0x29')]=function(_0x2b2f3f,_0x4d7a2e){var _0x80fa77={},_0x8a93b5={},_0x705267={'count':0x0,'rows':[]};var _0x144db8=_['map'](db['CmCustomField'][_0x18bf('0x2a')],function(_0x10b120){return{'name':_0x10b120[_0x18bf('0x2b')],'type':_0x10b120[_0x18bf('0x2c')]['key']};});_0x8a93b5[_0x18bf('0x2d')]=_[_0x18bf('0x2e')](_['map'](_0x144db8,_0x18bf('0x27')),[_0x18bf('0x27')]);_0x8a93b5[_0x18bf('0x2f')]=_[_0x18bf('0x30')](_0x2b2f3f[_0x18bf('0x2f')]);_0x8a93b5['filters']=_['intersection'](_0x8a93b5[_0x18bf('0x2d')],_0x8a93b5[_0x18bf('0x2f')]);_0x80fa77['attributes']=_[_0x18bf('0x31')](_0x8a93b5['model'],qs[_0x18bf('0x32')](_0x2b2f3f[_0x18bf('0x2f')][_0x18bf('0x32')]));_0x80fa77[_0x18bf('0x33')]=_0x80fa77['attributes'][_0x18bf('0x34')]?_0x80fa77[_0x18bf('0x33')]:_0x8a93b5[_0x18bf('0x2d')];if(!_0x2b2f3f[_0x18bf('0x2f')]['hasOwnProperty'](_0x18bf('0x35'))){_0x80fa77[_0x18bf('0x18')]=qs[_0x18bf('0x18')](_0x2b2f3f[_0x18bf('0x2f')][_0x18bf('0x18')]);_0x80fa77['offset']=qs[_0x18bf('0x1a')](_0x2b2f3f[_0x18bf('0x2f')][_0x18bf('0x1a')]);}_0x80fa77[_0x18bf('0x36')]=qs[_0x18bf('0x37')](_0x2b2f3f[_0x18bf('0x2f')][_0x18bf('0x37')]);_0x80fa77[_0x18bf('0x38')]=qs[_0x18bf('0x39')](_[_0x18bf('0x3a')](_0x2b2f3f['query'],_0x8a93b5[_0x18bf('0x39')]),_0x144db8);if(_0x2b2f3f['query']['filter']){_0x80fa77[_0x18bf('0x38')]=_[_0x18bf('0x3b')](_0x80fa77['where'],{'$or':_[_0x18bf('0x3c')](_0x144db8,function(_0x4a4ee5){if(_0x4a4ee5[_0x18bf('0x2c')]!==_0x18bf('0x3d')){var _0x57d1b1={};_0x57d1b1[_0x4a4ee5[_0x18bf('0x27')]]={'$like':'%'+_0x2b2f3f[_0x18bf('0x2f')]['filter']+'%'};return _0x57d1b1;}})});}_0x80fa77=_['merge']({},_0x80fa77,_0x2b2f3f[_0x18bf('0x3e')]);var _0x49d449={'where':_0x80fa77[_0x18bf('0x38')]};return db[_0x18bf('0x3f')]['count'](_0x49d449)[_0x18bf('0x21')](function(_0x538b9b){_0x705267[_0x18bf('0x19')]=_0x538b9b;if(_0x2b2f3f[_0x18bf('0x2f')][_0x18bf('0x40')]){_0x80fa77['include']=[{'all':!![]}];}return db[_0x18bf('0x3f')][_0x18bf('0x41')](_0x80fa77);})['then'](function(_0x5f4b52){_0x705267['rows']=_0x5f4b52;return _0x705267;})[_0x18bf('0x21')](respondWithFilteredResult(_0x4d7a2e,_0x80fa77))[_0x18bf('0x42')](handleError(_0x4d7a2e,null));};exports[_0x18bf('0x43')]=function(_0x2b7d05,_0x344d80){var _0x5d1f5f={'raw':!![],'where':{'id':_0x2b7d05[_0x18bf('0x44')]['id']}},_0x57ae99={};_0x57ae99['model']=_['keys'](db[_0x18bf('0x3f')]['rawAttributes']);_0x57ae99[_0x18bf('0x2f')]=_[_0x18bf('0x30')](_0x2b7d05['query']);_0x57ae99[_0x18bf('0x39')]=_[_0x18bf('0x31')](_0x57ae99[_0x18bf('0x2d')],_0x57ae99[_0x18bf('0x2f')]);_0x5d1f5f[_0x18bf('0x33')]=_[_0x18bf('0x31')](_0x57ae99[_0x18bf('0x2d')],qs[_0x18bf('0x32')](_0x2b7d05['query'][_0x18bf('0x32')]));_0x5d1f5f[_0x18bf('0x33')]=_0x5d1f5f[_0x18bf('0x33')][_0x18bf('0x34')]?_0x5d1f5f[_0x18bf('0x33')]:_0x57ae99[_0x18bf('0x2d')];if(_0x2b7d05[_0x18bf('0x2f')]['includeAll']){_0x5d1f5f[_0x18bf('0x45')]=[{'all':!![]}];}_0x5d1f5f=_[_0x18bf('0x3b')]({},_0x5d1f5f,_0x2b7d05['options']);return db[_0x18bf('0x3f')][_0x18bf('0x46')](_0x5d1f5f)['then'](handleEntityNotFound(_0x344d80,null))['then'](respondWithResult(_0x344d80,null))[_0x18bf('0x42')](handleError(_0x344d80,null));};exports[_0x18bf('0x20')]=function(_0x440314,_0x256002){if(_0x440314[_0x18bf('0x47')]['id']){delete _0x440314[_0x18bf('0x47')]['id'];}return db[_0x18bf('0x3f')][_0x18bf('0x46')]({'where':{'id':_0x440314[_0x18bf('0x44')]['id']}})['then'](handleEntityNotFound(_0x256002,null))[_0x18bf('0x21')](saveUpdates(_0x440314['body'],null))[_0x18bf('0x21')](respondWithResult(_0x256002,null))[_0x18bf('0x42')](handleError(_0x256002,null));};exports[_0x18bf('0x22')]=function(_0x4828ab,_0x5bc441){return db['CmCustomField'][_0x18bf('0x46')]({'where':{'id':_0x4828ab['params']['id']}})['then'](handleEntityNotFound(_0x5bc441,null))['then'](removeEntity(_0x5bc441,null))[_0x18bf('0x42')](handleError(_0x5bc441,null));};exports[_0x18bf('0x48')]=function(_0x11b23d,_0x294342){var _0x3b73d4;return db[_0x18bf('0x49')][_0x18bf('0x4a')](function(_0x453548){return db[_0x18bf('0x3f')]['create'](_0x11b23d[_0x18bf('0x47')],{'transaction':_0x453548})[_0x18bf('0x21')](function(_0x5b3845){_0x3b73d4=_0x5b3845;var _0xd08525={'type':db[_0x18bf('0x4b')][_0x18bf('0x4c')],'transaction':_0x453548};switch(_0x11b23d[_0x18bf('0x47')][_0x18bf('0x2c')]){case'text':_0xd08525[_0x18bf('0x2c')]=db['Sequelize']['TEXT'];break;case _0x18bf('0x4d'):_0xd08525['type']=db['Sequelize'][_0x18bf('0x4e')];break;case _0x18bf('0x4f'):_0xd08525[_0x18bf('0x2c')]=db['Sequelize'][_0x18bf('0x50')];_0xd08525['defaultValue']=![];break;default:}return db['sequelize'][_0x18bf('0x51')][_0x18bf('0x52')](_0x18bf('0x53'),util[_0x18bf('0x54')](_0x18bf('0x55'),_0x3b73d4['id']),_0xd08525);})[_0x18bf('0x21')](function(){return _0x3b73d4;});})[_0x18bf('0x21')](respondWithResult(_0x294342,0xc9))['catch'](handleError(_0x294342,null));}; \ No newline at end of file +var _0x32c5=['rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','body','destroy','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format'];(function(_0x5d68bb,_0x131909){var _0x3dfcd9=function(_0x4d593d){while(--_0x4d593d){_0x5d68bb['push'](_0x5d68bb['shift']());}};_0x3dfcd9(++_0x131909);}(_0x32c5,0x1b2));var _0x532c=function(_0x29d036,_0xfcbfbf){_0x29d036=_0x29d036-0x0;var _0x102a2c=_0x32c5[_0x29d036];return _0x102a2c;};'use strict';var emlformat=require(_0x532c('0x0'));var rimraf=require(_0x532c('0x1'));var zipdir=require(_0x532c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x532c('0x3'));var moment=require('moment');var BPromise=require(_0x532c('0x4'));var Mustache=require(_0x532c('0x5'));var util=require(_0x532c('0x6'));var path=require('path');var sox=require(_0x532c('0x7'));var csv=require(_0x532c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x532c('0x9'));var squel=require(_0x532c('0xa'));var crypto=require(_0x532c('0xb'));var jsforce=require(_0x532c('0xc'));var deskjs=require(_0x532c('0xd'));var toCsv=require(_0x532c('0x8'));var querystring=require('querystring');var Papa=require(_0x532c('0xe'));var Redis=require(_0x532c('0xf'));var authService=require(_0x532c('0x10'));var qs=require(_0x532c('0x11'));var as=require(_0x532c('0x12'));var hardwareService=require(_0x532c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x532c('0x14'));var config=require(_0x532c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x532c('0x16'))['db'];function respondWithStatusCode(_0x4e0544,_0x417029){_0x417029=_0x417029||0xcc;return function(_0x413312){if(_0x413312){return _0x4e0544[_0x532c('0x17')](_0x417029);}return _0x4e0544[_0x532c('0x18')](_0x417029)[_0x532c('0x19')]();};}function respondWithResult(_0x33348d,_0x4d738f){_0x4d738f=_0x4d738f||0xc8;return function(_0x59f333){if(_0x59f333){return _0x33348d[_0x532c('0x18')](_0x4d738f)[_0x532c('0x1a')](_0x59f333);}};}function respondWithFilteredResult(_0x210e7f,_0x4af7ff){return function(_0x34661a){if(_0x34661a){var _0x5d05c1=typeof _0x4af7ff[_0x532c('0x1b')]===_0x532c('0x1c')&&typeof _0x4af7ff[_0x532c('0x1d')]==='undefined';var _0x3c637c=_0x34661a[_0x532c('0x1e')];var _0x280511=_0x5d05c1?0x0:_0x4af7ff[_0x532c('0x1b')];var _0x2d3bf8=_0x5d05c1?_0x34661a['count']:_0x4af7ff[_0x532c('0x1b')]+_0x4af7ff[_0x532c('0x1d')];var _0x37d612;if(_0x2d3bf8>=_0x3c637c){_0x2d3bf8=_0x3c637c;_0x37d612=0xc8;}else{_0x37d612=0xce;}_0x210e7f[_0x532c('0x18')](_0x37d612);return _0x210e7f['set'](_0x532c('0x1f'),_0x280511+'-'+_0x2d3bf8+'/'+_0x3c637c)[_0x532c('0x1a')](_0x34661a);}return null;};}function patchUpdates(_0x4158df){return function(_0x11dffb){try{jsonpatch[_0x532c('0x20')](_0x11dffb,_0x4158df,!![]);}catch(_0x3b7724){return BPromise[_0x532c('0x21')](_0x3b7724);}return _0x11dffb[_0x532c('0x22')]();};}function saveUpdates(_0x503415,_0x47d23f){return function(_0x5f55ee){if(_0x5f55ee){return _0x5f55ee[_0x532c('0x23')](_0x503415)['then'](function(_0x407929){return _0x407929;});}return null;};}function removeEntity(_0x16757a,_0x1f855f){return function(_0x13509d){if(_0x13509d){return _0x13509d['destroy']()[_0x532c('0x24')](function(){_0x16757a[_0x532c('0x18')](0xcc)[_0x532c('0x19')]();});}};}function handleEntityNotFound(_0x24d814,_0x4323b0){return function(_0x5a6a67){if(!_0x5a6a67){_0x24d814[_0x532c('0x17')](0x194);}return _0x5a6a67;};}function handleError(_0x1159c0,_0xb3d135){_0xb3d135=_0xb3d135||0x1f4;return function(_0x184afb){logger['error'](_0x184afb[_0x532c('0x25')]);if(_0x184afb[_0x532c('0x26')]){delete _0x184afb[_0x532c('0x26')];}_0x1159c0['status'](_0xb3d135)['send'](_0x184afb);};}exports[_0x532c('0x27')]=function(_0x3134be,_0x4a0d37){var _0xd44930={},_0x589010={},_0x4d0bfd={'count':0x0,'rows':[]};var _0x3dbf64=_[_0x532c('0x28')](db[_0x532c('0x29')][_0x532c('0x2a')],function(_0x4a82a7){return{'name':_0x4a82a7[_0x532c('0x2b')],'type':_0x4a82a7[_0x532c('0x2c')]['key']};});_0x589010[_0x532c('0x2d')]=_[_0x532c('0x2e')](_[_0x532c('0x28')](_0x3dbf64,_0x532c('0x26')),[_0x532c('0x26')]);_0x589010[_0x532c('0x2f')]=_[_0x532c('0x30')](_0x3134be[_0x532c('0x2f')]);_0x589010[_0x532c('0x31')]=_[_0x532c('0x32')](_0x589010[_0x532c('0x2d')],_0x589010[_0x532c('0x2f')]);_0xd44930[_0x532c('0x33')]=_['intersection'](_0x589010[_0x532c('0x2d')],qs[_0x532c('0x34')](_0x3134be[_0x532c('0x2f')][_0x532c('0x34')]));_0xd44930[_0x532c('0x33')]=_0xd44930['attributes'][_0x532c('0x35')]?_0xd44930['attributes']:_0x589010['model'];if(!_0x3134be[_0x532c('0x2f')][_0x532c('0x36')](_0x532c('0x37'))){_0xd44930[_0x532c('0x1d')]=qs[_0x532c('0x1d')](_0x3134be[_0x532c('0x2f')][_0x532c('0x1d')]);_0xd44930[_0x532c('0x1b')]=qs['offset'](_0x3134be['query']['offset']);}_0xd44930['order']=qs['sort'](_0x3134be[_0x532c('0x2f')][_0x532c('0x38')]);_0xd44930[_0x532c('0x39')]=qs[_0x532c('0x31')](_[_0x532c('0x3a')](_0x3134be[_0x532c('0x2f')],_0x589010[_0x532c('0x31')]),_0x3dbf64);if(_0x3134be[_0x532c('0x2f')][_0x532c('0x3b')]){_0xd44930['where']=_[_0x532c('0x3c')](_0xd44930[_0x532c('0x39')],{'$or':_[_0x532c('0x28')](_0x3dbf64,function(_0x1719d7){if(_0x1719d7[_0x532c('0x2c')]!==_0x532c('0x3d')){var _0x34862a={};_0x34862a[_0x1719d7['name']]={'$like':'%'+_0x3134be[_0x532c('0x2f')]['filter']+'%'};return _0x34862a;}})});}_0xd44930=_[_0x532c('0x3c')]({},_0xd44930,_0x3134be[_0x532c('0x3e')]);var _0xba23da={'where':_0xd44930[_0x532c('0x39')]};return db[_0x532c('0x29')]['count'](_0xba23da)[_0x532c('0x24')](function(_0x620ce0){_0x4d0bfd[_0x532c('0x1e')]=_0x620ce0;if(_0x3134be[_0x532c('0x2f')][_0x532c('0x3f')]){_0xd44930[_0x532c('0x40')]=[{'all':!![]}];}return db[_0x532c('0x29')][_0x532c('0x41')](_0xd44930);})[_0x532c('0x24')](function(_0x263ffd){_0x4d0bfd[_0x532c('0x42')]=_0x263ffd;return _0x4d0bfd;})[_0x532c('0x24')](respondWithFilteredResult(_0x4a0d37,_0xd44930))['catch'](handleError(_0x4a0d37,null));};exports[_0x532c('0x43')]=function(_0x20818e,_0x423013){var _0x3a442d={'raw':!![],'where':{'id':_0x20818e[_0x532c('0x44')]['id']}},_0x595864={};_0x595864[_0x532c('0x2d')]=_[_0x532c('0x30')](db[_0x532c('0x29')]['rawAttributes']);_0x595864[_0x532c('0x2f')]=_[_0x532c('0x30')](_0x20818e[_0x532c('0x2f')]);_0x595864['filters']=_[_0x532c('0x32')](_0x595864[_0x532c('0x2d')],_0x595864['query']);_0x3a442d[_0x532c('0x33')]=_[_0x532c('0x32')](_0x595864[_0x532c('0x2d')],qs[_0x532c('0x34')](_0x20818e[_0x532c('0x2f')][_0x532c('0x34')]));_0x3a442d[_0x532c('0x33')]=_0x3a442d['attributes'][_0x532c('0x35')]?_0x3a442d['attributes']:_0x595864[_0x532c('0x2d')];if(_0x20818e['query'][_0x532c('0x3f')]){_0x3a442d[_0x532c('0x40')]=[{'all':!![]}];}_0x3a442d=_[_0x532c('0x3c')]({},_0x3a442d,_0x20818e[_0x532c('0x3e')]);return db[_0x532c('0x29')][_0x532c('0x45')](_0x3a442d)[_0x532c('0x24')](handleEntityNotFound(_0x423013,null))['then'](respondWithResult(_0x423013,null))[_0x532c('0x46')](handleError(_0x423013,null));};exports[_0x532c('0x23')]=function(_0x2a79f0,_0xddadbe){if(_0x2a79f0[_0x532c('0x47')]['id']){delete _0x2a79f0[_0x532c('0x47')]['id'];}return db[_0x532c('0x29')][_0x532c('0x45')]({'where':{'id':_0x2a79f0['params']['id']}})[_0x532c('0x24')](handleEntityNotFound(_0xddadbe,null))[_0x532c('0x24')](saveUpdates(_0x2a79f0['body'],null))['then'](respondWithResult(_0xddadbe,null))[_0x532c('0x46')](handleError(_0xddadbe,null));};exports[_0x532c('0x48')]=function(_0xaa48d6,_0x543ea4){return db[_0x532c('0x29')]['find']({'where':{'id':_0xaa48d6[_0x532c('0x44')]['id']}})[_0x532c('0x24')](handleEntityNotFound(_0x543ea4,null))[_0x532c('0x24')](removeEntity(_0x543ea4,null))[_0x532c('0x46')](handleError(_0x543ea4,null));};exports[_0x532c('0x49')]=function(_0x1a025a,_0x3ff727){var _0x13a19c;return db[_0x532c('0x4a')][_0x532c('0x4b')](function(_0xb0ef64){return db[_0x532c('0x29')][_0x532c('0x49')](_0x1a025a[_0x532c('0x47')],{'transaction':_0xb0ef64})[_0x532c('0x24')](function(_0x396c48){_0x13a19c=_0x396c48;var _0x18292b={'type':db[_0x532c('0x4c')][_0x532c('0x4d')],'transaction':_0xb0ef64};switch(_0x1a025a[_0x532c('0x47')][_0x532c('0x2c')]){case'text':_0x18292b[_0x532c('0x2c')]=db[_0x532c('0x4c')]['TEXT'];break;case _0x532c('0x4e'):_0x18292b[_0x532c('0x2c')]=db[_0x532c('0x4c')][_0x532c('0x4f')];break;case _0x532c('0x50'):_0x18292b[_0x532c('0x2c')]=db[_0x532c('0x4c')][_0x532c('0x51')];_0x18292b['defaultValue']=![];break;default:}return db['sequelize'][_0x532c('0x52')][_0x532c('0x53')](_0x532c('0x54'),util[_0x532c('0x55')](_0x532c('0x56'),_0x13a19c['id']),_0x18292b);})['then'](function(){return _0x13a19c;});})[_0x532c('0x24')](respondWithResult(_0x3ff727,0xc9))[_0x532c('0x46')](handleError(_0x3ff727,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c20337a..430a736 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 _0x1c5a=['cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x58cec2,_0x1159a0){var _0xa8147d=function(_0x4a130a){while(--_0x4a130a){_0x58cec2['push'](_0x58cec2['shift']());}};_0xa8147d(++_0x1159a0);}(_0x1c5a,0x1b3));var _0xa1c5=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x1c5a[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xa1c5('0x0'));var util=require('util');var logger=require(_0xa1c5('0x1'))(_0xa1c5('0x2'));var moment=require(_0xa1c5('0x3'));var BPromise=require(_0xa1c5('0x4'));var rp=require(_0xa1c5('0x5'));var fs=require('fs');var path=require(_0xa1c5('0x6'));var rimraf=require(_0xa1c5('0x7'));var config=require(_0xa1c5('0x8'));var attributes=require(_0xa1c5('0x9'));module[_0xa1c5('0xa')]=function(_0x4c5973,_0xe4c097){return _0x4c5973[_0xa1c5('0xb')](_0xa1c5('0xc'),attributes,{'tableName':_0xa1c5('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x555d=['exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26c427,_0x3fa48a){var _0x37329c=function(_0x1855eb){while(--_0x1855eb){_0x26c427['push'](_0x26c427['shift']());}};_0x37329c(++_0x3fa48a);}(_0x555d,0xac));var _0xd555=function(_0x8ac5b5,_0x31f591){_0x8ac5b5=_0x8ac5b5-0x0;var _0x5c1b1d=_0x555d[_0x8ac5b5];return _0x5c1b1d;};'use strict';var _=require(_0xd555('0x0'));var util=require(_0xd555('0x1'));var logger=require(_0xd555('0x2'))(_0xd555('0x3'));var moment=require(_0xd555('0x4'));var BPromise=require(_0xd555('0x5'));var rp=require(_0xd555('0x6'));var fs=require('fs');var path=require(_0xd555('0x7'));var rimraf=require(_0xd555('0x8'));var config=require(_0xd555('0x9'));var attributes=require('./cmCustomField.attributes');module[_0xd555('0xa')]=function(_0x183601,_0x618b0){return _0x183601[_0xd555('0xb')](_0xd555('0xc'),attributes,{'tableName':_0xd555('0xd'),'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 2bbd8a7..039c895 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 _0x1cef=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmCustomField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x9ec221,_0x2594a6){var _0xdbe55e=function(_0x4b4c43){while(--_0x4b4c43){_0x9ec221['push'](_0x9ec221['shift']());}};_0xdbe55e(++_0x2594a6);}(_0x1cef,0xc2));var _0xf1ce=function(_0x12e3e3,_0x501eaf){_0x12e3e3=_0x12e3e3-0x0;var _0x26602e=_0x1cef[_0x12e3e3];return _0x26602e;};'use strict';var _=require(_0xf1ce('0x0'));var util=require(_0xf1ce('0x1'));var moment=require(_0xf1ce('0x2'));var BPromise=require(_0xf1ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf1ce('0x5'));var logger=require(_0xf1ce('0x6'))(_0xf1ce('0x7'));var config=require(_0xf1ce('0x8'));var jayson=require(_0xf1ce('0x9'));var client=jayson[_0xf1ce('0xa')][_0xf1ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b2058,_0x17d315,_0x43daa3){return new BPromise(function(_0x5acd5d,_0x2a4ad3){return client['request'](_0x1b2058,_0x43daa3)[_0xf1ce('0xc')](function(_0x16a439){logger[_0xf1ce('0xd')]('CmCustomField,\x20%s,\x20%s',_0x17d315,'request\x20sent');logger[_0xf1ce('0xe')](_0xf1ce('0xf'),_0x17d315,_0xf1ce('0x10'),JSON[_0xf1ce('0x11')](_0x16a439));if(_0x16a439[_0xf1ce('0x12')]){if(_0x16a439[_0xf1ce('0x12')]['code']===0x1f4){logger['error'](_0xf1ce('0x13'),_0x17d315,_0x16a439['error'][_0xf1ce('0x14')]);return _0x2a4ad3(_0x16a439['error']['message']);}logger[_0xf1ce('0x12')](_0xf1ce('0x13'),_0x17d315,_0x16a439[_0xf1ce('0x12')]['message']);return _0x5acd5d(_0x16a439[_0xf1ce('0x12')][_0xf1ce('0x14')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x17d315,_0xf1ce('0x10'));_0x5acd5d(_0x16a439[_0xf1ce('0x15')][_0xf1ce('0x14')]);}})['catch'](function(_0x2f3044){logger[_0xf1ce('0x12')](_0xf1ce('0x13'),_0x17d315,_0x2f3044);_0x2a4ad3(_0x2f3044);});});} \ No newline at end of file +var _0xe3b0=['code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe3b0,0x123));var _0x0e3b=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0xe3b0[_0x3b96cf];return _0x2e315a;};'use strict';var _=require(_0x0e3b('0x0'));var util=require(_0x0e3b('0x1'));var moment=require(_0x0e3b('0x2'));var BPromise=require(_0x0e3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e3b('0x5'));var logger=require(_0x0e3b('0x6'))(_0x0e3b('0x7'));var config=require(_0x0e3b('0x8'));var jayson=require(_0x0e3b('0x9'));var client=jayson[_0x0e3b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43b1c0,_0x321f73,_0x10a9ee){return new BPromise(function(_0x424409,_0x53f205){return client['request'](_0x43b1c0,_0x10a9ee)['then'](function(_0x1cf3cd){logger[_0x0e3b('0xb')]('CmCustomField,\x20%s,\x20%s',_0x321f73,_0x0e3b('0xc'));logger[_0x0e3b('0xd')](_0x0e3b('0xe'),_0x321f73,_0x0e3b('0xc'),JSON[_0x0e3b('0xf')](_0x1cf3cd));if(_0x1cf3cd[_0x0e3b('0x10')]){if(_0x1cf3cd[_0x0e3b('0x10')][_0x0e3b('0x11')]===0x1f4){logger[_0x0e3b('0x10')](_0x0e3b('0x12'),_0x321f73,_0x1cf3cd['error']['message']);return _0x53f205(_0x1cf3cd[_0x0e3b('0x10')][_0x0e3b('0x13')]);}logger['error'](_0x0e3b('0x12'),_0x321f73,_0x1cf3cd['error'][_0x0e3b('0x13')]);return _0x424409(_0x1cf3cd[_0x0e3b('0x10')][_0x0e3b('0x13')]);}else{logger['info'](_0x0e3b('0x12'),_0x321f73,'request\x20sent');_0x424409(_0x1cf3cd[_0x0e3b('0x14')]['message']);}})[_0x0e3b('0x15')](function(_0x3eb27c){logger[_0x0e3b('0x10')](_0x0e3b('0x12'),_0x321f73,_0x3eb27c);_0x53f205(_0x3eb27c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index b18b24e..627fb0e 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 _0x1e9d=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','post','create','put','update','delete','destroy'];(function(_0x40ba05,_0x34bcff){var _0x4fc163=function(_0x43c969){while(--_0x43c969){_0x40ba05['push'](_0x40ba05['shift']());}};_0x4fc163(++_0x34bcff);}(_0x1e9d,0x1dd));var _0xd1e9=function(_0x49e483,_0x2978e6){_0x49e483=_0x49e483-0x0;var _0xf155a6=_0x1e9d[_0x49e483];return _0xf155a6;};'use strict';var multer=require(_0xd1e9('0x0'));var util=require('util');var path=require(_0xd1e9('0x1'));var timeout=require(_0xd1e9('0x2'));var express=require(_0xd1e9('0x3'));var router=express[_0xd1e9('0x4')]();var fs_extra=require(_0xd1e9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd1e9('0x6'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd1e9('0x7')](_0xd1e9('0x8'),auth[_0xd1e9('0x9')](),controller['show']);router[_0xd1e9('0xa')]('/',auth['isAuthenticated'](),controller[_0xd1e9('0xb')]);router[_0xd1e9('0xc')](_0xd1e9('0x8'),auth[_0xd1e9('0x9')](),controller[_0xd1e9('0xd')]);router[_0xd1e9('0xe')](_0xd1e9('0x8'),auth[_0xd1e9('0x9')](),controller[_0xd1e9('0xf')]);module[_0xd1e9('0x10')]=router; \ No newline at end of file +var _0x5b2e=['show','create','put','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5b2e,0xe5));var _0xe5b2=function(_0x5e05a8,_0x1412ba){_0x5e05a8=_0x5e05a8-0x0;var _0x39a26f=_0x5b2e[_0x5e05a8];return _0x39a26f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe5b2('0x0'));var express=require(_0xe5b2('0x1'));var router=express[_0xe5b2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe5b2('0x3'));var interaction=require(_0xe5b2('0x4'));var config=require(_0xe5b2('0x5'));var controller=require(_0xe5b2('0x6'));router[_0xe5b2('0x7')]('/',auth['isAuthenticated'](),controller[_0xe5b2('0x8')]);router[_0xe5b2('0x7')](_0xe5b2('0x9'),auth[_0xe5b2('0xa')](),controller[_0xe5b2('0xb')]);router['post']('/',auth[_0xe5b2('0xa')](),controller[_0xe5b2('0xc')]);router[_0xe5b2('0xd')](_0xe5b2('0x9'),auth[_0xe5b2('0xa')](),controller['update']);router[_0xe5b2('0xe')]('/:id',auth[_0xe5b2('0xa')](),controller['destroy']);module[_0xe5b2('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 27c846d..ed641a5 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 _0xb389=['BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x261eb4,_0x27c4c6){var _0x564bc1=function(_0x505b7a){while(--_0x505b7a){_0x261eb4['push'](_0x261eb4['shift']());}};_0x564bc1(++_0x27c4c6);}(_0xb389,0x87));var _0x9b38=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xb389[_0x1cb18a];return _0x22442e;};'use strict';var moment=require(_0x9b38('0x0'));var Sequelize=require(_0x9b38('0x1'));module[_0x9b38('0x2')]={'phone':{'type':Sequelize[_0x9b38('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9b38('0x4')],'defaultValue':moment()[_0x9b38('0x5')](_0x9b38('0x6'))},'countbusyretry':{'type':Sequelize[_0x9b38('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9b38('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9b38('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9b38('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x9b38('0x7')](0x2)[_0x9b38('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9b38('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9b38('0x7')],'unique':_0x9b38('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x9b38('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x9b38('0xa')},'CampaignId':{'type':Sequelize[_0x9b38('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x9b38('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9b38('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9b38('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9b38('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9b38('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9b38('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9b38('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x9b38('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x1bff=['BOOLEAN','STRING','UNSIGNED','contactListQueue','moment','exports','DATE','format','INTEGER'];(function(_0x176d2,_0x3f1861){var _0x5af7f7=function(_0x189cdb){while(--_0x189cdb){_0x176d2['push'](_0x176d2['shift']());}};_0x5af7f7(++_0x3f1861);}(_0x1bff,0xd3));var _0xf1bf=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x1bff[_0x8c8176];return _0x4dc47b;};'use strict';var moment=require(_0xf1bf('0x0'));var Sequelize=require('sequelize');module[_0xf1bf('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf1bf('0x2')],'defaultValue':moment()[_0xf1bf('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xf1bf('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf1bf('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf1bf('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf1bf('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf1bf('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf1bf('0x2')]},'priority':{'type':Sequelize[_0xf1bf('0x4')](0x2)[_0xf1bf('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf1bf('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf1bf('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xf1bf('0x4')],'unique':_0xf1bf('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xf1bf('0x4')],'unique':_0xf1bf('0x8')},'CampaignId':{'type':Sequelize[_0xf1bf('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xf1bf('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf1bf('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf1bf('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf1bf('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xf1bf('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf1bf('0x6')]},'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 20c8195..48438f6 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 _0x1670=['scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','getPreviewRecall','findOne','Queue','dialActive','getOpenContacts','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','update','sendStatus','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','intersection','filters','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$notILike','$contains','$contained','$any','fields','attributes','length','sort','where','pick','merge','VIRTUAL','filter','then','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','user','value','direction','isEmpty','priority','scheduledAt','DESC','ASC','literal','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1670,0x9a));var _0x0167=function(_0xa91ebb,_0x3a7ef0){_0xa91ebb=_0xa91ebb-0x0;var _0x494a17=_0x1670[_0xa91ebb];return _0x494a17;};'use strict';var moment=require(_0x0167('0x0'));var _=require(_0x0167('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x0167('0x2'))('api');var shared=require(_0x0167('0x3'));var db=require(_0x0167('0x4'))['db'];function respondWithResult(_0x377590,_0x6f87ae){_0x6f87ae=_0x6f87ae||0xc8;return function(_0x5786d8){if(_0x5786d8){return _0x377590['status'](_0x6f87ae)[_0x0167('0x5')](_0x5786d8);}};}function respondWithFilteredResult(_0x1ae650,_0x295e51){return function(_0x3e1507){if(_0x3e1507){var _0x2120f2=typeof _0x295e51[_0x0167('0x6')]===_0x0167('0x7')&&typeof _0x295e51[_0x0167('0x8')]==='undefined';var _0x4c6b78=_0x3e1507[_0x0167('0x9')];var _0x178f5f=_0x2120f2?0x0:_0x295e51[_0x0167('0x6')];var _0x1632d4=_0x2120f2?_0x3e1507[_0x0167('0x9')]:_0x295e51[_0x0167('0x6')]+_0x295e51[_0x0167('0x8')];var _0x194af9;if(_0x1632d4>=_0x4c6b78){_0x1632d4=_0x4c6b78;_0x194af9=0xc8;}else{_0x194af9=0xce;}_0x1ae650[_0x0167('0xa')](_0x194af9);return _0x1ae650[_0x0167('0xb')](_0x0167('0xc'),_0x178f5f+'-'+_0x1632d4+'/'+_0x4c6b78)[_0x0167('0x5')](_0x3e1507);}return null;};}function saveUpdates(_0x34ac02,_0x2ebfa3){return function(_0x570965){if(_0x570965){return _0x570965[_0x0167('0xd')](_0x34ac02)['then'](function(_0x25e5d4){return _0x25e5d4;});}return null;};}function handleEntityNotFound(_0x5eb5f9,_0x7744d1){return function(_0x39e644){if(!_0x39e644){_0x5eb5f9[_0x0167('0xe')](0x194);}return _0x39e644;};}function handleError(_0x57c0e0,_0x50c1a3){_0x50c1a3=_0x50c1a3||0x1f4;return function(_0x547dea){logger[_0x0167('0xf')](_0x547dea[_0x0167('0x10')]);if(_0x547dea['name']){delete _0x547dea[_0x0167('0x11')];}_0x57c0e0['status'](_0x50c1a3)['send'](_0x547dea);};}exports[_0x0167('0x12')]=function(_0x574f04,_0x22f07c){var _0x4c0e4f={},_0x16094a={},_0x2740b5={'count':0x0,'rows':[]};var _0x170207=_[_0x0167('0x13')](db[_0x0167('0x14')][_0x0167('0x15')],function(_0xa384d9){return{'name':_0xa384d9[_0x0167('0x16')],'type':_0xa384d9[_0x0167('0x17')][_0x0167('0x18')]};});_0x16094a[_0x0167('0x19')]=_[_0x0167('0x13')](_0x170207,'name');_0x16094a[_0x0167('0x1a')]=_[_0x0167('0x1b')](_0x574f04[_0x0167('0x1a')]);_0x16094a['filters']=_[_0x0167('0x1c')](_0x16094a[_0x0167('0x19')],_0x16094a[_0x0167('0x1a')]);_0x16094a[_0x0167('0x1d')]=_['concat'](_0x16094a[_0x0167('0x1d')],['$and',_0x0167('0x1e'),_0x0167('0x1f'),_0x0167('0x20'),_0x0167('0x21'),_0x0167('0x22'),_0x0167('0x23'),_0x0167('0x24'),'$not',_0x0167('0x25'),_0x0167('0x26'),_0x0167('0x27'),'$notIn',_0x0167('0x28'),_0x0167('0x29'),'$iLike',_0x0167('0x2a'),_0x0167('0x28'),'$overlap',_0x0167('0x2b'),_0x0167('0x2c'),_0x0167('0x2d')]);_0x4c0e4f['attributes']=_[_0x0167('0x1c')](_0x16094a[_0x0167('0x19')],qs['fields'](_0x574f04['query'][_0x0167('0x2e')]));_0x4c0e4f[_0x0167('0x2f')]=_0x4c0e4f[_0x0167('0x2f')][_0x0167('0x30')]?_0x4c0e4f['attributes']:_0x16094a['model'];if(!_0x574f04[_0x0167('0x1a')]['hasOwnProperty']('nolimit')){_0x4c0e4f[_0x0167('0x8')]=qs[_0x0167('0x8')](_0x574f04[_0x0167('0x1a')][_0x0167('0x8')]);_0x4c0e4f[_0x0167('0x6')]=qs[_0x0167('0x6')](_0x574f04[_0x0167('0x1a')]['offset']);}_0x4c0e4f['order']=qs[_0x0167('0x31')](_0x574f04[_0x0167('0x1a')][_0x0167('0x31')]);_0x4c0e4f[_0x0167('0x32')]=qs[_0x0167('0x1d')](_[_0x0167('0x33')](_0x574f04['query'],_0x16094a[_0x0167('0x1d')]),_0x170207);if(_0x574f04['query']['filter']){_0x4c0e4f[_0x0167('0x32')]=_[_0x0167('0x34')](_0x4c0e4f[_0x0167('0x32')],{'$or':_['map'](_0x170207,function(_0x29355d){if(_0x29355d[_0x0167('0x17')]!==_0x0167('0x35')){var _0xb0cc5c={};_0xb0cc5c[_0x29355d['name']]={'$like':'%'+_0x574f04[_0x0167('0x1a')][_0x0167('0x36')]+'%'};return _0xb0cc5c;}})});}_0x4c0e4f=_[_0x0167('0x34')]({},_0x4c0e4f,_0x574f04['options']);var _0x2ba723={'where':_0x4c0e4f[_0x0167('0x32')]};return db[_0x0167('0x14')][_0x0167('0x9')](_0x2ba723)[_0x0167('0x37')](function(_0x5ef495){_0x2740b5[_0x0167('0x9')]=_0x5ef495;if(_0x574f04[_0x0167('0x1a')]['includeAll']){_0x4c0e4f[_0x0167('0x38')]=[{'all':!![]}];}return db[_0x0167('0x14')][_0x0167('0x39')](_0x4c0e4f);})[_0x0167('0x37')](function(_0x1280b4){_0x2740b5[_0x0167('0x3a')]=_0x1280b4;return _0x2740b5;})['then'](respondWithFilteredResult(_0x22f07c,_0x4c0e4f))[_0x0167('0x3b')](handleError(_0x22f07c,null));};exports[_0x0167('0x3c')]=function(_0x3bf14c,_0x34981a){var _0x49dc4d={'raw':!![],'where':{'id':_0x3bf14c[_0x0167('0x3d')]['id']}},_0x42cfe1={};_0x42cfe1['model']=_[_0x0167('0x1b')](db[_0x0167('0x14')][_0x0167('0x15')]);_0x42cfe1['query']=_[_0x0167('0x1b')](_0x3bf14c[_0x0167('0x1a')]);_0x42cfe1[_0x0167('0x1d')]=_[_0x0167('0x1c')](_0x42cfe1[_0x0167('0x19')],_0x42cfe1[_0x0167('0x1a')]);_0x49dc4d[_0x0167('0x2f')]=_[_0x0167('0x1c')](_0x42cfe1['model'],qs[_0x0167('0x2e')](_0x3bf14c['query'][_0x0167('0x2e')]));_0x49dc4d[_0x0167('0x2f')]=_0x49dc4d[_0x0167('0x2f')]['length']?_0x49dc4d['attributes']:_0x42cfe1['model'];if(_0x3bf14c[_0x0167('0x1a')][_0x0167('0x3e')]){_0x49dc4d[_0x0167('0x38')]=[{'all':!![]}];}_0x49dc4d=_[_0x0167('0x34')]({},_0x49dc4d,_0x3bf14c[_0x0167('0x3f')]);return db[_0x0167('0x14')]['find'](_0x49dc4d)['then'](handleEntityNotFound(_0x34981a,null))['then'](respondWithResult(_0x34981a,null))[_0x0167('0x3b')](handleError(_0x34981a,null));};exports['create']=function(_0x117123,_0x20c350){return db[_0x0167('0x14')][_0x0167('0x40')](_0x117123['body'],{})[_0x0167('0x37')](respondWithResult(_0x20c350,0xc9))[_0x0167('0x3b')](handleError(_0x20c350,null));};exports[_0x0167('0xd')]=function(_0x431cb7,_0x2c910a){if(_0x431cb7[_0x0167('0x41')]['id']){delete _0x431cb7[_0x0167('0x41')]['id'];}return db[_0x0167('0x14')][_0x0167('0x42')]({'where':{'id':_0x431cb7[_0x0167('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2c910a,null))['then'](saveUpdates(_0x431cb7[_0x0167('0x41')],null))['then'](respondWithResult(_0x2c910a,null))[_0x0167('0x3b')](handleError(_0x2c910a,null));};exports['describe']=function(_0x2c3efc,_0x52b720){return db[_0x0167('0x14')][_0x0167('0x43')]()['then'](respondWithResult(_0x52b720,null))['catch'](handleError(_0x52b720,null));};exports['destroy']=function(_0x174a7a,_0x55aaa0){var _0x5e3746;var _0x18d29d=_0x174a7a['params']['id'];return db[_0x0167('0x14')][_0x0167('0x42')]({'where':{'id':_0x174a7a[_0x0167('0x3d')]['id']}})['then'](handleEntityNotFound(_0x55aaa0,null))[_0x0167('0x37')](function(_0x5d1bbd){if(_0x5d1bbd){return _0x5d1bbd['destroy']()['then'](function(_0xecc47d){return _0xecc47d;});}})[_0x0167('0x37')](function(_0x3bb496){_0x5e3746=_0x3bb496;if(_0x3bb496){if(_0x3bb496[_0x0167('0x44')]||_0x3bb496[_0x0167('0x45')]){return db[_0x3bb496['VoiceQueueId']?_0x0167('0x46'):_0x0167('0x47')][_0x0167('0x42')]({'where':{'id':_0x3bb496[_0x0167('0x44')]?_0x3bb496['VoiceQueueId']:_0x3bb496['CampaignId']},'attributes':['id',_0x0167('0x11')],'raw':!![]});}}})['then'](function(_0x3a9e01){var _0x1deb9c={};if(_0x3a9e01){_[_0x0167('0x34')](_0x1deb9c,_[_0x0167('0x48')](_0x5e3746[_0x0167('0x49')],[_0x0167('0x4a'),_0x0167('0x4b'),'id']));_0x1deb9c[_0x0167('0x4c')]=0x15;_0x1deb9c[_0x0167('0x4d')]=_0x0167('0x4e');_0x1deb9c['campaign']=_0x3a9e01['name'];_0x1deb9c[_0x0167('0x4f')]=_0x174a7a['user'][_0x0167('0x11')];_0x1deb9c[_0x0167('0x50')]=_0x174a7a['user']['id'];_0x1deb9c[_0x0167('0x4e')]=!![];_0x1deb9c[_0x0167('0x51')]=moment()['format'](_0x0167('0x52'));_0x1deb9c[_0x0167('0x53')]=_0x5e3746[_0x0167('0x54')];_0x1deb9c[_0x0167('0x55')]=_0x5e3746['VoiceQueueId']?_0x0167('0x56'):_0x0167('0x57');return db[_0x0167('0x58')]['find']({'where':{'id':_0x1deb9c[_0x0167('0x59')]},'attributes':[_0x0167('0x5a'),_0x0167('0x5b')]})[_0x0167('0x37')](function(_0x35ceda){if(!_[_0x0167('0x5c')](_0x55aaa0)&&!_[_0x0167('0x5c')](_0x35ceda[_0x0167('0x5a')])){_0x1deb9c[_0x0167('0x5d')]=_0x35ceda['firstName'];if(!_[_0x0167('0x5c')](_0x35ceda[_0x0167('0x5b')])){_0x1deb9c[_0x0167('0x5d')]+='\x20'+_0x35ceda[_0x0167('0x5b')];}}})[_0x0167('0x5e')](function(){return db[_0x0167('0x5f')]['create'](_0x1deb9c);});}})[_0x0167('0x37')](function(_0x4da582){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x18d29d}});})[_0x0167('0x37')](function(){return _0x55aaa0[_0x0167('0xa')](0xcc)[_0x0167('0x60')]();})[_0x0167('0x3b')](handleError(_0x55aaa0,null));};exports[_0x0167('0x61')]=function(_0x5ad0ba,_0x20140b){var _0x38994f=[];return db['CmContact'][_0x0167('0x43')]()[_0x0167('0x37')](function(_0x3c46a0){_0x38994f=_[_0x0167('0x1b')](_0x3c46a0);return _0x5ad0ba['user']['getVoiceQueues']({'where':{'type':_0x0167('0x62'),'dialActive':!![],'dialMethod':_0x0167('0x63')},'attributes':['id',_0x0167('0x64'),_0x0167('0x65')],'raw':!![]});})[_0x0167('0x37')](function(_0x123df4){if(_0x123df4&&_0x123df4[_0x0167('0x30')]){return db[_0x0167('0x66')][_0x0167('0x67')](function(_0x3b5c80){var _0x5ed240={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0167('0x68')](_0x0167('0x52'))},'VoiceQueueId':{'$in':_[_0x0167('0x13')](_0x123df4,'id')},'$or':[{'UserId':null},{'UserId':_0x5ad0ba[_0x0167('0x69')]['id']}]};var _0x3b56ec={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x123df4)[_0x0167('0x36')]([_0x0167('0x65'),0x0])['map']('id')[_0x0167('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x5ad0ba[_0x0167('0x69')]['id']}]};var _0x547538={'$or':[_0x5ed240,_0x3b56ec]};var _0x1c46ce=[];if(_0x5ad0ba['body'][_0x0167('0x6b')]&&_0x5ad0ba[_0x0167('0x41')][_0x0167('0x6b')]==='prev'){if(!_[_0x0167('0x6c')](_0x5ad0ba[_0x0167('0x41')]['hopperIds'])){_0x547538['id']={'$in':_0x5ad0ba[_0x0167('0x41')]['hopperIds']};}_0x1c46ce=[[_0x0167('0x6d'),'ASC'],[_0x0167('0x6e'),_0x123df4[0x0][_0x0167('0x64')]==='ASC'?_0x0167('0x6f'):_0x0167('0x70')],db[_0x0167('0x66')][_0x0167('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x0167('0x6c')](_0x5ad0ba[_0x0167('0x41')][_0x0167('0x72')])){_0x547538['id']={'$notIn':_0x5ad0ba[_0x0167('0x41')]['hopperIds']};}_0x1c46ce=[[_0x0167('0x6d'),'DESC'],[_0x0167('0x6e'),_0x123df4[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x0167('0x71')](_0x0167('0x73')),['id',_0x0167('0x70')]];}return db[_0x0167('0x14')]['findOne']({'attributes':['id',_0x0167('0x74'),_0x0167('0x54'),_0x0167('0x75')],'where':_0x547538,'order':_0x1c46ce,'transaction':_0x3b5c80,'lock':_0x3b5c80[_0x0167('0x76')][_0x0167('0x77')],'include':[{'model':db[_0x0167('0x58')],'as':_0x0167('0x78'),'attributes':_0x38994f,'include':[{'model':db[_0x0167('0x79')],'as':_0x0167('0x7a'),'attributes':['id','name']}]},{'model':db[_0x0167('0x7b')],'as':'List','attributes':['id',_0x0167('0x11')]},{'model':db[_0x0167('0x46')],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x0167('0x37')](function(_0x383085){if(_0x383085){return _0x383085['update']({'UserId':_0x5ad0ba['user']['id']},{'transaction':_0x3b5c80});}});});}})[_0x0167('0x37')](handleEntityNotFound(_0x20140b,null))[_0x0167('0x37')](respondWithResult(_0x20140b,null))['catch'](handleError(_0x20140b,null));};exports[_0x0167('0x7c')]=function(_0x255f88,_0x19c717,_0x30d32e){var _0x426bf4=[];var _0x3c0bca=_0x255f88['params']['id'];var _0x25b543=_0x255f88[_0x0167('0x69')]['id'];return db['CmContact'][_0x0167('0x43')]()[_0x0167('0x37')](function(_0xa7b06b){_0x426bf4=_[_0x0167('0x1b')](_0xa7b06b);return db[_0x0167('0x66')]['transaction'](function(_0x52bed0){const _0x557693={'id':_0x3c0bca};return db[_0x0167('0x14')][_0x0167('0x7d')]({'attributes':['id',_0x0167('0x74'),_0x0167('0x75')],'where':_0x557693,'transaction':_0x52bed0,'lock':_0x52bed0[_0x0167('0x76')]['UPDATE'],'include':[{'model':db[_0x0167('0x58')],'as':_0x0167('0x78'),'attributes':_0x426bf4,'include':[{'model':db[_0x0167('0x79')],'as':_0x0167('0x7a'),'attributes':['id',_0x0167('0x11')]}]},{'model':db[_0x0167('0x7b')],'as':'List','attributes':['id','name']},{'model':db[_0x0167('0x46')],'as':_0x0167('0x7e'),'attributes':['id','name',_0x0167('0x7f')]}]})[_0x0167('0x37')](function(_0x442e99){if(_0x442e99){return _0x442e99[_0x0167('0xd')]({'UserId':_0x25b543},{'transaction':_0x52bed0});}});});})[_0x0167('0x37')](handleEntityNotFound(_0x19c717,null))[_0x0167('0x37')](respondWithResult(_0x19c717,null))[_0x0167('0x3b')](handleError(_0x19c717,null));};exports[_0x0167('0x80')]=function(_0x4ba0c4,_0x427a7e){return _0x4ba0c4[_0x0167('0x69')][_0x0167('0x81')]({'where':{'type':_0x0167('0x62'),'dialActive':!![],'dialMethod':_0x0167('0x63')},'attributes':['id'],'raw':!![]})[_0x0167('0x37')](function(_0x344120){if(_0x344120&&_0x344120['length']){return db[_0x0167('0x14')][_0x0167('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x0167('0x13')](_0x344120,'id')},'$or':[{'UserId':null},{'UserId':_0x4ba0c4[_0x0167('0x69')]['id']}]}});}return 0x0;})[_0x0167('0x37')](function(_0x11cf46){if(!_['isNil'](_0x11cf46)&&_['isNumber'](_0x11cf46)){return _0x427a7e[_0x0167('0xa')](0xc8)['json']({'contacts':_0x11cf46});}else{logger['error'](_0x0167('0x82'),_0x0167('0x80'),0x194,'entity\x20not\x20found');_0x427a7e['sendStatus'](0x194);}})[_0x0167('0x3b')](handleError(_0x427a7e,null));};exports['getTimezones']=function(_0x1a1eba,_0x19adef){var _0x9980e3=shared[_0x0167('0x83')];var _0x3c5cdf=[];_[_0x0167('0x13')](_0x9980e3,function(_0x189f8a){_0x3c5cdf[_0x0167('0x84')]({'id':_0x189f8a[_0x0167('0x11')],'name':_0x189f8a[_0x0167('0x11')],'utcOffset':_0x189f8a[_0x0167('0x85')]});});return _0x19adef['status'](0xc8)['json']({'tz':_0x3c5cdf});};exports[_0x0167('0x86')]=function(_0x15ad6e,_0x2fb81e){var _0x5b0e7b=shared[_0x0167('0x83')];var _0x6421b0={};if(!_[_0x0167('0x5c')](_0x5b0e7b[_0x15ad6e[_0x0167('0x41')]['id']]))_0x6421b0=_0x5b0e7b[_0x15ad6e[_0x0167('0x41')]['id']];return _0x2fb81e[_0x0167('0xa')](0xc8)['json'](_0x6421b0);}; \ No newline at end of file +var _0x8ece=['index','CmHopper','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','concat','$and','$or','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','statedesc','deleted','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','UPDATE','Contact','CmCompany','Company','List','VoiceQueue','dialActive','getPreviewRecall','findOne','recallme','LOCK','CmList','getOpenContacts','isNumber','error','entity\x20not\x20found','getTimezones','timezones','push','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','sendStatus','stack','name','send'];(function(_0x46fe10,_0x321d51){var _0x1d7b1c=function(_0x550658){while(--_0x550658){_0x46fe10['push'](_0x46fe10['shift']());}};_0x1d7b1c(++_0x321d51);}(_0x8ece,0x195));var _0xe8ec=function(_0x1bbe54,_0xdc2c1b){_0x1bbe54=_0x1bbe54-0x0;var _0x1c5952=_0x8ece[_0x1bbe54];return _0x1c5952;};'use strict';var moment=require(_0xe8ec('0x0'));var _=require(_0xe8ec('0x1'));var qs=require(_0xe8ec('0x2'));var logger=require(_0xe8ec('0x3'))('api');var shared=require('../../config/environment');var db=require(_0xe8ec('0x4'))['db'];function respondWithResult(_0x30c05a,_0x5047e7){_0x5047e7=_0x5047e7||0xc8;return function(_0x433734){if(_0x433734){return _0x30c05a[_0xe8ec('0x5')](_0x5047e7)['json'](_0x433734);}};}function respondWithFilteredResult(_0x346577,_0x23fa35){return function(_0x64ed4c){if(_0x64ed4c){var _0x234b67=typeof _0x23fa35[_0xe8ec('0x6')]===_0xe8ec('0x7')&&typeof _0x23fa35[_0xe8ec('0x8')]==='undefined';var _0x44d128=_0x64ed4c['count'];var _0x1345e0=_0x234b67?0x0:_0x23fa35['offset'];var _0x1b0a84=_0x234b67?_0x64ed4c[_0xe8ec('0x9')]:_0x23fa35[_0xe8ec('0x6')]+_0x23fa35[_0xe8ec('0x8')];var _0x235e18;if(_0x1b0a84>=_0x44d128){_0x1b0a84=_0x44d128;_0x235e18=0xc8;}else{_0x235e18=0xce;}_0x346577[_0xe8ec('0x5')](_0x235e18);return _0x346577[_0xe8ec('0xa')](_0xe8ec('0xb'),_0x1345e0+'-'+_0x1b0a84+'/'+_0x44d128)[_0xe8ec('0xc')](_0x64ed4c);}return null;};}function saveUpdates(_0x69a424,_0xf72aa7){return function(_0x153203){if(_0x153203){return _0x153203[_0xe8ec('0xd')](_0x69a424)['then'](function(_0x15de29){return _0x15de29;});}return null;};}function handleEntityNotFound(_0x431723,_0x2e5a88){return function(_0x167ebb){if(!_0x167ebb){_0x431723[_0xe8ec('0xe')](0x194);}return _0x167ebb;};}function handleError(_0xdb2565,_0x1e76ac){_0x1e76ac=_0x1e76ac||0x1f4;return function(_0x218a4b){logger['error'](_0x218a4b[_0xe8ec('0xf')]);if(_0x218a4b[_0xe8ec('0x10')]){delete _0x218a4b[_0xe8ec('0x10')];}_0xdb2565['status'](_0x1e76ac)[_0xe8ec('0x11')](_0x218a4b);};}exports[_0xe8ec('0x12')]=function(_0x2a3b73,_0x34a582){var _0x9a6f0c={},_0x39e557={},_0x1d183a={'count':0x0,'rows':[]};var _0x2e54f0=_['map'](db[_0xe8ec('0x13')][_0xe8ec('0x14')],function(_0x13c5c8){return{'name':_0x13c5c8[_0xe8ec('0x15')],'type':_0x13c5c8[_0xe8ec('0x16')][_0xe8ec('0x17')]};});_0x39e557[_0xe8ec('0x18')]=_[_0xe8ec('0x19')](_0x2e54f0,_0xe8ec('0x10'));_0x39e557['query']=_[_0xe8ec('0x1a')](_0x2a3b73[_0xe8ec('0x1b')]);_0x39e557[_0xe8ec('0x1c')]=_[_0xe8ec('0x1d')](_0x39e557[_0xe8ec('0x18')],_0x39e557['query']);_0x39e557[_0xe8ec('0x1c')]=_[_0xe8ec('0x1e')](_0x39e557[_0xe8ec('0x1c')],[_0xe8ec('0x1f'),_0xe8ec('0x20'),_0xe8ec('0x21'),'$gte','$lt',_0xe8ec('0x22'),_0xe8ec('0x23'),_0xe8ec('0x24'),_0xe8ec('0x25'),_0xe8ec('0x26'),_0xe8ec('0x27'),_0xe8ec('0x28'),_0xe8ec('0x29'),_0xe8ec('0x2a'),_0xe8ec('0x2b'),_0xe8ec('0x2c'),_0xe8ec('0x2d'),_0xe8ec('0x2a'),_0xe8ec('0x2e'),_0xe8ec('0x2f'),'$contained',_0xe8ec('0x30')]);_0x9a6f0c[_0xe8ec('0x31')]=_[_0xe8ec('0x1d')](_0x39e557['model'],qs[_0xe8ec('0x32')](_0x2a3b73['query'][_0xe8ec('0x32')]));_0x9a6f0c[_0xe8ec('0x31')]=_0x9a6f0c[_0xe8ec('0x31')][_0xe8ec('0x33')]?_0x9a6f0c[_0xe8ec('0x31')]:_0x39e557['model'];if(!_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x34')](_0xe8ec('0x35'))){_0x9a6f0c['limit']=qs[_0xe8ec('0x8')](_0x2a3b73['query'][_0xe8ec('0x8')]);_0x9a6f0c[_0xe8ec('0x6')]=qs[_0xe8ec('0x6')](_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x6')]);}_0x9a6f0c[_0xe8ec('0x36')]=qs[_0xe8ec('0x37')](_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x37')]);_0x9a6f0c['where']=qs[_0xe8ec('0x1c')](_[_0xe8ec('0x38')](_0x2a3b73[_0xe8ec('0x1b')],_0x39e557['filters']),_0x2e54f0);if(_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x39')]){_0x9a6f0c['where']=_[_0xe8ec('0x3a')](_0x9a6f0c[_0xe8ec('0x3b')],{'$or':_[_0xe8ec('0x19')](_0x2e54f0,function(_0x15dd54){if(_0x15dd54['type']!==_0xe8ec('0x3c')){var _0x3c3a12={};_0x3c3a12[_0x15dd54[_0xe8ec('0x10')]]={'$like':'%'+_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x39')]+'%'};return _0x3c3a12;}})});}_0x9a6f0c=_[_0xe8ec('0x3a')]({},_0x9a6f0c,_0x2a3b73[_0xe8ec('0x3d')]);var _0x29f78a={'where':_0x9a6f0c['where']};return db['CmHopper'][_0xe8ec('0x9')](_0x29f78a)[_0xe8ec('0x3e')](function(_0x25406d){_0x1d183a[_0xe8ec('0x9')]=_0x25406d;if(_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x3f')]){_0x9a6f0c[_0xe8ec('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0xe8ec('0x41')](_0x9a6f0c);})['then'](function(_0x341c75){_0x1d183a[_0xe8ec('0x42')]=_0x341c75;return _0x1d183a;})['then'](respondWithFilteredResult(_0x34a582,_0x9a6f0c))['catch'](handleError(_0x34a582,null));};exports[_0xe8ec('0x43')]=function(_0x2591e5,_0x34c572){var _0x5c99cd={'raw':!![],'where':{'id':_0x2591e5[_0xe8ec('0x44')]['id']}},_0x1223b8={};_0x1223b8[_0xe8ec('0x18')]=_[_0xe8ec('0x1a')](db[_0xe8ec('0x13')]['rawAttributes']);_0x1223b8['query']=_[_0xe8ec('0x1a')](_0x2591e5['query']);_0x1223b8[_0xe8ec('0x1c')]=_[_0xe8ec('0x1d')](_0x1223b8[_0xe8ec('0x18')],_0x1223b8[_0xe8ec('0x1b')]);_0x5c99cd[_0xe8ec('0x31')]=_[_0xe8ec('0x1d')](_0x1223b8[_0xe8ec('0x18')],qs['fields'](_0x2591e5[_0xe8ec('0x1b')][_0xe8ec('0x32')]));_0x5c99cd[_0xe8ec('0x31')]=_0x5c99cd[_0xe8ec('0x31')][_0xe8ec('0x33')]?_0x5c99cd[_0xe8ec('0x31')]:_0x1223b8[_0xe8ec('0x18')];if(_0x2591e5[_0xe8ec('0x1b')]['includeAll']){_0x5c99cd[_0xe8ec('0x40')]=[{'all':!![]}];}_0x5c99cd=_[_0xe8ec('0x3a')]({},_0x5c99cd,_0x2591e5[_0xe8ec('0x3d')]);return db['CmHopper'][_0xe8ec('0x45')](_0x5c99cd)['then'](handleEntityNotFound(_0x34c572,null))[_0xe8ec('0x3e')](respondWithResult(_0x34c572,null))[_0xe8ec('0x46')](handleError(_0x34c572,null));};exports[_0xe8ec('0x47')]=function(_0x5e8740,_0x230305){return db[_0xe8ec('0x13')]['create'](_0x5e8740[_0xe8ec('0x48')],{})['then'](respondWithResult(_0x230305,0xc9))[_0xe8ec('0x46')](handleError(_0x230305,null));};exports['update']=function(_0x82a0db,_0x1028dd){if(_0x82a0db[_0xe8ec('0x48')]['id']){delete _0x82a0db[_0xe8ec('0x48')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x82a0db['params']['id']}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x1028dd,null))[_0xe8ec('0x3e')](saveUpdates(_0x82a0db[_0xe8ec('0x48')],null))['then'](respondWithResult(_0x1028dd,null))[_0xe8ec('0x46')](handleError(_0x1028dd,null));};exports[_0xe8ec('0x49')]=function(_0x96ca5f,_0x1f96d9){return db[_0xe8ec('0x13')]['describe']()[_0xe8ec('0x3e')](respondWithResult(_0x1f96d9,null))[_0xe8ec('0x46')](handleError(_0x1f96d9,null));};exports[_0xe8ec('0x4a')]=function(_0x3de7aa,_0x329ef3){var _0xd3127;var _0x37611a=_0x3de7aa['params']['id'];return db[_0xe8ec('0x13')][_0xe8ec('0x45')]({'where':{'id':_0x3de7aa['params']['id']}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x329ef3,null))[_0xe8ec('0x3e')](function(_0x40b8e6){if(_0x40b8e6){return _0x40b8e6[_0xe8ec('0x4a')]()['then'](function(_0x30f211){return _0x30f211;});}})[_0xe8ec('0x3e')](function(_0x3ae6ae){_0xd3127=_0x3ae6ae;if(_0x3ae6ae){if(_0x3ae6ae[_0xe8ec('0x4b')]||_0x3ae6ae[_0xe8ec('0x4c')]){return db[_0x3ae6ae[_0xe8ec('0x4b')]?'VoiceQueue':_0xe8ec('0x4d')][_0xe8ec('0x45')]({'where':{'id':_0x3ae6ae['VoiceQueueId']?_0x3ae6ae['VoiceQueueId']:_0x3ae6ae[_0xe8ec('0x4c')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x3bd3fb){var _0xb2731e={};if(_0x3bd3fb){_[_0xe8ec('0x3a')](_0xb2731e,_[_0xe8ec('0x4e')](_0xd3127[_0xe8ec('0x4f')],[_0xe8ec('0x50'),'updatedAt','id']));_0xb2731e['state']=0x15;_0xb2731e[_0xe8ec('0x51')]=_0xe8ec('0x52');_0xb2731e['campaign']=_0x3bd3fb['name'];_0xb2731e[_0xe8ec('0x53')]=_0x3de7aa[_0xe8ec('0x54')][_0xe8ec('0x10')];_0xb2731e['UserId']=_0x3de7aa['user']['id'];_0xb2731e[_0xe8ec('0x52')]=!![];_0xb2731e[_0xe8ec('0x55')]=moment()[_0xe8ec('0x56')](_0xe8ec('0x57'));_0xb2731e['calleridnum']=_0xd3127['phone'];_0xb2731e[_0xe8ec('0x58')]=_0xd3127['VoiceQueueId']?_0xe8ec('0x59'):_0xe8ec('0x5a');return db['CmContact'][_0xe8ec('0x45')]({'where':{'id':_0xb2731e['ContactId']},'attributes':[_0xe8ec('0x5b'),'lastName']})[_0xe8ec('0x3e')](function(_0x307fce){if(!_[_0xe8ec('0x5c')](_0x329ef3)&&!_[_0xe8ec('0x5c')](_0x307fce[_0xe8ec('0x5b')])){_0xb2731e[_0xe8ec('0x5d')]=_0x307fce['firstName'];if(!_[_0xe8ec('0x5c')](_0x307fce['lastName'])){_0xb2731e[_0xe8ec('0x5d')]+='\x20'+_0x307fce[_0xe8ec('0x5e')];}}})[_0xe8ec('0x5f')](function(){return db[_0xe8ec('0x60')][_0xe8ec('0x47')](_0xb2731e);});}})['then'](function(_0x471a6a){return db[_0xe8ec('0x61')]['destroy']({'where':{'CmHopperId':_0x37611a}});})['then'](function(){return _0x329ef3[_0xe8ec('0x5')](0xcc)[_0xe8ec('0x62')]();})['catch'](handleError(_0x329ef3,null));};exports[_0xe8ec('0x63')]=function(_0x41e5a5,_0x4ee845){var _0x492062=[];return db[_0xe8ec('0x64')][_0xe8ec('0x49')]()['then'](function(_0x4fef2b){_0x492062=_[_0xe8ec('0x1a')](_0x4fef2b);return _0x41e5a5[_0xe8ec('0x54')][_0xe8ec('0x65')]({'where':{'type':_0xe8ec('0x66'),'dialActive':!![],'dialMethod':_0xe8ec('0x67')},'attributes':['id',_0xe8ec('0x68'),_0xe8ec('0x69')],'raw':!![]});})[_0xe8ec('0x3e')](function(_0x6071b5){if(_0x6071b5&&_0x6071b5[_0xe8ec('0x33')]){return db[_0xe8ec('0x6a')][_0xe8ec('0x6b')](function(_0x903ed5){var _0x277fc0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe8ec('0x56')](_0xe8ec('0x57'))},'VoiceQueueId':{'$in':_['map'](_0x6071b5,'id')},'$or':[{'UserId':null},{'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']}]};var _0x27850d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x6071b5)[_0xe8ec('0x39')]([_0xe8ec('0x69'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']}]};var _0x50c78d={'$or':[_0x277fc0,_0x27850d]};var _0x1ae75a=[];if(_0x41e5a5['body'][_0xe8ec('0x6c')]&&_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6c')]===_0xe8ec('0x6d')){if(!_[_0xe8ec('0x6e')](_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')])){_0x50c78d['id']={'$in':_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')]};}_0x1ae75a=[[_0xe8ec('0x70'),'ASC'],[_0xe8ec('0x71'),_0x6071b5[0x0][_0xe8ec('0x68')]===_0xe8ec('0x72')?_0xe8ec('0x73'):'ASC'],db[_0xe8ec('0x6a')]['literal'](_0xe8ec('0x74')),['id','DESC']];}else{if(!_[_0xe8ec('0x6e')](_0x41e5a5['body'][_0xe8ec('0x6f')])){_0x50c78d['id']={'$notIn':_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')]};}_0x1ae75a=[[_0xe8ec('0x70'),'DESC'],[_0xe8ec('0x71'),_0x6071b5[0x0]['dialOrderByScheduledAt']],db[_0xe8ec('0x6a')][_0xe8ec('0x75')](_0xe8ec('0x76')),['id',_0xe8ec('0x72')]];}return db[_0xe8ec('0x13')]['findOne']({'attributes':['id',_0xe8ec('0x77'),_0xe8ec('0x78'),'recallme'],'where':_0x50c78d,'order':_0x1ae75a,'transaction':_0x903ed5,'lock':_0x903ed5['LOCK'][_0xe8ec('0x79')],'include':[{'model':db[_0xe8ec('0x64')],'as':_0xe8ec('0x7a'),'attributes':_0x492062,'include':[{'model':db[_0xe8ec('0x7b')],'as':_0xe8ec('0x7c'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xe8ec('0x7d'),'attributes':['id',_0xe8ec('0x10')]},{'model':db[_0xe8ec('0x7e')],'as':'Queue','attributes':['id','name',_0xe8ec('0x7f')]}]})['then'](function(_0x39928f){if(_0x39928f){return _0x39928f['update']({'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']},{'transaction':_0x903ed5});}});});}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x4ee845,null))[_0xe8ec('0x3e')](respondWithResult(_0x4ee845,null))['catch'](handleError(_0x4ee845,null));};exports[_0xe8ec('0x80')]=function(_0x173dd9,_0x543a25,_0x16a85b){var _0x31125a=[];var _0x1bd095=_0x173dd9[_0xe8ec('0x44')]['id'];var _0x5a5aa7=_0x173dd9[_0xe8ec('0x54')]['id'];return db['CmContact'][_0xe8ec('0x49')]()[_0xe8ec('0x3e')](function(_0x4f116c){_0x31125a=_[_0xe8ec('0x1a')](_0x4f116c);return db[_0xe8ec('0x6a')][_0xe8ec('0x6b')](function(_0x49e13b){const _0x43af9b={'id':_0x1bd095};return db[_0xe8ec('0x13')][_0xe8ec('0x81')]({'attributes':['id',_0xe8ec('0x77'),_0xe8ec('0x82')],'where':_0x43af9b,'transaction':_0x49e13b,'lock':_0x49e13b[_0xe8ec('0x83')][_0xe8ec('0x79')],'include':[{'model':db[_0xe8ec('0x64')],'as':'Contact','attributes':_0x31125a,'include':[{'model':db['CmCompany'],'as':_0xe8ec('0x7c'),'attributes':['id',_0xe8ec('0x10')]}]},{'model':db[_0xe8ec('0x84')],'as':_0xe8ec('0x7d'),'attributes':['id',_0xe8ec('0x10')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0xe8ec('0x7f')]}]})[_0xe8ec('0x3e')](function(_0xb0dce6){if(_0xb0dce6){return _0xb0dce6[_0xe8ec('0xd')]({'UserId':_0x5a5aa7},{'transaction':_0x49e13b});}});});})[_0xe8ec('0x3e')](handleEntityNotFound(_0x543a25,null))['then'](respondWithResult(_0x543a25,null))['catch'](handleError(_0x543a25,null));};exports[_0xe8ec('0x85')]=function(_0x229753,_0x2f0f34){return _0x229753[_0xe8ec('0x54')]['getVoiceQueues']({'where':{'type':_0xe8ec('0x66'),'dialActive':!![],'dialMethod':_0xe8ec('0x67')},'attributes':['id'],'raw':!![]})[_0xe8ec('0x3e')](function(_0x5c20ba){if(_0x5c20ba&&_0x5c20ba[_0xe8ec('0x33')]){return db[_0xe8ec('0x13')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe8ec('0x56')](_0xe8ec('0x57'))},'VoiceQueueId':{'$in':_[_0xe8ec('0x19')](_0x5c20ba,'id')},'$or':[{'UserId':null},{'UserId':_0x229753[_0xe8ec('0x54')]['id']}]}});}return 0x0;})[_0xe8ec('0x3e')](function(_0x24c698){if(!_[_0xe8ec('0x5c')](_0x24c698)&&_[_0xe8ec('0x86')](_0x24c698)){return _0x2f0f34[_0xe8ec('0x5')](0xc8)[_0xe8ec('0xc')]({'contacts':_0x24c698});}else{logger[_0xe8ec('0x87')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xe8ec('0x85'),0x194,_0xe8ec('0x88'));_0x2f0f34[_0xe8ec('0xe')](0x194);}})['catch'](handleError(_0x2f0f34,null));};exports[_0xe8ec('0x89')]=function(_0x155a68,_0x1011f5){var _0x32b42c=shared[_0xe8ec('0x8a')];var _0x473c23=[];_['map'](_0x32b42c,function(_0x52fffa){_0x473c23[_0xe8ec('0x8b')]({'id':_0x52fffa['name'],'name':_0x52fffa[_0xe8ec('0x10')],'utcOffset':_0x52fffa['utcOffset']});});return _0x1011f5[_0xe8ec('0x5')](0xc8)['json']({'tz':_0x473c23});};exports[_0xe8ec('0x8c')]=function(_0x380048,_0x336204){var _0x54851b=shared['timezones'];var _0x1bd533={};if(!_[_0xe8ec('0x5c')](_0x54851b[_0x380048[_0xe8ec('0x48')]['id']]))_0x1bd533=_0x54851b[_0x380048[_0xe8ec('0x48')]['id']];return _0x336204['status'](0xc8)[_0xe8ec('0xc')](_0x1bd533);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index e833ecf..4c6fef2 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 _0xe2fe=['CmHopper','scheduledat','phone','priority','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x342b4c,_0x381e5d){var _0x4aa2dc=function(_0x22c3d1){while(--_0x22c3d1){_0x342b4c['push'](_0x342b4c['shift']());}};_0x4aa2dc(++_0x381e5d);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./cmHopper.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['scheduledat']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]},{'name':'priority','fields':[_0xee2f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['define','CmHopper','cm_hopper','scheduledat','phone','priority','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x38cb62,_0x4ec9f2){var _0xfda91d=function(_0x41f1d3){while(--_0x41f1d3){_0x38cb62['push'](_0x38cb62['shift']());}};_0xfda91d(++_0x4ec9f2);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x45becc,_0xf48b96){_0x45becc=_0x45becc-0x0;var _0x3dcc14=_0xdbf5[_0x45becc];return _0x3dcc14;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5dbf('0xc')]},{'name':'phone','fields':[_0x5dbf('0xd')]},{'name':_0x5dbf('0xe'),'fields':[_0x5dbf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b5fd48d..f2a72a9 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 _0xebf3=['NOW()','lodash','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','map','attributes','include','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','create','UpdateCmHopper','update','body','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','UserId','push','includes','all','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','describe','GetCmHopperPreview','keys','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xebf3,0x1e1));var _0x3ebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ebf('0x0'));var util=require('util');var moment=require(_0x3ebf('0x1'));var BPromise=require(_0x3ebf('0x2'));var db=require(_0x3ebf('0x3'))['db'];var logger=require('../../config/logger')(_0x3ebf('0x4'));exports[_0x3ebf('0x5')]=function(_0x558460){var _0x4c7d5b=this;return new Promise(function(_0x2f9b96,_0x3584e6){return db[_0x3ebf('0x6')][_0x3ebf('0x7')]({'raw':_0x558460[_0x3ebf('0x8')]?_0x558460[_0x3ebf('0x8')][_0x3ebf('0x9')]===undefined?!![]:![]:!![],'where':_0x558460[_0x3ebf('0x8')]?_0x558460[_0x3ebf('0x8')][_0x3ebf('0xa')]||null:null,'attributes':_0x558460[_0x3ebf('0x8')]?_0x558460['options']['attributes']||null:null,'limit':_0x558460[_0x3ebf('0x8')]?_0x558460[_0x3ebf('0x8')]['limit']||null:null,'include':_0x558460[_0x3ebf('0x8')]?_0x558460[_0x3ebf('0x8')]['include']?_[_0x3ebf('0xb')](_0x558460[_0x3ebf('0x8')]['include'],function(_0x4927d8){return{'model':db[_0x4927d8['model']],'as':_0x4927d8['as'],'attributes':_0x4927d8[_0x3ebf('0xc')],'include':_0x4927d8[_0x3ebf('0xd')]?_[_0x3ebf('0xb')](_0x4927d8[_0x3ebf('0xd')],function(_0x4d026a){return{'model':db[_0x4d026a['model']],'as':_0x4d026a['as'],'attributes':_0x4d026a[_0x3ebf('0xc')],'include':_0x4d026a['include']?_['map'](_0x4d026a['include'],function(_0x194797){return{'model':db[_0x194797[_0x3ebf('0xe')]],'as':_0x194797['as'],'attributes':_0x194797['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ebf('0xf')](function(_0x19180e){logger[_0x3ebf('0x10')](_0x3ebf('0x5'),_0x558460);logger[_0x3ebf('0x11')](_0x3ebf('0x5'),_0x558460,JSON[_0x3ebf('0x12')](_0x19180e));_0x2f9b96(_0x19180e);})[_0x3ebf('0x13')](function(_0x4532f6){logger[_0x3ebf('0x14')](_0x3ebf('0x5'),_0x4532f6[_0x3ebf('0x15')],_0x558460);_0x3584e6(_0x4c7d5b['error'](0x1f4,_0x4532f6[_0x3ebf('0x15')]));});});};exports[_0x3ebf('0x16')]=function(_0x48596c){var _0x121dc9=this;return new Promise(function(_0x55468b,_0x5853f7){return db['CmHopper'][_0x3ebf('0x17')]({'raw':_0x48596c[_0x3ebf('0x8')]?_0x48596c[_0x3ebf('0x8')][_0x3ebf('0x9')]===undefined?!![]:![]:!![],'where':_0x48596c[_0x3ebf('0x8')]?_0x48596c['options'][_0x3ebf('0xa')]||null:null,'attributes':_0x48596c[_0x3ebf('0x8')]?_0x48596c[_0x3ebf('0x8')][_0x3ebf('0xc')]||null:null,'include':_0x48596c[_0x3ebf('0x8')]?_0x48596c[_0x3ebf('0x8')][_0x3ebf('0xd')]?_[_0x3ebf('0xb')](_0x48596c[_0x3ebf('0x8')]['include'],function(_0x4efe6b){return{'model':db[_0x4efe6b['model']],'as':_0x4efe6b['as'],'attributes':_0x4efe6b[_0x3ebf('0xc')],'include':_0x4efe6b[_0x3ebf('0xd')]?_['map'](_0x4efe6b[_0x3ebf('0xd')],function(_0x101571){return{'model':db[_0x101571[_0x3ebf('0xe')]],'as':_0x101571['as'],'attributes':_0x101571['attributes'],'include':_0x101571[_0x3ebf('0xd')]?_['map'](_0x101571[_0x3ebf('0xd')],function(_0x45f7c8){return{'model':db[_0x45f7c8[_0x3ebf('0xe')]],'as':_0x45f7c8['as'],'attributes':_0x45f7c8[_0x3ebf('0xc')]};}):[]};}):[]};}):[]:[]})[_0x3ebf('0xf')](function(_0x181c0b){logger[_0x3ebf('0x10')](_0x3ebf('0x16'),_0x48596c);logger[_0x3ebf('0x11')]('ShowCmHopper',_0x48596c,JSON[_0x3ebf('0x12')](_0x181c0b));_0x55468b(_0x181c0b);})[_0x3ebf('0x13')](function(_0x3719f7){logger[_0x3ebf('0x14')](_0x3ebf('0x16'),_0x3719f7[_0x3ebf('0x15')],_0x48596c);_0x5853f7(_0x121dc9[_0x3ebf('0x14')](0x1f4,_0x3719f7[_0x3ebf('0x15')]));});});};exports[_0x3ebf('0x18')]=function(_0x312ffc){var _0x30846d=this;return new Promise(function(_0x487b18,_0x2d4030){return db['CmHopper'][_0x3ebf('0x19')](_0x312ffc['body'],{'raw':_0x312ffc['options']?_0x312ffc[_0x3ebf('0x8')][_0x3ebf('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x1e278e){logger[_0x3ebf('0x10')]('CreateCmHopper',_0x312ffc);logger[_0x3ebf('0x11')](_0x3ebf('0x18'),_0x312ffc,JSON['stringify'](_0x1e278e));_0x487b18(_0x1e278e);})[_0x3ebf('0x13')](function(_0x1719d8){logger[_0x3ebf('0x14')](_0x3ebf('0x18'),_0x1719d8[_0x3ebf('0x15')],_0x312ffc);_0x2d4030(_0x30846d[_0x3ebf('0x14')](0x1f4,_0x1719d8[_0x3ebf('0x15')]));});});};exports[_0x3ebf('0x1a')]=function(_0x332286){var _0x506140=this;return new Promise(function(_0x49149b,_0x4eb8ad){return db[_0x3ebf('0x6')][_0x3ebf('0x1b')](_0x332286[_0x3ebf('0x1c')],{'raw':_0x332286[_0x3ebf('0x8')]?_0x332286['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x332286[_0x3ebf('0x8')]?_0x332286[_0x3ebf('0x8')][_0x3ebf('0xa')]||null:null,'attributes':_0x332286[_0x3ebf('0x8')]?_0x332286[_0x3ebf('0x8')][_0x3ebf('0xc')]||null:null,'limit':_0x332286[_0x3ebf('0x8')]?_0x332286[_0x3ebf('0x8')][_0x3ebf('0x1d')]||null:null})[_0x3ebf('0xf')](function(_0x25a143){logger[_0x3ebf('0x10')](_0x3ebf('0x1a'),_0x332286);logger[_0x3ebf('0x10')](_0x3ebf('0x1e'),JSON[_0x3ebf('0x12')](_0x332286['options']['where']),_0x332286[_0x3ebf('0x1c')][_0x3ebf('0x1f')]);logger[_0x3ebf('0x11')](_0x3ebf('0x1a'),_0x332286,JSON[_0x3ebf('0x12')](_0x25a143));_0x49149b(_0x25a143);})['catch'](function(_0x1df16a){logger[_0x3ebf('0x14')](_0x3ebf('0x1a'),_0x1df16a[_0x3ebf('0x15')],_0x332286);_0x4eb8ad(_0x506140['error'](0x1f4,_0x1df16a['message']));});});};exports[_0x3ebf('0x20')]=function(_0x4a18e0){var _0x1820c3=this;return new Promise(function(_0x24ef8f,_0xdc3621){return db[_0x3ebf('0x6')]['destroy']({'where':_0x4a18e0[_0x3ebf('0x8')]?_0x4a18e0[_0x3ebf('0x8')][_0x3ebf('0xa')]||null:null})[_0x3ebf('0xf')](function(_0x501f74){logger[_0x3ebf('0x10')](_0x3ebf('0x20'),_0x4a18e0);logger[_0x3ebf('0x11')]('DestroyCmHopper',_0x4a18e0,JSON[_0x3ebf('0x12')](_0x501f74));_0x24ef8f(_0x501f74);})[_0x3ebf('0x13')](function(_0x34f688){logger[_0x3ebf('0x14')]('DestroyCmHopper',_0x34f688[_0x3ebf('0x15')],_0x4a18e0);_0xdc3621(_0x1820c3[_0x3ebf('0x14')](0x1f4,_0x34f688[_0x3ebf('0x15')]));});});};exports['GetContactDialer']=function(_0x2058bf){var _0x123aec=this;return new Promise(function(_0x2e67bb,_0x437343){return db[_0x3ebf('0x21')]['describe']()['then'](function(_0x452cc1){return db[_0x3ebf('0x22')][_0x3ebf('0x23')](function(_0x4a9d84){return db[_0x3ebf('0x6')][_0x3ebf('0x7')]({'where':_0x2058bf[_0x3ebf('0x8')]?_0x2058bf[_0x3ebf('0x8')][_0x3ebf('0xa')]||null:null,'attributes':_0x2058bf['options']?_0x2058bf['options'][_0x3ebf('0xc')]||null:null,'limit':_0x2058bf[_0x3ebf('0x8')]?_0x2058bf[_0x3ebf('0x8')][_0x3ebf('0x1d')]||null:null,'order':_0x2058bf[_0x3ebf('0x8')]?_0x2058bf['options'][_0x3ebf('0x24')]||null:null,'transaction':_0x4a9d84,'lock':_0x4a9d84[_0x3ebf('0x25')][_0x3ebf('0x26')],'include':[{'model':db[_0x3ebf('0x21')],'as':_0x3ebf('0x27'),'attributes':_['keys'](_0x452cc1)},{'model':db[_0x3ebf('0x28')],'as':_0x3ebf('0x29'),'attributes':['id',_0x3ebf('0x2a'),_0x3ebf('0x2b')]}]})['then'](function(_0x2949e0){var _0x403d58=[];var _0x4759bc=[];for(var _0x1c9076=0x0;_0x1c9076<_0x2949e0[_0x3ebf('0x2c')];_0x1c9076+=0x1){var _0x330a06=_0x2949e0[_0x1c9076][_0x3ebf('0x2d')];if(_0x330a06===null){_0x403d58[_0x3ebf('0x2e')](_0x2949e0[_0x1c9076][_0x3ebf('0x1b')](_0x2058bf[_0x3ebf('0x1c')],{'transaction':_0x4a9d84}));}else if(!_0x4759bc[_0x3ebf('0x2f')](_0x330a06)){_0x4759bc['push'](_0x330a06);_0x403d58[_0x3ebf('0x2e')](_0x2949e0[_0x1c9076][_0x3ebf('0x1b')](_0x2058bf[_0x3ebf('0x1c')],{'transaction':_0x4a9d84}));}}return BPromise[_0x3ebf('0x30')](_0x403d58);});})[_0x3ebf('0xf')](function(_0x44cbfc){logger['info']('GetContactDialer',_0x2058bf);if(_0x44cbfc[_0x3ebf('0x2c')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x44cbfc[0x0]['dataValues']['id'],_0x44cbfc[0x0][_0x3ebf('0x31')][_0x3ebf('0x32')],_0x44cbfc[0x0]['dataValues'][_0x3ebf('0x1f')]);}logger[_0x3ebf('0x11')](_0x3ebf('0x33'),_0x2058bf,JSON['stringify'](_0x44cbfc));_0x2e67bb(_0x44cbfc);})[_0x3ebf('0x13')](function(_0x49a90c){logger[_0x3ebf('0x14')](_0x3ebf('0x33'),_0x49a90c[_0x3ebf('0x15')],_0x2058bf);_0x437343(_0x123aec[_0x3ebf('0x14')](0x1f4,_0x49a90c[_0x3ebf('0x15')]));});});});};exports[_0x3ebf('0x34')]=function(_0x40e078){var _0x4a952e=this;return new Promise(function(_0x22f4cb,_0x314a4b){return db[_0x3ebf('0x22')][_0x3ebf('0x23')](function(_0x4b5938){return db[_0x3ebf('0x35')][_0x3ebf('0x19')](_0x40e078[_0x3ebf('0x1c')],{'raw':_0x40e078[_0x3ebf('0x8')]?_0x40e078[_0x3ebf('0x8')][_0x3ebf('0x9')]===undefined?!![]:![]:!![],'transaction':_0x4b5938})['then'](function(){logger['info'](_0x3ebf('0x36'),JSON[_0x3ebf('0x12')](_0x40e078['options'][_0x3ebf('0xa')]),_0x40e078[_0x3ebf('0x8')][_0x3ebf('0xa')][_0x3ebf('0x1f')]);return db[_0x3ebf('0x6')][_0x3ebf('0x37')]({'where':_0x40e078[_0x3ebf('0x8')]?_0x40e078[_0x3ebf('0x8')][_0x3ebf('0xa')]||null:null,'transaction':_0x4b5938});});})['then'](function(_0x25b401){logger['info'](_0x3ebf('0x34'),_0x40e078);logger[_0x3ebf('0x11')]('MoveContactManagedDialer',_0x40e078,JSON[_0x3ebf('0x12')](_0x25b401));_0x22f4cb(_0x25b401);})['catch'](function(_0x210885){logger['error'](_0x3ebf('0x34'),_0x210885[_0x3ebf('0x15')],_0x40e078);_0x314a4b(_0x4a952e['error'](0x1f4,_0x210885[_0x3ebf('0x15')]));});});};exports[_0x3ebf('0x38')]=function(_0x104f8a){var _0x905d35=this;return new Promise(function(_0x5e9d45,_0xbec08d){return db[_0x3ebf('0x6')][_0x3ebf('0x7')]({'raw':_0x104f8a['options']?_0x104f8a[_0x3ebf('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x104f8a['options']?_0x104f8a[_0x3ebf('0x8')][_0x3ebf('0xa')]||null:null,'attributes':[[db[_0x3ebf('0x22')]['fn'](_0x3ebf('0x39'),db[_0x3ebf('0x22')]['fn']('IF',db[_0x3ebf('0x22')][_0x3ebf('0x3a')](_0x3ebf('0x3b')+util[_0x3ebf('0x3c')](_0x3ebf('0x3d'),moment()[_0x3ebf('0x3c')](_0x3ebf('0x3e')))+'\x20,\x201,\x20null'))),_0x3ebf('0x3f')]]})['then'](function(_0x298cef){logger[_0x3ebf('0x10')]('CountReScheduled',_0x104f8a);logger[_0x3ebf('0x11')](_0x3ebf('0x38'),_0x104f8a,JSON[_0x3ebf('0x12')](_0x298cef));_0x5e9d45(_0x298cef);})[_0x3ebf('0x13')](function(_0x2023b5){logger[_0x3ebf('0x14')](_0x3ebf('0x38'),_0x2023b5[_0x3ebf('0x15')],_0x104f8a);_0xbec08d(_0x905d35['error'](0x1f4,_0x2023b5[_0x3ebf('0x15')]));});});};exports[_0x3ebf('0x40')]=function(_0x457cc3){var _0x4f1615=this;return new Promise(function(_0x15d434,_0x4fe4c9){return db[_0x3ebf('0x21')][_0x3ebf('0x41')]()[_0x3ebf('0xf')](function(){return db[_0x3ebf('0x22')]['transaction'](function(_0x373e7c){return db['CmHopper'][_0x3ebf('0x7')]({'where':_0x457cc3[_0x3ebf('0x8')]?_0x457cc3[_0x3ebf('0x8')]['where']||null:null,'attributes':_0x457cc3[_0x3ebf('0x8')]?_0x457cc3[_0x3ebf('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x457cc3['options']?_0x457cc3[_0x3ebf('0x8')][_0x3ebf('0x24')]||null:null,'group':db[_0x3ebf('0x6')][_0x3ebf('0x2d')],'transaction':_0x373e7c,'lock':_0x373e7c[_0x3ebf('0x25')][_0x3ebf('0x26')],'include':_0x457cc3[_0x3ebf('0x8')]?_0x457cc3[_0x3ebf('0x8')][_0x3ebf('0xd')]?_[_0x3ebf('0xb')](_0x457cc3['options'][_0x3ebf('0xd')],function(_0x54a8b9){return{'model':db[_0x54a8b9[_0x3ebf('0xe')]],'as':_0x54a8b9['as'],'attributes':_0x54a8b9[_0x3ebf('0xc')],'include':_0x54a8b9[_0x3ebf('0xd')]?_[_0x3ebf('0xb')](_0x54a8b9[_0x3ebf('0xd')],function(_0xa50587){return{'model':db[_0xa50587[_0x3ebf('0xe')]],'as':_0xa50587['as'],'attributes':_0xa50587[_0x3ebf('0xc')],'include':_0xa50587['include']?_[_0x3ebf('0xb')](_0xa50587[_0x3ebf('0xd')],function(_0x2c5cf3){return{'model':db[_0x2c5cf3[_0x3ebf('0xe')]],'as':_0x2c5cf3['as'],'attributes':_0x2c5cf3['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ebf('0xf')](function(_0x1c042b){var _0x1867b6=[];for(var _0x56bfb2=0x0;_0x56bfb2<_0x1c042b['length'];_0x56bfb2+=0x1){_0x1867b6[_0x3ebf('0x2e')](_0x1c042b[_0x56bfb2]['update'](_0x457cc3[_0x3ebf('0x1c')],{'transaction':_0x373e7c}));}return BPromise[_0x3ebf('0x30')](_0x1867b6);});})[_0x3ebf('0xf')](function(_0x281906){logger[_0x3ebf('0x10')](_0x3ebf('0x40'),_0x457cc3);logger[_0x3ebf('0x11')](_0x3ebf('0x40'),_0x457cc3,JSON[_0x3ebf('0x12')](_0x281906));_0x15d434(_0x281906);})[_0x3ebf('0x13')](function(_0x19eaa8){logger[_0x3ebf('0x14')](_0x3ebf('0x40'),_0x19eaa8['message'],_0x457cc3);_0x4fe4c9(_0x4f1615[_0x3ebf('0x14')](0x1f4,_0x19eaa8[_0x3ebf('0x15')]));});});});};exports[_0x3ebf('0x42')]=function(_0x3431b5){var _0x2f4842=this;return new Promise(function(_0x338f6f,_0x4dcf25){db[_0x3ebf('0x21')][_0x3ebf('0x41')]()[_0x3ebf('0xf')](function(_0x2bee9b){return db[_0x3ebf('0x6')]['findAll']({'raw':_0x3431b5['options']?_0x3431b5[_0x3ebf('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x3431b5['options']?_0x3431b5['options'][_0x3ebf('0xa')]||null:null,'attributes':_0x3431b5['options']?_0x3431b5[_0x3ebf('0x8')][_0x3ebf('0xc')]||null:null,'limit':_0x3431b5[_0x3ebf('0x8')]?_0x3431b5[_0x3ebf('0x8')]['limit']||null:null,'include':_0x3431b5[_0x3ebf('0x8')]?_0x3431b5[_0x3ebf('0x8')][_0x3ebf('0xd')]?_[_0x3ebf('0xb')](_0x3431b5[_0x3ebf('0x8')][_0x3ebf('0xd')],function(_0xc6dcb0){return{'model':db[_0xc6dcb0[_0x3ebf('0xe')]],'as':_0xc6dcb0['as'],'attributes':_0xc6dcb0['as']===_0x3ebf('0x27')?_[_0x3ebf('0x43')](_0x2bee9b):_0xc6dcb0[_0x3ebf('0xc')],'include':_0xc6dcb0['include']?_[_0x3ebf('0xb')](_0xc6dcb0[_0x3ebf('0xd')],function(_0x2e9851){return{'model':db[_0x2e9851[_0x3ebf('0xe')]],'as':_0x2e9851['as'],'attributes':_0x2e9851[_0x3ebf('0xc')],'include':_0x2e9851[_0x3ebf('0xd')]?_[_0x3ebf('0xb')](_0x2e9851[_0x3ebf('0xd')],function(_0x1b8e0e){return{'model':db[_0x1b8e0e['model']],'as':_0x1b8e0e['as'],'attributes':_0x1b8e0e[_0x3ebf('0xc')]};}):[]};}):[]};}):[]:[]})[_0x3ebf('0xf')](function(_0x1177df){logger[_0x3ebf('0x10')](_0x3ebf('0x5'),_0x3431b5);logger['debug'](_0x3ebf('0x5'),_0x3431b5,JSON['stringify'](_0x1177df));_0x338f6f(_0x1177df);})[_0x3ebf('0x13')](function(_0x108a9c){logger['error']('GetCmHopper',_0x108a9c[_0x3ebf('0x15')],_0x3431b5);_0x4dcf25(_0x2f4842[_0x3ebf('0x14')](0x1f4,_0x108a9c[_0x3ebf('0x15')]));});});});};exports[_0x3ebf('0x44')]=function(_0x1368a0){var _0x773b7e=this;return new Promise(function(_0x284d0b,_0x5b3fd8){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x1368a0[_0x3ebf('0x8')][_0x3ebf('0xa')][_0x3ebf('0x45')]},'attributes':['id',_0x3ebf('0x46')],'order':[['id',_0x3ebf('0x47')]]})[_0x3ebf('0xf')](function(_0x39f7d1){logger[_0x3ebf('0x10')](_0x3ebf('0x48'),_0x1368a0);logger[_0x3ebf('0x11')](_0x3ebf('0x48'),_0x1368a0,JSON[_0x3ebf('0x12')](_0x39f7d1));_0x284d0b(_0x39f7d1);})[_0x3ebf('0x13')](function(_0x28bc75){logger[_0x3ebf('0x14')](_0x3ebf('0x48'),_0x28bc75[_0x3ebf('0x15')],_0x1368a0);_0x5b3fd8(_0x773b7e[_0x3ebf('0x14')](0x1f4,_0x28bc75['message']));});});};exports[_0x3ebf('0x49')]=function(_0xe53927){var _0x50f720=this;return new Promise(function(_0xa65aee,_0x33cfc8){return db[_0x3ebf('0x22')][_0x3ebf('0x23')](function(_0x4d5cd6){var _0x11e577=_0xe53927['options']&&_0xe53927[_0x3ebf('0x8')][_0x3ebf('0xa')]?_0xe53927['options']['where']:{};return db[_0x3ebf('0x6')][_0x3ebf('0x1b')](_0xe53927[_0x3ebf('0x1c')],{'where':_0x11e577,'transaction':_0x4d5cd6})[_0x3ebf('0xf')](function(_0x42a166){logger[_0x3ebf('0x10')](_0x3ebf('0x49'),_0xe53927);logger[_0x3ebf('0x11')](_0x3ebf('0x49'),_0xe53927,JSON[_0x3ebf('0x12')](_0x42a166));_0xa65aee(_0x42a166);})[_0x3ebf('0x13')](function(_0x4aa9cf){logger['error'](_0x3ebf('0x49'),_0x4aa9cf['message'],_0xe53927);_0x33cfc8(_0x50f720[_0x3ebf('0x14')](0x1f4,_0x4aa9cf[_0x3ebf('0x15')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x153dc6){var _0x301c66=this;var _0x3d2c8b=_0x153dc6['body']['where'][_0x3ebf('0x4a')];var _0x285d0e=_0x153dc6[_0x3ebf('0x1c')]['where'][_0x3ebf('0x4b')];var _0x2c132e=_0x153dc6[_0x3ebf('0x1c')][_0x3ebf('0xa')][_0x3ebf('0x4c')];return new Promise(function(_0x128ce3,_0xe7215f){return db[_0x3ebf('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x3d2c8b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3ebf('0x22')][_0x3ebf('0x3a')](_0x3ebf('0x4d')+_0x285d0e+_0x3ebf('0x4e')),'$gt':db[_0x3ebf('0x22')][_0x3ebf('0x3a')](_0x3ebf('0x4f'))}},'UserId':{'$in':_0x2c132e}},'include':[{'model':db['CmContact'],'as':_0x3ebf('0x27')},{'model':db[_0x3ebf('0x28')],'as':_0x3ebf('0x29'),'attributes':['id','name',_0x3ebf('0x2b')]},{'model':db['CmList'],'as':'List'}]})['then'](function(_0x6331aa){if(_0x6331aa[_0x3ebf('0x2c')]>0x0){return db[_0x3ebf('0x22')][_0x3ebf('0x23')](function(_0x626f04){return db[_0x3ebf('0x6')][_0x3ebf('0x1b')]({'recallmeNotifiedDate':db['sequelize'][_0x3ebf('0x3a')](_0x3ebf('0x4f'))},{'where':{'id':{'$in':_[_0x3ebf('0xb')](_0x6331aa,'id')}},'transaction':_0x626f04})[_0x3ebf('0xf')](function(){_0x128ce3(_0x6331aa);})[_0x3ebf('0x13')](function(_0x1ecc2d){logger[_0x3ebf('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x1ecc2d[_0x3ebf('0x15')],_0x153dc6);_0xe7215f(_0x301c66[_0x3ebf('0x14')](0x1f4,_0x1ecc2d[_0x3ebf('0x15')]));});})[_0x3ebf('0x13')](function(_0xb9d073){logger[_0x3ebf('0x14')]('CmHopperHandlePreviewRecallNotifications',_0xb9d073['message'],_0x153dc6);_0xe7215f(_0x301c66[_0x3ebf('0x14')](0x1f4,_0xb9d073['message']));});}else{_0x128ce3(_0x6331aa);}});});}; \ No newline at end of file +var _0x0a2e=['options','raw','where','attributes','limit','include','map','model','info','debug','stringify','catch','error','message','ShowCmHopper','find','then','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','User','name','length','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','\x20,\x201,\x20null','contactsRescheduled','describe','UserId','UPDATE','GetContactRecallMe','GetCmHopperPreview','Contact','keys','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','voicePause','lodash','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0x0a2e,0xe1));var _0xe0a2=function(_0x589248,_0x31dea3){_0x589248=_0x589248-0x0;var _0x486750=_0x0a2e[_0x589248];return _0x486750;};'use strict';var _=require(_0xe0a2('0x0'));var util=require(_0xe0a2('0x1'));var moment=require(_0xe0a2('0x2'));var BPromise=require(_0xe0a2('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xe0a2('0x4'))(_0xe0a2('0x5'));exports[_0xe0a2('0x6')]=function(_0x2e9ab5){var _0x5dd25b=this;return new Promise(function(_0x48900e,_0x1a19da){return db[_0xe0a2('0x7')][_0xe0a2('0x8')]({'raw':_0x2e9ab5[_0xe0a2('0x9')]?_0x2e9ab5[_0xe0a2('0x9')][_0xe0a2('0xa')]===undefined?!![]:![]:!![],'where':_0x2e9ab5[_0xe0a2('0x9')]?_0x2e9ab5[_0xe0a2('0x9')][_0xe0a2('0xb')]||null:null,'attributes':_0x2e9ab5[_0xe0a2('0x9')]?_0x2e9ab5[_0xe0a2('0x9')][_0xe0a2('0xc')]||null:null,'limit':_0x2e9ab5[_0xe0a2('0x9')]?_0x2e9ab5[_0xe0a2('0x9')][_0xe0a2('0xd')]||null:null,'include':_0x2e9ab5[_0xe0a2('0x9')]?_0x2e9ab5[_0xe0a2('0x9')][_0xe0a2('0xe')]?_[_0xe0a2('0xf')](_0x2e9ab5['options']['include'],function(_0xf82cf3){return{'model':db[_0xf82cf3[_0xe0a2('0x10')]],'as':_0xf82cf3['as'],'attributes':_0xf82cf3[_0xe0a2('0xc')],'include':_0xf82cf3[_0xe0a2('0xe')]?_[_0xe0a2('0xf')](_0xf82cf3[_0xe0a2('0xe')],function(_0x3fcbda){return{'model':db[_0x3fcbda[_0xe0a2('0x10')]],'as':_0x3fcbda['as'],'attributes':_0x3fcbda['attributes'],'include':_0x3fcbda['include']?_[_0xe0a2('0xf')](_0x3fcbda[_0xe0a2('0xe')],function(_0x7dc715){return{'model':db[_0x7dc715[_0xe0a2('0x10')]],'as':_0x7dc715['as'],'attributes':_0x7dc715[_0xe0a2('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41ad4e){logger[_0xe0a2('0x11')](_0xe0a2('0x6'),_0x2e9ab5);logger[_0xe0a2('0x12')]('GetCmHopper',_0x2e9ab5,JSON[_0xe0a2('0x13')](_0x41ad4e));_0x48900e(_0x41ad4e);})[_0xe0a2('0x14')](function(_0x544fca){logger[_0xe0a2('0x15')](_0xe0a2('0x6'),_0x544fca[_0xe0a2('0x16')],_0x2e9ab5);_0x1a19da(_0x5dd25b[_0xe0a2('0x15')](0x1f4,_0x544fca[_0xe0a2('0x16')]));});});};exports[_0xe0a2('0x17')]=function(_0x2d0b0e){var _0xcf70e6=this;return new Promise(function(_0x46e881,_0x4a743d){return db['CmHopper'][_0xe0a2('0x18')]({'raw':_0x2d0b0e[_0xe0a2('0x9')]?_0x2d0b0e[_0xe0a2('0x9')][_0xe0a2('0xa')]===undefined?!![]:![]:!![],'where':_0x2d0b0e[_0xe0a2('0x9')]?_0x2d0b0e[_0xe0a2('0x9')][_0xe0a2('0xb')]||null:null,'attributes':_0x2d0b0e[_0xe0a2('0x9')]?_0x2d0b0e[_0xe0a2('0x9')]['attributes']||null:null,'include':_0x2d0b0e[_0xe0a2('0x9')]?_0x2d0b0e[_0xe0a2('0x9')][_0xe0a2('0xe')]?_[_0xe0a2('0xf')](_0x2d0b0e[_0xe0a2('0x9')][_0xe0a2('0xe')],function(_0xeb487d){return{'model':db[_0xeb487d[_0xe0a2('0x10')]],'as':_0xeb487d['as'],'attributes':_0xeb487d['attributes'],'include':_0xeb487d[_0xe0a2('0xe')]?_[_0xe0a2('0xf')](_0xeb487d[_0xe0a2('0xe')],function(_0x1906f9){return{'model':db[_0x1906f9['model']],'as':_0x1906f9['as'],'attributes':_0x1906f9['attributes'],'include':_0x1906f9[_0xe0a2('0xe')]?_[_0xe0a2('0xf')](_0x1906f9[_0xe0a2('0xe')],function(_0x1c013e){return{'model':db[_0x1c013e[_0xe0a2('0x10')]],'as':_0x1c013e['as'],'attributes':_0x1c013e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe0a2('0x19')](function(_0x2543ff){logger['info'](_0xe0a2('0x17'),_0x2d0b0e);logger[_0xe0a2('0x12')](_0xe0a2('0x17'),_0x2d0b0e,JSON[_0xe0a2('0x13')](_0x2543ff));_0x46e881(_0x2543ff);})[_0xe0a2('0x14')](function(_0x1893f7){logger[_0xe0a2('0x15')](_0xe0a2('0x17'),_0x1893f7[_0xe0a2('0x16')],_0x2d0b0e);_0x4a743d(_0xcf70e6[_0xe0a2('0x15')](0x1f4,_0x1893f7[_0xe0a2('0x16')]));});});};exports[_0xe0a2('0x1a')]=function(_0x5752aa){var _0x46aa81=this;return new Promise(function(_0x1dd03a,_0x440857){return db[_0xe0a2('0x7')][_0xe0a2('0x1b')](_0x5752aa[_0xe0a2('0x1c')],{'raw':_0x5752aa[_0xe0a2('0x9')]?_0x5752aa[_0xe0a2('0x9')][_0xe0a2('0xa')]===undefined?!![]:![]:!![]})[_0xe0a2('0x19')](function(_0x2254aa){logger[_0xe0a2('0x11')](_0xe0a2('0x1a'),_0x5752aa);logger[_0xe0a2('0x12')](_0xe0a2('0x1a'),_0x5752aa,JSON['stringify'](_0x2254aa));_0x1dd03a(_0x2254aa);})['catch'](function(_0x16a564){logger[_0xe0a2('0x15')](_0xe0a2('0x1a'),_0x16a564[_0xe0a2('0x16')],_0x5752aa);_0x440857(_0x46aa81[_0xe0a2('0x15')](0x1f4,_0x16a564[_0xe0a2('0x16')]));});});};exports[_0xe0a2('0x1d')]=function(_0x36c442){var _0x2a1b2f=this;return new Promise(function(_0x48592b,_0x132d9e){return db[_0xe0a2('0x7')][_0xe0a2('0x1e')](_0x36c442[_0xe0a2('0x1c')],{'raw':_0x36c442[_0xe0a2('0x9')]?_0x36c442[_0xe0a2('0x9')][_0xe0a2('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36c442['options']?_0x36c442[_0xe0a2('0x9')][_0xe0a2('0xb')]||null:null,'attributes':_0x36c442[_0xe0a2('0x9')]?_0x36c442[_0xe0a2('0x9')][_0xe0a2('0xc')]||null:null,'limit':_0x36c442['options']?_0x36c442[_0xe0a2('0x9')][_0xe0a2('0xd')]||null:null})[_0xe0a2('0x19')](function(_0x3d73bd){logger[_0xe0a2('0x11')](_0xe0a2('0x1d'),_0x36c442);logger['info'](_0xe0a2('0x1f'),JSON[_0xe0a2('0x13')](_0x36c442[_0xe0a2('0x9')][_0xe0a2('0xb')]),_0x36c442['body'][_0xe0a2('0x20')]);logger[_0xe0a2('0x12')]('UpdateCmHopper',_0x36c442,JSON[_0xe0a2('0x13')](_0x3d73bd));_0x48592b(_0x3d73bd);})[_0xe0a2('0x14')](function(_0x848235){logger[_0xe0a2('0x15')](_0xe0a2('0x1d'),_0x848235[_0xe0a2('0x16')],_0x36c442);_0x132d9e(_0x2a1b2f[_0xe0a2('0x15')](0x1f4,_0x848235['message']));});});};exports[_0xe0a2('0x21')]=function(_0x35ad57){var _0x228f47=this;return new Promise(function(_0x4f6b1b,_0xea606d){return db[_0xe0a2('0x7')][_0xe0a2('0x22')]({'where':_0x35ad57[_0xe0a2('0x9')]?_0x35ad57[_0xe0a2('0x9')][_0xe0a2('0xb')]||null:null})[_0xe0a2('0x19')](function(_0x238b24){logger[_0xe0a2('0x11')]('DestroyCmHopper',_0x35ad57);logger['debug'](_0xe0a2('0x21'),_0x35ad57,JSON[_0xe0a2('0x13')](_0x238b24));_0x4f6b1b(_0x238b24);})[_0xe0a2('0x14')](function(_0x1b1b63){logger['error'](_0xe0a2('0x21'),_0x1b1b63['message'],_0x35ad57);_0xea606d(_0x228f47[_0xe0a2('0x15')](0x1f4,_0x1b1b63[_0xe0a2('0x16')]));});});};exports[_0xe0a2('0x23')]=function(_0x1bc77f){var _0x17bf6e=this;return new Promise(function(_0x41a768,_0x21145f){return db[_0xe0a2('0x24')]['describe']()[_0xe0a2('0x19')](function(_0x17b1a1){return db[_0xe0a2('0x25')][_0xe0a2('0x26')](function(_0x201a48){return db[_0xe0a2('0x7')][_0xe0a2('0x8')]({'where':_0x1bc77f['options']?_0x1bc77f[_0xe0a2('0x9')][_0xe0a2('0xb')]||null:null,'attributes':_0x1bc77f['options']?_0x1bc77f['options'][_0xe0a2('0xc')]||null:null,'limit':_0x1bc77f[_0xe0a2('0x9')]?_0x1bc77f[_0xe0a2('0x9')][_0xe0a2('0xd')]||null:null,'order':_0x1bc77f[_0xe0a2('0x9')]?_0x1bc77f[_0xe0a2('0x9')][_0xe0a2('0x27')]||null:null,'transaction':_0x201a48,'lock':_0x201a48[_0xe0a2('0x28')]['UPDATE'],'include':[{'model':db[_0xe0a2('0x24')],'as':'Contact','attributes':_['keys'](_0x17b1a1)},{'model':db[_0xe0a2('0x29')],'as':'Agent','attributes':['id',_0xe0a2('0x2a'),'voicePause']}]})[_0xe0a2('0x19')](function(_0x2a56e3){var _0x3601eb=[];var _0xdf8394=[];for(var _0x147c77=0x0;_0x147c77<_0x2a56e3[_0xe0a2('0x2b')];_0x147c77+=0x1){var _0x51952b=_0x2a56e3[_0x147c77]['UserId'];if(_0x51952b===null){_0x3601eb['push'](_0x2a56e3[_0x147c77][_0xe0a2('0x1e')](_0x1bc77f[_0xe0a2('0x1c')],{'transaction':_0x201a48}));}else if(!_0xdf8394['includes'](_0x51952b)){_0xdf8394[_0xe0a2('0x2c')](_0x51952b);_0x3601eb['push'](_0x2a56e3[_0x147c77][_0xe0a2('0x1e')](_0x1bc77f[_0xe0a2('0x1c')],{'transaction':_0x201a48}));}}return BPromise[_0xe0a2('0x2d')](_0x3601eb);});})[_0xe0a2('0x19')](function(_0x30fce3){logger[_0xe0a2('0x11')]('GetContactDialer',_0x1bc77f);if(_0x30fce3[_0xe0a2('0x2b')]>0x0){logger['info'](_0xe0a2('0x2e'),_0x30fce3[0x0][_0xe0a2('0x2f')]['id'],_0x30fce3[0x0][_0xe0a2('0x2f')][_0xe0a2('0x30')],_0x30fce3[0x0][_0xe0a2('0x2f')][_0xe0a2('0x20')]);}logger[_0xe0a2('0x12')]('GetContactDialer',_0x1bc77f,JSON[_0xe0a2('0x13')](_0x30fce3));_0x41a768(_0x30fce3);})[_0xe0a2('0x14')](function(_0x4f8344){logger[_0xe0a2('0x15')](_0xe0a2('0x23'),_0x4f8344['message'],_0x1bc77f);_0x21145f(_0x17bf6e[_0xe0a2('0x15')](0x1f4,_0x4f8344[_0xe0a2('0x16')]));});});});};exports[_0xe0a2('0x31')]=function(_0x4ae3c8){var _0x222de4=this;return new Promise(function(_0x58c7ab,_0x3dd8ba){return db[_0xe0a2('0x25')]['transaction'](function(_0x1db744){return db[_0xe0a2('0x32')][_0xe0a2('0x1b')](_0x4ae3c8['body'],{'raw':_0x4ae3c8[_0xe0a2('0x9')]?_0x4ae3c8[_0xe0a2('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1db744})[_0xe0a2('0x19')](function(){logger[_0xe0a2('0x11')](_0xe0a2('0x33'),JSON['stringify'](_0x4ae3c8[_0xe0a2('0x9')][_0xe0a2('0xb')]),_0x4ae3c8[_0xe0a2('0x9')][_0xe0a2('0xb')][_0xe0a2('0x20')]);return db[_0xe0a2('0x7')][_0xe0a2('0x22')]({'where':_0x4ae3c8[_0xe0a2('0x9')]?_0x4ae3c8[_0xe0a2('0x9')][_0xe0a2('0xb')]||null:null,'transaction':_0x1db744});});})['then'](function(_0x1c7726){logger[_0xe0a2('0x11')](_0xe0a2('0x31'),_0x4ae3c8);logger[_0xe0a2('0x12')](_0xe0a2('0x31'),_0x4ae3c8,JSON[_0xe0a2('0x13')](_0x1c7726));_0x58c7ab(_0x1c7726);})['catch'](function(_0x278d31){logger['error'](_0xe0a2('0x31'),_0x278d31[_0xe0a2('0x16')],_0x4ae3c8);_0x3dd8ba(_0x222de4[_0xe0a2('0x15')](0x1f4,_0x278d31[_0xe0a2('0x16')]));});});};exports[_0xe0a2('0x34')]=function(_0xed8341){var _0x43d606=this;return new Promise(function(_0x203093,_0xd16864){return db[_0xe0a2('0x7')][_0xe0a2('0x8')]({'raw':_0xed8341[_0xe0a2('0x9')]?_0xed8341[_0xe0a2('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0xed8341[_0xe0a2('0x9')]?_0xed8341[_0xe0a2('0x9')][_0xe0a2('0xb')]||null:null,'attributes':[[db['sequelize']['fn'](_0xe0a2('0x35'),db[_0xe0a2('0x25')]['fn']('IF',db[_0xe0a2('0x25')][_0xe0a2('0x36')](_0xe0a2('0x37')+util[_0xe0a2('0x38')](_0xe0a2('0x39'),moment()[_0xe0a2('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xe0a2('0x3a')))),_0xe0a2('0x3b')]]})[_0xe0a2('0x19')](function(_0x281540){logger[_0xe0a2('0x11')](_0xe0a2('0x34'),_0xed8341);logger[_0xe0a2('0x12')](_0xe0a2('0x34'),_0xed8341,JSON['stringify'](_0x281540));_0x203093(_0x281540);})[_0xe0a2('0x14')](function(_0x46d513){logger['error'](_0xe0a2('0x34'),_0x46d513[_0xe0a2('0x16')],_0xed8341);_0xd16864(_0x43d606[_0xe0a2('0x15')](0x1f4,_0x46d513[_0xe0a2('0x16')]));});});};exports['GetContactRecallMe']=function(_0x5ed877){var _0x5a9d38=this;return new Promise(function(_0x2f9374,_0x319c75){return db[_0xe0a2('0x24')][_0xe0a2('0x3c')]()[_0xe0a2('0x19')](function(){return db['sequelize'][_0xe0a2('0x26')](function(_0x3ae5f3){return db['CmHopper'][_0xe0a2('0x8')]({'where':_0x5ed877[_0xe0a2('0x9')]?_0x5ed877[_0xe0a2('0x9')]['where']||null:null,'attributes':_0x5ed877[_0xe0a2('0x9')]?_0x5ed877['options'][_0xe0a2('0xc')]||null:null,'limit':0x1,'order':_0x5ed877[_0xe0a2('0x9')]?_0x5ed877[_0xe0a2('0x9')][_0xe0a2('0x27')]||null:null,'group':db[_0xe0a2('0x7')][_0xe0a2('0x3d')],'transaction':_0x3ae5f3,'lock':_0x3ae5f3[_0xe0a2('0x28')][_0xe0a2('0x3e')],'include':_0x5ed877[_0xe0a2('0x9')]?_0x5ed877[_0xe0a2('0x9')]['include']?_[_0xe0a2('0xf')](_0x5ed877[_0xe0a2('0x9')]['include'],function(_0x34d943){return{'model':db[_0x34d943[_0xe0a2('0x10')]],'as':_0x34d943['as'],'attributes':_0x34d943[_0xe0a2('0xc')],'include':_0x34d943[_0xe0a2('0xe')]?_[_0xe0a2('0xf')](_0x34d943[_0xe0a2('0xe')],function(_0x5cf294){return{'model':db[_0x5cf294[_0xe0a2('0x10')]],'as':_0x5cf294['as'],'attributes':_0x5cf294['attributes'],'include':_0x5cf294[_0xe0a2('0xe')]?_[_0xe0a2('0xf')](_0x5cf294[_0xe0a2('0xe')],function(_0xbacb97){return{'model':db[_0xbacb97[_0xe0a2('0x10')]],'as':_0xbacb97['as'],'attributes':_0xbacb97[_0xe0a2('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4985ed){var _0x2082fc=[];for(var _0x43c672=0x0;_0x43c672<_0x4985ed[_0xe0a2('0x2b')];_0x43c672+=0x1){_0x2082fc['push'](_0x4985ed[_0x43c672][_0xe0a2('0x1e')](_0x5ed877[_0xe0a2('0x1c')],{'transaction':_0x3ae5f3}));}return BPromise['all'](_0x2082fc);});})['then'](function(_0x150416){logger[_0xe0a2('0x11')](_0xe0a2('0x3f'),_0x5ed877);logger['debug']('GetContactRecallMe',_0x5ed877,JSON[_0xe0a2('0x13')](_0x150416));_0x2f9374(_0x150416);})[_0xe0a2('0x14')](function(_0xf7dff0){logger[_0xe0a2('0x15')]('GetContactRecallMe',_0xf7dff0['message'],_0x5ed877);_0x319c75(_0x5a9d38[_0xe0a2('0x15')](0x1f4,_0xf7dff0[_0xe0a2('0x16')]));});});});};exports[_0xe0a2('0x40')]=function(_0x493046){var _0x4bf4d1=this;return new Promise(function(_0x1f6377,_0x47fdac){db['CmContact']['describe']()[_0xe0a2('0x19')](function(_0x597513){return db[_0xe0a2('0x7')][_0xe0a2('0x8')]({'raw':_0x493046[_0xe0a2('0x9')]?_0x493046[_0xe0a2('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x493046[_0xe0a2('0x9')]?_0x493046[_0xe0a2('0x9')][_0xe0a2('0xb')]||null:null,'attributes':_0x493046[_0xe0a2('0x9')]?_0x493046['options']['attributes']||null:null,'limit':_0x493046[_0xe0a2('0x9')]?_0x493046['options'][_0xe0a2('0xd')]||null:null,'include':_0x493046[_0xe0a2('0x9')]?_0x493046[_0xe0a2('0x9')]['include']?_[_0xe0a2('0xf')](_0x493046['options'][_0xe0a2('0xe')],function(_0x26b80d){return{'model':db[_0x26b80d['model']],'as':_0x26b80d['as'],'attributes':_0x26b80d['as']===_0xe0a2('0x41')?_[_0xe0a2('0x42')](_0x597513):_0x26b80d[_0xe0a2('0xc')],'include':_0x26b80d[_0xe0a2('0xe')]?_[_0xe0a2('0xf')](_0x26b80d[_0xe0a2('0xe')],function(_0x4f92c8){return{'model':db[_0x4f92c8['model']],'as':_0x4f92c8['as'],'attributes':_0x4f92c8[_0xe0a2('0xc')],'include':_0x4f92c8[_0xe0a2('0xe')]?_['map'](_0x4f92c8[_0xe0a2('0xe')],function(_0x13dec1){return{'model':db[_0x13dec1['model']],'as':_0x13dec1['as'],'attributes':_0x13dec1[_0xe0a2('0xc')]};}):[]};}):[]};}):[]:[]})[_0xe0a2('0x19')](function(_0x551e77){logger[_0xe0a2('0x11')](_0xe0a2('0x6'),_0x493046);logger['debug'](_0xe0a2('0x6'),_0x493046,JSON['stringify'](_0x551e77));_0x1f6377(_0x551e77);})[_0xe0a2('0x14')](function(_0x4fa953){logger[_0xe0a2('0x15')](_0xe0a2('0x6'),_0x4fa953[_0xe0a2('0x16')],_0x493046);_0x47fdac(_0x4bf4d1[_0xe0a2('0x15')](0x1f4,_0x4fa953[_0xe0a2('0x16')]));});});});};exports['GetContactByPhone']=function(_0x202cb6){var _0x671ad6=this;return new Promise(function(_0x198ed7,_0x4d9fff){return db[_0xe0a2('0x24')][_0xe0a2('0x43')]({'raw':!![],'where':{'phone':_0x202cb6[_0xe0a2('0x9')][_0xe0a2('0xb')][_0xe0a2('0x44')]},'attributes':['id',_0xe0a2('0x45')],'order':[['id','DESC']]})[_0xe0a2('0x19')](function(_0xf30864){logger[_0xe0a2('0x11')](_0xe0a2('0x46'),_0x202cb6);logger[_0xe0a2('0x12')]('getContactByPhone',_0x202cb6,JSON['stringify'](_0xf30864));_0x198ed7(_0xf30864);})[_0xe0a2('0x14')](function(_0x56c6d7){logger[_0xe0a2('0x15')]('getContactByPhone',_0x56c6d7[_0xe0a2('0x16')],_0x202cb6);_0x4d9fff(_0x671ad6['error'](0x1f4,_0x56c6d7[_0xe0a2('0x16')]));});});};exports[_0xe0a2('0x47')]=function(_0x34f4df){var _0x3bd1b2=this;return new Promise(function(_0x46349d,_0xf8cc49){return db[_0xe0a2('0x25')]['transaction'](function(_0x309c2a){var _0x7e8529=_0x34f4df[_0xe0a2('0x9')]&&_0x34f4df[_0xe0a2('0x9')][_0xe0a2('0xb')]?_0x34f4df['options'][_0xe0a2('0xb')]:{};return db[_0xe0a2('0x7')][_0xe0a2('0x1e')](_0x34f4df[_0xe0a2('0x1c')],{'where':_0x7e8529,'transaction':_0x309c2a})[_0xe0a2('0x19')](function(_0x31ad2b){logger['info'](_0xe0a2('0x47'),_0x34f4df);logger['debug'](_0xe0a2('0x47'),_0x34f4df,JSON['stringify'](_0x31ad2b));_0x46349d(_0x31ad2b);})['catch'](function(_0x38167d){logger[_0xe0a2('0x15')]('ResetActiveCalls',_0x38167d['message'],_0x34f4df);_0xf8cc49(_0x3bd1b2[_0xe0a2('0x15')](0x1f4,_0x38167d[_0xe0a2('0x16')]));});});});};exports[_0xe0a2('0x48')]=function(_0x338fcd){var _0x5dbb47=this;var _0x30c123=_0x338fcd['body'][_0xe0a2('0xb')][_0xe0a2('0x49')];var _0x53e486=_0x338fcd[_0xe0a2('0x1c')][_0xe0a2('0xb')]['interval'];var _0x42da0f=_0x338fcd[_0xe0a2('0x1c')][_0xe0a2('0xb')][_0xe0a2('0x4a')];return new Promise(function(_0x21f74d,_0x5c360c){return db[_0xe0a2('0x7')][_0xe0a2('0x8')]({'where':{'voiceQueueId':{'$in':_0x30c123},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe0a2('0x25')]['literal'](_0xe0a2('0x4b')+_0x53e486+'\x20MINUTE'),'$gt':db[_0xe0a2('0x25')][_0xe0a2('0x36')](_0xe0a2('0x4c'))}},'UserId':{'$in':_0x42da0f}},'include':[{'model':db[_0xe0a2('0x24')],'as':'Contact'},{'model':db[_0xe0a2('0x29')],'as':'Agent','attributes':['id',_0xe0a2('0x2a'),_0xe0a2('0x4d')]},{'model':db['CmList'],'as':'List'}]})[_0xe0a2('0x19')](function(_0x45e0ef){if(_0x45e0ef[_0xe0a2('0x2b')]>0x0){return db[_0xe0a2('0x25')][_0xe0a2('0x26')](function(_0x49dc61){return db[_0xe0a2('0x7')][_0xe0a2('0x1e')]({'recallmeNotifiedDate':db[_0xe0a2('0x25')][_0xe0a2('0x36')](_0xe0a2('0x4c'))},{'where':{'id':{'$in':_[_0xe0a2('0xf')](_0x45e0ef,'id')}},'transaction':_0x49dc61})['then'](function(){_0x21f74d(_0x45e0ef);})['catch'](function(_0x46bb4a){logger[_0xe0a2('0x15')](_0xe0a2('0x48'),_0x46bb4a[_0xe0a2('0x16')],_0x338fcd);_0x5c360c(_0x5dbb47[_0xe0a2('0x15')](0x1f4,_0x46bb4a[_0xe0a2('0x16')]));});})[_0xe0a2('0x14')](function(_0x3edeea){logger[_0xe0a2('0x15')](_0xe0a2('0x48'),_0x3edeea[_0xe0a2('0x16')],_0x338fcd);_0x5c360c(_0x5dbb47[_0xe0a2('0x15')](0x1f4,_0x3edeea['message']));});}else{_0x21f74d(_0x45e0ef);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 2ff7725..d9e9048 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 _0xc5f5=['express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','getOpenContacts','getPreviewRecall','post','/preview','getPreview','getTimezone','/:id','destroy','exports'];(function(_0x13dbea,_0x4349e6){var _0x412115=function(_0x232ef4){while(--_0x232ef4){_0x13dbea['push'](_0x13dbea['shift']());}};_0x412115(++_0x4349e6);}(_0xc5f5,0xbb));var _0x5c5f=function(_0x44d5a6,_0x37e14a){_0x44d5a6=_0x44d5a6-0x0;var _0x1d793b=_0xc5f5[_0x44d5a6];return _0x1d793b;};'use strict';var express=require(_0x5c5f('0x0'));var router=express[_0x5c5f('0x1')]();var auth=require(_0x5c5f('0x2'));var controller=require(_0x5c5f('0x3'));router[_0x5c5f('0x4')]('/',auth[_0x5c5f('0x5')](),controller[_0x5c5f('0x6')]);router['get'](_0x5c5f('0x7'),auth[_0x5c5f('0x5')](),controller['describe']);router['get']('/opencontacts',auth[_0x5c5f('0x5')](),controller[_0x5c5f('0x8')]);router[_0x5c5f('0x4')]('/timezones',auth[_0x5c5f('0x5')](),controller['getTimezones']);router[_0x5c5f('0x4')]('/:id',auth[_0x5c5f('0x5')](),controller['show']);router[_0x5c5f('0x4')]('/:id/previewrecall',auth[_0x5c5f('0x5')](),controller[_0x5c5f('0x9')]);router['post']('/',auth[_0x5c5f('0x5')](),controller['create']);router[_0x5c5f('0xa')](_0x5c5f('0xb'),auth['isAuthenticated'](),controller[_0x5c5f('0xc')]);router[_0x5c5f('0xa')]('/timezone',auth[_0x5c5f('0x5')](),controller[_0x5c5f('0xd')]);router['put'](_0x5c5f('0xe'),auth[_0x5c5f('0x5')](),controller['update']);router['delete'](_0x5c5f('0xe'),auth['isAuthenticated'](),controller[_0x5c5f('0xf')]);module[_0x5c5f('0x10')]=router; \ No newline at end of file +var _0xf3c2=['show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','exports','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated','/opencontacts','/timezones','getTimezones','/:id'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf3c2,0x137));var _0x2f3c=function(_0x578818,_0x3eafd0){_0x578818=_0x578818-0x0;var _0x45b8a8=_0xf3c2[_0x578818];return _0x45b8a8;};'use strict';var express=require('express');var router=express[_0x2f3c('0x0')]();var auth=require(_0x2f3c('0x1'));var controller=require(_0x2f3c('0x2'));router[_0x2f3c('0x3')]('/',auth['isAuthenticated'](),controller[_0x2f3c('0x4')]);router['get'](_0x2f3c('0x5'),auth[_0x2f3c('0x6')](),controller['describe']);router[_0x2f3c('0x3')](_0x2f3c('0x7'),auth[_0x2f3c('0x6')](),controller['getOpenContacts']);router[_0x2f3c('0x3')](_0x2f3c('0x8'),auth[_0x2f3c('0x6')](),controller[_0x2f3c('0x9')]);router[_0x2f3c('0x3')](_0x2f3c('0xa'),auth[_0x2f3c('0x6')](),controller[_0x2f3c('0xb')]);router['get'](_0x2f3c('0xc'),auth[_0x2f3c('0x6')](),controller[_0x2f3c('0xd')]);router[_0x2f3c('0xe')]('/',auth['isAuthenticated'](),controller[_0x2f3c('0xf')]);router[_0x2f3c('0xe')](_0x2f3c('0x10'),auth[_0x2f3c('0x6')](),controller[_0x2f3c('0x11')]);router['post'](_0x2f3c('0x12'),auth[_0x2f3c('0x6')](),controller[_0x2f3c('0x13')]);router[_0x2f3c('0x14')](_0x2f3c('0xa'),auth[_0x2f3c('0x6')](),controller[_0x2f3c('0x15')]);router['delete']('/:id',auth[_0x2f3c('0x6')](),controller['destroy']);module[_0x2f3c('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index bc1ffdf..2bc3c37 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 _0x798c=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x4e35d2,_0x516864){var _0x384964=function(_0x53012b){while(--_0x53012b){_0x4e35d2['push'](_0x4e35d2['shift']());}};_0x384964(++_0x516864);}(_0x798c,0x11e));var _0xc798=function(_0x292288,_0x208480){_0x292288=_0x292288-0x0;var _0x14214e=_0x798c[_0x292288];return _0x14214e;};'use strict';var moment=require(_0xc798('0x0'));var Sequelize=require(_0xc798('0x1'));module[_0xc798('0x2')]={'CmHopperId':{'type':Sequelize[_0xc798('0x3')]},'phone':{'type':Sequelize[_0xc798('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xc798('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xc798('0x5')],'defaultValue':moment()[_0xc798('0x6')](_0xc798('0x7'))},'countbusyretry':{'type':Sequelize[_0xc798('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc798('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xc798('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc798('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc798('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc798('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc798('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x90bc=['format','moment','sequelize','INTEGER','STRING','DATE'];(function(_0x24c970,_0x1199ef){var _0x48f700=function(_0x5d22fe){while(--_0x5d22fe){_0x24c970['push'](_0x24c970['shift']());}};_0x48f700(++_0x1199ef);}(_0x90bc,0xe5));var _0xc90b=function(_0xeacae,_0x1bc236){_0xeacae=_0xeacae-0x0;var _0x2019fb=_0x90bc[_0xeacae];return _0x2019fb;};'use strict';var moment=require(_0xc90b('0x0'));var Sequelize=require(_0xc90b('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xc90b('0x2')]},'phone':{'type':Sequelize[_0xc90b('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xc90b('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xc90b('0x4')],'defaultValue':moment()[_0xc90b('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xc90b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc90b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xc90b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc90b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc90b('0x2')],'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 72b03fb..04fe69b 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 _0x853e=['findAll','rows','catch','show','params','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','keys','query','attributes','model','fields','nolimit','order','sort','where','filters','filter','merge','type','CmHopperAdditionalPhone','include'];(function(_0x4d91c5,_0x3eb4cd){var _0x12020e=function(_0x73a373){while(--_0x73a373){_0x4d91c5['push'](_0x4d91c5['shift']());}};_0x12020e(++_0x3eb4cd);}(_0x853e,0xb5));var _0xe853=function(_0x20e9e5,_0x30f3f8){_0x20e9e5=_0x20e9e5-0x0;var _0x100a59=_0x853e[_0x20e9e5];return _0x100a59;};'use strict';var emlformat=require(_0xe853('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe853('0x1'));var moment=require(_0xe853('0x2'));var BPromise=require(_0xe853('0x3'));var Mustache=require(_0xe853('0x4'));var util=require('util');var path=require(_0xe853('0x5'));var sox=require(_0xe853('0x6'));var csv=require(_0xe853('0x7'));var ejs=require(_0xe853('0x8'));var fs=require('fs');var fs_extra=require(_0xe853('0x9'));var _=require(_0xe853('0xa'));var squel=require(_0xe853('0xb'));var crypto=require(_0xe853('0xc'));var jsforce=require(_0xe853('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe853('0x7'));var querystring=require(_0xe853('0xe'));var Papa=require('papaparse');var Redis=require(_0xe853('0xf'));var authService=require(_0xe853('0x10'));var qs=require(_0xe853('0x11'));var as=require(_0xe853('0x12'));var hardwareService=require(_0xe853('0x13'));var logger=require(_0xe853('0x14'))(_0xe853('0x15'));var utils=require(_0xe853('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe853('0x17'));var db=require(_0xe853('0x18'))['db'];function respondWithStatusCode(_0x5a06fc,_0x27369d){_0x27369d=_0x27369d||0xcc;return function(_0x741bb2){if(_0x741bb2){return _0x5a06fc[_0xe853('0x19')](_0x27369d);}return _0x5a06fc[_0xe853('0x1a')](_0x27369d)[_0xe853('0x1b')]();};}function respondWithResult(_0x1a45e7,_0xb68d4c){_0xb68d4c=_0xb68d4c||0xc8;return function(_0x17ac80){if(_0x17ac80){return _0x1a45e7[_0xe853('0x1a')](_0xb68d4c)[_0xe853('0x1c')](_0x17ac80);}};}function respondWithFilteredResult(_0x5397a3,_0x17806c){return function(_0x24658c){if(_0x24658c){var _0x4b6c9a=typeof _0x17806c[_0xe853('0x1d')]==='undefined'&&typeof _0x17806c[_0xe853('0x1e')]===_0xe853('0x1f');var _0x3d83af=_0x24658c[_0xe853('0x20')];var _0x223184=_0x4b6c9a?0x0:_0x17806c['offset'];var _0x11f79b=_0x4b6c9a?_0x24658c[_0xe853('0x20')]:_0x17806c['offset']+_0x17806c['limit'];var _0x1063a6;if(_0x11f79b>=_0x3d83af){_0x11f79b=_0x3d83af;_0x1063a6=0xc8;}else{_0x1063a6=0xce;}_0x5397a3['status'](_0x1063a6);return _0x5397a3['set'](_0xe853('0x21'),_0x223184+'-'+_0x11f79b+'/'+_0x3d83af)[_0xe853('0x1c')](_0x24658c);}return null;};}function patchUpdates(_0x36b407){return function(_0x368864){try{jsonpatch[_0xe853('0x22')](_0x368864,_0x36b407,!![]);}catch(_0xabf47){return BPromise[_0xe853('0x23')](_0xabf47);}return _0x368864[_0xe853('0x24')]();};}function saveUpdates(_0x56b3a3,_0x541f8b){return function(_0x384b7f){if(_0x384b7f){return _0x384b7f[_0xe853('0x25')](_0x56b3a3)[_0xe853('0x26')](function(_0xeb4b62){return _0xeb4b62;});}return null;};}function removeEntity(_0xbbd16f,_0xd0e816){return function(_0x224476){if(_0x224476){return _0x224476[_0xe853('0x27')]()[_0xe853('0x26')](function(){var _0x9c89f4=_0x224476['get']({'plain':!![]});var _0x2287e6=_0xe853('0x28');return db[_0xe853('0x29')][_0xe853('0x27')]({'where':{'type':_0x2287e6,'resourceId':_0x9c89f4['id']}})[_0xe853('0x26')](function(){return _0x224476;});})[_0xe853('0x26')](function(){_0xbbd16f[_0xe853('0x1a')](0xcc)[_0xe853('0x1b')]();});}};}function handleEntityNotFound(_0x3e2e56,_0x15931e){return function(_0x3c3b40){if(!_0x3c3b40){_0x3e2e56[_0xe853('0x19')](0x194);}return _0x3c3b40;};}function handleError(_0x485118,_0x17956b){_0x17956b=_0x17956b||0x1f4;return function(_0x4503c3){logger[_0xe853('0x2a')](_0x4503c3[_0xe853('0x2b')]);if(_0x4503c3[_0xe853('0x2c')]){delete _0x4503c3['name'];}_0x485118[_0xe853('0x1a')](_0x17956b)['send'](_0x4503c3);};}exports[_0xe853('0x2d')]=function(_0xf1a5ba,_0x4a0e38){var _0x486b47={},_0x4f1764={},_0x60632={'count':0x0,'rows':[]};var _0x583439=_[_0xe853('0x2e')](db['CmHopperAdditionalPhone'][_0xe853('0x2f')],function(_0xed19ef){return{'name':_0xed19ef[_0xe853('0x30')],'type':_0xed19ef['type'][_0xe853('0x31')]};});_0x4f1764['model']=_[_0xe853('0x2e')](_0x583439,'name');_0x4f1764['query']=_[_0xe853('0x32')](_0xf1a5ba['query']);_0x4f1764['filters']=_['intersection'](_0x4f1764['model'],_0x4f1764[_0xe853('0x33')]);_0x486b47[_0xe853('0x34')]=_['intersection'](_0x4f1764[_0xe853('0x35')],qs[_0xe853('0x36')](_0xf1a5ba[_0xe853('0x33')][_0xe853('0x36')]));_0x486b47[_0xe853('0x34')]=_0x486b47[_0xe853('0x34')]['length']?_0x486b47[_0xe853('0x34')]:_0x4f1764[_0xe853('0x35')];if(!_0xf1a5ba[_0xe853('0x33')]['hasOwnProperty'](_0xe853('0x37'))){_0x486b47['limit']=qs[_0xe853('0x1e')](_0xf1a5ba[_0xe853('0x33')][_0xe853('0x1e')]);_0x486b47[_0xe853('0x1d')]=qs[_0xe853('0x1d')](_0xf1a5ba['query'][_0xe853('0x1d')]);}_0x486b47[_0xe853('0x38')]=qs['sort'](_0xf1a5ba['query'][_0xe853('0x39')]);_0x486b47[_0xe853('0x3a')]=qs[_0xe853('0x3b')](_['pick'](_0xf1a5ba[_0xe853('0x33')],_0x4f1764[_0xe853('0x3b')]),_0x583439);if(_0xf1a5ba[_0xe853('0x33')][_0xe853('0x3c')]){_0x486b47[_0xe853('0x3a')]=_[_0xe853('0x3d')](_0x486b47[_0xe853('0x3a')],{'$or':_[_0xe853('0x2e')](_0x583439,function(_0x1bb699){if(_0x1bb699[_0xe853('0x3e')]!=='VIRTUAL'){var _0x55542a={};_0x55542a[_0x1bb699[_0xe853('0x2c')]]={'$like':'%'+_0xf1a5ba['query']['filter']+'%'};return _0x55542a;}})});}_0x486b47=_[_0xe853('0x3d')]({},_0x486b47,_0xf1a5ba['options']);var _0x30a8a0={'where':_0x486b47[_0xe853('0x3a')]};return db[_0xe853('0x3f')][_0xe853('0x20')](_0x30a8a0)['then'](function(_0x5c109b){_0x60632[_0xe853('0x20')]=_0x5c109b;if(_0xf1a5ba[_0xe853('0x33')]['includeAll']){_0x486b47[_0xe853('0x40')]=[{'all':!![]}];}return db[_0xe853('0x3f')][_0xe853('0x41')](_0x486b47);})[_0xe853('0x26')](function(_0x329bf7){_0x60632[_0xe853('0x42')]=_0x329bf7;return _0x60632;})[_0xe853('0x26')](respondWithFilteredResult(_0x4a0e38,_0x486b47))[_0xe853('0x43')](handleError(_0x4a0e38,null));};exports[_0xe853('0x44')]=function(_0xf75992,_0x5a5ecc){var _0x3bc8b3={'raw':!![],'where':{'id':_0xf75992[_0xe853('0x45')]['id']}},_0x2de14a={};_0x2de14a[_0xe853('0x35')]=_[_0xe853('0x32')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x2de14a[_0xe853('0x33')]=_[_0xe853('0x32')](_0xf75992['query']);_0x2de14a[_0xe853('0x3b')]=_[_0xe853('0x46')](_0x2de14a[_0xe853('0x35')],_0x2de14a['query']);_0x3bc8b3[_0xe853('0x34')]=_[_0xe853('0x46')](_0x2de14a[_0xe853('0x35')],qs[_0xe853('0x36')](_0xf75992[_0xe853('0x33')][_0xe853('0x36')]));_0x3bc8b3[_0xe853('0x34')]=_0x3bc8b3[_0xe853('0x34')]['length']?_0x3bc8b3[_0xe853('0x34')]:_0x2de14a[_0xe853('0x35')];if(_0xf75992['query']['includeAll']){_0x3bc8b3['include']=[{'all':!![]}];}_0x3bc8b3=_[_0xe853('0x3d')]({},_0x3bc8b3,_0xf75992['options']);return db[_0xe853('0x3f')][_0xe853('0x47')](_0x3bc8b3)[_0xe853('0x26')](handleEntityNotFound(_0x5a5ecc,null))[_0xe853('0x26')](respondWithResult(_0x5a5ecc,null))[_0xe853('0x43')](handleError(_0x5a5ecc,null));};exports[_0xe853('0x48')]=function(_0x32b18e,_0x3f02ec){return db['CmHopperAdditionalPhone'][_0xe853('0x48')](_0x32b18e[_0xe853('0x49')],{})[_0xe853('0x26')](function(_0x1995aa){var _0x499de7=_0x32b18e['user'][_0xe853('0x4a')]({'plain':!![]});if(!_0x499de7)throw new Error(_0xe853('0x4b'));if(_0x499de7[_0xe853('0x4c')]===_0xe853('0x4d')){var _0x51c61b=_0x1995aa[_0xe853('0x4a')]({'plain':!![]});var _0xd5c982=_0xe853('0x28');return db[_0xe853('0x4e')][_0xe853('0x47')]({'where':{'name':_0xd5c982,'userProfileId':_0x499de7[_0xe853('0x4f')]},'raw':!![]})[_0xe853('0x26')](function(_0x302a13){if(_0x302a13&&_0x302a13[_0xe853('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x51c61b['name'],'resourceId':_0x51c61b['id'],'type':_0x302a13[_0xe853('0x2c')],'sectionId':_0x302a13['id']},{})[_0xe853('0x26')](function(){return _0x1995aa;});}else{return _0x1995aa;}})[_0xe853('0x43')](function(_0x381ba0){logger[_0xe853('0x2a')](_0xe853('0x51'),_0x381ba0);throw _0x381ba0;});}return _0x1995aa;})[_0xe853('0x26')](respondWithResult(_0x3f02ec,0xc9))[_0xe853('0x43')](handleError(_0x3f02ec,null));};exports['update']=function(_0x21da34,_0x207f0b){if(_0x21da34[_0xe853('0x49')]['id']){delete _0x21da34['body']['id'];}return db[_0xe853('0x3f')][_0xe853('0x47')]({'where':{'id':_0x21da34[_0xe853('0x45')]['id']}})[_0xe853('0x26')](handleEntityNotFound(_0x207f0b,null))[_0xe853('0x26')](saveUpdates(_0x21da34[_0xe853('0x49')],null))[_0xe853('0x26')](respondWithResult(_0x207f0b,null))[_0xe853('0x43')](handleError(_0x207f0b,null));};exports[_0xe853('0x27')]=function(_0x4283b3,_0x8127e8){return db[_0xe853('0x3f')]['find']({'where':{'id':_0x4283b3[_0xe853('0x45')]['id']}})[_0xe853('0x26')](handleEntityNotFound(_0x8127e8,null))[_0xe853('0x26')](removeEntity(_0x8127e8,null))[_0xe853('0x43')](handleError(_0x8127e8,null));}; \ No newline at end of file +var _0xa807=['fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','name','send','map','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','findAll','catch','params','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x399818,_0x1d83ba){var _0x26f353=function(_0x47d96b){while(--_0x47d96b){_0x399818['push'](_0x399818['shift']());}};_0x26f353(++_0x1d83ba);}(_0xa807,0x14d));var _0x7a80=function(_0x1302a7,_0x335c01){_0x1302a7=_0x1302a7-0x0;var _0x1da674=_0xa807[_0x1302a7];return _0x1da674;};'use strict';var emlformat=require(_0x7a80('0x0'));var rimraf=require(_0x7a80('0x1'));var zipdir=require(_0x7a80('0x2'));var jsonpatch=require(_0x7a80('0x3'));var rp=require('request-promise');var moment=require(_0x7a80('0x4'));var BPromise=require(_0x7a80('0x5'));var Mustache=require(_0x7a80('0x6'));var util=require(_0x7a80('0x7'));var path=require(_0x7a80('0x8'));var sox=require('sox');var csv=require(_0x7a80('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a80('0xa'));var _=require('lodash');var squel=require(_0x7a80('0xb'));var crypto=require('crypto');var jsforce=require(_0x7a80('0xc'));var deskjs=require(_0x7a80('0xd'));var toCsv=require(_0x7a80('0x9'));var querystring=require(_0x7a80('0xe'));var Papa=require('papaparse');var Redis=require(_0x7a80('0xf'));var authService=require(_0x7a80('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a80('0x11'));var logger=require(_0x7a80('0x12'))(_0x7a80('0x13'));var utils=require(_0x7a80('0x14'));var config=require(_0x7a80('0x15'));var licenseUtil=require(_0x7a80('0x16'));var db=require(_0x7a80('0x17'))['db'];function respondWithStatusCode(_0x57cef4,_0x4c953d){_0x4c953d=_0x4c953d||0xcc;return function(_0x103b8b){if(_0x103b8b){return _0x57cef4['sendStatus'](_0x4c953d);}return _0x57cef4['status'](_0x4c953d)[_0x7a80('0x18')]();};}function respondWithResult(_0x25af48,_0x21a271){_0x21a271=_0x21a271||0xc8;return function(_0x270589){if(_0x270589){return _0x25af48[_0x7a80('0x19')](_0x21a271)[_0x7a80('0x1a')](_0x270589);}};}function respondWithFilteredResult(_0x16b071,_0x244f7a){return function(_0x590b2e){if(_0x590b2e){var _0x482e3d=typeof _0x244f7a[_0x7a80('0x1b')]===_0x7a80('0x1c')&&typeof _0x244f7a['limit']===_0x7a80('0x1c');var _0x1d7c50=_0x590b2e[_0x7a80('0x1d')];var _0x4ef985=_0x482e3d?0x0:_0x244f7a['offset'];var _0x2b41f1=_0x482e3d?_0x590b2e[_0x7a80('0x1d')]:_0x244f7a[_0x7a80('0x1b')]+_0x244f7a['limit'];var _0x20c8b4;if(_0x2b41f1>=_0x1d7c50){_0x2b41f1=_0x1d7c50;_0x20c8b4=0xc8;}else{_0x20c8b4=0xce;}_0x16b071['status'](_0x20c8b4);return _0x16b071[_0x7a80('0x1e')](_0x7a80('0x1f'),_0x4ef985+'-'+_0x2b41f1+'/'+_0x1d7c50)[_0x7a80('0x1a')](_0x590b2e);}return null;};}function patchUpdates(_0x4545a8){return function(_0x3fb41e){try{jsonpatch[_0x7a80('0x20')](_0x3fb41e,_0x4545a8,!![]);}catch(_0xdea54d){return BPromise[_0x7a80('0x21')](_0xdea54d);}return _0x3fb41e[_0x7a80('0x22')]();};}function saveUpdates(_0x30aee1,_0x49566b){return function(_0x575810){if(_0x575810){return _0x575810[_0x7a80('0x23')](_0x30aee1)['then'](function(_0x476d68){return _0x476d68;});}return null;};}function removeEntity(_0x4bbb55,_0x3f800c){return function(_0x24abc7){if(_0x24abc7){return _0x24abc7[_0x7a80('0x24')]()[_0x7a80('0x25')](function(){var _0x1adb01=_0x24abc7['get']({'plain':!![]});var _0x27e4ce=_0x7a80('0x26');return db[_0x7a80('0x27')][_0x7a80('0x24')]({'where':{'type':_0x27e4ce,'resourceId':_0x1adb01['id']}})[_0x7a80('0x25')](function(){return _0x24abc7;});})['then'](function(){_0x4bbb55[_0x7a80('0x19')](0xcc)[_0x7a80('0x18')]();});}};}function handleEntityNotFound(_0x1940b6,_0xf6e96){return function(_0x588491){if(!_0x588491){_0x1940b6[_0x7a80('0x28')](0x194);}return _0x588491;};}function handleError(_0x44def9,_0x3c0e1c){_0x3c0e1c=_0x3c0e1c||0x1f4;return function(_0x21bb38){logger[_0x7a80('0x29')](_0x21bb38[_0x7a80('0x2a')]);if(_0x21bb38[_0x7a80('0x2b')]){delete _0x21bb38['name'];}_0x44def9[_0x7a80('0x19')](_0x3c0e1c)[_0x7a80('0x2c')](_0x21bb38);};}exports['index']=function(_0x3ac7ce,_0x1dbdaf){var _0x3035cc={},_0x428699={},_0x1272cd={'count':0x0,'rows':[]};var _0x1144cd=_[_0x7a80('0x2d')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x551042){return{'name':_0x551042[_0x7a80('0x2e')],'type':_0x551042[_0x7a80('0x2f')]['key']};});_0x428699[_0x7a80('0x30')]=_[_0x7a80('0x2d')](_0x1144cd,'name');_0x428699['query']=_['keys'](_0x3ac7ce[_0x7a80('0x31')]);_0x428699[_0x7a80('0x32')]=_[_0x7a80('0x33')](_0x428699[_0x7a80('0x30')],_0x428699[_0x7a80('0x31')]);_0x3035cc['attributes']=_['intersection'](_0x428699[_0x7a80('0x30')],qs[_0x7a80('0x34')](_0x3ac7ce[_0x7a80('0x31')]['fields']));_0x3035cc[_0x7a80('0x35')]=_0x3035cc[_0x7a80('0x35')][_0x7a80('0x36')]?_0x3035cc[_0x7a80('0x35')]:_0x428699[_0x7a80('0x30')];if(!_0x3ac7ce[_0x7a80('0x31')][_0x7a80('0x37')]('nolimit')){_0x3035cc[_0x7a80('0x38')]=qs[_0x7a80('0x38')](_0x3ac7ce[_0x7a80('0x31')]['limit']);_0x3035cc[_0x7a80('0x1b')]=qs[_0x7a80('0x1b')](_0x3ac7ce[_0x7a80('0x31')][_0x7a80('0x1b')]);}_0x3035cc[_0x7a80('0x39')]=qs[_0x7a80('0x3a')](_0x3ac7ce[_0x7a80('0x31')][_0x7a80('0x3a')]);_0x3035cc[_0x7a80('0x3b')]=qs[_0x7a80('0x32')](_[_0x7a80('0x3c')](_0x3ac7ce['query'],_0x428699[_0x7a80('0x32')]),_0x1144cd);if(_0x3ac7ce['query'][_0x7a80('0x3d')]){_0x3035cc['where']=_[_0x7a80('0x3e')](_0x3035cc['where'],{'$or':_[_0x7a80('0x2d')](_0x1144cd,function(_0x177ca2){if(_0x177ca2[_0x7a80('0x2f')]!==_0x7a80('0x3f')){var _0x457f9d={};_0x457f9d[_0x177ca2['name']]={'$like':'%'+_0x3ac7ce[_0x7a80('0x31')][_0x7a80('0x3d')]+'%'};return _0x457f9d;}})});}_0x3035cc=_[_0x7a80('0x3e')]({},_0x3035cc,_0x3ac7ce[_0x7a80('0x40')]);var _0x3f3dd9={'where':_0x3035cc['where']};return db[_0x7a80('0x41')][_0x7a80('0x1d')](_0x3f3dd9)[_0x7a80('0x25')](function(_0x1c1971){_0x1272cd[_0x7a80('0x1d')]=_0x1c1971;if(_0x3ac7ce['query'][_0x7a80('0x42')]){_0x3035cc[_0x7a80('0x43')]=[{'all':!![]}];}return db[_0x7a80('0x41')][_0x7a80('0x44')](_0x3035cc);})[_0x7a80('0x25')](function(_0x99c74){_0x1272cd['rows']=_0x99c74;return _0x1272cd;})[_0x7a80('0x25')](respondWithFilteredResult(_0x1dbdaf,_0x3035cc))[_0x7a80('0x45')](handleError(_0x1dbdaf,null));};exports['show']=function(_0x2867a1,_0x539169){var _0x4dfa50={'raw':!![],'where':{'id':_0x2867a1[_0x7a80('0x46')]['id']}},_0x3e0a35={};_0x3e0a35[_0x7a80('0x30')]=_[_0x7a80('0x47')](db[_0x7a80('0x41')][_0x7a80('0x48')]);_0x3e0a35['query']=_[_0x7a80('0x47')](_0x2867a1['query']);_0x3e0a35['filters']=_['intersection'](_0x3e0a35[_0x7a80('0x30')],_0x3e0a35[_0x7a80('0x31')]);_0x4dfa50['attributes']=_[_0x7a80('0x33')](_0x3e0a35['model'],qs[_0x7a80('0x34')](_0x2867a1[_0x7a80('0x31')][_0x7a80('0x34')]));_0x4dfa50[_0x7a80('0x35')]=_0x4dfa50[_0x7a80('0x35')][_0x7a80('0x36')]?_0x4dfa50[_0x7a80('0x35')]:_0x3e0a35['model'];if(_0x2867a1[_0x7a80('0x31')]['includeAll']){_0x4dfa50[_0x7a80('0x43')]=[{'all':!![]}];}_0x4dfa50=_['merge']({},_0x4dfa50,_0x2867a1[_0x7a80('0x40')]);return db['CmHopperAdditionalPhone'][_0x7a80('0x49')](_0x4dfa50)[_0x7a80('0x25')](handleEntityNotFound(_0x539169,null))[_0x7a80('0x25')](respondWithResult(_0x539169,null))[_0x7a80('0x45')](handleError(_0x539169,null));};exports['create']=function(_0x3cd58a,_0x123be2){return db[_0x7a80('0x41')][_0x7a80('0x4a')](_0x3cd58a[_0x7a80('0x4b')],{})['then'](function(_0x14c863){var _0x3ca251=_0x3cd58a[_0x7a80('0x4c')][_0x7a80('0x4d')]({'plain':!![]});if(!_0x3ca251)throw new Error(_0x7a80('0x4e'));if(_0x3ca251[_0x7a80('0x4f')]===_0x7a80('0x4c')){var _0x897579=_0x14c863[_0x7a80('0x4d')]({'plain':!![]});var _0x117b97=_0x7a80('0x26');return db[_0x7a80('0x50')]['find']({'where':{'name':_0x117b97,'userProfileId':_0x3ca251[_0x7a80('0x51')]},'raw':!![]})['then'](function(_0x37e14e){if(_0x37e14e&&_0x37e14e[_0x7a80('0x52')]===0x0){return db[_0x7a80('0x27')]['create']({'name':_0x897579[_0x7a80('0x2b')],'resourceId':_0x897579['id'],'type':_0x37e14e['name'],'sectionId':_0x37e14e['id']},{})[_0x7a80('0x25')](function(){return _0x14c863;});}else{return _0x14c863;}})['catch'](function(_0x4da72c){logger[_0x7a80('0x29')](_0x7a80('0x53'),_0x4da72c);throw _0x4da72c;});}return _0x14c863;})[_0x7a80('0x25')](respondWithResult(_0x123be2,0xc9))['catch'](handleError(_0x123be2,null));};exports[_0x7a80('0x23')]=function(_0xb76196,_0x276282){if(_0xb76196[_0x7a80('0x4b')]['id']){delete _0xb76196[_0x7a80('0x4b')]['id'];}return db[_0x7a80('0x41')]['find']({'where':{'id':_0xb76196[_0x7a80('0x46')]['id']}})[_0x7a80('0x25')](handleEntityNotFound(_0x276282,null))[_0x7a80('0x25')](saveUpdates(_0xb76196[_0x7a80('0x4b')],null))['then'](respondWithResult(_0x276282,null))[_0x7a80('0x45')](handleError(_0x276282,null));};exports['destroy']=function(_0x5adff5,_0x3a169f){return db[_0x7a80('0x41')][_0x7a80('0x49')]({'where':{'id':_0x5adff5[_0x7a80('0x46')]['id']}})[_0x7a80('0x25')](handleEntityNotFound(_0x3a169f,null))[_0x7a80('0x25')](removeEntity(_0x3a169f,null))['catch'](handleError(_0x3a169f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f857b97..4c9e643 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 _0x61f0=['exports','define','CmHopperAdditionalPhone','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x61f0,0x121));var _0x061f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x61f0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x061f('0x0'));var util=require(_0x061f('0x1'));var logger=require('../../config/logger')(_0x061f('0x2'));var moment=require(_0x061f('0x3'));var BPromise=require(_0x061f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x061f('0x5'));var config=require(_0x061f('0x6'));var attributes=require(_0x061f('0x7'));module[_0x061f('0x8')]=function(_0x1a46d8,_0x3c5f4e){return _0x1a46d8[_0x061f('0x9')](_0x061f('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe277=['util','api','moment','request-promise','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xe277,0xe6));var _0x7e27=function(_0x472931,_0x446c38){_0x472931=_0x472931-0x0;var _0xdcabfa=_0xe277[_0x472931];return _0xdcabfa;};'use strict';var _=require('lodash');var util=require(_0x7e27('0x0'));var logger=require('../../config/logger')(_0x7e27('0x1'));var moment=require(_0x7e27('0x2'));var BPromise=require('bluebird');var rp=require(_0x7e27('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e27('0x4'));var config=require(_0x7e27('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x7e27('0x6')]=function(_0x429376,_0x9f8f4d){return _0x429376[_0x7e27('0x7')](_0x7e27('0x8'),attributes,{'tableName':_0x7e27('0x9'),'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 1ff3296..b39e2f3 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 _0x6375=['isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','stringify','error','message','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countagentrejectretry','entity','catch','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0x6375,0x167));var _0x5637=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x6375[_0x590851];return _0x3b0115;};'use strict';var _=require(_0x5637('0x0'));var util=require(_0x5637('0x1'));var moment=require(_0x5637('0x2'));var BPromise=require(_0x5637('0x3'));var rs=require(_0x5637('0x4'));var fs=require('fs');var Redis=require(_0x5637('0x5'));var db=require(_0x5637('0x6'))['db'];var utils=require(_0x5637('0x7'));var logger=require(_0x5637('0x8'))(_0x5637('0x9'));var config=require(_0x5637('0xa'));var jayson=require(_0x5637('0xb'));var client=jayson[_0x5637('0xc')][_0x5637('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x83ebde,_0x471327,_0x4d7f90){return new BPromise(function(_0x1d953c,_0x2db62f){return client[_0x5637('0xe')](_0x83ebde,_0x4d7f90)[_0x5637('0xf')](function(_0x5cc7de){logger[_0x5637('0x10')](_0x5637('0x11'),_0x471327,_0x5637('0x12'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x471327,'request\x20sent',JSON[_0x5637('0x13')](_0x5cc7de));if(_0x5cc7de[_0x5637('0x14')]){if(_0x5cc7de['error']['code']===0x1f4){logger[_0x5637('0x14')](_0x5637('0x11'),_0x471327,_0x5cc7de[_0x5637('0x14')][_0x5637('0x15')]);return _0x2db62f(_0x5cc7de['error']['message']);}logger[_0x5637('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x471327,_0x5cc7de[_0x5637('0x14')]['message']);return _0x1d953c(_0x5cc7de['error'][_0x5637('0x15')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x471327,_0x5637('0x12'));_0x1d953c(_0x5cc7de['result'][_0x5637('0x15')]);}})['catch'](function(_0x419922){logger['error'](_0x5637('0x11'),_0x471327,_0x419922);_0x2db62f(_0x419922);});});}exports['VerifyAdditionalPhones']=function(_0x3412ec){var _0x3e0368=this;return new Promise(function(_0x199c46,_0x599502){return db[_0x5637('0x16')][_0x5637('0x17')]({'raw':!![],'where':{'ContactId':_0x3412ec['body'][_0x5637('0x18')],'ListId':_0x3412ec[_0x5637('0x19')][_0x5637('0x1a')],'VoiceQueueId':_0x3412ec['body']['VoiceQueueId']===undefined?null:_0x3412ec[_0x5637('0x19')][_0x5637('0x1b')],'CampaignId':_0x3412ec[_0x5637('0x19')][_0x5637('0x1c')]===undefined?null:_0x3412ec['body']['CampaignId']}})[_0x5637('0xf')](function(_0x1a26d0){if(_0x1a26d0!=null){return db['CmHopperAdditionalPhone'][_0x5637('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1a26d0['id'],'OrderBy':{'$gt':_0x1a26d0[_0x5637('0x1d')]}},'order':[[_0x5637('0x1d'),_0x5637('0x1e')]]})[_0x5637('0xf')](function(_0x129b78){var _0x3710f8=0x0;if(_0x129b78){if(_0x129b78[_0x5637('0x1f')]+_0x129b78[_0x5637('0x20')]+_0x129b78[_0x5637('0x21')]+_0x129b78[_0x5637('0x22')]+_0x129b78[_0x5637('0x23')]+_0x129b78[_0x5637('0x24')]+_0x129b78[_0x5637('0x25')]+_0x129b78['countagentrejectretry']<_0x3412ec['entity'][_0x5637('0x26')])_0x3710f8=0x1;_0x199c46({'additional':_0x3710f8});}else{return db[_0x5637('0x27')][_0x5637('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1a26d0['id']},'order':[[_0x5637('0x1d'),_0x5637('0x1e')]]})[_0x5637('0xf')](function(_0x2b520a){var _0x36c3cd=0x0;if(_0x2b520a){if(_0x2b520a[_0x5637('0x1f')]+_0x2b520a[_0x5637('0x20')]+_0x2b520a[_0x5637('0x21')]+_0x2b520a['countnosuchnumberretry']+_0x2b520a['countdropretry']+_0x2b520a[_0x5637('0x24')]+_0x2b520a['countmachineretry']+_0x2b520a[_0x5637('0x28')]<_0x3412ec[_0x5637('0x29')][_0x5637('0x26')])_0x36c3cd=0x1;_0x199c46({'additional':_0x36c3cd});}else{_0x199c46({'additional':0x0});}})[_0x5637('0x2a')](function(_0x80dfa7){logger[_0x5637('0x14')](_0x5637('0x2b'),_0x80dfa7[_0x5637('0x15')]);_0x599502(_0x3e0368[_0x5637('0x14')](0x1f4,_0x80dfa7['message']));});}})['catch'](function(_0x235582){logger[_0x5637('0x14')](_0x5637('0x2b'),_0x235582[_0x5637('0x15')]);_0x599502(_0x3e0368[_0x5637('0x14')](0x1f4,_0x235582[_0x5637('0x15')]));});}else _0x199c46({'additional':0x0});});});};exports[_0x5637('0x2c')]=function(_0x407da1){var _0x1d4ab8=this;return new Promise(function(_0x1566a8,_0x5bdfc8){return db[_0x5637('0x16')][_0x5637('0x17')]({'raw':!![],'where':{'ContactId':_0x407da1[_0x5637('0x19')][_0x5637('0x18')],'ListId':_0x407da1[_0x5637('0x19')][_0x5637('0x1a')],'VoiceQueueId':_0x407da1[_0x5637('0x19')][_0x5637('0x1b')]===undefined?null:_0x407da1['body'][_0x5637('0x1b')],'CampaignId':_0x407da1[_0x5637('0x19')][_0x5637('0x1c')]===undefined?null:_0x407da1[_0x5637('0x19')][_0x5637('0x1c')]}})['then'](function(_0x10ef0b){if(_0x10ef0b!=null){return db[_0x5637('0x27')][_0x5637('0x17')]({'raw':!![],'where':{'CmHopperId':_0x10ef0b['id'],'OrderBy':{'$gte':_0x10ef0b[_0x5637('0x1d')]}},'order':[[_0x5637('0x1d'),_0x5637('0x1e')]]})['then'](function(_0x1df419){if(_0x1df419)return activateAdditionalPhone(_0x10ef0b,_0x407da1[_0x5637('0x19')],_0x1df419,_0x407da1[_0x5637('0x2d')],_0x407da1[_0x5637('0x2e')])['then'](function(_0x2b2fe1){_0x1566a8(_0x2b2fe1);});else{return db[_0x5637('0x27')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x10ef0b['id']},'order':[[_0x5637('0x1d'),'ASC']]})['then'](function(_0x1afa24){if(_0x1afa24)return activateAdditionalPhone(_0x10ef0b,_0x407da1[_0x5637('0x19')],_0x1afa24,_0x407da1[_0x5637('0x2d')],_0x407da1[_0x5637('0x2e')])[_0x5637('0xf')](function(_0x21fefd){_0x1566a8(_0x21fefd);});else{_0x1566a8({'id':_0x10ef0b['id'],'phone':''});}})[_0x5637('0x2a')](function(_0x4e7d83){logger['error'](_0x5637('0x2b'),_0x4e7d83[_0x5637('0x15')]);_0x5bdfc8(_0x1d4ab8[_0x5637('0x14')](0x1f4,_0x4e7d83['message']));});}})[_0x5637('0x2a')](function(_0x5c7275){logger[_0x5637('0x14')](_0x5637('0x2b'),_0x5c7275[_0x5637('0x15')]);_0x5bdfc8(_0x1d4ab8[_0x5637('0x14')](0x1f4,_0x5c7275[_0x5637('0x15')]));});}else _0x1566a8(0x1);});});};function activateAdditionalPhone(_0x10937a,_0x339955,_0x14f8a4,_0x4ec251,_0x143e3c){return new Promise(function(_0x5a97c0,_0x4eb3af){var _0x242078;if(_[_0x5637('0x2f')](_0x14f8a4[_0x5637('0x30')])){_0x14f8a4[_0x5637('0x30')]=moment();}if(moment()>moment(_0x14f8a4[_0x5637('0x30')])){_0x242078=moment()[_0x5637('0x31')](_0x143e3c||0x3,'minutes');}else{if(_0x14f8a4[_0x5637('0x1d')]==0x0){_0x242078=moment(_0x14f8a4['scheduledat']);}else{_0x242078=moment()['add'](_0x143e3c||0x3,_0x5637('0x32'));}}if(_['isNil'](_0x242078)){_0x242078=moment()[_0x5637('0x31')](_0x143e3c||0x3,_0x5637('0x32'));}var _0x3cc93d={'phone':_0x10937a[_0x5637('0x33')],'active':0x0,'OrderBy':_[_0x5637('0x2f')](_0x10937a[_0x5637('0x1d')])?0x0:_0x10937a[_0x5637('0x1d')],'scheduledat':moment()[_0x5637('0x31')](_0x4ec251||0x1,_0x5637('0x32')),'countbusyretry':_0x339955[_0x5637('0x1f')],'countcongestionretry':_0x339955[_0x5637('0x20')],'countnoanswerretry':_0x339955['countnoanswerretry'],'countnosuchnumberretry':_0x339955[_0x5637('0x22')],'countdropretry':_0x339955[_0x5637('0x23')],'countabandonedretry':_0x339955[_0x5637('0x24')],'countmachineretry':_0x339955[_0x5637('0x25')],'countagentrejectretry':_0x339955[_0x5637('0x28')],'createdAt':_0x339955[_0x5637('0x34')],'updatedAt':_0x339955[_0x5637('0x35')]};var _0x19fe6d={'CmHopperId':_0x10937a['id'],'phone':_0x14f8a4['phone'],'active':0x0,'OrderBy':_[_0x5637('0x2f')](_0x14f8a4['OrderBy'])?0x0:_0x14f8a4[_0x5637('0x1d')],'scheduledat':_0x242078,'countbusyretry':_0x14f8a4[_0x5637('0x1f')],'countcongestionretry':_0x14f8a4[_0x5637('0x20')],'countnoanswerretry':_0x14f8a4[_0x5637('0x21')],'countnosuchnumberretry':_0x14f8a4['countnosuchnumberretry'],'countdropretry':_0x14f8a4[_0x5637('0x23')],'countabandonedretry':_0x14f8a4[_0x5637('0x24')],'countmachineretry':_0x14f8a4[_0x5637('0x25')],'countagentrejectretry':_0x14f8a4['countagentrejectretry'],'createdAt':_0x14f8a4[_0x5637('0x34')],'updatedAt':_0x14f8a4[_0x5637('0x35')]};return db['sequelize']['transaction'](function(_0x22e994){return db[_0x5637('0x27')][_0x5637('0x36')](_0x3cc93d,{'where':{'id':_0x14f8a4['id']}},{'transaction':_0x22e994})[_0x5637('0xf')](function(){return db[_0x5637('0x16')][_0x5637('0x36')](_0x19fe6d,{'where':{'id':_0x10937a['id']}},{'transaction':_0x22e994});});})[_0x5637('0xf')](function(_0x3068c4){_0x5a97c0({'id':_0x10937a['id'],'phone':_0x14f8a4[_0x5637('0x33')]});})['catch'](function(_0x528f39){logger[_0x5637('0x14')](_0x5637('0x37'),_0x528f39[_0x5637('0x15')]);_0x4eb3af({'error':_0x528f39['message']});});});}exports[_0x5637('0x38')]=function(_0x2f517f){var _0x44f054=this;return new Promise(function(_0x523dd7,_0x10a13c){return db[_0x5637('0x16')][_0x5637('0x36')](_0x2f517f[_0x5637('0x19')][_0x5637('0x39')],{'where':{'id':_0x2f517f['body']['id']}})[_0x5637('0xf')](function(_0x364d2f){_0x523dd7(_0x364d2f);})[_0x5637('0x2a')](function(_0x530b77){logger[_0x5637('0x14')]('IncrementPreviewCounters',_0x530b77[_0x5637('0x15')]);_0x10a13c(_0x44f054[_0x5637('0x14')](0x1f4,_0x530b77['message']));});});}; \ No newline at end of file +var _0x93d5=['catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','then','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countnosuchnumberretry','SwapAdditionalPhones','duration','waitTime','add','minutes','scheduledat','isNil','createdAt','updatedAt','phone','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','debug','request\x20sent','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','info'];(function(_0x44c30c,_0x508fd8){var _0xb179c7=function(_0x44e170){while(--_0x44e170){_0x44c30c['push'](_0x44c30c['shift']());}};_0xb179c7(++_0x508fd8);}(_0x93d5,0x93));var _0x593d=function(_0x55acdf,_0xaeff3f){_0x55acdf=_0x55acdf-0x0;var _0x3aa299=_0x93d5[_0x55acdf];return _0x3aa299;};'use strict';var _=require('lodash');var util=require(_0x593d('0x0'));var moment=require(_0x593d('0x1'));var BPromise=require(_0x593d('0x2'));var rs=require(_0x593d('0x3'));var fs=require('fs');var Redis=require(_0x593d('0x4'));var db=require(_0x593d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x593d('0x6'))(_0x593d('0x7'));var config=require('../../config/environment');var jayson=require(_0x593d('0x8'));var client=jayson[_0x593d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24c905,_0x1feb44,_0x2186b9){return new BPromise(function(_0x2d62a7,_0x554fe2){return client['request'](_0x24c905,_0x2186b9)['then'](function(_0x24b6f4){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1feb44,'request\x20sent');logger[_0x593d('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x1feb44,_0x593d('0xb'),JSON[_0x593d('0xc')](_0x24b6f4));if(_0x24b6f4[_0x593d('0xd')]){if(_0x24b6f4['error'][_0x593d('0xe')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1feb44,_0x24b6f4[_0x593d('0xd')][_0x593d('0xf')]);return _0x554fe2(_0x24b6f4[_0x593d('0xd')][_0x593d('0xf')]);}logger[_0x593d('0xd')](_0x593d('0x10'),_0x1feb44,_0x24b6f4[_0x593d('0xd')][_0x593d('0xf')]);return _0x2d62a7(_0x24b6f4[_0x593d('0xd')][_0x593d('0xf')]);}else{logger[_0x593d('0x11')](_0x593d('0x10'),_0x1feb44,_0x593d('0xb'));_0x2d62a7(_0x24b6f4['result'][_0x593d('0xf')]);}})[_0x593d('0x12')](function(_0x3a814e){logger[_0x593d('0xd')](_0x593d('0x10'),_0x1feb44,_0x3a814e);_0x554fe2(_0x3a814e);});});}exports[_0x593d('0x13')]=function(_0x357fab){var _0x176f0d=this;return new Promise(function(_0x294d16,_0x4a8601){return db[_0x593d('0x14')][_0x593d('0x15')]({'raw':!![],'where':{'ContactId':_0x357fab['body'][_0x593d('0x16')],'ListId':_0x357fab[_0x593d('0x17')][_0x593d('0x18')],'VoiceQueueId':_0x357fab[_0x593d('0x17')][_0x593d('0x19')]===undefined?null:_0x357fab[_0x593d('0x17')][_0x593d('0x19')],'CampaignId':_0x357fab['body'][_0x593d('0x1a')]===undefined?null:_0x357fab['body'][_0x593d('0x1a')]}})['then'](function(_0x4ed297){if(_0x4ed297!=null){return db[_0x593d('0x1b')][_0x593d('0x15')]({'raw':!![],'where':{'CmHopperId':_0x4ed297['id'],'OrderBy':{'$gt':_0x4ed297[_0x593d('0x1c')]}},'order':[['OrderBy',_0x593d('0x1d')]]})[_0x593d('0x1e')](function(_0xe21e59){var _0x297095=0x0;if(_0xe21e59){if(_0xe21e59[_0x593d('0x1f')]+_0xe21e59[_0x593d('0x20')]+_0xe21e59[_0x593d('0x21')]+_0xe21e59['countnosuchnumberretry']+_0xe21e59[_0x593d('0x22')]+_0xe21e59[_0x593d('0x23')]+_0xe21e59[_0x593d('0x24')]+_0xe21e59[_0x593d('0x25')]<_0x357fab['entity'][_0x593d('0x26')])_0x297095=0x1;_0x294d16({'additional':_0x297095});}else{return db[_0x593d('0x1b')][_0x593d('0x15')]({'raw':!![],'where':{'CmHopperId':_0x4ed297['id']},'order':[[_0x593d('0x1c'),_0x593d('0x1d')]]})[_0x593d('0x1e')](function(_0x285653){var _0x188f6a=0x0;if(_0x285653){if(_0x285653[_0x593d('0x1f')]+_0x285653[_0x593d('0x20')]+_0x285653[_0x593d('0x21')]+_0x285653[_0x593d('0x27')]+_0x285653[_0x593d('0x22')]+_0x285653[_0x593d('0x23')]+_0x285653[_0x593d('0x24')]+_0x285653[_0x593d('0x25')]<_0x357fab['entity'][_0x593d('0x26')])_0x188f6a=0x1;_0x294d16({'additional':_0x188f6a});}else{_0x294d16({'additional':0x0});}})[_0x593d('0x12')](function(_0x54682c){logger[_0x593d('0xd')](_0x593d('0x13'),_0x54682c['message']);_0x4a8601(_0x176f0d[_0x593d('0xd')](0x1f4,_0x54682c[_0x593d('0xf')]));});}})[_0x593d('0x12')](function(_0x54c1b9){logger['error'](_0x593d('0x13'),_0x54c1b9[_0x593d('0xf')]);_0x4a8601(_0x176f0d[_0x593d('0xd')](0x1f4,_0x54c1b9[_0x593d('0xf')]));});}else _0x294d16({'additional':0x0});});});};exports[_0x593d('0x28')]=function(_0x15dafc){var _0x595b85=this;return new Promise(function(_0x2f8681,_0x4ee78f){return db[_0x593d('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x15dafc[_0x593d('0x17')]['ContactId'],'ListId':_0x15dafc[_0x593d('0x17')][_0x593d('0x18')],'VoiceQueueId':_0x15dafc[_0x593d('0x17')][_0x593d('0x19')]===undefined?null:_0x15dafc[_0x593d('0x17')]['VoiceQueueId'],'CampaignId':_0x15dafc[_0x593d('0x17')][_0x593d('0x1a')]===undefined?null:_0x15dafc[_0x593d('0x17')][_0x593d('0x1a')]}})['then'](function(_0x4c0692){if(_0x4c0692!=null){return db['CmHopperAdditionalPhone'][_0x593d('0x15')]({'raw':!![],'where':{'CmHopperId':_0x4c0692['id'],'OrderBy':{'$gte':_0x4c0692[_0x593d('0x1c')]}},'order':[[_0x593d('0x1c'),_0x593d('0x1d')]]})[_0x593d('0x1e')](function(_0x4787c2){if(_0x4787c2)return activateAdditionalPhone(_0x4c0692,_0x15dafc[_0x593d('0x17')],_0x4787c2,_0x15dafc[_0x593d('0x29')],_0x15dafc[_0x593d('0x2a')])['then'](function(_0x1578e6){_0x2f8681(_0x1578e6);});else{return db[_0x593d('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4c0692['id']},'order':[[_0x593d('0x1c'),_0x593d('0x1d')]]})['then'](function(_0x10fb43){if(_0x10fb43)return activateAdditionalPhone(_0x4c0692,_0x15dafc[_0x593d('0x17')],_0x10fb43,_0x15dafc[_0x593d('0x29')],_0x15dafc[_0x593d('0x2a')])['then'](function(_0x511c0c){_0x2f8681(_0x511c0c);});else{_0x2f8681({'id':_0x4c0692['id'],'phone':''});}})['catch'](function(_0x486c0c){logger[_0x593d('0xd')](_0x593d('0x13'),_0x486c0c['message']);_0x4ee78f(_0x595b85['error'](0x1f4,_0x486c0c['message']));});}})[_0x593d('0x12')](function(_0xaf16d){logger[_0x593d('0xd')]('VerifyAdditionalPhones',_0xaf16d[_0x593d('0xf')]);_0x4ee78f(_0x595b85[_0x593d('0xd')](0x1f4,_0xaf16d[_0x593d('0xf')]));});}else _0x2f8681(0x1);});});};function activateAdditionalPhone(_0x1b244c,_0x3264d5,_0x3667ed,_0x2e1f6b,_0x3a9dd1){return new Promise(function(_0x1b12b5,_0xa23323){var _0x175b12;if(_['isNil'](_0x3667ed['scheduledat'])){_0x3667ed['scheduledat']=moment();}if(moment()>moment(_0x3667ed['scheduledat'])){_0x175b12=moment()[_0x593d('0x2b')](_0x3a9dd1||0x3,_0x593d('0x2c'));}else{if(_0x3667ed[_0x593d('0x1c')]==0x0){_0x175b12=moment(_0x3667ed[_0x593d('0x2d')]);}else{_0x175b12=moment()[_0x593d('0x2b')](_0x3a9dd1||0x3,_0x593d('0x2c'));}}if(_[_0x593d('0x2e')](_0x175b12)){_0x175b12=moment()['add'](_0x3a9dd1||0x3,_0x593d('0x2c'));}var _0x113108={'phone':_0x1b244c['phone'],'active':0x0,'OrderBy':_[_0x593d('0x2e')](_0x1b244c[_0x593d('0x1c')])?0x0:_0x1b244c[_0x593d('0x1c')],'scheduledat':moment()['add'](_0x2e1f6b||0x1,'minutes'),'countbusyretry':_0x3264d5[_0x593d('0x1f')],'countcongestionretry':_0x3264d5['countcongestionretry'],'countnoanswerretry':_0x3264d5['countnoanswerretry'],'countnosuchnumberretry':_0x3264d5[_0x593d('0x27')],'countdropretry':_0x3264d5[_0x593d('0x22')],'countabandonedretry':_0x3264d5['countabandonedretry'],'countmachineretry':_0x3264d5['countmachineretry'],'countagentrejectretry':_0x3264d5['countagentrejectretry'],'createdAt':_0x3264d5[_0x593d('0x2f')],'updatedAt':_0x3264d5[_0x593d('0x30')]};var _0x3b94ab={'CmHopperId':_0x1b244c['id'],'phone':_0x3667ed[_0x593d('0x31')],'active':0x0,'OrderBy':_[_0x593d('0x2e')](_0x3667ed[_0x593d('0x1c')])?0x0:_0x3667ed[_0x593d('0x1c')],'scheduledat':_0x175b12,'countbusyretry':_0x3667ed[_0x593d('0x1f')],'countcongestionretry':_0x3667ed['countcongestionretry'],'countnoanswerretry':_0x3667ed[_0x593d('0x21')],'countnosuchnumberretry':_0x3667ed[_0x593d('0x27')],'countdropretry':_0x3667ed['countdropretry'],'countabandonedretry':_0x3667ed[_0x593d('0x23')],'countmachineretry':_0x3667ed[_0x593d('0x24')],'countagentrejectretry':_0x3667ed[_0x593d('0x25')],'createdAt':_0x3667ed[_0x593d('0x2f')],'updatedAt':_0x3667ed[_0x593d('0x30')]};return db[_0x593d('0x32')][_0x593d('0x33')](function(_0x5986ec){return db[_0x593d('0x1b')][_0x593d('0x34')](_0x113108,{'where':{'id':_0x3667ed['id']}},{'transaction':_0x5986ec})[_0x593d('0x1e')](function(){return db[_0x593d('0x14')][_0x593d('0x34')](_0x3b94ab,{'where':{'id':_0x1b244c['id']}},{'transaction':_0x5986ec});});})[_0x593d('0x1e')](function(_0xa9cd83){_0x1b12b5({'id':_0x1b244c['id'],'phone':_0x3667ed[_0x593d('0x31')]});})[_0x593d('0x12')](function(_0x46c661){logger['error'](_0x593d('0x35'),_0x46c661[_0x593d('0xf')]);_0xa23323({'error':_0x46c661[_0x593d('0xf')]});});});}exports[_0x593d('0x36')]=function(_0x237d21){var _0x3bf403=this;return new Promise(function(_0x189f42,_0x335d6f){return db[_0x593d('0x14')][_0x593d('0x34')](_0x237d21[_0x593d('0x17')]['field'],{'where':{'id':_0x237d21[_0x593d('0x17')]['id']}})[_0x593d('0x1e')](function(_0x2add7f){_0x189f42(_0x2add7f);})[_0x593d('0x12')](function(_0x2c84a1){logger[_0x593d('0xd')](_0x593d('0x36'),_0x2c84a1[_0x593d('0xf')]);_0x335d6f(_0x3bf403[_0x593d('0xd')](0x1f4,_0x2c84a1['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 9fc32d3..fa4d6cf 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 _0xa6ea=['delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','get','/:id','show','post','create','put'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa6ea,0x1ce));var _0xaa6e=function(_0x564b11,_0x383e33){_0x564b11=_0x564b11-0x0;var _0x17a8dd=_0xa6ea[_0x564b11];return _0x17a8dd;};'use strict';var multer=require(_0xaa6e('0x0'));var util=require('util');var path=require(_0xaa6e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa6e('0x2')]();var fs_extra=require(_0xaa6e('0x3'));var auth=require(_0xaa6e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaa6e('0x5'));var controller=require(_0xaa6e('0x6'));router['get']('/',auth[_0xaa6e('0x7')](),controller['index']);router[_0xaa6e('0x8')](_0xaa6e('0x9'),auth['isAuthenticated'](),controller[_0xaa6e('0xa')]);router[_0xaa6e('0xb')]('/',auth['isAuthenticated'](),controller[_0xaa6e('0xc')]);router[_0xaa6e('0xd')](_0xaa6e('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xaa6e('0xe')](_0xaa6e('0x9'),auth[_0xaa6e('0x7')](),controller[_0xaa6e('0xf')]);module[_0xaa6e('0x10')]=router; \ No newline at end of file +var _0xa679=['put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa679,0x7d));var _0x9a67=function(_0x4db5ec,_0x16b140){_0x4db5ec=_0x4db5ec-0x0;var _0x218902=_0xa679[_0x4db5ec];return _0x218902;};'use strict';var multer=require('multer');var util=require(_0x9a67('0x0'));var path=require(_0x9a67('0x1'));var timeout=require(_0x9a67('0x2'));var express=require(_0x9a67('0x3'));var router=express[_0x9a67('0x4')]();var fs_extra=require(_0x9a67('0x5'));var auth=require(_0x9a67('0x6'));var interaction=require(_0x9a67('0x7'));var config=require('../../config/environment');var controller=require(_0x9a67('0x8'));router[_0x9a67('0x9')]('/',auth[_0x9a67('0xa')](),controller[_0x9a67('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9a67('0xc')]);router[_0x9a67('0xd')]('/',auth[_0x9a67('0xa')](),controller[_0x9a67('0xe')]);router[_0x9a67('0xf')](_0x9a67('0x10'),auth[_0x9a67('0xa')](),controller['update']);router[_0x9a67('0x11')]('/:id',auth[_0x9a67('0xa')](),controller[_0x9a67('0x12')]);module[_0x9a67('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index cececc3..41803f6 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 _0xef96=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x235ad6,_0x5e4437){var _0x2885d9=function(_0x3e55ba){while(--_0x3e55ba){_0x235ad6['push'](_0x235ad6['shift']());}};_0x2885d9(++_0x5e4437);}(_0xef96,0x162));var _0x6ef9=function(_0xf04ef0,_0x5cb940){_0xf04ef0=_0xf04ef0-0x0;var _0x474b0a=_0xef96[_0xf04ef0];return _0x474b0a;};'use strict';var moment=require(_0x6ef9('0x0'));var Sequelize=require(_0x6ef9('0x1'));module[_0x6ef9('0x2')]={'phone':{'type':Sequelize[_0x6ef9('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6ef9('0x4')],'unique':_0x6ef9('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x6ef9('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x1a0b=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x57142a,_0x443468){_0x57142a=_0x57142a-0x0;var _0xaf0c0c=_0x1a0b[_0x57142a];return _0xaf0c0c;};'use strict';var moment=require(_0xb1a0('0x0'));var Sequelize=require('sequelize');module[_0xb1a0('0x1')]={'phone':{'type':Sequelize[_0xb1a0('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb1a0('0x3')],'unique':_0xb1a0('0x4')},'ListId':{'type':Sequelize[_0xb1a0('0x3')],'unique':_0xb1a0('0x4')},'VoiceQueueId':{'type':Sequelize[_0xb1a0('0x3')],'unique':_0xb1a0('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index d326c5b..6a14dea 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 _0x7d0e=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','map','CmHopperBlack','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','describe','eml-format','zip-dir','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7d0e,0x1f2));var _0xe7d0=function(_0xfec0fe,_0x4c7308){_0xfec0fe=_0xfec0fe-0x0;var _0x381d42=_0x7d0e[_0xfec0fe];return _0x381d42;};'use strict';var emlformat=require(_0xe7d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe7d0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7d0('0x3'));var util=require('util');var path=require(_0xe7d0('0x4'));var sox=require('sox');var csv=require(_0xe7d0('0x5'));var ejs=require(_0xe7d0('0x6'));var fs=require('fs');var fs_extra=require(_0xe7d0('0x7'));var _=require(_0xe7d0('0x8'));var squel=require(_0xe7d0('0x9'));var crypto=require(_0xe7d0('0xa'));var jsforce=require(_0xe7d0('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe7d0('0xc'));var Redis=require(_0xe7d0('0xd'));var authService=require(_0xe7d0('0xe'));var qs=require(_0xe7d0('0xf'));var as=require(_0xe7d0('0x10'));var hardwareService=require(_0xe7d0('0x11'));var logger=require(_0xe7d0('0x12'))(_0xe7d0('0x13'));var utils=require(_0xe7d0('0x14'));var config=require(_0xe7d0('0x15'));var licenseUtil=require(_0xe7d0('0x16'));var db=require(_0xe7d0('0x17'))['db'];function respondWithStatusCode(_0x3c579f,_0x52a80f){_0x52a80f=_0x52a80f||0xcc;return function(_0x2fba9b){if(_0x2fba9b){return _0x3c579f['sendStatus'](_0x52a80f);}return _0x3c579f[_0xe7d0('0x18')](_0x52a80f)[_0xe7d0('0x19')]();};}function respondWithResult(_0x562205,_0x20d059){_0x20d059=_0x20d059||0xc8;return function(_0x2ec786){if(_0x2ec786){return _0x562205['status'](_0x20d059)[_0xe7d0('0x1a')](_0x2ec786);}};}function respondWithFilteredResult(_0xa0f800,_0x3cc8ce){return function(_0x30e84b){if(_0x30e84b){var _0x511eea=typeof _0x3cc8ce[_0xe7d0('0x1b')]===_0xe7d0('0x1c')&&typeof _0x3cc8ce['limit']===_0xe7d0('0x1c');var _0x5b5749=_0x30e84b[_0xe7d0('0x1d')];var _0x277259=_0x511eea?0x0:_0x3cc8ce[_0xe7d0('0x1b')];var _0x43597d=_0x511eea?_0x30e84b['count']:_0x3cc8ce[_0xe7d0('0x1b')]+_0x3cc8ce[_0xe7d0('0x1e')];var _0x3a8ddf;if(_0x43597d>=_0x5b5749){_0x43597d=_0x5b5749;_0x3a8ddf=0xc8;}else{_0x3a8ddf=0xce;}_0xa0f800[_0xe7d0('0x18')](_0x3a8ddf);return _0xa0f800[_0xe7d0('0x1f')](_0xe7d0('0x20'),_0x277259+'-'+_0x43597d+'/'+_0x5b5749)[_0xe7d0('0x1a')](_0x30e84b);}return null;};}function patchUpdates(_0x35621a){return function(_0x62b102){try{jsonpatch[_0xe7d0('0x21')](_0x62b102,_0x35621a,!![]);}catch(_0x4e8b9e){return BPromise['reject'](_0x4e8b9e);}return _0x62b102[_0xe7d0('0x22')]();};}function saveUpdates(_0x32d9af,_0x1d82cf){return function(_0x36d42e){if(_0x36d42e){return _0x36d42e['update'](_0x32d9af)['then'](function(_0x130652){return _0x130652;});}return null;};}function removeEntity(_0x52fb35,_0x2b31e4){return function(_0x1bd6db){if(_0x1bd6db){return _0x1bd6db[_0xe7d0('0x23')]()[_0xe7d0('0x24')](function(){_0x52fb35[_0xe7d0('0x18')](0xcc)[_0xe7d0('0x19')]();});}};}function handleEntityNotFound(_0x266c9c,_0x3e95f5){return function(_0x1ef236){if(!_0x1ef236){_0x266c9c[_0xe7d0('0x25')](0x194);}return _0x1ef236;};}function handleError(_0x46f8da,_0x20ad8a){_0x20ad8a=_0x20ad8a||0x1f4;return function(_0x2c2a26){logger[_0xe7d0('0x26')](_0x2c2a26[_0xe7d0('0x27')]);if(_0x2c2a26[_0xe7d0('0x28')]){delete _0x2c2a26[_0xe7d0('0x28')];}_0x46f8da[_0xe7d0('0x18')](_0x20ad8a)['send'](_0x2c2a26);};}exports['index']=function(_0x103e78,_0x3a2b90){var _0x27a8f8={},_0x252bb6={},_0x3e8edb={'count':0x0,'rows':[]};var _0x43e35e=_[_0xe7d0('0x29')](db[_0xe7d0('0x2a')]['rawAttributes'],function(_0x58402e){return{'name':_0x58402e[_0xe7d0('0x2b')],'type':_0x58402e[_0xe7d0('0x2c')]['key']};});_0x252bb6[_0xe7d0('0x2d')]=_[_0xe7d0('0x29')](_0x43e35e,_0xe7d0('0x28'));_0x252bb6[_0xe7d0('0x2e')]=_[_0xe7d0('0x2f')](_0x103e78[_0xe7d0('0x2e')]);_0x252bb6['filters']=_[_0xe7d0('0x30')](_0x252bb6[_0xe7d0('0x2d')],_0x252bb6['query']);_0x27a8f8[_0xe7d0('0x31')]=_[_0xe7d0('0x30')](_0x252bb6['model'],qs['fields'](_0x103e78[_0xe7d0('0x2e')][_0xe7d0('0x32')]));_0x27a8f8[_0xe7d0('0x31')]=_0x27a8f8[_0xe7d0('0x31')][_0xe7d0('0x33')]?_0x27a8f8['attributes']:_0x252bb6[_0xe7d0('0x2d')];if(!_0x103e78[_0xe7d0('0x2e')][_0xe7d0('0x34')](_0xe7d0('0x35'))){_0x27a8f8[_0xe7d0('0x1e')]=qs[_0xe7d0('0x1e')](_0x103e78[_0xe7d0('0x2e')]['limit']);_0x27a8f8[_0xe7d0('0x1b')]=qs[_0xe7d0('0x1b')](_0x103e78[_0xe7d0('0x2e')][_0xe7d0('0x1b')]);}_0x27a8f8[_0xe7d0('0x36')]=qs['sort'](_0x103e78[_0xe7d0('0x2e')][_0xe7d0('0x37')]);_0x27a8f8['where']=qs[_0xe7d0('0x38')](_[_0xe7d0('0x39')](_0x103e78[_0xe7d0('0x2e')],_0x252bb6['filters']),_0x43e35e);if(_0x103e78[_0xe7d0('0x2e')][_0xe7d0('0x3a')]){_0x27a8f8[_0xe7d0('0x3b')]=_[_0xe7d0('0x3c')](_0x27a8f8[_0xe7d0('0x3b')],{'$or':_[_0xe7d0('0x29')](_0x43e35e,function(_0x480132){if(_0x480132[_0xe7d0('0x2c')]!==_0xe7d0('0x3d')){var _0x1e2f5d={};_0x1e2f5d[_0x480132[_0xe7d0('0x28')]]={'$like':'%'+_0x103e78[_0xe7d0('0x2e')]['filter']+'%'};return _0x1e2f5d;}})});}_0x27a8f8=_[_0xe7d0('0x3c')]({},_0x27a8f8,_0x103e78[_0xe7d0('0x3e')]);var _0x2508cb={'where':_0x27a8f8['where']};return db[_0xe7d0('0x2a')][_0xe7d0('0x1d')](_0x2508cb)[_0xe7d0('0x24')](function(_0x341bc3){_0x3e8edb[_0xe7d0('0x1d')]=_0x341bc3;if(_0x103e78[_0xe7d0('0x2e')][_0xe7d0('0x3f')]){_0x27a8f8[_0xe7d0('0x40')]=[{'all':!![]}];}return db[_0xe7d0('0x2a')][_0xe7d0('0x41')](_0x27a8f8);})[_0xe7d0('0x24')](function(_0x330cb0){_0x3e8edb[_0xe7d0('0x42')]=_0x330cb0;return _0x3e8edb;})[_0xe7d0('0x24')](respondWithFilteredResult(_0x3a2b90,_0x27a8f8))[_0xe7d0('0x43')](handleError(_0x3a2b90,null));};exports[_0xe7d0('0x44')]=function(_0x5484c9,_0x794a39){var _0x5ce5e9={'raw':!![],'where':{'id':_0x5484c9[_0xe7d0('0x45')]['id']}},_0x55e7fa={};_0x55e7fa[_0xe7d0('0x2d')]=_[_0xe7d0('0x2f')](db['CmHopperBlack']['rawAttributes']);_0x55e7fa[_0xe7d0('0x2e')]=_[_0xe7d0('0x2f')](_0x5484c9[_0xe7d0('0x2e')]);_0x55e7fa['filters']=_[_0xe7d0('0x30')](_0x55e7fa[_0xe7d0('0x2d')],_0x55e7fa[_0xe7d0('0x2e')]);_0x5ce5e9[_0xe7d0('0x31')]=_[_0xe7d0('0x30')](_0x55e7fa['model'],qs[_0xe7d0('0x32')](_0x5484c9[_0xe7d0('0x2e')][_0xe7d0('0x32')]));_0x5ce5e9['attributes']=_0x5ce5e9[_0xe7d0('0x31')][_0xe7d0('0x33')]?_0x5ce5e9['attributes']:_0x55e7fa[_0xe7d0('0x2d')];if(_0x5484c9['query']['includeAll']){_0x5ce5e9['include']=[{'all':!![]}];}_0x5ce5e9=_['merge']({},_0x5ce5e9,_0x5484c9['options']);return db['CmHopperBlack'][_0xe7d0('0x46')](_0x5ce5e9)[_0xe7d0('0x24')](handleEntityNotFound(_0x794a39,null))['then'](respondWithResult(_0x794a39,null))[_0xe7d0('0x43')](handleError(_0x794a39,null));};exports[_0xe7d0('0x47')]=function(_0x1518e7,_0x3608d1){if(_0x1518e7[_0xe7d0('0x48')]['id']){delete _0x1518e7[_0xe7d0('0x48')]['id'];}return db[_0xe7d0('0x2a')][_0xe7d0('0x46')]({'where':{'id':_0x1518e7[_0xe7d0('0x45')]['id']}})[_0xe7d0('0x24')](handleEntityNotFound(_0x3608d1,null))[_0xe7d0('0x24')](saveUpdates(_0x1518e7[_0xe7d0('0x48')],null))['then'](respondWithResult(_0x3608d1,null))[_0xe7d0('0x43')](handleError(_0x3608d1,null));};exports[_0xe7d0('0x23')]=function(_0x276817,_0x3feda1){return db['CmHopperBlack'][_0xe7d0('0x46')]({'where':{'id':_0x276817[_0xe7d0('0x45')]['id']}})['then'](handleEntityNotFound(_0x3feda1,null))[_0xe7d0('0x24')](removeEntity(_0x3feda1,null))[_0xe7d0('0x43')](handleError(_0x3feda1,null));};exports[_0xe7d0('0x49')]=function(_0x1b0ab4,_0x4f539c){return db[_0xe7d0('0x2a')][_0xe7d0('0x49')]()[_0xe7d0('0x24')](respondWithResult(_0x4f539c,null))[_0xe7d0('0x43')](handleError(_0x4f539c,null));}; \ No newline at end of file +var _0x0758=['params','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','CmHopperBlack','rawAttributes','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','includeAll','include','rows','catch','show'];(function(_0x3fd2f2,_0x21fbb9){var _0x64a36=function(_0x13b612){while(--_0x13b612){_0x3fd2f2['push'](_0x3fd2f2['shift']());}};_0x64a36(++_0x21fbb9);}(_0x0758,0x93));var _0x8075=function(_0x2027d9,_0x362594){_0x2027d9=_0x2027d9-0x0;var _0x1ca4ff=_0x0758[_0x2027d9];return _0x1ca4ff;};'use strict';var emlformat=require(_0x8075('0x0'));var rimraf=require(_0x8075('0x1'));var zipdir=require(_0x8075('0x2'));var jsonpatch=require(_0x8075('0x3'));var rp=require(_0x8075('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8075('0x5'));var util=require('util');var path=require(_0x8075('0x6'));var sox=require(_0x8075('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8075('0x8'));var crypto=require(_0x8075('0x9'));var jsforce=require(_0x8075('0xa'));var deskjs=require(_0x8075('0xb'));var toCsv=require(_0x8075('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8075('0xd'));var qs=require(_0x8075('0xe'));var as=require(_0x8075('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8075('0x10'))(_0x8075('0x11'));var utils=require(_0x8075('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8075('0x13'));var db=require(_0x8075('0x14'))['db'];function respondWithStatusCode(_0x93e953,_0x28391e){_0x28391e=_0x28391e||0xcc;return function(_0x3fe510){if(_0x3fe510){return _0x93e953[_0x8075('0x15')](_0x28391e);}return _0x93e953[_0x8075('0x16')](_0x28391e)[_0x8075('0x17')]();};}function respondWithResult(_0x3bc7af,_0x254039){_0x254039=_0x254039||0xc8;return function(_0x3469ef){if(_0x3469ef){return _0x3bc7af['status'](_0x254039)[_0x8075('0x18')](_0x3469ef);}};}function respondWithFilteredResult(_0x2714c0,_0x59e4c6){return function(_0x4724bd){if(_0x4724bd){var _0x2dbf6e=typeof _0x59e4c6[_0x8075('0x19')]===_0x8075('0x1a')&&typeof _0x59e4c6['limit']===_0x8075('0x1a');var _0x451fcd=_0x4724bd[_0x8075('0x1b')];var _0x3be61e=_0x2dbf6e?0x0:_0x59e4c6['offset'];var _0x31f072=_0x2dbf6e?_0x4724bd[_0x8075('0x1b')]:_0x59e4c6[_0x8075('0x19')]+_0x59e4c6[_0x8075('0x1c')];var _0x40600d;if(_0x31f072>=_0x451fcd){_0x31f072=_0x451fcd;_0x40600d=0xc8;}else{_0x40600d=0xce;}_0x2714c0['status'](_0x40600d);return _0x2714c0[_0x8075('0x1d')](_0x8075('0x1e'),_0x3be61e+'-'+_0x31f072+'/'+_0x451fcd)[_0x8075('0x18')](_0x4724bd);}return null;};}function patchUpdates(_0x54cae3){return function(_0x561ed9){try{jsonpatch[_0x8075('0x1f')](_0x561ed9,_0x54cae3,!![]);}catch(_0x3fbe26){return BPromise[_0x8075('0x20')](_0x3fbe26);}return _0x561ed9[_0x8075('0x21')]();};}function saveUpdates(_0x176ce0,_0x2a9e18){return function(_0xb2117c){if(_0xb2117c){return _0xb2117c[_0x8075('0x22')](_0x176ce0)[_0x8075('0x23')](function(_0x8a233c){return _0x8a233c;});}return null;};}function removeEntity(_0x38b91f,_0x582720){return function(_0x2d303d){if(_0x2d303d){return _0x2d303d[_0x8075('0x24')]()[_0x8075('0x23')](function(){_0x38b91f[_0x8075('0x16')](0xcc)[_0x8075('0x17')]();});}};}function handleEntityNotFound(_0x5134c1,_0x5f01ec){return function(_0x640067){if(!_0x640067){_0x5134c1['sendStatus'](0x194);}return _0x640067;};}function handleError(_0x2bb1ff,_0x4a1d51){_0x4a1d51=_0x4a1d51||0x1f4;return function(_0x5294ed){logger[_0x8075('0x25')](_0x5294ed[_0x8075('0x26')]);if(_0x5294ed['name']){delete _0x5294ed['name'];}_0x2bb1ff[_0x8075('0x16')](_0x4a1d51)['send'](_0x5294ed);};}exports[_0x8075('0x27')]=function(_0x5a13a6,_0x24090a){var _0x2010f5={},_0x5122ec={},_0x1054a4={'count':0x0,'rows':[]};var _0x31fb4b=_['map'](db[_0x8075('0x28')][_0x8075('0x29')],function(_0xc14fa1){return{'name':_0xc14fa1['fieldName'],'type':_0xc14fa1[_0x8075('0x2a')][_0x8075('0x2b')]};});_0x5122ec[_0x8075('0x2c')]=_['map'](_0x31fb4b,_0x8075('0x2d'));_0x5122ec[_0x8075('0x2e')]=_[_0x8075('0x2f')](_0x5a13a6[_0x8075('0x2e')]);_0x5122ec[_0x8075('0x30')]=_[_0x8075('0x31')](_0x5122ec[_0x8075('0x2c')],_0x5122ec[_0x8075('0x2e')]);_0x2010f5['attributes']=_[_0x8075('0x31')](_0x5122ec[_0x8075('0x2c')],qs[_0x8075('0x32')](_0x5a13a6[_0x8075('0x2e')]['fields']));_0x2010f5[_0x8075('0x33')]=_0x2010f5[_0x8075('0x33')][_0x8075('0x34')]?_0x2010f5[_0x8075('0x33')]:_0x5122ec[_0x8075('0x2c')];if(!_0x5a13a6[_0x8075('0x2e')][_0x8075('0x35')](_0x8075('0x36'))){_0x2010f5[_0x8075('0x1c')]=qs['limit'](_0x5a13a6[_0x8075('0x2e')][_0x8075('0x1c')]);_0x2010f5[_0x8075('0x19')]=qs['offset'](_0x5a13a6['query'][_0x8075('0x19')]);}_0x2010f5['order']=qs['sort'](_0x5a13a6[_0x8075('0x2e')][_0x8075('0x37')]);_0x2010f5[_0x8075('0x38')]=qs[_0x8075('0x30')](_['pick'](_0x5a13a6[_0x8075('0x2e')],_0x5122ec[_0x8075('0x30')]),_0x31fb4b);if(_0x5a13a6[_0x8075('0x2e')][_0x8075('0x39')]){_0x2010f5['where']=_[_0x8075('0x3a')](_0x2010f5[_0x8075('0x38')],{'$or':_[_0x8075('0x3b')](_0x31fb4b,function(_0x14af53){if(_0x14af53[_0x8075('0x2a')]!==_0x8075('0x3c')){var _0x14b7ef={};_0x14b7ef[_0x14af53[_0x8075('0x2d')]]={'$like':'%'+_0x5a13a6[_0x8075('0x2e')][_0x8075('0x39')]+'%'};return _0x14b7ef;}})});}_0x2010f5=_[_0x8075('0x3a')]({},_0x2010f5,_0x5a13a6['options']);var _0x7d9d04={'where':_0x2010f5[_0x8075('0x38')]};return db[_0x8075('0x28')][_0x8075('0x1b')](_0x7d9d04)[_0x8075('0x23')](function(_0x98d4fa){_0x1054a4[_0x8075('0x1b')]=_0x98d4fa;if(_0x5a13a6[_0x8075('0x2e')][_0x8075('0x3d')]){_0x2010f5[_0x8075('0x3e')]=[{'all':!![]}];}return db[_0x8075('0x28')]['findAll'](_0x2010f5);})['then'](function(_0x59172b){_0x1054a4[_0x8075('0x3f')]=_0x59172b;return _0x1054a4;})[_0x8075('0x23')](respondWithFilteredResult(_0x24090a,_0x2010f5))[_0x8075('0x40')](handleError(_0x24090a,null));};exports[_0x8075('0x41')]=function(_0x5e136e,_0x3426e5){var _0x298e88={'raw':!![],'where':{'id':_0x5e136e[_0x8075('0x42')]['id']}},_0x3aa515={};_0x3aa515['model']=_[_0x8075('0x2f')](db[_0x8075('0x28')]['rawAttributes']);_0x3aa515[_0x8075('0x2e')]=_[_0x8075('0x2f')](_0x5e136e[_0x8075('0x2e')]);_0x3aa515[_0x8075('0x30')]=_[_0x8075('0x31')](_0x3aa515[_0x8075('0x2c')],_0x3aa515[_0x8075('0x2e')]);_0x298e88[_0x8075('0x33')]=_[_0x8075('0x31')](_0x3aa515['model'],qs[_0x8075('0x32')](_0x5e136e['query'][_0x8075('0x32')]));_0x298e88[_0x8075('0x33')]=_0x298e88['attributes'][_0x8075('0x34')]?_0x298e88['attributes']:_0x3aa515['model'];if(_0x5e136e['query']['includeAll']){_0x298e88[_0x8075('0x3e')]=[{'all':!![]}];}_0x298e88=_[_0x8075('0x3a')]({},_0x298e88,_0x5e136e[_0x8075('0x43')]);return db[_0x8075('0x28')][_0x8075('0x44')](_0x298e88)[_0x8075('0x23')](handleEntityNotFound(_0x3426e5,null))[_0x8075('0x23')](respondWithResult(_0x3426e5,null))['catch'](handleError(_0x3426e5,null));};exports[_0x8075('0x22')]=function(_0x2adf50,_0x45130b){if(_0x2adf50[_0x8075('0x45')]['id']){delete _0x2adf50[_0x8075('0x45')]['id'];}return db[_0x8075('0x28')][_0x8075('0x44')]({'where':{'id':_0x2adf50[_0x8075('0x42')]['id']}})[_0x8075('0x23')](handleEntityNotFound(_0x45130b,null))[_0x8075('0x23')](saveUpdates(_0x2adf50['body'],null))[_0x8075('0x23')](respondWithResult(_0x45130b,null))['catch'](handleError(_0x45130b,null));};exports[_0x8075('0x24')]=function(_0xe46f0b,_0x2ff59c){return db['CmHopperBlack'][_0x8075('0x44')]({'where':{'id':_0xe46f0b[_0x8075('0x42')]['id']}})[_0x8075('0x23')](handleEntityNotFound(_0x2ff59c,null))[_0x8075('0x23')](removeEntity(_0x2ff59c,null))[_0x8075('0x40')](handleError(_0x2ff59c,null));};exports[_0x8075('0x46')]=function(_0x3e2fb2,_0x25eea9){return db[_0x8075('0x28')]['describe']()[_0x8075('0x23')](respondWithResult(_0x25eea9,null))[_0x8075('0x40')](handleError(_0x25eea9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 06be07f..1396125 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 _0x802e=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2582af,_0x3409f7){var _0x38c9c6=function(_0x2695e4){while(--_0x2695e4){_0x2582af['push'](_0x2582af['shift']());}};_0x38c9c6(++_0x3409f7);}(_0x802e,0x1e5));var _0xe802=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x802e[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require(_0xe802('0x0'));var logger=require(_0xe802('0x1'))(_0xe802('0x2'));var moment=require(_0xe802('0x3'));var BPromise=require(_0xe802('0x4'));var rp=require(_0xe802('0x5'));var fs=require('fs');var path=require(_0xe802('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe802('0x7'));module[_0xe802('0x8')]=function(_0x39570b,_0x57a27a){return _0x39570b[_0xe802('0x9')](_0xe802('0xa'),attributes,{'tableName':_0xe802('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4106=['path','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x38271e,_0x900983){var _0x43ef=function(_0x558006){while(--_0x558006){_0x38271e['push'](_0x38271e['shift']());}};_0x43ef(++_0x900983);}(_0x4106,0x158));var _0x6410=function(_0xe3b946,_0x448908){_0xe3b946=_0xe3b946-0x0;var _0x30dc2d=_0x4106[_0xe3b946];return _0x30dc2d;};'use strict';var _=require(_0x6410('0x0'));var util=require(_0x6410('0x1'));var logger=require(_0x6410('0x2'))(_0x6410('0x3'));var moment=require(_0x6410('0x4'));var BPromise=require(_0x6410('0x5'));var rp=require(_0x6410('0x6'));var fs=require('fs');var path=require(_0x6410('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6410('0x8'));module[_0x6410('0x9')]=function(_0xfbdac,_0x32e94e){return _0xfbdac[_0x6410('0xa')](_0x6410('0xb'),attributes,{'tableName':_0x6410('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 2306914..8dd15a3 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 _0x38cf=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','map','include','model','CmHopperBlack','body','UpdateCmHopperBlack','debug','DestroyCmHopperBlack','destroy','lodash','util','moment'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x38cf,0xa7));var _0xf38c=function(_0x2ee152,_0x3f253b){_0x2ee152=_0x2ee152-0x0;var _0x2ee170=_0x38cf[_0x2ee152];return _0x2ee170;};'use strict';var _=require(_0xf38c('0x0'));var util=require(_0xf38c('0x1'));var moment=require(_0xf38c('0x2'));var BPromise=require('bluebird');var rs=require(_0xf38c('0x3'));var fs=require('fs');var Redis=require(_0xf38c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf38c('0x5'))(_0xf38c('0x6'));var config=require('../../config/environment');var jayson=require(_0xf38c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16ac7a,_0x153017,_0x38cb83){return new BPromise(function(_0x348e15,_0x20377a){return client['request'](_0x16ac7a,_0x38cb83)[_0xf38c('0x8')](function(_0x495f85){logger['info'](_0xf38c('0x9'),_0x153017,_0xf38c('0xa'));logger['debug'](_0xf38c('0xb'),_0x153017,_0xf38c('0xa'),JSON[_0xf38c('0xc')](_0x495f85));if(_0x495f85['error']){if(_0x495f85[_0xf38c('0xd')]['code']===0x1f4){logger['error'](_0xf38c('0x9'),_0x153017,_0x495f85[_0xf38c('0xd')][_0xf38c('0xe')]);return _0x20377a(_0x495f85[_0xf38c('0xd')]['message']);}logger[_0xf38c('0xd')](_0xf38c('0x9'),_0x153017,_0x495f85['error'][_0xf38c('0xe')]);return _0x348e15(_0x495f85[_0xf38c('0xd')]['message']);}else{logger[_0xf38c('0xf')](_0xf38c('0x9'),_0x153017,_0xf38c('0xa'));_0x348e15(_0x495f85[_0xf38c('0x10')]['message']);}})[_0xf38c('0x11')](function(_0x299bb2){logger[_0xf38c('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x153017,_0x299bb2);_0x20377a(_0x299bb2);});});}exports[_0xf38c('0x12')]=function(_0x17c69c){var _0x4089c4=this;return new Promise(function(_0x5b7645,_0x1f95ae){return db['CmHopperBlack'][_0xf38c('0x13')]({'raw':_0x17c69c[_0xf38c('0x14')]?_0x17c69c[_0xf38c('0x14')][_0xf38c('0x15')]===undefined?!![]:![]:!![],'where':_0x17c69c[_0xf38c('0x14')]?_0x17c69c[_0xf38c('0x14')][_0xf38c('0x16')]||null:null,'attributes':_0x17c69c[_0xf38c('0x14')]?_0x17c69c[_0xf38c('0x14')][_0xf38c('0x17')]||null:null,'limit':_0x17c69c[_0xf38c('0x14')]?_0x17c69c[_0xf38c('0x14')][_0xf38c('0x18')]||null:null,'include':_0x17c69c['options']?_0x17c69c[_0xf38c('0x14')]['include']?_[_0xf38c('0x19')](_0x17c69c[_0xf38c('0x14')][_0xf38c('0x1a')],function(_0x1008fe){return{'model':db[_0x1008fe[_0xf38c('0x1b')]],'as':_0x1008fe['as'],'attributes':_0x1008fe[_0xf38c('0x17')],'include':_0x1008fe[_0xf38c('0x1a')]?_[_0xf38c('0x19')](_0x1008fe[_0xf38c('0x1a')],function(_0x4df5b4){return{'model':db[_0x4df5b4[_0xf38c('0x1b')]],'as':_0x4df5b4['as'],'attributes':_0x4df5b4[_0xf38c('0x17')],'include':_0x4df5b4[_0xf38c('0x1a')]?_[_0xf38c('0x19')](_0x4df5b4[_0xf38c('0x1a')],function(_0x44fa9b){return{'model':db[_0x44fa9b[_0xf38c('0x1b')]],'as':_0x44fa9b['as'],'attributes':_0x44fa9b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb1e053){logger[_0xf38c('0xf')](_0xf38c('0x12'),_0x17c69c);logger['debug'](_0xf38c('0x12'),_0x17c69c,JSON[_0xf38c('0xc')](_0xb1e053));_0x5b7645(_0xb1e053);})['catch'](function(_0x4dc119){logger['error'](_0xf38c('0x12'),_0x4dc119['message'],_0x17c69c);_0x1f95ae(_0x4089c4[_0xf38c('0xd')](0x1f4,_0x4dc119[_0xf38c('0xe')]));});});};exports['UpdateCmHopperBlack']=function(_0x2c5624){var _0x3a8931=this;return new Promise(function(_0x2adde8,_0x4181d7){return db[_0xf38c('0x1c')]['update'](_0x2c5624[_0xf38c('0x1d')],{'raw':_0x2c5624[_0xf38c('0x14')]?_0x2c5624[_0xf38c('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c5624[_0xf38c('0x14')]?_0x2c5624[_0xf38c('0x14')][_0xf38c('0x16')]||null:null,'attributes':_0x2c5624[_0xf38c('0x14')]?_0x2c5624[_0xf38c('0x14')][_0xf38c('0x17')]||null:null,'limit':_0x2c5624[_0xf38c('0x14')]?_0x2c5624[_0xf38c('0x14')][_0xf38c('0x18')]||null:null})[_0xf38c('0x8')](function(_0x417036){logger['info'](_0xf38c('0x1e'),_0x2c5624);logger[_0xf38c('0x1f')]('UpdateCmHopperBlack',_0x2c5624,JSON['stringify'](_0x417036));_0x2adde8(_0x417036);})[_0xf38c('0x11')](function(_0x5599a3){logger[_0xf38c('0xd')](_0xf38c('0x1e'),_0x5599a3[_0xf38c('0xe')],_0x2c5624);_0x4181d7(_0x3a8931[_0xf38c('0xd')](0x1f4,_0x5599a3[_0xf38c('0xe')]));});});};exports[_0xf38c('0x20')]=function(_0x939244){var _0x4a2d55=this;return new Promise(function(_0x51c36d,_0x6c50ff){return db[_0xf38c('0x1c')][_0xf38c('0x21')]({'where':_0x939244['options']?_0x939244[_0xf38c('0x14')][_0xf38c('0x16')]||null:null})[_0xf38c('0x8')](function(_0x1e484c){logger[_0xf38c('0xf')](_0xf38c('0x20'),_0x939244);logger[_0xf38c('0x1f')]('DestroyCmHopperBlack',_0x939244,JSON['stringify'](_0x1e484c));_0x51c36d(_0x1e484c);})[_0xf38c('0x11')](function(_0x9a664a){logger[_0xf38c('0xd')](_0xf38c('0x20'),_0x9a664a[_0xf38c('0xe')],_0x939244);_0x6c50ff(_0x4a2d55['error'](0x1f4,_0x9a664a[_0xf38c('0xe')]));});});}; \ No newline at end of file +var _0x1612=['CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0x1612,0x14a));var _0x2161=function(_0x4276f0,_0x470625){_0x4276f0=_0x4276f0-0x0;var _0x27e490=_0x1612[_0x4276f0];return _0x27e490;};'use strict';var _=require(_0x2161('0x0'));var util=require('util');var moment=require(_0x2161('0x1'));var BPromise=require(_0x2161('0x2'));var rs=require(_0x2161('0x3'));var fs=require('fs');var Redis=require(_0x2161('0x4'));var db=require(_0x2161('0x5'))['db'];var utils=require(_0x2161('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2161('0x7'));var jayson=require(_0x2161('0x8'));var client=jayson[_0x2161('0x9')][_0x2161('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a477f,_0x532871,_0x47f145){return new BPromise(function(_0x36fcba,_0x5d7295){return client['request'](_0x3a477f,_0x47f145)[_0x2161('0xb')](function(_0x38d734){logger['info'](_0x2161('0xc'),_0x532871,_0x2161('0xd'));logger[_0x2161('0xe')](_0x2161('0xf'),_0x532871,_0x2161('0xd'),JSON[_0x2161('0x10')](_0x38d734));if(_0x38d734[_0x2161('0x11')]){if(_0x38d734[_0x2161('0x11')][_0x2161('0x12')]===0x1f4){logger[_0x2161('0x11')](_0x2161('0xc'),_0x532871,_0x38d734[_0x2161('0x11')][_0x2161('0x13')]);return _0x5d7295(_0x38d734[_0x2161('0x11')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x532871,_0x38d734[_0x2161('0x11')]['message']);return _0x36fcba(_0x38d734[_0x2161('0x11')][_0x2161('0x13')]);}else{logger[_0x2161('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x532871,_0x2161('0xd'));_0x36fcba(_0x38d734[_0x2161('0x15')][_0x2161('0x13')]);}})[_0x2161('0x16')](function(_0x584a9d){logger[_0x2161('0x11')](_0x2161('0xc'),_0x532871,_0x584a9d);_0x5d7295(_0x584a9d);});});}exports[_0x2161('0x17')]=function(_0x3f2638){var _0xc8c6bc=this;return new Promise(function(_0x4fa1f9,_0x266131){return db[_0x2161('0x18')][_0x2161('0x19')]({'raw':_0x3f2638['options']?_0x3f2638['options'][_0x2161('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f2638[_0x2161('0x1b')]?_0x3f2638[_0x2161('0x1b')][_0x2161('0x1c')]||null:null,'attributes':_0x3f2638['options']?_0x3f2638[_0x2161('0x1b')][_0x2161('0x1d')]||null:null,'limit':_0x3f2638[_0x2161('0x1b')]?_0x3f2638['options'][_0x2161('0x1e')]||null:null,'include':_0x3f2638[_0x2161('0x1b')]?_0x3f2638[_0x2161('0x1b')][_0x2161('0x1f')]?_[_0x2161('0x20')](_0x3f2638['options'][_0x2161('0x1f')],function(_0x434fd3){return{'model':db[_0x434fd3[_0x2161('0x21')]],'as':_0x434fd3['as'],'attributes':_0x434fd3[_0x2161('0x1d')],'include':_0x434fd3[_0x2161('0x1f')]?_[_0x2161('0x20')](_0x434fd3[_0x2161('0x1f')],function(_0x1deedb){return{'model':db[_0x1deedb[_0x2161('0x21')]],'as':_0x1deedb['as'],'attributes':_0x1deedb['attributes'],'include':_0x1deedb[_0x2161('0x1f')]?_[_0x2161('0x20')](_0x1deedb[_0x2161('0x1f')],function(_0x15ebba){return{'model':db[_0x15ebba[_0x2161('0x21')]],'as':_0x15ebba['as'],'attributes':_0x15ebba[_0x2161('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2161('0xb')](function(_0x1b4089){logger[_0x2161('0x14')](_0x2161('0x17'),_0x3f2638);logger[_0x2161('0xe')](_0x2161('0x17'),_0x3f2638,JSON['stringify'](_0x1b4089));_0x4fa1f9(_0x1b4089);})[_0x2161('0x16')](function(_0x3121e0){logger[_0x2161('0x11')](_0x2161('0x17'),_0x3121e0[_0x2161('0x13')],_0x3f2638);_0x266131(_0xc8c6bc[_0x2161('0x11')](0x1f4,_0x3121e0[_0x2161('0x13')]));});});};exports[_0x2161('0x22')]=function(_0x5f43dc){var _0xe9a633=this;return new Promise(function(_0x583573,_0x537262){return db[_0x2161('0x18')][_0x2161('0x23')](_0x5f43dc[_0x2161('0x24')],{'raw':_0x5f43dc[_0x2161('0x1b')]?_0x5f43dc[_0x2161('0x1b')][_0x2161('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f43dc['options']?_0x5f43dc[_0x2161('0x1b')]['where']||null:null,'attributes':_0x5f43dc[_0x2161('0x1b')]?_0x5f43dc[_0x2161('0x1b')]['attributes']||null:null,'limit':_0x5f43dc[_0x2161('0x1b')]?_0x5f43dc[_0x2161('0x1b')]['limit']||null:null})[_0x2161('0xb')](function(_0x46fc7f){logger['info']('UpdateCmHopperBlack',_0x5f43dc);logger[_0x2161('0xe')](_0x2161('0x22'),_0x5f43dc,JSON[_0x2161('0x10')](_0x46fc7f));_0x583573(_0x46fc7f);})[_0x2161('0x16')](function(_0x220109){logger[_0x2161('0x11')](_0x2161('0x22'),_0x220109[_0x2161('0x13')],_0x5f43dc);_0x537262(_0xe9a633[_0x2161('0x11')](0x1f4,_0x220109[_0x2161('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0xc1f9d4){var _0x6718ef=this;return new Promise(function(_0x19792b,_0x469ee9){return db[_0x2161('0x18')]['destroy']({'where':_0xc1f9d4[_0x2161('0x1b')]?_0xc1f9d4[_0x2161('0x1b')]['where']||null:null})[_0x2161('0xb')](function(_0x5b55c0){logger[_0x2161('0x14')](_0x2161('0x25'),_0xc1f9d4);logger[_0x2161('0xe')](_0x2161('0x25'),_0xc1f9d4,JSON[_0x2161('0x10')](_0x5b55c0));_0x19792b(_0x5b55c0);})[_0x2161('0x16')](function(_0x702c23){logger['error'](_0x2161('0x25'),_0x702c23['message'],_0xc1f9d4);_0x469ee9(_0x6718ef[_0x2161('0x11')](0x1f4,_0x702c23[_0x2161('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 06f4d11..3599b47 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 _0x627e=['describe','/:id','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe'];(function(_0x424e09,_0x1cb691){var _0x2804f4=function(_0x4f211c){while(--_0x4f211c){_0x424e09['push'](_0x424e09['shift']());}};_0x2804f4(++_0x1cb691);}(_0x627e,0x14a));var _0xe627=function(_0x5003b3,_0x38bbc4){_0x5003b3=_0x5003b3-0x0;var _0x363a8c=_0x627e[_0x5003b3];return _0x363a8c;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe627('0xe')](_0xe627('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe627('0xf')](_0xe627('0xd'),auth[_0xe627('0x8')](),controller[_0xe627('0x10')]);module[_0xe627('0x11')]=router; \ No newline at end of file +var _0x8ca9=['express','Router','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xa1671c,_0x57700d){var _0x2107f0=function(_0x436e27){while(--_0x436e27){_0xa1671c['push'](_0xa1671c['shift']());}};_0x2107f0(++_0x57700d);}(_0x8ca9,0x9c));var _0x98ca=function(_0xf55b85,_0x59c6f2){_0xf55b85=_0xf55b85-0x0;var _0x453186=_0x8ca9[_0xf55b85];return _0x453186;};'use strict';var multer=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var path=require(_0x98ca('0x2'));var timeout=require(_0x98ca('0x3'));var express=require(_0x98ca('0x4'));var router=express[_0x98ca('0x5')]();var fs_extra=require(_0x98ca('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x98ca('0x7'));var controller=require('./cmHopperBlack.controller');router[_0x98ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x98ca('0x9')]);router[_0x98ca('0x8')](_0x98ca('0xa'),auth[_0x98ca('0xb')](),controller[_0x98ca('0xc')]);router[_0x98ca('0x8')](_0x98ca('0xd'),auth[_0x98ca('0xb')](),controller[_0x98ca('0xe')]);router[_0x98ca('0xf')](_0x98ca('0xd'),auth[_0x98ca('0xb')](),controller[_0x98ca('0x10')]);router[_0x98ca('0x11')](_0x98ca('0xd'),auth[_0x98ca('0xb')](),controller[_0x98ca('0x12')]);module[_0x98ca('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ba26133..5a4cd9d 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 _0xca59=['getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x395ccb,_0x5052ff){var _0x4f5d43=function(_0x2dbce9){while(--_0x2dbce9){_0x395ccb['push'](_0x395ccb['shift']());}};_0x4f5d43(++_0x5052ff);}(_0xca59,0x1c2));var _0x9ca5=function(_0x1789b2,_0x347f4e){_0x1789b2=_0x1789b2-0x0;var _0x49c5cf=_0xca59[_0x1789b2];return _0x49c5cf;};'use strict';var Sequelize=require(_0x9ca5('0x0'));var moment=require(_0x9ca5('0x1'));module[_0x9ca5('0x2')]={'state':{'type':Sequelize[_0x9ca5('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x9ca5('0x4')]},'scheduledat':{'type':Sequelize[_0x9ca5('0x5')]},'countbusyretry':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9ca5('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9ca5('0x5')]},'responsetime':{'type':Sequelize[_0x9ca5('0x5')]},'answertime':{'type':Sequelize[_0x9ca5('0x5')]},'droptime':{'type':Sequelize[_0x9ca5('0x5')]},'endtime':{'type':Sequelize[_0x9ca5('0x5')]},'ringtime':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9ca5('0x4')]},'campaign':{'type':Sequelize[_0x9ca5('0x4')]},'campaigntype':{'type':Sequelize[_0x9ca5('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x9ca5('0x4')]},'disposition':{'type':Sequelize[_0x9ca5('0x4')]},'secondDisposition':{'type':Sequelize[_0x9ca5('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9ca5('0x4')]},'dispositionat':{'type':Sequelize[_0x9ca5('0x5')],'set':function(_0x46f47b){var _0x518afb=this[_0x9ca5('0x6')](_0x9ca5('0x7'));if(_0x518afb&&_0x46f47b){this[_0x9ca5('0x8')](_0x9ca5('0x9'),moment(_0x46f47b)[_0x9ca5('0xa')](moment(_0x518afb),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x9ca5('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9ca5('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9ca5('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9ca5('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9ca5('0x5')]},'recallme':{'type':Sequelize[_0x9ca5('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9ca5('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x88b1=['DATE','getDataValue','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x17eba5,_0x434f32){var _0x1aa6f1=function(_0x163713){while(--_0x163713){_0x17eba5['push'](_0x17eba5['shift']());}};_0x1aa6f1(++_0x434f32);}(_0x88b1,0x127));var _0x188b=function(_0x147692,_0x40490c){_0x147692=_0x147692-0x0;var _0x2af108=_0x88b1[_0x147692];return _0x2af108;};'use strict';var Sequelize=require(_0x188b('0x0'));var moment=require(_0x188b('0x1'));module[_0x188b('0x2')]={'state':{'type':Sequelize[_0x188b('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x188b('0x4')]},'scheduledat':{'type':Sequelize[_0x188b('0x5')]},'countbusyretry':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x188b('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x188b('0x4')]},'calleridnum':{'type':Sequelize[_0x188b('0x4')]},'calleridname':{'type':Sequelize[_0x188b('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x188b('0x4')]},'campaign':{'type':Sequelize[_0x188b('0x4')]},'campaigntype':{'type':Sequelize[_0x188b('0x4')]},'membername':{'type':Sequelize[_0x188b('0x4')]},'reason':{'type':Sequelize[_0x188b('0x4')]},'disposition':{'type':Sequelize[_0x188b('0x4')]},'secondDisposition':{'type':Sequelize[_0x188b('0x4')]},'thirdDisposition':{'type':Sequelize[_0x188b('0x4')]},'dispositionat':{'type':Sequelize[_0x188b('0x5')],'set':function(_0x406310){var _0xe8f31d=this[_0x188b('0x6')](_0x188b('0x7'));if(_0xe8f31d&&_0x406310){this['setDataValue'](_0x188b('0x8'),moment(_0x406310)[_0x188b('0x9')](moment(_0xe8f31d),_0x188b('0xa')));}}},'amd':{'type':Sequelize[_0x188b('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x188b('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x188b('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x188b('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x188b('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x188b('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x188b('0x5')]},'deleted':{'type':Sequelize[_0x188b('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x188b('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x188b('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x188b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x188b('0x3')],'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 52c3557..e7c9014 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 _0x57ca=['state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','cm_hopper','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','toString','group','moveContactsIvrCampaignHopperFinal','scheduledAt','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','from','state\x20=\x204','checkContactHopper','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','CmHopperFinal','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x90d43e,_0x382907){var _0x13d0b4=function(_0x2020e1){while(--_0x2020e1){_0x90d43e['push'](_0x90d43e['shift']());}};_0x13d0b4(++_0x382907);}(_0x57ca,0x108));var _0xa57c=function(_0x2fba24,_0xc2bdd5){_0x2fba24=_0x2fba24-0x0;var _0x43c564=_0x57ca[_0x2fba24];return _0x43c564;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')]()['then'](respondWithResult(_0x44ea0a,null))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x5082ef,_0x232675){if(_0x5082ef['body'][_0xa57c('0x42')]){delete _0x5082ef[_0xa57c('0x43')]['uniqueid'];}return db[_0xa57c('0x2a')][_0xa57c('0x3f')]({'where':{'uniqueid':_0x5082ef[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x232675,null))[_0xa57c('0x21')](saveUpdates(_0x5082ef['body'],null))[_0xa57c('0x21')](respondWithResult(_0x232675,null))[_0xa57c('0x40')](handleError(_0x232675,null));};exports[_0xa57c('0x44')]=function(_0xd57bac,_0x2e4b84,_0x5ace6d){return db[_0xa57c('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0xd57bac['params']['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize']['literal'](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4a')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x4b')))),_0xa57c('0x4c')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),_0xa57c('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db['sequelize']['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0x2e4b84,null))['then'](respondWithResult(_0x2e4b84,null))[_0xa57c('0x40')](handleError(_0x2e4b84,null));};exports[_0xa57c('0x56')]=function(_0x1899ad,_0xb19d93,_0x2adcf6){return db[_0xa57c('0x2a')][_0xa57c('0x3d')]({'raw':![],'where':{'CampaignId':_0x1899ad[_0xa57c('0x3e')]['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0xa57c('0x57')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4b')))),'busyContacts'],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),'dropContacts'],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0xb19d93,null))['then'](respondWithResult(_0xb19d93,null))[_0xa57c('0x40')](handleError(_0xb19d93,null));};exports[_0xa57c('0x58')]=function(_0x1be631,_0x47e3d5,_0x571e10){return db[_0xa57c('0x59')][_0xa57c('0x3f')]({'where':{'id':_0x1be631[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x47e3d5,null))[_0xa57c('0x21')](function(_0x39411b){var _0x2a7aab;if(_0x39411b){_0x2a7aab=squel[_0xa57c('0x5a')]()[_0xa57c('0x5b')]('cm_hopper')[_0xa57c('0x5c')]([_0xa57c('0x5d'),'scheduledAt',_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x60'),_0xa57c('0x61'),_0xa57c('0x62')],squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x65'),'phone')[_0xa57c('0x64')](_0xa57c('0x66'),'scheduledAt')[_0xa57c('0x64')](_0xa57c('0x67'),'ContactId')['field'](_0xa57c('0x68'),_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x69'),_0xa57c('0x60'))['field'](_0xa57c('0x66'),_0xa57c('0x61'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x62'))['from'](_0xa57c('0x6a'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1be631[_0xa57c('0x43')][_0xa57c('0x6d')]['toString']())[_0xa57c('0x37')](_0xa57c('0x6e'))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x5d'))['from'](_0xa57c('0x6f'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']()))[_0xa57c('0x37')](_0xa57c('0x70'),squel['select']()[_0xa57c('0x64')](_0xa57c('0x71'))['from'](_0xa57c('0x6a'))['where'](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id'][_0xa57c('0x72')]())[_0xa57c('0x37')]('state\x20=\x204'))[_0xa57c('0x73')](_0xa57c('0x5e')))[_0xa57c('0x72')]();return db[_0xa57c('0x45')][_0xa57c('0x2e')](_0x2a7aab);}return[];})[_0xa57c('0x21')](respondWithResult(_0x47e3d5,null))[_0xa57c('0x40')](handleError(_0x47e3d5,null));};exports[_0xa57c('0x74')]=function(_0x1129f,_0x2c4e6c,_0x46dbb1){return db['Campaign']['find']({'where':{'id':_0x1129f['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x2c4e6c,null))['then'](function(_0x43c430){var _0x442dc7;if(_0x43c430){_0x442dc7=squel[_0xa57c('0x5a')]()['into'](_0xa57c('0x6f'))[_0xa57c('0x5c')]([_0xa57c('0x5d'),_0xa57c('0x75'),_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x76'),'createdAt',_0xa57c('0x62')],squel[_0xa57c('0x63')]()['field']('ANY_VALUE(calleridnum)',_0xa57c('0x5d'))[_0xa57c('0x64')]('NOW()','scheduledAt')[_0xa57c('0x64')]('ANY_VALUE(ContactId)',_0xa57c('0x5e'))[_0xa57c('0x64')]('ANY_VALUE(ListId)',_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x77'),_0xa57c('0x76'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x61'))['field'](_0xa57c('0x66'),_0xa57c('0x62'))['from']('cm_hopper_final')['where'](_0xa57c('0x78'),_0x1129f['params']['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1129f[_0xa57c('0x43')]['state'][_0xa57c('0x72')]())[_0xa57c('0x37')](_0xa57c('0x6e'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()['field'](_0xa57c('0x5d'))[_0xa57c('0x79')]('cm_hopper')[_0xa57c('0x37')]('CampaignId\x20=\x20?',_0x1129f['params']['id']['toString']()))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa57c('0x71'))[_0xa57c('0x79')]('cm_hopper_final')[_0xa57c('0x37')](_0xa57c('0x78'),_0x1129f[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x7a')))[_0xa57c('0x73')](_0xa57c('0x5e')))['toString']();return db['sequelize'][_0xa57c('0x2e')](_0x442dc7);}return[];})['then'](respondWithResult(_0x2c4e6c,null))[_0xa57c('0x40')](handleError(_0x2c4e6c,null));};exports[_0xa57c('0x7b')]=function(_0x2cc12b,_0x4dc6ac,_0x138c4e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x2cc12b[_0xa57c('0x43')]['VoiceQueueId'],'CampaignId':_0x2cc12b[_0xa57c('0x43')][_0xa57c('0x76')],'ContactId':_0x2cc12b['body']['ContactId']}})[_0xa57c('0x21')](handleEntityNotFound(_0x4dc6ac,null))[_0xa57c('0x21')](function(_0x50a940){if(_0x50a940){return _0x50a940;}return null;})['then'](respondWithResult(_0x4dc6ac,null))[_0xa57c('0x40')](handleError(_0x4dc6ac,null));}; \ No newline at end of file +var _0xf61e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','describe','update','body','uniqueid','params','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','fromQuery','ContactId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','checkContactHopper','findOne','eml-format'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf61e,0x191));var _0xef61=function(_0x3b40db,_0x51dacd){_0x3b40db=_0x3b40db-0x0;var _0x245591=_0xf61e[_0x3b40db];return _0x245591;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['CmHopperFinal']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':!![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')]()['then'](respondWithResult(_0x47b09d,null))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x13d0f8,_0x2904e0){if(_0x13d0f8[_0xef61('0x4a')][_0xef61('0x4b')]){delete _0x13d0f8[_0xef61('0x4a')]['uniqueid'];}return db[_0xef61('0x30')]['find']({'where':{'uniqueid':_0x13d0f8[_0xef61('0x4c')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x2904e0,null))[_0xef61('0x28')](saveUpdates(_0x13d0f8[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x2904e0,null))[_0xef61('0x45')](handleError(_0x2904e0,null));};exports[_0xef61('0x4d')]=function(_0x1565c7,_0x264877,_0x4af2f3){return db[_0xef61('0x30')][_0xef61('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x1565c7['params']['id']},'attributes':[[db['sequelize']['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db['sequelize'][_0xef61('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xef61('0x51')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xef61('0x52')],[db[_0xef61('0x4f')]['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xef61('0x53')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xef61('0x54')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x55')))),_0xef61('0x56')],[db['sequelize']['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x57')))),_0xef61('0x58')],[db['sequelize']['fn'](_0xef61('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0xef61('0x50')](_0xef61('0x59')))),_0xef61('0x5a')],[db['sequelize']['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5b')))),_0xef61('0x5c')]]})[_0xef61('0x28')](handleEntityNotFound(_0x264877,null))[_0xef61('0x28')](respondWithResult(_0x264877,null))[_0xef61('0x45')](handleError(_0x264877,null));};exports[_0xef61('0x5d')]=function(_0x5507ee,_0x15a8c5,_0x4b26e6){return db['CmHopperFinal'][_0xef61('0x44')]({'raw':![],'where':{'CampaignId':_0x5507ee[_0xef61('0x4c')]['id']},'attributes':[[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xef61('0x51')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5e')))),_0xef61('0x52')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db['sequelize'][_0xef61('0x50')](_0xef61('0x5f')))),'busyContacts'],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x60')))),_0xef61('0x54')],[db[_0xef61('0x4f')]['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xef61('0x56')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db['sequelize']['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x57')))),_0xef61('0x58')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x59')))),_0xef61('0x5a')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5b')))),_0xef61('0x5c')]]})['then'](handleEntityNotFound(_0x15a8c5,null))[_0xef61('0x28')](respondWithResult(_0x15a8c5,null))[_0xef61('0x45')](handleError(_0x15a8c5,null));};exports[_0xef61('0x61')]=function(_0x5ab4fe,_0x38117b,_0x346752){return db['VoiceQueue'][_0xef61('0x47')]({'where':{'id':_0x5ab4fe[_0xef61('0x4c')]['id']}})['then'](handleEntityNotFound(_0x38117b,null))[_0xef61('0x28')](function(_0x54777a){var _0xe62ec2;if(_0x54777a){_0xe62ec2=squel[_0xef61('0x62')]()['into'](_0xef61('0x63'))['fromQuery']([_0xef61('0x64'),_0xef61('0x65'),'ContactId','ListId',_0xef61('0x66'),_0xef61('0x67'),_0xef61('0x68')],squel[_0xef61('0x69')]()[_0xef61('0x6a')]('ANY_VALUE(calleridnum)',_0xef61('0x64'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x65'))[_0xef61('0x6a')](_0xef61('0x6c'),'ContactId')[_0xef61('0x6a')]('ANY_VALUE(ListId)',_0xef61('0x6d'))[_0xef61('0x6a')](_0xef61('0x6e'),_0xef61('0x66'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x67'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x68'))[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')]('VoiceQueueId\x20=\x20?',_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x72'),_0x5ab4fe['body'][_0xef61('0x73')]['toString']())['where'](_0xef61('0x74'))['where'](_0xef61('0x75'),squel['select']()['field'](_0xef61('0x64'))[_0xef61('0x6f')]('cm_hopper')[_0xef61('0x3d')]('VoiceQueueId\x20=\x20?',_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]()))[_0xef61('0x3d')](_0xef61('0x75'),squel['select']()[_0xef61('0x6a')]('calleridnum')[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')](_0xef61('0x76'),_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x77')))[_0xef61('0x78')]('ContactId'))[_0xef61('0x71')]();return db['sequelize'][_0xef61('0x34')](_0xe62ec2);}return[];})[_0xef61('0x28')](respondWithResult(_0x38117b,null))['catch'](handleError(_0x38117b,null));};exports[_0xef61('0x79')]=function(_0x5b86e4,_0x52f7c5,_0x465fb5){return db[_0xef61('0x7a')]['find']({'where':{'id':_0x5b86e4[_0xef61('0x4c')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x52f7c5,null))['then'](function(_0x352633){var _0x2cb8a8;if(_0x352633){_0x2cb8a8=squel['insert']()[_0xef61('0x7b')]('cm_hopper')[_0xef61('0x7c')]([_0xef61('0x64'),_0xef61('0x65'),_0xef61('0x7d'),'ListId',_0xef61('0x7e'),_0xef61('0x67'),_0xef61('0x68')],squel['select']()[_0xef61('0x6a')](_0xef61('0x7f'),'phone')['field'](_0xef61('0x6b'),_0xef61('0x65'))[_0xef61('0x6a')](_0xef61('0x6c'),_0xef61('0x7d'))[_0xef61('0x6a')](_0xef61('0x80'),_0xef61('0x6d'))[_0xef61('0x6a')](_0xef61('0x81'),_0xef61('0x7e'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x67'))[_0xef61('0x6a')](_0xef61('0x6b'),'updatedAt')[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')](_0xef61('0x82'),_0x5b86e4[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x72'),_0x5b86e4[_0xef61('0x4a')][_0xef61('0x73')][_0xef61('0x71')]())[_0xef61('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xef61('0x3d')](_0xef61('0x75'),squel['select']()[_0xef61('0x6a')](_0xef61('0x64'))[_0xef61('0x6f')](_0xef61('0x63'))[_0xef61('0x3d')]('CampaignId\x20=\x20?',_0x5b86e4[_0xef61('0x4c')]['id']['toString']()))[_0xef61('0x3d')](_0xef61('0x75'),squel[_0xef61('0x69')]()[_0xef61('0x6a')](_0xef61('0x83'))[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')]('CampaignId\x20=\x20?',_0x5b86e4[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x77')))[_0xef61('0x78')](_0xef61('0x7d')))[_0xef61('0x71')]();return db[_0xef61('0x4f')][_0xef61('0x34')](_0x2cb8a8);}return[];})['then'](respondWithResult(_0x52f7c5,null))[_0xef61('0x45')](handleError(_0x52f7c5,null));};exports[_0xef61('0x84')]=function(_0x22006a,_0x317c4a,_0x5d8ee9){return db['CmHopper'][_0xef61('0x85')]({'where':{'VoiceQueueId':_0x22006a[_0xef61('0x4a')][_0xef61('0x66')],'CampaignId':_0x22006a[_0xef61('0x4a')][_0xef61('0x7e')],'ContactId':_0x22006a[_0xef61('0x4a')][_0xef61('0x7d')]}})['then'](handleEntityNotFound(_0x317c4a,null))[_0xef61('0x28')](function(_0x660c71){if(_0x660c71){return _0x660c71;}return null;})[_0xef61('0x28')](respondWithResult(_0x317c4a,null))[_0xef61('0x45')](handleError(_0x317c4a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index b0f5332..31cf38b 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 _0x10c3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x5ee33a,_0x22cc8d){var _0x36105a=function(_0x1dcec0){while(--_0x1dcec0){_0x5ee33a['push'](_0x5ee33a['shift']());}};_0x36105a(++_0x22cc8d);}(_0x10c3,0xfc));var _0x310c=function(_0x79cf50,_0x129d7e){_0x79cf50=_0x79cf50-0x0;var _0x39ba72=_0x10c3[_0x79cf50];return _0x39ba72;};'use strict';var _=require(_0x310c('0x0'));var util=require(_0x310c('0x1'));var logger=require(_0x310c('0x2'))('api');var moment=require(_0x310c('0x3'));var BPromise=require(_0x310c('0x4'));var rp=require(_0x310c('0x5'));var fs=require('fs');var path=require(_0x310c('0x6'));var rimraf=require(_0x310c('0x7'));var config=require(_0x310c('0x8'));var attributes=require(_0x310c('0x9'));module['exports']=function(_0x1bccb0,_0x45890b){return _0x1bccb0[_0x310c('0xa')](_0x310c('0xb'),attributes,{'tableName':_0x310c('0xc'),'paranoid':![],'indexes':[{'name':_0x310c('0xd'),'fields':['calleridnum']},{'name':_0x310c('0xe'),'fields':[_0x310c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f3b=['./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x433899,_0x401977){var _0x17990b=function(_0x2f086c){while(--_0x2f086c){_0x433899['push'](_0x433899['shift']());}};_0x17990b(++_0x401977);}(_0x7f3b,0x12e));var _0xb7f3=function(_0x49380f,_0x3db965){_0x49380f=_0x49380f-0x0;var _0x12e196=_0x7f3b[_0x49380f];return _0x12e196;};'use strict';var _=require(_0xb7f3('0x0'));var util=require('util');var logger=require(_0xb7f3('0x1'))(_0xb7f3('0x2'));var moment=require(_0xb7f3('0x3'));var BPromise=require(_0xb7f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7f3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb7f3('0x6'));module['exports']=function(_0x578ec4,_0x143960){return _0x578ec4[_0xb7f3('0x7')]('CmHopperFinal',attributes,{'tableName':_0xb7f3('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xb7f3('0x9')]},{'name':_0xb7f3('0xa'),'fields':[_0xb7f3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 00753b3..a6c5888 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0xf24848,_0x3d69fe){var _0x2e9a97=function(_0x41b9b4){while(--_0x41b9b4){_0xf24848['push'](_0xf24848['shift']());}};_0x2e9a97(++_0x3d69fe);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a350c,_0x2760a1){_0x4a350c=_0x4a350c-0x0;var _0x51bb79=_0xb10b[_0x4a350c];return _0x51bb79;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0xdd30c,_0x18408a){var _0x3c8a6a=function(_0x488716){while(--_0x488716){_0xdd30c['push'](_0xdd30c['shift']());}};_0x3c8a6a(++_0x18408a);}(_0xb10b,0x12a));var _0xbb10=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0xb10b[_0x27d8bc];return _0x4b04cb;};'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 a69d807..b3d1c80 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 _0x8f4c=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports'];(function(_0x7df4a9,_0x55442f){var _0x26dce4=function(_0x474e63){while(--_0x474e63){_0x7df4a9['push'](_0x7df4a9['shift']());}};_0x26dce4(++_0x55442f);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2c2390,_0x37ef1c){_0x2c2390=_0x2c2390-0x0;var _0x478b7e=_0x8f4c[_0x2c2390];return _0x478b7e;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./cmHopperFinal.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x9')]('/campaign/countAttributes/:id',auth[_0xc8f4('0xd')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xc8f4('0x11')](_0xc8f4('0x12'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x11')]('/voice/campaign/moveContacts/:id',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x14')]);router[_0xc8f4('0x11')](_0xc8f4('0x15'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x16')]);router['put'](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x17')]);module[_0xc8f4('0x18')]=router; \ No newline at end of file +var _0x9231=['describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe'];(function(_0x2350dd,_0x53e293){var _0x5ca2db=function(_0x5dacc7){while(--_0x5dacc7){_0x2350dd['push'](_0x2350dd['shift']());}};_0x5ca2db(++_0x53e293);}(_0x9231,0x66));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1923('0x0'));var util=require(_0x1923('0x1'));var path=require(_0x1923('0x2'));var timeout=require(_0x1923('0x3'));var express=require('express');var router=express[_0x1923('0x4')]();var fs_extra=require(_0x1923('0x5'));var auth=require(_0x1923('0x6'));var interaction=require(_0x1923('0x7'));var config=require(_0x1923('0x8'));var controller=require(_0x1923('0x9'));router[_0x1923('0xa')]('/',auth[_0x1923('0xb')](),controller[_0x1923('0xc')]);router[_0x1923('0xa')](_0x1923('0xd'),auth[_0x1923('0xb')](),controller[_0x1923('0xe')]);router[_0x1923('0xa')](_0x1923('0xf'),auth['isAuthenticated'](),controller[_0x1923('0x10')]);router[_0x1923('0xa')](_0x1923('0x11'),auth[_0x1923('0xb')](),controller[_0x1923('0x12')]);router['get'](_0x1923('0x13'),auth[_0x1923('0xb')](),controller[_0x1923('0x14')]);router[_0x1923('0x15')](_0x1923('0x16'),auth[_0x1923('0xb')](),controller[_0x1923('0x17')]);router[_0x1923('0x15')](_0x1923('0x18'),auth[_0x1923('0xb')](),controller[_0x1923('0x19')]);router[_0x1923('0x15')](_0x1923('0x1a'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x1923('0x1b')](_0x1923('0xf'),auth[_0x1923('0xb')](),controller['update']);module[_0x1923('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 61b32f1..29d1f7f 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 _0xf788=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x4f9f86,_0x77603a){var _0x14658d=function(_0x1f941b){while(--_0x1f941b){_0x4f9f86['push'](_0x4f9f86['shift']());}};_0x14658d(++_0x77603a);}(_0xf788,0x197));var _0x8f78=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xf788[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require(_0x8f78('0x0'));module[_0x8f78('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8f78('0x2')]},'scheduledat':{'type':Sequelize[_0x8f78('0x3')]},'countbusyretry':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8f78('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8f78('0x2')]},'calleridnum':{'type':Sequelize[_0x8f78('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8f78('0x3')]},'responsetime':{'type':Sequelize[_0x8f78('0x3')]},'answertime':{'type':Sequelize[_0x8f78('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8f78('0x2')]},'campaign':{'type':Sequelize[_0x8f78('0x2')]},'campaigntype':{'type':Sequelize[_0x8f78('0x2')]},'membername':{'type':Sequelize[_0x8f78('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x8f78('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8f78('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8f78('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8f78('0x3')]},'recallme':{'type':Sequelize[_0x8f78('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8f78('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8f78('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8f78('0x2')]}}; \ No newline at end of file +var _0x89b3=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x58c24a,_0x159665){var _0x50d1bc=function(_0x4ad730){while(--_0x4ad730){_0x58c24a['push'](_0x58c24a['shift']());}};_0x50d1bc(++_0x159665);}(_0x89b3,0x12a));var _0x389b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89b3[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x389b('0x0'));module[_0x389b('0x1')]={'state':{'type':Sequelize[_0x389b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x389b('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x389b('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x389b('0x3')]},'calleridname':{'type':Sequelize[_0x389b('0x3')]},'starttime':{'type':Sequelize[_0x389b('0x4')]},'responsetime':{'type':Sequelize[_0x389b('0x4')]},'answertime':{'type':Sequelize[_0x389b('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x389b('0x3')]},'membername':{'type':Sequelize[_0x389b('0x3')]},'reason':{'type':Sequelize[_0x389b('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x389b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x389b('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x389b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x389b('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x389b('0x4')]},'edited':{'type':Sequelize[_0x389b('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x389b('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x389b('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 4f878db..1cd6107 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 _0xf08e=['send','map','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmHopperHistory','count','includeAll','include','findAll','rows','catch','show','params','create','body','describe','uniqueid','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','then','destroy','end','error','stack','name'];(function(_0x3ebe03,_0x2b35e2){var _0x272ae6=function(_0x242607){while(--_0x242607){_0x3ebe03['push'](_0x3ebe03['shift']());}};_0x272ae6(++_0x2b35e2);}(_0xf08e,0xb0));var _0xef08=function(_0x1816e9,_0x1639c1){_0x1816e9=_0x1816e9-0x0;var _0x1483c0=_0xf08e[_0x1816e9];return _0x1483c0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xef08('0x0'));var jsonpatch=require(_0xef08('0x1'));var rp=require(_0xef08('0x2'));var moment=require(_0xef08('0x3'));var BPromise=require(_0xef08('0x4'));var Mustache=require(_0xef08('0x5'));var util=require(_0xef08('0x6'));var path=require(_0xef08('0x7'));var sox=require(_0xef08('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef08('0x9'));var _=require(_0xef08('0xa'));var squel=require(_0xef08('0xb'));var crypto=require('crypto');var jsforce=require(_0xef08('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xef08('0xd'));var Papa=require(_0xef08('0xe'));var Redis=require(_0xef08('0xf'));var authService=require(_0xef08('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xef08('0x11'))(_0xef08('0x12'));var utils=require('../../config/utils');var config=require(_0xef08('0x13'));var licenseUtil=require(_0xef08('0x14'));var db=require(_0xef08('0x15'))['db'];function respondWithStatusCode(_0x375438,_0xbdcfe7){_0xbdcfe7=_0xbdcfe7||0xcc;return function(_0x3ee7a3){if(_0x3ee7a3){return _0x375438[_0xef08('0x16')](_0xbdcfe7);}return _0x375438['status'](_0xbdcfe7)['end']();};}function respondWithResult(_0x3b0856,_0x3a6b70){_0x3a6b70=_0x3a6b70||0xc8;return function(_0x4a9259){if(_0x4a9259){return _0x3b0856[_0xef08('0x17')](_0x3a6b70)[_0xef08('0x18')](_0x4a9259);}};}function respondWithFilteredResult(_0x1cf7f6,_0x5a5832){return function(_0x154c32){if(_0x154c32){var _0x4da90f=typeof _0x5a5832[_0xef08('0x19')]===_0xef08('0x1a')&&typeof _0x5a5832[_0xef08('0x1b')]==='undefined';var _0x38e767=_0x154c32['count'];var _0x47fc0a=_0x4da90f?0x0:_0x5a5832[_0xef08('0x19')];var _0x129689=_0x4da90f?_0x154c32['count']:_0x5a5832['offset']+_0x5a5832[_0xef08('0x1b')];var _0x4b344b;if(_0x129689>=_0x38e767){_0x129689=_0x38e767;_0x4b344b=0xc8;}else{_0x4b344b=0xce;}_0x1cf7f6['status'](_0x4b344b);return _0x1cf7f6[_0xef08('0x1c')](_0xef08('0x1d'),_0x47fc0a+'-'+_0x129689+'/'+_0x38e767)[_0xef08('0x18')](_0x154c32);}return null;};}function patchUpdates(_0x581e21){return function(_0x2d8f4a){try{jsonpatch[_0xef08('0x1e')](_0x2d8f4a,_0x581e21,!![]);}catch(_0x17a1f1){return BPromise['reject'](_0x17a1f1);}return _0x2d8f4a['save']();};}function saveUpdates(_0x4e29aa,_0x3a08ca){return function(_0x3ed20a){if(_0x3ed20a){return _0x3ed20a['update'](_0x4e29aa)[_0xef08('0x1f')](function(_0x3846b0){return _0x3846b0;});}return null;};}function removeEntity(_0x14f524,_0xe943a6){return function(_0x45dec7){if(_0x45dec7){return _0x45dec7[_0xef08('0x20')]()['then'](function(){_0x14f524['status'](0xcc)[_0xef08('0x21')]();});}};}function handleEntityNotFound(_0x3c6716,_0x446a08){return function(_0x47c369){if(!_0x47c369){_0x3c6716[_0xef08('0x16')](0x194);}return _0x47c369;};}function handleError(_0x557a39,_0x4154e0){_0x4154e0=_0x4154e0||0x1f4;return function(_0x4caf48){logger[_0xef08('0x22')](_0x4caf48[_0xef08('0x23')]);if(_0x4caf48[_0xef08('0x24')]){delete _0x4caf48[_0xef08('0x24')];}_0x557a39['status'](_0x4154e0)[_0xef08('0x25')](_0x4caf48);};}exports['index']=function(_0x29e1b9,_0x48b4df){var _0x3d6a77={},_0x4a3b87={},_0x1a3e63={'count':0x0,'rows':[]};var _0x10145d=_[_0xef08('0x26')](db['CmHopperHistory'][_0xef08('0x27')],function(_0x52d0ad){return{'name':_0x52d0ad[_0xef08('0x28')],'type':_0x52d0ad[_0xef08('0x29')]['key']};});_0x4a3b87['model']=_[_0xef08('0x26')](_0x10145d,'name');_0x4a3b87[_0xef08('0x2a')]=_[_0xef08('0x2b')](_0x29e1b9[_0xef08('0x2a')]);_0x4a3b87['filters']=_[_0xef08('0x2c')](_0x4a3b87['model'],_0x4a3b87[_0xef08('0x2a')]);_0x3d6a77['attributes']=_[_0xef08('0x2c')](_0x4a3b87[_0xef08('0x2d')],qs[_0xef08('0x2e')](_0x29e1b9[_0xef08('0x2a')][_0xef08('0x2e')]));_0x3d6a77[_0xef08('0x2f')]=_0x3d6a77[_0xef08('0x2f')]['length']?_0x3d6a77[_0xef08('0x2f')]:_0x4a3b87[_0xef08('0x2d')];if(!_0x29e1b9[_0xef08('0x2a')]['hasOwnProperty'](_0xef08('0x30'))){_0x3d6a77['limit']=qs[_0xef08('0x1b')](_0x29e1b9[_0xef08('0x2a')]['limit']);_0x3d6a77[_0xef08('0x19')]=qs[_0xef08('0x19')](_0x29e1b9[_0xef08('0x2a')][_0xef08('0x19')]);}_0x3d6a77['order']=qs[_0xef08('0x31')](_0x29e1b9[_0xef08('0x2a')][_0xef08('0x31')]);_0x3d6a77[_0xef08('0x32')]=qs[_0xef08('0x33')](_[_0xef08('0x34')](_0x29e1b9[_0xef08('0x2a')],_0x4a3b87[_0xef08('0x33')]),_0x10145d);if(_0x29e1b9[_0xef08('0x2a')][_0xef08('0x35')]){_0x3d6a77['where']=_[_0xef08('0x36')](_0x3d6a77[_0xef08('0x32')],{'$or':_[_0xef08('0x26')](_0x10145d,function(_0x265112){if(_0x265112['type']!==_0xef08('0x37')){var _0x1ad3cd={};_0x1ad3cd[_0x265112[_0xef08('0x24')]]={'$like':'%'+_0x29e1b9[_0xef08('0x2a')][_0xef08('0x35')]+'%'};return _0x1ad3cd;}})});}_0x3d6a77=_[_0xef08('0x36')]({},_0x3d6a77,_0x29e1b9[_0xef08('0x38')]);var _0x23bb2c={'where':_0x3d6a77[_0xef08('0x32')]};return db[_0xef08('0x39')][_0xef08('0x3a')](_0x23bb2c)['then'](function(_0x370267){_0x1a3e63['count']=_0x370267;if(_0x29e1b9[_0xef08('0x2a')][_0xef08('0x3b')]){_0x3d6a77[_0xef08('0x3c')]=[{'all':!![]}];}return db[_0xef08('0x39')][_0xef08('0x3d')](_0x3d6a77);})[_0xef08('0x1f')](function(_0x5d262d){_0x1a3e63[_0xef08('0x3e')]=_0x5d262d;return _0x1a3e63;})['then'](respondWithFilteredResult(_0x48b4df,_0x3d6a77))[_0xef08('0x3f')](handleError(_0x48b4df,null));};exports[_0xef08('0x40')]=function(_0x12a5e4,_0xfe8705){var _0x57e5de={'raw':!![],'where':{'id':_0x12a5e4[_0xef08('0x41')]['id']}},_0x2a9623={};_0x2a9623[_0xef08('0x2d')]=_[_0xef08('0x2b')](db[_0xef08('0x39')][_0xef08('0x27')]);_0x2a9623[_0xef08('0x2a')]=_[_0xef08('0x2b')](_0x12a5e4['query']);_0x2a9623['filters']=_[_0xef08('0x2c')](_0x2a9623['model'],_0x2a9623[_0xef08('0x2a')]);_0x57e5de[_0xef08('0x2f')]=_[_0xef08('0x2c')](_0x2a9623['model'],qs['fields'](_0x12a5e4[_0xef08('0x2a')][_0xef08('0x2e')]));_0x57e5de[_0xef08('0x2f')]=_0x57e5de['attributes']['length']?_0x57e5de[_0xef08('0x2f')]:_0x2a9623['model'];if(_0x12a5e4['query'][_0xef08('0x3b')]){_0x57e5de[_0xef08('0x3c')]=[{'all':!![]}];}_0x57e5de=_[_0xef08('0x36')]({},_0x57e5de,_0x12a5e4['options']);return db[_0xef08('0x39')]['find'](_0x57e5de)[_0xef08('0x1f')](handleEntityNotFound(_0xfe8705,null))['then'](respondWithResult(_0xfe8705,null))[_0xef08('0x3f')](handleError(_0xfe8705,null));};exports[_0xef08('0x42')]=function(_0x3a61c1,_0x16d555){return db[_0xef08('0x39')][_0xef08('0x42')](_0x3a61c1[_0xef08('0x43')],{})[_0xef08('0x1f')](respondWithResult(_0x16d555,0xc9))[_0xef08('0x3f')](handleError(_0x16d555,null));};exports[_0xef08('0x44')]=function(_0x451efa,_0x16950b){return db['CmHopperHistory']['describe']()[_0xef08('0x1f')](respondWithResult(_0x16950b,null))[_0xef08('0x3f')](handleError(_0x16950b,null));};exports['update']=function(_0x50b552,_0x2272e5){if(_0x50b552[_0xef08('0x43')][_0xef08('0x45')]){delete _0x50b552[_0xef08('0x43')][_0xef08('0x45')];}return db[_0xef08('0x39')][_0xef08('0x46')]({'where':{'uniqueid':_0x50b552['params']['id']}})['then'](handleEntityNotFound(_0x2272e5,null))[_0xef08('0x1f')](saveUpdates(_0x50b552[_0xef08('0x43')],null))[_0xef08('0x1f')](respondWithResult(_0x2272e5,null))[_0xef08('0x3f')](handleError(_0x2272e5,null));}; \ No newline at end of file +var _0x2730=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','stack','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','type','filter','merge','options','CmHopperHistory','includeAll','include','findAll','show','params','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0x4aa67d,_0x214cea){var _0x319716=function(_0x4d7a2a){while(--_0x4d7a2a){_0x4aa67d['push'](_0x4aa67d['shift']());}};_0x319716(++_0x214cea);}(_0x2730,0x1ae));var _0x0273=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2730[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x0273('0x0'));var rimraf=require(_0x0273('0x1'));var zipdir=require(_0x0273('0x2'));var jsonpatch=require(_0x0273('0x3'));var rp=require(_0x0273('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0273('0x5'));var util=require(_0x0273('0x6'));var path=require(_0x0273('0x7'));var sox=require(_0x0273('0x8'));var csv=require(_0x0273('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0273('0xa'));var _=require(_0x0273('0xb'));var squel=require(_0x0273('0xc'));var crypto=require(_0x0273('0xd'));var jsforce=require(_0x0273('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0273('0x9'));var querystring=require(_0x0273('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0273('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0273('0x11'));var hardwareService=require(_0x0273('0x12'));var logger=require(_0x0273('0x13'))('api');var utils=require(_0x0273('0x14'));var config=require(_0x0273('0x15'));var licenseUtil=require(_0x0273('0x16'));var db=require(_0x0273('0x17'))['db'];function respondWithStatusCode(_0x2bce73,_0x1d2a52){_0x1d2a52=_0x1d2a52||0xcc;return function(_0x8b0079){if(_0x8b0079){return _0x2bce73[_0x0273('0x18')](_0x1d2a52);}return _0x2bce73[_0x0273('0x19')](_0x1d2a52)[_0x0273('0x1a')]();};}function respondWithResult(_0x19787d,_0x44983f){_0x44983f=_0x44983f||0xc8;return function(_0x3b3b19){if(_0x3b3b19){return _0x19787d[_0x0273('0x19')](_0x44983f)[_0x0273('0x1b')](_0x3b3b19);}};}function respondWithFilteredResult(_0xa5c4a6,_0x54f9b4){return function(_0x504062){if(_0x504062){var _0x5acd51=typeof _0x54f9b4[_0x0273('0x1c')]===_0x0273('0x1d')&&typeof _0x54f9b4[_0x0273('0x1e')]===_0x0273('0x1d');var _0x1e0380=_0x504062[_0x0273('0x1f')];var _0x116d7d=_0x5acd51?0x0:_0x54f9b4['offset'];var _0x36224e=_0x5acd51?_0x504062[_0x0273('0x1f')]:_0x54f9b4[_0x0273('0x1c')]+_0x54f9b4[_0x0273('0x1e')];var _0x59f9e5;if(_0x36224e>=_0x1e0380){_0x36224e=_0x1e0380;_0x59f9e5=0xc8;}else{_0x59f9e5=0xce;}_0xa5c4a6[_0x0273('0x19')](_0x59f9e5);return _0xa5c4a6[_0x0273('0x20')](_0x0273('0x21'),_0x116d7d+'-'+_0x36224e+'/'+_0x1e0380)[_0x0273('0x1b')](_0x504062);}return null;};}function patchUpdates(_0x7efd4c){return function(_0x38e24a){try{jsonpatch[_0x0273('0x22')](_0x38e24a,_0x7efd4c,!![]);}catch(_0x5eeae5){return BPromise[_0x0273('0x23')](_0x5eeae5);}return _0x38e24a['save']();};}function saveUpdates(_0x34b699,_0x34d763){return function(_0x32adb5){if(_0x32adb5){return _0x32adb5[_0x0273('0x24')](_0x34b699)[_0x0273('0x25')](function(_0x2a5b65){return _0x2a5b65;});}return null;};}function removeEntity(_0x456945,_0x48908e){return function(_0x3c8542){if(_0x3c8542){return _0x3c8542['destroy']()[_0x0273('0x25')](function(){_0x456945[_0x0273('0x19')](0xcc)[_0x0273('0x1a')]();});}};}function handleEntityNotFound(_0x2da07c,_0x497961){return function(_0x1296dc){if(!_0x1296dc){_0x2da07c['sendStatus'](0x194);}return _0x1296dc;};}function handleError(_0x193f5b,_0x5ae848){_0x5ae848=_0x5ae848||0x1f4;return function(_0x4d6853){logger['error'](_0x4d6853[_0x0273('0x26')]);if(_0x4d6853[_0x0273('0x27')]){delete _0x4d6853[_0x0273('0x27')];}_0x193f5b[_0x0273('0x19')](_0x5ae848)['send'](_0x4d6853);};}exports[_0x0273('0x28')]=function(_0x154d23,_0x5cea7a){var _0x3d5d98={},_0x496309={},_0x219e73={'count':0x0,'rows':[]};var _0x2d9e81=_[_0x0273('0x29')](db['CmHopperHistory']['rawAttributes'],function(_0x30070c){return{'name':_0x30070c[_0x0273('0x2a')],'type':_0x30070c['type'][_0x0273('0x2b')]};});_0x496309[_0x0273('0x2c')]=_[_0x0273('0x29')](_0x2d9e81,_0x0273('0x27'));_0x496309[_0x0273('0x2d')]=_[_0x0273('0x2e')](_0x154d23[_0x0273('0x2d')]);_0x496309[_0x0273('0x2f')]=_[_0x0273('0x30')](_0x496309[_0x0273('0x2c')],_0x496309[_0x0273('0x2d')]);_0x3d5d98[_0x0273('0x31')]=_[_0x0273('0x30')](_0x496309[_0x0273('0x2c')],qs[_0x0273('0x32')](_0x154d23[_0x0273('0x2d')][_0x0273('0x32')]));_0x3d5d98[_0x0273('0x31')]=_0x3d5d98['attributes'][_0x0273('0x33')]?_0x3d5d98[_0x0273('0x31')]:_0x496309[_0x0273('0x2c')];if(!_0x154d23[_0x0273('0x2d')][_0x0273('0x34')](_0x0273('0x35'))){_0x3d5d98['limit']=qs[_0x0273('0x1e')](_0x154d23[_0x0273('0x2d')]['limit']);_0x3d5d98['offset']=qs['offset'](_0x154d23[_0x0273('0x2d')][_0x0273('0x1c')]);}_0x3d5d98['order']=qs[_0x0273('0x36')](_0x154d23[_0x0273('0x2d')][_0x0273('0x36')]);_0x3d5d98['where']=qs[_0x0273('0x2f')](_[_0x0273('0x37')](_0x154d23[_0x0273('0x2d')],_0x496309[_0x0273('0x2f')]),_0x2d9e81);if(_0x154d23[_0x0273('0x2d')]['filter']){_0x3d5d98[_0x0273('0x38')]=_['merge'](_0x3d5d98[_0x0273('0x38')],{'$or':_[_0x0273('0x29')](_0x2d9e81,function(_0x4d1156){if(_0x4d1156[_0x0273('0x39')]!=='VIRTUAL'){var _0x184188={};_0x184188[_0x4d1156[_0x0273('0x27')]]={'$like':'%'+_0x154d23['query'][_0x0273('0x3a')]+'%'};return _0x184188;}})});}_0x3d5d98=_[_0x0273('0x3b')]({},_0x3d5d98,_0x154d23[_0x0273('0x3c')]);var _0x4faf28={'where':_0x3d5d98[_0x0273('0x38')]};return db[_0x0273('0x3d')][_0x0273('0x1f')](_0x4faf28)[_0x0273('0x25')](function(_0x3c1baf){_0x219e73[_0x0273('0x1f')]=_0x3c1baf;if(_0x154d23[_0x0273('0x2d')][_0x0273('0x3e')]){_0x3d5d98[_0x0273('0x3f')]=[{'all':!![]}];}return db[_0x0273('0x3d')][_0x0273('0x40')](_0x3d5d98);})[_0x0273('0x25')](function(_0x57f0fd){_0x219e73['rows']=_0x57f0fd;return _0x219e73;})[_0x0273('0x25')](respondWithFilteredResult(_0x5cea7a,_0x3d5d98))['catch'](handleError(_0x5cea7a,null));};exports[_0x0273('0x41')]=function(_0x372f84,_0x2b2e22){var _0x3c853a={'raw':!![],'where':{'id':_0x372f84[_0x0273('0x42')]['id']}},_0x3d83a1={};_0x3d83a1['model']=_['keys'](db[_0x0273('0x3d')]['rawAttributes']);_0x3d83a1[_0x0273('0x2d')]=_[_0x0273('0x2e')](_0x372f84[_0x0273('0x2d')]);_0x3d83a1['filters']=_[_0x0273('0x30')](_0x3d83a1['model'],_0x3d83a1['query']);_0x3c853a[_0x0273('0x31')]=_[_0x0273('0x30')](_0x3d83a1[_0x0273('0x2c')],qs[_0x0273('0x32')](_0x372f84['query'][_0x0273('0x32')]));_0x3c853a[_0x0273('0x31')]=_0x3c853a[_0x0273('0x31')][_0x0273('0x33')]?_0x3c853a['attributes']:_0x3d83a1[_0x0273('0x2c')];if(_0x372f84[_0x0273('0x2d')][_0x0273('0x3e')]){_0x3c853a[_0x0273('0x3f')]=[{'all':!![]}];}_0x3c853a=_[_0x0273('0x3b')]({},_0x3c853a,_0x372f84[_0x0273('0x3c')]);return db[_0x0273('0x3d')][_0x0273('0x43')](_0x3c853a)[_0x0273('0x25')](handleEntityNotFound(_0x2b2e22,null))[_0x0273('0x25')](respondWithResult(_0x2b2e22,null))[_0x0273('0x44')](handleError(_0x2b2e22,null));};exports['create']=function(_0x98623b,_0x4a0493){return db[_0x0273('0x3d')][_0x0273('0x45')](_0x98623b[_0x0273('0x46')],{})[_0x0273('0x25')](respondWithResult(_0x4a0493,0xc9))[_0x0273('0x44')](handleError(_0x4a0493,null));};exports['describe']=function(_0x2e9e49,_0x416117){return db[_0x0273('0x3d')][_0x0273('0x47')]()[_0x0273('0x25')](respondWithResult(_0x416117,null))[_0x0273('0x44')](handleError(_0x416117,null));};exports[_0x0273('0x24')]=function(_0x46cce4,_0x5bce82){if(_0x46cce4['body'][_0x0273('0x48')]){delete _0x46cce4[_0x0273('0x46')]['uniqueid'];}return db[_0x0273('0x3d')][_0x0273('0x43')]({'where':{'uniqueid':_0x46cce4[_0x0273('0x42')]['id']}})[_0x0273('0x25')](handleEntityNotFound(_0x5bce82,null))['then'](saveUpdates(_0x46cce4[_0x0273('0x46')],null))[_0x0273('0x25')](respondWithResult(_0x5bce82,null))['catch'](handleError(_0x5bce82,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 89aa9fd..d0b6cff 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 _0xa908=['cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory'];(function(_0x1dbbd5,_0x151281){var _0x21518b=function(_0x1d2db0){while(--_0x1d2db0){_0x1dbbd5['push'](_0x1dbbd5['shift']());}};_0x21518b(++_0x151281);}(_0xa908,0x1c3));var _0x8a90=function(_0x1938f4,_0x5c0c98){_0x1938f4=_0x1938f4-0x0;var _0x37f4db=_0xa908[_0x1938f4];return _0x37f4db;};'use strict';var _=require(_0x8a90('0x0'));var util=require('util');var logger=require(_0x8a90('0x1'))('api');var moment=require(_0x8a90('0x2'));var BPromise=require(_0x8a90('0x3'));var rp=require(_0x8a90('0x4'));var fs=require('fs');var path=require(_0x8a90('0x5'));var rimraf=require(_0x8a90('0x6'));var config=require('../../config/environment');var attributes=require(_0x8a90('0x7'));module[_0x8a90('0x8')]=function(_0x5e41b9,_0x1c516f){return _0x5e41b9[_0x8a90('0x9')](_0x8a90('0xa'),attributes,{'tableName':_0x8a90('0xb'),'paranoid':![],'indexes':[{'name':_0x8a90('0xc'),'fields':[_0x8a90('0xc')]},{'name':'uniqueid','fields':[_0x8a90('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18b2=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger'];(function(_0x1d006a,_0x2812b5){var _0x20a76b=function(_0x15953f){while(--_0x15953f){_0x1d006a['push'](_0x1d006a['shift']());}};_0x20a76b(++_0x2812b5);}(_0x18b2,0x85));var _0x218b=function(_0x1cf64d,_0x34411a){_0x1cf64d=_0x1cf64d-0x0;var _0x2602eb=_0x18b2[_0x1cf64d];return _0x2602eb;};'use strict';var _=require('lodash');var util=require(_0x218b('0x0'));var logger=require(_0x218b('0x1'))(_0x218b('0x2'));var moment=require('moment');var BPromise=require(_0x218b('0x3'));var rp=require(_0x218b('0x4'));var fs=require('fs');var path=require(_0x218b('0x5'));var rimraf=require(_0x218b('0x6'));var config=require(_0x218b('0x7'));var attributes=require(_0x218b('0x8'));module[_0x218b('0x9')]=function(_0x3a9261,_0x1c2c17){return _0x3a9261[_0x218b('0xa')](_0x218b('0xb'),attributes,{'tableName':_0x218b('0xc'),'paranoid':![],'indexes':[{'name':_0x218b('0xd'),'fields':[_0x218b('0xd')]},{'name':_0x218b('0xe'),'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 3bd12c7..70e19a9 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 _0xcb91=['outboundReCallsDay','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','then','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','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','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xcb91[_0x2ff762];return _0x158b02;};'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')]('CmHopperHistory,\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);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')](_0x23d3a9[_0x1cb9('0x17')],{'raw':_0x23d3a9[_0x1cb9('0x18')]?_0x23d3a9[_0x1cb9('0x18')][_0x1cb9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x559bcc){logger[_0x1cb9('0xa')]('CreateCmHopperHistory',_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON['stringify'](_0x559bcc));_0x479d43(_0x559bcc);})['catch'](function(_0x2e3854){logger[_0x1cb9('0x10')](_0x1cb9('0x14'),_0x2e3854[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340[_0x1cb9('0x10')](0x1f4,_0x2e3854[_0x1cb9('0x12')]));});});};exports['AvgHandleTime']=function(_0x55b232){var _0x6c6f61=this;return new Promise(function(_0x557199,_0x10a419){return db[_0x1cb9('0x15')][_0x1cb9('0x1a')]({'raw':_0x55b232[_0x1cb9('0x18')]?_0x55b232[_0x1cb9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x55b232[_0x1cb9('0x18')]?_0x55b232[_0x1cb9('0x18')]['where']||null:null,'attributes':[[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')][_0x1cb9('0x1d')]('id')),_0x1cb9('0x1e')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x1cb9('0x20')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x21')))),_0x1cb9('0x22')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x23')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x1cb9('0x1b')]['fn']('AVG',db[_0x1cb9('0x1b')]['fn']('IF',db['sequelize'][_0x1cb9('0x1f')](_0x1cb9('0x24')))),_0x1cb9('0x25')],[db[_0x1cb9('0x1b')]['fn']('AVG',db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x26')))),_0x1cb9('0x27')]]})[_0x1cb9('0x28')](function(_0xc6d5fd){logger[_0x1cb9('0xa')](_0x1cb9('0x29'),_0x55b232);logger[_0x1cb9('0xd')](_0x1cb9('0x29'),_0x55b232,JSON[_0x1cb9('0xf')](_0xc6d5fd));_0x557199(_0xc6d5fd);})[_0x1cb9('0x13')](function(_0x4c8cb0){logger['error'](_0x1cb9('0x29'),_0x4c8cb0[_0x1cb9('0x12')],_0x55b232);_0x10a419(_0x6c6f61[_0x1cb9('0x10')](0x1f4,_0x4c8cb0[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x2a')]=function(_0x3a06e6){var _0x35f5e8=this;return new Promise(function(_0x3f5637,_0x4d3e39){return db[_0x1cb9('0x15')][_0x1cb9('0x1a')]({'raw':_0x3a06e6[_0x1cb9('0x18')]?_0x3a06e6['options'][_0x1cb9('0x19')]===undefined?!![]:![]:!![],'where':_0x3a06e6['options']?_0x3a06e6[_0x1cb9('0x18')]['where']||null:null,'attributes':[[_0x1cb9('0x2b'),_0x1cb9('0x2c')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x2d')))),_0x1cb9('0x2e')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1cb9('0x2f')))),_0x1cb9('0x30')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db['sequelize'][_0x1cb9('0x1f')]('`state`\x20=\x205,\x201,\x20null'))),_0x1cb9('0x31')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')]['literal'](_0x1cb9('0x32')))),_0x1cb9('0x33')],[db['sequelize']['fn']('COUNT',db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x34')))),_0x1cb9('0x35')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1cb9('0x36')))),_0x1cb9('0x37')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x38')))),_0x1cb9('0x39')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x3a')))),'outboundBlacklistCallsDay'],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')]('`state`\x20=\x2014,\x201,\x20null'))),_0x1cb9('0x3b')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x3c')))),_0x1cb9('0x3d')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x3e')))),_0x1cb9('0x3f')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x1cb9('0x3d')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x40')))),_0x1cb9('0x41')]],'group':[_0x1cb9('0x2b')]})[_0x1cb9('0x28')](function(_0x4a4b87){logger[_0x1cb9('0xa')]('GetVoiceQueueHopperHistory',_0x3a06e6);logger[_0x1cb9('0xd')]('GetVoiceQueueHopperHistory',_0x3a06e6,JSON[_0x1cb9('0xf')](_0x4a4b87));_0x3f5637(_0x4a4b87);})['catch'](function(_0x5e5174){logger[_0x1cb9('0x10')](_0x1cb9('0x2a'),_0x5e5174[_0x1cb9('0x12')],_0x3a06e6);_0x4d3e39(_0x35f5e8['error'](0x1f4,_0x5e5174[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x42')]=function(_0x52fbfe){var _0x571b33=this;return new Promise(function(_0x398d9d,_0x1a0314){return db[_0x1cb9('0x15')][_0x1cb9('0x1a')]({'raw':_0x52fbfe[_0x1cb9('0x18')]?_0x52fbfe[_0x1cb9('0x18')][_0x1cb9('0x19')]===undefined?!![]:![]:!![],'where':_0x52fbfe['options']?_0x52fbfe[_0x1cb9('0x18')][_0x1cb9('0x43')]||null:null,'attributes':[[_0x1cb9('0x2b'),'name'],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')][_0x1cb9('0x1d')]('id')),_0x1cb9('0x44')],[db[_0x1cb9('0x1b')]['fn']('COUNT',db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x2f')))),_0x1cb9('0x45')]],'group':[_0x1cb9('0x2b')]})[_0x1cb9('0x28')](function(_0x3c126a){logger[_0x1cb9('0xa')](_0x1cb9('0x42'),_0x52fbfe);logger[_0x1cb9('0xd')]('GetCampaignHopperHistory',_0x52fbfe,JSON[_0x1cb9('0xf')](_0x3c126a));_0x398d9d(_0x3c126a);})[_0x1cb9('0x13')](function(_0xebc79f){logger[_0x1cb9('0x10')]('GetCampaignHopperHistory',_0xebc79f['message'],_0x52fbfe);_0x1a0314(_0x571b33[_0x1cb9('0x10')](0x1f4,_0xebc79f[_0x1cb9('0x12')]));});});}; \ No newline at end of file +var _0xea70=['literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`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','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls'];(function(_0x11a918,_0x14e79d){var _0x44db2d=function(_0x4bd8d9){while(--_0x4bd8d9){_0x11a918['push'](_0x11a918['shift']());}};_0x44db2d(++_0x14e79d);}(_0xea70,0x175));var _0x0ea7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xea70[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var moment=require(_0x0ea7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ea7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ea7('0x5'))(_0x0ea7('0x6'));var config=require(_0x0ea7('0x7'));var jayson=require(_0x0ea7('0x8'));var client=jayson[_0x0ea7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144497,_0x1ebefe,_0x51b516){return new BPromise(function(_0x48dedd,_0xc97410){return client['request'](_0x144497,_0x51b516)[_0x0ea7('0xa')](function(_0x107f04){logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,'request\x20sent');logger[_0x0ea7('0xd')](_0x0ea7('0xe'),_0x1ebefe,_0x0ea7('0xf'),JSON[_0x0ea7('0x10')](_0x107f04));if(_0x107f04[_0x0ea7('0x11')]){if(_0x107f04['error'][_0x0ea7('0x12')]===0x1f4){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04['error']['message']);return _0xc97410(_0x107f04['error'][_0x0ea7('0x13')]);}logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04[_0x0ea7('0x11')]['message']);return _0x48dedd(_0x107f04['error']['message']);}else{logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,_0x0ea7('0xf'));_0x48dedd(_0x107f04['result']['message']);}})[_0x0ea7('0x14')](function(_0x2aa4e9){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x2aa4e9);_0xc97410(_0x2aa4e9);});});}exports[_0x0ea7('0x15')]=function(_0x987032){var _0x1b1cb5=this;return new Promise(function(_0x48f10a,_0x4deb29){return db[_0x0ea7('0x16')][_0x0ea7('0x17')](_0x987032['body'],{'raw':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x19')]===undefined?!![]:![]:!![]})[_0x0ea7('0xa')](function(_0x306ace){logger[_0x0ea7('0xb')]('CreateCmHopperHistory',_0x987032);logger[_0x0ea7('0xd')](_0x0ea7('0x15'),_0x987032,JSON[_0x0ea7('0x10')](_0x306ace));_0x48f10a(_0x306ace);})[_0x0ea7('0x14')](function(_0x411603){logger[_0x0ea7('0x11')](_0x0ea7('0x15'),_0x411603[_0x0ea7('0x13')],_0x987032);_0x4deb29(_0x1b1cb5['error'](0x1f4,_0x411603[_0x0ea7('0x13')]));});});};exports[_0x0ea7('0x1a')]=function(_0x76d6a9){var _0x503da9=this;return new Promise(function(_0x357cbc,_0x471a1d){return db['CmHopperHistory'][_0x0ea7('0x1b')]({'raw':_0x76d6a9['options']?_0x76d6a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x76d6a9[_0x0ea7('0x18')]?_0x76d6a9[_0x0ea7('0x18')][_0x0ea7('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')][_0x0ea7('0x1f')]('id')),_0x0ea7('0x20')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')]['literal'](_0x0ea7('0x21')))),_0x0ea7('0x22')],[db['sequelize']['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x0ea7('0x26'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x0ea7('0x27')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x28')))),_0x0ea7('0x29')]]})[_0x0ea7('0xa')](function(_0x57152e){logger[_0x0ea7('0xb')](_0x0ea7('0x1a'),_0x76d6a9);logger['debug'](_0x0ea7('0x1a'),_0x76d6a9,JSON[_0x0ea7('0x10')](_0x57152e));_0x357cbc(_0x57152e);})[_0x0ea7('0x14')](function(_0x3f5959){logger['error'](_0x0ea7('0x1a'),_0x3f5959[_0x0ea7('0x13')],_0x76d6a9);_0x471a1d(_0x503da9['error'](0x1f4,_0x3f5959[_0x0ea7('0x13')]));});});};exports[_0x0ea7('0x2a')]=function(_0xbcf7f3){var _0x21fee3=this;return new Promise(function(_0x2beef2,_0x5f0739){return db[_0x0ea7('0x16')][_0x0ea7('0x1b')]({'raw':_0xbcf7f3[_0x0ea7('0x18')]?_0xbcf7f3[_0x0ea7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xbcf7f3['options']?_0xbcf7f3[_0x0ea7('0x18')][_0x0ea7('0x1c')]||null:null,'attributes':[['campaign',_0x0ea7('0x2b')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x2c')))),_0x0ea7('0x2d')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db['sequelize']['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0x0ea7('0x2e')],[db[_0x0ea7('0x1e')]['fn']('COUNT',db[_0x0ea7('0x1e')]['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x21')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x0ea7('0x1d'),db['sequelize']['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x2f')))),_0x0ea7('0x30')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x31')))),'outboundCongestionCallsDay'],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x32')))),_0x0ea7('0x33')],[db[_0x0ea7('0x1e')]['fn']('COUNT',db[_0x0ea7('0x1e')]['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x34')))),_0x0ea7('0x35')],[db['sequelize']['fn'](_0x0ea7('0x1d'),db['sequelize']['fn']('IF',db[_0x0ea7('0x1e')]['literal'](_0x0ea7('0x36')))),_0x0ea7('0x37')],[db['sequelize']['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')]['literal'](_0x0ea7('0x38')))),_0x0ea7('0x39')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x0ea7('0x3a')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x3b')))),_0x0ea7('0x3c')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x0ea7('0x3d')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x3e')))),_0x0ea7('0x3c')],[db[_0x0ea7('0x1e')]['fn']('COUNT',db[_0x0ea7('0x1e')]['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x3f')))),_0x0ea7('0x40')]],'group':[_0x0ea7('0x41')]})[_0x0ea7('0xa')](function(_0x81ab20){logger['info'](_0x0ea7('0x2a'),_0xbcf7f3);logger[_0x0ea7('0xd')](_0x0ea7('0x2a'),_0xbcf7f3,JSON[_0x0ea7('0x10')](_0x81ab20));_0x2beef2(_0x81ab20);})[_0x0ea7('0x14')](function(_0x5d6114){logger[_0x0ea7('0x11')]('GetVoiceQueueHopperHistory',_0x5d6114[_0x0ea7('0x13')],_0xbcf7f3);_0x5f0739(_0x21fee3[_0x0ea7('0x11')](0x1f4,_0x5d6114['message']));});});};exports[_0x0ea7('0x42')]=function(_0x1abb3e){var _0x47c026=this;return new Promise(function(_0x4eee8d,_0xc2e4bc){return db[_0x0ea7('0x16')][_0x0ea7('0x1b')]({'raw':_0x1abb3e[_0x0ea7('0x18')]?_0x1abb3e[_0x0ea7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1abb3e[_0x0ea7('0x18')]?_0x1abb3e[_0x0ea7('0x18')][_0x0ea7('0x1c')]||null:null,'attributes':[[_0x0ea7('0x41'),_0x0ea7('0x2b')],[db['sequelize']['fn']('COUNT',db[_0x0ea7('0x1e')][_0x0ea7('0x1f')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x0ea7('0x43')]],'group':[_0x0ea7('0x41')]})[_0x0ea7('0xa')](function(_0x36487a){logger[_0x0ea7('0xb')]('GetCampaignHopperHistory',_0x1abb3e);logger['debug']('GetCampaignHopperHistory',_0x1abb3e,JSON['stringify'](_0x36487a));_0x4eee8d(_0x36487a);})['catch'](function(_0x259adc){logger['error'](_0x0ea7('0x42'),_0x259adc[_0x0ea7('0x13')],_0x1abb3e);_0xc2e4bc(_0x47c026[_0x0ea7('0x11')](0x1f4,_0x259adc[_0x0ea7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a6a5eda..f6b90e1 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 _0xf896=['../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','show','post','create','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x342b41,_0x402c11){var _0x5c7340=function(_0x2e08ff){while(--_0x2e08ff){_0x342b41['push'](_0x342b41['shift']());}};_0x5c7340(++_0x402c11);}(_0xf896,0x12d));var _0x6f89=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xf896[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x6f89('0x0'));var util=require(_0x6f89('0x1'));var path=require(_0x6f89('0x2'));var timeout=require(_0x6f89('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6f89('0x4'));var auth=require(_0x6f89('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6f89('0x6'));var controller=require(_0x6f89('0x7'));router[_0x6f89('0x8')]('/',auth[_0x6f89('0x9')](),controller[_0x6f89('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6f89('0xb')]);router[_0x6f89('0x8')](_0x6f89('0xc'),auth[_0x6f89('0x9')](),controller[_0x6f89('0xd')]);router[_0x6f89('0xe')]('/',auth[_0x6f89('0x9')](),controller[_0x6f89('0xf')]);router['put'](_0x6f89('0xc'),auth[_0x6f89('0x9')](),controller['update']);module[_0x6f89('0x10')]=router; \ No newline at end of file +var _0xc8e8=['get','/describe','isAuthenticated','describe','show','post','create','/:id','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','index'];(function(_0x1e7c5d,_0x8a4fe1){var _0x427fc7=function(_0x3f8bdb){while(--_0x3f8bdb){_0x1e7c5d['push'](_0x1e7c5d['shift']());}};_0x427fc7(++_0x8a4fe1);}(_0xc8e8,0x126));var _0x8c8e=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xc8e8[_0x4c7935];return _0x30651d;};'use strict';var multer=require(_0x8c8e('0x0'));var util=require(_0x8c8e('0x1'));var path=require(_0x8c8e('0x2'));var timeout=require(_0x8c8e('0x3'));var express=require('express');var router=express[_0x8c8e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8c8e('0x5'));var interaction=require(_0x8c8e('0x6'));var config=require(_0x8c8e('0x7'));var controller=require(_0x8c8e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8c8e('0x9')]);router[_0x8c8e('0xa')](_0x8c8e('0xb'),auth[_0x8c8e('0xc')](),controller[_0x8c8e('0xd')]);router[_0x8c8e('0xa')]('/:id',auth[_0x8c8e('0xc')](),controller[_0x8c8e('0xe')]);router[_0x8c8e('0xf')]('/',auth[_0x8c8e('0xc')](),controller[_0x8c8e('0x10')]);router['put'](_0x8c8e('0x11'),auth['isAuthenticated'](),controller[_0x8c8e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c9af8ae..6ddbf67 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 _0xf6d1=['name','sequelize','exports','STRING'];(function(_0x5e8bd1,_0x470d7a){var _0x5406a2=function(_0x4285b3){while(--_0x4285b3){_0x5e8bd1['push'](_0x5e8bd1['shift']());}};_0x5406a2(++_0x470d7a);}(_0xf6d1,0x99));var _0x1f6d=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xf6d1[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x1f6d('0x0'));module[_0x1f6d('0x1')]={'name':{'type':Sequelize[_0x1f6d('0x2')],'unique':_0x1f6d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1f6d('0x2')]},'dialPrefix':{'type':Sequelize[_0x1f6d('0x2')]}}; \ No newline at end of file +var _0x943c=['sequelize','exports','STRING','name'];(function(_0x3e95a8,_0xa7af87){var _0x1d8724=function(_0xd751a7){while(--_0xd751a7){_0x3e95a8['push'](_0x3e95a8['shift']());}};_0x1d8724(++_0xa7af87);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc943('0x0'));module[_0xc943('0x1')]={'name':{'type':Sequelize[_0xc943('0x2')],'unique':_0xc943('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2d7d50d..c6b2479 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 _0x1553=['sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','defaultValue','addColumn','getCustomFields','pick','findAndCountAll','addAgents','omit','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','spread','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Lists','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','CmList','includeAll','findAll','rows','catch','params','keys','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','CmContact','tags','isArray','each','success','errors','push','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','nolimit','getContacts','ContactItemType','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','select','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','field','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv'];(function(_0x24fad1,_0x3de9fb){var _0x572e6c=function(_0x181e3c){while(--_0x181e3c){_0x24fad1['push'](_0x24fad1['shift']());}};_0x572e6c(++_0x3de9fb);}(_0x1553,0x154));var _0x3155=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x1553[_0x3ef2d5];return _0x2fefb2;};'use strict';var emlformat=require(_0x3155('0x0'));var rimraf=require(_0x3155('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3155('0x2'));var BPromise=require(_0x3155('0x3'));var Mustache=require(_0x3155('0x4'));var util=require(_0x3155('0x5'));var path=require('path');var sox=require(_0x3155('0x6'));var csv=require(_0x3155('0x7'));var ejs=require(_0x3155('0x8'));var fs=require('fs');var fs_extra=require(_0x3155('0x9'));var _=require(_0x3155('0xa'));var squel=require(_0x3155('0xb'));var crypto=require('crypto');var jsforce=require(_0x3155('0xc'));var deskjs=require(_0x3155('0xd'));var toCsv=require(_0x3155('0x7'));var querystring=require('querystring');var Papa=require(_0x3155('0xe'));var Redis=require(_0x3155('0xf'));var authService=require(_0x3155('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3155('0x11'));var hardwareService=require(_0x3155('0x12'));var logger=require(_0x3155('0x13'))(_0x3155('0x14'));var utils=require('../../config/utils');var config=require(_0x3155('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3155('0x16'))['db'];var csv_results;config[_0x3155('0x17')]=_[_0x3155('0x18')](config[_0x3155('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3155('0x19'))(new Redis(config[_0x3155('0x17')]));require(_0x3155('0x1a'))['register'](socket);function respondWithStatusCode(_0x42a3f6,_0x5bdc97){_0x5bdc97=_0x5bdc97||0xcc;return function(_0x3464f4){if(_0x3464f4){return _0x42a3f6[_0x3155('0x1b')](_0x5bdc97);}return _0x42a3f6['status'](_0x5bdc97)[_0x3155('0x1c')]();};}function respondWithResult(_0x95d8d2,_0x4041a0){_0x4041a0=_0x4041a0||0xc8;return function(_0x58768a){if(_0x58768a){return _0x95d8d2[_0x3155('0x1d')](_0x4041a0)[_0x3155('0x1e')](_0x58768a);}};}function respondWithFilteredResult(_0xb6556a,_0x15a75f){return function(_0x597366){if(_0x597366){var _0x3406fe=typeof _0x15a75f[_0x3155('0x1f')]===_0x3155('0x20')&&typeof _0x15a75f[_0x3155('0x21')]===_0x3155('0x20');var _0x404a86=_0x597366[_0x3155('0x22')];var _0x9b617d=_0x3406fe?0x0:_0x15a75f[_0x3155('0x1f')];var _0x210acf=_0x3406fe?_0x597366['count']:_0x15a75f['offset']+_0x15a75f['limit'];var _0x5df027;if(_0x210acf>=_0x404a86){_0x210acf=_0x404a86;_0x5df027=0xc8;}else{_0x5df027=0xce;}_0xb6556a[_0x3155('0x1d')](_0x5df027);return _0xb6556a['set'](_0x3155('0x23'),_0x9b617d+'-'+_0x210acf+'/'+_0x404a86)[_0x3155('0x1e')](_0x597366);}return null;};}function patchUpdates(_0xcd65fe){return function(_0x5e179a){try{jsonpatch['apply'](_0x5e179a,_0xcd65fe,!![]);}catch(_0x4e62f2){return BPromise[_0x3155('0x24')](_0x4e62f2);}return _0x5e179a[_0x3155('0x25')]();};}function saveUpdates(_0x3304ba,_0x31a8f3){return function(_0x3e699d){if(_0x3e699d){return _0x3e699d[_0x3155('0x26')](_0x3304ba)[_0x3155('0x27')](function(_0x2ce543){return _0x2ce543;});}return null;};}function removeEntity(_0xe32ac9,_0x477c3a){return function(_0x5c7c4c){if(_0x5c7c4c){return _0x5c7c4c[_0x3155('0x28')]()[_0x3155('0x27')](function(){var _0x48e9f6=_0x5c7c4c[_0x3155('0x29')]({'plain':!![]});var _0x20d7b9=_0x3155('0x2a');return db['UserProfileResource'][_0x3155('0x28')]({'where':{'type':_0x20d7b9,'resourceId':_0x48e9f6['id']}})[_0x3155('0x27')](function(){return _0x5c7c4c;});})[_0x3155('0x27')](function(){_0xe32ac9[_0x3155('0x1d')](0xcc)[_0x3155('0x1c')]();});}};}function handleEntityNotFound(_0x219a29,_0x25d6c1){return function(_0x4bb205){if(!_0x4bb205){_0x219a29[_0x3155('0x1b')](0x194);}return _0x4bb205;};}function handleError(_0x279f80,_0x226a2c){_0x226a2c=_0x226a2c||0x1f4;return function(_0x38201c){logger[_0x3155('0x2b')](_0x38201c[_0x3155('0x2c')]);if(_0x38201c[_0x3155('0x2d')]){delete _0x38201c[_0x3155('0x2d')];}_0x279f80['status'](_0x226a2c)['send'](_0x38201c);};}exports['index']=function(_0x1cc3f6,_0xbf44b9){var _0x4970c4={},_0x5e8a70={},_0x5ec9ce={'count':0x0,'rows':[]};var _0x58f849=_[_0x3155('0x2e')](db['CmList'][_0x3155('0x2f')],function(_0x2f055c){return{'name':_0x2f055c[_0x3155('0x30')],'type':_0x2f055c[_0x3155('0x31')][_0x3155('0x32')]};});_0x5e8a70[_0x3155('0x33')]=_[_0x3155('0x2e')](_0x58f849,'name');_0x5e8a70[_0x3155('0x34')]=_['keys'](_0x1cc3f6[_0x3155('0x34')]);_0x5e8a70[_0x3155('0x35')]=_['intersection'](_0x5e8a70[_0x3155('0x33')],_0x5e8a70['query']);_0x4970c4[_0x3155('0x36')]=_[_0x3155('0x37')](_0x5e8a70[_0x3155('0x33')],qs[_0x3155('0x38')](_0x1cc3f6[_0x3155('0x34')][_0x3155('0x38')]));_0x4970c4[_0x3155('0x36')]=_0x4970c4[_0x3155('0x36')][_0x3155('0x39')]?_0x4970c4['attributes']:_0x5e8a70[_0x3155('0x33')];if(!_0x1cc3f6[_0x3155('0x34')][_0x3155('0x3a')]('nolimit')){_0x4970c4[_0x3155('0x21')]=qs['limit'](_0x1cc3f6[_0x3155('0x34')][_0x3155('0x21')]);_0x4970c4[_0x3155('0x1f')]=qs[_0x3155('0x1f')](_0x1cc3f6['query'][_0x3155('0x1f')]);}_0x4970c4[_0x3155('0x3b')]=qs['sort'](_0x1cc3f6[_0x3155('0x34')][_0x3155('0x3c')]);_0x4970c4[_0x3155('0x3d')]=qs[_0x3155('0x35')](_['pick'](_0x1cc3f6[_0x3155('0x34')],_0x5e8a70[_0x3155('0x35')]),_0x58f849);if(_0x1cc3f6[_0x3155('0x34')][_0x3155('0x3e')]){_0x4970c4[_0x3155('0x3d')]=_['merge'](_0x4970c4[_0x3155('0x3d')],{'$or':_['map'](_0x58f849,function(_0x346758){if(_0x346758[_0x3155('0x31')]!==_0x3155('0x3f')){var _0x6b4d9f={};_0x6b4d9f[_0x346758[_0x3155('0x2d')]]={'$like':'%'+_0x1cc3f6[_0x3155('0x34')]['filter']+'%'};return _0x6b4d9f;}})});}_0x4970c4=_[_0x3155('0x40')]({},_0x4970c4,_0x1cc3f6['options']);var _0x499a49={'where':_0x4970c4[_0x3155('0x3d')]};return db[_0x3155('0x41')][_0x3155('0x22')](_0x499a49)[_0x3155('0x27')](function(_0xc066bd){_0x5ec9ce['count']=_0xc066bd;if(_0x1cc3f6[_0x3155('0x34')][_0x3155('0x42')]){_0x4970c4['include']=[{'all':!![]}];}return db['CmList'][_0x3155('0x43')](_0x4970c4);})['then'](function(_0x4bccf9){_0x5ec9ce[_0x3155('0x44')]=_0x4bccf9;return _0x5ec9ce;})['then'](respondWithFilteredResult(_0xbf44b9,_0x4970c4))[_0x3155('0x45')](handleError(_0xbf44b9,null));};exports['show']=function(_0x45cfdd,_0x5a3ea6){var _0x5a293c={'raw':![],'where':{'id':_0x45cfdd[_0x3155('0x46')]['id']}},_0xc08c4b={};_0xc08c4b[_0x3155('0x33')]=_[_0x3155('0x47')](db[_0x3155('0x41')][_0x3155('0x2f')]);_0xc08c4b[_0x3155('0x34')]=_['keys'](_0x45cfdd[_0x3155('0x34')]);_0xc08c4b[_0x3155('0x35')]=_[_0x3155('0x37')](_0xc08c4b[_0x3155('0x33')],_0xc08c4b['query']);_0x5a293c[_0x3155('0x36')]=_[_0x3155('0x37')](_0xc08c4b['model'],qs[_0x3155('0x38')](_0x45cfdd[_0x3155('0x34')][_0x3155('0x38')]));_0x5a293c[_0x3155('0x36')]=_0x5a293c['attributes']['length']?_0x5a293c[_0x3155('0x36')]:_0xc08c4b[_0x3155('0x33')];if(_0x45cfdd['query'][_0x3155('0x42')]){_0x5a293c[_0x3155('0x48')]=[{'all':!![]}];}_0x5a293c=_[_0x3155('0x40')]({},_0x5a293c,_0x45cfdd[_0x3155('0x49')]);return db[_0x3155('0x41')][_0x3155('0x4a')](_0x5a293c)[_0x3155('0x27')](handleEntityNotFound(_0x5a3ea6,null))[_0x3155('0x27')](respondWithResult(_0x5a3ea6,null))[_0x3155('0x45')](handleError(_0x5a3ea6,null));};exports[_0x3155('0x4b')]=function(_0x189790,_0x15035d){return db[_0x3155('0x41')][_0x3155('0x4b')](_0x189790['body'],{})['then'](function(_0x172f0d){var _0x53f137=_0x189790['user']['get']({'plain':!![]});if(!_0x53f137)throw new Error(_0x3155('0x4c'));if(_0x53f137[_0x3155('0x4d')]===_0x3155('0x4e')){var _0x587e50=_0x172f0d[_0x3155('0x29')]({'plain':!![]});var _0x4bb6c8=_0x3155('0x2a');return db[_0x3155('0x4f')][_0x3155('0x4a')]({'where':{'name':_0x4bb6c8,'userProfileId':_0x53f137[_0x3155('0x50')]},'raw':!![]})['then'](function(_0x5dca56){if(_0x5dca56&&_0x5dca56[_0x3155('0x51')]===0x0){return db[_0x3155('0x52')][_0x3155('0x4b')]({'name':_0x587e50[_0x3155('0x2d')],'resourceId':_0x587e50['id'],'type':_0x5dca56[_0x3155('0x2d')],'sectionId':_0x5dca56['id']},{})[_0x3155('0x27')](function(){return _0x172f0d;});}else{return _0x172f0d;}})[_0x3155('0x45')](function(_0x4f4d6b){logger[_0x3155('0x2b')](_0x3155('0x53'),_0x4f4d6b);throw _0x4f4d6b;});}return _0x172f0d;})[_0x3155('0x27')](respondWithResult(_0x15035d,0xc9))[_0x3155('0x45')](handleError(_0x15035d,null));};exports[_0x3155('0x26')]=function(_0x2a842a,_0x5d298e){if(_0x2a842a['body']['id']){delete _0x2a842a['body']['id'];}return db[_0x3155('0x41')][_0x3155('0x4a')]({'where':{'id':_0x2a842a['params']['id']}})['then'](handleEntityNotFound(_0x5d298e,null))['then'](saveUpdates(_0x2a842a[_0x3155('0x54')],null))[_0x3155('0x27')](respondWithResult(_0x5d298e,null))['catch'](handleError(_0x5d298e,null));};exports[_0x3155('0x28')]=function(_0x2a6e47,_0xb71d18){return db[_0x3155('0x41')][_0x3155('0x4a')]({'where':{'id':_0x2a6e47[_0x3155('0x46')]['id']}})[_0x3155('0x27')](handleEntityNotFound(_0xb71d18,null))[_0x3155('0x27')](removeEntity(_0xb71d18,null))[_0x3155('0x45')](handleError(_0xb71d18,null));};exports[_0x3155('0x55')]=function(_0x31ae99,_0x506200){return db['CmList'][_0x3155('0x55')]()[_0x3155('0x27')](respondWithResult(_0x506200,null))['catch'](handleError(_0x506200,null));};exports[_0x3155('0x56')]=function(_0x26a1f2,_0x15d1be,_0x39f1a4){if(_0x26a1f2[_0x3155('0x54')]['id']){delete _0x26a1f2[_0x3155('0x54')]['id'];}return db[_0x3155('0x41')][_0x3155('0x4a')]({'where':{'id':_0x26a1f2[_0x3155('0x46')]['id']}})[_0x3155('0x27')](handleEntityNotFound(_0x15d1be,null))[_0x3155('0x27')](function(_0x31397c){if(_0x31397c){_0x26a1f2[_0x3155('0x54')][_0x3155('0x57')]=_0x31397c['id'];return db['Disposition']['create'](_0x26a1f2[_0x3155('0x54')]);}})[_0x3155('0x27')](respondWithResult(_0x15d1be,null))[_0x3155('0x45')](handleError(_0x15d1be,null));};exports[_0x3155('0x58')]=function(_0x5953dd,_0x4352bc,_0xf24717){var _0x491157={'raw':![],'where':{}};var _0x3f7289={};var _0x3908ed={'count':0x0,'rows':[]};return db['CmList'][_0x3155('0x59')]({'where':{'id':_0x5953dd['params']['id']}})[_0x3155('0x27')](handleEntityNotFound(_0x4352bc,null))[_0x3155('0x27')](function(_0x246595){if(_0x246595){_0x3f7289[_0x3155('0x33')]=_[_0x3155('0x47')](db[_0x3155('0x5a')][_0x3155('0x2f')]);_0x3f7289[_0x3155('0x34')]=_['keys'](_0x5953dd[_0x3155('0x34')]);_0x3f7289[_0x3155('0x35')]=_[_0x3155('0x37')](_0x3f7289[_0x3155('0x33')],_0x3f7289['query']);_0x491157[_0x3155('0x36')]=_[_0x3155('0x37')](_0x3f7289[_0x3155('0x33')],qs[_0x3155('0x38')](_0x5953dd['query'][_0x3155('0x38')]));_0x491157[_0x3155('0x36')]=_0x491157[_0x3155('0x36')][_0x3155('0x39')]?_0x491157['attributes']:_0x3f7289['model'];if(!_0x5953dd[_0x3155('0x34')]['hasOwnProperty']('nolimit')){_0x491157[_0x3155('0x21')]=qs[_0x3155('0x21')](_0x5953dd['query'][_0x3155('0x21')]);_0x491157[_0x3155('0x1f')]=qs['offset'](_0x5953dd[_0x3155('0x34')][_0x3155('0x1f')]);}_0x491157[_0x3155('0x3b')]=qs[_0x3155('0x3c')](_0x5953dd['query'][_0x3155('0x3c')]);_0x491157[_0x3155('0x3d')]=qs['filters'](_['pick'](_0x5953dd[_0x3155('0x34')],_0x3f7289[_0x3155('0x35')]));_0x491157[_0x3155('0x3d')][_0x3155('0x57')]=_0x246595['id'];if(_0x5953dd['query']['filter']){_0x491157['where']=_[_0x3155('0x40')](_0x491157[_0x3155('0x3d')],{'$or':_[_0x3155('0x2e')](_0x491157[_0x3155('0x36')],function(_0x1e58f8){var _0x411d18={};_0x411d18[_0x1e58f8]={'$like':'%'+_0x5953dd[_0x3155('0x34')][_0x3155('0x3e')]+'%'};return _0x411d18;})});}_0x491157=_[_0x3155('0x40')]({},_0x491157,_0x5953dd[_0x3155('0x49')]);return db[_0x3155('0x5a')]['count']({'where':_0x491157[_0x3155('0x3d')]})[_0x3155('0x27')](function(_0x428288){_0x3908ed[_0x3155('0x22')]=_0x428288;if(_0x5953dd['query']['includeAll']){_0x491157[_0x3155('0x48')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x491157);})[_0x3155('0x27')](function(_0x3d534b){_0x3908ed['rows']=_0x3d534b;return _0x3908ed;});}})[_0x3155('0x27')](respondWithFilteredResult(_0x4352bc,_0x491157))[_0x3155('0x45')](handleError(_0x4352bc,null));};exports[_0x3155('0x5b')]=function(_0x27c4d7,_0x1dd909,_0x25ee67){return db[_0x3155('0x41')][_0x3155('0x4a')]({'where':{'id':_0x27c4d7[_0x3155('0x46')]['id']}})[_0x3155('0x27')](handleEntityNotFound(_0x1dd909,null))[_0x3155('0x27')](function(_0x1e7805){if(_0x1e7805){return _0x1e7805['removeDispositions'](_0x27c4d7['query'][_0x3155('0x5c')]);}})[_0x3155('0x27')](respondWithStatusCode(_0x1dd909,null))['catch'](handleError(_0x1dd909,null));};exports['addContacts']=function(_0x23ac81,_0x3897e1,_0x2a0c1a){return db['CmList'][_0x3155('0x4a')]({'where':{'id':_0x23ac81['params']['id']}})[_0x3155('0x27')](handleEntityNotFound(_0x3897e1,null))['then'](function(_0xd7e4c2){if(_0xd7e4c2){var _0x158524=[];var _0x58aed6={'success':[],'errors':[]};return db[_0x3155('0x5d')][_0x3155('0x55')]()[_0x3155('0x27')](function(_0x2654a8){if(_0x23ac81[_0x3155('0x54')][_0x3155('0x5e')]&&_[_0x3155('0x5f')](_0x23ac81[_0x3155('0x54')]['tags'])){if(_0x23ac81[_0x3155('0x54')][_0x3155('0x5e')][_0x3155('0x39')]){_0x23ac81['body'][_0x3155('0x5e')]=_0x23ac81[_0x3155('0x54')][_0x3155('0x5e')]['join'](';')+';';}else{_0x23ac81['body']['tags']=null;}}else{_0x23ac81['body'][_0x3155('0x5e')]=null;}if(_0x23ac81[_0x3155('0x54')]&&_['isArray'](_0x23ac81[_0x3155('0x54')])){for(var _0x5de79e=0x0;_0x5de79e<_0x23ac81['body'][_0x3155('0x39')];_0x5de79e+=0x1){_0x23ac81[_0x3155('0x54')][_0x5de79e]['ListId']=_0x23ac81[_0x3155('0x46')]['id'];_0x158524['push'](_0x23ac81[_0x3155('0x54')][_0x5de79e]);}return BPromise[_0x3155('0x60')](_0x158524,function(_0x9ed937){return db[_0x3155('0x5d')][_0x3155('0x4b')](_['omit'](_0x9ed937,[_0x3155('0x5c'),'id'])||{},{'fields':_[_0x3155('0x47')](_0x2654a8),'raw':!![]})[_0x3155('0x27')](function(_0x452824){_0x58aed6[_0x3155('0x61')]['push'](_0x452824['dataValues']);})['catch'](function(_0x43fc2b){_0x58aed6[_0x3155('0x62')][_0x3155('0x63')]({'data':_0x9ed937,'error':_0x43fc2b[_0x3155('0x64')]});});})[_0x3155('0x27')](function(_0x196914){return _0x58aed6;})[_0x3155('0x45')](function(_0x1d5e3d){return _0x1d5e3d;});}else{_0x3897e1[_0x3155('0x1d')](0x190)['json']({'message':_0x3155('0x65')});}});}})[_0x3155('0x27')](respondWithResult(_0x3897e1,null))[_0x3155('0x45')](handleError(_0x3897e1,null));};exports['getContacts']=function(_0x2bc0d8,_0x71df13,_0x27a77d){var _0x504fc2;return db[_0x3155('0x41')][_0x3155('0x4a')]({'where':{'id':_0x2bc0d8['params']['id']},'include':[{'model':db[_0x3155('0x66')],'as':_0x3155('0x67')}]})[_0x3155('0x27')](handleEntityNotFound(_0x71df13,null))['then'](function(_0x10b55c){if(_0x10b55c){_0x504fc2=_0x10b55c;return db[_0x3155('0x5d')][_0x3155('0x2f')];}})[_0x3155('0x27')](function(_0x5d1460){if(_0x5d1460){var _0x1a89bd={};var _0xc7c8bf={};_0xc7c8bf[_0x3155('0x33')]=_[_0x3155('0x68')](_['keys'](_0x5d1460),_[_0x3155('0x2e')](_0x504fc2['CustomFields'],function(_0x3c770e){return util[_0x3155('0x69')](_0x3155('0x6a'),_0x3c770e['id']);}));_0xc7c8bf[_0x3155('0x34')]=_['keys'](_0x2bc0d8[_0x3155('0x34')]);_0xc7c8bf[_0x3155('0x35')]=_[_0x3155('0x37')](_0xc7c8bf['model'],_0xc7c8bf[_0x3155('0x34')]);_0x1a89bd[_0x3155('0x36')]=_[_0x3155('0x37')](_0xc7c8bf['model'],qs['fields'](_0x2bc0d8[_0x3155('0x34')][_0x3155('0x38')]));_0x1a89bd[_0x3155('0x36')]=_0x1a89bd[_0x3155('0x36')][_0x3155('0x39')]?_0x1a89bd[_0x3155('0x36')]:_0xc7c8bf[_0x3155('0x33')];if(!_0x2bc0d8['query'][_0x3155('0x3a')](_0x3155('0x6b'))){_0x1a89bd['limit']=qs[_0x3155('0x21')](_0x2bc0d8[_0x3155('0x34')][_0x3155('0x21')]);_0x1a89bd[_0x3155('0x1f')]=qs[_0x3155('0x1f')](_0x2bc0d8[_0x3155('0x34')]['offset']);}_0x1a89bd[_0x3155('0x3b')]=qs[_0x3155('0x3c')](_0x2bc0d8[_0x3155('0x34')][_0x3155('0x3c')]);_0x1a89bd[_0x3155('0x3d')]=qs[_0x3155('0x35')](_['pick'](_0x2bc0d8[_0x3155('0x34')],_0xc7c8bf[_0x3155('0x35')]));_0x1a89bd['raw']=!![];if(_0x2bc0d8[_0x3155('0x34')][_0x3155('0x3e')]){_0x1a89bd[_0x3155('0x3d')]=_['merge'](_0x1a89bd[_0x3155('0x3d')],{'$or':_[_0x3155('0x2e')](_0x1a89bd[_0x3155('0x36')],function(_0x3efafc){var _0x53a55={};_0x53a55[_0x3efafc]={'$like':'%'+_0x2bc0d8[_0x3155('0x34')][_0x3155('0x3e')]+'%'};return _0x53a55;})});}_0x1a89bd=_[_0x3155('0x40')]({},_0x1a89bd,_0x2bc0d8[_0x3155('0x49')]);return _0x504fc2[_0x3155('0x6c')](_0x1a89bd);}})[_0x3155('0x27')](respondWithResult(_0x71df13,null))[_0x3155('0x45')](handleError(_0x71df13,null));};exports['getContactsCsv']=function(_0x4845a7,_0x5de7f1,_0x3b8798){var _0x5ebf85;var _0x93fa75;var _0x4ebade;var _0x3bf29b=_0x4845a7[_0x3155('0x46')]['id'];csv_results=[];return db[_0x3155('0x6d')]['findAll']({'attributes':['id',_0x3155('0x2d')],'raw':!![],'order':[_0x3155('0x6e')]})[_0x3155('0x27')](function(_0x5d6eed){_0x5ebf85=_0x5d6eed;var _0x47da7a=_[_0x3155('0x47')](db[_0x3155('0x5d')][_0x3155('0x2f')]);return db[_0x3155('0x66')][_0x3155('0x43')]({'raw':!![],'attributes':['id',_0x3155('0x6f')]})[_0x3155('0x27')](function(_0x5f57c1){_0x93fa75=_0x5f57c1;var _0x570ef7=squel['select']()[_0x3155('0x38')](_0x47da7a)[_0x3155('0x70')](_0x3155('0x71'),'c')[_0x3155('0x3d')](_0x3155('0x72'),_0x3bf29b)[_0x3155('0x3d')](_0x3155('0x73'))[_0x3155('0x74')]();for(var _0x1194d2=0x0;_0x1194d2<_0x93fa75[_0x3155('0x39')];_0x1194d2++){_0x570ef7['field'](_0x3155('0x75')+_0x93fa75[_0x1194d2]['id'],_0x3155('0x76')+_0x93fa75[_0x1194d2][_0x3155('0x6f')]);}for(var _0x1194d2=0x0;_0x1194d2<_0x5ebf85['length'];_0x1194d2++){_0x570ef7['field'](squel[_0x3155('0x77')]()['field'](_0x3155('0x78'))[_0x3155('0x70')]('cm_contact_has_items')[_0x3155('0x3d')](_0x3155('0x79'),_0x5ebf85[_0x1194d2]['id'])[_0x3155('0x3d')](_0x3155('0x7a')),'additionalPhone_'+_0x5ebf85[_0x1194d2]['name']);_0x570ef7['field'](squel[_0x3155('0x77')]()[_0x3155('0x7b')](_0x3155('0x7c'))[_0x3155('0x70')](_0x3155('0x7d'))['where']('ItemTypeId\x20=\x20?',_0x5ebf85[_0x1194d2]['id'])[_0x3155('0x3d')](_0x3155('0x7a')),_0x3155('0x7e')+_0x5ebf85[_0x1194d2][_0x3155('0x2d')]);}var _0x25f329=[];_0x25f329[_0x3155('0x63')](_0x570ef7['toString']());BPromise[_0x3155('0x60')](_0x25f329,handleQuery)[_0x3155('0x27')](function(_0x16b7bb){handleQuery(_0x570ef7[_0x3155('0x7f')]());var _0x3f98e9=csv_results[0x0];if(!_[_0x3155('0x80')](_0x3f98e9)){var _0x4c6e4a=toCsv(_0x3f98e9);var _0x4538a2=Date[_0x3155('0x81')]();fs[_0x3155('0x82')](util[_0x3155('0x69')](_0x3155('0x83'),_0x3bf29b,_0x4538a2),_0x4c6e4a);_0x5de7f1['setHeader'](_0x3155('0x84'),'attachment;\x20filename='+util[_0x3155('0x69')](_0x3155('0x85'),_0x3bf29b,_0x4538a2));_0x5de7f1[_0x3155('0x86')](_0x3155('0x87'),_0x3155('0x88'));return _0x5de7f1['download'](util[_0x3155('0x69')](_0x3155('0x83'),_0x3bf29b,_0x4538a2));}else{return _0x5de7f1[_0x3155('0x1b')](0xcc);}});});});};exports['addCustomField']=function(_0x344c99,_0x359654,_0xe736cf){var _0x4b8573;delete _0x344c99[_0x3155('0x54')]['id'];return db[_0x3155('0x41')][_0x3155('0x59')]({'where':{'id':_0x344c99['params']['id']}})[_0x3155('0x27')](handleEntityNotFound(_0x359654,null))[_0x3155('0x27')](function(_0xc732de){if(_0xc732de){return db[_0x3155('0x89')][_0x3155('0x8a')](function(_0x4adbf1){return db['CmCustomField'][_0x3155('0x4b')](_0x344c99['body'],{'transaction':_0x4adbf1})[_0x3155('0x27')](function(_0x4710ac){_0x4b8573=_0x4710ac;return _0xc732de[_0x3155('0x8b')](_0x4710ac,{'transaction':_0x4adbf1});})[_0x3155('0x27')](function(){var _0x23c975={'type':db[_0x3155('0x8c')][_0x3155('0x8d')],'transaction':_0x4adbf1};switch(_0x344c99[_0x3155('0x54')][_0x3155('0x31')]){case _0x3155('0x8e'):_0x23c975['type']=db['Sequelize'][_0x3155('0x8d')];break;case'number':_0x23c975['type']=db[_0x3155('0x8c')][_0x3155('0x8f')];break;case _0x3155('0x90'):_0x23c975[_0x3155('0x31')]=db[_0x3155('0x8c')]['BOOLEAN'];_0x23c975[_0x3155('0x91')]=![];break;default:}return db['sequelize']['queryInterface'][_0x3155('0x92')](_0x3155('0x71'),util[_0x3155('0x69')]('cf_%s',_0x4b8573['id']),_0x23c975);})[_0x3155('0x27')](function(){return _0x4b8573;});});}})[_0x3155('0x27')](respondWithResult(_0x359654,null))[_0x3155('0x45')](handleError(_0x359654,null));};exports[_0x3155('0x93')]=function(_0x1ab622,_0x63d695,_0x3b3f04){var _0x6ba754={};var _0xcebef0={};var _0x3d8f13;var _0x27b02c;return db[_0x3155('0x41')][_0x3155('0x59')]({'where':{'id':_0x1ab622[_0x3155('0x46')]['id']}})[_0x3155('0x27')](handleEntityNotFound(_0x63d695,null))[_0x3155('0x27')](function(_0x43d16d){if(_0x43d16d){_0x3d8f13=_0x43d16d;_0xcebef0[_0x3155('0x33')]=_[_0x3155('0x47')](db[_0x3155('0x66')][_0x3155('0x2f')]);_0xcebef0[_0x3155('0x34')]=_[_0x3155('0x47')](_0x1ab622['query']);_0xcebef0[_0x3155('0x35')]=_['intersection'](_0xcebef0[_0x3155('0x33')],_0xcebef0[_0x3155('0x34')]);_0x6ba754[_0x3155('0x36')]=_[_0x3155('0x37')](_0xcebef0[_0x3155('0x33')],qs[_0x3155('0x38')](_0x1ab622[_0x3155('0x34')][_0x3155('0x38')]));_0x6ba754[_0x3155('0x36')]=_0x6ba754[_0x3155('0x36')][_0x3155('0x39')]?_0x6ba754[_0x3155('0x36')]:_0xcebef0[_0x3155('0x33')];_0x6ba754[_0x3155('0x3b')]=qs['sort'](_0x1ab622['query'][_0x3155('0x3c')]);_0x6ba754[_0x3155('0x3d')]=qs[_0x3155('0x35')](_[_0x3155('0x94')](_0x1ab622[_0x3155('0x34')],_0xcebef0[_0x3155('0x35')]));_0x6ba754['where']=_['merge'](_0x6ba754[_0x3155('0x3d')],{'$or':[{'ListId':_0x43d16d['id']},{'ListId':null}]});if(_0x1ab622[_0x3155('0x34')][_0x3155('0x3e')]){_0x6ba754[_0x3155('0x3d')]=_[_0x3155('0x40')](_0x6ba754[_0x3155('0x3d')],{'$or':_[_0x3155('0x2e')](_0x6ba754[_0x3155('0x36')],function(_0x28aa71){var _0x152bef={};_0x152bef[_0x28aa71]={'$like':'%'+_0x1ab622['query'][_0x3155('0x3e')]+'%'};return _0x152bef;})});}_0x6ba754=_[_0x3155('0x40')]({},_0x6ba754,_0x1ab622[_0x3155('0x49')]);return db['CmCustomField'][_0x3155('0x95')](_0x6ba754);}})[_0x3155('0x27')](respondWithResult(_0x63d695,null))['catch'](handleError(_0x63d695,null));};exports['getGlobalCustomFields']=function(_0x5490e7,_0x4f9715){return db[_0x3155('0x66')][_0x3155('0x95')]({'where':{'ListId':null}})[_0x3155('0x27')](handleEntityNotFound(_0x4f9715,null))[_0x3155('0x27')](function(_0x25b26d){return _0x25b26d;})[_0x3155('0x27')](respondWithResult(_0x4f9715,null))[_0x3155('0x45')](handleError(_0x4f9715,null));};exports[_0x3155('0x96')]=function(_0x535654,_0x3d7960,_0x56a09d){return db[_0x3155('0x41')][_0x3155('0x4a')]({'where':{'id':_0x535654['params']['id']}})[_0x3155('0x27')](handleEntityNotFound(_0x3d7960,null))[_0x3155('0x27')](function(_0x9d79eb){if(_0x9d79eb){return _0x9d79eb[_0x3155('0x96')](_0x535654[_0x3155('0x54')][_0x3155('0x5c')],_[_0x3155('0x97')](_0x535654[_0x3155('0x54')],[_0x3155('0x5c'),'id'])||{})['spread'](function(_0x89c517){for(var _0x39c1e8=0x0;_0x39c1e8<_0x535654['body']['ids']['length'];_0x39c1e8+=0x1){socket[_0x3155('0x98')](_0x3155('0x99'),{'UserId':Number(_0x535654[_0x3155('0x54')][_0x3155('0x5c')][_0x39c1e8]),'CmListId':Number(_0x535654[_0x3155('0x46')]['id'])});}return _0x89c517;});}})['then'](respondWithResult(_0x3d7960,null))[_0x3155('0x45')](handleError(_0x3d7960,null));};exports[_0x3155('0x9a')]=function(_0x929f8b,_0x3b13c4,_0x161204){return db[_0x3155('0x41')][_0x3155('0x4a')]({'where':{'id':_0x929f8b[_0x3155('0x46')]['id']}})[_0x3155('0x27')](handleEntityNotFound(_0x3b13c4,null))['then'](function(_0x51dec7){if(_0x51dec7){return _0x51dec7[_0x3155('0x9a')](_0x929f8b[_0x3155('0x34')][_0x3155('0x5c')])[_0x3155('0x27')](function(){if(_[_0x3155('0x5f')](_0x929f8b[_0x3155('0x34')][_0x3155('0x5c')])){for(var _0x55893c=0x0;_0x55893c<_0x929f8b[_0x3155('0x34')]['ids'][_0x3155('0x39')];_0x55893c+=0x1){socket['emit'](_0x3155('0x9b'),{'UserId':Number(_0x929f8b[_0x3155('0x34')][_0x3155('0x5c')][_0x55893c]),'CmListId':Number(_0x929f8b['params']['id'])});}}else{socket[_0x3155('0x98')]('userCmList:remove',{'UserId':Number(_0x929f8b[_0x3155('0x34')][_0x3155('0x5c')]),'CmListId':Number(_0x929f8b[_0x3155('0x46')]['id'])});}});}})[_0x3155('0x27')](respondWithStatusCode(_0x3b13c4,null))[_0x3155('0x45')](handleError(_0x3b13c4,null));};exports[_0x3155('0x9c')]=function(_0x14d3cb,_0x1dbabb,_0x9eaba2){var _0x505acc={};var _0x40fa21={};var _0x3f6352;var _0x1a5bec;return db[_0x3155('0x41')][_0x3155('0x59')]({'where':{'id':_0x14d3cb[_0x3155('0x46')]['id']}})[_0x3155('0x27')](handleEntityNotFound(_0x1dbabb,null))[_0x3155('0x27')](function(_0x246847){if(_0x246847){_0x3f6352=_0x246847;_0x40fa21[_0x3155('0x33')]=_[_0x3155('0x47')](db['User'][_0x3155('0x2f')]);_0x40fa21['query']=_[_0x3155('0x47')](_0x14d3cb[_0x3155('0x34')]);_0x40fa21[_0x3155('0x35')]=_[_0x3155('0x37')](_0x40fa21['model'],_0x40fa21[_0x3155('0x34')]);_0x505acc[_0x3155('0x36')]=_['intersection'](_0x40fa21[_0x3155('0x33')],qs[_0x3155('0x38')](_0x14d3cb[_0x3155('0x34')]['fields']));_0x505acc['attributes']=_0x505acc[_0x3155('0x36')]['length']?_0x505acc['attributes']:_0x40fa21[_0x3155('0x33')];_0x505acc[_0x3155('0x3b')]=qs[_0x3155('0x3c')](_0x14d3cb['query'][_0x3155('0x3c')]);_0x505acc[_0x3155('0x3d')]=qs[_0x3155('0x35')](_[_0x3155('0x94')](_0x14d3cb[_0x3155('0x34')],_0x40fa21['filters']));if(_0x14d3cb['query'][_0x3155('0x3e')]){_0x505acc[_0x3155('0x3d')]=_['merge'](_0x505acc[_0x3155('0x3d')],{'$or':_['map'](_0x505acc[_0x3155('0x36')],function(_0x3b2cf7){var _0x1453f2={};_0x1453f2[_0x3b2cf7]={'$like':'%'+_0x14d3cb[_0x3155('0x34')][_0x3155('0x3e')]+'%'};return _0x1453f2;})});}_0x505acc=_[_0x3155('0x40')]({},_0x505acc,_0x14d3cb[_0x3155('0x49')]);return _0x3f6352['getAgents'](_0x505acc);}})[_0x3155('0x27')](function(_0x5c5171){if(_0x5c5171){_0x1a5bec=_0x5c5171[_0x3155('0x39')];if(!_0x14d3cb['query'][_0x3155('0x3a')](_0x3155('0x6b'))){_0x505acc[_0x3155('0x21')]=qs['limit'](_0x14d3cb[_0x3155('0x34')][_0x3155('0x21')]);_0x505acc[_0x3155('0x1f')]=qs[_0x3155('0x1f')](_0x14d3cb[_0x3155('0x34')][_0x3155('0x1f')]);}return _0x3f6352[_0x3155('0x9c')](_0x505acc);}})[_0x3155('0x27')](function(_0x307d37){if(_0x307d37){return _0x307d37?{'count':_0x1a5bec,'rows':_0x307d37}:null;}})[_0x3155('0x27')](respondWithResult(_0x1dbabb,null))[_0x3155('0x45')](handleError(_0x1dbabb,null));};function handleQuery(_0x1be318){logger[_0x3155('0x9d')](_0x1be318);return db[_0x3155('0x89')][_0x3155('0x34')](_0x1be318)[_0x3155('0x9e')](function(_0x54e2fc){csv_results['push'](_0x54e2fc);})[_0x3155('0x45')](function(_0x387a93){logger[_0x3155('0x2b')](_0x387a93[_0x3155('0x64')]);});} \ No newline at end of file +var _0x8be8=['addDisposition','Disposition','findOne','order','removeDispositions','addContacts','CmContact','tags','isArray','join','ListId','push','each','omit','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','map','format','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./cmList.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','CmList','include','findAll','rows','catch','show','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','describe'];(function(_0x1b4034,_0x518bdc){var _0x2cb5ff=function(_0x3fd0d7){while(--_0x3fd0d7){_0x1b4034['push'](_0x1b4034['shift']());}};_0x2cb5ff(++_0x518bdc);}(_0x8be8,0xf6));var _0x88be=function(_0x279455,_0x9bcc63){_0x279455=_0x279455-0x0;var _0x1d5e70=_0x8be8[_0x279455];return _0x1d5e70;};'use strict';var emlformat=require(_0x88be('0x0'));var rimraf=require(_0x88be('0x1'));var zipdir=require(_0x88be('0x2'));var jsonpatch=require(_0x88be('0x3'));var rp=require(_0x88be('0x4'));var moment=require(_0x88be('0x5'));var BPromise=require(_0x88be('0x6'));var Mustache=require(_0x88be('0x7'));var util=require(_0x88be('0x8'));var path=require('path');var sox=require(_0x88be('0x9'));var csv=require('to-csv');var ejs=require(_0x88be('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88be('0xb'));var squel=require(_0x88be('0xc'));var crypto=require(_0x88be('0xd'));var jsforce=require(_0x88be('0xe'));var deskjs=require(_0x88be('0xf'));var toCsv=require(_0x88be('0x10'));var querystring=require('querystring');var Papa=require(_0x88be('0x11'));var Redis=require('ioredis');var authService=require(_0x88be('0x12'));var qs=require(_0x88be('0x13'));var as=require(_0x88be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88be('0x15'))(_0x88be('0x16'));var utils=require(_0x88be('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88be('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x88be('0x19')]=_['defaults'](config['redis'],{'host':_0x88be('0x1a'),'port':0x18eb});var socket=require(_0x88be('0x1b'))(new Redis(config[_0x88be('0x19')]));require(_0x88be('0x1c'))[_0x88be('0x1d')](socket);function respondWithStatusCode(_0x209623,_0x14d2fc){_0x14d2fc=_0x14d2fc||0xcc;return function(_0x18deca){if(_0x18deca){return _0x209623['sendStatus'](_0x14d2fc);}return _0x209623[_0x88be('0x1e')](_0x14d2fc)[_0x88be('0x1f')]();};}function respondWithResult(_0x44a12f,_0x4da122){_0x4da122=_0x4da122||0xc8;return function(_0x5658e4){if(_0x5658e4){return _0x44a12f[_0x88be('0x1e')](_0x4da122)['json'](_0x5658e4);}};}function respondWithFilteredResult(_0x3566e7,_0x40d34c){return function(_0xf43785){if(_0xf43785){var _0x435ba8=typeof _0x40d34c[_0x88be('0x20')]===_0x88be('0x21')&&typeof _0x40d34c[_0x88be('0x22')]===_0x88be('0x21');var _0x53fb85=_0xf43785[_0x88be('0x23')];var _0x485a55=_0x435ba8?0x0:_0x40d34c[_0x88be('0x20')];var _0x49ac52=_0x435ba8?_0xf43785['count']:_0x40d34c[_0x88be('0x20')]+_0x40d34c[_0x88be('0x22')];var _0x4079f7;if(_0x49ac52>=_0x53fb85){_0x49ac52=_0x53fb85;_0x4079f7=0xc8;}else{_0x4079f7=0xce;}_0x3566e7['status'](_0x4079f7);return _0x3566e7[_0x88be('0x24')](_0x88be('0x25'),_0x485a55+'-'+_0x49ac52+'/'+_0x53fb85)[_0x88be('0x26')](_0xf43785);}return null;};}function patchUpdates(_0x213580){return function(_0x3eb7c7){try{jsonpatch[_0x88be('0x27')](_0x3eb7c7,_0x213580,!![]);}catch(_0x466b19){return BPromise[_0x88be('0x28')](_0x466b19);}return _0x3eb7c7[_0x88be('0x29')]();};}function saveUpdates(_0x215024,_0x380ae7){return function(_0x1e336b){if(_0x1e336b){return _0x1e336b[_0x88be('0x2a')](_0x215024)[_0x88be('0x2b')](function(_0x1c3e45){return _0x1c3e45;});}return null;};}function removeEntity(_0x2be310,_0x5c1671){return function(_0x13eddd){if(_0x13eddd){return _0x13eddd[_0x88be('0x2c')]()[_0x88be('0x2b')](function(){var _0x58b671=_0x13eddd[_0x88be('0x2d')]({'plain':!![]});var _0x381a99=_0x88be('0x2e');return db[_0x88be('0x2f')][_0x88be('0x2c')]({'where':{'type':_0x381a99,'resourceId':_0x58b671['id']}})['then'](function(){return _0x13eddd;});})[_0x88be('0x2b')](function(){_0x2be310[_0x88be('0x1e')](0xcc)[_0x88be('0x1f')]();});}};}function handleEntityNotFound(_0x537c0b,_0x3a08fa){return function(_0x2fe023){if(!_0x2fe023){_0x537c0b[_0x88be('0x30')](0x194);}return _0x2fe023;};}function handleError(_0x2f95ff,_0x23060c){_0x23060c=_0x23060c||0x1f4;return function(_0x134910){logger[_0x88be('0x31')](_0x134910[_0x88be('0x32')]);if(_0x134910[_0x88be('0x33')]){delete _0x134910['name'];}_0x2f95ff[_0x88be('0x1e')](_0x23060c)[_0x88be('0x34')](_0x134910);};}exports[_0x88be('0x35')]=function(_0x23ccbe,_0x382be6){var _0x222e36={},_0x1e9108={},_0x2de7e3={'count':0x0,'rows':[]};var _0x1ff408=_['map'](db['CmList'][_0x88be('0x36')],function(_0x36c3a8){return{'name':_0x36c3a8[_0x88be('0x37')],'type':_0x36c3a8['type']['key']};});_0x1e9108[_0x88be('0x38')]=_['map'](_0x1ff408,_0x88be('0x33'));_0x1e9108['query']=_[_0x88be('0x39')](_0x23ccbe[_0x88be('0x3a')]);_0x1e9108[_0x88be('0x3b')]=_[_0x88be('0x3c')](_0x1e9108[_0x88be('0x38')],_0x1e9108[_0x88be('0x3a')]);_0x222e36[_0x88be('0x3d')]=_[_0x88be('0x3c')](_0x1e9108[_0x88be('0x38')],qs[_0x88be('0x3e')](_0x23ccbe[_0x88be('0x3a')][_0x88be('0x3e')]));_0x222e36[_0x88be('0x3d')]=_0x222e36[_0x88be('0x3d')][_0x88be('0x3f')]?_0x222e36[_0x88be('0x3d')]:_0x1e9108[_0x88be('0x38')];if(!_0x23ccbe[_0x88be('0x3a')][_0x88be('0x40')](_0x88be('0x41'))){_0x222e36[_0x88be('0x22')]=qs[_0x88be('0x22')](_0x23ccbe[_0x88be('0x3a')][_0x88be('0x22')]);_0x222e36['offset']=qs['offset'](_0x23ccbe['query'][_0x88be('0x20')]);}_0x222e36['order']=qs[_0x88be('0x42')](_0x23ccbe[_0x88be('0x3a')][_0x88be('0x42')]);_0x222e36[_0x88be('0x43')]=qs[_0x88be('0x3b')](_[_0x88be('0x44')](_0x23ccbe[_0x88be('0x3a')],_0x1e9108['filters']),_0x1ff408);if(_0x23ccbe['query'][_0x88be('0x45')]){_0x222e36[_0x88be('0x43')]=_[_0x88be('0x46')](_0x222e36[_0x88be('0x43')],{'$or':_['map'](_0x1ff408,function(_0xa7b71a){if(_0xa7b71a[_0x88be('0x47')]!==_0x88be('0x48')){var _0x25cf8c={};_0x25cf8c[_0xa7b71a['name']]={'$like':'%'+_0x23ccbe[_0x88be('0x3a')][_0x88be('0x45')]+'%'};return _0x25cf8c;}})});}_0x222e36=_[_0x88be('0x46')]({},_0x222e36,_0x23ccbe[_0x88be('0x49')]);var _0x3fcb76={'where':_0x222e36[_0x88be('0x43')]};return db[_0x88be('0x4a')][_0x88be('0x23')](_0x3fcb76)[_0x88be('0x2b')](function(_0x5261d7){_0x2de7e3[_0x88be('0x23')]=_0x5261d7;if(_0x23ccbe['query']['includeAll']){_0x222e36[_0x88be('0x4b')]=[{'all':!![]}];}return db[_0x88be('0x4a')][_0x88be('0x4c')](_0x222e36);})[_0x88be('0x2b')](function(_0x4aca27){_0x2de7e3[_0x88be('0x4d')]=_0x4aca27;return _0x2de7e3;})[_0x88be('0x2b')](respondWithFilteredResult(_0x382be6,_0x222e36))[_0x88be('0x4e')](handleError(_0x382be6,null));};exports[_0x88be('0x4f')]=function(_0x32b893,_0x496f4c){var _0x25456c={'raw':![],'where':{'id':_0x32b893['params']['id']}},_0x249cc7={};_0x249cc7[_0x88be('0x38')]=_['keys'](db[_0x88be('0x4a')]['rawAttributes']);_0x249cc7[_0x88be('0x3a')]=_[_0x88be('0x39')](_0x32b893['query']);_0x249cc7[_0x88be('0x3b')]=_[_0x88be('0x3c')](_0x249cc7[_0x88be('0x38')],_0x249cc7[_0x88be('0x3a')]);_0x25456c[_0x88be('0x3d')]=_[_0x88be('0x3c')](_0x249cc7['model'],qs['fields'](_0x32b893[_0x88be('0x3a')][_0x88be('0x3e')]));_0x25456c[_0x88be('0x3d')]=_0x25456c[_0x88be('0x3d')][_0x88be('0x3f')]?_0x25456c[_0x88be('0x3d')]:_0x249cc7['model'];if(_0x32b893['query'][_0x88be('0x50')]){_0x25456c[_0x88be('0x4b')]=[{'all':!![]}];}_0x25456c=_[_0x88be('0x46')]({},_0x25456c,_0x32b893[_0x88be('0x49')]);return db['CmList']['find'](_0x25456c)[_0x88be('0x2b')](handleEntityNotFound(_0x496f4c,null))['then'](respondWithResult(_0x496f4c,null))[_0x88be('0x4e')](handleError(_0x496f4c,null));};exports[_0x88be('0x51')]=function(_0x40cfbd,_0x58b542){return db[_0x88be('0x4a')][_0x88be('0x51')](_0x40cfbd['body'],{})[_0x88be('0x2b')](function(_0x582efa){var _0x1956ae=_0x40cfbd['user'][_0x88be('0x2d')]({'plain':!![]});if(!_0x1956ae)throw new Error(_0x88be('0x52'));if(_0x1956ae[_0x88be('0x53')]===_0x88be('0x54')){var _0xffc8a9=_0x582efa[_0x88be('0x2d')]({'plain':!![]});var _0x33d797=_0x88be('0x2e');return db['UserProfileSection'][_0x88be('0x55')]({'where':{'name':_0x33d797,'userProfileId':_0x1956ae[_0x88be('0x56')]},'raw':!![]})['then'](function(_0x44dd80){if(_0x44dd80&&_0x44dd80[_0x88be('0x57')]===0x0){return db['UserProfileResource'][_0x88be('0x51')]({'name':_0xffc8a9['name'],'resourceId':_0xffc8a9['id'],'type':_0x44dd80[_0x88be('0x33')],'sectionId':_0x44dd80['id']},{})[_0x88be('0x2b')](function(){return _0x582efa;});}else{return _0x582efa;}})[_0x88be('0x4e')](function(_0x282ab7){logger['error'](_0x88be('0x58'),_0x282ab7);throw _0x282ab7;});}return _0x582efa;})[_0x88be('0x2b')](respondWithResult(_0x58b542,0xc9))[_0x88be('0x4e')](handleError(_0x58b542,null));};exports[_0x88be('0x2a')]=function(_0x4f9bee,_0x2cac33){if(_0x4f9bee['body']['id']){delete _0x4f9bee['body']['id'];}return db[_0x88be('0x4a')]['find']({'where':{'id':_0x4f9bee[_0x88be('0x59')]['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0x2cac33,null))[_0x88be('0x2b')](saveUpdates(_0x4f9bee[_0x88be('0x5a')],null))[_0x88be('0x2b')](respondWithResult(_0x2cac33,null))['catch'](handleError(_0x2cac33,null));};exports[_0x88be('0x2c')]=function(_0x44ef72,_0x29ad7e){return db[_0x88be('0x4a')][_0x88be('0x55')]({'where':{'id':_0x44ef72[_0x88be('0x59')]['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0x29ad7e,null))['then'](removeEntity(_0x29ad7e,null))[_0x88be('0x4e')](handleError(_0x29ad7e,null));};exports['describe']=function(_0x14da48,_0x249ffc){return db[_0x88be('0x4a')][_0x88be('0x5b')]()[_0x88be('0x2b')](respondWithResult(_0x249ffc,null))[_0x88be('0x4e')](handleError(_0x249ffc,null));};exports[_0x88be('0x5c')]=function(_0x2d1b73,_0x5bbb8f,_0x50355b){if(_0x2d1b73[_0x88be('0x5a')]['id']){delete _0x2d1b73['body']['id'];}return db[_0x88be('0x4a')][_0x88be('0x55')]({'where':{'id':_0x2d1b73[_0x88be('0x59')]['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0x5bbb8f,null))['then'](function(_0x3c0772){if(_0x3c0772){_0x2d1b73[_0x88be('0x5a')]['ListId']=_0x3c0772['id'];return db[_0x88be('0x5d')][_0x88be('0x51')](_0x2d1b73[_0x88be('0x5a')]);}})['then'](respondWithResult(_0x5bbb8f,null))[_0x88be('0x4e')](handleError(_0x5bbb8f,null));};exports['getDispositions']=function(_0x4d9f77,_0x106ff5,_0x12df66){var _0x7b240a={'raw':![],'where':{}};var _0x4b409f={};var _0x30200f={'count':0x0,'rows':[]};return db['CmList'][_0x88be('0x5e')]({'where':{'id':_0x4d9f77[_0x88be('0x59')]['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0x106ff5,null))['then'](function(_0x427823){if(_0x427823){_0x4b409f[_0x88be('0x38')]=_[_0x88be('0x39')](db[_0x88be('0x5d')][_0x88be('0x36')]);_0x4b409f[_0x88be('0x3a')]=_['keys'](_0x4d9f77['query']);_0x4b409f['filters']=_[_0x88be('0x3c')](_0x4b409f[_0x88be('0x38')],_0x4b409f[_0x88be('0x3a')]);_0x7b240a[_0x88be('0x3d')]=_[_0x88be('0x3c')](_0x4b409f['model'],qs[_0x88be('0x3e')](_0x4d9f77[_0x88be('0x3a')][_0x88be('0x3e')]));_0x7b240a['attributes']=_0x7b240a[_0x88be('0x3d')][_0x88be('0x3f')]?_0x7b240a[_0x88be('0x3d')]:_0x4b409f['model'];if(!_0x4d9f77[_0x88be('0x3a')][_0x88be('0x40')](_0x88be('0x41'))){_0x7b240a[_0x88be('0x22')]=qs[_0x88be('0x22')](_0x4d9f77[_0x88be('0x3a')][_0x88be('0x22')]);_0x7b240a[_0x88be('0x20')]=qs[_0x88be('0x20')](_0x4d9f77[_0x88be('0x3a')][_0x88be('0x20')]);}_0x7b240a[_0x88be('0x5f')]=qs[_0x88be('0x42')](_0x4d9f77[_0x88be('0x3a')][_0x88be('0x42')]);_0x7b240a[_0x88be('0x43')]=qs[_0x88be('0x3b')](_[_0x88be('0x44')](_0x4d9f77[_0x88be('0x3a')],_0x4b409f['filters']));_0x7b240a[_0x88be('0x43')]['ListId']=_0x427823['id'];if(_0x4d9f77[_0x88be('0x3a')]['filter']){_0x7b240a[_0x88be('0x43')]=_[_0x88be('0x46')](_0x7b240a[_0x88be('0x43')],{'$or':_['map'](_0x7b240a['attributes'],function(_0x21e63d){var _0x30da13={};_0x30da13[_0x21e63d]={'$like':'%'+_0x4d9f77['query'][_0x88be('0x45')]+'%'};return _0x30da13;})});}_0x7b240a=_[_0x88be('0x46')]({},_0x7b240a,_0x4d9f77[_0x88be('0x49')]);return db[_0x88be('0x5d')][_0x88be('0x23')]({'where':_0x7b240a[_0x88be('0x43')]})[_0x88be('0x2b')](function(_0x203600){_0x30200f['count']=_0x203600;if(_0x4d9f77[_0x88be('0x3a')][_0x88be('0x50')]){_0x7b240a[_0x88be('0x4b')]=[{'all':!![]}];}return db[_0x88be('0x5d')]['findAll'](_0x7b240a);})['then'](function(_0x167f02){_0x30200f['rows']=_0x167f02;return _0x30200f;});}})[_0x88be('0x2b')](respondWithFilteredResult(_0x106ff5,_0x7b240a))['catch'](handleError(_0x106ff5,null));};exports[_0x88be('0x60')]=function(_0x3a5d2e,_0x1ab180,_0x2acef9){return db[_0x88be('0x4a')][_0x88be('0x55')]({'where':{'id':_0x3a5d2e[_0x88be('0x59')]['id']}})['then'](handleEntityNotFound(_0x1ab180,null))['then'](function(_0x3624f2){if(_0x3624f2){return _0x3624f2[_0x88be('0x60')](_0x3a5d2e['query']['ids']);}})[_0x88be('0x2b')](respondWithStatusCode(_0x1ab180,null))[_0x88be('0x4e')](handleError(_0x1ab180,null));};exports[_0x88be('0x61')]=function(_0x2e41ce,_0x3671e2,_0x2e6967){return db[_0x88be('0x4a')][_0x88be('0x55')]({'where':{'id':_0x2e41ce[_0x88be('0x59')]['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0x3671e2,null))[_0x88be('0x2b')](function(_0xa6cbff){if(_0xa6cbff){var _0x38e7de=[];var _0x1da82a={'success':[],'errors':[]};return db[_0x88be('0x62')]['describe']()['then'](function(_0x429c1e){if(_0x2e41ce[_0x88be('0x5a')][_0x88be('0x63')]&&_[_0x88be('0x64')](_0x2e41ce[_0x88be('0x5a')][_0x88be('0x63')])){if(_0x2e41ce[_0x88be('0x5a')][_0x88be('0x63')]['length']){_0x2e41ce[_0x88be('0x5a')][_0x88be('0x63')]=_0x2e41ce['body'][_0x88be('0x63')][_0x88be('0x65')](';')+';';}else{_0x2e41ce['body'][_0x88be('0x63')]=null;}}else{_0x2e41ce[_0x88be('0x5a')][_0x88be('0x63')]=null;}if(_0x2e41ce['body']&&_[_0x88be('0x64')](_0x2e41ce[_0x88be('0x5a')])){for(var _0x1703c9=0x0;_0x1703c9<_0x2e41ce[_0x88be('0x5a')][_0x88be('0x3f')];_0x1703c9+=0x1){_0x2e41ce[_0x88be('0x5a')][_0x1703c9][_0x88be('0x66')]=_0x2e41ce[_0x88be('0x59')]['id'];_0x38e7de[_0x88be('0x67')](_0x2e41ce[_0x88be('0x5a')][_0x1703c9]);}return BPromise[_0x88be('0x68')](_0x38e7de,function(_0x51f0e3){return db['CmContact'][_0x88be('0x51')](_[_0x88be('0x69')](_0x51f0e3,[_0x88be('0x6a'),'id'])||{},{'fields':_[_0x88be('0x39')](_0x429c1e),'raw':!![]})[_0x88be('0x2b')](function(_0x2043fe){_0x1da82a[_0x88be('0x6b')][_0x88be('0x67')](_0x2043fe[_0x88be('0x6c')]);})[_0x88be('0x4e')](function(_0x4c1d6b){_0x1da82a[_0x88be('0x6d')][_0x88be('0x67')]({'data':_0x51f0e3,'error':_0x4c1d6b[_0x88be('0x6e')]});});})[_0x88be('0x2b')](function(_0x3e58c1){return _0x1da82a;})['catch'](function(_0x42ee5a){return _0x42ee5a;});}else{_0x3671e2[_0x88be('0x1e')](0x190)[_0x88be('0x26')]({'message':_0x88be('0x6f')});}});}})[_0x88be('0x2b')](respondWithResult(_0x3671e2,null))['catch'](handleError(_0x3671e2,null));};exports[_0x88be('0x70')]=function(_0x34f1e9,_0x1c4be1,_0x5262ea){var _0x4dde7a;return db['CmList'][_0x88be('0x55')]({'where':{'id':_0x34f1e9[_0x88be('0x59')]['id']},'include':[{'model':db[_0x88be('0x71')],'as':_0x88be('0x72')}]})[_0x88be('0x2b')](handleEntityNotFound(_0x1c4be1,null))['then'](function(_0xe11e51){if(_0xe11e51){_0x4dde7a=_0xe11e51;return db[_0x88be('0x62')][_0x88be('0x36')];}})[_0x88be('0x2b')](function(_0x5f750d){if(_0x5f750d){var _0x29ac2a={};var _0x4f3cce={};_0x4f3cce[_0x88be('0x38')]=_[_0x88be('0x73')](_[_0x88be('0x39')](_0x5f750d),_[_0x88be('0x74')](_0x4dde7a[_0x88be('0x72')],function(_0x19ad16){return util[_0x88be('0x75')]('cf_%d',_0x19ad16['id']);}));_0x4f3cce[_0x88be('0x3a')]=_[_0x88be('0x39')](_0x34f1e9[_0x88be('0x3a')]);_0x4f3cce[_0x88be('0x3b')]=_[_0x88be('0x3c')](_0x4f3cce['model'],_0x4f3cce[_0x88be('0x3a')]);_0x29ac2a[_0x88be('0x3d')]=_[_0x88be('0x3c')](_0x4f3cce[_0x88be('0x38')],qs['fields'](_0x34f1e9[_0x88be('0x3a')][_0x88be('0x3e')]));_0x29ac2a[_0x88be('0x3d')]=_0x29ac2a[_0x88be('0x3d')][_0x88be('0x3f')]?_0x29ac2a['attributes']:_0x4f3cce['model'];if(!_0x34f1e9[_0x88be('0x3a')][_0x88be('0x40')](_0x88be('0x41'))){_0x29ac2a['limit']=qs[_0x88be('0x22')](_0x34f1e9[_0x88be('0x3a')][_0x88be('0x22')]);_0x29ac2a[_0x88be('0x20')]=qs[_0x88be('0x20')](_0x34f1e9[_0x88be('0x3a')][_0x88be('0x20')]);}_0x29ac2a[_0x88be('0x5f')]=qs[_0x88be('0x42')](_0x34f1e9[_0x88be('0x3a')][_0x88be('0x42')]);_0x29ac2a[_0x88be('0x43')]=qs['filters'](_[_0x88be('0x44')](_0x34f1e9[_0x88be('0x3a')],_0x4f3cce[_0x88be('0x3b')]));_0x29ac2a[_0x88be('0x76')]=!![];if(_0x34f1e9[_0x88be('0x3a')]['filter']){_0x29ac2a[_0x88be('0x43')]=_['merge'](_0x29ac2a[_0x88be('0x43')],{'$or':_[_0x88be('0x74')](_0x29ac2a[_0x88be('0x3d')],function(_0x5578be){var _0x1fcacf={};_0x1fcacf[_0x5578be]={'$like':'%'+_0x34f1e9[_0x88be('0x3a')][_0x88be('0x45')]+'%'};return _0x1fcacf;})});}_0x29ac2a=_[_0x88be('0x46')]({},_0x29ac2a,_0x34f1e9['options']);return _0x4dde7a['getContacts'](_0x29ac2a);}})[_0x88be('0x2b')](respondWithResult(_0x1c4be1,null))[_0x88be('0x4e')](handleError(_0x1c4be1,null));};exports[_0x88be('0x77')]=function(_0x300792,_0x5e12ef,_0x106d5e){var _0x5e1a81;var _0x390abd;var _0x18d791;var _0x2d29a=_0x300792['params']['id'];csv_results=[];return db[_0x88be('0x78')][_0x88be('0x4c')]({'attributes':['id',_0x88be('0x33')],'raw':!![],'order':[_0x88be('0x79')]})[_0x88be('0x2b')](function(_0x16d038){_0x5e1a81=_0x16d038;var _0x37c73a=_[_0x88be('0x39')](db['CmContact'][_0x88be('0x36')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x88be('0x7a')]})[_0x88be('0x2b')](function(_0xbe7bac){_0x390abd=_0xbe7bac;var _0x4f7a0d=squel[_0x88be('0x7b')]()[_0x88be('0x3e')](_0x37c73a)[_0x88be('0x7c')](_0x88be('0x7d'),'c')[_0x88be('0x43')]('c.ListId\x20=\x20?',_0x2d29a)[_0x88be('0x43')](_0x88be('0x7e'))['distinct']();for(var _0x40222c=0x0;_0x40222c<_0x390abd[_0x88be('0x3f')];_0x40222c++){_0x4f7a0d[_0x88be('0x7f')](_0x88be('0x80')+_0x390abd[_0x40222c]['id'],_0x88be('0x81')+_0x390abd[_0x40222c][_0x88be('0x7a')]);}for(var _0x40222c=0x0;_0x40222c<_0x5e1a81['length'];_0x40222c++){_0x4f7a0d[_0x88be('0x7f')](squel[_0x88be('0x7b')]()[_0x88be('0x7f')](_0x88be('0x82'))[_0x88be('0x7c')](_0x88be('0x83'))['where'](_0x88be('0x84'),_0x5e1a81[_0x40222c]['id'])['where']('CmContactId\x20=\x20c.id'),_0x88be('0x85')+_0x5e1a81[_0x40222c]['name']);_0x4f7a0d[_0x88be('0x7f')](squel[_0x88be('0x7b')]()[_0x88be('0x7f')](_0x88be('0x86'))['from']('cm_contact_has_items')['where'](_0x88be('0x84'),_0x5e1a81[_0x40222c]['id'])['where'](_0x88be('0x87')),_0x88be('0x88')+_0x5e1a81[_0x40222c]['name']);}var _0x56f5d9=[];_0x56f5d9[_0x88be('0x67')](_0x4f7a0d[_0x88be('0x89')]());BPromise[_0x88be('0x68')](_0x56f5d9,handleQuery)[_0x88be('0x2b')](function(_0x2f8b98){handleQuery(_0x4f7a0d[_0x88be('0x89')]());var _0x540512=csv_results[0x0];if(!_[_0x88be('0x8a')](_0x540512)){var _0x8d2d81=toCsv(_0x540512);var _0x3dfb8f=Date['now']();fs[_0x88be('0x8b')](util[_0x88be('0x75')](_0x88be('0x8c'),_0x2d29a,_0x3dfb8f),_0x8d2d81);_0x5e12ef[_0x88be('0x8d')](_0x88be('0x8e'),'attachment;\x20filename='+util[_0x88be('0x75')](_0x88be('0x8f'),_0x2d29a,_0x3dfb8f));_0x5e12ef[_0x88be('0x8d')](_0x88be('0x90'),_0x88be('0x91'));return _0x5e12ef[_0x88be('0x92')](util[_0x88be('0x75')]('/tmp/list_%d_%s.csv',_0x2d29a,_0x3dfb8f));}else{return _0x5e12ef[_0x88be('0x30')](0xcc);}});});});};exports[_0x88be('0x93')]=function(_0x44d69a,_0x378383,_0x1b103e){var _0x28b75f;delete _0x44d69a['body']['id'];return db[_0x88be('0x4a')]['findOne']({'where':{'id':_0x44d69a['params']['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0x378383,null))[_0x88be('0x2b')](function(_0x4391b5){if(_0x4391b5){return db[_0x88be('0x94')][_0x88be('0x95')](function(_0x258b21){return db[_0x88be('0x71')]['create'](_0x44d69a[_0x88be('0x5a')],{'transaction':_0x258b21})['then'](function(_0x237bed){_0x28b75f=_0x237bed;return _0x4391b5[_0x88be('0x96')](_0x237bed,{'transaction':_0x258b21});})[_0x88be('0x2b')](function(){var _0x4ae6cf={'type':db[_0x88be('0x97')][_0x88be('0x98')],'transaction':_0x258b21};switch(_0x44d69a[_0x88be('0x5a')][_0x88be('0x47')]){case _0x88be('0x99'):_0x4ae6cf[_0x88be('0x47')]=db[_0x88be('0x97')][_0x88be('0x98')];break;case _0x88be('0x9a'):_0x4ae6cf[_0x88be('0x47')]=db[_0x88be('0x97')]['INTEGER'];break;case _0x88be('0x9b'):_0x4ae6cf[_0x88be('0x47')]=db[_0x88be('0x97')]['BOOLEAN'];_0x4ae6cf[_0x88be('0x9c')]=![];break;default:}return db[_0x88be('0x94')][_0x88be('0x9d')]['addColumn']('cm_contacts',util['format'](_0x88be('0x9e'),_0x28b75f['id']),_0x4ae6cf);})[_0x88be('0x2b')](function(){return _0x28b75f;});});}})[_0x88be('0x2b')](respondWithResult(_0x378383,null))[_0x88be('0x4e')](handleError(_0x378383,null));};exports[_0x88be('0x9f')]=function(_0xa33784,_0x152e8a,_0x4846c3){var _0x427a86={};var _0x3131ef={};var _0x4010cd;var _0x26e6a8;return db['CmList'][_0x88be('0x5e')]({'where':{'id':_0xa33784[_0x88be('0x59')]['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0x152e8a,null))['then'](function(_0x147165){if(_0x147165){_0x4010cd=_0x147165;_0x3131ef[_0x88be('0x38')]=_[_0x88be('0x39')](db[_0x88be('0x71')][_0x88be('0x36')]);_0x3131ef['query']=_[_0x88be('0x39')](_0xa33784[_0x88be('0x3a')]);_0x3131ef[_0x88be('0x3b')]=_['intersection'](_0x3131ef[_0x88be('0x38')],_0x3131ef[_0x88be('0x3a')]);_0x427a86[_0x88be('0x3d')]=_[_0x88be('0x3c')](_0x3131ef[_0x88be('0x38')],qs['fields'](_0xa33784[_0x88be('0x3a')]['fields']));_0x427a86['attributes']=_0x427a86['attributes'][_0x88be('0x3f')]?_0x427a86['attributes']:_0x3131ef[_0x88be('0x38')];_0x427a86[_0x88be('0x5f')]=qs[_0x88be('0x42')](_0xa33784[_0x88be('0x3a')][_0x88be('0x42')]);_0x427a86['where']=qs['filters'](_[_0x88be('0x44')](_0xa33784[_0x88be('0x3a')],_0x3131ef[_0x88be('0x3b')]));_0x427a86[_0x88be('0x43')]=_['merge'](_0x427a86[_0x88be('0x43')],{'$or':[{'ListId':_0x147165['id']},{'ListId':null}]});if(_0xa33784[_0x88be('0x3a')]['filter']){_0x427a86[_0x88be('0x43')]=_['merge'](_0x427a86[_0x88be('0x43')],{'$or':_[_0x88be('0x74')](_0x427a86['attributes'],function(_0x5165ba){var _0x46e0db={};_0x46e0db[_0x5165ba]={'$like':'%'+_0xa33784[_0x88be('0x3a')][_0x88be('0x45')]+'%'};return _0x46e0db;})});}_0x427a86=_[_0x88be('0x46')]({},_0x427a86,_0xa33784['options']);return db[_0x88be('0x71')][_0x88be('0xa0')](_0x427a86);}})[_0x88be('0x2b')](respondWithResult(_0x152e8a,null))[_0x88be('0x4e')](handleError(_0x152e8a,null));};exports['getGlobalCustomFields']=function(_0x4382fa,_0x14ab5e){return db[_0x88be('0x71')][_0x88be('0xa0')]({'where':{'ListId':null}})[_0x88be('0x2b')](handleEntityNotFound(_0x14ab5e,null))['then'](function(_0x2310cd){return _0x2310cd;})[_0x88be('0x2b')](respondWithResult(_0x14ab5e,null))['catch'](handleError(_0x14ab5e,null));};exports['addAgents']=function(_0x4fd3e8,_0xd11afe,_0x9ef67a){return db[_0x88be('0x4a')][_0x88be('0x55')]({'where':{'id':_0x4fd3e8['params']['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0xd11afe,null))['then'](function(_0x5f4382){if(_0x5f4382){return _0x5f4382[_0x88be('0xa1')](_0x4fd3e8[_0x88be('0x5a')][_0x88be('0x6a')],_[_0x88be('0x69')](_0x4fd3e8[_0x88be('0x5a')],[_0x88be('0x6a'),'id'])||{})[_0x88be('0xa2')](function(_0x1e8f5a){for(var _0x7e0d89=0x0;_0x7e0d89<_0x4fd3e8['body'][_0x88be('0x6a')][_0x88be('0x3f')];_0x7e0d89+=0x1){socket[_0x88be('0xa3')](_0x88be('0xa4'),{'UserId':Number(_0x4fd3e8[_0x88be('0x5a')][_0x88be('0x6a')][_0x7e0d89]),'CmListId':Number(_0x4fd3e8['params']['id'])});}return _0x1e8f5a;});}})[_0x88be('0x2b')](respondWithResult(_0xd11afe,null))['catch'](handleError(_0xd11afe,null));};exports[_0x88be('0xa5')]=function(_0x199a82,_0x3e5313,_0x3599d2){return db[_0x88be('0x4a')][_0x88be('0x55')]({'where':{'id':_0x199a82[_0x88be('0x59')]['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0x3e5313,null))[_0x88be('0x2b')](function(_0x491500){if(_0x491500){return _0x491500[_0x88be('0xa5')](_0x199a82['query'][_0x88be('0x6a')])[_0x88be('0x2b')](function(){if(_[_0x88be('0x64')](_0x199a82['query']['ids'])){for(var _0x26c2a8=0x0;_0x26c2a8<_0x199a82[_0x88be('0x3a')]['ids'][_0x88be('0x3f')];_0x26c2a8+=0x1){socket[_0x88be('0xa3')]('userCmList:remove',{'UserId':Number(_0x199a82[_0x88be('0x3a')][_0x88be('0x6a')][_0x26c2a8]),'CmListId':Number(_0x199a82['params']['id'])});}}else{socket[_0x88be('0xa3')](_0x88be('0xa6'),{'UserId':Number(_0x199a82[_0x88be('0x3a')][_0x88be('0x6a')]),'CmListId':Number(_0x199a82['params']['id'])});}});}})[_0x88be('0x2b')](respondWithStatusCode(_0x3e5313,null))[_0x88be('0x4e')](handleError(_0x3e5313,null));};exports['getAgents']=function(_0x4fc2ee,_0x2963dd,_0x3ba3dc){var _0x17278f={};var _0x5544cd={};var _0x575144;var _0x5d7e92;return db[_0x88be('0x4a')][_0x88be('0x5e')]({'where':{'id':_0x4fc2ee[_0x88be('0x59')]['id']}})[_0x88be('0x2b')](handleEntityNotFound(_0x2963dd,null))[_0x88be('0x2b')](function(_0x290737){if(_0x290737){_0x575144=_0x290737;_0x5544cd[_0x88be('0x38')]=_['keys'](db[_0x88be('0xa7')][_0x88be('0x36')]);_0x5544cd[_0x88be('0x3a')]=_['keys'](_0x4fc2ee[_0x88be('0x3a')]);_0x5544cd[_0x88be('0x3b')]=_[_0x88be('0x3c')](_0x5544cd[_0x88be('0x38')],_0x5544cd['query']);_0x17278f[_0x88be('0x3d')]=_[_0x88be('0x3c')](_0x5544cd['model'],qs[_0x88be('0x3e')](_0x4fc2ee[_0x88be('0x3a')][_0x88be('0x3e')]));_0x17278f['attributes']=_0x17278f[_0x88be('0x3d')][_0x88be('0x3f')]?_0x17278f[_0x88be('0x3d')]:_0x5544cd[_0x88be('0x38')];_0x17278f[_0x88be('0x5f')]=qs[_0x88be('0x42')](_0x4fc2ee[_0x88be('0x3a')][_0x88be('0x42')]);_0x17278f[_0x88be('0x43')]=qs[_0x88be('0x3b')](_['pick'](_0x4fc2ee['query'],_0x5544cd[_0x88be('0x3b')]));if(_0x4fc2ee['query'][_0x88be('0x45')]){_0x17278f[_0x88be('0x43')]=_['merge'](_0x17278f[_0x88be('0x43')],{'$or':_[_0x88be('0x74')](_0x17278f[_0x88be('0x3d')],function(_0x28b81d){var _0x10c56b={};_0x10c56b[_0x28b81d]={'$like':'%'+_0x4fc2ee[_0x88be('0x3a')]['filter']+'%'};return _0x10c56b;})});}_0x17278f=_['merge']({},_0x17278f,_0x4fc2ee[_0x88be('0x49')]);return _0x575144[_0x88be('0xa8')](_0x17278f);}})[_0x88be('0x2b')](function(_0x1ca953){if(_0x1ca953){_0x5d7e92=_0x1ca953['length'];if(!_0x4fc2ee['query'][_0x88be('0x40')](_0x88be('0x41'))){_0x17278f[_0x88be('0x22')]=qs['limit'](_0x4fc2ee[_0x88be('0x3a')]['limit']);_0x17278f['offset']=qs[_0x88be('0x20')](_0x4fc2ee[_0x88be('0x3a')]['offset']);}return _0x575144[_0x88be('0xa8')](_0x17278f);}})[_0x88be('0x2b')](function(_0x38a861){if(_0x38a861){return _0x38a861?{'count':_0x5d7e92,'rows':_0x38a861}:null;}})[_0x88be('0x2b')](respondWithResult(_0x2963dd,null))[_0x88be('0x4e')](handleError(_0x2963dd,null));};function handleQuery(_0x2ce1f8){logger['info'](_0x2ce1f8);return db['sequelize'][_0x88be('0x3a')](_0x2ce1f8)['spread'](function(_0x212d4c){csv_results[_0x88be('0x67')](_0x212d4c);})[_0x88be('0x4e')](function(_0x99e07b){logger[_0x88be('0x31')](_0x99e07b[_0x88be('0x6e')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 47e4062..bb191a5 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5fc3[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x1e271f,_0xf14504){var _0x2b2ac5=function(_0x21c3b6){while(--_0x21c3b6){_0x1e271f['push'](_0x1e271f['shift']());}};_0x2b2ac5(++_0xf14504);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4dfaf0d..05fdeee 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 _0xe5b5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash'];(function(_0x4c38b2,_0x226268){var _0x598ad5=function(_0x64dd73){while(--_0x64dd73){_0x4c38b2['push'](_0x4c38b2['shift']());}};_0x598ad5(++_0x226268);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0xe5b5[_0x98db33];return _0x5ae63a;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var rp=require(_0x5e5b('0x6'));var fs=require('fs');var path=require(_0x5e5b('0x7'));var rimraf=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var attributes=require(_0x5e5b('0xa'));module[_0x5e5b('0xb')]=function(_0xf1fbe2,_0x11e0e0){return _0xf1fbe2[_0x5e5b('0xc')](_0x5e5b('0xd'),attributes,{'tableName':_0x5e5b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb58b=['CmList','cm_lists','util','../../config/logger','api','bluebird','request-promise','rimraf','./cmList.attributes','exports','define'];(function(_0x22a524,_0x32c0d0){var _0x2ebb53=function(_0x4899a6){while(--_0x4899a6){_0x22a524['push'](_0x22a524['shift']());}};_0x2ebb53(++_0x32c0d0);}(_0xb58b,0x1f1));var _0xbb58=function(_0x57c482,_0x3fa980){_0x57c482=_0x57c482-0x0;var _0x3ee356=_0xb58b[_0x57c482];return _0x3ee356;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var moment=require('moment');var BPromise=require(_0xbb58('0x3'));var rp=require(_0xbb58('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb58('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb58('0x6'));module[_0xbb58('0x7')]=function(_0x33fe85,_0x5cf8b1){return _0x33fe85[_0xbb58('0x8')](_0xbb58('0x9'),attributes,{'tableName':_0xbb58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 9daa3cc..4cdb905 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 _0x82d8=['defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x82d8,0xd6));var _0x882d=function(_0x3e5a6b,_0xeedc2f){_0x3e5a6b=_0x3e5a6b-0x0;var _0x105b57=_0x82d8[_0x3e5a6b];return _0x105b57;};'use strict';var _=require('lodash');var util=require(_0x882d('0x0'));var moment=require(_0x882d('0x1'));var BPromise=require('bluebird');var rs=require(_0x882d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x882d('0x3'))['db'];var utils=require(_0x882d('0x4'));var logger=require(_0x882d('0x5'))(_0x882d('0x6'));var config=require('../../config/environment');var jayson=require(_0x882d('0x7'));var client=jayson[_0x882d('0x8')][_0x882d('0x9')]({'port':0x232a});config[_0x882d('0xa')]=_[_0x882d('0xb')](config['redis'],{'host':_0x882d('0xc'),'port':0x18eb});var socket=require(_0x882d('0xd'))(new Redis(config[_0x882d('0xa')]));require(_0x882d('0xe'))[_0x882d('0xf')](socket);function respondWithRpcPromise(_0x4d14bc,_0x3de376,_0x568482){return new BPromise(function(_0x58c57d,_0xb27d1c){return client[_0x882d('0x10')](_0x4d14bc,_0x568482)[_0x882d('0x11')](function(_0x287286){logger[_0x882d('0x12')](_0x882d('0x13'),_0x3de376,'request\x20sent');logger[_0x882d('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x3de376,_0x882d('0x15'),JSON[_0x882d('0x16')](_0x287286));if(_0x287286['error']){if(_0x287286['error']['code']===0x1f4){logger[_0x882d('0x17')]('CmList,\x20%s,\x20%s',_0x3de376,_0x287286['error'][_0x882d('0x18')]);return _0xb27d1c(_0x287286['error'][_0x882d('0x18')]);}logger[_0x882d('0x17')]('CmList,\x20%s,\x20%s',_0x3de376,_0x287286[_0x882d('0x17')][_0x882d('0x18')]);return _0x58c57d(_0x287286['error'][_0x882d('0x18')]);}else{logger[_0x882d('0x12')]('CmList,\x20%s,\x20%s',_0x3de376,_0x882d('0x15'));_0x58c57d(_0x287286['result'][_0x882d('0x18')]);}})['catch'](function(_0x4b75c3){logger[_0x882d('0x17')](_0x882d('0x13'),_0x3de376,_0x4b75c3);_0xb27d1c(_0x4b75c3);});});} \ No newline at end of file +var _0xd391=['redis','defaults','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x143cc6,_0xf94536){var _0x2cedba=function(_0x15a2ad){while(--_0x15a2ad){_0x143cc6['push'](_0x143cc6['shift']());}};_0x2cedba(++_0xf94536);}(_0xd391,0x68));var _0x1d39=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd391[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x1d39('0x0'));var util=require(_0x1d39('0x1'));var moment=require(_0x1d39('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d39('0x3'));var fs=require('fs');var Redis=require(_0x1d39('0x4'));var db=require(_0x1d39('0x5'))['db'];var utils=require(_0x1d39('0x6'));var logger=require(_0x1d39('0x7'))(_0x1d39('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d39('0x9'));var client=jayson[_0x1d39('0xa')][_0x1d39('0xb')]({'port':0x232a});config[_0x1d39('0xc')]=_[_0x1d39('0xd')](config[_0x1d39('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1d39('0xe'))[_0x1d39('0xf')](socket);function respondWithRpcPromise(_0x68f9d3,_0x2c4c83,_0x1e163e){return new BPromise(function(_0x456f60,_0x3a2523){return client[_0x1d39('0x10')](_0x68f9d3,_0x1e163e)[_0x1d39('0x11')](function(_0x498d40){logger[_0x1d39('0x12')]('CmList,\x20%s,\x20%s',_0x2c4c83,_0x1d39('0x13'));logger[_0x1d39('0x14')](_0x1d39('0x15'),_0x2c4c83,_0x1d39('0x13'),JSON[_0x1d39('0x16')](_0x498d40));if(_0x498d40['error']){if(_0x498d40[_0x1d39('0x17')][_0x1d39('0x18')]===0x1f4){logger[_0x1d39('0x17')](_0x1d39('0x19'),_0x2c4c83,_0x498d40['error'][_0x1d39('0x1a')]);return _0x3a2523(_0x498d40[_0x1d39('0x17')]['message']);}logger[_0x1d39('0x17')](_0x1d39('0x19'),_0x2c4c83,_0x498d40[_0x1d39('0x17')]['message']);return _0x456f60(_0x498d40['error'][_0x1d39('0x1a')]);}else{logger[_0x1d39('0x12')](_0x1d39('0x19'),_0x2c4c83,_0x1d39('0x13'));_0x456f60(_0x498d40[_0x1d39('0x1b')][_0x1d39('0x1a')]);}})[_0x1d39('0x1c')](function(_0x5c3e08){logger[_0x1d39('0x17')]('CmList,\x20%s,\x20%s',_0x2c4c83,_0x5c3e08);_0x3a2523(_0x5c3e08);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 367c14c..4c1bf3f 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 _0x76e6=['removeListener','register','length','cmList:','remove','emit'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0x76e6,0x8e));var _0x676e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x76e6[_0x19e35c];return _0x3e1fe8;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x676e('0x0'),'update'];function createListener(_0x140efe,_0x70b6fa){return function(_0x5e1588){_0x70b6fa[_0x676e('0x1')](_0x140efe,_0x5e1588);};}function removeListener(_0x3531d0,_0x208250){return function(){CmListEvents[_0x676e('0x2')](_0x3531d0,_0x208250);};}exports[_0x676e('0x3')]=function(_0x198430){for(var _0x2cae9a=0x0,_0xab286f=events[_0x676e('0x4')];_0x2cae9a<_0xab286f;_0x2cae9a++){var _0x321163=events[_0x2cae9a];var _0x20f158=createListener(_0x676e('0x5')+_0x321163,_0x198430);CmListEvents['on'](_0x321163,_0x20f158);}}; \ No newline at end of file +var _0x395a=['save','emit','removeListener','register','./cmList.events'];(function(_0x10bbc3,_0xdc3c9b){var _0x182c28=function(_0x5c0a61){while(--_0x5c0a61){_0x10bbc3['push'](_0x10bbc3['shift']());}};_0x182c28(++_0xdc3c9b);}(_0x395a,0x199));var _0xa395=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x395a[_0xd7b0a4];return _0x184e9e;};'use strict';var CmListEvents=require(_0xa395('0x0'));var events=[_0xa395('0x1'),'remove','update'];function createListener(_0x1cd624,_0x5a36f9){return function(_0xb96361){_0x5a36f9[_0xa395('0x2')](_0x1cd624,_0xb96361);};}function removeListener(_0x5e2f04,_0xd5741){return function(){CmListEvents[_0xa395('0x3')](_0x5e2f04,_0xd5741);};}exports[_0xa395('0x4')]=function(_0x49d2e2){for(var _0x501d32=0x0,_0x1a4ee6=events['length'];_0x501d32<_0x1a4ee6;_0x501d32++){var _0x5c6eb1=events[_0x501d32];var _0x575183=createListener('cmList:'+_0x5c6eb1,_0x49d2e2);CmListEvents['on'](_0x5c6eb1,_0x575183);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c504f14..ce42a10 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 _0x603c=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/global_fields','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','addContacts','addCustomField','put','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0x4af4d0,_0xed98a7){var _0x211e13=function(_0x13dcc7){while(--_0x13dcc7){_0x4af4d0['push'](_0x4af4d0['shift']());}};_0x211e13(++_0xed98a7);}(_0x603c,0x16b));var _0xc603=function(_0x6306d2,_0x4ae91b){_0x6306d2=_0x6306d2-0x0;var _0x4d13aa=_0x603c[_0x6306d2];return _0x4d13aa;};'use strict';var multer=require(_0xc603('0x0'));var util=require(_0xc603('0x1'));var path=require(_0xc603('0x2'));var timeout=require(_0xc603('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc603('0x4'));var auth=require(_0xc603('0x5'));var interaction=require(_0xc603('0x6'));var config=require(_0xc603('0x7'));var controller=require('./cmList.controller');router[_0xc603('0x8')]('/',auth['isAuthenticated'](),controller[_0xc603('0x9')]);router[_0xc603('0x8')](_0xc603('0xa'),auth['isAuthenticated'](),controller[_0xc603('0xb')]);router[_0xc603('0x8')](_0xc603('0xc'),auth[_0xc603('0xd')](),controller['getGlobalCustomFields']);router[_0xc603('0x8')](_0xc603('0xe'),auth[_0xc603('0xd')](),controller[_0xc603('0xf')]);router[_0xc603('0x8')](_0xc603('0x10'),auth[_0xc603('0xd')](),controller[_0xc603('0x11')]);router['get'](_0xc603('0x12'),auth[_0xc603('0xd')](),controller['getContacts']);router['get'](_0xc603('0x13'),auth[_0xc603('0xd')](),controller[_0xc603('0x14')]);router[_0xc603('0x8')](_0xc603('0x15'),auth[_0xc603('0xd')](),controller['getCustomFields']);router[_0xc603('0x8')](_0xc603('0x16'),auth[_0xc603('0xd')](),controller[_0xc603('0x17')]);router[_0xc603('0x18')]('/',auth[_0xc603('0xd')](),controller['create']);router['post']('/:id/dispositions',auth[_0xc603('0xd')](),controller['addDisposition']);router['post']('/:id/contacts',auth[_0xc603('0xd')](),controller[_0xc603('0x19')]);router[_0xc603('0x18')]('/:id/fields',auth[_0xc603('0xd')](),controller[_0xc603('0x1a')]);router['post']('/:id/users',auth[_0xc603('0xd')](),controller['addAgents']);router[_0xc603('0x1b')]('/:id',auth[_0xc603('0xd')](),controller['update']);router[_0xc603('0x1c')]('/:id',auth[_0xc603('0xd')](),controller[_0xc603('0x1d')]);router[_0xc603('0x1c')](_0xc603('0x10'),auth['isAuthenticated'](),controller[_0xc603('0x1e')]);router[_0xc603('0x1c')](_0xc603('0x16'),auth[_0xc603('0xd')](),controller[_0xc603('0x1f')]);module[_0xc603('0x20')]=router; \ No newline at end of file +var _0x0379=['create','addDisposition','/:id/contacts','addContacts','addCustomField','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/global_fields','getGlobalCustomFields','/:id/dispositions','getDispositions','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post'];(function(_0x21e034,_0x59fc14){var _0x1faab3=function(_0x2bd3ba){while(--_0x2bd3ba){_0x21e034['push'](_0x21e034['shift']());}};_0x1faab3(++_0x59fc14);}(_0x0379,0x114));var _0x9037=function(_0x2b7d7e,_0x41f56c){_0x2b7d7e=_0x2b7d7e-0x0;var _0x64e89c=_0x0379[_0x2b7d7e];return _0x64e89c;};'use strict';var multer=require(_0x9037('0x0'));var util=require(_0x9037('0x1'));var path=require('path');var timeout=require(_0x9037('0x2'));var express=require(_0x9037('0x3'));var router=express[_0x9037('0x4')]();var fs_extra=require(_0x9037('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9037('0x6'));var config=require(_0x9037('0x7'));var controller=require('./cmList.controller');router[_0x9037('0x8')]('/',auth[_0x9037('0x9')](),controller['index']);router[_0x9037('0x8')](_0x9037('0xa'),auth[_0x9037('0x9')](),controller[_0x9037('0xb')]);router[_0x9037('0x8')](_0x9037('0xc'),auth[_0x9037('0x9')](),controller[_0x9037('0xd')]);router['get']('/:id',auth[_0x9037('0x9')](),controller['show']);router[_0x9037('0x8')](_0x9037('0xe'),auth[_0x9037('0x9')](),controller[_0x9037('0xf')]);router[_0x9037('0x8')]('/:id/contacts',auth[_0x9037('0x9')](),controller['getContacts']);router['get'](_0x9037('0x10'),auth[_0x9037('0x9')](),controller['getContactsCsv']);router[_0x9037('0x8')](_0x9037('0x11'),auth['isAuthenticated'](),controller[_0x9037('0x12')]);router['get'](_0x9037('0x13'),auth[_0x9037('0x9')](),controller['getAgents']);router[_0x9037('0x14')]('/',auth[_0x9037('0x9')](),controller[_0x9037('0x15')]);router['post'](_0x9037('0xe'),auth[_0x9037('0x9')](),controller[_0x9037('0x16')]);router[_0x9037('0x14')](_0x9037('0x17'),auth[_0x9037('0x9')](),controller[_0x9037('0x18')]);router[_0x9037('0x14')](_0x9037('0x11'),auth[_0x9037('0x9')](),controller[_0x9037('0x19')]);router[_0x9037('0x14')](_0x9037('0x13'),auth[_0x9037('0x9')](),controller['addAgents']);router[_0x9037('0x1a')]('/:id',auth[_0x9037('0x9')](),controller[_0x9037('0x1b')]);router[_0x9037('0x1c')]('/:id',auth[_0x9037('0x9')](),controller[_0x9037('0x1d')]);router['delete'](_0x9037('0xe'),auth[_0x9037('0x9')](),controller[_0x9037('0x1e')]);router[_0x9037('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0x9037('0x1f')]);module[_0x9037('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4a4e608..3a73c8b 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 _0x415c=['exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x3fd971,_0xf12fe3){var _0x4eb76d=function(_0x36db7d){while(--_0x36db7d){_0x3fd971['push'](_0x3fd971['shift']());}};_0x4eb76d(++_0xf12fe3);}(_0x415c,0x1ae));var _0xc415=function(_0x5a24de,_0x542232){_0x5a24de=_0x5a24de-0x0;var _0x388e2e=_0x415c[_0x5a24de];return _0x388e2e;};'use strict';var Sequelize=require('sequelize');module[_0xc415('0x0')]={'name':{'type':Sequelize[_0xc415('0x1')],'get':function(_0x1d89cc){return this[_0xc415('0x2')](_0xc415('0x3'));}},'field':{'type':Sequelize[_0xc415('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8456=['sequelize','exports','VIRTUAL','STRING'];(function(_0x3a511f,_0x546b37){var _0x5e557e=function(_0x147090){while(--_0x147090){_0x3a511f['push'](_0x3a511f['shift']());}};_0x5e557e(++_0x546b37);}(_0x8456,0x180));var _0x6845=function(_0x1c820a,_0x423cc2){_0x1c820a=_0x1c820a-0x0;var _0x37e809=_0x8456[_0x1c820a];return _0x37e809;};'use strict';var Sequelize=require(_0x6845('0x0'));module[_0x6845('0x1')]={'name':{'type':Sequelize[_0x6845('0x2')],'get':function(_0x4c3fae){return this['getDataValue']('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x6845('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index b0f988b..6d0895a 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(_0x22268e,_0x37d7fe){var _0x40612e=function(_0x3a26ae){while(--_0x3a26ae){_0x22268e['push'](_0x22268e['shift']());}};_0x40612e(++_0x37d7fe);}(_0x7a54,0x106));var _0x47a5=function(_0x4d6848,_0x5cb33d){_0x4d6848=_0x4d6848-0x0;var _0x51f442=_0x7a54[_0x4d6848];return _0x51f442;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x179bb0,_0x161b4d){var _0x242c7d=function(_0x167b39){while(--_0x167b39){_0x179bb0['push'](_0x179bb0['shift']());}};_0x242c7d(++_0x161b4d);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 7296877..d913137 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 _0x97e2=['../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x97e2,0x186));var _0x297e=function(_0x3f5676,_0x2b593a){_0x3f5676=_0x3f5676-0x0;var _0x565c46=_0x97e2[_0x3f5676];return _0x565c46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x297e('0x0'))('api');var moment=require(_0x297e('0x1'));var BPromise=require(_0x297e('0x2'));var rp=require(_0x297e('0x3'));var fs=require('fs');var path=require(_0x297e('0x4'));var rimraf=require(_0x297e('0x5'));var config=require(_0x297e('0x6'));var attributes=require(_0x297e('0x7'));module[_0x297e('0x8')]=function(_0x25c25f,_0x4cfb19){return _0x25c25f[_0x297e('0x9')](_0x297e('0xa'),attributes,{'tableName':_0x297e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cdc=['exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x5482af,_0xd50828){var _0x22ea20=function(_0x5b2d6b){while(--_0x5b2d6b){_0x5482af['push'](_0x5482af['shift']());}};_0x22ea20(++_0xd50828);}(_0x3cdc,0x121));var _0xc3cd=function(_0x5c4d30,_0x2bc47a){_0x5c4d30=_0x5c4d30-0x0;var _0x120851=_0x3cdc[_0x5c4d30];return _0x120851;};'use strict';var _=require(_0xc3cd('0x0'));var util=require(_0xc3cd('0x1'));var logger=require(_0xc3cd('0x2'))(_0xc3cd('0x3'));var moment=require(_0xc3cd('0x4'));var BPromise=require(_0xc3cd('0x5'));var rp=require(_0xc3cd('0x6'));var fs=require('fs');var path=require(_0xc3cd('0x7'));var rimraf=require(_0xc3cd('0x8'));var config=require(_0xc3cd('0x9'));var attributes=require(_0xc3cd('0xa'));module[_0xc3cd('0xb')]=function(_0x3a4735,_0x18df63){return _0x3a4735[_0xc3cd('0xc')](_0xc3cd('0xd'),attributes,{'tableName':_0xc3cd('0xe'),'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 8a7dbe7..4a10251 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 _0xf0d5=['request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x5c2b2a,_0x44ce2d){var _0x1b2130=function(_0x2ef119){while(--_0x2ef119){_0x5c2b2a['push'](_0x5c2b2a['shift']());}};_0x1b2130(++_0x44ce2d);}(_0xf0d5,0x109));var _0x5f0d=function(_0x128415,_0x22cfbc){_0x128415=_0x128415-0x0;var _0x1b799f=_0xf0d5[_0x128415];return _0x1b799f;};'use strict';var _=require(_0x5f0d('0x0'));var util=require(_0x5f0d('0x1'));var moment=require(_0x5f0d('0x2'));var BPromise=require(_0x5f0d('0x3'));var rs=require(_0x5f0d('0x4'));var fs=require('fs');var Redis=require(_0x5f0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f0d('0x6'));var logger=require('../../config/logger')(_0x5f0d('0x7'));var config=require(_0x5f0d('0x8'));var jayson=require(_0x5f0d('0x9'));var client=jayson['client'][_0x5f0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4906a6,_0x4c3162,_0x162fe5){return new BPromise(function(_0x4ca6cb,_0x5a314c){return client[_0x5f0d('0xb')](_0x4906a6,_0x162fe5)[_0x5f0d('0xc')](function(_0x1fb58e){logger['info'](_0x5f0d('0xd'),_0x4c3162,_0x5f0d('0xe'));logger[_0x5f0d('0xf')](_0x5f0d('0x10'),_0x4c3162,_0x5f0d('0xe'),JSON[_0x5f0d('0x11')](_0x1fb58e));if(_0x1fb58e[_0x5f0d('0x12')]){if(_0x1fb58e[_0x5f0d('0x12')][_0x5f0d('0x13')]===0x1f4){logger['error'](_0x5f0d('0xd'),_0x4c3162,_0x1fb58e['error']['message']);return _0x5a314c(_0x1fb58e[_0x5f0d('0x12')][_0x5f0d('0x14')]);}logger[_0x5f0d('0x12')](_0x5f0d('0xd'),_0x4c3162,_0x1fb58e['error']['message']);return _0x4ca6cb(_0x1fb58e[_0x5f0d('0x12')][_0x5f0d('0x14')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x4c3162,'request\x20sent');_0x4ca6cb(_0x1fb58e[_0x5f0d('0x15')][_0x5f0d('0x14')]);}})[_0x5f0d('0x16')](function(_0x385221){logger['error']('Condition,\x20%s,\x20%s',_0x4c3162,_0x385221);_0x5a314c(_0x385221);});});} \ No newline at end of file +var _0x5a09=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../config/logger','rpc','jayson/promise','request','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x151da1,_0x7eeaf2){var _0x13d96d=function(_0x55fa2e){while(--_0x55fa2e){_0x151da1['push'](_0x151da1['shift']());}};_0x13d96d(++_0x7eeaf2);}(_0x5a09,0x171));var _0x95a0=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x5a09[_0xd1b4d7];return _0x3002ec;};'use strict';var _=require('lodash');var util=require(_0x95a0('0x0'));var moment=require(_0x95a0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95a0('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x95a0('0x3'))(_0x95a0('0x4'));var config=require('../../config/environment');var jayson=require(_0x95a0('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13ab1e,_0x16a338,_0x325530){return new BPromise(function(_0x3e7b8e,_0x18f460){return client[_0x95a0('0x6')](_0x13ab1e,_0x325530)[_0x95a0('0x7')](function(_0x3add8f){logger[_0x95a0('0x8')](_0x95a0('0x9'),_0x16a338,_0x95a0('0xa'));logger[_0x95a0('0xb')](_0x95a0('0xc'),_0x16a338,_0x95a0('0xa'),JSON[_0x95a0('0xd')](_0x3add8f));if(_0x3add8f[_0x95a0('0xe')]){if(_0x3add8f[_0x95a0('0xe')][_0x95a0('0xf')]===0x1f4){logger['error'](_0x95a0('0x9'),_0x16a338,_0x3add8f[_0x95a0('0xe')][_0x95a0('0x10')]);return _0x18f460(_0x3add8f[_0x95a0('0xe')][_0x95a0('0x10')]);}logger[_0x95a0('0xe')](_0x95a0('0x9'),_0x16a338,_0x3add8f['error'][_0x95a0('0x10')]);return _0x3e7b8e(_0x3add8f['error'][_0x95a0('0x10')]);}else{logger[_0x95a0('0x8')]('Condition,\x20%s,\x20%s',_0x16a338,_0x95a0('0xa'));_0x3e7b8e(_0x3add8f[_0x95a0('0x11')][_0x95a0('0x10')]);}})[_0x95a0('0x12')](function(_0x2fb6bd){logger[_0x95a0('0xe')](_0x95a0('0x9'),_0x16a338,_0x2fb6bd);_0x18f460(_0x2fb6bd);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 919a9b5..1501690 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 _0x0650=['isAuthenticated','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','delete','/:id'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0650,0xed));var _0x0065=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0x0650[_0x38e177];return _0x1faf15;};'use strict';var multer=require(_0x0065('0x0'));var util=require('util');var path=require(_0x0065('0x1'));var timeout=require(_0x0065('0x2'));var express=require('express');var router=express[_0x0065('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0065('0x4'));var interaction=require(_0x0065('0x5'));var config=require(_0x0065('0x6'));var controller=require('./condition.controller');router[_0x0065('0x7')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0065('0x8')](_0x0065('0x9'),auth[_0x0065('0xa')](),controller[_0x0065('0xb')]);module[_0x0065('0xc')]=router; \ No newline at end of file +var _0x895c=['../../components/auth/service','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','util','express','fs-extra'];(function(_0x2d76d9,_0x5ce14c){var _0x4033ab=function(_0x5ba666){while(--_0x5ba666){_0x2d76d9['push'](_0x2d76d9['shift']());}};_0x4033ab(++_0x5ce14c);}(_0x895c,0x1c5));var _0xc895=function(_0x462d45,_0xec23a){_0x462d45=_0x462d45-0x0;var _0x51acb3=_0x895c[_0x462d45];return _0x51acb3;};'use strict';var multer=require('multer');var util=require(_0xc895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc895('0x1'));var router=express['Router']();var fs_extra=require(_0xc895('0x2'));var auth=require(_0xc895('0x3'));var interaction=require(_0xc895('0x4'));var config=require('../../config/environment');var controller=require(_0xc895('0x5'));router['put'](_0xc895('0x6'),auth[_0xc895('0x7')](),controller[_0xc895('0x8')]);router[_0xc895('0x9')](_0xc895('0x6'),auth[_0xc895('0x7')](),controller[_0xc895('0xa')]);module[_0xc895('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 60bc37b..00e1abe 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 _0x143b=['INTEGER','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x143b,0x17d));var _0xb143=function(_0x352b26,_0x4b6e5f){_0x352b26=_0x352b26-0x0;var _0x4b29be=_0x143b[_0x352b26];return _0x4b29be;};'use strict';var Sequelize=require(_0xb143('0x0'));module[_0xb143('0x1')]={'name':{'type':Sequelize[_0xb143('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xb143('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xb143('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf3e2=['sequelize','exports','STRING','name','INTEGER'];(function(_0xf02de0,_0x54818a){var _0x158b4c=function(_0x1e48c5){while(--_0x1e48c5){_0xf02de0['push'](_0xf02de0['shift']());}};_0x158b4c(++_0x54818a);}(_0xf3e2,0x1bd));var _0x2f3e=function(_0x2c2422,_0x4d6b42){_0x2c2422=_0x2c2422-0x0;var _0x3859d3=_0xf3e2[_0x2c2422];return _0x3859d3;};'use strict';var Sequelize=require(_0x2f3e('0x0'));module[_0x2f3e('0x1')]={'name':{'type':Sequelize[_0x2f3e('0x2')],'allowNull':![],'unique':_0x2f3e('0x3')},'OrderBy':{'type':Sequelize[_0x2f3e('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 2b886f4..6217f55 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 _0xf2e3=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','get','UserProfileResource','then','stack','name','index','ContactItemType','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xf2e3[_0x819464];return _0x49dcc0;};'use strict';var emlformat=require(_0x3f2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f2e('0x1'));var jsonpatch=require(_0x3f2e('0x2'));var rp=require(_0x3f2e('0x3'));var moment=require(_0x3f2e('0x4'));var BPromise=require(_0x3f2e('0x5'));var Mustache=require(_0x3f2e('0x6'));var util=require(_0x3f2e('0x7'));var path=require(_0x3f2e('0x8'));var sox=require(_0x3f2e('0x9'));var csv=require('to-csv');var ejs=require(_0x3f2e('0xa'));var fs=require('fs');var fs_extra=require(_0x3f2e('0xb'));var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0x11'));var querystring=require(_0x3f2e('0x12'));var Papa=require(_0x3f2e('0x13'));var Redis=require(_0x3f2e('0x14'));var authService=require(_0x3f2e('0x15'));var qs=require(_0x3f2e('0x16'));var as=require(_0x3f2e('0x17'));var hardwareService=require(_0x3f2e('0x18'));var logger=require(_0x3f2e('0x19'))(_0x3f2e('0x1a'));var utils=require(_0x3f2e('0x1b'));var config=require(_0x3f2e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1d'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1f')](_0x5471f9)[_0x3f2e('0x20')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1f')](_0x57cba7)[_0x3f2e('0x21')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=typeof _0x43f69e[_0x3f2e('0x22')]===_0x3f2e('0x23')&&typeof _0x43f69e[_0x3f2e('0x24')]===_0x3f2e('0x23');var _0x155411=_0x218b44[_0x3f2e('0x25')];var _0xc00add=_0x17ef58?0x0:_0x43f69e[_0x3f2e('0x22')];var _0x5b9989=_0x17ef58?_0x218b44[_0x3f2e('0x25')]:_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x24')];var _0xbe899c;if(_0x5b9989>=_0x155411){_0x5b9989=_0x155411;_0xbe899c=0xc8;}else{_0xbe899c=0xce;}_0x4f2e38[_0x3f2e('0x1f')](_0xbe899c);return _0x4f2e38['set']('Content-Range',_0xc00add+'-'+_0x5b9989+'/'+_0x155411)[_0x3f2e('0x21')](_0x218b44);}return null;};}function patchUpdates(_0x11f84c){return function(_0x38bbae){try{jsonpatch[_0x3f2e('0x26')](_0x38bbae,_0x11f84c,!![]);}catch(_0x4381e5){return BPromise[_0x3f2e('0x27')](_0x4381e5);}return _0x38bbae['save']();};}function saveUpdates(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['update'](_0x5a7047)['then'](function(_0x46bb1c){return _0x46bb1c;});}return null;};}function removeEntity(_0x5646f5,_0x1b8c67){return function(_0x401ed9){if(_0x401ed9){return _0x401ed9['destroy']()['then'](function(){var _0x52803d=_0x401ed9[_0x3f2e('0x28')]({'plain':!![]});var _0x3d7631='ContactItemTypes';return db[_0x3f2e('0x29')]['destroy']({'where':{'type':_0x3d7631,'resourceId':_0x52803d['id']}})[_0x3f2e('0x2a')](function(){return _0x401ed9;});})['then'](function(){_0x5646f5[_0x3f2e('0x1f')](0xcc)[_0x3f2e('0x20')]();});}};}function handleEntityNotFound(_0x12926e,_0x9c6c34){return function(_0x11bad1){if(!_0x11bad1){_0x12926e['sendStatus'](0x194);}return _0x11bad1;};}function handleError(_0x426d68,_0x28ef64){_0x28ef64=_0x28ef64||0x1f4;return function(_0x5eab38){logger['error'](_0x5eab38[_0x3f2e('0x2b')]);if(_0x5eab38[_0x3f2e('0x2c')]){delete _0x5eab38[_0x3f2e('0x2c')];}_0x426d68[_0x3f2e('0x1f')](_0x28ef64)['send'](_0x5eab38);};}exports[_0x3f2e('0x2d')]=function(_0x465a94,_0x37ddfe){var _0x4d9b8c={},_0x349ed4={},_0x2741d0={'count':0x0,'rows':[]};var _0xa6a8ab=_['map'](db[_0x3f2e('0x2e')][_0x3f2e('0x2f')],function(_0x71568e){return{'name':_0x71568e[_0x3f2e('0x30')],'type':_0x71568e[_0x3f2e('0x31')][_0x3f2e('0x32')]};});_0x349ed4['model']=_[_0x3f2e('0x33')](_0xa6a8ab,_0x3f2e('0x2c'));_0x349ed4[_0x3f2e('0x34')]=_[_0x3f2e('0x35')](_0x465a94[_0x3f2e('0x34')]);_0x349ed4[_0x3f2e('0x36')]=_[_0x3f2e('0x37')](_0x349ed4['model'],_0x349ed4[_0x3f2e('0x34')]);_0x4d9b8c[_0x3f2e('0x38')]=_[_0x3f2e('0x37')](_0x349ed4[_0x3f2e('0x39')],qs['fields'](_0x465a94['query'][_0x3f2e('0x3a')]));_0x4d9b8c[_0x3f2e('0x38')]=_0x4d9b8c[_0x3f2e('0x38')][_0x3f2e('0x3b')]?_0x4d9b8c[_0x3f2e('0x38')]:_0x349ed4[_0x3f2e('0x39')];if(!_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x3c')](_0x3f2e('0x3d'))){_0x4d9b8c[_0x3f2e('0x24')]=qs['limit'](_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x24')]);_0x4d9b8c[_0x3f2e('0x22')]=qs[_0x3f2e('0x22')](_0x465a94['query'][_0x3f2e('0x22')]);}_0x4d9b8c[_0x3f2e('0x3e')]=qs[_0x3f2e('0x3f')](_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x3f')]);_0x4d9b8c[_0x3f2e('0x40')]=qs[_0x3f2e('0x36')](_[_0x3f2e('0x41')](_0x465a94['query'],_0x349ed4[_0x3f2e('0x36')]),_0xa6a8ab);if(_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x42')]){_0x4d9b8c[_0x3f2e('0x40')]=_['merge'](_0x4d9b8c[_0x3f2e('0x40')],{'$or':_[_0x3f2e('0x33')](_0xa6a8ab,function(_0x4cb56b){if(_0x4cb56b[_0x3f2e('0x31')]!==_0x3f2e('0x43')){var _0x596124={};_0x596124[_0x4cb56b[_0x3f2e('0x2c')]]={'$like':'%'+_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x42')]+'%'};return _0x596124;}})});}_0x4d9b8c=_[_0x3f2e('0x44')]({},_0x4d9b8c,_0x465a94['options']);var _0x39d324={'where':_0x4d9b8c[_0x3f2e('0x40')]};return db['ContactItemType']['count'](_0x39d324)[_0x3f2e('0x2a')](function(_0x23de01){_0x2741d0[_0x3f2e('0x25')]=_0x23de01;if(_0x465a94['query'][_0x3f2e('0x45')]){_0x4d9b8c[_0x3f2e('0x46')]=[{'all':!![]}];}return db[_0x3f2e('0x2e')][_0x3f2e('0x47')](_0x4d9b8c);})[_0x3f2e('0x2a')](function(_0x3668dc){_0x2741d0[_0x3f2e('0x48')]=_0x3668dc;return _0x2741d0;})[_0x3f2e('0x2a')](respondWithFilteredResult(_0x37ddfe,_0x4d9b8c))[_0x3f2e('0x49')](handleError(_0x37ddfe,null));};exports[_0x3f2e('0x4a')]=function(_0x50f446,_0x5d14b7){var _0x32f295={'raw':!![],'where':{'id':_0x50f446['params']['id']}},_0x38900c={};_0x38900c['model']=_[_0x3f2e('0x35')](db[_0x3f2e('0x2e')][_0x3f2e('0x2f')]);_0x38900c['query']=_[_0x3f2e('0x35')](_0x50f446[_0x3f2e('0x34')]);_0x38900c[_0x3f2e('0x36')]=_['intersection'](_0x38900c[_0x3f2e('0x39')],_0x38900c[_0x3f2e('0x34')]);_0x32f295[_0x3f2e('0x38')]=_['intersection'](_0x38900c[_0x3f2e('0x39')],qs[_0x3f2e('0x3a')](_0x50f446[_0x3f2e('0x34')]['fields']));_0x32f295[_0x3f2e('0x38')]=_0x32f295['attributes'][_0x3f2e('0x3b')]?_0x32f295['attributes']:_0x38900c['model'];if(_0x50f446[_0x3f2e('0x34')][_0x3f2e('0x45')]){_0x32f295[_0x3f2e('0x46')]=[{'all':!![]}];}_0x32f295=_[_0x3f2e('0x44')]({},_0x32f295,_0x50f446[_0x3f2e('0x4b')]);return db['ContactItemType']['find'](_0x32f295)[_0x3f2e('0x2a')](handleEntityNotFound(_0x5d14b7,null))[_0x3f2e('0x2a')](respondWithResult(_0x5d14b7,null))[_0x3f2e('0x49')](handleError(_0x5d14b7,null));};exports[_0x3f2e('0x4c')]=function(_0x39dbd1,_0xb891b2){return db[_0x3f2e('0x2e')][_0x3f2e('0x4c')](_0x39dbd1[_0x3f2e('0x4d')],{})['then'](function(_0x4f65fe){var _0x2fe0c3=_0x39dbd1['user'][_0x3f2e('0x28')]({'plain':!![]});if(!_0x2fe0c3)throw new Error(_0x3f2e('0x4e'));if(_0x2fe0c3[_0x3f2e('0x4f')]===_0x3f2e('0x50')){var _0x4b6950=_0x4f65fe[_0x3f2e('0x28')]({'plain':!![]});var _0x4e7491=_0x3f2e('0x51');return db[_0x3f2e('0x52')]['find']({'where':{'name':_0x4e7491,'userProfileId':_0x2fe0c3[_0x3f2e('0x53')]},'raw':!![]})['then'](function(_0x81a50d){if(_0x81a50d&&_0x81a50d[_0x3f2e('0x54')]===0x0){return db[_0x3f2e('0x29')]['create']({'name':_0x4b6950[_0x3f2e('0x2c')],'resourceId':_0x4b6950['id'],'type':_0x81a50d[_0x3f2e('0x2c')],'sectionId':_0x81a50d['id']},{})[_0x3f2e('0x2a')](function(){return _0x4f65fe;});}else{return _0x4f65fe;}})[_0x3f2e('0x49')](function(_0x3c4cbe){logger[_0x3f2e('0x55')](_0x3f2e('0x56'),_0x3c4cbe);throw _0x3c4cbe;});}return _0x4f65fe;})[_0x3f2e('0x2a')](respondWithResult(_0xb891b2,0xc9))[_0x3f2e('0x49')](handleError(_0xb891b2,null));};exports[_0x3f2e('0x57')]=function(_0x519afe,_0x2634a1){if(_0x519afe[_0x3f2e('0x4d')]['id']){delete _0x519afe[_0x3f2e('0x4d')]['id'];}return db[_0x3f2e('0x2e')][_0x3f2e('0x58')]({'where':{'id':_0x519afe[_0x3f2e('0x59')]['id']}})[_0x3f2e('0x2a')](handleEntityNotFound(_0x2634a1,null))[_0x3f2e('0x2a')](saveUpdates(_0x519afe['body'],null))[_0x3f2e('0x2a')](respondWithResult(_0x2634a1,null))[_0x3f2e('0x49')](handleError(_0x2634a1,null));};exports[_0x3f2e('0x5a')]=function(_0xb6e744,_0x11f48d){return db['ContactItemType']['find']({'where':{'id':_0xb6e744[_0x3f2e('0x59')]['id']}})[_0x3f2e('0x2a')](handleEntityNotFound(_0x11f48d,null))[_0x3f2e('0x2a')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0xb6e744['params']['id']}}))[_0x3f2e('0x2a')](removeEntity(_0x11f48d,null))[_0x3f2e('0x49')](handleError(_0x11f48d,null));}; \ No newline at end of file +var _0x0b0e=['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','UserProfileResource','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','update','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x18f8a6,_0xacaa79){var _0x504699=function(_0x274b22){while(--_0x274b22){_0x18f8a6['push'](_0x18f8a6['shift']());}};_0x504699(++_0xacaa79);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0x0b0e[_0x3efe9b];return _0x132073;};'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(){var _0x28586d=_0x503883['get']({'plain':!![]});var _0x3e5c88='ContactItemTypes';return db[_0xe0b0('0x25')]['destroy']({'where':{'type':_0x3e5c88,'resourceId':_0x28586d['id']}})[_0xe0b0('0x23')](function(){return _0x503883;});})['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)[_0xe0b0('0x19')]();});}};}function handleEntityNotFound(_0x1f1ebd,_0x1d91ad){return function(_0x3ec2){if(!_0x3ec2){_0x1f1ebd[_0xe0b0('0x18')](0x194);}return _0x3ec2;};}function handleError(_0x5200a6,_0x1444b9){_0x1444b9=_0x1444b9||0x1f4;return function(_0x1b8aa8){logger['error'](_0x1b8aa8[_0xe0b0('0x26')]);if(_0x1b8aa8[_0xe0b0('0x27')]){delete _0x1b8aa8[_0xe0b0('0x27')];}_0x5200a6[_0xe0b0('0x1a')](_0x1444b9)[_0xe0b0('0x28')](_0x1b8aa8);};}exports[_0xe0b0('0x29')]=function(_0x136bd4,_0x4fb3b7){var _0x1854b8={},_0x3c0109={},_0x48a9b5={'count':0x0,'rows':[]};var _0x4fe400=_[_0xe0b0('0x2a')](db[_0xe0b0('0x2b')][_0xe0b0('0x2c')],function(_0x3f81d5){return{'name':_0x3f81d5[_0xe0b0('0x2d')],'type':_0x3f81d5['type'][_0xe0b0('0x2e')]};});_0x3c0109[_0xe0b0('0x2f')]=_[_0xe0b0('0x2a')](_0x4fe400,_0xe0b0('0x27'));_0x3c0109[_0xe0b0('0x30')]=_['keys'](_0x136bd4[_0xe0b0('0x30')]);_0x3c0109[_0xe0b0('0x31')]=_[_0xe0b0('0x32')](_0x3c0109[_0xe0b0('0x2f')],_0x3c0109[_0xe0b0('0x30')]);_0x1854b8[_0xe0b0('0x33')]=_[_0xe0b0('0x32')](_0x3c0109[_0xe0b0('0x2f')],qs[_0xe0b0('0x34')](_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x34')]));_0x1854b8[_0xe0b0('0x33')]=_0x1854b8[_0xe0b0('0x33')][_0xe0b0('0x35')]?_0x1854b8[_0xe0b0('0x33')]:_0x3c0109['model'];if(!_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x36')](_0xe0b0('0x37'))){_0x1854b8[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x1d')]);_0x1854b8['offset']=qs['offset'](_0x136bd4['query']['offset']);}_0x1854b8[_0xe0b0('0x38')]=qs[_0xe0b0('0x39')](_0x136bd4[_0xe0b0('0x30')]['sort']);_0x1854b8[_0xe0b0('0x3a')]=qs[_0xe0b0('0x31')](_[_0xe0b0('0x3b')](_0x136bd4[_0xe0b0('0x30')],_0x3c0109['filters']),_0x4fe400);if(_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x3c')]){_0x1854b8[_0xe0b0('0x3a')]=_[_0xe0b0('0x3d')](_0x1854b8[_0xe0b0('0x3a')],{'$or':_[_0xe0b0('0x2a')](_0x4fe400,function(_0x8b745){if(_0x8b745[_0xe0b0('0x3e')]!==_0xe0b0('0x3f')){var _0x54f251={};_0x54f251[_0x8b745[_0xe0b0('0x27')]]={'$like':'%'+_0x136bd4['query'][_0xe0b0('0x3c')]+'%'};return _0x54f251;}})});}_0x1854b8=_[_0xe0b0('0x3d')]({},_0x1854b8,_0x136bd4[_0xe0b0('0x40')]);var _0x74f3fa={'where':_0x1854b8['where']};return db[_0xe0b0('0x2b')][_0xe0b0('0x41')](_0x74f3fa)[_0xe0b0('0x23')](function(_0x402a0e){_0x48a9b5[_0xe0b0('0x41')]=_0x402a0e;if(_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x42')]){_0x1854b8[_0xe0b0('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0xe0b0('0x44')](_0x1854b8);})[_0xe0b0('0x23')](function(_0x528818){_0x48a9b5['rows']=_0x528818;return _0x48a9b5;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x4fb3b7,_0x1854b8))[_0xe0b0('0x45')](handleError(_0x4fb3b7,null));};exports['show']=function(_0x18a59d,_0x285d61){var _0x6bca5c={'raw':!![],'where':{'id':_0x18a59d[_0xe0b0('0x46')]['id']}},_0x1c869d={};_0x1c869d['model']=_['keys'](db['ContactItemType'][_0xe0b0('0x2c')]);_0x1c869d[_0xe0b0('0x30')]=_['keys'](_0x18a59d[_0xe0b0('0x30')]);_0x1c869d[_0xe0b0('0x31')]=_[_0xe0b0('0x32')](_0x1c869d[_0xe0b0('0x2f')],_0x1c869d[_0xe0b0('0x30')]);_0x6bca5c['attributes']=_['intersection'](_0x1c869d[_0xe0b0('0x2f')],qs[_0xe0b0('0x34')](_0x18a59d[_0xe0b0('0x30')][_0xe0b0('0x34')]));_0x6bca5c[_0xe0b0('0x33')]=_0x6bca5c['attributes'][_0xe0b0('0x35')]?_0x6bca5c[_0xe0b0('0x33')]:_0x1c869d['model'];if(_0x18a59d['query']['includeAll']){_0x6bca5c[_0xe0b0('0x43')]=[{'all':!![]}];}_0x6bca5c=_[_0xe0b0('0x3d')]({},_0x6bca5c,_0x18a59d[_0xe0b0('0x40')]);return db[_0xe0b0('0x2b')]['find'](_0x6bca5c)[_0xe0b0('0x23')](handleEntityNotFound(_0x285d61,null))[_0xe0b0('0x23')](respondWithResult(_0x285d61,null))['catch'](handleError(_0x285d61,null));};exports['create']=function(_0x2365be,_0x1bc6e0){return db['ContactItemType'][_0xe0b0('0x47')](_0x2365be[_0xe0b0('0x48')],{})['then'](function(_0x5cb2b6){var _0x123ad2=_0x2365be['user'][_0xe0b0('0x49')]({'plain':!![]});if(!_0x123ad2)throw new Error(_0xe0b0('0x4a'));if(_0x123ad2[_0xe0b0('0x4b')]===_0xe0b0('0x4c')){var _0x19ee71=_0x5cb2b6[_0xe0b0('0x49')]({'plain':!![]});var _0x5f5486='ContactItemTypes';return db[_0xe0b0('0x4d')]['find']({'where':{'name':_0x5f5486,'userProfileId':_0x123ad2['userProfileId']},'raw':!![]})[_0xe0b0('0x23')](function(_0x222174){if(_0x222174&&_0x222174['autoAssociation']===0x0){return db['UserProfileResource'][_0xe0b0('0x47')]({'name':_0x19ee71[_0xe0b0('0x27')],'resourceId':_0x19ee71['id'],'type':_0x222174[_0xe0b0('0x27')],'sectionId':_0x222174['id']},{})[_0xe0b0('0x23')](function(){return _0x5cb2b6;});}else{return _0x5cb2b6;}})[_0xe0b0('0x45')](function(_0x24115f){logger[_0xe0b0('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24115f);throw _0x24115f;});}return _0x5cb2b6;})[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,0xc9))['catch'](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x4f')]=function(_0x54106c,_0x5b2055){if(_0x54106c[_0xe0b0('0x48')]['id']){delete _0x54106c[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2b')][_0xe0b0('0x50')]({'where':{'id':_0x54106c[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5b2055,null))[_0xe0b0('0x23')](saveUpdates(_0x54106c[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x5b2055,null))['catch'](handleError(_0x5b2055,null));};exports[_0xe0b0('0x24')]=function(_0x57ccc9,_0x2b5553){return db[_0xe0b0('0x2b')][_0xe0b0('0x50')]({'where':{'id':_0x57ccc9[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x2b5553,null))[_0xe0b0('0x23')](db['CmContactHasItem'][_0xe0b0('0x4f')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x57ccc9[_0xe0b0('0x46')]['id']}}))[_0xe0b0('0x23')](removeEntity(_0x2b5553,null))[_0xe0b0('0x45')](handleError(_0x2b5553,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index f51fe02..a1196f7 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 _0x8772=['../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','api','moment','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8772,0x178));var _0x2877=function(_0x2608f6,_0x3e467){_0x2608f6=_0x2608f6-0x0;var _0x581a04=_0x8772[_0x2608f6];return _0x581a04;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2877('0x0'));var moment=require(_0x2877('0x1'));var BPromise=require('bluebird');var rp=require(_0x2877('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2877('0x3'));var config=require(_0x2877('0x4'));var attributes=require(_0x2877('0x5'));module[_0x2877('0x6')]=function(_0x177745,_0x545d81){return _0x177745[_0x2877('0x7')](_0x2877('0x8'),attributes,{'tableName':_0x2877('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x758e=['../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x43d7ce,_0x43e118){var _0x559dc7=function(_0x5ec414){while(--_0x5ec414){_0x43d7ce['push'](_0x43d7ce['shift']());}};_0x559dc7(++_0x43e118);}(_0x758e,0xc9));var _0xe758=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x758e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xe758('0x0'));var util=require(_0xe758('0x1'));var logger=require(_0xe758('0x2'))('api');var moment=require(_0xe758('0x3'));var BPromise=require('bluebird');var rp=require(_0xe758('0x4'));var fs=require('fs');var path=require(_0xe758('0x5'));var rimraf=require(_0xe758('0x6'));var config=require(_0xe758('0x7'));var attributes=require(_0xe758('0x8'));module[_0xe758('0x9')]=function(_0x137b2b,_0x15208d){return _0x137b2b[_0xe758('0xa')](_0xe758('0xb'),attributes,{'tableName':_0xe758('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 34d1bf7..a1a3609 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 _0xf6c1=['jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x23ab47,_0x445d72){var _0x4d76e2=function(_0x21bd7c){while(--_0x21bd7c){_0x23ab47['push'](_0x23ab47['shift']());}};_0x4d76e2(++_0x445d72);}(_0xf6c1,0x149));var _0x1f6c=function(_0x43540d,_0x3c33e5){_0x43540d=_0x43540d-0x0;var _0x528884=_0xf6c1[_0x43540d];return _0x528884;};'use strict';var _=require(_0x1f6c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1f6c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f6c('0x2'));var db=require(_0x1f6c('0x3'))['db'];var utils=require(_0x1f6c('0x4'));var logger=require(_0x1f6c('0x5'))(_0x1f6c('0x6'));var config=require('../../config/environment');var jayson=require(_0x1f6c('0x7'));var client=jayson[_0x1f6c('0x8')][_0x1f6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44a2d4,_0x4f3b5c,_0x15a298){return new BPromise(function(_0x3b2f8e,_0x44cbb4){return client[_0x1f6c('0xa')](_0x44a2d4,_0x15a298)[_0x1f6c('0xb')](function(_0x470a31){logger[_0x1f6c('0xc')](_0x1f6c('0xd'),_0x4f3b5c,'request\x20sent');logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x4f3b5c,_0x1f6c('0xe'),JSON[_0x1f6c('0xf')](_0x470a31));if(_0x470a31['error']){if(_0x470a31[_0x1f6c('0x10')][_0x1f6c('0x11')]===0x1f4){logger['error'](_0x1f6c('0xd'),_0x4f3b5c,_0x470a31[_0x1f6c('0x10')][_0x1f6c('0x12')]);return _0x44cbb4(_0x470a31[_0x1f6c('0x10')][_0x1f6c('0x12')]);}logger[_0x1f6c('0x10')](_0x1f6c('0xd'),_0x4f3b5c,_0x470a31['error'][_0x1f6c('0x12')]);return _0x3b2f8e(_0x470a31[_0x1f6c('0x10')][_0x1f6c('0x12')]);}else{logger[_0x1f6c('0xc')](_0x1f6c('0xd'),_0x4f3b5c,_0x1f6c('0xe'));_0x3b2f8e(_0x470a31[_0x1f6c('0x13')][_0x1f6c('0x12')]);}})[_0x1f6c('0x14')](function(_0x57cd29){logger[_0x1f6c('0x10')](_0x1f6c('0xd'),_0x4f3b5c,_0x57cd29);_0x44cbb4(_0x57cd29);});});} \ No newline at end of file +var _0x657b=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x657b,0x131));var _0xb657=function(_0x26fb65,_0x54f295){_0x26fb65=_0x26fb65-0x0;var _0x217225=_0x657b[_0x26fb65];return _0x217225;};'use strict';var _=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var moment=require(_0xb657('0x2'));var BPromise=require(_0xb657('0x3'));var rs=require(_0xb657('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb657('0x5'))['db'];var utils=require(_0xb657('0x6'));var logger=require('../../config/logger')(_0xb657('0x7'));var config=require(_0xb657('0x8'));var jayson=require(_0xb657('0x9'));var client=jayson[_0xb657('0xa')][_0xb657('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d54f6,_0x471e78,_0x55acdf){return new BPromise(function(_0x326dd7,_0x42a844){return client[_0xb657('0xc')](_0x5d54f6,_0x55acdf)['then'](function(_0x36b334){logger['info'](_0xb657('0xd'),_0x471e78,'request\x20sent');logger[_0xb657('0xe')](_0xb657('0xf'),_0x471e78,_0xb657('0x10'),JSON['stringify'](_0x36b334));if(_0x36b334[_0xb657('0x11')]){if(_0x36b334[_0xb657('0x11')][_0xb657('0x12')]===0x1f4){logger[_0xb657('0x11')]('ContactItemType,\x20%s,\x20%s',_0x471e78,_0x36b334[_0xb657('0x11')][_0xb657('0x13')]);return _0x42a844(_0x36b334['error'][_0xb657('0x13')]);}logger[_0xb657('0x11')](_0xb657('0xd'),_0x471e78,_0x36b334[_0xb657('0x11')]['message']);return _0x326dd7(_0x36b334[_0xb657('0x11')][_0xb657('0x13')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x471e78,_0xb657('0x10'));_0x326dd7(_0x36b334[_0xb657('0x14')][_0xb657('0x13')]);}})[_0xb657('0x15')](function(_0x17c045){logger[_0xb657('0x11')](_0xb657('0xd'),_0x471e78,_0x17c045);_0x42a844(_0x17c045);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 018efca..7455064 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 _0xce97=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce97,0x128));var _0x7ce9=function(_0xae471d,_0x4db54c){_0xae471d=_0xae471d-0x0;var _0x2963f4=_0xce97[_0xae471d];return _0x2963f4;};'use strict';var multer=require(_0x7ce9('0x0'));var util=require(_0x7ce9('0x1'));var path=require(_0x7ce9('0x2'));var timeout=require(_0x7ce9('0x3'));var express=require(_0x7ce9('0x4'));var router=express[_0x7ce9('0x5')]();var fs_extra=require(_0x7ce9('0x6'));var auth=require(_0x7ce9('0x7'));var interaction=require(_0x7ce9('0x8'));var config=require(_0x7ce9('0x9'));var controller=require(_0x7ce9('0xa'));router[_0x7ce9('0xb')]('/',auth[_0x7ce9('0xc')](),controller[_0x7ce9('0xd')]);router[_0x7ce9('0xb')](_0x7ce9('0xe'),auth[_0x7ce9('0xc')](),controller['show']);router[_0x7ce9('0xf')]('/',auth[_0x7ce9('0xc')](),controller['create']);router['put'](_0x7ce9('0xe'),auth[_0x7ce9('0xc')](),controller[_0x7ce9('0x10')]);router[_0x7ce9('0x11')]('/:id',auth[_0x7ce9('0xc')](),controller[_0x7ce9('0x12')]);module[_0x7ce9('0x13')]=router; \ No newline at end of file +var _0x2c2f=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x2c2f,0x1d2));var _0xf2c2=function(_0x17b207,_0x36a21d){_0x17b207=_0x17b207-0x0;var _0x2630b9=_0x2c2f[_0x17b207];return _0x2630b9;};'use strict';var multer=require(_0xf2c2('0x0'));var util=require(_0xf2c2('0x1'));var path=require(_0xf2c2('0x2'));var timeout=require(_0xf2c2('0x3'));var express=require(_0xf2c2('0x4'));var router=express[_0xf2c2('0x5')]();var fs_extra=require(_0xf2c2('0x6'));var auth=require(_0xf2c2('0x7'));var interaction=require(_0xf2c2('0x8'));var config=require(_0xf2c2('0x9'));var controller=require(_0xf2c2('0xa'));router[_0xf2c2('0xb')]('/',auth[_0xf2c2('0xc')](),controller[_0xf2c2('0xd')]);router[_0xf2c2('0xb')](_0xf2c2('0xe'),auth[_0xf2c2('0xc')](),controller[_0xf2c2('0xf')]);router[_0xf2c2('0x10')]('/',auth[_0xf2c2('0xc')](),controller[_0xf2c2('0x11')]);router[_0xf2c2('0x12')]('/:id',auth[_0xf2c2('0xc')](),controller[_0xf2c2('0x13')]);router[_0xf2c2('0x14')](_0xf2c2('0xe'),auth[_0xf2c2('0xc')](),controller[_0xf2c2('0x15')]);module[_0xf2c2('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index ceb2810..c1af9d8 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x3dab7b,_0x516920){var _0x2223a0=function(_0x12e51a){while(--_0x12e51a){_0x3dab7b['push'](_0x3dab7b['shift']());}};_0x2223a0(++_0x516920);}(_0x757a,0xde));var _0xa757=function(_0x26e9a2,_0x2cefa9){_0x26e9a2=_0x26e9a2-0x0;var _0x5af32f=_0x757a[_0x26e9a2];return _0x5af32f;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x1795fc,_0x549491){var _0x3263bb=function(_0x261b46){while(--_0x261b46){_0x1795fc['push'](_0x1795fc['shift']());}};_0x3263bb(++_0x549491);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index a59b517..da02f33 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 _0x95d1=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','Dashboard','fieldName','key','model','keys','filters','intersection','query','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','CustomDashboards','UserProfileSection','attrUrl','attrs','value','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','squel','crypto','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3410f3,_0x516979){var _0x5f2755=function(_0x305883){while(--_0x305883){_0x3410f3['push'](_0x3410f3['shift']());}};_0x5f2755(++_0x516979);}(_0x95d1,0x1f3));var _0x195d=function(_0x260b45,_0x2b6ef8){_0x260b45=_0x260b45-0x0;var _0x2b47d1=_0x95d1[_0x260b45];return _0x2b47d1;};'use strict';var emlformat=require(_0x195d('0x0'));var rimraf=require(_0x195d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x195d('0x2'));var rp=require('request-promise');var moment=require(_0x195d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x195d('0x4'));var util=require(_0x195d('0x5'));var path=require(_0x195d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x195d('0x7'));var fs=require('fs');var fs_extra=require(_0x195d('0x8'));var _=require('lodash');var squel=require(_0x195d('0x9'));var crypto=require(_0x195d('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x195d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x195d('0xc'));var qs=require(_0x195d('0xd'));var as=require(_0x195d('0xe'));var hardwareService=require(_0x195d('0xf'));var logger=require(_0x195d('0x10'))(_0x195d('0x11'));var utils=require(_0x195d('0x12'));var config=require(_0x195d('0x13'));var licenseUtil=require(_0x195d('0x14'));var db=require(_0x195d('0x15'))['db'];config[_0x195d('0x16')]=_[_0x195d('0x17')](config[_0x195d('0x16')],{'host':_0x195d('0x18'),'port':0x18eb});var socket=require(_0x195d('0x19'))(new Redis(config[_0x195d('0x16')]));require('./dashboard.socket')[_0x195d('0x1a')](socket);function respondWithStatusCode(_0x4c71a1,_0x4f1d13){_0x4f1d13=_0x4f1d13||0xcc;return function(_0x4cc423){if(_0x4cc423){return _0x4c71a1[_0x195d('0x1b')](_0x4f1d13);}return _0x4c71a1[_0x195d('0x1c')](_0x4f1d13)[_0x195d('0x1d')]();};}function respondWithResult(_0xd09ea4,_0x4eab52){_0x4eab52=_0x4eab52||0xc8;return function(_0xf53665){if(_0xf53665){return _0xd09ea4[_0x195d('0x1c')](_0x4eab52)[_0x195d('0x1e')](_0xf53665);}};}function respondWithFilteredResult(_0x1b5be3,_0x3f5a42){return function(_0x5d6fc4){if(_0x5d6fc4){var _0x1afa4f=typeof _0x3f5a42['offset']==='undefined'&&typeof _0x3f5a42['limit']===_0x195d('0x1f');var _0x44275c=_0x5d6fc4[_0x195d('0x20')];var _0x36febd=_0x1afa4f?0x0:_0x3f5a42[_0x195d('0x21')];var _0x17dc4d=_0x1afa4f?_0x5d6fc4[_0x195d('0x20')]:_0x3f5a42['offset']+_0x3f5a42[_0x195d('0x22')];var _0x20b093;if(_0x17dc4d>=_0x44275c){_0x17dc4d=_0x44275c;_0x20b093=0xc8;}else{_0x20b093=0xce;}_0x1b5be3[_0x195d('0x1c')](_0x20b093);return _0x1b5be3['set'](_0x195d('0x23'),_0x36febd+'-'+_0x17dc4d+'/'+_0x44275c)['json'](_0x5d6fc4);}return null;};}function patchUpdates(_0x31791b){return function(_0x93fbcf){try{jsonpatch[_0x195d('0x24')](_0x93fbcf,_0x31791b,!![]);}catch(_0x4cca20){return BPromise[_0x195d('0x25')](_0x4cca20);}return _0x93fbcf[_0x195d('0x26')]();};}function saveUpdates(_0x59d622,_0x4347b7){return function(_0x4a68c2){if(_0x4a68c2){return _0x4a68c2[_0x195d('0x27')](_0x59d622)[_0x195d('0x28')](function(_0x3ffe53){return _0x3ffe53;});}return null;};}function removeEntity(_0x1a10a9,_0x24cbad){return function(_0x1d3652){if(_0x1d3652){return _0x1d3652[_0x195d('0x29')]()[_0x195d('0x28')](function(){var _0xb0dea1=_0x1d3652[_0x195d('0x2a')]({'plain':!![]});var _0x1fd0ed='CustomDashboards';return db['UserProfileResource'][_0x195d('0x29')]({'where':{'type':_0x1fd0ed,'resourceId':_0xb0dea1['id']}})[_0x195d('0x28')](function(){return _0x1d3652;});})['then'](function(){_0x1a10a9[_0x195d('0x1c')](0xcc)[_0x195d('0x1d')]();});}};}function handleEntityNotFound(_0x19a28b,_0x1a4dac){return function(_0x22c68c){if(!_0x22c68c){_0x19a28b[_0x195d('0x1b')](0x194);}return _0x22c68c;};}function handleError(_0x56df53,_0x3db9fc){_0x3db9fc=_0x3db9fc||0x1f4;return function(_0xaada31){logger[_0x195d('0x2b')](_0xaada31[_0x195d('0x2c')]);if(_0xaada31[_0x195d('0x2d')]){delete _0xaada31[_0x195d('0x2d')];}_0x56df53[_0x195d('0x1c')](_0x3db9fc)[_0x195d('0x2e')](_0xaada31);};}exports[_0x195d('0x2f')]=function(_0x187e2f,_0x3a2734){var _0x2c62be={},_0x22c3b2={},_0x4ac1f2={'count':0x0,'rows':[]};var _0x4ef44e=_[_0x195d('0x30')](db[_0x195d('0x31')]['rawAttributes'],function(_0x287bad){return{'name':_0x287bad[_0x195d('0x32')],'type':_0x287bad['type'][_0x195d('0x33')]};});_0x22c3b2[_0x195d('0x34')]=_[_0x195d('0x30')](_0x4ef44e,_0x195d('0x2d'));_0x22c3b2['query']=_[_0x195d('0x35')](_0x187e2f['query']);_0x22c3b2[_0x195d('0x36')]=_[_0x195d('0x37')](_0x22c3b2[_0x195d('0x34')],_0x22c3b2[_0x195d('0x38')]);_0x2c62be['attributes']=_[_0x195d('0x37')](_0x22c3b2[_0x195d('0x34')],qs[_0x195d('0x39')](_0x187e2f['query']['fields']));_0x2c62be['attributes']=_0x2c62be['attributes'][_0x195d('0x3a')]?_0x2c62be[_0x195d('0x3b')]:_0x22c3b2[_0x195d('0x34')];if(!_0x187e2f[_0x195d('0x38')][_0x195d('0x3c')](_0x195d('0x3d'))){_0x2c62be[_0x195d('0x22')]=qs['limit'](_0x187e2f[_0x195d('0x38')][_0x195d('0x22')]);_0x2c62be[_0x195d('0x21')]=qs['offset'](_0x187e2f['query'][_0x195d('0x21')]);}_0x2c62be[_0x195d('0x3e')]=qs['sort'](_0x187e2f['query'][_0x195d('0x3f')]);_0x2c62be[_0x195d('0x40')]=qs[_0x195d('0x36')](_[_0x195d('0x41')](_0x187e2f[_0x195d('0x38')],_0x22c3b2[_0x195d('0x36')]),_0x4ef44e);if(_0x187e2f['query'][_0x195d('0x42')]){_0x2c62be[_0x195d('0x40')]=_[_0x195d('0x43')](_0x2c62be[_0x195d('0x40')],{'$or':_[_0x195d('0x30')](_0x4ef44e,function(_0x4d235d){if(_0x4d235d[_0x195d('0x44')]!==_0x195d('0x45')){var _0x3d5c94={};_0x3d5c94[_0x4d235d[_0x195d('0x2d')]]={'$like':'%'+_0x187e2f[_0x195d('0x38')][_0x195d('0x42')]+'%'};return _0x3d5c94;}})});}_0x2c62be=_['merge']({},_0x2c62be,_0x187e2f[_0x195d('0x46')]);var _0x30eb29={'where':_0x2c62be['where']};return db[_0x195d('0x31')][_0x195d('0x20')](_0x30eb29)['then'](function(_0x28ea98){_0x4ac1f2[_0x195d('0x20')]=_0x28ea98;if(_0x187e2f[_0x195d('0x38')][_0x195d('0x47')]){_0x2c62be['include']=[{'all':!![]}];}return db[_0x195d('0x31')][_0x195d('0x48')](_0x2c62be);})['then'](function(_0x46cd7b){_0x4ac1f2[_0x195d('0x49')]=_0x46cd7b;return _0x4ac1f2;})['then'](respondWithFilteredResult(_0x3a2734,_0x2c62be))[_0x195d('0x4a')](handleError(_0x3a2734,null));};exports['show']=function(_0x567fcf,_0x2b6a3b){var _0x9f139d={'raw':![],'where':{'id':_0x567fcf[_0x195d('0x4b')]['id']}},_0xb4a997={};_0xb4a997[_0x195d('0x34')]=_['keys'](db[_0x195d('0x31')][_0x195d('0x4c')]);_0xb4a997['query']=_['keys'](_0x567fcf[_0x195d('0x38')]);_0xb4a997[_0x195d('0x36')]=_[_0x195d('0x37')](_0xb4a997['model'],_0xb4a997[_0x195d('0x38')]);_0x9f139d[_0x195d('0x3b')]=_['intersection'](_0xb4a997[_0x195d('0x34')],qs['fields'](_0x567fcf[_0x195d('0x38')][_0x195d('0x39')]));_0x9f139d[_0x195d('0x3b')]=_0x9f139d['attributes'][_0x195d('0x3a')]?_0x9f139d[_0x195d('0x3b')]:_0xb4a997[_0x195d('0x34')];if(_0x567fcf[_0x195d('0x38')][_0x195d('0x47')]){_0x9f139d[_0x195d('0x4d')]=[{'all':!![]}];}_0x9f139d=_[_0x195d('0x43')]({},_0x9f139d,_0x567fcf[_0x195d('0x46')]);return db[_0x195d('0x31')][_0x195d('0x4e')](_0x9f139d)[_0x195d('0x28')](handleEntityNotFound(_0x2b6a3b,null))[_0x195d('0x28')](respondWithResult(_0x2b6a3b,null))['catch'](handleError(_0x2b6a3b,null));};exports[_0x195d('0x4f')]=function(_0x24df22,_0x481add){return db['Dashboard'][_0x195d('0x4f')](_0x24df22[_0x195d('0x50')],{})[_0x195d('0x28')](function(_0x58fd7e){var _0x52b4cc=_0x24df22['user'][_0x195d('0x2a')]({'plain':!![]});if(!_0x52b4cc)throw new Error(_0x195d('0x51'));if(_0x52b4cc[_0x195d('0x52')]===_0x195d('0x53')){var _0x348cee=_0x58fd7e['get']({'plain':!![]});var _0x580172='CustomDashboards';return db['UserProfileSection'][_0x195d('0x4e')]({'where':{'name':_0x580172,'userProfileId':_0x52b4cc[_0x195d('0x54')]},'raw':!![]})['then'](function(_0x402bf2){if(_0x402bf2&&_0x402bf2[_0x195d('0x55')]===0x0){return db[_0x195d('0x56')]['create']({'name':_0x348cee[_0x195d('0x2d')],'resourceId':_0x348cee['id'],'type':_0x402bf2['name'],'sectionId':_0x402bf2['id']},{})[_0x195d('0x28')](function(){return _0x58fd7e;});}else{return _0x58fd7e;}})[_0x195d('0x4a')](function(_0x46110d){logger[_0x195d('0x2b')](_0x195d('0x57'),_0x46110d);throw _0x46110d;});}return _0x58fd7e;})['then'](respondWithResult(_0x481add,0xc9))[_0x195d('0x4a')](handleError(_0x481add,null));};exports[_0x195d('0x58')]=function(_0xc5fa37,_0x1c2c7f){var _0x264b9a={'where':{'id':_0xc5fa37['params']['id']}},_0x3dccfc={};_0x3dccfc['model']=_[_0x195d('0x35')](db['Dashboard'][_0x195d('0x4c')]);_0x264b9a[_0x195d('0x3b')]=_[_0x195d('0x37')](_0x3dccfc[_0x195d('0x34')],qs[_0x195d('0x39')](_0xc5fa37[_0x195d('0x38')][_0x195d('0x39')]));_0x264b9a[_0x195d('0x3b')]=_0x264b9a[_0x195d('0x3b')][_0x195d('0x3a')]?_0x264b9a[_0x195d('0x3b')]:_0x3dccfc[_0x195d('0x34')];if(_0xc5fa37[_0x195d('0x38')]['includeAll']){_0x264b9a[_0x195d('0x4d')]=[{'all':!![]}];}_0x264b9a=_[_0x195d('0x43')]({},_0x264b9a,_0xc5fa37[_0x195d('0x46')]);return db[_0x195d('0x31')]['find'](_0x264b9a)[_0x195d('0x28')](handleEntityNotFound(_0x1c2c7f,null))[_0x195d('0x28')](function(_0x188bdf){if(_0x188bdf){var _0x378a0a=_0x188bdf[_0x195d('0x2a')]({'plain':!![]});_0x378a0a=qs[_0x195d('0x59')](_0x378a0a,['id','createdAt','updatedAt']);_0xc5fa37[_0x195d('0x50')]=_[_0x195d('0x59')](_0xc5fa37[_0x195d('0x50')],['id',_0x195d('0x5a'),_0x195d('0x5b')]);return db[_0x195d('0x31')]['create'](_['merge'](_0x378a0a,_0xc5fa37['body']),{'include':_0xc5fa37[_0x195d('0x38')][_0x195d('0x47')]?[{'all':!![]}]:undefined})[_0x195d('0x28')](function(_0x4516ab){var _0x576740=_0xc5fa37[_0x195d('0x53')][_0x195d('0x2a')]({'plain':!![]});if(!_0x576740)throw new Error(_0x195d('0x51'));if(_0x576740[_0x195d('0x52')]===_0x195d('0x53')){var _0x549b44=_0x4516ab[_0x195d('0x2a')]({'plain':!![]});var _0x49c0a5=_0x195d('0x5c');return db[_0x195d('0x5d')][_0x195d('0x4e')]({'where':{'name':_0x49c0a5,'userProfileId':_0x576740[_0x195d('0x54')]},'raw':!![]})[_0x195d('0x28')](function(_0x2451f0){if(_0x2451f0&&_0x2451f0['autoAssociation']===0x0){return db[_0x195d('0x56')][_0x195d('0x4f')]({'name':_0x549b44[_0x195d('0x2d')],'resourceId':_0x549b44['id'],'type':_0x2451f0[_0x195d('0x2d')],'sectionId':_0x2451f0['id']},{})['then'](function(){return _0x4516ab;});}else{return _0x4516ab;}})[_0x195d('0x4a')](function(_0x234c91){logger[_0x195d('0x2b')](_0x195d('0x57'),_0x234c91);throw _0x234c91;});}return _0x4516ab;});}})[_0x195d('0x28')](respondWithResult(_0x1c2c7f,0xc9))['catch'](handleError(_0x1c2c7f,null));};exports[_0x195d('0x27')]=function(_0x2f2ae4,_0x1d5181){if(_0x2f2ae4[_0x195d('0x50')]['id']){delete _0x2f2ae4[_0x195d('0x50')]['id'];}return db[_0x195d('0x31')][_0x195d('0x4e')]({'where':{'id':_0x2f2ae4[_0x195d('0x4b')]['id']}})[_0x195d('0x28')](handleEntityNotFound(_0x1d5181,null))[_0x195d('0x28')](saveUpdates(_0x2f2ae4[_0x195d('0x50')],null))[_0x195d('0x28')](respondWithResult(_0x1d5181,null))['catch'](handleError(_0x1d5181,null));};exports[_0x195d('0x29')]=function(_0x52b35b,_0x2dc87e){return db['Dashboard'][_0x195d('0x4e')]({'where':{'id':_0x52b35b[_0x195d('0x4b')]['id']}})[_0x195d('0x28')](handleEntityNotFound(_0x2dc87e,null))[_0x195d('0x28')](removeEntity(_0x2dc87e,null))[_0x195d('0x4a')](handleError(_0x2dc87e,null));};function widgetAttributes(_0x29a131){try{switch(_0x29a131[_0x195d('0x44')]){case'iframe':return[{'name':_0x195d('0x5e'),'value':_0x29a131[_0x195d('0x5e')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131['attrs'][0x0]?_0x29a131[_0x195d('0x5f')][0x0][_0x195d('0x60')]:undefined)||'https://'}];case'custom':return[{'name':_0x195d('0x61'),'value':_0x29a131[_0x195d('0x61')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x0]?_0x29a131[_0x195d('0x5f')][0x0][_0x195d('0x60')]:undefined)||''}];case _0x195d('0x62'):return[{'name':'attrHourFormat','value':_0x29a131['attrHourFormat']||(_0x29a131['attrs']&&_0x29a131['attrs'][0x0]?_0x29a131[_0x195d('0x5f')][0x0]['value']:undefined)||_0x195d('0x63')},{'name':_0x195d('0x64'),'value':_0x29a131[_0x195d('0x64')]||(_0x29a131['attrs']&&_0x29a131[_0x195d('0x5f')][0x1]?_0x29a131[_0x195d('0x5f')][0x1][_0x195d('0x60')]:undefined)||_0x195d('0x65')},{'name':_0x195d('0x66'),'value':_0x29a131[_0x195d('0x66')]||(_0x29a131['attrs']&&_0x29a131[_0x195d('0x5f')][0x2]?_0x29a131[_0x195d('0x5f')][0x2][_0x195d('0x60')]:undefined)||0xc}];case _0x195d('0x67'):return[{'name':_0x195d('0x68'),'value':_0x29a131[_0x195d('0x68')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x0]?_0x29a131[_0x195d('0x5f')][0x0][_0x195d('0x60')]:undefined)||_0x195d('0x69')},{'name':'attrVoiceQueues','value':_0x29a131[_0x195d('0x6a')]||(_0x29a131['attrs']&&_0x29a131[_0x195d('0x5f')][0x1]?_0x29a131[_0x195d('0x5f')][0x1][_0x195d('0x60')]:undefined)||[]},{'name':_0x195d('0x66'),'value':_0x29a131[_0x195d('0x66')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x2]?_0x29a131[_0x195d('0x5f')][0x2][_0x195d('0x60')]:undefined)||0x14},{'name':_0x195d('0x6b'),'value':_0x29a131[_0x195d('0x6b')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x3]?_0x29a131[_0x195d('0x5f')][0x3][_0x195d('0x60')]:undefined)||_0x195d('0x6c')},{'name':_0x195d('0x6d'),'value':_0x29a131[_0x195d('0x6d')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x4]?_0x29a131[_0x195d('0x5f')][0x4][_0x195d('0x60')]:undefined)||''},{'name':_0x195d('0x6e'),'value':_0x29a131[_0x195d('0x6e')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131['attrs'][0x5]?_0x29a131[_0x195d('0x5f')][0x5][_0x195d('0x60')]:undefined)||''},{'name':_0x195d('0x6f'),'value':_0x29a131[_0x195d('0x6f')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131['attrs'][0x6]?_0x29a131[_0x195d('0x5f')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x29a131[_0x195d('0x70')]||(_0x29a131['attrs']&&_0x29a131['attrs'][0x7]?_0x29a131[_0x195d('0x5f')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x29a131['attrWhatsappAccounts']||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x8]?_0x29a131[_0x195d('0x5f')][0x8][_0x195d('0x60')]:undefined)||''},{'name':_0x195d('0x71'),'value':_0x29a131[_0x195d('0x71')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131['attrs'][0x9]?_0x29a131[_0x195d('0x5f')][0x9]['value']:undefined)||''}];case _0x195d('0x72'):case'pie-chart':return[{'name':_0x195d('0x73'),'value':_0x29a131[_0x195d('0x73')]||(_0x29a131['attrs']&&_0x29a131[_0x195d('0x5f')][0x0]?_0x29a131[_0x195d('0x5f')][0x0][_0x195d('0x60')]:undefined)||_0x195d('0x69')},{'name':_0x195d('0x74'),'value':_0x29a131[_0x195d('0x74')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x1]?_0x29a131[_0x195d('0x5f')][0x1]['value']:undefined)||null},{'name':_0x195d('0x75'),'value':_0x29a131[_0x195d('0x75')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x2]?_0x29a131[_0x195d('0x5f')][0x2][_0x195d('0x60')]:undefined)||null},{'name':_0x195d('0x6a'),'value':_0x29a131[_0x195d('0x6a')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131['attrs'][0x3]?_0x29a131['attrs'][0x3][_0x195d('0x60')]:undefined)||[]},{'name':_0x195d('0x6b'),'value':_0x29a131['attrChannel']||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x4]?_0x29a131[_0x195d('0x5f')][0x4]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x29a131['attrEmailAccounts']||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x5]?_0x29a131['attrs'][0x5][_0x195d('0x60')]:undefined)||''},{'name':_0x195d('0x6e'),'value':_0x29a131[_0x195d('0x6e')]||(_0x29a131['attrs']&&_0x29a131['attrs'][0x6]?_0x29a131[_0x195d('0x5f')][0x6]['value']:undefined)||''},{'name':_0x195d('0x6f'),'value':_0x29a131[_0x195d('0x6f')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x7]?_0x29a131[_0x195d('0x5f')][0x7][_0x195d('0x60')]:undefined)||''},{'name':_0x195d('0x70'),'value':_0x29a131[_0x195d('0x70')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x8]?_0x29a131['attrs'][0x8][_0x195d('0x60')]:undefined)||''},{'name':_0x195d('0x76'),'value':_0x29a131[_0x195d('0x76')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x9]?_0x29a131[_0x195d('0x5f')][0x9][_0x195d('0x60')]:undefined)||''},{'name':_0x195d('0x71'),'value':_0x29a131[_0x195d('0x71')]||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0xa]?_0x29a131[_0x195d('0x5f')][0xa]['value']:undefined)||''}];case _0x195d('0x77'):return[{'name':_0x195d('0x78'),'type':_0x29a131[_0x195d('0x79')]||(_0x29a131['attrs']&&_0x29a131['attrs'][0x0]?_0x29a131['attrs'][0x0][_0x195d('0x44')]:undefined)||null,'value':_0x29a131[_0x195d('0x78')]||(_0x29a131['attrs']&&_0x29a131[_0x195d('0x5f')][0x0]?_0x29a131[_0x195d('0x5f')][0x0]['value']:undefined)||null},{'name':_0x195d('0x7a'),'value':_0x29a131['attrRefresh']||(_0x29a131[_0x195d('0x5f')]&&_0x29a131[_0x195d('0x5f')][0x1]?_0x29a131[_0x195d('0x5f')][0x1][_0x195d('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x4ddfe6){logger[_0x195d('0x2b')](_0x195d('0x7b'),JSON[_0x195d('0x7c')](_0x4ddfe6));return[];}}exports[_0x195d('0x7d')]=function(_0x24fe07,_0xd35f4b,_0x442ce1){if(_0x24fe07[_0x195d('0x50')]['id']){delete _0x24fe07[_0x195d('0x50')]['id'];}return db[_0x195d('0x31')][_0x195d('0x4e')]({'where':{'id':_0x24fe07[_0x195d('0x4b')]['id']}})['then'](handleEntityNotFound(_0xd35f4b,null))[_0x195d('0x28')](function(_0x5c75f3){if(_0x5c75f3){_0x24fe07['body'][_0x195d('0x7e')]=_0x5c75f3['id'];_0x24fe07[_0x195d('0x50')]['attrs']=widgetAttributes(_0x24fe07[_0x195d('0x50')]);return db['DashboardItem'][_0x195d('0x4f')](_0x24fe07[_0x195d('0x50')]);}})[_0x195d('0x28')](respondWithResult(_0xd35f4b,null))[_0x195d('0x4a')](handleError(_0xd35f4b,null));};exports[_0x195d('0x7f')]=function(_0x3eafd8,_0x1f08b6,_0x3c9c5a){var _0x7b315d={};var _0x556550={};var _0x29069a;var _0x575ae7;return db['Dashboard'][_0x195d('0x80')]({'where':{'id':_0x3eafd8[_0x195d('0x4b')]['id']}})[_0x195d('0x28')](handleEntityNotFound(_0x1f08b6,null))['then'](function(_0x3fb9e7){if(_0x3fb9e7){_0x29069a=_0x3fb9e7;_0x556550[_0x195d('0x34')]=_[_0x195d('0x35')](db[_0x195d('0x81')][_0x195d('0x4c')]);_0x556550[_0x195d('0x38')]=_[_0x195d('0x35')](_0x3eafd8['query']);_0x556550[_0x195d('0x36')]=_[_0x195d('0x37')](_0x556550[_0x195d('0x34')],_0x556550['query']);_0x7b315d[_0x195d('0x3b')]=_['intersection'](_0x556550[_0x195d('0x34')],qs[_0x195d('0x39')](_0x3eafd8[_0x195d('0x38')][_0x195d('0x39')]));_0x7b315d[_0x195d('0x3b')]=_0x7b315d[_0x195d('0x3b')]['length']?_0x7b315d[_0x195d('0x3b')]:_0x556550[_0x195d('0x34')];_0x7b315d['order']=qs[_0x195d('0x3f')](_0x3eafd8[_0x195d('0x38')][_0x195d('0x3f')]);_0x7b315d[_0x195d('0x40')]=qs['filters'](_[_0x195d('0x41')](_0x3eafd8[_0x195d('0x38')],_0x556550[_0x195d('0x36')]));if(_0x3eafd8[_0x195d('0x38')][_0x195d('0x42')]){_0x7b315d[_0x195d('0x40')]=_[_0x195d('0x43')](_0x7b315d[_0x195d('0x40')],{'$or':_[_0x195d('0x30')](_0x7b315d['attributes'],function(_0x5b2896){var _0x556b43={};_0x556b43[_0x5b2896]={'$like':'%'+_0x3eafd8[_0x195d('0x38')][_0x195d('0x42')]+'%'};return _0x556b43;})});}_0x7b315d=_[_0x195d('0x43')]({},_0x7b315d,_0x3eafd8[_0x195d('0x46')]);return _0x29069a[_0x195d('0x7f')](_0x7b315d);}})['then'](function(_0x1d3191){if(_0x1d3191){_0x575ae7=_0x1d3191[_0x195d('0x3a')];if(!_0x3eafd8[_0x195d('0x38')][_0x195d('0x3c')]('nolimit')){_0x7b315d['limit']=qs[_0x195d('0x22')](_0x3eafd8[_0x195d('0x38')][_0x195d('0x22')]);_0x7b315d['offset']=qs['offset'](_0x3eafd8[_0x195d('0x38')][_0x195d('0x21')]);}return _0x29069a[_0x195d('0x7f')](_0x7b315d);}})[_0x195d('0x28')](function(_0x3483da){if(_0x3483da){return _0x3483da?{'count':_0x575ae7,'rows':_0x3483da}:null;}})[_0x195d('0x28')](respondWithResult(_0x1f08b6,null))[_0x195d('0x4a')](handleError(_0x1f08b6,null));}; \ No newline at end of file +var _0x87bb=['fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','get','UserProfileResource','destroy','name','index','Dashboard','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','map','VIRTUAL','options','findAll','rows','catch','rawAttributes','includeAll','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x87bb,0x7a));var _0xb87b=function(_0x23ae4c,_0x58df94){_0x23ae4c=_0x23ae4c-0x0;var _0x5f4379=_0x87bb[_0x23ae4c];return _0x5f4379;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb87b('0x0'));var jsonpatch=require(_0xb87b('0x1'));var rp=require(_0xb87b('0x2'));var moment=require(_0xb87b('0x3'));var BPromise=require(_0xb87b('0x4'));var Mustache=require(_0xb87b('0x5'));var util=require(_0xb87b('0x6'));var path=require('path');var sox=require(_0xb87b('0x7'));var csv=require(_0xb87b('0x8'));var ejs=require(_0xb87b('0x9'));var fs=require('fs');var fs_extra=require(_0xb87b('0xa'));var _=require(_0xb87b('0xb'));var squel=require(_0xb87b('0xc'));var crypto=require('crypto');var jsforce=require(_0xb87b('0xd'));var deskjs=require(_0xb87b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb87b('0xf'));var Redis=require(_0xb87b('0x10'));var authService=require(_0xb87b('0x11'));var qs=require(_0xb87b('0x12'));var as=require(_0xb87b('0x13'));var hardwareService=require(_0xb87b('0x14'));var logger=require(_0xb87b('0x15'))('api');var utils=require(_0xb87b('0x16'));var config=require(_0xb87b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb87b('0x18'))['db'];config[_0xb87b('0x19')]=_['defaults'](config[_0xb87b('0x19')],{'host':_0xb87b('0x1a'),'port':0x18eb});var socket=require(_0xb87b('0x1b'))(new Redis(config[_0xb87b('0x19')]));require(_0xb87b('0x1c'))['register'](socket);function respondWithStatusCode(_0x1b3b39,_0x3700b1){_0x3700b1=_0x3700b1||0xcc;return function(_0x50f310){if(_0x50f310){return _0x1b3b39[_0xb87b('0x1d')](_0x3700b1);}return _0x1b3b39[_0xb87b('0x1e')](_0x3700b1)[_0xb87b('0x1f')]();};}function respondWithResult(_0x351883,_0x4e0976){_0x4e0976=_0x4e0976||0xc8;return function(_0x509c1b){if(_0x509c1b){return _0x351883[_0xb87b('0x1e')](_0x4e0976)['json'](_0x509c1b);}};}function respondWithFilteredResult(_0x1f8641,_0x4e38b5){return function(_0x3f92fe){if(_0x3f92fe){var _0x208141=typeof _0x4e38b5['offset']===_0xb87b('0x20')&&typeof _0x4e38b5[_0xb87b('0x21')]==='undefined';var _0x22225d=_0x3f92fe[_0xb87b('0x22')];var _0x135253=_0x208141?0x0:_0x4e38b5[_0xb87b('0x23')];var _0x17e580=_0x208141?_0x3f92fe[_0xb87b('0x22')]:_0x4e38b5[_0xb87b('0x23')]+_0x4e38b5['limit'];var _0x1d3f12;if(_0x17e580>=_0x22225d){_0x17e580=_0x22225d;_0x1d3f12=0xc8;}else{_0x1d3f12=0xce;}_0x1f8641[_0xb87b('0x1e')](_0x1d3f12);return _0x1f8641[_0xb87b('0x24')]('Content-Range',_0x135253+'-'+_0x17e580+'/'+_0x22225d)[_0xb87b('0x25')](_0x3f92fe);}return null;};}function patchUpdates(_0x5a9f90){return function(_0x32a40e){try{jsonpatch[_0xb87b('0x26')](_0x32a40e,_0x5a9f90,!![]);}catch(_0x3615aa){return BPromise[_0xb87b('0x27')](_0x3615aa);}return _0x32a40e[_0xb87b('0x28')]();};}function saveUpdates(_0x9e818,_0x59ac9c){return function(_0x35c8e1){if(_0x35c8e1){return _0x35c8e1['update'](_0x9e818)[_0xb87b('0x29')](function(_0x498cae){return _0x498cae;});}return null;};}function removeEntity(_0x2360ca,_0x5cc475){return function(_0x1544f9){if(_0x1544f9){return _0x1544f9['destroy']()[_0xb87b('0x29')](function(){var _0x406e68=_0x1544f9[_0xb87b('0x2a')]({'plain':!![]});var _0x6b1b70='CustomDashboards';return db[_0xb87b('0x2b')][_0xb87b('0x2c')]({'where':{'type':_0x6b1b70,'resourceId':_0x406e68['id']}})['then'](function(){return _0x1544f9;});})['then'](function(){_0x2360ca[_0xb87b('0x1e')](0xcc)[_0xb87b('0x1f')]();});}};}function handleEntityNotFound(_0x4c49b3,_0x1cd480){return function(_0x24130f){if(!_0x24130f){_0x4c49b3['sendStatus'](0x194);}return _0x24130f;};}function handleError(_0x124b7e,_0x5dcbfd){_0x5dcbfd=_0x5dcbfd||0x1f4;return function(_0x106b68){logger['error'](_0x106b68['stack']);if(_0x106b68[_0xb87b('0x2d')]){delete _0x106b68[_0xb87b('0x2d')];}_0x124b7e['status'](_0x5dcbfd)['send'](_0x106b68);};}exports[_0xb87b('0x2e')]=function(_0x41be4a,_0x32ea21){var _0xc9d6dd={},_0x95d3bd={},_0x1dd8bf={'count':0x0,'rows':[]};var _0xaa10e1=_['map'](db[_0xb87b('0x2f')]['rawAttributes'],function(_0x15c5cc){return{'name':_0x15c5cc['fieldName'],'type':_0x15c5cc[_0xb87b('0x30')][_0xb87b('0x31')]};});_0x95d3bd[_0xb87b('0x32')]=_['map'](_0xaa10e1,_0xb87b('0x2d'));_0x95d3bd[_0xb87b('0x33')]=_[_0xb87b('0x34')](_0x41be4a[_0xb87b('0x33')]);_0x95d3bd[_0xb87b('0x35')]=_[_0xb87b('0x36')](_0x95d3bd['model'],_0x95d3bd[_0xb87b('0x33')]);_0xc9d6dd[_0xb87b('0x37')]=_[_0xb87b('0x36')](_0x95d3bd[_0xb87b('0x32')],qs[_0xb87b('0x38')](_0x41be4a['query'][_0xb87b('0x38')]));_0xc9d6dd['attributes']=_0xc9d6dd[_0xb87b('0x37')][_0xb87b('0x39')]?_0xc9d6dd[_0xb87b('0x37')]:_0x95d3bd[_0xb87b('0x32')];if(!_0x41be4a['query'][_0xb87b('0x3a')]('nolimit')){_0xc9d6dd[_0xb87b('0x21')]=qs[_0xb87b('0x21')](_0x41be4a[_0xb87b('0x33')][_0xb87b('0x21')]);_0xc9d6dd['offset']=qs[_0xb87b('0x23')](_0x41be4a[_0xb87b('0x33')][_0xb87b('0x23')]);}_0xc9d6dd['order']=qs[_0xb87b('0x3b')](_0x41be4a[_0xb87b('0x33')][_0xb87b('0x3b')]);_0xc9d6dd['where']=qs['filters'](_[_0xb87b('0x3c')](_0x41be4a['query'],_0x95d3bd[_0xb87b('0x35')]),_0xaa10e1);if(_0x41be4a[_0xb87b('0x33')][_0xb87b('0x3d')]){_0xc9d6dd[_0xb87b('0x3e')]=_[_0xb87b('0x3f')](_0xc9d6dd[_0xb87b('0x3e')],{'$or':_[_0xb87b('0x40')](_0xaa10e1,function(_0x4641dd){if(_0x4641dd[_0xb87b('0x30')]!==_0xb87b('0x41')){var _0x5c8e5b={};_0x5c8e5b[_0x4641dd[_0xb87b('0x2d')]]={'$like':'%'+_0x41be4a[_0xb87b('0x33')]['filter']+'%'};return _0x5c8e5b;}})});}_0xc9d6dd=_[_0xb87b('0x3f')]({},_0xc9d6dd,_0x41be4a[_0xb87b('0x42')]);var _0x9c41b0={'where':_0xc9d6dd[_0xb87b('0x3e')]};return db[_0xb87b('0x2f')][_0xb87b('0x22')](_0x9c41b0)[_0xb87b('0x29')](function(_0xa77de1){_0x1dd8bf[_0xb87b('0x22')]=_0xa77de1;if(_0x41be4a[_0xb87b('0x33')]['includeAll']){_0xc9d6dd['include']=[{'all':!![]}];}return db[_0xb87b('0x2f')][_0xb87b('0x43')](_0xc9d6dd);})['then'](function(_0x375df3){_0x1dd8bf[_0xb87b('0x44')]=_0x375df3;return _0x1dd8bf;})[_0xb87b('0x29')](respondWithFilteredResult(_0x32ea21,_0xc9d6dd))[_0xb87b('0x45')](handleError(_0x32ea21,null));};exports['show']=function(_0x1f29fe,_0xd44136){var _0x57e28f={'raw':![],'where':{'id':_0x1f29fe['params']['id']}},_0x2d5431={};_0x2d5431['model']=_[_0xb87b('0x34')](db[_0xb87b('0x2f')][_0xb87b('0x46')]);_0x2d5431[_0xb87b('0x33')]=_[_0xb87b('0x34')](_0x1f29fe[_0xb87b('0x33')]);_0x2d5431[_0xb87b('0x35')]=_[_0xb87b('0x36')](_0x2d5431['model'],_0x2d5431[_0xb87b('0x33')]);_0x57e28f['attributes']=_[_0xb87b('0x36')](_0x2d5431[_0xb87b('0x32')],qs['fields'](_0x1f29fe[_0xb87b('0x33')][_0xb87b('0x38')]));_0x57e28f[_0xb87b('0x37')]=_0x57e28f[_0xb87b('0x37')]['length']?_0x57e28f['attributes']:_0x2d5431[_0xb87b('0x32')];if(_0x1f29fe['query'][_0xb87b('0x47')]){_0x57e28f[_0xb87b('0x48')]=[{'all':!![]}];}_0x57e28f=_[_0xb87b('0x3f')]({},_0x57e28f,_0x1f29fe[_0xb87b('0x42')]);return db[_0xb87b('0x2f')]['find'](_0x57e28f)[_0xb87b('0x29')](handleEntityNotFound(_0xd44136,null))['then'](respondWithResult(_0xd44136,null))[_0xb87b('0x45')](handleError(_0xd44136,null));};exports[_0xb87b('0x49')]=function(_0x29f744,_0x59d497){return db[_0xb87b('0x2f')][_0xb87b('0x49')](_0x29f744[_0xb87b('0x4a')],{})[_0xb87b('0x29')](function(_0x583975){var _0x515be5=_0x29f744['user']['get']({'plain':!![]});if(!_0x515be5)throw new Error(_0xb87b('0x4b'));if(_0x515be5[_0xb87b('0x4c')]===_0xb87b('0x4d')){var _0x5047be=_0x583975['get']({'plain':!![]});var _0x3818a6=_0xb87b('0x4e');return db[_0xb87b('0x4f')][_0xb87b('0x50')]({'where':{'name':_0x3818a6,'userProfileId':_0x515be5[_0xb87b('0x51')]},'raw':!![]})[_0xb87b('0x29')](function(_0x4eee09){if(_0x4eee09&&_0x4eee09[_0xb87b('0x52')]===0x0){return db[_0xb87b('0x2b')][_0xb87b('0x49')]({'name':_0x5047be[_0xb87b('0x2d')],'resourceId':_0x5047be['id'],'type':_0x4eee09[_0xb87b('0x2d')],'sectionId':_0x4eee09['id']},{})['then'](function(){return _0x583975;});}else{return _0x583975;}})[_0xb87b('0x45')](function(_0x5ec159){logger[_0xb87b('0x53')](_0xb87b('0x54'),_0x5ec159);throw _0x5ec159;});}return _0x583975;})['then'](respondWithResult(_0x59d497,0xc9))[_0xb87b('0x45')](handleError(_0x59d497,null));};exports[_0xb87b('0x55')]=function(_0x4f558f,_0x36b6f4){var _0x355764={'where':{'id':_0x4f558f[_0xb87b('0x56')]['id']}},_0x31edcf={};_0x31edcf['model']=_[_0xb87b('0x34')](db[_0xb87b('0x2f')][_0xb87b('0x46')]);_0x355764[_0xb87b('0x37')]=_[_0xb87b('0x36')](_0x31edcf[_0xb87b('0x32')],qs[_0xb87b('0x38')](_0x4f558f[_0xb87b('0x33')]['fields']));_0x355764[_0xb87b('0x37')]=_0x355764[_0xb87b('0x37')][_0xb87b('0x39')]?_0x355764['attributes']:_0x31edcf[_0xb87b('0x32')];if(_0x4f558f['query'][_0xb87b('0x47')]){_0x355764['include']=[{'all':!![]}];}_0x355764=_['merge']({},_0x355764,_0x4f558f[_0xb87b('0x42')]);return db[_0xb87b('0x2f')][_0xb87b('0x50')](_0x355764)[_0xb87b('0x29')](handleEntityNotFound(_0x36b6f4,null))[_0xb87b('0x29')](function(_0x1ad137){if(_0x1ad137){var _0x1970f7=_0x1ad137['get']({'plain':!![]});_0x1970f7=qs['omit'](_0x1970f7,['id',_0xb87b('0x57'),_0xb87b('0x58')]);_0x4f558f[_0xb87b('0x4a')]=_[_0xb87b('0x59')](_0x4f558f[_0xb87b('0x4a')],['id',_0xb87b('0x57'),_0xb87b('0x58')]);return db['Dashboard']['create'](_[_0xb87b('0x3f')](_0x1970f7,_0x4f558f[_0xb87b('0x4a')]),{'include':_0x4f558f['query'][_0xb87b('0x47')]?[{'all':!![]}]:undefined})[_0xb87b('0x29')](function(_0x1fdc8c){var _0x14cf71=_0x4f558f['user'][_0xb87b('0x2a')]({'plain':!![]});if(!_0x14cf71)throw new Error(_0xb87b('0x4b'));if(_0x14cf71[_0xb87b('0x4c')]==='user'){var _0x1eaa5a=_0x1fdc8c[_0xb87b('0x2a')]({'plain':!![]});var _0x1476d4=_0xb87b('0x4e');return db[_0xb87b('0x4f')][_0xb87b('0x50')]({'where':{'name':_0x1476d4,'userProfileId':_0x14cf71[_0xb87b('0x51')]},'raw':!![]})['then'](function(_0x2a2edc){if(_0x2a2edc&&_0x2a2edc[_0xb87b('0x52')]===0x0){return db['UserProfileResource'][_0xb87b('0x49')]({'name':_0x1eaa5a[_0xb87b('0x2d')],'resourceId':_0x1eaa5a['id'],'type':_0x2a2edc[_0xb87b('0x2d')],'sectionId':_0x2a2edc['id']},{})[_0xb87b('0x29')](function(){return _0x1fdc8c;});}else{return _0x1fdc8c;}})[_0xb87b('0x45')](function(_0x1f0f2c){logger['error'](_0xb87b('0x54'),_0x1f0f2c);throw _0x1f0f2c;});}return _0x1fdc8c;});}})[_0xb87b('0x29')](respondWithResult(_0x36b6f4,0xc9))['catch'](handleError(_0x36b6f4,null));};exports[_0xb87b('0x5a')]=function(_0x36d916,_0x433fc1){if(_0x36d916[_0xb87b('0x4a')]['id']){delete _0x36d916['body']['id'];}return db[_0xb87b('0x2f')][_0xb87b('0x50')]({'where':{'id':_0x36d916['params']['id']}})[_0xb87b('0x29')](handleEntityNotFound(_0x433fc1,null))[_0xb87b('0x29')](saveUpdates(_0x36d916[_0xb87b('0x4a')],null))[_0xb87b('0x29')](respondWithResult(_0x433fc1,null))[_0xb87b('0x45')](handleError(_0x433fc1,null));};exports[_0xb87b('0x2c')]=function(_0x3bbb71,_0x4bd2db){return db[_0xb87b('0x2f')][_0xb87b('0x50')]({'where':{'id':_0x3bbb71[_0xb87b('0x56')]['id']}})[_0xb87b('0x29')](handleEntityNotFound(_0x4bd2db,null))['then'](removeEntity(_0x4bd2db,null))[_0xb87b('0x45')](handleError(_0x4bd2db,null));};function widgetAttributes(_0xeeb79a){try{switch(_0xeeb79a[_0xb87b('0x30')]){case _0xb87b('0x5b'):return[{'name':_0xb87b('0x5c'),'value':_0xeeb79a[_0xb87b('0x5c')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a['attrs'][0x0]?_0xeeb79a[_0xb87b('0x5d')][0x0][_0xb87b('0x5e')]:undefined)||_0xb87b('0x5f')}];case _0xb87b('0x60'):return[{'name':_0xb87b('0x61'),'value':_0xeeb79a[_0xb87b('0x61')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x0]?_0xeeb79a['attrs'][0x0][_0xb87b('0x5e')]:undefined)||''}];case _0xb87b('0x62'):return[{'name':'attrHourFormat','value':_0xeeb79a[_0xb87b('0x63')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x0]?_0xeeb79a[_0xb87b('0x5d')][0x0]['value']:undefined)||_0xb87b('0x64')},{'name':_0xb87b('0x65'),'value':_0xeeb79a[_0xb87b('0x65')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x1]?_0xeeb79a[_0xb87b('0x5d')][0x1][_0xb87b('0x5e')]:undefined)||'0.00'},{'name':_0xb87b('0x66'),'value':_0xeeb79a[_0xb87b('0x66')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x2]?_0xeeb79a['attrs'][0x2][_0xb87b('0x5e')]:undefined)||0xc}];case _0xb87b('0x67'):return[{'name':'attrMetric','value':_0xeeb79a[_0xb87b('0x68')]||(_0xeeb79a['attrs']&&_0xeeb79a[_0xb87b('0x5d')][0x0]?_0xeeb79a[_0xb87b('0x5d')][0x0][_0xb87b('0x5e')]:undefined)||_0xb87b('0x69')},{'name':_0xb87b('0x6a'),'value':_0xeeb79a[_0xb87b('0x6a')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a['attrs'][0x1]?_0xeeb79a[_0xb87b('0x5d')][0x1]['value']:undefined)||[]},{'name':_0xb87b('0x66'),'value':_0xeeb79a[_0xb87b('0x66')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a['attrs'][0x2]?_0xeeb79a[_0xb87b('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0xb87b('0x6b'),'value':_0xeeb79a['attrChannel']||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a['attrs'][0x3]?_0xeeb79a[_0xb87b('0x5d')][0x3][_0xb87b('0x5e')]:undefined)||_0xb87b('0x6c')},{'name':_0xb87b('0x6d'),'value':_0xeeb79a[_0xb87b('0x6d')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x4]?_0xeeb79a[_0xb87b('0x5d')][0x4][_0xb87b('0x5e')]:undefined)||''},{'name':_0xb87b('0x6e'),'value':_0xeeb79a['attrFaxAccounts']||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a['attrs'][0x5]?_0xeeb79a[_0xb87b('0x5d')][0x5][_0xb87b('0x5e')]:undefined)||''},{'name':_0xb87b('0x6f'),'value':_0xeeb79a['attrSmsAccounts']||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a['attrs'][0x6]?_0xeeb79a[_0xb87b('0x5d')][0x6][_0xb87b('0x5e')]:undefined)||''},{'name':_0xb87b('0x70'),'value':_0xeeb79a[_0xb87b('0x70')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x7]?_0xeeb79a[_0xb87b('0x5d')][0x7][_0xb87b('0x5e')]:undefined)||''},{'name':_0xb87b('0x71'),'value':_0xeeb79a[_0xb87b('0x71')]||(_0xeeb79a['attrs']&&_0xeeb79a[_0xb87b('0x5d')][0x8]?_0xeeb79a['attrs'][0x8][_0xb87b('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0xeeb79a['attrChatWebsites']||(_0xeeb79a['attrs']&&_0xeeb79a[_0xb87b('0x5d')][0x9]?_0xeeb79a[_0xb87b('0x5d')][0x9]['value']:undefined)||''}];case _0xb87b('0x72'):case _0xb87b('0x73'):return[{'name':_0xb87b('0x74'),'value':_0xeeb79a[_0xb87b('0x74')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x0]?_0xeeb79a[_0xb87b('0x5d')][0x0]['value']:undefined)||'total'},{'name':_0xb87b('0x75'),'value':_0xeeb79a['attrSerie2']||(_0xeeb79a['attrs']&&_0xeeb79a[_0xb87b('0x5d')][0x1]?_0xeeb79a[_0xb87b('0x5d')][0x1][_0xb87b('0x5e')]:undefined)||null},{'name':_0xb87b('0x76'),'value':_0xeeb79a[_0xb87b('0x76')]||(_0xeeb79a['attrs']&&_0xeeb79a[_0xb87b('0x5d')][0x2]?_0xeeb79a[_0xb87b('0x5d')][0x2][_0xb87b('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0xeeb79a['attrVoiceQueues']||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x3]?_0xeeb79a['attrs'][0x3][_0xb87b('0x5e')]:undefined)||[]},{'name':_0xb87b('0x6b'),'value':_0xeeb79a[_0xb87b('0x6b')]||(_0xeeb79a['attrs']&&_0xeeb79a[_0xb87b('0x5d')][0x4]?_0xeeb79a[_0xb87b('0x5d')][0x4][_0xb87b('0x5e')]:undefined)||_0xb87b('0x6c')},{'name':_0xb87b('0x6d'),'value':_0xeeb79a['attrEmailAccounts']||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x5]?_0xeeb79a[_0xb87b('0x5d')][0x5][_0xb87b('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xeeb79a[_0xb87b('0x6e')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x6]?_0xeeb79a[_0xb87b('0x5d')][0x6][_0xb87b('0x5e')]:undefined)||''},{'name':_0xb87b('0x6f'),'value':_0xeeb79a[_0xb87b('0x6f')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x7]?_0xeeb79a[_0xb87b('0x5d')][0x7][_0xb87b('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xeeb79a['attrOpenchannelAccounts']||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x8]?_0xeeb79a['attrs'][0x8][_0xb87b('0x5e')]:undefined)||''},{'name':_0xb87b('0x71'),'value':_0xeeb79a['attrWhatsappAccounts']||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x9]?_0xeeb79a[_0xb87b('0x5d')][0x9][_0xb87b('0x5e')]:undefined)||''},{'name':_0xb87b('0x77'),'value':_0xeeb79a['attrChatWebsites']||(_0xeeb79a['attrs']&&_0xeeb79a['attrs'][0xa]?_0xeeb79a['attrs'][0xa]['value']:undefined)||''}];case _0xb87b('0x78'):return[{'name':_0xb87b('0x79'),'type':_0xeeb79a[_0xb87b('0x7a')]||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x0]?_0xeeb79a[_0xb87b('0x5d')][0x0][_0xb87b('0x30')]:undefined)||null,'value':_0xeeb79a[_0xb87b('0x79')]||(_0xeeb79a['attrs']&&_0xeeb79a[_0xb87b('0x5d')][0x0]?_0xeeb79a[_0xb87b('0x5d')][0x0]['value']:undefined)||null},{'name':_0xb87b('0x7b'),'value':_0xeeb79a['attrRefresh']||(_0xeeb79a[_0xb87b('0x5d')]&&_0xeeb79a[_0xb87b('0x5d')][0x1]?_0xeeb79a['attrs'][0x1][_0xb87b('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x9c5472){logger['error'](_0xb87b('0x7c'),JSON[_0xb87b('0x7d')](_0x9c5472));return[];}}exports[_0xb87b('0x7e')]=function(_0x1717c8,_0x3d0a09,_0x1c7699){if(_0x1717c8[_0xb87b('0x4a')]['id']){delete _0x1717c8[_0xb87b('0x4a')]['id'];}return db[_0xb87b('0x2f')][_0xb87b('0x50')]({'where':{'id':_0x1717c8[_0xb87b('0x56')]['id']}})[_0xb87b('0x29')](handleEntityNotFound(_0x3d0a09,null))[_0xb87b('0x29')](function(_0xfa9745){if(_0xfa9745){_0x1717c8[_0xb87b('0x4a')][_0xb87b('0x7f')]=_0xfa9745['id'];_0x1717c8[_0xb87b('0x4a')][_0xb87b('0x5d')]=widgetAttributes(_0x1717c8[_0xb87b('0x4a')]);return db[_0xb87b('0x80')][_0xb87b('0x49')](_0x1717c8[_0xb87b('0x4a')]);}})[_0xb87b('0x29')](respondWithResult(_0x3d0a09,null))[_0xb87b('0x45')](handleError(_0x3d0a09,null));};exports[_0xb87b('0x81')]=function(_0x2ab02a,_0x2d18fa,_0x164c8e){var _0x4c9030={};var _0x278b78={};var _0x2f2abe;var _0x3189b8;return db['Dashboard'][_0xb87b('0x82')]({'where':{'id':_0x2ab02a['params']['id']}})['then'](handleEntityNotFound(_0x2d18fa,null))['then'](function(_0x2afa8b){if(_0x2afa8b){_0x2f2abe=_0x2afa8b;_0x278b78['model']=_['keys'](db[_0xb87b('0x80')][_0xb87b('0x46')]);_0x278b78['query']=_[_0xb87b('0x34')](_0x2ab02a['query']);_0x278b78[_0xb87b('0x35')]=_[_0xb87b('0x36')](_0x278b78['model'],_0x278b78['query']);_0x4c9030[_0xb87b('0x37')]=_['intersection'](_0x278b78[_0xb87b('0x32')],qs[_0xb87b('0x38')](_0x2ab02a[_0xb87b('0x33')][_0xb87b('0x38')]));_0x4c9030[_0xb87b('0x37')]=_0x4c9030[_0xb87b('0x37')]['length']?_0x4c9030[_0xb87b('0x37')]:_0x278b78[_0xb87b('0x32')];_0x4c9030['order']=qs[_0xb87b('0x3b')](_0x2ab02a['query'][_0xb87b('0x3b')]);_0x4c9030[_0xb87b('0x3e')]=qs['filters'](_['pick'](_0x2ab02a[_0xb87b('0x33')],_0x278b78['filters']));if(_0x2ab02a['query'][_0xb87b('0x3d')]){_0x4c9030[_0xb87b('0x3e')]=_[_0xb87b('0x3f')](_0x4c9030[_0xb87b('0x3e')],{'$or':_[_0xb87b('0x40')](_0x4c9030['attributes'],function(_0x4cdd68){var _0x5ce018={};_0x5ce018[_0x4cdd68]={'$like':'%'+_0x2ab02a[_0xb87b('0x33')]['filter']+'%'};return _0x5ce018;})});}_0x4c9030=_[_0xb87b('0x3f')]({},_0x4c9030,_0x2ab02a[_0xb87b('0x42')]);return _0x2f2abe[_0xb87b('0x81')](_0x4c9030);}})['then'](function(_0x55f000){if(_0x55f000){_0x3189b8=_0x55f000['length'];if(!_0x2ab02a[_0xb87b('0x33')][_0xb87b('0x3a')](_0xb87b('0x83'))){_0x4c9030[_0xb87b('0x21')]=qs[_0xb87b('0x21')](_0x2ab02a[_0xb87b('0x33')]['limit']);_0x4c9030[_0xb87b('0x23')]=qs[_0xb87b('0x23')](_0x2ab02a['query'][_0xb87b('0x23')]);}return _0x2f2abe['getItems'](_0x4c9030);}})['then'](function(_0x3b9b96){if(_0x3b9b96){return _0x3b9b96?{'count':_0x3189b8,'rows':_0x3b9b96}:null;}})[_0xb87b('0x29')](respondWithResult(_0x2d18fa,null))['catch'](handleError(_0x2d18fa,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a0f312f..5e4fcec 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 _0xa5b8=['events','../../mysqldb','setMaxListeners','save','update','emit','hook','exports'];(function(_0x508acd,_0x852c77){var _0x4e8524=function(_0x10ea09){while(--_0x10ea09){_0x508acd['push'](_0x508acd['shift']());}};_0x4e8524(++_0x852c77);}(_0xa5b8,0x148));var _0x8a5b=function(_0x1e02e2,_0xf95d1c){_0x1e02e2=_0x1e02e2-0x0;var _0x2d826a=_0xa5b8[_0x1e02e2];return _0x2d826a;};'use strict';var EventEmitter=require(_0x8a5b('0x0'));var Dashboard=require(_0x8a5b('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8a5b('0x2')](0x0);var events={'afterCreate':_0x8a5b('0x3'),'afterUpdate':_0x8a5b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3847ba){return function(_0x90c80e,_0x429256,_0xb865ca){DashboardEvents[_0x8a5b('0x5')](_0x3847ba+':'+_0x90c80e['id'],_0x90c80e);DashboardEvents['emit'](_0x3847ba,_0x90c80e);_0xb865ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x8a5b('0x6')](e,emitEvent(event));}}module[_0x8a5b('0x7')]=DashboardEvents; \ No newline at end of file +var _0x5655=['../../mysqldb','Dashboard','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x5a3f5d,_0x563619){var _0x3879fd=function(_0xcf8a4){while(--_0xcf8a4){_0x5a3f5d['push'](_0x5a3f5d['shift']());}};_0x3879fd(++_0x563619);}(_0x5655,0x15e));var _0x5565=function(_0x3904a6,_0x12da68){_0x3904a6=_0x3904a6-0x0;var _0x2c65a4=_0x5655[_0x3904a6];return _0x2c65a4;};'use strict';var EventEmitter=require(_0x5565('0x0'));var Dashboard=require(_0x5565('0x1'))['db'][_0x5565('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5565('0x3')](0x0);var events={'afterCreate':_0x5565('0x4'),'afterUpdate':_0x5565('0x5'),'afterDestroy':'remove'};function emitEvent(_0x480b69){return function(_0x307c01,_0x58e4f5,_0x247aa3){DashboardEvents[_0x5565('0x6')](_0x480b69+':'+_0x307c01['id'],_0x307c01);DashboardEvents[_0x5565('0x6')](_0x480b69,_0x307c01);_0x247aa3(null);};}for(var e in events){if(events[_0x5565('0x7')](e)){var event=events[e];Dashboard[_0x5565('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 25d646e..502d52e 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 _0xac0b=['path','rimraf','../../config/environment','define','Dashboard','dashboards','lodash','util','../../config/logger','bluebird'];(function(_0x320bc6,_0xdd35bf){var _0x4b4f35=function(_0x4efb06){while(--_0x4efb06){_0x320bc6['push'](_0x320bc6['shift']());}};_0x4b4f35(++_0xdd35bf);}(_0xac0b,0x164));var _0xbac0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xac0b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xbac0('0x0'));var util=require(_0xbac0('0x1'));var logger=require(_0xbac0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbac0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbac0('0x4'));var rimraf=require(_0xbac0('0x5'));var config=require(_0xbac0('0x6'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x4ada50,_0x3f73f9){return _0x4ada50[_0xbac0('0x7')](_0xbac0('0x8'),attributes,{'tableName':_0xbac0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e0e=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e3011,_0x55fbf0){var _0x1c0d89=function(_0x2ed78e){while(--_0x2ed78e){_0x2e3011['push'](_0x2e3011['shift']());}};_0x1c0d89(++_0x55fbf0);}(_0x5e0e,0x19c));var _0xe5e0=function(_0x4c3ece,_0x57053e){_0x4c3ece=_0x4c3ece-0x0;var _0x409c1d=_0x5e0e[_0x4c3ece];return _0x409c1d;};'use strict';var _=require('lodash');var util=require(_0xe5e0('0x0'));var logger=require(_0xe5e0('0x1'))(_0xe5e0('0x2'));var moment=require(_0xe5e0('0x3'));var BPromise=require(_0xe5e0('0x4'));var rp=require(_0xe5e0('0x5'));var fs=require('fs');var path=require(_0xe5e0('0x6'));var rimraf=require(_0xe5e0('0x7'));var config=require(_0xe5e0('0x8'));var attributes=require(_0xe5e0('0x9'));module[_0xe5e0('0xa')]=function(_0x245c2c,_0x1765a8){return _0x245c2c[_0xe5e0('0xb')](_0xe5e0('0xc'),attributes,{'tableName':_0xe5e0('0xd'),'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 1d4add5..1c855c9 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 _0x6b24=['socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x541bc4,_0x3dcc6d){var _0x393bdc=function(_0x3ef405){while(--_0x3ef405){_0x541bc4['push'](_0x541bc4['shift']());}};_0x393bdc(++_0x3dcc6d);}(_0x6b24,0xf7));var _0x46b2=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0x6b24[_0x5f36cd];return _0x49832a;};'use strict';var _=require(_0x46b2('0x0'));var util=require(_0x46b2('0x1'));var moment=require(_0x46b2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46b2('0x3'));var db=require(_0x46b2('0x4'))['db'];var utils=require(_0x46b2('0x5'));var logger=require(_0x46b2('0x6'))(_0x46b2('0x7'));var config=require('../../config/environment');var jayson=require(_0x46b2('0x8'));var client=jayson[_0x46b2('0x9')][_0x46b2('0xa')]({'port':0x232a});config[_0x46b2('0xb')]=_[_0x46b2('0xc')](config['redis'],{'host':_0x46b2('0xd'),'port':0x18eb});var socket=require(_0x46b2('0xe'))(new Redis(config[_0x46b2('0xb')]));require(_0x46b2('0xf'))[_0x46b2('0x10')](socket);function respondWithRpcPromise(_0x30f0fa,_0x2b153c,_0x4f42e1){return new BPromise(function(_0x501ee3,_0x4b07bd){return client[_0x46b2('0x11')](_0x30f0fa,_0x4f42e1)[_0x46b2('0x12')](function(_0x37bf63){logger[_0x46b2('0x13')](_0x46b2('0x14'),_0x2b153c,_0x46b2('0x15'));logger[_0x46b2('0x16')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x2b153c,_0x46b2('0x15'),JSON[_0x46b2('0x17')](_0x37bf63));if(_0x37bf63['error']){if(_0x37bf63[_0x46b2('0x18')][_0x46b2('0x19')]===0x1f4){logger[_0x46b2('0x18')](_0x46b2('0x14'),_0x2b153c,_0x37bf63[_0x46b2('0x18')][_0x46b2('0x1a')]);return _0x4b07bd(_0x37bf63['error']['message']);}logger['error'](_0x46b2('0x14'),_0x2b153c,_0x37bf63['error'][_0x46b2('0x1a')]);return _0x501ee3(_0x37bf63['error'][_0x46b2('0x1a')]);}else{logger[_0x46b2('0x13')](_0x46b2('0x14'),_0x2b153c,_0x46b2('0x15'));_0x501ee3(_0x37bf63[_0x46b2('0x1b')][_0x46b2('0x1a')]);}})[_0x46b2('0x1c')](function(_0x5cd2d9){logger[_0x46b2('0x18')](_0x46b2('0x14'),_0x2b153c,_0x5cd2d9);_0x4b07bd(_0x5cd2d9);});});} \ No newline at end of file +var _0x90c1=['http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x46e3c7,_0x4fae8c){var _0x5491a6=function(_0x36e784){while(--_0x36e784){_0x46e3c7['push'](_0x46e3c7['shift']());}};_0x5491a6(++_0x4fae8c);}(_0x90c1,0x1d2));var _0x190c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x90c1[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x190c('0x0'));var util=require(_0x190c('0x1'));var moment=require(_0x190c('0x2'));var BPromise=require('bluebird');var rs=require(_0x190c('0x3'));var fs=require('fs');var Redis=require(_0x190c('0x4'));var db=require(_0x190c('0x5'))['db'];var utils=require(_0x190c('0x6'));var logger=require('../../config/logger')(_0x190c('0x7'));var config=require(_0x190c('0x8'));var jayson=require(_0x190c('0x9'));var client=jayson['client'][_0x190c('0xa')]({'port':0x232a});config[_0x190c('0xb')]=_[_0x190c('0xc')](config[_0x190c('0xb')],{'host':_0x190c('0xd'),'port':0x18eb});var socket=require(_0x190c('0xe'))(new Redis(config[_0x190c('0xb')]));require(_0x190c('0xf'))[_0x190c('0x10')](socket);function respondWithRpcPromise(_0xdcbdf6,_0x51d34c,_0x5c5272){return new BPromise(function(_0x2cf34b,_0x4a2dae){return client['request'](_0xdcbdf6,_0x5c5272)[_0x190c('0x11')](function(_0x469af7){logger[_0x190c('0x12')](_0x190c('0x13'),_0x51d34c,_0x190c('0x14'));logger[_0x190c('0x15')](_0x190c('0x16'),_0x51d34c,'request\x20sent',JSON[_0x190c('0x17')](_0x469af7));if(_0x469af7[_0x190c('0x18')]){if(_0x469af7[_0x190c('0x18')][_0x190c('0x19')]===0x1f4){logger[_0x190c('0x18')](_0x190c('0x13'),_0x51d34c,_0x469af7[_0x190c('0x18')]['message']);return _0x4a2dae(_0x469af7[_0x190c('0x18')][_0x190c('0x1a')]);}logger['error'](_0x190c('0x13'),_0x51d34c,_0x469af7[_0x190c('0x18')][_0x190c('0x1a')]);return _0x2cf34b(_0x469af7[_0x190c('0x18')][_0x190c('0x1a')]);}else{logger[_0x190c('0x12')](_0x190c('0x13'),_0x51d34c,_0x190c('0x14'));_0x2cf34b(_0x469af7[_0x190c('0x1b')]['message']);}})['catch'](function(_0x42a740){logger['error'](_0x190c('0x13'),_0x51d34c,_0x42a740);_0x4a2dae(_0x42a740);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 78face6..a44cd06 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 _0xcc44=['dashboard:','save','remove','update','emit','removeListener','register','length'];(function(_0x4b0351,_0x2ab585){var _0x463413=function(_0x29780c){while(--_0x29780c){_0x4b0351['push'](_0x4b0351['shift']());}};_0x463413(++_0x2ab585);}(_0xcc44,0x119));var _0x4cc4=function(_0xc415c7,_0x5239ce){_0xc415c7=_0xc415c7-0x0;var _0x2e3806=_0xcc44[_0xc415c7];return _0x2e3806;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x4cc4('0x0'),_0x4cc4('0x1'),_0x4cc4('0x2')];function createListener(_0x1930b5,_0x475c9d){return function(_0x137a44){_0x475c9d[_0x4cc4('0x3')](_0x1930b5,_0x137a44);};}function removeListener(_0xad1bc6,_0x680018){return function(){DashboardEvents[_0x4cc4('0x4')](_0xad1bc6,_0x680018);};}exports[_0x4cc4('0x5')]=function(_0x3ab040){for(var _0x34c45f=0x0,_0x1f8365=events[_0x4cc4('0x6')];_0x34c45f<_0x1f8365;_0x34c45f++){var _0x3f0789=events[_0x34c45f];var _0x1539e5=createListener(_0x4cc4('0x7')+_0x3f0789,_0x3ab040);DashboardEvents['on'](_0x3f0789,_0x1539e5);}}; \ No newline at end of file +var _0xdb0f=['register','dashboard:','./dashboard.events','remove','update','emit','removeListener'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0xdb0f,0x14b));var _0xfdb0=function(_0xe7bc65,_0x51a349){_0xe7bc65=_0xe7bc65-0x0;var _0x28cff8=_0xdb0f[_0xe7bc65];return _0x28cff8;};'use strict';var DashboardEvents=require(_0xfdb0('0x0'));var events=['save',_0xfdb0('0x1'),_0xfdb0('0x2')];function createListener(_0x459d93,_0x4a22d8){return function(_0x6df87b){_0x4a22d8[_0xfdb0('0x3')](_0x459d93,_0x6df87b);};}function removeListener(_0x55bc8e,_0x1078c5){return function(){DashboardEvents[_0xfdb0('0x4')](_0x55bc8e,_0x1078c5);};}exports[_0xfdb0('0x5')]=function(_0x519c3){for(var _0x2a108b=0x0,_0x46b799=events['length'];_0x2a108b<_0x46b799;_0x2a108b++){var _0x1153cb=events[_0x2a108b];var _0x3fb755=createListener(_0xfdb0('0x6')+_0x1153cb,_0x519c3);DashboardEvents['on'](_0x1153cb,_0x3fb755);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index f3d6f47..9fa4238 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 _0xef12=['getItems','post','/:id/clone','put','delete','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','/:id/items'];(function(_0x129c23,_0x1920de){var _0x4668a6=function(_0x3289a0){while(--_0x3289a0){_0x129c23['push'](_0x129c23['shift']());}};_0x4668a6(++_0x1920de);}(_0xef12,0xa7));var _0x2ef1=function(_0x53a62a,_0x4e4383){_0x53a62a=_0x53a62a-0x0;var _0x4e5293=_0xef12[_0x53a62a];return _0x4e5293;};'use strict';var multer=require('multer');var util=require(_0x2ef1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2ef1('0x1'));var router=express[_0x2ef1('0x2')]();var fs_extra=require(_0x2ef1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2ef1('0x4'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x2ef1('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2ef1('0x5')](_0x2ef1('0x6'),auth[_0x2ef1('0x7')](),controller['show']);router[_0x2ef1('0x5')](_0x2ef1('0x8'),auth[_0x2ef1('0x7')](),controller[_0x2ef1('0x9')]);router[_0x2ef1('0xa')]('/',auth[_0x2ef1('0x7')](),controller['create']);router[_0x2ef1('0xa')](_0x2ef1('0xb'),auth[_0x2ef1('0x7')](),controller['clone']);router[_0x2ef1('0xa')]('/:id/items',auth[_0x2ef1('0x7')](),controller['addItem']);router[_0x2ef1('0xc')](_0x2ef1('0x6'),auth[_0x2ef1('0x7')](),controller['update']);router[_0x2ef1('0xd')](_0x2ef1('0x6'),auth[_0x2ef1('0x7')](),controller[_0x2ef1('0xe')]);module[_0x2ef1('0xf')]=router; \ No newline at end of file +var _0xd7e3=['isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x42e0bc,_0x5a44c0){var _0x470fcd=function(_0x3b1e1b){while(--_0x3b1e1b){_0x42e0bc['push'](_0x42e0bc['shift']());}};_0x470fcd(++_0x5a44c0);}(_0xd7e3,0x12e));var _0x3d7e=function(_0x75372b,_0x4b12c4){_0x75372b=_0x75372b-0x0;var _0x2f56a5=_0xd7e3[_0x75372b];return _0x2f56a5;};'use strict';var multer=require(_0x3d7e('0x0'));var util=require(_0x3d7e('0x1'));var path=require(_0x3d7e('0x2'));var timeout=require(_0x3d7e('0x3'));var express=require(_0x3d7e('0x4'));var router=express[_0x3d7e('0x5')]();var fs_extra=require(_0x3d7e('0x6'));var auth=require(_0x3d7e('0x7'));var interaction=require(_0x3d7e('0x8'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x3d7e('0x9')]('/',auth[_0x3d7e('0xa')](),controller[_0x3d7e('0xb')]);router['get'](_0x3d7e('0xc'),auth[_0x3d7e('0xa')](),controller[_0x3d7e('0xd')]);router['get'](_0x3d7e('0xe'),auth[_0x3d7e('0xa')](),controller[_0x3d7e('0xf')]);router[_0x3d7e('0x10')]('/',auth[_0x3d7e('0xa')](),controller[_0x3d7e('0x11')]);router[_0x3d7e('0x10')](_0x3d7e('0x12'),auth[_0x3d7e('0xa')](),controller[_0x3d7e('0x13')]);router[_0x3d7e('0x10')](_0x3d7e('0xe'),auth[_0x3d7e('0xa')](),controller['addItem']);router[_0x3d7e('0x14')](_0x3d7e('0xc'),auth[_0x3d7e('0xa')](),controller[_0x3d7e('0x15')]);router[_0x3d7e('0x16')](_0x3d7e('0xc'),auth[_0x3d7e('0xa')](),controller[_0x3d7e('0x17')]);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 0a96c0f..1ce3643 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 _0x2bd8=['TEXT','long','parse','attrs','stringify','setDataValue','INTEGER','sequelize','lodash','exports','STRING'];(function(_0x8118e2,_0xa95dd7){var _0x492bb4=function(_0x5d4c45){while(--_0x5d4c45){_0x8118e2['push'](_0x8118e2['shift']());}};_0x492bb4(++_0xa95dd7);}(_0x2bd8,0x130));var _0x82bd=function(_0x16b70c,_0x5e7985){_0x16b70c=_0x16b70c-0x0;var _0x5c1054=_0x2bd8[_0x16b70c];return _0x5c1054;};'use strict';var Sequelize=require(_0x82bd('0x0'));var squel=require('squel');var _=require(_0x82bd('0x1'));module[_0x82bd('0x2')]={'title':{'type':Sequelize[_0x82bd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x82bd('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x82bd('0x4')](_0x82bd('0x5')),'get':function(){try{return JSON[_0x82bd('0x6')](this['getDataValue'](_0x82bd('0x7')));}catch(_0x2e1a98){return[];}},'set':function(_0x3bf810){try{this['setDataValue'](_0x82bd('0x7'),JSON[_0x82bd('0x8')](_0x3bf810));}catch(_0x226f60){this[_0x82bd('0x9')]('attrs',JSON[_0x82bd('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x82bd('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x82bd('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x82bd('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x7c09=['getDataValue','attrs','stringify','setDataValue','INTEGER','#2196f3','squel','lodash','STRING','TEXT','long','parse'];(function(_0x5b73ff,_0x1cba4d){var _0x1c4ba4=function(_0x319db1){while(--_0x319db1){_0x5b73ff['push'](_0x5b73ff['shift']());}};_0x1c4ba4(++_0x1cba4d);}(_0x7c09,0x102));var _0x97c0=function(_0x3859b2,_0x17370e){_0x3859b2=_0x3859b2-0x0;var _0x2978e5=_0x7c09[_0x3859b2];return _0x2978e5;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x97c0('0x0'));var _=require(_0x97c0('0x1'));module['exports']={'title':{'type':Sequelize[_0x97c0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x97c0('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x97c0('0x3')](_0x97c0('0x4')),'get':function(){try{return JSON[_0x97c0('0x5')](this[_0x97c0('0x6')](_0x97c0('0x7')));}catch(_0x4a7788){return[];}},'set':function(_0x4b2f81){try{this['setDataValue'](_0x97c0('0x7'),JSON[_0x97c0('0x8')](_0x4b2f81));}catch(_0x2c19fa){this[_0x97c0('0x9')](_0x97c0('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x97c0('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x97c0('0xa')]},'col':{'type':Sequelize[_0x97c0('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x97c0('0x2')],'allowNull':![],'defaultValue':_0x97c0('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x97c0('0x2')]},'titleFontSize':{'type':Sequelize[_0x97c0('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index db4e74b..6068962 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 _0xacd6=['type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','then','destroy','name','send','params','model','DashboardItem','rawAttributes','query','filters','intersection','attributes','length','include','merge','options','find','catch'];(function(_0xd31e74,_0x387b28){var _0x568864=function(_0x4f7086){while(--_0x4f7086){_0xd31e74['push'](_0xd31e74['shift']());}};_0x568864(++_0x387b28);}(_0xacd6,0xef));var _0x6acd=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0xacd6[_0x29ae80];return _0x5d6d71;};'use strict';var emlformat=require(_0x6acd('0x0'));var rimraf=require(_0x6acd('0x1'));var zipdir=require(_0x6acd('0x2'));var jsonpatch=require(_0x6acd('0x3'));var rp=require(_0x6acd('0x4'));var moment=require(_0x6acd('0x5'));var BPromise=require(_0x6acd('0x6'));var Mustache=require(_0x6acd('0x7'));var util=require(_0x6acd('0x8'));var path=require(_0x6acd('0x9'));var sox=require(_0x6acd('0xa'));var csv=require(_0x6acd('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6acd('0xc'));var _=require(_0x6acd('0xd'));var squel=require(_0x6acd('0xe'));var crypto=require(_0x6acd('0xf'));var jsforce=require(_0x6acd('0x10'));var deskjs=require(_0x6acd('0x11'));var toCsv=require(_0x6acd('0xb'));var querystring=require(_0x6acd('0x12'));var Papa=require('papaparse');var Redis=require(_0x6acd('0x13'));var authService=require(_0x6acd('0x14'));var qs=require(_0x6acd('0x15'));var as=require(_0x6acd('0x16'));var hardwareService=require(_0x6acd('0x17'));var logger=require(_0x6acd('0x18'))(_0x6acd('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6acd('0x1a'));var db=require(_0x6acd('0x1b'))['db'];config[_0x6acd('0x1c')]=_['defaults'](config[_0x6acd('0x1c')],{'host':_0x6acd('0x1d'),'port':0x18eb});var socket=require(_0x6acd('0x1e'))(new Redis(config[_0x6acd('0x1c')]));require(_0x6acd('0x1f'))[_0x6acd('0x20')](socket);function respondWithStatusCode(_0x1387ab,_0x3b656a){_0x3b656a=_0x3b656a||0xcc;return function(_0x49210e){if(_0x49210e){return _0x1387ab[_0x6acd('0x21')](_0x3b656a);}return _0x1387ab[_0x6acd('0x22')](_0x3b656a)[_0x6acd('0x23')]();};}function respondWithResult(_0x34da42,_0x21916d){_0x21916d=_0x21916d||0xc8;return function(_0x5d0a63){if(_0x5d0a63){return _0x34da42['status'](_0x21916d)[_0x6acd('0x24')](_0x5d0a63);}};}function respondWithFilteredResult(_0x13557f,_0x55a0b9){return function(_0xf0c6f5){if(_0xf0c6f5){var _0x581ce1=typeof _0x55a0b9[_0x6acd('0x25')]===_0x6acd('0x26')&&typeof _0x55a0b9[_0x6acd('0x27')]===_0x6acd('0x26');var _0xc01af2=_0xf0c6f5[_0x6acd('0x28')];var _0x2c53b8=_0x581ce1?0x0:_0x55a0b9[_0x6acd('0x25')];var _0x595592=_0x581ce1?_0xf0c6f5[_0x6acd('0x28')]:_0x55a0b9['offset']+_0x55a0b9[_0x6acd('0x27')];var _0x31eaec;if(_0x595592>=_0xc01af2){_0x595592=_0xc01af2;_0x31eaec=0xc8;}else{_0x31eaec=0xce;}_0x13557f[_0x6acd('0x22')](_0x31eaec);return _0x13557f['set']('Content-Range',_0x2c53b8+'-'+_0x595592+'/'+_0xc01af2)[_0x6acd('0x24')](_0xf0c6f5);}return null;};}function patchUpdates(_0x2d3e2d){return function(_0x48dbee){try{jsonpatch[_0x6acd('0x29')](_0x48dbee,_0x2d3e2d,!![]);}catch(_0x5ebc86){return BPromise['reject'](_0x5ebc86);}return _0x48dbee[_0x6acd('0x2a')]();};}function saveUpdates(_0x40dde8,_0x4b0754){return function(_0x3c8bd7){if(_0x3c8bd7){return _0x3c8bd7['update'](_0x40dde8)[_0x6acd('0x2b')](function(_0xa57e4d){return _0xa57e4d;});}return null;};}function removeEntity(_0x25d47b,_0x48ce7b){return function(_0xd16837){if(_0xd16837){return _0xd16837[_0x6acd('0x2c')]()[_0x6acd('0x2b')](function(){_0x25d47b[_0x6acd('0x22')](0xcc)[_0x6acd('0x23')]();});}};}function handleEntityNotFound(_0x29a6d9,_0x400380){return function(_0x4f1b6d){if(!_0x4f1b6d){_0x29a6d9[_0x6acd('0x21')](0x194);}return _0x4f1b6d;};}function handleError(_0x288027,_0x592c1a){_0x592c1a=_0x592c1a||0x1f4;return function(_0x229269){logger['error'](_0x229269['stack']);if(_0x229269['name']){delete _0x229269[_0x6acd('0x2d')];}_0x288027[_0x6acd('0x22')](_0x592c1a)[_0x6acd('0x2e')](_0x229269);};}exports['show']=function(_0x58e3ef,_0x1187c4){var _0x2e2612={'raw':![],'where':{'id':_0x58e3ef[_0x6acd('0x2f')]['id']}},_0x4ce355={};_0x4ce355[_0x6acd('0x30')]=_['keys'](db[_0x6acd('0x31')][_0x6acd('0x32')]);_0x4ce355[_0x6acd('0x33')]=_['keys'](_0x58e3ef[_0x6acd('0x33')]);_0x4ce355[_0x6acd('0x34')]=_[_0x6acd('0x35')](_0x4ce355[_0x6acd('0x30')],_0x4ce355['query']);_0x2e2612['attributes']=_['intersection'](_0x4ce355[_0x6acd('0x30')],qs['fields'](_0x58e3ef[_0x6acd('0x33')]['fields']));_0x2e2612['attributes']=_0x2e2612[_0x6acd('0x36')][_0x6acd('0x37')]?_0x2e2612[_0x6acd('0x36')]:_0x4ce355['model'];if(_0x58e3ef[_0x6acd('0x33')]['includeAll']){_0x2e2612[_0x6acd('0x38')]=[{'all':!![]}];}_0x2e2612=_[_0x6acd('0x39')]({},_0x2e2612,_0x58e3ef[_0x6acd('0x3a')]);return db[_0x6acd('0x31')][_0x6acd('0x3b')](_0x2e2612)[_0x6acd('0x2b')](handleEntityNotFound(_0x1187c4,null))[_0x6acd('0x2b')](respondWithResult(_0x1187c4,null))[_0x6acd('0x3c')](handleError(_0x1187c4,null));};exports[_0x6acd('0x2c')]=function(_0x27be63,_0x2553d2){return db[_0x6acd('0x31')][_0x6acd('0x3b')]({'where':{'id':_0x27be63['params']['id']}})[_0x6acd('0x2b')](handleEntityNotFound(_0x2553d2,null))[_0x6acd('0x2b')](removeEntity(_0x2553d2,null))[_0x6acd('0x3c')](handleError(_0x2553d2,null));};function widgetAttributes(_0x548a0f){try{switch(_0x548a0f[_0x6acd('0x3d')]){case _0x6acd('0x3e'):return[{'name':_0x6acd('0x3f'),'value':_0x548a0f[_0x6acd('0x3f')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x0]?_0x548a0f[_0x6acd('0x40')][0x0]['value']:undefined)||_0x6acd('0x41')}];case _0x6acd('0x42'):return[{'name':_0x6acd('0x43'),'value':_0x548a0f['attrPath']||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x0]?_0x548a0f[_0x6acd('0x40')][0x0][_0x6acd('0x44')]:undefined)||''}];case _0x6acd('0x45'):return[{'name':_0x6acd('0x46'),'value':_0x548a0f[_0x6acd('0x46')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x0]?_0x548a0f[_0x6acd('0x40')][0x0][_0x6acd('0x44')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x548a0f[_0x6acd('0x47')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x1]?_0x548a0f['attrs'][0x1][_0x6acd('0x44')]:undefined)||_0x6acd('0x48')},{'name':_0x6acd('0x49'),'value':_0x548a0f[_0x6acd('0x49')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f['attrs'][0x2]?_0x548a0f['attrs'][0x2][_0x6acd('0x44')]:undefined)||0xc}];case _0x6acd('0x4a'):return[{'name':_0x6acd('0x4b'),'value':_0x548a0f[_0x6acd('0x4b')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f['attrs'][0x0]?_0x548a0f[_0x6acd('0x40')][0x0][_0x6acd('0x44')]:undefined)||_0x6acd('0x4c')},{'name':_0x6acd('0x4d'),'value':_0x548a0f['attrVoiceQueues']||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x1]?_0x548a0f[_0x6acd('0x40')][0x1][_0x6acd('0x44')]:undefined)||[]},{'name':_0x6acd('0x49'),'value':_0x548a0f['attrFontSize']||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f['attrs'][0x2]?_0x548a0f[_0x6acd('0x40')][0x2][_0x6acd('0x44')]:undefined)||0x14},{'name':_0x6acd('0x4e'),'value':_0x548a0f[_0x6acd('0x4e')]||(_0x548a0f['attrs']&&_0x548a0f[_0x6acd('0x40')][0x3]?_0x548a0f[_0x6acd('0x40')][0x3][_0x6acd('0x44')]:undefined)||_0x6acd('0x4f')},{'name':_0x6acd('0x50'),'value':_0x548a0f[_0x6acd('0x50')]||(_0x548a0f['attrs']&&_0x548a0f[_0x6acd('0x40')][0x4]?_0x548a0f[_0x6acd('0x40')][0x4][_0x6acd('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x548a0f[_0x6acd('0x51')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x5]?_0x548a0f[_0x6acd('0x40')][0x5]['value']:undefined)||''},{'name':_0x6acd('0x52'),'value':_0x548a0f['attrSmsAccounts']||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x6]?_0x548a0f[_0x6acd('0x40')][0x6][_0x6acd('0x44')]:undefined)||''},{'name':_0x6acd('0x53'),'value':_0x548a0f[_0x6acd('0x53')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f['attrs'][0x7]?_0x548a0f[_0x6acd('0x40')][0x7][_0x6acd('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x548a0f[_0x6acd('0x54')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x8]?_0x548a0f[_0x6acd('0x40')][0x8]['value']:undefined)||''},{'name':_0x6acd('0x55'),'value':_0x548a0f[_0x6acd('0x55')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x9]?_0x548a0f[_0x6acd('0x40')][0x9][_0x6acd('0x44')]:undefined)||''}];case _0x6acd('0x56'):case _0x6acd('0x57'):return[{'name':_0x6acd('0x58'),'value':_0x548a0f['attrSerie1']||(_0x548a0f['attrs']&&_0x548a0f[_0x6acd('0x40')][0x0]?_0x548a0f['attrs'][0x0]['value']:undefined)||_0x6acd('0x4c')},{'name':_0x6acd('0x59'),'value':_0x548a0f[_0x6acd('0x59')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x1]?_0x548a0f[_0x6acd('0x40')][0x1][_0x6acd('0x44')]:undefined)||null},{'name':_0x6acd('0x5a'),'value':_0x548a0f[_0x6acd('0x5a')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x2]?_0x548a0f['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x548a0f[_0x6acd('0x4d')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x3]?_0x548a0f['attrs'][0x3][_0x6acd('0x44')]:undefined)||[]},{'name':_0x6acd('0x4e'),'value':_0x548a0f[_0x6acd('0x4e')]||(_0x548a0f['attrs']&&_0x548a0f['attrs'][0x4]?_0x548a0f[_0x6acd('0x40')][0x4][_0x6acd('0x44')]:undefined)||'voice'},{'name':_0x6acd('0x50'),'value':_0x548a0f[_0x6acd('0x50')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x5]?_0x548a0f[_0x6acd('0x40')][0x5][_0x6acd('0x44')]:undefined)||''},{'name':_0x6acd('0x51'),'value':_0x548a0f[_0x6acd('0x51')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x6]?_0x548a0f['attrs'][0x6][_0x6acd('0x44')]:undefined)||''},{'name':_0x6acd('0x52'),'value':_0x548a0f[_0x6acd('0x52')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x7]?_0x548a0f['attrs'][0x7][_0x6acd('0x44')]:undefined)||''},{'name':_0x6acd('0x53'),'value':_0x548a0f[_0x6acd('0x53')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f['attrs'][0x8]?_0x548a0f[_0x6acd('0x40')][0x8][_0x6acd('0x44')]:undefined)||''},{'name':_0x6acd('0x54'),'value':_0x548a0f[_0x6acd('0x54')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f['attrs'][0x9]?_0x548a0f[_0x6acd('0x40')][0x9][_0x6acd('0x44')]:undefined)||''},{'name':_0x6acd('0x55'),'value':_0x548a0f[_0x6acd('0x55')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0xa]?_0x548a0f[_0x6acd('0x40')][0xa][_0x6acd('0x44')]:undefined)||''}];case'web-report':return[{'name':_0x6acd('0x5b'),'type':_0x548a0f[_0x6acd('0x5c')]||(_0x548a0f['attrs']&&_0x548a0f[_0x6acd('0x40')][0x0]?_0x548a0f['attrs'][0x0][_0x6acd('0x3d')]:undefined)||null,'value':_0x548a0f[_0x6acd('0x5b')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f['attrs'][0x0]?_0x548a0f[_0x6acd('0x40')][0x0][_0x6acd('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x548a0f[_0x6acd('0x5d')]||(_0x548a0f[_0x6acd('0x40')]&&_0x548a0f[_0x6acd('0x40')][0x1]?_0x548a0f[_0x6acd('0x40')][0x1][_0x6acd('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x4b6962){logger[_0x6acd('0x5e')](_0x6acd('0x5f'),JSON[_0x6acd('0x60')](_0x4b6962));return[];}}exports[_0x6acd('0x61')]=function(_0x1c3dec,_0x30ec81){if(_0x1c3dec['body']){_0x1c3dec[_0x6acd('0x62')][_0x6acd('0x40')]=widgetAttributes(_0x1c3dec[_0x6acd('0x62')]);}return db[_0x6acd('0x31')][_0x6acd('0x61')](_0x1c3dec[_0x6acd('0x62')],{})[_0x6acd('0x2b')](respondWithResult(_0x30ec81,0xc9))[_0x6acd('0x3c')](handleError(_0x30ec81,null));};exports[_0x6acd('0x63')]=function(_0x5c02d6,_0x383764){if(_0x5c02d6[_0x6acd('0x62')]['id']){delete _0x5c02d6[_0x6acd('0x62')]['id'];}_0x5c02d6[_0x6acd('0x62')][_0x6acd('0x40')]=widgetAttributes(_0x5c02d6[_0x6acd('0x62')]);return db[_0x6acd('0x31')]['find']({'where':{'id':_0x5c02d6[_0x6acd('0x2f')]['id']}})[_0x6acd('0x2b')](handleEntityNotFound(_0x383764,null))['then'](saveUpdates(_0x5c02d6[_0x6acd('0x62')],null))[_0x6acd('0x2b')](respondWithResult(_0x383764,null))[_0x6acd('0x3c')](handleError(_0x383764,null));}; \ No newline at end of file +var _0x9303=['attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','create','body','update','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','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','end','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','destroy','type','attrUrl','attrs','custom'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9303,0xd7));var _0x3930=function(_0x3d3531,_0x1e4748){_0x3d3531=_0x3d3531-0x0;var _0x299781=_0x9303[_0x3d3531];return _0x299781;};'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'];config[_0x3930('0x12')]=_['defaults'](config[_0x3930('0x12')],{'host':_0x3930('0x13'),'port':0x18eb});var socket=require(_0x3930('0x14'))(new Redis(config['redis']));require(_0x3930('0x15'))[_0x3930('0x16')](socket);function respondWithStatusCode(_0x4ef6c4,_0x457912){_0x457912=_0x457912||0xcc;return function(_0x44603d){if(_0x44603d){return _0x4ef6c4[_0x3930('0x17')](_0x457912);}return _0x4ef6c4[_0x3930('0x18')](_0x457912)['end']();};}function respondWithResult(_0x55ec9b,_0x3a2ac0){_0x3a2ac0=_0x3a2ac0||0xc8;return function(_0x49468d){if(_0x49468d){return _0x55ec9b[_0x3930('0x18')](_0x3a2ac0)['json'](_0x49468d);}};}function respondWithFilteredResult(_0x4113c4,_0x5bf6f4){return function(_0x5a1c39){if(_0x5a1c39){var _0x4a1405=typeof _0x5bf6f4['offset']===_0x3930('0x19')&&typeof _0x5bf6f4[_0x3930('0x1a')]===_0x3930('0x19');var _0x5b5f55=_0x5a1c39['count'];var _0x4f4e2e=_0x4a1405?0x0:_0x5bf6f4['offset'];var _0x3400f5=_0x4a1405?_0x5a1c39[_0x3930('0x1b')]:_0x5bf6f4[_0x3930('0x1c')]+_0x5bf6f4[_0x3930('0x1a')];var _0x3d2a2f;if(_0x3400f5>=_0x5b5f55){_0x3400f5=_0x5b5f55;_0x3d2a2f=0xc8;}else{_0x3d2a2f=0xce;}_0x4113c4['status'](_0x3d2a2f);return _0x4113c4[_0x3930('0x1d')](_0x3930('0x1e'),_0x4f4e2e+'-'+_0x3400f5+'/'+_0x5b5f55)[_0x3930('0x1f')](_0x5a1c39);}return null;};}function patchUpdates(_0x4a4307){return function(_0x30ccf0){try{jsonpatch[_0x3930('0x20')](_0x30ccf0,_0x4a4307,!![]);}catch(_0x12eeb7){return BPromise[_0x3930('0x21')](_0x12eeb7);}return _0x30ccf0[_0x3930('0x22')]();};}function saveUpdates(_0x186e2e,_0x347d7d){return function(_0x14acf5){if(_0x14acf5){return _0x14acf5['update'](_0x186e2e)[_0x3930('0x23')](function(_0x1dcdcd){return _0x1dcdcd;});}return null;};}function removeEntity(_0x187453,_0x11358e){return function(_0x454138){if(_0x454138){return _0x454138['destroy']()[_0x3930('0x23')](function(){_0x187453[_0x3930('0x18')](0xcc)[_0x3930('0x24')]();});}};}function handleEntityNotFound(_0x5b20a7,_0x2ec9b1){return function(_0x306d5b){if(!_0x306d5b){_0x5b20a7[_0x3930('0x17')](0x194);}return _0x306d5b;};}function handleError(_0x423fe6,_0x582b18){_0x582b18=_0x582b18||0x1f4;return function(_0x575e76){logger[_0x3930('0x25')](_0x575e76[_0x3930('0x26')]);if(_0x575e76[_0x3930('0x27')]){delete _0x575e76['name'];}_0x423fe6[_0x3930('0x18')](_0x582b18)[_0x3930('0x28')](_0x575e76);};}exports[_0x3930('0x29')]=function(_0x3e41de,_0x11290d){var _0x8fdd26={'raw':![],'where':{'id':_0x3e41de[_0x3930('0x2a')]['id']}},_0xcd21b7={};_0xcd21b7[_0x3930('0x2b')]=_[_0x3930('0x2c')](db[_0x3930('0x2d')][_0x3930('0x2e')]);_0xcd21b7[_0x3930('0x2f')]=_[_0x3930('0x2c')](_0x3e41de[_0x3930('0x2f')]);_0xcd21b7[_0x3930('0x30')]=_[_0x3930('0x31')](_0xcd21b7[_0x3930('0x2b')],_0xcd21b7[_0x3930('0x2f')]);_0x8fdd26[_0x3930('0x32')]=_['intersection'](_0xcd21b7['model'],qs['fields'](_0x3e41de[_0x3930('0x2f')][_0x3930('0x33')]));_0x8fdd26['attributes']=_0x8fdd26[_0x3930('0x32')][_0x3930('0x34')]?_0x8fdd26['attributes']:_0xcd21b7[_0x3930('0x2b')];if(_0x3e41de['query'][_0x3930('0x35')]){_0x8fdd26[_0x3930('0x36')]=[{'all':!![]}];}_0x8fdd26=_[_0x3930('0x37')]({},_0x8fdd26,_0x3e41de[_0x3930('0x38')]);return db[_0x3930('0x2d')][_0x3930('0x39')](_0x8fdd26)[_0x3930('0x23')](handleEntityNotFound(_0x11290d,null))[_0x3930('0x23')](respondWithResult(_0x11290d,null))[_0x3930('0x3a')](handleError(_0x11290d,null));};exports[_0x3930('0x3b')]=function(_0x315091,_0x2e9694){return db[_0x3930('0x2d')][_0x3930('0x39')]({'where':{'id':_0x315091[_0x3930('0x2a')]['id']}})[_0x3930('0x23')](handleEntityNotFound(_0x2e9694,null))['then'](removeEntity(_0x2e9694,null))[_0x3930('0x3a')](handleError(_0x2e9694,null));};function widgetAttributes(_0x533d69){try{switch(_0x533d69[_0x3930('0x3c')]){case'iframe':return[{'name':_0x3930('0x3d'),'value':_0x533d69['attrUrl']||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69[_0x3930('0x3e')][0x0]['value']:undefined)||'https://'}];case _0x3930('0x3f'):return[{'name':'attrPath','value':_0x533d69[_0x3930('0x40')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69[_0x3930('0x3e')][0x0][_0x3930('0x41')]:undefined)||''}];case _0x3930('0x42'):return[{'name':_0x3930('0x43'),'value':_0x533d69[_0x3930('0x43')]||(_0x533d69['attrs']&&_0x533d69['attrs'][0x0]?_0x533d69[_0x3930('0x3e')][0x0][_0x3930('0x41')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x533d69[_0x3930('0x44')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x1]?_0x533d69['attrs'][0x1]['value']:undefined)||_0x3930('0x45')},{'name':_0x3930('0x46'),'value':_0x533d69[_0x3930('0x46')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x2]?_0x533d69['attrs'][0x2][_0x3930('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0x3930('0x47'),'value':_0x533d69[_0x3930('0x47')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69['attrs'][0x0][_0x3930('0x41')]:undefined)||_0x3930('0x48')},{'name':_0x3930('0x49'),'value':_0x533d69[_0x3930('0x49')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x1]?_0x533d69[_0x3930('0x3e')][0x1][_0x3930('0x41')]:undefined)||[]},{'name':_0x3930('0x46'),'value':_0x533d69[_0x3930('0x46')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x2]?_0x533d69[_0x3930('0x3e')][0x2][_0x3930('0x41')]:undefined)||0x14},{'name':_0x3930('0x4a'),'value':_0x533d69['attrChannel']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x3]?_0x533d69[_0x3930('0x3e')][0x3][_0x3930('0x41')]:undefined)||_0x3930('0x4b')},{'name':_0x3930('0x4c'),'value':_0x533d69['attrEmailAccounts']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x4]?_0x533d69[_0x3930('0x3e')][0x4][_0x3930('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x533d69[_0x3930('0x4d')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x5]?_0x533d69['attrs'][0x5]['value']:undefined)||''},{'name':_0x3930('0x4e'),'value':_0x533d69[_0x3930('0x4e')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x6]?_0x533d69[_0x3930('0x3e')][0x6][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x4f'),'value':_0x533d69['attrOpenchannelAccounts']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x7]?_0x533d69[_0x3930('0x3e')][0x7][_0x3930('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x533d69[_0x3930('0x50')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x8]?_0x533d69[_0x3930('0x3e')][0x8][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x51'),'value':_0x533d69['attrChatWebsites']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x9]?_0x533d69['attrs'][0x9][_0x3930('0x41')]:undefined)||''}];case'multibar-chart':case _0x3930('0x52'):return[{'name':_0x3930('0x53'),'value':_0x533d69[_0x3930('0x53')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x0]?_0x533d69[_0x3930('0x3e')][0x0][_0x3930('0x41')]:undefined)||_0x3930('0x48')},{'name':_0x3930('0x54'),'value':_0x533d69[_0x3930('0x54')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x1]?_0x533d69[_0x3930('0x3e')][0x1][_0x3930('0x41')]:undefined)||null},{'name':_0x3930('0x55'),'value':_0x533d69['attrSerie3']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x2]?_0x533d69[_0x3930('0x3e')][0x2]['value']:undefined)||null},{'name':_0x3930('0x49'),'value':_0x533d69['attrVoiceQueues']||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x3]?_0x533d69[_0x3930('0x3e')][0x3][_0x3930('0x41')]:undefined)||[]},{'name':_0x3930('0x4a'),'value':_0x533d69[_0x3930('0x4a')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x4]?_0x533d69[_0x3930('0x3e')][0x4][_0x3930('0x41')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x533d69[_0x3930('0x4c')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x5]?_0x533d69['attrs'][0x5][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x4d'),'value':_0x533d69[_0x3930('0x4d')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x6]?_0x533d69[_0x3930('0x3e')][0x6][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x4e'),'value':_0x533d69[_0x3930('0x4e')]||(_0x533d69['attrs']&&_0x533d69['attrs'][0x7]?_0x533d69[_0x3930('0x3e')][0x7][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x4f'),'value':_0x533d69['attrOpenchannelAccounts']||(_0x533d69['attrs']&&_0x533d69['attrs'][0x8]?_0x533d69['attrs'][0x8][_0x3930('0x41')]:undefined)||''},{'name':_0x3930('0x50'),'value':_0x533d69[_0x3930('0x50')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69['attrs'][0x9]?_0x533d69[_0x3930('0x3e')][0x9][_0x3930('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x533d69[_0x3930('0x51')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0xa]?_0x533d69[_0x3930('0x3e')][0xa][_0x3930('0x41')]:undefined)||''}];case _0x3930('0x56'):return[{'name':'attrReport','type':_0x533d69[_0x3930('0x57')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69['attrs'][0x0][_0x3930('0x3c')]:undefined)||null,'value':_0x533d69[_0x3930('0x58')]||(_0x533d69[_0x3930('0x3e')]&&_0x533d69[_0x3930('0x3e')][0x0]?_0x533d69[_0x3930('0x3e')][0x0][_0x3930('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x533d69[_0x3930('0x59')]||(_0x533d69['attrs']&&_0x533d69[_0x3930('0x3e')][0x1]?_0x533d69['attrs'][0x1][_0x3930('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x51637e){logger[_0x3930('0x25')]('widgetAttributes:\x20%s',JSON['stringify'](_0x51637e));return[];}}exports[_0x3930('0x5a')]=function(_0x2b29d3,_0x4159f6){if(_0x2b29d3[_0x3930('0x5b')]){_0x2b29d3[_0x3930('0x5b')][_0x3930('0x3e')]=widgetAttributes(_0x2b29d3[_0x3930('0x5b')]);}return db[_0x3930('0x2d')]['create'](_0x2b29d3[_0x3930('0x5b')],{})['then'](respondWithResult(_0x4159f6,0xc9))[_0x3930('0x3a')](handleError(_0x4159f6,null));};exports[_0x3930('0x5c')]=function(_0x1f5cd9,_0x406b34){if(_0x1f5cd9[_0x3930('0x5b')]['id']){delete _0x1f5cd9[_0x3930('0x5b')]['id'];}_0x1f5cd9['body'][_0x3930('0x3e')]=widgetAttributes(_0x1f5cd9[_0x3930('0x5b')]);return db['DashboardItem'][_0x3930('0x39')]({'where':{'id':_0x1f5cd9[_0x3930('0x2a')]['id']}})[_0x3930('0x23')](handleEntityNotFound(_0x406b34,null))['then'](saveUpdates(_0x1f5cd9['body'],null))[_0x3930('0x23')](respondWithResult(_0x406b34,null))['catch'](handleError(_0x406b34,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 164acd1..e0f6205 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 _0x76be=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0xb1bf56,_0x1b8fde){var _0x26e7d6=function(_0x2d2c4c){while(--_0x2d2c4c){_0xb1bf56['push'](_0xb1bf56['shift']());}};_0x26e7d6(++_0x1b8fde);}(_0x76be,0x8b));var _0xe76b=function(_0x59c234,_0x190b5a){_0x59c234=_0x59c234-0x0;var _0x32956b=_0x76be[_0x59c234];return _0x32956b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xe76b('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe76b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe76b('0x2'),'afterDestroy':_0xe76b('0x3')};function emitEvent(_0x2e5d1b){return function(_0x462ca5,_0x1e0298,_0x51cdeb){DashboardItemEvents[_0xe76b('0x4')](_0x2e5d1b+':'+_0x462ca5['id'],_0x462ca5);DashboardItemEvents[_0xe76b('0x4')](_0x2e5d1b,_0x462ca5);_0x51cdeb(null);};}for(var e in events){if(events[_0xe76b('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xe76b('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x9339=['setMaxListeners','update','emit','hasOwnProperty','events','../../mysqldb','DashboardItem'];(function(_0x406e3f,_0x4544c9){var _0x584be6=function(_0x3243bd){while(--_0x3243bd){_0x406e3f['push'](_0x406e3f['shift']());}};_0x584be6(++_0x4544c9);}(_0x9339,0x1bd));var _0x9933=function(_0x2263d6,_0x23ef72){_0x2263d6=_0x2263d6-0x0;var _0x392795=_0x9339[_0x2263d6];return _0x392795;};'use strict';var EventEmitter=require(_0x9933('0x0'));var DashboardItem=require(_0x9933('0x1'))['db'][_0x9933('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9933('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9933('0x4'),'afterDestroy':'remove'};function emitEvent(_0x28be06){return function(_0x18ba8b,_0x1d9332,_0x2dd7a2){DashboardItemEvents[_0x9933('0x5')](_0x28be06+':'+_0x18ba8b['id'],_0x18ba8b);DashboardItemEvents[_0x9933('0x5')](_0x28be06,_0x18ba8b);_0x2dd7a2(null);};}for(var e in events){if(events[_0x9933('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index aca22d0..abe432c 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 _0x2e2e=['./dashboardItem.attributes','exports','define','dashboard_items','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3c559f,_0x17a3b7){var _0x558431=function(_0x36a749){while(--_0x36a749){_0x3c559f['push'](_0x3c559f['shift']());}};_0x558431(++_0x17a3b7);}(_0x2e2e,0x138));var _0xe2e2=function(_0x538af9,_0x486bf){_0x538af9=_0x538af9-0x0;var _0x9329e8=_0x2e2e[_0x538af9];return _0x9329e8;};'use strict';var _=require(_0xe2e2('0x0'));var util=require(_0xe2e2('0x1'));var logger=require(_0xe2e2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe2e2('0x3'));var rp=require(_0xe2e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2e2('0x5'));var config=require(_0xe2e2('0x6'));var attributes=require(_0xe2e2('0x7'));module[_0xe2e2('0x8')]=function(_0x11271f,_0x4f2a56){return _0x11271f[_0xe2e2('0x9')]('DashboardItem',attributes,{'tableName':_0xe2e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9456=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','DashboardItem','dashboard_items'];(function(_0x975740,_0x1f8cbf){var _0xa13027=function(_0x2fb09b){while(--_0x2fb09b){_0x975740['push'](_0x975740['shift']());}};_0xa13027(++_0x1f8cbf);}(_0x9456,0x1f4));var _0x6945=function(_0x3ebb93,_0x2ea04c){_0x3ebb93=_0x3ebb93-0x0;var _0x1fd207=_0x9456[_0x3ebb93];return _0x1fd207;};'use strict';var _=require(_0x6945('0x0'));var util=require('util');var logger=require(_0x6945('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6945('0x2'));var rp=require(_0x6945('0x3'));var fs=require('fs');var path=require(_0x6945('0x4'));var rimraf=require(_0x6945('0x5'));var config=require(_0x6945('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x6945('0x7')]=function(_0x19ed8f,_0x3fb736){return _0x19ed8f['define'](_0x6945('0x8'),attributes,{'tableName':_0x6945('0x9'),'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 2753681..8c64fef 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 _0x321e=['register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x5766f8,_0x4de87b){var _0x2b7b90=function(_0x2a29c3){while(--_0x2a29c3){_0x5766f8['push'](_0x5766f8['shift']());}};_0x2b7b90(++_0x4de87b);}(_0x321e,0x124));var _0xe321=function(_0x115302,_0x5dc168){_0x115302=_0x115302-0x0;var _0x3e1cca=_0x321e[_0x115302];return _0x3e1cca;};'use strict';var _=require(_0xe321('0x0'));var util=require(_0xe321('0x1'));var moment=require(_0xe321('0x2'));var BPromise=require(_0xe321('0x3'));var rs=require(_0xe321('0x4'));var fs=require('fs');var Redis=require(_0xe321('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe321('0x6'));var logger=require(_0xe321('0x7'))(_0xe321('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe321('0x9')][_0xe321('0xa')]({'port':0x232a});config['redis']=_[_0xe321('0xb')](config[_0xe321('0xc')],{'host':_0xe321('0xd'),'port':0x18eb});var socket=require(_0xe321('0xe'))(new Redis(config[_0xe321('0xc')]));require(_0xe321('0xf'))[_0xe321('0x10')](socket);function respondWithRpcPromise(_0x3087d5,_0x20295b,_0x37733e){return new BPromise(function(_0x4e4504,_0x368ee3){return client[_0xe321('0x11')](_0x3087d5,_0x37733e)[_0xe321('0x12')](function(_0x58a793){logger[_0xe321('0x13')](_0xe321('0x14'),_0x20295b,_0xe321('0x15'));logger[_0xe321('0x16')](_0xe321('0x17'),_0x20295b,_0xe321('0x15'),JSON['stringify'](_0x58a793));if(_0x58a793[_0xe321('0x18')]){if(_0x58a793['error'][_0xe321('0x19')]===0x1f4){logger[_0xe321('0x18')](_0xe321('0x14'),_0x20295b,_0x58a793[_0xe321('0x18')][_0xe321('0x1a')]);return _0x368ee3(_0x58a793['error']['message']);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x20295b,_0x58a793['error'][_0xe321('0x1a')]);return _0x4e4504(_0x58a793['error']['message']);}else{logger['info'](_0xe321('0x14'),_0x20295b,_0xe321('0x15'));_0x4e4504(_0x58a793[_0xe321('0x1b')][_0xe321('0x1a')]);}})['catch'](function(_0xa0e745){logger[_0xe321('0x18')](_0xe321('0x14'),_0x20295b,_0xa0e745);_0x368ee3(_0xa0e745);});});} \ No newline at end of file +var _0xd536=['http','redis','localhost','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x503ec3,_0x5f851e){var _0x4ce7cf=function(_0x5231bb){while(--_0x5231bb){_0x503ec3['push'](_0x503ec3['shift']());}};_0x4ce7cf(++_0x5f851e);}(_0xd536,0x1d8));var _0x6d53=function(_0x4a5918,_0x473323){_0x4a5918=_0x4a5918-0x0;var _0x46e80f=_0xd536[_0x4a5918];return _0x46e80f;};'use strict';var _=require(_0x6d53('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6d53('0x1'));var fs=require('fs');var Redis=require(_0x6d53('0x2'));var db=require(_0x6d53('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6d53('0x4'));var config=require(_0x6d53('0x5'));var jayson=require(_0x6d53('0x6'));var client=jayson[_0x6d53('0x7')][_0x6d53('0x8')]({'port':0x232a});config[_0x6d53('0x9')]=_['defaults'](config[_0x6d53('0x9')],{'host':_0x6d53('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6d53('0xb'))['register'](socket);function respondWithRpcPromise(_0x1c6db5,_0x4c51e0,_0x28b09a){return new BPromise(function(_0x13a849,_0x1d12ca){return client[_0x6d53('0xc')](_0x1c6db5,_0x28b09a)[_0x6d53('0xd')](function(_0x47d0d4){logger[_0x6d53('0xe')](_0x6d53('0xf'),_0x4c51e0,_0x6d53('0x10'));logger[_0x6d53('0x11')](_0x6d53('0x12'),_0x4c51e0,'request\x20sent',JSON[_0x6d53('0x13')](_0x47d0d4));if(_0x47d0d4[_0x6d53('0x14')]){if(_0x47d0d4[_0x6d53('0x14')][_0x6d53('0x15')]===0x1f4){logger[_0x6d53('0x14')](_0x6d53('0xf'),_0x4c51e0,_0x47d0d4[_0x6d53('0x14')][_0x6d53('0x16')]);return _0x1d12ca(_0x47d0d4[_0x6d53('0x14')][_0x6d53('0x16')]);}logger[_0x6d53('0x14')](_0x6d53('0xf'),_0x4c51e0,_0x47d0d4[_0x6d53('0x14')]['message']);return _0x13a849(_0x47d0d4[_0x6d53('0x14')][_0x6d53('0x16')]);}else{logger[_0x6d53('0xe')](_0x6d53('0xf'),_0x4c51e0,_0x6d53('0x10'));_0x13a849(_0x47d0d4[_0x6d53('0x17')][_0x6d53('0x16')]);}})['catch'](function(_0x82579a){logger[_0x6d53('0x14')](_0x6d53('0xf'),_0x4c51e0,_0x82579a);_0x1d12ca(_0x82579a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 48b0f0b..7b5a334 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 _0xc712=['emit','removeListener','register','length','./dashboardItem.events','remove','update'];(function(_0xc43f02,_0x51c747){var _0x282b7e=function(_0x3a635a){while(--_0x3a635a){_0xc43f02['push'](_0xc43f02['shift']());}};_0x282b7e(++_0x51c747);}(_0xc712,0xdd));var _0x2c71=function(_0x121da2,_0x540d77){_0x121da2=_0x121da2-0x0;var _0x41d85c=_0xc712[_0x121da2];return _0x41d85c;};'use strict';var DashboardItemEvents=require(_0x2c71('0x0'));var events=['save',_0x2c71('0x1'),_0x2c71('0x2')];function createListener(_0x440756,_0x3ab6c5){return function(_0x2df478){_0x3ab6c5[_0x2c71('0x3')](_0x440756,_0x2df478);};}function removeListener(_0x1d689a,_0x79c956){return function(){DashboardItemEvents[_0x2c71('0x4')](_0x1d689a,_0x79c956);};}exports[_0x2c71('0x5')]=function(_0x352274){for(var _0x4db72c=0x0,_0x144e29=events[_0x2c71('0x6')];_0x4db72c<_0x144e29;_0x4db72c++){var _0x572fb7=events[_0x4db72c];var _0x21638a=createListener('dashboardItem:'+_0x572fb7,_0x352274);DashboardItemEvents['on'](_0x572fb7,_0x21638a);}}; \ No newline at end of file +var _0xd880=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x253caa,_0x3c5598){var _0x3fd880=function(_0x59b902){while(--_0x59b902){_0x253caa['push'](_0x253caa['shift']());}};_0x3fd880(++_0x3c5598);}(_0xd880,0x18d));var _0x0d88=function(_0x1bdfab,_0x5625ca){_0x1bdfab=_0x1bdfab-0x0;var _0x554412=_0xd880[_0x1bdfab];return _0x554412;};'use strict';var DashboardItemEvents=require(_0x0d88('0x0'));var events=[_0x0d88('0x1'),_0x0d88('0x2'),'update'];function createListener(_0x14a8f5,_0x2e73b3){return function(_0x132d31){_0x2e73b3[_0x0d88('0x3')](_0x14a8f5,_0x132d31);};}function removeListener(_0x263e87,_0x4d1ca7){return function(){DashboardItemEvents[_0x0d88('0x4')](_0x263e87,_0x4d1ca7);};}exports[_0x0d88('0x5')]=function(_0x41be58){for(var _0x5aca47=0x0,_0x10247f=events[_0x0d88('0x6')];_0x5aca47<_0x10247f;_0x5aca47++){var _0x4c5a99=events[_0x5aca47];var _0x2bd6fb=createListener(_0x0d88('0x7')+_0x4c5a99,_0x41be58);DashboardItemEvents['on'](_0x4c5a99,_0x2bd6fb);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 920f74a..8e05bd7 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 _0x6262=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','show','post','create','put','delete','/:id','exports','multer','util'];(function(_0x4d6a00,_0x3f44db){var _0x104da1=function(_0x27bed8){while(--_0x27bed8){_0x4d6a00['push'](_0x4d6a00['shift']());}};_0x104da1(++_0x3f44db);}(_0x6262,0x11f));var _0x2626=function(_0x5b78fe,_0x44542c){_0x5b78fe=_0x5b78fe-0x0;var _0x24ac3c=_0x6262[_0x5b78fe];return _0x24ac3c;};'use strict';var multer=require(_0x2626('0x0'));var util=require(_0x2626('0x1'));var path=require(_0x2626('0x2'));var timeout=require(_0x2626('0x3'));var express=require('express');var router=express[_0x2626('0x4')]();var fs_extra=require(_0x2626('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2626('0x6'));var config=require(_0x2626('0x7'));var controller=require(_0x2626('0x8'));router['get']('/:id',auth[_0x2626('0x9')](),controller[_0x2626('0xa')]);router[_0x2626('0xb')]('/',auth['isAuthenticated'](),controller[_0x2626('0xc')]);router[_0x2626('0xd')]('/:id',auth[_0x2626('0x9')](),controller['update']);router[_0x2626('0xe')](_0x2626('0xf'),auth[_0x2626('0x9')](),controller['destroy']);module[_0x2626('0x10')]=router; \ No newline at end of file +var _0x9d51=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','update','delete','multer','util'];(function(_0x65ff6c,_0x4c2da3){var _0x238215=function(_0x485ddf){while(--_0x485ddf){_0x65ff6c['push'](_0x65ff6c['shift']());}};_0x238215(++_0x4c2da3);}(_0x9d51,0x196));var _0x19d5=function(_0x3bf79e,_0x269e20){_0x3bf79e=_0x3bf79e-0x0;var _0x43af03=_0x9d51[_0x3bf79e];return _0x43af03;};'use strict';var multer=require(_0x19d5('0x0'));var util=require(_0x19d5('0x1'));var path=require(_0x19d5('0x2'));var timeout=require(_0x19d5('0x3'));var express=require('express');var router=express[_0x19d5('0x4')]();var fs_extra=require(_0x19d5('0x5'));var auth=require(_0x19d5('0x6'));var interaction=require(_0x19d5('0x7'));var config=require(_0x19d5('0x8'));var controller=require(_0x19d5('0x9'));router['get'](_0x19d5('0xa'),auth[_0x19d5('0xb')](),controller[_0x19d5('0xc')]);router[_0x19d5('0xd')]('/',auth['isAuthenticated'](),controller[_0x19d5('0xe')]);router['put'](_0x19d5('0xa'),auth[_0x19d5('0xb')](),controller[_0x19d5('0xf')]);router[_0x19d5('0x10')](_0x19d5('0xa'),auth[_0x19d5('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 63d2862..8488786 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 _0xea9e=['exports','STRING','first','third','sequelize'];(function(_0x490cd3,_0x97d5ee){var _0x3320d7=function(_0x2ad809){while(--_0x2ad809){_0x490cd3['push'](_0x490cd3['shift']());}};_0x3320d7(++_0x97d5ee);}(_0xea9e,0x199));var _0xeea9=function(_0x704edc,_0x3d3faf){_0x704edc=_0x704edc-0x0;var _0x4677f1=_0xea9e[_0x704edc];return _0x4677f1;};'use strict';var Sequelize=require(_0xeea9('0x0'));module[_0xeea9('0x1')]={'name':{'type':Sequelize[_0xeea9('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xeea9('0x3'),'second',_0xeea9('0x4')),'allowNull':![],'defaultValue':_0xeea9('0x3')},'description':{'type':Sequelize[_0xeea9('0x2')]}}; \ No newline at end of file +var _0xd6a2=['second','third','exports','STRING','first'];(function(_0x437a28,_0x5a7916){var _0x56f3be=function(_0x1407ba){while(--_0x1407ba){_0x437a28['push'](_0x437a28['shift']());}};_0x56f3be(++_0x5a7916);}(_0xd6a2,0xf2));var _0x2d6a=function(_0x846a63,_0x4375e9){_0x846a63=_0x846a63-0x0;var _0x16d152=_0xd6a2[_0x846a63];return _0x16d152;};'use strict';var Sequelize=require('sequelize');module[_0x2d6a('0x0')]={'name':{'type':Sequelize[_0x2d6a('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x2d6a('0x2'),_0x2d6a('0x3'),_0x2d6a('0x4')),'allowNull':![],'defaultValue':_0x2d6a('0x2')},'description':{'type':Sequelize[_0x2d6a('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 0fb34fb..4a6a352 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 _0x1d19=['UserProfileSection','userProfileId','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','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x135caa,_0x47cd31){var _0x72b373=function(_0x5b7821){while(--_0x5b7821){_0x135caa['push'](_0x135caa['shift']());}};_0x72b373(++_0x47cd31);}(_0x1d19,0xb1));var _0x91d1=function(_0x11f96c,_0x14a1cb){_0x11f96c=_0x11f96c-0x0;var _0x33ca18=_0x1d19[_0x11f96c];return _0x33ca18;};'use strict';var emlformat=require(_0x91d1('0x0'));var rimraf=require(_0x91d1('0x1'));var zipdir=require(_0x91d1('0x2'));var jsonpatch=require(_0x91d1('0x3'));var rp=require(_0x91d1('0x4'));var moment=require(_0x91d1('0x5'));var BPromise=require(_0x91d1('0x6'));var Mustache=require(_0x91d1('0x7'));var util=require(_0x91d1('0x8'));var path=require(_0x91d1('0x9'));var sox=require(_0x91d1('0xa'));var csv=require(_0x91d1('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91d1('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x91d1('0xd'));var deskjs=require(_0x91d1('0xe'));var toCsv=require(_0x91d1('0xb'));var querystring=require(_0x91d1('0xf'));var Papa=require(_0x91d1('0x10'));var Redis=require(_0x91d1('0x11'));var authService=require(_0x91d1('0x12'));var qs=require(_0x91d1('0x13'));var as=require(_0x91d1('0x14'));var hardwareService=require(_0x91d1('0x15'));var logger=require(_0x91d1('0x16'))(_0x91d1('0x17'));var utils=require('../../config/utils');var config=require(_0x91d1('0x18'));var licenseUtil=require(_0x91d1('0x19'));var db=require(_0x91d1('0x1a'))['db'];function respondWithStatusCode(_0x2ef7cc,_0x99ecf){_0x99ecf=_0x99ecf||0xcc;return function(_0x5c24b6){if(_0x5c24b6){return _0x2ef7cc['sendStatus'](_0x99ecf);}return _0x2ef7cc[_0x91d1('0x1b')](_0x99ecf)[_0x91d1('0x1c')]();};}function respondWithResult(_0x25385d,_0x4662dc){_0x4662dc=_0x4662dc||0xc8;return function(_0x108d9c){if(_0x108d9c){return _0x25385d[_0x91d1('0x1b')](_0x4662dc)[_0x91d1('0x1d')](_0x108d9c);}};}function respondWithFilteredResult(_0x347299,_0x3dab43){return function(_0x225192){if(_0x225192){var _0x2e2f62=typeof _0x3dab43['offset']==='undefined'&&typeof _0x3dab43[_0x91d1('0x1e')]===_0x91d1('0x1f');var _0x25f062=_0x225192[_0x91d1('0x20')];var _0x1593cd=_0x2e2f62?0x0:_0x3dab43[_0x91d1('0x21')];var _0x34f691=_0x2e2f62?_0x225192[_0x91d1('0x20')]:_0x3dab43['offset']+_0x3dab43['limit'];var _0x5961ce;if(_0x34f691>=_0x25f062){_0x34f691=_0x25f062;_0x5961ce=0xc8;}else{_0x5961ce=0xce;}_0x347299[_0x91d1('0x1b')](_0x5961ce);return _0x347299[_0x91d1('0x22')](_0x91d1('0x23'),_0x1593cd+'-'+_0x34f691+'/'+_0x25f062)[_0x91d1('0x1d')](_0x225192);}return null;};}function patchUpdates(_0x1a61d5){return function(_0x2798b1){try{jsonpatch[_0x91d1('0x24')](_0x2798b1,_0x1a61d5,!![]);}catch(_0x520caf){return BPromise[_0x91d1('0x25')](_0x520caf);}return _0x2798b1[_0x91d1('0x26')]();};}function saveUpdates(_0x200633,_0x3346d8){return function(_0x2dfda2){if(_0x2dfda2){return _0x2dfda2[_0x91d1('0x27')](_0x200633)[_0x91d1('0x28')](function(_0x5e07cb){return _0x5e07cb;});}return null;};}function removeEntity(_0x444341,_0x574b3d){return function(_0x58ba1b){if(_0x58ba1b){return _0x58ba1b[_0x91d1('0x29')]()[_0x91d1('0x28')](function(){var _0x178c0a=_0x58ba1b[_0x91d1('0x2a')]({'plain':!![]});var _0x4b63d1=_0x91d1('0x2b');return db[_0x91d1('0x2c')][_0x91d1('0x29')]({'where':{'type':_0x4b63d1,'resourceId':_0x178c0a['id']}})[_0x91d1('0x28')](function(){return _0x58ba1b;});})[_0x91d1('0x28')](function(){_0x444341[_0x91d1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7ddb,_0x30fe01){return function(_0x39d18c){if(!_0x39d18c){_0x1c7ddb[_0x91d1('0x2d')](0x194);}return _0x39d18c;};}function handleError(_0x2bb320,_0x1c8f0e){_0x1c8f0e=_0x1c8f0e||0x1f4;return function(_0xc150d5){logger['error'](_0xc150d5[_0x91d1('0x2e')]);if(_0xc150d5['name']){delete _0xc150d5[_0x91d1('0x2f')];}_0x2bb320['status'](_0x1c8f0e)[_0x91d1('0x30')](_0xc150d5);};}exports[_0x91d1('0x31')]=function(_0x343934,_0x3ccc81){var _0x463973={},_0x27f5dd={},_0x533439={'count':0x0,'rows':[]};var _0x170e53=_['map'](db[_0x91d1('0x32')][_0x91d1('0x33')],function(_0x2162ed){return{'name':_0x2162ed[_0x91d1('0x34')],'type':_0x2162ed[_0x91d1('0x35')][_0x91d1('0x36')]};});_0x27f5dd[_0x91d1('0x37')]=_['map'](_0x170e53,_0x91d1('0x2f'));_0x27f5dd[_0x91d1('0x38')]=_[_0x91d1('0x39')](_0x343934[_0x91d1('0x38')]);_0x27f5dd[_0x91d1('0x3a')]=_[_0x91d1('0x3b')](_0x27f5dd[_0x91d1('0x37')],_0x27f5dd['query']);_0x463973[_0x91d1('0x3c')]=_[_0x91d1('0x3b')](_0x27f5dd[_0x91d1('0x37')],qs[_0x91d1('0x3d')](_0x343934[_0x91d1('0x38')][_0x91d1('0x3d')]));_0x463973[_0x91d1('0x3c')]=_0x463973['attributes']['length']?_0x463973['attributes']:_0x27f5dd[_0x91d1('0x37')];if(!_0x343934['query'][_0x91d1('0x3e')](_0x91d1('0x3f'))){_0x463973['limit']=qs[_0x91d1('0x1e')](_0x343934[_0x91d1('0x38')][_0x91d1('0x1e')]);_0x463973[_0x91d1('0x21')]=qs[_0x91d1('0x21')](_0x343934['query'][_0x91d1('0x21')]);}_0x463973['order']=qs['sort'](_0x343934['query'][_0x91d1('0x40')]);_0x463973[_0x91d1('0x41')]=qs[_0x91d1('0x3a')](_[_0x91d1('0x42')](_0x343934[_0x91d1('0x38')],_0x27f5dd[_0x91d1('0x3a')]),_0x170e53);if(_0x343934[_0x91d1('0x38')]['filter']){_0x463973[_0x91d1('0x41')]=_[_0x91d1('0x43')](_0x463973[_0x91d1('0x41')],{'$or':_[_0x91d1('0x44')](_0x170e53,function(_0x4808f8){if(_0x4808f8[_0x91d1('0x35')]!==_0x91d1('0x45')){var _0x338cf3={};_0x338cf3[_0x4808f8[_0x91d1('0x2f')]]={'$like':'%'+_0x343934[_0x91d1('0x38')][_0x91d1('0x46')]+'%'};return _0x338cf3;}})});}_0x463973=_[_0x91d1('0x43')]({},_0x463973,_0x343934['options']);var _0x301bd0={'where':_0x463973[_0x91d1('0x41')]};return db[_0x91d1('0x32')]['count'](_0x301bd0)[_0x91d1('0x28')](function(_0x54e8b1){_0x533439[_0x91d1('0x20')]=_0x54e8b1;if(_0x343934[_0x91d1('0x38')][_0x91d1('0x47')]){_0x463973[_0x91d1('0x48')]=[{'all':!![]}];}return db[_0x91d1('0x32')]['findAll'](_0x463973);})[_0x91d1('0x28')](function(_0x5cf984){_0x533439[_0x91d1('0x49')]=_0x5cf984;return _0x533439;})[_0x91d1('0x28')](respondWithFilteredResult(_0x3ccc81,_0x463973))[_0x91d1('0x4a')](handleError(_0x3ccc81,null));};exports[_0x91d1('0x4b')]=function(_0x37a988,_0x39b76c){var _0x7e52b8={'raw':!![],'where':{'id':_0x37a988[_0x91d1('0x4c')]['id']}},_0x2e1bb4={};_0x2e1bb4['model']=_[_0x91d1('0x39')](db[_0x91d1('0x32')][_0x91d1('0x33')]);_0x2e1bb4[_0x91d1('0x38')]=_[_0x91d1('0x39')](_0x37a988[_0x91d1('0x38')]);_0x2e1bb4[_0x91d1('0x3a')]=_[_0x91d1('0x3b')](_0x2e1bb4['model'],_0x2e1bb4[_0x91d1('0x38')]);_0x7e52b8[_0x91d1('0x3c')]=_[_0x91d1('0x3b')](_0x2e1bb4[_0x91d1('0x37')],qs[_0x91d1('0x3d')](_0x37a988[_0x91d1('0x38')][_0x91d1('0x3d')]));_0x7e52b8[_0x91d1('0x3c')]=_0x7e52b8['attributes']['length']?_0x7e52b8[_0x91d1('0x3c')]:_0x2e1bb4[_0x91d1('0x37')];if(_0x37a988[_0x91d1('0x38')][_0x91d1('0x47')]){_0x7e52b8[_0x91d1('0x48')]=[{'all':!![]}];}_0x7e52b8=_[_0x91d1('0x43')]({},_0x7e52b8,_0x37a988[_0x91d1('0x4d')]);return db[_0x91d1('0x32')][_0x91d1('0x4e')](_0x7e52b8)[_0x91d1('0x28')](handleEntityNotFound(_0x39b76c,null))[_0x91d1('0x28')](respondWithResult(_0x39b76c,null))[_0x91d1('0x4a')](handleError(_0x39b76c,null));};exports[_0x91d1('0x4f')]=function(_0x4bf710,_0x4ce4ef){return db[_0x91d1('0x32')]['create'](_0x4bf710[_0x91d1('0x50')],{})[_0x91d1('0x28')](function(_0x321f59){var _0xf533bc=_0x4bf710[_0x91d1('0x51')]['get']({'plain':!![]});if(!_0xf533bc)throw new Error(_0x91d1('0x52'));if(_0xf533bc[_0x91d1('0x53')]==='user'){var _0xace475=_0x321f59[_0x91d1('0x2a')]({'plain':!![]});var _0x5cbe86=_0x91d1('0x2b');return db[_0x91d1('0x54')][_0x91d1('0x4e')]({'where':{'name':_0x5cbe86,'userProfileId':_0xf533bc[_0x91d1('0x55')]},'raw':!![]})['then'](function(_0x3f2b2e){if(_0x3f2b2e&&_0x3f2b2e['autoAssociation']===0x0){return db[_0x91d1('0x2c')]['create']({'name':_0xace475['name'],'resourceId':_0xace475['id'],'type':_0x3f2b2e['name'],'sectionId':_0x3f2b2e['id']},{})[_0x91d1('0x28')](function(){return _0x321f59;});}else{return _0x321f59;}})[_0x91d1('0x4a')](function(_0x579204){logger['error'](_0x91d1('0x56'),_0x579204);throw _0x579204;});}return _0x321f59;})[_0x91d1('0x28')](respondWithResult(_0x4ce4ef,0xc9))[_0x91d1('0x4a')](handleError(_0x4ce4ef,null));};exports[_0x91d1('0x27')]=function(_0x5a759d,_0x3cacea){if(_0x5a759d['body']['id']){delete _0x5a759d[_0x91d1('0x50')]['id'];}return db[_0x91d1('0x32')][_0x91d1('0x4e')]({'where':{'id':_0x5a759d[_0x91d1('0x4c')]['id']}})[_0x91d1('0x28')](handleEntityNotFound(_0x3cacea,null))[_0x91d1('0x28')](saveUpdates(_0x5a759d[_0x91d1('0x50')],null))[_0x91d1('0x28')](respondWithResult(_0x3cacea,null))['catch'](handleError(_0x3cacea,null));};exports[_0x91d1('0x29')]=function(_0x482196,_0x22b058){return db[_0x91d1('0x32')][_0x91d1('0x4e')]({'where':{'id':_0x482196[_0x91d1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x22b058,null))[_0x91d1('0x28')](removeEntity(_0x22b058,null))[_0x91d1('0x4a')](handleError(_0x22b058,null));}; \ No newline at end of file +var _0x2dcc=['UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Dispositions'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0x2dcc,0x88));var _0xc2dc=function(_0x3500a8,_0x1081f3){_0x3500a8=_0x3500a8-0x0;var _0xa198f5=_0x2dcc[_0x3500a8];return _0xa198f5;};'use strict';var emlformat=require(_0xc2dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc2dc('0x1'));var jsonpatch=require(_0xc2dc('0x2'));var rp=require(_0xc2dc('0x3'));var moment=require(_0xc2dc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc2dc('0x5'));var path=require(_0xc2dc('0x6'));var sox=require('sox');var csv=require(_0xc2dc('0x7'));var ejs=require(_0xc2dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc2dc('0x9'));var _=require('lodash');var squel=require(_0xc2dc('0xa'));var crypto=require(_0xc2dc('0xb'));var jsforce=require(_0xc2dc('0xc'));var deskjs=require(_0xc2dc('0xd'));var toCsv=require(_0xc2dc('0x7'));var querystring=require(_0xc2dc('0xe'));var Papa=require(_0xc2dc('0xf'));var Redis=require('ioredis');var authService=require(_0xc2dc('0x10'));var qs=require(_0xc2dc('0x11'));var as=require(_0xc2dc('0x12'));var hardwareService=require(_0xc2dc('0x13'));var logger=require(_0xc2dc('0x14'))(_0xc2dc('0x15'));var utils=require(_0xc2dc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc2dc('0x17'));var db=require(_0xc2dc('0x18'))['db'];function respondWithStatusCode(_0x192ae1,_0x53b2d8){_0x53b2d8=_0x53b2d8||0xcc;return function(_0x1dce2d){if(_0x1dce2d){return _0x192ae1[_0xc2dc('0x19')](_0x53b2d8);}return _0x192ae1[_0xc2dc('0x1a')](_0x53b2d8)[_0xc2dc('0x1b')]();};}function respondWithResult(_0x223b35,_0x251877){_0x251877=_0x251877||0xc8;return function(_0x2f116a){if(_0x2f116a){return _0x223b35[_0xc2dc('0x1a')](_0x251877)['json'](_0x2f116a);}};}function respondWithFilteredResult(_0x1a14e4,_0x27582e){return function(_0x2838ba){if(_0x2838ba){var _0x389c5f=typeof _0x27582e['offset']===_0xc2dc('0x1c')&&typeof _0x27582e['limit']===_0xc2dc('0x1c');var _0x3f1d63=_0x2838ba[_0xc2dc('0x1d')];var _0x1d06fd=_0x389c5f?0x0:_0x27582e['offset'];var _0x35cec9=_0x389c5f?_0x2838ba[_0xc2dc('0x1d')]:_0x27582e[_0xc2dc('0x1e')]+_0x27582e[_0xc2dc('0x1f')];var _0x135c93;if(_0x35cec9>=_0x3f1d63){_0x35cec9=_0x3f1d63;_0x135c93=0xc8;}else{_0x135c93=0xce;}_0x1a14e4[_0xc2dc('0x1a')](_0x135c93);return _0x1a14e4[_0xc2dc('0x20')](_0xc2dc('0x21'),_0x1d06fd+'-'+_0x35cec9+'/'+_0x3f1d63)['json'](_0x2838ba);}return null;};}function patchUpdates(_0x479627){return function(_0x26aa89){try{jsonpatch[_0xc2dc('0x22')](_0x26aa89,_0x479627,!![]);}catch(_0x568796){return BPromise[_0xc2dc('0x23')](_0x568796);}return _0x26aa89['save']();};}function saveUpdates(_0x2e17f4,_0x2ea853){return function(_0x270f09){if(_0x270f09){return _0x270f09[_0xc2dc('0x24')](_0x2e17f4)[_0xc2dc('0x25')](function(_0x4c7221){return _0x4c7221;});}return null;};}function removeEntity(_0x1249ca,_0x4d1237){return function(_0x377ba8){if(_0x377ba8){return _0x377ba8[_0xc2dc('0x26')]()['then'](function(){var _0x47b5b3=_0x377ba8['get']({'plain':!![]});var _0x2bffa1=_0xc2dc('0x27');return db[_0xc2dc('0x28')]['destroy']({'where':{'type':_0x2bffa1,'resourceId':_0x47b5b3['id']}})[_0xc2dc('0x25')](function(){return _0x377ba8;});})[_0xc2dc('0x25')](function(){_0x1249ca[_0xc2dc('0x1a')](0xcc)[_0xc2dc('0x1b')]();});}};}function handleEntityNotFound(_0x1ff346,_0x41af14){return function(_0x19f643){if(!_0x19f643){_0x1ff346[_0xc2dc('0x19')](0x194);}return _0x19f643;};}function handleError(_0x52f8d4,_0x3d5d95){_0x3d5d95=_0x3d5d95||0x1f4;return function(_0x52c12b){logger[_0xc2dc('0x29')](_0x52c12b[_0xc2dc('0x2a')]);if(_0x52c12b['name']){delete _0x52c12b[_0xc2dc('0x2b')];}_0x52f8d4[_0xc2dc('0x1a')](_0x3d5d95)[_0xc2dc('0x2c')](_0x52c12b);};}exports[_0xc2dc('0x2d')]=function(_0x518cab,_0x19999e){var _0x273801={},_0x385c93={},_0x5e48db={'count':0x0,'rows':[]};var _0x1cc08a=_[_0xc2dc('0x2e')](db[_0xc2dc('0x2f')][_0xc2dc('0x30')],function(_0x17c1f5){return{'name':_0x17c1f5[_0xc2dc('0x31')],'type':_0x17c1f5[_0xc2dc('0x32')][_0xc2dc('0x33')]};});_0x385c93[_0xc2dc('0x34')]=_[_0xc2dc('0x2e')](_0x1cc08a,_0xc2dc('0x2b'));_0x385c93[_0xc2dc('0x35')]=_[_0xc2dc('0x36')](_0x518cab[_0xc2dc('0x35')]);_0x385c93[_0xc2dc('0x37')]=_[_0xc2dc('0x38')](_0x385c93[_0xc2dc('0x34')],_0x385c93[_0xc2dc('0x35')]);_0x273801[_0xc2dc('0x39')]=_[_0xc2dc('0x38')](_0x385c93[_0xc2dc('0x34')],qs[_0xc2dc('0x3a')](_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x3a')]));_0x273801[_0xc2dc('0x39')]=_0x273801[_0xc2dc('0x39')][_0xc2dc('0x3b')]?_0x273801['attributes']:_0x385c93[_0xc2dc('0x34')];if(!_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x3c')](_0xc2dc('0x3d'))){_0x273801['limit']=qs[_0xc2dc('0x1f')](_0x518cab['query'][_0xc2dc('0x1f')]);_0x273801[_0xc2dc('0x1e')]=qs[_0xc2dc('0x1e')](_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x1e')]);}_0x273801[_0xc2dc('0x3e')]=qs[_0xc2dc('0x3f')](_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x3f')]);_0x273801['where']=qs[_0xc2dc('0x37')](_[_0xc2dc('0x40')](_0x518cab['query'],_0x385c93[_0xc2dc('0x37')]),_0x1cc08a);if(_0x518cab[_0xc2dc('0x35')][_0xc2dc('0x41')]){_0x273801[_0xc2dc('0x42')]=_['merge'](_0x273801[_0xc2dc('0x42')],{'$or':_[_0xc2dc('0x2e')](_0x1cc08a,function(_0x59057c){if(_0x59057c[_0xc2dc('0x32')]!==_0xc2dc('0x43')){var _0xa16af3={};_0xa16af3[_0x59057c[_0xc2dc('0x2b')]]={'$like':'%'+_0x518cab[_0xc2dc('0x35')]['filter']+'%'};return _0xa16af3;}})});}_0x273801=_[_0xc2dc('0x44')]({},_0x273801,_0x518cab[_0xc2dc('0x45')]);var _0x51d9fd={'where':_0x273801[_0xc2dc('0x42')]};return db[_0xc2dc('0x2f')][_0xc2dc('0x1d')](_0x51d9fd)[_0xc2dc('0x25')](function(_0x5f2ea3){_0x5e48db[_0xc2dc('0x1d')]=_0x5f2ea3;if(_0x518cab['query'][_0xc2dc('0x46')]){_0x273801[_0xc2dc('0x47')]=[{'all':!![]}];}return db['Disposition'][_0xc2dc('0x48')](_0x273801);})[_0xc2dc('0x25')](function(_0x531714){_0x5e48db[_0xc2dc('0x49')]=_0x531714;return _0x5e48db;})[_0xc2dc('0x25')](respondWithFilteredResult(_0x19999e,_0x273801))[_0xc2dc('0x4a')](handleError(_0x19999e,null));};exports[_0xc2dc('0x4b')]=function(_0x290453,_0x3bcf81){var _0x725b45={'raw':!![],'where':{'id':_0x290453[_0xc2dc('0x4c')]['id']}},_0x140cb9={};_0x140cb9[_0xc2dc('0x34')]=_[_0xc2dc('0x36')](db[_0xc2dc('0x2f')][_0xc2dc('0x30')]);_0x140cb9[_0xc2dc('0x35')]=_['keys'](_0x290453[_0xc2dc('0x35')]);_0x140cb9[_0xc2dc('0x37')]=_[_0xc2dc('0x38')](_0x140cb9[_0xc2dc('0x34')],_0x140cb9[_0xc2dc('0x35')]);_0x725b45[_0xc2dc('0x39')]=_[_0xc2dc('0x38')](_0x140cb9[_0xc2dc('0x34')],qs[_0xc2dc('0x3a')](_0x290453[_0xc2dc('0x35')][_0xc2dc('0x3a')]));_0x725b45[_0xc2dc('0x39')]=_0x725b45[_0xc2dc('0x39')][_0xc2dc('0x3b')]?_0x725b45[_0xc2dc('0x39')]:_0x140cb9[_0xc2dc('0x34')];if(_0x290453[_0xc2dc('0x35')][_0xc2dc('0x46')]){_0x725b45[_0xc2dc('0x47')]=[{'all':!![]}];}_0x725b45=_[_0xc2dc('0x44')]({},_0x725b45,_0x290453['options']);return db[_0xc2dc('0x2f')][_0xc2dc('0x4d')](_0x725b45)[_0xc2dc('0x25')](handleEntityNotFound(_0x3bcf81,null))[_0xc2dc('0x25')](respondWithResult(_0x3bcf81,null))[_0xc2dc('0x4a')](handleError(_0x3bcf81,null));};exports[_0xc2dc('0x4e')]=function(_0x4b9043,_0x1bf9f8){return db[_0xc2dc('0x2f')][_0xc2dc('0x4e')](_0x4b9043[_0xc2dc('0x4f')],{})[_0xc2dc('0x25')](function(_0x4b33df){var _0x29d866=_0x4b9043[_0xc2dc('0x50')][_0xc2dc('0x51')]({'plain':!![]});if(!_0x29d866)throw new Error(_0xc2dc('0x52'));if(_0x29d866[_0xc2dc('0x53')]===_0xc2dc('0x50')){var _0x5d760a=_0x4b33df['get']({'plain':!![]});var _0x117624=_0xc2dc('0x27');return db[_0xc2dc('0x54')][_0xc2dc('0x4d')]({'where':{'name':_0x117624,'userProfileId':_0x29d866[_0xc2dc('0x55')]},'raw':!![]})['then'](function(_0x4bf1b8){if(_0x4bf1b8&&_0x4bf1b8[_0xc2dc('0x56')]===0x0){return db[_0xc2dc('0x28')]['create']({'name':_0x5d760a['name'],'resourceId':_0x5d760a['id'],'type':_0x4bf1b8[_0xc2dc('0x2b')],'sectionId':_0x4bf1b8['id']},{})['then'](function(){return _0x4b33df;});}else{return _0x4b33df;}})['catch'](function(_0xa4bb62){logger[_0xc2dc('0x29')](_0xc2dc('0x57'),_0xa4bb62);throw _0xa4bb62;});}return _0x4b33df;})[_0xc2dc('0x25')](respondWithResult(_0x1bf9f8,0xc9))['catch'](handleError(_0x1bf9f8,null));};exports[_0xc2dc('0x24')]=function(_0x57923a,_0x366833){if(_0x57923a[_0xc2dc('0x4f')]['id']){delete _0x57923a[_0xc2dc('0x4f')]['id'];}return db[_0xc2dc('0x2f')][_0xc2dc('0x4d')]({'where':{'id':_0x57923a['params']['id']}})[_0xc2dc('0x25')](handleEntityNotFound(_0x366833,null))['then'](saveUpdates(_0x57923a[_0xc2dc('0x4f')],null))[_0xc2dc('0x25')](respondWithResult(_0x366833,null))['catch'](handleError(_0x366833,null));};exports[_0xc2dc('0x26')]=function(_0xd67840,_0x4f88aa){return db[_0xc2dc('0x2f')][_0xc2dc('0x4d')]({'where':{'id':_0xd67840[_0xc2dc('0x4c')]['id']}})[_0xc2dc('0x25')](handleEntityNotFound(_0x4f88aa,null))[_0xc2dc('0x25')](removeEntity(_0x4f88aa,null))[_0xc2dc('0x4a')](handleError(_0x4f88aa,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 8abfb21..eb3152d 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 _0x954b=['name_fax','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId'];(function(_0x56bc2f,_0x174768){var _0x50e3a2=function(_0x1407f3){while(--_0x1407f3){_0x56bc2f['push'](_0x56bc2f['shift']());}};_0x50e3a2(++_0x174768);}(_0x954b,0x122));var _0xb954=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x954b[_0x4fe19c];return _0x952ac7;};'use strict';var _=require(_0xb954('0x0'));var util=require('util');var logger=require(_0xb954('0x1'))(_0xb954('0x2'));var moment=require(_0xb954('0x3'));var BPromise=require('bluebird');var rp=require(_0xb954('0x4'));var fs=require('fs');var path=require(_0xb954('0x5'));var rimraf=require(_0xb954('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xb954('0x7')]=function(_0x5d2319,_0x2cc75e){return _0x5d2319[_0xb954('0x8')](_0xb954('0x9'),attributes,{'tableName':_0xb954('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xb954('0xb'),_0xb954('0xc')]},{'unique':!![],'name':_0xb954('0xd'),'fields':[_0xb954('0xb'),_0xb954('0xe')]},{'unique':!![],'name':_0xb954('0xf'),'fields':[_0xb954('0xb'),_0xb954('0x10')]},{'unique':!![],'name':'name_sms','fields':['name',_0xb954('0x11')]},{'unique':!![],'name':_0xb954('0x12'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0xb954('0x13'),'fields':[_0xb954('0xb'),_0xb954('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xb954('0xb'),_0xb954('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f03=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','name_fax','FaxAccountId'];(function(_0x3d9b21,_0x5b580e){var _0x90862f=function(_0x1b732e){while(--_0x1b732e){_0x3d9b21['push'](_0x3d9b21['shift']());}};_0x90862f(++_0x5b580e);}(_0x2f03,0x77));var _0x32f0=function(_0x18c714,_0x27876d){_0x18c714=_0x18c714-0x0;var _0x33bcde=_0x2f03[_0x18c714];return _0x33bcde;};'use strict';var _=require(_0x32f0('0x0'));var util=require(_0x32f0('0x1'));var logger=require(_0x32f0('0x2'))(_0x32f0('0x3'));var moment=require('moment');var BPromise=require(_0x32f0('0x4'));var rp=require(_0x32f0('0x5'));var fs=require('fs');var path=require(_0x32f0('0x6'));var rimraf=require(_0x32f0('0x7'));var config=require(_0x32f0('0x8'));var attributes=require(_0x32f0('0x9'));module['exports']=function(_0x30c24b,_0x44ab97){return _0x30c24b[_0x32f0('0xa')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x32f0('0xb'),_0x32f0('0xc')]},{'unique':!![],'name':_0x32f0('0xd'),'fields':[_0x32f0('0xb'),_0x32f0('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0x32f0('0xb'),_0x32f0('0xf')]},{'unique':!![],'name':_0x32f0('0x10'),'fields':[_0x32f0('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x32f0('0x11'),'fields':[_0x32f0('0xb'),_0x32f0('0x12')]},{'unique':!![],'name':_0x32f0('0x13'),'fields':[_0x32f0('0xb'),_0x32f0('0x14')]},{'unique':!![],'name':_0x32f0('0x15'),'fields':['name',_0x32f0('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b47660d..262b992 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(_0x340596,_0x58f4fd){var _0x1993c2=function(_0x27d3cf){while(--_0x27d3cf){_0x340596['push'](_0x340596['shift']());}};_0x1993c2(++_0x58f4fd);}(_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(_0x29926f,_0xad63b0){var _0x1327dc=function(_0x428ec2){while(--_0x428ec2){_0x29926f['push'](_0x29926f['shift']());}};_0x1327dc(++_0xad63b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 7b45351..dd193b8 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 _0xbd62=['multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','destroy'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0xbd62,0x143));var _0x2bd6=function(_0x5376ab,_0xb53031){_0x5376ab=_0x5376ab-0x0;var _0xc483d=_0xbd62[_0x5376ab];return _0xc483d;};'use strict';var multer=require(_0x2bd6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2bd6('0x1'));var express=require('express');var router=express[_0x2bd6('0x2')]();var fs_extra=require(_0x2bd6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2bd6('0x4'));var config=require(_0x2bd6('0x5'));var controller=require(_0x2bd6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2bd6('0x7')]);router[_0x2bd6('0x8')](_0x2bd6('0x9'),auth[_0x2bd6('0xa')](),controller[_0x2bd6('0xb')]);router[_0x2bd6('0xc')]('/',auth[_0x2bd6('0xa')](),controller[_0x2bd6('0xd')]);router[_0x2bd6('0xe')](_0x2bd6('0x9'),auth[_0x2bd6('0xa')](),controller[_0x2bd6('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2bd6('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6788=['put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6788,0x1bf));var _0x8678=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x6788[_0x26462c];return _0x509a42;};'use strict';var multer=require(_0x8678('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8678('0x1'));var express=require('express');var router=express[_0x8678('0x2')]();var fs_extra=require(_0x8678('0x3'));var auth=require(_0x8678('0x4'));var interaction=require(_0x8678('0x5'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x8678('0x6')]('/',auth[_0x8678('0x7')](),controller[_0x8678('0x8')]);router['get'](_0x8678('0x9'),auth['isAuthenticated'](),controller[_0x8678('0xa')]);router[_0x8678('0xb')]('/',auth[_0x8678('0x7')](),controller['create']);router[_0x8678('0xc')](_0x8678('0x9'),auth['isAuthenticated'](),controller[_0x8678('0xd')]);router[_0x8678('0xe')](_0x8678('0x9'),auth[_0x8678('0x7')](),controller[_0x8678('0xf')]);module[_0x8678('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 45826cb..9fe9d05 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 _0x931c=['yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','9600','14400','7200','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','exports','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x931c,0x14d));var _0xc931=function(_0x585387,_0x3f4ce5){_0x585387=_0x585387-0x0;var _0x3e2183=_0x931c[_0x585387];return _0x3e2183;};'use strict';var Sequelize=require(_0xc931('0x0'));module[_0xc931('0x1')]={'name':{'type':Sequelize[_0xc931('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0xc931('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xc931('0x2')],'defaultValue':_0xc931('0x4')},'localstationid':{'type':Sequelize[_0xc931('0x2')],'unique':_0xc931('0x5')},'minrate':{'type':Sequelize[_0xc931('0x6')](_0xc931('0x7'),_0xc931('0x8'),'7200',_0xc931('0x9'),'12000',_0xc931('0xa')),'defaultValue':_0xc931('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0xc931('0x7'),'4800',_0xc931('0xb'),_0xc931('0x9'),_0xc931('0xc'),_0xc931('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xc931('0xd')},'gateway':{'type':Sequelize[_0xc931('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc931('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc931('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xc931('0x6')](_0xc931('0xf'),_0xc931('0x10'),_0xc931('0x11'),_0xc931('0x12')),'defaultValue':_0xc931('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc931('0x13')],'defaultValue':function(){return _0xc931('0x14');}},'notificationSound':{'type':Sequelize[_0xc931('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc931('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc931('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc931('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc931('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc931('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc931('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0xc931('0x16')},'mandatoryDisposition':{'type':Sequelize[_0xc931('0x15')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x13159b){if(!_0x13159b)this['setDataValue'](_0xc931('0x17'),null);this['setDataValue']('mandatoryDisposition',_0x13159b);}}}; \ No newline at end of file +var _0x39b2=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','7200','12000','14400','4800','v17,v27,v29','INTEGER','SIP','IAX','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x51057a,_0x2c8c27){var _0x3cbdaa=function(_0x168adf){while(--_0x168adf){_0x51057a['push'](_0x51057a['shift']());}};_0x3cbdaa(++_0x2c8c27);}(_0x39b2,0x134));var _0x239b=function(_0x5a297c,_0x11f2b8){_0x5a297c=_0x5a297c-0x0;var _0xe3dbd=_0x39b2[_0x5a297c];return _0xe3dbd;};'use strict';var Sequelize=require(_0x239b('0x0'));module[_0x239b('0x1')]={'name':{'type':Sequelize[_0x239b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x239b('0x2')]},'ecm':{'type':Sequelize[_0x239b('0x3')](_0x239b('0x4'),'no'),'defaultValue':_0x239b('0x4')},'headerinfo':{'type':Sequelize[_0x239b('0x2')],'defaultValue':_0x239b('0x5')},'localstationid':{'type':Sequelize[_0x239b('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x239b('0x3')](_0x239b('0x6'),'4800',_0x239b('0x7'),'9600',_0x239b('0x8'),_0x239b('0x9')),'defaultValue':_0x239b('0xa')},'maxrate':{'type':Sequelize[_0x239b('0x3')](_0x239b('0x6'),_0x239b('0xa'),_0x239b('0x7'),'9600','12000',_0x239b('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x239b('0x2')],'defaultValue':_0x239b('0xb')},'gateway':{'type':Sequelize[_0x239b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x239b('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x239b('0xd'),_0x239b('0xe'),'DADHI','KHOMP'),'defaultValue':_0x239b('0xd')},'key':{'type':Sequelize[_0x239b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x239b('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x239b('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x239b('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x239b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x239b('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x239b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x239b('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x239b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x239b('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x239b('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x239b('0x10')],'defaultValue':![],'comment':_0x239b('0x12'),'set':function(_0x539cad){if(!_0x539cad)this[_0x239b('0x13')](_0x239b('0x14'),null);this[_0x239b('0x13')](_0x239b('0x15'),_0x539cad);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index f79e8f1..bdd0bbd 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 _0xb233=['include','findAll','rows','catch','show','params','mandatoryDispositionPause','intersection','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','rawAttributes','length','order','filter','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','Contact','User','Owner','fullname','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','findAndCountAll','stack','finally','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','priority','Answer','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','headerinfo','maxrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','format','CmList','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','name','send','index','Pause','fieldName','type','key','model','map','query','keys','filters','attributes','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','FaxAccount','includeAll'];(function(_0x2d58e6,_0x55cb14){var _0x5bcd81=function(_0x2b8252){while(--_0x2b8252){_0x2d58e6['push'](_0x2d58e6['shift']());}};_0x5bcd81(++_0x55cb14);}(_0xb233,0x76));var _0x3b23=function(_0x556c2e,_0x284d5b){_0x556c2e=_0x556c2e-0x0;var _0x17b198=_0xb233[_0x556c2e];return _0x17b198;};'use strict';var emlformat=require(_0x3b23('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b23('0x1'));var jsonpatch=require(_0x3b23('0x2'));var rp=require(_0x3b23('0x3'));var moment=require('moment');var BPromise=require(_0x3b23('0x4'));var Mustache=require('mustache');var util=require(_0x3b23('0x5'));var path=require(_0x3b23('0x6'));var sox=require(_0x3b23('0x7'));var csv=require(_0x3b23('0x8'));var ejs=require(_0x3b23('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b23('0xa'));var squel=require(_0x3b23('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3b23('0x8'));var querystring=require(_0x3b23('0xc'));var Papa=require(_0x3b23('0xd'));var Redis=require(_0x3b23('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3b23('0xf'));var as=require(_0x3b23('0x10'));var hardwareService=require(_0x3b23('0x11'));var logger=require(_0x3b23('0x12'))('api');var utils=require(_0x3b23('0x13'));var config=require(_0x3b23('0x14'));var licenseUtil=require(_0x3b23('0x15'));var db=require(_0x3b23('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3b23('0x17'),'port':0x18eb});var socket=require(_0x3b23('0x18'))(new Redis(config['redis']));require(_0x3b23('0x19'))[_0x3b23('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3b23('0x1b')][_0x3b23('0x1c')]({'port':0x232c});var client9002=jayson[_0x3b23('0x1b')][_0x3b23('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3954e9,_0x260bc3,_0x4659bb,_0x17f649){return new BPromise(function(_0x1d99aa,_0x51a465){var _0xa94d16=_0x17f649||client;return _0xa94d16['request'](_0x3954e9,_0x4659bb)[_0x3b23('0x1d')](function(_0x4b0d07){logger['info'](_0x3b23('0x1e'),_0x260bc3,_0x3b23('0x1f'));logger[_0x3b23('0x20')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x260bc3,_0x3b23('0x1f'),JSON['stringify'](_0x4b0d07));if(_0x4b0d07['error']){if(_0x4b0d07['error']['code']===0x1f4){logger['error'](_0x3b23('0x1e'),_0x260bc3,_0x4b0d07[_0x3b23('0x21')]['message']);return _0x51a465(_0x4b0d07[_0x3b23('0x21')][_0x3b23('0x22')]);}logger[_0x3b23('0x21')](_0x3b23('0x1e'),_0x260bc3,_0x4b0d07[_0x3b23('0x21')][_0x3b23('0x22')]);return _0x1d99aa(_0x4b0d07['error']['message']);}else{logger[_0x3b23('0x23')](_0x3b23('0x1e'),_0x260bc3,_0x3b23('0x1f'));_0x1d99aa(_0x4b0d07[_0x3b23('0x24')][_0x3b23('0x22')]);}})['catch'](function(_0x3702cb){logger['error']('FaxAccount,\x20%s,\x20%s',_0x260bc3,_0x3702cb);_0x51a465(_0x3702cb);});});}function respondWithStatusCode(_0x3f86eb,_0x1fd3bd){_0x1fd3bd=_0x1fd3bd||0xcc;return function(_0x236b74){if(_0x236b74){return _0x3f86eb[_0x3b23('0x25')](_0x1fd3bd);}return _0x3f86eb[_0x3b23('0x26')](_0x1fd3bd)[_0x3b23('0x27')]();};}function respondWithResult(_0x538e3a,_0x120643){_0x120643=_0x120643||0xc8;return function(_0x566b22){if(_0x566b22){return _0x538e3a[_0x3b23('0x26')](_0x120643)['json'](_0x566b22);}};}function respondWithFilteredResult(_0x4b8f70,_0xcba4a1){return function(_0x1cebf7){if(_0x1cebf7){var _0x4ddfdb=typeof _0xcba4a1['offset']===_0x3b23('0x28')&&typeof _0xcba4a1[_0x3b23('0x29')]===_0x3b23('0x28');var _0x25da80=_0x1cebf7[_0x3b23('0x2a')];var _0x378452=_0x4ddfdb?0x0:_0xcba4a1[_0x3b23('0x2b')];var _0x8ac896=_0x4ddfdb?_0x1cebf7[_0x3b23('0x2a')]:_0xcba4a1['offset']+_0xcba4a1[_0x3b23('0x29')];var _0x1aa20f;if(_0x8ac896>=_0x25da80){_0x8ac896=_0x25da80;_0x1aa20f=0xc8;}else{_0x1aa20f=0xce;}_0x4b8f70['status'](_0x1aa20f);return _0x4b8f70[_0x3b23('0x2c')](_0x3b23('0x2d'),_0x378452+'-'+_0x8ac896+'/'+_0x25da80)[_0x3b23('0x2e')](_0x1cebf7);}return null;};}function patchUpdates(_0x383e33){return function(_0x7cdb36){try{jsonpatch[_0x3b23('0x2f')](_0x7cdb36,_0x383e33,!![]);}catch(_0xfb298d){return BPromise[_0x3b23('0x30')](_0xfb298d);}return _0x7cdb36[_0x3b23('0x31')]();};}function saveUpdates(_0x2ecb4c,_0x19be4b){return function(_0x2a640c){if(_0x2a640c){return _0x2a640c[_0x3b23('0x32')](_0x2ecb4c)['then'](function(_0x102843){return _0x102843;});}return null;};}function removeEntity(_0x397739,_0x4b4a0c){return function(_0x3a0962){if(_0x3a0962){return _0x3a0962[_0x3b23('0x33')]()[_0x3b23('0x1d')](function(){var _0x198c0c=_0x3a0962[_0x3b23('0x34')]({'plain':!![]});var _0x46229d='FaxAccounts';return db[_0x3b23('0x35')][_0x3b23('0x33')]({'where':{'type':_0x46229d,'resourceId':_0x198c0c['id']}})['then'](function(){return _0x3a0962;});})[_0x3b23('0x1d')](function(){_0x397739[_0x3b23('0x26')](0xcc)[_0x3b23('0x27')]();});}};}function handleEntityNotFound(_0x26dc4c,_0x41d43a){return function(_0xba4b98){if(!_0xba4b98){_0x26dc4c[_0x3b23('0x25')](0x194);}return _0xba4b98;};}function handleError(_0x1b2027,_0x6f84d7){_0x6f84d7=_0x6f84d7||0x1f4;return function(_0x566196){logger[_0x3b23('0x21')](_0x566196['stack']);if(_0x566196[_0x3b23('0x36')]){delete _0x566196[_0x3b23('0x36')];}_0x1b2027[_0x3b23('0x26')](_0x6f84d7)[_0x3b23('0x37')](_0x566196);};}exports[_0x3b23('0x38')]=function(_0x2420f5,_0x13b130){var _0x183c0b={'include':[{'model':db[_0x3b23('0x39')],'as':'mandatoryDispositionPause'}]},_0x3ea277={},_0x322572={'count':0x0,'rows':[]};var _0x213e16=_['map'](db['FaxAccount']['rawAttributes'],function(_0x18dca1){return{'name':_0x18dca1[_0x3b23('0x3a')],'type':_0x18dca1[_0x3b23('0x3b')][_0x3b23('0x3c')]};});_0x3ea277[_0x3b23('0x3d')]=_[_0x3b23('0x3e')](_0x213e16,_0x3b23('0x36'));_0x3ea277[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0x2420f5[_0x3b23('0x3f')]);_0x3ea277[_0x3b23('0x41')]=_['intersection'](_0x3ea277[_0x3b23('0x3d')],_0x3ea277['query']);_0x183c0b['attributes']=_['intersection'](_0x3ea277[_0x3b23('0x3d')],qs['fields'](_0x2420f5['query']['fields']));_0x183c0b[_0x3b23('0x42')]=_0x183c0b[_0x3b23('0x42')]['length']?_0x183c0b['attributes']:_0x3ea277[_0x3b23('0x3d')];if(!_0x2420f5['query'][_0x3b23('0x43')]('nolimit')){_0x183c0b['limit']=qs[_0x3b23('0x29')](_0x2420f5['query'][_0x3b23('0x29')]);_0x183c0b['offset']=qs['offset'](_0x2420f5[_0x3b23('0x3f')][_0x3b23('0x2b')]);}_0x183c0b['order']=qs[_0x3b23('0x44')](_0x2420f5['query'][_0x3b23('0x44')]);_0x183c0b[_0x3b23('0x45')]=qs[_0x3b23('0x41')](_[_0x3b23('0x46')](_0x2420f5[_0x3b23('0x3f')],_0x3ea277[_0x3b23('0x41')]),_0x213e16);if(_0x2420f5['query']['filter']){_0x183c0b['where']=_[_0x3b23('0x47')](_0x183c0b[_0x3b23('0x45')],{'$or':_[_0x3b23('0x3e')](_0x213e16,function(_0x2a8aec){if(_0x2a8aec[_0x3b23('0x3b')]!==_0x3b23('0x48')){var _0x1ec622={};_0x1ec622[_0x2a8aec[_0x3b23('0x36')]]={'$like':'%'+_0x2420f5[_0x3b23('0x3f')]['filter']+'%'};return _0x1ec622;}})});}_0x183c0b=_[_0x3b23('0x47')]({},_0x183c0b,_0x2420f5[_0x3b23('0x49')]);var _0x556a3f={'where':_0x183c0b[_0x3b23('0x45')]};return db[_0x3b23('0x4a')]['count'](_0x556a3f)['then'](function(_0xbf6b63){_0x322572['count']=_0xbf6b63;if(_0x2420f5[_0x3b23('0x3f')][_0x3b23('0x4b')]){_0x183c0b[_0x3b23('0x4c')]=[{'all':!![]}];}return db['FaxAccount'][_0x3b23('0x4d')](_0x183c0b);})['then'](function(_0x5d15fe){_0x322572[_0x3b23('0x4e')]=_0x5d15fe;return _0x322572;})[_0x3b23('0x1d')](respondWithFilteredResult(_0x13b130,_0x183c0b))[_0x3b23('0x4f')](handleError(_0x13b130,null));};exports[_0x3b23('0x50')]=function(_0x21e6d0,_0x344809){var _0x4c8c3e={'raw':![],'where':{'id':_0x21e6d0[_0x3b23('0x51')]['id']},'include':[{'model':db[_0x3b23('0x39')],'as':_0x3b23('0x52')}]},_0x77d9b8={};_0x77d9b8[_0x3b23('0x3d')]=_[_0x3b23('0x40')](db[_0x3b23('0x4a')]['rawAttributes']);_0x77d9b8[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0x21e6d0[_0x3b23('0x3f')]);_0x77d9b8[_0x3b23('0x41')]=_[_0x3b23('0x53')](_0x77d9b8[_0x3b23('0x3d')],_0x77d9b8['query']);_0x4c8c3e[_0x3b23('0x42')]=_['intersection'](_0x77d9b8['model'],qs[_0x3b23('0x54')](_0x21e6d0[_0x3b23('0x3f')][_0x3b23('0x54')]));_0x4c8c3e[_0x3b23('0x42')]=_0x4c8c3e[_0x3b23('0x42')]['length']?_0x4c8c3e[_0x3b23('0x42')]:_0x77d9b8[_0x3b23('0x3d')];if(_0x21e6d0[_0x3b23('0x3f')][_0x3b23('0x4b')]){_0x4c8c3e[_0x3b23('0x4c')]=[{'all':!![]}];}_0x4c8c3e=_['merge']({},_0x4c8c3e,_0x21e6d0[_0x3b23('0x49')]);return db[_0x3b23('0x4a')]['find'](_0x4c8c3e)[_0x3b23('0x1d')](handleEntityNotFound(_0x344809,null))[_0x3b23('0x1d')](respondWithResult(_0x344809,null))[_0x3b23('0x4f')](handleError(_0x344809,null));};exports[_0x3b23('0x55')]=function(_0xe216db,_0x236d3e){return db['FaxAccount']['create'](_0xe216db[_0x3b23('0x56')],{})[_0x3b23('0x1d')](function(_0x2791c0){var _0x4c8ffb=_0xe216db['user']['get']({'plain':!![]});if(!_0x4c8ffb)throw new Error(_0x3b23('0x57'));if(_0x4c8ffb['role']===_0x3b23('0x58')){var _0x9c228a=_0x2791c0['get']({'plain':!![]});var _0x4209e9='FaxAccounts';return db[_0x3b23('0x59')][_0x3b23('0x5a')]({'where':{'name':_0x4209e9,'userProfileId':_0x4c8ffb[_0x3b23('0x5b')]},'raw':!![]})['then'](function(_0x288694){if(_0x288694&&_0x288694[_0x3b23('0x5c')]===0x0){return db[_0x3b23('0x35')][_0x3b23('0x55')]({'name':_0x9c228a['name'],'resourceId':_0x9c228a['id'],'type':_0x288694['name'],'sectionId':_0x288694['id']},{})[_0x3b23('0x1d')](function(){return _0x2791c0;});}else{return _0x2791c0;}})[_0x3b23('0x4f')](function(_0x280d99){logger[_0x3b23('0x21')](_0x3b23('0x5d'),_0x280d99);throw _0x280d99;});}return _0x2791c0;})['then'](respondWithResult(_0x236d3e,0xc9))[_0x3b23('0x4f')](handleError(_0x236d3e,null));};exports[_0x3b23('0x32')]=function(_0x4b1ed1,_0x4ce526){if(_0x4b1ed1[_0x3b23('0x56')]['id']){delete _0x4b1ed1[_0x3b23('0x56')]['id'];}return db['FaxAccount'][_0x3b23('0x5a')]({'where':{'id':_0x4b1ed1[_0x3b23('0x51')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x3b23('0x1d')](handleEntityNotFound(_0x4ce526,null))[_0x3b23('0x1d')](saveUpdates(_0x4b1ed1[_0x3b23('0x56')],null))['then'](respondWithResult(_0x4ce526,null))[_0x3b23('0x4f')](handleError(_0x4ce526,null));};exports[_0x3b23('0x33')]=function(_0x561af1,_0x5e819e){return db['FaxAccount'][_0x3b23('0x5a')]({'where':{'id':_0x561af1[_0x3b23('0x51')]['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x5e819e,null))[_0x3b23('0x1d')](removeEntity(_0x5e819e,null))['catch'](handleError(_0x5e819e,null));};exports[_0x3b23('0x5e')]=function(_0x3508ba,_0x143aaa){return db[_0x3b23('0x4a')][_0x3b23('0x5e')]()[_0x3b23('0x1d')](respondWithResult(_0x143aaa,null))['catch'](handleError(_0x143aaa,null));};exports[_0x3b23('0x5f')]=function(_0x255c27,_0x41edc7,_0x30831e){if(_0x255c27[_0x3b23('0x56')]['id']){delete _0x255c27[_0x3b23('0x56')]['id'];}return db[_0x3b23('0x4a')][_0x3b23('0x5a')]({'where':{'id':_0x255c27[_0x3b23('0x51')]['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x41edc7,null))['then'](function(_0x320f57){if(_0x320f57){_0x255c27[_0x3b23('0x56')][_0x3b23('0x60')]=_0x320f57['id'];return db['Disposition']['create'](_0x255c27[_0x3b23('0x56')]);}})['then'](respondWithResult(_0x41edc7,null))[_0x3b23('0x4f')](handleError(_0x41edc7,null));};exports[_0x3b23('0x61')]=function(_0xa1746a,_0x3f96a4,_0x49c3e4){var _0x15c4ac={'raw':![],'where':{}};var _0x4d8fb1={};var _0x27fbfb={'count':0x0,'rows':[]};return db[_0x3b23('0x4a')]['findOne']({'where':{'id':_0xa1746a[_0x3b23('0x51')]['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x3f96a4,null))['then'](function(_0x31590d){if(_0x31590d){_0x4d8fb1[_0x3b23('0x3d')]=_[_0x3b23('0x40')](db['Disposition'][_0x3b23('0x62')]);_0x4d8fb1[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0xa1746a[_0x3b23('0x3f')]);_0x4d8fb1[_0x3b23('0x41')]=_['intersection'](_0x4d8fb1[_0x3b23('0x3d')],_0x4d8fb1[_0x3b23('0x3f')]);_0x15c4ac[_0x3b23('0x42')]=_[_0x3b23('0x53')](_0x4d8fb1['model'],qs['fields'](_0xa1746a['query']['fields']));_0x15c4ac[_0x3b23('0x42')]=_0x15c4ac['attributes'][_0x3b23('0x63')]?_0x15c4ac['attributes']:_0x4d8fb1[_0x3b23('0x3d')];if(!_0xa1746a[_0x3b23('0x3f')]['hasOwnProperty']('nolimit')){_0x15c4ac[_0x3b23('0x29')]=qs[_0x3b23('0x29')](_0xa1746a[_0x3b23('0x3f')][_0x3b23('0x29')]);_0x15c4ac[_0x3b23('0x2b')]=qs[_0x3b23('0x2b')](_0xa1746a[_0x3b23('0x3f')][_0x3b23('0x2b')]);}_0x15c4ac[_0x3b23('0x64')]=qs[_0x3b23('0x44')](_0xa1746a['query'][_0x3b23('0x44')]);_0x15c4ac[_0x3b23('0x45')]=qs['filters'](_['pick'](_0xa1746a['query'],_0x4d8fb1['filters']));_0x15c4ac[_0x3b23('0x45')][_0x3b23('0x60')]=_0x31590d['id'];if(_0xa1746a[_0x3b23('0x3f')]['filter']){_0x15c4ac[_0x3b23('0x45')]=_[_0x3b23('0x47')](_0x15c4ac['where'],{'$or':_[_0x3b23('0x3e')](_0x15c4ac[_0x3b23('0x42')],function(_0x1fdfa6){var _0x56d2cd={};_0x56d2cd[_0x1fdfa6]={'$like':'%'+_0xa1746a[_0x3b23('0x3f')][_0x3b23('0x65')]+'%'};return _0x56d2cd;})});}_0x15c4ac=_['merge']({},_0x15c4ac,_0xa1746a[_0x3b23('0x49')]);return db[_0x3b23('0x66')][_0x3b23('0x2a')]({'where':_0x15c4ac[_0x3b23('0x45')]})[_0x3b23('0x1d')](function(_0x41db6c){_0x27fbfb[_0x3b23('0x2a')]=_0x41db6c;if(_0xa1746a[_0x3b23('0x3f')][_0x3b23('0x4b')]){_0x15c4ac[_0x3b23('0x4c')]=[{'all':!![]}];}return db[_0x3b23('0x66')]['findAll'](_0x15c4ac);})[_0x3b23('0x1d')](function(_0x27d9bc){_0x27fbfb[_0x3b23('0x4e')]=_0x27d9bc;return _0x27fbfb;});}})['then'](respondWithFilteredResult(_0x3f96a4,_0x15c4ac))['catch'](handleError(_0x3f96a4,null));};exports['removeDispositions']=function(_0x5f36c1,_0x269bec,_0x5ccee9){return db[_0x3b23('0x4a')][_0x3b23('0x5a')]({'where':{'id':_0x5f36c1[_0x3b23('0x51')]['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x269bec,null))[_0x3b23('0x1d')](function(_0x1a95f8){if(_0x1a95f8){return _0x1a95f8[_0x3b23('0x67')](_0x5f36c1['query'][_0x3b23('0x68')]);}})[_0x3b23('0x1d')](respondWithStatusCode(_0x269bec,null))[_0x3b23('0x4f')](handleError(_0x269bec,null));};exports[_0x3b23('0x69')]=function(_0x4f1010,_0x7b0ffc,_0x2be3a4){if(_0x4f1010['body']['id']){delete _0x4f1010['body']['id'];}return db[_0x3b23('0x4a')][_0x3b23('0x5a')]({'where':{'id':_0x4f1010['params']['id']}})['then'](handleEntityNotFound(_0x7b0ffc,null))[_0x3b23('0x1d')](function(_0x5ecb0f){if(_0x5ecb0f){_0x4f1010[_0x3b23('0x56')]['FaxAccountId']=_0x5ecb0f['id'];return db[_0x3b23('0x6a')][_0x3b23('0x55')](_0x4f1010['body']);}})[_0x3b23('0x1d')](respondWithResult(_0x7b0ffc,null))[_0x3b23('0x4f')](handleError(_0x7b0ffc,null));};exports[_0x3b23('0x6b')]=function(_0x33dd8e,_0x910815,_0x221b45){var _0xa1dbfc={'raw':![],'where':{}};var _0x46a2ac={};var _0x581eea={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3b23('0x6c')]({'where':{'id':_0x33dd8e['params']['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x910815,null))[_0x3b23('0x1d')](function(_0x4a2926){if(_0x4a2926){_0x46a2ac[_0x3b23('0x3d')]=_['keys'](db[_0x3b23('0x6a')][_0x3b23('0x62')]);_0x46a2ac[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0x33dd8e[_0x3b23('0x3f')]);_0x46a2ac[_0x3b23('0x41')]=_[_0x3b23('0x53')](_0x46a2ac[_0x3b23('0x3d')],_0x46a2ac[_0x3b23('0x3f')]);_0xa1dbfc['attributes']=_['intersection'](_0x46a2ac[_0x3b23('0x3d')],qs[_0x3b23('0x54')](_0x33dd8e[_0x3b23('0x3f')]['fields']));_0xa1dbfc[_0x3b23('0x42')]=_0xa1dbfc[_0x3b23('0x42')][_0x3b23('0x63')]?_0xa1dbfc[_0x3b23('0x42')]:_0x46a2ac[_0x3b23('0x3d')];if(!_0x33dd8e[_0x3b23('0x3f')][_0x3b23('0x43')](_0x3b23('0x6d'))){_0xa1dbfc[_0x3b23('0x29')]=qs[_0x3b23('0x29')](_0x33dd8e[_0x3b23('0x3f')][_0x3b23('0x29')]);_0xa1dbfc[_0x3b23('0x2b')]=qs[_0x3b23('0x2b')](_0x33dd8e[_0x3b23('0x3f')][_0x3b23('0x2b')]);}_0xa1dbfc['order']=qs[_0x3b23('0x44')](_0x33dd8e[_0x3b23('0x3f')][_0x3b23('0x44')]);_0xa1dbfc['where']=qs['filters'](_[_0x3b23('0x46')](_0x33dd8e[_0x3b23('0x3f')],_0x46a2ac['filters']));_0xa1dbfc[_0x3b23('0x45')]['FaxAccountId']=_0x4a2926['id'];if(_0x33dd8e[_0x3b23('0x3f')][_0x3b23('0x65')]){_0xa1dbfc['where']=_['merge'](_0xa1dbfc['where'],{'$or':_[_0x3b23('0x3e')](_0xa1dbfc[_0x3b23('0x42')],function(_0x303c9e){var _0x396ca6={};_0x396ca6[_0x303c9e]={'$like':'%'+_0x33dd8e[_0x3b23('0x3f')][_0x3b23('0x65')]+'%'};return _0x396ca6;})});}_0xa1dbfc=_[_0x3b23('0x47')]({},_0xa1dbfc,_0x33dd8e['options']);return db[_0x3b23('0x6a')][_0x3b23('0x2a')]({'where':_0xa1dbfc['where']})[_0x3b23('0x1d')](function(_0x17ff18){_0x581eea[_0x3b23('0x2a')]=_0x17ff18;if(_0x33dd8e[_0x3b23('0x3f')][_0x3b23('0x4b')]){_0xa1dbfc['include']=[{'all':!![]}];}return db[_0x3b23('0x6a')]['findAll'](_0xa1dbfc);})[_0x3b23('0x1d')](function(_0x53377e){_0x581eea[_0x3b23('0x4e')]=_0x53377e;return _0x581eea;});}})[_0x3b23('0x1d')](respondWithFilteredResult(_0x910815,_0xa1dbfc))[_0x3b23('0x4f')](handleError(_0x910815,null));};exports['removeAnswers']=function(_0x53c96a,_0x1aa574,_0x5c6fc3){return db[_0x3b23('0x4a')][_0x3b23('0x5a')]({'where':{'id':_0x53c96a['params']['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x1aa574,null))[_0x3b23('0x1d')](function(_0x30c7c7){if(_0x30c7c7){return _0x30c7c7[_0x3b23('0x6e')](_0x53c96a[_0x3b23('0x3f')]['ids']);}})[_0x3b23('0x1d')](respondWithStatusCode(_0x1aa574,null))[_0x3b23('0x4f')](handleError(_0x1aa574,null));};exports[_0x3b23('0x6f')]=function(_0x7e2b1e,_0x684fcb,_0x541fe1){return db['FaxInteraction'][_0x3b23('0x5a')]({'where':{'id':_0x7e2b1e['params']['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x684fcb,null))[_0x3b23('0x1d')](function(_0x4141e8){if(_0x4141e8){return _0x4141e8['addInteraction'](_0x7e2b1e['body']['ids'],_[_0x3b23('0x70')](_0x7e2b1e[_0x3b23('0x56')],['ids','id'])||{});}})['then'](respondWithResult(_0x684fcb,null))[_0x3b23('0x4f')](handleError(_0x684fcb,null));};exports[_0x3b23('0x71')]=function(_0x3005c7,_0x39fe83,_0x5c9891){var _0x49ac7a={'raw':![],'where':{}};var _0x36c776={};var _0x310888={'count':0x0,'rows':[]};return db[_0x3b23('0x4a')][_0x3b23('0x6c')]({'where':{'id':_0x3005c7[_0x3b23('0x51')]['id']}})['then'](handleEntityNotFound(_0x39fe83,null))[_0x3b23('0x1d')](function(_0x2bf3fb){if(_0x2bf3fb){_0x36c776[_0x3b23('0x3d')]=_[_0x3b23('0x40')](db[_0x3b23('0x72')][_0x3b23('0x62')]);_0x36c776[_0x3b23('0x3f')]=_['keys'](_0x3005c7[_0x3b23('0x3f')]);_0x36c776[_0x3b23('0x41')]=_[_0x3b23('0x53')](_0x36c776[_0x3b23('0x3d')],_0x36c776[_0x3b23('0x3f')]);_0x49ac7a[_0x3b23('0x42')]=_['intersection'](_0x36c776[_0x3b23('0x3d')],qs[_0x3b23('0x54')](_0x3005c7[_0x3b23('0x3f')][_0x3b23('0x54')]));_0x49ac7a[_0x3b23('0x42')]=_0x49ac7a[_0x3b23('0x42')][_0x3b23('0x63')]?_0x49ac7a[_0x3b23('0x42')]:_0x36c776[_0x3b23('0x3d')];if(!_0x3005c7[_0x3b23('0x3f')][_0x3b23('0x43')](_0x3b23('0x6d'))){_0x49ac7a['limit']=qs['limit'](_0x3005c7[_0x3b23('0x3f')][_0x3b23('0x29')]);_0x49ac7a[_0x3b23('0x2b')]=qs['offset'](_0x3005c7['query'][_0x3b23('0x2b')]);}_0x49ac7a[_0x3b23('0x64')]=qs['sort'](_0x3005c7['query'][_0x3b23('0x44')]);_0x49ac7a[_0x3b23('0x45')]=qs[_0x3b23('0x41')](_[_0x3b23('0x46')](_0x3005c7[_0x3b23('0x3f')],_0x36c776[_0x3b23('0x41')]));_0x49ac7a[_0x3b23('0x45')][_0x3b23('0x60')]=_0x2bf3fb['id'];if(_0x3005c7[_0x3b23('0x3f')]['filter']){_0x49ac7a[_0x3b23('0x45')]=_['merge'](_0x49ac7a[_0x3b23('0x45')],{'$or':_['map'](_0x49ac7a[_0x3b23('0x42')],function(_0x5179cd){var _0x46033b={};_0x46033b[_0x5179cd]={'$like':'%'+_0x3005c7['query'][_0x3b23('0x65')]+'%'};return _0x46033b;})});}_0x49ac7a=_[_0x3b23('0x47')]({},_0x49ac7a,_0x3005c7[_0x3b23('0x49')]);return db[_0x3b23('0x72')][_0x3b23('0x2a')]({'where':_0x49ac7a[_0x3b23('0x45')]})[_0x3b23('0x1d')](function(_0x509bce){_0x310888[_0x3b23('0x2a')]=_0x509bce;if(_0x3005c7[_0x3b23('0x3f')][_0x3b23('0x4b')]){_0x49ac7a[_0x3b23('0x4c')]=[{'model':db['CmContact'],'as':_0x3b23('0x73'),'required':![]},{'model':db[_0x3b23('0x74')],'as':_0x3b23('0x75'),'attributes':['name',_0x3b23('0x76'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x3b23('0x77'),'attributes':['id','name','color'],'where':_0x3005c7[_0x3b23('0x3f')][_0x3b23('0x78')]?{'id':_0x3005c7[_0x3b23('0x3f')]['tag']}:undefined,'required':_0x3005c7['query'][_0x3b23('0x78')]?!![]:![]}];}return db['FaxInteraction'][_0x3b23('0x4d')](_0x49ac7a);})[_0x3b23('0x1d')](function(_0x5f2c73){_0x310888[_0x3b23('0x4e')]=_0x5f2c73;return _0x310888;});}})['then'](respondWithFilteredResult(_0x39fe83,_0x49ac7a))[_0x3b23('0x4f')](handleError(_0x39fe83,null));};exports[_0x3b23('0x79')]=function(_0x26201e,_0x18646e){var _0x19019a=_0x26201e[_0x3b23('0x51')]['id'];var _0x2a943f=_0x26201e['body'];var _0x15a634=0xc8;var _0x3d8c3a=null;return db[_0x3b23('0x7a')][_0x3b23('0x7b')]({'isolationLevel':db[_0x3b23('0x7a')][_0x3b23('0x7c')][_0x3b23('0x7d')]['READ_COMMITTED']},function(_0x3afea5){return db['FaxAccount']['findOne']({'where':{'id':_0x19019a},'transaction':_0x3afea5})[_0x3b23('0x1d')](function(_0x340900){if(_0x340900){return db[_0x3b23('0x7e')][_0x3b23('0x33')]({'where':{'FaxAccountId':_0x19019a},'transaction':_0x3afea5})[_0x3b23('0x1d')](function(){var _0x1801e9=_[_0x3b23('0x3e')](_0x2a943f,function(_0x11f2d7){_0x11f2d7['FaxAccountId']=_0x19019a;return _0x11f2d7;});return db[_0x3b23('0x7e')]['bulkCreate'](_0x1801e9,{'transaction':_0x3afea5});});}else{_0x15a634=0x194;_0x3d8c3a=[];}});})[_0x3b23('0x1d')](function(){if(_0x15a634!==0x194){return db[_0x3b23('0x7e')][_0x3b23('0x7f')]({'where':{'FaxAccountId':_0x19019a},'order':'priority'})['then'](function(_0xcb4104){_0x3d8c3a=_0xcb4104;});}})['catch'](function(_0x290382){_0x15a634=0x1f4;logger[_0x3b23('0x21')](_0x290382[_0x3b23('0x80')]);if(_0x290382['name']){delete _0x290382[_0x3b23('0x36')];}_0x3d8c3a=_0x290382;})[_0x3b23('0x81')](function(){if(_0x3d8c3a===null){_0x18646e[_0x3b23('0x25')](_0x15a634);}else{if(_0x15a634===0x1f4){_0x18646e[_0x3b23('0x26')](_0x15a634)[_0x3b23('0x37')](_0x3d8c3a);}else{_0x18646e[_0x3b23('0x26')](_0x15a634)[_0x3b23('0x2e')](_0x3d8c3a);}}});};exports[_0x3b23('0x82')]=function(_0x16c233,_0x490950,_0x29d8b0){var _0x31e78c={};var _0x440783={};var _0xc12ed;var _0xf77be4;return db[_0x3b23('0x4a')][_0x3b23('0x6c')]({'where':{'id':_0x16c233[_0x3b23('0x51')]['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x490950,null))[_0x3b23('0x1d')](function(_0x19df22){if(_0x19df22){_0xc12ed=_0x19df22;_0x440783['model']=_[_0x3b23('0x40')](db[_0x3b23('0x7e')]['rawAttributes']);_0x440783[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0x16c233['query']);_0x440783['filters']=_[_0x3b23('0x53')](_0x440783[_0x3b23('0x3d')],_0x440783[_0x3b23('0x3f')]);_0x31e78c[_0x3b23('0x42')]=_[_0x3b23('0x53')](_0x440783[_0x3b23('0x3d')],qs[_0x3b23('0x54')](_0x16c233[_0x3b23('0x3f')]['fields']));_0x31e78c[_0x3b23('0x42')]=_0x31e78c[_0x3b23('0x42')][_0x3b23('0x63')]?_0x31e78c[_0x3b23('0x42')]:_0x440783['model'];_0x31e78c[_0x3b23('0x64')]=qs[_0x3b23('0x44')](_0x16c233[_0x3b23('0x3f')][_0x3b23('0x44')]);_0x31e78c[_0x3b23('0x45')]=qs[_0x3b23('0x41')](_[_0x3b23('0x46')](_0x16c233[_0x3b23('0x3f')],_0x440783[_0x3b23('0x41')]));if(_0x16c233['query'][_0x3b23('0x65')]){_0x31e78c[_0x3b23('0x45')]=_[_0x3b23('0x47')](_0x31e78c['where'],{'$or':_[_0x3b23('0x3e')](_0x31e78c[_0x3b23('0x42')],function(_0x55a799){var _0x585bfc={};_0x585bfc[_0x55a799]={'$like':'%'+_0x16c233[_0x3b23('0x3f')][_0x3b23('0x65')]+'%'};return _0x585bfc;})});}_0x31e78c=_[_0x3b23('0x47')]({},_0x31e78c,_0x16c233[_0x3b23('0x49')]);return _0xc12ed[_0x3b23('0x82')](_0x31e78c);}})[_0x3b23('0x1d')](function(_0x180f57){if(_0x180f57){_0xf77be4=_0x180f57[_0x3b23('0x63')];if(!_0x16c233['query'][_0x3b23('0x43')]('nolimit')){_0x31e78c[_0x3b23('0x29')]=qs[_0x3b23('0x29')](_0x16c233['query']['limit']);_0x31e78c['offset']=qs[_0x3b23('0x2b')](_0x16c233[_0x3b23('0x3f')][_0x3b23('0x2b')]);}return _0xc12ed[_0x3b23('0x82')](_0x31e78c);}})['then'](function(_0x5be8b8){if(_0x5be8b8){return _0x5be8b8?{'count':_0xf77be4,'rows':_0x5be8b8}:null;}})[_0x3b23('0x1d')](respondWithResult(_0x490950,null))[_0x3b23('0x4f')](handleError(_0x490950,null));};function Extension(_0x244e34,_0x995574,_0xd402e6,_0x1e8b4d){this['context']=_0x3b23('0x83');this[_0x3b23('0x84')]=_0x244e34['localstationid'];this[_0x3b23('0x85')]=_0x1e8b4d;this[_0x3b23('0x3b')]=_0x3b23('0x86');this[_0x3b23('0x87')]=_0x3b23('0x88');this[_0x3b23('0x60')]=_0x244e34['id'];this[_0x3b23('0x89')]=_0x995574;this['appdata']=_0xd402e6;}function createExtensionsReciveFax(_0xb54e85){var _0x1e160e=0x1;var _0xc8a66c=[];_0xc8a66c['push'](new Extension(_0xb54e85,_0x1e160e,'',_0x3b23('0x8a')));_0x1e160e+=0x1;_0xc8a66c[_0x3b23('0x8b')](new Extension(_0xb54e85,_0x1e160e,_0x3b23('0x8c'),_0x3b23('0x8d')));_0x1e160e+=0x1;for(var _0x1e3715 in _0xb54e85){if(_0xb54e85['hasOwnProperty'](_0x1e3715)&&(_0x1e3715===_0x3b23('0x8e')||_0x1e3715===_0x3b23('0x8f')||_0x1e3715===_0x3b23('0x90')||_0x1e3715==='faxdetect'||_0x1e3715===_0x3b23('0x91')||_0x1e3715===_0x3b23('0x92')||_0x1e3715==='minrate'||_0x1e3715===_0x3b23('0x93')||_0x1e3715==='t38timeout')){_0xc8a66c[_0x3b23('0x8b')](new Extension(_0xb54e85,_0x1e160e,'FAXOPT('+_0x1e3715+')='+_0xb54e85[_0x1e3715],_0x3b23('0x8d')));_0x1e160e+=0x1;}}_0xc8a66c[_0x3b23('0x8b')](new Extension(_0xb54e85,_0x1e160e,'6',_0x3b23('0x94')));_0x1e160e+=0x1;_0xc8a66c['push'](new Extension(_0xb54e85,_0x1e160e,_0x3b23('0x95'),_0x3b23('0x96')));_0x1e160e=0x0;return _0xc8a66c;}exports[_0x3b23('0x97')]=function(_0x4beba8,_0x428a52,_0x4a4e06){var _0x211a0a;return db['sequelize'][_0x3b23('0x7b')](function(_0x58d215){return db[_0x3b23('0x4a')]['create'](_0x4beba8[_0x3b23('0x56')],{'transaction':_0x58d215})[_0x3b23('0x1d')](function(_0x353abe){_0x211a0a=_0x353abe[_0x3b23('0x34')]({'plain':!![]});return db[_0x3b23('0x98')][_0x3b23('0x99')](createExtensionsReciveFax(_0x211a0a),{'transaction':_0x58d215});});})[_0x3b23('0x1d')](function(){return _0x211a0a;})[_0x3b23('0x1d')](respondWithResult(_0x428a52,null))[_0x3b23('0x4f')](handleError(_0x428a52,null));};exports['updateAccountApplications']=function(_0x5a3678,_0x14860e,_0x2d4bec){var _0x453b9f;return db['sequelize']['transaction'](function(_0x4fa386){return db[_0x3b23('0x4a')][_0x3b23('0x32')](_0x5a3678[_0x3b23('0x56')],{'where':{'id':_0x5a3678[_0x3b23('0x56')]['id']},'transaction':_0x4fa386})[_0x3b23('0x1d')](function(_0x387ec8){return db[_0x3b23('0x98')][_0x3b23('0x33')]({'where':{'FaxAccountId':_0x5a3678[_0x3b23('0x56')]['id']},'transaction':_0x4fa386})[_0x3b23('0x1d')](function(_0x1242b9){return db[_0x3b23('0x98')][_0x3b23('0x99')](createExtensionsReciveFax(_[_0x3b23('0x70')](_0x5a3678[_0x3b23('0x56')],[_0x3b23('0x9a'),_0x3b23('0x3c'),_0x3b23('0x9b'),_0x3b23('0x9c'),_0x3b23('0x9d'),'ListId'])),{'transaction':_0x4fa386});});});})['then'](function(){return db[_0x3b23('0x4a')][_0x3b23('0x9e')](_0x5a3678[_0x3b23('0x56')]['id']);})[_0x3b23('0x1d')](respondWithResult(_0x14860e,null))[_0x3b23('0x4f')](handleError(_0x14860e,null));};exports[_0x3b23('0x9f')]=function(_0x3a0f93,_0x2af2cd,_0xc70ebd){var _0x554992={'raw':!![],'where':{}};var _0x39fa90={};var _0xe858e2={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3b23('0x6c')]({'where':{'id':_0x3a0f93[_0x3b23('0x51')]['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x2af2cd,null))['then'](function(_0x44ee4b){if(_0x44ee4b){_0x39fa90['model']=_[_0x3b23('0x40')](db[_0x3b23('0xa0')][_0x3b23('0x62')]);_0x39fa90[_0x3b23('0x3f')]=_[_0x3b23('0x40')](_0x3a0f93['query']);_0x39fa90['filters']=_[_0x3b23('0x53')](_0x39fa90[_0x3b23('0x3d')],_0x39fa90[_0x3b23('0x3f')]);_0x554992[_0x3b23('0x42')]=_[_0x3b23('0x53')](_0x39fa90['model'],qs['fields'](_0x3a0f93[_0x3b23('0x3f')]['fields']));_0x554992[_0x3b23('0x42')]=_0x554992['attributes'][_0x3b23('0x63')]?_0x554992[_0x3b23('0x42')]:_0x39fa90[_0x3b23('0x3d')];if(!_0x3a0f93[_0x3b23('0x3f')][_0x3b23('0x43')](_0x3b23('0x6d'))){_0x554992[_0x3b23('0x29')]=qs[_0x3b23('0x29')](_0x3a0f93[_0x3b23('0x3f')][_0x3b23('0x29')]);_0x554992[_0x3b23('0x2b')]=qs[_0x3b23('0x2b')](_0x3a0f93[_0x3b23('0x3f')][_0x3b23('0x2b')]);}_0x554992['order']=qs[_0x3b23('0x44')](_0x3a0f93[_0x3b23('0x3f')]['sort']);_0x554992[_0x3b23('0x45')]=qs[_0x3b23('0x41')](_[_0x3b23('0x46')](_0x3a0f93['query'],_0x39fa90[_0x3b23('0x41')]));_0x554992[_0x3b23('0x45')]['FaxAccountId']=_0x44ee4b['id'];if(_0x3a0f93[_0x3b23('0x3f')][_0x3b23('0x65')]){_0x554992[_0x3b23('0x45')]=_['merge'](_0x554992[_0x3b23('0x45')],{'$or':_[_0x3b23('0x3e')](_0x554992[_0x3b23('0x42')],function(_0x454800){var _0x35c1a7={};_0x35c1a7[_0x454800]={'$like':'%'+_0x3a0f93[_0x3b23('0x3f')][_0x3b23('0x65')]+'%'};return _0x35c1a7;})});}if(_0x3a0f93['query']['$gte']){var _0x55d162=_0x3a0f93['query']['$gte']['split'](',');var _0x4cc6fd={};_0x4cc6fd[_0x55d162[0x0]]={'$gte':moment(_0x55d162[0x1])[_0x3b23('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x554992[_0x3b23('0x45')]=_[_0x3b23('0x47')](_0x554992[_0x3b23('0x45')],_0x4cc6fd);}_0x554992=_['merge']({},_0x554992,_0x3a0f93[_0x3b23('0x49')]);return db[_0x3b23('0xa0')][_0x3b23('0x2a')]({'where':_0x554992[_0x3b23('0x45')]})[_0x3b23('0x1d')](function(_0x51b414){_0xe858e2[_0x3b23('0x2a')]=_0x51b414;if(_0x3a0f93[_0x3b23('0x3f')][_0x3b23('0x4b')]){_0x554992[_0x3b23('0x4c')]=[{'all':!![]}];}return db[_0x3b23('0xa0')][_0x3b23('0x4d')](_0x554992);})[_0x3b23('0x1d')](function(_0x26a5eb){_0xe858e2['rows']=_0x26a5eb;return _0xe858e2;});}})[_0x3b23('0x1d')](respondWithFilteredResult(_0x2af2cd,_0x554992))[_0x3b23('0x4f')](handleError(_0x2af2cd,null));};exports[_0x3b23('0x37')]=function(_0x2e3a4c,_0x1d2cbc,_0x288eb7){var _0x48c44c,_0x269018={},_0x2dce22;if(_0x2e3a4c[_0x3b23('0x56')]['to']){_0x2dce22=_0x2e3a4c[_0x3b23('0x56')]['to'][0x0];}return db['FaxAccount'][_0x3b23('0x5a')]({'where':{'id':_0x2e3a4c[_0x3b23('0x51')]['id']},'include':[{'model':db[_0x3b23('0xa2')],'as':_0x3b23('0xa3'),'include':[{'model':db[_0x3b23('0xa4')],'as':_0x3b23('0xa5'),'where':{'fax':_0x2dce22},'limit':0x1,'order':[[_0x3b23('0x9c'),_0x3b23('0xa6')]]}]}]})[_0x3b23('0x1d')](handleEntityNotFound(_0x1d2cbc,null))[_0x3b23('0x1d')](function(_0x379b62){_0x48c44c=_0x379b62;if(_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')]&&_0x2e3a4c['body'][_0x3b23('0xa7')][_0x3b23('0x63')]){for(var _0x19c490=0x0;_0x19c490<_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')]['length'];_0x19c490+=0x1){_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')][_0x19c490]={'filename':_0x2e3a4c[_0x3b23('0x56')]['attachments'][_0x19c490][_0x3b23('0x36')],'id':_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')][_0x19c490]['id'],'path':path['join'](config[_0x3b23('0xa8')],_0x3b23('0xa9'),_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')][_0x19c490][_0x3b23('0xaa')])};}}return respondWithRpcPromise(_0x3b23('0xab'),_0x3b23('0xab'),{'FaxAccountId':_[_0x3b23('0xac')](_0x2e3a4c['params']['id'])?undefined:_0x2e3a4c[_0x3b23('0x51')]['id'],'path':_[_0x3b23('0xac')](_0x2e3a4c['body'][_0x3b23('0xa7')][0x0]['path'])?undefined:_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')][0x0][_0x3b23('0x6')],'fax':_[_0x3b23('0xac')](_0x2e3a4c['body']['to'][0x0])?undefined:_0x2e3a4c['body']['to'][0x0]},client9002);})[_0x3b23('0x1d')](function(){if(_0x48c44c){if(_[_0x3b23('0xac')](_0x2e3a4c[_0x3b23('0x56')]['from'])){_0x2e3a4c['body'][_0x3b23('0xad')]=util['format'](_0x3b23('0xae'),_0x48c44c[_0x3b23('0x36')],_0x48c44c[_0x3b23('0xaf')]);}if(_0x48c44c[_0x3b23('0xa3')]){if(_0x48c44c['List']['Contacts']['length']){return _0x48c44c[_0x3b23('0xa3')]['Contacts'][0x0];}else{return db[_0x3b23('0xa4')][_0x3b23('0x55')](_['defaults'](_0x2e3a4c[_0x3b23('0x56')],{'firstName':_0x2e3a4c['body']['to'][0x0],'phone':_0x2e3a4c[_0x3b23('0x56')]['to'][0x0],'fax':_0x2e3a4c[_0x3b23('0x56')]['to'][0x0],'ListId':_0x48c44c[_0x3b23('0xb0')]}));}}else{throw new Error(_0x3b23('0xb1'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x3b23('0x1d')](function(_0x542aa0){if(_0x542aa0){return db[_0x3b23('0x72')][_0x3b23('0x5a')]({'where':{'ContactId':_0x542aa0['id'],'closed':![],'FaxAccountId':_0x48c44c['id']}})['then'](function(_0xa33684){if(_0xa33684){return[_0xa33684,![]];}return db[_0x3b23('0x72')][_0x3b23('0x55')]({'UserId':_0x2e3a4c[_0x3b23('0x58')]['id'],'ContactId':_0x542aa0['id'],'FaxAccountId':_0x48c44c['id'],'fax':_0x2e3a4c['body']['to'][0x0],'firstMsgDirection':_0x3b23('0xb2'),'Messages':[_[_0x3b23('0x47')](_0x2e3a4c[_0x3b23('0x56')],{'read':![],'body':_0x2e3a4c['body'][_0x3b23('0xa7')][0x0]['filename'],'FaxAccountId':_0x48c44c['id'],'UserId':_0x2e3a4c[_0x3b23('0x58')]['id'],'ContactId':_0x542aa0['id'],'AttachmentId':_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x3b23('0xa0')],'as':_0x3b23('0xb3')}]})[_0x3b23('0x1d')](function(_0x26953b){return[_0x26953b,!![]];});});}else{throw new Error(_0x3b23('0xb4'));}})['spread'](function(_0x406bb2,_0x491cfc){if(_0x491cfc){return _0x406bb2;}return db[_0x3b23('0xa0')][_0x3b23('0x55')]({'direction':_0x3b23('0xb2'),'read':![],'body':_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')][0x0][_0x3b23('0xb5')],'FaxAccountId':_0x48c44c['id'],'FaxInteractionId':_0x406bb2['id'],'UserId':_0x2e3a4c[_0x3b23('0x58')]['id'],'ContactId':_0x406bb2[_0x3b23('0xb6')],'AttachmentId':_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')][0x0]['id']})[_0x3b23('0x1d')](function(_0x34f4ad){_0x406bb2['dataValues']['Messages']=[];_0x406bb2[_0x3b23('0xb7')][_0x3b23('0xb3')]['push'](_0x34f4ad[_0x3b23('0xb7')]);return _0x406bb2;});})['then'](function(_0x325176){respondWithRpcPromise(_0x3b23('0xb8'),_0x3b23('0xb8'),{'FaxAccountId':_['isNil'](_0x2e3a4c[_0x3b23('0x51')]['id'])?undefined:_0x2e3a4c['params']['id'],'path':_[_0x3b23('0xac')](_0x2e3a4c[_0x3b23('0x56')]['attachments'][0x0][_0x3b23('0x6')])?undefined:_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')][0x0][_0x3b23('0x6')],'fax':_[_0x3b23('0xac')](_0x2e3a4c['body']['to'][0x0])?undefined:_0x2e3a4c[_0x3b23('0x56')]['to'][0x0],'AttachmentId':_0x2e3a4c[_0x3b23('0x56')][_0x3b23('0xa7')][0x0]['id']},client9002)[_0x3b23('0x1d')](function(_0x1849f4){logger[_0x3b23('0x23')](_0x3b23('0xb9'),_0x1849f4);})[_0x3b23('0x4f')](function(_0x3bf1e6){logger['info']('SendFaxRpc,\x20%s',_0x3bf1e6);});return _0x325176;})[_0x3b23('0x1d')](respondWithResult(_0x1d2cbc,null))[_0x3b23('0x4f')](handleError(_0x1d2cbc,null));};exports['addAgents']=function(_0x35e92d,_0x59aa53,_0x5c2772){return db['FaxAccount']['find']({'where':{'id':_0x35e92d[_0x3b23('0x51')]['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x59aa53,null))[_0x3b23('0x1d')](function(_0xc8c9f){if(_0xc8c9f){return _0xc8c9f[_0x3b23('0xba')](_0x35e92d[_0x3b23('0x56')][_0x3b23('0x68')],_[_0x3b23('0x70')](_0x35e92d['body'],['ids','id'])||{})[_0x3b23('0xbb')](function(_0x31cd5f){for(var _0x4fb2b4=0x0;_0x4fb2b4<_0x35e92d[_0x3b23('0x56')][_0x3b23('0x68')][_0x3b23('0x63')];_0x4fb2b4+=0x1){socket['emit'](_0x3b23('0xbc'),{'UserId':Number(_0x35e92d[_0x3b23('0x56')]['ids'][_0x4fb2b4]),'FaxAccountId':Number(_0x35e92d[_0x3b23('0x51')]['id'])});}return _0x31cd5f;});}})['then'](respondWithResult(_0x59aa53,null))[_0x3b23('0x4f')](handleError(_0x59aa53,null));};exports[_0x3b23('0xbd')]=function(_0x1d43a8,_0x4db0e7,_0x959fd4){return db[_0x3b23('0x4a')][_0x3b23('0x5a')]({'where':{'id':_0x1d43a8[_0x3b23('0x51')]['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x4db0e7,null))[_0x3b23('0x1d')](function(_0xeffac4){if(_0xeffac4){return _0xeffac4[_0x3b23('0xbd')](_0x1d43a8[_0x3b23('0x3f')][_0x3b23('0x68')])['then'](function(){if(_[_0x3b23('0xbe')](_0x1d43a8[_0x3b23('0x3f')][_0x3b23('0x68')])){for(var _0x55fa35=0x0;_0x55fa35<_0x1d43a8['query'][_0x3b23('0x68')][_0x3b23('0x63')];_0x55fa35+=0x1){socket[_0x3b23('0xbf')](_0x3b23('0xc0'),{'UserId':Number(_0x1d43a8[_0x3b23('0x3f')][_0x3b23('0x68')][_0x55fa35]),'FaxAccountId':Number(_0x1d43a8['params']['id'])});}}else{socket[_0x3b23('0xbf')](_0x3b23('0xc0'),{'UserId':Number(_0x1d43a8['query'][_0x3b23('0x68')]),'FaxAccountId':Number(_0x1d43a8['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4db0e7,null))[_0x3b23('0x4f')](handleError(_0x4db0e7,null));};exports[_0x3b23('0xc1')]=function(_0x153456,_0x4a3314,_0xf64102){var _0x49b48f={};var _0x32ad5c={};var _0x424a25;var _0x148f76;return db['FaxAccount']['findOne']({'where':{'id':_0x153456[_0x3b23('0x51')]['id']}})[_0x3b23('0x1d')](handleEntityNotFound(_0x4a3314,null))['then'](function(_0x1d9868){if(_0x1d9868){_0x424a25=_0x1d9868;_0x32ad5c[_0x3b23('0x3d')]=_['keys'](db[_0x3b23('0x74')][_0x3b23('0x62')]);_0x32ad5c[_0x3b23('0x3f')]=_['keys'](_0x153456['query']);_0x32ad5c[_0x3b23('0x41')]=_[_0x3b23('0x53')](_0x32ad5c[_0x3b23('0x3d')],_0x32ad5c['query']);_0x49b48f[_0x3b23('0x42')]=_['intersection'](_0x32ad5c[_0x3b23('0x3d')],qs['fields'](_0x153456[_0x3b23('0x3f')][_0x3b23('0x54')]));_0x49b48f[_0x3b23('0x42')]=_0x49b48f[_0x3b23('0x42')][_0x3b23('0x63')]?_0x49b48f[_0x3b23('0x42')]:_0x32ad5c[_0x3b23('0x3d')];_0x49b48f[_0x3b23('0x64')]=qs['sort'](_0x153456[_0x3b23('0x3f')][_0x3b23('0x44')]);_0x49b48f['where']=qs[_0x3b23('0x41')](_[_0x3b23('0x46')](_0x153456[_0x3b23('0x3f')],_0x32ad5c['filters']));if(_0x153456['query'][_0x3b23('0x65')]){_0x49b48f[_0x3b23('0x45')]=_['merge'](_0x49b48f[_0x3b23('0x45')],{'$or':_[_0x3b23('0x3e')](_0x49b48f['attributes'],function(_0x568b82){var _0x47f958={};_0x47f958[_0x568b82]={'$like':'%'+_0x153456[_0x3b23('0x3f')][_0x3b23('0x65')]+'%'};return _0x47f958;})});}_0x49b48f=_['merge']({},_0x49b48f,_0x153456['options']);return _0x424a25[_0x3b23('0xc1')](_0x49b48f);}})[_0x3b23('0x1d')](function(_0x3b0352){if(_0x3b0352){_0x148f76=_0x3b0352[_0x3b23('0x63')];if(!_0x153456[_0x3b23('0x3f')][_0x3b23('0x43')]('nolimit')){_0x49b48f[_0x3b23('0x29')]=qs[_0x3b23('0x29')](_0x153456[_0x3b23('0x3f')][_0x3b23('0x29')]);_0x49b48f[_0x3b23('0x2b')]=qs[_0x3b23('0x2b')](_0x153456['query'][_0x3b23('0x2b')]);}return _0x424a25['getAgents'](_0x49b48f);}})['then'](function(_0x1ba770){if(_0x1ba770){return _0x1ba770?{'count':_0x148f76,'rows':_0x1ba770}:null;}})[_0x3b23('0x1d')](respondWithResult(_0x4a3314,null))['catch'](handleError(_0x4a3314,null));}; \ No newline at end of file +var _0xe65b=['removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','hasOwnProperty','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','context','exten','localstationid','system','Fax\x20Extension','priority','appdata','Answer','push','CDR(type)=inbound-fax','Set','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','user','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','userFaxAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','end','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','name','keys','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','pick','filters','VIRTUAL','merge','include','findAll','rows','params','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','FaxAccountId','Disposition','findOne','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xe65b,0x124));var _0xbe65=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe65b[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe65('0x0'));var zipdir=require(_0xbe65('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe65('0x2'));var moment=require(_0xbe65('0x3'));var BPromise=require(_0xbe65('0x4'));var Mustache=require(_0xbe65('0x5'));var util=require(_0xbe65('0x6'));var path=require(_0xbe65('0x7'));var sox=require(_0xbe65('0x8'));var csv=require(_0xbe65('0x9'));var ejs=require(_0xbe65('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe65('0xb'));var squel=require(_0xbe65('0xc'));var crypto=require(_0xbe65('0xd'));var jsforce=require(_0xbe65('0xe'));var deskjs=require(_0xbe65('0xf'));var toCsv=require(_0xbe65('0x9'));var querystring=require(_0xbe65('0x10'));var Papa=require(_0xbe65('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe65('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbe65('0x13'));var utils=require(_0xbe65('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbe65('0x15'));var db=require(_0xbe65('0x16'))['db'];config[_0xbe65('0x17')]=_[_0xbe65('0x18')](config[_0xbe65('0x17')],{'host':_0xbe65('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe65('0x17')]));require(_0xbe65('0x1a'))[_0xbe65('0x1b')](socket);var jayson=require(_0xbe65('0x1c'));var client=jayson['client'][_0xbe65('0x1d')]({'port':0x232c});var client9002=jayson[_0xbe65('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e1545,_0x143bcd,_0x57724d,_0x1436a7){return new BPromise(function(_0x1b9561,_0x2d64a2){var _0x191654=_0x1436a7||client;return _0x191654[_0xbe65('0x1f')](_0x3e1545,_0x57724d)[_0xbe65('0x20')](function(_0x4d49bf){logger[_0xbe65('0x21')](_0xbe65('0x22'),_0x143bcd,'request\x20sent');logger[_0xbe65('0x23')](_0xbe65('0x24'),_0x143bcd,_0xbe65('0x25'),JSON['stringify'](_0x4d49bf));if(_0x4d49bf[_0xbe65('0x26')]){if(_0x4d49bf[_0xbe65('0x26')][_0xbe65('0x27')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x143bcd,_0x4d49bf[_0xbe65('0x26')][_0xbe65('0x28')]);return _0x2d64a2(_0x4d49bf[_0xbe65('0x26')][_0xbe65('0x28')]);}logger['error'](_0xbe65('0x22'),_0x143bcd,_0x4d49bf[_0xbe65('0x26')][_0xbe65('0x28')]);return _0x1b9561(_0x4d49bf[_0xbe65('0x26')][_0xbe65('0x28')]);}else{logger[_0xbe65('0x21')](_0xbe65('0x22'),_0x143bcd,_0xbe65('0x25'));_0x1b9561(_0x4d49bf[_0xbe65('0x29')][_0xbe65('0x28')]);}})[_0xbe65('0x2a')](function(_0x411a15){logger[_0xbe65('0x26')](_0xbe65('0x22'),_0x143bcd,_0x411a15);_0x2d64a2(_0x411a15);});});}function respondWithStatusCode(_0x37679c,_0x7fc172){_0x7fc172=_0x7fc172||0xcc;return function(_0x50c181){if(_0x50c181){return _0x37679c[_0xbe65('0x2b')](_0x7fc172);}return _0x37679c[_0xbe65('0x2c')](_0x7fc172)['end']();};}function respondWithResult(_0x4d361e,_0x5f2eed){_0x5f2eed=_0x5f2eed||0xc8;return function(_0x2a7206){if(_0x2a7206){return _0x4d361e[_0xbe65('0x2c')](_0x5f2eed)['json'](_0x2a7206);}};}function respondWithFilteredResult(_0x4d580d,_0x1b9bb1){return function(_0x577230){if(_0x577230){var _0x2d90f8=typeof _0x1b9bb1[_0xbe65('0x2d')]===_0xbe65('0x2e')&&typeof _0x1b9bb1[_0xbe65('0x2f')]===_0xbe65('0x2e');var _0x555159=_0x577230[_0xbe65('0x30')];var _0x226a95=_0x2d90f8?0x0:_0x1b9bb1[_0xbe65('0x2d')];var _0x1d3221=_0x2d90f8?_0x577230[_0xbe65('0x30')]:_0x1b9bb1[_0xbe65('0x2d')]+_0x1b9bb1['limit'];var _0x23fb8e;if(_0x1d3221>=_0x555159){_0x1d3221=_0x555159;_0x23fb8e=0xc8;}else{_0x23fb8e=0xce;}_0x4d580d[_0xbe65('0x2c')](_0x23fb8e);return _0x4d580d['set'](_0xbe65('0x31'),_0x226a95+'-'+_0x1d3221+'/'+_0x555159)[_0xbe65('0x32')](_0x577230);}return null;};}function patchUpdates(_0x3560bf){return function(_0x2731ae){try{jsonpatch[_0xbe65('0x33')](_0x2731ae,_0x3560bf,!![]);}catch(_0x27b550){return BPromise['reject'](_0x27b550);}return _0x2731ae[_0xbe65('0x34')]();};}function saveUpdates(_0x2fd3c8,_0x5507b2){return function(_0x457c30){if(_0x457c30){return _0x457c30[_0xbe65('0x35')](_0x2fd3c8)['then'](function(_0xb516fd){return _0xb516fd;});}return null;};}function removeEntity(_0x581a04,_0x1d59c3){return function(_0x9820ff){if(_0x9820ff){return _0x9820ff[_0xbe65('0x36')]()[_0xbe65('0x20')](function(){var _0x28e638=_0x9820ff[_0xbe65('0x37')]({'plain':!![]});var _0x47c4a5=_0xbe65('0x38');return db[_0xbe65('0x39')]['destroy']({'where':{'type':_0x47c4a5,'resourceId':_0x28e638['id']}})[_0xbe65('0x20')](function(){return _0x9820ff;});})['then'](function(){_0x581a04[_0xbe65('0x2c')](0xcc)[_0xbe65('0x3a')]();});}};}function handleEntityNotFound(_0x331db8,_0x25a651){return function(_0x4bc695){if(!_0x4bc695){_0x331db8[_0xbe65('0x2b')](0x194);}return _0x4bc695;};}function handleError(_0x3999ae,_0x3b97f7){_0x3b97f7=_0x3b97f7||0x1f4;return function(_0x114e81){logger['error'](_0x114e81['stack']);if(_0x114e81['name']){delete _0x114e81['name'];}_0x3999ae[_0xbe65('0x2c')](_0x3b97f7)[_0xbe65('0x3b')](_0x114e81);};}exports[_0xbe65('0x3c')]=function(_0x25476f,_0x9041ab){var _0x14aafc={'include':[{'model':db['Pause'],'as':_0xbe65('0x3d')}]},_0x4b38f3={},_0x475a4b={'count':0x0,'rows':[]};var _0x3030d3=_[_0xbe65('0x3e')](db[_0xbe65('0x3f')][_0xbe65('0x40')],function(_0x32ec76){return{'name':_0x32ec76[_0xbe65('0x41')],'type':_0x32ec76[_0xbe65('0x42')][_0xbe65('0x43')]};});_0x4b38f3['model']=_[_0xbe65('0x3e')](_0x3030d3,_0xbe65('0x44'));_0x4b38f3['query']=_[_0xbe65('0x45')](_0x25476f['query']);_0x4b38f3['filters']=_[_0xbe65('0x46')](_0x4b38f3[_0xbe65('0x47')],_0x4b38f3[_0xbe65('0x48')]);_0x14aafc[_0xbe65('0x49')]=_['intersection'](_0x4b38f3['model'],qs[_0xbe65('0x4a')](_0x25476f['query'][_0xbe65('0x4a')]));_0x14aafc[_0xbe65('0x49')]=_0x14aafc[_0xbe65('0x49')][_0xbe65('0x4b')]?_0x14aafc[_0xbe65('0x49')]:_0x4b38f3[_0xbe65('0x47')];if(!_0x25476f[_0xbe65('0x48')]['hasOwnProperty'](_0xbe65('0x4c'))){_0x14aafc[_0xbe65('0x2f')]=qs[_0xbe65('0x2f')](_0x25476f[_0xbe65('0x48')][_0xbe65('0x2f')]);_0x14aafc[_0xbe65('0x2d')]=qs['offset'](_0x25476f[_0xbe65('0x48')]['offset']);}_0x14aafc[_0xbe65('0x4d')]=qs[_0xbe65('0x4e')](_0x25476f[_0xbe65('0x48')][_0xbe65('0x4e')]);_0x14aafc[_0xbe65('0x4f')]=qs['filters'](_[_0xbe65('0x50')](_0x25476f[_0xbe65('0x48')],_0x4b38f3[_0xbe65('0x51')]),_0x3030d3);if(_0x25476f[_0xbe65('0x48')]['filter']){_0x14aafc[_0xbe65('0x4f')]=_['merge'](_0x14aafc[_0xbe65('0x4f')],{'$or':_[_0xbe65('0x3e')](_0x3030d3,function(_0x470135){if(_0x470135[_0xbe65('0x42')]!==_0xbe65('0x52')){var _0x3aefc5={};_0x3aefc5[_0x470135[_0xbe65('0x44')]]={'$like':'%'+_0x25476f[_0xbe65('0x48')]['filter']+'%'};return _0x3aefc5;}})});}_0x14aafc=_[_0xbe65('0x53')]({},_0x14aafc,_0x25476f['options']);var _0x7b98b1={'where':_0x14aafc[_0xbe65('0x4f')]};return db[_0xbe65('0x3f')]['count'](_0x7b98b1)['then'](function(_0x2fc57a){_0x475a4b['count']=_0x2fc57a;if(_0x25476f['query']['includeAll']){_0x14aafc[_0xbe65('0x54')]=[{'all':!![]}];}return db[_0xbe65('0x3f')][_0xbe65('0x55')](_0x14aafc);})[_0xbe65('0x20')](function(_0x14cf30){_0x475a4b[_0xbe65('0x56')]=_0x14cf30;return _0x475a4b;})[_0xbe65('0x20')](respondWithFilteredResult(_0x9041ab,_0x14aafc))[_0xbe65('0x2a')](handleError(_0x9041ab,null));};exports['show']=function(_0x2a4d2f,_0x5a9fab){var _0x196b7c={'raw':![],'where':{'id':_0x2a4d2f[_0xbe65('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xbe65('0x3d')}]},_0x319600={};_0x319600[_0xbe65('0x47')]=_[_0xbe65('0x45')](db[_0xbe65('0x3f')]['rawAttributes']);_0x319600[_0xbe65('0x48')]=_[_0xbe65('0x45')](_0x2a4d2f['query']);_0x319600['filters']=_[_0xbe65('0x46')](_0x319600[_0xbe65('0x47')],_0x319600[_0xbe65('0x48')]);_0x196b7c[_0xbe65('0x49')]=_[_0xbe65('0x46')](_0x319600[_0xbe65('0x47')],qs[_0xbe65('0x4a')](_0x2a4d2f[_0xbe65('0x48')][_0xbe65('0x4a')]));_0x196b7c['attributes']=_0x196b7c['attributes'][_0xbe65('0x4b')]?_0x196b7c['attributes']:_0x319600[_0xbe65('0x47')];if(_0x2a4d2f[_0xbe65('0x48')][_0xbe65('0x58')]){_0x196b7c['include']=[{'all':!![]}];}_0x196b7c=_[_0xbe65('0x53')]({},_0x196b7c,_0x2a4d2f[_0xbe65('0x59')]);return db[_0xbe65('0x3f')][_0xbe65('0x5a')](_0x196b7c)[_0xbe65('0x20')](handleEntityNotFound(_0x5a9fab,null))[_0xbe65('0x20')](respondWithResult(_0x5a9fab,null))[_0xbe65('0x2a')](handleError(_0x5a9fab,null));};exports[_0xbe65('0x5b')]=function(_0x1554a7,_0x1da3a4){return db[_0xbe65('0x3f')]['create'](_0x1554a7['body'],{})[_0xbe65('0x20')](function(_0x498f30){var _0xcd25bc=_0x1554a7['user'][_0xbe65('0x37')]({'plain':!![]});if(!_0xcd25bc)throw new Error(_0xbe65('0x5c'));if(_0xcd25bc[_0xbe65('0x5d')]==='user'){var _0x6c79bc=_0x498f30['get']({'plain':!![]});var _0x47aaf7='FaxAccounts';return db[_0xbe65('0x5e')][_0xbe65('0x5a')]({'where':{'name':_0x47aaf7,'userProfileId':_0xcd25bc['userProfileId']},'raw':!![]})[_0xbe65('0x20')](function(_0x2e2acc){if(_0x2e2acc&&_0x2e2acc['autoAssociation']===0x0){return db[_0xbe65('0x39')][_0xbe65('0x5b')]({'name':_0x6c79bc['name'],'resourceId':_0x6c79bc['id'],'type':_0x2e2acc[_0xbe65('0x44')],'sectionId':_0x2e2acc['id']},{})[_0xbe65('0x20')](function(){return _0x498f30;});}else{return _0x498f30;}})[_0xbe65('0x2a')](function(_0x1c98a6){logger['error'](_0xbe65('0x5f'),_0x1c98a6);throw _0x1c98a6;});}return _0x498f30;})[_0xbe65('0x20')](respondWithResult(_0x1da3a4,0xc9))[_0xbe65('0x2a')](handleError(_0x1da3a4,null));};exports[_0xbe65('0x35')]=function(_0x380438,_0x245805){if(_0x380438[_0xbe65('0x60')]['id']){delete _0x380438[_0xbe65('0x60')]['id'];}return db[_0xbe65('0x3f')][_0xbe65('0x5a')]({'where':{'id':_0x380438['params']['id']},'include':[{'model':db[_0xbe65('0x61')],'as':_0xbe65('0x3d')}]})[_0xbe65('0x20')](handleEntityNotFound(_0x245805,null))[_0xbe65('0x20')](saveUpdates(_0x380438['body'],null))[_0xbe65('0x20')](respondWithResult(_0x245805,null))['catch'](handleError(_0x245805,null));};exports[_0xbe65('0x36')]=function(_0x471208,_0x522ea6){return db[_0xbe65('0x3f')][_0xbe65('0x5a')]({'where':{'id':_0x471208[_0xbe65('0x57')]['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x522ea6,null))['then'](removeEntity(_0x522ea6,null))[_0xbe65('0x2a')](handleError(_0x522ea6,null));};exports[_0xbe65('0x62')]=function(_0x10928e,_0x5e036e){return db[_0xbe65('0x3f')][_0xbe65('0x62')]()[_0xbe65('0x20')](respondWithResult(_0x5e036e,null))['catch'](handleError(_0x5e036e,null));};exports['addDisposition']=function(_0x409322,_0x5621b8,_0x4fbc9b){if(_0x409322[_0xbe65('0x60')]['id']){delete _0x409322['body']['id'];}return db['FaxAccount'][_0xbe65('0x5a')]({'where':{'id':_0x409322[_0xbe65('0x57')]['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x5621b8,null))['then'](function(_0x47575a){if(_0x47575a){_0x409322[_0xbe65('0x60')][_0xbe65('0x63')]=_0x47575a['id'];return db[_0xbe65('0x64')][_0xbe65('0x5b')](_0x409322['body']);}})[_0xbe65('0x20')](respondWithResult(_0x5621b8,null))['catch'](handleError(_0x5621b8,null));};exports['getDispositions']=function(_0x7c4521,_0x2043bc,_0x361938){var _0x283d90={'raw':![],'where':{}};var _0x23e3e4={};var _0x162b6f={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbe65('0x65')]({'where':{'id':_0x7c4521['params']['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x2043bc,null))[_0xbe65('0x20')](function(_0x5655e6){if(_0x5655e6){_0x23e3e4[_0xbe65('0x47')]=_[_0xbe65('0x45')](db[_0xbe65('0x64')][_0xbe65('0x40')]);_0x23e3e4[_0xbe65('0x48')]=_[_0xbe65('0x45')](_0x7c4521[_0xbe65('0x48')]);_0x23e3e4[_0xbe65('0x51')]=_['intersection'](_0x23e3e4[_0xbe65('0x47')],_0x23e3e4[_0xbe65('0x48')]);_0x283d90[_0xbe65('0x49')]=_[_0xbe65('0x46')](_0x23e3e4['model'],qs[_0xbe65('0x4a')](_0x7c4521[_0xbe65('0x48')][_0xbe65('0x4a')]));_0x283d90['attributes']=_0x283d90['attributes'][_0xbe65('0x4b')]?_0x283d90['attributes']:_0x23e3e4['model'];if(!_0x7c4521[_0xbe65('0x48')]['hasOwnProperty'](_0xbe65('0x4c'))){_0x283d90[_0xbe65('0x2f')]=qs[_0xbe65('0x2f')](_0x7c4521[_0xbe65('0x48')][_0xbe65('0x2f')]);_0x283d90[_0xbe65('0x2d')]=qs[_0xbe65('0x2d')](_0x7c4521[_0xbe65('0x48')]['offset']);}_0x283d90[_0xbe65('0x4d')]=qs[_0xbe65('0x4e')](_0x7c4521[_0xbe65('0x48')][_0xbe65('0x4e')]);_0x283d90['where']=qs['filters'](_[_0xbe65('0x50')](_0x7c4521[_0xbe65('0x48')],_0x23e3e4[_0xbe65('0x51')]));_0x283d90['where'][_0xbe65('0x63')]=_0x5655e6['id'];if(_0x7c4521['query'][_0xbe65('0x66')]){_0x283d90[_0xbe65('0x4f')]=_[_0xbe65('0x53')](_0x283d90['where'],{'$or':_[_0xbe65('0x3e')](_0x283d90[_0xbe65('0x49')],function(_0x3c873a){var _0x5721c3={};_0x5721c3[_0x3c873a]={'$like':'%'+_0x7c4521[_0xbe65('0x48')]['filter']+'%'};return _0x5721c3;})});}_0x283d90=_[_0xbe65('0x53')]({},_0x283d90,_0x7c4521['options']);return db[_0xbe65('0x64')][_0xbe65('0x30')]({'where':_0x283d90[_0xbe65('0x4f')]})[_0xbe65('0x20')](function(_0x2881d2){_0x162b6f[_0xbe65('0x30')]=_0x2881d2;if(_0x7c4521[_0xbe65('0x48')][_0xbe65('0x58')]){_0x283d90['include']=[{'all':!![]}];}return db[_0xbe65('0x64')]['findAll'](_0x283d90);})['then'](function(_0x5defa4){_0x162b6f[_0xbe65('0x56')]=_0x5defa4;return _0x162b6f;});}})[_0xbe65('0x20')](respondWithFilteredResult(_0x2043bc,_0x283d90))[_0xbe65('0x2a')](handleError(_0x2043bc,null));};exports[_0xbe65('0x67')]=function(_0x219a6d,_0x1031d5,_0x205e2a){return db[_0xbe65('0x3f')][_0xbe65('0x5a')]({'where':{'id':_0x219a6d['params']['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x1031d5,null))[_0xbe65('0x20')](function(_0x59c9d4){if(_0x59c9d4){return _0x59c9d4[_0xbe65('0x67')](_0x219a6d['query'][_0xbe65('0x68')]);}})['then'](respondWithStatusCode(_0x1031d5,null))[_0xbe65('0x2a')](handleError(_0x1031d5,null));};exports[_0xbe65('0x69')]=function(_0x55a375,_0x3940b3,_0x2a479f){if(_0x55a375['body']['id']){delete _0x55a375[_0xbe65('0x60')]['id'];}return db[_0xbe65('0x3f')][_0xbe65('0x5a')]({'where':{'id':_0x55a375['params']['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x3940b3,null))[_0xbe65('0x20')](function(_0x9acf0f){if(_0x9acf0f){_0x55a375['body']['FaxAccountId']=_0x9acf0f['id'];return db[_0xbe65('0x6a')][_0xbe65('0x5b')](_0x55a375[_0xbe65('0x60')]);}})[_0xbe65('0x20')](respondWithResult(_0x3940b3,null))['catch'](handleError(_0x3940b3,null));};exports[_0xbe65('0x6b')]=function(_0x43ca2c,_0x3028c8,_0x5212ec){var _0x785b5={'raw':![],'where':{}};var _0x40b1f2={};var _0x12d7f7={'count':0x0,'rows':[]};return db[_0xbe65('0x3f')][_0xbe65('0x65')]({'where':{'id':_0x43ca2c[_0xbe65('0x57')]['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x3028c8,null))[_0xbe65('0x20')](function(_0x5a7a75){if(_0x5a7a75){_0x40b1f2[_0xbe65('0x47')]=_[_0xbe65('0x45')](db[_0xbe65('0x6a')][_0xbe65('0x40')]);_0x40b1f2[_0xbe65('0x48')]=_['keys'](_0x43ca2c[_0xbe65('0x48')]);_0x40b1f2[_0xbe65('0x51')]=_[_0xbe65('0x46')](_0x40b1f2[_0xbe65('0x47')],_0x40b1f2[_0xbe65('0x48')]);_0x785b5['attributes']=_[_0xbe65('0x46')](_0x40b1f2[_0xbe65('0x47')],qs[_0xbe65('0x4a')](_0x43ca2c['query'][_0xbe65('0x4a')]));_0x785b5[_0xbe65('0x49')]=_0x785b5[_0xbe65('0x49')][_0xbe65('0x4b')]?_0x785b5['attributes']:_0x40b1f2[_0xbe65('0x47')];if(!_0x43ca2c[_0xbe65('0x48')]['hasOwnProperty'](_0xbe65('0x4c'))){_0x785b5[_0xbe65('0x2f')]=qs[_0xbe65('0x2f')](_0x43ca2c[_0xbe65('0x48')]['limit']);_0x785b5[_0xbe65('0x2d')]=qs[_0xbe65('0x2d')](_0x43ca2c[_0xbe65('0x48')][_0xbe65('0x2d')]);}_0x785b5[_0xbe65('0x4d')]=qs[_0xbe65('0x4e')](_0x43ca2c['query'][_0xbe65('0x4e')]);_0x785b5[_0xbe65('0x4f')]=qs[_0xbe65('0x51')](_['pick'](_0x43ca2c[_0xbe65('0x48')],_0x40b1f2['filters']));_0x785b5['where']['FaxAccountId']=_0x5a7a75['id'];if(_0x43ca2c[_0xbe65('0x48')][_0xbe65('0x66')]){_0x785b5['where']=_[_0xbe65('0x53')](_0x785b5['where'],{'$or':_['map'](_0x785b5[_0xbe65('0x49')],function(_0x17bb8a){var _0x9a0dac={};_0x9a0dac[_0x17bb8a]={'$like':'%'+_0x43ca2c[_0xbe65('0x48')][_0xbe65('0x66')]+'%'};return _0x9a0dac;})});}_0x785b5=_['merge']({},_0x785b5,_0x43ca2c[_0xbe65('0x59')]);return db['CannedAnswer'][_0xbe65('0x30')]({'where':_0x785b5['where']})['then'](function(_0x19b645){_0x12d7f7[_0xbe65('0x30')]=_0x19b645;if(_0x43ca2c['query'][_0xbe65('0x58')]){_0x785b5[_0xbe65('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x785b5);})[_0xbe65('0x20')](function(_0x2a3b70){_0x12d7f7[_0xbe65('0x56')]=_0x2a3b70;return _0x12d7f7;});}})[_0xbe65('0x20')](respondWithFilteredResult(_0x3028c8,_0x785b5))[_0xbe65('0x2a')](handleError(_0x3028c8,null));};exports[_0xbe65('0x6c')]=function(_0x11bffd,_0x36fcf1,_0x4a1433){return db['FaxAccount'][_0xbe65('0x5a')]({'where':{'id':_0x11bffd[_0xbe65('0x57')]['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x36fcf1,null))['then'](function(_0x3ac07f){if(_0x3ac07f){return _0x3ac07f[_0xbe65('0x6c')](_0x11bffd[_0xbe65('0x48')][_0xbe65('0x68')]);}})[_0xbe65('0x20')](respondWithStatusCode(_0x36fcf1,null))[_0xbe65('0x2a')](handleError(_0x36fcf1,null));};exports[_0xbe65('0x6d')]=function(_0x55c59e,_0x4382db,_0xeb6058){return db[_0xbe65('0x6e')][_0xbe65('0x5a')]({'where':{'id':_0x55c59e['params']['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x4382db,null))[_0xbe65('0x20')](function(_0x12c4a8){if(_0x12c4a8){return _0x12c4a8[_0xbe65('0x6d')](_0x55c59e['body'][_0xbe65('0x68')],_[_0xbe65('0x6f')](_0x55c59e[_0xbe65('0x60')],['ids','id'])||{});}})['then'](respondWithResult(_0x4382db,null))[_0xbe65('0x2a')](handleError(_0x4382db,null));};exports[_0xbe65('0x70')]=function(_0x4b4573,_0x591ffd,_0x1d6450){var _0x5332b9={'raw':![],'where':{}};var _0x3157d9={};var _0x5b39ea={'count':0x0,'rows':[]};return db[_0xbe65('0x3f')]['findOne']({'where':{'id':_0x4b4573[_0xbe65('0x57')]['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x591ffd,null))['then'](function(_0x8c1265){if(_0x8c1265){_0x3157d9[_0xbe65('0x47')]=_['keys'](db[_0xbe65('0x6e')]['rawAttributes']);_0x3157d9[_0xbe65('0x48')]=_[_0xbe65('0x45')](_0x4b4573[_0xbe65('0x48')]);_0x3157d9[_0xbe65('0x51')]=_[_0xbe65('0x46')](_0x3157d9['model'],_0x3157d9['query']);_0x5332b9['attributes']=_[_0xbe65('0x46')](_0x3157d9[_0xbe65('0x47')],qs[_0xbe65('0x4a')](_0x4b4573[_0xbe65('0x48')][_0xbe65('0x4a')]));_0x5332b9[_0xbe65('0x49')]=_0x5332b9[_0xbe65('0x49')][_0xbe65('0x4b')]?_0x5332b9[_0xbe65('0x49')]:_0x3157d9[_0xbe65('0x47')];if(!_0x4b4573['query'][_0xbe65('0x71')](_0xbe65('0x4c'))){_0x5332b9['limit']=qs[_0xbe65('0x2f')](_0x4b4573[_0xbe65('0x48')][_0xbe65('0x2f')]);_0x5332b9['offset']=qs[_0xbe65('0x2d')](_0x4b4573[_0xbe65('0x48')][_0xbe65('0x2d')]);}_0x5332b9[_0xbe65('0x4d')]=qs[_0xbe65('0x4e')](_0x4b4573[_0xbe65('0x48')]['sort']);_0x5332b9[_0xbe65('0x4f')]=qs[_0xbe65('0x51')](_['pick'](_0x4b4573[_0xbe65('0x48')],_0x3157d9[_0xbe65('0x51')]));_0x5332b9[_0xbe65('0x4f')][_0xbe65('0x63')]=_0x8c1265['id'];if(_0x4b4573['query']['filter']){_0x5332b9[_0xbe65('0x4f')]=_[_0xbe65('0x53')](_0x5332b9['where'],{'$or':_[_0xbe65('0x3e')](_0x5332b9[_0xbe65('0x49')],function(_0x1c9df5){var _0x5d5230={};_0x5d5230[_0x1c9df5]={'$like':'%'+_0x4b4573[_0xbe65('0x48')][_0xbe65('0x66')]+'%'};return _0x5d5230;})});}_0x5332b9=_[_0xbe65('0x53')]({},_0x5332b9,_0x4b4573['options']);return db[_0xbe65('0x6e')][_0xbe65('0x30')]({'where':_0x5332b9[_0xbe65('0x4f')]})[_0xbe65('0x20')](function(_0x562ea2){_0x5b39ea[_0xbe65('0x30')]=_0x562ea2;if(_0x4b4573[_0xbe65('0x48')][_0xbe65('0x58')]){_0x5332b9['include']=[{'model':db[_0xbe65('0x72')],'as':_0xbe65('0x73'),'required':![]},{'model':db[_0xbe65('0x74')],'as':_0xbe65('0x75'),'attributes':[_0xbe65('0x44'),_0xbe65('0x76'),'internal'],'required':![]},{'model':db[_0xbe65('0x77')],'as':_0xbe65('0x78'),'attributes':['id','name',_0xbe65('0x79')],'where':_0x4b4573['query'][_0xbe65('0x7a')]?{'id':_0x4b4573[_0xbe65('0x48')]['tag']}:undefined,'required':_0x4b4573['query'][_0xbe65('0x7a')]?!![]:![]}];}return db[_0xbe65('0x6e')][_0xbe65('0x55')](_0x5332b9);})[_0xbe65('0x20')](function(_0x3c5a4c){_0x5b39ea[_0xbe65('0x56')]=_0x3c5a4c;return _0x5b39ea;});}})['then'](respondWithFilteredResult(_0x591ffd,_0x5332b9))['catch'](handleError(_0x591ffd,null));};exports[_0xbe65('0x7b')]=function(_0x4d9071,_0x210f4d){var _0x299792=_0x4d9071[_0xbe65('0x57')]['id'];var _0x543b70=_0x4d9071[_0xbe65('0x60')];var _0x2a5239=0xc8;var _0x20ab7e=null;return db['sequelize'][_0xbe65('0x7c')]({'isolationLevel':db[_0xbe65('0x7d')][_0xbe65('0x7e')][_0xbe65('0x7f')][_0xbe65('0x80')]},function(_0x1f40c3){return db['FaxAccount'][_0xbe65('0x65')]({'where':{'id':_0x299792},'transaction':_0x1f40c3})[_0xbe65('0x20')](function(_0x5797f1){if(_0x5797f1){return db[_0xbe65('0x81')]['destroy']({'where':{'FaxAccountId':_0x299792},'transaction':_0x1f40c3})[_0xbe65('0x20')](function(){var _0x5ee52f=_[_0xbe65('0x3e')](_0x543b70,function(_0x15bb7b){_0x15bb7b['FaxAccountId']=_0x299792;return _0x15bb7b;});return db[_0xbe65('0x81')][_0xbe65('0x82')](_0x5ee52f,{'transaction':_0x1f40c3});});}else{_0x2a5239=0x194;_0x20ab7e=[];}});})[_0xbe65('0x20')](function(){if(_0x2a5239!==0x194){return db[_0xbe65('0x81')][_0xbe65('0x83')]({'where':{'FaxAccountId':_0x299792},'order':'priority'})['then'](function(_0x1143f8){_0x20ab7e=_0x1143f8;});}})[_0xbe65('0x2a')](function(_0x178b1d){_0x2a5239=0x1f4;logger[_0xbe65('0x26')](_0x178b1d[_0xbe65('0x84')]);if(_0x178b1d['name']){delete _0x178b1d['name'];}_0x20ab7e=_0x178b1d;})[_0xbe65('0x85')](function(){if(_0x20ab7e===null){_0x210f4d['sendStatus'](_0x2a5239);}else{if(_0x2a5239===0x1f4){_0x210f4d[_0xbe65('0x2c')](_0x2a5239)[_0xbe65('0x3b')](_0x20ab7e);}else{_0x210f4d[_0xbe65('0x2c')](_0x2a5239)[_0xbe65('0x32')](_0x20ab7e);}}});};exports[_0xbe65('0x86')]=function(_0x474bc8,_0x3d99d4,_0x8a229c){var _0x34026a={};var _0x223e9a={};var _0x117474;var _0x8d7cd4;return db['FaxAccount'][_0xbe65('0x65')]({'where':{'id':_0x474bc8['params']['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x3d99d4,null))[_0xbe65('0x20')](function(_0x2e59ed){if(_0x2e59ed){_0x117474=_0x2e59ed;_0x223e9a[_0xbe65('0x47')]=_[_0xbe65('0x45')](db['FaxApplication'][_0xbe65('0x40')]);_0x223e9a['query']=_[_0xbe65('0x45')](_0x474bc8['query']);_0x223e9a[_0xbe65('0x51')]=_[_0xbe65('0x46')](_0x223e9a[_0xbe65('0x47')],_0x223e9a[_0xbe65('0x48')]);_0x34026a['attributes']=_[_0xbe65('0x46')](_0x223e9a[_0xbe65('0x47')],qs['fields'](_0x474bc8[_0xbe65('0x48')]['fields']));_0x34026a[_0xbe65('0x49')]=_0x34026a[_0xbe65('0x49')][_0xbe65('0x4b')]?_0x34026a[_0xbe65('0x49')]:_0x223e9a[_0xbe65('0x47')];_0x34026a[_0xbe65('0x4d')]=qs[_0xbe65('0x4e')](_0x474bc8[_0xbe65('0x48')][_0xbe65('0x4e')]);_0x34026a[_0xbe65('0x4f')]=qs[_0xbe65('0x51')](_[_0xbe65('0x50')](_0x474bc8['query'],_0x223e9a['filters']));if(_0x474bc8[_0xbe65('0x48')][_0xbe65('0x66')]){_0x34026a[_0xbe65('0x4f')]=_[_0xbe65('0x53')](_0x34026a[_0xbe65('0x4f')],{'$or':_[_0xbe65('0x3e')](_0x34026a[_0xbe65('0x49')],function(_0x5b8a22){var _0x15fbd4={};_0x15fbd4[_0x5b8a22]={'$like':'%'+_0x474bc8[_0xbe65('0x48')][_0xbe65('0x66')]+'%'};return _0x15fbd4;})});}_0x34026a=_[_0xbe65('0x53')]({},_0x34026a,_0x474bc8[_0xbe65('0x59')]);return _0x117474[_0xbe65('0x86')](_0x34026a);}})[_0xbe65('0x20')](function(_0x27c0de){if(_0x27c0de){_0x8d7cd4=_0x27c0de['length'];if(!_0x474bc8[_0xbe65('0x48')]['hasOwnProperty']('nolimit')){_0x34026a[_0xbe65('0x2f')]=qs[_0xbe65('0x2f')](_0x474bc8[_0xbe65('0x48')][_0xbe65('0x2f')]);_0x34026a[_0xbe65('0x2d')]=qs[_0xbe65('0x2d')](_0x474bc8[_0xbe65('0x48')]['offset']);}return _0x117474['getApplications'](_0x34026a);}})['then'](function(_0x27014d){if(_0x27014d){return _0x27014d?{'count':_0x8d7cd4,'rows':_0x27014d}:null;}})[_0xbe65('0x20')](respondWithResult(_0x3d99d4,null))[_0xbe65('0x2a')](handleError(_0x3d99d4,null));};function Extension(_0x5714b1,_0x5c9533,_0x142cf9,_0x19fed2){this[_0xbe65('0x87')]='from-voip-provider';this[_0xbe65('0x88')]=_0x5714b1[_0xbe65('0x89')];this['app']=_0x19fed2;this[_0xbe65('0x42')]=_0xbe65('0x8a');this['description']=_0xbe65('0x8b');this['FaxAccountId']=_0x5714b1['id'];this[_0xbe65('0x8c')]=_0x5c9533;this[_0xbe65('0x8d')]=_0x142cf9;}function createExtensionsReciveFax(_0x37fba6){var _0x13609b=0x1;var _0x31805f=[];_0x31805f['push'](new Extension(_0x37fba6,_0x13609b,'',_0xbe65('0x8e')));_0x13609b+=0x1;_0x31805f[_0xbe65('0x8f')](new Extension(_0x37fba6,_0x13609b,_0xbe65('0x90'),_0xbe65('0x91')));_0x13609b+=0x1;for(var _0x1dd891 in _0x37fba6){if(_0x37fba6[_0xbe65('0x71')](_0x1dd891)&&(_0x1dd891==='ecm'||_0x1dd891==='localstationid'||_0x1dd891===_0xbe65('0x92')||_0x1dd891==='faxdetect'||_0x1dd891===_0xbe65('0x93')||_0x1dd891===_0xbe65('0x94')||_0x1dd891===_0xbe65('0x95')||_0x1dd891===_0xbe65('0x96')||_0x1dd891===_0xbe65('0x97'))){_0x31805f[_0xbe65('0x8f')](new Extension(_0x37fba6,_0x13609b,_0xbe65('0x98')+_0x1dd891+')='+_0x37fba6[_0x1dd891],_0xbe65('0x91')));_0x13609b+=0x1;}}_0x31805f[_0xbe65('0x8f')](new Extension(_0x37fba6,_0x13609b,'6',_0xbe65('0x99')));_0x13609b+=0x1;_0x31805f['push'](new Extension(_0x37fba6,_0x13609b,_0xbe65('0x9a'),_0xbe65('0x9b')));_0x13609b=0x0;return _0x31805f;}exports[_0xbe65('0x9c')]=function(_0x21d516,_0x4dfa02,_0x595841){var _0x1a4028;return db[_0xbe65('0x7d')][_0xbe65('0x7c')](function(_0x3f24f7){return db[_0xbe65('0x3f')][_0xbe65('0x5b')](_0x21d516[_0xbe65('0x60')],{'transaction':_0x3f24f7})[_0xbe65('0x20')](function(_0xe23a53){_0x1a4028=_0xe23a53[_0xbe65('0x37')]({'plain':!![]});return db[_0xbe65('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x1a4028),{'transaction':_0x3f24f7});});})[_0xbe65('0x20')](function(){return _0x1a4028;})['then'](respondWithResult(_0x4dfa02,null))['catch'](handleError(_0x4dfa02,null));};exports['updateAccountApplications']=function(_0x3fd01d,_0x12adaa,_0x41cfad){var _0x529ea8;return db['sequelize'][_0xbe65('0x7c')](function(_0x2f86ce){return db[_0xbe65('0x3f')][_0xbe65('0x35')](_0x3fd01d[_0xbe65('0x60')],{'where':{'id':_0x3fd01d[_0xbe65('0x60')]['id']},'transaction':_0x2f86ce})[_0xbe65('0x20')](function(_0x151f78){return db[_0xbe65('0x9d')][_0xbe65('0x36')]({'where':{'FaxAccountId':_0x3fd01d[_0xbe65('0x60')]['id']},'transaction':_0x2f86ce})['then'](function(_0x3745dc){return db[_0xbe65('0x9d')]['bulkCreate'](createExtensionsReciveFax(_[_0xbe65('0x6f')](_0x3fd01d[_0xbe65('0x60')],[_0xbe65('0x9e'),_0xbe65('0x43'),_0xbe65('0x9f'),_0xbe65('0xa0'),_0xbe65('0xa1'),_0xbe65('0xa2')])),{'transaction':_0x2f86ce});});});})['then'](function(){return db[_0xbe65('0x3f')][_0xbe65('0xa3')](_0x3fd01d[_0xbe65('0x60')]['id']);})[_0xbe65('0x20')](respondWithResult(_0x12adaa,null))[_0xbe65('0x2a')](handleError(_0x12adaa,null));};exports[_0xbe65('0xa4')]=function(_0x1db6bc,_0x2ada92,_0x2411f4){var _0x52b62e={'raw':!![],'where':{}};var _0x184fe2={};var _0x3bb0c5={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbe65('0x65')]({'where':{'id':_0x1db6bc[_0xbe65('0x57')]['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x2ada92,null))[_0xbe65('0x20')](function(_0x5600d9){if(_0x5600d9){_0x184fe2['model']=_[_0xbe65('0x45')](db[_0xbe65('0xa5')]['rawAttributes']);_0x184fe2['query']=_['keys'](_0x1db6bc['query']);_0x184fe2[_0xbe65('0x51')]=_[_0xbe65('0x46')](_0x184fe2[_0xbe65('0x47')],_0x184fe2['query']);_0x52b62e[_0xbe65('0x49')]=_['intersection'](_0x184fe2['model'],qs['fields'](_0x1db6bc['query'][_0xbe65('0x4a')]));_0x52b62e['attributes']=_0x52b62e['attributes'][_0xbe65('0x4b')]?_0x52b62e[_0xbe65('0x49')]:_0x184fe2[_0xbe65('0x47')];if(!_0x1db6bc[_0xbe65('0x48')]['hasOwnProperty'](_0xbe65('0x4c'))){_0x52b62e[_0xbe65('0x2f')]=qs[_0xbe65('0x2f')](_0x1db6bc[_0xbe65('0x48')]['limit']);_0x52b62e[_0xbe65('0x2d')]=qs[_0xbe65('0x2d')](_0x1db6bc[_0xbe65('0x48')][_0xbe65('0x2d')]);}_0x52b62e[_0xbe65('0x4d')]=qs[_0xbe65('0x4e')](_0x1db6bc[_0xbe65('0x48')][_0xbe65('0x4e')]);_0x52b62e[_0xbe65('0x4f')]=qs['filters'](_[_0xbe65('0x50')](_0x1db6bc[_0xbe65('0x48')],_0x184fe2['filters']));_0x52b62e[_0xbe65('0x4f')][_0xbe65('0x63')]=_0x5600d9['id'];if(_0x1db6bc[_0xbe65('0x48')]['filter']){_0x52b62e[_0xbe65('0x4f')]=_[_0xbe65('0x53')](_0x52b62e[_0xbe65('0x4f')],{'$or':_[_0xbe65('0x3e')](_0x52b62e['attributes'],function(_0x46188b){var _0x500abc={};_0x500abc[_0x46188b]={'$like':'%'+_0x1db6bc['query'][_0xbe65('0x66')]+'%'};return _0x500abc;})});}if(_0x1db6bc[_0xbe65('0x48')][_0xbe65('0xa6')]){var _0x287cce=_0x1db6bc[_0xbe65('0x48')][_0xbe65('0xa6')][_0xbe65('0xa7')](',');var _0x2c44a7={};_0x2c44a7[_0x287cce[0x0]]={'$gte':moment(_0x287cce[0x1])[_0xbe65('0xa8')](_0xbe65('0xa9'))};_0x52b62e[_0xbe65('0x4f')]=_[_0xbe65('0x53')](_0x52b62e[_0xbe65('0x4f')],_0x2c44a7);}_0x52b62e=_['merge']({},_0x52b62e,_0x1db6bc[_0xbe65('0x59')]);return db[_0xbe65('0xa5')][_0xbe65('0x30')]({'where':_0x52b62e['where']})[_0xbe65('0x20')](function(_0x605bfe){_0x3bb0c5[_0xbe65('0x30')]=_0x605bfe;if(_0x1db6bc['query']['includeAll']){_0x52b62e['include']=[{'all':!![]}];}return db[_0xbe65('0xa5')]['findAll'](_0x52b62e);})[_0xbe65('0x20')](function(_0x34d549){_0x3bb0c5[_0xbe65('0x56')]=_0x34d549;return _0x3bb0c5;});}})['then'](respondWithFilteredResult(_0x2ada92,_0x52b62e))['catch'](handleError(_0x2ada92,null));};exports[_0xbe65('0x3b')]=function(_0x12725a,_0x393d97,_0x137db5){var _0x39c5d1,_0x2e4de6={},_0xcf3761;if(_0x12725a['body']['to']){_0xcf3761=_0x12725a[_0xbe65('0x60')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x12725a[_0xbe65('0x57')]['id']},'include':[{'model':db[_0xbe65('0xaa')],'as':_0xbe65('0xab'),'include':[{'model':db[_0xbe65('0x72')],'as':'Contacts','where':{'fax':_0xcf3761},'limit':0x1,'order':[[_0xbe65('0xa0'),_0xbe65('0xac')]]}]}]})['then'](handleEntityNotFound(_0x393d97,null))[_0xbe65('0x20')](function(_0x533e88){_0x39c5d1=_0x533e88;if(_0x12725a[_0xbe65('0x60')][_0xbe65('0xad')]&&_0x12725a[_0xbe65('0x60')][_0xbe65('0xad')][_0xbe65('0x4b')]){for(var _0x2e91c9=0x0;_0x2e91c9<_0x12725a[_0xbe65('0x60')]['attachments'][_0xbe65('0x4b')];_0x2e91c9+=0x1){_0x12725a['body'][_0xbe65('0xad')][_0x2e91c9]={'filename':_0x12725a['body'][_0xbe65('0xad')][_0x2e91c9][_0xbe65('0x44')],'id':_0x12725a[_0xbe65('0x60')]['attachments'][_0x2e91c9]['id'],'path':path[_0xbe65('0xae')](config[_0xbe65('0xaf')],_0xbe65('0xb0'),_0x12725a['body'][_0xbe65('0xad')][_0x2e91c9][_0xbe65('0xb1')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xbe65('0xb2')](_0x12725a[_0xbe65('0x57')]['id'])?undefined:_0x12725a[_0xbe65('0x57')]['id'],'path':_[_0xbe65('0xb2')](_0x12725a[_0xbe65('0x60')][_0xbe65('0xad')][0x0][_0xbe65('0x7')])?undefined:_0x12725a[_0xbe65('0x60')][_0xbe65('0xad')][0x0]['path'],'fax':_['isNil'](_0x12725a[_0xbe65('0x60')]['to'][0x0])?undefined:_0x12725a[_0xbe65('0x60')]['to'][0x0]},client9002);})[_0xbe65('0x20')](function(){if(_0x39c5d1){if(_['isNil'](_0x12725a[_0xbe65('0x60')][_0xbe65('0xb3')])){_0x12725a[_0xbe65('0x60')][_0xbe65('0xb3')]=util[_0xbe65('0xa8')](_0xbe65('0xb4'),_0x39c5d1[_0xbe65('0x44')],_0x39c5d1[_0xbe65('0xb5')]);}if(_0x39c5d1[_0xbe65('0xab')]){if(_0x39c5d1[_0xbe65('0xab')][_0xbe65('0xb6')]['length']){return _0x39c5d1['List'][_0xbe65('0xb6')][0x0];}else{return db[_0xbe65('0x72')][_0xbe65('0x5b')](_[_0xbe65('0x18')](_0x12725a['body'],{'firstName':_0x12725a['body']['to'][0x0],'phone':_0x12725a[_0xbe65('0x60')]['to'][0x0],'fax':_0x12725a[_0xbe65('0x60')]['to'][0x0],'ListId':_0x39c5d1[_0xbe65('0xa2')]}));}}else{throw new Error(_0xbe65('0xb7'));}}else{throw new Error(_0xbe65('0xb8'));}})[_0xbe65('0x20')](function(_0x16b9ca){if(_0x16b9ca){return db[_0xbe65('0x6e')][_0xbe65('0x5a')]({'where':{'ContactId':_0x16b9ca['id'],'closed':![],'FaxAccountId':_0x39c5d1['id']}})[_0xbe65('0x20')](function(_0x1d2031){if(_0x1d2031){return[_0x1d2031,![]];}return db[_0xbe65('0x6e')][_0xbe65('0x5b')]({'UserId':_0x12725a[_0xbe65('0xb9')]['id'],'ContactId':_0x16b9ca['id'],'FaxAccountId':_0x39c5d1['id'],'fax':_0x12725a[_0xbe65('0x60')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xbe65('0x53')](_0x12725a[_0xbe65('0x60')],{'read':![],'body':_0x12725a[_0xbe65('0x60')]['attachments'][0x0][_0xbe65('0xba')],'FaxAccountId':_0x39c5d1['id'],'UserId':_0x12725a[_0xbe65('0xb9')]['id'],'ContactId':_0x16b9ca['id'],'AttachmentId':_0x12725a[_0xbe65('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xbe65('0xa5')],'as':_0xbe65('0xbb')}]})[_0xbe65('0x20')](function(_0x10a5f0){return[_0x10a5f0,!![]];});});}else{throw new Error(_0xbe65('0xbc'));}})['spread'](function(_0x4f234f,_0x2c93b7){if(_0x2c93b7){return _0x4f234f;}return db[_0xbe65('0xa5')]['create']({'direction':_0xbe65('0xbd'),'read':![],'body':_0x12725a['body'][_0xbe65('0xad')][0x0][_0xbe65('0xba')],'FaxAccountId':_0x39c5d1['id'],'FaxInteractionId':_0x4f234f['id'],'UserId':_0x12725a[_0xbe65('0xb9')]['id'],'ContactId':_0x4f234f[_0xbe65('0xbe')],'AttachmentId':_0x12725a['body'][_0xbe65('0xad')][0x0]['id']})[_0xbe65('0x20')](function(_0x5e7b36){_0x4f234f[_0xbe65('0xbf')][_0xbe65('0xbb')]=[];_0x4f234f['dataValues'][_0xbe65('0xbb')][_0xbe65('0x8f')](_0x5e7b36['dataValues']);return _0x4f234f;});})[_0xbe65('0x20')](function(_0x2b8b10){respondWithRpcPromise(_0xbe65('0xc0'),_0xbe65('0xc0'),{'FaxAccountId':_[_0xbe65('0xb2')](_0x12725a[_0xbe65('0x57')]['id'])?undefined:_0x12725a[_0xbe65('0x57')]['id'],'path':_['isNil'](_0x12725a['body'][_0xbe65('0xad')][0x0][_0xbe65('0x7')])?undefined:_0x12725a[_0xbe65('0x60')][_0xbe65('0xad')][0x0]['path'],'fax':_[_0xbe65('0xb2')](_0x12725a[_0xbe65('0x60')]['to'][0x0])?undefined:_0x12725a[_0xbe65('0x60')]['to'][0x0],'AttachmentId':_0x12725a[_0xbe65('0x60')][_0xbe65('0xad')][0x0]['id']},client9002)[_0xbe65('0x20')](function(_0x547407){logger[_0xbe65('0x21')](_0xbe65('0xc1'),_0x547407);})[_0xbe65('0x2a')](function(_0x7bd0e2){logger['info'](_0xbe65('0xc1'),_0x7bd0e2);});return _0x2b8b10;})[_0xbe65('0x20')](respondWithResult(_0x393d97,null))[_0xbe65('0x2a')](handleError(_0x393d97,null));};exports[_0xbe65('0xc2')]=function(_0x4243eb,_0x46cd30,_0x753f80){return db[_0xbe65('0x3f')][_0xbe65('0x5a')]({'where':{'id':_0x4243eb[_0xbe65('0x57')]['id']}})['then'](handleEntityNotFound(_0x46cd30,null))['then'](function(_0x4a56a3){if(_0x4a56a3){return _0x4a56a3[_0xbe65('0xc2')](_0x4243eb['body'][_0xbe65('0x68')],_[_0xbe65('0x6f')](_0x4243eb[_0xbe65('0x60')],['ids','id'])||{})[_0xbe65('0xc3')](function(_0x3ecea1){for(var _0x3bfd75=0x0;_0x3bfd75<_0x4243eb['body'][_0xbe65('0x68')]['length'];_0x3bfd75+=0x1){socket[_0xbe65('0xc4')]('userFaxAccount:save',{'UserId':Number(_0x4243eb['body']['ids'][_0x3bfd75]),'FaxAccountId':Number(_0x4243eb[_0xbe65('0x57')]['id'])});}return _0x3ecea1;});}})['then'](respondWithResult(_0x46cd30,null))[_0xbe65('0x2a')](handleError(_0x46cd30,null));};exports[_0xbe65('0xc5')]=function(_0x9668f6,_0x225e36,_0x274d8d){return db[_0xbe65('0x3f')][_0xbe65('0x5a')]({'where':{'id':_0x9668f6[_0xbe65('0x57')]['id']}})[_0xbe65('0x20')](handleEntityNotFound(_0x225e36,null))[_0xbe65('0x20')](function(_0x2d9424){if(_0x2d9424){return _0x2d9424[_0xbe65('0xc5')](_0x9668f6[_0xbe65('0x48')][_0xbe65('0x68')])[_0xbe65('0x20')](function(){if(_['isArray'](_0x9668f6[_0xbe65('0x48')][_0xbe65('0x68')])){for(var _0x203dc2=0x0;_0x203dc2<_0x9668f6[_0xbe65('0x48')]['ids'][_0xbe65('0x4b')];_0x203dc2+=0x1){socket[_0xbe65('0xc4')](_0xbe65('0xc6'),{'UserId':Number(_0x9668f6[_0xbe65('0x48')][_0xbe65('0x68')][_0x203dc2]),'FaxAccountId':Number(_0x9668f6['params']['id'])});}}else{socket[_0xbe65('0xc4')](_0xbe65('0xc6'),{'UserId':Number(_0x9668f6['query'][_0xbe65('0x68')]),'FaxAccountId':Number(_0x9668f6['params']['id'])});}});}})['then'](respondWithStatusCode(_0x225e36,null))[_0xbe65('0x2a')](handleError(_0x225e36,null));};exports[_0xbe65('0xc7')]=function(_0x549fa3,_0x54432a,_0x1c3d4b){var _0x5a47d2={};var _0x39de6d={};var _0x33150c;var _0x40c52d;return db[_0xbe65('0x3f')]['findOne']({'where':{'id':_0x549fa3[_0xbe65('0x57')]['id']}})['then'](handleEntityNotFound(_0x54432a,null))['then'](function(_0xac9e87){if(_0xac9e87){_0x33150c=_0xac9e87;_0x39de6d[_0xbe65('0x47')]=_[_0xbe65('0x45')](db[_0xbe65('0x74')][_0xbe65('0x40')]);_0x39de6d[_0xbe65('0x48')]=_[_0xbe65('0x45')](_0x549fa3['query']);_0x39de6d[_0xbe65('0x51')]=_[_0xbe65('0x46')](_0x39de6d[_0xbe65('0x47')],_0x39de6d[_0xbe65('0x48')]);_0x5a47d2[_0xbe65('0x49')]=_[_0xbe65('0x46')](_0x39de6d['model'],qs[_0xbe65('0x4a')](_0x549fa3[_0xbe65('0x48')][_0xbe65('0x4a')]));_0x5a47d2[_0xbe65('0x49')]=_0x5a47d2['attributes']['length']?_0x5a47d2[_0xbe65('0x49')]:_0x39de6d[_0xbe65('0x47')];_0x5a47d2[_0xbe65('0x4d')]=qs[_0xbe65('0x4e')](_0x549fa3['query']['sort']);_0x5a47d2['where']=qs[_0xbe65('0x51')](_[_0xbe65('0x50')](_0x549fa3['query'],_0x39de6d[_0xbe65('0x51')]));if(_0x549fa3['query'][_0xbe65('0x66')]){_0x5a47d2[_0xbe65('0x4f')]=_['merge'](_0x5a47d2[_0xbe65('0x4f')],{'$or':_[_0xbe65('0x3e')](_0x5a47d2[_0xbe65('0x49')],function(_0xdaa068){var _0xc68d6b={};_0xc68d6b[_0xdaa068]={'$like':'%'+_0x549fa3[_0xbe65('0x48')][_0xbe65('0x66')]+'%'};return _0xc68d6b;})});}_0x5a47d2=_['merge']({},_0x5a47d2,_0x549fa3[_0xbe65('0x59')]);return _0x33150c[_0xbe65('0xc7')](_0x5a47d2);}})[_0xbe65('0x20')](function(_0x6c55f6){if(_0x6c55f6){_0x40c52d=_0x6c55f6[_0xbe65('0x4b')];if(!_0x549fa3['query'][_0xbe65('0x71')](_0xbe65('0x4c'))){_0x5a47d2[_0xbe65('0x2f')]=qs[_0xbe65('0x2f')](_0x549fa3[_0xbe65('0x48')][_0xbe65('0x2f')]);_0x5a47d2[_0xbe65('0x2d')]=qs[_0xbe65('0x2d')](_0x549fa3[_0xbe65('0x48')][_0xbe65('0x2d')]);}return _0x33150c[_0xbe65('0xc7')](_0x5a47d2);}})['then'](function(_0xa1a3d3){if(_0xa1a3d3){return _0xa1a3d3?{'count':_0x40c52d,'rows':_0xa1a3d3}:null;}})[_0xbe65('0x20')](respondWithResult(_0x54432a,null))[_0xbe65('0x2a')](handleError(_0x54432a,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b6ea6a4..f2c56c0 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 _0x6635=['update','remove','emit','hook','exports','FaxAccount','setMaxListeners','save'];(function(_0x272cd3,_0x4b9a03){var _0x356a60=function(_0x4a1aa6){while(--_0x4a1aa6){_0x272cd3['push'](_0x272cd3['shift']());}};_0x356a60(++_0x4b9a03);}(_0x6635,0x10d));var _0x5663=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x6635[_0x47fd36];return _0x21a0fc;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x5663('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5663('0x1')](0x0);var events={'afterCreate':_0x5663('0x2'),'afterUpdate':_0x5663('0x3'),'afterDestroy':_0x5663('0x4')};function emitEvent(_0x526b55){return function(_0xfa4b45,_0x1f5480,_0x38d1b1){FaxAccountEvents[_0x5663('0x5')](_0x526b55+':'+_0xfa4b45['id'],_0xfa4b45);FaxAccountEvents[_0x5663('0x5')](_0x526b55,_0xfa4b45);_0x38d1b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x5663('0x6')](e,emitEvent(event));}}module[_0x5663('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x8137=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','FaxAccount'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0x8137,0x180));var _0x7813=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x8137[_0x35885a];return _0xe86249;};'use strict';var EventEmitter=require(_0x7813('0x0'));var FaxAccount=require(_0x7813('0x1'))['db'][_0x7813('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x7813('0x3')](0x0);var events={'afterCreate':_0x7813('0x4'),'afterUpdate':_0x7813('0x5'),'afterDestroy':_0x7813('0x6')};function emitEvent(_0x3c1b01){return function(_0x3d73b4,_0x5868f0,_0x3dd4c9){FaxAccountEvents[_0x7813('0x7')](_0x3c1b01+':'+_0x3d73b4['id'],_0x3d73b4);FaxAccountEvents[_0x7813('0x7')](_0x3c1b01,_0x3d73b4);_0x3dd4c9(null);};}for(var e in events){if(events[_0x7813('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0ffc68e..fec7062 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 _0xee88=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports'];(function(_0x2d9611,_0x44a317){var _0x25ca4a=function(_0x41bce4){while(--_0x41bce4){_0x2d9611['push'](_0x2d9611['shift']());}};_0x25ca4a(++_0x44a317);}(_0xee88,0x1ed));var _0x8ee8=function(_0x372d80,_0x56a894){_0x372d80=_0x372d80-0x0;var _0x2371f2=_0xee88[_0x372d80];return _0x2371f2;};'use strict';var _=require(_0x8ee8('0x0'));var util=require(_0x8ee8('0x1'));var logger=require(_0x8ee8('0x2'))(_0x8ee8('0x3'));var moment=require(_0x8ee8('0x4'));var BPromise=require(_0x8ee8('0x5'));var rp=require(_0x8ee8('0x6'));var fs=require('fs');var path=require(_0x8ee8('0x7'));var rimraf=require(_0x8ee8('0x8'));var config=require('../../config/environment');var attributes=require(_0x8ee8('0x9'));module[_0x8ee8('0xa')]=function(_0xa5f7a,_0x4a1411){return _0xa5f7a[_0x8ee8('0xb')](_0x8ee8('0xc'),attributes,{'tableName':_0x8ee8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x442e=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x2e6e98,_0x661a12){var _0x4ceb9d=function(_0x30017a){while(--_0x30017a){_0x2e6e98['push'](_0x2e6e98['shift']());}};_0x4ceb9d(++_0x661a12);}(_0x442e,0xbf));var _0xe442=function(_0x8f3bd8,_0x26a01c){_0x8f3bd8=_0x8f3bd8-0x0;var _0x431518=_0x442e[_0x8f3bd8];return _0x431518;};'use strict';var _=require(_0xe442('0x0'));var util=require(_0xe442('0x1'));var logger=require(_0xe442('0x2'))(_0xe442('0x3'));var moment=require(_0xe442('0x4'));var BPromise=require(_0xe442('0x5'));var rp=require(_0xe442('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe442('0x7'));var config=require(_0xe442('0x8'));var attributes=require('./faxAccount.attributes');module[_0xe442('0x9')]=function(_0x5cf097,_0x5cd8dc){return _0x5cf097[_0xe442('0xa')](_0xe442('0xb'),attributes,{'tableName':_0xe442('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 7a1958e..0ad2519 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 _0x920f=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','FaxAccount','find','List','DESC','Applications','account','applications','list','orderBy','asc','length','Contacts','defaults','from','create','contact','FaxInteraction','spread','get','push','close','unmanaged','created','interaction','ContactId','AttachmentId','UserId','User','unshift','name','waitForTheAssignedAgent','startRouting','Start','moment','bluebird','randomstring','../../config/utils','client','http','localhost','socket.io-emitter','redis','./faxAccount.socket','request','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetFaxAccount','findAll','options','raw','where','include','map','model','attributes','then','info','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','keys','CompanyId','ListId','isNil'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x920f,0x1c3));var _0xf920=function(_0x108739,_0x257719){_0x108739=_0x108739-0x0;var _0x1ddadf=_0x920f[_0x108739];return _0x1ddadf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf920('0x0'));var BPromise=require(_0xf920('0x1'));var rs=require(_0xf920('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf920('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf920('0x4')][_0xf920('0x5')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':_0xf920('0x6'),'port':0x18eb});var socket=require(_0xf920('0x7'))(new Redis(config[_0xf920('0x8')]));require(_0xf920('0x9'))['register'](socket);function respondWithRpcPromise(_0x24af2f,_0x430389,_0x1d9c01){return new BPromise(function(_0x245166,_0x2a6800){return client[_0xf920('0xa')](_0x24af2f,_0x1d9c01)['then'](function(_0x35ef18){logger['info'](_0xf920('0xb'),_0x430389,'request\x20sent');logger[_0xf920('0xc')](_0xf920('0xd'),_0x430389,_0xf920('0xe'),JSON['stringify'](_0x35ef18));if(_0x35ef18['error']){if(_0x35ef18['error'][_0xf920('0xf')]===0x1f4){logger[_0xf920('0x10')](_0xf920('0xb'),_0x430389,_0x35ef18[_0xf920('0x10')][_0xf920('0x11')]);return _0x2a6800(_0x35ef18[_0xf920('0x10')][_0xf920('0x11')]);}logger[_0xf920('0x10')](_0xf920('0xb'),_0x430389,_0x35ef18[_0xf920('0x10')][_0xf920('0x11')]);return _0x245166(_0x35ef18[_0xf920('0x10')][_0xf920('0x11')]);}else{logger['info'](_0xf920('0xb'),_0x430389,'request\x20sent');_0x245166(_0x35ef18[_0xf920('0x12')][_0xf920('0x11')]);}})[_0xf920('0x13')](function(_0x3eefb8){logger[_0xf920('0x10')]('FaxAccount,\x20%s,\x20%s',_0x430389,_0x3eefb8);_0x2a6800(_0x3eefb8);});});}exports[_0xf920('0x14')]=function(_0x2d7c0d){var _0x31c976=this;return new Promise(function(_0x52ce90,_0x25bae2){return db['FaxAccount'][_0xf920('0x15')]({'raw':_0x2d7c0d[_0xf920('0x16')]?_0x2d7c0d[_0xf920('0x16')][_0xf920('0x17')]===undefined?!![]:![]:!![],'where':_0x2d7c0d[_0xf920('0x16')]?_0x2d7c0d['options'][_0xf920('0x18')]||null:null,'attributes':_0x2d7c0d[_0xf920('0x16')]?_0x2d7c0d['options']['attributes']||null:null,'limit':_0x2d7c0d[_0xf920('0x16')]?_0x2d7c0d[_0xf920('0x16')]['limit']||null:null,'include':_0x2d7c0d[_0xf920('0x16')]?_0x2d7c0d[_0xf920('0x16')][_0xf920('0x19')]?_[_0xf920('0x1a')](_0x2d7c0d[_0xf920('0x16')][_0xf920('0x19')],function(_0x203b27){return{'model':db[_0x203b27[_0xf920('0x1b')]],'as':_0x203b27['as'],'attributes':_0x203b27['attributes'],'include':_0x203b27[_0xf920('0x19')]?_['map'](_0x203b27[_0xf920('0x19')],function(_0x40bef1){return{'model':db[_0x40bef1[_0xf920('0x1b')]],'as':_0x40bef1['as'],'attributes':_0x40bef1[_0xf920('0x1c')],'include':_0x40bef1[_0xf920('0x19')]?_[_0xf920('0x1a')](_0x40bef1['include'],function(_0x2fdf75){return{'model':db[_0x2fdf75[_0xf920('0x1b')]],'as':_0x2fdf75['as'],'attributes':_0x2fdf75[_0xf920('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf920('0x1d')](function(_0x539a7d){logger[_0xf920('0x1e')](_0xf920('0x14'),_0x2d7c0d);logger['debug'](_0xf920('0x14'),_0x2d7c0d,JSON[_0xf920('0x1f')](_0x539a7d));_0x52ce90(_0x539a7d);})['catch'](function(_0x687a03){logger[_0xf920('0x10')](_0xf920('0x14'),_0x687a03[_0xf920('0x11')],_0x2d7c0d);_0x25bae2(_0x31c976[_0xf920('0x10')](0x1f4,_0x687a03[_0xf920('0x11')]));});});};exports[_0xf920('0x20')]=function(_0x560f69,_0x4e4cb4,_0x12cc95){var _0x52ed5f=this;return new Promise(function(_0x330ec2,_0xdfcf4d){var _0x50e357={'body':_0x560f69[_0xf920('0x21')],'channel':_0xf920('0x22')};var _0x2dd260=[];var _0x4192f6=[];var _0x57e082={};return db[_0xf920('0x23')][_0xf920('0x24')]()['then'](function(_0x27f279){if(!_0x27f279){throw new db[(_0xf920('0x25'))][(_0xf920('0x26'))](_0xf920('0x27'));}_0x2dd260=_['difference'](_['keys'](_0x27f279),[_0xf920('0x28'),_0xf920('0x29')]);_0x4192f6=_[_0xf920('0x2a')](_[_0xf920('0x2b')](_0x27f279),['createdAt',_0xf920('0x29'),_0xf920('0x2c'),_0xf920('0x2d')]);if(_0x560f69['body']['id']){delete _0x560f69[_0xf920('0x21')]['id'];}if(_[_0xf920('0x2e')](_0x560f69[_0xf920('0x21')]['from'])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x560f69['body'][_0xf920('0x21')])||_0x560f69[_0xf920('0x21')][_0xf920('0x21')]===''){throw new db[(_0xf920('0x25'))][(_0xf920('0x26'))](_0xf920('0x2f'));}if(_['isNil'](_0x560f69[_0xf920('0x21')]['mapKey'])){throw new db[(_0xf920('0x25'))][(_0xf920('0x26'))](_0xf920('0x30')+_0x4192f6);}if(!_['includes'](_0x4192f6,_0x560f69['body'][_0xf920('0x31')])){throw new db['Sequelize'][(_0xf920('0x26'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4192f6);}_0x57e082[_0x560f69['body']['mapKey']]=_0x560f69[_0xf920('0x21')]['from'];})[_0xf920('0x1d')](function(){return db[_0xf920('0x32')][_0xf920('0x33')]({'where':{'id':_0x560f69['account']['id']},'include':[{'model':db['CmList'],'as':_0xf920('0x34'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x57e082,'limit':0x1,'order':[[_0xf920('0x29'),_0xf920('0x35')]]}]},{'model':db['FaxApplication'],'as':_0xf920('0x36')}]});})['then'](function(_0x1b6bce){if(_0x1b6bce&&_0x1b6bce[_0xf920('0x34')]){var _0x122790=_0x1b6bce['get']({'plain':!![]});_0x50e357[_0xf920('0x37')]=_0x122790;_0x50e357[_0xf920('0x38')]=_0x122790[_0xf920('0x36')];_0x50e357[_0xf920('0x39')]=_0x122790[_0xf920('0x34')];_0x50e357['applications']=_[_0xf920('0x3a')](_0x50e357[_0xf920('0x38')],['priority'],[_0xf920('0x3b')]);if(_0x50e357['account']['Applications']){delete _0x50e357[_0xf920('0x37')][_0xf920('0x36')];}if(_0x50e357[_0xf920('0x37')][_0xf920('0x34')]&&_0x50e357[_0xf920('0x37')][_0xf920('0x34')]['Contacts'][_0xf920('0x3c')]){return _0x50e357['account'][_0xf920('0x34')][_0xf920('0x3d')][0x0];}var _0x2c149b=_[_0xf920('0x3e')](_0x560f69[_0xf920('0x21')],{'firstName':_0x560f69['body']['from'],'ListId':_0x122790['ListId']});_0x2c149b[_0x560f69['body'][_0xf920('0x31')]]=_0x560f69[_0xf920('0x21')][_0xf920('0x3f')];return db['CmContact'][_0xf920('0x40')](_0x2c149b,{'fields':_0x2dd260,'raw':!![]});}})[_0xf920('0x1d')](function(_0x43a60c){_0x50e357[_0xf920('0x41')]=_0x43a60c;if(_0x43a60c){var _0x29e55d={'ContactId':_0x43a60c['id'],'FaxAccountId':_0x560f69[_0xf920('0x37')]['id'],'fax':_0x43a60c[_0xf920('0x22')]};return db[_0xf920('0x42')][_0xf920('0x33')]({'where':{'ContactId':_0x43a60c['id'],'closed':![],'FaxAccountId':_0x560f69[_0xf920('0x37')]['id']}})['then'](function(_0x206385){if(_0x206385){return[_0x206385,![]];}return db[_0xf920('0x42')][_0xf920('0x40')](_0x29e55d)[_0xf920('0x1d')](function(_0x2f8bf2){return[_0x2f8bf2,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf920('0x43')](function(_0x2fdaab,_0x5bd2fe){var _0x25d6db=_0x2fdaab[_0xf920('0x44')]({'plain':!![]});if(_0x5bd2fe){if(_0x50e357[_0xf920('0x37')]['autoclose']){_0x50e357[_0xf920('0x38')][_0xf920('0x45')]({'id':0x0,'priority':_0x50e357[_0xf920('0x38')][_0xf920('0x3c')]+0x1,'app':_0xf920('0x46'),'appdata':_0xf920('0x47'),'interval':'*,*,*,*'});}_0x25d6db[_0xf920('0x48')]=!![];}else{_0x25d6db['created']=![];}_0x50e357[_0xf920('0x49')]=_0x25d6db;return db['FaxMessage']['create']({'body':_0x560f69[_0xf920('0x21')][_0xf920('0x21')],'FaxAccountId':_0x560f69['account']['id'],'FaxInteractionId':_0x2fdaab['id'],'direction':'in','ContactId':_0x2fdaab[_0xf920('0x4a')],'AttachmentId':_0x560f69[_0xf920('0x21')][_0xf920('0x4b')]});})[_0xf920('0x1d')](function(_0x3152f7){_0x50e357[_0xf920('0x11')]=_0x3152f7;if(_0x50e357['interaction'][_0xf920('0x4c')]){return db[_0xf920('0x4d')][_0xf920('0x33')]({'attributes':['id','name'],'where':{'id':_0x50e357['interaction']['UserId']}})[_0xf920('0x1d')](function(_0x4e3286){if(_0x4e3286){_0x50e357[_0xf920('0x38')][_0xf920('0x4e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4e3286[_0xf920('0x4f')]+','+(_0x50e357[_0xf920('0x37')][_0xf920('0x50')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xf920('0x51'),_0x50e357);});}return respondWithRpcPromise(_0xf920('0x52'),_0xf920('0x51'),_0x50e357);})[_0xf920('0x1d')](function(_0x2e07da){_0x330ec2(_0x2e07da);})[_0xf920('0x13')](function(_0x2e85f1){_0xdfcf4d(_0x52ed5f['error'](0x1f4,_0x2e85f1[_0xf920('0x11')]));});});}; \ No newline at end of file +var _0xb176=['options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','FaxApplication','Applications','account','applications','list','orderBy','priority','asc','length','Contacts','create','contact','find','FaxInteraction','spread','autoclose','push','close','unmanaged','created','interaction','AttachmentId','User','name','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0xb176,0xeb));var _0x6b17=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0xb176[_0x3cc05d];return _0x28b736;};'use strict';var _=require(_0x6b17('0x0'));var util=require(_0x6b17('0x1'));var moment=require(_0x6b17('0x2'));var BPromise=require(_0x6b17('0x3'));var rs=require(_0x6b17('0x4'));var fs=require('fs');var Redis=require(_0x6b17('0x5'));var db=require(_0x6b17('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b17('0x7'))(_0x6b17('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b17('0x9'));var client=jayson['client'][_0x6b17('0xa')]({'port':0x232c});config[_0x6b17('0xb')]=_[_0x6b17('0xc')](config[_0x6b17('0xb')],{'host':_0x6b17('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b17('0xb')]));require(_0x6b17('0xe'))[_0x6b17('0xf')](socket);function respondWithRpcPromise(_0x39afd5,_0x35154,_0x140bad){return new BPromise(function(_0x573c4a,_0x21685e){return client[_0x6b17('0x10')](_0x39afd5,_0x140bad)[_0x6b17('0x11')](function(_0x44dfae){logger['info'](_0x6b17('0x12'),_0x35154,_0x6b17('0x13'));logger[_0x6b17('0x14')](_0x6b17('0x15'),_0x35154,_0x6b17('0x13'),JSON[_0x6b17('0x16')](_0x44dfae));if(_0x44dfae[_0x6b17('0x17')]){if(_0x44dfae[_0x6b17('0x17')][_0x6b17('0x18')]===0x1f4){logger[_0x6b17('0x17')]('FaxAccount,\x20%s,\x20%s',_0x35154,_0x44dfae[_0x6b17('0x17')][_0x6b17('0x19')]);return _0x21685e(_0x44dfae[_0x6b17('0x17')][_0x6b17('0x19')]);}logger[_0x6b17('0x17')](_0x6b17('0x12'),_0x35154,_0x44dfae[_0x6b17('0x17')][_0x6b17('0x19')]);return _0x573c4a(_0x44dfae[_0x6b17('0x17')]['message']);}else{logger[_0x6b17('0x1a')](_0x6b17('0x12'),_0x35154,'request\x20sent');_0x573c4a(_0x44dfae[_0x6b17('0x1b')]['message']);}})[_0x6b17('0x1c')](function(_0x3552e7){logger[_0x6b17('0x17')](_0x6b17('0x12'),_0x35154,_0x3552e7);_0x21685e(_0x3552e7);});});}exports[_0x6b17('0x1d')]=function(_0x2a04d9){var _0x9703de=this;return new Promise(function(_0x7e36b7,_0x234d50){return db[_0x6b17('0x1e')][_0x6b17('0x1f')]({'raw':_0x2a04d9[_0x6b17('0x20')]?_0x2a04d9[_0x6b17('0x20')][_0x6b17('0x21')]===undefined?!![]:![]:!![],'where':_0x2a04d9[_0x6b17('0x20')]?_0x2a04d9[_0x6b17('0x20')]['where']||null:null,'attributes':_0x2a04d9[_0x6b17('0x20')]?_0x2a04d9[_0x6b17('0x20')][_0x6b17('0x22')]||null:null,'limit':_0x2a04d9[_0x6b17('0x20')]?_0x2a04d9[_0x6b17('0x20')][_0x6b17('0x23')]||null:null,'include':_0x2a04d9[_0x6b17('0x20')]?_0x2a04d9['options'][_0x6b17('0x24')]?_[_0x6b17('0x25')](_0x2a04d9[_0x6b17('0x20')][_0x6b17('0x24')],function(_0xec684b){return{'model':db[_0xec684b[_0x6b17('0x26')]],'as':_0xec684b['as'],'attributes':_0xec684b[_0x6b17('0x22')],'include':_0xec684b['include']?_[_0x6b17('0x25')](_0xec684b[_0x6b17('0x24')],function(_0x1333c7){return{'model':db[_0x1333c7['model']],'as':_0x1333c7['as'],'attributes':_0x1333c7[_0x6b17('0x22')],'include':_0x1333c7[_0x6b17('0x24')]?_['map'](_0x1333c7[_0x6b17('0x24')],function(_0x378e93){return{'model':db[_0x378e93[_0x6b17('0x26')]],'as':_0x378e93['as'],'attributes':_0x378e93[_0x6b17('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x515962){logger[_0x6b17('0x1a')](_0x6b17('0x1d'),_0x2a04d9);logger[_0x6b17('0x14')](_0x6b17('0x1d'),_0x2a04d9,JSON['stringify'](_0x515962));_0x7e36b7(_0x515962);})[_0x6b17('0x1c')](function(_0x5ee6a3){logger['error'](_0x6b17('0x1d'),_0x5ee6a3[_0x6b17('0x19')],_0x2a04d9);_0x234d50(_0x9703de[_0x6b17('0x17')](0x1f4,_0x5ee6a3[_0x6b17('0x19')]));});});};exports[_0x6b17('0x27')]=function(_0xf748f6,_0x58b36d,_0x5e3bbf){var _0x477438=this;return new Promise(function(_0x1069df,_0x1161c6){var _0x39afa7={'body':_0xf748f6[_0x6b17('0x28')],'channel':_0x6b17('0x29')};var _0xdec1fd=[];var _0x45e3c6=[];var _0x11f759={};return db[_0x6b17('0x2a')][_0x6b17('0x2b')]()[_0x6b17('0x11')](function(_0x3c5176){if(!_0x3c5176){throw new db[(_0x6b17('0x2c'))][(_0x6b17('0x2d'))](_0x6b17('0x2e'));}_0xdec1fd=_[_0x6b17('0x2f')](_[_0x6b17('0x30')](_0x3c5176),[_0x6b17('0x31'),_0x6b17('0x32')]);_0x45e3c6=_[_0x6b17('0x2f')](_['keys'](_0x3c5176),[_0x6b17('0x31'),_0x6b17('0x32'),_0x6b17('0x33'),_0x6b17('0x34')]);if(_0xf748f6['body']['id']){delete _0xf748f6[_0x6b17('0x28')]['id'];}if(_[_0x6b17('0x35')](_0xf748f6[_0x6b17('0x28')][_0x6b17('0x36')])){throw new db[(_0x6b17('0x2c'))][(_0x6b17('0x2d'))](_0x6b17('0x37'));}if(_[_0x6b17('0x35')](_0xf748f6[_0x6b17('0x28')]['body'])||_0xf748f6[_0x6b17('0x28')]['body']===''){throw new db[(_0x6b17('0x2c'))][(_0x6b17('0x2d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6b17('0x35')](_0xf748f6['body'][_0x6b17('0x38')])){throw new db['Sequelize'][(_0x6b17('0x2d'))](_0x6b17('0x39')+_0x45e3c6);}if(!_[_0x6b17('0x3a')](_0x45e3c6,_0xf748f6['body'][_0x6b17('0x38')])){throw new db[(_0x6b17('0x2c'))]['ValidationError'](_0x6b17('0x3b')+_0x45e3c6);}_0x11f759[_0xf748f6[_0x6b17('0x28')][_0x6b17('0x38')]]=_0xf748f6[_0x6b17('0x28')][_0x6b17('0x36')];})[_0x6b17('0x11')](function(){return db['FaxAccount']['find']({'where':{'id':_0xf748f6['account']['id']},'include':[{'model':db['CmList'],'as':_0x6b17('0x3c'),'include':[{'model':db[_0x6b17('0x2a')],'as':'Contacts','where':_0x11f759,'limit':0x1,'order':[[_0x6b17('0x32'),_0x6b17('0x3d')]]}]},{'model':db[_0x6b17('0x3e')],'as':_0x6b17('0x3f')}]});})[_0x6b17('0x11')](function(_0x29cc5d){if(_0x29cc5d&&_0x29cc5d[_0x6b17('0x3c')]){var _0x14e9ce=_0x29cc5d['get']({'plain':!![]});_0x39afa7[_0x6b17('0x40')]=_0x14e9ce;_0x39afa7[_0x6b17('0x41')]=_0x14e9ce['Applications'];_0x39afa7[_0x6b17('0x42')]=_0x14e9ce[_0x6b17('0x3c')];_0x39afa7[_0x6b17('0x41')]=_[_0x6b17('0x43')](_0x39afa7[_0x6b17('0x41')],[_0x6b17('0x44')],[_0x6b17('0x45')]);if(_0x39afa7[_0x6b17('0x40')][_0x6b17('0x3f')]){delete _0x39afa7[_0x6b17('0x40')][_0x6b17('0x3f')];}if(_0x39afa7[_0x6b17('0x40')][_0x6b17('0x3c')]&&_0x39afa7[_0x6b17('0x40')][_0x6b17('0x3c')]['Contacts'][_0x6b17('0x46')]){return _0x39afa7['account']['List'][_0x6b17('0x47')][0x0];}var _0x128c9c=_[_0x6b17('0xc')](_0xf748f6[_0x6b17('0x28')],{'firstName':_0xf748f6[_0x6b17('0x28')][_0x6b17('0x36')],'ListId':_0x14e9ce[_0x6b17('0x34')]});_0x128c9c[_0xf748f6[_0x6b17('0x28')][_0x6b17('0x38')]]=_0xf748f6[_0x6b17('0x28')][_0x6b17('0x36')];return db[_0x6b17('0x2a')][_0x6b17('0x48')](_0x128c9c,{'fields':_0xdec1fd,'raw':!![]});}})['then'](function(_0x2b90cd){_0x39afa7[_0x6b17('0x49')]=_0x2b90cd;if(_0x2b90cd){var _0x5e31db={'ContactId':_0x2b90cd['id'],'FaxAccountId':_0xf748f6['account']['id'],'fax':_0x2b90cd[_0x6b17('0x29')]};return db['FaxInteraction'][_0x6b17('0x4a')]({'where':{'ContactId':_0x2b90cd['id'],'closed':![],'FaxAccountId':_0xf748f6[_0x6b17('0x40')]['id']}})[_0x6b17('0x11')](function(_0xeb511a){if(_0xeb511a){return[_0xeb511a,![]];}return db[_0x6b17('0x4b')][_0x6b17('0x48')](_0x5e31db)[_0x6b17('0x11')](function(_0x456822){return[_0x456822,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x6b17('0x4c')](function(_0x157cee,_0x24f5bb){var _0x1215a8=_0x157cee['get']({'plain':!![]});if(_0x24f5bb){if(_0x39afa7[_0x6b17('0x40')][_0x6b17('0x4d')]){_0x39afa7[_0x6b17('0x41')][_0x6b17('0x4e')]({'id':0x0,'priority':_0x39afa7[_0x6b17('0x41')][_0x6b17('0x46')]+0x1,'app':_0x6b17('0x4f'),'appdata':_0x6b17('0x50'),'interval':'*,*,*,*'});}_0x1215a8[_0x6b17('0x51')]=!![];}else{_0x1215a8[_0x6b17('0x51')]=![];}_0x39afa7[_0x6b17('0x52')]=_0x1215a8;return db['FaxMessage']['create']({'body':_0xf748f6[_0x6b17('0x28')]['body'],'FaxAccountId':_0xf748f6[_0x6b17('0x40')]['id'],'FaxInteractionId':_0x157cee['id'],'direction':'in','ContactId':_0x157cee['ContactId'],'AttachmentId':_0xf748f6['body'][_0x6b17('0x53')]});})[_0x6b17('0x11')](function(_0x56acd9){_0x39afa7[_0x6b17('0x19')]=_0x56acd9;if(_0x39afa7[_0x6b17('0x52')]['UserId']){return db[_0x6b17('0x54')]['find']({'attributes':['id',_0x6b17('0x55')],'where':{'id':_0x39afa7[_0x6b17('0x52')]['UserId']}})[_0x6b17('0x11')](function(_0x422af0){if(_0x422af0){_0x39afa7['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x422af0[_0x6b17('0x55')]+','+(_0x39afa7['account']['waitForTheAssignedAgent']||0xa),'interval':_0x6b17('0x56')});}return respondWithRpcPromise(_0x6b17('0x57'),_0x6b17('0x58'),_0x39afa7);});}return respondWithRpcPromise(_0x6b17('0x57'),'startRouting',_0x39afa7);})[_0x6b17('0x11')](function(_0x1116b6){_0x1069df(_0x1116b6);})[_0x6b17('0x1c')](function(_0x519dc8){_0x1161c6(_0x477438['error'](0x1f4,_0x519dc8[_0x6b17('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index ddc350b..091a85e 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 _0xb4d7=['faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2c9280,_0x10985d){var _0x10db87=function(_0x359bed){while(--_0x359bed){_0x2c9280['push'](_0x2c9280['shift']());}};_0x10db87(++_0x10985d);}(_0xb4d7,0x64));var _0x7b4d=function(_0x97d228,_0x639770){_0x97d228=_0x97d228-0x0;var _0x47c6a5=_0xb4d7[_0x97d228];return _0x47c6a5;};'use strict';var FaxAccountEvents=require(_0x7b4d('0x0'));var events=[_0x7b4d('0x1'),_0x7b4d('0x2'),_0x7b4d('0x3')];function createListener(_0x4df439,_0x23e3a6){return function(_0x421a84){_0x23e3a6[_0x7b4d('0x4')](_0x4df439,_0x421a84);};}function removeListener(_0x19c203,_0x47b3f5){return function(){FaxAccountEvents[_0x7b4d('0x5')](_0x19c203,_0x47b3f5);};}exports[_0x7b4d('0x6')]=function(_0x207e11){for(var _0x18118b=0x0,_0x4f6f1b=events[_0x7b4d('0x7')];_0x18118b<_0x4f6f1b;_0x18118b++){var _0x157586=events[_0x18118b];var _0x232cf1=createListener(_0x7b4d('0x8')+_0x157586,_0x207e11);FaxAccountEvents['on'](_0x157586,_0x232cf1);}}; \ No newline at end of file +var _0xc8b0=['remove','emit','removeListener','length','faxAccount:','./faxAccount.events','save'];(function(_0xcacaa8,_0x16505d){var _0x49bd4d=function(_0x2ab512){while(--_0x2ab512){_0xcacaa8['push'](_0xcacaa8['shift']());}};_0x49bd4d(++_0x16505d);}(_0xc8b0,0x11d));var _0x0c8b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc8b0[_0x2dafbe];return _0x58a45a;};'use strict';var FaxAccountEvents=require(_0x0c8b('0x0'));var events=[_0x0c8b('0x1'),_0x0c8b('0x2'),'update'];function createListener(_0x334b7c,_0x55d94a){return function(_0x1d0b5f){_0x55d94a[_0x0c8b('0x3')](_0x334b7c,_0x1d0b5f);};}function removeListener(_0x4b5b7c,_0x510b14){return function(){FaxAccountEvents[_0x0c8b('0x4')](_0x4b5b7c,_0x510b14);};}exports['register']=function(_0x2fe2f7){for(var _0x537c95=0x0,_0x41ecad=events[_0x0c8b('0x5')];_0x537c95<_0x41ecad;_0x537c95++){var _0x48dd5f=events[_0x537c95];var _0x263a8d=createListener(_0x0c8b('0x6')+_0x48dd5f,_0x2fe2f7);FaxAccountEvents['on'](_0x48dd5f,_0x263a8d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0a18af0..c06c143 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x36df03,_0xdb48d6){var _0x55ef09=function(_0x51e028){while(--_0x51e028){_0x36df03['push'](_0x36df03['shift']());}};_0x55ef09(++_0xdb48d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x36be0a,_0x44b257){var _0xee76a5=function(_0x2254f8){while(--_0x2254f8){_0x36be0a['push'](_0x36be0a['shift']());}};_0xee76a5(++_0x44b257);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 3383428..2f6f195 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 _0x4210=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2b550e,_0x47ed6d){var _0x545551=function(_0xa3fa17){while(--_0xa3fa17){_0x2b550e['push'](_0x2b550e['shift']());}};_0x545551(++_0x47ed6d);}(_0x4210,0x12b));var _0x0421=function(_0x10fa74,_0x1753bf){_0x10fa74=_0x10fa74-0x0;var _0x40d62a=_0x4210[_0x10fa74];return _0x40d62a;};'use strict';var Sequelize=require(_0x0421('0x0'));module[_0x0421('0x1')]={'priority':{'type':Sequelize[_0x0421('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0421('0x3')],'allowNull':![],'defaultValue':_0x0421('0x4')},'appdata':{'type':Sequelize[_0x0421('0x5')]()},'description':{'type':Sequelize[_0x0421('0x3')]},'interval':{'type':Sequelize[_0x0421('0x3')],'defaultValue':_0x0421('0x6')}}; \ No newline at end of file +var _0xd882=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0xd882,0xfb));var _0x2d88=function(_0x50859e,_0x2c958a){_0x50859e=_0x50859e-0x0;var _0x5847a2=_0xd882[_0x50859e];return _0x5847a2;};'use strict';var Sequelize=require(_0x2d88('0x0'));module[_0x2d88('0x1')]={'priority':{'type':Sequelize[_0x2d88('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2d88('0x3')],'allowNull':![],'defaultValue':_0x2d88('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2d88('0x3')],'defaultValue':_0x2d88('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 40b8655..9ddcf3e 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 _0x1d36=['findAll','catch','show','params','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','map','FaxApplication','rawAttributes','fieldName','type','key','name','keys','intersection','query','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x262457,_0x5e57f7){var _0x10d539=function(_0xe860c4){while(--_0xe860c4){_0x262457['push'](_0x262457['shift']());}};_0x10d539(++_0x5e57f7);}(_0x1d36,0x12e));var _0x61d3=function(_0x315e8f,_0x5a663f){_0x315e8f=_0x315e8f-0x0;var _0x4decf2=_0x1d36[_0x315e8f];return _0x4decf2;};'use strict';var emlformat=require(_0x61d3('0x0'));var rimraf=require(_0x61d3('0x1'));var zipdir=require(_0x61d3('0x2'));var jsonpatch=require(_0x61d3('0x3'));var rp=require(_0x61d3('0x4'));var moment=require(_0x61d3('0x5'));var BPromise=require(_0x61d3('0x6'));var Mustache=require(_0x61d3('0x7'));var util=require(_0x61d3('0x8'));var path=require(_0x61d3('0x9'));var sox=require(_0x61d3('0xa'));var csv=require(_0x61d3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61d3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x61d3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x61d3('0xe'));var toCsv=require(_0x61d3('0xb'));var querystring=require(_0x61d3('0xf'));var Papa=require('papaparse');var Redis=require(_0x61d3('0x10'));var authService=require(_0x61d3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x61d3('0x12'));var hardwareService=require(_0x61d3('0x13'));var logger=require(_0x61d3('0x14'))('api');var utils=require(_0x61d3('0x15'));var config=require(_0x61d3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x61d3('0x17'))['db'];function respondWithStatusCode(_0x43bfdd,_0xb7f441){_0xb7f441=_0xb7f441||0xcc;return function(_0x5fb3fc){if(_0x5fb3fc){return _0x43bfdd[_0x61d3('0x18')](_0xb7f441);}return _0x43bfdd['status'](_0xb7f441)[_0x61d3('0x19')]();};}function respondWithResult(_0x1bc6f5,_0x4babea){_0x4babea=_0x4babea||0xc8;return function(_0x1e0c56){if(_0x1e0c56){return _0x1bc6f5[_0x61d3('0x1a')](_0x4babea)['json'](_0x1e0c56);}};}function respondWithFilteredResult(_0x2fb3d3,_0x9191ab){return function(_0x21f1fa){if(_0x21f1fa){var _0x3fdade=typeof _0x9191ab[_0x61d3('0x1b')]==='undefined'&&typeof _0x9191ab['limit']===_0x61d3('0x1c');var _0x20c38b=_0x21f1fa[_0x61d3('0x1d')];var _0x355f8b=_0x3fdade?0x0:_0x9191ab[_0x61d3('0x1b')];var _0x1745ed=_0x3fdade?_0x21f1fa[_0x61d3('0x1d')]:_0x9191ab[_0x61d3('0x1b')]+_0x9191ab['limit'];var _0x4eca01;if(_0x1745ed>=_0x20c38b){_0x1745ed=_0x20c38b;_0x4eca01=0xc8;}else{_0x4eca01=0xce;}_0x2fb3d3[_0x61d3('0x1a')](_0x4eca01);return _0x2fb3d3[_0x61d3('0x1e')](_0x61d3('0x1f'),_0x355f8b+'-'+_0x1745ed+'/'+_0x20c38b)[_0x61d3('0x20')](_0x21f1fa);}return null;};}function patchUpdates(_0x687ada){return function(_0x1c8989){try{jsonpatch[_0x61d3('0x21')](_0x1c8989,_0x687ada,!![]);}catch(_0x5419e5){return BPromise[_0x61d3('0x22')](_0x5419e5);}return _0x1c8989['save']();};}function saveUpdates(_0x58f79f,_0x1cabe9){return function(_0x5aae42){if(_0x5aae42){return _0x5aae42[_0x61d3('0x23')](_0x58f79f)[_0x61d3('0x24')](function(_0x54b0ae){return _0x54b0ae;});}return null;};}function removeEntity(_0x4ff484,_0x18cc4a){return function(_0x6ea6a4){if(_0x6ea6a4){return _0x6ea6a4[_0x61d3('0x25')]()[_0x61d3('0x24')](function(){_0x4ff484['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2401ea,_0x18036b){return function(_0x42f58d){if(!_0x42f58d){_0x2401ea[_0x61d3('0x18')](0x194);}return _0x42f58d;};}function handleError(_0x4c7bbc,_0x32160a){_0x32160a=_0x32160a||0x1f4;return function(_0x5b48b9){logger[_0x61d3('0x26')](_0x5b48b9[_0x61d3('0x27')]);if(_0x5b48b9['name']){delete _0x5b48b9['name'];}_0x4c7bbc[_0x61d3('0x1a')](_0x32160a)[_0x61d3('0x28')](_0x5b48b9);};}exports['index']=function(_0x1671f8,_0x4a7c7e){var _0x49a84e={},_0x19eb81={},_0x5df452={'count':0x0,'rows':[]};var _0x50e9e1=_[_0x61d3('0x29')](db[_0x61d3('0x2a')][_0x61d3('0x2b')],function(_0x5b95b1){return{'name':_0x5b95b1[_0x61d3('0x2c')],'type':_0x5b95b1[_0x61d3('0x2d')][_0x61d3('0x2e')]};});_0x19eb81['model']=_[_0x61d3('0x29')](_0x50e9e1,_0x61d3('0x2f'));_0x19eb81['query']=_[_0x61d3('0x30')](_0x1671f8['query']);_0x19eb81['filters']=_[_0x61d3('0x31')](_0x19eb81['model'],_0x19eb81[_0x61d3('0x32')]);_0x49a84e[_0x61d3('0x33')]=_[_0x61d3('0x31')](_0x19eb81['model'],qs[_0x61d3('0x34')](_0x1671f8[_0x61d3('0x32')][_0x61d3('0x34')]));_0x49a84e[_0x61d3('0x33')]=_0x49a84e[_0x61d3('0x33')][_0x61d3('0x35')]?_0x49a84e[_0x61d3('0x33')]:_0x19eb81[_0x61d3('0x36')];if(!_0x1671f8[_0x61d3('0x32')][_0x61d3('0x37')](_0x61d3('0x38'))){_0x49a84e[_0x61d3('0x39')]=qs[_0x61d3('0x39')](_0x1671f8[_0x61d3('0x32')][_0x61d3('0x39')]);_0x49a84e[_0x61d3('0x1b')]=qs[_0x61d3('0x1b')](_0x1671f8[_0x61d3('0x32')][_0x61d3('0x1b')]);}_0x49a84e[_0x61d3('0x3a')]=qs[_0x61d3('0x3b')](_0x1671f8[_0x61d3('0x32')][_0x61d3('0x3b')]);_0x49a84e[_0x61d3('0x3c')]=qs[_0x61d3('0x3d')](_['pick'](_0x1671f8[_0x61d3('0x32')],_0x19eb81[_0x61d3('0x3d')]),_0x50e9e1);if(_0x1671f8[_0x61d3('0x32')][_0x61d3('0x3e')]){_0x49a84e[_0x61d3('0x3c')]=_['merge'](_0x49a84e[_0x61d3('0x3c')],{'$or':_[_0x61d3('0x29')](_0x50e9e1,function(_0x588200){if(_0x588200['type']!==_0x61d3('0x3f')){var _0x40184a={};_0x40184a[_0x588200['name']]={'$like':'%'+_0x1671f8[_0x61d3('0x32')][_0x61d3('0x3e')]+'%'};return _0x40184a;}})});}_0x49a84e=_[_0x61d3('0x40')]({},_0x49a84e,_0x1671f8[_0x61d3('0x41')]);var _0x338301={'where':_0x49a84e['where']};return db[_0x61d3('0x2a')][_0x61d3('0x1d')](_0x338301)['then'](function(_0x30cb1c){_0x5df452[_0x61d3('0x1d')]=_0x30cb1c;if(_0x1671f8[_0x61d3('0x32')][_0x61d3('0x42')]){_0x49a84e[_0x61d3('0x43')]=[{'all':!![]}];}return db[_0x61d3('0x2a')][_0x61d3('0x44')](_0x49a84e);})[_0x61d3('0x24')](function(_0x680055){_0x5df452['rows']=_0x680055;return _0x5df452;})[_0x61d3('0x24')](respondWithFilteredResult(_0x4a7c7e,_0x49a84e))[_0x61d3('0x45')](handleError(_0x4a7c7e,null));};exports[_0x61d3('0x46')]=function(_0x389f76,_0x1381ff){var _0x492bc1={'raw':!![],'where':{'id':_0x389f76[_0x61d3('0x47')]['id']}},_0x4139aa={};_0x4139aa['model']=_['keys'](db[_0x61d3('0x2a')]['rawAttributes']);_0x4139aa[_0x61d3('0x32')]=_['keys'](_0x389f76[_0x61d3('0x32')]);_0x4139aa[_0x61d3('0x3d')]=_[_0x61d3('0x31')](_0x4139aa['model'],_0x4139aa[_0x61d3('0x32')]);_0x492bc1[_0x61d3('0x33')]=_[_0x61d3('0x31')](_0x4139aa['model'],qs[_0x61d3('0x34')](_0x389f76['query']['fields']));_0x492bc1[_0x61d3('0x33')]=_0x492bc1[_0x61d3('0x33')][_0x61d3('0x35')]?_0x492bc1[_0x61d3('0x33')]:_0x4139aa[_0x61d3('0x36')];if(_0x389f76[_0x61d3('0x32')][_0x61d3('0x42')]){_0x492bc1[_0x61d3('0x43')]=[{'all':!![]}];}_0x492bc1=_[_0x61d3('0x40')]({},_0x492bc1,_0x389f76[_0x61d3('0x41')]);return db[_0x61d3('0x2a')]['find'](_0x492bc1)[_0x61d3('0x24')](handleEntityNotFound(_0x1381ff,null))['then'](respondWithResult(_0x1381ff,null))['catch'](handleError(_0x1381ff,null));};exports[_0x61d3('0x48')]=function(_0x20b8e2,_0x29e998){return db[_0x61d3('0x2a')][_0x61d3('0x48')](_0x20b8e2[_0x61d3('0x49')],{})[_0x61d3('0x24')](respondWithResult(_0x29e998,0xc9))[_0x61d3('0x45')](handleError(_0x29e998,null));};exports[_0x61d3('0x23')]=function(_0x46c537,_0x137815){if(_0x46c537['body']['id']){delete _0x46c537['body']['id'];}return db[_0x61d3('0x2a')]['find']({'where':{'id':_0x46c537['params']['id']}})['then'](handleEntityNotFound(_0x137815,null))[_0x61d3('0x24')](saveUpdates(_0x46c537[_0x61d3('0x49')],null))[_0x61d3('0x24')](respondWithResult(_0x137815,null))[_0x61d3('0x45')](handleError(_0x137815,null));};exports['destroy']=function(_0x3998f3,_0xde630){return db[_0x61d3('0x2a')]['find']({'where':{'id':_0x3998f3[_0x61d3('0x47')]['id']}})['then'](handleEntityNotFound(_0xde630,null))['then'](removeEntity(_0xde630,null))[_0x61d3('0x45')](handleError(_0xde630,null));}; \ No newline at end of file +var _0xc87c=['find','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','rows','catch','show','params','create','body'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xc87c,0x119));var _0xcc87=function(_0x286118,_0x2cff53){_0x286118=_0x286118-0x0;var _0x5f0d01=_0xc87c[_0x286118];return _0x5f0d01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc87('0x0'));var zipdir=require(_0xcc87('0x1'));var jsonpatch=require(_0xcc87('0x2'));var rp=require(_0xcc87('0x3'));var moment=require(_0xcc87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcc87('0x5'));var util=require('util');var path=require(_0xcc87('0x6'));var sox=require(_0xcc87('0x7'));var csv=require('to-csv');var ejs=require(_0xcc87('0x8'));var fs=require('fs');var fs_extra=require(_0xcc87('0x9'));var _=require(_0xcc87('0xa'));var squel=require('squel');var crypto=require(_0xcc87('0xb'));var jsforce=require(_0xcc87('0xc'));var deskjs=require(_0xcc87('0xd'));var toCsv=require(_0xcc87('0xe'));var querystring=require(_0xcc87('0xf'));var Papa=require(_0xcc87('0x10'));var Redis=require(_0xcc87('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc87('0x12'));var as=require(_0xcc87('0x13'));var hardwareService=require(_0xcc87('0x14'));var logger=require('../../config/logger')(_0xcc87('0x15'));var utils=require(_0xcc87('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc87('0x17'));var db=require(_0xcc87('0x18'))['db'];function respondWithStatusCode(_0x46844b,_0x348e48){_0x348e48=_0x348e48||0xcc;return function(_0x498f12){if(_0x498f12){return _0x46844b[_0xcc87('0x19')](_0x348e48);}return _0x46844b[_0xcc87('0x1a')](_0x348e48)[_0xcc87('0x1b')]();};}function respondWithResult(_0xda9498,_0x3b556a){_0x3b556a=_0x3b556a||0xc8;return function(_0x203971){if(_0x203971){return _0xda9498[_0xcc87('0x1a')](_0x3b556a)['json'](_0x203971);}};}function respondWithFilteredResult(_0x4275e0,_0x10c986){return function(_0x200698){if(_0x200698){var _0xa3e183=typeof _0x10c986[_0xcc87('0x1c')]===_0xcc87('0x1d')&&typeof _0x10c986[_0xcc87('0x1e')]==='undefined';var _0x9db3ee=_0x200698[_0xcc87('0x1f')];var _0x55fbb1=_0xa3e183?0x0:_0x10c986[_0xcc87('0x1c')];var _0x2d3a2b=_0xa3e183?_0x200698[_0xcc87('0x1f')]:_0x10c986[_0xcc87('0x1c')]+_0x10c986[_0xcc87('0x1e')];var _0x165cf0;if(_0x2d3a2b>=_0x9db3ee){_0x2d3a2b=_0x9db3ee;_0x165cf0=0xc8;}else{_0x165cf0=0xce;}_0x4275e0[_0xcc87('0x1a')](_0x165cf0);return _0x4275e0['set'](_0xcc87('0x20'),_0x55fbb1+'-'+_0x2d3a2b+'/'+_0x9db3ee)['json'](_0x200698);}return null;};}function patchUpdates(_0x1eb0e2){return function(_0x80fcbe){try{jsonpatch[_0xcc87('0x21')](_0x80fcbe,_0x1eb0e2,!![]);}catch(_0x551a6f){return BPromise[_0xcc87('0x22')](_0x551a6f);}return _0x80fcbe['save']();};}function saveUpdates(_0x123af3,_0x2626c8){return function(_0x4b0039){if(_0x4b0039){return _0x4b0039[_0xcc87('0x23')](_0x123af3)[_0xcc87('0x24')](function(_0x287594){return _0x287594;});}return null;};}function removeEntity(_0x36dcb6,_0x5ea830){return function(_0x3227a7){if(_0x3227a7){return _0x3227a7[_0xcc87('0x25')]()['then'](function(){_0x36dcb6['status'](0xcc)[_0xcc87('0x1b')]();});}};}function handleEntityNotFound(_0x23a97d,_0x4d3227){return function(_0x10a2b2){if(!_0x10a2b2){_0x23a97d[_0xcc87('0x19')](0x194);}return _0x10a2b2;};}function handleError(_0x33e500,_0x49f066){_0x49f066=_0x49f066||0x1f4;return function(_0x47a006){logger['error'](_0x47a006[_0xcc87('0x26')]);if(_0x47a006[_0xcc87('0x27')]){delete _0x47a006[_0xcc87('0x27')];}_0x33e500[_0xcc87('0x1a')](_0x49f066)[_0xcc87('0x28')](_0x47a006);};}exports['index']=function(_0x367387,_0x36a4d5){var _0x16b104={},_0x3ac19e={},_0x485b2d={'count':0x0,'rows':[]};var _0x203cc1=_[_0xcc87('0x29')](db[_0xcc87('0x2a')][_0xcc87('0x2b')],function(_0x3b1973){return{'name':_0x3b1973[_0xcc87('0x2c')],'type':_0x3b1973['type'][_0xcc87('0x2d')]};});_0x3ac19e[_0xcc87('0x2e')]=_[_0xcc87('0x29')](_0x203cc1,_0xcc87('0x27'));_0x3ac19e[_0xcc87('0x2f')]=_[_0xcc87('0x30')](_0x367387[_0xcc87('0x2f')]);_0x3ac19e[_0xcc87('0x31')]=_[_0xcc87('0x32')](_0x3ac19e['model'],_0x3ac19e[_0xcc87('0x2f')]);_0x16b104[_0xcc87('0x33')]=_[_0xcc87('0x32')](_0x3ac19e['model'],qs[_0xcc87('0x34')](_0x367387[_0xcc87('0x2f')][_0xcc87('0x34')]));_0x16b104[_0xcc87('0x33')]=_0x16b104['attributes']['length']?_0x16b104[_0xcc87('0x33')]:_0x3ac19e[_0xcc87('0x2e')];if(!_0x367387[_0xcc87('0x2f')]['hasOwnProperty'](_0xcc87('0x35'))){_0x16b104[_0xcc87('0x1e')]=qs[_0xcc87('0x1e')](_0x367387[_0xcc87('0x2f')]['limit']);_0x16b104[_0xcc87('0x1c')]=qs[_0xcc87('0x1c')](_0x367387[_0xcc87('0x2f')]['offset']);}_0x16b104[_0xcc87('0x36')]=qs[_0xcc87('0x37')](_0x367387['query'][_0xcc87('0x37')]);_0x16b104[_0xcc87('0x38')]=qs[_0xcc87('0x31')](_[_0xcc87('0x39')](_0x367387[_0xcc87('0x2f')],_0x3ac19e[_0xcc87('0x31')]),_0x203cc1);if(_0x367387[_0xcc87('0x2f')][_0xcc87('0x3a')]){_0x16b104['where']=_[_0xcc87('0x3b')](_0x16b104[_0xcc87('0x38')],{'$or':_[_0xcc87('0x29')](_0x203cc1,function(_0x494c52){if(_0x494c52[_0xcc87('0x3c')]!=='VIRTUAL'){var _0x312de1={};_0x312de1[_0x494c52[_0xcc87('0x27')]]={'$like':'%'+_0x367387[_0xcc87('0x2f')][_0xcc87('0x3a')]+'%'};return _0x312de1;}})});}_0x16b104=_[_0xcc87('0x3b')]({},_0x16b104,_0x367387[_0xcc87('0x3d')]);var _0x340fe5={'where':_0x16b104[_0xcc87('0x38')]};return db[_0xcc87('0x2a')][_0xcc87('0x1f')](_0x340fe5)['then'](function(_0x1046da){_0x485b2d[_0xcc87('0x1f')]=_0x1046da;if(_0x367387[_0xcc87('0x2f')][_0xcc87('0x3e')]){_0x16b104['include']=[{'all':!![]}];}return db[_0xcc87('0x2a')]['findAll'](_0x16b104);})[_0xcc87('0x24')](function(_0x3ef9d9){_0x485b2d[_0xcc87('0x3f')]=_0x3ef9d9;return _0x485b2d;})['then'](respondWithFilteredResult(_0x36a4d5,_0x16b104))[_0xcc87('0x40')](handleError(_0x36a4d5,null));};exports[_0xcc87('0x41')]=function(_0x263c2c,_0x4aa1b8){var _0x2213a2={'raw':!![],'where':{'id':_0x263c2c[_0xcc87('0x42')]['id']}},_0x47db28={};_0x47db28[_0xcc87('0x2e')]=_['keys'](db[_0xcc87('0x2a')][_0xcc87('0x2b')]);_0x47db28['query']=_[_0xcc87('0x30')](_0x263c2c[_0xcc87('0x2f')]);_0x47db28['filters']=_[_0xcc87('0x32')](_0x47db28[_0xcc87('0x2e')],_0x47db28[_0xcc87('0x2f')]);_0x2213a2[_0xcc87('0x33')]=_[_0xcc87('0x32')](_0x47db28['model'],qs[_0xcc87('0x34')](_0x263c2c['query']['fields']));_0x2213a2[_0xcc87('0x33')]=_0x2213a2['attributes']['length']?_0x2213a2['attributes']:_0x47db28[_0xcc87('0x2e')];if(_0x263c2c[_0xcc87('0x2f')]['includeAll']){_0x2213a2['include']=[{'all':!![]}];}_0x2213a2=_['merge']({},_0x2213a2,_0x263c2c['options']);return db[_0xcc87('0x2a')]['find'](_0x2213a2)['then'](handleEntityNotFound(_0x4aa1b8,null))[_0xcc87('0x24')](respondWithResult(_0x4aa1b8,null))['catch'](handleError(_0x4aa1b8,null));};exports[_0xcc87('0x43')]=function(_0x136b68,_0x3ed9cd){return db[_0xcc87('0x2a')][_0xcc87('0x43')](_0x136b68[_0xcc87('0x44')],{})[_0xcc87('0x24')](respondWithResult(_0x3ed9cd,0xc9))[_0xcc87('0x40')](handleError(_0x3ed9cd,null));};exports[_0xcc87('0x23')]=function(_0x50dfd9,_0x14b99e){if(_0x50dfd9[_0xcc87('0x44')]['id']){delete _0x50dfd9['body']['id'];}return db['FaxApplication'][_0xcc87('0x45')]({'where':{'id':_0x50dfd9[_0xcc87('0x42')]['id']}})[_0xcc87('0x24')](handleEntityNotFound(_0x14b99e,null))[_0xcc87('0x24')](saveUpdates(_0x50dfd9[_0xcc87('0x44')],null))['then'](respondWithResult(_0x14b99e,null))[_0xcc87('0x40')](handleError(_0x14b99e,null));};exports[_0xcc87('0x25')]=function(_0x2eaa99,_0x32b0a3){return db['FaxApplication']['find']({'where':{'id':_0x2eaa99['params']['id']}})[_0xcc87('0x24')](handleEntityNotFound(_0x32b0a3,null))['then'](removeEntity(_0x32b0a3,null))[_0xcc87('0x40')](handleError(_0x32b0a3,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 452caf7..9ddcde1 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 _0xaa38=['request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','utf8mb4','lodash','api','moment','bluebird'];(function(_0x544d2a,_0x10aca1){var _0x3dc667=function(_0x4ef53d){while(--_0x4ef53d){_0x544d2a['push'](_0x544d2a['shift']());}};_0x3dc667(++_0x10aca1);}(_0xaa38,0x80));var _0x8aa3=function(_0x53cad4,_0x54a6dd){_0x53cad4=_0x53cad4-0x0;var _0x24b578=_0xaa38[_0x53cad4];return _0x24b578;};'use strict';var _=require(_0x8aa3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8aa3('0x1'));var moment=require(_0x8aa3('0x2'));var BPromise=require(_0x8aa3('0x3'));var rp=require(_0x8aa3('0x4'));var fs=require('fs');var path=require(_0x8aa3('0x5'));var rimraf=require(_0x8aa3('0x6'));var config=require(_0x8aa3('0x7'));var attributes=require(_0x8aa3('0x8'));module[_0x8aa3('0x9')]=function(_0x592967,_0x5e359f){return _0x592967[_0x8aa3('0xa')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aa3('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3f1c=['../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3f1c,0x1b9));var _0xc3f1=function(_0x4745a2,_0x196d86){_0x4745a2=_0x4745a2-0x0;var _0x4fa375=_0x3f1c[_0x4745a2];return _0x4fa375;};'use strict';var _=require(_0xc3f1('0x0'));var util=require(_0xc3f1('0x1'));var logger=require(_0xc3f1('0x2'))(_0xc3f1('0x3'));var moment=require(_0xc3f1('0x4'));var BPromise=require(_0xc3f1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3f1('0x6'));var rimraf=require('rimraf');var config=require(_0xc3f1('0x7'));var attributes=require(_0xc3f1('0x8'));module[_0xc3f1('0x9')]=function(_0x168448,_0x918671){return _0x168448[_0xc3f1('0xa')](_0xc3f1('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc3f1('0xc'),'collate':_0xc3f1('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index b04f926..a1d5e76 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 _0x3fb1=['body','options','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication'];(function(_0x5f378b,_0x408bf8){var _0x5427ef=function(_0x10d024){while(--_0x10d024){_0x5f378b['push'](_0x5f378b['shift']());}};_0x5427ef(++_0x408bf8);}(_0x3fb1,0x8c));var _0x13fb=function(_0x2529b0,_0x266391){_0x2529b0=_0x2529b0-0x0;var _0x252acc=_0x3fb1[_0x2529b0];return _0x252acc;};'use strict';var _=require(_0x13fb('0x0'));var util=require(_0x13fb('0x1'));var moment=require(_0x13fb('0x2'));var BPromise=require(_0x13fb('0x3'));var rs=require(_0x13fb('0x4'));var fs=require('fs');var Redis=require(_0x13fb('0x5'));var db=require(_0x13fb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13fb('0x7'));var config=require(_0x13fb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x13fb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d9d93,_0x356a04,_0x380f3c){return new BPromise(function(_0x4e5135,_0x5a0642){return client['request'](_0x5d9d93,_0x380f3c)[_0x13fb('0xa')](function(_0x27353d){logger[_0x13fb('0xb')](_0x13fb('0xc'),_0x356a04,_0x13fb('0xd'));logger[_0x13fb('0xe')](_0x13fb('0xf'),_0x356a04,'request\x20sent',JSON[_0x13fb('0x10')](_0x27353d));if(_0x27353d[_0x13fb('0x11')]){if(_0x27353d[_0x13fb('0x11')]['code']===0x1f4){logger[_0x13fb('0x11')](_0x13fb('0xc'),_0x356a04,_0x27353d['error']['message']);return _0x5a0642(_0x27353d[_0x13fb('0x11')][_0x13fb('0x12')]);}logger['error'](_0x13fb('0xc'),_0x356a04,_0x27353d['error']['message']);return _0x4e5135(_0x27353d[_0x13fb('0x11')]['message']);}else{logger['info'](_0x13fb('0xc'),_0x356a04,_0x13fb('0xd'));_0x4e5135(_0x27353d[_0x13fb('0x13')][_0x13fb('0x12')]);}})[_0x13fb('0x14')](function(_0x17262e){logger[_0x13fb('0x11')](_0x13fb('0xc'),_0x356a04,_0x17262e);_0x5a0642(_0x17262e);});});}exports[_0x13fb('0x15')]=function(_0x306748){var _0x55f14a=this;return new Promise(function(_0x350c08,_0x4b3029){return db['FaxApplication']['update'](_0x306748[_0x13fb('0x16')],{'raw':_0x306748[_0x13fb('0x17')]?_0x306748[_0x13fb('0x17')][_0x13fb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x306748[_0x13fb('0x17')]?_0x306748['options']['where']||null:null,'attributes':_0x306748[_0x13fb('0x17')]?_0x306748[_0x13fb('0x17')][_0x13fb('0x19')]||null:null,'limit':_0x306748[_0x13fb('0x17')]?_0x306748['options'][_0x13fb('0x1a')]||null:null})['then'](function(_0xb3a4df){logger[_0x13fb('0xb')](_0x13fb('0x15'),_0x306748);logger['debug']('UpdateFaxApplication',_0x306748,JSON[_0x13fb('0x10')](_0xb3a4df));_0x350c08(_0xb3a4df);})[_0x13fb('0x14')](function(_0x137bd1){logger['error'](_0x13fb('0x15'),_0x137bd1[_0x13fb('0x12')],_0x306748);_0x4b3029(_0x55f14a[_0x13fb('0x11')](0x1f4,_0x137bd1['message']));});});}; \ No newline at end of file +var _0xa0f1=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa0f1,0x199));var _0x1a0f=function(_0x27e4ba,_0x479751){_0x27e4ba=_0x27e4ba-0x0;var _0x53547b=_0xa0f1[_0x27e4ba];return _0x53547b;};'use strict';var _=require(_0x1a0f('0x0'));var util=require(_0x1a0f('0x1'));var moment=require(_0x1a0f('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a0f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a0f('0x4'))['db'];var utils=require(_0x1a0f('0x5'));var logger=require(_0x1a0f('0x6'))(_0x1a0f('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a0f('0x8'));var client=jayson[_0x1a0f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ad91d,_0x59144e,_0x58570a){return new BPromise(function(_0x510465,_0x4c5a6a){return client['request'](_0x2ad91d,_0x58570a)['then'](function(_0x53b1d7){logger[_0x1a0f('0xa')](_0x1a0f('0xb'),_0x59144e,_0x1a0f('0xc'));logger[_0x1a0f('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x59144e,_0x1a0f('0xc'),JSON[_0x1a0f('0xe')](_0x53b1d7));if(_0x53b1d7[_0x1a0f('0xf')]){if(_0x53b1d7[_0x1a0f('0xf')][_0x1a0f('0x10')]===0x1f4){logger[_0x1a0f('0xf')](_0x1a0f('0xb'),_0x59144e,_0x53b1d7[_0x1a0f('0xf')][_0x1a0f('0x11')]);return _0x4c5a6a(_0x53b1d7[_0x1a0f('0xf')][_0x1a0f('0x11')]);}logger[_0x1a0f('0xf')](_0x1a0f('0xb'),_0x59144e,_0x53b1d7['error']['message']);return _0x510465(_0x53b1d7[_0x1a0f('0xf')][_0x1a0f('0x11')]);}else{logger[_0x1a0f('0xa')](_0x1a0f('0xb'),_0x59144e,_0x1a0f('0xc'));_0x510465(_0x53b1d7[_0x1a0f('0x12')]['message']);}})[_0x1a0f('0x13')](function(_0x138e97){logger[_0x1a0f('0xf')](_0x1a0f('0xb'),_0x59144e,_0x138e97);_0x4c5a6a(_0x138e97);});});}exports[_0x1a0f('0x14')]=function(_0x45f973){var _0x974995=this;return new Promise(function(_0x147696,_0x135aa6){return db[_0x1a0f('0x15')][_0x1a0f('0x16')](_0x45f973[_0x1a0f('0x17')],{'raw':_0x45f973[_0x1a0f('0x18')]?_0x45f973[_0x1a0f('0x18')][_0x1a0f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f973[_0x1a0f('0x18')]?_0x45f973[_0x1a0f('0x18')][_0x1a0f('0x1a')]||null:null,'attributes':_0x45f973[_0x1a0f('0x18')]?_0x45f973[_0x1a0f('0x18')][_0x1a0f('0x1b')]||null:null,'limit':_0x45f973[_0x1a0f('0x18')]?_0x45f973[_0x1a0f('0x18')][_0x1a0f('0x1c')]||null:null})[_0x1a0f('0x1d')](function(_0x459527){logger[_0x1a0f('0xa')](_0x1a0f('0x14'),_0x45f973);logger[_0x1a0f('0xd')](_0x1a0f('0x14'),_0x45f973,JSON['stringify'](_0x459527));_0x147696(_0x459527);})[_0x1a0f('0x13')](function(_0x593c55){logger[_0x1a0f('0xf')](_0x1a0f('0x14'),_0x593c55[_0x1a0f('0x11')],_0x45f973);_0x135aa6(_0x974995[_0x1a0f('0xf')](0x1f4,_0x593c55[_0x1a0f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 000a527..1605a53 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxApplication.controller'];(function(_0x876ecf,_0x2be287){var _0x2e2e54=function(_0x58bd98){while(--_0x58bd98){_0x876ecf['push'](_0x876ecf['shift']());}};_0x2e2e54(++_0x2be287);}(_0x14a0,0x8e));var _0x014a=function(_0x50d145,_0x4bab6e){_0x50d145=_0x50d145-0x0;var _0x549748=_0x14a0[_0x50d145];return _0x549748;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3423=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','path','connect-timeout','express','Router'];(function(_0x1c7c96,_0x2ab3d2){var _0x5b483d=function(_0x226219){while(--_0x226219){_0x1c7c96['push'](_0x1c7c96['shift']());}};_0x5b483d(++_0x2ab3d2);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0xe')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xf')]);router['put']('/:id',auth[_0x3342('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3342('0x10')]);module[_0x3342('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 94f5ead..909b7a2 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 _0x6aa5=['out','exports','STRING','DATE','ENUM'];(function(_0x4581c9,_0x15026e){var _0x53216b=function(_0x3f7b7a){while(--_0x3f7b7a){_0x4581c9['push'](_0x4581c9['shift']());}};_0x53216b(++_0x15026e);}(_0x6aa5,0x1dc));var _0x56aa=function(_0xf23e58,_0x2a84b4){_0xf23e58=_0xf23e58-0x0;var _0x25dc0c=_0x6aa5[_0xf23e58];return _0x25dc0c;};'use strict';var Sequelize=require('sequelize');module[_0x56aa('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x56aa('0x1')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x56aa('0x2')]},'fax':{'type':Sequelize[_0x56aa('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x56aa('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x56aa('0x3')]('in',_0x56aa('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x1b8e=['out','DATE','sequelize','exports','BOOLEAN','STRING','ENUM'];(function(_0x5da13c,_0x4ef8a4){var _0x27abe4=function(_0x32daf0){while(--_0x32daf0){_0x5da13c['push'](_0x5da13c['shift']());}};_0x27abe4(++_0x4ef8a4);}(_0x1b8e,0x10c));var _0xe1b8=function(_0x861420,_0x1b16dc){_0x861420=_0x861420-0x0;var _0x8a5d8f=_0x1b8e[_0x861420];return _0x8a5d8f;};'use strict';var Sequelize=require(_0xe1b8('0x0'));module[_0xe1b8('0x1')]={'closed':{'type':Sequelize[_0xe1b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe1b8('0x3')]},'secondDisposition':{'type':Sequelize[_0xe1b8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe1b8('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xe1b8('0x4')]('in',_0xe1b8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe1b8('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xe1b8('0x4')]('in',_0xe1b8('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 110d4f1..8b5ef35 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 _0xee92=['set','Content-Range','update','then','stack','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','query','user','catch','params','model','keys','filters','attributes','intersection','fields','length','include','merge','options','find','body','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','format','push','Attachment','Messages','createdAt','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','offset','count','limit'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xee92,0x11f));var _0x2ee9=function(_0x16a519,_0x48ac72){_0x16a519=_0x16a519-0x0;var _0x3c2db6=_0xee92[_0x16a519];return _0x3c2db6;};'use strict';var rimraf=require(_0x2ee9('0x0'));var zipdir=require(_0x2ee9('0x1'));var moment=require(_0x2ee9('0x2'));var BPromise=require(_0x2ee9('0x3'));var util=require('util');var path=require(_0x2ee9('0x4'));var fs=require('fs');var _=require(_0x2ee9('0x5'));var Redis=require(_0x2ee9('0x6'));var interaction=require(_0x2ee9('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x2ee9('0x8'))(_0x2ee9('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2ee9('0xa')]=_[_0x2ee9('0xb')](config['redis'],{'host':_0x2ee9('0xc'),'port':0x18eb});var socket=require(_0x2ee9('0xd'))(new Redis(config[_0x2ee9('0xa')]));require(_0x2ee9('0xe'))['register'](socket);function respondWithStatusCode(_0x457c1d,_0x4465b7){_0x4465b7=_0x4465b7||0xcc;return function(_0x583013){if(_0x583013){return _0x457c1d[_0x2ee9('0xf')](_0x4465b7);}return _0x457c1d['status'](_0x4465b7)[_0x2ee9('0x10')]();};}function respondWithResult(_0x3db0db,_0x1406b4){_0x1406b4=_0x1406b4||0xc8;return function(_0x7cb8c3){if(_0x7cb8c3){return _0x3db0db[_0x2ee9('0x11')](_0x1406b4)[_0x2ee9('0x12')](_0x7cb8c3);}};}function respondWithFilteredResult(_0x2abf55,_0x4359f3){return function(_0xcb025b){if(_0xcb025b){var _0x11a98a=typeof _0x4359f3[_0x2ee9('0x13')]==='undefined'&&typeof _0x4359f3['limit']==='undefined';var _0x3704ed=_0xcb025b[_0x2ee9('0x14')];var _0x21f25b=_0x11a98a?0x0:_0x4359f3[_0x2ee9('0x13')];var _0x5011e7=_0x11a98a?_0xcb025b[_0x2ee9('0x14')]:_0x4359f3[_0x2ee9('0x13')]+_0x4359f3[_0x2ee9('0x15')];var _0x2784c9;if(_0x5011e7>=_0x3704ed){_0x5011e7=_0x3704ed;_0x2784c9=0xc8;}else{_0x2784c9=0xce;}_0x2abf55[_0x2ee9('0x11')](_0x2784c9);return _0x2abf55[_0x2ee9('0x16')](_0x2ee9('0x17'),_0x21f25b+'-'+_0x5011e7+'/'+_0x3704ed)[_0x2ee9('0x12')](_0xcb025b);}return null;};}function saveUpdates(_0x33e0d5){return function(_0x453180){if(_0x453180){return _0x453180[_0x2ee9('0x18')](_0x33e0d5)[_0x2ee9('0x19')](function(_0x4db3f1){return _0x4db3f1;});}return null;};}function removeEntity(_0x38abfc){return function(_0x482e4e){if(_0x482e4e){return _0x482e4e['destroy']()[_0x2ee9('0x19')](function(){_0x38abfc['status'](0xcc)[_0x2ee9('0x10')]();});}};}function handleEntityNotFound(_0x57de93){return function(_0x5a8389){if(!_0x5a8389){_0x57de93[_0x2ee9('0xf')](0x194);}return _0x5a8389;};}function handleError(_0x51abd6,_0x4e7a7){_0x4e7a7=_0x4e7a7||0x1f4;return function(_0x3d220a){logger['error'](_0x3d220a[_0x2ee9('0x1a')]);if(_0x3d220a['name']){delete _0x3d220a['name'];}_0x51abd6[_0x2ee9('0x11')](_0x4e7a7)[_0x2ee9('0x1b')](_0x3d220a);};}exports[_0x2ee9('0x1c')]=function(_0x1d48bc,_0x9d3f04){var _0x1b29d8={};var _0x59e8da=_[_0x2ee9('0x1d')](db[_0x2ee9('0x1e')][_0x2ee9('0x1f')],function(_0x1c33b8){return{'name':_0x1c33b8[_0x2ee9('0x20')],'type':_0x1c33b8[_0x2ee9('0x21')][_0x2ee9('0x22')]};});_0x1b29d8=qs[_0x2ee9('0x23')](_0x59e8da,_0x1d48bc);return interaction['findAll'](_0x2ee9('0x24'),_0x1d48bc[_0x2ee9('0x25')],_0x1d48bc[_0x2ee9('0x26')],_0x1b29d8,_0x59e8da)['then'](respondWithFilteredResult(_0x9d3f04,_0x1b29d8))[_0x2ee9('0x27')](handleError(_0x9d3f04,null));};exports['show']=function(_0x58d302,_0x2d22b4){var _0x31d051={'raw':![],'where':{'id':_0x58d302[_0x2ee9('0x28')]['id']}},_0x4a298c={};_0x4a298c[_0x2ee9('0x29')]=_[_0x2ee9('0x2a')](db['FaxInteraction'][_0x2ee9('0x1f')]);_0x4a298c[_0x2ee9('0x25')]=_[_0x2ee9('0x2a')](_0x58d302['query']);_0x4a298c[_0x2ee9('0x2b')]=_['intersection'](_0x4a298c[_0x2ee9('0x29')],_0x4a298c['query']);_0x31d051[_0x2ee9('0x2c')]=_[_0x2ee9('0x2d')](_0x4a298c[_0x2ee9('0x29')],qs[_0x2ee9('0x2e')](_0x58d302[_0x2ee9('0x25')][_0x2ee9('0x2e')]));_0x31d051[_0x2ee9('0x2c')]=_0x31d051[_0x2ee9('0x2c')][_0x2ee9('0x2f')]?_0x31d051['attributes']:_0x4a298c[_0x2ee9('0x29')];if(_0x58d302[_0x2ee9('0x25')]['includeAll']){_0x31d051[_0x2ee9('0x30')]=[{'all':!![]}];}_0x31d051=_[_0x2ee9('0x31')]({},_0x31d051,_0x58d302[_0x2ee9('0x32')]);return db[_0x2ee9('0x1e')][_0x2ee9('0x33')](_0x31d051)[_0x2ee9('0x19')](handleEntityNotFound(_0x2d22b4,null))['then'](respondWithResult(_0x2d22b4,null))[_0x2ee9('0x27')](handleError(_0x2d22b4,null));};exports['create']=function(_0x29ea49,_0x1e7a16){return db['FaxInteraction']['create'](_0x29ea49[_0x2ee9('0x34')],{})[_0x2ee9('0x19')](respondWithResult(_0x1e7a16,0xc9))[_0x2ee9('0x27')](handleError(_0x1e7a16,null));};exports[_0x2ee9('0x18')]=function(_0x54678f,_0x30a69a){if(_0x54678f[_0x2ee9('0x34')]['id']){delete _0x54678f['body']['id'];}return db[_0x2ee9('0x1e')][_0x2ee9('0x33')]({'where':{'id':_0x54678f['params']['id']}})['then'](handleEntityNotFound(_0x30a69a,null))['then'](saveUpdates(_0x54678f['body'],null))[_0x2ee9('0x19')](respondWithResult(_0x30a69a,null))['catch'](handleError(_0x30a69a,null));};exports[_0x2ee9('0x35')]=function(_0x4048ce,_0x4e1b50){return db[_0x2ee9('0x1e')][_0x2ee9('0x33')]({'where':{'id':_0x4048ce['params']['id']}})[_0x2ee9('0x19')](handleEntityNotFound(_0x4e1b50,null))[_0x2ee9('0x19')](removeEntity(_0x4e1b50,null))[_0x2ee9('0x27')](handleError(_0x4e1b50,null));};exports['describe']=function(_0x31fab9,_0x5033a7){return db[_0x2ee9('0x1e')][_0x2ee9('0x36')]()[_0x2ee9('0x19')](respondWithResult(_0x5033a7,null))[_0x2ee9('0x27')](handleError(_0x5033a7,null));};exports[_0x2ee9('0x37')]=function(_0x5242b9,_0x2c51f8){return db[_0x2ee9('0x38')][_0x2ee9('0x33')]({'where':{'id':_0x5242b9['params']['id']}})[_0x2ee9('0x19')](handleEntityNotFound(_0x2c51f8,null))['then'](function(_0x234722){if(_0x234722){return _0x234722[_0x2ee9('0x37')](_0x5242b9[_0x2ee9('0x34')][_0x2ee9('0x39')],_[_0x2ee9('0x3a')](_0x5242b9['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2c51f8,null))[_0x2ee9('0x27')](handleError(_0x2c51f8,null));};exports[_0x2ee9('0x3b')]=function(_0x38d27f,_0x377e37){var _0x3d2b73={'raw':![],'where':{}};var _0xf5cea2={};var _0x347a7e={'count':0x0,'rows':[]};return db[_0x2ee9('0x1e')][_0x2ee9('0x3c')]({'where':{'id':_0x38d27f[_0x2ee9('0x28')]['id']}})['then'](handleEntityNotFound(_0x377e37,null))['then'](function(_0x3074d5){if(_0x3074d5){_0xf5cea2[_0x2ee9('0x29')]=_[_0x2ee9('0x2a')](db[_0x2ee9('0x38')][_0x2ee9('0x1f')]);_0xf5cea2[_0x2ee9('0x25')]=_[_0x2ee9('0x2a')](_0x38d27f[_0x2ee9('0x25')]);_0xf5cea2[_0x2ee9('0x2b')]=_['intersection'](_0xf5cea2['model'],_0xf5cea2[_0x2ee9('0x25')]);_0x3d2b73['attributes']=_['intersection'](_0xf5cea2[_0x2ee9('0x29')],qs['fields'](_0x38d27f[_0x2ee9('0x25')]['fields']));_0x3d2b73[_0x2ee9('0x2c')]=_0x3d2b73[_0x2ee9('0x2c')][_0x2ee9('0x2f')]?_0x3d2b73[_0x2ee9('0x2c')]:_0xf5cea2[_0x2ee9('0x29')];if(!_0x38d27f[_0x2ee9('0x25')][_0x2ee9('0x3d')](_0x2ee9('0x3e'))){_0x3d2b73['limit']=qs[_0x2ee9('0x15')](_0x38d27f['query'][_0x2ee9('0x15')]);_0x3d2b73[_0x2ee9('0x13')]=qs[_0x2ee9('0x13')](_0x38d27f[_0x2ee9('0x25')][_0x2ee9('0x13')]);}_0x3d2b73['order']=qs[_0x2ee9('0x3f')](_0x38d27f[_0x2ee9('0x25')][_0x2ee9('0x3f')]);_0x3d2b73[_0x2ee9('0x40')]=qs['filters'](_[_0x2ee9('0x41')](_0x38d27f[_0x2ee9('0x25')],_0xf5cea2['filters']));_0x3d2b73['where'][_0x2ee9('0x42')]=_0x3074d5['id'];if(_0x38d27f[_0x2ee9('0x25')][_0x2ee9('0x43')]){_0x3d2b73[_0x2ee9('0x40')]=_[_0x2ee9('0x31')](_0x3d2b73[_0x2ee9('0x40')],{'$or':_[_0x2ee9('0x1d')](_0x3d2b73[_0x2ee9('0x2c')],function(_0x5e9e54){var _0x265db5={};_0x265db5[_0x5e9e54]={'$like':'%'+_0x38d27f['query'][_0x2ee9('0x43')]+'%'};return _0x265db5;})});}if(_0x38d27f[_0x2ee9('0x25')][_0x2ee9('0x44')]){var _0x33a583=_0x38d27f[_0x2ee9('0x25')]['$gte'][_0x2ee9('0x45')](',');var _0x566372={};_0x566372[_0x33a583[0x0]]={'$gte':moment(_0x33a583[0x1])['format'](_0x2ee9('0x46'))};_0x3d2b73[_0x2ee9('0x40')]=_[_0x2ee9('0x31')](_0x3d2b73[_0x2ee9('0x40')],_0x566372);}_0x3d2b73=_[_0x2ee9('0x31')]({},_0x3d2b73,_0x38d27f['options']);return db[_0x2ee9('0x38')]['count']({'where':_0x3d2b73[_0x2ee9('0x40')]})['then'](function(_0x3dd0ed){_0x347a7e['count']=_0x3dd0ed;if(_0x38d27f[_0x2ee9('0x25')][_0x2ee9('0x47')]){_0x3d2b73[_0x2ee9('0x30')]=[{'all':!![]}];}return db[_0x2ee9('0x38')][_0x2ee9('0x48')](_0x3d2b73);})['then'](function(_0x220ba5){_0x347a7e[_0x2ee9('0x49')]=_0x220ba5;return _0x347a7e;});}})['then'](respondWithFilteredResult(_0x377e37,_0x3d2b73))['catch'](handleError(_0x377e37,null));};exports['addTags']=function(_0x56ea43,_0x32e677){return db[_0x2ee9('0x1e')][_0x2ee9('0x33')]({'where':{'id':_0x56ea43['params']['id']}})[_0x2ee9('0x19')](handleEntityNotFound(_0x32e677,null))[_0x2ee9('0x19')](function(_0x445fca){if(_0x445fca){return _0x445fca[_0x2ee9('0x4a')](_0x56ea43['body'][_0x2ee9('0x39')],_['omit'](_0x56ea43[_0x2ee9('0x34')],[_0x2ee9('0x39'),'id'])||{})[_0x2ee9('0x4b')](function(){return db[_0x2ee9('0x4c')][_0x2ee9('0x48')]({'attributes':['id','name',_0x2ee9('0x4d')],'where':{'id':_0x56ea43['body']['ids']}});})[_0x2ee9('0x19')](function(_0x598f41){socket[_0x2ee9('0x4e')](_0x2ee9('0x4f'),{'id':Number(_0x56ea43[_0x2ee9('0x28')]['id']),'tags':_0x598f41||[]});return{'id':Number(_0x56ea43[_0x2ee9('0x28')]['id']),'tags':_0x598f41||[]};});}})[_0x2ee9('0x19')](respondWithResult(_0x32e677,null))[_0x2ee9('0x27')](handleError(_0x32e677,null));};exports[_0x2ee9('0x50')]=function(_0x3e4115,_0x1e60e8){return db[_0x2ee9('0x1e')][_0x2ee9('0x33')]({'where':{'id':_0x3e4115[_0x2ee9('0x28')]['id']}})[_0x2ee9('0x19')](handleEntityNotFound(_0x1e60e8,null))[_0x2ee9('0x19')](function(_0x16070d){if(_0x16070d){return _0x16070d['removeTags'](_0x3e4115[_0x2ee9('0x25')][_0x2ee9('0x39')]);}})[_0x2ee9('0x19')](respondWithStatusCode(_0x1e60e8,null))[_0x2ee9('0x27')](handleError(_0x1e60e8,null));};exports[_0x2ee9('0x51')]=function(_0x26e97b,_0xd6a0dc){var _0x566495=moment()[_0x2ee9('0x52')]()[_0x2ee9('0x53')]();var _0x22daa6=path[_0x2ee9('0x54')](config[_0x2ee9('0x55')],_0x2ee9('0x56'),_0x2ee9('0x57'),'tmp');var _0x1c2959=path[_0x2ee9('0x54')](config[_0x2ee9('0x55')],_0x2ee9('0x56'),_0x2ee9('0x57'),_0x2ee9('0x58'));var _0x26e204=path[_0x2ee9('0x54')](_0x22daa6,_0x566495);var _0x1eacd0=util[_0x2ee9('0x59')]('transcript-%d-%s.zip',_0x26e97b[_0x2ee9('0x28')]['id'],_0x566495);var _0x1f0260=path['join'](_0x22daa6,_0x1eacd0);var _0x4a6abd=[];_0x4a6abd[_0x2ee9('0x5a')]({'model':db[_0x2ee9('0x5b')],'as':'Attachment','raw':!![]});var _0x4feb9e=[{'model':db[_0x2ee9('0x38')],'as':_0x2ee9('0x5c'),'attributes':['id','body',_0x2ee9('0x5d')],'include':_0x4a6abd}];return db['FaxInteraction'][_0x2ee9('0x33')]({'where':{'id':_0x26e97b[_0x2ee9('0x28')]['id']},'include':_0x4feb9e})[_0x2ee9('0x19')](handleEntityNotFound(_0xd6a0dc,null))['then'](function(_0x5575bb){if(_0x5575bb&&_0x5575bb[_0x2ee9('0x5c')]){var _0x218ec1=_0x5575bb[_0x2ee9('0x5e')]({'plain':!![]});fs[_0x2ee9('0x5f')](_0x26e204);for(var _0x192b4b=0x0;_0x192b4b<_0x218ec1['Messages'][_0x2ee9('0x2f')];_0x192b4b++){var _0x4f13df=_0x218ec1[_0x2ee9('0x5c')][_0x192b4b]['Attachment'];if(_0x4f13df){var _0x7e9669=path[_0x2ee9('0x54')](_0x1c2959,_0x4f13df['basename']);if(fs[_0x2ee9('0x60')](_0x7e9669)){fs[_0x2ee9('0x61')](_0x7e9669)[_0x2ee9('0x62')](fs[_0x2ee9('0x63')](path[_0x2ee9('0x54')](_0x26e204,_0x4f13df['basename'])));}}}return BPromise[_0x2ee9('0x64')]()[_0x2ee9('0x19')](function(){return new BPromise(function(_0x193c1b,_0x3b4833){zipdir(_0x26e204,{'saveTo':_0x1f0260},function(_0xe91924,_0xa8d539){if(_0xe91924)return _0x3b4833(_0xe91924);return _0x193c1b(_0xa8d539);});})['then'](function(){return new BPromise(function(_0x1b47e6,_0x1d319d){rimraf(_0x26e204,function(_0x114d97){if(_0x114d97)_0x1d319d(_0x114d97);return _0x1b47e6();});});})[_0x2ee9('0x19')](function(){return _0xd6a0dc[_0x2ee9('0x51')](_0x1f0260,_0x1eacd0,function(_0x1fab4e){if(_0x1fab4e){console[_0x2ee9('0x65')](_0x2ee9('0x66'),_0x1fab4e);}else{fs['unlinkSync'](_0x1f0260);}});});});}else{return _0xd6a0dc[_0x2ee9('0xf')](0xc8);}})['catch'](handleError(_0xd6a0dc,null));}; \ No newline at end of file +var _0x3530=['root','server','files','tmp','attachments','transcript-%d-%s.zip','Messages','createdAt','mkdirSync','Attachment','basename','pipe','createWriteStream','log','err','zip-dir','bluebird','path','lodash','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','error','stack','name','index','map','FaxInteraction','rawAttributes','key','getOptions','findAll','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','catch','update','describe','addMessage','FaxMessage','ids','getMessages','hasOwnProperty','nolimit','sort','where','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','faxInteractionTags:save','removeTags','download','toString','join'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0x3530,0x183));var _0x0353=function(_0x2c97b9,_0x434261){_0x2c97b9=_0x2c97b9-0x0;var _0x37e866=_0x3530[_0x2c97b9];return _0x37e866;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0353('0x0'));var moment=require('moment');var BPromise=require(_0x0353('0x1'));var util=require('util');var path=require(_0x0353('0x2'));var fs=require('fs');var _=require(_0x0353('0x3'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x0353('0x4'))('api');var config=require(_0x0353('0x5'));var db=require(_0x0353('0x6'))['db'];config['redis']=_[_0x0353('0x7')](config['redis'],{'host':_0x0353('0x8'),'port':0x18eb});var socket=require(_0x0353('0x9'))(new Redis(config[_0x0353('0xa')]));require(_0x0353('0xb'))[_0x0353('0xc')](socket);function respondWithStatusCode(_0x5c5a21,_0x479693){_0x479693=_0x479693||0xcc;return function(_0x1b0aa6){if(_0x1b0aa6){return _0x5c5a21[_0x0353('0xd')](_0x479693);}return _0x5c5a21[_0x0353('0xe')](_0x479693)[_0x0353('0xf')]();};}function respondWithResult(_0x4d249b,_0x41e6a5){_0x41e6a5=_0x41e6a5||0xc8;return function(_0x1821de){if(_0x1821de){return _0x4d249b[_0x0353('0xe')](_0x41e6a5)[_0x0353('0x10')](_0x1821de);}};}function respondWithFilteredResult(_0x1f04dc,_0x1f8f9b){return function(_0x122976){if(_0x122976){var _0xd02176=typeof _0x1f8f9b[_0x0353('0x11')]===_0x0353('0x12')&&typeof _0x1f8f9b[_0x0353('0x13')]===_0x0353('0x12');var _0x51b989=_0x122976['count'];var _0x1f0e40=_0xd02176?0x0:_0x1f8f9b[_0x0353('0x11')];var _0x3886f9=_0xd02176?_0x122976[_0x0353('0x14')]:_0x1f8f9b[_0x0353('0x11')]+_0x1f8f9b[_0x0353('0x13')];var _0x3d5059;if(_0x3886f9>=_0x51b989){_0x3886f9=_0x51b989;_0x3d5059=0xc8;}else{_0x3d5059=0xce;}_0x1f04dc['status'](_0x3d5059);return _0x1f04dc[_0x0353('0x15')]('Content-Range',_0x1f0e40+'-'+_0x3886f9+'/'+_0x51b989)[_0x0353('0x10')](_0x122976);}return null;};}function saveUpdates(_0x1183ec){return function(_0x343c61){if(_0x343c61){return _0x343c61['update'](_0x1183ec)['then'](function(_0x32b1c8){return _0x32b1c8;});}return null;};}function removeEntity(_0x3d0409){return function(_0x591265){if(_0x591265){return _0x591265[_0x0353('0x16')]()[_0x0353('0x17')](function(){_0x3d0409['status'](0xcc)[_0x0353('0xf')]();});}};}function handleEntityNotFound(_0x3aa05e){return function(_0x3fce8b){if(!_0x3fce8b){_0x3aa05e[_0x0353('0xd')](0x194);}return _0x3fce8b;};}function handleError(_0xbcfa37,_0xb2dd14){_0xb2dd14=_0xb2dd14||0x1f4;return function(_0x4a4e96){logger[_0x0353('0x18')](_0x4a4e96[_0x0353('0x19')]);if(_0x4a4e96[_0x0353('0x1a')]){delete _0x4a4e96[_0x0353('0x1a')];}_0xbcfa37[_0x0353('0xe')](_0xb2dd14)['send'](_0x4a4e96);};}exports[_0x0353('0x1b')]=function(_0x159374,_0xee9518){var _0x5befa3={};var _0x4b6d95=_[_0x0353('0x1c')](db[_0x0353('0x1d')][_0x0353('0x1e')],function(_0x500c7c){return{'name':_0x500c7c['fieldName'],'type':_0x500c7c['type'][_0x0353('0x1f')]};});_0x5befa3=qs[_0x0353('0x20')](_0x4b6d95,_0x159374);return interaction[_0x0353('0x21')]('fax',_0x159374[_0x0353('0x22')],_0x159374[_0x0353('0x23')],_0x5befa3,_0x4b6d95)[_0x0353('0x17')](respondWithFilteredResult(_0xee9518,_0x5befa3))['catch'](handleError(_0xee9518,null));};exports[_0x0353('0x24')]=function(_0x190201,_0x7b5280){var _0x5c6931={'raw':![],'where':{'id':_0x190201[_0x0353('0x25')]['id']}},_0xd2ceaa={};_0xd2ceaa[_0x0353('0x26')]=_[_0x0353('0x27')](db[_0x0353('0x1d')][_0x0353('0x1e')]);_0xd2ceaa[_0x0353('0x22')]=_[_0x0353('0x27')](_0x190201[_0x0353('0x22')]);_0xd2ceaa[_0x0353('0x28')]=_[_0x0353('0x29')](_0xd2ceaa[_0x0353('0x26')],_0xd2ceaa[_0x0353('0x22')]);_0x5c6931[_0x0353('0x2a')]=_[_0x0353('0x29')](_0xd2ceaa['model'],qs['fields'](_0x190201[_0x0353('0x22')][_0x0353('0x2b')]));_0x5c6931['attributes']=_0x5c6931['attributes'][_0x0353('0x2c')]?_0x5c6931[_0x0353('0x2a')]:_0xd2ceaa[_0x0353('0x26')];if(_0x190201[_0x0353('0x22')][_0x0353('0x2d')]){_0x5c6931[_0x0353('0x2e')]=[{'all':!![]}];}_0x5c6931=_[_0x0353('0x2f')]({},_0x5c6931,_0x190201['options']);return db[_0x0353('0x1d')][_0x0353('0x30')](_0x5c6931)['then'](handleEntityNotFound(_0x7b5280,null))[_0x0353('0x17')](respondWithResult(_0x7b5280,null))['catch'](handleError(_0x7b5280,null));};exports[_0x0353('0x31')]=function(_0x595ce3,_0x1fb56d){return db[_0x0353('0x1d')][_0x0353('0x31')](_0x595ce3[_0x0353('0x32')],{})[_0x0353('0x17')](respondWithResult(_0x1fb56d,0xc9))[_0x0353('0x33')](handleError(_0x1fb56d,null));};exports[_0x0353('0x34')]=function(_0x1c1561,_0x11efe3){if(_0x1c1561[_0x0353('0x32')]['id']){delete _0x1c1561[_0x0353('0x32')]['id'];}return db[_0x0353('0x1d')][_0x0353('0x30')]({'where':{'id':_0x1c1561[_0x0353('0x25')]['id']}})[_0x0353('0x17')](handleEntityNotFound(_0x11efe3,null))[_0x0353('0x17')](saveUpdates(_0x1c1561[_0x0353('0x32')],null))[_0x0353('0x17')](respondWithResult(_0x11efe3,null))[_0x0353('0x33')](handleError(_0x11efe3,null));};exports[_0x0353('0x16')]=function(_0x47b884,_0x3398a0){return db['FaxInteraction'][_0x0353('0x30')]({'where':{'id':_0x47b884[_0x0353('0x25')]['id']}})[_0x0353('0x17')](handleEntityNotFound(_0x3398a0,null))['then'](removeEntity(_0x3398a0,null))[_0x0353('0x33')](handleError(_0x3398a0,null));};exports[_0x0353('0x35')]=function(_0xe80556,_0x4ca8a9){return db[_0x0353('0x1d')][_0x0353('0x35')]()['then'](respondWithResult(_0x4ca8a9,null))[_0x0353('0x33')](handleError(_0x4ca8a9,null));};exports[_0x0353('0x36')]=function(_0x4eb23f,_0x282ab1){return db[_0x0353('0x37')][_0x0353('0x30')]({'where':{'id':_0x4eb23f[_0x0353('0x25')]['id']}})[_0x0353('0x17')](handleEntityNotFound(_0x282ab1,null))[_0x0353('0x17')](function(_0x293715){if(_0x293715){return _0x293715[_0x0353('0x36')](_0x4eb23f[_0x0353('0x32')][_0x0353('0x38')],_['omit'](_0x4eb23f[_0x0353('0x32')],[_0x0353('0x38'),'id'])||{});}})[_0x0353('0x17')](respondWithResult(_0x282ab1,null))[_0x0353('0x33')](handleError(_0x282ab1,null));};exports[_0x0353('0x39')]=function(_0x191e77,_0x4d0f32){var _0x129c08={'raw':![],'where':{}};var _0x45f602={};var _0xeacc38={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x191e77[_0x0353('0x25')]['id']}})['then'](handleEntityNotFound(_0x4d0f32,null))[_0x0353('0x17')](function(_0x32252e){if(_0x32252e){_0x45f602['model']=_[_0x0353('0x27')](db['FaxMessage']['rawAttributes']);_0x45f602['query']=_[_0x0353('0x27')](_0x191e77[_0x0353('0x22')]);_0x45f602[_0x0353('0x28')]=_[_0x0353('0x29')](_0x45f602['model'],_0x45f602['query']);_0x129c08['attributes']=_[_0x0353('0x29')](_0x45f602['model'],qs[_0x0353('0x2b')](_0x191e77[_0x0353('0x22')]['fields']));_0x129c08[_0x0353('0x2a')]=_0x129c08[_0x0353('0x2a')]['length']?_0x129c08[_0x0353('0x2a')]:_0x45f602['model'];if(!_0x191e77[_0x0353('0x22')][_0x0353('0x3a')](_0x0353('0x3b'))){_0x129c08[_0x0353('0x13')]=qs[_0x0353('0x13')](_0x191e77[_0x0353('0x22')]['limit']);_0x129c08[_0x0353('0x11')]=qs[_0x0353('0x11')](_0x191e77[_0x0353('0x22')][_0x0353('0x11')]);}_0x129c08['order']=qs[_0x0353('0x3c')](_0x191e77['query'][_0x0353('0x3c')]);_0x129c08[_0x0353('0x3d')]=qs['filters'](_['pick'](_0x191e77[_0x0353('0x22')],_0x45f602[_0x0353('0x28')]));_0x129c08[_0x0353('0x3d')][_0x0353('0x3e')]=_0x32252e['id'];if(_0x191e77[_0x0353('0x22')][_0x0353('0x3f')]){_0x129c08[_0x0353('0x3d')]=_[_0x0353('0x2f')](_0x129c08['where'],{'$or':_[_0x0353('0x1c')](_0x129c08[_0x0353('0x2a')],function(_0x70ec24){var _0x22fdcc={};_0x22fdcc[_0x70ec24]={'$like':'%'+_0x191e77['query'][_0x0353('0x3f')]+'%'};return _0x22fdcc;})});}if(_0x191e77[_0x0353('0x22')][_0x0353('0x40')]){var _0x487fb0=_0x191e77[_0x0353('0x22')][_0x0353('0x40')]['split'](',');var _0x57f81f={};_0x57f81f[_0x487fb0[0x0]]={'$gte':moment(_0x487fb0[0x1])[_0x0353('0x41')](_0x0353('0x42'))};_0x129c08[_0x0353('0x3d')]=_[_0x0353('0x2f')](_0x129c08[_0x0353('0x3d')],_0x57f81f);}_0x129c08=_[_0x0353('0x2f')]({},_0x129c08,_0x191e77['options']);return db[_0x0353('0x37')]['count']({'where':_0x129c08[_0x0353('0x3d')]})[_0x0353('0x17')](function(_0x23b50f){_0xeacc38[_0x0353('0x14')]=_0x23b50f;if(_0x191e77[_0x0353('0x22')]['includeAll']){_0x129c08[_0x0353('0x2e')]=[{'all':!![]}];}return db[_0x0353('0x37')][_0x0353('0x21')](_0x129c08);})[_0x0353('0x17')](function(_0x4cb9cb){_0xeacc38[_0x0353('0x43')]=_0x4cb9cb;return _0xeacc38;});}})['then'](respondWithFilteredResult(_0x4d0f32,_0x129c08))[_0x0353('0x33')](handleError(_0x4d0f32,null));};exports[_0x0353('0x44')]=function(_0x4ccb99,_0x1b91f0){return db[_0x0353('0x1d')]['find']({'where':{'id':_0x4ccb99[_0x0353('0x25')]['id']}})[_0x0353('0x17')](handleEntityNotFound(_0x1b91f0,null))[_0x0353('0x17')](function(_0x1236f2){if(_0x1236f2){return _0x1236f2[_0x0353('0x45')](_0x4ccb99[_0x0353('0x32')][_0x0353('0x38')],_[_0x0353('0x46')](_0x4ccb99[_0x0353('0x32')],[_0x0353('0x38'),'id'])||{})[_0x0353('0x47')](function(){return db[_0x0353('0x48')][_0x0353('0x21')]({'attributes':['id',_0x0353('0x1a'),'color'],'where':{'id':_0x4ccb99[_0x0353('0x32')][_0x0353('0x38')]}});})[_0x0353('0x17')](function(_0x540379){socket['emit'](_0x0353('0x49'),{'id':Number(_0x4ccb99['params']['id']),'tags':_0x540379||[]});return{'id':Number(_0x4ccb99[_0x0353('0x25')]['id']),'tags':_0x540379||[]};});}})[_0x0353('0x17')](respondWithResult(_0x1b91f0,null))[_0x0353('0x33')](handleError(_0x1b91f0,null));};exports['removeTags']=function(_0xc3c487,_0x27255a){return db[_0x0353('0x1d')]['find']({'where':{'id':_0xc3c487[_0x0353('0x25')]['id']}})['then'](handleEntityNotFound(_0x27255a,null))[_0x0353('0x17')](function(_0x5e6c35){if(_0x5e6c35){return _0x5e6c35[_0x0353('0x4a')](_0xc3c487[_0x0353('0x22')]['ids']);}})[_0x0353('0x17')](respondWithStatusCode(_0x27255a,null))[_0x0353('0x33')](handleError(_0x27255a,null));};exports[_0x0353('0x4b')]=function(_0x5706e9,_0x1b4181){var _0x47ed97=moment()['unix']()[_0x0353('0x4c')]();var _0x3a668b=path[_0x0353('0x4d')](config[_0x0353('0x4e')],_0x0353('0x4f'),_0x0353('0x50'),_0x0353('0x51'));var _0xb0b7e6=path[_0x0353('0x4d')](config[_0x0353('0x4e')],_0x0353('0x4f'),_0x0353('0x50'),_0x0353('0x52'));var _0x5963fc=path[_0x0353('0x4d')](_0x3a668b,_0x47ed97);var _0x309d37=util[_0x0353('0x41')](_0x0353('0x53'),_0x5706e9[_0x0353('0x25')]['id'],_0x47ed97);var _0x563360=path[_0x0353('0x4d')](_0x3a668b,_0x309d37);var _0x4e88e9=[];_0x4e88e9['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x5c8aa5=[{'model':db[_0x0353('0x37')],'as':_0x0353('0x54'),'attributes':['id','body',_0x0353('0x55')],'include':_0x4e88e9}];return db[_0x0353('0x1d')][_0x0353('0x30')]({'where':{'id':_0x5706e9[_0x0353('0x25')]['id']},'include':_0x5c8aa5})[_0x0353('0x17')](handleEntityNotFound(_0x1b4181,null))['then'](function(_0x208716){if(_0x208716&&_0x208716['Messages']){var _0x2261bc=_0x208716['get']({'plain':!![]});fs[_0x0353('0x56')](_0x5963fc);for(var _0x389d79=0x0;_0x389d79<_0x2261bc[_0x0353('0x54')]['length'];_0x389d79++){var _0x56edd3=_0x2261bc[_0x0353('0x54')][_0x389d79][_0x0353('0x57')];if(_0x56edd3){var _0x5c43ab=path[_0x0353('0x4d')](_0xb0b7e6,_0x56edd3[_0x0353('0x58')]);if(fs['existsSync'](_0x5c43ab)){fs['createReadStream'](_0x5c43ab)[_0x0353('0x59')](fs[_0x0353('0x5a')](path[_0x0353('0x4d')](_0x5963fc,_0x56edd3[_0x0353('0x58')])));}}}return BPromise['resolve']()[_0x0353('0x17')](function(){return new BPromise(function(_0x5ea3db,_0x4d3af4){zipdir(_0x5963fc,{'saveTo':_0x563360},function(_0x3238e2,_0x3a4bad){if(_0x3238e2)return _0x4d3af4(_0x3238e2);return _0x5ea3db(_0x3a4bad);});})[_0x0353('0x17')](function(){return new BPromise(function(_0x77185b,_0x227554){rimraf(_0x5963fc,function(_0x59d422){if(_0x59d422)_0x227554(_0x59d422);return _0x77185b();});});})['then'](function(){return _0x1b4181[_0x0353('0x4b')](_0x563360,_0x309d37,function(_0x3f6ad2){if(_0x3f6ad2){console[_0x0353('0x5b')](_0x0353('0x5c'),_0x3f6ad2);}else{fs['unlinkSync'](_0x563360);}});});});}else{return _0x1b4181[_0x0353('0xd')](0xc8);}})[_0x0353('0x33')](handleError(_0x1b4181,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index cfdff66..60138b9 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 _0x2b16=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue'];(function(_0x294328,_0x2f8adf){var _0x4c1335=function(_0x9136c7){while(--_0x9136c7){_0x294328['push'](_0x294328['shift']());}};_0x4c1335(++_0x2f8adf);}(_0x2b16,0x195));var _0x62b1=function(_0x3a0989,_0x1125f9){_0x3a0989=_0x3a0989-0x0;var _0x35e864=_0x2b16[_0x3a0989];return _0x35e864;};'use strict';var EventEmitter=require(_0x62b1('0x0'));var FaxInteraction=require(_0x62b1('0x1'))['db'][_0x62b1('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x62b1('0x3')](0x0);var events={'afterCreate':_0x62b1('0x4'),'afterUpdate':'update','afterDestroy':_0x62b1('0x5')};function emitEvent(_0x4ce0c5){return function(_0x2c7425,_0x3d344e,_0x28d44f){_0x2c7425[_0x62b1('0x6')]({'attributes':['id'],'raw':!![]})[_0x62b1('0x7')](function(_0x9e4e0e){_0x2c7425[_0x62b1('0x8')](_0x62b1('0x9'),_0x9e4e0e[_0x62b1('0xa')](function(_0x5a3b39){return{'id':_0x5a3b39['id']};}));return FaxMessage[_0x62b1('0xb')]({'where':{'FaxInteractionId':_0x2c7425['id'],'direction':'in','read':![]},'raw':!![]});})[_0x62b1('0x7')](function(_0x2b4919){_0x2c7425[_0x62b1('0x8')](_0x62b1('0xc'),_0x2b4919[_0x62b1('0xd')]);FaxInteractionEvents['emit'](_0x4ce0c5+':'+_0x2c7425['id'],_0x2c7425);FaxInteractionEvents[_0x62b1('0xe')](_0x4ce0c5,_0x2c7425);_0x28d44f(null);})[_0x62b1('0xf')](_0x28d44f(null));};}for(var e in events){if(events[_0x62b1('0x10')](e)){var event=events[e];FaxInteraction[_0x62b1('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x9789=['getUsers','findAll','then','unreadMessages','emit','exports','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9789,0x15b));var _0x9978=function(_0x39761b,_0x32982c){_0x39761b=_0x39761b-0x0;var _0x4429e9=_0x9789[_0x39761b];return _0x4429e9;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x9978('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x9978('0x0'))['db'][_0x9978('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9978('0x2')](0x0);var events={'afterCreate':_0x9978('0x3'),'afterUpdate':_0x9978('0x4'),'afterDestroy':'remove'};function emitEvent(_0x46a82){return function(_0x1ac360,_0x2735b1,_0x57a58f){_0x1ac360[_0x9978('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x217d8f){_0x1ac360['setDataValue']('Users',_0x217d8f['map'](function(_0x4ed253){return{'id':_0x4ed253['id']};}));return FaxMessage[_0x9978('0x6')]({'where':{'FaxInteractionId':_0x1ac360['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9978('0x7')](function(_0xce1261){_0x1ac360['setDataValue'](_0x9978('0x8'),_0xce1261['length']);FaxInteractionEvents['emit'](_0x46a82+':'+_0x1ac360['id'],_0x1ac360);FaxInteractionEvents[_0x9978('0x9')](_0x46a82,_0x1ac360);_0x57a58f(null);})['catch'](_0x57a58f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x9978('0xa')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c48e64f..8f9f9e5 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 _0xf2f2=['lodash','util','api','bluebird','request-promise','path','./faxInteraction.attributes','define','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf2f2,0x70));var _0x2f2f=function(_0x42a44a,_0x15ca12){_0x42a44a=_0x42a44a-0x0;var _0x1e6ab6=_0xf2f2[_0x42a44a];return _0x1e6ab6;};'use strict';var _=require(_0x2f2f('0x0'));var util=require(_0x2f2f('0x1'));var logger=require('../../config/logger')(_0x2f2f('0x2'));var moment=require('moment');var BPromise=require(_0x2f2f('0x3'));var rp=require(_0x2f2f('0x4'));var fs=require('fs');var path=require(_0x2f2f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2f2f('0x6'));module['exports']=function(_0x5b8164,_0xbf8b3c){return _0x5b8164[_0x2f2f('0x7')]('FaxInteraction',attributes,{'tableName':_0x2f2f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6f4b73,_0x501cf9,_0x161cfc){if(_0x6f4b73[_0x2f2f('0x9')](_0x2f2f('0xa'))){_0x6f4b73[_0x2f2f('0xb')]=moment()[_0x2f2f('0xc')](_0x2f2f('0xd'));}_0x161cfc(null,_0x6f4b73);}}});}; \ No newline at end of file +var _0x6e9b=['moment','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x3dc341,_0x20e830){var _0x2bb254=function(_0x82789){while(--_0x82789){_0x3dc341['push'](_0x3dc341['shift']());}};_0x2bb254(++_0x20e830);}(_0x6e9b,0xea));var _0xb6e9=function(_0x5a3af1,_0x397a79){_0x5a3af1=_0x5a3af1-0x0;var _0xbaa54c=_0x6e9b[_0x5a3af1];return _0xbaa54c;};'use strict';var _=require(_0xb6e9('0x0'));var util=require(_0xb6e9('0x1'));var logger=require(_0xb6e9('0x2'))(_0xb6e9('0x3'));var moment=require(_0xb6e9('0x4'));var BPromise=require('bluebird');var rp=require(_0xb6e9('0x5'));var fs=require('fs');var path=require(_0xb6e9('0x6'));var rimraf=require(_0xb6e9('0x7'));var config=require('../../config/environment');var attributes=require(_0xb6e9('0x8'));module[_0xb6e9('0x9')]=function(_0x2bdfb8,_0x6b0286){return _0x2bdfb8[_0xb6e9('0xa')](_0xb6e9('0xb'),attributes,{'tableName':_0xb6e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5967ba,_0x20ba2a,_0x178923){if(_0x5967ba[_0xb6e9('0xd')](_0xb6e9('0xe'))){_0x5967ba[_0xb6e9('0xf')]=moment()['format'](_0xb6e9('0x10'));}_0x178923(null,_0x5967ba);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 77ca8e1..127503a 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 _0x7b70=['localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','FaxInteraction,\x20%s,\x20%s','info','result','catch','body','options','raw','where','attributes','limit','UpdateFaxInteraction','FaxInteraction','addTags','ids','spread','AddTags','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7b70,0x1ac));var _0x07b7=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x7b70[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x07b7('0x0'));var util=require(_0x07b7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x07b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07b7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x07b7('0x4'))(_0x07b7('0x5'));var config=require(_0x07b7('0x6'));var jayson=require(_0x07b7('0x7'));var client=jayson[_0x07b7('0x8')][_0x07b7('0x9')]({'port':0x232a});config[_0x07b7('0xa')]=_[_0x07b7('0xb')](config[_0x07b7('0xa')],{'host':_0x07b7('0xc'),'port':0x18eb});var socket=require(_0x07b7('0xd'))(new Redis(config[_0x07b7('0xa')]));require(_0x07b7('0xe'))[_0x07b7('0xf')](socket);function respondWithRpcPromise(_0x57c395,_0x3c3607,_0x40dd0c){return new BPromise(function(_0x4ad50c,_0x2c69fd){return client[_0x07b7('0x10')](_0x57c395,_0x40dd0c)[_0x07b7('0x11')](function(_0x42f911){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x3c3607,'request\x20sent');logger[_0x07b7('0x12')](_0x07b7('0x13'),_0x3c3607,_0x07b7('0x14'),JSON[_0x07b7('0x15')](_0x42f911));if(_0x42f911[_0x07b7('0x16')]){if(_0x42f911['error']['code']===0x1f4){logger[_0x07b7('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x3c3607,_0x42f911[_0x07b7('0x16')]['message']);return _0x2c69fd(_0x42f911['error'][_0x07b7('0x17')]);}logger['error'](_0x07b7('0x18'),_0x3c3607,_0x42f911[_0x07b7('0x16')][_0x07b7('0x17')]);return _0x4ad50c(_0x42f911[_0x07b7('0x16')]['message']);}else{logger[_0x07b7('0x19')](_0x07b7('0x18'),_0x3c3607,_0x07b7('0x14'));_0x4ad50c(_0x42f911[_0x07b7('0x1a')][_0x07b7('0x17')]);}})[_0x07b7('0x1b')](function(_0x4ab9e6){logger[_0x07b7('0x16')](_0x07b7('0x18'),_0x3c3607,_0x4ab9e6);_0x2c69fd(_0x4ab9e6);});});}exports['UpdateFaxInteraction']=function(_0x466fcc){var _0x174245=this;return new Promise(function(_0x18052c,_0x2fcfef){return db['FaxInteraction']['update'](_0x466fcc[_0x07b7('0x1c')],{'raw':_0x466fcc[_0x07b7('0x1d')]?_0x466fcc[_0x07b7('0x1d')][_0x07b7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466fcc[_0x07b7('0x1d')]?_0x466fcc[_0x07b7('0x1d')][_0x07b7('0x1f')]||null:null,'attributes':_0x466fcc[_0x07b7('0x1d')]?_0x466fcc[_0x07b7('0x1d')][_0x07b7('0x20')]||null:null,'limit':_0x466fcc['options']?_0x466fcc['options'][_0x07b7('0x21')]||null:null})[_0x07b7('0x11')](function(_0xe1dad6){logger['info'](_0x07b7('0x22'),_0x466fcc);logger['debug'](_0x07b7('0x22'),_0x466fcc,JSON['stringify'](_0xe1dad6));_0x18052c(_0xe1dad6);})[_0x07b7('0x1b')](function(_0x414e22){logger[_0x07b7('0x16')](_0x07b7('0x22'),_0x414e22['message'],_0x466fcc);_0x2fcfef(_0x174245['error'](0x1f4,_0x414e22[_0x07b7('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x1fdb3b){return new Promise(function(_0x1e6399,_0xe60ede){return db[_0x07b7('0x23')]['find']({'where':_0x1fdb3b[_0x07b7('0x1d')]?_0x1fdb3b['options'][_0x07b7('0x1f')]||null:null})['then'](function(_0x3971e3){if(_0x3971e3){return _0x3971e3[_0x07b7('0x24')](_0x1fdb3b['body'][_0x07b7('0x25')],_['omit'](_0x1fdb3b['body'],['ids','id'])||{});}})[_0x07b7('0x26')](function(_0x17164e){logger[_0x07b7('0x19')](_0x07b7('0x27'),_0x1fdb3b);logger[_0x07b7('0x12')](_0x07b7('0x27'),_0x1fdb3b,JSON[_0x07b7('0x15')](_0x17164e));_0x1e6399(_0x17164e);})[_0x07b7('0x1b')](function(_0x2a4d05){logger['error'](_0x07b7('0x27'),_0x2a4d05['message'],_0x1fdb3b);_0xe60ede(_this['error'](0x1f4,_0x2a4d05[_0x07b7('0x17')]));});});}; \ No newline at end of file +var _0x01bf=['redis','defaults','socket.io-emitter','./faxInteraction.socket','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxInteraction,\x20%s,\x20%s','result','FaxInteraction','update','body','options','where','attributes','limit','UpdateFaxInteraction','debug','catch','AddTagsToFaxInteraction','find','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http'];(function(_0x5ac708,_0x45fa54){var _0x573502=function(_0x5b3a26){while(--_0x5b3a26){_0x5ac708['push'](_0x5ac708['shift']());}};_0x573502(++_0x45fa54);}(_0x01bf,0x127));var _0xf01b=function(_0x15214b,_0x3a7ebd){_0x15214b=_0x15214b-0x0;var _0xe42e19=_0x01bf[_0x15214b];return _0xe42e19;};'use strict';var _=require(_0xf01b('0x0'));var util=require(_0xf01b('0x1'));var moment=require('moment');var BPromise=require(_0xf01b('0x2'));var rs=require(_0xf01b('0x3'));var fs=require('fs');var Redis=require(_0xf01b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf01b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf01b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf01b('0x7')][_0xf01b('0x8')]({'port':0x232a});config[_0xf01b('0x9')]=_[_0xf01b('0xa')](config[_0xf01b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf01b('0xb'))(new Redis(config[_0xf01b('0x9')]));require(_0xf01b('0xc'))['register'](socket);function respondWithRpcPromise(_0x45ac90,_0x2c9419,_0x261381){return new BPromise(function(_0x2ca91c,_0x338a7b){return client[_0xf01b('0xd')](_0x45ac90,_0x261381)[_0xf01b('0xe')](function(_0x4dba6f){logger[_0xf01b('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x2c9419,_0xf01b('0x10'));logger['debug'](_0xf01b('0x11'),_0x2c9419,_0xf01b('0x10'),JSON[_0xf01b('0x12')](_0x4dba6f));if(_0x4dba6f['error']){if(_0x4dba6f[_0xf01b('0x13')]['code']===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2c9419,_0x4dba6f['error'][_0xf01b('0x14')]);return _0x338a7b(_0x4dba6f['error'][_0xf01b('0x14')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2c9419,_0x4dba6f['error'][_0xf01b('0x14')]);return _0x2ca91c(_0x4dba6f['error'][_0xf01b('0x14')]);}else{logger[_0xf01b('0xf')](_0xf01b('0x15'),_0x2c9419,_0xf01b('0x10'));_0x2ca91c(_0x4dba6f[_0xf01b('0x16')][_0xf01b('0x14')]);}})['catch'](function(_0x2ca56a){logger[_0xf01b('0x13')](_0xf01b('0x15'),_0x2c9419,_0x2ca56a);_0x338a7b(_0x2ca56a);});});}exports['UpdateFaxInteraction']=function(_0x1a6fb9){var _0x27d660=this;return new Promise(function(_0x481995,_0x3dc2bc){return db[_0xf01b('0x17')][_0xf01b('0x18')](_0x1a6fb9[_0xf01b('0x19')],{'raw':_0x1a6fb9['options']?_0x1a6fb9[_0xf01b('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a6fb9[_0xf01b('0x1a')]?_0x1a6fb9['options'][_0xf01b('0x1b')]||null:null,'attributes':_0x1a6fb9[_0xf01b('0x1a')]?_0x1a6fb9['options'][_0xf01b('0x1c')]||null:null,'limit':_0x1a6fb9[_0xf01b('0x1a')]?_0x1a6fb9[_0xf01b('0x1a')][_0xf01b('0x1d')]||null:null})['then'](function(_0x1259cf){logger[_0xf01b('0xf')](_0xf01b('0x1e'),_0x1a6fb9);logger[_0xf01b('0x1f')](_0xf01b('0x1e'),_0x1a6fb9,JSON[_0xf01b('0x12')](_0x1259cf));_0x481995(_0x1259cf);})[_0xf01b('0x20')](function(_0x5d51d9){logger[_0xf01b('0x13')]('UpdateFaxInteraction',_0x5d51d9['message'],_0x1a6fb9);_0x3dc2bc(_0x27d660[_0xf01b('0x13')](0x1f4,_0x5d51d9['message']));});});};exports[_0xf01b('0x21')]=function(_0xbe157d){return new Promise(function(_0x4eb208,_0x189fa9){return db['FaxInteraction'][_0xf01b('0x22')]({'where':_0xbe157d[_0xf01b('0x1a')]?_0xbe157d[_0xf01b('0x1a')][_0xf01b('0x1b')]||null:null})[_0xf01b('0xe')](function(_0x5f16ce){if(_0x5f16ce){return _0x5f16ce['addTags'](_0xbe157d[_0xf01b('0x19')][_0xf01b('0x23')],_['omit'](_0xbe157d[_0xf01b('0x19')],[_0xf01b('0x23'),'id'])||{});}})[_0xf01b('0x24')](function(_0x237be1){logger['info'](_0xf01b('0x25'),_0xbe157d);logger['debug']('AddTags',_0xbe157d,JSON['stringify'](_0x237be1));_0x4eb208(_0x237be1);})['catch'](function(_0x410bbc){logger[_0xf01b('0x13')]('AddTags',_0x410bbc[_0xf01b('0x14')],_0xbe157d);_0x189fa9(_this[_0xf01b('0x13')](0x1f4,_0x410bbc['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0ecd23a..6c02a28 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 _0x8193=['length','save','emit','removeListener'];(function(_0x1cca72,_0x2b2721){var _0x2d88b3=function(_0x5031e9){while(--_0x5031e9){_0x1cca72['push'](_0x1cca72['shift']());}};_0x2d88b3(++_0x2b2721);}(_0x8193,0x115));var _0x3819=function(_0x31089b,_0x51dcfb){_0x31089b=_0x31089b-0x0;var _0x3f0df6=_0x8193[_0x31089b];return _0x3f0df6;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x3819('0x0'),'remove','update'];function createListener(_0x2295a0,_0x1c823d){return function(_0x11457a){_0x1c823d[_0x3819('0x1')](_0x2295a0,_0x11457a);};}function removeListener(_0x5458d5,_0x17365f){return function(){FaxInteractionEvents[_0x3819('0x2')](_0x5458d5,_0x17365f);};}exports['register']=function(_0x1efeb4){for(var _0x58e7f0=0x0,_0x52ae31=events[_0x3819('0x3')];_0x58e7f0<_0x52ae31;_0x58e7f0++){var _0x3e499c=events[_0x58e7f0];var _0x56a890=createListener('faxInteraction:'+_0x3e499c,_0x1efeb4);FaxInteractionEvents['on'](_0x3e499c,_0x56a890);}}; \ No newline at end of file +var _0x3baa=['./faxInteraction.events','remove','removeListener','length','faxInteraction:'];(function(_0x1c860e,_0x57c4bf){var _0xee4700=function(_0x589e5f){while(--_0x589e5f){_0x1c860e['push'](_0x1c860e['shift']());}};_0xee4700(++_0x57c4bf);}(_0x3baa,0x1b8));var _0xa3ba=function(_0x53f28d,_0x521c75){_0x53f28d=_0x53f28d-0x0;var _0x48858a=_0x3baa[_0x53f28d];return _0x48858a;};'use strict';var FaxInteractionEvents=require(_0xa3ba('0x0'));var events=['save',_0xa3ba('0x1'),'update'];function createListener(_0x3da749,_0x4e48c6){return function(_0x4c0ea7){_0x4e48c6['emit'](_0x3da749,_0x4c0ea7);};}function removeListener(_0x25cfcf,_0x1d8f44){return function(){FaxInteractionEvents[_0xa3ba('0x2')](_0x25cfcf,_0x1d8f44);};}exports['register']=function(_0xfb237a){for(var _0x1140de=0x0,_0x542c77=events[_0xa3ba('0x3')];_0x1140de<_0x542c77;_0x1140de++){var _0x169348=events[_0x1140de];var _0x2c9c45=createListener(_0xa3ba('0x4')+_0x169348,_0xfb237a);FaxInteractionEvents['on'](_0x169348,_0x2c9c45);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 3befd5b..42cf0f1 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 _0xbd5a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbd5a,0x1d0));var _0xabd5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbd5a[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xabd5('0x0'));var util=require(_0xabd5('0x1'));var path=require(_0xabd5('0x2'));var timeout=require(_0xabd5('0x3'));var express=require(_0xabd5('0x4'));var router=express[_0xabd5('0x5')]();var fs_extra=require(_0xabd5('0x6'));var auth=require(_0xabd5('0x7'));var interaction=require(_0xabd5('0x8'));var config=require(_0xabd5('0x9'));var controller=require(_0xabd5('0xa'));router[_0xabd5('0xb')]('/',auth[_0xabd5('0xc')](),controller[_0xabd5('0xd')]);router[_0xabd5('0xb')](_0xabd5('0xe'),auth[_0xabd5('0xc')](),controller[_0xabd5('0xf')]);router['get'](_0xabd5('0x10'),auth[_0xabd5('0xc')](),controller[_0xabd5('0x11')]);router['get']('/:id/messages',auth[_0xabd5('0xc')](),controller[_0xabd5('0x12')]);router[_0xabd5('0xb')](_0xabd5('0x13'),auth[_0xabd5('0xc')](),controller['download']);router[_0xabd5('0x14')]('/',auth[_0xabd5('0xc')](),controller[_0xabd5('0x15')]);router[_0xabd5('0x14')]('/:id/messages',auth[_0xabd5('0xc')](),controller[_0xabd5('0x16')]);router[_0xabd5('0x14')](_0xabd5('0x17'),auth[_0xabd5('0xc')](),interaction['tracked'](_0xabd5('0x18'),_0xabd5('0x19')),controller[_0xabd5('0x1a')]);router[_0xabd5('0x1b')](_0xabd5('0x10'),auth[_0xabd5('0xc')](),interaction[_0xabd5('0x1c')]('fax',_0xabd5('0x1d')),controller[_0xabd5('0x1e')]);router[_0xabd5('0x1f')](_0xabd5('0x10'),auth[_0xabd5('0xc')](),interaction[_0xabd5('0x1c')](_0xabd5('0x18'),_0xabd5('0x20')),controller[_0xabd5('0x21')]);router[_0xabd5('0x1f')](_0xabd5('0x17'),auth[_0xabd5('0xc')](),controller[_0xabd5('0x22')]);module[_0xabd5('0x23')]=router; \ No newline at end of file +var _0xd859=['getMessages','/:id/download','post','create','addMessage','tracked','fax','faxinteraction:addtags','/:id','faxinteraction:update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','show','/:id/messages'];(function(_0x422be4,_0x3ea357){var _0x22c4d9=function(_0x37c4ae){while(--_0x37c4ae){_0x422be4['push'](_0x422be4['shift']());}};_0x22c4d9(++_0x3ea357);}(_0xd859,0x189));var _0x9d85=function(_0x1fb86d,_0xc5978a){_0x1fb86d=_0x1fb86d-0x0;var _0x3f7334=_0xd859[_0x1fb86d];return _0x3f7334;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9d85('0x0'));var timeout=require(_0x9d85('0x1'));var express=require(_0x9d85('0x2'));var router=express['Router']();var fs_extra=require(_0x9d85('0x3'));var auth=require(_0x9d85('0x4'));var interaction=require(_0x9d85('0x5'));var config=require(_0x9d85('0x6'));var controller=require(_0x9d85('0x7'));router[_0x9d85('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9d85('0x8')](_0x9d85('0x9'),auth[_0x9d85('0xa')](),controller['describe']);router['get']('/:id',auth[_0x9d85('0xa')](),controller[_0x9d85('0xb')]);router[_0x9d85('0x8')](_0x9d85('0xc'),auth['isAuthenticated'](),controller[_0x9d85('0xd')]);router[_0x9d85('0x8')](_0x9d85('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x9d85('0xf')]('/',auth['isAuthenticated'](),controller[_0x9d85('0x10')]);router[_0x9d85('0xf')](_0x9d85('0xc'),auth[_0x9d85('0xa')](),controller[_0x9d85('0x11')]);router[_0x9d85('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x9d85('0x12')](_0x9d85('0x13'),_0x9d85('0x14')),controller['addTags']);router['put'](_0x9d85('0x15'),auth[_0x9d85('0xa')](),interaction[_0x9d85('0x12')](_0x9d85('0x13'),_0x9d85('0x16')),controller['update']);router[_0x9d85('0x17')](_0x9d85('0x15'),auth[_0x9d85('0xa')](),interaction[_0x9d85('0x12')]('fax',_0x9d85('0x18')),controller[_0x9d85('0x19')]);router['delete'](_0x9d85('0x1a'),auth[_0x9d85('0xa')](),controller[_0x9d85('0x1b')]);module[_0x9d85('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index baa14e4..ac2f1b4 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 _0x644a=['out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x644a,0xfd));var _0xa644=function(_0x4af43b,_0x46ddfc){_0x4af43b=_0x4af43b-0x0;var _0xb20e01=_0x644a[_0x4af43b];return _0xb20e01;};'use strict';var Sequelize=require(_0xa644('0x0'));module[_0xa644('0x1')]={'body':{'type':Sequelize[_0xa644('0x2')](_0xa644('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa644('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa644('0x5')),'defaultValue':_0xa644('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0207=['exports','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x2a113,_0xd6b589){var _0x21bad8=function(_0x52e64d){while(--_0x52e64d){_0x2a113['push'](_0x2a113['shift']());}};_0x21bad8(++_0xd6b589);}(_0x0207,0x162));var _0x7020=function(_0x2b0c2b,_0x279329){_0x2b0c2b=_0x2b0c2b-0x0;var _0x3a5e50=_0x0207[_0x2b0c2b];return _0x3a5e50;};'use strict';var Sequelize=require('sequelize');module[_0x7020('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7020('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7020('0x2')]('in',_0x7020('0x3')),'defaultValue':_0x7020('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x7020('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7020('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 012bd6c..71f47ff 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 _0x4483=['http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','end','name','send','index','map','FaxMessage','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','pick','filter','merge','where','VIRTUAL','options','count','include','findAll','rows','show','rawAttributes','includeAll','find','body','params','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','internal','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','root','server','files','attachments','join','basename','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client'];(function(_0x3818c0,_0x542521){var _0x55ec33=function(_0x2be9ea){while(--_0x2be9ea){_0x3818c0['push'](_0x3818c0['shift']());}};_0x55ec33(++_0x542521);}(_0x4483,0x19c));var _0x3448=function(_0x1bd037,_0x3bf937){_0x1bd037=_0x1bd037-0x0;var _0x1bb364=_0x4483[_0x1bd037];return _0x1bb364;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3448('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3448('0x2'));var BPromise=require(_0x3448('0x3'));var Mustache=require(_0x3448('0x4'));var util=require(_0x3448('0x5'));var path=require(_0x3448('0x6'));var sox=require(_0x3448('0x7'));var csv=require('to-csv');var ejs=require(_0x3448('0x8'));var fs=require('fs');var fs_extra=require(_0x3448('0x9'));var _=require('lodash');var squel=require(_0x3448('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3448('0xb'));var querystring=require(_0x3448('0xc'));var Papa=require(_0x3448('0xd'));var Redis=require(_0x3448('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3448('0xf'));var as=require(_0x3448('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3448('0x11'))(_0x3448('0x12'));var utils=require(_0x3448('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3448('0x14'));var db=require(_0x3448('0x15'))['db'];config[_0x3448('0x16')]=_[_0x3448('0x17')](config[_0x3448('0x16')],{'host':_0x3448('0x18'),'port':0x18eb});var socket=require(_0x3448('0x19'))(new Redis(config[_0x3448('0x16')]));require(_0x3448('0x1a'))['register'](socket);var jayson=require(_0x3448('0x1b'));var client=jayson[_0x3448('0x1c')][_0x3448('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x3448('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x49a0fc,_0x368c4e,_0x3ee94b,_0x4833f9){return new BPromise(function(_0x183ac6,_0x21dda6){var _0x518c71=_0x4833f9||client;return _0x518c71[_0x3448('0x1e')](_0x49a0fc,_0x3ee94b)[_0x3448('0x1f')](function(_0x588eb8){logger[_0x3448('0x20')]('FaxMessage,\x20%s,\x20%s',_0x368c4e,_0x3448('0x21'));logger[_0x3448('0x22')](_0x3448('0x23'),_0x368c4e,_0x3448('0x21'),JSON[_0x3448('0x24')](_0x588eb8));if(_0x588eb8[_0x3448('0x25')]){if(_0x588eb8[_0x3448('0x25')][_0x3448('0x26')]===0x1f4){logger[_0x3448('0x25')](_0x3448('0x27'),_0x368c4e,_0x588eb8[_0x3448('0x25')][_0x3448('0x28')]);return _0x21dda6(_0x588eb8['error'][_0x3448('0x28')]);}logger[_0x3448('0x25')](_0x3448('0x27'),_0x368c4e,_0x588eb8[_0x3448('0x25')][_0x3448('0x28')]);return _0x183ac6(_0x588eb8[_0x3448('0x25')][_0x3448('0x28')]);}else{logger[_0x3448('0x20')](_0x3448('0x27'),_0x368c4e,_0x3448('0x21'));_0x183ac6(_0x588eb8[_0x3448('0x29')][_0x3448('0x28')]);}})[_0x3448('0x2a')](function(_0x285792){logger['error'](_0x3448('0x27'),_0x368c4e,_0x285792);_0x21dda6(_0x285792);});});}function respondWithStatusCode(_0x4670e6,_0x7050b0){_0x7050b0=_0x7050b0||0xcc;return function(_0xeaf2d7){if(_0xeaf2d7){return _0x4670e6[_0x3448('0x2b')](_0x7050b0);}return _0x4670e6[_0x3448('0x2c')](_0x7050b0)['end']();};}function respondWithResult(_0xdeb6b2,_0x5eca66){_0x5eca66=_0x5eca66||0xc8;return function(_0x400a1b){if(_0x400a1b){return _0xdeb6b2['status'](_0x5eca66)[_0x3448('0x2d')](_0x400a1b);}};}function respondWithFilteredResult(_0x41e30e,_0x281538){return function(_0x389058){if(_0x389058){var _0x452b65=typeof _0x281538[_0x3448('0x2e')]===_0x3448('0x2f')&&typeof _0x281538[_0x3448('0x30')]===_0x3448('0x2f');var _0x5bcb6c=_0x389058['count'];var _0x4dd7ed=_0x452b65?0x0:_0x281538[_0x3448('0x2e')];var _0x594051=_0x452b65?_0x389058['count']:_0x281538[_0x3448('0x2e')]+_0x281538[_0x3448('0x30')];var _0x324700;if(_0x594051>=_0x5bcb6c){_0x594051=_0x5bcb6c;_0x324700=0xc8;}else{_0x324700=0xce;}_0x41e30e[_0x3448('0x2c')](_0x324700);return _0x41e30e[_0x3448('0x31')](_0x3448('0x32'),_0x4dd7ed+'-'+_0x594051+'/'+_0x5bcb6c)[_0x3448('0x2d')](_0x389058);}return null;};}function patchUpdates(_0x52b9b8){return function(_0x303ff9){try{jsonpatch['apply'](_0x303ff9,_0x52b9b8,!![]);}catch(_0x3e8c6c){return BPromise[_0x3448('0x33')](_0x3e8c6c);}return _0x303ff9[_0x3448('0x34')]();};}function saveUpdates(_0x3d898b,_0x4bb273){return function(_0x2443f7){if(_0x2443f7){return _0x2443f7[_0x3448('0x35')](_0x3d898b)[_0x3448('0x1f')](function(_0x5c3d85){return _0x5c3d85;});}return null;};}function removeEntity(_0x167e11,_0x1001bd){return function(_0x517813){if(_0x517813){return _0x517813[_0x3448('0x36')]()[_0x3448('0x1f')](function(){_0x167e11[_0x3448('0x2c')](0xcc)[_0x3448('0x37')]();});}};}function handleEntityNotFound(_0x555d40,_0x31ace7){return function(_0x42c4dd){if(!_0x42c4dd){_0x555d40[_0x3448('0x2b')](0x194);}return _0x42c4dd;};}function handleError(_0x1b7301,_0x4e8ade){_0x4e8ade=_0x4e8ade||0x1f4;return function(_0x154425){logger[_0x3448('0x25')](_0x154425['stack']);if(_0x154425[_0x3448('0x38')]){delete _0x154425[_0x3448('0x38')];}_0x1b7301[_0x3448('0x2c')](_0x4e8ade)[_0x3448('0x39')](_0x154425);};}exports[_0x3448('0x3a')]=function(_0x1defd0,_0x1dcb6e){var _0x4defd9={},_0x303bf5={},_0x2d6e1e={'count':0x0,'rows':[]};var _0x8993a7=_[_0x3448('0x3b')](db[_0x3448('0x3c')]['rawAttributes'],function(_0x3b66be){return{'name':_0x3b66be[_0x3448('0x3d')],'type':_0x3b66be[_0x3448('0x3e')][_0x3448('0x3f')]};});_0x303bf5[_0x3448('0x40')]=_['map'](_0x8993a7,_0x3448('0x38'));_0x303bf5['query']=_[_0x3448('0x41')](_0x1defd0[_0x3448('0x42')]);_0x303bf5[_0x3448('0x43')]=_[_0x3448('0x44')](_0x303bf5['model'],_0x303bf5[_0x3448('0x42')]);_0x4defd9['attributes']=_[_0x3448('0x44')](_0x303bf5[_0x3448('0x40')],qs[_0x3448('0x45')](_0x1defd0[_0x3448('0x42')][_0x3448('0x45')]));_0x4defd9[_0x3448('0x46')]=_0x4defd9[_0x3448('0x46')][_0x3448('0x47')]?_0x4defd9[_0x3448('0x46')]:_0x303bf5[_0x3448('0x40')];if(!_0x1defd0[_0x3448('0x42')]['hasOwnProperty'](_0x3448('0x48'))){_0x4defd9[_0x3448('0x30')]=qs[_0x3448('0x30')](_0x1defd0[_0x3448('0x42')]['limit']);_0x4defd9['offset']=qs[_0x3448('0x2e')](_0x1defd0['query']['offset']);}_0x4defd9[_0x3448('0x49')]=qs['sort'](_0x1defd0[_0x3448('0x42')]['sort']);_0x4defd9['where']=qs[_0x3448('0x43')](_[_0x3448('0x4a')](_0x1defd0[_0x3448('0x42')],_0x303bf5[_0x3448('0x43')]),_0x8993a7);if(_0x1defd0[_0x3448('0x42')][_0x3448('0x4b')]){_0x4defd9['where']=_[_0x3448('0x4c')](_0x4defd9[_0x3448('0x4d')],{'$or':_[_0x3448('0x3b')](_0x8993a7,function(_0x2c4b3c){if(_0x2c4b3c[_0x3448('0x3e')]!==_0x3448('0x4e')){var _0x59e138={};_0x59e138[_0x2c4b3c[_0x3448('0x38')]]={'$like':'%'+_0x1defd0[_0x3448('0x42')]['filter']+'%'};return _0x59e138;}})});}_0x4defd9=_['merge']({},_0x4defd9,_0x1defd0[_0x3448('0x4f')]);var _0x44a424={'where':_0x4defd9[_0x3448('0x4d')]};return db[_0x3448('0x3c')][_0x3448('0x50')](_0x44a424)[_0x3448('0x1f')](function(_0x42444d){_0x2d6e1e[_0x3448('0x50')]=_0x42444d;if(_0x1defd0['query']['includeAll']){_0x4defd9[_0x3448('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0x3448('0x52')](_0x4defd9);})[_0x3448('0x1f')](function(_0x261b56){_0x2d6e1e[_0x3448('0x53')]=_0x261b56;return _0x2d6e1e;})[_0x3448('0x1f')](respondWithFilteredResult(_0x1dcb6e,_0x4defd9))[_0x3448('0x2a')](handleError(_0x1dcb6e,null));};exports[_0x3448('0x54')]=function(_0x45d3e1,_0x4927b1){var _0x4f394f={'raw':!![],'where':{'id':_0x45d3e1['params']['id']}},_0x5512b4={};_0x5512b4[_0x3448('0x40')]=_[_0x3448('0x41')](db['FaxMessage'][_0x3448('0x55')]);_0x5512b4[_0x3448('0x42')]=_[_0x3448('0x41')](_0x45d3e1['query']);_0x5512b4[_0x3448('0x43')]=_[_0x3448('0x44')](_0x5512b4['model'],_0x5512b4['query']);_0x4f394f['attributes']=_[_0x3448('0x44')](_0x5512b4[_0x3448('0x40')],qs[_0x3448('0x45')](_0x45d3e1[_0x3448('0x42')]['fields']));_0x4f394f[_0x3448('0x46')]=_0x4f394f[_0x3448('0x46')][_0x3448('0x47')]?_0x4f394f[_0x3448('0x46')]:_0x5512b4[_0x3448('0x40')];if(_0x45d3e1[_0x3448('0x42')][_0x3448('0x56')]){_0x4f394f[_0x3448('0x51')]=[{'all':!![]}];}_0x4f394f=_[_0x3448('0x4c')]({},_0x4f394f,_0x45d3e1['options']);return db[_0x3448('0x3c')][_0x3448('0x57')](_0x4f394f)[_0x3448('0x1f')](handleEntityNotFound(_0x4927b1,null))[_0x3448('0x1f')](respondWithResult(_0x4927b1,null))[_0x3448('0x2a')](handleError(_0x4927b1,null));};exports[_0x3448('0x35')]=function(_0x284529,_0x3b6732){if(_0x284529[_0x3448('0x58')]['id']){delete _0x284529['body']['id'];}return db[_0x3448('0x3c')][_0x3448('0x57')]({'where':{'id':_0x284529[_0x3448('0x59')]['id']}})['then'](handleEntityNotFound(_0x3b6732,null))[_0x3448('0x1f')](saveUpdates(_0x284529[_0x3448('0x58')],null))[_0x3448('0x1f')](respondWithResult(_0x3b6732,null))[_0x3448('0x2a')](handleError(_0x3b6732,null));};exports[_0x3448('0x36')]=function(_0x280126,_0x43cf67){return db[_0x3448('0x3c')][_0x3448('0x57')]({'where':{'id':_0x280126[_0x3448('0x59')]['id']}})[_0x3448('0x1f')](handleEntityNotFound(_0x43cf67,null))[_0x3448('0x1f')](removeEntity(_0x43cf67,null))[_0x3448('0x2a')](handleError(_0x43cf67,null));};exports['describe']=function(_0x2216e9,_0x181f55){return db[_0x3448('0x3c')][_0x3448('0x5a')]()['then'](respondWithResult(_0x181f55,null))[_0x3448('0x2a')](handleError(_0x181f55,null));};var interaction_log=require(_0x3448('0x11'))(_0x3448('0x5b'));exports['accept']=function(_0x18a3bf,_0x3b0bee,_0x845526){var _0x1f7316={'agent':{},'channel':'fax'};if(_0x18a3bf[_0x3448('0x58')]['id']){delete _0x18a3bf[_0x3448('0x58')]['id'];}_0x18a3bf[_0x3448('0x58')][_0x3448('0x5c')]=!![];_0x18a3bf['body'][_0x3448('0x5d')]=moment()[_0x3448('0x5e')](_0x3448('0x5f'));_0x18a3bf[_0x3448('0x58')][_0x3448('0x60')]=_0x18a3bf['body'][_0x3448('0x60')]||_0x18a3bf[_0x3448('0x61')]['id'];_0x1f7316['agent']['id']=_0x18a3bf[_0x3448('0x58')][_0x3448('0x60')];return db[_0x3448('0x3c')][_0x3448('0x57')]({'where':{'id':_0x18a3bf[_0x3448('0x59')]['id'],'UserId':null}})[_0x3448('0x1f')](handleEntityNotFound(_0x3b0bee,null))['then'](saveUpdates(_0x18a3bf[_0x3448('0x58')],null))[_0x3448('0x1f')](function(_0x3a4440){if(_0x3a4440){_0x1f7316[_0x3448('0x28')]=_0x3a4440[_0x3448('0x62')]({'plain':!![]});return db[_0x3448('0x63')][_0x3448('0x57')]({'where':{'id':_0x3a4440[_0x3448('0x64')]}});}return null;})[_0x3448('0x1f')](handleEntityNotFound(_0x3b0bee,null))[_0x3448('0x1f')](function(_0x450d75){if(_0x450d75){return _0x450d75['update']({'UserId':_0x18a3bf[_0x3448('0x58')][_0x3448('0x60')],'read1stAt':_[_0x3448('0x65')](_0x450d75[_0x3448('0x66')])?moment()['format'](_0x3448('0x5f')):undefined});}return null;})[_0x3448('0x1f')](function(_0x3b8ade){if(_0x3b8ade){_0x1f7316[_0x3448('0x67')]=_0x3b8ade[_0x3448('0x62')]({'plain':!![]});interaction_log['info'](_0x3448('0x68'),_0x18a3bf[_0x3448('0x61')]['id'],_0x18a3bf['user']['name'],_0x18a3bf['user'][_0x3448('0x69')],_0x1f7316['interaction']['id'],_0x18a3bf[_0x3448('0x58')]?JSON[_0x3448('0x24')](_0x18a3bf[_0x3448('0x58')]):_0x3448('0x6a'));return respondWithRpcPromise(_0x3448('0x6b'),_0x3448('0x6c'),_0x1f7316);}return null;})[_0x3448('0x1f')](function(_0x4b538b){var _0x4133e7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4b538b[_0x3448('0x28')][_0x3448('0x6d')];return db[_0x3448('0x6e')]['query'](_0x4133e7,{'type':db[_0x3448('0x6f')][_0x3448('0x70')][_0x3448('0x71')],'raw':!![]})[_0x3448('0x1f')](function(_0x41d6f0){return _0x41d6f0;});})[_0x3448('0x1f')](function(_0x2b5f08){if(_0x2b5f08){_0x1f7316[_0x3448('0x28')]['contact']=_0x2b5f08[0x0];if(!_0x18a3bf[_0x3448('0x58')][_0x3448('0x60')])return;return db[_0x3448('0x72')][_0x3448('0x57')]({'where':{'id':_0x18a3bf[_0x3448('0x58')][_0x3448('0x60')],'role':_0x3448('0x73')},'attributes':['id',_0x3448('0x38'),'fullname',_0x3448('0x74'),'internal'],'raw':!![]});}return null;})[_0x3448('0x1f')](function(_0x148efd){if(!_0x148efd)return null;_0x1f7316[_0x3448('0x28')][_0x3448('0x73')]=_0x148efd;return _0x1f7316;})['then'](function(_0x377f1a){if(_0x377f1a){if(_0x18a3bf[_0x3448('0x58')][_0x3448('0x75')]){_0x1f7316['message'][_0x3448('0x76')]=util[_0x3448('0x5e')](_0x3448('0x77'),_0x18a3bf[_0x3448('0x61')][_0x3448('0x38')]);_0x1f7316[_0x3448('0x28')][_0x3448('0x78')]=_0x1f7316[_0x3448('0x78')];_0x1f7316[_0x3448('0x28')][_0x3448('0x79')]=_0x1f7316[_0x3448('0x78')];_0x1f7316[_0x3448('0x28')][_0x3448('0x7a')]=_0x3448('0x7b');return respondWithRpcPromise(_0x3448('0x7c'),_0x3448('0x7c'),{'event':_0x3448('0x7d'),'message':_0x1f7316[_0x3448('0x28')]},client9002)['then'](function(){return _0x1f7316;});}return _0x1f7316;}return null;})[_0x3448('0x1f')](respondWithResult(_0x3b0bee,null))[_0x3448('0x2a')](handleError(_0x3b0bee,null));};var interaction_log=require('../../config/logger')(_0x3448('0x5b'));exports[_0x3448('0x33')]=function(_0xd0bdd2,_0x19eecb,_0x499f3c){var _0x17e33d={'agent':{},'channel':_0x3448('0x7e')};if(_0xd0bdd2[_0x3448('0x58')]['id']){delete _0xd0bdd2[_0x3448('0x58')]['id'];}_0xd0bdd2[_0x3448('0x58')][_0x3448('0x60')]=_0xd0bdd2[_0x3448('0x58')][_0x3448('0x60')]||_0xd0bdd2[_0x3448('0x61')]['id'];_0x17e33d[_0x3448('0x73')]['id']=_0xd0bdd2[_0x3448('0x58')][_0x3448('0x60')];return db[_0x3448('0x3c')][_0x3448('0x57')]({'where':{'id':_0xd0bdd2['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x19eecb,null))[_0x3448('0x1f')](function(_0x3eff17){if(_0x3eff17){_0x17e33d[_0x3448('0x28')]=_0x3eff17[_0x3448('0x62')]({'plain':!![]});return db[_0x3448('0x63')][_0x3448('0x57')]({'where':{'id':_0x3eff17['FaxInteractionId']}});}return null;})[_0x3448('0x1f')](handleEntityNotFound(_0x19eecb,null))[_0x3448('0x1f')](function(_0x1ee98c){if(_0x1ee98c){_0x17e33d[_0x3448('0x67')]=_0x1ee98c[_0x3448('0x62')]({'plain':!![]});interaction_log[_0x3448('0x20')](_0x3448('0x7f'),_0xd0bdd2[_0x3448('0x61')]['id'],_0xd0bdd2[_0x3448('0x61')][_0x3448('0x38')],_0xd0bdd2['user']['role'],_0x17e33d[_0x3448('0x67')]['id'],_0xd0bdd2['body']?JSON[_0x3448('0x24')](_0xd0bdd2[_0x3448('0x58')]):'null');return respondWithRpcPromise(_0x3448('0x80'),_0x3448('0x81'),_0x17e33d);}return null;})[_0x3448('0x1f')](function(_0x2ae704){var _0x1d481b=_0x3448('0x82')+_0x2ae704['message'][_0x3448('0x6d')];return db[_0x3448('0x6e')]['query'](_0x1d481b,{'type':db[_0x3448('0x6f')][_0x3448('0x70')][_0x3448('0x71')],'raw':!![]})[_0x3448('0x1f')](function(_0x5646de){return _0x5646de;});})['then'](function(_0x4493e2){if(_0x4493e2){_0x17e33d['message'][_0x3448('0x83')]=_0x4493e2[0x0];if(!_0xd0bdd2[_0x3448('0x58')][_0x3448('0x60')])return;return db[_0x3448('0x72')]['find']({'where':{'id':_0xd0bdd2['body'][_0x3448('0x60')],'role':_0x3448('0x73')},'attributes':['id','name','fullname',_0x3448('0x74'),_0x3448('0x84')],'raw':!![]});}return null;})[_0x3448('0x1f')](function(_0x34667f){if(!_0x34667f)return null;_0x17e33d['message']['agent']=_0x34667f;return _0x17e33d;})[_0x3448('0x1f')](function(_0x9ba651){if(_0x9ba651){_0x9ba651[_0x3448('0x28')][_0x3448('0x76')]=util['format'](_0x3448('0x77'),_0xd0bdd2['user'][_0x3448('0x38')]);_0x9ba651[_0x3448('0x28')]['channel']=_0x17e33d[_0x3448('0x78')];_0x9ba651[_0x3448('0x28')][_0x3448('0x79')]=_0x17e33d[_0x3448('0x78')];_0x9ba651[_0x3448('0x28')][_0x3448('0x7a')]=_0x3448('0x33');respondWithRpcPromise(_0x3448('0x7c'),_0x3448('0x7c'),{'event':'rejectmessage','message':_0x9ba651[_0x3448('0x28')]},client9002);return _0x17e33d;}return null;})[_0x3448('0x1f')](respondWithResult(_0x19eecb,null))[_0x3448('0x2a')](handleError(_0x19eecb,null));};exports['create']=function(_0x1aace4,_0x3d4b92){var _0xe99653;return db[_0x3448('0x3c')][_0x3448('0x85')](_0x1aace4[_0x3448('0x58')],{})[_0x3448('0x1f')](function(_0x30546b){_0xe99653=_0x30546b;return db[_0x3448('0x86')][_0x3448('0x87')]({'where':{'id':_0xe99653[_0x3448('0x6d')]}});})[_0x3448('0x1f')](function(_0x1f359a){if(_[_0x3448('0x65')](_0x1f359a)){return;}else{_0xe99653[_0x3448('0x7e')]=_0x1f359a[_0x3448('0x7e')];return db[_0x3448('0x88')][_0x3448('0x87')]({'where':{'id':_0xe99653['AttachmentId']}});}})[_0x3448('0x1f')](function(_0x57bb4b){return respondWithRpcPromise(_0x3448('0x89'),_0x3448('0x89'),{'FaxAccountId':_[_0x3448('0x65')](_0x1aace4['body'])?undefined:_0x1aace4[_0x3448('0x58')][_0x3448('0x8a')],'path':_[_0x3448('0x65')](_0x57bb4b)?undefined:util['format'](_0x3448('0x8b'),_0x57bb4b['basename']),'fax':_[_0x3448('0x65')](_0xe99653[_0x3448('0x7e')])?undefined:_0xe99653['fax'],'AttachmentId':_0xe99653['AttachmentId']},client9002);})[_0x3448('0x1f')](respondWithResult(_0x3d4b92,0xc9))[_0x3448('0x2a')](handleError(_0x3d4b92,null));};exports[_0x3448('0x8c')]=function(_0x2c7a62,_0x59912e){var _0x44b73a=path['join'](config[_0x3448('0x8d')],_0x3448('0x8e'),_0x3448('0x8f'),_0x3448('0x90'));return db[_0x3448('0x3c')][_0x3448('0x57')]({'where':{'id':_0x2c7a62[_0x3448('0x59')]['id']},'include':[{'model':db[_0x3448('0x88')],'as':'Attachment'}]})[_0x3448('0x1f')](handleEntityNotFound(_0x59912e,null))[_0x3448('0x1f')](function(_0x270d7d){if(_0x270d7d){return _0x59912e['download'](path[_0x3448('0x91')](_0x44b73a,_0x270d7d[_0x3448('0x88')][_0x3448('0x92')]));}})['catch'](handleError(_0x59912e,null));}; \ No newline at end of file +var _0x4fe4=['UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax-interactions','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','QueryTypes','contact','email','motionChannel','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','server','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','sendStatus','name','send','index','FaxMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','show','params','options','find','body','describe','../../config/logger','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x58575a,_0x5206b4){var _0x3279d8=function(_0x77f8f){while(--_0x77f8f){_0x58575a['push'](_0x58575a['shift']());}};_0x3279d8(++_0x5206b4);}(_0x4fe4,0x14a));var _0x44fe=function(_0x3655e5,_0x469eae){_0x3655e5=_0x3655e5-0x0;var _0x37dfac=_0x4fe4[_0x3655e5];return _0x37dfac;};'use strict';var emlformat=require(_0x44fe('0x0'));var rimraf=require(_0x44fe('0x1'));var zipdir=require(_0x44fe('0x2'));var jsonpatch=require(_0x44fe('0x3'));var rp=require('request-promise');var moment=require(_0x44fe('0x4'));var BPromise=require(_0x44fe('0x5'));var Mustache=require(_0x44fe('0x6'));var util=require(_0x44fe('0x7'));var path=require('path');var sox=require(_0x44fe('0x8'));var csv=require('to-csv');var ejs=require(_0x44fe('0x9'));var fs=require('fs');var fs_extra=require(_0x44fe('0xa'));var _=require(_0x44fe('0xb'));var squel=require(_0x44fe('0xc'));var crypto=require(_0x44fe('0xd'));var jsforce=require(_0x44fe('0xe'));var deskjs=require(_0x44fe('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x44fe('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44fe('0x11'));var logger=require('../../config/logger')(_0x44fe('0x12'));var utils=require(_0x44fe('0x13'));var config=require(_0x44fe('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x44fe('0x15'))['db'];config[_0x44fe('0x16')]=_[_0x44fe('0x17')](config[_0x44fe('0x16')],{'host':_0x44fe('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44fe('0x19'))[_0x44fe('0x1a')](socket);var jayson=require(_0x44fe('0x1b'));var client=jayson['client'][_0x44fe('0x1c')]({'port':0x232c});var client9002=jayson[_0x44fe('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20a0d1,_0x36f8ee,_0x30a05f,_0x11d1ae){return new BPromise(function(_0x3fc8a2,_0x1a7683){var _0x3f2b29=_0x11d1ae||client;return _0x3f2b29[_0x44fe('0x1e')](_0x20a0d1,_0x30a05f)[_0x44fe('0x1f')](function(_0x41adc7){logger[_0x44fe('0x20')](_0x44fe('0x21'),_0x36f8ee,_0x44fe('0x22'));logger[_0x44fe('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x36f8ee,_0x44fe('0x22'),JSON[_0x44fe('0x24')](_0x41adc7));if(_0x41adc7[_0x44fe('0x25')]){if(_0x41adc7[_0x44fe('0x25')][_0x44fe('0x26')]===0x1f4){logger[_0x44fe('0x25')](_0x44fe('0x21'),_0x36f8ee,_0x41adc7[_0x44fe('0x25')][_0x44fe('0x27')]);return _0x1a7683(_0x41adc7[_0x44fe('0x25')][_0x44fe('0x27')]);}logger[_0x44fe('0x25')](_0x44fe('0x21'),_0x36f8ee,_0x41adc7[_0x44fe('0x25')][_0x44fe('0x27')]);return _0x3fc8a2(_0x41adc7['error'][_0x44fe('0x27')]);}else{logger[_0x44fe('0x20')]('FaxMessage,\x20%s,\x20%s',_0x36f8ee,_0x44fe('0x22'));_0x3fc8a2(_0x41adc7[_0x44fe('0x28')][_0x44fe('0x27')]);}})[_0x44fe('0x29')](function(_0x5a42ba){logger['error'](_0x44fe('0x21'),_0x36f8ee,_0x5a42ba);_0x1a7683(_0x5a42ba);});});}function respondWithStatusCode(_0x375d26,_0x26c4f3){_0x26c4f3=_0x26c4f3||0xcc;return function(_0x5a025e){if(_0x5a025e){return _0x375d26['sendStatus'](_0x26c4f3);}return _0x375d26[_0x44fe('0x2a')](_0x26c4f3)['end']();};}function respondWithResult(_0x121b67,_0x446120){_0x446120=_0x446120||0xc8;return function(_0x96914e){if(_0x96914e){return _0x121b67['status'](_0x446120)[_0x44fe('0x2b')](_0x96914e);}};}function respondWithFilteredResult(_0x972c29,_0x5a9a73){return function(_0x441b62){if(_0x441b62){var _0x11f8c2=typeof _0x5a9a73[_0x44fe('0x2c')]===_0x44fe('0x2d')&&typeof _0x5a9a73[_0x44fe('0x2e')]===_0x44fe('0x2d');var _0x30bcf4=_0x441b62[_0x44fe('0x2f')];var _0x313b27=_0x11f8c2?0x0:_0x5a9a73[_0x44fe('0x2c')];var _0x58e355=_0x11f8c2?_0x441b62['count']:_0x5a9a73['offset']+_0x5a9a73[_0x44fe('0x2e')];var _0x843540;if(_0x58e355>=_0x30bcf4){_0x58e355=_0x30bcf4;_0x843540=0xc8;}else{_0x843540=0xce;}_0x972c29[_0x44fe('0x2a')](_0x843540);return _0x972c29[_0x44fe('0x30')](_0x44fe('0x31'),_0x313b27+'-'+_0x58e355+'/'+_0x30bcf4)[_0x44fe('0x2b')](_0x441b62);}return null;};}function patchUpdates(_0x4001b9){return function(_0x2fe313){try{jsonpatch[_0x44fe('0x32')](_0x2fe313,_0x4001b9,!![]);}catch(_0x43456a){return BPromise['reject'](_0x43456a);}return _0x2fe313[_0x44fe('0x33')]();};}function saveUpdates(_0x473396,_0x286887){return function(_0x274730){if(_0x274730){return _0x274730[_0x44fe('0x34')](_0x473396)[_0x44fe('0x1f')](function(_0x39e9ac){return _0x39e9ac;});}return null;};}function removeEntity(_0x2bb1a0,_0x5e240a){return function(_0xf7c226){if(_0xf7c226){return _0xf7c226['destroy']()[_0x44fe('0x1f')](function(){_0x2bb1a0[_0x44fe('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3062,_0x592f73){return function(_0x30bd9e){if(!_0x30bd9e){_0x5d3062[_0x44fe('0x35')](0x194);}return _0x30bd9e;};}function handleError(_0x28b48a,_0x353c0c){_0x353c0c=_0x353c0c||0x1f4;return function(_0x4013fa){logger['error'](_0x4013fa['stack']);if(_0x4013fa[_0x44fe('0x36')]){delete _0x4013fa[_0x44fe('0x36')];}_0x28b48a[_0x44fe('0x2a')](_0x353c0c)[_0x44fe('0x37')](_0x4013fa);};}exports[_0x44fe('0x38')]=function(_0x40f777,_0x4369d8){var _0x5ef4e6={},_0x3476a3={},_0x416027={'count':0x0,'rows':[]};var _0x38ba71=_['map'](db[_0x44fe('0x39')][_0x44fe('0x3a')],function(_0xaea90d){return{'name':_0xaea90d[_0x44fe('0x3b')],'type':_0xaea90d[_0x44fe('0x3c')]['key']};});_0x3476a3[_0x44fe('0x3d')]=_[_0x44fe('0x3e')](_0x38ba71,_0x44fe('0x36'));_0x3476a3[_0x44fe('0x3f')]=_[_0x44fe('0x40')](_0x40f777['query']);_0x3476a3[_0x44fe('0x41')]=_[_0x44fe('0x42')](_0x3476a3[_0x44fe('0x3d')],_0x3476a3['query']);_0x5ef4e6[_0x44fe('0x43')]=_[_0x44fe('0x42')](_0x3476a3['model'],qs[_0x44fe('0x44')](_0x40f777['query'][_0x44fe('0x44')]));_0x5ef4e6[_0x44fe('0x43')]=_0x5ef4e6[_0x44fe('0x43')][_0x44fe('0x45')]?_0x5ef4e6[_0x44fe('0x43')]:_0x3476a3[_0x44fe('0x3d')];if(!_0x40f777[_0x44fe('0x3f')][_0x44fe('0x46')](_0x44fe('0x47'))){_0x5ef4e6[_0x44fe('0x2e')]=qs[_0x44fe('0x2e')](_0x40f777[_0x44fe('0x3f')][_0x44fe('0x2e')]);_0x5ef4e6[_0x44fe('0x2c')]=qs[_0x44fe('0x2c')](_0x40f777[_0x44fe('0x3f')][_0x44fe('0x2c')]);}_0x5ef4e6[_0x44fe('0x48')]=qs[_0x44fe('0x49')](_0x40f777[_0x44fe('0x3f')]['sort']);_0x5ef4e6[_0x44fe('0x4a')]=qs[_0x44fe('0x41')](_[_0x44fe('0x4b')](_0x40f777[_0x44fe('0x3f')],_0x3476a3['filters']),_0x38ba71);if(_0x40f777[_0x44fe('0x3f')][_0x44fe('0x4c')]){_0x5ef4e6[_0x44fe('0x4a')]=_[_0x44fe('0x4d')](_0x5ef4e6[_0x44fe('0x4a')],{'$or':_[_0x44fe('0x3e')](_0x38ba71,function(_0x54a09f){if(_0x54a09f[_0x44fe('0x3c')]!=='VIRTUAL'){var _0x32bed1={};_0x32bed1[_0x54a09f[_0x44fe('0x36')]]={'$like':'%'+_0x40f777['query'][_0x44fe('0x4c')]+'%'};return _0x32bed1;}})});}_0x5ef4e6=_['merge']({},_0x5ef4e6,_0x40f777['options']);var _0x1b21b5={'where':_0x5ef4e6['where']};return db[_0x44fe('0x39')]['count'](_0x1b21b5)[_0x44fe('0x1f')](function(_0x183231){_0x416027[_0x44fe('0x2f')]=_0x183231;if(_0x40f777[_0x44fe('0x3f')][_0x44fe('0x4e')]){_0x5ef4e6[_0x44fe('0x4f')]=[{'all':!![]}];}return db[_0x44fe('0x39')]['findAll'](_0x5ef4e6);})[_0x44fe('0x1f')](function(_0x532108){_0x416027[_0x44fe('0x50')]=_0x532108;return _0x416027;})[_0x44fe('0x1f')](respondWithFilteredResult(_0x4369d8,_0x5ef4e6))[_0x44fe('0x29')](handleError(_0x4369d8,null));};exports[_0x44fe('0x51')]=function(_0x24eca8,_0x265d0a){var _0x1fda25={'raw':!![],'where':{'id':_0x24eca8[_0x44fe('0x52')]['id']}},_0x5c18dd={};_0x5c18dd['model']=_[_0x44fe('0x40')](db[_0x44fe('0x39')][_0x44fe('0x3a')]);_0x5c18dd['query']=_['keys'](_0x24eca8[_0x44fe('0x3f')]);_0x5c18dd[_0x44fe('0x41')]=_[_0x44fe('0x42')](_0x5c18dd[_0x44fe('0x3d')],_0x5c18dd['query']);_0x1fda25[_0x44fe('0x43')]=_[_0x44fe('0x42')](_0x5c18dd[_0x44fe('0x3d')],qs[_0x44fe('0x44')](_0x24eca8['query']['fields']));_0x1fda25['attributes']=_0x1fda25[_0x44fe('0x43')][_0x44fe('0x45')]?_0x1fda25[_0x44fe('0x43')]:_0x5c18dd[_0x44fe('0x3d')];if(_0x24eca8['query'][_0x44fe('0x4e')]){_0x1fda25[_0x44fe('0x4f')]=[{'all':!![]}];}_0x1fda25=_[_0x44fe('0x4d')]({},_0x1fda25,_0x24eca8[_0x44fe('0x53')]);return db[_0x44fe('0x39')][_0x44fe('0x54')](_0x1fda25)[_0x44fe('0x1f')](handleEntityNotFound(_0x265d0a,null))['then'](respondWithResult(_0x265d0a,null))[_0x44fe('0x29')](handleError(_0x265d0a,null));};exports[_0x44fe('0x34')]=function(_0xb7004,_0x47aa4c){if(_0xb7004[_0x44fe('0x55')]['id']){delete _0xb7004[_0x44fe('0x55')]['id'];}return db[_0x44fe('0x39')][_0x44fe('0x54')]({'where':{'id':_0xb7004['params']['id']}})[_0x44fe('0x1f')](handleEntityNotFound(_0x47aa4c,null))['then'](saveUpdates(_0xb7004[_0x44fe('0x55')],null))[_0x44fe('0x1f')](respondWithResult(_0x47aa4c,null))[_0x44fe('0x29')](handleError(_0x47aa4c,null));};exports['destroy']=function(_0x2932cf,_0x2396fb){return db['FaxMessage'][_0x44fe('0x54')]({'where':{'id':_0x2932cf[_0x44fe('0x52')]['id']}})['then'](handleEntityNotFound(_0x2396fb,null))['then'](removeEntity(_0x2396fb,null))[_0x44fe('0x29')](handleError(_0x2396fb,null));};exports[_0x44fe('0x56')]=function(_0x1a8ec6,_0x424fcb){return db[_0x44fe('0x39')][_0x44fe('0x56')]()['then'](respondWithResult(_0x424fcb,null))[_0x44fe('0x29')](handleError(_0x424fcb,null));};var interaction_log=require(_0x44fe('0x57'))('fax-interactions');exports[_0x44fe('0x58')]=function(_0x25325e,_0x218783,_0x138991){var _0x1fbdec={'agent':{},'channel':_0x44fe('0x59')};if(_0x25325e[_0x44fe('0x55')]['id']){delete _0x25325e['body']['id'];}_0x25325e['body'][_0x44fe('0x5a')]=!![];_0x25325e['body']['readAt']=moment()[_0x44fe('0x5b')](_0x44fe('0x5c'));_0x25325e['body'][_0x44fe('0x5d')]=_0x25325e['body'][_0x44fe('0x5d')]||_0x25325e[_0x44fe('0x5e')]['id'];_0x1fbdec[_0x44fe('0x5f')]['id']=_0x25325e[_0x44fe('0x55')][_0x44fe('0x5d')];return db['FaxMessage'][_0x44fe('0x54')]({'where':{'id':_0x25325e['params']['id'],'UserId':null}})[_0x44fe('0x1f')](handleEntityNotFound(_0x218783,null))[_0x44fe('0x1f')](saveUpdates(_0x25325e['body'],null))[_0x44fe('0x1f')](function(_0x55a764){if(_0x55a764){_0x1fbdec[_0x44fe('0x27')]=_0x55a764[_0x44fe('0x60')]({'plain':!![]});return db[_0x44fe('0x61')][_0x44fe('0x54')]({'where':{'id':_0x55a764[_0x44fe('0x62')]}});}return null;})[_0x44fe('0x1f')](handleEntityNotFound(_0x218783,null))[_0x44fe('0x1f')](function(_0x4c17fe){if(_0x4c17fe){return _0x4c17fe[_0x44fe('0x34')]({'UserId':_0x25325e[_0x44fe('0x55')][_0x44fe('0x5d')],'read1stAt':_['isNil'](_0x4c17fe[_0x44fe('0x63')])?moment()[_0x44fe('0x5b')](_0x44fe('0x5c')):undefined});}return null;})[_0x44fe('0x1f')](function(_0x31208){if(_0x31208){_0x1fbdec[_0x44fe('0x64')]=_0x31208['get']({'plain':!![]});interaction_log[_0x44fe('0x20')](_0x44fe('0x65'),_0x25325e['user']['id'],_0x25325e[_0x44fe('0x5e')][_0x44fe('0x36')],_0x25325e['user']['role'],_0x1fbdec[_0x44fe('0x64')]['id'],_0x25325e[_0x44fe('0x55')]?JSON[_0x44fe('0x24')](_0x25325e[_0x44fe('0x55')]):'null');return respondWithRpcPromise(_0x44fe('0x66'),_0x44fe('0x67'),_0x1fbdec);}return null;})[_0x44fe('0x1f')](function(_0x2758ca){var _0x4f64f4=_0x44fe('0x68')+_0x2758ca[_0x44fe('0x27')]['ContactId'];return db[_0x44fe('0x69')]['query'](_0x4f64f4,{'type':db[_0x44fe('0x6a')]['QueryTypes'][_0x44fe('0x6b')],'raw':!![]})[_0x44fe('0x1f')](function(_0x7ca9d1){return _0x7ca9d1;});})['then'](function(_0x211d2e){if(_0x211d2e){_0x1fbdec[_0x44fe('0x27')]['contact']=_0x211d2e[0x0];if(!_0x25325e[_0x44fe('0x55')][_0x44fe('0x5d')])return;return db[_0x44fe('0x6c')]['find']({'where':{'id':_0x25325e['body'][_0x44fe('0x5d')],'role':'agent'},'attributes':['id',_0x44fe('0x36'),'fullname','email',_0x44fe('0x6d')],'raw':!![]});}return null;})[_0x44fe('0x1f')](function(_0x15da94){if(!_0x15da94)return null;_0x1fbdec[_0x44fe('0x27')][_0x44fe('0x5f')]=_0x15da94;return _0x1fbdec;})[_0x44fe('0x1f')](function(_0x27236e){if(_0x27236e){if(_0x25325e[_0x44fe('0x55')][_0x44fe('0x6e')]){_0x1fbdec['message'][_0x44fe('0x6f')]=util[_0x44fe('0x5b')](_0x44fe('0x70'),_0x25325e[_0x44fe('0x5e')][_0x44fe('0x36')]);_0x1fbdec[_0x44fe('0x27')][_0x44fe('0x71')]=_0x1fbdec[_0x44fe('0x71')];_0x1fbdec['message']['motionChannel']=_0x1fbdec[_0x44fe('0x71')];_0x1fbdec['message'][_0x44fe('0x72')]=_0x44fe('0x58');return respondWithRpcPromise('EventManager',_0x44fe('0x73'),{'event':_0x44fe('0x74'),'message':_0x1fbdec[_0x44fe('0x27')]},client9002)[_0x44fe('0x1f')](function(){return _0x1fbdec;});}return _0x1fbdec;}return null;})['then'](respondWithResult(_0x218783,null))['catch'](handleError(_0x218783,null));};var interaction_log=require(_0x44fe('0x57'))(_0x44fe('0x75'));exports[_0x44fe('0x76')]=function(_0x119dcd,_0x2ab4c8,_0x149604){var _0x347d95={'agent':{},'channel':_0x44fe('0x59')};if(_0x119dcd[_0x44fe('0x55')]['id']){delete _0x119dcd[_0x44fe('0x55')]['id'];}_0x119dcd[_0x44fe('0x55')][_0x44fe('0x5d')]=_0x119dcd[_0x44fe('0x55')][_0x44fe('0x5d')]||_0x119dcd[_0x44fe('0x5e')]['id'];_0x347d95[_0x44fe('0x5f')]['id']=_0x119dcd['body'][_0x44fe('0x5d')];return db[_0x44fe('0x39')][_0x44fe('0x54')]({'where':{'id':_0x119dcd['params']['id'],'UserId':null}})[_0x44fe('0x1f')](handleEntityNotFound(_0x2ab4c8,null))[_0x44fe('0x1f')](function(_0x128716){if(_0x128716){_0x347d95['message']=_0x128716[_0x44fe('0x60')]({'plain':!![]});return db[_0x44fe('0x61')][_0x44fe('0x54')]({'where':{'id':_0x128716[_0x44fe('0x62')]}});}return null;})[_0x44fe('0x1f')](handleEntityNotFound(_0x2ab4c8,null))[_0x44fe('0x1f')](function(_0x494a23){if(_0x494a23){_0x347d95['interaction']=_0x494a23[_0x44fe('0x60')]({'plain':!![]});interaction_log[_0x44fe('0x20')](_0x44fe('0x77'),_0x119dcd[_0x44fe('0x5e')]['id'],_0x119dcd['user'][_0x44fe('0x36')],_0x119dcd[_0x44fe('0x5e')][_0x44fe('0x78')],_0x347d95[_0x44fe('0x64')]['id'],_0x119dcd[_0x44fe('0x55')]?JSON[_0x44fe('0x24')](_0x119dcd[_0x44fe('0x55')]):'null');return respondWithRpcPromise('RejectMessage',_0x44fe('0x79'),_0x347d95);}return null;})['then'](function(_0x318d25){var _0x139243=_0x44fe('0x68')+_0x318d25[_0x44fe('0x27')]['ContactId'];return db[_0x44fe('0x69')][_0x44fe('0x3f')](_0x139243,{'type':db[_0x44fe('0x6a')][_0x44fe('0x7a')][_0x44fe('0x6b')],'raw':!![]})[_0x44fe('0x1f')](function(_0x562a14){return _0x562a14;});})[_0x44fe('0x1f')](function(_0x11837e){if(_0x11837e){_0x347d95['message'][_0x44fe('0x7b')]=_0x11837e[0x0];if(!_0x119dcd[_0x44fe('0x55')][_0x44fe('0x5d')])return;return db[_0x44fe('0x6c')]['find']({'where':{'id':_0x119dcd[_0x44fe('0x55')][_0x44fe('0x5d')],'role':_0x44fe('0x5f')},'attributes':['id',_0x44fe('0x36'),'fullname',_0x44fe('0x7c'),_0x44fe('0x6d')],'raw':!![]});}return null;})[_0x44fe('0x1f')](function(_0x3f00d8){if(!_0x3f00d8)return null;_0x347d95[_0x44fe('0x27')]['agent']=_0x3f00d8;return _0x347d95;})['then'](function(_0x175c20){if(_0x175c20){_0x175c20['message']['interface']=util[_0x44fe('0x5b')]('SIP/%s',_0x119dcd['user'][_0x44fe('0x36')]);_0x175c20['message'][_0x44fe('0x71')]=_0x347d95[_0x44fe('0x71')];_0x175c20[_0x44fe('0x27')][_0x44fe('0x7d')]=_0x347d95[_0x44fe('0x71')];_0x175c20[_0x44fe('0x27')][_0x44fe('0x72')]=_0x44fe('0x76');respondWithRpcPromise(_0x44fe('0x73'),'EventManager',{'event':_0x44fe('0x7e'),'message':_0x175c20['message']},client9002);return _0x347d95;}return null;})['then'](respondWithResult(_0x2ab4c8,null))['catch'](handleError(_0x2ab4c8,null));};exports[_0x44fe('0x7f')]=function(_0x3a97b1,_0x42be8a){var _0x324b93;return db[_0x44fe('0x39')][_0x44fe('0x7f')](_0x3a97b1[_0x44fe('0x55')],{})[_0x44fe('0x1f')](function(_0x3d71ce){_0x324b93=_0x3d71ce;return db[_0x44fe('0x80')][_0x44fe('0x81')]({'where':{'id':_0x324b93['ContactId']}});})['then'](function(_0x2d3f8a){if(_[_0x44fe('0x82')](_0x2d3f8a)){return;}else{_0x324b93[_0x44fe('0x59')]=_0x2d3f8a['fax'];return db[_0x44fe('0x83')]['findOne']({'where':{'id':_0x324b93[_0x44fe('0x84')]}});}})[_0x44fe('0x1f')](function(_0x333e24){return respondWithRpcPromise(_0x44fe('0x85'),_0x44fe('0x85'),{'FaxAccountId':_['isNil'](_0x3a97b1[_0x44fe('0x55')])?undefined:_0x3a97b1[_0x44fe('0x55')][_0x44fe('0x86')],'path':_[_0x44fe('0x82')](_0x333e24)?undefined:util[_0x44fe('0x5b')](_0x44fe('0x87'),_0x333e24[_0x44fe('0x88')]),'fax':_[_0x44fe('0x82')](_0x324b93[_0x44fe('0x59')])?undefined:_0x324b93[_0x44fe('0x59')],'AttachmentId':_0x324b93[_0x44fe('0x84')]},client9002);})['then'](respondWithResult(_0x42be8a,0xc9))[_0x44fe('0x29')](handleError(_0x42be8a,null));};exports['download']=function(_0x550283,_0x54853c){var _0x2dd4ca=path[_0x44fe('0x89')](config['root'],_0x44fe('0x8a'),'files',_0x44fe('0x8b'));return db[_0x44fe('0x39')][_0x44fe('0x54')]({'where':{'id':_0x550283[_0x44fe('0x52')]['id']},'include':[{'model':db[_0x44fe('0x83')],'as':_0x44fe('0x83')}]})[_0x44fe('0x1f')](handleEntityNotFound(_0x54853c,null))[_0x44fe('0x1f')](function(_0x494886){if(_0x494886){return _0x54853c[_0x44fe('0x8c')](path[_0x44fe('0x89')](_0x2dd4ca,_0x494886['Attachment']['basename']));}})[_0x44fe('0x29')](handleError(_0x54853c,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 91a5cf6..4a9f946 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 _0x6209=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6209,0x1e8));var _0x9620=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x6209[_0x110c3d];return _0x226d67;};'use strict';var EventEmitter=require(_0x9620('0x0'));var FaxMessage=require(_0x9620('0x1'))['db'][_0x9620('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x9620('0x3')](0x0);var events={'afterCreate':_0x9620('0x4'),'afterUpdate':_0x9620('0x5'),'afterDestroy':_0x9620('0x6')};function emitEvent(_0x5deb40){return function(_0x2869e2,_0x17dc92,_0x2fa00b){FaxMessageEvents['emit'](_0x5deb40+':'+_0x2869e2['id'],_0x2869e2);FaxMessageEvents[_0x9620('0x7')](_0x5deb40,_0x2869e2);_0x2fa00b(null);};}for(var e in events){if(events[_0x9620('0x8')](e)){var event=events[e];FaxMessage[_0x9620('0x9')](e,emitEvent(event));}}module[_0x9620('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0xcaaf=['update','remove','emit','hasOwnProperty','hook','exports','events','FaxMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcaaf,0x66));var _0xfcaa=function(_0x52fac3,_0x288a9b){_0x52fac3=_0x52fac3-0x0;var _0x4692a0=_0xcaaf[_0x52fac3];return _0x4692a0;};'use strict';var EventEmitter=require(_0xfcaa('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xfcaa('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfcaa('0x2'),'afterDestroy':_0xfcaa('0x3')};function emitEvent(_0x4b8844){return function(_0xf120fe,_0x540311,_0x581a66){FaxMessageEvents[_0xfcaa('0x4')](_0x4b8844+':'+_0xf120fe['id'],_0xf120fe);FaxMessageEvents[_0xfcaa('0x4')](_0x4b8844,_0xf120fe);_0x581a66(null);};}for(var e in events){if(events[_0xfcaa('0x5')](e)){var event=events[e];FaxMessage[_0xfcaa('0x6')](e,emitEvent(event));}}module[_0xfcaa('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 6005d12..70ea613 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 _0x99ae=['get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','error','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','FaxMessage','fti_fax_messages','body'];(function(_0x5e9e3d,_0x567718){var _0x579c2c=function(_0xc24425){while(--_0xc24425){_0x5e9e3d['push'](_0x5e9e3d['shift']());}};_0x579c2c(++_0x567718);}(_0x99ae,0xe6));var _0xe99a=function(_0x4eda63,_0x4197d6){_0x4eda63=_0x4eda63-0x0;var _0x373117=_0x99ae[_0x4eda63];return _0x373117;};'use strict';var _=require(_0xe99a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe99a('0x1'));var moment=require(_0xe99a('0x2'));var BPromise=require(_0xe99a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe99a('0x4'));var rimraf=require(_0xe99a('0x5'));var config=require(_0xe99a('0x6'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x421671,_0x42f53e){return _0x421671['define'](_0xe99a('0x7'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xe99a('0x8'),'fields':[_0xe99a('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fc459,_0x2ac995,_0x509ff3){var _0x4a1402=_0x421671['models'];var _0x37cef4=_0x4fc459[_0xe99a('0xa')]({'plain':!![]});if(_0x37cef4[_0xe99a('0xb')][_0xe99a('0xc')]()==='in'||_0x37cef4[_0xe99a('0xb')]['toLowerCase']()===_0xe99a('0xd')&&!_0x37cef4[_0xe99a('0xe')]&&!_[_0xe99a('0xf')](_0x37cef4[_0xe99a('0x10')])){_0x4a1402[_0xe99a('0x11')][_0xe99a('0x12')]({'where':{'id':_0x37cef4[_0xe99a('0x13')]}})[_0xe99a('0x14')](function(_0x48b170){if(_0x48b170){_0x48b170['update']({'lastMsgAt':_0x37cef4[_0xe99a('0x15')],'lastMsgDirection':_0x37cef4[_0xe99a('0xb')]['toLowerCase']()});}})['catch'](function(_0x367500){console[_0xe99a('0x16')](_0x367500);});}_0x509ff3();}},'charset':'utf8mb4','collate':_0xe99a('0x17')});}; \ No newline at end of file +var _0xd95f=['models','get','direction','toLowerCase','secret','UserId','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT'];(function(_0x18d8e9,_0x2d9568){var _0x1b9102=function(_0x4ecf17){while(--_0x4ecf17){_0x18d8e9['push'](_0x18d8e9['shift']());}};_0x1b9102(++_0x2d9568);}(_0xd95f,0x1ce));var _0xfd95=function(_0x22adc9,_0x336720){_0x22adc9=_0x22adc9-0x0;var _0x16fdf8=_0xd95f[_0x22adc9];return _0x16fdf8;};'use strict';var _=require(_0xfd95('0x0'));var util=require(_0xfd95('0x1'));var logger=require(_0xfd95('0x2'))(_0xfd95('0x3'));var moment=require(_0xfd95('0x4'));var BPromise=require(_0xfd95('0x5'));var rp=require(_0xfd95('0x6'));var fs=require('fs');var path=require(_0xfd95('0x7'));var rimraf=require(_0xfd95('0x8'));var config=require(_0xfd95('0x9'));var attributes=require(_0xfd95('0xa'));module[_0xfd95('0xb')]=function(_0x33f014,_0x436227){return _0x33f014[_0xfd95('0xc')](_0xfd95('0xd'),attributes,{'tableName':_0xfd95('0xe'),'paranoid':![],'indexes':[{'name':_0xfd95('0xf'),'fields':[_0xfd95('0x10')],'type':_0xfd95('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47a1f1,_0x1e7641,_0x125e1c){var _0x49907f=_0x33f014[_0xfd95('0x12')];var _0x404a81=_0x47a1f1[_0xfd95('0x13')]({'plain':!![]});if(_0x404a81[_0xfd95('0x14')]['toLowerCase']()==='in'||_0x404a81['direction'][_0xfd95('0x15')]()==='out'&&!_0x404a81[_0xfd95('0x16')]&&!_['isNil'](_0x404a81[_0xfd95('0x17')])){_0x49907f['FaxInteraction'][_0xfd95('0x18')]({'where':{'id':_0x404a81['FaxInteractionId']}})[_0xfd95('0x19')](function(_0x1547a9){if(_0x1547a9){_0x1547a9[_0xfd95('0x1a')]({'lastMsgAt':_0x404a81[_0xfd95('0x1b')],'lastMsgDirection':_0x404a81[_0xfd95('0x14')]['toLowerCase']()});}})[_0xfd95('0x1c')](function(_0xf6994f){console[_0xfd95('0x1d')](_0xf6994f);});}_0x125e1c();}},'charset':_0xfd95('0x1e'),'collate':_0xfd95('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 4d54ba3..7863c08 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 _0x0a9a=['error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','CreateFaxMessage','debug','UpdateFaxMessage','update','raw','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb59d07,_0x547f71){var _0x5a6adf=function(_0x282c9b){while(--_0x282c9b){_0xb59d07['push'](_0xb59d07['shift']());}};_0x5a6adf(++_0x547f71);}(_0x0a9a,0x183));var _0xa0a9=function(_0x5af6ff,_0x421680){_0x5af6ff=_0x5af6ff-0x0;var _0x391471=_0x0a9a[_0x5af6ff];return _0x391471;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});config[_0xa0a9('0xa')]=_['defaults'](config[_0xa0a9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0a9('0xb'))(new Redis(config[_0xa0a9('0xa')]));require(_0xa0a9('0xc'))[_0xa0a9('0xd')](socket);function respondWithRpcPromise(_0x4b9b93,_0x2ba0ac,_0x1b5bfb){return new BPromise(function(_0x5ce7e9,_0x5909cf){return client[_0xa0a9('0xe')](_0x4b9b93,_0x1b5bfb)[_0xa0a9('0xf')](function(_0x51d5a5){logger[_0xa0a9('0x10')]('FaxMessage,\x20%s,\x20%s',_0x2ba0ac,_0xa0a9('0x11'));logger['debug'](_0xa0a9('0x12'),_0x2ba0ac,_0xa0a9('0x11'),JSON[_0xa0a9('0x13')](_0x51d5a5));if(_0x51d5a5[_0xa0a9('0x14')]){if(_0x51d5a5[_0xa0a9('0x14')]['code']===0x1f4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);return _0x5909cf(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}logger['error'](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5['error']['message']);return _0x5ce7e9(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}else{logger[_0xa0a9('0x10')](_0xa0a9('0x15'),_0x2ba0ac,'request\x20sent');_0x5ce7e9(_0x51d5a5[_0xa0a9('0x17')][_0xa0a9('0x16')]);}})[_0xa0a9('0x18')](function(_0x27f8d4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x27f8d4);_0x5909cf(_0x27f8d4);});});}exports['CreateFaxMessage']=function(_0x3cdd8c){var _0x3107ce=this;return new Promise(function(_0x4a8e80,_0x53b99d){return db[_0xa0a9('0x19')][_0xa0a9('0x1a')](_0x3cdd8c[_0xa0a9('0x1b')],{'raw':_0x3cdd8c['options']?_0x3cdd8c[_0xa0a9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa0a9('0xf')](function(_0x5e6148){logger[_0xa0a9('0x10')](_0xa0a9('0x1d'),_0x3cdd8c);logger[_0xa0a9('0x1e')](_0xa0a9('0x1d'),_0x3cdd8c,JSON['stringify'](_0x5e6148));_0x4a8e80(_0x5e6148);})[_0xa0a9('0x18')](function(_0x4fb909){logger[_0xa0a9('0x14')](_0xa0a9('0x1d'),_0x4fb909[_0xa0a9('0x16')],_0x3cdd8c);_0x53b99d(_0x3107ce[_0xa0a9('0x14')](0x1f4,_0x4fb909['message']));});});};exports[_0xa0a9('0x1f')]=function(_0xe49d3b){var _0x384cd5=this;return new Promise(function(_0x3f4bea,_0x526dd1){return db[_0xa0a9('0x19')][_0xa0a9('0x20')](_0xe49d3b[_0xa0a9('0x1b')],{'raw':_0xe49d3b['options']?_0xe49d3b['options'][_0xa0a9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x22')]||null:null,'attributes':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x23')]||null:null,'limit':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x24')]||null:null})[_0xa0a9('0xf')](function(_0x554191){logger[_0xa0a9('0x10')](_0xa0a9('0x1f'),_0xe49d3b);logger['debug'](_0xa0a9('0x1f'),_0xe49d3b,JSON[_0xa0a9('0x13')](_0x554191));_0x3f4bea(_0x554191);})['catch'](function(_0x47c19b){logger[_0xa0a9('0x14')]('UpdateFaxMessage',_0x47c19b['message'],_0xe49d3b);_0x526dd1(_0x384cd5[_0xa0a9('0x14')](0x1f4,_0x47c19b[_0xa0a9('0x16')]));});});}; \ No newline at end of file +var _0x5636=['error','code','message','result','CreateFaxMessage','FaxMessage','body','options','then','UpdateFaxMessage','update','where','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x25678f,_0x5958d5){var _0x1961b5=function(_0x3d0258){while(--_0x3d0258){_0x25678f['push'](_0x25678f['shift']());}};_0x1961b5(++_0x5958d5);}(_0x5636,0x102));var _0x6563=function(_0x5ae504,_0x11ad0c){_0x5ae504=_0x5ae504-0x0;var _0x465f3f=_0x5636[_0x5ae504];return _0x465f3f;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});config[_0x6563('0xa')]=_[_0x6563('0xb')](config[_0x6563('0xa')],{'host':_0x6563('0xc'),'port':0x18eb});var socket=require(_0x6563('0xd'))(new Redis(config[_0x6563('0xa')]));require(_0x6563('0xe'))[_0x6563('0xf')](socket);function respondWithRpcPromise(_0x516d1a,_0x51fdc2,_0x2946f3){return new BPromise(function(_0x129fa3,_0x490a56){return client['request'](_0x516d1a,_0x2946f3)['then'](function(_0x1ef002){logger[_0x6563('0x10')](_0x6563('0x11'),_0x51fdc2,_0x6563('0x12'));logger[_0x6563('0x13')](_0x6563('0x14'),_0x51fdc2,_0x6563('0x12'),JSON[_0x6563('0x15')](_0x1ef002));if(_0x1ef002[_0x6563('0x16')]){if(_0x1ef002['error'][_0x6563('0x17')]===0x1f4){logger['error'](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x490a56(_0x1ef002[_0x6563('0x16')]['message']);}logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x129fa3(_0x1ef002['error'][_0x6563('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x51fdc2,'request\x20sent');_0x129fa3(_0x1ef002[_0x6563('0x19')]['message']);}})['catch'](function(_0x27651b){logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x27651b);_0x490a56(_0x27651b);});});}exports[_0x6563('0x1a')]=function(_0xf8b544){var _0x10811d=this;return new Promise(function(_0x37ba3,_0x93a45){return db[_0x6563('0x1b')]['create'](_0xf8b544[_0x6563('0x1c')],{'raw':_0xf8b544[_0x6563('0x1d')]?_0xf8b544[_0x6563('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x6563('0x1e')](function(_0x5c37bb){logger[_0x6563('0x10')](_0x6563('0x1a'),_0xf8b544);logger['debug']('CreateFaxMessage',_0xf8b544,JSON[_0x6563('0x15')](_0x5c37bb));_0x37ba3(_0x5c37bb);})['catch'](function(_0x1097d0){logger[_0x6563('0x16')](_0x6563('0x1a'),_0x1097d0['message'],_0xf8b544);_0x93a45(_0x10811d[_0x6563('0x16')](0x1f4,_0x1097d0['message']));});});};exports[_0x6563('0x1f')]=function(_0x1590e6){var _0x5e5aeb=this;return new Promise(function(_0x365b16,_0x28252d){return db['FaxMessage'][_0x6563('0x20')](_0x1590e6['body'],{'raw':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')][_0x6563('0x21')]||null:null,'attributes':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')]['attributes']||null:null,'limit':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['limit']||null:null})[_0x6563('0x1e')](function(_0x35af37){logger[_0x6563('0x10')](_0x6563('0x1f'),_0x1590e6);logger[_0x6563('0x13')](_0x6563('0x1f'),_0x1590e6,JSON[_0x6563('0x15')](_0x35af37));_0x365b16(_0x35af37);})[_0x6563('0x22')](function(_0x101b24){logger[_0x6563('0x16')]('UpdateFaxMessage',_0x101b24[_0x6563('0x18')],_0x1590e6);_0x28252d(_0x5e5aeb[_0x6563('0x16')](0x1f4,_0x101b24[_0x6563('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index e433995..e5c8600 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 _0xb011=['update','emit','length','save','remove'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xb011,0x99));var _0x1b01=function(_0x4b16ff,_0x1d427c){_0x4b16ff=_0x4b16ff-0x0;var _0x47f12a=_0xb011[_0x4b16ff];return _0x47f12a;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x1b01('0x0'),_0x1b01('0x1'),_0x1b01('0x2')];function createListener(_0x2e8ae4,_0x369579){return function(_0x5d8620){_0x369579[_0x1b01('0x3')](_0x2e8ae4,_0x5d8620);};}function removeListener(_0x5853f8,_0x8c07ec){return function(){FaxMessageEvents['removeListener'](_0x5853f8,_0x8c07ec);};}exports['register']=function(_0x25a9bf){for(var _0x42eadc=0x0,_0x1f6008=events[_0x1b01('0x4')];_0x42eadc<_0x1f6008;_0x42eadc++){var _0x4d17a6=events[_0x42eadc];var _0x5471fc=createListener('faxMessage:'+_0x4d17a6,_0x25a9bf);FaxMessageEvents['on'](_0x4d17a6,_0x5471fc);}}; \ No newline at end of file +var _0x7385=['removeListener','register','faxMessage:','./faxMessage.events','update','emit'];(function(_0x3c3d3c,_0x1b8ff4){var _0x41d1b5=function(_0x3b7623){while(--_0x3b7623){_0x3c3d3c['push'](_0x3c3d3c['shift']());}};_0x41d1b5(++_0x1b8ff4);}(_0x7385,0x11d));var _0x5738=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7385[_0x5b644e];return _0x49c6bf;};'use strict';var FaxMessageEvents=require(_0x5738('0x0'));var events=['save','remove',_0x5738('0x1')];function createListener(_0x5e9949,_0x51bf2e){return function(_0x6691bd){_0x51bf2e[_0x5738('0x2')](_0x5e9949,_0x6691bd);};}function removeListener(_0x233241,_0x13d04f){return function(){FaxMessageEvents[_0x5738('0x3')](_0x233241,_0x13d04f);};}exports[_0x5738('0x4')]=function(_0x4f85e4){for(var _0x3a705a=0x0,_0x36f7f6=events['length'];_0x3a705a<_0x36f7f6;_0x3a705a++){var _0x4ac9ca=events[_0x3a705a];var _0xf115c4=createListener(_0x5738('0x5')+_0x4ac9ca,_0x4f85e4);FaxMessageEvents['on'](_0x4ac9ca,_0xf115c4);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 942763d..4d9494c 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 _0xd3d1=['put','update','accept','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create'];(function(_0x343efd,_0x38b3ab){var _0x437670=function(_0x4ae231){while(--_0x4ae231){_0x343efd['push'](_0x343efd['shift']());}};_0x437670(++_0x38b3ab);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd3d1[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3d('0x2'));var router=express[_0x1d3d('0x3')]();var fs_extra=require(_0x1d3d('0x4'));var auth=require(_0x1d3d('0x5'));var interaction=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var controller=require(_0x1d3d('0x8'));router[_0x1d3d('0x9')]('/',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xb')]);router[_0x1d3d('0x9')](_0x1d3d('0xc'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xd')]);router[_0x1d3d('0x9')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller['show']);router[_0x1d3d('0x9')](_0x1d3d('0xf'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x10')]);router[_0x1d3d('0x11')]('/',auth[_0x1d3d('0xa')](),interaction[_0x1d3d('0x12')](_0x1d3d('0x13'),_0x1d3d('0x14')),controller[_0x1d3d('0x15')]);router[_0x1d3d('0x16')]('/:id',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x17')]);router['put']('/:id/accept',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x18')]);router[_0x1d3d('0x16')]('/:id/reject',auth[_0x1d3d('0xa')](),controller['reject']);router[_0x1d3d('0x19')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x1a')]);module[_0x1d3d('0x1b')]=router; \ No newline at end of file +var _0x579c=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x128ee8,_0x4aafab){var _0x359fc3=function(_0xbdeefb){while(--_0xbdeefb){_0x128ee8['push'](_0x128ee8['shift']());}};_0x359fc3(++_0x4aafab);}(_0x579c,0xda));var _0xc579=function(_0x32fb8d,_0x567a64){_0x32fb8d=_0x32fb8d-0x0;var _0x37cf13=_0x579c[_0x32fb8d];return _0x37cf13;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/describe',auth[_0xc579('0xa')](),controller[_0xc579('0xc')]);router[_0xc579('0x9')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0x9')](_0xc579('0xf'),auth['isAuthenticated'](),controller[_0xc579('0x10')]);router[_0xc579('0x11')]('/',auth[_0xc579('0xa')](),interaction[_0xc579('0x12')](_0xc579('0x13'),_0xc579('0x14')),controller[_0xc579('0x15')]);router[_0xc579('0x16')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0x17')]);router['put'](_0xc579('0x18'),auth['isAuthenticated'](),controller[_0xc579('0x19')]);router['put'](_0xc579('0x1a'),auth['isAuthenticated'](),controller[_0xc579('0x1b')]);router['delete'](_0xc579('0xd'),auth[_0xc579('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fbec405..da2fd8f 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 _0x51a2=['roundrobin','INTEGER','sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x51a2,0x16a));var _0x251a=function(_0x26d034,_0x2c22db){_0x26d034=_0x26d034-0x0;var _0x3015aa=_0x51a2[_0x26d034];return _0x3015aa;};'use strict';var Sequelize=require(_0x251a('0x0'));module[_0x251a('0x1')]={'name':{'type':Sequelize[_0x251a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x251a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x251a('0x3')](_0x251a('0x4'),_0x251a('0x5'),_0x251a('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x251a('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9cef=['name','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x10bd94,_0x46b509){var _0x364677=function(_0x417683){while(--_0x417683){_0x10bd94['push'](_0x10bd94['shift']());}};_0x364677(++_0x46b509);}(_0x9cef,0xee));var _0xf9ce=function(_0x258d86,_0x2ac3f3){_0x258d86=_0x258d86-0x0;var _0x46ff28=_0x9cef[_0x258d86];return _0x46ff28;};'use strict';var Sequelize=require(_0xf9ce('0x0'));module[_0xf9ce('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf9ce('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf9ce('0x3')]},'timeout':{'type':Sequelize[_0xf9ce('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf9ce('0x5'),_0xf9ce('0x6'),_0xf9ce('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xf9ce('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 8222610..52426b9 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 _0x8223=['type','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAndCountAll','createdAt','%s/%s','faxPause','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','includes','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x8223,0x1e8));var _0x3822=function(_0x322254,_0x494764){_0x322254=_0x322254-0x0;var _0x34c8d0=_0x8223[_0x322254];return _0x34c8d0;};'use strict';var emlformat=require(_0x3822('0x0'));var rimraf=require(_0x3822('0x1'));var zipdir=require(_0x3822('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3822('0x3'));var Mustache=require(_0x3822('0x4'));var util=require(_0x3822('0x5'));var path=require(_0x3822('0x6'));var sox=require(_0x3822('0x7'));var csv=require(_0x3822('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3822('0x9'));var squel=require(_0x3822('0xa'));var crypto=require('crypto');var jsforce=require(_0x3822('0xb'));var deskjs=require(_0x3822('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3822('0xd'));var Papa=require(_0x3822('0xe'));var Redis=require(_0x3822('0xf'));var authService=require(_0x3822('0x10'));var qs=require(_0x3822('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3822('0x12'))(_0x3822('0x13'));var utils=require(_0x3822('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3822('0x15'));var db=require(_0x3822('0x16'))['db'];config[_0x3822('0x17')]=_[_0x3822('0x18')](config[_0x3822('0x17')],{'host':_0x3822('0x19'),'port':0x18eb});var socket=require(_0x3822('0x1a'))(new Redis(config[_0x3822('0x17')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x5e9340,_0xba911d){_0xba911d=_0xba911d||0xcc;return function(_0x35271a){if(_0x35271a){return _0x5e9340[_0x3822('0x1b')](_0xba911d);}return _0x5e9340['status'](_0xba911d)['end']();};}function respondWithResult(_0x236fb6,_0x537c67){_0x537c67=_0x537c67||0xc8;return function(_0xe7531b){if(_0xe7531b){return _0x236fb6[_0x3822('0x1c')](_0x537c67)[_0x3822('0x1d')](_0xe7531b);}};}function respondWithFilteredResult(_0x1a848b,_0x51a35d){return function(_0x40e4fe){if(_0x40e4fe){var _0x4052ac=typeof _0x51a35d[_0x3822('0x1e')]===_0x3822('0x1f')&&typeof _0x51a35d[_0x3822('0x20')]===_0x3822('0x1f');var _0x23e0ac=_0x40e4fe[_0x3822('0x21')];var _0x208831=_0x4052ac?0x0:_0x51a35d[_0x3822('0x1e')];var _0x5b79cb=_0x4052ac?_0x40e4fe['count']:_0x51a35d[_0x3822('0x1e')]+_0x51a35d[_0x3822('0x20')];var _0x1dc0bd;if(_0x5b79cb>=_0x23e0ac){_0x5b79cb=_0x23e0ac;_0x1dc0bd=0xc8;}else{_0x1dc0bd=0xce;}_0x1a848b[_0x3822('0x1c')](_0x1dc0bd);return _0x1a848b[_0x3822('0x22')](_0x3822('0x23'),_0x208831+'-'+_0x5b79cb+'/'+_0x23e0ac)['json'](_0x40e4fe);}return null;};}function patchUpdates(_0x506af1){return function(_0x149029){try{jsonpatch[_0x3822('0x24')](_0x149029,_0x506af1,!![]);}catch(_0x5920ba){return BPromise[_0x3822('0x25')](_0x5920ba);}return _0x149029[_0x3822('0x26')]();};}function saveUpdates(_0x48f298,_0x2c1d61){return function(_0x1bbe07){if(_0x1bbe07){return _0x1bbe07[_0x3822('0x27')](_0x48f298)[_0x3822('0x28')](function(_0x11aa48){return _0x11aa48;});}return null;};}function removeEntity(_0x284399,_0x112702){return function(_0x163f97){if(_0x163f97){return _0x163f97[_0x3822('0x29')]()[_0x3822('0x28')](function(){var _0x54581d=_0x163f97[_0x3822('0x2a')]({'plain':!![]});var _0x14c174=_0x3822('0x2b');return db['UserProfileResource'][_0x3822('0x29')]({'where':{'type':_0x14c174,'resourceId':_0x54581d['id']}})[_0x3822('0x28')](function(){return _0x163f97;});})[_0x3822('0x28')](function(){_0x284399[_0x3822('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x95c5e2,_0x54b8ae){return function(_0x4b2ef4){if(!_0x4b2ef4){_0x95c5e2[_0x3822('0x1b')](0x194);}return _0x4b2ef4;};}function handleError(_0x59ac49,_0x26a77a){_0x26a77a=_0x26a77a||0x1f4;return function(_0x4b4d20){logger[_0x3822('0x2c')](_0x4b4d20[_0x3822('0x2d')]);if(_0x4b4d20[_0x3822('0x2e')]){delete _0x4b4d20[_0x3822('0x2e')];}_0x59ac49[_0x3822('0x1c')](_0x26a77a)[_0x3822('0x2f')](_0x4b4d20);};}exports[_0x3822('0x30')]=function(_0x2ff18b,_0x494ce1){var _0x5c0184={},_0x4163a3={},_0x37c3be={'count':0x0,'rows':[]};var _0xdf07ed=_['map'](db[_0x3822('0x31')][_0x3822('0x32')],function(_0x198d96){return{'name':_0x198d96[_0x3822('0x33')],'type':_0x198d96[_0x3822('0x34')]['key']};});_0x4163a3[_0x3822('0x35')]=_[_0x3822('0x36')](_0xdf07ed,'name');_0x4163a3[_0x3822('0x37')]=_['keys'](_0x2ff18b[_0x3822('0x37')]);_0x4163a3[_0x3822('0x38')]=_['intersection'](_0x4163a3[_0x3822('0x35')],_0x4163a3[_0x3822('0x37')]);_0x5c0184[_0x3822('0x39')]=_['intersection'](_0x4163a3[_0x3822('0x35')],qs[_0x3822('0x3a')](_0x2ff18b[_0x3822('0x37')][_0x3822('0x3a')]));_0x5c0184[_0x3822('0x39')]=_0x5c0184[_0x3822('0x39')]['length']?_0x5c0184['attributes']:_0x4163a3[_0x3822('0x35')];if(!_0x2ff18b[_0x3822('0x37')][_0x3822('0x3b')](_0x3822('0x3c'))){_0x5c0184[_0x3822('0x20')]=qs[_0x3822('0x20')](_0x2ff18b[_0x3822('0x37')][_0x3822('0x20')]);_0x5c0184[_0x3822('0x1e')]=qs[_0x3822('0x1e')](_0x2ff18b[_0x3822('0x37')][_0x3822('0x1e')]);}_0x5c0184[_0x3822('0x3d')]=qs[_0x3822('0x3e')](_0x2ff18b[_0x3822('0x37')][_0x3822('0x3e')]);_0x5c0184[_0x3822('0x3f')]=qs[_0x3822('0x38')](_[_0x3822('0x40')](_0x2ff18b['query'],_0x4163a3['filters']),_0xdf07ed);if(_0x2ff18b['query'][_0x3822('0x41')]){_0x5c0184['where']=_['merge'](_0x5c0184[_0x3822('0x3f')],{'$or':_['map'](_0xdf07ed,function(_0x2d4de5){if(_0x2d4de5[_0x3822('0x34')]!==_0x3822('0x42')){var _0x3988dd={};_0x3988dd[_0x2d4de5[_0x3822('0x2e')]]={'$like':'%'+_0x2ff18b[_0x3822('0x37')][_0x3822('0x41')]+'%'};return _0x3988dd;}})});}_0x5c0184=_[_0x3822('0x43')]({},_0x5c0184,_0x2ff18b[_0x3822('0x44')]);var _0x272901={'where':_0x5c0184['where']};return db[_0x3822('0x31')]['count'](_0x272901)[_0x3822('0x28')](function(_0x4c16fc){_0x37c3be[_0x3822('0x21')]=_0x4c16fc;if(_0x2ff18b[_0x3822('0x37')]['includeAll']){_0x5c0184[_0x3822('0x45')]=[{'all':!![]}];}return db[_0x3822('0x31')][_0x3822('0x46')](_0x5c0184);})[_0x3822('0x28')](function(_0x435ea8){_0x37c3be[_0x3822('0x47')]=_0x435ea8;return _0x37c3be;})[_0x3822('0x28')](respondWithFilteredResult(_0x494ce1,_0x5c0184))[_0x3822('0x48')](handleError(_0x494ce1,null));};exports[_0x3822('0x49')]=function(_0x5a01bb,_0x372f7){var _0x5b7d27={'raw':!![],'where':{'id':_0x5a01bb[_0x3822('0x4a')]['id']}},_0x2dba6c={};_0x2dba6c[_0x3822('0x35')]=_['keys'](db[_0x3822('0x31')][_0x3822('0x32')]);_0x2dba6c[_0x3822('0x37')]=_[_0x3822('0x4b')](_0x5a01bb[_0x3822('0x37')]);_0x2dba6c[_0x3822('0x38')]=_[_0x3822('0x4c')](_0x2dba6c['model'],_0x2dba6c[_0x3822('0x37')]);_0x5b7d27[_0x3822('0x39')]=_[_0x3822('0x4c')](_0x2dba6c[_0x3822('0x35')],qs[_0x3822('0x3a')](_0x5a01bb[_0x3822('0x37')][_0x3822('0x3a')]));_0x5b7d27['attributes']=_0x5b7d27[_0x3822('0x39')][_0x3822('0x4d')]?_0x5b7d27[_0x3822('0x39')]:_0x2dba6c[_0x3822('0x35')];if(_0x5a01bb[_0x3822('0x37')]['includeAll']){_0x5b7d27[_0x3822('0x45')]=[{'all':!![]}];}_0x5b7d27=_[_0x3822('0x43')]({},_0x5b7d27,_0x5a01bb[_0x3822('0x44')]);return db['FaxQueue'][_0x3822('0x4e')](_0x5b7d27)['then'](handleEntityNotFound(_0x372f7,null))['then'](respondWithResult(_0x372f7,null))[_0x3822('0x48')](handleError(_0x372f7,null));};exports[_0x3822('0x4f')]=function(_0x232556,_0x54f360){return db[_0x3822('0x31')]['create'](_0x232556[_0x3822('0x50')],{})[_0x3822('0x28')](function(_0x6490c3){var _0x41e6f9=_0x232556[_0x3822('0x51')][_0x3822('0x2a')]({'plain':!![]});if(!_0x41e6f9)throw new Error(_0x3822('0x52'));if(_0x41e6f9[_0x3822('0x53')]===_0x3822('0x51')){var _0x1a5808=_0x6490c3[_0x3822('0x2a')]({'plain':!![]});var _0x4ff5f9=_0x3822('0x2b');return db[_0x3822('0x54')][_0x3822('0x4e')]({'where':{'name':_0x4ff5f9,'userProfileId':_0x41e6f9['userProfileId']},'raw':!![]})['then'](function(_0x2114aa){if(_0x2114aa&&_0x2114aa[_0x3822('0x55')]===0x0){return db['UserProfileResource'][_0x3822('0x4f')]({'name':_0x1a5808['name'],'resourceId':_0x1a5808['id'],'type':_0x2114aa[_0x3822('0x2e')],'sectionId':_0x2114aa['id']},{})[_0x3822('0x28')](function(){return _0x6490c3;});}else{return _0x6490c3;}})['catch'](function(_0x303438){logger[_0x3822('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x303438);throw _0x303438;});}return _0x6490c3;})['then'](respondWithResult(_0x54f360,0xc9))[_0x3822('0x48')](handleError(_0x54f360,null));};exports[_0x3822('0x27')]=function(_0x236c16,_0x4262d9){if(_0x236c16[_0x3822('0x50')]['id']){delete _0x236c16['body']['id'];}return db[_0x3822('0x31')]['find']({'where':{'id':_0x236c16[_0x3822('0x4a')]['id']}})[_0x3822('0x28')](handleEntityNotFound(_0x4262d9,null))[_0x3822('0x28')](saveUpdates(_0x236c16['body'],null))['then'](respondWithResult(_0x4262d9,null))[_0x3822('0x48')](handleError(_0x4262d9,null));};exports[_0x3822('0x29')]=function(_0x2f199f,_0x20b55c){return db['FaxQueue']['find']({'where':{'id':_0x2f199f['params']['id']}})['then'](handleEntityNotFound(_0x20b55c,null))[_0x3822('0x28')](removeEntity(_0x20b55c,null))[_0x3822('0x48')](handleError(_0x20b55c,null));};exports[_0x3822('0x56')]=function(_0x166550,_0x47e2c2){return db[_0x3822('0x31')][_0x3822('0x56')]()[_0x3822('0x28')](respondWithResult(_0x47e2c2,null))[_0x3822('0x48')](handleError(_0x47e2c2,null));};exports[_0x3822('0x57')]=function(_0x54f820,_0x146767,_0x5b82ca){var _0x2578bd={'raw':!![],'where':{}},_0x27d07f={},_0x1c4c5b;return db[_0x3822('0x31')][_0x3822('0x58')]({'where':{'id':_0x54f820[_0x3822('0x4a')]['id']}})[_0x3822('0x28')](handleEntityNotFound(_0x146767,null))['then'](function(_0x2054cc){if(_0x2054cc){_0x1c4c5b=_0x2054cc[_0x3822('0x2a')]({'plain':!![]});_0x27d07f[_0x3822('0x35')]=_['keys'](db[_0x3822('0x59')][_0x3822('0x32')]);_0x27d07f[_0x3822('0x37')]=_['keys'](_0x54f820[_0x3822('0x37')]);_0x27d07f[_0x3822('0x38')]=_[_0x3822('0x4c')](_0x27d07f[_0x3822('0x35')],_0x27d07f[_0x3822('0x37')]);_0x2578bd[_0x3822('0x39')]=_[_0x3822('0x4c')](_0x27d07f[_0x3822('0x35')],qs['fields'](_0x54f820['query'][_0x3822('0x3a')]));_0x2578bd[_0x3822('0x39')]=_0x2578bd[_0x3822('0x39')][_0x3822('0x4d')]?_0x2578bd[_0x3822('0x39')]:_0x27d07f[_0x3822('0x35')];if(!_0x54f820['query']['hasOwnProperty'](_0x3822('0x3c'))){_0x2578bd[_0x3822('0x20')]=qs[_0x3822('0x20')](_0x54f820['query'][_0x3822('0x20')]);_0x2578bd[_0x3822('0x1e')]=qs['offset'](_0x54f820[_0x3822('0x37')][_0x3822('0x1e')]);}_0x2578bd[_0x3822('0x3d')]=qs['sort'](_0x54f820[_0x3822('0x37')]['sort']);_0x2578bd['where']=qs[_0x3822('0x38')](_['pick'](_0x54f820[_0x3822('0x37')],_0x27d07f['filters']));_0x2578bd['where'][_0x3822('0x5a')]=_0x2054cc['id'];if(_0x54f820[_0x3822('0x37')][_0x3822('0x41')]){_0x2578bd[_0x3822('0x3f')]=_['merge'](_0x2578bd[_0x3822('0x3f')],{'$or':_[_0x3822('0x36')](_0x2578bd[_0x3822('0x39')],function(_0x2d25fb){var _0x4dafbf={};_0x4dafbf[_0x2d25fb]={'$like':'%'+_0x54f820[_0x3822('0x37')][_0x3822('0x41')]+'%'};return _0x4dafbf;})});}_0x2578bd=_[_0x3822('0x43')]({},_0x2578bd,_0x54f820[_0x3822('0x44')]);return db[_0x3822('0x59')][_0x3822('0x46')](_0x2578bd);}})[_0x3822('0x28')](function(_0x5dd793){if(_0x5dd793){return db['User'][_0x3822('0x5b')]({'where':{'id':_['map'](_0x5dd793,'UserId'),'role':'agent'},'attributes':['id','name','faxPause','updatedAt',_0x3822('0x5c')]});}})['then'](function(_0x4cf673){if(_0x4cf673){return{'count':_0x4cf673[_0x3822('0x21')],'rows':_[_0x3822('0x36')](_0x4cf673['rows'],function(_0xf85e65){return{'membername':_0xf85e65[_0x3822('0x2e')],'UserId':_0xf85e65['id'],'queue_name':_0x1c4c5b[_0x3822('0x2e')],'FaxQueueId':_0x1c4c5b['id'],'interface':util['format'](_0x3822('0x5d'),'SIP',_0xf85e65[_0x3822('0x2e')]),'penalty':0x0,'paused':_0xf85e65[_0x3822('0x5e')],'createdAt':_0xf85e65[_0x3822('0x5c')],'updatedAt':_0xf85e65['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3822('0x28')](respondWithFilteredResult(_0x146767,_0x2578bd))['catch'](handleError(_0x146767,null));};exports['getTeams']=function(_0x3429b8,_0x15d738,_0x3b76a5){var _0x1fbde8={};var _0x18f00b={};var _0x51c30c;var _0x23a8ff;return db[_0x3822('0x31')][_0x3822('0x58')]({'where':{'id':_0x3429b8[_0x3822('0x4a')]['id']}})['then'](handleEntityNotFound(_0x15d738,null))[_0x3822('0x28')](function(_0x1f93cf){if(_0x1f93cf){_0x51c30c=_0x1f93cf;_0x18f00b[_0x3822('0x35')]=_[_0x3822('0x4b')](db[_0x3822('0x5f')][_0x3822('0x32')]);_0x18f00b['query']=_[_0x3822('0x4b')](_0x3429b8[_0x3822('0x37')]);_0x18f00b['filters']=_['intersection'](_0x18f00b[_0x3822('0x35')],_0x18f00b[_0x3822('0x37')]);_0x1fbde8[_0x3822('0x39')]=_['intersection'](_0x18f00b[_0x3822('0x35')],qs['fields'](_0x3429b8[_0x3822('0x37')][_0x3822('0x3a')]));_0x1fbde8[_0x3822('0x39')]=_0x1fbde8['attributes'][_0x3822('0x4d')]?_0x1fbde8[_0x3822('0x39')]:_0x18f00b[_0x3822('0x35')];_0x1fbde8[_0x3822('0x3d')]=qs['sort'](_0x3429b8['query']['sort']);_0x1fbde8[_0x3822('0x3f')]=qs[_0x3822('0x38')](_[_0x3822('0x40')](_0x3429b8[_0x3822('0x37')],_0x18f00b[_0x3822('0x38')]));if(_0x3429b8[_0x3822('0x37')][_0x3822('0x41')]){_0x1fbde8[_0x3822('0x3f')]=_[_0x3822('0x43')](_0x1fbde8['where'],{'$or':_['map'](_0x1fbde8[_0x3822('0x39')],function(_0x1ef5bf){var _0x24232d={};_0x24232d[_0x1ef5bf]={'$like':'%'+_0x3429b8[_0x3822('0x37')]['filter']+'%'};return _0x24232d;})});}_0x1fbde8=_[_0x3822('0x43')]({},_0x1fbde8,_0x3429b8['options']);return _0x51c30c['getTeams'](_0x1fbde8);}})['then'](function(_0x23a6f5){if(_0x23a6f5){_0x23a8ff=_0x23a6f5[_0x3822('0x4d')];if(!_0x3429b8[_0x3822('0x37')][_0x3822('0x3b')](_0x3822('0x3c'))){_0x1fbde8[_0x3822('0x20')]=qs['limit'](_0x3429b8[_0x3822('0x37')][_0x3822('0x20')]);_0x1fbde8['offset']=qs[_0x3822('0x1e')](_0x3429b8[_0x3822('0x37')][_0x3822('0x1e')]);}return _0x51c30c[_0x3822('0x60')](_0x1fbde8);}})[_0x3822('0x28')](function(_0x19ffc3){if(_0x19ffc3){return _0x19ffc3?{'count':_0x23a8ff,'rows':_0x19ffc3}:null;}})[_0x3822('0x28')](respondWithResult(_0x15d738,null))[_0x3822('0x48')](handleError(_0x15d738,null));};exports[_0x3822('0x61')]=function(_0x3bf290,_0x32e748,_0x5eea8c){var _0x227516=_0x3bf290[_0x3822('0x50')][_0x3822('0x62')];return db['Team'][_0x3822('0x46')]({'where':{'id':_0x227516},'attributes':['id'],'include':[{'model':db[_0x3822('0x63')],'as':_0x3822('0x64'),'attributes':['id',_0x3822('0x2e'),_0x3822('0x65'),_0x3822('0x66'),_0x3822('0x67')],'raw':!![]}]})[_0x3822('0x28')](function(_0x268e62){if(_0x268e62){var _0x2ddfb3=_['flatMap'](_0x268e62,function(_0x413bc5){var _0xae9b6a=_0x413bc5[_0x3822('0x2a')]({'plain':!![]});return _0xae9b6a[_0x3822('0x64')];});return db[_0x3822('0x31')]['find']({'where':{'id':_0x3bf290[_0x3822('0x4a')]['id']}})[_0x3822('0x28')](function(_0x4b2af3){return db['sequelize'][_0x3822('0x68')](function(_0xa8c8c9){return _0x4b2af3['addTeams'](_0x227516,{'transaction':_0xa8c8c9})[_0x3822('0x28')](function(){return BPromise[_0x3822('0x69')](_0x2ddfb3,function(_0x13ac2a){return db[_0x3822('0x59')][_0x3822('0x6a')]({'where':{'UserId':_0x13ac2a['id'],'FaxQueueId':_0x3bf290[_0x3822('0x4a')]['id']},'transaction':_0xa8c8c9});});})[_0x3822('0x28')](function(){_0x2ddfb3[_0x3822('0x6b')](function(_0x1482d4){socket[_0x3822('0x6c')](_0x3822('0x6d'),{'UserId':_0x1482d4['id'],'FaxQueueId':_0x4b2af3['id']});});});});});}})[_0x3822('0x28')](respondWithStatusCode(_0x32e748,null))['catch'](handleError(_0x32e748,null));};exports[_0x3822('0x6e')]=function(_0x286373,_0x130493,_0x133611){return db[_0x3822('0x5f')]['findAll']({'where':{'id':_0x286373[_0x3822('0x37')][_0x3822('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3822('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x130493,null))[_0x3822('0x28')](function(_0xa51c63){var _0x18b9ae=_[_0x3822('0x36')](_0xa51c63,'id');var _0x3afa81=[];var _0x12a5f4=[];var _0xf248ec=squel['select']();_0xf248ec[_0x3822('0x6f')](_0x3822('0x70'))[_0x3822('0x71')](_0x3822('0x72'),'tq')[_0x3822('0x73')](_0x3822('0x74'),'ut',_0x3822('0x75'))[_0x3822('0x3f')]('FaxQueueId\x20=\x20?',_0x286373[_0x3822('0x4a')]['id']);for(var _0x4a2f27=0x0;_0x4a2f27<_0xa51c63[_0x3822('0x4d')];_0x4a2f27+=0x1){let _0x23c12e=_0xa51c63[_0x4a2f27];for(var _0x37d5e4=0x0;_0x37d5e4<_0x23c12e[_0x3822('0x64')][_0x3822('0x4d')];_0x37d5e4+=0x1){let _0x4dfb50=_0x23c12e[_0x3822('0x64')][_0x37d5e4];var _0x113911=_0xf248ec[_0x3822('0x76')]();_0x113911['where'](_0x3822('0x77'),_0x4dfb50['id']);_0x12a5f4[_0x3822('0x78')](db[_0x3822('0x79')][_0x3822('0x37')](_0x113911[_0x3822('0x7a')](),{'type':db[_0x3822('0x79')]['QueryTypes'][_0x3822('0x7b')]})['then'](function(_0x119e7f){if(_0x119e7f[_0x3822('0x4d')]===0x1){return _0x4dfb50['id'];}else{var _0x244829=_[_0x3822('0x7c')](_[_0x3822('0x36')](_0x119e7f,'TeamId'),function(_0x5de8cf){return _[_0x3822('0x7d')](_0x18b9ae,_0x5de8cf);});if(_0x244829){return _0x4dfb50['id'];}}}));}}return BPromise['all'](_0x12a5f4)[_0x3822('0x28')](function(_0xfafed7){_0x3afa81=_(_0x3afa81)[_0x3822('0x7e')](_0xfafed7)[_0x3822('0x7f')]()['value']();return db[_0x3822('0x31')]['find']({'where':{'id':_0x286373[_0x3822('0x4a')]['id']}})[_0x3822('0x28')](function(_0x57ca78){return db[_0x3822('0x79')][_0x3822('0x68')](function(_0x1e8d0f){return _0x57ca78[_0x3822('0x6e')](_0x286373[_0x3822('0x37')]['ids'],{'transaction':_0x1e8d0f})[_0x3822('0x28')](function(){if(!_[_0x3822('0x80')](_0x3afa81)){return _0x57ca78[_0x3822('0x81')](_0x3afa81,{'transaction':_0x1e8d0f});}})['then'](function(){_0x3afa81[_0x3822('0x6b')](function(_0x3ea77d){socket['emit'](_0x3822('0x82'),{'UserId':_0x3ea77d,'FaxQueueId':_0x57ca78['id']});});});});});});})[_0x3822('0x28')](respondWithStatusCode(_0x130493,null))[_0x3822('0x48')](handleError(_0x130493,null));};exports[_0x3822('0x83')]=function(_0x3e82d0,_0x42c5b1,_0x334d43){return db[_0x3822('0x31')][_0x3822('0x4e')]({'where':{'id':_0x3e82d0[_0x3822('0x4a')]['id']}})[_0x3822('0x28')](handleEntityNotFound(_0x42c5b1,null))[_0x3822('0x28')](function(_0x2cf0d5){if(_0x2cf0d5){return _0x2cf0d5['addAgents'](_0x3e82d0[_0x3822('0x50')][_0x3822('0x62')],_['omit'](_0x3e82d0[_0x3822('0x50')],[_0x3822('0x62'),'id'])||{})[_0x3822('0x84')](function(_0x2d576d){for(var _0x5f4454=0x0;_0x5f4454<_0x3e82d0['body'][_0x3822('0x62')][_0x3822('0x4d')];_0x5f4454+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x3e82d0[_0x3822('0x50')]['ids'][_0x5f4454]),'FaxQueueId':Number(_0x3e82d0['params']['id'])});}return _0x2d576d;});}})[_0x3822('0x28')](respondWithResult(_0x42c5b1,null))['catch'](handleError(_0x42c5b1,null));};exports[_0x3822('0x81')]=function(_0x122cd8,_0x3628be,_0x49dc84){return db[_0x3822('0x31')][_0x3822('0x4e')]({'where':{'id':_0x122cd8[_0x3822('0x4a')]['id']}})[_0x3822('0x28')](handleEntityNotFound(_0x3628be,null))[_0x3822('0x28')](function(_0x5da527){if(_0x5da527){return _0x5da527[_0x3822('0x81')](_0x122cd8[_0x3822('0x37')][_0x3822('0x62')])[_0x3822('0x28')](function(){if(_[_0x3822('0x85')](_0x122cd8[_0x3822('0x37')]['ids'])){for(var _0x156851=0x0;_0x156851<_0x122cd8[_0x3822('0x37')][_0x3822('0x62')][_0x3822('0x4d')];_0x156851+=0x1){socket[_0x3822('0x6c')](_0x3822('0x82'),{'UserId':Number(_0x122cd8[_0x3822('0x37')][_0x3822('0x62')][_0x156851]),'FaxQueueId':Number(_0x122cd8[_0x3822('0x4a')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x122cd8['query'][_0x3822('0x62')]),'FaxQueueId':Number(_0x122cd8[_0x3822('0x4a')]['id'])});}});}})[_0x3822('0x28')](respondWithStatusCode(_0x3628be,null))[_0x3822('0x48')](handleError(_0x3628be,null));};exports[_0x3822('0x86')]=function(_0x57684e,_0x59ada2,_0x3b4f7a){var _0x3473d9={};var _0x443b11={};var _0x419a20;var _0x5e8cb4;return db[_0x3822('0x31')][_0x3822('0x58')]({'where':{'id':_0x57684e[_0x3822('0x4a')]['id']}})[_0x3822('0x28')](handleEntityNotFound(_0x59ada2,null))[_0x3822('0x28')](function(_0x20e11f){if(_0x20e11f){_0x419a20=_0x20e11f;_0x443b11['model']=_['keys'](db[_0x3822('0x63')][_0x3822('0x32')]);_0x443b11[_0x3822('0x37')]=_['keys'](_0x57684e[_0x3822('0x37')]);_0x443b11[_0x3822('0x38')]=_[_0x3822('0x4c')](_0x443b11['model'],_0x443b11[_0x3822('0x37')]);_0x3473d9[_0x3822('0x39')]=_[_0x3822('0x4c')](_0x443b11['model'],qs[_0x3822('0x3a')](_0x57684e['query'][_0x3822('0x3a')]));_0x3473d9['attributes']=_0x3473d9['attributes']['length']?_0x3473d9[_0x3822('0x39')]:_0x443b11[_0x3822('0x35')];_0x3473d9[_0x3822('0x3d')]=qs[_0x3822('0x3e')](_0x57684e[_0x3822('0x37')][_0x3822('0x3e')]);_0x3473d9[_0x3822('0x3f')]=qs[_0x3822('0x38')](_[_0x3822('0x40')](_0x57684e[_0x3822('0x37')],_0x443b11['filters']));if(_0x57684e[_0x3822('0x37')]['filter']){_0x3473d9[_0x3822('0x3f')]=_['merge'](_0x3473d9[_0x3822('0x3f')],{'$or':_['map'](_0x3473d9[_0x3822('0x39')],function(_0x395c6d){var _0x4a1a0f={};_0x4a1a0f[_0x395c6d]={'$like':'%'+_0x57684e[_0x3822('0x37')][_0x3822('0x41')]+'%'};return _0x4a1a0f;})});}_0x3473d9=_[_0x3822('0x43')]({},_0x3473d9,_0x57684e['options']);return _0x419a20[_0x3822('0x86')](_0x3473d9);}})['then'](function(_0xd681d2){if(_0xd681d2){_0x5e8cb4=_0xd681d2[_0x3822('0x4d')];if(!_0x57684e[_0x3822('0x37')][_0x3822('0x3b')](_0x3822('0x3c'))){_0x3473d9['limit']=qs[_0x3822('0x20')](_0x57684e[_0x3822('0x37')][_0x3822('0x20')]);_0x3473d9['offset']=qs[_0x3822('0x1e')](_0x57684e[_0x3822('0x37')]['offset']);}return _0x419a20[_0x3822('0x86')](_0x3473d9);}})[_0x3822('0x28')](function(_0x238d57){if(_0x238d57){return _0x238d57?{'count':_0x5e8cb4,'rows':_0x238d57}:null;}})['then'](respondWithResult(_0x59ada2,null))['catch'](handleError(_0x59ada2,null));}; \ No newline at end of file +var _0x2e48=['interface','transaction','each','findOrCreate','forEach','removeTeams','Agents','field','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','includes','all','compact','removeAgents','userFaxQueue:remove','addAgents','omit','emit','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','./faxQueue.socket','register','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','FaxQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause'];(function(_0x117643,_0x2b3351){var _0x4f9ce1=function(_0x3500b8){while(--_0x3500b8){_0x117643['push'](_0x117643['shift']());}};_0x4f9ce1(++_0x2b3351);}(_0x2e48,0x1b8));var _0x82e4=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x2e48[_0x2bc3f4];return _0x14ac53;};'use strict';var emlformat=require(_0x82e4('0x0'));var rimraf=require(_0x82e4('0x1'));var zipdir=require(_0x82e4('0x2'));var jsonpatch=require(_0x82e4('0x3'));var rp=require(_0x82e4('0x4'));var moment=require(_0x82e4('0x5'));var BPromise=require(_0x82e4('0x6'));var Mustache=require(_0x82e4('0x7'));var util=require(_0x82e4('0x8'));var path=require(_0x82e4('0x9'));var sox=require(_0x82e4('0xa'));var csv=require(_0x82e4('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82e4('0xc'));var _=require('lodash');var squel=require(_0x82e4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x82e4('0xe'));var Papa=require(_0x82e4('0xf'));var Redis=require(_0x82e4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x82e4('0x11'));var hardwareService=require(_0x82e4('0x12'));var logger=require(_0x82e4('0x13'))('api');var utils=require(_0x82e4('0x14'));var config=require(_0x82e4('0x15'));var licenseUtil=require(_0x82e4('0x16'));var db=require(_0x82e4('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x82e4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82e4('0x19')]));require(_0x82e4('0x1a'))[_0x82e4('0x1b')](socket);function respondWithStatusCode(_0x57a24f,_0x59c78c){_0x59c78c=_0x59c78c||0xcc;return function(_0x4c4374){if(_0x4c4374){return _0x57a24f['sendStatus'](_0x59c78c);}return _0x57a24f['status'](_0x59c78c)['end']();};}function respondWithResult(_0x3517fd,_0x5834e1){_0x5834e1=_0x5834e1||0xc8;return function(_0x1b3fe0){if(_0x1b3fe0){return _0x3517fd['status'](_0x5834e1)[_0x82e4('0x1c')](_0x1b3fe0);}};}function respondWithFilteredResult(_0x491b92,_0x2bbdd3){return function(_0xac7384){if(_0xac7384){var _0x5a9e76=typeof _0x2bbdd3['offset']===_0x82e4('0x1d')&&typeof _0x2bbdd3['limit']==='undefined';var _0xb12444=_0xac7384[_0x82e4('0x1e')];var _0x1b5698=_0x5a9e76?0x0:_0x2bbdd3[_0x82e4('0x1f')];var _0x4eaf00=_0x5a9e76?_0xac7384[_0x82e4('0x1e')]:_0x2bbdd3['offset']+_0x2bbdd3[_0x82e4('0x20')];var _0x39ffe9;if(_0x4eaf00>=_0xb12444){_0x4eaf00=_0xb12444;_0x39ffe9=0xc8;}else{_0x39ffe9=0xce;}_0x491b92[_0x82e4('0x21')](_0x39ffe9);return _0x491b92[_0x82e4('0x22')](_0x82e4('0x23'),_0x1b5698+'-'+_0x4eaf00+'/'+_0xb12444)[_0x82e4('0x1c')](_0xac7384);}return null;};}function patchUpdates(_0x5dd49c){return function(_0x221ecc){try{jsonpatch['apply'](_0x221ecc,_0x5dd49c,!![]);}catch(_0x317eed){return BPromise[_0x82e4('0x24')](_0x317eed);}return _0x221ecc[_0x82e4('0x25')]();};}function saveUpdates(_0x126e04,_0x2d1215){return function(_0x3efca0){if(_0x3efca0){return _0x3efca0[_0x82e4('0x26')](_0x126e04)[_0x82e4('0x27')](function(_0x4f1adc){return _0x4f1adc;});}return null;};}function removeEntity(_0x1447d4,_0x5c03b9){return function(_0x1a0670){if(_0x1a0670){return _0x1a0670[_0x82e4('0x28')]()[_0x82e4('0x27')](function(){var _0x13c549=_0x1a0670[_0x82e4('0x29')]({'plain':!![]});var _0x3be636='FaxQueues';return db[_0x82e4('0x2a')][_0x82e4('0x28')]({'where':{'type':_0x3be636,'resourceId':_0x13c549['id']}})[_0x82e4('0x27')](function(){return _0x1a0670;});})[_0x82e4('0x27')](function(){_0x1447d4['status'](0xcc)[_0x82e4('0x2b')]();});}};}function handleEntityNotFound(_0x57d13b,_0x5b501f){return function(_0x238bea){if(!_0x238bea){_0x57d13b[_0x82e4('0x2c')](0x194);}return _0x238bea;};}function handleError(_0x246ec5,_0x8973cf){_0x8973cf=_0x8973cf||0x1f4;return function(_0x988a85){logger[_0x82e4('0x2d')](_0x988a85[_0x82e4('0x2e')]);if(_0x988a85[_0x82e4('0x2f')]){delete _0x988a85[_0x82e4('0x2f')];}_0x246ec5[_0x82e4('0x21')](_0x8973cf)[_0x82e4('0x30')](_0x988a85);};}exports[_0x82e4('0x31')]=function(_0x5f7b9f,_0x15275c){var _0x58ff9c={},_0x4f88bc={},_0x1dd2f5={'count':0x0,'rows':[]};var _0xf14d05=_['map'](db[_0x82e4('0x32')][_0x82e4('0x33')],function(_0x44f918){return{'name':_0x44f918[_0x82e4('0x34')],'type':_0x44f918[_0x82e4('0x35')][_0x82e4('0x36')]};});_0x4f88bc[_0x82e4('0x37')]=_[_0x82e4('0x38')](_0xf14d05,_0x82e4('0x2f'));_0x4f88bc['query']=_[_0x82e4('0x39')](_0x5f7b9f[_0x82e4('0x3a')]);_0x4f88bc[_0x82e4('0x3b')]=_[_0x82e4('0x3c')](_0x4f88bc[_0x82e4('0x37')],_0x4f88bc[_0x82e4('0x3a')]);_0x58ff9c[_0x82e4('0x3d')]=_['intersection'](_0x4f88bc[_0x82e4('0x37')],qs['fields'](_0x5f7b9f[_0x82e4('0x3a')][_0x82e4('0x3e')]));_0x58ff9c[_0x82e4('0x3d')]=_0x58ff9c['attributes'][_0x82e4('0x3f')]?_0x58ff9c[_0x82e4('0x3d')]:_0x4f88bc[_0x82e4('0x37')];if(!_0x5f7b9f[_0x82e4('0x3a')]['hasOwnProperty'](_0x82e4('0x40'))){_0x58ff9c[_0x82e4('0x20')]=qs['limit'](_0x5f7b9f['query'][_0x82e4('0x20')]);_0x58ff9c[_0x82e4('0x1f')]=qs[_0x82e4('0x1f')](_0x5f7b9f['query']['offset']);}_0x58ff9c[_0x82e4('0x41')]=qs[_0x82e4('0x42')](_0x5f7b9f['query'][_0x82e4('0x42')]);_0x58ff9c[_0x82e4('0x43')]=qs['filters'](_[_0x82e4('0x44')](_0x5f7b9f[_0x82e4('0x3a')],_0x4f88bc[_0x82e4('0x3b')]),_0xf14d05);if(_0x5f7b9f[_0x82e4('0x3a')][_0x82e4('0x45')]){_0x58ff9c[_0x82e4('0x43')]=_['merge'](_0x58ff9c[_0x82e4('0x43')],{'$or':_[_0x82e4('0x38')](_0xf14d05,function(_0x439343){if(_0x439343[_0x82e4('0x35')]!==_0x82e4('0x46')){var _0x5533b1={};_0x5533b1[_0x439343['name']]={'$like':'%'+_0x5f7b9f[_0x82e4('0x3a')][_0x82e4('0x45')]+'%'};return _0x5533b1;}})});}_0x58ff9c=_[_0x82e4('0x47')]({},_0x58ff9c,_0x5f7b9f[_0x82e4('0x48')]);var _0x4394ff={'where':_0x58ff9c[_0x82e4('0x43')]};return db[_0x82e4('0x32')]['count'](_0x4394ff)[_0x82e4('0x27')](function(_0x3d2b0a){_0x1dd2f5[_0x82e4('0x1e')]=_0x3d2b0a;if(_0x5f7b9f[_0x82e4('0x3a')][_0x82e4('0x49')]){_0x58ff9c[_0x82e4('0x4a')]=[{'all':!![]}];}return db['FaxQueue'][_0x82e4('0x4b')](_0x58ff9c);})[_0x82e4('0x27')](function(_0x2a2d82){_0x1dd2f5[_0x82e4('0x4c')]=_0x2a2d82;return _0x1dd2f5;})[_0x82e4('0x27')](respondWithFilteredResult(_0x15275c,_0x58ff9c))[_0x82e4('0x4d')](handleError(_0x15275c,null));};exports['show']=function(_0x466ede,_0x187e92){var _0x980c7a={'raw':!![],'where':{'id':_0x466ede[_0x82e4('0x4e')]['id']}},_0x5e4a47={};_0x5e4a47[_0x82e4('0x37')]=_[_0x82e4('0x39')](db['FaxQueue'][_0x82e4('0x33')]);_0x5e4a47[_0x82e4('0x3a')]=_['keys'](_0x466ede[_0x82e4('0x3a')]);_0x5e4a47[_0x82e4('0x3b')]=_[_0x82e4('0x3c')](_0x5e4a47['model'],_0x5e4a47[_0x82e4('0x3a')]);_0x980c7a[_0x82e4('0x3d')]=_[_0x82e4('0x3c')](_0x5e4a47[_0x82e4('0x37')],qs[_0x82e4('0x3e')](_0x466ede['query'][_0x82e4('0x3e')]));_0x980c7a[_0x82e4('0x3d')]=_0x980c7a['attributes'][_0x82e4('0x3f')]?_0x980c7a[_0x82e4('0x3d')]:_0x5e4a47[_0x82e4('0x37')];if(_0x466ede[_0x82e4('0x3a')][_0x82e4('0x49')]){_0x980c7a['include']=[{'all':!![]}];}_0x980c7a=_[_0x82e4('0x47')]({},_0x980c7a,_0x466ede[_0x82e4('0x48')]);return db[_0x82e4('0x32')][_0x82e4('0x4f')](_0x980c7a)['then'](handleEntityNotFound(_0x187e92,null))[_0x82e4('0x27')](respondWithResult(_0x187e92,null))['catch'](handleError(_0x187e92,null));};exports[_0x82e4('0x50')]=function(_0x4cc291,_0x47c0a3){return db[_0x82e4('0x32')][_0x82e4('0x50')](_0x4cc291[_0x82e4('0x51')],{})[_0x82e4('0x27')](function(_0x49e368){var _0x7ac51=_0x4cc291[_0x82e4('0x52')][_0x82e4('0x29')]({'plain':!![]});if(!_0x7ac51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7ac51[_0x82e4('0x53')]===_0x82e4('0x52')){var _0x2213a3=_0x49e368['get']({'plain':!![]});var _0x1061ad=_0x82e4('0x54');return db['UserProfileSection']['find']({'where':{'name':_0x1061ad,'userProfileId':_0x7ac51[_0x82e4('0x55')]},'raw':!![]})[_0x82e4('0x27')](function(_0x4aa7e7){if(_0x4aa7e7&&_0x4aa7e7['autoAssociation']===0x0){return db['UserProfileResource'][_0x82e4('0x50')]({'name':_0x2213a3[_0x82e4('0x2f')],'resourceId':_0x2213a3['id'],'type':_0x4aa7e7[_0x82e4('0x2f')],'sectionId':_0x4aa7e7['id']},{})[_0x82e4('0x27')](function(){return _0x49e368;});}else{return _0x49e368;}})['catch'](function(_0x2597e7){logger['error'](_0x82e4('0x56'),_0x2597e7);throw _0x2597e7;});}return _0x49e368;})[_0x82e4('0x27')](respondWithResult(_0x47c0a3,0xc9))[_0x82e4('0x4d')](handleError(_0x47c0a3,null));};exports[_0x82e4('0x26')]=function(_0x4b55cc,_0x5cea7a){if(_0x4b55cc['body']['id']){delete _0x4b55cc[_0x82e4('0x51')]['id'];}return db[_0x82e4('0x32')]['find']({'where':{'id':_0x4b55cc['params']['id']}})['then'](handleEntityNotFound(_0x5cea7a,null))[_0x82e4('0x27')](saveUpdates(_0x4b55cc[_0x82e4('0x51')],null))[_0x82e4('0x27')](respondWithResult(_0x5cea7a,null))[_0x82e4('0x4d')](handleError(_0x5cea7a,null));};exports['destroy']=function(_0x77d3f8,_0x19dc6b){return db[_0x82e4('0x32')][_0x82e4('0x4f')]({'where':{'id':_0x77d3f8[_0x82e4('0x4e')]['id']}})[_0x82e4('0x27')](handleEntityNotFound(_0x19dc6b,null))[_0x82e4('0x27')](removeEntity(_0x19dc6b,null))[_0x82e4('0x4d')](handleError(_0x19dc6b,null));};exports[_0x82e4('0x57')]=function(_0x1544fc,_0x2f2bf1){return db[_0x82e4('0x32')]['describe']()[_0x82e4('0x27')](respondWithResult(_0x2f2bf1,null))[_0x82e4('0x4d')](handleError(_0x2f2bf1,null));};exports[_0x82e4('0x58')]=function(_0x47a604,_0x2ba78c,_0xab559){var _0x5a711b={'raw':!![],'where':{}},_0x5fffe7={},_0x128701;return db[_0x82e4('0x32')][_0x82e4('0x59')]({'where':{'id':_0x47a604[_0x82e4('0x4e')]['id']}})[_0x82e4('0x27')](handleEntityNotFound(_0x2ba78c,null))[_0x82e4('0x27')](function(_0x419c2f){if(_0x419c2f){_0x128701=_0x419c2f[_0x82e4('0x29')]({'plain':!![]});_0x5fffe7[_0x82e4('0x37')]=_[_0x82e4('0x39')](db[_0x82e4('0x5a')][_0x82e4('0x33')]);_0x5fffe7[_0x82e4('0x3a')]=_[_0x82e4('0x39')](_0x47a604[_0x82e4('0x3a')]);_0x5fffe7[_0x82e4('0x3b')]=_[_0x82e4('0x3c')](_0x5fffe7[_0x82e4('0x37')],_0x5fffe7[_0x82e4('0x3a')]);_0x5a711b[_0x82e4('0x3d')]=_['intersection'](_0x5fffe7[_0x82e4('0x37')],qs[_0x82e4('0x3e')](_0x47a604[_0x82e4('0x3a')][_0x82e4('0x3e')]));_0x5a711b['attributes']=_0x5a711b[_0x82e4('0x3d')][_0x82e4('0x3f')]?_0x5a711b[_0x82e4('0x3d')]:_0x5fffe7[_0x82e4('0x37')];if(!_0x47a604['query'][_0x82e4('0x5b')](_0x82e4('0x40'))){_0x5a711b[_0x82e4('0x20')]=qs[_0x82e4('0x20')](_0x47a604[_0x82e4('0x3a')]['limit']);_0x5a711b[_0x82e4('0x1f')]=qs[_0x82e4('0x1f')](_0x47a604[_0x82e4('0x3a')][_0x82e4('0x1f')]);}_0x5a711b['order']=qs[_0x82e4('0x42')](_0x47a604['query'][_0x82e4('0x42')]);_0x5a711b[_0x82e4('0x43')]=qs['filters'](_[_0x82e4('0x44')](_0x47a604['query'],_0x5fffe7[_0x82e4('0x3b')]));_0x5a711b[_0x82e4('0x43')][_0x82e4('0x5c')]=_0x419c2f['id'];if(_0x47a604[_0x82e4('0x3a')][_0x82e4('0x45')]){_0x5a711b[_0x82e4('0x43')]=_[_0x82e4('0x47')](_0x5a711b['where'],{'$or':_[_0x82e4('0x38')](_0x5a711b[_0x82e4('0x3d')],function(_0x8d7181){var _0x303531={};_0x303531[_0x8d7181]={'$like':'%'+_0x47a604[_0x82e4('0x3a')][_0x82e4('0x45')]+'%'};return _0x303531;})});}_0x5a711b=_['merge']({},_0x5a711b,_0x47a604[_0x82e4('0x48')]);return db['UserFaxQueue'][_0x82e4('0x4b')](_0x5a711b);}})['then'](function(_0x3636ba){if(_0x3636ba){return db[_0x82e4('0x5d')][_0x82e4('0x5e')]({'where':{'id':_['map'](_0x3636ba,_0x82e4('0x5f')),'role':_0x82e4('0x60')},'attributes':['id','name',_0x82e4('0x61'),_0x82e4('0x62'),_0x82e4('0x63')]});}})[_0x82e4('0x27')](function(_0x538e96){if(_0x538e96){return{'count':_0x538e96[_0x82e4('0x1e')],'rows':_[_0x82e4('0x38')](_0x538e96[_0x82e4('0x4c')],function(_0x58b4d8){return{'membername':_0x58b4d8[_0x82e4('0x2f')],'UserId':_0x58b4d8['id'],'queue_name':_0x128701[_0x82e4('0x2f')],'FaxQueueId':_0x128701['id'],'interface':util['format'](_0x82e4('0x64'),_0x82e4('0x65'),_0x58b4d8[_0x82e4('0x2f')]),'penalty':0x0,'paused':_0x58b4d8[_0x82e4('0x61')],'createdAt':_0x58b4d8['createdAt'],'updatedAt':_0x58b4d8[_0x82e4('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x82e4('0x27')](respondWithFilteredResult(_0x2ba78c,_0x5a711b))[_0x82e4('0x4d')](handleError(_0x2ba78c,null));};exports[_0x82e4('0x66')]=function(_0x55af30,_0x407fcb,_0x1d3c09){var _0x1d5f87={};var _0x4a83f9={};var _0x3281d5;var _0x51f522;return db[_0x82e4('0x32')][_0x82e4('0x59')]({'where':{'id':_0x55af30[_0x82e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x407fcb,null))[_0x82e4('0x27')](function(_0x32d92f){if(_0x32d92f){_0x3281d5=_0x32d92f;_0x4a83f9[_0x82e4('0x37')]=_['keys'](db[_0x82e4('0x67')][_0x82e4('0x33')]);_0x4a83f9[_0x82e4('0x3a')]=_[_0x82e4('0x39')](_0x55af30[_0x82e4('0x3a')]);_0x4a83f9[_0x82e4('0x3b')]=_[_0x82e4('0x3c')](_0x4a83f9[_0x82e4('0x37')],_0x4a83f9[_0x82e4('0x3a')]);_0x1d5f87[_0x82e4('0x3d')]=_['intersection'](_0x4a83f9['model'],qs[_0x82e4('0x3e')](_0x55af30['query'][_0x82e4('0x3e')]));_0x1d5f87[_0x82e4('0x3d')]=_0x1d5f87[_0x82e4('0x3d')][_0x82e4('0x3f')]?_0x1d5f87[_0x82e4('0x3d')]:_0x4a83f9[_0x82e4('0x37')];_0x1d5f87[_0x82e4('0x41')]=qs[_0x82e4('0x42')](_0x55af30['query'][_0x82e4('0x42')]);_0x1d5f87['where']=qs[_0x82e4('0x3b')](_[_0x82e4('0x44')](_0x55af30[_0x82e4('0x3a')],_0x4a83f9[_0x82e4('0x3b')]));if(_0x55af30['query'][_0x82e4('0x45')]){_0x1d5f87[_0x82e4('0x43')]=_[_0x82e4('0x47')](_0x1d5f87[_0x82e4('0x43')],{'$or':_[_0x82e4('0x38')](_0x1d5f87[_0x82e4('0x3d')],function(_0x1ca898){var _0xc43bd2={};_0xc43bd2[_0x1ca898]={'$like':'%'+_0x55af30[_0x82e4('0x3a')]['filter']+'%'};return _0xc43bd2;})});}_0x1d5f87=_[_0x82e4('0x47')]({},_0x1d5f87,_0x55af30[_0x82e4('0x48')]);return _0x3281d5[_0x82e4('0x66')](_0x1d5f87);}})[_0x82e4('0x27')](function(_0x5cfc93){if(_0x5cfc93){_0x51f522=_0x5cfc93[_0x82e4('0x3f')];if(!_0x55af30['query'][_0x82e4('0x5b')]('nolimit')){_0x1d5f87[_0x82e4('0x20')]=qs[_0x82e4('0x20')](_0x55af30['query'][_0x82e4('0x20')]);_0x1d5f87[_0x82e4('0x1f')]=qs[_0x82e4('0x1f')](_0x55af30[_0x82e4('0x3a')][_0x82e4('0x1f')]);}return _0x3281d5['getTeams'](_0x1d5f87);}})[_0x82e4('0x27')](function(_0x18505e){if(_0x18505e){return _0x18505e?{'count':_0x51f522,'rows':_0x18505e}:null;}})['then'](respondWithResult(_0x407fcb,null))[_0x82e4('0x4d')](handleError(_0x407fcb,null));};exports[_0x82e4('0x68')]=function(_0x80d9f,_0x47875a,_0x15e902){var _0x138e93=_0x80d9f[_0x82e4('0x51')][_0x82e4('0x69')];return db[_0x82e4('0x67')][_0x82e4('0x4b')]({'where':{'id':_0x138e93},'attributes':['id'],'include':[{'model':db[_0x82e4('0x5d')],'as':'Agents','attributes':['id',_0x82e4('0x2f'),_0x82e4('0x6a'),_0x82e4('0x6b'),_0x82e4('0x6c')],'raw':!![]}]})[_0x82e4('0x27')](function(_0x372abe){if(_0x372abe){var _0x166e9e=_['flatMap'](_0x372abe,function(_0x117297){var _0x15f033=_0x117297[_0x82e4('0x29')]({'plain':!![]});return _0x15f033['Agents'];});return db[_0x82e4('0x32')]['find']({'where':{'id':_0x80d9f['params']['id']}})[_0x82e4('0x27')](function(_0x4f286a){return db['sequelize'][_0x82e4('0x6d')](function(_0x814df4){return _0x4f286a[_0x82e4('0x68')](_0x138e93,{'transaction':_0x814df4})[_0x82e4('0x27')](function(){return BPromise[_0x82e4('0x6e')](_0x166e9e,function(_0x4ead86){return db[_0x82e4('0x5a')][_0x82e4('0x6f')]({'where':{'UserId':_0x4ead86['id'],'FaxQueueId':_0x80d9f[_0x82e4('0x4e')]['id']},'transaction':_0x814df4});});})['then'](function(){_0x166e9e[_0x82e4('0x70')](function(_0x573260){socket['emit']('userFaxQueue:save',{'UserId':_0x573260['id'],'FaxQueueId':_0x4f286a['id']});});});});});}})['then'](respondWithStatusCode(_0x47875a,null))['catch'](handleError(_0x47875a,null));};exports[_0x82e4('0x71')]=function(_0x308db5,_0x188f7c,_0x135ea7){return db[_0x82e4('0x67')][_0x82e4('0x4b')]({'where':{'id':_0x308db5[_0x82e4('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x82e4('0x5d')],'as':_0x82e4('0x72'),'attributes':['id'],'raw':!![]}]})[_0x82e4('0x27')](handleEntityNotFound(_0x188f7c,null))['then'](function(_0x4fef94){var _0x1c690f=_['map'](_0x4fef94,'id');var _0x1f2d9b=[];var _0x3a7b33=[];var _0x564e38=squel['select']();_0x564e38[_0x82e4('0x73')]('tq.TeamId')[_0x82e4('0x74')](_0x82e4('0x75'),'tq')['join'](_0x82e4('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x82e4('0x77'),_0x308db5['params']['id']);for(var _0x4cc1ce=0x0;_0x4cc1ce<_0x4fef94['length'];_0x4cc1ce+=0x1){let _0x30f235=_0x4fef94[_0x4cc1ce];for(var _0x57111f=0x0;_0x57111f<_0x30f235[_0x82e4('0x72')][_0x82e4('0x3f')];_0x57111f+=0x1){let _0x2eab92=_0x30f235[_0x82e4('0x72')][_0x57111f];var _0x504f8e=_0x564e38[_0x82e4('0x78')]();_0x504f8e['where'](_0x82e4('0x79'),_0x2eab92['id']);_0x3a7b33[_0x82e4('0x7a')](db['sequelize']['query'](_0x504f8e[_0x82e4('0x7b')](),{'type':db[_0x82e4('0x7c')]['QueryTypes'][_0x82e4('0x7d')]})[_0x82e4('0x27')](function(_0x5c003d){if(_0x5c003d[_0x82e4('0x3f')]===0x1){return _0x2eab92['id'];}else{var _0x1ec046=_['every'](_[_0x82e4('0x38')](_0x5c003d,'TeamId'),function(_0x17ac2e){return _[_0x82e4('0x7e')](_0x1c690f,_0x17ac2e);});if(_0x1ec046){return _0x2eab92['id'];}}}));}}return BPromise[_0x82e4('0x7f')](_0x3a7b33)[_0x82e4('0x27')](function(_0x2a295f){_0x1f2d9b=_(_0x1f2d9b)['union'](_0x2a295f)[_0x82e4('0x80')]()['value']();return db[_0x82e4('0x32')][_0x82e4('0x4f')]({'where':{'id':_0x308db5[_0x82e4('0x4e')]['id']}})[_0x82e4('0x27')](function(_0x4fc4e2){return db[_0x82e4('0x7c')][_0x82e4('0x6d')](function(_0x5c43f9){return _0x4fc4e2[_0x82e4('0x71')](_0x308db5[_0x82e4('0x3a')]['ids'],{'transaction':_0x5c43f9})[_0x82e4('0x27')](function(){if(!_['isEmpty'](_0x1f2d9b)){return _0x4fc4e2[_0x82e4('0x81')](_0x1f2d9b,{'transaction':_0x5c43f9});}})[_0x82e4('0x27')](function(){_0x1f2d9b['forEach'](function(_0x5f2a11){socket['emit'](_0x82e4('0x82'),{'UserId':_0x5f2a11,'FaxQueueId':_0x4fc4e2['id']});});});});});});})[_0x82e4('0x27')](respondWithStatusCode(_0x188f7c,null))[_0x82e4('0x4d')](handleError(_0x188f7c,null));};exports[_0x82e4('0x83')]=function(_0x5a9338,_0x51b7fe,_0x1bcd63){return db[_0x82e4('0x32')][_0x82e4('0x4f')]({'where':{'id':_0x5a9338[_0x82e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x51b7fe,null))[_0x82e4('0x27')](function(_0x6cc325){if(_0x6cc325){return _0x6cc325[_0x82e4('0x83')](_0x5a9338[_0x82e4('0x51')][_0x82e4('0x69')],_[_0x82e4('0x84')](_0x5a9338['body'],[_0x82e4('0x69'),'id'])||{})['spread'](function(_0x3621d4){for(var _0x6be2d2=0x0;_0x6be2d2<_0x5a9338[_0x82e4('0x51')]['ids'][_0x82e4('0x3f')];_0x6be2d2+=0x1){socket[_0x82e4('0x85')](_0x82e4('0x86'),{'UserId':Number(_0x5a9338[_0x82e4('0x51')][_0x82e4('0x69')][_0x6be2d2]),'FaxQueueId':Number(_0x5a9338[_0x82e4('0x4e')]['id'])});}return _0x3621d4;});}})['then'](respondWithResult(_0x51b7fe,null))[_0x82e4('0x4d')](handleError(_0x51b7fe,null));};exports[_0x82e4('0x81')]=function(_0x24db19,_0x5ac6f9,_0x14561b){return db[_0x82e4('0x32')][_0x82e4('0x4f')]({'where':{'id':_0x24db19[_0x82e4('0x4e')]['id']}})[_0x82e4('0x27')](handleEntityNotFound(_0x5ac6f9,null))[_0x82e4('0x27')](function(_0x419d9d){if(_0x419d9d){return _0x419d9d[_0x82e4('0x81')](_0x24db19[_0x82e4('0x3a')][_0x82e4('0x69')])[_0x82e4('0x27')](function(){if(_[_0x82e4('0x87')](_0x24db19[_0x82e4('0x3a')]['ids'])){for(var _0x1d39c2=0x0;_0x1d39c2<_0x24db19['query'][_0x82e4('0x69')][_0x82e4('0x3f')];_0x1d39c2+=0x1){socket[_0x82e4('0x85')](_0x82e4('0x82'),{'UserId':Number(_0x24db19[_0x82e4('0x3a')]['ids'][_0x1d39c2]),'FaxQueueId':Number(_0x24db19[_0x82e4('0x4e')]['id'])});}}else{socket['emit'](_0x82e4('0x82'),{'UserId':Number(_0x24db19['query']['ids']),'FaxQueueId':Number(_0x24db19[_0x82e4('0x4e')]['id'])});}});}})[_0x82e4('0x27')](respondWithStatusCode(_0x5ac6f9,null))['catch'](handleError(_0x5ac6f9,null));};exports[_0x82e4('0x88')]=function(_0x3a527e,_0x529b21,_0x18e383){var _0x586049={};var _0x51ed15={};var _0x41231d;var _0x386f00;return db[_0x82e4('0x32')][_0x82e4('0x59')]({'where':{'id':_0x3a527e[_0x82e4('0x4e')]['id']}})[_0x82e4('0x27')](handleEntityNotFound(_0x529b21,null))[_0x82e4('0x27')](function(_0x4e2913){if(_0x4e2913){_0x41231d=_0x4e2913;_0x51ed15[_0x82e4('0x37')]=_['keys'](db[_0x82e4('0x5d')][_0x82e4('0x33')]);_0x51ed15[_0x82e4('0x3a')]=_[_0x82e4('0x39')](_0x3a527e[_0x82e4('0x3a')]);_0x51ed15[_0x82e4('0x3b')]=_[_0x82e4('0x3c')](_0x51ed15['model'],_0x51ed15[_0x82e4('0x3a')]);_0x586049['attributes']=_[_0x82e4('0x3c')](_0x51ed15[_0x82e4('0x37')],qs['fields'](_0x3a527e['query'][_0x82e4('0x3e')]));_0x586049['attributes']=_0x586049[_0x82e4('0x3d')][_0x82e4('0x3f')]?_0x586049[_0x82e4('0x3d')]:_0x51ed15[_0x82e4('0x37')];_0x586049[_0x82e4('0x41')]=qs[_0x82e4('0x42')](_0x3a527e[_0x82e4('0x3a')][_0x82e4('0x42')]);_0x586049[_0x82e4('0x43')]=qs['filters'](_[_0x82e4('0x44')](_0x3a527e['query'],_0x51ed15[_0x82e4('0x3b')]));if(_0x3a527e[_0x82e4('0x3a')][_0x82e4('0x45')]){_0x586049[_0x82e4('0x43')]=_[_0x82e4('0x47')](_0x586049[_0x82e4('0x43')],{'$or':_[_0x82e4('0x38')](_0x586049[_0x82e4('0x3d')],function(_0xffbd79){var _0xbad486={};_0xbad486[_0xffbd79]={'$like':'%'+_0x3a527e[_0x82e4('0x3a')][_0x82e4('0x45')]+'%'};return _0xbad486;})});}_0x586049=_['merge']({},_0x586049,_0x3a527e[_0x82e4('0x48')]);return _0x41231d['getAgents'](_0x586049);}})[_0x82e4('0x27')](function(_0x433cdf){if(_0x433cdf){_0x386f00=_0x433cdf[_0x82e4('0x3f')];if(!_0x3a527e[_0x82e4('0x3a')][_0x82e4('0x5b')](_0x82e4('0x40'))){_0x586049['limit']=qs[_0x82e4('0x20')](_0x3a527e[_0x82e4('0x3a')][_0x82e4('0x20')]);_0x586049['offset']=qs['offset'](_0x3a527e['query'][_0x82e4('0x1f')]);}return _0x41231d['getAgents'](_0x586049);}})[_0x82e4('0x27')](function(_0x488670){if(_0x488670){return _0x488670?{'count':_0x386f00,'rows':_0x488670}:null;}})[_0x82e4('0x27')](respondWithResult(_0x529b21,null))['catch'](handleError(_0x529b21,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a4eb74f..7e76a8b 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 _0x15b6=['hook','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x235f95,_0x2bf647){var _0x2348cb=function(_0x4b10d8){while(--_0x4b10d8){_0x235f95['push'](_0x235f95['shift']());}};_0x2348cb(++_0x2bf647);}(_0x15b6,0x91));var _0x615b=function(_0x2e9a53,_0x54d309){_0x2e9a53=_0x2e9a53-0x0;var _0x49201c=_0x15b6[_0x2e9a53];return _0x49201c;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x615b('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x615b('0x1')](0x0);var events={'afterCreate':_0x615b('0x2'),'afterUpdate':_0x615b('0x3'),'afterDestroy':_0x615b('0x4')};function emitEvent(_0x935c95){return function(_0x4f8e97,_0x339f58,_0x5cbf9b){FaxQueueEvents['emit'](_0x935c95+':'+_0x4f8e97['id'],_0x4f8e97);FaxQueueEvents[_0x615b('0x5')](_0x935c95,_0x4f8e97);_0x5cbf9b(null);};}for(var e in events){if(events[_0x615b('0x6')](e)){var event=events[e];FaxQueue[_0x615b('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x329d=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x370ccf,_0x9546b2){var _0x2fa783=function(_0x6ad7ac){while(--_0x6ad7ac){_0x370ccf['push'](_0x370ccf['shift']());}};_0x2fa783(++_0x9546b2);}(_0x329d,0x16a));var _0xd329=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0x329d[_0x452968];return _0xb6f9ae;};'use strict';var EventEmitter=require(_0xd329('0x0'));var FaxQueue=require(_0xd329('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xd329('0x2')](0x0);var events={'afterCreate':_0xd329('0x3'),'afterUpdate':_0xd329('0x4'),'afterDestroy':_0xd329('0x5')};function emitEvent(_0x4eddd9){return function(_0x5681cb,_0x31e164,_0x4b8dee){FaxQueueEvents[_0xd329('0x6')](_0x4eddd9+':'+_0x5681cb['id'],_0x5681cb);FaxQueueEvents[_0xd329('0x6')](_0x4eddd9,_0x5681cb);_0x4b8dee(null);};}for(var e in events){if(events[_0xd329('0x7')](e)){var event=events[e];FaxQueue[_0xd329('0x8')](e,emitEvent(event));}}module[_0xd329('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 068ceb9..3754743 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 _0x939c=['define','FaxQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0x939c,0x195));var _0xc939=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x939c[_0x5db657];return _0x2d6e70;};'use strict';var _=require(_0xc939('0x0'));var util=require(_0xc939('0x1'));var logger=require(_0xc939('0x2'))('api');var moment=require(_0xc939('0x3'));var BPromise=require(_0xc939('0x4'));var rp=require(_0xc939('0x5'));var fs=require('fs');var path=require(_0xc939('0x6'));var rimraf=require(_0xc939('0x7'));var config=require(_0xc939('0x8'));var attributes=require(_0xc939('0x9'));module[_0xc939('0xa')]=function(_0x3e5e17,_0x2232c5){return _0x3e5e17[_0xc939('0xb')](_0xc939('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x056d=['FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define'];(function(_0x4eb8f5,_0x37a761){var _0xa43cb8=function(_0x20a2d8){while(--_0x20a2d8){_0x4eb8f5['push'](_0x4eb8f5['shift']());}};_0xa43cb8(++_0x37a761);}(_0x056d,0x152));var _0xd056=function(_0x363dda,_0x396c9f){_0x363dda=_0x363dda-0x0;var _0x55e4d4=_0x056d[_0x363dda];return _0x55e4d4;};'use strict';var _=require(_0xd056('0x0'));var util=require(_0xd056('0x1'));var logger=require(_0xd056('0x2'))(_0xd056('0x3'));var moment=require(_0xd056('0x4'));var BPromise=require(_0xd056('0x5'));var rp=require(_0xd056('0x6'));var fs=require('fs');var path=require(_0xd056('0x7'));var rimraf=require(_0xd056('0x8'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module['exports']=function(_0x1ca980,_0x2c07fc){return _0x1ca980[_0xd056('0x9')](_0xd056('0xa'),attributes,{'tableName':_0xd056('0xb'),'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 ffebc4f..7ab07e0 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 _0x01a3=['where','attributes','limit','map','include','model','info','ShowFaxQueue','find','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFaxQueue','findAll','options','raw'];(function(_0x173e6e,_0x543052){var _0x33d2a7=function(_0x13b0c2){while(--_0x13b0c2){_0x173e6e['push'](_0x173e6e['shift']());}};_0x33d2a7(++_0x543052);}(_0x01a3,0x1eb));var _0x301a=function(_0x26958c,_0x4a0a04){_0x26958c=_0x26958c-0x0;var _0x27bdaa=_0x01a3[_0x26958c];return _0x27bdaa;};'use strict';var _=require(_0x301a('0x0'));var util=require(_0x301a('0x1'));var moment=require('moment');var BPromise=require(_0x301a('0x2'));var rs=require(_0x301a('0x3'));var fs=require('fs');var Redis=require(_0x301a('0x4'));var db=require(_0x301a('0x5'))['db'];var utils=require(_0x301a('0x6'));var logger=require(_0x301a('0x7'))('rpc');var config=require(_0x301a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x301a('0x9')]({'port':0x232a});config[_0x301a('0xa')]=_[_0x301a('0xb')](config[_0x301a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x301a('0xc'))(new Redis(config[_0x301a('0xa')]));require('./faxQueue.socket')[_0x301a('0xd')](socket);function respondWithRpcPromise(_0x22f815,_0x1481c8,_0x525b55){return new BPromise(function(_0x5dc96f,_0x3299e1){return client[_0x301a('0xe')](_0x22f815,_0x525b55)['then'](function(_0x2025dd){logger['info'](_0x301a('0xf'),_0x1481c8,_0x301a('0x10'));logger[_0x301a('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1481c8,'request\x20sent',JSON[_0x301a('0x12')](_0x2025dd));if(_0x2025dd[_0x301a('0x13')]){if(_0x2025dd[_0x301a('0x13')]['code']===0x1f4){logger[_0x301a('0x13')](_0x301a('0xf'),_0x1481c8,_0x2025dd[_0x301a('0x13')][_0x301a('0x14')]);return _0x3299e1(_0x2025dd[_0x301a('0x13')]['message']);}logger[_0x301a('0x13')](_0x301a('0xf'),_0x1481c8,_0x2025dd[_0x301a('0x13')][_0x301a('0x14')]);return _0x5dc96f(_0x2025dd[_0x301a('0x13')][_0x301a('0x14')]);}else{logger['info'](_0x301a('0xf'),_0x1481c8,_0x301a('0x10'));_0x5dc96f(_0x2025dd[_0x301a('0x15')][_0x301a('0x14')]);}})[_0x301a('0x16')](function(_0x4d7fd9){logger[_0x301a('0x13')](_0x301a('0xf'),_0x1481c8,_0x4d7fd9);_0x3299e1(_0x4d7fd9);});});}exports[_0x301a('0x17')]=function(_0x2b56ba){var _0x2d6fe0=this;return new Promise(function(_0x10fdc1,_0x306938){return db['FaxQueue'][_0x301a('0x18')]({'raw':_0x2b56ba[_0x301a('0x19')]?_0x2b56ba[_0x301a('0x19')][_0x301a('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b56ba[_0x301a('0x19')]?_0x2b56ba[_0x301a('0x19')][_0x301a('0x1b')]||null:null,'attributes':_0x2b56ba[_0x301a('0x19')]?_0x2b56ba['options'][_0x301a('0x1c')]||null:null,'limit':_0x2b56ba['options']?_0x2b56ba[_0x301a('0x19')][_0x301a('0x1d')]||null:null,'include':_0x2b56ba[_0x301a('0x19')]?_0x2b56ba[_0x301a('0x19')]['include']?_[_0x301a('0x1e')](_0x2b56ba[_0x301a('0x19')][_0x301a('0x1f')],function(_0x3da2db){return{'model':db[_0x3da2db[_0x301a('0x20')]],'as':_0x3da2db['as'],'attributes':_0x3da2db['attributes'],'include':_0x3da2db[_0x301a('0x1f')]?_['map'](_0x3da2db['include'],function(_0x557fdb){return{'model':db[_0x557fdb[_0x301a('0x20')]],'as':_0x557fdb['as'],'attributes':_0x557fdb[_0x301a('0x1c')],'include':_0x557fdb['include']?_[_0x301a('0x1e')](_0x557fdb['include'],function(_0x3b26d7){return{'model':db[_0x3b26d7['model']],'as':_0x3b26d7['as'],'attributes':_0x3b26d7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a403f){logger[_0x301a('0x21')](_0x301a('0x17'),_0x2b56ba);logger[_0x301a('0x11')](_0x301a('0x17'),_0x2b56ba,JSON[_0x301a('0x12')](_0x5a403f));_0x10fdc1(_0x5a403f);})[_0x301a('0x16')](function(_0x4e050d){logger[_0x301a('0x13')]('GetFaxQueue',_0x4e050d[_0x301a('0x14')],_0x2b56ba);_0x306938(_0x2d6fe0[_0x301a('0x13')](0x1f4,_0x4e050d[_0x301a('0x14')]));});});};exports[_0x301a('0x22')]=function(_0x5dc21c){var _0x53280c=this;return new Promise(function(_0x4547df,_0x11deaa){return db['FaxQueue'][_0x301a('0x23')]({'raw':_0x5dc21c['options']?_0x5dc21c['options'][_0x301a('0x1a')]===undefined?!![]:![]:!![],'where':_0x5dc21c[_0x301a('0x19')]?_0x5dc21c['options'][_0x301a('0x1b')]||null:null,'attributes':_0x5dc21c[_0x301a('0x19')]?_0x5dc21c[_0x301a('0x19')][_0x301a('0x1c')]||null:null,'include':_0x5dc21c['options']?_0x5dc21c[_0x301a('0x19')][_0x301a('0x1f')]?_[_0x301a('0x1e')](_0x5dc21c[_0x301a('0x19')][_0x301a('0x1f')],function(_0x3308fc){return{'model':db[_0x3308fc['model']],'as':_0x3308fc['as'],'attributes':_0x3308fc[_0x301a('0x1c')],'include':_0x3308fc[_0x301a('0x1f')]?_[_0x301a('0x1e')](_0x3308fc[_0x301a('0x1f')],function(_0x4a554a){return{'model':db[_0x4a554a['model']],'as':_0x4a554a['as'],'attributes':_0x4a554a[_0x301a('0x1c')],'include':_0x4a554a['include']?_[_0x301a('0x1e')](_0x4a554a[_0x301a('0x1f')],function(_0xff15bb){return{'model':db[_0xff15bb[_0x301a('0x20')]],'as':_0xff15bb['as'],'attributes':_0xff15bb[_0x301a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x301a('0x24')](function(_0x1c86a8){logger[_0x301a('0x21')](_0x301a('0x22'),_0x5dc21c);logger[_0x301a('0x11')]('ShowFaxQueue',_0x5dc21c,JSON[_0x301a('0x12')](_0x1c86a8));_0x4547df(_0x1c86a8);})[_0x301a('0x16')](function(_0x259a25){logger['error'](_0x301a('0x22'),_0x259a25['message'],_0x5dc21c);_0x11deaa(_0x53280c[_0x301a('0x13')](0x1f4,_0x259a25['message']));});});}; \ No newline at end of file +var _0x5cdb=['error','code','FaxQueue,\x20%s,\x20%s','message','result','FaxQueue','findAll','options','raw','limit','map','include','model','attributes','GetFaxQueue','ShowFaxQueue','find','where','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./faxQueue.socket','register','then','info','debug','request\x20sent','stringify'];(function(_0x49081f,_0x4a9fd5){var _0x502642=function(_0x2993e4){while(--_0x2993e4){_0x49081f['push'](_0x49081f['shift']());}};_0x502642(++_0x4a9fd5);}(_0x5cdb,0x17b));var _0xb5cd=function(_0x299379,_0x21761b){_0x299379=_0x299379-0x0;var _0x5f3aea=_0x5cdb[_0x299379];return _0x5f3aea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb5cd('0x0'));var BPromise=require('bluebird');var rs=require(_0xb5cd('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5cd('0x2'))['db'];var utils=require(_0xb5cd('0x3'));var logger=require(_0xb5cd('0x4'))('rpc');var config=require(_0xb5cd('0x5'));var jayson=require(_0xb5cd('0x6'));var client=jayson['client'][_0xb5cd('0x7')]({'port':0x232a});config[_0xb5cd('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb5cd('0x9'))(new Redis(config[_0xb5cd('0x8')]));require(_0xb5cd('0xa'))[_0xb5cd('0xb')](socket);function respondWithRpcPromise(_0x2d4516,_0x41e41c,_0x14c52b){return new BPromise(function(_0x20ed03,_0xc6592c){return client['request'](_0x2d4516,_0x14c52b)[_0xb5cd('0xc')](function(_0xe6348d){logger[_0xb5cd('0xd')]('FaxQueue,\x20%s,\x20%s',_0x41e41c,'request\x20sent');logger[_0xb5cd('0xe')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x41e41c,_0xb5cd('0xf'),JSON[_0xb5cd('0x10')](_0xe6348d));if(_0xe6348d[_0xb5cd('0x11')]){if(_0xe6348d[_0xb5cd('0x11')][_0xb5cd('0x12')]===0x1f4){logger[_0xb5cd('0x11')](_0xb5cd('0x13'),_0x41e41c,_0xe6348d[_0xb5cd('0x11')][_0xb5cd('0x14')]);return _0xc6592c(_0xe6348d[_0xb5cd('0x11')][_0xb5cd('0x14')]);}logger[_0xb5cd('0x11')]('FaxQueue,\x20%s,\x20%s',_0x41e41c,_0xe6348d['error'][_0xb5cd('0x14')]);return _0x20ed03(_0xe6348d[_0xb5cd('0x11')][_0xb5cd('0x14')]);}else{logger[_0xb5cd('0xd')](_0xb5cd('0x13'),_0x41e41c,'request\x20sent');_0x20ed03(_0xe6348d[_0xb5cd('0x15')]['message']);}})['catch'](function(_0x2ce6ab){logger[_0xb5cd('0x11')](_0xb5cd('0x13'),_0x41e41c,_0x2ce6ab);_0xc6592c(_0x2ce6ab);});});}exports['GetFaxQueue']=function(_0x1445dc){var _0x37bc6e=this;return new Promise(function(_0x34147b,_0x1077b5){return db[_0xb5cd('0x16')][_0xb5cd('0x17')]({'raw':_0x1445dc[_0xb5cd('0x18')]?_0x1445dc[_0xb5cd('0x18')][_0xb5cd('0x19')]===undefined?!![]:![]:!![],'where':_0x1445dc[_0xb5cd('0x18')]?_0x1445dc['options']['where']||null:null,'attributes':_0x1445dc[_0xb5cd('0x18')]?_0x1445dc[_0xb5cd('0x18')]['attributes']||null:null,'limit':_0x1445dc[_0xb5cd('0x18')]?_0x1445dc[_0xb5cd('0x18')][_0xb5cd('0x1a')]||null:null,'include':_0x1445dc['options']?_0x1445dc[_0xb5cd('0x18')]['include']?_[_0xb5cd('0x1b')](_0x1445dc['options'][_0xb5cd('0x1c')],function(_0x345b1f){return{'model':db[_0x345b1f[_0xb5cd('0x1d')]],'as':_0x345b1f['as'],'attributes':_0x345b1f[_0xb5cd('0x1e')],'include':_0x345b1f[_0xb5cd('0x1c')]?_['map'](_0x345b1f['include'],function(_0x596ee9){return{'model':db[_0x596ee9[_0xb5cd('0x1d')]],'as':_0x596ee9['as'],'attributes':_0x596ee9[_0xb5cd('0x1e')],'include':_0x596ee9[_0xb5cd('0x1c')]?_[_0xb5cd('0x1b')](_0x596ee9[_0xb5cd('0x1c')],function(_0x10ee67){return{'model':db[_0x10ee67[_0xb5cd('0x1d')]],'as':_0x10ee67['as'],'attributes':_0x10ee67[_0xb5cd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5cd('0xc')](function(_0x3a0c1e){logger['info'](_0xb5cd('0x1f'),_0x1445dc);logger[_0xb5cd('0xe')](_0xb5cd('0x1f'),_0x1445dc,JSON[_0xb5cd('0x10')](_0x3a0c1e));_0x34147b(_0x3a0c1e);})['catch'](function(_0x2a24be){logger[_0xb5cd('0x11')](_0xb5cd('0x1f'),_0x2a24be[_0xb5cd('0x14')],_0x1445dc);_0x1077b5(_0x37bc6e[_0xb5cd('0x11')](0x1f4,_0x2a24be['message']));});});};exports[_0xb5cd('0x20')]=function(_0x18bdeb){var _0x25e112=this;return new Promise(function(_0x599bc5,_0x21f853){return db[_0xb5cd('0x16')][_0xb5cd('0x21')]({'raw':_0x18bdeb[_0xb5cd('0x18')]?_0x18bdeb[_0xb5cd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x18bdeb[_0xb5cd('0x18')]?_0x18bdeb[_0xb5cd('0x18')][_0xb5cd('0x22')]||null:null,'attributes':_0x18bdeb['options']?_0x18bdeb[_0xb5cd('0x18')]['attributes']||null:null,'include':_0x18bdeb[_0xb5cd('0x18')]?_0x18bdeb[_0xb5cd('0x18')][_0xb5cd('0x1c')]?_[_0xb5cd('0x1b')](_0x18bdeb['options'][_0xb5cd('0x1c')],function(_0x5f0882){return{'model':db[_0x5f0882[_0xb5cd('0x1d')]],'as':_0x5f0882['as'],'attributes':_0x5f0882[_0xb5cd('0x1e')],'include':_0x5f0882[_0xb5cd('0x1c')]?_['map'](_0x5f0882['include'],function(_0x12d99b){return{'model':db[_0x12d99b[_0xb5cd('0x1d')]],'as':_0x12d99b['as'],'attributes':_0x12d99b[_0xb5cd('0x1e')],'include':_0x12d99b['include']?_[_0xb5cd('0x1b')](_0x12d99b[_0xb5cd('0x1c')],function(_0x1ab3d7){return{'model':db[_0x1ab3d7[_0xb5cd('0x1d')]],'as':_0x1ab3d7['as'],'attributes':_0x1ab3d7[_0xb5cd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12790e){logger[_0xb5cd('0xd')](_0xb5cd('0x20'),_0x18bdeb);logger[_0xb5cd('0xe')]('ShowFaxQueue',_0x18bdeb,JSON[_0xb5cd('0x10')](_0x12790e));_0x599bc5(_0x12790e);})[_0xb5cd('0x23')](function(_0xe9ba7b){logger[_0xb5cd('0x11')](_0xb5cd('0x20'),_0xe9ba7b[_0xb5cd('0x14')],_0x18bdeb);_0x21f853(_0x25e112[_0xb5cd('0x11')](0x1f4,_0xe9ba7b[_0xb5cd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ef4ee54..97e1f73 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 _0x49c2=['register','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x2c388f,_0x4a1220){var _0x596a6b=function(_0x55f1d8){while(--_0x55f1d8){_0x2c388f['push'](_0x2c388f['shift']());}};_0x596a6b(++_0x4a1220);}(_0x49c2,0x176));var _0x249c=function(_0x1ea691,_0x370196){_0x1ea691=_0x1ea691-0x0;var _0x5d479f=_0x49c2[_0x1ea691];return _0x5d479f;};'use strict';var FaxQueueEvents=require(_0x249c('0x0'));var events=[_0x249c('0x1'),_0x249c('0x2'),_0x249c('0x3')];function createListener(_0x4945d8,_0x1a7d9b){return function(_0x4a9cb){_0x1a7d9b['emit'](_0x4945d8,_0x4a9cb);};}function removeListener(_0x28d220,_0x303fcc){return function(){FaxQueueEvents['removeListener'](_0x28d220,_0x303fcc);};}exports[_0x249c('0x4')]=function(_0x4c0c15){for(var _0x5c5f30=0x0,_0x559ced=events['length'];_0x5c5f30<_0x559ced;_0x5c5f30++){var _0xbe365c=events[_0x5c5f30];var _0x2d2d00=createListener(_0x249c('0x5')+_0xbe365c,_0x4c0c15);FaxQueueEvents['on'](_0xbe365c,_0x2d2d00);}}; \ No newline at end of file +var _0xde8a=['register','length','./faxQueue.events','save','remove','update','removeListener'];(function(_0x2d06c0,_0x22fe53){var _0x5e3d64=function(_0x523d41){while(--_0x523d41){_0x2d06c0['push'](_0x2d06c0['shift']());}};_0x5e3d64(++_0x22fe53);}(_0xde8a,0x9c));var _0xade8=function(_0x20194e,_0x664d0a){_0x20194e=_0x20194e-0x0;var _0x1c78ec=_0xde8a[_0x20194e];return _0x1c78ec;};'use strict';var FaxQueueEvents=require(_0xade8('0x0'));var events=[_0xade8('0x1'),_0xade8('0x2'),_0xade8('0x3')];function createListener(_0x6b294e,_0x229f97){return function(_0x592d21){_0x229f97['emit'](_0x6b294e,_0x592d21);};}function removeListener(_0x2c6fb6,_0x2e73f6){return function(){FaxQueueEvents[_0xade8('0x4')](_0x2c6fb6,_0x2e73f6);};}exports[_0xade8('0x5')]=function(_0x52c7d8){for(var _0xc50f0f=0x0,_0x559d3e=events[_0xade8('0x6')];_0xc50f0f<_0x559d3e;_0xc50f0f++){var _0x321ff3=events[_0xc50f0f];var _0x5c1078=createListener('faxQueue:'+_0x321ff3,_0x52c7d8);FaxQueueEvents['on'](_0x321ff3,_0x5c1078);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 931ba0b..a57ab0c 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 _0x430c=['post','create','/:id/teams','/:id/users','addAgents','put','destroy','delete','removeAgents','multer','connect-timeout','express','Router','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getAgents'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0x430c,0x1a1));var _0xc430=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x430c[_0x58381c];return _0x1a7440;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();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(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/teams',auth[_0xc430('0x8')](),controller['getTeams']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0xf')]('/',auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0xf')](_0xc430('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xc430('0xf')](_0xc430('0x12'),auth[_0xc430('0x8')](),controller[_0xc430('0x13')]);router[_0xc430('0x14')]('/:id',auth[_0xc430('0x8')](),controller['update']);router['delete'](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router['delete']('/:id/teams',auth[_0xc430('0x8')](),controller['removeTeams']);router[_0xc430('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xc430('0x17')]);module['exports']=router; \ No newline at end of file +var _0xcde7=['../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','path','connect-timeout','express'];(function(_0x49b06d,_0x5204de){var _0x21d068=function(_0x47c3b4){while(--_0x47c3b4){_0x49b06d['push'](_0x49b06d['shift']());}};_0x21d068(++_0x5204de);}(_0xcde7,0x65));var _0x7cde=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcde7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7cde('0x0'));var timeout=require(_0x7cde('0x1'));var express=require(_0x7cde('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7cde('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7cde('0x4'));var controller=require(_0x7cde('0x5'));router[_0x7cde('0x6')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0x8')]);router[_0x7cde('0x6')]('/describe',auth[_0x7cde('0x7')](),controller['describe']);router[_0x7cde('0x6')](_0x7cde('0x9'),auth[_0x7cde('0x7')](),controller[_0x7cde('0xa')]);router['get'](_0x7cde('0xb'),auth[_0x7cde('0x7')](),controller[_0x7cde('0xc')]);router[_0x7cde('0x6')](_0x7cde('0xd'),auth[_0x7cde('0x7')](),controller[_0x7cde('0xe')]);router[_0x7cde('0x6')](_0x7cde('0xf'),auth[_0x7cde('0x7')](),controller['getAgents']);router[_0x7cde('0x10')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0x11')]);router[_0x7cde('0x10')](_0x7cde('0xd'),auth[_0x7cde('0x7')](),controller[_0x7cde('0x12')]);router[_0x7cde('0x10')](_0x7cde('0xf'),auth['isAuthenticated'](),controller[_0x7cde('0x13')]);router[_0x7cde('0x14')](_0x7cde('0x9'),auth[_0x7cde('0x7')](),controller[_0x7cde('0x15')]);router[_0x7cde('0x16')](_0x7cde('0x9'),auth[_0x7cde('0x7')](),controller[_0x7cde('0x17')]);router[_0x7cde('0x16')](_0x7cde('0xd'),auth[_0x7cde('0x7')](),controller[_0x7cde('0x18')]);router['delete'](_0x7cde('0xf'),auth[_0x7cde('0x7')](),controller[_0x7cde('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index d61c0c0..2328d84 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 _0x16c9=['STRING','DATE','moment','exports'];(function(_0x2cdcf9,_0x8a09d1){var _0x39412d=function(_0x7b476e){while(--_0x7b476e){_0x2cdcf9['push'](_0x2cdcf9['shift']());}};_0x39412d(++_0x8a09d1);}(_0x16c9,0x6a));var _0x916c=function(_0x5a8a97,_0x3458a4){_0x5a8a97=_0x5a8a97-0x0;var _0x49d07f=_0x16c9[_0x5a8a97];return _0x49d07f;};'use strict';var moment=require(_0x916c('0x0'));var Sequelize=require('sequelize');module[_0x916c('0x1')]={'uniqueid':{'type':Sequelize[_0x916c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x916c('0x3')]},'leaveAt':{'type':Sequelize[_0x916c('0x3')]},'acceptAt':{'type':Sequelize[_0x916c('0x3')]},'exitAt':{'type':Sequelize[_0x916c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x86ec=['exports','DATE','STRING','moment','sequelize'];(function(_0x2422d8,_0x2419c1){var _0x50090b=function(_0x3e76b2){while(--_0x3e76b2){_0x2422d8['push'](_0x2422d8['shift']());}};_0x50090b(++_0x2419c1);}(_0x86ec,0xe9));var _0xc86e=function(_0x278b54,_0x48bc04){_0x278b54=_0x278b54-0x0;var _0x17e2ef=_0x86ec[_0x278b54];return _0x17e2ef;};'use strict';var moment=require(_0xc86e('0x0'));var Sequelize=require(_0xc86e('0x1'));module[_0xc86e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc86e('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc86e('0x3')]},'exitAt':{'type':Sequelize[_0xc86e('0x3')]},'reason':{'type':Sequelize[_0xc86e('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index d390278..877bed9 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 _0x8e0d=['../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','json','offset','undefined','count','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x29bcd1,_0x321aab){var _0xe7f9cb=function(_0x250661){while(--_0x250661){_0x29bcd1['push'](_0x29bcd1['shift']());}};_0xe7f9cb(++_0x321aab);}(_0x8e0d,0x82));var _0xd8e0=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x8e0d[_0x3c8e9a];return _0x2d4c57;};'use strict';var emlformat=require(_0xd8e0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd8e0('0x1'));var rp=require(_0xd8e0('0x2'));var moment=require('moment');var BPromise=require(_0xd8e0('0x3'));var Mustache=require(_0xd8e0('0x4'));var util=require(_0xd8e0('0x5'));var path=require(_0xd8e0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8e0('0x7'));var fs=require('fs');var fs_extra=require(_0xd8e0('0x8'));var _=require(_0xd8e0('0x9'));var squel=require(_0xd8e0('0xa'));var crypto=require('crypto');var jsforce=require(_0xd8e0('0xb'));var deskjs=require(_0xd8e0('0xc'));var toCsv=require(_0xd8e0('0xd'));var querystring=require(_0xd8e0('0xe'));var Papa=require(_0xd8e0('0xf'));var Redis=require('ioredis');var authService=require(_0xd8e0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd8e0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd8e0('0x12'));var utils=require(_0xd8e0('0x13'));var config=require(_0xd8e0('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdc16bd,_0x4d968a){_0x4d968a=_0x4d968a||0xcc;return function(_0x11cf8d){if(_0x11cf8d){return _0xdc16bd['sendStatus'](_0x4d968a);}return _0xdc16bd['status'](_0x4d968a)['end']();};}function respondWithResult(_0x1557be,_0x5c983a){_0x5c983a=_0x5c983a||0xc8;return function(_0x34f992){if(_0x34f992){return _0x1557be[_0xd8e0('0x15')](_0x5c983a)[_0xd8e0('0x16')](_0x34f992);}};}function respondWithFilteredResult(_0x14e38b,_0x2689d3){return function(_0x28f3e0){if(_0x28f3e0){var _0xe5d019=typeof _0x2689d3[_0xd8e0('0x17')]===_0xd8e0('0x18')&&typeof _0x2689d3['limit']===_0xd8e0('0x18');var _0x282a0f=_0x28f3e0[_0xd8e0('0x19')];var _0x42586f=_0xe5d019?0x0:_0x2689d3[_0xd8e0('0x17')];var _0x2bf195=_0xe5d019?_0x28f3e0[_0xd8e0('0x19')]:_0x2689d3[_0xd8e0('0x17')]+_0x2689d3['limit'];var _0x371136;if(_0x2bf195>=_0x282a0f){_0x2bf195=_0x282a0f;_0x371136=0xc8;}else{_0x371136=0xce;}_0x14e38b[_0xd8e0('0x15')](_0x371136);return _0x14e38b['set'](_0xd8e0('0x1a'),_0x42586f+'-'+_0x2bf195+'/'+_0x282a0f)['json'](_0x28f3e0);}return null;};}function patchUpdates(_0x55ce9b){return function(_0x50c2a2){try{jsonpatch[_0xd8e0('0x1b')](_0x50c2a2,_0x55ce9b,!![]);}catch(_0x29c413){return BPromise['reject'](_0x29c413);}return _0x50c2a2[_0xd8e0('0x1c')]();};}function saveUpdates(_0x4209fb,_0x1d31de){return function(_0x40f098){if(_0x40f098){return _0x40f098[_0xd8e0('0x1d')](_0x4209fb)[_0xd8e0('0x1e')](function(_0x5285d7){return _0x5285d7;});}return null;};}function removeEntity(_0x1757f3,_0x340ae1){return function(_0x54c515){if(_0x54c515){return _0x54c515['destroy']()['then'](function(){_0x1757f3[_0xd8e0('0x15')](0xcc)[_0xd8e0('0x1f')]();});}};}function handleEntityNotFound(_0x2c1257,_0x16f1ab){return function(_0x148646){if(!_0x148646){_0x2c1257['sendStatus'](0x194);}return _0x148646;};}function handleError(_0x5a156c,_0x1a29c7){_0x1a29c7=_0x1a29c7||0x1f4;return function(_0x469b52){logger[_0xd8e0('0x20')](_0x469b52[_0xd8e0('0x21')]);if(_0x469b52['name']){delete _0x469b52[_0xd8e0('0x22')];}_0x5a156c[_0xd8e0('0x15')](_0x1a29c7)[_0xd8e0('0x23')](_0x469b52);};}exports[_0xd8e0('0x24')]=function(_0x532542,_0x38692c){var _0x46f3a2={},_0x1a9364={},_0x2ab62b={'count':0x0,'rows':[]};var _0x276665=_[_0xd8e0('0x25')](db[_0xd8e0('0x26')]['rawAttributes'],function(_0x2f27ae){return{'name':_0x2f27ae[_0xd8e0('0x27')],'type':_0x2f27ae[_0xd8e0('0x28')][_0xd8e0('0x29')]};});_0x1a9364[_0xd8e0('0x2a')]=_[_0xd8e0('0x25')](_0x276665,_0xd8e0('0x22'));_0x1a9364[_0xd8e0('0x2b')]=_[_0xd8e0('0x2c')](_0x532542[_0xd8e0('0x2b')]);_0x1a9364[_0xd8e0('0x2d')]=_['intersection'](_0x1a9364[_0xd8e0('0x2a')],_0x1a9364[_0xd8e0('0x2b')]);_0x46f3a2[_0xd8e0('0x2e')]=_[_0xd8e0('0x2f')](_0x1a9364[_0xd8e0('0x2a')],qs[_0xd8e0('0x30')](_0x532542['query'][_0xd8e0('0x30')]));_0x46f3a2[_0xd8e0('0x2e')]=_0x46f3a2[_0xd8e0('0x2e')][_0xd8e0('0x31')]?_0x46f3a2[_0xd8e0('0x2e')]:_0x1a9364[_0xd8e0('0x2a')];if(!_0x532542['query'][_0xd8e0('0x32')](_0xd8e0('0x33'))){_0x46f3a2[_0xd8e0('0x34')]=qs['limit'](_0x532542[_0xd8e0('0x2b')]['limit']);_0x46f3a2[_0xd8e0('0x17')]=qs[_0xd8e0('0x17')](_0x532542[_0xd8e0('0x2b')][_0xd8e0('0x17')]);}_0x46f3a2[_0xd8e0('0x35')]=qs[_0xd8e0('0x36')](_0x532542['query'][_0xd8e0('0x36')]);_0x46f3a2[_0xd8e0('0x37')]=qs[_0xd8e0('0x2d')](_[_0xd8e0('0x38')](_0x532542[_0xd8e0('0x2b')],_0x1a9364['filters']),_0x276665);if(_0x532542[_0xd8e0('0x2b')][_0xd8e0('0x39')]){_0x46f3a2[_0xd8e0('0x37')]=_[_0xd8e0('0x3a')](_0x46f3a2[_0xd8e0('0x37')],{'$or':_[_0xd8e0('0x25')](_0x276665,function(_0xd2d3fd){if(_0xd2d3fd[_0xd8e0('0x28')]!==_0xd8e0('0x3b')){var _0x4b3d02={};_0x4b3d02[_0xd2d3fd[_0xd8e0('0x22')]]={'$like':'%'+_0x532542[_0xd8e0('0x2b')][_0xd8e0('0x39')]+'%'};return _0x4b3d02;}})});}_0x46f3a2=_[_0xd8e0('0x3a')]({},_0x46f3a2,_0x532542[_0xd8e0('0x3c')]);var _0x2531e5={'where':_0x46f3a2[_0xd8e0('0x37')]};return db['FaxQueueReport'][_0xd8e0('0x19')](_0x2531e5)[_0xd8e0('0x1e')](function(_0x5f6426){_0x2ab62b[_0xd8e0('0x19')]=_0x5f6426;if(_0x532542[_0xd8e0('0x2b')][_0xd8e0('0x3d')]){_0x46f3a2['include']=[{'all':!![]}];}return db[_0xd8e0('0x26')][_0xd8e0('0x3e')](_0x46f3a2);})['then'](function(_0x371ca7){_0x2ab62b[_0xd8e0('0x3f')]=_0x371ca7;return _0x2ab62b;})[_0xd8e0('0x1e')](respondWithFilteredResult(_0x38692c,_0x46f3a2))[_0xd8e0('0x40')](handleError(_0x38692c,null));};exports[_0xd8e0('0x41')]=function(_0x460da3,_0x41ec9c){var _0x3b9867={'raw':!![],'where':{'id':_0x460da3[_0xd8e0('0x42')]['id']}},_0xf808a={};_0xf808a[_0xd8e0('0x2a')]=_[_0xd8e0('0x2c')](db[_0xd8e0('0x26')]['rawAttributes']);_0xf808a['query']=_[_0xd8e0('0x2c')](_0x460da3['query']);_0xf808a[_0xd8e0('0x2d')]=_[_0xd8e0('0x2f')](_0xf808a['model'],_0xf808a[_0xd8e0('0x2b')]);_0x3b9867[_0xd8e0('0x2e')]=_[_0xd8e0('0x2f')](_0xf808a[_0xd8e0('0x2a')],qs[_0xd8e0('0x30')](_0x460da3['query'][_0xd8e0('0x30')]));_0x3b9867[_0xd8e0('0x2e')]=_0x3b9867[_0xd8e0('0x2e')]['length']?_0x3b9867['attributes']:_0xf808a['model'];if(_0x460da3[_0xd8e0('0x2b')][_0xd8e0('0x3d')]){_0x3b9867[_0xd8e0('0x43')]=[{'all':!![]}];}_0x3b9867=_[_0xd8e0('0x3a')]({},_0x3b9867,_0x460da3[_0xd8e0('0x3c')]);return db[_0xd8e0('0x26')]['find'](_0x3b9867)[_0xd8e0('0x1e')](handleEntityNotFound(_0x41ec9c,null))[_0xd8e0('0x1e')](respondWithResult(_0x41ec9c,null))[_0xd8e0('0x40')](handleError(_0x41ec9c,null));};exports[_0xd8e0('0x44')]=function(_0x20a2eb,_0x3c6af6){return db[_0xd8e0('0x26')][_0xd8e0('0x44')](_0x20a2eb['body'],{})[_0xd8e0('0x1e')](respondWithResult(_0x3c6af6,0xc9))[_0xd8e0('0x40')](handleError(_0x3c6af6,null));};exports['update']=function(_0x58b5a9,_0x3cec45){if(_0x58b5a9[_0xd8e0('0x45')]['id']){delete _0x58b5a9[_0xd8e0('0x45')]['id'];}return db[_0xd8e0('0x26')][_0xd8e0('0x46')]({'where':{'id':_0x58b5a9[_0xd8e0('0x42')]['id']}})[_0xd8e0('0x1e')](handleEntityNotFound(_0x3cec45,null))[_0xd8e0('0x1e')](saveUpdates(_0x58b5a9[_0xd8e0('0x45')],null))['then'](respondWithResult(_0x3cec45,null))[_0xd8e0('0x40')](handleError(_0x3cec45,null));};exports[_0xd8e0('0x47')]=function(_0x415e0f,_0x56ca9a){return db[_0xd8e0('0x26')][_0xd8e0('0x46')]({'where':{'id':_0x415e0f[_0xd8e0('0x42')]['id']}})[_0xd8e0('0x1e')](handleEntityNotFound(_0x56ca9a,null))['then'](removeEntity(_0x56ca9a,null))[_0xd8e0('0x40')](handleError(_0x56ca9a,null));};exports[_0xd8e0('0x48')]=function(_0x698f20,_0x2fd866){return db[_0xd8e0('0x26')][_0xd8e0('0x48')]()[_0xd8e0('0x1e')](respondWithResult(_0x2fd866,null))[_0xd8e0('0x40')](handleError(_0x2fd866,null));}; \ No newline at end of file +var _0xc125=['set','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','index','FaxQueueReport','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset'];(function(_0x534380,_0x4c3a1d){var _0x18f1c0=function(_0x1cdc97){while(--_0x1cdc97){_0x534380['push'](_0x534380['shift']());}};_0x18f1c0(++_0x4c3a1d);}(_0xc125,0x150));var _0x5c12=function(_0x5c46d0,_0x58c514){_0x5c46d0=_0x5c46d0-0x0;var _0x11ecd0=_0xc125[_0x5c46d0];return _0x11ecd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c12('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c12('0x1'));var rp=require(_0x5c12('0x2'));var moment=require(_0x5c12('0x3'));var BPromise=require(_0x5c12('0x4'));var Mustache=require(_0x5c12('0x5'));var util=require(_0x5c12('0x6'));var path=require(_0x5c12('0x7'));var sox=require(_0x5c12('0x8'));var csv=require(_0x5c12('0x9'));var ejs=require(_0x5c12('0xa'));var fs=require('fs');var fs_extra=require(_0x5c12('0xb'));var _=require(_0x5c12('0xc'));var squel=require('squel');var crypto=require(_0x5c12('0xd'));var jsforce=require(_0x5c12('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5c12('0x9'));var querystring=require(_0x5c12('0xf'));var Papa=require(_0x5c12('0x10'));var Redis=require(_0x5c12('0x11'));var authService=require(_0x5c12('0x12'));var qs=require(_0x5c12('0x13'));var as=require(_0x5c12('0x14'));var hardwareService=require(_0x5c12('0x15'));var logger=require('../../config/logger')(_0x5c12('0x16'));var utils=require(_0x5c12('0x17'));var config=require(_0x5c12('0x18'));var licenseUtil=require(_0x5c12('0x19'));var db=require(_0x5c12('0x1a'))['db'];function respondWithStatusCode(_0x4a1279,_0x4f40ae){_0x4f40ae=_0x4f40ae||0xcc;return function(_0x40d80b){if(_0x40d80b){return _0x4a1279['sendStatus'](_0x4f40ae);}return _0x4a1279[_0x5c12('0x1b')](_0x4f40ae)[_0x5c12('0x1c')]();};}function respondWithResult(_0x448667,_0x4a9910){_0x4a9910=_0x4a9910||0xc8;return function(_0x5676a9){if(_0x5676a9){return _0x448667[_0x5c12('0x1b')](_0x4a9910)[_0x5c12('0x1d')](_0x5676a9);}};}function respondWithFilteredResult(_0x5cb237,_0x460ff1){return function(_0xf18ba2){if(_0xf18ba2){var _0x244216=typeof _0x460ff1['offset']==='undefined'&&typeof _0x460ff1[_0x5c12('0x1e')]===_0x5c12('0x1f');var _0x319cc8=_0xf18ba2[_0x5c12('0x20')];var _0x1bd895=_0x244216?0x0:_0x460ff1[_0x5c12('0x21')];var _0x16543f=_0x244216?_0xf18ba2[_0x5c12('0x20')]:_0x460ff1['offset']+_0x460ff1['limit'];var _0x2f7d71;if(_0x16543f>=_0x319cc8){_0x16543f=_0x319cc8;_0x2f7d71=0xc8;}else{_0x2f7d71=0xce;}_0x5cb237[_0x5c12('0x1b')](_0x2f7d71);return _0x5cb237[_0x5c12('0x22')](_0x5c12('0x23'),_0x1bd895+'-'+_0x16543f+'/'+_0x319cc8)['json'](_0xf18ba2);}return null;};}function patchUpdates(_0x3ea1b5){return function(_0x4c096d){try{jsonpatch[_0x5c12('0x24')](_0x4c096d,_0x3ea1b5,!![]);}catch(_0x26aa3f){return BPromise['reject'](_0x26aa3f);}return _0x4c096d['save']();};}function saveUpdates(_0xa1ad8f,_0x5f7e40){return function(_0x5b0552){if(_0x5b0552){return _0x5b0552[_0x5c12('0x25')](_0xa1ad8f)['then'](function(_0xfa7c1e){return _0xfa7c1e;});}return null;};}function removeEntity(_0x7bc2ff,_0x1d9e30){return function(_0x40f6ab){if(_0x40f6ab){return _0x40f6ab[_0x5c12('0x26')]()[_0x5c12('0x27')](function(){_0x7bc2ff[_0x5c12('0x1b')](0xcc)[_0x5c12('0x1c')]();});}};}function handleEntityNotFound(_0xca0f79,_0x1d6d76){return function(_0x23e787){if(!_0x23e787){_0xca0f79[_0x5c12('0x28')](0x194);}return _0x23e787;};}function handleError(_0x146bce,_0x598c2b){_0x598c2b=_0x598c2b||0x1f4;return function(_0x37979e){logger[_0x5c12('0x29')](_0x37979e[_0x5c12('0x2a')]);if(_0x37979e[_0x5c12('0x2b')]){delete _0x37979e[_0x5c12('0x2b')];}_0x146bce[_0x5c12('0x1b')](_0x598c2b)['send'](_0x37979e);};}exports[_0x5c12('0x2c')]=function(_0x3e9bf5,_0x4d21b6){var _0x5939a8={},_0x5815d4={},_0x130be5={'count':0x0,'rows':[]};var _0x2dded3=_['map'](db[_0x5c12('0x2d')][_0x5c12('0x2e')],function(_0xdb38eb){return{'name':_0xdb38eb['fieldName'],'type':_0xdb38eb[_0x5c12('0x2f')]['key']};});_0x5815d4[_0x5c12('0x30')]=_[_0x5c12('0x31')](_0x2dded3,_0x5c12('0x2b'));_0x5815d4[_0x5c12('0x32')]=_[_0x5c12('0x33')](_0x3e9bf5[_0x5c12('0x32')]);_0x5815d4[_0x5c12('0x34')]=_['intersection'](_0x5815d4['model'],_0x5815d4[_0x5c12('0x32')]);_0x5939a8[_0x5c12('0x35')]=_[_0x5c12('0x36')](_0x5815d4[_0x5c12('0x30')],qs['fields'](_0x3e9bf5['query'][_0x5c12('0x37')]));_0x5939a8[_0x5c12('0x35')]=_0x5939a8['attributes']['length']?_0x5939a8['attributes']:_0x5815d4[_0x5c12('0x30')];if(!_0x3e9bf5[_0x5c12('0x32')][_0x5c12('0x38')](_0x5c12('0x39'))){_0x5939a8[_0x5c12('0x1e')]=qs['limit'](_0x3e9bf5[_0x5c12('0x32')][_0x5c12('0x1e')]);_0x5939a8['offset']=qs[_0x5c12('0x21')](_0x3e9bf5[_0x5c12('0x32')][_0x5c12('0x21')]);}_0x5939a8[_0x5c12('0x3a')]=qs[_0x5c12('0x3b')](_0x3e9bf5['query'][_0x5c12('0x3b')]);_0x5939a8[_0x5c12('0x3c')]=qs['filters'](_[_0x5c12('0x3d')](_0x3e9bf5[_0x5c12('0x32')],_0x5815d4[_0x5c12('0x34')]),_0x2dded3);if(_0x3e9bf5['query'][_0x5c12('0x3e')]){_0x5939a8[_0x5c12('0x3c')]=_[_0x5c12('0x3f')](_0x5939a8['where'],{'$or':_[_0x5c12('0x31')](_0x2dded3,function(_0x52e976){if(_0x52e976['type']!=='VIRTUAL'){var _0x1b377f={};_0x1b377f[_0x52e976[_0x5c12('0x2b')]]={'$like':'%'+_0x3e9bf5[_0x5c12('0x32')][_0x5c12('0x3e')]+'%'};return _0x1b377f;}})});}_0x5939a8=_[_0x5c12('0x3f')]({},_0x5939a8,_0x3e9bf5[_0x5c12('0x40')]);var _0x1c1f22={'where':_0x5939a8['where']};return db[_0x5c12('0x2d')][_0x5c12('0x20')](_0x1c1f22)[_0x5c12('0x27')](function(_0x47fece){_0x130be5['count']=_0x47fece;if(_0x3e9bf5['query'][_0x5c12('0x41')]){_0x5939a8['include']=[{'all':!![]}];}return db[_0x5c12('0x2d')][_0x5c12('0x42')](_0x5939a8);})[_0x5c12('0x27')](function(_0x2d3bf8){_0x130be5[_0x5c12('0x43')]=_0x2d3bf8;return _0x130be5;})[_0x5c12('0x27')](respondWithFilteredResult(_0x4d21b6,_0x5939a8))[_0x5c12('0x44')](handleError(_0x4d21b6,null));};exports['show']=function(_0x44da8b,_0x217dbe){var _0x4c1225={'raw':!![],'where':{'id':_0x44da8b[_0x5c12('0x45')]['id']}},_0x312d55={};_0x312d55[_0x5c12('0x30')]=_[_0x5c12('0x33')](db[_0x5c12('0x2d')][_0x5c12('0x2e')]);_0x312d55[_0x5c12('0x32')]=_['keys'](_0x44da8b['query']);_0x312d55[_0x5c12('0x34')]=_[_0x5c12('0x36')](_0x312d55[_0x5c12('0x30')],_0x312d55[_0x5c12('0x32')]);_0x4c1225[_0x5c12('0x35')]=_[_0x5c12('0x36')](_0x312d55[_0x5c12('0x30')],qs[_0x5c12('0x37')](_0x44da8b[_0x5c12('0x32')][_0x5c12('0x37')]));_0x4c1225[_0x5c12('0x35')]=_0x4c1225[_0x5c12('0x35')]['length']?_0x4c1225['attributes']:_0x312d55[_0x5c12('0x30')];if(_0x44da8b[_0x5c12('0x32')][_0x5c12('0x41')]){_0x4c1225['include']=[{'all':!![]}];}_0x4c1225=_[_0x5c12('0x3f')]({},_0x4c1225,_0x44da8b[_0x5c12('0x40')]);return db[_0x5c12('0x2d')][_0x5c12('0x46')](_0x4c1225)[_0x5c12('0x27')](handleEntityNotFound(_0x217dbe,null))[_0x5c12('0x27')](respondWithResult(_0x217dbe,null))['catch'](handleError(_0x217dbe,null));};exports[_0x5c12('0x47')]=function(_0x11801c,_0x36ac79){return db['FaxQueueReport']['create'](_0x11801c[_0x5c12('0x48')],{})[_0x5c12('0x27')](respondWithResult(_0x36ac79,0xc9))[_0x5c12('0x44')](handleError(_0x36ac79,null));};exports[_0x5c12('0x25')]=function(_0x3f80d5,_0x1908c7){if(_0x3f80d5[_0x5c12('0x48')]['id']){delete _0x3f80d5['body']['id'];}return db[_0x5c12('0x2d')][_0x5c12('0x46')]({'where':{'id':_0x3f80d5['params']['id']}})['then'](handleEntityNotFound(_0x1908c7,null))[_0x5c12('0x27')](saveUpdates(_0x3f80d5[_0x5c12('0x48')],null))[_0x5c12('0x27')](respondWithResult(_0x1908c7,null))[_0x5c12('0x44')](handleError(_0x1908c7,null));};exports['destroy']=function(_0x461529,_0x48ac1b){return db['FaxQueueReport'][_0x5c12('0x46')]({'where':{'id':_0x461529['params']['id']}})[_0x5c12('0x27')](handleEntityNotFound(_0x48ac1b,null))[_0x5c12('0x27')](removeEntity(_0x48ac1b,null))[_0x5c12('0x44')](handleError(_0x48ac1b,null));};exports['describe']=function(_0x42ffbc,_0x5083ba){return db[_0x5c12('0x2d')][_0x5c12('0x49')]()[_0x5c12('0x27')](respondWithResult(_0x5083ba,null))[_0x5c12('0x44')](handleError(_0x5083ba,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f48f65c..8ff8976 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(_0x502abd,_0x2132fc){var _0xe4eb73=function(_0x2a2b94){while(--_0x2a2b94){_0x502abd['push'](_0x502abd['shift']());}};_0xe4eb73(++_0x2132fc);}(_0xf494,0x1c6));var _0x4f49=function(_0x1cd585,_0x54276b){_0x1cd585=_0x1cd585-0x0;var _0x3ca87f=_0xf494[_0x1cd585];return _0x3ca87f;};'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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46c265,_0xfbd7ef){var _0x3b9b69=function(_0x6acf03){while(--_0x6acf03){_0x46c265['push'](_0x46c265['shift']());}};_0x3b9b69(++_0xfbd7ef);}(_0x4975,0x86));var _0x5497=function(_0x4df1ea,_0x5ad09c){_0x4df1ea=_0x4df1ea-0x0;var _0x73cc74=_0x4975[_0x4df1ea];return _0x73cc74;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 25e7deb..03f7e6c 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 _0x0d93=['limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateFaxQueueReport','create','body','options','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes'];(function(_0x1c8e46,_0x149c76){var _0x38a854=function(_0x3e73ef){while(--_0x3e73ef){_0x1c8e46['push'](_0x1c8e46['shift']());}};_0x38a854(++_0x149c76);}(_0x0d93,0x1f1));var _0x30d9=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0x0d93[_0x2ad008];return _0x4538cf;};'use strict';var _=require(_0x30d9('0x0'));var util=require(_0x30d9('0x1'));var moment=require(_0x30d9('0x2'));var BPromise=require(_0x30d9('0x3'));var rs=require(_0x30d9('0x4'));var fs=require('fs');var Redis=require(_0x30d9('0x5'));var db=require(_0x30d9('0x6'))['db'];var utils=require(_0x30d9('0x7'));var logger=require(_0x30d9('0x8'))('rpc');var config=require(_0x30d9('0x9'));var jayson=require(_0x30d9('0xa'));var client=jayson['client'][_0x30d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4255e4,_0x1067ec,_0x1ed1e3){return new BPromise(function(_0x2f47f5,_0x97f8a2){return client['request'](_0x4255e4,_0x1ed1e3)['then'](function(_0x246d70){logger[_0x30d9('0xc')](_0x30d9('0xd'),_0x1067ec,'request\x20sent');logger[_0x30d9('0xe')](_0x30d9('0xf'),_0x1067ec,_0x30d9('0x10'),JSON[_0x30d9('0x11')](_0x246d70));if(_0x246d70[_0x30d9('0x12')]){if(_0x246d70['error']['code']===0x1f4){logger[_0x30d9('0x12')](_0x30d9('0xd'),_0x1067ec,_0x246d70[_0x30d9('0x12')][_0x30d9('0x13')]);return _0x97f8a2(_0x246d70[_0x30d9('0x12')][_0x30d9('0x13')]);}logger['error'](_0x30d9('0xd'),_0x1067ec,_0x246d70[_0x30d9('0x12')][_0x30d9('0x13')]);return _0x2f47f5(_0x246d70[_0x30d9('0x12')][_0x30d9('0x13')]);}else{logger['info'](_0x30d9('0xd'),_0x1067ec,'request\x20sent');_0x2f47f5(_0x246d70[_0x30d9('0x14')]['message']);}})[_0x30d9('0x15')](function(_0xdbbd28){logger['error'](_0x30d9('0xd'),_0x1067ec,_0xdbbd28);_0x97f8a2(_0xdbbd28);});});}exports[_0x30d9('0x16')]=function(_0x13440d){var _0x44b2ce=this;return new Promise(function(_0x26b5fb,_0x595b89){return db['FaxQueueReport'][_0x30d9('0x17')](_0x13440d[_0x30d9('0x18')],{'raw':_0x13440d[_0x30d9('0x19')]?_0x13440d[_0x30d9('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x208879){logger[_0x30d9('0xc')]('CreateFaxQueueReport',_0x13440d);logger[_0x30d9('0xe')](_0x30d9('0x16'),_0x13440d,JSON[_0x30d9('0x11')](_0x208879));_0x26b5fb(_0x208879);})[_0x30d9('0x15')](function(_0x56b80c){logger[_0x30d9('0x12')](_0x30d9('0x16'),_0x56b80c[_0x30d9('0x13')],_0x13440d);_0x595b89(_0x44b2ce['error'](0x1f4,_0x56b80c[_0x30d9('0x13')]));});});};exports[_0x30d9('0x1a')]=function(_0x3d328){var _0x2c19e5=this;return new Promise(function(_0x1f1664,_0x47ad81){return db[_0x30d9('0x1b')][_0x30d9('0x1c')](_0x3d328['body'],{'raw':_0x3d328[_0x30d9('0x19')]?_0x3d328[_0x30d9('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d328[_0x30d9('0x19')]?_0x3d328[_0x30d9('0x19')][_0x30d9('0x1d')]||null:null,'attributes':_0x3d328['options']?_0x3d328[_0x30d9('0x19')][_0x30d9('0x1e')]||null:null,'limit':_0x3d328[_0x30d9('0x19')]?_0x3d328[_0x30d9('0x19')][_0x30d9('0x1f')]||null:null})[_0x30d9('0x20')](function(_0x2ddc00){logger[_0x30d9('0xc')]('UpdateFaxQueueReport',_0x3d328);logger[_0x30d9('0xe')]('UpdateFaxQueueReport',_0x3d328,JSON[_0x30d9('0x11')](_0x2ddc00));_0x1f1664(_0x2ddc00);})['catch'](function(_0x481353){logger[_0x30d9('0x12')](_0x30d9('0x1a'),_0x481353[_0x30d9('0x13')],_0x3d328);_0x47ad81(_0x2c19e5[_0x30d9('0x12')](0x1f4,_0x481353[_0x30d9('0x13')]));});});}; \ No newline at end of file +var _0x3bf5=['raw','UpdateFaxQueueReport','update','body','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','options'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0x3bf5,0x173));var _0x53bf=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x3bf5[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x53bf('0x0'));var util=require(_0x53bf('0x1'));var moment=require(_0x53bf('0x2'));var BPromise=require(_0x53bf('0x3'));var rs=require(_0x53bf('0x4'));var fs=require('fs');var Redis=require(_0x53bf('0x5'));var db=require(_0x53bf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x53bf('0x7'))('rpc');var config=require(_0x53bf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x53bf('0x9')][_0x53bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fbf39,_0x784308,_0x21d8ff){return new BPromise(function(_0xdc2b86,_0x191f39){return client['request'](_0x3fbf39,_0x21d8ff)[_0x53bf('0xb')](function(_0x1b788b){logger[_0x53bf('0xc')](_0x53bf('0xd'),_0x784308,_0x53bf('0xe'));logger[_0x53bf('0xf')](_0x53bf('0x10'),_0x784308,'request\x20sent',JSON[_0x53bf('0x11')](_0x1b788b));if(_0x1b788b[_0x53bf('0x12')]){if(_0x1b788b['error'][_0x53bf('0x13')]===0x1f4){logger['error'](_0x53bf('0xd'),_0x784308,_0x1b788b[_0x53bf('0x12')][_0x53bf('0x14')]);return _0x191f39(_0x1b788b[_0x53bf('0x12')]['message']);}logger[_0x53bf('0x12')](_0x53bf('0xd'),_0x784308,_0x1b788b[_0x53bf('0x12')][_0x53bf('0x14')]);return _0xdc2b86(_0x1b788b[_0x53bf('0x12')][_0x53bf('0x14')]);}else{logger['info'](_0x53bf('0xd'),_0x784308,_0x53bf('0xe'));_0xdc2b86(_0x1b788b[_0x53bf('0x15')][_0x53bf('0x14')]);}})['catch'](function(_0x35cdbc){logger[_0x53bf('0x12')](_0x53bf('0xd'),_0x784308,_0x35cdbc);_0x191f39(_0x35cdbc);});});}exports[_0x53bf('0x16')]=function(_0x477db9){var _0x1e5b51=this;return new Promise(function(_0x3e141c,_0x4ea2a6){return db[_0x53bf('0x17')]['create'](_0x477db9['body'],{'raw':_0x477db9[_0x53bf('0x18')]?_0x477db9['options'][_0x53bf('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x42771f){logger[_0x53bf('0xc')](_0x53bf('0x16'),_0x477db9);logger['debug'](_0x53bf('0x16'),_0x477db9,JSON[_0x53bf('0x11')](_0x42771f));_0x3e141c(_0x42771f);})['catch'](function(_0xe40465){logger['error'](_0x53bf('0x16'),_0xe40465[_0x53bf('0x14')],_0x477db9);_0x4ea2a6(_0x1e5b51[_0x53bf('0x12')](0x1f4,_0xe40465[_0x53bf('0x14')]));});});};exports[_0x53bf('0x1a')]=function(_0x474777){var _0x5c74c4=this;return new Promise(function(_0x1c42d0,_0x2d2c6e){return db[_0x53bf('0x17')][_0x53bf('0x1b')](_0x474777[_0x53bf('0x1c')],{'raw':_0x474777['options']?_0x474777[_0x53bf('0x18')][_0x53bf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x474777[_0x53bf('0x18')]?_0x474777[_0x53bf('0x18')][_0x53bf('0x1d')]||null:null,'attributes':_0x474777[_0x53bf('0x18')]?_0x474777[_0x53bf('0x18')][_0x53bf('0x1e')]||null:null,'limit':_0x474777[_0x53bf('0x18')]?_0x474777[_0x53bf('0x18')][_0x53bf('0x1f')]||null:null})[_0x53bf('0xb')](function(_0x4cd39c){logger[_0x53bf('0xc')](_0x53bf('0x1a'),_0x474777);logger[_0x53bf('0xf')](_0x53bf('0x1a'),_0x474777,JSON[_0x53bf('0x11')](_0x4cd39c));_0x1c42d0(_0x4cd39c);})[_0x53bf('0x20')](function(_0x4d062e){logger[_0x53bf('0x12')]('UpdateFaxQueueReport',_0x4d062e[_0x53bf('0x14')],_0x474777);_0x2d2c6e(_0x5c74c4[_0x53bf('0x12')](0x1f4,_0x4d062e[_0x53bf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8e934fc..8937836 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 _0x881f=['/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4f06b9,_0x5cf181){var _0x2a6fca=function(_0x42b3fc){while(--_0x42b3fc){_0x4f06b9['push'](_0x4f06b9['shift']());}};_0x2a6fca(++_0x5cf181);}(_0x881f,0xb9));var _0xf881=function(_0x430d95,_0x4d603a){_0x430d95=_0x430d95-0x0;var _0x42ee3f=_0x881f[_0x430d95];return _0x42ee3f;};'use strict';var multer=require(_0xf881('0x0'));var util=require(_0xf881('0x1'));var path=require(_0xf881('0x2'));var timeout=require(_0xf881('0x3'));var express=require(_0xf881('0x4'));var router=express[_0xf881('0x5')]();var fs_extra=require(_0xf881('0x6'));var auth=require(_0xf881('0x7'));var interaction=require(_0xf881('0x8'));var config=require(_0xf881('0x9'));var controller=require('./faxQueueReport.controller');router[_0xf881('0xa')]('/',auth[_0xf881('0xb')](),controller[_0xf881('0xc')]);router[_0xf881('0xa')](_0xf881('0xd'),auth[_0xf881('0xb')](),controller[_0xf881('0xe')]);router['get'](_0xf881('0xf'),auth[_0xf881('0xb')](),controller[_0xf881('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf881('0x11')]);router[_0xf881('0x12')](_0xf881('0xf'),auth[_0xf881('0xb')](),controller[_0xf881('0x13')]);router[_0xf881('0x14')](_0xf881('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf881('0x15')]=router; \ No newline at end of file +var _0x98a2=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy'];(function(_0x4662d5,_0x3b6e1d){var _0x1f73dd=function(_0x325f40){while(--_0x325f40){_0x4662d5['push'](_0x4662d5['shift']());}};_0x1f73dd(++_0x3b6e1d);}(_0x98a2,0x1b6));var _0x298a=function(_0x5a9db8,_0x293123){_0x5a9db8=_0x5a9db8-0x0;var _0x542f89=_0x98a2[_0x5a9db8];return _0x542f89;};'use strict';var multer=require(_0x298a('0x0'));var util=require(_0x298a('0x1'));var path=require('path');var timeout=require(_0x298a('0x2'));var express=require(_0x298a('0x3'));var router=express[_0x298a('0x4')]();var fs_extra=require(_0x298a('0x5'));var auth=require(_0x298a('0x6'));var interaction=require(_0x298a('0x7'));var config=require(_0x298a('0x8'));var controller=require('./faxQueueReport.controller');router[_0x298a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x298a('0xa')](),controller['describe']);router[_0x298a('0x9')](_0x298a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x298a('0xc')]('/',auth['isAuthenticated'](),controller[_0x298a('0xd')]);router[_0x298a('0xe')](_0x298a('0xb'),auth[_0x298a('0xa')](),controller[_0x298a('0xf')]);router[_0x298a('0x10')](_0x298a('0xb'),auth[_0x298a('0xa')](),controller[_0x298a('0x11')]);module[_0x298a('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index ba9664f..78703e2 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5904e1,_0x53eb79){var _0x36a918=function(_0x1f0261){while(--_0x1f0261){_0x5904e1['push'](_0x5904e1['shift']());}};_0x36a918(++_0x53eb79);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2f81f0,_0x43a3c7){_0x2f81f0=_0x2f81f0-0x0;var _0x4bdcd9=_0xf4eb[_0x2f81f0];return _0x4bdcd9;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5cefc5,_0x2eb303){var _0x24f53d=function(_0x21f7f4){while(--_0x21f7f4){_0x5cefc5['push'](_0x5cefc5['shift']());}};_0x24f53d(++_0x2eb303);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c5ce4,_0x1b4766){_0x2c5ce4=_0x2c5ce4-0x0;var _0x4060a3=_0xedd9[_0x2c5ce4];return _0x4060a3;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 02f6ab8..b4c1f8f 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 _0xa6dc=['rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','include','findAll','rows','show','params','includeAll','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','error','stack','name','index','FaxTransferReport'];(function(_0x172ad9,_0x34b8c7){var _0x243801=function(_0x2cbb55){while(--_0x2cbb55){_0x172ad9['push'](_0x172ad9['shift']());}};_0x243801(++_0x34b8c7);}(_0xa6dc,0xf3));var _0xca6d=function(_0x2c7ec8,_0x4ca951){_0x2c7ec8=_0x2c7ec8-0x0;var _0x5c5653=_0xa6dc[_0x2c7ec8];return _0x5c5653;};'use strict';var emlformat=require(_0xca6d('0x0'));var rimraf=require(_0xca6d('0x1'));var zipdir=require(_0xca6d('0x2'));var jsonpatch=require(_0xca6d('0x3'));var rp=require(_0xca6d('0x4'));var moment=require(_0xca6d('0x5'));var BPromise=require(_0xca6d('0x6'));var Mustache=require('mustache');var util=require(_0xca6d('0x7'));var path=require(_0xca6d('0x8'));var sox=require('sox');var csv=require(_0xca6d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca6d('0xa'));var _=require(_0xca6d('0xb'));var squel=require(_0xca6d('0xc'));var crypto=require('crypto');var jsforce=require(_0xca6d('0xd'));var deskjs=require(_0xca6d('0xe'));var toCsv=require(_0xca6d('0x9'));var querystring=require('querystring');var Papa=require(_0xca6d('0xf'));var Redis=require(_0xca6d('0x10'));var authService=require(_0xca6d('0x11'));var qs=require(_0xca6d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca6d('0x13'));var logger=require(_0xca6d('0x14'))(_0xca6d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xca6d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x264a75,_0x18d50f){_0x18d50f=_0x18d50f||0xcc;return function(_0x6e1c4e){if(_0x6e1c4e){return _0x264a75[_0xca6d('0x17')](_0x18d50f);}return _0x264a75[_0xca6d('0x18')](_0x18d50f)['end']();};}function respondWithResult(_0x4675b2,_0x5cb188){_0x5cb188=_0x5cb188||0xc8;return function(_0x470793){if(_0x470793){return _0x4675b2[_0xca6d('0x18')](_0x5cb188)[_0xca6d('0x19')](_0x470793);}};}function respondWithFilteredResult(_0xc20146,_0x177acd){return function(_0x36c4c8){if(_0x36c4c8){var _0x545027=typeof _0x177acd[_0xca6d('0x1a')]===_0xca6d('0x1b')&&typeof _0x177acd[_0xca6d('0x1c')]===_0xca6d('0x1b');var _0x19c684=_0x36c4c8[_0xca6d('0x1d')];var _0x3aa12a=_0x545027?0x0:_0x177acd[_0xca6d('0x1a')];var _0x15ce0e=_0x545027?_0x36c4c8[_0xca6d('0x1d')]:_0x177acd['offset']+_0x177acd[_0xca6d('0x1c')];var _0x178e7a;if(_0x15ce0e>=_0x19c684){_0x15ce0e=_0x19c684;_0x178e7a=0xc8;}else{_0x178e7a=0xce;}_0xc20146[_0xca6d('0x18')](_0x178e7a);return _0xc20146[_0xca6d('0x1e')](_0xca6d('0x1f'),_0x3aa12a+'-'+_0x15ce0e+'/'+_0x19c684)['json'](_0x36c4c8);}return null;};}function patchUpdates(_0x2c31d5){return function(_0x4f718c){try{jsonpatch['apply'](_0x4f718c,_0x2c31d5,!![]);}catch(_0x1a565a){return BPromise['reject'](_0x1a565a);}return _0x4f718c[_0xca6d('0x20')]();};}function saveUpdates(_0x12e606,_0x19eb90){return function(_0x1f8756){if(_0x1f8756){return _0x1f8756[_0xca6d('0x21')](_0x12e606)['then'](function(_0x1a1554){return _0x1a1554;});}return null;};}function removeEntity(_0x5c9654,_0x2d6634){return function(_0x4f48d9){if(_0x4f48d9){return _0x4f48d9[_0xca6d('0x22')]()[_0xca6d('0x23')](function(){_0x5c9654[_0xca6d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504a0e,_0x20ffb8){return function(_0x4de098){if(!_0x4de098){_0x504a0e[_0xca6d('0x17')](0x194);}return _0x4de098;};}function handleError(_0x42bdf0,_0x226087){_0x226087=_0x226087||0x1f4;return function(_0x5aca4d){logger[_0xca6d('0x24')](_0x5aca4d[_0xca6d('0x25')]);if(_0x5aca4d[_0xca6d('0x26')]){delete _0x5aca4d[_0xca6d('0x26')];}_0x42bdf0[_0xca6d('0x18')](_0x226087)['send'](_0x5aca4d);};}exports[_0xca6d('0x27')]=function(_0x1f1c12,_0x1d8ebb){var _0x4684ff={},_0x37179e={},_0x2682c4={'count':0x0,'rows':[]};var _0x533b6e=_['map'](db[_0xca6d('0x28')][_0xca6d('0x29')],function(_0x32cc3f){return{'name':_0x32cc3f[_0xca6d('0x2a')],'type':_0x32cc3f[_0xca6d('0x2b')][_0xca6d('0x2c')]};});_0x37179e[_0xca6d('0x2d')]=_[_0xca6d('0x2e')](_0x533b6e,_0xca6d('0x26'));_0x37179e['query']=_[_0xca6d('0x2f')](_0x1f1c12[_0xca6d('0x30')]);_0x37179e[_0xca6d('0x31')]=_[_0xca6d('0x32')](_0x37179e[_0xca6d('0x2d')],_0x37179e[_0xca6d('0x30')]);_0x4684ff['attributes']=_[_0xca6d('0x32')](_0x37179e[_0xca6d('0x2d')],qs[_0xca6d('0x33')](_0x1f1c12[_0xca6d('0x30')]['fields']));_0x4684ff[_0xca6d('0x34')]=_0x4684ff[_0xca6d('0x34')]['length']?_0x4684ff['attributes']:_0x37179e[_0xca6d('0x2d')];if(!_0x1f1c12[_0xca6d('0x30')][_0xca6d('0x35')]('nolimit')){_0x4684ff[_0xca6d('0x1c')]=qs[_0xca6d('0x1c')](_0x1f1c12['query']['limit']);_0x4684ff['offset']=qs[_0xca6d('0x1a')](_0x1f1c12['query'][_0xca6d('0x1a')]);}_0x4684ff[_0xca6d('0x36')]=qs[_0xca6d('0x37')](_0x1f1c12[_0xca6d('0x30')]['sort']);_0x4684ff[_0xca6d('0x38')]=qs[_0xca6d('0x31')](_['pick'](_0x1f1c12[_0xca6d('0x30')],_0x37179e[_0xca6d('0x31')]),_0x533b6e);if(_0x1f1c12['query'][_0xca6d('0x39')]){_0x4684ff[_0xca6d('0x38')]=_[_0xca6d('0x3a')](_0x4684ff['where'],{'$or':_['map'](_0x533b6e,function(_0x4ceb2f){if(_0x4ceb2f[_0xca6d('0x2b')]!=='VIRTUAL'){var _0x5d4706={};_0x5d4706[_0x4ceb2f['name']]={'$like':'%'+_0x1f1c12['query'][_0xca6d('0x39')]+'%'};return _0x5d4706;}})});}_0x4684ff=_['merge']({},_0x4684ff,_0x1f1c12['options']);var _0x52559c={'where':_0x4684ff[_0xca6d('0x38')]};return db[_0xca6d('0x28')][_0xca6d('0x1d')](_0x52559c)[_0xca6d('0x23')](function(_0x4be6b8){_0x2682c4[_0xca6d('0x1d')]=_0x4be6b8;if(_0x1f1c12['query']['includeAll']){_0x4684ff[_0xca6d('0x3b')]=[{'all':!![]}];}return db[_0xca6d('0x28')][_0xca6d('0x3c')](_0x4684ff);})['then'](function(_0x1d84be){_0x2682c4[_0xca6d('0x3d')]=_0x1d84be;return _0x2682c4;})[_0xca6d('0x23')](respondWithFilteredResult(_0x1d8ebb,_0x4684ff))['catch'](handleError(_0x1d8ebb,null));};exports[_0xca6d('0x3e')]=function(_0x5559d,_0x119e3f){var _0x49c917={'raw':!![],'where':{'id':_0x5559d[_0xca6d('0x3f')]['id']}},_0x2bfb28={};_0x2bfb28[_0xca6d('0x2d')]=_[_0xca6d('0x2f')](db['FaxTransferReport'][_0xca6d('0x29')]);_0x2bfb28[_0xca6d('0x30')]=_[_0xca6d('0x2f')](_0x5559d[_0xca6d('0x30')]);_0x2bfb28[_0xca6d('0x31')]=_['intersection'](_0x2bfb28['model'],_0x2bfb28[_0xca6d('0x30')]);_0x49c917[_0xca6d('0x34')]=_['intersection'](_0x2bfb28[_0xca6d('0x2d')],qs['fields'](_0x5559d[_0xca6d('0x30')][_0xca6d('0x33')]));_0x49c917['attributes']=_0x49c917[_0xca6d('0x34')]['length']?_0x49c917['attributes']:_0x2bfb28[_0xca6d('0x2d')];if(_0x5559d[_0xca6d('0x30')][_0xca6d('0x40')]){_0x49c917[_0xca6d('0x3b')]=[{'all':!![]}];}_0x49c917=_[_0xca6d('0x3a')]({},_0x49c917,_0x5559d[_0xca6d('0x41')]);return db[_0xca6d('0x28')]['find'](_0x49c917)[_0xca6d('0x23')](handleEntityNotFound(_0x119e3f,null))[_0xca6d('0x23')](respondWithResult(_0x119e3f,null))[_0xca6d('0x42')](handleError(_0x119e3f,null));};exports[_0xca6d('0x43')]=function(_0x2fc265,_0x5251b1){return db['FaxTransferReport'][_0xca6d('0x43')](_0x2fc265[_0xca6d('0x44')],{})['then'](respondWithResult(_0x5251b1,0xc9))['catch'](handleError(_0x5251b1,null));};exports['update']=function(_0x391864,_0x3b3554){if(_0x391864[_0xca6d('0x44')]['id']){delete _0x391864[_0xca6d('0x44')]['id'];}return db[_0xca6d('0x28')][_0xca6d('0x45')]({'where':{'id':_0x391864[_0xca6d('0x3f')]['id']}})[_0xca6d('0x23')](handleEntityNotFound(_0x3b3554,null))[_0xca6d('0x23')](saveUpdates(_0x391864[_0xca6d('0x44')],null))['then'](respondWithResult(_0x3b3554,null))[_0xca6d('0x42')](handleError(_0x3b3554,null));};exports[_0xca6d('0x22')]=function(_0x49c52f,_0x113303){return db[_0xca6d('0x28')][_0xca6d('0x45')]({'where':{'id':_0x49c52f[_0xca6d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x113303,null))[_0xca6d('0x23')](removeEntity(_0x113303,null))[_0xca6d('0x42')](handleError(_0x113303,null));};exports[_0xca6d('0x46')]=function(_0x2f7b8b,_0x4e48ce){return db[_0xca6d('0x28')][_0xca6d('0x46')]()[_0xca6d('0x23')](respondWithResult(_0x4e48ce,null))[_0xca6d('0x42')](handleError(_0x4e48ce,null));}; \ No newline at end of file +var _0xb22c=['destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','save','update','then','error','stack','name','send','index','FaxTransferReport','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','keys','create','body','find','params'];(function(_0x590f6a,_0x30235d){var _0x281747=function(_0x2e884f){while(--_0x2e884f){_0x590f6a['push'](_0x590f6a['shift']());}};_0x281747(++_0x30235d);}(_0xb22c,0x1ca));var _0xcb22=function(_0x5e8932,_0x433e8b){_0x5e8932=_0x5e8932-0x0;var _0x57aede=_0xb22c[_0x5e8932];return _0x57aede;};'use strict';var emlformat=require(_0xcb22('0x0'));var rimraf=require(_0xcb22('0x1'));var zipdir=require(_0xcb22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb22('0x3'));var moment=require(_0xcb22('0x4'));var BPromise=require(_0xcb22('0x5'));var Mustache=require(_0xcb22('0x6'));var util=require(_0xcb22('0x7'));var path=require('path');var sox=require(_0xcb22('0x8'));var csv=require(_0xcb22('0x9'));var ejs=require(_0xcb22('0xa'));var fs=require('fs');var fs_extra=require(_0xcb22('0xb'));var _=require(_0xcb22('0xc'));var squel=require(_0xcb22('0xd'));var crypto=require('crypto');var jsforce=require(_0xcb22('0xe'));var deskjs=require(_0xcb22('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcb22('0x10'));var Papa=require(_0xcb22('0x11'));var Redis=require(_0xcb22('0x12'));var authService=require(_0xcb22('0x13'));var qs=require(_0xcb22('0x14'));var as=require(_0xcb22('0x15'));var hardwareService=require(_0xcb22('0x16'));var logger=require(_0xcb22('0x17'))(_0xcb22('0x18'));var utils=require(_0xcb22('0x19'));var config=require(_0xcb22('0x1a'));var licenseUtil=require(_0xcb22('0x1b'));var db=require(_0xcb22('0x1c'))['db'];function respondWithStatusCode(_0x401dbb,_0x163514){_0x163514=_0x163514||0xcc;return function(_0x281dfb){if(_0x281dfb){return _0x401dbb['sendStatus'](_0x163514);}return _0x401dbb[_0xcb22('0x1d')](_0x163514)[_0xcb22('0x1e')]();};}function respondWithResult(_0x3759f6,_0x54ac0a){_0x54ac0a=_0x54ac0a||0xc8;return function(_0x69ff7c){if(_0x69ff7c){return _0x3759f6[_0xcb22('0x1d')](_0x54ac0a)[_0xcb22('0x1f')](_0x69ff7c);}};}function respondWithFilteredResult(_0x46f98e,_0x596884){return function(_0x2ec128){if(_0x2ec128){var _0x3e847e=typeof _0x596884[_0xcb22('0x20')]===_0xcb22('0x21')&&typeof _0x596884[_0xcb22('0x22')]==='undefined';var _0x424486=_0x2ec128[_0xcb22('0x23')];var _0x760b3f=_0x3e847e?0x0:_0x596884[_0xcb22('0x20')];var _0x354183=_0x3e847e?_0x2ec128['count']:_0x596884[_0xcb22('0x20')]+_0x596884[_0xcb22('0x22')];var _0x39b6a5;if(_0x354183>=_0x424486){_0x354183=_0x424486;_0x39b6a5=0xc8;}else{_0x39b6a5=0xce;}_0x46f98e[_0xcb22('0x1d')](_0x39b6a5);return _0x46f98e['set']('Content-Range',_0x760b3f+'-'+_0x354183+'/'+_0x424486)[_0xcb22('0x1f')](_0x2ec128);}return null;};}function patchUpdates(_0x423530){return function(_0x59ce37){try{jsonpatch['apply'](_0x59ce37,_0x423530,!![]);}catch(_0x4e4ba4){return BPromise['reject'](_0x4e4ba4);}return _0x59ce37[_0xcb22('0x24')]();};}function saveUpdates(_0x36586c,_0x814ce9){return function(_0x4b608e){if(_0x4b608e){return _0x4b608e[_0xcb22('0x25')](_0x36586c)[_0xcb22('0x26')](function(_0x4682dd){return _0x4682dd;});}return null;};}function removeEntity(_0x328c8b,_0x3c1d06){return function(_0x2cd1ca){if(_0x2cd1ca){return _0x2cd1ca['destroy']()['then'](function(){_0x328c8b[_0xcb22('0x1d')](0xcc)[_0xcb22('0x1e')]();});}};}function handleEntityNotFound(_0x3bec16,_0x2a5177){return function(_0xd002a9){if(!_0xd002a9){_0x3bec16['sendStatus'](0x194);}return _0xd002a9;};}function handleError(_0x45ef8d,_0x295435){_0x295435=_0x295435||0x1f4;return function(_0x2ce787){logger[_0xcb22('0x27')](_0x2ce787[_0xcb22('0x28')]);if(_0x2ce787['name']){delete _0x2ce787[_0xcb22('0x29')];}_0x45ef8d[_0xcb22('0x1d')](_0x295435)[_0xcb22('0x2a')](_0x2ce787);};}exports[_0xcb22('0x2b')]=function(_0x882ad6,_0x3855ec){var _0x289426={},_0xb54b92={},_0x40eaad={'count':0x0,'rows':[]};var _0x3185f9=_['map'](db[_0xcb22('0x2c')][_0xcb22('0x2d')],function(_0x7813df){return{'name':_0x7813df['fieldName'],'type':_0x7813df[_0xcb22('0x2e')]['key']};});_0xb54b92[_0xcb22('0x2f')]=_[_0xcb22('0x30')](_0x3185f9,_0xcb22('0x29'));_0xb54b92[_0xcb22('0x31')]=_['keys'](_0x882ad6['query']);_0xb54b92[_0xcb22('0x32')]=_[_0xcb22('0x33')](_0xb54b92[_0xcb22('0x2f')],_0xb54b92[_0xcb22('0x31')]);_0x289426[_0xcb22('0x34')]=_[_0xcb22('0x33')](_0xb54b92['model'],qs[_0xcb22('0x35')](_0x882ad6['query'][_0xcb22('0x35')]));_0x289426[_0xcb22('0x34')]=_0x289426[_0xcb22('0x34')][_0xcb22('0x36')]?_0x289426[_0xcb22('0x34')]:_0xb54b92['model'];if(!_0x882ad6[_0xcb22('0x31')][_0xcb22('0x37')](_0xcb22('0x38'))){_0x289426[_0xcb22('0x22')]=qs['limit'](_0x882ad6[_0xcb22('0x31')][_0xcb22('0x22')]);_0x289426[_0xcb22('0x20')]=qs[_0xcb22('0x20')](_0x882ad6['query']['offset']);}_0x289426[_0xcb22('0x39')]=qs['sort'](_0x882ad6['query'][_0xcb22('0x3a')]);_0x289426['where']=qs['filters'](_[_0xcb22('0x3b')](_0x882ad6[_0xcb22('0x31')],_0xb54b92[_0xcb22('0x32')]),_0x3185f9);if(_0x882ad6['query'][_0xcb22('0x3c')]){_0x289426[_0xcb22('0x3d')]=_[_0xcb22('0x3e')](_0x289426['where'],{'$or':_[_0xcb22('0x30')](_0x3185f9,function(_0x121de0){if(_0x121de0[_0xcb22('0x2e')]!=='VIRTUAL'){var _0xf8491c={};_0xf8491c[_0x121de0[_0xcb22('0x29')]]={'$like':'%'+_0x882ad6[_0xcb22('0x31')][_0xcb22('0x3c')]+'%'};return _0xf8491c;}})});}_0x289426=_[_0xcb22('0x3e')]({},_0x289426,_0x882ad6[_0xcb22('0x3f')]);var _0x402780={'where':_0x289426[_0xcb22('0x3d')]};return db[_0xcb22('0x2c')][_0xcb22('0x23')](_0x402780)[_0xcb22('0x26')](function(_0x1ecd05){_0x40eaad[_0xcb22('0x23')]=_0x1ecd05;if(_0x882ad6[_0xcb22('0x31')][_0xcb22('0x40')]){_0x289426['include']=[{'all':!![]}];}return db[_0xcb22('0x2c')][_0xcb22('0x41')](_0x289426);})['then'](function(_0x290e69){_0x40eaad[_0xcb22('0x42')]=_0x290e69;return _0x40eaad;})[_0xcb22('0x26')](respondWithFilteredResult(_0x3855ec,_0x289426))[_0xcb22('0x43')](handleError(_0x3855ec,null));};exports[_0xcb22('0x44')]=function(_0x3ea033,_0x1881b8){var _0x4f0eba={'raw':!![],'where':{'id':_0x3ea033['params']['id']}},_0x25d967={};_0x25d967[_0xcb22('0x2f')]=_[_0xcb22('0x45')](db[_0xcb22('0x2c')][_0xcb22('0x2d')]);_0x25d967[_0xcb22('0x31')]=_[_0xcb22('0x45')](_0x3ea033[_0xcb22('0x31')]);_0x25d967['filters']=_[_0xcb22('0x33')](_0x25d967[_0xcb22('0x2f')],_0x25d967[_0xcb22('0x31')]);_0x4f0eba[_0xcb22('0x34')]=_[_0xcb22('0x33')](_0x25d967[_0xcb22('0x2f')],qs[_0xcb22('0x35')](_0x3ea033[_0xcb22('0x31')]['fields']));_0x4f0eba[_0xcb22('0x34')]=_0x4f0eba[_0xcb22('0x34')]['length']?_0x4f0eba[_0xcb22('0x34')]:_0x25d967[_0xcb22('0x2f')];if(_0x3ea033['query'][_0xcb22('0x40')]){_0x4f0eba['include']=[{'all':!![]}];}_0x4f0eba=_[_0xcb22('0x3e')]({},_0x4f0eba,_0x3ea033[_0xcb22('0x3f')]);return db[_0xcb22('0x2c')]['find'](_0x4f0eba)[_0xcb22('0x26')](handleEntityNotFound(_0x1881b8,null))['then'](respondWithResult(_0x1881b8,null))[_0xcb22('0x43')](handleError(_0x1881b8,null));};exports[_0xcb22('0x46')]=function(_0x39e3ad,_0x38be2b){return db[_0xcb22('0x2c')][_0xcb22('0x46')](_0x39e3ad['body'],{})[_0xcb22('0x26')](respondWithResult(_0x38be2b,0xc9))[_0xcb22('0x43')](handleError(_0x38be2b,null));};exports[_0xcb22('0x25')]=function(_0x260eca,_0x2d2b50){if(_0x260eca[_0xcb22('0x47')]['id']){delete _0x260eca[_0xcb22('0x47')]['id'];}return db[_0xcb22('0x2c')][_0xcb22('0x48')]({'where':{'id':_0x260eca[_0xcb22('0x49')]['id']}})[_0xcb22('0x26')](handleEntityNotFound(_0x2d2b50,null))[_0xcb22('0x26')](saveUpdates(_0x260eca[_0xcb22('0x47')],null))[_0xcb22('0x26')](respondWithResult(_0x2d2b50,null))[_0xcb22('0x43')](handleError(_0x2d2b50,null));};exports[_0xcb22('0x4a')]=function(_0x7e8b3b,_0x892576){return db[_0xcb22('0x2c')][_0xcb22('0x48')]({'where':{'id':_0x7e8b3b['params']['id']}})[_0xcb22('0x26')](handleEntityNotFound(_0x892576,null))[_0xcb22('0x26')](removeEntity(_0x892576,null))[_0xcb22('0x43')](handleError(_0x892576,null));};exports[_0xcb22('0x4b')]=function(_0x4dcc40,_0x1326ac){return db[_0xcb22('0x2c')]['describe']()[_0xcb22('0x26')](respondWithResult(_0x1326ac,null))[_0xcb22('0x43')](handleError(_0x1326ac,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 94c3c92..7d0b793 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 _0x4210=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x2a75cd,_0x247962){var _0x2319bc=function(_0x47d0c5){while(--_0x47d0c5){_0x2a75cd['push'](_0x2a75cd['shift']());}};_0x2319bc(++_0x247962);}(_0x4210,0x7a));var _0x0421=function(_0x31ed69,_0x4cf451){_0x31ed69=_0x31ed69-0x0;var _0x48cf2e=_0x4210[_0x31ed69];return _0x48cf2e;};'use strict';var _=require(_0x0421('0x0'));var util=require(_0x0421('0x1'));var logger=require(_0x0421('0x2'))(_0x0421('0x3'));var moment=require(_0x0421('0x4'));var BPromise=require(_0x0421('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0421('0x6'));var rimraf=require(_0x0421('0x7'));var config=require(_0x0421('0x8'));var attributes=require(_0x0421('0x9'));module['exports']=function(_0x2517a2,_0x57532e){return _0x2517a2['define']('FaxTransferReport',attributes,{'tableName':_0x0421('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0421('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd099=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0xcd459c,_0xe2632d){var _0x5e3ba4=function(_0x2a3035){while(--_0x2a3035){_0xcd459c['push'](_0xcd459c['shift']());}};_0x5e3ba4(++_0xe2632d);}(_0xd099,0x1bd));var _0x9d09=function(_0x409ad2,_0x5129c1){_0x409ad2=_0x409ad2-0x0;var _0x595b5f=_0xd099[_0x409ad2];return _0x595b5f;};'use strict';var _=require(_0x9d09('0x0'));var util=require(_0x9d09('0x1'));var logger=require(_0x9d09('0x2'))(_0x9d09('0x3'));var moment=require('moment');var BPromise=require(_0x9d09('0x4'));var rp=require(_0x9d09('0x5'));var fs=require('fs');var path=require(_0x9d09('0x6'));var rimraf=require(_0x9d09('0x7'));var config=require(_0x9d09('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x9d09('0x9')]=function(_0x4f5b37,_0x1bcc73){return _0x4f5b37[_0x9d09('0xa')](_0x9d09('0xb'),attributes,{'tableName':_0x9d09('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9d09('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 3ef7513..9e18940 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 _0xa28e=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x287d08,_0x55ab1e){var _0x3e7834=function(_0x3cada6){while(--_0x3cada6){_0x287d08['push'](_0x287d08['shift']());}};_0x3e7834(++_0x55ab1e);}(_0xa28e,0x185));var _0xea28=function(_0x59cf5a,_0x381c66){_0x59cf5a=_0x59cf5a-0x0;var _0x88c714=_0xa28e[_0x59cf5a];return _0x88c714;};'use strict';var _=require(_0xea28('0x0'));var util=require(_0xea28('0x1'));var moment=require(_0xea28('0x2'));var BPromise=require(_0xea28('0x3'));var rs=require(_0xea28('0x4'));var fs=require('fs');var Redis=require(_0xea28('0x5'));var db=require(_0xea28('0x6'))['db'];var utils=require(_0xea28('0x7'));var logger=require(_0xea28('0x8'))(_0xea28('0x9'));var config=require(_0xea28('0xa'));var jayson=require(_0xea28('0xb'));var client=jayson[_0xea28('0xc')][_0xea28('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x179afb,_0x51617b,_0x508601){return new BPromise(function(_0x587469,_0x1c2f60){return client[_0xea28('0xe')](_0x179afb,_0x508601)[_0xea28('0xf')](function(_0x364418){logger[_0xea28('0x10')](_0xea28('0x11'),_0x51617b,_0xea28('0x12'));logger[_0xea28('0x13')](_0xea28('0x14'),_0x51617b,'request\x20sent',JSON[_0xea28('0x15')](_0x364418));if(_0x364418[_0xea28('0x16')]){if(_0x364418[_0xea28('0x16')][_0xea28('0x17')]===0x1f4){logger[_0xea28('0x16')](_0xea28('0x11'),_0x51617b,_0x364418[_0xea28('0x16')][_0xea28('0x18')]);return _0x1c2f60(_0x364418[_0xea28('0x16')]['message']);}logger[_0xea28('0x16')]('FaxTransferReport,\x20%s,\x20%s',_0x51617b,_0x364418[_0xea28('0x16')][_0xea28('0x18')]);return _0x587469(_0x364418[_0xea28('0x16')][_0xea28('0x18')]);}else{logger[_0xea28('0x10')](_0xea28('0x11'),_0x51617b,_0xea28('0x12'));_0x587469(_0x364418[_0xea28('0x19')]['message']);}})[_0xea28('0x1a')](function(_0x5e112b){logger[_0xea28('0x16')](_0xea28('0x11'),_0x51617b,_0x5e112b);_0x1c2f60(_0x5e112b);});});} \ No newline at end of file +var _0x5e65=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0xdb6db0,_0x25bcab){var _0x45bad9=function(_0x3759a9){while(--_0x3759a9){_0xdb6db0['push'](_0xdb6db0['shift']());}};_0x45bad9(++_0x25bcab);}(_0x5e65,0x8a));var _0x55e6=function(_0x17458d,_0x12a41b){_0x17458d=_0x17458d-0x0;var _0x48ea09=_0x5e65[_0x17458d];return _0x48ea09;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x55e6('0x0'));var BPromise=require(_0x55e6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55e6('0x2'));var db=require(_0x55e6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x55e6('0x4'))(_0x55e6('0x5'));var config=require(_0x55e6('0x6'));var jayson=require(_0x55e6('0x7'));var client=jayson[_0x55e6('0x8')][_0x55e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cdf66,_0x4a7779,_0x31a2f4){return new BPromise(function(_0x19c270,_0x2fc72b){return client[_0x55e6('0xa')](_0x4cdf66,_0x31a2f4)[_0x55e6('0xb')](function(_0x44b338){logger[_0x55e6('0xc')](_0x55e6('0xd'),_0x4a7779,'request\x20sent');logger['debug'](_0x55e6('0xe'),_0x4a7779,'request\x20sent',JSON[_0x55e6('0xf')](_0x44b338));if(_0x44b338[_0x55e6('0x10')]){if(_0x44b338[_0x55e6('0x10')]['code']===0x1f4){logger[_0x55e6('0x10')](_0x55e6('0xd'),_0x4a7779,_0x44b338['error'][_0x55e6('0x11')]);return _0x2fc72b(_0x44b338[_0x55e6('0x10')]['message']);}logger[_0x55e6('0x10')](_0x55e6('0xd'),_0x4a7779,_0x44b338[_0x55e6('0x10')][_0x55e6('0x11')]);return _0x19c270(_0x44b338['error']['message']);}else{logger[_0x55e6('0xc')](_0x55e6('0xd'),_0x4a7779,_0x55e6('0x12'));_0x19c270(_0x44b338['result'][_0x55e6('0x11')]);}})['catch'](function(_0x3157f1){logger[_0x55e6('0x10')](_0x55e6('0xd'),_0x4a7779,_0x3157f1);_0x2fc72b(_0x3157f1);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 35d3fd4..b974238 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 _0xb7c8=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','destroy'];(function(_0x1893bb,_0x451317){var _0x5c8e15=function(_0x5a8f02){while(--_0x5a8f02){_0x1893bb['push'](_0x1893bb['shift']());}};_0x5c8e15(++_0x451317);}(_0xb7c8,0x90));var _0x8b7c=function(_0x4dd9f4,_0x144fe2){_0x4dd9f4=_0x4dd9f4-0x0;var _0x8154b1=_0xb7c8[_0x4dd9f4];return _0x8154b1;};'use strict';var multer=require('multer');var util=require(_0x8b7c('0x0'));var path=require(_0x8b7c('0x1'));var timeout=require(_0x8b7c('0x2'));var express=require(_0x8b7c('0x3'));var router=express[_0x8b7c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b7c('0x5'));var interaction=require(_0x8b7c('0x6'));var config=require(_0x8b7c('0x7'));var controller=require('./faxTransferReport.controller');router[_0x8b7c('0x8')]('/',auth[_0x8b7c('0x9')](),controller['index']);router[_0x8b7c('0x8')](_0x8b7c('0xa'),auth[_0x8b7c('0x9')](),controller[_0x8b7c('0xb')]);router['get'](_0x8b7c('0xc'),auth[_0x8b7c('0x9')](),controller[_0x8b7c('0xd')]);router[_0x8b7c('0xe')]('/',auth['isAuthenticated'](),controller[_0x8b7c('0xf')]);router['put']('/:id',auth[_0x8b7c('0x9')](),controller[_0x8b7c('0x10')]);router['delete'](_0x8b7c('0xc'),auth[_0x8b7c('0x9')](),controller[_0x8b7c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x058e=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x28d4e4,_0x49f71b){var _0x543b9c=function(_0x5cab7e){while(--_0x5cab7e){_0x28d4e4['push'](_0x28d4e4['shift']());}};_0x543b9c(++_0x49f71b);}(_0x058e,0x156));var _0xe058=function(_0x4983a1,_0xbd04e9){_0x4983a1=_0x4983a1-0x0;var _0x1c93ec=_0x058e[_0x4983a1];return _0x1c93ec;};'use strict';var multer=require('multer');var util=require(_0xe058('0x0'));var path=require('path');var timeout=require(_0xe058('0x1'));var express=require(_0xe058('0x2'));var router=express[_0xe058('0x3')]();var fs_extra=require(_0xe058('0x4'));var auth=require(_0xe058('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe058('0x6'));router[_0xe058('0x7')]('/',auth[_0xe058('0x8')](),controller['index']);router['get']('/describe',auth[_0xe058('0x8')](),controller[_0xe058('0x9')]);router[_0xe058('0x7')]('/:id',auth[_0xe058('0x8')](),controller[_0xe058('0xa')]);router[_0xe058('0xb')]('/',auth[_0xe058('0x8')](),controller[_0xe058('0xc')]);router[_0xe058('0xd')](_0xe058('0xe'),auth[_0xe058('0x8')](),controller[_0xe058('0xf')]);router[_0xe058('0x10')](_0xe058('0xe'),auth[_0xe058('0x8')](),controller[_0xe058('0x11')]);module[_0xe058('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index db29867..f3f1793 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 _0x37f6=['create','addConfiguration','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','index','/:id/configurations','/:id/fields','isAuthenticated','getFields','post'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x37f6,0x75));var _0x637f=function(_0x1e6f9a,_0x37c6d8){_0x1e6f9a=_0x1e6f9a-0x0;var _0x2b65b0=_0x37f6[_0x1e6f9a];return _0x2b65b0;};'use strict';var multer=require(_0x637f('0x0'));var util=require('util');var path=require(_0x637f('0x1'));var timeout=require(_0x637f('0x2'));var express=require(_0x637f('0x3'));var router=express[_0x637f('0x4')]();var fs_extra=require(_0x637f('0x5'));var auth=require(_0x637f('0x6'));var interaction=require(_0x637f('0x7'));var config=require('../../config/environment');var controller=require(_0x637f('0x8'));router[_0x637f('0x9')]('/',auth['isAuthenticated'](),controller[_0x637f('0xa')]);router[_0x637f('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x637f('0x9')](_0x637f('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x637f('0x9')](_0x637f('0xc'),auth[_0x637f('0xd')](),controller[_0x637f('0xe')]);router[_0x637f('0xf')]('/',auth['isAuthenticated'](),controller[_0x637f('0x10')]);router[_0x637f('0xf')](_0x637f('0xb'),auth['isAuthenticated'](),controller[_0x637f('0x11')]);router['put']('/:id',auth[_0x637f('0xd')](),controller['update']);router['delete']('/:id',auth[_0x637f('0xd')](),controller[_0x637f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0fce=['/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x554b50,_0x108720){var _0x53f35a=function(_0x58060b){while(--_0x58060b){_0x554b50['push'](_0x554b50['shift']());}};_0x53f35a(++_0x108720);}(_0x0fce,0x198));var _0xe0fc=function(_0x38ae7,_0x156bed){_0x38ae7=_0x38ae7-0x0;var _0x5cb385=_0x0fce[_0x38ae7];return _0x5cb385;};'use strict';var multer=require(_0xe0fc('0x0'));var util=require(_0xe0fc('0x1'));var path=require(_0xe0fc('0x2'));var timeout=require(_0xe0fc('0x3'));var express=require('express');var router=express[_0xe0fc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe0fc('0x5'));var config=require(_0xe0fc('0x6'));var controller=require(_0xe0fc('0x7'));router[_0xe0fc('0x8')]('/',auth[_0xe0fc('0x9')](),controller['index']);router[_0xe0fc('0x8')](_0xe0fc('0xa'),auth['isAuthenticated'](),controller[_0xe0fc('0xb')]);router[_0xe0fc('0x8')]('/:id/configurations',auth[_0xe0fc('0x9')](),controller[_0xe0fc('0xc')]);router[_0xe0fc('0x8')](_0xe0fc('0xd'),auth[_0xe0fc('0x9')](),controller[_0xe0fc('0xe')]);router[_0xe0fc('0xf')]('/',auth[_0xe0fc('0x9')](),controller[_0xe0fc('0x10')]);router[_0xe0fc('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xe0fc('0x11')]);router[_0xe0fc('0x12')](_0xe0fc('0xa'),auth['isAuthenticated'](),controller[_0xe0fc('0x13')]);router[_0xe0fc('0x14')](_0xe0fc('0xa'),auth[_0xe0fc('0x9')](),controller['destroy']);module[_0xe0fc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index e3b41c1..25c0a7a 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 _0x18f8=['STRING','ENUM','newTab','integrationTab','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x18f8,0xdb));var _0x818f=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x18f8[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');module[_0x818f('0x0')]={'name':{'type':Sequelize[_0x818f('0x1')]},'description':{'type':Sequelize[_0x818f('0x1')]},'username':{'type':Sequelize[_0x818f('0x1')]},'remoteUri':{'type':Sequelize[_0x818f('0x1')]},'authType':{'type':Sequelize[_0x818f('0x2')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0x818f('0x1')]},'consumerKey':{'type':Sequelize[_0x818f('0x1')]},'consumerSecret':{'type':Sequelize[_0x818f('0x1')]},'token':{'type':Sequelize[_0x818f('0x1')]},'tokenSecret':{'type':Sequelize[_0x818f('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x818f('0x2')]('integrationTab',_0x818f('0x3')),'defaultValue':_0x818f('0x4')}}; \ No newline at end of file +var _0x93a9=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x4f7179,_0x4f8444){var _0xaa2319=function(_0x3b2703){while(--_0x3b2703){_0x4f7179['push'](_0x4f7179['shift']());}};_0xaa2319(++_0x4f8444);}(_0x93a9,0xfb));var _0x993a=function(_0x36f641,_0x1a3063){_0x36f641=_0x36f641-0x0;var _0x39b299=_0x93a9[_0x36f641];return _0x39b299;};'use strict';var Sequelize=require(_0x993a('0x0'));module[_0x993a('0x1')]={'name':{'type':Sequelize[_0x993a('0x2')]},'description':{'type':Sequelize[_0x993a('0x2')]},'username':{'type':Sequelize[_0x993a('0x2')]},'remoteUri':{'type':Sequelize[_0x993a('0x2')]},'authType':{'type':Sequelize[_0x993a('0x3')]('basic'),'defaultValue':_0x993a('0x4')},'password':{'type':Sequelize[_0x993a('0x2')]},'consumerKey':{'type':Sequelize[_0x993a('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x993a('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x993a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x993a('0x3')](_0x993a('0x5'),_0x993a('0x6')),'defaultValue':_0x993a('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index e4890c0..f37c7b7 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 _0x78dc=['consumerKey','consumerSecret','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','then','include','findAll','rows','params','includeAll','find','catch','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','channel','Descriptions','create','DeskField','getFields','priority','authType','username','password'];(function(_0x481604,_0x276ff8){var _0x1ca4ed=function(_0x136e9d){while(--_0x136e9d){_0x481604['push'](_0x481604['shift']());}};_0x1ca4ed(++_0x276ff8);}(_0x78dc,0x92));var _0xc78d=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x78dc[_0x49c057];return _0xd8f0e6;};'use strict';var emlformat=require(_0xc78d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc78d('0x1'));var jsonpatch=require(_0xc78d('0x2'));var rp=require(_0xc78d('0x3'));var moment=require(_0xc78d('0x4'));var BPromise=require(_0xc78d('0x5'));var Mustache=require(_0xc78d('0x6'));var util=require(_0xc78d('0x7'));var path=require(_0xc78d('0x8'));var sox=require('sox');var csv=require(_0xc78d('0x9'));var ejs=require(_0xc78d('0xa'));var fs=require('fs');var fs_extra=require(_0xc78d('0xb'));var _=require(_0xc78d('0xc'));var squel=require(_0xc78d('0xd'));var crypto=require(_0xc78d('0xe'));var jsforce=require(_0xc78d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc78d('0x9'));var querystring=require(_0xc78d('0x10'));var Papa=require(_0xc78d('0x11'));var Redis=require(_0xc78d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc78d('0x13'));var hardwareService=require(_0xc78d('0x14'));var logger=require('../../config/logger')(_0xc78d('0x15'));var utils=require(_0xc78d('0x16'));var config=require(_0xc78d('0x17'));var licenseUtil=require(_0xc78d('0x18'));var db=require(_0xc78d('0x19'))['db'];var integrations=require(_0xc78d('0x1a'));function respondWithStatusCode(_0x1a327e,_0x44567f){_0x44567f=_0x44567f||0xcc;return function(_0x23cca6){if(_0x23cca6){return _0x1a327e['sendStatus'](_0x44567f);}return _0x1a327e[_0xc78d('0x1b')](_0x44567f)[_0xc78d('0x1c')]();};}function respondWithResult(_0x3613cb,_0x4355e6){_0x4355e6=_0x4355e6||0xc8;return function(_0x1b55ca){if(_0x1b55ca){return _0x3613cb['status'](_0x4355e6)[_0xc78d('0x1d')](_0x1b55ca);}};}function respondWithFilteredResult(_0x44bc8f,_0x3d6b60){return function(_0x120e36){if(_0x120e36){var _0x1a46db=typeof _0x3d6b60[_0xc78d('0x1e')]==='undefined'&&typeof _0x3d6b60[_0xc78d('0x1f')]===_0xc78d('0x20');var _0x45b6e7=_0x120e36[_0xc78d('0x21')];var _0x13e28a=_0x1a46db?0x0:_0x3d6b60['offset'];var _0x1eb33b=_0x1a46db?_0x120e36[_0xc78d('0x21')]:_0x3d6b60[_0xc78d('0x1e')]+_0x3d6b60['limit'];var _0x3be25a;if(_0x1eb33b>=_0x45b6e7){_0x1eb33b=_0x45b6e7;_0x3be25a=0xc8;}else{_0x3be25a=0xce;}_0x44bc8f[_0xc78d('0x1b')](_0x3be25a);return _0x44bc8f[_0xc78d('0x22')](_0xc78d('0x23'),_0x13e28a+'-'+_0x1eb33b+'/'+_0x45b6e7)[_0xc78d('0x1d')](_0x120e36);}return null;};}function patchUpdates(_0x15e4c7){return function(_0x37af48){try{jsonpatch[_0xc78d('0x24')](_0x37af48,_0x15e4c7,!![]);}catch(_0x237654){return BPromise[_0xc78d('0x25')](_0x237654);}return _0x37af48[_0xc78d('0x26')]();};}function saveUpdates(_0xb909c3,_0x3b2f1b){return function(_0x4da025){if(_0x4da025){return _0x4da025[_0xc78d('0x27')](_0xb909c3)['then'](function(_0xccbd81){return _0xccbd81;});}return null;};}function removeEntity(_0x3ffb39,_0x1ab4b3){return function(_0x567866){if(_0x567866){return _0x567866[_0xc78d('0x28')]()['then'](function(){_0x3ffb39['status'](0xcc)[_0xc78d('0x1c')]();});}};}function handleEntityNotFound(_0xce3c5a,_0x4c234d){return function(_0x252645){if(!_0x252645){_0xce3c5a['sendStatus'](0x194);}return _0x252645;};}function handleError(_0x2d5ef8,_0xe631a3){_0xe631a3=_0xe631a3||0x1f4;return function(_0x56aed8){logger['error'](_0x56aed8[_0xc78d('0x29')]);if(_0x56aed8[_0xc78d('0x2a')]){delete _0x56aed8[_0xc78d('0x2a')];}_0x2d5ef8[_0xc78d('0x1b')](_0xe631a3)[_0xc78d('0x2b')](_0x56aed8);};}exports[_0xc78d('0x2c')]=function(_0x893a86,_0x40f4ec){var _0x3ff6fe={},_0x1fc64c={},_0x5036b6={'count':0x0,'rows':[]};var _0x2cd230=_[_0xc78d('0x2d')](db[_0xc78d('0x2e')][_0xc78d('0x2f')],function(_0x415bb1){return{'name':_0x415bb1['fieldName'],'type':_0x415bb1[_0xc78d('0x30')][_0xc78d('0x31')]};});_0x1fc64c['model']=_[_0xc78d('0x2d')](_0x2cd230,_0xc78d('0x2a'));_0x1fc64c[_0xc78d('0x32')]=_[_0xc78d('0x33')](_0x893a86[_0xc78d('0x32')]);_0x1fc64c['filters']=_['intersection'](_0x1fc64c[_0xc78d('0x34')],_0x1fc64c[_0xc78d('0x32')]);_0x3ff6fe[_0xc78d('0x35')]=_[_0xc78d('0x36')](_0x1fc64c['model'],qs['fields'](_0x893a86[_0xc78d('0x32')][_0xc78d('0x37')]));_0x3ff6fe[_0xc78d('0x35')]=_0x3ff6fe[_0xc78d('0x35')][_0xc78d('0x38')]?_0x3ff6fe[_0xc78d('0x35')]:_0x1fc64c['model'];if(!_0x893a86[_0xc78d('0x32')][_0xc78d('0x39')](_0xc78d('0x3a'))){_0x3ff6fe[_0xc78d('0x1f')]=qs['limit'](_0x893a86[_0xc78d('0x32')]['limit']);_0x3ff6fe[_0xc78d('0x1e')]=qs[_0xc78d('0x1e')](_0x893a86['query']['offset']);}_0x3ff6fe[_0xc78d('0x3b')]=qs['sort'](_0x893a86['query'][_0xc78d('0x3c')]);_0x3ff6fe['where']=qs[_0xc78d('0x3d')](_['pick'](_0x893a86[_0xc78d('0x32')],_0x1fc64c['filters']),_0x2cd230);if(_0x893a86['query'][_0xc78d('0x3e')]){_0x3ff6fe[_0xc78d('0x3f')]=_[_0xc78d('0x40')](_0x3ff6fe[_0xc78d('0x3f')],{'$or':_[_0xc78d('0x2d')](_0x2cd230,function(_0x6f337e){if(_0x6f337e[_0xc78d('0x30')]!==_0xc78d('0x41')){var _0xd7897={};_0xd7897[_0x6f337e[_0xc78d('0x2a')]]={'$like':'%'+_0x893a86[_0xc78d('0x32')][_0xc78d('0x3e')]+'%'};return _0xd7897;}})});}_0x3ff6fe=_[_0xc78d('0x40')]({},_0x3ff6fe,_0x893a86[_0xc78d('0x42')]);var _0x1f519a={'where':_0x3ff6fe['where']};return db[_0xc78d('0x2e')]['count'](_0x1f519a)[_0xc78d('0x43')](function(_0x3476a3){_0x5036b6[_0xc78d('0x21')]=_0x3476a3;if(_0x893a86[_0xc78d('0x32')]['includeAll']){_0x3ff6fe[_0xc78d('0x44')]=[{'all':!![]}];}return db[_0xc78d('0x2e')][_0xc78d('0x45')](_0x3ff6fe);})['then'](function(_0x3a95ec){_0x5036b6[_0xc78d('0x46')]=_0x3a95ec;return _0x5036b6;})[_0xc78d('0x43')](respondWithFilteredResult(_0x40f4ec,_0x3ff6fe))['catch'](handleError(_0x40f4ec,null));};exports['show']=function(_0x3cc0a2,_0x142c43){var _0x12c23c={'raw':![],'where':{'id':_0x3cc0a2[_0xc78d('0x47')]['id']}},_0x41dd87={};_0x41dd87[_0xc78d('0x34')]=_['keys'](db[_0xc78d('0x2e')][_0xc78d('0x2f')]);_0x41dd87['query']=_[_0xc78d('0x33')](_0x3cc0a2[_0xc78d('0x32')]);_0x41dd87[_0xc78d('0x3d')]=_[_0xc78d('0x36')](_0x41dd87[_0xc78d('0x34')],_0x41dd87[_0xc78d('0x32')]);_0x12c23c[_0xc78d('0x35')]=_[_0xc78d('0x36')](_0x41dd87[_0xc78d('0x34')],qs[_0xc78d('0x37')](_0x3cc0a2[_0xc78d('0x32')]['fields']));_0x12c23c[_0xc78d('0x35')]=_0x12c23c['attributes'][_0xc78d('0x38')]?_0x12c23c[_0xc78d('0x35')]:_0x41dd87[_0xc78d('0x34')];if(_0x3cc0a2[_0xc78d('0x32')][_0xc78d('0x48')]){_0x12c23c[_0xc78d('0x44')]=[{'all':!![]}];}_0x12c23c=_['merge']({},_0x12c23c,_0x3cc0a2['options']);return db['DeskAccount'][_0xc78d('0x49')](_0x12c23c)[_0xc78d('0x43')](handleEntityNotFound(_0x142c43,null))[_0xc78d('0x43')](respondWithResult(_0x142c43,null))[_0xc78d('0x4a')](handleError(_0x142c43,null));};exports['create']=function(_0x44210d,_0x34ecec){return db[_0xc78d('0x2e')]['create'](_0x44210d[_0xc78d('0x4b')],{})[_0xc78d('0x43')](respondWithResult(_0x34ecec,0xc9))['catch'](handleError(_0x34ecec,null));};exports['update']=function(_0x395bd0,_0x1fe84c){if(_0x395bd0[_0xc78d('0x4b')]['id']){delete _0x395bd0['body']['id'];}return db['DeskAccount'][_0xc78d('0x49')]({'where':{'id':_0x395bd0['params']['id']}})[_0xc78d('0x43')](handleEntityNotFound(_0x1fe84c,null))[_0xc78d('0x43')](saveUpdates(_0x395bd0[_0xc78d('0x4b')],null))[_0xc78d('0x43')](respondWithResult(_0x1fe84c,null))[_0xc78d('0x4a')](handleError(_0x1fe84c,null));};exports[_0xc78d('0x28')]=function(_0xbc60f8,_0x85f723){return db[_0xc78d('0x2e')][_0xc78d('0x49')]({'where':{'id':_0xbc60f8[_0xc78d('0x47')]['id']}})[_0xc78d('0x43')](handleEntityNotFound(_0x85f723,null))[_0xc78d('0x43')](removeEntity(_0x85f723,null))[_0xc78d('0x4a')](handleError(_0x85f723,null));};exports[_0xc78d('0x4c')]=function(_0x16b739,_0xfc6f98,_0x211cae){var _0x252db7={};var _0x3a1411={};var _0x177e6e;var _0x5e84a7;return db[_0xc78d('0x2e')][_0xc78d('0x4d')]({'where':{'id':_0x16b739[_0xc78d('0x47')]['id']}})[_0xc78d('0x43')](handleEntityNotFound(_0xfc6f98,null))[_0xc78d('0x43')](function(_0x1b5209){if(_0x1b5209){_0x177e6e=_0x1b5209;_0x3a1411[_0xc78d('0x34')]=_['keys'](db[_0xc78d('0x4e')][_0xc78d('0x2f')]);_0x3a1411[_0xc78d('0x32')]=_['keys'](_0x16b739['query']);_0x3a1411[_0xc78d('0x3d')]=_[_0xc78d('0x36')](_0x3a1411[_0xc78d('0x34')],_0x3a1411[_0xc78d('0x32')]);_0x252db7[_0xc78d('0x35')]=_[_0xc78d('0x36')](_0x3a1411[_0xc78d('0x34')],qs[_0xc78d('0x37')](_0x16b739['query'][_0xc78d('0x37')]));_0x252db7['attributes']=_0x252db7[_0xc78d('0x35')][_0xc78d('0x38')]?_0x252db7[_0xc78d('0x35')]:_0x3a1411[_0xc78d('0x34')];_0x252db7['order']=qs[_0xc78d('0x3c')](_0x16b739[_0xc78d('0x32')]['sort']);_0x252db7[_0xc78d('0x3f')]=qs[_0xc78d('0x3d')](_['pick'](_0x16b739[_0xc78d('0x32')],_0x3a1411[_0xc78d('0x3d')]));if(_0x16b739[_0xc78d('0x32')]['filter']){_0x252db7['where']=_[_0xc78d('0x40')](_0x252db7[_0xc78d('0x3f')],{'$or':_['map'](_0x252db7['attributes'],function(_0x1b3344){var _0x3a6137={};_0x3a6137[_0x1b3344]={'$like':'%'+_0x16b739[_0xc78d('0x32')][_0xc78d('0x3e')]+'%'};return _0x3a6137;})});}_0x252db7=_[_0xc78d('0x40')]({},_0x252db7,_0x16b739[_0xc78d('0x42')]);return _0x177e6e[_0xc78d('0x4c')](_0x252db7);}})[_0xc78d('0x43')](function(_0x393420){if(_0x393420){_0x5e84a7=_0x393420[_0xc78d('0x38')];if(!_0x16b739[_0xc78d('0x32')][_0xc78d('0x39')](_0xc78d('0x3a'))){_0x252db7[_0xc78d('0x1f')]=qs[_0xc78d('0x1f')](_0x16b739['query'][_0xc78d('0x1f')]);_0x252db7[_0xc78d('0x1e')]=qs[_0xc78d('0x1e')](_0x16b739['query'][_0xc78d('0x1e')]);}return _0x177e6e[_0xc78d('0x4c')](_0x252db7);}})['then'](function(_0x48fca9){if(_0x48fca9){return _0x48fca9?{'count':_0x5e84a7,'rows':_0x48fca9}:null;}})[_0xc78d('0x43')](respondWithResult(_0xfc6f98,null))[_0xc78d('0x4a')](handleError(_0xfc6f98,null));};exports[_0xc78d('0x4f')]=function(_0x39e6ab,_0x1ba096,_0x7984c8){if(_0x39e6ab['body']['id']){delete _0x39e6ab[_0xc78d('0x4b')]['id'];}return db[_0xc78d('0x2e')][_0xc78d('0x4d')]({'where':{'id':_0x39e6ab[_0xc78d('0x47')]['id']}})[_0xc78d('0x43')](handleEntityNotFound(_0x1ba096,null))[_0xc78d('0x43')](function(_0x4c23e5){if(_0x4c23e5){_0x39e6ab['body']['AccountId']=_0x4c23e5['id'];_0x39e6ab[_0xc78d('0x4b')][_0xc78d('0x50')]=integrations['getSubjects'](_0x39e6ab[_0xc78d('0x4b')][_0xc78d('0x51')],_0x39e6ab['body']['type']);_0x39e6ab[_0xc78d('0x4b')][_0xc78d('0x52')]=integrations['getDescriptions'](_0x39e6ab[_0xc78d('0x4b')]['channel'],_0x39e6ab[_0xc78d('0x4b')][_0xc78d('0x30')]);return db[_0xc78d('0x4e')][_0xc78d('0x53')](_0x39e6ab['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0xc78d('0x54')],'as':'Descriptions'}]});}return null;})[_0xc78d('0x43')](respondWithResult(_0x1ba096,null))[_0xc78d('0x4a')](handleError(_0x1ba096,null));};exports[_0xc78d('0x55')]=function(_0x43783c,_0xcdc0,_0x2235d9){var _0x17e649=[{'name':'priority','label':_0xc78d('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2f0935='';return db[_0xc78d('0x2e')][_0xc78d('0x4d')]({'where':{'id':_0x43783c[_0xc78d('0x47')]['id']},'attributes':['id','remoteUri',_0xc78d('0x57'),_0xc78d('0x58'),_0xc78d('0x59'),_0xc78d('0x5a'),_0xc78d('0x5b'),'token',_0xc78d('0x5c')]})[_0xc78d('0x43')](handleEntityNotFound(_0xcdc0,null))[_0xc78d('0x43')](function(_0x82c123){if(_0x82c123){_0x2f0935=_0x82c123[_0xc78d('0x5d')];var _0x6fe2e3=_0x2f0935[_0xc78d('0x5e')](-0x1);if(_0x6fe2e3==='/'){_0x2f0935=_0x2f0935[_0xc78d('0x5f')](0x0,_0x2f0935[_0xc78d('0x60')](_0x6fe2e3));}var _0x41ea4a={'method':_0xc78d('0x61'),'uri':util[_0xc78d('0x62')](_0xc78d('0x63'),_0x2f0935),'headers':{'Content-Type':_0xc78d('0x64'),'Accept':'application/json'},'json':!![]};if(_0x82c123[_0xc78d('0x57')]===_0xc78d('0x65')){_0x41ea4a[_0xc78d('0x66')][_0xc78d('0x67')]=util[_0xc78d('0x62')](_0xc78d('0x68'),new Buffer(util[_0xc78d('0x62')]('%s:%s',_0x82c123[_0xc78d('0x58')],_0x82c123[_0xc78d('0x59')]))[_0xc78d('0x69')](_0xc78d('0x6a')));}return rp(_0x41ea4a)[_0xc78d('0x43')](function(_0x2141ca){return _0x17e649[_0xc78d('0x6b')](_['map'](_0x2141ca[_0xc78d('0x6c')][_0xc78d('0x6d')],function(_0x176158){return{'id':_0x176158['name'],'name':_0x176158[_0xc78d('0x2a')],'type':_0x176158[_0xc78d('0x30')],'active':_0x176158[_0xc78d('0x6e')],'label':_0x176158[_0xc78d('0x6f')],'custom':!![]};}));});}})[_0xc78d('0x43')](function(_0x10c8ea){return{'count':_0x10c8ea[_0xc78d('0x38')],'rows':_0x10c8ea};})['then'](respondWithResult(_0xcdc0,null))[_0xc78d('0x4a')](function(_0x40e16b){var _0x36e243=_0x43783c[_0xc78d('0x32')][_0xc78d('0x70')]?0x1f4:_0x40e16b[_0xc78d('0x71')]||0x1f4;logger[_0xc78d('0x72')](_0xc78d('0x73'),_0xc78d('0x55'),_0x36e243,JSON[_0xc78d('0x74')](_0x40e16b));delete _0x40e16b['name'];if(_0x36e243===0x191){_0x36e243=0x190;}_0xcdc0[_0xc78d('0x1b')](_0x36e243)[_0xc78d('0x2b')](_0x43783c[_0xc78d('0x32')][_0xc78d('0x70')]?{'message':_0xc78d('0x75'),'statusCode':_0x40e16b[_0xc78d('0x71')]}:_0x40e16b);});}; \ No newline at end of file +var _0x344f=['show','params','rawAttributes','intersection','includeAll','find','create','body','getConfigurations','findOne','DeskConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','tokenSecret','lastIndexOf','GET','format','application/json','basic','Authorization','Basic\x20%s','username','password','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','DeskAccount','include','findAll','rows','catch'];(function(_0x4b2ece,_0x573128){var _0x3dc94f=function(_0x8ec85f){while(--_0x8ec85f){_0x4b2ece['push'](_0x4b2ece['shift']());}};_0x3dc94f(++_0x573128);}(_0x344f,0x184));var _0xf344=function(_0x552e56,_0x44e760){_0x552e56=_0x552e56-0x0;var _0x559e29=_0x344f[_0x552e56];return _0x559e29;};'use strict';var emlformat=require(_0xf344('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf344('0x1'));var jsonpatch=require(_0xf344('0x2'));var rp=require(_0xf344('0x3'));var moment=require(_0xf344('0x4'));var BPromise=require(_0xf344('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf344('0x6'));var sox=require(_0xf344('0x7'));var csv=require(_0xf344('0x8'));var ejs=require(_0xf344('0x9'));var fs=require('fs');var fs_extra=require(_0xf344('0xa'));var _=require(_0xf344('0xb'));var squel=require(_0xf344('0xc'));var crypto=require(_0xf344('0xd'));var jsforce=require(_0xf344('0xe'));var deskjs=require(_0xf344('0xf'));var toCsv=require(_0xf344('0x8'));var querystring=require(_0xf344('0x10'));var Papa=require(_0xf344('0x11'));var Redis=require('ioredis');var authService=require(_0xf344('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf344('0x13'));var hardwareService=require(_0xf344('0x14'));var logger=require('../../config/logger')(_0xf344('0x15'));var utils=require(_0xf344('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf344('0x17'))['db'];var integrations=require(_0xf344('0x18'));function respondWithStatusCode(_0x5a9464,_0x331d4d){_0x331d4d=_0x331d4d||0xcc;return function(_0x15e6f7){if(_0x15e6f7){return _0x5a9464[_0xf344('0x19')](_0x331d4d);}return _0x5a9464[_0xf344('0x1a')](_0x331d4d)[_0xf344('0x1b')]();};}function respondWithResult(_0x1255ac,_0x1a5dea){_0x1a5dea=_0x1a5dea||0xc8;return function(_0x13dda0){if(_0x13dda0){return _0x1255ac[_0xf344('0x1a')](_0x1a5dea)[_0xf344('0x1c')](_0x13dda0);}};}function respondWithFilteredResult(_0x1ac419,_0x42b328){return function(_0x2372cd){if(_0x2372cd){var _0x2dd37d=typeof _0x42b328['offset']===_0xf344('0x1d')&&typeof _0x42b328[_0xf344('0x1e')]==='undefined';var _0x45bca8=_0x2372cd[_0xf344('0x1f')];var _0x55a2c6=_0x2dd37d?0x0:_0x42b328[_0xf344('0x20')];var _0x574405=_0x2dd37d?_0x2372cd[_0xf344('0x1f')]:_0x42b328[_0xf344('0x20')]+_0x42b328[_0xf344('0x1e')];var _0x5daeb1;if(_0x574405>=_0x45bca8){_0x574405=_0x45bca8;_0x5daeb1=0xc8;}else{_0x5daeb1=0xce;}_0x1ac419[_0xf344('0x1a')](_0x5daeb1);return _0x1ac419[_0xf344('0x21')](_0xf344('0x22'),_0x55a2c6+'-'+_0x574405+'/'+_0x45bca8)[_0xf344('0x1c')](_0x2372cd);}return null;};}function patchUpdates(_0x424d89){return function(_0x20fd2b){try{jsonpatch[_0xf344('0x23')](_0x20fd2b,_0x424d89,!![]);}catch(_0x446c7d){return BPromise['reject'](_0x446c7d);}return _0x20fd2b['save']();};}function saveUpdates(_0x59d366,_0x338da8){return function(_0x15ccae){if(_0x15ccae){return _0x15ccae[_0xf344('0x24')](_0x59d366)[_0xf344('0x25')](function(_0x2ff6d0){return _0x2ff6d0;});}return null;};}function removeEntity(_0x5566a2,_0x262415){return function(_0x484952){if(_0x484952){return _0x484952[_0xf344('0x26')]()[_0xf344('0x25')](function(){_0x5566a2[_0xf344('0x1a')](0xcc)[_0xf344('0x1b')]();});}};}function handleEntityNotFound(_0x40264c,_0xf00a11){return function(_0x3d036c){if(!_0x3d036c){_0x40264c[_0xf344('0x19')](0x194);}return _0x3d036c;};}function handleError(_0x3ccbed,_0x9dc4d5){_0x9dc4d5=_0x9dc4d5||0x1f4;return function(_0xee3e73){logger[_0xf344('0x27')](_0xee3e73[_0xf344('0x28')]);if(_0xee3e73[_0xf344('0x29')]){delete _0xee3e73[_0xf344('0x29')];}_0x3ccbed[_0xf344('0x1a')](_0x9dc4d5)[_0xf344('0x2a')](_0xee3e73);};}exports[_0xf344('0x2b')]=function(_0x4b7d9b,_0x5b284c){var _0x2762d8={},_0x42719a={},_0x4179ef={'count':0x0,'rows':[]};var _0x193038=_[_0xf344('0x2c')](db['DeskAccount']['rawAttributes'],function(_0x3eb4c0){return{'name':_0x3eb4c0[_0xf344('0x2d')],'type':_0x3eb4c0[_0xf344('0x2e')][_0xf344('0x2f')]};});_0x42719a[_0xf344('0x30')]=_[_0xf344('0x2c')](_0x193038,'name');_0x42719a['query']=_[_0xf344('0x31')](_0x4b7d9b[_0xf344('0x32')]);_0x42719a[_0xf344('0x33')]=_['intersection'](_0x42719a[_0xf344('0x30')],_0x42719a[_0xf344('0x32')]);_0x2762d8[_0xf344('0x34')]=_['intersection'](_0x42719a['model'],qs[_0xf344('0x35')](_0x4b7d9b[_0xf344('0x32')][_0xf344('0x35')]));_0x2762d8['attributes']=_0x2762d8['attributes'][_0xf344('0x36')]?_0x2762d8[_0xf344('0x34')]:_0x42719a[_0xf344('0x30')];if(!_0x4b7d9b[_0xf344('0x32')]['hasOwnProperty'](_0xf344('0x37'))){_0x2762d8[_0xf344('0x1e')]=qs[_0xf344('0x1e')](_0x4b7d9b['query'][_0xf344('0x1e')]);_0x2762d8[_0xf344('0x20')]=qs[_0xf344('0x20')](_0x4b7d9b['query'][_0xf344('0x20')]);}_0x2762d8[_0xf344('0x38')]=qs[_0xf344('0x39')](_0x4b7d9b[_0xf344('0x32')]['sort']);_0x2762d8['where']=qs[_0xf344('0x33')](_['pick'](_0x4b7d9b[_0xf344('0x32')],_0x42719a[_0xf344('0x33')]),_0x193038);if(_0x4b7d9b[_0xf344('0x32')]['filter']){_0x2762d8[_0xf344('0x3a')]=_[_0xf344('0x3b')](_0x2762d8['where'],{'$or':_[_0xf344('0x2c')](_0x193038,function(_0x37b3c4){if(_0x37b3c4[_0xf344('0x2e')]!==_0xf344('0x3c')){var _0x3f5b67={};_0x3f5b67[_0x37b3c4[_0xf344('0x29')]]={'$like':'%'+_0x4b7d9b['query'][_0xf344('0x3d')]+'%'};return _0x3f5b67;}})});}_0x2762d8=_[_0xf344('0x3b')]({},_0x2762d8,_0x4b7d9b[_0xf344('0x3e')]);var _0x234a70={'where':_0x2762d8['where']};return db[_0xf344('0x3f')][_0xf344('0x1f')](_0x234a70)['then'](function(_0x384f51){_0x4179ef[_0xf344('0x1f')]=_0x384f51;if(_0x4b7d9b[_0xf344('0x32')]['includeAll']){_0x2762d8[_0xf344('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0xf344('0x41')](_0x2762d8);})[_0xf344('0x25')](function(_0x27588f){_0x4179ef[_0xf344('0x42')]=_0x27588f;return _0x4179ef;})[_0xf344('0x25')](respondWithFilteredResult(_0x5b284c,_0x2762d8))[_0xf344('0x43')](handleError(_0x5b284c,null));};exports[_0xf344('0x44')]=function(_0x2f490e,_0x41abb5){var _0x3c2dba={'raw':![],'where':{'id':_0x2f490e[_0xf344('0x45')]['id']}},_0x6a8258={};_0x6a8258[_0xf344('0x30')]=_['keys'](db['DeskAccount'][_0xf344('0x46')]);_0x6a8258[_0xf344('0x32')]=_[_0xf344('0x31')](_0x2f490e[_0xf344('0x32')]);_0x6a8258['filters']=_['intersection'](_0x6a8258[_0xf344('0x30')],_0x6a8258[_0xf344('0x32')]);_0x3c2dba[_0xf344('0x34')]=_[_0xf344('0x47')](_0x6a8258['model'],qs[_0xf344('0x35')](_0x2f490e[_0xf344('0x32')][_0xf344('0x35')]));_0x3c2dba[_0xf344('0x34')]=_0x3c2dba[_0xf344('0x34')]['length']?_0x3c2dba[_0xf344('0x34')]:_0x6a8258[_0xf344('0x30')];if(_0x2f490e[_0xf344('0x32')][_0xf344('0x48')]){_0x3c2dba[_0xf344('0x40')]=[{'all':!![]}];}_0x3c2dba=_['merge']({},_0x3c2dba,_0x2f490e[_0xf344('0x3e')]);return db[_0xf344('0x3f')][_0xf344('0x49')](_0x3c2dba)['then'](handleEntityNotFound(_0x41abb5,null))[_0xf344('0x25')](respondWithResult(_0x41abb5,null))['catch'](handleError(_0x41abb5,null));};exports['create']=function(_0xe1fb12,_0x51c465){return db[_0xf344('0x3f')][_0xf344('0x4a')](_0xe1fb12['body'],{})[_0xf344('0x25')](respondWithResult(_0x51c465,0xc9))[_0xf344('0x43')](handleError(_0x51c465,null));};exports[_0xf344('0x24')]=function(_0x10b0c6,_0x558a4e){if(_0x10b0c6[_0xf344('0x4b')]['id']){delete _0x10b0c6[_0xf344('0x4b')]['id'];}return db[_0xf344('0x3f')][_0xf344('0x49')]({'where':{'id':_0x10b0c6['params']['id']}})[_0xf344('0x25')](handleEntityNotFound(_0x558a4e,null))[_0xf344('0x25')](saveUpdates(_0x10b0c6['body'],null))[_0xf344('0x25')](respondWithResult(_0x558a4e,null))[_0xf344('0x43')](handleError(_0x558a4e,null));};exports['destroy']=function(_0x1faf5d,_0x171d19){return db[_0xf344('0x3f')][_0xf344('0x49')]({'where':{'id':_0x1faf5d['params']['id']}})[_0xf344('0x25')](handleEntityNotFound(_0x171d19,null))[_0xf344('0x25')](removeEntity(_0x171d19,null))[_0xf344('0x43')](handleError(_0x171d19,null));};exports[_0xf344('0x4c')]=function(_0x5972d6,_0x5796ca,_0x1c10fd){var _0x1e5346={};var _0x549e85={};var _0x3074e1;var _0x39975b;return db[_0xf344('0x3f')][_0xf344('0x4d')]({'where':{'id':_0x5972d6[_0xf344('0x45')]['id']}})['then'](handleEntityNotFound(_0x5796ca,null))[_0xf344('0x25')](function(_0x4a53b8){if(_0x4a53b8){_0x3074e1=_0x4a53b8;_0x549e85['model']=_[_0xf344('0x31')](db[_0xf344('0x4e')]['rawAttributes']);_0x549e85[_0xf344('0x32')]=_['keys'](_0x5972d6[_0xf344('0x32')]);_0x549e85[_0xf344('0x33')]=_[_0xf344('0x47')](_0x549e85[_0xf344('0x30')],_0x549e85[_0xf344('0x32')]);_0x1e5346[_0xf344('0x34')]=_['intersection'](_0x549e85[_0xf344('0x30')],qs[_0xf344('0x35')](_0x5972d6[_0xf344('0x32')][_0xf344('0x35')]));_0x1e5346[_0xf344('0x34')]=_0x1e5346[_0xf344('0x34')][_0xf344('0x36')]?_0x1e5346[_0xf344('0x34')]:_0x549e85['model'];_0x1e5346['order']=qs[_0xf344('0x39')](_0x5972d6[_0xf344('0x32')][_0xf344('0x39')]);_0x1e5346[_0xf344('0x3a')]=qs['filters'](_[_0xf344('0x4f')](_0x5972d6['query'],_0x549e85['filters']));if(_0x5972d6[_0xf344('0x32')]['filter']){_0x1e5346['where']=_[_0xf344('0x3b')](_0x1e5346[_0xf344('0x3a')],{'$or':_[_0xf344('0x2c')](_0x1e5346[_0xf344('0x34')],function(_0xf16b61){var _0x21c626={};_0x21c626[_0xf16b61]={'$like':'%'+_0x5972d6[_0xf344('0x32')][_0xf344('0x3d')]+'%'};return _0x21c626;})});}_0x1e5346=_[_0xf344('0x3b')]({},_0x1e5346,_0x5972d6['options']);return _0x3074e1['getConfigurations'](_0x1e5346);}})['then'](function(_0x370769){if(_0x370769){_0x39975b=_0x370769[_0xf344('0x36')];if(!_0x5972d6[_0xf344('0x32')][_0xf344('0x50')](_0xf344('0x37'))){_0x1e5346['limit']=qs[_0xf344('0x1e')](_0x5972d6['query'][_0xf344('0x1e')]);_0x1e5346['offset']=qs[_0xf344('0x20')](_0x5972d6[_0xf344('0x32')][_0xf344('0x20')]);}return _0x3074e1[_0xf344('0x4c')](_0x1e5346);}})['then'](function(_0x7ec17d){if(_0x7ec17d){return _0x7ec17d?{'count':_0x39975b,'rows':_0x7ec17d}:null;}})[_0xf344('0x25')](respondWithResult(_0x5796ca,null))[_0xf344('0x43')](handleError(_0x5796ca,null));};exports[_0xf344('0x51')]=function(_0xbfc0ec,_0x583709,_0x5da1bb){if(_0xbfc0ec[_0xf344('0x4b')]['id']){delete _0xbfc0ec[_0xf344('0x4b')]['id'];}return db[_0xf344('0x3f')]['findOne']({'where':{'id':_0xbfc0ec[_0xf344('0x45')]['id']}})['then'](handleEntityNotFound(_0x583709,null))[_0xf344('0x25')](function(_0x21d63a){if(_0x21d63a){_0xbfc0ec[_0xf344('0x4b')][_0xf344('0x52')]=_0x21d63a['id'];_0xbfc0ec[_0xf344('0x4b')][_0xf344('0x53')]=integrations['getSubjects'](_0xbfc0ec[_0xf344('0x4b')][_0xf344('0x54')],_0xbfc0ec['body'][_0xf344('0x2e')]);_0xbfc0ec['body'][_0xf344('0x55')]=integrations[_0xf344('0x56')](_0xbfc0ec['body'][_0xf344('0x54')],_0xbfc0ec[_0xf344('0x4b')]['type']);return db[_0xf344('0x4e')][_0xf344('0x4a')](_0xbfc0ec[_0xf344('0x4b')],{'include':[{'model':db[_0xf344('0x57')],'as':_0xf344('0x53')},{'model':db[_0xf344('0x57')],'as':'Descriptions'}]});}return null;})[_0xf344('0x25')](respondWithResult(_0x583709,null))[_0xf344('0x43')](handleError(_0x583709,null));};exports[_0xf344('0x58')]=function(_0x1f7f22,_0x33a9a6,_0x556c32){var _0x33b0a9=[{'name':_0xf344('0x59'),'label':_0xf344('0x59'),'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 _0x170128='';return db[_0xf344('0x3f')][_0xf344('0x4d')]({'where':{'id':_0x1f7f22[_0xf344('0x45')]['id']},'attributes':['id',_0xf344('0x5a'),_0xf344('0x5b'),'username','password',_0xf344('0x5c'),_0xf344('0x5d'),'token',_0xf344('0x5e')]})[_0xf344('0x25')](handleEntityNotFound(_0x33a9a6,null))[_0xf344('0x25')](function(_0x288824){if(_0x288824){_0x170128=_0x288824[_0xf344('0x5a')];var _0x24f5d8=_0x170128['slice'](-0x1);if(_0x24f5d8==='/'){_0x170128=_0x170128['substring'](0x0,_0x170128[_0xf344('0x5f')](_0x24f5d8));}var _0x44ff24={'method':_0xf344('0x60'),'uri':util[_0xf344('0x61')]('%s/custom_fields',_0x170128),'headers':{'Content-Type':_0xf344('0x62'),'Accept':_0xf344('0x62')},'json':!![]};if(_0x288824['authType']===_0xf344('0x63')){_0x44ff24['headers'][_0xf344('0x64')]=util[_0xf344('0x61')](_0xf344('0x65'),new Buffer(util[_0xf344('0x61')]('%s:%s',_0x288824[_0xf344('0x66')],_0x288824[_0xf344('0x67')]))[_0xf344('0x68')](_0xf344('0x69')));}return rp(_0x44ff24)[_0xf344('0x25')](function(_0x51cf2f){return _0x33b0a9['concat'](_['map'](_0x51cf2f[_0xf344('0x6a')][_0xf344('0x6b')],function(_0x1c1cee){return{'id':_0x1c1cee['name'],'name':_0x1c1cee['name'],'type':_0x1c1cee[_0xf344('0x2e')],'active':_0x1c1cee[_0xf344('0x6c')],'label':_0x1c1cee[_0xf344('0x6d')],'custom':!![]};}));});}})['then'](function(_0x2ec1fa){return{'count':_0x2ec1fa['length'],'rows':_0x2ec1fa};})[_0xf344('0x25')](respondWithResult(_0x33a9a6,null))[_0xf344('0x43')](function(_0x5927aa){var _0x44a511=_0x1f7f22['query'][_0xf344('0x6e')]?0x1f4:_0x5927aa[_0xf344('0x6f')]||0x1f4;logger[_0xf344('0x27')](_0xf344('0x70'),_0xf344('0x58'),_0x44a511,JSON['stringify'](_0x5927aa));delete _0x5927aa['name'];if(_0x44a511===0x191){_0x44a511=0x190;}_0x33a9a6[_0xf344('0x1a')](_0x44a511)[_0xf344('0x2a')](_0x1f7f22['query'][_0xf344('0x6e')]?{'message':_0xf344('0x71'),'statusCode':_0x5927aa[_0xf344('0x6f')]}:_0x5927aa);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9c5587c..cd898a8 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 _0x04e7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','util','../../config/logger'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x04e7,0x172));var _0x704e=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0x04e7[_0x26efac];return _0x8482e4;};'use strict';var _=require('lodash');var util=require(_0x704e('0x0'));var logger=require(_0x704e('0x1'))('api');var moment=require(_0x704e('0x2'));var BPromise=require(_0x704e('0x3'));var rp=require(_0x704e('0x4'));var fs=require('fs');var path=require(_0x704e('0x5'));var rimraf=require(_0x704e('0x6'));var config=require(_0x704e('0x7'));var attributes=require(_0x704e('0x8'));var integrations=require(_0x704e('0x9'));module['exports']=function(_0x554b3b,_0x16904f){return _0x554b3b[_0x704e('0xa')](_0x704e('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ef5=['moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','int_desk_accounts','lodash','../../config/logger','api'];(function(_0x589459,_0x531069){var _0x3a468b=function(_0x2be6aa){while(--_0x2be6aa){_0x589459['push'](_0x589459['shift']());}};_0x3a468b(++_0x531069);}(_0x7ef5,0xc5));var _0x57ef=function(_0x32a201,_0x1bcdaa){_0x32a201=_0x32a201-0x0;var _0x4aa6bd=_0x7ef5[_0x32a201];return _0x4aa6bd;};'use strict';var _=require(_0x57ef('0x0'));var util=require('util');var logger=require(_0x57ef('0x1'))(_0x57ef('0x2'));var moment=require(_0x57ef('0x3'));var BPromise=require(_0x57ef('0x4'));var rp=require(_0x57ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57ef('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x57ef('0x7'));module[_0x57ef('0x8')]=function(_0x35d5b6,_0x37993c){return _0x35d5b6['define']('DeskAccount',attributes,{'tableName':_0x57ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 2db1ea9..7405cc9 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 _0x45f3=['request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','GetDeskAccount','stringify','catch','ShowDeskAccount','find','where','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5df67d,_0x7f71cf){var _0x1f0c73=function(_0xf21942){while(--_0xf21942){_0x5df67d['push'](_0x5df67d['shift']());}};_0x1f0c73(++_0x7f71cf);}(_0x45f3,0x166));var _0x345f=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x45f3[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require('lodash');var util=require(_0x345f('0x0'));var moment=require(_0x345f('0x1'));var BPromise=require(_0x345f('0x2'));var rs=require(_0x345f('0x3'));var fs=require('fs');var Redis=require(_0x345f('0x4'));var db=require(_0x345f('0x5'))['db'];var utils=require(_0x345f('0x6'));var logger=require(_0x345f('0x7'))(_0x345f('0x8'));var config=require(_0x345f('0x9'));var jayson=require(_0x345f('0xa'));var client=jayson['client'][_0x345f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c031d,_0x15bb18,_0x4d3e7f){return new BPromise(function(_0x35f20f,_0x2926ce){return client[_0x345f('0xc')](_0x5c031d,_0x4d3e7f)[_0x345f('0xd')](function(_0x1b6352){logger[_0x345f('0xe')](_0x345f('0xf'),_0x15bb18,'request\x20sent');logger['debug'](_0x345f('0x10'),_0x15bb18,_0x345f('0x11'),JSON['stringify'](_0x1b6352));if(_0x1b6352[_0x345f('0x12')]){if(_0x1b6352['error']['code']===0x1f4){logger[_0x345f('0x12')](_0x345f('0xf'),_0x15bb18,_0x1b6352[_0x345f('0x12')][_0x345f('0x13')]);return _0x2926ce(_0x1b6352['error'][_0x345f('0x13')]);}logger[_0x345f('0x12')](_0x345f('0xf'),_0x15bb18,_0x1b6352[_0x345f('0x12')][_0x345f('0x13')]);return _0x35f20f(_0x1b6352[_0x345f('0x12')][_0x345f('0x13')]);}else{logger[_0x345f('0xe')](_0x345f('0xf'),_0x15bb18,'request\x20sent');_0x35f20f(_0x1b6352[_0x345f('0x14')][_0x345f('0x13')]);}})['catch'](function(_0x29e899){logger[_0x345f('0x12')](_0x345f('0xf'),_0x15bb18,_0x29e899);_0x2926ce(_0x29e899);});});}exports['GetDeskAccount']=function(_0x1783c1){var _0x31dbb1=this;return new Promise(function(_0x46eece,_0x57c4dd){return db[_0x345f('0x15')][_0x345f('0x16')]({'raw':_0x1783c1[_0x345f('0x17')]?_0x1783c1[_0x345f('0x17')][_0x345f('0x18')]===undefined?!![]:![]:!![],'where':_0x1783c1[_0x345f('0x17')]?_0x1783c1[_0x345f('0x17')]['where']||null:null,'attributes':_0x1783c1[_0x345f('0x17')]?_0x1783c1[_0x345f('0x17')][_0x345f('0x19')]||null:null,'limit':_0x1783c1[_0x345f('0x17')]?_0x1783c1[_0x345f('0x17')][_0x345f('0x1a')]||null:null,'include':_0x1783c1[_0x345f('0x17')]?_0x1783c1[_0x345f('0x17')][_0x345f('0x1b')]?_[_0x345f('0x1c')](_0x1783c1[_0x345f('0x17')]['include'],function(_0xa51e29){return{'model':db[_0xa51e29[_0x345f('0x1d')]],'as':_0xa51e29['as'],'attributes':_0xa51e29[_0x345f('0x19')],'include':_0xa51e29[_0x345f('0x1b')]?_[_0x345f('0x1c')](_0xa51e29[_0x345f('0x1b')],function(_0x36bfcd){return{'model':db[_0x36bfcd[_0x345f('0x1d')]],'as':_0x36bfcd['as'],'attributes':_0x36bfcd['attributes'],'include':_0x36bfcd[_0x345f('0x1b')]?_[_0x345f('0x1c')](_0x36bfcd[_0x345f('0x1b')],function(_0x30062c){return{'model':db[_0x30062c[_0x345f('0x1d')]],'as':_0x30062c['as'],'attributes':_0x30062c['attributes']};}):[]};}):[]};}):[]:[]})[_0x345f('0xd')](function(_0x532e6c){logger['info'](_0x345f('0x1e'),_0x1783c1);logger['debug'](_0x345f('0x1e'),_0x1783c1,JSON[_0x345f('0x1f')](_0x532e6c));_0x46eece(_0x532e6c);})[_0x345f('0x20')](function(_0x2791f2){logger[_0x345f('0x12')](_0x345f('0x1e'),_0x2791f2[_0x345f('0x13')],_0x1783c1);_0x57c4dd(_0x31dbb1[_0x345f('0x12')](0x1f4,_0x2791f2['message']));});});};exports[_0x345f('0x21')]=function(_0x218d1b){var _0xbab751=this;return new Promise(function(_0x2a169e,_0x8890e1){return db[_0x345f('0x15')][_0x345f('0x22')]({'raw':_0x218d1b['options']?_0x218d1b[_0x345f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x218d1b[_0x345f('0x17')]?_0x218d1b['options'][_0x345f('0x23')]||null:null,'attributes':_0x218d1b[_0x345f('0x17')]?_0x218d1b[_0x345f('0x17')][_0x345f('0x19')]||null:null,'include':_0x218d1b[_0x345f('0x17')]?_0x218d1b[_0x345f('0x17')][_0x345f('0x1b')]?_['map'](_0x218d1b[_0x345f('0x17')][_0x345f('0x1b')],function(_0x26abf6){return{'model':db[_0x26abf6[_0x345f('0x1d')]],'as':_0x26abf6['as'],'attributes':_0x26abf6['attributes'],'include':_0x26abf6[_0x345f('0x1b')]?_[_0x345f('0x1c')](_0x26abf6[_0x345f('0x1b')],function(_0x364344){return{'model':db[_0x364344[_0x345f('0x1d')]],'as':_0x364344['as'],'attributes':_0x364344[_0x345f('0x19')],'include':_0x364344['include']?_['map'](_0x364344[_0x345f('0x1b')],function(_0x2246b6){return{'model':db[_0x2246b6[_0x345f('0x1d')]],'as':_0x2246b6['as'],'attributes':_0x2246b6[_0x345f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x345f('0xd')](function(_0x42b486){logger[_0x345f('0xe')](_0x345f('0x21'),_0x218d1b);logger[_0x345f('0x24')](_0x345f('0x21'),_0x218d1b,JSON[_0x345f('0x1f')](_0x42b486));_0x2a169e(_0x42b486);})['catch'](function(_0x4b905b){logger[_0x345f('0x12')](_0x345f('0x21'),_0x4b905b[_0x345f('0x13')],_0x218d1b);_0x8890e1(_0xbab751[_0x345f('0x12')](0x1f4,_0x4b905b[_0x345f('0x13')]));});});}; \ No newline at end of file +var _0x3b68=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','DeskAccount','findAll','options','raw','where','include','map','model','attributes','then','GetDeskAccount','ShowDeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s'];(function(_0x55e08c,_0x298377){var _0x29c691=function(_0x30851b){while(--_0x30851b){_0x55e08c['push'](_0x55e08c['shift']());}};_0x29c691(++_0x298377);}(_0x3b68,0x84));var _0x83b6=function(_0x461395,_0x4baad3){_0x461395=_0x461395-0x0;var _0x41a6f9=_0x3b68[_0x461395];return _0x41a6f9;};'use strict';var _=require(_0x83b6('0x0'));var util=require(_0x83b6('0x1'));var moment=require('moment');var BPromise=require(_0x83b6('0x2'));var rs=require(_0x83b6('0x3'));var fs=require('fs');var Redis=require(_0x83b6('0x4'));var db=require(_0x83b6('0x5'))['db'];var utils=require(_0x83b6('0x6'));var logger=require(_0x83b6('0x7'))(_0x83b6('0x8'));var config=require(_0x83b6('0x9'));var jayson=require(_0x83b6('0xa'));var client=jayson[_0x83b6('0xb')][_0x83b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x261b4c,_0x427317,_0x57d20e){return new BPromise(function(_0x4ed16c,_0x1b21fa){return client[_0x83b6('0xd')](_0x261b4c,_0x57d20e)['then'](function(_0x15f631){logger[_0x83b6('0xe')](_0x83b6('0xf'),_0x427317,_0x83b6('0x10'));logger[_0x83b6('0x11')](_0x83b6('0x12'),_0x427317,_0x83b6('0x10'),JSON[_0x83b6('0x13')](_0x15f631));if(_0x15f631[_0x83b6('0x14')]){if(_0x15f631[_0x83b6('0x14')]['code']===0x1f4){logger[_0x83b6('0x14')](_0x83b6('0xf'),_0x427317,_0x15f631['error']['message']);return _0x1b21fa(_0x15f631[_0x83b6('0x14')]['message']);}logger[_0x83b6('0x14')]('DeskAccount,\x20%s,\x20%s',_0x427317,_0x15f631['error']['message']);return _0x4ed16c(_0x15f631[_0x83b6('0x14')][_0x83b6('0x15')]);}else{logger['info'](_0x83b6('0xf'),_0x427317,_0x83b6('0x10'));_0x4ed16c(_0x15f631[_0x83b6('0x16')][_0x83b6('0x15')]);}})[_0x83b6('0x17')](function(_0x3f7d0c){logger[_0x83b6('0x14')](_0x83b6('0xf'),_0x427317,_0x3f7d0c);_0x1b21fa(_0x3f7d0c);});});}exports['GetDeskAccount']=function(_0x34a8a2){var _0x128ed8=this;return new Promise(function(_0x2fb994,_0x1ca873){return db[_0x83b6('0x18')][_0x83b6('0x19')]({'raw':_0x34a8a2['options']?_0x34a8a2[_0x83b6('0x1a')][_0x83b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x34a8a2[_0x83b6('0x1a')]?_0x34a8a2['options'][_0x83b6('0x1c')]||null:null,'attributes':_0x34a8a2['options']?_0x34a8a2['options']['attributes']||null:null,'limit':_0x34a8a2['options']?_0x34a8a2[_0x83b6('0x1a')]['limit']||null:null,'include':_0x34a8a2[_0x83b6('0x1a')]?_0x34a8a2[_0x83b6('0x1a')][_0x83b6('0x1d')]?_[_0x83b6('0x1e')](_0x34a8a2[_0x83b6('0x1a')][_0x83b6('0x1d')],function(_0x588852){return{'model':db[_0x588852[_0x83b6('0x1f')]],'as':_0x588852['as'],'attributes':_0x588852['attributes'],'include':_0x588852[_0x83b6('0x1d')]?_['map'](_0x588852[_0x83b6('0x1d')],function(_0x17e65b){return{'model':db[_0x17e65b[_0x83b6('0x1f')]],'as':_0x17e65b['as'],'attributes':_0x17e65b['attributes'],'include':_0x17e65b['include']?_[_0x83b6('0x1e')](_0x17e65b[_0x83b6('0x1d')],function(_0x315986){return{'model':db[_0x315986[_0x83b6('0x1f')]],'as':_0x315986['as'],'attributes':_0x315986[_0x83b6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x83b6('0x21')](function(_0x2c1286){logger[_0x83b6('0xe')](_0x83b6('0x22'),_0x34a8a2);logger[_0x83b6('0x11')](_0x83b6('0x22'),_0x34a8a2,JSON[_0x83b6('0x13')](_0x2c1286));_0x2fb994(_0x2c1286);})['catch'](function(_0x36f4ef){logger[_0x83b6('0x14')](_0x83b6('0x22'),_0x36f4ef[_0x83b6('0x15')],_0x34a8a2);_0x1ca873(_0x128ed8['error'](0x1f4,_0x36f4ef[_0x83b6('0x15')]));});});};exports[_0x83b6('0x23')]=function(_0x459f72){var _0x51d4d5=this;return new Promise(function(_0x9d094b,_0x17faaa){return db[_0x83b6('0x18')][_0x83b6('0x24')]({'raw':_0x459f72[_0x83b6('0x1a')]?_0x459f72[_0x83b6('0x1a')][_0x83b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x459f72[_0x83b6('0x1a')]?_0x459f72['options']['where']||null:null,'attributes':_0x459f72[_0x83b6('0x1a')]?_0x459f72[_0x83b6('0x1a')][_0x83b6('0x20')]||null:null,'include':_0x459f72[_0x83b6('0x1a')]?_0x459f72[_0x83b6('0x1a')][_0x83b6('0x1d')]?_[_0x83b6('0x1e')](_0x459f72[_0x83b6('0x1a')]['include'],function(_0x14f107){return{'model':db[_0x14f107['model']],'as':_0x14f107['as'],'attributes':_0x14f107[_0x83b6('0x20')],'include':_0x14f107[_0x83b6('0x1d')]?_['map'](_0x14f107[_0x83b6('0x1d')],function(_0x36479e){return{'model':db[_0x36479e[_0x83b6('0x1f')]],'as':_0x36479e['as'],'attributes':_0x36479e[_0x83b6('0x20')],'include':_0x36479e[_0x83b6('0x1d')]?_[_0x83b6('0x1e')](_0x36479e['include'],function(_0x5a284c){return{'model':db[_0x5a284c[_0x83b6('0x1f')]],'as':_0x5a284c['as'],'attributes':_0x5a284c[_0x83b6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x83b6('0x21')](function(_0x4eaa2a){logger[_0x83b6('0xe')](_0x83b6('0x23'),_0x459f72);logger['debug'](_0x83b6('0x23'),_0x459f72,JSON[_0x83b6('0x13')](_0x4eaa2a));_0x9d094b(_0x4eaa2a);})[_0x83b6('0x17')](function(_0x12d163){logger['error'](_0x83b6('0x23'),_0x12d163['message'],_0x459f72);_0x17faaa(_0x51d4d5[_0x83b6('0x14')](0x1f4,_0x12d163[_0x83b6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 98a7c76..8e5332b 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(_0x3ce92d,_0x6ecd66){var _0x4982d2=function(_0x1a40bc){while(--_0x1a40bc){_0x3ce92d['push'](_0x3ce92d['shift']());}};_0x4982d2(++_0x6ecd66);}(_0x34e8,0x12c));var _0x834e=function(_0x3a1ddb,_0x2bacbc){_0x3a1ddb=_0x3a1ddb-0x0;var _0x18222c=_0x34e8[_0x3a1ddb];return _0x18222c;};'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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x2b7a89,_0x16d9f8){var _0x1d580b=function(_0x53199b){while(--_0x53199b){_0x2b7a89['push'](_0x2b7a89['shift']());}};_0x1d580b(++_0x16d9f8);}(_0x7217,0x19e));var _0x7721=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x7217[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index ad96558..620b44f 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 _0x0b85=['STRING','exports'];(function(_0xdba10e,_0x5495db){var _0x5a0a5c=function(_0x32392f){while(--_0x32392f){_0xdba10e['push'](_0xdba10e['shift']());}};_0x5a0a5c(++_0x5495db);}(_0x0b85,0xa7));var _0x50b8=function(_0xc48e15,_0x44a57e){_0xc48e15=_0xc48e15-0x0;var _0x29ccb7=_0x0b85[_0xc48e15];return _0x29ccb7;};'use strict';var Sequelize=require('sequelize');module[_0x50b8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x50b8('0x1')]}}; \ No newline at end of file +var _0x8a99=['sequelize','exports','STRING'];(function(_0x470c7e,_0x10118f){var _0x308623=function(_0x571dfa){while(--_0x571dfa){_0x470c7e['push'](_0x470c7e['shift']());}};_0x308623(++_0x10118f);}(_0x8a99,0x9c));var _0x98a9=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x8a99[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require(_0x98a9('0x0'));module[_0x98a9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x98a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f2cb848..77ac48e 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 _0x43ca=['sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','keys','includeAll','find','create','body','params','getFields','findOne','DeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x291b78,_0x4e1fac){var _0x7fd41c=function(_0x4adf29){while(--_0x4adf29){_0x291b78['push'](_0x291b78['shift']());}};_0x7fd41c(++_0x4e1fac);}(_0x43ca,0x1d9));var _0xa43c=function(_0x37594c,_0x250938){_0x37594c=_0x37594c-0x0;var _0xc6c829=_0x43ca[_0x37594c];return _0xc6c829;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa43c('0x0'));var zipdir=require(_0xa43c('0x1'));var jsonpatch=require(_0xa43c('0x2'));var rp=require(_0xa43c('0x3'));var moment=require(_0xa43c('0x4'));var BPromise=require(_0xa43c('0x5'));var Mustache=require(_0xa43c('0x6'));var util=require(_0xa43c('0x7'));var path=require(_0xa43c('0x8'));var sox=require(_0xa43c('0x9'));var csv=require(_0xa43c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa43c('0xb'));var _=require(_0xa43c('0xc'));var squel=require(_0xa43c('0xd'));var crypto=require(_0xa43c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa43c('0xf'));var toCsv=require(_0xa43c('0xa'));var querystring=require(_0xa43c('0x10'));var Papa=require(_0xa43c('0x11'));var Redis=require('ioredis');var authService=require(_0xa43c('0x12'));var qs=require(_0xa43c('0x13'));var as=require(_0xa43c('0x14'));var hardwareService=require(_0xa43c('0x15'));var logger=require(_0xa43c('0x16'))(_0xa43c('0x17'));var utils=require(_0xa43c('0x18'));var config=require(_0xa43c('0x19'));var licenseUtil=require(_0xa43c('0x1a'));var db=require(_0xa43c('0x1b'))['db'];function respondWithStatusCode(_0x549302,_0x3529f8){_0x3529f8=_0x3529f8||0xcc;return function(_0x24f027){if(_0x24f027){return _0x549302[_0xa43c('0x1c')](_0x3529f8);}return _0x549302['status'](_0x3529f8)[_0xa43c('0x1d')]();};}function respondWithResult(_0x2d4263,_0x27f4be){_0x27f4be=_0x27f4be||0xc8;return function(_0x51115a){if(_0x51115a){return _0x2d4263[_0xa43c('0x1e')](_0x27f4be)['json'](_0x51115a);}};}function respondWithFilteredResult(_0x93b2ce,_0x40663d){return function(_0x3fc817){if(_0x3fc817){var _0x52d966=typeof _0x40663d[_0xa43c('0x1f')]===_0xa43c('0x20')&&typeof _0x40663d[_0xa43c('0x21')]===_0xa43c('0x20');var _0x2f5372=_0x3fc817['count'];var _0x236d0e=_0x52d966?0x0:_0x40663d[_0xa43c('0x1f')];var _0x38d2e7=_0x52d966?_0x3fc817[_0xa43c('0x22')]:_0x40663d['offset']+_0x40663d[_0xa43c('0x21')];var _0x1f3df9;if(_0x38d2e7>=_0x2f5372){_0x38d2e7=_0x2f5372;_0x1f3df9=0xc8;}else{_0x1f3df9=0xce;}_0x93b2ce[_0xa43c('0x1e')](_0x1f3df9);return _0x93b2ce['set'](_0xa43c('0x23'),_0x236d0e+'-'+_0x38d2e7+'/'+_0x2f5372)[_0xa43c('0x24')](_0x3fc817);}return null;};}function patchUpdates(_0xac7e51){return function(_0x25e5d8){try{jsonpatch[_0xa43c('0x25')](_0x25e5d8,_0xac7e51,!![]);}catch(_0x4340fa){return BPromise[_0xa43c('0x26')](_0x4340fa);}return _0x25e5d8['save']();};}function saveUpdates(_0x180e6d,_0x4af35d){return function(_0x1f493f){if(_0x1f493f){return _0x1f493f[_0xa43c('0x27')](_0x180e6d)[_0xa43c('0x28')](function(_0x26ddba){return _0x26ddba;});}return null;};}function removeEntity(_0x1ceb50,_0x4e653d){return function(_0x532714){if(_0x532714){return _0x532714[_0xa43c('0x29')]()[_0xa43c('0x28')](function(){_0x1ceb50[_0xa43c('0x1e')](0xcc)[_0xa43c('0x1d')]();});}};}function handleEntityNotFound(_0x1ec3de,_0x2a18e1){return function(_0x48a0eb){if(!_0x48a0eb){_0x1ec3de['sendStatus'](0x194);}return _0x48a0eb;};}function handleError(_0x3de578,_0x264d1d){_0x264d1d=_0x264d1d||0x1f4;return function(_0x593696){logger[_0xa43c('0x2a')](_0x593696[_0xa43c('0x2b')]);if(_0x593696[_0xa43c('0x2c')]){delete _0x593696[_0xa43c('0x2c')];}_0x3de578[_0xa43c('0x1e')](_0x264d1d)[_0xa43c('0x2d')](_0x593696);};}exports[_0xa43c('0x2e')]=function(_0x212a70,_0x605643){var _0x4c52bd={},_0x496553={},_0x4f7679={'count':0x0,'rows':[]};var _0x1708a6=_[_0xa43c('0x2f')](db[_0xa43c('0x30')][_0xa43c('0x31')],function(_0x2ef0b5){return{'name':_0x2ef0b5[_0xa43c('0x32')],'type':_0x2ef0b5[_0xa43c('0x33')][_0xa43c('0x34')]};});_0x496553[_0xa43c('0x35')]=_[_0xa43c('0x2f')](_0x1708a6,'name');_0x496553['query']=_['keys'](_0x212a70[_0xa43c('0x36')]);_0x496553[_0xa43c('0x37')]=_[_0xa43c('0x38')](_0x496553[_0xa43c('0x35')],_0x496553[_0xa43c('0x36')]);_0x4c52bd[_0xa43c('0x39')]=_[_0xa43c('0x38')](_0x496553[_0xa43c('0x35')],qs[_0xa43c('0x3a')](_0x212a70['query']['fields']));_0x4c52bd[_0xa43c('0x39')]=_0x4c52bd[_0xa43c('0x39')][_0xa43c('0x3b')]?_0x4c52bd[_0xa43c('0x39')]:_0x496553[_0xa43c('0x35')];if(!_0x212a70[_0xa43c('0x36')]['hasOwnProperty'](_0xa43c('0x3c'))){_0x4c52bd[_0xa43c('0x21')]=qs[_0xa43c('0x21')](_0x212a70[_0xa43c('0x36')]['limit']);_0x4c52bd[_0xa43c('0x1f')]=qs[_0xa43c('0x1f')](_0x212a70['query']['offset']);}_0x4c52bd['order']=qs['sort'](_0x212a70[_0xa43c('0x36')][_0xa43c('0x3d')]);_0x4c52bd[_0xa43c('0x3e')]=qs[_0xa43c('0x37')](_[_0xa43c('0x3f')](_0x212a70['query'],_0x496553[_0xa43c('0x37')]),_0x1708a6);if(_0x212a70[_0xa43c('0x36')][_0xa43c('0x40')]){_0x4c52bd[_0xa43c('0x3e')]=_['merge'](_0x4c52bd['where'],{'$or':_['map'](_0x1708a6,function(_0x57bcea){if(_0x57bcea[_0xa43c('0x33')]!==_0xa43c('0x41')){var _0x51311b={};_0x51311b[_0x57bcea[_0xa43c('0x2c')]]={'$like':'%'+_0x212a70[_0xa43c('0x36')][_0xa43c('0x40')]+'%'};return _0x51311b;}})});}_0x4c52bd=_[_0xa43c('0x42')]({},_0x4c52bd,_0x212a70[_0xa43c('0x43')]);var _0x42eb3f={'where':_0x4c52bd[_0xa43c('0x3e')]};return db['DeskConfiguration'][_0xa43c('0x22')](_0x42eb3f)[_0xa43c('0x28')](function(_0x2597e7){_0x4f7679[_0xa43c('0x22')]=_0x2597e7;if(_0x212a70['query']['includeAll']){_0x4c52bd[_0xa43c('0x44')]=[{'all':!![]}];}return db[_0xa43c('0x30')]['findAll'](_0x4c52bd);})[_0xa43c('0x28')](function(_0x2133e7){_0x4f7679[_0xa43c('0x45')]=_0x2133e7;return _0x4f7679;})[_0xa43c('0x28')](respondWithFilteredResult(_0x605643,_0x4c52bd))[_0xa43c('0x46')](handleError(_0x605643,null));};exports[_0xa43c('0x47')]=function(_0x40b13f,_0x2978c0){var _0x3bf468={'raw':![],'where':{'id':_0x40b13f['params']['id']}},_0xde0921={};_0xde0921[_0xa43c('0x35')]=_[_0xa43c('0x48')](db[_0xa43c('0x30')]['rawAttributes']);_0xde0921[_0xa43c('0x36')]=_[_0xa43c('0x48')](_0x40b13f[_0xa43c('0x36')]);_0xde0921[_0xa43c('0x37')]=_[_0xa43c('0x38')](_0xde0921[_0xa43c('0x35')],_0xde0921[_0xa43c('0x36')]);_0x3bf468[_0xa43c('0x39')]=_['intersection'](_0xde0921[_0xa43c('0x35')],qs[_0xa43c('0x3a')](_0x40b13f[_0xa43c('0x36')][_0xa43c('0x3a')]));_0x3bf468[_0xa43c('0x39')]=_0x3bf468[_0xa43c('0x39')]['length']?_0x3bf468[_0xa43c('0x39')]:_0xde0921['model'];if(_0x40b13f[_0xa43c('0x36')][_0xa43c('0x49')]){_0x3bf468[_0xa43c('0x44')]=[{'all':!![]}];}_0x3bf468=_['merge']({},_0x3bf468,_0x40b13f[_0xa43c('0x43')]);return db[_0xa43c('0x30')][_0xa43c('0x4a')](_0x3bf468)[_0xa43c('0x28')](handleEntityNotFound(_0x2978c0,null))[_0xa43c('0x28')](respondWithResult(_0x2978c0,null))['catch'](handleError(_0x2978c0,null));};exports[_0xa43c('0x4b')]=function(_0x3a5fe6,_0x43941f){return db[_0xa43c('0x30')][_0xa43c('0x4b')](_0x3a5fe6[_0xa43c('0x4c')],{})[_0xa43c('0x28')](respondWithResult(_0x43941f,0xc9))[_0xa43c('0x46')](handleError(_0x43941f,null));};exports[_0xa43c('0x27')]=function(_0x1f0a0c,_0x2c6ffb){if(_0x1f0a0c['body']['id']){delete _0x1f0a0c[_0xa43c('0x4c')]['id'];}return db[_0xa43c('0x30')][_0xa43c('0x4a')]({'where':{'id':_0x1f0a0c[_0xa43c('0x4d')]['id']}})[_0xa43c('0x28')](handleEntityNotFound(_0x2c6ffb,null))[_0xa43c('0x28')](saveUpdates(_0x1f0a0c[_0xa43c('0x4c')],null))[_0xa43c('0x28')](respondWithResult(_0x2c6ffb,null))['catch'](handleError(_0x2c6ffb,null));};exports[_0xa43c('0x29')]=function(_0x129ff2,_0x34fbac){return db['DeskConfiguration'][_0xa43c('0x4a')]({'where':{'id':_0x129ff2[_0xa43c('0x4d')]['id']}})[_0xa43c('0x28')](handleEntityNotFound(_0x34fbac,null))[_0xa43c('0x28')](removeEntity(_0x34fbac,null))[_0xa43c('0x46')](handleError(_0x34fbac,null));};exports[_0xa43c('0x4e')]=function(_0x3fe5e4,_0x3129f4,_0x56a5ab){var _0x12a6ea={};var _0x5e48f3={};var _0x423ce8;var _0x4cc9de;return db[_0xa43c('0x30')][_0xa43c('0x4f')]({'where':{'id':_0x3fe5e4['params']['id']}})[_0xa43c('0x28')](handleEntityNotFound(_0x3129f4,null))[_0xa43c('0x28')](function(_0x2dc5fa){if(_0x2dc5fa){_0x423ce8=_0x2dc5fa;_0x5e48f3[_0xa43c('0x35')]=_['keys'](db[_0xa43c('0x50')]['rawAttributes']);_0x5e48f3['query']=_[_0xa43c('0x48')](_0x3fe5e4['query']);_0x5e48f3[_0xa43c('0x37')]=_[_0xa43c('0x38')](_0x5e48f3[_0xa43c('0x35')],_0x5e48f3[_0xa43c('0x36')]);_0x12a6ea[_0xa43c('0x39')]=_['intersection'](_0x5e48f3['model'],qs['fields'](_0x3fe5e4['query']['fields']));_0x12a6ea[_0xa43c('0x39')]=_0x12a6ea[_0xa43c('0x39')][_0xa43c('0x3b')]?_0x12a6ea[_0xa43c('0x39')]:_0x5e48f3[_0xa43c('0x35')];_0x12a6ea[_0xa43c('0x51')]=qs[_0xa43c('0x3d')](_0x3fe5e4[_0xa43c('0x36')][_0xa43c('0x3d')]);_0x12a6ea[_0xa43c('0x3e')]=qs['filters'](_['pick'](_0x3fe5e4[_0xa43c('0x36')],_0x5e48f3[_0xa43c('0x37')]));if(_0x3fe5e4[_0xa43c('0x36')][_0xa43c('0x40')]){_0x12a6ea[_0xa43c('0x3e')]=_[_0xa43c('0x42')](_0x12a6ea[_0xa43c('0x3e')],{'$or':_['map'](_0x12a6ea['attributes'],function(_0xb5e014){var _0x53f3c3={};_0x53f3c3[_0xb5e014]={'$like':'%'+_0x3fe5e4[_0xa43c('0x36')]['filter']+'%'};return _0x53f3c3;})});}_0x12a6ea=_['merge']({},_0x12a6ea,_0x3fe5e4[_0xa43c('0x43')]);return _0x423ce8[_0xa43c('0x4e')](_0x12a6ea);}})['then'](function(_0x19d52e){if(_0x19d52e){_0x4cc9de=_0x19d52e[_0xa43c('0x3b')];if(!_0x3fe5e4[_0xa43c('0x36')][_0xa43c('0x52')]('nolimit')){_0x12a6ea[_0xa43c('0x21')]=qs[_0xa43c('0x21')](_0x3fe5e4[_0xa43c('0x36')][_0xa43c('0x21')]);_0x12a6ea[_0xa43c('0x1f')]=qs['offset'](_0x3fe5e4[_0xa43c('0x36')][_0xa43c('0x1f')]);}return _0x423ce8['getFields'](_0x12a6ea);}})[_0xa43c('0x28')](function(_0x340821){if(_0x340821){return _0x340821?{'count':_0x4cc9de,'rows':_0x340821}:null;}})[_0xa43c('0x28')](respondWithResult(_0x3129f4,null))[_0xa43c('0x46')](handleError(_0x3129f4,null));};exports['getSubjects']=function(_0x1b46d2,_0x1adbbb,_0x17c938){var _0x28db5f={};var _0x2a3a06={};var _0x54b971;var _0x397860;return db['DeskConfiguration'][_0xa43c('0x4f')]({'where':{'id':_0x1b46d2[_0xa43c('0x4d')]['id']}})[_0xa43c('0x28')](handleEntityNotFound(_0x1adbbb,null))[_0xa43c('0x28')](function(_0x1f7e0a){if(_0x1f7e0a){_0x54b971=_0x1f7e0a;_0x2a3a06[_0xa43c('0x35')]=_[_0xa43c('0x48')](db['DeskField'][_0xa43c('0x31')]);_0x2a3a06[_0xa43c('0x36')]=_['keys'](_0x1b46d2[_0xa43c('0x36')]);_0x2a3a06[_0xa43c('0x37')]=_['intersection'](_0x2a3a06[_0xa43c('0x35')],_0x2a3a06[_0xa43c('0x36')]);_0x28db5f[_0xa43c('0x39')]=_[_0xa43c('0x38')](_0x2a3a06[_0xa43c('0x35')],qs[_0xa43c('0x3a')](_0x1b46d2[_0xa43c('0x36')]['fields']));_0x28db5f['attributes']=_0x28db5f[_0xa43c('0x39')][_0xa43c('0x3b')]?_0x28db5f[_0xa43c('0x39')]:_0x2a3a06[_0xa43c('0x35')];_0x28db5f[_0xa43c('0x51')]=qs[_0xa43c('0x3d')](_0x1b46d2[_0xa43c('0x36')]['sort']);_0x28db5f[_0xa43c('0x3e')]=qs['filters'](_['pick'](_0x1b46d2[_0xa43c('0x36')],_0x2a3a06['filters']));if(_0x1b46d2[_0xa43c('0x36')][_0xa43c('0x40')]){_0x28db5f[_0xa43c('0x3e')]=_[_0xa43c('0x42')](_0x28db5f[_0xa43c('0x3e')],{'$or':_[_0xa43c('0x2f')](_0x28db5f[_0xa43c('0x39')],function(_0x4094bf){var _0xaeee75={};_0xaeee75[_0x4094bf]={'$like':'%'+_0x1b46d2['query']['filter']+'%'};return _0xaeee75;})});}_0x28db5f=_[_0xa43c('0x42')]({},_0x28db5f,_0x1b46d2[_0xa43c('0x43')]);return _0x54b971[_0xa43c('0x53')](_0x28db5f);}})[_0xa43c('0x28')](function(_0x29ea32){if(_0x29ea32){_0x397860=_0x29ea32[_0xa43c('0x3b')];if(!_0x1b46d2[_0xa43c('0x36')][_0xa43c('0x52')](_0xa43c('0x3c'))){_0x28db5f[_0xa43c('0x21')]=qs[_0xa43c('0x21')](_0x1b46d2[_0xa43c('0x36')]['limit']);_0x28db5f[_0xa43c('0x1f')]=qs[_0xa43c('0x1f')](_0x1b46d2[_0xa43c('0x36')][_0xa43c('0x1f')]);}return _0x54b971[_0xa43c('0x53')](_0x28db5f);}})['then'](function(_0x3f1e99){if(_0x3f1e99){return _0x3f1e99?{'count':_0x397860,'rows':_0x3f1e99}:null;}})['then'](respondWithResult(_0x1adbbb,null))[_0xa43c('0x46')](handleError(_0x1adbbb,null));};exports['getDescriptions']=function(_0x21967e,_0x27da6d,_0x2aa63d){var _0x2ebe0={};var _0xa59323={};var _0x227ea1;var _0x1b7c8b;return db[_0xa43c('0x30')][_0xa43c('0x4f')]({'where':{'id':_0x21967e[_0xa43c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x27da6d,null))[_0xa43c('0x28')](function(_0x451d71){if(_0x451d71){_0x227ea1=_0x451d71;_0xa59323['model']=_[_0xa43c('0x48')](db['DeskField']['rawAttributes']);_0xa59323[_0xa43c('0x36')]=_['keys'](_0x21967e[_0xa43c('0x36')]);_0xa59323['filters']=_['intersection'](_0xa59323[_0xa43c('0x35')],_0xa59323['query']);_0x2ebe0[_0xa43c('0x39')]=_[_0xa43c('0x38')](_0xa59323['model'],qs[_0xa43c('0x3a')](_0x21967e[_0xa43c('0x36')][_0xa43c('0x3a')]));_0x2ebe0[_0xa43c('0x39')]=_0x2ebe0[_0xa43c('0x39')][_0xa43c('0x3b')]?_0x2ebe0[_0xa43c('0x39')]:_0xa59323[_0xa43c('0x35')];_0x2ebe0[_0xa43c('0x51')]=qs[_0xa43c('0x3d')](_0x21967e[_0xa43c('0x36')][_0xa43c('0x3d')]);_0x2ebe0[_0xa43c('0x3e')]=qs[_0xa43c('0x37')](_[_0xa43c('0x3f')](_0x21967e[_0xa43c('0x36')],_0xa59323['filters']));if(_0x21967e['query'][_0xa43c('0x40')]){_0x2ebe0[_0xa43c('0x3e')]=_[_0xa43c('0x42')](_0x2ebe0['where'],{'$or':_[_0xa43c('0x2f')](_0x2ebe0[_0xa43c('0x39')],function(_0x28613c){var _0x3140f7={};_0x3140f7[_0x28613c]={'$like':'%'+_0x21967e[_0xa43c('0x36')][_0xa43c('0x40')]+'%'};return _0x3140f7;})});}_0x2ebe0=_['merge']({},_0x2ebe0,_0x21967e['options']);return _0x227ea1[_0xa43c('0x54')](_0x2ebe0);}})[_0xa43c('0x28')](function(_0x112fc5){if(_0x112fc5){_0x1b7c8b=_0x112fc5[_0xa43c('0x3b')];if(!_0x21967e[_0xa43c('0x36')]['hasOwnProperty'](_0xa43c('0x3c'))){_0x2ebe0['limit']=qs[_0xa43c('0x21')](_0x21967e[_0xa43c('0x36')][_0xa43c('0x21')]);_0x2ebe0[_0xa43c('0x1f')]=qs[_0xa43c('0x1f')](_0x21967e['query']['offset']);}return _0x227ea1['getDescriptions'](_0x2ebe0);}})[_0xa43c('0x28')](function(_0x4903f6){if(_0x4903f6){return _0x4903f6?{'count':_0x1b7c8b,'rows':_0x4903f6}:null;}})[_0xa43c('0x28')](respondWithResult(_0x27da6d,null))[_0xa43c('0x46')](handleError(_0x27da6d,null));};exports[_0xa43c('0x55')]=function(_0x2af701,_0x1c89e2,_0x4e35a8){var _0x10bae6={};var _0x36bccb={};var _0x2a3e3e;var _0x33f945;return db[_0xa43c('0x30')][_0xa43c('0x4f')]({'where':{'id':_0x2af701[_0xa43c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c89e2,null))[_0xa43c('0x28')](function(_0x369d80){if(_0x369d80){_0x2a3e3e=_0x369d80;_0x36bccb['model']=_['keys'](db[_0xa43c('0x56')][_0xa43c('0x31')]);_0x36bccb[_0xa43c('0x36')]=_[_0xa43c('0x48')](_0x2af701[_0xa43c('0x36')]);_0x36bccb[_0xa43c('0x37')]=_[_0xa43c('0x38')](_0x36bccb[_0xa43c('0x35')],_0x36bccb[_0xa43c('0x36')]);_0x10bae6[_0xa43c('0x39')]=_[_0xa43c('0x38')](_0x36bccb['model'],qs[_0xa43c('0x3a')](_0x2af701[_0xa43c('0x36')][_0xa43c('0x3a')]));_0x10bae6['attributes']=_0x10bae6[_0xa43c('0x39')][_0xa43c('0x3b')]?_0x10bae6['attributes']:_0x36bccb[_0xa43c('0x35')];_0x10bae6[_0xa43c('0x51')]=qs[_0xa43c('0x3d')](_0x2af701[_0xa43c('0x36')][_0xa43c('0x3d')]);_0x10bae6[_0xa43c('0x3e')]=qs['filters'](_[_0xa43c('0x3f')](_0x2af701[_0xa43c('0x36')],_0x36bccb[_0xa43c('0x37')]));if(_0x2af701[_0xa43c('0x36')][_0xa43c('0x40')]){_0x10bae6['where']=_[_0xa43c('0x42')](_0x10bae6[_0xa43c('0x3e')],{'$or':_[_0xa43c('0x2f')](_0x10bae6[_0xa43c('0x39')],function(_0x2db82a){var _0x466715={};_0x466715[_0x2db82a]={'$like':'%'+_0x2af701[_0xa43c('0x36')]['filter']+'%'};return _0x466715;})});}_0x10bae6=_[_0xa43c('0x42')]({},_0x10bae6,_0x2af701[_0xa43c('0x43')]);return _0x2a3e3e[_0xa43c('0x55')](_0x10bae6);}})[_0xa43c('0x28')](function(_0x4bd30e){if(_0x4bd30e){_0x33f945=_0x4bd30e[_0xa43c('0x3b')];if(!_0x2af701[_0xa43c('0x36')][_0xa43c('0x52')](_0xa43c('0x3c'))){_0x10bae6[_0xa43c('0x21')]=qs['limit'](_0x2af701[_0xa43c('0x36')]['limit']);_0x10bae6[_0xa43c('0x1f')]=qs[_0xa43c('0x1f')](_0x2af701[_0xa43c('0x36')][_0xa43c('0x1f')]);}return _0x2a3e3e[_0xa43c('0x55')](_0x10bae6);}})['then'](function(_0x403a48){if(_0x403a48){return _0x403a48?{'count':_0x33f945,'rows':_0x403a48}:null;}})[_0xa43c('0x28')](respondWithResult(_0x1c89e2,null))[_0xa43c('0x46')](handleError(_0x1c89e2,null));};exports[_0xa43c('0x57')]=function(_0x462e1e,_0x4283b5,_0x5f48b5){if(_0x462e1e[_0xa43c('0x4c')]['id']){delete _0x462e1e['body']['id'];}return db[_0xa43c('0x30')][_0xa43c('0x4f')]({'where':{'id':_0x462e1e['params']['id']}})[_0xa43c('0x28')](handleEntityNotFound(_0x4283b5,null))[_0xa43c('0x28')](function(_0x20efb5){if(_0x20efb5){return _0x20efb5[_0xa43c('0x57')](_0x462e1e[_0xa43c('0x4c')][_0xa43c('0x58')]||[]);}return null;})[_0xa43c('0x28')](respondWithResult(_0x4283b5,null))[_0xa43c('0x46')](handleError(_0x4283b5,null));}; \ No newline at end of file +var _0x04b6=['index','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','DeskConfiguration','findAll','rows','show','params','length','options','find','catch','create','body','getFields','findOne','map','hasOwnProperty','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','then','error','stack','name'];(function(_0x52e584,_0x4c89af){var _0x7b5634=function(_0x220fdc){while(--_0x220fdc){_0x52e584['push'](_0x52e584['shift']());}};_0x7b5634(++_0x4c89af);}(_0x04b6,0x162));var _0x604b=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x04b6[_0x4226d6];return _0x19655b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x604b('0x0'));var zipdir=require(_0x604b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x604b('0x2'));var moment=require(_0x604b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x604b('0x4'));var util=require(_0x604b('0x5'));var path=require(_0x604b('0x6'));var sox=require(_0x604b('0x7'));var csv=require(_0x604b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x604b('0x9'));var squel=require(_0x604b('0xa'));var crypto=require(_0x604b('0xb'));var jsforce=require(_0x604b('0xc'));var deskjs=require(_0x604b('0xd'));var toCsv=require(_0x604b('0x8'));var querystring=require(_0x604b('0xe'));var Papa=require(_0x604b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x604b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x604b('0x11'))('api');var utils=require(_0x604b('0x12'));var config=require(_0x604b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x604b('0x14'))['db'];function respondWithStatusCode(_0x42b413,_0x5c2eb4){_0x5c2eb4=_0x5c2eb4||0xcc;return function(_0x412aeb){if(_0x412aeb){return _0x42b413[_0x604b('0x15')](_0x5c2eb4);}return _0x42b413['status'](_0x5c2eb4)[_0x604b('0x16')]();};}function respondWithResult(_0x491cb4,_0x49cbdd){_0x49cbdd=_0x49cbdd||0xc8;return function(_0x3eea44){if(_0x3eea44){return _0x491cb4[_0x604b('0x17')](_0x49cbdd)['json'](_0x3eea44);}};}function respondWithFilteredResult(_0x123237,_0x1f8d78){return function(_0x2d1ca9){if(_0x2d1ca9){var _0x16721e=typeof _0x1f8d78[_0x604b('0x18')]===_0x604b('0x19')&&typeof _0x1f8d78[_0x604b('0x1a')]==='undefined';var _0x219cd1=_0x2d1ca9[_0x604b('0x1b')];var _0x2d1651=_0x16721e?0x0:_0x1f8d78[_0x604b('0x18')];var _0x185e68=_0x16721e?_0x2d1ca9[_0x604b('0x1b')]:_0x1f8d78[_0x604b('0x18')]+_0x1f8d78['limit'];var _0x5d8832;if(_0x185e68>=_0x219cd1){_0x185e68=_0x219cd1;_0x5d8832=0xc8;}else{_0x5d8832=0xce;}_0x123237['status'](_0x5d8832);return _0x123237['set']('Content-Range',_0x2d1651+'-'+_0x185e68+'/'+_0x219cd1)[_0x604b('0x1c')](_0x2d1ca9);}return null;};}function patchUpdates(_0x4ef838){return function(_0x16af86){try{jsonpatch[_0x604b('0x1d')](_0x16af86,_0x4ef838,!![]);}catch(_0x173dc1){return BPromise[_0x604b('0x1e')](_0x173dc1);}return _0x16af86[_0x604b('0x1f')]();};}function saveUpdates(_0x166cc9,_0x389567){return function(_0x24fd7b){if(_0x24fd7b){return _0x24fd7b['update'](_0x166cc9)['then'](function(_0x1ae66b){return _0x1ae66b;});}return null;};}function removeEntity(_0x3ab018,_0x53fc54){return function(_0x2bc3a2){if(_0x2bc3a2){return _0x2bc3a2['destroy']()[_0x604b('0x20')](function(){_0x3ab018[_0x604b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cf8f7,_0x159cba){return function(_0x4e1d4e){if(!_0x4e1d4e){_0x5cf8f7['sendStatus'](0x194);}return _0x4e1d4e;};}function handleError(_0x528866,_0x575770){_0x575770=_0x575770||0x1f4;return function(_0xe4a7f9){logger[_0x604b('0x21')](_0xe4a7f9[_0x604b('0x22')]);if(_0xe4a7f9['name']){delete _0xe4a7f9[_0x604b('0x23')];}_0x528866[_0x604b('0x17')](_0x575770)['send'](_0xe4a7f9);};}exports[_0x604b('0x24')]=function(_0x18bb50,_0x3c3ce3){var _0x4746b2={},_0x2dbae1={},_0x2a1395={'count':0x0,'rows':[]};var _0x1babd6=_['map'](db['DeskConfiguration'][_0x604b('0x25')],function(_0x58fd01){return{'name':_0x58fd01[_0x604b('0x26')],'type':_0x58fd01['type'][_0x604b('0x27')]};});_0x2dbae1[_0x604b('0x28')]=_['map'](_0x1babd6,_0x604b('0x23'));_0x2dbae1[_0x604b('0x29')]=_[_0x604b('0x2a')](_0x18bb50[_0x604b('0x29')]);_0x2dbae1['filters']=_[_0x604b('0x2b')](_0x2dbae1[_0x604b('0x28')],_0x2dbae1[_0x604b('0x29')]);_0x4746b2[_0x604b('0x2c')]=_[_0x604b('0x2b')](_0x2dbae1[_0x604b('0x28')],qs[_0x604b('0x2d')](_0x18bb50[_0x604b('0x29')]['fields']));_0x4746b2[_0x604b('0x2c')]=_0x4746b2['attributes']['length']?_0x4746b2['attributes']:_0x2dbae1['model'];if(!_0x18bb50[_0x604b('0x29')]['hasOwnProperty']('nolimit')){_0x4746b2[_0x604b('0x1a')]=qs[_0x604b('0x1a')](_0x18bb50[_0x604b('0x29')]['limit']);_0x4746b2[_0x604b('0x18')]=qs[_0x604b('0x18')](_0x18bb50[_0x604b('0x29')][_0x604b('0x18')]);}_0x4746b2[_0x604b('0x2e')]=qs[_0x604b('0x2f')](_0x18bb50[_0x604b('0x29')]['sort']);_0x4746b2[_0x604b('0x30')]=qs[_0x604b('0x31')](_[_0x604b('0x32')](_0x18bb50[_0x604b('0x29')],_0x2dbae1['filters']),_0x1babd6);if(_0x18bb50[_0x604b('0x29')][_0x604b('0x33')]){_0x4746b2[_0x604b('0x30')]=_[_0x604b('0x34')](_0x4746b2[_0x604b('0x30')],{'$or':_['map'](_0x1babd6,function(_0x3b8252){if(_0x3b8252[_0x604b('0x35')]!==_0x604b('0x36')){var _0x4a3ec4={};_0x4a3ec4[_0x3b8252[_0x604b('0x23')]]={'$like':'%'+_0x18bb50[_0x604b('0x29')]['filter']+'%'};return _0x4a3ec4;}})});}_0x4746b2=_['merge']({},_0x4746b2,_0x18bb50['options']);var _0x59b9f2={'where':_0x4746b2[_0x604b('0x30')]};return db['DeskConfiguration']['count'](_0x59b9f2)[_0x604b('0x20')](function(_0x4ea892){_0x2a1395[_0x604b('0x1b')]=_0x4ea892;if(_0x18bb50['query'][_0x604b('0x37')]){_0x4746b2[_0x604b('0x38')]=[{'all':!![]}];}return db[_0x604b('0x39')][_0x604b('0x3a')](_0x4746b2);})['then'](function(_0x26a668){_0x2a1395[_0x604b('0x3b')]=_0x26a668;return _0x2a1395;})[_0x604b('0x20')](respondWithFilteredResult(_0x3c3ce3,_0x4746b2))['catch'](handleError(_0x3c3ce3,null));};exports[_0x604b('0x3c')]=function(_0x25a4ab,_0xc21dd2){var _0x199ba2={'raw':![],'where':{'id':_0x25a4ab[_0x604b('0x3d')]['id']}},_0x38e40b={};_0x38e40b[_0x604b('0x28')]=_[_0x604b('0x2a')](db[_0x604b('0x39')][_0x604b('0x25')]);_0x38e40b[_0x604b('0x29')]=_[_0x604b('0x2a')](_0x25a4ab[_0x604b('0x29')]);_0x38e40b['filters']=_[_0x604b('0x2b')](_0x38e40b[_0x604b('0x28')],_0x38e40b[_0x604b('0x29')]);_0x199ba2['attributes']=_[_0x604b('0x2b')](_0x38e40b[_0x604b('0x28')],qs[_0x604b('0x2d')](_0x25a4ab['query'][_0x604b('0x2d')]));_0x199ba2[_0x604b('0x2c')]=_0x199ba2[_0x604b('0x2c')][_0x604b('0x3e')]?_0x199ba2[_0x604b('0x2c')]:_0x38e40b['model'];if(_0x25a4ab['query']['includeAll']){_0x199ba2[_0x604b('0x38')]=[{'all':!![]}];}_0x199ba2=_[_0x604b('0x34')]({},_0x199ba2,_0x25a4ab[_0x604b('0x3f')]);return db[_0x604b('0x39')][_0x604b('0x40')](_0x199ba2)[_0x604b('0x20')](handleEntityNotFound(_0xc21dd2,null))[_0x604b('0x20')](respondWithResult(_0xc21dd2,null))[_0x604b('0x41')](handleError(_0xc21dd2,null));};exports[_0x604b('0x42')]=function(_0x54c1ab,_0x3f4d8b){return db[_0x604b('0x39')][_0x604b('0x42')](_0x54c1ab['body'],{})[_0x604b('0x20')](respondWithResult(_0x3f4d8b,0xc9))[_0x604b('0x41')](handleError(_0x3f4d8b,null));};exports['update']=function(_0x4cba13,_0x2bd89f){if(_0x4cba13[_0x604b('0x43')]['id']){delete _0x4cba13[_0x604b('0x43')]['id'];}return db[_0x604b('0x39')][_0x604b('0x40')]({'where':{'id':_0x4cba13['params']['id']}})[_0x604b('0x20')](handleEntityNotFound(_0x2bd89f,null))[_0x604b('0x20')](saveUpdates(_0x4cba13['body'],null))[_0x604b('0x20')](respondWithResult(_0x2bd89f,null))['catch'](handleError(_0x2bd89f,null));};exports['destroy']=function(_0x2505cf,_0xd0bf67){return db[_0x604b('0x39')][_0x604b('0x40')]({'where':{'id':_0x2505cf['params']['id']}})['then'](handleEntityNotFound(_0xd0bf67,null))[_0x604b('0x20')](removeEntity(_0xd0bf67,null))['catch'](handleError(_0xd0bf67,null));};exports[_0x604b('0x44')]=function(_0xcc2763,_0xa2e8d7,_0x3183ae){var _0x1ee3b2={};var _0x2fb9fd={};var _0x20b4ba;var _0x40297b;return db[_0x604b('0x39')][_0x604b('0x45')]({'where':{'id':_0xcc2763['params']['id']}})[_0x604b('0x20')](handleEntityNotFound(_0xa2e8d7,null))['then'](function(_0x1bae85){if(_0x1bae85){_0x20b4ba=_0x1bae85;_0x2fb9fd['model']=_[_0x604b('0x2a')](db['DeskField'][_0x604b('0x25')]);_0x2fb9fd[_0x604b('0x29')]=_[_0x604b('0x2a')](_0xcc2763[_0x604b('0x29')]);_0x2fb9fd['filters']=_[_0x604b('0x2b')](_0x2fb9fd[_0x604b('0x28')],_0x2fb9fd['query']);_0x1ee3b2[_0x604b('0x2c')]=_['intersection'](_0x2fb9fd[_0x604b('0x28')],qs[_0x604b('0x2d')](_0xcc2763[_0x604b('0x29')][_0x604b('0x2d')]));_0x1ee3b2[_0x604b('0x2c')]=_0x1ee3b2[_0x604b('0x2c')][_0x604b('0x3e')]?_0x1ee3b2[_0x604b('0x2c')]:_0x2fb9fd[_0x604b('0x28')];_0x1ee3b2[_0x604b('0x2e')]=qs[_0x604b('0x2f')](_0xcc2763[_0x604b('0x29')][_0x604b('0x2f')]);_0x1ee3b2[_0x604b('0x30')]=qs[_0x604b('0x31')](_[_0x604b('0x32')](_0xcc2763[_0x604b('0x29')],_0x2fb9fd[_0x604b('0x31')]));if(_0xcc2763['query'][_0x604b('0x33')]){_0x1ee3b2[_0x604b('0x30')]=_['merge'](_0x1ee3b2[_0x604b('0x30')],{'$or':_[_0x604b('0x46')](_0x1ee3b2[_0x604b('0x2c')],function(_0x5134b9){var _0x54552b={};_0x54552b[_0x5134b9]={'$like':'%'+_0xcc2763[_0x604b('0x29')]['filter']+'%'};return _0x54552b;})});}_0x1ee3b2=_[_0x604b('0x34')]({},_0x1ee3b2,_0xcc2763[_0x604b('0x3f')]);return _0x20b4ba[_0x604b('0x44')](_0x1ee3b2);}})[_0x604b('0x20')](function(_0x5471a9){if(_0x5471a9){_0x40297b=_0x5471a9[_0x604b('0x3e')];if(!_0xcc2763[_0x604b('0x29')][_0x604b('0x47')]('nolimit')){_0x1ee3b2['limit']=qs[_0x604b('0x1a')](_0xcc2763['query'][_0x604b('0x1a')]);_0x1ee3b2[_0x604b('0x18')]=qs[_0x604b('0x18')](_0xcc2763['query'][_0x604b('0x18')]);}return _0x20b4ba[_0x604b('0x44')](_0x1ee3b2);}})['then'](function(_0x2d649b){if(_0x2d649b){return _0x2d649b?{'count':_0x40297b,'rows':_0x2d649b}:null;}})[_0x604b('0x20')](respondWithResult(_0xa2e8d7,null))[_0x604b('0x41')](handleError(_0xa2e8d7,null));};exports[_0x604b('0x48')]=function(_0xc28d02,_0x4e8cf7,_0x237aa9){var _0x465796={};var _0x1b9882={};var _0x2ec3af;var _0x5b1dc0;return db[_0x604b('0x39')][_0x604b('0x45')]({'where':{'id':_0xc28d02['params']['id']}})[_0x604b('0x20')](handleEntityNotFound(_0x4e8cf7,null))[_0x604b('0x20')](function(_0x88fd91){if(_0x88fd91){_0x2ec3af=_0x88fd91;_0x1b9882[_0x604b('0x28')]=_[_0x604b('0x2a')](db['DeskField'][_0x604b('0x25')]);_0x1b9882[_0x604b('0x29')]=_[_0x604b('0x2a')](_0xc28d02[_0x604b('0x29')]);_0x1b9882['filters']=_['intersection'](_0x1b9882[_0x604b('0x28')],_0x1b9882[_0x604b('0x29')]);_0x465796[_0x604b('0x2c')]=_[_0x604b('0x2b')](_0x1b9882[_0x604b('0x28')],qs[_0x604b('0x2d')](_0xc28d02[_0x604b('0x29')][_0x604b('0x2d')]));_0x465796[_0x604b('0x2c')]=_0x465796[_0x604b('0x2c')][_0x604b('0x3e')]?_0x465796[_0x604b('0x2c')]:_0x1b9882['model'];_0x465796['order']=qs['sort'](_0xc28d02[_0x604b('0x29')]['sort']);_0x465796[_0x604b('0x30')]=qs['filters'](_[_0x604b('0x32')](_0xc28d02['query'],_0x1b9882[_0x604b('0x31')]));if(_0xc28d02[_0x604b('0x29')][_0x604b('0x33')]){_0x465796['where']=_[_0x604b('0x34')](_0x465796['where'],{'$or':_[_0x604b('0x46')](_0x465796[_0x604b('0x2c')],function(_0x29458c){var _0x581ed6={};_0x581ed6[_0x29458c]={'$like':'%'+_0xc28d02[_0x604b('0x29')][_0x604b('0x33')]+'%'};return _0x581ed6;})});}_0x465796=_[_0x604b('0x34')]({},_0x465796,_0xc28d02[_0x604b('0x3f')]);return _0x2ec3af[_0x604b('0x48')](_0x465796);}})['then'](function(_0x4173ba){if(_0x4173ba){_0x5b1dc0=_0x4173ba['length'];if(!_0xc28d02[_0x604b('0x29')][_0x604b('0x47')](_0x604b('0x49'))){_0x465796[_0x604b('0x1a')]=qs[_0x604b('0x1a')](_0xc28d02['query']['limit']);_0x465796[_0x604b('0x18')]=qs[_0x604b('0x18')](_0xc28d02[_0x604b('0x29')][_0x604b('0x18')]);}return _0x2ec3af['getSubjects'](_0x465796);}})[_0x604b('0x20')](function(_0x43e0cd){if(_0x43e0cd){return _0x43e0cd?{'count':_0x5b1dc0,'rows':_0x43e0cd}:null;}})[_0x604b('0x20')](respondWithResult(_0x4e8cf7,null))[_0x604b('0x41')](handleError(_0x4e8cf7,null));};exports[_0x604b('0x4a')]=function(_0x537f51,_0xee8d0e,_0x330f72){var _0x4c8a4f={};var _0x76d8bd={};var _0x3b8a88;var _0x20eb02;return db[_0x604b('0x39')]['findOne']({'where':{'id':_0x537f51[_0x604b('0x3d')]['id']}})[_0x604b('0x20')](handleEntityNotFound(_0xee8d0e,null))['then'](function(_0x26f13e){if(_0x26f13e){_0x3b8a88=_0x26f13e;_0x76d8bd[_0x604b('0x28')]=_['keys'](db['DeskField']['rawAttributes']);_0x76d8bd[_0x604b('0x29')]=_[_0x604b('0x2a')](_0x537f51[_0x604b('0x29')]);_0x76d8bd['filters']=_[_0x604b('0x2b')](_0x76d8bd['model'],_0x76d8bd[_0x604b('0x29')]);_0x4c8a4f[_0x604b('0x2c')]=_[_0x604b('0x2b')](_0x76d8bd['model'],qs['fields'](_0x537f51[_0x604b('0x29')]['fields']));_0x4c8a4f[_0x604b('0x2c')]=_0x4c8a4f[_0x604b('0x2c')][_0x604b('0x3e')]?_0x4c8a4f['attributes']:_0x76d8bd[_0x604b('0x28')];_0x4c8a4f[_0x604b('0x2e')]=qs[_0x604b('0x2f')](_0x537f51[_0x604b('0x29')]['sort']);_0x4c8a4f[_0x604b('0x30')]=qs['filters'](_[_0x604b('0x32')](_0x537f51[_0x604b('0x29')],_0x76d8bd[_0x604b('0x31')]));if(_0x537f51['query'][_0x604b('0x33')]){_0x4c8a4f['where']=_[_0x604b('0x34')](_0x4c8a4f['where'],{'$or':_[_0x604b('0x46')](_0x4c8a4f[_0x604b('0x2c')],function(_0x3535c4){var _0x192927={};_0x192927[_0x3535c4]={'$like':'%'+_0x537f51['query']['filter']+'%'};return _0x192927;})});}_0x4c8a4f=_[_0x604b('0x34')]({},_0x4c8a4f,_0x537f51[_0x604b('0x3f')]);return _0x3b8a88[_0x604b('0x4a')](_0x4c8a4f);}})['then'](function(_0x127fa9){if(_0x127fa9){_0x20eb02=_0x127fa9[_0x604b('0x3e')];if(!_0x537f51[_0x604b('0x29')]['hasOwnProperty'](_0x604b('0x49'))){_0x4c8a4f[_0x604b('0x1a')]=qs[_0x604b('0x1a')](_0x537f51[_0x604b('0x29')][_0x604b('0x1a')]);_0x4c8a4f[_0x604b('0x18')]=qs[_0x604b('0x18')](_0x537f51[_0x604b('0x29')][_0x604b('0x18')]);}return _0x3b8a88['getDescriptions'](_0x4c8a4f);}})[_0x604b('0x20')](function(_0x1619d6){if(_0x1619d6){return _0x1619d6?{'count':_0x20eb02,'rows':_0x1619d6}:null;}})[_0x604b('0x20')](respondWithResult(_0xee8d0e,null))[_0x604b('0x41')](handleError(_0xee8d0e,null));};exports[_0x604b('0x4b')]=function(_0x5afa28,_0x31c846,_0x41a5f1){var _0x3955f6={};var _0x2dce65={};var _0x9f3f7b;var _0x37744f;return db['DeskConfiguration'][_0x604b('0x45')]({'where':{'id':_0x5afa28[_0x604b('0x3d')]['id']}})[_0x604b('0x20')](handleEntityNotFound(_0x31c846,null))[_0x604b('0x20')](function(_0x209b6f){if(_0x209b6f){_0x9f3f7b=_0x209b6f;_0x2dce65[_0x604b('0x28')]=_[_0x604b('0x2a')](db[_0x604b('0x4c')]['rawAttributes']);_0x2dce65['query']=_[_0x604b('0x2a')](_0x5afa28[_0x604b('0x29')]);_0x2dce65[_0x604b('0x31')]=_[_0x604b('0x2b')](_0x2dce65[_0x604b('0x28')],_0x2dce65[_0x604b('0x29')]);_0x3955f6[_0x604b('0x2c')]=_[_0x604b('0x2b')](_0x2dce65[_0x604b('0x28')],qs[_0x604b('0x2d')](_0x5afa28['query'][_0x604b('0x2d')]));_0x3955f6['attributes']=_0x3955f6[_0x604b('0x2c')][_0x604b('0x3e')]?_0x3955f6[_0x604b('0x2c')]:_0x2dce65[_0x604b('0x28')];_0x3955f6[_0x604b('0x2e')]=qs['sort'](_0x5afa28[_0x604b('0x29')][_0x604b('0x2f')]);_0x3955f6[_0x604b('0x30')]=qs[_0x604b('0x31')](_[_0x604b('0x32')](_0x5afa28['query'],_0x2dce65[_0x604b('0x31')]));if(_0x5afa28['query'][_0x604b('0x33')]){_0x3955f6[_0x604b('0x30')]=_[_0x604b('0x34')](_0x3955f6['where'],{'$or':_['map'](_0x3955f6['attributes'],function(_0x186a4b){var _0x35c92f={};_0x35c92f[_0x186a4b]={'$like':'%'+_0x5afa28['query']['filter']+'%'};return _0x35c92f;})});}_0x3955f6=_[_0x604b('0x34')]({},_0x3955f6,_0x5afa28[_0x604b('0x3f')]);return _0x9f3f7b[_0x604b('0x4b')](_0x3955f6);}})[_0x604b('0x20')](function(_0x2cd0ea){if(_0x2cd0ea){_0x37744f=_0x2cd0ea[_0x604b('0x3e')];if(!_0x5afa28[_0x604b('0x29')][_0x604b('0x47')](_0x604b('0x49'))){_0x3955f6[_0x604b('0x1a')]=qs[_0x604b('0x1a')](_0x5afa28['query'][_0x604b('0x1a')]);_0x3955f6['offset']=qs[_0x604b('0x18')](_0x5afa28['query']['offset']);}return _0x9f3f7b[_0x604b('0x4b')](_0x3955f6);}})[_0x604b('0x20')](function(_0x3dcdec){if(_0x3dcdec){return _0x3dcdec?{'count':_0x37744f,'rows':_0x3dcdec}:null;}})[_0x604b('0x20')](respondWithResult(_0x31c846,null))['catch'](handleError(_0x31c846,null));};exports[_0x604b('0x4d')]=function(_0x302edf,_0x13b753,_0x1147d7){if(_0x302edf[_0x604b('0x43')]['id']){delete _0x302edf[_0x604b('0x43')]['id'];}return db['DeskConfiguration'][_0x604b('0x45')]({'where':{'id':_0x302edf[_0x604b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x13b753,null))[_0x604b('0x20')](function(_0x19e2fa){if(_0x19e2fa){return _0x19e2fa[_0x604b('0x4d')](_0x302edf[_0x604b('0x43')]['ids']||[]);}return null;})[_0x604b('0x20')](respondWithResult(_0x13b753,null))[_0x604b('0x41')](handleError(_0x13b753,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index c11afd7..49ba008 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 _0xe376=['define','int_desk_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x5f3701,_0x53859e){var _0x5b6078=function(_0x23c719){while(--_0x23c719){_0x5f3701['push'](_0x5f3701['shift']());}};_0x5b6078(++_0x53859e);}(_0xe376,0x115));var _0x6e37=function(_0x5d184b,_0x1b04c5){_0x5d184b=_0x5d184b-0x0;var _0x5cee64=_0xe376[_0x5d184b];return _0x5cee64;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e37('0x0'))(_0x6e37('0x1'));var moment=require(_0x6e37('0x2'));var BPromise=require(_0x6e37('0x3'));var rp=require(_0x6e37('0x4'));var fs=require('fs');var path=require(_0x6e37('0x5'));var rimraf=require(_0x6e37('0x6'));var config=require(_0x6e37('0x7'));var attributes=require(_0x6e37('0x8'));module['exports']=function(_0x18c1fa,_0x27869c){return _0x18c1fa[_0x6e37('0x9')]('DeskConfiguration',attributes,{'tableName':_0x6e37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe891=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x36e03b,_0x35917e){var _0x396b86=function(_0x2d9dff){while(--_0x2d9dff){_0x36e03b['push'](_0x36e03b['shift']());}};_0x396b86(++_0x35917e);}(_0xe891,0x15f));var _0x1e89=function(_0x24a85d,_0x14e3fd){_0x24a85d=_0x24a85d-0x0;var _0x5408fe=_0xe891[_0x24a85d];return _0x5408fe;};'use strict';var _=require(_0x1e89('0x0'));var util=require(_0x1e89('0x1'));var logger=require('../../config/logger')(_0x1e89('0x2'));var moment=require(_0x1e89('0x3'));var BPromise=require(_0x1e89('0x4'));var rp=require(_0x1e89('0x5'));var fs=require('fs');var path=require(_0x1e89('0x6'));var rimraf=require(_0x1e89('0x7'));var config=require(_0x1e89('0x8'));var attributes=require(_0x1e89('0x9'));module[_0x1e89('0xa')]=function(_0x440fee,_0x204254){return _0x440fee[_0x1e89('0xb')](_0x1e89('0xc'),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 5646507..eaaac9b 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 _0xe9f2=['request\x20sent','debug','error','DeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2cf22d,_0x2349c0){var _0x490fbc=function(_0x1e56f8){while(--_0x1e56f8){_0x2cf22d['push'](_0x2cf22d['shift']());}};_0x490fbc(++_0x2349c0);}(_0xe9f2,0xba));var _0x2e9f=function(_0x90a273,_0x47e42){_0x90a273=_0x90a273-0x0;var _0xc984d7=_0xe9f2[_0x90a273];return _0xc984d7;};'use strict';var _=require(_0x2e9f('0x0'));var util=require(_0x2e9f('0x1'));var moment=require(_0x2e9f('0x2'));var BPromise=require(_0x2e9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e9f('0x4'));var db=require(_0x2e9f('0x5'))['db'];var utils=require(_0x2e9f('0x6'));var logger=require(_0x2e9f('0x7'))('rpc');var config=require(_0x2e9f('0x8'));var jayson=require(_0x2e9f('0x9'));var client=jayson[_0x2e9f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20ba82,_0x3264c8,_0x52f89e){return new BPromise(function(_0x545d7c,_0x2727d2){return client[_0x2e9f('0xb')](_0x20ba82,_0x52f89e)[_0x2e9f('0xc')](function(_0x5f3c66){logger[_0x2e9f('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x3264c8,_0x2e9f('0xe'));logger[_0x2e9f('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3264c8,_0x2e9f('0xe'),JSON['stringify'](_0x5f3c66));if(_0x5f3c66[_0x2e9f('0x10')]){if(_0x5f3c66[_0x2e9f('0x10')]['code']===0x1f4){logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x3264c8,_0x5f3c66[_0x2e9f('0x10')][_0x2e9f('0x12')]);return _0x2727d2(_0x5f3c66[_0x2e9f('0x10')][_0x2e9f('0x12')]);}logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x3264c8,_0x5f3c66['error']['message']);return _0x545d7c(_0x5f3c66[_0x2e9f('0x10')][_0x2e9f('0x12')]);}else{logger[_0x2e9f('0xd')](_0x2e9f('0x11'),_0x3264c8,_0x2e9f('0xe'));_0x545d7c(_0x5f3c66[_0x2e9f('0x13')][_0x2e9f('0x12')]);}})['catch'](function(_0x4969f6){logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x3264c8,_0x4969f6);_0x2727d2(_0x4969f6);});});} \ No newline at end of file +var _0x4123=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x39a907,_0x506d5b){var _0x1e6896=function(_0x3f063b){while(--_0x3f063b){_0x39a907['push'](_0x39a907['shift']());}};_0x1e6896(++_0x506d5b);}(_0x4123,0x87));var _0x3412=function(_0x1439e6,_0x2634b8){_0x1439e6=_0x1439e6-0x0;var _0x1101a9=_0x4123[_0x1439e6];return _0x1101a9;};'use strict';var _=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var moment=require(_0x3412('0x2'));var BPromise=require(_0x3412('0x3'));var rs=require(_0x3412('0x4'));var fs=require('fs');var Redis=require(_0x3412('0x5'));var db=require(_0x3412('0x6'))['db'];var utils=require(_0x3412('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3412('0x8'));var jayson=require(_0x3412('0x9'));var client=jayson['client'][_0x3412('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6b42,_0x30d18b,_0x43f43c){return new BPromise(function(_0x40c825,_0x2617a6){return client['request'](_0x2c6b42,_0x43f43c)[_0x3412('0xb')](function(_0x2517b0){logger[_0x3412('0xc')](_0x3412('0xd'),_0x30d18b,_0x3412('0xe'));logger[_0x3412('0xf')](_0x3412('0x10'),_0x30d18b,_0x3412('0xe'),JSON[_0x3412('0x11')](_0x2517b0));if(_0x2517b0['error']){if(_0x2517b0['error'][_0x3412('0x12')]===0x1f4){logger[_0x3412('0x13')](_0x3412('0xd'),_0x30d18b,_0x2517b0['error']['message']);return _0x2617a6(_0x2517b0['error'][_0x3412('0x14')]);}logger[_0x3412('0x13')](_0x3412('0xd'),_0x30d18b,_0x2517b0[_0x3412('0x13')][_0x3412('0x14')]);return _0x40c825(_0x2517b0[_0x3412('0x13')][_0x3412('0x14')]);}else{logger[_0x3412('0xc')](_0x3412('0xd'),_0x30d18b,_0x3412('0xe'));_0x40c825(_0x2517b0[_0x3412('0x15')][_0x3412('0x14')]);}})[_0x3412('0x16')](function(_0x854010){logger['error'](_0x3412('0xd'),_0x30d18b,_0x854010);_0x2617a6(_0x854010);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index c409a64..e909871 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 _0x831b=['index','/:id','post','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated'];(function(_0x324fe8,_0x1ccb46){var _0x4a1cd9=function(_0x506af2){while(--_0x506af2){_0x324fe8['push'](_0x324fe8['shift']());}};_0x4a1cd9(++_0x1ccb46);}(_0x831b,0x114));var _0xb831=function(_0x53aad5,_0x2665b6){_0x53aad5=_0x53aad5-0x0;var _0x5061c4=_0x831b[_0x53aad5];return _0x5061c4;};'use strict';var multer=require('multer');var util=require(_0xb831('0x0'));var path=require(_0xb831('0x1'));var timeout=require(_0xb831('0x2'));var express=require(_0xb831('0x3'));var router=express[_0xb831('0x4')]();var fs_extra=require(_0xb831('0x5'));var auth=require(_0xb831('0x6'));var interaction=require(_0xb831('0x7'));var config=require(_0xb831('0x8'));var controller=require(_0xb831('0x9'));router[_0xb831('0xa')]('/',auth[_0xb831('0xb')](),controller[_0xb831('0xc')]);router[_0xb831('0xa')](_0xb831('0xd'),auth[_0xb831('0xb')](),controller['show']);router[_0xb831('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb831('0xd'),auth[_0xb831('0xb')](),controller[_0xb831('0xf')]);router[_0xb831('0x10')](_0xb831('0xd'),auth[_0xb831('0xb')](),controller[_0xb831('0x11')]);module['exports']=router; \ No newline at end of file +var _0x709b=['isAuthenticated','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x709b,0x97));var _0xb709=function(_0x5691a9,_0x4cf4d0){_0x5691a9=_0x5691a9-0x0;var _0x105033=_0x709b[_0x5691a9];return _0x105033;};'use strict';var multer=require(_0xb709('0x0'));var util=require(_0xb709('0x1'));var path=require(_0xb709('0x2'));var timeout=require(_0xb709('0x3'));var express=require(_0xb709('0x4'));var router=express[_0xb709('0x5')]();var fs_extra=require(_0xb709('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb709('0x7'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0xb709('0x8')]('/',auth[_0xb709('0x9')](),controller['index']);router[_0xb709('0x8')](_0xb709('0xa'),auth[_0xb709('0x9')](),controller[_0xb709('0xb')]);router[_0xb709('0xc')]('/',auth['isAuthenticated'](),controller[_0xb709('0xd')]);router['put'](_0xb709('0xa'),auth[_0xb709('0x9')](),controller['update']);router[_0xb709('0xe')]('/:id',auth[_0xb709('0x9')](),controller[_0xb709('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 717d960..a472bb2 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 _0xc659=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc659,0xf1));var _0x9c65=function(_0x536b02,_0x222598){_0x536b02=_0x536b02-0x0;var _0x49f4b6=_0xc659[_0x536b02];return _0x49f4b6;};'use strict';var Sequelize=require('sequelize');module[_0x9c65('0x0')]={'type':{'type':Sequelize[_0x9c65('0x1')](_0x9c65('0x2'),_0x9c65('0x3'),_0x9c65('0x4'),_0x9c65('0x5'),_0x9c65('0x6')),'defaultValue':_0x9c65('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9c65('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9c65('0x2'),_0x9c65('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9c65('0x7')]},'idField':{'type':Sequelize[_0x9c65('0x7')]},'nameField':{'type':Sequelize[_0x9c65('0x7')]},'customField':{'type':Sequelize[_0x9c65('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe23d=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x453a15,_0xcab71f){var _0x2e7f2d=function(_0x141a0b){while(--_0x141a0b){_0x453a15['push'](_0x453a15['shift']());}};_0x2e7f2d(++_0xcab71f);}(_0xe23d,0x182));var _0xde23=function(_0x27c1fc,_0x3c93fa){_0x27c1fc=_0x27c1fc-0x0;var _0x22d336=_0xe23d[_0x27c1fc];return _0x22d336;};'use strict';var Sequelize=require(_0xde23('0x0'));module[_0xde23('0x1')]={'type':{'type':Sequelize[_0xde23('0x2')](_0xde23('0x3'),_0xde23('0x4'),_0xde23('0x5'),'keyValue',_0xde23('0x6')),'defaultValue':_0xde23('0x3')},'content':{'type':Sequelize[_0xde23('0x7')]},'key':{'type':Sequelize[_0xde23('0x7')]},'keyType':{'type':Sequelize[_0xde23('0x2')]('string','variable',_0xde23('0x5'))},'keyContent':{'type':Sequelize[_0xde23('0x7')]},'idField':{'type':Sequelize[_0xde23('0x7')]},'nameField':{'type':Sequelize[_0xde23('0x7')]},'customField':{'type':Sequelize[_0xde23('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde23('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2368d81..214e125 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 _0x33ac=['../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskField','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x136cbd,_0x2473ad){var _0x3c7b44=function(_0x1ebda3){while(--_0x1ebda3){_0x136cbd['push'](_0x136cbd['shift']());}};_0x3c7b44(++_0x2473ad);}(_0x33ac,0x1f2));var _0xc33a=function(_0x2e332f,_0xae372e){_0x2e332f=_0x2e332f-0x0;var _0x330472=_0x33ac[_0x2e332f];return _0x330472;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc33a('0x1'));var moment=require(_0xc33a('0x2'));var BPromise=require(_0xc33a('0x3'));var Mustache=require(_0xc33a('0x4'));var util=require(_0xc33a('0x5'));var path=require(_0xc33a('0x6'));var sox=require(_0xc33a('0x7'));var csv=require(_0xc33a('0x8'));var ejs=require(_0xc33a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc33a('0xa'));var crypto=require(_0xc33a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc33a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc33a('0xd'));var Papa=require(_0xc33a('0xe'));var Redis=require(_0xc33a('0xf'));var authService=require(_0xc33a('0x10'));var qs=require(_0xc33a('0x11'));var as=require(_0xc33a('0x12'));var hardwareService=require(_0xc33a('0x13'));var logger=require(_0xc33a('0x14'))(_0xc33a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc33a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51421e,_0x24bc72){_0x24bc72=_0x24bc72||0xcc;return function(_0x287e3b){if(_0x287e3b){return _0x51421e[_0xc33a('0x17')](_0x24bc72);}return _0x51421e[_0xc33a('0x18')](_0x24bc72)[_0xc33a('0x19')]();};}function respondWithResult(_0x154791,_0x57383c){_0x57383c=_0x57383c||0xc8;return function(_0x2737cd){if(_0x2737cd){return _0x154791[_0xc33a('0x18')](_0x57383c)[_0xc33a('0x1a')](_0x2737cd);}};}function respondWithFilteredResult(_0x4c70ae,_0x1a77f7){return function(_0x53f800){if(_0x53f800){var _0x6d5b1=typeof _0x1a77f7[_0xc33a('0x1b')]===_0xc33a('0x1c')&&typeof _0x1a77f7[_0xc33a('0x1d')]===_0xc33a('0x1c');var _0x4fa7d0=_0x53f800['count'];var _0x40d736=_0x6d5b1?0x0:_0x1a77f7[_0xc33a('0x1b')];var _0x148b95=_0x6d5b1?_0x53f800[_0xc33a('0x1e')]:_0x1a77f7[_0xc33a('0x1b')]+_0x1a77f7[_0xc33a('0x1d')];var _0x3ee9cf;if(_0x148b95>=_0x4fa7d0){_0x148b95=_0x4fa7d0;_0x3ee9cf=0xc8;}else{_0x3ee9cf=0xce;}_0x4c70ae[_0xc33a('0x18')](_0x3ee9cf);return _0x4c70ae['set'](_0xc33a('0x1f'),_0x40d736+'-'+_0x148b95+'/'+_0x4fa7d0)[_0xc33a('0x1a')](_0x53f800);}return null;};}function patchUpdates(_0x4142f1){return function(_0x3896da){try{jsonpatch['apply'](_0x3896da,_0x4142f1,!![]);}catch(_0x17d70e){return BPromise[_0xc33a('0x20')](_0x17d70e);}return _0x3896da['save']();};}function saveUpdates(_0x35fd35,_0x2fc9f9){return function(_0x3b7aba){if(_0x3b7aba){return _0x3b7aba[_0xc33a('0x21')](_0x35fd35)[_0xc33a('0x22')](function(_0xd16dc5){return _0xd16dc5;});}return null;};}function removeEntity(_0x30534c,_0x3981cb){return function(_0x1481a0){if(_0x1481a0){return _0x1481a0[_0xc33a('0x23')]()[_0xc33a('0x22')](function(){_0x30534c[_0xc33a('0x18')](0xcc)[_0xc33a('0x19')]();});}};}function handleEntityNotFound(_0x37b32d,_0x29d3d3){return function(_0x3d3c3b){if(!_0x3d3c3b){_0x37b32d[_0xc33a('0x17')](0x194);}return _0x3d3c3b;};}function handleError(_0x708428,_0x375a32){_0x375a32=_0x375a32||0x1f4;return function(_0x4c42d1){logger[_0xc33a('0x24')](_0x4c42d1[_0xc33a('0x25')]);if(_0x4c42d1[_0xc33a('0x26')]){delete _0x4c42d1['name'];}_0x708428[_0xc33a('0x18')](_0x375a32)[_0xc33a('0x27')](_0x4c42d1);};}exports[_0xc33a('0x28')]=function(_0x2a1cc8,_0x2cdd42){var _0x4c676={},_0x4ccc71={},_0x2b489f={'count':0x0,'rows':[]};var _0x1b0338=_[_0xc33a('0x29')](db['DeskField']['rawAttributes'],function(_0x301762){return{'name':_0x301762[_0xc33a('0x2a')],'type':_0x301762[_0xc33a('0x2b')][_0xc33a('0x2c')]};});_0x4ccc71[_0xc33a('0x2d')]=_[_0xc33a('0x29')](_0x1b0338,_0xc33a('0x26'));_0x4ccc71[_0xc33a('0x2e')]=_[_0xc33a('0x2f')](_0x2a1cc8['query']);_0x4ccc71['filters']=_['intersection'](_0x4ccc71[_0xc33a('0x2d')],_0x4ccc71[_0xc33a('0x2e')]);_0x4c676[_0xc33a('0x30')]=_[_0xc33a('0x31')](_0x4ccc71[_0xc33a('0x2d')],qs[_0xc33a('0x32')](_0x2a1cc8['query'][_0xc33a('0x32')]));_0x4c676[_0xc33a('0x30')]=_0x4c676[_0xc33a('0x30')][_0xc33a('0x33')]?_0x4c676[_0xc33a('0x30')]:_0x4ccc71[_0xc33a('0x2d')];if(!_0x2a1cc8[_0xc33a('0x2e')][_0xc33a('0x34')](_0xc33a('0x35'))){_0x4c676[_0xc33a('0x1d')]=qs[_0xc33a('0x1d')](_0x2a1cc8[_0xc33a('0x2e')]['limit']);_0x4c676[_0xc33a('0x1b')]=qs['offset'](_0x2a1cc8['query'][_0xc33a('0x1b')]);}_0x4c676['order']=qs[_0xc33a('0x36')](_0x2a1cc8[_0xc33a('0x2e')][_0xc33a('0x36')]);_0x4c676[_0xc33a('0x37')]=qs[_0xc33a('0x38')](_[_0xc33a('0x39')](_0x2a1cc8['query'],_0x4ccc71[_0xc33a('0x38')]),_0x1b0338);if(_0x2a1cc8['query'][_0xc33a('0x3a')]){_0x4c676[_0xc33a('0x37')]=_[_0xc33a('0x3b')](_0x4c676[_0xc33a('0x37')],{'$or':_[_0xc33a('0x29')](_0x1b0338,function(_0x420638){if(_0x420638[_0xc33a('0x2b')]!==_0xc33a('0x3c')){var _0x4033a3={};_0x4033a3[_0x420638[_0xc33a('0x26')]]={'$like':'%'+_0x2a1cc8['query'][_0xc33a('0x3a')]+'%'};return _0x4033a3;}})});}_0x4c676=_[_0xc33a('0x3b')]({},_0x4c676,_0x2a1cc8[_0xc33a('0x3d')]);var _0x51a455={'where':_0x4c676[_0xc33a('0x37')]};return db[_0xc33a('0x3e')][_0xc33a('0x1e')](_0x51a455)[_0xc33a('0x22')](function(_0x56ff5f){_0x2b489f[_0xc33a('0x1e')]=_0x56ff5f;if(_0x2a1cc8['query']['includeAll']){_0x4c676[_0xc33a('0x3f')]=[{'all':!![]}];}return db[_0xc33a('0x3e')][_0xc33a('0x40')](_0x4c676);})['then'](function(_0x223b41){_0x2b489f[_0xc33a('0x41')]=_0x223b41;return _0x2b489f;})[_0xc33a('0x22')](respondWithFilteredResult(_0x2cdd42,_0x4c676))[_0xc33a('0x42')](handleError(_0x2cdd42,null));};exports[_0xc33a('0x43')]=function(_0x3eb3a8,_0x5a4de2){var _0x4a00f0={'raw':!![],'where':{'id':_0x3eb3a8[_0xc33a('0x44')]['id']}},_0x2bdac1={};_0x2bdac1[_0xc33a('0x2d')]=_[_0xc33a('0x2f')](db[_0xc33a('0x3e')][_0xc33a('0x45')]);_0x2bdac1[_0xc33a('0x2e')]=_[_0xc33a('0x2f')](_0x3eb3a8[_0xc33a('0x2e')]);_0x2bdac1['filters']=_[_0xc33a('0x31')](_0x2bdac1['model'],_0x2bdac1[_0xc33a('0x2e')]);_0x4a00f0[_0xc33a('0x30')]=_[_0xc33a('0x31')](_0x2bdac1[_0xc33a('0x2d')],qs[_0xc33a('0x32')](_0x3eb3a8[_0xc33a('0x2e')]['fields']));_0x4a00f0[_0xc33a('0x30')]=_0x4a00f0[_0xc33a('0x30')][_0xc33a('0x33')]?_0x4a00f0[_0xc33a('0x30')]:_0x2bdac1[_0xc33a('0x2d')];if(_0x3eb3a8[_0xc33a('0x2e')][_0xc33a('0x46')]){_0x4a00f0[_0xc33a('0x3f')]=[{'all':!![]}];}_0x4a00f0=_[_0xc33a('0x3b')]({},_0x4a00f0,_0x3eb3a8[_0xc33a('0x3d')]);return db['DeskField'][_0xc33a('0x47')](_0x4a00f0)[_0xc33a('0x22')](handleEntityNotFound(_0x5a4de2,null))[_0xc33a('0x22')](respondWithResult(_0x5a4de2,null))[_0xc33a('0x42')](handleError(_0x5a4de2,null));};exports[_0xc33a('0x48')]=function(_0x1da1f9,_0xea6fbd){return db[_0xc33a('0x3e')][_0xc33a('0x48')](_0x1da1f9['body'],{})[_0xc33a('0x22')](respondWithResult(_0xea6fbd,0xc9))[_0xc33a('0x42')](handleError(_0xea6fbd,null));};exports['update']=function(_0x1f86a0,_0x6b2859){if(_0x1f86a0[_0xc33a('0x49')]['id']){delete _0x1f86a0[_0xc33a('0x49')]['id'];}return db[_0xc33a('0x3e')][_0xc33a('0x47')]({'where':{'id':_0x1f86a0[_0xc33a('0x44')]['id']}})[_0xc33a('0x22')](handleEntityNotFound(_0x6b2859,null))[_0xc33a('0x22')](saveUpdates(_0x1f86a0[_0xc33a('0x49')],null))[_0xc33a('0x22')](respondWithResult(_0x6b2859,null))['catch'](handleError(_0x6b2859,null));};exports[_0xc33a('0x23')]=function(_0x2deacf,_0x400f52){return db[_0xc33a('0x3e')][_0xc33a('0x47')]({'where':{'id':_0x2deacf['params']['id']}})['then'](handleEntityNotFound(_0x400f52,null))[_0xc33a('0x22')](removeEntity(_0x400f52,null))[_0xc33a('0x42')](handleError(_0x400f52,null));}; \ No newline at end of file +var _0xa014=['VIRTUAL','options','includeAll','include','DeskField','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type'];(function(_0x1585f0,_0x2a6b0f){var _0x4eccc8=function(_0x565234){while(--_0x565234){_0x1585f0['push'](_0x1585f0['shift']());}};_0x4eccc8(++_0x2a6b0f);}(_0xa014,0xeb));var _0x4a01=function(_0x230f48,_0x5229b6){_0x230f48=_0x230f48-0x0;var _0x4739b2=_0xa014[_0x230f48];return _0x4739b2;};'use strict';var emlformat=require(_0x4a01('0x0'));var rimraf=require(_0x4a01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4a01('0x2'));var BPromise=require(_0x4a01('0x3'));var Mustache=require(_0x4a01('0x4'));var util=require('util');var path=require(_0x4a01('0x5'));var sox=require(_0x4a01('0x6'));var csv=require(_0x4a01('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a01('0x8'));var squel=require(_0x4a01('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4a01('0xa'));var toCsv=require(_0x4a01('0x7'));var querystring=require('querystring');var Papa=require(_0x4a01('0xb'));var Redis=require(_0x4a01('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4a01('0xd'));var as=require(_0x4a01('0xe'));var hardwareService=require(_0x4a01('0xf'));var logger=require(_0x4a01('0x10'))(_0x4a01('0x11'));var utils=require(_0x4a01('0x12'));var config=require(_0x4a01('0x13'));var licenseUtil=require(_0x4a01('0x14'));var db=require(_0x4a01('0x15'))['db'];function respondWithStatusCode(_0x50cdd8,_0x2e1433){_0x2e1433=_0x2e1433||0xcc;return function(_0x5d1ac9){if(_0x5d1ac9){return _0x50cdd8[_0x4a01('0x16')](_0x2e1433);}return _0x50cdd8[_0x4a01('0x17')](_0x2e1433)[_0x4a01('0x18')]();};}function respondWithResult(_0x3afe36,_0x160011){_0x160011=_0x160011||0xc8;return function(_0x3a5d68){if(_0x3a5d68){return _0x3afe36['status'](_0x160011)['json'](_0x3a5d68);}};}function respondWithFilteredResult(_0xf90ba7,_0x511d6e){return function(_0x17836b){if(_0x17836b){var _0x102577=typeof _0x511d6e[_0x4a01('0x19')]==='undefined'&&typeof _0x511d6e[_0x4a01('0x1a')]===_0x4a01('0x1b');var _0x2ff76c=_0x17836b['count'];var _0x591678=_0x102577?0x0:_0x511d6e[_0x4a01('0x19')];var _0x2c4941=_0x102577?_0x17836b[_0x4a01('0x1c')]:_0x511d6e[_0x4a01('0x19')]+_0x511d6e[_0x4a01('0x1a')];var _0x10b6ed;if(_0x2c4941>=_0x2ff76c){_0x2c4941=_0x2ff76c;_0x10b6ed=0xc8;}else{_0x10b6ed=0xce;}_0xf90ba7['status'](_0x10b6ed);return _0xf90ba7['set']('Content-Range',_0x591678+'-'+_0x2c4941+'/'+_0x2ff76c)[_0x4a01('0x1d')](_0x17836b);}return null;};}function patchUpdates(_0x19fb43){return function(_0x444e5d){try{jsonpatch[_0x4a01('0x1e')](_0x444e5d,_0x19fb43,!![]);}catch(_0x243e65){return BPromise[_0x4a01('0x1f')](_0x243e65);}return _0x444e5d[_0x4a01('0x20')]();};}function saveUpdates(_0xffe06d,_0x26147f){return function(_0x1a040b){if(_0x1a040b){return _0x1a040b[_0x4a01('0x21')](_0xffe06d)[_0x4a01('0x22')](function(_0x1ca842){return _0x1ca842;});}return null;};}function removeEntity(_0x5f03b3,_0x1aec2f){return function(_0x8b4f03){if(_0x8b4f03){return _0x8b4f03[_0x4a01('0x23')]()['then'](function(){_0x5f03b3[_0x4a01('0x17')](0xcc)[_0x4a01('0x18')]();});}};}function handleEntityNotFound(_0x29b92b,_0x1e8010){return function(_0x359623){if(!_0x359623){_0x29b92b[_0x4a01('0x16')](0x194);}return _0x359623;};}function handleError(_0x27d945,_0x253a1b){_0x253a1b=_0x253a1b||0x1f4;return function(_0x3fe7cb){logger[_0x4a01('0x24')](_0x3fe7cb[_0x4a01('0x25')]);if(_0x3fe7cb[_0x4a01('0x26')]){delete _0x3fe7cb[_0x4a01('0x26')];}_0x27d945[_0x4a01('0x17')](_0x253a1b)[_0x4a01('0x27')](_0x3fe7cb);};}exports[_0x4a01('0x28')]=function(_0x20d953,_0x442248){var _0xca9d77={},_0x127b8b={},_0x2386b1={'count':0x0,'rows':[]};var _0x5f44c3=_['map'](db['DeskField'][_0x4a01('0x29')],function(_0x20f68d){return{'name':_0x20f68d[_0x4a01('0x2a')],'type':_0x20f68d['type'][_0x4a01('0x2b')]};});_0x127b8b['model']=_[_0x4a01('0x2c')](_0x5f44c3,_0x4a01('0x26'));_0x127b8b[_0x4a01('0x2d')]=_[_0x4a01('0x2e')](_0x20d953[_0x4a01('0x2d')]);_0x127b8b[_0x4a01('0x2f')]=_[_0x4a01('0x30')](_0x127b8b[_0x4a01('0x31')],_0x127b8b[_0x4a01('0x2d')]);_0xca9d77['attributes']=_[_0x4a01('0x30')](_0x127b8b[_0x4a01('0x31')],qs['fields'](_0x20d953[_0x4a01('0x2d')][_0x4a01('0x32')]));_0xca9d77[_0x4a01('0x33')]=_0xca9d77[_0x4a01('0x33')][_0x4a01('0x34')]?_0xca9d77['attributes']:_0x127b8b[_0x4a01('0x31')];if(!_0x20d953['query'][_0x4a01('0x35')](_0x4a01('0x36'))){_0xca9d77[_0x4a01('0x1a')]=qs[_0x4a01('0x1a')](_0x20d953['query'][_0x4a01('0x1a')]);_0xca9d77[_0x4a01('0x19')]=qs[_0x4a01('0x19')](_0x20d953[_0x4a01('0x2d')][_0x4a01('0x19')]);}_0xca9d77['order']=qs[_0x4a01('0x37')](_0x20d953[_0x4a01('0x2d')]['sort']);_0xca9d77[_0x4a01('0x38')]=qs[_0x4a01('0x2f')](_[_0x4a01('0x39')](_0x20d953[_0x4a01('0x2d')],_0x127b8b[_0x4a01('0x2f')]),_0x5f44c3);if(_0x20d953[_0x4a01('0x2d')][_0x4a01('0x3a')]){_0xca9d77[_0x4a01('0x38')]=_[_0x4a01('0x3b')](_0xca9d77[_0x4a01('0x38')],{'$or':_[_0x4a01('0x2c')](_0x5f44c3,function(_0xb4465c){if(_0xb4465c[_0x4a01('0x3c')]!==_0x4a01('0x3d')){var _0x5450f1={};_0x5450f1[_0xb4465c['name']]={'$like':'%'+_0x20d953[_0x4a01('0x2d')]['filter']+'%'};return _0x5450f1;}})});}_0xca9d77=_[_0x4a01('0x3b')]({},_0xca9d77,_0x20d953[_0x4a01('0x3e')]);var _0x3f9ea5={'where':_0xca9d77[_0x4a01('0x38')]};return db['DeskField']['count'](_0x3f9ea5)[_0x4a01('0x22')](function(_0x158bc2){_0x2386b1[_0x4a01('0x1c')]=_0x158bc2;if(_0x20d953['query'][_0x4a01('0x3f')]){_0xca9d77[_0x4a01('0x40')]=[{'all':!![]}];}return db[_0x4a01('0x41')][_0x4a01('0x42')](_0xca9d77);})[_0x4a01('0x22')](function(_0x5043c2){_0x2386b1[_0x4a01('0x43')]=_0x5043c2;return _0x2386b1;})[_0x4a01('0x22')](respondWithFilteredResult(_0x442248,_0xca9d77))['catch'](handleError(_0x442248,null));};exports[_0x4a01('0x44')]=function(_0x222106,_0x4921a5){var _0x1f8dd4={'raw':!![],'where':{'id':_0x222106[_0x4a01('0x45')]['id']}},_0x127993={};_0x127993['model']=_[_0x4a01('0x2e')](db[_0x4a01('0x41')][_0x4a01('0x29')]);_0x127993['query']=_['keys'](_0x222106[_0x4a01('0x2d')]);_0x127993['filters']=_['intersection'](_0x127993[_0x4a01('0x31')],_0x127993['query']);_0x1f8dd4[_0x4a01('0x33')]=_[_0x4a01('0x30')](_0x127993[_0x4a01('0x31')],qs[_0x4a01('0x32')](_0x222106[_0x4a01('0x2d')][_0x4a01('0x32')]));_0x1f8dd4[_0x4a01('0x33')]=_0x1f8dd4[_0x4a01('0x33')][_0x4a01('0x34')]?_0x1f8dd4['attributes']:_0x127993['model'];if(_0x222106[_0x4a01('0x2d')]['includeAll']){_0x1f8dd4[_0x4a01('0x40')]=[{'all':!![]}];}_0x1f8dd4=_[_0x4a01('0x3b')]({},_0x1f8dd4,_0x222106[_0x4a01('0x3e')]);return db[_0x4a01('0x41')][_0x4a01('0x46')](_0x1f8dd4)[_0x4a01('0x22')](handleEntityNotFound(_0x4921a5,null))[_0x4a01('0x22')](respondWithResult(_0x4921a5,null))[_0x4a01('0x47')](handleError(_0x4921a5,null));};exports[_0x4a01('0x48')]=function(_0x1e2841,_0x41c82a){return db[_0x4a01('0x41')][_0x4a01('0x48')](_0x1e2841[_0x4a01('0x49')],{})[_0x4a01('0x22')](respondWithResult(_0x41c82a,0xc9))[_0x4a01('0x47')](handleError(_0x41c82a,null));};exports['update']=function(_0x555419,_0x10b3c5){if(_0x555419[_0x4a01('0x49')]['id']){delete _0x555419[_0x4a01('0x49')]['id'];}return db[_0x4a01('0x41')][_0x4a01('0x46')]({'where':{'id':_0x555419[_0x4a01('0x45')]['id']}})[_0x4a01('0x22')](handleEntityNotFound(_0x10b3c5,null))[_0x4a01('0x22')](saveUpdates(_0x555419[_0x4a01('0x49')],null))[_0x4a01('0x22')](respondWithResult(_0x10b3c5,null))[_0x4a01('0x47')](handleError(_0x10b3c5,null));};exports[_0x4a01('0x23')]=function(_0x5c3798,_0x1888dd){return db['DeskField'][_0x4a01('0x46')]({'where':{'id':_0x5c3798[_0x4a01('0x45')]['id']}})[_0x4a01('0x22')](handleEntityNotFound(_0x1888dd,null))['then'](removeEntity(_0x1888dd,null))[_0x4a01('0x47')](handleError(_0x1888dd,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6e187c2..fb9bd4b 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 _0x2c4b=['lodash','util','api','moment','bluebird','request-promise','path','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','FieldId'];(function(_0xf4d05,_0x5e601f){var _0x47c971=function(_0x17aae3){while(--_0x17aae3){_0xf4d05['push'](_0xf4d05['shift']());}};_0x47c971(++_0x5e601f);}(_0x2c4b,0xdd));var _0xb2c4=function(_0x1b28ae,_0x22b993){_0x1b28ae=_0x1b28ae-0x0;var _0x58e0fb=_0x2c4b[_0x1b28ae];return _0x58e0fb;};'use strict';var _=require(_0xb2c4('0x0'));var util=require(_0xb2c4('0x1'));var logger=require('../../config/logger')(_0xb2c4('0x2'));var moment=require(_0xb2c4('0x3'));var BPromise=require(_0xb2c4('0x4'));var rp=require(_0xb2c4('0x5'));var fs=require('fs');var path=require(_0xb2c4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb2c4('0x7'));module['exports']=function(_0x1fb7e1,_0x34282c){return _0x1fb7e1[_0xb2c4('0x8')](_0xb2c4('0x9'),attributes,{'tableName':_0xb2c4('0xa'),'paranoid':![],'indexes':[{'name':_0xb2c4('0xb'),'fields':['idField',_0xb2c4('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f35=['int_desk_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x2f35,0x160));var _0x52f3=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0x2f35[_0x5de818];return _0x345670;};'use strict';var _=require(_0x52f3('0x0'));var util=require(_0x52f3('0x1'));var logger=require(_0x52f3('0x2'))(_0x52f3('0x3'));var moment=require(_0x52f3('0x4'));var BPromise=require(_0x52f3('0x5'));var rp=require(_0x52f3('0x6'));var fs=require('fs');var path=require(_0x52f3('0x7'));var rimraf=require(_0x52f3('0x8'));var config=require(_0x52f3('0x9'));var attributes=require(_0x52f3('0xa'));module[_0x52f3('0xb')]=function(_0x298c1a,_0x3a2ad3){return _0x298c1a['define']('DeskField',attributes,{'tableName':_0x52f3('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','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 89a4373..30e05a6 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 _0xa72f=['info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x4e8522,_0x5d93a6){var _0x23fb25=function(_0x2f59ef){while(--_0x2f59ef){_0x4e8522['push'](_0x4e8522['shift']());}};_0x23fb25(++_0x5d93a6);}(_0xa72f,0xd1));var _0xfa72=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xa72f[_0x4c6d6f];return _0x2d4478;};'use strict';var _=require('lodash');var util=require(_0xfa72('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa72('0x1'));var fs=require('fs');var Redis=require(_0xfa72('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa72('0x3'));var logger=require(_0xfa72('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfa72('0x5'));var client=jayson['client'][_0xfa72('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x588dd,_0x1671f0,_0x8f30dd){return new BPromise(function(_0x4e9f78,_0x3a458e){return client['request'](_0x588dd,_0x8f30dd)['then'](function(_0x542055){logger[_0xfa72('0x7')]('DeskField,\x20%s,\x20%s',_0x1671f0,_0xfa72('0x8'));logger[_0xfa72('0x9')](_0xfa72('0xa'),_0x1671f0,_0xfa72('0x8'),JSON[_0xfa72('0xb')](_0x542055));if(_0x542055[_0xfa72('0xc')]){if(_0x542055[_0xfa72('0xc')][_0xfa72('0xd')]===0x1f4){logger[_0xfa72('0xc')](_0xfa72('0xe'),_0x1671f0,_0x542055['error'][_0xfa72('0xf')]);return _0x3a458e(_0x542055[_0xfa72('0xc')][_0xfa72('0xf')]);}logger[_0xfa72('0xc')](_0xfa72('0xe'),_0x1671f0,_0x542055[_0xfa72('0xc')][_0xfa72('0xf')]);return _0x4e9f78(_0x542055[_0xfa72('0xc')][_0xfa72('0xf')]);}else{logger[_0xfa72('0x7')](_0xfa72('0xe'),_0x1671f0,_0xfa72('0x8'));_0x4e9f78(_0x542055[_0xfa72('0x10')][_0xfa72('0xf')]);}})[_0xfa72('0x11')](function(_0x41f547){logger[_0xfa72('0xc')](_0xfa72('0xe'),_0x1671f0,_0x41f547);_0x3a458e(_0x41f547);});});} \ No newline at end of file +var _0x6f03=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x6f03,0x174));var _0x36f0=function(_0x5b764c,_0x19d093){_0x5b764c=_0x5b764c-0x0;var _0xc102a6=_0x6f03[_0x5b764c];return _0xc102a6;};'use strict';var _=require(_0x36f0('0x0'));var util=require('util');var moment=require(_0x36f0('0x1'));var BPromise=require(_0x36f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36f0('0x3'));var db=require(_0x36f0('0x4'))['db'];var utils=require(_0x36f0('0x5'));var logger=require(_0x36f0('0x6'))(_0x36f0('0x7'));var config=require('../../config/environment');var jayson=require(_0x36f0('0x8'));var client=jayson[_0x36f0('0x9')][_0x36f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359b3c,_0x248760,_0x332cd5){return new BPromise(function(_0x512952,_0x36678f){return client[_0x36f0('0xb')](_0x359b3c,_0x332cd5)[_0x36f0('0xc')](function(_0x21b555){logger['info'](_0x36f0('0xd'),_0x248760,_0x36f0('0xe'));logger[_0x36f0('0xf')](_0x36f0('0x10'),_0x248760,_0x36f0('0xe'),JSON[_0x36f0('0x11')](_0x21b555));if(_0x21b555['error']){if(_0x21b555[_0x36f0('0x12')]['code']===0x1f4){logger[_0x36f0('0x12')](_0x36f0('0xd'),_0x248760,_0x21b555[_0x36f0('0x12')]['message']);return _0x36678f(_0x21b555[_0x36f0('0x12')]['message']);}logger[_0x36f0('0x12')](_0x36f0('0xd'),_0x248760,_0x21b555['error'][_0x36f0('0x13')]);return _0x512952(_0x21b555[_0x36f0('0x12')][_0x36f0('0x13')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x248760,_0x36f0('0xe'));_0x512952(_0x21b555[_0x36f0('0x14')][_0x36f0('0x13')]);}})[_0x36f0('0x15')](function(_0xf6e81e){logger['error'](_0x36f0('0xd'),_0x248760,_0xf6e81e);_0x36678f(_0xf6e81e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9b1ac79..70fce5a 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 _0xb847=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x44c18f,_0x143a29){var _0x18bd86=function(_0x51afbd){while(--_0x51afbd){_0x44c18f['push'](_0x44c18f['shift']());}};_0x18bd86(++_0x143a29);}(_0xb847,0x15b));var _0x7b84=function(_0x39628c,_0x2eb8c4){_0x39628c=_0x39628c-0x0;var _0x2b0532=_0xb847[_0x39628c];return _0x2b0532;};'use strict';var multer=require('multer');var util=require(_0x7b84('0x0'));var path=require(_0x7b84('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b84('0x2'));var router=express[_0x7b84('0x3')]();var fs_extra=require(_0x7b84('0x4'));var auth=require(_0x7b84('0x5'));var interaction=require(_0x7b84('0x6'));var config=require(_0x7b84('0x7'));var controller=require(_0x7b84('0x8'));router[_0x7b84('0x9')]('/',auth[_0x7b84('0xa')](),controller[_0x7b84('0xb')]);router['get'](_0x7b84('0xc'),auth[_0x7b84('0xa')](),controller[_0x7b84('0xd')]);router['get'](_0x7b84('0xe'),auth['isAuthenticated'](),controller[_0x7b84('0xf')]);router[_0x7b84('0x9')](_0x7b84('0x10'),auth[_0x7b84('0xa')](),controller['getFields']);router[_0x7b84('0x11')]('/',auth[_0x7b84('0xa')](),controller[_0x7b84('0x12')]);router[_0x7b84('0x11')](_0x7b84('0xe'),auth[_0x7b84('0xa')](),controller[_0x7b84('0x13')]);router[_0x7b84('0x14')](_0x7b84('0xc'),auth[_0x7b84('0xa')](),controller['update']);router['delete'](_0x7b84('0xc'),auth[_0x7b84('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9bdf=['get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x270dc8,_0x262811){var _0xcf0e11=function(_0x295b98){while(--_0x295b98){_0x270dc8['push'](_0x270dc8['shift']());}};_0xcf0e11(++_0x262811);}(_0x9bdf,0x1f2));var _0xf9bd=function(_0x8f52c7,_0x10f91c){_0x8f52c7=_0x8f52c7-0x0;var _0x48bb92=_0x9bdf[_0x8f52c7];return _0x48bb92;};'use strict';var multer=require(_0xf9bd('0x0'));var util=require(_0xf9bd('0x1'));var path=require('path');var timeout=require(_0xf9bd('0x2'));var express=require('express');var router=express[_0xf9bd('0x3')]();var fs_extra=require(_0xf9bd('0x4'));var auth=require(_0xf9bd('0x5'));var interaction=require(_0xf9bd('0x6'));var config=require(_0xf9bd('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xf9bd('0x8')]('/',auth[_0xf9bd('0x9')](),controller[_0xf9bd('0xa')]);router[_0xf9bd('0x8')]('/:id',auth[_0xf9bd('0x9')](),controller[_0xf9bd('0xb')]);router[_0xf9bd('0x8')](_0xf9bd('0xc'),auth[_0xf9bd('0x9')](),controller['getConfigurations']);router[_0xf9bd('0x8')](_0xf9bd('0xd'),auth[_0xf9bd('0x9')](),controller[_0xf9bd('0xe')]);router[_0xf9bd('0xf')]('/',auth[_0xf9bd('0x9')](),controller[_0xf9bd('0x10')]);router['post'](_0xf9bd('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xf9bd('0x11')](_0xf9bd('0x12'),auth[_0xf9bd('0x9')](),controller[_0xf9bd('0x13')]);router[_0xf9bd('0x14')]('/:id',auth[_0xf9bd('0x9')](),controller[_0xf9bd('0x15')]);module[_0xf9bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 9304246..75dca9d 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 _0x09f4=['STRING','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09f4,0xe4));var _0x409f=function(_0x50e033,_0x391e5d){_0x50e033=_0x50e033-0x0;var _0x40b17e=_0x09f4[_0x50e033];return _0x40b17e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x409f('0x0')]},'username':{'type':Sequelize[_0x409f('0x0')]},'password':{'type':Sequelize[_0x409f('0x0')]},'remoteUri':{'type':Sequelize[_0x409f('0x0')]},'tenantId':{'type':Sequelize[_0x409f('0x0')]},'clientId':{'type':Sequelize[_0x409f('0x0')]},'clientSecret':{'type':Sequelize[_0x409f('0x0')]},'serverUrl':{'type':Sequelize[_0x409f('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x409f('0x0')]},'modernAuthentication':{'type':Sequelize[_0x409f('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfc9b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x498472,_0x2467ca){var _0x198546=function(_0x3fad29){while(--_0x3fad29){_0x498472['push'](_0x498472['shift']());}};_0x198546(++_0x2467ca);}(_0xfc9b,0x74));var _0xbfc9=function(_0xffc79c,_0x2c4e80){_0xffc79c=_0xffc79c-0x0;var _0x516e02=_0xfc9b[_0xffc79c];return _0x516e02;};'use strict';var Sequelize=require(_0xbfc9('0x0'));module[_0xbfc9('0x1')]={'name':{'type':Sequelize[_0xbfc9('0x2')]},'username':{'type':Sequelize[_0xbfc9('0x2')]},'password':{'type':Sequelize[_0xbfc9('0x2')]},'remoteUri':{'type':Sequelize[_0xbfc9('0x2')]},'tenantId':{'type':Sequelize[_0xbfc9('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xbfc9('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xbfc9('0x2')]},'modernAuthentication':{'type':Sequelize[_0xbfc9('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c233326..d7f9ac9 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 _0x5d37=['AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','getFields','ticketType','Incident','PhoneCall','title','description','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','MetadataId','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','all','statusCode','error','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','true','FalseOption','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','offset','undefined','limit','count','status','set','json','update','then','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','show','params','keys','include','catch','create','body','find','findOne','Dynamics365Configuration','order','getConfigurations','addConfiguration'];(function(_0x6945ca,_0x13d349){var _0x3907c4=function(_0x34f33e){while(--_0x34f33e){_0x6945ca['push'](_0x6945ca['shift']());}};_0x3907c4(++_0x13d349);}(_0x5d37,0x1f2));var _0x75d3=function(_0x588c3a,_0x3aea4b){_0x588c3a=_0x588c3a-0x0;var _0x2a6284=_0x5d37[_0x588c3a];return _0x2a6284;};'use strict';var rp=require(_0x75d3('0x0'));var util=require(_0x75d3('0x1'));var _=require('lodash');var qs=require(_0x75d3('0x2'));var logger=require(_0x75d3('0x3'))(_0x75d3('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0x75d3('0x5'));function respondWithResult(_0x2e5b72,_0x2673e2){_0x2673e2=_0x2673e2||0xc8;return function(_0x16d98e){if(_0x16d98e){return _0x2e5b72['status'](_0x2673e2)['json'](_0x16d98e);}};}function respondWithFilteredResult(_0x1bcb8e,_0x42eb3b){return function(_0xae5697){if(_0xae5697){var _0x2fab67=typeof _0x42eb3b[_0x75d3('0x6')]===_0x75d3('0x7')&&typeof _0x42eb3b[_0x75d3('0x8')]===_0x75d3('0x7');var _0x3c33ac=_0xae5697[_0x75d3('0x9')];var _0x40743e=_0x2fab67?0x0:_0x42eb3b[_0x75d3('0x6')];var _0x4f087e=_0x2fab67?_0xae5697['count']:_0x42eb3b[_0x75d3('0x6')]+_0x42eb3b[_0x75d3('0x8')];var _0x28b512;if(_0x4f087e>=_0x3c33ac){_0x4f087e=_0x3c33ac;_0x28b512=0xc8;}else{_0x28b512=0xce;}_0x1bcb8e[_0x75d3('0xa')](_0x28b512);return _0x1bcb8e[_0x75d3('0xb')]('Content-Range',_0x40743e+'-'+_0x4f087e+'/'+_0x3c33ac)[_0x75d3('0xc')](_0xae5697);}return null;};}function saveUpdates(_0x29b192){return function(_0x4f5a38){if(_0x4f5a38){return _0x4f5a38[_0x75d3('0xd')](_0x29b192)[_0x75d3('0xe')](function(_0x26426f){return _0x26426f;});}return null;};}function removeEntity(_0x34f1c9){return function(_0x36928b){if(_0x36928b){return _0x36928b[_0x75d3('0xf')]()[_0x75d3('0xe')](function(){_0x34f1c9[_0x75d3('0xa')](0xcc)[_0x75d3('0x10')]();});}};}function handleEntityNotFound(_0x323713){return function(_0xa20135){if(!_0xa20135){_0x323713[_0x75d3('0x11')](0x194);}return _0xa20135;};}function handleError(_0x239c08,_0x360270){_0x360270=_0x360270||0x1f4;return function(_0x41be86){logger['error'](_0x41be86[_0x75d3('0x12')]);if(_0x41be86[_0x75d3('0x13')]){delete _0x41be86[_0x75d3('0x13')];}_0x239c08[_0x75d3('0xa')](_0x360270)[_0x75d3('0x14')](_0x41be86);};}exports['index']=function(_0x54050d,_0x1f181e){var _0x549a0c={},_0x105ee8={},_0x1f4974={'count':0x0,'rows':[]};var _0xae142=_[_0x75d3('0x15')](db['Dynamics365Account'][_0x75d3('0x16')],function(_0x25a6cf){return{'name':_0x25a6cf[_0x75d3('0x17')],'type':_0x25a6cf[_0x75d3('0x18')][_0x75d3('0x19')]};});_0x105ee8[_0x75d3('0x1a')]=_[_0x75d3('0x15')](_0xae142,_0x75d3('0x13'));_0x105ee8[_0x75d3('0x1b')]=_['keys'](_0x54050d[_0x75d3('0x1b')]);_0x105ee8['filters']=_[_0x75d3('0x1c')](_0x105ee8[_0x75d3('0x1a')],_0x105ee8[_0x75d3('0x1b')]);_0x549a0c[_0x75d3('0x1d')]=_[_0x75d3('0x1c')](_0x105ee8['model'],qs[_0x75d3('0x1e')](_0x54050d[_0x75d3('0x1b')][_0x75d3('0x1e')]));_0x549a0c[_0x75d3('0x1d')]=_0x549a0c['attributes'][_0x75d3('0x1f')]?_0x549a0c['attributes']:_0x105ee8[_0x75d3('0x1a')];if(!_0x54050d[_0x75d3('0x1b')][_0x75d3('0x20')](_0x75d3('0x21'))){_0x549a0c['limit']=qs[_0x75d3('0x8')](_0x54050d[_0x75d3('0x1b')][_0x75d3('0x8')]);_0x549a0c[_0x75d3('0x6')]=qs[_0x75d3('0x6')](_0x54050d[_0x75d3('0x1b')]['offset']);}_0x549a0c['order']=qs['sort'](_0x54050d['query'][_0x75d3('0x22')]);_0x549a0c[_0x75d3('0x23')]=qs[_0x75d3('0x24')](_[_0x75d3('0x25')](_0x54050d[_0x75d3('0x1b')],_0x105ee8[_0x75d3('0x24')]),_0xae142);if(_0x54050d[_0x75d3('0x1b')][_0x75d3('0x26')]){_0x549a0c[_0x75d3('0x23')]=_[_0x75d3('0x27')](_0x549a0c['where'],{'$or':_[_0x75d3('0x15')](_0xae142,function(_0x4924e7){if(_0x4924e7[_0x75d3('0x18')]!==_0x75d3('0x28')){var _0x2699ba={};_0x2699ba[_0x4924e7['name']]={'$like':'%'+_0x54050d[_0x75d3('0x1b')]['filter']+'%'};return _0x2699ba;}})});}_0x549a0c=_['merge']({},_0x549a0c,_0x54050d[_0x75d3('0x29')]);var _0x396bc3={'where':_0x549a0c[_0x75d3('0x23')]};return db[_0x75d3('0x2a')][_0x75d3('0x9')](_0x396bc3)[_0x75d3('0xe')](function(_0x3f7441){_0x1f4974['count']=_0x3f7441;if(_0x54050d[_0x75d3('0x1b')][_0x75d3('0x2b')]){_0x549a0c['include']=[{'all':!![]}];}return db[_0x75d3('0x2a')]['findAll'](_0x549a0c);})[_0x75d3('0xe')](function(_0x394df2){_0x1f4974['rows']=_0x394df2;return _0x1f4974;})['then'](respondWithFilteredResult(_0x1f181e,_0x549a0c))['catch'](handleError(_0x1f181e,null));};exports[_0x75d3('0x2c')]=function(_0x3473f7,_0x305f11){var _0x5a982c={'raw':![],'where':{'id':_0x3473f7[_0x75d3('0x2d')]['id']}},_0x9f8383={};_0x9f8383[_0x75d3('0x1a')]=_[_0x75d3('0x2e')](db['Dynamics365Account'][_0x75d3('0x16')]);_0x9f8383[_0x75d3('0x1b')]=_['keys'](_0x3473f7['query']);_0x9f8383[_0x75d3('0x24')]=_[_0x75d3('0x1c')](_0x9f8383[_0x75d3('0x1a')],_0x9f8383[_0x75d3('0x1b')]);_0x5a982c[_0x75d3('0x1d')]=_[_0x75d3('0x1c')](_0x9f8383[_0x75d3('0x1a')],qs['fields'](_0x3473f7['query'][_0x75d3('0x1e')]));_0x5a982c['attributes']=_0x5a982c[_0x75d3('0x1d')][_0x75d3('0x1f')]?_0x5a982c['attributes']:_0x9f8383[_0x75d3('0x1a')];if(_0x3473f7['query'][_0x75d3('0x2b')]){_0x5a982c[_0x75d3('0x2f')]=[{'all':!![]}];}_0x5a982c=_['merge']({},_0x5a982c,_0x3473f7[_0x75d3('0x29')]);return db[_0x75d3('0x2a')]['find'](_0x5a982c)['then'](handleEntityNotFound(_0x305f11,null))[_0x75d3('0xe')](respondWithResult(_0x305f11,null))[_0x75d3('0x30')](handleError(_0x305f11,null));};exports[_0x75d3('0x31')]=function(_0x255631,_0x5489bf){return db[_0x75d3('0x2a')][_0x75d3('0x31')](_0x255631['body'],{})[_0x75d3('0xe')](respondWithResult(_0x5489bf,0xc9))[_0x75d3('0x30')](handleError(_0x5489bf,null));};exports[_0x75d3('0xd')]=function(_0x539c66,_0xf26957){if(_0x539c66[_0x75d3('0x32')]['id']){delete _0x539c66[_0x75d3('0x32')]['id'];}return db['Dynamics365Account'][_0x75d3('0x33')]({'where':{'id':_0x539c66['params']['id']}})[_0x75d3('0xe')](handleEntityNotFound(_0xf26957,null))[_0x75d3('0xe')](saveUpdates(_0x539c66[_0x75d3('0x32')],null))[_0x75d3('0xe')](respondWithResult(_0xf26957,null))[_0x75d3('0x30')](handleError(_0xf26957,null));};exports[_0x75d3('0xf')]=function(_0x467bcf,_0x42dbfd){return db[_0x75d3('0x2a')][_0x75d3('0x33')]({'where':{'id':_0x467bcf[_0x75d3('0x2d')]['id']}})[_0x75d3('0xe')](handleEntityNotFound(_0x42dbfd,null))['then'](removeEntity(_0x42dbfd,null))['catch'](handleError(_0x42dbfd,null));};exports['getConfigurations']=function(_0x3a0212,_0x343a34){var _0x42b86e={};var _0x144884={};var _0x479cf6;var _0x27c8e3;return db['Dynamics365Account'][_0x75d3('0x34')]({'where':{'id':_0x3a0212[_0x75d3('0x2d')]['id']}})[_0x75d3('0xe')](handleEntityNotFound(_0x343a34,null))['then'](function(_0x1ce38a){if(_0x1ce38a){_0x479cf6=_0x1ce38a;_0x144884[_0x75d3('0x1a')]=_[_0x75d3('0x2e')](db[_0x75d3('0x35')][_0x75d3('0x16')]);_0x144884[_0x75d3('0x1b')]=_[_0x75d3('0x2e')](_0x3a0212[_0x75d3('0x1b')]);_0x144884[_0x75d3('0x24')]=_[_0x75d3('0x1c')](_0x144884[_0x75d3('0x1a')],_0x144884[_0x75d3('0x1b')]);_0x42b86e['attributes']=_[_0x75d3('0x1c')](_0x144884[_0x75d3('0x1a')],qs[_0x75d3('0x1e')](_0x3a0212[_0x75d3('0x1b')][_0x75d3('0x1e')]));_0x42b86e[_0x75d3('0x1d')]=_0x42b86e['attributes'][_0x75d3('0x1f')]?_0x42b86e[_0x75d3('0x1d')]:_0x144884[_0x75d3('0x1a')];_0x42b86e[_0x75d3('0x36')]=qs['sort'](_0x3a0212[_0x75d3('0x1b')][_0x75d3('0x22')]);_0x42b86e[_0x75d3('0x23')]=qs['filters'](_[_0x75d3('0x25')](_0x3a0212[_0x75d3('0x1b')],_0x144884[_0x75d3('0x24')]));if(_0x3a0212[_0x75d3('0x1b')]['filter']){_0x42b86e[_0x75d3('0x23')]=_[_0x75d3('0x27')](_0x42b86e[_0x75d3('0x23')],{'$or':_[_0x75d3('0x15')](_0x42b86e[_0x75d3('0x1d')],function(_0x3c9c01){var _0x23a313={};_0x23a313[_0x3c9c01]={'$like':'%'+_0x3a0212['query'][_0x75d3('0x26')]+'%'};return _0x23a313;})});}_0x42b86e=_[_0x75d3('0x27')]({},_0x42b86e,_0x3a0212['options']);return _0x479cf6[_0x75d3('0x37')](_0x42b86e);}})[_0x75d3('0xe')](function(_0x309b32){if(_0x309b32){_0x27c8e3=_0x309b32[_0x75d3('0x1f')];if(!_0x3a0212[_0x75d3('0x1b')][_0x75d3('0x20')]('nolimit')){_0x42b86e[_0x75d3('0x8')]=qs[_0x75d3('0x8')](_0x3a0212[_0x75d3('0x1b')]['limit']);_0x42b86e[_0x75d3('0x6')]=qs[_0x75d3('0x6')](_0x3a0212['query'][_0x75d3('0x6')]);}return _0x479cf6[_0x75d3('0x37')](_0x42b86e);}})[_0x75d3('0xe')](function(_0x497c57){if(_0x497c57){return _0x497c57?{'count':_0x27c8e3,'rows':_0x497c57}:null;}})[_0x75d3('0xe')](respondWithResult(_0x343a34,null))[_0x75d3('0x30')](handleError(_0x343a34,null));};exports[_0x75d3('0x38')]=function(_0x3de46e,_0x1f0379){if(_0x3de46e['body']['id']){delete _0x3de46e[_0x75d3('0x32')]['id'];}return db['Dynamics365Account'][_0x75d3('0x34')]({'where':{'id':_0x3de46e[_0x75d3('0x2d')]['id']}})[_0x75d3('0xe')](handleEntityNotFound(_0x1f0379,null))['then'](function(_0x53dede){if(_0x53dede){_0x3de46e[_0x75d3('0x32')][_0x75d3('0x39')]=_0x53dede['id'];_0x3de46e[_0x75d3('0x32')][_0x75d3('0x3a')]=integrations['getSubjects'](_0x3de46e[_0x75d3('0x32')][_0x75d3('0x3b')],_0x3de46e[_0x75d3('0x32')][_0x75d3('0x18')]);_0x3de46e[_0x75d3('0x32')][_0x75d3('0x3c')]=integrations[_0x75d3('0x3d')](_0x3de46e[_0x75d3('0x32')]['channel'],_0x3de46e[_0x75d3('0x32')][_0x75d3('0x18')]);return db['Dynamics365Configuration'][_0x75d3('0x31')](_0x3de46e[_0x75d3('0x32')],{'include':[{'model':db[_0x75d3('0x3e')],'as':_0x75d3('0x3a')},{'model':db['Dynamics365Field'],'as':_0x75d3('0x3c')}]});}return null;})[_0x75d3('0xe')](respondWithResult(_0x1f0379,null))[_0x75d3('0x30')](handleError(_0x1f0379,null));};function sanitizeRemoteUri(_0x5c5429){var _0x10fa5c=_0x5c5429[_0x75d3('0x3f')](-0x1);if(_0x10fa5c==='/')return _0x5c5429[_0x75d3('0x40')](0x0,_0x5c5429['lastIndexOf'](_0x10fa5c));return _0x5c5429;}function getWebApiUrl(_0x4aa679){return util[_0x75d3('0x41')]('%s/api/data/v9.0/',_0x4aa679);}exports[_0x75d3('0x42')]=function(_0x4c38c2,_0x36c7b1){var _0x1c767c=_0x4c38c2[_0x75d3('0x1b')][_0x75d3('0x43')];var _0x40acbb=_0x1c767c==='incident'?_0x75d3('0x44'):_0x75d3('0x45');var _0x5f52b8='';var _0x14b55e='';var _0x59c998='';var _0x3cff79='';var _0x2269aa='';var _0xa17f4d='';var _0x599316='';var _0x141d03='';var _0x594ab9=[_0x75d3('0x46'),_0x75d3('0x47'),'customerid',_0x75d3('0x48'),_0x75d3('0x49'),'subject',_0x75d3('0x4a'),_0x75d3('0x4b'),_0x75d3('0x4c'),_0x75d3('0x4d')];var _0x353004=[_0x75d3('0x4e'),_0x75d3('0x4f'),_0x75d3('0x50'),'billedserviceunits',_0x75d3('0x51'),'contactidyominame',_0x75d3('0x52'),_0x75d3('0x53'),_0x75d3('0x54'),_0x75d3('0x55'),_0x75d3('0x56'),'createdbyyominame',_0x75d3('0x57'),_0x75d3('0x58'),_0x75d3('0x59'),'customeridname',_0x75d3('0x5a'),_0x75d3('0x5b'),_0x75d3('0x5c'),_0x75d3('0x5d'),'entityimage_timestamp',_0x75d3('0x5e'),_0x75d3('0x5f'),_0x75d3('0x60'),_0x75d3('0x61'),_0x75d3('0x62'),_0x75d3('0x63'),_0x75d3('0x64'),'kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame',_0x75d3('0x65'),'modifiedonbehalfbyname',_0x75d3('0x66'),_0x75d3('0x67'),_0x75d3('0x68'),_0x75d3('0x69'),_0x75d3('0x6a'),_0x75d3('0x6b'),_0x75d3('0x6c'),_0x75d3('0x6d'),_0x75d3('0x6e'),_0x75d3('0x6f'),_0x75d3('0x70'),'primarycontactidyominame',_0x75d3('0x71'),_0x75d3('0x72'),_0x75d3('0x73'),_0x75d3('0x74'),_0x75d3('0x75'),_0x75d3('0x76'),_0x75d3('0x77'),_0x75d3('0x78'),_0x75d3('0x79'),_0x75d3('0x7a'),_0x75d3('0x7b'),_0x75d3('0x7c'),'statecode','statuscode',_0x75d3('0x7d'),'ticketnumber',_0x75d3('0x7e'),_0x75d3('0x7f'),'traversedpath',_0x75d3('0x80'),_0x75d3('0x81')];var _0x59a62b=_0x594ab9[_0x75d3('0x82')](_0x353004);return db[_0x75d3('0x2a')][_0x75d3('0x34')]({'where':{'id':_0x4c38c2['params']['id']},'attributes':['id','username','password',_0x75d3('0x83'),_0x75d3('0x84'),_0x75d3('0x85'),_0x75d3('0x86'),_0x75d3('0x87')],'include':[{'model':db[_0x75d3('0x88')],'as':_0x75d3('0x88'),'attributes':['id',_0x75d3('0x89'),'data7']}]})[_0x75d3('0xe')](handleEntityNotFound(_0x36c7b1,null))[_0x75d3('0xe')](function(_0x10850d){if(_0x10850d){if(_0x10850d[_0x75d3('0x87')]){_0x10850d[_0x75d3('0x8a')]=_0x10850d[_0x75d3('0x88')]['data5'];_0x141d03=sanitizeRemoteUri(_0x10850d['CloudProvider'][_0x75d3('0x8b')]);_0x599316=getWebApiUrl(_0x141d03);return _0x10850d;}_0x141d03=sanitizeRemoteUri(_0x10850d[_0x75d3('0x83')]);_0x599316=getWebApiUrl(_0x141d03);var _0x4c857a={'method':_0x75d3('0x8c'),'uri':_0x75d3('0x8d')+_0x10850d[_0x75d3('0x84')]+'/oauth2/token','form':{'client_id':_0x10850d['clientId'],'resource':_0x141d03,'username':_0x10850d['username'],'password':_0x10850d[_0x75d3('0x8e')],'grant_type':_0x75d3('0x8e'),'client_secret':_0x10850d[_0x75d3('0x86')]},'json':!![]};return rp(_0x4c857a);}})['then'](function(_0x38714f){_0xa17f4d=_0x38714f['access_token'];var _0x1c7975={'method':_0x75d3('0x8f'),'uri':encodeURI(_0x599316+_0x75d3('0x90')+_0x40acbb+'\x27'),'headers':{'Authorization':_0x75d3('0x91')+_0xa17f4d,'If-None-Match':null,'OData-Version':_0x75d3('0x92')},'json':!![]};return rp(_0x1c7975);})[_0x75d3('0xe')](function(_0x14b059){var _0x2483a5=_0x14b059[_0x75d3('0x93')][0x0];var _0x1ed262=_0x2483a5['MetadataId'];var _0x26a31f={'method':_0x75d3('0x8f'),'uri':_0x599316+_0x75d3('0x94')+_0x1ed262+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x75d3('0x91')+_0xa17f4d,'If-None-Match':null,'OData-Version':_0x75d3('0x92')},'json':!![]};return rp(_0x26a31f);})['then'](function(_0xc72d8c){_0x5f52b8=_0xc72d8c;_0x14b55e=_0x5f52b8[_0x75d3('0x95')];_0x14b55e=_['remove'](_0x14b55e,function(_0x585d1f){return!_0x59a62b[_0x75d3('0x96')](_0x585d1f[_0x75d3('0x97')]);});var _0x528444=[];var _0x257388=[];_0x14b55e[_0x75d3('0x98')](function(_0x5591ab){if(_0x5591ab[_0x75d3('0x99')]){var _0x30de43=_0x5591ab[_0x75d3('0x99')][_0x75d3('0x40')](_0x5591ab[_0x75d3('0x99')][_0x75d3('0x9a')]('.')+0x1);if(_0x30de43===_0x75d3('0x9b')){_0x528444['push'](getSelectList(_0x599316,_0x1c767c,_0x257388,_0x5f52b8['MetadataId'],_0x5591ab[_0x75d3('0x9c')],_0xa17f4d));}}});return Promise['all'](_0x528444);})[_0x75d3('0xe')](function(_0x397baf){_0x59c998=_0x397baf[0x0];var _0x187766=[];var _0x9ec08a=[];_0x14b55e[_0x75d3('0x98')](function(_0x554b81){if(!_[_0x75d3('0x9d')](_0x554b81['@odata.type'])){var _0x8d9595=_0x554b81[_0x75d3('0x99')][_0x75d3('0x40')](_0x554b81['@odata.type'][_0x75d3('0x9a')]('.')+0x1);if(_0x8d9595==='BooleanAttributeMetadata'){_0x187766[_0x75d3('0x9e')](getBooleanList(_0x599316,_0x1c767c,_0x9ec08a,_0x5f52b8[_0x75d3('0x9c')],_0x554b81[_0x75d3('0x9c')],_0xa17f4d));}}});return Promise['all'](_0x187766);})[_0x75d3('0xe')](function(_0x502219){_0x3cff79=_0x502219[0x0];var _0x4d1984=[];var _0x2a84ca=[];_0x14b55e[_0x75d3('0x98')](function(_0x17a22a){if(_0x17a22a[_0x75d3('0x99')]){var _0x335e07=_0x17a22a['@odata.type']['substring'](_0x17a22a[_0x75d3('0x99')][_0x75d3('0x9a')]('.')+0x1);if(_0x335e07===_0x75d3('0x9f')||_0x335e07===_0x75d3('0xa0')||_0x335e07===_0x75d3('0xa1')||_0x335e07===_0x75d3('0xa2')||_0x335e07===_0x75d3('0xa3')||_0x335e07===_0x75d3('0xa4')||_0x335e07===_0x75d3('0xa5')||_0x335e07===_0x75d3('0xa6')||_0x335e07===_0x75d3('0xa7')||_0x335e07==='DecimalAttributeMetadata'){_0x4d1984[_0x75d3('0x9e')](getInputList(_0x599316,_0x1c767c,_0x335e07,_0x2a84ca,_0x5f52b8['MetadataId'],_0x17a22a[_0x75d3('0x9c')],_0xa17f4d));}}});return Promise[_0x75d3('0xa8')](_0x4d1984);})[_0x75d3('0xe')](function(_0x1851c2){_0x2269aa=_0x1851c2[0x0];var _0x963b5e=_0x59c998[_0x75d3('0x82')](_0x3cff79)[_0x75d3('0x82')](_0x2269aa);var _0x5d7b9f={'count':_0x963b5e[_0x75d3('0x1f')],'rows':_0x963b5e};return _0x5d7b9f;})[_0x75d3('0xe')](respondWithResult(_0x36c7b1,null))[_0x75d3('0x30')](function(_0xdfd47b){var _0x2be646=_0x4c38c2[_0x75d3('0x1b')]['test']?0x1f4:_0xdfd47b[_0x75d3('0xa9')]||0x1f4;logger[_0x75d3('0xaa')](_0xdfd47b[_0x75d3('0x12')]);delete _0xdfd47b[_0x75d3('0x13')];if(_0x2be646===0x191){_0x2be646=0x190;}_0x36c7b1[_0x75d3('0xa')](_0x2be646)['send'](_0x4c38c2[_0x75d3('0x1b')][_0x75d3('0xab')]?{'message':_0x75d3('0xac'),'statusCode':_0xdfd47b[_0x75d3('0xa9')]}:_0xdfd47b);});};function getSelectList(_0x305e7b,_0x29f4f3,_0x2fcd8c,_0x42b579,_0xe3e338,_0x474118){var _0x121cf0={'method':_0x75d3('0x8f'),'uri':_0x305e7b+_0x75d3('0x94')+_0x42b579+_0x75d3('0xad')+_0xe3e338+_0x75d3('0xae')+_0x75d3('0xaf'),'headers':{'Authorization':_0x75d3('0x91')+_0x474118,'If-None-Match':null,'OData-Version':_0x75d3('0x92')},'json':!![]};return rp(_0x121cf0)[_0x75d3('0xe')](function(_0x4eb9c7){var _0xc462fb=[];var _0x53851d=_0x4eb9c7[_0x75d3('0xb0')][_0x75d3('0xb1')];_0x53851d[_0x75d3('0x98')](function(_0x229a71){_0xc462fb[_0x75d3('0x9e')]({'name':_0x229a71[_0x75d3('0xb2')][_0x75d3('0xb3')][_0x75d3('0xb2')],'value':String(_0x229a71[_0x75d3('0xb4')])});});var _0xbf983a={'id':_0x29f4f3+'_'+_0x4eb9c7[_0x75d3('0x97')],'name':_0x4eb9c7[_0x75d3('0xb5')]['UserLocalizedLabel'][_0x75d3('0xb2')],'custom':![],'options':_0xc462fb};_0x2fcd8c[_0x75d3('0x9e')](_0xbf983a);return _0x2fcd8c;});}function getBooleanList(_0xe85003,_0x5d6d79,_0x16819e,_0x15dd90,_0x10a987,_0x34da24){var _0x1d2b65={'method':_0x75d3('0x8f'),'uri':_0xe85003+_0x75d3('0x94')+_0x15dd90+')/Attributes('+_0x10a987+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x34da24,'If-None-Match':null,'OData-Version':_0x75d3('0x92')},'json':!![]};return rp(_0x1d2b65)[_0x75d3('0xe')](function(_0x3bdf31){var _0x49df9c=[];_0x49df9c['push']({'name':_0x3bdf31[_0x75d3('0xb0')]['TrueOption'][_0x75d3('0xb2')][_0x75d3('0xb3')][_0x75d3('0xb2')],'value':_0x75d3('0xb6')},{'name':_0x3bdf31[_0x75d3('0xb0')][_0x75d3('0xb7')][_0x75d3('0xb2')][_0x75d3('0xb3')][_0x75d3('0xb2')],'value':'false'});var _0x57d9de={'id':_0x5d6d79+'_'+_0x3bdf31[_0x75d3('0x97')],'name':_0x3bdf31[_0x75d3('0xb5')][_0x75d3('0xb3')][_0x75d3('0xb2')],'custom':![],'options':_0x49df9c};_0x16819e[_0x75d3('0x9e')](_0x57d9de);return _0x16819e;});}function getInputList(_0x32c781,_0x32adbf,_0x3a91f4,_0x3ddf3a,_0x5e8dd3,_0x43528c,_0x1a060a){var _0x4abec5={'method':_0x75d3('0x8f'),'uri':_0x32c781+_0x75d3('0x94')+_0x5e8dd3+_0x75d3('0xad')+_0x43528c+')/Microsoft.Dynamics.CRM.'+_0x3a91f4+_0x75d3('0xb8'),'headers':{'Authorization':_0x75d3('0x91')+_0x1a060a,'If-None-Match':null,'OData-Version':_0x75d3('0x92')},'json':!![]};return rp(_0x4abec5)[_0x75d3('0xe')](function(_0xba882){var _0x492115={'id':_0x32adbf+'_'+_0xba882[_0x75d3('0x97')],'name':_0xba882[_0x75d3('0xb5')][_0x75d3('0xb3')]?_0xba882['DisplayName'][_0x75d3('0xb3')][_0x75d3('0xb2')]:_0xba882[_0x75d3('0x97')],'custom':![],'options':[]};_0x3ddf3a[_0x75d3('0x9e')](_0x492115);return _0x3ddf3a;});} \ No newline at end of file +var _0x2d93=['sentimentvalue','slainvokedidname','statuscode','ticketnumber','transactioncurrencyidname','concat','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','update','then','destroy','end','sendStatus','error','stack','name','send','index','Dynamics365Account','fieldName','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','type','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','customerid','caseorigincode','subject','phonenumber','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname'];(function(_0x276880,_0x33a6cc){var _0x2b9207=function(_0x14c558){while(--_0x14c558){_0x276880['push'](_0x276880['shift']());}};_0x2b9207(++_0x33a6cc);}(_0x2d93,0xf3));var _0x32d9=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x2d93[_0x386c3e];return _0x4b8e13;};'use strict';var rp=require(_0x32d9('0x0'));var util=require(_0x32d9('0x1'));var _=require(_0x32d9('0x2'));var qs=require(_0x32d9('0x3'));var logger=require(_0x32d9('0x4'))(_0x32d9('0x5'));var db=require(_0x32d9('0x6'))['db'];var integrations=require(_0x32d9('0x7'));function respondWithResult(_0x395372,_0x80afe8){_0x80afe8=_0x80afe8||0xc8;return function(_0x423f4d){if(_0x423f4d){return _0x395372[_0x32d9('0x8')](_0x80afe8)[_0x32d9('0x9')](_0x423f4d);}};}function respondWithFilteredResult(_0x3529db,_0x4d2424){return function(_0x161a9f){if(_0x161a9f){var _0x12c49f=typeof _0x4d2424[_0x32d9('0xa')]===_0x32d9('0xb')&&typeof _0x4d2424[_0x32d9('0xc')]==='undefined';var _0x21df58=_0x161a9f[_0x32d9('0xd')];var _0x1d5f25=_0x12c49f?0x0:_0x4d2424[_0x32d9('0xa')];var _0x2babbf=_0x12c49f?_0x161a9f[_0x32d9('0xd')]:_0x4d2424[_0x32d9('0xa')]+_0x4d2424[_0x32d9('0xc')];var _0x2875cf;if(_0x2babbf>=_0x21df58){_0x2babbf=_0x21df58;_0x2875cf=0xc8;}else{_0x2875cf=0xce;}_0x3529db[_0x32d9('0x8')](_0x2875cf);return _0x3529db[_0x32d9('0xe')]('Content-Range',_0x1d5f25+'-'+_0x2babbf+'/'+_0x21df58)['json'](_0x161a9f);}return null;};}function saveUpdates(_0x16e983){return function(_0x3ae057){if(_0x3ae057){return _0x3ae057[_0x32d9('0xf')](_0x16e983)[_0x32d9('0x10')](function(_0x460eb9){return _0x460eb9;});}return null;};}function removeEntity(_0x3b1d99){return function(_0x9a0f21){if(_0x9a0f21){return _0x9a0f21[_0x32d9('0x11')]()[_0x32d9('0x10')](function(){_0x3b1d99[_0x32d9('0x8')](0xcc)[_0x32d9('0x12')]();});}};}function handleEntityNotFound(_0x428821){return function(_0x5ebcab){if(!_0x5ebcab){_0x428821[_0x32d9('0x13')](0x194);}return _0x5ebcab;};}function handleError(_0x28cc2a,_0x558d64){_0x558d64=_0x558d64||0x1f4;return function(_0x24ab70){logger[_0x32d9('0x14')](_0x24ab70[_0x32d9('0x15')]);if(_0x24ab70[_0x32d9('0x16')]){delete _0x24ab70[_0x32d9('0x16')];}_0x28cc2a[_0x32d9('0x8')](_0x558d64)[_0x32d9('0x17')](_0x24ab70);};}exports[_0x32d9('0x18')]=function(_0x1b006a,_0x213980){var _0x543607={},_0x599bdc={},_0x43e296={'count':0x0,'rows':[]};var _0x34d483=_['map'](db[_0x32d9('0x19')]['rawAttributes'],function(_0x3db7e3){return{'name':_0x3db7e3[_0x32d9('0x1a')],'type':_0x3db7e3['type']['key']};});_0x599bdc[_0x32d9('0x1b')]=_[_0x32d9('0x1c')](_0x34d483,'name');_0x599bdc['query']=_[_0x32d9('0x1d')](_0x1b006a[_0x32d9('0x1e')]);_0x599bdc[_0x32d9('0x1f')]=_[_0x32d9('0x20')](_0x599bdc[_0x32d9('0x1b')],_0x599bdc['query']);_0x543607[_0x32d9('0x21')]=_[_0x32d9('0x20')](_0x599bdc[_0x32d9('0x1b')],qs[_0x32d9('0x22')](_0x1b006a['query'][_0x32d9('0x22')]));_0x543607[_0x32d9('0x21')]=_0x543607[_0x32d9('0x21')]['length']?_0x543607[_0x32d9('0x21')]:_0x599bdc[_0x32d9('0x1b')];if(!_0x1b006a[_0x32d9('0x1e')][_0x32d9('0x23')]('nolimit')){_0x543607[_0x32d9('0xc')]=qs[_0x32d9('0xc')](_0x1b006a[_0x32d9('0x1e')][_0x32d9('0xc')]);_0x543607['offset']=qs['offset'](_0x1b006a['query'][_0x32d9('0xa')]);}_0x543607[_0x32d9('0x24')]=qs[_0x32d9('0x25')](_0x1b006a['query'][_0x32d9('0x25')]);_0x543607[_0x32d9('0x26')]=qs['filters'](_[_0x32d9('0x27')](_0x1b006a[_0x32d9('0x1e')],_0x599bdc[_0x32d9('0x1f')]),_0x34d483);if(_0x1b006a[_0x32d9('0x1e')][_0x32d9('0x28')]){_0x543607['where']=_[_0x32d9('0x29')](_0x543607[_0x32d9('0x26')],{'$or':_[_0x32d9('0x1c')](_0x34d483,function(_0x1dc799){if(_0x1dc799['type']!==_0x32d9('0x2a')){var _0x4bc713={};_0x4bc713[_0x1dc799[_0x32d9('0x16')]]={'$like':'%'+_0x1b006a[_0x32d9('0x1e')][_0x32d9('0x28')]+'%'};return _0x4bc713;}})});}_0x543607=_[_0x32d9('0x29')]({},_0x543607,_0x1b006a[_0x32d9('0x2b')]);var _0x245787={'where':_0x543607[_0x32d9('0x26')]};return db[_0x32d9('0x19')][_0x32d9('0xd')](_0x245787)['then'](function(_0x3302d0){_0x43e296[_0x32d9('0xd')]=_0x3302d0;if(_0x1b006a[_0x32d9('0x1e')][_0x32d9('0x2c')]){_0x543607[_0x32d9('0x2d')]=[{'all':!![]}];}return db[_0x32d9('0x19')][_0x32d9('0x2e')](_0x543607);})[_0x32d9('0x10')](function(_0x240157){_0x43e296[_0x32d9('0x2f')]=_0x240157;return _0x43e296;})['then'](respondWithFilteredResult(_0x213980,_0x543607))['catch'](handleError(_0x213980,null));};exports[_0x32d9('0x30')]=function(_0x19b2f6,_0x27e7d8){var _0x115911={'raw':![],'where':{'id':_0x19b2f6[_0x32d9('0x31')]['id']}},_0x3844ef={};_0x3844ef[_0x32d9('0x1b')]=_[_0x32d9('0x1d')](db[_0x32d9('0x19')][_0x32d9('0x32')]);_0x3844ef['query']=_[_0x32d9('0x1d')](_0x19b2f6['query']);_0x3844ef['filters']=_[_0x32d9('0x20')](_0x3844ef[_0x32d9('0x1b')],_0x3844ef['query']);_0x115911[_0x32d9('0x21')]=_['intersection'](_0x3844ef[_0x32d9('0x1b')],qs[_0x32d9('0x22')](_0x19b2f6[_0x32d9('0x1e')]['fields']));_0x115911[_0x32d9('0x21')]=_0x115911[_0x32d9('0x21')][_0x32d9('0x33')]?_0x115911[_0x32d9('0x21')]:_0x3844ef[_0x32d9('0x1b')];if(_0x19b2f6[_0x32d9('0x1e')][_0x32d9('0x2c')]){_0x115911[_0x32d9('0x2d')]=[{'all':!![]}];}_0x115911=_['merge']({},_0x115911,_0x19b2f6['options']);return db[_0x32d9('0x19')][_0x32d9('0x34')](_0x115911)['then'](handleEntityNotFound(_0x27e7d8,null))[_0x32d9('0x10')](respondWithResult(_0x27e7d8,null))[_0x32d9('0x35')](handleError(_0x27e7d8,null));};exports[_0x32d9('0x36')]=function(_0x261c27,_0x4beff9){return db['Dynamics365Account'][_0x32d9('0x36')](_0x261c27[_0x32d9('0x37')],{})[_0x32d9('0x10')](respondWithResult(_0x4beff9,0xc9))[_0x32d9('0x35')](handleError(_0x4beff9,null));};exports[_0x32d9('0xf')]=function(_0x2df736,_0x2090e0){if(_0x2df736[_0x32d9('0x37')]['id']){delete _0x2df736[_0x32d9('0x37')]['id'];}return db[_0x32d9('0x19')]['find']({'where':{'id':_0x2df736[_0x32d9('0x31')]['id']}})['then'](handleEntityNotFound(_0x2090e0,null))[_0x32d9('0x10')](saveUpdates(_0x2df736[_0x32d9('0x37')],null))[_0x32d9('0x10')](respondWithResult(_0x2090e0,null))['catch'](handleError(_0x2090e0,null));};exports['destroy']=function(_0x4f6139,_0x386808){return db[_0x32d9('0x19')]['find']({'where':{'id':_0x4f6139[_0x32d9('0x31')]['id']}})['then'](handleEntityNotFound(_0x386808,null))[_0x32d9('0x10')](removeEntity(_0x386808,null))['catch'](handleError(_0x386808,null));};exports[_0x32d9('0x38')]=function(_0x33cf20,_0x186371){var _0x17dc5c={};var _0xadc374={};var _0x53bc08;var _0x2a2232;return db[_0x32d9('0x19')][_0x32d9('0x39')]({'where':{'id':_0x33cf20['params']['id']}})[_0x32d9('0x10')](handleEntityNotFound(_0x186371,null))[_0x32d9('0x10')](function(_0x24d827){if(_0x24d827){_0x53bc08=_0x24d827;_0xadc374[_0x32d9('0x1b')]=_[_0x32d9('0x1d')](db['Dynamics365Configuration'][_0x32d9('0x32')]);_0xadc374[_0x32d9('0x1e')]=_[_0x32d9('0x1d')](_0x33cf20[_0x32d9('0x1e')]);_0xadc374['filters']=_['intersection'](_0xadc374[_0x32d9('0x1b')],_0xadc374[_0x32d9('0x1e')]);_0x17dc5c[_0x32d9('0x21')]=_[_0x32d9('0x20')](_0xadc374[_0x32d9('0x1b')],qs[_0x32d9('0x22')](_0x33cf20[_0x32d9('0x1e')][_0x32d9('0x22')]));_0x17dc5c['attributes']=_0x17dc5c[_0x32d9('0x21')][_0x32d9('0x33')]?_0x17dc5c[_0x32d9('0x21')]:_0xadc374['model'];_0x17dc5c['order']=qs[_0x32d9('0x25')](_0x33cf20[_0x32d9('0x1e')][_0x32d9('0x25')]);_0x17dc5c[_0x32d9('0x26')]=qs[_0x32d9('0x1f')](_[_0x32d9('0x27')](_0x33cf20['query'],_0xadc374['filters']));if(_0x33cf20[_0x32d9('0x1e')][_0x32d9('0x28')]){_0x17dc5c['where']=_[_0x32d9('0x29')](_0x17dc5c[_0x32d9('0x26')],{'$or':_['map'](_0x17dc5c[_0x32d9('0x21')],function(_0x38be46){var _0xafa557={};_0xafa557[_0x38be46]={'$like':'%'+_0x33cf20[_0x32d9('0x1e')][_0x32d9('0x28')]+'%'};return _0xafa557;})});}_0x17dc5c=_[_0x32d9('0x29')]({},_0x17dc5c,_0x33cf20['options']);return _0x53bc08[_0x32d9('0x38')](_0x17dc5c);}})[_0x32d9('0x10')](function(_0x3754d6){if(_0x3754d6){_0x2a2232=_0x3754d6[_0x32d9('0x33')];if(!_0x33cf20[_0x32d9('0x1e')]['hasOwnProperty'](_0x32d9('0x3a'))){_0x17dc5c[_0x32d9('0xc')]=qs[_0x32d9('0xc')](_0x33cf20[_0x32d9('0x1e')][_0x32d9('0xc')]);_0x17dc5c[_0x32d9('0xa')]=qs[_0x32d9('0xa')](_0x33cf20['query'][_0x32d9('0xa')]);}return _0x53bc08[_0x32d9('0x38')](_0x17dc5c);}})[_0x32d9('0x10')](function(_0x32649a){if(_0x32649a){return _0x32649a?{'count':_0x2a2232,'rows':_0x32649a}:null;}})['then'](respondWithResult(_0x186371,null))['catch'](handleError(_0x186371,null));};exports[_0x32d9('0x3b')]=function(_0x18d580,_0x410576){if(_0x18d580[_0x32d9('0x37')]['id']){delete _0x18d580['body']['id'];}return db[_0x32d9('0x19')][_0x32d9('0x39')]({'where':{'id':_0x18d580['params']['id']}})[_0x32d9('0x10')](handleEntityNotFound(_0x410576,null))['then'](function(_0x5dfe71){if(_0x5dfe71){_0x18d580[_0x32d9('0x37')][_0x32d9('0x3c')]=_0x5dfe71['id'];_0x18d580[_0x32d9('0x37')][_0x32d9('0x3d')]=integrations['getSubjects'](_0x18d580[_0x32d9('0x37')][_0x32d9('0x3e')],_0x18d580['body']['type']);_0x18d580[_0x32d9('0x37')][_0x32d9('0x3f')]=integrations[_0x32d9('0x40')](_0x18d580['body'][_0x32d9('0x3e')],_0x18d580[_0x32d9('0x37')][_0x32d9('0x41')]);return db[_0x32d9('0x42')][_0x32d9('0x36')](_0x18d580[_0x32d9('0x37')],{'include':[{'model':db['Dynamics365Field'],'as':_0x32d9('0x3d')},{'model':db[_0x32d9('0x43')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x410576,null))[_0x32d9('0x35')](handleError(_0x410576,null));};function sanitizeRemoteUri(_0x19c616){var _0x184dd8=_0x19c616[_0x32d9('0x44')](-0x1);if(_0x184dd8==='/')return _0x19c616[_0x32d9('0x45')](0x0,_0x19c616[_0x32d9('0x46')](_0x184dd8));return _0x19c616;}function getWebApiUrl(_0x55ebe1){return util[_0x32d9('0x47')](_0x32d9('0x48'),_0x55ebe1);}exports[_0x32d9('0x49')]=function(_0x3e137,_0x4ff60e){var _0x38a176=_0x3e137[_0x32d9('0x1e')]['ticketType'];var _0x56a88d=_0x38a176===_0x32d9('0x4a')?_0x32d9('0x4b'):_0x32d9('0x4c');var _0x17f450='';var _0x5e3d4f='';var _0x4d9416='';var _0x7f767a='';var _0xf0460b='';var _0x155e98='';var _0x517d86='';var _0x64c706='';var _0x675286=[_0x32d9('0x4d'),'description',_0x32d9('0x4e'),'ownerid',_0x32d9('0x4f'),_0x32d9('0x50'),_0x32d9('0x51'),'regardingobjectid','directioncode',_0x32d9('0x52')];var _0x2b0db3=['accountidname',_0x32d9('0x53'),_0x32d9('0x54'),_0x32d9('0x55'),'contactidname',_0x32d9('0x56'),'contractdetailidname',_0x32d9('0x57'),'createdbyexternalpartyname',_0x32d9('0x58'),_0x32d9('0x59'),'createdbyyominame','createdon',_0x32d9('0x5a'),_0x32d9('0x5b'),_0x32d9('0x5c'),_0x32d9('0x5d'),_0x32d9('0x5e'),_0x32d9('0x5f'),_0x32d9('0x60'),_0x32d9('0x61'),_0x32d9('0x62'),'escalatedon','exchangerate',_0x32d9('0x63'),_0x32d9('0x64'),_0x32d9('0x65'),_0x32d9('0x66'),_0x32d9('0x67'),_0x32d9('0x68'),_0x32d9('0x69'),'modifiedbyexternalpartyname',_0x32d9('0x6a'),_0x32d9('0x6b'),_0x32d9('0x6c'),_0x32d9('0x6d'),_0x32d9('0x6e'),_0x32d9('0x6f'),_0x32d9('0x70'),_0x32d9('0x71'),'numberofchildincidents',_0x32d9('0x72'),'overriddencreatedon','owneridname',_0x32d9('0x73'),'owneridyominame',_0x32d9('0x74'),_0x32d9('0x75'),_0x32d9('0x76'),_0x32d9('0x77'),_0x32d9('0x78'),_0x32d9('0x79'),_0x32d9('0x7a'),_0x32d9('0x7b'),'responseby',_0x32d9('0x7c'),'responsiblecontactidyominame',_0x32d9('0x7d'),_0x32d9('0x7e'),'slaname','socialprofileidname','statecode',_0x32d9('0x7f'),'subjectidname',_0x32d9('0x80'),'timezoneruleversionnumber',_0x32d9('0x81'),'traversedpath','utcconversiontimezonecode','versionnumber'];var _0x199b19=_0x675286[_0x32d9('0x82')](_0x2b0db3);return db['Dynamics365Account'][_0x32d9('0x39')]({'where':{'id':_0x3e137[_0x32d9('0x31')]['id']},'attributes':['id','username',_0x32d9('0x83'),_0x32d9('0x84'),_0x32d9('0x85'),_0x32d9('0x86'),'clientSecret',_0x32d9('0x87')],'include':[{'model':db[_0x32d9('0x88')],'as':_0x32d9('0x88'),'attributes':['id',_0x32d9('0x89'),_0x32d9('0x8a')]}]})[_0x32d9('0x10')](handleEntityNotFound(_0x4ff60e,null))[_0x32d9('0x10')](function(_0x157cbf){if(_0x157cbf){if(_0x157cbf['modernAuthentication']){_0x157cbf[_0x32d9('0x8b')]=_0x157cbf['CloudProvider']['data5'];_0x64c706=sanitizeRemoteUri(_0x157cbf['CloudProvider']['data7']);_0x517d86=getWebApiUrl(_0x64c706);return _0x157cbf;}_0x64c706=sanitizeRemoteUri(_0x157cbf[_0x32d9('0x84')]);_0x517d86=getWebApiUrl(_0x64c706);var _0x502f1d={'method':_0x32d9('0x8c'),'uri':_0x32d9('0x8d')+_0x157cbf[_0x32d9('0x85')]+_0x32d9('0x8e'),'form':{'client_id':_0x157cbf[_0x32d9('0x86')],'resource':_0x64c706,'username':_0x157cbf[_0x32d9('0x8f')],'password':_0x157cbf[_0x32d9('0x83')],'grant_type':_0x32d9('0x83'),'client_secret':_0x157cbf['clientSecret']},'json':!![]};return rp(_0x502f1d);}})[_0x32d9('0x10')](function(_0x5c82e8){_0x155e98=_0x5c82e8[_0x32d9('0x8b')];var _0x1096a7={'method':_0x32d9('0x90'),'uri':encodeURI(_0x517d86+_0x32d9('0x91')+_0x56a88d+'\x27'),'headers':{'Authorization':_0x32d9('0x92')+_0x155e98,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1096a7);})[_0x32d9('0x10')](function(_0x161b27){var _0x110a7d=_0x161b27[_0x32d9('0x93')][0x0];var _0x1faca1=_0x110a7d[_0x32d9('0x94')];var _0x4da374={'method':'GET','uri':_0x517d86+_0x32d9('0x95')+_0x1faca1+_0x32d9('0x96'),'headers':{'Authorization':_0x32d9('0x92')+_0x155e98,'If-None-Match':null,'OData-Version':_0x32d9('0x97')},'json':!![]};return rp(_0x4da374);})[_0x32d9('0x10')](function(_0x37b109){_0x17f450=_0x37b109;_0x5e3d4f=_0x17f450[_0x32d9('0x98')];_0x5e3d4f=_[_0x32d9('0x99')](_0x5e3d4f,function(_0xb7595a){return!_0x199b19[_0x32d9('0x9a')](_0xb7595a[_0x32d9('0x9b')]);});var _0x27d4e4=[];var _0x32c91a=[];_0x5e3d4f[_0x32d9('0x9c')](function(_0x166111){if(_0x166111[_0x32d9('0x9d')]){var _0x1376b4=_0x166111['@odata.type'][_0x32d9('0x45')](_0x166111[_0x32d9('0x9d')][_0x32d9('0x46')]('.')+0x1);if(_0x1376b4===_0x32d9('0x9e')){_0x27d4e4[_0x32d9('0x9f')](getSelectList(_0x517d86,_0x38a176,_0x32c91a,_0x17f450[_0x32d9('0x94')],_0x166111[_0x32d9('0x94')],_0x155e98));}}});return Promise['all'](_0x27d4e4);})[_0x32d9('0x10')](function(_0x4a964a){_0x4d9416=_0x4a964a[0x0];var _0x28dffd=[];var _0x78fcbf=[];_0x5e3d4f[_0x32d9('0x9c')](function(_0x51fc9b){if(!_[_0x32d9('0xa0')](_0x51fc9b[_0x32d9('0x9d')])){var _0x4e3a23=_0x51fc9b[_0x32d9('0x9d')][_0x32d9('0x45')](_0x51fc9b[_0x32d9('0x9d')][_0x32d9('0x46')]('.')+0x1);if(_0x4e3a23===_0x32d9('0xa1')){_0x28dffd[_0x32d9('0x9f')](getBooleanList(_0x517d86,_0x38a176,_0x78fcbf,_0x17f450[_0x32d9('0x94')],_0x51fc9b[_0x32d9('0x94')],_0x155e98));}}});return Promise[_0x32d9('0xa2')](_0x28dffd);})[_0x32d9('0x10')](function(_0xc713d3){_0x7f767a=_0xc713d3[0x0];var _0x44ef70=[];var _0x400184=[];_0x5e3d4f[_0x32d9('0x9c')](function(_0x293693){if(_0x293693['@odata.type']){var _0x36307e=_0x293693[_0x32d9('0x9d')][_0x32d9('0x45')](_0x293693[_0x32d9('0x9d')]['lastIndexOf']('.')+0x1);if(_0x36307e===_0x32d9('0xa3')||_0x36307e===_0x32d9('0xa4')||_0x36307e===_0x32d9('0xa5')||_0x36307e===_0x32d9('0xa6')||_0x36307e===_0x32d9('0xa7')||_0x36307e===_0x32d9('0xa8')||_0x36307e==='StatusAttributeMetadata'||_0x36307e===_0x32d9('0xa9')||_0x36307e===_0x32d9('0xaa')||_0x36307e==='DecimalAttributeMetadata'){_0x44ef70['push'](getInputList(_0x517d86,_0x38a176,_0x36307e,_0x400184,_0x17f450[_0x32d9('0x94')],_0x293693[_0x32d9('0x94')],_0x155e98));}}});return Promise[_0x32d9('0xa2')](_0x44ef70);})['then'](function(_0x2cc671){_0xf0460b=_0x2cc671[0x0];var _0xc40116=_0x4d9416[_0x32d9('0x82')](_0x7f767a)[_0x32d9('0x82')](_0xf0460b);var _0x1e2483={'count':_0xc40116[_0x32d9('0x33')],'rows':_0xc40116};return _0x1e2483;})[_0x32d9('0x10')](respondWithResult(_0x4ff60e,null))['catch'](function(_0x29b911){var _0x511c38=_0x3e137['query'][_0x32d9('0xab')]?0x1f4:_0x29b911[_0x32d9('0xac')]||0x1f4;logger['error'](_0x29b911['stack']);delete _0x29b911[_0x32d9('0x16')];if(_0x511c38===0x191){_0x511c38=0x190;}_0x4ff60e[_0x32d9('0x8')](_0x511c38)[_0x32d9('0x17')](_0x3e137['query'][_0x32d9('0xab')]?{'message':_0x32d9('0xad'),'statusCode':_0x29b911[_0x32d9('0xac')]}:_0x29b911);});};function getSelectList(_0x1e055e,_0x32b011,_0x435993,_0x4bb137,_0xaa266f,_0x443a16){var _0x1fa63b={'method':'GET','uri':_0x1e055e+_0x32d9('0x95')+_0x4bb137+_0x32d9('0xae')+_0xaa266f+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x32d9('0x92')+_0x443a16,'If-None-Match':null,'OData-Version':_0x32d9('0x97')},'json':!![]};return rp(_0x1fa63b)[_0x32d9('0x10')](function(_0x2a1de0){var _0x3e9f50=[];var _0x461071=_0x2a1de0[_0x32d9('0xaf')][_0x32d9('0xb0')];_0x461071[_0x32d9('0x9c')](function(_0xcabef5){_0x3e9f50[_0x32d9('0x9f')]({'name':_0xcabef5[_0x32d9('0xb1')][_0x32d9('0xb2')][_0x32d9('0xb1')],'value':String(_0xcabef5[_0x32d9('0xb3')])});});var _0xa2bf72={'id':_0x32b011+'_'+_0x2a1de0[_0x32d9('0x9b')],'name':_0x2a1de0[_0x32d9('0xb4')][_0x32d9('0xb2')][_0x32d9('0xb1')],'custom':![],'options':_0x3e9f50};_0x435993[_0x32d9('0x9f')](_0xa2bf72);return _0x435993;});}function getBooleanList(_0x2c15fe,_0x5f07b5,_0x460e82,_0x4667ab,_0x560e62,_0x29dc11){var _0x35fe87={'method':'GET','uri':_0x2c15fe+'EntityDefinitions('+_0x4667ab+_0x32d9('0xae')+_0x560e62+_0x32d9('0xb5'),'headers':{'Authorization':_0x32d9('0x92')+_0x29dc11,'If-None-Match':null,'OData-Version':_0x32d9('0x97')},'json':!![]};return rp(_0x35fe87)['then'](function(_0x4ee997){var _0x5d086f=[];_0x5d086f[_0x32d9('0x9f')]({'name':_0x4ee997[_0x32d9('0xaf')]['TrueOption'][_0x32d9('0xb1')][_0x32d9('0xb2')][_0x32d9('0xb1')],'value':'true'},{'name':_0x4ee997[_0x32d9('0xaf')]['FalseOption'][_0x32d9('0xb1')][_0x32d9('0xb2')]['Label'],'value':'false'});var _0x38cfe7={'id':_0x5f07b5+'_'+_0x4ee997[_0x32d9('0x9b')],'name':_0x4ee997[_0x32d9('0xb4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x5d086f};_0x460e82[_0x32d9('0x9f')](_0x38cfe7);return _0x460e82;});}function getInputList(_0x306fc4,_0x3bb3f0,_0x2b4410,_0x1ad210,_0x28fefd,_0x1cb524,_0x1699f8){var _0x37c6a6={'method':_0x32d9('0x90'),'uri':_0x306fc4+_0x32d9('0x95')+_0x28fefd+_0x32d9('0xae')+_0x1cb524+_0x32d9('0xb6')+_0x2b4410+_0x32d9('0xb7'),'headers':{'Authorization':_0x32d9('0x92')+_0x1699f8,'If-None-Match':null,'OData-Version':_0x32d9('0x97')},'json':!![]};return rp(_0x37c6a6)[_0x32d9('0x10')](function(_0x33cfbd){var _0x219566={'id':_0x3bb3f0+'_'+_0x33cfbd[_0x32d9('0x9b')],'name':_0x33cfbd[_0x32d9('0xb4')]['UserLocalizedLabel']?_0x33cfbd['DisplayName'][_0x32d9('0xb2')][_0x32d9('0xb1')]:_0x33cfbd[_0x32d9('0x9b')],'custom':![],'options':[]};_0x1ad210[_0x32d9('0x9f')](_0x219566);return _0x1ad210;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1235d1e..a8574f1 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x2da06d,_0x54035a){var _0x1e752f=function(_0x30c01b){while(--_0x30c01b){_0x2da06d['push'](_0x2da06d['shift']());}};_0x1e752f(++_0x54035a);}(_0x757a,0xde));var _0xa757=function(_0xad720d,_0x275382){_0xad720d=_0xad720d-0x0;var _0x930114=_0x757a[_0xad720d];return _0x930114;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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(_0x336772,_0xa1cb7a){var _0x133943=function(_0x481912){while(--_0x481912){_0x336772['push'](_0x336772['shift']());}};_0x133943(++_0xa1cb7a);}(_0xe706,0xa3));var _0x6e70=function(_0x4b64a4,_0x1bdc50){_0x4b64a4=_0x4b64a4-0x0;var _0xd19b0e=_0xe706[_0x4b64a4];return _0xd19b0e;};'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 37190ff..91bf1f9 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 _0x786a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','request','then','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','Dynamics365Account','findAll','options','raw','attributes','include','map','model','GetDynamics365Account','ShowDynamics365Account','where','moment'];(function(_0x4ee806,_0x249222){var _0x1670d6=function(_0x569e0f){while(--_0x569e0f){_0x4ee806['push'](_0x4ee806['shift']());}};_0x1670d6(++_0x249222);}(_0x786a,0x1ec));var _0xa786=function(_0x18bbcd,_0x152c0f){_0x18bbcd=_0x18bbcd-0x0;var _0x170b45=_0x786a[_0x18bbcd];return _0x170b45;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa786('0x0'));var BPromise=require(_0xa786('0x1'));var rs=require(_0xa786('0x2'));var fs=require('fs');var Redis=require(_0xa786('0x3'));var db=require(_0xa786('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa786('0x5'))('rpc');var config=require(_0xa786('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfc981a,_0x133476,_0x3b4630){return new BPromise(function(_0x57d256,_0x1c633e){return client[_0xa786('0x7')](_0xfc981a,_0x3b4630)[_0xa786('0x8')](function(_0x57a378){logger['info'](_0xa786('0x9'),_0x133476,'request\x20sent');logger[_0xa786('0xa')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x133476,_0xa786('0xb'),JSON[_0xa786('0xc')](_0x57a378));if(_0x57a378[_0xa786('0xd')]){if(_0x57a378[_0xa786('0xd')]['code']===0x1f4){logger['error'](_0xa786('0x9'),_0x133476,_0x57a378[_0xa786('0xd')][_0xa786('0xe')]);return _0x1c633e(_0x57a378['error'][_0xa786('0xe')]);}logger['error'](_0xa786('0x9'),_0x133476,_0x57a378[_0xa786('0xd')][_0xa786('0xe')]);return _0x57d256(_0x57a378[_0xa786('0xd')][_0xa786('0xe')]);}else{logger[_0xa786('0xf')](_0xa786('0x9'),_0x133476,_0xa786('0xb'));_0x57d256(_0x57a378[_0xa786('0x10')][_0xa786('0xe')]);}})[_0xa786('0x11')](function(_0x3a7561){logger['error'](_0xa786('0x9'),_0x133476,_0x3a7561);_0x1c633e(_0x3a7561);});});}exports['GetDynamics365Account']=function(_0x4821d0){var _0x4d69a9=this;return new Promise(function(_0x3c0d63,_0x518183){return db[_0xa786('0x12')][_0xa786('0x13')]({'raw':_0x4821d0[_0xa786('0x14')]?_0x4821d0['options'][_0xa786('0x15')]===undefined?!![]:![]:!![],'where':_0x4821d0[_0xa786('0x14')]?_0x4821d0[_0xa786('0x14')]['where']||null:null,'attributes':_0x4821d0['options']?_0x4821d0[_0xa786('0x14')][_0xa786('0x16')]||null:null,'limit':_0x4821d0[_0xa786('0x14')]?_0x4821d0[_0xa786('0x14')]['limit']||null:null,'include':_0x4821d0[_0xa786('0x14')]?_0x4821d0[_0xa786('0x14')][_0xa786('0x17')]?_[_0xa786('0x18')](_0x4821d0['options'][_0xa786('0x17')],function(_0x27fc88){return{'model':db[_0x27fc88['model']],'as':_0x27fc88['as'],'attributes':_0x27fc88['attributes'],'include':_0x27fc88['include']?_['map'](_0x27fc88[_0xa786('0x17')],function(_0x21d30d){return{'model':db[_0x21d30d[_0xa786('0x19')]],'as':_0x21d30d['as'],'attributes':_0x21d30d[_0xa786('0x16')],'include':_0x21d30d['include']?_['map'](_0x21d30d[_0xa786('0x17')],function(_0x4948c2){return{'model':db[_0x4948c2['model']],'as':_0x4948c2['as'],'attributes':_0x4948c2['attributes']};}):[]};}):[]};}):[]:[]})[_0xa786('0x8')](function(_0x36e956){logger[_0xa786('0xf')](_0xa786('0x1a'),_0x4821d0);logger['debug'](_0xa786('0x1a'),_0x4821d0,JSON[_0xa786('0xc')](_0x36e956));_0x3c0d63(_0x36e956);})['catch'](function(_0x3b27f6){logger[_0xa786('0xd')](_0xa786('0x1a'),_0x3b27f6[_0xa786('0xe')],_0x4821d0);_0x518183(_0x4d69a9[_0xa786('0xd')](0x1f4,_0x3b27f6[_0xa786('0xe')]));});});};exports[_0xa786('0x1b')]=function(_0x293790){var _0x3b8880=this;return new Promise(function(_0x3e9544,_0x4abcb8){return db['Dynamics365Account']['find']({'raw':_0x293790[_0xa786('0x14')]?_0x293790[_0xa786('0x14')][_0xa786('0x15')]===undefined?!![]:![]:!![],'where':_0x293790[_0xa786('0x14')]?_0x293790[_0xa786('0x14')][_0xa786('0x1c')]||null:null,'attributes':_0x293790[_0xa786('0x14')]?_0x293790[_0xa786('0x14')][_0xa786('0x16')]||null:null,'include':_0x293790['options']?_0x293790[_0xa786('0x14')]['include']?_[_0xa786('0x18')](_0x293790[_0xa786('0x14')][_0xa786('0x17')],function(_0x153ab4){return{'model':db[_0x153ab4[_0xa786('0x19')]],'as':_0x153ab4['as'],'attributes':_0x153ab4[_0xa786('0x16')],'include':_0x153ab4[_0xa786('0x17')]?_[_0xa786('0x18')](_0x153ab4[_0xa786('0x17')],function(_0x2d0a71){return{'model':db[_0x2d0a71[_0xa786('0x19')]],'as':_0x2d0a71['as'],'attributes':_0x2d0a71[_0xa786('0x16')],'include':_0x2d0a71[_0xa786('0x17')]?_[_0xa786('0x18')](_0x2d0a71[_0xa786('0x17')],function(_0x4cd54c){return{'model':db[_0x4cd54c['model']],'as':_0x4cd54c['as'],'attributes':_0x4cd54c[_0xa786('0x16')]};}):[]};}):[]};}):[]:[]})[_0xa786('0x8')](function(_0x844d02){logger[_0xa786('0xf')](_0xa786('0x1b'),_0x293790);logger['debug'](_0xa786('0x1b'),_0x293790,JSON[_0xa786('0xc')](_0x844d02));_0x3e9544(_0x844d02);})[_0xa786('0x11')](function(_0x29b264){logger[_0xa786('0xd')](_0xa786('0x1b'),_0x29b264['message'],_0x293790);_0x4abcb8(_0x3b8880['error'](0x1f4,_0x29b264[_0xa786('0xe')]));});});}; \ No newline at end of file +var _0x572b=['options','raw','attributes','limit','include','map','model','then','info','debug','catch','ShowDynamics365Account','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetDynamics365Account','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x572b,0x1b2));var _0xb572=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0x572b[_0x211fef];return _0x5447bf;};'use strict';var _=require(_0xb572('0x0'));var util=require(_0xb572('0x1'));var moment=require(_0xb572('0x2'));var BPromise=require(_0xb572('0x3'));var rs=require(_0xb572('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb572('0x5'))['db'];var utils=require(_0xb572('0x6'));var logger=require(_0xb572('0x7'))('rpc');var config=require(_0xb572('0x8'));var jayson=require(_0xb572('0x9'));var client=jayson[_0xb572('0xa')][_0xb572('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fa9a5,_0x46aafe,_0xe9c455){return new BPromise(function(_0x2166ee,_0x427949){return client[_0xb572('0xc')](_0x2fa9a5,_0xe9c455)['then'](function(_0x34b3df){logger['info'](_0xb572('0xd'),_0x46aafe,_0xb572('0xe'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x46aafe,_0xb572('0xe'),JSON[_0xb572('0xf')](_0x34b3df));if(_0x34b3df[_0xb572('0x10')]){if(_0x34b3df['error']['code']===0x1f4){logger[_0xb572('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x46aafe,_0x34b3df[_0xb572('0x10')][_0xb572('0x11')]);return _0x427949(_0x34b3df[_0xb572('0x10')]['message']);}logger[_0xb572('0x10')](_0xb572('0xd'),_0x46aafe,_0x34b3df[_0xb572('0x10')]['message']);return _0x2166ee(_0x34b3df[_0xb572('0x10')]['message']);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x46aafe,_0xb572('0xe'));_0x2166ee(_0x34b3df[_0xb572('0x12')][_0xb572('0x11')]);}})['catch'](function(_0x3285f9){logger[_0xb572('0x10')](_0xb572('0xd'),_0x46aafe,_0x3285f9);_0x427949(_0x3285f9);});});}exports[_0xb572('0x13')]=function(_0x583ea5){var _0x2b9c04=this;return new Promise(function(_0x18597b,_0x5b9a16){return db['Dynamics365Account'][_0xb572('0x14')]({'raw':_0x583ea5[_0xb572('0x15')]?_0x583ea5['options'][_0xb572('0x16')]===undefined?!![]:![]:!![],'where':_0x583ea5['options']?_0x583ea5[_0xb572('0x15')]['where']||null:null,'attributes':_0x583ea5[_0xb572('0x15')]?_0x583ea5[_0xb572('0x15')][_0xb572('0x17')]||null:null,'limit':_0x583ea5['options']?_0x583ea5[_0xb572('0x15')][_0xb572('0x18')]||null:null,'include':_0x583ea5[_0xb572('0x15')]?_0x583ea5['options'][_0xb572('0x19')]?_[_0xb572('0x1a')](_0x583ea5[_0xb572('0x15')]['include'],function(_0x3775b9){return{'model':db[_0x3775b9[_0xb572('0x1b')]],'as':_0x3775b9['as'],'attributes':_0x3775b9[_0xb572('0x17')],'include':_0x3775b9[_0xb572('0x19')]?_['map'](_0x3775b9[_0xb572('0x19')],function(_0x1b4ad5){return{'model':db[_0x1b4ad5[_0xb572('0x1b')]],'as':_0x1b4ad5['as'],'attributes':_0x1b4ad5[_0xb572('0x17')],'include':_0x1b4ad5['include']?_[_0xb572('0x1a')](_0x1b4ad5[_0xb572('0x19')],function(_0x3a6e07){return{'model':db[_0x3a6e07[_0xb572('0x1b')]],'as':_0x3a6e07['as'],'attributes':_0x3a6e07['attributes']};}):[]};}):[]};}):[]:[]})[_0xb572('0x1c')](function(_0x51c17f){logger[_0xb572('0x1d')]('GetDynamics365Account',_0x583ea5);logger[_0xb572('0x1e')](_0xb572('0x13'),_0x583ea5,JSON[_0xb572('0xf')](_0x51c17f));_0x18597b(_0x51c17f);})[_0xb572('0x1f')](function(_0x44a12e){logger[_0xb572('0x10')](_0xb572('0x13'),_0x44a12e[_0xb572('0x11')],_0x583ea5);_0x5b9a16(_0x2b9c04[_0xb572('0x10')](0x1f4,_0x44a12e['message']));});});};exports[_0xb572('0x20')]=function(_0x1f3ddb){var _0x36563d=this;return new Promise(function(_0x363782,_0x1527f7){return db['Dynamics365Account'][_0xb572('0x21')]({'raw':_0x1f3ddb[_0xb572('0x15')]?_0x1f3ddb[_0xb572('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1f3ddb[_0xb572('0x15')]?_0x1f3ddb[_0xb572('0x15')][_0xb572('0x22')]||null:null,'attributes':_0x1f3ddb[_0xb572('0x15')]?_0x1f3ddb[_0xb572('0x15')][_0xb572('0x17')]||null:null,'include':_0x1f3ddb[_0xb572('0x15')]?_0x1f3ddb[_0xb572('0x15')]['include']?_[_0xb572('0x1a')](_0x1f3ddb[_0xb572('0x15')][_0xb572('0x19')],function(_0x234bc7){return{'model':db[_0x234bc7[_0xb572('0x1b')]],'as':_0x234bc7['as'],'attributes':_0x234bc7[_0xb572('0x17')],'include':_0x234bc7['include']?_[_0xb572('0x1a')](_0x234bc7[_0xb572('0x19')],function(_0x2742f2){return{'model':db[_0x2742f2['model']],'as':_0x2742f2['as'],'attributes':_0x2742f2[_0xb572('0x17')],'include':_0x2742f2[_0xb572('0x19')]?_['map'](_0x2742f2[_0xb572('0x19')],function(_0x1b310c){return{'model':db[_0x1b310c['model']],'as':_0x1b310c['as'],'attributes':_0x1b310c[_0xb572('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb572('0x1c')](function(_0x22caba){logger[_0xb572('0x1d')]('ShowDynamics365Account',_0x1f3ddb);logger[_0xb572('0x1e')]('ShowDynamics365Account',_0x1f3ddb,JSON['stringify'](_0x22caba));_0x363782(_0x22caba);})['catch'](function(_0x380d9e){logger[_0xb572('0x10')](_0xb572('0x20'),_0x380d9e[_0xb572('0x11')],_0x1f3ddb);_0x1527f7(_0x36563d[_0xb572('0x10')](0x1f4,_0x380d9e[_0xb572('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b5ebe83..b6b8a66 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 _0x0c74=['getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects'];(function(_0x234fb3,_0x1168ae){var _0x37d9c8=function(_0x3f56d3){while(--_0x3f56d3){_0x234fb3['push'](_0x234fb3['shift']());}};_0x37d9c8(++_0x1168ae);}(_0x0c74,0xc1));var _0x40c7=function(_0x2534a0,_0xda89db){_0x2534a0=_0x2534a0-0x0;var _0x3209c0=_0x0c74[_0x2534a0];return _0x3209c0;};'use strict';var multer=require('multer');var util=require(_0x40c7('0x0'));var path=require(_0x40c7('0x1'));var timeout=require('connect-timeout');var express=require(_0x40c7('0x2'));var router=express[_0x40c7('0x3')]();var fs_extra=require(_0x40c7('0x4'));var auth=require(_0x40c7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x40c7('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0x40c7('0x7')]('/',auth[_0x40c7('0x8')](),controller[_0x40c7('0x9')]);router['get'](_0x40c7('0xa'),auth[_0x40c7('0x8')](),controller['show']);router[_0x40c7('0x7')](_0x40c7('0xb'),auth[_0x40c7('0x8')](),controller[_0x40c7('0xc')]);router[_0x40c7('0x7')](_0x40c7('0xd'),auth[_0x40c7('0x8')](),controller[_0x40c7('0xe')]);router[_0x40c7('0x7')](_0x40c7('0xf'),auth[_0x40c7('0x8')](),controller[_0x40c7('0x10')]);router[_0x40c7('0x11')]('/',auth['isAuthenticated'](),controller[_0x40c7('0x12')]);router['put'](_0x40c7('0xa'),auth[_0x40c7('0x8')](),controller[_0x40c7('0x13')]);router[_0x40c7('0x14')]('/:id',auth[_0x40c7('0x8')](),controller[_0x40c7('0x15')]);module[_0x40c7('0x16')]=router; \ No newline at end of file +var _0x5480=['delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5480,0x18a));var _0x0548=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x5480[_0x307086];return _0x699043;};'use strict';var multer=require(_0x0548('0x0'));var util=require(_0x0548('0x1'));var path=require(_0x0548('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0548('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0548('0x4'));var interaction=require(_0x0548('0x5'));var config=require('../../config/environment');var controller=require(_0x0548('0x6'));router[_0x0548('0x7')]('/',auth[_0x0548('0x8')](),controller[_0x0548('0x9')]);router[_0x0548('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0548('0xa')]);router['get'](_0x0548('0xb'),auth[_0x0548('0x8')](),controller[_0x0548('0xc')]);router['get'](_0x0548('0xd'),auth[_0x0548('0x8')](),controller[_0x0548('0xe')]);router[_0x0548('0x7')](_0x0548('0xf'),auth[_0x0548('0x8')](),controller['getDescriptions']);router[_0x0548('0x10')]('/',auth[_0x0548('0x8')](),controller[_0x0548('0x11')]);router[_0x0548('0x12')](_0x0548('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x0548('0x14')](_0x0548('0x13'),auth[_0x0548('0x8')](),controller[_0x0548('0x15')]);module[_0x0548('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 49f2df4..b246339 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 _0xa77d=['STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN','sequelize','exports'];(function(_0x3b8c0c,_0x4cb7c8){var _0xbee0a=function(_0x586d9b){while(--_0x586d9b){_0x3b8c0c['push'](_0x3b8c0c['shift']());}};_0xbee0a(++_0x4cb7c8);}(_0xa77d,0x16f));var _0xda77=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0xa77d[_0x509273];return _0x38ef40;};'use strict';var Sequelize=require(_0xda77('0x0'));module[_0xda77('0x1')]={'name':{'type':Sequelize[_0xda77('0x2')]},'description':{'type':Sequelize[_0xda77('0x2')]},'ticketType':{'type':Sequelize[_0xda77('0x3')](_0xda77('0x4'),_0xda77('0x5')),'defaultValue':_0xda77('0x4')},'moduleCreate':{'type':Sequelize[_0xda77('0x3')](_0xda77('0x6'),_0xda77('0x7')),'defaultValue':_0xda77('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xda77('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x433b=['phonecall','nothing','contact','BOOLEAN','exports','STRING','ENUM','incident'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x433b,0x16c));var _0xb433=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x433b[_0x562f3b];return _0x1edd55;};'use strict';var Sequelize=require('sequelize');module[_0xb433('0x0')]={'name':{'type':Sequelize[_0xb433('0x1')]},'description':{'type':Sequelize[_0xb433('0x1')]},'ticketType':{'type':Sequelize[_0xb433('0x2')](_0xb433('0x3'),_0xb433('0x4')),'defaultValue':_0xb433('0x3')},'moduleCreate':{'type':Sequelize[_0xb433('0x2')]('contact',_0xb433('0x5')),'defaultValue':_0xb433('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xb433('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xb433('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9d758e0..da214bf 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 _0x61b2=['then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','includeAll','findAll','rows','show','params','include','options','find','create','body','catch','findOne','Dynamics365Field','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy'];(function(_0x45e3c4,_0x45a9ec){var _0x50acc9=function(_0x596c9d){while(--_0x596c9d){_0x45e3c4['push'](_0x45e3c4['shift']());}};_0x50acc9(++_0x45a9ec);}(_0x61b2,0xcb));var _0x261b=function(_0x1d96e9,_0x1db7ee){_0x1d96e9=_0x1d96e9-0x0;var _0x601da5=_0x61b2[_0x1d96e9];return _0x601da5;};'use strict';var emlformat=require(_0x261b('0x0'));var rimraf=require(_0x261b('0x1'));var zipdir=require(_0x261b('0x2'));var jsonpatch=require(_0x261b('0x3'));var rp=require(_0x261b('0x4'));var moment=require(_0x261b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x261b('0x6'));var util=require(_0x261b('0x7'));var path=require(_0x261b('0x8'));var sox=require('sox');var csv=require(_0x261b('0x9'));var ejs=require(_0x261b('0xa'));var fs=require('fs');var fs_extra=require(_0x261b('0xb'));var _=require('lodash');var squel=require(_0x261b('0xc'));var crypto=require(_0x261b('0xd'));var jsforce=require(_0x261b('0xe'));var deskjs=require(_0x261b('0xf'));var toCsv=require(_0x261b('0x9'));var querystring=require('querystring');var Papa=require(_0x261b('0x10'));var Redis=require(_0x261b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x261b('0x12'));var hardwareService=require(_0x261b('0x13'));var logger=require(_0x261b('0x14'))(_0x261b('0x15'));var utils=require(_0x261b('0x16'));var config=require(_0x261b('0x17'));var licenseUtil=require(_0x261b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x432409,_0x86f708){_0x86f708=_0x86f708||0xcc;return function(_0x496021){if(_0x496021){return _0x432409[_0x261b('0x19')](_0x86f708);}return _0x432409[_0x261b('0x1a')](_0x86f708)[_0x261b('0x1b')]();};}function respondWithResult(_0x2ea072,_0x236590){_0x236590=_0x236590||0xc8;return function(_0x1d32c9){if(_0x1d32c9){return _0x2ea072['status'](_0x236590)[_0x261b('0x1c')](_0x1d32c9);}};}function respondWithFilteredResult(_0x5e897d,_0x1505d9){return function(_0x361e70){if(_0x361e70){var _0x342f9b=typeof _0x1505d9['offset']===_0x261b('0x1d')&&typeof _0x1505d9[_0x261b('0x1e')]==='undefined';var _0x1e1ad7=_0x361e70[_0x261b('0x1f')];var _0x4ac2cc=_0x342f9b?0x0:_0x1505d9[_0x261b('0x20')];var _0x3f0374=_0x342f9b?_0x361e70[_0x261b('0x1f')]:_0x1505d9[_0x261b('0x20')]+_0x1505d9['limit'];var _0x12ee8e;if(_0x3f0374>=_0x1e1ad7){_0x3f0374=_0x1e1ad7;_0x12ee8e=0xc8;}else{_0x12ee8e=0xce;}_0x5e897d[_0x261b('0x1a')](_0x12ee8e);return _0x5e897d['set'](_0x261b('0x21'),_0x4ac2cc+'-'+_0x3f0374+'/'+_0x1e1ad7)[_0x261b('0x1c')](_0x361e70);}return null;};}function patchUpdates(_0x52b810){return function(_0x366825){try{jsonpatch[_0x261b('0x22')](_0x366825,_0x52b810,!![]);}catch(_0x1e47b5){return BPromise['reject'](_0x1e47b5);}return _0x366825['save']();};}function saveUpdates(_0x4e6a36,_0xa9daf1){return function(_0x4a91ef){if(_0x4a91ef){return _0x4a91ef[_0x261b('0x23')](_0x4e6a36)['then'](function(_0x38a5e0){return _0x38a5e0;});}return null;};}function removeEntity(_0x16c8a6,_0x3631c7){return function(_0x48a50a){if(_0x48a50a){return _0x48a50a[_0x261b('0x24')]()[_0x261b('0x25')](function(){_0x16c8a6[_0x261b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a14e4,_0x5d401d){return function(_0x2ed2d4){if(!_0x2ed2d4){_0x3a14e4[_0x261b('0x19')](0x194);}return _0x2ed2d4;};}function handleError(_0x9c9f9a,_0x19677b){_0x19677b=_0x19677b||0x1f4;return function(_0x5106d4){logger['error'](_0x5106d4[_0x261b('0x26')]);if(_0x5106d4[_0x261b('0x27')]){delete _0x5106d4[_0x261b('0x27')];}_0x9c9f9a[_0x261b('0x1a')](_0x19677b)[_0x261b('0x28')](_0x5106d4);};}exports[_0x261b('0x29')]=function(_0xdaa590,_0x517622){var _0x23fa52={},_0x4ebdd2={},_0x5c0819={'count':0x0,'rows':[]};var _0x530ed3=_[_0x261b('0x2a')](db[_0x261b('0x2b')][_0x261b('0x2c')],function(_0x5e2355){return{'name':_0x5e2355[_0x261b('0x2d')],'type':_0x5e2355[_0x261b('0x2e')][_0x261b('0x2f')]};});_0x4ebdd2[_0x261b('0x30')]=_['map'](_0x530ed3,_0x261b('0x27'));_0x4ebdd2[_0x261b('0x31')]=_[_0x261b('0x32')](_0xdaa590[_0x261b('0x31')]);_0x4ebdd2['filters']=_['intersection'](_0x4ebdd2[_0x261b('0x30')],_0x4ebdd2['query']);_0x23fa52[_0x261b('0x33')]=_[_0x261b('0x34')](_0x4ebdd2[_0x261b('0x30')],qs[_0x261b('0x35')](_0xdaa590[_0x261b('0x31')][_0x261b('0x35')]));_0x23fa52[_0x261b('0x33')]=_0x23fa52[_0x261b('0x33')][_0x261b('0x36')]?_0x23fa52[_0x261b('0x33')]:_0x4ebdd2[_0x261b('0x30')];if(!_0xdaa590[_0x261b('0x31')][_0x261b('0x37')]('nolimit')){_0x23fa52[_0x261b('0x1e')]=qs[_0x261b('0x1e')](_0xdaa590['query']['limit']);_0x23fa52[_0x261b('0x20')]=qs[_0x261b('0x20')](_0xdaa590[_0x261b('0x31')][_0x261b('0x20')]);}_0x23fa52[_0x261b('0x38')]=qs[_0x261b('0x39')](_0xdaa590[_0x261b('0x31')]['sort']);_0x23fa52['where']=qs[_0x261b('0x3a')](_[_0x261b('0x3b')](_0xdaa590[_0x261b('0x31')],_0x4ebdd2[_0x261b('0x3a')]),_0x530ed3);if(_0xdaa590['query'][_0x261b('0x3c')]){_0x23fa52[_0x261b('0x3d')]=_[_0x261b('0x3e')](_0x23fa52[_0x261b('0x3d')],{'$or':_['map'](_0x530ed3,function(_0x54b280){if(_0x54b280['type']!=='VIRTUAL'){var _0x5e8a80={};_0x5e8a80[_0x54b280['name']]={'$like':'%'+_0xdaa590['query']['filter']+'%'};return _0x5e8a80;}})});}_0x23fa52=_[_0x261b('0x3e')]({},_0x23fa52,_0xdaa590['options']);var _0x1fc6e3={'where':_0x23fa52[_0x261b('0x3d')]};return db[_0x261b('0x2b')][_0x261b('0x1f')](_0x1fc6e3)[_0x261b('0x25')](function(_0x27930f){_0x5c0819[_0x261b('0x1f')]=_0x27930f;if(_0xdaa590['query'][_0x261b('0x3f')]){_0x23fa52['include']=[{'all':!![]}];}return db[_0x261b('0x2b')][_0x261b('0x40')](_0x23fa52);})['then'](function(_0x3b7e9d){_0x5c0819[_0x261b('0x41')]=_0x3b7e9d;return _0x5c0819;})[_0x261b('0x25')](respondWithFilteredResult(_0x517622,_0x23fa52))['catch'](handleError(_0x517622,null));};exports[_0x261b('0x42')]=function(_0x1ca464,_0x1cde54){var _0x5aa965={'raw':![],'where':{'id':_0x1ca464[_0x261b('0x43')]['id']}},_0x268227={};_0x268227[_0x261b('0x30')]=_[_0x261b('0x32')](db[_0x261b('0x2b')][_0x261b('0x2c')]);_0x268227['query']=_['keys'](_0x1ca464[_0x261b('0x31')]);_0x268227['filters']=_[_0x261b('0x34')](_0x268227[_0x261b('0x30')],_0x268227['query']);_0x5aa965[_0x261b('0x33')]=_[_0x261b('0x34')](_0x268227[_0x261b('0x30')],qs[_0x261b('0x35')](_0x1ca464[_0x261b('0x31')][_0x261b('0x35')]));_0x5aa965[_0x261b('0x33')]=_0x5aa965[_0x261b('0x33')][_0x261b('0x36')]?_0x5aa965[_0x261b('0x33')]:_0x268227[_0x261b('0x30')];if(_0x1ca464[_0x261b('0x31')][_0x261b('0x3f')]){_0x5aa965[_0x261b('0x44')]=[{'all':!![]}];}_0x5aa965=_['merge']({},_0x5aa965,_0x1ca464[_0x261b('0x45')]);return db[_0x261b('0x2b')][_0x261b('0x46')](_0x5aa965)['then'](handleEntityNotFound(_0x1cde54,null))[_0x261b('0x25')](respondWithResult(_0x1cde54,null))['catch'](handleError(_0x1cde54,null));};exports[_0x261b('0x47')]=function(_0x242c05,_0x48bccc){return db[_0x261b('0x2b')][_0x261b('0x47')](_0x242c05[_0x261b('0x48')],{})[_0x261b('0x25')](respondWithResult(_0x48bccc,0xc9))[_0x261b('0x49')](handleError(_0x48bccc,null));};exports[_0x261b('0x23')]=function(_0x44d46a,_0x4b535a){if(_0x44d46a[_0x261b('0x48')]['id']){delete _0x44d46a[_0x261b('0x48')]['id'];}return db[_0x261b('0x2b')][_0x261b('0x46')]({'where':{'id':_0x44d46a[_0x261b('0x43')]['id']}})[_0x261b('0x25')](handleEntityNotFound(_0x4b535a,null))[_0x261b('0x25')](saveUpdates(_0x44d46a[_0x261b('0x48')],null))[_0x261b('0x25')](respondWithResult(_0x4b535a,null))[_0x261b('0x49')](handleError(_0x4b535a,null));};exports[_0x261b('0x24')]=function(_0x37999b,_0x1b2678){return db[_0x261b('0x2b')][_0x261b('0x46')]({'where':{'id':_0x37999b['params']['id']}})[_0x261b('0x25')](handleEntityNotFound(_0x1b2678,null))[_0x261b('0x25')](removeEntity(_0x1b2678,null))['catch'](handleError(_0x1b2678,null));};exports['getFields']=function(_0x499d6d,_0xecb76b,_0xd21005){var _0x1d4e87={};var _0x557108={};var _0x1c03a2;var _0x1e464f;return db['Dynamics365Configuration'][_0x261b('0x4a')]({'where':{'id':_0x499d6d[_0x261b('0x43')]['id']}})[_0x261b('0x25')](handleEntityNotFound(_0xecb76b,null))[_0x261b('0x25')](function(_0x47c788){if(_0x47c788){_0x1c03a2=_0x47c788;_0x557108['model']=_['keys'](db[_0x261b('0x4b')]['rawAttributes']);_0x557108[_0x261b('0x31')]=_[_0x261b('0x32')](_0x499d6d[_0x261b('0x31')]);_0x557108[_0x261b('0x3a')]=_[_0x261b('0x34')](_0x557108[_0x261b('0x30')],_0x557108['query']);_0x1d4e87[_0x261b('0x33')]=_['intersection'](_0x557108['model'],qs['fields'](_0x499d6d[_0x261b('0x31')][_0x261b('0x35')]));_0x1d4e87[_0x261b('0x33')]=_0x1d4e87[_0x261b('0x33')][_0x261b('0x36')]?_0x1d4e87[_0x261b('0x33')]:_0x557108[_0x261b('0x30')];_0x1d4e87['order']=qs['sort'](_0x499d6d['query']['sort']);_0x1d4e87[_0x261b('0x3d')]=qs[_0x261b('0x3a')](_[_0x261b('0x3b')](_0x499d6d[_0x261b('0x31')],_0x557108[_0x261b('0x3a')]));if(_0x499d6d[_0x261b('0x31')][_0x261b('0x3c')]){_0x1d4e87[_0x261b('0x3d')]=_[_0x261b('0x3e')](_0x1d4e87[_0x261b('0x3d')],{'$or':_[_0x261b('0x2a')](_0x1d4e87[_0x261b('0x33')],function(_0x2d0402){var _0x27e01c={};_0x27e01c[_0x2d0402]={'$like':'%'+_0x499d6d[_0x261b('0x31')][_0x261b('0x3c')]+'%'};return _0x27e01c;})});}_0x1d4e87=_['merge']({},_0x1d4e87,_0x499d6d[_0x261b('0x45')]);return _0x1c03a2[_0x261b('0x4c')](_0x1d4e87);}})['then'](function(_0x3db1e3){if(_0x3db1e3){_0x1e464f=_0x3db1e3[_0x261b('0x36')];if(!_0x499d6d[_0x261b('0x31')][_0x261b('0x37')](_0x261b('0x4d'))){_0x1d4e87[_0x261b('0x1e')]=qs[_0x261b('0x1e')](_0x499d6d['query'][_0x261b('0x1e')]);_0x1d4e87['offset']=qs[_0x261b('0x20')](_0x499d6d[_0x261b('0x31')][_0x261b('0x20')]);}return _0x1c03a2[_0x261b('0x4c')](_0x1d4e87);}})[_0x261b('0x25')](function(_0x393655){if(_0x393655){return _0x393655?{'count':_0x1e464f,'rows':_0x393655}:null;}})[_0x261b('0x25')](respondWithResult(_0xecb76b,null))[_0x261b('0x49')](handleError(_0xecb76b,null));};exports[_0x261b('0x4e')]=function(_0x5a4528,_0x3f44c1,_0x265112){var _0x47aa72={};var _0xa05df7={};var _0x53d86c;var _0x20d6a0;return db[_0x261b('0x2b')][_0x261b('0x4a')]({'where':{'id':_0x5a4528[_0x261b('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f44c1,null))[_0x261b('0x25')](function(_0x139333){if(_0x139333){_0x53d86c=_0x139333;_0xa05df7[_0x261b('0x30')]=_[_0x261b('0x32')](db[_0x261b('0x4b')][_0x261b('0x2c')]);_0xa05df7['query']=_[_0x261b('0x32')](_0x5a4528['query']);_0xa05df7[_0x261b('0x3a')]=_['intersection'](_0xa05df7[_0x261b('0x30')],_0xa05df7['query']);_0x47aa72['attributes']=_[_0x261b('0x34')](_0xa05df7[_0x261b('0x30')],qs[_0x261b('0x35')](_0x5a4528[_0x261b('0x31')]['fields']));_0x47aa72[_0x261b('0x33')]=_0x47aa72[_0x261b('0x33')][_0x261b('0x36')]?_0x47aa72['attributes']:_0xa05df7['model'];_0x47aa72[_0x261b('0x38')]=qs['sort'](_0x5a4528[_0x261b('0x31')][_0x261b('0x39')]);_0x47aa72[_0x261b('0x3d')]=qs['filters'](_[_0x261b('0x3b')](_0x5a4528[_0x261b('0x31')],_0xa05df7[_0x261b('0x3a')]));if(_0x5a4528[_0x261b('0x31')][_0x261b('0x3c')]){_0x47aa72[_0x261b('0x3d')]=_[_0x261b('0x3e')](_0x47aa72[_0x261b('0x3d')],{'$or':_[_0x261b('0x2a')](_0x47aa72['attributes'],function(_0x16382a){var _0x3f5356={};_0x3f5356[_0x16382a]={'$like':'%'+_0x5a4528[_0x261b('0x31')][_0x261b('0x3c')]+'%'};return _0x3f5356;})});}_0x47aa72=_['merge']({},_0x47aa72,_0x5a4528[_0x261b('0x45')]);return _0x53d86c['getSubjects'](_0x47aa72);}})[_0x261b('0x25')](function(_0x721d4e){if(_0x721d4e){_0x20d6a0=_0x721d4e[_0x261b('0x36')];if(!_0x5a4528[_0x261b('0x31')][_0x261b('0x37')](_0x261b('0x4d'))){_0x47aa72['limit']=qs[_0x261b('0x1e')](_0x5a4528[_0x261b('0x31')]['limit']);_0x47aa72['offset']=qs[_0x261b('0x20')](_0x5a4528[_0x261b('0x31')][_0x261b('0x20')]);}return _0x53d86c[_0x261b('0x4e')](_0x47aa72);}})[_0x261b('0x25')](function(_0xc1f21c){if(_0xc1f21c){return _0xc1f21c?{'count':_0x20d6a0,'rows':_0xc1f21c}:null;}})[_0x261b('0x25')](respondWithResult(_0x3f44c1,null))[_0x261b('0x49')](handleError(_0x3f44c1,null));};exports[_0x261b('0x4f')]=function(_0x30c053,_0x5518e3,_0x4f022c){var _0x3edde9={};var _0x40bee0={};var _0x538a4d;var _0x5eed93;return db[_0x261b('0x2b')][_0x261b('0x4a')]({'where':{'id':_0x30c053[_0x261b('0x43')]['id']}})[_0x261b('0x25')](handleEntityNotFound(_0x5518e3,null))[_0x261b('0x25')](function(_0x2608dc){if(_0x2608dc){_0x538a4d=_0x2608dc;_0x40bee0[_0x261b('0x30')]=_[_0x261b('0x32')](db['Dynamics365Field']['rawAttributes']);_0x40bee0[_0x261b('0x31')]=_[_0x261b('0x32')](_0x30c053[_0x261b('0x31')]);_0x40bee0['filters']=_[_0x261b('0x34')](_0x40bee0[_0x261b('0x30')],_0x40bee0['query']);_0x3edde9[_0x261b('0x33')]=_[_0x261b('0x34')](_0x40bee0['model'],qs['fields'](_0x30c053[_0x261b('0x31')][_0x261b('0x35')]));_0x3edde9[_0x261b('0x33')]=_0x3edde9[_0x261b('0x33')][_0x261b('0x36')]?_0x3edde9[_0x261b('0x33')]:_0x40bee0[_0x261b('0x30')];_0x3edde9['order']=qs[_0x261b('0x39')](_0x30c053['query'][_0x261b('0x39')]);_0x3edde9[_0x261b('0x3d')]=qs['filters'](_[_0x261b('0x3b')](_0x30c053[_0x261b('0x31')],_0x40bee0['filters']));if(_0x30c053[_0x261b('0x31')][_0x261b('0x3c')]){_0x3edde9[_0x261b('0x3d')]=_[_0x261b('0x3e')](_0x3edde9[_0x261b('0x3d')],{'$or':_[_0x261b('0x2a')](_0x3edde9[_0x261b('0x33')],function(_0x347ce9){var _0x4c72f2={};_0x4c72f2[_0x347ce9]={'$like':'%'+_0x30c053[_0x261b('0x31')][_0x261b('0x3c')]+'%'};return _0x4c72f2;})});}_0x3edde9=_[_0x261b('0x3e')]({},_0x3edde9,_0x30c053[_0x261b('0x45')]);return _0x538a4d['getDescriptions'](_0x3edde9);}})[_0x261b('0x25')](function(_0x14691f){if(_0x14691f){_0x5eed93=_0x14691f[_0x261b('0x36')];if(!_0x30c053[_0x261b('0x31')]['hasOwnProperty'](_0x261b('0x4d'))){_0x3edde9['limit']=qs['limit'](_0x30c053[_0x261b('0x31')]['limit']);_0x3edde9[_0x261b('0x20')]=qs[_0x261b('0x20')](_0x30c053[_0x261b('0x31')][_0x261b('0x20')]);}return _0x538a4d['getDescriptions'](_0x3edde9);}})['then'](function(_0x5539c3){if(_0x5539c3){return _0x5539c3?{'count':_0x5eed93,'rows':_0x5539c3}:null;}})[_0x261b('0x25')](respondWithResult(_0x5518e3,null))[_0x261b('0x49')](handleError(_0x5518e3,null));}; \ No newline at end of file +var _0x8fff=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','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/environment','../../config/license/util','json','offset','undefined','limit','count','set','save','then','status','end','error','name','Dynamics365Configuration','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fff,0x155));var _0xf8ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fff[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf8ff('0x0'));var rimraf=require(_0xf8ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8ff('0x2'));var rp=require(_0xf8ff('0x3'));var moment=require('moment');var BPromise=require(_0xf8ff('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf8ff('0x5'));var sox=require(_0xf8ff('0x6'));var csv=require(_0xf8ff('0x7'));var ejs=require(_0xf8ff('0x8'));var fs=require('fs');var fs_extra=require(_0xf8ff('0x9'));var _=require(_0xf8ff('0xa'));var squel=require(_0xf8ff('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf8ff('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf8ff('0xd'));var Papa=require(_0xf8ff('0xe'));var Redis=require(_0xf8ff('0xf'));var authService=require(_0xf8ff('0x10'));var qs=require(_0xf8ff('0x11'));var as=require(_0xf8ff('0x12'));var hardwareService=require(_0xf8ff('0x13'));var logger=require(_0xf8ff('0x14'))(_0xf8ff('0x15'));var utils=require('../../config/utils');var config=require(_0xf8ff('0x16'));var licenseUtil=require(_0xf8ff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d1fae,_0x574cf8){_0x574cf8=_0x574cf8||0xcc;return function(_0x3969c4){if(_0x3969c4){return _0x3d1fae['sendStatus'](_0x574cf8);}return _0x3d1fae['status'](_0x574cf8)['end']();};}function respondWithResult(_0x4576df,_0x4a67b5){_0x4a67b5=_0x4a67b5||0xc8;return function(_0x1b3091){if(_0x1b3091){return _0x4576df['status'](_0x4a67b5)[_0xf8ff('0x18')](_0x1b3091);}};}function respondWithFilteredResult(_0x5b686b,_0x4d8aca){return function(_0x781c28){if(_0x781c28){var _0x1e0779=typeof _0x4d8aca[_0xf8ff('0x19')]===_0xf8ff('0x1a')&&typeof _0x4d8aca[_0xf8ff('0x1b')]==='undefined';var _0x444f27=_0x781c28[_0xf8ff('0x1c')];var _0x48066a=_0x1e0779?0x0:_0x4d8aca[_0xf8ff('0x19')];var _0x4c6a6e=_0x1e0779?_0x781c28[_0xf8ff('0x1c')]:_0x4d8aca['offset']+_0x4d8aca['limit'];var _0x72b1c9;if(_0x4c6a6e>=_0x444f27){_0x4c6a6e=_0x444f27;_0x72b1c9=0xc8;}else{_0x72b1c9=0xce;}_0x5b686b['status'](_0x72b1c9);return _0x5b686b[_0xf8ff('0x1d')]('Content-Range',_0x48066a+'-'+_0x4c6a6e+'/'+_0x444f27)['json'](_0x781c28);}return null;};}function patchUpdates(_0x217d3c){return function(_0x47f5fc){try{jsonpatch['apply'](_0x47f5fc,_0x217d3c,!![]);}catch(_0x1807b0){return BPromise['reject'](_0x1807b0);}return _0x47f5fc[_0xf8ff('0x1e')]();};}function saveUpdates(_0x8c332f,_0x2e121d){return function(_0x1d55b9){if(_0x1d55b9){return _0x1d55b9['update'](_0x8c332f)[_0xf8ff('0x1f')](function(_0x202f74){return _0x202f74;});}return null;};}function removeEntity(_0x45ee53,_0x403e7f){return function(_0x20582c){if(_0x20582c){return _0x20582c['destroy']()['then'](function(){_0x45ee53[_0xf8ff('0x20')](0xcc)[_0xf8ff('0x21')]();});}};}function handleEntityNotFound(_0x47f2cd,_0x22578a){return function(_0x18941e){if(!_0x18941e){_0x47f2cd['sendStatus'](0x194);}return _0x18941e;};}function handleError(_0x4495cb,_0x275f21){_0x275f21=_0x275f21||0x1f4;return function(_0x1ab124){logger[_0xf8ff('0x22')](_0x1ab124['stack']);if(_0x1ab124[_0xf8ff('0x23')]){delete _0x1ab124[_0xf8ff('0x23')];}_0x4495cb['status'](_0x275f21)['send'](_0x1ab124);};}exports['index']=function(_0x316365,_0x55620d){var _0x4d7df5={},_0xe98578={},_0x31d2e2={'count':0x0,'rows':[]};var _0x23fd65=_['map'](db[_0xf8ff('0x24')][_0xf8ff('0x25')],function(_0x3fef92){return{'name':_0x3fef92[_0xf8ff('0x26')],'type':_0x3fef92[_0xf8ff('0x27')][_0xf8ff('0x28')]};});_0xe98578[_0xf8ff('0x29')]=_[_0xf8ff('0x2a')](_0x23fd65,'name');_0xe98578[_0xf8ff('0x2b')]=_[_0xf8ff('0x2c')](_0x316365[_0xf8ff('0x2b')]);_0xe98578[_0xf8ff('0x2d')]=_[_0xf8ff('0x2e')](_0xe98578['model'],_0xe98578[_0xf8ff('0x2b')]);_0x4d7df5[_0xf8ff('0x2f')]=_[_0xf8ff('0x2e')](_0xe98578['model'],qs[_0xf8ff('0x30')](_0x316365[_0xf8ff('0x2b')][_0xf8ff('0x30')]));_0x4d7df5[_0xf8ff('0x2f')]=_0x4d7df5[_0xf8ff('0x2f')][_0xf8ff('0x31')]?_0x4d7df5[_0xf8ff('0x2f')]:_0xe98578['model'];if(!_0x316365[_0xf8ff('0x2b')][_0xf8ff('0x32')](_0xf8ff('0x33'))){_0x4d7df5[_0xf8ff('0x1b')]=qs['limit'](_0x316365[_0xf8ff('0x2b')][_0xf8ff('0x1b')]);_0x4d7df5[_0xf8ff('0x19')]=qs['offset'](_0x316365['query'][_0xf8ff('0x19')]);}_0x4d7df5[_0xf8ff('0x34')]=qs[_0xf8ff('0x35')](_0x316365[_0xf8ff('0x2b')]['sort']);_0x4d7df5[_0xf8ff('0x36')]=qs[_0xf8ff('0x2d')](_[_0xf8ff('0x37')](_0x316365[_0xf8ff('0x2b')],_0xe98578[_0xf8ff('0x2d')]),_0x23fd65);if(_0x316365['query'][_0xf8ff('0x38')]){_0x4d7df5[_0xf8ff('0x36')]=_[_0xf8ff('0x39')](_0x4d7df5[_0xf8ff('0x36')],{'$or':_[_0xf8ff('0x2a')](_0x23fd65,function(_0x232927){if(_0x232927[_0xf8ff('0x27')]!==_0xf8ff('0x3a')){var _0x265c37={};_0x265c37[_0x232927[_0xf8ff('0x23')]]={'$like':'%'+_0x316365[_0xf8ff('0x2b')]['filter']+'%'};return _0x265c37;}})});}_0x4d7df5=_[_0xf8ff('0x39')]({},_0x4d7df5,_0x316365[_0xf8ff('0x3b')]);var _0x3eb455={'where':_0x4d7df5[_0xf8ff('0x36')]};return db[_0xf8ff('0x24')]['count'](_0x3eb455)['then'](function(_0x2d982c){_0x31d2e2[_0xf8ff('0x1c')]=_0x2d982c;if(_0x316365[_0xf8ff('0x2b')][_0xf8ff('0x3c')]){_0x4d7df5[_0xf8ff('0x3d')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xf8ff('0x3e')](_0x4d7df5);})[_0xf8ff('0x1f')](function(_0xabdf26){_0x31d2e2[_0xf8ff('0x3f')]=_0xabdf26;return _0x31d2e2;})[_0xf8ff('0x1f')](respondWithFilteredResult(_0x55620d,_0x4d7df5))[_0xf8ff('0x40')](handleError(_0x55620d,null));};exports[_0xf8ff('0x41')]=function(_0x3527a3,_0x1c69c0){var _0x1a54f3={'raw':![],'where':{'id':_0x3527a3[_0xf8ff('0x42')]['id']}},_0x3a56be={};_0x3a56be[_0xf8ff('0x29')]=_['keys'](db['Dynamics365Configuration'][_0xf8ff('0x25')]);_0x3a56be[_0xf8ff('0x2b')]=_[_0xf8ff('0x2c')](_0x3527a3[_0xf8ff('0x2b')]);_0x3a56be[_0xf8ff('0x2d')]=_['intersection'](_0x3a56be[_0xf8ff('0x29')],_0x3a56be['query']);_0x1a54f3[_0xf8ff('0x2f')]=_[_0xf8ff('0x2e')](_0x3a56be[_0xf8ff('0x29')],qs[_0xf8ff('0x30')](_0x3527a3[_0xf8ff('0x2b')][_0xf8ff('0x30')]));_0x1a54f3[_0xf8ff('0x2f')]=_0x1a54f3[_0xf8ff('0x2f')][_0xf8ff('0x31')]?_0x1a54f3['attributes']:_0x3a56be[_0xf8ff('0x29')];if(_0x3527a3[_0xf8ff('0x2b')]['includeAll']){_0x1a54f3[_0xf8ff('0x3d')]=[{'all':!![]}];}_0x1a54f3=_[_0xf8ff('0x39')]({},_0x1a54f3,_0x3527a3[_0xf8ff('0x3b')]);return db[_0xf8ff('0x24')][_0xf8ff('0x43')](_0x1a54f3)[_0xf8ff('0x1f')](handleEntityNotFound(_0x1c69c0,null))['then'](respondWithResult(_0x1c69c0,null))['catch'](handleError(_0x1c69c0,null));};exports[_0xf8ff('0x44')]=function(_0x158778,_0x100ef3){return db['Dynamics365Configuration'][_0xf8ff('0x44')](_0x158778[_0xf8ff('0x45')],{})['then'](respondWithResult(_0x100ef3,0xc9))[_0xf8ff('0x40')](handleError(_0x100ef3,null));};exports['update']=function(_0x73a57e,_0x3915fa){if(_0x73a57e['body']['id']){delete _0x73a57e[_0xf8ff('0x45')]['id'];}return db[_0xf8ff('0x24')][_0xf8ff('0x43')]({'where':{'id':_0x73a57e[_0xf8ff('0x42')]['id']}})[_0xf8ff('0x1f')](handleEntityNotFound(_0x3915fa,null))[_0xf8ff('0x1f')](saveUpdates(_0x73a57e[_0xf8ff('0x45')],null))[_0xf8ff('0x1f')](respondWithResult(_0x3915fa,null))[_0xf8ff('0x40')](handleError(_0x3915fa,null));};exports[_0xf8ff('0x46')]=function(_0x188430,_0xd2fb84){return db[_0xf8ff('0x24')]['find']({'where':{'id':_0x188430[_0xf8ff('0x42')]['id']}})[_0xf8ff('0x1f')](handleEntityNotFound(_0xd2fb84,null))['then'](removeEntity(_0xd2fb84,null))['catch'](handleError(_0xd2fb84,null));};exports[_0xf8ff('0x47')]=function(_0x3098d5,_0x277c15,_0x4a6018){var _0x2db0c8={};var _0x3748fc={};var _0x46eedb;var _0x3371a9;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3098d5[_0xf8ff('0x42')]['id']}})[_0xf8ff('0x1f')](handleEntityNotFound(_0x277c15,null))['then'](function(_0x325555){if(_0x325555){_0x46eedb=_0x325555;_0x3748fc[_0xf8ff('0x29')]=_[_0xf8ff('0x2c')](db['Dynamics365Field'][_0xf8ff('0x25')]);_0x3748fc['query']=_[_0xf8ff('0x2c')](_0x3098d5[_0xf8ff('0x2b')]);_0x3748fc[_0xf8ff('0x2d')]=_[_0xf8ff('0x2e')](_0x3748fc[_0xf8ff('0x29')],_0x3748fc[_0xf8ff('0x2b')]);_0x2db0c8[_0xf8ff('0x2f')]=_['intersection'](_0x3748fc[_0xf8ff('0x29')],qs[_0xf8ff('0x30')](_0x3098d5['query'][_0xf8ff('0x30')]));_0x2db0c8['attributes']=_0x2db0c8[_0xf8ff('0x2f')]['length']?_0x2db0c8[_0xf8ff('0x2f')]:_0x3748fc[_0xf8ff('0x29')];_0x2db0c8[_0xf8ff('0x34')]=qs[_0xf8ff('0x35')](_0x3098d5[_0xf8ff('0x2b')][_0xf8ff('0x35')]);_0x2db0c8[_0xf8ff('0x36')]=qs[_0xf8ff('0x2d')](_[_0xf8ff('0x37')](_0x3098d5[_0xf8ff('0x2b')],_0x3748fc[_0xf8ff('0x2d')]));if(_0x3098d5[_0xf8ff('0x2b')][_0xf8ff('0x38')]){_0x2db0c8[_0xf8ff('0x36')]=_[_0xf8ff('0x39')](_0x2db0c8[_0xf8ff('0x36')],{'$or':_[_0xf8ff('0x2a')](_0x2db0c8[_0xf8ff('0x2f')],function(_0x316e87){var _0x157ebb={};_0x157ebb[_0x316e87]={'$like':'%'+_0x3098d5[_0xf8ff('0x2b')]['filter']+'%'};return _0x157ebb;})});}_0x2db0c8=_[_0xf8ff('0x39')]({},_0x2db0c8,_0x3098d5[_0xf8ff('0x3b')]);return _0x46eedb[_0xf8ff('0x47')](_0x2db0c8);}})['then'](function(_0x36d33a){if(_0x36d33a){_0x3371a9=_0x36d33a['length'];if(!_0x3098d5[_0xf8ff('0x2b')][_0xf8ff('0x32')](_0xf8ff('0x33'))){_0x2db0c8[_0xf8ff('0x1b')]=qs['limit'](_0x3098d5['query'][_0xf8ff('0x1b')]);_0x2db0c8[_0xf8ff('0x19')]=qs[_0xf8ff('0x19')](_0x3098d5[_0xf8ff('0x2b')][_0xf8ff('0x19')]);}return _0x46eedb['getFields'](_0x2db0c8);}})[_0xf8ff('0x1f')](function(_0x536a3d){if(_0x536a3d){return _0x536a3d?{'count':_0x3371a9,'rows':_0x536a3d}:null;}})[_0xf8ff('0x1f')](respondWithResult(_0x277c15,null))[_0xf8ff('0x40')](handleError(_0x277c15,null));};exports[_0xf8ff('0x48')]=function(_0x183a0e,_0x55f8df,_0x3ce948){var _0x13a7e9={};var _0x44900c={};var _0x79ec66;var _0x2235b7;return db[_0xf8ff('0x24')][_0xf8ff('0x49')]({'where':{'id':_0x183a0e['params']['id']}})['then'](handleEntityNotFound(_0x55f8df,null))['then'](function(_0x52057f){if(_0x52057f){_0x79ec66=_0x52057f;_0x44900c[_0xf8ff('0x29')]=_[_0xf8ff('0x2c')](db[_0xf8ff('0x4a')][_0xf8ff('0x25')]);_0x44900c[_0xf8ff('0x2b')]=_[_0xf8ff('0x2c')](_0x183a0e[_0xf8ff('0x2b')]);_0x44900c[_0xf8ff('0x2d')]=_[_0xf8ff('0x2e')](_0x44900c[_0xf8ff('0x29')],_0x44900c['query']);_0x13a7e9[_0xf8ff('0x2f')]=_[_0xf8ff('0x2e')](_0x44900c['model'],qs[_0xf8ff('0x30')](_0x183a0e[_0xf8ff('0x2b')][_0xf8ff('0x30')]));_0x13a7e9[_0xf8ff('0x2f')]=_0x13a7e9['attributes'][_0xf8ff('0x31')]?_0x13a7e9[_0xf8ff('0x2f')]:_0x44900c[_0xf8ff('0x29')];_0x13a7e9[_0xf8ff('0x34')]=qs[_0xf8ff('0x35')](_0x183a0e[_0xf8ff('0x2b')][_0xf8ff('0x35')]);_0x13a7e9[_0xf8ff('0x36')]=qs[_0xf8ff('0x2d')](_['pick'](_0x183a0e['query'],_0x44900c[_0xf8ff('0x2d')]));if(_0x183a0e[_0xf8ff('0x2b')][_0xf8ff('0x38')]){_0x13a7e9['where']=_[_0xf8ff('0x39')](_0x13a7e9['where'],{'$or':_['map'](_0x13a7e9[_0xf8ff('0x2f')],function(_0x3c629d){var _0x326899={};_0x326899[_0x3c629d]={'$like':'%'+_0x183a0e[_0xf8ff('0x2b')][_0xf8ff('0x38')]+'%'};return _0x326899;})});}_0x13a7e9=_[_0xf8ff('0x39')]({},_0x13a7e9,_0x183a0e[_0xf8ff('0x3b')]);return _0x79ec66['getSubjects'](_0x13a7e9);}})[_0xf8ff('0x1f')](function(_0x5347f6){if(_0x5347f6){_0x2235b7=_0x5347f6[_0xf8ff('0x31')];if(!_0x183a0e[_0xf8ff('0x2b')]['hasOwnProperty']('nolimit')){_0x13a7e9['limit']=qs['limit'](_0x183a0e[_0xf8ff('0x2b')][_0xf8ff('0x1b')]);_0x13a7e9['offset']=qs[_0xf8ff('0x19')](_0x183a0e[_0xf8ff('0x2b')][_0xf8ff('0x19')]);}return _0x79ec66[_0xf8ff('0x48')](_0x13a7e9);}})[_0xf8ff('0x1f')](function(_0x22554a){if(_0x22554a){return _0x22554a?{'count':_0x2235b7,'rows':_0x22554a}:null;}})[_0xf8ff('0x1f')](respondWithResult(_0x55f8df,null))['catch'](handleError(_0x55f8df,null));};exports[_0xf8ff('0x4b')]=function(_0xc53cf4,_0xb43f98,_0x26c290){var _0x1a475b={};var _0x3978b0={};var _0x3e7845;var _0x10da6b;return db[_0xf8ff('0x24')]['findOne']({'where':{'id':_0xc53cf4[_0xf8ff('0x42')]['id']}})['then'](handleEntityNotFound(_0xb43f98,null))['then'](function(_0x35ec68){if(_0x35ec68){_0x3e7845=_0x35ec68;_0x3978b0[_0xf8ff('0x29')]=_[_0xf8ff('0x2c')](db[_0xf8ff('0x4a')][_0xf8ff('0x25')]);_0x3978b0[_0xf8ff('0x2b')]=_[_0xf8ff('0x2c')](_0xc53cf4[_0xf8ff('0x2b')]);_0x3978b0[_0xf8ff('0x2d')]=_['intersection'](_0x3978b0[_0xf8ff('0x29')],_0x3978b0[_0xf8ff('0x2b')]);_0x1a475b[_0xf8ff('0x2f')]=_[_0xf8ff('0x2e')](_0x3978b0[_0xf8ff('0x29')],qs[_0xf8ff('0x30')](_0xc53cf4['query'][_0xf8ff('0x30')]));_0x1a475b['attributes']=_0x1a475b[_0xf8ff('0x2f')][_0xf8ff('0x31')]?_0x1a475b[_0xf8ff('0x2f')]:_0x3978b0['model'];_0x1a475b[_0xf8ff('0x34')]=qs[_0xf8ff('0x35')](_0xc53cf4[_0xf8ff('0x2b')][_0xf8ff('0x35')]);_0x1a475b[_0xf8ff('0x36')]=qs['filters'](_[_0xf8ff('0x37')](_0xc53cf4['query'],_0x3978b0[_0xf8ff('0x2d')]));if(_0xc53cf4[_0xf8ff('0x2b')]['filter']){_0x1a475b['where']=_[_0xf8ff('0x39')](_0x1a475b[_0xf8ff('0x36')],{'$or':_[_0xf8ff('0x2a')](_0x1a475b[_0xf8ff('0x2f')],function(_0x194a9a){var _0x5bb584={};_0x5bb584[_0x194a9a]={'$like':'%'+_0xc53cf4[_0xf8ff('0x2b')][_0xf8ff('0x38')]+'%'};return _0x5bb584;})});}_0x1a475b=_['merge']({},_0x1a475b,_0xc53cf4['options']);return _0x3e7845[_0xf8ff('0x4b')](_0x1a475b);}})[_0xf8ff('0x1f')](function(_0x24b496){if(_0x24b496){_0x10da6b=_0x24b496[_0xf8ff('0x31')];if(!_0xc53cf4[_0xf8ff('0x2b')]['hasOwnProperty']('nolimit')){_0x1a475b[_0xf8ff('0x1b')]=qs[_0xf8ff('0x1b')](_0xc53cf4['query'][_0xf8ff('0x1b')]);_0x1a475b[_0xf8ff('0x19')]=qs[_0xf8ff('0x19')](_0xc53cf4[_0xf8ff('0x2b')][_0xf8ff('0x19')]);}return _0x3e7845[_0xf8ff('0x4b')](_0x1a475b);}})[_0xf8ff('0x1f')](function(_0x45e5c2){if(_0x45e5c2){return _0x45e5c2?{'count':_0x10da6b,'rows':_0x45e5c2}:null;}})[_0xf8ff('0x1f')](respondWithResult(_0xb43f98,null))[_0xf8ff('0x40')](handleError(_0xb43f98,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f0ee223..faffcd7 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x2f8838,_0x1f4aae){var _0x568f4c=function(_0x55a6ef){while(--_0x55a6ef){_0x2f8838['push'](_0x2f8838['shift']());}};_0x568f4c(++_0x1f4aae);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5add07,_0x192146){_0x5add07=_0x5add07-0x0;var _0x4b76ce=_0xb43b[_0x5add07];return _0x4b76ce;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x10563f,_0x24093e){var _0x407ad6=function(_0x2cab07){while(--_0x2cab07){_0x10563f['push'](_0x10563f['shift']());}};_0x407ad6(++_0x24093e);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2f7554,_0x5e8b63){_0x2f7554=_0x2f7554-0x0;var _0x22a973=_0x8d0e[_0x2f7554];return _0x22a973;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index d2c0984..3ad3945 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 _0x762b=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x563bbe,_0x18a7cc){var _0x2bd72c=function(_0x20ebbf){while(--_0x20ebbf){_0x563bbe['push'](_0x563bbe['shift']());}};_0x2bd72c(++_0x18a7cc);}(_0x762b,0x16b));var _0xb762=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x762b[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xb762('0x0'));var util=require(_0xb762('0x1'));var moment=require('moment');var BPromise=require(_0xb762('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb762('0x3'));var db=require(_0xb762('0x4'))['db'];var utils=require(_0xb762('0x5'));var logger=require(_0xb762('0x6'))('rpc');var config=require(_0xb762('0x7'));var jayson=require(_0xb762('0x8'));var client=jayson[_0xb762('0x9')][_0xb762('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xac8340,_0x1cbcc9,_0x1e06cf){return new BPromise(function(_0x165038,_0x57dee9){return client[_0xb762('0xb')](_0xac8340,_0x1e06cf)['then'](function(_0x5a0c6d){logger[_0xb762('0xc')](_0xb762('0xd'),_0x1cbcc9,_0xb762('0xe'));logger['debug'](_0xb762('0xf'),_0x1cbcc9,_0xb762('0xe'),JSON[_0xb762('0x10')](_0x5a0c6d));if(_0x5a0c6d[_0xb762('0x11')]){if(_0x5a0c6d[_0xb762('0x11')][_0xb762('0x12')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1cbcc9,_0x5a0c6d['error'][_0xb762('0x13')]);return _0x57dee9(_0x5a0c6d[_0xb762('0x11')][_0xb762('0x13')]);}logger[_0xb762('0x11')](_0xb762('0xd'),_0x1cbcc9,_0x5a0c6d['error'][_0xb762('0x13')]);return _0x165038(_0x5a0c6d[_0xb762('0x11')][_0xb762('0x13')]);}else{logger['info'](_0xb762('0xd'),_0x1cbcc9,_0xb762('0xe'));_0x165038(_0x5a0c6d['result']['message']);}})[_0xb762('0x14')](function(_0x2e6155){logger[_0xb762('0x11')](_0xb762('0xd'),_0x1cbcc9,_0x2e6155);_0x57dee9(_0x2e6155);});});} \ No newline at end of file +var _0xf7de=['../../config/environment','client','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xf7de,0x92));var _0xef7d=function(_0x20cc13,_0x1b730f){_0x20cc13=_0x20cc13-0x0;var _0x5fefe9=_0xf7de[_0x20cc13];return _0x5fefe9;};'use strict';var _=require(_0xef7d('0x0'));var util=require(_0xef7d('0x1'));var moment=require(_0xef7d('0x2'));var BPromise=require(_0xef7d('0x3'));var rs=require(_0xef7d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef7d('0x5'));var logger=require(_0xef7d('0x6'))(_0xef7d('0x7'));var config=require(_0xef7d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1db5ac,_0x444a14,_0x44a8fe){return new BPromise(function(_0x9d5bf,_0x4394c9){return client[_0xef7d('0xa')](_0x1db5ac,_0x44a8fe)[_0xef7d('0xb')](function(_0x5de570){logger[_0xef7d('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x444a14,_0xef7d('0xd'));logger[_0xef7d('0xe')](_0xef7d('0xf'),_0x444a14,_0xef7d('0xd'),JSON[_0xef7d('0x10')](_0x5de570));if(_0x5de570[_0xef7d('0x11')]){if(_0x5de570['error'][_0xef7d('0x12')]===0x1f4){logger[_0xef7d('0x11')](_0xef7d('0x13'),_0x444a14,_0x5de570[_0xef7d('0x11')][_0xef7d('0x14')]);return _0x4394c9(_0x5de570[_0xef7d('0x11')][_0xef7d('0x14')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x444a14,_0x5de570['error'][_0xef7d('0x14')]);return _0x9d5bf(_0x5de570[_0xef7d('0x11')]['message']);}else{logger[_0xef7d('0xc')](_0xef7d('0x13'),_0x444a14,_0xef7d('0xd'));_0x9d5bf(_0x5de570['result'][_0xef7d('0x14')]);}})[_0xef7d('0x15')](function(_0x434631){logger[_0xef7d('0x11')](_0xef7d('0x13'),_0x444a14,_0x434631);_0x4394c9(_0x434631);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ce1142d..3c189c7 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 _0x23e4=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0x44bffa,_0x3e613e){var _0x3e5565=function(_0x6afe76){while(--_0x6afe76){_0x44bffa['push'](_0x44bffa['shift']());}};_0x3e5565(++_0x3e613e);}(_0x23e4,0x1d2));var _0x423e=function(_0x2f811b,_0x228796){_0x2f811b=_0x2f811b-0x0;var _0x26144e=_0x23e4[_0x2f811b];return _0x26144e;};'use strict';var multer=require(_0x423e('0x0'));var util=require(_0x423e('0x1'));var path=require(_0x423e('0x2'));var timeout=require('connect-timeout');var express=require(_0x423e('0x3'));var router=express[_0x423e('0x4')]();var fs_extra=require(_0x423e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x423e('0x6'));var config=require(_0x423e('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x423e('0x8')]('/',auth[_0x423e('0x9')](),controller[_0x423e('0xa')]);router[_0x423e('0x8')](_0x423e('0xb'),auth[_0x423e('0x9')](),controller['show']);router[_0x423e('0xc')]('/',auth[_0x423e('0x9')](),controller[_0x423e('0xd')]);router[_0x423e('0xe')](_0x423e('0xb'),auth[_0x423e('0x9')](),controller[_0x423e('0xf')]);router[_0x423e('0x10')]('/:id',auth[_0x423e('0x9')](),controller[_0x423e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc436=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc436,0xf1));var _0x6c43=function(_0x236bf0,_0x157cc6){_0x236bf0=_0x236bf0-0x0;var _0xc69f43=_0xc436[_0x236bf0];return _0xc69f43;};'use strict';var multer=require(_0x6c43('0x0'));var util=require(_0x6c43('0x1'));var path=require('path');var timeout=require(_0x6c43('0x2'));var express=require('express');var router=express[_0x6c43('0x3')]();var fs_extra=require(_0x6c43('0x4'));var auth=require(_0x6c43('0x5'));var interaction=require(_0x6c43('0x6'));var config=require(_0x6c43('0x7'));var controller=require(_0x6c43('0x8'));router[_0x6c43('0x9')]('/',auth[_0x6c43('0xa')](),controller[_0x6c43('0xb')]);router[_0x6c43('0x9')](_0x6c43('0xc'),auth[_0x6c43('0xa')](),controller[_0x6c43('0xd')]);router[_0x6c43('0xe')]('/',auth['isAuthenticated'](),controller[_0x6c43('0xf')]);router[_0x6c43('0x10')]('/:id',auth[_0x6c43('0xa')](),controller[_0x6c43('0x11')]);router['delete'](_0x6c43('0xc'),auth['isAuthenticated'](),controller[_0x6c43('0x12')]);module[_0x6c43('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 21019fb..c3314f8 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 _0xdbfe=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0xaece9e,_0x45d1d8){var _0x158e07=function(_0x57407c){while(--_0x57407c){_0xaece9e['push'](_0xaece9e['shift']());}};_0x158e07(++_0x45d1d8);}(_0xdbfe,0x1e9));var _0xedbf=function(_0x46b4e6,_0x2b1fea){_0x46b4e6=_0x46b4e6-0x0;var _0x1f7fbc=_0xdbfe[_0x46b4e6];return _0x1f7fbc;};'use strict';var Sequelize=require(_0xedbf('0x0'));module[_0xedbf('0x1')]={'type':{'type':Sequelize[_0xedbf('0x2')](_0xedbf('0x3'),_0xedbf('0x4'),_0xedbf('0x5'),_0xedbf('0x6'),_0xedbf('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xedbf('0x8')]},'key':{'type':Sequelize[_0xedbf('0x8')]},'keyType':{'type':Sequelize[_0xedbf('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xedbf('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xedbf('0x8')]},'customField':{'type':Sequelize[_0xedbf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xedbf('0x8')]}}; \ No newline at end of file +var _0xbaea=['exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x56562d,_0x578183){var _0xdafef9=function(_0x27453e){while(--_0x27453e){_0x56562d['push'](_0x56562d['shift']());}};_0xdafef9(++_0x578183);}(_0xbaea,0x1d8));var _0xabae=function(_0x5d9728,_0x5d8b01){_0x5d9728=_0x5d9728-0x0;var _0x5500db=_0xbaea[_0x5d9728];return _0x5500db;};'use strict';var Sequelize=require('sequelize');module[_0xabae('0x0')]={'type':{'type':Sequelize['ENUM'](_0xabae('0x1'),_0xabae('0x2'),_0xabae('0x3'),_0xabae('0x4'),_0xabae('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xabae('0x6')]},'key':{'type':Sequelize[_0xabae('0x6')]},'keyType':{'type':Sequelize[_0xabae('0x7')](_0xabae('0x1'),_0xabae('0x2'),_0xabae('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xabae('0x6')]},'nameField':{'type':Sequelize[_0xabae('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xabae('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ecb10e1..891bf02 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 _0x3b25=['includeAll','include','findAll','rows','catch','params','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count'];(function(_0x2e52ff,_0x479a7f){var _0x2a7a0d=function(_0x5d2ef5){while(--_0x5d2ef5){_0x2e52ff['push'](_0x2e52ff['shift']());}};_0x2a7a0d(++_0x479a7f);}(_0x3b25,0xa6));var _0x53b2=function(_0x3f8a38,_0x274364){_0x3f8a38=_0x3f8a38-0x0;var _0xab48c=_0x3b25[_0x3f8a38];return _0xab48c;};'use strict';var emlformat=require(_0x53b2('0x0'));var rimraf=require(_0x53b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53b2('0x2'));var rp=require(_0x53b2('0x3'));var moment=require(_0x53b2('0x4'));var BPromise=require(_0x53b2('0x5'));var Mustache=require('mustache');var util=require(_0x53b2('0x6'));var path=require('path');var sox=require(_0x53b2('0x7'));var csv=require(_0x53b2('0x8'));var ejs=require(_0x53b2('0x9'));var fs=require('fs');var fs_extra=require(_0x53b2('0xa'));var _=require(_0x53b2('0xb'));var squel=require(_0x53b2('0xc'));var crypto=require(_0x53b2('0xd'));var jsforce=require(_0x53b2('0xe'));var deskjs=require(_0x53b2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x53b2('0x10'));var authService=require(_0x53b2('0x11'));var qs=require(_0x53b2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53b2('0x13'));var logger=require(_0x53b2('0x14'))(_0x53b2('0x15'));var utils=require(_0x53b2('0x16'));var config=require(_0x53b2('0x17'));var licenseUtil=require(_0x53b2('0x18'));var db=require(_0x53b2('0x19'))['db'];function respondWithStatusCode(_0x469b0b,_0xfb14f){_0xfb14f=_0xfb14f||0xcc;return function(_0x42a2f9){if(_0x42a2f9){return _0x469b0b[_0x53b2('0x1a')](_0xfb14f);}return _0x469b0b['status'](_0xfb14f)[_0x53b2('0x1b')]();};}function respondWithResult(_0x15d9fe,_0x593bfe){_0x593bfe=_0x593bfe||0xc8;return function(_0x22266f){if(_0x22266f){return _0x15d9fe[_0x53b2('0x1c')](_0x593bfe)['json'](_0x22266f);}};}function respondWithFilteredResult(_0x3120cb,_0x19f0f7){return function(_0x14d916){if(_0x14d916){var _0x50edd8=typeof _0x19f0f7[_0x53b2('0x1d')]===_0x53b2('0x1e')&&typeof _0x19f0f7[_0x53b2('0x1f')]===_0x53b2('0x1e');var _0xe4277a=_0x14d916['count'];var _0x1432ae=_0x50edd8?0x0:_0x19f0f7[_0x53b2('0x1d')];var _0x45a014=_0x50edd8?_0x14d916['count']:_0x19f0f7[_0x53b2('0x1d')]+_0x19f0f7[_0x53b2('0x1f')];var _0x462147;if(_0x45a014>=_0xe4277a){_0x45a014=_0xe4277a;_0x462147=0xc8;}else{_0x462147=0xce;}_0x3120cb[_0x53b2('0x1c')](_0x462147);return _0x3120cb['set'](_0x53b2('0x20'),_0x1432ae+'-'+_0x45a014+'/'+_0xe4277a)[_0x53b2('0x21')](_0x14d916);}return null;};}function patchUpdates(_0x441aee){return function(_0x4a04e2){try{jsonpatch[_0x53b2('0x22')](_0x4a04e2,_0x441aee,!![]);}catch(_0x496fd3){return BPromise[_0x53b2('0x23')](_0x496fd3);}return _0x4a04e2[_0x53b2('0x24')]();};}function saveUpdates(_0x5a702d,_0x1b3fc7){return function(_0x7b60c9){if(_0x7b60c9){return _0x7b60c9[_0x53b2('0x25')](_0x5a702d)[_0x53b2('0x26')](function(_0x10fbf4){return _0x10fbf4;});}return null;};}function removeEntity(_0x46cc3f,_0x2c19c5){return function(_0x1ac007){if(_0x1ac007){return _0x1ac007[_0x53b2('0x27')]()['then'](function(){_0x46cc3f[_0x53b2('0x1c')](0xcc)[_0x53b2('0x1b')]();});}};}function handleEntityNotFound(_0x546e61,_0x333b6f){return function(_0x142a15){if(!_0x142a15){_0x546e61['sendStatus'](0x194);}return _0x142a15;};}function handleError(_0x31d75f,_0x3e2562){_0x3e2562=_0x3e2562||0x1f4;return function(_0x45c756){logger[_0x53b2('0x28')](_0x45c756[_0x53b2('0x29')]);if(_0x45c756[_0x53b2('0x2a')]){delete _0x45c756[_0x53b2('0x2a')];}_0x31d75f[_0x53b2('0x1c')](_0x3e2562)[_0x53b2('0x2b')](_0x45c756);};}exports[_0x53b2('0x2c')]=function(_0x2d40a4,_0x5e5942){var _0x13be67={},_0x321763={},_0x4c748c={'count':0x0,'rows':[]};var _0xb9170c=_['map'](db[_0x53b2('0x2d')][_0x53b2('0x2e')],function(_0x1e03ba){return{'name':_0x1e03ba[_0x53b2('0x2f')],'type':_0x1e03ba[_0x53b2('0x30')][_0x53b2('0x31')]};});_0x321763[_0x53b2('0x32')]=_['map'](_0xb9170c,_0x53b2('0x2a'));_0x321763[_0x53b2('0x33')]=_['keys'](_0x2d40a4[_0x53b2('0x33')]);_0x321763[_0x53b2('0x34')]=_[_0x53b2('0x35')](_0x321763['model'],_0x321763[_0x53b2('0x33')]);_0x13be67[_0x53b2('0x36')]=_[_0x53b2('0x35')](_0x321763[_0x53b2('0x32')],qs['fields'](_0x2d40a4['query']['fields']));_0x13be67[_0x53b2('0x36')]=_0x13be67[_0x53b2('0x36')][_0x53b2('0x37')]?_0x13be67['attributes']:_0x321763['model'];if(!_0x2d40a4[_0x53b2('0x33')][_0x53b2('0x38')](_0x53b2('0x39'))){_0x13be67[_0x53b2('0x1f')]=qs['limit'](_0x2d40a4[_0x53b2('0x33')]['limit']);_0x13be67[_0x53b2('0x1d')]=qs['offset'](_0x2d40a4['query'][_0x53b2('0x1d')]);}_0x13be67[_0x53b2('0x3a')]=qs[_0x53b2('0x3b')](_0x2d40a4['query'][_0x53b2('0x3b')]);_0x13be67[_0x53b2('0x3c')]=qs[_0x53b2('0x34')](_[_0x53b2('0x3d')](_0x2d40a4[_0x53b2('0x33')],_0x321763[_0x53b2('0x34')]),_0xb9170c);if(_0x2d40a4[_0x53b2('0x33')][_0x53b2('0x3e')]){_0x13be67[_0x53b2('0x3c')]=_[_0x53b2('0x3f')](_0x13be67[_0x53b2('0x3c')],{'$or':_[_0x53b2('0x40')](_0xb9170c,function(_0xb6d706){if(_0xb6d706[_0x53b2('0x30')]!==_0x53b2('0x41')){var _0x4ec59c={};_0x4ec59c[_0xb6d706['name']]={'$like':'%'+_0x2d40a4[_0x53b2('0x33')][_0x53b2('0x3e')]+'%'};return _0x4ec59c;}})});}_0x13be67=_[_0x53b2('0x3f')]({},_0x13be67,_0x2d40a4[_0x53b2('0x42')]);var _0x491ef7={'where':_0x13be67[_0x53b2('0x3c')]};return db[_0x53b2('0x2d')][_0x53b2('0x43')](_0x491ef7)[_0x53b2('0x26')](function(_0x53d79d){_0x4c748c[_0x53b2('0x43')]=_0x53d79d;if(_0x2d40a4['query'][_0x53b2('0x44')]){_0x13be67[_0x53b2('0x45')]=[{'all':!![]}];}return db[_0x53b2('0x2d')][_0x53b2('0x46')](_0x13be67);})[_0x53b2('0x26')](function(_0x370008){_0x4c748c[_0x53b2('0x47')]=_0x370008;return _0x4c748c;})[_0x53b2('0x26')](respondWithFilteredResult(_0x5e5942,_0x13be67))[_0x53b2('0x48')](handleError(_0x5e5942,null));};exports['show']=function(_0x59fff0,_0x3568f3){var _0x2efb15={'raw':!![],'where':{'id':_0x59fff0[_0x53b2('0x49')]['id']}},_0x2b8fb6={};_0x2b8fb6[_0x53b2('0x32')]=_['keys'](db[_0x53b2('0x2d')][_0x53b2('0x2e')]);_0x2b8fb6[_0x53b2('0x33')]=_['keys'](_0x59fff0[_0x53b2('0x33')]);_0x2b8fb6['filters']=_[_0x53b2('0x35')](_0x2b8fb6[_0x53b2('0x32')],_0x2b8fb6['query']);_0x2efb15[_0x53b2('0x36')]=_[_0x53b2('0x35')](_0x2b8fb6['model'],qs[_0x53b2('0x4a')](_0x59fff0[_0x53b2('0x33')][_0x53b2('0x4a')]));_0x2efb15[_0x53b2('0x36')]=_0x2efb15[_0x53b2('0x36')]['length']?_0x2efb15[_0x53b2('0x36')]:_0x2b8fb6['model'];if(_0x59fff0[_0x53b2('0x33')][_0x53b2('0x44')]){_0x2efb15[_0x53b2('0x45')]=[{'all':!![]}];}_0x2efb15=_[_0x53b2('0x3f')]({},_0x2efb15,_0x59fff0[_0x53b2('0x42')]);return db['Dynamics365Field'][_0x53b2('0x4b')](_0x2efb15)['then'](handleEntityNotFound(_0x3568f3,null))['then'](respondWithResult(_0x3568f3,null))['catch'](handleError(_0x3568f3,null));};exports[_0x53b2('0x4c')]=function(_0x2308ea,_0x4e49f3){return db['Dynamics365Field'][_0x53b2('0x4c')](_0x2308ea[_0x53b2('0x4d')],{})[_0x53b2('0x26')](respondWithResult(_0x4e49f3,0xc9))['catch'](handleError(_0x4e49f3,null));};exports[_0x53b2('0x25')]=function(_0x4952dd,_0x449d9b){if(_0x4952dd[_0x53b2('0x4d')]['id']){delete _0x4952dd['body']['id'];}return db[_0x53b2('0x2d')][_0x53b2('0x4b')]({'where':{'id':_0x4952dd['params']['id']}})[_0x53b2('0x26')](handleEntityNotFound(_0x449d9b,null))[_0x53b2('0x26')](saveUpdates(_0x4952dd[_0x53b2('0x4d')],null))[_0x53b2('0x26')](respondWithResult(_0x449d9b,null))[_0x53b2('0x48')](handleError(_0x449d9b,null));};exports[_0x53b2('0x27')]=function(_0x5b6c35,_0x33e9dc){return db[_0x53b2('0x2d')][_0x53b2('0x4b')]({'where':{'id':_0x5b6c35[_0x53b2('0x49')]['id']}})[_0x53b2('0x26')](handleEntityNotFound(_0x33e9dc,null))[_0x53b2('0x26')](removeEntity(_0x33e9dc,null))[_0x53b2('0x48')](handleError(_0x33e9dc,null));}; \ No newline at end of file +var _0x5830=['params','keys','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','Dynamics365Field','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show'];(function(_0xf45da8,_0x356737){var _0x4f310d=function(_0x551b96){while(--_0x551b96){_0xf45da8['push'](_0xf45da8['shift']());}};_0x4f310d(++_0x356737);}(_0x5830,0x1cf));var _0x0583=function(_0x26dad6,_0x2a399f){_0x26dad6=_0x26dad6-0x0;var _0x28ad1f=_0x5830[_0x26dad6];return _0x28ad1f;};'use strict';var emlformat=require(_0x0583('0x0'));var rimraf=require(_0x0583('0x1'));var zipdir=require(_0x0583('0x2'));var jsonpatch=require(_0x0583('0x3'));var rp=require('request-promise');var moment=require(_0x0583('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0583('0x5'));var util=require(_0x0583('0x6'));var path=require(_0x0583('0x7'));var sox=require(_0x0583('0x8'));var csv=require(_0x0583('0x9'));var ejs=require(_0x0583('0xa'));var fs=require('fs');var fs_extra=require(_0x0583('0xb'));var _=require(_0x0583('0xc'));var squel=require('squel');var crypto=require(_0x0583('0xd'));var jsforce=require(_0x0583('0xe'));var deskjs=require(_0x0583('0xf'));var toCsv=require(_0x0583('0x9'));var querystring=require(_0x0583('0x10'));var Papa=require('papaparse');var Redis=require(_0x0583('0x11'));var authService=require(_0x0583('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0583('0x13'));var hardwareService=require(_0x0583('0x14'));var logger=require('../../config/logger')(_0x0583('0x15'));var utils=require(_0x0583('0x16'));var config=require(_0x0583('0x17'));var licenseUtil=require(_0x0583('0x18'));var db=require(_0x0583('0x19'))['db'];function respondWithStatusCode(_0x3b3683,_0xdcf8fd){_0xdcf8fd=_0xdcf8fd||0xcc;return function(_0x18414e){if(_0x18414e){return _0x3b3683[_0x0583('0x1a')](_0xdcf8fd);}return _0x3b3683[_0x0583('0x1b')](_0xdcf8fd)['end']();};}function respondWithResult(_0x10e70d,_0x4a5f6d){_0x4a5f6d=_0x4a5f6d||0xc8;return function(_0x4920b6){if(_0x4920b6){return _0x10e70d[_0x0583('0x1b')](_0x4a5f6d)[_0x0583('0x1c')](_0x4920b6);}};}function respondWithFilteredResult(_0x36f929,_0xfba603){return function(_0x3aed95){if(_0x3aed95){var _0x14fbc6=typeof _0xfba603[_0x0583('0x1d')]==='undefined'&&typeof _0xfba603[_0x0583('0x1e')]===_0x0583('0x1f');var _0x19f18d=_0x3aed95['count'];var _0x23db05=_0x14fbc6?0x0:_0xfba603[_0x0583('0x1d')];var _0x1b443a=_0x14fbc6?_0x3aed95[_0x0583('0x20')]:_0xfba603[_0x0583('0x1d')]+_0xfba603[_0x0583('0x1e')];var _0x5b23ed;if(_0x1b443a>=_0x19f18d){_0x1b443a=_0x19f18d;_0x5b23ed=0xc8;}else{_0x5b23ed=0xce;}_0x36f929[_0x0583('0x1b')](_0x5b23ed);return _0x36f929[_0x0583('0x21')](_0x0583('0x22'),_0x23db05+'-'+_0x1b443a+'/'+_0x19f18d)['json'](_0x3aed95);}return null;};}function patchUpdates(_0x37a3f9){return function(_0x2e4f54){try{jsonpatch[_0x0583('0x23')](_0x2e4f54,_0x37a3f9,!![]);}catch(_0x37ae59){return BPromise[_0x0583('0x24')](_0x37ae59);}return _0x2e4f54[_0x0583('0x25')]();};}function saveUpdates(_0x5208d7,_0x10974a){return function(_0x5510e3){if(_0x5510e3){return _0x5510e3[_0x0583('0x26')](_0x5208d7)[_0x0583('0x27')](function(_0x14bccd){return _0x14bccd;});}return null;};}function removeEntity(_0x1594b7,_0x7b01c7){return function(_0x3ad0ab){if(_0x3ad0ab){return _0x3ad0ab[_0x0583('0x28')]()[_0x0583('0x27')](function(){_0x1594b7[_0x0583('0x1b')](0xcc)[_0x0583('0x29')]();});}};}function handleEntityNotFound(_0x46e8e9,_0x75c56a){return function(_0x176e27){if(!_0x176e27){_0x46e8e9[_0x0583('0x1a')](0x194);}return _0x176e27;};}function handleError(_0x1b2a7d,_0x475f9e){_0x475f9e=_0x475f9e||0x1f4;return function(_0x2a1072){logger['error'](_0x2a1072['stack']);if(_0x2a1072[_0x0583('0x2a')]){delete _0x2a1072[_0x0583('0x2a')];}_0x1b2a7d[_0x0583('0x1b')](_0x475f9e)[_0x0583('0x2b')](_0x2a1072);};}exports[_0x0583('0x2c')]=function(_0x34b5bc,_0x13e47f){var _0x282504={},_0x162863={},_0x174457={'count':0x0,'rows':[]};var _0x741a=_['map'](db[_0x0583('0x2d')][_0x0583('0x2e')],function(_0x14c4d9){return{'name':_0x14c4d9[_0x0583('0x2f')],'type':_0x14c4d9['type']['key']};});_0x162863[_0x0583('0x30')]=_[_0x0583('0x31')](_0x741a,_0x0583('0x2a'));_0x162863[_0x0583('0x32')]=_['keys'](_0x34b5bc['query']);_0x162863[_0x0583('0x33')]=_[_0x0583('0x34')](_0x162863[_0x0583('0x30')],_0x162863[_0x0583('0x32')]);_0x282504[_0x0583('0x35')]=_[_0x0583('0x34')](_0x162863[_0x0583('0x30')],qs['fields'](_0x34b5bc['query'][_0x0583('0x36')]));_0x282504['attributes']=_0x282504[_0x0583('0x35')]['length']?_0x282504[_0x0583('0x35')]:_0x162863[_0x0583('0x30')];if(!_0x34b5bc[_0x0583('0x32')][_0x0583('0x37')](_0x0583('0x38'))){_0x282504[_0x0583('0x1e')]=qs[_0x0583('0x1e')](_0x34b5bc['query'][_0x0583('0x1e')]);_0x282504['offset']=qs[_0x0583('0x1d')](_0x34b5bc['query'][_0x0583('0x1d')]);}_0x282504[_0x0583('0x39')]=qs[_0x0583('0x3a')](_0x34b5bc[_0x0583('0x32')][_0x0583('0x3a')]);_0x282504[_0x0583('0x3b')]=qs[_0x0583('0x33')](_['pick'](_0x34b5bc['query'],_0x162863[_0x0583('0x33')]),_0x741a);if(_0x34b5bc[_0x0583('0x32')][_0x0583('0x3c')]){_0x282504[_0x0583('0x3b')]=_[_0x0583('0x3d')](_0x282504[_0x0583('0x3b')],{'$or':_['map'](_0x741a,function(_0x5633){if(_0x5633[_0x0583('0x3e')]!==_0x0583('0x3f')){var _0xe491e8={};_0xe491e8[_0x5633['name']]={'$like':'%'+_0x34b5bc[_0x0583('0x32')][_0x0583('0x3c')]+'%'};return _0xe491e8;}})});}_0x282504=_['merge']({},_0x282504,_0x34b5bc[_0x0583('0x40')]);var _0x49d40b={'where':_0x282504['where']};return db[_0x0583('0x2d')][_0x0583('0x20')](_0x49d40b)[_0x0583('0x27')](function(_0x3749d4){_0x174457[_0x0583('0x20')]=_0x3749d4;if(_0x34b5bc['query']['includeAll']){_0x282504['include']=[{'all':!![]}];}return db[_0x0583('0x2d')][_0x0583('0x41')](_0x282504);})[_0x0583('0x27')](function(_0x5cd4d9){_0x174457[_0x0583('0x42')]=_0x5cd4d9;return _0x174457;})['then'](respondWithFilteredResult(_0x13e47f,_0x282504))[_0x0583('0x43')](handleError(_0x13e47f,null));};exports[_0x0583('0x44')]=function(_0x273249,_0x4debd5){var _0x2adf2a={'raw':!![],'where':{'id':_0x273249[_0x0583('0x45')]['id']}},_0x2b0fd5={};_0x2b0fd5[_0x0583('0x30')]=_[_0x0583('0x46')](db[_0x0583('0x2d')]['rawAttributes']);_0x2b0fd5[_0x0583('0x32')]=_[_0x0583('0x46')](_0x273249[_0x0583('0x32')]);_0x2b0fd5['filters']=_[_0x0583('0x34')](_0x2b0fd5[_0x0583('0x30')],_0x2b0fd5[_0x0583('0x32')]);_0x2adf2a[_0x0583('0x35')]=_[_0x0583('0x34')](_0x2b0fd5['model'],qs['fields'](_0x273249[_0x0583('0x32')][_0x0583('0x36')]));_0x2adf2a[_0x0583('0x35')]=_0x2adf2a[_0x0583('0x35')][_0x0583('0x47')]?_0x2adf2a[_0x0583('0x35')]:_0x2b0fd5[_0x0583('0x30')];if(_0x273249[_0x0583('0x32')]['includeAll']){_0x2adf2a[_0x0583('0x48')]=[{'all':!![]}];}_0x2adf2a=_[_0x0583('0x3d')]({},_0x2adf2a,_0x273249['options']);return db[_0x0583('0x2d')][_0x0583('0x49')](_0x2adf2a)[_0x0583('0x27')](handleEntityNotFound(_0x4debd5,null))[_0x0583('0x27')](respondWithResult(_0x4debd5,null))['catch'](handleError(_0x4debd5,null));};exports['create']=function(_0x5852f6,_0xe381f){return db[_0x0583('0x2d')][_0x0583('0x4a')](_0x5852f6[_0x0583('0x4b')],{})[_0x0583('0x27')](respondWithResult(_0xe381f,0xc9))[_0x0583('0x43')](handleError(_0xe381f,null));};exports['update']=function(_0x38c031,_0x55cd2e){if(_0x38c031[_0x0583('0x4b')]['id']){delete _0x38c031[_0x0583('0x4b')]['id'];}return db[_0x0583('0x2d')][_0x0583('0x49')]({'where':{'id':_0x38c031[_0x0583('0x45')]['id']}})[_0x0583('0x27')](handleEntityNotFound(_0x55cd2e,null))[_0x0583('0x27')](saveUpdates(_0x38c031[_0x0583('0x4b')],null))[_0x0583('0x27')](respondWithResult(_0x55cd2e,null))[_0x0583('0x43')](handleError(_0x55cd2e,null));};exports['destroy']=function(_0x4cd659,_0x366c70){return db[_0x0583('0x2d')][_0x0583('0x49')]({'where':{'id':_0x4cd659[_0x0583('0x45')]['id']}})[_0x0583('0x27')](handleEntityNotFound(_0x366c70,null))[_0x0583('0x27')](removeEntity(_0x366c70,null))['catch'](handleError(_0x366c70,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 8d5b168..d128541 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 _0x49a4=['request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','api','bluebird'];(function(_0x138d06,_0x33edf2){var _0x1a01eb=function(_0x387acb){while(--_0x387acb){_0x138d06['push'](_0x138d06['shift']());}};_0x1a01eb(++_0x33edf2);}(_0x49a4,0x19c));var _0x449a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x49a4[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x449a('0x0'));var util=require(_0x449a('0x1'));var logger=require('../../config/logger')(_0x449a('0x2'));var moment=require('moment');var BPromise=require(_0x449a('0x3'));var rp=require(_0x449a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x449a('0x5'));var config=require(_0x449a('0x6'));var attributes=require(_0x449a('0x7'));module['exports']=function(_0x552059,_0x44281b){return _0x552059[_0x449a('0x8')](_0x449a('0x9'),attributes,{'tableName':_0x449a('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x449a('0xb'),_0x449a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd894=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x2cec5d,_0x4faa1d){var _0x59c60b=function(_0x417b7c){while(--_0x417b7c){_0x2cec5d['push'](_0x2cec5d['shift']());}};_0x59c60b(++_0x4faa1d);}(_0xd894,0xa6));var _0x4d89=function(_0x25d74c,_0x5ba6fd){_0x25d74c=_0x25d74c-0x0;var _0xd8fc9a=_0xd894[_0x25d74c];return _0xd8fc9a;};'use strict';var _=require(_0x4d89('0x0'));var util=require(_0x4d89('0x1'));var logger=require(_0x4d89('0x2'))(_0x4d89('0x3'));var moment=require('moment');var BPromise=require(_0x4d89('0x4'));var rp=require(_0x4d89('0x5'));var fs=require('fs');var path=require(_0x4d89('0x6'));var rimraf=require(_0x4d89('0x7'));var config=require(_0x4d89('0x8'));var attributes=require(_0x4d89('0x9'));module[_0x4d89('0xa')]=function(_0x582525,_0x1123cb){return _0x582525[_0x4d89('0xb')]('Dynamics365Field',attributes,{'tableName':_0x4d89('0xc'),'paranoid':![],'indexes':[{'name':_0x4d89('0xd'),'fields':['idField',_0x4d89('0xe')],'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 325f517..71fd28b 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 _0x7642=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then'];(function(_0x58e7dd,_0x221a4e){var _0x549a23=function(_0x41cea1){while(--_0x41cea1){_0x58e7dd['push'](_0x58e7dd['shift']());}};_0x549a23(++_0x221a4e);}(_0x7642,0x135));var _0x2764=function(_0x2b50df,_0xbad153){_0x2b50df=_0x2b50df-0x0;var _0x3391a5=_0x7642[_0x2b50df];return _0x3391a5;};'use strict';var _=require(_0x2764('0x0'));var util=require(_0x2764('0x1'));var moment=require(_0x2764('0x2'));var BPromise=require(_0x2764('0x3'));var rs=require(_0x2764('0x4'));var fs=require('fs');var Redis=require(_0x2764('0x5'));var db=require(_0x2764('0x6'))['db'];var utils=require(_0x2764('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2764('0x8'));var client=jayson[_0x2764('0x9')][_0x2764('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11a539,_0x3e638d,_0x1c7ba4){return new BPromise(function(_0x42a9ec,_0x15673c){return client[_0x2764('0xb')](_0x11a539,_0x1c7ba4)[_0x2764('0xc')](function(_0x254a17){logger['info'](_0x2764('0xd'),_0x3e638d,_0x2764('0xe'));logger['debug'](_0x2764('0xf'),_0x3e638d,_0x2764('0xe'),JSON[_0x2764('0x10')](_0x254a17));if(_0x254a17[_0x2764('0x11')]){if(_0x254a17[_0x2764('0x11')][_0x2764('0x12')]===0x1f4){logger['error'](_0x2764('0xd'),_0x3e638d,_0x254a17['error'][_0x2764('0x13')]);return _0x15673c(_0x254a17[_0x2764('0x11')][_0x2764('0x13')]);}logger['error'](_0x2764('0xd'),_0x3e638d,_0x254a17['error'][_0x2764('0x13')]);return _0x42a9ec(_0x254a17[_0x2764('0x11')][_0x2764('0x13')]);}else{logger[_0x2764('0x14')](_0x2764('0xd'),_0x3e638d,_0x2764('0xe'));_0x42a9ec(_0x254a17[_0x2764('0x15')][_0x2764('0x13')]);}})[_0x2764('0x16')](function(_0x38f1de){logger['error'](_0x2764('0xd'),_0x3e638d,_0x38f1de);_0x15673c(_0x38f1de);});});} \ No newline at end of file +var _0xcf2d=['request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4b8edf,_0x20b662){var _0x2ee767=function(_0x2c280b){while(--_0x2c280b){_0x4b8edf['push'](_0x4b8edf['shift']());}};_0x2ee767(++_0x20b662);}(_0xcf2d,0x120));var _0xdcf2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdcf2('0x0'));var moment=require(_0xdcf2('0x1'));var BPromise=require(_0xdcf2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcf2('0x3'));var db=require(_0xdcf2('0x4'))['db'];var utils=require(_0xdcf2('0x5'));var logger=require(_0xdcf2('0x6'))(_0xdcf2('0x7'));var config=require(_0xdcf2('0x8'));var jayson=require(_0xdcf2('0x9'));var client=jayson[_0xdcf2('0xa')][_0xdcf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16ff89,_0x61d658,_0x155ac0){return new BPromise(function(_0x34a2ab,_0xd7096){return client[_0xdcf2('0xc')](_0x16ff89,_0x155ac0)[_0xdcf2('0xd')](function(_0x2988de){logger[_0xdcf2('0xe')](_0xdcf2('0xf'),_0x61d658,_0xdcf2('0x10'));logger[_0xdcf2('0x11')](_0xdcf2('0x12'),_0x61d658,_0xdcf2('0x10'),JSON[_0xdcf2('0x13')](_0x2988de));if(_0x2988de[_0xdcf2('0x14')]){if(_0x2988de['error'][_0xdcf2('0x15')]===0x1f4){logger[_0xdcf2('0x14')](_0xdcf2('0xf'),_0x61d658,_0x2988de['error'][_0xdcf2('0x16')]);return _0xd7096(_0x2988de[_0xdcf2('0x14')]['message']);}logger[_0xdcf2('0x14')](_0xdcf2('0xf'),_0x61d658,_0x2988de[_0xdcf2('0x14')][_0xdcf2('0x16')]);return _0x34a2ab(_0x2988de[_0xdcf2('0x14')][_0xdcf2('0x16')]);}else{logger[_0xdcf2('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x61d658,_0xdcf2('0x10'));_0x34a2ab(_0x2988de[_0xdcf2('0x17')][_0xdcf2('0x16')]);}})[_0xdcf2('0x18')](function(_0x105e2e){logger[_0xdcf2('0x14')](_0xdcf2('0xf'),_0x61d658,_0x105e2e);_0xd7096(_0x105e2e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e5ebaa5..fd35156 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 _0xc1cd=['index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1cd,0xfc));var _0xdc1c=function(_0x5679d0,_0xe85795){_0x5679d0=_0x5679d0-0x0;var _0x4276eb=_0xc1cd[_0x5679d0];return _0x4276eb;};'use strict';var multer=require(_0xdc1c('0x0'));var util=require(_0xdc1c('0x1'));var path=require(_0xdc1c('0x2'));var timeout=require(_0xdc1c('0x3'));var express=require(_0xdc1c('0x4'));var router=express['Router']();var fs_extra=require(_0xdc1c('0x5'));var auth=require(_0xdc1c('0x6'));var interaction=require(_0xdc1c('0x7'));var config=require(_0xdc1c('0x8'));var controller=require(_0xdc1c('0x9'));router[_0xdc1c('0xa')]('/',auth[_0xdc1c('0xb')](),controller[_0xdc1c('0xc')]);router[_0xdc1c('0xa')](_0xdc1c('0xd'),auth[_0xdc1c('0xb')](),controller[_0xdc1c('0xe')]);router['get']('/:id/configurations',auth[_0xdc1c('0xb')](),controller[_0xdc1c('0xf')]);router[_0xdc1c('0xa')]('/:id/fields',auth[_0xdc1c('0xb')](),controller[_0xdc1c('0x10')]);router[_0xdc1c('0x11')]('/',auth['isAuthenticated'](),controller[_0xdc1c('0x12')]);router[_0xdc1c('0x11')](_0xdc1c('0x13'),auth['isAuthenticated'](),controller[_0xdc1c('0x14')]);router[_0xdc1c('0x15')](_0xdc1c('0xd'),auth[_0xdc1c('0xb')](),controller[_0xdc1c('0x16')]);router['delete'](_0xdc1c('0xd'),auth[_0xdc1c('0xb')](),controller['destroy']);module[_0xdc1c('0x17')]=router; \ No newline at end of file +var _0xba93=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xba93,0x145));var _0x3ba9=function(_0x1616d9,_0x3c9e6f){_0x1616d9=_0x1616d9-0x0;var _0x2b3e89=_0xba93[_0x1616d9];return _0x2b3e89;};'use strict';var multer=require(_0x3ba9('0x0'));var util=require('util');var path=require(_0x3ba9('0x1'));var timeout=require(_0x3ba9('0x2'));var express=require(_0x3ba9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3ba9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ba9('0x5'));router[_0x3ba9('0x6')]('/',auth[_0x3ba9('0x7')](),controller[_0x3ba9('0x8')]);router[_0x3ba9('0x6')](_0x3ba9('0x9'),auth['isAuthenticated'](),controller[_0x3ba9('0xa')]);router['get'](_0x3ba9('0xb'),auth[_0x3ba9('0x7')](),controller['getConfigurations']);router[_0x3ba9('0x6')](_0x3ba9('0xc'),auth[_0x3ba9('0x7')](),controller[_0x3ba9('0xd')]);router[_0x3ba9('0xe')]('/',auth[_0x3ba9('0x7')](),controller[_0x3ba9('0xf')]);router[_0x3ba9('0xe')](_0x3ba9('0xb'),auth[_0x3ba9('0x7')](),controller[_0x3ba9('0x10')]);router[_0x3ba9('0x11')]('/:id',auth[_0x3ba9('0x7')](),controller[_0x3ba9('0x12')]);router[_0x3ba9('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3ba9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index ed22bb7..cae83c3 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 _0xfb11=['sequelize','STRING','username'];(function(_0x116b40,_0xf36542){var _0xdf922b=function(_0x1f5162){while(--_0x1f5162){_0x116b40['push'](_0x116b40['shift']());}};_0xdf922b(++_0xf36542);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xfb11[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'name':{'type':Sequelize[_0x1fb1('0x1')]},'description':{'type':Sequelize[_0x1fb1('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x1fb1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1fb1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x1fb1('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb145=['STRING','username','remoteUri','exports'];(function(_0x48b6c6,_0xba4073){var _0x1bcc9a=function(_0x581c84){while(--_0x581c84){_0x48b6c6['push'](_0x48b6c6['shift']());}};_0x1bcc9a(++_0xba4073);}(_0xb145,0xa3));var _0x5b14=function(_0x23c1f4,_0x42ad3e){_0x23c1f4=_0x23c1f4-0x0;var _0x164dd1=_0xb145[_0x23c1f4];return _0x164dd1;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'apiKey':{'type':Sequelize[_0x5b14('0x1')]},'remoteUri':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d920e87..5026eb3 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 _0x69d3=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','show','keys','find','catch','create','update','body','params','getConfigurations','findOne','FreshdeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','requester','subject','agent','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','default','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x69d3,0xda));var _0x369d=function(_0x4d6db8,_0x1df9b9){_0x4d6db8=_0x4d6db8-0x0;var _0x49dfe9=_0x69d3[_0x4d6db8];return _0x49dfe9;};'use strict';var emlformat=require(_0x369d('0x0'));var rimraf=require(_0x369d('0x1'));var zipdir=require(_0x369d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x369d('0x3'));var moment=require(_0x369d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x369d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x369d('0x6'));var ejs=require(_0x369d('0x7'));var fs=require('fs');var fs_extra=require(_0x369d('0x8'));var _=require(_0x369d('0x9'));var squel=require(_0x369d('0xa'));var crypto=require(_0x369d('0xb'));var jsforce=require(_0x369d('0xc'));var deskjs=require(_0x369d('0xd'));var toCsv=require(_0x369d('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x369d('0xe'));var authService=require(_0x369d('0xf'));var qs=require(_0x369d('0x10'));var as=require(_0x369d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x369d('0x12'));var utils=require(_0x369d('0x13'));var config=require(_0x369d('0x14'));var licenseUtil=require(_0x369d('0x15'));var db=require(_0x369d('0x16'))['db'];var integrations=require(_0x369d('0x17'));function respondWithStatusCode(_0x52c126,_0x15b417){_0x15b417=_0x15b417||0xcc;return function(_0x9d016){if(_0x9d016){return _0x52c126[_0x369d('0x18')](_0x15b417);}return _0x52c126[_0x369d('0x19')](_0x15b417)[_0x369d('0x1a')]();};}function respondWithResult(_0x539536,_0x5cd4c3){_0x5cd4c3=_0x5cd4c3||0xc8;return function(_0x5485a1){if(_0x5485a1){return _0x539536[_0x369d('0x19')](_0x5cd4c3)[_0x369d('0x1b')](_0x5485a1);}};}function respondWithFilteredResult(_0x389c43,_0x5b4f55){return function(_0x2c1a4a){if(_0x2c1a4a){var _0x29c1fe=typeof _0x5b4f55[_0x369d('0x1c')]==='undefined'&&typeof _0x5b4f55[_0x369d('0x1d')]===_0x369d('0x1e');var _0x4ea6c2=_0x2c1a4a['count'];var _0x597b67=_0x29c1fe?0x0:_0x5b4f55[_0x369d('0x1c')];var _0x4494b3=_0x29c1fe?_0x2c1a4a[_0x369d('0x1f')]:_0x5b4f55['offset']+_0x5b4f55[_0x369d('0x1d')];var _0x24dfff;if(_0x4494b3>=_0x4ea6c2){_0x4494b3=_0x4ea6c2;_0x24dfff=0xc8;}else{_0x24dfff=0xce;}_0x389c43[_0x369d('0x19')](_0x24dfff);return _0x389c43[_0x369d('0x20')](_0x369d('0x21'),_0x597b67+'-'+_0x4494b3+'/'+_0x4ea6c2)['json'](_0x2c1a4a);}return null;};}function patchUpdates(_0x5c9fdd){return function(_0x448e6e){try{jsonpatch[_0x369d('0x22')](_0x448e6e,_0x5c9fdd,!![]);}catch(_0x11ac1d){return BPromise[_0x369d('0x23')](_0x11ac1d);}return _0x448e6e[_0x369d('0x24')]();};}function saveUpdates(_0x15fbef,_0x1b262a){return function(_0x54a42e){if(_0x54a42e){return _0x54a42e['update'](_0x15fbef)[_0x369d('0x25')](function(_0xed16e){return _0xed16e;});}return null;};}function removeEntity(_0xf7bc3a,_0xcae58){return function(_0x30e7c5){if(_0x30e7c5){return _0x30e7c5[_0x369d('0x26')]()[_0x369d('0x25')](function(){_0xf7bc3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16145e,_0x46de2b){return function(_0x15cd81){if(!_0x15cd81){_0x16145e[_0x369d('0x18')](0x194);}return _0x15cd81;};}function handleError(_0x8aa521,_0x41e0cf){_0x41e0cf=_0x41e0cf||0x1f4;return function(_0x8090b0){logger['error'](_0x8090b0[_0x369d('0x27')]);if(_0x8090b0[_0x369d('0x28')]){delete _0x8090b0[_0x369d('0x28')];}_0x8aa521[_0x369d('0x19')](_0x41e0cf)[_0x369d('0x29')](_0x8090b0);};}exports[_0x369d('0x2a')]=function(_0x3d1ce0,_0x4d42ea){var _0x157291={},_0x56efb1={},_0x57b94c={'count':0x0,'rows':[]};var _0x38feda=_[_0x369d('0x2b')](db['FreshdeskAccount'][_0x369d('0x2c')],function(_0x5a14ce){return{'name':_0x5a14ce[_0x369d('0x2d')],'type':_0x5a14ce[_0x369d('0x2e')][_0x369d('0x2f')]};});_0x56efb1[_0x369d('0x30')]=_[_0x369d('0x2b')](_0x38feda,_0x369d('0x28'));_0x56efb1[_0x369d('0x31')]=_['keys'](_0x3d1ce0[_0x369d('0x31')]);_0x56efb1[_0x369d('0x32')]=_[_0x369d('0x33')](_0x56efb1[_0x369d('0x30')],_0x56efb1[_0x369d('0x31')]);_0x157291[_0x369d('0x34')]=_[_0x369d('0x33')](_0x56efb1[_0x369d('0x30')],qs['fields'](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x35')]));_0x157291[_0x369d('0x34')]=_0x157291[_0x369d('0x34')][_0x369d('0x36')]?_0x157291['attributes']:_0x56efb1[_0x369d('0x30')];if(!_0x3d1ce0[_0x369d('0x31')][_0x369d('0x37')](_0x369d('0x38'))){_0x157291[_0x369d('0x1d')]=qs[_0x369d('0x1d')](_0x3d1ce0['query'][_0x369d('0x1d')]);_0x157291[_0x369d('0x1c')]=qs[_0x369d('0x1c')](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x1c')]);}_0x157291[_0x369d('0x39')]=qs[_0x369d('0x3a')](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x3a')]);_0x157291[_0x369d('0x3b')]=qs[_0x369d('0x32')](_[_0x369d('0x3c')](_0x3d1ce0[_0x369d('0x31')],_0x56efb1[_0x369d('0x32')]),_0x38feda);if(_0x3d1ce0[_0x369d('0x31')][_0x369d('0x3d')]){_0x157291[_0x369d('0x3b')]=_[_0x369d('0x3e')](_0x157291[_0x369d('0x3b')],{'$or':_[_0x369d('0x2b')](_0x38feda,function(_0x10c5b6){if(_0x10c5b6[_0x369d('0x2e')]!==_0x369d('0x3f')){var _0xd58366={};_0xd58366[_0x10c5b6['name']]={'$like':'%'+_0x3d1ce0['query'][_0x369d('0x3d')]+'%'};return _0xd58366;}})});}_0x157291=_[_0x369d('0x3e')]({},_0x157291,_0x3d1ce0[_0x369d('0x40')]);var _0x401bc7={'where':_0x157291[_0x369d('0x3b')]};return db[_0x369d('0x41')][_0x369d('0x1f')](_0x401bc7)[_0x369d('0x25')](function(_0x46c940){_0x57b94c['count']=_0x46c940;if(_0x3d1ce0[_0x369d('0x31')][_0x369d('0x42')]){_0x157291[_0x369d('0x43')]=[{'all':!![]}];}return db[_0x369d('0x41')][_0x369d('0x44')](_0x157291);})[_0x369d('0x25')](function(_0x28803c){_0x57b94c[_0x369d('0x45')]=_0x28803c;return _0x57b94c;})['then'](respondWithFilteredResult(_0x4d42ea,_0x157291))['catch'](handleError(_0x4d42ea,null));};exports[_0x369d('0x46')]=function(_0x3222ce,_0x30909a){var _0x4dad71={'raw':![],'where':{'id':_0x3222ce['params']['id']}},_0x4d07ac={};_0x4d07ac[_0x369d('0x30')]=_[_0x369d('0x47')](db['FreshdeskAccount'][_0x369d('0x2c')]);_0x4d07ac[_0x369d('0x31')]=_[_0x369d('0x47')](_0x3222ce[_0x369d('0x31')]);_0x4d07ac['filters']=_[_0x369d('0x33')](_0x4d07ac['model'],_0x4d07ac[_0x369d('0x31')]);_0x4dad71['attributes']=_[_0x369d('0x33')](_0x4d07ac[_0x369d('0x30')],qs[_0x369d('0x35')](_0x3222ce['query']['fields']));_0x4dad71[_0x369d('0x34')]=_0x4dad71[_0x369d('0x34')][_0x369d('0x36')]?_0x4dad71['attributes']:_0x4d07ac[_0x369d('0x30')];if(_0x3222ce[_0x369d('0x31')][_0x369d('0x42')]){_0x4dad71[_0x369d('0x43')]=[{'all':!![]}];}_0x4dad71=_[_0x369d('0x3e')]({},_0x4dad71,_0x3222ce[_0x369d('0x40')]);return db[_0x369d('0x41')][_0x369d('0x48')](_0x4dad71)[_0x369d('0x25')](handleEntityNotFound(_0x30909a,null))['then'](respondWithResult(_0x30909a,null))[_0x369d('0x49')](handleError(_0x30909a,null));};exports[_0x369d('0x4a')]=function(_0xcc1465,_0x257c3d){return db[_0x369d('0x41')][_0x369d('0x4a')](_0xcc1465['body'],{})[_0x369d('0x25')](respondWithResult(_0x257c3d,0xc9))[_0x369d('0x49')](handleError(_0x257c3d,null));};exports[_0x369d('0x4b')]=function(_0x44a357,_0x1b04d9){if(_0x44a357[_0x369d('0x4c')]['id']){delete _0x44a357[_0x369d('0x4c')]['id'];}return db[_0x369d('0x41')][_0x369d('0x48')]({'where':{'id':_0x44a357[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x1b04d9,null))[_0x369d('0x25')](saveUpdates(_0x44a357['body'],null))[_0x369d('0x25')](respondWithResult(_0x1b04d9,null))[_0x369d('0x49')](handleError(_0x1b04d9,null));};exports[_0x369d('0x26')]=function(_0x85edd6,_0x648a0d){return db['FreshdeskAccount'][_0x369d('0x48')]({'where':{'id':_0x85edd6['params']['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x648a0d,null))[_0x369d('0x25')](removeEntity(_0x648a0d,null))[_0x369d('0x49')](handleError(_0x648a0d,null));};exports[_0x369d('0x4e')]=function(_0x46c62c,_0x1bd31c,_0x22e2d4){var _0x418cab={};var _0x1cdeca={};var _0x9f1544;var _0x4d582a;return db['FreshdeskAccount'][_0x369d('0x4f')]({'where':{'id':_0x46c62c[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x1bd31c,null))[_0x369d('0x25')](function(_0x347df4){if(_0x347df4){_0x9f1544=_0x347df4;_0x1cdeca['model']=_['keys'](db[_0x369d('0x50')][_0x369d('0x2c')]);_0x1cdeca['query']=_[_0x369d('0x47')](_0x46c62c['query']);_0x1cdeca[_0x369d('0x32')]=_[_0x369d('0x33')](_0x1cdeca[_0x369d('0x30')],_0x1cdeca['query']);_0x418cab[_0x369d('0x34')]=_[_0x369d('0x33')](_0x1cdeca[_0x369d('0x30')],qs[_0x369d('0x35')](_0x46c62c['query']['fields']));_0x418cab[_0x369d('0x34')]=_0x418cab[_0x369d('0x34')][_0x369d('0x36')]?_0x418cab['attributes']:_0x1cdeca[_0x369d('0x30')];_0x418cab[_0x369d('0x39')]=qs[_0x369d('0x3a')](_0x46c62c['query']['sort']);_0x418cab[_0x369d('0x3b')]=qs[_0x369d('0x32')](_[_0x369d('0x3c')](_0x46c62c[_0x369d('0x31')],_0x1cdeca['filters']));if(_0x46c62c[_0x369d('0x31')][_0x369d('0x3d')]){_0x418cab[_0x369d('0x3b')]=_[_0x369d('0x3e')](_0x418cab[_0x369d('0x3b')],{'$or':_['map'](_0x418cab[_0x369d('0x34')],function(_0x304a9e){var _0x28b752={};_0x28b752[_0x304a9e]={'$like':'%'+_0x46c62c['query'][_0x369d('0x3d')]+'%'};return _0x28b752;})});}_0x418cab=_['merge']({},_0x418cab,_0x46c62c[_0x369d('0x40')]);return _0x9f1544['getConfigurations'](_0x418cab);}})['then'](function(_0x5f440e){if(_0x5f440e){_0x4d582a=_0x5f440e['length'];if(!_0x46c62c[_0x369d('0x31')]['hasOwnProperty'](_0x369d('0x38'))){_0x418cab['limit']=qs[_0x369d('0x1d')](_0x46c62c[_0x369d('0x31')][_0x369d('0x1d')]);_0x418cab['offset']=qs[_0x369d('0x1c')](_0x46c62c[_0x369d('0x31')][_0x369d('0x1c')]);}return _0x9f1544[_0x369d('0x4e')](_0x418cab);}})[_0x369d('0x25')](function(_0xe63e0f){if(_0xe63e0f){return _0xe63e0f?{'count':_0x4d582a,'rows':_0xe63e0f}:null;}})['then'](respondWithResult(_0x1bd31c,null))[_0x369d('0x49')](handleError(_0x1bd31c,null));};exports['addConfiguration']=function(_0x5706be,_0x56c98e,_0x36e990){if(_0x5706be[_0x369d('0x4c')]['id']){delete _0x5706be[_0x369d('0x4c')]['id'];}return db[_0x369d('0x41')][_0x369d('0x4f')]({'where':{'id':_0x5706be[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x56c98e,null))[_0x369d('0x25')](function(_0x1c9683){if(_0x1c9683){_0x5706be[_0x369d('0x4c')][_0x369d('0x51')]=_0x1c9683['id'];_0x5706be[_0x369d('0x4c')][_0x369d('0x52')]=integrations[_0x369d('0x53')](_0x5706be[_0x369d('0x4c')][_0x369d('0x54')],_0x5706be['body'][_0x369d('0x2e')]);_0x5706be['body'][_0x369d('0x55')]=integrations[_0x369d('0x56')](_0x5706be[_0x369d('0x4c')][_0x369d('0x54')],_0x5706be[_0x369d('0x4c')]['type']);return db[_0x369d('0x50')]['create'](_0x5706be['body'],{'include':[{'model':db[_0x369d('0x57')],'as':_0x369d('0x52')},{'model':db[_0x369d('0x57')],'as':_0x369d('0x55')}]});}return null;})[_0x369d('0x25')](respondWithResult(_0x56c98e,null))[_0x369d('0x49')](handleError(_0x56c98e,null));};exports[_0x369d('0x58')]=function(_0x11ac7d,_0x55a811,_0x461782){var _0x24e70d='';return db['FreshdeskAccount'][_0x369d('0x4f')]({'where':{'id':_0x11ac7d[_0x369d('0x4d')]['id']},'attributes':['id',_0x369d('0x59'),'apiKey']})[_0x369d('0x25')](handleEntityNotFound(_0x55a811,null))['then'](function(_0x2a8152){if(_0x2a8152){_0x24e70d=_0x2a8152[_0x369d('0x59')];var _0x328593=_0x24e70d[_0x369d('0x5a')](-0x1);if(_0x328593==='/'){_0x24e70d=_0x24e70d[_0x369d('0x5b')](0x0,_0x24e70d[_0x369d('0x5c')](_0x328593));}return rp({'method':_0x369d('0x5d'),'uri':util['format'](_0x369d('0x5e'),_0x24e70d,_0x369d('0x5f')),'headers':{'Authorization':util['format'](_0x369d('0x60'),new Buffer(util['format'](_0x369d('0x61'),_0x2a8152[_0x369d('0x62')]))[_0x369d('0x63')]('base64'))},'json':!![]});}})[_0x369d('0x25')](function(_0x2cbe15){if(_0x2cbe15){var _0x4f6c45=[_0x369d('0x64'),_0x369d('0x65'),_0x369d('0x66'),'description',_0x369d('0x19'),_0x369d('0x67'),_0x369d('0x68'),_0x369d('0x69'),_0x369d('0x6a'),'group',_0x369d('0x6b')];_[_0x369d('0x6c')](_0x2cbe15,function(_0x45fadd){return _0x4f6c45[_0x369d('0x6d')](_0x45fadd[_0x369d('0x28')])||!_0x45fadd['default']&&_0x45fadd['type']!==_0x369d('0x6e')&&_0x45fadd[_0x369d('0x2e')]!==_0x369d('0x6f');});return{'count':_0x2cbe15[_0x369d('0x36')],'rows':_[_0x369d('0x2b')](_0x2cbe15,function(_0x2cc996){return{'id':_0x2cc996['name'],'name':_0x2cc996[_0x369d('0x70')],'custom':!_0x2cc996[_0x369d('0x71')],'options':_0x2cc996['choices']?_[_0x369d('0x2b')](_0x2cc996['choices'],function(_0x4936eb){return{'name':_['capitalize'](_0x4936eb),'value':_0x4936eb};}):[]};})};}})[_0x369d('0x25')](respondWithResult(_0x55a811,null))[_0x369d('0x49')](function(_0x5b2c2f){var _0x4148a9=_0x11ac7d['query'][_0x369d('0x72')]?0x1f4:_0x5b2c2f['statusCode']||0x1f4;logger['error'](_0x369d('0x73'),_0x369d('0x58'),_0x4148a9,JSON[_0x369d('0x74')](_0x5b2c2f));delete _0x5b2c2f[_0x369d('0x28')];if(_0x4148a9===0x191){_0x4148a9=0x190;}_0x55a811[_0x369d('0x19')](_0x4148a9)['send'](_0x11ac7d[_0x369d('0x31')][_0x369d('0x72')]?{'message':_0x369d('0x75'),'statusCode':_0x5b2c2f[_0x369d('0x76')]}:_0x5b2c2f);});}; \ No newline at end of file +var _0xd353=['default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','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','api','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','FreshdeskAccount','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','destroy','find','getConfigurations','FreshdeskConfiguration','findOne','AccountId','Subjects','getSubjects','channel','type','Descriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','description','group','source','ticket_type','remove'];(function(_0x5d7863,_0x1fa9c5){var _0x35c3b0=function(_0x3d53b9){while(--_0x3d53b9){_0x5d7863['push'](_0x5d7863['shift']());}};_0x35c3b0(++_0x1fa9c5);}(_0xd353,0x7e));var _0x3d35=function(_0x4e0f80,_0x443a9a){_0x4e0f80=_0x4e0f80-0x0;var _0x350f87=_0xd353[_0x4e0f80];return _0x350f87;};'use strict';var emlformat=require(_0x3d35('0x0'));var rimraf=require(_0x3d35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d35('0x2'));var rp=require(_0x3d35('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3d35('0x4'));var util=require('util');var path=require(_0x3d35('0x5'));var sox=require(_0x3d35('0x6'));var csv=require(_0x3d35('0x7'));var ejs=require(_0x3d35('0x8'));var fs=require('fs');var fs_extra=require(_0x3d35('0x9'));var _=require(_0x3d35('0xa'));var squel=require(_0x3d35('0xb'));var crypto=require('crypto');var jsforce=require(_0x3d35('0xc'));var deskjs=require(_0x3d35('0xd'));var toCsv=require(_0x3d35('0x7'));var querystring=require(_0x3d35('0xe'));var Papa=require(_0x3d35('0xf'));var Redis=require(_0x3d35('0x10'));var authService=require(_0x3d35('0x11'));var qs=require(_0x3d35('0x12'));var as=require(_0x3d35('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d35('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x289a28,_0x567e9a){_0x567e9a=_0x567e9a||0xcc;return function(_0x2dceec){if(_0x2dceec){return _0x289a28[_0x3d35('0x15')](_0x567e9a);}return _0x289a28[_0x3d35('0x16')](_0x567e9a)[_0x3d35('0x17')]();};}function respondWithResult(_0x548c84,_0x46b4e8){_0x46b4e8=_0x46b4e8||0xc8;return function(_0x2118cd){if(_0x2118cd){return _0x548c84['status'](_0x46b4e8)[_0x3d35('0x18')](_0x2118cd);}};}function respondWithFilteredResult(_0x1ec3db,_0x5c59a0){return function(_0x2c5e9a){if(_0x2c5e9a){var _0x2f3dfa=typeof _0x5c59a0[_0x3d35('0x19')]===_0x3d35('0x1a')&&typeof _0x5c59a0[_0x3d35('0x1b')]===_0x3d35('0x1a');var _0x57444d=_0x2c5e9a[_0x3d35('0x1c')];var _0x1f06dc=_0x2f3dfa?0x0:_0x5c59a0[_0x3d35('0x19')];var _0x3c452a=_0x2f3dfa?_0x2c5e9a['count']:_0x5c59a0['offset']+_0x5c59a0[_0x3d35('0x1b')];var _0x4ddb8d;if(_0x3c452a>=_0x57444d){_0x3c452a=_0x57444d;_0x4ddb8d=0xc8;}else{_0x4ddb8d=0xce;}_0x1ec3db['status'](_0x4ddb8d);return _0x1ec3db[_0x3d35('0x1d')](_0x3d35('0x1e'),_0x1f06dc+'-'+_0x3c452a+'/'+_0x57444d)[_0x3d35('0x18')](_0x2c5e9a);}return null;};}function patchUpdates(_0x314df6){return function(_0x50d199){try{jsonpatch[_0x3d35('0x1f')](_0x50d199,_0x314df6,!![]);}catch(_0x51445b){return BPromise[_0x3d35('0x20')](_0x51445b);}return _0x50d199[_0x3d35('0x21')]();};}function saveUpdates(_0x446cd8,_0x3f5a61){return function(_0x23c1c8){if(_0x23c1c8){return _0x23c1c8[_0x3d35('0x22')](_0x446cd8)[_0x3d35('0x23')](function(_0x2e62a7){return _0x2e62a7;});}return null;};}function removeEntity(_0xe8fcaa,_0x53945c){return function(_0x5dbaeb){if(_0x5dbaeb){return _0x5dbaeb['destroy']()[_0x3d35('0x23')](function(){_0xe8fcaa[_0x3d35('0x16')](0xcc)[_0x3d35('0x17')]();});}};}function handleEntityNotFound(_0x5ee1f3,_0x2c7ca4){return function(_0x5bbac4){if(!_0x5bbac4){_0x5ee1f3['sendStatus'](0x194);}return _0x5bbac4;};}function handleError(_0x5323b8,_0x5eacc0){_0x5eacc0=_0x5eacc0||0x1f4;return function(_0x5004e2){logger[_0x3d35('0x24')](_0x5004e2[_0x3d35('0x25')]);if(_0x5004e2['name']){delete _0x5004e2['name'];}_0x5323b8['status'](_0x5eacc0)[_0x3d35('0x26')](_0x5004e2);};}exports[_0x3d35('0x27')]=function(_0x381cec,_0x46a63d){var _0x23c62a={},_0x5c6cfe={},_0x9b3b9f={'count':0x0,'rows':[]};var _0x11f7d6=_[_0x3d35('0x28')](db[_0x3d35('0x29')][_0x3d35('0x2a')],function(_0x11c30b){return{'name':_0x11c30b[_0x3d35('0x2b')],'type':_0x11c30b['type']['key']};});_0x5c6cfe[_0x3d35('0x2c')]=_[_0x3d35('0x28')](_0x11f7d6,_0x3d35('0x2d'));_0x5c6cfe[_0x3d35('0x2e')]=_[_0x3d35('0x2f')](_0x381cec[_0x3d35('0x2e')]);_0x5c6cfe[_0x3d35('0x30')]=_[_0x3d35('0x31')](_0x5c6cfe[_0x3d35('0x2c')],_0x5c6cfe['query']);_0x23c62a[_0x3d35('0x32')]=_['intersection'](_0x5c6cfe['model'],qs['fields'](_0x381cec[_0x3d35('0x2e')][_0x3d35('0x33')]));_0x23c62a[_0x3d35('0x32')]=_0x23c62a[_0x3d35('0x32')][_0x3d35('0x34')]?_0x23c62a['attributes']:_0x5c6cfe[_0x3d35('0x2c')];if(!_0x381cec['query'][_0x3d35('0x35')](_0x3d35('0x36'))){_0x23c62a[_0x3d35('0x1b')]=qs[_0x3d35('0x1b')](_0x381cec[_0x3d35('0x2e')][_0x3d35('0x1b')]);_0x23c62a[_0x3d35('0x19')]=qs[_0x3d35('0x19')](_0x381cec[_0x3d35('0x2e')][_0x3d35('0x19')]);}_0x23c62a[_0x3d35('0x37')]=qs[_0x3d35('0x38')](_0x381cec[_0x3d35('0x2e')]['sort']);_0x23c62a[_0x3d35('0x39')]=qs['filters'](_[_0x3d35('0x3a')](_0x381cec[_0x3d35('0x2e')],_0x5c6cfe['filters']),_0x11f7d6);if(_0x381cec[_0x3d35('0x2e')]['filter']){_0x23c62a[_0x3d35('0x39')]=_['merge'](_0x23c62a[_0x3d35('0x39')],{'$or':_[_0x3d35('0x28')](_0x11f7d6,function(_0x5a1d64){if(_0x5a1d64['type']!==_0x3d35('0x3b')){var _0x1376f4={};_0x1376f4[_0x5a1d64[_0x3d35('0x2d')]]={'$like':'%'+_0x381cec['query'][_0x3d35('0x3c')]+'%'};return _0x1376f4;}})});}_0x23c62a=_[_0x3d35('0x3d')]({},_0x23c62a,_0x381cec['options']);var _0x1e69e0={'where':_0x23c62a[_0x3d35('0x39')]};return db[_0x3d35('0x29')]['count'](_0x1e69e0)[_0x3d35('0x23')](function(_0x38da1c){_0x9b3b9f[_0x3d35('0x1c')]=_0x38da1c;if(_0x381cec[_0x3d35('0x2e')][_0x3d35('0x3e')]){_0x23c62a[_0x3d35('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x3d35('0x40')](_0x23c62a);})['then'](function(_0x3afc63){_0x9b3b9f[_0x3d35('0x41')]=_0x3afc63;return _0x9b3b9f;})[_0x3d35('0x23')](respondWithFilteredResult(_0x46a63d,_0x23c62a))[_0x3d35('0x42')](handleError(_0x46a63d,null));};exports[_0x3d35('0x43')]=function(_0x9f2156,_0x1198b4){var _0x1d52b4={'raw':![],'where':{'id':_0x9f2156[_0x3d35('0x44')]['id']}},_0xf9f327={};_0xf9f327[_0x3d35('0x2c')]=_[_0x3d35('0x2f')](db[_0x3d35('0x29')][_0x3d35('0x2a')]);_0xf9f327['query']=_[_0x3d35('0x2f')](_0x9f2156[_0x3d35('0x2e')]);_0xf9f327[_0x3d35('0x30')]=_['intersection'](_0xf9f327[_0x3d35('0x2c')],_0xf9f327['query']);_0x1d52b4[_0x3d35('0x32')]=_[_0x3d35('0x31')](_0xf9f327['model'],qs[_0x3d35('0x33')](_0x9f2156[_0x3d35('0x2e')]['fields']));_0x1d52b4[_0x3d35('0x32')]=_0x1d52b4[_0x3d35('0x32')][_0x3d35('0x34')]?_0x1d52b4['attributes']:_0xf9f327[_0x3d35('0x2c')];if(_0x9f2156[_0x3d35('0x2e')][_0x3d35('0x3e')]){_0x1d52b4[_0x3d35('0x3f')]=[{'all':!![]}];}_0x1d52b4=_[_0x3d35('0x3d')]({},_0x1d52b4,_0x9f2156[_0x3d35('0x45')]);return db[_0x3d35('0x29')]['find'](_0x1d52b4)[_0x3d35('0x23')](handleEntityNotFound(_0x1198b4,null))['then'](respondWithResult(_0x1198b4,null))[_0x3d35('0x42')](handleError(_0x1198b4,null));};exports['create']=function(_0x3ea610,_0x2aba01){return db[_0x3d35('0x29')][_0x3d35('0x46')](_0x3ea610[_0x3d35('0x47')],{})[_0x3d35('0x23')](respondWithResult(_0x2aba01,0xc9))[_0x3d35('0x42')](handleError(_0x2aba01,null));};exports[_0x3d35('0x22')]=function(_0x1da2d9,_0x2b3156){if(_0x1da2d9[_0x3d35('0x47')]['id']){delete _0x1da2d9[_0x3d35('0x47')]['id'];}return db[_0x3d35('0x29')]['find']({'where':{'id':_0x1da2d9[_0x3d35('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b3156,null))[_0x3d35('0x23')](saveUpdates(_0x1da2d9[_0x3d35('0x47')],null))[_0x3d35('0x23')](respondWithResult(_0x2b3156,null))['catch'](handleError(_0x2b3156,null));};exports[_0x3d35('0x48')]=function(_0x1ccdf8,_0x5de3b0){return db[_0x3d35('0x29')][_0x3d35('0x49')]({'where':{'id':_0x1ccdf8['params']['id']}})['then'](handleEntityNotFound(_0x5de3b0,null))[_0x3d35('0x23')](removeEntity(_0x5de3b0,null))['catch'](handleError(_0x5de3b0,null));};exports[_0x3d35('0x4a')]=function(_0x5486a5,_0x39a37c,_0xdc728b){var _0xc2613d={};var _0x50b7ff={};var _0x2fee40;var _0x1b9739;return db[_0x3d35('0x29')]['findOne']({'where':{'id':_0x5486a5[_0x3d35('0x44')]['id']}})[_0x3d35('0x23')](handleEntityNotFound(_0x39a37c,null))[_0x3d35('0x23')](function(_0x50875f){if(_0x50875f){_0x2fee40=_0x50875f;_0x50b7ff[_0x3d35('0x2c')]=_[_0x3d35('0x2f')](db[_0x3d35('0x4b')]['rawAttributes']);_0x50b7ff[_0x3d35('0x2e')]=_['keys'](_0x5486a5[_0x3d35('0x2e')]);_0x50b7ff[_0x3d35('0x30')]=_['intersection'](_0x50b7ff[_0x3d35('0x2c')],_0x50b7ff[_0x3d35('0x2e')]);_0xc2613d[_0x3d35('0x32')]=_[_0x3d35('0x31')](_0x50b7ff[_0x3d35('0x2c')],qs[_0x3d35('0x33')](_0x5486a5['query'][_0x3d35('0x33')]));_0xc2613d[_0x3d35('0x32')]=_0xc2613d[_0x3d35('0x32')][_0x3d35('0x34')]?_0xc2613d['attributes']:_0x50b7ff[_0x3d35('0x2c')];_0xc2613d['order']=qs[_0x3d35('0x38')](_0x5486a5['query'][_0x3d35('0x38')]);_0xc2613d[_0x3d35('0x39')]=qs[_0x3d35('0x30')](_[_0x3d35('0x3a')](_0x5486a5[_0x3d35('0x2e')],_0x50b7ff[_0x3d35('0x30')]));if(_0x5486a5[_0x3d35('0x2e')]['filter']){_0xc2613d[_0x3d35('0x39')]=_[_0x3d35('0x3d')](_0xc2613d['where'],{'$or':_[_0x3d35('0x28')](_0xc2613d[_0x3d35('0x32')],function(_0xfb1561){var _0x2cfe1a={};_0x2cfe1a[_0xfb1561]={'$like':'%'+_0x5486a5[_0x3d35('0x2e')][_0x3d35('0x3c')]+'%'};return _0x2cfe1a;})});}_0xc2613d=_[_0x3d35('0x3d')]({},_0xc2613d,_0x5486a5['options']);return _0x2fee40[_0x3d35('0x4a')](_0xc2613d);}})[_0x3d35('0x23')](function(_0x1d96ce){if(_0x1d96ce){_0x1b9739=_0x1d96ce[_0x3d35('0x34')];if(!_0x5486a5[_0x3d35('0x2e')][_0x3d35('0x35')](_0x3d35('0x36'))){_0xc2613d[_0x3d35('0x1b')]=qs[_0x3d35('0x1b')](_0x5486a5[_0x3d35('0x2e')][_0x3d35('0x1b')]);_0xc2613d[_0x3d35('0x19')]=qs[_0x3d35('0x19')](_0x5486a5[_0x3d35('0x2e')]['offset']);}return _0x2fee40[_0x3d35('0x4a')](_0xc2613d);}})[_0x3d35('0x23')](function(_0x48d2b1){if(_0x48d2b1){return _0x48d2b1?{'count':_0x1b9739,'rows':_0x48d2b1}:null;}})[_0x3d35('0x23')](respondWithResult(_0x39a37c,null))[_0x3d35('0x42')](handleError(_0x39a37c,null));};exports['addConfiguration']=function(_0x120ea8,_0x1107c8,_0x3ea56a){if(_0x120ea8[_0x3d35('0x47')]['id']){delete _0x120ea8[_0x3d35('0x47')]['id'];}return db['FreshdeskAccount'][_0x3d35('0x4c')]({'where':{'id':_0x120ea8[_0x3d35('0x44')]['id']}})['then'](handleEntityNotFound(_0x1107c8,null))[_0x3d35('0x23')](function(_0x8c9323){if(_0x8c9323){_0x120ea8['body'][_0x3d35('0x4d')]=_0x8c9323['id'];_0x120ea8[_0x3d35('0x47')][_0x3d35('0x4e')]=integrations[_0x3d35('0x4f')](_0x120ea8[_0x3d35('0x47')][_0x3d35('0x50')],_0x120ea8['body'][_0x3d35('0x51')]);_0x120ea8[_0x3d35('0x47')][_0x3d35('0x52')]=integrations['getDescriptions'](_0x120ea8['body'][_0x3d35('0x50')],_0x120ea8[_0x3d35('0x47')]['type']);return db['FreshdeskConfiguration']['create'](_0x120ea8['body'],{'include':[{'model':db[_0x3d35('0x53')],'as':'Subjects'},{'model':db[_0x3d35('0x53')],'as':_0x3d35('0x52')}]});}return null;})['then'](respondWithResult(_0x1107c8,null))[_0x3d35('0x42')](handleError(_0x1107c8,null));};exports['getFields']=function(_0x2d448c,_0x580368,_0x34d813){var _0x5463c0='';return db['FreshdeskAccount'][_0x3d35('0x4c')]({'where':{'id':_0x2d448c['params']['id']},'attributes':['id',_0x3d35('0x54'),_0x3d35('0x55')]})['then'](handleEntityNotFound(_0x580368,null))['then'](function(_0x1b4e11){if(_0x1b4e11){_0x5463c0=_0x1b4e11[_0x3d35('0x54')];var _0x9af4d8=_0x5463c0[_0x3d35('0x56')](-0x1);if(_0x9af4d8==='/'){_0x5463c0=_0x5463c0[_0x3d35('0x57')](0x0,_0x5463c0[_0x3d35('0x58')](_0x9af4d8));}return rp({'method':_0x3d35('0x59'),'uri':util[_0x3d35('0x5a')](_0x3d35('0x5b'),_0x5463c0,_0x3d35('0x5c')),'headers':{'Authorization':util[_0x3d35('0x5a')](_0x3d35('0x5d'),new Buffer(util[_0x3d35('0x5a')](_0x3d35('0x5e'),_0x1b4e11[_0x3d35('0x55')]))[_0x3d35('0x5f')]('base64'))},'json':!![]});}})[_0x3d35('0x23')](function(_0x5cd5b0){if(_0x5cd5b0){var _0x11c2b2=[_0x3d35('0x60'),_0x3d35('0x61'),_0x3d35('0x62'),_0x3d35('0x63'),'status','priority',_0x3d35('0x64'),_0x3d35('0x65'),_0x3d35('0x66'),_0x3d35('0x64'),'company'];_[_0x3d35('0x67')](_0x5cd5b0,function(_0x485b7b){return _0x11c2b2['includes'](_0x485b7b[_0x3d35('0x2d')])||!_0x485b7b[_0x3d35('0x68')]&&_0x485b7b[_0x3d35('0x51')]!==_0x3d35('0x69')&&_0x485b7b[_0x3d35('0x51')]!==_0x3d35('0x6a');});return{'count':_0x5cd5b0['length'],'rows':_[_0x3d35('0x28')](_0x5cd5b0,function(_0x531c9d){return{'id':_0x531c9d[_0x3d35('0x2d')],'name':_0x531c9d[_0x3d35('0x6b')],'custom':!_0x531c9d[_0x3d35('0x68')],'options':_0x531c9d['choices']?_[_0x3d35('0x28')](_0x531c9d[_0x3d35('0x6c')],function(_0x582e31){return{'name':_[_0x3d35('0x6d')](_0x582e31),'value':_0x582e31};}):[]};})};}})['then'](respondWithResult(_0x580368,null))[_0x3d35('0x42')](function(_0x12df57){var _0xdb3ad2=_0x2d448c['query'][_0x3d35('0x6e')]?0x1f4:_0x12df57[_0x3d35('0x6f')]||0x1f4;logger[_0x3d35('0x24')](_0x3d35('0x70'),_0x3d35('0x71'),_0xdb3ad2,JSON['stringify'](_0x12df57));delete _0x12df57[_0x3d35('0x2d')];if(_0xdb3ad2===0x191){_0xdb3ad2=0x190;}_0x580368[_0x3d35('0x16')](_0xdb3ad2)[_0x3d35('0x26')](_0x2d448c[_0x3d35('0x2e')][_0x3d35('0x6e')]?{'message':_0x3d35('0x72'),'statusCode':_0x12df57['statusCode']}:_0x12df57);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 636fb58..1b1bcb9 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 _0x6bab=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x6bab,0x176));var _0xb6ba=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x6bab[_0x71e493];return _0x3d40ab;};'use strict';var _=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var logger=require(_0xb6ba('0x2'))(_0xb6ba('0x3'));var moment=require(_0xb6ba('0x4'));var BPromise=require(_0xb6ba('0x5'));var rp=require(_0xb6ba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb6ba('0x7'));var attributes=require(_0xb6ba('0x8'));var integrations=require(_0xb6ba('0x9'));module['exports']=function(_0x4def92,_0x3bfcac){return _0x4def92[_0xb6ba('0xa')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2841=['exports','FreshdeskAccount','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2841,0x157));var _0x1284=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x2841[_0x3b6652];return _0x14d39f;};'use strict';var _=require('lodash');var util=require(_0x1284('0x0'));var logger=require(_0x1284('0x1'))('api');var moment=require(_0x1284('0x2'));var BPromise=require(_0x1284('0x3'));var rp=require(_0x1284('0x4'));var fs=require('fs');var path=require(_0x1284('0x5'));var rimraf=require('rimraf');var config=require(_0x1284('0x6'));var attributes=require(_0x1284('0x7'));var integrations=require(_0x1284('0x8'));module[_0x1284('0x9')]=function(_0x378631,_0x4af1e7){return _0x378631['define'](_0x1284('0xa'),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 8145fa6..82c11aa 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 _0x897c=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','find','info','ShowFreshdeskAccount','lodash'];(function(_0x401a04,_0x27cd04){var _0x469676=function(_0x39aea1){while(--_0x39aea1){_0x401a04['push'](_0x401a04['shift']());}};_0x469676(++_0x27cd04);}(_0x897c,0x197));var _0xc897=function(_0x352969,_0x92dc74){_0x352969=_0x352969-0x0;var _0x61ea8d=_0x897c[_0x352969];return _0x61ea8d;};'use strict';var _=require(_0xc897('0x0'));var util=require('util');var moment=require(_0xc897('0x1'));var BPromise=require(_0xc897('0x2'));var rs=require(_0xc897('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc897('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc897('0x5'))(_0xc897('0x6'));var config=require(_0xc897('0x7'));var jayson=require(_0xc897('0x8'));var client=jayson[_0xc897('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25d516,_0x171087,_0x555939){return new BPromise(function(_0x266e16,_0x18f956){return client[_0xc897('0xa')](_0x25d516,_0x555939)['then'](function(_0x5d31b6){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x171087,'request\x20sent');logger[_0xc897('0xb')](_0xc897('0xc'),_0x171087,_0xc897('0xd'),JSON[_0xc897('0xe')](_0x5d31b6));if(_0x5d31b6['error']){if(_0x5d31b6[_0xc897('0xf')][_0xc897('0x10')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x171087,_0x5d31b6[_0xc897('0xf')][_0xc897('0x11')]);return _0x18f956(_0x5d31b6['error'][_0xc897('0x11')]);}logger[_0xc897('0xf')](_0xc897('0x12'),_0x171087,_0x5d31b6[_0xc897('0xf')][_0xc897('0x11')]);return _0x266e16(_0x5d31b6[_0xc897('0xf')][_0xc897('0x11')]);}else{logger['info'](_0xc897('0x12'),_0x171087,'request\x20sent');_0x266e16(_0x5d31b6[_0xc897('0x13')][_0xc897('0x11')]);}})[_0xc897('0x14')](function(_0x55bbe9){logger[_0xc897('0xf')](_0xc897('0x12'),_0x171087,_0x55bbe9);_0x18f956(_0x55bbe9);});});}exports[_0xc897('0x15')]=function(_0x3823f1){var _0x808f3f=this;return new Promise(function(_0x2d31ee,_0x5f1f8e){return db[_0xc897('0x16')][_0xc897('0x17')]({'raw':_0x3823f1[_0xc897('0x18')]?_0x3823f1[_0xc897('0x18')][_0xc897('0x19')]===undefined?!![]:![]:!![],'where':_0x3823f1['options']?_0x3823f1[_0xc897('0x18')][_0xc897('0x1a')]||null:null,'attributes':_0x3823f1[_0xc897('0x18')]?_0x3823f1[_0xc897('0x18')][_0xc897('0x1b')]||null:null,'limit':_0x3823f1[_0xc897('0x18')]?_0x3823f1['options']['limit']||null:null,'include':_0x3823f1['options']?_0x3823f1['options'][_0xc897('0x1c')]?_[_0xc897('0x1d')](_0x3823f1[_0xc897('0x18')][_0xc897('0x1c')],function(_0x3a7716){return{'model':db[_0x3a7716[_0xc897('0x1e')]],'as':_0x3a7716['as'],'attributes':_0x3a7716[_0xc897('0x1b')],'include':_0x3a7716['include']?_[_0xc897('0x1d')](_0x3a7716[_0xc897('0x1c')],function(_0x48bc56){return{'model':db[_0x48bc56['model']],'as':_0x48bc56['as'],'attributes':_0x48bc56[_0xc897('0x1b')],'include':_0x48bc56[_0xc897('0x1c')]?_[_0xc897('0x1d')](_0x48bc56[_0xc897('0x1c')],function(_0x256402){return{'model':db[_0x256402[_0xc897('0x1e')]],'as':_0x256402['as'],'attributes':_0x256402[_0xc897('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x83e22c){logger['info'](_0xc897('0x15'),_0x3823f1);logger[_0xc897('0xb')](_0xc897('0x15'),_0x3823f1,JSON[_0xc897('0xe')](_0x83e22c));_0x2d31ee(_0x83e22c);})['catch'](function(_0x20e53f){logger[_0xc897('0xf')](_0xc897('0x15'),_0x20e53f[_0xc897('0x11')],_0x3823f1);_0x5f1f8e(_0x808f3f[_0xc897('0xf')](0x1f4,_0x20e53f[_0xc897('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x31f71e){var _0x4c4914=this;return new Promise(function(_0x8de4e1,_0x25b998){return db['FreshdeskAccount'][_0xc897('0x1f')]({'raw':_0x31f71e[_0xc897('0x18')]?_0x31f71e[_0xc897('0x18')][_0xc897('0x19')]===undefined?!![]:![]:!![],'where':_0x31f71e['options']?_0x31f71e[_0xc897('0x18')][_0xc897('0x1a')]||null:null,'attributes':_0x31f71e[_0xc897('0x18')]?_0x31f71e['options'][_0xc897('0x1b')]||null:null,'include':_0x31f71e[_0xc897('0x18')]?_0x31f71e['options'][_0xc897('0x1c')]?_[_0xc897('0x1d')](_0x31f71e[_0xc897('0x18')]['include'],function(_0x31a743){return{'model':db[_0x31a743['model']],'as':_0x31a743['as'],'attributes':_0x31a743[_0xc897('0x1b')],'include':_0x31a743[_0xc897('0x1c')]?_[_0xc897('0x1d')](_0x31a743[_0xc897('0x1c')],function(_0x1b9c1d){return{'model':db[_0x1b9c1d[_0xc897('0x1e')]],'as':_0x1b9c1d['as'],'attributes':_0x1b9c1d[_0xc897('0x1b')],'include':_0x1b9c1d['include']?_[_0xc897('0x1d')](_0x1b9c1d[_0xc897('0x1c')],function(_0x3c08f1){return{'model':db[_0x3c08f1[_0xc897('0x1e')]],'as':_0x3c08f1['as'],'attributes':_0x3c08f1[_0xc897('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x522ea4){logger[_0xc897('0x20')](_0xc897('0x21'),_0x31f71e);logger['debug'](_0xc897('0x21'),_0x31f71e,JSON[_0xc897('0xe')](_0x522ea4));_0x8de4e1(_0x522ea4);})['catch'](function(_0x3a46c2){logger[_0xc897('0xf')]('ShowFreshdeskAccount',_0x3a46c2[_0xc897('0x11')],_0x31f71e);_0x25b998(_0x4c4914[_0xc897('0xf')](0x1f4,_0x3a46c2[_0xc897('0x11')]));});});}; \ No newline at end of file +var _0xe0b5=['where','limit','include','map','model','attributes','then','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FreshdeskAccount','findAll','options','raw'];(function(_0x1e7812,_0x4a0b31){var _0x22c229=function(_0xcced5b){while(--_0xcced5b){_0x1e7812['push'](_0x1e7812['shift']());}};_0x22c229(++_0x4a0b31);}(_0xe0b5,0xe2));var _0x5e0b=function(_0xed3d85,_0x2a3d93){_0xed3d85=_0xed3d85-0x0;var _0xcb0cdb=_0xe0b5[_0xed3d85];return _0xcb0cdb;};'use strict';var _=require(_0x5e0b('0x0'));var util=require(_0x5e0b('0x1'));var moment=require(_0x5e0b('0x2'));var BPromise=require(_0x5e0b('0x3'));var rs=require(_0x5e0b('0x4'));var fs=require('fs');var Redis=require(_0x5e0b('0x5'));var db=require(_0x5e0b('0x6'))['db'];var utils=require(_0x5e0b('0x7'));var logger=require(_0x5e0b('0x8'))('rpc');var config=require(_0x5e0b('0x9'));var jayson=require(_0x5e0b('0xa'));var client=jayson[_0x5e0b('0xb')][_0x5e0b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46a413,_0x5896d5,_0x451071){return new BPromise(function(_0x788190,_0x5b3232){return client[_0x5e0b('0xd')](_0x46a413,_0x451071)['then'](function(_0x2808a2){logger[_0x5e0b('0xe')](_0x5e0b('0xf'),_0x5896d5,_0x5e0b('0x10'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5896d5,'request\x20sent',JSON[_0x5e0b('0x11')](_0x2808a2));if(_0x2808a2['error']){if(_0x2808a2[_0x5e0b('0x12')][_0x5e0b('0x13')]===0x1f4){logger[_0x5e0b('0x12')](_0x5e0b('0xf'),_0x5896d5,_0x2808a2[_0x5e0b('0x12')][_0x5e0b('0x14')]);return _0x5b3232(_0x2808a2[_0x5e0b('0x12')][_0x5e0b('0x14')]);}logger[_0x5e0b('0x12')](_0x5e0b('0xf'),_0x5896d5,_0x2808a2[_0x5e0b('0x12')][_0x5e0b('0x14')]);return _0x788190(_0x2808a2[_0x5e0b('0x12')][_0x5e0b('0x14')]);}else{logger[_0x5e0b('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5896d5,_0x5e0b('0x10'));_0x788190(_0x2808a2['result'][_0x5e0b('0x14')]);}})[_0x5e0b('0x15')](function(_0x235706){logger[_0x5e0b('0x12')](_0x5e0b('0xf'),_0x5896d5,_0x235706);_0x5b3232(_0x235706);});});}exports['GetFreshdeskAccount']=function(_0x5b7238){var _0x189612=this;return new Promise(function(_0x7246f2,_0x541a78){return db[_0x5e0b('0x16')][_0x5e0b('0x17')]({'raw':_0x5b7238[_0x5e0b('0x18')]?_0x5b7238[_0x5e0b('0x18')][_0x5e0b('0x19')]===undefined?!![]:![]:!![],'where':_0x5b7238[_0x5e0b('0x18')]?_0x5b7238['options'][_0x5e0b('0x1a')]||null:null,'attributes':_0x5b7238[_0x5e0b('0x18')]?_0x5b7238[_0x5e0b('0x18')]['attributes']||null:null,'limit':_0x5b7238[_0x5e0b('0x18')]?_0x5b7238[_0x5e0b('0x18')][_0x5e0b('0x1b')]||null:null,'include':_0x5b7238[_0x5e0b('0x18')]?_0x5b7238[_0x5e0b('0x18')][_0x5e0b('0x1c')]?_[_0x5e0b('0x1d')](_0x5b7238[_0x5e0b('0x18')]['include'],function(_0x49756d){return{'model':db[_0x49756d[_0x5e0b('0x1e')]],'as':_0x49756d['as'],'attributes':_0x49756d[_0x5e0b('0x1f')],'include':_0x49756d[_0x5e0b('0x1c')]?_[_0x5e0b('0x1d')](_0x49756d[_0x5e0b('0x1c')],function(_0x51e547){return{'model':db[_0x51e547[_0x5e0b('0x1e')]],'as':_0x51e547['as'],'attributes':_0x51e547[_0x5e0b('0x1f')],'include':_0x51e547[_0x5e0b('0x1c')]?_[_0x5e0b('0x1d')](_0x51e547['include'],function(_0x26d3ba){return{'model':db[_0x26d3ba[_0x5e0b('0x1e')]],'as':_0x26d3ba['as'],'attributes':_0x26d3ba[_0x5e0b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5e0b('0x20')](function(_0x1ac0e7){logger[_0x5e0b('0xe')](_0x5e0b('0x21'),_0x5b7238);logger['debug'](_0x5e0b('0x21'),_0x5b7238,JSON[_0x5e0b('0x11')](_0x1ac0e7));_0x7246f2(_0x1ac0e7);})['catch'](function(_0x16a23a){logger[_0x5e0b('0x12')]('GetFreshdeskAccount',_0x16a23a['message'],_0x5b7238);_0x541a78(_0x189612[_0x5e0b('0x12')](0x1f4,_0x16a23a['message']));});});};exports[_0x5e0b('0x22')]=function(_0x411133){var _0x4ea8f3=this;return new Promise(function(_0x1ecad0,_0x56cc21){return db[_0x5e0b('0x16')][_0x5e0b('0x23')]({'raw':_0x411133[_0x5e0b('0x18')]?_0x411133[_0x5e0b('0x18')][_0x5e0b('0x19')]===undefined?!![]:![]:!![],'where':_0x411133[_0x5e0b('0x18')]?_0x411133[_0x5e0b('0x18')][_0x5e0b('0x1a')]||null:null,'attributes':_0x411133[_0x5e0b('0x18')]?_0x411133[_0x5e0b('0x18')][_0x5e0b('0x1f')]||null:null,'include':_0x411133[_0x5e0b('0x18')]?_0x411133[_0x5e0b('0x18')][_0x5e0b('0x1c')]?_['map'](_0x411133[_0x5e0b('0x18')][_0x5e0b('0x1c')],function(_0x3d94fc){return{'model':db[_0x3d94fc['model']],'as':_0x3d94fc['as'],'attributes':_0x3d94fc[_0x5e0b('0x1f')],'include':_0x3d94fc[_0x5e0b('0x1c')]?_[_0x5e0b('0x1d')](_0x3d94fc[_0x5e0b('0x1c')],function(_0x7c601){return{'model':db[_0x7c601[_0x5e0b('0x1e')]],'as':_0x7c601['as'],'attributes':_0x7c601['attributes'],'include':_0x7c601[_0x5e0b('0x1c')]?_[_0x5e0b('0x1d')](_0x7c601[_0x5e0b('0x1c')],function(_0x3076ec){return{'model':db[_0x3076ec['model']],'as':_0x3076ec['as'],'attributes':_0x3076ec[_0x5e0b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5e0b('0x20')](function(_0x491a01){logger[_0x5e0b('0xe')](_0x5e0b('0x22'),_0x411133);logger['debug'](_0x5e0b('0x22'),_0x411133,JSON[_0x5e0b('0x11')](_0x491a01));_0x1ecad0(_0x491a01);})[_0x5e0b('0x15')](function(_0x164778){logger[_0x5e0b('0x12')]('ShowFreshdeskAccount',_0x164778[_0x5e0b('0x14')],_0x411133);_0x56cc21(_0x4ea8f3[_0x5e0b('0x12')](0x1f4,_0x164778[_0x5e0b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 2bceae8..f6659ba 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 _0x43bf=['../../components/interaction/service','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x46399a,_0x108f44){var _0x3f97ca=function(_0xb8ca74){while(--_0xb8ca74){_0x46399a['push'](_0x46399a['shift']());}};_0x3f97ca(++_0x108f44);}(_0x43bf,0x73));var _0xf43b=function(_0x2ed64f,_0x202e19){_0x2ed64f=_0x2ed64f-0x0;var _0x792fac=_0x43bf[_0x2ed64f];return _0x792fac;};'use strict';var multer=require(_0xf43b('0x0'));var util=require(_0xf43b('0x1'));var path=require('path');var timeout=require(_0xf43b('0x2'));var express=require(_0xf43b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf43b('0x4'));var interaction=require(_0xf43b('0x5'));var config=require('../../config/environment');var controller=require(_0xf43b('0x6'));router[_0xf43b('0x7')]('/',auth['isAuthenticated'](),controller[_0xf43b('0x8')]);router[_0xf43b('0x7')](_0xf43b('0x9'),auth[_0xf43b('0xa')](),controller[_0xf43b('0xb')]);router['get']('/:id/fields',auth[_0xf43b('0xa')](),controller['getFields']);router[_0xf43b('0x7')](_0xf43b('0xc'),auth['isAuthenticated'](),controller[_0xf43b('0xd')]);router['get'](_0xf43b('0xe'),auth['isAuthenticated'](),controller[_0xf43b('0xf')]);router['get'](_0xf43b('0x10'),auth[_0xf43b('0xa')](),controller[_0xf43b('0x11')]);router[_0xf43b('0x12')]('/',auth[_0xf43b('0xa')](),controller['create']);router['post'](_0xf43b('0x10'),auth[_0xf43b('0xa')](),controller[_0xf43b('0x13')]);router['put'](_0xf43b('0x9'),auth['isAuthenticated'](),controller[_0xf43b('0x14')]);router[_0xf43b('0x15')](_0xf43b('0x9'),auth['isAuthenticated'](),controller[_0xf43b('0x16')]);module[_0xf43b('0x17')]=router; \ No newline at end of file +var _0x0d82=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show'];(function(_0x23f0e1,_0x11d94b){var _0x257f0d=function(_0xab63c7){while(--_0xab63c7){_0x23f0e1['push'](_0x23f0e1['shift']());}};_0x257f0d(++_0x11d94b);}(_0x0d82,0x1c8));var _0x20d8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0d82[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x20d8('0x0'));var util=require(_0x20d8('0x1'));var path=require('path');var timeout=require(_0x20d8('0x2'));var express=require('express');var router=express[_0x20d8('0x3')]();var fs_extra=require(_0x20d8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x20d8('0x5'));var config=require('../../config/environment');var controller=require(_0x20d8('0x6'));router['get']('/',auth[_0x20d8('0x7')](),controller[_0x20d8('0x8')]);router[_0x20d8('0x9')](_0x20d8('0xa'),auth[_0x20d8('0x7')](),controller[_0x20d8('0xb')]);router['get'](_0x20d8('0xc'),auth[_0x20d8('0x7')](),controller['getFields']);router['get'](_0x20d8('0xd'),auth['isAuthenticated'](),controller[_0x20d8('0xe')]);router[_0x20d8('0x9')](_0x20d8('0xf'),auth['isAuthenticated'](),controller[_0x20d8('0x10')]);router[_0x20d8('0x9')](_0x20d8('0x11'),auth[_0x20d8('0x7')](),controller[_0x20d8('0x12')]);router['post']('/',auth[_0x20d8('0x7')](),controller['create']);router[_0x20d8('0x13')](_0x20d8('0x11'),auth['isAuthenticated'](),controller[_0x20d8('0x14')]);router[_0x20d8('0x15')](_0x20d8('0xa'),auth[_0x20d8('0x7')](),controller[_0x20d8('0x16')]);router[_0x20d8('0x17')](_0x20d8('0xa'),auth[_0x20d8('0x7')](),controller[_0x20d8('0x18')]);module[_0x20d8('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 8dadb32..0691171 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 _0x9a97=['exports','STRING'];(function(_0x228c64,_0x56b08b){var _0x2da93d=function(_0xd522a3){while(--_0xd522a3){_0x228c64['push'](_0x228c64['shift']());}};_0x2da93d(++_0x56b08b);}(_0x9a97,0x16e));var _0x79a9=function(_0x2e1c6a,_0xfd371){_0x2e1c6a=_0x2e1c6a-0x0;var _0x3578a0=_0x9a97[_0x2e1c6a];return _0x3578a0;};'use strict';var Sequelize=require('sequelize');module[_0x79a9('0x0')]={'name':{'type':Sequelize[_0x79a9('0x1')]},'description':{'type':Sequelize[_0x79a9('0x1')]}}; \ No newline at end of file +var _0xf5fa=['sequelize','exports'];(function(_0x116df5,_0x3ada0e){var _0x2f71e6=function(_0x367e16){while(--_0x367e16){_0x116df5['push'](_0x116df5['shift']());}};_0x2f71e6(++_0x3ada0e);}(_0xf5fa,0x102));var _0xaf5f=function(_0xef4468,_0x171fcf){_0xef4468=_0xef4468-0x0;var _0xef3a19=_0xf5fa[_0xef4468];return _0xef3a19;};'use strict';var Sequelize=require(_0xaf5f('0x0'));module[_0xaf5f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index bb619d5..920d787 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 _0x3f85=['../../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','map','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','FreshdeskConfiguration','catch','body','find','getFields','FreshdeskField','pick','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3f85,0x1eb));var _0x53f8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f85[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x53f8('0x0'));var rimraf=require(_0x53f8('0x1'));var zipdir=require(_0x53f8('0x2'));var jsonpatch=require(_0x53f8('0x3'));var rp=require(_0x53f8('0x4'));var moment=require(_0x53f8('0x5'));var BPromise=require(_0x53f8('0x6'));var Mustache=require('mustache');var util=require(_0x53f8('0x7'));var path=require(_0x53f8('0x8'));var sox=require(_0x53f8('0x9'));var csv=require(_0x53f8('0xa'));var ejs=require(_0x53f8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53f8('0xc'));var squel=require('squel');var crypto=require(_0x53f8('0xd'));var jsforce=require(_0x53f8('0xe'));var deskjs=require(_0x53f8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x53f8('0x10'));var as=require(_0x53f8('0x11'));var hardwareService=require(_0x53f8('0x12'));var logger=require(_0x53f8('0x13'))(_0x53f8('0x14'));var utils=require(_0x53f8('0x15'));var config=require(_0x53f8('0x16'));var licenseUtil=require(_0x53f8('0x17'));var db=require(_0x53f8('0x18'))['db'];function respondWithStatusCode(_0x13f2a3,_0x4a328c){_0x4a328c=_0x4a328c||0xcc;return function(_0x46ee3f){if(_0x46ee3f){return _0x13f2a3[_0x53f8('0x19')](_0x4a328c);}return _0x13f2a3[_0x53f8('0x1a')](_0x4a328c)[_0x53f8('0x1b')]();};}function respondWithResult(_0x857082,_0x3b531b){_0x3b531b=_0x3b531b||0xc8;return function(_0x533924){if(_0x533924){return _0x857082[_0x53f8('0x1a')](_0x3b531b)[_0x53f8('0x1c')](_0x533924);}};}function respondWithFilteredResult(_0x49cf23,_0x55c257){return function(_0x4d8711){if(_0x4d8711){var _0x3f5682=typeof _0x55c257[_0x53f8('0x1d')]===_0x53f8('0x1e')&&typeof _0x55c257[_0x53f8('0x1f')]===_0x53f8('0x1e');var _0x374f59=_0x4d8711[_0x53f8('0x20')];var _0x1b6b92=_0x3f5682?0x0:_0x55c257['offset'];var _0xe8b4dc=_0x3f5682?_0x4d8711[_0x53f8('0x20')]:_0x55c257[_0x53f8('0x1d')]+_0x55c257[_0x53f8('0x1f')];var _0x52b32c;if(_0xe8b4dc>=_0x374f59){_0xe8b4dc=_0x374f59;_0x52b32c=0xc8;}else{_0x52b32c=0xce;}_0x49cf23[_0x53f8('0x1a')](_0x52b32c);return _0x49cf23['set'](_0x53f8('0x21'),_0x1b6b92+'-'+_0xe8b4dc+'/'+_0x374f59)[_0x53f8('0x1c')](_0x4d8711);}return null;};}function patchUpdates(_0x43cbdd){return function(_0x9591de){try{jsonpatch[_0x53f8('0x22')](_0x9591de,_0x43cbdd,!![]);}catch(_0x19d90d){return BPromise[_0x53f8('0x23')](_0x19d90d);}return _0x9591de[_0x53f8('0x24')]();};}function saveUpdates(_0x5c0692,_0x6ad390){return function(_0xc5eeec){if(_0xc5eeec){return _0xc5eeec[_0x53f8('0x25')](_0x5c0692)[_0x53f8('0x26')](function(_0x5d215c){return _0x5d215c;});}return null;};}function removeEntity(_0x40c3dd,_0x43238c){return function(_0x1cad3d){if(_0x1cad3d){return _0x1cad3d[_0x53f8('0x27')]()[_0x53f8('0x26')](function(){_0x40c3dd[_0x53f8('0x1a')](0xcc)[_0x53f8('0x1b')]();});}};}function handleEntityNotFound(_0x1d7c0c,_0x59af86){return function(_0x2a86b4){if(!_0x2a86b4){_0x1d7c0c[_0x53f8('0x19')](0x194);}return _0x2a86b4;};}function handleError(_0x27e6e8,_0x583ebf){_0x583ebf=_0x583ebf||0x1f4;return function(_0x21aa08){logger[_0x53f8('0x28')](_0x21aa08[_0x53f8('0x29')]);if(_0x21aa08[_0x53f8('0x2a')]){delete _0x21aa08[_0x53f8('0x2a')];}_0x27e6e8[_0x53f8('0x1a')](_0x583ebf)['send'](_0x21aa08);};}exports['index']=function(_0x1b3537,_0xaa0718){var _0x196576={},_0x318ef1={},_0x4edadb={'count':0x0,'rows':[]};var _0x19c3d7=_[_0x53f8('0x2b')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x3f6676){return{'name':_0x3f6676[_0x53f8('0x2c')],'type':_0x3f6676[_0x53f8('0x2d')][_0x53f8('0x2e')]};});_0x318ef1['model']=_[_0x53f8('0x2b')](_0x19c3d7,'name');_0x318ef1[_0x53f8('0x2f')]=_[_0x53f8('0x30')](_0x1b3537[_0x53f8('0x2f')]);_0x318ef1[_0x53f8('0x31')]=_['intersection'](_0x318ef1['model'],_0x318ef1[_0x53f8('0x2f')]);_0x196576[_0x53f8('0x32')]=_[_0x53f8('0x33')](_0x318ef1[_0x53f8('0x34')],qs[_0x53f8('0x35')](_0x1b3537[_0x53f8('0x2f')]['fields']));_0x196576['attributes']=_0x196576['attributes'][_0x53f8('0x36')]?_0x196576[_0x53f8('0x32')]:_0x318ef1[_0x53f8('0x34')];if(!_0x1b3537[_0x53f8('0x2f')][_0x53f8('0x37')](_0x53f8('0x38'))){_0x196576[_0x53f8('0x1f')]=qs[_0x53f8('0x1f')](_0x1b3537[_0x53f8('0x2f')][_0x53f8('0x1f')]);_0x196576[_0x53f8('0x1d')]=qs[_0x53f8('0x1d')](_0x1b3537[_0x53f8('0x2f')][_0x53f8('0x1d')]);}_0x196576[_0x53f8('0x39')]=qs[_0x53f8('0x3a')](_0x1b3537[_0x53f8('0x2f')][_0x53f8('0x3a')]);_0x196576[_0x53f8('0x3b')]=qs[_0x53f8('0x31')](_['pick'](_0x1b3537['query'],_0x318ef1['filters']),_0x19c3d7);if(_0x1b3537[_0x53f8('0x2f')][_0x53f8('0x3c')]){_0x196576[_0x53f8('0x3b')]=_[_0x53f8('0x3d')](_0x196576['where'],{'$or':_[_0x53f8('0x2b')](_0x19c3d7,function(_0xb36de6){if(_0xb36de6['type']!==_0x53f8('0x3e')){var _0x5688d1={};_0x5688d1[_0xb36de6[_0x53f8('0x2a')]]={'$like':'%'+_0x1b3537[_0x53f8('0x2f')][_0x53f8('0x3c')]+'%'};return _0x5688d1;}})});}_0x196576=_[_0x53f8('0x3d')]({},_0x196576,_0x1b3537[_0x53f8('0x3f')]);var _0x4ae33c={'where':_0x196576['where']};return db['FreshdeskConfiguration'][_0x53f8('0x20')](_0x4ae33c)[_0x53f8('0x26')](function(_0xc5463){_0x4edadb[_0x53f8('0x20')]=_0xc5463;if(_0x1b3537[_0x53f8('0x2f')][_0x53f8('0x40')]){_0x196576[_0x53f8('0x41')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x53f8('0x42')](_0x196576);})[_0x53f8('0x26')](function(_0x42a2e6){_0x4edadb[_0x53f8('0x43')]=_0x42a2e6;return _0x4edadb;})[_0x53f8('0x26')](respondWithFilteredResult(_0xaa0718,_0x196576))['catch'](handleError(_0xaa0718,null));};exports[_0x53f8('0x44')]=function(_0x51c86f,_0x480dae){var _0x5e3db8={'raw':![],'where':{'id':_0x51c86f[_0x53f8('0x45')]['id']}},_0x16f4fb={};_0x16f4fb[_0x53f8('0x34')]=_[_0x53f8('0x30')](db['FreshdeskConfiguration'][_0x53f8('0x46')]);_0x16f4fb['query']=_[_0x53f8('0x30')](_0x51c86f[_0x53f8('0x2f')]);_0x16f4fb[_0x53f8('0x31')]=_[_0x53f8('0x33')](_0x16f4fb[_0x53f8('0x34')],_0x16f4fb[_0x53f8('0x2f')]);_0x5e3db8[_0x53f8('0x32')]=_[_0x53f8('0x33')](_0x16f4fb[_0x53f8('0x34')],qs[_0x53f8('0x35')](_0x51c86f[_0x53f8('0x2f')]['fields']));_0x5e3db8['attributes']=_0x5e3db8[_0x53f8('0x32')][_0x53f8('0x36')]?_0x5e3db8[_0x53f8('0x32')]:_0x16f4fb['model'];if(_0x51c86f[_0x53f8('0x2f')][_0x53f8('0x40')]){_0x5e3db8[_0x53f8('0x41')]=[{'all':!![]}];}_0x5e3db8=_[_0x53f8('0x3d')]({},_0x5e3db8,_0x51c86f['options']);return db[_0x53f8('0x47')]['find'](_0x5e3db8)['then'](handleEntityNotFound(_0x480dae,null))[_0x53f8('0x26')](respondWithResult(_0x480dae,null))[_0x53f8('0x48')](handleError(_0x480dae,null));};exports['create']=function(_0x104cda,_0x4ffe1d){return db[_0x53f8('0x47')]['create'](_0x104cda[_0x53f8('0x49')],{})[_0x53f8('0x26')](respondWithResult(_0x4ffe1d,0xc9))[_0x53f8('0x48')](handleError(_0x4ffe1d,null));};exports[_0x53f8('0x25')]=function(_0x2d78c9,_0x152394){if(_0x2d78c9[_0x53f8('0x49')]['id']){delete _0x2d78c9[_0x53f8('0x49')]['id'];}return db[_0x53f8('0x47')][_0x53f8('0x4a')]({'where':{'id':_0x2d78c9[_0x53f8('0x45')]['id']}})[_0x53f8('0x26')](handleEntityNotFound(_0x152394,null))[_0x53f8('0x26')](saveUpdates(_0x2d78c9[_0x53f8('0x49')],null))[_0x53f8('0x26')](respondWithResult(_0x152394,null))[_0x53f8('0x48')](handleError(_0x152394,null));};exports[_0x53f8('0x27')]=function(_0x6feb38,_0x3d5b28){return db[_0x53f8('0x47')]['find']({'where':{'id':_0x6feb38[_0x53f8('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d5b28,null))[_0x53f8('0x26')](removeEntity(_0x3d5b28,null))[_0x53f8('0x48')](handleError(_0x3d5b28,null));};exports[_0x53f8('0x4b')]=function(_0x27bf04,_0x34697d,_0x21343a){var _0x4a07a8={};var _0x15d6d2={};var _0x387497;var _0x464988;return db[_0x53f8('0x47')]['findOne']({'where':{'id':_0x27bf04['params']['id']}})[_0x53f8('0x26')](handleEntityNotFound(_0x34697d,null))[_0x53f8('0x26')](function(_0x46cd88){if(_0x46cd88){_0x387497=_0x46cd88;_0x15d6d2[_0x53f8('0x34')]=_['keys'](db[_0x53f8('0x4c')]['rawAttributes']);_0x15d6d2['query']=_[_0x53f8('0x30')](_0x27bf04['query']);_0x15d6d2['filters']=_[_0x53f8('0x33')](_0x15d6d2[_0x53f8('0x34')],_0x15d6d2['query']);_0x4a07a8['attributes']=_[_0x53f8('0x33')](_0x15d6d2['model'],qs[_0x53f8('0x35')](_0x27bf04[_0x53f8('0x2f')][_0x53f8('0x35')]));_0x4a07a8[_0x53f8('0x32')]=_0x4a07a8[_0x53f8('0x32')][_0x53f8('0x36')]?_0x4a07a8[_0x53f8('0x32')]:_0x15d6d2['model'];_0x4a07a8[_0x53f8('0x39')]=qs[_0x53f8('0x3a')](_0x27bf04[_0x53f8('0x2f')][_0x53f8('0x3a')]);_0x4a07a8[_0x53f8('0x3b')]=qs[_0x53f8('0x31')](_[_0x53f8('0x4d')](_0x27bf04[_0x53f8('0x2f')],_0x15d6d2[_0x53f8('0x31')]));if(_0x27bf04[_0x53f8('0x2f')]['filter']){_0x4a07a8[_0x53f8('0x3b')]=_['merge'](_0x4a07a8[_0x53f8('0x3b')],{'$or':_[_0x53f8('0x2b')](_0x4a07a8[_0x53f8('0x32')],function(_0x1b51fc){var _0x433836={};_0x433836[_0x1b51fc]={'$like':'%'+_0x27bf04[_0x53f8('0x2f')][_0x53f8('0x3c')]+'%'};return _0x433836;})});}_0x4a07a8=_[_0x53f8('0x3d')]({},_0x4a07a8,_0x27bf04[_0x53f8('0x3f')]);return _0x387497[_0x53f8('0x4b')](_0x4a07a8);}})['then'](function(_0x2dfcfe){if(_0x2dfcfe){_0x464988=_0x2dfcfe['length'];if(!_0x27bf04[_0x53f8('0x2f')][_0x53f8('0x37')](_0x53f8('0x38'))){_0x4a07a8[_0x53f8('0x1f')]=qs[_0x53f8('0x1f')](_0x27bf04[_0x53f8('0x2f')]['limit']);_0x4a07a8[_0x53f8('0x1d')]=qs['offset'](_0x27bf04['query'][_0x53f8('0x1d')]);}return _0x387497['getFields'](_0x4a07a8);}})[_0x53f8('0x26')](function(_0x464a9b){if(_0x464a9b){return _0x464a9b?{'count':_0x464988,'rows':_0x464a9b}:null;}})['then'](respondWithResult(_0x34697d,null))[_0x53f8('0x48')](handleError(_0x34697d,null));};exports[_0x53f8('0x4e')]=function(_0x25a7b1,_0xc85b8f,_0x133301){var _0x1af608={};var _0x5b32cf={};var _0x165df0;var _0x224cfc;return db[_0x53f8('0x47')][_0x53f8('0x4f')]({'where':{'id':_0x25a7b1[_0x53f8('0x45')]['id']}})[_0x53f8('0x26')](handleEntityNotFound(_0xc85b8f,null))[_0x53f8('0x26')](function(_0x1b6f58){if(_0x1b6f58){_0x165df0=_0x1b6f58;_0x5b32cf[_0x53f8('0x34')]=_['keys'](db[_0x53f8('0x4c')][_0x53f8('0x46')]);_0x5b32cf[_0x53f8('0x2f')]=_['keys'](_0x25a7b1[_0x53f8('0x2f')]);_0x5b32cf['filters']=_[_0x53f8('0x33')](_0x5b32cf[_0x53f8('0x34')],_0x5b32cf[_0x53f8('0x2f')]);_0x1af608['attributes']=_[_0x53f8('0x33')](_0x5b32cf[_0x53f8('0x34')],qs[_0x53f8('0x35')](_0x25a7b1[_0x53f8('0x2f')][_0x53f8('0x35')]));_0x1af608[_0x53f8('0x32')]=_0x1af608[_0x53f8('0x32')][_0x53f8('0x36')]?_0x1af608[_0x53f8('0x32')]:_0x5b32cf[_0x53f8('0x34')];_0x1af608['order']=qs[_0x53f8('0x3a')](_0x25a7b1[_0x53f8('0x2f')]['sort']);_0x1af608[_0x53f8('0x3b')]=qs[_0x53f8('0x31')](_['pick'](_0x25a7b1['query'],_0x5b32cf[_0x53f8('0x31')]));if(_0x25a7b1[_0x53f8('0x2f')][_0x53f8('0x3c')]){_0x1af608[_0x53f8('0x3b')]=_[_0x53f8('0x3d')](_0x1af608['where'],{'$or':_[_0x53f8('0x2b')](_0x1af608[_0x53f8('0x32')],function(_0x1e5649){var _0x20b2dc={};_0x20b2dc[_0x1e5649]={'$like':'%'+_0x25a7b1['query'][_0x53f8('0x3c')]+'%'};return _0x20b2dc;})});}_0x1af608=_[_0x53f8('0x3d')]({},_0x1af608,_0x25a7b1[_0x53f8('0x3f')]);return _0x165df0[_0x53f8('0x4e')](_0x1af608);}})[_0x53f8('0x26')](function(_0x184aaf){if(_0x184aaf){_0x224cfc=_0x184aaf[_0x53f8('0x36')];if(!_0x25a7b1[_0x53f8('0x2f')][_0x53f8('0x37')](_0x53f8('0x38'))){_0x1af608[_0x53f8('0x1f')]=qs[_0x53f8('0x1f')](_0x25a7b1[_0x53f8('0x2f')][_0x53f8('0x1f')]);_0x1af608[_0x53f8('0x1d')]=qs[_0x53f8('0x1d')](_0x25a7b1[_0x53f8('0x2f')][_0x53f8('0x1d')]);}return _0x165df0[_0x53f8('0x4e')](_0x1af608);}})[_0x53f8('0x26')](function(_0x5dd044){if(_0x5dd044){return _0x5dd044?{'count':_0x224cfc,'rows':_0x5dd044}:null;}})[_0x53f8('0x26')](respondWithResult(_0xc85b8f,null))[_0x53f8('0x48')](handleError(_0xc85b8f,null));};exports['getDescriptions']=function(_0x3cd50a,_0x40918b,_0x5891e4){var _0x15b805={};var _0x18e6ea={};var _0x58994c;var _0x4cc06b;return db[_0x53f8('0x47')]['findOne']({'where':{'id':_0x3cd50a[_0x53f8('0x45')]['id']}})[_0x53f8('0x26')](handleEntityNotFound(_0x40918b,null))[_0x53f8('0x26')](function(_0x2e58d1){if(_0x2e58d1){_0x58994c=_0x2e58d1;_0x18e6ea[_0x53f8('0x34')]=_[_0x53f8('0x30')](db[_0x53f8('0x4c')][_0x53f8('0x46')]);_0x18e6ea[_0x53f8('0x2f')]=_[_0x53f8('0x30')](_0x3cd50a['query']);_0x18e6ea[_0x53f8('0x31')]=_['intersection'](_0x18e6ea[_0x53f8('0x34')],_0x18e6ea[_0x53f8('0x2f')]);_0x15b805[_0x53f8('0x32')]=_['intersection'](_0x18e6ea[_0x53f8('0x34')],qs[_0x53f8('0x35')](_0x3cd50a['query'][_0x53f8('0x35')]));_0x15b805[_0x53f8('0x32')]=_0x15b805[_0x53f8('0x32')][_0x53f8('0x36')]?_0x15b805['attributes']:_0x18e6ea[_0x53f8('0x34')];_0x15b805[_0x53f8('0x39')]=qs[_0x53f8('0x3a')](_0x3cd50a[_0x53f8('0x2f')][_0x53f8('0x3a')]);_0x15b805['where']=qs[_0x53f8('0x31')](_[_0x53f8('0x4d')](_0x3cd50a[_0x53f8('0x2f')],_0x18e6ea['filters']));if(_0x3cd50a[_0x53f8('0x2f')][_0x53f8('0x3c')]){_0x15b805['where']=_['merge'](_0x15b805['where'],{'$or':_[_0x53f8('0x2b')](_0x15b805[_0x53f8('0x32')],function(_0xf6a503){var _0x3daee2={};_0x3daee2[_0xf6a503]={'$like':'%'+_0x3cd50a[_0x53f8('0x2f')][_0x53f8('0x3c')]+'%'};return _0x3daee2;})});}_0x15b805=_['merge']({},_0x15b805,_0x3cd50a['options']);return _0x58994c[_0x53f8('0x50')](_0x15b805);}})[_0x53f8('0x26')](function(_0x4d7b13){if(_0x4d7b13){_0x4cc06b=_0x4d7b13['length'];if(!_0x3cd50a['query'][_0x53f8('0x37')]('nolimit')){_0x15b805[_0x53f8('0x1f')]=qs[_0x53f8('0x1f')](_0x3cd50a['query'][_0x53f8('0x1f')]);_0x15b805[_0x53f8('0x1d')]=qs[_0x53f8('0x1d')](_0x3cd50a[_0x53f8('0x2f')][_0x53f8('0x1d')]);}return _0x58994c[_0x53f8('0x50')](_0x15b805);}})[_0x53f8('0x26')](function(_0x803753){if(_0x803753){return _0x803753?{'count':_0x4cc06b,'rows':_0x803753}:null;}})[_0x53f8('0x26')](respondWithResult(_0x40918b,null))[_0x53f8('0x48')](handleError(_0x40918b,null));};exports['getTags']=function(_0x1b5807,_0x286b32,_0x5b8cab){var _0x283dba={};var _0x692cff={};var _0x58c9df;var _0x147e96;return db['FreshdeskConfiguration'][_0x53f8('0x4f')]({'where':{'id':_0x1b5807[_0x53f8('0x45')]['id']}})[_0x53f8('0x26')](handleEntityNotFound(_0x286b32,null))[_0x53f8('0x26')](function(_0x469f15){if(_0x469f15){_0x58c9df=_0x469f15;_0x692cff['model']=_['keys'](db[_0x53f8('0x51')][_0x53f8('0x46')]);_0x692cff[_0x53f8('0x2f')]=_['keys'](_0x1b5807[_0x53f8('0x2f')]);_0x692cff[_0x53f8('0x31')]=_[_0x53f8('0x33')](_0x692cff['model'],_0x692cff[_0x53f8('0x2f')]);_0x283dba[_0x53f8('0x32')]=_[_0x53f8('0x33')](_0x692cff['model'],qs[_0x53f8('0x35')](_0x1b5807[_0x53f8('0x2f')][_0x53f8('0x35')]));_0x283dba[_0x53f8('0x32')]=_0x283dba['attributes'][_0x53f8('0x36')]?_0x283dba['attributes']:_0x692cff[_0x53f8('0x34')];_0x283dba[_0x53f8('0x39')]=qs[_0x53f8('0x3a')](_0x1b5807['query'][_0x53f8('0x3a')]);_0x283dba[_0x53f8('0x3b')]=qs[_0x53f8('0x31')](_[_0x53f8('0x4d')](_0x1b5807[_0x53f8('0x2f')],_0x692cff['filters']));if(_0x1b5807[_0x53f8('0x2f')][_0x53f8('0x3c')]){_0x283dba['where']=_['merge'](_0x283dba[_0x53f8('0x3b')],{'$or':_['map'](_0x283dba[_0x53f8('0x32')],function(_0x4793d0){var _0x355deb={};_0x355deb[_0x4793d0]={'$like':'%'+_0x1b5807[_0x53f8('0x2f')]['filter']+'%'};return _0x355deb;})});}_0x283dba=_[_0x53f8('0x3d')]({},_0x283dba,_0x1b5807['options']);return _0x58c9df[_0x53f8('0x52')](_0x283dba);}})[_0x53f8('0x26')](function(_0x44d707){if(_0x44d707){_0x147e96=_0x44d707[_0x53f8('0x36')];if(!_0x1b5807[_0x53f8('0x2f')]['hasOwnProperty'](_0x53f8('0x38'))){_0x283dba[_0x53f8('0x1f')]=qs['limit'](_0x1b5807[_0x53f8('0x2f')][_0x53f8('0x1f')]);_0x283dba['offset']=qs['offset'](_0x1b5807[_0x53f8('0x2f')][_0x53f8('0x1d')]);}return _0x58c9df[_0x53f8('0x52')](_0x283dba);}})[_0x53f8('0x26')](function(_0x5eb1e2){if(_0x5eb1e2){return _0x5eb1e2?{'count':_0x147e96,'rows':_0x5eb1e2}:null;}})[_0x53f8('0x26')](respondWithResult(_0x286b32,null))[_0x53f8('0x48')](handleError(_0x286b32,null));};exports[_0x53f8('0x53')]=function(_0x43dec0,_0x55e184,_0x125174){if(_0x43dec0[_0x53f8('0x49')]['id']){delete _0x43dec0[_0x53f8('0x49')]['id'];}return db['FreshdeskConfiguration'][_0x53f8('0x4f')]({'where':{'id':_0x43dec0[_0x53f8('0x45')]['id']}})[_0x53f8('0x26')](handleEntityNotFound(_0x55e184,null))[_0x53f8('0x26')](function(_0x4c01d4){if(_0x4c01d4){return _0x4c01d4[_0x53f8('0x53')](_0x43dec0[_0x53f8('0x49')][_0x53f8('0x54')]||[]);}return null;})[_0x53f8('0x26')](respondWithResult(_0x55e184,null))[_0x53f8('0x48')](handleError(_0x55e184,null));}; \ No newline at end of file +var _0xa82e=['update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','length','find','body','findOne','order','hasOwnProperty','nolimit','getFields','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa82e,0x87));var _0xea82=function(_0x11327b,_0x3f71b8){_0x11327b=_0x11327b-0x0;var _0x1d1322=_0xa82e[_0x11327b];return _0x1d1322;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea82('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea82('0x1'));var rp=require(_0xea82('0x2'));var moment=require(_0xea82('0x3'));var BPromise=require(_0xea82('0x4'));var Mustache=require(_0xea82('0x5'));var util=require(_0xea82('0x6'));var path=require(_0xea82('0x7'));var sox=require(_0xea82('0x8'));var csv=require('to-csv');var ejs=require(_0xea82('0x9'));var fs=require('fs');var fs_extra=require(_0xea82('0xa'));var _=require(_0xea82('0xb'));var squel=require(_0xea82('0xc'));var crypto=require('crypto');var jsforce=require(_0xea82('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea82('0xe'));var querystring=require('querystring');var Papa=require(_0xea82('0xf'));var Redis=require(_0xea82('0x10'));var authService=require(_0xea82('0x11'));var qs=require(_0xea82('0x12'));var as=require(_0xea82('0x13'));var hardwareService=require(_0xea82('0x14'));var logger=require(_0xea82('0x15'))(_0xea82('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xea82('0x17'));var db=require(_0xea82('0x18'))['db'];function respondWithStatusCode(_0x2c2a6b,_0x4f51e1){_0x4f51e1=_0x4f51e1||0xcc;return function(_0x391a0b){if(_0x391a0b){return _0x2c2a6b[_0xea82('0x19')](_0x4f51e1);}return _0x2c2a6b[_0xea82('0x1a')](_0x4f51e1)['end']();};}function respondWithResult(_0x3594c1,_0x4782ee){_0x4782ee=_0x4782ee||0xc8;return function(_0x2aeb21){if(_0x2aeb21){return _0x3594c1['status'](_0x4782ee)[_0xea82('0x1b')](_0x2aeb21);}};}function respondWithFilteredResult(_0x4e9403,_0xe7cd4e){return function(_0x26d1d8){if(_0x26d1d8){var _0xe5053d=typeof _0xe7cd4e[_0xea82('0x1c')]===_0xea82('0x1d')&&typeof _0xe7cd4e[_0xea82('0x1e')]===_0xea82('0x1d');var _0x433ac2=_0x26d1d8['count'];var _0x30727e=_0xe5053d?0x0:_0xe7cd4e['offset'];var _0x35c797=_0xe5053d?_0x26d1d8['count']:_0xe7cd4e['offset']+_0xe7cd4e[_0xea82('0x1e')];var _0x22a073;if(_0x35c797>=_0x433ac2){_0x35c797=_0x433ac2;_0x22a073=0xc8;}else{_0x22a073=0xce;}_0x4e9403[_0xea82('0x1a')](_0x22a073);return _0x4e9403[_0xea82('0x1f')]('Content-Range',_0x30727e+'-'+_0x35c797+'/'+_0x433ac2)[_0xea82('0x1b')](_0x26d1d8);}return null;};}function patchUpdates(_0x3b8bee){return function(_0x3f24e3){try{jsonpatch[_0xea82('0x20')](_0x3f24e3,_0x3b8bee,!![]);}catch(_0x3f6aaa){return BPromise[_0xea82('0x21')](_0x3f6aaa);}return _0x3f24e3[_0xea82('0x22')]();};}function saveUpdates(_0x3e333e,_0x1466dc){return function(_0x286616){if(_0x286616){return _0x286616[_0xea82('0x23')](_0x3e333e)[_0xea82('0x24')](function(_0x1a6e3e){return _0x1a6e3e;});}return null;};}function removeEntity(_0x2128f4,_0x5cd171){return function(_0x5cd36a){if(_0x5cd36a){return _0x5cd36a[_0xea82('0x25')]()[_0xea82('0x24')](function(){_0x2128f4[_0xea82('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x379096,_0x55625d){return function(_0x5c846d){if(!_0x5c846d){_0x379096[_0xea82('0x19')](0x194);}return _0x5c846d;};}function handleError(_0x3e2138,_0x50193f){_0x50193f=_0x50193f||0x1f4;return function(_0x3d1b09){logger[_0xea82('0x26')](_0x3d1b09[_0xea82('0x27')]);if(_0x3d1b09['name']){delete _0x3d1b09[_0xea82('0x28')];}_0x3e2138['status'](_0x50193f)[_0xea82('0x29')](_0x3d1b09);};}exports[_0xea82('0x2a')]=function(_0x387974,_0x55f6bc){var _0x4d2c84={},_0x3d5590={},_0x2fd0ba={'count':0x0,'rows':[]};var _0x42cf3a=_[_0xea82('0x2b')](db[_0xea82('0x2c')][_0xea82('0x2d')],function(_0x229e4a){return{'name':_0x229e4a[_0xea82('0x2e')],'type':_0x229e4a[_0xea82('0x2f')]['key']};});_0x3d5590[_0xea82('0x30')]=_[_0xea82('0x2b')](_0x42cf3a,_0xea82('0x28'));_0x3d5590[_0xea82('0x31')]=_['keys'](_0x387974[_0xea82('0x31')]);_0x3d5590[_0xea82('0x32')]=_[_0xea82('0x33')](_0x3d5590[_0xea82('0x30')],_0x3d5590[_0xea82('0x31')]);_0x4d2c84[_0xea82('0x34')]=_['intersection'](_0x3d5590[_0xea82('0x30')],qs['fields'](_0x387974[_0xea82('0x31')][_0xea82('0x35')]));_0x4d2c84['attributes']=_0x4d2c84[_0xea82('0x34')]['length']?_0x4d2c84[_0xea82('0x34')]:_0x3d5590['model'];if(!_0x387974['query']['hasOwnProperty']('nolimit')){_0x4d2c84[_0xea82('0x1e')]=qs[_0xea82('0x1e')](_0x387974[_0xea82('0x31')][_0xea82('0x1e')]);_0x4d2c84[_0xea82('0x1c')]=qs[_0xea82('0x1c')](_0x387974[_0xea82('0x31')]['offset']);}_0x4d2c84['order']=qs['sort'](_0x387974[_0xea82('0x31')][_0xea82('0x36')]);_0x4d2c84[_0xea82('0x37')]=qs['filters'](_[_0xea82('0x38')](_0x387974[_0xea82('0x31')],_0x3d5590['filters']),_0x42cf3a);if(_0x387974[_0xea82('0x31')][_0xea82('0x39')]){_0x4d2c84[_0xea82('0x37')]=_[_0xea82('0x3a')](_0x4d2c84[_0xea82('0x37')],{'$or':_[_0xea82('0x2b')](_0x42cf3a,function(_0x2ec1e2){if(_0x2ec1e2[_0xea82('0x2f')]!==_0xea82('0x3b')){var _0x5915a0={};_0x5915a0[_0x2ec1e2[_0xea82('0x28')]]={'$like':'%'+_0x387974[_0xea82('0x31')][_0xea82('0x39')]+'%'};return _0x5915a0;}})});}_0x4d2c84=_[_0xea82('0x3a')]({},_0x4d2c84,_0x387974[_0xea82('0x3c')]);var _0x58bf87={'where':_0x4d2c84[_0xea82('0x37')]};return db[_0xea82('0x2c')][_0xea82('0x3d')](_0x58bf87)[_0xea82('0x24')](function(_0xfce09a){_0x2fd0ba[_0xea82('0x3d')]=_0xfce09a;if(_0x387974['query'][_0xea82('0x3e')]){_0x4d2c84[_0xea82('0x3f')]=[{'all':!![]}];}return db[_0xea82('0x2c')][_0xea82('0x40')](_0x4d2c84);})[_0xea82('0x24')](function(_0x4840c6){_0x2fd0ba[_0xea82('0x41')]=_0x4840c6;return _0x2fd0ba;})[_0xea82('0x24')](respondWithFilteredResult(_0x55f6bc,_0x4d2c84))[_0xea82('0x42')](handleError(_0x55f6bc,null));};exports[_0xea82('0x43')]=function(_0x114b98,_0xbe1800){var _0x5dd8f4={'raw':![],'where':{'id':_0x114b98[_0xea82('0x44')]['id']}},_0x59b1bf={};_0x59b1bf[_0xea82('0x30')]=_['keys'](db['FreshdeskConfiguration'][_0xea82('0x2d')]);_0x59b1bf['query']=_[_0xea82('0x45')](_0x114b98[_0xea82('0x31')]);_0x59b1bf[_0xea82('0x32')]=_[_0xea82('0x33')](_0x59b1bf[_0xea82('0x30')],_0x59b1bf['query']);_0x5dd8f4['attributes']=_[_0xea82('0x33')](_0x59b1bf['model'],qs[_0xea82('0x35')](_0x114b98['query'][_0xea82('0x35')]));_0x5dd8f4[_0xea82('0x34')]=_0x5dd8f4[_0xea82('0x34')][_0xea82('0x46')]?_0x5dd8f4[_0xea82('0x34')]:_0x59b1bf[_0xea82('0x30')];if(_0x114b98['query'][_0xea82('0x3e')]){_0x5dd8f4['include']=[{'all':!![]}];}_0x5dd8f4=_[_0xea82('0x3a')]({},_0x5dd8f4,_0x114b98['options']);return db[_0xea82('0x2c')][_0xea82('0x47')](_0x5dd8f4)['then'](handleEntityNotFound(_0xbe1800,null))[_0xea82('0x24')](respondWithResult(_0xbe1800,null))[_0xea82('0x42')](handleError(_0xbe1800,null));};exports['create']=function(_0x320866,_0x537e8){return db['FreshdeskConfiguration']['create'](_0x320866[_0xea82('0x48')],{})[_0xea82('0x24')](respondWithResult(_0x537e8,0xc9))[_0xea82('0x42')](handleError(_0x537e8,null));};exports[_0xea82('0x23')]=function(_0x37c3d6,_0x247796){if(_0x37c3d6['body']['id']){delete _0x37c3d6[_0xea82('0x48')]['id'];}return db[_0xea82('0x2c')]['find']({'where':{'id':_0x37c3d6[_0xea82('0x44')]['id']}})[_0xea82('0x24')](handleEntityNotFound(_0x247796,null))['then'](saveUpdates(_0x37c3d6[_0xea82('0x48')],null))[_0xea82('0x24')](respondWithResult(_0x247796,null))['catch'](handleError(_0x247796,null));};exports['destroy']=function(_0x4bed2d,_0x614a23){return db['FreshdeskConfiguration'][_0xea82('0x47')]({'where':{'id':_0x4bed2d[_0xea82('0x44')]['id']}})[_0xea82('0x24')](handleEntityNotFound(_0x614a23,null))[_0xea82('0x24')](removeEntity(_0x614a23,null))[_0xea82('0x42')](handleError(_0x614a23,null));};exports['getFields']=function(_0x400e1e,_0x6696b2,_0x2e52b7){var _0x2ebec4={};var _0xefb59={};var _0x4ce4b4;var _0x468cda;return db[_0xea82('0x2c')][_0xea82('0x49')]({'where':{'id':_0x400e1e['params']['id']}})['then'](handleEntityNotFound(_0x6696b2,null))[_0xea82('0x24')](function(_0x349805){if(_0x349805){_0x4ce4b4=_0x349805;_0xefb59[_0xea82('0x30')]=_[_0xea82('0x45')](db['FreshdeskField'][_0xea82('0x2d')]);_0xefb59[_0xea82('0x31')]=_['keys'](_0x400e1e[_0xea82('0x31')]);_0xefb59[_0xea82('0x32')]=_['intersection'](_0xefb59['model'],_0xefb59[_0xea82('0x31')]);_0x2ebec4['attributes']=_[_0xea82('0x33')](_0xefb59[_0xea82('0x30')],qs[_0xea82('0x35')](_0x400e1e[_0xea82('0x31')]['fields']));_0x2ebec4['attributes']=_0x2ebec4[_0xea82('0x34')][_0xea82('0x46')]?_0x2ebec4['attributes']:_0xefb59[_0xea82('0x30')];_0x2ebec4[_0xea82('0x4a')]=qs[_0xea82('0x36')](_0x400e1e[_0xea82('0x31')][_0xea82('0x36')]);_0x2ebec4['where']=qs[_0xea82('0x32')](_[_0xea82('0x38')](_0x400e1e[_0xea82('0x31')],_0xefb59['filters']));if(_0x400e1e[_0xea82('0x31')][_0xea82('0x39')]){_0x2ebec4[_0xea82('0x37')]=_[_0xea82('0x3a')](_0x2ebec4[_0xea82('0x37')],{'$or':_[_0xea82('0x2b')](_0x2ebec4[_0xea82('0x34')],function(_0x1cb233){var _0x5b0a23={};_0x5b0a23[_0x1cb233]={'$like':'%'+_0x400e1e[_0xea82('0x31')]['filter']+'%'};return _0x5b0a23;})});}_0x2ebec4=_[_0xea82('0x3a')]({},_0x2ebec4,_0x400e1e[_0xea82('0x3c')]);return _0x4ce4b4['getFields'](_0x2ebec4);}})['then'](function(_0x37e482){if(_0x37e482){_0x468cda=_0x37e482[_0xea82('0x46')];if(!_0x400e1e[_0xea82('0x31')][_0xea82('0x4b')](_0xea82('0x4c'))){_0x2ebec4[_0xea82('0x1e')]=qs[_0xea82('0x1e')](_0x400e1e[_0xea82('0x31')][_0xea82('0x1e')]);_0x2ebec4[_0xea82('0x1c')]=qs[_0xea82('0x1c')](_0x400e1e['query'][_0xea82('0x1c')]);}return _0x4ce4b4[_0xea82('0x4d')](_0x2ebec4);}})[_0xea82('0x24')](function(_0xa5a0ea){if(_0xa5a0ea){return _0xa5a0ea?{'count':_0x468cda,'rows':_0xa5a0ea}:null;}})['then'](respondWithResult(_0x6696b2,null))['catch'](handleError(_0x6696b2,null));};exports['getSubjects']=function(_0x1426e2,_0xbdaf47,_0xac699d){var _0x3890e6={};var _0x1da660={};var _0x3942ee;var _0x16462f;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1426e2[_0xea82('0x44')]['id']}})['then'](handleEntityNotFound(_0xbdaf47,null))[_0xea82('0x24')](function(_0x1987d9){if(_0x1987d9){_0x3942ee=_0x1987d9;_0x1da660['model']=_[_0xea82('0x45')](db[_0xea82('0x4e')]['rawAttributes']);_0x1da660['query']=_[_0xea82('0x45')](_0x1426e2[_0xea82('0x31')]);_0x1da660[_0xea82('0x32')]=_[_0xea82('0x33')](_0x1da660[_0xea82('0x30')],_0x1da660[_0xea82('0x31')]);_0x3890e6[_0xea82('0x34')]=_[_0xea82('0x33')](_0x1da660['model'],qs[_0xea82('0x35')](_0x1426e2[_0xea82('0x31')][_0xea82('0x35')]));_0x3890e6['attributes']=_0x3890e6[_0xea82('0x34')][_0xea82('0x46')]?_0x3890e6[_0xea82('0x34')]:_0x1da660[_0xea82('0x30')];_0x3890e6['order']=qs[_0xea82('0x36')](_0x1426e2[_0xea82('0x31')]['sort']);_0x3890e6['where']=qs[_0xea82('0x32')](_[_0xea82('0x38')](_0x1426e2[_0xea82('0x31')],_0x1da660[_0xea82('0x32')]));if(_0x1426e2[_0xea82('0x31')][_0xea82('0x39')]){_0x3890e6[_0xea82('0x37')]=_['merge'](_0x3890e6['where'],{'$or':_[_0xea82('0x2b')](_0x3890e6['attributes'],function(_0x4eedf8){var _0x219c51={};_0x219c51[_0x4eedf8]={'$like':'%'+_0x1426e2[_0xea82('0x31')][_0xea82('0x39')]+'%'};return _0x219c51;})});}_0x3890e6=_['merge']({},_0x3890e6,_0x1426e2['options']);return _0x3942ee[_0xea82('0x4f')](_0x3890e6);}})['then'](function(_0x4dee2e){if(_0x4dee2e){_0x16462f=_0x4dee2e[_0xea82('0x46')];if(!_0x1426e2[_0xea82('0x31')][_0xea82('0x4b')](_0xea82('0x4c'))){_0x3890e6['limit']=qs[_0xea82('0x1e')](_0x1426e2[_0xea82('0x31')][_0xea82('0x1e')]);_0x3890e6[_0xea82('0x1c')]=qs[_0xea82('0x1c')](_0x1426e2['query'][_0xea82('0x1c')]);}return _0x3942ee['getSubjects'](_0x3890e6);}})[_0xea82('0x24')](function(_0xe2fa6e){if(_0xe2fa6e){return _0xe2fa6e?{'count':_0x16462f,'rows':_0xe2fa6e}:null;}})[_0xea82('0x24')](respondWithResult(_0xbdaf47,null))[_0xea82('0x42')](handleError(_0xbdaf47,null));};exports[_0xea82('0x50')]=function(_0x5380c7,_0x31bf1b,_0x40dd06){var _0x17f973={};var _0x32b24c={};var _0x3f1b24;var _0x24067f;return db[_0xea82('0x2c')][_0xea82('0x49')]({'where':{'id':_0x5380c7['params']['id']}})[_0xea82('0x24')](handleEntityNotFound(_0x31bf1b,null))['then'](function(_0x2ecc6f){if(_0x2ecc6f){_0x3f1b24=_0x2ecc6f;_0x32b24c[_0xea82('0x30')]=_[_0xea82('0x45')](db['FreshdeskField'][_0xea82('0x2d')]);_0x32b24c[_0xea82('0x31')]=_['keys'](_0x5380c7['query']);_0x32b24c['filters']=_[_0xea82('0x33')](_0x32b24c['model'],_0x32b24c[_0xea82('0x31')]);_0x17f973[_0xea82('0x34')]=_[_0xea82('0x33')](_0x32b24c[_0xea82('0x30')],qs[_0xea82('0x35')](_0x5380c7[_0xea82('0x31')]['fields']));_0x17f973['attributes']=_0x17f973['attributes'][_0xea82('0x46')]?_0x17f973[_0xea82('0x34')]:_0x32b24c[_0xea82('0x30')];_0x17f973['order']=qs['sort'](_0x5380c7[_0xea82('0x31')][_0xea82('0x36')]);_0x17f973[_0xea82('0x37')]=qs[_0xea82('0x32')](_[_0xea82('0x38')](_0x5380c7[_0xea82('0x31')],_0x32b24c[_0xea82('0x32')]));if(_0x5380c7[_0xea82('0x31')][_0xea82('0x39')]){_0x17f973[_0xea82('0x37')]=_[_0xea82('0x3a')](_0x17f973[_0xea82('0x37')],{'$or':_[_0xea82('0x2b')](_0x17f973[_0xea82('0x34')],function(_0x5257cb){var _0x4a7df1={};_0x4a7df1[_0x5257cb]={'$like':'%'+_0x5380c7[_0xea82('0x31')][_0xea82('0x39')]+'%'};return _0x4a7df1;})});}_0x17f973=_['merge']({},_0x17f973,_0x5380c7[_0xea82('0x3c')]);return _0x3f1b24['getDescriptions'](_0x17f973);}})[_0xea82('0x24')](function(_0x3890c0){if(_0x3890c0){_0x24067f=_0x3890c0['length'];if(!_0x5380c7[_0xea82('0x31')]['hasOwnProperty']('nolimit')){_0x17f973[_0xea82('0x1e')]=qs[_0xea82('0x1e')](_0x5380c7[_0xea82('0x31')]['limit']);_0x17f973['offset']=qs[_0xea82('0x1c')](_0x5380c7[_0xea82('0x31')][_0xea82('0x1c')]);}return _0x3f1b24[_0xea82('0x50')](_0x17f973);}})[_0xea82('0x24')](function(_0x1a81a8){if(_0x1a81a8){return _0x1a81a8?{'count':_0x24067f,'rows':_0x1a81a8}:null;}})[_0xea82('0x24')](respondWithResult(_0x31bf1b,null))[_0xea82('0x42')](handleError(_0x31bf1b,null));};exports[_0xea82('0x51')]=function(_0x4446a2,_0x1930d5,_0x2135d8){var _0x21f0f9={};var _0x43c616={};var _0x4a1f87;var _0x2c6753;return db[_0xea82('0x2c')][_0xea82('0x49')]({'where':{'id':_0x4446a2[_0xea82('0x44')]['id']}})[_0xea82('0x24')](handleEntityNotFound(_0x1930d5,null))[_0xea82('0x24')](function(_0xd227fa){if(_0xd227fa){_0x4a1f87=_0xd227fa;_0x43c616[_0xea82('0x30')]=_['keys'](db[_0xea82('0x52')][_0xea82('0x2d')]);_0x43c616[_0xea82('0x31')]=_['keys'](_0x4446a2['query']);_0x43c616[_0xea82('0x32')]=_[_0xea82('0x33')](_0x43c616[_0xea82('0x30')],_0x43c616['query']);_0x21f0f9[_0xea82('0x34')]=_['intersection'](_0x43c616[_0xea82('0x30')],qs['fields'](_0x4446a2[_0xea82('0x31')][_0xea82('0x35')]));_0x21f0f9[_0xea82('0x34')]=_0x21f0f9['attributes'][_0xea82('0x46')]?_0x21f0f9[_0xea82('0x34')]:_0x43c616[_0xea82('0x30')];_0x21f0f9['order']=qs[_0xea82('0x36')](_0x4446a2[_0xea82('0x31')][_0xea82('0x36')]);_0x21f0f9[_0xea82('0x37')]=qs['filters'](_[_0xea82('0x38')](_0x4446a2[_0xea82('0x31')],_0x43c616['filters']));if(_0x4446a2['query'][_0xea82('0x39')]){_0x21f0f9[_0xea82('0x37')]=_[_0xea82('0x3a')](_0x21f0f9[_0xea82('0x37')],{'$or':_[_0xea82('0x2b')](_0x21f0f9[_0xea82('0x34')],function(_0x315bc8){var _0x3da953={};_0x3da953[_0x315bc8]={'$like':'%'+_0x4446a2['query'][_0xea82('0x39')]+'%'};return _0x3da953;})});}_0x21f0f9=_['merge']({},_0x21f0f9,_0x4446a2[_0xea82('0x3c')]);return _0x4a1f87[_0xea82('0x51')](_0x21f0f9);}})['then'](function(_0x23ebc2){if(_0x23ebc2){_0x2c6753=_0x23ebc2[_0xea82('0x46')];if(!_0x4446a2[_0xea82('0x31')]['hasOwnProperty'](_0xea82('0x4c'))){_0x21f0f9['limit']=qs[_0xea82('0x1e')](_0x4446a2['query'][_0xea82('0x1e')]);_0x21f0f9[_0xea82('0x1c')]=qs[_0xea82('0x1c')](_0x4446a2[_0xea82('0x31')][_0xea82('0x1c')]);}return _0x4a1f87['getTags'](_0x21f0f9);}})[_0xea82('0x24')](function(_0x159de4){if(_0x159de4){return _0x159de4?{'count':_0x2c6753,'rows':_0x159de4}:null;}})[_0xea82('0x24')](respondWithResult(_0x1930d5,null))[_0xea82('0x42')](handleError(_0x1930d5,null));};exports[_0xea82('0x53')]=function(_0x5aaa3d,_0x1b0c10,_0x577560){if(_0x5aaa3d[_0xea82('0x48')]['id']){delete _0x5aaa3d[_0xea82('0x48')]['id'];}return db[_0xea82('0x2c')][_0xea82('0x49')]({'where':{'id':_0x5aaa3d[_0xea82('0x44')]['id']}})[_0xea82('0x24')](handleEntityNotFound(_0x1b0c10,null))['then'](function(_0x498c66){if(_0x498c66){return _0x498c66['setTags'](_0x5aaa3d[_0xea82('0x48')][_0xea82('0x54')]||[]);}return null;})['then'](respondWithResult(_0x1b0c10,null))[_0xea82('0x42')](handleError(_0x1b0c10,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a0ca32d..b7b3cd7 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 _0x8508=['int_freshdesk_configurations','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x596bfd,_0x5746ed){var _0x16c8b8=function(_0x448e23){while(--_0x448e23){_0x596bfd['push'](_0x596bfd['shift']());}};_0x16c8b8(++_0x5746ed);}(_0x8508,0x199));var _0x8850=function(_0x25bf39,_0x3b9fc0){_0x25bf39=_0x25bf39-0x0;var _0x85aca2=_0x8508[_0x25bf39];return _0x85aca2;};'use strict';var _=require(_0x8850('0x0'));var util=require('util');var logger=require(_0x8850('0x1'))('api');var moment=require(_0x8850('0x2'));var BPromise=require(_0x8850('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8850('0x4'));var rimraf=require(_0x8850('0x5'));var config=require(_0x8850('0x6'));var attributes=require(_0x8850('0x7'));module[_0x8850('0x8')]=function(_0x2f0f25,_0x150d80){return _0x2f0f25[_0x8850('0x9')](_0x8850('0xa'),attributes,{'tableName':_0x8850('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5a6=['FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x3b7308,_0x4a1125){var _0x224d22=function(_0x2b3b69){while(--_0x2b3b69){_0x3b7308['push'](_0x3b7308['shift']());}};_0x224d22(++_0x4a1125);}(_0xf5a6,0x109));var _0x6f5a=function(_0xf19205,_0x1fe865){_0xf19205=_0xf19205-0x0;var _0x3fd2e2=_0xf5a6[_0xf19205];return _0x3fd2e2;};'use strict';var _=require(_0x6f5a('0x0'));var util=require(_0x6f5a('0x1'));var logger=require(_0x6f5a('0x2'))(_0x6f5a('0x3'));var moment=require(_0x6f5a('0x4'));var BPromise=require(_0x6f5a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f5a('0x6'));var rimraf=require('rimraf');var config=require(_0x6f5a('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x6f5a('0x8')]=function(_0x468f52,_0x30a372){return _0x468f52[_0x6f5a('0x9')](_0x6f5a('0xa'),attributes,{'tableName':'int_freshdesk_configurations','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 b1f88f2..4ba5356 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 _0x0fa6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util'];(function(_0x1b407d,_0x30b6b4){var _0x29b95f=function(_0x576591){while(--_0x576591){_0x1b407d['push'](_0x1b407d['shift']());}};_0x29b95f(++_0x30b6b4);}(_0x0fa6,0x1da));var _0x60fa=function(_0x5dc913,_0x39e1ec){_0x5dc913=_0x5dc913-0x0;var _0x4ec94a=_0x0fa6[_0x5dc913];return _0x4ec94a;};'use strict';var _=require('lodash');var util=require(_0x60fa('0x0'));var moment=require('moment');var BPromise=require(_0x60fa('0x1'));var rs=require(_0x60fa('0x2'));var fs=require('fs');var Redis=require(_0x60fa('0x3'));var db=require(_0x60fa('0x4'))['db'];var utils=require(_0x60fa('0x5'));var logger=require(_0x60fa('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x60fa('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3159d4,_0x7328ad,_0x21333f){return new BPromise(function(_0xd80da6,_0x3bfc9f){return client[_0x60fa('0x8')](_0x3159d4,_0x21333f)[_0x60fa('0x9')](function(_0x42560c){logger[_0x60fa('0xa')](_0x60fa('0xb'),_0x7328ad,_0x60fa('0xc'));logger[_0x60fa('0xd')](_0x60fa('0xe'),_0x7328ad,_0x60fa('0xc'),JSON[_0x60fa('0xf')](_0x42560c));if(_0x42560c[_0x60fa('0x10')]){if(_0x42560c[_0x60fa('0x10')]['code']===0x1f4){logger[_0x60fa('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x7328ad,_0x42560c['error'][_0x60fa('0x11')]);return _0x3bfc9f(_0x42560c[_0x60fa('0x10')][_0x60fa('0x11')]);}logger[_0x60fa('0x10')](_0x60fa('0xb'),_0x7328ad,_0x42560c[_0x60fa('0x10')][_0x60fa('0x11')]);return _0xd80da6(_0x42560c[_0x60fa('0x10')][_0x60fa('0x11')]);}else{logger[_0x60fa('0xa')](_0x60fa('0xb'),_0x7328ad,_0x60fa('0xc'));_0xd80da6(_0x42560c['result'][_0x60fa('0x11')]);}})[_0x60fa('0x12')](function(_0x5907d4){logger[_0x60fa('0x10')](_0x60fa('0xb'),_0x7328ad,_0x5907d4);_0x3bfc9f(_0x5907d4);});});} \ No newline at end of file +var _0xadfd=['client','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xadfd,0x15c));var _0xdadf=function(_0x4a7cf0,_0xafd49a){_0x4a7cf0=_0x4a7cf0-0x0;var _0x1ece2b=_0xadfd[_0x4a7cf0];return _0x1ece2b;};'use strict';var _=require(_0xdadf('0x0'));var util=require('util');var moment=require(_0xdadf('0x1'));var BPromise=require('bluebird');var rs=require(_0xdadf('0x2'));var fs=require('fs');var Redis=require(_0xdadf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdadf('0x4'));var logger=require(_0xdadf('0x5'))(_0xdadf('0x6'));var config=require(_0xdadf('0x7'));var jayson=require(_0xdadf('0x8'));var client=jayson[_0xdadf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1142cb,_0x5eba47,_0x221d7b){return new BPromise(function(_0x2567c8,_0x2c307a){return client['request'](_0x1142cb,_0x221d7b)['then'](function(_0x53258e){logger['info'](_0xdadf('0xa'),_0x5eba47,_0xdadf('0xb'));logger[_0xdadf('0xc')](_0xdadf('0xd'),_0x5eba47,'request\x20sent',JSON[_0xdadf('0xe')](_0x53258e));if(_0x53258e['error']){if(_0x53258e[_0xdadf('0xf')][_0xdadf('0x10')]===0x1f4){logger[_0xdadf('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5eba47,_0x53258e['error'][_0xdadf('0x11')]);return _0x2c307a(_0x53258e[_0xdadf('0xf')][_0xdadf('0x11')]);}logger[_0xdadf('0xf')](_0xdadf('0xa'),_0x5eba47,_0x53258e[_0xdadf('0xf')][_0xdadf('0x11')]);return _0x2567c8(_0x53258e['error'][_0xdadf('0x11')]);}else{logger[_0xdadf('0x12')](_0xdadf('0xa'),_0x5eba47,'request\x20sent');_0x2567c8(_0x53258e[_0xdadf('0x13')][_0xdadf('0x11')]);}})[_0xdadf('0x14')](function(_0x35339c){logger[_0xdadf('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5eba47,_0x35339c);_0x2c307a(_0x35339c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index eebb81a..40459be 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 _0xf96b=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','show','post','put','update','delete','/:id','destroy'];(function(_0x866fbd,_0x2d8dea){var _0x103dc3=function(_0x5aec01){while(--_0x5aec01){_0x866fbd['push'](_0x866fbd['shift']());}};_0x103dc3(++_0x2d8dea);}(_0xf96b,0x1ed));var _0xbf96=function(_0x4238a9,_0x39303f){_0x4238a9=_0x4238a9-0x0;var _0x425f53=_0xf96b[_0x4238a9];return _0x425f53;};'use strict';var multer=require(_0xbf96('0x0'));var util=require('util');var path=require(_0xbf96('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf96('0x2'));var router=express[_0xbf96('0x3')]();var fs_extra=require(_0xbf96('0x4'));var auth=require(_0xbf96('0x5'));var interaction=require(_0xbf96('0x6'));var config=require('../../config/environment');var controller=require(_0xbf96('0x7'));router[_0xbf96('0x8')]('/',auth[_0xbf96('0x9')](),controller['index']);router[_0xbf96('0x8')]('/:id',auth[_0xbf96('0x9')](),controller[_0xbf96('0xa')]);router[_0xbf96('0xb')]('/',auth[_0xbf96('0x9')](),controller['create']);router[_0xbf96('0xc')]('/:id',auth[_0xbf96('0x9')](),controller[_0xbf96('0xd')]);router[_0xbf96('0xe')](_0xbf96('0xf'),auth[_0xbf96('0x9')](),controller[_0xbf96('0x10')]);module['exports']=router; \ No newline at end of file +var _0x34a3=['create','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','show','post','isAuthenticated'];(function(_0x57cbd2,_0x2bdef3){var _0x4aac1f=function(_0x2c7038){while(--_0x2c7038){_0x57cbd2['push'](_0x57cbd2['shift']());}};_0x4aac1f(++_0x2bdef3);}(_0x34a3,0x147));var _0x334a=function(_0x4e24e2,_0x4bf3cc){_0x4e24e2=_0x4e24e2-0x0;var _0x17975b=_0x34a3[_0x4e24e2];return _0x17975b;};'use strict';var multer=require('multer');var util=require(_0x334a('0x0'));var path=require(_0x334a('0x1'));var timeout=require(_0x334a('0x2'));var express=require(_0x334a('0x3'));var router=express[_0x334a('0x4')]();var fs_extra=require(_0x334a('0x5'));var auth=require(_0x334a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x334a('0x7'));var controller=require(_0x334a('0x8'));router[_0x334a('0x9')]('/',auth['isAuthenticated'](),controller[_0x334a('0xa')]);router[_0x334a('0x9')](_0x334a('0xb'),auth['isAuthenticated'](),controller[_0x334a('0xc')]);router[_0x334a('0xd')]('/',auth[_0x334a('0xe')](),controller[_0x334a('0xf')]);router['put'](_0x334a('0xb'),auth['isAuthenticated'](),controller[_0x334a('0x10')]);router[_0x334a('0x11')](_0x334a('0xb'),auth[_0x334a('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 0ede4ee..0c100f5 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 _0x9c9b=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','string'];(function(_0x437fab,_0x307857){var _0x3907ad=function(_0x584abc){while(--_0x584abc){_0x437fab['push'](_0x437fab['shift']());}};_0x3907ad(++_0x307857);}(_0x9c9b,0x82));var _0xb9c9=function(_0xebef8e,_0x1aaf04){_0xebef8e=_0xebef8e-0x0;var _0x5a5f86=_0x9c9b[_0xebef8e];return _0x5a5f86;};'use strict';var Sequelize=require(_0xb9c9('0x0'));module[_0xb9c9('0x1')]={'type':{'type':Sequelize[_0xb9c9('0x2')]('string',_0xb9c9('0x3'),_0xb9c9('0x4'),'keyValue','picklist'),'defaultValue':_0xb9c9('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb9c9('0x6')]},'keyType':{'type':Sequelize[_0xb9c9('0x2')](_0xb9c9('0x5'),_0xb9c9('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xb9c9('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb9c9('0x6')]},'customField':{'type':Sequelize[_0xb9c9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb9c9('0x6')]}}; \ No newline at end of file +var _0x6da2=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x271f00,_0x3cfe65){var _0x54c579=function(_0x12cd8e){while(--_0x12cd8e){_0x271f00['push'](_0x271f00['shift']());}};_0x54c579(++_0x3cfe65);}(_0x6da2,0x87));var _0x26da=function(_0x92a3d9,_0xcf3970){_0x92a3d9=_0x92a3d9-0x0;var _0x56458b=_0x6da2[_0x92a3d9];return _0x56458b;};'use strict';var Sequelize=require(_0x26da('0x0'));module[_0x26da('0x1')]={'type':{'type':Sequelize[_0x26da('0x2')](_0x26da('0x3'),_0x26da('0x4'),_0x26da('0x5'),_0x26da('0x6'),_0x26da('0x7')),'defaultValue':_0x26da('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x26da('0x8')]},'keyType':{'type':Sequelize[_0x26da('0x2')](_0x26da('0x3'),_0x26da('0x4'),_0x26da('0x5'))},'keyContent':{'type':Sequelize[_0x26da('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x26da('0x9')],'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 e3e61a2..1900971 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 _0xeffd=['rawAttributes','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','update','then','destroy','stack','name','send','index','map','FreshdeskField'];(function(_0x27670e,_0x16b7b6){var _0x59c41f=function(_0x8d5cf5){while(--_0x8d5cf5){_0x27670e['push'](_0x27670e['shift']());}};_0x59c41f(++_0x16b7b6);}(_0xeffd,0x6b));var _0xdeff=function(_0x77bb74,_0x3a15ae){_0x77bb74=_0x77bb74-0x0;var _0x245d99=_0xeffd[_0x77bb74];return _0x245d99;};'use strict';var emlformat=require(_0xdeff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdeff('0x1'));var jsonpatch=require(_0xdeff('0x2'));var rp=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var Mustache=require(_0xdeff('0x6'));var util=require(_0xdeff('0x7'));var path=require(_0xdeff('0x8'));var sox=require(_0xdeff('0x9'));var csv=require(_0xdeff('0xa'));var ejs=require(_0xdeff('0xb'));var fs=require('fs');var fs_extra=require(_0xdeff('0xc'));var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var licenseUtil=require(_0xdeff('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461699,_0x116bf9){_0x116bf9=_0x116bf9||0xcc;return function(_0x4952f2){if(_0x4952f2){return _0x461699[_0xdeff('0x1d')](_0x116bf9);}return _0x461699['status'](_0x116bf9)['end']();};}function respondWithResult(_0x3e56a1,_0x47410f){_0x47410f=_0x47410f||0xc8;return function(_0x1585e8){if(_0x1585e8){return _0x3e56a1[_0xdeff('0x1e')](_0x47410f)['json'](_0x1585e8);}};}function respondWithFilteredResult(_0x826132,_0x314ded){return function(_0xea6c4){if(_0xea6c4){var _0x391633=typeof _0x314ded[_0xdeff('0x1f')]===_0xdeff('0x20')&&typeof _0x314ded['limit']==='undefined';var _0x7440af=_0xea6c4['count'];var _0x5c9837=_0x391633?0x0:_0x314ded[_0xdeff('0x1f')];var _0x369e13=_0x391633?_0xea6c4['count']:_0x314ded[_0xdeff('0x1f')]+_0x314ded[_0xdeff('0x21')];var _0x1ab1fa;if(_0x369e13>=_0x7440af){_0x369e13=_0x7440af;_0x1ab1fa=0xc8;}else{_0x1ab1fa=0xce;}_0x826132[_0xdeff('0x1e')](_0x1ab1fa);return _0x826132[_0xdeff('0x22')](_0xdeff('0x23'),_0x5c9837+'-'+_0x369e13+'/'+_0x7440af)[_0xdeff('0x24')](_0xea6c4);}return null;};}function patchUpdates(_0x919c93){return function(_0x488faa){try{jsonpatch['apply'](_0x488faa,_0x919c93,!![]);}catch(_0x56cb84){return BPromise[_0xdeff('0x25')](_0x56cb84);}return _0x488faa['save']();};}function saveUpdates(_0x189627,_0x91c0b4){return function(_0x543653){if(_0x543653){return _0x543653[_0xdeff('0x26')](_0x189627)[_0xdeff('0x27')](function(_0x4eb2a8){return _0x4eb2a8;});}return null;};}function removeEntity(_0x5dbe96,_0x3b2554){return function(_0x15c425){if(_0x15c425){return _0x15c425[_0xdeff('0x28')]()[_0xdeff('0x27')](function(){_0x5dbe96[_0xdeff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb08f19,_0x412db3){return function(_0x3741fb){if(!_0x3741fb){_0xb08f19[_0xdeff('0x1d')](0x194);}return _0x3741fb;};}function handleError(_0x16974b,_0x35823c){_0x35823c=_0x35823c||0x1f4;return function(_0x3d0111){logger['error'](_0x3d0111[_0xdeff('0x29')]);if(_0x3d0111[_0xdeff('0x2a')]){delete _0x3d0111['name'];}_0x16974b['status'](_0x35823c)[_0xdeff('0x2b')](_0x3d0111);};}exports[_0xdeff('0x2c')]=function(_0x16b2d0,_0xcb819c){var _0x533069={},_0xf9b278={},_0xbc75ee={'count':0x0,'rows':[]};var _0x4e0ff2=_[_0xdeff('0x2d')](db[_0xdeff('0x2e')][_0xdeff('0x2f')],function(_0x5045b8){return{'name':_0x5045b8['fieldName'],'type':_0x5045b8[_0xdeff('0x30')]['key']};});_0xf9b278[_0xdeff('0x31')]=_[_0xdeff('0x2d')](_0x4e0ff2,_0xdeff('0x2a'));_0xf9b278['query']=_[_0xdeff('0x32')](_0x16b2d0['query']);_0xf9b278['filters']=_[_0xdeff('0x33')](_0xf9b278[_0xdeff('0x31')],_0xf9b278[_0xdeff('0x34')]);_0x533069[_0xdeff('0x35')]=_['intersection'](_0xf9b278[_0xdeff('0x31')],qs[_0xdeff('0x36')](_0x16b2d0[_0xdeff('0x34')][_0xdeff('0x36')]));_0x533069[_0xdeff('0x35')]=_0x533069[_0xdeff('0x35')][_0xdeff('0x37')]?_0x533069['attributes']:_0xf9b278[_0xdeff('0x31')];if(!_0x16b2d0['query'][_0xdeff('0x38')](_0xdeff('0x39'))){_0x533069[_0xdeff('0x21')]=qs[_0xdeff('0x21')](_0x16b2d0[_0xdeff('0x34')][_0xdeff('0x21')]);_0x533069['offset']=qs[_0xdeff('0x1f')](_0x16b2d0[_0xdeff('0x34')]['offset']);}_0x533069[_0xdeff('0x3a')]=qs[_0xdeff('0x3b')](_0x16b2d0[_0xdeff('0x34')][_0xdeff('0x3b')]);_0x533069[_0xdeff('0x3c')]=qs[_0xdeff('0x3d')](_[_0xdeff('0x3e')](_0x16b2d0[_0xdeff('0x34')],_0xf9b278['filters']),_0x4e0ff2);if(_0x16b2d0[_0xdeff('0x34')]['filter']){_0x533069[_0xdeff('0x3c')]=_[_0xdeff('0x3f')](_0x533069[_0xdeff('0x3c')],{'$or':_['map'](_0x4e0ff2,function(_0x443550){if(_0x443550[_0xdeff('0x30')]!==_0xdeff('0x40')){var _0x467ce0={};_0x467ce0[_0x443550[_0xdeff('0x2a')]]={'$like':'%'+_0x16b2d0['query'][_0xdeff('0x41')]+'%'};return _0x467ce0;}})});}_0x533069=_['merge']({},_0x533069,_0x16b2d0[_0xdeff('0x42')]);var _0x14f1d0={'where':_0x533069['where']};return db[_0xdeff('0x2e')][_0xdeff('0x43')](_0x14f1d0)[_0xdeff('0x27')](function(_0x2e9dcd){_0xbc75ee[_0xdeff('0x43')]=_0x2e9dcd;if(_0x16b2d0['query'][_0xdeff('0x44')]){_0x533069[_0xdeff('0x45')]=[{'all':!![]}];}return db[_0xdeff('0x2e')][_0xdeff('0x46')](_0x533069);})[_0xdeff('0x27')](function(_0x5dfbb3){_0xbc75ee['rows']=_0x5dfbb3;return _0xbc75ee;})[_0xdeff('0x27')](respondWithFilteredResult(_0xcb819c,_0x533069))[_0xdeff('0x47')](handleError(_0xcb819c,null));};exports[_0xdeff('0x48')]=function(_0x318e77,_0x3c4fd2){var _0x289f70={'raw':!![],'where':{'id':_0x318e77['params']['id']}},_0x2cd68a={};_0x2cd68a[_0xdeff('0x31')]=_[_0xdeff('0x32')](db[_0xdeff('0x2e')]['rawAttributes']);_0x2cd68a[_0xdeff('0x34')]=_[_0xdeff('0x32')](_0x318e77[_0xdeff('0x34')]);_0x2cd68a[_0xdeff('0x3d')]=_['intersection'](_0x2cd68a[_0xdeff('0x31')],_0x2cd68a[_0xdeff('0x34')]);_0x289f70[_0xdeff('0x35')]=_[_0xdeff('0x33')](_0x2cd68a[_0xdeff('0x31')],qs[_0xdeff('0x36')](_0x318e77[_0xdeff('0x34')][_0xdeff('0x36')]));_0x289f70['attributes']=_0x289f70[_0xdeff('0x35')][_0xdeff('0x37')]?_0x289f70[_0xdeff('0x35')]:_0x2cd68a[_0xdeff('0x31')];if(_0x318e77[_0xdeff('0x34')]['includeAll']){_0x289f70[_0xdeff('0x45')]=[{'all':!![]}];}_0x289f70=_[_0xdeff('0x3f')]({},_0x289f70,_0x318e77[_0xdeff('0x42')]);return db[_0xdeff('0x2e')][_0xdeff('0x49')](_0x289f70)['then'](handleEntityNotFound(_0x3c4fd2,null))[_0xdeff('0x27')](respondWithResult(_0x3c4fd2,null))['catch'](handleError(_0x3c4fd2,null));};exports[_0xdeff('0x4a')]=function(_0x10e4ba,_0x1bf17c){return db[_0xdeff('0x2e')][_0xdeff('0x4a')](_0x10e4ba[_0xdeff('0x4b')],{})['then'](respondWithResult(_0x1bf17c,0xc9))['catch'](handleError(_0x1bf17c,null));};exports[_0xdeff('0x26')]=function(_0xf91a72,_0x3dc206){if(_0xf91a72['body']['id']){delete _0xf91a72['body']['id'];}return db[_0xdeff('0x2e')][_0xdeff('0x49')]({'where':{'id':_0xf91a72['params']['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x3dc206,null))[_0xdeff('0x27')](saveUpdates(_0xf91a72[_0xdeff('0x4b')],null))['then'](respondWithResult(_0x3dc206,null))[_0xdeff('0x47')](handleError(_0x3dc206,null));};exports[_0xdeff('0x28')]=function(_0x1ca376,_0x59ae32){return db[_0xdeff('0x2e')][_0xdeff('0x49')]({'where':{'id':_0x1ca376[_0xdeff('0x4c')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x59ae32,null))[_0xdeff('0x27')](removeEntity(_0x59ae32,null))[_0xdeff('0x47')](handleError(_0x59ae32,null));}; \ No newline at end of file +var _0xb332=['includeAll','findAll','rows','show','keys','find','body','params','destroy','catch','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','error','name','index','map','FreshdeskField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options'];(function(_0x3cd1d4,_0x34f9e5){var _0x40acbf=function(_0x39c916){while(--_0x39c916){_0x3cd1d4['push'](_0x3cd1d4['shift']());}};_0x40acbf(++_0x34f9e5);}(_0xb332,0xd9));var _0x2b33=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xb332[_0x6d6a66];return _0x11eb6e;};'use strict';var emlformat=require(_0x2b33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b33('0x1'));var jsonpatch=require(_0x2b33('0x2'));var rp=require('request-promise');var moment=require(_0x2b33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b33('0x4'));var util=require('util');var path=require(_0x2b33('0x5'));var sox=require('sox');var csv=require(_0x2b33('0x6'));var ejs=require(_0x2b33('0x7'));var fs=require('fs');var fs_extra=require(_0x2b33('0x8'));var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x6'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];function respondWithStatusCode(_0x3969cb,_0xca2248){_0xca2248=_0xca2248||0xcc;return function(_0x4df129){if(_0x4df129){return _0x3969cb[_0x2b33('0x17')](_0xca2248);}return _0x3969cb[_0x2b33('0x18')](_0xca2248)[_0x2b33('0x19')]();};}function respondWithResult(_0x4ef886,_0x173c75){_0x173c75=_0x173c75||0xc8;return function(_0x4d39db){if(_0x4d39db){return _0x4ef886[_0x2b33('0x18')](_0x173c75)[_0x2b33('0x1a')](_0x4d39db);}};}function respondWithFilteredResult(_0x233cd9,_0x57aea7){return function(_0x52693f){if(_0x52693f){var _0x1d8e75=typeof _0x57aea7[_0x2b33('0x1b')]===_0x2b33('0x1c')&&typeof _0x57aea7[_0x2b33('0x1d')]===_0x2b33('0x1c');var _0x4d69d0=_0x52693f['count'];var _0x59f0b6=_0x1d8e75?0x0:_0x57aea7[_0x2b33('0x1b')];var _0x4f10c4=_0x1d8e75?_0x52693f['count']:_0x57aea7[_0x2b33('0x1b')]+_0x57aea7[_0x2b33('0x1d')];var _0x205d8f;if(_0x4f10c4>=_0x4d69d0){_0x4f10c4=_0x4d69d0;_0x205d8f=0xc8;}else{_0x205d8f=0xce;}_0x233cd9['status'](_0x205d8f);return _0x233cd9[_0x2b33('0x1e')]('Content-Range',_0x59f0b6+'-'+_0x4f10c4+'/'+_0x4d69d0)[_0x2b33('0x1a')](_0x52693f);}return null;};}function patchUpdates(_0x2565be){return function(_0x8c8dc2){try{jsonpatch[_0x2b33('0x1f')](_0x8c8dc2,_0x2565be,!![]);}catch(_0x233ba6){return BPromise[_0x2b33('0x20')](_0x233ba6);}return _0x8c8dc2[_0x2b33('0x21')]();};}function saveUpdates(_0x4fb725,_0x23024c){return function(_0x1d9c98){if(_0x1d9c98){return _0x1d9c98[_0x2b33('0x22')](_0x4fb725)[_0x2b33('0x23')](function(_0x58998e){return _0x58998e;});}return null;};}function removeEntity(_0x1c27d4,_0x27f1b8){return function(_0x2605e6){if(_0x2605e6){return _0x2605e6['destroy']()[_0x2b33('0x23')](function(){_0x1c27d4[_0x2b33('0x18')](0xcc)[_0x2b33('0x19')]();});}};}function handleEntityNotFound(_0x32b835,_0x4df3d4){return function(_0x2ec9db){if(!_0x2ec9db){_0x32b835['sendStatus'](0x194);}return _0x2ec9db;};}function handleError(_0x373e27,_0x483cf4){_0x483cf4=_0x483cf4||0x1f4;return function(_0x2e74d0){logger[_0x2b33('0x24')](_0x2e74d0['stack']);if(_0x2e74d0[_0x2b33('0x25')]){delete _0x2e74d0['name'];}_0x373e27[_0x2b33('0x18')](_0x483cf4)['send'](_0x2e74d0);};}exports[_0x2b33('0x26')]=function(_0xa109f4,_0x9482a){var _0x268c1d={},_0xaa6643={},_0x312d4d={'count':0x0,'rows':[]};var _0x2be034=_[_0x2b33('0x27')](db[_0x2b33('0x28')][_0x2b33('0x29')],function(_0x4cf72f){return{'name':_0x4cf72f['fieldName'],'type':_0x4cf72f[_0x2b33('0x2a')][_0x2b33('0x2b')]};});_0xaa6643[_0x2b33('0x2c')]=_[_0x2b33('0x27')](_0x2be034,_0x2b33('0x25'));_0xaa6643['query']=_['keys'](_0xa109f4[_0x2b33('0x2d')]);_0xaa6643[_0x2b33('0x2e')]=_[_0x2b33('0x2f')](_0xaa6643[_0x2b33('0x2c')],_0xaa6643[_0x2b33('0x2d')]);_0x268c1d[_0x2b33('0x30')]=_['intersection'](_0xaa6643[_0x2b33('0x2c')],qs['fields'](_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x31')]));_0x268c1d[_0x2b33('0x30')]=_0x268c1d[_0x2b33('0x30')][_0x2b33('0x32')]?_0x268c1d[_0x2b33('0x30')]:_0xaa6643[_0x2b33('0x2c')];if(!_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x33')](_0x2b33('0x34'))){_0x268c1d[_0x2b33('0x1d')]=qs[_0x2b33('0x1d')](_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x1d')]);_0x268c1d[_0x2b33('0x1b')]=qs[_0x2b33('0x1b')](_0xa109f4['query']['offset']);}_0x268c1d['order']=qs[_0x2b33('0x35')](_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x35')]);_0x268c1d[_0x2b33('0x36')]=qs[_0x2b33('0x2e')](_['pick'](_0xa109f4['query'],_0xaa6643[_0x2b33('0x2e')]),_0x2be034);if(_0xa109f4['query'][_0x2b33('0x37')]){_0x268c1d[_0x2b33('0x36')]=_[_0x2b33('0x38')](_0x268c1d[_0x2b33('0x36')],{'$or':_[_0x2b33('0x27')](_0x2be034,function(_0x40a109){if(_0x40a109[_0x2b33('0x2a')]!==_0x2b33('0x39')){var _0x21557c={};_0x21557c[_0x40a109[_0x2b33('0x25')]]={'$like':'%'+_0xa109f4['query'][_0x2b33('0x37')]+'%'};return _0x21557c;}})});}_0x268c1d=_[_0x2b33('0x38')]({},_0x268c1d,_0xa109f4[_0x2b33('0x3a')]);var _0x5b7c32={'where':_0x268c1d['where']};return db[_0x2b33('0x28')]['count'](_0x5b7c32)[_0x2b33('0x23')](function(_0x23a27c){_0x312d4d['count']=_0x23a27c;if(_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x3b')]){_0x268c1d['include']=[{'all':!![]}];}return db[_0x2b33('0x28')][_0x2b33('0x3c')](_0x268c1d);})['then'](function(_0x2168b6){_0x312d4d[_0x2b33('0x3d')]=_0x2168b6;return _0x312d4d;})[_0x2b33('0x23')](respondWithFilteredResult(_0x9482a,_0x268c1d))['catch'](handleError(_0x9482a,null));};exports[_0x2b33('0x3e')]=function(_0x26928a,_0x2b1c29){var _0x22f321={'raw':!![],'where':{'id':_0x26928a['params']['id']}},_0x22ce0c={};_0x22ce0c[_0x2b33('0x2c')]=_[_0x2b33('0x3f')](db[_0x2b33('0x28')]['rawAttributes']);_0x22ce0c[_0x2b33('0x2d')]=_[_0x2b33('0x3f')](_0x26928a[_0x2b33('0x2d')]);_0x22ce0c[_0x2b33('0x2e')]=_['intersection'](_0x22ce0c[_0x2b33('0x2c')],_0x22ce0c[_0x2b33('0x2d')]);_0x22f321['attributes']=_['intersection'](_0x22ce0c['model'],qs[_0x2b33('0x31')](_0x26928a['query'][_0x2b33('0x31')]));_0x22f321[_0x2b33('0x30')]=_0x22f321[_0x2b33('0x30')][_0x2b33('0x32')]?_0x22f321[_0x2b33('0x30')]:_0x22ce0c[_0x2b33('0x2c')];if(_0x26928a[_0x2b33('0x2d')][_0x2b33('0x3b')]){_0x22f321['include']=[{'all':!![]}];}_0x22f321=_[_0x2b33('0x38')]({},_0x22f321,_0x26928a[_0x2b33('0x3a')]);return db[_0x2b33('0x28')][_0x2b33('0x40')](_0x22f321)[_0x2b33('0x23')](handleEntityNotFound(_0x2b1c29,null))[_0x2b33('0x23')](respondWithResult(_0x2b1c29,null))['catch'](handleError(_0x2b1c29,null));};exports['create']=function(_0x57cb02,_0x493123){return db[_0x2b33('0x28')]['create'](_0x57cb02[_0x2b33('0x41')],{})['then'](respondWithResult(_0x493123,0xc9))['catch'](handleError(_0x493123,null));};exports[_0x2b33('0x22')]=function(_0xd15da9,_0x357724){if(_0xd15da9['body']['id']){delete _0xd15da9[_0x2b33('0x41')]['id'];}return db['FreshdeskField'][_0x2b33('0x40')]({'where':{'id':_0xd15da9[_0x2b33('0x42')]['id']}})[_0x2b33('0x23')](handleEntityNotFound(_0x357724,null))[_0x2b33('0x23')](saveUpdates(_0xd15da9[_0x2b33('0x41')],null))[_0x2b33('0x23')](respondWithResult(_0x357724,null))['catch'](handleError(_0x357724,null));};exports[_0x2b33('0x43')]=function(_0x27f766,_0xc3fd2e){return db['FreshdeskField'][_0x2b33('0x40')]({'where':{'id':_0x27f766[_0x2b33('0x42')]['id']}})[_0x2b33('0x23')](handleEntityNotFound(_0xc3fd2e,null))['then'](removeEntity(_0xc3fd2e,null))[_0x2b33('0x44')](handleError(_0xc3fd2e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 45f1af2..168291e 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 _0x296f=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','int_freshdesk_fields','freshdesk_unique_index','FieldId'];(function(_0x464f24,_0x1a3b5f){var _0x56b42e=function(_0x4f8604){while(--_0x4f8604){_0x464f24['push'](_0x464f24['shift']());}};_0x56b42e(++_0x1a3b5f);}(_0x296f,0xf0));var _0xf296=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0x296f[_0x6aad74];return _0x5b1c38;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var logger=require(_0xf296('0x2'))(_0xf296('0x3'));var moment=require(_0xf296('0x4'));var BPromise=require(_0xf296('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf296('0x6'));var config=require(_0xf296('0x7'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x4c9620,_0x41a1b3){return _0x4c9620[_0xf296('0x8')]('FreshdeskField',attributes,{'tableName':_0xf296('0x9'),'paranoid':![],'indexes':[{'name':_0xf296('0xa'),'fields':['idField',_0xf296('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1abc=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','FreshdeskField','freshdesk_unique_index'];(function(_0x5d2659,_0x1af900){var _0x533e59=function(_0x26664a){while(--_0x26664a){_0x5d2659['push'](_0x5d2659['shift']());}};_0x533e59(++_0x1af900);}(_0x1abc,0x174));var _0xc1ab=function(_0x1b640a,_0x3ec2d0){_0x1b640a=_0x1b640a-0x0;var _0x23f029=_0x1abc[_0x1b640a];return _0x23f029;};'use strict';var _=require(_0xc1ab('0x0'));var util=require(_0xc1ab('0x1'));var logger=require('../../config/logger')(_0xc1ab('0x2'));var moment=require(_0xc1ab('0x3'));var BPromise=require(_0xc1ab('0x4'));var rp=require(_0xc1ab('0x5'));var fs=require('fs');var path=require(_0xc1ab('0x6'));var rimraf=require(_0xc1ab('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xc1ab('0x8')]=function(_0x1c5a30,_0x9933ac){return _0x1c5a30[_0xc1ab('0x9')](_0xc1ab('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xc1ab('0xb'),'fields':['idField','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 378ba0a..cbd8df9 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 _0x1aaa=['rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x14e9f0,_0x287f90){var _0xa63f7e=function(_0x4829d6){while(--_0x4829d6){_0x14e9f0['push'](_0x14e9f0['shift']());}};_0xa63f7e(++_0x287f90);}(_0x1aaa,0x185));var _0xa1aa=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x1aaa[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xa1aa('0x0'));var util=require(_0xa1aa('0x1'));var moment=require(_0xa1aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xa1aa('0x3'));var fs=require('fs');var Redis=require(_0xa1aa('0x4'));var db=require(_0xa1aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1aa('0x6'))(_0xa1aa('0x7'));var config=require(_0xa1aa('0x8'));var jayson=require(_0xa1aa('0x9'));var client=jayson[_0xa1aa('0xa')][_0xa1aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45cfb8,_0x4e7435,_0x187fd3){return new BPromise(function(_0x18860d,_0x4e3f09){return client[_0xa1aa('0xc')](_0x45cfb8,_0x187fd3)[_0xa1aa('0xd')](function(_0x155495){logger['info'](_0xa1aa('0xe'),_0x4e7435,_0xa1aa('0xf'));logger[_0xa1aa('0x10')](_0xa1aa('0x11'),_0x4e7435,_0xa1aa('0xf'),JSON['stringify'](_0x155495));if(_0x155495['error']){if(_0x155495[_0xa1aa('0x12')]['code']===0x1f4){logger[_0xa1aa('0x12')](_0xa1aa('0xe'),_0x4e7435,_0x155495[_0xa1aa('0x12')][_0xa1aa('0x13')]);return _0x4e3f09(_0x155495[_0xa1aa('0x12')][_0xa1aa('0x13')]);}logger[_0xa1aa('0x12')](_0xa1aa('0xe'),_0x4e7435,_0x155495['error'][_0xa1aa('0x13')]);return _0x18860d(_0x155495[_0xa1aa('0x12')]['message']);}else{logger[_0xa1aa('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x4e7435,_0xa1aa('0xf'));_0x18860d(_0x155495['result']['message']);}})[_0xa1aa('0x15')](function(_0x3169e3){logger[_0xa1aa('0x12')](_0xa1aa('0xe'),_0x4e7435,_0x3169e3);_0x4e3f09(_0x3169e3);});});} \ No newline at end of file +var _0x8e44=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4dd0a7,_0xb4399f){var _0x487e9b=function(_0x355738){while(--_0x355738){_0x4dd0a7['push'](_0x4dd0a7['shift']());}};_0x487e9b(++_0xb4399f);}(_0x8e44,0x1e3));var _0x48e4=function(_0x487605,_0x17306e){_0x487605=_0x487605-0x0;var _0x42c167=_0x8e44[_0x487605];return _0x42c167;};'use strict';var _=require(_0x48e4('0x0'));var util=require('util');var moment=require(_0x48e4('0x1'));var BPromise=require(_0x48e4('0x2'));var rs=require(_0x48e4('0x3'));var fs=require('fs');var Redis=require(_0x48e4('0x4'));var db=require(_0x48e4('0x5'))['db'];var utils=require(_0x48e4('0x6'));var logger=require(_0x48e4('0x7'))(_0x48e4('0x8'));var config=require('../../config/environment');var jayson=require(_0x48e4('0x9'));var client=jayson[_0x48e4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf4ef7c,_0x4627dd,_0x149865){return new BPromise(function(_0x5eb229,_0x4882d1){return client[_0x48e4('0xb')](_0xf4ef7c,_0x149865)[_0x48e4('0xc')](function(_0x39b49d){logger[_0x48e4('0xd')](_0x48e4('0xe'),_0x4627dd,_0x48e4('0xf'));logger[_0x48e4('0x10')](_0x48e4('0x11'),_0x4627dd,_0x48e4('0xf'),JSON['stringify'](_0x39b49d));if(_0x39b49d[_0x48e4('0x12')]){if(_0x39b49d['error'][_0x48e4('0x13')]===0x1f4){logger['error'](_0x48e4('0xe'),_0x4627dd,_0x39b49d[_0x48e4('0x12')][_0x48e4('0x14')]);return _0x4882d1(_0x39b49d['error']['message']);}logger[_0x48e4('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x4627dd,_0x39b49d[_0x48e4('0x12')][_0x48e4('0x14')]);return _0x5eb229(_0x39b49d[_0x48e4('0x12')][_0x48e4('0x14')]);}else{logger[_0x48e4('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x4627dd,_0x48e4('0xf'));_0x5eb229(_0x39b49d[_0x48e4('0x15')][_0x48e4('0x14')]);}})[_0x48e4('0x16')](function(_0x34527c){logger[_0x48e4('0x12')](_0x48e4('0xe'),_0x4627dd,_0x34527c);_0x4882d1(_0x34527c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d26e985..03c951e 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 _0xb62e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x2b0a69,_0x232266){var _0x10a382=function(_0x4217a4){while(--_0x4217a4){_0x2b0a69['push'](_0x2b0a69['shift']());}};_0x10a382(++_0x232266);}(_0xb62e,0x1de));var _0xeb62=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb62e[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')]('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x11')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),controller['addConfiguration']);router[_0xeb62('0x13')](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x15')]);router['delete'](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0102=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','util','path','connect-timeout','express','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x0102,0x186));var _0x2010=function(_0x324023,_0x29823a){_0x324023=_0x324023-0x0;var _0x1809f1=_0x0102[_0x324023];return _0x1809f1;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();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(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id/configurations',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0xe')]);router[_0x2010('0xd')](_0x2010('0xf'),auth[_0x2010('0x6')](),controller[_0x2010('0x10')]);router[_0x2010('0x11')](_0x2010('0x8'),auth[_0x2010('0x6')](),controller['update']);router['delete'](_0x2010('0x8'),auth[_0x2010('0x6')](),controller[_0x2010('0x12')]);module[_0x2010('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index e1c2f27..f37b471 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 _0xd943=['exports','STRING','username','remoteUri','sequelize'];(function(_0x89dd97,_0x22709c){var _0x2a164d=function(_0x58229c){while(--_0x58229c){_0x89dd97['push'](_0x89dd97['shift']());}};_0x2a164d(++_0x22709c);}(_0xd943,0x15d));var _0x3d94=function(_0x5ddbd7,_0x595ffa){_0x5ddbd7=_0x5ddbd7-0x0;var _0x4bfd8b=_0xd943[_0x5ddbd7];return _0x4bfd8b;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'name':{'type':Sequelize[_0x3d94('0x2')]},'description':{'type':Sequelize[_0x3d94('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3d94('0x3')},'apiKey':{'type':Sequelize[_0x3d94('0x2')]},'remoteUri':{'type':Sequelize[_0x3d94('0x2')],'unique':_0x3d94('0x4')},'serverUrl':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd117=['remoteUri','sequelize','exports','STRING','username'];(function(_0x589ae6,_0x498418){var _0x5b5498=function(_0xfbe718){while(--_0xfbe718){_0x589ae6['push'](_0x589ae6['shift']());}};_0x5b5498(++_0x498418);}(_0xd117,0x182));var _0x7d11=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0xd117[_0x42d2af];return _0x1d6d63;};'use strict';var Sequelize=require(_0x7d11('0x0'));module[_0x7d11('0x1')]={'name':{'type':Sequelize[_0x7d11('0x2')]},'description':{'type':Sequelize[_0x7d11('0x2')]},'username':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x3')},'apiKey':{'type':Sequelize[_0x7d11('0x2')]},'remoteUri':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x4')},'serverUrl':{'type':Sequelize[_0x7d11('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 ddbbac8..f84b673 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 _0xa415=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','offset','set','json','apply','reject','save','update','destroy','then','end','name','send','index','map','FreshsalesAccount','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','count','includeAll','include','rows','catch','show','params','options','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','addConfiguration','channel','Descriptions','getDescriptions','Subjects','getFields','username','apiKey','remoteUri','slice','lastIndexOf','/api/selector/owners','Token\x20token=','email','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto'];(function(_0x3fedb8,_0x230308){var _0x48df7d=function(_0x3fb17c){while(--_0x3fb17c){_0x3fedb8['push'](_0x3fedb8['shift']());}};_0x48df7d(++_0x230308);}(_0xa415,0x1d5));var _0x5a41=function(_0x4a3b7c,_0x30aa7a){_0x4a3b7c=_0x4a3b7c-0x0;var _0x300068=_0xa415[_0x4a3b7c];return _0x300068;};'use strict';var emlformat=require(_0x5a41('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a41('0x1'));var jsonpatch=require(_0x5a41('0x2'));var rp=require(_0x5a41('0x3'));var moment=require(_0x5a41('0x4'));var BPromise=require(_0x5a41('0x5'));var Mustache=require(_0x5a41('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5a41('0x7'));var csv=require(_0x5a41('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a41('0x9'));var squel=require('squel');var crypto=require(_0x5a41('0xa'));var jsforce=require(_0x5a41('0xb'));var deskjs=require(_0x5a41('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5a41('0xd'));var Papa=require(_0x5a41('0xe'));var Redis=require(_0x5a41('0xf'));var authService=require(_0x5a41('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5a41('0x11'));var hardwareService=require(_0x5a41('0x12'));var logger=require('../../config/logger')(_0x5a41('0x13'));var utils=require(_0x5a41('0x14'));var config=require(_0x5a41('0x15'));var licenseUtil=require(_0x5a41('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5a41('0x17'));function respondWithStatusCode(_0x56da65,_0x263c91){_0x263c91=_0x263c91||0xcc;return function(_0x3d4538){if(_0x3d4538){return _0x56da65[_0x5a41('0x18')](_0x263c91);}return _0x56da65[_0x5a41('0x19')](_0x263c91)['end']();};}function respondWithResult(_0x2e179b,_0x3938de){_0x3938de=_0x3938de||0xc8;return function(_0x3f0618){if(_0x3f0618){return _0x2e179b[_0x5a41('0x19')](_0x3938de)['json'](_0x3f0618);}};}function respondWithFilteredResult(_0xa1e4da,_0x40ba8e){return function(_0x32335f){if(_0x32335f){var _0x439122=typeof _0x40ba8e['offset']===_0x5a41('0x1a')&&typeof _0x40ba8e['limit']===_0x5a41('0x1a');var _0x4493ae=_0x32335f['count'];var _0x4ac2e4=_0x439122?0x0:_0x40ba8e[_0x5a41('0x1b')];var _0x2a1062=_0x439122?_0x32335f['count']:_0x40ba8e[_0x5a41('0x1b')]+_0x40ba8e['limit'];var _0x372e18;if(_0x2a1062>=_0x4493ae){_0x2a1062=_0x4493ae;_0x372e18=0xc8;}else{_0x372e18=0xce;}_0xa1e4da[_0x5a41('0x19')](_0x372e18);return _0xa1e4da[_0x5a41('0x1c')]('Content-Range',_0x4ac2e4+'-'+_0x2a1062+'/'+_0x4493ae)[_0x5a41('0x1d')](_0x32335f);}return null;};}function patchUpdates(_0x3dc33b){return function(_0x50ca63){try{jsonpatch[_0x5a41('0x1e')](_0x50ca63,_0x3dc33b,!![]);}catch(_0x3c9c68){return BPromise[_0x5a41('0x1f')](_0x3c9c68);}return _0x50ca63[_0x5a41('0x20')]();};}function saveUpdates(_0x986d1f,_0xcd548){return function(_0x58f5e6){if(_0x58f5e6){return _0x58f5e6[_0x5a41('0x21')](_0x986d1f)['then'](function(_0x3e7630){return _0x3e7630;});}return null;};}function removeEntity(_0x237332,_0x21ce06){return function(_0x240923){if(_0x240923){return _0x240923[_0x5a41('0x22')]()[_0x5a41('0x23')](function(){_0x237332['status'](0xcc)[_0x5a41('0x24')]();});}};}function handleEntityNotFound(_0x2fe3dd,_0x16195e){return function(_0xf4c29c){if(!_0xf4c29c){_0x2fe3dd['sendStatus'](0x194);}return _0xf4c29c;};}function handleError(_0x3df36c,_0x55ff83){_0x55ff83=_0x55ff83||0x1f4;return function(_0x5c58b0){logger['error'](_0x5c58b0['stack']);if(_0x5c58b0[_0x5a41('0x25')]){delete _0x5c58b0[_0x5a41('0x25')];}_0x3df36c[_0x5a41('0x19')](_0x55ff83)[_0x5a41('0x26')](_0x5c58b0);};}exports[_0x5a41('0x27')]=function(_0x328275,_0xb4a6f){var _0x4cc3ea={},_0x15f652={},_0x5366ae={'count':0x0,'rows':[]};var _0x3e8070=_[_0x5a41('0x28')](db[_0x5a41('0x29')]['rawAttributes'],function(_0x5ebcf7){return{'name':_0x5ebcf7[_0x5a41('0x2a')],'type':_0x5ebcf7['type']['key']};});_0x15f652['model']=_[_0x5a41('0x28')](_0x3e8070,_0x5a41('0x25'));_0x15f652['query']=_[_0x5a41('0x2b')](_0x328275[_0x5a41('0x2c')]);_0x15f652[_0x5a41('0x2d')]=_[_0x5a41('0x2e')](_0x15f652[_0x5a41('0x2f')],_0x15f652[_0x5a41('0x2c')]);_0x4cc3ea[_0x5a41('0x30')]=_[_0x5a41('0x2e')](_0x15f652[_0x5a41('0x2f')],qs[_0x5a41('0x31')](_0x328275[_0x5a41('0x2c')][_0x5a41('0x31')]));_0x4cc3ea[_0x5a41('0x30')]=_0x4cc3ea[_0x5a41('0x30')][_0x5a41('0x32')]?_0x4cc3ea[_0x5a41('0x30')]:_0x15f652[_0x5a41('0x2f')];if(!_0x328275[_0x5a41('0x2c')][_0x5a41('0x33')](_0x5a41('0x34'))){_0x4cc3ea[_0x5a41('0x35')]=qs[_0x5a41('0x35')](_0x328275[_0x5a41('0x2c')][_0x5a41('0x35')]);_0x4cc3ea['offset']=qs[_0x5a41('0x1b')](_0x328275[_0x5a41('0x2c')][_0x5a41('0x1b')]);}_0x4cc3ea[_0x5a41('0x36')]=qs[_0x5a41('0x37')](_0x328275['query']['sort']);_0x4cc3ea[_0x5a41('0x38')]=qs[_0x5a41('0x2d')](_[_0x5a41('0x39')](_0x328275['query'],_0x15f652[_0x5a41('0x2d')]),_0x3e8070);if(_0x328275[_0x5a41('0x2c')]['filter']){_0x4cc3ea[_0x5a41('0x38')]=_[_0x5a41('0x3a')](_0x4cc3ea[_0x5a41('0x38')],{'$or':_['map'](_0x3e8070,function(_0x52aa45){if(_0x52aa45[_0x5a41('0x3b')]!==_0x5a41('0x3c')){var _0x3ec4b9={};_0x3ec4b9[_0x52aa45[_0x5a41('0x25')]]={'$like':'%'+_0x328275['query'][_0x5a41('0x3d')]+'%'};return _0x3ec4b9;}})});}_0x4cc3ea=_[_0x5a41('0x3a')]({},_0x4cc3ea,_0x328275['options']);var _0x14e848={'where':_0x4cc3ea[_0x5a41('0x38')]};return db[_0x5a41('0x29')][_0x5a41('0x3e')](_0x14e848)[_0x5a41('0x23')](function(_0x3381f2){_0x5366ae[_0x5a41('0x3e')]=_0x3381f2;if(_0x328275[_0x5a41('0x2c')][_0x5a41('0x3f')]){_0x4cc3ea[_0x5a41('0x40')]=[{'all':!![]}];}return db[_0x5a41('0x29')]['findAll'](_0x4cc3ea);})[_0x5a41('0x23')](function(_0x41ed0a){_0x5366ae[_0x5a41('0x41')]=_0x41ed0a;return _0x5366ae;})['then'](respondWithFilteredResult(_0xb4a6f,_0x4cc3ea))[_0x5a41('0x42')](handleError(_0xb4a6f,null));};exports[_0x5a41('0x43')]=function(_0x47ee39,_0x1d0855){var _0x1a8e20={'raw':![],'where':{'id':_0x47ee39[_0x5a41('0x44')]['id']}},_0x105ed7={};_0x105ed7[_0x5a41('0x2f')]=_[_0x5a41('0x2b')](db[_0x5a41('0x29')]['rawAttributes']);_0x105ed7[_0x5a41('0x2c')]=_[_0x5a41('0x2b')](_0x47ee39['query']);_0x105ed7['filters']=_[_0x5a41('0x2e')](_0x105ed7[_0x5a41('0x2f')],_0x105ed7['query']);_0x1a8e20[_0x5a41('0x30')]=_[_0x5a41('0x2e')](_0x105ed7[_0x5a41('0x2f')],qs[_0x5a41('0x31')](_0x47ee39['query'][_0x5a41('0x31')]));_0x1a8e20[_0x5a41('0x30')]=_0x1a8e20[_0x5a41('0x30')][_0x5a41('0x32')]?_0x1a8e20[_0x5a41('0x30')]:_0x105ed7[_0x5a41('0x2f')];if(_0x47ee39[_0x5a41('0x2c')][_0x5a41('0x3f')]){_0x1a8e20[_0x5a41('0x40')]=[{'all':!![]}];}_0x1a8e20=_[_0x5a41('0x3a')]({},_0x1a8e20,_0x47ee39[_0x5a41('0x45')]);return db[_0x5a41('0x29')]['find'](_0x1a8e20)[_0x5a41('0x23')](handleEntityNotFound(_0x1d0855,null))['then'](respondWithResult(_0x1d0855,null))['catch'](handleError(_0x1d0855,null));};exports[_0x5a41('0x46')]=function(_0x4795df,_0x40d0b8){return db[_0x5a41('0x29')][_0x5a41('0x46')](_0x4795df[_0x5a41('0x47')],{})[_0x5a41('0x23')](respondWithResult(_0x40d0b8,0xc9))[_0x5a41('0x42')](handleError(_0x40d0b8,null));};exports['update']=function(_0x2fe1e9,_0x5f399d){if(_0x2fe1e9[_0x5a41('0x47')]['id']){delete _0x2fe1e9['body']['id'];}return db[_0x5a41('0x29')][_0x5a41('0x48')]({'where':{'id':_0x2fe1e9['params']['id']}})[_0x5a41('0x23')](handleEntityNotFound(_0x5f399d,null))[_0x5a41('0x23')](saveUpdates(_0x2fe1e9[_0x5a41('0x47')],null))[_0x5a41('0x23')](respondWithResult(_0x5f399d,null))[_0x5a41('0x42')](handleError(_0x5f399d,null));};exports[_0x5a41('0x22')]=function(_0x217b53,_0x26ac19){return db[_0x5a41('0x29')][_0x5a41('0x48')]({'where':{'id':_0x217b53[_0x5a41('0x44')]['id']}})['then'](handleEntityNotFound(_0x26ac19,null))['then'](removeEntity(_0x26ac19,null))[_0x5a41('0x42')](handleError(_0x26ac19,null));};exports[_0x5a41('0x49')]=function(_0x54351e,_0x57df66,_0x34f7f2){var _0xa2d14d={};var _0x57992e={};var _0x33046f;var _0x7c794b;return db['FreshsalesAccount'][_0x5a41('0x4a')]({'where':{'id':_0x54351e[_0x5a41('0x44')]['id']}})[_0x5a41('0x23')](handleEntityNotFound(_0x57df66,null))[_0x5a41('0x23')](function(_0x979291){if(_0x979291){_0x33046f=_0x979291;_0x57992e[_0x5a41('0x2f')]=_['keys'](db[_0x5a41('0x4b')][_0x5a41('0x4c')]);_0x57992e['query']=_[_0x5a41('0x2b')](_0x54351e[_0x5a41('0x2c')]);_0x57992e['filters']=_[_0x5a41('0x2e')](_0x57992e[_0x5a41('0x2f')],_0x57992e[_0x5a41('0x2c')]);_0xa2d14d['attributes']=_[_0x5a41('0x2e')](_0x57992e[_0x5a41('0x2f')],qs[_0x5a41('0x31')](_0x54351e[_0x5a41('0x2c')][_0x5a41('0x31')]));_0xa2d14d[_0x5a41('0x30')]=_0xa2d14d[_0x5a41('0x30')][_0x5a41('0x32')]?_0xa2d14d[_0x5a41('0x30')]:_0x57992e[_0x5a41('0x2f')];_0xa2d14d[_0x5a41('0x36')]=qs[_0x5a41('0x37')](_0x54351e['query'][_0x5a41('0x37')]);_0xa2d14d[_0x5a41('0x38')]=qs[_0x5a41('0x2d')](_[_0x5a41('0x39')](_0x54351e[_0x5a41('0x2c')],_0x57992e['filters']));if(_0x54351e[_0x5a41('0x2c')][_0x5a41('0x3d')]){_0xa2d14d['where']=_[_0x5a41('0x3a')](_0xa2d14d['where'],{'$or':_[_0x5a41('0x28')](_0xa2d14d[_0x5a41('0x30')],function(_0x42fe3f){var _0x10a2e0={};_0x10a2e0[_0x42fe3f]={'$like':'%'+_0x54351e[_0x5a41('0x2c')][_0x5a41('0x3d')]+'%'};return _0x10a2e0;})});}_0xa2d14d=_['merge']({},_0xa2d14d,_0x54351e[_0x5a41('0x45')]);return _0x33046f[_0x5a41('0x49')](_0xa2d14d);}})['then'](function(_0x1bf061){if(_0x1bf061){_0x7c794b=_0x1bf061['length'];if(!_0x54351e[_0x5a41('0x2c')][_0x5a41('0x33')](_0x5a41('0x34'))){_0xa2d14d[_0x5a41('0x35')]=qs[_0x5a41('0x35')](_0x54351e[_0x5a41('0x2c')]['limit']);_0xa2d14d[_0x5a41('0x1b')]=qs['offset'](_0x54351e[_0x5a41('0x2c')][_0x5a41('0x1b')]);}return _0x33046f[_0x5a41('0x49')](_0xa2d14d);}})[_0x5a41('0x23')](function(_0xae9550){if(_0xae9550){return _0xae9550?{'count':_0x7c794b,'rows':_0xae9550}:null;}})[_0x5a41('0x23')](respondWithResult(_0x57df66,null))['catch'](handleError(_0x57df66,null));};exports[_0x5a41('0x4d')]=function(_0x19e1e4,_0x47be2e,_0x5842e3){if(_0x19e1e4[_0x5a41('0x47')]['id']){delete _0x19e1e4[_0x5a41('0x47')]['id'];}return db['FreshsalesAccount'][_0x5a41('0x4a')]({'where':{'id':_0x19e1e4['params']['id']}})[_0x5a41('0x23')](handleEntityNotFound(_0x47be2e,null))['then'](function(_0x155316){if(_0x155316){_0x19e1e4[_0x5a41('0x47')]['AccountId']=_0x155316['id'];_0x19e1e4[_0x5a41('0x47')]['Subjects']=integrations['getSubjects'](_0x19e1e4['body'][_0x5a41('0x4e')],_0x19e1e4[_0x5a41('0x47')][_0x5a41('0x3b')]);_0x19e1e4[_0x5a41('0x47')][_0x5a41('0x4f')]=integrations[_0x5a41('0x50')](_0x19e1e4[_0x5a41('0x47')][_0x5a41('0x4e')],_0x19e1e4[_0x5a41('0x47')][_0x5a41('0x3b')]);return db[_0x5a41('0x4b')][_0x5a41('0x46')](_0x19e1e4[_0x5a41('0x47')],{'include':[{'model':db['FreshsalesField'],'as':_0x5a41('0x51')},{'model':db['FreshsalesField'],'as':_0x5a41('0x4f')}]});}return null;})[_0x5a41('0x23')](respondWithResult(_0x47be2e,null))[_0x5a41('0x42')](handleError(_0x47be2e,null));};exports[_0x5a41('0x52')]=function(_0x3d2b73,_0x2f15ab,_0x1c00ce){var _0x4536b0='';var _0x357645='';return db['FreshsalesAccount'][_0x5a41('0x4a')]({'where':{'id':_0x3d2b73[_0x5a41('0x44')]['id']},'attributes':['id',_0x5a41('0x53'),'remoteUri',_0x5a41('0x54')]})[_0x5a41('0x23')](handleEntityNotFound(_0x2f15ab,null))['then'](function(_0xdb1c1){if(_0xdb1c1){_0x357645=_0xdb1c1[_0x5a41('0x53')];_0x4536b0=_0xdb1c1[_0x5a41('0x55')];var _0x45eef8=_0xdb1c1[_0x5a41('0x55')][_0x5a41('0x56')](-0x1);if(_0x45eef8==='/'){_0x4536b0=_0x4536b0['substring'](0x0,_0x4536b0[_0x5a41('0x57')](_0x45eef8));}return rp({'method':'GET','uri':util['format']('%s%s',_0x4536b0,_0x5a41('0x58')),'headers':{'Authorization':_0x5a41('0x59')+_0xdb1c1['apiKey']},'json':!![]});}})['then'](function(_0x46c563){if(_0x46c563){var _0xb456df=_0x46c563['users'];var _0x3d79d0=![];var _0x34dd9d=null;for(_0x34dd9d=0x0;_0x34dd9d<_0xb456df[_0x5a41('0x32')];_0x34dd9d++){if(_0xb456df[_0x34dd9d][_0x5a41('0x5a')]===_0x357645){_0x3d79d0=!![];}}if(_0x3d79d0){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x5a41('0x23')](respondWithResult(_0x2f15ab,null))[_0x5a41('0x42')](function(_0x5ded4a){var _0x4b35a0=_0x3d2b73[_0x5a41('0x2c')][_0x5a41('0x5b')]?0x1f4:_0x5ded4a[_0x5a41('0x5c')]||0x1f4;logger[_0x5a41('0x5d')]('getFields,\x20%s,\x20%s,\x20%s',_0x5a41('0x52'),_0x4b35a0,JSON[_0x5a41('0x5e')](_0x5ded4a));delete _0x5ded4a[_0x5a41('0x25')];if(_0x4b35a0===0x191){_0x4b35a0=0x190;}_0x2f15ab[_0x5a41('0x19')](_0x4b35a0)[_0x5a41('0x26')](_0x3d2b73[_0x5a41('0x2c')][_0x5a41('0x5b')]?{'message':_0x5a41('0x5f'),'statusCode':_0x5ded4a[_0x5a41('0x5c')]}:_0x5ded4a);});}; \ No newline at end of file +var _0x09e7=['query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','Subjects','channel','Descriptions','getDescriptions','create','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','Requested\x20Resource\x20not\x20Found','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','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','count','limit','set','apply','reject','save','then','destroy','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09e7,0x99));var _0x709e=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0x09e7[_0x5a7e3c];return _0x59252b;};'use strict';var emlformat=require(_0x709e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x709e('0x1'));var moment=require(_0x709e('0x2'));var BPromise=require(_0x709e('0x3'));var Mustache=require(_0x709e('0x4'));var util=require(_0x709e('0x5'));var path=require(_0x709e('0x6'));var sox=require(_0x709e('0x7'));var csv=require('to-csv');var ejs=require(_0x709e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x709e('0x9'));var squel=require(_0x709e('0xa'));var crypto=require(_0x709e('0xb'));var jsforce=require(_0x709e('0xc'));var deskjs=require(_0x709e('0xd'));var toCsv=require(_0x709e('0xe'));var querystring=require(_0x709e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x709e('0x10'));var qs=require(_0x709e('0x11'));var as=require(_0x709e('0x12'));var hardwareService=require(_0x709e('0x13'));var logger=require(_0x709e('0x14'))(_0x709e('0x15'));var utils=require(_0x709e('0x16'));var config=require(_0x709e('0x17'));var licenseUtil=require(_0x709e('0x18'));var db=require(_0x709e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5fa310,_0x4f4e01){_0x4f4e01=_0x4f4e01||0xcc;return function(_0x526335){if(_0x526335){return _0x5fa310[_0x709e('0x1a')](_0x4f4e01);}return _0x5fa310[_0x709e('0x1b')](_0x4f4e01)[_0x709e('0x1c')]();};}function respondWithResult(_0x42ee0e,_0x52c3ea){_0x52c3ea=_0x52c3ea||0xc8;return function(_0x118e8c){if(_0x118e8c){return _0x42ee0e[_0x709e('0x1b')](_0x52c3ea)[_0x709e('0x1d')](_0x118e8c);}};}function respondWithFilteredResult(_0x3dd37d,_0x2eaeb4){return function(_0x4d3246){if(_0x4d3246){var _0x2e1d8b=typeof _0x2eaeb4[_0x709e('0x1e')]==='undefined'&&typeof _0x2eaeb4['limit']==='undefined';var _0x1d3d91=_0x4d3246[_0x709e('0x1f')];var _0x581ec8=_0x2e1d8b?0x0:_0x2eaeb4[_0x709e('0x1e')];var _0x290654=_0x2e1d8b?_0x4d3246['count']:_0x2eaeb4[_0x709e('0x1e')]+_0x2eaeb4[_0x709e('0x20')];var _0x39615c;if(_0x290654>=_0x1d3d91){_0x290654=_0x1d3d91;_0x39615c=0xc8;}else{_0x39615c=0xce;}_0x3dd37d[_0x709e('0x1b')](_0x39615c);return _0x3dd37d[_0x709e('0x21')]('Content-Range',_0x581ec8+'-'+_0x290654+'/'+_0x1d3d91)[_0x709e('0x1d')](_0x4d3246);}return null;};}function patchUpdates(_0x528240){return function(_0xcb9aec){try{jsonpatch[_0x709e('0x22')](_0xcb9aec,_0x528240,!![]);}catch(_0x5f3455){return BPromise[_0x709e('0x23')](_0x5f3455);}return _0xcb9aec[_0x709e('0x24')]();};}function saveUpdates(_0x527b56,_0xb234ac){return function(_0x10e8f3){if(_0x10e8f3){return _0x10e8f3['update'](_0x527b56)[_0x709e('0x25')](function(_0x1b0f6f){return _0x1b0f6f;});}return null;};}function removeEntity(_0x1231be,_0x436154){return function(_0x11bb37){if(_0x11bb37){return _0x11bb37[_0x709e('0x26')]()[_0x709e('0x25')](function(){_0x1231be['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x354fa9,_0x4c0c4e){return function(_0x5b2629){if(!_0x5b2629){_0x354fa9[_0x709e('0x1a')](0x194);}return _0x5b2629;};}function handleError(_0x5f3c48,_0x4f1ec8){_0x4f1ec8=_0x4f1ec8||0x1f4;return function(_0x5980db){logger['error'](_0x5980db[_0x709e('0x27')]);if(_0x5980db[_0x709e('0x28')]){delete _0x5980db[_0x709e('0x28')];}_0x5f3c48['status'](_0x4f1ec8)[_0x709e('0x29')](_0x5980db);};}exports['index']=function(_0x5a2dfa,_0x4bb025){var _0x3be123={},_0x3c1a19={},_0xdcdee3={'count':0x0,'rows':[]};var _0x3d16df=_[_0x709e('0x2a')](db[_0x709e('0x2b')][_0x709e('0x2c')],function(_0x43b15f){return{'name':_0x43b15f[_0x709e('0x2d')],'type':_0x43b15f[_0x709e('0x2e')][_0x709e('0x2f')]};});_0x3c1a19[_0x709e('0x30')]=_[_0x709e('0x2a')](_0x3d16df,'name');_0x3c1a19[_0x709e('0x31')]=_['keys'](_0x5a2dfa[_0x709e('0x31')]);_0x3c1a19[_0x709e('0x32')]=_[_0x709e('0x33')](_0x3c1a19[_0x709e('0x30')],_0x3c1a19[_0x709e('0x31')]);_0x3be123['attributes']=_[_0x709e('0x33')](_0x3c1a19[_0x709e('0x30')],qs['fields'](_0x5a2dfa[_0x709e('0x31')][_0x709e('0x34')]));_0x3be123[_0x709e('0x35')]=_0x3be123[_0x709e('0x35')]['length']?_0x3be123[_0x709e('0x35')]:_0x3c1a19['model'];if(!_0x5a2dfa['query'][_0x709e('0x36')](_0x709e('0x37'))){_0x3be123[_0x709e('0x20')]=qs[_0x709e('0x20')](_0x5a2dfa['query'][_0x709e('0x20')]);_0x3be123[_0x709e('0x1e')]=qs[_0x709e('0x1e')](_0x5a2dfa[_0x709e('0x31')][_0x709e('0x1e')]);}_0x3be123[_0x709e('0x38')]=qs[_0x709e('0x39')](_0x5a2dfa[_0x709e('0x31')][_0x709e('0x39')]);_0x3be123[_0x709e('0x3a')]=qs[_0x709e('0x32')](_['pick'](_0x5a2dfa[_0x709e('0x31')],_0x3c1a19[_0x709e('0x32')]),_0x3d16df);if(_0x5a2dfa[_0x709e('0x31')][_0x709e('0x3b')]){_0x3be123[_0x709e('0x3a')]=_[_0x709e('0x3c')](_0x3be123[_0x709e('0x3a')],{'$or':_[_0x709e('0x2a')](_0x3d16df,function(_0x488933){if(_0x488933[_0x709e('0x2e')]!==_0x709e('0x3d')){var _0x378056={};_0x378056[_0x488933[_0x709e('0x28')]]={'$like':'%'+_0x5a2dfa[_0x709e('0x31')]['filter']+'%'};return _0x378056;}})});}_0x3be123=_['merge']({},_0x3be123,_0x5a2dfa[_0x709e('0x3e')]);var _0x45049f={'where':_0x3be123[_0x709e('0x3a')]};return db['FreshsalesAccount']['count'](_0x45049f)[_0x709e('0x25')](function(_0x39237d){_0xdcdee3[_0x709e('0x1f')]=_0x39237d;if(_0x5a2dfa[_0x709e('0x31')][_0x709e('0x3f')]){_0x3be123[_0x709e('0x40')]=[{'all':!![]}];}return db[_0x709e('0x2b')][_0x709e('0x41')](_0x3be123);})[_0x709e('0x25')](function(_0x1f302a){_0xdcdee3[_0x709e('0x42')]=_0x1f302a;return _0xdcdee3;})[_0x709e('0x25')](respondWithFilteredResult(_0x4bb025,_0x3be123))[_0x709e('0x43')](handleError(_0x4bb025,null));};exports[_0x709e('0x44')]=function(_0x1cd241,_0xb0956e){var _0x19920d={'raw':![],'where':{'id':_0x1cd241[_0x709e('0x45')]['id']}},_0x4fa9cf={};_0x4fa9cf[_0x709e('0x30')]=_[_0x709e('0x46')](db[_0x709e('0x2b')][_0x709e('0x2c')]);_0x4fa9cf[_0x709e('0x31')]=_[_0x709e('0x46')](_0x1cd241[_0x709e('0x31')]);_0x4fa9cf[_0x709e('0x32')]=_[_0x709e('0x33')](_0x4fa9cf[_0x709e('0x30')],_0x4fa9cf[_0x709e('0x31')]);_0x19920d[_0x709e('0x35')]=_[_0x709e('0x33')](_0x4fa9cf[_0x709e('0x30')],qs['fields'](_0x1cd241['query']['fields']));_0x19920d[_0x709e('0x35')]=_0x19920d[_0x709e('0x35')][_0x709e('0x47')]?_0x19920d['attributes']:_0x4fa9cf[_0x709e('0x30')];if(_0x1cd241['query'][_0x709e('0x3f')]){_0x19920d[_0x709e('0x40')]=[{'all':!![]}];}_0x19920d=_[_0x709e('0x3c')]({},_0x19920d,_0x1cd241[_0x709e('0x3e')]);return db[_0x709e('0x2b')][_0x709e('0x48')](_0x19920d)['then'](handleEntityNotFound(_0xb0956e,null))[_0x709e('0x25')](respondWithResult(_0xb0956e,null))[_0x709e('0x43')](handleError(_0xb0956e,null));};exports['create']=function(_0x589014,_0x501714){return db['FreshsalesAccount']['create'](_0x589014[_0x709e('0x49')],{})['then'](respondWithResult(_0x501714,0xc9))[_0x709e('0x43')](handleError(_0x501714,null));};exports['update']=function(_0x3ea2cc,_0x2f0486){if(_0x3ea2cc[_0x709e('0x49')]['id']){delete _0x3ea2cc['body']['id'];}return db[_0x709e('0x2b')][_0x709e('0x48')]({'where':{'id':_0x3ea2cc['params']['id']}})['then'](handleEntityNotFound(_0x2f0486,null))[_0x709e('0x25')](saveUpdates(_0x3ea2cc[_0x709e('0x49')],null))[_0x709e('0x25')](respondWithResult(_0x2f0486,null))[_0x709e('0x43')](handleError(_0x2f0486,null));};exports[_0x709e('0x26')]=function(_0x30cbb4,_0x5ce28a){return db[_0x709e('0x2b')][_0x709e('0x48')]({'where':{'id':_0x30cbb4['params']['id']}})['then'](handleEntityNotFound(_0x5ce28a,null))[_0x709e('0x25')](removeEntity(_0x5ce28a,null))[_0x709e('0x43')](handleError(_0x5ce28a,null));};exports[_0x709e('0x4a')]=function(_0x3a63d7,_0x8b651f,_0x38e216){var _0x2e2fee={};var _0x1fe3a5={};var _0xb380ee;var _0x40f2e3;return db[_0x709e('0x2b')][_0x709e('0x4b')]({'where':{'id':_0x3a63d7['params']['id']}})['then'](handleEntityNotFound(_0x8b651f,null))[_0x709e('0x25')](function(_0x371686){if(_0x371686){_0xb380ee=_0x371686;_0x1fe3a5[_0x709e('0x30')]=_[_0x709e('0x46')](db[_0x709e('0x4c')][_0x709e('0x2c')]);_0x1fe3a5[_0x709e('0x31')]=_[_0x709e('0x46')](_0x3a63d7[_0x709e('0x31')]);_0x1fe3a5[_0x709e('0x32')]=_[_0x709e('0x33')](_0x1fe3a5[_0x709e('0x30')],_0x1fe3a5['query']);_0x2e2fee[_0x709e('0x35')]=_['intersection'](_0x1fe3a5['model'],qs[_0x709e('0x34')](_0x3a63d7[_0x709e('0x31')][_0x709e('0x34')]));_0x2e2fee[_0x709e('0x35')]=_0x2e2fee[_0x709e('0x35')][_0x709e('0x47')]?_0x2e2fee[_0x709e('0x35')]:_0x1fe3a5[_0x709e('0x30')];_0x2e2fee[_0x709e('0x38')]=qs['sort'](_0x3a63d7[_0x709e('0x31')][_0x709e('0x39')]);_0x2e2fee['where']=qs[_0x709e('0x32')](_['pick'](_0x3a63d7[_0x709e('0x31')],_0x1fe3a5[_0x709e('0x32')]));if(_0x3a63d7[_0x709e('0x31')][_0x709e('0x3b')]){_0x2e2fee[_0x709e('0x3a')]=_['merge'](_0x2e2fee[_0x709e('0x3a')],{'$or':_['map'](_0x2e2fee[_0x709e('0x35')],function(_0x482a33){var _0x2331db={};_0x2331db[_0x482a33]={'$like':'%'+_0x3a63d7[_0x709e('0x31')][_0x709e('0x3b')]+'%'};return _0x2331db;})});}_0x2e2fee=_[_0x709e('0x3c')]({},_0x2e2fee,_0x3a63d7['options']);return _0xb380ee['getConfigurations'](_0x2e2fee);}})[_0x709e('0x25')](function(_0xf4d2ce){if(_0xf4d2ce){_0x40f2e3=_0xf4d2ce[_0x709e('0x47')];if(!_0x3a63d7[_0x709e('0x31')][_0x709e('0x36')]('nolimit')){_0x2e2fee['limit']=qs[_0x709e('0x20')](_0x3a63d7['query'][_0x709e('0x20')]);_0x2e2fee[_0x709e('0x1e')]=qs[_0x709e('0x1e')](_0x3a63d7[_0x709e('0x31')][_0x709e('0x1e')]);}return _0xb380ee[_0x709e('0x4a')](_0x2e2fee);}})[_0x709e('0x25')](function(_0x40dd9c){if(_0x40dd9c){return _0x40dd9c?{'count':_0x40f2e3,'rows':_0x40dd9c}:null;}})[_0x709e('0x25')](respondWithResult(_0x8b651f,null))[_0x709e('0x43')](handleError(_0x8b651f,null));};exports[_0x709e('0x4d')]=function(_0x13bad6,_0x35cce0,_0x1da7ec){if(_0x13bad6[_0x709e('0x49')]['id']){delete _0x13bad6[_0x709e('0x49')]['id'];}return db['FreshsalesAccount'][_0x709e('0x4b')]({'where':{'id':_0x13bad6[_0x709e('0x45')]['id']}})[_0x709e('0x25')](handleEntityNotFound(_0x35cce0,null))[_0x709e('0x25')](function(_0x1c5824){if(_0x1c5824){_0x13bad6[_0x709e('0x49')]['AccountId']=_0x1c5824['id'];_0x13bad6['body'][_0x709e('0x4e')]=integrations['getSubjects'](_0x13bad6['body'][_0x709e('0x4f')],_0x13bad6['body'][_0x709e('0x2e')]);_0x13bad6[_0x709e('0x49')][_0x709e('0x50')]=integrations[_0x709e('0x51')](_0x13bad6[_0x709e('0x49')][_0x709e('0x4f')],_0x13bad6[_0x709e('0x49')][_0x709e('0x2e')]);return db[_0x709e('0x4c')][_0x709e('0x52')](_0x13bad6[_0x709e('0x49')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x709e('0x25')](respondWithResult(_0x35cce0,null))[_0x709e('0x43')](handleError(_0x35cce0,null));};exports['getFields']=function(_0x575e45,_0x3e3c4c,_0x22d473){var _0x36e0e3='';var _0xf9979b='';return db[_0x709e('0x2b')]['findOne']({'where':{'id':_0x575e45[_0x709e('0x45')]['id']},'attributes':['id','username',_0x709e('0x53'),'apiKey']})[_0x709e('0x25')](handleEntityNotFound(_0x3e3c4c,null))[_0x709e('0x25')](function(_0x10704e){if(_0x10704e){_0xf9979b=_0x10704e['username'];_0x36e0e3=_0x10704e[_0x709e('0x53')];var _0x1a395b=_0x10704e[_0x709e('0x53')][_0x709e('0x54')](-0x1);if(_0x1a395b==='/'){_0x36e0e3=_0x36e0e3[_0x709e('0x55')](0x0,_0x36e0e3[_0x709e('0x56')](_0x1a395b));}return rp({'method':_0x709e('0x57'),'uri':util[_0x709e('0x58')](_0x709e('0x59'),_0x36e0e3,_0x709e('0x5a')),'headers':{'Authorization':_0x709e('0x5b')+_0x10704e[_0x709e('0x5c')]},'json':!![]});}})['then'](function(_0x4fb93d){if(_0x4fb93d){var _0x2cf142=_0x4fb93d['users'];var _0x5ab4b1=![];var _0x3eec7c=null;for(_0x3eec7c=0x0;_0x3eec7c<_0x2cf142[_0x709e('0x47')];_0x3eec7c++){if(_0x2cf142[_0x3eec7c]['email']===_0xf9979b){_0x5ab4b1=!![];}}if(_0x5ab4b1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x709e('0x5d')});}}})[_0x709e('0x25')](respondWithResult(_0x3e3c4c,null))[_0x709e('0x43')](function(_0x56c96c){var _0x54c99e=_0x575e45[_0x709e('0x31')]['test']?0x1f4:_0x56c96c['statusCode']||0x1f4;logger[_0x709e('0x5e')](_0x709e('0x5f'),_0x709e('0x60'),_0x54c99e,JSON[_0x709e('0x61')](_0x56c96c));delete _0x56c96c[_0x709e('0x28')];if(_0x54c99e===0x191){_0x54c99e=0x190;}_0x3e3c4c[_0x709e('0x1b')](_0x54c99e)[_0x709e('0x29')](_0x575e45[_0x709e('0x31')][_0x709e('0x62')]?{'message':_0x709e('0x63'),'statusCode':_0x56c96c[_0x709e('0x64')]}:_0x56c96c);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index d6d8c68..f8889a5 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 _0x47c5=['rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x295ff8,_0x1c1d53){var _0x503316=function(_0x4373e6){while(--_0x4373e6){_0x295ff8['push'](_0x295ff8['shift']());}};_0x503316(++_0x1c1d53);}(_0x47c5,0x165));var _0x547c=function(_0x39d908,_0x47677b){_0x39d908=_0x39d908-0x0;var _0x4376c4=_0x47c5[_0x39d908];return _0x4376c4;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var logger=require(_0x547c('0x2'))(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x547c('0x6'));var rimraf=require(_0x547c('0x7'));var config=require('../../config/environment');var attributes=require(_0x547c('0x8'));var integrations=require(_0x547c('0x9'));module['exports']=function(_0x2e5b57,_0x439f25){return _0x2e5b57[_0x547c('0xa')](_0x547c('0xb'),attributes,{'tableName':_0x547c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb11=['lodash','../../config/logger','api','bluebird','path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x12aa4c,_0x2cbe20){var _0x16a9b2=function(_0x15b7a4){while(--_0x15b7a4){_0x12aa4c['push'](_0x12aa4c['shift']());}};_0x16a9b2(++_0x2cbe20);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xfb11[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x1fb1('0x7')]=function(_0x133727,_0x4c098d){return _0x133727[_0x1fb1('0x8')](_0x1fb1('0x9'),attributes,{'tableName':_0x1fb1('0xa'),'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 a34f124..9dcdc96 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 _0x8aad=['stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','then','ShowFreshsalesAccount','find','raw','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0x8aad,0x146));var _0xd8aa=function(_0x39ea39,_0x1f7566){_0x39ea39=_0x39ea39-0x0;var _0x58eaf3=_0x8aad[_0x39ea39];return _0x58eaf3;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});}exports[_0xd8aa('0x14')]=function(_0x32e2cd){var _0x3a29ca=this;return new Promise(function(_0x2d34ac,_0x4953be){return db[_0xd8aa('0x15')][_0xd8aa('0x16')]({'raw':_0x32e2cd[_0xd8aa('0x17')]?_0x32e2cd[_0xd8aa('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x32e2cd[_0xd8aa('0x17')]?_0x32e2cd[_0xd8aa('0x17')][_0xd8aa('0x18')]||null:null,'attributes':_0x32e2cd[_0xd8aa('0x17')]?_0x32e2cd[_0xd8aa('0x17')]['attributes']||null:null,'limit':_0x32e2cd[_0xd8aa('0x17')]?_0x32e2cd[_0xd8aa('0x17')][_0xd8aa('0x19')]||null:null,'include':_0x32e2cd['options']?_0x32e2cd[_0xd8aa('0x17')][_0xd8aa('0x1a')]?_[_0xd8aa('0x1b')](_0x32e2cd[_0xd8aa('0x17')][_0xd8aa('0x1a')],function(_0x16758a){return{'model':db[_0x16758a[_0xd8aa('0x1c')]],'as':_0x16758a['as'],'attributes':_0x16758a[_0xd8aa('0x1d')],'include':_0x16758a[_0xd8aa('0x1a')]?_[_0xd8aa('0x1b')](_0x16758a[_0xd8aa('0x1a')],function(_0x370d6f){return{'model':db[_0x370d6f[_0xd8aa('0x1c')]],'as':_0x370d6f['as'],'attributes':_0x370d6f['attributes'],'include':_0x370d6f[_0xd8aa('0x1a')]?_[_0xd8aa('0x1b')](_0x370d6f[_0xd8aa('0x1a')],function(_0x1f6ab2){return{'model':db[_0x1f6ab2[_0xd8aa('0x1c')]],'as':_0x1f6ab2['as'],'attributes':_0x1f6ab2[_0xd8aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd8aa('0x1e')](function(_0x19edee){logger[_0xd8aa('0x9')](_0xd8aa('0x14'),_0x32e2cd);logger['debug'](_0xd8aa('0x14'),_0x32e2cd,JSON[_0xd8aa('0xe')](_0x19edee));_0x2d34ac(_0x19edee);})[_0xd8aa('0x13')](function(_0x49a7c8){logger[_0xd8aa('0xf')]('GetFreshsalesAccount',_0x49a7c8[_0xd8aa('0x11')],_0x32e2cd);_0x4953be(_0x3a29ca[_0xd8aa('0xf')](0x1f4,_0x49a7c8[_0xd8aa('0x11')]));});});};exports[_0xd8aa('0x1f')]=function(_0x44f783){var _0x28f3cc=this;return new Promise(function(_0xd8d3b3,_0x3cbe8d){return db['FreshsalesAccount'][_0xd8aa('0x20')]({'raw':_0x44f783[_0xd8aa('0x17')]?_0x44f783[_0xd8aa('0x17')][_0xd8aa('0x21')]===undefined?!![]:![]:!![],'where':_0x44f783[_0xd8aa('0x17')]?_0x44f783[_0xd8aa('0x17')][_0xd8aa('0x18')]||null:null,'attributes':_0x44f783[_0xd8aa('0x17')]?_0x44f783['options'][_0xd8aa('0x1d')]||null:null,'include':_0x44f783[_0xd8aa('0x17')]?_0x44f783[_0xd8aa('0x17')]['include']?_[_0xd8aa('0x1b')](_0x44f783[_0xd8aa('0x17')][_0xd8aa('0x1a')],function(_0x45c216){return{'model':db[_0x45c216[_0xd8aa('0x1c')]],'as':_0x45c216['as'],'attributes':_0x45c216[_0xd8aa('0x1d')],'include':_0x45c216[_0xd8aa('0x1a')]?_[_0xd8aa('0x1b')](_0x45c216[_0xd8aa('0x1a')],function(_0x47a3b2){return{'model':db[_0x47a3b2[_0xd8aa('0x1c')]],'as':_0x47a3b2['as'],'attributes':_0x47a3b2[_0xd8aa('0x1d')],'include':_0x47a3b2[_0xd8aa('0x1a')]?_[_0xd8aa('0x1b')](_0x47a3b2[_0xd8aa('0x1a')],function(_0x1b1469){return{'model':db[_0x1b1469[_0xd8aa('0x1c')]],'as':_0x1b1469['as'],'attributes':_0x1b1469[_0xd8aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd8aa('0x1e')](function(_0x5983f6){logger[_0xd8aa('0x9')]('ShowFreshsalesAccount',_0x44f783);logger[_0xd8aa('0xc')](_0xd8aa('0x1f'),_0x44f783,JSON['stringify'](_0x5983f6));_0xd8d3b3(_0x5983f6);})[_0xd8aa('0x13')](function(_0x1a4f2c){logger[_0xd8aa('0xf')](_0xd8aa('0x1f'),_0x1a4f2c[_0xd8aa('0x11')],_0x44f783);_0x3cbe8d(_0x28f3cc['error'](0x1f4,_0x1a4f2c['message']));});});}; \ No newline at end of file +var _0xa46e=['model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','info','result','catch','FreshsalesAccount','findAll','options','raw','include','map'];(function(_0x7ac73b,_0x4aedcf){var _0x16a21b=function(_0x15ded0){while(--_0x15ded0){_0x7ac73b['push'](_0x7ac73b['shift']());}};_0x16a21b(++_0x4aedcf);}(_0xa46e,0x8a));var _0xea46=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa46e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['GetFreshsalesAccount']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')]({'raw':_0x19d5c1['options']?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'where':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')]['where']||null:null,'attributes':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options']['attributes']||null:null,'limit':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options']['limit']||null:null,'include':_0x19d5c1['options']?_0x19d5c1[_0xea46('0x17')][_0xea46('0x19')]?_[_0xea46('0x1a')](_0x19d5c1['options'][_0xea46('0x19')],function(_0x59b10d){return{'model':db[_0x59b10d[_0xea46('0x1b')]],'as':_0x59b10d['as'],'attributes':_0x59b10d[_0xea46('0x1c')],'include':_0x59b10d['include']?_[_0xea46('0x1a')](_0x59b10d['include'],function(_0x2b3a8f){return{'model':db[_0x2b3a8f[_0xea46('0x1b')]],'as':_0x2b3a8f['as'],'attributes':_0x2b3a8f[_0xea46('0x1c')],'include':_0x2b3a8f['include']?_['map'](_0x2b3a8f[_0xea46('0x19')],function(_0x38ac07){return{'model':db[_0x38ac07['model']],'as':_0x38ac07['as'],'attributes':_0x38ac07[_0xea46('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11129d){logger['info'](_0xea46('0x1d'),_0x19d5c1);logger[_0xea46('0xc')](_0xea46('0x1d'),_0x19d5c1,JSON[_0xea46('0xd')](_0x11129d));_0x5cf5dd(_0x11129d);})[_0xea46('0x14')](function(_0x174345){logger['error'](_0xea46('0x1d'),_0x174345[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d[_0xea46('0xe')](0x1f4,_0x174345['message']));});});};exports[_0xea46('0x1e')]=function(_0x3cdf96){var _0x38d631=this;return new Promise(function(_0x5a0fc0,_0x4a0635){return db['FreshsalesAccount'][_0xea46('0x1f')]({'raw':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'where':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x20')]||null:null,'attributes':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x1c')]||null:null,'include':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96['options'][_0xea46('0x19')]?_[_0xea46('0x1a')](_0x3cdf96[_0xea46('0x17')][_0xea46('0x19')],function(_0x1472c0){return{'model':db[_0x1472c0[_0xea46('0x1b')]],'as':_0x1472c0['as'],'attributes':_0x1472c0[_0xea46('0x1c')],'include':_0x1472c0['include']?_[_0xea46('0x1a')](_0x1472c0[_0xea46('0x19')],function(_0x388449){return{'model':db[_0x388449[_0xea46('0x1b')]],'as':_0x388449['as'],'attributes':_0x388449[_0xea46('0x1c')],'include':_0x388449['include']?_['map'](_0x388449[_0xea46('0x19')],function(_0x343499){return{'model':db[_0x343499['model']],'as':_0x343499['as'],'attributes':_0x343499[_0xea46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xea46('0xa')](function(_0x123aae){logger[_0xea46('0x12')]('ShowFreshsalesAccount',_0x3cdf96);logger['debug'](_0xea46('0x1e'),_0x3cdf96,JSON['stringify'](_0x123aae));_0x5a0fc0(_0x123aae);})[_0xea46('0x14')](function(_0xdec374){logger['error'](_0xea46('0x1e'),_0xdec374[_0xea46('0x10')],_0x3cdf96);_0x4a0635(_0x38d631['error'](0x1f4,_0xdec374[_0xea46('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a59748a..c5dc65c 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 _0x3ecf=['show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','create','delete','/:id','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x3ecf,0x1af));var _0xf3ec=function(_0x51a193,_0x52d496){_0x51a193=_0x51a193-0x0;var _0x3012cc=_0x3ecf[_0x51a193];return _0x3012cc;};'use strict';var multer=require('multer');var util=require(_0xf3ec('0x0'));var path=require('path');var timeout=require(_0xf3ec('0x1'));var express=require(_0xf3ec('0x2'));var router=express['Router']();var fs_extra=require(_0xf3ec('0x3'));var auth=require(_0xf3ec('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf3ec('0x5'));router[_0xf3ec('0x6')]('/',auth[_0xf3ec('0x7')](),controller[_0xf3ec('0x8')]);router[_0xf3ec('0x6')]('/:id',auth[_0xf3ec('0x7')](),controller[_0xf3ec('0x9')]);router[_0xf3ec('0x6')](_0xf3ec('0xa'),auth[_0xf3ec('0x7')](),controller[_0xf3ec('0xb')]);router[_0xf3ec('0x6')](_0xf3ec('0xc'),auth[_0xf3ec('0x7')](),controller[_0xf3ec('0xd')]);router[_0xf3ec('0x6')](_0xf3ec('0xe'),auth[_0xf3ec('0x7')](),controller['getFields']);router['post']('/',auth[_0xf3ec('0x7')](),controller[_0xf3ec('0xf')]);router['put']('/:id',auth[_0xf3ec('0x7')](),controller['update']);router[_0xf3ec('0x10')](_0xf3ec('0x11'),auth[_0xf3ec('0x7')](),controller[_0xf3ec('0x12')]);module[_0xf3ec('0x13')]=router; \ No newline at end of file +var _0xfacc=['/:id/fields','getFields','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0xfacc,0x104));var _0xcfac=function(_0x4de364,_0x6b4ba){_0x4de364=_0x4de364-0x0;var _0x385173=_0xfacc[_0x4de364];return _0x385173;};'use strict';var multer=require(_0xcfac('0x0'));var util=require(_0xcfac('0x1'));var path=require(_0xcfac('0x2'));var timeout=require('connect-timeout');var express=require(_0xcfac('0x3'));var router=express[_0xcfac('0x4')]();var fs_extra=require(_0xcfac('0x5'));var auth=require(_0xcfac('0x6'));var interaction=require(_0xcfac('0x7'));var config=require(_0xcfac('0x8'));var controller=require(_0xcfac('0x9'));router[_0xcfac('0xa')]('/',auth[_0xcfac('0xb')](),controller['index']);router[_0xcfac('0xa')](_0xcfac('0xc'),auth[_0xcfac('0xb')](),controller[_0xcfac('0xd')]);router[_0xcfac('0xa')](_0xcfac('0xe'),auth[_0xcfac('0xb')](),controller[_0xcfac('0xf')]);router[_0xcfac('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0xcfac('0x10'),auth[_0xcfac('0xb')](),controller[_0xcfac('0x11')]);router[_0xcfac('0x12')]('/',auth['isAuthenticated'](),controller[_0xcfac('0x13')]);router['put'](_0xcfac('0xc'),auth[_0xcfac('0xb')](),controller[_0xcfac('0x14')]);router[_0xcfac('0x15')](_0xcfac('0xc'),auth[_0xcfac('0xb')](),controller['destroy']);module[_0xcfac('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c80d712..3da000d 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 _0x30b3=['sequelize','exports'];(function(_0x129046,_0x519448){var _0x4d06d9=function(_0x425c26){while(--_0x425c26){_0x129046['push'](_0x129046['shift']());}};_0x4d06d9(++_0x519448);}(_0x30b3,0xfa));var _0x330b=function(_0x341c44,_0x2e1057){_0x341c44=_0x341c44-0x0;var _0x2bda72=_0x30b3[_0x341c44];return _0x2bda72;};'use strict';var Sequelize=require(_0x330b('0x0'));module[_0x330b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7bbe=['STRING','sequelize','exports'];(function(_0x12c0ea,_0x2ed696){var _0x276352=function(_0x18e053){while(--_0x18e053){_0x12c0ea['push'](_0x12c0ea['shift']());}};_0x276352(++_0x2ed696);}(_0x7bbe,0x184));var _0xe7bb=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x7bbe[_0x2e913b];return _0x173899;};'use strict';var Sequelize=require(_0xe7bb('0x0'));module[_0xe7bb('0x1')]={'name':{'type':Sequelize[_0xe7bb('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0c99f4c..eebe278 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 _0xf9fa=['Content-Range','reject','save','update','then','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','order','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','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','end','status','json','offset','undefined','count'];(function(_0x4c667c,_0x26e15d){var _0x19a2df=function(_0xd3d6c2){while(--_0xd3d6c2){_0x4c667c['push'](_0x4c667c['shift']());}};_0x19a2df(++_0x26e15d);}(_0xf9fa,0x1b5));var _0xaf9f=function(_0x58f98a,_0x5b3b27){_0x58f98a=_0x58f98a-0x0;var _0x4ffe9e=_0xf9fa[_0x58f98a];return _0x4ffe9e;};'use strict';var emlformat=require(_0xaf9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf9f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf9f('0x2'));var moment=require(_0xaf9f('0x3'));var BPromise=require(_0xaf9f('0x4'));var Mustache=require('mustache');var util=require(_0xaf9f('0x5'));var path=require('path');var sox=require(_0xaf9f('0x6'));var csv=require(_0xaf9f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf9f('0x8'));var _=require('lodash');var squel=require(_0xaf9f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf9f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xaf9f('0xb'));var Papa=require(_0xaf9f('0xc'));var Redis=require(_0xaf9f('0xd'));var authService=require(_0xaf9f('0xe'));var qs=require(_0xaf9f('0xf'));var as=require(_0xaf9f('0x10'));var hardwareService=require(_0xaf9f('0x11'));var logger=require(_0xaf9f('0x12'))(_0xaf9f('0x13'));var utils=require(_0xaf9f('0x14'));var config=require(_0xaf9f('0x15'));var licenseUtil=require(_0xaf9f('0x16'));var db=require(_0xaf9f('0x17'))['db'];function respondWithStatusCode(_0xbedbf4,_0x585eba){_0x585eba=_0x585eba||0xcc;return function(_0x53a7fa){if(_0x53a7fa){return _0xbedbf4[_0xaf9f('0x18')](_0x585eba);}return _0xbedbf4['status'](_0x585eba)[_0xaf9f('0x19')]();};}function respondWithResult(_0x32aad6,_0x59ee62){_0x59ee62=_0x59ee62||0xc8;return function(_0x264c8e){if(_0x264c8e){return _0x32aad6[_0xaf9f('0x1a')](_0x59ee62)[_0xaf9f('0x1b')](_0x264c8e);}};}function respondWithFilteredResult(_0x48fcc3,_0x32b174){return function(_0x4cc7ff){if(_0x4cc7ff){var _0x4be595=typeof _0x32b174[_0xaf9f('0x1c')]===_0xaf9f('0x1d')&&typeof _0x32b174['limit']===_0xaf9f('0x1d');var _0x137929=_0x4cc7ff[_0xaf9f('0x1e')];var _0x2e95ae=_0x4be595?0x0:_0x32b174[_0xaf9f('0x1c')];var _0x14eaca=_0x4be595?_0x4cc7ff['count']:_0x32b174[_0xaf9f('0x1c')]+_0x32b174['limit'];var _0xb60ffa;if(_0x14eaca>=_0x137929){_0x14eaca=_0x137929;_0xb60ffa=0xc8;}else{_0xb60ffa=0xce;}_0x48fcc3[_0xaf9f('0x1a')](_0xb60ffa);return _0x48fcc3['set'](_0xaf9f('0x1f'),_0x2e95ae+'-'+_0x14eaca+'/'+_0x137929)[_0xaf9f('0x1b')](_0x4cc7ff);}return null;};}function patchUpdates(_0x50ac3e){return function(_0xaab6b4){try{jsonpatch['apply'](_0xaab6b4,_0x50ac3e,!![]);}catch(_0x3c64c0){return BPromise[_0xaf9f('0x20')](_0x3c64c0);}return _0xaab6b4[_0xaf9f('0x21')]();};}function saveUpdates(_0x5218f9,_0x31b903){return function(_0x5eba44){if(_0x5eba44){return _0x5eba44[_0xaf9f('0x22')](_0x5218f9)[_0xaf9f('0x23')](function(_0x1d886b){return _0x1d886b;});}return null;};}function removeEntity(_0x27cdf4,_0x3c0e07){return function(_0x47d7f8){if(_0x47d7f8){return _0x47d7f8['destroy']()[_0xaf9f('0x23')](function(){_0x27cdf4[_0xaf9f('0x1a')](0xcc)[_0xaf9f('0x19')]();});}};}function handleEntityNotFound(_0x711c08,_0x21f607){return function(_0x1220a4){if(!_0x1220a4){_0x711c08[_0xaf9f('0x18')](0x194);}return _0x1220a4;};}function handleError(_0xee08cc,_0x204bb3){_0x204bb3=_0x204bb3||0x1f4;return function(_0x50606c){logger['error'](_0x50606c[_0xaf9f('0x24')]);if(_0x50606c['name']){delete _0x50606c[_0xaf9f('0x25')];}_0xee08cc[_0xaf9f('0x1a')](_0x204bb3)[_0xaf9f('0x26')](_0x50606c);};}exports[_0xaf9f('0x27')]=function(_0x1c2bce,_0x505da0){var _0x11551d={},_0x166a6f={},_0x340cac={'count':0x0,'rows':[]};var _0x52df07=_[_0xaf9f('0x28')](db[_0xaf9f('0x29')][_0xaf9f('0x2a')],function(_0x10adef){return{'name':_0x10adef[_0xaf9f('0x2b')],'type':_0x10adef[_0xaf9f('0x2c')][_0xaf9f('0x2d')]};});_0x166a6f['model']=_[_0xaf9f('0x28')](_0x52df07,'name');_0x166a6f[_0xaf9f('0x2e')]=_[_0xaf9f('0x2f')](_0x1c2bce[_0xaf9f('0x2e')]);_0x166a6f['filters']=_[_0xaf9f('0x30')](_0x166a6f['model'],_0x166a6f[_0xaf9f('0x2e')]);_0x11551d[_0xaf9f('0x31')]=_[_0xaf9f('0x30')](_0x166a6f[_0xaf9f('0x32')],qs[_0xaf9f('0x33')](_0x1c2bce[_0xaf9f('0x2e')][_0xaf9f('0x33')]));_0x11551d[_0xaf9f('0x31')]=_0x11551d[_0xaf9f('0x31')][_0xaf9f('0x34')]?_0x11551d[_0xaf9f('0x31')]:_0x166a6f[_0xaf9f('0x32')];if(!_0x1c2bce[_0xaf9f('0x2e')][_0xaf9f('0x35')](_0xaf9f('0x36'))){_0x11551d[_0xaf9f('0x37')]=qs['limit'](_0x1c2bce[_0xaf9f('0x2e')][_0xaf9f('0x37')]);_0x11551d[_0xaf9f('0x1c')]=qs[_0xaf9f('0x1c')](_0x1c2bce[_0xaf9f('0x2e')][_0xaf9f('0x1c')]);}_0x11551d['order']=qs[_0xaf9f('0x38')](_0x1c2bce[_0xaf9f('0x2e')][_0xaf9f('0x38')]);_0x11551d[_0xaf9f('0x39')]=qs[_0xaf9f('0x3a')](_[_0xaf9f('0x3b')](_0x1c2bce['query'],_0x166a6f[_0xaf9f('0x3a')]),_0x52df07);if(_0x1c2bce[_0xaf9f('0x2e')][_0xaf9f('0x3c')]){_0x11551d[_0xaf9f('0x39')]=_[_0xaf9f('0x3d')](_0x11551d[_0xaf9f('0x39')],{'$or':_[_0xaf9f('0x28')](_0x52df07,function(_0x23f712){if(_0x23f712[_0xaf9f('0x2c')]!=='VIRTUAL'){var _0x20d7ef={};_0x20d7ef[_0x23f712[_0xaf9f('0x25')]]={'$like':'%'+_0x1c2bce['query'][_0xaf9f('0x3c')]+'%'};return _0x20d7ef;}})});}_0x11551d=_[_0xaf9f('0x3d')]({},_0x11551d,_0x1c2bce[_0xaf9f('0x3e')]);var _0x35e8af={'where':_0x11551d['where']};return db[_0xaf9f('0x29')][_0xaf9f('0x1e')](_0x35e8af)['then'](function(_0x39e2f5){_0x340cac[_0xaf9f('0x1e')]=_0x39e2f5;if(_0x1c2bce['query'][_0xaf9f('0x3f')]){_0x11551d[_0xaf9f('0x40')]=[{'all':!![]}];}return db[_0xaf9f('0x29')][_0xaf9f('0x41')](_0x11551d);})[_0xaf9f('0x23')](function(_0x34ec78){_0x340cac['rows']=_0x34ec78;return _0x340cac;})[_0xaf9f('0x23')](respondWithFilteredResult(_0x505da0,_0x11551d))[_0xaf9f('0x42')](handleError(_0x505da0,null));};exports[_0xaf9f('0x43')]=function(_0x18ca2a,_0xed733f){var _0x95b56e={'raw':![],'where':{'id':_0x18ca2a[_0xaf9f('0x44')]['id']}},_0x455539={};_0x455539[_0xaf9f('0x32')]=_[_0xaf9f('0x2f')](db[_0xaf9f('0x29')][_0xaf9f('0x2a')]);_0x455539['query']=_[_0xaf9f('0x2f')](_0x18ca2a['query']);_0x455539[_0xaf9f('0x3a')]=_[_0xaf9f('0x30')](_0x455539[_0xaf9f('0x32')],_0x455539['query']);_0x95b56e['attributes']=_[_0xaf9f('0x30')](_0x455539[_0xaf9f('0x32')],qs[_0xaf9f('0x33')](_0x18ca2a[_0xaf9f('0x2e')][_0xaf9f('0x33')]));_0x95b56e['attributes']=_0x95b56e[_0xaf9f('0x31')][_0xaf9f('0x34')]?_0x95b56e['attributes']:_0x455539[_0xaf9f('0x32')];if(_0x18ca2a[_0xaf9f('0x2e')][_0xaf9f('0x3f')]){_0x95b56e['include']=[{'all':!![]}];}_0x95b56e=_[_0xaf9f('0x3d')]({},_0x95b56e,_0x18ca2a[_0xaf9f('0x3e')]);return db[_0xaf9f('0x29')]['find'](_0x95b56e)[_0xaf9f('0x23')](handleEntityNotFound(_0xed733f,null))['then'](respondWithResult(_0xed733f,null))['catch'](handleError(_0xed733f,null));};exports[_0xaf9f('0x45')]=function(_0x397d73,_0x3f4520){return db[_0xaf9f('0x29')]['create'](_0x397d73[_0xaf9f('0x46')],{})[_0xaf9f('0x23')](respondWithResult(_0x3f4520,0xc9))[_0xaf9f('0x42')](handleError(_0x3f4520,null));};exports[_0xaf9f('0x22')]=function(_0x2bdacc,_0x311936){if(_0x2bdacc['body']['id']){delete _0x2bdacc[_0xaf9f('0x46')]['id'];}return db[_0xaf9f('0x29')][_0xaf9f('0x47')]({'where':{'id':_0x2bdacc[_0xaf9f('0x44')]['id']}})[_0xaf9f('0x23')](handleEntityNotFound(_0x311936,null))['then'](saveUpdates(_0x2bdacc[_0xaf9f('0x46')],null))[_0xaf9f('0x23')](respondWithResult(_0x311936,null))[_0xaf9f('0x42')](handleError(_0x311936,null));};exports['destroy']=function(_0xc83f69,_0x3fef70){return db[_0xaf9f('0x29')]['find']({'where':{'id':_0xc83f69[_0xaf9f('0x44')]['id']}})[_0xaf9f('0x23')](handleEntityNotFound(_0x3fef70,null))['then'](removeEntity(_0x3fef70,null))[_0xaf9f('0x42')](handleError(_0x3fef70,null));};exports[_0xaf9f('0x48')]=function(_0x5a8aa0,_0x1e6d16,_0x281cd8){var _0x37b4a8={};var _0x2c4104={};var _0x3869e6;var _0x352bfb;return db[_0xaf9f('0x29')]['findOne']({'where':{'id':_0x5a8aa0['params']['id']}})[_0xaf9f('0x23')](handleEntityNotFound(_0x1e6d16,null))['then'](function(_0x3988ef){if(_0x3988ef){_0x3869e6=_0x3988ef;_0x2c4104[_0xaf9f('0x32')]=_[_0xaf9f('0x2f')](db[_0xaf9f('0x49')]['rawAttributes']);_0x2c4104[_0xaf9f('0x2e')]=_[_0xaf9f('0x2f')](_0x5a8aa0[_0xaf9f('0x2e')]);_0x2c4104[_0xaf9f('0x3a')]=_[_0xaf9f('0x30')](_0x2c4104[_0xaf9f('0x32')],_0x2c4104[_0xaf9f('0x2e')]);_0x37b4a8[_0xaf9f('0x31')]=_['intersection'](_0x2c4104['model'],qs[_0xaf9f('0x33')](_0x5a8aa0['query'][_0xaf9f('0x33')]));_0x37b4a8[_0xaf9f('0x31')]=_0x37b4a8[_0xaf9f('0x31')][_0xaf9f('0x34')]?_0x37b4a8[_0xaf9f('0x31')]:_0x2c4104['model'];_0x37b4a8['order']=qs[_0xaf9f('0x38')](_0x5a8aa0['query'][_0xaf9f('0x38')]);_0x37b4a8[_0xaf9f('0x39')]=qs['filters'](_[_0xaf9f('0x3b')](_0x5a8aa0[_0xaf9f('0x2e')],_0x2c4104[_0xaf9f('0x3a')]));if(_0x5a8aa0[_0xaf9f('0x2e')][_0xaf9f('0x3c')]){_0x37b4a8['where']=_['merge'](_0x37b4a8[_0xaf9f('0x39')],{'$or':_[_0xaf9f('0x28')](_0x37b4a8[_0xaf9f('0x31')],function(_0x1f9e39){var _0x410ed4={};_0x410ed4[_0x1f9e39]={'$like':'%'+_0x5a8aa0[_0xaf9f('0x2e')][_0xaf9f('0x3c')]+'%'};return _0x410ed4;})});}_0x37b4a8=_[_0xaf9f('0x3d')]({},_0x37b4a8,_0x5a8aa0['options']);return _0x3869e6[_0xaf9f('0x48')](_0x37b4a8);}})[_0xaf9f('0x23')](function(_0x59d3e5){if(_0x59d3e5){_0x352bfb=_0x59d3e5[_0xaf9f('0x34')];if(!_0x5a8aa0[_0xaf9f('0x2e')][_0xaf9f('0x35')](_0xaf9f('0x36'))){_0x37b4a8[_0xaf9f('0x37')]=qs[_0xaf9f('0x37')](_0x5a8aa0['query'][_0xaf9f('0x37')]);_0x37b4a8[_0xaf9f('0x1c')]=qs[_0xaf9f('0x1c')](_0x5a8aa0[_0xaf9f('0x2e')][_0xaf9f('0x1c')]);}return _0x3869e6['getSubjects'](_0x37b4a8);}})[_0xaf9f('0x23')](function(_0x1d2f12){if(_0x1d2f12){return _0x1d2f12?{'count':_0x352bfb,'rows':_0x1d2f12}:null;}})[_0xaf9f('0x23')](respondWithResult(_0x1e6d16,null))[_0xaf9f('0x42')](handleError(_0x1e6d16,null));};exports[_0xaf9f('0x4a')]=function(_0x5cff54,_0x59c1ec,_0x2f2dfa){var _0x329cc2={};var _0x110864={};var _0x4dd31f;var _0xc17a80;return db[_0xaf9f('0x29')][_0xaf9f('0x4b')]({'where':{'id':_0x5cff54['params']['id']}})[_0xaf9f('0x23')](handleEntityNotFound(_0x59c1ec,null))[_0xaf9f('0x23')](function(_0x21d12a){if(_0x21d12a){_0x4dd31f=_0x21d12a;_0x110864['model']=_[_0xaf9f('0x2f')](db[_0xaf9f('0x49')][_0xaf9f('0x2a')]);_0x110864[_0xaf9f('0x2e')]=_['keys'](_0x5cff54['query']);_0x110864[_0xaf9f('0x3a')]=_[_0xaf9f('0x30')](_0x110864['model'],_0x110864[_0xaf9f('0x2e')]);_0x329cc2[_0xaf9f('0x31')]=_[_0xaf9f('0x30')](_0x110864[_0xaf9f('0x32')],qs['fields'](_0x5cff54[_0xaf9f('0x2e')]['fields']));_0x329cc2[_0xaf9f('0x31')]=_0x329cc2[_0xaf9f('0x31')][_0xaf9f('0x34')]?_0x329cc2[_0xaf9f('0x31')]:_0x110864[_0xaf9f('0x32')];_0x329cc2['order']=qs[_0xaf9f('0x38')](_0x5cff54[_0xaf9f('0x2e')]['sort']);_0x329cc2[_0xaf9f('0x39')]=qs[_0xaf9f('0x3a')](_['pick'](_0x5cff54['query'],_0x110864[_0xaf9f('0x3a')]));if(_0x5cff54[_0xaf9f('0x2e')][_0xaf9f('0x3c')]){_0x329cc2[_0xaf9f('0x39')]=_['merge'](_0x329cc2['where'],{'$or':_[_0xaf9f('0x28')](_0x329cc2[_0xaf9f('0x31')],function(_0xecced1){var _0x53a64b={};_0x53a64b[_0xecced1]={'$like':'%'+_0x5cff54[_0xaf9f('0x2e')]['filter']+'%'};return _0x53a64b;})});}_0x329cc2=_[_0xaf9f('0x3d')]({},_0x329cc2,_0x5cff54[_0xaf9f('0x3e')]);return _0x4dd31f[_0xaf9f('0x4a')](_0x329cc2);}})[_0xaf9f('0x23')](function(_0x5aa7be){if(_0x5aa7be){_0xc17a80=_0x5aa7be[_0xaf9f('0x34')];if(!_0x5cff54[_0xaf9f('0x2e')]['hasOwnProperty'](_0xaf9f('0x36'))){_0x329cc2[_0xaf9f('0x37')]=qs[_0xaf9f('0x37')](_0x5cff54[_0xaf9f('0x2e')][_0xaf9f('0x37')]);_0x329cc2[_0xaf9f('0x1c')]=qs['offset'](_0x5cff54[_0xaf9f('0x2e')]['offset']);}return _0x4dd31f[_0xaf9f('0x4a')](_0x329cc2);}})['then'](function(_0x20ae57){if(_0x20ae57){return _0x20ae57?{'count':_0xc17a80,'rows':_0x20ae57}:null;}})[_0xaf9f('0x23')](respondWithResult(_0x59c1ec,null))[_0xaf9f('0x42')](handleError(_0x59c1ec,null));};exports[_0xaf9f('0x4c')]=function(_0x2b2e7d,_0x2765f3,_0x5608fc){var _0x23fda2={};var _0x151c09={};var _0x16fdc1;var _0x4d0fed;return db[_0xaf9f('0x29')][_0xaf9f('0x4b')]({'where':{'id':_0x2b2e7d['params']['id']}})[_0xaf9f('0x23')](handleEntityNotFound(_0x2765f3,null))[_0xaf9f('0x23')](function(_0x4a7abf){if(_0x4a7abf){_0x16fdc1=_0x4a7abf;_0x151c09[_0xaf9f('0x32')]=_[_0xaf9f('0x2f')](db[_0xaf9f('0x49')][_0xaf9f('0x2a')]);_0x151c09[_0xaf9f('0x2e')]=_['keys'](_0x2b2e7d[_0xaf9f('0x2e')]);_0x151c09[_0xaf9f('0x3a')]=_['intersection'](_0x151c09[_0xaf9f('0x32')],_0x151c09['query']);_0x23fda2[_0xaf9f('0x31')]=_[_0xaf9f('0x30')](_0x151c09['model'],qs[_0xaf9f('0x33')](_0x2b2e7d[_0xaf9f('0x2e')][_0xaf9f('0x33')]));_0x23fda2['attributes']=_0x23fda2[_0xaf9f('0x31')][_0xaf9f('0x34')]?_0x23fda2[_0xaf9f('0x31')]:_0x151c09['model'];_0x23fda2[_0xaf9f('0x4d')]=qs['sort'](_0x2b2e7d[_0xaf9f('0x2e')][_0xaf9f('0x38')]);_0x23fda2[_0xaf9f('0x39')]=qs[_0xaf9f('0x3a')](_[_0xaf9f('0x3b')](_0x2b2e7d[_0xaf9f('0x2e')],_0x151c09[_0xaf9f('0x3a')]));if(_0x2b2e7d[_0xaf9f('0x2e')][_0xaf9f('0x3c')]){_0x23fda2[_0xaf9f('0x39')]=_[_0xaf9f('0x3d')](_0x23fda2['where'],{'$or':_[_0xaf9f('0x28')](_0x23fda2[_0xaf9f('0x31')],function(_0x1c8948){var _0x292abf={};_0x292abf[_0x1c8948]={'$like':'%'+_0x2b2e7d[_0xaf9f('0x2e')]['filter']+'%'};return _0x292abf;})});}_0x23fda2=_[_0xaf9f('0x3d')]({},_0x23fda2,_0x2b2e7d[_0xaf9f('0x3e')]);return _0x16fdc1[_0xaf9f('0x4c')](_0x23fda2);}})[_0xaf9f('0x23')](function(_0x28a715){if(_0x28a715){_0x4d0fed=_0x28a715[_0xaf9f('0x34')];if(!_0x2b2e7d[_0xaf9f('0x2e')]['hasOwnProperty']('nolimit')){_0x23fda2['limit']=qs[_0xaf9f('0x37')](_0x2b2e7d[_0xaf9f('0x2e')]['limit']);_0x23fda2[_0xaf9f('0x1c')]=qs[_0xaf9f('0x1c')](_0x2b2e7d[_0xaf9f('0x2e')][_0xaf9f('0x1c')]);}return _0x16fdc1[_0xaf9f('0x4c')](_0x23fda2);}})[_0xaf9f('0x23')](function(_0x3567e6){if(_0x3567e6){return _0x3567e6?{'count':_0x4d0fed,'rows':_0x3567e6}:null;}})[_0xaf9f('0x23')](respondWithResult(_0x2765f3,null))[_0xaf9f('0x42')](handleError(_0x2765f3,null));}; \ No newline at end of file +var _0x9a9c=['filter','merge','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','getSubjects','FreshsalesField','getDescriptions','getFields','findOne','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','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','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL'];(function(_0x3d9a06,_0x501593){var _0x2f23c6=function(_0x2c6499){while(--_0x2c6499){_0x3d9a06['push'](_0x3d9a06['shift']());}};_0x2f23c6(++_0x501593);}(_0x9a9c,0x15f));var _0xc9a9=function(_0x7531ff,_0x15f80d){_0x7531ff=_0x7531ff-0x0;var _0x43e3d9=_0x9a9c[_0x7531ff];return _0x43e3d9;};'use strict';var emlformat=require(_0xc9a9('0x0'));var rimraf=require(_0xc9a9('0x1'));var zipdir=require(_0xc9a9('0x2'));var jsonpatch=require(_0xc9a9('0x3'));var rp=require(_0xc9a9('0x4'));var moment=require(_0xc9a9('0x5'));var BPromise=require(_0xc9a9('0x6'));var Mustache=require(_0xc9a9('0x7'));var util=require(_0xc9a9('0x8'));var path=require(_0xc9a9('0x9'));var sox=require(_0xc9a9('0xa'));var csv=require(_0xc9a9('0xb'));var ejs=require(_0xc9a9('0xc'));var fs=require('fs');var fs_extra=require(_0xc9a9('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc9a9('0xe'));var jsforce=require(_0xc9a9('0xf'));var deskjs=require(_0xc9a9('0x10'));var toCsv=require(_0xc9a9('0xb'));var querystring=require('querystring');var Papa=require(_0xc9a9('0x11'));var Redis=require(_0xc9a9('0x12'));var authService=require(_0xc9a9('0x13'));var qs=require(_0xc9a9('0x14'));var as=require(_0xc9a9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9a9('0x16'))(_0xc9a9('0x17'));var utils=require(_0xc9a9('0x18'));var config=require(_0xc9a9('0x19'));var licenseUtil=require(_0xc9a9('0x1a'));var db=require(_0xc9a9('0x1b'))['db'];function respondWithStatusCode(_0x3ae908,_0x1ecc3b){_0x1ecc3b=_0x1ecc3b||0xcc;return function(_0x353b90){if(_0x353b90){return _0x3ae908[_0xc9a9('0x1c')](_0x1ecc3b);}return _0x3ae908[_0xc9a9('0x1d')](_0x1ecc3b)['end']();};}function respondWithResult(_0x41bc15,_0x581ba9){_0x581ba9=_0x581ba9||0xc8;return function(_0x17f8fe){if(_0x17f8fe){return _0x41bc15[_0xc9a9('0x1d')](_0x581ba9)[_0xc9a9('0x1e')](_0x17f8fe);}};}function respondWithFilteredResult(_0x2d4e84,_0x4fc285){return function(_0x4a5483){if(_0x4a5483){var _0x1ceb3a=typeof _0x4fc285[_0xc9a9('0x1f')]===_0xc9a9('0x20')&&typeof _0x4fc285[_0xc9a9('0x21')]===_0xc9a9('0x20');var _0x2e7003=_0x4a5483[_0xc9a9('0x22')];var _0x41ee73=_0x1ceb3a?0x0:_0x4fc285[_0xc9a9('0x1f')];var _0x5ef456=_0x1ceb3a?_0x4a5483['count']:_0x4fc285[_0xc9a9('0x1f')]+_0x4fc285['limit'];var _0x302712;if(_0x5ef456>=_0x2e7003){_0x5ef456=_0x2e7003;_0x302712=0xc8;}else{_0x302712=0xce;}_0x2d4e84[_0xc9a9('0x1d')](_0x302712);return _0x2d4e84[_0xc9a9('0x23')](_0xc9a9('0x24'),_0x41ee73+'-'+_0x5ef456+'/'+_0x2e7003)['json'](_0x4a5483);}return null;};}function patchUpdates(_0x314b31){return function(_0x5b7428){try{jsonpatch[_0xc9a9('0x25')](_0x5b7428,_0x314b31,!![]);}catch(_0xd2e171){return BPromise[_0xc9a9('0x26')](_0xd2e171);}return _0x5b7428['save']();};}function saveUpdates(_0x7671e9,_0x544d2d){return function(_0x4c8168){if(_0x4c8168){return _0x4c8168[_0xc9a9('0x27')](_0x7671e9)[_0xc9a9('0x28')](function(_0x208873){return _0x208873;});}return null;};}function removeEntity(_0x14de3e,_0x2b744e){return function(_0x170fe2){if(_0x170fe2){return _0x170fe2['destroy']()[_0xc9a9('0x28')](function(){_0x14de3e[_0xc9a9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3243aa,_0x44d44b){return function(_0x3b1048){if(!_0x3b1048){_0x3243aa[_0xc9a9('0x1c')](0x194);}return _0x3b1048;};}function handleError(_0x5e3825,_0x138928){_0x138928=_0x138928||0x1f4;return function(_0xe7f4d){logger[_0xc9a9('0x29')](_0xe7f4d[_0xc9a9('0x2a')]);if(_0xe7f4d[_0xc9a9('0x2b')]){delete _0xe7f4d['name'];}_0x5e3825[_0xc9a9('0x1d')](_0x138928)[_0xc9a9('0x2c')](_0xe7f4d);};}exports[_0xc9a9('0x2d')]=function(_0x3bfcd5,_0xe53b38){var _0x25d708={},_0xe423d={},_0x19df84={'count':0x0,'rows':[]};var _0x476bae=_[_0xc9a9('0x2e')](db['FreshsalesConfiguration'][_0xc9a9('0x2f')],function(_0x248e00){return{'name':_0x248e00['fieldName'],'type':_0x248e00[_0xc9a9('0x30')]['key']};});_0xe423d['model']=_['map'](_0x476bae,_0xc9a9('0x2b'));_0xe423d[_0xc9a9('0x31')]=_[_0xc9a9('0x32')](_0x3bfcd5[_0xc9a9('0x31')]);_0xe423d[_0xc9a9('0x33')]=_[_0xc9a9('0x34')](_0xe423d['model'],_0xe423d[_0xc9a9('0x31')]);_0x25d708[_0xc9a9('0x35')]=_['intersection'](_0xe423d[_0xc9a9('0x36')],qs[_0xc9a9('0x37')](_0x3bfcd5[_0xc9a9('0x31')]['fields']));_0x25d708['attributes']=_0x25d708['attributes'][_0xc9a9('0x38')]?_0x25d708[_0xc9a9('0x35')]:_0xe423d[_0xc9a9('0x36')];if(!_0x3bfcd5[_0xc9a9('0x31')][_0xc9a9('0x39')](_0xc9a9('0x3a'))){_0x25d708[_0xc9a9('0x21')]=qs[_0xc9a9('0x21')](_0x3bfcd5[_0xc9a9('0x31')][_0xc9a9('0x21')]);_0x25d708['offset']=qs[_0xc9a9('0x1f')](_0x3bfcd5[_0xc9a9('0x31')][_0xc9a9('0x1f')]);}_0x25d708[_0xc9a9('0x3b')]=qs['sort'](_0x3bfcd5[_0xc9a9('0x31')][_0xc9a9('0x3c')]);_0x25d708[_0xc9a9('0x3d')]=qs[_0xc9a9('0x33')](_[_0xc9a9('0x3e')](_0x3bfcd5[_0xc9a9('0x31')],_0xe423d[_0xc9a9('0x33')]),_0x476bae);if(_0x3bfcd5[_0xc9a9('0x31')]['filter']){_0x25d708[_0xc9a9('0x3d')]=_['merge'](_0x25d708[_0xc9a9('0x3d')],{'$or':_[_0xc9a9('0x2e')](_0x476bae,function(_0x345639){if(_0x345639['type']!==_0xc9a9('0x3f')){var _0x2c785f={};_0x2c785f[_0x345639['name']]={'$like':'%'+_0x3bfcd5[_0xc9a9('0x31')][_0xc9a9('0x40')]+'%'};return _0x2c785f;}})});}_0x25d708=_[_0xc9a9('0x41')]({},_0x25d708,_0x3bfcd5['options']);var _0x19d0b4={'where':_0x25d708[_0xc9a9('0x3d')]};return db[_0xc9a9('0x42')][_0xc9a9('0x22')](_0x19d0b4)[_0xc9a9('0x28')](function(_0x3aa052){_0x19df84[_0xc9a9('0x22')]=_0x3aa052;if(_0x3bfcd5[_0xc9a9('0x31')][_0xc9a9('0x43')]){_0x25d708[_0xc9a9('0x44')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xc9a9('0x45')](_0x25d708);})[_0xc9a9('0x28')](function(_0x409964){_0x19df84[_0xc9a9('0x46')]=_0x409964;return _0x19df84;})[_0xc9a9('0x28')](respondWithFilteredResult(_0xe53b38,_0x25d708))[_0xc9a9('0x47')](handleError(_0xe53b38,null));};exports[_0xc9a9('0x48')]=function(_0x18f2a6,_0x3b58dc){var _0x296ff8={'raw':![],'where':{'id':_0x18f2a6[_0xc9a9('0x49')]['id']}},_0x419d60={};_0x419d60[_0xc9a9('0x36')]=_['keys'](db[_0xc9a9('0x42')][_0xc9a9('0x2f')]);_0x419d60[_0xc9a9('0x31')]=_[_0xc9a9('0x32')](_0x18f2a6[_0xc9a9('0x31')]);_0x419d60['filters']=_['intersection'](_0x419d60['model'],_0x419d60[_0xc9a9('0x31')]);_0x296ff8[_0xc9a9('0x35')]=_[_0xc9a9('0x34')](_0x419d60[_0xc9a9('0x36')],qs[_0xc9a9('0x37')](_0x18f2a6[_0xc9a9('0x31')][_0xc9a9('0x37')]));_0x296ff8['attributes']=_0x296ff8[_0xc9a9('0x35')]['length']?_0x296ff8[_0xc9a9('0x35')]:_0x419d60[_0xc9a9('0x36')];if(_0x18f2a6['query'][_0xc9a9('0x43')]){_0x296ff8[_0xc9a9('0x44')]=[{'all':!![]}];}_0x296ff8=_[_0xc9a9('0x41')]({},_0x296ff8,_0x18f2a6[_0xc9a9('0x4a')]);return db[_0xc9a9('0x42')]['find'](_0x296ff8)[_0xc9a9('0x28')](handleEntityNotFound(_0x3b58dc,null))['then'](respondWithResult(_0x3b58dc,null))[_0xc9a9('0x47')](handleError(_0x3b58dc,null));};exports['create']=function(_0x9fcf82,_0x35c9a){return db[_0xc9a9('0x42')][_0xc9a9('0x4b')](_0x9fcf82[_0xc9a9('0x4c')],{})[_0xc9a9('0x28')](respondWithResult(_0x35c9a,0xc9))[_0xc9a9('0x47')](handleError(_0x35c9a,null));};exports[_0xc9a9('0x27')]=function(_0xa8b857,_0x785ee4){if(_0xa8b857[_0xc9a9('0x4c')]['id']){delete _0xa8b857[_0xc9a9('0x4c')]['id'];}return db[_0xc9a9('0x42')][_0xc9a9('0x4d')]({'where':{'id':_0xa8b857[_0xc9a9('0x49')]['id']}})[_0xc9a9('0x28')](handleEntityNotFound(_0x785ee4,null))[_0xc9a9('0x28')](saveUpdates(_0xa8b857[_0xc9a9('0x4c')],null))[_0xc9a9('0x28')](respondWithResult(_0x785ee4,null))[_0xc9a9('0x47')](handleError(_0x785ee4,null));};exports['destroy']=function(_0x1b6b07,_0x14d1de){return db[_0xc9a9('0x42')]['find']({'where':{'id':_0x1b6b07[_0xc9a9('0x49')]['id']}})[_0xc9a9('0x28')](handleEntityNotFound(_0x14d1de,null))[_0xc9a9('0x28')](removeEntity(_0x14d1de,null))['catch'](handleError(_0x14d1de,null));};exports[_0xc9a9('0x4e')]=function(_0x22f148,_0xfb390c,_0xf03cf7){var _0xf7b2b2={};var _0xabf3b7={};var _0x342554;var _0x5f424a;return db[_0xc9a9('0x42')]['findOne']({'where':{'id':_0x22f148[_0xc9a9('0x49')]['id']}})['then'](handleEntityNotFound(_0xfb390c,null))[_0xc9a9('0x28')](function(_0x2b16ef){if(_0x2b16ef){_0x342554=_0x2b16ef;_0xabf3b7['model']=_[_0xc9a9('0x32')](db['FreshsalesField'][_0xc9a9('0x2f')]);_0xabf3b7['query']=_[_0xc9a9('0x32')](_0x22f148['query']);_0xabf3b7['filters']=_[_0xc9a9('0x34')](_0xabf3b7[_0xc9a9('0x36')],_0xabf3b7[_0xc9a9('0x31')]);_0xf7b2b2[_0xc9a9('0x35')]=_[_0xc9a9('0x34')](_0xabf3b7[_0xc9a9('0x36')],qs[_0xc9a9('0x37')](_0x22f148[_0xc9a9('0x31')][_0xc9a9('0x37')]));_0xf7b2b2[_0xc9a9('0x35')]=_0xf7b2b2[_0xc9a9('0x35')]['length']?_0xf7b2b2['attributes']:_0xabf3b7[_0xc9a9('0x36')];_0xf7b2b2[_0xc9a9('0x3b')]=qs['sort'](_0x22f148[_0xc9a9('0x31')][_0xc9a9('0x3c')]);_0xf7b2b2['where']=qs[_0xc9a9('0x33')](_[_0xc9a9('0x3e')](_0x22f148['query'],_0xabf3b7[_0xc9a9('0x33')]));if(_0x22f148[_0xc9a9('0x31')][_0xc9a9('0x40')]){_0xf7b2b2[_0xc9a9('0x3d')]=_[_0xc9a9('0x41')](_0xf7b2b2[_0xc9a9('0x3d')],{'$or':_[_0xc9a9('0x2e')](_0xf7b2b2[_0xc9a9('0x35')],function(_0x360ae2){var _0x134251={};_0x134251[_0x360ae2]={'$like':'%'+_0x22f148['query'][_0xc9a9('0x40')]+'%'};return _0x134251;})});}_0xf7b2b2=_['merge']({},_0xf7b2b2,_0x22f148[_0xc9a9('0x4a')]);return _0x342554['getSubjects'](_0xf7b2b2);}})[_0xc9a9('0x28')](function(_0x2c32f6){if(_0x2c32f6){_0x5f424a=_0x2c32f6[_0xc9a9('0x38')];if(!_0x22f148['query'][_0xc9a9('0x39')]('nolimit')){_0xf7b2b2[_0xc9a9('0x21')]=qs[_0xc9a9('0x21')](_0x22f148[_0xc9a9('0x31')][_0xc9a9('0x21')]);_0xf7b2b2[_0xc9a9('0x1f')]=qs[_0xc9a9('0x1f')](_0x22f148[_0xc9a9('0x31')][_0xc9a9('0x1f')]);}return _0x342554[_0xc9a9('0x4e')](_0xf7b2b2);}})[_0xc9a9('0x28')](function(_0x1f1eb6){if(_0x1f1eb6){return _0x1f1eb6?{'count':_0x5f424a,'rows':_0x1f1eb6}:null;}})[_0xc9a9('0x28')](respondWithResult(_0xfb390c,null))['catch'](handleError(_0xfb390c,null));};exports['getDescriptions']=function(_0x2a2d38,_0x1cfdc8,_0x4209e4){var _0x666e1c={};var _0x2adc81={};var _0x1c025d;var _0x5850d6;return db[_0xc9a9('0x42')]['findOne']({'where':{'id':_0x2a2d38['params']['id']}})[_0xc9a9('0x28')](handleEntityNotFound(_0x1cfdc8,null))[_0xc9a9('0x28')](function(_0x45a5ee){if(_0x45a5ee){_0x1c025d=_0x45a5ee;_0x2adc81[_0xc9a9('0x36')]=_[_0xc9a9('0x32')](db[_0xc9a9('0x4f')]['rawAttributes']);_0x2adc81[_0xc9a9('0x31')]=_[_0xc9a9('0x32')](_0x2a2d38[_0xc9a9('0x31')]);_0x2adc81['filters']=_['intersection'](_0x2adc81[_0xc9a9('0x36')],_0x2adc81['query']);_0x666e1c[_0xc9a9('0x35')]=_[_0xc9a9('0x34')](_0x2adc81['model'],qs['fields'](_0x2a2d38[_0xc9a9('0x31')][_0xc9a9('0x37')]));_0x666e1c[_0xc9a9('0x35')]=_0x666e1c[_0xc9a9('0x35')][_0xc9a9('0x38')]?_0x666e1c[_0xc9a9('0x35')]:_0x2adc81[_0xc9a9('0x36')];_0x666e1c[_0xc9a9('0x3b')]=qs[_0xc9a9('0x3c')](_0x2a2d38[_0xc9a9('0x31')]['sort']);_0x666e1c['where']=qs[_0xc9a9('0x33')](_[_0xc9a9('0x3e')](_0x2a2d38['query'],_0x2adc81[_0xc9a9('0x33')]));if(_0x2a2d38[_0xc9a9('0x31')][_0xc9a9('0x40')]){_0x666e1c[_0xc9a9('0x3d')]=_[_0xc9a9('0x41')](_0x666e1c[_0xc9a9('0x3d')],{'$or':_['map'](_0x666e1c[_0xc9a9('0x35')],function(_0x21f576){var _0x1e0703={};_0x1e0703[_0x21f576]={'$like':'%'+_0x2a2d38[_0xc9a9('0x31')][_0xc9a9('0x40')]+'%'};return _0x1e0703;})});}_0x666e1c=_['merge']({},_0x666e1c,_0x2a2d38[_0xc9a9('0x4a')]);return _0x1c025d[_0xc9a9('0x50')](_0x666e1c);}})[_0xc9a9('0x28')](function(_0x2a7bb3){if(_0x2a7bb3){_0x5850d6=_0x2a7bb3['length'];if(!_0x2a2d38['query'][_0xc9a9('0x39')]('nolimit')){_0x666e1c[_0xc9a9('0x21')]=qs[_0xc9a9('0x21')](_0x2a2d38[_0xc9a9('0x31')]['limit']);_0x666e1c[_0xc9a9('0x1f')]=qs['offset'](_0x2a2d38[_0xc9a9('0x31')][_0xc9a9('0x1f')]);}return _0x1c025d[_0xc9a9('0x50')](_0x666e1c);}})[_0xc9a9('0x28')](function(_0x494ddb){if(_0x494ddb){return _0x494ddb?{'count':_0x5850d6,'rows':_0x494ddb}:null;}})[_0xc9a9('0x28')](respondWithResult(_0x1cfdc8,null))['catch'](handleError(_0x1cfdc8,null));};exports[_0xc9a9('0x51')]=function(_0xd7cdfb,_0x2118c3,_0x248bd2){var _0x232885={};var _0x17ec78={};var _0x424ce5;var _0x1a1857;return db['FreshsalesConfiguration'][_0xc9a9('0x52')]({'where':{'id':_0xd7cdfb[_0xc9a9('0x49')]['id']}})[_0xc9a9('0x28')](handleEntityNotFound(_0x2118c3,null))['then'](function(_0x5b5bbb){if(_0x5b5bbb){_0x424ce5=_0x5b5bbb;_0x17ec78[_0xc9a9('0x36')]=_['keys'](db[_0xc9a9('0x4f')][_0xc9a9('0x2f')]);_0x17ec78['query']=_[_0xc9a9('0x32')](_0xd7cdfb[_0xc9a9('0x31')]);_0x17ec78[_0xc9a9('0x33')]=_[_0xc9a9('0x34')](_0x17ec78[_0xc9a9('0x36')],_0x17ec78['query']);_0x232885[_0xc9a9('0x35')]=_[_0xc9a9('0x34')](_0x17ec78[_0xc9a9('0x36')],qs[_0xc9a9('0x37')](_0xd7cdfb[_0xc9a9('0x31')][_0xc9a9('0x37')]));_0x232885[_0xc9a9('0x35')]=_0x232885[_0xc9a9('0x35')][_0xc9a9('0x38')]?_0x232885[_0xc9a9('0x35')]:_0x17ec78[_0xc9a9('0x36')];_0x232885[_0xc9a9('0x3b')]=qs['sort'](_0xd7cdfb[_0xc9a9('0x31')][_0xc9a9('0x3c')]);_0x232885[_0xc9a9('0x3d')]=qs[_0xc9a9('0x33')](_[_0xc9a9('0x3e')](_0xd7cdfb[_0xc9a9('0x31')],_0x17ec78[_0xc9a9('0x33')]));if(_0xd7cdfb['query'][_0xc9a9('0x40')]){_0x232885[_0xc9a9('0x3d')]=_[_0xc9a9('0x41')](_0x232885[_0xc9a9('0x3d')],{'$or':_['map'](_0x232885[_0xc9a9('0x35')],function(_0x31538c){var _0x2c4ccd={};_0x2c4ccd[_0x31538c]={'$like':'%'+_0xd7cdfb[_0xc9a9('0x31')]['filter']+'%'};return _0x2c4ccd;})});}_0x232885=_[_0xc9a9('0x41')]({},_0x232885,_0xd7cdfb[_0xc9a9('0x4a')]);return _0x424ce5[_0xc9a9('0x51')](_0x232885);}})[_0xc9a9('0x28')](function(_0x4c044f){if(_0x4c044f){_0x1a1857=_0x4c044f[_0xc9a9('0x38')];if(!_0xd7cdfb[_0xc9a9('0x31')][_0xc9a9('0x39')](_0xc9a9('0x3a'))){_0x232885['limit']=qs['limit'](_0xd7cdfb['query'][_0xc9a9('0x21')]);_0x232885[_0xc9a9('0x1f')]=qs['offset'](_0xd7cdfb['query'][_0xc9a9('0x1f')]);}return _0x424ce5[_0xc9a9('0x51')](_0x232885);}})[_0xc9a9('0x28')](function(_0x2cb663){if(_0x2cb663){return _0x2cb663?{'count':_0x1a1857,'rows':_0x2cb663}:null;}})[_0xc9a9('0x28')](respondWithResult(_0x2118c3,null))[_0xc9a9('0x47')](handleError(_0x2118c3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c355ec6..0b642d5 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 _0x382d=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0x382d,0xab));var _0xd382=function(_0x26f8b2,_0x8aa972){_0x26f8b2=_0x26f8b2-0x0;var _0x20f62a=_0x382d[_0x26f8b2];return _0x20f62a;};'use strict';var _=require(_0xd382('0x0'));var util=require(_0xd382('0x1'));var logger=require(_0xd382('0x2'))('api');var moment=require(_0xd382('0x3'));var BPromise=require('bluebird');var rp=require(_0xd382('0x4'));var fs=require('fs');var path=require(_0xd382('0x5'));var rimraf=require(_0xd382('0x6'));var config=require(_0xd382('0x7'));var attributes=require(_0xd382('0x8'));module['exports']=function(_0x34933c,_0x303a74){return _0x34933c[_0xd382('0x9')](_0xd382('0xa'),attributes,{'tableName':_0xd382('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4956=['bluebird','path','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment'];(function(_0x2051e8,_0x1fb61a){var _0x2613fa=function(_0x23b936){while(--_0x23b936){_0x2051e8['push'](_0x2051e8['shift']());}};_0x2613fa(++_0x1fb61a);}(_0x4956,0x132));var _0x6495=function(_0x29c870,_0x3b6839){_0x29c870=_0x29c870-0x0;var _0x47e1f8=_0x4956[_0x29c870];return _0x47e1f8;};'use strict';var _=require(_0x6495('0x0'));var util=require('util');var logger=require(_0x6495('0x1'))(_0x6495('0x2'));var moment=require(_0x6495('0x3'));var BPromise=require(_0x6495('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6495('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6495('0x6'));module['exports']=function(_0x352d3a,_0x2540be){return _0x352d3a[_0x6495('0x7')](_0x6495('0x8'),attributes,{'tableName':_0x6495('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 5195d71..98f78f9 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 _0x5455=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3f648c,_0xf2b583){var _0x21c8dd=function(_0x22060a){while(--_0x22060a){_0x3f648c['push'](_0x3f648c['shift']());}};_0x21c8dd(++_0xf2b583);}(_0x5455,0x197));var _0x5545=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5455[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var moment=require(_0x5545('0x1'));var BPromise=require(_0x5545('0x2'));var rs=require(_0x5545('0x3'));var fs=require('fs');var Redis=require(_0x5545('0x4'));var db=require(_0x5545('0x5'))['db'];var utils=require(_0x5545('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5545('0x7'));var jayson=require(_0x5545('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea57f,_0x5d69d3,_0x5c2476){return new BPromise(function(_0x9cbb0d,_0x36f3b9){return client['request'](_0x2ea57f,_0x5c2476)[_0x5545('0x9')](function(_0xbf37f){logger[_0x5545('0xa')](_0x5545('0xb'),_0x5d69d3,_0x5545('0xc'));logger[_0x5545('0xd')](_0x5545('0xe'),_0x5d69d3,_0x5545('0xc'),JSON[_0x5545('0xf')](_0xbf37f));if(_0xbf37f['error']){if(_0xbf37f['error'][_0x5545('0x10')]===0x1f4){logger[_0x5545('0x11')](_0x5545('0xb'),_0x5d69d3,_0xbf37f[_0x5545('0x11')]['message']);return _0x36f3b9(_0xbf37f[_0x5545('0x11')][_0x5545('0x12')]);}logger['error'](_0x5545('0xb'),_0x5d69d3,_0xbf37f[_0x5545('0x11')][_0x5545('0x12')]);return _0x9cbb0d(_0xbf37f[_0x5545('0x11')]['message']);}else{logger[_0x5545('0xa')](_0x5545('0xb'),_0x5d69d3,_0x5545('0xc'));_0x9cbb0d(_0xbf37f[_0x5545('0x13')][_0x5545('0x12')]);}})[_0x5545('0x14')](function(_0xf9256c){logger[_0x5545('0x11')](_0x5545('0xb'),_0x5d69d3,_0xf9256c);_0x36f3b9(_0xf9256c);});});} \ No newline at end of file +var _0xe073=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0xe073,0x6b));var _0x3e07=function(_0x58b250,_0x210a75){_0x58b250=_0x58b250-0x0;var _0x2ad6d6=_0xe073[_0x58b250];return _0x2ad6d6;};'use strict';var _=require(_0x3e07('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e07('0x1'));var rs=require(_0x3e07('0x2'));var fs=require('fs');var Redis=require(_0x3e07('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3e07('0x4'));var config=require(_0x3e07('0x5'));var jayson=require(_0x3e07('0x6'));var client=jayson[_0x3e07('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cc0c0,_0x926571,_0x5eca7a){return new BPromise(function(_0x4eae88,_0x19f8f8){return client[_0x3e07('0x8')](_0x2cc0c0,_0x5eca7a)[_0x3e07('0x9')](function(_0x2797b0){logger['info'](_0x3e07('0xa'),_0x926571,_0x3e07('0xb'));logger[_0x3e07('0xc')](_0x3e07('0xd'),_0x926571,_0x3e07('0xb'),JSON[_0x3e07('0xe')](_0x2797b0));if(_0x2797b0[_0x3e07('0xf')]){if(_0x2797b0[_0x3e07('0xf')][_0x3e07('0x10')]===0x1f4){logger[_0x3e07('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x926571,_0x2797b0[_0x3e07('0xf')][_0x3e07('0x11')]);return _0x19f8f8(_0x2797b0[_0x3e07('0xf')]['message']);}logger['error'](_0x3e07('0xa'),_0x926571,_0x2797b0['error']['message']);return _0x4eae88(_0x2797b0[_0x3e07('0xf')]['message']);}else{logger['info'](_0x3e07('0xa'),_0x926571,_0x3e07('0xb'));_0x4eae88(_0x2797b0[_0x3e07('0x12')][_0x3e07('0x11')]);}})[_0x3e07('0x13')](function(_0x387d6c){logger[_0x3e07('0xf')](_0x3e07('0xa'),_0x926571,_0x387d6c);_0x19f8f8(_0x387d6c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index cdccd44..cc404ad 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 _0x2504=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','multer','util'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x2504,0xee));var _0x4250=function(_0x1ef7cf,_0x54b978){_0x1ef7cf=_0x1ef7cf-0x0;var _0x1d00bf=_0x2504[_0x1ef7cf];return _0x1d00bf;};'use strict';var multer=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var path=require(_0x4250('0x2'));var timeout=require(_0x4250('0x3'));var express=require(_0x4250('0x4'));var router=express[_0x4250('0x5')]();var fs_extra=require(_0x4250('0x6'));var auth=require(_0x4250('0x7'));var interaction=require(_0x4250('0x8'));var config=require(_0x4250('0x9'));var controller=require(_0x4250('0xa'));router[_0x4250('0xb')]('/',auth['isAuthenticated'](),controller[_0x4250('0xc')]);router['get']('/:id',auth[_0x4250('0xd')](),controller[_0x4250('0xe')]);router[_0x4250('0xf')]('/',auth[_0x4250('0xd')](),controller[_0x4250('0x10')]);router['put'](_0x4250('0x11'),auth['isAuthenticated'](),controller[_0x4250('0x12')]);router[_0x4250('0x13')]('/:id',auth[_0x4250('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x447b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x447b,0xe4));var _0xb447=function(_0x22caa9,_0x15006d){_0x22caa9=_0x22caa9-0x0;var _0x2fdf50=_0x447b[_0x22caa9];return _0x2fdf50;};'use strict';var multer=require(_0xb447('0x0'));var util=require(_0xb447('0x1'));var path=require('path');var timeout=require(_0xb447('0x2'));var express=require(_0xb447('0x3'));var router=express[_0xb447('0x4')]();var fs_extra=require(_0xb447('0x5'));var auth=require(_0xb447('0x6'));var interaction=require(_0xb447('0x7'));var config=require(_0xb447('0x8'));var controller=require(_0xb447('0x9'));router[_0xb447('0xa')]('/',auth[_0xb447('0xb')](),controller['index']);router['get'](_0xb447('0xc'),auth['isAuthenticated'](),controller[_0xb447('0xd')]);router[_0xb447('0xe')]('/',auth[_0xb447('0xb')](),controller[_0xb447('0xf')]);router[_0xb447('0x10')]('/:id',auth[_0xb447('0xb')](),controller[_0xb447('0x11')]);router[_0xb447('0x12')](_0xb447('0xc'),auth['isAuthenticated'](),controller[_0xb447('0x13')]);module[_0xb447('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index d98e857..09e7bbd 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 _0x8595=['variable','picklist','STRING','string','customVariable','BOOLEAN','sequelize','exports'];(function(_0x3f6f5f,_0x5add9d){var _0x264a30=function(_0x1e6e4d){while(--_0x1e6e4d){_0x3f6f5f['push'](_0x3f6f5f['shift']());}};_0x264a30(++_0x5add9d);}(_0x8595,0x10e));var _0x5859=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x8595[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x5859('0x0'));module[_0x5859('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x5859('0x2'),'customVariable','keyValue',_0x5859('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5859('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x5859('0x5'),_0x5859('0x2'),_0x5859('0x6'))},'keyContent':{'type':Sequelize[_0x5859('0x4')]},'idField':{'type':Sequelize[_0x5859('0x4')]},'nameField':{'type':Sequelize[_0x5859('0x4')]},'customField':{'type':Sequelize[_0x5859('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7f96=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x143900,_0x2c96b1){var _0x450a49=function(_0x99551f){while(--_0x99551f){_0x143900['push'](_0x143900['shift']());}};_0x450a49(++_0x2c96b1);}(_0x7f96,0x1cd));var _0x67f9=function(_0x183685,_0x4ef602){_0x183685=_0x183685-0x0;var _0x246602=_0x7f96[_0x183685];return _0x246602;};'use strict';var Sequelize=require(_0x67f9('0x0'));module[_0x67f9('0x1')]={'type':{'type':Sequelize[_0x67f9('0x2')](_0x67f9('0x3'),_0x67f9('0x4'),_0x67f9('0x5'),_0x67f9('0x6'),'picklist'),'defaultValue':_0x67f9('0x3')},'content':{'type':Sequelize[_0x67f9('0x7')]},'key':{'type':Sequelize[_0x67f9('0x7')]},'keyType':{'type':Sequelize[_0x67f9('0x2')](_0x67f9('0x3'),_0x67f9('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x67f9('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x67f9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x67f9('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 5d9112f..125bb90 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 _0x2675=['../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','set','save','update','then','end','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','keys','catch','create','body','find','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0xfd07c0,_0x5253b1){var _0x1cc98e=function(_0x2aa5d5){while(--_0x2aa5d5){_0xfd07c0['push'](_0xfd07c0['shift']());}};_0x1cc98e(++_0x5253b1);}(_0x2675,0x7b));var _0x5267=function(_0x37a428,_0x6f789b){_0x37a428=_0x37a428-0x0;var _0x3eb628=_0x2675[_0x37a428];return _0x3eb628;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5267('0x0'));var zipdir=require(_0x5267('0x1'));var jsonpatch=require(_0x5267('0x2'));var rp=require(_0x5267('0x3'));var moment=require(_0x5267('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x5'));var util=require(_0x5267('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5267('0x7'));var ejs=require(_0x5267('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require(_0x5267('0x7'));var querystring=require('querystring');var Papa=require(_0x5267('0xd'));var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require(_0x5267('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5267('0x12'))('api');var utils=require(_0x5267('0x13'));var config=require(_0x5267('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x468ebd,_0x392e97){_0x392e97=_0x392e97||0xcc;return function(_0x394125){if(_0x394125){return _0x468ebd[_0x5267('0x15')](_0x392e97);}return _0x468ebd['status'](_0x392e97)['end']();};}function respondWithResult(_0x3f3c95,_0x2163b4){_0x2163b4=_0x2163b4||0xc8;return function(_0x31cdf8){if(_0x31cdf8){return _0x3f3c95[_0x5267('0x16')](_0x2163b4)[_0x5267('0x17')](_0x31cdf8);}};}function respondWithFilteredResult(_0x4086d5,_0x2f3b63){return function(_0x84882d){if(_0x84882d){var _0xbcb8ac=typeof _0x2f3b63[_0x5267('0x18')]===_0x5267('0x19')&&typeof _0x2f3b63[_0x5267('0x1a')]===_0x5267('0x19');var _0x2afd32=_0x84882d['count'];var _0x23a772=_0xbcb8ac?0x0:_0x2f3b63[_0x5267('0x18')];var _0xda0143=_0xbcb8ac?_0x84882d['count']:_0x2f3b63['offset']+_0x2f3b63[_0x5267('0x1a')];var _0x71d4df;if(_0xda0143>=_0x2afd32){_0xda0143=_0x2afd32;_0x71d4df=0xc8;}else{_0x71d4df=0xce;}_0x4086d5[_0x5267('0x16')](_0x71d4df);return _0x4086d5[_0x5267('0x1b')]('Content-Range',_0x23a772+'-'+_0xda0143+'/'+_0x2afd32)['json'](_0x84882d);}return null;};}function patchUpdates(_0x340983){return function(_0x1a9594){try{jsonpatch['apply'](_0x1a9594,_0x340983,!![]);}catch(_0x17ba26){return BPromise['reject'](_0x17ba26);}return _0x1a9594[_0x5267('0x1c')]();};}function saveUpdates(_0x576f56,_0xbe6d5a){return function(_0x1de0f7){if(_0x1de0f7){return _0x1de0f7[_0x5267('0x1d')](_0x576f56)[_0x5267('0x1e')](function(_0x44d73b){return _0x44d73b;});}return null;};}function removeEntity(_0x26fa78,_0xfa7fcd){return function(_0x46ac34){if(_0x46ac34){return _0x46ac34['destroy']()[_0x5267('0x1e')](function(){_0x26fa78[_0x5267('0x16')](0xcc)[_0x5267('0x1f')]();});}};}function handleEntityNotFound(_0x2054db,_0x508cee){return function(_0x5d3048){if(!_0x5d3048){_0x2054db[_0x5267('0x15')](0x194);}return _0x5d3048;};}function handleError(_0x2b6c3a,_0x737e42){_0x737e42=_0x737e42||0x1f4;return function(_0x4b2ee9){logger[_0x5267('0x20')](_0x4b2ee9[_0x5267('0x21')]);if(_0x4b2ee9[_0x5267('0x22')]){delete _0x4b2ee9[_0x5267('0x22')];}_0x2b6c3a[_0x5267('0x16')](_0x737e42)[_0x5267('0x23')](_0x4b2ee9);};}exports[_0x5267('0x24')]=function(_0x401219,_0x3ea752){var _0x1e1189={},_0x6c9cd5={},_0x804807={'count':0x0,'rows':[]};var _0x50b6be=_['map'](db[_0x5267('0x25')][_0x5267('0x26')],function(_0x29d411){return{'name':_0x29d411[_0x5267('0x27')],'type':_0x29d411[_0x5267('0x28')]['key']};});_0x6c9cd5['model']=_['map'](_0x50b6be,_0x5267('0x22'));_0x6c9cd5['query']=_['keys'](_0x401219[_0x5267('0x29')]);_0x6c9cd5[_0x5267('0x2a')]=_[_0x5267('0x2b')](_0x6c9cd5['model'],_0x6c9cd5[_0x5267('0x29')]);_0x1e1189[_0x5267('0x2c')]=_['intersection'](_0x6c9cd5[_0x5267('0x2d')],qs[_0x5267('0x2e')](_0x401219['query'][_0x5267('0x2e')]));_0x1e1189['attributes']=_0x1e1189[_0x5267('0x2c')][_0x5267('0x2f')]?_0x1e1189[_0x5267('0x2c')]:_0x6c9cd5[_0x5267('0x2d')];if(!_0x401219[_0x5267('0x29')][_0x5267('0x30')](_0x5267('0x31'))){_0x1e1189[_0x5267('0x1a')]=qs['limit'](_0x401219[_0x5267('0x29')]['limit']);_0x1e1189[_0x5267('0x18')]=qs['offset'](_0x401219['query'][_0x5267('0x18')]);}_0x1e1189[_0x5267('0x32')]=qs[_0x5267('0x33')](_0x401219[_0x5267('0x29')]['sort']);_0x1e1189[_0x5267('0x34')]=qs['filters'](_[_0x5267('0x35')](_0x401219[_0x5267('0x29')],_0x6c9cd5[_0x5267('0x2a')]),_0x50b6be);if(_0x401219[_0x5267('0x29')]['filter']){_0x1e1189[_0x5267('0x34')]=_[_0x5267('0x36')](_0x1e1189[_0x5267('0x34')],{'$or':_[_0x5267('0x37')](_0x50b6be,function(_0x1f5cbb){if(_0x1f5cbb[_0x5267('0x28')]!==_0x5267('0x38')){var _0x3bfc28={};_0x3bfc28[_0x1f5cbb[_0x5267('0x22')]]={'$like':'%'+_0x401219[_0x5267('0x29')][_0x5267('0x39')]+'%'};return _0x3bfc28;}})});}_0x1e1189=_[_0x5267('0x36')]({},_0x1e1189,_0x401219[_0x5267('0x3a')]);var _0x7d88d3={'where':_0x1e1189[_0x5267('0x34')]};return db[_0x5267('0x25')]['count'](_0x7d88d3)[_0x5267('0x1e')](function(_0x4a91c9){_0x804807[_0x5267('0x3b')]=_0x4a91c9;if(_0x401219['query'][_0x5267('0x3c')]){_0x1e1189[_0x5267('0x3d')]=[{'all':!![]}];}return db[_0x5267('0x25')][_0x5267('0x3e')](_0x1e1189);})[_0x5267('0x1e')](function(_0x5a7ce2){_0x804807[_0x5267('0x3f')]=_0x5a7ce2;return _0x804807;})[_0x5267('0x1e')](respondWithFilteredResult(_0x3ea752,_0x1e1189))['catch'](handleError(_0x3ea752,null));};exports['show']=function(_0x5738f4,_0xd9f8e4){var _0x292b92={'raw':!![],'where':{'id':_0x5738f4['params']['id']}},_0x2f654f={};_0x2f654f[_0x5267('0x2d')]=_[_0x5267('0x40')](db['FreshsalesField'][_0x5267('0x26')]);_0x2f654f[_0x5267('0x29')]=_[_0x5267('0x40')](_0x5738f4[_0x5267('0x29')]);_0x2f654f[_0x5267('0x2a')]=_[_0x5267('0x2b')](_0x2f654f[_0x5267('0x2d')],_0x2f654f[_0x5267('0x29')]);_0x292b92[_0x5267('0x2c')]=_[_0x5267('0x2b')](_0x2f654f[_0x5267('0x2d')],qs[_0x5267('0x2e')](_0x5738f4['query'][_0x5267('0x2e')]));_0x292b92[_0x5267('0x2c')]=_0x292b92[_0x5267('0x2c')]['length']?_0x292b92[_0x5267('0x2c')]:_0x2f654f[_0x5267('0x2d')];if(_0x5738f4['query'][_0x5267('0x3c')]){_0x292b92[_0x5267('0x3d')]=[{'all':!![]}];}_0x292b92=_[_0x5267('0x36')]({},_0x292b92,_0x5738f4[_0x5267('0x3a')]);return db[_0x5267('0x25')]['find'](_0x292b92)[_0x5267('0x1e')](handleEntityNotFound(_0xd9f8e4,null))[_0x5267('0x1e')](respondWithResult(_0xd9f8e4,null))[_0x5267('0x41')](handleError(_0xd9f8e4,null));};exports[_0x5267('0x42')]=function(_0x30e5b5,_0x5a7789){return db['FreshsalesField'][_0x5267('0x42')](_0x30e5b5[_0x5267('0x43')],{})[_0x5267('0x1e')](respondWithResult(_0x5a7789,0xc9))[_0x5267('0x41')](handleError(_0x5a7789,null));};exports[_0x5267('0x1d')]=function(_0x4e219e,_0x94272d){if(_0x4e219e[_0x5267('0x43')]['id']){delete _0x4e219e[_0x5267('0x43')]['id'];}return db[_0x5267('0x25')][_0x5267('0x44')]({'where':{'id':_0x4e219e[_0x5267('0x45')]['id']}})[_0x5267('0x1e')](handleEntityNotFound(_0x94272d,null))[_0x5267('0x1e')](saveUpdates(_0x4e219e['body'],null))['then'](respondWithResult(_0x94272d,null))[_0x5267('0x41')](handleError(_0x94272d,null));};exports[_0x5267('0x46')]=function(_0xdb8dc9,_0x291c7b){return db['FreshsalesField'][_0x5267('0x44')]({'where':{'id':_0xdb8dc9[_0x5267('0x45')]['id']}})[_0x5267('0x1e')](handleEntityNotFound(_0x291c7b,null))[_0x5267('0x1e')](removeEntity(_0x291c7b,null))['catch'](handleError(_0x291c7b,null));}; \ No newline at end of file +var _0x145e=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x145e,0x173));var _0xe145=function(_0x1b6c96,_0x30bd30){_0x1b6c96=_0x1b6c96-0x0;var _0x80e240=_0x145e[_0x1b6c96];return _0x80e240;};'use strict';var emlformat=require(_0xe145('0x0'));var rimraf=require(_0xe145('0x1'));var zipdir=require(_0xe145('0x2'));var jsonpatch=require(_0xe145('0x3'));var rp=require(_0xe145('0x4'));var moment=require(_0xe145('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe145('0x6'));var util=require(_0xe145('0x7'));var path=require('path');var sox=require(_0xe145('0x8'));var csv=require(_0xe145('0x9'));var ejs=require(_0xe145('0xa'));var fs=require('fs');var fs_extra=require(_0xe145('0xb'));var _=require(_0xe145('0xc'));var squel=require(_0xe145('0xd'));var crypto=require(_0xe145('0xe'));var jsforce=require(_0xe145('0xf'));var deskjs=require(_0xe145('0x10'));var toCsv=require(_0xe145('0x9'));var querystring=require(_0xe145('0x11'));var Papa=require(_0xe145('0x12'));var Redis=require('ioredis');var authService=require(_0xe145('0x13'));var qs=require(_0xe145('0x14'));var as=require(_0xe145('0x15'));var hardwareService=require(_0xe145('0x16'));var logger=require(_0xe145('0x17'))(_0xe145('0x18'));var utils=require('../../config/utils');var config=require(_0xe145('0x19'));var licenseUtil=require(_0xe145('0x1a'));var db=require(_0xe145('0x1b'))['db'];function respondWithStatusCode(_0x107e9c,_0x518ac1){_0x518ac1=_0x518ac1||0xcc;return function(_0x425248){if(_0x425248){return _0x107e9c['sendStatus'](_0x518ac1);}return _0x107e9c[_0xe145('0x1c')](_0x518ac1)[_0xe145('0x1d')]();};}function respondWithResult(_0x1f6e6f,_0x1fe24c){_0x1fe24c=_0x1fe24c||0xc8;return function(_0x262f9f){if(_0x262f9f){return _0x1f6e6f['status'](_0x1fe24c)[_0xe145('0x1e')](_0x262f9f);}};}function respondWithFilteredResult(_0x532da8,_0x2b94eb){return function(_0x2cefe5){if(_0x2cefe5){var _0x6b96b9=typeof _0x2b94eb[_0xe145('0x1f')]===_0xe145('0x20')&&typeof _0x2b94eb[_0xe145('0x21')]==='undefined';var _0x270b03=_0x2cefe5[_0xe145('0x22')];var _0x5c172b=_0x6b96b9?0x0:_0x2b94eb[_0xe145('0x1f')];var _0x1c6cd2=_0x6b96b9?_0x2cefe5[_0xe145('0x22')]:_0x2b94eb['offset']+_0x2b94eb[_0xe145('0x21')];var _0x40353c;if(_0x1c6cd2>=_0x270b03){_0x1c6cd2=_0x270b03;_0x40353c=0xc8;}else{_0x40353c=0xce;}_0x532da8[_0xe145('0x1c')](_0x40353c);return _0x532da8['set']('Content-Range',_0x5c172b+'-'+_0x1c6cd2+'/'+_0x270b03)['json'](_0x2cefe5);}return null;};}function patchUpdates(_0x3411b4){return function(_0xde2406){try{jsonpatch['apply'](_0xde2406,_0x3411b4,!![]);}catch(_0x473005){return BPromise[_0xe145('0x23')](_0x473005);}return _0xde2406[_0xe145('0x24')]();};}function saveUpdates(_0x3749f1,_0x27784f){return function(_0x266fbe){if(_0x266fbe){return _0x266fbe[_0xe145('0x25')](_0x3749f1)[_0xe145('0x26')](function(_0x4b6a31){return _0x4b6a31;});}return null;};}function removeEntity(_0x1ec415,_0x2937d){return function(_0x39bc35){if(_0x39bc35){return _0x39bc35[_0xe145('0x27')]()['then'](function(){_0x1ec415['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x392525,_0x2be9d9){return function(_0x697c23){if(!_0x697c23){_0x392525[_0xe145('0x28')](0x194);}return _0x697c23;};}function handleError(_0x108a5f,_0x1d0d39){_0x1d0d39=_0x1d0d39||0x1f4;return function(_0x20178e){logger['error'](_0x20178e[_0xe145('0x29')]);if(_0x20178e[_0xe145('0x2a')]){delete _0x20178e[_0xe145('0x2a')];}_0x108a5f[_0xe145('0x1c')](_0x1d0d39)[_0xe145('0x2b')](_0x20178e);};}exports[_0xe145('0x2c')]=function(_0x5606cf,_0x8250f1){var _0xacd18e={},_0x275f76={},_0x203908={'count':0x0,'rows':[]};var _0xbe506f=_[_0xe145('0x2d')](db[_0xe145('0x2e')][_0xe145('0x2f')],function(_0xdbede){return{'name':_0xdbede[_0xe145('0x30')],'type':_0xdbede[_0xe145('0x31')][_0xe145('0x32')]};});_0x275f76[_0xe145('0x33')]=_[_0xe145('0x2d')](_0xbe506f,_0xe145('0x2a'));_0x275f76[_0xe145('0x34')]=_[_0xe145('0x35')](_0x5606cf[_0xe145('0x34')]);_0x275f76[_0xe145('0x36')]=_[_0xe145('0x37')](_0x275f76['model'],_0x275f76[_0xe145('0x34')]);_0xacd18e[_0xe145('0x38')]=_[_0xe145('0x37')](_0x275f76['model'],qs[_0xe145('0x39')](_0x5606cf['query'][_0xe145('0x39')]));_0xacd18e['attributes']=_0xacd18e[_0xe145('0x38')][_0xe145('0x3a')]?_0xacd18e[_0xe145('0x38')]:_0x275f76[_0xe145('0x33')];if(!_0x5606cf['query']['hasOwnProperty'](_0xe145('0x3b'))){_0xacd18e['limit']=qs[_0xe145('0x21')](_0x5606cf['query']['limit']);_0xacd18e[_0xe145('0x1f')]=qs[_0xe145('0x1f')](_0x5606cf['query'][_0xe145('0x1f')]);}_0xacd18e[_0xe145('0x3c')]=qs['sort'](_0x5606cf[_0xe145('0x34')][_0xe145('0x3d')]);_0xacd18e[_0xe145('0x3e')]=qs[_0xe145('0x36')](_['pick'](_0x5606cf[_0xe145('0x34')],_0x275f76[_0xe145('0x36')]),_0xbe506f);if(_0x5606cf['query'][_0xe145('0x3f')]){_0xacd18e['where']=_[_0xe145('0x40')](_0xacd18e[_0xe145('0x3e')],{'$or':_[_0xe145('0x2d')](_0xbe506f,function(_0x4ee9e4){if(_0x4ee9e4[_0xe145('0x31')]!==_0xe145('0x41')){var _0x209be1={};_0x209be1[_0x4ee9e4[_0xe145('0x2a')]]={'$like':'%'+_0x5606cf[_0xe145('0x34')][_0xe145('0x3f')]+'%'};return _0x209be1;}})});}_0xacd18e=_['merge']({},_0xacd18e,_0x5606cf[_0xe145('0x42')]);var _0x334297={'where':_0xacd18e[_0xe145('0x3e')]};return db['FreshsalesField'][_0xe145('0x22')](_0x334297)[_0xe145('0x26')](function(_0x28aa4c){_0x203908[_0xe145('0x22')]=_0x28aa4c;if(_0x5606cf[_0xe145('0x34')][_0xe145('0x43')]){_0xacd18e[_0xe145('0x44')]=[{'all':!![]}];}return db[_0xe145('0x2e')][_0xe145('0x45')](_0xacd18e);})[_0xe145('0x26')](function(_0x47e6a1){_0x203908[_0xe145('0x46')]=_0x47e6a1;return _0x203908;})[_0xe145('0x26')](respondWithFilteredResult(_0x8250f1,_0xacd18e))['catch'](handleError(_0x8250f1,null));};exports[_0xe145('0x47')]=function(_0x517f59,_0xd2332f){var _0x145e72={'raw':!![],'where':{'id':_0x517f59[_0xe145('0x48')]['id']}},_0x4e04b6={};_0x4e04b6['model']=_[_0xe145('0x35')](db[_0xe145('0x2e')][_0xe145('0x2f')]);_0x4e04b6[_0xe145('0x34')]=_['keys'](_0x517f59[_0xe145('0x34')]);_0x4e04b6[_0xe145('0x36')]=_[_0xe145('0x37')](_0x4e04b6[_0xe145('0x33')],_0x4e04b6[_0xe145('0x34')]);_0x145e72['attributes']=_[_0xe145('0x37')](_0x4e04b6['model'],qs[_0xe145('0x39')](_0x517f59[_0xe145('0x34')][_0xe145('0x39')]));_0x145e72[_0xe145('0x38')]=_0x145e72[_0xe145('0x38')]['length']?_0x145e72[_0xe145('0x38')]:_0x4e04b6[_0xe145('0x33')];if(_0x517f59[_0xe145('0x34')]['includeAll']){_0x145e72['include']=[{'all':!![]}];}_0x145e72=_[_0xe145('0x40')]({},_0x145e72,_0x517f59['options']);return db[_0xe145('0x2e')][_0xe145('0x49')](_0x145e72)[_0xe145('0x26')](handleEntityNotFound(_0xd2332f,null))['then'](respondWithResult(_0xd2332f,null))['catch'](handleError(_0xd2332f,null));};exports[_0xe145('0x4a')]=function(_0x1caae6,_0x3956e5){return db['FreshsalesField'][_0xe145('0x4a')](_0x1caae6[_0xe145('0x4b')],{})[_0xe145('0x26')](respondWithResult(_0x3956e5,0xc9))['catch'](handleError(_0x3956e5,null));};exports['update']=function(_0x3db762,_0x5a877f){if(_0x3db762[_0xe145('0x4b')]['id']){delete _0x3db762[_0xe145('0x4b')]['id'];}return db[_0xe145('0x2e')][_0xe145('0x49')]({'where':{'id':_0x3db762[_0xe145('0x48')]['id']}})[_0xe145('0x26')](handleEntityNotFound(_0x5a877f,null))[_0xe145('0x26')](saveUpdates(_0x3db762[_0xe145('0x4b')],null))['then'](respondWithResult(_0x5a877f,null))[_0xe145('0x4c')](handleError(_0x5a877f,null));};exports[_0xe145('0x27')]=function(_0x1cad22,_0x25e627){return db[_0xe145('0x2e')][_0xe145('0x49')]({'where':{'id':_0x1cad22[_0xe145('0x48')]['id']}})[_0xe145('0x26')](handleEntityNotFound(_0x25e627,null))[_0xe145('0x26')](removeEntity(_0x25e627,null))[_0xe145('0x4c')](handleError(_0x25e627,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 89d608c..476a18a 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 _0x85de=['moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x48842c,_0x978548){var _0x53296b=function(_0x582645){while(--_0x582645){_0x48842c['push'](_0x48842c['shift']());}};_0x53296b(++_0x978548);}(_0x85de,0x65));var _0xe85d=function(_0x429f74,_0x37dd69){_0x429f74=_0x429f74-0x0;var _0x27f192=_0x85de[_0x429f74];return _0x27f192;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var logger=require(_0xe85d('0x2'))(_0xe85d('0x3'));var moment=require(_0xe85d('0x4'));var BPromise=require(_0xe85d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe85d('0x6'));var rimraf=require(_0xe85d('0x7'));var config=require(_0xe85d('0x8'));var attributes=require(_0xe85d('0x9'));module['exports']=function(_0x5f12a2,_0x2797cd){return _0x5f12a2[_0xe85d('0xa')](_0xe85d('0xb'),attributes,{'tableName':_0xe85d('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xe85d('0xd'),_0xe85d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42f4=['moment','bluebird','request-promise','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api'];(function(_0x2706e6,_0x4ab6f1){var _0xe21e14=function(_0xcdbfcd){while(--_0xcdbfcd){_0x2706e6['push'](_0x2706e6['shift']());}};_0xe21e14(++_0x4ab6f1);}(_0x42f4,0x19d));var _0x442f=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0x42f4[_0x138836];return _0x322688;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var logger=require(_0x442f('0x1'))(_0x442f('0x2'));var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var rp=require(_0x442f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442f('0x6'));module[_0x442f('0x7')]=function(_0x545b7b,_0x3ed622){return _0x545b7b[_0x442f('0x8')](_0x442f('0x9'),attributes,{'tableName':_0x442f('0xa'),'paranoid':![],'indexes':[{'name':_0x442f('0xb'),'fields':[_0x442f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 7ebc173..5d4eea6 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x687b,0x14a));var _0xb687=function(_0x5ed7af,_0x422676){_0x5ed7af=_0x5ed7af-0x0;var _0x29a495=_0x687b[_0x5ed7af];return _0x29a495;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x1261=['then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\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(_0x37a391,_0x1bbb28){var _0x113222=function(_0x329d5b){while(--_0x329d5b){_0x37a391['push'](_0x37a391['shift']());}};_0x113222(++_0x1bbb28);}(_0x1261,0x144));var _0x1126=function(_0x24693e,_0x2ba888){_0x24693e=_0x24693e-0x0;var _0x53e672=_0x1261[_0x24693e];return _0x53e672;};'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')]('FreshsalesField,\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/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index fdfed04..b675648 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(_0x31b100,_0x471549){var _0x4ec0e8=function(_0x19587c){while(--_0x19587c){_0x31b100['push'](_0x31b100['shift']());}};_0x4ec0e8(++_0x471549);}(_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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xcfdd24,_0x42a2c4){var _0x396711=function(_0x12908b){while(--_0x12908b){_0xcfdd24['push'](_0xcfdd24['shift']());}};_0x396711(++_0x42a2c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 62a068d..6a2fc3d 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 _0x7366=['newTab','sequelize','exports','STRING','username','integrationTab'];(function(_0x72e262,_0x482c3b){var _0x6a0955=function(_0x1e9ac3){while(--_0x1e9ac3){_0x72e262['push'](_0x72e262['shift']());}};_0x6a0955(++_0x482c3b);}(_0x7366,0x9d));var _0x6736=function(_0x3c5e8b,_0x17513d){_0x3c5e8b=_0x3c5e8b-0x0;var _0x1784b6=_0x7366[_0x3c5e8b];return _0x1784b6;};'use strict';var Sequelize=require(_0x6736('0x0'));module[_0x6736('0x1')]={'name':{'type':Sequelize[_0x6736('0x2')]},'description':{'type':Sequelize[_0x6736('0x2')]},'username':{'type':Sequelize[_0x6736('0x2')],'unique':_0x6736('0x3')},'remoteUri':{'type':Sequelize[_0x6736('0x2')]},'password':{'type':Sequelize[_0x6736('0x2')]},'clientId':{'type':Sequelize[_0x6736('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x6736('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6736('0x4'),_0x6736('0x5')),'defaultValue':_0x6736('0x4')}}; \ No newline at end of file +var _0x25a9=['newTab','exports','STRING','username','integrationTab'];(function(_0x3adc35,_0x34d88a){var _0x3ea6fc=function(_0x19b38c){while(--_0x19b38c){_0x3adc35['push'](_0x3adc35['shift']());}};_0x3ea6fc(++_0x34d88a);}(_0x25a9,0xf1));var _0x925a=function(_0x49ebed,_0x2ed245){_0x49ebed=_0x49ebed-0x0;var _0x247194=_0x25a9[_0x49ebed];return _0x247194;};'use strict';var Sequelize=require('sequelize');module[_0x925a('0x0')]={'name':{'type':Sequelize[_0x925a('0x1')]},'description':{'type':Sequelize[_0x925a('0x1')]},'username':{'type':Sequelize[_0x925a('0x1')],'unique':_0x925a('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x925a('0x1')]},'clientId':{'type':Sequelize[_0x925a('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x925a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x925a('0x3'),_0x925a('0x4')),'defaultValue':_0x925a('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 57f6e70..7641532 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 _0x8e0c=['rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','sendStatus','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','then','includeAll','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','clientSecret','username','password','securityToken','slice','substring','Connection','clientId','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','picklist','email','textarea','remove','includes','label','custom','picklistValues','boolean','true','False','false','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format'];(function(_0x4a496c,_0x12e1c7){var _0x2f74eb=function(_0x322c44){while(--_0x322c44){_0x4a496c['push'](_0x4a496c['shift']());}};_0x2f74eb(++_0x12e1c7);}(_0x8e0c,0x1e7));var _0xc8e0=function(_0x57d2c9,_0x159ed9){_0x57d2c9=_0x57d2c9-0x0;var _0x6742ba=_0x8e0c[_0x57d2c9];return _0x6742ba;};'use strict';var emlformat=require(_0xc8e0('0x0'));var rimraf=require(_0xc8e0('0x1'));var zipdir=require(_0xc8e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8e0('0x3'));var moment=require(_0xc8e0('0x4'));var BPromise=require(_0xc8e0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc8e0('0x6'));var sox=require('sox');var csv=require(_0xc8e0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8e0('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc8e0('0x9'));var jsforce=require(_0xc8e0('0xa'));var deskjs=require(_0xc8e0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc8e0('0xc'));var Redis=require(_0xc8e0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc8e0('0xe'));var as=require(_0xc8e0('0xf'));var hardwareService=require(_0xc8e0('0x10'));var logger=require('../../config/logger')(_0xc8e0('0x11'));var utils=require(_0xc8e0('0x12'));var config=require(_0xc8e0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8e0('0x14'))['db'];var integrations=require(_0xc8e0('0x15'));function respondWithStatusCode(_0x5d3592,_0x91da4a){_0x91da4a=_0x91da4a||0xcc;return function(_0x15e5b8){if(_0x15e5b8){return _0x5d3592['sendStatus'](_0x91da4a);}return _0x5d3592[_0xc8e0('0x16')](_0x91da4a)[_0xc8e0('0x17')]();};}function respondWithResult(_0x261e70,_0x2438f0){_0x2438f0=_0x2438f0||0xc8;return function(_0x130f92){if(_0x130f92){return _0x261e70[_0xc8e0('0x16')](_0x2438f0)[_0xc8e0('0x18')](_0x130f92);}};}function respondWithFilteredResult(_0xb2217d,_0x1dc50f){return function(_0x5bea87){if(_0x5bea87){var _0x138420=typeof _0x1dc50f[_0xc8e0('0x19')]===_0xc8e0('0x1a')&&typeof _0x1dc50f[_0xc8e0('0x1b')]==='undefined';var _0x4f2736=_0x5bea87[_0xc8e0('0x1c')];var _0x4af0c0=_0x138420?0x0:_0x1dc50f[_0xc8e0('0x19')];var _0x323575=_0x138420?_0x5bea87[_0xc8e0('0x1c')]:_0x1dc50f[_0xc8e0('0x19')]+_0x1dc50f[_0xc8e0('0x1b')];var _0x3d3cff;if(_0x323575>=_0x4f2736){_0x323575=_0x4f2736;_0x3d3cff=0xc8;}else{_0x3d3cff=0xce;}_0xb2217d[_0xc8e0('0x16')](_0x3d3cff);return _0xb2217d[_0xc8e0('0x1d')]('Content-Range',_0x4af0c0+'-'+_0x323575+'/'+_0x4f2736)[_0xc8e0('0x18')](_0x5bea87);}return null;};}function patchUpdates(_0x4a514b){return function(_0x1a5955){try{jsonpatch['apply'](_0x1a5955,_0x4a514b,!![]);}catch(_0x4b9dc9){return BPromise[_0xc8e0('0x1e')](_0x4b9dc9);}return _0x1a5955['save']();};}function saveUpdates(_0x1177f5,_0x53587a){return function(_0x14b236){if(_0x14b236){return _0x14b236[_0xc8e0('0x1f')](_0x1177f5)['then'](function(_0xde03ed){return _0xde03ed;});}return null;};}function removeEntity(_0x1a0eff,_0x111465){return function(_0x1b19ad){if(_0x1b19ad){return _0x1b19ad[_0xc8e0('0x20')]()['then'](function(){_0x1a0eff['status'](0xcc)[_0xc8e0('0x17')]();});}};}function handleEntityNotFound(_0x338bd3,_0x5c19de){return function(_0x1a243f){if(!_0x1a243f){_0x338bd3[_0xc8e0('0x21')](0x194);}return _0x1a243f;};}function handleError(_0x6c62f1,_0x377776){_0x377776=_0x377776||0x1f4;return function(_0x3ad9cf){logger['error'](_0x3ad9cf['stack']);if(_0x3ad9cf[_0xc8e0('0x22')]){delete _0x3ad9cf[_0xc8e0('0x22')];}_0x6c62f1[_0xc8e0('0x16')](_0x377776)[_0xc8e0('0x23')](_0x3ad9cf);};}exports[_0xc8e0('0x24')]=function(_0x22139e,_0x2c8cc8){var _0xf06d8={},_0x43aca0={},_0x3ce739={'count':0x0,'rows':[]};var _0x3ba36f=_[_0xc8e0('0x25')](db[_0xc8e0('0x26')][_0xc8e0('0x27')],function(_0x55079e){return{'name':_0x55079e[_0xc8e0('0x28')],'type':_0x55079e[_0xc8e0('0x29')][_0xc8e0('0x2a')]};});_0x43aca0[_0xc8e0('0x2b')]=_[_0xc8e0('0x25')](_0x3ba36f,_0xc8e0('0x22'));_0x43aca0['query']=_[_0xc8e0('0x2c')](_0x22139e['query']);_0x43aca0['filters']=_[_0xc8e0('0x2d')](_0x43aca0['model'],_0x43aca0['query']);_0xf06d8[_0xc8e0('0x2e')]=_['intersection'](_0x43aca0[_0xc8e0('0x2b')],qs[_0xc8e0('0x2f')](_0x22139e['query'][_0xc8e0('0x2f')]));_0xf06d8[_0xc8e0('0x2e')]=_0xf06d8[_0xc8e0('0x2e')][_0xc8e0('0x30')]?_0xf06d8['attributes']:_0x43aca0[_0xc8e0('0x2b')];if(!_0x22139e[_0xc8e0('0x31')][_0xc8e0('0x32')](_0xc8e0('0x33'))){_0xf06d8['limit']=qs[_0xc8e0('0x1b')](_0x22139e['query'][_0xc8e0('0x1b')]);_0xf06d8[_0xc8e0('0x19')]=qs[_0xc8e0('0x19')](_0x22139e[_0xc8e0('0x31')][_0xc8e0('0x19')]);}_0xf06d8[_0xc8e0('0x34')]=qs['sort'](_0x22139e['query'][_0xc8e0('0x35')]);_0xf06d8['where']=qs[_0xc8e0('0x36')](_[_0xc8e0('0x37')](_0x22139e[_0xc8e0('0x31')],_0x43aca0[_0xc8e0('0x36')]),_0x3ba36f);if(_0x22139e[_0xc8e0('0x31')]['filter']){_0xf06d8[_0xc8e0('0x38')]=_[_0xc8e0('0x39')](_0xf06d8[_0xc8e0('0x38')],{'$or':_[_0xc8e0('0x25')](_0x3ba36f,function(_0x1b05c5){if(_0x1b05c5[_0xc8e0('0x29')]!=='VIRTUAL'){var _0x1916e2={};_0x1916e2[_0x1b05c5[_0xc8e0('0x22')]]={'$like':'%'+_0x22139e['query'][_0xc8e0('0x3a')]+'%'};return _0x1916e2;}})});}_0xf06d8=_[_0xc8e0('0x39')]({},_0xf06d8,_0x22139e[_0xc8e0('0x3b')]);var _0x3a0c16={'where':_0xf06d8[_0xc8e0('0x38')]};return db[_0xc8e0('0x26')]['count'](_0x3a0c16)[_0xc8e0('0x3c')](function(_0x956626){_0x3ce739[_0xc8e0('0x1c')]=_0x956626;if(_0x22139e[_0xc8e0('0x31')][_0xc8e0('0x3d')]){_0xf06d8['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0xc8e0('0x3e')](_0xf06d8);})[_0xc8e0('0x3c')](function(_0x53ce2e){_0x3ce739[_0xc8e0('0x3f')]=_0x53ce2e;return _0x3ce739;})['then'](respondWithFilteredResult(_0x2c8cc8,_0xf06d8))[_0xc8e0('0x40')](handleError(_0x2c8cc8,null));};exports[_0xc8e0('0x41')]=function(_0x3e601f,_0xef1a92){var _0x587303={'raw':![],'where':{'id':_0x3e601f[_0xc8e0('0x42')]['id']}},_0x311360={};_0x311360[_0xc8e0('0x2b')]=_['keys'](db[_0xc8e0('0x26')][_0xc8e0('0x27')]);_0x311360[_0xc8e0('0x31')]=_[_0xc8e0('0x2c')](_0x3e601f[_0xc8e0('0x31')]);_0x311360['filters']=_[_0xc8e0('0x2d')](_0x311360[_0xc8e0('0x2b')],_0x311360[_0xc8e0('0x31')]);_0x587303[_0xc8e0('0x2e')]=_['intersection'](_0x311360['model'],qs['fields'](_0x3e601f[_0xc8e0('0x31')]['fields']));_0x587303[_0xc8e0('0x2e')]=_0x587303[_0xc8e0('0x2e')][_0xc8e0('0x30')]?_0x587303[_0xc8e0('0x2e')]:_0x311360[_0xc8e0('0x2b')];if(_0x3e601f[_0xc8e0('0x31')][_0xc8e0('0x3d')]){_0x587303['include']=[{'all':!![]}];}_0x587303=_['merge']({},_0x587303,_0x3e601f[_0xc8e0('0x3b')]);return db[_0xc8e0('0x26')][_0xc8e0('0x43')](_0x587303)['then'](handleEntityNotFound(_0xef1a92,null))[_0xc8e0('0x3c')](respondWithResult(_0xef1a92,null))['catch'](handleError(_0xef1a92,null));};exports[_0xc8e0('0x44')]=function(_0xc9d9cb,_0x2570f3){return db['SalesforceAccount'][_0xc8e0('0x44')](_0xc9d9cb[_0xc8e0('0x45')],{})[_0xc8e0('0x3c')](respondWithResult(_0x2570f3,0xc9))[_0xc8e0('0x40')](handleError(_0x2570f3,null));};exports[_0xc8e0('0x1f')]=function(_0x5d82af,_0xfa06fb){if(_0x5d82af[_0xc8e0('0x45')]['id']){delete _0x5d82af['body']['id'];}return db['SalesforceAccount'][_0xc8e0('0x43')]({'where':{'id':_0x5d82af[_0xc8e0('0x42')]['id']}})['then'](handleEntityNotFound(_0xfa06fb,null))[_0xc8e0('0x3c')](saveUpdates(_0x5d82af[_0xc8e0('0x45')],null))['then'](respondWithResult(_0xfa06fb,null))[_0xc8e0('0x40')](handleError(_0xfa06fb,null));};exports['destroy']=function(_0x3580c9,_0x49e0e4){return db[_0xc8e0('0x26')]['find']({'where':{'id':_0x3580c9[_0xc8e0('0x42')]['id']}})[_0xc8e0('0x3c')](handleEntityNotFound(_0x49e0e4,null))['then'](removeEntity(_0x49e0e4,null))['catch'](handleError(_0x49e0e4,null));};exports[_0xc8e0('0x46')]=function(_0x36f9a8,_0x16e8ca,_0x552bf9){var _0x8f84b0={};var _0x424db3={};var _0x4b6e0a;var _0x299030;return db[_0xc8e0('0x26')][_0xc8e0('0x47')]({'where':{'id':_0x36f9a8[_0xc8e0('0x42')]['id']}})[_0xc8e0('0x3c')](handleEntityNotFound(_0x16e8ca,null))['then'](function(_0x471f10){if(_0x471f10){_0x4b6e0a=_0x471f10;_0x424db3[_0xc8e0('0x2b')]=_[_0xc8e0('0x2c')](db['SalesforceConfiguration'][_0xc8e0('0x27')]);_0x424db3[_0xc8e0('0x31')]=_['keys'](_0x36f9a8[_0xc8e0('0x31')]);_0x424db3[_0xc8e0('0x36')]=_['intersection'](_0x424db3[_0xc8e0('0x2b')],_0x424db3[_0xc8e0('0x31')]);_0x8f84b0['attributes']=_['intersection'](_0x424db3['model'],qs[_0xc8e0('0x2f')](_0x36f9a8[_0xc8e0('0x31')][_0xc8e0('0x2f')]));_0x8f84b0[_0xc8e0('0x2e')]=_0x8f84b0['attributes']['length']?_0x8f84b0[_0xc8e0('0x2e')]:_0x424db3['model'];_0x8f84b0[_0xc8e0('0x34')]=qs[_0xc8e0('0x35')](_0x36f9a8[_0xc8e0('0x31')][_0xc8e0('0x35')]);_0x8f84b0[_0xc8e0('0x38')]=qs[_0xc8e0('0x36')](_[_0xc8e0('0x37')](_0x36f9a8[_0xc8e0('0x31')],_0x424db3[_0xc8e0('0x36')]));if(_0x36f9a8[_0xc8e0('0x31')]['filter']){_0x8f84b0[_0xc8e0('0x38')]=_['merge'](_0x8f84b0[_0xc8e0('0x38')],{'$or':_['map'](_0x8f84b0[_0xc8e0('0x2e')],function(_0x4f9269){var _0x56c708={};_0x56c708[_0x4f9269]={'$like':'%'+_0x36f9a8[_0xc8e0('0x31')][_0xc8e0('0x3a')]+'%'};return _0x56c708;})});}_0x8f84b0=_[_0xc8e0('0x39')]({},_0x8f84b0,_0x36f9a8[_0xc8e0('0x3b')]);return _0x4b6e0a[_0xc8e0('0x46')](_0x8f84b0);}})['then'](function(_0x4b3b02){if(_0x4b3b02){_0x299030=_0x4b3b02[_0xc8e0('0x30')];if(!_0x36f9a8['query']['hasOwnProperty'](_0xc8e0('0x33'))){_0x8f84b0[_0xc8e0('0x1b')]=qs[_0xc8e0('0x1b')](_0x36f9a8[_0xc8e0('0x31')][_0xc8e0('0x1b')]);_0x8f84b0[_0xc8e0('0x19')]=qs[_0xc8e0('0x19')](_0x36f9a8[_0xc8e0('0x31')][_0xc8e0('0x19')]);}return _0x4b6e0a['getConfigurations'](_0x8f84b0);}})[_0xc8e0('0x3c')](function(_0x43f203){if(_0x43f203){return _0x43f203?{'count':_0x299030,'rows':_0x43f203}:null;}})[_0xc8e0('0x3c')](respondWithResult(_0x16e8ca,null))['catch'](handleError(_0x16e8ca,null));};exports[_0xc8e0('0x48')]=function(_0x1f0e53,_0x1893cf,_0xa3cb8c){if(_0x1f0e53[_0xc8e0('0x45')]['id']){delete _0x1f0e53[_0xc8e0('0x45')]['id'];}return db['SalesforceAccount'][_0xc8e0('0x47')]({'where':{'id':_0x1f0e53[_0xc8e0('0x42')]['id']}})[_0xc8e0('0x3c')](handleEntityNotFound(_0x1893cf,null))['then'](function(_0x7c80fb){if(_0x7c80fb){_0x1f0e53[_0xc8e0('0x45')][_0xc8e0('0x49')]=_0x7c80fb['id'];_0x1f0e53[_0xc8e0('0x45')][_0xc8e0('0x4a')]=integrations[_0xc8e0('0x4b')](_0x1f0e53[_0xc8e0('0x45')][_0xc8e0('0x4c')],_0x1f0e53[_0xc8e0('0x45')][_0xc8e0('0x29')]);_0x1f0e53[_0xc8e0('0x45')][_0xc8e0('0x4d')]=integrations[_0xc8e0('0x4e')](_0x1f0e53[_0xc8e0('0x45')][_0xc8e0('0x4c')],_0x1f0e53['body'][_0xc8e0('0x29')]);return db[_0xc8e0('0x4f')][_0xc8e0('0x44')](_0x1f0e53['body'],{'include':[{'model':db[_0xc8e0('0x50')],'as':_0xc8e0('0x4a')},{'model':db[_0xc8e0('0x50')],'as':'Descriptions'}]});}return null;})[_0xc8e0('0x3c')](respondWithResult(_0x1893cf,null))[_0xc8e0('0x40')](handleError(_0x1893cf,null));};exports[_0xc8e0('0x51')]=function(_0x47d241,_0x3fb1b3,_0x1b8e67){var _0x562443;var _0x25e040='';var _0x3f3cd4=_0xc8e0('0x52');return db['SalesforceAccount'][_0xc8e0('0x47')]({'where':{'id':_0x47d241['params']['id']},'attributes':['id','remoteUri','clientId',_0xc8e0('0x53'),_0xc8e0('0x54'),_0xc8e0('0x55'),_0xc8e0('0x56')]})[_0xc8e0('0x3c')](handleEntityNotFound(_0x3fb1b3,null))['then'](function(_0x27953c){if(_0x27953c){_0x25e040=_0x27953c['remoteUri'];var _0x4d2e43=_0x25e040[_0xc8e0('0x57')](-0x1);if(_0x4d2e43==='/'){_0x25e040=_0x25e040[_0xc8e0('0x58')](0x0,_0x25e040['lastIndexOf'](_0x4d2e43));}_0x562443=new jsforce[(_0xc8e0('0x59'))]({'oauth2':{'loginUrl':_0x25e040,'clientId':_0x27953c[_0xc8e0('0x5a')],'clientSecret':_0x27953c['clientSecret']}});return _0x562443[_0xc8e0('0x5b')](_0x27953c['username'],_0x27953c[_0xc8e0('0x55')][_0xc8e0('0x5c')](_0x27953c[_0xc8e0('0x56')]));}})[_0xc8e0('0x3c')](function(_0x6cd86a){if(_0x6cd86a){if(!_[_0xc8e0('0x5d')](_0x47d241[_0xc8e0('0x31')][_0xc8e0('0x5e')])){_0x3f3cd4=_0x47d241[_0xc8e0('0x31')][_0xc8e0('0x5e')];}return _0x562443[_0xc8e0('0x5f')](_0x3f3cd4)[_0xc8e0('0x60')]();}})['then'](function(_0x5a45d5){var _0x5e628d=[_0xc8e0('0x61'),_0xc8e0('0x62'),_0xc8e0('0x63'),_0xc8e0('0x64'),'Subject',_0xc8e0('0x65')];var _0x55fc02=[_0xc8e0('0x66'),_0xc8e0('0x67'),_0xc8e0('0x68'),'boolean',_0xc8e0('0x69'),_0xc8e0('0x6a'),'phone'];if(_0x5a45d5){_[_0xc8e0('0x6b')](_0x5a45d5[_0xc8e0('0x2f')],function(_0xeff97){return _0x5e628d[_0xc8e0('0x6c')](_0xeff97[_0xc8e0('0x22')])||!_0x55fc02[_0xc8e0('0x6c')](_0xeff97[_0xc8e0('0x29')]);});return{'count':_0x5a45d5[_0xc8e0('0x2f')][_0xc8e0('0x30')],'rows':_[_0xc8e0('0x25')](_0x5a45d5['fields'],function(_0x4f56ef){return{'id':_0x4f56ef[_0xc8e0('0x22')],'name':_0x4f56ef[_0xc8e0('0x6d')],'custom':_0x4f56ef[_0xc8e0('0x6e')],'options':_0x4f56ef['picklistValues'][_0xc8e0('0x30')]>0x0?_[_0xc8e0('0x25')](_0x4f56ef[_0xc8e0('0x6f')],function(_0x466cfc){return{'name':_0x466cfc['label'],'value':_0x466cfc['value']};}):_0x4f56ef[_0xc8e0('0x29')]==_0xc8e0('0x70')?[{'name':'True','value':_0xc8e0('0x71')},{'name':_0xc8e0('0x72'),'value':_0xc8e0('0x73')}]:[]};})};}})['then'](respondWithResult(_0x3fb1b3,null))[_0xc8e0('0x40')](function(_0x479cdf){var _0x2c3081=_0x47d241[_0xc8e0('0x31')]['test']?0x1f4:_0x479cdf[_0xc8e0('0x74')]||0x1f4;logger[_0xc8e0('0x75')](_0xc8e0('0x76'),'getFields',_0x2c3081,JSON[_0xc8e0('0x77')](_0x479cdf));delete _0x479cdf[_0xc8e0('0x22')];if(_0x2c3081===0x191){_0x2c3081=0x190;}_0x3fb1b3['status'](_0x2c3081)[_0xc8e0('0x23')](_0x47d241[_0xc8e0('0x31')][_0xc8e0('0x78')]?{'message':_0xc8e0('0x79'),'statusCode':_0x479cdf['statusCode']}:_0x479cdf);});}; \ No newline at end of file +var _0x4051=['includes','label','custom','picklistValues','value','true','false','test','statusCode','error','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','path','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/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','name','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','keys','intersection','length','include','catch','create','body','params','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Description','string','int','picklist','boolean','email','textarea','remove'];(function(_0x35030d,_0x62063a){var _0x27c9e6=function(_0x294746){while(--_0x294746){_0x35030d['push'](_0x35030d['shift']());}};_0x27c9e6(++_0x62063a);}(_0x4051,0x102));var _0x1405=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x4051[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require(_0x1405('0x0'));var rimraf=require(_0x1405('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1405('0x2'));var moment=require(_0x1405('0x3'));var BPromise=require(_0x1405('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1405('0x5'));var sox=require('sox');var csv=require(_0x1405('0x6'));var ejs=require(_0x1405('0x7'));var fs=require('fs');var fs_extra=require(_0x1405('0x8'));var _=require(_0x1405('0x9'));var squel=require(_0x1405('0xa'));var crypto=require(_0x1405('0xb'));var jsforce=require(_0x1405('0xc'));var deskjs=require(_0x1405('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1405('0xe'));var Papa=require(_0x1405('0xf'));var Redis=require(_0x1405('0x10'));var authService=require(_0x1405('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1405('0x12'));var logger=require(_0x1405('0x13'))(_0x1405('0x14'));var utils=require(_0x1405('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1405('0x16'));var db=require(_0x1405('0x17'))['db'];var integrations=require(_0x1405('0x18'));function respondWithStatusCode(_0x23b8dd,_0x199df8){_0x199df8=_0x199df8||0xcc;return function(_0x3cc0b6){if(_0x3cc0b6){return _0x23b8dd[_0x1405('0x19')](_0x199df8);}return _0x23b8dd[_0x1405('0x1a')](_0x199df8)[_0x1405('0x1b')]();};}function respondWithResult(_0x5a6f6c,_0x1d172a){_0x1d172a=_0x1d172a||0xc8;return function(_0x28c054){if(_0x28c054){return _0x5a6f6c['status'](_0x1d172a)[_0x1405('0x1c')](_0x28c054);}};}function respondWithFilteredResult(_0x1f82a2,_0x1664ba){return function(_0x2f2171){if(_0x2f2171){var _0x166176=typeof _0x1664ba[_0x1405('0x1d')]===_0x1405('0x1e')&&typeof _0x1664ba['limit']===_0x1405('0x1e');var _0x228d4c=_0x2f2171[_0x1405('0x1f')];var _0x12a211=_0x166176?0x0:_0x1664ba[_0x1405('0x1d')];var _0x40c27c=_0x166176?_0x2f2171['count']:_0x1664ba[_0x1405('0x1d')]+_0x1664ba[_0x1405('0x20')];var _0x2402d5;if(_0x40c27c>=_0x228d4c){_0x40c27c=_0x228d4c;_0x2402d5=0xc8;}else{_0x2402d5=0xce;}_0x1f82a2[_0x1405('0x1a')](_0x2402d5);return _0x1f82a2['set'](_0x1405('0x21'),_0x12a211+'-'+_0x40c27c+'/'+_0x228d4c)['json'](_0x2f2171);}return null;};}function patchUpdates(_0x2df3b6){return function(_0x2b2736){try{jsonpatch['apply'](_0x2b2736,_0x2df3b6,!![]);}catch(_0xa06fa7){return BPromise[_0x1405('0x22')](_0xa06fa7);}return _0x2b2736[_0x1405('0x23')]();};}function saveUpdates(_0x130239,_0x50f182){return function(_0x500153){if(_0x500153){return _0x500153[_0x1405('0x24')](_0x130239)[_0x1405('0x25')](function(_0xc87830){return _0xc87830;});}return null;};}function removeEntity(_0x52d731,_0x52c9a7){return function(_0x1881c9){if(_0x1881c9){return _0x1881c9[_0x1405('0x26')]()[_0x1405('0x25')](function(){_0x52d731[_0x1405('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42c3c3,_0x5b2a50){return function(_0x262c68){if(!_0x262c68){_0x42c3c3['sendStatus'](0x194);}return _0x262c68;};}function handleError(_0x2860d2,_0xc50d43){_0xc50d43=_0xc50d43||0x1f4;return function(_0xbbba64){logger['error'](_0xbbba64['stack']);if(_0xbbba64[_0x1405('0x27')]){delete _0xbbba64[_0x1405('0x27')];}_0x2860d2['status'](_0xc50d43)['send'](_0xbbba64);};}exports['index']=function(_0x1e4f34,_0x296f8a){var _0x15ab36={},_0xe23c97={},_0xb6afb1={'count':0x0,'rows':[]};var _0x482673=_[_0x1405('0x28')](db[_0x1405('0x29')][_0x1405('0x2a')],function(_0x3c9418){return{'name':_0x3c9418[_0x1405('0x2b')],'type':_0x3c9418[_0x1405('0x2c')]['key']};});_0xe23c97[_0x1405('0x2d')]=_[_0x1405('0x28')](_0x482673,'name');_0xe23c97[_0x1405('0x2e')]=_['keys'](_0x1e4f34[_0x1405('0x2e')]);_0xe23c97[_0x1405('0x2f')]=_['intersection'](_0xe23c97[_0x1405('0x2d')],_0xe23c97[_0x1405('0x2e')]);_0x15ab36[_0x1405('0x30')]=_['intersection'](_0xe23c97['model'],qs[_0x1405('0x31')](_0x1e4f34[_0x1405('0x2e')][_0x1405('0x31')]));_0x15ab36[_0x1405('0x30')]=_0x15ab36[_0x1405('0x30')]['length']?_0x15ab36['attributes']:_0xe23c97[_0x1405('0x2d')];if(!_0x1e4f34[_0x1405('0x2e')][_0x1405('0x32')](_0x1405('0x33'))){_0x15ab36[_0x1405('0x20')]=qs[_0x1405('0x20')](_0x1e4f34[_0x1405('0x2e')][_0x1405('0x20')]);_0x15ab36[_0x1405('0x1d')]=qs[_0x1405('0x1d')](_0x1e4f34['query'][_0x1405('0x1d')]);}_0x15ab36[_0x1405('0x34')]=qs['sort'](_0x1e4f34[_0x1405('0x2e')][_0x1405('0x35')]);_0x15ab36['where']=qs[_0x1405('0x2f')](_[_0x1405('0x36')](_0x1e4f34[_0x1405('0x2e')],_0xe23c97[_0x1405('0x2f')]),_0x482673);if(_0x1e4f34[_0x1405('0x2e')][_0x1405('0x37')]){_0x15ab36[_0x1405('0x38')]=_[_0x1405('0x39')](_0x15ab36[_0x1405('0x38')],{'$or':_['map'](_0x482673,function(_0x5723db){if(_0x5723db[_0x1405('0x2c')]!=='VIRTUAL'){var _0x5aab1b={};_0x5aab1b[_0x5723db[_0x1405('0x27')]]={'$like':'%'+_0x1e4f34['query'][_0x1405('0x37')]+'%'};return _0x5aab1b;}})});}_0x15ab36=_[_0x1405('0x39')]({},_0x15ab36,_0x1e4f34[_0x1405('0x3a')]);var _0x234753={'where':_0x15ab36[_0x1405('0x38')]};return db[_0x1405('0x29')][_0x1405('0x1f')](_0x234753)[_0x1405('0x25')](function(_0x3abfa7){_0xb6afb1[_0x1405('0x1f')]=_0x3abfa7;if(_0x1e4f34['query'][_0x1405('0x3b')]){_0x15ab36['include']=[{'all':!![]}];}return db[_0x1405('0x29')][_0x1405('0x3c')](_0x15ab36);})[_0x1405('0x25')](function(_0x113760){_0xb6afb1[_0x1405('0x3d')]=_0x113760;return _0xb6afb1;})[_0x1405('0x25')](respondWithFilteredResult(_0x296f8a,_0x15ab36))['catch'](handleError(_0x296f8a,null));};exports[_0x1405('0x3e')]=function(_0x195b37,_0x5f0ef4){var _0x398bc7={'raw':![],'where':{'id':_0x195b37['params']['id']}},_0x298c44={};_0x298c44[_0x1405('0x2d')]=_[_0x1405('0x3f')](db[_0x1405('0x29')][_0x1405('0x2a')]);_0x298c44[_0x1405('0x2e')]=_[_0x1405('0x3f')](_0x195b37[_0x1405('0x2e')]);_0x298c44[_0x1405('0x2f')]=_['intersection'](_0x298c44[_0x1405('0x2d')],_0x298c44[_0x1405('0x2e')]);_0x398bc7[_0x1405('0x30')]=_[_0x1405('0x40')](_0x298c44['model'],qs[_0x1405('0x31')](_0x195b37['query'][_0x1405('0x31')]));_0x398bc7[_0x1405('0x30')]=_0x398bc7[_0x1405('0x30')][_0x1405('0x41')]?_0x398bc7[_0x1405('0x30')]:_0x298c44[_0x1405('0x2d')];if(_0x195b37[_0x1405('0x2e')][_0x1405('0x3b')]){_0x398bc7[_0x1405('0x42')]=[{'all':!![]}];}_0x398bc7=_[_0x1405('0x39')]({},_0x398bc7,_0x195b37[_0x1405('0x3a')]);return db['SalesforceAccount']['find'](_0x398bc7)[_0x1405('0x25')](handleEntityNotFound(_0x5f0ef4,null))[_0x1405('0x25')](respondWithResult(_0x5f0ef4,null))[_0x1405('0x43')](handleError(_0x5f0ef4,null));};exports[_0x1405('0x44')]=function(_0x567a08,_0x33bbc5){return db[_0x1405('0x29')][_0x1405('0x44')](_0x567a08['body'],{})[_0x1405('0x25')](respondWithResult(_0x33bbc5,0xc9))[_0x1405('0x43')](handleError(_0x33bbc5,null));};exports['update']=function(_0x290a18,_0x120c72){if(_0x290a18['body']['id']){delete _0x290a18[_0x1405('0x45')]['id'];}return db[_0x1405('0x29')]['find']({'where':{'id':_0x290a18[_0x1405('0x46')]['id']}})[_0x1405('0x25')](handleEntityNotFound(_0x120c72,null))[_0x1405('0x25')](saveUpdates(_0x290a18['body'],null))['then'](respondWithResult(_0x120c72,null))[_0x1405('0x43')](handleError(_0x120c72,null));};exports[_0x1405('0x26')]=function(_0x358d40,_0x16eb58){return db['SalesforceAccount']['find']({'where':{'id':_0x358d40[_0x1405('0x46')]['id']}})[_0x1405('0x25')](handleEntityNotFound(_0x16eb58,null))[_0x1405('0x25')](removeEntity(_0x16eb58,null))[_0x1405('0x43')](handleError(_0x16eb58,null));};exports[_0x1405('0x47')]=function(_0x218b37,_0x124166,_0x1d570c){var _0x5b7e48={};var _0x3508c7={};var _0xbad084;var _0x53b950;return db[_0x1405('0x29')]['findOne']({'where':{'id':_0x218b37[_0x1405('0x46')]['id']}})[_0x1405('0x25')](handleEntityNotFound(_0x124166,null))[_0x1405('0x25')](function(_0x22a9a7){if(_0x22a9a7){_0xbad084=_0x22a9a7;_0x3508c7[_0x1405('0x2d')]=_['keys'](db[_0x1405('0x48')][_0x1405('0x2a')]);_0x3508c7[_0x1405('0x2e')]=_[_0x1405('0x3f')](_0x218b37[_0x1405('0x2e')]);_0x3508c7[_0x1405('0x2f')]=_[_0x1405('0x40')](_0x3508c7[_0x1405('0x2d')],_0x3508c7[_0x1405('0x2e')]);_0x5b7e48[_0x1405('0x30')]=_[_0x1405('0x40')](_0x3508c7[_0x1405('0x2d')],qs[_0x1405('0x31')](_0x218b37[_0x1405('0x2e')]['fields']));_0x5b7e48[_0x1405('0x30')]=_0x5b7e48[_0x1405('0x30')][_0x1405('0x41')]?_0x5b7e48[_0x1405('0x30')]:_0x3508c7[_0x1405('0x2d')];_0x5b7e48['order']=qs['sort'](_0x218b37['query'][_0x1405('0x35')]);_0x5b7e48[_0x1405('0x38')]=qs[_0x1405('0x2f')](_[_0x1405('0x36')](_0x218b37[_0x1405('0x2e')],_0x3508c7[_0x1405('0x2f')]));if(_0x218b37[_0x1405('0x2e')][_0x1405('0x37')]){_0x5b7e48[_0x1405('0x38')]=_[_0x1405('0x39')](_0x5b7e48[_0x1405('0x38')],{'$or':_[_0x1405('0x28')](_0x5b7e48['attributes'],function(_0x28343d){var _0x457d46={};_0x457d46[_0x28343d]={'$like':'%'+_0x218b37['query'][_0x1405('0x37')]+'%'};return _0x457d46;})});}_0x5b7e48=_[_0x1405('0x39')]({},_0x5b7e48,_0x218b37[_0x1405('0x3a')]);return _0xbad084[_0x1405('0x47')](_0x5b7e48);}})['then'](function(_0x4cc1a6){if(_0x4cc1a6){_0x53b950=_0x4cc1a6['length'];if(!_0x218b37[_0x1405('0x2e')]['hasOwnProperty'](_0x1405('0x33'))){_0x5b7e48[_0x1405('0x20')]=qs[_0x1405('0x20')](_0x218b37[_0x1405('0x2e')]['limit']);_0x5b7e48[_0x1405('0x1d')]=qs[_0x1405('0x1d')](_0x218b37[_0x1405('0x2e')][_0x1405('0x1d')]);}return _0xbad084[_0x1405('0x47')](_0x5b7e48);}})['then'](function(_0x5e852d){if(_0x5e852d){return _0x5e852d?{'count':_0x53b950,'rows':_0x5e852d}:null;}})[_0x1405('0x25')](respondWithResult(_0x124166,null))[_0x1405('0x43')](handleError(_0x124166,null));};exports[_0x1405('0x49')]=function(_0x2c9e65,_0x177ff7,_0x37560c){if(_0x2c9e65[_0x1405('0x45')]['id']){delete _0x2c9e65[_0x1405('0x45')]['id'];}return db['SalesforceAccount'][_0x1405('0x4a')]({'where':{'id':_0x2c9e65[_0x1405('0x46')]['id']}})[_0x1405('0x25')](handleEntityNotFound(_0x177ff7,null))[_0x1405('0x25')](function(_0x1e6e5a){if(_0x1e6e5a){_0x2c9e65[_0x1405('0x45')][_0x1405('0x4b')]=_0x1e6e5a['id'];_0x2c9e65[_0x1405('0x45')]['Subjects']=integrations[_0x1405('0x4c')](_0x2c9e65['body'][_0x1405('0x4d')],_0x2c9e65[_0x1405('0x45')][_0x1405('0x2c')]);_0x2c9e65[_0x1405('0x45')][_0x1405('0x4e')]=integrations[_0x1405('0x4f')](_0x2c9e65['body']['channel'],_0x2c9e65[_0x1405('0x45')][_0x1405('0x2c')]);return db[_0x1405('0x48')][_0x1405('0x44')](_0x2c9e65[_0x1405('0x45')],{'include':[{'model':db['SalesforceField'],'as':_0x1405('0x50')},{'model':db['SalesforceField'],'as':_0x1405('0x4e')}]});}return null;})['then'](respondWithResult(_0x177ff7,null))[_0x1405('0x43')](handleError(_0x177ff7,null));};exports['getFields']=function(_0xdbec40,_0x5145dd,_0x146f6d){var _0xdc1264;var _0x4052aa='';var _0x48f217=_0x1405('0x51');return db[_0x1405('0x29')][_0x1405('0x4a')]({'where':{'id':_0xdbec40[_0x1405('0x46')]['id']},'attributes':['id',_0x1405('0x52'),_0x1405('0x53'),_0x1405('0x54'),_0x1405('0x55'),_0x1405('0x56'),_0x1405('0x57')]})[_0x1405('0x25')](handleEntityNotFound(_0x5145dd,null))[_0x1405('0x25')](function(_0x2a6ec8){if(_0x2a6ec8){_0x4052aa=_0x2a6ec8[_0x1405('0x52')];var _0x272447=_0x4052aa['slice'](-0x1);if(_0x272447==='/'){_0x4052aa=_0x4052aa[_0x1405('0x58')](0x0,_0x4052aa[_0x1405('0x59')](_0x272447));}_0xdc1264=new jsforce[(_0x1405('0x5a'))]({'oauth2':{'loginUrl':_0x4052aa,'clientId':_0x2a6ec8[_0x1405('0x53')],'clientSecret':_0x2a6ec8['clientSecret']}});return _0xdc1264[_0x1405('0x5b')](_0x2a6ec8[_0x1405('0x55')],_0x2a6ec8[_0x1405('0x56')][_0x1405('0x5c')](_0x2a6ec8[_0x1405('0x57')]));}})['then'](function(_0x439d98){if(_0x439d98){if(!_[_0x1405('0x5d')](_0xdbec40['query'][_0x1405('0x5e')])){_0x48f217=_0xdbec40['query']['ticketType'];}return _0xdc1264[_0x1405('0x5f')](_0x48f217)[_0x1405('0x60')]();}})[_0x1405('0x25')](function(_0x17ecbb){var _0x20dfd5=[_0x1405('0x61'),_0x1405('0x62'),'IsReminderSet',_0x1405('0x63'),'Subject',_0x1405('0x64')];var _0x2b930b=[_0x1405('0x65'),_0x1405('0x66'),_0x1405('0x67'),_0x1405('0x68'),_0x1405('0x69'),_0x1405('0x6a'),'phone'];if(_0x17ecbb){_[_0x1405('0x6b')](_0x17ecbb['fields'],function(_0x1f9526){return _0x20dfd5[_0x1405('0x6c')](_0x1f9526[_0x1405('0x27')])||!_0x2b930b[_0x1405('0x6c')](_0x1f9526[_0x1405('0x2c')]);});return{'count':_0x17ecbb[_0x1405('0x31')][_0x1405('0x41')],'rows':_[_0x1405('0x28')](_0x17ecbb[_0x1405('0x31')],function(_0x2d3f87){return{'id':_0x2d3f87['name'],'name':_0x2d3f87[_0x1405('0x6d')],'custom':_0x2d3f87[_0x1405('0x6e')],'options':_0x2d3f87[_0x1405('0x6f')]['length']>0x0?_[_0x1405('0x28')](_0x2d3f87[_0x1405('0x6f')],function(_0x719082){return{'name':_0x719082['label'],'value':_0x719082[_0x1405('0x70')]};}):_0x2d3f87[_0x1405('0x2c')]==_0x1405('0x68')?[{'name':'True','value':_0x1405('0x71')},{'name':'False','value':_0x1405('0x72')}]:[]};})};}})[_0x1405('0x25')](respondWithResult(_0x5145dd,null))['catch'](function(_0x157e67){var _0x57811d=_0xdbec40['query'][_0x1405('0x73')]?0x1f4:_0x157e67[_0x1405('0x74')]||0x1f4;logger[_0x1405('0x75')]('getFields,\x20%s,\x20%s,\x20%s',_0x1405('0x76'),_0x57811d,JSON[_0x1405('0x77')](_0x157e67));delete _0x157e67[_0x1405('0x27')];if(_0x57811d===0x191){_0x57811d=0x190;}_0x5145dd['status'](_0x57811d)[_0x1405('0x78')](_0xdbec40['query'][_0x1405('0x73')]?{'message':_0x1405('0x79'),'statusCode':_0x157e67[_0x1405('0x74')]}:_0x157e67);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7e1baa0..15bb920 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 _0xe3c8=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x4bb943,_0x588b3a){var _0x1b01a6=function(_0x4f211a){while(--_0x4f211a){_0x4bb943['push'](_0x4bb943['shift']());}};_0x1b01a6(++_0x588b3a);}(_0xe3c8,0x145));var _0x8e3c=function(_0x268363,_0x1a3e36){_0x268363=_0x268363-0x0;var _0x5a426e=_0xe3c8[_0x268363];return _0x5a426e;};'use strict';var _=require(_0x8e3c('0x0'));var util=require(_0x8e3c('0x1'));var logger=require(_0x8e3c('0x2'))(_0x8e3c('0x3'));var moment=require(_0x8e3c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e3c('0x5'));var rimraf=require('rimraf');var config=require(_0x8e3c('0x6'));var attributes=require(_0x8e3c('0x7'));var integrations=require(_0x8e3c('0x8'));module[_0x8e3c('0x9')]=function(_0x338f7d,_0x5c1a19){return _0x338f7d[_0x8e3c('0xa')](_0x8e3c('0xb'),attributes,{'tableName':_0x8e3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5568=['int_salesforce_accounts','util','api','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0xa07e6,_0x42e10a){var _0x539ca6=function(_0x4c8201){while(--_0x4c8201){_0xa07e6['push'](_0xa07e6['shift']());}};_0x539ca6(++_0x42e10a);}(_0x5568,0x6f));var _0x8556=function(_0x34b9ab,_0x19f38c){_0x34b9ab=_0x34b9ab-0x0;var _0x30a880=_0x5568[_0x34b9ab];return _0x30a880;};'use strict';var _=require('lodash');var util=require(_0x8556('0x0'));var logger=require('../../config/logger')(_0x8556('0x1'));var moment=require('moment');var BPromise=require(_0x8556('0x2'));var rp=require(_0x8556('0x3'));var fs=require('fs');var path=require(_0x8556('0x4'));var rimraf=require('rimraf');var config=require(_0x8556('0x5'));var attributes=require(_0x8556('0x6'));var integrations=require(_0x8556('0x7'));module[_0x8556('0x8')]=function(_0x48d377,_0x3dfe0a){return _0x48d377[_0x8556('0x9')]('SalesforceAccount',attributes,{'tableName':_0x8556('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 928b966..e066c3b 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 _0x3ab0=['request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x50bbee,_0x1bb422){var _0x380bd1=function(_0x3b4940){while(--_0x3b4940){_0x50bbee['push'](_0x50bbee['shift']());}};_0x380bd1(++_0x1bb422);}(_0x3ab0,0xb6));var _0x03ab=function(_0xc0f10a,_0x3a2702){_0xc0f10a=_0xc0f10a-0x0;var _0x2c8ab6=_0x3ab0[_0xc0f10a];return _0x2c8ab6;};'use strict';var _=require(_0x03ab('0x0'));var util=require(_0x03ab('0x1'));var moment=require(_0x03ab('0x2'));var BPromise=require(_0x03ab('0x3'));var rs=require(_0x03ab('0x4'));var fs=require('fs');var Redis=require(_0x03ab('0x5'));var db=require(_0x03ab('0x6'))['db'];var utils=require(_0x03ab('0x7'));var logger=require(_0x03ab('0x8'))(_0x03ab('0x9'));var config=require('../../config/environment');var jayson=require(_0x03ab('0xa'));var client=jayson[_0x03ab('0xb')][_0x03ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14f20d,_0x471e77,_0xd315e7){return new BPromise(function(_0x12492b,_0x83f969){return client[_0x03ab('0xd')](_0x14f20d,_0xd315e7)['then'](function(_0x4c8d9a){logger[_0x03ab('0xe')](_0x03ab('0xf'),_0x471e77,_0x03ab('0x10'));logger[_0x03ab('0x11')](_0x03ab('0x12'),_0x471e77,_0x03ab('0x10'),JSON[_0x03ab('0x13')](_0x4c8d9a));if(_0x4c8d9a[_0x03ab('0x14')]){if(_0x4c8d9a[_0x03ab('0x14')][_0x03ab('0x15')]===0x1f4){logger['error'](_0x03ab('0xf'),_0x471e77,_0x4c8d9a[_0x03ab('0x14')][_0x03ab('0x16')]);return _0x83f969(_0x4c8d9a['error'][_0x03ab('0x16')]);}logger[_0x03ab('0x14')](_0x03ab('0xf'),_0x471e77,_0x4c8d9a['error']['message']);return _0x12492b(_0x4c8d9a[_0x03ab('0x14')][_0x03ab('0x16')]);}else{logger[_0x03ab('0xe')](_0x03ab('0xf'),_0x471e77,_0x03ab('0x10'));_0x12492b(_0x4c8d9a[_0x03ab('0x17')][_0x03ab('0x16')]);}})[_0x03ab('0x18')](function(_0x408e30){logger[_0x03ab('0x14')](_0x03ab('0xf'),_0x471e77,_0x408e30);_0x83f969(_0x408e30);});});}exports[_0x03ab('0x19')]=function(_0x1b49c8){var _0x38ce86=this;return new Promise(function(_0x271def,_0x51ac2e){return db[_0x03ab('0x1a')][_0x03ab('0x1b')]({'raw':_0x1b49c8[_0x03ab('0x1c')]?_0x1b49c8[_0x03ab('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1b49c8['options']?_0x1b49c8[_0x03ab('0x1c')][_0x03ab('0x1d')]||null:null,'attributes':_0x1b49c8['options']?_0x1b49c8[_0x03ab('0x1c')][_0x03ab('0x1e')]||null:null,'limit':_0x1b49c8['options']?_0x1b49c8['options'][_0x03ab('0x1f')]||null:null,'include':_0x1b49c8[_0x03ab('0x1c')]?_0x1b49c8[_0x03ab('0x1c')][_0x03ab('0x20')]?_[_0x03ab('0x21')](_0x1b49c8[_0x03ab('0x1c')][_0x03ab('0x20')],function(_0x2f10e9){return{'model':db[_0x2f10e9[_0x03ab('0x22')]],'as':_0x2f10e9['as'],'attributes':_0x2f10e9[_0x03ab('0x1e')],'include':_0x2f10e9[_0x03ab('0x20')]?_[_0x03ab('0x21')](_0x2f10e9[_0x03ab('0x20')],function(_0x134e1e){return{'model':db[_0x134e1e[_0x03ab('0x22')]],'as':_0x134e1e['as'],'attributes':_0x134e1e[_0x03ab('0x1e')],'include':_0x134e1e['include']?_['map'](_0x134e1e['include'],function(_0x35bc79){return{'model':db[_0x35bc79[_0x03ab('0x22')]],'as':_0x35bc79['as'],'attributes':_0x35bc79[_0x03ab('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x03ab('0x23')](function(_0x4405ef){logger['info']('GetSalesforceAccount',_0x1b49c8);logger[_0x03ab('0x11')]('GetSalesforceAccount',_0x1b49c8,JSON['stringify'](_0x4405ef));_0x271def(_0x4405ef);})[_0x03ab('0x18')](function(_0x33daaf){logger['error']('GetSalesforceAccount',_0x33daaf[_0x03ab('0x16')],_0x1b49c8);_0x51ac2e(_0x38ce86[_0x03ab('0x14')](0x1f4,_0x33daaf[_0x03ab('0x16')]));});});};exports[_0x03ab('0x24')]=function(_0x43b584){var _0x705752=this;return new Promise(function(_0x4e6454,_0x67f332){return db['SalesforceAccount'][_0x03ab('0x25')]({'raw':_0x43b584[_0x03ab('0x1c')]?_0x43b584['options'][_0x03ab('0x26')]===undefined?!![]:![]:!![],'where':_0x43b584[_0x03ab('0x1c')]?_0x43b584['options']['where']||null:null,'attributes':_0x43b584['options']?_0x43b584[_0x03ab('0x1c')][_0x03ab('0x1e')]||null:null,'include':_0x43b584[_0x03ab('0x1c')]?_0x43b584[_0x03ab('0x1c')]['include']?_['map'](_0x43b584['options'][_0x03ab('0x20')],function(_0x2bcfe3){return{'model':db[_0x2bcfe3[_0x03ab('0x22')]],'as':_0x2bcfe3['as'],'attributes':_0x2bcfe3[_0x03ab('0x1e')],'include':_0x2bcfe3[_0x03ab('0x20')]?_[_0x03ab('0x21')](_0x2bcfe3[_0x03ab('0x20')],function(_0x5f0d45){return{'model':db[_0x5f0d45[_0x03ab('0x22')]],'as':_0x5f0d45['as'],'attributes':_0x5f0d45[_0x03ab('0x1e')],'include':_0x5f0d45[_0x03ab('0x20')]?_['map'](_0x5f0d45[_0x03ab('0x20')],function(_0x5840c1){return{'model':db[_0x5840c1[_0x03ab('0x22')]],'as':_0x5840c1['as'],'attributes':_0x5840c1[_0x03ab('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x03ab('0x23')](function(_0xb66761){logger[_0x03ab('0xe')](_0x03ab('0x24'),_0x43b584);logger[_0x03ab('0x11')](_0x03ab('0x24'),_0x43b584,JSON[_0x03ab('0x13')](_0xb66761));_0x4e6454(_0xb66761);})[_0x03ab('0x18')](function(_0x409c72){logger[_0x03ab('0x14')](_0x03ab('0x24'),_0x409c72[_0x03ab('0x16')],_0x43b584);_0x67f332(_0x705752['error'](0x1f4,_0x409c72[_0x03ab('0x16')]));});});}; \ No newline at end of file +var _0xebef=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','lodash','util','moment','bluebird','ioredis'];(function(_0x30dd3c,_0x104587){var _0xac6bcf=function(_0x591235){while(--_0x591235){_0x30dd3c['push'](_0x30dd3c['shift']());}};_0xac6bcf(++_0x104587);}(_0xebef,0xf0));var _0xfebe=function(_0x54a59a,_0x4327b9){_0x54a59a=_0x54a59a-0x0;var _0xef231e=_0xebef[_0x54a59a];return _0xef231e;};'use strict';var _=require(_0xfebe('0x0'));var util=require(_0xfebe('0x1'));var moment=require(_0xfebe('0x2'));var BPromise=require(_0xfebe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfebe('0x4'));var db=require(_0xfebe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfebe('0x6'))('rpc');var config=require(_0xfebe('0x7'));var jayson=require(_0xfebe('0x8'));var client=jayson[_0xfebe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5fd49,_0x24cd56,_0xa01449){return new BPromise(function(_0x5dea0e,_0xee4110){return client[_0xfebe('0xa')](_0x5fd49,_0xa01449)[_0xfebe('0xb')](function(_0x2c0938){logger[_0xfebe('0xc')](_0xfebe('0xd'),_0x24cd56,_0xfebe('0xe'));logger[_0xfebe('0xf')](_0xfebe('0x10'),_0x24cd56,'request\x20sent',JSON[_0xfebe('0x11')](_0x2c0938));if(_0x2c0938['error']){if(_0x2c0938[_0xfebe('0x12')][_0xfebe('0x13')]===0x1f4){logger[_0xfebe('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x24cd56,_0x2c0938[_0xfebe('0x12')]['message']);return _0xee4110(_0x2c0938[_0xfebe('0x12')][_0xfebe('0x14')]);}logger[_0xfebe('0x12')](_0xfebe('0xd'),_0x24cd56,_0x2c0938[_0xfebe('0x12')][_0xfebe('0x14')]);return _0x5dea0e(_0x2c0938['error'][_0xfebe('0x14')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x24cd56,_0xfebe('0xe'));_0x5dea0e(_0x2c0938[_0xfebe('0x15')][_0xfebe('0x14')]);}})[_0xfebe('0x16')](function(_0x330208){logger[_0xfebe('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x24cd56,_0x330208);_0xee4110(_0x330208);});});}exports[_0xfebe('0x17')]=function(_0x1a1be2){var _0x56557c=this;return new Promise(function(_0x4f0a01,_0x323fdb){return db[_0xfebe('0x18')][_0xfebe('0x19')]({'raw':_0x1a1be2[_0xfebe('0x1a')]?_0x1a1be2[_0xfebe('0x1a')][_0xfebe('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a1be2[_0xfebe('0x1a')]?_0x1a1be2[_0xfebe('0x1a')][_0xfebe('0x1c')]||null:null,'attributes':_0x1a1be2[_0xfebe('0x1a')]?_0x1a1be2[_0xfebe('0x1a')][_0xfebe('0x1d')]||null:null,'limit':_0x1a1be2[_0xfebe('0x1a')]?_0x1a1be2[_0xfebe('0x1a')][_0xfebe('0x1e')]||null:null,'include':_0x1a1be2[_0xfebe('0x1a')]?_0x1a1be2[_0xfebe('0x1a')][_0xfebe('0x1f')]?_[_0xfebe('0x20')](_0x1a1be2['options'][_0xfebe('0x1f')],function(_0x57b4ce){return{'model':db[_0x57b4ce['model']],'as':_0x57b4ce['as'],'attributes':_0x57b4ce[_0xfebe('0x1d')],'include':_0x57b4ce[_0xfebe('0x1f')]?_[_0xfebe('0x20')](_0x57b4ce[_0xfebe('0x1f')],function(_0x32f20e){return{'model':db[_0x32f20e[_0xfebe('0x21')]],'as':_0x32f20e['as'],'attributes':_0x32f20e['attributes'],'include':_0x32f20e['include']?_[_0xfebe('0x20')](_0x32f20e[_0xfebe('0x1f')],function(_0x53c9a8){return{'model':db[_0x53c9a8[_0xfebe('0x21')]],'as':_0x53c9a8['as'],'attributes':_0x53c9a8[_0xfebe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfebe('0xb')](function(_0x490ddd){logger[_0xfebe('0xc')](_0xfebe('0x17'),_0x1a1be2);logger[_0xfebe('0xf')]('GetSalesforceAccount',_0x1a1be2,JSON['stringify'](_0x490ddd));_0x4f0a01(_0x490ddd);})['catch'](function(_0x5ac252){logger[_0xfebe('0x12')](_0xfebe('0x17'),_0x5ac252['message'],_0x1a1be2);_0x323fdb(_0x56557c[_0xfebe('0x12')](0x1f4,_0x5ac252['message']));});});};exports['ShowSalesforceAccount']=function(_0x563be6){var _0x267867=this;return new Promise(function(_0x237e37,_0x54b36f){return db[_0xfebe('0x18')]['find']({'raw':_0x563be6[_0xfebe('0x1a')]?_0x563be6['options']['raw']===undefined?!![]:![]:!![],'where':_0x563be6[_0xfebe('0x1a')]?_0x563be6['options'][_0xfebe('0x1c')]||null:null,'attributes':_0x563be6['options']?_0x563be6[_0xfebe('0x1a')][_0xfebe('0x1d')]||null:null,'include':_0x563be6[_0xfebe('0x1a')]?_0x563be6[_0xfebe('0x1a')][_0xfebe('0x1f')]?_[_0xfebe('0x20')](_0x563be6[_0xfebe('0x1a')][_0xfebe('0x1f')],function(_0x5c13a2){return{'model':db[_0x5c13a2[_0xfebe('0x21')]],'as':_0x5c13a2['as'],'attributes':_0x5c13a2[_0xfebe('0x1d')],'include':_0x5c13a2[_0xfebe('0x1f')]?_['map'](_0x5c13a2[_0xfebe('0x1f')],function(_0x21404f){return{'model':db[_0x21404f['model']],'as':_0x21404f['as'],'attributes':_0x21404f[_0xfebe('0x1d')],'include':_0x21404f[_0xfebe('0x1f')]?_['map'](_0x21404f[_0xfebe('0x1f')],function(_0x274678){return{'model':db[_0x274678[_0xfebe('0x21')]],'as':_0x274678['as'],'attributes':_0x274678[_0xfebe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfebe('0xb')](function(_0x1bc248){logger[_0xfebe('0xc')]('ShowSalesforceAccount',_0x563be6);logger['debug'](_0xfebe('0x22'),_0x563be6,JSON[_0xfebe('0x11')](_0x1bc248));_0x237e37(_0x1bc248);})[_0xfebe('0x16')](function(_0x10b558){logger[_0xfebe('0x12')]('ShowSalesforceAccount',_0x10b558[_0xfebe('0x14')],_0x563be6);_0x54b36f(_0x267867[_0xfebe('0x12')](0x1f4,_0x10b558[_0xfebe('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ddad467..9adccd4 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xdb28,0x106));var _0x8db2=function(_0xa9e1ac,_0x31a864){_0xa9e1ac=_0xa9e1ac-0x0;var _0x2074af=_0xdb28[_0xa9e1ac];return _0x2074af;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _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(_0xff5aab,_0x4d2305){var _0x1e4b2c=function(_0x593f22){while(--_0x593f22){_0xff5aab['push'](_0xff5aab['shift']());}};_0x1e4b2c(++_0x4d2305);}(_0x2ef3,0xba));var _0x32ef=function(_0x5b7f90,_0x3c9ff7){_0x5b7f90=_0x5b7f90-0x0;var _0x1f93e9=_0x2ef3[_0x5b7f90];return _0x1f93e9;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 144bde0..1e393d3 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 _0x38fe=['Task','ENUM','contact_lead','lead','account_contact_lead','account','nothing','contact','sequelize','exports','STRING'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x38fe,0xfa));var _0xe38f=function(_0x1a6a01,_0x220829){_0x1a6a01=_0x1a6a01-0x0;var _0x35e4b3=_0x38fe[_0x1a6a01];return _0x35e4b3;};'use strict';var Sequelize=require(_0xe38f('0x0'));module[_0xe38f('0x1')]={'name':{'type':Sequelize[_0xe38f('0x2')]},'description':{'type':Sequelize[_0xe38f('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xe38f('0x3'),'Case'),'defaultValue':_0xe38f('0x3')},'moduleSearch':{'type':Sequelize[_0xe38f('0x4')](_0xe38f('0x5'),'contact',_0xe38f('0x6'),_0xe38f('0x7'),_0xe38f('0x8')),'defaultValue':_0xe38f('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0xe38f('0x9'),_0xe38f('0xa'),_0xe38f('0x6'),'account'),'defaultValue':_0xe38f('0x6')},'leadId':{'type':Sequelize[_0xe38f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xe38f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xe38f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xe38f('0x2')]}}; \ No newline at end of file +var _0x5c1e=['account','nothing','contact','sequelize','exports','STRING','ENUM','Task','contact_lead','lead','account_contact_lead'];(function(_0x48adc3,_0x1de7b7){var _0x509d6e=function(_0x13083c){while(--_0x13083c){_0x48adc3['push'](_0x48adc3['shift']());}};_0x509d6e(++_0x1de7b7);}(_0x5c1e,0x121));var _0xe5c1=function(_0x4ac5e4,_0x21e521){_0x4ac5e4=_0x4ac5e4-0x0;var _0x3baebe=_0x5c1e[_0x4ac5e4];return _0x3baebe;};'use strict';var Sequelize=require(_0xe5c1('0x0'));module[_0xe5c1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5c1('0x2')]},'ticketType':{'type':Sequelize[_0xe5c1('0x3')](_0xe5c1('0x4'),'Case'),'defaultValue':_0xe5c1('0x4')},'moduleSearch':{'type':Sequelize[_0xe5c1('0x3')](_0xe5c1('0x5'),'contact',_0xe5c1('0x6'),_0xe5c1('0x7'),_0xe5c1('0x8')),'defaultValue':_0xe5c1('0x5')},'moduleCreate':{'type':Sequelize[_0xe5c1('0x3')](_0xe5c1('0x9'),_0xe5c1('0xa'),_0xe5c1('0x6'),_0xe5c1('0x8')),'defaultValue':_0xe5c1('0x6')},'leadId':{'type':Sequelize[_0xe5c1('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xe5c1('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xe5c1('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4b2b323..4450847 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 _0xde02=['name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xde02,0xd5));var _0x2de0=function(_0x583cf9,_0xd944b1){_0x583cf9=_0x583cf9-0x0;var _0x5e633e=_0xde02[_0x583cf9];return _0x5e633e;};'use strict';var emlformat=require(_0x2de0('0x0'));var rimraf=require(_0x2de0('0x1'));var zipdir=require(_0x2de0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2de0('0x3'));var BPromise=require(_0x2de0('0x4'));var Mustache=require(_0x2de0('0x5'));var util=require('util');var path=require(_0x2de0('0x6'));var sox=require(_0x2de0('0x7'));var csv=require(_0x2de0('0x8'));var ejs=require(_0x2de0('0x9'));var fs=require('fs');var fs_extra=require(_0x2de0('0xa'));var _=require(_0x2de0('0xb'));var squel=require(_0x2de0('0xc'));var crypto=require(_0x2de0('0xd'));var jsforce=require(_0x2de0('0xe'));var deskjs=require(_0x2de0('0xf'));var toCsv=require(_0x2de0('0x8'));var querystring=require(_0x2de0('0x10'));var Papa=require(_0x2de0('0x11'));var Redis=require(_0x2de0('0x12'));var authService=require(_0x2de0('0x13'));var qs=require(_0x2de0('0x14'));var as=require(_0x2de0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2de0('0x16'))(_0x2de0('0x17'));var utils=require(_0x2de0('0x18'));var config=require(_0x2de0('0x19'));var licenseUtil=require(_0x2de0('0x1a'));var db=require(_0x2de0('0x1b'))['db'];function respondWithStatusCode(_0x334b8c,_0x1544ce){_0x1544ce=_0x1544ce||0xcc;return function(_0x378881){if(_0x378881){return _0x334b8c['sendStatus'](_0x1544ce);}return _0x334b8c[_0x2de0('0x1c')](_0x1544ce)[_0x2de0('0x1d')]();};}function respondWithResult(_0x415513,_0x30032e){_0x30032e=_0x30032e||0xc8;return function(_0x226a20){if(_0x226a20){return _0x415513[_0x2de0('0x1c')](_0x30032e)['json'](_0x226a20);}};}function respondWithFilteredResult(_0x277861,_0x12f3c1){return function(_0x1a1368){if(_0x1a1368){var _0x9f062f=typeof _0x12f3c1[_0x2de0('0x1e')]===_0x2de0('0x1f')&&typeof _0x12f3c1[_0x2de0('0x20')]===_0x2de0('0x1f');var _0x441d0a=_0x1a1368['count'];var _0x1334ba=_0x9f062f?0x0:_0x12f3c1['offset'];var _0x189c85=_0x9f062f?_0x1a1368[_0x2de0('0x21')]:_0x12f3c1[_0x2de0('0x1e')]+_0x12f3c1[_0x2de0('0x20')];var _0x56f627;if(_0x189c85>=_0x441d0a){_0x189c85=_0x441d0a;_0x56f627=0xc8;}else{_0x56f627=0xce;}_0x277861[_0x2de0('0x1c')](_0x56f627);return _0x277861[_0x2de0('0x22')](_0x2de0('0x23'),_0x1334ba+'-'+_0x189c85+'/'+_0x441d0a)['json'](_0x1a1368);}return null;};}function patchUpdates(_0xd513b){return function(_0x2f6f77){try{jsonpatch[_0x2de0('0x24')](_0x2f6f77,_0xd513b,!![]);}catch(_0x322a7a){return BPromise[_0x2de0('0x25')](_0x322a7a);}return _0x2f6f77[_0x2de0('0x26')]();};}function saveUpdates(_0x1597a7,_0x311811){return function(_0x41a750){if(_0x41a750){return _0x41a750[_0x2de0('0x27')](_0x1597a7)[_0x2de0('0x28')](function(_0x4529b3){return _0x4529b3;});}return null;};}function removeEntity(_0x1495b9,_0x2ed36f){return function(_0x8fc9e0){if(_0x8fc9e0){return _0x8fc9e0[_0x2de0('0x29')]()[_0x2de0('0x28')](function(){_0x1495b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x590149,_0x11b8da){return function(_0x2e49eb){if(!_0x2e49eb){_0x590149[_0x2de0('0x2a')](0x194);}return _0x2e49eb;};}function handleError(_0x3213dc,_0x1bc31b){_0x1bc31b=_0x1bc31b||0x1f4;return function(_0x28d698){logger[_0x2de0('0x2b')](_0x28d698[_0x2de0('0x2c')]);if(_0x28d698['name']){delete _0x28d698[_0x2de0('0x2d')];}_0x3213dc[_0x2de0('0x1c')](_0x1bc31b)[_0x2de0('0x2e')](_0x28d698);};}exports[_0x2de0('0x2f')]=function(_0x17575a,_0xc94f43){var _0x1168ea={},_0x53c0af={},_0x982303={'count':0x0,'rows':[]};var _0x32c30c=_[_0x2de0('0x30')](db[_0x2de0('0x31')][_0x2de0('0x32')],function(_0x37224e){return{'name':_0x37224e[_0x2de0('0x33')],'type':_0x37224e[_0x2de0('0x34')][_0x2de0('0x35')]};});_0x53c0af[_0x2de0('0x36')]=_['map'](_0x32c30c,_0x2de0('0x2d'));_0x53c0af[_0x2de0('0x37')]=_[_0x2de0('0x38')](_0x17575a[_0x2de0('0x37')]);_0x53c0af[_0x2de0('0x39')]=_[_0x2de0('0x3a')](_0x53c0af[_0x2de0('0x36')],_0x53c0af['query']);_0x1168ea[_0x2de0('0x3b')]=_[_0x2de0('0x3a')](_0x53c0af[_0x2de0('0x36')],qs[_0x2de0('0x3c')](_0x17575a[_0x2de0('0x37')][_0x2de0('0x3c')]));_0x1168ea[_0x2de0('0x3b')]=_0x1168ea[_0x2de0('0x3b')][_0x2de0('0x3d')]?_0x1168ea[_0x2de0('0x3b')]:_0x53c0af[_0x2de0('0x36')];if(!_0x17575a[_0x2de0('0x37')][_0x2de0('0x3e')](_0x2de0('0x3f'))){_0x1168ea[_0x2de0('0x20')]=qs[_0x2de0('0x20')](_0x17575a['query'][_0x2de0('0x20')]);_0x1168ea['offset']=qs['offset'](_0x17575a[_0x2de0('0x37')][_0x2de0('0x1e')]);}_0x1168ea['order']=qs[_0x2de0('0x40')](_0x17575a['query'][_0x2de0('0x40')]);_0x1168ea[_0x2de0('0x41')]=qs[_0x2de0('0x39')](_[_0x2de0('0x42')](_0x17575a[_0x2de0('0x37')],_0x53c0af[_0x2de0('0x39')]),_0x32c30c);if(_0x17575a[_0x2de0('0x37')][_0x2de0('0x43')]){_0x1168ea[_0x2de0('0x41')]=_['merge'](_0x1168ea[_0x2de0('0x41')],{'$or':_[_0x2de0('0x30')](_0x32c30c,function(_0x4079c0){if(_0x4079c0[_0x2de0('0x34')]!==_0x2de0('0x44')){var _0x4423d3={};_0x4423d3[_0x4079c0[_0x2de0('0x2d')]]={'$like':'%'+_0x17575a[_0x2de0('0x37')]['filter']+'%'};return _0x4423d3;}})});}_0x1168ea=_[_0x2de0('0x45')]({},_0x1168ea,_0x17575a[_0x2de0('0x46')]);var _0x31aa99={'where':_0x1168ea[_0x2de0('0x41')]};return db[_0x2de0('0x31')][_0x2de0('0x21')](_0x31aa99)[_0x2de0('0x28')](function(_0x8be218){_0x982303[_0x2de0('0x21')]=_0x8be218;if(_0x17575a[_0x2de0('0x37')][_0x2de0('0x47')]){_0x1168ea[_0x2de0('0x48')]=[{'all':!![]}];}return db[_0x2de0('0x31')][_0x2de0('0x49')](_0x1168ea);})['then'](function(_0x15015c){_0x982303[_0x2de0('0x4a')]=_0x15015c;return _0x982303;})['then'](respondWithFilteredResult(_0xc94f43,_0x1168ea))[_0x2de0('0x4b')](handleError(_0xc94f43,null));};exports[_0x2de0('0x4c')]=function(_0x451970,_0x533ad4){var _0x5ca201={'raw':![],'where':{'id':_0x451970[_0x2de0('0x4d')]['id']}},_0x487412={};_0x487412[_0x2de0('0x36')]=_[_0x2de0('0x38')](db['SalesforceConfiguration'][_0x2de0('0x32')]);_0x487412[_0x2de0('0x37')]=_[_0x2de0('0x38')](_0x451970['query']);_0x487412[_0x2de0('0x39')]=_[_0x2de0('0x3a')](_0x487412[_0x2de0('0x36')],_0x487412[_0x2de0('0x37')]);_0x5ca201[_0x2de0('0x3b')]=_[_0x2de0('0x3a')](_0x487412[_0x2de0('0x36')],qs[_0x2de0('0x3c')](_0x451970['query'][_0x2de0('0x3c')]));_0x5ca201[_0x2de0('0x3b')]=_0x5ca201['attributes'][_0x2de0('0x3d')]?_0x5ca201['attributes']:_0x487412[_0x2de0('0x36')];if(_0x451970[_0x2de0('0x37')][_0x2de0('0x47')]){_0x5ca201[_0x2de0('0x48')]=[{'all':!![]}];}_0x5ca201=_[_0x2de0('0x45')]({},_0x5ca201,_0x451970[_0x2de0('0x46')]);return db['SalesforceConfiguration']['find'](_0x5ca201)[_0x2de0('0x28')](handleEntityNotFound(_0x533ad4,null))[_0x2de0('0x28')](respondWithResult(_0x533ad4,null))[_0x2de0('0x4b')](handleError(_0x533ad4,null));};exports[_0x2de0('0x4e')]=function(_0x317c8f,_0x486b01){return db[_0x2de0('0x31')]['create'](_0x317c8f[_0x2de0('0x4f')],{})[_0x2de0('0x28')](respondWithResult(_0x486b01,0xc9))[_0x2de0('0x4b')](handleError(_0x486b01,null));};exports[_0x2de0('0x27')]=function(_0x5c4e78,_0x2d1fc1){if(_0x5c4e78[_0x2de0('0x4f')]['id']){delete _0x5c4e78[_0x2de0('0x4f')]['id'];}return db[_0x2de0('0x31')][_0x2de0('0x50')]({'where':{'id':_0x5c4e78[_0x2de0('0x4d')]['id']}})[_0x2de0('0x28')](handleEntityNotFound(_0x2d1fc1,null))[_0x2de0('0x28')](saveUpdates(_0x5c4e78[_0x2de0('0x4f')],null))[_0x2de0('0x28')](respondWithResult(_0x2d1fc1,null))[_0x2de0('0x4b')](handleError(_0x2d1fc1,null));};exports['destroy']=function(_0x12c08b,_0x470a79){return db[_0x2de0('0x31')][_0x2de0('0x50')]({'where':{'id':_0x12c08b[_0x2de0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x470a79,null))[_0x2de0('0x28')](removeEntity(_0x470a79,null))['catch'](handleError(_0x470a79,null));};exports[_0x2de0('0x51')]=function(_0x3b4bc7,_0x234ee1,_0x387476){var _0x260232={};var _0x530b76={};var _0x4e6aae;var _0x4fa82f;return db[_0x2de0('0x31')][_0x2de0('0x52')]({'where':{'id':_0x3b4bc7[_0x2de0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x234ee1,null))['then'](function(_0x45c39a){if(_0x45c39a){_0x4e6aae=_0x45c39a;_0x530b76['model']=_[_0x2de0('0x38')](db['SalesforceField'][_0x2de0('0x32')]);_0x530b76[_0x2de0('0x37')]=_[_0x2de0('0x38')](_0x3b4bc7[_0x2de0('0x37')]);_0x530b76[_0x2de0('0x39')]=_['intersection'](_0x530b76[_0x2de0('0x36')],_0x530b76['query']);_0x260232[_0x2de0('0x3b')]=_[_0x2de0('0x3a')](_0x530b76['model'],qs[_0x2de0('0x3c')](_0x3b4bc7[_0x2de0('0x37')]['fields']));_0x260232[_0x2de0('0x3b')]=_0x260232['attributes'][_0x2de0('0x3d')]?_0x260232[_0x2de0('0x3b')]:_0x530b76[_0x2de0('0x36')];_0x260232[_0x2de0('0x53')]=qs[_0x2de0('0x40')](_0x3b4bc7['query'][_0x2de0('0x40')]);_0x260232[_0x2de0('0x41')]=qs[_0x2de0('0x39')](_[_0x2de0('0x42')](_0x3b4bc7[_0x2de0('0x37')],_0x530b76['filters']));if(_0x3b4bc7['query'][_0x2de0('0x43')]){_0x260232[_0x2de0('0x41')]=_[_0x2de0('0x45')](_0x260232['where'],{'$or':_['map'](_0x260232[_0x2de0('0x3b')],function(_0x588709){var _0x3ae875={};_0x3ae875[_0x588709]={'$like':'%'+_0x3b4bc7['query'][_0x2de0('0x43')]+'%'};return _0x3ae875;})});}_0x260232=_['merge']({},_0x260232,_0x3b4bc7['options']);return _0x4e6aae[_0x2de0('0x51')](_0x260232);}})[_0x2de0('0x28')](function(_0x20bf92){if(_0x20bf92){_0x4fa82f=_0x20bf92[_0x2de0('0x3d')];if(!_0x3b4bc7[_0x2de0('0x37')]['hasOwnProperty'](_0x2de0('0x3f'))){_0x260232['limit']=qs[_0x2de0('0x20')](_0x3b4bc7['query'][_0x2de0('0x20')]);_0x260232[_0x2de0('0x1e')]=qs['offset'](_0x3b4bc7[_0x2de0('0x37')][_0x2de0('0x1e')]);}return _0x4e6aae[_0x2de0('0x51')](_0x260232);}})['then'](function(_0x201aaa){if(_0x201aaa){return _0x201aaa?{'count':_0x4fa82f,'rows':_0x201aaa}:null;}})[_0x2de0('0x28')](respondWithResult(_0x234ee1,null))[_0x2de0('0x4b')](handleError(_0x234ee1,null));};exports[_0x2de0('0x54')]=function(_0x5db54e,_0x4e39ba,_0x1d309d){var _0x3fe926={};var _0x34644e={};var _0xe969b4;var _0x16f21e;return db['SalesforceConfiguration'][_0x2de0('0x52')]({'where':{'id':_0x5db54e['params']['id']}})['then'](handleEntityNotFound(_0x4e39ba,null))['then'](function(_0x18dccb){if(_0x18dccb){_0xe969b4=_0x18dccb;_0x34644e[_0x2de0('0x36')]=_[_0x2de0('0x38')](db['SalesforceField']['rawAttributes']);_0x34644e[_0x2de0('0x37')]=_[_0x2de0('0x38')](_0x5db54e[_0x2de0('0x37')]);_0x34644e[_0x2de0('0x39')]=_[_0x2de0('0x3a')](_0x34644e['model'],_0x34644e[_0x2de0('0x37')]);_0x3fe926['attributes']=_['intersection'](_0x34644e[_0x2de0('0x36')],qs[_0x2de0('0x3c')](_0x5db54e[_0x2de0('0x37')][_0x2de0('0x3c')]));_0x3fe926[_0x2de0('0x3b')]=_0x3fe926['attributes'][_0x2de0('0x3d')]?_0x3fe926['attributes']:_0x34644e['model'];_0x3fe926[_0x2de0('0x53')]=qs[_0x2de0('0x40')](_0x5db54e[_0x2de0('0x37')]['sort']);_0x3fe926[_0x2de0('0x41')]=qs[_0x2de0('0x39')](_[_0x2de0('0x42')](_0x5db54e['query'],_0x34644e['filters']));if(_0x5db54e['query']['filter']){_0x3fe926[_0x2de0('0x41')]=_[_0x2de0('0x45')](_0x3fe926[_0x2de0('0x41')],{'$or':_['map'](_0x3fe926[_0x2de0('0x3b')],function(_0x211e5f){var _0x4108ea={};_0x4108ea[_0x211e5f]={'$like':'%'+_0x5db54e[_0x2de0('0x37')][_0x2de0('0x43')]+'%'};return _0x4108ea;})});}_0x3fe926=_[_0x2de0('0x45')]({},_0x3fe926,_0x5db54e['options']);return _0xe969b4[_0x2de0('0x54')](_0x3fe926);}})[_0x2de0('0x28')](function(_0x464d6f){if(_0x464d6f){_0x16f21e=_0x464d6f['length'];if(!_0x5db54e[_0x2de0('0x37')][_0x2de0('0x3e')]('nolimit')){_0x3fe926[_0x2de0('0x20')]=qs[_0x2de0('0x20')](_0x5db54e[_0x2de0('0x37')][_0x2de0('0x20')]);_0x3fe926[_0x2de0('0x1e')]=qs[_0x2de0('0x1e')](_0x5db54e[_0x2de0('0x37')][_0x2de0('0x1e')]);}return _0xe969b4[_0x2de0('0x54')](_0x3fe926);}})['then'](function(_0x253884){if(_0x253884){return _0x253884?{'count':_0x16f21e,'rows':_0x253884}:null;}})[_0x2de0('0x28')](respondWithResult(_0x4e39ba,null))['catch'](handleError(_0x4e39ba,null));};exports[_0x2de0('0x55')]=function(_0x511be5,_0x13fc47,_0x3793ce){var _0x58ca80={};var _0x4be16d={};var _0x4aa2f5;var _0x31c41c;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x511be5[_0x2de0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x13fc47,null))['then'](function(_0x415e5b){if(_0x415e5b){_0x4aa2f5=_0x415e5b;_0x4be16d[_0x2de0('0x36')]=_[_0x2de0('0x38')](db['SalesforceField'][_0x2de0('0x32')]);_0x4be16d[_0x2de0('0x37')]=_[_0x2de0('0x38')](_0x511be5[_0x2de0('0x37')]);_0x4be16d[_0x2de0('0x39')]=_['intersection'](_0x4be16d[_0x2de0('0x36')],_0x4be16d[_0x2de0('0x37')]);_0x58ca80[_0x2de0('0x3b')]=_[_0x2de0('0x3a')](_0x4be16d[_0x2de0('0x36')],qs[_0x2de0('0x3c')](_0x511be5[_0x2de0('0x37')][_0x2de0('0x3c')]));_0x58ca80['attributes']=_0x58ca80[_0x2de0('0x3b')]['length']?_0x58ca80[_0x2de0('0x3b')]:_0x4be16d[_0x2de0('0x36')];_0x58ca80[_0x2de0('0x53')]=qs[_0x2de0('0x40')](_0x511be5[_0x2de0('0x37')]['sort']);_0x58ca80['where']=qs[_0x2de0('0x39')](_[_0x2de0('0x42')](_0x511be5['query'],_0x4be16d['filters']));if(_0x511be5[_0x2de0('0x37')][_0x2de0('0x43')]){_0x58ca80[_0x2de0('0x41')]=_[_0x2de0('0x45')](_0x58ca80[_0x2de0('0x41')],{'$or':_[_0x2de0('0x30')](_0x58ca80[_0x2de0('0x3b')],function(_0x1f4d3b){var _0x638111={};_0x638111[_0x1f4d3b]={'$like':'%'+_0x511be5[_0x2de0('0x37')]['filter']+'%'};return _0x638111;})});}_0x58ca80=_[_0x2de0('0x45')]({},_0x58ca80,_0x511be5[_0x2de0('0x46')]);return _0x4aa2f5[_0x2de0('0x55')](_0x58ca80);}})[_0x2de0('0x28')](function(_0x640824){if(_0x640824){_0x31c41c=_0x640824[_0x2de0('0x3d')];if(!_0x511be5[_0x2de0('0x37')][_0x2de0('0x3e')](_0x2de0('0x3f'))){_0x58ca80[_0x2de0('0x20')]=qs[_0x2de0('0x20')](_0x511be5[_0x2de0('0x37')][_0x2de0('0x20')]);_0x58ca80[_0x2de0('0x1e')]=qs[_0x2de0('0x1e')](_0x511be5[_0x2de0('0x37')][_0x2de0('0x1e')]);}return _0x4aa2f5['getDescriptions'](_0x58ca80);}})[_0x2de0('0x28')](function(_0x3f1c81){if(_0x3f1c81){return _0x3f1c81?{'count':_0x31c41c,'rows':_0x3f1c81}:null;}})[_0x2de0('0x28')](respondWithResult(_0x13fc47,null))['catch'](handleError(_0x13fc47,null));}; \ No newline at end of file +var _0x4351=['intersection','create','body','catch','update','find','params','getFields','findOne','keys','sort','getSubjects','SalesforceField','rawAttributes','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','index','map','model','name','query','fields','attributes','length','hasOwnProperty','order','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','SalesforceConfiguration','findAll','show'];(function(_0x27a434,_0x1ec23a){var _0x48b6c0=function(_0x55ed53){while(--_0x55ed53){_0x27a434['push'](_0x27a434['shift']());}};_0x48b6c0(++_0x1ec23a);}(_0x4351,0xb2));var _0x1435=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x4351[_0x33032e];return _0x13316b;};'use strict';var emlformat=require(_0x1435('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1435('0x1'));var jsonpatch=require(_0x1435('0x2'));var rp=require(_0x1435('0x3'));var moment=require(_0x1435('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1435('0x5'));var util=require(_0x1435('0x6'));var path=require(_0x1435('0x7'));var sox=require('sox');var csv=require(_0x1435('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1435('0x9'));var _=require(_0x1435('0xa'));var squel=require(_0x1435('0xb'));var crypto=require(_0x1435('0xc'));var jsforce=require(_0x1435('0xd'));var deskjs=require(_0x1435('0xe'));var toCsv=require(_0x1435('0x8'));var querystring=require(_0x1435('0xf'));var Papa=require(_0x1435('0x10'));var Redis=require(_0x1435('0x11'));var authService=require(_0x1435('0x12'));var qs=require(_0x1435('0x13'));var as=require(_0x1435('0x14'));var hardwareService=require(_0x1435('0x15'));var logger=require(_0x1435('0x16'))(_0x1435('0x17'));var utils=require(_0x1435('0x18'));var config=require(_0x1435('0x19'));var licenseUtil=require(_0x1435('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298191,_0x3c2bbb){_0x3c2bbb=_0x3c2bbb||0xcc;return function(_0x4a8b8c){if(_0x4a8b8c){return _0x298191[_0x1435('0x1b')](_0x3c2bbb);}return _0x298191[_0x1435('0x1c')](_0x3c2bbb)[_0x1435('0x1d')]();};}function respondWithResult(_0x1c8694,_0x6bd66d){_0x6bd66d=_0x6bd66d||0xc8;return function(_0x469bd1){if(_0x469bd1){return _0x1c8694['status'](_0x6bd66d)[_0x1435('0x1e')](_0x469bd1);}};}function respondWithFilteredResult(_0x4a0e38,_0x473e50){return function(_0x557771){if(_0x557771){var _0x251230=typeof _0x473e50[_0x1435('0x1f')]===_0x1435('0x20')&&typeof _0x473e50[_0x1435('0x21')]===_0x1435('0x20');var _0x6b0666=_0x557771['count'];var _0x78ab9d=_0x251230?0x0:_0x473e50['offset'];var _0xe238a1=_0x251230?_0x557771[_0x1435('0x22')]:_0x473e50[_0x1435('0x1f')]+_0x473e50[_0x1435('0x21')];var _0x86d664;if(_0xe238a1>=_0x6b0666){_0xe238a1=_0x6b0666;_0x86d664=0xc8;}else{_0x86d664=0xce;}_0x4a0e38[_0x1435('0x1c')](_0x86d664);return _0x4a0e38[_0x1435('0x23')](_0x1435('0x24'),_0x78ab9d+'-'+_0xe238a1+'/'+_0x6b0666)[_0x1435('0x1e')](_0x557771);}return null;};}function patchUpdates(_0x752e2c){return function(_0x159bfc){try{jsonpatch[_0x1435('0x25')](_0x159bfc,_0x752e2c,!![]);}catch(_0x26f285){return BPromise[_0x1435('0x26')](_0x26f285);}return _0x159bfc[_0x1435('0x27')]();};}function saveUpdates(_0xeefd51,_0x13b588){return function(_0x75851d){if(_0x75851d){return _0x75851d['update'](_0xeefd51)['then'](function(_0x28dbfb){return _0x28dbfb;});}return null;};}function removeEntity(_0x57e944,_0x7510d2){return function(_0x4eab0b){if(_0x4eab0b){return _0x4eab0b['destroy']()[_0x1435('0x28')](function(){_0x57e944['status'](0xcc)[_0x1435('0x1d')]();});}};}function handleEntityNotFound(_0x1f35aa,_0x41056b){return function(_0x488155){if(!_0x488155){_0x1f35aa['sendStatus'](0x194);}return _0x488155;};}function handleError(_0x64b57a,_0x13004a){_0x13004a=_0x13004a||0x1f4;return function(_0x49e287){logger['error'](_0x49e287[_0x1435('0x29')]);if(_0x49e287['name']){delete _0x49e287['name'];}_0x64b57a[_0x1435('0x1c')](_0x13004a)['send'](_0x49e287);};}exports[_0x1435('0x2a')]=function(_0x18f31b,_0x571e2c){var _0x799fef={},_0x2b1c98={},_0x305f1c={'count':0x0,'rows':[]};var _0x57361b=_[_0x1435('0x2b')](db['SalesforceConfiguration']['rawAttributes'],function(_0x5c7067){return{'name':_0x5c7067['fieldName'],'type':_0x5c7067['type']['key']};});_0x2b1c98[_0x1435('0x2c')]=_['map'](_0x57361b,_0x1435('0x2d'));_0x2b1c98[_0x1435('0x2e')]=_['keys'](_0x18f31b['query']);_0x2b1c98['filters']=_['intersection'](_0x2b1c98[_0x1435('0x2c')],_0x2b1c98[_0x1435('0x2e')]);_0x799fef['attributes']=_['intersection'](_0x2b1c98[_0x1435('0x2c')],qs[_0x1435('0x2f')](_0x18f31b[_0x1435('0x2e')][_0x1435('0x2f')]));_0x799fef['attributes']=_0x799fef[_0x1435('0x30')][_0x1435('0x31')]?_0x799fef[_0x1435('0x30')]:_0x2b1c98[_0x1435('0x2c')];if(!_0x18f31b[_0x1435('0x2e')][_0x1435('0x32')]('nolimit')){_0x799fef[_0x1435('0x21')]=qs['limit'](_0x18f31b[_0x1435('0x2e')]['limit']);_0x799fef[_0x1435('0x1f')]=qs[_0x1435('0x1f')](_0x18f31b[_0x1435('0x2e')]['offset']);}_0x799fef[_0x1435('0x33')]=qs['sort'](_0x18f31b['query']['sort']);_0x799fef[_0x1435('0x34')]=qs[_0x1435('0x35')](_[_0x1435('0x36')](_0x18f31b[_0x1435('0x2e')],_0x2b1c98[_0x1435('0x35')]),_0x57361b);if(_0x18f31b[_0x1435('0x2e')][_0x1435('0x37')]){_0x799fef['where']=_['merge'](_0x799fef[_0x1435('0x34')],{'$or':_['map'](_0x57361b,function(_0x52e9d6){if(_0x52e9d6[_0x1435('0x38')]!==_0x1435('0x39')){var _0x25b856={};_0x25b856[_0x52e9d6[_0x1435('0x2d')]]={'$like':'%'+_0x18f31b[_0x1435('0x2e')][_0x1435('0x37')]+'%'};return _0x25b856;}})});}_0x799fef=_[_0x1435('0x3a')]({},_0x799fef,_0x18f31b[_0x1435('0x3b')]);var _0x191e7d={'where':_0x799fef[_0x1435('0x34')]};return db['SalesforceConfiguration'][_0x1435('0x22')](_0x191e7d)[_0x1435('0x28')](function(_0x4c8cbe){_0x305f1c['count']=_0x4c8cbe;if(_0x18f31b[_0x1435('0x2e')][_0x1435('0x3c')]){_0x799fef[_0x1435('0x3d')]=[{'all':!![]}];}return db[_0x1435('0x3e')][_0x1435('0x3f')](_0x799fef);})['then'](function(_0xce21ac){_0x305f1c['rows']=_0xce21ac;return _0x305f1c;})[_0x1435('0x28')](respondWithFilteredResult(_0x571e2c,_0x799fef))['catch'](handleError(_0x571e2c,null));};exports[_0x1435('0x40')]=function(_0x191302,_0x3eb056){var _0xa6ee1c={'raw':![],'where':{'id':_0x191302['params']['id']}},_0x18b314={};_0x18b314[_0x1435('0x2c')]=_['keys'](db[_0x1435('0x3e')]['rawAttributes']);_0x18b314[_0x1435('0x2e')]=_['keys'](_0x191302[_0x1435('0x2e')]);_0x18b314[_0x1435('0x35')]=_[_0x1435('0x41')](_0x18b314['model'],_0x18b314['query']);_0xa6ee1c[_0x1435('0x30')]=_[_0x1435('0x41')](_0x18b314['model'],qs['fields'](_0x191302[_0x1435('0x2e')][_0x1435('0x2f')]));_0xa6ee1c['attributes']=_0xa6ee1c[_0x1435('0x30')][_0x1435('0x31')]?_0xa6ee1c[_0x1435('0x30')]:_0x18b314[_0x1435('0x2c')];if(_0x191302[_0x1435('0x2e')][_0x1435('0x3c')]){_0xa6ee1c[_0x1435('0x3d')]=[{'all':!![]}];}_0xa6ee1c=_[_0x1435('0x3a')]({},_0xa6ee1c,_0x191302[_0x1435('0x3b')]);return db[_0x1435('0x3e')]['find'](_0xa6ee1c)['then'](handleEntityNotFound(_0x3eb056,null))[_0x1435('0x28')](respondWithResult(_0x3eb056,null))['catch'](handleError(_0x3eb056,null));};exports['create']=function(_0x46ffe1,_0x32d25b){return db['SalesforceConfiguration'][_0x1435('0x42')](_0x46ffe1[_0x1435('0x43')],{})['then'](respondWithResult(_0x32d25b,0xc9))[_0x1435('0x44')](handleError(_0x32d25b,null));};exports[_0x1435('0x45')]=function(_0x47f29d,_0x5cf6e2){if(_0x47f29d[_0x1435('0x43')]['id']){delete _0x47f29d[_0x1435('0x43')]['id'];}return db[_0x1435('0x3e')][_0x1435('0x46')]({'where':{'id':_0x47f29d[_0x1435('0x47')]['id']}})[_0x1435('0x28')](handleEntityNotFound(_0x5cf6e2,null))[_0x1435('0x28')](saveUpdates(_0x47f29d[_0x1435('0x43')],null))[_0x1435('0x28')](respondWithResult(_0x5cf6e2,null))['catch'](handleError(_0x5cf6e2,null));};exports['destroy']=function(_0x359e36,_0x2f9a9f){return db[_0x1435('0x3e')]['find']({'where':{'id':_0x359e36[_0x1435('0x47')]['id']}})[_0x1435('0x28')](handleEntityNotFound(_0x2f9a9f,null))['then'](removeEntity(_0x2f9a9f,null))['catch'](handleError(_0x2f9a9f,null));};exports[_0x1435('0x48')]=function(_0x1ba84a,_0x3d3457,_0x118363){var _0x186da2={};var _0xe6bcb4={};var _0x275f32;var _0x226929;return db['SalesforceConfiguration'][_0x1435('0x49')]({'where':{'id':_0x1ba84a[_0x1435('0x47')]['id']}})[_0x1435('0x28')](handleEntityNotFound(_0x3d3457,null))[_0x1435('0x28')](function(_0x2ca570){if(_0x2ca570){_0x275f32=_0x2ca570;_0xe6bcb4[_0x1435('0x2c')]=_[_0x1435('0x4a')](db['SalesforceField']['rawAttributes']);_0xe6bcb4[_0x1435('0x2e')]=_[_0x1435('0x4a')](_0x1ba84a[_0x1435('0x2e')]);_0xe6bcb4[_0x1435('0x35')]=_['intersection'](_0xe6bcb4[_0x1435('0x2c')],_0xe6bcb4[_0x1435('0x2e')]);_0x186da2['attributes']=_[_0x1435('0x41')](_0xe6bcb4['model'],qs[_0x1435('0x2f')](_0x1ba84a[_0x1435('0x2e')][_0x1435('0x2f')]));_0x186da2[_0x1435('0x30')]=_0x186da2[_0x1435('0x30')][_0x1435('0x31')]?_0x186da2['attributes']:_0xe6bcb4[_0x1435('0x2c')];_0x186da2[_0x1435('0x33')]=qs['sort'](_0x1ba84a[_0x1435('0x2e')][_0x1435('0x4b')]);_0x186da2[_0x1435('0x34')]=qs[_0x1435('0x35')](_[_0x1435('0x36')](_0x1ba84a[_0x1435('0x2e')],_0xe6bcb4[_0x1435('0x35')]));if(_0x1ba84a['query'][_0x1435('0x37')]){_0x186da2[_0x1435('0x34')]=_[_0x1435('0x3a')](_0x186da2['where'],{'$or':_[_0x1435('0x2b')](_0x186da2[_0x1435('0x30')],function(_0x468d61){var _0x2e6355={};_0x2e6355[_0x468d61]={'$like':'%'+_0x1ba84a[_0x1435('0x2e')]['filter']+'%'};return _0x2e6355;})});}_0x186da2=_[_0x1435('0x3a')]({},_0x186da2,_0x1ba84a[_0x1435('0x3b')]);return _0x275f32['getFields'](_0x186da2);}})[_0x1435('0x28')](function(_0x74f403){if(_0x74f403){_0x226929=_0x74f403['length'];if(!_0x1ba84a['query']['hasOwnProperty']('nolimit')){_0x186da2[_0x1435('0x21')]=qs[_0x1435('0x21')](_0x1ba84a[_0x1435('0x2e')][_0x1435('0x21')]);_0x186da2[_0x1435('0x1f')]=qs[_0x1435('0x1f')](_0x1ba84a[_0x1435('0x2e')][_0x1435('0x1f')]);}return _0x275f32[_0x1435('0x48')](_0x186da2);}})[_0x1435('0x28')](function(_0x1292a0){if(_0x1292a0){return _0x1292a0?{'count':_0x226929,'rows':_0x1292a0}:null;}})[_0x1435('0x28')](respondWithResult(_0x3d3457,null))[_0x1435('0x44')](handleError(_0x3d3457,null));};exports[_0x1435('0x4c')]=function(_0x256e53,_0x1547d1,_0x515330){var _0x4fa624={};var _0x9b60d1={};var _0x12cd11;var _0x37b16d;return db[_0x1435('0x3e')][_0x1435('0x49')]({'where':{'id':_0x256e53['params']['id']}})[_0x1435('0x28')](handleEntityNotFound(_0x1547d1,null))[_0x1435('0x28')](function(_0x57aeb8){if(_0x57aeb8){_0x12cd11=_0x57aeb8;_0x9b60d1[_0x1435('0x2c')]=_['keys'](db[_0x1435('0x4d')][_0x1435('0x4e')]);_0x9b60d1[_0x1435('0x2e')]=_[_0x1435('0x4a')](_0x256e53[_0x1435('0x2e')]);_0x9b60d1[_0x1435('0x35')]=_['intersection'](_0x9b60d1['model'],_0x9b60d1[_0x1435('0x2e')]);_0x4fa624[_0x1435('0x30')]=_[_0x1435('0x41')](_0x9b60d1[_0x1435('0x2c')],qs['fields'](_0x256e53[_0x1435('0x2e')][_0x1435('0x2f')]));_0x4fa624[_0x1435('0x30')]=_0x4fa624[_0x1435('0x30')]['length']?_0x4fa624[_0x1435('0x30')]:_0x9b60d1[_0x1435('0x2c')];_0x4fa624[_0x1435('0x33')]=qs[_0x1435('0x4b')](_0x256e53[_0x1435('0x2e')][_0x1435('0x4b')]);_0x4fa624[_0x1435('0x34')]=qs['filters'](_[_0x1435('0x36')](_0x256e53[_0x1435('0x2e')],_0x9b60d1[_0x1435('0x35')]));if(_0x256e53['query'][_0x1435('0x37')]){_0x4fa624[_0x1435('0x34')]=_['merge'](_0x4fa624['where'],{'$or':_[_0x1435('0x2b')](_0x4fa624[_0x1435('0x30')],function(_0x394913){var _0x531bcf={};_0x531bcf[_0x394913]={'$like':'%'+_0x256e53[_0x1435('0x2e')][_0x1435('0x37')]+'%'};return _0x531bcf;})});}_0x4fa624=_[_0x1435('0x3a')]({},_0x4fa624,_0x256e53['options']);return _0x12cd11[_0x1435('0x4c')](_0x4fa624);}})[_0x1435('0x28')](function(_0x71503a){if(_0x71503a){_0x37b16d=_0x71503a['length'];if(!_0x256e53['query']['hasOwnProperty'](_0x1435('0x4f'))){_0x4fa624[_0x1435('0x21')]=qs[_0x1435('0x21')](_0x256e53['query'][_0x1435('0x21')]);_0x4fa624[_0x1435('0x1f')]=qs[_0x1435('0x1f')](_0x256e53[_0x1435('0x2e')]['offset']);}return _0x12cd11[_0x1435('0x4c')](_0x4fa624);}})[_0x1435('0x28')](function(_0x5c1a5e){if(_0x5c1a5e){return _0x5c1a5e?{'count':_0x37b16d,'rows':_0x5c1a5e}:null;}})[_0x1435('0x28')](respondWithResult(_0x1547d1,null))[_0x1435('0x44')](handleError(_0x1547d1,null));};exports[_0x1435('0x50')]=function(_0xf11a41,_0x268f0c,_0x27fbcd){var _0x2b1719={};var _0x5c3616={};var _0x44a1d1;var _0x38171f;return db[_0x1435('0x3e')]['findOne']({'where':{'id':_0xf11a41['params']['id']}})[_0x1435('0x28')](handleEntityNotFound(_0x268f0c,null))[_0x1435('0x28')](function(_0x5977e5){if(_0x5977e5){_0x44a1d1=_0x5977e5;_0x5c3616[_0x1435('0x2c')]=_[_0x1435('0x4a')](db['SalesforceField'][_0x1435('0x4e')]);_0x5c3616[_0x1435('0x2e')]=_[_0x1435('0x4a')](_0xf11a41[_0x1435('0x2e')]);_0x5c3616[_0x1435('0x35')]=_[_0x1435('0x41')](_0x5c3616['model'],_0x5c3616[_0x1435('0x2e')]);_0x2b1719['attributes']=_[_0x1435('0x41')](_0x5c3616[_0x1435('0x2c')],qs['fields'](_0xf11a41[_0x1435('0x2e')][_0x1435('0x2f')]));_0x2b1719['attributes']=_0x2b1719[_0x1435('0x30')][_0x1435('0x31')]?_0x2b1719[_0x1435('0x30')]:_0x5c3616[_0x1435('0x2c')];_0x2b1719[_0x1435('0x33')]=qs[_0x1435('0x4b')](_0xf11a41['query']['sort']);_0x2b1719[_0x1435('0x34')]=qs['filters'](_['pick'](_0xf11a41['query'],_0x5c3616[_0x1435('0x35')]));if(_0xf11a41['query'][_0x1435('0x37')]){_0x2b1719[_0x1435('0x34')]=_[_0x1435('0x3a')](_0x2b1719[_0x1435('0x34')],{'$or':_[_0x1435('0x2b')](_0x2b1719[_0x1435('0x30')],function(_0x170bcc){var _0x52571c={};_0x52571c[_0x170bcc]={'$like':'%'+_0xf11a41[_0x1435('0x2e')][_0x1435('0x37')]+'%'};return _0x52571c;})});}_0x2b1719=_[_0x1435('0x3a')]({},_0x2b1719,_0xf11a41[_0x1435('0x3b')]);return _0x44a1d1[_0x1435('0x50')](_0x2b1719);}})[_0x1435('0x28')](function(_0x591f98){if(_0x591f98){_0x38171f=_0x591f98['length'];if(!_0xf11a41[_0x1435('0x2e')][_0x1435('0x32')](_0x1435('0x4f'))){_0x2b1719[_0x1435('0x21')]=qs[_0x1435('0x21')](_0xf11a41[_0x1435('0x2e')][_0x1435('0x21')]);_0x2b1719[_0x1435('0x1f')]=qs['offset'](_0xf11a41[_0x1435('0x2e')][_0x1435('0x1f')]);}return _0x44a1d1[_0x1435('0x50')](_0x2b1719);}})[_0x1435('0x28')](function(_0x1fa4e3){if(_0x1fa4e3){return _0x1fa4e3?{'count':_0x38171f,'rows':_0x1fa4e3}:null;}})[_0x1435('0x28')](respondWithResult(_0x268f0c,null))[_0x1435('0x44')](handleError(_0x268f0c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f19ba61..b5c7dfd 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 _0xb1aa=['SalesforceConfiguration','int_salesforce_configurations','util','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x46563e,_0x36c7d3){var _0x339dc4=function(_0x74a5b6){while(--_0x74a5b6){_0x46563e['push'](_0x46563e['shift']());}};_0x339dc4(++_0x36c7d3);}(_0xb1aa,0x91));var _0xab1a=function(_0x55d50f,_0xd4a783){_0x55d50f=_0x55d50f-0x0;var _0x18d28a=_0xb1aa[_0x55d50f];return _0x18d28a;};'use strict';var _=require('lodash');var util=require(_0xab1a('0x0'));var logger=require('../../config/logger')(_0xab1a('0x1'));var moment=require(_0xab1a('0x2'));var BPromise=require(_0xab1a('0x3'));var rp=require(_0xab1a('0x4'));var fs=require('fs');var path=require(_0xab1a('0x5'));var rimraf=require(_0xab1a('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0xab1a('0x7')]=function(_0x417d99,_0xa7ebcf){return _0x417d99[_0xab1a('0x8')](_0xab1a('0x9'),attributes,{'tableName':_0xab1a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf58e=['api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','lodash','../../config/logger'];(function(_0x3cd9fd,_0x43996f){var _0x4b75a3=function(_0x4ae405){while(--_0x4ae405){_0x3cd9fd['push'](_0x3cd9fd['shift']());}};_0x4b75a3(++_0x43996f);}(_0xf58e,0x17f));var _0xef58=function(_0x3cd09e,_0x459a9c){_0x3cd09e=_0x3cd09e-0x0;var _0x41dba5=_0xf58e[_0x3cd09e];return _0x41dba5;};'use strict';var _=require(_0xef58('0x0'));var util=require('util');var logger=require(_0xef58('0x1'))(_0xef58('0x2'));var moment=require(_0xef58('0x3'));var BPromise=require('bluebird');var rp=require(_0xef58('0x4'));var fs=require('fs');var path=require(_0xef58('0x5'));var rimraf=require(_0xef58('0x6'));var config=require(_0xef58('0x7'));var attributes=require(_0xef58('0x8'));module['exports']=function(_0x1f5215,_0x5a7a30){return _0x1f5215[_0xef58('0x9')](_0xef58('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 3a67200..f4b1a13 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 _0x1526=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x6496d5,_0x309320){var _0x4e753f=function(_0x52c059){while(--_0x52c059){_0x6496d5['push'](_0x6496d5['shift']());}};_0x4e753f(++_0x309320);}(_0x1526,0xaa));var _0x6152=function(_0x345d70,_0x93524c){_0x345d70=_0x345d70-0x0;var _0x3d40c5=_0x1526[_0x345d70];return _0x3d40c5;};'use strict';var _=require(_0x6152('0x0'));var util=require(_0x6152('0x1'));var moment=require(_0x6152('0x2'));var BPromise=require('bluebird');var rs=require(_0x6152('0x3'));var fs=require('fs');var Redis=require(_0x6152('0x4'));var db=require(_0x6152('0x5'))['db'];var utils=require(_0x6152('0x6'));var logger=require(_0x6152('0x7'))('rpc');var config=require(_0x6152('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6152('0x9')][_0x6152('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df234,_0x13fbb0,_0x362ac1){return new BPromise(function(_0x1c366f,_0x36057c){return client[_0x6152('0xb')](_0x2df234,_0x362ac1)[_0x6152('0xc')](function(_0x369116){logger[_0x6152('0xd')](_0x6152('0xe'),_0x13fbb0,_0x6152('0xf'));logger[_0x6152('0x10')](_0x6152('0x11'),_0x13fbb0,_0x6152('0xf'),JSON[_0x6152('0x12')](_0x369116));if(_0x369116[_0x6152('0x13')]){if(_0x369116[_0x6152('0x13')]['code']===0x1f4){logger[_0x6152('0x13')](_0x6152('0xe'),_0x13fbb0,_0x369116[_0x6152('0x13')][_0x6152('0x14')]);return _0x36057c(_0x369116[_0x6152('0x13')][_0x6152('0x14')]);}logger[_0x6152('0x13')](_0x6152('0xe'),_0x13fbb0,_0x369116[_0x6152('0x13')][_0x6152('0x14')]);return _0x1c366f(_0x369116[_0x6152('0x13')]['message']);}else{logger[_0x6152('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x13fbb0,_0x6152('0xf'));_0x1c366f(_0x369116['result'][_0x6152('0x14')]);}})[_0x6152('0x15')](function(_0x3c7e0c){logger[_0x6152('0x13')](_0x6152('0xe'),_0x13fbb0,_0x3c7e0c);_0x36057c(_0x3c7e0c);});});} \ No newline at end of file +var _0xee96=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0xee96,0xd2));var _0x6ee9=function(_0x4f9381,_0x52e4a7){_0x4f9381=_0x4f9381-0x0;var _0x36ca36=_0xee96[_0x4f9381];return _0x36ca36;};'use strict';var _=require(_0x6ee9('0x0'));var util=require(_0x6ee9('0x1'));var moment=require(_0x6ee9('0x2'));var BPromise=require('bluebird');var rs=require(_0x6ee9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ee9('0x4'))['db'];var utils=require(_0x6ee9('0x5'));var logger=require(_0x6ee9('0x6'))(_0x6ee9('0x7'));var config=require('../../config/environment');var jayson=require(_0x6ee9('0x8'));var client=jayson[_0x6ee9('0x9')][_0x6ee9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x302d00,_0x219e01,_0x40e23a){return new BPromise(function(_0x6b00e7,_0x2573db){return client['request'](_0x302d00,_0x40e23a)['then'](function(_0x5c4cf6){logger[_0x6ee9('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x219e01,_0x6ee9('0xc'));logger['debug'](_0x6ee9('0xd'),_0x219e01,'request\x20sent',JSON[_0x6ee9('0xe')](_0x5c4cf6));if(_0x5c4cf6[_0x6ee9('0xf')]){if(_0x5c4cf6[_0x6ee9('0xf')][_0x6ee9('0x10')]===0x1f4){logger[_0x6ee9('0xf')](_0x6ee9('0x11'),_0x219e01,_0x5c4cf6[_0x6ee9('0xf')][_0x6ee9('0x12')]);return _0x2573db(_0x5c4cf6[_0x6ee9('0xf')][_0x6ee9('0x12')]);}logger[_0x6ee9('0xf')](_0x6ee9('0x11'),_0x219e01,_0x5c4cf6[_0x6ee9('0xf')][_0x6ee9('0x12')]);return _0x6b00e7(_0x5c4cf6[_0x6ee9('0xf')][_0x6ee9('0x12')]);}else{logger[_0x6ee9('0xb')](_0x6ee9('0x11'),_0x219e01,_0x6ee9('0xc'));_0x6b00e7(_0x5c4cf6[_0x6ee9('0x13')][_0x6ee9('0x12')]);}})[_0x6ee9('0x14')](function(_0x2f6692){logger[_0x6ee9('0xf')](_0x6ee9('0x11'),_0x219e01,_0x2f6692);_0x2573db(_0x2f6692);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index becf687..af3648d 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 _0x5a23=['../../config/environment','get','isAuthenticated','post','create','put','update','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x518b99,_0x4333e4){var _0x45faed=function(_0x48efa3){while(--_0x48efa3){_0x518b99['push'](_0x518b99['shift']());}};_0x45faed(++_0x4333e4);}(_0x5a23,0x16a));var _0x35a2=function(_0x50a925,_0x25ca8d){_0x50a925=_0x50a925-0x0;var _0x5d2be4=_0x5a23[_0x50a925];return _0x5d2be4;};'use strict';var multer=require(_0x35a2('0x0'));var util=require(_0x35a2('0x1'));var path=require(_0x35a2('0x2'));var timeout=require('connect-timeout');var express=require(_0x35a2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x35a2('0x4'));var interaction=require(_0x35a2('0x5'));var config=require(_0x35a2('0x6'));var controller=require('./intSalesforceField.controller');router[_0x35a2('0x7')]('/',auth[_0x35a2('0x8')](),controller['index']);router['get']('/:id',auth[_0x35a2('0x8')](),controller['show']);router[_0x35a2('0x9')]('/',auth[_0x35a2('0x8')](),controller[_0x35a2('0xa')]);router[_0x35a2('0xb')]('/:id',auth[_0x35a2('0x8')](),controller[_0x35a2('0xc')]);router['delete'](_0x35a2('0xd'),auth[_0x35a2('0x8')](),controller[_0x35a2('0xe')]);module[_0x35a2('0xf')]=router; \ No newline at end of file +var _0x33d9=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports'];(function(_0x111165,_0x4f9303){var _0x64f7b6=function(_0x400882){while(--_0x400882){_0x111165['push'](_0x111165['shift']());}};_0x64f7b6(++_0x4f9303);}(_0x33d9,0x10e));var _0x933d=function(_0x11255b,_0x186cbc){_0x11255b=_0x11255b-0x0;var _0x492947=_0x33d9[_0x11255b];return _0x492947;};'use strict';var multer=require(_0x933d('0x0'));var util=require('util');var path=require(_0x933d('0x1'));var timeout=require('connect-timeout');var express=require(_0x933d('0x2'));var router=express[_0x933d('0x3')]();var fs_extra=require(_0x933d('0x4'));var auth=require(_0x933d('0x5'));var interaction=require(_0x933d('0x6'));var config=require(_0x933d('0x7'));var controller=require(_0x933d('0x8'));router[_0x933d('0x9')]('/',auth[_0x933d('0xa')](),controller[_0x933d('0xb')]);router['get']('/:id',auth[_0x933d('0xa')](),controller['show']);router['post']('/',auth[_0x933d('0xa')](),controller[_0x933d('0xc')]);router[_0x933d('0xd')](_0x933d('0xe'),auth[_0x933d('0xa')](),controller[_0x933d('0xf')]);router[_0x933d('0x10')](_0x933d('0xe'),auth[_0x933d('0xa')](),controller['destroy']);module[_0x933d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 7b17b6c..f01058e 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 _0xd8f5=['string','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x3d94c8,_0x3ac426){var _0x73dc8a=function(_0x4145f1){while(--_0x4145f1){_0x3d94c8['push'](_0x3d94c8['shift']());}};_0x73dc8a(++_0x3ac426);}(_0xd8f5,0x107));var _0x5d8f=function(_0xcb55e,_0x460720){_0xcb55e=_0xcb55e-0x0;var _0x219298=_0xd8f5[_0xcb55e];return _0x219298;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5d8f('0x0')](_0x5d8f('0x1'),'variable',_0x5d8f('0x2'),_0x5d8f('0x3'),_0x5d8f('0x4')),'defaultValue':_0x5d8f('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5d8f('0x5')]},'keyType':{'type':Sequelize[_0x5d8f('0x0')](_0x5d8f('0x1'),'variable',_0x5d8f('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5d8f('0x5')]},'variableName':{'type':Sequelize[_0x5d8f('0x5')]}}; \ No newline at end of file +var _0x0ea2=['picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x1f2dda,_0x539c5f){var _0x29b49e=function(_0x4cba4f){while(--_0x4cba4f){_0x1f2dda['push'](_0x1f2dda['shift']());}};_0x29b49e(++_0x539c5f);}(_0x0ea2,0x123));var _0x20ea=function(_0x5dfc69,_0x137b1d){_0x5dfc69=_0x5dfc69-0x0;var _0xa03233=_0x0ea2[_0x5dfc69];return _0xa03233;};'use strict';var Sequelize=require(_0x20ea('0x0'));module[_0x20ea('0x1')]={'type':{'type':Sequelize[_0x20ea('0x2')]('string',_0x20ea('0x3'),_0x20ea('0x4'),_0x20ea('0x5'),_0x20ea('0x6')),'defaultValue':_0x20ea('0x7')},'content':{'type':Sequelize[_0x20ea('0x8')]},'key':{'type':Sequelize[_0x20ea('0x8')]},'keyType':{'type':Sequelize[_0x20ea('0x2')](_0x20ea('0x7'),_0x20ea('0x3'),_0x20ea('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x20ea('0x8')]},'variableName':{'type':Sequelize[_0x20ea('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 7c67803..6f5323f 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 _0x60b6=['desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','fieldName','type','model','query','filters','attributes','intersection','fields','length','order','sort','filter','merge','where','options','SalesforceField','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','include','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4f103e,_0x284aaf){var _0x474b4d=function(_0x1448ae){while(--_0x1448ae){_0x4f103e['push'](_0x4f103e['shift']());}};_0x474b4d(++_0x284aaf);}(_0x60b6,0xca));var _0x660b=function(_0x50396a,_0x191090){_0x50396a=_0x50396a-0x0;var _0x14bf4a=_0x60b6[_0x50396a];return _0x14bf4a;};'use strict';var emlformat=require(_0x660b('0x0'));var rimraf=require(_0x660b('0x1'));var zipdir=require(_0x660b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x660b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x660b('0x4'));var util=require(_0x660b('0x5'));var path=require('path');var sox=require(_0x660b('0x6'));var csv=require(_0x660b('0x7'));var ejs=require(_0x660b('0x8'));var fs=require('fs');var fs_extra=require(_0x660b('0x9'));var _=require(_0x660b('0xa'));var squel=require(_0x660b('0xb'));var crypto=require(_0x660b('0xc'));var jsforce=require(_0x660b('0xd'));var deskjs=require(_0x660b('0xe'));var toCsv=require(_0x660b('0x7'));var querystring=require(_0x660b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x660b('0x10'));var qs=require(_0x660b('0x11'));var as=require(_0x660b('0x12'));var hardwareService=require(_0x660b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x660b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x660b('0x15'));var db=require(_0x660b('0x16'))['db'];function respondWithStatusCode(_0x18943d,_0x2ca29a){_0x2ca29a=_0x2ca29a||0xcc;return function(_0x2c64fd){if(_0x2c64fd){return _0x18943d[_0x660b('0x17')](_0x2ca29a);}return _0x18943d[_0x660b('0x18')](_0x2ca29a)[_0x660b('0x19')]();};}function respondWithResult(_0x5f4472,_0x58527e){_0x58527e=_0x58527e||0xc8;return function(_0xaead04){if(_0xaead04){return _0x5f4472[_0x660b('0x18')](_0x58527e)[_0x660b('0x1a')](_0xaead04);}};}function respondWithFilteredResult(_0x1c1e65,_0x4c333f){return function(_0x1a4258){if(_0x1a4258){var _0x1224b7=typeof _0x4c333f[_0x660b('0x1b')]===_0x660b('0x1c')&&typeof _0x4c333f[_0x660b('0x1d')]===_0x660b('0x1c');var _0x4b9123=_0x1a4258[_0x660b('0x1e')];var _0x31f5e5=_0x1224b7?0x0:_0x4c333f[_0x660b('0x1b')];var _0x2dc232=_0x1224b7?_0x1a4258[_0x660b('0x1e')]:_0x4c333f['offset']+_0x4c333f[_0x660b('0x1d')];var _0x2fae9f;if(_0x2dc232>=_0x4b9123){_0x2dc232=_0x4b9123;_0x2fae9f=0xc8;}else{_0x2fae9f=0xce;}_0x1c1e65['status'](_0x2fae9f);return _0x1c1e65[_0x660b('0x1f')](_0x660b('0x20'),_0x31f5e5+'-'+_0x2dc232+'/'+_0x4b9123)['json'](_0x1a4258);}return null;};}function patchUpdates(_0x3b86e4){return function(_0x3d9311){try{jsonpatch[_0x660b('0x21')](_0x3d9311,_0x3b86e4,!![]);}catch(_0x46fcc3){return BPromise[_0x660b('0x22')](_0x46fcc3);}return _0x3d9311[_0x660b('0x23')]();};}function saveUpdates(_0x40b805,_0xdcb44b){return function(_0x48eb3e){if(_0x48eb3e){return _0x48eb3e[_0x660b('0x24')](_0x40b805)[_0x660b('0x25')](function(_0x275668){return _0x275668;});}return null;};}function removeEntity(_0x560fa7,_0x3a019f){return function(_0x2b4128){if(_0x2b4128){return _0x2b4128['destroy']()['then'](function(){_0x560fa7[_0x660b('0x18')](0xcc)[_0x660b('0x19')]();});}};}function handleEntityNotFound(_0x4e01fc,_0x32426b){return function(_0xd7d02e){if(!_0xd7d02e){_0x4e01fc[_0x660b('0x17')](0x194);}return _0xd7d02e;};}function handleError(_0xe4fa57,_0x70e04c){_0x70e04c=_0x70e04c||0x1f4;return function(_0x50ce4a){logger[_0x660b('0x26')](_0x50ce4a[_0x660b('0x27')]);if(_0x50ce4a[_0x660b('0x28')]){delete _0x50ce4a[_0x660b('0x28')];}_0xe4fa57[_0x660b('0x18')](_0x70e04c)['send'](_0x50ce4a);};}exports[_0x660b('0x29')]=function(_0x278e3f,_0x3b9dec){var _0x2e4ece={},_0x462cf4={},_0x1dc6f6={'count':0x0,'rows':[]};var _0x45217a=_[_0x660b('0x2a')](db['SalesforceField']['rawAttributes'],function(_0x1b290e){return{'name':_0x1b290e[_0x660b('0x2b')],'type':_0x1b290e[_0x660b('0x2c')]['key']};});_0x462cf4[_0x660b('0x2d')]=_[_0x660b('0x2a')](_0x45217a,_0x660b('0x28'));_0x462cf4[_0x660b('0x2e')]=_['keys'](_0x278e3f[_0x660b('0x2e')]);_0x462cf4[_0x660b('0x2f')]=_['intersection'](_0x462cf4[_0x660b('0x2d')],_0x462cf4['query']);_0x2e4ece[_0x660b('0x30')]=_[_0x660b('0x31')](_0x462cf4['model'],qs['fields'](_0x278e3f[_0x660b('0x2e')][_0x660b('0x32')]));_0x2e4ece['attributes']=_0x2e4ece['attributes'][_0x660b('0x33')]?_0x2e4ece['attributes']:_0x462cf4[_0x660b('0x2d')];if(!_0x278e3f[_0x660b('0x2e')]['hasOwnProperty']('nolimit')){_0x2e4ece[_0x660b('0x1d')]=qs['limit'](_0x278e3f['query'][_0x660b('0x1d')]);_0x2e4ece[_0x660b('0x1b')]=qs[_0x660b('0x1b')](_0x278e3f['query'][_0x660b('0x1b')]);}_0x2e4ece[_0x660b('0x34')]=qs[_0x660b('0x35')](_0x278e3f[_0x660b('0x2e')][_0x660b('0x35')]);_0x2e4ece['where']=qs[_0x660b('0x2f')](_['pick'](_0x278e3f['query'],_0x462cf4[_0x660b('0x2f')]),_0x45217a);if(_0x278e3f[_0x660b('0x2e')][_0x660b('0x36')]){_0x2e4ece['where']=_[_0x660b('0x37')](_0x2e4ece[_0x660b('0x38')],{'$or':_[_0x660b('0x2a')](_0x45217a,function(_0x8bd15f){if(_0x8bd15f[_0x660b('0x2c')]!=='VIRTUAL'){var _0x398f61={};_0x398f61[_0x8bd15f[_0x660b('0x28')]]={'$like':'%'+_0x278e3f[_0x660b('0x2e')][_0x660b('0x36')]+'%'};return _0x398f61;}})});}_0x2e4ece=_[_0x660b('0x37')]({},_0x2e4ece,_0x278e3f[_0x660b('0x39')]);var _0x16f2a2={'where':_0x2e4ece[_0x660b('0x38')]};return db[_0x660b('0x3a')][_0x660b('0x1e')](_0x16f2a2)['then'](function(_0x177d25){_0x1dc6f6[_0x660b('0x1e')]=_0x177d25;if(_0x278e3f[_0x660b('0x2e')][_0x660b('0x3b')]){_0x2e4ece['include']=[{'all':!![]}];}return db['SalesforceField'][_0x660b('0x3c')](_0x2e4ece);})[_0x660b('0x25')](function(_0x7503ee){_0x1dc6f6[_0x660b('0x3d')]=_0x7503ee;return _0x1dc6f6;})[_0x660b('0x25')](respondWithFilteredResult(_0x3b9dec,_0x2e4ece))[_0x660b('0x3e')](handleError(_0x3b9dec,null));};exports[_0x660b('0x3f')]=function(_0xcb79af,_0x5654bb){var _0x576fc5={'raw':!![],'where':{'id':_0xcb79af[_0x660b('0x40')]['id']}},_0x5255ee={};_0x5255ee[_0x660b('0x2d')]=_['keys'](db['SalesforceField'][_0x660b('0x41')]);_0x5255ee[_0x660b('0x2e')]=_[_0x660b('0x42')](_0xcb79af['query']);_0x5255ee[_0x660b('0x2f')]=_[_0x660b('0x31')](_0x5255ee[_0x660b('0x2d')],_0x5255ee[_0x660b('0x2e')]);_0x576fc5[_0x660b('0x30')]=_['intersection'](_0x5255ee[_0x660b('0x2d')],qs['fields'](_0xcb79af[_0x660b('0x2e')][_0x660b('0x32')]));_0x576fc5['attributes']=_0x576fc5['attributes']['length']?_0x576fc5['attributes']:_0x5255ee['model'];if(_0xcb79af[_0x660b('0x2e')][_0x660b('0x3b')]){_0x576fc5[_0x660b('0x43')]=[{'all':!![]}];}_0x576fc5=_[_0x660b('0x37')]({},_0x576fc5,_0xcb79af[_0x660b('0x39')]);return db[_0x660b('0x3a')][_0x660b('0x44')](_0x576fc5)[_0x660b('0x25')](handleEntityNotFound(_0x5654bb,null))[_0x660b('0x25')](respondWithResult(_0x5654bb,null))[_0x660b('0x3e')](handleError(_0x5654bb,null));};exports['create']=function(_0x1b035c,_0xa75762){return db[_0x660b('0x3a')][_0x660b('0x45')](_0x1b035c[_0x660b('0x46')],{})[_0x660b('0x25')](respondWithResult(_0xa75762,0xc9))[_0x660b('0x3e')](handleError(_0xa75762,null));};exports[_0x660b('0x24')]=function(_0x487239,_0x1c14b3){if(_0x487239[_0x660b('0x46')]['id']){delete _0x487239[_0x660b('0x46')]['id'];}return db['SalesforceField'][_0x660b('0x44')]({'where':{'id':_0x487239[_0x660b('0x40')]['id']}})[_0x660b('0x25')](handleEntityNotFound(_0x1c14b3,null))[_0x660b('0x25')](saveUpdates(_0x487239[_0x660b('0x46')],null))[_0x660b('0x25')](respondWithResult(_0x1c14b3,null))['catch'](handleError(_0x1c14b3,null));};exports[_0x660b('0x47')]=function(_0x1fcab6,_0xef2194){return db[_0x660b('0x3a')][_0x660b('0x44')]({'where':{'id':_0x1fcab6[_0x660b('0x40')]['id']}})['then'](handleEntityNotFound(_0xef2194,null))[_0x660b('0x25')](removeEntity(_0xef2194,null))[_0x660b('0x3e')](handleError(_0xef2194,null));}; \ No newline at end of file +var _0xe4ef=['model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','type','VIRTUAL','filter','merge','includeAll','rows','catch','params','intersection','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','destroy','then','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','key'];(function(_0x56568d,_0x2754bd){var _0x11b14d=function(_0x5c2df0){while(--_0x5c2df0){_0x56568d['push'](_0x56568d['shift']());}};_0x11b14d(++_0x2754bd);}(_0xe4ef,0x1e3));var _0xfe4e=function(_0x3a57d7,_0x5bb130){_0x3a57d7=_0x3a57d7-0x0;var _0x59aa46=_0xe4ef[_0x3a57d7];return _0x59aa46;};'use strict';var emlformat=require(_0xfe4e('0x0'));var rimraf=require(_0xfe4e('0x1'));var zipdir=require(_0xfe4e('0x2'));var jsonpatch=require(_0xfe4e('0x3'));var rp=require(_0xfe4e('0x4'));var moment=require(_0xfe4e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfe4e('0x6'));var util=require('util');var path=require(_0xfe4e('0x7'));var sox=require(_0xfe4e('0x8'));var csv=require(_0xfe4e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe4e('0xa'));var _=require(_0xfe4e('0xb'));var squel=require(_0xfe4e('0xc'));var crypto=require(_0xfe4e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfe4e('0xe'));var toCsv=require(_0xfe4e('0x9'));var querystring=require(_0xfe4e('0xf'));var Papa=require(_0xfe4e('0x10'));var Redis=require('ioredis');var authService=require(_0xfe4e('0x11'));var qs=require(_0xfe4e('0x12'));var as=require(_0xfe4e('0x13'));var hardwareService=require(_0xfe4e('0x14'));var logger=require(_0xfe4e('0x15'))(_0xfe4e('0x16'));var utils=require(_0xfe4e('0x17'));var config=require(_0xfe4e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe4e('0x19'))['db'];function respondWithStatusCode(_0x355c0d,_0x288527){_0x288527=_0x288527||0xcc;return function(_0x5bc7b5){if(_0x5bc7b5){return _0x355c0d[_0xfe4e('0x1a')](_0x288527);}return _0x355c0d[_0xfe4e('0x1b')](_0x288527)[_0xfe4e('0x1c')]();};}function respondWithResult(_0x243324,_0x18f69e){_0x18f69e=_0x18f69e||0xc8;return function(_0x371174){if(_0x371174){return _0x243324[_0xfe4e('0x1b')](_0x18f69e)[_0xfe4e('0x1d')](_0x371174);}};}function respondWithFilteredResult(_0x30700c,_0x420305){return function(_0x89b05a){if(_0x89b05a){var _0x32b811=typeof _0x420305['offset']===_0xfe4e('0x1e')&&typeof _0x420305[_0xfe4e('0x1f')]==='undefined';var _0x2b9e16=_0x89b05a[_0xfe4e('0x20')];var _0x179ab8=_0x32b811?0x0:_0x420305[_0xfe4e('0x21')];var _0x31fa87=_0x32b811?_0x89b05a[_0xfe4e('0x20')]:_0x420305[_0xfe4e('0x21')]+_0x420305[_0xfe4e('0x1f')];var _0x161c8b;if(_0x31fa87>=_0x2b9e16){_0x31fa87=_0x2b9e16;_0x161c8b=0xc8;}else{_0x161c8b=0xce;}_0x30700c[_0xfe4e('0x1b')](_0x161c8b);return _0x30700c['set']('Content-Range',_0x179ab8+'-'+_0x31fa87+'/'+_0x2b9e16)[_0xfe4e('0x1d')](_0x89b05a);}return null;};}function patchUpdates(_0x3b2b43){return function(_0x479c01){try{jsonpatch[_0xfe4e('0x22')](_0x479c01,_0x3b2b43,!![]);}catch(_0x505ab1){return BPromise[_0xfe4e('0x23')](_0x505ab1);}return _0x479c01[_0xfe4e('0x24')]();};}function saveUpdates(_0x2abe93,_0x5e556d){return function(_0x46ea75){if(_0x46ea75){return _0x46ea75[_0xfe4e('0x25')](_0x2abe93)['then'](function(_0x2a88c1){return _0x2a88c1;});}return null;};}function removeEntity(_0x2caecc,_0x3fc292){return function(_0x11e3ee){if(_0x11e3ee){return _0x11e3ee[_0xfe4e('0x26')]()[_0xfe4e('0x27')](function(){_0x2caecc[_0xfe4e('0x1b')](0xcc)[_0xfe4e('0x1c')]();});}};}function handleEntityNotFound(_0x28b59b,_0x33996f){return function(_0x53eb63){if(!_0x53eb63){_0x28b59b[_0xfe4e('0x1a')](0x194);}return _0x53eb63;};}function handleError(_0xd8a478,_0x366a2c){_0x366a2c=_0x366a2c||0x1f4;return function(_0x4095b6){logger[_0xfe4e('0x28')](_0x4095b6['stack']);if(_0x4095b6[_0xfe4e('0x29')]){delete _0x4095b6['name'];}_0xd8a478['status'](_0x366a2c)[_0xfe4e('0x2a')](_0x4095b6);};}exports[_0xfe4e('0x2b')]=function(_0x3ae752,_0x452fc4){var _0x21f0e8={},_0xf1ed15={},_0x5361fb={'count':0x0,'rows':[]};var _0x291f93=_[_0xfe4e('0x2c')](db[_0xfe4e('0x2d')][_0xfe4e('0x2e')],function(_0x534e13){return{'name':_0x534e13[_0xfe4e('0x2f')],'type':_0x534e13['type'][_0xfe4e('0x30')]};});_0xf1ed15[_0xfe4e('0x31')]=_[_0xfe4e('0x2c')](_0x291f93,_0xfe4e('0x29'));_0xf1ed15[_0xfe4e('0x32')]=_[_0xfe4e('0x33')](_0x3ae752['query']);_0xf1ed15['filters']=_['intersection'](_0xf1ed15[_0xfe4e('0x31')],_0xf1ed15['query']);_0x21f0e8[_0xfe4e('0x34')]=_['intersection'](_0xf1ed15[_0xfe4e('0x31')],qs[_0xfe4e('0x35')](_0x3ae752[_0xfe4e('0x32')][_0xfe4e('0x35')]));_0x21f0e8[_0xfe4e('0x34')]=_0x21f0e8[_0xfe4e('0x34')][_0xfe4e('0x36')]?_0x21f0e8[_0xfe4e('0x34')]:_0xf1ed15['model'];if(!_0x3ae752['query'][_0xfe4e('0x37')](_0xfe4e('0x38'))){_0x21f0e8[_0xfe4e('0x1f')]=qs[_0xfe4e('0x1f')](_0x3ae752[_0xfe4e('0x32')]['limit']);_0x21f0e8['offset']=qs['offset'](_0x3ae752[_0xfe4e('0x32')]['offset']);}_0x21f0e8[_0xfe4e('0x39')]=qs[_0xfe4e('0x3a')](_0x3ae752[_0xfe4e('0x32')]['sort']);_0x21f0e8[_0xfe4e('0x3b')]=qs['filters'](_[_0xfe4e('0x3c')](_0x3ae752['query'],_0xf1ed15[_0xfe4e('0x3d')]),_0x291f93);if(_0x3ae752[_0xfe4e('0x32')]['filter']){_0x21f0e8[_0xfe4e('0x3b')]=_['merge'](_0x21f0e8[_0xfe4e('0x3b')],{'$or':_[_0xfe4e('0x2c')](_0x291f93,function(_0x308ab3){if(_0x308ab3[_0xfe4e('0x3e')]!==_0xfe4e('0x3f')){var _0x2cc46e={};_0x2cc46e[_0x308ab3['name']]={'$like':'%'+_0x3ae752[_0xfe4e('0x32')][_0xfe4e('0x40')]+'%'};return _0x2cc46e;}})});}_0x21f0e8=_[_0xfe4e('0x41')]({},_0x21f0e8,_0x3ae752['options']);var _0x2395f4={'where':_0x21f0e8[_0xfe4e('0x3b')]};return db[_0xfe4e('0x2d')][_0xfe4e('0x20')](_0x2395f4)[_0xfe4e('0x27')](function(_0x363c74){_0x5361fb[_0xfe4e('0x20')]=_0x363c74;if(_0x3ae752[_0xfe4e('0x32')][_0xfe4e('0x42')]){_0x21f0e8['include']=[{'all':!![]}];}return db[_0xfe4e('0x2d')]['findAll'](_0x21f0e8);})['then'](function(_0x4614a5){_0x5361fb[_0xfe4e('0x43')]=_0x4614a5;return _0x5361fb;})[_0xfe4e('0x27')](respondWithFilteredResult(_0x452fc4,_0x21f0e8))[_0xfe4e('0x44')](handleError(_0x452fc4,null));};exports['show']=function(_0x3484d3,_0x479597){var _0x452f58={'raw':!![],'where':{'id':_0x3484d3[_0xfe4e('0x45')]['id']}},_0x3e8407={};_0x3e8407[_0xfe4e('0x31')]=_[_0xfe4e('0x33')](db['SalesforceField'][_0xfe4e('0x2e')]);_0x3e8407[_0xfe4e('0x32')]=_['keys'](_0x3484d3[_0xfe4e('0x32')]);_0x3e8407[_0xfe4e('0x3d')]=_[_0xfe4e('0x46')](_0x3e8407['model'],_0x3e8407[_0xfe4e('0x32')]);_0x452f58['attributes']=_[_0xfe4e('0x46')](_0x3e8407[_0xfe4e('0x31')],qs[_0xfe4e('0x35')](_0x3484d3[_0xfe4e('0x32')][_0xfe4e('0x35')]));_0x452f58[_0xfe4e('0x34')]=_0x452f58[_0xfe4e('0x34')][_0xfe4e('0x36')]?_0x452f58[_0xfe4e('0x34')]:_0x3e8407[_0xfe4e('0x31')];if(_0x3484d3[_0xfe4e('0x32')]['includeAll']){_0x452f58[_0xfe4e('0x47')]=[{'all':!![]}];}_0x452f58=_[_0xfe4e('0x41')]({},_0x452f58,_0x3484d3[_0xfe4e('0x48')]);return db['SalesforceField'][_0xfe4e('0x49')](_0x452f58)[_0xfe4e('0x27')](handleEntityNotFound(_0x479597,null))[_0xfe4e('0x27')](respondWithResult(_0x479597,null))[_0xfe4e('0x44')](handleError(_0x479597,null));};exports['create']=function(_0x4a024d,_0x563cca){return db['SalesforceField'][_0xfe4e('0x4a')](_0x4a024d['body'],{})['then'](respondWithResult(_0x563cca,0xc9))[_0xfe4e('0x44')](handleError(_0x563cca,null));};exports['update']=function(_0x4f44dd,_0x5a1c91){if(_0x4f44dd['body']['id']){delete _0x4f44dd[_0xfe4e('0x4b')]['id'];}return db[_0xfe4e('0x2d')][_0xfe4e('0x49')]({'where':{'id':_0x4f44dd[_0xfe4e('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a1c91,null))[_0xfe4e('0x27')](saveUpdates(_0x4f44dd[_0xfe4e('0x4b')],null))[_0xfe4e('0x27')](respondWithResult(_0x5a1c91,null))['catch'](handleError(_0x5a1c91,null));};exports[_0xfe4e('0x26')]=function(_0x28ac14,_0x1172b5){return db[_0xfe4e('0x2d')][_0xfe4e('0x49')]({'where':{'id':_0x28ac14['params']['id']}})[_0xfe4e('0x27')](handleEntityNotFound(_0x1172b5,null))[_0xfe4e('0x27')](removeEntity(_0x1172b5,null))['catch'](handleError(_0x1172b5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 33d29f9..b5a7174 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 _0x29e5=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x5401b5,_0x3404fb){var _0x4a2d8e=function(_0x2089da){while(--_0x2089da){_0x5401b5['push'](_0x5401b5['shift']());}};_0x4a2d8e(++_0x3404fb);}(_0x29e5,0x1ab));var _0x529e=function(_0x1e7a35,_0x50cf62){_0x1e7a35=_0x1e7a35-0x0;var _0x635f61=_0x29e5[_0x1e7a35];return _0x635f61;};'use strict';var _=require(_0x529e('0x0'));var util=require(_0x529e('0x1'));var logger=require(_0x529e('0x2'))(_0x529e('0x3'));var moment=require('moment');var BPromise=require(_0x529e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x529e('0x5'));var rimraf=require(_0x529e('0x6'));var config=require(_0x529e('0x7'));var attributes=require(_0x529e('0x8'));module[_0x529e('0x9')]=function(_0xb0fd19,_0x1a77c5){return _0xb0fd19[_0x529e('0xa')](_0x529e('0xb'),attributes,{'tableName':_0x529e('0xc'),'paranoid':![],'indexes':[{'name':_0x529e('0xd'),'fields':[_0x529e('0xe'),_0x529e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb0a1=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xb0a1,0x95));var _0x1b0a=function(_0xf10ab2,_0x4139fa){_0xf10ab2=_0xf10ab2-0x0;var _0x4c6629=_0xb0a1[_0xf10ab2];return _0x4c6629;};'use strict';var _=require(_0x1b0a('0x0'));var util=require(_0x1b0a('0x1'));var logger=require(_0x1b0a('0x2'))(_0x1b0a('0x3'));var moment=require(_0x1b0a('0x4'));var BPromise=require('bluebird');var rp=require(_0x1b0a('0x5'));var fs=require('fs');var path=require(_0x1b0a('0x6'));var rimraf=require(_0x1b0a('0x7'));var config=require(_0x1b0a('0x8'));var attributes=require(_0x1b0a('0x9'));module['exports']=function(_0x1306be,_0x10c115){return _0x1306be[_0x1b0a('0xa')](_0x1b0a('0xb'),attributes,{'tableName':_0x1b0a('0xc'),'paranoid':![],'indexes':[{'name':_0x1b0a('0xd'),'fields':['idField',_0x1b0a('0xe')],'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 1867cb5..c6fada5 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 _0x77e8=['request','then','SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x1d8b9c,_0xc2cdd3){var _0x459bf4=function(_0xe2f94b){while(--_0xe2f94b){_0x1d8b9c['push'](_0x1d8b9c['shift']());}};_0x459bf4(++_0xc2cdd3);}(_0x77e8,0xda));var _0x877e=function(_0x5ba736,_0x3470bb){_0x5ba736=_0x5ba736-0x0;var _0xa338e4=_0x77e8[_0x5ba736];return _0xa338e4;};'use strict';var _=require(_0x877e('0x0'));var util=require('util');var moment=require(_0x877e('0x1'));var BPromise=require(_0x877e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x877e('0x3'));var db=require(_0x877e('0x4'))['db'];var utils=require(_0x877e('0x5'));var logger=require(_0x877e('0x6'))(_0x877e('0x7'));var config=require('../../config/environment');var jayson=require(_0x877e('0x8'));var client=jayson['client'][_0x877e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1259e7,_0x37addd,_0x2b95ed){return new BPromise(function(_0x203df0,_0x403edc){return client[_0x877e('0xa')](_0x1259e7,_0x2b95ed)[_0x877e('0xb')](function(_0x24176e){logger['info'](_0x877e('0xc'),_0x37addd,'request\x20sent');logger['debug'](_0x877e('0xd'),_0x37addd,_0x877e('0xe'),JSON[_0x877e('0xf')](_0x24176e));if(_0x24176e[_0x877e('0x10')]){if(_0x24176e['error']['code']===0x1f4){logger[_0x877e('0x10')](_0x877e('0xc'),_0x37addd,_0x24176e[_0x877e('0x10')][_0x877e('0x11')]);return _0x403edc(_0x24176e[_0x877e('0x10')][_0x877e('0x11')]);}logger[_0x877e('0x10')](_0x877e('0xc'),_0x37addd,_0x24176e[_0x877e('0x10')]['message']);return _0x203df0(_0x24176e[_0x877e('0x10')][_0x877e('0x11')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x37addd,_0x877e('0xe'));_0x203df0(_0x24176e[_0x877e('0x12')][_0x877e('0x11')]);}})['catch'](function(_0x16be0b){logger[_0x877e('0x10')](_0x877e('0xc'),_0x37addd,_0x16be0b);_0x403edc(_0x16be0b);});});} \ No newline at end of file +var _0x4243=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x4243,0x1c9));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3424('0x0'));var util=require(_0x3424('0x1'));var moment=require(_0x3424('0x2'));var BPromise=require('bluebird');var rs=require(_0x3424('0x3'));var fs=require('fs');var Redis=require(_0x3424('0x4'));var db=require(_0x3424('0x5'))['db'];var utils=require(_0x3424('0x6'));var logger=require(_0x3424('0x7'))(_0x3424('0x8'));var config=require(_0x3424('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3424('0xa')][_0x3424('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31e5d5,_0x4eb6c7,_0x5b6c94){return new BPromise(function(_0x3049c9,_0x2f8816){return client[_0x3424('0xc')](_0x31e5d5,_0x5b6c94)[_0x3424('0xd')](function(_0x3eee41){logger[_0x3424('0xe')]('SalesforceField,\x20%s,\x20%s',_0x4eb6c7,'request\x20sent');logger['debug'](_0x3424('0xf'),_0x4eb6c7,'request\x20sent',JSON[_0x3424('0x10')](_0x3eee41));if(_0x3eee41['error']){if(_0x3eee41[_0x3424('0x11')][_0x3424('0x12')]===0x1f4){logger[_0x3424('0x11')](_0x3424('0x13'),_0x4eb6c7,_0x3eee41[_0x3424('0x11')][_0x3424('0x14')]);return _0x2f8816(_0x3eee41[_0x3424('0x11')]['message']);}logger[_0x3424('0x11')](_0x3424('0x13'),_0x4eb6c7,_0x3eee41[_0x3424('0x11')][_0x3424('0x14')]);return _0x3049c9(_0x3eee41[_0x3424('0x11')][_0x3424('0x14')]);}else{logger[_0x3424('0xe')]('SalesforceField,\x20%s,\x20%s',_0x4eb6c7,_0x3424('0x15'));_0x3049c9(_0x3eee41[_0x3424('0x16')]['message']);}})[_0x3424('0x17')](function(_0x19191e){logger[_0x3424('0x11')](_0x3424('0x13'),_0x4eb6c7,_0x19191e);_0x2f8816(_0x19191e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a41ef8a..b811ec2 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 _0xe26e=['addConfiguration','delete','destroy','multer','path','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0xa9544e,_0x52f96c){var _0x56e975=function(_0x178faf){while(--_0x178faf){_0xa9544e['push'](_0xa9544e['shift']());}};_0x56e975(++_0x52f96c);}(_0xe26e,0x1e9));var _0xee26=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe26e[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xee26('0x0'));var util=require('util');var path=require(_0xee26('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xee26('0x2'));var config=require(_0xee26('0x3'));var controller=require(_0xee26('0x4'));router[_0xee26('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee26('0x5')](_0xee26('0x6'),auth[_0xee26('0x7')](),controller[_0xee26('0x8')]);router[_0xee26('0x5')](_0xee26('0x9'),auth[_0xee26('0x7')](),controller[_0xee26('0xa')]);router[_0xee26('0x5')](_0xee26('0xb'),auth['isAuthenticated'](),controller[_0xee26('0xc')]);router[_0xee26('0xd')]('/',auth[_0xee26('0x7')](),controller[_0xee26('0xe')]);router['post'](_0xee26('0x9'),auth['isAuthenticated'](),controller[_0xee26('0xf')]);router['put'](_0xee26('0x6'),auth[_0xee26('0x7')](),controller['update']);router[_0xee26('0x10')](_0xee26('0x6'),auth[_0xee26('0x7')](),controller[_0xee26('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb469=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x71e130,_0x1e0395){var _0x57a368=function(_0x46ac2d){while(--_0x46ac2d){_0x71e130['push'](_0x71e130['shift']());}};_0x57a368(++_0x1e0395);}(_0xb469,0x13b));var _0x9b46=function(_0x5e344d,_0x13f009){_0x5e344d=_0x5e344d-0x0;var _0x1d0601=_0xb469[_0x5e344d];return _0x1d0601;};'use strict';var multer=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require(_0x9b46('0x2'));var timeout=require(_0x9b46('0x3'));var express=require(_0x9b46('0x4'));var router=express[_0x9b46('0x5')]();var fs_extra=require(_0x9b46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x9b46('0x9')]('/',auth[_0x9b46('0xa')](),controller['index']);router[_0x9b46('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9b46('0xb')]);router['get'](_0x9b46('0xc'),auth[_0x9b46('0xa')](),controller[_0x9b46('0xd')]);router['get'](_0x9b46('0xe'),auth['isAuthenticated'](),controller[_0x9b46('0xf')]);router['post']('/',auth[_0x9b46('0xa')](),controller['create']);router[_0x9b46('0x10')](_0x9b46('0xc'),auth['isAuthenticated'](),controller[_0x9b46('0x11')]);router[_0x9b46('0x12')]('/:id',auth[_0x9b46('0xa')](),controller[_0x9b46('0x13')]);router[_0x9b46('0x14')](_0x9b46('0x15'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x16')]);module[_0x9b46('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 6fda36a..8dc9788 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 _0xb654=['username','exports','STRING'];(function(_0x542cea,_0x4f75f3){var _0x3a20cd=function(_0x1ebdc4){while(--_0x1ebdc4){_0x542cea['push'](_0x542cea['shift']());}};_0x3a20cd(++_0x4f75f3);}(_0xb654,0xaf));var _0x4b65=function(_0x57d4b3,_0x478fd1){_0x57d4b3=_0x57d4b3-0x0;var _0x5f36ed=_0xb654[_0x57d4b3];return _0x5f36ed;};'use strict';var Sequelize=require('sequelize');module[_0x4b65('0x0')]={'name':{'type':Sequelize[_0x4b65('0x1')]},'description':{'type':Sequelize[_0x4b65('0x1')]},'username':{'type':Sequelize[_0x4b65('0x1')],'unique':_0x4b65('0x2')},'password':{'type':Sequelize[_0x4b65('0x1')]},'email':{'type':Sequelize[_0x4b65('0x1')]},'remoteUri':{'type':Sequelize[_0x4b65('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4b65('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6a14=['username','sequelize','exports','STRING'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x6a14,0xb5));var _0x46a1=function(_0x3f08c9,_0x557d0b){_0x3f08c9=_0x3f08c9-0x0;var _0x4c3250=_0x6a14[_0x3f08c9];return _0x4c3250;};'use strict';var Sequelize=require(_0x46a1('0x0'));module[_0x46a1('0x1')]={'name':{'type':Sequelize[_0x46a1('0x2')]},'description':{'type':Sequelize[_0x46a1('0x2')]},'username':{'type':Sequelize[_0x46a1('0x2')],'unique':_0x46a1('0x3')},'password':{'type':Sequelize[_0x46a1('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x46a1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x46a1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1acc0c5..b9bbcfe 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 _0xeedf=['model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','catch','show','params','keys','create','body','find','getConfigurations','findOne','ServicenowConfiguration','Subjects','getSubjects','Descriptions','channel','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','impact','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','remoteUri','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','result','incident\x20table\x20objects','remove','includes','forEach','label','push','all','assign','log','internalType','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','true','False','inactive','false','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','send','index','map','rawAttributes','type','key','filters','intersection','query'];(function(_0x4971d7,_0x3a5903){var _0x523eaa=function(_0x74957e){while(--_0x74957e){_0x4971d7['push'](_0x4971d7['shift']());}};_0x523eaa(++_0x3a5903);}(_0xeedf,0x83));var _0xfeed=function(_0x600c9b,_0x54f104){_0x600c9b=_0x600c9b-0x0;var _0x4bb67a=_0xeedf[_0x600c9b];return _0x4bb67a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfeed('0x0'));var rp=require(_0xfeed('0x1'));var moment=require(_0xfeed('0x2'));var BPromise=require(_0xfeed('0x3'));var Mustache=require(_0xfeed('0x4'));var util=require(_0xfeed('0x5'));var path=require(_0xfeed('0x6'));var sox=require(_0xfeed('0x7'));var csv=require('to-csv');var ejs=require(_0xfeed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfeed('0x9'));var squel=require(_0xfeed('0xa'));var crypto=require('crypto');var jsforce=require(_0xfeed('0xb'));var deskjs=require(_0xfeed('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfeed('0xd'));var Papa=require(_0xfeed('0xe'));var Redis=require(_0xfeed('0xf'));var authService=require(_0xfeed('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfeed('0x11'));var hardwareService=require(_0xfeed('0x12'));var logger=require(_0xfeed('0x13'))('api');var utils=require(_0xfeed('0x14'));var config=require(_0xfeed('0x15'));var licenseUtil=require(_0xfeed('0x16'));var db=require(_0xfeed('0x17'))['db'];var integrations=require(_0xfeed('0x18'));function respondWithStatusCode(_0x4410ba,_0x9e13a6){_0x9e13a6=_0x9e13a6||0xcc;return function(_0x434edd){if(_0x434edd){return _0x4410ba[_0xfeed('0x19')](_0x9e13a6);}return _0x4410ba[_0xfeed('0x1a')](_0x9e13a6)[_0xfeed('0x1b')]();};}function respondWithResult(_0x1f8519,_0x209c16){_0x209c16=_0x209c16||0xc8;return function(_0x2519fb){if(_0x2519fb){return _0x1f8519['status'](_0x209c16)[_0xfeed('0x1c')](_0x2519fb);}};}function respondWithFilteredResult(_0x2717bc,_0x4318b3){return function(_0x32356d){if(_0x32356d){var _0x11e075=typeof _0x4318b3[_0xfeed('0x1d')]===_0xfeed('0x1e')&&typeof _0x4318b3[_0xfeed('0x1f')]===_0xfeed('0x1e');var _0x7ee02a=_0x32356d['count'];var _0x4df985=_0x11e075?0x0:_0x4318b3[_0xfeed('0x1d')];var _0x17f2fb=_0x11e075?_0x32356d[_0xfeed('0x20')]:_0x4318b3[_0xfeed('0x1d')]+_0x4318b3[_0xfeed('0x1f')];var _0xb19611;if(_0x17f2fb>=_0x7ee02a){_0x17f2fb=_0x7ee02a;_0xb19611=0xc8;}else{_0xb19611=0xce;}_0x2717bc['status'](_0xb19611);return _0x2717bc[_0xfeed('0x21')](_0xfeed('0x22'),_0x4df985+'-'+_0x17f2fb+'/'+_0x7ee02a)[_0xfeed('0x1c')](_0x32356d);}return null;};}function patchUpdates(_0x17b5e1){return function(_0x542431){try{jsonpatch[_0xfeed('0x23')](_0x542431,_0x17b5e1,!![]);}catch(_0x1e5360){return BPromise['reject'](_0x1e5360);}return _0x542431['save']();};}function saveUpdates(_0x2c7c01,_0x59e5bf){return function(_0xe3ed96){if(_0xe3ed96){return _0xe3ed96[_0xfeed('0x24')](_0x2c7c01)[_0xfeed('0x25')](function(_0x581edb){return _0x581edb;});}return null;};}function removeEntity(_0x338b4a,_0x706f06){return function(_0x2377e2){if(_0x2377e2){return _0x2377e2[_0xfeed('0x26')]()[_0xfeed('0x25')](function(){_0x338b4a['status'](0xcc)[_0xfeed('0x1b')]();});}};}function handleEntityNotFound(_0x50a1fc,_0x3e28b5){return function(_0x5affa5){if(!_0x5affa5){_0x50a1fc[_0xfeed('0x19')](0x194);}return _0x5affa5;};}function handleError(_0x52eb68,_0x4ce6dd){_0x4ce6dd=_0x4ce6dd||0x1f4;return function(_0x4393a1){logger['error'](_0x4393a1['stack']);if(_0x4393a1[_0xfeed('0x27')]){delete _0x4393a1['name'];}_0x52eb68['status'](_0x4ce6dd)[_0xfeed('0x28')](_0x4393a1);};}exports[_0xfeed('0x29')]=function(_0x392064,_0x45309f){var _0x1ca24b={},_0x1070c7={},_0x38c130={'count':0x0,'rows':[]};var _0x4ac3aa=_[_0xfeed('0x2a')](db['ServicenowAccount'][_0xfeed('0x2b')],function(_0x10c8a2){return{'name':_0x10c8a2['fieldName'],'type':_0x10c8a2[_0xfeed('0x2c')][_0xfeed('0x2d')]};});_0x1070c7['model']=_[_0xfeed('0x2a')](_0x4ac3aa,_0xfeed('0x27'));_0x1070c7['query']=_['keys'](_0x392064['query']);_0x1070c7[_0xfeed('0x2e')]=_[_0xfeed('0x2f')](_0x1070c7['model'],_0x1070c7[_0xfeed('0x30')]);_0x1ca24b['attributes']=_['intersection'](_0x1070c7[_0xfeed('0x31')],qs['fields'](_0x392064[_0xfeed('0x30')][_0xfeed('0x32')]));_0x1ca24b[_0xfeed('0x33')]=_0x1ca24b[_0xfeed('0x33')][_0xfeed('0x34')]?_0x1ca24b['attributes']:_0x1070c7[_0xfeed('0x31')];if(!_0x392064[_0xfeed('0x30')][_0xfeed('0x35')](_0xfeed('0x36'))){_0x1ca24b[_0xfeed('0x1f')]=qs[_0xfeed('0x1f')](_0x392064[_0xfeed('0x30')]['limit']);_0x1ca24b[_0xfeed('0x1d')]=qs[_0xfeed('0x1d')](_0x392064[_0xfeed('0x30')][_0xfeed('0x1d')]);}_0x1ca24b[_0xfeed('0x37')]=qs[_0xfeed('0x38')](_0x392064[_0xfeed('0x30')]['sort']);_0x1ca24b['where']=qs[_0xfeed('0x2e')](_[_0xfeed('0x39')](_0x392064[_0xfeed('0x30')],_0x1070c7['filters']),_0x4ac3aa);if(_0x392064[_0xfeed('0x30')][_0xfeed('0x3a')]){_0x1ca24b[_0xfeed('0x3b')]=_[_0xfeed('0x3c')](_0x1ca24b['where'],{'$or':_[_0xfeed('0x2a')](_0x4ac3aa,function(_0x497bf2){if(_0x497bf2[_0xfeed('0x2c')]!==_0xfeed('0x3d')){var _0x55c47f={};_0x55c47f[_0x497bf2[_0xfeed('0x27')]]={'$like':'%'+_0x392064[_0xfeed('0x30')][_0xfeed('0x3a')]+'%'};return _0x55c47f;}})});}_0x1ca24b=_[_0xfeed('0x3c')]({},_0x1ca24b,_0x392064[_0xfeed('0x3e')]);var _0x37ef3c={'where':_0x1ca24b['where']};return db[_0xfeed('0x3f')][_0xfeed('0x20')](_0x37ef3c)['then'](function(_0x3a4b39){_0x38c130['count']=_0x3a4b39;if(_0x392064[_0xfeed('0x30')][_0xfeed('0x40')]){_0x1ca24b[_0xfeed('0x41')]=[{'all':!![]}];}return db[_0xfeed('0x3f')][_0xfeed('0x42')](_0x1ca24b);})[_0xfeed('0x25')](function(_0x14aa15){_0x38c130['rows']=_0x14aa15;return _0x38c130;})[_0xfeed('0x25')](respondWithFilteredResult(_0x45309f,_0x1ca24b))[_0xfeed('0x43')](handleError(_0x45309f,null));};exports[_0xfeed('0x44')]=function(_0x591823,_0x503427){var _0x455974={'raw':![],'where':{'id':_0x591823[_0xfeed('0x45')]['id']}},_0x46a40c={};_0x46a40c[_0xfeed('0x31')]=_['keys'](db[_0xfeed('0x3f')]['rawAttributes']);_0x46a40c['query']=_[_0xfeed('0x46')](_0x591823[_0xfeed('0x30')]);_0x46a40c[_0xfeed('0x2e')]=_[_0xfeed('0x2f')](_0x46a40c['model'],_0x46a40c['query']);_0x455974[_0xfeed('0x33')]=_[_0xfeed('0x2f')](_0x46a40c[_0xfeed('0x31')],qs[_0xfeed('0x32')](_0x591823['query'][_0xfeed('0x32')]));_0x455974['attributes']=_0x455974[_0xfeed('0x33')][_0xfeed('0x34')]?_0x455974['attributes']:_0x46a40c[_0xfeed('0x31')];if(_0x591823['query'][_0xfeed('0x40')]){_0x455974[_0xfeed('0x41')]=[{'all':!![]}];}_0x455974=_[_0xfeed('0x3c')]({},_0x455974,_0x591823['options']);return db[_0xfeed('0x3f')]['find'](_0x455974)['then'](handleEntityNotFound(_0x503427,null))[_0xfeed('0x25')](respondWithResult(_0x503427,null))[_0xfeed('0x43')](handleError(_0x503427,null));};exports[_0xfeed('0x47')]=function(_0x20c5e7,_0x45a6d8){return db[_0xfeed('0x3f')][_0xfeed('0x47')](_0x20c5e7['body'],{})[_0xfeed('0x25')](respondWithResult(_0x45a6d8,0xc9))[_0xfeed('0x43')](handleError(_0x45a6d8,null));};exports[_0xfeed('0x24')]=function(_0x263971,_0x147eb9){if(_0x263971['body']['id']){delete _0x263971[_0xfeed('0x48')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x263971[_0xfeed('0x45')]['id']}})[_0xfeed('0x25')](handleEntityNotFound(_0x147eb9,null))[_0xfeed('0x25')](saveUpdates(_0x263971['body'],null))[_0xfeed('0x25')](respondWithResult(_0x147eb9,null))[_0xfeed('0x43')](handleError(_0x147eb9,null));};exports[_0xfeed('0x26')]=function(_0x5c9064,_0x4c494c){return db[_0xfeed('0x3f')][_0xfeed('0x49')]({'where':{'id':_0x5c9064[_0xfeed('0x45')]['id']}})[_0xfeed('0x25')](handleEntityNotFound(_0x4c494c,null))['then'](removeEntity(_0x4c494c,null))[_0xfeed('0x43')](handleError(_0x4c494c,null));};exports[_0xfeed('0x4a')]=function(_0x50be84,_0x44f0ba,_0x2c6258){var _0x5835c5={};var _0x4ebfad={};var _0x32b11;var _0x32ca88;return db[_0xfeed('0x3f')][_0xfeed('0x4b')]({'where':{'id':_0x50be84[_0xfeed('0x45')]['id']}})[_0xfeed('0x25')](handleEntityNotFound(_0x44f0ba,null))[_0xfeed('0x25')](function(_0x1fbc05){if(_0x1fbc05){_0x32b11=_0x1fbc05;_0x4ebfad[_0xfeed('0x31')]=_[_0xfeed('0x46')](db[_0xfeed('0x4c')][_0xfeed('0x2b')]);_0x4ebfad[_0xfeed('0x30')]=_[_0xfeed('0x46')](_0x50be84[_0xfeed('0x30')]);_0x4ebfad['filters']=_[_0xfeed('0x2f')](_0x4ebfad[_0xfeed('0x31')],_0x4ebfad[_0xfeed('0x30')]);_0x5835c5[_0xfeed('0x33')]=_[_0xfeed('0x2f')](_0x4ebfad[_0xfeed('0x31')],qs['fields'](_0x50be84['query'][_0xfeed('0x32')]));_0x5835c5[_0xfeed('0x33')]=_0x5835c5[_0xfeed('0x33')][_0xfeed('0x34')]?_0x5835c5['attributes']:_0x4ebfad[_0xfeed('0x31')];_0x5835c5[_0xfeed('0x37')]=qs[_0xfeed('0x38')](_0x50be84['query'][_0xfeed('0x38')]);_0x5835c5[_0xfeed('0x3b')]=qs['filters'](_[_0xfeed('0x39')](_0x50be84[_0xfeed('0x30')],_0x4ebfad[_0xfeed('0x2e')]));if(_0x50be84[_0xfeed('0x30')][_0xfeed('0x3a')]){_0x5835c5[_0xfeed('0x3b')]=_[_0xfeed('0x3c')](_0x5835c5['where'],{'$or':_['map'](_0x5835c5[_0xfeed('0x33')],function(_0x8c333){var _0x4d7dcd={};_0x4d7dcd[_0x8c333]={'$like':'%'+_0x50be84[_0xfeed('0x30')][_0xfeed('0x3a')]+'%'};return _0x4d7dcd;})});}_0x5835c5=_[_0xfeed('0x3c')]({},_0x5835c5,_0x50be84[_0xfeed('0x3e')]);return _0x32b11[_0xfeed('0x4a')](_0x5835c5);}})[_0xfeed('0x25')](function(_0x3c676f){if(_0x3c676f){_0x32ca88=_0x3c676f[_0xfeed('0x34')];if(!_0x50be84[_0xfeed('0x30')][_0xfeed('0x35')](_0xfeed('0x36'))){_0x5835c5[_0xfeed('0x1f')]=qs[_0xfeed('0x1f')](_0x50be84['query'][_0xfeed('0x1f')]);_0x5835c5[_0xfeed('0x1d')]=qs[_0xfeed('0x1d')](_0x50be84[_0xfeed('0x30')][_0xfeed('0x1d')]);}return _0x32b11[_0xfeed('0x4a')](_0x5835c5);}})[_0xfeed('0x25')](function(_0x5733f2){if(_0x5733f2){return _0x5733f2?{'count':_0x32ca88,'rows':_0x5733f2}:null;}})[_0xfeed('0x25')](respondWithResult(_0x44f0ba,null))[_0xfeed('0x43')](handleError(_0x44f0ba,null));};exports['addConfiguration']=function(_0xf4debd,_0x556ec2,_0x2090fd){if(_0xf4debd['body']['id']){delete _0xf4debd[_0xfeed('0x48')]['id'];}return db[_0xfeed('0x3f')][_0xfeed('0x4b')]({'where':{'id':_0xf4debd[_0xfeed('0x45')]['id']}})[_0xfeed('0x25')](handleEntityNotFound(_0x556ec2,null))[_0xfeed('0x25')](function(_0x5abe23){if(_0x5abe23){_0xf4debd[_0xfeed('0x48')]['AccountId']=_0x5abe23['id'];_0xf4debd[_0xfeed('0x48')][_0xfeed('0x4d')]=integrations[_0xfeed('0x4e')](_0xf4debd[_0xfeed('0x48')]['channel'],_0xf4debd[_0xfeed('0x48')][_0xfeed('0x2c')]);_0xf4debd[_0xfeed('0x48')][_0xfeed('0x4f')]=integrations['getDescriptions'](_0xf4debd['body'][_0xfeed('0x50')],_0xf4debd[_0xfeed('0x48')][_0xfeed('0x2c')]);return db[_0xfeed('0x4c')]['create'](_0xf4debd[_0xfeed('0x48')],{'include':[{'model':db[_0xfeed('0x51')],'as':_0xfeed('0x4d')},{'model':db[_0xfeed('0x51')],'as':_0xfeed('0x4f')}]});}return null;})[_0xfeed('0x25')](respondWithResult(_0x556ec2,null))['catch'](handleError(_0x556ec2,null));};exports['getFields']=function(_0x525506,_0x46bc43,_0x57e0e4){var _0x4ce195=[_0xfeed('0x52'),_0xfeed('0x53'),_0xfeed('0x54'),_0xfeed('0x55'),_0xfeed('0x56'),_0xfeed('0x57'),_0xfeed('0x58'),_0xfeed('0x59'),_0xfeed('0x5a')];var _0x25ded6=[_0xfeed('0x5b'),_0xfeed('0x52'),_0xfeed('0x5c'),_0xfeed('0x5d'),_0xfeed('0x5e'),'sys_updated_on',_0xfeed('0x5f'),_0xfeed('0x53'),_0xfeed('0x60'),'number','resolved_by',_0xfeed('0x61'),_0xfeed('0x62'),_0xfeed('0x63'),'sys_created_on',_0xfeed('0x64'),_0xfeed('0x65'),_0xfeed('0x66'),_0xfeed('0x54'),'order',_0xfeed('0x67'),'closed_at','cmdb_ci','delivery_plan',_0xfeed('0x68'),'active',_0xfeed('0x69'),_0xfeed('0x6a'),'priority',_0xfeed('0x6b'),_0xfeed('0x6c'),_0xfeed('0x6d'),_0xfeed('0x6e'),_0xfeed('0x6f'),_0xfeed('0x70'),_0xfeed('0x71'),_0xfeed('0x72'),_0xfeed('0x73'),_0xfeed('0x74'),_0xfeed('0x75'),_0xfeed('0x76'),_0xfeed('0x55'),_0xfeed('0x77'),_0xfeed('0x78'),'close_code',_0xfeed('0x79'),_0xfeed('0x7a'),'work_start',_0xfeed('0x7b'),_0xfeed('0x7c'),_0xfeed('0x7d'),_0xfeed('0x7e'),_0xfeed('0x7f'),_0xfeed('0x57'),_0xfeed('0x80'),_0xfeed('0x81'),'closed_by',_0xfeed('0x82'),_0xfeed('0x83'),_0xfeed('0x84'),_0xfeed('0x85'),_0xfeed('0x86'),_0xfeed('0x58'),_0xfeed('0x87'),_0xfeed('0x88'),_0xfeed('0x89'),_0xfeed('0x8a'),_0xfeed('0x8b'),'assigned_to',_0xfeed('0x59'),_0xfeed('0x8c'),'sla_due','approval',_0xfeed('0x8d'),_0xfeed('0x8e'),_0xfeed('0x8f'),_0xfeed('0x90'),_0xfeed('0x91'),_0xfeed('0x92'),_0xfeed('0x93'),_0xfeed('0x94'),_0xfeed('0x95'),_0xfeed('0x5a')];var _0x181ef1='';var _0x496a97='';var _0x4f90d3=[];var _0x39446f='';var _0x538def='';var _0x912a01=[];var _0x3ab075='';var _0x599e65='';var _0x1dd207={};var _0x1ef747='';return db['ServicenowAccount'][_0xfeed('0x4b')]({'where':{'id':_0x525506[_0xfeed('0x45')]['id']},'attributes':['id',_0xfeed('0x96'),'password','email',_0xfeed('0x97'),'serverUrl']})[_0xfeed('0x25')](handleEntityNotFound(_0x46bc43,null))[_0xfeed('0x25')](function(_0x5613c3){if(_0x5613c3){_0x1ef747=_0x5613c3[_0xfeed('0x97')];var _0x4e7590=_0x1ef747['slice'](-0x1);if(_0x4e7590==='/'){_0x1ef747=_0x1ef747['substring'](0x0,_0x1ef747[_0xfeed('0x98')](_0x4e7590));}_0x599e65=util[_0xfeed('0x99')](_0xfeed('0x9a'),_0x1ef747);_0x3ab075=util[_0xfeed('0x99')](_0xfeed('0x9b'),_0x1ef747);_0x1dd207={'user':_0x5613c3[_0xfeed('0x96')],'pass':_0x5613c3[_0xfeed('0x9c')]};var _0xa320aa={'method':_0xfeed('0x9d'),'uri':_0x599e65+'incident?sysparm_display_value=all','auth':_0x1dd207,'json':!![]};return rp(_0xa320aa);}})[_0xfeed('0x25')](function(_0x1978d0){if(_0x1978d0[_0xfeed('0x9e')]['length']>0x0){_0x181ef1=_0x1978d0[_0xfeed('0x9e')];}console['log'](_0xfeed('0x9f'),_0x181ef1);_0x912a01=[];_0x496a97=Object['assign']([],_0x181ef1);_[_0xfeed('0xa0')](_0x496a97,function(_0x18b801){return!_0x4ce195[_0xfeed('0xa1')](_0x18b801['name']);});_0x496a97[_0xfeed('0xa2')](function(_0x183369){var _0x2a146a=createFieldObject(_0x3ab075,_0x1dd207,_0x183369['internalType'],_0x183369[_0xfeed('0x27')],_0x183369[_0xfeed('0xa3')],![]);_0x912a01[_0xfeed('0xa4')](_0x2a146a);});return Promise[_0xfeed('0xa5')](_0x912a01);})[_0xfeed('0x25')](function(_0x309670){_0x4f90d3=_0x309670;_0x39446f=Object[_0xfeed('0xa6')]([],_0x181ef1);console[_0xfeed('0xa7')]('TCL:\x20_object',_0x181ef1);_[_0xfeed('0xa0')](_0x39446f,function(_0x5f2f8f){return _0x25ded6[_0xfeed('0xa1')](_0x5f2f8f[_0xfeed('0x27')]);});console[_0xfeed('0xa7')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x39446f);_0x912a01=[];_0x39446f[_0xfeed('0xa2')](function(_0x43b9ac){var _0x533f2d=createFieldObject(_0x3ab075,_0x1dd207,_0x43b9ac[_0xfeed('0xa8')],_0x43b9ac[_0xfeed('0x27')],_0x43b9ac[_0xfeed('0xa3')],!![]);_0x912a01[_0xfeed('0xa4')](_0x533f2d);});return Promise['all'](_0x912a01);})[_0xfeed('0x25')](function(_0x376557){_0x538def=_0x376557;var _0x1ddb39=_0x4f90d3['concat'](_0x538def);return{'count':_0x1ddb39['length'],'rows':_0x1ddb39};})[_0xfeed('0x25')](respondWithResult(_0x46bc43,null))['catch'](function(_0x553942){console[_0xfeed('0xa7')](_0xfeed('0xa9')+_0x553942);var _0x4926a7=_0x525506[_0xfeed('0x30')][_0xfeed('0xaa')]?0x1f4:_0x553942[_0xfeed('0xab')]||0x1f4;logger[_0xfeed('0xac')](_0x553942['stack']);delete _0x553942[_0xfeed('0x27')];if(_0x4926a7===0x191){_0x4926a7=0x190;}_0x46bc43[_0xfeed('0x1a')](_0x4926a7)['send'](_0x525506['query'][_0xfeed('0xaa')]?{'message':_0xfeed('0xad'),'statusCode':_0x553942[_0xfeed('0xab')]}:_0x553942);});};function createFieldObject(_0x12d5de,_0x3e719b,_0x5df1f7,_0x4878ab,_0x33bb8d,_0x27a4ba){return new Promise(function(_0x24a4ca,_0x5de318){var _0x5824d0={'id':_0x4878ab,'name':_0x33bb8d,'custom':_0x27a4ba};if(_0x5df1f7===_0xfeed('0xae')){_0x5824d0[_0xfeed('0x3e')]=[{'name':_0xfeed('0xaf'),'value':_0xfeed('0xb0')},{'name':_0xfeed('0xb1'),'value':'false'}];_0x24a4ca(_0x5824d0);}else{var _0xeabd69={'method':_0xfeed('0x9d'),'uri':_0x12d5de+'sys_choice?sysparm_query=name=incident^element='+_0x4878ab,'auth':_0x3e719b,'json':!![]};return rp(_0xeabd69)['then'](function(_0x55764a){var _0x7e8079=[];if(_0x55764a['result'][_0xfeed('0x34')]>0x0){_0x55764a['result'][_0xfeed('0xa2')](function(_0x1add0e){if(_0x1add0e[_0xfeed('0xb2')]===_0xfeed('0xb3')){var _0xae949c={'name':_0x1add0e[_0xfeed('0xa3')],'value':_0x1add0e['value']};_0x7e8079[_0xfeed('0xa4')](_0xae949c);}});}_0x5824d0[_0xfeed('0x3e')]=_0x7e8079;if(_0x5824d0['options'][_0xfeed('0x34')]>0x0){_0x24a4ca(_0x5824d0);}else{if(_0x27a4ba==![]){_0x24a4ca();}else{_0x24a4ca(_0x5824d0);}}});}});} \ No newline at end of file +var _0x2564=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','ServicenowAccount','findAll','rows','catch','include','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','delivery_plan','impact','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','caller_id','approval_set','subcategory','short_description','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','incident_state','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x50ff1e,_0x306229){var _0x16c0fb=function(_0x4e837c){while(--_0x4e837c){_0x50ff1e['push'](_0x50ff1e['shift']());}};_0x16c0fb(++_0x306229);}(_0x2564,0x80));var _0x4256=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2564[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4256('0x0'));var rimraf=require(_0x4256('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4256('0x2'));var BPromise=require(_0x4256('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4256('0x4'));var sox=require(_0x4256('0x5'));var csv=require(_0x4256('0x6'));var ejs=require(_0x4256('0x7'));var fs=require('fs');var fs_extra=require(_0x4256('0x8'));var _=require(_0x4256('0x9'));var squel=require(_0x4256('0xa'));var crypto=require(_0x4256('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4256('0x6'));var querystring=require(_0x4256('0xc'));var Papa=require('papaparse');var Redis=require(_0x4256('0xd'));var authService=require(_0x4256('0xe'));var qs=require(_0x4256('0xf'));var as=require(_0x4256('0x10'));var hardwareService=require(_0x4256('0x11'));var logger=require(_0x4256('0x12'))('api');var utils=require(_0x4256('0x13'));var config=require(_0x4256('0x14'));var licenseUtil=require(_0x4256('0x15'));var db=require(_0x4256('0x16'))['db'];var integrations=require(_0x4256('0x17'));function respondWithStatusCode(_0x21241e,_0x1afb3d){_0x1afb3d=_0x1afb3d||0xcc;return function(_0x36c107){if(_0x36c107){return _0x21241e['sendStatus'](_0x1afb3d);}return _0x21241e[_0x4256('0x18')](_0x1afb3d)[_0x4256('0x19')]();};}function respondWithResult(_0x499b47,_0x25dce8){_0x25dce8=_0x25dce8||0xc8;return function(_0xdcce27){if(_0xdcce27){return _0x499b47[_0x4256('0x18')](_0x25dce8)[_0x4256('0x1a')](_0xdcce27);}};}function respondWithFilteredResult(_0x15b510,_0x1d3b11){return function(_0x2b39fd){if(_0x2b39fd){var _0x496c5f=typeof _0x1d3b11['offset']===_0x4256('0x1b')&&typeof _0x1d3b11[_0x4256('0x1c')]===_0x4256('0x1b');var _0x57b694=_0x2b39fd[_0x4256('0x1d')];var _0x3a4f13=_0x496c5f?0x0:_0x1d3b11[_0x4256('0x1e')];var _0x1fd463=_0x496c5f?_0x2b39fd[_0x4256('0x1d')]:_0x1d3b11[_0x4256('0x1e')]+_0x1d3b11[_0x4256('0x1c')];var _0x2c4228;if(_0x1fd463>=_0x57b694){_0x1fd463=_0x57b694;_0x2c4228=0xc8;}else{_0x2c4228=0xce;}_0x15b510['status'](_0x2c4228);return _0x15b510['set'](_0x4256('0x1f'),_0x3a4f13+'-'+_0x1fd463+'/'+_0x57b694)[_0x4256('0x1a')](_0x2b39fd);}return null;};}function patchUpdates(_0x3cbef3){return function(_0x339125){try{jsonpatch['apply'](_0x339125,_0x3cbef3,!![]);}catch(_0x456a91){return BPromise[_0x4256('0x20')](_0x456a91);}return _0x339125[_0x4256('0x21')]();};}function saveUpdates(_0x7a3f26,_0x3a1425){return function(_0x3b3fed){if(_0x3b3fed){return _0x3b3fed[_0x4256('0x22')](_0x7a3f26)[_0x4256('0x23')](function(_0x25bf6e){return _0x25bf6e;});}return null;};}function removeEntity(_0x4c1141,_0x41beca){return function(_0x584a80){if(_0x584a80){return _0x584a80[_0x4256('0x24')]()[_0x4256('0x23')](function(){_0x4c1141['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e2282,_0xba7f77){return function(_0x38a392){if(!_0x38a392){_0x4e2282['sendStatus'](0x194);}return _0x38a392;};}function handleError(_0x457d85,_0x41bea5){_0x41bea5=_0x41bea5||0x1f4;return function(_0x42b940){logger[_0x4256('0x25')](_0x42b940['stack']);if(_0x42b940[_0x4256('0x26')]){delete _0x42b940[_0x4256('0x26')];}_0x457d85[_0x4256('0x18')](_0x41bea5)[_0x4256('0x27')](_0x42b940);};}exports[_0x4256('0x28')]=function(_0x10a663,_0x38e858){var _0x14863e={},_0x2b4139={},_0x1bd9bd={'count':0x0,'rows':[]};var _0x1231aa=_[_0x4256('0x29')](db['ServicenowAccount'][_0x4256('0x2a')],function(_0x3c74b9){return{'name':_0x3c74b9[_0x4256('0x2b')],'type':_0x3c74b9[_0x4256('0x2c')][_0x4256('0x2d')]};});_0x2b4139[_0x4256('0x2e')]=_[_0x4256('0x29')](_0x1231aa,_0x4256('0x26'));_0x2b4139[_0x4256('0x2f')]=_[_0x4256('0x30')](_0x10a663[_0x4256('0x2f')]);_0x2b4139[_0x4256('0x31')]=_[_0x4256('0x32')](_0x2b4139[_0x4256('0x2e')],_0x2b4139[_0x4256('0x2f')]);_0x14863e[_0x4256('0x33')]=_[_0x4256('0x32')](_0x2b4139[_0x4256('0x2e')],qs['fields'](_0x10a663[_0x4256('0x2f')][_0x4256('0x34')]));_0x14863e[_0x4256('0x33')]=_0x14863e[_0x4256('0x33')][_0x4256('0x35')]?_0x14863e[_0x4256('0x33')]:_0x2b4139[_0x4256('0x2e')];if(!_0x10a663['query']['hasOwnProperty'](_0x4256('0x36'))){_0x14863e[_0x4256('0x1c')]=qs[_0x4256('0x1c')](_0x10a663[_0x4256('0x2f')][_0x4256('0x1c')]);_0x14863e['offset']=qs[_0x4256('0x1e')](_0x10a663[_0x4256('0x2f')][_0x4256('0x1e')]);}_0x14863e[_0x4256('0x37')]=qs[_0x4256('0x38')](_0x10a663[_0x4256('0x2f')][_0x4256('0x38')]);_0x14863e[_0x4256('0x39')]=qs[_0x4256('0x31')](_[_0x4256('0x3a')](_0x10a663['query'],_0x2b4139[_0x4256('0x31')]),_0x1231aa);if(_0x10a663[_0x4256('0x2f')][_0x4256('0x3b')]){_0x14863e['where']=_[_0x4256('0x3c')](_0x14863e['where'],{'$or':_['map'](_0x1231aa,function(_0x4dfd7f){if(_0x4dfd7f[_0x4256('0x2c')]!=='VIRTUAL'){var _0x4036e7={};_0x4036e7[_0x4dfd7f[_0x4256('0x26')]]={'$like':'%'+_0x10a663[_0x4256('0x2f')]['filter']+'%'};return _0x4036e7;}})});}_0x14863e=_['merge']({},_0x14863e,_0x10a663[_0x4256('0x3d')]);var _0x4734c8={'where':_0x14863e[_0x4256('0x39')]};return db[_0x4256('0x3e')][_0x4256('0x1d')](_0x4734c8)['then'](function(_0x330441){_0x1bd9bd['count']=_0x330441;if(_0x10a663[_0x4256('0x2f')]['includeAll']){_0x14863e['include']=[{'all':!![]}];}return db[_0x4256('0x3e')][_0x4256('0x3f')](_0x14863e);})[_0x4256('0x23')](function(_0x144252){_0x1bd9bd[_0x4256('0x40')]=_0x144252;return _0x1bd9bd;})[_0x4256('0x23')](respondWithFilteredResult(_0x38e858,_0x14863e))[_0x4256('0x41')](handleError(_0x38e858,null));};exports['show']=function(_0x4da0a3,_0x180ad6){var _0x32b4bc={'raw':![],'where':{'id':_0x4da0a3['params']['id']}},_0x3a5475={};_0x3a5475[_0x4256('0x2e')]=_['keys'](db['ServicenowAccount'][_0x4256('0x2a')]);_0x3a5475[_0x4256('0x2f')]=_['keys'](_0x4da0a3['query']);_0x3a5475[_0x4256('0x31')]=_['intersection'](_0x3a5475['model'],_0x3a5475[_0x4256('0x2f')]);_0x32b4bc[_0x4256('0x33')]=_[_0x4256('0x32')](_0x3a5475[_0x4256('0x2e')],qs[_0x4256('0x34')](_0x4da0a3[_0x4256('0x2f')][_0x4256('0x34')]));_0x32b4bc[_0x4256('0x33')]=_0x32b4bc[_0x4256('0x33')]['length']?_0x32b4bc[_0x4256('0x33')]:_0x3a5475['model'];if(_0x4da0a3['query']['includeAll']){_0x32b4bc[_0x4256('0x42')]=[{'all':!![]}];}_0x32b4bc=_[_0x4256('0x3c')]({},_0x32b4bc,_0x4da0a3[_0x4256('0x3d')]);return db['ServicenowAccount'][_0x4256('0x43')](_0x32b4bc)['then'](handleEntityNotFound(_0x180ad6,null))[_0x4256('0x23')](respondWithResult(_0x180ad6,null))[_0x4256('0x41')](handleError(_0x180ad6,null));};exports['create']=function(_0x3ecce1,_0x6eda6e){return db[_0x4256('0x3e')][_0x4256('0x44')](_0x3ecce1['body'],{})[_0x4256('0x23')](respondWithResult(_0x6eda6e,0xc9))[_0x4256('0x41')](handleError(_0x6eda6e,null));};exports['update']=function(_0x3e1f74,_0x16f1b2){if(_0x3e1f74['body']['id']){delete _0x3e1f74[_0x4256('0x45')]['id'];}return db['ServicenowAccount'][_0x4256('0x43')]({'where':{'id':_0x3e1f74[_0x4256('0x46')]['id']}})['then'](handleEntityNotFound(_0x16f1b2,null))[_0x4256('0x23')](saveUpdates(_0x3e1f74[_0x4256('0x45')],null))[_0x4256('0x23')](respondWithResult(_0x16f1b2,null))['catch'](handleError(_0x16f1b2,null));};exports[_0x4256('0x24')]=function(_0x3f19af,_0x4d8dac){return db[_0x4256('0x3e')][_0x4256('0x43')]({'where':{'id':_0x3f19af[_0x4256('0x46')]['id']}})[_0x4256('0x23')](handleEntityNotFound(_0x4d8dac,null))[_0x4256('0x23')](removeEntity(_0x4d8dac,null))[_0x4256('0x41')](handleError(_0x4d8dac,null));};exports[_0x4256('0x47')]=function(_0x20bc7b,_0x1eceb1,_0x531235){var _0x3ac231={};var _0x10737a={};var _0x32158a;var _0x1e3505;return db[_0x4256('0x3e')][_0x4256('0x48')]({'where':{'id':_0x20bc7b[_0x4256('0x46')]['id']}})[_0x4256('0x23')](handleEntityNotFound(_0x1eceb1,null))[_0x4256('0x23')](function(_0x13e27e){if(_0x13e27e){_0x32158a=_0x13e27e;_0x10737a[_0x4256('0x2e')]=_[_0x4256('0x30')](db[_0x4256('0x49')]['rawAttributes']);_0x10737a[_0x4256('0x2f')]=_[_0x4256('0x30')](_0x20bc7b[_0x4256('0x2f')]);_0x10737a[_0x4256('0x31')]=_['intersection'](_0x10737a['model'],_0x10737a['query']);_0x3ac231[_0x4256('0x33')]=_[_0x4256('0x32')](_0x10737a[_0x4256('0x2e')],qs[_0x4256('0x34')](_0x20bc7b[_0x4256('0x2f')][_0x4256('0x34')]));_0x3ac231[_0x4256('0x33')]=_0x3ac231[_0x4256('0x33')][_0x4256('0x35')]?_0x3ac231[_0x4256('0x33')]:_0x10737a[_0x4256('0x2e')];_0x3ac231[_0x4256('0x37')]=qs[_0x4256('0x38')](_0x20bc7b[_0x4256('0x2f')][_0x4256('0x38')]);_0x3ac231[_0x4256('0x39')]=qs[_0x4256('0x31')](_[_0x4256('0x3a')](_0x20bc7b[_0x4256('0x2f')],_0x10737a['filters']));if(_0x20bc7b[_0x4256('0x2f')][_0x4256('0x3b')]){_0x3ac231[_0x4256('0x39')]=_[_0x4256('0x3c')](_0x3ac231[_0x4256('0x39')],{'$or':_['map'](_0x3ac231[_0x4256('0x33')],function(_0x36640b){var _0x2055dd={};_0x2055dd[_0x36640b]={'$like':'%'+_0x20bc7b['query'][_0x4256('0x3b')]+'%'};return _0x2055dd;})});}_0x3ac231=_['merge']({},_0x3ac231,_0x20bc7b[_0x4256('0x3d')]);return _0x32158a[_0x4256('0x47')](_0x3ac231);}})['then'](function(_0x41f865){if(_0x41f865){_0x1e3505=_0x41f865[_0x4256('0x35')];if(!_0x20bc7b[_0x4256('0x2f')][_0x4256('0x4a')](_0x4256('0x36'))){_0x3ac231[_0x4256('0x1c')]=qs[_0x4256('0x1c')](_0x20bc7b[_0x4256('0x2f')]['limit']);_0x3ac231['offset']=qs[_0x4256('0x1e')](_0x20bc7b['query'][_0x4256('0x1e')]);}return _0x32158a['getConfigurations'](_0x3ac231);}})[_0x4256('0x23')](function(_0x3fba12){if(_0x3fba12){return _0x3fba12?{'count':_0x1e3505,'rows':_0x3fba12}:null;}})[_0x4256('0x23')](respondWithResult(_0x1eceb1,null))[_0x4256('0x41')](handleError(_0x1eceb1,null));};exports['addConfiguration']=function(_0x2d9c0e,_0xbd2c77,_0x40c231){if(_0x2d9c0e['body']['id']){delete _0x2d9c0e[_0x4256('0x45')]['id'];}return db[_0x4256('0x3e')][_0x4256('0x48')]({'where':{'id':_0x2d9c0e[_0x4256('0x46')]['id']}})[_0x4256('0x23')](handleEntityNotFound(_0xbd2c77,null))[_0x4256('0x23')](function(_0x3681dc){if(_0x3681dc){_0x2d9c0e[_0x4256('0x45')]['AccountId']=_0x3681dc['id'];_0x2d9c0e[_0x4256('0x45')][_0x4256('0x4b')]=integrations['getSubjects'](_0x2d9c0e[_0x4256('0x45')][_0x4256('0x4c')],_0x2d9c0e[_0x4256('0x45')][_0x4256('0x2c')]);_0x2d9c0e['body'][_0x4256('0x4d')]=integrations[_0x4256('0x4e')](_0x2d9c0e[_0x4256('0x45')][_0x4256('0x4c')],_0x2d9c0e[_0x4256('0x45')][_0x4256('0x2c')]);return db[_0x4256('0x49')][_0x4256('0x44')](_0x2d9c0e[_0x4256('0x45')],{'include':[{'model':db[_0x4256('0x4f')],'as':_0x4256('0x4b')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xbd2c77,null))[_0x4256('0x41')](handleError(_0xbd2c77,null));};exports[_0x4256('0x50')]=function(_0x46a4b0,_0x4fa2fb,_0xa7320c){var _0x194fc6=[_0x4256('0x51'),_0x4256('0x52'),_0x4256('0x53'),'subcategory',_0x4256('0x54'),'notify','incident_state',_0x4256('0x55'),_0x4256('0x56')];var _0x3f0cd8=[_0x4256('0x57'),_0x4256('0x51'),_0x4256('0x58'),_0x4256('0x59'),_0x4256('0x5a'),_0x4256('0x5b'),_0x4256('0x5c'),'hold_reason',_0x4256('0x5d'),'number',_0x4256('0x5e'),'sys_updated_by','opened_by',_0x4256('0x5f'),_0x4256('0x60'),_0x4256('0x61'),_0x4256('0x62'),_0x4256('0x63'),_0x4256('0x53'),'order',_0x4256('0x64'),'closed_at','cmdb_ci',_0x4256('0x65'),_0x4256('0x66'),'active','work_notes_list',_0x4256('0x67'),_0x4256('0x68'),'sys_domain_path',_0x4256('0x69'),_0x4256('0x6a'),_0x4256('0x6b'),_0x4256('0x6c'),_0x4256('0x6d'),_0x4256('0x6e'),'work_end',_0x4256('0x6f'),'resolved_at',_0x4256('0x70'),_0x4256('0x71'),_0x4256('0x72'),'work_notes',_0x4256('0x73'),_0x4256('0x54'),'correlation_display','delivery_task',_0x4256('0x74'),_0x4256('0x75'),_0x4256('0x76'),_0x4256('0x77'),_0x4256('0x78'),_0x4256('0x79'),_0x4256('0x7a'),'sys_class_name',_0x4256('0x7b'),_0x4256('0x7c'),_0x4256('0x7d'),_0x4256('0x7e'),_0x4256('0x7f'),'contact_type',_0x4256('0x80'),_0x4256('0x81'),'urgency','problem_id','company',_0x4256('0x82'),_0x4256('0x83'),_0x4256('0x84'),_0x4256('0x55'),_0x4256('0x85'),_0x4256('0x86'),'approval',_0x4256('0x87'),'due_date',_0x4256('0x88'),_0x4256('0x89'),'sys_tags',_0x4256('0x8a'),_0x4256('0x8b'),_0x4256('0x8c'),_0x4256('0x8d'),_0x4256('0x56')];var _0x552309='';var _0x32dd9c='';var _0x17af42=[];var _0x53743c='';var _0x27c872='';var _0x2e5339=[];var _0x2d8c64='';var _0x3bc30b='';var _0x904de={};var _0x397706='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x46a4b0[_0x4256('0x46')]['id']},'attributes':['id',_0x4256('0x8e'),_0x4256('0x8f'),_0x4256('0x90'),'remoteUri',_0x4256('0x91')]})['then'](handleEntityNotFound(_0x4fa2fb,null))['then'](function(_0x43f277){if(_0x43f277){_0x397706=_0x43f277[_0x4256('0x92')];var _0xc32652=_0x397706[_0x4256('0x93')](-0x1);if(_0xc32652==='/'){_0x397706=_0x397706[_0x4256('0x94')](0x0,_0x397706['lastIndexOf'](_0xc32652));}_0x3bc30b=util[_0x4256('0x95')](_0x4256('0x96'),_0x397706);_0x2d8c64=util[_0x4256('0x95')](_0x4256('0x97'),_0x397706);_0x904de={'user':_0x43f277[_0x4256('0x8e')],'pass':_0x43f277[_0x4256('0x8f')]};var _0x2d4a75={'method':_0x4256('0x98'),'uri':_0x3bc30b+_0x4256('0x99'),'auth':_0x904de,'json':!![]};return rp(_0x2d4a75);}})[_0x4256('0x23')](function(_0x3e7741){if(_0x3e7741[_0x4256('0x9a')][_0x4256('0x35')]>0x0){_0x552309=_0x3e7741[_0x4256('0x9a')];}console[_0x4256('0x9b')](_0x4256('0x9c'),_0x552309);_0x2e5339=[];_0x32dd9c=Object[_0x4256('0x9d')]([],_0x552309);_['remove'](_0x32dd9c,function(_0x45f38a){return!_0x194fc6[_0x4256('0x9e')](_0x45f38a[_0x4256('0x26')]);});_0x32dd9c[_0x4256('0x9f')](function(_0x2c5e44){var _0x27c171=createFieldObject(_0x2d8c64,_0x904de,_0x2c5e44[_0x4256('0xa0')],_0x2c5e44[_0x4256('0x26')],_0x2c5e44[_0x4256('0xa1')],![]);_0x2e5339[_0x4256('0xa2')](_0x27c171);});return Promise['all'](_0x2e5339);})['then'](function(_0x426dfd){_0x17af42=_0x426dfd;_0x53743c=Object[_0x4256('0x9d')]([],_0x552309);console[_0x4256('0x9b')](_0x4256('0xa3'),_0x552309);_[_0x4256('0xa4')](_0x53743c,function(_0x354449){return _0x3f0cd8['includes'](_0x354449[_0x4256('0x26')]);});console[_0x4256('0x9b')](_0x4256('0xa5'),_0x53743c);_0x2e5339=[];_0x53743c[_0x4256('0x9f')](function(_0x509b66){var _0x37651c=createFieldObject(_0x2d8c64,_0x904de,_0x509b66[_0x4256('0xa0')],_0x509b66[_0x4256('0x26')],_0x509b66[_0x4256('0xa1')],!![]);_0x2e5339['push'](_0x37651c);});return Promise['all'](_0x2e5339);})[_0x4256('0x23')](function(_0x59cafd){_0x27c872=_0x59cafd;var _0x475ba2=_0x17af42[_0x4256('0xa6')](_0x27c872);return{'count':_0x475ba2[_0x4256('0x35')],'rows':_0x475ba2};})['then'](respondWithResult(_0x4fa2fb,null))[_0x4256('0x41')](function(_0x523bdf){console[_0x4256('0x9b')](_0x4256('0xa7')+_0x523bdf);var _0xa6f741=_0x46a4b0[_0x4256('0x2f')][_0x4256('0xa8')]?0x1f4:_0x523bdf[_0x4256('0xa9')]||0x1f4;logger[_0x4256('0x25')](_0x523bdf['stack']);delete _0x523bdf[_0x4256('0x26')];if(_0xa6f741===0x191){_0xa6f741=0x190;}_0x4fa2fb[_0x4256('0x18')](_0xa6f741)[_0x4256('0x27')](_0x46a4b0[_0x4256('0x2f')][_0x4256('0xa8')]?{'message':'Wrong\x20credentials','statusCode':_0x523bdf[_0x4256('0xa9')]}:_0x523bdf);});};function createFieldObject(_0x15347f,_0x13b135,_0x25f388,_0x1779c2,_0x2e33f7,_0x365566){return new Promise(function(_0x46ccbc,_0x3c19b9){var _0x383378={'id':_0x1779c2,'name':_0x2e33f7,'custom':_0x365566};if(_0x25f388==='boolean'){_0x383378[_0x4256('0x3d')]=[{'name':_0x4256('0xaa'),'value':_0x4256('0xab')},{'name':_0x4256('0xac'),'value':_0x4256('0xad')}];_0x46ccbc(_0x383378);}else{var _0x5703c6={'method':_0x4256('0x98'),'uri':_0x15347f+_0x4256('0xae')+_0x1779c2,'auth':_0x13b135,'json':!![]};return rp(_0x5703c6)[_0x4256('0x23')](function(_0x30956c){var _0xb637a7=[];if(_0x30956c[_0x4256('0x9a')][_0x4256('0x35')]>0x0){_0x30956c['result'][_0x4256('0x9f')](function(_0x4e5c11){if(_0x4e5c11[_0x4256('0xaf')]===_0x4256('0xad')){var _0x57138={'name':_0x4e5c11[_0x4256('0xa1')],'value':_0x4e5c11['value']};_0xb637a7[_0x4256('0xa2')](_0x57138);}});}_0x383378[_0x4256('0x3d')]=_0xb637a7;if(_0x383378[_0x4256('0x3d')][_0x4256('0x35')]>0x0){_0x46ccbc(_0x383378);}else{if(_0x365566==![]){_0x46ccbc();}else{_0x46ccbc(_0x383378);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index bb50e92..1752a47 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 _0x5075=['bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x362979,_0x2d5673){var _0x13c81d=function(_0x555357){while(--_0x555357){_0x362979['push'](_0x362979['shift']());}};_0x13c81d(++_0x2d5673);}(_0x5075,0x73));var _0x5507=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0x5075[_0x51b0dc];return _0x13fa89;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var BPromise=require(_0x5507('0x5'));var rp=require(_0x5507('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var attributes=require(_0x5507('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2cd9ee,_0x773559){return _0x2cd9ee['define'](_0x5507('0xa'),attributes,{'tableName':_0x5507('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','util','../../config/logger','api','bluebird'];(function(_0x22fd47,_0x4c8d45){var _0x5a050e=function(_0x397d31){while(--_0x397d31){_0x22fd47['push'](_0x22fd47['shift']());}};_0x5a050e(++_0x4c8d45);}(_0x038b,0x114));var _0xb038=function(_0x1248bf,_0x5cd5e6){_0x1248bf=_0x1248bf-0x0;var _0x128ac7=_0x038b[_0x1248bf];return _0x128ac7;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));var integrations=require(_0xb038('0x7'));module['exports']=function(_0x54e1e7,_0x2e3e64){return _0x54e1e7[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index ba3b56a..4e135bc 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 _0x9f7d=['catch','ShowServicenowAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetServicenowAccount','ServicenowAccount','options','where','attributes','limit','map','model','include','debug'];(function(_0x3f627c,_0x506c0e){var _0xcdc4b6=function(_0x2da7d5){while(--_0x2da7d5){_0x3f627c['push'](_0x3f627c['shift']());}};_0xcdc4b6(++_0x506c0e);}(_0x9f7d,0x67));var _0xd9f7=function(_0x4dd904,_0x50878c){_0x4dd904=_0x4dd904-0x0;var _0xb0e013=_0x9f7d[_0x4dd904];return _0xb0e013;};'use strict';var _=require(_0xd9f7('0x0'));var util=require(_0xd9f7('0x1'));var moment=require(_0xd9f7('0x2'));var BPromise=require(_0xd9f7('0x3'));var rs=require(_0xd9f7('0x4'));var fs=require('fs');var Redis=require(_0xd9f7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9f7('0x6'));var logger=require(_0xd9f7('0x7'))(_0xd9f7('0x8'));var config=require(_0xd9f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd209a9,_0x714905,_0x46244e){return new BPromise(function(_0x45cb1f,_0x4fa5fd){return client[_0xd9f7('0xa')](_0xd209a9,_0x46244e)[_0xd9f7('0xb')](function(_0x60c3c0){logger[_0xd9f7('0xc')](_0xd9f7('0xd'),_0x714905,_0xd9f7('0xe'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x714905,'request\x20sent',JSON['stringify'](_0x60c3c0));if(_0x60c3c0[_0xd9f7('0xf')]){if(_0x60c3c0[_0xd9f7('0xf')][_0xd9f7('0x10')]===0x1f4){logger[_0xd9f7('0xf')](_0xd9f7('0xd'),_0x714905,_0x60c3c0[_0xd9f7('0xf')][_0xd9f7('0x11')]);return _0x4fa5fd(_0x60c3c0[_0xd9f7('0xf')]['message']);}logger[_0xd9f7('0xf')](_0xd9f7('0xd'),_0x714905,_0x60c3c0[_0xd9f7('0xf')][_0xd9f7('0x11')]);return _0x45cb1f(_0x60c3c0[_0xd9f7('0xf')][_0xd9f7('0x11')]);}else{logger[_0xd9f7('0xc')](_0xd9f7('0xd'),_0x714905,_0xd9f7('0xe'));_0x45cb1f(_0x60c3c0[_0xd9f7('0x12')]['message']);}})['catch'](function(_0x6b9fa9){logger[_0xd9f7('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x714905,_0x6b9fa9);_0x4fa5fd(_0x6b9fa9);});});}exports[_0xd9f7('0x13')]=function(_0x439114){var _0xbbaadc=this;return new Promise(function(_0x2e0d8a,_0x5c3348){return db[_0xd9f7('0x14')]['findAll']({'raw':_0x439114[_0xd9f7('0x15')]?_0x439114[_0xd9f7('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x439114[_0xd9f7('0x15')]?_0x439114[_0xd9f7('0x15')][_0xd9f7('0x16')]||null:null,'attributes':_0x439114['options']?_0x439114[_0xd9f7('0x15')][_0xd9f7('0x17')]||null:null,'limit':_0x439114[_0xd9f7('0x15')]?_0x439114[_0xd9f7('0x15')][_0xd9f7('0x18')]||null:null,'include':_0x439114[_0xd9f7('0x15')]?_0x439114['options']['include']?_[_0xd9f7('0x19')](_0x439114[_0xd9f7('0x15')]['include'],function(_0x432198){return{'model':db[_0x432198[_0xd9f7('0x1a')]],'as':_0x432198['as'],'attributes':_0x432198[_0xd9f7('0x17')],'include':_0x432198[_0xd9f7('0x1b')]?_[_0xd9f7('0x19')](_0x432198['include'],function(_0x4bae95){return{'model':db[_0x4bae95[_0xd9f7('0x1a')]],'as':_0x4bae95['as'],'attributes':_0x4bae95['attributes'],'include':_0x4bae95[_0xd9f7('0x1b')]?_[_0xd9f7('0x19')](_0x4bae95[_0xd9f7('0x1b')],function(_0x36e5b5){return{'model':db[_0x36e5b5['model']],'as':_0x36e5b5['as'],'attributes':_0x36e5b5[_0xd9f7('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd9f7('0xb')](function(_0x3e3ba6){logger[_0xd9f7('0xc')]('GetServicenowAccount',_0x439114);logger[_0xd9f7('0x1c')]('GetServicenowAccount',_0x439114,JSON['stringify'](_0x3e3ba6));_0x2e0d8a(_0x3e3ba6);})[_0xd9f7('0x1d')](function(_0x46e97b){logger[_0xd9f7('0xf')]('GetServicenowAccount',_0x46e97b[_0xd9f7('0x11')],_0x439114);_0x5c3348(_0xbbaadc['error'](0x1f4,_0x46e97b[_0xd9f7('0x11')]));});});};exports[_0xd9f7('0x1e')]=function(_0x366126){var _0x18e4f1=this;return new Promise(function(_0x2de915,_0x372f9b){return db[_0xd9f7('0x14')][_0xd9f7('0x1f')]({'raw':_0x366126['options']?_0x366126[_0xd9f7('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x366126[_0xd9f7('0x15')]?_0x366126[_0xd9f7('0x15')][_0xd9f7('0x16')]||null:null,'attributes':_0x366126[_0xd9f7('0x15')]?_0x366126[_0xd9f7('0x15')][_0xd9f7('0x17')]||null:null,'include':_0x366126[_0xd9f7('0x15')]?_0x366126[_0xd9f7('0x15')][_0xd9f7('0x1b')]?_[_0xd9f7('0x19')](_0x366126['options']['include'],function(_0x3248ef){return{'model':db[_0x3248ef[_0xd9f7('0x1a')]],'as':_0x3248ef['as'],'attributes':_0x3248ef[_0xd9f7('0x17')],'include':_0x3248ef[_0xd9f7('0x1b')]?_[_0xd9f7('0x19')](_0x3248ef[_0xd9f7('0x1b')],function(_0xe9870f){return{'model':db[_0xe9870f[_0xd9f7('0x1a')]],'as':_0xe9870f['as'],'attributes':_0xe9870f['attributes'],'include':_0xe9870f[_0xd9f7('0x1b')]?_['map'](_0xe9870f[_0xd9f7('0x1b')],function(_0x44a51b){return{'model':db[_0x44a51b['model']],'as':_0x44a51b['as'],'attributes':_0x44a51b[_0xd9f7('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd9f7('0xb')](function(_0x33e425){logger['info']('ShowServicenowAccount',_0x366126);logger[_0xd9f7('0x1c')](_0xd9f7('0x1e'),_0x366126,JSON[_0xd9f7('0x20')](_0x33e425));_0x2de915(_0x33e425);})[_0xd9f7('0x1d')](function(_0x2217ec){logger[_0xd9f7('0xf')](_0xd9f7('0x1e'),_0x2217ec[_0xd9f7('0x11')],_0x366126);_0x372f9b(_0x18e4f1[_0xd9f7('0xf')](0x1f4,_0x2217ec[_0xd9f7('0x11')]));});});}; \ No newline at end of file +var _0xf434=['findAll','options','raw','where','limit','include','model','attributes','map','then','stringify','ShowServicenowAccount','ServicenowAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetServicenowAccount'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0xf434,0x15b));var _0x4f43=function(_0x21dd8a,_0x39c0c0){_0x21dd8a=_0x21dd8a-0x0;var _0x57c2ad=_0xf434[_0x21dd8a];return _0x57c2ad;};'use strict';var _=require(_0x4f43('0x0'));var util=require('util');var moment=require(_0x4f43('0x1'));var BPromise=require(_0x4f43('0x2'));var rs=require(_0x4f43('0x3'));var fs=require('fs');var Redis=require(_0x4f43('0x4'));var db=require(_0x4f43('0x5'))['db'];var utils=require(_0x4f43('0x6'));var logger=require(_0x4f43('0x7'))(_0x4f43('0x8'));var config=require(_0x4f43('0x9'));var jayson=require(_0x4f43('0xa'));var client=jayson[_0x4f43('0xb')][_0x4f43('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26aa90,_0x45ffb4,_0x267ad1){return new BPromise(function(_0x2f8ce1,_0x584e33){return client['request'](_0x26aa90,_0x267ad1)['then'](function(_0x2f9ac9){logger['info'](_0x4f43('0xd'),_0x45ffb4,_0x4f43('0xe'));logger[_0x4f43('0xf')](_0x4f43('0x10'),_0x45ffb4,_0x4f43('0xe'),JSON['stringify'](_0x2f9ac9));if(_0x2f9ac9[_0x4f43('0x11')]){if(_0x2f9ac9[_0x4f43('0x11')][_0x4f43('0x12')]===0x1f4){logger[_0x4f43('0x11')](_0x4f43('0xd'),_0x45ffb4,_0x2f9ac9[_0x4f43('0x11')][_0x4f43('0x13')]);return _0x584e33(_0x2f9ac9[_0x4f43('0x11')][_0x4f43('0x13')]);}logger[_0x4f43('0x11')](_0x4f43('0xd'),_0x45ffb4,_0x2f9ac9[_0x4f43('0x11')][_0x4f43('0x13')]);return _0x2f8ce1(_0x2f9ac9[_0x4f43('0x11')][_0x4f43('0x13')]);}else{logger['info'](_0x4f43('0xd'),_0x45ffb4,_0x4f43('0xe'));_0x2f8ce1(_0x2f9ac9[_0x4f43('0x14')]['message']);}})[_0x4f43('0x15')](function(_0x26bdc8){logger[_0x4f43('0x11')](_0x4f43('0xd'),_0x45ffb4,_0x26bdc8);_0x584e33(_0x26bdc8);});});}exports[_0x4f43('0x16')]=function(_0x5e8cfc){var _0x445743=this;return new Promise(function(_0x86bc2,_0x40349a){return db['ServicenowAccount'][_0x4f43('0x17')]({'raw':_0x5e8cfc[_0x4f43('0x18')]?_0x5e8cfc[_0x4f43('0x18')][_0x4f43('0x19')]===undefined?!![]:![]:!![],'where':_0x5e8cfc['options']?_0x5e8cfc[_0x4f43('0x18')][_0x4f43('0x1a')]||null:null,'attributes':_0x5e8cfc[_0x4f43('0x18')]?_0x5e8cfc[_0x4f43('0x18')]['attributes']||null:null,'limit':_0x5e8cfc[_0x4f43('0x18')]?_0x5e8cfc[_0x4f43('0x18')][_0x4f43('0x1b')]||null:null,'include':_0x5e8cfc['options']?_0x5e8cfc[_0x4f43('0x18')][_0x4f43('0x1c')]?_['map'](_0x5e8cfc['options'][_0x4f43('0x1c')],function(_0x4b5a7f){return{'model':db[_0x4b5a7f[_0x4f43('0x1d')]],'as':_0x4b5a7f['as'],'attributes':_0x4b5a7f['attributes'],'include':_0x4b5a7f[_0x4f43('0x1c')]?_['map'](_0x4b5a7f['include'],function(_0x48ae18){return{'model':db[_0x48ae18[_0x4f43('0x1d')]],'as':_0x48ae18['as'],'attributes':_0x48ae18[_0x4f43('0x1e')],'include':_0x48ae18[_0x4f43('0x1c')]?_[_0x4f43('0x1f')](_0x48ae18[_0x4f43('0x1c')],function(_0x3a3c80){return{'model':db[_0x3a3c80[_0x4f43('0x1d')]],'as':_0x3a3c80['as'],'attributes':_0x3a3c80[_0x4f43('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f43('0x20')](function(_0xf67044){logger['info'](_0x4f43('0x16'),_0x5e8cfc);logger[_0x4f43('0xf')](_0x4f43('0x16'),_0x5e8cfc,JSON[_0x4f43('0x21')](_0xf67044));_0x86bc2(_0xf67044);})[_0x4f43('0x15')](function(_0x2546a7){logger[_0x4f43('0x11')](_0x4f43('0x16'),_0x2546a7[_0x4f43('0x13')],_0x5e8cfc);_0x40349a(_0x445743[_0x4f43('0x11')](0x1f4,_0x2546a7[_0x4f43('0x13')]));});});};exports[_0x4f43('0x22')]=function(_0x5db6d8){var _0x355a6c=this;return new Promise(function(_0x255a3a,_0x470321){return db[_0x4f43('0x23')][_0x4f43('0x24')]({'raw':_0x5db6d8[_0x4f43('0x18')]?_0x5db6d8[_0x4f43('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5db6d8[_0x4f43('0x18')]?_0x5db6d8[_0x4f43('0x18')]['where']||null:null,'attributes':_0x5db6d8[_0x4f43('0x18')]?_0x5db6d8['options']['attributes']||null:null,'include':_0x5db6d8[_0x4f43('0x18')]?_0x5db6d8[_0x4f43('0x18')][_0x4f43('0x1c')]?_[_0x4f43('0x1f')](_0x5db6d8[_0x4f43('0x18')][_0x4f43('0x1c')],function(_0xcbcd62){return{'model':db[_0xcbcd62[_0x4f43('0x1d')]],'as':_0xcbcd62['as'],'attributes':_0xcbcd62[_0x4f43('0x1e')],'include':_0xcbcd62['include']?_[_0x4f43('0x1f')](_0xcbcd62[_0x4f43('0x1c')],function(_0x2a0aa6){return{'model':db[_0x2a0aa6[_0x4f43('0x1d')]],'as':_0x2a0aa6['as'],'attributes':_0x2a0aa6[_0x4f43('0x1e')],'include':_0x2a0aa6['include']?_[_0x4f43('0x1f')](_0x2a0aa6[_0x4f43('0x1c')],function(_0x11fed7){return{'model':db[_0x11fed7[_0x4f43('0x1d')]],'as':_0x11fed7['as'],'attributes':_0x11fed7['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f43('0x20')](function(_0x1d3241){logger['info']('ShowServicenowAccount',_0x5db6d8);logger[_0x4f43('0xf')](_0x4f43('0x22'),_0x5db6d8,JSON['stringify'](_0x1d3241));_0x255a3a(_0x1d3241);})[_0x4f43('0x15')](function(_0xccdc2b){logger[_0x4f43('0x11')](_0x4f43('0x22'),_0xccdc2b[_0x4f43('0x13')],_0x5db6d8);_0x470321(_0x355a6c[_0x4f43('0x11')](0x1f4,_0xccdc2b[_0x4f43('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d71f336..5ac5b72 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 _0xdafc=['../../config/environment','index','get','/:id','isAuthenticated','/:id/subjects','/:id/descriptions','post','create','put','update','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0xdafc,0x1ab));var _0xcdaf=function(_0x510634,_0x2d2bf9){_0x510634=_0x510634-0x0;var _0x5a5609=_0xdafc[_0x510634];return _0x5a5609;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcdaf('0x0'));var express=require('express');var router=express[_0xcdaf('0x1')]();var fs_extra=require(_0xcdaf('0x2'));var auth=require(_0xcdaf('0x3'));var interaction=require(_0xcdaf('0x4'));var config=require(_0xcdaf('0x5'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xcdaf('0x6')]);router[_0xcdaf('0x7')](_0xcdaf('0x8'),auth[_0xcdaf('0x9')](),controller['show']);router[_0xcdaf('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xcdaf('0x7')](_0xcdaf('0xa'),auth[_0xcdaf('0x9')](),controller['getSubjects']);router[_0xcdaf('0x7')](_0xcdaf('0xb'),auth[_0xcdaf('0x9')](),controller['getDescriptions']);router[_0xcdaf('0xc')]('/',auth[_0xcdaf('0x9')](),controller[_0xcdaf('0xd')]);router[_0xcdaf('0xe')]('/:id',auth[_0xcdaf('0x9')](),controller[_0xcdaf('0xf')]);router['delete'](_0xcdaf('0x8'),auth['isAuthenticated'](),controller[_0xcdaf('0x10')]);module[_0xcdaf('0x11')]=router; \ No newline at end of file +var _0x2ab1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','put','delete','destroy','exports','util','path'];(function(_0x2be087,_0x4072b8){var _0x5a2855=function(_0x3c0088){while(--_0x3c0088){_0x2be087['push'](_0x2be087['shift']());}};_0x5a2855(++_0x4072b8);}(_0x2ab1,0x1b3));var _0x12ab=function(_0x77aaca,_0x43ccbb){_0x77aaca=_0x77aaca-0x0;var _0x46af82=_0x2ab1[_0x77aaca];return _0x46af82;};'use strict';var multer=require('multer');var util=require(_0x12ab('0x0'));var path=require(_0x12ab('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x12ab('0x2')]();var fs_extra=require(_0x12ab('0x3'));var auth=require(_0x12ab('0x4'));var interaction=require(_0x12ab('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x12ab('0x6')]('/',auth['isAuthenticated'](),controller[_0x12ab('0x7')]);router[_0x12ab('0x6')](_0x12ab('0x8'),auth[_0x12ab('0x9')](),controller[_0x12ab('0xa')]);router[_0x12ab('0x6')](_0x12ab('0xb'),auth[_0x12ab('0x9')](),controller[_0x12ab('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x12ab('0xd')]);router[_0x12ab('0x6')]('/:id/descriptions',auth[_0x12ab('0x9')](),controller[_0x12ab('0xe')]);router['post']('/',auth[_0x12ab('0x9')](),controller['create']);router[_0x12ab('0xf')]('/:id',auth[_0x12ab('0x9')](),controller['update']);router[_0x12ab('0x10')](_0x12ab('0x8'),auth[_0x12ab('0x9')](),controller[_0x12ab('0x11')]);module[_0x12ab('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 55d9ef7..b141b61 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 _0x0326=['exports','STRING','sequelize'];(function(_0x24a86a,_0x2ce743){var _0x479b79=function(_0x3f7313){while(--_0x3f7313){_0x24a86a['push'](_0x24a86a['shift']());}};_0x479b79(++_0x2ce743);}(_0x0326,0x1a3));var _0x6032=function(_0x1178a1,_0x1b9ac8){_0x1178a1=_0x1178a1-0x0;var _0x4f6545=_0x0326[_0x1178a1];return _0x4f6545;};'use strict';var Sequelize=require(_0x6032('0x0'));module[_0x6032('0x1')]={'name':{'type':Sequelize[_0x6032('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x59c3=['STRING'];(function(_0x401c3d,_0x166859){var _0x404170=function(_0x1f5190){while(--_0x1f5190){_0x401c3d['push'](_0x401c3d['shift']());}};_0x404170(++_0x166859);}(_0x59c3,0x1e2));var _0x359c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x59c3[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x359c('0x0')]},'description':{'type':Sequelize[_0x359c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e5bca77..e660247 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 _0x4a05=['catch','show','params','keys','merge','options','find','create','body','findOne','ServicenowField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','moment','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/utils','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','json','apply','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','ServicenowConfiguration','include','findAll','rows'];(function(_0xec94c4,_0x45fa7f){var _0x38e8f1=function(_0x5d1521){while(--_0x5d1521){_0xec94c4['push'](_0xec94c4['shift']());}};_0x38e8f1(++_0x45fa7f);}(_0x4a05,0x19a));var _0x54a0=function(_0x292716,_0x96d32){_0x292716=_0x292716-0x0;var _0x34cb57=_0x4a05[_0x292716];return _0x34cb57;};'use strict';var emlformat=require(_0x54a0('0x0'));var rimraf=require(_0x54a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x54a0('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x54a0('0x3'));var path=require(_0x54a0('0x4'));var sox=require(_0x54a0('0x5'));var csv=require(_0x54a0('0x6'));var ejs=require(_0x54a0('0x7'));var fs=require('fs');var fs_extra=require(_0x54a0('0x8'));var _=require(_0x54a0('0x9'));var squel=require(_0x54a0('0xa'));var crypto=require(_0x54a0('0xb'));var jsforce=require(_0x54a0('0xc'));var deskjs=require(_0x54a0('0xd'));var toCsv=require(_0x54a0('0x6'));var querystring=require(_0x54a0('0xe'));var Papa=require(_0x54a0('0xf'));var Redis=require(_0x54a0('0x10'));var authService=require(_0x54a0('0x11'));var qs=require(_0x54a0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54a0('0x13'));var logger=require(_0x54a0('0x14'))('api');var utils=require(_0x54a0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x54a0('0x16'));var db=require(_0x54a0('0x17'))['db'];function respondWithStatusCode(_0x53864e,_0xd614d4){_0xd614d4=_0xd614d4||0xcc;return function(_0x22abd1){if(_0x22abd1){return _0x53864e['sendStatus'](_0xd614d4);}return _0x53864e[_0x54a0('0x18')](_0xd614d4)[_0x54a0('0x19')]();};}function respondWithResult(_0x1b349f,_0x26538a){_0x26538a=_0x26538a||0xc8;return function(_0x377e33){if(_0x377e33){return _0x1b349f[_0x54a0('0x18')](_0x26538a)['json'](_0x377e33);}};}function respondWithFilteredResult(_0x13499e,_0x44dbec){return function(_0x24e9e6){if(_0x24e9e6){var _0x4be8c0=typeof _0x44dbec['offset']==='undefined'&&typeof _0x44dbec[_0x54a0('0x1a')]===_0x54a0('0x1b');var _0x55ae07=_0x24e9e6[_0x54a0('0x1c')];var _0xa62045=_0x4be8c0?0x0:_0x44dbec[_0x54a0('0x1d')];var _0x74b41=_0x4be8c0?_0x24e9e6[_0x54a0('0x1c')]:_0x44dbec[_0x54a0('0x1d')]+_0x44dbec['limit'];var _0x109211;if(_0x74b41>=_0x55ae07){_0x74b41=_0x55ae07;_0x109211=0xc8;}else{_0x109211=0xce;}_0x13499e[_0x54a0('0x18')](_0x109211);return _0x13499e['set']('Content-Range',_0xa62045+'-'+_0x74b41+'/'+_0x55ae07)[_0x54a0('0x1e')](_0x24e9e6);}return null;};}function patchUpdates(_0x413585){return function(_0x5390cf){try{jsonpatch[_0x54a0('0x1f')](_0x5390cf,_0x413585,!![]);}catch(_0x2ef6ef){return BPromise[_0x54a0('0x20')](_0x2ef6ef);}return _0x5390cf[_0x54a0('0x21')]();};}function saveUpdates(_0x42d9ff,_0x1038e9){return function(_0x8b8c91){if(_0x8b8c91){return _0x8b8c91[_0x54a0('0x22')](_0x42d9ff)[_0x54a0('0x23')](function(_0x460351){return _0x460351;});}return null;};}function removeEntity(_0x1492ba,_0x7dc06){return function(_0x22f55d){if(_0x22f55d){return _0x22f55d['destroy']()[_0x54a0('0x23')](function(){_0x1492ba[_0x54a0('0x18')](0xcc)[_0x54a0('0x19')]();});}};}function handleEntityNotFound(_0x5c9219,_0x216efc){return function(_0x2436ea){if(!_0x2436ea){_0x5c9219[_0x54a0('0x24')](0x194);}return _0x2436ea;};}function handleError(_0x780024,_0x1e4e4e){_0x1e4e4e=_0x1e4e4e||0x1f4;return function(_0x2c2720){logger[_0x54a0('0x25')](_0x2c2720['stack']);if(_0x2c2720[_0x54a0('0x26')]){delete _0x2c2720[_0x54a0('0x26')];}_0x780024[_0x54a0('0x18')](_0x1e4e4e)[_0x54a0('0x27')](_0x2c2720);};}exports[_0x54a0('0x28')]=function(_0x3cbc87,_0x319e1c){var _0x401cff={},_0x22304d={},_0x391262={'count':0x0,'rows':[]};var _0x4d412b=_[_0x54a0('0x29')](db['ServicenowConfiguration'][_0x54a0('0x2a')],function(_0x5a4494){return{'name':_0x5a4494[_0x54a0('0x2b')],'type':_0x5a4494[_0x54a0('0x2c')][_0x54a0('0x2d')]};});_0x22304d[_0x54a0('0x2e')]=_['map'](_0x4d412b,_0x54a0('0x26'));_0x22304d[_0x54a0('0x2f')]=_['keys'](_0x3cbc87[_0x54a0('0x2f')]);_0x22304d['filters']=_[_0x54a0('0x30')](_0x22304d[_0x54a0('0x2e')],_0x22304d[_0x54a0('0x2f')]);_0x401cff['attributes']=_['intersection'](_0x22304d['model'],qs[_0x54a0('0x31')](_0x3cbc87['query'][_0x54a0('0x31')]));_0x401cff['attributes']=_0x401cff[_0x54a0('0x32')][_0x54a0('0x33')]?_0x401cff['attributes']:_0x22304d[_0x54a0('0x2e')];if(!_0x3cbc87[_0x54a0('0x2f')][_0x54a0('0x34')]('nolimit')){_0x401cff[_0x54a0('0x1a')]=qs[_0x54a0('0x1a')](_0x3cbc87[_0x54a0('0x2f')][_0x54a0('0x1a')]);_0x401cff[_0x54a0('0x1d')]=qs[_0x54a0('0x1d')](_0x3cbc87['query']['offset']);}_0x401cff[_0x54a0('0x35')]=qs[_0x54a0('0x36')](_0x3cbc87[_0x54a0('0x2f')][_0x54a0('0x36')]);_0x401cff[_0x54a0('0x37')]=qs[_0x54a0('0x38')](_[_0x54a0('0x39')](_0x3cbc87['query'],_0x22304d[_0x54a0('0x38')]),_0x4d412b);if(_0x3cbc87[_0x54a0('0x2f')][_0x54a0('0x3a')]){_0x401cff['where']=_['merge'](_0x401cff[_0x54a0('0x37')],{'$or':_['map'](_0x4d412b,function(_0xa9f343){if(_0xa9f343[_0x54a0('0x2c')]!==_0x54a0('0x3b')){var _0x1773ba={};_0x1773ba[_0xa9f343[_0x54a0('0x26')]]={'$like':'%'+_0x3cbc87[_0x54a0('0x2f')][_0x54a0('0x3a')]+'%'};return _0x1773ba;}})});}_0x401cff=_['merge']({},_0x401cff,_0x3cbc87['options']);var _0x5ab8d8={'where':_0x401cff[_0x54a0('0x37')]};return db[_0x54a0('0x3c')][_0x54a0('0x1c')](_0x5ab8d8)[_0x54a0('0x23')](function(_0x2486bd){_0x391262[_0x54a0('0x1c')]=_0x2486bd;if(_0x3cbc87[_0x54a0('0x2f')]['includeAll']){_0x401cff[_0x54a0('0x3d')]=[{'all':!![]}];}return db[_0x54a0('0x3c')][_0x54a0('0x3e')](_0x401cff);})[_0x54a0('0x23')](function(_0x569dac){_0x391262[_0x54a0('0x3f')]=_0x569dac;return _0x391262;})[_0x54a0('0x23')](respondWithFilteredResult(_0x319e1c,_0x401cff))[_0x54a0('0x40')](handleError(_0x319e1c,null));};exports[_0x54a0('0x41')]=function(_0x3cc690,_0x46f3c1){var _0x382991={'raw':![],'where':{'id':_0x3cc690[_0x54a0('0x42')]['id']}},_0x3b6064={};_0x3b6064[_0x54a0('0x2e')]=_['keys'](db[_0x54a0('0x3c')]['rawAttributes']);_0x3b6064[_0x54a0('0x2f')]=_[_0x54a0('0x43')](_0x3cc690[_0x54a0('0x2f')]);_0x3b6064[_0x54a0('0x38')]=_['intersection'](_0x3b6064[_0x54a0('0x2e')],_0x3b6064[_0x54a0('0x2f')]);_0x382991[_0x54a0('0x32')]=_['intersection'](_0x3b6064[_0x54a0('0x2e')],qs[_0x54a0('0x31')](_0x3cc690[_0x54a0('0x2f')][_0x54a0('0x31')]));_0x382991[_0x54a0('0x32')]=_0x382991['attributes'][_0x54a0('0x33')]?_0x382991[_0x54a0('0x32')]:_0x3b6064[_0x54a0('0x2e')];if(_0x3cc690[_0x54a0('0x2f')]['includeAll']){_0x382991['include']=[{'all':!![]}];}_0x382991=_[_0x54a0('0x44')]({},_0x382991,_0x3cc690[_0x54a0('0x45')]);return db[_0x54a0('0x3c')][_0x54a0('0x46')](_0x382991)[_0x54a0('0x23')](handleEntityNotFound(_0x46f3c1,null))['then'](respondWithResult(_0x46f3c1,null))[_0x54a0('0x40')](handleError(_0x46f3c1,null));};exports[_0x54a0('0x47')]=function(_0x216739,_0x505e7c){return db[_0x54a0('0x3c')]['create'](_0x216739[_0x54a0('0x48')],{})[_0x54a0('0x23')](respondWithResult(_0x505e7c,0xc9))['catch'](handleError(_0x505e7c,null));};exports[_0x54a0('0x22')]=function(_0x44e505,_0x111cb8){if(_0x44e505[_0x54a0('0x48')]['id']){delete _0x44e505[_0x54a0('0x48')]['id'];}return db[_0x54a0('0x3c')][_0x54a0('0x46')]({'where':{'id':_0x44e505[_0x54a0('0x42')]['id']}})['then'](handleEntityNotFound(_0x111cb8,null))[_0x54a0('0x23')](saveUpdates(_0x44e505[_0x54a0('0x48')],null))[_0x54a0('0x23')](respondWithResult(_0x111cb8,null))[_0x54a0('0x40')](handleError(_0x111cb8,null));};exports['destroy']=function(_0x2f9008,_0x24ee33){return db['ServicenowConfiguration'][_0x54a0('0x46')]({'where':{'id':_0x2f9008[_0x54a0('0x42')]['id']}})[_0x54a0('0x23')](handleEntityNotFound(_0x24ee33,null))[_0x54a0('0x23')](removeEntity(_0x24ee33,null))[_0x54a0('0x40')](handleError(_0x24ee33,null));};exports['getFields']=function(_0x1faa10,_0x43b478,_0x5de8a0){var _0x34f87f={};var _0x195601={};var _0x28111b;var _0x49b0c9;return db[_0x54a0('0x3c')][_0x54a0('0x49')]({'where':{'id':_0x1faa10[_0x54a0('0x42')]['id']}})[_0x54a0('0x23')](handleEntityNotFound(_0x43b478,null))[_0x54a0('0x23')](function(_0x1fa0e4){if(_0x1fa0e4){_0x28111b=_0x1fa0e4;_0x195601['model']=_[_0x54a0('0x43')](db[_0x54a0('0x4a')][_0x54a0('0x2a')]);_0x195601['query']=_[_0x54a0('0x43')](_0x1faa10['query']);_0x195601[_0x54a0('0x38')]=_[_0x54a0('0x30')](_0x195601[_0x54a0('0x2e')],_0x195601[_0x54a0('0x2f')]);_0x34f87f[_0x54a0('0x32')]=_[_0x54a0('0x30')](_0x195601[_0x54a0('0x2e')],qs['fields'](_0x1faa10['query'][_0x54a0('0x31')]));_0x34f87f['attributes']=_0x34f87f[_0x54a0('0x32')]['length']?_0x34f87f['attributes']:_0x195601['model'];_0x34f87f[_0x54a0('0x35')]=qs[_0x54a0('0x36')](_0x1faa10[_0x54a0('0x2f')][_0x54a0('0x36')]);_0x34f87f[_0x54a0('0x37')]=qs[_0x54a0('0x38')](_[_0x54a0('0x39')](_0x1faa10[_0x54a0('0x2f')],_0x195601[_0x54a0('0x38')]));if(_0x1faa10[_0x54a0('0x2f')]['filter']){_0x34f87f[_0x54a0('0x37')]=_['merge'](_0x34f87f['where'],{'$or':_[_0x54a0('0x29')](_0x34f87f[_0x54a0('0x32')],function(_0x3cc170){var _0x1e7e13={};_0x1e7e13[_0x3cc170]={'$like':'%'+_0x1faa10[_0x54a0('0x2f')][_0x54a0('0x3a')]+'%'};return _0x1e7e13;})});}_0x34f87f=_['merge']({},_0x34f87f,_0x1faa10[_0x54a0('0x45')]);return _0x28111b['getFields'](_0x34f87f);}})[_0x54a0('0x23')](function(_0x1591a1){if(_0x1591a1){_0x49b0c9=_0x1591a1['length'];if(!_0x1faa10['query'][_0x54a0('0x34')]('nolimit')){_0x34f87f[_0x54a0('0x1a')]=qs[_0x54a0('0x1a')](_0x1faa10[_0x54a0('0x2f')][_0x54a0('0x1a')]);_0x34f87f['offset']=qs['offset'](_0x1faa10['query']['offset']);}return _0x28111b[_0x54a0('0x4b')](_0x34f87f);}})[_0x54a0('0x23')](function(_0x526d88){if(_0x526d88){return _0x526d88?{'count':_0x49b0c9,'rows':_0x526d88}:null;}})[_0x54a0('0x23')](respondWithResult(_0x43b478,null))[_0x54a0('0x40')](handleError(_0x43b478,null));};exports['getSubjects']=function(_0x3d8a48,_0x3ccc63,_0x2a6960){var _0x53dada={};var _0x2c7d5e={};var _0x1684e0;var _0x6fb199;return db[_0x54a0('0x3c')]['findOne']({'where':{'id':_0x3d8a48[_0x54a0('0x42')]['id']}})[_0x54a0('0x23')](handleEntityNotFound(_0x3ccc63,null))[_0x54a0('0x23')](function(_0x17e473){if(_0x17e473){_0x1684e0=_0x17e473;_0x2c7d5e[_0x54a0('0x2e')]=_[_0x54a0('0x43')](db[_0x54a0('0x4a')]['rawAttributes']);_0x2c7d5e[_0x54a0('0x2f')]=_['keys'](_0x3d8a48[_0x54a0('0x2f')]);_0x2c7d5e[_0x54a0('0x38')]=_[_0x54a0('0x30')](_0x2c7d5e['model'],_0x2c7d5e['query']);_0x53dada[_0x54a0('0x32')]=_[_0x54a0('0x30')](_0x2c7d5e[_0x54a0('0x2e')],qs[_0x54a0('0x31')](_0x3d8a48[_0x54a0('0x2f')]['fields']));_0x53dada[_0x54a0('0x32')]=_0x53dada[_0x54a0('0x32')][_0x54a0('0x33')]?_0x53dada[_0x54a0('0x32')]:_0x2c7d5e['model'];_0x53dada[_0x54a0('0x35')]=qs[_0x54a0('0x36')](_0x3d8a48[_0x54a0('0x2f')][_0x54a0('0x36')]);_0x53dada['where']=qs['filters'](_['pick'](_0x3d8a48[_0x54a0('0x2f')],_0x2c7d5e[_0x54a0('0x38')]));if(_0x3d8a48['query'][_0x54a0('0x3a')]){_0x53dada[_0x54a0('0x37')]=_[_0x54a0('0x44')](_0x53dada['where'],{'$or':_['map'](_0x53dada['attributes'],function(_0x45ad5a){var _0x58aa55={};_0x58aa55[_0x45ad5a]={'$like':'%'+_0x3d8a48[_0x54a0('0x2f')]['filter']+'%'};return _0x58aa55;})});}_0x53dada=_[_0x54a0('0x44')]({},_0x53dada,_0x3d8a48['options']);return _0x1684e0['getSubjects'](_0x53dada);}})[_0x54a0('0x23')](function(_0x3397ae){if(_0x3397ae){_0x6fb199=_0x3397ae[_0x54a0('0x33')];if(!_0x3d8a48[_0x54a0('0x2f')]['hasOwnProperty'](_0x54a0('0x4c'))){_0x53dada[_0x54a0('0x1a')]=qs['limit'](_0x3d8a48['query'][_0x54a0('0x1a')]);_0x53dada[_0x54a0('0x1d')]=qs[_0x54a0('0x1d')](_0x3d8a48[_0x54a0('0x2f')][_0x54a0('0x1d')]);}return _0x1684e0[_0x54a0('0x4d')](_0x53dada);}})['then'](function(_0x241980){if(_0x241980){return _0x241980?{'count':_0x6fb199,'rows':_0x241980}:null;}})[_0x54a0('0x23')](respondWithResult(_0x3ccc63,null))[_0x54a0('0x40')](handleError(_0x3ccc63,null));};exports[_0x54a0('0x4e')]=function(_0x4b308d,_0x58f58c,_0x2260e6){var _0x4d499e={};var _0x33d063={};var _0x1f2282;var _0x27b5dd;return db[_0x54a0('0x3c')][_0x54a0('0x49')]({'where':{'id':_0x4b308d[_0x54a0('0x42')]['id']}})[_0x54a0('0x23')](handleEntityNotFound(_0x58f58c,null))[_0x54a0('0x23')](function(_0x3b570c){if(_0x3b570c){_0x1f2282=_0x3b570c;_0x33d063[_0x54a0('0x2e')]=_[_0x54a0('0x43')](db[_0x54a0('0x4a')][_0x54a0('0x2a')]);_0x33d063['query']=_[_0x54a0('0x43')](_0x4b308d[_0x54a0('0x2f')]);_0x33d063['filters']=_[_0x54a0('0x30')](_0x33d063[_0x54a0('0x2e')],_0x33d063['query']);_0x4d499e[_0x54a0('0x32')]=_['intersection'](_0x33d063['model'],qs[_0x54a0('0x31')](_0x4b308d[_0x54a0('0x2f')][_0x54a0('0x31')]));_0x4d499e[_0x54a0('0x32')]=_0x4d499e[_0x54a0('0x32')]['length']?_0x4d499e[_0x54a0('0x32')]:_0x33d063[_0x54a0('0x2e')];_0x4d499e[_0x54a0('0x35')]=qs['sort'](_0x4b308d[_0x54a0('0x2f')][_0x54a0('0x36')]);_0x4d499e[_0x54a0('0x37')]=qs[_0x54a0('0x38')](_[_0x54a0('0x39')](_0x4b308d[_0x54a0('0x2f')],_0x33d063[_0x54a0('0x38')]));if(_0x4b308d[_0x54a0('0x2f')][_0x54a0('0x3a')]){_0x4d499e['where']=_[_0x54a0('0x44')](_0x4d499e[_0x54a0('0x37')],{'$or':_[_0x54a0('0x29')](_0x4d499e[_0x54a0('0x32')],function(_0x248827){var _0x4957e9={};_0x4957e9[_0x248827]={'$like':'%'+_0x4b308d[_0x54a0('0x2f')][_0x54a0('0x3a')]+'%'};return _0x4957e9;})});}_0x4d499e=_[_0x54a0('0x44')]({},_0x4d499e,_0x4b308d[_0x54a0('0x45')]);return _0x1f2282[_0x54a0('0x4e')](_0x4d499e);}})[_0x54a0('0x23')](function(_0x348c20){if(_0x348c20){_0x27b5dd=_0x348c20[_0x54a0('0x33')];if(!_0x4b308d[_0x54a0('0x2f')][_0x54a0('0x34')](_0x54a0('0x4c'))){_0x4d499e[_0x54a0('0x1a')]=qs['limit'](_0x4b308d[_0x54a0('0x2f')][_0x54a0('0x1a')]);_0x4d499e[_0x54a0('0x1d')]=qs[_0x54a0('0x1d')](_0x4b308d[_0x54a0('0x2f')][_0x54a0('0x1d')]);}return _0x1f2282['getDescriptions'](_0x4d499e);}})[_0x54a0('0x23')](function(_0x1d19a3){if(_0x1d19a3){return _0x1d19a3?{'count':_0x27b5dd,'rows':_0x1d19a3}:null;}})['then'](respondWithResult(_0x58f58c,null))[_0x54a0('0x40')](handleError(_0x58f58c,null));}; \ No newline at end of file +var _0xfeef=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','getFields','findOne','ServicenowField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','apply','reject','save','update','destroy','then','error','stack','name','send','map','ServicenowConfiguration','fieldName','type','key','model','query','keys'];(function(_0x3f761d,_0x5d907d){var _0x49d6e3=function(_0x39ab43){while(--_0x39ab43){_0x3f761d['push'](_0x3f761d['shift']());}};_0x49d6e3(++_0x5d907d);}(_0xfeef,0xb7));var _0xffee=function(_0x510f3a,_0x27d50e){_0x510f3a=_0x510f3a-0x0;var _0x48ddda=_0xfeef[_0x510f3a];return _0x48ddda;};'use strict';var emlformat=require(_0xffee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffee('0x1'));var jsonpatch=require(_0xffee('0x2'));var rp=require(_0xffee('0x3'));var moment=require(_0xffee('0x4'));var BPromise=require(_0xffee('0x5'));var Mustache=require(_0xffee('0x6'));var util=require('util');var path=require(_0xffee('0x7'));var sox=require(_0xffee('0x8'));var csv=require(_0xffee('0x9'));var ejs=require(_0xffee('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffee('0xb'));var squel=require('squel');var crypto=require(_0xffee('0xc'));var jsforce=require(_0xffee('0xd'));var deskjs=require(_0xffee('0xe'));var toCsv=require(_0xffee('0x9'));var querystring=require('querystring');var Papa=require(_0xffee('0xf'));var Redis=require('ioredis');var authService=require(_0xffee('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xffee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xffee('0x12'))(_0xffee('0x13'));var utils=require(_0xffee('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xffee('0x15'))['db'];function respondWithStatusCode(_0x3f531c,_0x5cd7d9){_0x5cd7d9=_0x5cd7d9||0xcc;return function(_0x468447){if(_0x468447){return _0x3f531c[_0xffee('0x16')](_0x5cd7d9);}return _0x3f531c['status'](_0x5cd7d9)[_0xffee('0x17')]();};}function respondWithResult(_0x57a3b5,_0x2f3909){_0x2f3909=_0x2f3909||0xc8;return function(_0x5e177f){if(_0x5e177f){return _0x57a3b5[_0xffee('0x18')](_0x2f3909)[_0xffee('0x19')](_0x5e177f);}};}function respondWithFilteredResult(_0x475a59,_0x165875){return function(_0x43d301){if(_0x43d301){var _0x84a5e8=typeof _0x165875['offset']===_0xffee('0x1a')&&typeof _0x165875[_0xffee('0x1b')]===_0xffee('0x1a');var _0x34c729=_0x43d301['count'];var _0x1ab28a=_0x84a5e8?0x0:_0x165875[_0xffee('0x1c')];var _0x23e30f=_0x84a5e8?_0x43d301['count']:_0x165875[_0xffee('0x1c')]+_0x165875['limit'];var _0x264a02;if(_0x23e30f>=_0x34c729){_0x23e30f=_0x34c729;_0x264a02=0xc8;}else{_0x264a02=0xce;}_0x475a59[_0xffee('0x18')](_0x264a02);return _0x475a59[_0xffee('0x1d')]('Content-Range',_0x1ab28a+'-'+_0x23e30f+'/'+_0x34c729)[_0xffee('0x19')](_0x43d301);}return null;};}function patchUpdates(_0x3cb078){return function(_0x12079b){try{jsonpatch[_0xffee('0x1e')](_0x12079b,_0x3cb078,!![]);}catch(_0x4e0a37){return BPromise[_0xffee('0x1f')](_0x4e0a37);}return _0x12079b[_0xffee('0x20')]();};}function saveUpdates(_0x5787c3,_0x1bc66f){return function(_0x548e9f){if(_0x548e9f){return _0x548e9f[_0xffee('0x21')](_0x5787c3)['then'](function(_0x2a2af7){return _0x2a2af7;});}return null;};}function removeEntity(_0x3ec8fd,_0x38b96e){return function(_0x4debe8){if(_0x4debe8){return _0x4debe8[_0xffee('0x22')]()[_0xffee('0x23')](function(){_0x3ec8fd[_0xffee('0x18')](0xcc)[_0xffee('0x17')]();});}};}function handleEntityNotFound(_0x11be6f,_0x1c0e1d){return function(_0x50bfb4){if(!_0x50bfb4){_0x11be6f['sendStatus'](0x194);}return _0x50bfb4;};}function handleError(_0x10e234,_0x1d7e1b){_0x1d7e1b=_0x1d7e1b||0x1f4;return function(_0x4df93f){logger[_0xffee('0x24')](_0x4df93f[_0xffee('0x25')]);if(_0x4df93f[_0xffee('0x26')]){delete _0x4df93f[_0xffee('0x26')];}_0x10e234[_0xffee('0x18')](_0x1d7e1b)[_0xffee('0x27')](_0x4df93f);};}exports['index']=function(_0x46ab18,_0x247777){var _0x1d58a1={},_0x87bd6={},_0x50f38f={'count':0x0,'rows':[]};var _0x56bd92=_[_0xffee('0x28')](db[_0xffee('0x29')]['rawAttributes'],function(_0x172f88){return{'name':_0x172f88[_0xffee('0x2a')],'type':_0x172f88[_0xffee('0x2b')][_0xffee('0x2c')]};});_0x87bd6[_0xffee('0x2d')]=_[_0xffee('0x28')](_0x56bd92,_0xffee('0x26'));_0x87bd6[_0xffee('0x2e')]=_[_0xffee('0x2f')](_0x46ab18[_0xffee('0x2e')]);_0x87bd6[_0xffee('0x30')]=_[_0xffee('0x31')](_0x87bd6[_0xffee('0x2d')],_0x87bd6[_0xffee('0x2e')]);_0x1d58a1[_0xffee('0x32')]=_[_0xffee('0x31')](_0x87bd6['model'],qs[_0xffee('0x33')](_0x46ab18[_0xffee('0x2e')][_0xffee('0x33')]));_0x1d58a1['attributes']=_0x1d58a1[_0xffee('0x32')][_0xffee('0x34')]?_0x1d58a1['attributes']:_0x87bd6[_0xffee('0x2d')];if(!_0x46ab18['query'][_0xffee('0x35')](_0xffee('0x36'))){_0x1d58a1[_0xffee('0x1b')]=qs[_0xffee('0x1b')](_0x46ab18[_0xffee('0x2e')][_0xffee('0x1b')]);_0x1d58a1[_0xffee('0x1c')]=qs[_0xffee('0x1c')](_0x46ab18['query'][_0xffee('0x1c')]);}_0x1d58a1[_0xffee('0x37')]=qs[_0xffee('0x38')](_0x46ab18['query'][_0xffee('0x38')]);_0x1d58a1[_0xffee('0x39')]=qs[_0xffee('0x30')](_[_0xffee('0x3a')](_0x46ab18['query'],_0x87bd6[_0xffee('0x30')]),_0x56bd92);if(_0x46ab18[_0xffee('0x2e')][_0xffee('0x3b')]){_0x1d58a1[_0xffee('0x39')]=_[_0xffee('0x3c')](_0x1d58a1['where'],{'$or':_[_0xffee('0x28')](_0x56bd92,function(_0x53dfb6){if(_0x53dfb6[_0xffee('0x2b')]!=='VIRTUAL'){var _0x5af6d3={};_0x5af6d3[_0x53dfb6[_0xffee('0x26')]]={'$like':'%'+_0x46ab18[_0xffee('0x2e')]['filter']+'%'};return _0x5af6d3;}})});}_0x1d58a1=_[_0xffee('0x3c')]({},_0x1d58a1,_0x46ab18['options']);var _0x3513af={'where':_0x1d58a1[_0xffee('0x39')]};return db['ServicenowConfiguration']['count'](_0x3513af)[_0xffee('0x23')](function(_0x277eab){_0x50f38f[_0xffee('0x3d')]=_0x277eab;if(_0x46ab18[_0xffee('0x2e')]['includeAll']){_0x1d58a1[_0xffee('0x3e')]=[{'all':!![]}];}return db[_0xffee('0x29')][_0xffee('0x3f')](_0x1d58a1);})[_0xffee('0x23')](function(_0x359b4f){_0x50f38f[_0xffee('0x40')]=_0x359b4f;return _0x50f38f;})[_0xffee('0x23')](respondWithFilteredResult(_0x247777,_0x1d58a1))[_0xffee('0x41')](handleError(_0x247777,null));};exports[_0xffee('0x42')]=function(_0x50eb78,_0x509da0){var _0x665989={'raw':![],'where':{'id':_0x50eb78[_0xffee('0x43')]['id']}},_0x3f5fc3={};_0x3f5fc3[_0xffee('0x2d')]=_[_0xffee('0x2f')](db[_0xffee('0x29')][_0xffee('0x44')]);_0x3f5fc3['query']=_[_0xffee('0x2f')](_0x50eb78[_0xffee('0x2e')]);_0x3f5fc3[_0xffee('0x30')]=_[_0xffee('0x31')](_0x3f5fc3[_0xffee('0x2d')],_0x3f5fc3[_0xffee('0x2e')]);_0x665989['attributes']=_[_0xffee('0x31')](_0x3f5fc3[_0xffee('0x2d')],qs[_0xffee('0x33')](_0x50eb78[_0xffee('0x2e')]['fields']));_0x665989['attributes']=_0x665989[_0xffee('0x32')]['length']?_0x665989['attributes']:_0x3f5fc3[_0xffee('0x2d')];if(_0x50eb78['query']['includeAll']){_0x665989[_0xffee('0x3e')]=[{'all':!![]}];}_0x665989=_[_0xffee('0x3c')]({},_0x665989,_0x50eb78[_0xffee('0x45')]);return db['ServicenowConfiguration'][_0xffee('0x46')](_0x665989)[_0xffee('0x23')](handleEntityNotFound(_0x509da0,null))['then'](respondWithResult(_0x509da0,null))[_0xffee('0x41')](handleError(_0x509da0,null));};exports[_0xffee('0x47')]=function(_0x3b3c78,_0x3eedac){return db[_0xffee('0x29')][_0xffee('0x47')](_0x3b3c78[_0xffee('0x48')],{})[_0xffee('0x23')](respondWithResult(_0x3eedac,0xc9))[_0xffee('0x41')](handleError(_0x3eedac,null));};exports[_0xffee('0x21')]=function(_0x551ebf,_0x458124){if(_0x551ebf[_0xffee('0x48')]['id']){delete _0x551ebf[_0xffee('0x48')]['id'];}return db[_0xffee('0x29')][_0xffee('0x46')]({'where':{'id':_0x551ebf[_0xffee('0x43')]['id']}})['then'](handleEntityNotFound(_0x458124,null))['then'](saveUpdates(_0x551ebf[_0xffee('0x48')],null))[_0xffee('0x23')](respondWithResult(_0x458124,null))[_0xffee('0x41')](handleError(_0x458124,null));};exports[_0xffee('0x22')]=function(_0x2d8ab5,_0x6b8119){return db[_0xffee('0x29')][_0xffee('0x46')]({'where':{'id':_0x2d8ab5[_0xffee('0x43')]['id']}})[_0xffee('0x23')](handleEntityNotFound(_0x6b8119,null))['then'](removeEntity(_0x6b8119,null))[_0xffee('0x41')](handleError(_0x6b8119,null));};exports[_0xffee('0x49')]=function(_0x5ec6db,_0x2c3390,_0x132ca4){var _0xe25ba4={};var _0x35e21f={};var _0x784d07;var _0x3c4b38;return db['ServicenowConfiguration'][_0xffee('0x4a')]({'where':{'id':_0x5ec6db[_0xffee('0x43')]['id']}})[_0xffee('0x23')](handleEntityNotFound(_0x2c3390,null))['then'](function(_0x47e952){if(_0x47e952){_0x784d07=_0x47e952;_0x35e21f[_0xffee('0x2d')]=_['keys'](db[_0xffee('0x4b')][_0xffee('0x44')]);_0x35e21f[_0xffee('0x2e')]=_[_0xffee('0x2f')](_0x5ec6db[_0xffee('0x2e')]);_0x35e21f[_0xffee('0x30')]=_['intersection'](_0x35e21f['model'],_0x35e21f['query']);_0xe25ba4[_0xffee('0x32')]=_['intersection'](_0x35e21f[_0xffee('0x2d')],qs[_0xffee('0x33')](_0x5ec6db[_0xffee('0x2e')]['fields']));_0xe25ba4['attributes']=_0xe25ba4[_0xffee('0x32')][_0xffee('0x34')]?_0xe25ba4[_0xffee('0x32')]:_0x35e21f[_0xffee('0x2d')];_0xe25ba4[_0xffee('0x37')]=qs['sort'](_0x5ec6db[_0xffee('0x2e')][_0xffee('0x38')]);_0xe25ba4['where']=qs[_0xffee('0x30')](_['pick'](_0x5ec6db['query'],_0x35e21f[_0xffee('0x30')]));if(_0x5ec6db['query'][_0xffee('0x3b')]){_0xe25ba4[_0xffee('0x39')]=_[_0xffee('0x3c')](_0xe25ba4[_0xffee('0x39')],{'$or':_[_0xffee('0x28')](_0xe25ba4[_0xffee('0x32')],function(_0x3b2113){var _0x51ba28={};_0x51ba28[_0x3b2113]={'$like':'%'+_0x5ec6db[_0xffee('0x2e')][_0xffee('0x3b')]+'%'};return _0x51ba28;})});}_0xe25ba4=_[_0xffee('0x3c')]({},_0xe25ba4,_0x5ec6db[_0xffee('0x45')]);return _0x784d07['getFields'](_0xe25ba4);}})[_0xffee('0x23')](function(_0x465b55){if(_0x465b55){_0x3c4b38=_0x465b55['length'];if(!_0x5ec6db[_0xffee('0x2e')][_0xffee('0x35')](_0xffee('0x36'))){_0xe25ba4['limit']=qs[_0xffee('0x1b')](_0x5ec6db[_0xffee('0x2e')]['limit']);_0xe25ba4[_0xffee('0x1c')]=qs[_0xffee('0x1c')](_0x5ec6db[_0xffee('0x2e')]['offset']);}return _0x784d07[_0xffee('0x49')](_0xe25ba4);}})[_0xffee('0x23')](function(_0x917050){if(_0x917050){return _0x917050?{'count':_0x3c4b38,'rows':_0x917050}:null;}})[_0xffee('0x23')](respondWithResult(_0x2c3390,null))[_0xffee('0x41')](handleError(_0x2c3390,null));};exports['getSubjects']=function(_0x3356b1,_0x28f0e0,_0x182773){var _0x396f5b={};var _0x151476={};var _0x1385cf;var _0x2e1a37;return db[_0xffee('0x29')][_0xffee('0x4a')]({'where':{'id':_0x3356b1[_0xffee('0x43')]['id']}})[_0xffee('0x23')](handleEntityNotFound(_0x28f0e0,null))[_0xffee('0x23')](function(_0x4397cc){if(_0x4397cc){_0x1385cf=_0x4397cc;_0x151476[_0xffee('0x2d')]=_[_0xffee('0x2f')](db[_0xffee('0x4b')][_0xffee('0x44')]);_0x151476[_0xffee('0x2e')]=_['keys'](_0x3356b1[_0xffee('0x2e')]);_0x151476[_0xffee('0x30')]=_[_0xffee('0x31')](_0x151476[_0xffee('0x2d')],_0x151476['query']);_0x396f5b[_0xffee('0x32')]=_[_0xffee('0x31')](_0x151476[_0xffee('0x2d')],qs[_0xffee('0x33')](_0x3356b1[_0xffee('0x2e')][_0xffee('0x33')]));_0x396f5b[_0xffee('0x32')]=_0x396f5b[_0xffee('0x32')][_0xffee('0x34')]?_0x396f5b[_0xffee('0x32')]:_0x151476[_0xffee('0x2d')];_0x396f5b[_0xffee('0x37')]=qs['sort'](_0x3356b1[_0xffee('0x2e')]['sort']);_0x396f5b[_0xffee('0x39')]=qs[_0xffee('0x30')](_[_0xffee('0x3a')](_0x3356b1['query'],_0x151476['filters']));if(_0x3356b1[_0xffee('0x2e')][_0xffee('0x3b')]){_0x396f5b[_0xffee('0x39')]=_[_0xffee('0x3c')](_0x396f5b['where'],{'$or':_[_0xffee('0x28')](_0x396f5b[_0xffee('0x32')],function(_0x409af2){var _0x14b104={};_0x14b104[_0x409af2]={'$like':'%'+_0x3356b1[_0xffee('0x2e')]['filter']+'%'};return _0x14b104;})});}_0x396f5b=_[_0xffee('0x3c')]({},_0x396f5b,_0x3356b1[_0xffee('0x45')]);return _0x1385cf['getSubjects'](_0x396f5b);}})[_0xffee('0x23')](function(_0x15aa17){if(_0x15aa17){_0x2e1a37=_0x15aa17[_0xffee('0x34')];if(!_0x3356b1[_0xffee('0x2e')][_0xffee('0x35')](_0xffee('0x36'))){_0x396f5b['limit']=qs[_0xffee('0x1b')](_0x3356b1[_0xffee('0x2e')]['limit']);_0x396f5b['offset']=qs['offset'](_0x3356b1['query'][_0xffee('0x1c')]);}return _0x1385cf['getSubjects'](_0x396f5b);}})['then'](function(_0x1de812){if(_0x1de812){return _0x1de812?{'count':_0x2e1a37,'rows':_0x1de812}:null;}})[_0xffee('0x23')](respondWithResult(_0x28f0e0,null))[_0xffee('0x41')](handleError(_0x28f0e0,null));};exports[_0xffee('0x4c')]=function(_0x4ddf4b,_0x53b9f2,_0x5e3013){var _0x37a5d4={};var _0x32132e={};var _0x53f9cf;var _0x138c9e;return db[_0xffee('0x29')][_0xffee('0x4a')]({'where':{'id':_0x4ddf4b[_0xffee('0x43')]['id']}})['then'](handleEntityNotFound(_0x53b9f2,null))[_0xffee('0x23')](function(_0x5c3a85){if(_0x5c3a85){_0x53f9cf=_0x5c3a85;_0x32132e[_0xffee('0x2d')]=_['keys'](db[_0xffee('0x4b')][_0xffee('0x44')]);_0x32132e[_0xffee('0x2e')]=_[_0xffee('0x2f')](_0x4ddf4b[_0xffee('0x2e')]);_0x32132e[_0xffee('0x30')]=_['intersection'](_0x32132e[_0xffee('0x2d')],_0x32132e[_0xffee('0x2e')]);_0x37a5d4[_0xffee('0x32')]=_['intersection'](_0x32132e[_0xffee('0x2d')],qs[_0xffee('0x33')](_0x4ddf4b[_0xffee('0x2e')][_0xffee('0x33')]));_0x37a5d4[_0xffee('0x32')]=_0x37a5d4['attributes'][_0xffee('0x34')]?_0x37a5d4['attributes']:_0x32132e[_0xffee('0x2d')];_0x37a5d4[_0xffee('0x37')]=qs[_0xffee('0x38')](_0x4ddf4b['query'][_0xffee('0x38')]);_0x37a5d4[_0xffee('0x39')]=qs[_0xffee('0x30')](_['pick'](_0x4ddf4b[_0xffee('0x2e')],_0x32132e['filters']));if(_0x4ddf4b['query']['filter']){_0x37a5d4[_0xffee('0x39')]=_[_0xffee('0x3c')](_0x37a5d4[_0xffee('0x39')],{'$or':_[_0xffee('0x28')](_0x37a5d4[_0xffee('0x32')],function(_0xbe0b32){var _0x57ed7a={};_0x57ed7a[_0xbe0b32]={'$like':'%'+_0x4ddf4b[_0xffee('0x2e')][_0xffee('0x3b')]+'%'};return _0x57ed7a;})});}_0x37a5d4=_['merge']({},_0x37a5d4,_0x4ddf4b[_0xffee('0x45')]);return _0x53f9cf[_0xffee('0x4c')](_0x37a5d4);}})['then'](function(_0x23c9d0){if(_0x23c9d0){_0x138c9e=_0x23c9d0[_0xffee('0x34')];if(!_0x4ddf4b[_0xffee('0x2e')]['hasOwnProperty'](_0xffee('0x36'))){_0x37a5d4['limit']=qs['limit'](_0x4ddf4b[_0xffee('0x2e')][_0xffee('0x1b')]);_0x37a5d4[_0xffee('0x1c')]=qs[_0xffee('0x1c')](_0x4ddf4b['query'][_0xffee('0x1c')]);}return _0x53f9cf[_0xffee('0x4c')](_0x37a5d4);}})[_0xffee('0x23')](function(_0x1b8d60){if(_0x1b8d60){return _0x1b8d60?{'count':_0x138c9e,'rows':_0x1b8d60}:null;}})[_0xffee('0x23')](respondWithResult(_0x53b9f2,null))[_0xffee('0x41')](handleError(_0x53b9f2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 3379762..df57eee 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 _0xed3c=['util','../../config/logger','api','bluebird','request-promise','path','./intServicenowConfiguration.attributes','exports','lodash'];(function(_0x4deed6,_0x1b6209){var _0x3d3d49=function(_0x5b77b7){while(--_0x5b77b7){_0x4deed6['push'](_0x4deed6['shift']());}};_0x3d3d49(++_0x1b6209);}(_0xed3c,0x1a6));var _0xced3=function(_0x2fc026,_0xdc4f7a){_0x2fc026=_0x2fc026-0x0;var _0x34d056=_0xed3c[_0x2fc026];return _0x34d056;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b0e=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x3fdfab,_0x433685){var _0x2d2350=function(_0x3b8066){while(--_0x3b8066){_0x3fdfab['push'](_0x3fdfab['shift']());}};_0x2d2350(++_0x433685);}(_0x1b0e,0x132));var _0xe1b0=function(_0x378dfd,_0x423c99){_0x378dfd=_0x378dfd-0x0;var _0x537e01=_0x1b0e[_0x378dfd];return _0x537e01;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var logger=require(_0xe1b0('0x2'))(_0xe1b0('0x3'));var moment=require(_0xe1b0('0x4'));var BPromise=require(_0xe1b0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe1b0('0x6'));var config=require(_0xe1b0('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xe1b0('0x8')]=function(_0x2a049f,_0xfb57ae){return _0x2a049f['define'](_0xe1b0('0x9'),attributes,{'tableName':_0xe1b0('0xa'),'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 9f86454..7c10522 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x524e,0x15e));var _0xe524=function(_0x299880,_0x5a9e6c){_0x299880=_0x299880-0x0;var _0x55a269=_0x524e[_0x299880];return _0x55a269;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x95b2=['http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x95b2,0x144));var _0x295b=function(_0xc0c45,_0x5b0509){_0xc0c45=_0xc0c45-0x0;var _0x16c229=_0x95b2[_0xc0c45];return _0x16c229;};'use strict';var _=require(_0x295b('0x0'));var util=require(_0x295b('0x1'));var moment=require(_0x295b('0x2'));var BPromise=require(_0x295b('0x3'));var rs=require(_0x295b('0x4'));var fs=require('fs');var Redis=require(_0x295b('0x5'));var db=require(_0x295b('0x6'))['db'];var utils=require(_0x295b('0x7'));var logger=require(_0x295b('0x8'))('rpc');var config=require(_0x295b('0x9'));var jayson=require(_0x295b('0xa'));var client=jayson[_0x295b('0xb')][_0x295b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xef543d,_0x52a60b,_0x1172b6){return new BPromise(function(_0x454eb2,_0xf90f02){return client[_0x295b('0xd')](_0xef543d,_0x1172b6)[_0x295b('0xe')](function(_0x3c23e5){logger[_0x295b('0xf')](_0x295b('0x10'),_0x52a60b,_0x295b('0x11'));logger['debug'](_0x295b('0x12'),_0x52a60b,_0x295b('0x11'),JSON[_0x295b('0x13')](_0x3c23e5));if(_0x3c23e5['error']){if(_0x3c23e5['error'][_0x295b('0x14')]===0x1f4){logger[_0x295b('0x15')](_0x295b('0x10'),_0x52a60b,_0x3c23e5[_0x295b('0x15')]['message']);return _0xf90f02(_0x3c23e5[_0x295b('0x15')]['message']);}logger[_0x295b('0x15')](_0x295b('0x10'),_0x52a60b,_0x3c23e5['error'][_0x295b('0x16')]);return _0x454eb2(_0x3c23e5[_0x295b('0x15')][_0x295b('0x16')]);}else{logger[_0x295b('0xf')](_0x295b('0x10'),_0x52a60b,_0x295b('0x11'));_0x454eb2(_0x3c23e5[_0x295b('0x17')][_0x295b('0x16')]);}})['catch'](function(_0xc9604d){logger[_0x295b('0x15')](_0x295b('0x10'),_0x52a60b,_0xc9604d);_0xf90f02(_0xc9604d);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 035d6eb..dd9e152 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 _0xac2a=['index','/:id','show','create','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x1a155b,_0x2d9ebd){var _0x213e66=function(_0x382575){while(--_0x382575){_0x1a155b['push'](_0x1a155b['shift']());}};_0x213e66(++_0x2d9ebd);}(_0xac2a,0x1aa));var _0xaac2=function(_0x539f83,_0x57ab15){_0x539f83=_0x539f83-0x0;var _0x540d95=_0xac2a[_0x539f83];return _0x540d95;};'use strict';var multer=require(_0xaac2('0x0'));var util=require(_0xaac2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaac2('0x2'));var router=express[_0xaac2('0x3')]();var fs_extra=require(_0xaac2('0x4'));var auth=require(_0xaac2('0x5'));var interaction=require(_0xaac2('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xaac2('0x7')]('/',auth[_0xaac2('0x8')](),controller[_0xaac2('0x9')]);router[_0xaac2('0x7')](_0xaac2('0xa'),auth[_0xaac2('0x8')](),controller[_0xaac2('0xb')]);router['post']('/',auth[_0xaac2('0x8')](),controller[_0xaac2('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xaac2('0xa'),auth[_0xaac2('0x8')](),controller[_0xaac2('0xd')]);module[_0xaac2('0xe')]=router; \ No newline at end of file +var _0x6eb8=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x22e6b9,_0x180b39){var _0x3aaa6b=function(_0x4f6473){while(--_0x4f6473){_0x22e6b9['push'](_0x22e6b9['shift']());}};_0x3aaa6b(++_0x180b39);}(_0x6eb8,0x1a7));var _0x86eb=function(_0x5c9f8b,_0x348375){_0x5c9f8b=_0x5c9f8b-0x0;var _0x5a7832=_0x6eb8[_0x5c9f8b];return _0x5a7832;};'use strict';var multer=require(_0x86eb('0x0'));var util=require(_0x86eb('0x1'));var path=require(_0x86eb('0x2'));var timeout=require(_0x86eb('0x3'));var express=require('express');var router=express[_0x86eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x86eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x86eb('0x6'));var controller=require(_0x86eb('0x7'));router[_0x86eb('0x8')]('/',auth['isAuthenticated'](),controller[_0x86eb('0x9')]);router[_0x86eb('0x8')](_0x86eb('0xa'),auth['isAuthenticated'](),controller[_0x86eb('0xb')]);router[_0x86eb('0xc')]('/',auth[_0x86eb('0xd')](),controller[_0x86eb('0xe')]);router[_0x86eb('0xf')](_0x86eb('0xa'),auth['isAuthenticated'](),controller[_0x86eb('0x10')]);router[_0x86eb('0x11')](_0x86eb('0xa'),auth[_0x86eb('0xd')](),controller[_0x86eb('0x12')]);module[_0x86eb('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 56af6c4..b098dc9 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 _0x3d74=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x63570b,_0x1f494b){var _0x373d68=function(_0x3fdfa5){while(--_0x3fdfa5){_0x63570b['push'](_0x63570b['shift']());}};_0x373d68(++_0x1f494b);}(_0x3d74,0xab));var _0x43d7=function(_0x39bdde,_0x1fba1b){_0x39bdde=_0x39bdde-0x0;var _0x205741=_0x3d74[_0x39bdde];return _0x205741;};'use strict';var Sequelize=require(_0x43d7('0x0'));module[_0x43d7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x43d7('0x2'),_0x43d7('0x3'),_0x43d7('0x4'),_0x43d7('0x5'),_0x43d7('0x6')),'defaultValue':_0x43d7('0x2')},'content':{'type':Sequelize[_0x43d7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x43d7('0x2'),'variable',_0x43d7('0x4'))},'keyContent':{'type':Sequelize[_0x43d7('0x7')]},'idField':{'type':Sequelize[_0x43d7('0x7')]},'nameField':{'type':Sequelize[_0x43d7('0x7')]},'customField':{'type':Sequelize[_0x43d7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x43d7('0x7')]}}; \ No newline at end of file +var _0x92f7=['exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','sequelize'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x92f7,0xfb));var _0x792f=function(_0x2aa3ed,_0x21bb61){_0x2aa3ed=_0x2aa3ed-0x0;var _0x4e0881=_0x92f7[_0x2aa3ed];return _0x4e0881;};'use strict';var Sequelize=require(_0x792f('0x0'));module[_0x792f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x792f('0x2'),_0x792f('0x3'),_0x792f('0x4'),_0x792f('0x5'),_0x792f('0x6')),'defaultValue':_0x792f('0x2')},'content':{'type':Sequelize[_0x792f('0x7')]},'key':{'type':Sequelize[_0x792f('0x7')]},'keyType':{'type':Sequelize[_0x792f('0x8')]('string',_0x792f('0x3'),_0x792f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x792f('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 f5d615a..640f7d6 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 _0xe454=['util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','then','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x55f344,_0x38b6b6){var _0x25fb2e=function(_0x427fa4){while(--_0x427fa4){_0x55f344['push'](_0x55f344['shift']());}};_0x25fb2e(++_0x38b6b6);}(_0xe454,0xd7));var _0x4e45=function(_0x251653,_0x335ff9){_0x251653=_0x251653-0x0;var _0x50e8ce=_0xe454[_0x251653];return _0x50e8ce;};'use strict';var emlformat=require(_0x4e45('0x0'));var rimraf=require(_0x4e45('0x1'));var zipdir=require(_0x4e45('0x2'));var jsonpatch=require(_0x4e45('0x3'));var rp=require('request-promise');var moment=require(_0x4e45('0x4'));var BPromise=require(_0x4e45('0x5'));var Mustache=require(_0x4e45('0x6'));var util=require(_0x4e45('0x7'));var path=require(_0x4e45('0x8'));var sox=require('sox');var csv=require(_0x4e45('0x9'));var ejs=require(_0x4e45('0xa'));var fs=require('fs');var fs_extra=require(_0x4e45('0xb'));var _=require(_0x4e45('0xc'));var squel=require(_0x4e45('0xd'));var crypto=require(_0x4e45('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4e45('0xf'));var toCsv=require(_0x4e45('0x9'));var querystring=require('querystring');var Papa=require(_0x4e45('0x10'));var Redis=require(_0x4e45('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e45('0x12'))(_0x4e45('0x13'));var utils=require(_0x4e45('0x14'));var config=require(_0x4e45('0x15'));var licenseUtil=require(_0x4e45('0x16'));var db=require(_0x4e45('0x17'))['db'];function respondWithStatusCode(_0x51182e,_0x118310){_0x118310=_0x118310||0xcc;return function(_0x2966cc){if(_0x2966cc){return _0x51182e[_0x4e45('0x18')](_0x118310);}return _0x51182e[_0x4e45('0x19')](_0x118310)['end']();};}function respondWithResult(_0x2ae49d,_0xa587f4){_0xa587f4=_0xa587f4||0xc8;return function(_0x35044d){if(_0x35044d){return _0x2ae49d[_0x4e45('0x19')](_0xa587f4)[_0x4e45('0x1a')](_0x35044d);}};}function respondWithFilteredResult(_0x6ed42d,_0x2e4cef){return function(_0x875204){if(_0x875204){var _0x3cda2d=typeof _0x2e4cef[_0x4e45('0x1b')]===_0x4e45('0x1c')&&typeof _0x2e4cef[_0x4e45('0x1d')]==='undefined';var _0x9f56f2=_0x875204['count'];var _0x5b6be3=_0x3cda2d?0x0:_0x2e4cef[_0x4e45('0x1b')];var _0x2550a9=_0x3cda2d?_0x875204[_0x4e45('0x1e')]:_0x2e4cef[_0x4e45('0x1b')]+_0x2e4cef['limit'];var _0x58863c;if(_0x2550a9>=_0x9f56f2){_0x2550a9=_0x9f56f2;_0x58863c=0xc8;}else{_0x58863c=0xce;}_0x6ed42d[_0x4e45('0x19')](_0x58863c);return _0x6ed42d[_0x4e45('0x1f')](_0x4e45('0x20'),_0x5b6be3+'-'+_0x2550a9+'/'+_0x9f56f2)[_0x4e45('0x1a')](_0x875204);}return null;};}function patchUpdates(_0xbf5773){return function(_0x31e5e1){try{jsonpatch['apply'](_0x31e5e1,_0xbf5773,!![]);}catch(_0x4b6101){return BPromise['reject'](_0x4b6101);}return _0x31e5e1[_0x4e45('0x21')]();};}function saveUpdates(_0x395b83,_0xb8dd42){return function(_0x2d8a69){if(_0x2d8a69){return _0x2d8a69[_0x4e45('0x22')](_0x395b83)['then'](function(_0x48f774){return _0x48f774;});}return null;};}function removeEntity(_0x1a90e2,_0x26112d){return function(_0x321869){if(_0x321869){return _0x321869[_0x4e45('0x23')]()['then'](function(){_0x1a90e2[_0x4e45('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18e32d,_0x53c92b){return function(_0x164b50){if(!_0x164b50){_0x18e32d[_0x4e45('0x18')](0x194);}return _0x164b50;};}function handleError(_0x9f089e,_0x5445a9){_0x5445a9=_0x5445a9||0x1f4;return function(_0x138053){logger[_0x4e45('0x24')](_0x138053[_0x4e45('0x25')]);if(_0x138053[_0x4e45('0x26')]){delete _0x138053['name'];}_0x9f089e['status'](_0x5445a9)[_0x4e45('0x27')](_0x138053);};}exports[_0x4e45('0x28')]=function(_0x42563b,_0x59989b){var _0x13e52c={},_0x6f6703={},_0x3db1d9={'count':0x0,'rows':[]};var _0x331f7f=_[_0x4e45('0x29')](db[_0x4e45('0x2a')][_0x4e45('0x2b')],function(_0x4b0cf7){return{'name':_0x4b0cf7[_0x4e45('0x2c')],'type':_0x4b0cf7['type'][_0x4e45('0x2d')]};});_0x6f6703[_0x4e45('0x2e')]=_[_0x4e45('0x29')](_0x331f7f,_0x4e45('0x26'));_0x6f6703['query']=_[_0x4e45('0x2f')](_0x42563b[_0x4e45('0x30')]);_0x6f6703[_0x4e45('0x31')]=_[_0x4e45('0x32')](_0x6f6703['model'],_0x6f6703[_0x4e45('0x30')]);_0x13e52c['attributes']=_[_0x4e45('0x32')](_0x6f6703['model'],qs[_0x4e45('0x33')](_0x42563b['query'][_0x4e45('0x33')]));_0x13e52c[_0x4e45('0x34')]=_0x13e52c['attributes']['length']?_0x13e52c[_0x4e45('0x34')]:_0x6f6703[_0x4e45('0x2e')];if(!_0x42563b[_0x4e45('0x30')]['hasOwnProperty'](_0x4e45('0x35'))){_0x13e52c[_0x4e45('0x1d')]=qs[_0x4e45('0x1d')](_0x42563b[_0x4e45('0x30')]['limit']);_0x13e52c[_0x4e45('0x1b')]=qs[_0x4e45('0x1b')](_0x42563b[_0x4e45('0x30')][_0x4e45('0x1b')]);}_0x13e52c[_0x4e45('0x36')]=qs['sort'](_0x42563b[_0x4e45('0x30')][_0x4e45('0x37')]);_0x13e52c['where']=qs[_0x4e45('0x31')](_[_0x4e45('0x38')](_0x42563b[_0x4e45('0x30')],_0x6f6703['filters']),_0x331f7f);if(_0x42563b['query'][_0x4e45('0x39')]){_0x13e52c[_0x4e45('0x3a')]=_[_0x4e45('0x3b')](_0x13e52c[_0x4e45('0x3a')],{'$or':_[_0x4e45('0x29')](_0x331f7f,function(_0x5bee17){if(_0x5bee17[_0x4e45('0x3c')]!==_0x4e45('0x3d')){var _0x303dfb={};_0x303dfb[_0x5bee17[_0x4e45('0x26')]]={'$like':'%'+_0x42563b[_0x4e45('0x30')][_0x4e45('0x39')]+'%'};return _0x303dfb;}})});}_0x13e52c=_[_0x4e45('0x3b')]({},_0x13e52c,_0x42563b[_0x4e45('0x3e')]);var _0x18302e={'where':_0x13e52c[_0x4e45('0x3a')]};return db[_0x4e45('0x2a')][_0x4e45('0x1e')](_0x18302e)['then'](function(_0x828ee5){_0x3db1d9['count']=_0x828ee5;if(_0x42563b[_0x4e45('0x30')][_0x4e45('0x3f')]){_0x13e52c[_0x4e45('0x40')]=[{'all':!![]}];}return db[_0x4e45('0x2a')]['findAll'](_0x13e52c);})['then'](function(_0x13119c){_0x3db1d9[_0x4e45('0x41')]=_0x13119c;return _0x3db1d9;})[_0x4e45('0x42')](respondWithFilteredResult(_0x59989b,_0x13e52c))[_0x4e45('0x43')](handleError(_0x59989b,null));};exports[_0x4e45('0x44')]=function(_0x4634ae,_0x448f1e){var _0x3281e2={'raw':!![],'where':{'id':_0x4634ae[_0x4e45('0x45')]['id']}},_0xbf636f={};_0xbf636f[_0x4e45('0x2e')]=_[_0x4e45('0x2f')](db[_0x4e45('0x2a')][_0x4e45('0x2b')]);_0xbf636f[_0x4e45('0x30')]=_['keys'](_0x4634ae[_0x4e45('0x30')]);_0xbf636f[_0x4e45('0x31')]=_[_0x4e45('0x32')](_0xbf636f[_0x4e45('0x2e')],_0xbf636f[_0x4e45('0x30')]);_0x3281e2[_0x4e45('0x34')]=_[_0x4e45('0x32')](_0xbf636f[_0x4e45('0x2e')],qs[_0x4e45('0x33')](_0x4634ae['query']['fields']));_0x3281e2['attributes']=_0x3281e2[_0x4e45('0x34')][_0x4e45('0x46')]?_0x3281e2[_0x4e45('0x34')]:_0xbf636f[_0x4e45('0x2e')];if(_0x4634ae[_0x4e45('0x30')][_0x4e45('0x3f')]){_0x3281e2['include']=[{'all':!![]}];}_0x3281e2=_[_0x4e45('0x3b')]({},_0x3281e2,_0x4634ae[_0x4e45('0x3e')]);return db[_0x4e45('0x2a')][_0x4e45('0x47')](_0x3281e2)[_0x4e45('0x42')](handleEntityNotFound(_0x448f1e,null))['then'](respondWithResult(_0x448f1e,null))[_0x4e45('0x43')](handleError(_0x448f1e,null));};exports[_0x4e45('0x48')]=function(_0x3c2be7,_0x289d59){return db[_0x4e45('0x2a')]['create'](_0x3c2be7[_0x4e45('0x49')],{})[_0x4e45('0x42')](respondWithResult(_0x289d59,0xc9))['catch'](handleError(_0x289d59,null));};exports[_0x4e45('0x22')]=function(_0x3cb84c,_0x708b31){if(_0x3cb84c[_0x4e45('0x49')]['id']){delete _0x3cb84c[_0x4e45('0x49')]['id'];}return db['ServicenowField'][_0x4e45('0x47')]({'where':{'id':_0x3cb84c[_0x4e45('0x45')]['id']}})[_0x4e45('0x42')](handleEntityNotFound(_0x708b31,null))[_0x4e45('0x42')](saveUpdates(_0x3cb84c['body'],null))[_0x4e45('0x42')](respondWithResult(_0x708b31,null))[_0x4e45('0x43')](handleError(_0x708b31,null));};exports['destroy']=function(_0x163356,_0x45e12f){return db['ServicenowField'][_0x4e45('0x47')]({'where':{'id':_0x163356['params']['id']}})[_0x4e45('0x42')](handleEntityNotFound(_0x45e12f,null))[_0x4e45('0x42')](removeEntity(_0x45e12f,null))[_0x4e45('0x43')](handleError(_0x45e12f,null));}; \ No newline at end of file +var _0x84f3=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ServicenowField','catch','show','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','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','../../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','save','update','then','destroy'];(function(_0x5395ac,_0xf08fb2){var _0x50917d=function(_0x3cd882){while(--_0x3cd882){_0x5395ac['push'](_0x5395ac['shift']());}};_0x50917d(++_0xf08fb2);}(_0x84f3,0x114));var _0x384f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x84f3[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x384f('0x0'));var zipdir=require(_0x384f('0x1'));var jsonpatch=require(_0x384f('0x2'));var rp=require('request-promise');var moment=require(_0x384f('0x3'));var BPromise=require(_0x384f('0x4'));var Mustache=require(_0x384f('0x5'));var util=require(_0x384f('0x6'));var path=require(_0x384f('0x7'));var sox=require('sox');var csv=require(_0x384f('0x8'));var ejs=require(_0x384f('0x9'));var fs=require('fs');var fs_extra=require(_0x384f('0xa'));var _=require(_0x384f('0xb'));var squel=require(_0x384f('0xc'));var crypto=require(_0x384f('0xd'));var jsforce=require(_0x384f('0xe'));var deskjs=require(_0x384f('0xf'));var toCsv=require(_0x384f('0x8'));var querystring=require(_0x384f('0x10'));var Papa=require(_0x384f('0x11'));var Redis=require(_0x384f('0x12'));var authService=require(_0x384f('0x13'));var qs=require(_0x384f('0x14'));var as=require(_0x384f('0x15'));var hardwareService=require(_0x384f('0x16'));var logger=require(_0x384f('0x17'))(_0x384f('0x18'));var utils=require(_0x384f('0x19'));var config=require(_0x384f('0x1a'));var licenseUtil=require(_0x384f('0x1b'));var db=require(_0x384f('0x1c'))['db'];function respondWithStatusCode(_0x2850ba,_0x323742){_0x323742=_0x323742||0xcc;return function(_0x16ffa9){if(_0x16ffa9){return _0x2850ba[_0x384f('0x1d')](_0x323742);}return _0x2850ba[_0x384f('0x1e')](_0x323742)[_0x384f('0x1f')]();};}function respondWithResult(_0x3f8998,_0x503691){_0x503691=_0x503691||0xc8;return function(_0x1360c4){if(_0x1360c4){return _0x3f8998['status'](_0x503691)[_0x384f('0x20')](_0x1360c4);}};}function respondWithFilteredResult(_0x1ac832,_0x114a56){return function(_0x5e7d87){if(_0x5e7d87){var _0x2fdb42=typeof _0x114a56[_0x384f('0x21')]===_0x384f('0x22')&&typeof _0x114a56[_0x384f('0x23')]===_0x384f('0x22');var _0xd2c2d3=_0x5e7d87[_0x384f('0x24')];var _0x313f7d=_0x2fdb42?0x0:_0x114a56['offset'];var _0x5d38d7=_0x2fdb42?_0x5e7d87[_0x384f('0x24')]:_0x114a56['offset']+_0x114a56[_0x384f('0x23')];var _0x30676d;if(_0x5d38d7>=_0xd2c2d3){_0x5d38d7=_0xd2c2d3;_0x30676d=0xc8;}else{_0x30676d=0xce;}_0x1ac832[_0x384f('0x1e')](_0x30676d);return _0x1ac832[_0x384f('0x25')](_0x384f('0x26'),_0x313f7d+'-'+_0x5d38d7+'/'+_0xd2c2d3)[_0x384f('0x20')](_0x5e7d87);}return null;};}function patchUpdates(_0x22aa2b){return function(_0x43620e){try{jsonpatch[_0x384f('0x27')](_0x43620e,_0x22aa2b,!![]);}catch(_0x5106b2){return BPromise['reject'](_0x5106b2);}return _0x43620e[_0x384f('0x28')]();};}function saveUpdates(_0x230713,_0x4c8b5d){return function(_0x316fd6){if(_0x316fd6){return _0x316fd6[_0x384f('0x29')](_0x230713)[_0x384f('0x2a')](function(_0x18c121){return _0x18c121;});}return null;};}function removeEntity(_0x2393a6,_0x13969b){return function(_0x49ee41){if(_0x49ee41){return _0x49ee41[_0x384f('0x2b')]()[_0x384f('0x2a')](function(){_0x2393a6['status'](0xcc)[_0x384f('0x1f')]();});}};}function handleEntityNotFound(_0x53fcb9,_0x546631){return function(_0xa1a092){if(!_0xa1a092){_0x53fcb9['sendStatus'](0x194);}return _0xa1a092;};}function handleError(_0x240149,_0x4cbf52){_0x4cbf52=_0x4cbf52||0x1f4;return function(_0x2634e9){logger['error'](_0x2634e9[_0x384f('0x2c')]);if(_0x2634e9[_0x384f('0x2d')]){delete _0x2634e9[_0x384f('0x2d')];}_0x240149['status'](_0x4cbf52)[_0x384f('0x2e')](_0x2634e9);};}exports[_0x384f('0x2f')]=function(_0x14ed95,_0x330328){var _0x3934ab={},_0x4576e7={},_0x228c83={'count':0x0,'rows':[]};var _0x8d6cc9=_[_0x384f('0x30')](db['ServicenowField'][_0x384f('0x31')],function(_0x3ceb1e){return{'name':_0x3ceb1e[_0x384f('0x32')],'type':_0x3ceb1e[_0x384f('0x33')][_0x384f('0x34')]};});_0x4576e7[_0x384f('0x35')]=_['map'](_0x8d6cc9,_0x384f('0x2d'));_0x4576e7['query']=_[_0x384f('0x36')](_0x14ed95['query']);_0x4576e7[_0x384f('0x37')]=_['intersection'](_0x4576e7[_0x384f('0x35')],_0x4576e7[_0x384f('0x38')]);_0x3934ab[_0x384f('0x39')]=_[_0x384f('0x3a')](_0x4576e7['model'],qs[_0x384f('0x3b')](_0x14ed95[_0x384f('0x38')]['fields']));_0x3934ab['attributes']=_0x3934ab[_0x384f('0x39')][_0x384f('0x3c')]?_0x3934ab[_0x384f('0x39')]:_0x4576e7[_0x384f('0x35')];if(!_0x14ed95[_0x384f('0x38')][_0x384f('0x3d')](_0x384f('0x3e'))){_0x3934ab[_0x384f('0x23')]=qs[_0x384f('0x23')](_0x14ed95[_0x384f('0x38')]['limit']);_0x3934ab[_0x384f('0x21')]=qs[_0x384f('0x21')](_0x14ed95[_0x384f('0x38')][_0x384f('0x21')]);}_0x3934ab[_0x384f('0x3f')]=qs[_0x384f('0x40')](_0x14ed95['query']['sort']);_0x3934ab[_0x384f('0x41')]=qs[_0x384f('0x37')](_[_0x384f('0x42')](_0x14ed95[_0x384f('0x38')],_0x4576e7['filters']),_0x8d6cc9);if(_0x14ed95['query'][_0x384f('0x43')]){_0x3934ab[_0x384f('0x41')]=_[_0x384f('0x44')](_0x3934ab[_0x384f('0x41')],{'$or':_[_0x384f('0x30')](_0x8d6cc9,function(_0x5a3f7b){if(_0x5a3f7b[_0x384f('0x33')]!==_0x384f('0x45')){var _0x1a05fa={};_0x1a05fa[_0x5a3f7b['name']]={'$like':'%'+_0x14ed95['query'][_0x384f('0x43')]+'%'};return _0x1a05fa;}})});}_0x3934ab=_[_0x384f('0x44')]({},_0x3934ab,_0x14ed95['options']);var _0x3fed08={'where':_0x3934ab[_0x384f('0x41')]};return db['ServicenowField']['count'](_0x3fed08)[_0x384f('0x2a')](function(_0x495418){_0x228c83[_0x384f('0x24')]=_0x495418;if(_0x14ed95['query'][_0x384f('0x46')]){_0x3934ab[_0x384f('0x47')]=[{'all':!![]}];}return db[_0x384f('0x48')]['findAll'](_0x3934ab);})[_0x384f('0x2a')](function(_0x22625c){_0x228c83['rows']=_0x22625c;return _0x228c83;})['then'](respondWithFilteredResult(_0x330328,_0x3934ab))[_0x384f('0x49')](handleError(_0x330328,null));};exports[_0x384f('0x4a')]=function(_0x5c9b6b,_0x5125b7){var _0x1fd1d7={'raw':!![],'where':{'id':_0x5c9b6b['params']['id']}},_0x2862d6={};_0x2862d6[_0x384f('0x35')]=_[_0x384f('0x36')](db[_0x384f('0x48')][_0x384f('0x31')]);_0x2862d6[_0x384f('0x38')]=_['keys'](_0x5c9b6b[_0x384f('0x38')]);_0x2862d6[_0x384f('0x37')]=_['intersection'](_0x2862d6[_0x384f('0x35')],_0x2862d6[_0x384f('0x38')]);_0x1fd1d7[_0x384f('0x39')]=_['intersection'](_0x2862d6[_0x384f('0x35')],qs[_0x384f('0x3b')](_0x5c9b6b['query'][_0x384f('0x3b')]));_0x1fd1d7[_0x384f('0x39')]=_0x1fd1d7[_0x384f('0x39')]['length']?_0x1fd1d7['attributes']:_0x2862d6[_0x384f('0x35')];if(_0x5c9b6b[_0x384f('0x38')][_0x384f('0x46')]){_0x1fd1d7[_0x384f('0x47')]=[{'all':!![]}];}_0x1fd1d7=_['merge']({},_0x1fd1d7,_0x5c9b6b[_0x384f('0x4b')]);return db[_0x384f('0x48')][_0x384f('0x4c')](_0x1fd1d7)[_0x384f('0x2a')](handleEntityNotFound(_0x5125b7,null))[_0x384f('0x2a')](respondWithResult(_0x5125b7,null))[_0x384f('0x49')](handleError(_0x5125b7,null));};exports[_0x384f('0x4d')]=function(_0x6b911,_0x5465ca){return db[_0x384f('0x48')][_0x384f('0x4d')](_0x6b911[_0x384f('0x4e')],{})[_0x384f('0x2a')](respondWithResult(_0x5465ca,0xc9))[_0x384f('0x49')](handleError(_0x5465ca,null));};exports[_0x384f('0x29')]=function(_0x25cc94,_0x56c8fc){if(_0x25cc94[_0x384f('0x4e')]['id']){delete _0x25cc94['body']['id'];}return db[_0x384f('0x48')]['find']({'where':{'id':_0x25cc94[_0x384f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x56c8fc,null))[_0x384f('0x2a')](saveUpdates(_0x25cc94[_0x384f('0x4e')],null))['then'](respondWithResult(_0x56c8fc,null))['catch'](handleError(_0x56c8fc,null));};exports[_0x384f('0x2b')]=function(_0x20cae4,_0x5458a8){return db['ServicenowField'][_0x384f('0x4c')]({'where':{'id':_0x20cae4[_0x384f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5458a8,null))[_0x384f('0x2a')](removeEntity(_0x5458a8,null))[_0x384f('0x49')](handleError(_0x5458a8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 862c80e..97a5e4b 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 _0x630d=['exports','define','int_servicenow_fields','servicenow_unique_index','FieldId','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3526de,_0x5b0492){var _0x3cb3e6=function(_0x325f01){while(--_0x325f01){_0x3526de['push'](_0x3526de['shift']());}};_0x3cb3e6(++_0x5b0492);}(_0x630d,0x159));var _0xd630=function(_0x1e2c00,_0x52e1ed){_0x1e2c00=_0x1e2c00-0x0;var _0x415f48=_0x630d[_0x1e2c00];return _0x415f48;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd630('0x0'));var rp=require(_0xd630('0x1'));var fs=require('fs');var path=require(_0xd630('0x2'));var rimraf=require(_0xd630('0x3'));var config=require(_0xd630('0x4'));var attributes=require('./intServicenowField.attributes');module[_0xd630('0x5')]=function(_0x447a88,_0x33a6b3){return _0x447a88[_0xd630('0x6')]('ServicenowField',attributes,{'tableName':_0xd630('0x7'),'paranoid':![],'indexes':[{'name':_0xd630('0x8'),'fields':['idField',_0xd630('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x61b0=['exports','define','int_servicenow_fields','servicenow_unique_index','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x34a38d,_0x5af692){var _0x268aac=function(_0x3ea46b){while(--_0x3ea46b){_0x34a38d['push'](_0x34a38d['shift']());}};_0x268aac(++_0x5af692);}(_0x61b0,0x64));var _0x061b=function(_0x3706e1,_0x3ed326){_0x3706e1=_0x3706e1-0x0;var _0x1e7b3c=_0x61b0[_0x3706e1];return _0x1e7b3c;};'use strict';var _=require(_0x061b('0x0'));var util=require(_0x061b('0x1'));var logger=require(_0x061b('0x2'))(_0x061b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x061b('0x4'));var fs=require('fs');var path=require(_0x061b('0x5'));var rimraf=require(_0x061b('0x6'));var config=require(_0x061b('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x061b('0x8')]=function(_0x306e06,_0x85bf89){return _0x306e06[_0x061b('0x9')]('ServicenowField',attributes,{'tableName':_0x061b('0xa'),'paranoid':![],'indexes':[{'name':_0x061b('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 4cc6419..900d529 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 _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(_0x2aa393,_0xedcca7){var _0x4cabcc=function(_0x567ffe){while(--_0x567ffe){_0x2aa393['push'](_0x2aa393['shift']());}};_0x4cabcc(++_0xedcca7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0xcb91[_0xe6e78c];return _0x2a09c8;};'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 +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x51b861,_0xb480d3){var _0x52401b=function(_0x30c1ea){while(--_0x30c1ea){_0x51b861['push'](_0x51b861['shift']());}};_0x52401b(++_0xb480d3);}(_0xaa88,0x137));var _0x8aa8=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0xaa88[_0x53f402];return _0x45a76d;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 2510a1a..5c40c5f 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(_0x503711,_0x5abce4){var _0x3cc929=function(_0x3c3df2){while(--_0x3c3df2){_0x503711['push'](_0x503711['shift']());}};_0x3cc929(++_0x5abce4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x1f2422,_0x28a97b){var _0x139373=function(_0xe7525c){while(--_0xe7525c){_0x1f2422['push'](_0x1f2422['shift']());}};_0x139373(++_0x28a97b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 e2c31ad..885c803 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(_0x481ee0,_0x44bd67){var _0x30bb06=function(_0x4775b6){while(--_0x4775b6){_0x481ee0['push'](_0x481ee0['shift']());}};_0x30bb06(++_0x44bd67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x276c9a,_0x5ad129){var _0x42fc49=function(_0x3eae2f){while(--_0x3eae2f){_0x276c9a['push'](_0x276c9a['shift']());}};_0x42fc49(++_0x5ad129);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 18248f4..8c4d6eb 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 _0x5562=['PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','format','get_module_fields','Calls','values','label','endsWith','value','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','destroy','getConfigurations','findOne','nolimit','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','%s%s','/service/v4_1/rest.php','login','JSON','stringify'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x5562,0x8b));var _0x2556=function(_0x1a3917,_0x4f02ea){_0x1a3917=_0x1a3917-0x0;var _0x49172a=_0x5562[_0x1a3917];return _0x49172a;};'use strict';var emlformat=require(_0x2556('0x0'));var rimraf=require(_0x2556('0x1'));var zipdir=require(_0x2556('0x2'));var jsonpatch=require(_0x2556('0x3'));var rp=require(_0x2556('0x4'));var moment=require(_0x2556('0x5'));var BPromise=require(_0x2556('0x6'));var Mustache=require(_0x2556('0x7'));var util=require(_0x2556('0x8'));var path=require(_0x2556('0x9'));var sox=require('sox');var csv=require(_0x2556('0xa'));var ejs=require(_0x2556('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2556('0xc'));var squel=require(_0x2556('0xd'));var crypto=require(_0x2556('0xe'));var jsforce=require(_0x2556('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2556('0xa'));var querystring=require(_0x2556('0x10'));var Papa=require(_0x2556('0x11'));var Redis=require(_0x2556('0x12'));var authService=require(_0x2556('0x13'));var qs=require(_0x2556('0x14'));var as=require(_0x2556('0x15'));var hardwareService=require(_0x2556('0x16'));var logger=require(_0x2556('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x2556('0x18'));var licenseUtil=require(_0x2556('0x19'));var db=require(_0x2556('0x1a'))['db'];var integrations=require(_0x2556('0x1b'));function respondWithStatusCode(_0x446780,_0x27fc12){_0x27fc12=_0x27fc12||0xcc;return function(_0x336bce){if(_0x336bce){return _0x446780[_0x2556('0x1c')](_0x27fc12);}return _0x446780[_0x2556('0x1d')](_0x27fc12)[_0x2556('0x1e')]();};}function respondWithResult(_0x4cf91c,_0x2e07e1){_0x2e07e1=_0x2e07e1||0xc8;return function(_0x29fc0b){if(_0x29fc0b){return _0x4cf91c[_0x2556('0x1d')](_0x2e07e1)[_0x2556('0x1f')](_0x29fc0b);}};}function respondWithFilteredResult(_0x34fc69,_0x273a6e){return function(_0x12039a){if(_0x12039a){var _0x1149bc=typeof _0x273a6e['offset']===_0x2556('0x20')&&typeof _0x273a6e[_0x2556('0x21')]===_0x2556('0x20');var _0x1067ae=_0x12039a[_0x2556('0x22')];var _0x24e714=_0x1149bc?0x0:_0x273a6e[_0x2556('0x23')];var _0x2c27a2=_0x1149bc?_0x12039a[_0x2556('0x22')]:_0x273a6e['offset']+_0x273a6e['limit'];var _0x3d55e2;if(_0x2c27a2>=_0x1067ae){_0x2c27a2=_0x1067ae;_0x3d55e2=0xc8;}else{_0x3d55e2=0xce;}_0x34fc69[_0x2556('0x1d')](_0x3d55e2);return _0x34fc69[_0x2556('0x24')](_0x2556('0x25'),_0x24e714+'-'+_0x2c27a2+'/'+_0x1067ae)[_0x2556('0x1f')](_0x12039a);}return null;};}function patchUpdates(_0x1942f6){return function(_0x43523a){try{jsonpatch[_0x2556('0x26')](_0x43523a,_0x1942f6,!![]);}catch(_0x3bcfeb){return BPromise[_0x2556('0x27')](_0x3bcfeb);}return _0x43523a[_0x2556('0x28')]();};}function saveUpdates(_0x20c0ac,_0xc754d2){return function(_0x2f3f3a){if(_0x2f3f3a){return _0x2f3f3a['update'](_0x20c0ac)[_0x2556('0x29')](function(_0xf9cd44){return _0xf9cd44;});}return null;};}function removeEntity(_0x34ac7b,_0x38e822){return function(_0x34ae47){if(_0x34ae47){return _0x34ae47['destroy']()[_0x2556('0x29')](function(){_0x34ac7b['status'](0xcc)[_0x2556('0x1e')]();});}};}function handleEntityNotFound(_0x5a8175,_0x1a0f06){return function(_0x382193){if(!_0x382193){_0x5a8175[_0x2556('0x1c')](0x194);}return _0x382193;};}function handleError(_0x12541c,_0x49f4fb){_0x49f4fb=_0x49f4fb||0x1f4;return function(_0x48915c){logger[_0x2556('0x2a')](_0x48915c[_0x2556('0x2b')]);if(_0x48915c[_0x2556('0x2c')]){delete _0x48915c['name'];}_0x12541c[_0x2556('0x1d')](_0x49f4fb)[_0x2556('0x2d')](_0x48915c);};}exports[_0x2556('0x2e')]=function(_0x5f0fa9,_0x1aa97d){var _0x27200e={},_0x10a9a8={},_0x362efc={'count':0x0,'rows':[]};var _0x159aca=_[_0x2556('0x2f')](db[_0x2556('0x30')][_0x2556('0x31')],function(_0x5793fd){return{'name':_0x5793fd['fieldName'],'type':_0x5793fd['type'][_0x2556('0x32')]};});_0x10a9a8[_0x2556('0x33')]=_[_0x2556('0x2f')](_0x159aca,_0x2556('0x2c'));_0x10a9a8['query']=_[_0x2556('0x34')](_0x5f0fa9[_0x2556('0x35')]);_0x10a9a8[_0x2556('0x36')]=_[_0x2556('0x37')](_0x10a9a8['model'],_0x10a9a8[_0x2556('0x35')]);_0x27200e[_0x2556('0x38')]=_[_0x2556('0x37')](_0x10a9a8[_0x2556('0x33')],qs[_0x2556('0x39')](_0x5f0fa9[_0x2556('0x35')][_0x2556('0x39')]));_0x27200e[_0x2556('0x38')]=_0x27200e[_0x2556('0x38')][_0x2556('0x3a')]?_0x27200e[_0x2556('0x38')]:_0x10a9a8[_0x2556('0x33')];if(!_0x5f0fa9['query'][_0x2556('0x3b')]('nolimit')){_0x27200e[_0x2556('0x21')]=qs[_0x2556('0x21')](_0x5f0fa9[_0x2556('0x35')][_0x2556('0x21')]);_0x27200e[_0x2556('0x23')]=qs[_0x2556('0x23')](_0x5f0fa9[_0x2556('0x35')][_0x2556('0x23')]);}_0x27200e[_0x2556('0x3c')]=qs['sort'](_0x5f0fa9['query'][_0x2556('0x3d')]);_0x27200e[_0x2556('0x3e')]=qs[_0x2556('0x36')](_[_0x2556('0x3f')](_0x5f0fa9[_0x2556('0x35')],_0x10a9a8['filters']),_0x159aca);if(_0x5f0fa9[_0x2556('0x35')]['filter']){_0x27200e[_0x2556('0x3e')]=_['merge'](_0x27200e[_0x2556('0x3e')],{'$or':_[_0x2556('0x2f')](_0x159aca,function(_0x5b5fd0){if(_0x5b5fd0[_0x2556('0x40')]!==_0x2556('0x41')){var _0x4f434a={};_0x4f434a[_0x5b5fd0[_0x2556('0x2c')]]={'$like':'%'+_0x5f0fa9[_0x2556('0x35')][_0x2556('0x42')]+'%'};return _0x4f434a;}})});}_0x27200e=_[_0x2556('0x43')]({},_0x27200e,_0x5f0fa9['options']);var _0x2d399d={'where':_0x27200e['where']};return db[_0x2556('0x30')]['count'](_0x2d399d)[_0x2556('0x29')](function(_0x1d70fd){_0x362efc[_0x2556('0x22')]=_0x1d70fd;if(_0x5f0fa9[_0x2556('0x35')]['includeAll']){_0x27200e[_0x2556('0x44')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x2556('0x45')](_0x27200e);})[_0x2556('0x29')](function(_0x36657f){_0x362efc[_0x2556('0x46')]=_0x36657f;return _0x362efc;})[_0x2556('0x29')](respondWithFilteredResult(_0x1aa97d,_0x27200e))[_0x2556('0x47')](handleError(_0x1aa97d,null));};exports[_0x2556('0x48')]=function(_0x2531ab,_0x1f22bc){var _0x185c71={'raw':![],'where':{'id':_0x2531ab[_0x2556('0x49')]['id']}},_0x314cf8={};_0x314cf8['model']=_[_0x2556('0x34')](db['SugarcrmAccount']['rawAttributes']);_0x314cf8[_0x2556('0x35')]=_[_0x2556('0x34')](_0x2531ab['query']);_0x314cf8['filters']=_['intersection'](_0x314cf8['model'],_0x314cf8[_0x2556('0x35')]);_0x185c71[_0x2556('0x38')]=_[_0x2556('0x37')](_0x314cf8['model'],qs[_0x2556('0x39')](_0x2531ab['query'][_0x2556('0x39')]));_0x185c71[_0x2556('0x38')]=_0x185c71[_0x2556('0x38')][_0x2556('0x3a')]?_0x185c71['attributes']:_0x314cf8['model'];if(_0x2531ab[_0x2556('0x35')][_0x2556('0x4a')]){_0x185c71[_0x2556('0x44')]=[{'all':!![]}];}_0x185c71=_[_0x2556('0x43')]({},_0x185c71,_0x2531ab[_0x2556('0x4b')]);return db[_0x2556('0x30')][_0x2556('0x4c')](_0x185c71)[_0x2556('0x29')](handleEntityNotFound(_0x1f22bc,null))[_0x2556('0x29')](respondWithResult(_0x1f22bc,null))['catch'](handleError(_0x1f22bc,null));};exports[_0x2556('0x4d')]=function(_0x5b805,_0x3a83a8){return db['SugarcrmAccount'][_0x2556('0x4d')](_0x5b805[_0x2556('0x4e')],{})[_0x2556('0x29')](respondWithResult(_0x3a83a8,0xc9))[_0x2556('0x47')](handleError(_0x3a83a8,null));};exports[_0x2556('0x4f')]=function(_0x38947b,_0x2c20c5){if(_0x38947b['body']['id']){delete _0x38947b['body']['id'];}return db[_0x2556('0x30')][_0x2556('0x4c')]({'where':{'id':_0x38947b['params']['id']}})[_0x2556('0x29')](handleEntityNotFound(_0x2c20c5,null))[_0x2556('0x29')](saveUpdates(_0x38947b['body'],null))[_0x2556('0x29')](respondWithResult(_0x2c20c5,null))[_0x2556('0x47')](handleError(_0x2c20c5,null));};exports[_0x2556('0x50')]=function(_0x51b3a5,_0x5c3115){return db['SugarcrmAccount'][_0x2556('0x4c')]({'where':{'id':_0x51b3a5['params']['id']}})[_0x2556('0x29')](handleEntityNotFound(_0x5c3115,null))[_0x2556('0x29')](removeEntity(_0x5c3115,null))['catch'](handleError(_0x5c3115,null));};exports[_0x2556('0x51')]=function(_0x43f4bc,_0x4f5d7d,_0x3fd949){var _0x5192d7={};var _0x497184={};var _0x550e02;var _0x44a6c3;return db[_0x2556('0x30')][_0x2556('0x52')]({'where':{'id':_0x43f4bc[_0x2556('0x49')]['id']}})[_0x2556('0x29')](handleEntityNotFound(_0x4f5d7d,null))[_0x2556('0x29')](function(_0x401f2b){if(_0x401f2b){_0x550e02=_0x401f2b;_0x497184[_0x2556('0x33')]=_['keys'](db['SugarcrmConfiguration'][_0x2556('0x31')]);_0x497184[_0x2556('0x35')]=_['keys'](_0x43f4bc[_0x2556('0x35')]);_0x497184[_0x2556('0x36')]=_[_0x2556('0x37')](_0x497184[_0x2556('0x33')],_0x497184[_0x2556('0x35')]);_0x5192d7[_0x2556('0x38')]=_[_0x2556('0x37')](_0x497184[_0x2556('0x33')],qs[_0x2556('0x39')](_0x43f4bc[_0x2556('0x35')][_0x2556('0x39')]));_0x5192d7[_0x2556('0x38')]=_0x5192d7[_0x2556('0x38')][_0x2556('0x3a')]?_0x5192d7[_0x2556('0x38')]:_0x497184[_0x2556('0x33')];_0x5192d7[_0x2556('0x3c')]=qs[_0x2556('0x3d')](_0x43f4bc[_0x2556('0x35')][_0x2556('0x3d')]);_0x5192d7[_0x2556('0x3e')]=qs['filters'](_[_0x2556('0x3f')](_0x43f4bc[_0x2556('0x35')],_0x497184[_0x2556('0x36')]));if(_0x43f4bc['query'][_0x2556('0x42')]){_0x5192d7['where']=_[_0x2556('0x43')](_0x5192d7[_0x2556('0x3e')],{'$or':_['map'](_0x5192d7['attributes'],function(_0x1718cb){var _0x1f04d0={};_0x1f04d0[_0x1718cb]={'$like':'%'+_0x43f4bc[_0x2556('0x35')][_0x2556('0x42')]+'%'};return _0x1f04d0;})});}_0x5192d7=_[_0x2556('0x43')]({},_0x5192d7,_0x43f4bc[_0x2556('0x4b')]);return _0x550e02[_0x2556('0x51')](_0x5192d7);}})['then'](function(_0x45284a){if(_0x45284a){_0x44a6c3=_0x45284a[_0x2556('0x3a')];if(!_0x43f4bc['query'][_0x2556('0x3b')](_0x2556('0x53'))){_0x5192d7['limit']=qs['limit'](_0x43f4bc[_0x2556('0x35')]['limit']);_0x5192d7[_0x2556('0x23')]=qs[_0x2556('0x23')](_0x43f4bc[_0x2556('0x35')][_0x2556('0x23')]);}return _0x550e02[_0x2556('0x51')](_0x5192d7);}})[_0x2556('0x29')](function(_0x2e7af8){if(_0x2e7af8){return _0x2e7af8?{'count':_0x44a6c3,'rows':_0x2e7af8}:null;}})[_0x2556('0x29')](respondWithResult(_0x4f5d7d,null))[_0x2556('0x47')](handleError(_0x4f5d7d,null));};exports['addConfiguration']=function(_0x9d64ea,_0x2edb5a,_0x22f8fb){if(_0x9d64ea[_0x2556('0x4e')]['id']){delete _0x9d64ea[_0x2556('0x4e')]['id'];}return db[_0x2556('0x30')][_0x2556('0x52')]({'where':{'id':_0x9d64ea[_0x2556('0x49')]['id']}})[_0x2556('0x29')](handleEntityNotFound(_0x2edb5a,null))[_0x2556('0x29')](function(_0xc74f5e){if(_0xc74f5e){_0x9d64ea[_0x2556('0x4e')]['AccountId']=_0xc74f5e['id'];_0x9d64ea[_0x2556('0x4e')][_0x2556('0x54')]=integrations['getSubjects'](_0x9d64ea[_0x2556('0x4e')][_0x2556('0x55')],_0x9d64ea[_0x2556('0x4e')]['type']);_0x9d64ea[_0x2556('0x4e')][_0x2556('0x56')]=integrations[_0x2556('0x57')](_0x9d64ea[_0x2556('0x4e')][_0x2556('0x55')],_0x9d64ea[_0x2556('0x4e')][_0x2556('0x40')]);return db['SugarcrmConfiguration'][_0x2556('0x4d')](_0x9d64ea['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x2556('0x54')},{'model':db[_0x2556('0x58')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2edb5a,null))[_0x2556('0x47')](handleError(_0x2edb5a,null));};exports['getFields']=function(_0x27ca52,_0x52b0a1,_0x12b524){var _0x4bab49='';var _0x1b3eee=['id',_0x2556('0x2c'),_0x2556('0x59'),_0x2556('0x5a'),_0x2556('0x5b'),'date_start',_0x2556('0x5c'),'duration_minutes',_0x2556('0x5d'),_0x2556('0x5e'),_0x2556('0x5f'),_0x2556('0x60')];return db[_0x2556('0x30')][_0x2556('0x52')]({'where':{'id':_0x27ca52[_0x2556('0x49')]['id']},'attributes':['id',_0x2556('0x61'),_0x2556('0x62'),_0x2556('0x63')]})['then'](handleEntityNotFound(_0x52b0a1,null))[_0x2556('0x29')](function(_0x25a126){if(_0x25a126){_0x4bab49=_0x25a126['remoteUri'];var _0x9dc8ee=_0x4bab49[_0x2556('0x64')](-0x1);if(_0x9dc8ee==='/'){_0x4bab49=_0x4bab49[_0x2556('0x65')](0x0,_0x4bab49['lastIndexOf'](_0x9dc8ee));}return rp({'method':'POST','uri':util['format'](_0x2556('0x66'),_0x4bab49,_0x2556('0x67')),'json':!![],'form':{'method':_0x2556('0x68'),'input_type':_0x2556('0x69'),'response_type':_0x2556('0x69'),'rest_data':JSON[_0x2556('0x6a')]({'user_auth':{'user_name':_0x25a126[_0x2556('0x61')],'password':_0x25a126['password'],'encryption':_0x2556('0x6b')},'application':_0x2556('0x6c')})}});}})[_0x2556('0x29')](function(_0x16f5c4){if(_0x16f5c4&&_0x16f5c4['name']!==_0x2556('0x6d')&&_0x16f5c4['name']!==_0x2556('0x6e')){return rp({'method':_0x2556('0x6f'),'uri':util[_0x2556('0x70')](_0x2556('0x66'),_0x4bab49,_0x2556('0x67')),'json':!![],'form':{'method':_0x2556('0x71'),'input_type':_0x2556('0x69'),'response_type':_0x2556('0x69'),'rest_data':JSON[_0x2556('0x6a')]({'session':_0x16f5c4['id'],'module_name':_0x2556('0x72')})}})['then'](function(_0x2d9a9b){if(_0x2d9a9b){var _0x2405fb=_[_0x2556('0x73')](_0x2d9a9b['module_fields']);_['remove'](_0x2405fb,function(_0x440e60){return _0x1b3eee['includes'](_0x440e60[_0x2556('0x2c')]);});return{'count':_0x2405fb['length'],'rows':_['map'](_0x2405fb,function(_0xa29dbe){return{'id':_0xa29dbe[_0x2556('0x2c')],'name':_0xa29dbe[_0x2556('0x74')],'custom':_[_0x2556('0x75')](_0xa29dbe[_0x2556('0x2c')],'_c')?!![]:![],'options':_0xa29dbe[_0x2556('0x4b')]?_['map'](_[_0x2556('0x73')](_0xa29dbe[_0x2556('0x4b')]),function(_0x3db6d6){return{'name':_0x3db6d6[_0x2556('0x76')],'value':_0x3db6d6['name']};}):[]};})};}})['then'](respondWithResult(_0x52b0a1,null))['catch'](function(_0x3576fd){var _0x1aabf8=_0x27ca52[_0x2556('0x35')][_0x2556('0x77')]?0x1f4:_0x3576fd[_0x2556('0x78')]||0x1f4;logger[_0x2556('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x2556('0x79'),_0x1aabf8,JSON[_0x2556('0x6a')](_0x3576fd));delete _0x3576fd[_0x2556('0x2c')];if(_0x1aabf8===0x191){_0x1aabf8=0x190;}_0x52b0a1[_0x2556('0x1d')](_0x1aabf8)[_0x2556('0x2d')](_0x27ca52[_0x2556('0x35')][_0x2556('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x3576fd[_0x2556('0x78')]}:_0x3576fd);});}else{var _0x520095=0x1f4;_0x52b0a1[_0x2556('0x1d')](_0x520095)[_0x2556('0x2d')]({'message':_0x2556('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd5f9=['where','pick','filter','merge','options','then','include','findAll','show','params','catch','create','body','find','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','remove','includes','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','end','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x5ef37b,_0x166e27){var _0x2a10fa=function(_0x8ed29d){while(--_0x8ed29d){_0x5ef37b['push'](_0x5ef37b['shift']());}};_0x2a10fa(++_0x166e27);}(_0xd5f9,0xb2));var _0x9d5f=function(_0x59ad89,_0x41cdbd){_0x59ad89=_0x59ad89-0x0;var _0x463e97=_0xd5f9[_0x59ad89];return _0x463e97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d5f('0x0'));var zipdir=require(_0x9d5f('0x1'));var jsonpatch=require(_0x9d5f('0x2'));var rp=require(_0x9d5f('0x3'));var moment=require('moment');var BPromise=require(_0x9d5f('0x4'));var Mustache=require(_0x9d5f('0x5'));var util=require(_0x9d5f('0x6'));var path=require(_0x9d5f('0x7'));var sox=require(_0x9d5f('0x8'));var csv=require(_0x9d5f('0x9'));var ejs=require(_0x9d5f('0xa'));var fs=require('fs');var fs_extra=require(_0x9d5f('0xb'));var _=require('lodash');var squel=require(_0x9d5f('0xc'));var crypto=require(_0x9d5f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9d5f('0x9'));var querystring=require('querystring');var Papa=require(_0x9d5f('0xe'));var Redis=require(_0x9d5f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9d5f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d5f('0x11'));var logger=require(_0x9d5f('0x12'))('api');var utils=require(_0x9d5f('0x13'));var config=require(_0x9d5f('0x14'));var licenseUtil=require(_0x9d5f('0x15'));var db=require(_0x9d5f('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2ab6a7,_0x3a9308){_0x3a9308=_0x3a9308||0xcc;return function(_0x44a8be){if(_0x44a8be){return _0x2ab6a7[_0x9d5f('0x17')](_0x3a9308);}return _0x2ab6a7[_0x9d5f('0x18')](_0x3a9308)['end']();};}function respondWithResult(_0x5a9d40,_0x5853c8){_0x5853c8=_0x5853c8||0xc8;return function(_0x44f3d1){if(_0x44f3d1){return _0x5a9d40[_0x9d5f('0x18')](_0x5853c8)['json'](_0x44f3d1);}};}function respondWithFilteredResult(_0x1f1553,_0x11cf6b){return function(_0x54b027){if(_0x54b027){var _0xce4398=typeof _0x11cf6b[_0x9d5f('0x19')]==='undefined'&&typeof _0x11cf6b['limit']===_0x9d5f('0x1a');var _0x590397=_0x54b027[_0x9d5f('0x1b')];var _0x230c0f=_0xce4398?0x0:_0x11cf6b['offset'];var _0x52175e=_0xce4398?_0x54b027[_0x9d5f('0x1b')]:_0x11cf6b[_0x9d5f('0x19')]+_0x11cf6b['limit'];var _0x5d9413;if(_0x52175e>=_0x590397){_0x52175e=_0x590397;_0x5d9413=0xc8;}else{_0x5d9413=0xce;}_0x1f1553[_0x9d5f('0x18')](_0x5d9413);return _0x1f1553[_0x9d5f('0x1c')](_0x9d5f('0x1d'),_0x230c0f+'-'+_0x52175e+'/'+_0x590397)[_0x9d5f('0x1e')](_0x54b027);}return null;};}function patchUpdates(_0x397fb0){return function(_0x4ff6bb){try{jsonpatch[_0x9d5f('0x1f')](_0x4ff6bb,_0x397fb0,!![]);}catch(_0x1f8c07){return BPromise[_0x9d5f('0x20')](_0x1f8c07);}return _0x4ff6bb[_0x9d5f('0x21')]();};}function saveUpdates(_0x5903af,_0x446645){return function(_0x3d7262){if(_0x3d7262){return _0x3d7262[_0x9d5f('0x22')](_0x5903af)['then'](function(_0x3e3b31){return _0x3e3b31;});}return null;};}function removeEntity(_0x21e758,_0x1e3b06){return function(_0x2293dd){if(_0x2293dd){return _0x2293dd[_0x9d5f('0x23')]()['then'](function(){_0x21e758[_0x9d5f('0x18')](0xcc)[_0x9d5f('0x24')]();});}};}function handleEntityNotFound(_0x3cccc9,_0x17d907){return function(_0x35f0fd){if(!_0x35f0fd){_0x3cccc9[_0x9d5f('0x17')](0x194);}return _0x35f0fd;};}function handleError(_0x2314eb,_0x183d0a){_0x183d0a=_0x183d0a||0x1f4;return function(_0x11fa85){logger[_0x9d5f('0x25')](_0x11fa85[_0x9d5f('0x26')]);if(_0x11fa85[_0x9d5f('0x27')]){delete _0x11fa85['name'];}_0x2314eb[_0x9d5f('0x18')](_0x183d0a)[_0x9d5f('0x28')](_0x11fa85);};}exports[_0x9d5f('0x29')]=function(_0x38e8c8,_0x56afba){var _0x1d4b0c={},_0x499153={},_0x49a8a3={'count':0x0,'rows':[]};var _0x6e902d=_['map'](db[_0x9d5f('0x2a')][_0x9d5f('0x2b')],function(_0x3c0a00){return{'name':_0x3c0a00[_0x9d5f('0x2c')],'type':_0x3c0a00['type'][_0x9d5f('0x2d')]};});_0x499153[_0x9d5f('0x2e')]=_[_0x9d5f('0x2f')](_0x6e902d,_0x9d5f('0x27'));_0x499153[_0x9d5f('0x30')]=_[_0x9d5f('0x31')](_0x38e8c8[_0x9d5f('0x30')]);_0x499153[_0x9d5f('0x32')]=_['intersection'](_0x499153[_0x9d5f('0x2e')],_0x499153['query']);_0x1d4b0c[_0x9d5f('0x33')]=_[_0x9d5f('0x34')](_0x499153['model'],qs[_0x9d5f('0x35')](_0x38e8c8[_0x9d5f('0x30')]['fields']));_0x1d4b0c['attributes']=_0x1d4b0c[_0x9d5f('0x33')][_0x9d5f('0x36')]?_0x1d4b0c[_0x9d5f('0x33')]:_0x499153[_0x9d5f('0x2e')];if(!_0x38e8c8[_0x9d5f('0x30')][_0x9d5f('0x37')](_0x9d5f('0x38'))){_0x1d4b0c[_0x9d5f('0x39')]=qs[_0x9d5f('0x39')](_0x38e8c8['query'][_0x9d5f('0x39')]);_0x1d4b0c[_0x9d5f('0x19')]=qs[_0x9d5f('0x19')](_0x38e8c8[_0x9d5f('0x30')]['offset']);}_0x1d4b0c[_0x9d5f('0x3a')]=qs[_0x9d5f('0x3b')](_0x38e8c8[_0x9d5f('0x30')]['sort']);_0x1d4b0c[_0x9d5f('0x3c')]=qs[_0x9d5f('0x32')](_[_0x9d5f('0x3d')](_0x38e8c8['query'],_0x499153[_0x9d5f('0x32')]),_0x6e902d);if(_0x38e8c8[_0x9d5f('0x30')][_0x9d5f('0x3e')]){_0x1d4b0c['where']=_[_0x9d5f('0x3f')](_0x1d4b0c['where'],{'$or':_['map'](_0x6e902d,function(_0x9f1d07){if(_0x9f1d07['type']!=='VIRTUAL'){var _0x1d715d={};_0x1d715d[_0x9f1d07[_0x9d5f('0x27')]]={'$like':'%'+_0x38e8c8[_0x9d5f('0x30')]['filter']+'%'};return _0x1d715d;}})});}_0x1d4b0c=_['merge']({},_0x1d4b0c,_0x38e8c8[_0x9d5f('0x40')]);var _0x1725bc={'where':_0x1d4b0c[_0x9d5f('0x3c')]};return db['SugarcrmAccount'][_0x9d5f('0x1b')](_0x1725bc)[_0x9d5f('0x41')](function(_0x2afd9b){_0x49a8a3[_0x9d5f('0x1b')]=_0x2afd9b;if(_0x38e8c8[_0x9d5f('0x30')]['includeAll']){_0x1d4b0c[_0x9d5f('0x42')]=[{'all':!![]}];}return db[_0x9d5f('0x2a')][_0x9d5f('0x43')](_0x1d4b0c);})[_0x9d5f('0x41')](function(_0x284f13){_0x49a8a3['rows']=_0x284f13;return _0x49a8a3;})[_0x9d5f('0x41')](respondWithFilteredResult(_0x56afba,_0x1d4b0c))['catch'](handleError(_0x56afba,null));};exports[_0x9d5f('0x44')]=function(_0xd0e5c5,_0x472b03){var _0xb206e4={'raw':![],'where':{'id':_0xd0e5c5[_0x9d5f('0x45')]['id']}},_0x54515e={};_0x54515e['model']=_[_0x9d5f('0x31')](db[_0x9d5f('0x2a')][_0x9d5f('0x2b')]);_0x54515e[_0x9d5f('0x30')]=_[_0x9d5f('0x31')](_0xd0e5c5['query']);_0x54515e[_0x9d5f('0x32')]=_[_0x9d5f('0x34')](_0x54515e[_0x9d5f('0x2e')],_0x54515e['query']);_0xb206e4[_0x9d5f('0x33')]=_[_0x9d5f('0x34')](_0x54515e[_0x9d5f('0x2e')],qs[_0x9d5f('0x35')](_0xd0e5c5['query']['fields']));_0xb206e4[_0x9d5f('0x33')]=_0xb206e4[_0x9d5f('0x33')]['length']?_0xb206e4[_0x9d5f('0x33')]:_0x54515e[_0x9d5f('0x2e')];if(_0xd0e5c5[_0x9d5f('0x30')]['includeAll']){_0xb206e4['include']=[{'all':!![]}];}_0xb206e4=_[_0x9d5f('0x3f')]({},_0xb206e4,_0xd0e5c5['options']);return db[_0x9d5f('0x2a')]['find'](_0xb206e4)['then'](handleEntityNotFound(_0x472b03,null))[_0x9d5f('0x41')](respondWithResult(_0x472b03,null))[_0x9d5f('0x46')](handleError(_0x472b03,null));};exports['create']=function(_0x21d474,_0x3a0e8e){return db[_0x9d5f('0x2a')][_0x9d5f('0x47')](_0x21d474[_0x9d5f('0x48')],{})[_0x9d5f('0x41')](respondWithResult(_0x3a0e8e,0xc9))[_0x9d5f('0x46')](handleError(_0x3a0e8e,null));};exports['update']=function(_0x25ac8b,_0x5e7ff0){if(_0x25ac8b[_0x9d5f('0x48')]['id']){delete _0x25ac8b[_0x9d5f('0x48')]['id'];}return db[_0x9d5f('0x2a')]['find']({'where':{'id':_0x25ac8b[_0x9d5f('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e7ff0,null))[_0x9d5f('0x41')](saveUpdates(_0x25ac8b['body'],null))[_0x9d5f('0x41')](respondWithResult(_0x5e7ff0,null))[_0x9d5f('0x46')](handleError(_0x5e7ff0,null));};exports[_0x9d5f('0x23')]=function(_0x166344,_0x4dff3d){return db[_0x9d5f('0x2a')][_0x9d5f('0x49')]({'where':{'id':_0x166344[_0x9d5f('0x45')]['id']}})[_0x9d5f('0x41')](handleEntityNotFound(_0x4dff3d,null))['then'](removeEntity(_0x4dff3d,null))[_0x9d5f('0x46')](handleError(_0x4dff3d,null));};exports[_0x9d5f('0x4a')]=function(_0x33e882,_0x2aa8e2,_0x5911b5){var _0xc1a75e={};var _0xb599f7={};var _0x3ffc42;var _0x115bb8;return db[_0x9d5f('0x2a')][_0x9d5f('0x4b')]({'where':{'id':_0x33e882[_0x9d5f('0x45')]['id']}})[_0x9d5f('0x41')](handleEntityNotFound(_0x2aa8e2,null))[_0x9d5f('0x41')](function(_0x53e0ff){if(_0x53e0ff){_0x3ffc42=_0x53e0ff;_0xb599f7[_0x9d5f('0x2e')]=_[_0x9d5f('0x31')](db['SugarcrmConfiguration'][_0x9d5f('0x2b')]);_0xb599f7['query']=_[_0x9d5f('0x31')](_0x33e882[_0x9d5f('0x30')]);_0xb599f7[_0x9d5f('0x32')]=_[_0x9d5f('0x34')](_0xb599f7[_0x9d5f('0x2e')],_0xb599f7['query']);_0xc1a75e[_0x9d5f('0x33')]=_[_0x9d5f('0x34')](_0xb599f7['model'],qs[_0x9d5f('0x35')](_0x33e882[_0x9d5f('0x30')]['fields']));_0xc1a75e[_0x9d5f('0x33')]=_0xc1a75e[_0x9d5f('0x33')]['length']?_0xc1a75e[_0x9d5f('0x33')]:_0xb599f7[_0x9d5f('0x2e')];_0xc1a75e['order']=qs['sort'](_0x33e882[_0x9d5f('0x30')][_0x9d5f('0x3b')]);_0xc1a75e[_0x9d5f('0x3c')]=qs[_0x9d5f('0x32')](_[_0x9d5f('0x3d')](_0x33e882[_0x9d5f('0x30')],_0xb599f7[_0x9d5f('0x32')]));if(_0x33e882[_0x9d5f('0x30')][_0x9d5f('0x3e')]){_0xc1a75e['where']=_[_0x9d5f('0x3f')](_0xc1a75e[_0x9d5f('0x3c')],{'$or':_[_0x9d5f('0x2f')](_0xc1a75e['attributes'],function(_0x27421e){var _0x18f5a1={};_0x18f5a1[_0x27421e]={'$like':'%'+_0x33e882[_0x9d5f('0x30')][_0x9d5f('0x3e')]+'%'};return _0x18f5a1;})});}_0xc1a75e=_[_0x9d5f('0x3f')]({},_0xc1a75e,_0x33e882[_0x9d5f('0x40')]);return _0x3ffc42[_0x9d5f('0x4a')](_0xc1a75e);}})[_0x9d5f('0x41')](function(_0x2f164e){if(_0x2f164e){_0x115bb8=_0x2f164e['length'];if(!_0x33e882[_0x9d5f('0x30')][_0x9d5f('0x37')](_0x9d5f('0x38'))){_0xc1a75e['limit']=qs[_0x9d5f('0x39')](_0x33e882[_0x9d5f('0x30')][_0x9d5f('0x39')]);_0xc1a75e[_0x9d5f('0x19')]=qs['offset'](_0x33e882[_0x9d5f('0x30')]['offset']);}return _0x3ffc42[_0x9d5f('0x4a')](_0xc1a75e);}})['then'](function(_0x5652b2){if(_0x5652b2){return _0x5652b2?{'count':_0x115bb8,'rows':_0x5652b2}:null;}})[_0x9d5f('0x41')](respondWithResult(_0x2aa8e2,null))[_0x9d5f('0x46')](handleError(_0x2aa8e2,null));};exports[_0x9d5f('0x4c')]=function(_0x19e5fb,_0x2c8ca7,_0x34afd1){if(_0x19e5fb[_0x9d5f('0x48')]['id']){delete _0x19e5fb['body']['id'];}return db[_0x9d5f('0x2a')]['findOne']({'where':{'id':_0x19e5fb[_0x9d5f('0x45')]['id']}})[_0x9d5f('0x41')](handleEntityNotFound(_0x2c8ca7,null))['then'](function(_0x1e69a0){if(_0x1e69a0){_0x19e5fb['body']['AccountId']=_0x1e69a0['id'];_0x19e5fb[_0x9d5f('0x48')][_0x9d5f('0x4d')]=integrations[_0x9d5f('0x4e')](_0x19e5fb['body'][_0x9d5f('0x4f')],_0x19e5fb['body']['type']);_0x19e5fb[_0x9d5f('0x48')][_0x9d5f('0x50')]=integrations[_0x9d5f('0x51')](_0x19e5fb[_0x9d5f('0x48')][_0x9d5f('0x4f')],_0x19e5fb['body'][_0x9d5f('0x52')]);return db[_0x9d5f('0x53')][_0x9d5f('0x47')](_0x19e5fb[_0x9d5f('0x48')],{'include':[{'model':db[_0x9d5f('0x54')],'as':_0x9d5f('0x4d')},{'model':db[_0x9d5f('0x54')],'as':_0x9d5f('0x50')}]});}return null;})[_0x9d5f('0x41')](respondWithResult(_0x2c8ca7,null))[_0x9d5f('0x46')](handleError(_0x2c8ca7,null));};exports[_0x9d5f('0x55')]=function(_0x6d81,_0x3d0ebd,_0x99e814){var _0x24ebac='';var _0x4548a4=['id',_0x9d5f('0x27'),_0x9d5f('0x56'),_0x9d5f('0x57'),_0x9d5f('0x58'),_0x9d5f('0x59'),_0x9d5f('0x5a'),'duration_minutes',_0x9d5f('0x5b'),'parent_type',_0x9d5f('0x5c'),_0x9d5f('0x5d')];return db['SugarcrmAccount'][_0x9d5f('0x4b')]({'where':{'id':_0x6d81[_0x9d5f('0x45')]['id']},'attributes':['id',_0x9d5f('0x5e'),_0x9d5f('0x5f'),_0x9d5f('0x60')]})['then'](handleEntityNotFound(_0x3d0ebd,null))['then'](function(_0xa56466){if(_0xa56466){_0x24ebac=_0xa56466['remoteUri'];var _0x4830bc=_0x24ebac[_0x9d5f('0x61')](-0x1);if(_0x4830bc==='/'){_0x24ebac=_0x24ebac['substring'](0x0,_0x24ebac[_0x9d5f('0x62')](_0x4830bc));}return rp({'method':_0x9d5f('0x63'),'uri':util[_0x9d5f('0x64')](_0x9d5f('0x65'),_0x24ebac,_0x9d5f('0x66')),'json':!![],'form':{'method':_0x9d5f('0x67'),'input_type':_0x9d5f('0x68'),'response_type':_0x9d5f('0x68'),'rest_data':JSON[_0x9d5f('0x69')]({'user_auth':{'user_name':_0xa56466[_0x9d5f('0x5e')],'password':_0xa56466[_0x9d5f('0x5f')],'encryption':'PLAIN'},'application':_0x9d5f('0x6a')})}});}})[_0x9d5f('0x41')](function(_0x20f98c){if(_0x20f98c&&_0x20f98c[_0x9d5f('0x27')]!==_0x9d5f('0x6b')&&_0x20f98c['name']!==_0x9d5f('0x6c')){return rp({'method':_0x9d5f('0x63'),'uri':util['format']('%s%s',_0x24ebac,_0x9d5f('0x66')),'json':!![],'form':{'method':_0x9d5f('0x6d'),'input_type':_0x9d5f('0x68'),'response_type':_0x9d5f('0x68'),'rest_data':JSON[_0x9d5f('0x69')]({'session':_0x20f98c['id'],'module_name':_0x9d5f('0x6e')})}})['then'](function(_0x2f31f8){if(_0x2f31f8){var _0x1ecce8=_[_0x9d5f('0x6f')](_0x2f31f8['module_fields']);_[_0x9d5f('0x70')](_0x1ecce8,function(_0x18046d){return _0x4548a4[_0x9d5f('0x71')](_0x18046d[_0x9d5f('0x27')]);});return{'count':_0x1ecce8['length'],'rows':_[_0x9d5f('0x2f')](_0x1ecce8,function(_0x126b67){return{'id':_0x126b67['name'],'name':_0x126b67[_0x9d5f('0x72')],'custom':_['endsWith'](_0x126b67[_0x9d5f('0x27')],'_c')?!![]:![],'options':_0x126b67[_0x9d5f('0x40')]?_['map'](_['values'](_0x126b67[_0x9d5f('0x40')]),function(_0x4158c9){return{'name':_0x4158c9['value'],'value':_0x4158c9['name']};}):[]};})};}})[_0x9d5f('0x41')](respondWithResult(_0x3d0ebd,null))['catch'](function(_0x5bc746){var _0x3c2b09=_0x6d81[_0x9d5f('0x30')][_0x9d5f('0x73')]?0x1f4:_0x5bc746[_0x9d5f('0x74')]||0x1f4;logger[_0x9d5f('0x25')](_0x9d5f('0x75'),'getFields',_0x3c2b09,JSON[_0x9d5f('0x69')](_0x5bc746));delete _0x5bc746[_0x9d5f('0x27')];if(_0x3c2b09===0x191){_0x3c2b09=0x190;}_0x3d0ebd[_0x9d5f('0x18')](_0x3c2b09)[_0x9d5f('0x28')](_0x6d81[_0x9d5f('0x30')][_0x9d5f('0x73')]?{'message':_0x9d5f('0x76'),'statusCode':_0x5bc746[_0x9d5f('0x74')]}:_0x5bc746);});}else{var _0x4a4105=0x1f4;_0x3d0ebd[_0x9d5f('0x18')](_0x4a4105)[_0x9d5f('0x28')]({'message':_0x9d5f('0x76'),'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 76a0a11..0fb2ff8 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 _0x6afd=['api','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger'];(function(_0x3f2dda,_0x14cadc){var _0xa57aab=function(_0x2d18bd){while(--_0x2d18bd){_0x3f2dda['push'](_0x3f2dda['shift']());}};_0xa57aab(++_0x14cadc);}(_0x6afd,0x9a));var _0xd6af=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6afd[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xd6af('0x0'));var logger=require(_0xd6af('0x1'))(_0xd6af('0x2'));var moment=require('moment');var BPromise=require(_0xd6af('0x3'));var rp=require(_0xd6af('0x4'));var fs=require('fs');var path=require(_0xd6af('0x5'));var rimraf=require('rimraf');var config=require(_0xd6af('0x6'));var attributes=require(_0xd6af('0x7'));var integrations=require(_0xd6af('0x8'));module['exports']=function(_0x647903,_0x36fa8f){return _0x647903[_0xd6af('0x9')](_0xd6af('0xa'),attributes,{'tableName':_0xd6af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd2=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','lodash'];(function(_0x11ce46,_0x7a1715){var _0x272001=function(_0x38c599){while(--_0x38c599){_0x11ce46['push'](_0x11ce46['shift']());}};_0x272001(++_0x7a1715);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require(_0x2cdd('0x2'))(_0x2cdd('0x3'));var moment=require('moment');var BPromise=require(_0x2cdd('0x4'));var rp=require(_0x2cdd('0x5'));var fs=require('fs');var path=require(_0x2cdd('0x6'));var rimraf=require(_0x2cdd('0x7'));var config=require('../../config/environment');var attributes=require(_0x2cdd('0x8'));var integrations=require(_0x2cdd('0x9'));module['exports']=function(_0x1cc1ac,_0x36f9ad){return _0x1cc1ac[_0x2cdd('0xa')](_0x2cdd('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 1de7e7f..fb8ff41 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 _0x3ea5=['jayson/promise','client','http','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3ce0e2,_0x3ca132){var _0x36fb36=function(_0x24fd4c){while(--_0x24fd4c){_0x3ce0e2['push'](_0x3ce0e2['shift']());}};_0x36fb36(++_0x3ca132);}(_0x3ea5,0x1d9));var _0x53ea=function(_0x4f7362,_0x41212d){_0x4f7362=_0x4f7362-0x0;var _0x26102d=_0x3ea5[_0x4f7362];return _0x26102d;};'use strict';var _=require('lodash');var util=require(_0x53ea('0x0'));var moment=require(_0x53ea('0x1'));var BPromise=require(_0x53ea('0x2'));var rs=require(_0x53ea('0x3'));var fs=require('fs');var Redis=require(_0x53ea('0x4'));var db=require(_0x53ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x53ea('0x6'));var config=require('../../config/environment');var jayson=require(_0x53ea('0x7'));var client=jayson[_0x53ea('0x8')][_0x53ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f89cc,_0x141a1d,_0xd928ce){return new BPromise(function(_0x218be7,_0x44c080){return client['request'](_0x3f89cc,_0xd928ce)[_0x53ea('0xa')](function(_0x3da39b){logger[_0x53ea('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x141a1d,_0x53ea('0xc'));logger[_0x53ea('0xd')](_0x53ea('0xe'),_0x141a1d,_0x53ea('0xc'),JSON[_0x53ea('0xf')](_0x3da39b));if(_0x3da39b[_0x53ea('0x10')]){if(_0x3da39b[_0x53ea('0x10')]['code']===0x1f4){logger[_0x53ea('0x10')](_0x53ea('0x11'),_0x141a1d,_0x3da39b[_0x53ea('0x10')][_0x53ea('0x12')]);return _0x44c080(_0x3da39b[_0x53ea('0x10')][_0x53ea('0x12')]);}logger[_0x53ea('0x10')](_0x53ea('0x11'),_0x141a1d,_0x3da39b[_0x53ea('0x10')]['message']);return _0x218be7(_0x3da39b[_0x53ea('0x10')][_0x53ea('0x12')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x141a1d,_0x53ea('0xc'));_0x218be7(_0x3da39b[_0x53ea('0x13')]['message']);}})[_0x53ea('0x14')](function(_0x15d8a6){logger['error'](_0x53ea('0x11'),_0x141a1d,_0x15d8a6);_0x44c080(_0x15d8a6);});});}exports['GetSugarcrmAccount']=function(_0x415247){var _0x1ccc7a=this;return new Promise(function(_0x155cba,_0x403be2){return db['SugarcrmAccount']['findAll']({'raw':_0x415247['options']?_0x415247[_0x53ea('0x15')][_0x53ea('0x16')]===undefined?!![]:![]:!![],'where':_0x415247[_0x53ea('0x15')]?_0x415247[_0x53ea('0x15')][_0x53ea('0x17')]||null:null,'attributes':_0x415247['options']?_0x415247['options'][_0x53ea('0x18')]||null:null,'limit':_0x415247[_0x53ea('0x15')]?_0x415247[_0x53ea('0x15')][_0x53ea('0x19')]||null:null,'include':_0x415247['options']?_0x415247['options'][_0x53ea('0x1a')]?_[_0x53ea('0x1b')](_0x415247[_0x53ea('0x15')]['include'],function(_0x1fd59d){return{'model':db[_0x1fd59d[_0x53ea('0x1c')]],'as':_0x1fd59d['as'],'attributes':_0x1fd59d[_0x53ea('0x18')],'include':_0x1fd59d[_0x53ea('0x1a')]?_['map'](_0x1fd59d[_0x53ea('0x1a')],function(_0x4be522){return{'model':db[_0x4be522[_0x53ea('0x1c')]],'as':_0x4be522['as'],'attributes':_0x4be522[_0x53ea('0x18')],'include':_0x4be522[_0x53ea('0x1a')]?_['map'](_0x4be522[_0x53ea('0x1a')],function(_0x538675){return{'model':db[_0x538675[_0x53ea('0x1c')]],'as':_0x538675['as'],'attributes':_0x538675[_0x53ea('0x18')]};}):[]};}):[]};}):[]:[]})[_0x53ea('0xa')](function(_0x348423){logger[_0x53ea('0xb')](_0x53ea('0x1d'),_0x415247);logger[_0x53ea('0xd')](_0x53ea('0x1d'),_0x415247,JSON[_0x53ea('0xf')](_0x348423));_0x155cba(_0x348423);})[_0x53ea('0x14')](function(_0x16349b){logger[_0x53ea('0x10')](_0x53ea('0x1d'),_0x16349b[_0x53ea('0x12')],_0x415247);_0x403be2(_0x1ccc7a[_0x53ea('0x10')](0x1f4,_0x16349b[_0x53ea('0x12')]));});});};exports[_0x53ea('0x1e')]=function(_0xcad780){var _0x24f7b8=this;return new Promise(function(_0x43c13a,_0x1ae42a){return db[_0x53ea('0x1f')]['find']({'raw':_0xcad780[_0x53ea('0x15')]?_0xcad780[_0x53ea('0x15')][_0x53ea('0x16')]===undefined?!![]:![]:!![],'where':_0xcad780[_0x53ea('0x15')]?_0xcad780[_0x53ea('0x15')][_0x53ea('0x17')]||null:null,'attributes':_0xcad780[_0x53ea('0x15')]?_0xcad780[_0x53ea('0x15')][_0x53ea('0x18')]||null:null,'include':_0xcad780[_0x53ea('0x15')]?_0xcad780[_0x53ea('0x15')]['include']?_[_0x53ea('0x1b')](_0xcad780[_0x53ea('0x15')][_0x53ea('0x1a')],function(_0x3a5717){return{'model':db[_0x3a5717[_0x53ea('0x1c')]],'as':_0x3a5717['as'],'attributes':_0x3a5717[_0x53ea('0x18')],'include':_0x3a5717[_0x53ea('0x1a')]?_[_0x53ea('0x1b')](_0x3a5717[_0x53ea('0x1a')],function(_0x3555e3){return{'model':db[_0x3555e3[_0x53ea('0x1c')]],'as':_0x3555e3['as'],'attributes':_0x3555e3['attributes'],'include':_0x3555e3[_0x53ea('0x1a')]?_[_0x53ea('0x1b')](_0x3555e3['include'],function(_0x3fd1d8){return{'model':db[_0x3fd1d8[_0x53ea('0x1c')]],'as':_0x3fd1d8['as'],'attributes':_0x3fd1d8[_0x53ea('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b4bc3){logger[_0x53ea('0xb')](_0x53ea('0x1e'),_0xcad780);logger['debug'](_0x53ea('0x1e'),_0xcad780,JSON[_0x53ea('0xf')](_0x3b4bc3));_0x43c13a(_0x3b4bc3);})[_0x53ea('0x14')](function(_0x18077e){logger[_0x53ea('0x10')]('ShowSugarcrmAccount',_0x18077e[_0x53ea('0x12')],_0xcad780);_0x1ae42a(_0x24f7b8[_0x53ea('0x10')](0x1f4,_0x18077e[_0x53ea('0x12')]));});});}; \ No newline at end of file +var _0x890d=['SugarcrmAccount','findAll','options','where','limit','include','map','model','attributes','stringify','find','ShowSugarcrmAccount','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSugarcrmAccount'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x890d,0x114));var _0xd890=function(_0x2894e4,_0x39f2f7){_0x2894e4=_0x2894e4-0x0;var _0x341734=_0x890d[_0x2894e4];return _0x341734;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd890('0x0'));var BPromise=require(_0xd890('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd890('0x2'))['db'];var utils=require(_0xd890('0x3'));var logger=require('../../config/logger')(_0xd890('0x4'));var config=require(_0xd890('0x5'));var jayson=require(_0xd890('0x6'));var client=jayson[_0xd890('0x7')][_0xd890('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x692d3a,_0x57f679,_0x5d0f82){return new BPromise(function(_0x1f059b,_0x1af5e6){return client[_0xd890('0x9')](_0x692d3a,_0x5d0f82)[_0xd890('0xa')](function(_0x54d4d8){logger[_0xd890('0xb')](_0xd890('0xc'),_0x57f679,_0xd890('0xd'));logger[_0xd890('0xe')](_0xd890('0xf'),_0x57f679,_0xd890('0xd'),JSON['stringify'](_0x54d4d8));if(_0x54d4d8[_0xd890('0x10')]){if(_0x54d4d8[_0xd890('0x10')][_0xd890('0x11')]===0x1f4){logger[_0xd890('0x10')](_0xd890('0xc'),_0x57f679,_0x54d4d8[_0xd890('0x10')][_0xd890('0x12')]);return _0x1af5e6(_0x54d4d8['error'][_0xd890('0x12')]);}logger[_0xd890('0x10')](_0xd890('0xc'),_0x57f679,_0x54d4d8['error'][_0xd890('0x12')]);return _0x1f059b(_0x54d4d8[_0xd890('0x10')][_0xd890('0x12')]);}else{logger['info'](_0xd890('0xc'),_0x57f679,_0xd890('0xd'));_0x1f059b(_0x54d4d8[_0xd890('0x13')][_0xd890('0x12')]);}})['catch'](function(_0x220b7e){logger[_0xd890('0x10')](_0xd890('0xc'),_0x57f679,_0x220b7e);_0x1af5e6(_0x220b7e);});});}exports[_0xd890('0x14')]=function(_0x3be8f8){var _0x377a14=this;return new Promise(function(_0x25654b,_0x46ac62){return db[_0xd890('0x15')][_0xd890('0x16')]({'raw':_0x3be8f8['options']?_0x3be8f8[_0xd890('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3be8f8[_0xd890('0x17')]?_0x3be8f8[_0xd890('0x17')][_0xd890('0x18')]||null:null,'attributes':_0x3be8f8['options']?_0x3be8f8['options']['attributes']||null:null,'limit':_0x3be8f8[_0xd890('0x17')]?_0x3be8f8[_0xd890('0x17')][_0xd890('0x19')]||null:null,'include':_0x3be8f8['options']?_0x3be8f8['options'][_0xd890('0x1a')]?_[_0xd890('0x1b')](_0x3be8f8[_0xd890('0x17')]['include'],function(_0x45f9bb){return{'model':db[_0x45f9bb[_0xd890('0x1c')]],'as':_0x45f9bb['as'],'attributes':_0x45f9bb['attributes'],'include':_0x45f9bb[_0xd890('0x1a')]?_[_0xd890('0x1b')](_0x45f9bb[_0xd890('0x1a')],function(_0x491c82){return{'model':db[_0x491c82['model']],'as':_0x491c82['as'],'attributes':_0x491c82[_0xd890('0x1d')],'include':_0x491c82['include']?_['map'](_0x491c82[_0xd890('0x1a')],function(_0x5723be){return{'model':db[_0x5723be[_0xd890('0x1c')]],'as':_0x5723be['as'],'attributes':_0x5723be[_0xd890('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa9b2ef){logger[_0xd890('0xb')](_0xd890('0x14'),_0x3be8f8);logger['debug']('GetSugarcrmAccount',_0x3be8f8,JSON[_0xd890('0x1e')](_0xa9b2ef));_0x25654b(_0xa9b2ef);})['catch'](function(_0x8b35e8){logger['error'](_0xd890('0x14'),_0x8b35e8['message'],_0x3be8f8);_0x46ac62(_0x377a14[_0xd890('0x10')](0x1f4,_0x8b35e8[_0xd890('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x5e1905){var _0x4f5b5e=this;return new Promise(function(_0x22c4c4,_0x50e344){return db['SugarcrmAccount'][_0xd890('0x1f')]({'raw':_0x5e1905['options']?_0x5e1905[_0xd890('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5e1905[_0xd890('0x17')]?_0x5e1905['options'][_0xd890('0x18')]||null:null,'attributes':_0x5e1905[_0xd890('0x17')]?_0x5e1905[_0xd890('0x17')][_0xd890('0x1d')]||null:null,'include':_0x5e1905['options']?_0x5e1905[_0xd890('0x17')][_0xd890('0x1a')]?_[_0xd890('0x1b')](_0x5e1905[_0xd890('0x17')]['include'],function(_0x3325a1){return{'model':db[_0x3325a1[_0xd890('0x1c')]],'as':_0x3325a1['as'],'attributes':_0x3325a1[_0xd890('0x1d')],'include':_0x3325a1[_0xd890('0x1a')]?_['map'](_0x3325a1[_0xd890('0x1a')],function(_0x5f34bb){return{'model':db[_0x5f34bb[_0xd890('0x1c')]],'as':_0x5f34bb['as'],'attributes':_0x5f34bb[_0xd890('0x1d')],'include':_0x5f34bb['include']?_[_0xd890('0x1b')](_0x5f34bb[_0xd890('0x1a')],function(_0x1bb903){return{'model':db[_0x1bb903[_0xd890('0x1c')]],'as':_0x1bb903['as'],'attributes':_0x1bb903[_0xd890('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd890('0xa')](function(_0x2544b9){logger[_0xd890('0xb')](_0xd890('0x20'),_0x5e1905);logger['debug']('ShowSugarcrmAccount',_0x5e1905,JSON['stringify'](_0x2544b9));_0x22c4c4(_0x2544b9);})['catch'](function(_0x565369){logger[_0xd890('0x10')](_0xd890('0x20'),_0x565369[_0xd890('0x12')],_0x5e1905);_0x50e344(_0x4f5b5e[_0xd890('0x10')](0x1f4,_0x565369[_0xd890('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index fb76391..4f42f28 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 _0xada8=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x18f620,_0x5868b6){var _0x470803=function(_0x5e4bf3){while(--_0x5e4bf3){_0x18f620['push'](_0x18f620['shift']());}};_0x470803(++_0x5868b6);}(_0xada8,0xee));var _0x8ada=function(_0x1f86e2,_0x224a5e){_0x1f86e2=_0x1f86e2-0x0;var _0x20ae10=_0xada8[_0x1f86e2];return _0x20ae10;};'use strict';var multer=require(_0x8ada('0x0'));var util=require(_0x8ada('0x1'));var path=require(_0x8ada('0x2'));var timeout=require(_0x8ada('0x3'));var express=require(_0x8ada('0x4'));var router=express['Router']();var fs_extra=require(_0x8ada('0x5'));var auth=require(_0x8ada('0x6'));var interaction=require(_0x8ada('0x7'));var config=require(_0x8ada('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x8ada('0x9')](),controller[_0x8ada('0xa')]);router[_0x8ada('0xb')](_0x8ada('0xc'),auth[_0x8ada('0x9')](),controller[_0x8ada('0xd')]);router[_0x8ada('0xb')](_0x8ada('0xe'),auth[_0x8ada('0x9')](),controller[_0x8ada('0xf')]);router[_0x8ada('0xb')](_0x8ada('0x10'),auth[_0x8ada('0x9')](),controller[_0x8ada('0x11')]);router[_0x8ada('0xb')](_0x8ada('0x12'),auth[_0x8ada('0x9')](),controller[_0x8ada('0x13')]);router[_0x8ada('0x14')]('/',auth[_0x8ada('0x9')](),controller[_0x8ada('0x15')]);router['put'](_0x8ada('0xc'),auth[_0x8ada('0x9')](),controller['update']);router[_0x8ada('0x16')](_0x8ada('0xc'),auth[_0x8ada('0x9')](),controller[_0x8ada('0x17')]);module[_0x8ada('0x18')]=router; \ No newline at end of file +var _0xa818=['post','create','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x4aba8d,_0x10bb16){var _0x2a34c0=function(_0x11d10f){while(--_0x11d10f){_0x4aba8d['push'](_0x4aba8d['shift']());}};_0x2a34c0(++_0x10bb16);}(_0xa818,0x1e8));var _0x8a81=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0xa818[_0xf34b0a];return _0x5021e1;};'use strict';var multer=require(_0x8a81('0x0'));var util=require(_0x8a81('0x1'));var path=require(_0x8a81('0x2'));var timeout=require(_0x8a81('0x3'));var express=require(_0x8a81('0x4'));var router=express['Router']();var fs_extra=require(_0x8a81('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8a81('0x6'));var config=require(_0x8a81('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x8a81('0x8')]('/',auth[_0x8a81('0x9')](),controller[_0x8a81('0xa')]);router[_0x8a81('0x8')](_0x8a81('0xb'),auth[_0x8a81('0x9')](),controller['show']);router[_0x8a81('0x8')](_0x8a81('0xc'),auth[_0x8a81('0x9')](),controller[_0x8a81('0xd')]);router[_0x8a81('0x8')](_0x8a81('0xe'),auth[_0x8a81('0x9')](),controller[_0x8a81('0xf')]);router[_0x8a81('0x8')](_0x8a81('0x10'),auth[_0x8a81('0x9')](),controller[_0x8a81('0x11')]);router[_0x8a81('0x12')]('/',auth[_0x8a81('0x9')](),controller[_0x8a81('0x13')]);router['put'](_0x8a81('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8a81('0x14')](_0x8a81('0xb'),auth[_0x8a81('0x9')](),controller['destroy']);module[_0x8a81('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 60cebcc..6d80627 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 _0x5790=['STRING','sequelize','exports'];(function(_0x47f2c5,_0x40c84b){var _0x38b405=function(_0x22c2aa){while(--_0x22c2aa){_0x47f2c5['push'](_0x47f2c5['shift']());}};_0x38b405(++_0x40c84b);}(_0x5790,0x1de));var _0x0579=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5790[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x0579('0x0'));module[_0x0579('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0579('0x2')]}}; \ No newline at end of file +var _0x031a=['STRING','sequelize','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x031a,0xbb));var _0xa031=function(_0x35498,_0x56e276){_0x35498=_0x35498-0x0;var _0x41e396=_0x031a[_0x35498];return _0x41e396;};'use strict';var Sequelize=require(_0xa031('0x0'));module[_0xa031('0x1')]={'name':{'type':Sequelize[_0xa031('0x2')]},'description':{'type':Sequelize[_0xa031('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 406b4b6..384be6d 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 _0x16d3=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','end','error','name','send','index','SugarcrmConfiguration','type','map','keys','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','destroy','getFields','findOne','SugarcrmField','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring'];(function(_0x2b38d2,_0x36fd84){var _0x3e5000=function(_0x57f2bc){while(--_0x57f2bc){_0x2b38d2['push'](_0x2b38d2['shift']());}};_0x3e5000(++_0x36fd84);}(_0x16d3,0xd6));var _0x316d=function(_0x4f1b87,_0x260834){_0x4f1b87=_0x4f1b87-0x0;var _0x74718e=_0x16d3[_0x4f1b87];return _0x74718e;};'use strict';var emlformat=require(_0x316d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x316d('0x1'));var jsonpatch=require(_0x316d('0x2'));var rp=require(_0x316d('0x3'));var moment=require(_0x316d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x316d('0x5'));var util=require('util');var path=require(_0x316d('0x6'));var sox=require(_0x316d('0x7'));var csv=require('to-csv');var ejs=require(_0x316d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x316d('0x9'));var squel=require('squel');var crypto=require(_0x316d('0xa'));var jsforce=require(_0x316d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x316d('0xc'));var querystring=require(_0x316d('0xd'));var Papa=require(_0x316d('0xe'));var Redis=require(_0x316d('0xf'));var authService=require(_0x316d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x316d('0x11'));var hardwareService=require(_0x316d('0x12'));var logger=require(_0x316d('0x13'))(_0x316d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x316d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25e8a9,_0x2a5c62){_0x2a5c62=_0x2a5c62||0xcc;return function(_0x5d10f8){if(_0x5d10f8){return _0x25e8a9[_0x316d('0x16')](_0x2a5c62);}return _0x25e8a9[_0x316d('0x17')](_0x2a5c62)['end']();};}function respondWithResult(_0x28745a,_0x842fa4){_0x842fa4=_0x842fa4||0xc8;return function(_0x1d48bc){if(_0x1d48bc){return _0x28745a[_0x316d('0x17')](_0x842fa4)[_0x316d('0x18')](_0x1d48bc);}};}function respondWithFilteredResult(_0x410da9,_0x3801da){return function(_0x326e66){if(_0x326e66){var _0x4ce987=typeof _0x3801da['offset']===_0x316d('0x19')&&typeof _0x3801da[_0x316d('0x1a')]===_0x316d('0x19');var _0x32a936=_0x326e66[_0x316d('0x1b')];var _0x5cddad=_0x4ce987?0x0:_0x3801da[_0x316d('0x1c')];var _0x284759=_0x4ce987?_0x326e66[_0x316d('0x1b')]:_0x3801da[_0x316d('0x1c')]+_0x3801da[_0x316d('0x1a')];var _0x55b13c;if(_0x284759>=_0x32a936){_0x284759=_0x32a936;_0x55b13c=0xc8;}else{_0x55b13c=0xce;}_0x410da9[_0x316d('0x17')](_0x55b13c);return _0x410da9[_0x316d('0x1d')](_0x316d('0x1e'),_0x5cddad+'-'+_0x284759+'/'+_0x32a936)['json'](_0x326e66);}return null;};}function patchUpdates(_0x243683){return function(_0x5a02dc){try{jsonpatch[_0x316d('0x1f')](_0x5a02dc,_0x243683,!![]);}catch(_0x165286){return BPromise['reject'](_0x165286);}return _0x5a02dc[_0x316d('0x20')]();};}function saveUpdates(_0x50af52,_0x15db91){return function(_0x3c5266){if(_0x3c5266){return _0x3c5266[_0x316d('0x21')](_0x50af52)[_0x316d('0x22')](function(_0xa93726){return _0xa93726;});}return null;};}function removeEntity(_0x385152,_0x253b73){return function(_0x260f08){if(_0x260f08){return _0x260f08['destroy']()['then'](function(){_0x385152[_0x316d('0x17')](0xcc)[_0x316d('0x23')]();});}};}function handleEntityNotFound(_0x2948ed,_0x56cae7){return function(_0x32eb0f){if(!_0x32eb0f){_0x2948ed['sendStatus'](0x194);}return _0x32eb0f;};}function handleError(_0x56082a,_0x4a8eea){_0x4a8eea=_0x4a8eea||0x1f4;return function(_0x426927){logger[_0x316d('0x24')](_0x426927['stack']);if(_0x426927[_0x316d('0x25')]){delete _0x426927[_0x316d('0x25')];}_0x56082a[_0x316d('0x17')](_0x4a8eea)[_0x316d('0x26')](_0x426927);};}exports[_0x316d('0x27')]=function(_0x4d157a,_0x17feaf){var _0x3da393={},_0x1a554d={},_0x5e697={'count':0x0,'rows':[]};var _0x52c731=_['map'](db[_0x316d('0x28')]['rawAttributes'],function(_0x3e61e6){return{'name':_0x3e61e6['fieldName'],'type':_0x3e61e6[_0x316d('0x29')]['key']};});_0x1a554d['model']=_[_0x316d('0x2a')](_0x52c731,_0x316d('0x25'));_0x1a554d['query']=_[_0x316d('0x2b')](_0x4d157a[_0x316d('0x2c')]);_0x1a554d[_0x316d('0x2d')]=_['intersection'](_0x1a554d[_0x316d('0x2e')],_0x1a554d[_0x316d('0x2c')]);_0x3da393['attributes']=_[_0x316d('0x2f')](_0x1a554d['model'],qs[_0x316d('0x30')](_0x4d157a[_0x316d('0x2c')][_0x316d('0x30')]));_0x3da393['attributes']=_0x3da393[_0x316d('0x31')][_0x316d('0x32')]?_0x3da393[_0x316d('0x31')]:_0x1a554d[_0x316d('0x2e')];if(!_0x4d157a[_0x316d('0x2c')]['hasOwnProperty'](_0x316d('0x33'))){_0x3da393[_0x316d('0x1a')]=qs[_0x316d('0x1a')](_0x4d157a[_0x316d('0x2c')][_0x316d('0x1a')]);_0x3da393[_0x316d('0x1c')]=qs[_0x316d('0x1c')](_0x4d157a[_0x316d('0x2c')][_0x316d('0x1c')]);}_0x3da393[_0x316d('0x34')]=qs[_0x316d('0x35')](_0x4d157a[_0x316d('0x2c')]['sort']);_0x3da393[_0x316d('0x36')]=qs[_0x316d('0x2d')](_[_0x316d('0x37')](_0x4d157a[_0x316d('0x2c')],_0x1a554d[_0x316d('0x2d')]),_0x52c731);if(_0x4d157a['query'][_0x316d('0x38')]){_0x3da393[_0x316d('0x36')]=_[_0x316d('0x39')](_0x3da393[_0x316d('0x36')],{'$or':_['map'](_0x52c731,function(_0x1854fd){if(_0x1854fd['type']!=='VIRTUAL'){var _0x4e5645={};_0x4e5645[_0x1854fd[_0x316d('0x25')]]={'$like':'%'+_0x4d157a[_0x316d('0x2c')][_0x316d('0x38')]+'%'};return _0x4e5645;}})});}_0x3da393=_['merge']({},_0x3da393,_0x4d157a[_0x316d('0x3a')]);var _0x2242ba={'where':_0x3da393[_0x316d('0x36')]};return db[_0x316d('0x28')][_0x316d('0x1b')](_0x2242ba)['then'](function(_0x5a1119){_0x5e697[_0x316d('0x1b')]=_0x5a1119;if(_0x4d157a[_0x316d('0x2c')][_0x316d('0x3b')]){_0x3da393['include']=[{'all':!![]}];}return db[_0x316d('0x28')][_0x316d('0x3c')](_0x3da393);})[_0x316d('0x22')](function(_0x169660){_0x5e697['rows']=_0x169660;return _0x5e697;})[_0x316d('0x22')](respondWithFilteredResult(_0x17feaf,_0x3da393))[_0x316d('0x3d')](handleError(_0x17feaf,null));};exports[_0x316d('0x3e')]=function(_0x226dd7,_0x1c294b){var _0x572571={'raw':![],'where':{'id':_0x226dd7[_0x316d('0x3f')]['id']}},_0x459391={};_0x459391['model']=_[_0x316d('0x2b')](db[_0x316d('0x28')][_0x316d('0x40')]);_0x459391[_0x316d('0x2c')]=_[_0x316d('0x2b')](_0x226dd7[_0x316d('0x2c')]);_0x459391[_0x316d('0x2d')]=_['intersection'](_0x459391[_0x316d('0x2e')],_0x459391['query']);_0x572571[_0x316d('0x31')]=_[_0x316d('0x2f')](_0x459391[_0x316d('0x2e')],qs[_0x316d('0x30')](_0x226dd7['query'][_0x316d('0x30')]));_0x572571[_0x316d('0x31')]=_0x572571[_0x316d('0x31')][_0x316d('0x32')]?_0x572571['attributes']:_0x459391[_0x316d('0x2e')];if(_0x226dd7[_0x316d('0x2c')][_0x316d('0x3b')]){_0x572571[_0x316d('0x41')]=[{'all':!![]}];}_0x572571=_[_0x316d('0x39')]({},_0x572571,_0x226dd7[_0x316d('0x3a')]);return db[_0x316d('0x28')][_0x316d('0x42')](_0x572571)[_0x316d('0x22')](handleEntityNotFound(_0x1c294b,null))[_0x316d('0x22')](respondWithResult(_0x1c294b,null))[_0x316d('0x3d')](handleError(_0x1c294b,null));};exports[_0x316d('0x43')]=function(_0x2f1c30,_0x35eebf){return db[_0x316d('0x28')][_0x316d('0x43')](_0x2f1c30[_0x316d('0x44')],{})[_0x316d('0x22')](respondWithResult(_0x35eebf,0xc9))[_0x316d('0x3d')](handleError(_0x35eebf,null));};exports[_0x316d('0x21')]=function(_0x3bba68,_0x499c1f){if(_0x3bba68[_0x316d('0x44')]['id']){delete _0x3bba68[_0x316d('0x44')]['id'];}return db[_0x316d('0x28')]['find']({'where':{'id':_0x3bba68[_0x316d('0x3f')]['id']}})[_0x316d('0x22')](handleEntityNotFound(_0x499c1f,null))[_0x316d('0x22')](saveUpdates(_0x3bba68['body'],null))[_0x316d('0x22')](respondWithResult(_0x499c1f,null))[_0x316d('0x3d')](handleError(_0x499c1f,null));};exports[_0x316d('0x45')]=function(_0x3e749c,_0x345885){return db[_0x316d('0x28')][_0x316d('0x42')]({'where':{'id':_0x3e749c[_0x316d('0x3f')]['id']}})[_0x316d('0x22')](handleEntityNotFound(_0x345885,null))[_0x316d('0x22')](removeEntity(_0x345885,null))[_0x316d('0x3d')](handleError(_0x345885,null));};exports[_0x316d('0x46')]=function(_0x4950f2,_0x23eb91,_0x19a630){var _0x2d7232={};var _0x2d81f0={};var _0x570435;var _0x3cbf8d;return db[_0x316d('0x28')][_0x316d('0x47')]({'where':{'id':_0x4950f2[_0x316d('0x3f')]['id']}})[_0x316d('0x22')](handleEntityNotFound(_0x23eb91,null))[_0x316d('0x22')](function(_0x1d11dc){if(_0x1d11dc){_0x570435=_0x1d11dc;_0x2d81f0[_0x316d('0x2e')]=_[_0x316d('0x2b')](db[_0x316d('0x48')][_0x316d('0x40')]);_0x2d81f0[_0x316d('0x2c')]=_[_0x316d('0x2b')](_0x4950f2[_0x316d('0x2c')]);_0x2d81f0['filters']=_[_0x316d('0x2f')](_0x2d81f0[_0x316d('0x2e')],_0x2d81f0[_0x316d('0x2c')]);_0x2d7232[_0x316d('0x31')]=_['intersection'](_0x2d81f0[_0x316d('0x2e')],qs[_0x316d('0x30')](_0x4950f2[_0x316d('0x2c')][_0x316d('0x30')]));_0x2d7232[_0x316d('0x31')]=_0x2d7232[_0x316d('0x31')][_0x316d('0x32')]?_0x2d7232[_0x316d('0x31')]:_0x2d81f0['model'];_0x2d7232['order']=qs[_0x316d('0x35')](_0x4950f2['query'][_0x316d('0x35')]);_0x2d7232['where']=qs['filters'](_[_0x316d('0x37')](_0x4950f2[_0x316d('0x2c')],_0x2d81f0[_0x316d('0x2d')]));if(_0x4950f2[_0x316d('0x2c')]['filter']){_0x2d7232[_0x316d('0x36')]=_[_0x316d('0x39')](_0x2d7232['where'],{'$or':_[_0x316d('0x2a')](_0x2d7232[_0x316d('0x31')],function(_0x5062b8){var _0x26e574={};_0x26e574[_0x5062b8]={'$like':'%'+_0x4950f2[_0x316d('0x2c')][_0x316d('0x38')]+'%'};return _0x26e574;})});}_0x2d7232=_[_0x316d('0x39')]({},_0x2d7232,_0x4950f2[_0x316d('0x3a')]);return _0x570435['getFields'](_0x2d7232);}})[_0x316d('0x22')](function(_0x48685b){if(_0x48685b){_0x3cbf8d=_0x48685b[_0x316d('0x32')];if(!_0x4950f2['query']['hasOwnProperty'](_0x316d('0x33'))){_0x2d7232['limit']=qs[_0x316d('0x1a')](_0x4950f2[_0x316d('0x2c')][_0x316d('0x1a')]);_0x2d7232[_0x316d('0x1c')]=qs[_0x316d('0x1c')](_0x4950f2[_0x316d('0x2c')][_0x316d('0x1c')]);}return _0x570435[_0x316d('0x46')](_0x2d7232);}})[_0x316d('0x22')](function(_0x29d8ee){if(_0x29d8ee){return _0x29d8ee?{'count':_0x3cbf8d,'rows':_0x29d8ee}:null;}})[_0x316d('0x22')](respondWithResult(_0x23eb91,null))[_0x316d('0x3d')](handleError(_0x23eb91,null));};exports[_0x316d('0x49')]=function(_0x5f2ae8,_0x5301c5,_0x68444b){var _0x73feb1={};var _0x4c7e77={};var _0x5a1ab6;var _0x42069a;return db[_0x316d('0x28')][_0x316d('0x47')]({'where':{'id':_0x5f2ae8[_0x316d('0x3f')]['id']}})[_0x316d('0x22')](handleEntityNotFound(_0x5301c5,null))['then'](function(_0x13952c){if(_0x13952c){_0x5a1ab6=_0x13952c;_0x4c7e77[_0x316d('0x2e')]=_[_0x316d('0x2b')](db[_0x316d('0x48')][_0x316d('0x40')]);_0x4c7e77['query']=_[_0x316d('0x2b')](_0x5f2ae8['query']);_0x4c7e77['filters']=_[_0x316d('0x2f')](_0x4c7e77[_0x316d('0x2e')],_0x4c7e77[_0x316d('0x2c')]);_0x73feb1[_0x316d('0x31')]=_['intersection'](_0x4c7e77[_0x316d('0x2e')],qs[_0x316d('0x30')](_0x5f2ae8[_0x316d('0x2c')][_0x316d('0x30')]));_0x73feb1[_0x316d('0x31')]=_0x73feb1[_0x316d('0x31')][_0x316d('0x32')]?_0x73feb1[_0x316d('0x31')]:_0x4c7e77[_0x316d('0x2e')];_0x73feb1[_0x316d('0x34')]=qs[_0x316d('0x35')](_0x5f2ae8['query'][_0x316d('0x35')]);_0x73feb1[_0x316d('0x36')]=qs[_0x316d('0x2d')](_[_0x316d('0x37')](_0x5f2ae8[_0x316d('0x2c')],_0x4c7e77[_0x316d('0x2d')]));if(_0x5f2ae8[_0x316d('0x2c')][_0x316d('0x38')]){_0x73feb1['where']=_['merge'](_0x73feb1[_0x316d('0x36')],{'$or':_[_0x316d('0x2a')](_0x73feb1[_0x316d('0x31')],function(_0x24c1eb){var _0x2d370d={};_0x2d370d[_0x24c1eb]={'$like':'%'+_0x5f2ae8['query'][_0x316d('0x38')]+'%'};return _0x2d370d;})});}_0x73feb1=_[_0x316d('0x39')]({},_0x73feb1,_0x5f2ae8[_0x316d('0x3a')]);return _0x5a1ab6[_0x316d('0x49')](_0x73feb1);}})[_0x316d('0x22')](function(_0x3f966f){if(_0x3f966f){_0x42069a=_0x3f966f[_0x316d('0x32')];if(!_0x5f2ae8[_0x316d('0x2c')][_0x316d('0x4a')](_0x316d('0x33'))){_0x73feb1[_0x316d('0x1a')]=qs[_0x316d('0x1a')](_0x5f2ae8['query'][_0x316d('0x1a')]);_0x73feb1['offset']=qs['offset'](_0x5f2ae8['query']['offset']);}return _0x5a1ab6[_0x316d('0x49')](_0x73feb1);}})['then'](function(_0xf4469){if(_0xf4469){return _0xf4469?{'count':_0x42069a,'rows':_0xf4469}:null;}})[_0x316d('0x22')](respondWithResult(_0x5301c5,null))[_0x316d('0x3d')](handleError(_0x5301c5,null));};exports[_0x316d('0x4b')]=function(_0x366b80,_0x2c4a03,_0x49d0c1){var _0x3d9304={};var _0x2c9ec8={};var _0xdb3bdb;var _0xf6dbd9;return db[_0x316d('0x28')][_0x316d('0x47')]({'where':{'id':_0x366b80[_0x316d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c4a03,null))[_0x316d('0x22')](function(_0x52b330){if(_0x52b330){_0xdb3bdb=_0x52b330;_0x2c9ec8[_0x316d('0x2e')]=_[_0x316d('0x2b')](db[_0x316d('0x48')][_0x316d('0x40')]);_0x2c9ec8[_0x316d('0x2c')]=_[_0x316d('0x2b')](_0x366b80[_0x316d('0x2c')]);_0x2c9ec8['filters']=_[_0x316d('0x2f')](_0x2c9ec8[_0x316d('0x2e')],_0x2c9ec8[_0x316d('0x2c')]);_0x3d9304[_0x316d('0x31')]=_[_0x316d('0x2f')](_0x2c9ec8[_0x316d('0x2e')],qs[_0x316d('0x30')](_0x366b80[_0x316d('0x2c')][_0x316d('0x30')]));_0x3d9304[_0x316d('0x31')]=_0x3d9304[_0x316d('0x31')][_0x316d('0x32')]?_0x3d9304[_0x316d('0x31')]:_0x2c9ec8[_0x316d('0x2e')];_0x3d9304['order']=qs['sort'](_0x366b80[_0x316d('0x2c')][_0x316d('0x35')]);_0x3d9304[_0x316d('0x36')]=qs[_0x316d('0x2d')](_['pick'](_0x366b80[_0x316d('0x2c')],_0x2c9ec8[_0x316d('0x2d')]));if(_0x366b80[_0x316d('0x2c')][_0x316d('0x38')]){_0x3d9304['where']=_[_0x316d('0x39')](_0x3d9304['where'],{'$or':_[_0x316d('0x2a')](_0x3d9304[_0x316d('0x31')],function(_0x855af3){var _0x199a78={};_0x199a78[_0x855af3]={'$like':'%'+_0x366b80[_0x316d('0x2c')][_0x316d('0x38')]+'%'};return _0x199a78;})});}_0x3d9304=_[_0x316d('0x39')]({},_0x3d9304,_0x366b80['options']);return _0xdb3bdb[_0x316d('0x4b')](_0x3d9304);}})[_0x316d('0x22')](function(_0x364b35){if(_0x364b35){_0xf6dbd9=_0x364b35[_0x316d('0x32')];if(!_0x366b80[_0x316d('0x2c')][_0x316d('0x4a')](_0x316d('0x33'))){_0x3d9304['limit']=qs[_0x316d('0x1a')](_0x366b80[_0x316d('0x2c')]['limit']);_0x3d9304[_0x316d('0x1c')]=qs[_0x316d('0x1c')](_0x366b80[_0x316d('0x2c')][_0x316d('0x1c')]);}return _0xdb3bdb[_0x316d('0x4b')](_0x3d9304);}})[_0x316d('0x22')](function(_0x4bbad8){if(_0x4bbad8){return _0x4bbad8?{'count':_0xf6dbd9,'rows':_0x4bbad8}:null;}})['then'](respondWithResult(_0x2c4a03,null))['catch'](handleError(_0x2c4a03,null));}; \ No newline at end of file +var _0xd712=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','offset','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x418a4d,_0x5113db){var _0x21d1ef=function(_0x27be01){while(--_0x27be01){_0x418a4d['push'](_0x418a4d['shift']());}};_0x21d1ef(++_0x5113db);}(_0xd712,0x19a));var _0x2d71=function(_0x2e79d8,_0x14c151){_0x2e79d8=_0x2e79d8-0x0;var _0x274288=_0xd712[_0x2e79d8];return _0x274288;};'use strict';var emlformat=require(_0x2d71('0x0'));var rimraf=require(_0x2d71('0x1'));var zipdir=require(_0x2d71('0x2'));var jsonpatch=require(_0x2d71('0x3'));var rp=require(_0x2d71('0x4'));var moment=require(_0x2d71('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2d71('0x6'));var util=require(_0x2d71('0x7'));var path=require(_0x2d71('0x8'));var sox=require(_0x2d71('0x9'));var csv=require(_0x2d71('0xa'));var ejs=require(_0x2d71('0xb'));var fs=require('fs');var fs_extra=require(_0x2d71('0xc'));var _=require(_0x2d71('0xd'));var squel=require(_0x2d71('0xe'));var crypto=require(_0x2d71('0xf'));var jsforce=require(_0x2d71('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2d71('0xa'));var querystring=require(_0x2d71('0x11'));var Papa=require(_0x2d71('0x12'));var Redis=require(_0x2d71('0x13'));var authService=require(_0x2d71('0x14'));var qs=require(_0x2d71('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d71('0x16'))('api');var utils=require(_0x2d71('0x17'));var config=require(_0x2d71('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d71('0x19'))['db'];function respondWithStatusCode(_0x105089,_0x2986be){_0x2986be=_0x2986be||0xcc;return function(_0x53dfc2){if(_0x53dfc2){return _0x105089[_0x2d71('0x1a')](_0x2986be);}return _0x105089[_0x2d71('0x1b')](_0x2986be)[_0x2d71('0x1c')]();};}function respondWithResult(_0xe58115,_0x4c0d02){_0x4c0d02=_0x4c0d02||0xc8;return function(_0xf4a0c){if(_0xf4a0c){return _0xe58115[_0x2d71('0x1b')](_0x4c0d02)[_0x2d71('0x1d')](_0xf4a0c);}};}function respondWithFilteredResult(_0x2cbe6c,_0x3b61bc){return function(_0x5b4771){if(_0x5b4771){var _0x3f5e4c=typeof _0x3b61bc['offset']===_0x2d71('0x1e')&&typeof _0x3b61bc[_0x2d71('0x1f')]===_0x2d71('0x1e');var _0x37f39c=_0x5b4771[_0x2d71('0x20')];var _0x5a241e=_0x3f5e4c?0x0:_0x3b61bc['offset'];var _0x3dc8bc=_0x3f5e4c?_0x5b4771[_0x2d71('0x20')]:_0x3b61bc['offset']+_0x3b61bc[_0x2d71('0x1f')];var _0x47785f;if(_0x3dc8bc>=_0x37f39c){_0x3dc8bc=_0x37f39c;_0x47785f=0xc8;}else{_0x47785f=0xce;}_0x2cbe6c['status'](_0x47785f);return _0x2cbe6c[_0x2d71('0x21')](_0x2d71('0x22'),_0x5a241e+'-'+_0x3dc8bc+'/'+_0x37f39c)[_0x2d71('0x1d')](_0x5b4771);}return null;};}function patchUpdates(_0x3ab7e9){return function(_0x1be0eb){try{jsonpatch[_0x2d71('0x23')](_0x1be0eb,_0x3ab7e9,!![]);}catch(_0x404338){return BPromise[_0x2d71('0x24')](_0x404338);}return _0x1be0eb['save']();};}function saveUpdates(_0x96f13b,_0x681cdd){return function(_0x299c91){if(_0x299c91){return _0x299c91[_0x2d71('0x25')](_0x96f13b)[_0x2d71('0x26')](function(_0x38d7bb){return _0x38d7bb;});}return null;};}function removeEntity(_0x4da0d1,_0x3cb120){return function(_0x424a09){if(_0x424a09){return _0x424a09[_0x2d71('0x27')]()['then'](function(){_0x4da0d1[_0x2d71('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x168e58,_0xcfcb65){return function(_0x239a08){if(!_0x239a08){_0x168e58['sendStatus'](0x194);}return _0x239a08;};}function handleError(_0x5b9817,_0x44ed11){_0x44ed11=_0x44ed11||0x1f4;return function(_0x51ce4e){logger[_0x2d71('0x28')](_0x51ce4e[_0x2d71('0x29')]);if(_0x51ce4e[_0x2d71('0x2a')]){delete _0x51ce4e['name'];}_0x5b9817['status'](_0x44ed11)[_0x2d71('0x2b')](_0x51ce4e);};}exports[_0x2d71('0x2c')]=function(_0x66ca3d,_0x59a2c2){var _0xdfd70d={},_0x27d110={},_0x4f23cf={'count':0x0,'rows':[]};var _0x26c6e1=_[_0x2d71('0x2d')](db[_0x2d71('0x2e')][_0x2d71('0x2f')],function(_0x3255c3){return{'name':_0x3255c3[_0x2d71('0x30')],'type':_0x3255c3['type'][_0x2d71('0x31')]};});_0x27d110[_0x2d71('0x32')]=_[_0x2d71('0x2d')](_0x26c6e1,_0x2d71('0x2a'));_0x27d110['query']=_[_0x2d71('0x33')](_0x66ca3d[_0x2d71('0x34')]);_0x27d110[_0x2d71('0x35')]=_[_0x2d71('0x36')](_0x27d110[_0x2d71('0x32')],_0x27d110[_0x2d71('0x34')]);_0xdfd70d[_0x2d71('0x37')]=_['intersection'](_0x27d110[_0x2d71('0x32')],qs[_0x2d71('0x38')](_0x66ca3d['query'][_0x2d71('0x38')]));_0xdfd70d['attributes']=_0xdfd70d[_0x2d71('0x37')]['length']?_0xdfd70d['attributes']:_0x27d110[_0x2d71('0x32')];if(!_0x66ca3d[_0x2d71('0x34')]['hasOwnProperty'](_0x2d71('0x39'))){_0xdfd70d[_0x2d71('0x1f')]=qs[_0x2d71('0x1f')](_0x66ca3d[_0x2d71('0x34')]['limit']);_0xdfd70d[_0x2d71('0x3a')]=qs[_0x2d71('0x3a')](_0x66ca3d['query'][_0x2d71('0x3a')]);}_0xdfd70d['order']=qs[_0x2d71('0x3b')](_0x66ca3d[_0x2d71('0x34')][_0x2d71('0x3b')]);_0xdfd70d[_0x2d71('0x3c')]=qs[_0x2d71('0x35')](_[_0x2d71('0x3d')](_0x66ca3d[_0x2d71('0x34')],_0x27d110['filters']),_0x26c6e1);if(_0x66ca3d[_0x2d71('0x34')][_0x2d71('0x3e')]){_0xdfd70d[_0x2d71('0x3c')]=_['merge'](_0xdfd70d[_0x2d71('0x3c')],{'$or':_[_0x2d71('0x2d')](_0x26c6e1,function(_0x247714){if(_0x247714[_0x2d71('0x3f')]!==_0x2d71('0x40')){var _0x55d8cc={};_0x55d8cc[_0x247714[_0x2d71('0x2a')]]={'$like':'%'+_0x66ca3d['query'][_0x2d71('0x3e')]+'%'};return _0x55d8cc;}})});}_0xdfd70d=_[_0x2d71('0x41')]({},_0xdfd70d,_0x66ca3d[_0x2d71('0x42')]);var _0x5ab07a={'where':_0xdfd70d['where']};return db[_0x2d71('0x2e')]['count'](_0x5ab07a)['then'](function(_0x49cd05){_0x4f23cf[_0x2d71('0x20')]=_0x49cd05;if(_0x66ca3d[_0x2d71('0x34')][_0x2d71('0x43')]){_0xdfd70d[_0x2d71('0x44')]=[{'all':!![]}];}return db[_0x2d71('0x2e')][_0x2d71('0x45')](_0xdfd70d);})[_0x2d71('0x26')](function(_0x9b561d){_0x4f23cf['rows']=_0x9b561d;return _0x4f23cf;})[_0x2d71('0x26')](respondWithFilteredResult(_0x59a2c2,_0xdfd70d))[_0x2d71('0x46')](handleError(_0x59a2c2,null));};exports[_0x2d71('0x47')]=function(_0x5dc73d,_0x3426f1){var _0x2d7144={'raw':![],'where':{'id':_0x5dc73d[_0x2d71('0x48')]['id']}},_0x664f5a={};_0x664f5a[_0x2d71('0x32')]=_[_0x2d71('0x33')](db[_0x2d71('0x2e')][_0x2d71('0x2f')]);_0x664f5a[_0x2d71('0x34')]=_[_0x2d71('0x33')](_0x5dc73d[_0x2d71('0x34')]);_0x664f5a[_0x2d71('0x35')]=_[_0x2d71('0x36')](_0x664f5a['model'],_0x664f5a['query']);_0x2d7144[_0x2d71('0x37')]=_['intersection'](_0x664f5a['model'],qs[_0x2d71('0x38')](_0x5dc73d[_0x2d71('0x34')][_0x2d71('0x38')]));_0x2d7144[_0x2d71('0x37')]=_0x2d7144[_0x2d71('0x37')][_0x2d71('0x49')]?_0x2d7144[_0x2d71('0x37')]:_0x664f5a[_0x2d71('0x32')];if(_0x5dc73d[_0x2d71('0x34')][_0x2d71('0x43')]){_0x2d7144[_0x2d71('0x44')]=[{'all':!![]}];}_0x2d7144=_[_0x2d71('0x41')]({},_0x2d7144,_0x5dc73d['options']);return db[_0x2d71('0x2e')][_0x2d71('0x4a')](_0x2d7144)[_0x2d71('0x26')](handleEntityNotFound(_0x3426f1,null))['then'](respondWithResult(_0x3426f1,null))[_0x2d71('0x46')](handleError(_0x3426f1,null));};exports[_0x2d71('0x4b')]=function(_0x23471a,_0x41a3b2){return db[_0x2d71('0x2e')][_0x2d71('0x4b')](_0x23471a[_0x2d71('0x4c')],{})['then'](respondWithResult(_0x41a3b2,0xc9))[_0x2d71('0x46')](handleError(_0x41a3b2,null));};exports[_0x2d71('0x25')]=function(_0x4cc028,_0x3473b0){if(_0x4cc028['body']['id']){delete _0x4cc028[_0x2d71('0x4c')]['id'];}return db[_0x2d71('0x2e')][_0x2d71('0x4a')]({'where':{'id':_0x4cc028[_0x2d71('0x48')]['id']}})[_0x2d71('0x26')](handleEntityNotFound(_0x3473b0,null))[_0x2d71('0x26')](saveUpdates(_0x4cc028[_0x2d71('0x4c')],null))[_0x2d71('0x26')](respondWithResult(_0x3473b0,null))[_0x2d71('0x46')](handleError(_0x3473b0,null));};exports[_0x2d71('0x27')]=function(_0x1adcd5,_0x37d28e){return db[_0x2d71('0x2e')][_0x2d71('0x4a')]({'where':{'id':_0x1adcd5['params']['id']}})[_0x2d71('0x26')](handleEntityNotFound(_0x37d28e,null))[_0x2d71('0x26')](removeEntity(_0x37d28e,null))[_0x2d71('0x46')](handleError(_0x37d28e,null));};exports[_0x2d71('0x4d')]=function(_0x3ece14,_0x311876,_0x285144){var _0x118a7f={};var _0x1a57d9={};var _0x3f3e01;var _0x334b8c;return db[_0x2d71('0x2e')][_0x2d71('0x4e')]({'where':{'id':_0x3ece14[_0x2d71('0x48')]['id']}})[_0x2d71('0x26')](handleEntityNotFound(_0x311876,null))[_0x2d71('0x26')](function(_0x35eac4){if(_0x35eac4){_0x3f3e01=_0x35eac4;_0x1a57d9[_0x2d71('0x32')]=_[_0x2d71('0x33')](db[_0x2d71('0x4f')][_0x2d71('0x2f')]);_0x1a57d9[_0x2d71('0x34')]=_[_0x2d71('0x33')](_0x3ece14[_0x2d71('0x34')]);_0x1a57d9[_0x2d71('0x35')]=_['intersection'](_0x1a57d9[_0x2d71('0x32')],_0x1a57d9[_0x2d71('0x34')]);_0x118a7f[_0x2d71('0x37')]=_[_0x2d71('0x36')](_0x1a57d9[_0x2d71('0x32')],qs[_0x2d71('0x38')](_0x3ece14[_0x2d71('0x34')][_0x2d71('0x38')]));_0x118a7f[_0x2d71('0x37')]=_0x118a7f[_0x2d71('0x37')][_0x2d71('0x49')]?_0x118a7f[_0x2d71('0x37')]:_0x1a57d9[_0x2d71('0x32')];_0x118a7f['order']=qs['sort'](_0x3ece14[_0x2d71('0x34')][_0x2d71('0x3b')]);_0x118a7f[_0x2d71('0x3c')]=qs[_0x2d71('0x35')](_[_0x2d71('0x3d')](_0x3ece14[_0x2d71('0x34')],_0x1a57d9[_0x2d71('0x35')]));if(_0x3ece14['query'][_0x2d71('0x3e')]){_0x118a7f[_0x2d71('0x3c')]=_[_0x2d71('0x41')](_0x118a7f[_0x2d71('0x3c')],{'$or':_[_0x2d71('0x2d')](_0x118a7f[_0x2d71('0x37')],function(_0xbf1cf4){var _0x458c95={};_0x458c95[_0xbf1cf4]={'$like':'%'+_0x3ece14['query']['filter']+'%'};return _0x458c95;})});}_0x118a7f=_[_0x2d71('0x41')]({},_0x118a7f,_0x3ece14['options']);return _0x3f3e01[_0x2d71('0x4d')](_0x118a7f);}})['then'](function(_0x30dc9b){if(_0x30dc9b){_0x334b8c=_0x30dc9b['length'];if(!_0x3ece14[_0x2d71('0x34')][_0x2d71('0x50')]('nolimit')){_0x118a7f[_0x2d71('0x1f')]=qs[_0x2d71('0x1f')](_0x3ece14['query'][_0x2d71('0x1f')]);_0x118a7f[_0x2d71('0x3a')]=qs[_0x2d71('0x3a')](_0x3ece14['query'][_0x2d71('0x3a')]);}return _0x3f3e01[_0x2d71('0x4d')](_0x118a7f);}})[_0x2d71('0x26')](function(_0x2e4e23){if(_0x2e4e23){return _0x2e4e23?{'count':_0x334b8c,'rows':_0x2e4e23}:null;}})[_0x2d71('0x26')](respondWithResult(_0x311876,null))[_0x2d71('0x46')](handleError(_0x311876,null));};exports[_0x2d71('0x51')]=function(_0x52b176,_0x3be743,_0x241c82){var _0x1ea2ed={};var _0x1fe2da={};var _0x5a22b1;var _0x3ffa32;return db[_0x2d71('0x2e')]['findOne']({'where':{'id':_0x52b176[_0x2d71('0x48')]['id']}})[_0x2d71('0x26')](handleEntityNotFound(_0x3be743,null))['then'](function(_0x592647){if(_0x592647){_0x5a22b1=_0x592647;_0x1fe2da['model']=_[_0x2d71('0x33')](db['SugarcrmField']['rawAttributes']);_0x1fe2da[_0x2d71('0x34')]=_[_0x2d71('0x33')](_0x52b176['query']);_0x1fe2da[_0x2d71('0x35')]=_[_0x2d71('0x36')](_0x1fe2da['model'],_0x1fe2da[_0x2d71('0x34')]);_0x1ea2ed[_0x2d71('0x37')]=_['intersection'](_0x1fe2da[_0x2d71('0x32')],qs[_0x2d71('0x38')](_0x52b176[_0x2d71('0x34')][_0x2d71('0x38')]));_0x1ea2ed[_0x2d71('0x37')]=_0x1ea2ed[_0x2d71('0x37')][_0x2d71('0x49')]?_0x1ea2ed[_0x2d71('0x37')]:_0x1fe2da[_0x2d71('0x32')];_0x1ea2ed[_0x2d71('0x52')]=qs[_0x2d71('0x3b')](_0x52b176[_0x2d71('0x34')][_0x2d71('0x3b')]);_0x1ea2ed[_0x2d71('0x3c')]=qs[_0x2d71('0x35')](_[_0x2d71('0x3d')](_0x52b176[_0x2d71('0x34')],_0x1fe2da['filters']));if(_0x52b176[_0x2d71('0x34')][_0x2d71('0x3e')]){_0x1ea2ed[_0x2d71('0x3c')]=_['merge'](_0x1ea2ed[_0x2d71('0x3c')],{'$or':_['map'](_0x1ea2ed[_0x2d71('0x37')],function(_0x21e68f){var _0x366a11={};_0x366a11[_0x21e68f]={'$like':'%'+_0x52b176['query'][_0x2d71('0x3e')]+'%'};return _0x366a11;})});}_0x1ea2ed=_['merge']({},_0x1ea2ed,_0x52b176[_0x2d71('0x42')]);return _0x5a22b1[_0x2d71('0x51')](_0x1ea2ed);}})[_0x2d71('0x26')](function(_0x2c1e4e){if(_0x2c1e4e){_0x3ffa32=_0x2c1e4e[_0x2d71('0x49')];if(!_0x52b176['query'][_0x2d71('0x50')](_0x2d71('0x39'))){_0x1ea2ed['limit']=qs[_0x2d71('0x1f')](_0x52b176[_0x2d71('0x34')][_0x2d71('0x1f')]);_0x1ea2ed[_0x2d71('0x3a')]=qs['offset'](_0x52b176['query']['offset']);}return _0x5a22b1[_0x2d71('0x51')](_0x1ea2ed);}})[_0x2d71('0x26')](function(_0x2023dc){if(_0x2023dc){return _0x2023dc?{'count':_0x3ffa32,'rows':_0x2023dc}:null;}})[_0x2d71('0x26')](respondWithResult(_0x3be743,null))[_0x2d71('0x46')](handleError(_0x3be743,null));};exports[_0x2d71('0x53')]=function(_0x290943,_0x563137,_0x486507){var _0x3bc609={};var _0x2c0e1a={};var _0x43c62f;var _0x439958;return db[_0x2d71('0x2e')][_0x2d71('0x4e')]({'where':{'id':_0x290943['params']['id']}})[_0x2d71('0x26')](handleEntityNotFound(_0x563137,null))[_0x2d71('0x26')](function(_0x554bf4){if(_0x554bf4){_0x43c62f=_0x554bf4;_0x2c0e1a[_0x2d71('0x32')]=_[_0x2d71('0x33')](db[_0x2d71('0x4f')]['rawAttributes']);_0x2c0e1a[_0x2d71('0x34')]=_[_0x2d71('0x33')](_0x290943[_0x2d71('0x34')]);_0x2c0e1a[_0x2d71('0x35')]=_[_0x2d71('0x36')](_0x2c0e1a['model'],_0x2c0e1a[_0x2d71('0x34')]);_0x3bc609['attributes']=_[_0x2d71('0x36')](_0x2c0e1a['model'],qs[_0x2d71('0x38')](_0x290943[_0x2d71('0x34')][_0x2d71('0x38')]));_0x3bc609[_0x2d71('0x37')]=_0x3bc609[_0x2d71('0x37')]['length']?_0x3bc609[_0x2d71('0x37')]:_0x2c0e1a[_0x2d71('0x32')];_0x3bc609['order']=qs['sort'](_0x290943['query']['sort']);_0x3bc609['where']=qs[_0x2d71('0x35')](_['pick'](_0x290943[_0x2d71('0x34')],_0x2c0e1a[_0x2d71('0x35')]));if(_0x290943[_0x2d71('0x34')][_0x2d71('0x3e')]){_0x3bc609[_0x2d71('0x3c')]=_[_0x2d71('0x41')](_0x3bc609['where'],{'$or':_['map'](_0x3bc609['attributes'],function(_0x43a74f){var _0x40f0a0={};_0x40f0a0[_0x43a74f]={'$like':'%'+_0x290943['query'][_0x2d71('0x3e')]+'%'};return _0x40f0a0;})});}_0x3bc609=_[_0x2d71('0x41')]({},_0x3bc609,_0x290943['options']);return _0x43c62f[_0x2d71('0x53')](_0x3bc609);}})['then'](function(_0x2050ac){if(_0x2050ac){_0x439958=_0x2050ac[_0x2d71('0x49')];if(!_0x290943[_0x2d71('0x34')][_0x2d71('0x50')](_0x2d71('0x39'))){_0x3bc609[_0x2d71('0x1f')]=qs['limit'](_0x290943[_0x2d71('0x34')][_0x2d71('0x1f')]);_0x3bc609[_0x2d71('0x3a')]=qs[_0x2d71('0x3a')](_0x290943[_0x2d71('0x34')][_0x2d71('0x3a')]);}return _0x43c62f['getDescriptions'](_0x3bc609);}})[_0x2d71('0x26')](function(_0xbb0804){if(_0xbb0804){return _0xbb0804?{'count':_0x439958,'rows':_0xbb0804}:null;}})[_0x2d71('0x26')](respondWithResult(_0x563137,null))[_0x2d71('0x46')](handleError(_0x563137,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index d98c0c0..7bdcf4f 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 _0xf65e=['../../config/logger','moment','bluebird','path','../../config/environment','./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations','lodash'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf65e,0x167));var _0xef65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf65e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef65('0x0'));var util=require('util');var logger=require(_0xef65('0x1'))('api');var moment=require(_0xef65('0x2'));var BPromise=require(_0xef65('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef65('0x4'));var rimraf=require('rimraf');var config=require(_0xef65('0x5'));var attributes=require(_0xef65('0x6'));module['exports']=function(_0xeb7f44,_0x35227c){return _0xeb7f44[_0xef65('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0xef65('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e2d=['api','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x2257c6,_0x266547){var _0x5b5ad9=function(_0x25d28c){while(--_0x25d28c){_0x2257c6['push'](_0x2257c6['shift']());}};_0x5b5ad9(++_0x266547);}(_0x1e2d,0x127));var _0xd1e2=function(_0x5f04b9,_0x304165){_0x5f04b9=_0x5f04b9-0x0;var _0x1bf927=_0x1e2d[_0x5f04b9];return _0x1bf927;};'use strict';var _=require('lodash');var util=require(_0xd1e2('0x0'));var logger=require(_0xd1e2('0x1'))(_0xd1e2('0x2'));var moment=require('moment');var BPromise=require(_0xd1e2('0x3'));var rp=require(_0xd1e2('0x4'));var fs=require('fs');var path=require(_0xd1e2('0x5'));var rimraf=require('rimraf');var config=require(_0xd1e2('0x6'));var attributes=require(_0xd1e2('0x7'));module['exports']=function(_0x205aeb,_0x2b14e0){return _0x205aeb[_0xd1e2('0x8')](_0xd1e2('0x9'),attributes,{'tableName':_0xd1e2('0xa'),'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 5823aa0..897667d 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 _0x8297=['../../config/utils','rpc','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0x1123bb,_0x54472a){var _0xdeb602=function(_0x529467){while(--_0x529467){_0x1123bb['push'](_0x1123bb['shift']());}};_0xdeb602(++_0x54472a);}(_0x8297,0x10b));var _0x7829=function(_0x1cc247,_0x56a0e0){_0x1cc247=_0x1cc247-0x0;var _0x4286ec=_0x8297[_0x1cc247];return _0x4286ec;};'use strict';var _=require(_0x7829('0x0'));var util=require(_0x7829('0x1'));var moment=require('moment');var BPromise=require(_0x7829('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7829('0x3'));var logger=require('../../config/logger')(_0x7829('0x4'));var config=require('../../config/environment');var jayson=require(_0x7829('0x5'));var client=jayson['client'][_0x7829('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x671c47,_0x2a8497,_0x3262cd){return new BPromise(function(_0x26623c,_0x4cec48){return client[_0x7829('0x7')](_0x671c47,_0x3262cd)[_0x7829('0x8')](function(_0x9970ee){logger[_0x7829('0x9')](_0x7829('0xa'),_0x2a8497,_0x7829('0xb'));logger['debug'](_0x7829('0xc'),_0x2a8497,_0x7829('0xb'),JSON[_0x7829('0xd')](_0x9970ee));if(_0x9970ee[_0x7829('0xe')]){if(_0x9970ee[_0x7829('0xe')][_0x7829('0xf')]===0x1f4){logger['error'](_0x7829('0xa'),_0x2a8497,_0x9970ee[_0x7829('0xe')][_0x7829('0x10')]);return _0x4cec48(_0x9970ee[_0x7829('0xe')]['message']);}logger[_0x7829('0xe')](_0x7829('0xa'),_0x2a8497,_0x9970ee['error'][_0x7829('0x10')]);return _0x26623c(_0x9970ee['error'][_0x7829('0x10')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a8497,_0x7829('0xb'));_0x26623c(_0x9970ee[_0x7829('0x11')][_0x7829('0x10')]);}})['catch'](function(_0x3e114d){logger[_0x7829('0xe')](_0x7829('0xa'),_0x2a8497,_0x3e114d);_0x4cec48(_0x3e114d);});});} \ No newline at end of file +var _0xf2cc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xf2cc,0xa0));var _0xcf2c=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xf2cc[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xcf2c('0x0'));var util=require(_0xcf2c('0x1'));var moment=require(_0xcf2c('0x2'));var BPromise=require(_0xcf2c('0x3'));var rs=require(_0xcf2c('0x4'));var fs=require('fs');var Redis=require(_0xcf2c('0x5'));var db=require(_0xcf2c('0x6'))['db'];var utils=require(_0xcf2c('0x7'));var logger=require(_0xcf2c('0x8'))(_0xcf2c('0x9'));var config=require(_0xcf2c('0xa'));var jayson=require(_0xcf2c('0xb'));var client=jayson[_0xcf2c('0xc')][_0xcf2c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xbcf5ab,_0x3754e3,_0x1f4f11){return new BPromise(function(_0x38cd55,_0x5ee578){return client['request'](_0xbcf5ab,_0x1f4f11)['then'](function(_0x5964fe){logger[_0xcf2c('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3754e3,'request\x20sent');logger[_0xcf2c('0xf')](_0xcf2c('0x10'),_0x3754e3,_0xcf2c('0x11'),JSON[_0xcf2c('0x12')](_0x5964fe));if(_0x5964fe[_0xcf2c('0x13')]){if(_0x5964fe[_0xcf2c('0x13')]['code']===0x1f4){logger[_0xcf2c('0x13')](_0xcf2c('0x14'),_0x3754e3,_0x5964fe[_0xcf2c('0x13')][_0xcf2c('0x15')]);return _0x5ee578(_0x5964fe['error'][_0xcf2c('0x15')]);}logger[_0xcf2c('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3754e3,_0x5964fe['error'][_0xcf2c('0x15')]);return _0x38cd55(_0x5964fe['error']['message']);}else{logger[_0xcf2c('0xe')](_0xcf2c('0x14'),_0x3754e3,'request\x20sent');_0x38cd55(_0x5964fe[_0xcf2c('0x16')][_0xcf2c('0x15')]);}})['catch'](function(_0x2cef64){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3754e3,_0x2cef64);_0x5ee578(_0x2cef64);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b13492c..f50c5d7 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 _0xfbde=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','create','put','/:id','delete'];(function(_0x39a9a1,_0x179ec1){var _0x131e78=function(_0x57ca0b){while(--_0x57ca0b){_0x39a9a1['push'](_0x39a9a1['shift']());}};_0x131e78(++_0x179ec1);}(_0xfbde,0xda));var _0xefbd=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xfbde[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xefbd('0x0'));var util=require(_0xefbd('0x1'));var path=require(_0xefbd('0x2'));var timeout=require(_0xefbd('0x3'));var express=require('express');var router=express[_0xefbd('0x4')]();var fs_extra=require(_0xefbd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xefbd('0x6'));var config=require(_0xefbd('0x7'));var controller=require(_0xefbd('0x8'));router[_0xefbd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xefbd('0x9')]('/:id',auth[_0xefbd('0xa')](),controller[_0xefbd('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xefbd('0xc')]);router[_0xefbd('0xd')](_0xefbd('0xe'),auth[_0xefbd('0xa')](),controller['update']);router[_0xefbd('0xf')](_0xefbd('0xe'),auth[_0xefbd('0xa')](),controller[_0xefbd('0x10')]);module[_0xefbd('0x11')]=router; \ No newline at end of file +var _0xabec=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','update','delete','destroy'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xabec,0xdd));var _0xcabe=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0xabec[_0x5cca9f];return _0x55edda;};'use strict';var multer=require(_0xcabe('0x0'));var util=require(_0xcabe('0x1'));var path=require(_0xcabe('0x2'));var timeout=require(_0xcabe('0x3'));var express=require('express');var router=express[_0xcabe('0x4')]();var fs_extra=require(_0xcabe('0x5'));var auth=require(_0xcabe('0x6'));var interaction=require(_0xcabe('0x7'));var config=require(_0xcabe('0x8'));var controller=require(_0xcabe('0x9'));router[_0xcabe('0xa')]('/',auth[_0xcabe('0xb')](),controller[_0xcabe('0xc')]);router['get']('/:id',auth[_0xcabe('0xb')](),controller[_0xcabe('0xd')]);router[_0xcabe('0xe')]('/',auth[_0xcabe('0xb')](),controller[_0xcabe('0xf')]);router['put']('/:id',auth[_0xcabe('0xb')](),controller[_0xcabe('0x10')]);router[_0xcabe('0x11')]('/:id',auth[_0xcabe('0xb')](),controller[_0xcabe('0x12')]);module[_0xcabe('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8449411..eb9af77 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 _0x9daa=['sequelize','exports','ENUM','keyValue','picklist','string','STRING','variable','customVariable','BOOLEAN'];(function(_0x4538fb,_0x1e55bb){var _0x15e3c5=function(_0x157768){while(--_0x157768){_0x4538fb['push'](_0x4538fb['shift']());}};_0x15e3c5(++_0x1e55bb);}(_0x9daa,0x12c));var _0xa9da=function(_0x1a98f3,_0x1f91ad){_0x1a98f3=_0x1a98f3-0x0;var _0x4bca43=_0x9daa[_0x1a98f3];return _0x4bca43;};'use strict';var Sequelize=require(_0xa9da('0x0'));module[_0xa9da('0x1')]={'type':{'type':Sequelize[_0xa9da('0x2')]('string','variable','customVariable',_0xa9da('0x3'),_0xa9da('0x4')),'defaultValue':_0xa9da('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa9da('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xa9da('0x7'),_0xa9da('0x8'))},'keyContent':{'type':Sequelize[_0xa9da('0x6')]},'idField':{'type':Sequelize[_0xa9da('0x6')]},'nameField':{'type':Sequelize[_0xa9da('0x6')]},'customField':{'type':Sequelize[_0xa9da('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa9da('0x6')]}}; \ No newline at end of file +var _0x1e71=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0xc57e60,_0xe3399c){var _0x5222b3=function(_0x2d9c56){while(--_0x2d9c56){_0xc57e60['push'](_0xc57e60['shift']());}};_0x5222b3(++_0xe3399c);}(_0x1e71,0x1c6));var _0x11e7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x1e71[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x11e7('0x0'));module[_0x11e7('0x1')]={'type':{'type':Sequelize[_0x11e7('0x2')](_0x11e7('0x3'),'variable',_0x11e7('0x4'),_0x11e7('0x5'),_0x11e7('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x11e7('0x7')]},'key':{'type':Sequelize[_0x11e7('0x7')]},'keyType':{'type':Sequelize[_0x11e7('0x2')]('string','variable',_0x11e7('0x4'))},'keyContent':{'type':Sequelize[_0x11e7('0x7')]},'idField':{'type':Sequelize[_0x11e7('0x7')]},'nameField':{'type':Sequelize[_0x11e7('0x7')]},'customField':{'type':Sequelize[_0x11e7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 90db04a..9f667ed 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 _0xee25=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x3590a4,_0x2eea94){var _0x17a579=function(_0x185371){while(--_0x185371){_0x3590a4['push'](_0x3590a4['shift']());}};_0x17a579(++_0x2eea94);}(_0xee25,0x7e));var _0x5ee2=function(_0x4dafb4,_0x387813){_0x4dafb4=_0x4dafb4-0x0;var _0x28e414=_0xee25[_0x4dafb4];return _0x28e414;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5ee2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ee2('0x1'));var BPromise=require(_0x5ee2('0x2'));var Mustache=require(_0x5ee2('0x3'));var util=require(_0x5ee2('0x4'));var path=require(_0x5ee2('0x5'));var sox=require('sox');var csv=require(_0x5ee2('0x6'));var ejs=require(_0x5ee2('0x7'));var fs=require('fs');var fs_extra=require(_0x5ee2('0x8'));var _=require(_0x5ee2('0x9'));var squel=require(_0x5ee2('0xa'));var crypto=require(_0x5ee2('0xb'));var jsforce=require(_0x5ee2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5ee2('0x6'));var querystring=require(_0x5ee2('0xd'));var Papa=require(_0x5ee2('0xe'));var Redis=require(_0x5ee2('0xf'));var authService=require(_0x5ee2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5ee2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ee2('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x5ee2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ee2('0x14'))['db'];function respondWithStatusCode(_0x3e2085,_0x822ce3){_0x822ce3=_0x822ce3||0xcc;return function(_0x4bd76a){if(_0x4bd76a){return _0x3e2085[_0x5ee2('0x15')](_0x822ce3);}return _0x3e2085[_0x5ee2('0x16')](_0x822ce3)[_0x5ee2('0x17')]();};}function respondWithResult(_0x1d10bd,_0x86891e){_0x86891e=_0x86891e||0xc8;return function(_0x58860f){if(_0x58860f){return _0x1d10bd['status'](_0x86891e)[_0x5ee2('0x18')](_0x58860f);}};}function respondWithFilteredResult(_0x120cdf,_0x319faf){return function(_0x11aa77){if(_0x11aa77){var _0x4a158e=typeof _0x319faf['offset']===_0x5ee2('0x19')&&typeof _0x319faf[_0x5ee2('0x1a')]===_0x5ee2('0x19');var _0x374526=_0x11aa77[_0x5ee2('0x1b')];var _0x5b9315=_0x4a158e?0x0:_0x319faf[_0x5ee2('0x1c')];var _0x3b8719=_0x4a158e?_0x11aa77[_0x5ee2('0x1b')]:_0x319faf['offset']+_0x319faf[_0x5ee2('0x1a')];var _0x47a1a1;if(_0x3b8719>=_0x374526){_0x3b8719=_0x374526;_0x47a1a1=0xc8;}else{_0x47a1a1=0xce;}_0x120cdf[_0x5ee2('0x16')](_0x47a1a1);return _0x120cdf[_0x5ee2('0x1d')]('Content-Range',_0x5b9315+'-'+_0x3b8719+'/'+_0x374526)['json'](_0x11aa77);}return null;};}function patchUpdates(_0x371d99){return function(_0x35127){try{jsonpatch['apply'](_0x35127,_0x371d99,!![]);}catch(_0x47dc37){return BPromise[_0x5ee2('0x1e')](_0x47dc37);}return _0x35127[_0x5ee2('0x1f')]();};}function saveUpdates(_0x385f45,_0x35a7d3){return function(_0x3aed33){if(_0x3aed33){return _0x3aed33[_0x5ee2('0x20')](_0x385f45)[_0x5ee2('0x21')](function(_0x25f0af){return _0x25f0af;});}return null;};}function removeEntity(_0x2f67b4,_0x45e632){return function(_0x3500b1){if(_0x3500b1){return _0x3500b1['destroy']()[_0x5ee2('0x21')](function(){_0x2f67b4[_0x5ee2('0x16')](0xcc)[_0x5ee2('0x17')]();});}};}function handleEntityNotFound(_0x4155b8,_0x519d9c){return function(_0x2fcbd5){if(!_0x2fcbd5){_0x4155b8['sendStatus'](0x194);}return _0x2fcbd5;};}function handleError(_0x5e1f5c,_0x2cbba4){_0x2cbba4=_0x2cbba4||0x1f4;return function(_0x5c92ee){logger[_0x5ee2('0x22')](_0x5c92ee[_0x5ee2('0x23')]);if(_0x5c92ee[_0x5ee2('0x24')]){delete _0x5c92ee[_0x5ee2('0x24')];}_0x5e1f5c[_0x5ee2('0x16')](_0x2cbba4)[_0x5ee2('0x25')](_0x5c92ee);};}exports[_0x5ee2('0x26')]=function(_0x770900,_0x12ac03){var _0x2cd5ed={},_0x5916dd={},_0x7202cf={'count':0x0,'rows':[]};var _0x436b7c=_['map'](db[_0x5ee2('0x27')][_0x5ee2('0x28')],function(_0x3b927a){return{'name':_0x3b927a[_0x5ee2('0x29')],'type':_0x3b927a['type']['key']};});_0x5916dd['model']=_[_0x5ee2('0x2a')](_0x436b7c,'name');_0x5916dd[_0x5ee2('0x2b')]=_[_0x5ee2('0x2c')](_0x770900[_0x5ee2('0x2b')]);_0x5916dd[_0x5ee2('0x2d')]=_[_0x5ee2('0x2e')](_0x5916dd[_0x5ee2('0x2f')],_0x5916dd[_0x5ee2('0x2b')]);_0x2cd5ed[_0x5ee2('0x30')]=_[_0x5ee2('0x2e')](_0x5916dd[_0x5ee2('0x2f')],qs[_0x5ee2('0x31')](_0x770900['query'][_0x5ee2('0x31')]));_0x2cd5ed[_0x5ee2('0x30')]=_0x2cd5ed['attributes'][_0x5ee2('0x32')]?_0x2cd5ed[_0x5ee2('0x30')]:_0x5916dd[_0x5ee2('0x2f')];if(!_0x770900[_0x5ee2('0x2b')][_0x5ee2('0x33')](_0x5ee2('0x34'))){_0x2cd5ed[_0x5ee2('0x1a')]=qs[_0x5ee2('0x1a')](_0x770900['query'][_0x5ee2('0x1a')]);_0x2cd5ed[_0x5ee2('0x1c')]=qs[_0x5ee2('0x1c')](_0x770900['query'][_0x5ee2('0x1c')]);}_0x2cd5ed['order']=qs[_0x5ee2('0x35')](_0x770900[_0x5ee2('0x2b')][_0x5ee2('0x35')]);_0x2cd5ed[_0x5ee2('0x36')]=qs[_0x5ee2('0x2d')](_[_0x5ee2('0x37')](_0x770900['query'],_0x5916dd[_0x5ee2('0x2d')]),_0x436b7c);if(_0x770900[_0x5ee2('0x2b')][_0x5ee2('0x38')]){_0x2cd5ed['where']=_[_0x5ee2('0x39')](_0x2cd5ed['where'],{'$or':_[_0x5ee2('0x2a')](_0x436b7c,function(_0x30fd23){if(_0x30fd23[_0x5ee2('0x3a')]!==_0x5ee2('0x3b')){var _0x1f82d8={};_0x1f82d8[_0x30fd23[_0x5ee2('0x24')]]={'$like':'%'+_0x770900[_0x5ee2('0x2b')]['filter']+'%'};return _0x1f82d8;}})});}_0x2cd5ed=_[_0x5ee2('0x39')]({},_0x2cd5ed,_0x770900[_0x5ee2('0x3c')]);var _0x13f691={'where':_0x2cd5ed[_0x5ee2('0x36')]};return db[_0x5ee2('0x27')][_0x5ee2('0x1b')](_0x13f691)[_0x5ee2('0x21')](function(_0x42530b){_0x7202cf['count']=_0x42530b;if(_0x770900[_0x5ee2('0x2b')]['includeAll']){_0x2cd5ed['include']=[{'all':!![]}];}return db[_0x5ee2('0x27')][_0x5ee2('0x3d')](_0x2cd5ed);})[_0x5ee2('0x21')](function(_0x4ab06f){_0x7202cf[_0x5ee2('0x3e')]=_0x4ab06f;return _0x7202cf;})[_0x5ee2('0x21')](respondWithFilteredResult(_0x12ac03,_0x2cd5ed))[_0x5ee2('0x3f')](handleError(_0x12ac03,null));};exports[_0x5ee2('0x40')]=function(_0xed671,_0x104d2f){var _0x15d589={'raw':!![],'where':{'id':_0xed671[_0x5ee2('0x41')]['id']}},_0x48ea6f={};_0x48ea6f[_0x5ee2('0x2f')]=_[_0x5ee2('0x2c')](db[_0x5ee2('0x27')]['rawAttributes']);_0x48ea6f[_0x5ee2('0x2b')]=_[_0x5ee2('0x2c')](_0xed671[_0x5ee2('0x2b')]);_0x48ea6f[_0x5ee2('0x2d')]=_[_0x5ee2('0x2e')](_0x48ea6f[_0x5ee2('0x2f')],_0x48ea6f['query']);_0x15d589[_0x5ee2('0x30')]=_[_0x5ee2('0x2e')](_0x48ea6f[_0x5ee2('0x2f')],qs['fields'](_0xed671[_0x5ee2('0x2b')][_0x5ee2('0x31')]));_0x15d589['attributes']=_0x15d589[_0x5ee2('0x30')]['length']?_0x15d589[_0x5ee2('0x30')]:_0x48ea6f['model'];if(_0xed671[_0x5ee2('0x2b')][_0x5ee2('0x42')]){_0x15d589[_0x5ee2('0x43')]=[{'all':!![]}];}_0x15d589=_[_0x5ee2('0x39')]({},_0x15d589,_0xed671[_0x5ee2('0x3c')]);return db[_0x5ee2('0x27')][_0x5ee2('0x44')](_0x15d589)[_0x5ee2('0x21')](handleEntityNotFound(_0x104d2f,null))[_0x5ee2('0x21')](respondWithResult(_0x104d2f,null))['catch'](handleError(_0x104d2f,null));};exports[_0x5ee2('0x45')]=function(_0x25f625,_0x5bdad3){return db[_0x5ee2('0x27')][_0x5ee2('0x45')](_0x25f625[_0x5ee2('0x46')],{})[_0x5ee2('0x21')](respondWithResult(_0x5bdad3,0xc9))[_0x5ee2('0x3f')](handleError(_0x5bdad3,null));};exports['update']=function(_0x127dc3,_0x1efb1f){if(_0x127dc3['body']['id']){delete _0x127dc3[_0x5ee2('0x46')]['id'];}return db[_0x5ee2('0x27')]['find']({'where':{'id':_0x127dc3[_0x5ee2('0x41')]['id']}})['then'](handleEntityNotFound(_0x1efb1f,null))[_0x5ee2('0x21')](saveUpdates(_0x127dc3[_0x5ee2('0x46')],null))[_0x5ee2('0x21')](respondWithResult(_0x1efb1f,null))[_0x5ee2('0x3f')](handleError(_0x1efb1f,null));};exports['destroy']=function(_0x2dad61,_0x1a6ce8){return db['SugarcrmField'][_0x5ee2('0x44')]({'where':{'id':_0x2dad61[_0x5ee2('0x41')]['id']}})[_0x5ee2('0x21')](handleEntityNotFound(_0x1a6ce8,null))['then'](removeEntity(_0x1a6ce8,null))[_0x5ee2('0x3f')](handleError(_0x1a6ce8,null));}; \ No newline at end of file +var _0xc570=['keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','SugarcrmField','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model'];(function(_0x132d7b,_0x5574fc){var _0x511f44=function(_0x2e467a){while(--_0x2e467a){_0x132d7b['push'](_0x132d7b['shift']());}};_0x511f44(++_0x5574fc);}(_0xc570,0x13e));var _0x0c57=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xc570[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x0c57('0x0'));var rimraf=require(_0x0c57('0x1'));var zipdir=require(_0x0c57('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c57('0x3'));var moment=require(_0x0c57('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0c57('0x5'));var sox=require(_0x0c57('0x6'));var csv=require('to-csv');var ejs=require(_0x0c57('0x7'));var fs=require('fs');var fs_extra=require(_0x0c57('0x8'));var _=require(_0x0c57('0x9'));var squel=require('squel');var crypto=require(_0x0c57('0xa'));var jsforce=require(_0x0c57('0xb'));var deskjs=require(_0x0c57('0xc'));var toCsv=require(_0x0c57('0xd'));var querystring=require(_0x0c57('0xe'));var Papa=require(_0x0c57('0xf'));var Redis=require(_0x0c57('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c57('0x11'));var logger=require(_0x0c57('0x12'))(_0x0c57('0x13'));var utils=require(_0x0c57('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0c57('0x15'));var db=require(_0x0c57('0x16'))['db'];function respondWithStatusCode(_0x28b090,_0xa267ad){_0xa267ad=_0xa267ad||0xcc;return function(_0x2ba9fd){if(_0x2ba9fd){return _0x28b090[_0x0c57('0x17')](_0xa267ad);}return _0x28b090['status'](_0xa267ad)[_0x0c57('0x18')]();};}function respondWithResult(_0x17839f,_0x41f1b9){_0x41f1b9=_0x41f1b9||0xc8;return function(_0x286d9c){if(_0x286d9c){return _0x17839f[_0x0c57('0x19')](_0x41f1b9)['json'](_0x286d9c);}};}function respondWithFilteredResult(_0x53a9b8,_0x47a881){return function(_0x44db67){if(_0x44db67){var _0x3d399b=typeof _0x47a881[_0x0c57('0x1a')]===_0x0c57('0x1b')&&typeof _0x47a881['limit']===_0x0c57('0x1b');var _0x8037e7=_0x44db67[_0x0c57('0x1c')];var _0x315442=_0x3d399b?0x0:_0x47a881[_0x0c57('0x1a')];var _0x5de183=_0x3d399b?_0x44db67[_0x0c57('0x1c')]:_0x47a881[_0x0c57('0x1a')]+_0x47a881[_0x0c57('0x1d')];var _0x8e40c9;if(_0x5de183>=_0x8037e7){_0x5de183=_0x8037e7;_0x8e40c9=0xc8;}else{_0x8e40c9=0xce;}_0x53a9b8['status'](_0x8e40c9);return _0x53a9b8[_0x0c57('0x1e')](_0x0c57('0x1f'),_0x315442+'-'+_0x5de183+'/'+_0x8037e7)[_0x0c57('0x20')](_0x44db67);}return null;};}function patchUpdates(_0x59af51){return function(_0x576759){try{jsonpatch['apply'](_0x576759,_0x59af51,!![]);}catch(_0x515ec5){return BPromise[_0x0c57('0x21')](_0x515ec5);}return _0x576759[_0x0c57('0x22')]();};}function saveUpdates(_0x325c88,_0x5dc461){return function(_0x3a14fa){if(_0x3a14fa){return _0x3a14fa[_0x0c57('0x23')](_0x325c88)[_0x0c57('0x24')](function(_0x5c1b3b){return _0x5c1b3b;});}return null;};}function removeEntity(_0x49e428,_0x44bd5e){return function(_0x4e2c86){if(_0x4e2c86){return _0x4e2c86[_0x0c57('0x25')]()[_0x0c57('0x24')](function(){_0x49e428[_0x0c57('0x19')](0xcc)[_0x0c57('0x18')]();});}};}function handleEntityNotFound(_0x366103,_0x30b822){return function(_0xdf8661){if(!_0xdf8661){_0x366103[_0x0c57('0x17')](0x194);}return _0xdf8661;};}function handleError(_0x129cda,_0x3f2f5d){_0x3f2f5d=_0x3f2f5d||0x1f4;return function(_0x120e13){logger[_0x0c57('0x26')](_0x120e13['stack']);if(_0x120e13[_0x0c57('0x27')]){delete _0x120e13['name'];}_0x129cda[_0x0c57('0x19')](_0x3f2f5d)[_0x0c57('0x28')](_0x120e13);};}exports[_0x0c57('0x29')]=function(_0x3017ec,_0x5dff62){var _0x179462={},_0x41c75b={},_0xb30b3={'count':0x0,'rows':[]};var _0x1c6d13=_[_0x0c57('0x2a')](db['SugarcrmField'][_0x0c57('0x2b')],function(_0x3e241d){return{'name':_0x3e241d[_0x0c57('0x2c')],'type':_0x3e241d['type'][_0x0c57('0x2d')]};});_0x41c75b[_0x0c57('0x2e')]=_[_0x0c57('0x2a')](_0x1c6d13,_0x0c57('0x27'));_0x41c75b['query']=_[_0x0c57('0x2f')](_0x3017ec['query']);_0x41c75b[_0x0c57('0x30')]=_[_0x0c57('0x31')](_0x41c75b['model'],_0x41c75b['query']);_0x179462['attributes']=_[_0x0c57('0x31')](_0x41c75b[_0x0c57('0x2e')],qs[_0x0c57('0x32')](_0x3017ec[_0x0c57('0x33')][_0x0c57('0x32')]));_0x179462[_0x0c57('0x34')]=_0x179462[_0x0c57('0x34')][_0x0c57('0x35')]?_0x179462[_0x0c57('0x34')]:_0x41c75b[_0x0c57('0x2e')];if(!_0x3017ec['query'][_0x0c57('0x36')]('nolimit')){_0x179462[_0x0c57('0x1d')]=qs[_0x0c57('0x1d')](_0x3017ec[_0x0c57('0x33')][_0x0c57('0x1d')]);_0x179462[_0x0c57('0x1a')]=qs[_0x0c57('0x1a')](_0x3017ec['query']['offset']);}_0x179462[_0x0c57('0x37')]=qs[_0x0c57('0x38')](_0x3017ec[_0x0c57('0x33')]['sort']);_0x179462[_0x0c57('0x39')]=qs['filters'](_[_0x0c57('0x3a')](_0x3017ec[_0x0c57('0x33')],_0x41c75b['filters']),_0x1c6d13);if(_0x3017ec[_0x0c57('0x33')][_0x0c57('0x3b')]){_0x179462[_0x0c57('0x39')]=_[_0x0c57('0x3c')](_0x179462[_0x0c57('0x39')],{'$or':_['map'](_0x1c6d13,function(_0x330272){if(_0x330272['type']!=='VIRTUAL'){var _0x3448eb={};_0x3448eb[_0x330272[_0x0c57('0x27')]]={'$like':'%'+_0x3017ec['query'][_0x0c57('0x3b')]+'%'};return _0x3448eb;}})});}_0x179462=_[_0x0c57('0x3c')]({},_0x179462,_0x3017ec[_0x0c57('0x3d')]);var _0x5acc75={'where':_0x179462[_0x0c57('0x39')]};return db[_0x0c57('0x3e')][_0x0c57('0x1c')](_0x5acc75)[_0x0c57('0x24')](function(_0x3e0d6e){_0xb30b3[_0x0c57('0x1c')]=_0x3e0d6e;if(_0x3017ec['query']['includeAll']){_0x179462[_0x0c57('0x3f')]=[{'all':!![]}];}return db[_0x0c57('0x3e')][_0x0c57('0x40')](_0x179462);})[_0x0c57('0x24')](function(_0x2c7687){_0xb30b3[_0x0c57('0x41')]=_0x2c7687;return _0xb30b3;})[_0x0c57('0x24')](respondWithFilteredResult(_0x5dff62,_0x179462))[_0x0c57('0x42')](handleError(_0x5dff62,null));};exports[_0x0c57('0x43')]=function(_0x4c5821,_0x129728){var _0x378d79={'raw':!![],'where':{'id':_0x4c5821[_0x0c57('0x44')]['id']}},_0x123787={};_0x123787[_0x0c57('0x2e')]=_[_0x0c57('0x2f')](db['SugarcrmField']['rawAttributes']);_0x123787[_0x0c57('0x33')]=_[_0x0c57('0x2f')](_0x4c5821[_0x0c57('0x33')]);_0x123787[_0x0c57('0x30')]=_[_0x0c57('0x31')](_0x123787[_0x0c57('0x2e')],_0x123787['query']);_0x378d79[_0x0c57('0x34')]=_[_0x0c57('0x31')](_0x123787[_0x0c57('0x2e')],qs[_0x0c57('0x32')](_0x4c5821[_0x0c57('0x33')][_0x0c57('0x32')]));_0x378d79['attributes']=_0x378d79['attributes'][_0x0c57('0x35')]?_0x378d79[_0x0c57('0x34')]:_0x123787[_0x0c57('0x2e')];if(_0x4c5821[_0x0c57('0x33')][_0x0c57('0x45')]){_0x378d79[_0x0c57('0x3f')]=[{'all':!![]}];}_0x378d79=_[_0x0c57('0x3c')]({},_0x378d79,_0x4c5821[_0x0c57('0x3d')]);return db[_0x0c57('0x3e')][_0x0c57('0x46')](_0x378d79)[_0x0c57('0x24')](handleEntityNotFound(_0x129728,null))[_0x0c57('0x24')](respondWithResult(_0x129728,null))[_0x0c57('0x42')](handleError(_0x129728,null));};exports['create']=function(_0x5381e1,_0x475e48){return db[_0x0c57('0x3e')][_0x0c57('0x47')](_0x5381e1['body'],{})['then'](respondWithResult(_0x475e48,0xc9))[_0x0c57('0x42')](handleError(_0x475e48,null));};exports[_0x0c57('0x23')]=function(_0x473ec5,_0x418a62){if(_0x473ec5[_0x0c57('0x48')]['id']){delete _0x473ec5['body']['id'];}return db[_0x0c57('0x3e')][_0x0c57('0x46')]({'where':{'id':_0x473ec5[_0x0c57('0x44')]['id']}})['then'](handleEntityNotFound(_0x418a62,null))[_0x0c57('0x24')](saveUpdates(_0x473ec5[_0x0c57('0x48')],null))[_0x0c57('0x24')](respondWithResult(_0x418a62,null))['catch'](handleError(_0x418a62,null));};exports[_0x0c57('0x25')]=function(_0x3adae1,_0x538818){return db[_0x0c57('0x3e')][_0x0c57('0x46')]({'where':{'id':_0x3adae1[_0x0c57('0x44')]['id']}})[_0x0c57('0x24')](handleEntityNotFound(_0x538818,null))[_0x0c57('0x24')](removeEntity(_0x538818,null))[_0x0c57('0x42')](handleError(_0x538818,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6ba8c88..983b301 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 _0x97e6=['exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x185291,_0x193229){var _0x5b3c5a=function(_0x563ac3){while(--_0x563ac3){_0x185291['push'](_0x185291['shift']());}};_0x5b3c5a(++_0x193229);}(_0x97e6,0x1c9));var _0x697e=function(_0x3746fe,_0x30b6b0){_0x3746fe=_0x3746fe-0x0;var _0xb3093d=_0x97e6[_0x3746fe];return _0xb3093d;};'use strict';var _=require('lodash');var util=require(_0x697e('0x0'));var logger=require(_0x697e('0x1'))('api');var moment=require(_0x697e('0x2'));var BPromise=require('bluebird');var rp=require(_0x697e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x697e('0x4'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x697e('0x5')]=function(_0x59dcba,_0x4667f5){return _0x59dcba['define'](_0x697e('0x6'),attributes,{'tableName':_0x697e('0x7'),'paranoid':![],'indexes':[{'name':_0x697e('0x8'),'fields':[_0x697e('0x9'),_0x697e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc154=['moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','lodash','util'];(function(_0xf671c8,_0x275759){var _0x2a7d44=function(_0x18481f){while(--_0x18481f){_0xf671c8['push'](_0xf671c8['shift']());}};_0x2a7d44(++_0x275759);}(_0xc154,0xf5));var _0x4c15=function(_0x2d08b9,_0x2fee02){_0x2d08b9=_0x2d08b9-0x0;var _0x34c713=_0xc154[_0x2d08b9];return _0x34c713;};'use strict';var _=require(_0x4c15('0x0'));var util=require(_0x4c15('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4c15('0x2'));var BPromise=require(_0x4c15('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c15('0x4'));var rimraf=require(_0x4c15('0x5'));var config=require(_0x4c15('0x6'));var attributes=require(_0x4c15('0x7'));module[_0x4c15('0x8')]=function(_0x77e21d,_0x5e586e){return _0x77e21d[_0x4c15('0x9')](_0x4c15('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x4c15('0xb'),'fields':[_0x4c15('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index c30e607..c993d1c 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 _0x6bb2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','info','result','catch','lodash','util'];(function(_0x3937ef,_0x5d2a76){var _0x3d35a5=function(_0x27be1b){while(--_0x27be1b){_0x3937ef['push'](_0x3937ef['shift']());}};_0x3d35a5(++_0x5d2a76);}(_0x6bb2,0xda));var _0x26bb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6bb2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x26bb('0x0'));var util=require(_0x26bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x26bb('0x2'));var fs=require('fs');var Redis=require(_0x26bb('0x3'));var db=require(_0x26bb('0x4'))['db'];var utils=require(_0x26bb('0x5'));var logger=require(_0x26bb('0x6'))('rpc');var config=require(_0x26bb('0x7'));var jayson=require(_0x26bb('0x8'));var client=jayson[_0x26bb('0x9')][_0x26bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b625d,_0x31bcec,_0x34f850){return new BPromise(function(_0x3ed546,_0x45f0a5){return client[_0x26bb('0xb')](_0x3b625d,_0x34f850)[_0x26bb('0xc')](function(_0xd49fc3){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x31bcec,_0x26bb('0xd'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x31bcec,_0x26bb('0xd'),JSON[_0x26bb('0xe')](_0xd49fc3));if(_0xd49fc3[_0x26bb('0xf')]){if(_0xd49fc3[_0x26bb('0xf')][_0x26bb('0x10')]===0x1f4){logger[_0x26bb('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x31bcec,_0xd49fc3['error'][_0x26bb('0x11')]);return _0x45f0a5(_0xd49fc3[_0x26bb('0xf')][_0x26bb('0x11')]);}logger[_0x26bb('0xf')](_0x26bb('0x12'),_0x31bcec,_0xd49fc3[_0x26bb('0xf')][_0x26bb('0x11')]);return _0x3ed546(_0xd49fc3[_0x26bb('0xf')][_0x26bb('0x11')]);}else{logger[_0x26bb('0x13')](_0x26bb('0x12'),_0x31bcec,_0x26bb('0xd'));_0x3ed546(_0xd49fc3[_0x26bb('0x14')]['message']);}})[_0x26bb('0x15')](function(_0x32f9cb){logger[_0x26bb('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x31bcec,_0x32f9cb);_0x45f0a5(_0x32f9cb);});});} \ No newline at end of file +var _0x5c8b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x5c8b,0x164));var _0xb5c8=function(_0x443a29,_0x42e598){_0x443a29=_0x443a29-0x0;var _0xb3434d=_0x5c8b[_0x443a29];return _0xb3434d;};'use strict';var _=require(_0xb5c8('0x0'));var util=require('util');var moment=require(_0xb5c8('0x1'));var BPromise=require(_0xb5c8('0x2'));var rs=require(_0xb5c8('0x3'));var fs=require('fs');var Redis=require(_0xb5c8('0x4'));var db=require(_0xb5c8('0x5'))['db'];var utils=require(_0xb5c8('0x6'));var logger=require(_0xb5c8('0x7'))(_0xb5c8('0x8'));var config=require(_0xb5c8('0x9'));var jayson=require(_0xb5c8('0xa'));var client=jayson[_0xb5c8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d468d,_0x40b56e,_0x550cc2){return new BPromise(function(_0x264f4a,_0x2feef0){return client['request'](_0x5d468d,_0x550cc2)['then'](function(_0x4295ba){logger[_0xb5c8('0xc')](_0xb5c8('0xd'),_0x40b56e,_0xb5c8('0xe'));logger['debug'](_0xb5c8('0xf'),_0x40b56e,_0xb5c8('0xe'),JSON[_0xb5c8('0x10')](_0x4295ba));if(_0x4295ba['error']){if(_0x4295ba['error'][_0xb5c8('0x11')]===0x1f4){logger[_0xb5c8('0x12')](_0xb5c8('0xd'),_0x40b56e,_0x4295ba[_0xb5c8('0x12')][_0xb5c8('0x13')]);return _0x2feef0(_0x4295ba[_0xb5c8('0x12')][_0xb5c8('0x13')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x40b56e,_0x4295ba[_0xb5c8('0x12')][_0xb5c8('0x13')]);return _0x264f4a(_0x4295ba['error'][_0xb5c8('0x13')]);}else{logger['info'](_0xb5c8('0xd'),_0x40b56e,'request\x20sent');_0x264f4a(_0x4295ba[_0xb5c8('0x14')][_0xb5c8('0x13')]);}})['catch'](function(_0x44d10d){logger['error'](_0xb5c8('0xd'),_0x40b56e,_0x44d10d);_0x2feef0(_0x44d10d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6b991d5..6cbda80 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 _0xf1e1=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e7055,_0x4aae9d){var _0x396bdc=function(_0x598be3){while(--_0x598be3){_0x2e7055['push'](_0x2e7055['shift']());}};_0x396bdc(++_0x4aae9d);}(_0xf1e1,0x102));var _0x1f1e=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0xf1e1[_0x15a8fa];return _0x1355c2;};'use strict';var multer=require(_0x1f1e('0x0'));var util=require('util');var path=require(_0x1f1e('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f1e('0x2'));var router=express['Router']();var fs_extra=require(_0x1f1e('0x3'));var auth=require(_0x1f1e('0x4'));var interaction=require(_0x1f1e('0x5'));var config=require(_0x1f1e('0x6'));var controller=require(_0x1f1e('0x7'));router[_0x1f1e('0x8')]('/',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0xa')]);router[_0x1f1e('0x8')](_0x1f1e('0xb'),auth[_0x1f1e('0x9')](),controller[_0x1f1e('0xc')]);router[_0x1f1e('0x8')](_0x1f1e('0xd'),auth['isAuthenticated'](),controller[_0x1f1e('0xe')]);router[_0x1f1e('0x8')](_0x1f1e('0xf'),auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x10')]);router[_0x1f1e('0x11')]('/',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x12')]);router[_0x1f1e('0x11')]('/:id/configurations',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x13')]);router[_0x1f1e('0x14')](_0x1f1e('0xb'),auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x15')]);router[_0x1f1e('0x16')]('/:id',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc716=['Router','fs-extra','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0xfa61f2,_0x1195b4){var _0x3d5f41=function(_0x55504d){while(--_0x55504d){_0xfa61f2['push'](_0xfa61f2['shift']());}};_0x3d5f41(++_0x1195b4);}(_0xc716,0x16c));var _0x6c71=function(_0x76aa46,_0x29459d){_0x76aa46=_0x76aa46-0x0;var _0x3604b9=_0xc716[_0x76aa46];return _0x3604b9;};'use strict';var multer=require(_0x6c71('0x0'));var util=require('util');var path=require(_0x6c71('0x1'));var timeout=require(_0x6c71('0x2'));var express=require(_0x6c71('0x3'));var router=express[_0x6c71('0x4')]();var fs_extra=require(_0x6c71('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6c71('0x6'));var config=require('../../config/environment');var controller=require(_0x6c71('0x7'));router[_0x6c71('0x8')]('/',auth[_0x6c71('0x9')](),controller[_0x6c71('0xa')]);router[_0x6c71('0x8')](_0x6c71('0xb'),auth[_0x6c71('0x9')](),controller[_0x6c71('0xc')]);router[_0x6c71('0x8')]('/:id/configurations',auth[_0x6c71('0x9')](),controller['getConfigurations']);router[_0x6c71('0x8')]('/:id/fields',auth[_0x6c71('0x9')](),controller[_0x6c71('0xd')]);router['post']('/',auth[_0x6c71('0x9')](),controller[_0x6c71('0xe')]);router[_0x6c71('0xf')](_0x6c71('0x10'),auth[_0x6c71('0x9')](),controller[_0x6c71('0x11')]);router[_0x6c71('0x12')](_0x6c71('0xb'),auth['isAuthenticated'](),controller[_0x6c71('0x13')]);router[_0x6c71('0x14')](_0x6c71('0xb'),auth['isAuthenticated'](),controller[_0x6c71('0x15')]);module[_0x6c71('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2795577..451e60c 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 _0xaa54=['HelpDesk','sequelize','STRING'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xaa54,0x190));var _0x4aa5=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xaa54[_0x25d386];return _0x857f4a;};'use strict';var Sequelize=require(_0x4aa5('0x0'));module['exports']={'name':{'type':Sequelize[_0x4aa5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4aa5('0x1')]},'username':{'type':Sequelize[_0x4aa5('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4aa5('0x1')],'allowNull':![],'defaultValue':_0x4aa5('0x2')},'remoteUri':{'type':Sequelize[_0x4aa5('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4aa5('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4aa5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x44d3=['exports','STRING','HelpDesk','sequelize'];(function(_0x44c7f0,_0x399637){var _0x99836c=function(_0x3b4c62){while(--_0x3b4c62){_0x44c7f0['push'](_0x44c7f0['shift']());}};_0x99836c(++_0x399637);}(_0x44d3,0xfb));var _0x344d=function(_0x76b4a1,_0x420f1c){_0x76b4a1=_0x76b4a1-0x0;var _0x220bca=_0x44d3[_0x76b4a1];return _0x220bca;};'use strict';var Sequelize=require(_0x344d('0x0'));module[_0x344d('0x1')]={'name':{'type':Sequelize[_0x344d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x344d('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x344d('0x2')],'allowNull':![],'defaultValue':_0x344d('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x344d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x344d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index c085f23..28e7b45 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 _0x9f07=['fields','attributes','length','sort','where','pick','filter','merge','type','VIRTUAL','options','VtigerAccount','includeAll','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','result','token','success','describe','autogenerated','includes','remove','editable','label','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','model','query','keys','filters','intersection'];(function(_0xd2a23d,_0x381171){var _0x1b1a2a=function(_0x4e55e2){while(--_0x4e55e2){_0xd2a23d['push'](_0xd2a23d['shift']());}};_0x1b1a2a(++_0x381171);}(_0x9f07,0x12e));var _0x79f0=function(_0x2c0ba0,_0x4f44b6){_0x2c0ba0=_0x2c0ba0-0x0;var _0x315f2d=_0x9f07[_0x2c0ba0];return _0x315f2d;};'use strict';var emlformat=require(_0x79f0('0x0'));var rimraf=require(_0x79f0('0x1'));var zipdir=require(_0x79f0('0x2'));var jsonpatch=require(_0x79f0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x79f0('0x4'));var Mustache=require(_0x79f0('0x5'));var util=require(_0x79f0('0x6'));var path=require(_0x79f0('0x7'));var sox=require('sox');var csv=require(_0x79f0('0x8'));var ejs=require(_0x79f0('0x9'));var fs=require('fs');var fs_extra=require(_0x79f0('0xa'));var _=require(_0x79f0('0xb'));var squel=require('squel');var crypto=require(_0x79f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x79f0('0xd'));var toCsv=require(_0x79f0('0x8'));var querystring=require(_0x79f0('0xe'));var Papa=require(_0x79f0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x79f0('0x10'));var hardwareService=require(_0x79f0('0x11'));var logger=require(_0x79f0('0x12'))(_0x79f0('0x13'));var utils=require(_0x79f0('0x14'));var config=require(_0x79f0('0x15'));var licenseUtil=require(_0x79f0('0x16'));var db=require(_0x79f0('0x17'))['db'];var integrations=require(_0x79f0('0x18'));function respondWithStatusCode(_0x5d1a69,_0x39bfb8){_0x39bfb8=_0x39bfb8||0xcc;return function(_0x1eb9bc){if(_0x1eb9bc){return _0x5d1a69[_0x79f0('0x19')](_0x39bfb8);}return _0x5d1a69['status'](_0x39bfb8)[_0x79f0('0x1a')]();};}function respondWithResult(_0x1bee68,_0x2f49){_0x2f49=_0x2f49||0xc8;return function(_0x251260){if(_0x251260){return _0x1bee68[_0x79f0('0x1b')](_0x2f49)[_0x79f0('0x1c')](_0x251260);}};}function respondWithFilteredResult(_0x49f442,_0x11fabc){return function(_0x2a4572){if(_0x2a4572){var _0x161a76=typeof _0x11fabc[_0x79f0('0x1d')]===_0x79f0('0x1e')&&typeof _0x11fabc[_0x79f0('0x1f')]==='undefined';var _0x194f12=_0x2a4572[_0x79f0('0x20')];var _0x42048b=_0x161a76?0x0:_0x11fabc[_0x79f0('0x1d')];var _0x3d9879=_0x161a76?_0x2a4572[_0x79f0('0x20')]:_0x11fabc['offset']+_0x11fabc['limit'];var _0x1951ae;if(_0x3d9879>=_0x194f12){_0x3d9879=_0x194f12;_0x1951ae=0xc8;}else{_0x1951ae=0xce;}_0x49f442['status'](_0x1951ae);return _0x49f442[_0x79f0('0x21')](_0x79f0('0x22'),_0x42048b+'-'+_0x3d9879+'/'+_0x194f12)[_0x79f0('0x1c')](_0x2a4572);}return null;};}function patchUpdates(_0x205c11){return function(_0x418168){try{jsonpatch[_0x79f0('0x23')](_0x418168,_0x205c11,!![]);}catch(_0x3fda98){return BPromise[_0x79f0('0x24')](_0x3fda98);}return _0x418168[_0x79f0('0x25')]();};}function saveUpdates(_0x4e7f23,_0x4539d9){return function(_0x5bf891){if(_0x5bf891){return _0x5bf891[_0x79f0('0x26')](_0x4e7f23)[_0x79f0('0x27')](function(_0x3242d2){return _0x3242d2;});}return null;};}function removeEntity(_0x41e193,_0x44c4f9){return function(_0x26b8ae){if(_0x26b8ae){return _0x26b8ae[_0x79f0('0x28')]()[_0x79f0('0x27')](function(){_0x41e193[_0x79f0('0x1b')](0xcc)[_0x79f0('0x1a')]();});}};}function handleEntityNotFound(_0x5a9885,_0x5a1347){return function(_0xdac20){if(!_0xdac20){_0x5a9885[_0x79f0('0x19')](0x194);}return _0xdac20;};}function handleError(_0x1d07ad,_0x170d05){_0x170d05=_0x170d05||0x1f4;return function(_0xfa4119){logger[_0x79f0('0x29')](_0xfa4119[_0x79f0('0x2a')]);if(_0xfa4119[_0x79f0('0x2b')]){delete _0xfa4119[_0x79f0('0x2b')];}_0x1d07ad[_0x79f0('0x1b')](_0x170d05)['send'](_0xfa4119);};}exports[_0x79f0('0x2c')]=function(_0x230204,_0x43e9bf){var _0x332163={},_0x300371={},_0x108261={'count':0x0,'rows':[]};var _0x34aea6=_[_0x79f0('0x2d')](db['VtigerAccount'][_0x79f0('0x2e')],function(_0x353f8b){return{'name':_0x353f8b['fieldName'],'type':_0x353f8b['type']['key']};});_0x300371[_0x79f0('0x2f')]=_[_0x79f0('0x2d')](_0x34aea6,_0x79f0('0x2b'));_0x300371[_0x79f0('0x30')]=_[_0x79f0('0x31')](_0x230204[_0x79f0('0x30')]);_0x300371[_0x79f0('0x32')]=_[_0x79f0('0x33')](_0x300371['model'],_0x300371[_0x79f0('0x30')]);_0x332163['attributes']=_[_0x79f0('0x33')](_0x300371[_0x79f0('0x2f')],qs[_0x79f0('0x34')](_0x230204['query'][_0x79f0('0x34')]));_0x332163['attributes']=_0x332163[_0x79f0('0x35')][_0x79f0('0x36')]?_0x332163[_0x79f0('0x35')]:_0x300371['model'];if(!_0x230204[_0x79f0('0x30')]['hasOwnProperty']('nolimit')){_0x332163[_0x79f0('0x1f')]=qs[_0x79f0('0x1f')](_0x230204['query'][_0x79f0('0x1f')]);_0x332163[_0x79f0('0x1d')]=qs['offset'](_0x230204[_0x79f0('0x30')][_0x79f0('0x1d')]);}_0x332163['order']=qs['sort'](_0x230204[_0x79f0('0x30')][_0x79f0('0x37')]);_0x332163[_0x79f0('0x38')]=qs[_0x79f0('0x32')](_[_0x79f0('0x39')](_0x230204[_0x79f0('0x30')],_0x300371['filters']),_0x34aea6);if(_0x230204['query'][_0x79f0('0x3a')]){_0x332163['where']=_[_0x79f0('0x3b')](_0x332163[_0x79f0('0x38')],{'$or':_[_0x79f0('0x2d')](_0x34aea6,function(_0x55d7ef){if(_0x55d7ef[_0x79f0('0x3c')]!==_0x79f0('0x3d')){var _0x205e26={};_0x205e26[_0x55d7ef[_0x79f0('0x2b')]]={'$like':'%'+_0x230204[_0x79f0('0x30')][_0x79f0('0x3a')]+'%'};return _0x205e26;}})});}_0x332163=_[_0x79f0('0x3b')]({},_0x332163,_0x230204[_0x79f0('0x3e')]);var _0x3eed1e={'where':_0x332163[_0x79f0('0x38')]};return db[_0x79f0('0x3f')][_0x79f0('0x20')](_0x3eed1e)[_0x79f0('0x27')](function(_0x8f3abd){_0x108261[_0x79f0('0x20')]=_0x8f3abd;if(_0x230204['query'][_0x79f0('0x40')]){_0x332163['include']=[{'all':!![]}];}return db[_0x79f0('0x3f')][_0x79f0('0x41')](_0x332163);})[_0x79f0('0x27')](function(_0x3e2e57){_0x108261[_0x79f0('0x42')]=_0x3e2e57;return _0x108261;})[_0x79f0('0x27')](respondWithFilteredResult(_0x43e9bf,_0x332163))[_0x79f0('0x43')](handleError(_0x43e9bf,null));};exports[_0x79f0('0x44')]=function(_0x50f386,_0x2711de){var _0x4de566={'raw':![],'where':{'id':_0x50f386[_0x79f0('0x45')]['id']}},_0x18727b={};_0x18727b[_0x79f0('0x2f')]=_[_0x79f0('0x31')](db[_0x79f0('0x3f')][_0x79f0('0x2e')]);_0x18727b[_0x79f0('0x30')]=_['keys'](_0x50f386[_0x79f0('0x30')]);_0x18727b['filters']=_['intersection'](_0x18727b['model'],_0x18727b['query']);_0x4de566[_0x79f0('0x35')]=_['intersection'](_0x18727b[_0x79f0('0x2f')],qs['fields'](_0x50f386[_0x79f0('0x30')][_0x79f0('0x34')]));_0x4de566[_0x79f0('0x35')]=_0x4de566['attributes'][_0x79f0('0x36')]?_0x4de566[_0x79f0('0x35')]:_0x18727b['model'];if(_0x50f386[_0x79f0('0x30')]['includeAll']){_0x4de566['include']=[{'all':!![]}];}_0x4de566=_[_0x79f0('0x3b')]({},_0x4de566,_0x50f386['options']);return db[_0x79f0('0x3f')][_0x79f0('0x46')](_0x4de566)[_0x79f0('0x27')](handleEntityNotFound(_0x2711de,null))[_0x79f0('0x27')](respondWithResult(_0x2711de,null))['catch'](handleError(_0x2711de,null));};exports['create']=function(_0x30cf5d,_0x1b5b3b){return db[_0x79f0('0x3f')][_0x79f0('0x47')](_0x30cf5d[_0x79f0('0x48')],{})['then'](respondWithResult(_0x1b5b3b,0xc9))[_0x79f0('0x43')](handleError(_0x1b5b3b,null));};exports[_0x79f0('0x26')]=function(_0x25baef,_0x3dfa97){if(_0x25baef['body']['id']){delete _0x25baef[_0x79f0('0x48')]['id'];}return db[_0x79f0('0x3f')][_0x79f0('0x46')]({'where':{'id':_0x25baef[_0x79f0('0x45')]['id']}})['then'](handleEntityNotFound(_0x3dfa97,null))[_0x79f0('0x27')](saveUpdates(_0x25baef[_0x79f0('0x48')],null))['then'](respondWithResult(_0x3dfa97,null))['catch'](handleError(_0x3dfa97,null));};exports[_0x79f0('0x28')]=function(_0x290b59,_0x1914c9){return db[_0x79f0('0x3f')][_0x79f0('0x46')]({'where':{'id':_0x290b59[_0x79f0('0x45')]['id']}})[_0x79f0('0x27')](handleEntityNotFound(_0x1914c9,null))[_0x79f0('0x27')](removeEntity(_0x1914c9,null))['catch'](handleError(_0x1914c9,null));};exports[_0x79f0('0x49')]=function(_0x5cfc85,_0x3aaa55,_0x2ce7d9){var _0x76065b={};var _0x56f50f={};var _0x12cf43;var _0x1ad1fa;return db[_0x79f0('0x3f')][_0x79f0('0x4a')]({'where':{'id':_0x5cfc85['params']['id']}})[_0x79f0('0x27')](handleEntityNotFound(_0x3aaa55,null))[_0x79f0('0x27')](function(_0x109511){if(_0x109511){_0x12cf43=_0x109511;_0x56f50f[_0x79f0('0x2f')]=_['keys'](db[_0x79f0('0x4b')][_0x79f0('0x2e')]);_0x56f50f[_0x79f0('0x30')]=_[_0x79f0('0x31')](_0x5cfc85['query']);_0x56f50f[_0x79f0('0x32')]=_[_0x79f0('0x33')](_0x56f50f[_0x79f0('0x2f')],_0x56f50f['query']);_0x76065b[_0x79f0('0x35')]=_['intersection'](_0x56f50f['model'],qs['fields'](_0x5cfc85[_0x79f0('0x30')][_0x79f0('0x34')]));_0x76065b[_0x79f0('0x35')]=_0x76065b[_0x79f0('0x35')]['length']?_0x76065b[_0x79f0('0x35')]:_0x56f50f['model'];_0x76065b[_0x79f0('0x4c')]=qs['sort'](_0x5cfc85['query'][_0x79f0('0x37')]);_0x76065b[_0x79f0('0x38')]=qs[_0x79f0('0x32')](_[_0x79f0('0x39')](_0x5cfc85[_0x79f0('0x30')],_0x56f50f['filters']));if(_0x5cfc85[_0x79f0('0x30')]['filter']){_0x76065b[_0x79f0('0x38')]=_['merge'](_0x76065b['where'],{'$or':_['map'](_0x76065b[_0x79f0('0x35')],function(_0x26f57d){var _0x7e4cb5={};_0x7e4cb5[_0x26f57d]={'$like':'%'+_0x5cfc85['query']['filter']+'%'};return _0x7e4cb5;})});}_0x76065b=_['merge']({},_0x76065b,_0x5cfc85[_0x79f0('0x3e')]);return _0x12cf43[_0x79f0('0x49')](_0x76065b);}})['then'](function(_0x1270b5){if(_0x1270b5){_0x1ad1fa=_0x1270b5[_0x79f0('0x36')];if(!_0x5cfc85[_0x79f0('0x30')][_0x79f0('0x4d')](_0x79f0('0x4e'))){_0x76065b[_0x79f0('0x1f')]=qs[_0x79f0('0x1f')](_0x5cfc85[_0x79f0('0x30')][_0x79f0('0x1f')]);_0x76065b['offset']=qs[_0x79f0('0x1d')](_0x5cfc85[_0x79f0('0x30')][_0x79f0('0x1d')]);}return _0x12cf43[_0x79f0('0x49')](_0x76065b);}})[_0x79f0('0x27')](function(_0x4de85c){if(_0x4de85c){return _0x4de85c?{'count':_0x1ad1fa,'rows':_0x4de85c}:null;}})[_0x79f0('0x27')](respondWithResult(_0x3aaa55,null))[_0x79f0('0x43')](handleError(_0x3aaa55,null));};exports[_0x79f0('0x4f')]=function(_0x1e8eec,_0x45cc73,_0x5b04b5){if(_0x1e8eec['body']['id']){delete _0x1e8eec[_0x79f0('0x48')]['id'];}return db['VtigerAccount'][_0x79f0('0x4a')]({'where':{'id':_0x1e8eec[_0x79f0('0x45')]['id']}})[_0x79f0('0x27')](handleEntityNotFound(_0x45cc73,null))[_0x79f0('0x27')](function(_0x5dd0f1){if(_0x5dd0f1){_0x1e8eec[_0x79f0('0x48')][_0x79f0('0x50')]=_0x5dd0f1['id'];_0x1e8eec[_0x79f0('0x48')][_0x79f0('0x51')]=integrations['getSubjects'](_0x1e8eec['body'][_0x79f0('0x52')],_0x1e8eec[_0x79f0('0x48')][_0x79f0('0x3c')]);_0x1e8eec[_0x79f0('0x48')][_0x79f0('0x53')]=integrations[_0x79f0('0x54')](_0x1e8eec[_0x79f0('0x48')][_0x79f0('0x52')],_0x1e8eec[_0x79f0('0x48')][_0x79f0('0x3c')]);return db['VtigerConfiguration'][_0x79f0('0x47')](_0x1e8eec[_0x79f0('0x48')],{'include':[{'model':db[_0x79f0('0x55')],'as':_0x79f0('0x51')},{'model':db[_0x79f0('0x55')],'as':_0x79f0('0x53')}]});}return null;})[_0x79f0('0x27')](respondWithResult(_0x45cc73,null))[_0x79f0('0x43')](handleError(_0x45cc73,null));};var md5=require(_0x79f0('0x56'));exports[_0x79f0('0x57')]=function(_0x56e9e4,_0x59861d,_0x54ad9a){var _0x4b7844=null;var _0x28ba9a=null;var _0x19a353=null;var _0x263028=null;var _0x2e2dcc='';return db[_0x79f0('0x3f')][_0x79f0('0x4a')]({'where':{'id':_0x56e9e4[_0x79f0('0x45')]['id']},'attributes':['id',_0x79f0('0x2b'),_0x79f0('0x58'),_0x79f0('0x59'),_0x79f0('0x5a'),_0x79f0('0x5b'),_0x79f0('0x5c'),_0x79f0('0x5d')]})[_0x79f0('0x27')](handleEntityNotFound(_0x59861d,null))[_0x79f0('0x27')](function(_0x4e80be){if(_0x4e80be){_0x4b7844=_0x4e80be[_0x79f0('0x58')];_0x28ba9a=_0x4e80be[_0x79f0('0x5d')];_0x19a353=_0x4e80be['moduleName'];_0x2e2dcc=_0x4e80be[_0x79f0('0x5b')];var _0x54a974=_0x2e2dcc[_0x79f0('0x5e')](-0x1);if(_0x54a974==='/'){_0x2e2dcc=_0x2e2dcc[_0x79f0('0x5f')](0x0,_0x2e2dcc[_0x79f0('0x60')](_0x54a974));}_0x263028=util['format'](_0x79f0('0x61'),_0x2e2dcc);var _0x53d1b5={'method':'GET','uri':_0x263028,'qs':{'operation':_0x79f0('0x62'),'username':_0x4e80be[_0x79f0('0x58')]},'json':!![]};return rp(_0x53d1b5);}})['then'](function(_0x4b109d){if(_0x4b109d['success']){var _0x246d84={'method':'POST','uri':_0x263028,'form':{'operation':'login','username':_0x4b7844,'accessKey':md5(_0x4b109d[_0x79f0('0x63')][_0x79f0('0x64')]+_0x28ba9a)},'json':!![]};return rp(_0x246d84);}})[_0x79f0('0x27')](function(_0x1c0f47){if(_0x1c0f47[_0x79f0('0x65')]){var _0xd85011={'method':'GET','uri':_0x263028,'qs':{'operation':_0x79f0('0x66'),'username':_0x4b7844,'sessionName':_0x1c0f47[_0x79f0('0x63')]['sessionName'],'elementType':_0x19a353},'json':!![]};return rp(_0xd85011);}})[_0x79f0('0x27')](function(_0x5ac763){if(_0x5ac763['success']){var _0x428e3c=[_0x79f0('0x67'),'reference','owner'];_['remove'](_0x5ac763['result'][_0x79f0('0x34')],function(_0x27f7be){return _0x428e3c[_0x79f0('0x68')](_0x27f7be['type'][_0x79f0('0x2b')]);});_[_0x79f0('0x69')](_0x5ac763[_0x79f0('0x63')][_0x79f0('0x34')],function(_0x3d8c72){return _0x3d8c72[_0x79f0('0x6a')]==='false';});return{'count':_0x5ac763['result']['fields']['length'],'rows':_[_0x79f0('0x2d')](_0x5ac763['result'][_0x79f0('0x34')],function(_0x3612d1){return{'id':_0x3612d1[_0x79f0('0x2b')],'name':_0x3612d1[_0x79f0('0x6b')],'custom':_['startsWith'](_0x3612d1['name'],'cf_')?!![]:![],'options':_0x3612d1[_0x79f0('0x3c')][_0x79f0('0x2b')]===_0x79f0('0x6c')&&_0x3612d1[_0x79f0('0x3c')][_0x79f0('0x6d')][_0x79f0('0x36')]>0x0?_[_0x79f0('0x2d')](_0x3612d1[_0x79f0('0x3c')]['picklistValues'],function(_0x24f652){return{'name':_0x24f652[_0x79f0('0x6b')],'value':_0x24f652[_0x79f0('0x6e')]};}):[]};})};}})[_0x79f0('0x27')](respondWithResult(_0x59861d,null))[_0x79f0('0x43')](function(_0x5c1779){console[_0x79f0('0x6f')]('vTiger\x20error:\x20'+_0x5c1779);var _0x549e0b=_0x56e9e4['query'][_0x79f0('0x70')]?0x1f4:_0x5c1779[_0x79f0('0x71')]||0x1f4;logger[_0x79f0('0x29')](_0x79f0('0x72'),'getFields',_0x549e0b,JSON[_0x79f0('0x73')](_0x5c1779));delete _0x5c1779['name'];if(_0x549e0b===0x191){_0x549e0b=0x190;}_0x59861d[_0x79f0('0x1b')](_0x549e0b)[_0x79f0('0x74')](_0x56e9e4[_0x79f0('0x30')][_0x79f0('0x70')]?{'message':_0x79f0('0x75'),'statusCode':_0x5c1779['statusCode']}:_0x5c1779);});}; \ No newline at end of file +var _0xc5eb=['stringify','Wrong\x20credentials','zip-dir','fast-json-patch','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../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','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','VtigerAccount','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','getConfigurations','VtigerConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','%s/webservice.php','GET','getchallenge','POST','login','sessionName','autogenerated','reference','owner','result','includes','remove','editable','startsWith','cf_','picklist','picklistValues','label','value','log','test','statusCode'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xc5eb,0x79));var _0xbc5e=function(_0x32b207,_0x19e746){_0x32b207=_0x32b207-0x0;var _0x43c814=_0xc5eb[_0x32b207];return _0x43c814;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbc5e('0x0'));var jsonpatch=require(_0xbc5e('0x1'));var rp=require('request-promise');var moment=require(_0xbc5e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbc5e('0x3'));var util=require('util');var path=require(_0xbc5e('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbc5e('0x5'));var fs=require('fs');var fs_extra=require(_0xbc5e('0x6'));var _=require(_0xbc5e('0x7'));var squel=require(_0xbc5e('0x8'));var crypto=require(_0xbc5e('0x9'));var jsforce=require(_0xbc5e('0xa'));var deskjs=require(_0xbc5e('0xb'));var toCsv=require(_0xbc5e('0xc'));var querystring=require('querystring');var Papa=require(_0xbc5e('0xd'));var Redis=require(_0xbc5e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbc5e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc5e('0x10'))(_0xbc5e('0x11'));var utils=require('../../config/utils');var config=require(_0xbc5e('0x12'));var licenseUtil=require(_0xbc5e('0x13'));var db=require(_0xbc5e('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x244598,_0x3b4cc0){_0x3b4cc0=_0x3b4cc0||0xcc;return function(_0x227104){if(_0x227104){return _0x244598[_0xbc5e('0x15')](_0x3b4cc0);}return _0x244598[_0xbc5e('0x16')](_0x3b4cc0)[_0xbc5e('0x17')]();};}function respondWithResult(_0x5d680d,_0x491831){_0x491831=_0x491831||0xc8;return function(_0x48490c){if(_0x48490c){return _0x5d680d[_0xbc5e('0x16')](_0x491831)[_0xbc5e('0x18')](_0x48490c);}};}function respondWithFilteredResult(_0x32f5e6,_0x4b4a2c){return function(_0x51bfd1){if(_0x51bfd1){var _0x4e01eb=typeof _0x4b4a2c[_0xbc5e('0x19')]===_0xbc5e('0x1a')&&typeof _0x4b4a2c[_0xbc5e('0x1b')]===_0xbc5e('0x1a');var _0x11f6a2=_0x51bfd1['count'];var _0x179fc2=_0x4e01eb?0x0:_0x4b4a2c[_0xbc5e('0x19')];var _0x2791cd=_0x4e01eb?_0x51bfd1[_0xbc5e('0x1c')]:_0x4b4a2c[_0xbc5e('0x19')]+_0x4b4a2c['limit'];var _0x1dd9d3;if(_0x2791cd>=_0x11f6a2){_0x2791cd=_0x11f6a2;_0x1dd9d3=0xc8;}else{_0x1dd9d3=0xce;}_0x32f5e6[_0xbc5e('0x16')](_0x1dd9d3);return _0x32f5e6['set'](_0xbc5e('0x1d'),_0x179fc2+'-'+_0x2791cd+'/'+_0x11f6a2)['json'](_0x51bfd1);}return null;};}function patchUpdates(_0x3257bb){return function(_0x269bcb){try{jsonpatch[_0xbc5e('0x1e')](_0x269bcb,_0x3257bb,!![]);}catch(_0x453fd3){return BPromise[_0xbc5e('0x1f')](_0x453fd3);}return _0x269bcb[_0xbc5e('0x20')]();};}function saveUpdates(_0x1567d6,_0x3dc585){return function(_0x2e0a73){if(_0x2e0a73){return _0x2e0a73[_0xbc5e('0x21')](_0x1567d6)[_0xbc5e('0x22')](function(_0x312ee5){return _0x312ee5;});}return null;};}function removeEntity(_0x10f073,_0x5a517b){return function(_0x25317d){if(_0x25317d){return _0x25317d[_0xbc5e('0x23')]()[_0xbc5e('0x22')](function(){_0x10f073[_0xbc5e('0x16')](0xcc)[_0xbc5e('0x17')]();});}};}function handleEntityNotFound(_0x1fab66,_0x2006c4){return function(_0x54f4c6){if(!_0x54f4c6){_0x1fab66['sendStatus'](0x194);}return _0x54f4c6;};}function handleError(_0x204e5f,_0x559c56){_0x559c56=_0x559c56||0x1f4;return function(_0x55da93){logger[_0xbc5e('0x24')](_0x55da93[_0xbc5e('0x25')]);if(_0x55da93[_0xbc5e('0x26')]){delete _0x55da93['name'];}_0x204e5f['status'](_0x559c56)[_0xbc5e('0x27')](_0x55da93);};}exports[_0xbc5e('0x28')]=function(_0x3cd644,_0x5bf0ea){var _0x54e2a0={},_0x124003={},_0x945ae2={'count':0x0,'rows':[]};var _0x4f63a3=_[_0xbc5e('0x29')](db['VtigerAccount'][_0xbc5e('0x2a')],function(_0x41af7a){return{'name':_0x41af7a[_0xbc5e('0x2b')],'type':_0x41af7a['type']['key']};});_0x124003[_0xbc5e('0x2c')]=_[_0xbc5e('0x29')](_0x4f63a3,'name');_0x124003[_0xbc5e('0x2d')]=_['keys'](_0x3cd644[_0xbc5e('0x2d')]);_0x124003[_0xbc5e('0x2e')]=_[_0xbc5e('0x2f')](_0x124003[_0xbc5e('0x2c')],_0x124003[_0xbc5e('0x2d')]);_0x54e2a0['attributes']=_[_0xbc5e('0x2f')](_0x124003['model'],qs[_0xbc5e('0x30')](_0x3cd644[_0xbc5e('0x2d')][_0xbc5e('0x30')]));_0x54e2a0['attributes']=_0x54e2a0[_0xbc5e('0x31')][_0xbc5e('0x32')]?_0x54e2a0[_0xbc5e('0x31')]:_0x124003[_0xbc5e('0x2c')];if(!_0x3cd644[_0xbc5e('0x2d')][_0xbc5e('0x33')](_0xbc5e('0x34'))){_0x54e2a0[_0xbc5e('0x1b')]=qs[_0xbc5e('0x1b')](_0x3cd644['query'][_0xbc5e('0x1b')]);_0x54e2a0[_0xbc5e('0x19')]=qs[_0xbc5e('0x19')](_0x3cd644[_0xbc5e('0x2d')][_0xbc5e('0x19')]);}_0x54e2a0[_0xbc5e('0x35')]=qs[_0xbc5e('0x36')](_0x3cd644['query'][_0xbc5e('0x36')]);_0x54e2a0['where']=qs[_0xbc5e('0x2e')](_[_0xbc5e('0x37')](_0x3cd644[_0xbc5e('0x2d')],_0x124003[_0xbc5e('0x2e')]),_0x4f63a3);if(_0x3cd644[_0xbc5e('0x2d')]['filter']){_0x54e2a0['where']=_['merge'](_0x54e2a0[_0xbc5e('0x38')],{'$or':_[_0xbc5e('0x29')](_0x4f63a3,function(_0xaa0afa){if(_0xaa0afa['type']!==_0xbc5e('0x39')){var _0x4de79d={};_0x4de79d[_0xaa0afa[_0xbc5e('0x26')]]={'$like':'%'+_0x3cd644[_0xbc5e('0x2d')][_0xbc5e('0x3a')]+'%'};return _0x4de79d;}})});}_0x54e2a0=_[_0xbc5e('0x3b')]({},_0x54e2a0,_0x3cd644[_0xbc5e('0x3c')]);var _0x27bae8={'where':_0x54e2a0[_0xbc5e('0x38')]};return db[_0xbc5e('0x3d')][_0xbc5e('0x1c')](_0x27bae8)[_0xbc5e('0x22')](function(_0x256918){_0x945ae2[_0xbc5e('0x1c')]=_0x256918;if(_0x3cd644[_0xbc5e('0x2d')]['includeAll']){_0x54e2a0['include']=[{'all':!![]}];}return db[_0xbc5e('0x3d')][_0xbc5e('0x3e')](_0x54e2a0);})[_0xbc5e('0x22')](function(_0x3b8eff){_0x945ae2[_0xbc5e('0x3f')]=_0x3b8eff;return _0x945ae2;})['then'](respondWithFilteredResult(_0x5bf0ea,_0x54e2a0))[_0xbc5e('0x40')](handleError(_0x5bf0ea,null));};exports[_0xbc5e('0x41')]=function(_0x50871f,_0x2ceb1f){var _0x239c12={'raw':![],'where':{'id':_0x50871f[_0xbc5e('0x42')]['id']}},_0x5839c2={};_0x5839c2[_0xbc5e('0x2c')]=_[_0xbc5e('0x43')](db[_0xbc5e('0x3d')][_0xbc5e('0x2a')]);_0x5839c2['query']=_[_0xbc5e('0x43')](_0x50871f['query']);_0x5839c2[_0xbc5e('0x2e')]=_[_0xbc5e('0x2f')](_0x5839c2[_0xbc5e('0x2c')],_0x5839c2[_0xbc5e('0x2d')]);_0x239c12[_0xbc5e('0x31')]=_[_0xbc5e('0x2f')](_0x5839c2[_0xbc5e('0x2c')],qs['fields'](_0x50871f[_0xbc5e('0x2d')]['fields']));_0x239c12[_0xbc5e('0x31')]=_0x239c12[_0xbc5e('0x31')]['length']?_0x239c12[_0xbc5e('0x31')]:_0x5839c2[_0xbc5e('0x2c')];if(_0x50871f[_0xbc5e('0x2d')][_0xbc5e('0x44')]){_0x239c12[_0xbc5e('0x45')]=[{'all':!![]}];}_0x239c12=_[_0xbc5e('0x3b')]({},_0x239c12,_0x50871f['options']);return db[_0xbc5e('0x3d')][_0xbc5e('0x46')](_0x239c12)[_0xbc5e('0x22')](handleEntityNotFound(_0x2ceb1f,null))[_0xbc5e('0x22')](respondWithResult(_0x2ceb1f,null))[_0xbc5e('0x40')](handleError(_0x2ceb1f,null));};exports['create']=function(_0x4015ed,_0x5f34de){return db[_0xbc5e('0x3d')][_0xbc5e('0x47')](_0x4015ed[_0xbc5e('0x48')],{})[_0xbc5e('0x22')](respondWithResult(_0x5f34de,0xc9))[_0xbc5e('0x40')](handleError(_0x5f34de,null));};exports[_0xbc5e('0x21')]=function(_0x1448dc,_0xeef1bd){if(_0x1448dc[_0xbc5e('0x48')]['id']){delete _0x1448dc[_0xbc5e('0x48')]['id'];}return db[_0xbc5e('0x3d')][_0xbc5e('0x46')]({'where':{'id':_0x1448dc['params']['id']}})[_0xbc5e('0x22')](handleEntityNotFound(_0xeef1bd,null))[_0xbc5e('0x22')](saveUpdates(_0x1448dc[_0xbc5e('0x48')],null))['then'](respondWithResult(_0xeef1bd,null))[_0xbc5e('0x40')](handleError(_0xeef1bd,null));};exports[_0xbc5e('0x23')]=function(_0x33f890,_0x536c68){return db[_0xbc5e('0x3d')][_0xbc5e('0x46')]({'where':{'id':_0x33f890[_0xbc5e('0x42')]['id']}})[_0xbc5e('0x22')](handleEntityNotFound(_0x536c68,null))[_0xbc5e('0x22')](removeEntity(_0x536c68,null))['catch'](handleError(_0x536c68,null));};exports[_0xbc5e('0x49')]=function(_0x87390c,_0x16f96f,_0x3f5c81){var _0xabe9f1={};var _0x112f01={};var _0x583648;var _0x4d24ab;return db[_0xbc5e('0x3d')]['findOne']({'where':{'id':_0x87390c[_0xbc5e('0x42')]['id']}})['then'](handleEntityNotFound(_0x16f96f,null))['then'](function(_0x3326a9){if(_0x3326a9){_0x583648=_0x3326a9;_0x112f01[_0xbc5e('0x2c')]=_[_0xbc5e('0x43')](db[_0xbc5e('0x4a')][_0xbc5e('0x2a')]);_0x112f01[_0xbc5e('0x2d')]=_[_0xbc5e('0x43')](_0x87390c[_0xbc5e('0x2d')]);_0x112f01[_0xbc5e('0x2e')]=_[_0xbc5e('0x2f')](_0x112f01['model'],_0x112f01[_0xbc5e('0x2d')]);_0xabe9f1[_0xbc5e('0x31')]=_['intersection'](_0x112f01[_0xbc5e('0x2c')],qs[_0xbc5e('0x30')](_0x87390c['query'][_0xbc5e('0x30')]));_0xabe9f1[_0xbc5e('0x31')]=_0xabe9f1['attributes'][_0xbc5e('0x32')]?_0xabe9f1[_0xbc5e('0x31')]:_0x112f01[_0xbc5e('0x2c')];_0xabe9f1[_0xbc5e('0x35')]=qs[_0xbc5e('0x36')](_0x87390c['query'][_0xbc5e('0x36')]);_0xabe9f1[_0xbc5e('0x38')]=qs['filters'](_[_0xbc5e('0x37')](_0x87390c[_0xbc5e('0x2d')],_0x112f01[_0xbc5e('0x2e')]));if(_0x87390c[_0xbc5e('0x2d')][_0xbc5e('0x3a')]){_0xabe9f1['where']=_['merge'](_0xabe9f1['where'],{'$or':_[_0xbc5e('0x29')](_0xabe9f1[_0xbc5e('0x31')],function(_0x2c6d3a){var _0x536e05={};_0x536e05[_0x2c6d3a]={'$like':'%'+_0x87390c[_0xbc5e('0x2d')][_0xbc5e('0x3a')]+'%'};return _0x536e05;})});}_0xabe9f1=_[_0xbc5e('0x3b')]({},_0xabe9f1,_0x87390c[_0xbc5e('0x3c')]);return _0x583648[_0xbc5e('0x49')](_0xabe9f1);}})[_0xbc5e('0x22')](function(_0x58c226){if(_0x58c226){_0x4d24ab=_0x58c226[_0xbc5e('0x32')];if(!_0x87390c[_0xbc5e('0x2d')][_0xbc5e('0x33')](_0xbc5e('0x34'))){_0xabe9f1[_0xbc5e('0x1b')]=qs[_0xbc5e('0x1b')](_0x87390c[_0xbc5e('0x2d')][_0xbc5e('0x1b')]);_0xabe9f1[_0xbc5e('0x19')]=qs[_0xbc5e('0x19')](_0x87390c[_0xbc5e('0x2d')][_0xbc5e('0x19')]);}return _0x583648[_0xbc5e('0x49')](_0xabe9f1);}})[_0xbc5e('0x22')](function(_0x253f6b){if(_0x253f6b){return _0x253f6b?{'count':_0x4d24ab,'rows':_0x253f6b}:null;}})[_0xbc5e('0x22')](respondWithResult(_0x16f96f,null))[_0xbc5e('0x40')](handleError(_0x16f96f,null));};exports[_0xbc5e('0x4b')]=function(_0x4b4356,_0x7ca129,_0x5e51df){if(_0x4b4356['body']['id']){delete _0x4b4356[_0xbc5e('0x48')]['id'];}return db[_0xbc5e('0x3d')][_0xbc5e('0x4c')]({'where':{'id':_0x4b4356[_0xbc5e('0x42')]['id']}})[_0xbc5e('0x22')](handleEntityNotFound(_0x7ca129,null))['then'](function(_0xd4608d){if(_0xd4608d){_0x4b4356[_0xbc5e('0x48')][_0xbc5e('0x4d')]=_0xd4608d['id'];_0x4b4356[_0xbc5e('0x48')][_0xbc5e('0x4e')]=integrations[_0xbc5e('0x4f')](_0x4b4356['body'][_0xbc5e('0x50')],_0x4b4356['body'][_0xbc5e('0x51')]);_0x4b4356[_0xbc5e('0x48')][_0xbc5e('0x52')]=integrations[_0xbc5e('0x53')](_0x4b4356[_0xbc5e('0x48')]['channel'],_0x4b4356[_0xbc5e('0x48')][_0xbc5e('0x51')]);return db['VtigerConfiguration'][_0xbc5e('0x47')](_0x4b4356['body'],{'include':[{'model':db[_0xbc5e('0x54')],'as':_0xbc5e('0x4e')},{'model':db[_0xbc5e('0x54')],'as':'Descriptions'}]});}return null;})[_0xbc5e('0x22')](respondWithResult(_0x7ca129,null))[_0xbc5e('0x40')](handleError(_0x7ca129,null));};var md5=require(_0xbc5e('0x55'));exports[_0xbc5e('0x56')]=function(_0x42b30c,_0x2dfcce,_0x3bf93d){var _0x33f641=null;var _0x4b5784=null;var _0x49c293=null;var _0x82bb92=null;var _0xf56e34='';return db[_0xbc5e('0x3d')]['findOne']({'where':{'id':_0x42b30c['params']['id']},'attributes':['id',_0xbc5e('0x26'),_0xbc5e('0x57'),_0xbc5e('0x58'),_0xbc5e('0x59'),'remoteUri',_0xbc5e('0x5a'),_0xbc5e('0x5b')]})[_0xbc5e('0x22')](handleEntityNotFound(_0x2dfcce,null))[_0xbc5e('0x22')](function(_0x2b6cf9){if(_0x2b6cf9){_0x33f641=_0x2b6cf9['username'];_0x4b5784=_0x2b6cf9[_0xbc5e('0x5b')];_0x49c293=_0x2b6cf9[_0xbc5e('0x59')];_0xf56e34=_0x2b6cf9[_0xbc5e('0x5c')];var _0x3f9549=_0xf56e34[_0xbc5e('0x5d')](-0x1);if(_0x3f9549==='/'){_0xf56e34=_0xf56e34[_0xbc5e('0x5e')](0x0,_0xf56e34['lastIndexOf'](_0x3f9549));}_0x82bb92=util['format'](_0xbc5e('0x5f'),_0xf56e34);var _0x47a491={'method':_0xbc5e('0x60'),'uri':_0x82bb92,'qs':{'operation':_0xbc5e('0x61'),'username':_0x2b6cf9[_0xbc5e('0x57')]},'json':!![]};return rp(_0x47a491);}})[_0xbc5e('0x22')](function(_0x4f8bdd){if(_0x4f8bdd['success']){var _0x4da6cf={'method':_0xbc5e('0x62'),'uri':_0x82bb92,'form':{'operation':_0xbc5e('0x63'),'username':_0x33f641,'accessKey':md5(_0x4f8bdd['result']['token']+_0x4b5784)},'json':!![]};return rp(_0x4da6cf);}})[_0xbc5e('0x22')](function(_0x4ec5d9){if(_0x4ec5d9['success']){var _0x52c91d={'method':_0xbc5e('0x60'),'uri':_0x82bb92,'qs':{'operation':'describe','username':_0x33f641,'sessionName':_0x4ec5d9['result'][_0xbc5e('0x64')],'elementType':_0x49c293},'json':!![]};return rp(_0x52c91d);}})[_0xbc5e('0x22')](function(_0x427d57){if(_0x427d57['success']){var _0x32c733=[_0xbc5e('0x65'),_0xbc5e('0x66'),_0xbc5e('0x67')];_['remove'](_0x427d57[_0xbc5e('0x68')][_0xbc5e('0x30')],function(_0xe5db94){return _0x32c733[_0xbc5e('0x69')](_0xe5db94['type'][_0xbc5e('0x26')]);});_[_0xbc5e('0x6a')](_0x427d57[_0xbc5e('0x68')][_0xbc5e('0x30')],function(_0x408c6){return _0x408c6[_0xbc5e('0x6b')]==='false';});return{'count':_0x427d57[_0xbc5e('0x68')][_0xbc5e('0x30')][_0xbc5e('0x32')],'rows':_[_0xbc5e('0x29')](_0x427d57[_0xbc5e('0x68')]['fields'],function(_0x33f3d7){return{'id':_0x33f3d7[_0xbc5e('0x26')],'name':_0x33f3d7['label'],'custom':_[_0xbc5e('0x6c')](_0x33f3d7[_0xbc5e('0x26')],_0xbc5e('0x6d'))?!![]:![],'options':_0x33f3d7[_0xbc5e('0x51')][_0xbc5e('0x26')]===_0xbc5e('0x6e')&&_0x33f3d7['type'][_0xbc5e('0x6f')][_0xbc5e('0x32')]>0x0?_[_0xbc5e('0x29')](_0x33f3d7[_0xbc5e('0x51')][_0xbc5e('0x6f')],function(_0x1bc060){return{'name':_0x1bc060[_0xbc5e('0x70')],'value':_0x1bc060[_0xbc5e('0x71')]};}):[]};})};}})[_0xbc5e('0x22')](respondWithResult(_0x2dfcce,null))[_0xbc5e('0x40')](function(_0x4ec6e0){console[_0xbc5e('0x72')]('vTiger\x20error:\x20'+_0x4ec6e0);var _0x285a13=_0x42b30c[_0xbc5e('0x2d')][_0xbc5e('0x73')]?0x1f4:_0x4ec6e0[_0xbc5e('0x74')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xbc5e('0x56'),_0x285a13,JSON[_0xbc5e('0x75')](_0x4ec6e0));delete _0x4ec6e0[_0xbc5e('0x26')];if(_0x285a13===0x191){_0x285a13=0x190;}_0x2dfcce[_0xbc5e('0x16')](_0x285a13)[_0xbc5e('0x27')](_0x42b30c[_0xbc5e('0x2d')]['test']?{'message':_0xbc5e('0x76'),'statusCode':_0x4ec6e0[_0xbc5e('0x74')]}:_0x4ec6e0);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index c2269a3..d7aa490 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 _0x99b3=['path','rimraf','../../config/environment','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x576224,_0xd53d85){var _0x3f6fbb=function(_0x3dd085){while(--_0x3dd085){_0x576224['push'](_0x576224['shift']());}};_0x3f6fbb(++_0xd53d85);}(_0x99b3,0x69));var _0x399b=function(_0x112b42,_0x17973a){_0x112b42=_0x112b42-0x0;var _0x767e9a=_0x99b3[_0x112b42];return _0x767e9a;};'use strict';var _=require(_0x399b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x399b('0x1'));var moment=require(_0x399b('0x2'));var BPromise=require(_0x399b('0x3'));var rp=require(_0x399b('0x4'));var fs=require('fs');var path=require(_0x399b('0x5'));var rimraf=require(_0x399b('0x6'));var config=require(_0x399b('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x399b('0x8'));module['exports']=function(_0x3019ad,_0x57a381){return _0x3019ad['define'](_0x399b('0x9'),attributes,{'tableName':_0x399b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce70=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','exports'];(function(_0x4c7e93,_0x17454b){var _0x4c2901=function(_0x41cf1b){while(--_0x41cf1b){_0x4c7e93['push'](_0x4c7e93['shift']());}};_0x4c2901(++_0x17454b);}(_0xce70,0xe0));var _0x0ce7=function(_0x5ac72d,_0x20aca1){_0x5ac72d=_0x5ac72d-0x0;var _0xc3755d=_0xce70[_0x5ac72d];return _0xc3755d;};'use strict';var _=require(_0x0ce7('0x0'));var util=require(_0x0ce7('0x1'));var logger=require(_0x0ce7('0x2'))(_0x0ce7('0x3'));var moment=require(_0x0ce7('0x4'));var BPromise=require('bluebird');var rp=require(_0x0ce7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ce7('0x6'));var config=require(_0x0ce7('0x7'));var attributes=require(_0x0ce7('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x0ce7('0x9')]=function(_0x49a7e8,_0x2e7265){return _0x49a7e8[_0x0ce7('0xa')](_0x0ce7('0xb'),attributes,{'tableName':_0x0ce7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 4d2f482..f77f01e 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 _0xe511=['find','attributes','ShowVtigerAccount','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','then'];(function(_0x40b723,_0x118b22){var _0x1981ad=function(_0x1dbe18){while(--_0x1dbe18){_0x40b723['push'](_0x40b723['shift']());}};_0x1981ad(++_0x118b22);}(_0xe511,0x16f));var _0x1e51=function(_0x182455,_0x162dfe){_0x182455=_0x182455-0x0;var _0x1b4bd6=_0xe511[_0x182455];return _0x1b4bd6;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['findAll']({'raw':_0x27dcad[_0x1e51('0x16')]?_0x27dcad['options'][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x18')]||null:null,'attributes':_0x27dcad['options']?_0x27dcad['options']['attributes']||null:null,'limit':_0x27dcad['options']?_0x27dcad[_0x1e51('0x16')]['limit']||null:null,'include':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')],function(_0x270adf){return{'model':db[_0x270adf[_0x1e51('0x1b')]],'as':_0x270adf['as'],'attributes':_0x270adf['attributes'],'include':_0x270adf['include']?_[_0x1e51('0x1a')](_0x270adf[_0x1e51('0x19')],function(_0x2e42b1){return{'model':db[_0x2e42b1[_0x1e51('0x1b')]],'as':_0x2e42b1['as'],'attributes':_0x2e42b1['attributes'],'include':_0x2e42b1['include']?_['map'](_0x2e42b1[_0x1e51('0x19')],function(_0x2a1561){return{'model':db[_0x2a1561[_0x1e51('0x1b')]],'as':_0x2a1561['as'],'attributes':_0x2a1561['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x49c507){logger['info'](_0x1e51('0x14'),_0x27dcad);logger['debug'](_0x1e51('0x14'),_0x27dcad,JSON[_0x1e51('0xf')](_0x49c507));_0x4785a5(_0x49c507);})['catch'](function(_0x3e6ef2){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3e6ef2[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c['error'](0x1f4,_0x3e6ef2['message']));});});};exports['ShowVtigerAccount']=function(_0x20eb9b){var _0x288b50=this;return new Promise(function(_0x1ba84a,_0x36dabe){return db[_0x1e51('0x15')][_0x1e51('0x1d')]({'raw':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['where']||null:null,'attributes':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x1e')]||null:null,'include':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['include']?_[_0x1e51('0x1a')](_0x20eb9b['options'][_0x1e51('0x19')],function(_0x3fb57e){return{'model':db[_0x3fb57e[_0x1e51('0x1b')]],'as':_0x3fb57e['as'],'attributes':_0x3fb57e['attributes'],'include':_0x3fb57e[_0x1e51('0x19')]?_['map'](_0x3fb57e[_0x1e51('0x19')],function(_0x4e0187){return{'model':db[_0x4e0187['model']],'as':_0x4e0187['as'],'attributes':_0x4e0187[_0x1e51('0x1e')],'include':_0x4e0187[_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x4e0187['include'],function(_0x42ac30){return{'model':db[_0x42ac30['model']],'as':_0x42ac30['as'],'attributes':_0x42ac30[_0x1e51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x5760ba){logger[_0x1e51('0xa')](_0x1e51('0x1f'),_0x20eb9b);logger[_0x1e51('0xd')](_0x1e51('0x1f'),_0x20eb9b,JSON[_0x1e51('0xf')](_0x5760ba));_0x1ba84a(_0x5760ba);})[_0x1e51('0x20')](function(_0x5c57a6){logger['error'](_0x1e51('0x1f'),_0x5c57a6['message'],_0x20eb9b);_0x36dabe(_0x288b50[_0x1e51('0x10')](0x1f4,_0x5c57a6[_0x1e51('0x12')]));});});}; \ No newline at end of file +var _0xd914=['raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0xd914,0x17f));var _0x4d91=function(_0x4ea955,_0x1eda76){_0x4ea955=_0x4ea955-0x0;var _0x558561=_0xd914[_0x4ea955];return _0x558561;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175ce3,_0x27c0d5,_0x22f2a4){return new BPromise(function(_0x150767,_0x3016c0){return client[_0x4d91('0xb')](_0x175ce3,_0x22f2a4)['then'](function(_0x37bde4){logger[_0x4d91('0xc')](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));logger[_0x4d91('0xf')](_0x4d91('0x10'),_0x27c0d5,'request\x20sent',JSON['stringify'](_0x37bde4));if(_0x37bde4[_0x4d91('0x11')]){if(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x12')]===0x1f4){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')]['message']);return _0x3016c0(_0x37bde4['error'][_0x4d91('0x13')]);}logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);return _0x150767(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);}else{logger['info'](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));_0x150767(_0x37bde4[_0x4d91('0x14')][_0x4d91('0x13')]);}})[_0x4d91('0x15')](function(_0x554ca8){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x554ca8);_0x3016c0(_0x554ca8);});});}exports[_0x4d91('0x16')]=function(_0x44b9a7){var _0x4cfa40=this;return new Promise(function(_0x350e23,_0x3b579b){return db[_0x4d91('0x17')]['findAll']({'raw':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x19')]===undefined?!![]:![]:!![],'where':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1a')]||null:null,'attributes':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1b')]||null:null,'limit':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7['options'][_0x4d91('0x1c')]||null:null,'include':_0x44b9a7['options']?_0x44b9a7['options'][_0x4d91('0x1d')]?_[_0x4d91('0x1e')](_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1d')],function(_0x7d8cbf){return{'model':db[_0x7d8cbf[_0x4d91('0x1f')]],'as':_0x7d8cbf['as'],'attributes':_0x7d8cbf[_0x4d91('0x1b')],'include':_0x7d8cbf[_0x4d91('0x1d')]?_['map'](_0x7d8cbf['include'],function(_0x1ee6b3){return{'model':db[_0x1ee6b3[_0x4d91('0x1f')]],'as':_0x1ee6b3['as'],'attributes':_0x1ee6b3[_0x4d91('0x1b')],'include':_0x1ee6b3[_0x4d91('0x1d')]?_[_0x4d91('0x1e')](_0x1ee6b3[_0x4d91('0x1d')],function(_0x14bdb4){return{'model':db[_0x14bdb4['model']],'as':_0x14bdb4['as'],'attributes':_0x14bdb4[_0x4d91('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4d91('0x20')](function(_0x12ac74){logger['info']('GetVtigerAccount',_0x44b9a7);logger[_0x4d91('0xf')](_0x4d91('0x16'),_0x44b9a7,JSON['stringify'](_0x12ac74));_0x350e23(_0x12ac74);})['catch'](function(_0x42d5a0){logger[_0x4d91('0x11')](_0x4d91('0x16'),_0x42d5a0[_0x4d91('0x13')],_0x44b9a7);_0x3b579b(_0x4cfa40['error'](0x1f4,_0x42d5a0[_0x4d91('0x13')]));});});};exports[_0x4d91('0x21')]=function(_0x468e95){var _0xee7535=this;return new Promise(function(_0xa63422,_0x3466f3){return db[_0x4d91('0x17')]['find']({'raw':_0x468e95[_0x4d91('0x18')]?_0x468e95['options']['raw']===undefined?!![]:![]:!![],'where':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')]['where']||null:null,'attributes':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')][_0x4d91('0x1b')]||null:null,'include':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')]['include']?_[_0x4d91('0x1e')](_0x468e95[_0x4d91('0x18')][_0x4d91('0x1d')],function(_0x2b8131){return{'model':db[_0x2b8131[_0x4d91('0x1f')]],'as':_0x2b8131['as'],'attributes':_0x2b8131[_0x4d91('0x1b')],'include':_0x2b8131['include']?_[_0x4d91('0x1e')](_0x2b8131[_0x4d91('0x1d')],function(_0x5c2247){return{'model':db[_0x5c2247[_0x4d91('0x1f')]],'as':_0x5c2247['as'],'attributes':_0x5c2247[_0x4d91('0x1b')],'include':_0x5c2247[_0x4d91('0x1d')]?_['map'](_0x5c2247[_0x4d91('0x1d')],function(_0x2c8b54){return{'model':db[_0x2c8b54[_0x4d91('0x1f')]],'as':_0x2c8b54['as'],'attributes':_0x2c8b54[_0x4d91('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x64cee3){logger[_0x4d91('0xc')](_0x4d91('0x21'),_0x468e95);logger[_0x4d91('0xf')]('ShowVtigerAccount',_0x468e95,JSON['stringify'](_0x64cee3));_0xa63422(_0x64cee3);})[_0x4d91('0x15')](function(_0x3dac76){logger['error'](_0x4d91('0x21'),_0x3dac76[_0x4d91('0x13')],_0x468e95);_0x3466f3(_0xee7535[_0x4d91('0x11')](0x1f4,_0x3dac76[_0x4d91('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 7d8083c..aa7cfee 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 _0xc0b1=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0xc0b1,0x1ad));var _0x1c0b=function(_0x3a60b8,_0x47caab){_0x3a60b8=_0x3a60b8-0x0;var _0x4eb583=_0xc0b1[_0x3a60b8];return _0x4eb583;};'use strict';var multer=require(_0x1c0b('0x0'));var util=require(_0x1c0b('0x1'));var path=require(_0x1c0b('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c0b('0x3'));var router=express['Router']();var fs_extra=require(_0x1c0b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1c0b('0x5'));var config=require(_0x1c0b('0x6'));var controller=require(_0x1c0b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1c0b('0x8')]);router[_0x1c0b('0x9')](_0x1c0b('0xa'),auth['isAuthenticated'](),controller[_0x1c0b('0xb')]);router['get'](_0x1c0b('0xc'),auth[_0x1c0b('0xd')](),controller[_0x1c0b('0xe')]);router[_0x1c0b('0x9')]('/:id/subjects',auth[_0x1c0b('0xd')](),controller[_0x1c0b('0xf')]);router[_0x1c0b('0x9')](_0x1c0b('0x10'),auth['isAuthenticated'](),controller[_0x1c0b('0x11')]);router[_0x1c0b('0x12')]('/',auth[_0x1c0b('0xd')](),controller[_0x1c0b('0x13')]);router[_0x1c0b('0x14')](_0x1c0b('0xa'),auth[_0x1c0b('0xd')](),controller[_0x1c0b('0x15')]);router[_0x1c0b('0x16')](_0x1c0b('0xa'),auth[_0x1c0b('0xd')](),controller[_0x1c0b('0x17')]);module[_0x1c0b('0x18')]=router; \ No newline at end of file +var _0x4428=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','/:id','get','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x4428,0xb0));var _0x8442=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x4428[_0x26462c];return _0x509a42;};'use strict';var multer=require('multer');var util=require(_0x8442('0x0'));var path=require(_0x8442('0x1'));var timeout=require(_0x8442('0x2'));var express=require(_0x8442('0x3'));var router=express[_0x8442('0x4')]();var fs_extra=require(_0x8442('0x5'));var auth=require(_0x8442('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8442('0x7'));var controller=require(_0x8442('0x8'));router['get']('/',auth[_0x8442('0x9')](),controller[_0x8442('0xa')]);router['get'](_0x8442('0xb'),auth[_0x8442('0x9')](),controller['show']);router[_0x8442('0xc')]('/:id/fields',auth[_0x8442('0x9')](),controller[_0x8442('0xd')]);router[_0x8442('0xc')](_0x8442('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x8442('0xf'),auth['isAuthenticated'](),controller[_0x8442('0x10')]);router[_0x8442('0x11')]('/',auth[_0x8442('0x9')](),controller[_0x8442('0x12')]);router[_0x8442('0x13')](_0x8442('0xb'),auth[_0x8442('0x9')](),controller['update']);router['delete'](_0x8442('0xb'),auth['isAuthenticated'](),controller[_0x8442('0x14')]);module[_0x8442('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 edc7fdd..d338afd 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 _0x667c=['sequelize','exports','STRING'];(function(_0x55a76d,_0x373bdb){var _0x281fc3=function(_0x5176b9){while(--_0x5176b9){_0x55a76d['push'](_0x55a76d['shift']());}};_0x281fc3(++_0x373bdb);}(_0x667c,0x183));var _0xc667=function(_0x40bf0c,_0x453d4f){_0x40bf0c=_0x40bf0c-0x0;var _0x9fd479=_0x667c[_0x40bf0c];return _0x9fd479;};'use strict';var Sequelize=require(_0xc667('0x0'));module[_0xc667('0x1')]={'name':{'type':Sequelize[_0xc667('0x2')]},'description':{'type':Sequelize[_0xc667('0x2')]}}; \ No newline at end of file +var _0xb803=['exports'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0xb803,0x175));var _0x3b80=function(_0x31da91,_0x300a94){_0x31da91=_0x31da91-0x0;var _0x499aa0=_0xb803[_0x31da91];return _0x499aa0;};'use strict';var Sequelize=require('sequelize');module[_0x3b80('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a59250d..8cb70bb 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 _0xd030=['error','name','send','index','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','VtigerConfiguration','include','findAll','rows','show','rawAttributes','merge','catch','create','body','params','findOne','VtigerField','length','getFields','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x46fc0e,_0x375bcc){var _0x4f03e2=function(_0xd2994c){while(--_0xd2994c){_0x46fc0e['push'](_0x46fc0e['shift']());}};_0x4f03e2(++_0x375bcc);}(_0xd030,0x16c));var _0x0d03=function(_0x2b95a2,_0x1ac7cb){_0x2b95a2=_0x2b95a2-0x0;var _0x1c2433=_0xd030[_0x2b95a2];return _0x1c2433;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d03('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d03('0x1'));var rp=require(_0x0d03('0x2'));var moment=require(_0x0d03('0x3'));var BPromise=require(_0x0d03('0x4'));var Mustache=require(_0x0d03('0x5'));var util=require(_0x0d03('0x6'));var path=require(_0x0d03('0x7'));var sox=require(_0x0d03('0x8'));var csv=require('to-csv');var ejs=require(_0x0d03('0x9'));var fs=require('fs');var fs_extra=require(_0x0d03('0xa'));var _=require('lodash');var squel=require(_0x0d03('0xb'));var crypto=require('crypto');var jsforce=require(_0x0d03('0xc'));var deskjs=require(_0x0d03('0xd'));var toCsv=require(_0x0d03('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0d03('0xf'));var qs=require(_0x0d03('0x10'));var as=require(_0x0d03('0x11'));var hardwareService=require(_0x0d03('0x12'));var logger=require(_0x0d03('0x13'))(_0x0d03('0x14'));var utils=require(_0x0d03('0x15'));var config=require(_0x0d03('0x16'));var licenseUtil=require(_0x0d03('0x17'));var db=require(_0x0d03('0x18'))['db'];function respondWithStatusCode(_0x59adf5,_0x2ccbb4){_0x2ccbb4=_0x2ccbb4||0xcc;return function(_0x7bc9f6){if(_0x7bc9f6){return _0x59adf5[_0x0d03('0x19')](_0x2ccbb4);}return _0x59adf5['status'](_0x2ccbb4)[_0x0d03('0x1a')]();};}function respondWithResult(_0x426f52,_0x24b53e){_0x24b53e=_0x24b53e||0xc8;return function(_0x4c8db5){if(_0x4c8db5){return _0x426f52[_0x0d03('0x1b')](_0x24b53e)[_0x0d03('0x1c')](_0x4c8db5);}};}function respondWithFilteredResult(_0x3d2050,_0x35c7f2){return function(_0x57dc67){if(_0x57dc67){var _0x40ec9b=typeof _0x35c7f2[_0x0d03('0x1d')]===_0x0d03('0x1e')&&typeof _0x35c7f2['limit']===_0x0d03('0x1e');var _0x120fe8=_0x57dc67[_0x0d03('0x1f')];var _0xb2bdd2=_0x40ec9b?0x0:_0x35c7f2[_0x0d03('0x1d')];var _0x1e8703=_0x40ec9b?_0x57dc67[_0x0d03('0x1f')]:_0x35c7f2[_0x0d03('0x1d')]+_0x35c7f2[_0x0d03('0x20')];var _0x587309;if(_0x1e8703>=_0x120fe8){_0x1e8703=_0x120fe8;_0x587309=0xc8;}else{_0x587309=0xce;}_0x3d2050[_0x0d03('0x1b')](_0x587309);return _0x3d2050[_0x0d03('0x21')](_0x0d03('0x22'),_0xb2bdd2+'-'+_0x1e8703+'/'+_0x120fe8)['json'](_0x57dc67);}return null;};}function patchUpdates(_0x406968){return function(_0x5debae){try{jsonpatch[_0x0d03('0x23')](_0x5debae,_0x406968,!![]);}catch(_0x2dcc7e){return BPromise[_0x0d03('0x24')](_0x2dcc7e);}return _0x5debae[_0x0d03('0x25')]();};}function saveUpdates(_0xb0bc9b,_0x34b8d9){return function(_0x15a996){if(_0x15a996){return _0x15a996[_0x0d03('0x26')](_0xb0bc9b)[_0x0d03('0x27')](function(_0x429989){return _0x429989;});}return null;};}function removeEntity(_0x5a67d0,_0x7b33d8){return function(_0x5c524c){if(_0x5c524c){return _0x5c524c[_0x0d03('0x28')]()['then'](function(){_0x5a67d0[_0x0d03('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507ef7,_0xacdace){return function(_0x4e0a20){if(!_0x4e0a20){_0x507ef7[_0x0d03('0x19')](0x194);}return _0x4e0a20;};}function handleError(_0x275554,_0x51fe7e){_0x51fe7e=_0x51fe7e||0x1f4;return function(_0x2d9376){logger[_0x0d03('0x29')](_0x2d9376['stack']);if(_0x2d9376[_0x0d03('0x2a')]){delete _0x2d9376[_0x0d03('0x2a')];}_0x275554[_0x0d03('0x1b')](_0x51fe7e)[_0x0d03('0x2b')](_0x2d9376);};}exports[_0x0d03('0x2c')]=function(_0x198318,_0x4ebc9c){var _0x467fd3={},_0x2b8827={},_0x228d00={'count':0x0,'rows':[]};var _0x1e71ae=_[_0x0d03('0x2d')](db['VtigerConfiguration']['rawAttributes'],function(_0x524af7){return{'name':_0x524af7[_0x0d03('0x2e')],'type':_0x524af7[_0x0d03('0x2f')][_0x0d03('0x30')]};});_0x2b8827[_0x0d03('0x31')]=_['map'](_0x1e71ae,_0x0d03('0x2a'));_0x2b8827['query']=_[_0x0d03('0x32')](_0x198318[_0x0d03('0x33')]);_0x2b8827['filters']=_[_0x0d03('0x34')](_0x2b8827[_0x0d03('0x31')],_0x2b8827['query']);_0x467fd3['attributes']=_[_0x0d03('0x34')](_0x2b8827[_0x0d03('0x31')],qs[_0x0d03('0x35')](_0x198318['query']['fields']));_0x467fd3[_0x0d03('0x36')]=_0x467fd3[_0x0d03('0x36')]['length']?_0x467fd3['attributes']:_0x2b8827[_0x0d03('0x31')];if(!_0x198318[_0x0d03('0x33')][_0x0d03('0x37')](_0x0d03('0x38'))){_0x467fd3['limit']=qs[_0x0d03('0x20')](_0x198318[_0x0d03('0x33')]['limit']);_0x467fd3[_0x0d03('0x1d')]=qs[_0x0d03('0x1d')](_0x198318[_0x0d03('0x33')][_0x0d03('0x1d')]);}_0x467fd3[_0x0d03('0x39')]=qs[_0x0d03('0x3a')](_0x198318[_0x0d03('0x33')]['sort']);_0x467fd3[_0x0d03('0x3b')]=qs[_0x0d03('0x3c')](_[_0x0d03('0x3d')](_0x198318[_0x0d03('0x33')],_0x2b8827[_0x0d03('0x3c')]),_0x1e71ae);if(_0x198318['query'][_0x0d03('0x3e')]){_0x467fd3['where']=_['merge'](_0x467fd3['where'],{'$or':_[_0x0d03('0x2d')](_0x1e71ae,function(_0x5773e7){if(_0x5773e7[_0x0d03('0x2f')]!=='VIRTUAL'){var _0x3f590e={};_0x3f590e[_0x5773e7[_0x0d03('0x2a')]]={'$like':'%'+_0x198318['query'][_0x0d03('0x3e')]+'%'};return _0x3f590e;}})});}_0x467fd3=_['merge']({},_0x467fd3,_0x198318[_0x0d03('0x3f')]);var _0x9831be={'where':_0x467fd3['where']};return db[_0x0d03('0x40')][_0x0d03('0x1f')](_0x9831be)[_0x0d03('0x27')](function(_0x3df5f2){_0x228d00[_0x0d03('0x1f')]=_0x3df5f2;if(_0x198318[_0x0d03('0x33')]['includeAll']){_0x467fd3[_0x0d03('0x41')]=[{'all':!![]}];}return db[_0x0d03('0x40')][_0x0d03('0x42')](_0x467fd3);})[_0x0d03('0x27')](function(_0x1724f9){_0x228d00[_0x0d03('0x43')]=_0x1724f9;return _0x228d00;})[_0x0d03('0x27')](respondWithFilteredResult(_0x4ebc9c,_0x467fd3))['catch'](handleError(_0x4ebc9c,null));};exports[_0x0d03('0x44')]=function(_0x376b48,_0x1f7d99){var _0x2806eb={'raw':![],'where':{'id':_0x376b48['params']['id']}},_0x4f6a67={};_0x4f6a67[_0x0d03('0x31')]=_[_0x0d03('0x32')](db['VtigerConfiguration'][_0x0d03('0x45')]);_0x4f6a67[_0x0d03('0x33')]=_[_0x0d03('0x32')](_0x376b48[_0x0d03('0x33')]);_0x4f6a67[_0x0d03('0x3c')]=_[_0x0d03('0x34')](_0x4f6a67[_0x0d03('0x31')],_0x4f6a67[_0x0d03('0x33')]);_0x2806eb[_0x0d03('0x36')]=_[_0x0d03('0x34')](_0x4f6a67[_0x0d03('0x31')],qs[_0x0d03('0x35')](_0x376b48[_0x0d03('0x33')][_0x0d03('0x35')]));_0x2806eb[_0x0d03('0x36')]=_0x2806eb[_0x0d03('0x36')]['length']?_0x2806eb[_0x0d03('0x36')]:_0x4f6a67[_0x0d03('0x31')];if(_0x376b48[_0x0d03('0x33')]['includeAll']){_0x2806eb['include']=[{'all':!![]}];}_0x2806eb=_[_0x0d03('0x46')]({},_0x2806eb,_0x376b48[_0x0d03('0x3f')]);return db[_0x0d03('0x40')]['find'](_0x2806eb)[_0x0d03('0x27')](handleEntityNotFound(_0x1f7d99,null))[_0x0d03('0x27')](respondWithResult(_0x1f7d99,null))[_0x0d03('0x47')](handleError(_0x1f7d99,null));};exports[_0x0d03('0x48')]=function(_0x3957f6,_0x1b8606){return db[_0x0d03('0x40')][_0x0d03('0x48')](_0x3957f6[_0x0d03('0x49')],{})[_0x0d03('0x27')](respondWithResult(_0x1b8606,0xc9))[_0x0d03('0x47')](handleError(_0x1b8606,null));};exports[_0x0d03('0x26')]=function(_0x4d811c,_0x206907){if(_0x4d811c[_0x0d03('0x49')]['id']){delete _0x4d811c[_0x0d03('0x49')]['id'];}return db[_0x0d03('0x40')]['find']({'where':{'id':_0x4d811c[_0x0d03('0x4a')]['id']}})['then'](handleEntityNotFound(_0x206907,null))[_0x0d03('0x27')](saveUpdates(_0x4d811c[_0x0d03('0x49')],null))[_0x0d03('0x27')](respondWithResult(_0x206907,null))['catch'](handleError(_0x206907,null));};exports[_0x0d03('0x28')]=function(_0x501573,_0xe64935){return db[_0x0d03('0x40')]['find']({'where':{'id':_0x501573[_0x0d03('0x4a')]['id']}})[_0x0d03('0x27')](handleEntityNotFound(_0xe64935,null))[_0x0d03('0x27')](removeEntity(_0xe64935,null))[_0x0d03('0x47')](handleError(_0xe64935,null));};exports['getFields']=function(_0x9b127e,_0x314a31,_0x2ea269){var _0x2b0715={};var _0x30e9c6={};var _0x49096e;var _0x1a2d5a;return db[_0x0d03('0x40')][_0x0d03('0x4b')]({'where':{'id':_0x9b127e['params']['id']}})[_0x0d03('0x27')](handleEntityNotFound(_0x314a31,null))[_0x0d03('0x27')](function(_0x1c6aef){if(_0x1c6aef){_0x49096e=_0x1c6aef;_0x30e9c6['model']=_[_0x0d03('0x32')](db[_0x0d03('0x4c')][_0x0d03('0x45')]);_0x30e9c6[_0x0d03('0x33')]=_[_0x0d03('0x32')](_0x9b127e['query']);_0x30e9c6['filters']=_[_0x0d03('0x34')](_0x30e9c6[_0x0d03('0x31')],_0x30e9c6['query']);_0x2b0715['attributes']=_[_0x0d03('0x34')](_0x30e9c6[_0x0d03('0x31')],qs[_0x0d03('0x35')](_0x9b127e[_0x0d03('0x33')][_0x0d03('0x35')]));_0x2b0715[_0x0d03('0x36')]=_0x2b0715[_0x0d03('0x36')][_0x0d03('0x4d')]?_0x2b0715[_0x0d03('0x36')]:_0x30e9c6[_0x0d03('0x31')];_0x2b0715[_0x0d03('0x39')]=qs[_0x0d03('0x3a')](_0x9b127e[_0x0d03('0x33')][_0x0d03('0x3a')]);_0x2b0715[_0x0d03('0x3b')]=qs['filters'](_[_0x0d03('0x3d')](_0x9b127e[_0x0d03('0x33')],_0x30e9c6[_0x0d03('0x3c')]));if(_0x9b127e[_0x0d03('0x33')][_0x0d03('0x3e')]){_0x2b0715['where']=_['merge'](_0x2b0715['where'],{'$or':_[_0x0d03('0x2d')](_0x2b0715[_0x0d03('0x36')],function(_0xbff8d6){var _0x8de93e={};_0x8de93e[_0xbff8d6]={'$like':'%'+_0x9b127e[_0x0d03('0x33')][_0x0d03('0x3e')]+'%'};return _0x8de93e;})});}_0x2b0715=_['merge']({},_0x2b0715,_0x9b127e[_0x0d03('0x3f')]);return _0x49096e[_0x0d03('0x4e')](_0x2b0715);}})[_0x0d03('0x27')](function(_0x53dff1){if(_0x53dff1){_0x1a2d5a=_0x53dff1['length'];if(!_0x9b127e[_0x0d03('0x33')]['hasOwnProperty'](_0x0d03('0x38'))){_0x2b0715[_0x0d03('0x20')]=qs[_0x0d03('0x20')](_0x9b127e[_0x0d03('0x33')]['limit']);_0x2b0715[_0x0d03('0x1d')]=qs[_0x0d03('0x1d')](_0x9b127e['query']['offset']);}return _0x49096e[_0x0d03('0x4e')](_0x2b0715);}})[_0x0d03('0x27')](function(_0xd51a3a){if(_0xd51a3a){return _0xd51a3a?{'count':_0x1a2d5a,'rows':_0xd51a3a}:null;}})[_0x0d03('0x27')](respondWithResult(_0x314a31,null))[_0x0d03('0x47')](handleError(_0x314a31,null));};exports[_0x0d03('0x4f')]=function(_0x7f601,_0x4f0bb9,_0x542845){var _0x1615a9={};var _0x80cda4={};var _0x4ea9e5;var _0x110f3f;return db[_0x0d03('0x40')]['findOne']({'where':{'id':_0x7f601[_0x0d03('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f0bb9,null))[_0x0d03('0x27')](function(_0x19cb0f){if(_0x19cb0f){_0x4ea9e5=_0x19cb0f;_0x80cda4[_0x0d03('0x31')]=_['keys'](db[_0x0d03('0x4c')][_0x0d03('0x45')]);_0x80cda4[_0x0d03('0x33')]=_[_0x0d03('0x32')](_0x7f601[_0x0d03('0x33')]);_0x80cda4[_0x0d03('0x3c')]=_[_0x0d03('0x34')](_0x80cda4[_0x0d03('0x31')],_0x80cda4['query']);_0x1615a9[_0x0d03('0x36')]=_[_0x0d03('0x34')](_0x80cda4['model'],qs['fields'](_0x7f601[_0x0d03('0x33')]['fields']));_0x1615a9[_0x0d03('0x36')]=_0x1615a9['attributes'][_0x0d03('0x4d')]?_0x1615a9[_0x0d03('0x36')]:_0x80cda4[_0x0d03('0x31')];_0x1615a9['order']=qs['sort'](_0x7f601[_0x0d03('0x33')][_0x0d03('0x3a')]);_0x1615a9['where']=qs['filters'](_[_0x0d03('0x3d')](_0x7f601[_0x0d03('0x33')],_0x80cda4['filters']));if(_0x7f601[_0x0d03('0x33')][_0x0d03('0x3e')]){_0x1615a9['where']=_['merge'](_0x1615a9[_0x0d03('0x3b')],{'$or':_['map'](_0x1615a9[_0x0d03('0x36')],function(_0x3a76ba){var _0x5e0f61={};_0x5e0f61[_0x3a76ba]={'$like':'%'+_0x7f601[_0x0d03('0x33')]['filter']+'%'};return _0x5e0f61;})});}_0x1615a9=_['merge']({},_0x1615a9,_0x7f601[_0x0d03('0x3f')]);return _0x4ea9e5[_0x0d03('0x4f')](_0x1615a9);}})['then'](function(_0x5b4bb0){if(_0x5b4bb0){_0x110f3f=_0x5b4bb0[_0x0d03('0x4d')];if(!_0x7f601[_0x0d03('0x33')]['hasOwnProperty']('nolimit')){_0x1615a9[_0x0d03('0x20')]=qs[_0x0d03('0x20')](_0x7f601[_0x0d03('0x33')][_0x0d03('0x20')]);_0x1615a9[_0x0d03('0x1d')]=qs['offset'](_0x7f601[_0x0d03('0x33')][_0x0d03('0x1d')]);}return _0x4ea9e5['getSubjects'](_0x1615a9);}})[_0x0d03('0x27')](function(_0x4e7fdd){if(_0x4e7fdd){return _0x4e7fdd?{'count':_0x110f3f,'rows':_0x4e7fdd}:null;}})['then'](respondWithResult(_0x4f0bb9,null))[_0x0d03('0x47')](handleError(_0x4f0bb9,null));};exports[_0x0d03('0x50')]=function(_0x273aa0,_0x5a0bf6,_0x38567c){var _0x37e626={};var _0x1c2011={};var _0x117ec1;var _0x4d611a;return db['VtigerConfiguration'][_0x0d03('0x4b')]({'where':{'id':_0x273aa0[_0x0d03('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5a0bf6,null))['then'](function(_0xb213d3){if(_0xb213d3){_0x117ec1=_0xb213d3;_0x1c2011[_0x0d03('0x31')]=_[_0x0d03('0x32')](db['VtigerField'][_0x0d03('0x45')]);_0x1c2011[_0x0d03('0x33')]=_['keys'](_0x273aa0[_0x0d03('0x33')]);_0x1c2011[_0x0d03('0x3c')]=_[_0x0d03('0x34')](_0x1c2011['model'],_0x1c2011[_0x0d03('0x33')]);_0x37e626[_0x0d03('0x36')]=_[_0x0d03('0x34')](_0x1c2011[_0x0d03('0x31')],qs[_0x0d03('0x35')](_0x273aa0['query'][_0x0d03('0x35')]));_0x37e626['attributes']=_0x37e626[_0x0d03('0x36')]['length']?_0x37e626[_0x0d03('0x36')]:_0x1c2011[_0x0d03('0x31')];_0x37e626[_0x0d03('0x39')]=qs[_0x0d03('0x3a')](_0x273aa0[_0x0d03('0x33')][_0x0d03('0x3a')]);_0x37e626[_0x0d03('0x3b')]=qs[_0x0d03('0x3c')](_[_0x0d03('0x3d')](_0x273aa0[_0x0d03('0x33')],_0x1c2011[_0x0d03('0x3c')]));if(_0x273aa0[_0x0d03('0x33')][_0x0d03('0x3e')]){_0x37e626[_0x0d03('0x3b')]=_['merge'](_0x37e626[_0x0d03('0x3b')],{'$or':_['map'](_0x37e626[_0x0d03('0x36')],function(_0xefb8ea){var _0x261559={};_0x261559[_0xefb8ea]={'$like':'%'+_0x273aa0['query'][_0x0d03('0x3e')]+'%'};return _0x261559;})});}_0x37e626=_[_0x0d03('0x46')]({},_0x37e626,_0x273aa0[_0x0d03('0x3f')]);return _0x117ec1[_0x0d03('0x50')](_0x37e626);}})['then'](function(_0x3e0088){if(_0x3e0088){_0x4d611a=_0x3e0088[_0x0d03('0x4d')];if(!_0x273aa0[_0x0d03('0x33')]['hasOwnProperty']('nolimit')){_0x37e626[_0x0d03('0x20')]=qs[_0x0d03('0x20')](_0x273aa0[_0x0d03('0x33')][_0x0d03('0x20')]);_0x37e626[_0x0d03('0x1d')]=qs['offset'](_0x273aa0[_0x0d03('0x33')][_0x0d03('0x1d')]);}return _0x117ec1[_0x0d03('0x50')](_0x37e626);}})[_0x0d03('0x27')](function(_0xcce016){if(_0xcce016){return _0xcce016?{'count':_0x4d611a,'rows':_0xcce016}:null;}})[_0x0d03('0x27')](respondWithResult(_0x5a0bf6,null))['catch'](handleError(_0x5a0bf6,null));}; \ No newline at end of file +var _0x87e7=['count','Content-Range','apply','reject','save','update','then','sendStatus','stack','send','index','VtigerConfiguration','key','model','name','query','keys','filters','intersection','attributes','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','getFields','findOne','VtigerField','rawAttributes','order','map','length','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x434b9c,_0x1a460a){var _0x39c455=function(_0x206b3b){while(--_0x206b3b){_0x434b9c['push'](_0x434b9c['shift']());}};_0x39c455(++_0x1a460a);}(_0x87e7,0x11e));var _0x787e=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0x87e7[_0x473ee7];return _0x30f0d4;};'use strict';var emlformat=require(_0x787e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x787e('0x1'));var jsonpatch=require(_0x787e('0x2'));var rp=require('request-promise');var moment=require(_0x787e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x787e('0x4'));var util=require(_0x787e('0x5'));var path=require(_0x787e('0x6'));var sox=require(_0x787e('0x7'));var csv=require(_0x787e('0x8'));var ejs=require(_0x787e('0x9'));var fs=require('fs');var fs_extra=require(_0x787e('0xa'));var _=require(_0x787e('0xb'));var squel=require(_0x787e('0xc'));var crypto=require(_0x787e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x787e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x787e('0xf'));var Papa=require(_0x787e('0x10'));var Redis=require(_0x787e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x787e('0x12'));var as=require(_0x787e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x787e('0x14'))(_0x787e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x787e('0x16'));var db=require(_0x787e('0x17'))['db'];function respondWithStatusCode(_0x6ff953,_0x237ce4){_0x237ce4=_0x237ce4||0xcc;return function(_0x4c989a){if(_0x4c989a){return _0x6ff953['sendStatus'](_0x237ce4);}return _0x6ff953[_0x787e('0x18')](_0x237ce4)[_0x787e('0x19')]();};}function respondWithResult(_0x5a3d72,_0x518c51){_0x518c51=_0x518c51||0xc8;return function(_0x1d1878){if(_0x1d1878){return _0x5a3d72[_0x787e('0x18')](_0x518c51)[_0x787e('0x1a')](_0x1d1878);}};}function respondWithFilteredResult(_0x4f40cd,_0x58f720){return function(_0x41cef9){if(_0x41cef9){var _0x3216d2=typeof _0x58f720[_0x787e('0x1b')]===_0x787e('0x1c')&&typeof _0x58f720[_0x787e('0x1d')]===_0x787e('0x1c');var _0x2f1227=_0x41cef9[_0x787e('0x1e')];var _0x26b13d=_0x3216d2?0x0:_0x58f720['offset'];var _0x1506d1=_0x3216d2?_0x41cef9[_0x787e('0x1e')]:_0x58f720[_0x787e('0x1b')]+_0x58f720[_0x787e('0x1d')];var _0x47a87f;if(_0x1506d1>=_0x2f1227){_0x1506d1=_0x2f1227;_0x47a87f=0xc8;}else{_0x47a87f=0xce;}_0x4f40cd[_0x787e('0x18')](_0x47a87f);return _0x4f40cd['set'](_0x787e('0x1f'),_0x26b13d+'-'+_0x1506d1+'/'+_0x2f1227)[_0x787e('0x1a')](_0x41cef9);}return null;};}function patchUpdates(_0x4e7dac){return function(_0x214b3f){try{jsonpatch[_0x787e('0x20')](_0x214b3f,_0x4e7dac,!![]);}catch(_0x2138a7){return BPromise[_0x787e('0x21')](_0x2138a7);}return _0x214b3f[_0x787e('0x22')]();};}function saveUpdates(_0x5a7ccc,_0x44d9d5){return function(_0x426644){if(_0x426644){return _0x426644[_0x787e('0x23')](_0x5a7ccc)['then'](function(_0x383a23){return _0x383a23;});}return null;};}function removeEntity(_0x26acee,_0x4fa9b6){return function(_0x2263c3){if(_0x2263c3){return _0x2263c3['destroy']()[_0x787e('0x24')](function(){_0x26acee[_0x787e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbca604,_0x525349){return function(_0x1c56cf){if(!_0x1c56cf){_0xbca604[_0x787e('0x25')](0x194);}return _0x1c56cf;};}function handleError(_0x491f51,_0x526e1f){_0x526e1f=_0x526e1f||0x1f4;return function(_0x3af171){logger['error'](_0x3af171[_0x787e('0x26')]);if(_0x3af171['name']){delete _0x3af171['name'];}_0x491f51[_0x787e('0x18')](_0x526e1f)[_0x787e('0x27')](_0x3af171);};}exports[_0x787e('0x28')]=function(_0x1ec100,_0x46ce43){var _0x3edd64={},_0xa400ba={},_0x7dc45e={'count':0x0,'rows':[]};var _0x4dbbcb=_['map'](db[_0x787e('0x29')]['rawAttributes'],function(_0xb37f1){return{'name':_0xb37f1['fieldName'],'type':_0xb37f1['type'][_0x787e('0x2a')]};});_0xa400ba[_0x787e('0x2b')]=_['map'](_0x4dbbcb,_0x787e('0x2c'));_0xa400ba[_0x787e('0x2d')]=_[_0x787e('0x2e')](_0x1ec100[_0x787e('0x2d')]);_0xa400ba[_0x787e('0x2f')]=_[_0x787e('0x30')](_0xa400ba[_0x787e('0x2b')],_0xa400ba['query']);_0x3edd64[_0x787e('0x31')]=_[_0x787e('0x30')](_0xa400ba[_0x787e('0x2b')],qs['fields'](_0x1ec100[_0x787e('0x2d')]['fields']));_0x3edd64['attributes']=_0x3edd64[_0x787e('0x31')]['length']?_0x3edd64[_0x787e('0x31')]:_0xa400ba['model'];if(!_0x1ec100[_0x787e('0x2d')]['hasOwnProperty']('nolimit')){_0x3edd64[_0x787e('0x1d')]=qs[_0x787e('0x1d')](_0x1ec100['query'][_0x787e('0x1d')]);_0x3edd64[_0x787e('0x1b')]=qs[_0x787e('0x1b')](_0x1ec100[_0x787e('0x2d')][_0x787e('0x1b')]);}_0x3edd64['order']=qs[_0x787e('0x32')](_0x1ec100['query'][_0x787e('0x32')]);_0x3edd64[_0x787e('0x33')]=qs[_0x787e('0x2f')](_[_0x787e('0x34')](_0x1ec100[_0x787e('0x2d')],_0xa400ba[_0x787e('0x2f')]),_0x4dbbcb);if(_0x1ec100[_0x787e('0x2d')][_0x787e('0x35')]){_0x3edd64['where']=_[_0x787e('0x36')](_0x3edd64['where'],{'$or':_['map'](_0x4dbbcb,function(_0x4767a1){if(_0x4767a1[_0x787e('0x37')]!==_0x787e('0x38')){var _0x1f4777={};_0x1f4777[_0x4767a1['name']]={'$like':'%'+_0x1ec100[_0x787e('0x2d')][_0x787e('0x35')]+'%'};return _0x1f4777;}})});}_0x3edd64=_['merge']({},_0x3edd64,_0x1ec100[_0x787e('0x39')]);var _0x2a17b7={'where':_0x3edd64[_0x787e('0x33')]};return db[_0x787e('0x29')][_0x787e('0x1e')](_0x2a17b7)[_0x787e('0x24')](function(_0x181d79){_0x7dc45e[_0x787e('0x1e')]=_0x181d79;if(_0x1ec100[_0x787e('0x2d')][_0x787e('0x3a')]){_0x3edd64[_0x787e('0x3b')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x787e('0x3c')](_0x3edd64);})['then'](function(_0x4d72f4){_0x7dc45e[_0x787e('0x3d')]=_0x4d72f4;return _0x7dc45e;})['then'](respondWithFilteredResult(_0x46ce43,_0x3edd64))[_0x787e('0x3e')](handleError(_0x46ce43,null));};exports['show']=function(_0x4b21d0,_0x5953f7){var _0x14a2ad={'raw':![],'where':{'id':_0x4b21d0[_0x787e('0x3f')]['id']}},_0x53bfe2={};_0x53bfe2[_0x787e('0x2b')]=_[_0x787e('0x2e')](db[_0x787e('0x29')]['rawAttributes']);_0x53bfe2['query']=_[_0x787e('0x2e')](_0x4b21d0['query']);_0x53bfe2[_0x787e('0x2f')]=_[_0x787e('0x30')](_0x53bfe2[_0x787e('0x2b')],_0x53bfe2[_0x787e('0x2d')]);_0x14a2ad[_0x787e('0x31')]=_['intersection'](_0x53bfe2[_0x787e('0x2b')],qs[_0x787e('0x40')](_0x4b21d0[_0x787e('0x2d')][_0x787e('0x40')]));_0x14a2ad[_0x787e('0x31')]=_0x14a2ad[_0x787e('0x31')]['length']?_0x14a2ad[_0x787e('0x31')]:_0x53bfe2[_0x787e('0x2b')];if(_0x4b21d0['query'][_0x787e('0x3a')]){_0x14a2ad[_0x787e('0x3b')]=[{'all':!![]}];}_0x14a2ad=_['merge']({},_0x14a2ad,_0x4b21d0[_0x787e('0x39')]);return db[_0x787e('0x29')][_0x787e('0x41')](_0x14a2ad)[_0x787e('0x24')](handleEntityNotFound(_0x5953f7,null))[_0x787e('0x24')](respondWithResult(_0x5953f7,null))[_0x787e('0x3e')](handleError(_0x5953f7,null));};exports[_0x787e('0x42')]=function(_0x11613d,_0x5537e6){return db[_0x787e('0x29')][_0x787e('0x42')](_0x11613d[_0x787e('0x43')],{})[_0x787e('0x24')](respondWithResult(_0x5537e6,0xc9))[_0x787e('0x3e')](handleError(_0x5537e6,null));};exports[_0x787e('0x23')]=function(_0x28afb8,_0x57f0f9){if(_0x28afb8[_0x787e('0x43')]['id']){delete _0x28afb8[_0x787e('0x43')]['id'];}return db['VtigerConfiguration'][_0x787e('0x41')]({'where':{'id':_0x28afb8[_0x787e('0x3f')]['id']}})[_0x787e('0x24')](handleEntityNotFound(_0x57f0f9,null))[_0x787e('0x24')](saveUpdates(_0x28afb8[_0x787e('0x43')],null))[_0x787e('0x24')](respondWithResult(_0x57f0f9,null))['catch'](handleError(_0x57f0f9,null));};exports['destroy']=function(_0x2727c1,_0x43cc61){return db['VtigerConfiguration'][_0x787e('0x41')]({'where':{'id':_0x2727c1['params']['id']}})['then'](handleEntityNotFound(_0x43cc61,null))[_0x787e('0x24')](removeEntity(_0x43cc61,null))[_0x787e('0x3e')](handleError(_0x43cc61,null));};exports[_0x787e('0x44')]=function(_0x34b20d,_0x3beb8d,_0x2aee32){var _0x1ac376={};var _0x4d4eea={};var _0x4d3ee3;var _0x421587;return db['VtigerConfiguration'][_0x787e('0x45')]({'where':{'id':_0x34b20d['params']['id']}})[_0x787e('0x24')](handleEntityNotFound(_0x3beb8d,null))[_0x787e('0x24')](function(_0x46dfff){if(_0x46dfff){_0x4d3ee3=_0x46dfff;_0x4d4eea[_0x787e('0x2b')]=_[_0x787e('0x2e')](db[_0x787e('0x46')][_0x787e('0x47')]);_0x4d4eea[_0x787e('0x2d')]=_['keys'](_0x34b20d[_0x787e('0x2d')]);_0x4d4eea[_0x787e('0x2f')]=_[_0x787e('0x30')](_0x4d4eea[_0x787e('0x2b')],_0x4d4eea[_0x787e('0x2d')]);_0x1ac376[_0x787e('0x31')]=_[_0x787e('0x30')](_0x4d4eea[_0x787e('0x2b')],qs['fields'](_0x34b20d['query'][_0x787e('0x40')]));_0x1ac376[_0x787e('0x31')]=_0x1ac376[_0x787e('0x31')]['length']?_0x1ac376[_0x787e('0x31')]:_0x4d4eea[_0x787e('0x2b')];_0x1ac376[_0x787e('0x48')]=qs[_0x787e('0x32')](_0x34b20d['query'][_0x787e('0x32')]);_0x1ac376[_0x787e('0x33')]=qs[_0x787e('0x2f')](_[_0x787e('0x34')](_0x34b20d[_0x787e('0x2d')],_0x4d4eea[_0x787e('0x2f')]));if(_0x34b20d['query'][_0x787e('0x35')]){_0x1ac376[_0x787e('0x33')]=_[_0x787e('0x36')](_0x1ac376[_0x787e('0x33')],{'$or':_[_0x787e('0x49')](_0x1ac376[_0x787e('0x31')],function(_0x37399c){var _0x5b5d66={};_0x5b5d66[_0x37399c]={'$like':'%'+_0x34b20d[_0x787e('0x2d')][_0x787e('0x35')]+'%'};return _0x5b5d66;})});}_0x1ac376=_[_0x787e('0x36')]({},_0x1ac376,_0x34b20d['options']);return _0x4d3ee3[_0x787e('0x44')](_0x1ac376);}})[_0x787e('0x24')](function(_0xa25835){if(_0xa25835){_0x421587=_0xa25835[_0x787e('0x4a')];if(!_0x34b20d['query'][_0x787e('0x4b')](_0x787e('0x4c'))){_0x1ac376[_0x787e('0x1d')]=qs['limit'](_0x34b20d[_0x787e('0x2d')]['limit']);_0x1ac376['offset']=qs['offset'](_0x34b20d[_0x787e('0x2d')][_0x787e('0x1b')]);}return _0x4d3ee3[_0x787e('0x44')](_0x1ac376);}})[_0x787e('0x24')](function(_0x19d2e2){if(_0x19d2e2){return _0x19d2e2?{'count':_0x421587,'rows':_0x19d2e2}:null;}})[_0x787e('0x24')](respondWithResult(_0x3beb8d,null))[_0x787e('0x3e')](handleError(_0x3beb8d,null));};exports['getSubjects']=function(_0xb715b7,_0x139aea,_0x2df883){var _0x129859={};var _0x117c01={};var _0x3f18cf;var _0x301c3f;return db[_0x787e('0x29')]['findOne']({'where':{'id':_0xb715b7['params']['id']}})[_0x787e('0x24')](handleEntityNotFound(_0x139aea,null))['then'](function(_0x44f3ef){if(_0x44f3ef){_0x3f18cf=_0x44f3ef;_0x117c01[_0x787e('0x2b')]=_['keys'](db['VtigerField'][_0x787e('0x47')]);_0x117c01[_0x787e('0x2d')]=_[_0x787e('0x2e')](_0xb715b7[_0x787e('0x2d')]);_0x117c01['filters']=_['intersection'](_0x117c01['model'],_0x117c01[_0x787e('0x2d')]);_0x129859['attributes']=_['intersection'](_0x117c01[_0x787e('0x2b')],qs[_0x787e('0x40')](_0xb715b7['query']['fields']));_0x129859[_0x787e('0x31')]=_0x129859['attributes'][_0x787e('0x4a')]?_0x129859[_0x787e('0x31')]:_0x117c01[_0x787e('0x2b')];_0x129859[_0x787e('0x48')]=qs[_0x787e('0x32')](_0xb715b7[_0x787e('0x2d')][_0x787e('0x32')]);_0x129859['where']=qs['filters'](_[_0x787e('0x34')](_0xb715b7[_0x787e('0x2d')],_0x117c01['filters']));if(_0xb715b7[_0x787e('0x2d')][_0x787e('0x35')]){_0x129859[_0x787e('0x33')]=_[_0x787e('0x36')](_0x129859[_0x787e('0x33')],{'$or':_[_0x787e('0x49')](_0x129859['attributes'],function(_0xa19e9){var _0x114214={};_0x114214[_0xa19e9]={'$like':'%'+_0xb715b7['query'][_0x787e('0x35')]+'%'};return _0x114214;})});}_0x129859=_['merge']({},_0x129859,_0xb715b7[_0x787e('0x39')]);return _0x3f18cf[_0x787e('0x4d')](_0x129859);}})['then'](function(_0x4ea141){if(_0x4ea141){_0x301c3f=_0x4ea141[_0x787e('0x4a')];if(!_0xb715b7[_0x787e('0x2d')][_0x787e('0x4b')](_0x787e('0x4c'))){_0x129859['limit']=qs[_0x787e('0x1d')](_0xb715b7[_0x787e('0x2d')][_0x787e('0x1d')]);_0x129859[_0x787e('0x1b')]=qs[_0x787e('0x1b')](_0xb715b7[_0x787e('0x2d')]['offset']);}return _0x3f18cf[_0x787e('0x4d')](_0x129859);}})[_0x787e('0x24')](function(_0x41a763){if(_0x41a763){return _0x41a763?{'count':_0x301c3f,'rows':_0x41a763}:null;}})['then'](respondWithResult(_0x139aea,null))[_0x787e('0x3e')](handleError(_0x139aea,null));};exports['getDescriptions']=function(_0x5d7047,_0x3bbe2a,_0x28383c){var _0x43e0e2={};var _0x530b24={};var _0x56fc73;var _0x3bc59b;return db[_0x787e('0x29')][_0x787e('0x45')]({'where':{'id':_0x5d7047['params']['id']}})[_0x787e('0x24')](handleEntityNotFound(_0x3bbe2a,null))['then'](function(_0x45ad7a){if(_0x45ad7a){_0x56fc73=_0x45ad7a;_0x530b24[_0x787e('0x2b')]=_[_0x787e('0x2e')](db[_0x787e('0x46')][_0x787e('0x47')]);_0x530b24[_0x787e('0x2d')]=_[_0x787e('0x2e')](_0x5d7047[_0x787e('0x2d')]);_0x530b24['filters']=_[_0x787e('0x30')](_0x530b24[_0x787e('0x2b')],_0x530b24[_0x787e('0x2d')]);_0x43e0e2[_0x787e('0x31')]=_['intersection'](_0x530b24[_0x787e('0x2b')],qs[_0x787e('0x40')](_0x5d7047[_0x787e('0x2d')][_0x787e('0x40')]));_0x43e0e2[_0x787e('0x31')]=_0x43e0e2[_0x787e('0x31')][_0x787e('0x4a')]?_0x43e0e2['attributes']:_0x530b24['model'];_0x43e0e2[_0x787e('0x48')]=qs[_0x787e('0x32')](_0x5d7047[_0x787e('0x2d')][_0x787e('0x32')]);_0x43e0e2[_0x787e('0x33')]=qs['filters'](_[_0x787e('0x34')](_0x5d7047[_0x787e('0x2d')],_0x530b24[_0x787e('0x2f')]));if(_0x5d7047[_0x787e('0x2d')][_0x787e('0x35')]){_0x43e0e2['where']=_[_0x787e('0x36')](_0x43e0e2[_0x787e('0x33')],{'$or':_['map'](_0x43e0e2[_0x787e('0x31')],function(_0x58fc0e){var _0x24cf8c={};_0x24cf8c[_0x58fc0e]={'$like':'%'+_0x5d7047[_0x787e('0x2d')][_0x787e('0x35')]+'%'};return _0x24cf8c;})});}_0x43e0e2=_[_0x787e('0x36')]({},_0x43e0e2,_0x5d7047['options']);return _0x56fc73[_0x787e('0x4e')](_0x43e0e2);}})[_0x787e('0x24')](function(_0x526f18){if(_0x526f18){_0x3bc59b=_0x526f18[_0x787e('0x4a')];if(!_0x5d7047[_0x787e('0x2d')][_0x787e('0x4b')](_0x787e('0x4c'))){_0x43e0e2[_0x787e('0x1d')]=qs[_0x787e('0x1d')](_0x5d7047['query'][_0x787e('0x1d')]);_0x43e0e2[_0x787e('0x1b')]=qs['offset'](_0x5d7047['query'][_0x787e('0x1b')]);}return _0x56fc73[_0x787e('0x4e')](_0x43e0e2);}})[_0x787e('0x24')](function(_0x7cb446){if(_0x7cb446){return _0x7cb446?{'count':_0x3bc59b,'rows':_0x7cb446}:null;}})[_0x787e('0x24')](respondWithResult(_0x3bbe2a,null))[_0x787e('0x3e')](handleError(_0x3bbe2a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d990b96..706275e 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 _0x47e3=['path','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','api','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x47e3,0x166));var _0x347e=function(_0x19c15a,_0x28f8e9){_0x19c15a=_0x19c15a-0x0;var _0x5da97c=_0x47e3[_0x19c15a];return _0x5da97c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x347e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x347e('0x1'));var fs=require('fs');var path=require(_0x347e('0x2'));var rimraf=require(_0x347e('0x3'));var config=require(_0x347e('0x4'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x347e('0x5')]=function(_0x467f7b,_0x4377c6){return _0x467f7b[_0x347e('0x6')](_0x347e('0x7'),attributes,{'tableName':_0x347e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe0b=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x5d270d,_0x16a76e){var _0x2b3b4a=function(_0x4ebbf1){while(--_0x4ebbf1){_0x5d270d['push'](_0x5d270d['shift']());}};_0x2b3b4a(++_0x16a76e);}(_0xfe0b,0x13d));var _0xbfe0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfe0b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xbfe0('0x0'));var util=require(_0xbfe0('0x1'));var logger=require(_0xbfe0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfe0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbfe0('0x4'));var rimraf=require(_0xbfe0('0x5'));var config=require(_0xbfe0('0x6'));var attributes=require(_0xbfe0('0x7'));module[_0xbfe0('0x8')]=function(_0x2bc53b,_0x30af96){return _0x2bc53b[_0xbfe0('0x9')](_0xbfe0('0xa'),attributes,{'tableName':_0xbfe0('0xb'),'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 21507f5..3b8a266 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 _0x0f95=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5ebc04,_0x14a363){var _0x17845c=function(_0x360850){while(--_0x360850){_0x5ebc04['push'](_0x5ebc04['shift']());}};_0x17845c(++_0x14a363);}(_0x0f95,0xdd));var _0x50f9=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x0f95[_0x470f63];return _0x4f09e2;};'use strict';var _=require(_0x50f9('0x0'));var util=require(_0x50f9('0x1'));var moment=require(_0x50f9('0x2'));var BPromise=require(_0x50f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x50f9('0x4'));var logger=require(_0x50f9('0x5'))(_0x50f9('0x6'));var config=require(_0x50f9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x50f9('0x8')][_0x50f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29d4a6,_0x59f9fb,_0x13fd3c){return new BPromise(function(_0x59d212,_0x219ae2){return client[_0x50f9('0xa')](_0x29d4a6,_0x13fd3c)[_0x50f9('0xb')](function(_0x5921ea){logger[_0x50f9('0xc')](_0x50f9('0xd'),_0x59f9fb,_0x50f9('0xe'));logger[_0x50f9('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x59f9fb,_0x50f9('0xe'),JSON[_0x50f9('0x10')](_0x5921ea));if(_0x5921ea[_0x50f9('0x11')]){if(_0x5921ea[_0x50f9('0x11')][_0x50f9('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x59f9fb,_0x5921ea['error']['message']);return _0x219ae2(_0x5921ea[_0x50f9('0x11')]['message']);}logger[_0x50f9('0x11')](_0x50f9('0xd'),_0x59f9fb,_0x5921ea['error'][_0x50f9('0x13')]);return _0x59d212(_0x5921ea['error'][_0x50f9('0x13')]);}else{logger[_0x50f9('0xc')](_0x50f9('0xd'),_0x59f9fb,_0x50f9('0xe'));_0x59d212(_0x5921ea[_0x50f9('0x14')][_0x50f9('0x13')]);}})['catch'](function(_0x5651c4){logger[_0x50f9('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x59f9fb,_0x5651c4);_0x219ae2(_0x5651c4);});});} \ No newline at end of file +var _0x2ab9=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','info','catch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2ab9,0x18c));var _0x92ab=function(_0x2710d0,_0x2926be){_0x2710d0=_0x2710d0-0x0;var _0x21320e=_0x2ab9[_0x2710d0];return _0x21320e;};'use strict';var _=require(_0x92ab('0x0'));var util=require(_0x92ab('0x1'));var moment=require(_0x92ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x92ab('0x3'));var fs=require('fs');var Redis=require(_0x92ab('0x4'));var db=require(_0x92ab('0x5'))['db'];var utils=require(_0x92ab('0x6'));var logger=require(_0x92ab('0x7'))(_0x92ab('0x8'));var config=require(_0x92ab('0x9'));var jayson=require(_0x92ab('0xa'));var client=jayson[_0x92ab('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf3ed02,_0x3f25ab,_0x3537ab){return new BPromise(function(_0x4aff7b,_0x494e59){return client[_0x92ab('0xc')](_0xf3ed02,_0x3537ab)[_0x92ab('0xd')](function(_0x33e875){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x3f25ab,_0x92ab('0xe'));logger['debug'](_0x92ab('0xf'),_0x3f25ab,'request\x20sent',JSON[_0x92ab('0x10')](_0x33e875));if(_0x33e875[_0x92ab('0x11')]){if(_0x33e875[_0x92ab('0x11')]['code']===0x1f4){logger[_0x92ab('0x11')](_0x92ab('0x12'),_0x3f25ab,_0x33e875['error']['message']);return _0x494e59(_0x33e875[_0x92ab('0x11')][_0x92ab('0x13')]);}logger[_0x92ab('0x11')](_0x92ab('0x12'),_0x3f25ab,_0x33e875[_0x92ab('0x11')][_0x92ab('0x13')]);return _0x4aff7b(_0x33e875[_0x92ab('0x11')][_0x92ab('0x13')]);}else{logger[_0x92ab('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f25ab,_0x92ab('0xe'));_0x4aff7b(_0x33e875['result'][_0x92ab('0x13')]);}})[_0x92ab('0x15')](function(_0x3d9855){logger[_0x92ab('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f25ab,_0x3d9855);_0x494e59(_0x3d9855);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6523b15..4a96eb7 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 _0x7c29=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c29,0x1ec));var _0x97c2=function(_0x170b4f,_0x2b5f91){_0x170b4f=_0x170b4f-0x0;var _0x62a4a8=_0x7c29[_0x170b4f];return _0x62a4a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x97c2('0x0'));var timeout=require(_0x97c2('0x1'));var express=require(_0x97c2('0x2'));var router=express[_0x97c2('0x3')]();var fs_extra=require(_0x97c2('0x4'));var auth=require(_0x97c2('0x5'));var interaction=require(_0x97c2('0x6'));var config=require(_0x97c2('0x7'));var controller=require('./intVtigerField.controller');router[_0x97c2('0x8')]('/',auth[_0x97c2('0x9')](),controller[_0x97c2('0xa')]);router[_0x97c2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x97c2('0xb')]);router[_0x97c2('0xc')]('/',auth[_0x97c2('0x9')](),controller[_0x97c2('0xd')]);router[_0x97c2('0xe')](_0x97c2('0xf'),auth['isAuthenticated'](),controller[_0x97c2('0x10')]);router[_0x97c2('0x11')](_0x97c2('0xf'),auth[_0x97c2('0x9')](),controller[_0x97c2('0x12')]);module[_0x97c2('0x13')]=router; \ No newline at end of file +var _0xadc8=['post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x38afc7,_0x52d703){var _0x5a3568=function(_0x1651b9){while(--_0x1651b9){_0x38afc7['push'](_0x38afc7['shift']());}};_0x5a3568(++_0x52d703);}(_0xadc8,0x142));var _0x8adc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadc8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8adc('0x0'));var util=require(_0x8adc('0x1'));var path=require(_0x8adc('0x2'));var timeout=require(_0x8adc('0x3'));var express=require('express');var router=express[_0x8adc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8adc('0x5'));var interaction=require(_0x8adc('0x6'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x8adc('0x7')](),controller['index']);router['get']('/:id',auth[_0x8adc('0x7')](),controller['show']);router[_0x8adc('0x8')]('/',auth[_0x8adc('0x7')](),controller[_0x8adc('0x9')]);router[_0x8adc('0xa')](_0x8adc('0xb'),auth[_0x8adc('0x7')](),controller[_0x8adc('0xc')]);router[_0x8adc('0xd')](_0x8adc('0xb'),auth[_0x8adc('0x7')](),controller[_0x8adc('0xe')]);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 b8f8134..866565e 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 _0xe3c8=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x419b19,_0x1d7f9f){var _0x48f016=function(_0x184aeb){while(--_0x184aeb){_0x419b19['push'](_0x419b19['shift']());}};_0x48f016(++_0x1d7f9f);}(_0xe3c8,0x168));var _0x8e3c=function(_0x1028f2,_0x334f6f){_0x1028f2=_0x1028f2-0x0;var _0x1e4f8f=_0xe3c8[_0x1028f2];return _0x1e4f8f;};'use strict';var Sequelize=require('sequelize');module[_0x8e3c('0x0')]={'type':{'type':Sequelize[_0x8e3c('0x1')](_0x8e3c('0x2'),_0x8e3c('0x3'),_0x8e3c('0x4'),_0x8e3c('0x5'),_0x8e3c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8e3c('0x7')]},'key':{'type':Sequelize[_0x8e3c('0x7')]},'keyType':{'type':Sequelize[_0x8e3c('0x1')]('string','variable',_0x8e3c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8e3c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8e3c('0x7')]}}; \ No newline at end of file +var _0xef3d=['ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','exports'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xef3d,0x197));var _0xdef3=function(_0x220d47,_0x4c9364){_0x220d47=_0x220d47-0x0;var _0x5d2e8f=_0xef3d[_0x220d47];return _0x5d2e8f;};'use strict';var Sequelize=require('sequelize');module[_0xdef3('0x0')]={'type':{'type':Sequelize[_0xdef3('0x1')]('string',_0xdef3('0x2'),_0xdef3('0x3'),'keyValue',_0xdef3('0x4')),'defaultValue':_0xdef3('0x5')},'content':{'type':Sequelize[_0xdef3('0x6')]},'key':{'type':Sequelize[_0xdef3('0x6')]},'keyType':{'type':Sequelize[_0xdef3('0x1')](_0xdef3('0x5'),_0xdef3('0x2'),_0xdef3('0x3'))},'keyContent':{'type':Sequelize[_0xdef3('0x6')]},'idField':{'type':Sequelize[_0xdef3('0x6')]},'nameField':{'type':Sequelize[_0xdef3('0x6')]},'customField':{'type':Sequelize[_0xdef3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdef3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 254d4f9..418b2f1 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 _0x88c0=['type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','name','index','map','VtigerField','rawAttributes','fieldName'];(function(_0xe5e0c1,_0x5cac0b){var _0x981bd7=function(_0x3d8f37){while(--_0x3d8f37){_0xe5e0c1['push'](_0xe5e0c1['shift']());}};_0x981bd7(++_0x5cac0b);}(_0x88c0,0x149));var _0x088c=function(_0x2f879a,_0x3ae245){_0x2f879a=_0x2f879a-0x0;var _0x41c702=_0x88c0[_0x2f879a];return _0x41c702;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x088c('0x0'));var zipdir=require(_0x088c('0x1'));var jsonpatch=require(_0x088c('0x2'));var rp=require(_0x088c('0x3'));var moment=require(_0x088c('0x4'));var BPromise=require(_0x088c('0x5'));var Mustache=require('mustache');var util=require(_0x088c('0x6'));var path=require(_0x088c('0x7'));var sox=require('sox');var csv=require(_0x088c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x088c('0x9'));var _=require(_0x088c('0xa'));var squel=require(_0x088c('0xb'));var crypto=require(_0x088c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x088c('0xd'));var toCsv=require(_0x088c('0x8'));var querystring=require(_0x088c('0xe'));var Papa=require('papaparse');var Redis=require(_0x088c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x088c('0x10'));var as=require(_0x088c('0x11'));var hardwareService=require(_0x088c('0x12'));var logger=require(_0x088c('0x13'))('api');var utils=require(_0x088c('0x14'));var config=require(_0x088c('0x15'));var licenseUtil=require(_0x088c('0x16'));var db=require(_0x088c('0x17'))['db'];function respondWithStatusCode(_0x301747,_0x264c87){_0x264c87=_0x264c87||0xcc;return function(_0x505985){if(_0x505985){return _0x301747['sendStatus'](_0x264c87);}return _0x301747[_0x088c('0x18')](_0x264c87)[_0x088c('0x19')]();};}function respondWithResult(_0x370c04,_0x32335d){_0x32335d=_0x32335d||0xc8;return function(_0x349a95){if(_0x349a95){return _0x370c04['status'](_0x32335d)[_0x088c('0x1a')](_0x349a95);}};}function respondWithFilteredResult(_0x194402,_0x54ba64){return function(_0x5cd788){if(_0x5cd788){var _0x28e421=typeof _0x54ba64[_0x088c('0x1b')]===_0x088c('0x1c')&&typeof _0x54ba64[_0x088c('0x1d')]==='undefined';var _0x14f3e1=_0x5cd788[_0x088c('0x1e')];var _0x3802c7=_0x28e421?0x0:_0x54ba64['offset'];var _0x30de66=_0x28e421?_0x5cd788['count']:_0x54ba64[_0x088c('0x1b')]+_0x54ba64[_0x088c('0x1d')];var _0xfe4c74;if(_0x30de66>=_0x14f3e1){_0x30de66=_0x14f3e1;_0xfe4c74=0xc8;}else{_0xfe4c74=0xce;}_0x194402[_0x088c('0x18')](_0xfe4c74);return _0x194402[_0x088c('0x1f')]('Content-Range',_0x3802c7+'-'+_0x30de66+'/'+_0x14f3e1)[_0x088c('0x1a')](_0x5cd788);}return null;};}function patchUpdates(_0x41ccea){return function(_0x331785){try{jsonpatch[_0x088c('0x20')](_0x331785,_0x41ccea,!![]);}catch(_0x129d25){return BPromise[_0x088c('0x21')](_0x129d25);}return _0x331785[_0x088c('0x22')]();};}function saveUpdates(_0x172580,_0x2443db){return function(_0x53447a){if(_0x53447a){return _0x53447a[_0x088c('0x23')](_0x172580)['then'](function(_0x57527b){return _0x57527b;});}return null;};}function removeEntity(_0x3ab104,_0x263f6f){return function(_0x514b74){if(_0x514b74){return _0x514b74[_0x088c('0x24')]()[_0x088c('0x25')](function(){_0x3ab104[_0x088c('0x18')](0xcc)[_0x088c('0x19')]();});}};}function handleEntityNotFound(_0x12bf94,_0x18a5a9){return function(_0x3d308a){if(!_0x3d308a){_0x12bf94[_0x088c('0x26')](0x194);}return _0x3d308a;};}function handleError(_0x149c18,_0x1f5da7){_0x1f5da7=_0x1f5da7||0x1f4;return function(_0x4ab66e){logger[_0x088c('0x27')](_0x4ab66e['stack']);if(_0x4ab66e[_0x088c('0x28')]){delete _0x4ab66e['name'];}_0x149c18['status'](_0x1f5da7)['send'](_0x4ab66e);};}exports[_0x088c('0x29')]=function(_0x2c8150,_0x5a7f58){var _0x3acce9={},_0x3cf7eb={},_0x305970={'count':0x0,'rows':[]};var _0x1ceb48=_[_0x088c('0x2a')](db[_0x088c('0x2b')][_0x088c('0x2c')],function(_0x282865){return{'name':_0x282865[_0x088c('0x2d')],'type':_0x282865[_0x088c('0x2e')][_0x088c('0x2f')]};});_0x3cf7eb[_0x088c('0x30')]=_[_0x088c('0x2a')](_0x1ceb48,_0x088c('0x28'));_0x3cf7eb['query']=_[_0x088c('0x31')](_0x2c8150[_0x088c('0x32')]);_0x3cf7eb[_0x088c('0x33')]=_['intersection'](_0x3cf7eb[_0x088c('0x30')],_0x3cf7eb[_0x088c('0x32')]);_0x3acce9[_0x088c('0x34')]=_[_0x088c('0x35')](_0x3cf7eb[_0x088c('0x30')],qs[_0x088c('0x36')](_0x2c8150[_0x088c('0x32')][_0x088c('0x36')]));_0x3acce9[_0x088c('0x34')]=_0x3acce9['attributes'][_0x088c('0x37')]?_0x3acce9[_0x088c('0x34')]:_0x3cf7eb[_0x088c('0x30')];if(!_0x2c8150['query'][_0x088c('0x38')](_0x088c('0x39'))){_0x3acce9['limit']=qs[_0x088c('0x1d')](_0x2c8150[_0x088c('0x32')][_0x088c('0x1d')]);_0x3acce9['offset']=qs[_0x088c('0x1b')](_0x2c8150[_0x088c('0x32')][_0x088c('0x1b')]);}_0x3acce9[_0x088c('0x3a')]=qs['sort'](_0x2c8150[_0x088c('0x32')][_0x088c('0x3b')]);_0x3acce9[_0x088c('0x3c')]=qs[_0x088c('0x33')](_['pick'](_0x2c8150[_0x088c('0x32')],_0x3cf7eb[_0x088c('0x33')]),_0x1ceb48);if(_0x2c8150[_0x088c('0x32')]['filter']){_0x3acce9['where']=_['merge'](_0x3acce9['where'],{'$or':_['map'](_0x1ceb48,function(_0x240b7b){if(_0x240b7b[_0x088c('0x2e')]!==_0x088c('0x3d')){var _0x4aa0da={};_0x4aa0da[_0x240b7b[_0x088c('0x28')]]={'$like':'%'+_0x2c8150['query'][_0x088c('0x3e')]+'%'};return _0x4aa0da;}})});}_0x3acce9=_[_0x088c('0x3f')]({},_0x3acce9,_0x2c8150[_0x088c('0x40')]);var _0xa6e990={'where':_0x3acce9[_0x088c('0x3c')]};return db[_0x088c('0x2b')][_0x088c('0x1e')](_0xa6e990)[_0x088c('0x25')](function(_0x1350b3){_0x305970[_0x088c('0x1e')]=_0x1350b3;if(_0x2c8150[_0x088c('0x32')][_0x088c('0x41')]){_0x3acce9[_0x088c('0x42')]=[{'all':!![]}];}return db['VtigerField'][_0x088c('0x43')](_0x3acce9);})[_0x088c('0x25')](function(_0x2ca416){_0x305970[_0x088c('0x44')]=_0x2ca416;return _0x305970;})[_0x088c('0x25')](respondWithFilteredResult(_0x5a7f58,_0x3acce9))[_0x088c('0x45')](handleError(_0x5a7f58,null));};exports[_0x088c('0x46')]=function(_0x344a05,_0x268edf){var _0x9a7b77={'raw':!![],'where':{'id':_0x344a05[_0x088c('0x47')]['id']}},_0x490221={};_0x490221[_0x088c('0x30')]=_[_0x088c('0x31')](db['VtigerField'][_0x088c('0x2c')]);_0x490221[_0x088c('0x32')]=_[_0x088c('0x31')](_0x344a05[_0x088c('0x32')]);_0x490221[_0x088c('0x33')]=_[_0x088c('0x35')](_0x490221[_0x088c('0x30')],_0x490221[_0x088c('0x32')]);_0x9a7b77[_0x088c('0x34')]=_[_0x088c('0x35')](_0x490221[_0x088c('0x30')],qs[_0x088c('0x36')](_0x344a05[_0x088c('0x32')][_0x088c('0x36')]));_0x9a7b77['attributes']=_0x9a7b77['attributes']['length']?_0x9a7b77[_0x088c('0x34')]:_0x490221[_0x088c('0x30')];if(_0x344a05[_0x088c('0x32')][_0x088c('0x41')]){_0x9a7b77[_0x088c('0x42')]=[{'all':!![]}];}_0x9a7b77=_['merge']({},_0x9a7b77,_0x344a05['options']);return db[_0x088c('0x2b')][_0x088c('0x48')](_0x9a7b77)[_0x088c('0x25')](handleEntityNotFound(_0x268edf,null))[_0x088c('0x25')](respondWithResult(_0x268edf,null))[_0x088c('0x45')](handleError(_0x268edf,null));};exports[_0x088c('0x49')]=function(_0x4f0561,_0x309a8a){return db['VtigerField']['create'](_0x4f0561[_0x088c('0x4a')],{})['then'](respondWithResult(_0x309a8a,0xc9))['catch'](handleError(_0x309a8a,null));};exports[_0x088c('0x23')]=function(_0xfc5fd2,_0x4297c5){if(_0xfc5fd2[_0x088c('0x4a')]['id']){delete _0xfc5fd2['body']['id'];}return db[_0x088c('0x2b')][_0x088c('0x48')]({'where':{'id':_0xfc5fd2[_0x088c('0x47')]['id']}})[_0x088c('0x25')](handleEntityNotFound(_0x4297c5,null))[_0x088c('0x25')](saveUpdates(_0xfc5fd2['body'],null))[_0x088c('0x25')](respondWithResult(_0x4297c5,null))['catch'](handleError(_0x4297c5,null));};exports[_0x088c('0x24')]=function(_0x10f5a1,_0x3acc10){return db[_0x088c('0x2b')][_0x088c('0x48')]({'where':{'id':_0x10f5a1[_0x088c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3acc10,null))['then'](removeEntity(_0x3acc10,null))[_0x088c('0x45')](handleError(_0x3acc10,null));}; \ No newline at end of file +var _0x366d=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','VtigerField','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x14a8fa,_0x1a6fd0){var _0x59b146=function(_0x3fd5a1){while(--_0x3fd5a1){_0x14a8fa['push'](_0x14a8fa['shift']());}};_0x59b146(++_0x1a6fd0);}(_0x366d,0xde));var _0xd366=function(_0xf0a00,_0x18342a){_0xf0a00=_0xf0a00-0x0;var _0x51f837=_0x366d[_0xf0a00];return _0x51f837;};'use strict';var emlformat=require(_0xd366('0x0'));var rimraf=require(_0xd366('0x1'));var zipdir=require(_0xd366('0x2'));var jsonpatch=require(_0xd366('0x3'));var rp=require(_0xd366('0x4'));var moment=require(_0xd366('0x5'));var BPromise=require(_0xd366('0x6'));var Mustache=require(_0xd366('0x7'));var util=require(_0xd366('0x8'));var path=require(_0xd366('0x9'));var sox=require(_0xd366('0xa'));var csv=require(_0xd366('0xb'));var ejs=require(_0xd366('0xc'));var fs=require('fs');var fs_extra=require(_0xd366('0xd'));var _=require(_0xd366('0xe'));var squel=require(_0xd366('0xf'));var crypto=require(_0xd366('0x10'));var jsforce=require(_0xd366('0x11'));var deskjs=require(_0xd366('0x12'));var toCsv=require(_0xd366('0xb'));var querystring=require(_0xd366('0x13'));var Papa=require(_0xd366('0x14'));var Redis=require(_0xd366('0x15'));var authService=require(_0xd366('0x16'));var qs=require(_0xd366('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd366('0x18'))(_0xd366('0x19'));var utils=require(_0xd366('0x1a'));var config=require(_0xd366('0x1b'));var licenseUtil=require(_0xd366('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xccabd1,_0x23c1bc){_0x23c1bc=_0x23c1bc||0xcc;return function(_0x575806){if(_0x575806){return _0xccabd1[_0xd366('0x1d')](_0x23c1bc);}return _0xccabd1[_0xd366('0x1e')](_0x23c1bc)[_0xd366('0x1f')]();};}function respondWithResult(_0x1853e5,_0x3d91ca){_0x3d91ca=_0x3d91ca||0xc8;return function(_0x470535){if(_0x470535){return _0x1853e5[_0xd366('0x1e')](_0x3d91ca)[_0xd366('0x20')](_0x470535);}};}function respondWithFilteredResult(_0x459d68,_0x58cd84){return function(_0x492eae){if(_0x492eae){var _0xc06a46=typeof _0x58cd84[_0xd366('0x21')]===_0xd366('0x22')&&typeof _0x58cd84[_0xd366('0x23')]===_0xd366('0x22');var _0x2ff310=_0x492eae[_0xd366('0x24')];var _0x526cfb=_0xc06a46?0x0:_0x58cd84[_0xd366('0x21')];var _0x160324=_0xc06a46?_0x492eae[_0xd366('0x24')]:_0x58cd84[_0xd366('0x21')]+_0x58cd84[_0xd366('0x23')];var _0x219226;if(_0x160324>=_0x2ff310){_0x160324=_0x2ff310;_0x219226=0xc8;}else{_0x219226=0xce;}_0x459d68['status'](_0x219226);return _0x459d68[_0xd366('0x25')](_0xd366('0x26'),_0x526cfb+'-'+_0x160324+'/'+_0x2ff310)['json'](_0x492eae);}return null;};}function patchUpdates(_0x1c2a49){return function(_0x3f8bc9){try{jsonpatch[_0xd366('0x27')](_0x3f8bc9,_0x1c2a49,!![]);}catch(_0x11850b){return BPromise[_0xd366('0x28')](_0x11850b);}return _0x3f8bc9['save']();};}function saveUpdates(_0x3c53be,_0x6ff0a0){return function(_0x4f398c){if(_0x4f398c){return _0x4f398c['update'](_0x3c53be)[_0xd366('0x29')](function(_0x5bf186){return _0x5bf186;});}return null;};}function removeEntity(_0x1694fb,_0x1d96c4){return function(_0x2a901b){if(_0x2a901b){return _0x2a901b[_0xd366('0x2a')]()[_0xd366('0x29')](function(){_0x1694fb[_0xd366('0x1e')](0xcc)[_0xd366('0x1f')]();});}};}function handleEntityNotFound(_0x1f7cc5,_0x5a61f4){return function(_0x296fc1){if(!_0x296fc1){_0x1f7cc5[_0xd366('0x1d')](0x194);}return _0x296fc1;};}function handleError(_0x2402e2,_0xf549eb){_0xf549eb=_0xf549eb||0x1f4;return function(_0x5dc8ff){logger[_0xd366('0x2b')](_0x5dc8ff['stack']);if(_0x5dc8ff[_0xd366('0x2c')]){delete _0x5dc8ff[_0xd366('0x2c')];}_0x2402e2[_0xd366('0x1e')](_0xf549eb)[_0xd366('0x2d')](_0x5dc8ff);};}exports[_0xd366('0x2e')]=function(_0x5c0e1a,_0x1833f9){var _0x5e3b79={},_0x7f9024={},_0x25e68a={'count':0x0,'rows':[]};var _0x196d19=_[_0xd366('0x2f')](db[_0xd366('0x30')]['rawAttributes'],function(_0x5b6c3e){return{'name':_0x5b6c3e[_0xd366('0x31')],'type':_0x5b6c3e[_0xd366('0x32')][_0xd366('0x33')]};});_0x7f9024['model']=_['map'](_0x196d19,_0xd366('0x2c'));_0x7f9024[_0xd366('0x34')]=_[_0xd366('0x35')](_0x5c0e1a[_0xd366('0x34')]);_0x7f9024['filters']=_[_0xd366('0x36')](_0x7f9024[_0xd366('0x37')],_0x7f9024[_0xd366('0x34')]);_0x5e3b79[_0xd366('0x38')]=_[_0xd366('0x36')](_0x7f9024['model'],qs[_0xd366('0x39')](_0x5c0e1a['query']['fields']));_0x5e3b79[_0xd366('0x38')]=_0x5e3b79[_0xd366('0x38')][_0xd366('0x3a')]?_0x5e3b79[_0xd366('0x38')]:_0x7f9024['model'];if(!_0x5c0e1a[_0xd366('0x34')][_0xd366('0x3b')]('nolimit')){_0x5e3b79['limit']=qs[_0xd366('0x23')](_0x5c0e1a['query'][_0xd366('0x23')]);_0x5e3b79['offset']=qs[_0xd366('0x21')](_0x5c0e1a[_0xd366('0x34')][_0xd366('0x21')]);}_0x5e3b79[_0xd366('0x3c')]=qs[_0xd366('0x3d')](_0x5c0e1a['query']['sort']);_0x5e3b79[_0xd366('0x3e')]=qs[_0xd366('0x3f')](_[_0xd366('0x40')](_0x5c0e1a[_0xd366('0x34')],_0x7f9024[_0xd366('0x3f')]),_0x196d19);if(_0x5c0e1a[_0xd366('0x34')]['filter']){_0x5e3b79['where']=_[_0xd366('0x41')](_0x5e3b79[_0xd366('0x3e')],{'$or':_[_0xd366('0x2f')](_0x196d19,function(_0x4315d3){if(_0x4315d3[_0xd366('0x32')]!==_0xd366('0x42')){var _0xa91905={};_0xa91905[_0x4315d3[_0xd366('0x2c')]]={'$like':'%'+_0x5c0e1a[_0xd366('0x34')][_0xd366('0x43')]+'%'};return _0xa91905;}})});}_0x5e3b79=_[_0xd366('0x41')]({},_0x5e3b79,_0x5c0e1a[_0xd366('0x44')]);var _0x24ac52={'where':_0x5e3b79[_0xd366('0x3e')]};return db[_0xd366('0x30')][_0xd366('0x24')](_0x24ac52)[_0xd366('0x29')](function(_0x34cfe7){_0x25e68a['count']=_0x34cfe7;if(_0x5c0e1a['query'][_0xd366('0x45')]){_0x5e3b79[_0xd366('0x46')]=[{'all':!![]}];}return db[_0xd366('0x30')][_0xd366('0x47')](_0x5e3b79);})[_0xd366('0x29')](function(_0x17444f){_0x25e68a[_0xd366('0x48')]=_0x17444f;return _0x25e68a;})[_0xd366('0x29')](respondWithFilteredResult(_0x1833f9,_0x5e3b79))[_0xd366('0x49')](handleError(_0x1833f9,null));};exports['show']=function(_0x470aaf,_0x275cb3){var _0x470ff2={'raw':!![],'where':{'id':_0x470aaf[_0xd366('0x4a')]['id']}},_0x420fef={};_0x420fef[_0xd366('0x37')]=_[_0xd366('0x35')](db[_0xd366('0x30')]['rawAttributes']);_0x420fef[_0xd366('0x34')]=_[_0xd366('0x35')](_0x470aaf[_0xd366('0x34')]);_0x420fef[_0xd366('0x3f')]=_[_0xd366('0x36')](_0x420fef[_0xd366('0x37')],_0x420fef[_0xd366('0x34')]);_0x470ff2['attributes']=_['intersection'](_0x420fef[_0xd366('0x37')],qs[_0xd366('0x39')](_0x470aaf[_0xd366('0x34')][_0xd366('0x39')]));_0x470ff2['attributes']=_0x470ff2['attributes'][_0xd366('0x3a')]?_0x470ff2[_0xd366('0x38')]:_0x420fef['model'];if(_0x470aaf['query'][_0xd366('0x45')]){_0x470ff2[_0xd366('0x46')]=[{'all':!![]}];}_0x470ff2=_[_0xd366('0x41')]({},_0x470ff2,_0x470aaf[_0xd366('0x44')]);return db[_0xd366('0x30')]['find'](_0x470ff2)[_0xd366('0x29')](handleEntityNotFound(_0x275cb3,null))[_0xd366('0x29')](respondWithResult(_0x275cb3,null))['catch'](handleError(_0x275cb3,null));};exports[_0xd366('0x4b')]=function(_0x58e881,_0x2057d9){return db[_0xd366('0x30')]['create'](_0x58e881['body'],{})[_0xd366('0x29')](respondWithResult(_0x2057d9,0xc9))[_0xd366('0x49')](handleError(_0x2057d9,null));};exports['update']=function(_0x5c4395,_0x4afbc5){if(_0x5c4395[_0xd366('0x4c')]['id']){delete _0x5c4395[_0xd366('0x4c')]['id'];}return db[_0xd366('0x30')]['find']({'where':{'id':_0x5c4395[_0xd366('0x4a')]['id']}})[_0xd366('0x29')](handleEntityNotFound(_0x4afbc5,null))[_0xd366('0x29')](saveUpdates(_0x5c4395[_0xd366('0x4c')],null))[_0xd366('0x29')](respondWithResult(_0x4afbc5,null))['catch'](handleError(_0x4afbc5,null));};exports[_0xd366('0x2a')]=function(_0x5f4596,_0x2aad35){return db['VtigerField'][_0xd366('0x4d')]({'where':{'id':_0x5f4596[_0xd366('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2aad35,null))[_0xd366('0x29')](removeEntity(_0x2aad35,null))[_0xd366('0x49')](handleError(_0x2aad35,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3da5f9b..56105a9 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 _0x3dca=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x137651,_0x285956){var _0x113cc4=function(_0x3c41f3){while(--_0x3c41f3){_0x137651['push'](_0x137651['shift']());}};_0x113cc4(++_0x285956);}(_0x3dca,0x1bb));var _0xa3dc=function(_0x47e3f8,_0x34d49e){_0x47e3f8=_0x47e3f8-0x0;var _0x471145=_0x3dca[_0x47e3f8];return _0x471145;};'use strict';var _=require(_0xa3dc('0x0'));var util=require(_0xa3dc('0x1'));var logger=require('../../config/logger')(_0xa3dc('0x2'));var moment=require(_0xa3dc('0x3'));var BPromise=require(_0xa3dc('0x4'));var rp=require(_0xa3dc('0x5'));var fs=require('fs');var path=require(_0xa3dc('0x6'));var rimraf=require(_0xa3dc('0x7'));var config=require(_0xa3dc('0x8'));var attributes=require(_0xa3dc('0x9'));module[_0xa3dc('0xa')]=function(_0x56ec64,_0x5e54f4){return _0x56ec64[_0xa3dc('0xb')](_0xa3dc('0xc'),attributes,{'tableName':_0xa3dc('0xd'),'paranoid':![],'indexes':[{'name':_0xa3dc('0xe'),'fields':[_0xa3dc('0xf'),_0xa3dc('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x309d=['exports','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x5374c9,_0x5239e8){var _0x1f4e5e=function(_0x521086){while(--_0x521086){_0x5374c9['push'](_0x5374c9['shift']());}};_0x1f4e5e(++_0x5239e8);}(_0x309d,0x6e));var _0xd309=function(_0x1ddc89,_0x16620d){_0x1ddc89=_0x1ddc89-0x0;var _0x386695=_0x309d[_0x1ddc89];return _0x386695;};'use strict';var _=require(_0xd309('0x0'));var util=require('util');var logger=require(_0xd309('0x1'))(_0xd309('0x2'));var moment=require(_0xd309('0x3'));var BPromise=require(_0xd309('0x4'));var rp=require(_0xd309('0x5'));var fs=require('fs');var path=require(_0xd309('0x6'));var rimraf=require(_0xd309('0x7'));var config=require(_0xd309('0x8'));var attributes=require(_0xd309('0x9'));module[_0xd309('0xa')]=function(_0x2b0aa4,_0x1d65d4){return _0x2b0aa4['define']('VtigerField',attributes,{'tableName':_0xd309('0xb'),'paranoid':![],'indexes':[{'name':_0xd309('0xc'),'fields':[_0xd309('0xd'),_0xd309('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 19c8e51..2c1964e 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 _0x3c85=['request','then','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1dc9ce,_0x3e7865){var _0x23a357=function(_0x5be331){while(--_0x5be331){_0x1dc9ce['push'](_0x1dc9ce['shift']());}};_0x23a357(++_0x3e7865);}(_0x3c85,0x113));var _0x53c8=function(_0x3ff496,_0x3e9bbe){_0x3ff496=_0x3ff496-0x0;var _0x36bff8=_0x3c85[_0x3ff496];return _0x36bff8;};'use strict';var _=require(_0x53c8('0x0'));var util=require(_0x53c8('0x1'));var moment=require(_0x53c8('0x2'));var BPromise=require(_0x53c8('0x3'));var rs=require(_0x53c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53c8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53c8('0x6'))(_0x53c8('0x7'));var config=require(_0x53c8('0x8'));var jayson=require(_0x53c8('0x9'));var client=jayson[_0x53c8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25c465,_0x494543,_0x331e2b){return new BPromise(function(_0x224e44,_0x2e6498){return client[_0x53c8('0xb')](_0x25c465,_0x331e2b)[_0x53c8('0xc')](function(_0x148d88){logger['info']('VtigerField,\x20%s,\x20%s',_0x494543,_0x53c8('0xd'));logger[_0x53c8('0xe')](_0x53c8('0xf'),_0x494543,_0x53c8('0xd'),JSON[_0x53c8('0x10')](_0x148d88));if(_0x148d88[_0x53c8('0x11')]){if(_0x148d88[_0x53c8('0x11')][_0x53c8('0x12')]===0x1f4){logger['error'](_0x53c8('0x13'),_0x494543,_0x148d88[_0x53c8('0x11')][_0x53c8('0x14')]);return _0x2e6498(_0x148d88[_0x53c8('0x11')][_0x53c8('0x14')]);}logger[_0x53c8('0x11')](_0x53c8('0x13'),_0x494543,_0x148d88[_0x53c8('0x11')][_0x53c8('0x14')]);return _0x224e44(_0x148d88['error'][_0x53c8('0x14')]);}else{logger['info'](_0x53c8('0x13'),_0x494543,_0x53c8('0xd'));_0x224e44(_0x148d88['result'][_0x53c8('0x14')]);}})[_0x53c8('0x15')](function(_0x148ab7){logger[_0x53c8('0x11')](_0x53c8('0x13'),_0x494543,_0x148ab7);_0x2e6498(_0x148ab7);});});} \ No newline at end of file +var _0x4d92=['debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0x4d92,0x1ce));var _0x24d9=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0x4d92[_0x207d2f];return _0x3c3498;};'use strict';var _=require(_0x24d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x24d9('0x1'));var rs=require(_0x24d9('0x2'));var fs=require('fs');var Redis=require(_0x24d9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x24d9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x24d9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x24d9('0x6')][_0x24d9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14ce33,_0x32575a,_0x55f7bf){return new BPromise(function(_0x11acd7,_0xeb194e){return client[_0x24d9('0x8')](_0x14ce33,_0x55f7bf)[_0x24d9('0x9')](function(_0x2ad441){logger[_0x24d9('0xa')](_0x24d9('0xb'),_0x32575a,_0x24d9('0xc'));logger[_0x24d9('0xd')](_0x24d9('0xe'),_0x32575a,'request\x20sent',JSON[_0x24d9('0xf')](_0x2ad441));if(_0x2ad441[_0x24d9('0x10')]){if(_0x2ad441[_0x24d9('0x10')]['code']===0x1f4){logger[_0x24d9('0x10')]('VtigerField,\x20%s,\x20%s',_0x32575a,_0x2ad441['error'][_0x24d9('0x11')]);return _0xeb194e(_0x2ad441['error'][_0x24d9('0x11')]);}logger[_0x24d9('0x10')](_0x24d9('0xb'),_0x32575a,_0x2ad441[_0x24d9('0x10')][_0x24d9('0x11')]);return _0x11acd7(_0x2ad441[_0x24d9('0x10')][_0x24d9('0x11')]);}else{logger[_0x24d9('0xa')](_0x24d9('0xb'),_0x32575a,_0x24d9('0xc'));_0x11acd7(_0x2ad441[_0x24d9('0x12')][_0x24d9('0x11')]);}})['catch'](function(_0x5814c0){logger['error'](_0x24d9('0xb'),_0x32575a,_0x5814c0);_0xeb194e(_0x5814c0);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index cb29d82..8e97610 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 _0xd399=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd399,0x181));var _0x9d39=function(_0x184e9d,_0x30e7f3){_0x184e9d=_0x184e9d-0x0;var _0x373537=_0xd399[_0x184e9d];return _0x373537;};'use strict';var multer=require(_0x9d39('0x0'));var util=require(_0x9d39('0x1'));var path=require(_0x9d39('0x2'));var timeout=require(_0x9d39('0x3'));var express=require('express');var router=express[_0x9d39('0x4')]();var fs_extra=require(_0x9d39('0x5'));var auth=require(_0x9d39('0x6'));var interaction=require(_0x9d39('0x7'));var config=require(_0x9d39('0x8'));var controller=require('./intZendeskAccount.controller');router[_0x9d39('0x9')]('/',auth[_0x9d39('0xa')](),controller[_0x9d39('0xb')]);router['get'](_0x9d39('0xc'),auth[_0x9d39('0xa')](),controller[_0x9d39('0xd')]);router[_0x9d39('0x9')](_0x9d39('0xe'),auth[_0x9d39('0xa')](),controller[_0x9d39('0xf')]);router['get']('/:id/fields',auth[_0x9d39('0xa')](),controller[_0x9d39('0x10')]);router[_0x9d39('0x11')]('/',auth[_0x9d39('0xa')](),controller[_0x9d39('0x12')]);router[_0x9d39('0x11')](_0x9d39('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x9d39('0x13')](_0x9d39('0xc'),auth[_0x9d39('0xa')](),controller[_0x9d39('0x14')]);router[_0x9d39('0x15')](_0x9d39('0xc'),auth[_0x9d39('0xa')](),controller[_0x9d39('0x16')]);module['exports']=router; \ No newline at end of file +var _0x57ca=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get'];(function(_0x2c49d4,_0x1c1e18){var _0x10b70c=function(_0x2d6645){while(--_0x2d6645){_0x2c49d4['push'](_0x2c49d4['shift']());}};_0x10b70c(++_0x1c1e18);}(_0x57ca,0x108));var _0xa57c=function(_0x19ad63,_0x4df85e){_0x19ad63=_0x19ad63-0x0;var _0x26a275=_0x57ca[_0x19ad63];return _0x26a275;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0x8')]('/:id/fields',auth[_0xa57c('0x9')](),controller['getFields']);router[_0xa57c('0xf')]('/',auth[_0xa57c('0x9')](),controller['create']);router[_0xa57c('0xf')]('/:id/configurations',auth[_0xa57c('0x9')](),controller[_0xa57c('0x10')]);router[_0xa57c('0x11')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x12')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x13')]);module[_0xa57c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 442f8c0..12a59ea 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 _0xef66=['password','token','integrationTab','sequelize','exports','STRING','remoteUri','ENUM'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xef66,0x1db));var _0x6ef6=function(_0x18c679,_0x243a4a){_0x18c679=_0x18c679-0x0;var _0x178c74=_0xef66[_0x18c679];return _0x178c74;};'use strict';var Sequelize=require(_0x6ef6('0x0'));module[_0x6ef6('0x1')]={'name':{'type':Sequelize[_0x6ef6('0x2')]},'description':{'type':Sequelize[_0x6ef6('0x2')]},'username':{'type':Sequelize[_0x6ef6('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6ef6('0x2')]},'remoteUri':{'type':Sequelize[_0x6ef6('0x2')],'unique':_0x6ef6('0x3')},'authType':{'type':Sequelize[_0x6ef6('0x4')](_0x6ef6('0x5'),_0x6ef6('0x6')),'defaultValue':_0x6ef6('0x5')},'serverUrl':{'type':Sequelize[_0x6ef6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6ef6('0x4')]('integrationTab','newTab'),'defaultValue':_0x6ef6('0x7')}}; \ No newline at end of file +var _0xeae8=['token','integrationTab','newTab','sequelize','exports','STRING','remoteUri','ENUM','password'];(function(_0xc2b869,_0x1ad5f1){var _0x2091fd=function(_0x30e658){while(--_0x30e658){_0xc2b869['push'](_0xc2b869['shift']());}};_0x2091fd(++_0x1ad5f1);}(_0xeae8,0x66));var _0x8eae=function(_0x5dd7a6,_0x1e23d9){_0x5dd7a6=_0x5dd7a6-0x0;var _0x330c53=_0xeae8[_0x5dd7a6];return _0x330c53;};'use strict';var Sequelize=require(_0x8eae('0x0'));module[_0x8eae('0x1')]={'name':{'type':Sequelize[_0x8eae('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8eae('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x8eae('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8eae('0x2')],'unique':_0x8eae('0x3')},'authType':{'type':Sequelize[_0x8eae('0x4')](_0x8eae('0x5'),_0x8eae('0x6')),'defaultValue':_0x8eae('0x5')},'serverUrl':{'type':Sequelize[_0x8eae('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8eae('0x4')](_0x8eae('0x7'),_0x8eae('0x8')),'defaultValue':_0x8eae('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d35e40a..7437a49 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 _0x7072=['model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','count','includeAll','findAll','catch','show','fields','length','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x423797,_0x3d393b){var _0x57ec0c=function(_0x24c145){while(--_0x24c145){_0x423797['push'](_0x423797['shift']());}};_0x57ec0c(++_0x3d393b);}(_0x7072,0x138));var _0x2707=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x7072[_0x485b5a];return _0xd2b34d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];var integrations=require(_0x2707('0x1a'));function respondWithStatusCode(_0x40d370,_0x5bf16e){_0x5bf16e=_0x5bf16e||0xcc;return function(_0x44c1d7){if(_0x44c1d7){return _0x40d370['sendStatus'](_0x5bf16e);}return _0x40d370[_0x2707('0x1b')](_0x5bf16e)[_0x2707('0x1c')]();};}function respondWithResult(_0xfe975c,_0x3a67f2){_0x3a67f2=_0x3a67f2||0xc8;return function(_0x13d9ac){if(_0x13d9ac){return _0xfe975c['status'](_0x3a67f2)[_0x2707('0x1d')](_0x13d9ac);}};}function respondWithFilteredResult(_0x1a687a,_0x2f6381){return function(_0x5d523f){if(_0x5d523f){var _0x1153d7=typeof _0x2f6381[_0x2707('0x1e')]===_0x2707('0x1f')&&typeof _0x2f6381[_0x2707('0x20')]===_0x2707('0x1f');var _0x27a3ea=_0x5d523f['count'];var _0x119ac4=_0x1153d7?0x0:_0x2f6381[_0x2707('0x1e')];var _0x4009f3=_0x1153d7?_0x5d523f['count']:_0x2f6381['offset']+_0x2f6381['limit'];var _0x1da4a6;if(_0x4009f3>=_0x27a3ea){_0x4009f3=_0x27a3ea;_0x1da4a6=0xc8;}else{_0x1da4a6=0xce;}_0x1a687a[_0x2707('0x1b')](_0x1da4a6);return _0x1a687a[_0x2707('0x21')](_0x2707('0x22'),_0x119ac4+'-'+_0x4009f3+'/'+_0x27a3ea)[_0x2707('0x1d')](_0x5d523f);}return null;};}function patchUpdates(_0x3c2935){return function(_0xab87f1){try{jsonpatch[_0x2707('0x23')](_0xab87f1,_0x3c2935,!![]);}catch(_0x1e50ea){return BPromise[_0x2707('0x24')](_0x1e50ea);}return _0xab87f1[_0x2707('0x25')]();};}function saveUpdates(_0x119df4,_0x454fde){return function(_0x1c0ffe){if(_0x1c0ffe){return _0x1c0ffe['update'](_0x119df4)[_0x2707('0x26')](function(_0x3b030a){return _0x3b030a;});}return null;};}function removeEntity(_0x46259e,_0x369e3a){return function(_0x378ca4){if(_0x378ca4){return _0x378ca4[_0x2707('0x27')]()['then'](function(){_0x46259e[_0x2707('0x1b')](0xcc)[_0x2707('0x1c')]();});}};}function handleEntityNotFound(_0x171add,_0x2ad386){return function(_0x5b763f){if(!_0x5b763f){_0x171add['sendStatus'](0x194);}return _0x5b763f;};}function handleError(_0x2dce16,_0x4ca05d){_0x4ca05d=_0x4ca05d||0x1f4;return function(_0x29dad2){logger[_0x2707('0x28')](_0x29dad2[_0x2707('0x29')]);if(_0x29dad2['name']){delete _0x29dad2[_0x2707('0x2a')];}_0x2dce16[_0x2707('0x1b')](_0x4ca05d)[_0x2707('0x2b')](_0x29dad2);};}exports['index']=function(_0x31e990,_0x42adf8){var _0x4a99ce={},_0xd63d3f={},_0x497c92={'count':0x0,'rows':[]};var _0x5aaffb=_[_0x2707('0x2c')](db['ZendeskAccount'][_0x2707('0x2d')],function(_0x3f153d){return{'name':_0x3f153d[_0x2707('0x2e')],'type':_0x3f153d[_0x2707('0x2f')]['key']};});_0xd63d3f[_0x2707('0x30')]=_[_0x2707('0x2c')](_0x5aaffb,_0x2707('0x2a'));_0xd63d3f[_0x2707('0x31')]=_[_0x2707('0x32')](_0x31e990[_0x2707('0x31')]);_0xd63d3f[_0x2707('0x33')]=_[_0x2707('0x34')](_0xd63d3f[_0x2707('0x30')],_0xd63d3f['query']);_0x4a99ce[_0x2707('0x35')]=_[_0x2707('0x34')](_0xd63d3f['model'],qs['fields'](_0x31e990['query']['fields']));_0x4a99ce['attributes']=_0x4a99ce[_0x2707('0x35')]['length']?_0x4a99ce['attributes']:_0xd63d3f[_0x2707('0x30')];if(!_0x31e990[_0x2707('0x31')]['hasOwnProperty'](_0x2707('0x36'))){_0x4a99ce[_0x2707('0x20')]=qs['limit'](_0x31e990['query'][_0x2707('0x20')]);_0x4a99ce[_0x2707('0x1e')]=qs['offset'](_0x31e990['query'][_0x2707('0x1e')]);}_0x4a99ce[_0x2707('0x37')]=qs['sort'](_0x31e990[_0x2707('0x31')][_0x2707('0x38')]);_0x4a99ce[_0x2707('0x39')]=qs[_0x2707('0x33')](_[_0x2707('0x3a')](_0x31e990[_0x2707('0x31')],_0xd63d3f['filters']),_0x5aaffb);if(_0x31e990[_0x2707('0x31')][_0x2707('0x3b')]){_0x4a99ce[_0x2707('0x39')]=_[_0x2707('0x3c')](_0x4a99ce[_0x2707('0x39')],{'$or':_[_0x2707('0x2c')](_0x5aaffb,function(_0x2700bf){if(_0x2700bf['type']!==_0x2707('0x3d')){var _0x2473e3={};_0x2473e3[_0x2700bf[_0x2707('0x2a')]]={'$like':'%'+_0x31e990[_0x2707('0x31')][_0x2707('0x3b')]+'%'};return _0x2473e3;}})});}_0x4a99ce=_[_0x2707('0x3c')]({},_0x4a99ce,_0x31e990[_0x2707('0x3e')]);var _0x39d9f6={'where':_0x4a99ce[_0x2707('0x39')]};return db[_0x2707('0x3f')][_0x2707('0x40')](_0x39d9f6)[_0x2707('0x26')](function(_0x2a221c){_0x497c92[_0x2707('0x40')]=_0x2a221c;if(_0x31e990[_0x2707('0x31')][_0x2707('0x41')]){_0x4a99ce['include']=[{'all':!![]}];}return db[_0x2707('0x3f')][_0x2707('0x42')](_0x4a99ce);})['then'](function(_0x358aa8){_0x497c92['rows']=_0x358aa8;return _0x497c92;})[_0x2707('0x26')](respondWithFilteredResult(_0x42adf8,_0x4a99ce))[_0x2707('0x43')](handleError(_0x42adf8,null));};exports[_0x2707('0x44')]=function(_0x1d69d3,_0x13e1c0){var _0xdeec24={'raw':![],'where':{'id':_0x1d69d3['params']['id']}},_0x26b464={};_0x26b464[_0x2707('0x30')]=_[_0x2707('0x32')](db['ZendeskAccount'][_0x2707('0x2d')]);_0x26b464[_0x2707('0x31')]=_[_0x2707('0x32')](_0x1d69d3['query']);_0x26b464['filters']=_[_0x2707('0x34')](_0x26b464[_0x2707('0x30')],_0x26b464['query']);_0xdeec24[_0x2707('0x35')]=_['intersection'](_0x26b464[_0x2707('0x30')],qs[_0x2707('0x45')](_0x1d69d3[_0x2707('0x31')][_0x2707('0x45')]));_0xdeec24['attributes']=_0xdeec24[_0x2707('0x35')][_0x2707('0x46')]?_0xdeec24[_0x2707('0x35')]:_0x26b464[_0x2707('0x30')];if(_0x1d69d3[_0x2707('0x31')][_0x2707('0x41')]){_0xdeec24[_0x2707('0x47')]=[{'all':!![]}];}_0xdeec24=_['merge']({},_0xdeec24,_0x1d69d3[_0x2707('0x3e')]);return db[_0x2707('0x3f')][_0x2707('0x48')](_0xdeec24)[_0x2707('0x26')](handleEntityNotFound(_0x13e1c0,null))[_0x2707('0x26')](respondWithResult(_0x13e1c0,null))['catch'](handleError(_0x13e1c0,null));};exports[_0x2707('0x49')]=function(_0x4a6eea,_0xf96f41){return db[_0x2707('0x3f')]['create'](_0x4a6eea[_0x2707('0x4a')],{})[_0x2707('0x26')](respondWithResult(_0xf96f41,0xc9))[_0x2707('0x43')](handleError(_0xf96f41,null));};exports['update']=function(_0x1a8034,_0x59c60f){if(_0x1a8034[_0x2707('0x4a')]['id']){delete _0x1a8034[_0x2707('0x4a')]['id'];}return db['ZendeskAccount'][_0x2707('0x48')]({'where':{'id':_0x1a8034[_0x2707('0x4b')]['id']}})[_0x2707('0x26')](handleEntityNotFound(_0x59c60f,null))['then'](saveUpdates(_0x1a8034['body'],null))[_0x2707('0x26')](respondWithResult(_0x59c60f,null))[_0x2707('0x43')](handleError(_0x59c60f,null));};exports[_0x2707('0x27')]=function(_0x2515dc,_0x463bf){return db['ZendeskAccount']['find']({'where':{'id':_0x2515dc['params']['id']}})[_0x2707('0x26')](handleEntityNotFound(_0x463bf,null))[_0x2707('0x26')](removeEntity(_0x463bf,null))[_0x2707('0x43')](handleError(_0x463bf,null));};exports[_0x2707('0x4c')]=function(_0x1ffcce,_0x5b622c,_0xa2c4c0){var _0x2df682={};var _0x5c99fd={};var _0x482ed1;var _0x3b41b2;return db[_0x2707('0x3f')][_0x2707('0x4d')]({'where':{'id':_0x1ffcce['params']['id']}})[_0x2707('0x26')](handleEntityNotFound(_0x5b622c,null))[_0x2707('0x26')](function(_0x2a2a71){if(_0x2a2a71){_0x482ed1=_0x2a2a71;_0x5c99fd[_0x2707('0x30')]=_['keys'](db[_0x2707('0x4e')][_0x2707('0x2d')]);_0x5c99fd[_0x2707('0x31')]=_[_0x2707('0x32')](_0x1ffcce[_0x2707('0x31')]);_0x5c99fd[_0x2707('0x33')]=_[_0x2707('0x34')](_0x5c99fd[_0x2707('0x30')],_0x5c99fd[_0x2707('0x31')]);_0x2df682[_0x2707('0x35')]=_['intersection'](_0x5c99fd[_0x2707('0x30')],qs['fields'](_0x1ffcce['query'][_0x2707('0x45')]));_0x2df682['attributes']=_0x2df682['attributes'][_0x2707('0x46')]?_0x2df682[_0x2707('0x35')]:_0x5c99fd[_0x2707('0x30')];_0x2df682[_0x2707('0x37')]=qs[_0x2707('0x38')](_0x1ffcce[_0x2707('0x31')][_0x2707('0x38')]);_0x2df682[_0x2707('0x39')]=qs[_0x2707('0x33')](_[_0x2707('0x3a')](_0x1ffcce[_0x2707('0x31')],_0x5c99fd['filters']));if(_0x1ffcce['query']['filter']){_0x2df682[_0x2707('0x39')]=_[_0x2707('0x3c')](_0x2df682[_0x2707('0x39')],{'$or':_['map'](_0x2df682['attributes'],function(_0x33ce37){var _0x39c9b4={};_0x39c9b4[_0x33ce37]={'$like':'%'+_0x1ffcce[_0x2707('0x31')][_0x2707('0x3b')]+'%'};return _0x39c9b4;})});}_0x2df682=_[_0x2707('0x3c')]({},_0x2df682,_0x1ffcce['options']);return _0x482ed1['getConfigurations'](_0x2df682);}})[_0x2707('0x26')](function(_0x6a3e8d){if(_0x6a3e8d){_0x3b41b2=_0x6a3e8d[_0x2707('0x46')];if(!_0x1ffcce[_0x2707('0x31')][_0x2707('0x4f')](_0x2707('0x36'))){_0x2df682[_0x2707('0x20')]=qs[_0x2707('0x20')](_0x1ffcce[_0x2707('0x31')]['limit']);_0x2df682[_0x2707('0x1e')]=qs[_0x2707('0x1e')](_0x1ffcce[_0x2707('0x31')][_0x2707('0x1e')]);}return _0x482ed1[_0x2707('0x4c')](_0x2df682);}})[_0x2707('0x26')](function(_0x519042){if(_0x519042){return _0x519042?{'count':_0x3b41b2,'rows':_0x519042}:null;}})['then'](respondWithResult(_0x5b622c,null))[_0x2707('0x43')](handleError(_0x5b622c,null));};exports[_0x2707('0x50')]=function(_0x4eb8eb,_0x58fefc,_0x4f14e0){if(_0x4eb8eb['body']['id']){delete _0x4eb8eb[_0x2707('0x4a')]['id'];}return db[_0x2707('0x3f')]['findOne']({'where':{'id':_0x4eb8eb[_0x2707('0x4b')]['id']}})[_0x2707('0x26')](handleEntityNotFound(_0x58fefc,null))[_0x2707('0x26')](function(_0x5bad5a){if(_0x5bad5a){_0x4eb8eb['body'][_0x2707('0x51')]=_0x5bad5a['id'];_0x4eb8eb[_0x2707('0x4a')][_0x2707('0x52')]=integrations[_0x2707('0x53')](_0x4eb8eb[_0x2707('0x4a')][_0x2707('0x54')],_0x4eb8eb[_0x2707('0x4a')]['type']);_0x4eb8eb[_0x2707('0x4a')][_0x2707('0x55')]=integrations[_0x2707('0x56')](_0x4eb8eb[_0x2707('0x4a')][_0x2707('0x54')],_0x4eb8eb[_0x2707('0x4a')]['type']);return db[_0x2707('0x4e')][_0x2707('0x49')](_0x4eb8eb[_0x2707('0x4a')],{'include':[{'model':db[_0x2707('0x57')],'as':_0x2707('0x52')},{'model':db[_0x2707('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x58fefc,null))[_0x2707('0x43')](handleError(_0x58fefc,null));};exports[_0x2707('0x58')]=function(_0x354322,_0x42da4e,_0x3ae5c6){var _0x2af149='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x354322[_0x2707('0x4b')]['id']},'attributes':['id','username',_0x2707('0x59'),_0x2707('0x5a'),_0x2707('0x5b'),_0x2707('0x5c')]})[_0x2707('0x26')](handleEntityNotFound(_0x42da4e,null))[_0x2707('0x26')](function(_0x5bb260){if(_0x5bb260){_0x2af149=_0x5bb260[_0x2707('0x5c')];var _0x4787d7=_0x2af149[_0x2707('0x5d')](-0x1);if(_0x4787d7==='/'){_0x2af149=_0x2af149[_0x2707('0x5e')](0x0,_0x2af149['lastIndexOf'](_0x4787d7));}var _0x155c4f={'method':_0x2707('0x5f'),'uri':util[_0x2707('0x60')](_0x2707('0x61'),_0x2af149,_0x2707('0x62')),'json':!![]};switch(_0x5bb260['authType']){case _0x2707('0x59'):_0x155c4f[_0x2707('0x63')]={'Authorization':util[_0x2707('0x60')](_0x2707('0x64'),new Buffer(util[_0x2707('0x60')](_0x2707('0x65'),_0x5bb260[_0x2707('0x66')],_0x5bb260[_0x2707('0x59')]))[_0x2707('0x67')](_0x2707('0x68')))};break;case _0x2707('0x5a'):_0x155c4f[_0x2707('0x63')]={'Authorization':util[_0x2707('0x60')](_0x2707('0x64'),new Buffer(util[_0x2707('0x60')](_0x2707('0x69'),_0x5bb260[_0x2707('0x66')],_0x5bb260[_0x2707('0x5a')]))['toString'](_0x2707('0x68')))};break;default:throw new db['Sequelize']['ValidationError'](_0x2707('0x6a'));}return rp(_0x155c4f);}})[_0x2707('0x26')](function(_0x35a62c){if(_0x35a62c){var _0x11ac13=[_0x2707('0x6b'),_0x2707('0x6c'),'group',_0x2707('0x6d')];_[_0x2707('0x6e')](_0x35a62c[_0x2707('0x62')],function(_0x54009a){return _0x11ac13[_0x2707('0x6f')](_0x54009a[_0x2707('0x2f')]);});return{'count':_0x35a62c[_0x2707('0x62')][_0x2707('0x46')],'rows':_['map'](_0x35a62c[_0x2707('0x62')],function(_0x5c68d6){return{'id':_0x5c68d6['id'],'name':_0x5c68d6[_0x2707('0x70')]>0x7?_0x5c68d6[_0x2707('0x71')]:_0x5c68d6[_0x2707('0x2f')],'custom':_0x5c68d6[_0x2707('0x70')]>0x7?!![]:![],'options':_0x5c68d6[_0x2707('0x72')]?_0x5c68d6[_0x2707('0x72')]:_0x5c68d6[_0x2707('0x73')]?_0x5c68d6[_0x2707('0x73')]:[]};})};}})[_0x2707('0x26')](respondWithResult(_0x42da4e,null))['catch'](function(_0x4530bc){var _0x5a1a24=_0x354322[_0x2707('0x31')][_0x2707('0x74')]?0x1f4:_0x4530bc[_0x2707('0x75')]||0x1f4;logger[_0x2707('0x28')](_0x2707('0x76'),_0x2707('0x58'),_0x5a1a24,JSON['stringify'](_0x4530bc));delete _0x4530bc['name'];if(_0x5a1a24===0x191){_0x5a1a24=0x190;}_0x42da4e[_0x2707('0x1b')](_0x5a1a24)['send'](_0x354322[_0x2707('0x31')][_0x2707('0x74')]?{'message':_0x2707('0x77'),'statusCode':_0x4530bc[_0x2707('0x75')]}:_0x4530bc);});}; \ No newline at end of file +var _0x6b20=['../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','merge','create','body','find','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','authType','remoteUri','slice','format','Basic\x20%s','%s:%s','toString','base64','token','headers','Sequelize','ValidationError','Unknown\x20authentication\x20type','remove','includes','ticket_fields','position','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x402681,_0x1d0f63){var _0x2c8a46=function(_0x26f057){while(--_0x26f057){_0x402681['push'](_0x402681['shift']());}};_0x2c8a46(++_0x1d0f63);}(_0x6b20,0xd1));var _0x06b2=function(_0x4fc4dd,_0x4e3ffc){_0x4fc4dd=_0x4fc4dd-0x0;var _0x464a16=_0x6b20[_0x4fc4dd];return _0x464a16;};'use strict';var emlformat=require(_0x06b2('0x0'));var rimraf=require(_0x06b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b2('0x2'));var rp=require('request-promise');var moment=require(_0x06b2('0x3'));var BPromise=require(_0x06b2('0x4'));var Mustache=require(_0x06b2('0x5'));var util=require('util');var path=require(_0x06b2('0x6'));var sox=require(_0x06b2('0x7'));var csv=require(_0x06b2('0x8'));var ejs=require(_0x06b2('0x9'));var fs=require('fs');var fs_extra=require(_0x06b2('0xa'));var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x8'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var Redis=require('ioredis');var authService=require(_0x06b2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06b2('0x11'));var logger=require(_0x06b2('0x12'))('api');var utils=require(_0x06b2('0x13'));var config=require(_0x06b2('0x14'));var licenseUtil=require(_0x06b2('0x15'));var db=require(_0x06b2('0x16'))['db'];var integrations=require(_0x06b2('0x17'));function respondWithStatusCode(_0x810a12,_0x3039c9){_0x3039c9=_0x3039c9||0xcc;return function(_0x926bf6){if(_0x926bf6){return _0x810a12[_0x06b2('0x18')](_0x3039c9);}return _0x810a12[_0x06b2('0x19')](_0x3039c9)[_0x06b2('0x1a')]();};}function respondWithResult(_0x2822e9,_0x26faee){_0x26faee=_0x26faee||0xc8;return function(_0x544de8){if(_0x544de8){return _0x2822e9[_0x06b2('0x19')](_0x26faee)[_0x06b2('0x1b')](_0x544de8);}};}function respondWithFilteredResult(_0x47496c,_0x3830e9){return function(_0xef0466){if(_0xef0466){var _0x45d5c5=typeof _0x3830e9['offset']===_0x06b2('0x1c')&&typeof _0x3830e9[_0x06b2('0x1d')]==='undefined';var _0x1e16d1=_0xef0466['count'];var _0x4c9cae=_0x45d5c5?0x0:_0x3830e9[_0x06b2('0x1e')];var _0x1b4ab0=_0x45d5c5?_0xef0466[_0x06b2('0x1f')]:_0x3830e9[_0x06b2('0x1e')]+_0x3830e9['limit'];var _0x288801;if(_0x1b4ab0>=_0x1e16d1){_0x1b4ab0=_0x1e16d1;_0x288801=0xc8;}else{_0x288801=0xce;}_0x47496c[_0x06b2('0x19')](_0x288801);return _0x47496c[_0x06b2('0x20')](_0x06b2('0x21'),_0x4c9cae+'-'+_0x1b4ab0+'/'+_0x1e16d1)[_0x06b2('0x1b')](_0xef0466);}return null;};}function patchUpdates(_0x368ad8){return function(_0x268e7d){try{jsonpatch['apply'](_0x268e7d,_0x368ad8,!![]);}catch(_0x18c9a9){return BPromise[_0x06b2('0x22')](_0x18c9a9);}return _0x268e7d[_0x06b2('0x23')]();};}function saveUpdates(_0x208384,_0x4e2a4c){return function(_0x4fa84f){if(_0x4fa84f){return _0x4fa84f[_0x06b2('0x24')](_0x208384)[_0x06b2('0x25')](function(_0x4fc95f){return _0x4fc95f;});}return null;};}function removeEntity(_0x39659f,_0x5e40f2){return function(_0x3d58c6){if(_0x3d58c6){return _0x3d58c6[_0x06b2('0x26')]()[_0x06b2('0x25')](function(){_0x39659f['status'](0xcc)[_0x06b2('0x1a')]();});}};}function handleEntityNotFound(_0x306ce,_0xc65820){return function(_0x1a94dc){if(!_0x1a94dc){_0x306ce[_0x06b2('0x18')](0x194);}return _0x1a94dc;};}function handleError(_0x4f5e90,_0xbb00ea){_0xbb00ea=_0xbb00ea||0x1f4;return function(_0x34370b){logger[_0x06b2('0x27')](_0x34370b[_0x06b2('0x28')]);if(_0x34370b[_0x06b2('0x29')]){delete _0x34370b[_0x06b2('0x29')];}_0x4f5e90['status'](_0xbb00ea)[_0x06b2('0x2a')](_0x34370b);};}exports[_0x06b2('0x2b')]=function(_0x2720fa,_0x13c0eb){var _0x1f02d8={},_0x1bfaa9={},_0x3668bb={'count':0x0,'rows':[]};var _0x51698b=_[_0x06b2('0x2c')](db[_0x06b2('0x2d')][_0x06b2('0x2e')],function(_0x15a78b){return{'name':_0x15a78b[_0x06b2('0x2f')],'type':_0x15a78b[_0x06b2('0x30')][_0x06b2('0x31')]};});_0x1bfaa9[_0x06b2('0x32')]=_['map'](_0x51698b,_0x06b2('0x29'));_0x1bfaa9[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x2720fa[_0x06b2('0x33')]);_0x1bfaa9[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0x1bfaa9[_0x06b2('0x32')],_0x1bfaa9['query']);_0x1f02d8['attributes']=_[_0x06b2('0x36')](_0x1bfaa9[_0x06b2('0x32')],qs[_0x06b2('0x37')](_0x2720fa['query'][_0x06b2('0x37')]));_0x1f02d8[_0x06b2('0x38')]=_0x1f02d8[_0x06b2('0x38')][_0x06b2('0x39')]?_0x1f02d8[_0x06b2('0x38')]:_0x1bfaa9[_0x06b2('0x32')];if(!_0x2720fa['query'][_0x06b2('0x3a')](_0x06b2('0x3b'))){_0x1f02d8[_0x06b2('0x1d')]=qs['limit'](_0x2720fa[_0x06b2('0x33')][_0x06b2('0x1d')]);_0x1f02d8['offset']=qs[_0x06b2('0x1e')](_0x2720fa[_0x06b2('0x33')][_0x06b2('0x1e')]);}_0x1f02d8[_0x06b2('0x3c')]=qs[_0x06b2('0x3d')](_0x2720fa[_0x06b2('0x33')][_0x06b2('0x3d')]);_0x1f02d8[_0x06b2('0x3e')]=qs[_0x06b2('0x35')](_[_0x06b2('0x3f')](_0x2720fa[_0x06b2('0x33')],_0x1bfaa9[_0x06b2('0x35')]),_0x51698b);if(_0x2720fa['query'][_0x06b2('0x40')]){_0x1f02d8['where']=_['merge'](_0x1f02d8[_0x06b2('0x3e')],{'$or':_['map'](_0x51698b,function(_0x26ab14){if(_0x26ab14['type']!==_0x06b2('0x41')){var _0x369673={};_0x369673[_0x26ab14[_0x06b2('0x29')]]={'$like':'%'+_0x2720fa[_0x06b2('0x33')][_0x06b2('0x40')]+'%'};return _0x369673;}})});}_0x1f02d8=_['merge']({},_0x1f02d8,_0x2720fa[_0x06b2('0x42')]);var _0xee3ec6={'where':_0x1f02d8[_0x06b2('0x3e')]};return db[_0x06b2('0x2d')][_0x06b2('0x1f')](_0xee3ec6)[_0x06b2('0x25')](function(_0x5f2549){_0x3668bb[_0x06b2('0x1f')]=_0x5f2549;if(_0x2720fa[_0x06b2('0x33')]['includeAll']){_0x1f02d8['include']=[{'all':!![]}];}return db[_0x06b2('0x2d')][_0x06b2('0x43')](_0x1f02d8);})[_0x06b2('0x25')](function(_0x3a8452){_0x3668bb[_0x06b2('0x44')]=_0x3a8452;return _0x3668bb;})[_0x06b2('0x25')](respondWithFilteredResult(_0x13c0eb,_0x1f02d8))[_0x06b2('0x45')](handleError(_0x13c0eb,null));};exports[_0x06b2('0x46')]=function(_0x2e2a80,_0x117bf4){var _0x1d7750={'raw':![],'where':{'id':_0x2e2a80[_0x06b2('0x47')]['id']}},_0xf9b9e={};_0xf9b9e[_0x06b2('0x32')]=_[_0x06b2('0x34')](db[_0x06b2('0x2d')][_0x06b2('0x2e')]);_0xf9b9e[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x2e2a80['query']);_0xf9b9e[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0xf9b9e[_0x06b2('0x32')],_0xf9b9e[_0x06b2('0x33')]);_0x1d7750['attributes']=_[_0x06b2('0x36')](_0xf9b9e[_0x06b2('0x32')],qs['fields'](_0x2e2a80[_0x06b2('0x33')][_0x06b2('0x37')]));_0x1d7750['attributes']=_0x1d7750[_0x06b2('0x38')][_0x06b2('0x39')]?_0x1d7750['attributes']:_0xf9b9e['model'];if(_0x2e2a80['query'][_0x06b2('0x48')]){_0x1d7750[_0x06b2('0x49')]=[{'all':!![]}];}_0x1d7750=_[_0x06b2('0x4a')]({},_0x1d7750,_0x2e2a80[_0x06b2('0x42')]);return db[_0x06b2('0x2d')]['find'](_0x1d7750)['then'](handleEntityNotFound(_0x117bf4,null))[_0x06b2('0x25')](respondWithResult(_0x117bf4,null))[_0x06b2('0x45')](handleError(_0x117bf4,null));};exports[_0x06b2('0x4b')]=function(_0x1f4d89,_0x33ac29){return db[_0x06b2('0x2d')]['create'](_0x1f4d89[_0x06b2('0x4c')],{})[_0x06b2('0x25')](respondWithResult(_0x33ac29,0xc9))[_0x06b2('0x45')](handleError(_0x33ac29,null));};exports[_0x06b2('0x24')]=function(_0x146c5c,_0x36a74a){if(_0x146c5c['body']['id']){delete _0x146c5c[_0x06b2('0x4c')]['id'];}return db[_0x06b2('0x2d')][_0x06b2('0x4d')]({'where':{'id':_0x146c5c[_0x06b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x36a74a,null))[_0x06b2('0x25')](saveUpdates(_0x146c5c[_0x06b2('0x4c')],null))[_0x06b2('0x25')](respondWithResult(_0x36a74a,null))[_0x06b2('0x45')](handleError(_0x36a74a,null));};exports['destroy']=function(_0x346f04,_0x8cf9fe){return db[_0x06b2('0x2d')][_0x06b2('0x4d')]({'where':{'id':_0x346f04[_0x06b2('0x47')]['id']}})[_0x06b2('0x25')](handleEntityNotFound(_0x8cf9fe,null))[_0x06b2('0x25')](removeEntity(_0x8cf9fe,null))[_0x06b2('0x45')](handleError(_0x8cf9fe,null));};exports['getConfigurations']=function(_0x33bc8e,_0x8288ae,_0x318a3b){var _0x5c328c={};var _0x2857d5={};var _0x2f75a0;var _0x4fba4c;return db['ZendeskAccount'][_0x06b2('0x4e')]({'where':{'id':_0x33bc8e['params']['id']}})['then'](handleEntityNotFound(_0x8288ae,null))[_0x06b2('0x25')](function(_0x5899c1){if(_0x5899c1){_0x2f75a0=_0x5899c1;_0x2857d5[_0x06b2('0x32')]=_[_0x06b2('0x34')](db[_0x06b2('0x4f')][_0x06b2('0x2e')]);_0x2857d5[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x33bc8e[_0x06b2('0x33')]);_0x2857d5[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0x2857d5[_0x06b2('0x32')],_0x2857d5['query']);_0x5c328c['attributes']=_[_0x06b2('0x36')](_0x2857d5[_0x06b2('0x32')],qs['fields'](_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x37')]));_0x5c328c[_0x06b2('0x38')]=_0x5c328c[_0x06b2('0x38')]['length']?_0x5c328c['attributes']:_0x2857d5['model'];_0x5c328c[_0x06b2('0x3c')]=qs['sort'](_0x33bc8e['query'][_0x06b2('0x3d')]);_0x5c328c[_0x06b2('0x3e')]=qs[_0x06b2('0x35')](_[_0x06b2('0x3f')](_0x33bc8e[_0x06b2('0x33')],_0x2857d5[_0x06b2('0x35')]));if(_0x33bc8e['query'][_0x06b2('0x40')]){_0x5c328c[_0x06b2('0x3e')]=_['merge'](_0x5c328c[_0x06b2('0x3e')],{'$or':_[_0x06b2('0x2c')](_0x5c328c[_0x06b2('0x38')],function(_0x2e0388){var _0x23ce27={};_0x23ce27[_0x2e0388]={'$like':'%'+_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x40')]+'%'};return _0x23ce27;})});}_0x5c328c=_[_0x06b2('0x4a')]({},_0x5c328c,_0x33bc8e[_0x06b2('0x42')]);return _0x2f75a0[_0x06b2('0x50')](_0x5c328c);}})[_0x06b2('0x25')](function(_0x397b16){if(_0x397b16){_0x4fba4c=_0x397b16['length'];if(!_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x3a')]('nolimit')){_0x5c328c[_0x06b2('0x1d')]=qs[_0x06b2('0x1d')](_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x1d')]);_0x5c328c['offset']=qs[_0x06b2('0x1e')](_0x33bc8e[_0x06b2('0x33')][_0x06b2('0x1e')]);}return _0x2f75a0['getConfigurations'](_0x5c328c);}})[_0x06b2('0x25')](function(_0x1ad9f7){if(_0x1ad9f7){return _0x1ad9f7?{'count':_0x4fba4c,'rows':_0x1ad9f7}:null;}})[_0x06b2('0x25')](respondWithResult(_0x8288ae,null))[_0x06b2('0x45')](handleError(_0x8288ae,null));};exports[_0x06b2('0x51')]=function(_0x43b907,_0x1aae55,_0x10faea){if(_0x43b907[_0x06b2('0x4c')]['id']){delete _0x43b907['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x43b907['params']['id']}})[_0x06b2('0x25')](handleEntityNotFound(_0x1aae55,null))['then'](function(_0x200a6e){if(_0x200a6e){_0x43b907[_0x06b2('0x4c')][_0x06b2('0x52')]=_0x200a6e['id'];_0x43b907[_0x06b2('0x4c')][_0x06b2('0x53')]=integrations[_0x06b2('0x54')](_0x43b907['body']['channel'],_0x43b907[_0x06b2('0x4c')][_0x06b2('0x30')]);_0x43b907['body'][_0x06b2('0x55')]=integrations[_0x06b2('0x56')](_0x43b907[_0x06b2('0x4c')][_0x06b2('0x57')],_0x43b907[_0x06b2('0x4c')][_0x06b2('0x30')]);return db['ZendeskConfiguration'][_0x06b2('0x4b')](_0x43b907['body'],{'include':[{'model':db[_0x06b2('0x58')],'as':_0x06b2('0x53')},{'model':db[_0x06b2('0x58')],'as':'Descriptions'}]});}return null;})[_0x06b2('0x25')](respondWithResult(_0x1aae55,null))[_0x06b2('0x45')](handleError(_0x1aae55,null));};exports[_0x06b2('0x59')]=function(_0x4cc763,_0xc1010,_0x4900d2){var _0x15b345='';return db[_0x06b2('0x2d')][_0x06b2('0x4e')]({'where':{'id':_0x4cc763[_0x06b2('0x47')]['id']},'attributes':['id',_0x06b2('0x5a'),_0x06b2('0x5b'),'token',_0x06b2('0x5c'),_0x06b2('0x5d')]})[_0x06b2('0x25')](handleEntityNotFound(_0xc1010,null))[_0x06b2('0x25')](function(_0x5f3db5){if(_0x5f3db5){_0x15b345=_0x5f3db5[_0x06b2('0x5d')];var _0x39464c=_0x15b345[_0x06b2('0x5e')](-0x1);if(_0x39464c==='/'){_0x15b345=_0x15b345['substring'](0x0,_0x15b345['lastIndexOf'](_0x39464c));}var _0x3ef003={'method':'GET','uri':util[_0x06b2('0x5f')]('%s/%s',_0x15b345,'ticket_fields'),'json':!![]};switch(_0x5f3db5[_0x06b2('0x5c')]){case _0x06b2('0x5b'):_0x3ef003['headers']={'Authorization':util[_0x06b2('0x5f')](_0x06b2('0x60'),new Buffer(util[_0x06b2('0x5f')](_0x06b2('0x61'),_0x5f3db5[_0x06b2('0x5a')],_0x5f3db5[_0x06b2('0x5b')]))[_0x06b2('0x62')](_0x06b2('0x63')))};break;case _0x06b2('0x64'):_0x3ef003[_0x06b2('0x65')]={'Authorization':util[_0x06b2('0x5f')]('Basic\x20%s',new Buffer(util[_0x06b2('0x5f')]('%s/token:%s',_0x5f3db5['username'],_0x5f3db5[_0x06b2('0x64')]))[_0x06b2('0x62')]('base64'))};break;default:throw new db[(_0x06b2('0x66'))][(_0x06b2('0x67'))](_0x06b2('0x68'));}return rp(_0x3ef003);}})['then'](function(_0x309337){if(_0x309337){var _0x3ff04f=['subject','description','group','assignee'];_[_0x06b2('0x69')](_0x309337['ticket_fields'],function(_0x1e4412){return _0x3ff04f[_0x06b2('0x6a')](_0x1e4412[_0x06b2('0x30')]);});return{'count':_0x309337[_0x06b2('0x6b')][_0x06b2('0x39')],'rows':_[_0x06b2('0x2c')](_0x309337[_0x06b2('0x6b')],function(_0x444725){return{'id':_0x444725['id'],'name':_0x444725[_0x06b2('0x6c')]>0x7?_0x444725[_0x06b2('0x6d')]:_0x444725[_0x06b2('0x30')],'custom':_0x444725[_0x06b2('0x6c')]>0x7?!![]:![],'options':_0x444725[_0x06b2('0x6e')]?_0x444725['system_field_options']:_0x444725['custom_field_options']?_0x444725[_0x06b2('0x6f')]:[]};})};}})[_0x06b2('0x25')](respondWithResult(_0xc1010,null))[_0x06b2('0x45')](function(_0x1328ec){var _0x364706=_0x4cc763[_0x06b2('0x33')]['test']?0x1f4:_0x1328ec['statusCode']||0x1f4;logger[_0x06b2('0x27')](_0x06b2('0x70'),_0x06b2('0x59'),_0x364706,JSON[_0x06b2('0x71')](_0x1328ec));delete _0x1328ec[_0x06b2('0x29')];if(_0x364706===0x191){_0x364706=0x190;}_0xc1010['status'](_0x364706)[_0x06b2('0x2a')](_0x4cc763['query']['test']?{'message':_0x06b2('0x72'),'statusCode':_0x1328ec[_0x06b2('0x73')]}:_0x1328ec);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 351028c..44f4f9c 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 _0xf810=['ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x5b2414,_0x16d22f){var _0x30a395=function(_0x450826){while(--_0x450826){_0x5b2414['push'](_0x5b2414['shift']());}};_0x30a395(++_0x16d22f);}(_0xf810,0xdf));var _0x0f81=function(_0x207133,_0x5ad403){_0x207133=_0x207133-0x0;var _0x3fd8e2=_0xf810[_0x207133];return _0x3fd8e2;};'use strict';var _=require('lodash');var util=require(_0x0f81('0x0'));var logger=require(_0x0f81('0x1'))(_0x0f81('0x2'));var moment=require(_0x0f81('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f81('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f81('0x5'));var config=require(_0x0f81('0x6'));var attributes=require(_0x0f81('0x7'));var integrations=require(_0x0f81('0x8'));module[_0x0f81('0x9')]=function(_0x2d6784,_0x94376){return _0x2d6784[_0x0f81('0xa')](_0x0f81('0xb'),attributes,{'tableName':_0x0f81('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc341=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x4cc62b,_0x375830){var _0x320e79=function(_0x492446){while(--_0x492446){_0x4cc62b['push'](_0x4cc62b['shift']());}};_0x320e79(++_0x375830);}(_0xc341,0xea));var _0x1c34=function(_0x6362d0,_0x5400b4){_0x6362d0=_0x6362d0-0x0;var _0x19bbce=_0xc341[_0x6362d0];return _0x19bbce;};'use strict';var _=require(_0x1c34('0x0'));var util=require(_0x1c34('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1c34('0x2'));var BPromise=require(_0x1c34('0x3'));var rp=require(_0x1c34('0x4'));var fs=require('fs');var path=require(_0x1c34('0x5'));var rimraf=require(_0x1c34('0x6'));var config=require(_0x1c34('0x7'));var attributes=require(_0x1c34('0x8'));var integrations=require(_0x1c34('0x9'));module['exports']=function(_0x5c1174,_0x298322){return _0x5c1174[_0x1c34('0xa')](_0x1c34('0xb'),attributes,{'tableName':_0x1c34('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index dd2d8ba..c141530 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 _0x3ca4=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','limit','include','map','model','attributes','ShowZendeskAccount','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x4bd841,_0x29cb3b){var _0x8da6e5=function(_0xed75c2){while(--_0xed75c2){_0x4bd841['push'](_0x4bd841['shift']());}};_0x8da6e5(++_0x29cb3b);}(_0x3ca4,0xce));var _0x43ca=function(_0x620db3,_0x26c10e){_0x620db3=_0x620db3-0x0;var _0x47cea4=_0x3ca4[_0x620db3];return _0x47cea4;};'use strict';var _=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var moment=require(_0x43ca('0x2'));var BPromise=require(_0x43ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ca('0x4'));var db=require(_0x43ca('0x5'))['db'];var utils=require(_0x43ca('0x6'));var logger=require(_0x43ca('0x7'))(_0x43ca('0x8'));var config=require('../../config/environment');var jayson=require(_0x43ca('0x9'));var client=jayson[_0x43ca('0xa')][_0x43ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x320a16,_0x27567e,_0x4e6cfe){return new BPromise(function(_0x2bc795,_0x223bc0){return client[_0x43ca('0xc')](_0x320a16,_0x4e6cfe)[_0x43ca('0xd')](function(_0xd2ee9e){logger[_0x43ca('0xe')](_0x43ca('0xf'),_0x27567e,_0x43ca('0x10'));logger[_0x43ca('0x11')](_0x43ca('0x12'),_0x27567e,_0x43ca('0x10'),JSON['stringify'](_0xd2ee9e));if(_0xd2ee9e[_0x43ca('0x13')]){if(_0xd2ee9e[_0x43ca('0x13')][_0x43ca('0x14')]===0x1f4){logger[_0x43ca('0x13')](_0x43ca('0xf'),_0x27567e,_0xd2ee9e[_0x43ca('0x13')]['message']);return _0x223bc0(_0xd2ee9e['error'][_0x43ca('0x15')]);}logger[_0x43ca('0x13')](_0x43ca('0xf'),_0x27567e,_0xd2ee9e[_0x43ca('0x13')][_0x43ca('0x15')]);return _0x2bc795(_0xd2ee9e[_0x43ca('0x13')][_0x43ca('0x15')]);}else{logger[_0x43ca('0xe')](_0x43ca('0xf'),_0x27567e,'request\x20sent');_0x2bc795(_0xd2ee9e[_0x43ca('0x16')]['message']);}})[_0x43ca('0x17')](function(_0xb6e880){logger[_0x43ca('0x13')](_0x43ca('0xf'),_0x27567e,_0xb6e880);_0x223bc0(_0xb6e880);});});}exports[_0x43ca('0x18')]=function(_0x3f1d0e){var _0x227d3a=this;return new Promise(function(_0x490ca4,_0x48b4b6){return db[_0x43ca('0x19')][_0x43ca('0x1a')]({'raw':_0x3f1d0e['options']?_0x3f1d0e[_0x43ca('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f1d0e[_0x43ca('0x1b')]?_0x3f1d0e[_0x43ca('0x1b')][_0x43ca('0x1c')]||null:null,'attributes':_0x3f1d0e[_0x43ca('0x1b')]?_0x3f1d0e[_0x43ca('0x1b')]['attributes']||null:null,'limit':_0x3f1d0e['options']?_0x3f1d0e[_0x43ca('0x1b')][_0x43ca('0x1d')]||null:null,'include':_0x3f1d0e[_0x43ca('0x1b')]?_0x3f1d0e[_0x43ca('0x1b')][_0x43ca('0x1e')]?_[_0x43ca('0x1f')](_0x3f1d0e['options'][_0x43ca('0x1e')],function(_0x3a6b1e){return{'model':db[_0x3a6b1e[_0x43ca('0x20')]],'as':_0x3a6b1e['as'],'attributes':_0x3a6b1e[_0x43ca('0x21')],'include':_0x3a6b1e[_0x43ca('0x1e')]?_['map'](_0x3a6b1e['include'],function(_0xaa4124){return{'model':db[_0xaa4124[_0x43ca('0x20')]],'as':_0xaa4124['as'],'attributes':_0xaa4124['attributes'],'include':_0xaa4124['include']?_[_0x43ca('0x1f')](_0xaa4124[_0x43ca('0x1e')],function(_0x36829e){return{'model':db[_0x36829e[_0x43ca('0x20')]],'as':_0x36829e['as'],'attributes':_0x36829e[_0x43ca('0x21')]};}):[]};}):[]};}):[]:[]})[_0x43ca('0xd')](function(_0x2424c7){logger[_0x43ca('0xe')](_0x43ca('0x18'),_0x3f1d0e);logger[_0x43ca('0x11')](_0x43ca('0x18'),_0x3f1d0e,JSON['stringify'](_0x2424c7));_0x490ca4(_0x2424c7);})[_0x43ca('0x17')](function(_0x49d536){logger[_0x43ca('0x13')](_0x43ca('0x18'),_0x49d536[_0x43ca('0x15')],_0x3f1d0e);_0x48b4b6(_0x227d3a[_0x43ca('0x13')](0x1f4,_0x49d536[_0x43ca('0x15')]));});});};exports[_0x43ca('0x22')]=function(_0x1da55e){var _0x1ea426=this;return new Promise(function(_0x5d80be,_0x480f46){return db[_0x43ca('0x19')][_0x43ca('0x23')]({'raw':_0x1da55e[_0x43ca('0x1b')]?_0x1da55e[_0x43ca('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1da55e[_0x43ca('0x1b')]?_0x1da55e[_0x43ca('0x1b')]['where']||null:null,'attributes':_0x1da55e['options']?_0x1da55e[_0x43ca('0x1b')][_0x43ca('0x21')]||null:null,'include':_0x1da55e['options']?_0x1da55e[_0x43ca('0x1b')]['include']?_[_0x43ca('0x1f')](_0x1da55e[_0x43ca('0x1b')][_0x43ca('0x1e')],function(_0xdf6801){return{'model':db[_0xdf6801['model']],'as':_0xdf6801['as'],'attributes':_0xdf6801[_0x43ca('0x21')],'include':_0xdf6801[_0x43ca('0x1e')]?_[_0x43ca('0x1f')](_0xdf6801['include'],function(_0x525f62){return{'model':db[_0x525f62[_0x43ca('0x20')]],'as':_0x525f62['as'],'attributes':_0x525f62[_0x43ca('0x21')],'include':_0x525f62[_0x43ca('0x1e')]?_[_0x43ca('0x1f')](_0x525f62[_0x43ca('0x1e')],function(_0x294fc8){return{'model':db[_0x294fc8[_0x43ca('0x20')]],'as':_0x294fc8['as'],'attributes':_0x294fc8[_0x43ca('0x21')]};}):[]};}):[]};}):[]:[]})[_0x43ca('0xd')](function(_0x3e65f8){logger[_0x43ca('0xe')](_0x43ca('0x22'),_0x1da55e);logger[_0x43ca('0x11')](_0x43ca('0x22'),_0x1da55e,JSON[_0x43ca('0x24')](_0x3e65f8));_0x5d80be(_0x3e65f8);})[_0x43ca('0x17')](function(_0x9c8a72){logger[_0x43ca('0x13')](_0x43ca('0x22'),_0x9c8a72['message'],_0x1da55e);_0x480f46(_0x1ea426[_0x43ca('0x13')](0x1f4,_0x9c8a72[_0x43ca('0x15')]));});});}; \ No newline at end of file +var _0x9d30=['attributes','ShowZendeskAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9d30,0x157));var _0x09d3=function(_0x7c6f33,_0x374a4c){_0x7c6f33=_0x7c6f33-0x0;var _0x17f5c8=_0x9d30[_0x7c6f33];return _0x17f5c8;};'use strict';var _=require(_0x09d3('0x0'));var util=require(_0x09d3('0x1'));var moment=require(_0x09d3('0x2'));var BPromise=require(_0x09d3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09d3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x09d3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x09d3('0x6'));var jayson=require(_0x09d3('0x7'));var client=jayson[_0x09d3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x511594,_0x170bbb,_0x2b7894){return new BPromise(function(_0x2f0be6,_0x384068){return client['request'](_0x511594,_0x2b7894)[_0x09d3('0x9')](function(_0x38ab63){logger[_0x09d3('0xa')](_0x09d3('0xb'),_0x170bbb,_0x09d3('0xc'));logger[_0x09d3('0xd')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x170bbb,'request\x20sent',JSON[_0x09d3('0xe')](_0x38ab63));if(_0x38ab63[_0x09d3('0xf')]){if(_0x38ab63['error'][_0x09d3('0x10')]===0x1f4){logger[_0x09d3('0xf')](_0x09d3('0xb'),_0x170bbb,_0x38ab63[_0x09d3('0xf')][_0x09d3('0x11')]);return _0x384068(_0x38ab63[_0x09d3('0xf')][_0x09d3('0x11')]);}logger[_0x09d3('0xf')](_0x09d3('0xb'),_0x170bbb,_0x38ab63[_0x09d3('0xf')][_0x09d3('0x11')]);return _0x2f0be6(_0x38ab63[_0x09d3('0xf')][_0x09d3('0x11')]);}else{logger[_0x09d3('0xa')](_0x09d3('0xb'),_0x170bbb,_0x09d3('0xc'));_0x2f0be6(_0x38ab63['result'][_0x09d3('0x11')]);}})[_0x09d3('0x12')](function(_0x2f9f33){logger[_0x09d3('0xf')](_0x09d3('0xb'),_0x170bbb,_0x2f9f33);_0x384068(_0x2f9f33);});});}exports[_0x09d3('0x13')]=function(_0x780ecb){var _0x43ed3d=this;return new Promise(function(_0x1f8a7e,_0x1d5d2b){return db[_0x09d3('0x14')][_0x09d3('0x15')]({'raw':_0x780ecb[_0x09d3('0x16')]?_0x780ecb[_0x09d3('0x16')][_0x09d3('0x17')]===undefined?!![]:![]:!![],'where':_0x780ecb[_0x09d3('0x16')]?_0x780ecb['options'][_0x09d3('0x18')]||null:null,'attributes':_0x780ecb[_0x09d3('0x16')]?_0x780ecb[_0x09d3('0x16')]['attributes']||null:null,'limit':_0x780ecb['options']?_0x780ecb[_0x09d3('0x16')][_0x09d3('0x19')]||null:null,'include':_0x780ecb['options']?_0x780ecb[_0x09d3('0x16')][_0x09d3('0x1a')]?_[_0x09d3('0x1b')](_0x780ecb[_0x09d3('0x16')][_0x09d3('0x1a')],function(_0xb09d39){return{'model':db[_0xb09d39[_0x09d3('0x1c')]],'as':_0xb09d39['as'],'attributes':_0xb09d39[_0x09d3('0x1d')],'include':_0xb09d39[_0x09d3('0x1a')]?_[_0x09d3('0x1b')](_0xb09d39[_0x09d3('0x1a')],function(_0x6da078){return{'model':db[_0x6da078[_0x09d3('0x1c')]],'as':_0x6da078['as'],'attributes':_0x6da078[_0x09d3('0x1d')],'include':_0x6da078[_0x09d3('0x1a')]?_[_0x09d3('0x1b')](_0x6da078[_0x09d3('0x1a')],function(_0x2bb31d){return{'model':db[_0x2bb31d[_0x09d3('0x1c')]],'as':_0x2bb31d['as'],'attributes':_0x2bb31d[_0x09d3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x09d3('0x9')](function(_0x5d7e03){logger[_0x09d3('0xa')](_0x09d3('0x13'),_0x780ecb);logger[_0x09d3('0xd')](_0x09d3('0x13'),_0x780ecb,JSON[_0x09d3('0xe')](_0x5d7e03));_0x1f8a7e(_0x5d7e03);})[_0x09d3('0x12')](function(_0x5291e9){logger[_0x09d3('0xf')](_0x09d3('0x13'),_0x5291e9['message'],_0x780ecb);_0x1d5d2b(_0x43ed3d[_0x09d3('0xf')](0x1f4,_0x5291e9[_0x09d3('0x11')]));});});};exports[_0x09d3('0x1e')]=function(_0x25e81a){var _0x29f4b2=this;return new Promise(function(_0x52282a,_0x416b12){return db[_0x09d3('0x14')]['find']({'raw':_0x25e81a[_0x09d3('0x16')]?_0x25e81a['options'][_0x09d3('0x17')]===undefined?!![]:![]:!![],'where':_0x25e81a[_0x09d3('0x16')]?_0x25e81a[_0x09d3('0x16')][_0x09d3('0x18')]||null:null,'attributes':_0x25e81a[_0x09d3('0x16')]?_0x25e81a[_0x09d3('0x16')][_0x09d3('0x1d')]||null:null,'include':_0x25e81a['options']?_0x25e81a[_0x09d3('0x16')]['include']?_[_0x09d3('0x1b')](_0x25e81a[_0x09d3('0x16')]['include'],function(_0x2a2a81){return{'model':db[_0x2a2a81[_0x09d3('0x1c')]],'as':_0x2a2a81['as'],'attributes':_0x2a2a81[_0x09d3('0x1d')],'include':_0x2a2a81[_0x09d3('0x1a')]?_['map'](_0x2a2a81['include'],function(_0x392997){return{'model':db[_0x392997[_0x09d3('0x1c')]],'as':_0x392997['as'],'attributes':_0x392997[_0x09d3('0x1d')],'include':_0x392997['include']?_[_0x09d3('0x1b')](_0x392997[_0x09d3('0x1a')],function(_0x1147fc){return{'model':db[_0x1147fc[_0x09d3('0x1c')]],'as':_0x1147fc['as'],'attributes':_0x1147fc[_0x09d3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x09d3('0x9')](function(_0x5c8ba7){logger['info'](_0x09d3('0x1e'),_0x25e81a);logger[_0x09d3('0xd')](_0x09d3('0x1e'),_0x25e81a,JSON[_0x09d3('0xe')](_0x5c8ba7));_0x52282a(_0x5c8ba7);})[_0x09d3('0x12')](function(_0x2240e1){logger['error']('ShowZendeskAccount',_0x2240e1[_0x09d3('0x11')],_0x25e81a);_0x416b12(_0x29f4b2[_0x09d3('0xf')](0x1f4,_0x2240e1[_0x09d3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8f62f93..0a7f122 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 _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file +var _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x593de6,_0x569391){var _0x455fa2=function(_0x591ad3){while(--_0x591ad3){_0x593de6['push'](_0x593de6['shift']());}};_0x455fa2(++_0x569391);}(_0xea28,0x13a));var _0x8ea2=function(_0x9cb3d2,_0x37bfe8){_0x9cb3d2=_0x9cb3d2-0x0;var _0x3f1970=_0xea28[_0x9cb3d2];return _0x3f1970;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 639d4cc..617cefd 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 _0x84f3=['STRING','exports'];(function(_0x3c7f77,_0x50b2a2){var _0x7f4d0=function(_0x4a3ea4){while(--_0x4a3ea4){_0x3c7f77['push'](_0x3c7f77['shift']());}};_0x7f4d0(++_0x50b2a2);}(_0x84f3,0xa3));var _0x384f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x84f3[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module[_0x384f('0x0')]={'name':{'type':Sequelize[_0x384f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbe61=['STRING','exports'];(function(_0x4beb4d,_0x47449f){var _0x3f0e58=function(_0x4e4738){while(--_0x4e4738){_0x4beb4d['push'](_0x4beb4d['shift']());}};_0x3f0e58(++_0x47449f);}(_0xbe61,0x1c7));var _0x1be6=function(_0x54a933,_0x1f9da7){_0x54a933=_0x54a933-0x0;var _0x27a94e=_0xbe61[_0x54a933];return _0x27a94e;};'use strict';var Sequelize=require('sequelize');module[_0x1be6('0x0')]={'name':{'type':Sequelize[_0x1be6('0x1')]},'description':{'type':Sequelize[_0x1be6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 196f87a..b9d1a0f 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 _0x09c9=['where','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','getFields','findOne','ZendeskField','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','ZendeskConfiguration','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter'];(function(_0x10ca1b,_0x364a99){var _0x1f838f=function(_0x271f0d){while(--_0x271f0d){_0x10ca1b['push'](_0x10ca1b['shift']());}};_0x1f838f(++_0x364a99);}(_0x09c9,0x162));var _0x909c=function(_0x131e8a,_0x5eb754){_0x131e8a=_0x131e8a-0x0;var _0x2165ea=_0x09c9[_0x131e8a];return _0x2165ea;};'use strict';var emlformat=require(_0x909c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x909c('0x1'));var jsonpatch=require(_0x909c('0x2'));var rp=require(_0x909c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x909c('0x4'));var util=require('util');var path=require(_0x909c('0x5'));var sox=require(_0x909c('0x6'));var csv=require(_0x909c('0x7'));var ejs=require(_0x909c('0x8'));var fs=require('fs');var fs_extra=require(_0x909c('0x9'));var _=require(_0x909c('0xa'));var squel=require(_0x909c('0xb'));var crypto=require(_0x909c('0xc'));var jsforce=require(_0x909c('0xd'));var deskjs=require(_0x909c('0xe'));var toCsv=require(_0x909c('0x7'));var querystring=require(_0x909c('0xf'));var Papa=require(_0x909c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x909c('0x11'));var as=require(_0x909c('0x12'));var hardwareService=require(_0x909c('0x13'));var logger=require(_0x909c('0x14'))(_0x909c('0x15'));var utils=require(_0x909c('0x16'));var config=require(_0x909c('0x17'));var licenseUtil=require(_0x909c('0x18'));var db=require(_0x909c('0x19'))['db'];function respondWithStatusCode(_0xab048e,_0x132ed0){_0x132ed0=_0x132ed0||0xcc;return function(_0x2cc8b7){if(_0x2cc8b7){return _0xab048e[_0x909c('0x1a')](_0x132ed0);}return _0xab048e[_0x909c('0x1b')](_0x132ed0)[_0x909c('0x1c')]();};}function respondWithResult(_0x467f93,_0xb0800b){_0xb0800b=_0xb0800b||0xc8;return function(_0x293849){if(_0x293849){return _0x467f93[_0x909c('0x1b')](_0xb0800b)[_0x909c('0x1d')](_0x293849);}};}function respondWithFilteredResult(_0x5e014d,_0x4dba2d){return function(_0x21e520){if(_0x21e520){var _0x3e7a7c=typeof _0x4dba2d[_0x909c('0x1e')]===_0x909c('0x1f')&&typeof _0x4dba2d['limit']===_0x909c('0x1f');var _0x5c0b89=_0x21e520[_0x909c('0x20')];var _0x1b16c8=_0x3e7a7c?0x0:_0x4dba2d[_0x909c('0x1e')];var _0x1f07c5=_0x3e7a7c?_0x21e520[_0x909c('0x20')]:_0x4dba2d[_0x909c('0x1e')]+_0x4dba2d[_0x909c('0x21')];var _0x5534bf;if(_0x1f07c5>=_0x5c0b89){_0x1f07c5=_0x5c0b89;_0x5534bf=0xc8;}else{_0x5534bf=0xce;}_0x5e014d[_0x909c('0x1b')](_0x5534bf);return _0x5e014d['set'](_0x909c('0x22'),_0x1b16c8+'-'+_0x1f07c5+'/'+_0x5c0b89)[_0x909c('0x1d')](_0x21e520);}return null;};}function patchUpdates(_0x4a1429){return function(_0x417693){try{jsonpatch[_0x909c('0x23')](_0x417693,_0x4a1429,!![]);}catch(_0x508950){return BPromise[_0x909c('0x24')](_0x508950);}return _0x417693[_0x909c('0x25')]();};}function saveUpdates(_0x1e2a94,_0x1865bf){return function(_0x262605){if(_0x262605){return _0x262605[_0x909c('0x26')](_0x1e2a94)[_0x909c('0x27')](function(_0x1e2ead){return _0x1e2ead;});}return null;};}function removeEntity(_0x3d3398,_0x39986b){return function(_0x59fe5e){if(_0x59fe5e){return _0x59fe5e[_0x909c('0x28')]()[_0x909c('0x27')](function(){_0x3d3398['status'](0xcc)[_0x909c('0x1c')]();});}};}function handleEntityNotFound(_0x1786af,_0x58aea2){return function(_0x50e646){if(!_0x50e646){_0x1786af[_0x909c('0x1a')](0x194);}return _0x50e646;};}function handleError(_0x13f20f,_0x512c98){_0x512c98=_0x512c98||0x1f4;return function(_0x4e0414){logger[_0x909c('0x29')](_0x4e0414['stack']);if(_0x4e0414[_0x909c('0x2a')]){delete _0x4e0414[_0x909c('0x2a')];}_0x13f20f[_0x909c('0x1b')](_0x512c98)['send'](_0x4e0414);};}exports[_0x909c('0x2b')]=function(_0x26e117,_0x3cba48){var _0x1ca8df={},_0x575a37={},_0x152274={'count':0x0,'rows':[]};var _0x27744d=_['map'](db[_0x909c('0x2c')][_0x909c('0x2d')],function(_0x41ad0a){return{'name':_0x41ad0a['fieldName'],'type':_0x41ad0a['type'][_0x909c('0x2e')]};});_0x575a37[_0x909c('0x2f')]=_[_0x909c('0x30')](_0x27744d,_0x909c('0x2a'));_0x575a37[_0x909c('0x31')]=_[_0x909c('0x32')](_0x26e117[_0x909c('0x31')]);_0x575a37[_0x909c('0x33')]=_[_0x909c('0x34')](_0x575a37['model'],_0x575a37[_0x909c('0x31')]);_0x1ca8df[_0x909c('0x35')]=_[_0x909c('0x34')](_0x575a37[_0x909c('0x2f')],qs[_0x909c('0x36')](_0x26e117['query'][_0x909c('0x36')]));_0x1ca8df['attributes']=_0x1ca8df[_0x909c('0x35')][_0x909c('0x37')]?_0x1ca8df[_0x909c('0x35')]:_0x575a37[_0x909c('0x2f')];if(!_0x26e117[_0x909c('0x31')][_0x909c('0x38')]('nolimit')){_0x1ca8df['limit']=qs[_0x909c('0x21')](_0x26e117['query'][_0x909c('0x21')]);_0x1ca8df[_0x909c('0x1e')]=qs['offset'](_0x26e117[_0x909c('0x31')][_0x909c('0x1e')]);}_0x1ca8df[_0x909c('0x39')]=qs[_0x909c('0x3a')](_0x26e117[_0x909c('0x31')][_0x909c('0x3a')]);_0x1ca8df['where']=qs[_0x909c('0x33')](_[_0x909c('0x3b')](_0x26e117['query'],_0x575a37[_0x909c('0x33')]),_0x27744d);if(_0x26e117[_0x909c('0x31')][_0x909c('0x3c')]){_0x1ca8df[_0x909c('0x3d')]=_[_0x909c('0x3e')](_0x1ca8df['where'],{'$or':_[_0x909c('0x30')](_0x27744d,function(_0x99782c){if(_0x99782c['type']!=='VIRTUAL'){var _0x175545={};_0x175545[_0x99782c[_0x909c('0x2a')]]={'$like':'%'+_0x26e117[_0x909c('0x31')]['filter']+'%'};return _0x175545;}})});}_0x1ca8df=_[_0x909c('0x3e')]({},_0x1ca8df,_0x26e117[_0x909c('0x3f')]);var _0x6a1989={'where':_0x1ca8df[_0x909c('0x3d')]};return db[_0x909c('0x2c')][_0x909c('0x20')](_0x6a1989)['then'](function(_0x2312b8){_0x152274['count']=_0x2312b8;if(_0x26e117[_0x909c('0x31')][_0x909c('0x40')]){_0x1ca8df[_0x909c('0x41')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x909c('0x42')](_0x1ca8df);})[_0x909c('0x27')](function(_0x474ffd){_0x152274[_0x909c('0x43')]=_0x474ffd;return _0x152274;})[_0x909c('0x27')](respondWithFilteredResult(_0x3cba48,_0x1ca8df))[_0x909c('0x44')](handleError(_0x3cba48,null));};exports[_0x909c('0x45')]=function(_0x5f5994,_0x5213e0){var _0x69adeb={'raw':![],'where':{'id':_0x5f5994[_0x909c('0x46')]['id']}},_0x5f43c3={};_0x5f43c3[_0x909c('0x2f')]=_['keys'](db[_0x909c('0x2c')][_0x909c('0x2d')]);_0x5f43c3[_0x909c('0x31')]=_[_0x909c('0x32')](_0x5f5994['query']);_0x5f43c3[_0x909c('0x33')]=_[_0x909c('0x34')](_0x5f43c3[_0x909c('0x2f')],_0x5f43c3[_0x909c('0x31')]);_0x69adeb[_0x909c('0x35')]=_[_0x909c('0x34')](_0x5f43c3[_0x909c('0x2f')],qs['fields'](_0x5f5994[_0x909c('0x31')][_0x909c('0x36')]));_0x69adeb[_0x909c('0x35')]=_0x69adeb[_0x909c('0x35')][_0x909c('0x37')]?_0x69adeb[_0x909c('0x35')]:_0x5f43c3[_0x909c('0x2f')];if(_0x5f5994[_0x909c('0x31')][_0x909c('0x40')]){_0x69adeb['include']=[{'all':!![]}];}_0x69adeb=_[_0x909c('0x3e')]({},_0x69adeb,_0x5f5994[_0x909c('0x3f')]);return db['ZendeskConfiguration']['find'](_0x69adeb)[_0x909c('0x27')](handleEntityNotFound(_0x5213e0,null))['then'](respondWithResult(_0x5213e0,null))[_0x909c('0x44')](handleError(_0x5213e0,null));};exports['create']=function(_0x453257,_0x501014){return db[_0x909c('0x2c')]['create'](_0x453257[_0x909c('0x47')],{})['then'](respondWithResult(_0x501014,0xc9))[_0x909c('0x44')](handleError(_0x501014,null));};exports[_0x909c('0x26')]=function(_0x47c014,_0x28c4e4){if(_0x47c014[_0x909c('0x47')]['id']){delete _0x47c014['body']['id'];}return db[_0x909c('0x2c')][_0x909c('0x48')]({'where':{'id':_0x47c014[_0x909c('0x46')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x28c4e4,null))[_0x909c('0x27')](saveUpdates(_0x47c014[_0x909c('0x47')],null))[_0x909c('0x27')](respondWithResult(_0x28c4e4,null))[_0x909c('0x44')](handleError(_0x28c4e4,null));};exports[_0x909c('0x28')]=function(_0x1e3606,_0x10ea6b){return db['ZendeskConfiguration'][_0x909c('0x48')]({'where':{'id':_0x1e3606['params']['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x10ea6b,null))['then'](removeEntity(_0x10ea6b,null))[_0x909c('0x44')](handleError(_0x10ea6b,null));};exports[_0x909c('0x49')]=function(_0x8f8613,_0x5da1c1,_0x3a44a1){var _0x1a582c={};var _0x3243d1={};var _0x5bc034;var _0x2e3b01;return db[_0x909c('0x2c')][_0x909c('0x4a')]({'where':{'id':_0x8f8613[_0x909c('0x46')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x5da1c1,null))[_0x909c('0x27')](function(_0x4c4f68){if(_0x4c4f68){_0x5bc034=_0x4c4f68;_0x3243d1[_0x909c('0x2f')]=_[_0x909c('0x32')](db[_0x909c('0x4b')]['rawAttributes']);_0x3243d1['query']=_[_0x909c('0x32')](_0x8f8613[_0x909c('0x31')]);_0x3243d1['filters']=_[_0x909c('0x34')](_0x3243d1[_0x909c('0x2f')],_0x3243d1[_0x909c('0x31')]);_0x1a582c['attributes']=_[_0x909c('0x34')](_0x3243d1[_0x909c('0x2f')],qs[_0x909c('0x36')](_0x8f8613[_0x909c('0x31')]['fields']));_0x1a582c['attributes']=_0x1a582c['attributes'][_0x909c('0x37')]?_0x1a582c[_0x909c('0x35')]:_0x3243d1[_0x909c('0x2f')];_0x1a582c['order']=qs['sort'](_0x8f8613[_0x909c('0x31')][_0x909c('0x3a')]);_0x1a582c['where']=qs[_0x909c('0x33')](_['pick'](_0x8f8613[_0x909c('0x31')],_0x3243d1[_0x909c('0x33')]));if(_0x8f8613['query'][_0x909c('0x3c')]){_0x1a582c[_0x909c('0x3d')]=_[_0x909c('0x3e')](_0x1a582c[_0x909c('0x3d')],{'$or':_[_0x909c('0x30')](_0x1a582c[_0x909c('0x35')],function(_0x23b1ac){var _0x3b488a={};_0x3b488a[_0x23b1ac]={'$like':'%'+_0x8f8613[_0x909c('0x31')]['filter']+'%'};return _0x3b488a;})});}_0x1a582c=_[_0x909c('0x3e')]({},_0x1a582c,_0x8f8613[_0x909c('0x3f')]);return _0x5bc034['getFields'](_0x1a582c);}})['then'](function(_0x274628){if(_0x274628){_0x2e3b01=_0x274628[_0x909c('0x37')];if(!_0x8f8613[_0x909c('0x31')][_0x909c('0x38')]('nolimit')){_0x1a582c[_0x909c('0x21')]=qs[_0x909c('0x21')](_0x8f8613['query'][_0x909c('0x21')]);_0x1a582c['offset']=qs['offset'](_0x8f8613[_0x909c('0x31')][_0x909c('0x1e')]);}return _0x5bc034[_0x909c('0x49')](_0x1a582c);}})['then'](function(_0x5619b9){if(_0x5619b9){return _0x5619b9?{'count':_0x2e3b01,'rows':_0x5619b9}:null;}})['then'](respondWithResult(_0x5da1c1,null))[_0x909c('0x44')](handleError(_0x5da1c1,null));};exports[_0x909c('0x4c')]=function(_0x2b27fb,_0x20c416,_0x95ba9a){var _0x2067df={};var _0x3edec3={};var _0x52a6f8;var _0x550b69;return db[_0x909c('0x2c')]['findOne']({'where':{'id':_0x2b27fb[_0x909c('0x46')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x20c416,null))[_0x909c('0x27')](function(_0x4d5c56){if(_0x4d5c56){_0x52a6f8=_0x4d5c56;_0x3edec3[_0x909c('0x2f')]=_[_0x909c('0x32')](db[_0x909c('0x4b')][_0x909c('0x2d')]);_0x3edec3[_0x909c('0x31')]=_[_0x909c('0x32')](_0x2b27fb[_0x909c('0x31')]);_0x3edec3[_0x909c('0x33')]=_[_0x909c('0x34')](_0x3edec3[_0x909c('0x2f')],_0x3edec3['query']);_0x2067df[_0x909c('0x35')]=_[_0x909c('0x34')](_0x3edec3[_0x909c('0x2f')],qs[_0x909c('0x36')](_0x2b27fb[_0x909c('0x31')]['fields']));_0x2067df['attributes']=_0x2067df['attributes'][_0x909c('0x37')]?_0x2067df['attributes']:_0x3edec3['model'];_0x2067df[_0x909c('0x39')]=qs[_0x909c('0x3a')](_0x2b27fb[_0x909c('0x31')][_0x909c('0x3a')]);_0x2067df[_0x909c('0x3d')]=qs['filters'](_[_0x909c('0x3b')](_0x2b27fb[_0x909c('0x31')],_0x3edec3[_0x909c('0x33')]));if(_0x2b27fb[_0x909c('0x31')][_0x909c('0x3c')]){_0x2067df[_0x909c('0x3d')]=_[_0x909c('0x3e')](_0x2067df[_0x909c('0x3d')],{'$or':_[_0x909c('0x30')](_0x2067df[_0x909c('0x35')],function(_0x11c0bf){var _0x3a05a0={};_0x3a05a0[_0x11c0bf]={'$like':'%'+_0x2b27fb['query'][_0x909c('0x3c')]+'%'};return _0x3a05a0;})});}_0x2067df=_['merge']({},_0x2067df,_0x2b27fb[_0x909c('0x3f')]);return _0x52a6f8[_0x909c('0x4c')](_0x2067df);}})[_0x909c('0x27')](function(_0x11e7dc){if(_0x11e7dc){_0x550b69=_0x11e7dc[_0x909c('0x37')];if(!_0x2b27fb[_0x909c('0x31')][_0x909c('0x38')](_0x909c('0x4d'))){_0x2067df['limit']=qs[_0x909c('0x21')](_0x2b27fb[_0x909c('0x31')][_0x909c('0x21')]);_0x2067df['offset']=qs[_0x909c('0x1e')](_0x2b27fb['query'][_0x909c('0x1e')]);}return _0x52a6f8[_0x909c('0x4c')](_0x2067df);}})[_0x909c('0x27')](function(_0x40de6b){if(_0x40de6b){return _0x40de6b?{'count':_0x550b69,'rows':_0x40de6b}:null;}})[_0x909c('0x27')](respondWithResult(_0x20c416,null))[_0x909c('0x44')](handleError(_0x20c416,null));};exports[_0x909c('0x4e')]=function(_0x1c8343,_0x232906,_0x5c2274){var _0x185a07={};var _0x243b6d={};var _0x54c90f;var _0x2e1378;return db['ZendeskConfiguration'][_0x909c('0x4a')]({'where':{'id':_0x1c8343['params']['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x232906,null))['then'](function(_0x34101e){if(_0x34101e){_0x54c90f=_0x34101e;_0x243b6d['model']=_[_0x909c('0x32')](db[_0x909c('0x4b')][_0x909c('0x2d')]);_0x243b6d[_0x909c('0x31')]=_['keys'](_0x1c8343[_0x909c('0x31')]);_0x243b6d['filters']=_['intersection'](_0x243b6d[_0x909c('0x2f')],_0x243b6d[_0x909c('0x31')]);_0x185a07[_0x909c('0x35')]=_[_0x909c('0x34')](_0x243b6d[_0x909c('0x2f')],qs[_0x909c('0x36')](_0x1c8343[_0x909c('0x31')][_0x909c('0x36')]));_0x185a07[_0x909c('0x35')]=_0x185a07[_0x909c('0x35')][_0x909c('0x37')]?_0x185a07[_0x909c('0x35')]:_0x243b6d['model'];_0x185a07[_0x909c('0x39')]=qs[_0x909c('0x3a')](_0x1c8343[_0x909c('0x31')][_0x909c('0x3a')]);_0x185a07[_0x909c('0x3d')]=qs['filters'](_['pick'](_0x1c8343[_0x909c('0x31')],_0x243b6d['filters']));if(_0x1c8343[_0x909c('0x31')][_0x909c('0x3c')]){_0x185a07['where']=_['merge'](_0x185a07[_0x909c('0x3d')],{'$or':_[_0x909c('0x30')](_0x185a07[_0x909c('0x35')],function(_0x12bcd0){var _0x5bbb1f={};_0x5bbb1f[_0x12bcd0]={'$like':'%'+_0x1c8343[_0x909c('0x31')]['filter']+'%'};return _0x5bbb1f;})});}_0x185a07=_[_0x909c('0x3e')]({},_0x185a07,_0x1c8343[_0x909c('0x3f')]);return _0x54c90f[_0x909c('0x4e')](_0x185a07);}})[_0x909c('0x27')](function(_0x17d933){if(_0x17d933){_0x2e1378=_0x17d933[_0x909c('0x37')];if(!_0x1c8343[_0x909c('0x31')][_0x909c('0x38')]('nolimit')){_0x185a07[_0x909c('0x21')]=qs[_0x909c('0x21')](_0x1c8343[_0x909c('0x31')][_0x909c('0x21')]);_0x185a07[_0x909c('0x1e')]=qs[_0x909c('0x1e')](_0x1c8343['query'][_0x909c('0x1e')]);}return _0x54c90f[_0x909c('0x4e')](_0x185a07);}})[_0x909c('0x27')](function(_0x5179c8){if(_0x5179c8){return _0x5179c8?{'count':_0x2e1378,'rows':_0x5179c8}:null;}})['then'](respondWithResult(_0x232906,null))[_0x909c('0x44')](handleError(_0x232906,null));};exports[_0x909c('0x4f')]=function(_0x32c98a,_0x451fdb,_0x3f9de7){var _0x7ed23={};var _0x2a558c={};var _0x16c8bb;var _0x4b0681;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x32c98a['params']['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x451fdb,null))[_0x909c('0x27')](function(_0x5cabf3){if(_0x5cabf3){_0x16c8bb=_0x5cabf3;_0x2a558c[_0x909c('0x2f')]=_[_0x909c('0x32')](db[_0x909c('0x50')][_0x909c('0x2d')]);_0x2a558c[_0x909c('0x31')]=_[_0x909c('0x32')](_0x32c98a[_0x909c('0x31')]);_0x2a558c[_0x909c('0x33')]=_['intersection'](_0x2a558c[_0x909c('0x2f')],_0x2a558c[_0x909c('0x31')]);_0x7ed23['attributes']=_[_0x909c('0x34')](_0x2a558c['model'],qs[_0x909c('0x36')](_0x32c98a[_0x909c('0x31')][_0x909c('0x36')]));_0x7ed23[_0x909c('0x35')]=_0x7ed23[_0x909c('0x35')][_0x909c('0x37')]?_0x7ed23[_0x909c('0x35')]:_0x2a558c[_0x909c('0x2f')];_0x7ed23[_0x909c('0x39')]=qs['sort'](_0x32c98a[_0x909c('0x31')][_0x909c('0x3a')]);_0x7ed23[_0x909c('0x3d')]=qs['filters'](_[_0x909c('0x3b')](_0x32c98a[_0x909c('0x31')],_0x2a558c[_0x909c('0x33')]));if(_0x32c98a[_0x909c('0x31')][_0x909c('0x3c')]){_0x7ed23[_0x909c('0x3d')]=_['merge'](_0x7ed23[_0x909c('0x3d')],{'$or':_[_0x909c('0x30')](_0x7ed23[_0x909c('0x35')],function(_0x4dabb6){var _0x24de81={};_0x24de81[_0x4dabb6]={'$like':'%'+_0x32c98a[_0x909c('0x31')][_0x909c('0x3c')]+'%'};return _0x24de81;})});}_0x7ed23=_[_0x909c('0x3e')]({},_0x7ed23,_0x32c98a['options']);return _0x16c8bb[_0x909c('0x4f')](_0x7ed23);}})[_0x909c('0x27')](function(_0x1ccdd8){if(_0x1ccdd8){_0x4b0681=_0x1ccdd8[_0x909c('0x37')];if(!_0x32c98a[_0x909c('0x31')][_0x909c('0x38')](_0x909c('0x4d'))){_0x7ed23[_0x909c('0x21')]=qs[_0x909c('0x21')](_0x32c98a['query']['limit']);_0x7ed23[_0x909c('0x1e')]=qs[_0x909c('0x1e')](_0x32c98a[_0x909c('0x31')][_0x909c('0x1e')]);}return _0x16c8bb[_0x909c('0x4f')](_0x7ed23);}})['then'](function(_0x15b00d){if(_0x15b00d){return _0x15b00d?{'count':_0x4b0681,'rows':_0x15b00d}:null;}})[_0x909c('0x27')](respondWithResult(_0x451fdb,null))[_0x909c('0x44')](handleError(_0x451fdb,null));};exports[_0x909c('0x51')]=function(_0x263d31,_0xcbf2,_0xe7f997){if(_0x263d31['body']['id']){delete _0x263d31[_0x909c('0x47')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x263d31['params']['id']}})[_0x909c('0x27')](handleEntityNotFound(_0xcbf2,null))[_0x909c('0x27')](function(_0x5db5d3){if(_0x5db5d3){return _0x5db5d3[_0x909c('0x51')](_0x263d31['body'][_0x909c('0x52')]||[]);}return null;})['then'](respondWithResult(_0xcbf2,null))['catch'](handleError(_0xcbf2,null));}; \ No newline at end of file +var _0x862f=['request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','destroy','then','stack','name','send','map','ZendeskConfiguration','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','create','update','body','find','getFields','findOne','getSubjects','getDescriptions','ZendeskField','getTags','setTags','eml-format','rimraf','zip-dir'];(function(_0x1eaf74,_0x23a786){var _0xd34db2=function(_0x1c94e0){while(--_0x1c94e0){_0x1eaf74['push'](_0x1eaf74['shift']());}};_0xd34db2(++_0x23a786);}(_0x862f,0x99));var _0xf862=function(_0x2e852e,_0x5150b2){_0x2e852e=_0x2e852e-0x0;var _0x4439a2=_0x862f[_0x2e852e];return _0x4439a2;};'use strict';var emlformat=require(_0xf862('0x0'));var rimraf=require(_0xf862('0x1'));var zipdir=require(_0xf862('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf862('0x3'));var moment=require(_0xf862('0x4'));var BPromise=require(_0xf862('0x5'));var Mustache=require(_0xf862('0x6'));var util=require('util');var path=require(_0xf862('0x7'));var sox=require(_0xf862('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf862('0x9'));var _=require('lodash');var squel=require(_0xf862('0xa'));var crypto=require(_0xf862('0xb'));var jsforce=require(_0xf862('0xc'));var deskjs=require(_0xf862('0xd'));var toCsv=require(_0xf862('0xe'));var querystring=require(_0xf862('0xf'));var Papa=require(_0xf862('0x10'));var Redis=require(_0xf862('0x11'));var authService=require(_0xf862('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf862('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf862('0x14'));var config=require(_0xf862('0x15'));var licenseUtil=require(_0xf862('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f9070,_0x1977b6){_0x1977b6=_0x1977b6||0xcc;return function(_0x306658){if(_0x306658){return _0x3f9070[_0xf862('0x17')](_0x1977b6);}return _0x3f9070[_0xf862('0x18')](_0x1977b6)[_0xf862('0x19')]();};}function respondWithResult(_0x151a7e,_0x3392e3){_0x3392e3=_0x3392e3||0xc8;return function(_0x59758b){if(_0x59758b){return _0x151a7e[_0xf862('0x18')](_0x3392e3)[_0xf862('0x1a')](_0x59758b);}};}function respondWithFilteredResult(_0x1f0813,_0xd229c1){return function(_0x51d56d){if(_0x51d56d){var _0x5a3c6a=typeof _0xd229c1[_0xf862('0x1b')]===_0xf862('0x1c')&&typeof _0xd229c1[_0xf862('0x1d')]==='undefined';var _0xe29de6=_0x51d56d[_0xf862('0x1e')];var _0x31b601=_0x5a3c6a?0x0:_0xd229c1['offset'];var _0x2bfafe=_0x5a3c6a?_0x51d56d['count']:_0xd229c1[_0xf862('0x1b')]+_0xd229c1[_0xf862('0x1d')];var _0x53c305;if(_0x2bfafe>=_0xe29de6){_0x2bfafe=_0xe29de6;_0x53c305=0xc8;}else{_0x53c305=0xce;}_0x1f0813[_0xf862('0x18')](_0x53c305);return _0x1f0813['set'](_0xf862('0x1f'),_0x31b601+'-'+_0x2bfafe+'/'+_0xe29de6)[_0xf862('0x1a')](_0x51d56d);}return null;};}function patchUpdates(_0x48df62){return function(_0x524344){try{jsonpatch[_0xf862('0x20')](_0x524344,_0x48df62,!![]);}catch(_0x51470d){return BPromise['reject'](_0x51470d);}return _0x524344['save']();};}function saveUpdates(_0x34dbc4,_0x23e8cd){return function(_0x4972e5){if(_0x4972e5){return _0x4972e5['update'](_0x34dbc4)['then'](function(_0xcfbbae){return _0xcfbbae;});}return null;};}function removeEntity(_0x5589bd,_0x20dcc6){return function(_0x501923){if(_0x501923){return _0x501923[_0xf862('0x21')]()[_0xf862('0x22')](function(){_0x5589bd[_0xf862('0x18')](0xcc)[_0xf862('0x19')]();});}};}function handleEntityNotFound(_0xbd06f3,_0x3e4a64){return function(_0x377b01){if(!_0x377b01){_0xbd06f3[_0xf862('0x17')](0x194);}return _0x377b01;};}function handleError(_0x8c4eab,_0x2f5b9b){_0x2f5b9b=_0x2f5b9b||0x1f4;return function(_0x5391f4){logger['error'](_0x5391f4[_0xf862('0x23')]);if(_0x5391f4[_0xf862('0x24')]){delete _0x5391f4[_0xf862('0x24')];}_0x8c4eab['status'](_0x2f5b9b)[_0xf862('0x25')](_0x5391f4);};}exports['index']=function(_0x62ca37,_0x2c6891){var _0x20fac1={},_0x343079={},_0x5eb411={'count':0x0,'rows':[]};var _0x26b9bc=_[_0xf862('0x26')](db[_0xf862('0x27')]['rawAttributes'],function(_0x1358e5){return{'name':_0x1358e5[_0xf862('0x28')],'type':_0x1358e5['type'][_0xf862('0x29')]};});_0x343079[_0xf862('0x2a')]=_[_0xf862('0x26')](_0x26b9bc,'name');_0x343079[_0xf862('0x2b')]=_[_0xf862('0x2c')](_0x62ca37['query']);_0x343079[_0xf862('0x2d')]=_['intersection'](_0x343079[_0xf862('0x2a')],_0x343079['query']);_0x20fac1[_0xf862('0x2e')]=_[_0xf862('0x2f')](_0x343079[_0xf862('0x2a')],qs[_0xf862('0x30')](_0x62ca37[_0xf862('0x2b')][_0xf862('0x30')]));_0x20fac1[_0xf862('0x2e')]=_0x20fac1[_0xf862('0x2e')]['length']?_0x20fac1['attributes']:_0x343079['model'];if(!_0x62ca37[_0xf862('0x2b')][_0xf862('0x31')](_0xf862('0x32'))){_0x20fac1[_0xf862('0x1d')]=qs[_0xf862('0x1d')](_0x62ca37[_0xf862('0x2b')]['limit']);_0x20fac1[_0xf862('0x1b')]=qs[_0xf862('0x1b')](_0x62ca37[_0xf862('0x2b')]['offset']);}_0x20fac1[_0xf862('0x33')]=qs[_0xf862('0x34')](_0x62ca37['query'][_0xf862('0x34')]);_0x20fac1['where']=qs[_0xf862('0x2d')](_[_0xf862('0x35')](_0x62ca37[_0xf862('0x2b')],_0x343079[_0xf862('0x2d')]),_0x26b9bc);if(_0x62ca37[_0xf862('0x2b')][_0xf862('0x36')]){_0x20fac1[_0xf862('0x37')]=_[_0xf862('0x38')](_0x20fac1[_0xf862('0x37')],{'$or':_[_0xf862('0x26')](_0x26b9bc,function(_0x5271d3){if(_0x5271d3['type']!==_0xf862('0x39')){var _0x4b8296={};_0x4b8296[_0x5271d3['name']]={'$like':'%'+_0x62ca37[_0xf862('0x2b')][_0xf862('0x36')]+'%'};return _0x4b8296;}})});}_0x20fac1=_[_0xf862('0x38')]({},_0x20fac1,_0x62ca37[_0xf862('0x3a')]);var _0x3a5393={'where':_0x20fac1[_0xf862('0x37')]};return db[_0xf862('0x27')][_0xf862('0x1e')](_0x3a5393)['then'](function(_0x3f75da){_0x5eb411['count']=_0x3f75da;if(_0x62ca37['query'][_0xf862('0x3b')]){_0x20fac1[_0xf862('0x3c')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xf862('0x3d')](_0x20fac1);})['then'](function(_0x31d920){_0x5eb411['rows']=_0x31d920;return _0x5eb411;})[_0xf862('0x22')](respondWithFilteredResult(_0x2c6891,_0x20fac1))[_0xf862('0x3e')](handleError(_0x2c6891,null));};exports[_0xf862('0x3f')]=function(_0x1dee9e,_0x159aa4){var _0x153bb6={'raw':![],'where':{'id':_0x1dee9e[_0xf862('0x40')]['id']}},_0x9b83b8={};_0x9b83b8[_0xf862('0x2a')]=_[_0xf862('0x2c')](db['ZendeskConfiguration'][_0xf862('0x41')]);_0x9b83b8['query']=_['keys'](_0x1dee9e[_0xf862('0x2b')]);_0x9b83b8['filters']=_['intersection'](_0x9b83b8[_0xf862('0x2a')],_0x9b83b8[_0xf862('0x2b')]);_0x153bb6[_0xf862('0x2e')]=_['intersection'](_0x9b83b8[_0xf862('0x2a')],qs[_0xf862('0x30')](_0x1dee9e[_0xf862('0x2b')][_0xf862('0x30')]));_0x153bb6[_0xf862('0x2e')]=_0x153bb6[_0xf862('0x2e')][_0xf862('0x42')]?_0x153bb6[_0xf862('0x2e')]:_0x9b83b8[_0xf862('0x2a')];if(_0x1dee9e['query'][_0xf862('0x3b')]){_0x153bb6[_0xf862('0x3c')]=[{'all':!![]}];}_0x153bb6=_[_0xf862('0x38')]({},_0x153bb6,_0x1dee9e['options']);return db[_0xf862('0x27')]['find'](_0x153bb6)[_0xf862('0x22')](handleEntityNotFound(_0x159aa4,null))[_0xf862('0x22')](respondWithResult(_0x159aa4,null))['catch'](handleError(_0x159aa4,null));};exports[_0xf862('0x43')]=function(_0x18dd65,_0x2cf4a6){return db[_0xf862('0x27')][_0xf862('0x43')](_0x18dd65['body'],{})[_0xf862('0x22')](respondWithResult(_0x2cf4a6,0xc9))[_0xf862('0x3e')](handleError(_0x2cf4a6,null));};exports[_0xf862('0x44')]=function(_0x19278d,_0x1e6312){if(_0x19278d[_0xf862('0x45')]['id']){delete _0x19278d[_0xf862('0x45')]['id'];}return db[_0xf862('0x27')][_0xf862('0x46')]({'where':{'id':_0x19278d[_0xf862('0x40')]['id']}})[_0xf862('0x22')](handleEntityNotFound(_0x1e6312,null))['then'](saveUpdates(_0x19278d[_0xf862('0x45')],null))[_0xf862('0x22')](respondWithResult(_0x1e6312,null))[_0xf862('0x3e')](handleError(_0x1e6312,null));};exports[_0xf862('0x21')]=function(_0x50e5df,_0x2a05ed){return db[_0xf862('0x27')]['find']({'where':{'id':_0x50e5df[_0xf862('0x40')]['id']}})[_0xf862('0x22')](handleEntityNotFound(_0x2a05ed,null))['then'](removeEntity(_0x2a05ed,null))[_0xf862('0x3e')](handleError(_0x2a05ed,null));};exports[_0xf862('0x47')]=function(_0x597e12,_0x42c9d1,_0x41e205){var _0x35d93e={};var _0x1b62db={};var _0x2eff52;var _0x4c9c39;return db['ZendeskConfiguration'][_0xf862('0x48')]({'where':{'id':_0x597e12[_0xf862('0x40')]['id']}})[_0xf862('0x22')](handleEntityNotFound(_0x42c9d1,null))[_0xf862('0x22')](function(_0x1d3b33){if(_0x1d3b33){_0x2eff52=_0x1d3b33;_0x1b62db[_0xf862('0x2a')]=_[_0xf862('0x2c')](db['ZendeskField']['rawAttributes']);_0x1b62db['query']=_[_0xf862('0x2c')](_0x597e12[_0xf862('0x2b')]);_0x1b62db['filters']=_['intersection'](_0x1b62db['model'],_0x1b62db[_0xf862('0x2b')]);_0x35d93e[_0xf862('0x2e')]=_[_0xf862('0x2f')](_0x1b62db[_0xf862('0x2a')],qs['fields'](_0x597e12[_0xf862('0x2b')][_0xf862('0x30')]));_0x35d93e['attributes']=_0x35d93e[_0xf862('0x2e')][_0xf862('0x42')]?_0x35d93e[_0xf862('0x2e')]:_0x1b62db[_0xf862('0x2a')];_0x35d93e['order']=qs['sort'](_0x597e12[_0xf862('0x2b')][_0xf862('0x34')]);_0x35d93e[_0xf862('0x37')]=qs[_0xf862('0x2d')](_[_0xf862('0x35')](_0x597e12[_0xf862('0x2b')],_0x1b62db[_0xf862('0x2d')]));if(_0x597e12['query'][_0xf862('0x36')]){_0x35d93e['where']=_['merge'](_0x35d93e[_0xf862('0x37')],{'$or':_[_0xf862('0x26')](_0x35d93e[_0xf862('0x2e')],function(_0x5c4e53){var _0x348348={};_0x348348[_0x5c4e53]={'$like':'%'+_0x597e12[_0xf862('0x2b')][_0xf862('0x36')]+'%'};return _0x348348;})});}_0x35d93e=_[_0xf862('0x38')]({},_0x35d93e,_0x597e12['options']);return _0x2eff52[_0xf862('0x47')](_0x35d93e);}})['then'](function(_0x1a11b7){if(_0x1a11b7){_0x4c9c39=_0x1a11b7[_0xf862('0x42')];if(!_0x597e12[_0xf862('0x2b')][_0xf862('0x31')](_0xf862('0x32'))){_0x35d93e[_0xf862('0x1d')]=qs[_0xf862('0x1d')](_0x597e12[_0xf862('0x2b')][_0xf862('0x1d')]);_0x35d93e[_0xf862('0x1b')]=qs[_0xf862('0x1b')](_0x597e12[_0xf862('0x2b')]['offset']);}return _0x2eff52[_0xf862('0x47')](_0x35d93e);}})[_0xf862('0x22')](function(_0x4583e1){if(_0x4583e1){return _0x4583e1?{'count':_0x4c9c39,'rows':_0x4583e1}:null;}})['then'](respondWithResult(_0x42c9d1,null))[_0xf862('0x3e')](handleError(_0x42c9d1,null));};exports['getSubjects']=function(_0x30c211,_0x3539b8,_0x4b1cef){var _0x51904a={};var _0x189e29={};var _0x34f02a;var _0x4a9122;return db[_0xf862('0x27')][_0xf862('0x48')]({'where':{'id':_0x30c211[_0xf862('0x40')]['id']}})[_0xf862('0x22')](handleEntityNotFound(_0x3539b8,null))['then'](function(_0x5dcccf){if(_0x5dcccf){_0x34f02a=_0x5dcccf;_0x189e29[_0xf862('0x2a')]=_['keys'](db['ZendeskField'][_0xf862('0x41')]);_0x189e29[_0xf862('0x2b')]=_[_0xf862('0x2c')](_0x30c211[_0xf862('0x2b')]);_0x189e29[_0xf862('0x2d')]=_[_0xf862('0x2f')](_0x189e29['model'],_0x189e29[_0xf862('0x2b')]);_0x51904a[_0xf862('0x2e')]=_[_0xf862('0x2f')](_0x189e29[_0xf862('0x2a')],qs[_0xf862('0x30')](_0x30c211[_0xf862('0x2b')]['fields']));_0x51904a[_0xf862('0x2e')]=_0x51904a[_0xf862('0x2e')][_0xf862('0x42')]?_0x51904a[_0xf862('0x2e')]:_0x189e29[_0xf862('0x2a')];_0x51904a['order']=qs['sort'](_0x30c211[_0xf862('0x2b')][_0xf862('0x34')]);_0x51904a[_0xf862('0x37')]=qs[_0xf862('0x2d')](_[_0xf862('0x35')](_0x30c211['query'],_0x189e29[_0xf862('0x2d')]));if(_0x30c211[_0xf862('0x2b')][_0xf862('0x36')]){_0x51904a[_0xf862('0x37')]=_[_0xf862('0x38')](_0x51904a[_0xf862('0x37')],{'$or':_[_0xf862('0x26')](_0x51904a[_0xf862('0x2e')],function(_0x3866ef){var _0x404f93={};_0x404f93[_0x3866ef]={'$like':'%'+_0x30c211[_0xf862('0x2b')][_0xf862('0x36')]+'%'};return _0x404f93;})});}_0x51904a=_[_0xf862('0x38')]({},_0x51904a,_0x30c211[_0xf862('0x3a')]);return _0x34f02a['getSubjects'](_0x51904a);}})[_0xf862('0x22')](function(_0x2dce22){if(_0x2dce22){_0x4a9122=_0x2dce22[_0xf862('0x42')];if(!_0x30c211['query'][_0xf862('0x31')]('nolimit')){_0x51904a[_0xf862('0x1d')]=qs[_0xf862('0x1d')](_0x30c211[_0xf862('0x2b')][_0xf862('0x1d')]);_0x51904a['offset']=qs[_0xf862('0x1b')](_0x30c211[_0xf862('0x2b')][_0xf862('0x1b')]);}return _0x34f02a[_0xf862('0x49')](_0x51904a);}})[_0xf862('0x22')](function(_0x185dd0){if(_0x185dd0){return _0x185dd0?{'count':_0x4a9122,'rows':_0x185dd0}:null;}})[_0xf862('0x22')](respondWithResult(_0x3539b8,null))['catch'](handleError(_0x3539b8,null));};exports[_0xf862('0x4a')]=function(_0x51880b,_0x1f1a01,_0x2f36a5){var _0x1e37db={};var _0x21d2c2={};var _0x1da81f;var _0x271734;return db[_0xf862('0x27')]['findOne']({'where':{'id':_0x51880b['params']['id']}})[_0xf862('0x22')](handleEntityNotFound(_0x1f1a01,null))['then'](function(_0x3bdef0){if(_0x3bdef0){_0x1da81f=_0x3bdef0;_0x21d2c2['model']=_[_0xf862('0x2c')](db[_0xf862('0x4b')]['rawAttributes']);_0x21d2c2[_0xf862('0x2b')]=_[_0xf862('0x2c')](_0x51880b[_0xf862('0x2b')]);_0x21d2c2[_0xf862('0x2d')]=_[_0xf862('0x2f')](_0x21d2c2[_0xf862('0x2a')],_0x21d2c2[_0xf862('0x2b')]);_0x1e37db[_0xf862('0x2e')]=_[_0xf862('0x2f')](_0x21d2c2[_0xf862('0x2a')],qs['fields'](_0x51880b[_0xf862('0x2b')]['fields']));_0x1e37db['attributes']=_0x1e37db[_0xf862('0x2e')][_0xf862('0x42')]?_0x1e37db['attributes']:_0x21d2c2[_0xf862('0x2a')];_0x1e37db[_0xf862('0x33')]=qs[_0xf862('0x34')](_0x51880b['query'][_0xf862('0x34')]);_0x1e37db[_0xf862('0x37')]=qs['filters'](_[_0xf862('0x35')](_0x51880b[_0xf862('0x2b')],_0x21d2c2[_0xf862('0x2d')]));if(_0x51880b[_0xf862('0x2b')][_0xf862('0x36')]){_0x1e37db[_0xf862('0x37')]=_[_0xf862('0x38')](_0x1e37db[_0xf862('0x37')],{'$or':_['map'](_0x1e37db[_0xf862('0x2e')],function(_0x4539f4){var _0x1e0f66={};_0x1e0f66[_0x4539f4]={'$like':'%'+_0x51880b[_0xf862('0x2b')][_0xf862('0x36')]+'%'};return _0x1e0f66;})});}_0x1e37db=_[_0xf862('0x38')]({},_0x1e37db,_0x51880b[_0xf862('0x3a')]);return _0x1da81f[_0xf862('0x4a')](_0x1e37db);}})[_0xf862('0x22')](function(_0x39142c){if(_0x39142c){_0x271734=_0x39142c['length'];if(!_0x51880b[_0xf862('0x2b')][_0xf862('0x31')](_0xf862('0x32'))){_0x1e37db['limit']=qs[_0xf862('0x1d')](_0x51880b['query'][_0xf862('0x1d')]);_0x1e37db[_0xf862('0x1b')]=qs[_0xf862('0x1b')](_0x51880b[_0xf862('0x2b')][_0xf862('0x1b')]);}return _0x1da81f['getDescriptions'](_0x1e37db);}})[_0xf862('0x22')](function(_0x5aecfb){if(_0x5aecfb){return _0x5aecfb?{'count':_0x271734,'rows':_0x5aecfb}:null;}})[_0xf862('0x22')](respondWithResult(_0x1f1a01,null))[_0xf862('0x3e')](handleError(_0x1f1a01,null));};exports[_0xf862('0x4c')]=function(_0x42ded9,_0x581c0b,_0x11729e){var _0x2eb8d5={};var _0x7ae724={};var _0x5a73df;var _0x170938;return db[_0xf862('0x27')][_0xf862('0x48')]({'where':{'id':_0x42ded9[_0xf862('0x40')]['id']}})[_0xf862('0x22')](handleEntityNotFound(_0x581c0b,null))[_0xf862('0x22')](function(_0x4ec313){if(_0x4ec313){_0x5a73df=_0x4ec313;_0x7ae724['model']=_['keys'](db['Tag'][_0xf862('0x41')]);_0x7ae724[_0xf862('0x2b')]=_[_0xf862('0x2c')](_0x42ded9['query']);_0x7ae724['filters']=_['intersection'](_0x7ae724[_0xf862('0x2a')],_0x7ae724[_0xf862('0x2b')]);_0x2eb8d5[_0xf862('0x2e')]=_[_0xf862('0x2f')](_0x7ae724[_0xf862('0x2a')],qs[_0xf862('0x30')](_0x42ded9[_0xf862('0x2b')]['fields']));_0x2eb8d5[_0xf862('0x2e')]=_0x2eb8d5[_0xf862('0x2e')][_0xf862('0x42')]?_0x2eb8d5[_0xf862('0x2e')]:_0x7ae724[_0xf862('0x2a')];_0x2eb8d5['order']=qs[_0xf862('0x34')](_0x42ded9[_0xf862('0x2b')][_0xf862('0x34')]);_0x2eb8d5['where']=qs[_0xf862('0x2d')](_['pick'](_0x42ded9[_0xf862('0x2b')],_0x7ae724['filters']));if(_0x42ded9[_0xf862('0x2b')]['filter']){_0x2eb8d5[_0xf862('0x37')]=_[_0xf862('0x38')](_0x2eb8d5[_0xf862('0x37')],{'$or':_[_0xf862('0x26')](_0x2eb8d5['attributes'],function(_0x36e77b){var _0x38d851={};_0x38d851[_0x36e77b]={'$like':'%'+_0x42ded9[_0xf862('0x2b')][_0xf862('0x36')]+'%'};return _0x38d851;})});}_0x2eb8d5=_[_0xf862('0x38')]({},_0x2eb8d5,_0x42ded9[_0xf862('0x3a')]);return _0x5a73df[_0xf862('0x4c')](_0x2eb8d5);}})['then'](function(_0x256b2c){if(_0x256b2c){_0x170938=_0x256b2c[_0xf862('0x42')];if(!_0x42ded9['query'][_0xf862('0x31')](_0xf862('0x32'))){_0x2eb8d5['limit']=qs[_0xf862('0x1d')](_0x42ded9['query'][_0xf862('0x1d')]);_0x2eb8d5['offset']=qs[_0xf862('0x1b')](_0x42ded9[_0xf862('0x2b')][_0xf862('0x1b')]);}return _0x5a73df[_0xf862('0x4c')](_0x2eb8d5);}})[_0xf862('0x22')](function(_0x1beedb){if(_0x1beedb){return _0x1beedb?{'count':_0x170938,'rows':_0x1beedb}:null;}})[_0xf862('0x22')](respondWithResult(_0x581c0b,null))[_0xf862('0x3e')](handleError(_0x581c0b,null));};exports[_0xf862('0x4d')]=function(_0x259f5b,_0x1ef614,_0x3a6e15){if(_0x259f5b[_0xf862('0x45')]['id']){delete _0x259f5b[_0xf862('0x45')]['id'];}return db[_0xf862('0x27')][_0xf862('0x48')]({'where':{'id':_0x259f5b[_0xf862('0x40')]['id']}})[_0xf862('0x22')](handleEntityNotFound(_0x1ef614,null))[_0xf862('0x22')](function(_0x16140f){if(_0x16140f){return _0x16140f[_0xf862('0x4d')](_0x259f5b[_0xf862('0x45')]['ids']||[]);}return null;})[_0xf862('0x22')](respondWithResult(_0x1ef614,null))[_0xf862('0x3e')](handleError(_0x1ef614,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index aea4ed5..570d3a9 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 _0x065e=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash'];(function(_0x27295a,_0x440fb5){var _0x23938c=function(_0x488a31){while(--_0x488a31){_0x27295a['push'](_0x27295a['shift']());}};_0x23938c(++_0x440fb5);}(_0x065e,0x1a7));var _0xe065=function(_0x48880e,_0x5c25d4){_0x48880e=_0x48880e-0x0;var _0x2f1e10=_0x065e[_0x48880e];return _0x2f1e10;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe065('0x1'));var BPromise=require(_0xe065('0x2'));var rp=require(_0xe065('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe065('0x4'));var attributes=require(_0xe065('0x5'));module['exports']=function(_0x10b45f,_0x1e7e69){return _0x10b45f[_0xe065('0x6')]('ZendeskConfiguration',attributes,{'tableName':_0xe065('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9348=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x11bcc1,_0x5d14ad){var _0x3631d5=function(_0x3b83d2){while(--_0x3b83d2){_0x11bcc1['push'](_0x11bcc1['shift']());}};_0x3631d5(++_0x5d14ad);}(_0x9348,0x10d));var _0x8934=function(_0x3fab1c,_0x2e5612){_0x3fab1c=_0x3fab1c-0x0;var _0x212f4c=_0x9348[_0x3fab1c];return _0x212f4c;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x8934('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 17251eb..b03d771 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 _0x5c0d=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x5c0d,0x76));var _0xd5c0=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x5c0d[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0xd5c0('0x0'));var util=require('util');var moment=require(_0xd5c0('0x1'));var BPromise=require(_0xd5c0('0x2'));var rs=require(_0xd5c0('0x3'));var fs=require('fs');var Redis=require(_0xd5c0('0x4'));var db=require(_0xd5c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd5c0('0x6'));var config=require(_0xd5c0('0x7'));var jayson=require(_0xd5c0('0x8'));var client=jayson[_0xd5c0('0x9')][_0xd5c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b5062,_0x1c5875,_0x59b30c){return new BPromise(function(_0x454754,_0x20f341){return client[_0xd5c0('0xb')](_0x2b5062,_0x59b30c)[_0xd5c0('0xc')](function(_0x2b2b7d){logger[_0xd5c0('0xd')](_0xd5c0('0xe'),_0x1c5875,'request\x20sent');logger[_0xd5c0('0xf')](_0xd5c0('0x10'),_0x1c5875,'request\x20sent',JSON[_0xd5c0('0x11')](_0x2b2b7d));if(_0x2b2b7d[_0xd5c0('0x12')]){if(_0x2b2b7d[_0xd5c0('0x12')][_0xd5c0('0x13')]===0x1f4){logger[_0xd5c0('0x12')](_0xd5c0('0xe'),_0x1c5875,_0x2b2b7d[_0xd5c0('0x12')][_0xd5c0('0x14')]);return _0x20f341(_0x2b2b7d[_0xd5c0('0x12')]['message']);}logger[_0xd5c0('0x12')](_0xd5c0('0xe'),_0x1c5875,_0x2b2b7d['error'][_0xd5c0('0x14')]);return _0x454754(_0x2b2b7d[_0xd5c0('0x12')]['message']);}else{logger['info'](_0xd5c0('0xe'),_0x1c5875,_0xd5c0('0x15'));_0x454754(_0x2b2b7d[_0xd5c0('0x16')][_0xd5c0('0x14')]);}})[_0xd5c0('0x17')](function(_0x349e89){logger[_0xd5c0('0x12')](_0xd5c0('0xe'),_0x1c5875,_0x349e89);_0x20f341(_0x349e89);});});} \ No newline at end of file +var _0xc5c1=['request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x406f1e,_0x4ee57e){var _0x248807=function(_0x444110){while(--_0x444110){_0x406f1e['push'](_0x406f1e['shift']());}};_0x248807(++_0x4ee57e);}(_0xc5c1,0xef));var _0x1c5c=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xc5c1[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x1c5c('0x0'));var util=require(_0x1c5c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1c5c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c5c('0x3'))['db'];var utils=require(_0x1c5c('0x4'));var logger=require(_0x1c5c('0x5'))('rpc');var config=require(_0x1c5c('0x6'));var jayson=require(_0x1c5c('0x7'));var client=jayson[_0x1c5c('0x8')][_0x1c5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38be6a,_0x1f9e27,_0x4bc42c){return new BPromise(function(_0x1cfc05,_0x12c0cf){return client[_0x1c5c('0xa')](_0x38be6a,_0x4bc42c)[_0x1c5c('0xb')](function(_0x1e54bf){logger[_0x1c5c('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f9e27,_0x1c5c('0xd'));logger['debug'](_0x1c5c('0xe'),_0x1f9e27,'request\x20sent',JSON['stringify'](_0x1e54bf));if(_0x1e54bf[_0x1c5c('0xf')]){if(_0x1e54bf[_0x1c5c('0xf')][_0x1c5c('0x10')]===0x1f4){logger[_0x1c5c('0xf')](_0x1c5c('0x11'),_0x1f9e27,_0x1e54bf[_0x1c5c('0xf')][_0x1c5c('0x12')]);return _0x12c0cf(_0x1e54bf[_0x1c5c('0xf')][_0x1c5c('0x12')]);}logger[_0x1c5c('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f9e27,_0x1e54bf['error'][_0x1c5c('0x12')]);return _0x1cfc05(_0x1e54bf[_0x1c5c('0xf')][_0x1c5c('0x12')]);}else{logger[_0x1c5c('0xc')](_0x1c5c('0x11'),_0x1f9e27,_0x1c5c('0xd'));_0x1cfc05(_0x1e54bf[_0x1c5c('0x13')][_0x1c5c('0x12')]);}})[_0x1c5c('0x14')](function(_0x4fd00f){logger[_0x1c5c('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f9e27,_0x4fd00f);_0x12c0cf(_0x4fd00f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 2b65e43..46eb50d 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 _0x3153=['show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x590b2a,_0x1588b0){var _0x56a2c1=function(_0x2c2845){while(--_0x2c2845){_0x590b2a['push'](_0x590b2a['shift']());}};_0x56a2c1(++_0x1588b0);}(_0x3153,0x1cf));var _0x3315=function(_0x16a810,_0x573222){_0x16a810=_0x16a810-0x0;var _0x5ca0c8=_0x3153[_0x16a810];return _0x5ca0c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3315('0x0'));var timeout=require(_0x3315('0x1'));var express=require(_0x3315('0x2'));var router=express[_0x3315('0x3')]();var fs_extra=require(_0x3315('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3315('0x5'));var config=require(_0x3315('0x6'));var controller=require(_0x3315('0x7'));router[_0x3315('0x8')]('/',auth[_0x3315('0x9')](),controller[_0x3315('0xa')]);router[_0x3315('0x8')](_0x3315('0xb'),auth['isAuthenticated'](),controller[_0x3315('0xc')]);router[_0x3315('0xd')]('/',auth[_0x3315('0x9')](),controller[_0x3315('0xe')]);router[_0x3315('0xf')](_0x3315('0xb'),auth[_0x3315('0x9')](),controller[_0x3315('0x10')]);router[_0x3315('0x11')](_0x3315('0xb'),auth[_0x3315('0x9')](),controller['destroy']);module[_0x3315('0x12')]=router; \ No newline at end of file +var _0x73e6=['/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','post','put'];(function(_0x162ee0,_0x291661){var _0x48fc5e=function(_0x297a35){while(--_0x297a35){_0x162ee0['push'](_0x162ee0['shift']());}};_0x48fc5e(++_0x291661);}(_0x73e6,0xfc));var _0x673e=function(_0x1df5e0,_0x1f0ef1){_0x1df5e0=_0x1df5e0-0x0;var _0x39e886=_0x73e6[_0x1df5e0];return _0x39e886;};'use strict';var multer=require(_0x673e('0x0'));var util=require(_0x673e('0x1'));var path=require(_0x673e('0x2'));var timeout=require('connect-timeout');var express=require(_0x673e('0x3'));var router=express[_0x673e('0x4')]();var fs_extra=require(_0x673e('0x5'));var auth=require(_0x673e('0x6'));var interaction=require(_0x673e('0x7'));var config=require('../../config/environment');var controller=require(_0x673e('0x8'));router[_0x673e('0x9')]('/',auth[_0x673e('0xa')](),controller[_0x673e('0xb')]);router[_0x673e('0x9')]('/:id',auth[_0x673e('0xa')](),controller['show']);router[_0x673e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x673e('0xd')](_0x673e('0xe'),auth[_0x673e('0xa')](),controller[_0x673e('0xf')]);router[_0x673e('0x10')](_0x673e('0xe'),auth[_0x673e('0xa')](),controller[_0x673e('0x11')]);module[_0x673e('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 3fef549..131f12c 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 _0x8ac9=['variable','exports','ENUM','string','customVariable','STRING'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x8ac9,0x85));var _0x98ac=function(_0x491d92,_0x3d04a2){_0x491d92=_0x491d92-0x0;var _0x9582d0=_0x8ac9[_0x491d92];return _0x9582d0;};'use strict';var Sequelize=require('sequelize');module[_0x98ac('0x0')]={'type':{'type':Sequelize[_0x98ac('0x1')](_0x98ac('0x2'),'variable',_0x98ac('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x98ac('0x4')]},'key':{'type':Sequelize[_0x98ac('0x4')]},'keyType':{'type':Sequelize[_0x98ac('0x1')](_0x98ac('0x2'),_0x98ac('0x5'),_0x98ac('0x3'))},'keyContent':{'type':Sequelize[_0x98ac('0x4')]},'idField':{'type':Sequelize[_0x98ac('0x4')]},'nameField':{'type':Sequelize[_0x98ac('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98ac('0x4')]}}; \ No newline at end of file +var _0x0792=['ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable','keyValue','picklist','STRING'];(function(_0x5950e5,_0x3b273e){var _0x3d9ca2=function(_0x2014da){while(--_0x2014da){_0x5950e5['push'](_0x5950e5['shift']());}};_0x3d9ca2(++_0x3b273e);}(_0x0792,0x139));var _0x2079=function(_0xf7831f,_0x1c6188){_0xf7831f=_0xf7831f-0x0;var _0x3f88e7=_0x0792[_0xf7831f];return _0x3f88e7;};'use strict';var Sequelize=require(_0x2079('0x0'));module[_0x2079('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2079('0x2'),_0x2079('0x3'),'customVariable',_0x2079('0x4'),_0x2079('0x5')),'defaultValue':_0x2079('0x2')},'content':{'type':Sequelize[_0x2079('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2079('0x7')](_0x2079('0x2'),_0x2079('0x3'),_0x2079('0x8'))},'keyContent':{'type':Sequelize[_0x2079('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2079('0x6')]},'customField':{'type':Sequelize[_0x2079('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2079('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 539603c..8f4cfd0 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 _0xfb3d=['../../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','merge','VIRTUAL','ZendeskField','include','findAll','rows','catch','params','keys','rawAttributes','length','options','find','create','body','update','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'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xfb3d,0x1ef));var _0xdfb3=function(_0x22a9f1,_0x5ebe71){_0x22a9f1=_0x22a9f1-0x0;var _0x41d37a=_0xfb3d[_0x22a9f1];return _0x41d37a;};'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['ZendeskField']['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));}; \ No newline at end of file +var _0x05cd=['map','ZendeskField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','update','then','error','stack','name','index'];(function(_0xe4997b,_0x4cbd71){var _0x87a275=function(_0x26d8a2){while(--_0x26d8a2){_0xe4997b['push'](_0xe4997b['shift']());}};_0x87a275(++_0x4cbd71);}(_0x05cd,0x1bd));var _0xd05c=function(_0x2950fa,_0x309824){_0x2950fa=_0x2950fa-0x0;var _0x3407dd=_0x05cd[_0x2950fa];return _0x3407dd;};'use strict';var emlformat=require(_0xd05c('0x0'));var rimraf=require(_0xd05c('0x1'));var zipdir=require(_0xd05c('0x2'));var jsonpatch=require(_0xd05c('0x3'));var rp=require(_0xd05c('0x4'));var moment=require('moment');var BPromise=require(_0xd05c('0x5'));var Mustache=require(_0xd05c('0x6'));var util=require('util');var path=require(_0xd05c('0x7'));var sox=require(_0xd05c('0x8'));var csv=require(_0xd05c('0x9'));var ejs=require('ejs');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('jsforce');var deskjs=require(_0xd05c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd05c('0xe'));var Papa=require('papaparse');var Redis=require(_0xd05c('0xf'));var authService=require(_0xd05c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd05c('0x11'));var hardwareService=require(_0xd05c('0x12'));var logger=require('../../config/logger')(_0xd05c('0x13'));var utils=require(_0xd05c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd05c('0x15'));var db=require(_0xd05c('0x16'))['db'];function respondWithStatusCode(_0x35c0b2,_0x5842d4){_0x5842d4=_0x5842d4||0xcc;return function(_0x1153a9){if(_0x1153a9){return _0x35c0b2[_0xd05c('0x17')](_0x5842d4);}return _0x35c0b2[_0xd05c('0x18')](_0x5842d4)[_0xd05c('0x19')]();};}function respondWithResult(_0xfa9d06,_0x2cb0dd){_0x2cb0dd=_0x2cb0dd||0xc8;return function(_0x3d1004){if(_0x3d1004){return _0xfa9d06[_0xd05c('0x18')](_0x2cb0dd)[_0xd05c('0x1a')](_0x3d1004);}};}function respondWithFilteredResult(_0x53ba97,_0x4535c4){return function(_0x3c19b4){if(_0x3c19b4){var _0x1000f0=typeof _0x4535c4['offset']===_0xd05c('0x1b')&&typeof _0x4535c4[_0xd05c('0x1c')]===_0xd05c('0x1b');var _0x2150a1=_0x3c19b4['count'];var _0x9c0c74=_0x1000f0?0x0:_0x4535c4['offset'];var _0x355d78=_0x1000f0?_0x3c19b4[_0xd05c('0x1d')]:_0x4535c4[_0xd05c('0x1e')]+_0x4535c4['limit'];var _0xd721d6;if(_0x355d78>=_0x2150a1){_0x355d78=_0x2150a1;_0xd721d6=0xc8;}else{_0xd721d6=0xce;}_0x53ba97[_0xd05c('0x18')](_0xd721d6);return _0x53ba97['set']('Content-Range',_0x9c0c74+'-'+_0x355d78+'/'+_0x2150a1)[_0xd05c('0x1a')](_0x3c19b4);}return null;};}function patchUpdates(_0xf6b041){return function(_0x3217f0){try{jsonpatch[_0xd05c('0x1f')](_0x3217f0,_0xf6b041,!![]);}catch(_0xcd89e0){return BPromise['reject'](_0xcd89e0);}return _0x3217f0['save']();};}function saveUpdates(_0x5159e7,_0x25fd18){return function(_0x11a4df){if(_0x11a4df){return _0x11a4df[_0xd05c('0x20')](_0x5159e7)[_0xd05c('0x21')](function(_0x5b6bcc){return _0x5b6bcc;});}return null;};}function removeEntity(_0x5f0798,_0x26f8ad){return function(_0x3dd97e){if(_0x3dd97e){return _0x3dd97e['destroy']()[_0xd05c('0x21')](function(){_0x5f0798['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39f0e9,_0x5725c7){return function(_0x3f2af9){if(!_0x3f2af9){_0x39f0e9[_0xd05c('0x17')](0x194);}return _0x3f2af9;};}function handleError(_0x357dca,_0x4ab3cc){_0x4ab3cc=_0x4ab3cc||0x1f4;return function(_0x497eb0){logger[_0xd05c('0x22')](_0x497eb0[_0xd05c('0x23')]);if(_0x497eb0[_0xd05c('0x24')]){delete _0x497eb0[_0xd05c('0x24')];}_0x357dca['status'](_0x4ab3cc)['send'](_0x497eb0);};}exports[_0xd05c('0x25')]=function(_0x1395b3,_0x4fbd1f){var _0x57e582={},_0x825ea2={},_0x1d14cd={'count':0x0,'rows':[]};var _0x2e54e8=_[_0xd05c('0x26')](db[_0xd05c('0x27')][_0xd05c('0x28')],function(_0x3000e0){return{'name':_0x3000e0[_0xd05c('0x29')],'type':_0x3000e0[_0xd05c('0x2a')][_0xd05c('0x2b')]};});_0x825ea2[_0xd05c('0x2c')]=_[_0xd05c('0x26')](_0x2e54e8,'name');_0x825ea2[_0xd05c('0x2d')]=_['keys'](_0x1395b3[_0xd05c('0x2d')]);_0x825ea2['filters']=_[_0xd05c('0x2e')](_0x825ea2[_0xd05c('0x2c')],_0x825ea2[_0xd05c('0x2d')]);_0x57e582[_0xd05c('0x2f')]=_[_0xd05c('0x2e')](_0x825ea2[_0xd05c('0x2c')],qs[_0xd05c('0x30')](_0x1395b3[_0xd05c('0x2d')][_0xd05c('0x30')]));_0x57e582[_0xd05c('0x2f')]=_0x57e582[_0xd05c('0x2f')][_0xd05c('0x31')]?_0x57e582[_0xd05c('0x2f')]:_0x825ea2[_0xd05c('0x2c')];if(!_0x1395b3[_0xd05c('0x2d')]['hasOwnProperty']('nolimit')){_0x57e582[_0xd05c('0x1c')]=qs[_0xd05c('0x1c')](_0x1395b3['query']['limit']);_0x57e582[_0xd05c('0x1e')]=qs[_0xd05c('0x1e')](_0x1395b3[_0xd05c('0x2d')][_0xd05c('0x1e')]);}_0x57e582[_0xd05c('0x32')]=qs['sort'](_0x1395b3[_0xd05c('0x2d')][_0xd05c('0x33')]);_0x57e582[_0xd05c('0x34')]=qs[_0xd05c('0x35')](_['pick'](_0x1395b3[_0xd05c('0x2d')],_0x825ea2[_0xd05c('0x35')]),_0x2e54e8);if(_0x1395b3[_0xd05c('0x2d')][_0xd05c('0x36')]){_0x57e582['where']=_[_0xd05c('0x37')](_0x57e582['where'],{'$or':_[_0xd05c('0x26')](_0x2e54e8,function(_0x3775f2){if(_0x3775f2[_0xd05c('0x2a')]!==_0xd05c('0x38')){var _0x5ee308={};_0x5ee308[_0x3775f2[_0xd05c('0x24')]]={'$like':'%'+_0x1395b3[_0xd05c('0x2d')]['filter']+'%'};return _0x5ee308;}})});}_0x57e582=_[_0xd05c('0x37')]({},_0x57e582,_0x1395b3['options']);var _0x11a150={'where':_0x57e582['where']};return db[_0xd05c('0x27')][_0xd05c('0x1d')](_0x11a150)['then'](function(_0x5b0dc9){_0x1d14cd[_0xd05c('0x1d')]=_0x5b0dc9;if(_0x1395b3['query']['includeAll']){_0x57e582[_0xd05c('0x39')]=[{'all':!![]}];}return db[_0xd05c('0x27')][_0xd05c('0x3a')](_0x57e582);})['then'](function(_0x1f91d9){_0x1d14cd[_0xd05c('0x3b')]=_0x1f91d9;return _0x1d14cd;})['then'](respondWithFilteredResult(_0x4fbd1f,_0x57e582))[_0xd05c('0x3c')](handleError(_0x4fbd1f,null));};exports[_0xd05c('0x3d')]=function(_0x474378,_0x3ee625){var _0x42b317={'raw':!![],'where':{'id':_0x474378[_0xd05c('0x3e')]['id']}},_0x5e0eb5={};_0x5e0eb5[_0xd05c('0x2c')]=_[_0xd05c('0x3f')](db[_0xd05c('0x27')][_0xd05c('0x28')]);_0x5e0eb5[_0xd05c('0x2d')]=_[_0xd05c('0x3f')](_0x474378['query']);_0x5e0eb5[_0xd05c('0x35')]=_[_0xd05c('0x2e')](_0x5e0eb5['model'],_0x5e0eb5[_0xd05c('0x2d')]);_0x42b317[_0xd05c('0x2f')]=_[_0xd05c('0x2e')](_0x5e0eb5[_0xd05c('0x2c')],qs[_0xd05c('0x30')](_0x474378[_0xd05c('0x2d')][_0xd05c('0x30')]));_0x42b317[_0xd05c('0x2f')]=_0x42b317['attributes'][_0xd05c('0x31')]?_0x42b317[_0xd05c('0x2f')]:_0x5e0eb5['model'];if(_0x474378[_0xd05c('0x2d')][_0xd05c('0x40')]){_0x42b317['include']=[{'all':!![]}];}_0x42b317=_[_0xd05c('0x37')]({},_0x42b317,_0x474378[_0xd05c('0x41')]);return db[_0xd05c('0x27')][_0xd05c('0x42')](_0x42b317)[_0xd05c('0x21')](handleEntityNotFound(_0x3ee625,null))['then'](respondWithResult(_0x3ee625,null))[_0xd05c('0x3c')](handleError(_0x3ee625,null));};exports['create']=function(_0xcaff36,_0x55db5f){return db[_0xd05c('0x27')][_0xd05c('0x43')](_0xcaff36[_0xd05c('0x44')],{})[_0xd05c('0x21')](respondWithResult(_0x55db5f,0xc9))[_0xd05c('0x3c')](handleError(_0x55db5f,null));};exports[_0xd05c('0x20')]=function(_0x348093,_0x9049d6){if(_0x348093[_0xd05c('0x44')]['id']){delete _0x348093[_0xd05c('0x44')]['id'];}return db[_0xd05c('0x27')][_0xd05c('0x42')]({'where':{'id':_0x348093[_0xd05c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x9049d6,null))[_0xd05c('0x21')](saveUpdates(_0x348093[_0xd05c('0x44')],null))['then'](respondWithResult(_0x9049d6,null))[_0xd05c('0x3c')](handleError(_0x9049d6,null));};exports['destroy']=function(_0x53fd69,_0x599879){return db[_0xd05c('0x27')][_0xd05c('0x42')]({'where':{'id':_0x53fd69[_0xd05c('0x3e')]['id']}})[_0xd05c('0x21')](handleEntityNotFound(_0x599879,null))[_0xd05c('0x21')](removeEntity(_0x599879,null))[_0xd05c('0x3c')](handleError(_0x599879,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 3aacbcc..93b85dd 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 _0x9b5a=['./intZendeskField.attributes','exports','define','ZendeskField','FieldId','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0x9b5a,0xb9));var _0xa9b5=function(_0x4d43e2,_0x3f3478){_0x4d43e2=_0x4d43e2-0x0;var _0x15ea7b=_0x9b5a[_0x4d43e2];return _0x15ea7b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa9b5('0x0'))(_0xa9b5('0x1'));var moment=require('moment');var BPromise=require(_0xa9b5('0x2'));var rp=require(_0xa9b5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9b5('0x4'));var config=require('../../config/environment');var attributes=require(_0xa9b5('0x5'));module[_0xa9b5('0x6')]=function(_0x8f3a3c,_0x3609b6){return _0x8f3a3c[_0xa9b5('0x7')](_0xa9b5('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xa9b5('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb006=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x11e72c,_0x5f4c30){var _0x136bb9=function(_0x428ff6){while(--_0x428ff6){_0x11e72c['push'](_0x11e72c['shift']());}};_0x136bb9(++_0x5f4c30);}(_0xb006,0x15e));var _0x6b00=function(_0x497880,_0x430dbc){_0x497880=_0x497880-0x0;var _0x1a3d4b=_0xb006[_0x497880];return _0x1a3d4b;};'use strict';var _=require(_0x6b00('0x0'));var util=require('util');var logger=require(_0x6b00('0x1'))(_0x6b00('0x2'));var moment=require(_0x6b00('0x3'));var BPromise=require(_0x6b00('0x4'));var rp=require(_0x6b00('0x5'));var fs=require('fs');var path=require(_0x6b00('0x6'));var rimraf=require(_0x6b00('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b00('0x8'));module[_0x6b00('0x9')]=function(_0x433847,_0x5a847d){return _0x433847[_0x6b00('0xa')]('ZendeskField',attributes,{'tableName':_0x6b00('0xb'),'paranoid':![],'indexes':[{'name':_0x6b00('0xc'),'fields':[_0x6b00('0xd'),'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 594aadd..1835cfe 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 _0x5641=['../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5641,0xd5));var _0x1564=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x5641[_0x24061a];return _0x82054e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1564('0x0'));var BPromise=require(_0x1564('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1564('0x2'));var db=require(_0x1564('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1564('0x4'));var config=require(_0x1564('0x5'));var jayson=require(_0x1564('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ad6ff,_0x13ab9f,_0x62aac2){return new BPromise(function(_0x40fb57,_0x547a49){return client[_0x1564('0x7')](_0x4ad6ff,_0x62aac2)['then'](function(_0x14b409){logger[_0x1564('0x8')](_0x1564('0x9'),_0x13ab9f,_0x1564('0xa'));logger[_0x1564('0xb')](_0x1564('0xc'),_0x13ab9f,_0x1564('0xa'),JSON[_0x1564('0xd')](_0x14b409));if(_0x14b409[_0x1564('0xe')]){if(_0x14b409['error'][_0x1564('0xf')]===0x1f4){logger[_0x1564('0xe')](_0x1564('0x9'),_0x13ab9f,_0x14b409[_0x1564('0xe')][_0x1564('0x10')]);return _0x547a49(_0x14b409['error'][_0x1564('0x10')]);}logger[_0x1564('0xe')](_0x1564('0x9'),_0x13ab9f,_0x14b409[_0x1564('0xe')]['message']);return _0x40fb57(_0x14b409[_0x1564('0xe')]['message']);}else{logger[_0x1564('0x8')](_0x1564('0x9'),_0x13ab9f,_0x1564('0xa'));_0x40fb57(_0x14b409['result'][_0x1564('0x10')]);}})[_0x1564('0x11')](function(_0x17119d){logger[_0x1564('0xe')]('ZendeskField,\x20%s,\x20%s',_0x13ab9f,_0x17119d);_0x547a49(_0x17119d);});});} \ No newline at end of file +var _0xbf1a=['rpc','../../config/environment','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2181dc,_0x6a8b82){var _0x2fe9a6=function(_0x56a028){while(--_0x56a028){_0x2181dc['push'](_0x2181dc['shift']());}};_0x2fe9a6(++_0x6a8b82);}(_0xbf1a,0xb0));var _0xabf1=function(_0x4bf4ab,_0x5c7185){_0x4bf4ab=_0x4bf4ab-0x0;var _0x341ceb=_0xbf1a[_0x4bf4ab];return _0x341ceb;};'use strict';var _=require(_0xabf1('0x0'));var util=require(_0xabf1('0x1'));var moment=require(_0xabf1('0x2'));var BPromise=require(_0xabf1('0x3'));var rs=require(_0xabf1('0x4'));var fs=require('fs');var Redis=require(_0xabf1('0x5'));var db=require(_0xabf1('0x6'))['db'];var utils=require(_0xabf1('0x7'));var logger=require('../../config/logger')(_0xabf1('0x8'));var config=require(_0xabf1('0x9'));var jayson=require(_0xabf1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x444fb8,_0x2b0a41,_0x2de3f2){return new BPromise(function(_0xd71cba,_0x53e192){return client[_0xabf1('0xb')](_0x444fb8,_0x2de3f2)[_0xabf1('0xc')](function(_0x3bfc8d){logger[_0xabf1('0xd')](_0xabf1('0xe'),_0x2b0a41,_0xabf1('0xf'));logger[_0xabf1('0x10')](_0xabf1('0x11'),_0x2b0a41,'request\x20sent',JSON[_0xabf1('0x12')](_0x3bfc8d));if(_0x3bfc8d[_0xabf1('0x13')]){if(_0x3bfc8d[_0xabf1('0x13')]['code']===0x1f4){logger['error'](_0xabf1('0xe'),_0x2b0a41,_0x3bfc8d['error'][_0xabf1('0x14')]);return _0x53e192(_0x3bfc8d[_0xabf1('0x13')][_0xabf1('0x14')]);}logger['error'](_0xabf1('0xe'),_0x2b0a41,_0x3bfc8d[_0xabf1('0x13')]['message']);return _0xd71cba(_0x3bfc8d[_0xabf1('0x13')]['message']);}else{logger[_0xabf1('0xd')](_0xabf1('0xe'),_0x2b0a41,'request\x20sent');_0xd71cba(_0x3bfc8d[_0xabf1('0x15')]['message']);}})[_0xabf1('0x16')](function(_0x56d4a4){logger[_0xabf1('0x13')]('ZendeskField,\x20%s,\x20%s',_0x2b0a41,_0x56d4a4);_0x53e192(_0x56d4a4);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index cf5d11b..a5b2c43 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 _0xfaa5=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','destroy','util','path'];(function(_0x3282d4,_0x337fbe){var _0x48e7b9=function(_0x1be2cc){while(--_0x1be2cc){_0x3282d4['push'](_0x3282d4['shift']());}};_0x48e7b9(++_0x337fbe);}(_0xfaa5,0x157));var _0x5faa=function(_0x46cc29,_0x473f8e){_0x46cc29=_0x46cc29-0x0;var _0x5ea06f=_0xfaa5[_0x46cc29];return _0x5ea06f;};'use strict';var multer=require('multer');var util=require(_0x5faa('0x0'));var path=require(_0x5faa('0x1'));var timeout=require(_0x5faa('0x2'));var express=require(_0x5faa('0x3'));var router=express[_0x5faa('0x4')]();var fs_extra=require(_0x5faa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5faa('0x6'));var config=require(_0x5faa('0x7'));var controller=require(_0x5faa('0x8'));router[_0x5faa('0x9')]('/',auth[_0x5faa('0xa')](),controller[_0x5faa('0xb')]);router[_0x5faa('0x9')]('/:id',auth[_0x5faa('0xa')](),controller[_0x5faa('0xc')]);router[_0x5faa('0x9')](_0x5faa('0xd'),auth[_0x5faa('0xa')](),controller[_0x5faa('0xe')]);router[_0x5faa('0x9')](_0x5faa('0xf'),auth['isAuthenticated'](),controller[_0x5faa('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5faa('0x11')]);router[_0x5faa('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5faa('0x13')]);router[_0x5faa('0x14')](_0x5faa('0x15'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5faa('0x15'),auth['isAuthenticated'](),controller[_0x5faa('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf53d=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','create','post','addConfiguration','put','update','delete','/:id','multer','util','connect-timeout','../../components/auth/service'];(function(_0x137b31,_0x3b87ca){var _0x13df5a=function(_0x5eda53){while(--_0x5eda53){_0x137b31['push'](_0x137b31['shift']());}};_0x13df5a(++_0x3b87ca);}(_0xf53d,0xb0));var _0xdf53=function(_0x48bd5f,_0x34342d){_0x48bd5f=_0x48bd5f-0x0;var _0x43465c=_0xf53d[_0x48bd5f];return _0x43465c;};'use strict';var multer=require(_0xdf53('0x0'));var util=require(_0xdf53('0x1'));var path=require('path');var timeout=require(_0xdf53('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf53('0x3'));var interaction=require(_0xdf53('0x4'));var config=require(_0xdf53('0x5'));var controller=require(_0xdf53('0x6'));router[_0xdf53('0x7')]('/',auth[_0xdf53('0x8')](),controller[_0xdf53('0x9')]);router[_0xdf53('0x7')]('/:id',auth[_0xdf53('0x8')](),controller[_0xdf53('0xa')]);router[_0xdf53('0x7')](_0xdf53('0xb'),auth[_0xdf53('0x8')](),controller['getConfigurations']);router[_0xdf53('0x7')](_0xdf53('0xc'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xdf53('0x8')](),controller[_0xdf53('0xd')]);router[_0xdf53('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xdf53('0xf')]);router[_0xdf53('0x10')]('/:id',auth[_0xdf53('0x8')](),controller[_0xdf53('0x11')]);router[_0xdf53('0x12')](_0xdf53('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 691e846..5b06c15 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 _0x41bb=['exports','STRING','sequelize'];(function(_0x3d61c6,_0x4571e6){var _0x47e0df=function(_0x25adfd){while(--_0x25adfd){_0x3d61c6['push'](_0x3d61c6['shift']());}};_0x47e0df(++_0x4571e6);}(_0x41bb,0xc5));var _0xb41b=function(_0x17b773,_0x4217cf){_0x17b773=_0x17b773-0x0;var _0x35fd6e=_0x41bb[_0x17b773];return _0x35fd6e;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb41b('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xb41b('0x2')]},'clientId':{'type':Sequelize[_0xb41b('0x2')]},'clientSecret':{'type':Sequelize[_0xb41b('0x2')]},'serverUrl':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb41b('0x2')]}}; \ No newline at end of file +var _0x54ef=['STRING','sequelize','exports'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0x54ef,0x112));var _0xf54e=function(_0x399908,_0x43268b){_0x399908=_0x399908-0x0;var _0x50527b=_0x54ef[_0x399908];return _0x50527b;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'name':{'type':Sequelize[_0xf54e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf54e('0x2')]},'zone':{'type':Sequelize[_0xf54e('0x2')]},'clientId':{'type':Sequelize[_0xf54e('0x2')]},'clientSecret':{'type':Sequelize[_0xf54e('0x2')]},'serverUrl':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf54e('0x2')]},'refreshToken':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5be0b57..2d46d84 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 _0x0220=['pick','filter','merge','options','includeAll','findAll','rows','show','length','include','find','catch','create','body','params','findOne','ZohoConfiguration','order','sort','getConfigurations','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Subjects','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','refreshToken','zoho.eu','slice','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','update','then','destroy','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','where','filters'];(function(_0x30f7ef,_0x3ec7e0){var _0x595f63=function(_0x189027){while(--_0x189027){_0x30f7ef['push'](_0x30f7ef['shift']());}};_0x595f63(++_0x3ec7e0);}(_0x0220,0xc8));var _0x0022=function(_0x451980,_0x2ad060){_0x451980=_0x451980-0x0;var _0x3a66cf=_0x0220[_0x451980];return _0x3a66cf;};'use strict';var emlformat=require(_0x0022('0x0'));var rimraf=require(_0x0022('0x1'));var zipdir=require(_0x0022('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0022('0x3'));var moment=require(_0x0022('0x4'));var BPromise=require(_0x0022('0x5'));var Mustache=require(_0x0022('0x6'));var util=require('util');var path=require(_0x0022('0x7'));var sox=require('sox');var csv=require(_0x0022('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0022('0x9'));var _=require('lodash');var squel=require(_0x0022('0xa'));var crypto=require(_0x0022('0xb'));var jsforce=require(_0x0022('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0022('0x8'));var querystring=require(_0x0022('0xd'));var Papa=require(_0x0022('0xe'));var Redis=require('ioredis');var authService=require(_0x0022('0xf'));var qs=require(_0x0022('0x10'));var as=require(_0x0022('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0022('0x12'));var utils=require(_0x0022('0x13'));var config=require(_0x0022('0x14'));var licenseUtil=require(_0x0022('0x15'));var db=require(_0x0022('0x16'))['db'];var integrations=require(_0x0022('0x17'));function respondWithStatusCode(_0x1f0d22,_0xc015e5){_0xc015e5=_0xc015e5||0xcc;return function(_0x18ce9d){if(_0x18ce9d){return _0x1f0d22[_0x0022('0x18')](_0xc015e5);}return _0x1f0d22['status'](_0xc015e5)[_0x0022('0x19')]();};}function respondWithResult(_0xa2bc79,_0x41cccb){_0x41cccb=_0x41cccb||0xc8;return function(_0x2b4d7f){if(_0x2b4d7f){return _0xa2bc79[_0x0022('0x1a')](_0x41cccb)[_0x0022('0x1b')](_0x2b4d7f);}};}function respondWithFilteredResult(_0x34fe07,_0xcf98fd){return function(_0x2c5720){if(_0x2c5720){var _0x283a7b=typeof _0xcf98fd['offset']===_0x0022('0x1c')&&typeof _0xcf98fd[_0x0022('0x1d')]===_0x0022('0x1c');var _0x35fcc5=_0x2c5720[_0x0022('0x1e')];var _0x3c9dea=_0x283a7b?0x0:_0xcf98fd[_0x0022('0x1f')];var _0x20bc7d=_0x283a7b?_0x2c5720['count']:_0xcf98fd['offset']+_0xcf98fd[_0x0022('0x1d')];var _0x141c77;if(_0x20bc7d>=_0x35fcc5){_0x20bc7d=_0x35fcc5;_0x141c77=0xc8;}else{_0x141c77=0xce;}_0x34fe07[_0x0022('0x1a')](_0x141c77);return _0x34fe07[_0x0022('0x20')]('Content-Range',_0x3c9dea+'-'+_0x20bc7d+'/'+_0x35fcc5)[_0x0022('0x1b')](_0x2c5720);}return null;};}function patchUpdates(_0x4e1524){return function(_0x2884ac){try{jsonpatch['apply'](_0x2884ac,_0x4e1524,!![]);}catch(_0x476f00){return BPromise[_0x0022('0x21')](_0x476f00);}return _0x2884ac['save']();};}function saveUpdates(_0x489b5f,_0x27ac18){return function(_0x51d079){if(_0x51d079){return _0x51d079[_0x0022('0x22')](_0x489b5f)[_0x0022('0x23')](function(_0x37738f){return _0x37738f;});}return null;};}function removeEntity(_0x2a4298,_0x1d4f2c){return function(_0xc0ca9e){if(_0xc0ca9e){return _0xc0ca9e[_0x0022('0x24')]()['then'](function(){_0x2a4298['status'](0xcc)[_0x0022('0x19')]();});}};}function handleEntityNotFound(_0x86160e,_0x17c10e){return function(_0x138be4){if(!_0x138be4){_0x86160e[_0x0022('0x18')](0x194);}return _0x138be4;};}function handleError(_0x99cc12,_0x91112e){_0x91112e=_0x91112e||0x1f4;return function(_0x3a8940){logger[_0x0022('0x25')](_0x3a8940[_0x0022('0x26')]);if(_0x3a8940[_0x0022('0x27')]){delete _0x3a8940[_0x0022('0x27')];}_0x99cc12[_0x0022('0x1a')](_0x91112e)['send'](_0x3a8940);};}exports[_0x0022('0x28')]=function(_0x224021,_0x4b9e61){var _0x577091={},_0x461140={},_0x433371={'count':0x0,'rows':[]};var _0x50e9bd=_[_0x0022('0x29')](db[_0x0022('0x2a')][_0x0022('0x2b')],function(_0x1c6051){return{'name':_0x1c6051[_0x0022('0x2c')],'type':_0x1c6051[_0x0022('0x2d')][_0x0022('0x2e')]};});_0x461140['model']=_[_0x0022('0x29')](_0x50e9bd,_0x0022('0x27'));_0x461140[_0x0022('0x2f')]=_[_0x0022('0x30')](_0x224021[_0x0022('0x2f')]);_0x461140['filters']=_[_0x0022('0x31')](_0x461140[_0x0022('0x32')],_0x461140['query']);_0x577091[_0x0022('0x33')]=_[_0x0022('0x31')](_0x461140['model'],qs[_0x0022('0x34')](_0x224021['query'][_0x0022('0x34')]));_0x577091[_0x0022('0x33')]=_0x577091[_0x0022('0x33')]['length']?_0x577091['attributes']:_0x461140[_0x0022('0x32')];if(!_0x224021[_0x0022('0x2f')][_0x0022('0x35')]('nolimit')){_0x577091[_0x0022('0x1d')]=qs[_0x0022('0x1d')](_0x224021[_0x0022('0x2f')][_0x0022('0x1d')]);_0x577091[_0x0022('0x1f')]=qs[_0x0022('0x1f')](_0x224021[_0x0022('0x2f')]['offset']);}_0x577091['order']=qs['sort'](_0x224021[_0x0022('0x2f')]['sort']);_0x577091[_0x0022('0x36')]=qs[_0x0022('0x37')](_[_0x0022('0x38')](_0x224021['query'],_0x461140['filters']),_0x50e9bd);if(_0x224021[_0x0022('0x2f')][_0x0022('0x39')]){_0x577091[_0x0022('0x36')]=_[_0x0022('0x3a')](_0x577091[_0x0022('0x36')],{'$or':_[_0x0022('0x29')](_0x50e9bd,function(_0x5bfa7e){if(_0x5bfa7e[_0x0022('0x2d')]!=='VIRTUAL'){var _0x3a1f22={};_0x3a1f22[_0x5bfa7e[_0x0022('0x27')]]={'$like':'%'+_0x224021['query'][_0x0022('0x39')]+'%'};return _0x3a1f22;}})});}_0x577091=_[_0x0022('0x3a')]({},_0x577091,_0x224021[_0x0022('0x3b')]);var _0x52aa15={'where':_0x577091['where']};return db[_0x0022('0x2a')]['count'](_0x52aa15)[_0x0022('0x23')](function(_0x6209f8){_0x433371['count']=_0x6209f8;if(_0x224021[_0x0022('0x2f')][_0x0022('0x3c')]){_0x577091['include']=[{'all':!![]}];}return db[_0x0022('0x2a')][_0x0022('0x3d')](_0x577091);})[_0x0022('0x23')](function(_0x274600){_0x433371[_0x0022('0x3e')]=_0x274600;return _0x433371;})[_0x0022('0x23')](respondWithFilteredResult(_0x4b9e61,_0x577091))['catch'](handleError(_0x4b9e61,null));};exports[_0x0022('0x3f')]=function(_0x3c3bd7,_0x42a480){var _0x4ca2c6={'raw':![],'where':{'id':_0x3c3bd7['params']['id']}},_0x2d7f74={};_0x2d7f74['model']=_[_0x0022('0x30')](db[_0x0022('0x2a')][_0x0022('0x2b')]);_0x2d7f74[_0x0022('0x2f')]=_['keys'](_0x3c3bd7[_0x0022('0x2f')]);_0x2d7f74[_0x0022('0x37')]=_[_0x0022('0x31')](_0x2d7f74['model'],_0x2d7f74['query']);_0x4ca2c6['attributes']=_[_0x0022('0x31')](_0x2d7f74[_0x0022('0x32')],qs[_0x0022('0x34')](_0x3c3bd7['query']['fields']));_0x4ca2c6['attributes']=_0x4ca2c6[_0x0022('0x33')][_0x0022('0x40')]?_0x4ca2c6[_0x0022('0x33')]:_0x2d7f74['model'];if(_0x3c3bd7[_0x0022('0x2f')][_0x0022('0x3c')]){_0x4ca2c6[_0x0022('0x41')]=[{'all':!![]}];}_0x4ca2c6=_[_0x0022('0x3a')]({},_0x4ca2c6,_0x3c3bd7[_0x0022('0x3b')]);return db[_0x0022('0x2a')][_0x0022('0x42')](_0x4ca2c6)['then'](handleEntityNotFound(_0x42a480,null))[_0x0022('0x23')](respondWithResult(_0x42a480,null))[_0x0022('0x43')](handleError(_0x42a480,null));};exports['create']=function(_0x3a4479,_0x480601){return db[_0x0022('0x2a')][_0x0022('0x44')](_0x3a4479[_0x0022('0x45')],{})[_0x0022('0x23')](respondWithResult(_0x480601,0xc9))[_0x0022('0x43')](handleError(_0x480601,null));};exports[_0x0022('0x22')]=function(_0x22b4c2,_0x304982){if(_0x22b4c2[_0x0022('0x45')]['id']){delete _0x22b4c2[_0x0022('0x45')]['id'];}return db[_0x0022('0x2a')]['find']({'where':{'id':_0x22b4c2['params']['id']}})[_0x0022('0x23')](handleEntityNotFound(_0x304982,null))[_0x0022('0x23')](saveUpdates(_0x22b4c2['body'],null))['then'](respondWithResult(_0x304982,null))[_0x0022('0x43')](handleError(_0x304982,null));};exports[_0x0022('0x24')]=function(_0x2e1323,_0x43751f){return db[_0x0022('0x2a')][_0x0022('0x42')]({'where':{'id':_0x2e1323[_0x0022('0x46')]['id']}})[_0x0022('0x23')](handleEntityNotFound(_0x43751f,null))[_0x0022('0x23')](removeEntity(_0x43751f,null))[_0x0022('0x43')](handleError(_0x43751f,null));};exports['getConfigurations']=function(_0x3935fb,_0x1cd03b,_0x5d2d9a){var _0x187e63={};var _0x44539a={};var _0x46a1f3;var _0xe078b6;return db[_0x0022('0x2a')][_0x0022('0x47')]({'where':{'id':_0x3935fb[_0x0022('0x46')]['id']}})[_0x0022('0x23')](handleEntityNotFound(_0x1cd03b,null))[_0x0022('0x23')](function(_0x1235fe){if(_0x1235fe){_0x46a1f3=_0x1235fe;_0x44539a[_0x0022('0x32')]=_[_0x0022('0x30')](db[_0x0022('0x48')][_0x0022('0x2b')]);_0x44539a[_0x0022('0x2f')]=_[_0x0022('0x30')](_0x3935fb[_0x0022('0x2f')]);_0x44539a['filters']=_[_0x0022('0x31')](_0x44539a[_0x0022('0x32')],_0x44539a[_0x0022('0x2f')]);_0x187e63['attributes']=_[_0x0022('0x31')](_0x44539a['model'],qs['fields'](_0x3935fb['query']['fields']));_0x187e63[_0x0022('0x33')]=_0x187e63['attributes'][_0x0022('0x40')]?_0x187e63[_0x0022('0x33')]:_0x44539a[_0x0022('0x32')];_0x187e63[_0x0022('0x49')]=qs[_0x0022('0x4a')](_0x3935fb[_0x0022('0x2f')]['sort']);_0x187e63[_0x0022('0x36')]=qs['filters'](_[_0x0022('0x38')](_0x3935fb[_0x0022('0x2f')],_0x44539a['filters']));if(_0x3935fb[_0x0022('0x2f')][_0x0022('0x39')]){_0x187e63[_0x0022('0x36')]=_[_0x0022('0x3a')](_0x187e63['where'],{'$or':_[_0x0022('0x29')](_0x187e63[_0x0022('0x33')],function(_0x3ff050){var _0x3f392f={};_0x3f392f[_0x3ff050]={'$like':'%'+_0x3935fb['query'][_0x0022('0x39')]+'%'};return _0x3f392f;})});}_0x187e63=_['merge']({},_0x187e63,_0x3935fb[_0x0022('0x3b')]);return _0x46a1f3[_0x0022('0x4b')](_0x187e63);}})[_0x0022('0x23')](function(_0x447323){if(_0x447323){_0xe078b6=_0x447323['length'];if(!_0x3935fb[_0x0022('0x2f')][_0x0022('0x35')]('nolimit')){_0x187e63[_0x0022('0x1d')]=qs[_0x0022('0x1d')](_0x3935fb['query'][_0x0022('0x1d')]);_0x187e63['offset']=qs[_0x0022('0x1f')](_0x3935fb['query'][_0x0022('0x1f')]);}return _0x46a1f3[_0x0022('0x4b')](_0x187e63);}})[_0x0022('0x23')](function(_0x1c7e76){if(_0x1c7e76){return _0x1c7e76?{'count':_0xe078b6,'rows':_0x1c7e76}:null;}})['then'](respondWithResult(_0x1cd03b,null))['catch'](handleError(_0x1cd03b,null));};exports[_0x0022('0x4c')]=function(_0x57f8f9,_0x5e8a30,_0x4fd7a9){if(_0x57f8f9[_0x0022('0x45')]['id']){delete _0x57f8f9[_0x0022('0x45')]['id'];}return db[_0x0022('0x2a')][_0x0022('0x47')]({'where':{'id':_0x57f8f9[_0x0022('0x46')]['id']}})[_0x0022('0x23')](handleEntityNotFound(_0x5e8a30,null))[_0x0022('0x23')](function(_0x2ca54c){if(_0x2ca54c){_0x57f8f9[_0x0022('0x45')][_0x0022('0x4d')]=_0x2ca54c['id'];_0x57f8f9['body']['Subjects']=integrations['getSubjects'](_0x57f8f9[_0x0022('0x45')][_0x0022('0x4e')],_0x57f8f9['body'][_0x0022('0x2d')]);_0x57f8f9[_0x0022('0x45')][_0x0022('0x4f')]=integrations[_0x0022('0x50')](_0x57f8f9['body'][_0x0022('0x4e')],_0x57f8f9[_0x0022('0x45')]['type']);return db[_0x0022('0x48')][_0x0022('0x44')](_0x57f8f9[_0x0022('0x45')],{'include':[{'model':db['ZohoField'],'as':_0x0022('0x51')},{'model':db[_0x0022('0x52')],'as':_0x0022('0x4f')}]});}return null;})[_0x0022('0x23')](respondWithResult(_0x5e8a30,null))[_0x0022('0x43')](handleError(_0x5e8a30,null));};function getAccessToken(_0x23f07b){return new Promise(function(_0xe9986,_0x11862f){var _0x3917bd;switch(_0x23f07b['zone']){case'US':_0x3917bd='https://accounts.zoho.com';break;case'AU':_0x3917bd=_0x0022('0x53');break;case'EU':_0x3917bd=_0x0022('0x54');break;case'IN':_0x3917bd=_0x0022('0x55');break;case'CN':_0x3917bd='https://accounts.zoho.com.cn';break;default:_0x3917bd=_0x0022('0x54');break;}var _0x2e17ac={'method':'POST','uri':_0x3917bd+_0x0022('0x56'),'qs':{'refresh_token':_0x23f07b['refreshToken'],'client_id':_0x23f07b[_0x0022('0x57')],'client_secret':_0x23f07b[_0x0022('0x58')],'grant_type':_0x0022('0x59')},'json':!![]};return rp(_0x2e17ac)[_0x0022('0x23')](function(_0x72ef2){if(_0x72ef2['access_token']){_0xe9986(_0x72ef2[_0x0022('0x5a')]);}else{_0x11862f(_0x0022('0x5b'));}})[_0x0022('0x43')](function(_0x17966f){_0x11862f(_0x17966f);});});}exports[_0x0022('0x5c')]=function(_0x7fe157,_0x1e687a,_0x2576cf){var _0x284005,_0x155c9a,_0x487a24,_0x1776e3,_0xe1bbf9;return db[_0x0022('0x2a')]['findOne']({'where':{'id':_0x7fe157[_0x0022('0x46')]['id']},'attributes':['id',_0x0022('0x5d'),_0x0022('0x5e'),_0x0022('0x57'),_0x0022('0x58'),_0x0022('0x5f'),_0x0022('0x60'),_0x0022('0x61')]})[_0x0022('0x23')](handleEntityNotFound(_0x1e687a,null))[_0x0022('0x23')](function(_0x4d3153){_0xe1bbf9=_0x4d3153;_0x284005=_0xe1bbf9[_0x0022('0x5d')];_0x155c9a=_0x284005===_0x0022('0x62')?'eu':'com';_0x487a24=_0xe1bbf9[_0x0022('0x5f')];var _0x1456f0=_0x487a24[_0x0022('0x63')](-0x1);if(_0x1456f0==='/'||_0x1456f0==='\x5c'||_0x1456f0===':'){_0x487a24=_0x487a24['substring'](0x0,_0x487a24[_0x0022('0x64')](_0x1456f0));}if(!_0xe1bbf9[_0x0022('0x61')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0xe1bbf9);})[_0x0022('0x23')](function(_0x49cff9){if(_0x49cff9){return rp({'method':_0x0022('0x65'),'uri':util[_0x0022('0x66')](_0x0022('0x67'),_0x155c9a),'qs':{'module':_0x0022('0x68')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x49cff9},'json':!![]});}})[_0x0022('0x23')](function(_0x3a85a4){if(_0x3a85a4){if(_0x3a85a4[_0x0022('0x69')]&&_0x3a85a4[_0x0022('0x69')]['error']){throw new Error(_0x3a85a4[_0x0022('0x69')][_0x0022('0x25')][_0x0022('0x6a')]);}var _0x82c745=[];var _0x55746f=[];var _0x2363e3=[_0x0022('0x6b'),'Subject',_0x0022('0x6c'),_0x0022('0x6d'),_0x0022('0x6e'),_0x0022('0x6f'),'Call_Start_Time',_0x0022('0x70')];_0x55746f=_[_0x0022('0x71')](_0x3a85a4[_0x0022('0x34')],function(_0x2bed84){return _0x2363e3[_0x0022('0x72')](_0x2bed84['api_name']);});for(var _0x50277a=0x0;_0x50277a<_0x55746f[_0x0022('0x40')];_0x50277a++){if(_0x55746f[_0x50277a][_0x0022('0x73')]===![]){_0x82c745[_0x0022('0x74')]({'id':_0x55746f[_0x50277a]['id'],'name':_0x55746f[_0x50277a][_0x0022('0x75')],'custom':_0x55746f[_0x50277a][_0x0022('0x76')],'options':_0x55746f[_0x50277a][_0x0022('0x77')]===_0x0022('0x78')&&_0x55746f[_0x50277a][_0x0022('0x79')][_0x0022('0x40')]>-0x1?_['map'](_0x55746f[_0x50277a][_0x0022('0x79')],function(_0x305e04){return{'name':_0x305e04,'value':_0x305e04};}):[]});}}return{'count':_0x82c745['length'],'rows':_0x82c745};}else{return{'count':0x0,'rows':[]};}})[_0x0022('0x23')](respondWithResult(_0x1e687a,null))[_0x0022('0x43')](function(_0x39ba96){var _0x18d91b=_0x7fe157[_0x0022('0x2f')]['test']?0x1f4:_0x39ba96[_0x0022('0x7a')]||0x1f4;logger['error'](_0x0022('0x7b'),_0x0022('0x5c'),_0x18d91b,JSON[_0x0022('0x7c')](_0x39ba96));delete _0x39ba96['name'];if(_0x18d91b===0x191){_0x18d91b=0x190;}_0x1e687a['status'](_0x18d91b)[_0x0022('0x7d')](_0x7fe157['query'][_0x0022('0x7e')]?{'message':_0x0022('0x7f'),'statusCode':_0x39ba96[_0x0022('0x7a')]}:_0x39ba96);});}; \ No newline at end of file +var _0x9d23=['path','sox','to-csv','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','../../components/integrations/configuration','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','stack','name','send','map','ZohoAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','update','find','destroy','getConfigurations','findOne','ZohoConfiguration','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','error','Subject','Description','WhoId','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x33baaf,_0x90e373){var _0x433848=function(_0x480393){while(--_0x480393){_0x33baaf['push'](_0x33baaf['shift']());}};_0x433848(++_0x90e373);}(_0x9d23,0xf9));var _0x39d2=function(_0x44fff2,_0x3fc5b3){_0x44fff2=_0x44fff2-0x0;var _0x4829fa=_0x9d23[_0x44fff2];return _0x4829fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x39d2('0x0'));var jsonpatch=require(_0x39d2('0x1'));var rp=require('request-promise');var moment=require(_0x39d2('0x2'));var BPromise=require(_0x39d2('0x3'));var Mustache=require('mustache');var util=require(_0x39d2('0x4'));var path=require(_0x39d2('0x5'));var sox=require(_0x39d2('0x6'));var csv=require(_0x39d2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x39d2('0x8'));var crypto=require(_0x39d2('0x9'));var jsforce=require(_0x39d2('0xa'));var deskjs=require(_0x39d2('0xb'));var toCsv=require('to-csv');var querystring=require(_0x39d2('0xc'));var Papa=require('papaparse');var Redis=require(_0x39d2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x39d2('0xe'));var as=require(_0x39d2('0xf'));var hardwareService=require(_0x39d2('0x10'));var logger=require(_0x39d2('0x11'))(_0x39d2('0x12'));var utils=require(_0x39d2('0x13'));var config=require(_0x39d2('0x14'));var licenseUtil=require(_0x39d2('0x15'));var db=require(_0x39d2('0x16'))['db'];var integrations=require(_0x39d2('0x17'));function respondWithStatusCode(_0x198262,_0x275c31){_0x275c31=_0x275c31||0xcc;return function(_0xb3fbed){if(_0xb3fbed){return _0x198262['sendStatus'](_0x275c31);}return _0x198262[_0x39d2('0x18')](_0x275c31)[_0x39d2('0x19')]();};}function respondWithResult(_0x328fe8,_0x283e98){_0x283e98=_0x283e98||0xc8;return function(_0x21ecb5){if(_0x21ecb5){return _0x328fe8[_0x39d2('0x18')](_0x283e98)[_0x39d2('0x1a')](_0x21ecb5);}};}function respondWithFilteredResult(_0x46a7f5,_0x4b0bad){return function(_0x492a43){if(_0x492a43){var _0x423298=typeof _0x4b0bad['offset']===_0x39d2('0x1b')&&typeof _0x4b0bad['limit']===_0x39d2('0x1b');var _0x7433e=_0x492a43[_0x39d2('0x1c')];var _0x276553=_0x423298?0x0:_0x4b0bad[_0x39d2('0x1d')];var _0x1231b9=_0x423298?_0x492a43['count']:_0x4b0bad['offset']+_0x4b0bad[_0x39d2('0x1e')];var _0x8f1ed0;if(_0x1231b9>=_0x7433e){_0x1231b9=_0x7433e;_0x8f1ed0=0xc8;}else{_0x8f1ed0=0xce;}_0x46a7f5[_0x39d2('0x18')](_0x8f1ed0);return _0x46a7f5['set'](_0x39d2('0x1f'),_0x276553+'-'+_0x1231b9+'/'+_0x7433e)[_0x39d2('0x1a')](_0x492a43);}return null;};}function patchUpdates(_0x3003a3){return function(_0x2ffd93){try{jsonpatch[_0x39d2('0x20')](_0x2ffd93,_0x3003a3,!![]);}catch(_0x5caef7){return BPromise[_0x39d2('0x21')](_0x5caef7);}return _0x2ffd93[_0x39d2('0x22')]();};}function saveUpdates(_0x47cd85,_0x46ec61){return function(_0x254768){if(_0x254768){return _0x254768['update'](_0x47cd85)[_0x39d2('0x23')](function(_0x1666af){return _0x1666af;});}return null;};}function removeEntity(_0x56d4ee,_0x43ebc2){return function(_0x15e95a){if(_0x15e95a){return _0x15e95a['destroy']()[_0x39d2('0x23')](function(){_0x56d4ee[_0x39d2('0x18')](0xcc)[_0x39d2('0x19')]();});}};}function handleEntityNotFound(_0x2e4270,_0x1ae3a1){return function(_0x132a63){if(!_0x132a63){_0x2e4270['sendStatus'](0x194);}return _0x132a63;};}function handleError(_0x51a6f9,_0x1c0920){_0x1c0920=_0x1c0920||0x1f4;return function(_0x5ad831){logger['error'](_0x5ad831[_0x39d2('0x24')]);if(_0x5ad831['name']){delete _0x5ad831[_0x39d2('0x25')];}_0x51a6f9['status'](_0x1c0920)[_0x39d2('0x26')](_0x5ad831);};}exports['index']=function(_0x7eebee,_0x19a8fa){var _0xf0b28f={},_0x3a764c={},_0x36d9df={'count':0x0,'rows':[]};var _0x250845=_[_0x39d2('0x27')](db[_0x39d2('0x28')][_0x39d2('0x29')],function(_0x1f8090){return{'name':_0x1f8090['fieldName'],'type':_0x1f8090[_0x39d2('0x2a')][_0x39d2('0x2b')]};});_0x3a764c[_0x39d2('0x2c')]=_[_0x39d2('0x27')](_0x250845,_0x39d2('0x25'));_0x3a764c['query']=_[_0x39d2('0x2d')](_0x7eebee[_0x39d2('0x2e')]);_0x3a764c[_0x39d2('0x2f')]=_[_0x39d2('0x30')](_0x3a764c[_0x39d2('0x2c')],_0x3a764c['query']);_0xf0b28f[_0x39d2('0x31')]=_[_0x39d2('0x30')](_0x3a764c['model'],qs[_0x39d2('0x32')](_0x7eebee['query'][_0x39d2('0x32')]));_0xf0b28f[_0x39d2('0x31')]=_0xf0b28f[_0x39d2('0x31')]['length']?_0xf0b28f[_0x39d2('0x31')]:_0x3a764c[_0x39d2('0x2c')];if(!_0x7eebee['query'][_0x39d2('0x33')]('nolimit')){_0xf0b28f[_0x39d2('0x1e')]=qs[_0x39d2('0x1e')](_0x7eebee['query'][_0x39d2('0x1e')]);_0xf0b28f[_0x39d2('0x1d')]=qs[_0x39d2('0x1d')](_0x7eebee[_0x39d2('0x2e')][_0x39d2('0x1d')]);}_0xf0b28f[_0x39d2('0x34')]=qs['sort'](_0x7eebee[_0x39d2('0x2e')][_0x39d2('0x35')]);_0xf0b28f[_0x39d2('0x36')]=qs[_0x39d2('0x2f')](_['pick'](_0x7eebee[_0x39d2('0x2e')],_0x3a764c[_0x39d2('0x2f')]),_0x250845);if(_0x7eebee['query'][_0x39d2('0x37')]){_0xf0b28f['where']=_['merge'](_0xf0b28f['where'],{'$or':_[_0x39d2('0x27')](_0x250845,function(_0xaa7f93){if(_0xaa7f93['type']!==_0x39d2('0x38')){var _0x272c57={};_0x272c57[_0xaa7f93[_0x39d2('0x25')]]={'$like':'%'+_0x7eebee[_0x39d2('0x2e')]['filter']+'%'};return _0x272c57;}})});}_0xf0b28f=_[_0x39d2('0x39')]({},_0xf0b28f,_0x7eebee[_0x39d2('0x3a')]);var _0x40d558={'where':_0xf0b28f[_0x39d2('0x36')]};return db[_0x39d2('0x28')]['count'](_0x40d558)[_0x39d2('0x23')](function(_0x83ab0){_0x36d9df[_0x39d2('0x1c')]=_0x83ab0;if(_0x7eebee[_0x39d2('0x2e')][_0x39d2('0x3b')]){_0xf0b28f['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x39d2('0x3c')](_0xf0b28f);})[_0x39d2('0x23')](function(_0x1fe5bd){_0x36d9df[_0x39d2('0x3d')]=_0x1fe5bd;return _0x36d9df;})['then'](respondWithFilteredResult(_0x19a8fa,_0xf0b28f))[_0x39d2('0x3e')](handleError(_0x19a8fa,null));};exports[_0x39d2('0x3f')]=function(_0x428fb7,_0x35fe21){var _0x3f1bf5={'raw':![],'where':{'id':_0x428fb7[_0x39d2('0x40')]['id']}},_0x2268fa={};_0x2268fa[_0x39d2('0x2c')]=_[_0x39d2('0x2d')](db[_0x39d2('0x28')]['rawAttributes']);_0x2268fa[_0x39d2('0x2e')]=_['keys'](_0x428fb7[_0x39d2('0x2e')]);_0x2268fa[_0x39d2('0x2f')]=_['intersection'](_0x2268fa[_0x39d2('0x2c')],_0x2268fa[_0x39d2('0x2e')]);_0x3f1bf5['attributes']=_[_0x39d2('0x30')](_0x2268fa[_0x39d2('0x2c')],qs[_0x39d2('0x32')](_0x428fb7[_0x39d2('0x2e')][_0x39d2('0x32')]));_0x3f1bf5['attributes']=_0x3f1bf5[_0x39d2('0x31')][_0x39d2('0x41')]?_0x3f1bf5[_0x39d2('0x31')]:_0x2268fa[_0x39d2('0x2c')];if(_0x428fb7['query']['includeAll']){_0x3f1bf5[_0x39d2('0x42')]=[{'all':!![]}];}_0x3f1bf5=_['merge']({},_0x3f1bf5,_0x428fb7[_0x39d2('0x3a')]);return db[_0x39d2('0x28')]['find'](_0x3f1bf5)[_0x39d2('0x23')](handleEntityNotFound(_0x35fe21,null))[_0x39d2('0x23')](respondWithResult(_0x35fe21,null))[_0x39d2('0x3e')](handleError(_0x35fe21,null));};exports[_0x39d2('0x43')]=function(_0x40bad9,_0x32d66c){return db[_0x39d2('0x28')][_0x39d2('0x43')](_0x40bad9[_0x39d2('0x44')],{})[_0x39d2('0x23')](respondWithResult(_0x32d66c,0xc9))[_0x39d2('0x3e')](handleError(_0x32d66c,null));};exports[_0x39d2('0x45')]=function(_0x27830a,_0x5a4deb){if(_0x27830a[_0x39d2('0x44')]['id']){delete _0x27830a[_0x39d2('0x44')]['id'];}return db[_0x39d2('0x28')][_0x39d2('0x46')]({'where':{'id':_0x27830a[_0x39d2('0x40')]['id']}})[_0x39d2('0x23')](handleEntityNotFound(_0x5a4deb,null))[_0x39d2('0x23')](saveUpdates(_0x27830a[_0x39d2('0x44')],null))['then'](respondWithResult(_0x5a4deb,null))[_0x39d2('0x3e')](handleError(_0x5a4deb,null));};exports[_0x39d2('0x47')]=function(_0x46bbfd,_0x13251a){return db[_0x39d2('0x28')][_0x39d2('0x46')]({'where':{'id':_0x46bbfd[_0x39d2('0x40')]['id']}})[_0x39d2('0x23')](handleEntityNotFound(_0x13251a,null))[_0x39d2('0x23')](removeEntity(_0x13251a,null))['catch'](handleError(_0x13251a,null));};exports[_0x39d2('0x48')]=function(_0x874652,_0x4b9669,_0x1df2bf){var _0x360baa={};var _0x5b8dfc={};var _0x3e7503;var _0xe2cd7b;return db[_0x39d2('0x28')][_0x39d2('0x49')]({'where':{'id':_0x874652[_0x39d2('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b9669,null))[_0x39d2('0x23')](function(_0x5e24aa){if(_0x5e24aa){_0x3e7503=_0x5e24aa;_0x5b8dfc[_0x39d2('0x2c')]=_[_0x39d2('0x2d')](db[_0x39d2('0x4a')][_0x39d2('0x29')]);_0x5b8dfc[_0x39d2('0x2e')]=_[_0x39d2('0x2d')](_0x874652[_0x39d2('0x2e')]);_0x5b8dfc[_0x39d2('0x2f')]=_[_0x39d2('0x30')](_0x5b8dfc['model'],_0x5b8dfc[_0x39d2('0x2e')]);_0x360baa[_0x39d2('0x31')]=_[_0x39d2('0x30')](_0x5b8dfc[_0x39d2('0x2c')],qs[_0x39d2('0x32')](_0x874652['query'][_0x39d2('0x32')]));_0x360baa[_0x39d2('0x31')]=_0x360baa[_0x39d2('0x31')]['length']?_0x360baa[_0x39d2('0x31')]:_0x5b8dfc[_0x39d2('0x2c')];_0x360baa['order']=qs[_0x39d2('0x35')](_0x874652['query'][_0x39d2('0x35')]);_0x360baa[_0x39d2('0x36')]=qs[_0x39d2('0x2f')](_['pick'](_0x874652[_0x39d2('0x2e')],_0x5b8dfc['filters']));if(_0x874652[_0x39d2('0x2e')][_0x39d2('0x37')]){_0x360baa[_0x39d2('0x36')]=_[_0x39d2('0x39')](_0x360baa[_0x39d2('0x36')],{'$or':_[_0x39d2('0x27')](_0x360baa['attributes'],function(_0xa907bc){var _0x3c6487={};_0x3c6487[_0xa907bc]={'$like':'%'+_0x874652[_0x39d2('0x2e')][_0x39d2('0x37')]+'%'};return _0x3c6487;})});}_0x360baa=_['merge']({},_0x360baa,_0x874652[_0x39d2('0x3a')]);return _0x3e7503['getConfigurations'](_0x360baa);}})['then'](function(_0x3f014a){if(_0x3f014a){_0xe2cd7b=_0x3f014a[_0x39d2('0x41')];if(!_0x874652['query'][_0x39d2('0x33')](_0x39d2('0x4b'))){_0x360baa[_0x39d2('0x1e')]=qs[_0x39d2('0x1e')](_0x874652[_0x39d2('0x2e')][_0x39d2('0x1e')]);_0x360baa[_0x39d2('0x1d')]=qs[_0x39d2('0x1d')](_0x874652[_0x39d2('0x2e')]['offset']);}return _0x3e7503[_0x39d2('0x48')](_0x360baa);}})[_0x39d2('0x23')](function(_0x20db17){if(_0x20db17){return _0x20db17?{'count':_0xe2cd7b,'rows':_0x20db17}:null;}})[_0x39d2('0x23')](respondWithResult(_0x4b9669,null))[_0x39d2('0x3e')](handleError(_0x4b9669,null));};exports['addConfiguration']=function(_0x403f49,_0x3012b9,_0x4df3d7){if(_0x403f49['body']['id']){delete _0x403f49[_0x39d2('0x44')]['id'];}return db['ZohoAccount'][_0x39d2('0x49')]({'where':{'id':_0x403f49[_0x39d2('0x40')]['id']}})[_0x39d2('0x23')](handleEntityNotFound(_0x3012b9,null))[_0x39d2('0x23')](function(_0x219b2f){if(_0x219b2f){_0x403f49[_0x39d2('0x44')][_0x39d2('0x4c')]=_0x219b2f['id'];_0x403f49['body'][_0x39d2('0x4d')]=integrations[_0x39d2('0x4e')](_0x403f49[_0x39d2('0x44')][_0x39d2('0x4f')],_0x403f49['body'][_0x39d2('0x2a')]);_0x403f49[_0x39d2('0x44')][_0x39d2('0x50')]=integrations[_0x39d2('0x51')](_0x403f49['body'][_0x39d2('0x4f')],_0x403f49[_0x39d2('0x44')][_0x39d2('0x2a')]);return db[_0x39d2('0x4a')]['create'](_0x403f49[_0x39d2('0x44')],{'include':[{'model':db[_0x39d2('0x52')],'as':_0x39d2('0x4d')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x39d2('0x23')](respondWithResult(_0x3012b9,null))[_0x39d2('0x3e')](handleError(_0x3012b9,null));};function getAccessToken(_0x5c49b9){return new Promise(function(_0x43a744,_0x1a08b2){var _0x332d9f;switch(_0x5c49b9[_0x39d2('0x53')]){case'US':_0x332d9f=_0x39d2('0x54');break;case'AU':_0x332d9f='https://accounts.zoho.com.au';break;case'EU':_0x332d9f=_0x39d2('0x55');break;case'IN':_0x332d9f='https://accounts.zoho.in';break;case'CN':_0x332d9f=_0x39d2('0x56');break;default:_0x332d9f=_0x39d2('0x55');break;}var _0x58e7ce={'method':_0x39d2('0x57'),'uri':_0x332d9f+'/oauth/v2/token','qs':{'refresh_token':_0x5c49b9[_0x39d2('0x58')],'client_id':_0x5c49b9[_0x39d2('0x59')],'client_secret':_0x5c49b9[_0x39d2('0x5a')],'grant_type':_0x39d2('0x5b')},'json':!![]};return rp(_0x58e7ce)[_0x39d2('0x23')](function(_0x5630ff){if(_0x5630ff[_0x39d2('0x5c')]){_0x43a744(_0x5630ff[_0x39d2('0x5c')]);}else{_0x1a08b2(_0x39d2('0x5d'));}})[_0x39d2('0x3e')](function(_0x3aa2ee){_0x1a08b2(_0x3aa2ee);});});}exports['getFields']=function(_0xaa50e6,_0x1210b3,_0x537be3){var _0x55611e,_0x1aaee6,_0x409987,_0x5a77c8,_0x583614;return db[_0x39d2('0x28')][_0x39d2('0x49')]({'where':{'id':_0xaa50e6['params']['id']},'attributes':['id',_0x39d2('0x5e'),_0x39d2('0x53'),_0x39d2('0x59'),_0x39d2('0x5a'),_0x39d2('0x5f'),'code','refreshToken']})[_0x39d2('0x23')](handleEntityNotFound(_0x1210b3,null))[_0x39d2('0x23')](function(_0xcbdbd8){_0x583614=_0xcbdbd8;_0x55611e=_0x583614[_0x39d2('0x5e')];_0x1aaee6=_0x55611e===_0x39d2('0x60')?'eu':_0x39d2('0x61');_0x409987=_0x583614[_0x39d2('0x5f')];var _0x24ba96=_0x409987['slice'](-0x1);if(_0x24ba96==='/'||_0x24ba96==='\x5c'||_0x24ba96===':'){_0x409987=_0x409987[_0x39d2('0x62')](0x0,_0x409987[_0x39d2('0x63')](_0x24ba96));}if(!_0x583614['refreshToken']){throw new Error(_0x39d2('0x64'));}return getAccessToken(_0x583614);})[_0x39d2('0x23')](function(_0x18f812){if(_0x18f812){return rp({'method':_0x39d2('0x65'),'uri':util[_0x39d2('0x66')](_0x39d2('0x67'),_0x1aaee6),'qs':{'module':_0x39d2('0x68')},'headers':{'Authorization':_0x39d2('0x69')+_0x18f812},'json':!![]});}})[_0x39d2('0x23')](function(_0x254bbe){if(_0x254bbe){if(_0x254bbe['response']&&_0x254bbe['response']['error']){throw new Error(_0x254bbe['response'][_0x39d2('0x6a')]['message']);}var _0x44ddad=[];var _0x549b00=[];var _0x5982fc=['Owner',_0x39d2('0x6b'),_0x39d2('0x6c'),_0x39d2('0x6d'),'Call_Duration',_0x39d2('0x6e'),_0x39d2('0x6f'),'Call_Type'];_0x549b00=_[_0x39d2('0x70')](_0x254bbe[_0x39d2('0x32')],function(_0xfd8407){return _0x5982fc[_0x39d2('0x71')](_0xfd8407[_0x39d2('0x72')]);});for(var _0x3bcae3=0x0;_0x3bcae3<_0x549b00[_0x39d2('0x41')];_0x3bcae3++){if(_0x549b00[_0x3bcae3][_0x39d2('0x73')]===![]){_0x44ddad[_0x39d2('0x74')]({'id':_0x549b00[_0x3bcae3]['id'],'name':_0x549b00[_0x3bcae3][_0x39d2('0x75')],'custom':_0x549b00[_0x3bcae3][_0x39d2('0x76')],'options':_0x549b00[_0x3bcae3]['data_type']===_0x39d2('0x77')&&_0x549b00[_0x3bcae3][_0x39d2('0x78')][_0x39d2('0x41')]>-0x1?_[_0x39d2('0x27')](_0x549b00[_0x3bcae3]['pick_list_values'],function(_0x45f7cc){return{'name':_0x45f7cc,'value':_0x45f7cc};}):[]});}}return{'count':_0x44ddad['length'],'rows':_0x44ddad};}else{return{'count':0x0,'rows':[]};}})[_0x39d2('0x23')](respondWithResult(_0x1210b3,null))[_0x39d2('0x3e')](function(_0x27caf7){var _0x59e0e1=_0xaa50e6[_0x39d2('0x2e')][_0x39d2('0x79')]?0x1f4:_0x27caf7['statusCode']||0x1f4;logger[_0x39d2('0x6a')](_0x39d2('0x7a'),_0x39d2('0x7b'),_0x59e0e1,JSON[_0x39d2('0x7c')](_0x27caf7));delete _0x27caf7[_0x39d2('0x25')];if(_0x59e0e1===0x191){_0x59e0e1=0x190;}_0x1210b3['status'](_0x59e0e1)[_0x39d2('0x26')](_0xaa50e6[_0x39d2('0x2e')][_0x39d2('0x79')]?{'message':_0x39d2('0x7d'),'statusCode':_0x27caf7[_0x39d2('0x7e')]}:_0x27caf7);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ea12426..d85d208 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 _0xd6c2=['then','parse','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','catch','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','application/x-www-form-urlencoded','refresh_token','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code'];(function(_0x436a07,_0x134c56){var _0x369497=function(_0x57ddf6){while(--_0x57ddf6){_0x436a07['push'](_0x436a07['shift']());}};_0x369497(++_0x134c56);}(_0xd6c2,0x145));var _0x2d6c=function(_0x2c1fe0,_0x313eff){_0x2c1fe0=_0x2c1fe0-0x0;var _0x134dc4=_0xd6c2[_0x2c1fe0];return _0x134dc4;};'use strict';var _=require(_0x2d6c('0x0'));var util=require(_0x2d6c('0x1'));var logger=require(_0x2d6c('0x2'))('api');var moment=require(_0x2d6c('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d6c('0x4'));var fs=require('fs');var path=require(_0x2d6c('0x5'));var rimraf=require(_0x2d6c('0x6'));var config=require(_0x2d6c('0x7'));var attributes=require(_0x2d6c('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x2d6c('0x9')]=function(_0x45aa5d,_0x224828){return _0x45aa5d[_0x2d6c('0xa')](_0x2d6c('0xb'),attributes,{'tableName':_0x2d6c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b264a,_0x211705,_0x153fcc){if(_0x3b264a[_0x2d6c('0xd')](_0x2d6c('0xe'))||_0x3b264a['changed'](_0x2d6c('0xf'))||_0x3b264a[_0x2d6c('0xd')](_0x2d6c('0x10'))||_0x3b264a['changed'](_0x2d6c('0x11'))||_0x3b264a[_0x2d6c('0xd')](_0x2d6c('0x12'))||_0x3b264a[_0x2d6c('0xd')](_0x2d6c('0x13'))){var _0x47fcd,_0x405f7a;_0x47fcd=_0x3b264a[_0x2d6c('0xf')];var _0x526335=_0x47fcd[_0x2d6c('0x14')](-0x1);if(_0x526335==='/'||_0x526335==='\x5c'||_0x526335===':'){_0x47fcd=_0x47fcd[_0x2d6c('0x15')](0x0,_0x47fcd['lastIndexOf'](_0x526335));}switch(_0x3b264a[_0x2d6c('0xe')]){case'US':_0x405f7a='https://accounts.zoho.com';break;case'AU':_0x405f7a='https://accounts.zoho.com.au';break;case'IN':_0x405f7a=_0x2d6c('0x16');break;case'CN':_0x405f7a='https://accounts.zoho.com.cn';break;default:_0x405f7a=_0x2d6c('0x17');break;}var _0x28454d={'method':_0x2d6c('0x18'),'uri':_0x405f7a+_0x2d6c('0x19'),'form':{'grant_type':_0x2d6c('0x1a'),'client_id':_0x3b264a[_0x2d6c('0x10')],'client_secret':_0x3b264a['clientSecret'],'redirect_uri':_0x3b264a[_0x2d6c('0xf')],'code':_0x3b264a[_0x2d6c('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x28454d)[_0x2d6c('0x1b')](function(_0x2b748d){var _0x3a8341=JSON[_0x2d6c('0x1c')](_0x2b748d);if(_0x3a8341['refresh_token']){_0x3b264a[_0x2d6c('0x1d')]=_0x3a8341['refresh_token'];logger[_0x2d6c('0x1e')](util[_0x2d6c('0x1f')](_0x2d6c('0x20'),_0x3b264a[_0x2d6c('0x21')],_0x3b264a['id']));}else{logger[_0x2d6c('0x22')](util[_0x2d6c('0x1f')](_0x2d6c('0x23'),_0x3b264a[_0x2d6c('0x21')],_0x3b264a['id']),util[_0x2d6c('0x24')](_0x3a8341,{'showHidden':![],'depth':null}));}return _0x153fcc(null,_0x211705);})[_0x2d6c('0x25')](function(_0x9b14e3){logger['error'](util[_0x2d6c('0x1f')](_0x2d6c('0x23'),_0x3b264a['name'],_0x3b264a['id']),util[_0x2d6c('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x153fcc(_0x9b14e3);});}else{return _0x153fcc(null,_0x211705);}},'beforeUpdate':function(_0x25dacb,_0xed5a32,_0x2fd82c){if(_0x25dacb[_0x2d6c('0xd')](_0x2d6c('0xe'))||_0x25dacb['changed']('serverUrl')||_0x25dacb['changed'](_0x2d6c('0x10'))||_0x25dacb[_0x2d6c('0xd')]('clientSecret')||_0x25dacb[_0x2d6c('0xd')](_0x2d6c('0x12'))||_0x25dacb[_0x2d6c('0xd')](_0x2d6c('0x13'))){var _0xc0d1ce,_0x56342c;_0xc0d1ce=_0x25dacb[_0x2d6c('0xf')];var _0x1b7efd=_0xc0d1ce[_0x2d6c('0x14')](-0x1);if(_0x1b7efd==='/'||_0x1b7efd==='\x5c'||_0x1b7efd===':'){_0xc0d1ce=_0xc0d1ce[_0x2d6c('0x15')](0x0,_0xc0d1ce[_0x2d6c('0x26')](_0x1b7efd));}switch(_0x25dacb[_0x2d6c('0xe')]){case'US':_0x56342c=_0x2d6c('0x27');break;case'AU':_0x56342c=_0x2d6c('0x28');break;case'IN':_0x56342c=_0x2d6c('0x16');break;case'CN':_0x56342c=_0x2d6c('0x29');break;default:_0x56342c=_0x2d6c('0x17');break;}var _0x89b142={'method':_0x2d6c('0x18'),'uri':_0x56342c+_0x2d6c('0x19'),'form':{'grant_type':_0x2d6c('0x1a'),'client_id':_0x25dacb[_0x2d6c('0x10')],'client_secret':_0x25dacb[_0x2d6c('0x11')],'redirect_uri':_0x25dacb[_0x2d6c('0xf')],'code':_0x25dacb['code']},'headers':{'Content-Type':_0x2d6c('0x2a')}};return rp(_0x89b142)[_0x2d6c('0x1b')](function(_0x15960f){var _0x13577e=JSON[_0x2d6c('0x1c')](_0x15960f);if(_0x13577e[_0x2d6c('0x2b')]){_0x25dacb[_0x2d6c('0x1d')]=_0x13577e[_0x2d6c('0x2b')];logger[_0x2d6c('0x1e')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x25dacb[_0x2d6c('0x21')],_0x25dacb['id']));}else{logger[_0x2d6c('0x22')](util[_0x2d6c('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x25dacb[_0x2d6c('0x21')],_0x25dacb['id']),util[_0x2d6c('0x24')](_0x13577e,{'showHidden':![],'depth':null}));}return _0x2fd82c(null,_0xed5a32);})[_0x2d6c('0x25')](function(_0x402867){logger[_0x2d6c('0x22')](util[_0x2d6c('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x25dacb[_0x2d6c('0x21')],_0x25dacb['id']),util[_0x2d6c('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2fd82c(_0x402867);});}else{return _0x2fd82c(null,_0xed5a32);}}}});}; \ No newline at end of file +var _0x48be=['serverUrl','clientId','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','clientSecret','refreshToken','info','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','zone','changed'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x48be,0x118));var _0xe48b=function(_0x83b30a,_0x269162){_0x83b30a=_0x83b30a-0x0;var _0x1b071c=_0x48be[_0x83b30a];return _0x1b071c;};'use strict';var _=require('lodash');var util=require(_0xe48b('0x0'));var logger=require(_0xe48b('0x1'))('api');var moment=require(_0xe48b('0x2'));var BPromise=require('bluebird');var rp=require(_0xe48b('0x3'));var fs=require('fs');var path=require(_0xe48b('0x4'));var rimraf=require(_0xe48b('0x5'));var config=require(_0xe48b('0x6'));var attributes=require(_0xe48b('0x7'));var integrations=require(_0xe48b('0x8'));module['exports']=function(_0x349813,_0x3682a1){return _0x349813[_0xe48b('0x9')](_0xe48b('0xa'),attributes,{'tableName':_0xe48b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x44f504,_0x5c308d,_0x339493){if(_0x44f504['changed'](_0xe48b('0xc'))||_0x44f504[_0xe48b('0xd')](_0xe48b('0xe'))||_0x44f504[_0xe48b('0xd')](_0xe48b('0xf'))||_0x44f504[_0xe48b('0xd')]('clientSecret')||_0x44f504[_0xe48b('0xd')](_0xe48b('0x10'))||_0x44f504['changed'](_0xe48b('0x11'))){var _0x589bf7,_0x38cbed;_0x589bf7=_0x44f504[_0xe48b('0xe')];var _0x44e7c0=_0x589bf7[_0xe48b('0x12')](-0x1);if(_0x44e7c0==='/'||_0x44e7c0==='\x5c'||_0x44e7c0===':'){_0x589bf7=_0x589bf7[_0xe48b('0x13')](0x0,_0x589bf7[_0xe48b('0x14')](_0x44e7c0));}switch(_0x44f504[_0xe48b('0xc')]){case'US':_0x38cbed=_0xe48b('0x15');break;case'AU':_0x38cbed=_0xe48b('0x16');break;case'IN':_0x38cbed=_0xe48b('0x17');break;case'CN':_0x38cbed=_0xe48b('0x18');break;default:_0x38cbed=_0xe48b('0x19');break;}var _0x48d9d8={'method':'POST','uri':_0x38cbed+_0xe48b('0x1a'),'form':{'grant_type':_0xe48b('0x1b'),'client_id':_0x44f504[_0xe48b('0xf')],'client_secret':_0x44f504['clientSecret'],'redirect_uri':_0x44f504[_0xe48b('0xe')],'code':_0x44f504[_0xe48b('0x10')]},'headers':{'Content-Type':_0xe48b('0x1c')}};return rp(_0x48d9d8)[_0xe48b('0x1d')](function(_0x19d836){var _0x79b74a=JSON[_0xe48b('0x1e')](_0x19d836);if(_0x79b74a[_0xe48b('0x1f')]){_0x44f504['refreshToken']=_0x79b74a[_0xe48b('0x1f')];logger['info'](util['format'](_0xe48b('0x20'),_0x44f504[_0xe48b('0x21')],_0x44f504['id']));}else{logger[_0xe48b('0x22')](util[_0xe48b('0x23')](_0xe48b('0x24'),_0x44f504['name'],_0x44f504['id']),util[_0xe48b('0x25')](_0x79b74a,{'showHidden':![],'depth':null}));}return _0x339493(null,_0x5c308d);})[_0xe48b('0x26')](function(_0x58b437){logger[_0xe48b('0x22')](util[_0xe48b('0x23')](_0xe48b('0x24'),_0x44f504['name'],_0x44f504['id']),util[_0xe48b('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x339493(_0x58b437);});}else{return _0x339493(null,_0x5c308d);}},'beforeUpdate':function(_0x264850,_0x3ea6fe,_0x5eae17){if(_0x264850[_0xe48b('0xd')](_0xe48b('0xc'))||_0x264850[_0xe48b('0xd')](_0xe48b('0xe'))||_0x264850['changed']('clientId')||_0x264850[_0xe48b('0xd')]('clientSecret')||_0x264850[_0xe48b('0xd')](_0xe48b('0x10'))||_0x264850['changed'](_0xe48b('0x11'))){var _0x38f24a,_0x1a3894;_0x38f24a=_0x264850[_0xe48b('0xe')];var _0x51f435=_0x38f24a[_0xe48b('0x12')](-0x1);if(_0x51f435==='/'||_0x51f435==='\x5c'||_0x51f435===':'){_0x38f24a=_0x38f24a[_0xe48b('0x13')](0x0,_0x38f24a[_0xe48b('0x14')](_0x51f435));}switch(_0x264850['zone']){case'US':_0x1a3894=_0xe48b('0x15');break;case'AU':_0x1a3894=_0xe48b('0x16');break;case'IN':_0x1a3894=_0xe48b('0x17');break;case'CN':_0x1a3894=_0xe48b('0x18');break;default:_0x1a3894=_0xe48b('0x19');break;}var _0x1e3524={'method':'POST','uri':_0x1a3894+_0xe48b('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x264850[_0xe48b('0xf')],'client_secret':_0x264850[_0xe48b('0x27')],'redirect_uri':_0x264850['serverUrl'],'code':_0x264850['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1e3524)[_0xe48b('0x1d')](function(_0x4f1524){var _0x1c85d6=JSON['parse'](_0x4f1524);if(_0x1c85d6[_0xe48b('0x1f')]){_0x264850[_0xe48b('0x28')]=_0x1c85d6[_0xe48b('0x1f')];logger[_0xe48b('0x29')](util['format'](_0xe48b('0x20'),_0x264850[_0xe48b('0x21')],_0x264850['id']));}else{logger[_0xe48b('0x22')](util['format'](_0xe48b('0x24'),_0x264850[_0xe48b('0x21')],_0x264850['id']),util['inspect'](_0x1c85d6,{'showHidden':![],'depth':null}));}return _0x5eae17(null,_0x3ea6fe);})[_0xe48b('0x26')](function(_0x34cc12){logger[_0xe48b('0x22')](util[_0xe48b('0x23')](_0xe48b('0x24'),_0x264850[_0xe48b('0x21')],_0x264850['id']),util[_0xe48b('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x5eae17(_0x34cc12);});}else{return _0x5eae17(null,_0x3ea6fe);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 9667f82..1c8e646 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 _0xd5f9=['limit','map','include','model','ShowZohoAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes'];(function(_0x5b75c4,_0xca1d42){var _0x6f2bda=function(_0x262bdc){while(--_0x262bdc){_0x5b75c4['push'](_0x5b75c4['shift']());}};_0x6f2bda(++_0xca1d42);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x33eb5c,_0x4a7d98){_0x33eb5c=_0x33eb5c-0x0;var _0x253328=_0xd5f9[_0x33eb5c];return _0x253328;};'use strict';var _=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var moment=require(_0x9d5f('0x2'));var BPromise=require(_0x9d5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d5f('0x4'));var db=require(_0x9d5f('0x5'))['db'];var utils=require(_0x9d5f('0x6'));var logger=require(_0x9d5f('0x7'))(_0x9d5f('0x8'));var config=require(_0x9d5f('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dca4b,_0x2e1c4e,_0x4ac60a){return new BPromise(function(_0x402a35,_0x255389){return client['request'](_0x1dca4b,_0x4ac60a)[_0x9d5f('0xa')](function(_0x241166){logger['info'](_0x9d5f('0xb'),_0x2e1c4e,'request\x20sent');logger[_0x9d5f('0xc')](_0x9d5f('0xd'),_0x2e1c4e,_0x9d5f('0xe'),JSON[_0x9d5f('0xf')](_0x241166));if(_0x241166[_0x9d5f('0x10')]){if(_0x241166['error'][_0x9d5f('0x11')]===0x1f4){logger[_0x9d5f('0x10')](_0x9d5f('0xb'),_0x2e1c4e,_0x241166[_0x9d5f('0x10')][_0x9d5f('0x12')]);return _0x255389(_0x241166[_0x9d5f('0x10')][_0x9d5f('0x12')]);}logger[_0x9d5f('0x10')](_0x9d5f('0xb'),_0x2e1c4e,_0x241166['error']['message']);return _0x402a35(_0x241166['error']['message']);}else{logger[_0x9d5f('0x13')](_0x9d5f('0xb'),_0x2e1c4e,'request\x20sent');_0x402a35(_0x241166[_0x9d5f('0x14')][_0x9d5f('0x12')]);}})[_0x9d5f('0x15')](function(_0x3a9220){logger[_0x9d5f('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x2e1c4e,_0x3a9220);_0x255389(_0x3a9220);});});}exports[_0x9d5f('0x16')]=function(_0x463c1e){var _0xbfb436=this;return new Promise(function(_0x31ba0a,_0x3118ca){return db[_0x9d5f('0x17')][_0x9d5f('0x18')]({'raw':_0x463c1e['options']?_0x463c1e[_0x9d5f('0x19')][_0x9d5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x463c1e[_0x9d5f('0x19')]?_0x463c1e['options']['where']||null:null,'attributes':_0x463c1e[_0x9d5f('0x19')]?_0x463c1e[_0x9d5f('0x19')][_0x9d5f('0x1b')]||null:null,'limit':_0x463c1e[_0x9d5f('0x19')]?_0x463c1e['options'][_0x9d5f('0x1c')]||null:null,'include':_0x463c1e['options']?_0x463c1e[_0x9d5f('0x19')]['include']?_[_0x9d5f('0x1d')](_0x463c1e[_0x9d5f('0x19')][_0x9d5f('0x1e')],function(_0xfb3e00){return{'model':db[_0xfb3e00[_0x9d5f('0x1f')]],'as':_0xfb3e00['as'],'attributes':_0xfb3e00['attributes'],'include':_0xfb3e00[_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0xfb3e00['include'],function(_0x2a032a){return{'model':db[_0x2a032a[_0x9d5f('0x1f')]],'as':_0x2a032a['as'],'attributes':_0x2a032a[_0x9d5f('0x1b')],'include':_0x2a032a[_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0x2a032a['include'],function(_0x209f7b){return{'model':db[_0x209f7b[_0x9d5f('0x1f')]],'as':_0x209f7b['as'],'attributes':_0x209f7b[_0x9d5f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f8281){logger['info'](_0x9d5f('0x16'),_0x463c1e);logger[_0x9d5f('0xc')]('GetZohoAccount',_0x463c1e,JSON[_0x9d5f('0xf')](_0x5f8281));_0x31ba0a(_0x5f8281);})[_0x9d5f('0x15')](function(_0x3def92){logger['error']('GetZohoAccount',_0x3def92['message'],_0x463c1e);_0x3118ca(_0xbfb436[_0x9d5f('0x10')](0x1f4,_0x3def92[_0x9d5f('0x12')]));});});};exports[_0x9d5f('0x20')]=function(_0x4fafae){var _0x332191=this;return new Promise(function(_0x4c15e4,_0x540ec){return db[_0x9d5f('0x17')][_0x9d5f('0x21')]({'raw':_0x4fafae[_0x9d5f('0x19')]?_0x4fafae[_0x9d5f('0x19')][_0x9d5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4fafae['options']?_0x4fafae[_0x9d5f('0x19')][_0x9d5f('0x22')]||null:null,'attributes':_0x4fafae[_0x9d5f('0x19')]?_0x4fafae['options']['attributes']||null:null,'include':_0x4fafae[_0x9d5f('0x19')]?_0x4fafae[_0x9d5f('0x19')][_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0x4fafae[_0x9d5f('0x19')][_0x9d5f('0x1e')],function(_0x23de5a){return{'model':db[_0x23de5a[_0x9d5f('0x1f')]],'as':_0x23de5a['as'],'attributes':_0x23de5a[_0x9d5f('0x1b')],'include':_0x23de5a[_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0x23de5a[_0x9d5f('0x1e')],function(_0x1ee626){return{'model':db[_0x1ee626[_0x9d5f('0x1f')]],'as':_0x1ee626['as'],'attributes':_0x1ee626[_0x9d5f('0x1b')],'include':_0x1ee626[_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0x1ee626[_0x9d5f('0x1e')],function(_0x215ec8){return{'model':db[_0x215ec8[_0x9d5f('0x1f')]],'as':_0x215ec8['as'],'attributes':_0x215ec8[_0x9d5f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f4c39){logger[_0x9d5f('0x13')](_0x9d5f('0x20'),_0x4fafae);logger[_0x9d5f('0xc')](_0x9d5f('0x20'),_0x4fafae,JSON[_0x9d5f('0xf')](_0x5f4c39));_0x4c15e4(_0x5f4c39);})['catch'](function(_0x5548d6){logger[_0x9d5f('0x10')]('ShowZohoAccount',_0x5548d6[_0x9d5f('0x12')],_0x4fafae);_0x540ec(_0x332191['error'](0x1f4,_0x5548d6[_0x9d5f('0x12')]));});});}; \ No newline at end of file +var _0x3d04=['result','ZohoAccount','options','where','attributes','limit','include','map','model','GetZohoAccount','debug','catch','find','raw','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','ZohoAccount,\x20%s,\x20%s','message','info'];(function(_0xd4f806,_0xd637c1){var _0x281baf=function(_0x437e0b){while(--_0x437e0b){_0xd4f806['push'](_0xd4f806['shift']());}};_0x281baf(++_0xd637c1);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});}exports['GetZohoAccount']=function(_0x2c641e){var _0x532402=this;return new Promise(function(_0x2c9d06,_0x468ca2){return db[_0x43d0('0x15')]['findAll']({'raw':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x17')]||null:null,'attributes':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x18')]||null:null,'limit':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x19')]||null:null,'include':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x2c641e[_0x43d0('0x16')][_0x43d0('0x1a')],function(_0x48aa18){return{'model':db[_0x48aa18[_0x43d0('0x1c')]],'as':_0x48aa18['as'],'attributes':_0x48aa18[_0x43d0('0x18')],'include':_0x48aa18['include']?_[_0x43d0('0x1b')](_0x48aa18['include'],function(_0x29c111){return{'model':db[_0x29c111[_0x43d0('0x1c')]],'as':_0x29c111['as'],'attributes':_0x29c111['attributes'],'include':_0x29c111[_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x29c111['include'],function(_0x12df30){return{'model':db[_0x12df30[_0x43d0('0x1c')]],'as':_0x12df30['as'],'attributes':_0x12df30[_0x43d0('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x447725){logger[_0x43d0('0x13')](_0x43d0('0x1d'),_0x2c641e);logger[_0x43d0('0x1e')](_0x43d0('0x1d'),_0x2c641e,JSON[_0x43d0('0xf')](_0x447725));_0x2c9d06(_0x447725);})[_0x43d0('0x1f')](function(_0x4a3cd4){logger[_0x43d0('0x10')](_0x43d0('0x1d'),_0x4a3cd4[_0x43d0('0x12')],_0x2c641e);_0x468ca2(_0x532402['error'](0x1f4,_0x4a3cd4['message']));});});};exports['ShowZohoAccount']=function(_0x3c1ea3){var _0x2db9dc=this;return new Promise(function(_0x10086b,_0x13e3c9){return db[_0x43d0('0x15')][_0x43d0('0x20')]({'raw':_0x3c1ea3['options']?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x21')]===undefined?!![]:![]:!![],'where':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x17')]||null:null,'attributes':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x18')]||null:null,'include':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x1a')]?_['map'](_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x1a')],function(_0x45ec78){return{'model':db[_0x45ec78[_0x43d0('0x1c')]],'as':_0x45ec78['as'],'attributes':_0x45ec78['attributes'],'include':_0x45ec78[_0x43d0('0x1a')]?_['map'](_0x45ec78[_0x43d0('0x1a')],function(_0x23cc5b){return{'model':db[_0x23cc5b['model']],'as':_0x23cc5b['as'],'attributes':_0x23cc5b[_0x43d0('0x18')],'include':_0x23cc5b[_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x23cc5b[_0x43d0('0x1a')],function(_0x154db6){return{'model':db[_0x154db6[_0x43d0('0x1c')]],'as':_0x154db6['as'],'attributes':_0x154db6[_0x43d0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x43d0('0xd')](function(_0x7b7983){logger[_0x43d0('0x13')](_0x43d0('0x22'),_0x3c1ea3);logger['debug'](_0x43d0('0x22'),_0x3c1ea3,JSON[_0x43d0('0xf')](_0x7b7983));_0x10086b(_0x7b7983);})[_0x43d0('0x1f')](function(_0x7891c5){logger[_0x43d0('0x10')](_0x43d0('0x22'),_0x7891c5[_0x43d0('0x12')],_0x3c1ea3);_0x13e3c9(_0x2db9dc[_0x43d0('0x10')](0x1f4,_0x7891c5[_0x43d0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index aba6f4e..e871879 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 _0xbb09=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2e608a,_0x58d1f9){var _0x2a611b=function(_0x51f257){while(--_0x51f257){_0x2e608a['push'](_0x2e608a['shift']());}};_0x2a611b(++_0x58d1f9);}(_0xbb09,0xf0));var _0x9bb0=function(_0x43d79c,_0x531a55){_0x43d79c=_0x43d79c-0x0;var _0x4866b0=_0xbb09[_0x43d79c];return _0x4866b0;};'use strict';var multer=require(_0x9bb0('0x0'));var util=require(_0x9bb0('0x1'));var path=require(_0x9bb0('0x2'));var timeout=require(_0x9bb0('0x3'));var express=require(_0x9bb0('0x4'));var router=express[_0x9bb0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9bb0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9bb0('0x7'));var controller=require(_0x9bb0('0x8'));router[_0x9bb0('0x9')]('/',auth[_0x9bb0('0xa')](),controller[_0x9bb0('0xb')]);router['get'](_0x9bb0('0xc'),auth[_0x9bb0('0xa')](),controller[_0x9bb0('0xd')]);router[_0x9bb0('0x9')]('/:id/fields',auth[_0x9bb0('0xa')](),controller[_0x9bb0('0xe')]);router['get'](_0x9bb0('0xf'),auth['isAuthenticated'](),controller[_0x9bb0('0x10')]);router[_0x9bb0('0x9')](_0x9bb0('0x11'),auth[_0x9bb0('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x9bb0('0xa')](),controller[_0x9bb0('0x12')]);router['put'](_0x9bb0('0xc'),auth[_0x9bb0('0xa')](),controller[_0x9bb0('0x13')]);router[_0x9bb0('0x14')](_0x9bb0('0xc'),auth[_0x9bb0('0xa')](),controller[_0x9bb0('0x15')]);module[_0x9bb0('0x16')]=router; \ No newline at end of file +var _0x8b50=['create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8b50,0xdd));var _0x08b5=function(_0x4c144c,_0x55afe7){_0x4c144c=_0x4c144c-0x0;var _0x4e0d50=_0x8b50[_0x4c144c];return _0x4e0d50;};'use strict';var multer=require(_0x08b5('0x0'));var util=require(_0x08b5('0x1'));var path=require(_0x08b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x08b5('0x3'));var router=express[_0x08b5('0x4')]();var fs_extra=require(_0x08b5('0x5'));var auth=require(_0x08b5('0x6'));var interaction=require(_0x08b5('0x7'));var config=require(_0x08b5('0x8'));var controller=require(_0x08b5('0x9'));router[_0x08b5('0xa')]('/',auth[_0x08b5('0xb')](),controller['index']);router[_0x08b5('0xa')](_0x08b5('0xc'),auth[_0x08b5('0xb')](),controller['show']);router[_0x08b5('0xa')](_0x08b5('0xd'),auth[_0x08b5('0xb')](),controller['getFields']);router[_0x08b5('0xa')](_0x08b5('0xe'),auth[_0x08b5('0xb')](),controller[_0x08b5('0xf')]);router[_0x08b5('0xa')](_0x08b5('0x10'),auth[_0x08b5('0xb')](),controller[_0x08b5('0x11')]);router[_0x08b5('0x12')]('/',auth['isAuthenticated'](),controller[_0x08b5('0x13')]);router[_0x08b5('0x14')]('/:id',auth[_0x08b5('0xb')](),controller[_0x08b5('0x15')]);router['delete'](_0x08b5('0xc'),auth['isAuthenticated'](),controller[_0x08b5('0x16')]);module[_0x08b5('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 aeff71a..9f9eaa2 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 _0x3620=['nothing','contact_lead','STRING','ENUM','lead','contact'];(function(_0x45b309,_0x51cfad){var _0x10230b=function(_0x3159c6){while(--_0x3159c6){_0x45b309['push'](_0x45b309['shift']());}};_0x10230b(++_0x51cfad);}(_0x3620,0xcf));var _0x0362=function(_0x2d49f1,_0x20a323){_0x2d49f1=_0x2d49f1-0x0;var _0x496644=_0x3620[_0x2d49f1];return _0x496644;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x0362('0x0')](_0x0362('0x1'),_0x0362('0x2'),_0x0362('0x3')),'defaultValue':_0x0362('0x1')},'moduleSearch':{'type':Sequelize['ENUM'](_0x0362('0x4'),_0x0362('0x2'),_0x0362('0x1')),'defaultValue':_0x0362('0x4')},'description':{'type':Sequelize[_0x0362('0x5')]}}; \ No newline at end of file +var _0xf23b=['contact_lead','exports','STRING','ENUM','lead','contact','nothing'];(function(_0x512980,_0x401e50){var _0x571f0a=function(_0x456237){while(--_0x456237){_0x512980['push'](_0x512980['shift']());}};_0x571f0a(++_0x401e50);}(_0xf23b,0x1d6));var _0xbf23=function(_0x25b8b1,_0xe0b951){_0x25b8b1=_0x25b8b1-0x0;var _0x2d04f7=_0xf23b[_0x25b8b1];return _0x2d04f7;};'use strict';var Sequelize=require('sequelize');module[_0xbf23('0x0')]={'name':{'type':Sequelize[_0xbf23('0x1')]},'moduleCreate':{'type':Sequelize[_0xbf23('0x2')](_0xbf23('0x3'),_0xbf23('0x4'),_0xbf23('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0xbf23('0x6'),'contact',_0xbf23('0x3')),'defaultValue':_0xbf23('0x6')},'description':{'type':Sequelize[_0xbf23('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 8314436..0ef3d29 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 _0x90f5=['../../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','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','ZohoConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','create','body','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x10ccd3,_0x148da7){var _0x127fbc=function(_0x341936){while(--_0x341936){_0x10ccd3['push'](_0x10ccd3['shift']());}};_0x127fbc(++_0x148da7);}(_0x90f5,0x99));var _0x590f=function(_0x1a6432,_0x5a6de7){_0x1a6432=_0x1a6432-0x0;var _0x197b8a=_0x90f5[_0x1a6432];return _0x197b8a;};'use strict';var emlformat=require(_0x590f('0x0'));var rimraf=require(_0x590f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x590f('0x2'));var rp=require(_0x590f('0x3'));var moment=require(_0x590f('0x4'));var BPromise=require(_0x590f('0x5'));var Mustache=require(_0x590f('0x6'));var util=require(_0x590f('0x7'));var path=require(_0x590f('0x8'));var sox=require('sox');var csv=require(_0x590f('0x9'));var ejs=require(_0x590f('0xa'));var fs=require('fs');var fs_extra=require(_0x590f('0xb'));var _=require(_0x590f('0xc'));var squel=require(_0x590f('0xd'));var crypto=require('crypto');var jsforce=require(_0x590f('0xe'));var deskjs=require(_0x590f('0xf'));var toCsv=require(_0x590f('0x9'));var querystring=require(_0x590f('0x10'));var Papa=require('papaparse');var Redis=require(_0x590f('0x11'));var authService=require(_0x590f('0x12'));var qs=require(_0x590f('0x13'));var as=require(_0x590f('0x14'));var hardwareService=require(_0x590f('0x15'));var logger=require(_0x590f('0x16'))(_0x590f('0x17'));var utils=require(_0x590f('0x18'));var config=require(_0x590f('0x19'));var licenseUtil=require(_0x590f('0x1a'));var db=require(_0x590f('0x1b'))['db'];function respondWithStatusCode(_0x50daa3,_0xd527b4){_0xd527b4=_0xd527b4||0xcc;return function(_0x16d4da){if(_0x16d4da){return _0x50daa3[_0x590f('0x1c')](_0xd527b4);}return _0x50daa3[_0x590f('0x1d')](_0xd527b4)['end']();};}function respondWithResult(_0x5a5b74,_0xad79b1){_0xad79b1=_0xad79b1||0xc8;return function(_0x1380a7){if(_0x1380a7){return _0x5a5b74['status'](_0xad79b1)[_0x590f('0x1e')](_0x1380a7);}};}function respondWithFilteredResult(_0x45d55,_0xfd5ff){return function(_0x96a0c5){if(_0x96a0c5){var _0xc7be47=typeof _0xfd5ff[_0x590f('0x1f')]===_0x590f('0x20')&&typeof _0xfd5ff[_0x590f('0x21')]===_0x590f('0x20');var _0x23ae02=_0x96a0c5['count'];var _0x3380f1=_0xc7be47?0x0:_0xfd5ff[_0x590f('0x1f')];var _0x1d9896=_0xc7be47?_0x96a0c5[_0x590f('0x22')]:_0xfd5ff[_0x590f('0x1f')]+_0xfd5ff['limit'];var _0x22ee09;if(_0x1d9896>=_0x23ae02){_0x1d9896=_0x23ae02;_0x22ee09=0xc8;}else{_0x22ee09=0xce;}_0x45d55[_0x590f('0x1d')](_0x22ee09);return _0x45d55[_0x590f('0x23')](_0x590f('0x24'),_0x3380f1+'-'+_0x1d9896+'/'+_0x23ae02)[_0x590f('0x1e')](_0x96a0c5);}return null;};}function patchUpdates(_0x472406){return function(_0x1653d8){try{jsonpatch[_0x590f('0x25')](_0x1653d8,_0x472406,!![]);}catch(_0x124a68){return BPromise[_0x590f('0x26')](_0x124a68);}return _0x1653d8[_0x590f('0x27')]();};}function saveUpdates(_0x2b32ab,_0x17a3f0){return function(_0x305ca8){if(_0x305ca8){return _0x305ca8[_0x590f('0x28')](_0x2b32ab)[_0x590f('0x29')](function(_0x3c441c){return _0x3c441c;});}return null;};}function removeEntity(_0x213d38,_0x101ed6){return function(_0x44d5cf){if(_0x44d5cf){return _0x44d5cf[_0x590f('0x2a')]()[_0x590f('0x29')](function(){_0x213d38[_0x590f('0x1d')](0xcc)[_0x590f('0x2b')]();});}};}function handleEntityNotFound(_0x113929,_0x30bea6){return function(_0x65605f){if(!_0x65605f){_0x113929['sendStatus'](0x194);}return _0x65605f;};}function handleError(_0xb6f606,_0x3be783){_0x3be783=_0x3be783||0x1f4;return function(_0x573dc7){logger[_0x590f('0x2c')](_0x573dc7['stack']);if(_0x573dc7[_0x590f('0x2d')]){delete _0x573dc7[_0x590f('0x2d')];}_0xb6f606[_0x590f('0x1d')](_0x3be783)[_0x590f('0x2e')](_0x573dc7);};}exports[_0x590f('0x2f')]=function(_0x5b777e,_0x15d04d){var _0x4242f2={},_0x28092f={},_0x138a29={'count':0x0,'rows':[]};var _0x1a4005=_['map'](db[_0x590f('0x30')][_0x590f('0x31')],function(_0x161f25){return{'name':_0x161f25[_0x590f('0x32')],'type':_0x161f25['type'][_0x590f('0x33')]};});_0x28092f[_0x590f('0x34')]=_[_0x590f('0x35')](_0x1a4005,_0x590f('0x2d'));_0x28092f[_0x590f('0x36')]=_['keys'](_0x5b777e[_0x590f('0x36')]);_0x28092f[_0x590f('0x37')]=_[_0x590f('0x38')](_0x28092f[_0x590f('0x34')],_0x28092f[_0x590f('0x36')]);_0x4242f2[_0x590f('0x39')]=_[_0x590f('0x38')](_0x28092f['model'],qs[_0x590f('0x3a')](_0x5b777e[_0x590f('0x36')][_0x590f('0x3a')]));_0x4242f2[_0x590f('0x39')]=_0x4242f2[_0x590f('0x39')][_0x590f('0x3b')]?_0x4242f2['attributes']:_0x28092f['model'];if(!_0x5b777e['query']['hasOwnProperty'](_0x590f('0x3c'))){_0x4242f2[_0x590f('0x21')]=qs['limit'](_0x5b777e[_0x590f('0x36')][_0x590f('0x21')]);_0x4242f2[_0x590f('0x1f')]=qs['offset'](_0x5b777e['query'][_0x590f('0x1f')]);}_0x4242f2[_0x590f('0x3d')]=qs[_0x590f('0x3e')](_0x5b777e[_0x590f('0x36')][_0x590f('0x3e')]);_0x4242f2[_0x590f('0x3f')]=qs['filters'](_[_0x590f('0x40')](_0x5b777e[_0x590f('0x36')],_0x28092f[_0x590f('0x37')]),_0x1a4005);if(_0x5b777e[_0x590f('0x36')][_0x590f('0x41')]){_0x4242f2[_0x590f('0x3f')]=_[_0x590f('0x42')](_0x4242f2[_0x590f('0x3f')],{'$or':_[_0x590f('0x35')](_0x1a4005,function(_0xccd126){if(_0xccd126[_0x590f('0x43')]!==_0x590f('0x44')){var _0x4bddb7={};_0x4bddb7[_0xccd126[_0x590f('0x2d')]]={'$like':'%'+_0x5b777e['query'][_0x590f('0x41')]+'%'};return _0x4bddb7;}})});}_0x4242f2=_[_0x590f('0x42')]({},_0x4242f2,_0x5b777e['options']);var _0x2d1067={'where':_0x4242f2[_0x590f('0x3f')]};return db['ZohoConfiguration'][_0x590f('0x22')](_0x2d1067)[_0x590f('0x29')](function(_0x127101){_0x138a29[_0x590f('0x22')]=_0x127101;if(_0x5b777e[_0x590f('0x36')][_0x590f('0x45')]){_0x4242f2[_0x590f('0x46')]=[{'all':!![]}];}return db[_0x590f('0x30')]['findAll'](_0x4242f2);})['then'](function(_0x3cce6f){_0x138a29[_0x590f('0x47')]=_0x3cce6f;return _0x138a29;})[_0x590f('0x29')](respondWithFilteredResult(_0x15d04d,_0x4242f2))[_0x590f('0x48')](handleError(_0x15d04d,null));};exports[_0x590f('0x49')]=function(_0x1bde69,_0x216d1f){var _0x38cda3={'raw':![],'where':{'id':_0x1bde69[_0x590f('0x4a')]['id']}},_0x35ffba={};_0x35ffba[_0x590f('0x34')]=_[_0x590f('0x4b')](db[_0x590f('0x30')][_0x590f('0x31')]);_0x35ffba[_0x590f('0x36')]=_[_0x590f('0x4b')](_0x1bde69[_0x590f('0x36')]);_0x35ffba[_0x590f('0x37')]=_[_0x590f('0x38')](_0x35ffba[_0x590f('0x34')],_0x35ffba[_0x590f('0x36')]);_0x38cda3[_0x590f('0x39')]=_[_0x590f('0x38')](_0x35ffba[_0x590f('0x34')],qs[_0x590f('0x3a')](_0x1bde69[_0x590f('0x36')][_0x590f('0x3a')]));_0x38cda3['attributes']=_0x38cda3[_0x590f('0x39')][_0x590f('0x3b')]?_0x38cda3[_0x590f('0x39')]:_0x35ffba[_0x590f('0x34')];if(_0x1bde69[_0x590f('0x36')][_0x590f('0x45')]){_0x38cda3[_0x590f('0x46')]=[{'all':!![]}];}_0x38cda3=_[_0x590f('0x42')]({},_0x38cda3,_0x1bde69[_0x590f('0x4c')]);return db[_0x590f('0x30')][_0x590f('0x4d')](_0x38cda3)[_0x590f('0x29')](handleEntityNotFound(_0x216d1f,null))[_0x590f('0x29')](respondWithResult(_0x216d1f,null))[_0x590f('0x48')](handleError(_0x216d1f,null));};exports[_0x590f('0x4e')]=function(_0x540885,_0x170bef){return db[_0x590f('0x30')][_0x590f('0x4e')](_0x540885[_0x590f('0x4f')],{})[_0x590f('0x29')](respondWithResult(_0x170bef,0xc9))[_0x590f('0x48')](handleError(_0x170bef,null));};exports[_0x590f('0x28')]=function(_0x3fca52,_0x16cae9){if(_0x3fca52['body']['id']){delete _0x3fca52[_0x590f('0x4f')]['id'];}return db[_0x590f('0x30')][_0x590f('0x4d')]({'where':{'id':_0x3fca52[_0x590f('0x4a')]['id']}})[_0x590f('0x29')](handleEntityNotFound(_0x16cae9,null))[_0x590f('0x29')](saveUpdates(_0x3fca52[_0x590f('0x4f')],null))[_0x590f('0x29')](respondWithResult(_0x16cae9,null))[_0x590f('0x48')](handleError(_0x16cae9,null));};exports[_0x590f('0x2a')]=function(_0x784660,_0x4b8e62){return db[_0x590f('0x30')][_0x590f('0x4d')]({'where':{'id':_0x784660[_0x590f('0x4a')]['id']}})[_0x590f('0x29')](handleEntityNotFound(_0x4b8e62,null))['then'](removeEntity(_0x4b8e62,null))[_0x590f('0x48')](handleError(_0x4b8e62,null));};exports[_0x590f('0x50')]=function(_0x2ac5e9,_0x51fb1a,_0x28f04e){var _0x1abdec={};var _0x5247a1={};var _0x52269a;var _0x5a4940;return db[_0x590f('0x30')][_0x590f('0x51')]({'where':{'id':_0x2ac5e9[_0x590f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51fb1a,null))['then'](function(_0x3d98f3){if(_0x3d98f3){_0x52269a=_0x3d98f3;_0x5247a1['model']=_['keys'](db[_0x590f('0x52')][_0x590f('0x31')]);_0x5247a1[_0x590f('0x36')]=_[_0x590f('0x4b')](_0x2ac5e9[_0x590f('0x36')]);_0x5247a1[_0x590f('0x37')]=_['intersection'](_0x5247a1[_0x590f('0x34')],_0x5247a1['query']);_0x1abdec['attributes']=_[_0x590f('0x38')](_0x5247a1[_0x590f('0x34')],qs[_0x590f('0x3a')](_0x2ac5e9[_0x590f('0x36')]['fields']));_0x1abdec[_0x590f('0x39')]=_0x1abdec[_0x590f('0x39')][_0x590f('0x3b')]?_0x1abdec[_0x590f('0x39')]:_0x5247a1['model'];_0x1abdec[_0x590f('0x3d')]=qs['sort'](_0x2ac5e9[_0x590f('0x36')][_0x590f('0x3e')]);_0x1abdec[_0x590f('0x3f')]=qs[_0x590f('0x37')](_[_0x590f('0x40')](_0x2ac5e9[_0x590f('0x36')],_0x5247a1[_0x590f('0x37')]));if(_0x2ac5e9['query']['filter']){_0x1abdec['where']=_[_0x590f('0x42')](_0x1abdec[_0x590f('0x3f')],{'$or':_[_0x590f('0x35')](_0x1abdec[_0x590f('0x39')],function(_0x2f0afb){var _0x2f8110={};_0x2f8110[_0x2f0afb]={'$like':'%'+_0x2ac5e9[_0x590f('0x36')][_0x590f('0x41')]+'%'};return _0x2f8110;})});}_0x1abdec=_[_0x590f('0x42')]({},_0x1abdec,_0x2ac5e9[_0x590f('0x4c')]);return _0x52269a[_0x590f('0x50')](_0x1abdec);}})[_0x590f('0x29')](function(_0x2e29cd){if(_0x2e29cd){_0x5a4940=_0x2e29cd[_0x590f('0x3b')];if(!_0x2ac5e9[_0x590f('0x36')][_0x590f('0x53')](_0x590f('0x3c'))){_0x1abdec[_0x590f('0x21')]=qs[_0x590f('0x21')](_0x2ac5e9[_0x590f('0x36')]['limit']);_0x1abdec[_0x590f('0x1f')]=qs['offset'](_0x2ac5e9[_0x590f('0x36')][_0x590f('0x1f')]);}return _0x52269a[_0x590f('0x50')](_0x1abdec);}})[_0x590f('0x29')](function(_0x295f4a){if(_0x295f4a){return _0x295f4a?{'count':_0x5a4940,'rows':_0x295f4a}:null;}})[_0x590f('0x29')](respondWithResult(_0x51fb1a,null))['catch'](handleError(_0x51fb1a,null));};exports[_0x590f('0x54')]=function(_0x3b366e,_0x599741,_0x5e7aec){var _0x164034={};var _0x44e762={};var _0x1699d7;var _0x2e4070;return db['ZohoConfiguration'][_0x590f('0x51')]({'where':{'id':_0x3b366e[_0x590f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x599741,null))[_0x590f('0x29')](function(_0x30d605){if(_0x30d605){_0x1699d7=_0x30d605;_0x44e762['model']=_[_0x590f('0x4b')](db[_0x590f('0x52')][_0x590f('0x31')]);_0x44e762[_0x590f('0x36')]=_[_0x590f('0x4b')](_0x3b366e[_0x590f('0x36')]);_0x44e762[_0x590f('0x37')]=_['intersection'](_0x44e762[_0x590f('0x34')],_0x44e762[_0x590f('0x36')]);_0x164034[_0x590f('0x39')]=_[_0x590f('0x38')](_0x44e762[_0x590f('0x34')],qs[_0x590f('0x3a')](_0x3b366e[_0x590f('0x36')][_0x590f('0x3a')]));_0x164034[_0x590f('0x39')]=_0x164034[_0x590f('0x39')][_0x590f('0x3b')]?_0x164034['attributes']:_0x44e762['model'];_0x164034['order']=qs[_0x590f('0x3e')](_0x3b366e[_0x590f('0x36')][_0x590f('0x3e')]);_0x164034[_0x590f('0x3f')]=qs[_0x590f('0x37')](_[_0x590f('0x40')](_0x3b366e[_0x590f('0x36')],_0x44e762[_0x590f('0x37')]));if(_0x3b366e[_0x590f('0x36')][_0x590f('0x41')]){_0x164034['where']=_['merge'](_0x164034['where'],{'$or':_[_0x590f('0x35')](_0x164034[_0x590f('0x39')],function(_0x132092){var _0x372e52={};_0x372e52[_0x132092]={'$like':'%'+_0x3b366e[_0x590f('0x36')]['filter']+'%'};return _0x372e52;})});}_0x164034=_[_0x590f('0x42')]({},_0x164034,_0x3b366e[_0x590f('0x4c')]);return _0x1699d7[_0x590f('0x54')](_0x164034);}})[_0x590f('0x29')](function(_0x51cff5){if(_0x51cff5){_0x2e4070=_0x51cff5[_0x590f('0x3b')];if(!_0x3b366e[_0x590f('0x36')][_0x590f('0x53')]('nolimit')){_0x164034[_0x590f('0x21')]=qs['limit'](_0x3b366e[_0x590f('0x36')][_0x590f('0x21')]);_0x164034[_0x590f('0x1f')]=qs[_0x590f('0x1f')](_0x3b366e[_0x590f('0x36')][_0x590f('0x1f')]);}return _0x1699d7['getSubjects'](_0x164034);}})[_0x590f('0x29')](function(_0x3afa6a){if(_0x3afa6a){return _0x3afa6a?{'count':_0x2e4070,'rows':_0x3afa6a}:null;}})[_0x590f('0x29')](respondWithResult(_0x599741,null))[_0x590f('0x48')](handleError(_0x599741,null));};exports[_0x590f('0x55')]=function(_0x5bb529,_0x46e1a3,_0x2be8f8){var _0x31b73c={};var _0x4e9b97={};var _0xe99fd7;var _0x10e0ed;return db[_0x590f('0x30')][_0x590f('0x51')]({'where':{'id':_0x5bb529['params']['id']}})[_0x590f('0x29')](handleEntityNotFound(_0x46e1a3,null))[_0x590f('0x29')](function(_0x520faa){if(_0x520faa){_0xe99fd7=_0x520faa;_0x4e9b97[_0x590f('0x34')]=_[_0x590f('0x4b')](db['ZohoField'][_0x590f('0x31')]);_0x4e9b97['query']=_['keys'](_0x5bb529[_0x590f('0x36')]);_0x4e9b97[_0x590f('0x37')]=_['intersection'](_0x4e9b97[_0x590f('0x34')],_0x4e9b97[_0x590f('0x36')]);_0x31b73c['attributes']=_[_0x590f('0x38')](_0x4e9b97[_0x590f('0x34')],qs[_0x590f('0x3a')](_0x5bb529[_0x590f('0x36')][_0x590f('0x3a')]));_0x31b73c[_0x590f('0x39')]=_0x31b73c[_0x590f('0x39')]['length']?_0x31b73c[_0x590f('0x39')]:_0x4e9b97[_0x590f('0x34')];_0x31b73c['order']=qs[_0x590f('0x3e')](_0x5bb529[_0x590f('0x36')][_0x590f('0x3e')]);_0x31b73c[_0x590f('0x3f')]=qs[_0x590f('0x37')](_[_0x590f('0x40')](_0x5bb529[_0x590f('0x36')],_0x4e9b97[_0x590f('0x37')]));if(_0x5bb529[_0x590f('0x36')][_0x590f('0x41')]){_0x31b73c[_0x590f('0x3f')]=_[_0x590f('0x42')](_0x31b73c[_0x590f('0x3f')],{'$or':_['map'](_0x31b73c[_0x590f('0x39')],function(_0x3f6e2d){var _0x3b48bd={};_0x3b48bd[_0x3f6e2d]={'$like':'%'+_0x5bb529[_0x590f('0x36')][_0x590f('0x41')]+'%'};return _0x3b48bd;})});}_0x31b73c=_['merge']({},_0x31b73c,_0x5bb529['options']);return _0xe99fd7[_0x590f('0x55')](_0x31b73c);}})[_0x590f('0x29')](function(_0x8565d3){if(_0x8565d3){_0x10e0ed=_0x8565d3[_0x590f('0x3b')];if(!_0x5bb529['query'][_0x590f('0x53')](_0x590f('0x3c'))){_0x31b73c[_0x590f('0x21')]=qs[_0x590f('0x21')](_0x5bb529['query'][_0x590f('0x21')]);_0x31b73c[_0x590f('0x1f')]=qs[_0x590f('0x1f')](_0x5bb529['query'][_0x590f('0x1f')]);}return _0xe99fd7[_0x590f('0x55')](_0x31b73c);}})[_0x590f('0x29')](function(_0x2943df){if(_0x2943df){return _0x2943df?{'count':_0x10e0ed,'rows':_0x2943df}:null;}})[_0x590f('0x29')](respondWithResult(_0x46e1a3,null))[_0x590f('0x48')](handleError(_0x46e1a3,null));}; \ No newline at end of file +var _0x8318=['merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','find','create','body','destroy','getFields','findOne','order','nolimit','getSubjects','ZohoField','getDescriptions','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','ZohoConfiguration','fieldName','type','model','map','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0xd3aac9,_0x501d0a){var _0x12cc11=function(_0x1d3038){while(--_0x1d3038){_0xd3aac9['push'](_0xd3aac9['shift']());}};_0x12cc11(++_0x501d0a);}(_0x8318,0x10c));var _0x8831=function(_0x4ac791,_0x316ff6){_0x4ac791=_0x4ac791-0x0;var _0x38cb33=_0x8318[_0x4ac791];return _0x38cb33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8831('0x0'));var rp=require(_0x8831('0x1'));var moment=require(_0x8831('0x2'));var BPromise=require(_0x8831('0x3'));var Mustache=require('mustache');var util=require(_0x8831('0x4'));var path=require('path');var sox=require(_0x8831('0x5'));var csv=require('to-csv');var ejs=require(_0x8831('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8831('0x7'));var squel=require(_0x8831('0x8'));var crypto=require(_0x8831('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8831('0xa'));var toCsv=require(_0x8831('0xb'));var querystring=require(_0x8831('0xc'));var Papa=require(_0x8831('0xd'));var Redis=require(_0x8831('0xe'));var authService=require(_0x8831('0xf'));var qs=require(_0x8831('0x10'));var as=require(_0x8831('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8831('0x12'));var utils=require(_0x8831('0x13'));var config=require(_0x8831('0x14'));var licenseUtil=require(_0x8831('0x15'));var db=require(_0x8831('0x16'))['db'];function respondWithStatusCode(_0x4a0714,_0x104466){_0x104466=_0x104466||0xcc;return function(_0x5ac12a){if(_0x5ac12a){return _0x4a0714[_0x8831('0x17')](_0x104466);}return _0x4a0714[_0x8831('0x18')](_0x104466)[_0x8831('0x19')]();};}function respondWithResult(_0x3e4ed3,_0x45ea38){_0x45ea38=_0x45ea38||0xc8;return function(_0x5ec25f){if(_0x5ec25f){return _0x3e4ed3[_0x8831('0x18')](_0x45ea38)[_0x8831('0x1a')](_0x5ec25f);}};}function respondWithFilteredResult(_0x15b818,_0x548965){return function(_0x5513d4){if(_0x5513d4){var _0x31af16=typeof _0x548965['offset']===_0x8831('0x1b')&&typeof _0x548965[_0x8831('0x1c')]===_0x8831('0x1b');var _0x50ba5d=_0x5513d4[_0x8831('0x1d')];var _0x460c87=_0x31af16?0x0:_0x548965[_0x8831('0x1e')];var _0x30b2cf=_0x31af16?_0x5513d4['count']:_0x548965['offset']+_0x548965[_0x8831('0x1c')];var _0x5a9730;if(_0x30b2cf>=_0x50ba5d){_0x30b2cf=_0x50ba5d;_0x5a9730=0xc8;}else{_0x5a9730=0xce;}_0x15b818['status'](_0x5a9730);return _0x15b818[_0x8831('0x1f')](_0x8831('0x20'),_0x460c87+'-'+_0x30b2cf+'/'+_0x50ba5d)[_0x8831('0x1a')](_0x5513d4);}return null;};}function patchUpdates(_0x109f94){return function(_0x20fdcf){try{jsonpatch[_0x8831('0x21')](_0x20fdcf,_0x109f94,!![]);}catch(_0x2d9b42){return BPromise[_0x8831('0x22')](_0x2d9b42);}return _0x20fdcf[_0x8831('0x23')]();};}function saveUpdates(_0xc198d1,_0x4b5c1d){return function(_0x384086){if(_0x384086){return _0x384086[_0x8831('0x24')](_0xc198d1)['then'](function(_0x57314b){return _0x57314b;});}return null;};}function removeEntity(_0x34444f,_0x226127){return function(_0x465411){if(_0x465411){return _0x465411['destroy']()[_0x8831('0x25')](function(){_0x34444f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43d79b,_0x51e8f4){return function(_0x467318){if(!_0x467318){_0x43d79b[_0x8831('0x17')](0x194);}return _0x467318;};}function handleError(_0x250574,_0x123397){_0x123397=_0x123397||0x1f4;return function(_0x2a7acc){logger['error'](_0x2a7acc[_0x8831('0x26')]);if(_0x2a7acc[_0x8831('0x27')]){delete _0x2a7acc['name'];}_0x250574[_0x8831('0x18')](_0x123397)[_0x8831('0x28')](_0x2a7acc);};}exports[_0x8831('0x29')]=function(_0x207529,_0x409436){var _0x2796bc={},_0x568a50={},_0x40c2e4={'count':0x0,'rows':[]};var _0x37c7e8=_['map'](db[_0x8831('0x2a')]['rawAttributes'],function(_0x32c432){return{'name':_0x32c432[_0x8831('0x2b')],'type':_0x32c432[_0x8831('0x2c')]['key']};});_0x568a50[_0x8831('0x2d')]=_[_0x8831('0x2e')](_0x37c7e8,_0x8831('0x27'));_0x568a50[_0x8831('0x2f')]=_['keys'](_0x207529[_0x8831('0x2f')]);_0x568a50[_0x8831('0x30')]=_['intersection'](_0x568a50[_0x8831('0x2d')],_0x568a50['query']);_0x2796bc[_0x8831('0x31')]=_['intersection'](_0x568a50['model'],qs['fields'](_0x207529['query'][_0x8831('0x32')]));_0x2796bc[_0x8831('0x31')]=_0x2796bc['attributes'][_0x8831('0x33')]?_0x2796bc['attributes']:_0x568a50[_0x8831('0x2d')];if(!_0x207529[_0x8831('0x2f')][_0x8831('0x34')]('nolimit')){_0x2796bc['limit']=qs[_0x8831('0x1c')](_0x207529['query'][_0x8831('0x1c')]);_0x2796bc['offset']=qs[_0x8831('0x1e')](_0x207529[_0x8831('0x2f')][_0x8831('0x1e')]);}_0x2796bc['order']=qs[_0x8831('0x35')](_0x207529[_0x8831('0x2f')][_0x8831('0x35')]);_0x2796bc[_0x8831('0x36')]=qs[_0x8831('0x30')](_[_0x8831('0x37')](_0x207529[_0x8831('0x2f')],_0x568a50[_0x8831('0x30')]),_0x37c7e8);if(_0x207529[_0x8831('0x2f')]['filter']){_0x2796bc['where']=_[_0x8831('0x38')](_0x2796bc[_0x8831('0x36')],{'$or':_[_0x8831('0x2e')](_0x37c7e8,function(_0x466cf8){if(_0x466cf8[_0x8831('0x2c')]!==_0x8831('0x39')){var _0x5e56ee={};_0x5e56ee[_0x466cf8[_0x8831('0x27')]]={'$like':'%'+_0x207529['query'][_0x8831('0x3a')]+'%'};return _0x5e56ee;}})});}_0x2796bc=_[_0x8831('0x38')]({},_0x2796bc,_0x207529[_0x8831('0x3b')]);var _0x59eb30={'where':_0x2796bc[_0x8831('0x36')]};return db[_0x8831('0x2a')][_0x8831('0x1d')](_0x59eb30)[_0x8831('0x25')](function(_0x1c546a){_0x40c2e4[_0x8831('0x1d')]=_0x1c546a;if(_0x207529[_0x8831('0x2f')][_0x8831('0x3c')]){_0x2796bc[_0x8831('0x3d')]=[{'all':!![]}];}return db[_0x8831('0x2a')][_0x8831('0x3e')](_0x2796bc);})[_0x8831('0x25')](function(_0x52010b){_0x40c2e4[_0x8831('0x3f')]=_0x52010b;return _0x40c2e4;})[_0x8831('0x25')](respondWithFilteredResult(_0x409436,_0x2796bc))[_0x8831('0x40')](handleError(_0x409436,null));};exports[_0x8831('0x41')]=function(_0x5bceea,_0x5cc4bb){var _0x4e2746={'raw':![],'where':{'id':_0x5bceea[_0x8831('0x42')]['id']}},_0x3a2651={};_0x3a2651[_0x8831('0x2d')]=_[_0x8831('0x43')](db[_0x8831('0x2a')][_0x8831('0x44')]);_0x3a2651['query']=_[_0x8831('0x43')](_0x5bceea[_0x8831('0x2f')]);_0x3a2651[_0x8831('0x30')]=_[_0x8831('0x45')](_0x3a2651[_0x8831('0x2d')],_0x3a2651[_0x8831('0x2f')]);_0x4e2746[_0x8831('0x31')]=_[_0x8831('0x45')](_0x3a2651['model'],qs[_0x8831('0x32')](_0x5bceea[_0x8831('0x2f')][_0x8831('0x32')]));_0x4e2746[_0x8831('0x31')]=_0x4e2746['attributes'][_0x8831('0x33')]?_0x4e2746['attributes']:_0x3a2651['model'];if(_0x5bceea['query'][_0x8831('0x3c')]){_0x4e2746[_0x8831('0x3d')]=[{'all':!![]}];}_0x4e2746=_['merge']({},_0x4e2746,_0x5bceea[_0x8831('0x3b')]);return db[_0x8831('0x2a')][_0x8831('0x46')](_0x4e2746)[_0x8831('0x25')](handleEntityNotFound(_0x5cc4bb,null))[_0x8831('0x25')](respondWithResult(_0x5cc4bb,null))[_0x8831('0x40')](handleError(_0x5cc4bb,null));};exports[_0x8831('0x47')]=function(_0x206c6f,_0x3abf47){return db['ZohoConfiguration'][_0x8831('0x47')](_0x206c6f[_0x8831('0x48')],{})[_0x8831('0x25')](respondWithResult(_0x3abf47,0xc9))['catch'](handleError(_0x3abf47,null));};exports[_0x8831('0x24')]=function(_0x3507fc,_0x504503){if(_0x3507fc[_0x8831('0x48')]['id']){delete _0x3507fc['body']['id'];}return db[_0x8831('0x2a')][_0x8831('0x46')]({'where':{'id':_0x3507fc['params']['id']}})[_0x8831('0x25')](handleEntityNotFound(_0x504503,null))[_0x8831('0x25')](saveUpdates(_0x3507fc['body'],null))[_0x8831('0x25')](respondWithResult(_0x504503,null))[_0x8831('0x40')](handleError(_0x504503,null));};exports[_0x8831('0x49')]=function(_0x5e885e,_0x4090b5){return db[_0x8831('0x2a')][_0x8831('0x46')]({'where':{'id':_0x5e885e[_0x8831('0x42')]['id']}})['then'](handleEntityNotFound(_0x4090b5,null))[_0x8831('0x25')](removeEntity(_0x4090b5,null))['catch'](handleError(_0x4090b5,null));};exports[_0x8831('0x4a')]=function(_0x418150,_0x11b0cf,_0x1cb940){var _0x275bda={};var _0x3c43c4={};var _0xa4e9c7;var _0x24eee3;return db['ZohoConfiguration'][_0x8831('0x4b')]({'where':{'id':_0x418150[_0x8831('0x42')]['id']}})[_0x8831('0x25')](handleEntityNotFound(_0x11b0cf,null))[_0x8831('0x25')](function(_0x4428d8){if(_0x4428d8){_0xa4e9c7=_0x4428d8;_0x3c43c4[_0x8831('0x2d')]=_['keys'](db['ZohoField'][_0x8831('0x44')]);_0x3c43c4[_0x8831('0x2f')]=_[_0x8831('0x43')](_0x418150[_0x8831('0x2f')]);_0x3c43c4[_0x8831('0x30')]=_[_0x8831('0x45')](_0x3c43c4['model'],_0x3c43c4['query']);_0x275bda[_0x8831('0x31')]=_[_0x8831('0x45')](_0x3c43c4[_0x8831('0x2d')],qs[_0x8831('0x32')](_0x418150['query']['fields']));_0x275bda[_0x8831('0x31')]=_0x275bda[_0x8831('0x31')][_0x8831('0x33')]?_0x275bda[_0x8831('0x31')]:_0x3c43c4[_0x8831('0x2d')];_0x275bda[_0x8831('0x4c')]=qs[_0x8831('0x35')](_0x418150['query'][_0x8831('0x35')]);_0x275bda[_0x8831('0x36')]=qs['filters'](_[_0x8831('0x37')](_0x418150[_0x8831('0x2f')],_0x3c43c4[_0x8831('0x30')]));if(_0x418150[_0x8831('0x2f')][_0x8831('0x3a')]){_0x275bda[_0x8831('0x36')]=_['merge'](_0x275bda[_0x8831('0x36')],{'$or':_[_0x8831('0x2e')](_0x275bda['attributes'],function(_0x36d8da){var _0x319522={};_0x319522[_0x36d8da]={'$like':'%'+_0x418150[_0x8831('0x2f')]['filter']+'%'};return _0x319522;})});}_0x275bda=_[_0x8831('0x38')]({},_0x275bda,_0x418150['options']);return _0xa4e9c7[_0x8831('0x4a')](_0x275bda);}})[_0x8831('0x25')](function(_0x767193){if(_0x767193){_0x24eee3=_0x767193[_0x8831('0x33')];if(!_0x418150[_0x8831('0x2f')][_0x8831('0x34')](_0x8831('0x4d'))){_0x275bda[_0x8831('0x1c')]=qs['limit'](_0x418150[_0x8831('0x2f')]['limit']);_0x275bda[_0x8831('0x1e')]=qs[_0x8831('0x1e')](_0x418150[_0x8831('0x2f')][_0x8831('0x1e')]);}return _0xa4e9c7[_0x8831('0x4a')](_0x275bda);}})[_0x8831('0x25')](function(_0x2df5db){if(_0x2df5db){return _0x2df5db?{'count':_0x24eee3,'rows':_0x2df5db}:null;}})[_0x8831('0x25')](respondWithResult(_0x11b0cf,null))[_0x8831('0x40')](handleError(_0x11b0cf,null));};exports[_0x8831('0x4e')]=function(_0x350a9e,_0x2a370c,_0x4bf462){var _0x5ac142={};var _0xabe886={};var _0x4ea6f7;var _0x4dcc1b;return db[_0x8831('0x2a')][_0x8831('0x4b')]({'where':{'id':_0x350a9e['params']['id']}})['then'](handleEntityNotFound(_0x2a370c,null))['then'](function(_0x55f9a1){if(_0x55f9a1){_0x4ea6f7=_0x55f9a1;_0xabe886[_0x8831('0x2d')]=_[_0x8831('0x43')](db[_0x8831('0x4f')][_0x8831('0x44')]);_0xabe886[_0x8831('0x2f')]=_['keys'](_0x350a9e[_0x8831('0x2f')]);_0xabe886[_0x8831('0x30')]=_['intersection'](_0xabe886['model'],_0xabe886[_0x8831('0x2f')]);_0x5ac142[_0x8831('0x31')]=_[_0x8831('0x45')](_0xabe886[_0x8831('0x2d')],qs[_0x8831('0x32')](_0x350a9e[_0x8831('0x2f')][_0x8831('0x32')]));_0x5ac142[_0x8831('0x31')]=_0x5ac142[_0x8831('0x31')][_0x8831('0x33')]?_0x5ac142['attributes']:_0xabe886['model'];_0x5ac142[_0x8831('0x4c')]=qs['sort'](_0x350a9e['query']['sort']);_0x5ac142[_0x8831('0x36')]=qs[_0x8831('0x30')](_[_0x8831('0x37')](_0x350a9e['query'],_0xabe886['filters']));if(_0x350a9e[_0x8831('0x2f')][_0x8831('0x3a')]){_0x5ac142['where']=_[_0x8831('0x38')](_0x5ac142[_0x8831('0x36')],{'$or':_[_0x8831('0x2e')](_0x5ac142['attributes'],function(_0x48f8c2){var _0x4661be={};_0x4661be[_0x48f8c2]={'$like':'%'+_0x350a9e[_0x8831('0x2f')][_0x8831('0x3a')]+'%'};return _0x4661be;})});}_0x5ac142=_[_0x8831('0x38')]({},_0x5ac142,_0x350a9e[_0x8831('0x3b')]);return _0x4ea6f7['getSubjects'](_0x5ac142);}})[_0x8831('0x25')](function(_0x59ca5b){if(_0x59ca5b){_0x4dcc1b=_0x59ca5b[_0x8831('0x33')];if(!_0x350a9e[_0x8831('0x2f')]['hasOwnProperty']('nolimit')){_0x5ac142[_0x8831('0x1c')]=qs[_0x8831('0x1c')](_0x350a9e[_0x8831('0x2f')][_0x8831('0x1c')]);_0x5ac142[_0x8831('0x1e')]=qs[_0x8831('0x1e')](_0x350a9e[_0x8831('0x2f')][_0x8831('0x1e')]);}return _0x4ea6f7[_0x8831('0x4e')](_0x5ac142);}})[_0x8831('0x25')](function(_0x24fff5){if(_0x24fff5){return _0x24fff5?{'count':_0x4dcc1b,'rows':_0x24fff5}:null;}})[_0x8831('0x25')](respondWithResult(_0x2a370c,null))[_0x8831('0x40')](handleError(_0x2a370c,null));};exports[_0x8831('0x50')]=function(_0x1f1f5e,_0x2d8dc8,_0x4d2df7){var _0x231fc7={};var _0xd95000={};var _0x27e050;var _0x2665e1;return db['ZohoConfiguration'][_0x8831('0x4b')]({'where':{'id':_0x1f1f5e['params']['id']}})['then'](handleEntityNotFound(_0x2d8dc8,null))['then'](function(_0x2ccb44){if(_0x2ccb44){_0x27e050=_0x2ccb44;_0xd95000[_0x8831('0x2d')]=_[_0x8831('0x43')](db[_0x8831('0x4f')][_0x8831('0x44')]);_0xd95000[_0x8831('0x2f')]=_[_0x8831('0x43')](_0x1f1f5e[_0x8831('0x2f')]);_0xd95000[_0x8831('0x30')]=_[_0x8831('0x45')](_0xd95000[_0x8831('0x2d')],_0xd95000[_0x8831('0x2f')]);_0x231fc7['attributes']=_[_0x8831('0x45')](_0xd95000[_0x8831('0x2d')],qs[_0x8831('0x32')](_0x1f1f5e['query']['fields']));_0x231fc7[_0x8831('0x31')]=_0x231fc7['attributes'][_0x8831('0x33')]?_0x231fc7[_0x8831('0x31')]:_0xd95000[_0x8831('0x2d')];_0x231fc7[_0x8831('0x4c')]=qs[_0x8831('0x35')](_0x1f1f5e[_0x8831('0x2f')][_0x8831('0x35')]);_0x231fc7[_0x8831('0x36')]=qs['filters'](_[_0x8831('0x37')](_0x1f1f5e[_0x8831('0x2f')],_0xd95000[_0x8831('0x30')]));if(_0x1f1f5e['query'][_0x8831('0x3a')]){_0x231fc7[_0x8831('0x36')]=_[_0x8831('0x38')](_0x231fc7[_0x8831('0x36')],{'$or':_[_0x8831('0x2e')](_0x231fc7[_0x8831('0x31')],function(_0x273545){var _0x59f13f={};_0x59f13f[_0x273545]={'$like':'%'+_0x1f1f5e[_0x8831('0x2f')][_0x8831('0x3a')]+'%'};return _0x59f13f;})});}_0x231fc7=_[_0x8831('0x38')]({},_0x231fc7,_0x1f1f5e['options']);return _0x27e050[_0x8831('0x50')](_0x231fc7);}})[_0x8831('0x25')](function(_0xd107aa){if(_0xd107aa){_0x2665e1=_0xd107aa['length'];if(!_0x1f1f5e[_0x8831('0x2f')][_0x8831('0x34')](_0x8831('0x4d'))){_0x231fc7[_0x8831('0x1c')]=qs[_0x8831('0x1c')](_0x1f1f5e[_0x8831('0x2f')][_0x8831('0x1c')]);_0x231fc7[_0x8831('0x1e')]=qs[_0x8831('0x1e')](_0x1f1f5e['query'][_0x8831('0x1e')]);}return _0x27e050[_0x8831('0x50')](_0x231fc7);}})[_0x8831('0x25')](function(_0x2491a4){if(_0x2491a4){return _0x2491a4?{'count':_0x2665e1,'rows':_0x2491a4}:null;}})[_0x8831('0x25')](respondWithResult(_0x2d8dc8,null))[_0x8831('0x40')](handleError(_0x2d8dc8,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 296309e..21bf30a 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 _0xd610=['int_zoho_configurations','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','ZohoConfiguration'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xd610,0x14b));var _0x0d61=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xd610[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x0d61('0x0'));var util=require('util');var logger=require(_0x0d61('0x1'))('api');var moment=require(_0x0d61('0x2'));var BPromise=require(_0x0d61('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d61('0x4'));var rimraf=require(_0x0d61('0x5'));var config=require(_0x0d61('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x0d61('0x7')]=function(_0x5012fe,_0xb88653){return _0x5012fe[_0x0d61('0x8')](_0x0d61('0x9'),attributes,{'tableName':_0x0d61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8cf=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','lodash','bluebird','request-promise'];(function(_0x44caf2,_0x8ffb16){var _0x25978d=function(_0x1a2e61){while(--_0x1a2e61){_0x44caf2['push'](_0x44caf2['shift']());}};_0x25978d(++_0x8ffb16);}(_0xf8cf,0xb1));var _0xff8c=function(_0x1c5d5d,_0x168831){_0x1c5d5d=_0x1c5d5d-0x0;var _0xf82736=_0xf8cf[_0x1c5d5d];return _0xf82736;};'use strict';var _=require(_0xff8c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xff8c('0x1'));var rp=require(_0xff8c('0x2'));var fs=require('fs');var path=require(_0xff8c('0x3'));var rimraf=require(_0xff8c('0x4'));var config=require(_0xff8c('0x5'));var attributes=require(_0xff8c('0x6'));module['exports']=function(_0x4ca4c4,_0x47fd33){return _0x4ca4c4['define'](_0xff8c('0x7'),attributes,{'tableName':_0xff8c('0x8'),'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 3e90a9e..ffdcd55 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 _0x93fe=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0xfce4a7,_0x1d028e){var _0x2ea783=function(_0x47d19b){while(--_0x47d19b){_0xfce4a7['push'](_0xfce4a7['shift']());}};_0x2ea783(++_0x1d028e);}(_0x93fe,0xbb));var _0xe93f=function(_0x400174,_0x48e677){_0x400174=_0x400174-0x0;var _0xbc2804=_0x93fe[_0x400174];return _0xbc2804;};'use strict';var _=require(_0xe93f('0x0'));var util=require(_0xe93f('0x1'));var moment=require(_0xe93f('0x2'));var BPromise=require(_0xe93f('0x3'));var rs=require(_0xe93f('0x4'));var fs=require('fs');var Redis=require(_0xe93f('0x5'));var db=require(_0xe93f('0x6'))['db'];var utils=require(_0xe93f('0x7'));var logger=require(_0xe93f('0x8'))(_0xe93f('0x9'));var config=require('../../config/environment');var jayson=require(_0xe93f('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24071a,_0x334d92,_0xb142a6){return new BPromise(function(_0x3ee183,_0x5c5242){return client[_0xe93f('0xb')](_0x24071a,_0xb142a6)[_0xe93f('0xc')](function(_0x466d56){logger[_0xe93f('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x334d92,_0xe93f('0xe'));logger[_0xe93f('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x334d92,'request\x20sent',JSON['stringify'](_0x466d56));if(_0x466d56[_0xe93f('0x10')]){if(_0x466d56['error'][_0xe93f('0x11')]===0x1f4){logger[_0xe93f('0x10')](_0xe93f('0x12'),_0x334d92,_0x466d56['error']['message']);return _0x5c5242(_0x466d56['error']['message']);}logger[_0xe93f('0x10')](_0xe93f('0x12'),_0x334d92,_0x466d56['error'][_0xe93f('0x13')]);return _0x3ee183(_0x466d56[_0xe93f('0x10')][_0xe93f('0x13')]);}else{logger[_0xe93f('0xd')](_0xe93f('0x12'),_0x334d92,_0xe93f('0xe'));_0x3ee183(_0x466d56['result'][_0xe93f('0x13')]);}})[_0xe93f('0x14')](function(_0x599e42){logger[_0xe93f('0x10')](_0xe93f('0x12'),_0x334d92,_0x599e42);_0x5c5242(_0x599e42);});});} \ No newline at end of file +var _0x468e=['stringify','code','ZohoConfiguration,\x20%s,\x20%s','message','error','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x468e,0x160));var _0xe468=function(_0x30ee42,_0x3af329){_0x30ee42=_0x30ee42-0x0;var _0x4104b2=_0x468e[_0x30ee42];return _0x4104b2;};'use strict';var _=require(_0xe468('0x0'));var util=require(_0xe468('0x1'));var moment=require('moment');var BPromise=require(_0xe468('0x2'));var rs=require(_0xe468('0x3'));var fs=require('fs');var Redis=require(_0xe468('0x4'));var db=require(_0xe468('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe468('0x6'))(_0xe468('0x7'));var config=require(_0xe468('0x8'));var jayson=require(_0xe468('0x9'));var client=jayson['client'][_0xe468('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8ddf5,_0x5c1aa5,_0x2884ca){return new BPromise(function(_0x1f8b30,_0x78d0f1){return client['request'](_0x8ddf5,_0x2884ca)[_0xe468('0xb')](function(_0x50b929){logger[_0xe468('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c1aa5,_0xe468('0xd'));logger[_0xe468('0xe')](_0xe468('0xf'),_0x5c1aa5,'request\x20sent',JSON[_0xe468('0x10')](_0x50b929));if(_0x50b929['error']){if(_0x50b929['error'][_0xe468('0x11')]===0x1f4){logger['error'](_0xe468('0x12'),_0x5c1aa5,_0x50b929['error'][_0xe468('0x13')]);return _0x78d0f1(_0x50b929['error']['message']);}logger[_0xe468('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c1aa5,_0x50b929[_0xe468('0x14')]['message']);return _0x1f8b30(_0x50b929[_0xe468('0x14')]['message']);}else{logger[_0xe468('0xc')](_0xe468('0x12'),_0x5c1aa5,'request\x20sent');_0x1f8b30(_0x50b929[_0xe468('0x15')][_0xe468('0x13')]);}})[_0xe468('0x16')](function(_0x2d5efd){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x5c1aa5,_0x2d5efd);_0x78d0f1(_0x2d5efd);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 45ffe11..f7f16fa 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 _0x53cf=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show','create'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x53cf,0x82));var _0xf53c=function(_0x3cce82,_0x5a25dc){_0x3cce82=_0x3cce82-0x0;var _0x3b1548=_0x53cf[_0x3cce82];return _0x3b1548;};'use strict';var multer=require('multer');var util=require(_0xf53c('0x0'));var path=require(_0xf53c('0x1'));var timeout=require(_0xf53c('0x2'));var express=require(_0xf53c('0x3'));var router=express[_0xf53c('0x4')]();var fs_extra=require(_0xf53c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf53c('0x6'));var controller=require(_0xf53c('0x7'));router[_0xf53c('0x8')]('/',auth['isAuthenticated'](),controller[_0xf53c('0x9')]);router['get'](_0xf53c('0xa'),auth[_0xf53c('0xb')](),controller[_0xf53c('0xc')]);router['post']('/',auth[_0xf53c('0xb')](),controller[_0xf53c('0xd')]);router[_0xf53c('0xe')](_0xf53c('0xa'),auth[_0xf53c('0xb')](),controller['update']);router[_0xf53c('0xf')](_0xf53c('0xa'),auth[_0xf53c('0xb')](),controller[_0xf53c('0x10')]);module[_0xf53c('0x11')]=router; \ No newline at end of file +var _0x1f55=['index','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x291b3c,_0x25035b){var _0x280e01=function(_0x319f7f){while(--_0x319f7f){_0x291b3c['push'](_0x291b3c['shift']());}};_0x280e01(++_0x25035b);}(_0x1f55,0xf6));var _0x51f5=function(_0x2731fa,_0x20c8b8){_0x2731fa=_0x2731fa-0x0;var _0x3e79ec=_0x1f55[_0x2731fa];return _0x3e79ec;};'use strict';var multer=require(_0x51f5('0x0'));var util=require(_0x51f5('0x1'));var path=require(_0x51f5('0x2'));var timeout=require('connect-timeout');var express=require(_0x51f5('0x3'));var router=express[_0x51f5('0x4')]();var fs_extra=require(_0x51f5('0x5'));var auth=require(_0x51f5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x51f5('0x7'));var controller=require('./intZohoField.controller');router[_0x51f5('0x8')]('/',auth['isAuthenticated'](),controller[_0x51f5('0x9')]);router[_0x51f5('0x8')](_0x51f5('0xa'),auth[_0x51f5('0xb')](),controller[_0x51f5('0xc')]);router['post']('/',auth[_0x51f5('0xb')](),controller['create']);router[_0x51f5('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x51f5('0xe')]);router[_0x51f5('0xf')]('/:id',auth[_0x51f5('0xb')](),controller[_0x51f5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index fdd119b..9a94e0e 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 _0xe82d=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0xe82d,0x1a6));var _0xde82=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xe82d[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require(_0xde82('0x0'));module[_0xde82('0x1')]={'type':{'type':Sequelize[_0xde82('0x2')](_0xde82('0x3'),_0xde82('0x4'),_0xde82('0x5'),'keyValue',_0xde82('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xde82('0x7')]},'keyType':{'type':Sequelize[_0xde82('0x2')](_0xde82('0x3'),'variable',_0xde82('0x5'))},'keyContent':{'type':Sequelize[_0xde82('0x7')]},'idField':{'type':Sequelize[_0xde82('0x7')]},'nameField':{'type':Sequelize[_0xde82('0x7')]},'customField':{'type':Sequelize[_0xde82('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde82('0x7')]}}; \ No newline at end of file +var _0xc92e=['keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x452fde,_0x339a5f){var _0x36ecee=function(_0x830839){while(--_0x830839){_0x452fde['push'](_0x452fde['shift']());}};_0x36ecee(++_0x339a5f);}(_0xc92e,0x1c6));var _0xec92=function(_0x5b277d,_0x531eab){_0x5b277d=_0x5b277d-0x0;var _0x2bb765=_0xc92e[_0x5b277d];return _0x2bb765;};'use strict';var Sequelize=require(_0xec92('0x0'));module[_0xec92('0x1')]={'type':{'type':Sequelize['ENUM'](_0xec92('0x2'),_0xec92('0x3'),_0xec92('0x4'),_0xec92('0x5'),'picklist'),'defaultValue':_0xec92('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xec92('0x6')]},'keyType':{'type':Sequelize[_0xec92('0x7')](_0xec92('0x2'),_0xec92('0x3'),_0xec92('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xec92('0x6')]},'customField':{'type':Sequelize[_0xec92('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec92('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index c3eceb0..b8e50d7 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 _0xe540=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','map','VIRTUAL','options','ZohoField','includeAll','include','findAll','catch','show','params','length','merge','find','create','body','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x4166fe,_0x313c65){var _0x14d5bd=function(_0x5c55d3){while(--_0x5c55d3){_0x4166fe['push'](_0x4166fe['shift']());}};_0x14d5bd(++_0x313c65);}(_0xe540,0xe6));var _0x0e54=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe540[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x0e54('0x0'));var rimraf=require(_0x0e54('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e54('0x2'));var rp=require(_0x0e54('0x3'));var moment=require(_0x0e54('0x4'));var BPromise=require(_0x0e54('0x5'));var Mustache=require(_0x0e54('0x6'));var util=require(_0x0e54('0x7'));var path=require(_0x0e54('0x8'));var sox=require(_0x0e54('0x9'));var csv=require(_0x0e54('0xa'));var ejs=require(_0x0e54('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e54('0xc'));var squel=require(_0x0e54('0xd'));var crypto=require(_0x0e54('0xe'));var jsforce=require(_0x0e54('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0e54('0xa'));var querystring=require(_0x0e54('0x10'));var Papa=require(_0x0e54('0x11'));var Redis=require(_0x0e54('0x12'));var authService=require(_0x0e54('0x13'));var qs=require(_0x0e54('0x14'));var as=require(_0x0e54('0x15'));var hardwareService=require(_0x0e54('0x16'));var logger=require(_0x0e54('0x17'))(_0x0e54('0x18'));var utils=require(_0x0e54('0x19'));var config=require(_0x0e54('0x1a'));var licenseUtil=require(_0x0e54('0x1b'));var db=require(_0x0e54('0x1c'))['db'];function respondWithStatusCode(_0x43fb6c,_0x4fd9fa){_0x4fd9fa=_0x4fd9fa||0xcc;return function(_0x2768f2){if(_0x2768f2){return _0x43fb6c[_0x0e54('0x1d')](_0x4fd9fa);}return _0x43fb6c[_0x0e54('0x1e')](_0x4fd9fa)[_0x0e54('0x1f')]();};}function respondWithResult(_0x1efe9f,_0x1e76a1){_0x1e76a1=_0x1e76a1||0xc8;return function(_0x18c586){if(_0x18c586){return _0x1efe9f['status'](_0x1e76a1)[_0x0e54('0x20')](_0x18c586);}};}function respondWithFilteredResult(_0x252593,_0x239d0d){return function(_0xec8030){if(_0xec8030){var _0x2a2095=typeof _0x239d0d['offset']===_0x0e54('0x21')&&typeof _0x239d0d['limit']==='undefined';var _0x4ae0c1=_0xec8030[_0x0e54('0x22')];var _0x1069d9=_0x2a2095?0x0:_0x239d0d['offset'];var _0x405b65=_0x2a2095?_0xec8030[_0x0e54('0x22')]:_0x239d0d[_0x0e54('0x23')]+_0x239d0d[_0x0e54('0x24')];var _0x53cb8a;if(_0x405b65>=_0x4ae0c1){_0x405b65=_0x4ae0c1;_0x53cb8a=0xc8;}else{_0x53cb8a=0xce;}_0x252593[_0x0e54('0x1e')](_0x53cb8a);return _0x252593[_0x0e54('0x25')]('Content-Range',_0x1069d9+'-'+_0x405b65+'/'+_0x4ae0c1)['json'](_0xec8030);}return null;};}function patchUpdates(_0x57aed3){return function(_0x1ad029){try{jsonpatch[_0x0e54('0x26')](_0x1ad029,_0x57aed3,!![]);}catch(_0x5873a9){return BPromise[_0x0e54('0x27')](_0x5873a9);}return _0x1ad029[_0x0e54('0x28')]();};}function saveUpdates(_0x3f2fad,_0xd7b36b){return function(_0x3dafe6){if(_0x3dafe6){return _0x3dafe6[_0x0e54('0x29')](_0x3f2fad)[_0x0e54('0x2a')](function(_0x4b2726){return _0x4b2726;});}return null;};}function removeEntity(_0x1db02e,_0x5b5b48){return function(_0x2dc303){if(_0x2dc303){return _0x2dc303[_0x0e54('0x2b')]()[_0x0e54('0x2a')](function(){_0x1db02e[_0x0e54('0x1e')](0xcc)[_0x0e54('0x1f')]();});}};}function handleEntityNotFound(_0x4e0539,_0x1611d1){return function(_0xa32d3d){if(!_0xa32d3d){_0x4e0539[_0x0e54('0x1d')](0x194);}return _0xa32d3d;};}function handleError(_0x1ca9b1,_0x53417e){_0x53417e=_0x53417e||0x1f4;return function(_0xea6172){logger[_0x0e54('0x2c')](_0xea6172['stack']);if(_0xea6172['name']){delete _0xea6172[_0x0e54('0x2d')];}_0x1ca9b1['status'](_0x53417e)[_0x0e54('0x2e')](_0xea6172);};}exports[_0x0e54('0x2f')]=function(_0x5d36d8,_0x4a5e23){var _0x472aa3={},_0x11359c={},_0x25a23b={'count':0x0,'rows':[]};var _0x58ffc8=_['map'](db['ZohoField'][_0x0e54('0x30')],function(_0x57d0a4){return{'name':_0x57d0a4[_0x0e54('0x31')],'type':_0x57d0a4['type'][_0x0e54('0x32')]};});_0x11359c[_0x0e54('0x33')]=_['map'](_0x58ffc8,_0x0e54('0x2d'));_0x11359c[_0x0e54('0x34')]=_[_0x0e54('0x35')](_0x5d36d8[_0x0e54('0x34')]);_0x11359c[_0x0e54('0x36')]=_[_0x0e54('0x37')](_0x11359c[_0x0e54('0x33')],_0x11359c[_0x0e54('0x34')]);_0x472aa3['attributes']=_[_0x0e54('0x37')](_0x11359c[_0x0e54('0x33')],qs[_0x0e54('0x38')](_0x5d36d8[_0x0e54('0x34')][_0x0e54('0x38')]));_0x472aa3['attributes']=_0x472aa3[_0x0e54('0x39')]['length']?_0x472aa3[_0x0e54('0x39')]:_0x11359c[_0x0e54('0x33')];if(!_0x5d36d8[_0x0e54('0x34')][_0x0e54('0x3a')]('nolimit')){_0x472aa3[_0x0e54('0x24')]=qs[_0x0e54('0x24')](_0x5d36d8['query'][_0x0e54('0x24')]);_0x472aa3[_0x0e54('0x23')]=qs[_0x0e54('0x23')](_0x5d36d8[_0x0e54('0x34')][_0x0e54('0x23')]);}_0x472aa3[_0x0e54('0x3b')]=qs['sort'](_0x5d36d8[_0x0e54('0x34')][_0x0e54('0x3c')]);_0x472aa3['where']=qs['filters'](_['pick'](_0x5d36d8[_0x0e54('0x34')],_0x11359c['filters']),_0x58ffc8);if(_0x5d36d8['query'][_0x0e54('0x3d')]){_0x472aa3[_0x0e54('0x3e')]=_['merge'](_0x472aa3[_0x0e54('0x3e')],{'$or':_[_0x0e54('0x3f')](_0x58ffc8,function(_0x1e32c6){if(_0x1e32c6['type']!==_0x0e54('0x40')){var _0xd23491={};_0xd23491[_0x1e32c6[_0x0e54('0x2d')]]={'$like':'%'+_0x5d36d8['query']['filter']+'%'};return _0xd23491;}})});}_0x472aa3=_['merge']({},_0x472aa3,_0x5d36d8[_0x0e54('0x41')]);var _0x7f3bad={'where':_0x472aa3[_0x0e54('0x3e')]};return db[_0x0e54('0x42')][_0x0e54('0x22')](_0x7f3bad)['then'](function(_0x2a2ce4){_0x25a23b[_0x0e54('0x22')]=_0x2a2ce4;if(_0x5d36d8[_0x0e54('0x34')][_0x0e54('0x43')]){_0x472aa3[_0x0e54('0x44')]=[{'all':!![]}];}return db['ZohoField'][_0x0e54('0x45')](_0x472aa3);})[_0x0e54('0x2a')](function(_0x18dd89){_0x25a23b['rows']=_0x18dd89;return _0x25a23b;})[_0x0e54('0x2a')](respondWithFilteredResult(_0x4a5e23,_0x472aa3))[_0x0e54('0x46')](handleError(_0x4a5e23,null));};exports[_0x0e54('0x47')]=function(_0x59a630,_0x381016){var _0x3e2b2c={'raw':!![],'where':{'id':_0x59a630[_0x0e54('0x48')]['id']}},_0x33c8e0={};_0x33c8e0[_0x0e54('0x33')]=_['keys'](db[_0x0e54('0x42')][_0x0e54('0x30')]);_0x33c8e0[_0x0e54('0x34')]=_[_0x0e54('0x35')](_0x59a630[_0x0e54('0x34')]);_0x33c8e0[_0x0e54('0x36')]=_[_0x0e54('0x37')](_0x33c8e0['model'],_0x33c8e0[_0x0e54('0x34')]);_0x3e2b2c[_0x0e54('0x39')]=_[_0x0e54('0x37')](_0x33c8e0[_0x0e54('0x33')],qs['fields'](_0x59a630['query'][_0x0e54('0x38')]));_0x3e2b2c[_0x0e54('0x39')]=_0x3e2b2c[_0x0e54('0x39')][_0x0e54('0x49')]?_0x3e2b2c[_0x0e54('0x39')]:_0x33c8e0['model'];if(_0x59a630[_0x0e54('0x34')]['includeAll']){_0x3e2b2c[_0x0e54('0x44')]=[{'all':!![]}];}_0x3e2b2c=_[_0x0e54('0x4a')]({},_0x3e2b2c,_0x59a630[_0x0e54('0x41')]);return db['ZohoField'][_0x0e54('0x4b')](_0x3e2b2c)[_0x0e54('0x2a')](handleEntityNotFound(_0x381016,null))[_0x0e54('0x2a')](respondWithResult(_0x381016,null))[_0x0e54('0x46')](handleError(_0x381016,null));};exports[_0x0e54('0x4c')]=function(_0x28f543,_0x396c98){return db['ZohoField'][_0x0e54('0x4c')](_0x28f543[_0x0e54('0x4d')],{})[_0x0e54('0x2a')](respondWithResult(_0x396c98,0xc9))['catch'](handleError(_0x396c98,null));};exports['update']=function(_0x42b498,_0x49c16d){if(_0x42b498[_0x0e54('0x4d')]['id']){delete _0x42b498['body']['id'];}return db[_0x0e54('0x42')][_0x0e54('0x4b')]({'where':{'id':_0x42b498[_0x0e54('0x48')]['id']}})['then'](handleEntityNotFound(_0x49c16d,null))['then'](saveUpdates(_0x42b498[_0x0e54('0x4d')],null))[_0x0e54('0x2a')](respondWithResult(_0x49c16d,null))[_0x0e54('0x46')](handleError(_0x49c16d,null));};exports[_0x0e54('0x2b')]=function(_0x50c290,_0xa300ce){return db[_0x0e54('0x42')][_0x0e54('0x4b')]({'where':{'id':_0x50c290[_0x0e54('0x48')]['id']}})[_0x0e54('0x2a')](handleEntityNotFound(_0xa300ce,null))[_0x0e54('0x2a')](removeEntity(_0xa300ce,null))[_0x0e54('0x46')](handleError(_0xa300ce,null));}; \ No newline at end of file +var _0x2a19=['merge','includeAll','include','ZohoField','rows','catch','show','options','find','create','body','update','params','destroy','eml-format','rimraf','request-promise','moment','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x2fd82b,_0x26d7e0){var _0x5bbaa7=function(_0x72afda){while(--_0x72afda){_0x2fd82b['push'](_0x2fd82b['shift']());}};_0x5bbaa7(++_0x26d7e0);}(_0x2a19,0x199));var _0x92a1=function(_0x2fe708,_0x5b6dc1){_0x2fe708=_0x2fe708-0x0;var _0x920a50=_0x2a19[_0x2fe708];return _0x920a50;};'use strict';var emlformat=require(_0x92a1('0x0'));var rimraf=require(_0x92a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x92a1('0x2'));var moment=require(_0x92a1('0x3'));var BPromise=require(_0x92a1('0x4'));var Mustache=require(_0x92a1('0x5'));var util=require(_0x92a1('0x6'));var path=require(_0x92a1('0x7'));var sox=require('sox');var csv=require(_0x92a1('0x8'));var ejs=require(_0x92a1('0x9'));var fs=require('fs');var fs_extra=require(_0x92a1('0xa'));var _=require(_0x92a1('0xb'));var squel=require(_0x92a1('0xc'));var crypto=require(_0x92a1('0xd'));var jsforce=require(_0x92a1('0xe'));var deskjs=require(_0x92a1('0xf'));var toCsv=require(_0x92a1('0x8'));var querystring=require(_0x92a1('0x10'));var Papa=require(_0x92a1('0x11'));var Redis=require(_0x92a1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x92a1('0x13'));var as=require(_0x92a1('0x14'));var hardwareService=require(_0x92a1('0x15'));var logger=require(_0x92a1('0x16'))('api');var utils=require(_0x92a1('0x17'));var config=require(_0x92a1('0x18'));var licenseUtil=require(_0x92a1('0x19'));var db=require(_0x92a1('0x1a'))['db'];function respondWithStatusCode(_0x838615,_0x3454bd){_0x3454bd=_0x3454bd||0xcc;return function(_0x5cbf18){if(_0x5cbf18){return _0x838615[_0x92a1('0x1b')](_0x3454bd);}return _0x838615['status'](_0x3454bd)['end']();};}function respondWithResult(_0x517bb4,_0x316b6d){_0x316b6d=_0x316b6d||0xc8;return function(_0x38ed36){if(_0x38ed36){return _0x517bb4['status'](_0x316b6d)[_0x92a1('0x1c')](_0x38ed36);}};}function respondWithFilteredResult(_0x55161f,_0x4868d6){return function(_0x5567ac){if(_0x5567ac){var _0xf0957e=typeof _0x4868d6[_0x92a1('0x1d')]===_0x92a1('0x1e')&&typeof _0x4868d6[_0x92a1('0x1f')]===_0x92a1('0x1e');var _0x5b1b6a=_0x5567ac[_0x92a1('0x20')];var _0x3eca19=_0xf0957e?0x0:_0x4868d6[_0x92a1('0x1d')];var _0x570258=_0xf0957e?_0x5567ac[_0x92a1('0x20')]:_0x4868d6[_0x92a1('0x1d')]+_0x4868d6[_0x92a1('0x1f')];var _0x1e2025;if(_0x570258>=_0x5b1b6a){_0x570258=_0x5b1b6a;_0x1e2025=0xc8;}else{_0x1e2025=0xce;}_0x55161f[_0x92a1('0x21')](_0x1e2025);return _0x55161f['set'](_0x92a1('0x22'),_0x3eca19+'-'+_0x570258+'/'+_0x5b1b6a)[_0x92a1('0x1c')](_0x5567ac);}return null;};}function patchUpdates(_0x15df07){return function(_0x46be9f){try{jsonpatch[_0x92a1('0x23')](_0x46be9f,_0x15df07,!![]);}catch(_0x11531b){return BPromise[_0x92a1('0x24')](_0x11531b);}return _0x46be9f[_0x92a1('0x25')]();};}function saveUpdates(_0x33d55b,_0x412407){return function(_0x13790f){if(_0x13790f){return _0x13790f['update'](_0x33d55b)[_0x92a1('0x26')](function(_0x4f5b4e){return _0x4f5b4e;});}return null;};}function removeEntity(_0x48a0b6,_0x51de69){return function(_0x5392fc){if(_0x5392fc){return _0x5392fc['destroy']()['then'](function(){_0x48a0b6[_0x92a1('0x21')](0xcc)[_0x92a1('0x27')]();});}};}function handleEntityNotFound(_0x55f4d1,_0x18bf20){return function(_0x1e818a){if(!_0x1e818a){_0x55f4d1[_0x92a1('0x1b')](0x194);}return _0x1e818a;};}function handleError(_0x1c790b,_0x471f63){_0x471f63=_0x471f63||0x1f4;return function(_0x35fcf5){logger[_0x92a1('0x28')](_0x35fcf5[_0x92a1('0x29')]);if(_0x35fcf5[_0x92a1('0x2a')]){delete _0x35fcf5['name'];}_0x1c790b['status'](_0x471f63)[_0x92a1('0x2b')](_0x35fcf5);};}exports[_0x92a1('0x2c')]=function(_0x3d94ce,_0x59b02f){var _0x871d93={},_0xa54a22={},_0x4b6d45={'count':0x0,'rows':[]};var _0x2121d7=_['map'](db['ZohoField'][_0x92a1('0x2d')],function(_0x2d7528){return{'name':_0x2d7528[_0x92a1('0x2e')],'type':_0x2d7528[_0x92a1('0x2f')][_0x92a1('0x30')]};});_0xa54a22[_0x92a1('0x31')]=_[_0x92a1('0x32')](_0x2121d7,_0x92a1('0x2a'));_0xa54a22['query']=_[_0x92a1('0x33')](_0x3d94ce[_0x92a1('0x34')]);_0xa54a22[_0x92a1('0x35')]=_[_0x92a1('0x36')](_0xa54a22[_0x92a1('0x31')],_0xa54a22[_0x92a1('0x34')]);_0x871d93[_0x92a1('0x37')]=_[_0x92a1('0x36')](_0xa54a22['model'],qs[_0x92a1('0x38')](_0x3d94ce[_0x92a1('0x34')][_0x92a1('0x38')]));_0x871d93[_0x92a1('0x37')]=_0x871d93['attributes'][_0x92a1('0x39')]?_0x871d93[_0x92a1('0x37')]:_0xa54a22[_0x92a1('0x31')];if(!_0x3d94ce['query'][_0x92a1('0x3a')](_0x92a1('0x3b'))){_0x871d93[_0x92a1('0x1f')]=qs[_0x92a1('0x1f')](_0x3d94ce['query'][_0x92a1('0x1f')]);_0x871d93['offset']=qs[_0x92a1('0x1d')](_0x3d94ce[_0x92a1('0x34')]['offset']);}_0x871d93[_0x92a1('0x3c')]=qs[_0x92a1('0x3d')](_0x3d94ce[_0x92a1('0x34')][_0x92a1('0x3d')]);_0x871d93[_0x92a1('0x3e')]=qs['filters'](_[_0x92a1('0x3f')](_0x3d94ce[_0x92a1('0x34')],_0xa54a22['filters']),_0x2121d7);if(_0x3d94ce[_0x92a1('0x34')][_0x92a1('0x40')]){_0x871d93[_0x92a1('0x3e')]=_[_0x92a1('0x41')](_0x871d93[_0x92a1('0x3e')],{'$or':_[_0x92a1('0x32')](_0x2121d7,function(_0x691357){if(_0x691357[_0x92a1('0x2f')]!=='VIRTUAL'){var _0x3b2025={};_0x3b2025[_0x691357['name']]={'$like':'%'+_0x3d94ce[_0x92a1('0x34')][_0x92a1('0x40')]+'%'};return _0x3b2025;}})});}_0x871d93=_[_0x92a1('0x41')]({},_0x871d93,_0x3d94ce['options']);var _0x348e77={'where':_0x871d93[_0x92a1('0x3e')]};return db['ZohoField'][_0x92a1('0x20')](_0x348e77)[_0x92a1('0x26')](function(_0x274a30){_0x4b6d45['count']=_0x274a30;if(_0x3d94ce['query'][_0x92a1('0x42')]){_0x871d93[_0x92a1('0x43')]=[{'all':!![]}];}return db[_0x92a1('0x44')]['findAll'](_0x871d93);})[_0x92a1('0x26')](function(_0x1b5094){_0x4b6d45[_0x92a1('0x45')]=_0x1b5094;return _0x4b6d45;})[_0x92a1('0x26')](respondWithFilteredResult(_0x59b02f,_0x871d93))[_0x92a1('0x46')](handleError(_0x59b02f,null));};exports[_0x92a1('0x47')]=function(_0x18ed0e,_0x2359ca){var _0x3b8932={'raw':!![],'where':{'id':_0x18ed0e['params']['id']}},_0x3f1e48={};_0x3f1e48[_0x92a1('0x31')]=_[_0x92a1('0x33')](db[_0x92a1('0x44')]['rawAttributes']);_0x3f1e48[_0x92a1('0x34')]=_['keys'](_0x18ed0e[_0x92a1('0x34')]);_0x3f1e48[_0x92a1('0x35')]=_[_0x92a1('0x36')](_0x3f1e48[_0x92a1('0x31')],_0x3f1e48[_0x92a1('0x34')]);_0x3b8932['attributes']=_['intersection'](_0x3f1e48['model'],qs[_0x92a1('0x38')](_0x18ed0e[_0x92a1('0x34')][_0x92a1('0x38')]));_0x3b8932['attributes']=_0x3b8932['attributes'][_0x92a1('0x39')]?_0x3b8932[_0x92a1('0x37')]:_0x3f1e48[_0x92a1('0x31')];if(_0x18ed0e[_0x92a1('0x34')][_0x92a1('0x42')]){_0x3b8932[_0x92a1('0x43')]=[{'all':!![]}];}_0x3b8932=_[_0x92a1('0x41')]({},_0x3b8932,_0x18ed0e[_0x92a1('0x48')]);return db[_0x92a1('0x44')][_0x92a1('0x49')](_0x3b8932)[_0x92a1('0x26')](handleEntityNotFound(_0x2359ca,null))['then'](respondWithResult(_0x2359ca,null))['catch'](handleError(_0x2359ca,null));};exports[_0x92a1('0x4a')]=function(_0x154ca1,_0x3054fe){return db[_0x92a1('0x44')]['create'](_0x154ca1[_0x92a1('0x4b')],{})[_0x92a1('0x26')](respondWithResult(_0x3054fe,0xc9))[_0x92a1('0x46')](handleError(_0x3054fe,null));};exports[_0x92a1('0x4c')]=function(_0x2d9350,_0xd9d0ff){if(_0x2d9350[_0x92a1('0x4b')]['id']){delete _0x2d9350[_0x92a1('0x4b')]['id'];}return db[_0x92a1('0x44')][_0x92a1('0x49')]({'where':{'id':_0x2d9350[_0x92a1('0x4d')]['id']}})[_0x92a1('0x26')](handleEntityNotFound(_0xd9d0ff,null))[_0x92a1('0x26')](saveUpdates(_0x2d9350[_0x92a1('0x4b')],null))[_0x92a1('0x26')](respondWithResult(_0xd9d0ff,null))[_0x92a1('0x46')](handleError(_0xd9d0ff,null));};exports[_0x92a1('0x4e')]=function(_0x12c4c2,_0x63bba6){return db['ZohoField'][_0x92a1('0x49')]({'where':{'id':_0x12c4c2[_0x92a1('0x4d')]['id']}})[_0x92a1('0x26')](handleEntityNotFound(_0x63bba6,null))[_0x92a1('0x26')](removeEntity(_0x63bba6,null))[_0x92a1('0x46')](handleError(_0x63bba6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 79b6eb1..9e5d71b 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 _0x1a85=['rimraf','../../config/environment','exports','ZohoField','int_zoho_fields','idField','../../config/logger','api','moment','path'];(function(_0x3532f6,_0x2d0f54){var _0x3d230b=function(_0x23500e){while(--_0x23500e){_0x3532f6['push'](_0x3532f6['shift']());}};_0x3d230b(++_0x2d0f54);}(_0x1a85,0x178));var _0x51a8=function(_0x9efe0,_0x1e7272){_0x9efe0=_0x9efe0-0x0;var _0x232a0f=_0x1a85[_0x9efe0];return _0x232a0f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./intZohoField.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x51a8('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','ZohoField','zoho_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0x524e,0x15e));var _0xe524=function(_0x16cc65,_0x2d05be){_0x16cc65=_0x16cc65-0x0;var _0x544b90=_0x524e[_0x16cc65];return _0x544b90;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xe524('0xc'),'fields':[_0xe524('0xd'),_0xe524('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 52b0e88..9dc24da 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 _0x05c3=['lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch'];(function(_0xe17b70,_0x2c1714){var _0x3fa5c7=function(_0x152529){while(--_0x152529){_0xe17b70['push'](_0xe17b70['shift']());}};_0x3fa5c7(++_0x2c1714);}(_0x05c3,0x84));var _0x305c=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0x05c3[_0x4d7116];return _0x4593dc;};'use strict';var _=require(_0x305c('0x0'));var util=require(_0x305c('0x1'));var moment=require(_0x305c('0x2'));var BPromise=require(_0x305c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x305c('0x4'));var db=require(_0x305c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x305c('0x6'));var config=require(_0x305c('0x7'));var jayson=require(_0x305c('0x8'));var client=jayson[_0x305c('0x9')][_0x305c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x377e06,_0x12b3ad,_0x5e5d1f){return new BPromise(function(_0x555b4e,_0x4055d3){return client[_0x305c('0xb')](_0x377e06,_0x5e5d1f)['then'](function(_0xb508ac){logger['info'](_0x305c('0xc'),_0x12b3ad,'request\x20sent');logger[_0x305c('0xd')](_0x305c('0xe'),_0x12b3ad,_0x305c('0xf'),JSON[_0x305c('0x10')](_0xb508ac));if(_0xb508ac[_0x305c('0x11')]){if(_0xb508ac[_0x305c('0x11')][_0x305c('0x12')]===0x1f4){logger[_0x305c('0x11')](_0x305c('0xc'),_0x12b3ad,_0xb508ac['error'][_0x305c('0x13')]);return _0x4055d3(_0xb508ac[_0x305c('0x11')]['message']);}logger[_0x305c('0x11')]('ZohoField,\x20%s,\x20%s',_0x12b3ad,_0xb508ac['error'][_0x305c('0x13')]);return _0x555b4e(_0xb508ac[_0x305c('0x11')]['message']);}else{logger[_0x305c('0x14')](_0x305c('0xc'),_0x12b3ad,'request\x20sent');_0x555b4e(_0xb508ac['result'][_0x305c('0x13')]);}})[_0x305c('0x15')](function(_0x7884ca){logger[_0x305c('0x11')](_0x305c('0xc'),_0x12b3ad,_0x7884ca);_0x4055d3(_0x7884ca);});});} \ No newline at end of file +var _0xf20e=['request','then','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3de9d7,_0x21f552){var _0x66bf8d=function(_0x1f277b){while(--_0x1f277b){_0x3de9d7['push'](_0x3de9d7['shift']());}};_0x66bf8d(++_0x21f552);}(_0xf20e,0x136));var _0xef20=function(_0x562ec2,_0x33932b){_0x562ec2=_0x562ec2-0x0;var _0xd3a205=_0xf20e[_0x562ec2];return _0xd3a205;};'use strict';var _=require(_0xef20('0x0'));var util=require(_0xef20('0x1'));var moment=require(_0xef20('0x2'));var BPromise=require(_0xef20('0x3'));var rs=require(_0xef20('0x4'));var fs=require('fs');var Redis=require(_0xef20('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xef20('0x6'));var logger=require(_0xef20('0x7'))(_0xef20('0x8'));var config=require(_0xef20('0x9'));var jayson=require(_0xef20('0xa'));var client=jayson['client'][_0xef20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4db3eb,_0x5b13b3,_0x291db0){return new BPromise(function(_0x22d6c6,_0x2238cd){return client[_0xef20('0xc')](_0x4db3eb,_0x291db0)[_0xef20('0xd')](function(_0x329130){logger['info'](_0xef20('0xe'),_0x5b13b3,'request\x20sent');logger[_0xef20('0xf')](_0xef20('0x10'),_0x5b13b3,_0xef20('0x11'),JSON['stringify'](_0x329130));if(_0x329130[_0xef20('0x12')]){if(_0x329130[_0xef20('0x12')]['code']===0x1f4){logger[_0xef20('0x12')]('ZohoField,\x20%s,\x20%s',_0x5b13b3,_0x329130['error']['message']);return _0x2238cd(_0x329130[_0xef20('0x12')][_0xef20('0x13')]);}logger[_0xef20('0x12')](_0xef20('0xe'),_0x5b13b3,_0x329130[_0xef20('0x12')]['message']);return _0x22d6c6(_0x329130[_0xef20('0x12')][_0xef20('0x13')]);}else{logger[_0xef20('0x14')](_0xef20('0xe'),_0x5b13b3,_0xef20('0x11'));_0x22d6c6(_0x329130[_0xef20('0x15')]['message']);}})[_0xef20('0x16')](function(_0x4d1ab9){logger[_0xef20('0x12')](_0xef20('0xe'),_0x5b13b3,_0x4d1ab9);_0x2238cd(_0x4d1ab9);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index bb31985..7863d29 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x58f13e,_0x189762){var _0x565e4b=function(_0x51451f){while(--_0x51451f){_0x58f13e['push'](_0x58f13e['shift']());}};_0x565e4b(++_0x189762);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3e6b83,_0x224b71){var _0x599977=function(_0x51b428){while(--_0x51b428){_0x3e6b83['push'](_0x3e6b83['shift']());}};_0x599977(++_0x224b71);}(_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'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index e3ca1bc..8640415 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 _0x1e90=['unique_name_and_version','app.js','INTEGER','sequelize','exports','STRING'];(function(_0x113876,_0x2d243d){var _0x3da554=function(_0x4df645){while(--_0x4df645){_0x113876['push'](_0x113876['shift']());}};_0x3da554(++_0x2d243d);}(_0x1e90,0x1c5));var _0x01e9=function(_0x54482b,_0xc757f5){_0x54482b=_0x54482b-0x0;var _0x4f21ec=_0x1e90[_0x54482b];return _0x4f21ec;};'use strict';var Sequelize=require(_0x01e9('0x0'));module[_0x01e9('0x1')]={'name':{'type':Sequelize[_0x01e9('0x2')],'allowNull':![],'unique':_0x01e9('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x01e9('0x2')],'defaultValue':_0x01e9('0x4')},'filename':{'type':Sequelize[_0x01e9('0x2')]},'path':{'type':Sequelize[_0x01e9('0x2')]},'type':{'type':Sequelize[_0x01e9('0x2')]},'size':{'type':Sequelize[_0x01e9('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x01e9('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x01e9('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x01e9('0x2')]},'remoteUri':{'type':Sequelize[_0x01e9('0x2')]},'link':{'type':Sequelize[_0x01e9('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x578c=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x48c03b,_0x264ba4){var _0x5534ff=function(_0x1f7b99){while(--_0x1f7b99){_0x48c03b['push'](_0x48c03b['shift']());}};_0x5534ff(++_0x264ba4);}(_0x578c,0x1e8));var _0xc578=function(_0x3422d9,_0x53a70e){_0x3422d9=_0x3422d9-0x0;var _0x48a4b6=_0x578c[_0x3422d9];return _0x48a4b6;};'use strict';var Sequelize=require(_0xc578('0x0'));module[_0xc578('0x1')]={'name':{'type':Sequelize[_0xc578('0x2')],'allowNull':![],'unique':_0xc578('0x3')},'version':{'type':Sequelize[_0xc578('0x2')],'allowNull':![],'unique':_0xc578('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xc578('0x4')},'filename':{'type':Sequelize[_0xc578('0x2')]},'path':{'type':Sequelize[_0xc578('0x2')]},'type':{'type':Sequelize[_0xc578('0x2')]},'size':{'type':Sequelize[_0xc578('0x5')]},'active':{'type':Sequelize[_0xc578('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xc578('0x2')]},'state':{'type':Sequelize[_0xc578('0x2')],'unique':_0xc578('0x7')},'description':{'type':Sequelize[_0xc578('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc578('0x2')]},'link':{'type':Sequelize[_0xc578('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 336ed45..9f0f2fc 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 _0xc2c7=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2c7,0x134));var _0x7c2c=function(_0x7786c,_0x15a95d){_0x7786c=_0x7786c-0x0;var _0x5223d8=_0xc2c7[_0x7786c];return _0x5223d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['Integration'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['Integration'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));}; \ No newline at end of file +var _0xc1c6=['type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','Integration','rawAttributes'];(function(_0x570954,_0x38a3e3){var _0x5cf058=function(_0x3a101a){while(--_0x3a101a){_0x570954['push'](_0x570954['shift']());}};_0x5cf058(++_0x38a3e3);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x17162a,_0x16d96d){_0x17162a=_0x17162a-0x0;var _0x2163fb=_0xc1c6[_0x17162a];return _0x2163fb;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['Integration']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['Integration'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['Integration']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 78dbe97..e9b02d6 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 _0xc8e1=['path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x16af7d,_0x443055){var _0x599d0c=function(_0x5bbb8d){while(--_0x5bbb8d){_0x16af7d['push'](_0x16af7d['shift']());}};_0x599d0c(++_0x443055);}(_0xc8e1,0x190));var _0x1c8e=function(_0x253889,_0x4d077f){_0x253889=_0x253889-0x0;var _0x3dd963=_0xc8e1[_0x253889];return _0x3dd963;};'use strict';var _=require(_0x1c8e('0x0'));var util=require('util');var logger=require(_0x1c8e('0x1'))(_0x1c8e('0x2'));var moment=require(_0x1c8e('0x3'));var BPromise=require(_0x1c8e('0x4'));var rp=require(_0x1c8e('0x5'));var fs=require('fs');var path=require(_0x1c8e('0x6'));var rimraf=require(_0x1c8e('0x7'));var config=require(_0x1c8e('0x8'));var attributes=require(_0x1c8e('0x9'));module[_0x1c8e('0xa')]=function(_0x1eab8f,_0x5e9491){return _0x1eab8f[_0x1c8e('0xb')](_0x1c8e('0xc'),attributes,{'tableName':_0x1c8e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1e8=['Integration','integrations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0xa1e8,0x1a2));var _0x8a1e=function(_0x49f82d,_0x22e6f8){_0x49f82d=_0x49f82d-0x0;var _0x59ad86=_0xa1e8[_0x49f82d];return _0x59ad86;};'use strict';var _=require(_0x8a1e('0x0'));var util=require(_0x8a1e('0x1'));var logger=require(_0x8a1e('0x2'))(_0x8a1e('0x3'));var moment=require(_0x8a1e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8a1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a1e('0x6'));var config=require(_0x8a1e('0x7'));var attributes=require(_0x8a1e('0x8'));module[_0x8a1e('0x9')]=function(_0x2fe06e,_0x598950){return _0x2fe06e[_0x8a1e('0xa')](_0x8a1e('0xb'),attributes,{'tableName':_0x8a1e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 3177785..0e1cb36 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x5c9cc2,_0x29ed14){var _0x13f8fd=function(_0x4d4bee){while(--_0x4d4bee){_0x5c9cc2['push'](_0x5c9cc2['shift']());}};_0x13f8fd(++_0x29ed14);}(_0x66fa,0x117));var _0xa66f=function(_0x434b90,_0x2247eb){_0x434b90=_0x434b90-0x0;var _0x16191c=_0x66fa[_0x434b90];return _0x16191c;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2f6014,_0x5c65b7){var _0x21453a=function(_0x4e09c6){while(--_0x4e09c6){_0x2f6014['push'](_0x2f6014['shift']());}};_0x21453a(++_0x5c65b7);}(_0xadb5,0xad));var _0x5adb=function(_0x53ef4b,_0x2aeff4){_0x53ef4b=_0x53ef4b-0x0;var _0x193aef=_0xadb5[_0x53ef4b];return _0x193aef;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 2ffa49c..dc7421c 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 _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x135892,_0x203263){var _0x1351d4=function(_0x40bfd8){while(--_0x40bfd8){_0x135892['push'](_0x135892['shift']());}};_0x1351d4(++_0x203263);}(_0xba34,0x119));var _0x4ba3=function(_0x412a7e,_0x52d634){_0x412a7e=_0x412a7e-0x0;var _0x299e7f=_0xba34[_0x412a7e];return _0x299e7f;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file +var _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x10311a,_0x3390fd){var _0x3f9062=function(_0xc335c){while(--_0xc335c){_0x10311a['push'](_0x10311a['shift']());}};_0x3f9062(++_0x3390fd);}(_0x1261,0x144));var _0x1126=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x1261[_0xe719ec];return _0x4842a1;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6428a6c..3ade748 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 _0xecac=['INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING'];(function(_0x1f4a62,_0x24192a){var _0x2a9fe7=function(_0x2c8e09){while(--_0x2c8e09){_0x1f4a62['push'](_0x1f4a62['shift']());}};_0x2a9fe7(++_0x24192a);}(_0xecac,0x17a));var _0xceca=function(_0x51cb30,_0x1df41e){_0x51cb30=_0x51cb30-0x0;var _0x411220=_0xecac[_0x51cb30];return _0x411220;};'use strict';var Sequelize=require(_0xceca('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xceca('0x1')]},'integrationId':{'type':Sequelize[_0xceca('0x2')]},'contacts':{'type':Sequelize[_0xceca('0x1')]},'uniqueid':{'type':Sequelize[_0xceca('0x1')]},'calleridnum':{'type':Sequelize[_0xceca('0x1')]},'calleridname':{'type':Sequelize[_0xceca('0x1')]},'queue':{'type':Sequelize[_0xceca('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xceca('0x1')]},'agentcalledAt':{'type':Sequelize[_0xceca('0x3')]},'agentconnectAt':{'type':Sequelize[_0xceca('0x3')]},'holdtime':{'type':Sequelize[_0xceca('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xceca('0x3')]},'talktime':{'type':Sequelize[_0xceca('0x2')]},'agentacw':{'type':Sequelize[_0xceca('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xceca('0x2')]},'reason':{'type':Sequelize[_0xceca('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xceca('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xceca('0x3')]},'agentdump':{'type':Sequelize[_0xceca('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xceca('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xceca('0x1')]},'channelstate':{'type':Sequelize[_0xceca('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xceca('0x1')]},'language':{'type':Sequelize[_0xceca('0x1')]},'accountcode':{'type':Sequelize[_0xceca('0x1')]},'context':{'type':Sequelize[_0xceca('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xceca('0x1')]},'destchannel':{'type':Sequelize[_0xceca('0x1')]},'destchannelstate':{'type':Sequelize[_0xceca('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xceca('0x1')]},'destcalleridnum':{'type':Sequelize[_0xceca('0x1')]},'destcalleridname':{'type':Sequelize[_0xceca('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xceca('0x1')]},'destlanguage':{'type':Sequelize[_0xceca('0x1')]},'destaccountcode':{'type':Sequelize[_0xceca('0x1')]},'destcontext':{'type':Sequelize[_0xceca('0x1')]},'destexten':{'type':Sequelize[_0xceca('0x1')]},'destpriority':{'type':Sequelize[_0xceca('0x1')]},'destuniqueid':{'type':Sequelize[_0xceca('0x1')]},'messageId':{'type':Sequelize[_0xceca('0x1')]},'inReplyTo':{'type':Sequelize[_0xceca('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xceca('0x1')]},'cc':{'type':Sequelize[_0xceca('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xceca('0x5')]},'text':{'type':Sequelize[_0xceca('0x5')]},'status':{'type':Sequelize['ENUM'](_0xceca('0x6'),_0xceca('0x7'),_0xceca('0x8'),_0xceca('0x9'))},'url':{'type':Sequelize[_0xceca('0x1')]},'app':{'type':Sequelize[_0xceca('0x1')]},'appdata':{'type':Sequelize[_0xceca('0x1')]},'projectId':{'type':Sequelize[_0xceca('0x2')]}}; \ No newline at end of file +var _0x4a8c=['TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x4a8c,0x1aa));var _0xc4a8=function(_0x286cd3,_0x26e3df){_0x286cd3=_0x286cd3-0x0;var _0x3ef95d=_0x4a8c[_0x286cd3];return _0x3ef95d;};'use strict';var Sequelize=require(_0xc4a8('0x0'));module[_0xc4a8('0x1')]={'integration':{'type':Sequelize[_0xc4a8('0x2')]},'eventChannel':{'type':Sequelize[_0xc4a8('0x2')]},'exitStatus':{'type':Sequelize[_0xc4a8('0x2')]},'ticketId':{'type':Sequelize[_0xc4a8('0x2')]},'integrationId':{'type':Sequelize[_0xc4a8('0x3')]},'contacts':{'type':Sequelize[_0xc4a8('0x2')]},'uniqueid':{'type':Sequelize[_0xc4a8('0x2')]},'calleridnum':{'type':Sequelize[_0xc4a8('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc4a8('0x2')]},'interface':{'type':Sequelize[_0xc4a8('0x2')]},'membername':{'type':Sequelize[_0xc4a8('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc4a8('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xc4a8('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc4a8('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc4a8('0x3')]},'reason':{'type':Sequelize[_0xc4a8('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xc4a8('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xc4a8('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc4a8('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc4a8('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc4a8('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc4a8('0x2')]},'connectedlinename':{'type':Sequelize[_0xc4a8('0x2')]},'language':{'type':Sequelize[_0xc4a8('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc4a8('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc4a8('0x2')]},'destchannel':{'type':Sequelize[_0xc4a8('0x2')]},'destchannelstate':{'type':Sequelize[_0xc4a8('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc4a8('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc4a8('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc4a8('0x2')]},'destlanguage':{'type':Sequelize[_0xc4a8('0x2')]},'destaccountcode':{'type':Sequelize[_0xc4a8('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xc4a8('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc4a8('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xc4a8('0x2')]},'to':{'type':Sequelize[_0xc4a8('0x2')]},'cc':{'type':Sequelize[_0xc4a8('0x2')]},'attachment':{'type':Sequelize[_0xc4a8('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xc4a8('0x7')](_0xc4a8('0x8'),_0xc4a8('0x9'),_0xc4a8('0xa'),_0xc4a8('0xb'))},'url':{'type':Sequelize[_0xc4a8('0x2')]},'app':{'type':Sequelize[_0xc4a8('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xc4a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4736ff9..dc005d7 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 _0x5074=['findAll','catch','show','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','IntegrationReport','includeAll'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x5074,0x1ca));var _0x4507=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x5074[_0x4063a4];return _0x17908d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4507('0x0'));var zipdir=require(_0x4507('0x1'));var jsonpatch=require(_0x4507('0x2'));var rp=require(_0x4507('0x3'));var moment=require(_0x4507('0x4'));var BPromise=require(_0x4507('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4507('0x6'));var sox=require(_0x4507('0x7'));var csv=require(_0x4507('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4507('0x9'));var _=require(_0x4507('0xa'));var squel=require(_0x4507('0xb'));var crypto=require(_0x4507('0xc'));var jsforce=require(_0x4507('0xd'));var deskjs=require(_0x4507('0xe'));var toCsv=require(_0x4507('0x8'));var querystring=require(_0x4507('0xf'));var Papa=require('papaparse');var Redis=require(_0x4507('0x10'));var authService=require(_0x4507('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4507('0x12'));var hardwareService=require(_0x4507('0x13'));var logger=require('../../config/logger')(_0x4507('0x14'));var utils=require(_0x4507('0x15'));var config=require(_0x4507('0x16'));var licenseUtil=require(_0x4507('0x17'));var db=require(_0x4507('0x18'))['db'];function respondWithStatusCode(_0x120b49,_0x3c12ac){_0x3c12ac=_0x3c12ac||0xcc;return function(_0x52716e){if(_0x52716e){return _0x120b49['sendStatus'](_0x3c12ac);}return _0x120b49['status'](_0x3c12ac)[_0x4507('0x19')]();};}function respondWithResult(_0x32a33a,_0x4a02a3){_0x4a02a3=_0x4a02a3||0xc8;return function(_0x29be84){if(_0x29be84){return _0x32a33a[_0x4507('0x1a')](_0x4a02a3)[_0x4507('0x1b')](_0x29be84);}};}function respondWithFilteredResult(_0x2312b2,_0x510517){return function(_0x2b66e6){if(_0x2b66e6){var _0x27536e=typeof _0x510517['offset']==='undefined'&&typeof _0x510517[_0x4507('0x1c')]==='undefined';var _0x43f9bb=_0x2b66e6[_0x4507('0x1d')];var _0x266521=_0x27536e?0x0:_0x510517[_0x4507('0x1e')];var _0x4badee=_0x27536e?_0x2b66e6[_0x4507('0x1d')]:_0x510517[_0x4507('0x1e')]+_0x510517[_0x4507('0x1c')];var _0x1ee61c;if(_0x4badee>=_0x43f9bb){_0x4badee=_0x43f9bb;_0x1ee61c=0xc8;}else{_0x1ee61c=0xce;}_0x2312b2[_0x4507('0x1a')](_0x1ee61c);return _0x2312b2['set'](_0x4507('0x1f'),_0x266521+'-'+_0x4badee+'/'+_0x43f9bb)['json'](_0x2b66e6);}return null;};}function patchUpdates(_0x3a4556){return function(_0x147e7e){try{jsonpatch[_0x4507('0x20')](_0x147e7e,_0x3a4556,!![]);}catch(_0x8cda11){return BPromise[_0x4507('0x21')](_0x8cda11);}return _0x147e7e[_0x4507('0x22')]();};}function saveUpdates(_0x5d6b21,_0x394b64){return function(_0x325b61){if(_0x325b61){return _0x325b61[_0x4507('0x23')](_0x5d6b21)[_0x4507('0x24')](function(_0x252d86){return _0x252d86;});}return null;};}function removeEntity(_0x29d377,_0x2002d3){return function(_0x1581c9){if(_0x1581c9){return _0x1581c9[_0x4507('0x25')]()['then'](function(){_0x29d377[_0x4507('0x1a')](0xcc)[_0x4507('0x19')]();});}};}function handleEntityNotFound(_0x38adb4,_0x1ba5b4){return function(_0x3c1995){if(!_0x3c1995){_0x38adb4[_0x4507('0x26')](0x194);}return _0x3c1995;};}function handleError(_0x4a72e3,_0x431345){_0x431345=_0x431345||0x1f4;return function(_0x212a32){logger[_0x4507('0x27')](_0x212a32['stack']);if(_0x212a32[_0x4507('0x28')]){delete _0x212a32['name'];}_0x4a72e3['status'](_0x431345)[_0x4507('0x29')](_0x212a32);};}exports[_0x4507('0x2a')]=function(_0x59c31e,_0x288b09){var _0x19899d={},_0x36c69f={},_0x514a0c={'count':0x0,'rows':[]};var _0x470422=_[_0x4507('0x2b')](db['IntegrationReport'][_0x4507('0x2c')],function(_0x41050a){return{'name':_0x41050a[_0x4507('0x2d')],'type':_0x41050a[_0x4507('0x2e')][_0x4507('0x2f')]};});_0x36c69f[_0x4507('0x30')]=_['map'](_0x470422,_0x4507('0x28'));_0x36c69f[_0x4507('0x31')]=_[_0x4507('0x32')](_0x59c31e[_0x4507('0x31')]);_0x36c69f[_0x4507('0x33')]=_[_0x4507('0x34')](_0x36c69f[_0x4507('0x30')],_0x36c69f['query']);_0x19899d[_0x4507('0x35')]=_['intersection'](_0x36c69f[_0x4507('0x30')],qs['fields'](_0x59c31e['query'][_0x4507('0x36')]));_0x19899d[_0x4507('0x35')]=_0x19899d[_0x4507('0x35')][_0x4507('0x37')]?_0x19899d['attributes']:_0x36c69f[_0x4507('0x30')];if(!_0x59c31e['query'][_0x4507('0x38')](_0x4507('0x39'))){_0x19899d[_0x4507('0x1c')]=qs[_0x4507('0x1c')](_0x59c31e[_0x4507('0x31')]['limit']);_0x19899d[_0x4507('0x1e')]=qs['offset'](_0x59c31e['query'][_0x4507('0x1e')]);}_0x19899d[_0x4507('0x3a')]=qs['sort'](_0x59c31e[_0x4507('0x31')]['sort']);_0x19899d[_0x4507('0x3b')]=qs['filters'](_[_0x4507('0x3c')](_0x59c31e[_0x4507('0x31')],_0x36c69f[_0x4507('0x33')]),_0x470422);if(_0x59c31e[_0x4507('0x31')][_0x4507('0x3d')]){_0x19899d[_0x4507('0x3b')]=_[_0x4507('0x3e')](_0x19899d[_0x4507('0x3b')],{'$or':_['map'](_0x470422,function(_0x3267fb){if(_0x3267fb[_0x4507('0x2e')]!==_0x4507('0x3f')){var _0x4a2f06={};_0x4a2f06[_0x3267fb[_0x4507('0x28')]]={'$like':'%'+_0x59c31e[_0x4507('0x31')]['filter']+'%'};return _0x4a2f06;}})});}_0x19899d=_[_0x4507('0x3e')]({},_0x19899d,_0x59c31e[_0x4507('0x40')]);var _0x4399ba={'where':_0x19899d[_0x4507('0x3b')]};return db[_0x4507('0x41')][_0x4507('0x1d')](_0x4399ba)[_0x4507('0x24')](function(_0x35f889){_0x514a0c[_0x4507('0x1d')]=_0x35f889;if(_0x59c31e[_0x4507('0x31')][_0x4507('0x42')]){_0x19899d['include']=[{'all':!![]}];}return db[_0x4507('0x41')][_0x4507('0x43')](_0x19899d);})['then'](function(_0x4fb542){_0x514a0c['rows']=_0x4fb542;return _0x514a0c;})[_0x4507('0x24')](respondWithFilteredResult(_0x288b09,_0x19899d))[_0x4507('0x44')](handleError(_0x288b09,null));};exports[_0x4507('0x45')]=function(_0x3ba692,_0x593213){var _0x5db902={'raw':![],'where':{'id':_0x3ba692[_0x4507('0x46')]['id']}},_0x12624c={};_0x12624c[_0x4507('0x30')]=_[_0x4507('0x32')](db[_0x4507('0x41')]['rawAttributes']);_0x12624c[_0x4507('0x31')]=_[_0x4507('0x32')](_0x3ba692[_0x4507('0x31')]);_0x12624c[_0x4507('0x33')]=_['intersection'](_0x12624c[_0x4507('0x30')],_0x12624c[_0x4507('0x31')]);_0x5db902[_0x4507('0x35')]=_[_0x4507('0x34')](_0x12624c['model'],qs[_0x4507('0x36')](_0x3ba692['query'][_0x4507('0x36')]));_0x5db902[_0x4507('0x35')]=_0x5db902[_0x4507('0x35')]['length']?_0x5db902[_0x4507('0x35')]:_0x12624c[_0x4507('0x30')];if(_0x3ba692['query'][_0x4507('0x42')]){_0x5db902['include']=[{'all':!![]}];}_0x5db902=_[_0x4507('0x3e')]({},_0x5db902,_0x3ba692[_0x4507('0x40')]);return db[_0x4507('0x41')]['find'](_0x5db902)[_0x4507('0x24')](handleEntityNotFound(_0x593213,null))[_0x4507('0x24')](respondWithResult(_0x593213,null))[_0x4507('0x44')](handleError(_0x593213,null));};exports[_0x4507('0x47')]=function(_0x5815e5,_0x124c6d){return db[_0x4507('0x41')][_0x4507('0x47')](_0x5815e5[_0x4507('0x48')],{})['then'](respondWithResult(_0x124c6d,0xc9))[_0x4507('0x44')](handleError(_0x124c6d,null));};exports[_0x4507('0x23')]=function(_0x47be60,_0xbe6421){if(_0x47be60[_0x4507('0x48')]['id']){delete _0x47be60[_0x4507('0x48')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x47be60[_0x4507('0x46')]['id']}})[_0x4507('0x24')](handleEntityNotFound(_0xbe6421,null))[_0x4507('0x24')](saveUpdates(_0x47be60[_0x4507('0x48')],null))[_0x4507('0x24')](respondWithResult(_0xbe6421,null))[_0x4507('0x44')](handleError(_0xbe6421,null));};exports['destroy']=function(_0x46582c,_0x1afa1e){return db[_0x4507('0x41')][_0x4507('0x49')]({'where':{'id':_0x46582c[_0x4507('0x46')]['id']}})['then'](handleEntityNotFound(_0x1afa1e,null))[_0x4507('0x24')](removeEntity(_0x1afa1e,null))['catch'](handleError(_0x1afa1e,null));};exports[_0x4507('0x4a')]=function(_0x3e47d0,_0x320e2f){return db[_0x4507('0x41')][_0x4507('0x4a')]()[_0x4507('0x24')](respondWithResult(_0x320e2f,null))[_0x4507('0x44')](handleError(_0x320e2f,null));}; \ No newline at end of file +var _0xa85b=['show','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','rows','catch'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xa85b,0xea));var _0xba85=function(_0xa173c9,_0x2643fc){_0xa173c9=_0xa173c9-0x0;var _0x989fac=_0xa85b[_0xa173c9];return _0x989fac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba85('0x0'));var jsonpatch=require(_0xba85('0x1'));var rp=require(_0xba85('0x2'));var moment=require(_0xba85('0x3'));var BPromise=require(_0xba85('0x4'));var Mustache=require('mustache');var util=require(_0xba85('0x5'));var path=require(_0xba85('0x6'));var sox=require(_0xba85('0x7'));var csv=require(_0xba85('0x8'));var ejs=require(_0xba85('0x9'));var fs=require('fs');var fs_extra=require(_0xba85('0xa'));var _=require(_0xba85('0xb'));var squel=require(_0xba85('0xc'));var crypto=require(_0xba85('0xd'));var jsforce=require(_0xba85('0xe'));var deskjs=require(_0xba85('0xf'));var toCsv=require(_0xba85('0x8'));var querystring=require('querystring');var Papa=require(_0xba85('0x10'));var Redis=require(_0xba85('0x11'));var authService=require(_0xba85('0x12'));var qs=require(_0xba85('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xba85('0x14'))(_0xba85('0x15'));var utils=require(_0xba85('0x16'));var config=require(_0xba85('0x17'));var licenseUtil=require(_0xba85('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21c9d8,_0x2788bf){_0x2788bf=_0x2788bf||0xcc;return function(_0x3abd67){if(_0x3abd67){return _0x21c9d8[_0xba85('0x19')](_0x2788bf);}return _0x21c9d8['status'](_0x2788bf)['end']();};}function respondWithResult(_0x8b6811,_0x3d89a9){_0x3d89a9=_0x3d89a9||0xc8;return function(_0x3d3140){if(_0x3d3140){return _0x8b6811[_0xba85('0x1a')](_0x3d89a9)[_0xba85('0x1b')](_0x3d3140);}};}function respondWithFilteredResult(_0x6accd5,_0x4afdb9){return function(_0x55afa5){if(_0x55afa5){var _0x289424=typeof _0x4afdb9[_0xba85('0x1c')]===_0xba85('0x1d')&&typeof _0x4afdb9[_0xba85('0x1e')]==='undefined';var _0x4c4713=_0x55afa5[_0xba85('0x1f')];var _0x4e06d7=_0x289424?0x0:_0x4afdb9[_0xba85('0x1c')];var _0xb0ce76=_0x289424?_0x55afa5[_0xba85('0x1f')]:_0x4afdb9['offset']+_0x4afdb9[_0xba85('0x1e')];var _0x566044;if(_0xb0ce76>=_0x4c4713){_0xb0ce76=_0x4c4713;_0x566044=0xc8;}else{_0x566044=0xce;}_0x6accd5[_0xba85('0x1a')](_0x566044);return _0x6accd5[_0xba85('0x20')]('Content-Range',_0x4e06d7+'-'+_0xb0ce76+'/'+_0x4c4713)['json'](_0x55afa5);}return null;};}function patchUpdates(_0xe5445){return function(_0x599ae8){try{jsonpatch['apply'](_0x599ae8,_0xe5445,!![]);}catch(_0x1234d1){return BPromise[_0xba85('0x21')](_0x1234d1);}return _0x599ae8[_0xba85('0x22')]();};}function saveUpdates(_0x2c2e35,_0x2ebf58){return function(_0x5e4c74){if(_0x5e4c74){return _0x5e4c74[_0xba85('0x23')](_0x2c2e35)[_0xba85('0x24')](function(_0x54ee50){return _0x54ee50;});}return null;};}function removeEntity(_0x2fb11d,_0x17d7d7){return function(_0x57c4ce){if(_0x57c4ce){return _0x57c4ce[_0xba85('0x25')]()[_0xba85('0x24')](function(){_0x2fb11d['status'](0xcc)[_0xba85('0x26')]();});}};}function handleEntityNotFound(_0x1fa846,_0x23aaa6){return function(_0x1942ce){if(!_0x1942ce){_0x1fa846[_0xba85('0x19')](0x194);}return _0x1942ce;};}function handleError(_0x1946d7,_0x141073){_0x141073=_0x141073||0x1f4;return function(_0x3a0008){logger[_0xba85('0x27')](_0x3a0008[_0xba85('0x28')]);if(_0x3a0008[_0xba85('0x29')]){delete _0x3a0008[_0xba85('0x29')];}_0x1946d7[_0xba85('0x1a')](_0x141073)['send'](_0x3a0008);};}exports['index']=function(_0x514c32,_0x2e41cf){var _0xb6eb26={},_0x3200f0={},_0x28b9d0={'count':0x0,'rows':[]};var _0xd45190=_[_0xba85('0x2a')](db['IntegrationReport'][_0xba85('0x2b')],function(_0x5ef9cb){return{'name':_0x5ef9cb[_0xba85('0x2c')],'type':_0x5ef9cb[_0xba85('0x2d')]['key']};});_0x3200f0[_0xba85('0x2e')]=_[_0xba85('0x2a')](_0xd45190,'name');_0x3200f0[_0xba85('0x2f')]=_[_0xba85('0x30')](_0x514c32[_0xba85('0x2f')]);_0x3200f0['filters']=_[_0xba85('0x31')](_0x3200f0[_0xba85('0x2e')],_0x3200f0[_0xba85('0x2f')]);_0xb6eb26[_0xba85('0x32')]=_[_0xba85('0x31')](_0x3200f0[_0xba85('0x2e')],qs[_0xba85('0x33')](_0x514c32[_0xba85('0x2f')][_0xba85('0x33')]));_0xb6eb26[_0xba85('0x32')]=_0xb6eb26[_0xba85('0x32')][_0xba85('0x34')]?_0xb6eb26['attributes']:_0x3200f0['model'];if(!_0x514c32[_0xba85('0x2f')][_0xba85('0x35')](_0xba85('0x36'))){_0xb6eb26[_0xba85('0x1e')]=qs[_0xba85('0x1e')](_0x514c32[_0xba85('0x2f')]['limit']);_0xb6eb26[_0xba85('0x1c')]=qs[_0xba85('0x1c')](_0x514c32['query'][_0xba85('0x1c')]);}_0xb6eb26[_0xba85('0x37')]=qs['sort'](_0x514c32['query'][_0xba85('0x38')]);_0xb6eb26[_0xba85('0x39')]=qs[_0xba85('0x3a')](_[_0xba85('0x3b')](_0x514c32[_0xba85('0x2f')],_0x3200f0[_0xba85('0x3a')]),_0xd45190);if(_0x514c32[_0xba85('0x2f')][_0xba85('0x3c')]){_0xb6eb26[_0xba85('0x39')]=_[_0xba85('0x3d')](_0xb6eb26[_0xba85('0x39')],{'$or':_[_0xba85('0x2a')](_0xd45190,function(_0x421d38){if(_0x421d38[_0xba85('0x2d')]!==_0xba85('0x3e')){var _0x21f6e0={};_0x21f6e0[_0x421d38['name']]={'$like':'%'+_0x514c32[_0xba85('0x2f')][_0xba85('0x3c')]+'%'};return _0x21f6e0;}})});}_0xb6eb26=_[_0xba85('0x3d')]({},_0xb6eb26,_0x514c32[_0xba85('0x3f')]);var _0x1fb731={'where':_0xb6eb26[_0xba85('0x39')]};return db[_0xba85('0x40')][_0xba85('0x1f')](_0x1fb731)[_0xba85('0x24')](function(_0x1460d8){_0x28b9d0[_0xba85('0x1f')]=_0x1460d8;if(_0x514c32[_0xba85('0x2f')][_0xba85('0x41')]){_0xb6eb26[_0xba85('0x42')]=[{'all':!![]}];}return db[_0xba85('0x40')][_0xba85('0x43')](_0xb6eb26);})[_0xba85('0x24')](function(_0x53d126){_0x28b9d0[_0xba85('0x44')]=_0x53d126;return _0x28b9d0;})['then'](respondWithFilteredResult(_0x2e41cf,_0xb6eb26))[_0xba85('0x45')](handleError(_0x2e41cf,null));};exports[_0xba85('0x46')]=function(_0x33fd42,_0x2d4a2d){var _0x49d044={'raw':![],'where':{'id':_0x33fd42[_0xba85('0x47')]['id']}},_0x371b80={};_0x371b80[_0xba85('0x2e')]=_[_0xba85('0x30')](db[_0xba85('0x40')][_0xba85('0x2b')]);_0x371b80[_0xba85('0x2f')]=_[_0xba85('0x30')](_0x33fd42[_0xba85('0x2f')]);_0x371b80[_0xba85('0x3a')]=_[_0xba85('0x31')](_0x371b80['model'],_0x371b80[_0xba85('0x2f')]);_0x49d044[_0xba85('0x32')]=_[_0xba85('0x31')](_0x371b80[_0xba85('0x2e')],qs[_0xba85('0x33')](_0x33fd42['query'][_0xba85('0x33')]));_0x49d044[_0xba85('0x32')]=_0x49d044[_0xba85('0x32')]['length']?_0x49d044[_0xba85('0x32')]:_0x371b80['model'];if(_0x33fd42[_0xba85('0x2f')][_0xba85('0x41')]){_0x49d044[_0xba85('0x42')]=[{'all':!![]}];}_0x49d044=_[_0xba85('0x3d')]({},_0x49d044,_0x33fd42[_0xba85('0x3f')]);return db[_0xba85('0x40')][_0xba85('0x48')](_0x49d044)[_0xba85('0x24')](handleEntityNotFound(_0x2d4a2d,null))['then'](respondWithResult(_0x2d4a2d,null))['catch'](handleError(_0x2d4a2d,null));};exports[_0xba85('0x49')]=function(_0x23faa9,_0x5b21be){return db[_0xba85('0x40')][_0xba85('0x49')](_0x23faa9[_0xba85('0x4a')],{})['then'](respondWithResult(_0x5b21be,0xc9))[_0xba85('0x45')](handleError(_0x5b21be,null));};exports[_0xba85('0x23')]=function(_0x557067,_0x49536e){if(_0x557067[_0xba85('0x4a')]['id']){delete _0x557067['body']['id'];}return db[_0xba85('0x40')][_0xba85('0x48')]({'where':{'id':_0x557067[_0xba85('0x47')]['id']}})[_0xba85('0x24')](handleEntityNotFound(_0x49536e,null))['then'](saveUpdates(_0x557067[_0xba85('0x4a')],null))[_0xba85('0x24')](respondWithResult(_0x49536e,null))[_0xba85('0x45')](handleError(_0x49536e,null));};exports[_0xba85('0x25')]=function(_0x54013d,_0x23812b){return db[_0xba85('0x40')][_0xba85('0x48')]({'where':{'id':_0x54013d['params']['id']}})[_0xba85('0x24')](handleEntityNotFound(_0x23812b,null))[_0xba85('0x24')](removeEntity(_0x23812b,null))[_0xba85('0x45')](handleError(_0x23812b,null));};exports[_0xba85('0x4b')]=function(_0x530c37,_0x513130){return db[_0xba85('0x40')]['describe']()[_0xba85('0x24')](respondWithResult(_0x513130,null))[_0xba85('0x45')](handleError(_0x513130,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3da6aa4..7c9d4a6 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 _0x4506=['request-promise','path','rimraf','./integrationReport.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x2d518,_0x61c0e9){var _0xdc2ee7=function(_0x473acd){while(--_0x473acd){_0x2d518['push'](_0x2d518['shift']());}};_0xdc2ee7(++_0x61c0e9);}(_0x4506,0x1b3));var _0x6450=function(_0x19f1dc,_0x1c98d7){_0x19f1dc=_0x19f1dc-0x0;var _0x4af099=_0x4506[_0x19f1dc];return _0x4af099;};'use strict';var _=require(_0x6450('0x0'));var util=require(_0x6450('0x1'));var logger=require(_0x6450('0x2'))(_0x6450('0x3'));var moment=require('moment');var BPromise=require(_0x6450('0x4'));var rp=require(_0x6450('0x5'));var fs=require('fs');var path=require(_0x6450('0x6'));var rimraf=require(_0x6450('0x7'));var config=require('../../config/environment');var attributes=require(_0x6450('0x8'));module[_0x6450('0x9')]=function(_0x1d1d19,_0x1a9460){return _0x1d1d19[_0x6450('0xa')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbee8=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbee8,0x11f));var _0x8bee=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbee8[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8bee('0x0'));var util=require('util');var logger=require(_0x8bee('0x1'))(_0x8bee('0x2'));var moment=require(_0x8bee('0x3'));var BPromise=require(_0x8bee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bee('0x5'));var rimraf=require(_0x8bee('0x6'));var config=require(_0x8bee('0x7'));var attributes=require(_0x8bee('0x8'));module[_0x8bee('0x9')]=function(_0x7150b9,_0x232c34){return _0x7150b9['define'](_0x8bee('0xa'),attributes,{'tableName':_0x8bee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 8738280..fcffd33 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 _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x141080,_0x23115e){var _0x5897bf=function(_0x5223fa){while(--_0x5223fa){_0x141080['push'](_0x141080['shift']());}};_0x5897bf(++_0x23115e);}(_0x4819,0xcd));var _0x9481=function(_0x54f253,_0x13acb1){_0x54f253=_0x54f253-0x0;var _0x207e8d=_0x4819[_0x54f253];return _0x207e8d;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x427c7d,_0xace232){var _0x1a7ab8=function(_0x170caf){while(--_0x170caf){_0x427c7d['push'](_0x427c7d['shift']());}};_0x1a7ab8(++_0xace232);}(_0x0295,0x1f0));var _0x5029=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x0295[_0x51ac09];return _0x3f827d;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1c1c3d7..6bbc3dc 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 _0x342a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x342a,0xa2));var _0xa342=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x342a[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xa342('0x0'));var util=require(_0xa342('0x1'));var path=require(_0xa342('0x2'));var timeout=require(_0xa342('0x3'));var express=require('express');var router=express[_0xa342('0x4')]();var fs_extra=require(_0xa342('0x5'));var auth=require(_0xa342('0x6'));var interaction=require(_0xa342('0x7'));var config=require(_0xa342('0x8'));var controller=require(_0xa342('0x9'));router[_0xa342('0xa')]('/',auth[_0xa342('0xb')](),controller[_0xa342('0xc')]);router[_0xa342('0xa')](_0xa342('0xd'),auth[_0xa342('0xb')](),controller['show']);router[_0xa342('0xa')](_0xa342('0xe'),auth[_0xa342('0xb')](),controller[_0xa342('0xf')]);router[_0xa342('0x10')]('/',auth[_0xa342('0xb')](),controller[_0xa342('0x11')]);router[_0xa342('0x10')](_0xa342('0xe'),auth[_0xa342('0xb')](),controller[_0xa342('0x12')]);router[_0xa342('0x10')](_0xa342('0x13'),auth[_0xa342('0xb')](),controller['addIntervals']);router[_0xa342('0x14')](_0xa342('0xd'),auth[_0xa342('0xb')](),controller[_0xa342('0x15')]);router['delete'](_0xa342('0xd'),auth[_0xa342('0xb')](),controller[_0xa342('0x16')]);module[_0xa342('0x17')]=router; \ No newline at end of file +var _0x0427=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post'];(function(_0x2ba055,_0x386366){var _0x160d20=function(_0x767c97){while(--_0x767c97){_0x2ba055['push'](_0x2ba055['shift']());}};_0x160d20(++_0x386366);}(_0x0427,0x6c));var _0x7042=function(_0x4391d2,_0x4b0b88){_0x4391d2=_0x4391d2-0x0;var _0x5c4931=_0x0427[_0x4391d2];return _0x5c4931;};'use strict';var multer=require(_0x7042('0x0'));var util=require(_0x7042('0x1'));var path=require('path');var timeout=require(_0x7042('0x2'));var express=require(_0x7042('0x3'));var router=express[_0x7042('0x4')]();var fs_extra=require(_0x7042('0x5'));var auth=require(_0x7042('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7042('0x7'));var controller=require(_0x7042('0x8'));router[_0x7042('0x9')]('/',auth[_0x7042('0xa')](),controller[_0x7042('0xb')]);router[_0x7042('0x9')](_0x7042('0xc'),auth['isAuthenticated'](),controller[_0x7042('0xd')]);router[_0x7042('0x9')](_0x7042('0xe'),auth[_0x7042('0xa')](),controller[_0x7042('0xf')]);router[_0x7042('0x10')]('/',auth[_0x7042('0xa')](),controller['create']);router['post'](_0x7042('0xe'),auth[_0x7042('0xa')](),controller[_0x7042('0x11')]);router['post'](_0x7042('0x12'),auth[_0x7042('0xa')](),controller[_0x7042('0x13')]);router[_0x7042('0x14')](_0x7042('0xc'),auth[_0x7042('0xa')](),controller[_0x7042('0x15')]);router[_0x7042('0x16')](_0x7042('0xc'),auth['isAuthenticated'](),controller[_0x7042('0x17')]);module[_0x7042('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index be4f93c..092f2ac 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 _0xccee=['sequelize','exports','STRING'];(function(_0x593ec2,_0x422526){var _0x411e2b=function(_0x361302){while(--_0x361302){_0x593ec2['push'](_0x593ec2['shift']());}};_0x411e2b(++_0x422526);}(_0xccee,0x177));var _0xecce=function(_0x3166b5,_0x16cd1d){_0x3166b5=_0x3166b5-0x0;var _0x4e509f=_0xccee[_0x3166b5];return _0x4e509f;};'use strict';var Sequelize=require(_0xecce('0x0'));module[_0xecce('0x1')]={'name':{'type':Sequelize[_0xecce('0x2')]},'description':{'type':Sequelize[_0xecce('0x2')]},'interval':{'type':Sequelize[_0xecce('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9b8e=['sequelize','STRING'];(function(_0x477cb9,_0x1f151b){var _0x59f8ec=function(_0x231c54){while(--_0x231c54){_0x477cb9['push'](_0x477cb9['shift']());}};_0x59f8ec(++_0x1f151b);}(_0x9b8e,0x16c));var _0xe9b8=function(_0xb60fa4,_0x13ad73){_0xb60fa4=_0xb60fa4-0x0;var _0x111132=_0x9b8e[_0xb60fa4];return _0x111132;};'use strict';var Sequelize=require(_0xe9b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xe9b8('0x1')]},'description':{'type':Sequelize[_0xe9b8('0x1')]},'interval':{'type':Sequelize[_0xe9b8('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 22dc759..f3aaeed 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 _0x6443=['UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','sequelize','transaction','bulkCreate','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','stack','name','send','map','Interval','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','includeAll','create','body','role','user'];(function(_0x349ff6,_0xa232a2){var _0x185376=function(_0x5056e0){while(--_0x5056e0){_0x349ff6['push'](_0x349ff6['shift']());}};_0x185376(++_0xa232a2);}(_0x6443,0x1c5));var _0x3644=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x6443[_0x16938f];return _0x5c66e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3644('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3644('0x1'));var rp=require(_0x3644('0x2'));var moment=require(_0x3644('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3644('0x4'));var util=require(_0x3644('0x5'));var path=require(_0x3644('0x6'));var sox=require(_0x3644('0x7'));var csv=require(_0x3644('0x8'));var ejs=require(_0x3644('0x9'));var fs=require('fs');var fs_extra=require(_0x3644('0xa'));var _=require(_0x3644('0xb'));var squel=require('squel');var crypto=require(_0x3644('0xc'));var jsforce=require(_0x3644('0xd'));var deskjs=require(_0x3644('0xe'));var toCsv=require(_0x3644('0x8'));var querystring=require('querystring');var Papa=require(_0x3644('0xf'));var Redis=require(_0x3644('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3644('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3644('0x12'));var config=require(_0x3644('0x13'));var licenseUtil=require(_0x3644('0x14'));var db=require(_0x3644('0x15'))['db'];var extensions=require(_0x3644('0x16'));function respondWithStatusCode(_0x5a9e1d,_0x213e75){_0x213e75=_0x213e75||0xcc;return function(_0x140556){if(_0x140556){return _0x5a9e1d[_0x3644('0x17')](_0x213e75);}return _0x5a9e1d[_0x3644('0x18')](_0x213e75)['end']();};}function respondWithResult(_0x70626f,_0x1548bd){_0x1548bd=_0x1548bd||0xc8;return function(_0x341998){if(_0x341998){return _0x70626f[_0x3644('0x18')](_0x1548bd)['json'](_0x341998);}};}function respondWithFilteredResult(_0x75045,_0x578ef6){return function(_0xc938f6){if(_0xc938f6){var _0x373ef9=typeof _0x578ef6[_0x3644('0x19')]==='undefined'&&typeof _0x578ef6[_0x3644('0x1a')]==='undefined';var _0x3a153c=_0xc938f6[_0x3644('0x1b')];var _0x3d7c03=_0x373ef9?0x0:_0x578ef6[_0x3644('0x19')];var _0x192f44=_0x373ef9?_0xc938f6['count']:_0x578ef6[_0x3644('0x19')]+_0x578ef6['limit'];var _0x29d3dc;if(_0x192f44>=_0x3a153c){_0x192f44=_0x3a153c;_0x29d3dc=0xc8;}else{_0x29d3dc=0xce;}_0x75045[_0x3644('0x18')](_0x29d3dc);return _0x75045['set'](_0x3644('0x1c'),_0x3d7c03+'-'+_0x192f44+'/'+_0x3a153c)[_0x3644('0x1d')](_0xc938f6);}return null;};}function patchUpdates(_0xd921bc){return function(_0x59d7f3){try{jsonpatch[_0x3644('0x1e')](_0x59d7f3,_0xd921bc,!![]);}catch(_0x117c80){return BPromise[_0x3644('0x1f')](_0x117c80);}return _0x59d7f3[_0x3644('0x20')]();};}function saveUpdates(_0x4d577b,_0x149ca7){return function(_0x51cf0f){if(_0x51cf0f){return _0x51cf0f[_0x3644('0x21')](_0x4d577b)[_0x3644('0x22')](function(_0x494c65){return _0x494c65;});}return null;};}function removeEntity(_0x148759,_0x2b1111){return function(_0x12107a){if(_0x12107a){return _0x12107a[_0x3644('0x23')]()[_0x3644('0x22')](function(){var _0xc56a49=_0x12107a[_0x3644('0x24')]({'plain':!![]});var _0x2cb5eb=_0x3644('0x25');return db[_0x3644('0x26')][_0x3644('0x23')]({'where':{'type':_0x2cb5eb,'resourceId':_0xc56a49['id']}})[_0x3644('0x22')](function(){return _0x12107a;});})[_0x3644('0x22')](function(){_0x148759[_0x3644('0x18')](0xcc)[_0x3644('0x27')]();});}};}function handleEntityNotFound(_0x3109e0,_0x4f3b0b){return function(_0x4d316d){if(!_0x4d316d){_0x3109e0[_0x3644('0x17')](0x194);}return _0x4d316d;};}function handleError(_0x5f2044,_0x4e16fa){_0x4e16fa=_0x4e16fa||0x1f4;return function(_0x5f1c53){logger['error'](_0x5f1c53[_0x3644('0x28')]);if(_0x5f1c53[_0x3644('0x29')]){delete _0x5f1c53[_0x3644('0x29')];}_0x5f2044[_0x3644('0x18')](_0x4e16fa)[_0x3644('0x2a')](_0x5f1c53);};}exports['index']=function(_0x23b604,_0x1afd01){var _0x50b3e1={},_0x8476be={},_0x53575d={'count':0x0,'rows':[]};var _0x2918ad=_[_0x3644('0x2b')](db[_0x3644('0x2c')][_0x3644('0x2d')],function(_0x5f3bed){return{'name':_0x5f3bed['fieldName'],'type':_0x5f3bed['type'][_0x3644('0x2e')]};});_0x8476be[_0x3644('0x2f')]=_['map'](_0x2918ad,'name');_0x8476be[_0x3644('0x30')]=_[_0x3644('0x31')](_0x23b604[_0x3644('0x30')]);_0x8476be[_0x3644('0x32')]=_[_0x3644('0x33')](_0x8476be['model'],_0x8476be['query']);_0x50b3e1[_0x3644('0x34')]=_[_0x3644('0x33')](_0x8476be[_0x3644('0x2f')],qs[_0x3644('0x35')](_0x23b604[_0x3644('0x30')][_0x3644('0x35')]));_0x50b3e1['attributes']=_0x50b3e1[_0x3644('0x34')][_0x3644('0x36')]?_0x50b3e1['attributes']:_0x8476be[_0x3644('0x2f')];if(!_0x23b604[_0x3644('0x30')]['hasOwnProperty'](_0x3644('0x37'))){_0x50b3e1['limit']=qs[_0x3644('0x1a')](_0x23b604[_0x3644('0x30')][_0x3644('0x1a')]);_0x50b3e1[_0x3644('0x19')]=qs[_0x3644('0x19')](_0x23b604[_0x3644('0x30')]['offset']);}_0x50b3e1[_0x3644('0x38')]=qs[_0x3644('0x39')](_0x23b604[_0x3644('0x30')]['sort']);_0x50b3e1[_0x3644('0x3a')]=qs[_0x3644('0x32')](_[_0x3644('0x3b')](_0x23b604[_0x3644('0x30')],_0x8476be['filters']),_0x2918ad);if(_0x23b604[_0x3644('0x30')][_0x3644('0x3c')]){_0x50b3e1['where']=_[_0x3644('0x3d')](_0x50b3e1[_0x3644('0x3a')],{'$or':_[_0x3644('0x2b')](_0x2918ad,function(_0x106e96){if(_0x106e96[_0x3644('0x3e')]!==_0x3644('0x3f')){var _0x28d2fd={};_0x28d2fd[_0x106e96[_0x3644('0x29')]]={'$like':'%'+_0x23b604[_0x3644('0x30')][_0x3644('0x3c')]+'%'};return _0x28d2fd;}})});}_0x50b3e1=_[_0x3644('0x3d')]({},_0x50b3e1,_0x23b604[_0x3644('0x40')]);var _0x1238f8={'where':_0x50b3e1['where']};return db[_0x3644('0x2c')]['count'](_0x1238f8)[_0x3644('0x22')](function(_0x841198){_0x53575d['count']=_0x841198;if(_0x23b604[_0x3644('0x30')]['includeAll']){_0x50b3e1[_0x3644('0x41')]=[{'all':!![]}];}return db[_0x3644('0x2c')][_0x3644('0x42')](_0x50b3e1);})['then'](function(_0x3010c4){_0x53575d['rows']=_0x3010c4;return _0x53575d;})['then'](respondWithFilteredResult(_0x1afd01,_0x50b3e1))[_0x3644('0x43')](handleError(_0x1afd01,null));};exports[_0x3644('0x44')]=function(_0x41d1d4,_0x5a06ff){var _0x225d2c={'raw':!![],'where':{'id':_0x41d1d4[_0x3644('0x45')]['id']}},_0x20d8f6={};_0x20d8f6[_0x3644('0x2f')]=_[_0x3644('0x31')](db['Interval']['rawAttributes']);_0x20d8f6[_0x3644('0x30')]=_['keys'](_0x41d1d4[_0x3644('0x30')]);_0x20d8f6['filters']=_[_0x3644('0x33')](_0x20d8f6[_0x3644('0x2f')],_0x20d8f6[_0x3644('0x30')]);_0x225d2c[_0x3644('0x34')]=_[_0x3644('0x33')](_0x20d8f6[_0x3644('0x2f')],qs[_0x3644('0x35')](_0x41d1d4[_0x3644('0x30')]['fields']));_0x225d2c[_0x3644('0x34')]=_0x225d2c['attributes'][_0x3644('0x36')]?_0x225d2c['attributes']:_0x20d8f6['model'];if(_0x41d1d4[_0x3644('0x30')][_0x3644('0x46')]){_0x225d2c['include']=[{'all':!![]}];}_0x225d2c=_[_0x3644('0x3d')]({},_0x225d2c,_0x41d1d4[_0x3644('0x40')]);return db[_0x3644('0x2c')]['find'](_0x225d2c)['then'](handleEntityNotFound(_0x5a06ff,null))['then'](respondWithResult(_0x5a06ff,null))[_0x3644('0x43')](handleError(_0x5a06ff,null));};exports[_0x3644('0x47')]=function(_0x101de8,_0x568b05){return db[_0x3644('0x2c')][_0x3644('0x47')](_0x101de8[_0x3644('0x48')],{})['then'](function(_0x215db7){var _0x254a7c=_0x101de8['user'][_0x3644('0x24')]({'plain':!![]});if(!_0x254a7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x254a7c[_0x3644('0x49')]===_0x3644('0x4a')){var _0x7ad57e=_0x215db7[_0x3644('0x24')]({'plain':!![]});var _0x1985b0='Intervals';return db[_0x3644('0x4b')]['find']({'where':{'name':_0x1985b0,'userProfileId':_0x254a7c[_0x3644('0x4c')]},'raw':!![]})['then'](function(_0xa7e676){if(_0xa7e676&&_0xa7e676['autoAssociation']===0x0){return db['UserProfileResource'][_0x3644('0x47')]({'name':_0x7ad57e['name'],'resourceId':_0x7ad57e['id'],'type':_0xa7e676[_0x3644('0x29')],'sectionId':_0xa7e676['id']},{})[_0x3644('0x22')](function(){return _0x215db7;});}else{return _0x215db7;}})['catch'](function(_0x322c08){logger[_0x3644('0x4d')](_0x3644('0x4e'),_0x322c08);throw _0x322c08;});}return _0x215db7;})['then'](respondWithResult(_0x568b05,0xc9))[_0x3644('0x43')](handleError(_0x568b05,null));};exports[_0x3644('0x21')]=function(_0x4bd95b,_0x434fc7){if(_0x4bd95b[_0x3644('0x48')]['id']){delete _0x4bd95b[_0x3644('0x48')]['id'];}return db['Interval'][_0x3644('0x4f')]({'where':{'id':_0x4bd95b[_0x3644('0x45')]['id']}})['then'](handleEntityNotFound(_0x434fc7,null))[_0x3644('0x22')](saveUpdates(_0x4bd95b['body'],null))['then'](respondWithResult(_0x434fc7,null))[_0x3644('0x43')](handleError(_0x434fc7,null));};exports[_0x3644('0x23')]=function(_0x215523,_0x1aafd2){return db[_0x3644('0x2c')][_0x3644('0x4f')]({'where':{'id':_0x215523[_0x3644('0x45')]['id']}})[_0x3644('0x22')](handleEntityNotFound(_0x1aafd2,null))[_0x3644('0x22')](removeEntity(_0x1aafd2,null))[_0x3644('0x43')](handleError(_0x1aafd2,null));};exports[_0x3644('0x50')]=function(_0x59b9bf,_0x27a39d,_0x58615c){if(_0x59b9bf[_0x3644('0x48')]['id']){delete _0x59b9bf[_0x3644('0x48')]['id'];}return db['Interval'][_0x3644('0x4f')]({'where':{'id':_0x59b9bf['params']['id']}})[_0x3644('0x22')](handleEntityNotFound(_0x27a39d,null))[_0x3644('0x22')](function(_0x4e704f){if(_0x4e704f){_0x59b9bf[_0x3644('0x48')][_0x3644('0x51')]=_0x4e704f['id'];return db[_0x3644('0x2c')][_0x3644('0x47')](_0x59b9bf[_0x3644('0x48')]);}})[_0x3644('0x22')](respondWithResult(_0x27a39d,null))[_0x3644('0x43')](handleError(_0x27a39d,null));};exports[_0x3644('0x52')]=function(_0x4e0114,_0x34786e,_0x16ea4c){var _0x59b6cc={};var _0x2689ba={};var _0x14a165;var _0x361a34;return db['Interval'][_0x3644('0x53')]({'where':{'id':_0x4e0114[_0x3644('0x45')]['id']}})[_0x3644('0x22')](handleEntityNotFound(_0x34786e,null))[_0x3644('0x22')](function(_0xefa7b1){if(_0xefa7b1){_0x14a165=_0xefa7b1;_0x2689ba[_0x3644('0x2f')]=_[_0x3644('0x31')](db[_0x3644('0x2c')]['rawAttributes']);_0x2689ba[_0x3644('0x30')]=_[_0x3644('0x31')](_0x4e0114[_0x3644('0x30')]);_0x2689ba[_0x3644('0x32')]=_[_0x3644('0x33')](_0x2689ba['model'],_0x2689ba[_0x3644('0x30')]);_0x59b6cc['attributes']=_['intersection'](_0x2689ba['model'],qs[_0x3644('0x35')](_0x4e0114[_0x3644('0x30')]['fields']));_0x59b6cc[_0x3644('0x34')]=_0x59b6cc[_0x3644('0x34')][_0x3644('0x36')]?_0x59b6cc['attributes']:_0x2689ba[_0x3644('0x2f')];_0x59b6cc[_0x3644('0x38')]=qs['sort'](_0x4e0114[_0x3644('0x30')][_0x3644('0x39')]);_0x59b6cc[_0x3644('0x3a')]=qs[_0x3644('0x32')](_[_0x3644('0x3b')](_0x4e0114[_0x3644('0x30')],_0x2689ba[_0x3644('0x32')]));if(_0x4e0114['query'][_0x3644('0x3c')]){_0x59b6cc[_0x3644('0x3a')]=_[_0x3644('0x3d')](_0x59b6cc[_0x3644('0x3a')],{'$or':_['map'](_0x59b6cc[_0x3644('0x34')],function(_0x4928de){var _0x101fba={};_0x101fba[_0x4928de]={'$like':'%'+_0x4e0114[_0x3644('0x30')][_0x3644('0x3c')]+'%'};return _0x101fba;})});}_0x59b6cc=_[_0x3644('0x3d')]({},_0x59b6cc,_0x4e0114[_0x3644('0x40')]);return _0x14a165['getIntervals'](_0x59b6cc);}})[_0x3644('0x22')](function(_0x58eaad){if(_0x58eaad){_0x361a34=_0x58eaad[_0x3644('0x36')];if(!_0x4e0114[_0x3644('0x30')][_0x3644('0x54')]('nolimit')){_0x59b6cc[_0x3644('0x1a')]=qs[_0x3644('0x1a')](_0x4e0114['query'][_0x3644('0x1a')]);_0x59b6cc[_0x3644('0x19')]=qs[_0x3644('0x19')](_0x4e0114[_0x3644('0x30')][_0x3644('0x19')]);}return _0x14a165[_0x3644('0x52')](_0x59b6cc);}})['then'](function(_0x114f5c){if(_0x114f5c){return _0x114f5c?{'count':_0x361a34,'rows':_0x114f5c}:null;}})[_0x3644('0x22')](respondWithResult(_0x34786e,null))[_0x3644('0x43')](handleError(_0x34786e,null));};exports['addIntervals']=function(_0x34ad71,_0x2538db,_0x355c39){return db['Interval'][_0x3644('0x53')]({'where':{'id':_0x34ad71[_0x3644('0x45')]['id']}})[_0x3644('0x22')](handleEntityNotFound(_0x2538db,null))[_0x3644('0x22')](function(_0x318d0c){if(_0x318d0c){return db[_0x3644('0x55')][_0x3644('0x56')](function(_0x544cd4){return db[_0x3644('0x2c')][_0x3644('0x23')]({'where':{'IntervalId':_0x34ad71['params']['id']},'transaction':_0x544cd4})[_0x3644('0x22')](function(_0x5cff70){var _0x1d9beb=_[_0x3644('0x2b')](_0x34ad71[_0x3644('0x48')],function(_0x4e6bf7){delete _0x4e6bf7['id'];_0x4e6bf7[_0x3644('0x51')]=_0x34ad71[_0x3644('0x45')]['id'];return _0x4e6bf7;});return db['Interval'][_0x3644('0x57')](_0x1d9beb,{'transaction':_0x544cd4});});})['then'](function(){return db[_0x3644('0x2c')][_0x3644('0x42')]({'where':{'IntervalId':_0x34ad71[_0x3644('0x45')]['id']}});});}})[_0x3644('0x22')](respondWithResult(_0x2538db,null))[_0x3644('0x43')](handleError(_0x2538db,null));}; \ No newline at end of file +var _0xa6d6=['findAll','params','keys','rawAttributes','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','findOne','pick','getIntervals','addIntervals','sequelize','bulkCreate','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','Interval'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa6d6,0xc9));var _0x6a6d=function(_0x49c968,_0x45b4b8){_0x49c968=_0x49c968-0x0;var _0x43a87e=_0xa6d6[_0x49c968];return _0x43a87e;};'use strict';var emlformat=require(_0x6a6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a6d('0x1'));var jsonpatch=require(_0x6a6d('0x2'));var rp=require('request-promise');var moment=require(_0x6a6d('0x3'));var BPromise=require(_0x6a6d('0x4'));var Mustache=require(_0x6a6d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6a6d('0x6'));var csv=require(_0x6a6d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a6d('0x8'));var _=require(_0x6a6d('0x9'));var squel=require(_0x6a6d('0xa'));var crypto=require(_0x6a6d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6a6d('0x7'));var querystring=require(_0x6a6d('0xc'));var Papa=require(_0x6a6d('0xd'));var Redis=require(_0x6a6d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6a6d('0xf'));var as=require(_0x6a6d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6a6d('0x11'));var licenseUtil=require(_0x6a6d('0x12'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6a6d('0x13'));function respondWithStatusCode(_0x4a345d,_0x208146){_0x208146=_0x208146||0xcc;return function(_0x413111){if(_0x413111){return _0x4a345d[_0x6a6d('0x14')](_0x208146);}return _0x4a345d[_0x6a6d('0x15')](_0x208146)['end']();};}function respondWithResult(_0x84368b,_0x515a94){_0x515a94=_0x515a94||0xc8;return function(_0x588bd8){if(_0x588bd8){return _0x84368b[_0x6a6d('0x15')](_0x515a94)[_0x6a6d('0x16')](_0x588bd8);}};}function respondWithFilteredResult(_0x44bc16,_0x3fff50){return function(_0x924a28){if(_0x924a28){var _0x30c37d=typeof _0x3fff50[_0x6a6d('0x17')]===_0x6a6d('0x18')&&typeof _0x3fff50[_0x6a6d('0x19')]===_0x6a6d('0x18');var _0x4188b8=_0x924a28[_0x6a6d('0x1a')];var _0x4e5dae=_0x30c37d?0x0:_0x3fff50[_0x6a6d('0x17')];var _0x2ce50f=_0x30c37d?_0x924a28[_0x6a6d('0x1a')]:_0x3fff50[_0x6a6d('0x17')]+_0x3fff50[_0x6a6d('0x19')];var _0x25b94d;if(_0x2ce50f>=_0x4188b8){_0x2ce50f=_0x4188b8;_0x25b94d=0xc8;}else{_0x25b94d=0xce;}_0x44bc16[_0x6a6d('0x15')](_0x25b94d);return _0x44bc16[_0x6a6d('0x1b')](_0x6a6d('0x1c'),_0x4e5dae+'-'+_0x2ce50f+'/'+_0x4188b8)['json'](_0x924a28);}return null;};}function patchUpdates(_0x486649){return function(_0x5c951e){try{jsonpatch[_0x6a6d('0x1d')](_0x5c951e,_0x486649,!![]);}catch(_0x205921){return BPromise[_0x6a6d('0x1e')](_0x205921);}return _0x5c951e[_0x6a6d('0x1f')]();};}function saveUpdates(_0x5e849d,_0x576173){return function(_0x1ece38){if(_0x1ece38){return _0x1ece38[_0x6a6d('0x20')](_0x5e849d)['then'](function(_0x58b4f8){return _0x58b4f8;});}return null;};}function removeEntity(_0x3defe3,_0x4dd0a0){return function(_0x5db14f){if(_0x5db14f){return _0x5db14f[_0x6a6d('0x21')]()[_0x6a6d('0x22')](function(){var _0x29b1fc=_0x5db14f[_0x6a6d('0x23')]({'plain':!![]});var _0x34ef8d=_0x6a6d('0x24');return db[_0x6a6d('0x25')][_0x6a6d('0x21')]({'where':{'type':_0x34ef8d,'resourceId':_0x29b1fc['id']}})['then'](function(){return _0x5db14f;});})[_0x6a6d('0x22')](function(){_0x3defe3[_0x6a6d('0x15')](0xcc)[_0x6a6d('0x26')]();});}};}function handleEntityNotFound(_0x453bf8,_0x209c9e){return function(_0x43af93){if(!_0x43af93){_0x453bf8['sendStatus'](0x194);}return _0x43af93;};}function handleError(_0xf12e3,_0x5f12e4){_0x5f12e4=_0x5f12e4||0x1f4;return function(_0x5c2758){logger[_0x6a6d('0x27')](_0x5c2758[_0x6a6d('0x28')]);if(_0x5c2758[_0x6a6d('0x29')]){delete _0x5c2758['name'];}_0xf12e3[_0x6a6d('0x15')](_0x5f12e4)[_0x6a6d('0x2a')](_0x5c2758);};}exports[_0x6a6d('0x2b')]=function(_0x24e7c1,_0xf870e2){var _0x2725b6={},_0x54547e={},_0x51f5a5={'count':0x0,'rows':[]};var _0x92c7e9=_[_0x6a6d('0x2c')](db['Interval']['rawAttributes'],function(_0x54b6d4){return{'name':_0x54b6d4[_0x6a6d('0x2d')],'type':_0x54b6d4[_0x6a6d('0x2e')][_0x6a6d('0x2f')]};});_0x54547e[_0x6a6d('0x30')]=_[_0x6a6d('0x2c')](_0x92c7e9,'name');_0x54547e['query']=_['keys'](_0x24e7c1[_0x6a6d('0x31')]);_0x54547e['filters']=_['intersection'](_0x54547e[_0x6a6d('0x30')],_0x54547e[_0x6a6d('0x31')]);_0x2725b6[_0x6a6d('0x32')]=_[_0x6a6d('0x33')](_0x54547e[_0x6a6d('0x30')],qs[_0x6a6d('0x34')](_0x24e7c1['query'][_0x6a6d('0x34')]));_0x2725b6['attributes']=_0x2725b6[_0x6a6d('0x32')][_0x6a6d('0x35')]?_0x2725b6[_0x6a6d('0x32')]:_0x54547e[_0x6a6d('0x30')];if(!_0x24e7c1[_0x6a6d('0x31')][_0x6a6d('0x36')](_0x6a6d('0x37'))){_0x2725b6[_0x6a6d('0x19')]=qs['limit'](_0x24e7c1[_0x6a6d('0x31')][_0x6a6d('0x19')]);_0x2725b6[_0x6a6d('0x17')]=qs[_0x6a6d('0x17')](_0x24e7c1[_0x6a6d('0x31')][_0x6a6d('0x17')]);}_0x2725b6[_0x6a6d('0x38')]=qs[_0x6a6d('0x39')](_0x24e7c1[_0x6a6d('0x31')][_0x6a6d('0x39')]);_0x2725b6[_0x6a6d('0x3a')]=qs[_0x6a6d('0x3b')](_['pick'](_0x24e7c1[_0x6a6d('0x31')],_0x54547e[_0x6a6d('0x3b')]),_0x92c7e9);if(_0x24e7c1[_0x6a6d('0x31')]['filter']){_0x2725b6[_0x6a6d('0x3a')]=_[_0x6a6d('0x3c')](_0x2725b6[_0x6a6d('0x3a')],{'$or':_[_0x6a6d('0x2c')](_0x92c7e9,function(_0xa43cc1){if(_0xa43cc1[_0x6a6d('0x2e')]!==_0x6a6d('0x3d')){var _0x2fc38f={};_0x2fc38f[_0xa43cc1[_0x6a6d('0x29')]]={'$like':'%'+_0x24e7c1['query'][_0x6a6d('0x3e')]+'%'};return _0x2fc38f;}})});}_0x2725b6=_[_0x6a6d('0x3c')]({},_0x2725b6,_0x24e7c1[_0x6a6d('0x3f')]);var _0x5287d5={'where':_0x2725b6[_0x6a6d('0x3a')]};return db['Interval'][_0x6a6d('0x1a')](_0x5287d5)[_0x6a6d('0x22')](function(_0x2a0810){_0x51f5a5[_0x6a6d('0x1a')]=_0x2a0810;if(_0x24e7c1[_0x6a6d('0x31')][_0x6a6d('0x40')]){_0x2725b6['include']=[{'all':!![]}];}return db[_0x6a6d('0x41')][_0x6a6d('0x42')](_0x2725b6);})[_0x6a6d('0x22')](function(_0x22b11a){_0x51f5a5['rows']=_0x22b11a;return _0x51f5a5;})[_0x6a6d('0x22')](respondWithFilteredResult(_0xf870e2,_0x2725b6))['catch'](handleError(_0xf870e2,null));};exports['show']=function(_0x3c80c4,_0x64d820){var _0x5ae3cb={'raw':!![],'where':{'id':_0x3c80c4[_0x6a6d('0x43')]['id']}},_0x5501f3={};_0x5501f3[_0x6a6d('0x30')]=_[_0x6a6d('0x44')](db[_0x6a6d('0x41')][_0x6a6d('0x45')]);_0x5501f3[_0x6a6d('0x31')]=_[_0x6a6d('0x44')](_0x3c80c4['query']);_0x5501f3[_0x6a6d('0x3b')]=_['intersection'](_0x5501f3[_0x6a6d('0x30')],_0x5501f3[_0x6a6d('0x31')]);_0x5ae3cb[_0x6a6d('0x32')]=_[_0x6a6d('0x33')](_0x5501f3[_0x6a6d('0x30')],qs[_0x6a6d('0x34')](_0x3c80c4['query']['fields']));_0x5ae3cb[_0x6a6d('0x32')]=_0x5ae3cb[_0x6a6d('0x32')][_0x6a6d('0x35')]?_0x5ae3cb['attributes']:_0x5501f3[_0x6a6d('0x30')];if(_0x3c80c4[_0x6a6d('0x31')][_0x6a6d('0x40')]){_0x5ae3cb[_0x6a6d('0x46')]=[{'all':!![]}];}_0x5ae3cb=_[_0x6a6d('0x3c')]({},_0x5ae3cb,_0x3c80c4[_0x6a6d('0x3f')]);return db[_0x6a6d('0x41')]['find'](_0x5ae3cb)[_0x6a6d('0x22')](handleEntityNotFound(_0x64d820,null))[_0x6a6d('0x22')](respondWithResult(_0x64d820,null))[_0x6a6d('0x47')](handleError(_0x64d820,null));};exports[_0x6a6d('0x48')]=function(_0x3cc266,_0xdbfeef){return db[_0x6a6d('0x41')]['create'](_0x3cc266[_0x6a6d('0x49')],{})[_0x6a6d('0x22')](function(_0x5e66da){var _0x5d4c27=_0x3cc266[_0x6a6d('0x4a')][_0x6a6d('0x23')]({'plain':!![]});if(!_0x5d4c27)throw new Error(_0x6a6d('0x4b'));if(_0x5d4c27[_0x6a6d('0x4c')]===_0x6a6d('0x4a')){var _0x2a054c=_0x5e66da[_0x6a6d('0x23')]({'plain':!![]});var _0x1c81c3=_0x6a6d('0x24');return db[_0x6a6d('0x4d')][_0x6a6d('0x4e')]({'where':{'name':_0x1c81c3,'userProfileId':_0x5d4c27[_0x6a6d('0x4f')]},'raw':!![]})[_0x6a6d('0x22')](function(_0x4bbe5d){if(_0x4bbe5d&&_0x4bbe5d[_0x6a6d('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a054c[_0x6a6d('0x29')],'resourceId':_0x2a054c['id'],'type':_0x4bbe5d[_0x6a6d('0x29')],'sectionId':_0x4bbe5d['id']},{})[_0x6a6d('0x22')](function(){return _0x5e66da;});}else{return _0x5e66da;}})[_0x6a6d('0x47')](function(_0x55ce49){logger[_0x6a6d('0x27')](_0x6a6d('0x51'),_0x55ce49);throw _0x55ce49;});}return _0x5e66da;})[_0x6a6d('0x22')](respondWithResult(_0xdbfeef,0xc9))[_0x6a6d('0x47')](handleError(_0xdbfeef,null));};exports[_0x6a6d('0x20')]=function(_0x3b524a,_0x123f06){if(_0x3b524a[_0x6a6d('0x49')]['id']){delete _0x3b524a[_0x6a6d('0x49')]['id'];}return db[_0x6a6d('0x41')][_0x6a6d('0x4e')]({'where':{'id':_0x3b524a[_0x6a6d('0x43')]['id']}})['then'](handleEntityNotFound(_0x123f06,null))[_0x6a6d('0x22')](saveUpdates(_0x3b524a['body'],null))[_0x6a6d('0x22')](respondWithResult(_0x123f06,null))[_0x6a6d('0x47')](handleError(_0x123f06,null));};exports[_0x6a6d('0x21')]=function(_0x20a811,_0x12859c){return db[_0x6a6d('0x41')][_0x6a6d('0x4e')]({'where':{'id':_0x20a811[_0x6a6d('0x43')]['id']}})[_0x6a6d('0x22')](handleEntityNotFound(_0x12859c,null))[_0x6a6d('0x22')](removeEntity(_0x12859c,null))[_0x6a6d('0x47')](handleError(_0x12859c,null));};exports['addInterval']=function(_0x1d09f0,_0x18bdcf,_0x486479){if(_0x1d09f0[_0x6a6d('0x49')]['id']){delete _0x1d09f0['body']['id'];}return db[_0x6a6d('0x41')][_0x6a6d('0x4e')]({'where':{'id':_0x1d09f0[_0x6a6d('0x43')]['id']}})['then'](handleEntityNotFound(_0x18bdcf,null))[_0x6a6d('0x22')](function(_0x50ae50){if(_0x50ae50){_0x1d09f0[_0x6a6d('0x49')][_0x6a6d('0x52')]=_0x50ae50['id'];return db[_0x6a6d('0x41')][_0x6a6d('0x48')](_0x1d09f0[_0x6a6d('0x49')]);}})['then'](respondWithResult(_0x18bdcf,null))[_0x6a6d('0x47')](handleError(_0x18bdcf,null));};exports['getIntervals']=function(_0x45349a,_0x5c14d4,_0x1fa412){var _0x105301={};var _0x2e59f9={};var _0x29b75f;var _0x266c9a;return db[_0x6a6d('0x41')][_0x6a6d('0x53')]({'where':{'id':_0x45349a[_0x6a6d('0x43')]['id']}})[_0x6a6d('0x22')](handleEntityNotFound(_0x5c14d4,null))[_0x6a6d('0x22')](function(_0x315fd8){if(_0x315fd8){_0x29b75f=_0x315fd8;_0x2e59f9['model']=_['keys'](db[_0x6a6d('0x41')][_0x6a6d('0x45')]);_0x2e59f9[_0x6a6d('0x31')]=_[_0x6a6d('0x44')](_0x45349a['query']);_0x2e59f9[_0x6a6d('0x3b')]=_[_0x6a6d('0x33')](_0x2e59f9[_0x6a6d('0x30')],_0x2e59f9['query']);_0x105301[_0x6a6d('0x32')]=_[_0x6a6d('0x33')](_0x2e59f9[_0x6a6d('0x30')],qs[_0x6a6d('0x34')](_0x45349a[_0x6a6d('0x31')][_0x6a6d('0x34')]));_0x105301[_0x6a6d('0x32')]=_0x105301[_0x6a6d('0x32')][_0x6a6d('0x35')]?_0x105301['attributes']:_0x2e59f9['model'];_0x105301['order']=qs[_0x6a6d('0x39')](_0x45349a[_0x6a6d('0x31')][_0x6a6d('0x39')]);_0x105301[_0x6a6d('0x3a')]=qs[_0x6a6d('0x3b')](_[_0x6a6d('0x54')](_0x45349a[_0x6a6d('0x31')],_0x2e59f9[_0x6a6d('0x3b')]));if(_0x45349a[_0x6a6d('0x31')][_0x6a6d('0x3e')]){_0x105301[_0x6a6d('0x3a')]=_[_0x6a6d('0x3c')](_0x105301[_0x6a6d('0x3a')],{'$or':_[_0x6a6d('0x2c')](_0x105301[_0x6a6d('0x32')],function(_0x556ac0){var _0x3ca97a={};_0x3ca97a[_0x556ac0]={'$like':'%'+_0x45349a[_0x6a6d('0x31')][_0x6a6d('0x3e')]+'%'};return _0x3ca97a;})});}_0x105301=_[_0x6a6d('0x3c')]({},_0x105301,_0x45349a['options']);return _0x29b75f[_0x6a6d('0x55')](_0x105301);}})['then'](function(_0x5082bb){if(_0x5082bb){_0x266c9a=_0x5082bb['length'];if(!_0x45349a[_0x6a6d('0x31')][_0x6a6d('0x36')](_0x6a6d('0x37'))){_0x105301[_0x6a6d('0x19')]=qs[_0x6a6d('0x19')](_0x45349a[_0x6a6d('0x31')][_0x6a6d('0x19')]);_0x105301[_0x6a6d('0x17')]=qs[_0x6a6d('0x17')](_0x45349a[_0x6a6d('0x31')][_0x6a6d('0x17')]);}return _0x29b75f['getIntervals'](_0x105301);}})[_0x6a6d('0x22')](function(_0x385323){if(_0x385323){return _0x385323?{'count':_0x266c9a,'rows':_0x385323}:null;}})[_0x6a6d('0x22')](respondWithResult(_0x5c14d4,null))[_0x6a6d('0x47')](handleError(_0x5c14d4,null));};exports[_0x6a6d('0x56')]=function(_0x33e215,_0x5cca60,_0x1f7855){return db[_0x6a6d('0x41')][_0x6a6d('0x53')]({'where':{'id':_0x33e215[_0x6a6d('0x43')]['id']}})[_0x6a6d('0x22')](handleEntityNotFound(_0x5cca60,null))[_0x6a6d('0x22')](function(_0x3648a9){if(_0x3648a9){return db[_0x6a6d('0x57')]['transaction'](function(_0x1ad40c){return db[_0x6a6d('0x41')][_0x6a6d('0x21')]({'where':{'IntervalId':_0x33e215[_0x6a6d('0x43')]['id']},'transaction':_0x1ad40c})['then'](function(_0x27d927){var _0x1d455b=_[_0x6a6d('0x2c')](_0x33e215[_0x6a6d('0x49')],function(_0x59b3c5){delete _0x59b3c5['id'];_0x59b3c5[_0x6a6d('0x52')]=_0x33e215[_0x6a6d('0x43')]['id'];return _0x59b3c5;});return db[_0x6a6d('0x41')][_0x6a6d('0x58')](_0x1d455b,{'transaction':_0x1ad40c});});})[_0x6a6d('0x22')](function(){return db[_0x6a6d('0x41')][_0x6a6d('0x42')]({'where':{'IntervalId':_0x33e215[_0x6a6d('0x43')]['id']}});});}})[_0x6a6d('0x22')](respondWithResult(_0x5cca60,null))[_0x6a6d('0x47')](handleError(_0x5cca60,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 06ebf08..f04bb79 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 _0x2bb7=['ifTime','then','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','all','map'];(function(_0x3da9d1,_0x5a0d2d){var _0x30138a=function(_0x13236d){while(--_0x13236d){_0x3da9d1['push'](_0x3da9d1['shift']());}};_0x30138a(++_0x5a0d2d);}(_0x2bb7,0xe3));var _0x72bb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2bb7[_0x5b644e];return _0x49c6bf;};'use strict';var attributes=require(_0x72bb('0x0'));var extensions=require(_0x72bb('0x1'));var iftime=require(_0x72bb('0x2'))['iftime'];module[_0x72bb('0x3')]=function(_0x59e959){return _0x59e959[_0x72bb('0x4')](_0x72bb('0x5'),attributes,{'tableName':_0x72bb('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cc243){extensions[_0x72bb('0x7')](_0x59e959,_0x1cc243);},'afterBulkCreate':function(_0x3f6954,_0x1ee649,_0x3d1438){_0x3d1438();extensions[_0x72bb('0x7')](_0x59e959,_0x3f6954[0x0]);},'afterUpdate':function(_0x33ec79){extensions['rewrite'](_0x59e959,_0x33ec79);},'afterDestroy':function(_0x5c4951){extensions['rewrite'](_0x59e959,_0x5c4951);}},'instanceMethods':{'ifTime':function(_0x3664c9=undefined,_0x5bcd29=new Date()){if(typeof this[_0x72bb('0x8')]===_0x72bb('0x9')){return iftime(this[_0x72bb('0x8')],_0x3664c9,_0x5bcd29);}else{return this[_0x72bb('0xa')]()['then'](function(_0x3d95f9){return Promise[_0x72bb('0xb')](_0x3d95f9[_0x72bb('0xc')](function(_0x2dc1e6){return _0x2dc1e6[_0x72bb('0xd')](_0x3664c9,_0x5bcd29);}));})[_0x72bb('0xe')](function(_0x10fc33){return _0x10fc33['reduce'](function(_0x5b775a,_0x56a721){return _0x5b775a||_0x56a721;},![]);});}}}});}; \ No newline at end of file +var _0x88d6=['iftime','exports','Interval','tools_intervals','rewrite','string','interval','then','all','map','reduce','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x1c169a,_0x37a2fa){var _0x4be19d=function(_0x1e8d6d){while(--_0x1e8d6d){_0x1c169a['push'](_0x1c169a['shift']());}};_0x4be19d(++_0x37a2fa);}(_0x88d6,0x11c));var _0x688d=function(_0x47116f,_0x14a1da){_0x47116f=_0x47116f-0x0;var _0x465362=_0x88d6[_0x47116f];return _0x465362;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x688d('0x0'));var iftime=require(_0x688d('0x1'))[_0x688d('0x2')];module[_0x688d('0x3')]=function(_0xd31a0){return _0xd31a0['define'](_0x688d('0x4'),attributes,{'tableName':_0x688d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc5b779){extensions[_0x688d('0x6')](_0xd31a0,_0xc5b779);},'afterBulkCreate':function(_0x475ef8,_0x2ce1e7,_0x6eec24){_0x6eec24();extensions['rewrite'](_0xd31a0,_0x475ef8[0x0]);},'afterUpdate':function(_0x57b337){extensions[_0x688d('0x6')](_0xd31a0,_0x57b337);},'afterDestroy':function(_0x26cee7){extensions[_0x688d('0x6')](_0xd31a0,_0x26cee7);}},'instanceMethods':{'ifTime':function(_0x514b21=undefined,_0xfc8cf4=new Date()){if(typeof this['interval']===_0x688d('0x7')){return iftime(this[_0x688d('0x8')],_0x514b21,_0xfc8cf4);}else{return this['getIntervals']()[_0x688d('0x9')](function(_0x185693){return Promise[_0x688d('0xa')](_0x185693[_0x688d('0xb')](function(_0x5a5457){return _0x5a5457['ifTime'](_0x514b21,_0xfc8cf4);}));})[_0x688d('0x9')](function(_0x16ed28){return _0x16ed28[_0x688d('0xc')](function(_0x5f9864,_0x52bbbb){return _0x5f9864||_0x52bbbb;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c597a35..cf4acfc 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 _0x77d5=['reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','options','where','limit','include','map','model','attributes','then','debug','stringify','catch','error','message','ShowInterval','find','raw','info','findAll','all','ifTime'];(function(_0x1233d2,_0x5416f4){var _0x22759e=function(_0xb516aa){while(--_0xb516aa){_0x1233d2['push'](_0x1233d2['shift']());}};_0x22759e(++_0x5416f4);}(_0x77d5,0x13d));var _0x577d=function(_0x2ac97d,_0x20ebd6){_0x2ac97d=_0x2ac97d-0x0;var _0x44146b=_0x77d5[_0x2ac97d];return _0x44146b;};'use strict';var _=require(_0x577d('0x0'));var util=require(_0x577d('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x577d('0x2'))['iftime'];var logger=require(_0x577d('0x3'))(_0x577d('0x4'));exports[_0x577d('0x5')]=function(_0xeb25c8){var _0x20c074=this;return new Promise(function(_0x2a158e,_0x9db38c){return db[_0x577d('0x6')]['findAll']({'raw':_0xeb25c8['options']?_0xeb25c8['options']['raw']===undefined?!![]:![]:!![],'where':_0xeb25c8[_0x577d('0x7')]?_0xeb25c8[_0x577d('0x7')][_0x577d('0x8')]||null:null,'attributes':_0xeb25c8[_0x577d('0x7')]?_0xeb25c8[_0x577d('0x7')]['attributes']||null:null,'limit':_0xeb25c8[_0x577d('0x7')]?_0xeb25c8[_0x577d('0x7')][_0x577d('0x9')]||null:null,'include':_0xeb25c8[_0x577d('0x7')]?_0xeb25c8[_0x577d('0x7')][_0x577d('0xa')]?_[_0x577d('0xb')](_0xeb25c8[_0x577d('0x7')][_0x577d('0xa')],function(_0x4287a0){return{'model':db[_0x4287a0[_0x577d('0xc')]],'as':_0x4287a0['as'],'attributes':_0x4287a0[_0x577d('0xd')],'include':_0x4287a0[_0x577d('0xa')]?_[_0x577d('0xb')](_0x4287a0[_0x577d('0xa')],function(_0x52d673){return{'model':db[_0x52d673[_0x577d('0xc')]],'as':_0x52d673['as'],'attributes':_0x52d673[_0x577d('0xd')],'include':_0x52d673['include']?_[_0x577d('0xb')](_0x52d673[_0x577d('0xa')],function(_0xe41b8a){return{'model':db[_0xe41b8a[_0x577d('0xc')]],'as':_0xe41b8a['as'],'attributes':_0xe41b8a['attributes']};}):[]};}):[]};}):[]:[]})[_0x577d('0xe')](function(_0x151939){logger['info'](_0x577d('0x5'),_0xeb25c8);logger[_0x577d('0xf')](_0x577d('0x5'),_0xeb25c8,JSON[_0x577d('0x10')](_0x151939));_0x2a158e(_0x151939);})[_0x577d('0x11')](function(_0x546453){logger[_0x577d('0x12')]('GetInterval',_0x546453[_0x577d('0x13')],_0xeb25c8);_0x9db38c(_0x20c074['error'](0x1f4,_0x546453[_0x577d('0x13')]));});});};exports[_0x577d('0x14')]=function(_0xd026f4){var _0x8b8dca=this;return new Promise(function(_0x2e9ea2,_0x3acc19){return db['Interval'][_0x577d('0x15')]({'raw':_0xd026f4['options']?_0xd026f4[_0x577d('0x7')][_0x577d('0x16')]===undefined?!![]:![]:!![],'where':_0xd026f4[_0x577d('0x7')]?_0xd026f4[_0x577d('0x7')]['where']||null:null,'attributes':_0xd026f4['options']?_0xd026f4[_0x577d('0x7')][_0x577d('0xd')]||null:null,'include':_0xd026f4[_0x577d('0x7')]?_0xd026f4['options'][_0x577d('0xa')]?_[_0x577d('0xb')](_0xd026f4[_0x577d('0x7')][_0x577d('0xa')],function(_0x3f2d41){return{'model':db[_0x3f2d41[_0x577d('0xc')]],'as':_0x3f2d41['as'],'attributes':_0x3f2d41[_0x577d('0xd')],'include':_0x3f2d41[_0x577d('0xa')]?_[_0x577d('0xb')](_0x3f2d41[_0x577d('0xa')],function(_0x546559){return{'model':db[_0x546559[_0x577d('0xc')]],'as':_0x546559['as'],'attributes':_0x546559[_0x577d('0xd')],'include':_0x546559[_0x577d('0xa')]?_[_0x577d('0xb')](_0x546559[_0x577d('0xa')],function(_0x2d14f2){return{'model':db[_0x2d14f2[_0x577d('0xc')]],'as':_0x2d14f2['as'],'attributes':_0x2d14f2[_0x577d('0xd')]};}):[]};}):[]};}):[]:[]})[_0x577d('0xe')](function(_0x299b99){logger[_0x577d('0x17')](_0x577d('0x14'),_0xd026f4);logger[_0x577d('0xf')](_0x577d('0x14'),_0xd026f4,JSON[_0x577d('0x10')](_0x299b99));_0x2e9ea2(_0x299b99);})[_0x577d('0x11')](function(_0x772a16){logger[_0x577d('0x12')](_0x577d('0x14'),_0x772a16[_0x577d('0x13')],_0xd026f4);_0x3acc19(_0x8b8dca[_0x577d('0x12')](0x1f4,_0x772a16[_0x577d('0x13')]));});});};function checkArrayOfIntervals(_0x5b92af,_0x1907fd){var _0x3a1bc2=[];return db[_0x577d('0x6')][_0x577d('0x18')]({'where':{'id':_0x5b92af}})['then'](function(_0x11a2fe){_0x3a1bc2=_0x11a2fe;return Promise[_0x577d('0x19')](_0x3a1bc2['map'](function(_0x546ae2){return _0x546ae2[_0x577d('0x1a')](_0x1907fd);}));})[_0x577d('0xe')](function(_0x3882cf){var _0x50bf71=_0x3882cf[_0x577d('0x1b')](function(_0x217b71,_0x59e6da){return _0x217b71||_0x59e6da;},![]);logger[_0x577d('0x17')](util['format'](_0x577d('0x1c'),_0x3a1bc2[_0x577d('0xb')](function(_0x550650){return _0x550650['name'];})['join'](',\x20'),_0x3a1bc2[_0x577d('0xb')](function(_0x334586){return _0x334586['id'];})[_0x577d('0x1d')](',\x20')));return _0x50bf71;});}function checkSingleInterval(_0x20625c,_0x2715fe){return db['Interval']['findById'](_0x20625c)[_0x577d('0xe')](function(_0x4be1f2){if(_0x4be1f2){logger['info'](util[_0x577d('0x1e')](_0x577d('0x1f'),_0x4be1f2[_0x577d('0x20')],_0x4be1f2['id']));return _0x4be1f2['ifTime'](_0x2715fe);}});}exports[_0x577d('0x21')]=function(_0x2c714f){var _0x269686=_0x2c714f['intervalIds'];var _0x4b8839=Array[_0x577d('0x22')](_0x2c714f['intervals'])?_0x2c714f[_0x577d('0x23')]:typeof _0x2c714f['intervals']==='string'?[_0x2c714f[_0x577d('0x23')]]:[];var _0x173a87=_0x2c714f[_0x577d('0x24')]||undefined;var _0x14a5f8=![];if(_0x4b8839[_0x577d('0x25')]){logger[_0x577d('0x17')](util[_0x577d('0x1e')](_0x577d('0x26'),_0x4b8839['join'](';\x20')));}if(_0x173a87){logger[_0x577d('0x17')](util[_0x577d('0x1e')](_0x577d('0x27'),_0x173a87));}logger[_0x577d('0xf')](_0x577d('0x28'),_0x14a5f8);logger[_0x577d('0x29')](_0x577d('0x21'),_0x2c714f);return Promise[_0x577d('0x2a')]()['then'](function(){if(Array['isArray'](_0x269686)){return checkArrayOfIntervals(_0x269686,_0x173a87);}else if(_0x269686){return checkSingleInterval(_0x269686,_0x173a87);}})[_0x577d('0xe')](function(_0x1bd391){var _0x20213b=_0x4b8839[_0x577d('0x1b')](function(_0x220851,_0x270198){return _0x220851||iftime(_0x270198,_0x173a87);},![]);_0x14a5f8=_0x1bd391||_0x20213b;return _0x14a5f8;})['catch'](function(_0x5ead44){logger['error'](_0x577d('0x21'),_0x2c714f,_0x5ead44);throw this[_0x577d('0x12')](0x1f4,_0x5ead44[_0x577d('0x13')]);});}; \ No newline at end of file +var _0x0c41=['silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','options','raw','where','attributes','limit','map','include','model','info','debug','stringify','error','ShowInterval','Interval','find','catch','message','findAll','then','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s'];(function(_0x98b55b,_0x1bc38a){var _0x20bb80=function(_0x11de3b){while(--_0x11de3b){_0x98b55b['push'](_0x98b55b['shift']());}};_0x20bb80(++_0x1bc38a);}(_0x0c41,0xde));var _0x10c4=function(_0x565f12,_0x5ab213){_0x565f12=_0x565f12-0x0;var _0x3c8051=_0x0c41[_0x565f12];return _0x3c8051;};'use strict';var _=require(_0x10c4('0x0'));var util=require(_0x10c4('0x1'));var db=require(_0x10c4('0x2'))['db'];var iftime=require(_0x10c4('0x3'))[_0x10c4('0x4')];var logger=require(_0x10c4('0x5'))(_0x10c4('0x6'));exports[_0x10c4('0x7')]=function(_0x8376e6){var _0x15691b=this;return new Promise(function(_0x465425,_0x4303d2){return db['Interval']['findAll']({'raw':_0x8376e6['options']?_0x8376e6[_0x10c4('0x8')][_0x10c4('0x9')]===undefined?!![]:![]:!![],'where':_0x8376e6['options']?_0x8376e6['options'][_0x10c4('0xa')]||null:null,'attributes':_0x8376e6[_0x10c4('0x8')]?_0x8376e6['options'][_0x10c4('0xb')]||null:null,'limit':_0x8376e6[_0x10c4('0x8')]?_0x8376e6[_0x10c4('0x8')][_0x10c4('0xc')]||null:null,'include':_0x8376e6[_0x10c4('0x8')]?_0x8376e6[_0x10c4('0x8')]['include']?_[_0x10c4('0xd')](_0x8376e6['options'][_0x10c4('0xe')],function(_0x43beb5){return{'model':db[_0x43beb5[_0x10c4('0xf')]],'as':_0x43beb5['as'],'attributes':_0x43beb5[_0x10c4('0xb')],'include':_0x43beb5['include']?_[_0x10c4('0xd')](_0x43beb5['include'],function(_0x17cb69){return{'model':db[_0x17cb69[_0x10c4('0xf')]],'as':_0x17cb69['as'],'attributes':_0x17cb69[_0x10c4('0xb')],'include':_0x17cb69[_0x10c4('0xe')]?_[_0x10c4('0xd')](_0x17cb69[_0x10c4('0xe')],function(_0x56b644){return{'model':db[_0x56b644['model']],'as':_0x56b644['as'],'attributes':_0x56b644[_0x10c4('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x175e92){logger[_0x10c4('0x10')](_0x10c4('0x7'),_0x8376e6);logger[_0x10c4('0x11')](_0x10c4('0x7'),_0x8376e6,JSON[_0x10c4('0x12')](_0x175e92));_0x465425(_0x175e92);})['catch'](function(_0x48a6a3){logger[_0x10c4('0x13')](_0x10c4('0x7'),_0x48a6a3['message'],_0x8376e6);_0x4303d2(_0x15691b['error'](0x1f4,_0x48a6a3['message']));});});};exports[_0x10c4('0x14')]=function(_0x4c2eee){var _0x455027=this;return new Promise(function(_0x590077,_0x3dda73){return db[_0x10c4('0x15')][_0x10c4('0x16')]({'raw':_0x4c2eee['options']?_0x4c2eee[_0x10c4('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x4c2eee[_0x10c4('0x8')]?_0x4c2eee[_0x10c4('0x8')]['where']||null:null,'attributes':_0x4c2eee[_0x10c4('0x8')]?_0x4c2eee['options']['attributes']||null:null,'include':_0x4c2eee[_0x10c4('0x8')]?_0x4c2eee['options'][_0x10c4('0xe')]?_[_0x10c4('0xd')](_0x4c2eee[_0x10c4('0x8')][_0x10c4('0xe')],function(_0x4c9a66){return{'model':db[_0x4c9a66[_0x10c4('0xf')]],'as':_0x4c9a66['as'],'attributes':_0x4c9a66[_0x10c4('0xb')],'include':_0x4c9a66[_0x10c4('0xe')]?_[_0x10c4('0xd')](_0x4c9a66['include'],function(_0x53adf4){return{'model':db[_0x53adf4[_0x10c4('0xf')]],'as':_0x53adf4['as'],'attributes':_0x53adf4['attributes'],'include':_0x53adf4['include']?_[_0x10c4('0xd')](_0x53adf4[_0x10c4('0xe')],function(_0x367347){return{'model':db[_0x367347[_0x10c4('0xf')]],'as':_0x367347['as'],'attributes':_0x367347['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x100580){logger[_0x10c4('0x10')](_0x10c4('0x14'),_0x4c2eee);logger[_0x10c4('0x11')](_0x10c4('0x14'),_0x4c2eee,JSON[_0x10c4('0x12')](_0x100580));_0x590077(_0x100580);})[_0x10c4('0x17')](function(_0x531f21){logger[_0x10c4('0x13')]('ShowInterval',_0x531f21[_0x10c4('0x18')],_0x4c2eee);_0x3dda73(_0x455027[_0x10c4('0x13')](0x1f4,_0x531f21['message']));});});};function checkArrayOfIntervals(_0x468ef4,_0x50ee8b){var _0x483483=[];return db[_0x10c4('0x15')][_0x10c4('0x19')]({'where':{'id':_0x468ef4}})[_0x10c4('0x1a')](function(_0x6c4491){_0x483483=_0x6c4491;return Promise[_0x10c4('0x1b')](_0x483483[_0x10c4('0xd')](function(_0x2432d6){return _0x2432d6[_0x10c4('0x1c')](_0x50ee8b);}));})[_0x10c4('0x1a')](function(_0x1a0edb){var _0xabe8f7=_0x1a0edb[_0x10c4('0x1d')](function(_0x4aa061,_0x35d722){return _0x4aa061||_0x35d722;},![]);logger[_0x10c4('0x10')](util[_0x10c4('0x1e')](_0x10c4('0x1f'),_0x483483[_0x10c4('0xd')](function(_0x450a16){return _0x450a16[_0x10c4('0x20')];})['join'](',\x20'),_0x483483[_0x10c4('0xd')](function(_0x33ac1a){return _0x33ac1a['id'];})[_0x10c4('0x21')](',\x20')));return _0xabe8f7;});}function checkSingleInterval(_0x535bc2,_0x2f17bd){return db[_0x10c4('0x15')]['findById'](_0x535bc2)[_0x10c4('0x1a')](function(_0x2a347c){if(_0x2a347c){logger[_0x10c4('0x10')](util[_0x10c4('0x1e')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x2a347c[_0x10c4('0x20')],_0x2a347c['id']));return _0x2a347c[_0x10c4('0x1c')](_0x2f17bd);}});}exports[_0x10c4('0x22')]=function(_0x573414){var _0xa97134=_0x573414[_0x10c4('0x23')];var _0x374ab5=Array['isArray'](_0x573414[_0x10c4('0x24')])?_0x573414['intervals']:typeof _0x573414[_0x10c4('0x24')]===_0x10c4('0x25')?[_0x573414[_0x10c4('0x24')]]:[];var _0x3b6b70=_0x573414[_0x10c4('0x26')]||undefined;var _0x41d52a=![];if(_0x374ab5[_0x10c4('0x27')]){logger[_0x10c4('0x10')](util[_0x10c4('0x1e')](_0x10c4('0x28'),_0x374ab5[_0x10c4('0x21')](';\x20')));}if(_0x3b6b70){logger['info'](util['format'](_0x10c4('0x29'),_0x3b6b70));}logger[_0x10c4('0x11')]('Iftime',_0x41d52a);logger[_0x10c4('0x2a')]('IntervalIftime',_0x573414);return Promise[_0x10c4('0x2b')]()['then'](function(){if(Array['isArray'](_0xa97134)){return checkArrayOfIntervals(_0xa97134,_0x3b6b70);}else if(_0xa97134){return checkSingleInterval(_0xa97134,_0x3b6b70);}})['then'](function(_0x405aaa){var _0x44e5ef=_0x374ab5[_0x10c4('0x1d')](function(_0x57bee4,_0x122d2e){return _0x57bee4||iftime(_0x122d2e,_0x3b6b70);},![]);_0x41d52a=_0x405aaa||_0x44e5ef;return _0x41d52a;})[_0x10c4('0x17')](function(_0x21f88f){logger[_0x10c4('0x13')](_0x10c4('0x22'),_0x573414,_0x21f88f);throw this['error'](0x1f4,_0x21f88f[_0x10c4('0x18')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2e1d032..54bdd70 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x5a9d7e,_0x56332a){var _0x559205=function(_0x23d0c2){while(--_0x23d0c2){_0x5a9d7e['push'](_0x5a9d7e['shift']());}};_0x559205(++_0x56332a);}(_0x2032,0xd9));var _0x2203=function(_0x268b2a,_0x4609cf){_0x268b2a=_0x268b2a-0x0;var _0x322e33=_0x2032[_0x268b2a];return _0x322e33;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0x0b0e[_0x5976f8];return _0x179715;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 68cc2fc..b25ede3 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 _0x094b=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','newToken','customfield_11503','customfield_10102','track.xcallymotion.com','POST','application/json','toString','request','setEncoding','utf8','status','statusCode','json'];(function(_0x333ac3,_0x3a975f){var _0x3883df=function(_0x50918c){while(--_0x50918c){_0x333ac3['push'](_0x333ac3['shift']());}};_0x3883df(++_0x3a975f);}(_0x094b,0x1c3));var _0xb094=function(_0x63592,_0x3ff1eb){_0x63592=_0x63592-0x0;var _0x463e03=_0x094b[_0x63592];return _0x463e03;};'use strict';var BPromise=require('bluebird');var https=require(_0xb094('0x0'));var logger=require(_0xb094('0x1'))('api');var USERNAME='support';var PASSWORD=_0xb094('0x2');function openIssue(_0x81ae1,_0x16a12b){var _0x3c0604={'fields':{'project':{'key':_0x81ae1[_0xb094('0x3')]||_0xb094('0x4')},'summary':(_0x81ae1[_0xb094('0x5')]||_0xb094('0x6'))+_0xb094('0x7')+_0x81ae1['ip'],'description':_0x81ae1[_0xb094('0x8')]||JSON[_0xb094('0x9')](_0x81ae1),'issuetype':{'name':_0x81ae1[_0xb094('0xa')]||_0xb094('0xb')}}};_0x3c0604[_0xb094('0xc')]['customfield_11500']=_0x81ae1[_0xb094('0xd')];_0x3c0604[_0xb094('0xc')][_0xb094('0xe')]=_0x81ae1[_0xb094('0xf')];_0x3c0604['fields']['customfield_11502']=_0x81ae1[_0xb094('0x10')];_0x3c0604['fields'][_0xb094('0x11')]=_0x81ae1['name'];_0x3c0604['fields']['customfield_11504']=_0x81ae1['reason'];_0x3c0604[_0xb094('0xc')][_0xb094('0x12')]=_0x81ae1['ip'];var _0x4a827d={'host':_0xb094('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xb094('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xb094('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xb094('0x16')]('base64')}};var _0x4c73b4=JSON[_0xb094('0x9')](_0x3c0604);var _0x3e90b2=https[_0xb094('0x17')](_0x4a827d,function(_0x51dded){_0x51dded[_0xb094('0x18')](_0xb094('0x19'));var _0x5a57fe='';_0x51dded['on']('data',function(_0x1e0842){_0x5a57fe+=_0x1e0842;});_0x51dded['on']('end',function(){if(_0x16a12b){return _0x16a12b[_0xb094('0x1a')](_0x51dded[_0xb094('0x1b')])[_0xb094('0x1c')](JSON['parse'](_0x5a57fe));}});});_0x3e90b2['on']('error',function(_0x1bd3a1){if(_0x16a12b){return _0x16a12b[_0xb094('0x1a')](0x1f4)[_0xb094('0x1c')]({'errors':[{'message':_0xb094('0x1d'),'type':_0xb094('0x1e')}]});}});_0x3e90b2[_0xb094('0x1f')](_0x4c73b4);_0x3e90b2[_0xb094('0x20')]();}exports[_0xb094('0x21')]=openIssue;exports['send']=function(_0x2de9fe,_0x149578){_0x2de9fe['body']['ip']=_0x2de9fe[_0xb094('0x22')][_0xb094('0x23')]||_0x2de9fe[_0xb094('0x24')][_0xb094('0x25')]||_0x2de9fe[_0xb094('0x26')]['remoteAddress']||_0x2de9fe[_0xb094('0x24')][_0xb094('0x26')]['remoteAddress'];return openIssue(_0x2de9fe[_0xb094('0x27')],_0x149578);}; \ No newline at end of file +var _0xe696=['utf8','data','end','status','statusCode','parse','json','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','stringify','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding'];(function(_0x2494b6,_0x22541d){var _0x257ca4=function(_0x20ac3a){while(--_0x20ac3a){_0x2494b6['push'](_0x2494b6['shift']());}};_0x257ca4(++_0x22541d);}(_0xe696,0xc1));var _0x6e69=function(_0x31e5a6,_0x581e9b){_0x31e5a6=_0x31e5a6-0x0;var _0x99f068=_0xe696[_0x31e5a6];return _0x99f068;};'use strict';var BPromise=require('bluebird');var https=require(_0x6e69('0x0'));var logger=require(_0x6e69('0x1'))(_0x6e69('0x2'));var USERNAME=_0x6e69('0x3');var PASSWORD=_0x6e69('0x4');function openIssue(_0x43bee1,_0x479312){var _0x57f77c={'fields':{'project':{'key':_0x43bee1[_0x6e69('0x5')]||_0x6e69('0x6')},'summary':(_0x43bee1['summary']||_0x6e69('0x7'))+'\x20from\x20'+_0x43bee1['ip'],'description':_0x43bee1['description']||JSON[_0x6e69('0x8')](_0x43bee1),'issuetype':{'name':_0x43bee1['issuetype']||_0x6e69('0x9')}}};_0x57f77c[_0x6e69('0xa')]['customfield_11500']=_0x43bee1['email'];_0x57f77c[_0x6e69('0xa')][_0x6e69('0xb')]=_0x43bee1[_0x6e69('0xc')];_0x57f77c[_0x6e69('0xa')][_0x6e69('0xd')]=_0x43bee1[_0x6e69('0xe')];_0x57f77c[_0x6e69('0xa')]['customfield_11503']=_0x43bee1[_0x6e69('0xf')];_0x57f77c[_0x6e69('0xa')]['customfield_11504']=_0x43bee1[_0x6e69('0x10')];_0x57f77c[_0x6e69('0xa')][_0x6e69('0x11')]=_0x43bee1['ip'];var _0x4a034c={'host':_0x6e69('0x12'),'port':0x1bb,'path':_0x6e69('0x13'),'method':_0x6e69('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x6e69('0x15'),'Authorization':_0x6e69('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x6e69('0x17')](_0x6e69('0x18'))}};var _0x2da063=JSON[_0x6e69('0x8')](_0x57f77c);var _0x12bfc3=https[_0x6e69('0x19')](_0x4a034c,function(_0x890c28){_0x890c28[_0x6e69('0x1a')](_0x6e69('0x1b'));var _0x1bfb18='';_0x890c28['on'](_0x6e69('0x1c'),function(_0x127db4){_0x1bfb18+=_0x127db4;});_0x890c28['on'](_0x6e69('0x1d'),function(){if(_0x479312){return _0x479312[_0x6e69('0x1e')](_0x890c28[_0x6e69('0x1f')])['json'](JSON[_0x6e69('0x20')](_0x1bfb18));}});});_0x12bfc3['on']('error',function(_0x546fe6){if(_0x479312){return _0x479312[_0x6e69('0x1e')](0x1f4)[_0x6e69('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x6e69('0x22')}]});}});_0x12bfc3[_0x6e69('0x23')](_0x2da063);_0x12bfc3[_0x6e69('0x1d')]();}exports[_0x6e69('0x24')]=openIssue;exports[_0x6e69('0x25')]=function(_0x2b448d,_0x441dd5){_0x2b448d['body']['ip']=_0x2b448d[_0x6e69('0x26')][_0x6e69('0x27')]||_0x2b448d[_0x6e69('0x28')][_0x6e69('0x29')]||_0x2b448d[_0x6e69('0x2a')][_0x6e69('0x29')]||_0x2b448d[_0x6e69('0x28')][_0x6e69('0x2a')][_0x6e69('0x29')];return openIssue(_0x2b448d[_0x6e69('0x2b')],_0x441dd5);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 8bee092..bdcfbc5 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 _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x4bfade,_0x2200f7){var _0x2653f8=function(_0x4b85b4){while(--_0x4b85b4){_0x4bfade['push'](_0x4bfade['shift']());}};_0x2653f8(++_0x2200f7);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3cb530,_0x170e8c){_0x3cb530=_0x3cb530-0x0;var _0x4168ea=_0xf3cd[_0x3cb530];return _0x4168ea;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router; \ No newline at end of file +var _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xda55,0x6d));var _0x5da5=function(_0x5be658,_0x35d76d){_0x5be658=_0x5be658-0x0;var _0x373777=_0xda55[_0x5be658];return _0x373777;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 28f9f66..df2b0d1 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x3b13f7,_0x4b022f){_0x3b13f7=_0x3b13f7-0x0;var _0x43c13a=_0x7a54[_0x3b13f7];return _0x43c13a;};'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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0xa4af43,_0x2b5e97){_0xa4af43=_0xa4af43-0x0;var _0x5a7e76=_0x7a54[_0xa4af43];return _0x5a7e76;};'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 bed9502..29a8a52 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 _0xea31=['map','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','JscriptyAnswerReport','includeAll','include','findAll','catch','params','keys','length','options','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','stack','name','send','index'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xea31,0x6b));var _0x1ea3=function(_0x4f15c0,_0x23103c){_0x4f15c0=_0x4f15c0-0x0;var _0x63d358=_0xea31[_0x4f15c0];return _0x63d358;};'use strict';var emlformat=require(_0x1ea3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ea3('0x1'));var jsonpatch=require(_0x1ea3('0x2'));var rp=require(_0x1ea3('0x3'));var moment=require(_0x1ea3('0x4'));var BPromise=require(_0x1ea3('0x5'));var Mustache=require(_0x1ea3('0x6'));var util=require(_0x1ea3('0x7'));var path=require('path');var sox=require(_0x1ea3('0x8'));var csv=require(_0x1ea3('0x9'));var ejs=require(_0x1ea3('0xa'));var fs=require('fs');var fs_extra=require(_0x1ea3('0xb'));var _=require(_0x1ea3('0xc'));var squel=require('squel');var crypto=require(_0x1ea3('0xd'));var jsforce=require(_0x1ea3('0xe'));var deskjs=require(_0x1ea3('0xf'));var toCsv=require(_0x1ea3('0x9'));var querystring=require(_0x1ea3('0x10'));var Papa=require(_0x1ea3('0x11'));var Redis=require('ioredis');var authService=require(_0x1ea3('0x12'));var qs=require(_0x1ea3('0x13'));var as=require(_0x1ea3('0x14'));var hardwareService=require(_0x1ea3('0x15'));var logger=require(_0x1ea3('0x16'))(_0x1ea3('0x17'));var utils=require(_0x1ea3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1ea3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe537,_0x2fc7f4){_0x2fc7f4=_0x2fc7f4||0xcc;return function(_0x4305d3){if(_0x4305d3){return _0x3fe537['sendStatus'](_0x2fc7f4);}return _0x3fe537[_0x1ea3('0x1a')](_0x2fc7f4)[_0x1ea3('0x1b')]();};}function respondWithResult(_0x2fd1c9,_0x4b0af9){_0x4b0af9=_0x4b0af9||0xc8;return function(_0x1624ee){if(_0x1624ee){return _0x2fd1c9[_0x1ea3('0x1a')](_0x4b0af9)[_0x1ea3('0x1c')](_0x1624ee);}};}function respondWithFilteredResult(_0x3d0e71,_0x319de8){return function(_0x3fe673){if(_0x3fe673){var _0x29ceac=typeof _0x319de8['offset']===_0x1ea3('0x1d')&&typeof _0x319de8[_0x1ea3('0x1e')]===_0x1ea3('0x1d');var _0x2f6e6f=_0x3fe673[_0x1ea3('0x1f')];var _0x541e18=_0x29ceac?0x0:_0x319de8[_0x1ea3('0x20')];var _0x2a8b47=_0x29ceac?_0x3fe673[_0x1ea3('0x1f')]:_0x319de8['offset']+_0x319de8[_0x1ea3('0x1e')];var _0x21364e;if(_0x2a8b47>=_0x2f6e6f){_0x2a8b47=_0x2f6e6f;_0x21364e=0xc8;}else{_0x21364e=0xce;}_0x3d0e71[_0x1ea3('0x1a')](_0x21364e);return _0x3d0e71['set'](_0x1ea3('0x21'),_0x541e18+'-'+_0x2a8b47+'/'+_0x2f6e6f)['json'](_0x3fe673);}return null;};}function patchUpdates(_0x276e4d){return function(_0x405ec0){try{jsonpatch[_0x1ea3('0x22')](_0x405ec0,_0x276e4d,!![]);}catch(_0x5bad21){return BPromise[_0x1ea3('0x23')](_0x5bad21);}return _0x405ec0['save']();};}function saveUpdates(_0x4582af,_0x498455){return function(_0x941a50){if(_0x941a50){return _0x941a50['update'](_0x4582af)[_0x1ea3('0x24')](function(_0x388019){return _0x388019;});}return null;};}function removeEntity(_0x246231,_0x5ad8ff){return function(_0x50703d){if(_0x50703d){return _0x50703d[_0x1ea3('0x25')]()['then'](function(){_0x246231[_0x1ea3('0x1a')](0xcc)[_0x1ea3('0x1b')]();});}};}function handleEntityNotFound(_0x3c42f3,_0x91abee){return function(_0xa2b868){if(!_0xa2b868){_0x3c42f3['sendStatus'](0x194);}return _0xa2b868;};}function handleError(_0x50e511,_0x30cf8d){_0x30cf8d=_0x30cf8d||0x1f4;return function(_0x2edfb4){logger[_0x1ea3('0x26')](_0x2edfb4[_0x1ea3('0x27')]);if(_0x2edfb4[_0x1ea3('0x28')]){delete _0x2edfb4[_0x1ea3('0x28')];}_0x50e511[_0x1ea3('0x1a')](_0x30cf8d)[_0x1ea3('0x29')](_0x2edfb4);};}exports[_0x1ea3('0x2a')]=function(_0x3d9b63,_0x3bc186){var _0x33f5f2={},_0x2c29d7={},_0x1a020e={'count':0x0,'rows':[]};var _0xdbd7e3=_[_0x1ea3('0x2b')](db['JscriptyAnswerReport'][_0x1ea3('0x2c')],function(_0x366312){return{'name':_0x366312[_0x1ea3('0x2d')],'type':_0x366312[_0x1ea3('0x2e')][_0x1ea3('0x2f')]};});_0x2c29d7['model']=_['map'](_0xdbd7e3,_0x1ea3('0x28'));_0x2c29d7[_0x1ea3('0x30')]=_['keys'](_0x3d9b63[_0x1ea3('0x30')]);_0x2c29d7[_0x1ea3('0x31')]=_['intersection'](_0x2c29d7['model'],_0x2c29d7[_0x1ea3('0x30')]);_0x33f5f2[_0x1ea3('0x32')]=_[_0x1ea3('0x33')](_0x2c29d7[_0x1ea3('0x34')],qs[_0x1ea3('0x35')](_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x35')]));_0x33f5f2[_0x1ea3('0x32')]=_0x33f5f2[_0x1ea3('0x32')]['length']?_0x33f5f2[_0x1ea3('0x32')]:_0x2c29d7[_0x1ea3('0x34')];if(!_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x36')](_0x1ea3('0x37'))){_0x33f5f2[_0x1ea3('0x1e')]=qs[_0x1ea3('0x1e')](_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x1e')]);_0x33f5f2[_0x1ea3('0x20')]=qs['offset'](_0x3d9b63[_0x1ea3('0x30')]['offset']);}_0x33f5f2[_0x1ea3('0x38')]=qs['sort'](_0x3d9b63['query'][_0x1ea3('0x39')]);_0x33f5f2['where']=qs['filters'](_['pick'](_0x3d9b63[_0x1ea3('0x30')],_0x2c29d7[_0x1ea3('0x31')]),_0xdbd7e3);if(_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x3a')]){_0x33f5f2[_0x1ea3('0x3b')]=_['merge'](_0x33f5f2[_0x1ea3('0x3b')],{'$or':_['map'](_0xdbd7e3,function(_0x441442){if(_0x441442[_0x1ea3('0x2e')]!=='VIRTUAL'){var _0x102757={};_0x102757[_0x441442[_0x1ea3('0x28')]]={'$like':'%'+_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x3a')]+'%'};return _0x102757;}})});}_0x33f5f2=_[_0x1ea3('0x3c')]({},_0x33f5f2,_0x3d9b63['options']);var _0x12da5a={'where':_0x33f5f2['where']};return db[_0x1ea3('0x3d')][_0x1ea3('0x1f')](_0x12da5a)[_0x1ea3('0x24')](function(_0x47028d){_0x1a020e[_0x1ea3('0x1f')]=_0x47028d;if(_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x3e')]){_0x33f5f2[_0x1ea3('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x1ea3('0x40')](_0x33f5f2);})[_0x1ea3('0x24')](function(_0x2108e8){_0x1a020e['rows']=_0x2108e8;return _0x1a020e;})[_0x1ea3('0x24')](respondWithFilteredResult(_0x3bc186,_0x33f5f2))[_0x1ea3('0x41')](handleError(_0x3bc186,null));};exports['show']=function(_0x15f00a,_0x43c48d){var _0x58ba87={'raw':!![],'where':{'id':_0x15f00a[_0x1ea3('0x42')]['id']}},_0x133f48={};_0x133f48[_0x1ea3('0x34')]=_[_0x1ea3('0x43')](db[_0x1ea3('0x3d')][_0x1ea3('0x2c')]);_0x133f48['query']=_[_0x1ea3('0x43')](_0x15f00a[_0x1ea3('0x30')]);_0x133f48[_0x1ea3('0x31')]=_['intersection'](_0x133f48[_0x1ea3('0x34')],_0x133f48[_0x1ea3('0x30')]);_0x58ba87[_0x1ea3('0x32')]=_[_0x1ea3('0x33')](_0x133f48[_0x1ea3('0x34')],qs[_0x1ea3('0x35')](_0x15f00a[_0x1ea3('0x30')][_0x1ea3('0x35')]));_0x58ba87[_0x1ea3('0x32')]=_0x58ba87[_0x1ea3('0x32')][_0x1ea3('0x44')]?_0x58ba87['attributes']:_0x133f48[_0x1ea3('0x34')];if(_0x15f00a[_0x1ea3('0x30')][_0x1ea3('0x3e')]){_0x58ba87[_0x1ea3('0x3f')]=[{'all':!![]}];}_0x58ba87=_['merge']({},_0x58ba87,_0x15f00a[_0x1ea3('0x45')]);return db[_0x1ea3('0x3d')]['find'](_0x58ba87)[_0x1ea3('0x24')](handleEntityNotFound(_0x43c48d,null))[_0x1ea3('0x24')](respondWithResult(_0x43c48d,null))[_0x1ea3('0x41')](handleError(_0x43c48d,null));};exports[_0x1ea3('0x46')]=function(_0x454156,_0x28955f){return db[_0x1ea3('0x3d')]['create'](_0x454156['body'],{})['then'](respondWithResult(_0x28955f,0xc9))[_0x1ea3('0x41')](handleError(_0x28955f,null));};exports[_0x1ea3('0x47')]=function(_0xf69557,_0x2de88d){if(_0xf69557[_0x1ea3('0x48')]['id']){delete _0xf69557['body']['id'];}return db[_0x1ea3('0x3d')]['find']({'where':{'id':_0xf69557[_0x1ea3('0x42')]['id']}})[_0x1ea3('0x24')](handleEntityNotFound(_0x2de88d,null))['then'](saveUpdates(_0xf69557['body'],null))[_0x1ea3('0x24')](respondWithResult(_0x2de88d,null))[_0x1ea3('0x41')](handleError(_0x2de88d,null));};exports[_0x1ea3('0x25')]=function(_0x43f296,_0x4822b2){return db[_0x1ea3('0x3d')][_0x1ea3('0x49')]({'where':{'id':_0x43f296['params']['id']}})['then'](handleEntityNotFound(_0x4822b2,null))[_0x1ea3('0x24')](removeEntity(_0x4822b2,null))['catch'](handleError(_0x4822b2,null));};exports[_0x1ea3('0x4a')]=function(_0xee8f20,_0x409f8f){return db[_0x1ea3('0x3d')][_0x1ea3('0x4a')]()[_0x1ea3('0x24')](respondWithResult(_0x409f8f,null))[_0x1ea3('0x41')](handleError(_0x409f8f,null));}; \ No newline at end of file +var _0xce22=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','keys','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x16daee,_0xaf8850){var _0x436115=function(_0x2ba0d9){while(--_0x2ba0d9){_0x16daee['push'](_0x16daee['shift']());}};_0x436115(++_0xaf8850);}(_0xce22,0xea));var _0x2ce2=function(_0x3fdd11,_0x324f3b){_0x3fdd11=_0x3fdd11-0x0;var _0x4bd90a=_0xce22[_0x3fdd11];return _0x4bd90a;};'use strict';var emlformat=require(_0x2ce2('0x0'));var rimraf=require(_0x2ce2('0x1'));var zipdir=require(_0x2ce2('0x2'));var jsonpatch=require(_0x2ce2('0x3'));var rp=require(_0x2ce2('0x4'));var moment=require('moment');var BPromise=require(_0x2ce2('0x5'));var Mustache=require('mustache');var util=require(_0x2ce2('0x6'));var path=require(_0x2ce2('0x7'));var sox=require(_0x2ce2('0x8'));var csv=require(_0x2ce2('0x9'));var ejs=require(_0x2ce2('0xa'));var fs=require('fs');var fs_extra=require(_0x2ce2('0xb'));var _=require(_0x2ce2('0xc'));var squel=require('squel');var crypto=require(_0x2ce2('0xd'));var jsforce=require(_0x2ce2('0xe'));var deskjs=require(_0x2ce2('0xf'));var toCsv=require(_0x2ce2('0x9'));var querystring=require(_0x2ce2('0x10'));var Papa=require(_0x2ce2('0x11'));var Redis=require('ioredis');var authService=require(_0x2ce2('0x12'));var qs=require(_0x2ce2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ce2('0x14'));var logger=require(_0x2ce2('0x15'))('api');var utils=require(_0x2ce2('0x16'));var config=require(_0x2ce2('0x17'));var licenseUtil=require(_0x2ce2('0x18'));var db=require(_0x2ce2('0x19'))['db'];function respondWithStatusCode(_0x4b2407,_0x1b4a4f){_0x1b4a4f=_0x1b4a4f||0xcc;return function(_0x112244){if(_0x112244){return _0x4b2407[_0x2ce2('0x1a')](_0x1b4a4f);}return _0x4b2407['status'](_0x1b4a4f)[_0x2ce2('0x1b')]();};}function respondWithResult(_0x4d3490,_0x4874a5){_0x4874a5=_0x4874a5||0xc8;return function(_0x7b8036){if(_0x7b8036){return _0x4d3490[_0x2ce2('0x1c')](_0x4874a5)[_0x2ce2('0x1d')](_0x7b8036);}};}function respondWithFilteredResult(_0x17120f,_0x1ac6e9){return function(_0x18dd99){if(_0x18dd99){var _0x313e91=typeof _0x1ac6e9['offset']==='undefined'&&typeof _0x1ac6e9['limit']===_0x2ce2('0x1e');var _0xa229b7=_0x18dd99[_0x2ce2('0x1f')];var _0x3443e6=_0x313e91?0x0:_0x1ac6e9[_0x2ce2('0x20')];var _0x560a77=_0x313e91?_0x18dd99[_0x2ce2('0x1f')]:_0x1ac6e9['offset']+_0x1ac6e9[_0x2ce2('0x21')];var _0x42f597;if(_0x560a77>=_0xa229b7){_0x560a77=_0xa229b7;_0x42f597=0xc8;}else{_0x42f597=0xce;}_0x17120f[_0x2ce2('0x1c')](_0x42f597);return _0x17120f[_0x2ce2('0x22')](_0x2ce2('0x23'),_0x3443e6+'-'+_0x560a77+'/'+_0xa229b7)[_0x2ce2('0x1d')](_0x18dd99);}return null;};}function patchUpdates(_0x578cb5){return function(_0x4d3a37){try{jsonpatch[_0x2ce2('0x24')](_0x4d3a37,_0x578cb5,!![]);}catch(_0x3d07ec){return BPromise[_0x2ce2('0x25')](_0x3d07ec);}return _0x4d3a37[_0x2ce2('0x26')]();};}function saveUpdates(_0x4838fe,_0x5b2b79){return function(_0x5b0eb3){if(_0x5b0eb3){return _0x5b0eb3[_0x2ce2('0x27')](_0x4838fe)[_0x2ce2('0x28')](function(_0x4ae9b9){return _0x4ae9b9;});}return null;};}function removeEntity(_0x17a57a,_0x43a7b6){return function(_0x51249f){if(_0x51249f){return _0x51249f[_0x2ce2('0x29')]()[_0x2ce2('0x28')](function(){_0x17a57a[_0x2ce2('0x1c')](0xcc)[_0x2ce2('0x1b')]();});}};}function handleEntityNotFound(_0x5c748f,_0x528fec){return function(_0x10748a){if(!_0x10748a){_0x5c748f['sendStatus'](0x194);}return _0x10748a;};}function handleError(_0x3ee4f8,_0x2e3296){_0x2e3296=_0x2e3296||0x1f4;return function(_0x3a701e){logger[_0x2ce2('0x2a')](_0x3a701e[_0x2ce2('0x2b')]);if(_0x3a701e['name']){delete _0x3a701e['name'];}_0x3ee4f8[_0x2ce2('0x1c')](_0x2e3296)['send'](_0x3a701e);};}exports[_0x2ce2('0x2c')]=function(_0x44f622,_0x15a245){var _0x137d06={},_0x1e1f17={},_0x2aa881={'count':0x0,'rows':[]};var _0x4b201e=_[_0x2ce2('0x2d')](db[_0x2ce2('0x2e')][_0x2ce2('0x2f')],function(_0x383315){return{'name':_0x383315[_0x2ce2('0x30')],'type':_0x383315[_0x2ce2('0x31')][_0x2ce2('0x32')]};});_0x1e1f17[_0x2ce2('0x33')]=_['map'](_0x4b201e,_0x2ce2('0x34'));_0x1e1f17['query']=_['keys'](_0x44f622[_0x2ce2('0x35')]);_0x1e1f17[_0x2ce2('0x36')]=_['intersection'](_0x1e1f17[_0x2ce2('0x33')],_0x1e1f17[_0x2ce2('0x35')]);_0x137d06[_0x2ce2('0x37')]=_[_0x2ce2('0x38')](_0x1e1f17[_0x2ce2('0x33')],qs[_0x2ce2('0x39')](_0x44f622['query'][_0x2ce2('0x39')]));_0x137d06[_0x2ce2('0x37')]=_0x137d06[_0x2ce2('0x37')][_0x2ce2('0x3a')]?_0x137d06['attributes']:_0x1e1f17[_0x2ce2('0x33')];if(!_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x3b')](_0x2ce2('0x3c'))){_0x137d06[_0x2ce2('0x21')]=qs[_0x2ce2('0x21')](_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x21')]);_0x137d06[_0x2ce2('0x20')]=qs[_0x2ce2('0x20')](_0x44f622[_0x2ce2('0x35')]['offset']);}_0x137d06[_0x2ce2('0x3d')]=qs[_0x2ce2('0x3e')](_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x3e')]);_0x137d06[_0x2ce2('0x3f')]=qs[_0x2ce2('0x36')](_[_0x2ce2('0x40')](_0x44f622[_0x2ce2('0x35')],_0x1e1f17[_0x2ce2('0x36')]),_0x4b201e);if(_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x41')]){_0x137d06[_0x2ce2('0x3f')]=_['merge'](_0x137d06[_0x2ce2('0x3f')],{'$or':_[_0x2ce2('0x2d')](_0x4b201e,function(_0x5e0ee9){if(_0x5e0ee9[_0x2ce2('0x31')]!==_0x2ce2('0x42')){var _0x3b5f23={};_0x3b5f23[_0x5e0ee9[_0x2ce2('0x34')]]={'$like':'%'+_0x44f622[_0x2ce2('0x35')]['filter']+'%'};return _0x3b5f23;}})});}_0x137d06=_[_0x2ce2('0x43')]({},_0x137d06,_0x44f622[_0x2ce2('0x44')]);var _0x3f71d2={'where':_0x137d06['where']};return db[_0x2ce2('0x2e')][_0x2ce2('0x1f')](_0x3f71d2)[_0x2ce2('0x28')](function(_0x1f11cc){_0x2aa881[_0x2ce2('0x1f')]=_0x1f11cc;if(_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x45')]){_0x137d06['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2ce2('0x46')](_0x137d06);})[_0x2ce2('0x28')](function(_0x3a7d2b){_0x2aa881[_0x2ce2('0x47')]=_0x3a7d2b;return _0x2aa881;})[_0x2ce2('0x28')](respondWithFilteredResult(_0x15a245,_0x137d06))[_0x2ce2('0x48')](handleError(_0x15a245,null));};exports['show']=function(_0x611fe8,_0x2231d6){var _0x215a13={'raw':!![],'where':{'id':_0x611fe8['params']['id']}},_0x63000e={};_0x63000e['model']=_[_0x2ce2('0x49')](db[_0x2ce2('0x2e')][_0x2ce2('0x2f')]);_0x63000e['query']=_[_0x2ce2('0x49')](_0x611fe8[_0x2ce2('0x35')]);_0x63000e[_0x2ce2('0x36')]=_[_0x2ce2('0x38')](_0x63000e[_0x2ce2('0x33')],_0x63000e['query']);_0x215a13['attributes']=_[_0x2ce2('0x38')](_0x63000e[_0x2ce2('0x33')],qs[_0x2ce2('0x39')](_0x611fe8[_0x2ce2('0x35')][_0x2ce2('0x39')]));_0x215a13[_0x2ce2('0x37')]=_0x215a13['attributes']['length']?_0x215a13[_0x2ce2('0x37')]:_0x63000e[_0x2ce2('0x33')];if(_0x611fe8[_0x2ce2('0x35')][_0x2ce2('0x45')]){_0x215a13[_0x2ce2('0x4a')]=[{'all':!![]}];}_0x215a13=_[_0x2ce2('0x43')]({},_0x215a13,_0x611fe8['options']);return db[_0x2ce2('0x2e')][_0x2ce2('0x4b')](_0x215a13)['then'](handleEntityNotFound(_0x2231d6,null))[_0x2ce2('0x28')](respondWithResult(_0x2231d6,null))[_0x2ce2('0x48')](handleError(_0x2231d6,null));};exports[_0x2ce2('0x4c')]=function(_0x59f06b,_0x3b8458){return db[_0x2ce2('0x2e')][_0x2ce2('0x4c')](_0x59f06b['body'],{})['then'](respondWithResult(_0x3b8458,0xc9))[_0x2ce2('0x48')](handleError(_0x3b8458,null));};exports[_0x2ce2('0x27')]=function(_0x3cfeff,_0x3b50cc){if(_0x3cfeff[_0x2ce2('0x4d')]['id']){delete _0x3cfeff['body']['id'];}return db[_0x2ce2('0x2e')][_0x2ce2('0x4b')]({'where':{'id':_0x3cfeff[_0x2ce2('0x4e')]['id']}})[_0x2ce2('0x28')](handleEntityNotFound(_0x3b50cc,null))[_0x2ce2('0x28')](saveUpdates(_0x3cfeff[_0x2ce2('0x4d')],null))['then'](respondWithResult(_0x3b50cc,null))['catch'](handleError(_0x3b50cc,null));};exports[_0x2ce2('0x29')]=function(_0x1e4463,_0x381516){return db[_0x2ce2('0x2e')][_0x2ce2('0x4b')]({'where':{'id':_0x1e4463[_0x2ce2('0x4e')]['id']}})[_0x2ce2('0x28')](handleEntityNotFound(_0x381516,null))['then'](removeEntity(_0x381516,null))['catch'](handleError(_0x381516,null));};exports['describe']=function(_0x8f2768,_0x3a68ea){return db[_0x2ce2('0x2e')][_0x2ce2('0x4f')]()[_0x2ce2('0x28')](respondWithResult(_0x3a68ea,null))[_0x2ce2('0x48')](handleError(_0x3a68ea,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a5612d7..b0b71e0 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 _0x98ff=['request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','util','../../config/logger','api','moment'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x98ff,0x125));var _0xf98f=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x98ff[_0x2f3848];return _0x102668;};'use strict';var _=require('lodash');var util=require(_0xf98f('0x0'));var logger=require(_0xf98f('0x1'))(_0xf98f('0x2'));var moment=require(_0xf98f('0x3'));var BPromise=require('bluebird');var rp=require(_0xf98f('0x4'));var fs=require('fs');var path=require(_0xf98f('0x5'));var rimraf=require(_0xf98f('0x6'));var config=require(_0xf98f('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xf98f('0x8')]=function(_0x29a342,_0xcc5931){return _0x29a342[_0xf98f('0x9')](_0xf98f('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x970a=['rimraf','../../config/environment','exports','define','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x5a184b,_0x457876){var _0x713964=function(_0x1f6d49){while(--_0x1f6d49){_0x5a184b['push'](_0x5a184b['shift']());}};_0x713964(++_0x457876);}(_0x970a,0xeb));var _0xa970=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x970a[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0xa970('0x0'));var util=require(_0xa970('0x1'));var logger=require('../../config/logger')(_0xa970('0x2'));var moment=require(_0xa970('0x3'));var BPromise=require(_0xa970('0x4'));var rp=require(_0xa970('0x5'));var fs=require('fs');var path=require(_0xa970('0x6'));var rimraf=require(_0xa970('0x7'));var config=require(_0xa970('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xa970('0x9')]=function(_0x21310f,_0x3144ae){return _0x21310f[_0xa970('0xa')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index b3a7ffd..8918b8d 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 _0x307b=['error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','stringify'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x307b,0x131));var _0xb307=function(_0x436161,_0x3fea1f){_0x436161=_0x436161-0x0;var _0x18d4aa=_0x307b[_0x436161];return _0x18d4aa;};'use strict';var _=require(_0xb307('0x0'));var util=require(_0xb307('0x1'));var moment=require(_0xb307('0x2'));var BPromise=require(_0xb307('0x3'));var rs=require(_0xb307('0x4'));var fs=require('fs');var Redis=require(_0xb307('0x5'));var db=require(_0xb307('0x6'))['db'];var utils=require(_0xb307('0x7'));var logger=require(_0xb307('0x8'))(_0xb307('0x9'));var config=require(_0xb307('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb307('0xb')][_0xb307('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x329e6a,_0x11e41e,_0x535b2e){return new BPromise(function(_0x24254c,_0x27b57e){return client['request'](_0x329e6a,_0x535b2e)[_0xb307('0xd')](function(_0x3df9fd){logger[_0xb307('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x11e41e,_0xb307('0xf'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x11e41e,_0xb307('0xf'),JSON[_0xb307('0x10')](_0x3df9fd));if(_0x3df9fd[_0xb307('0x11')]){if(_0x3df9fd[_0xb307('0x11')][_0xb307('0x12')]===0x1f4){logger[_0xb307('0x11')](_0xb307('0x13'),_0x11e41e,_0x3df9fd[_0xb307('0x11')][_0xb307('0x14')]);return _0x27b57e(_0x3df9fd[_0xb307('0x11')][_0xb307('0x14')]);}logger[_0xb307('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x11e41e,_0x3df9fd[_0xb307('0x11')][_0xb307('0x14')]);return _0x24254c(_0x3df9fd['error'][_0xb307('0x14')]);}else{logger['info'](_0xb307('0x13'),_0x11e41e,_0xb307('0xf'));_0x24254c(_0x3df9fd[_0xb307('0x15')]['message']);}})[_0xb307('0x16')](function(_0x34e9ce){logger['error'](_0xb307('0x13'),_0x11e41e,_0x34e9ce);_0x27b57e(_0x34e9ce);});});} \ No newline at end of file +var _0xf846=['jayson/promise','client','http','request','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c8b46,_0x34e053){var _0x4bf0a8=function(_0x4fd53f){while(--_0x4fd53f){_0x3c8b46['push'](_0x3c8b46['shift']());}};_0x4bf0a8(++_0x34e053);}(_0xf846,0xd3));var _0x6f84=function(_0x49fa02,_0x290a6a){_0x49fa02=_0x49fa02-0x0;var _0x16e923=_0xf846[_0x49fa02];return _0x16e923;};'use strict';var _=require(_0x6f84('0x0'));var util=require(_0x6f84('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f84('0x2'));var fs=require('fs');var Redis=require(_0x6f84('0x3'));var db=require(_0x6f84('0x4'))['db'];var utils=require(_0x6f84('0x5'));var logger=require(_0x6f84('0x6'))(_0x6f84('0x7'));var config=require(_0x6f84('0x8'));var jayson=require(_0x6f84('0x9'));var client=jayson[_0x6f84('0xa')][_0x6f84('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6ba81a,_0x1358ee,_0x9f67c7){return new BPromise(function(_0x5c625d,_0x128a10){return client[_0x6f84('0xc')](_0x6ba81a,_0x9f67c7)[_0x6f84('0xd')](function(_0x29aa41){logger[_0x6f84('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1358ee,_0x6f84('0xf'));logger['debug'](_0x6f84('0x10'),_0x1358ee,_0x6f84('0xf'),JSON['stringify'](_0x29aa41));if(_0x29aa41[_0x6f84('0x11')]){if(_0x29aa41[_0x6f84('0x11')]['code']===0x1f4){logger[_0x6f84('0x11')](_0x6f84('0x12'),_0x1358ee,_0x29aa41[_0x6f84('0x11')][_0x6f84('0x13')]);return _0x128a10(_0x29aa41[_0x6f84('0x11')][_0x6f84('0x13')]);}logger['error'](_0x6f84('0x12'),_0x1358ee,_0x29aa41['error'][_0x6f84('0x13')]);return _0x5c625d(_0x29aa41[_0x6f84('0x11')][_0x6f84('0x13')]);}else{logger['info'](_0x6f84('0x12'),_0x1358ee,_0x6f84('0xf'));_0x5c625d(_0x29aa41[_0x6f84('0x14')][_0x6f84('0x13')]);}})[_0x6f84('0x15')](function(_0x871cc7){logger[_0x6f84('0x11')](_0x6f84('0x12'),_0x1358ee,_0x871cc7);_0x128a10(_0x871cc7);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 18030e5..f003203 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 _0xb23e=['get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','30s','getSummary','post','/:id/clone','clone','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xb23e,0xce));var _0xeb23=function(_0x35a71a,_0x5af48f){_0x35a71a=_0x35a71a-0x0;var _0x4c3815=_0xb23e[_0x35a71a];return _0x4c3815;};'use strict';var multer=require(_0xeb23('0x0'));var util=require(_0xeb23('0x1'));var path=require(_0xeb23('0x2'));var timeout=require(_0xeb23('0x3'));var express=require(_0xeb23('0x4'));var router=express[_0xeb23('0x5')]();var fs_extra=require(_0xeb23('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xeb23('0x7'));var config=require(_0xeb23('0x8'));var controller=require(_0xeb23('0x9'));router[_0xeb23('0xa')]('/',auth[_0xeb23('0xb')](),controller[_0xeb23('0xc')]);router[_0xeb23('0xa')](_0xeb23('0xd'),auth[_0xeb23('0xb')](),controller[_0xeb23('0xe')]);router[_0xeb23('0xa')](_0xeb23('0xf'),auth['isAuthenticated'](),controller[_0xeb23('0x10')]);router[_0xeb23('0xa')]('/:id/answers',auth[_0xeb23('0xb')](),controller[_0xeb23('0x11')]);router[_0xeb23('0xa')]('/:id/summary',auth['isAuthenticated'](),timeout(_0xeb23('0x12')),controller[_0xeb23('0x13')]);router[_0xeb23('0x14')]('/',auth[_0xeb23('0xb')](),controller['create']);router[_0xeb23('0x14')](_0xeb23('0x15'),auth['isAuthenticated'](),controller[_0xeb23('0x16')]);router[_0xeb23('0x17')](_0xeb23('0xd'),auth[_0xeb23('0xb')](),controller[_0xeb23('0x18')]);router['delete']('/:id',auth[_0xeb23('0xb')](),controller[_0xeb23('0x19')]);module[_0xeb23('0x1a')]=router; \ No newline at end of file +var _0x458e=['isAuthenticated','index','show','/:id/answers','/:id/summary','30s','getSummary','post','create','/:id/clone','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x8d5f87,_0x4a0d78){var _0x241ab8=function(_0x162d0c){while(--_0x162d0c){_0x8d5f87['push'](_0x8d5f87['shift']());}};_0x241ab8(++_0x4a0d78);}(_0x458e,0x15f));var _0xe458=function(_0x1dbf09,_0x2f9d68){_0x1dbf09=_0x1dbf09-0x0;var _0x2e581a=_0x458e[_0x1dbf09];return _0x2e581a;};'use strict';var multer=require(_0xe458('0x0'));var util=require('util');var path=require(_0xe458('0x1'));var timeout=require('connect-timeout');var express=require(_0xe458('0x2'));var router=express['Router']();var fs_extra=require(_0xe458('0x3'));var auth=require(_0xe458('0x4'));var interaction=require(_0xe458('0x5'));var config=require(_0xe458('0x6'));var controller=require(_0xe458('0x7'));router[_0xe458('0x8')]('/',auth[_0xe458('0x9')](),controller[_0xe458('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe458('0xb')]);router[_0xe458('0x8')]('/:id/sessions',auth['isAuthenticated'](),controller['getSessions']);router[_0xe458('0x8')](_0xe458('0xc'),auth[_0xe458('0x9')](),controller['getAnswers']);router['get'](_0xe458('0xd'),auth[_0xe458('0x9')](),timeout(_0xe458('0xe')),controller[_0xe458('0xf')]);router[_0xe458('0x10')]('/',auth['isAuthenticated'](),controller[_0xe458('0x11')]);router[_0xe458('0x10')](_0xe458('0x12'),auth[_0xe458('0x9')](),controller['clone']);router['put'](_0xe458('0x13'),auth[_0xe458('0x9')](),controller[_0xe458('0x14')]);router[_0xe458('0x15')](_0xe458('0x13'),auth[_0xe458('0x9')](),controller[_0xe458('0x16')]);module[_0xe458('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fc0021f..c18baf5 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 _0x926b=['isString','description','BOOLEAN','sequelize','lodash','util','exports','name','TEXT','long','isObjectLike','setDataValue','formData','stringify'];(function(_0x2c4200,_0x5ac2f6){var _0x51b3dc=function(_0x14f151){while(--_0x14f151){_0x2c4200['push'](_0x2c4200['shift']());}};_0x51b3dc(++_0x5ac2f6);}(_0x926b,0xb9));var _0xb926=function(_0x2e0901,_0x18eb5e){_0x2e0901=_0x2e0901-0x0;var _0x4fa318=_0x926b[_0x2e0901];return _0x4fa318;};'use strict';var Sequelize=require(_0xb926('0x0'));var _=require(_0xb926('0x1'));var util=require(_0xb926('0x2'));module[_0xb926('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0xb926('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xb926('0x5')](_0xb926('0x6')),'set':function(_0x4c90a9){if(_[_0xb926('0x7')](_0x4c90a9)){this[_0xb926('0x8')](_0xb926('0x9'),JSON[_0xb926('0xa')](_0x4c90a9));}else if(_[_0xb926('0xb')](_0x4c90a9)){this['setDataValue'](_0xb926('0x9'),_0x4c90a9);}else{this[_0xb926('0x8')]('formData',util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xb926('0x4'))||'',this['getDataValue'](_0xb926('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb926('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb926('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xcce5=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description','BOOLEAN','sequelize','lodash','exports','STRING','name','isObjectLike','setDataValue','formData','format'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xcce5,0x18f));var _0x5cce=function(_0xba731e,_0x27b5af){_0xba731e=_0xba731e-0x0;var _0xcc039e=_0xcce5[_0xba731e];return _0xcc039e;};'use strict';var Sequelize=require(_0x5cce('0x0'));var _=require(_0x5cce('0x1'));var util=require('util');module[_0x5cce('0x2')]={'name':{'type':Sequelize[_0x5cce('0x3')],'unique':_0x5cce('0x4')},'description':{'type':Sequelize[_0x5cce('0x3')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x86727a){if(_[_0x5cce('0x5')](_0x86727a)){this[_0x5cce('0x6')](_0x5cce('0x7'),JSON['stringify'](_0x86727a));}else if(_['isString'](_0x86727a)){this[_0x5cce('0x6')]('formData',_0x86727a);}else{this['setDataValue'](_0x5cce('0x7'),util[_0x5cce('0x8')](_0x5cce('0x9'),this['getDataValue'](_0x5cce('0x4'))||'',this['getDataValue'](_0x5cce('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5cce('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5cce('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 4efc140..1991e7b 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 _0x8b29=['mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','JscriptyProject','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','map','filter','includeAll','include','rows','catch','params','keys','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','getSessions','JscriptySessionReport','nolimit','ProjectId','JscriptyAnswerReport','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','fast-json-patch','request-promise','moment'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x8b29,0x14f));var _0x98b2=function(_0x2a2ec5,_0x300d47){_0x2a2ec5=_0x2a2ec5-0x0;var _0x3a5fe0=_0x8b29[_0x2a2ec5];return _0x3a5fe0;};'use strict';var emlformat=require(_0x98b2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x98b2('0x1'));var rp=require(_0x98b2('0x2'));var moment=require(_0x98b2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x98b2('0x4'));var util=require(_0x98b2('0x5'));var path=require(_0x98b2('0x6'));var sox=require('sox');var csv=require(_0x98b2('0x7'));var ejs=require(_0x98b2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98b2('0x9'));var squel=require(_0x98b2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x98b2('0xb'));var toCsv=require('to-csv');var querystring=require(_0x98b2('0xc'));var Papa=require(_0x98b2('0xd'));var Redis=require(_0x98b2('0xe'));var authService=require(_0x98b2('0xf'));var qs=require(_0x98b2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98b2('0x11'));var logger=require(_0x98b2('0x12'))('api');var utils=require(_0x98b2('0x13'));var config=require(_0x98b2('0x14'));var licenseUtil=require(_0x98b2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x109813,_0x331a25){_0x331a25=_0x331a25||0xcc;return function(_0x269346){if(_0x269346){return _0x109813[_0x98b2('0x16')](_0x331a25);}return _0x109813[_0x98b2('0x17')](_0x331a25)[_0x98b2('0x18')]();};}function respondWithResult(_0x2e767c,_0x91cecf){_0x91cecf=_0x91cecf||0xc8;return function(_0x2ff451){if(_0x2ff451){return _0x2e767c[_0x98b2('0x17')](_0x91cecf)[_0x98b2('0x19')](_0x2ff451);}};}function respondWithFilteredResult(_0x1d6e48,_0x4c874d){return function(_0x36424b){if(_0x36424b){var _0x2bc44f=typeof _0x4c874d[_0x98b2('0x1a')]==='undefined'&&typeof _0x4c874d['limit']===_0x98b2('0x1b');var _0x3352a0=_0x36424b[_0x98b2('0x1c')];var _0x41687b=_0x2bc44f?0x0:_0x4c874d[_0x98b2('0x1a')];var _0xf0e59d=_0x2bc44f?_0x36424b[_0x98b2('0x1c')]:_0x4c874d[_0x98b2('0x1a')]+_0x4c874d[_0x98b2('0x1d')];var _0x43a75f;if(_0xf0e59d>=_0x3352a0){_0xf0e59d=_0x3352a0;_0x43a75f=0xc8;}else{_0x43a75f=0xce;}_0x1d6e48[_0x98b2('0x17')](_0x43a75f);return _0x1d6e48[_0x98b2('0x1e')]('Content-Range',_0x41687b+'-'+_0xf0e59d+'/'+_0x3352a0)[_0x98b2('0x19')](_0x36424b);}return null;};}function patchUpdates(_0x459220){return function(_0x2d9a55){try{jsonpatch[_0x98b2('0x1f')](_0x2d9a55,_0x459220,!![]);}catch(_0x55853b){return BPromise['reject'](_0x55853b);}return _0x2d9a55['save']();};}function saveUpdates(_0xd7894a,_0x5c206e){return function(_0x34824b){if(_0x34824b){return _0x34824b[_0x98b2('0x20')](_0xd7894a)[_0x98b2('0x21')](function(_0x367e4b){return _0x367e4b;});}return null;};}function removeEntity(_0x50da70,_0x5dc4d3){return function(_0x56ff76){if(_0x56ff76){return _0x56ff76[_0x98b2('0x22')]()[_0x98b2('0x21')](function(){var _0xb51160=_0x56ff76[_0x98b2('0x23')]({'plain':!![]});var _0x2c7cea=_0x98b2('0x24');return db[_0x98b2('0x25')][_0x98b2('0x22')]({'where':{'type':_0x2c7cea,'resourceId':_0xb51160['id']}})[_0x98b2('0x21')](function(){return _0x56ff76;});})[_0x98b2('0x21')](function(){_0x50da70['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d0642,_0x1c9f1d){return function(_0x36fe29){if(!_0x36fe29){_0x7d0642[_0x98b2('0x16')](0x194);}return _0x36fe29;};}function handleError(_0x674e80,_0x5ae9c5){_0x5ae9c5=_0x5ae9c5||0x1f4;return function(_0x48f386){logger[_0x98b2('0x26')](_0x48f386[_0x98b2('0x27')]);if(_0x48f386[_0x98b2('0x28')]){delete _0x48f386[_0x98b2('0x28')];}_0x674e80[_0x98b2('0x17')](_0x5ae9c5)['send'](_0x48f386);};}exports[_0x98b2('0x29')]=function(_0x1d6390,_0x64a4e9){var _0x49da6f={},_0x3c7cd7={},_0x14ffcd={'count':0x0,'rows':[]};var _0x4c2575=_['map'](db[_0x98b2('0x2a')][_0x98b2('0x2b')],function(_0xd4d970){return{'name':_0xd4d970[_0x98b2('0x2c')],'type':_0xd4d970['type'][_0x98b2('0x2d')]};});_0x3c7cd7[_0x98b2('0x2e')]=_['map'](_0x4c2575,'name');_0x3c7cd7[_0x98b2('0x2f')]=_['keys'](_0x1d6390['query']);_0x3c7cd7['filters']=_['intersection'](_0x3c7cd7[_0x98b2('0x2e')],_0x3c7cd7['query']);_0x49da6f[_0x98b2('0x30')]=_[_0x98b2('0x31')](_0x3c7cd7[_0x98b2('0x2e')],qs[_0x98b2('0x32')](_0x1d6390['query'][_0x98b2('0x32')]));_0x49da6f[_0x98b2('0x30')]=_0x49da6f[_0x98b2('0x30')][_0x98b2('0x33')]?_0x49da6f[_0x98b2('0x30')]:_0x3c7cd7[_0x98b2('0x2e')];if(!_0x1d6390[_0x98b2('0x2f')][_0x98b2('0x34')]('nolimit')){_0x49da6f[_0x98b2('0x1d')]=qs[_0x98b2('0x1d')](_0x1d6390['query'][_0x98b2('0x1d')]);_0x49da6f['offset']=qs[_0x98b2('0x1a')](_0x1d6390[_0x98b2('0x2f')][_0x98b2('0x1a')]);}_0x49da6f[_0x98b2('0x35')]=qs['sort'](_0x1d6390[_0x98b2('0x2f')][_0x98b2('0x36')]);_0x49da6f[_0x98b2('0x37')]=qs['filters'](_[_0x98b2('0x38')](_0x1d6390[_0x98b2('0x2f')],_0x3c7cd7[_0x98b2('0x39')]),_0x4c2575);if(_0x1d6390[_0x98b2('0x2f')]['filter']){_0x49da6f[_0x98b2('0x37')]=_[_0x98b2('0x3a')](_0x49da6f[_0x98b2('0x37')],{'$or':_[_0x98b2('0x3b')](_0x4c2575,function(_0x5af300){if(_0x5af300['type']!=='VIRTUAL'){var _0xd132ba={};_0xd132ba[_0x5af300['name']]={'$like':'%'+_0x1d6390[_0x98b2('0x2f')][_0x98b2('0x3c')]+'%'};return _0xd132ba;}})});}_0x49da6f=_['merge']({},_0x49da6f,_0x1d6390['options']);var _0x4196ef={'where':_0x49da6f[_0x98b2('0x37')]};return db[_0x98b2('0x2a')]['count'](_0x4196ef)['then'](function(_0xc04eae){_0x14ffcd['count']=_0xc04eae;if(_0x1d6390[_0x98b2('0x2f')][_0x98b2('0x3d')]){_0x49da6f[_0x98b2('0x3e')]=[{'all':!![]}];}return db[_0x98b2('0x2a')]['findAll'](_0x49da6f);})['then'](function(_0x1a12a7){_0x14ffcd[_0x98b2('0x3f')]=_0x1a12a7;return _0x14ffcd;})[_0x98b2('0x21')](respondWithFilteredResult(_0x64a4e9,_0x49da6f))[_0x98b2('0x40')](handleError(_0x64a4e9,null));};exports['show']=function(_0x28aee8,_0x5f1816){var _0x4aa38e={'raw':![],'where':{'id':_0x28aee8[_0x98b2('0x41')]['id']}},_0x5da7be={};_0x5da7be[_0x98b2('0x2e')]=_['keys'](db['JscriptyProject'][_0x98b2('0x2b')]);_0x5da7be[_0x98b2('0x2f')]=_[_0x98b2('0x42')](_0x28aee8[_0x98b2('0x2f')]);_0x5da7be['filters']=_['intersection'](_0x5da7be[_0x98b2('0x2e')],_0x5da7be[_0x98b2('0x2f')]);_0x4aa38e[_0x98b2('0x30')]=_[_0x98b2('0x31')](_0x5da7be[_0x98b2('0x2e')],qs[_0x98b2('0x32')](_0x28aee8[_0x98b2('0x2f')][_0x98b2('0x32')]));_0x4aa38e['attributes']=_0x4aa38e[_0x98b2('0x30')][_0x98b2('0x33')]?_0x4aa38e[_0x98b2('0x30')]:_0x5da7be[_0x98b2('0x2e')];if(_0x28aee8[_0x98b2('0x2f')][_0x98b2('0x3d')]){_0x4aa38e[_0x98b2('0x3e')]=[{'all':!![]}];}_0x4aa38e=_['merge']({},_0x4aa38e,_0x28aee8['options']);return db[_0x98b2('0x2a')][_0x98b2('0x43')](_0x4aa38e)[_0x98b2('0x21')](handleEntityNotFound(_0x5f1816,null))[_0x98b2('0x21')](respondWithResult(_0x5f1816,null))[_0x98b2('0x40')](handleError(_0x5f1816,null));};exports[_0x98b2('0x44')]=function(_0x47d886,_0x25b284){return db['JscriptyProject']['create'](_0x47d886[_0x98b2('0x45')],{})[_0x98b2('0x21')](function(_0x1e954d){var _0x22f37d=_0x47d886[_0x98b2('0x46')][_0x98b2('0x23')]({'plain':!![]});if(!_0x22f37d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22f37d['role']===_0x98b2('0x46')){var _0x36dcd0=_0x1e954d[_0x98b2('0x23')]({'plain':!![]});var _0x159bcb='Projects';return db[_0x98b2('0x47')][_0x98b2('0x43')]({'where':{'name':_0x159bcb,'userProfileId':_0x22f37d['userProfileId']},'raw':!![]})[_0x98b2('0x21')](function(_0x23ef65){if(_0x23ef65&&_0x23ef65[_0x98b2('0x48')]===0x0){return db[_0x98b2('0x25')][_0x98b2('0x44')]({'name':_0x36dcd0[_0x98b2('0x28')],'resourceId':_0x36dcd0['id'],'type':_0x23ef65[_0x98b2('0x28')],'sectionId':_0x23ef65['id']},{})[_0x98b2('0x21')](function(){return _0x1e954d;});}else{return _0x1e954d;}})[_0x98b2('0x40')](function(_0xc6e965){logger[_0x98b2('0x26')](_0x98b2('0x49'),_0xc6e965);throw _0xc6e965;});}return _0x1e954d;})['then'](respondWithResult(_0x25b284,0xc9))[_0x98b2('0x40')](handleError(_0x25b284,null));};exports[_0x98b2('0x4a')]=function(_0x4610c5,_0xa68575){var _0x3cb958={'where':{'id':_0x4610c5['params']['id']}},_0x8daaea={};_0x8daaea['model']=_[_0x98b2('0x42')](db[_0x98b2('0x2a')]['rawAttributes']);_0x3cb958[_0x98b2('0x30')]=_['intersection'](_0x8daaea[_0x98b2('0x2e')],qs[_0x98b2('0x32')](_0x4610c5[_0x98b2('0x2f')][_0x98b2('0x32')]));_0x3cb958[_0x98b2('0x30')]=_0x3cb958[_0x98b2('0x30')][_0x98b2('0x33')]?_0x3cb958[_0x98b2('0x30')]:_0x8daaea[_0x98b2('0x2e')];if(_0x4610c5[_0x98b2('0x2f')]['includeAll']){_0x3cb958[_0x98b2('0x3e')]=[{'all':!![]}];}_0x3cb958=_[_0x98b2('0x3a')]({},_0x3cb958,_0x4610c5[_0x98b2('0x4b')]);return db['JscriptyProject'][_0x98b2('0x43')](_0x3cb958)[_0x98b2('0x21')](handleEntityNotFound(_0xa68575,null))[_0x98b2('0x21')](function(_0x286c22){if(_0x286c22){var _0x7180eb=_0x286c22[_0x98b2('0x23')]({'plain':!![]});_0x7180eb=qs[_0x98b2('0x4c')](_0x7180eb,['id','createdAt',_0x98b2('0x4d')]);_0x4610c5['body']=_[_0x98b2('0x4c')](_0x4610c5[_0x98b2('0x45')],['id',_0x98b2('0x4e'),_0x98b2('0x4d')]);return db[_0x98b2('0x2a')][_0x98b2('0x44')](_[_0x98b2('0x3a')](_0x7180eb,_0x4610c5['body']),{'include':_0x4610c5[_0x98b2('0x2f')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x41d128){var _0x428ea3=_0x4610c5[_0x98b2('0x46')][_0x98b2('0x23')]({'plain':!![]});if(!_0x428ea3)throw new Error(_0x98b2('0x4f'));if(_0x428ea3[_0x98b2('0x50')]===_0x98b2('0x46')){var _0x552b51=_0x41d128['get']({'plain':!![]});var _0x353b9a='Projects';return db['UserProfileSection'][_0x98b2('0x43')]({'where':{'name':_0x353b9a,'userProfileId':_0x428ea3[_0x98b2('0x51')]},'raw':!![]})[_0x98b2('0x21')](function(_0x33c6ca){if(_0x33c6ca&&_0x33c6ca[_0x98b2('0x48')]===0x0){return db[_0x98b2('0x25')][_0x98b2('0x44')]({'name':_0x552b51[_0x98b2('0x28')],'resourceId':_0x552b51['id'],'type':_0x33c6ca[_0x98b2('0x28')],'sectionId':_0x33c6ca['id']},{})[_0x98b2('0x21')](function(){return _0x41d128;});}else{return _0x41d128;}})[_0x98b2('0x40')](function(_0x467192){logger[_0x98b2('0x26')](_0x98b2('0x49'),_0x467192);throw _0x467192;});}return _0x41d128;});}})[_0x98b2('0x21')](respondWithResult(_0xa68575,0xc9))[_0x98b2('0x40')](handleError(_0xa68575,null));};exports[_0x98b2('0x20')]=function(_0x190de1,_0x55f035){if(_0x190de1[_0x98b2('0x45')]['id']){delete _0x190de1[_0x98b2('0x45')]['id'];}return db[_0x98b2('0x2a')][_0x98b2('0x43')]({'where':{'id':_0x190de1[_0x98b2('0x41')]['id']}})[_0x98b2('0x21')](handleEntityNotFound(_0x55f035,null))[_0x98b2('0x21')](saveUpdates(_0x190de1[_0x98b2('0x45')],null))[_0x98b2('0x21')](respondWithResult(_0x55f035,null))[_0x98b2('0x40')](handleError(_0x55f035,null));};exports[_0x98b2('0x22')]=function(_0x57fbc1,_0x5197dd){return db[_0x98b2('0x2a')][_0x98b2('0x43')]({'where':{'id':_0x57fbc1[_0x98b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x5197dd,null))['then'](removeEntity(_0x5197dd,null))[_0x98b2('0x40')](handleError(_0x5197dd,null));};exports[_0x98b2('0x52')]=function(_0x206d11,_0x192f86,_0x1b751b){var _0x574bc1={'raw':!![],'where':{}};var _0x2c560b={};var _0x35dad3={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x206d11['params']['id']}})[_0x98b2('0x21')](handleEntityNotFound(_0x192f86,null))[_0x98b2('0x21')](function(_0x963029){if(_0x963029){_0x2c560b[_0x98b2('0x2e')]=_[_0x98b2('0x42')](db[_0x98b2('0x53')][_0x98b2('0x2b')]);_0x2c560b[_0x98b2('0x2f')]=_['keys'](_0x206d11[_0x98b2('0x2f')]);_0x2c560b[_0x98b2('0x39')]=_[_0x98b2('0x31')](_0x2c560b[_0x98b2('0x2e')],_0x2c560b[_0x98b2('0x2f')]);_0x574bc1[_0x98b2('0x30')]=_[_0x98b2('0x31')](_0x2c560b[_0x98b2('0x2e')],qs['fields'](_0x206d11[_0x98b2('0x2f')][_0x98b2('0x32')]));_0x574bc1[_0x98b2('0x30')]=_0x574bc1['attributes']['length']?_0x574bc1['attributes']:_0x2c560b[_0x98b2('0x2e')];if(!_0x206d11[_0x98b2('0x2f')][_0x98b2('0x34')](_0x98b2('0x54'))){_0x574bc1[_0x98b2('0x1d')]=qs[_0x98b2('0x1d')](_0x206d11['query']['limit']);_0x574bc1[_0x98b2('0x1a')]=qs[_0x98b2('0x1a')](_0x206d11[_0x98b2('0x2f')][_0x98b2('0x1a')]);}_0x574bc1[_0x98b2('0x35')]=qs[_0x98b2('0x36')](_0x206d11[_0x98b2('0x2f')]['sort']);_0x574bc1[_0x98b2('0x37')]=qs[_0x98b2('0x39')](_['pick'](_0x206d11[_0x98b2('0x2f')],_0x2c560b[_0x98b2('0x39')]));_0x574bc1[_0x98b2('0x37')][_0x98b2('0x55')]=_0x963029['id'];if(_0x206d11['query'][_0x98b2('0x3c')]){_0x574bc1['where']=_['merge'](_0x574bc1['where'],{'$or':_[_0x98b2('0x3b')](_0x574bc1[_0x98b2('0x30')],function(_0x18f417){var _0x294027={};_0x294027[_0x18f417]={'$like':'%'+_0x206d11['query'][_0x98b2('0x3c')]+'%'};return _0x294027;})});}_0x574bc1=_[_0x98b2('0x3a')]({},_0x574bc1,_0x206d11['options']);return db['JscriptySessionReport'][_0x98b2('0x1c')]({'where':_0x574bc1[_0x98b2('0x37')]})[_0x98b2('0x21')](function(_0x178b10){_0x35dad3['count']=_0x178b10;if(_0x206d11[_0x98b2('0x2f')][_0x98b2('0x3d')]){_0x574bc1['include']=[{'all':!![]}];}return db[_0x98b2('0x53')]['findAll'](_0x574bc1);})[_0x98b2('0x21')](function(_0x5316b2){_0x35dad3[_0x98b2('0x3f')]=_0x5316b2;return _0x35dad3;});}})[_0x98b2('0x21')](respondWithFilteredResult(_0x192f86,_0x574bc1))['catch'](handleError(_0x192f86,null));};exports['getAnswers']=function(_0x47277b,_0x45e74c,_0x16ff27){var _0x26546b={'raw':!![],'where':{}};var _0x3a2d3a={};var _0x3aad76={'count':0x0,'rows':[]};return db[_0x98b2('0x2a')]['findOne']({'where':{'id':_0x47277b[_0x98b2('0x41')]['id']}})['then'](handleEntityNotFound(_0x45e74c,null))[_0x98b2('0x21')](function(_0x247d60){if(_0x247d60){_0x3a2d3a[_0x98b2('0x2e')]=_['keys'](db[_0x98b2('0x56')][_0x98b2('0x2b')]);_0x3a2d3a['query']=_[_0x98b2('0x42')](_0x47277b[_0x98b2('0x2f')]);_0x3a2d3a[_0x98b2('0x39')]=_['intersection'](_0x3a2d3a[_0x98b2('0x2e')],_0x3a2d3a[_0x98b2('0x2f')]);_0x26546b['attributes']=_[_0x98b2('0x31')](_0x3a2d3a[_0x98b2('0x2e')],qs['fields'](_0x47277b[_0x98b2('0x2f')][_0x98b2('0x32')]));_0x26546b[_0x98b2('0x30')]=_0x26546b[_0x98b2('0x30')][_0x98b2('0x33')]?_0x26546b[_0x98b2('0x30')]:_0x3a2d3a[_0x98b2('0x2e')];if(!_0x47277b[_0x98b2('0x2f')][_0x98b2('0x34')]('nolimit')){_0x26546b[_0x98b2('0x1d')]=qs[_0x98b2('0x1d')](_0x47277b[_0x98b2('0x2f')]['limit']);_0x26546b[_0x98b2('0x1a')]=qs[_0x98b2('0x1a')](_0x47277b['query'][_0x98b2('0x1a')]);}_0x26546b[_0x98b2('0x35')]=qs[_0x98b2('0x36')](_0x47277b['query'][_0x98b2('0x36')]);_0x26546b[_0x98b2('0x37')]=qs[_0x98b2('0x39')](_['pick'](_0x47277b[_0x98b2('0x2f')],_0x3a2d3a[_0x98b2('0x39')]));_0x26546b[_0x98b2('0x37')][_0x98b2('0x55')]=_0x247d60['id'];if(_0x47277b[_0x98b2('0x2f')]['filter']){_0x26546b[_0x98b2('0x37')]=_[_0x98b2('0x3a')](_0x26546b[_0x98b2('0x37')],{'$or':_['map'](_0x26546b[_0x98b2('0x30')],function(_0x3a95c2){var _0x5c73ec={};_0x5c73ec[_0x3a95c2]={'$like':'%'+_0x47277b[_0x98b2('0x2f')][_0x98b2('0x3c')]+'%'};return _0x5c73ec;})});}_0x26546b=_[_0x98b2('0x3a')]({},_0x26546b,_0x47277b[_0x98b2('0x4b')]);return db[_0x98b2('0x56')][_0x98b2('0x1c')]({'where':_0x26546b[_0x98b2('0x37')]})['then'](function(_0x7fdf81){_0x3aad76[_0x98b2('0x1c')]=_0x7fdf81;if(_0x47277b[_0x98b2('0x2f')]['includeAll']){_0x26546b['include']=[{'all':!![]}];}return db[_0x98b2('0x56')][_0x98b2('0x57')](_0x26546b);})['then'](function(_0xdc193f){_0x3aad76[_0x98b2('0x3f')]=_0xdc193f;return _0x3aad76;});}})[_0x98b2('0x21')](respondWithFilteredResult(_0x45e74c,_0x26546b))[_0x98b2('0x40')](handleError(_0x45e74c,null));};function char(_0x5c669d){return _0x98b2('0x58')===typeof _0x5c669d?String[_0x98b2('0x59')]['apply'](null,arguments):_0x5c669d;}function needsEncapsulation(_0x577fdd){return!!_0x577fdd&&(_0x577fdd[_0x98b2('0x5a')]()[_0x98b2('0x5b')](char(0xd))>=0x0||_0x577fdd[_0x98b2('0x5a')]()[_0x98b2('0x5b')](char(0xa))>=0x0||_0x577fdd[_0x98b2('0x5a')]()[_0x98b2('0x5b')](char(0x2c))>=0x0||_0x577fdd[_0x98b2('0x5a')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x16ebe1){var _0x3c91ed=char(0x22),_0x151815='\x5c'+char(0x22),_0x4e454a=_0x16ebe1[_0x98b2('0x5a')]()[_0x98b2('0x5c')](new RegExp(_0x3c91ed,'g'),_0x151815);return _0x3c91ed+_0x4e454a+_0x3c91ed;}exports[_0x98b2('0x5d')]=function(_0x1452da,_0x3ea9f1,_0x228ee7){var _0x2bacba,_0x41a4bf;var _0x201331={'where':{'ProjectId':_0x1452da[_0x98b2('0x41')]['id']}};if(_0x1452da[_0x98b2('0x2f')][_0x98b2('0x5e')]){_0x201331['where'][_0x98b2('0x5f')]=JSON[_0x98b2('0x60')](_0x1452da[_0x98b2('0x2f')][_0x98b2('0x5e')]);}return db[_0x98b2('0x53')][_0x98b2('0x57')](_0x201331)[_0x98b2('0x21')](handleEntityNotFound(_0x3ea9f1,null))[_0x98b2('0x21')](function(_0x1757a9){if(_0x1757a9){_0x2bacba=_0x1757a9;return db[_0x98b2('0x61')][_0x98b2('0x57')]({'where':{'SessionId':{'$in':_[_0x98b2('0x3b')](_0x2bacba,'id')},'ProjectId':_0x1452da[_0x98b2('0x41')]['id']},'order':_0x98b2('0x62')});}})[_0x98b2('0x21')](handleEntityNotFound(_0x3ea9f1,null))['then'](function(_0xb1ebab){if(_0xb1ebab){_0x41a4bf=_0xb1ebab;var _0x2bcc88={};for(var _0x532a26=0x0,_0x279f95=_0x41a4bf[_0x98b2('0x33')];_0x532a26<_0x279f95;_0x532a26++){if(!_0x2bcc88['hasOwnProperty'](_0x41a4bf[_0x532a26][_0x98b2('0x63')])){_0x2bcc88[_0x41a4bf[_0x532a26]['questionId']]=needsEncapsulation(_0x41a4bf[_0x532a26][_0x98b2('0x64')])?encapsulate(_0x41a4bf[_0x532a26][_0x98b2('0x64')]):_0x41a4bf[_0x532a26][_0x98b2('0x64')];}}var _0x470046=[],_0x11d585={};for(var _0x3cb601=0x0,_0x1aae16=_0x2bacba['length'];_0x3cb601<_0x1aae16;_0x3cb601++){_0x11d585={'ProjectId':_0x1452da['params']['id'],'SessionId':_0x2bacba[_0x3cb601]['id'],'StartTime':moment(_0x2bacba[_0x3cb601][_0x98b2('0x5f')])[_0x98b2('0x65')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x46a45c=0x0,_0xecf9a3=_0x41a4bf[_0x98b2('0x33')];_0x46a45c<_0xecf9a3;_0x46a45c++){if(_0x41a4bf[_0x46a45c][_0x98b2('0x66')]==_0x2bacba[_0x3cb601]['id']&&_0x2bcc88['hasOwnProperty'](_0x41a4bf[_0x46a45c][_0x98b2('0x63')])){_0x11d585[_0x2bcc88[_0x41a4bf[_0x46a45c][_0x98b2('0x63')]]]=_0x41a4bf[_0x46a45c][_0x98b2('0x67')];}}for(var _0x4c7379 in _0x2bcc88){if(!_0x11d585[_0x98b2('0x34')](_0x2bcc88[_0x4c7379])){_0x11d585[_0x2bcc88[_0x4c7379]]=null;}}_0x470046[_0x98b2('0x68')](_0x11d585);}return _0x470046;}})[_0x98b2('0x21')](function(_0x5cbece){if(!_['isEmpty'](_0x5cbece)){var _0x377c3f=toCsv(_0x5cbece);var _0x285f96=Date[_0x98b2('0x69')]();fs['writeFileSync'](util[_0x98b2('0x65')](_0x98b2('0x6a'),_0x1452da[_0x98b2('0x41')]['id'],_0x285f96),_0x377c3f);_0x3ea9f1[_0x98b2('0x6b')]('Content-disposition',_0x98b2('0x6c')+util[_0x98b2('0x65')](_0x98b2('0x6d'),_0x1452da[_0x98b2('0x41')]['id'],_0x285f96));_0x3ea9f1[_0x98b2('0x6b')](_0x98b2('0x6e'),_0x98b2('0x6f'));return _0x3ea9f1[_0x98b2('0x70')](util[_0x98b2('0x65')](_0x98b2('0x6a'),_0x1452da[_0x98b2('0x41')]['id'],_0x285f96));}else{return _0x3ea9f1[_0x98b2('0x16')](0xcc);}})[_0x98b2('0x40')](handleError(_0x3ea9f1,null));}; \ No newline at end of file +var _0x04bc=['crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','Projects','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','role','UserProfileSection','getSessions','findOne','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x04bc,0xeb));var _0xc04b=function(_0x5f1bbc,_0x5c5195){_0x5f1bbc=_0x5f1bbc-0x0;var _0x4f99f9=_0x04bc[_0x5f1bbc];return _0x4f99f9;};'use strict';var emlformat=require(_0xc04b('0x0'));var rimraf=require(_0xc04b('0x1'));var zipdir=require(_0xc04b('0x2'));var jsonpatch=require(_0xc04b('0x3'));var rp=require(_0xc04b('0x4'));var moment=require('moment');var BPromise=require(_0xc04b('0x5'));var Mustache=require(_0xc04b('0x6'));var util=require(_0xc04b('0x7'));var path=require('path');var sox=require(_0xc04b('0x8'));var csv=require(_0xc04b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc04b('0xa'));var _=require(_0xc04b('0xb'));var squel=require(_0xc04b('0xc'));var crypto=require(_0xc04b('0xd'));var jsforce=require(_0xc04b('0xe'));var deskjs=require(_0xc04b('0xf'));var toCsv=require(_0xc04b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc04b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc04b('0x11'));var hardwareService=require(_0xc04b('0x12'));var logger=require(_0xc04b('0x13'))(_0xc04b('0x14'));var utils=require(_0xc04b('0x15'));var config=require(_0xc04b('0x16'));var licenseUtil=require(_0xc04b('0x17'));var db=require(_0xc04b('0x18'))['db'];function respondWithStatusCode(_0x26cc1a,_0x3d7ec0){_0x3d7ec0=_0x3d7ec0||0xcc;return function(_0xd9c01d){if(_0xd9c01d){return _0x26cc1a[_0xc04b('0x19')](_0x3d7ec0);}return _0x26cc1a[_0xc04b('0x1a')](_0x3d7ec0)[_0xc04b('0x1b')]();};}function respondWithResult(_0x1f5cb7,_0x699cd){_0x699cd=_0x699cd||0xc8;return function(_0x34e545){if(_0x34e545){return _0x1f5cb7[_0xc04b('0x1a')](_0x699cd)[_0xc04b('0x1c')](_0x34e545);}};}function respondWithFilteredResult(_0x32026e,_0x39b3dc){return function(_0x7b257f){if(_0x7b257f){var _0x3d4a43=typeof _0x39b3dc['offset']==='undefined'&&typeof _0x39b3dc[_0xc04b('0x1d')]===_0xc04b('0x1e');var _0x8fa974=_0x7b257f[_0xc04b('0x1f')];var _0x34df7e=_0x3d4a43?0x0:_0x39b3dc[_0xc04b('0x20')];var _0x136880=_0x3d4a43?_0x7b257f['count']:_0x39b3dc[_0xc04b('0x20')]+_0x39b3dc['limit'];var _0xc0815a;if(_0x136880>=_0x8fa974){_0x136880=_0x8fa974;_0xc0815a=0xc8;}else{_0xc0815a=0xce;}_0x32026e[_0xc04b('0x1a')](_0xc0815a);return _0x32026e[_0xc04b('0x21')]('Content-Range',_0x34df7e+'-'+_0x136880+'/'+_0x8fa974)[_0xc04b('0x1c')](_0x7b257f);}return null;};}function patchUpdates(_0x50272b){return function(_0x178675){try{jsonpatch[_0xc04b('0x22')](_0x178675,_0x50272b,!![]);}catch(_0x2ebc01){return BPromise[_0xc04b('0x23')](_0x2ebc01);}return _0x178675[_0xc04b('0x24')]();};}function saveUpdates(_0x4f8dd2,_0x48d4cd){return function(_0x1fd9e8){if(_0x1fd9e8){return _0x1fd9e8[_0xc04b('0x25')](_0x4f8dd2)[_0xc04b('0x26')](function(_0xae8c){return _0xae8c;});}return null;};}function removeEntity(_0x4d3aba,_0x316644){return function(_0xffa313){if(_0xffa313){return _0xffa313[_0xc04b('0x27')]()[_0xc04b('0x26')](function(){var _0x33a2a8=_0xffa313['get']({'plain':!![]});var _0x3f4a83=_0xc04b('0x28');return db['UserProfileResource'][_0xc04b('0x27')]({'where':{'type':_0x3f4a83,'resourceId':_0x33a2a8['id']}})[_0xc04b('0x26')](function(){return _0xffa313;});})[_0xc04b('0x26')](function(){_0x4d3aba['status'](0xcc)[_0xc04b('0x1b')]();});}};}function handleEntityNotFound(_0x35e67f,_0x19133a){return function(_0x14f1ad){if(!_0x14f1ad){_0x35e67f[_0xc04b('0x19')](0x194);}return _0x14f1ad;};}function handleError(_0x37c7de,_0x52a0a7){_0x52a0a7=_0x52a0a7||0x1f4;return function(_0x1b3885){logger[_0xc04b('0x29')](_0x1b3885[_0xc04b('0x2a')]);if(_0x1b3885[_0xc04b('0x2b')]){delete _0x1b3885['name'];}_0x37c7de[_0xc04b('0x1a')](_0x52a0a7)[_0xc04b('0x2c')](_0x1b3885);};}exports[_0xc04b('0x2d')]=function(_0x51a66c,_0x476cc0){var _0x4066f8={},_0x4b1126={},_0x23a4a4={'count':0x0,'rows':[]};var _0x394782=_[_0xc04b('0x2e')](db[_0xc04b('0x2f')][_0xc04b('0x30')],function(_0x59cafb){return{'name':_0x59cafb[_0xc04b('0x31')],'type':_0x59cafb[_0xc04b('0x32')][_0xc04b('0x33')]};});_0x4b1126[_0xc04b('0x34')]=_['map'](_0x394782,_0xc04b('0x2b'));_0x4b1126[_0xc04b('0x35')]=_[_0xc04b('0x36')](_0x51a66c[_0xc04b('0x35')]);_0x4b1126[_0xc04b('0x37')]=_[_0xc04b('0x38')](_0x4b1126[_0xc04b('0x34')],_0x4b1126[_0xc04b('0x35')]);_0x4066f8[_0xc04b('0x39')]=_[_0xc04b('0x38')](_0x4b1126['model'],qs[_0xc04b('0x3a')](_0x51a66c[_0xc04b('0x35')][_0xc04b('0x3a')]));_0x4066f8['attributes']=_0x4066f8[_0xc04b('0x39')][_0xc04b('0x3b')]?_0x4066f8['attributes']:_0x4b1126['model'];if(!_0x51a66c[_0xc04b('0x35')][_0xc04b('0x3c')](_0xc04b('0x3d'))){_0x4066f8[_0xc04b('0x1d')]=qs[_0xc04b('0x1d')](_0x51a66c[_0xc04b('0x35')]['limit']);_0x4066f8[_0xc04b('0x20')]=qs[_0xc04b('0x20')](_0x51a66c[_0xc04b('0x35')][_0xc04b('0x20')]);}_0x4066f8['order']=qs[_0xc04b('0x3e')](_0x51a66c[_0xc04b('0x35')]['sort']);_0x4066f8[_0xc04b('0x3f')]=qs[_0xc04b('0x37')](_[_0xc04b('0x40')](_0x51a66c[_0xc04b('0x35')],_0x4b1126[_0xc04b('0x37')]),_0x394782);if(_0x51a66c[_0xc04b('0x35')][_0xc04b('0x41')]){_0x4066f8[_0xc04b('0x3f')]=_[_0xc04b('0x42')](_0x4066f8[_0xc04b('0x3f')],{'$or':_['map'](_0x394782,function(_0x2d9e25){if(_0x2d9e25[_0xc04b('0x32')]!==_0xc04b('0x43')){var _0x101014={};_0x101014[_0x2d9e25[_0xc04b('0x2b')]]={'$like':'%'+_0x51a66c[_0xc04b('0x35')][_0xc04b('0x41')]+'%'};return _0x101014;}})});}_0x4066f8=_[_0xc04b('0x42')]({},_0x4066f8,_0x51a66c[_0xc04b('0x44')]);var _0x4ba4a2={'where':_0x4066f8[_0xc04b('0x3f')]};return db[_0xc04b('0x2f')][_0xc04b('0x1f')](_0x4ba4a2)[_0xc04b('0x26')](function(_0x37c7b6){_0x23a4a4[_0xc04b('0x1f')]=_0x37c7b6;if(_0x51a66c[_0xc04b('0x35')][_0xc04b('0x45')]){_0x4066f8[_0xc04b('0x46')]=[{'all':!![]}];}return db['JscriptyProject'][_0xc04b('0x47')](_0x4066f8);})['then'](function(_0x43e1ea){_0x23a4a4[_0xc04b('0x48')]=_0x43e1ea;return _0x23a4a4;})[_0xc04b('0x26')](respondWithFilteredResult(_0x476cc0,_0x4066f8))['catch'](handleError(_0x476cc0,null));};exports[_0xc04b('0x49')]=function(_0xb20431,_0x3ce2c4){var _0x2f027f={'raw':![],'where':{'id':_0xb20431[_0xc04b('0x4a')]['id']}},_0x36cbc1={};_0x36cbc1[_0xc04b('0x34')]=_['keys'](db[_0xc04b('0x2f')][_0xc04b('0x30')]);_0x36cbc1[_0xc04b('0x35')]=_[_0xc04b('0x36')](_0xb20431['query']);_0x36cbc1[_0xc04b('0x37')]=_['intersection'](_0x36cbc1['model'],_0x36cbc1['query']);_0x2f027f[_0xc04b('0x39')]=_['intersection'](_0x36cbc1['model'],qs[_0xc04b('0x3a')](_0xb20431[_0xc04b('0x35')]['fields']));_0x2f027f[_0xc04b('0x39')]=_0x2f027f[_0xc04b('0x39')][_0xc04b('0x3b')]?_0x2f027f[_0xc04b('0x39')]:_0x36cbc1[_0xc04b('0x34')];if(_0xb20431['query'][_0xc04b('0x45')]){_0x2f027f[_0xc04b('0x46')]=[{'all':!![]}];}_0x2f027f=_['merge']({},_0x2f027f,_0xb20431[_0xc04b('0x44')]);return db['JscriptyProject'][_0xc04b('0x4b')](_0x2f027f)['then'](handleEntityNotFound(_0x3ce2c4,null))[_0xc04b('0x26')](respondWithResult(_0x3ce2c4,null))[_0xc04b('0x4c')](handleError(_0x3ce2c4,null));};exports['create']=function(_0x348619,_0x4ac0f6){return db[_0xc04b('0x2f')][_0xc04b('0x4d')](_0x348619['body'],{})[_0xc04b('0x26')](function(_0x31df3a){var _0x109375=_0x348619[_0xc04b('0x4e')][_0xc04b('0x4f')]({'plain':!![]});if(!_0x109375)throw new Error(_0xc04b('0x50'));if(_0x109375['role']===_0xc04b('0x4e')){var _0x26441c=_0x31df3a[_0xc04b('0x4f')]({'plain':!![]});var _0x28bf0f=_0xc04b('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x28bf0f,'userProfileId':_0x109375[_0xc04b('0x51')]},'raw':!![]})[_0xc04b('0x26')](function(_0x99d28){if(_0x99d28&&_0x99d28[_0xc04b('0x52')]===0x0){return db[_0xc04b('0x53')][_0xc04b('0x4d')]({'name':_0x26441c[_0xc04b('0x2b')],'resourceId':_0x26441c['id'],'type':_0x99d28['name'],'sectionId':_0x99d28['id']},{})[_0xc04b('0x26')](function(){return _0x31df3a;});}else{return _0x31df3a;}})['catch'](function(_0x16b0df){logger[_0xc04b('0x29')](_0xc04b('0x54'),_0x16b0df);throw _0x16b0df;});}return _0x31df3a;})[_0xc04b('0x26')](respondWithResult(_0x4ac0f6,0xc9))[_0xc04b('0x4c')](handleError(_0x4ac0f6,null));};exports['clone']=function(_0x4a3a2a,_0x292e25){var _0x5ad567={'where':{'id':_0x4a3a2a['params']['id']}},_0x160176={};_0x160176[_0xc04b('0x34')]=_[_0xc04b('0x36')](db[_0xc04b('0x2f')]['rawAttributes']);_0x5ad567[_0xc04b('0x39')]=_[_0xc04b('0x38')](_0x160176[_0xc04b('0x34')],qs['fields'](_0x4a3a2a[_0xc04b('0x35')][_0xc04b('0x3a')]));_0x5ad567['attributes']=_0x5ad567[_0xc04b('0x39')]['length']?_0x5ad567[_0xc04b('0x39')]:_0x160176[_0xc04b('0x34')];if(_0x4a3a2a['query'][_0xc04b('0x45')]){_0x5ad567[_0xc04b('0x46')]=[{'all':!![]}];}_0x5ad567=_[_0xc04b('0x42')]({},_0x5ad567,_0x4a3a2a[_0xc04b('0x44')]);return db[_0xc04b('0x2f')][_0xc04b('0x4b')](_0x5ad567)[_0xc04b('0x26')](handleEntityNotFound(_0x292e25,null))[_0xc04b('0x26')](function(_0x4fda2c){if(_0x4fda2c){var _0x3bd358=_0x4fda2c[_0xc04b('0x4f')]({'plain':!![]});_0x3bd358=qs[_0xc04b('0x55')](_0x3bd358,['id',_0xc04b('0x56'),_0xc04b('0x57')]);_0x4a3a2a[_0xc04b('0x58')]=_['omit'](_0x4a3a2a[_0xc04b('0x58')],['id',_0xc04b('0x56'),_0xc04b('0x57')]);return db[_0xc04b('0x2f')]['create'](_[_0xc04b('0x42')](_0x3bd358,_0x4a3a2a[_0xc04b('0x58')]),{'include':_0x4a3a2a[_0xc04b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1ef112){var _0x4867f9=_0x4a3a2a[_0xc04b('0x4e')][_0xc04b('0x4f')]({'plain':!![]});if(!_0x4867f9)throw new Error(_0xc04b('0x50'));if(_0x4867f9[_0xc04b('0x59')]===_0xc04b('0x4e')){var _0xc4ac8c=_0x1ef112['get']({'plain':!![]});var _0x5493c3=_0xc04b('0x28');return db[_0xc04b('0x5a')][_0xc04b('0x4b')]({'where':{'name':_0x5493c3,'userProfileId':_0x4867f9[_0xc04b('0x51')]},'raw':!![]})[_0xc04b('0x26')](function(_0x479987){if(_0x479987&&_0x479987[_0xc04b('0x52')]===0x0){return db[_0xc04b('0x53')]['create']({'name':_0xc4ac8c[_0xc04b('0x2b')],'resourceId':_0xc4ac8c['id'],'type':_0x479987[_0xc04b('0x2b')],'sectionId':_0x479987['id']},{})[_0xc04b('0x26')](function(){return _0x1ef112;});}else{return _0x1ef112;}})['catch'](function(_0x3f2366){logger[_0xc04b('0x29')](_0xc04b('0x54'),_0x3f2366);throw _0x3f2366;});}return _0x1ef112;});}})[_0xc04b('0x26')](respondWithResult(_0x292e25,0xc9))[_0xc04b('0x4c')](handleError(_0x292e25,null));};exports['update']=function(_0x5d2e17,_0x360f84){if(_0x5d2e17[_0xc04b('0x58')]['id']){delete _0x5d2e17['body']['id'];}return db[_0xc04b('0x2f')]['find']({'where':{'id':_0x5d2e17['params']['id']}})[_0xc04b('0x26')](handleEntityNotFound(_0x360f84,null))[_0xc04b('0x26')](saveUpdates(_0x5d2e17['body'],null))['then'](respondWithResult(_0x360f84,null))[_0xc04b('0x4c')](handleError(_0x360f84,null));};exports[_0xc04b('0x27')]=function(_0x5a45df,_0x43aef8){return db[_0xc04b('0x2f')][_0xc04b('0x4b')]({'where':{'id':_0x5a45df[_0xc04b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x43aef8,null))[_0xc04b('0x26')](removeEntity(_0x43aef8,null))[_0xc04b('0x4c')](handleError(_0x43aef8,null));};exports[_0xc04b('0x5b')]=function(_0x11eae1,_0x5e96ce,_0x44496a){var _0x49fafc={'raw':!![],'where':{}};var _0x381d5c={};var _0x8460f2={'count':0x0,'rows':[]};return db[_0xc04b('0x2f')][_0xc04b('0x5c')]({'where':{'id':_0x11eae1[_0xc04b('0x4a')]['id']}})[_0xc04b('0x26')](handleEntityNotFound(_0x5e96ce,null))['then'](function(_0x19cd26){if(_0x19cd26){_0x381d5c['model']=_[_0xc04b('0x36')](db[_0xc04b('0x5d')][_0xc04b('0x30')]);_0x381d5c['query']=_['keys'](_0x11eae1[_0xc04b('0x35')]);_0x381d5c[_0xc04b('0x37')]=_[_0xc04b('0x38')](_0x381d5c[_0xc04b('0x34')],_0x381d5c[_0xc04b('0x35')]);_0x49fafc[_0xc04b('0x39')]=_[_0xc04b('0x38')](_0x381d5c[_0xc04b('0x34')],qs['fields'](_0x11eae1[_0xc04b('0x35')][_0xc04b('0x3a')]));_0x49fafc['attributes']=_0x49fafc[_0xc04b('0x39')][_0xc04b('0x3b')]?_0x49fafc[_0xc04b('0x39')]:_0x381d5c['model'];if(!_0x11eae1[_0xc04b('0x35')][_0xc04b('0x3c')](_0xc04b('0x3d'))){_0x49fafc[_0xc04b('0x1d')]=qs[_0xc04b('0x1d')](_0x11eae1['query'][_0xc04b('0x1d')]);_0x49fafc[_0xc04b('0x20')]=qs['offset'](_0x11eae1['query']['offset']);}_0x49fafc[_0xc04b('0x5e')]=qs[_0xc04b('0x3e')](_0x11eae1[_0xc04b('0x35')][_0xc04b('0x3e')]);_0x49fafc[_0xc04b('0x3f')]=qs[_0xc04b('0x37')](_[_0xc04b('0x40')](_0x11eae1[_0xc04b('0x35')],_0x381d5c['filters']));_0x49fafc[_0xc04b('0x3f')][_0xc04b('0x5f')]=_0x19cd26['id'];if(_0x11eae1[_0xc04b('0x35')][_0xc04b('0x41')]){_0x49fafc[_0xc04b('0x3f')]=_['merge'](_0x49fafc[_0xc04b('0x3f')],{'$or':_[_0xc04b('0x2e')](_0x49fafc['attributes'],function(_0x209338){var _0x28493f={};_0x28493f[_0x209338]={'$like':'%'+_0x11eae1[_0xc04b('0x35')]['filter']+'%'};return _0x28493f;})});}_0x49fafc=_[_0xc04b('0x42')]({},_0x49fafc,_0x11eae1['options']);return db[_0xc04b('0x5d')][_0xc04b('0x1f')]({'where':_0x49fafc[_0xc04b('0x3f')]})['then'](function(_0x10ac39){_0x8460f2['count']=_0x10ac39;if(_0x11eae1['query'][_0xc04b('0x45')]){_0x49fafc[_0xc04b('0x46')]=[{'all':!![]}];}return db[_0xc04b('0x5d')][_0xc04b('0x47')](_0x49fafc);})[_0xc04b('0x26')](function(_0x117d9f){_0x8460f2[_0xc04b('0x48')]=_0x117d9f;return _0x8460f2;});}})[_0xc04b('0x26')](respondWithFilteredResult(_0x5e96ce,_0x49fafc))[_0xc04b('0x4c')](handleError(_0x5e96ce,null));};exports[_0xc04b('0x60')]=function(_0x4d8b68,_0x52b838,_0x3b9d01){var _0x479af3={'raw':!![],'where':{}};var _0x57f4af={};var _0x195454={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x4d8b68[_0xc04b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52b838,null))['then'](function(_0x12f1b5){if(_0x12f1b5){_0x57f4af[_0xc04b('0x34')]=_[_0xc04b('0x36')](db['JscriptyAnswerReport'][_0xc04b('0x30')]);_0x57f4af[_0xc04b('0x35')]=_[_0xc04b('0x36')](_0x4d8b68['query']);_0x57f4af[_0xc04b('0x37')]=_[_0xc04b('0x38')](_0x57f4af[_0xc04b('0x34')],_0x57f4af[_0xc04b('0x35')]);_0x479af3['attributes']=_[_0xc04b('0x38')](_0x57f4af[_0xc04b('0x34')],qs['fields'](_0x4d8b68[_0xc04b('0x35')][_0xc04b('0x3a')]));_0x479af3[_0xc04b('0x39')]=_0x479af3[_0xc04b('0x39')][_0xc04b('0x3b')]?_0x479af3[_0xc04b('0x39')]:_0x57f4af['model'];if(!_0x4d8b68[_0xc04b('0x35')][_0xc04b('0x3c')](_0xc04b('0x3d'))){_0x479af3[_0xc04b('0x1d')]=qs[_0xc04b('0x1d')](_0x4d8b68[_0xc04b('0x35')]['limit']);_0x479af3[_0xc04b('0x20')]=qs['offset'](_0x4d8b68[_0xc04b('0x35')][_0xc04b('0x20')]);}_0x479af3[_0xc04b('0x5e')]=qs[_0xc04b('0x3e')](_0x4d8b68[_0xc04b('0x35')][_0xc04b('0x3e')]);_0x479af3[_0xc04b('0x3f')]=qs[_0xc04b('0x37')](_[_0xc04b('0x40')](_0x4d8b68[_0xc04b('0x35')],_0x57f4af[_0xc04b('0x37')]));_0x479af3['where'][_0xc04b('0x5f')]=_0x12f1b5['id'];if(_0x4d8b68[_0xc04b('0x35')][_0xc04b('0x41')]){_0x479af3[_0xc04b('0x3f')]=_[_0xc04b('0x42')](_0x479af3[_0xc04b('0x3f')],{'$or':_[_0xc04b('0x2e')](_0x479af3['attributes'],function(_0x10552c){var _0x3ded3f={};_0x3ded3f[_0x10552c]={'$like':'%'+_0x4d8b68[_0xc04b('0x35')][_0xc04b('0x41')]+'%'};return _0x3ded3f;})});}_0x479af3=_[_0xc04b('0x42')]({},_0x479af3,_0x4d8b68[_0xc04b('0x44')]);return db[_0xc04b('0x61')]['count']({'where':_0x479af3[_0xc04b('0x3f')]})[_0xc04b('0x26')](function(_0x44578d){_0x195454[_0xc04b('0x1f')]=_0x44578d;if(_0x4d8b68[_0xc04b('0x35')][_0xc04b('0x45')]){_0x479af3['include']=[{'all':!![]}];}return db[_0xc04b('0x61')]['findAll'](_0x479af3);})[_0xc04b('0x26')](function(_0x8d3835){_0x195454[_0xc04b('0x48')]=_0x8d3835;return _0x195454;});}})[_0xc04b('0x26')](respondWithFilteredResult(_0x52b838,_0x479af3))[_0xc04b('0x4c')](handleError(_0x52b838,null));};function char(_0x550f93){return'number'===typeof _0x550f93?String['fromCharCode'][_0xc04b('0x22')](null,arguments):_0x550f93;}function needsEncapsulation(_0x110454){return!!_0x110454&&(_0x110454[_0xc04b('0x62')]()['indexOf'](char(0xd))>=0x0||_0x110454[_0xc04b('0x62')]()[_0xc04b('0x63')](char(0xa))>=0x0||_0x110454[_0xc04b('0x62')]()[_0xc04b('0x63')](char(0x2c))>=0x0||_0x110454[_0xc04b('0x62')]()[_0xc04b('0x63')](char(0x22))>=0x0);}function encapsulate(_0x505cf0){var _0x16d06d=char(0x22),_0x148744='\x5c'+char(0x22),_0xf90c0e=_0x505cf0[_0xc04b('0x62')]()[_0xc04b('0x64')](new RegExp(_0x16d06d,'g'),_0x148744);return _0x16d06d+_0xf90c0e+_0x16d06d;}exports[_0xc04b('0x65')]=function(_0x59d36e,_0x3d6fab,_0xc5fa2d){var _0x3a77d7,_0x29efbf;var _0x531dcf={'where':{'ProjectId':_0x59d36e[_0xc04b('0x4a')]['id']}};if(_0x59d36e[_0xc04b('0x35')][_0xc04b('0x66')]){_0x531dcf[_0xc04b('0x3f')]['starttime']=JSON[_0xc04b('0x67')](_0x59d36e[_0xc04b('0x35')][_0xc04b('0x66')]);}return db[_0xc04b('0x5d')][_0xc04b('0x47')](_0x531dcf)[_0xc04b('0x26')](handleEntityNotFound(_0x3d6fab,null))[_0xc04b('0x26')](function(_0x219bb4){if(_0x219bb4){_0x3a77d7=_0x219bb4;return db[_0xc04b('0x68')][_0xc04b('0x47')]({'where':{'SessionId':{'$in':_[_0xc04b('0x2e')](_0x3a77d7,'id')},'ProjectId':_0x59d36e[_0xc04b('0x4a')]['id']},'order':_0xc04b('0x69')});}})['then'](handleEntityNotFound(_0x3d6fab,null))[_0xc04b('0x26')](function(_0x221def){if(_0x221def){_0x29efbf=_0x221def;var _0x3815f6={};for(var _0x49af93=0x0,_0x336f9b=_0x29efbf[_0xc04b('0x3b')];_0x49af93<_0x336f9b;_0x49af93++){if(!_0x3815f6[_0xc04b('0x3c')](_0x29efbf[_0x49af93][_0xc04b('0x6a')])){_0x3815f6[_0x29efbf[_0x49af93]['questionId']]=needsEncapsulation(_0x29efbf[_0x49af93]['question'])?encapsulate(_0x29efbf[_0x49af93][_0xc04b('0x6b')]):_0x29efbf[_0x49af93]['question'];}}var _0x5bcb48=[],_0x2fd576={};for(var _0x5407af=0x0,_0xc1c29b=_0x3a77d7[_0xc04b('0x3b')];_0x5407af<_0xc1c29b;_0x5407af++){_0x2fd576={'ProjectId':_0x59d36e[_0xc04b('0x4a')]['id'],'SessionId':_0x3a77d7[_0x5407af]['id'],'StartTime':moment(_0x3a77d7[_0x5407af][_0xc04b('0x6c')])[_0xc04b('0x6d')](_0xc04b('0x6e'))};for(var _0x55ffda=0x0,_0xa6b622=_0x29efbf[_0xc04b('0x3b')];_0x55ffda<_0xa6b622;_0x55ffda++){if(_0x29efbf[_0x55ffda][_0xc04b('0x6f')]==_0x3a77d7[_0x5407af]['id']&&_0x3815f6['hasOwnProperty'](_0x29efbf[_0x55ffda][_0xc04b('0x6a')])){_0x2fd576[_0x3815f6[_0x29efbf[_0x55ffda][_0xc04b('0x6a')]]]=_0x29efbf[_0x55ffda][_0xc04b('0x70')];}}for(var _0x30fb85 in _0x3815f6){if(!_0x2fd576['hasOwnProperty'](_0x3815f6[_0x30fb85])){_0x2fd576[_0x3815f6[_0x30fb85]]=null;}}_0x5bcb48[_0xc04b('0x71')](_0x2fd576);}return _0x5bcb48;}})[_0xc04b('0x26')](function(_0x1ea5de){if(!_[_0xc04b('0x72')](_0x1ea5de)){var _0x5aa45a=toCsv(_0x1ea5de);var _0x154c2d=Date[_0xc04b('0x73')]();fs[_0xc04b('0x74')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x59d36e[_0xc04b('0x4a')]['id'],_0x154c2d),_0x5aa45a);_0x3d6fab[_0xc04b('0x75')](_0xc04b('0x76'),_0xc04b('0x77')+util[_0xc04b('0x6d')](_0xc04b('0x78'),_0x59d36e[_0xc04b('0x4a')]['id'],_0x154c2d));_0x3d6fab[_0xc04b('0x75')]('Content-type',_0xc04b('0x79'));return _0x3d6fab[_0xc04b('0x7a')](util[_0xc04b('0x6d')](_0xc04b('0x7b'),_0x59d36e[_0xc04b('0x4a')]['id'],_0x154c2d));}else{return _0x3d6fab[_0xc04b('0x19')](0xcc);}})[_0xc04b('0x4c')](handleError(_0x3d6fab,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 3dfe7de..3082a28 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 _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x885a,0x180));var _0xa885=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x885a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed95=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c3593,_0x4ea381){var _0x1172d1=function(_0x434b93){while(--_0x434b93){_0x4c3593['push'](_0x4c3593['shift']());}};_0x1172d1(++_0x4ea381);}(_0xed95,0xb9));var _0x5ed9=function(_0x105888,_0x50d1e7){_0x105888=_0x105888-0x0;var _0x289389=_0xed95[_0x105888];return _0x289389;};'use strict';var _=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var logger=require(_0x5ed9('0x2'))(_0x5ed9('0x3'));var moment=require(_0x5ed9('0x4'));var BPromise=require(_0x5ed9('0x5'));var rp=require(_0x5ed9('0x6'));var fs=require('fs');var path=require(_0x5ed9('0x7'));var rimraf=require(_0x5ed9('0x8'));var config=require(_0x5ed9('0x9'));var attributes=require(_0x5ed9('0xa'));module[_0x5ed9('0xb')]=function(_0x52a57d,_0x48efa8){return _0x52a57d[_0x5ed9('0xc')](_0x5ed9('0xd'),attributes,{'tableName':_0x5ed9('0xe'),'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 56af2da..8854d5d 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x20c9d6,_0x160bea){_0x20c9d6=_0x20c9d6-0x0;var _0x3b8794=_0xbdb7[_0x20c9d6];return _0x3b8794;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b46c2e2..03f636a 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 _0xb6d8=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x142535,_0x2352b8){var _0x14fa6e=function(_0x22bef4){while(--_0x22bef4){_0x142535['push'](_0x142535['shift']());}};_0x14fa6e(++_0x2352b8);}(_0xb6d8,0x1d3));var _0x8b6d=function(_0x5e1009,_0xb9528d){_0x5e1009=_0x5e1009-0x0;var _0x30ddb8=_0xb6d8[_0x5e1009];return _0x30ddb8;};'use strict';var multer=require(_0x8b6d('0x0'));var util=require(_0x8b6d('0x1'));var path=require(_0x8b6d('0x2'));var timeout=require(_0x8b6d('0x3'));var express=require(_0x8b6d('0x4'));var router=express['Router']();var fs_extra=require(_0x8b6d('0x5'));var auth=require(_0x8b6d('0x6'));var interaction=require(_0x8b6d('0x7'));var config=require('../../config/environment');var controller=require(_0x8b6d('0x8'));router[_0x8b6d('0x9')]('/',auth[_0x8b6d('0xa')](),controller['index']);router['get'](_0x8b6d('0xb'),auth[_0x8b6d('0xa')](),controller[_0x8b6d('0xc')]);router[_0x8b6d('0x9')](_0x8b6d('0xd'),auth[_0x8b6d('0xa')](),controller[_0x8b6d('0xe')]);router[_0x8b6d('0xf')]('/',auth[_0x8b6d('0xa')](),controller['create']);router[_0x8b6d('0x10')](_0x8b6d('0xd'),auth['isAuthenticated'](),controller[_0x8b6d('0x11')]);router[_0x8b6d('0x12')](_0x8b6d('0xd'),auth['isAuthenticated'](),controller[_0x8b6d('0x13')]);module[_0x8b6d('0x14')]=router; \ No newline at end of file +var _0x44e7=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy'];(function(_0x36a306,_0x1b0909){var _0x62ad0=function(_0x46d823){while(--_0x46d823){_0x36a306['push'](_0x36a306['shift']());}};_0x62ad0(++_0x1b0909);}(_0x44e7,0xfe));var _0x744e=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0x44e7[_0x55d8c5];return _0x225ae5;};'use strict';var multer=require(_0x744e('0x0'));var util=require(_0x744e('0x1'));var path=require(_0x744e('0x2'));var timeout=require(_0x744e('0x3'));var express=require(_0x744e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x744e('0x5'));var interaction=require(_0x744e('0x6'));var config=require(_0x744e('0x7'));var controller=require(_0x744e('0x8'));router[_0x744e('0x9')]('/',auth[_0x744e('0xa')](),controller[_0x744e('0xb')]);router[_0x744e('0x9')](_0x744e('0xc'),auth[_0x744e('0xa')](),controller[_0x744e('0xd')]);router[_0x744e('0x9')]('/:id',auth[_0x744e('0xa')](),controller[_0x744e('0xe')]);router[_0x744e('0xf')]('/',auth[_0x744e('0xa')](),controller[_0x744e('0x10')]);router[_0x744e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x744e('0x12')]);router[_0x744e('0x13')](_0x744e('0x14'),auth[_0x744e('0xa')](),controller[_0x744e('0x15')]);module[_0x744e('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 47e280d..a7248a4 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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x1620ba,_0x58eaf8){_0x1620ba=_0x1620ba-0x0;var _0x5b8242=_0x7a54[_0x1620ba];return _0x5b8242;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x204b61,_0x553a9c){_0x204b61=_0x204b61-0x0;var _0x3c9de0=_0x7a54[_0x204b61];return _0x3c9de0;};'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 b29486d..cff16fa 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 _0xf6b3=['include','findAll','rows','catch','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','update','then','destroy','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','map','options','includeAll'];(function(_0x8aec58,_0x15c1ba){var _0x292b83=function(_0x153443){while(--_0x153443){_0x8aec58['push'](_0x8aec58['shift']());}};_0x292b83(++_0x15c1ba);}(_0xf6b3,0xe8));var _0x3f6b=function(_0x1e87df,_0x56250a){_0x1e87df=_0x1e87df-0x0;var _0x4295cc=_0xf6b3[_0x1e87df];return _0x4295cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f6b('0x0'));var zipdir=require(_0x3f6b('0x1'));var jsonpatch=require(_0x3f6b('0x2'));var rp=require(_0x3f6b('0x3'));var moment=require(_0x3f6b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f6b('0x5'));var util=require(_0x3f6b('0x6'));var path=require(_0x3f6b('0x7'));var sox=require(_0x3f6b('0x8'));var csv=require('to-csv');var ejs=require(_0x3f6b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f6b('0xa'));var squel=require(_0x3f6b('0xb'));var crypto=require(_0x3f6b('0xc'));var jsforce=require(_0x3f6b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3f6b('0xe'));var querystring=require(_0x3f6b('0xf'));var Papa=require('papaparse');var Redis=require(_0x3f6b('0x10'));var authService=require(_0x3f6b('0x11'));var qs=require(_0x3f6b('0x12'));var as=require(_0x3f6b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f6b('0x14'))(_0x3f6b('0x15'));var utils=require(_0x3f6b('0x16'));var config=require(_0x3f6b('0x17'));var licenseUtil=require(_0x3f6b('0x18'));var db=require(_0x3f6b('0x19'))['db'];function respondWithStatusCode(_0x45909e,_0x18f966){_0x18f966=_0x18f966||0xcc;return function(_0x3b8fed){if(_0x3b8fed){return _0x45909e[_0x3f6b('0x1a')](_0x18f966);}return _0x45909e[_0x3f6b('0x1b')](_0x18f966)[_0x3f6b('0x1c')]();};}function respondWithResult(_0x51e782,_0x541951){_0x541951=_0x541951||0xc8;return function(_0x1473b8){if(_0x1473b8){return _0x51e782[_0x3f6b('0x1b')](_0x541951)[_0x3f6b('0x1d')](_0x1473b8);}};}function respondWithFilteredResult(_0x582713,_0x21c94){return function(_0x236e74){if(_0x236e74){var _0x458422=typeof _0x21c94[_0x3f6b('0x1e')]==='undefined'&&typeof _0x21c94[_0x3f6b('0x1f')]===_0x3f6b('0x20');var _0x160eb0=_0x236e74[_0x3f6b('0x21')];var _0x14fc05=_0x458422?0x0:_0x21c94[_0x3f6b('0x1e')];var _0x4a4959=_0x458422?_0x236e74[_0x3f6b('0x21')]:_0x21c94['offset']+_0x21c94[_0x3f6b('0x1f')];var _0x11ea61;if(_0x4a4959>=_0x160eb0){_0x4a4959=_0x160eb0;_0x11ea61=0xc8;}else{_0x11ea61=0xce;}_0x582713[_0x3f6b('0x1b')](_0x11ea61);return _0x582713['set']('Content-Range',_0x14fc05+'-'+_0x4a4959+'/'+_0x160eb0)[_0x3f6b('0x1d')](_0x236e74);}return null;};}function patchUpdates(_0x11af4c){return function(_0x59b789){try{jsonpatch[_0x3f6b('0x22')](_0x59b789,_0x11af4c,!![]);}catch(_0x1c882c){return BPromise[_0x3f6b('0x23')](_0x1c882c);}return _0x59b789['save']();};}function saveUpdates(_0x51e77f,_0x5562b7){return function(_0x167bf4){if(_0x167bf4){return _0x167bf4[_0x3f6b('0x24')](_0x51e77f)[_0x3f6b('0x25')](function(_0x4b66c2){return _0x4b66c2;});}return null;};}function removeEntity(_0x25414e,_0x2f8b98){return function(_0x4ed306){if(_0x4ed306){return _0x4ed306[_0x3f6b('0x26')]()['then'](function(){_0x25414e[_0x3f6b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2945db,_0x331d2c){return function(_0x2dd748){if(!_0x2dd748){_0x2945db[_0x3f6b('0x1a')](0x194);}return _0x2dd748;};}function handleError(_0x462048,_0x58481c){_0x58481c=_0x58481c||0x1f4;return function(_0xa3ec9){logger['error'](_0xa3ec9[_0x3f6b('0x27')]);if(_0xa3ec9[_0x3f6b('0x28')]){delete _0xa3ec9[_0x3f6b('0x28')];}_0x462048['status'](_0x58481c)[_0x3f6b('0x29')](_0xa3ec9);};}exports[_0x3f6b('0x2a')]=function(_0xca4c6f,_0x9930df){var _0x323800={},_0x3b48a6={},_0x488bed={'count':0x0,'rows':[]};var _0x2c4a16=_['map'](db[_0x3f6b('0x2b')][_0x3f6b('0x2c')],function(_0x24450f){return{'name':_0x24450f[_0x3f6b('0x2d')],'type':_0x24450f[_0x3f6b('0x2e')][_0x3f6b('0x2f')]};});_0x3b48a6[_0x3f6b('0x30')]=_['map'](_0x2c4a16,_0x3f6b('0x28'));_0x3b48a6['query']=_[_0x3f6b('0x31')](_0xca4c6f[_0x3f6b('0x32')]);_0x3b48a6[_0x3f6b('0x33')]=_[_0x3f6b('0x34')](_0x3b48a6[_0x3f6b('0x30')],_0x3b48a6[_0x3f6b('0x32')]);_0x323800['attributes']=_['intersection'](_0x3b48a6[_0x3f6b('0x30')],qs['fields'](_0xca4c6f[_0x3f6b('0x32')][_0x3f6b('0x35')]));_0x323800[_0x3f6b('0x36')]=_0x323800[_0x3f6b('0x36')]['length']?_0x323800[_0x3f6b('0x36')]:_0x3b48a6[_0x3f6b('0x30')];if(!_0xca4c6f[_0x3f6b('0x32')][_0x3f6b('0x37')]('nolimit')){_0x323800['limit']=qs[_0x3f6b('0x1f')](_0xca4c6f[_0x3f6b('0x32')][_0x3f6b('0x1f')]);_0x323800[_0x3f6b('0x1e')]=qs[_0x3f6b('0x1e')](_0xca4c6f['query']['offset']);}_0x323800['order']=qs[_0x3f6b('0x38')](_0xca4c6f['query'][_0x3f6b('0x38')]);_0x323800[_0x3f6b('0x39')]=qs[_0x3f6b('0x33')](_[_0x3f6b('0x3a')](_0xca4c6f[_0x3f6b('0x32')],_0x3b48a6['filters']),_0x2c4a16);if(_0xca4c6f[_0x3f6b('0x32')][_0x3f6b('0x3b')]){_0x323800['where']=_[_0x3f6b('0x3c')](_0x323800[_0x3f6b('0x39')],{'$or':_[_0x3f6b('0x3d')](_0x2c4a16,function(_0x101d8d){if(_0x101d8d[_0x3f6b('0x2e')]!=='VIRTUAL'){var _0x8ea4f3={};_0x8ea4f3[_0x101d8d['name']]={'$like':'%'+_0xca4c6f['query'][_0x3f6b('0x3b')]+'%'};return _0x8ea4f3;}})});}_0x323800=_[_0x3f6b('0x3c')]({},_0x323800,_0xca4c6f[_0x3f6b('0x3e')]);var _0x3a46ea={'where':_0x323800[_0x3f6b('0x39')]};return db[_0x3f6b('0x2b')]['count'](_0x3a46ea)[_0x3f6b('0x25')](function(_0x4fc587){_0x488bed[_0x3f6b('0x21')]=_0x4fc587;if(_0xca4c6f[_0x3f6b('0x32')][_0x3f6b('0x3f')]){_0x323800[_0x3f6b('0x40')]=[{'all':!![]}];}return db[_0x3f6b('0x2b')][_0x3f6b('0x41')](_0x323800);})[_0x3f6b('0x25')](function(_0x3be210){_0x488bed[_0x3f6b('0x42')]=_0x3be210;return _0x488bed;})['then'](respondWithFilteredResult(_0x9930df,_0x323800))[_0x3f6b('0x43')](handleError(_0x9930df,null));};exports['show']=function(_0x54262c,_0x349a9c){var _0x4bbf89={'raw':!![],'where':{'id':_0x54262c[_0x3f6b('0x44')]['id']}},_0x592e35={};_0x592e35[_0x3f6b('0x30')]=_[_0x3f6b('0x31')](db[_0x3f6b('0x2b')][_0x3f6b('0x2c')]);_0x592e35[_0x3f6b('0x32')]=_[_0x3f6b('0x31')](_0x54262c[_0x3f6b('0x32')]);_0x592e35[_0x3f6b('0x33')]=_[_0x3f6b('0x34')](_0x592e35[_0x3f6b('0x30')],_0x592e35[_0x3f6b('0x32')]);_0x4bbf89['attributes']=_[_0x3f6b('0x34')](_0x592e35['model'],qs[_0x3f6b('0x35')](_0x54262c[_0x3f6b('0x32')][_0x3f6b('0x35')]));_0x4bbf89['attributes']=_0x4bbf89[_0x3f6b('0x36')][_0x3f6b('0x45')]?_0x4bbf89[_0x3f6b('0x36')]:_0x592e35[_0x3f6b('0x30')];if(_0x54262c[_0x3f6b('0x32')][_0x3f6b('0x3f')]){_0x4bbf89[_0x3f6b('0x40')]=[{'all':!![]}];}_0x4bbf89=_[_0x3f6b('0x3c')]({},_0x4bbf89,_0x54262c['options']);return db[_0x3f6b('0x2b')][_0x3f6b('0x46')](_0x4bbf89)[_0x3f6b('0x25')](handleEntityNotFound(_0x349a9c,null))['then'](respondWithResult(_0x349a9c,null))[_0x3f6b('0x43')](handleError(_0x349a9c,null));};exports[_0x3f6b('0x47')]=function(_0x3e58b2,_0x5552a7){return db[_0x3f6b('0x2b')][_0x3f6b('0x47')](_0x3e58b2[_0x3f6b('0x48')],{})[_0x3f6b('0x25')](respondWithResult(_0x5552a7,0xc9))[_0x3f6b('0x43')](handleError(_0x5552a7,null));};exports['update']=function(_0x4bd666,_0x2a8395){if(_0x4bd666[_0x3f6b('0x48')]['id']){delete _0x4bd666['body']['id'];}return db[_0x3f6b('0x2b')][_0x3f6b('0x46')]({'where':{'id':_0x4bd666[_0x3f6b('0x44')]['id']}})[_0x3f6b('0x25')](handleEntityNotFound(_0x2a8395,null))[_0x3f6b('0x25')](saveUpdates(_0x4bd666[_0x3f6b('0x48')],null))['then'](respondWithResult(_0x2a8395,null))[_0x3f6b('0x43')](handleError(_0x2a8395,null));};exports[_0x3f6b('0x26')]=function(_0x2c1344,_0x11ab84){return db[_0x3f6b('0x2b')][_0x3f6b('0x46')]({'where':{'id':_0x2c1344['params']['id']}})['then'](handleEntityNotFound(_0x11ab84,null))[_0x3f6b('0x25')](removeEntity(_0x11ab84,null))['catch'](handleError(_0x11ab84,null));};exports[_0x3f6b('0x49')]=function(_0x50b4e6,_0x3a07f7){return db[_0x3f6b('0x2b')][_0x3f6b('0x49')]()[_0x3f6b('0x25')](respondWithResult(_0x3a07f7,null))['catch'](handleError(_0x3a07f7,null));}; \ No newline at end of file +var _0xcd3f=['crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x1f7996,_0x299a14){var _0x584609=function(_0x14c34a){while(--_0x14c34a){_0x1f7996['push'](_0x1f7996['shift']());}};_0x584609(++_0x299a14);}(_0xcd3f,0x1d8));var _0xfcd3=function(_0x3e4285,_0x83a4f0){_0x3e4285=_0x3e4285-0x0;var _0xce09e7=_0xcd3f[_0x3e4285];return _0xce09e7;};'use strict';var emlformat=require(_0xfcd3('0x0'));var rimraf=require(_0xfcd3('0x1'));var zipdir=require(_0xfcd3('0x2'));var jsonpatch=require(_0xfcd3('0x3'));var rp=require(_0xfcd3('0x4'));var moment=require(_0xfcd3('0x5'));var BPromise=require(_0xfcd3('0x6'));var Mustache=require(_0xfcd3('0x7'));var util=require(_0xfcd3('0x8'));var path=require(_0xfcd3('0x9'));var sox=require(_0xfcd3('0xa'));var csv=require(_0xfcd3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcd3('0xc'));var squel=require(_0xfcd3('0xd'));var crypto=require(_0xfcd3('0xe'));var jsforce=require(_0xfcd3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfcd3('0xb'));var querystring=require(_0xfcd3('0x10'));var Papa=require(_0xfcd3('0x11'));var Redis=require(_0xfcd3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfcd3('0x13'));var as=require(_0xfcd3('0x14'));var hardwareService=require(_0xfcd3('0x15'));var logger=require(_0xfcd3('0x16'))(_0xfcd3('0x17'));var utils=require(_0xfcd3('0x18'));var config=require(_0xfcd3('0x19'));var licenseUtil=require(_0xfcd3('0x1a'));var db=require(_0xfcd3('0x1b'))['db'];function respondWithStatusCode(_0x2f30c7,_0x40a2df){_0x40a2df=_0x40a2df||0xcc;return function(_0x1829b1){if(_0x1829b1){return _0x2f30c7[_0xfcd3('0x1c')](_0x40a2df);}return _0x2f30c7[_0xfcd3('0x1d')](_0x40a2df)[_0xfcd3('0x1e')]();};}function respondWithResult(_0x30859e,_0x5be53d){_0x5be53d=_0x5be53d||0xc8;return function(_0x3243ac){if(_0x3243ac){return _0x30859e[_0xfcd3('0x1d')](_0x5be53d)[_0xfcd3('0x1f')](_0x3243ac);}};}function respondWithFilteredResult(_0x1e08d0,_0x3f7f7c){return function(_0x2be777){if(_0x2be777){var _0x54f11a=typeof _0x3f7f7c[_0xfcd3('0x20')]===_0xfcd3('0x21')&&typeof _0x3f7f7c[_0xfcd3('0x22')]===_0xfcd3('0x21');var _0x304ac0=_0x2be777[_0xfcd3('0x23')];var _0xf67e15=_0x54f11a?0x0:_0x3f7f7c[_0xfcd3('0x20')];var _0x38c82c=_0x54f11a?_0x2be777[_0xfcd3('0x23')]:_0x3f7f7c[_0xfcd3('0x20')]+_0x3f7f7c[_0xfcd3('0x22')];var _0x414db4;if(_0x38c82c>=_0x304ac0){_0x38c82c=_0x304ac0;_0x414db4=0xc8;}else{_0x414db4=0xce;}_0x1e08d0['status'](_0x414db4);return _0x1e08d0[_0xfcd3('0x24')]('Content-Range',_0xf67e15+'-'+_0x38c82c+'/'+_0x304ac0)[_0xfcd3('0x1f')](_0x2be777);}return null;};}function patchUpdates(_0x56277d){return function(_0x1f7977){try{jsonpatch[_0xfcd3('0x25')](_0x1f7977,_0x56277d,!![]);}catch(_0x49d42c){return BPromise[_0xfcd3('0x26')](_0x49d42c);}return _0x1f7977[_0xfcd3('0x27')]();};}function saveUpdates(_0x4bcc42,_0x3ef464){return function(_0x893ce7){if(_0x893ce7){return _0x893ce7[_0xfcd3('0x28')](_0x4bcc42)[_0xfcd3('0x29')](function(_0x203b0f){return _0x203b0f;});}return null;};}function removeEntity(_0x4d6949,_0xca66f){return function(_0x47ab2b){if(_0x47ab2b){return _0x47ab2b[_0xfcd3('0x2a')]()[_0xfcd3('0x29')](function(){_0x4d6949[_0xfcd3('0x1d')](0xcc)[_0xfcd3('0x1e')]();});}};}function handleEntityNotFound(_0x5cdbc9,_0x10148f){return function(_0x4d0ce5){if(!_0x4d0ce5){_0x5cdbc9[_0xfcd3('0x1c')](0x194);}return _0x4d0ce5;};}function handleError(_0x4e7a7a,_0x1ace07){_0x1ace07=_0x1ace07||0x1f4;return function(_0xa28870){logger['error'](_0xa28870[_0xfcd3('0x2b')]);if(_0xa28870[_0xfcd3('0x2c')]){delete _0xa28870[_0xfcd3('0x2c')];}_0x4e7a7a[_0xfcd3('0x1d')](_0x1ace07)[_0xfcd3('0x2d')](_0xa28870);};}exports[_0xfcd3('0x2e')]=function(_0x36c87f,_0xc6b471){var _0x93efa5={},_0x1b7091={},_0x29b8d2={'count':0x0,'rows':[]};var _0x2c565d=_[_0xfcd3('0x2f')](db[_0xfcd3('0x30')][_0xfcd3('0x31')],function(_0x5071e2){return{'name':_0x5071e2['fieldName'],'type':_0x5071e2[_0xfcd3('0x32')][_0xfcd3('0x33')]};});_0x1b7091[_0xfcd3('0x34')]=_[_0xfcd3('0x2f')](_0x2c565d,_0xfcd3('0x2c'));_0x1b7091[_0xfcd3('0x35')]=_[_0xfcd3('0x36')](_0x36c87f['query']);_0x1b7091[_0xfcd3('0x37')]=_[_0xfcd3('0x38')](_0x1b7091[_0xfcd3('0x34')],_0x1b7091['query']);_0x93efa5['attributes']=_[_0xfcd3('0x38')](_0x1b7091[_0xfcd3('0x34')],qs[_0xfcd3('0x39')](_0x36c87f[_0xfcd3('0x35')]['fields']));_0x93efa5[_0xfcd3('0x3a')]=_0x93efa5['attributes'][_0xfcd3('0x3b')]?_0x93efa5[_0xfcd3('0x3a')]:_0x1b7091[_0xfcd3('0x34')];if(!_0x36c87f[_0xfcd3('0x35')][_0xfcd3('0x3c')](_0xfcd3('0x3d'))){_0x93efa5[_0xfcd3('0x22')]=qs[_0xfcd3('0x22')](_0x36c87f['query']['limit']);_0x93efa5[_0xfcd3('0x20')]=qs[_0xfcd3('0x20')](_0x36c87f[_0xfcd3('0x35')][_0xfcd3('0x20')]);}_0x93efa5[_0xfcd3('0x3e')]=qs[_0xfcd3('0x3f')](_0x36c87f[_0xfcd3('0x35')][_0xfcd3('0x3f')]);_0x93efa5[_0xfcd3('0x40')]=qs[_0xfcd3('0x37')](_[_0xfcd3('0x41')](_0x36c87f['query'],_0x1b7091[_0xfcd3('0x37')]),_0x2c565d);if(_0x36c87f[_0xfcd3('0x35')]['filter']){_0x93efa5[_0xfcd3('0x40')]=_[_0xfcd3('0x42')](_0x93efa5[_0xfcd3('0x40')],{'$or':_[_0xfcd3('0x2f')](_0x2c565d,function(_0x4217ae){if(_0x4217ae[_0xfcd3('0x32')]!==_0xfcd3('0x43')){var _0x242c14={};_0x242c14[_0x4217ae[_0xfcd3('0x2c')]]={'$like':'%'+_0x36c87f[_0xfcd3('0x35')][_0xfcd3('0x44')]+'%'};return _0x242c14;}})});}_0x93efa5=_[_0xfcd3('0x42')]({},_0x93efa5,_0x36c87f[_0xfcd3('0x45')]);var _0x2b9447={'where':_0x93efa5['where']};return db[_0xfcd3('0x30')][_0xfcd3('0x23')](_0x2b9447)['then'](function(_0x472085){_0x29b8d2[_0xfcd3('0x23')]=_0x472085;if(_0x36c87f[_0xfcd3('0x35')]['includeAll']){_0x93efa5[_0xfcd3('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xfcd3('0x47')](_0x93efa5);})[_0xfcd3('0x29')](function(_0x478f90){_0x29b8d2[_0xfcd3('0x48')]=_0x478f90;return _0x29b8d2;})[_0xfcd3('0x29')](respondWithFilteredResult(_0xc6b471,_0x93efa5))[_0xfcd3('0x49')](handleError(_0xc6b471,null));};exports[_0xfcd3('0x4a')]=function(_0x40d8cd,_0x3f6f73){var _0x4fcb77={'raw':!![],'where':{'id':_0x40d8cd[_0xfcd3('0x4b')]['id']}},_0x478c0c={};_0x478c0c[_0xfcd3('0x34')]=_[_0xfcd3('0x36')](db[_0xfcd3('0x30')]['rawAttributes']);_0x478c0c[_0xfcd3('0x35')]=_['keys'](_0x40d8cd[_0xfcd3('0x35')]);_0x478c0c[_0xfcd3('0x37')]=_[_0xfcd3('0x38')](_0x478c0c['model'],_0x478c0c[_0xfcd3('0x35')]);_0x4fcb77[_0xfcd3('0x3a')]=_[_0xfcd3('0x38')](_0x478c0c['model'],qs[_0xfcd3('0x39')](_0x40d8cd[_0xfcd3('0x35')][_0xfcd3('0x39')]));_0x4fcb77[_0xfcd3('0x3a')]=_0x4fcb77[_0xfcd3('0x3a')][_0xfcd3('0x3b')]?_0x4fcb77[_0xfcd3('0x3a')]:_0x478c0c[_0xfcd3('0x34')];if(_0x40d8cd['query'][_0xfcd3('0x4c')]){_0x4fcb77['include']=[{'all':!![]}];}_0x4fcb77=_[_0xfcd3('0x42')]({},_0x4fcb77,_0x40d8cd[_0xfcd3('0x45')]);return db['JscriptyQuestionReport'][_0xfcd3('0x4d')](_0x4fcb77)[_0xfcd3('0x29')](handleEntityNotFound(_0x3f6f73,null))[_0xfcd3('0x29')](respondWithResult(_0x3f6f73,null))[_0xfcd3('0x49')](handleError(_0x3f6f73,null));};exports[_0xfcd3('0x4e')]=function(_0x38cfa7,_0x4b09a7){return db[_0xfcd3('0x30')][_0xfcd3('0x4e')](_0x38cfa7[_0xfcd3('0x4f')],{})[_0xfcd3('0x29')](respondWithResult(_0x4b09a7,0xc9))['catch'](handleError(_0x4b09a7,null));};exports[_0xfcd3('0x28')]=function(_0x529e09,_0x3fc2ac){if(_0x529e09[_0xfcd3('0x4f')]['id']){delete _0x529e09['body']['id'];}return db[_0xfcd3('0x30')][_0xfcd3('0x4d')]({'where':{'id':_0x529e09[_0xfcd3('0x4b')]['id']}})[_0xfcd3('0x29')](handleEntityNotFound(_0x3fc2ac,null))[_0xfcd3('0x29')](saveUpdates(_0x529e09[_0xfcd3('0x4f')],null))[_0xfcd3('0x29')](respondWithResult(_0x3fc2ac,null))[_0xfcd3('0x49')](handleError(_0x3fc2ac,null));};exports[_0xfcd3('0x2a')]=function(_0x5821c4,_0x17ef19){return db[_0xfcd3('0x30')][_0xfcd3('0x4d')]({'where':{'id':_0x5821c4['params']['id']}})[_0xfcd3('0x29')](handleEntityNotFound(_0x17ef19,null))[_0xfcd3('0x29')](removeEntity(_0x17ef19,null))['catch'](handleError(_0x17ef19,null));};exports[_0xfcd3('0x50')]=function(_0x757cfb,_0x5a74ed){return db[_0xfcd3('0x30')][_0xfcd3('0x50')]()[_0xfcd3('0x29')](respondWithResult(_0x5a74ed,null))[_0xfcd3('0x49')](handleError(_0x5a74ed,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 3794bf7..f268dea 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 _0xd734=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_jscripty_questions','lodash','util'];(function(_0x22bd07,_0xf52ab3){var _0x3c0078=function(_0x439507){while(--_0x439507){_0x22bd07['push'](_0x22bd07['shift']());}};_0x3c0078(++_0xf52ab3);}(_0xd734,0x106));var _0x4d73=function(_0x20710d,_0x4372ea){_0x20710d=_0x20710d-0x0;var _0x4e4b6f=_0xd734[_0x20710d];return _0x4e4b6f;};'use strict';var _=require(_0x4d73('0x0'));var util=require(_0x4d73('0x1'));var logger=require(_0x4d73('0x2'))(_0x4d73('0x3'));var moment=require(_0x4d73('0x4'));var BPromise=require(_0x4d73('0x5'));var rp=require(_0x4d73('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d73('0x7'));var config=require(_0x4d73('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x4d73('0x9')]=function(_0xe0ca99,_0x31ba2a){return _0xe0ca99[_0x4d73('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x4d73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x701e=['report_jscripty_questions','lodash','util','moment','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','define'];(function(_0x58a9e3,_0x35e286){var _0x2e66bb=function(_0x5cf547){while(--_0x5cf547){_0x58a9e3['push'](_0x58a9e3['shift']());}};_0x2e66bb(++_0x35e286);}(_0x701e,0x1b1));var _0xe701=function(_0x808af1,_0x4cc03a){_0x808af1=_0x808af1-0x0;var _0x3965ca=_0x701e[_0x808af1];return _0x3965ca;};'use strict';var _=require(_0xe701('0x0'));var util=require(_0xe701('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe701('0x2'));var BPromise=require('bluebird');var rp=require(_0xe701('0x3'));var fs=require('fs');var path=require(_0xe701('0x4'));var rimraf=require(_0xe701('0x5'));var config=require('../../config/environment');var attributes=require(_0xe701('0x6'));module['exports']=function(_0xee5985,_0x43fc91){return _0xee5985[_0xe701('0x7')]('JscriptyQuestionReport',attributes,{'tableName':_0xe701('0x8'),'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 fc4d3b8..11fba58 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 _0x5707=['error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x34a94c,_0x18a21c){var _0x1f11a2=function(_0x281fdd){while(--_0x281fdd){_0x34a94c['push'](_0x34a94c['shift']());}};_0x1f11a2(++_0x18a21c);}(_0x5707,0xb4));var _0x7570=function(_0x4970d6,_0x2e6b07){_0x4970d6=_0x4970d6-0x0;var _0x2857f3=_0x5707[_0x4970d6];return _0x2857f3;};'use strict';var _=require('lodash');var util=require(_0x7570('0x0'));var moment=require(_0x7570('0x1'));var BPromise=require(_0x7570('0x2'));var rs=require(_0x7570('0x3'));var fs=require('fs');var Redis=require(_0x7570('0x4'));var db=require(_0x7570('0x5'))['db'];var utils=require(_0x7570('0x6'));var logger=require(_0x7570('0x7'))(_0x7570('0x8'));var config=require(_0x7570('0x9'));var jayson=require(_0x7570('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x117ee6,_0x59fbe2,_0x3abdb6){return new BPromise(function(_0x28ba87,_0xd8f31e){return client[_0x7570('0xb')](_0x117ee6,_0x3abdb6)['then'](function(_0x343252){logger[_0x7570('0xc')](_0x7570('0xd'),_0x59fbe2,_0x7570('0xe'));logger[_0x7570('0xf')](_0x7570('0x10'),_0x59fbe2,_0x7570('0xe'),JSON[_0x7570('0x11')](_0x343252));if(_0x343252[_0x7570('0x12')]){if(_0x343252[_0x7570('0x12')]['code']===0x1f4){logger[_0x7570('0x12')](_0x7570('0xd'),_0x59fbe2,_0x343252[_0x7570('0x12')][_0x7570('0x13')]);return _0xd8f31e(_0x343252[_0x7570('0x12')][_0x7570('0x13')]);}logger['error'](_0x7570('0xd'),_0x59fbe2,_0x343252[_0x7570('0x12')][_0x7570('0x13')]);return _0x28ba87(_0x343252[_0x7570('0x12')]['message']);}else{logger[_0x7570('0xc')](_0x7570('0xd'),_0x59fbe2,_0x7570('0xe'));_0x28ba87(_0x343252[_0x7570('0x14')][_0x7570('0x13')]);}})[_0x7570('0x15')](function(_0x1fb327){logger[_0x7570('0x12')](_0x7570('0xd'),_0x59fbe2,_0x1fb327);_0xd8f31e(_0x1fb327);});});} \ No newline at end of file +var _0xf531=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x108895,_0x2eac10){var _0x5a4393=function(_0xccdc56){while(--_0xccdc56){_0x108895['push'](_0x108895['shift']());}};_0x5a4393(++_0x2eac10);}(_0xf531,0x1ee));var _0x1f53=function(_0x49ebed,_0x2ed245){_0x49ebed=_0x49ebed-0x0;var _0x247194=_0xf531[_0x49ebed];return _0x247194;};'use strict';var _=require(_0x1f53('0x0'));var util=require(_0x1f53('0x1'));var moment=require(_0x1f53('0x2'));var BPromise=require(_0x1f53('0x3'));var rs=require(_0x1f53('0x4'));var fs=require('fs');var Redis=require(_0x1f53('0x5'));var db=require(_0x1f53('0x6'))['db'];var utils=require(_0x1f53('0x7'));var logger=require(_0x1f53('0x8'))('rpc');var config=require(_0x1f53('0x9'));var jayson=require(_0x1f53('0xa'));var client=jayson[_0x1f53('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12316d,_0x29cadb,_0x15e43e){return new BPromise(function(_0x40188d,_0x105f79){return client[_0x1f53('0xc')](_0x12316d,_0x15e43e)[_0x1f53('0xd')](function(_0x43b5a8){logger[_0x1f53('0xe')](_0x1f53('0xf'),_0x29cadb,_0x1f53('0x10'));logger[_0x1f53('0x11')](_0x1f53('0x12'),_0x29cadb,'request\x20sent',JSON[_0x1f53('0x13')](_0x43b5a8));if(_0x43b5a8[_0x1f53('0x14')]){if(_0x43b5a8[_0x1f53('0x14')][_0x1f53('0x15')]===0x1f4){logger[_0x1f53('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x29cadb,_0x43b5a8[_0x1f53('0x14')][_0x1f53('0x16')]);return _0x105f79(_0x43b5a8['error']['message']);}logger[_0x1f53('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x29cadb,_0x43b5a8[_0x1f53('0x14')]['message']);return _0x40188d(_0x43b5a8['error'][_0x1f53('0x16')]);}else{logger[_0x1f53('0xe')](_0x1f53('0xf'),_0x29cadb,_0x1f53('0x10'));_0x40188d(_0x43b5a8[_0x1f53('0x17')][_0x1f53('0x16')]);}})[_0x1f53('0x18')](function(_0x1c89e6){logger[_0x1f53('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x29cadb,_0x1c89e6);_0x105f79(_0x1c89e6);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index fd8d7e8..408b133 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 _0x5648=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','/:id/questions','create','update','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x195830,_0x519a07){var _0x59cf09=function(_0x10566a){while(--_0x10566a){_0x195830['push'](_0x195830['shift']());}};_0x59cf09(++_0x519a07);}(_0x5648,0x189));var _0x8564=function(_0x3c808a,_0x4c3d4e){_0x3c808a=_0x3c808a-0x0;var _0x48caee=_0x5648[_0x3c808a];return _0x48caee;};'use strict';var multer=require(_0x8564('0x0'));var util=require(_0x8564('0x1'));var path=require(_0x8564('0x2'));var timeout=require(_0x8564('0x3'));var express=require('express');var router=express[_0x8564('0x4')]();var fs_extra=require(_0x8564('0x5'));var auth=require(_0x8564('0x6'));var interaction=require(_0x8564('0x7'));var config=require(_0x8564('0x8'));var controller=require(_0x8564('0x9'));router[_0x8564('0xa')]('/',auth[_0x8564('0xb')](),controller['index']);router['get'](_0x8564('0xc'),auth[_0x8564('0xb')](),controller[_0x8564('0xd')]);router['get'](_0x8564('0xe'),auth[_0x8564('0xb')](),controller['show']);router['get'](_0x8564('0xf'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth[_0x8564('0xb')](),controller[_0x8564('0x10')]);router['put']('/:id',auth[_0x8564('0xb')](),controller[_0x8564('0x11')]);router['delete']('/:id',auth[_0x8564('0xb')](),controller['destroy']);module[_0x8564('0x12')]=router; \ No newline at end of file +var _0xb826=['path','connect-timeout','express','Router','../../components/auth/service','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','post','create','put','delete','destroy','exports','multer'];(function(_0x36ad59,_0x434433){var _0x5529c4=function(_0x242363){while(--_0x242363){_0x36ad59['push'](_0x36ad59['shift']());}};_0x5529c4(++_0x434433);}(_0xb826,0xbc));var _0x6b82=function(_0x2f4287,_0x535be2){_0x2f4287=_0x2f4287-0x0;var _0x3ecb19=_0xb826[_0x2f4287];return _0x3ecb19;};'use strict';var multer=require(_0x6b82('0x0'));var util=require('util');var path=require(_0x6b82('0x1'));var timeout=require(_0x6b82('0x2'));var express=require(_0x6b82('0x3'));var router=express[_0x6b82('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6b82('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6b82('0x6')]);router[_0x6b82('0x7')](_0x6b82('0x8'),auth['isAuthenticated'](),controller[_0x6b82('0x9')]);router[_0x6b82('0x7')](_0x6b82('0xa'),auth[_0x6b82('0xb')](),controller[_0x6b82('0xc')]);router[_0x6b82('0x7')](_0x6b82('0xd'),auth[_0x6b82('0xb')](),controller[_0x6b82('0xe')]);router[_0x6b82('0xf')]('/',auth[_0x6b82('0xb')](),controller[_0x6b82('0x10')]);router[_0x6b82('0x11')](_0x6b82('0xa'),auth[_0x6b82('0xb')](),controller['update']);router[_0x6b82('0x12')](_0x6b82('0xa'),auth['isAuthenticated'](),controller[_0x6b82('0x13')]);module[_0x6b82('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 5076ff6..740a835 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 _0x01a7=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','DATE','setDataValue'];(function(_0x20c7f9,_0x1460d5){var _0x304481=function(_0xbe8099){while(--_0xbe8099){_0x20c7f9['push'](_0x20c7f9['shift']());}};_0x304481(++_0x1460d5);}(_0x01a7,0x17e));var _0x701a=function(_0x22df9f,_0x9ec477){_0x22df9f=_0x22df9f-0x0;var _0x4ed906=_0x01a7[_0x22df9f];return _0x4ed906;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x701a('0x0')],'set':function(_0x1b9e8d){this['setDataValue']('starttime',_0x1b9e8d);this[_0x701a('0x1')](_0x701a('0x2'),moment()[_0x701a('0x3')](_0x701a('0x4')));}},'endtime':{'type':Sequelize[_0x701a('0x0')]},'membername':{'type':Sequelize[_0x701a('0x5')]},'projectname':{'type':Sequelize[_0x701a('0x5')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x701a('0x5')]},'calleridname':{'type':Sequelize[_0x701a('0x5')]},'calleridnum':{'type':Sequelize[_0x701a('0x5')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2646=['starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE','setDataValue'];(function(_0x183608,_0x3302fd){var _0x292e43=function(_0x16adab){while(--_0x16adab){_0x183608['push'](_0x183608['shift']());}};_0x292e43(++_0x3302fd);}(_0x2646,0xee));var _0x6264=function(_0x10bd3d,_0x478dfb){_0x10bd3d=_0x10bd3d-0x0;var _0x48d6fd=_0x2646[_0x10bd3d];return _0x48d6fd;};'use strict';var moment=require(_0x6264('0x0'));var Sequelize=require(_0x6264('0x1'));module[_0x6264('0x2')]={'starttime':{'type':Sequelize[_0x6264('0x3')],'set':function(_0x487dbf){this[_0x6264('0x4')](_0x6264('0x5'),_0x487dbf);this[_0x6264('0x4')](_0x6264('0x6'),moment()['format'](_0x6264('0x7')));}},'endtime':{'type':Sequelize[_0x6264('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6264('0x8')]},'uniqueid':{'type':Sequelize[_0x6264('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6264('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 760b7a4..53ec743 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 _0x1be8=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','show','params','find','create','body','catch','update','describe','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x1be8,0x132));var _0x81be=function(_0x139ff6,_0xddca5){_0x139ff6=_0x139ff6-0x0;var _0x71b083=_0x1be8[_0x139ff6];return _0x71b083;};'use strict';var emlformat=require(_0x81be('0x0'));var rimraf=require(_0x81be('0x1'));var zipdir=require(_0x81be('0x2'));var jsonpatch=require(_0x81be('0x3'));var rp=require(_0x81be('0x4'));var moment=require(_0x81be('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x81be('0x6'));var util=require('util');var path=require(_0x81be('0x7'));var sox=require(_0x81be('0x8'));var csv=require(_0x81be('0x9'));var ejs=require(_0x81be('0xa'));var fs=require('fs');var fs_extra=require(_0x81be('0xb'));var _=require(_0x81be('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x81be('0xd'));var deskjs=require(_0x81be('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x81be('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x81be('0x10'));var as=require(_0x81be('0x11'));var hardwareService=require(_0x81be('0x12'));var logger=require(_0x81be('0x13'))(_0x81be('0x14'));var utils=require(_0x81be('0x15'));var config=require(_0x81be('0x16'));var licenseUtil=require(_0x81be('0x17'));var db=require(_0x81be('0x18'))['db'];function respondWithStatusCode(_0x2ed4e4,_0x77a9c5){_0x77a9c5=_0x77a9c5||0xcc;return function(_0x3d4be7){if(_0x3d4be7){return _0x2ed4e4[_0x81be('0x19')](_0x77a9c5);}return _0x2ed4e4['status'](_0x77a9c5)[_0x81be('0x1a')]();};}function respondWithResult(_0x118ecd,_0x2d5526){_0x2d5526=_0x2d5526||0xc8;return function(_0x272631){if(_0x272631){return _0x118ecd[_0x81be('0x1b')](_0x2d5526)[_0x81be('0x1c')](_0x272631);}};}function respondWithFilteredResult(_0x527057,_0x268060){return function(_0x11bd54){if(_0x11bd54){var _0x426abc=typeof _0x268060[_0x81be('0x1d')]==='undefined'&&typeof _0x268060['limit']===_0x81be('0x1e');var _0x6dd0d=_0x11bd54[_0x81be('0x1f')];var _0x4e4e2d=_0x426abc?0x0:_0x268060['offset'];var _0x2592bb=_0x426abc?_0x11bd54[_0x81be('0x1f')]:_0x268060[_0x81be('0x1d')]+_0x268060[_0x81be('0x20')];var _0x2d8f07;if(_0x2592bb>=_0x6dd0d){_0x2592bb=_0x6dd0d;_0x2d8f07=0xc8;}else{_0x2d8f07=0xce;}_0x527057[_0x81be('0x1b')](_0x2d8f07);return _0x527057[_0x81be('0x21')]('Content-Range',_0x4e4e2d+'-'+_0x2592bb+'/'+_0x6dd0d)[_0x81be('0x1c')](_0x11bd54);}return null;};}function patchUpdates(_0xca56d0){return function(_0xbe7acd){try{jsonpatch['apply'](_0xbe7acd,_0xca56d0,!![]);}catch(_0x375088){return BPromise[_0x81be('0x22')](_0x375088);}return _0xbe7acd['save']();};}function saveUpdates(_0x27324f,_0x509dcb){return function(_0x488935){if(_0x488935){return _0x488935['update'](_0x27324f)[_0x81be('0x23')](function(_0x1ccae5){return _0x1ccae5;});}return null;};}function removeEntity(_0x6f7dca,_0x5db110){return function(_0x1f9224){if(_0x1f9224){return _0x1f9224[_0x81be('0x24')]()['then'](function(){_0x6f7dca['status'](0xcc)[_0x81be('0x1a')]();});}};}function handleEntityNotFound(_0x1ce66e,_0x465d0a){return function(_0x3c3c6c){if(!_0x3c3c6c){_0x1ce66e[_0x81be('0x19')](0x194);}return _0x3c3c6c;};}function handleError(_0x58633f,_0x3c0988){_0x3c0988=_0x3c0988||0x1f4;return function(_0x5c2fa5){logger['error'](_0x5c2fa5[_0x81be('0x25')]);if(_0x5c2fa5[_0x81be('0x26')]){delete _0x5c2fa5['name'];}_0x58633f[_0x81be('0x1b')](_0x3c0988)[_0x81be('0x27')](_0x5c2fa5);};}exports[_0x81be('0x28')]=function(_0x215bde,_0x35af57){var _0x107399={},_0x5482d6={},_0x36b4f8={'count':0x0,'rows':[]};var _0x359a8b=_[_0x81be('0x29')](db['JscriptySessionReport'][_0x81be('0x2a')],function(_0x189f16){return{'name':_0x189f16[_0x81be('0x2b')],'type':_0x189f16[_0x81be('0x2c')][_0x81be('0x2d')]};});_0x5482d6['model']=_[_0x81be('0x29')](_0x359a8b,_0x81be('0x26'));_0x5482d6[_0x81be('0x2e')]=_[_0x81be('0x2f')](_0x215bde[_0x81be('0x2e')]);_0x5482d6[_0x81be('0x30')]=_['intersection'](_0x5482d6['model'],_0x5482d6[_0x81be('0x2e')]);_0x107399[_0x81be('0x31')]=_[_0x81be('0x32')](_0x5482d6['model'],qs[_0x81be('0x33')](_0x215bde['query'][_0x81be('0x33')]));_0x107399[_0x81be('0x31')]=_0x107399[_0x81be('0x31')][_0x81be('0x34')]?_0x107399[_0x81be('0x31')]:_0x5482d6[_0x81be('0x35')];if(!_0x215bde[_0x81be('0x2e')][_0x81be('0x36')]('nolimit')){_0x107399[_0x81be('0x20')]=qs[_0x81be('0x20')](_0x215bde[_0x81be('0x2e')]['limit']);_0x107399['offset']=qs[_0x81be('0x1d')](_0x215bde[_0x81be('0x2e')][_0x81be('0x1d')]);}_0x107399[_0x81be('0x37')]=qs['sort'](_0x215bde[_0x81be('0x2e')][_0x81be('0x38')]);_0x107399[_0x81be('0x39')]=qs[_0x81be('0x30')](_[_0x81be('0x3a')](_0x215bde[_0x81be('0x2e')],_0x5482d6['filters']),_0x359a8b);if(_0x215bde[_0x81be('0x2e')][_0x81be('0x3b')]){_0x107399[_0x81be('0x39')]=_[_0x81be('0x3c')](_0x107399[_0x81be('0x39')],{'$or':_[_0x81be('0x29')](_0x359a8b,function(_0x4423ca){if(_0x4423ca[_0x81be('0x2c')]!==_0x81be('0x3d')){var _0x49ba7a={};_0x49ba7a[_0x4423ca[_0x81be('0x26')]]={'$like':'%'+_0x215bde['query'][_0x81be('0x3b')]+'%'};return _0x49ba7a;}})});}_0x107399=_['merge']({},_0x107399,_0x215bde[_0x81be('0x3e')]);var _0x3c363c={'where':_0x107399[_0x81be('0x39')]};return db[_0x81be('0x3f')][_0x81be('0x1f')](_0x3c363c)['then'](function(_0x206522){_0x36b4f8[_0x81be('0x1f')]=_0x206522;if(_0x215bde['query'][_0x81be('0x40')]){_0x107399[_0x81be('0x41')]=[{'all':!![]}];}return db[_0x81be('0x3f')][_0x81be('0x42')](_0x107399);})[_0x81be('0x23')](function(_0xbc7d20){_0x36b4f8[_0x81be('0x43')]=_0xbc7d20;return _0x36b4f8;})[_0x81be('0x23')](respondWithFilteredResult(_0x35af57,_0x107399))['catch'](handleError(_0x35af57,null));};exports[_0x81be('0x44')]=function(_0x4cfc06,_0xa86100){var _0x3464d0={'raw':!![],'where':{'id':_0x4cfc06[_0x81be('0x45')]['id']}},_0x40aa09={};_0x40aa09['model']=_[_0x81be('0x2f')](db['JscriptySessionReport'][_0x81be('0x2a')]);_0x40aa09[_0x81be('0x2e')]=_[_0x81be('0x2f')](_0x4cfc06[_0x81be('0x2e')]);_0x40aa09[_0x81be('0x30')]=_[_0x81be('0x32')](_0x40aa09[_0x81be('0x35')],_0x40aa09[_0x81be('0x2e')]);_0x3464d0[_0x81be('0x31')]=_[_0x81be('0x32')](_0x40aa09['model'],qs[_0x81be('0x33')](_0x4cfc06[_0x81be('0x2e')][_0x81be('0x33')]));_0x3464d0[_0x81be('0x31')]=_0x3464d0[_0x81be('0x31')]['length']?_0x3464d0[_0x81be('0x31')]:_0x40aa09[_0x81be('0x35')];if(_0x4cfc06[_0x81be('0x2e')][_0x81be('0x40')]){_0x3464d0['include']=[{'all':!![]}];}_0x3464d0=_[_0x81be('0x3c')]({},_0x3464d0,_0x4cfc06[_0x81be('0x3e')]);return db['JscriptySessionReport'][_0x81be('0x46')](_0x3464d0)[_0x81be('0x23')](handleEntityNotFound(_0xa86100,null))['then'](respondWithResult(_0xa86100,null))['catch'](handleError(_0xa86100,null));};exports[_0x81be('0x47')]=function(_0x510109,_0x3b0529){return db[_0x81be('0x3f')][_0x81be('0x47')](_0x510109[_0x81be('0x48')],{})[_0x81be('0x23')](respondWithResult(_0x3b0529,0xc9))[_0x81be('0x49')](handleError(_0x3b0529,null));};exports[_0x81be('0x4a')]=function(_0x794574,_0x238ca2){if(_0x794574['body']['id']){delete _0x794574[_0x81be('0x48')]['id'];}return db[_0x81be('0x3f')]['find']({'where':{'id':_0x794574['params']['id']}})[_0x81be('0x23')](handleEntityNotFound(_0x238ca2,null))[_0x81be('0x23')](saveUpdates(_0x794574[_0x81be('0x48')],null))[_0x81be('0x23')](respondWithResult(_0x238ca2,null))[_0x81be('0x49')](handleError(_0x238ca2,null));};exports[_0x81be('0x24')]=function(_0x3c3624,_0x185b97){return db[_0x81be('0x3f')][_0x81be('0x46')]({'where':{'id':_0x3c3624[_0x81be('0x45')]['id']}})[_0x81be('0x23')](handleEntityNotFound(_0x185b97,null))[_0x81be('0x23')](removeEntity(_0x185b97,null))['catch'](handleError(_0x185b97,null));};exports[_0x81be('0x4b')]=function(_0x16bc81,_0xcf1ad7){return db[_0x81be('0x3f')][_0x81be('0x4b')]()[_0x81be('0x23')](respondWithResult(_0xcf1ad7,null))[_0x81be('0x49')](handleError(_0xcf1ad7,null));};exports['getQuestions']=function(_0x5430d4,_0x5abf15,_0x22f242){var _0x53cdaf={'raw':!![],'where':{}};var _0x288671={};var _0x14a543={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x81be('0x4c')]({'where':{'id':_0x5430d4[_0x81be('0x45')]['id']}})[_0x81be('0x23')](handleEntityNotFound(_0x5abf15,null))[_0x81be('0x23')](function(_0x29f6a6){if(_0x29f6a6){_0x288671[_0x81be('0x35')]=_[_0x81be('0x2f')](db[_0x81be('0x4d')][_0x81be('0x2a')]);_0x288671['query']=_[_0x81be('0x2f')](_0x5430d4[_0x81be('0x2e')]);_0x288671[_0x81be('0x30')]=_[_0x81be('0x32')](_0x288671['model'],_0x288671[_0x81be('0x2e')]);_0x53cdaf[_0x81be('0x31')]=_[_0x81be('0x32')](_0x288671[_0x81be('0x35')],qs['fields'](_0x5430d4['query'][_0x81be('0x33')]));_0x53cdaf[_0x81be('0x31')]=_0x53cdaf['attributes'][_0x81be('0x34')]?_0x53cdaf['attributes']:_0x288671[_0x81be('0x35')];if(!_0x5430d4[_0x81be('0x2e')]['hasOwnProperty']('nolimit')){_0x53cdaf[_0x81be('0x20')]=qs['limit'](_0x5430d4[_0x81be('0x2e')]['limit']);_0x53cdaf[_0x81be('0x1d')]=qs[_0x81be('0x1d')](_0x5430d4[_0x81be('0x2e')][_0x81be('0x1d')]);}_0x53cdaf[_0x81be('0x37')]=qs['sort'](_0x5430d4[_0x81be('0x2e')][_0x81be('0x38')]);_0x53cdaf['where']=qs['filters'](_[_0x81be('0x3a')](_0x5430d4[_0x81be('0x2e')],_0x288671[_0x81be('0x30')]));_0x53cdaf['where']['SessionId']=_0x29f6a6['id'];if(_0x5430d4['query'][_0x81be('0x3b')]){_0x53cdaf[_0x81be('0x39')]=_[_0x81be('0x3c')](_0x53cdaf[_0x81be('0x39')],{'$or':_[_0x81be('0x29')](_0x53cdaf[_0x81be('0x31')],function(_0x226904){var _0x1ecef3={};_0x1ecef3[_0x226904]={'$like':'%'+_0x5430d4[_0x81be('0x2e')][_0x81be('0x3b')]+'%'};return _0x1ecef3;})});}_0x53cdaf=_[_0x81be('0x3c')]({},_0x53cdaf,_0x5430d4['options']);return db[_0x81be('0x4d')][_0x81be('0x1f')]({'where':_0x53cdaf[_0x81be('0x39')]})[_0x81be('0x23')](function(_0x328a1b){_0x14a543['count']=_0x328a1b;if(_0x5430d4[_0x81be('0x2e')][_0x81be('0x40')]){_0x53cdaf[_0x81be('0x41')]=[{'all':!![]}];}return db[_0x81be('0x4d')][_0x81be('0x42')](_0x53cdaf);})[_0x81be('0x23')](function(_0x5a870e){_0x14a543['rows']=_0x5a870e;return _0x14a543;});}})[_0x81be('0x23')](respondWithFilteredResult(_0x5abf15,_0x53cdaf))[_0x81be('0x49')](handleError(_0x5abf15,null));}; \ No newline at end of file +var _0x2d24=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','create','update','body','find','params','describe','getQuestions','findOne','nolimit','SessionId','JscriptyQuestionReport','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x33f8ed,_0x2a9f38){var _0x13339f=function(_0x16f404){while(--_0x16f404){_0x33f8ed['push'](_0x33f8ed['shift']());}};_0x13339f(++_0x2a9f38);}(_0x2d24,0xbd));var _0x42d2=function(_0x1db4ab,_0x27cc39){_0x1db4ab=_0x1db4ab-0x0;var _0x55d7a6=_0x2d24[_0x1db4ab];return _0x55d7a6;};'use strict';var emlformat=require(_0x42d2('0x0'));var rimraf=require(_0x42d2('0x1'));var zipdir=require(_0x42d2('0x2'));var jsonpatch=require(_0x42d2('0x3'));var rp=require(_0x42d2('0x4'));var moment=require(_0x42d2('0x5'));var BPromise=require(_0x42d2('0x6'));var Mustache=require(_0x42d2('0x7'));var util=require(_0x42d2('0x8'));var path=require(_0x42d2('0x9'));var sox=require(_0x42d2('0xa'));var csv=require(_0x42d2('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42d2('0xc'));var _=require('lodash');var squel=require(_0x42d2('0xd'));var crypto=require(_0x42d2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x42d2('0xf'));var toCsv=require(_0x42d2('0xb'));var querystring=require(_0x42d2('0x10'));var Papa=require(_0x42d2('0x11'));var Redis=require('ioredis');var authService=require(_0x42d2('0x12'));var qs=require(_0x42d2('0x13'));var as=require(_0x42d2('0x14'));var hardwareService=require(_0x42d2('0x15'));var logger=require(_0x42d2('0x16'))('api');var utils=require(_0x42d2('0x17'));var config=require(_0x42d2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35e478,_0x38128a){_0x38128a=_0x38128a||0xcc;return function(_0x6385a7){if(_0x6385a7){return _0x35e478[_0x42d2('0x19')](_0x38128a);}return _0x35e478['status'](_0x38128a)[_0x42d2('0x1a')]();};}function respondWithResult(_0x2988f4,_0x39fb5c){_0x39fb5c=_0x39fb5c||0xc8;return function(_0xf6511d){if(_0xf6511d){return _0x2988f4['status'](_0x39fb5c)['json'](_0xf6511d);}};}function respondWithFilteredResult(_0x508441,_0x1e8ab8){return function(_0x2747c1){if(_0x2747c1){var _0x55b02d=typeof _0x1e8ab8[_0x42d2('0x1b')]===_0x42d2('0x1c')&&typeof _0x1e8ab8[_0x42d2('0x1d')]===_0x42d2('0x1c');var _0x5115bd=_0x2747c1[_0x42d2('0x1e')];var _0x491ec9=_0x55b02d?0x0:_0x1e8ab8[_0x42d2('0x1b')];var _0x3f0ffc=_0x55b02d?_0x2747c1['count']:_0x1e8ab8[_0x42d2('0x1b')]+_0x1e8ab8[_0x42d2('0x1d')];var _0x2e0dcf;if(_0x3f0ffc>=_0x5115bd){_0x3f0ffc=_0x5115bd;_0x2e0dcf=0xc8;}else{_0x2e0dcf=0xce;}_0x508441[_0x42d2('0x1f')](_0x2e0dcf);return _0x508441['set'](_0x42d2('0x20'),_0x491ec9+'-'+_0x3f0ffc+'/'+_0x5115bd)[_0x42d2('0x21')](_0x2747c1);}return null;};}function patchUpdates(_0x5afbc6){return function(_0x3bf2ed){try{jsonpatch[_0x42d2('0x22')](_0x3bf2ed,_0x5afbc6,!![]);}catch(_0x8e4bbe){return BPromise[_0x42d2('0x23')](_0x8e4bbe);}return _0x3bf2ed[_0x42d2('0x24')]();};}function saveUpdates(_0x170775,_0x435c96){return function(_0x387717){if(_0x387717){return _0x387717['update'](_0x170775)[_0x42d2('0x25')](function(_0x2516da){return _0x2516da;});}return null;};}function removeEntity(_0x3d6dc0,_0x299efa){return function(_0x2ed507){if(_0x2ed507){return _0x2ed507[_0x42d2('0x26')]()['then'](function(){_0x3d6dc0[_0x42d2('0x1f')](0xcc)[_0x42d2('0x1a')]();});}};}function handleEntityNotFound(_0x277921,_0xe6ec0b){return function(_0x428c06){if(!_0x428c06){_0x277921[_0x42d2('0x19')](0x194);}return _0x428c06;};}function handleError(_0x115a0f,_0x5b9656){_0x5b9656=_0x5b9656||0x1f4;return function(_0x956b21){logger[_0x42d2('0x27')](_0x956b21[_0x42d2('0x28')]);if(_0x956b21['name']){delete _0x956b21[_0x42d2('0x29')];}_0x115a0f[_0x42d2('0x1f')](_0x5b9656)[_0x42d2('0x2a')](_0x956b21);};}exports[_0x42d2('0x2b')]=function(_0x4423d8,_0x3d0fc6){var _0xa328fd={},_0x4e1f46={},_0x3c9447={'count':0x0,'rows':[]};var _0x2f7ba4=_[_0x42d2('0x2c')](db[_0x42d2('0x2d')][_0x42d2('0x2e')],function(_0x594680){return{'name':_0x594680[_0x42d2('0x2f')],'type':_0x594680[_0x42d2('0x30')][_0x42d2('0x31')]};});_0x4e1f46['model']=_['map'](_0x2f7ba4,'name');_0x4e1f46[_0x42d2('0x32')]=_[_0x42d2('0x33')](_0x4423d8[_0x42d2('0x32')]);_0x4e1f46[_0x42d2('0x34')]=_[_0x42d2('0x35')](_0x4e1f46[_0x42d2('0x36')],_0x4e1f46[_0x42d2('0x32')]);_0xa328fd[_0x42d2('0x37')]=_[_0x42d2('0x35')](_0x4e1f46[_0x42d2('0x36')],qs[_0x42d2('0x38')](_0x4423d8[_0x42d2('0x32')][_0x42d2('0x38')]));_0xa328fd[_0x42d2('0x37')]=_0xa328fd[_0x42d2('0x37')][_0x42d2('0x39')]?_0xa328fd[_0x42d2('0x37')]:_0x4e1f46[_0x42d2('0x36')];if(!_0x4423d8['query'][_0x42d2('0x3a')]('nolimit')){_0xa328fd[_0x42d2('0x1d')]=qs[_0x42d2('0x1d')](_0x4423d8[_0x42d2('0x32')][_0x42d2('0x1d')]);_0xa328fd[_0x42d2('0x1b')]=qs[_0x42d2('0x1b')](_0x4423d8[_0x42d2('0x32')][_0x42d2('0x1b')]);}_0xa328fd[_0x42d2('0x3b')]=qs[_0x42d2('0x3c')](_0x4423d8[_0x42d2('0x32')][_0x42d2('0x3c')]);_0xa328fd[_0x42d2('0x3d')]=qs[_0x42d2('0x34')](_['pick'](_0x4423d8['query'],_0x4e1f46[_0x42d2('0x34')]),_0x2f7ba4);if(_0x4423d8[_0x42d2('0x32')][_0x42d2('0x3e')]){_0xa328fd[_0x42d2('0x3d')]=_[_0x42d2('0x3f')](_0xa328fd[_0x42d2('0x3d')],{'$or':_[_0x42d2('0x2c')](_0x2f7ba4,function(_0x4cd2e8){if(_0x4cd2e8[_0x42d2('0x30')]!==_0x42d2('0x40')){var _0x132e18={};_0x132e18[_0x4cd2e8[_0x42d2('0x29')]]={'$like':'%'+_0x4423d8['query']['filter']+'%'};return _0x132e18;}})});}_0xa328fd=_[_0x42d2('0x3f')]({},_0xa328fd,_0x4423d8[_0x42d2('0x41')]);var _0x434b15={'where':_0xa328fd[_0x42d2('0x3d')]};return db[_0x42d2('0x2d')][_0x42d2('0x1e')](_0x434b15)[_0x42d2('0x25')](function(_0x1f72cb){_0x3c9447[_0x42d2('0x1e')]=_0x1f72cb;if(_0x4423d8[_0x42d2('0x32')][_0x42d2('0x42')]){_0xa328fd[_0x42d2('0x43')]=[{'all':!![]}];}return db[_0x42d2('0x2d')]['findAll'](_0xa328fd);})[_0x42d2('0x25')](function(_0x2a97ab){_0x3c9447['rows']=_0x2a97ab;return _0x3c9447;})[_0x42d2('0x25')](respondWithFilteredResult(_0x3d0fc6,_0xa328fd))[_0x42d2('0x44')](handleError(_0x3d0fc6,null));};exports[_0x42d2('0x45')]=function(_0x506b43,_0x5ca0b9){var _0x576300={'raw':!![],'where':{'id':_0x506b43['params']['id']}},_0x323a9e={};_0x323a9e[_0x42d2('0x36')]=_[_0x42d2('0x33')](db[_0x42d2('0x2d')][_0x42d2('0x2e')]);_0x323a9e['query']=_[_0x42d2('0x33')](_0x506b43[_0x42d2('0x32')]);_0x323a9e[_0x42d2('0x34')]=_['intersection'](_0x323a9e['model'],_0x323a9e[_0x42d2('0x32')]);_0x576300['attributes']=_[_0x42d2('0x35')](_0x323a9e[_0x42d2('0x36')],qs[_0x42d2('0x38')](_0x506b43[_0x42d2('0x32')][_0x42d2('0x38')]));_0x576300[_0x42d2('0x37')]=_0x576300[_0x42d2('0x37')][_0x42d2('0x39')]?_0x576300[_0x42d2('0x37')]:_0x323a9e['model'];if(_0x506b43[_0x42d2('0x32')][_0x42d2('0x42')]){_0x576300[_0x42d2('0x43')]=[{'all':!![]}];}_0x576300=_[_0x42d2('0x3f')]({},_0x576300,_0x506b43[_0x42d2('0x41')]);return db[_0x42d2('0x2d')]['find'](_0x576300)[_0x42d2('0x25')](handleEntityNotFound(_0x5ca0b9,null))['then'](respondWithResult(_0x5ca0b9,null))['catch'](handleError(_0x5ca0b9,null));};exports[_0x42d2('0x46')]=function(_0x394d72,_0x2f7bb4){return db[_0x42d2('0x2d')]['create'](_0x394d72['body'],{})[_0x42d2('0x25')](respondWithResult(_0x2f7bb4,0xc9))[_0x42d2('0x44')](handleError(_0x2f7bb4,null));};exports[_0x42d2('0x47')]=function(_0x185638,_0x5972d1){if(_0x185638[_0x42d2('0x48')]['id']){delete _0x185638[_0x42d2('0x48')]['id'];}return db['JscriptySessionReport'][_0x42d2('0x49')]({'where':{'id':_0x185638[_0x42d2('0x4a')]['id']}})[_0x42d2('0x25')](handleEntityNotFound(_0x5972d1,null))[_0x42d2('0x25')](saveUpdates(_0x185638[_0x42d2('0x48')],null))[_0x42d2('0x25')](respondWithResult(_0x5972d1,null))[_0x42d2('0x44')](handleError(_0x5972d1,null));};exports[_0x42d2('0x26')]=function(_0x59f480,_0x5dc326){return db[_0x42d2('0x2d')]['find']({'where':{'id':_0x59f480[_0x42d2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5dc326,null))[_0x42d2('0x25')](removeEntity(_0x5dc326,null))[_0x42d2('0x44')](handleError(_0x5dc326,null));};exports[_0x42d2('0x4b')]=function(_0x30d375,_0x2814fe){return db[_0x42d2('0x2d')][_0x42d2('0x4b')]()['then'](respondWithResult(_0x2814fe,null))[_0x42d2('0x44')](handleError(_0x2814fe,null));};exports[_0x42d2('0x4c')]=function(_0x13f882,_0x6b151c,_0x68b15e){var _0x3dd412={'raw':!![],'where':{}};var _0x4c6949={};var _0x1793ee={'count':0x0,'rows':[]};return db[_0x42d2('0x2d')][_0x42d2('0x4d')]({'where':{'id':_0x13f882['params']['id']}})[_0x42d2('0x25')](handleEntityNotFound(_0x6b151c,null))['then'](function(_0x337be0){if(_0x337be0){_0x4c6949[_0x42d2('0x36')]=_[_0x42d2('0x33')](db['JscriptyQuestionReport'][_0x42d2('0x2e')]);_0x4c6949[_0x42d2('0x32')]=_[_0x42d2('0x33')](_0x13f882[_0x42d2('0x32')]);_0x4c6949[_0x42d2('0x34')]=_[_0x42d2('0x35')](_0x4c6949[_0x42d2('0x36')],_0x4c6949['query']);_0x3dd412[_0x42d2('0x37')]=_['intersection'](_0x4c6949['model'],qs['fields'](_0x13f882[_0x42d2('0x32')]['fields']));_0x3dd412[_0x42d2('0x37')]=_0x3dd412[_0x42d2('0x37')][_0x42d2('0x39')]?_0x3dd412[_0x42d2('0x37')]:_0x4c6949[_0x42d2('0x36')];if(!_0x13f882[_0x42d2('0x32')][_0x42d2('0x3a')](_0x42d2('0x4e'))){_0x3dd412[_0x42d2('0x1d')]=qs[_0x42d2('0x1d')](_0x13f882[_0x42d2('0x32')][_0x42d2('0x1d')]);_0x3dd412[_0x42d2('0x1b')]=qs[_0x42d2('0x1b')](_0x13f882[_0x42d2('0x32')][_0x42d2('0x1b')]);}_0x3dd412['order']=qs[_0x42d2('0x3c')](_0x13f882[_0x42d2('0x32')]['sort']);_0x3dd412[_0x42d2('0x3d')]=qs[_0x42d2('0x34')](_['pick'](_0x13f882[_0x42d2('0x32')],_0x4c6949[_0x42d2('0x34')]));_0x3dd412[_0x42d2('0x3d')][_0x42d2('0x4f')]=_0x337be0['id'];if(_0x13f882[_0x42d2('0x32')]['filter']){_0x3dd412[_0x42d2('0x3d')]=_[_0x42d2('0x3f')](_0x3dd412[_0x42d2('0x3d')],{'$or':_[_0x42d2('0x2c')](_0x3dd412[_0x42d2('0x37')],function(_0x372520){var _0x409d80={};_0x409d80[_0x372520]={'$like':'%'+_0x13f882['query'][_0x42d2('0x3e')]+'%'};return _0x409d80;})});}_0x3dd412=_[_0x42d2('0x3f')]({},_0x3dd412,_0x13f882[_0x42d2('0x41')]);return db[_0x42d2('0x50')][_0x42d2('0x1e')]({'where':_0x3dd412['where']})['then'](function(_0x1cc0c9){_0x1793ee['count']=_0x1cc0c9;if(_0x13f882[_0x42d2('0x32')][_0x42d2('0x42')]){_0x3dd412[_0x42d2('0x43')]=[{'all':!![]}];}return db[_0x42d2('0x50')][_0x42d2('0x51')](_0x3dd412);})[_0x42d2('0x25')](function(_0x2f44ce){_0x1793ee[_0x42d2('0x52')]=_0x2f44ce;return _0x1793ee;});}})[_0x42d2('0x25')](respondWithFilteredResult(_0x6b151c,_0x3dd412))[_0x42d2('0x44')](handleError(_0x6b151c,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 621012b..ad7d661 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 _0xa630=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x34226e,_0x5e50bf){_0x34226e=_0x34226e-0x0;var _0x3be88a=_0xa630[_0x34226e];return _0x3be88a;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));module[_0x0a63('0x7')]=function(_0x37b4c9,_0x4b7474){return _0x37b4c9[_0x0a63('0x8')](_0x0a63('0x9'),attributes,{'tableName':_0x0a63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9d=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x2df729,_0x2681ee){var _0x4b74cc=function(_0x589571){while(--_0x589571){_0x2df729['push'](_0x2df729['shift']());}};_0x4b74cc(++_0x2681ee);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));module['exports']=function(_0x1c37be,_0x24dd1e){return _0x1c37be[_0xd8f9('0x9')](_0xd8f9('0xa'),attributes,{'tableName':_0xd8f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index ecd3191..1a0e252 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 _0x68b3=['rpc','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5390d1,_0x48b4db){var _0x4a703c=function(_0x713bb8){while(--_0x713bb8){_0x5390d1['push'](_0x5390d1['shift']());}};_0x4a703c(++_0x48b4db);}(_0x68b3,0x1d8));var _0x368b=function(_0x24b60b,_0xad2ae2){_0x24b60b=_0x24b60b-0x0;var _0x1dfe6e=_0x68b3[_0x24b60b];return _0x1dfe6e;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});} \ No newline at end of file +var _0xd117=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xd117,0x182));var _0x7d11=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0xd117[_0x1c06f4];return _0x1a727e;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 1b55881..356a7a1 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 _0x1cbe=['Router','fs-extra','../../components/interaction/service','index','/:id','update','get','/download_log_file','isAuthenticated','exports','multer','util','path','connect-timeout','express'];(function(_0x1d5c94,_0xd635f1){var _0x321b8c=function(_0x3fb5f8){while(--_0x3fb5f8){_0x1d5c94['push'](_0x1d5c94['shift']());}};_0x321b8c(++_0xd635f1);}(_0x1cbe,0x109));var _0xe1cb=function(_0x257b88,_0x23b5cd){_0x257b88=_0x257b88-0x0;var _0xd83158=_0x1cbe[_0x257b88];return _0xd83158;};'use strict';var multer=require(_0xe1cb('0x0'));var util=require(_0xe1cb('0x1'));var path=require(_0xe1cb('0x2'));var timeout=require(_0xe1cb('0x3'));var express=require(_0xe1cb('0x4'));var router=express[_0xe1cb('0x5')]();var fs_extra=require(_0xe1cb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe1cb('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0xe1cb('0x8')]);router['put'](_0xe1cb('0x9'),auth['isAuthenticated'](),controller[_0xe1cb('0xa')]);router[_0xe1cb('0xb')](_0xe1cb('0xc'),auth[_0xe1cb('0xd')](),controller['downloadLogFile']);module[_0xe1cb('0xe')]=router; \ No newline at end of file +var _0x83fc=['index','put','/:id','update','get','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x83fc,0x1a1));var _0xc83f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x83fc[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xc83f('0x0'));var util=require('util');var path=require(_0xc83f('0x1'));var timeout=require(_0xc83f('0x2'));var express=require(_0xc83f('0x3'));var router=express['Router']();var fs_extra=require(_0xc83f('0x4'));var auth=require(_0xc83f('0x5'));var interaction=require(_0xc83f('0x6'));var config=require('../../config/environment');var controller=require(_0xc83f('0x7'));router['get']('/',controller[_0xc83f('0x8')]);router[_0xc83f('0x9')](_0xc83f('0xa'),auth['isAuthenticated'](),controller[_0xc83f('0xb')]);router[_0xc83f('0xc')](_0xc83f('0xd'),auth[_0xc83f('0xe')](),controller[_0xc83f('0xf')]);module[_0xc83f('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index c6d5617..950dbec 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 _0xc99c=['INTEGER','sequelize','exports','STRING'];(function(_0x21fdc3,_0x3a7bcf){var _0x26561c=function(_0x6b5023){while(--_0x6b5023){_0x21fdc3['push'](_0x21fdc3['shift']());}};_0x26561c(++_0x3a7bcf);}(_0xc99c,0x125));var _0xcc99=function(_0x1c768b,_0x34ef50){_0x1c768b=_0x1c768b-0x0;var _0x1726ea=_0xc99c[_0x1c768b];return _0x1726ea;};'use strict';var Sequelize=require(_0xcc99('0x0'));module[_0xcc99('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xcc99('0x2')]},'data2':{'type':Sequelize[_0xcc99('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xcc99('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0b51=['TEXT','STRING','sequelize'];(function(_0x1abf7e,_0x4546f2){var _0x1b5aaa=function(_0x141d51){while(--_0x141d51){_0x1abf7e['push'](_0x1abf7e['shift']());}};_0x1b5aaa(++_0x4546f2);}(_0x0b51,0xe3));var _0x10b5=function(_0xf7afd,_0x4ddcf1){_0xf7afd=_0xf7afd-0x0;var _0x14231a=_0x0b51[_0xf7afd];return _0x14231a;};'use strict';var Sequelize=require(_0x10b5('0x0'));module['exports']={'license':{'type':Sequelize[_0x10b5('0x1')]},'data1':{'type':Sequelize[_0x10b5('0x2')]},'data2':{'type':Sequelize[_0x10b5('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index afc7585..6f68df9 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 _0x08b9=['Content-disposition','attachment;\x20filename=','download','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','model','License','rawAttributes','keys','query','filters','intersection','attributes','fields','merge','options','getLicense','catch','update','body','find','checkLicense','demo','downloadLogFile','license-info.log','join','xcally','setHeader'];(function(_0x25d64c,_0x10b0d7){var _0x4ac36f=function(_0x49bfaf){while(--_0x49bfaf){_0x25d64c['push'](_0x25d64c['shift']());}};_0x4ac36f(++_0x10b0d7);}(_0x08b9,0x157));var _0x908b=function(_0x492221,_0x9e2521){_0x492221=_0x492221-0x0;var _0x398bf9=_0x08b9[_0x492221];return _0x398bf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x908b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x908b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x908b('0x2'));var util=require(_0x908b('0x3'));var path=require(_0x908b('0x4'));var sox=require(_0x908b('0x5'));var csv=require(_0x908b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x908b('0x7'));var _=require(_0x908b('0x8'));var squel=require(_0x908b('0x9'));var crypto=require(_0x908b('0xa'));var jsforce=require(_0x908b('0xb'));var deskjs=require(_0x908b('0xc'));var toCsv=require(_0x908b('0x6'));var querystring=require(_0x908b('0xd'));var Papa=require(_0x908b('0xe'));var Redis=require(_0x908b('0xf'));var authService=require(_0x908b('0x10'));var qs=require(_0x908b('0x11'));var as=require(_0x908b('0x12'));var hardwareService=require(_0x908b('0x13'));var logger=require(_0x908b('0x14'))('api');var utils=require(_0x908b('0x15'));var config=require(_0x908b('0x16'));var licenseUtil=require(_0x908b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd313ea,_0x29d65b){_0x29d65b=_0x29d65b||0xcc;return function(_0x212e70){if(_0x212e70){return _0xd313ea[_0x908b('0x18')](_0x29d65b);}return _0xd313ea[_0x908b('0x19')](_0x29d65b)[_0x908b('0x1a')]();};}function respondWithResult(_0x2a865b,_0x3a08fe){_0x3a08fe=_0x3a08fe||0xc8;return function(_0x1aa60f){if(_0x1aa60f){return _0x2a865b[_0x908b('0x19')](_0x3a08fe)[_0x908b('0x1b')](_0x1aa60f);}};}function respondWithFilteredResult(_0x1aa678,_0x16762a){return function(_0x5a9291){if(_0x5a9291){var _0x488b26=typeof _0x16762a[_0x908b('0x1c')]==='undefined'&&typeof _0x16762a[_0x908b('0x1d')]===_0x908b('0x1e');var _0x4ab964=_0x5a9291[_0x908b('0x1f')];var _0x1e6855=_0x488b26?0x0:_0x16762a[_0x908b('0x1c')];var _0x5e3613=_0x488b26?_0x5a9291['count']:_0x16762a['offset']+_0x16762a[_0x908b('0x1d')];var _0x4ef56c;if(_0x5e3613>=_0x4ab964){_0x5e3613=_0x4ab964;_0x4ef56c=0xc8;}else{_0x4ef56c=0xce;}_0x1aa678[_0x908b('0x19')](_0x4ef56c);return _0x1aa678[_0x908b('0x20')](_0x908b('0x21'),_0x1e6855+'-'+_0x5e3613+'/'+_0x4ab964)['json'](_0x5a9291);}return null;};}function patchUpdates(_0x1c731c){return function(_0x4d1ab5){try{jsonpatch[_0x908b('0x22')](_0x4d1ab5,_0x1c731c,!![]);}catch(_0x548469){return BPromise['reject'](_0x548469);}return _0x4d1ab5[_0x908b('0x23')]();};}function saveUpdates(_0xcb5b8,_0x2ca33f){return function(_0x3ccc3b){if(_0x3ccc3b){return _0x3ccc3b['update'](_0xcb5b8)[_0x908b('0x24')](function(_0x425228){return _0x425228;});}return null;};}function removeEntity(_0x79c40,_0xd54c14){return function(_0x342225){if(_0x342225){return _0x342225[_0x908b('0x25')]()[_0x908b('0x24')](function(){_0x79c40[_0x908b('0x19')](0xcc)[_0x908b('0x1a')]();});}};}function handleEntityNotFound(_0x1d9d18,_0x38e4f6){return function(_0x6db488){if(!_0x6db488){_0x1d9d18[_0x908b('0x18')](0x194);}return _0x6db488;};}function handleError(_0x111e72,_0x3c8d32){_0x3c8d32=_0x3c8d32||0x1f4;return function(_0x33f716){logger[_0x908b('0x26')](_0x33f716[_0x908b('0x27')]);if(_0x33f716[_0x908b('0x28')]){delete _0x33f716[_0x908b('0x28')];}_0x111e72[_0x908b('0x19')](_0x3c8d32)[_0x908b('0x29')](_0x33f716);};}var utilLicense=require(_0x908b('0x17'));exports['index']=function(_0x42d35d,_0x42f1fd){var _0x2a3254={'raw':!![],'where':{'id':0x1}},_0x2e6c98={};_0x2e6c98[_0x908b('0x2a')]=_['keys'](db[_0x908b('0x2b')][_0x908b('0x2c')]);_0x2e6c98['query']=_[_0x908b('0x2d')](_0x42d35d[_0x908b('0x2e')]);_0x2e6c98[_0x908b('0x2f')]=_[_0x908b('0x30')](_0x2e6c98[_0x908b('0x2a')],_0x2e6c98[_0x908b('0x2e')]);_0x2a3254[_0x908b('0x31')]=_[_0x908b('0x30')](_0x2e6c98[_0x908b('0x2a')],qs[_0x908b('0x32')](_0x42d35d['query']['fields']));_0x2a3254[_0x908b('0x31')]=_0x2a3254[_0x908b('0x31')]['length']?_0x2a3254['attributes']:_0x2e6c98[_0x908b('0x2a')];_0x2a3254=_[_0x908b('0x33')]({},_0x2a3254,_0x42d35d[_0x908b('0x34')]);return utilLicense[_0x908b('0x35')](_0x2a3254)[_0x908b('0x24')](respondWithResult(_0x42f1fd,null))[_0x908b('0x36')](handleError(_0x42f1fd,null));};exports[_0x908b('0x37')]=function(_0x3660be,_0x16b50e){if(_0x3660be[_0x908b('0x38')]['id']){delete _0x3660be['body']['id'];}return db[_0x908b('0x2b')][_0x908b('0x39')]({'where':{'id':_0x3660be['params']['id']}})['then'](handleEntityNotFound(_0x16b50e,null))[_0x908b('0x24')](function(_0x115bbb){var _0x49e94d=_0x115bbb['get']({'plain':!![]});return utilLicense[_0x908b('0x3a')](_0x49e94d,_0x3660be[_0x908b('0x38')]['key']);})[_0x908b('0x24')](function(_0x12fb8d){if(!_0x12fb8d[_0x908b('0x3b')]){return saveUpdates(_0x3660be[_0x908b('0x38')],null);}return _0x12fb8d;})[_0x908b('0x24')](respondWithResult(_0x16b50e,null))['catch'](handleError(_0x16b50e,null));};exports[_0x908b('0x3c')]=function(_0x26f1fa,_0xe5c539){var _0x1f6a51=_0x908b('0x3d');var _0x5843d7=path[_0x908b('0x3e')]('/var','log',_0x908b('0x3f'),_0x1f6a51);_0xe5c539[_0x908b('0x40')](_0x908b('0x41'),_0x908b('0x42')+_0x1f6a51);_0xe5c539[_0x908b('0x20')]('Content-Type','text/plain');_0xe5c539[_0x908b('0x43')](_0x5843d7);}; \ No newline at end of file +var _0xf2f5=['length','merge','options','getLicense','body','License','find','params','get','checkLicense','key','demo','catch','license-info.log','/var','log','xcally','setHeader','Content-disposition','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','model','keys','query','intersection','attributes','fields'];(function(_0x4df3db,_0x5f66a4){var _0x322281=function(_0x50a949){while(--_0x50a949){_0x4df3db['push'](_0x4df3db['shift']());}};_0x322281(++_0x5f66a4);}(_0xf2f5,0x125));var _0x5f2f=function(_0x3bc7a1,_0x1870c8){_0x3bc7a1=_0x3bc7a1-0x0;var _0x3699f1=_0xf2f5[_0x3bc7a1];return _0x3699f1;};'use strict';var emlformat=require(_0x5f2f('0x0'));var rimraf=require(_0x5f2f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f2f('0x2'));var rp=require(_0x5f2f('0x3'));var moment=require(_0x5f2f('0x4'));var BPromise=require(_0x5f2f('0x5'));var Mustache=require(_0x5f2f('0x6'));var util=require('util');var path=require(_0x5f2f('0x7'));var sox=require(_0x5f2f('0x8'));var csv=require('to-csv');var ejs=require(_0x5f2f('0x9'));var fs=require('fs');var fs_extra=require(_0x5f2f('0xa'));var _=require('lodash');var squel=require(_0x5f2f('0xb'));var crypto=require(_0x5f2f('0xc'));var jsforce=require(_0x5f2f('0xd'));var deskjs=require(_0x5f2f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5f2f('0xf'));var Papa=require(_0x5f2f('0x10'));var Redis=require(_0x5f2f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f2f('0x12'));var logger=require(_0x5f2f('0x13'))(_0x5f2f('0x14'));var utils=require('../../config/utils');var config=require(_0x5f2f('0x15'));var licenseUtil=require(_0x5f2f('0x16'));var db=require(_0x5f2f('0x17'))['db'];function respondWithStatusCode(_0x557690,_0x1fd51a){_0x1fd51a=_0x1fd51a||0xcc;return function(_0x32fcf8){if(_0x32fcf8){return _0x557690[_0x5f2f('0x18')](_0x1fd51a);}return _0x557690[_0x5f2f('0x19')](_0x1fd51a)['end']();};}function respondWithResult(_0x5cbb8e,_0x4d517f){_0x4d517f=_0x4d517f||0xc8;return function(_0x489e4d){if(_0x489e4d){return _0x5cbb8e['status'](_0x4d517f)[_0x5f2f('0x1a')](_0x489e4d);}};}function respondWithFilteredResult(_0x179cde,_0x76c8e1){return function(_0x3f21ed){if(_0x3f21ed){var _0x279e7a=typeof _0x76c8e1[_0x5f2f('0x1b')]===_0x5f2f('0x1c')&&typeof _0x76c8e1['limit']===_0x5f2f('0x1c');var _0x462bcc=_0x3f21ed[_0x5f2f('0x1d')];var _0x30a2d3=_0x279e7a?0x0:_0x76c8e1[_0x5f2f('0x1b')];var _0x13af49=_0x279e7a?_0x3f21ed[_0x5f2f('0x1d')]:_0x76c8e1[_0x5f2f('0x1b')]+_0x76c8e1['limit'];var _0x2e77e2;if(_0x13af49>=_0x462bcc){_0x13af49=_0x462bcc;_0x2e77e2=0xc8;}else{_0x2e77e2=0xce;}_0x179cde[_0x5f2f('0x19')](_0x2e77e2);return _0x179cde[_0x5f2f('0x1e')](_0x5f2f('0x1f'),_0x30a2d3+'-'+_0x13af49+'/'+_0x462bcc)['json'](_0x3f21ed);}return null;};}function patchUpdates(_0x2dcb42){return function(_0xbecd6f){try{jsonpatch[_0x5f2f('0x20')](_0xbecd6f,_0x2dcb42,!![]);}catch(_0x1cf878){return BPromise[_0x5f2f('0x21')](_0x1cf878);}return _0xbecd6f[_0x5f2f('0x22')]();};}function saveUpdates(_0x226a57,_0x5a7b76){return function(_0x35bd4a){if(_0x35bd4a){return _0x35bd4a[_0x5f2f('0x23')](_0x226a57)[_0x5f2f('0x24')](function(_0x4b0ee){return _0x4b0ee;});}return null;};}function removeEntity(_0x16d7fc,_0x228469){return function(_0x144ade){if(_0x144ade){return _0x144ade['destroy']()[_0x5f2f('0x24')](function(){_0x16d7fc[_0x5f2f('0x19')](0xcc)[_0x5f2f('0x25')]();});}};}function handleEntityNotFound(_0x10e090,_0x3d445c){return function(_0x1145ca){if(!_0x1145ca){_0x10e090[_0x5f2f('0x18')](0x194);}return _0x1145ca;};}function handleError(_0x4762ed,_0x44fcfa){_0x44fcfa=_0x44fcfa||0x1f4;return function(_0x1d1591){logger[_0x5f2f('0x26')](_0x1d1591['stack']);if(_0x1d1591[_0x5f2f('0x27')]){delete _0x1d1591['name'];}_0x4762ed[_0x5f2f('0x19')](_0x44fcfa)[_0x5f2f('0x28')](_0x1d1591);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0xbcc053,_0x591b42){var _0x29a0ea={'raw':!![],'where':{'id':0x1}},_0x5282e8={};_0x5282e8[_0x5f2f('0x29')]=_[_0x5f2f('0x2a')](db['License']['rawAttributes']);_0x5282e8[_0x5f2f('0x2b')]=_['keys'](_0xbcc053['query']);_0x5282e8['filters']=_[_0x5f2f('0x2c')](_0x5282e8[_0x5f2f('0x29')],_0x5282e8[_0x5f2f('0x2b')]);_0x29a0ea[_0x5f2f('0x2d')]=_[_0x5f2f('0x2c')](_0x5282e8[_0x5f2f('0x29')],qs[_0x5f2f('0x2e')](_0xbcc053[_0x5f2f('0x2b')][_0x5f2f('0x2e')]));_0x29a0ea[_0x5f2f('0x2d')]=_0x29a0ea['attributes'][_0x5f2f('0x2f')]?_0x29a0ea[_0x5f2f('0x2d')]:_0x5282e8[_0x5f2f('0x29')];_0x29a0ea=_[_0x5f2f('0x30')]({},_0x29a0ea,_0xbcc053[_0x5f2f('0x31')]);return utilLicense[_0x5f2f('0x32')](_0x29a0ea)[_0x5f2f('0x24')](respondWithResult(_0x591b42,null))['catch'](handleError(_0x591b42,null));};exports[_0x5f2f('0x23')]=function(_0x14e123,_0x5321d6){if(_0x14e123[_0x5f2f('0x33')]['id']){delete _0x14e123[_0x5f2f('0x33')]['id'];}return db[_0x5f2f('0x34')][_0x5f2f('0x35')]({'where':{'id':_0x14e123[_0x5f2f('0x36')]['id']}})[_0x5f2f('0x24')](handleEntityNotFound(_0x5321d6,null))[_0x5f2f('0x24')](function(_0x439d1b){var _0x50d770=_0x439d1b[_0x5f2f('0x37')]({'plain':!![]});return utilLicense[_0x5f2f('0x38')](_0x50d770,_0x14e123['body'][_0x5f2f('0x39')]);})[_0x5f2f('0x24')](function(_0x4a164b){if(!_0x4a164b[_0x5f2f('0x3a')]){return saveUpdates(_0x14e123[_0x5f2f('0x33')],null);}return _0x4a164b;})[_0x5f2f('0x24')](respondWithResult(_0x5321d6,null))[_0x5f2f('0x3b')](handleError(_0x5321d6,null));};exports['downloadLogFile']=function(_0x2444fb,_0x1cd0b9){var _0x1eed2c=_0x5f2f('0x3c');var _0x511290=path['join'](_0x5f2f('0x3d'),_0x5f2f('0x3e'),_0x5f2f('0x3f'),_0x1eed2c);_0x1cd0b9[_0x5f2f('0x40')](_0x5f2f('0x41'),'attachment;\x20filename='+_0x1eed2c);_0x1cd0b9[_0x5f2f('0x1e')]('Content-Type',_0x5f2f('0x42'));_0x1cd0b9[_0x5f2f('0x43')](_0x511290);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6139369..51ac881 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 _0x1420=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports','define','License','lodash'];(function(_0x7b3a0c,_0x308e40){var _0x2d57c6=function(_0x5afec8){while(--_0x5afec8){_0x7b3a0c['push'](_0x7b3a0c['shift']());}};_0x2d57c6(++_0x308e40);}(_0x1420,0x1eb));var _0x0142=function(_0x181284,_0x5413a9){_0x181284=_0x181284-0x0;var _0x356ff1=_0x1420[_0x181284];return _0x356ff1;};'use strict';var _=require(_0x0142('0x0'));var util=require('util');var logger=require(_0x0142('0x1'))(_0x0142('0x2'));var moment=require(_0x0142('0x3'));var BPromise=require(_0x0142('0x4'));var rp=require(_0x0142('0x5'));var fs=require('fs');var path=require(_0x0142('0x6'));var rimraf=require(_0x0142('0x7'));var config=require('../../config/environment');var attributes=require(_0x0142('0x8'));module[_0x0142('0x9')]=function(_0x45e8cf,_0x193218){return _0x45e8cf[_0x0142('0xa')](_0x0142('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x971f=['request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','../../config/logger','bluebird'];(function(_0x199ffa,_0x5115b9){var _0x5e7c3a=function(_0x5bd7f1){while(--_0x5bd7f1){_0x199ffa['push'](_0x199ffa['shift']());}};_0x5e7c3a(++_0x5115b9);}(_0x971f,0xf8));var _0xf971=function(_0x56246f,_0x4d5478){_0x56246f=_0x56246f-0x0;var _0x2bec6c=_0x971f[_0x56246f];return _0x2bec6c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf971('0x0'))('api');var moment=require('moment');var BPromise=require(_0xf971('0x1'));var rp=require(_0xf971('0x2'));var fs=require('fs');var path=require(_0xf971('0x3'));var rimraf=require(_0xf971('0x4'));var config=require(_0xf971('0x5'));var attributes=require(_0xf971('0x6'));module[_0xf971('0x7')]=function(_0x116ce4,_0x1ee2f5){return _0x116ce4[_0xf971('0x8')](_0xf971('0x9'),attributes,{'tableName':'license','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 93ba4aa..7143527 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 _0x24bd=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','License,\x20%s,\x20%s'];(function(_0x56685c,_0x11fc7a){var _0x436028=function(_0x7adbfa){while(--_0x7adbfa){_0x56685c['push'](_0x56685c['shift']());}};_0x436028(++_0x11fc7a);}(_0x24bd,0x182));var _0xd24b=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x24bd[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xd24b('0x0'));var util=require(_0xd24b('0x1'));var moment=require(_0xd24b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd24b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd24b('0x4'));var logger=require(_0xd24b('0x5'))(_0xd24b('0x6'));var config=require(_0xd24b('0x7'));var jayson=require(_0xd24b('0x8'));var client=jayson[_0xd24b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x90f12d,_0x1fc58d,_0x5dcad0){return new BPromise(function(_0x49f124,_0x1a2e17){return client['request'](_0x90f12d,_0x5dcad0)[_0xd24b('0xa')](function(_0xd72aac){logger[_0xd24b('0xb')](_0xd24b('0xc'),_0x1fc58d,_0xd24b('0xd'));logger[_0xd24b('0xe')](_0xd24b('0xf'),_0x1fc58d,_0xd24b('0xd'),JSON[_0xd24b('0x10')](_0xd72aac));if(_0xd72aac[_0xd24b('0x11')]){if(_0xd72aac['error']['code']===0x1f4){logger['error'](_0xd24b('0xc'),_0x1fc58d,_0xd72aac[_0xd24b('0x11')][_0xd24b('0x12')]);return _0x1a2e17(_0xd72aac[_0xd24b('0x11')][_0xd24b('0x12')]);}logger[_0xd24b('0x11')](_0xd24b('0xc'),_0x1fc58d,_0xd72aac['error'][_0xd24b('0x12')]);return _0x49f124(_0xd72aac[_0xd24b('0x11')][_0xd24b('0x12')]);}else{logger['info'](_0xd24b('0xc'),_0x1fc58d,_0xd24b('0xd'));_0x49f124(_0xd72aac[_0xd24b('0x13')][_0xd24b('0x12')]);}})[_0xd24b('0x14')](function(_0x5d2a37){logger[_0xd24b('0x11')](_0xd24b('0xc'),_0x1fc58d,_0x5d2a37);_0x1a2e17(_0x5d2a37);});});} \ No newline at end of file +var _0xd304=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x434faf,_0x4033d4){var _0x5d9a05=function(_0x44571a){while(--_0x44571a){_0x434faf['push'](_0x434faf['shift']());}};_0x5d9a05(++_0x4033d4);}(_0xd304,0xab));var _0x4d30=function(_0x2a59d2,_0x418602){_0x2a59d2=_0x2a59d2-0x0;var _0x1a4114=_0xd304[_0x2a59d2];return _0x1a4114;};'use strict';var _=require(_0x4d30('0x0'));var util=require(_0x4d30('0x1'));var moment=require(_0x4d30('0x2'));var BPromise=require(_0x4d30('0x3'));var rs=require(_0x4d30('0x4'));var fs=require('fs');var Redis=require(_0x4d30('0x5'));var db=require(_0x4d30('0x6'))['db'];var utils=require(_0x4d30('0x7'));var logger=require(_0x4d30('0x8'))(_0x4d30('0x9'));var config=require(_0x4d30('0xa'));var jayson=require(_0x4d30('0xb'));var client=jayson[_0x4d30('0xc')][_0x4d30('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x51af0f,_0x3d405c,_0xf60a72){return new BPromise(function(_0x2eb242,_0x5a71bc){return client['request'](_0x51af0f,_0xf60a72)[_0x4d30('0xe')](function(_0x36ccec){logger['info'](_0x4d30('0xf'),_0x3d405c,'request\x20sent');logger[_0x4d30('0x10')](_0x4d30('0x11'),_0x3d405c,'request\x20sent',JSON[_0x4d30('0x12')](_0x36ccec));if(_0x36ccec[_0x4d30('0x13')]){if(_0x36ccec['error'][_0x4d30('0x14')]===0x1f4){logger[_0x4d30('0x13')]('License,\x20%s,\x20%s',_0x3d405c,_0x36ccec['error'][_0x4d30('0x15')]);return _0x5a71bc(_0x36ccec[_0x4d30('0x13')][_0x4d30('0x15')]);}logger[_0x4d30('0x13')](_0x4d30('0xf'),_0x3d405c,_0x36ccec['error'][_0x4d30('0x15')]);return _0x2eb242(_0x36ccec[_0x4d30('0x13')][_0x4d30('0x15')]);}else{logger[_0x4d30('0x16')](_0x4d30('0xf'),_0x3d405c,_0x4d30('0x17'));_0x2eb242(_0x36ccec[_0x4d30('0x18')]['message']);}})['catch'](function(_0x37b0b8){logger[_0x4d30('0x13')](_0x4d30('0xf'),_0x3d405c,_0x37b0b8);_0x5a71bc(_0x37b0b8);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 58ba01f..6679859 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 _0x51d3=['/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x1f4d92,_0x188a3d){var _0x1afcf9=function(_0xafef34){while(--_0xafef34){_0x1f4d92['push'](_0x1f4d92['shift']());}};_0x1afcf9(++_0x188a3d);}(_0x51d3,0x199));var _0x351d=function(_0x137692,_0x338587){_0x137692=_0x137692-0x0;var _0x43d5a8=_0x51d3[_0x137692];return _0x43d5a8;};'use strict';var multer=require(_0x351d('0x0'));var util=require(_0x351d('0x1'));var path=require(_0x351d('0x2'));var timeout=require(_0x351d('0x3'));var express=require(_0x351d('0x4'));var router=express[_0x351d('0x5')]();var fs_extra=require(_0x351d('0x6'));var auth=require(_0x351d('0x7'));var interaction=require(_0x351d('0x8'));var config=require(_0x351d('0x9'));var controller=require('./mailAccount.controller');router[_0x351d('0xa')]('/',auth[_0x351d('0xb')](),controller[_0x351d('0xc')]);router[_0x351d('0xa')](_0x351d('0xd'),auth[_0x351d('0xb')](),controller[_0x351d('0xe')]);router[_0x351d('0xa')](_0x351d('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x351d('0xa')](_0x351d('0x10'),auth['isAuthenticated'](),controller[_0x351d('0x11')]);router[_0x351d('0xa')](_0x351d('0x12'),auth[_0x351d('0xb')](),controller[_0x351d('0x13')]);router[_0x351d('0xa')]('/:id/in_servers',auth[_0x351d('0xb')](),controller[_0x351d('0x14')]);router[_0x351d('0xa')](_0x351d('0x15'),auth[_0x351d('0xb')](),controller[_0x351d('0x16')]);router['get'](_0x351d('0x17'),auth[_0x351d('0xb')](),controller[_0x351d('0x18')]);router[_0x351d('0xa')](_0x351d('0x19'),auth[_0x351d('0xb')](),controller[_0x351d('0x1a')]);router[_0x351d('0xa')](_0x351d('0x1b'),auth[_0x351d('0xb')](),controller[_0x351d('0x1c')]);router[_0x351d('0xa')](_0x351d('0x1d'),auth[_0x351d('0xb')](),controller[_0x351d('0x1e')]);router['get'](_0x351d('0x1f'),auth['isAuthenticated'](),controller[_0x351d('0x20')]);router[_0x351d('0x21')]('/:id/dispositions',auth[_0x351d('0xb')](),controller[_0x351d('0x22')]);router[_0x351d('0x21')](_0x351d('0x12'),auth[_0x351d('0xb')](),controller[_0x351d('0x23')]);router[_0x351d('0x21')]('/',auth[_0x351d('0xb')](),controller[_0x351d('0x24')]);router['post'](_0x351d('0x25'),auth[_0x351d('0xb')](),controller[_0x351d('0x26')]);router[_0x351d('0x21')](_0x351d('0x15'),auth[_0x351d('0xb')](),controller[_0x351d('0x27')]);router[_0x351d('0x21')](_0x351d('0x17'),auth['isAuthenticated'](),controller[_0x351d('0x28')]);router['post'](_0x351d('0x19'),auth['isAuthenticated'](),controller[_0x351d('0x29')]);router[_0x351d('0x21')](_0x351d('0x2a'),auth[_0x351d('0xb')](),controller['send']);router[_0x351d('0x21')](_0x351d('0x1f'),auth[_0x351d('0xb')](),controller[_0x351d('0x2b')]);router[_0x351d('0x2c')]('/:id',auth['isAuthenticated'](),controller[_0x351d('0x2d')]);router[_0x351d('0x2e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x351d('0x2f')]);router[_0x351d('0x2e')](_0x351d('0x12'),auth[_0x351d('0xb')](),controller[_0x351d('0x30')]);router[_0x351d('0x2e')](_0x351d('0x25'),auth[_0x351d('0xb')](),controller[_0x351d('0x31')]);router[_0x351d('0x2e')](_0x351d('0x15'),auth[_0x351d('0xb')](),controller[_0x351d('0x32')]);router['delete'](_0x351d('0xf'),auth[_0x351d('0xb')](),controller[_0x351d('0x33')]);router['delete']('/:id/users',auth[_0x351d('0xb')](),controller['removeAgents']);module[_0x351d('0x34')]=router; \ No newline at end of file +var _0x805e=['removeSmtp','removeAgents','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','/:id/out_servers','addSmtp','addApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeImap'];(function(_0x1342fb,_0x1390b8){var _0x113390=function(_0x552d7c){while(--_0x552d7c){_0x1342fb['push'](_0x1342fb['shift']());}};_0x113390(++_0x1390b8);}(_0x805e,0x1b1));var _0xe805=function(_0x666504,_0x3cc475){_0x666504=_0x666504-0x0;var _0x1d13ce=_0x805e[_0x666504];return _0x1d13ce;};'use strict';var multer=require('multer');var util=require(_0xe805('0x0'));var path=require(_0xe805('0x1'));var timeout=require(_0xe805('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe805('0x3'));var interaction=require(_0xe805('0x4'));var config=require(_0xe805('0x5'));var controller=require('./mailAccount.controller');router[_0xe805('0x6')]('/',auth[_0xe805('0x7')](),controller[_0xe805('0x8')]);router['get'](_0xe805('0x9'),auth[_0xe805('0x7')](),controller[_0xe805('0xa')]);router[_0xe805('0x6')](_0xe805('0xb'),auth[_0xe805('0x7')](),controller[_0xe805('0xc')]);router[_0xe805('0x6')](_0xe805('0xd'),auth[_0xe805('0x7')](),controller[_0xe805('0xe')]);router[_0xe805('0x6')]('/:id/canned_answers',auth[_0xe805('0x7')](),controller[_0xe805('0xf')]);router[_0xe805('0x6')](_0xe805('0x10'),auth['isAuthenticated'](),controller[_0xe805('0x11')]);router[_0xe805('0x6')]('/:id/out_servers',auth[_0xe805('0x7')](),controller['getSmtp']);router[_0xe805('0x6')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xe805('0x12')]);router[_0xe805('0x6')](_0xe805('0x13'),auth[_0xe805('0x7')](),controller[_0xe805('0x14')]);router[_0xe805('0x6')](_0xe805('0x15'),auth['isAuthenticated'](),controller['getMessages']);router[_0xe805('0x6')]('/:id/verify',auth[_0xe805('0x7')](),controller['verifySmtp']);router[_0xe805('0x6')](_0xe805('0x16'),auth[_0xe805('0x7')](),controller[_0xe805('0x17')]);router[_0xe805('0x18')](_0xe805('0xd'),auth[_0xe805('0x7')](),controller[_0xe805('0x19')]);router[_0xe805('0x18')](_0xe805('0x1a'),auth[_0xe805('0x7')](),controller[_0xe805('0x1b')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe805('0x1c')]);router[_0xe805('0x18')]('/:id/in_servers',auth[_0xe805('0x7')](),controller[_0xe805('0x1d')]);router[_0xe805('0x18')](_0xe805('0x1e'),auth[_0xe805('0x7')](),controller[_0xe805('0x1f')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0xe805('0x13'),auth[_0xe805('0x7')](),controller[_0xe805('0x20')]);router[_0xe805('0x18')](_0xe805('0x21'),auth[_0xe805('0x7')](),controller[_0xe805('0x22')]);router[_0xe805('0x18')](_0xe805('0x16'),auth[_0xe805('0x7')](),controller[_0xe805('0x23')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe805('0x24')]);router[_0xe805('0x25')]('/:id/dispositions',auth[_0xe805('0x7')](),controller[_0xe805('0x26')]);router[_0xe805('0x25')]('/:id/canned_answers',auth[_0xe805('0x7')](),controller['removeAnswers']);router['delete'](_0xe805('0x10'),auth[_0xe805('0x7')](),controller[_0xe805('0x27')]);router[_0xe805('0x25')](_0xe805('0x1e'),auth[_0xe805('0x7')](),controller[_0xe805('0x28')]);router[_0xe805('0x25')]('/:id',auth[_0xe805('0x7')](),controller['destroy']);router[_0xe805('0x25')](_0xe805('0x16'),auth['isAuthenticated'](),controller[_0xe805('0x29')]);module[_0xe805('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3313616..ffc2fb0 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 _0xedfc=['outlook365','provider','getDataValue','custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedfc,0x100));var _0xcedf=function(_0x2a05bf,_0x55e3a4){_0x2a05bf=_0x2a05bf-0x0;var _0x38a62e=_0xedfc[_0x2a05bf];return _0x38a62e;};'use strict';var Sequelize=require(_0xcedf('0x0'));module[_0xcedf('0x1')]={'description':{'type':Sequelize[_0xcedf('0x2')]},'name':{'type':Sequelize[_0xcedf('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xcedf('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xcedf('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcedf('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xcedf('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xcedf('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcedf('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xcedf('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xcedf('0x6')],'defaultValue':function(){return _0xcedf('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcedf('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcedf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcedf('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xcedf('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xcedf('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d6992){if(!_0x2d6992)this[_0xcedf('0xa')](_0xcedf('0xb'),null);this['setDataValue'](_0xcedf('0xc'),_0x2d6992);}},'provider':{'type':Sequelize[_0xcedf('0xd')](_0xcedf('0xe'),_0xcedf('0xf'),_0xcedf('0x10'),_0xcedf('0x11')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xcedf('0x12')))return'custom';return this[_0xcedf('0x13')]('provider');},'set':function(_0x2b708a){if(_0x2b708a===_0xcedf('0x14'))_0x2b708a=null;return this[_0xcedf('0xa')]('provider',_0x2b708a);}}}; \ No newline at end of file +var _0xece3=['mandatoryDispositionPauseId','gmail','hotmail','yahoo','outlook365','provider','custom','getDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','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'];(function(_0x1389ae,_0x1caf91){var _0x1514d4=function(_0x41bb97){while(--_0x41bb97){_0x1389ae['push'](_0x1389ae['shift']());}};_0x1514d4(++_0x1caf91);}(_0xece3,0x14c));var _0x3ece=function(_0x96b6a,_0x12471d){_0x96b6a=_0x96b6a-0x0;var _0x3e16f3=_0xece3[_0x96b6a];return _0x3e16f3;};'use strict';var Sequelize=require(_0x3ece('0x0'));module[_0x3ece('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x3ece('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x3ece('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3ece('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x3ece('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x3ece('0x4')]},'markAsUnread':{'type':Sequelize[_0x3ece('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x3ece('0x2')],'allowNull':![],'defaultValue':_0x3ece('0x5')},'fontSize':{'type':Sequelize[_0x3ece('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x3ece('0x4')],'defaultValue':function(){return _0x3ece('0x7');}},'notificationSound':{'type':Sequelize[_0x3ece('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3ece('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3ece('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3ece('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3ece('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3ece('0x3')],'defaultValue':![],'comment':_0x3ece('0x8'),'set':function(_0x308d43){if(!_0x308d43)this[_0x3ece('0x9')](_0x3ece('0xa'),null);this[_0x3ece('0x9')]('mandatoryDisposition',_0x308d43);}},'provider':{'type':Sequelize['ENUM'](_0x3ece('0xb'),_0x3ece('0xc'),_0x3ece('0xd'),_0x3ece('0xe')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x3ece('0xf')))return _0x3ece('0x10');return this[_0x3ece('0x11')]('provider');},'set':function(_0x190996){if(_0x190996===_0x3ece('0x10'))_0x190996=null;return this[_0x3ece('0x9')](_0x3ece('0xf'),_0x190996);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ae65dca..729a767 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 _0xcdae=['active','role','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','addSmtp','removeSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','User','fullname','internal','Tag','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','send','getApplications','MailMessage','$gte','split','format','true','CmList','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','sendMail','List','List\x20not\x20found','ListId','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','moment','bluebird','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','get','end','stack','name','gmail','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.mail.yahoo.com','hotmail','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','MailAccount','includeAll','include','findAll','show','keys','find','catch','body','provider','params','MailServerIn','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','findOne','nolimit','Disposition','rows','ids','addAnswer','CannedAnswer','getAnswers','sort','removeAnswers','custom','email'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xcdae,0x108));var _0xecda=function(_0x71da3d,_0xe09954){_0x71da3d=_0x71da3d-0x0;var _0x4688ad=_0xcdae[_0x71da3d];return _0x4688ad;};'use strict';var moment=require(_0xecda('0x0'));var BPromise=require(_0xecda('0x1'));var util=require('util');var path=require('path');var _=require(_0xecda('0x2'));var juice=require('juice');var Redis=require(_0xecda('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xecda('0x4'))(_0xecda('0x5'));var config=require(_0xecda('0x6'));var db=require(_0xecda('0x7'))['db'];config['redis']=_[_0xecda('0x8')](config['redis'],{'host':_0xecda('0x9'),'port':0x18eb});var socket=require(_0xecda('0xa'))(new Redis(config[_0xecda('0xb')]));require(_0xecda('0xc'))[_0xecda('0xd')](socket);var jayson=require(_0xecda('0xe'));var client=jayson[_0xecda('0xf')][_0xecda('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x559b4d,_0x4c5920,_0x5dac78,_0x378438){return new BPromise(function(_0x26ef96,_0x581ca5){var _0xa2cf6b=_0x378438||client;return _0xa2cf6b['request'](_0x559b4d,_0x5dac78)[_0xecda('0x11')](function(_0x8df394){logger[_0xecda('0x12')](_0xecda('0x13'),_0x4c5920,'request\x20sent');logger[_0xecda('0x14')](_0xecda('0x15'),_0x4c5920,'request\x20sent',JSON[_0xecda('0x16')](_0x8df394));if(_0x8df394[_0xecda('0x17')]){if(_0x8df394[_0xecda('0x17')][_0xecda('0x18')]===0x1f4){logger[_0xecda('0x17')]('MailAccount,\x20%s,\x20%s',_0x4c5920,_0x8df394[_0xecda('0x17')][_0xecda('0x19')]);return _0x581ca5(_0x8df394['error'][_0xecda('0x19')]);}logger[_0xecda('0x17')](_0xecda('0x13'),_0x4c5920,_0x8df394[_0xecda('0x17')][_0xecda('0x19')]);return _0x26ef96(_0x8df394[_0xecda('0x17')]['message']);}else{logger[_0xecda('0x12')](_0xecda('0x13'),_0x4c5920,_0xecda('0x1a'));_0x26ef96(_0x8df394[_0xecda('0x1b')][_0xecda('0x19')]);}})['catch'](function(_0x5beb60){logger[_0xecda('0x17')](_0xecda('0x13'),_0x4c5920,_0x5beb60);_0x581ca5(_0x5beb60);});});}function respondWithStatusCode(_0x14f3bf,_0x42541d){_0x42541d=_0x42541d||0xcc;return function(_0x1f00c6){if(_0x1f00c6){return _0x14f3bf[_0xecda('0x1c')](_0x42541d);}return _0x14f3bf[_0xecda('0x1d')](_0x42541d)['end']();};}function respondWithResult(_0x5279f3,_0x59947f){_0x59947f=_0x59947f||0xc8;return function(_0x550715){if(_0x550715){return _0x5279f3[_0xecda('0x1d')](_0x59947f)['json'](_0x550715);}};}function respondWithFilteredResult(_0x45314c,_0xd2e2dc){return function(_0x378bdb){if(_0x378bdb){var _0xa84a1f=typeof _0xd2e2dc[_0xecda('0x1e')]===_0xecda('0x1f')&&typeof _0xd2e2dc['limit']===_0xecda('0x1f');var _0x203675=_0x378bdb['count'];var _0x46574a=_0xa84a1f?0x0:_0xd2e2dc[_0xecda('0x1e')];var _0xd46e81=_0xa84a1f?_0x378bdb[_0xecda('0x20')]:_0xd2e2dc['offset']+_0xd2e2dc[_0xecda('0x21')];var _0x541e3e;if(_0xd46e81>=_0x203675){_0xd46e81=_0x203675;_0x541e3e=0xc8;}else{_0x541e3e=0xce;}_0x45314c[_0xecda('0x1d')](_0x541e3e);return _0x45314c[_0xecda('0x22')](_0xecda('0x23'),_0x46574a+'-'+_0xd46e81+'/'+_0x203675)[_0xecda('0x24')](_0x378bdb);}return null;};}function saveUpdates(_0x36dc6c){return function(_0x111fd3){if(_0x111fd3){return _0x111fd3[_0xecda('0x25')](_0x36dc6c)[_0xecda('0x11')](function(_0x10af82){return _0x10af82;});}return null;};}function removeEntity(_0x31ed9c){return function(_0x62826d){if(_0x62826d){return _0x62826d[_0xecda('0x26')]()[_0xecda('0x11')](function(){var _0x565398=_0x62826d[_0xecda('0x27')]({'plain':!![]});var _0x36d6ff='MailAccounts';return db['UserProfileResource'][_0xecda('0x26')]({'where':{'type':_0x36d6ff,'resourceId':_0x565398['id']}})[_0xecda('0x11')](function(){return _0x62826d;});})['then'](function(){_0x31ed9c['status'](0xcc)[_0xecda('0x28')]();});}};}function handleEntityNotFound(_0x3aa872){return function(_0x5f2520){if(!_0x5f2520){_0x3aa872[_0xecda('0x1c')](0x194);}return _0x5f2520;};}function handleError(_0x5677cf,_0x45bb67){_0x45bb67=_0x45bb67||0x1f4;return function(_0x37cf6a){logger[_0xecda('0x17')](_0x37cf6a[_0xecda('0x29')]);if(_0x37cf6a[_0xecda('0x2a')]){delete _0x37cf6a['name'];}_0x5677cf[_0xecda('0x1d')](_0x45bb67)['send'](_0x37cf6a);};}function getImapHost(_0x21c0f4){switch(_0x21c0f4){case _0xecda('0x2b'):return'imap.gmail.com';case _0xecda('0x2c'):return _0xecda('0x2d');case'hotmail':return _0xecda('0x2e');case _0xecda('0x2f'):return _0xecda('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x21c0f4);}function getSmtpHost(_0x21eace){switch(_0x21eace){case _0xecda('0x2b'):return'smtp.gmail.com';case _0xecda('0x2c'):return _0xecda('0x31');case _0xecda('0x32'):return'smtp-mail.outlook.com';case _0xecda('0x2f'):return'smtp.office365.com';}throw new Error(_0xecda('0x33'),_0x21eace);}function getAuthenticationOptions(_0x124a2b,_0x1a3702){var _0x21246c={};var _0x29984f={};if(_0x124a2b){_0x21246c[_0xecda('0x34')]=_0x29984f[_0xecda('0x34')]=_0x1a3702[_0xecda('0x35')];_0x21246c[_0xecda('0x36')]=_0x29984f[_0xecda('0x37')]=_0x1a3702[_0xecda('0x36')];if(_0x1a3702[_0xecda('0x38')]){_0x21246c[_0xecda('0x38')]=_0x29984f[_0xecda('0x38')]=!![];_0x21246c[_0xecda('0x39')]=_0x29984f['CloudProviderId']=_0x1a3702['CloudProviderId'];_0x21246c[_0xecda('0x36')]=_0x29984f[_0xecda('0x37')]=null;}else{_0x21246c[_0xecda('0x39')]=_0x29984f['CloudProviderId']=null;}_0x21246c[_0xecda('0x3a')]=getImapHost(_0x124a2b);_0x21246c[_0xecda('0x3b')]=0x3e1;_0x29984f[_0xecda('0x3a')]=getSmtpHost(_0x124a2b);_0x29984f[_0xecda('0x3b')]=0x24b;_0x29984f[_0xecda('0x3c')]=![];_0x21246c[_0xecda('0x3d')]=_0x29984f[_0xecda('0x3d')]=null;}else{if(_0x1a3702[_0xecda('0x3e')]){_0x21246c[_0xecda('0x34')]=_0x29984f['user']=_0x1a3702[_0xecda('0x35')];_0x21246c[_0xecda('0x36')]=_0x29984f[_0xecda('0x37')]=_0x1a3702[_0xecda('0x36')];}else{_0x21246c[_0xecda('0x3e')]=_0x29984f[_0xecda('0x3e')]=![];_0x21246c[_0xecda('0x34')]=_0x29984f[_0xecda('0x34')]=null;_0x21246c[_0xecda('0x36')]=_0x29984f[_0xecda('0x37')]=null;}_0x21246c[_0xecda('0x3a')]=_0x1a3702[_0xecda('0x3f')][_0xecda('0x3a')];_0x21246c[_0xecda('0x3b')]=_0x1a3702['Imap'][_0xecda('0x3b')];_0x29984f[_0xecda('0x3a')]=_0x1a3702[_0xecda('0x40')][_0xecda('0x3a')];_0x29984f[_0xecda('0x3b')]=_0x1a3702[_0xecda('0x40')][_0xecda('0x3b')];}return{'Imap':_0x21246c,'Smtp':_0x29984f};}exports[_0xecda('0x41')]=function(_0x7073b1,_0x26ba5a){var _0x1b2474={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xecda('0x42')],'as':_0xecda('0x40')},{'model':db[_0xecda('0x43')],'as':_0xecda('0x44')}]},_0x318f6e={},_0x95b97d={'count':0x0,'rows':[]};var _0x231e11=_[_0xecda('0x45')](db['MailAccount'][_0xecda('0x46')],function(_0x8dcdc7){return{'name':_0x8dcdc7[_0xecda('0x47')],'type':_0x8dcdc7[_0xecda('0x48')][_0xecda('0x49')]};});_0x318f6e[_0xecda('0x4a')]=_[_0xecda('0x45')](_0x231e11,_0xecda('0x2a'));_0x318f6e[_0xecda('0x4b')]=_['keys'](_0x7073b1['query']);_0x318f6e[_0xecda('0x4c')]=_[_0xecda('0x4d')](_0x318f6e[_0xecda('0x4a')],_0x318f6e[_0xecda('0x4b')]);_0x1b2474[_0xecda('0x4e')]=_[_0xecda('0x4d')](_0x318f6e['model'],qs[_0xecda('0x4f')](_0x7073b1['query'][_0xecda('0x4f')]));_0x1b2474[_0xecda('0x4e')]=_0x1b2474[_0xecda('0x4e')][_0xecda('0x50')]?_0x1b2474[_0xecda('0x4e')]:_0x318f6e[_0xecda('0x4a')];if(!_0x7073b1[_0xecda('0x4b')][_0xecda('0x51')]('nolimit')){_0x1b2474[_0xecda('0x21')]=qs['limit'](_0x7073b1[_0xecda('0x4b')][_0xecda('0x21')]);_0x1b2474[_0xecda('0x1e')]=qs['offset'](_0x7073b1[_0xecda('0x4b')][_0xecda('0x1e')]);}_0x1b2474[_0xecda('0x52')]=qs['sort'](_0x7073b1[_0xecda('0x4b')]['sort']);_0x1b2474[_0xecda('0x53')]=qs['filters'](_[_0xecda('0x54')](_0x7073b1[_0xecda('0x4b')],_0x318f6e['filters']),_0x231e11);if(_0x7073b1[_0xecda('0x4b')]['filter']){_0x1b2474[_0xecda('0x53')]=_[_0xecda('0x55')](_0x1b2474['where'],{'$or':_[_0xecda('0x45')](_0x231e11,function(_0x33e173){if(_0x33e173[_0xecda('0x48')]!==_0xecda('0x56')){var _0x3f2c72={};_0x3f2c72[_0x33e173['name']]={'$like':'%'+_0x7073b1[_0xecda('0x4b')][_0xecda('0x57')]+'%'};return _0x3f2c72;}})});}_0x1b2474=_[_0xecda('0x55')]({},_0x1b2474,_0x7073b1[_0xecda('0x58')]);var _0x54e875={'where':_0x1b2474[_0xecda('0x53')]};return db[_0xecda('0x59')][_0xecda('0x20')](_0x54e875)['then'](function(_0x41ccdd){_0x95b97d[_0xecda('0x20')]=_0x41ccdd;if(_0x7073b1[_0xecda('0x4b')][_0xecda('0x5a')]){_0x1b2474[_0xecda('0x5b')]=[{'all':!![]}];}return db[_0xecda('0x59')][_0xecda('0x5c')](_0x1b2474);})[_0xecda('0x11')](function(_0x2117fd){_0x95b97d['rows']=_0x2117fd;return _0x95b97d;})[_0xecda('0x11')](respondWithFilteredResult(_0x26ba5a,_0x1b2474))['catch'](handleError(_0x26ba5a,null));};exports[_0xecda('0x5d')]=function(_0x333afe,_0x4d0f35){var _0x4d7697={'raw':![],'where':{'id':_0x333afe['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xecda('0x3f')},{'model':db[_0xecda('0x42')],'as':_0xecda('0x40')},{'model':db[_0xecda('0x43')],'as':_0xecda('0x44')}]},_0x2f78d1={};_0x2f78d1[_0xecda('0x4a')]=_[_0xecda('0x5e')](db[_0xecda('0x59')][_0xecda('0x46')]);_0x2f78d1['query']=_[_0xecda('0x5e')](_0x333afe[_0xecda('0x4b')]);_0x2f78d1['filters']=_[_0xecda('0x4d')](_0x2f78d1['model'],_0x2f78d1[_0xecda('0x4b')]);_0x4d7697[_0xecda('0x4e')]=_[_0xecda('0x4d')](_0x2f78d1[_0xecda('0x4a')],qs[_0xecda('0x4f')](_0x333afe['query'][_0xecda('0x4f')]));_0x4d7697['attributes']=_0x4d7697['attributes'][_0xecda('0x50')]?_0x4d7697['attributes']:_0x2f78d1['model'];if(_0x333afe[_0xecda('0x4b')][_0xecda('0x5a')]){_0x4d7697['include']=[{'all':!![]}];}_0x4d7697=_[_0xecda('0x55')]({},_0x4d7697,_0x333afe[_0xecda('0x58')]);return db[_0xecda('0x59')][_0xecda('0x5f')](_0x4d7697)[_0xecda('0x11')](handleEntityNotFound(_0x4d0f35,null))['then'](respondWithResult(_0x4d0f35,null))[_0xecda('0x60')](handleError(_0x4d0f35,null));};exports[_0xecda('0x25')]=function(_0x31f569,_0x559669){if(_0x31f569['body']['id']){delete _0x31f569[_0xecda('0x61')]['id'];}var _0x2b0e97=_0x31f569[_0xecda('0x61')]['provider']==='custom'?null:_0x31f569[_0xecda('0x61')][_0xecda('0x62')];var _0x4409a2=_0x31f569[_0xecda('0x61')][_0xecda('0x3f')]||{};var _0x4570b7=_0x31f569[_0xecda('0x61')]['Smtp']||{};if(_0x2b0e97){_0x4409a2['host']=getImapHost(_0x2b0e97);_0x4409a2['port']=0x3e1;_0x4570b7[_0xecda('0x3a')]=getSmtpHost(_0x2b0e97);_0x4570b7[_0xecda('0x3b')]=0x24b;_0x4570b7[_0xecda('0x3c')]=![];}if(_0x4570b7[_0xecda('0x38')]){_0x4570b7[_0xecda('0x3c')]=![];}else{_0x4570b7['CloudProviderId']=null;}if(!_0x4409a2[_0xecda('0x38')])_0x4409a2['CloudProviderId']=null;_0x31f569[_0xecda('0x61')][_0xecda('0x3f')]=_0x4409a2;_0x31f569[_0xecda('0x61')][_0xecda('0x40')]=_0x4570b7;return db[_0xecda('0x59')][_0xecda('0x5f')]({'where':{'id':_0x31f569[_0xecda('0x63')]['id']},'include':[{'model':db[_0xecda('0x64')],'as':_0xecda('0x3f')},{'model':db[_0xecda('0x42')],'as':'Smtp'},{'model':db[_0xecda('0x43')],'as':_0xecda('0x44')}]})[_0xecda('0x11')](handleEntityNotFound(_0x559669,null))['then'](function(_0x3c5f0f){if(!_0x3c5f0f)throw new Error(_0xecda('0x65'));if(_0x3c5f0f['service'])delete _0x31f569[_0xecda('0x61')][_0xecda('0x3f')];return _0x3c5f0f;})['then'](saveUpdates(_0x31f569['body'],null))[_0xecda('0x11')](function(_0x25b2c7){if(!_0x31f569[_0xecda('0x61')][_0xecda('0x3f')])return _0x25b2c7;return db['MailServerIn'][_0xecda('0x25')](_0x31f569[_0xecda('0x61')][_0xecda('0x3f')],{'where':{'MailAccountId':_0x25b2c7['id']}})['then'](function(){return _0x25b2c7;});})[_0xecda('0x11')](function(_0x512e26){if(!_0x31f569['body'][_0xecda('0x40')])return _0x512e26;return db[_0xecda('0x42')]['update'](_0x31f569[_0xecda('0x61')][_0xecda('0x40')],{'where':{'MailAccountId':_0x512e26['id']}})[_0xecda('0x11')](function(){return _0x512e26;});})[_0xecda('0x11')](respondWithResult(_0x559669,null))[_0xecda('0x60')](handleError(_0x559669,null));};exports[_0xecda('0x66')]=function(_0x21f781,_0x279e51){return db[_0xecda('0x59')][_0xecda('0x66')]()[_0xecda('0x11')](respondWithResult(_0x279e51,null))[_0xecda('0x60')](handleError(_0x279e51,null));};exports[_0xecda('0x67')]=function(_0x8e03f9,_0x46321d){if(_0x8e03f9[_0xecda('0x61')]['id']){delete _0x8e03f9[_0xecda('0x61')]['id'];}return db[_0xecda('0x59')][_0xecda('0x5f')]({'where':{'id':_0x8e03f9[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x46321d,null))[_0xecda('0x11')](function(_0x1d51d7){if(_0x1d51d7){_0x8e03f9['body'][_0xecda('0x68')]=_0x1d51d7['id'];return db['Disposition'][_0xecda('0x69')](_0x8e03f9['body']);}})['then'](respondWithResult(_0x46321d,null))[_0xecda('0x60')](handleError(_0x46321d,null));};exports['getDispositions']=function(_0x4d6ac2,_0x37cd3b){var _0x227b60={'raw':![],'where':{}};var _0x43680a={};var _0x41e27b={'count':0x0,'rows':[]};return db['MailAccount'][_0xecda('0x6a')]({'where':{'id':_0x4d6ac2[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x37cd3b,null))[_0xecda('0x11')](function(_0x544984){if(_0x544984){_0x43680a['model']=_['keys'](db['Disposition'][_0xecda('0x46')]);_0x43680a['query']=_['keys'](_0x4d6ac2['query']);_0x43680a[_0xecda('0x4c')]=_['intersection'](_0x43680a[_0xecda('0x4a')],_0x43680a[_0xecda('0x4b')]);_0x227b60[_0xecda('0x4e')]=_[_0xecda('0x4d')](_0x43680a[_0xecda('0x4a')],qs['fields'](_0x4d6ac2[_0xecda('0x4b')][_0xecda('0x4f')]));_0x227b60[_0xecda('0x4e')]=_0x227b60[_0xecda('0x4e')]['length']?_0x227b60[_0xecda('0x4e')]:_0x43680a[_0xecda('0x4a')];if(!_0x4d6ac2[_0xecda('0x4b')][_0xecda('0x51')](_0xecda('0x6b'))){_0x227b60[_0xecda('0x21')]=qs['limit'](_0x4d6ac2[_0xecda('0x4b')]['limit']);_0x227b60['offset']=qs[_0xecda('0x1e')](_0x4d6ac2['query']['offset']);}_0x227b60[_0xecda('0x52')]=qs['sort'](_0x4d6ac2['query']['sort']);_0x227b60[_0xecda('0x53')]=qs[_0xecda('0x4c')](_[_0xecda('0x54')](_0x4d6ac2[_0xecda('0x4b')],_0x43680a[_0xecda('0x4c')]));_0x227b60[_0xecda('0x53')][_0xecda('0x68')]=_0x544984['id'];if(_0x4d6ac2[_0xecda('0x4b')][_0xecda('0x57')]){_0x227b60[_0xecda('0x53')]=_['merge'](_0x227b60['where'],{'$or':_[_0xecda('0x45')](_0x227b60[_0xecda('0x4e')],function(_0x2bd649){var _0x46784e={};_0x46784e[_0x2bd649]={'$like':'%'+_0x4d6ac2[_0xecda('0x4b')][_0xecda('0x57')]+'%'};return _0x46784e;})});}_0x227b60=_[_0xecda('0x55')]({},_0x227b60,_0x4d6ac2[_0xecda('0x58')]);return db['Disposition'][_0xecda('0x20')]({'where':_0x227b60[_0xecda('0x53')]})[_0xecda('0x11')](function(_0x498233){_0x41e27b['count']=_0x498233;if(_0x4d6ac2['query'][_0xecda('0x5a')]){_0x227b60[_0xecda('0x5b')]=[{'all':!![]}];}return db[_0xecda('0x6c')]['findAll'](_0x227b60);})[_0xecda('0x11')](function(_0x216e54){_0x41e27b[_0xecda('0x6d')]=_0x216e54;return _0x41e27b;});}})['then'](respondWithFilteredResult(_0x37cd3b,_0x227b60))[_0xecda('0x60')](handleError(_0x37cd3b,null));};exports['removeDispositions']=function(_0x21d187,_0x3a624d){return db['MailAccount'][_0xecda('0x5f')]({'where':{'id':_0x21d187[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x3a624d,null))[_0xecda('0x11')](function(_0x13181c){if(_0x13181c){return _0x13181c['removeDispositions'](_0x21d187['query'][_0xecda('0x6e')]);}})[_0xecda('0x11')](respondWithStatusCode(_0x3a624d,null))['catch'](handleError(_0x3a624d,null));};exports[_0xecda('0x6f')]=function(_0x4f01e8,_0x393366){if(_0x4f01e8[_0xecda('0x61')]['id']){delete _0x4f01e8[_0xecda('0x61')]['id'];}return db[_0xecda('0x59')][_0xecda('0x5f')]({'where':{'id':_0x4f01e8[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x393366,null))[_0xecda('0x11')](function(_0x27a139){if(_0x27a139){_0x4f01e8['body'][_0xecda('0x68')]=_0x27a139['id'];return db[_0xecda('0x70')][_0xecda('0x69')](_0x4f01e8[_0xecda('0x61')]);}})[_0xecda('0x11')](respondWithResult(_0x393366,null))[_0xecda('0x60')](handleError(_0x393366,null));};exports[_0xecda('0x71')]=function(_0x65a550,_0x25555f){var _0x1468b6={'raw':![],'where':{}};var _0x3da455={};var _0x39ba83={'count':0x0,'rows':[]};return db[_0xecda('0x59')]['findOne']({'where':{'id':_0x65a550[_0xecda('0x63')]['id']}})['then'](handleEntityNotFound(_0x25555f,null))[_0xecda('0x11')](function(_0x4c0011){if(_0x4c0011){_0x3da455[_0xecda('0x4a')]=_[_0xecda('0x5e')](db[_0xecda('0x70')][_0xecda('0x46')]);_0x3da455[_0xecda('0x4b')]=_['keys'](_0x65a550[_0xecda('0x4b')]);_0x3da455[_0xecda('0x4c')]=_[_0xecda('0x4d')](_0x3da455['model'],_0x3da455[_0xecda('0x4b')]);_0x1468b6[_0xecda('0x4e')]=_[_0xecda('0x4d')](_0x3da455[_0xecda('0x4a')],qs[_0xecda('0x4f')](_0x65a550[_0xecda('0x4b')][_0xecda('0x4f')]));_0x1468b6[_0xecda('0x4e')]=_0x1468b6['attributes'][_0xecda('0x50')]?_0x1468b6[_0xecda('0x4e')]:_0x3da455[_0xecda('0x4a')];if(!_0x65a550['query'][_0xecda('0x51')](_0xecda('0x6b'))){_0x1468b6['limit']=qs[_0xecda('0x21')](_0x65a550['query']['limit']);_0x1468b6[_0xecda('0x1e')]=qs[_0xecda('0x1e')](_0x65a550[_0xecda('0x4b')]['offset']);}_0x1468b6[_0xecda('0x52')]=qs[_0xecda('0x72')](_0x65a550[_0xecda('0x4b')][_0xecda('0x72')]);_0x1468b6[_0xecda('0x53')]=qs[_0xecda('0x4c')](_[_0xecda('0x54')](_0x65a550[_0xecda('0x4b')],_0x3da455[_0xecda('0x4c')]));_0x1468b6['where'][_0xecda('0x68')]=_0x4c0011['id'];if(_0x65a550['query'][_0xecda('0x57')]){_0x1468b6[_0xecda('0x53')]=_[_0xecda('0x55')](_0x1468b6['where'],{'$or':_[_0xecda('0x45')](_0x1468b6[_0xecda('0x4e')],function(_0xc9ad56){var _0x47d5f0={};_0x47d5f0[_0xc9ad56]={'$like':'%'+_0x65a550[_0xecda('0x4b')][_0xecda('0x57')]+'%'};return _0x47d5f0;})});}_0x1468b6=_[_0xecda('0x55')]({},_0x1468b6,_0x65a550[_0xecda('0x58')]);return db['CannedAnswer'][_0xecda('0x20')]({'where':_0x1468b6[_0xecda('0x53')]})['then'](function(_0xdd48df){_0x39ba83[_0xecda('0x20')]=_0xdd48df;if(_0x65a550[_0xecda('0x4b')][_0xecda('0x5a')]){_0x1468b6['include']=[{'all':!![]}];}return db[_0xecda('0x70')][_0xecda('0x5c')](_0x1468b6);})['then'](function(_0x375e64){_0x39ba83[_0xecda('0x6d')]=_0x375e64;return _0x39ba83;});}})['then'](respondWithFilteredResult(_0x25555f,_0x1468b6))[_0xecda('0x60')](handleError(_0x25555f,null));};exports[_0xecda('0x73')]=function(_0x1dd5b4,_0x35dc09){return db[_0xecda('0x59')][_0xecda('0x5f')]({'where':{'id':_0x1dd5b4[_0xecda('0x63')]['id']}})['then'](handleEntityNotFound(_0x35dc09,null))[_0xecda('0x11')](function(_0x3990de){if(_0x3990de){return _0x3990de[_0xecda('0x73')](_0x1dd5b4[_0xecda('0x4b')][_0xecda('0x6e')]);}})[_0xecda('0x11')](respondWithStatusCode(_0x35dc09,null))['catch'](handleError(_0x35dc09,null));};exports['create']=function(_0x2d51ed,_0x36a001){var _0x18b7eb={'name':_0x2d51ed['body'][_0xecda('0x2a')],'key':_0x2d51ed[_0xecda('0x61')][_0xecda('0x49')],'provider':_0x2d51ed['body'][_0xecda('0x62')]===_0xecda('0x74')?null:_0x2d51ed[_0xecda('0x61')]['provider'],'email':_0x2d51ed[_0xecda('0x61')][_0xecda('0x75')],'ListId':_0x2d51ed[_0xecda('0x61')]['ListId'],'active':!_['isNil'](_0x2d51ed[_0xecda('0x61')][_0xecda('0x76')])?_0x2d51ed[_0xecda('0x61')][_0xecda('0x76')]:!![],'description':_0x2d51ed[_0xecda('0x61')]['description']||null};var _0x228dc5=getAuthenticationOptions(_0x18b7eb['provider'],_0x2d51ed[_0xecda('0x61')]);_0x18b7eb[_0xecda('0x3f')]=_0x228dc5['Imap'];_0x18b7eb[_0xecda('0x40')]=_0x228dc5['Smtp'];return db[_0xecda('0x59')]['create'](_0x18b7eb,{'include':[{'model':db[_0xecda('0x42')],'as':'Smtp'},{'model':db[_0xecda('0x64')],'as':'Imap'}]})[_0xecda('0x11')](function(_0x355f1a){var _0x2933e9=_0x2d51ed[_0xecda('0x34')]['get']({'plain':!![]});if(!_0x2933e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2933e9[_0xecda('0x77')]===_0xecda('0x34')){var _0x3a0125=_0x355f1a[_0xecda('0x27')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xecda('0x78'),'userProfileId':_0x2933e9[_0xecda('0x79')]},'raw':!![]})[_0xecda('0x11')](function(_0x3447a1){if(_0x3447a1&&_0x3447a1[_0xecda('0x7a')]===0x0){return db[_0xecda('0x7b')][_0xecda('0x69')]({'name':_0x3a0125[_0xecda('0x2a')],'resourceId':_0x3a0125['id'],'type':_0x3447a1[_0xecda('0x2a')],'sectionId':_0x3447a1['id']},{})['then'](function(){return _0x355f1a;});}else{return _0x355f1a;}})[_0xecda('0x60')](function(_0x29adff){logger[_0xecda('0x17')](_0xecda('0x7c'),_0x29adff);throw _0x29adff;});}return _0x355f1a;})[_0xecda('0x11')](respondWithResult(_0x36a001,0xc9))[_0xecda('0x60')](handleError(_0x36a001,null));};exports[_0xecda('0x7d')]=function(_0xd23580,_0x18433a){return db['MailAccount']['findOne']({'where':{'id':_0xd23580[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x18433a,null))[_0xecda('0x11')](function(_0x2dffba){if(_0x2dffba){return _0x2dffba[_0xecda('0x7d')]();}return null;})['then'](respondWithResult(_0x18433a,null))['catch'](handleError(_0x18433a,null));};exports[_0xecda('0x7e')]=function(_0x155a79,_0x53469d){if(_0x155a79[_0xecda('0x61')]['id']){delete _0x155a79[_0xecda('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x155a79['params']['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x53469d,null))['then'](function(_0x113788){if(_0x113788){_0x155a79[_0xecda('0x61')]['MailAccountId']=_0x113788['id'];return db['MailServerIn'][_0xecda('0x69')](_0x155a79[_0xecda('0x61')]);}})[_0xecda('0x11')](respondWithResult(_0x53469d,null))[_0xecda('0x60')](handleError(_0x53469d,null));};exports[_0xecda('0x7f')]=function(_0x2cf437,_0x3836ac){return db[_0xecda('0x59')][_0xecda('0x6a')]({'where':{'id':_0x2cf437[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x3836ac,null))['then'](function(_0xb2ef22){if(_0xb2ef22){return _0xb2ef22[_0xecda('0x80')](null);}return null;})[_0xecda('0x11')](respondWithStatusCode(_0x3836ac,null))[_0xecda('0x60')](handleError(_0x3836ac,null));};exports['getSmtp']=function(_0x55119d,_0xcceb10){return db[_0xecda('0x59')][_0xecda('0x6a')]({'where':{'id':_0x55119d[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0xcceb10,null))[_0xecda('0x11')](function(_0x1b7e29){if(_0x1b7e29){return _0x1b7e29['getSmtp']();}return null;})[_0xecda('0x11')](respondWithResult(_0xcceb10,null))[_0xecda('0x60')](handleError(_0xcceb10,null));};exports[_0xecda('0x81')]=function(_0x4ff150,_0x42d1f0){if(_0x4ff150[_0xecda('0x61')]['id']){delete _0x4ff150['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x4ff150[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x42d1f0,null))['then'](function(_0x566090){if(_0x566090){_0x4ff150[_0xecda('0x61')][_0xecda('0x68')]=_0x566090['id'];return db[_0xecda('0x42')]['create'](_0x4ff150[_0xecda('0x61')]);}})[_0xecda('0x11')](respondWithResult(_0x42d1f0,null))[_0xecda('0x60')](handleError(_0x42d1f0,null));};exports[_0xecda('0x82')]=function(_0x348b72,_0x616750){return db[_0xecda('0x59')]['findOne']({'where':{'id':_0x348b72['params']['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x616750,null))[_0xecda('0x11')](function(_0x188c60){if(_0x188c60){return _0x188c60['setSmtp'](null);}return null;})[_0xecda('0x11')](respondWithStatusCode(_0x616750,null))[_0xecda('0x60')](handleError(_0x616750,null));};exports[_0xecda('0x83')]=function(_0x1ae037,_0x265081){return db['MailInteraction'][_0xecda('0x5f')]({'where':{'id':_0x1ae037[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x265081,null))[_0xecda('0x11')](function(_0x40b4c2){if(_0x40b4c2){return _0x40b4c2[_0xecda('0x83')](_0x1ae037[_0xecda('0x61')][_0xecda('0x6e')],_[_0xecda('0x84')](_0x1ae037[_0xecda('0x61')],['ids','id'])||{});}})[_0xecda('0x11')](respondWithResult(_0x265081,null))['catch'](handleError(_0x265081,null));};exports['getInteractions']=function(_0x82a616,_0x2b11a5){var _0x44a78e={'raw':![],'where':{}};var _0x3a5d27={};var _0x5c5515={'count':0x0,'rows':[]};return db[_0xecda('0x59')][_0xecda('0x6a')]({'where':{'id':_0x82a616[_0xecda('0x63')]['id']}})['then'](handleEntityNotFound(_0x2b11a5,null))['then'](function(_0x8e5d6c){if(_0x8e5d6c){_0x3a5d27[_0xecda('0x4a')]=_[_0xecda('0x5e')](db[_0xecda('0x85')][_0xecda('0x46')]);_0x3a5d27['query']=_[_0xecda('0x5e')](_0x82a616[_0xecda('0x4b')]);_0x3a5d27[_0xecda('0x4c')]=_[_0xecda('0x4d')](_0x3a5d27[_0xecda('0x4a')],_0x3a5d27[_0xecda('0x4b')]);_0x44a78e[_0xecda('0x4e')]=_[_0xecda('0x4d')](_0x3a5d27['model'],qs[_0xecda('0x4f')](_0x82a616['query'][_0xecda('0x4f')]));_0x44a78e['attributes']=_0x44a78e[_0xecda('0x4e')]['length']?_0x44a78e[_0xecda('0x4e')]:_0x3a5d27['model'];if(!_0x82a616[_0xecda('0x4b')][_0xecda('0x51')](_0xecda('0x6b'))){_0x44a78e[_0xecda('0x21')]=qs['limit'](_0x82a616[_0xecda('0x4b')][_0xecda('0x21')]);_0x44a78e[_0xecda('0x1e')]=qs['offset'](_0x82a616[_0xecda('0x4b')][_0xecda('0x1e')]);}_0x44a78e['order']=qs[_0xecda('0x72')](_0x82a616[_0xecda('0x4b')][_0xecda('0x72')]);_0x44a78e['where']=qs[_0xecda('0x4c')](_[_0xecda('0x54')](_0x82a616['query'],_0x3a5d27[_0xecda('0x4c')]));_0x44a78e['where'][_0xecda('0x68')]=_0x8e5d6c['id'];if(_0x82a616[_0xecda('0x4b')][_0xecda('0x57')]){_0x44a78e['where']=_['merge'](_0x44a78e['where'],{'$or':_[_0xecda('0x45')](_0x44a78e['attributes'],function(_0x17e7f6){var _0x43249d={};_0x43249d[_0x17e7f6]={'$like':'%'+_0x82a616['query']['filter']+'%'};return _0x43249d;})});}_0x44a78e=_[_0xecda('0x55')]({},_0x44a78e,_0x82a616['options']);return db[_0xecda('0x85')][_0xecda('0x20')]({'where':_0x44a78e[_0xecda('0x53')]})['then'](function(_0x1e08b4){_0x5c5515['count']=_0x1e08b4;if(_0x82a616[_0xecda('0x4b')][_0xecda('0x5a')]){_0x44a78e['include']=[{'model':db[_0xecda('0x86')],'as':_0xecda('0x87'),'required':![]},{'model':db[_0xecda('0x88')],'as':'Owner','attributes':[_0xecda('0x2a'),_0xecda('0x89'),_0xecda('0x8a')],'required':![]},{'model':db[_0xecda('0x8b')],'as':'Tags','attributes':['id',_0xecda('0x2a'),'color'],'where':_0x82a616[_0xecda('0x4b')][_0xecda('0x8c')]?{'id':_0x82a616[_0xecda('0x4b')]['tag']}:undefined,'required':_0x82a616['query']['tag']?!![]:![]}];}return db[_0xecda('0x85')][_0xecda('0x5c')](_0x44a78e);})['then'](function(_0x341f2b){_0x5c5515[_0xecda('0x6d')]=_0x341f2b;return _0x5c5515;});}})[_0xecda('0x11')](respondWithFilteredResult(_0x2b11a5,_0x44a78e))[_0xecda('0x60')](handleError(_0x2b11a5,null));};exports[_0xecda('0x8d')]=function addApplications(_0x361336,_0x1e1b23){var _0x241cab=_0x361336[_0xecda('0x63')]['id'];var _0x456b7e=_0x361336[_0xecda('0x61')];var _0x497191=0xc8;var _0x1e5992=null;return db['sequelize'][_0xecda('0x8e')]({'isolationLevel':db[_0xecda('0x8f')][_0xecda('0x90')][_0xecda('0x91')][_0xecda('0x92')]},function(_0x48260d){return db[_0xecda('0x59')][_0xecda('0x6a')]({'where':{'id':_0x241cab},'transaction':_0x48260d})['then'](function(_0x2d1b46){if(_0x2d1b46){return db['MailApplication'][_0xecda('0x26')]({'where':{'MailAccountId':_0x241cab},'transaction':_0x48260d})['then'](function(){var _0x2b1128=_['map'](_0x456b7e,function(_0x4faa75){_0x4faa75[_0xecda('0x68')]=_0x241cab;return _0x4faa75;});return db[_0xecda('0x93')][_0xecda('0x94')](_0x2b1128,{'transaction':_0x48260d});});}else{_0x497191=0x194;_0x1e5992=[];}});})['then'](function(){if(_0x497191!==0x194){return db[_0xecda('0x93')][_0xecda('0x95')]({'where':{'MailAccountId':_0x241cab},'order':_0xecda('0x96')})[_0xecda('0x11')](function(_0x59473d){_0x1e5992=_0x59473d;});}})[_0xecda('0x60')](function(_0x10bdb0){_0x497191=0x1f4;logger[_0xecda('0x17')](_0x10bdb0[_0xecda('0x29')]);if(_0x10bdb0['name']){delete _0x10bdb0['name'];}_0x1e5992=_0x10bdb0;})['finally'](function(){if(_0x1e5992===null){_0x1e1b23['sendStatus'](_0x497191);}else{if(_0x497191===0x1f4){_0x1e1b23[_0xecda('0x1d')](_0x497191)[_0xecda('0x97')](_0x1e5992);}else{_0x1e1b23[_0xecda('0x1d')](_0x497191)['json'](_0x1e5992);}}});};exports[_0xecda('0x98')]=function(_0x365964,_0x58c58d){var _0x29479a={};var _0x590739={};var _0x57fc38;var _0x4528dc;return db[_0xecda('0x59')][_0xecda('0x6a')]({'where':{'id':_0x365964[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x58c58d,null))[_0xecda('0x11')](function(_0x4fbee3){if(_0x4fbee3){_0x57fc38=_0x4fbee3;_0x590739[_0xecda('0x4a')]=_[_0xecda('0x5e')](db[_0xecda('0x93')]['rawAttributes']);_0x590739['query']=_[_0xecda('0x5e')](_0x365964[_0xecda('0x4b')]);_0x590739[_0xecda('0x4c')]=_[_0xecda('0x4d')](_0x590739[_0xecda('0x4a')],_0x590739[_0xecda('0x4b')]);_0x29479a['attributes']=_['intersection'](_0x590739[_0xecda('0x4a')],qs[_0xecda('0x4f')](_0x365964[_0xecda('0x4b')][_0xecda('0x4f')]));_0x29479a[_0xecda('0x4e')]=_0x29479a['attributes'][_0xecda('0x50')]?_0x29479a['attributes']:_0x590739[_0xecda('0x4a')];_0x29479a[_0xecda('0x52')]=qs['sort'](_0x365964[_0xecda('0x4b')]['sort']);_0x29479a[_0xecda('0x53')]=qs[_0xecda('0x4c')](_[_0xecda('0x54')](_0x365964['query'],_0x590739['filters']));if(_0x365964[_0xecda('0x4b')][_0xecda('0x57')]){_0x29479a[_0xecda('0x53')]=_[_0xecda('0x55')](_0x29479a[_0xecda('0x53')],{'$or':_[_0xecda('0x45')](_0x29479a['attributes'],function(_0x32d06e){var _0x5bf2b0={};_0x5bf2b0[_0x32d06e]={'$like':'%'+_0x365964[_0xecda('0x4b')]['filter']+'%'};return _0x5bf2b0;})});}_0x29479a=_['merge']({},_0x29479a,_0x365964[_0xecda('0x58')]);return _0x57fc38[_0xecda('0x98')](_0x29479a);}})[_0xecda('0x11')](function(_0x39709b){if(_0x39709b){_0x4528dc=_0x39709b[_0xecda('0x50')];if(!_0x365964['query'][_0xecda('0x51')]('nolimit')){_0x29479a[_0xecda('0x21')]=qs[_0xecda('0x21')](_0x365964['query']['limit']);_0x29479a[_0xecda('0x1e')]=qs[_0xecda('0x1e')](_0x365964['query'][_0xecda('0x1e')]);}return _0x57fc38['getApplications'](_0x29479a);}})[_0xecda('0x11')](function(_0x565502){if(_0x565502){return _0x565502?{'count':_0x4528dc,'rows':_0x565502}:null;}})[_0xecda('0x11')](respondWithResult(_0x58c58d,null))['catch'](handleError(_0x58c58d,null));};exports['getMessages']=function(_0x342fbe,_0x4c327e){var _0x3a5af9={'raw':!![],'where':{}};var _0x27e61e={};var _0x1ba491={'count':0x0,'rows':[]};return db[_0xecda('0x59')][_0xecda('0x6a')]({'where':{'id':_0x342fbe[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x4c327e,null))['then'](function(_0x316c69){if(_0x316c69){_0x27e61e[_0xecda('0x4a')]=_[_0xecda('0x5e')](db[_0xecda('0x99')]['rawAttributes']);_0x27e61e[_0xecda('0x4b')]=_[_0xecda('0x5e')](_0x342fbe[_0xecda('0x4b')]);_0x27e61e[_0xecda('0x4c')]=_[_0xecda('0x4d')](_0x27e61e[_0xecda('0x4a')],_0x27e61e[_0xecda('0x4b')]);_0x3a5af9[_0xecda('0x4e')]=_[_0xecda('0x4d')](_0x27e61e[_0xecda('0x4a')],qs[_0xecda('0x4f')](_0x342fbe[_0xecda('0x4b')][_0xecda('0x4f')]));_0x3a5af9[_0xecda('0x4e')]=_0x3a5af9['attributes'][_0xecda('0x50')]?_0x3a5af9[_0xecda('0x4e')]:_0x27e61e[_0xecda('0x4a')];if(!_0x342fbe[_0xecda('0x4b')][_0xecda('0x51')](_0xecda('0x6b'))){_0x3a5af9[_0xecda('0x21')]=qs[_0xecda('0x21')](_0x342fbe['query']['limit']);_0x3a5af9['offset']=qs[_0xecda('0x1e')](_0x342fbe[_0xecda('0x4b')][_0xecda('0x1e')]);}_0x3a5af9[_0xecda('0x52')]=qs['sort'](_0x342fbe[_0xecda('0x4b')][_0xecda('0x72')]);_0x3a5af9['where']=qs[_0xecda('0x4c')](_[_0xecda('0x54')](_0x342fbe['query'],_0x27e61e['filters']));_0x3a5af9[_0xecda('0x53')][_0xecda('0x68')]=_0x316c69['id'];if(_0x342fbe['query'][_0xecda('0x57')]){_0x3a5af9[_0xecda('0x53')]=_[_0xecda('0x55')](_0x3a5af9[_0xecda('0x53')],{'$or':_['map'](_0x3a5af9[_0xecda('0x4e')],function(_0x5cce05){var _0x5e7ca0={};_0x5e7ca0[_0x5cce05]={'$like':'%'+_0x342fbe[_0xecda('0x4b')][_0xecda('0x57')]+'%'};return _0x5e7ca0;})});}if(_0x342fbe[_0xecda('0x4b')][_0xecda('0x9a')]){var _0x1dac32=_0x342fbe[_0xecda('0x4b')][_0xecda('0x9a')][_0xecda('0x9b')](',');var _0x78e433={};_0x78e433[_0x1dac32[0x0]]={'$gte':moment(_0x1dac32[0x1])[_0xecda('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3a5af9['where']=_[_0xecda('0x55')](_0x3a5af9[_0xecda('0x53')],_0x78e433);}_0x3a5af9=_[_0xecda('0x55')]({},_0x3a5af9,_0x342fbe[_0xecda('0x58')]);return db[_0xecda('0x99')][_0xecda('0x20')]({'where':_0x3a5af9[_0xecda('0x53')]})['then'](function(_0x3aecf6){_0x1ba491['count']=_0x3aecf6;if(_0x342fbe['query'][_0xecda('0x5a')]){_0x3a5af9[_0xecda('0x5b')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x3a5af9);})[_0xecda('0x11')](function(_0x488f22){if(_0x342fbe['query']['inlineCss']===_0xecda('0x9d')){for(var _0x29346b=0x0;_0x29346b<_0x488f22[_0xecda('0x50')];_0x29346b++){_0x488f22[_0x29346b][_0xecda('0x61')]=juice(_0x488f22[_0x29346b][_0xecda('0x61')]);}}_0x1ba491[_0xecda('0x6d')]=_0x488f22;return _0x1ba491;});}})[_0xecda('0x11')](respondWithFilteredResult(_0x4c327e,_0x3a5af9))['catch'](handleError(_0x4c327e,null));};exports[_0xecda('0x97')]=function(_0x3876d4,_0x8075b2){var _0x3b23b7,_0x426d69={},_0x4d3498;if(_0x3876d4[_0xecda('0x61')]['to']){_0x4d3498=_0x3876d4[_0xecda('0x61')]['to'][_0xecda('0x9b')](',')[0x0];}return db[_0xecda('0x59')][_0xecda('0x5f')]({'where':{'id':_0x3876d4[_0xecda('0x63')]['id']},'include':[{'model':db[_0xecda('0x9e')],'as':'List','include':[{'model':db[_0xecda('0x86')],'as':_0xecda('0x9f'),'where':{'email':_0x4d3498},'limit':0x1,'order':[['updatedAt',_0xecda('0xa0')]]}]},{'model':db['MailServerOut'],'as':_0xecda('0x40'),'raw':!![],'include':[{'model':db[_0xecda('0xa1')],'as':_0xecda('0xa1'),'raw':!![]}]}]})[_0xecda('0x11')](handleEntityNotFound(_0x8075b2,null))['then'](function(_0x39f589){if(!_0x39f589)return;_0x3b23b7=_0x39f589;if(!_0x39f589[_0xecda('0x40')])throw new Error(_0xecda('0xa2'));if(_[_0xecda('0xa3')](_0x3876d4[_0xecda('0x61')][_0xecda('0xa4')])){_0x3876d4[_0xecda('0x61')]['from']=util[_0xecda('0x9c')](_0xecda('0xa5'),_0x39f589['name'],_0x39f589[_0xecda('0x75')]||_0x39f589[_0xecda('0x40')][_0xecda('0x34')]);}if(_0x3876d4['body'][_0xecda('0xa6')]&&_0x3876d4[_0xecda('0x61')][_0xecda('0xa6')][_0xecda('0x50')]){for(var _0x4723b0=0x0;_0x4723b0<_0x3876d4['body'][_0xecda('0xa6')]['length'];_0x4723b0+=0x1){_0x3876d4[_0xecda('0x61')][_0xecda('0xa6')][_0x4723b0]={'filename':_0x3876d4[_0xecda('0x61')][_0xecda('0xa6')][_0x4723b0]['name'],'path':path[_0xecda('0xa7')](config[_0xecda('0xa8')],'server/files/attachments',_0x3876d4[_0xecda('0x61')][_0xecda('0xa6')][_0x4723b0]['basename'])};}}var _0x4f7f96=_0x39f589['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xecda('0xa9'),{'account':_0x4f7f96,'message':_0x3876d4[_0xecda('0x61')]});})['then'](function(_0x453e43){if(!_0x453e43)return;_0x426d69=_0x453e43;if(!_0x3b23b7[_0xecda('0xaa')])throw new Error(_0xecda('0xab'));if(_0x3b23b7['List'][_0xecda('0x9f')][_0xecda('0x50')])return _0x3b23b7[_0xecda('0xaa')][_0xecda('0x9f')][0x0];return db[_0xecda('0x86')][_0xecda('0x69')](_[_0xecda('0x8')](_0x3876d4['body'],{'firstName':_0x3876d4[_0xecda('0x61')]['to'],'email':_0x3876d4[_0xecda('0x61')]['to'],'phone':_0x3876d4[_0xecda('0x61')]['to'],'ListId':_0x3b23b7[_0xecda('0xac')]}));})[_0xecda('0x11')](function(_0x4b15ad){if(!_0x4b15ad)return;var _0x314194={'UserId':_0x3876d4[_0xecda('0x34')]['id'],'ContactId':_0x4b15ad['id'],'MailAccountId':_0x3b23b7['id'],'inReplyTo':_0x426d69[_0xecda('0xad')],'to':_0x3876d4[_0xecda('0x61')][_0xecda('0xa4')],'cc':_0x3876d4[_0xecda('0x61')]['cc'],'subject':_0x3876d4[_0xecda('0x61')]['subject'],'attach':_0x3876d4[_0xecda('0x61')][_0xecda('0xae')],'firstMsgDirection':_0xecda('0xaf'),'lastMsgAt':moment()[_0xecda('0x9c')](_0xecda('0xb0')),'lastMsgDirection':_0xecda('0xaf'),'Messages':[_[_0xecda('0x55')](_0x3876d4['body'],{'messageId':_0x426d69['messageId'],'sentAt':moment()['format'](_0xecda('0xb0')),'read':!![],'MailAccountId':_0x3b23b7['id'],'UserId':_0x3876d4[_0xecda('0x34')]['id'],'ContactId':_0x4b15ad['id']})]};if(_0x3876d4[_0xecda('0x61')][_0xecda('0xb1')]){_0x314194=_[_0xecda('0x55')](_0x314194,_0x3876d4['body'][_0xecda('0xb1')]);}return db[_0xecda('0x85')][_0xecda('0x69')](_0x314194,{'include':[{'model':db[_0xecda('0x99')],'as':'Messages'}]});})[_0xecda('0x11')](respondWithResult(_0x8075b2,null))[_0xecda('0x60')](handleError(_0x8075b2,null));};exports[_0xecda('0xb2')]=function(_0x91864a,_0x52821a){return db['MailAccount']['find']({'where':{'id':_0x91864a[_0xecda('0x63')]['id']},'include':[{'model':db[_0xecda('0x42')],'as':_0xecda('0x40'),'raw':!![],'include':[{'model':db[_0xecda('0xa1')],'as':_0xecda('0xa1'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x52821a,null))[_0xecda('0x11')](function(_0x5e3153){if(!_0x5e3153[_0xecda('0x40')])return;var _0x5c76b4=_0x5e3153[_0xecda('0xb3')]();return respondWithRpcPromise(_0xecda('0xb4'),'verifySmtp',{'account':_0x5c76b4});})[_0xecda('0x11')](respondWithResult(_0x52821a,null))['catch'](handleError(_0x52821a,null));};exports['destroy']=function(_0x244946,_0x360d7f){return db[_0xecda('0x59')]['find']({'where':{'id':_0x244946['params']['id']}})['then'](handleEntityNotFound(_0x360d7f,null))[_0xecda('0x11')](function(_0xc1f54){if(_0xc1f54&&_0xc1f54[_0xecda('0x3d')]){throw new db[(_0xecda('0xb5'))][(_0xecda('0xb6'))](_0xecda('0xb7'));}return _0xc1f54;})[_0xecda('0x11')](removeEntity(_0x360d7f,null))[_0xecda('0x60')](handleError(_0x360d7f,null));};exports[_0xecda('0xb8')]=function(_0x2ca844,_0x434702){return db[_0xecda('0x59')][_0xecda('0x5f')]({'where':{'id':_0x2ca844[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x434702,null))[_0xecda('0x11')](function(_0x16998d){if(_0x16998d){return _0x16998d[_0xecda('0xb8')](_0x2ca844[_0xecda('0x61')][_0xecda('0x6e')],_[_0xecda('0x84')](_0x2ca844[_0xecda('0x61')],['ids','id'])||{})[_0xecda('0xb9')](function(_0x41ea41){for(var _0x5a84d7=0x0;_0x5a84d7<_0x2ca844[_0xecda('0x61')][_0xecda('0x6e')][_0xecda('0x50')];_0x5a84d7+=0x1){socket[_0xecda('0xba')](_0xecda('0xbb'),{'UserId':Number(_0x2ca844[_0xecda('0x61')][_0xecda('0x6e')][_0x5a84d7]),'MailAccountId':Number(_0x2ca844[_0xecda('0x63')]['id'])});}return _0x41ea41;});}})[_0xecda('0x11')](respondWithResult(_0x434702,null))[_0xecda('0x60')](handleError(_0x434702,null));};exports['removeAgents']=function(_0xd6b701,_0x1ddf25){return db[_0xecda('0x59')][_0xecda('0x5f')]({'where':{'id':_0xd6b701[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x1ddf25,null))[_0xecda('0x11')](function(_0x26ca5b){if(_0x26ca5b){return _0x26ca5b['removeAgents'](_0xd6b701[_0xecda('0x4b')]['ids'])[_0xecda('0x11')](function(){if(_[_0xecda('0xbc')](_0xd6b701[_0xecda('0x4b')][_0xecda('0x6e')])){for(var _0x1d4810=0x0;_0x1d4810<_0xd6b701[_0xecda('0x4b')][_0xecda('0x6e')][_0xecda('0x50')];_0x1d4810+=0x1){socket[_0xecda('0xba')](_0xecda('0xbd'),{'UserId':Number(_0xd6b701['query'][_0xecda('0x6e')][_0x1d4810]),'MailAccountId':Number(_0xd6b701['params']['id'])});}}else{socket[_0xecda('0xba')](_0xecda('0xbd'),{'UserId':Number(_0xd6b701['query'][_0xecda('0x6e')]),'MailAccountId':Number(_0xd6b701[_0xecda('0x63')]['id'])});}});}})[_0xecda('0x11')](respondWithStatusCode(_0x1ddf25,null))[_0xecda('0x60')](handleError(_0x1ddf25,null));};exports['getAgents']=function(_0x345991,_0x5255d6){var _0x31f89d={};var _0x380f15={};var _0x15bf7f;var _0x5ca18d;return db[_0xecda('0x59')][_0xecda('0x6a')]({'where':{'id':_0x345991[_0xecda('0x63')]['id']}})[_0xecda('0x11')](handleEntityNotFound(_0x5255d6,null))[_0xecda('0x11')](function(_0x18f0f3){if(_0x18f0f3){_0x15bf7f=_0x18f0f3;_0x380f15['model']=_['keys'](db[_0xecda('0x88')][_0xecda('0x46')]);_0x380f15[_0xecda('0x4b')]=_['keys'](_0x345991[_0xecda('0x4b')]);_0x380f15['filters']=_[_0xecda('0x4d')](_0x380f15[_0xecda('0x4a')],_0x380f15[_0xecda('0x4b')]);_0x31f89d[_0xecda('0x4e')]=_[_0xecda('0x4d')](_0x380f15['model'],qs[_0xecda('0x4f')](_0x345991[_0xecda('0x4b')][_0xecda('0x4f')]));_0x31f89d[_0xecda('0x4e')]=_0x31f89d[_0xecda('0x4e')]['length']?_0x31f89d[_0xecda('0x4e')]:_0x380f15['model'];_0x31f89d[_0xecda('0x52')]=qs['sort'](_0x345991[_0xecda('0x4b')][_0xecda('0x72')]);_0x31f89d['where']=qs[_0xecda('0x4c')](_[_0xecda('0x54')](_0x345991[_0xecda('0x4b')],_0x380f15['filters']));if(_0x345991['query'][_0xecda('0x57')]){_0x31f89d[_0xecda('0x53')]=_[_0xecda('0x55')](_0x31f89d[_0xecda('0x53')],{'$or':_[_0xecda('0x45')](_0x31f89d[_0xecda('0x4e')],function(_0x25ed01){var _0x1ab453={};_0x1ab453[_0x25ed01]={'$like':'%'+_0x345991[_0xecda('0x4b')][_0xecda('0x57')]+'%'};return _0x1ab453;})});}_0x31f89d=_[_0xecda('0x55')]({},_0x31f89d,_0x345991['options']);return _0x15bf7f[_0xecda('0xbe')](_0x31f89d);}})[_0xecda('0x11')](function(_0x54eab8){if(_0x54eab8){_0x5ca18d=_0x54eab8[_0xecda('0x50')];if(!_0x345991[_0xecda('0x4b')][_0xecda('0x51')](_0xecda('0x6b'))){_0x31f89d[_0xecda('0x21')]=qs[_0xecda('0x21')](_0x345991[_0xecda('0x4b')][_0xecda('0x21')]);_0x31f89d[_0xecda('0x1e')]=qs[_0xecda('0x1e')](_0x345991[_0xecda('0x4b')][_0xecda('0x1e')]);}return _0x15bf7f[_0xecda('0xbe')](_0x31f89d);}})['then'](function(_0xcc18e7){if(_0xcc18e7){return _0xcc18e7?{'count':_0x5ca18d,'rows':_0xcc18e7}:null;}})['then'](respondWithResult(_0x5255d6,null))[_0xecda('0x60')](handleError(_0x5255d6,null));}; \ No newline at end of file +var _0x3878=['pick','filter','where','merge','VIRTUAL','options','MailAccount','includeAll','include','findAll','rows','catch','show','params','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','provider','email','isNil','description','get','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','json','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','List','Contacts','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','ListId','messageId','subject','out','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','undefined','limit','count','update','destroy','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2a20d0,_0x45c099){var _0x180aa9=function(_0x4e78dc){while(--_0x4e78dc){_0x2a20d0['push'](_0x2a20d0['shift']());}};_0x180aa9(++_0x45c099);}(_0x3878,0x6c));var _0x8387=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0x3878[_0x3d34f0];return _0x135ecd;};'use strict';var moment=require(_0x8387('0x0'));var BPromise=require(_0x8387('0x1'));var util=require(_0x8387('0x2'));var path=require(_0x8387('0x3'));var _=require(_0x8387('0x4'));var juice=require('juice');var Redis=require(_0x8387('0x5'));var qs=require(_0x8387('0x6'));var logger=require(_0x8387('0x7'))(_0x8387('0x8'));var config=require(_0x8387('0x9'));var db=require(_0x8387('0xa'))['db'];config[_0x8387('0xb')]=_['defaults'](config[_0x8387('0xb')],{'host':_0x8387('0xc'),'port':0x18eb});var socket=require(_0x8387('0xd'))(new Redis(config[_0x8387('0xb')]));require(_0x8387('0xe'))[_0x8387('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8387('0x10')][_0x8387('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x44c0a3,_0x49ddf7,_0x5df9a6,_0x593868){return new BPromise(function(_0x32a794,_0x355299){var _0x3e24bc=_0x593868||client;return _0x3e24bc[_0x8387('0x12')](_0x44c0a3,_0x5df9a6)[_0x8387('0x13')](function(_0x21ef3d){logger[_0x8387('0x14')](_0x8387('0x15'),_0x49ddf7,_0x8387('0x16'));logger['debug'](_0x8387('0x17'),_0x49ddf7,_0x8387('0x16'),JSON[_0x8387('0x18')](_0x21ef3d));if(_0x21ef3d[_0x8387('0x19')]){if(_0x21ef3d[_0x8387('0x19')]['code']===0x1f4){logger[_0x8387('0x19')]('MailAccount,\x20%s,\x20%s',_0x49ddf7,_0x21ef3d['error'][_0x8387('0x1a')]);return _0x355299(_0x21ef3d['error'][_0x8387('0x1a')]);}logger['error'](_0x8387('0x15'),_0x49ddf7,_0x21ef3d[_0x8387('0x19')][_0x8387('0x1a')]);return _0x32a794(_0x21ef3d[_0x8387('0x19')][_0x8387('0x1a')]);}else{logger[_0x8387('0x14')]('MailAccount,\x20%s,\x20%s',_0x49ddf7,'request\x20sent');_0x32a794(_0x21ef3d[_0x8387('0x1b')][_0x8387('0x1a')]);}})['catch'](function(_0xa013fc){logger[_0x8387('0x19')]('MailAccount,\x20%s,\x20%s',_0x49ddf7,_0xa013fc);_0x355299(_0xa013fc);});});}function respondWithStatusCode(_0x70d93,_0x451bb6){_0x451bb6=_0x451bb6||0xcc;return function(_0x356f24){if(_0x356f24){return _0x70d93[_0x8387('0x1c')](_0x451bb6);}return _0x70d93[_0x8387('0x1d')](_0x451bb6)[_0x8387('0x1e')]();};}function respondWithResult(_0xd21d54,_0x2d3fce){_0x2d3fce=_0x2d3fce||0xc8;return function(_0x469df7){if(_0x469df7){return _0xd21d54['status'](_0x2d3fce)['json'](_0x469df7);}};}function respondWithFilteredResult(_0x195fce,_0xa61089){return function(_0x1415a0){if(_0x1415a0){var _0x1866a8=typeof _0xa61089[_0x8387('0x1f')]===_0x8387('0x20')&&typeof _0xa61089[_0x8387('0x21')]===_0x8387('0x20');var _0x44bc60=_0x1415a0[_0x8387('0x22')];var _0x4a0576=_0x1866a8?0x0:_0xa61089['offset'];var _0xad186e=_0x1866a8?_0x1415a0[_0x8387('0x22')]:_0xa61089['offset']+_0xa61089[_0x8387('0x21')];var _0x35dfc1;if(_0xad186e>=_0x44bc60){_0xad186e=_0x44bc60;_0x35dfc1=0xc8;}else{_0x35dfc1=0xce;}_0x195fce[_0x8387('0x1d')](_0x35dfc1);return _0x195fce['set']('Content-Range',_0x4a0576+'-'+_0xad186e+'/'+_0x44bc60)['json'](_0x1415a0);}return null;};}function saveUpdates(_0x2d5e35){return function(_0x18d0d2){if(_0x18d0d2){return _0x18d0d2[_0x8387('0x23')](_0x2d5e35)[_0x8387('0x13')](function(_0xfbbcea){return _0xfbbcea;});}return null;};}function removeEntity(_0x4e78c3){return function(_0x36a98e){if(_0x36a98e){return _0x36a98e[_0x8387('0x24')]()[_0x8387('0x13')](function(){var _0xeab1e5=_0x36a98e['get']({'plain':!![]});var _0x5eb737=_0x8387('0x25');return db[_0x8387('0x26')][_0x8387('0x24')]({'where':{'type':_0x5eb737,'resourceId':_0xeab1e5['id']}})[_0x8387('0x13')](function(){return _0x36a98e;});})[_0x8387('0x13')](function(){_0x4e78c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x538b91){return function(_0xc6b57f){if(!_0xc6b57f){_0x538b91[_0x8387('0x1c')](0x194);}return _0xc6b57f;};}function handleError(_0x39b8b5,_0x43e9c3){_0x43e9c3=_0x43e9c3||0x1f4;return function(_0x200de3){logger[_0x8387('0x19')](_0x200de3['stack']);if(_0x200de3[_0x8387('0x27')]){delete _0x200de3[_0x8387('0x27')];}_0x39b8b5['status'](_0x43e9c3)[_0x8387('0x28')](_0x200de3);};}function getImapHost(_0x3d07a){switch(_0x3d07a){case _0x8387('0x29'):return _0x8387('0x2a');case _0x8387('0x2b'):return _0x8387('0x2c');case'hotmail':return'imap-mail.outlook.com';case _0x8387('0x2d'):return _0x8387('0x2e');}throw new Error(_0x8387('0x2f'),_0x3d07a);}function getSmtpHost(_0x8240c9){switch(_0x8240c9){case _0x8387('0x29'):return _0x8387('0x30');case _0x8387('0x2b'):return'smtp.mail.yahoo.com';case _0x8387('0x31'):return _0x8387('0x32');case'outlook365':return _0x8387('0x33');}throw new Error(_0x8387('0x2f'),_0x8240c9);}function getAuthenticationOptions(_0x887711,_0x176acb){var _0x273f1d={};var _0x45a1f7={};if(_0x887711){_0x273f1d[_0x8387('0x34')]=_0x45a1f7[_0x8387('0x34')]=_0x176acb[_0x8387('0x35')];_0x273f1d[_0x8387('0x36')]=_0x45a1f7[_0x8387('0x37')]=_0x176acb[_0x8387('0x36')];if(_0x176acb[_0x8387('0x38')]){_0x273f1d[_0x8387('0x38')]=_0x45a1f7[_0x8387('0x38')]=!![];_0x273f1d[_0x8387('0x39')]=_0x45a1f7[_0x8387('0x39')]=_0x176acb[_0x8387('0x39')];_0x273f1d[_0x8387('0x36')]=_0x45a1f7[_0x8387('0x37')]=null;}else{_0x273f1d[_0x8387('0x39')]=_0x45a1f7['CloudProviderId']=null;}_0x273f1d['host']=getImapHost(_0x887711);_0x273f1d[_0x8387('0x3a')]=0x3e1;_0x45a1f7[_0x8387('0x3b')]=getSmtpHost(_0x887711);_0x45a1f7[_0x8387('0x3a')]=0x24b;_0x45a1f7[_0x8387('0x3c')]=![];_0x273f1d[_0x8387('0x3d')]=_0x45a1f7[_0x8387('0x3d')]=null;}else{if(_0x176acb[_0x8387('0x3e')]){_0x273f1d[_0x8387('0x34')]=_0x45a1f7[_0x8387('0x34')]=_0x176acb[_0x8387('0x35')];_0x273f1d[_0x8387('0x36')]=_0x45a1f7[_0x8387('0x37')]=_0x176acb[_0x8387('0x36')];}else{_0x273f1d[_0x8387('0x3e')]=_0x45a1f7['authentication']=![];_0x273f1d[_0x8387('0x34')]=_0x45a1f7[_0x8387('0x34')]=null;_0x273f1d[_0x8387('0x36')]=_0x45a1f7['pass']=null;}_0x273f1d[_0x8387('0x3b')]=_0x176acb['Imap'][_0x8387('0x3b')];_0x273f1d[_0x8387('0x3a')]=_0x176acb[_0x8387('0x3f')][_0x8387('0x3a')];_0x45a1f7[_0x8387('0x3b')]=_0x176acb['Smtp'][_0x8387('0x3b')];_0x45a1f7[_0x8387('0x3a')]=_0x176acb[_0x8387('0x40')][_0x8387('0x3a')];}return{'Imap':_0x273f1d,'Smtp':_0x45a1f7};}exports[_0x8387('0x41')]=function(_0x4363d8,_0x20cb1e){var _0x42ddfa={'include':[{'model':db[_0x8387('0x42')],'as':_0x8387('0x3f')},{'model':db[_0x8387('0x43')],'as':_0x8387('0x40')},{'model':db[_0x8387('0x44')],'as':_0x8387('0x45')}]},_0x2a59c0={},_0x22a0db={'count':0x0,'rows':[]};var _0x5451e5=_[_0x8387('0x46')](db['MailAccount'][_0x8387('0x47')],function(_0x216cf5){return{'name':_0x216cf5[_0x8387('0x48')],'type':_0x216cf5[_0x8387('0x49')][_0x8387('0x4a')]};});_0x2a59c0[_0x8387('0x4b')]=_['map'](_0x5451e5,'name');_0x2a59c0[_0x8387('0x4c')]=_[_0x8387('0x4d')](_0x4363d8[_0x8387('0x4c')]);_0x2a59c0[_0x8387('0x4e')]=_['intersection'](_0x2a59c0[_0x8387('0x4b')],_0x2a59c0[_0x8387('0x4c')]);_0x42ddfa[_0x8387('0x4f')]=_[_0x8387('0x50')](_0x2a59c0[_0x8387('0x4b')],qs[_0x8387('0x51')](_0x4363d8['query']['fields']));_0x42ddfa[_0x8387('0x4f')]=_0x42ddfa[_0x8387('0x4f')][_0x8387('0x52')]?_0x42ddfa['attributes']:_0x2a59c0['model'];if(!_0x4363d8['query'][_0x8387('0x53')](_0x8387('0x54'))){_0x42ddfa['limit']=qs[_0x8387('0x21')](_0x4363d8['query'][_0x8387('0x21')]);_0x42ddfa['offset']=qs[_0x8387('0x1f')](_0x4363d8[_0x8387('0x4c')][_0x8387('0x1f')]);}_0x42ddfa[_0x8387('0x55')]=qs['sort'](_0x4363d8[_0x8387('0x4c')][_0x8387('0x56')]);_0x42ddfa['where']=qs[_0x8387('0x4e')](_[_0x8387('0x57')](_0x4363d8[_0x8387('0x4c')],_0x2a59c0[_0x8387('0x4e')]),_0x5451e5);if(_0x4363d8[_0x8387('0x4c')][_0x8387('0x58')]){_0x42ddfa[_0x8387('0x59')]=_[_0x8387('0x5a')](_0x42ddfa['where'],{'$or':_[_0x8387('0x46')](_0x5451e5,function(_0x353ff3){if(_0x353ff3[_0x8387('0x49')]!==_0x8387('0x5b')){var _0x20d148={};_0x20d148[_0x353ff3[_0x8387('0x27')]]={'$like':'%'+_0x4363d8[_0x8387('0x4c')]['filter']+'%'};return _0x20d148;}})});}_0x42ddfa=_[_0x8387('0x5a')]({},_0x42ddfa,_0x4363d8[_0x8387('0x5c')]);var _0x1316e8={'where':_0x42ddfa[_0x8387('0x59')]};return db[_0x8387('0x5d')][_0x8387('0x22')](_0x1316e8)[_0x8387('0x13')](function(_0x5eae26){_0x22a0db['count']=_0x5eae26;if(_0x4363d8[_0x8387('0x4c')][_0x8387('0x5e')]){_0x42ddfa[_0x8387('0x5f')]=[{'all':!![]}];}return db[_0x8387('0x5d')][_0x8387('0x60')](_0x42ddfa);})[_0x8387('0x13')](function(_0x1c3c28){_0x22a0db[_0x8387('0x61')]=_0x1c3c28;return _0x22a0db;})[_0x8387('0x13')](respondWithFilteredResult(_0x20cb1e,_0x42ddfa))[_0x8387('0x62')](handleError(_0x20cb1e,null));};exports[_0x8387('0x63')]=function(_0x2f9eab,_0x2e44c1){var _0x5b7e17={'raw':![],'where':{'id':_0x2f9eab[_0x8387('0x64')]['id']},'include':[{'model':db[_0x8387('0x42')],'as':_0x8387('0x3f')},{'model':db[_0x8387('0x43')],'as':_0x8387('0x40')},{'model':db[_0x8387('0x44')],'as':_0x8387('0x45')}]},_0x400a07={};_0x400a07[_0x8387('0x4b')]=_[_0x8387('0x4d')](db[_0x8387('0x5d')][_0x8387('0x47')]);_0x400a07[_0x8387('0x4c')]=_[_0x8387('0x4d')](_0x2f9eab[_0x8387('0x4c')]);_0x400a07[_0x8387('0x4e')]=_['intersection'](_0x400a07[_0x8387('0x4b')],_0x400a07[_0x8387('0x4c')]);_0x5b7e17['attributes']=_[_0x8387('0x50')](_0x400a07['model'],qs[_0x8387('0x51')](_0x2f9eab['query']['fields']));_0x5b7e17[_0x8387('0x4f')]=_0x5b7e17['attributes'][_0x8387('0x52')]?_0x5b7e17[_0x8387('0x4f')]:_0x400a07[_0x8387('0x4b')];if(_0x2f9eab[_0x8387('0x4c')][_0x8387('0x5e')]){_0x5b7e17[_0x8387('0x5f')]=[{'all':!![]}];}_0x5b7e17=_[_0x8387('0x5a')]({},_0x5b7e17,_0x2f9eab[_0x8387('0x5c')]);return db[_0x8387('0x5d')][_0x8387('0x65')](_0x5b7e17)[_0x8387('0x13')](handleEntityNotFound(_0x2e44c1,null))[_0x8387('0x13')](respondWithResult(_0x2e44c1,null))[_0x8387('0x62')](handleError(_0x2e44c1,null));};exports[_0x8387('0x23')]=function(_0x21e84f,_0x1e7b23){if(_0x21e84f[_0x8387('0x66')]['id']){delete _0x21e84f[_0x8387('0x66')]['id'];}var _0x396c86=_0x21e84f['body']['provider']==='custom'?null:_0x21e84f[_0x8387('0x66')]['provider'];var _0x1e5a60=_0x21e84f['body'][_0x8387('0x3f')]||{};var _0x42f4c8=_0x21e84f['body'][_0x8387('0x40')]||{};if(_0x396c86){_0x1e5a60[_0x8387('0x3b')]=getImapHost(_0x396c86);_0x1e5a60[_0x8387('0x3a')]=0x3e1;_0x42f4c8[_0x8387('0x3b')]=getSmtpHost(_0x396c86);_0x42f4c8[_0x8387('0x3a')]=0x24b;_0x42f4c8[_0x8387('0x3c')]=![];}if(_0x42f4c8[_0x8387('0x38')]){_0x42f4c8['secure']=![];}else{_0x42f4c8[_0x8387('0x39')]=null;}if(!_0x1e5a60[_0x8387('0x38')])_0x1e5a60[_0x8387('0x39')]=null;_0x21e84f[_0x8387('0x66')]['Imap']=_0x1e5a60;_0x21e84f['body'][_0x8387('0x40')]=_0x42f4c8;return db[_0x8387('0x5d')][_0x8387('0x65')]({'where':{'id':_0x21e84f['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x8387('0x40')},{'model':db[_0x8387('0x44')],'as':_0x8387('0x45')}]})[_0x8387('0x13')](handleEntityNotFound(_0x1e7b23,null))[_0x8387('0x13')](function(_0x24ec52){if(!_0x24ec52)throw new Error('Mail\x20Account\x20not\x20found');if(_0x24ec52['service'])delete _0x21e84f[_0x8387('0x66')][_0x8387('0x3f')];return _0x24ec52;})[_0x8387('0x13')](saveUpdates(_0x21e84f[_0x8387('0x66')],null))[_0x8387('0x13')](function(_0x376949){if(!_0x21e84f[_0x8387('0x66')][_0x8387('0x3f')])return _0x376949;return db['MailServerIn']['update'](_0x21e84f[_0x8387('0x66')]['Imap'],{'where':{'MailAccountId':_0x376949['id']}})['then'](function(){return _0x376949;});})[_0x8387('0x13')](function(_0x3cfba3){if(!_0x21e84f[_0x8387('0x66')][_0x8387('0x40')])return _0x3cfba3;return db[_0x8387('0x43')][_0x8387('0x23')](_0x21e84f[_0x8387('0x66')][_0x8387('0x40')],{'where':{'MailAccountId':_0x3cfba3['id']}})['then'](function(){return _0x3cfba3;});})[_0x8387('0x13')](respondWithResult(_0x1e7b23,null))[_0x8387('0x62')](handleError(_0x1e7b23,null));};exports[_0x8387('0x67')]=function(_0x356ebb,_0xf6b3f){return db[_0x8387('0x5d')][_0x8387('0x67')]()[_0x8387('0x13')](respondWithResult(_0xf6b3f,null))['catch'](handleError(_0xf6b3f,null));};exports[_0x8387('0x68')]=function(_0x28d6f5,_0x52933e){if(_0x28d6f5[_0x8387('0x66')]['id']){delete _0x28d6f5['body']['id'];}return db['MailAccount'][_0x8387('0x65')]({'where':{'id':_0x28d6f5[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x52933e,null))[_0x8387('0x13')](function(_0x30f028){if(_0x30f028){_0x28d6f5[_0x8387('0x66')][_0x8387('0x69')]=_0x30f028['id'];return db[_0x8387('0x6a')][_0x8387('0x6b')](_0x28d6f5[_0x8387('0x66')]);}})[_0x8387('0x13')](respondWithResult(_0x52933e,null))[_0x8387('0x62')](handleError(_0x52933e,null));};exports[_0x8387('0x6c')]=function(_0x4d9642,_0x11f056){var _0x35f361={'raw':![],'where':{}};var _0xc631fe={};var _0x51f099={'count':0x0,'rows':[]};return db[_0x8387('0x5d')][_0x8387('0x6d')]({'where':{'id':_0x4d9642[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x11f056,null))['then'](function(_0x462729){if(_0x462729){_0xc631fe[_0x8387('0x4b')]=_[_0x8387('0x4d')](db[_0x8387('0x6a')][_0x8387('0x47')]);_0xc631fe[_0x8387('0x4c')]=_[_0x8387('0x4d')](_0x4d9642[_0x8387('0x4c')]);_0xc631fe['filters']=_[_0x8387('0x50')](_0xc631fe['model'],_0xc631fe['query']);_0x35f361['attributes']=_['intersection'](_0xc631fe[_0x8387('0x4b')],qs[_0x8387('0x51')](_0x4d9642['query']['fields']));_0x35f361['attributes']=_0x35f361[_0x8387('0x4f')][_0x8387('0x52')]?_0x35f361[_0x8387('0x4f')]:_0xc631fe[_0x8387('0x4b')];if(!_0x4d9642['query'][_0x8387('0x53')](_0x8387('0x54'))){_0x35f361['limit']=qs['limit'](_0x4d9642[_0x8387('0x4c')][_0x8387('0x21')]);_0x35f361[_0x8387('0x1f')]=qs[_0x8387('0x1f')](_0x4d9642[_0x8387('0x4c')][_0x8387('0x1f')]);}_0x35f361[_0x8387('0x55')]=qs[_0x8387('0x56')](_0x4d9642[_0x8387('0x4c')]['sort']);_0x35f361[_0x8387('0x59')]=qs[_0x8387('0x4e')](_[_0x8387('0x57')](_0x4d9642[_0x8387('0x4c')],_0xc631fe[_0x8387('0x4e')]));_0x35f361[_0x8387('0x59')][_0x8387('0x69')]=_0x462729['id'];if(_0x4d9642[_0x8387('0x4c')][_0x8387('0x58')]){_0x35f361[_0x8387('0x59')]=_['merge'](_0x35f361[_0x8387('0x59')],{'$or':_[_0x8387('0x46')](_0x35f361[_0x8387('0x4f')],function(_0x291b0b){var _0x326867={};_0x326867[_0x291b0b]={'$like':'%'+_0x4d9642['query']['filter']+'%'};return _0x326867;})});}_0x35f361=_[_0x8387('0x5a')]({},_0x35f361,_0x4d9642[_0x8387('0x5c')]);return db[_0x8387('0x6a')][_0x8387('0x22')]({'where':_0x35f361[_0x8387('0x59')]})[_0x8387('0x13')](function(_0x43d600){_0x51f099['count']=_0x43d600;if(_0x4d9642['query'][_0x8387('0x5e')]){_0x35f361['include']=[{'all':!![]}];}return db[_0x8387('0x6a')][_0x8387('0x60')](_0x35f361);})[_0x8387('0x13')](function(_0x513187){_0x51f099[_0x8387('0x61')]=_0x513187;return _0x51f099;});}})[_0x8387('0x13')](respondWithFilteredResult(_0x11f056,_0x35f361))['catch'](handleError(_0x11f056,null));};exports[_0x8387('0x6e')]=function(_0x11c4c0,_0x289d07){return db[_0x8387('0x5d')][_0x8387('0x65')]({'where':{'id':_0x11c4c0[_0x8387('0x64')]['id']}})['then'](handleEntityNotFound(_0x289d07,null))[_0x8387('0x13')](function(_0x3f3670){if(_0x3f3670){return _0x3f3670['removeDispositions'](_0x11c4c0[_0x8387('0x4c')][_0x8387('0x6f')]);}})[_0x8387('0x13')](respondWithStatusCode(_0x289d07,null))[_0x8387('0x62')](handleError(_0x289d07,null));};exports[_0x8387('0x70')]=function(_0xed26b0,_0x13d44d){if(_0xed26b0[_0x8387('0x66')]['id']){delete _0xed26b0[_0x8387('0x66')]['id'];}return db[_0x8387('0x5d')][_0x8387('0x65')]({'where':{'id':_0xed26b0[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x13d44d,null))[_0x8387('0x13')](function(_0x22e28a){if(_0x22e28a){_0xed26b0[_0x8387('0x66')][_0x8387('0x69')]=_0x22e28a['id'];return db[_0x8387('0x71')][_0x8387('0x6b')](_0xed26b0['body']);}})[_0x8387('0x13')](respondWithResult(_0x13d44d,null))[_0x8387('0x62')](handleError(_0x13d44d,null));};exports[_0x8387('0x72')]=function(_0x3fac5c,_0x5df639){var _0xeaaa42={'raw':![],'where':{}};var _0x2dabc7={};var _0x7f9424={'count':0x0,'rows':[]};return db[_0x8387('0x5d')][_0x8387('0x6d')]({'where':{'id':_0x3fac5c[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x5df639,null))[_0x8387('0x13')](function(_0x5f7d52){if(_0x5f7d52){_0x2dabc7[_0x8387('0x4b')]=_['keys'](db[_0x8387('0x71')][_0x8387('0x47')]);_0x2dabc7['query']=_['keys'](_0x3fac5c[_0x8387('0x4c')]);_0x2dabc7[_0x8387('0x4e')]=_[_0x8387('0x50')](_0x2dabc7[_0x8387('0x4b')],_0x2dabc7[_0x8387('0x4c')]);_0xeaaa42['attributes']=_[_0x8387('0x50')](_0x2dabc7[_0x8387('0x4b')],qs['fields'](_0x3fac5c[_0x8387('0x4c')][_0x8387('0x51')]));_0xeaaa42['attributes']=_0xeaaa42['attributes']['length']?_0xeaaa42[_0x8387('0x4f')]:_0x2dabc7[_0x8387('0x4b')];if(!_0x3fac5c[_0x8387('0x4c')][_0x8387('0x53')](_0x8387('0x54'))){_0xeaaa42[_0x8387('0x21')]=qs['limit'](_0x3fac5c['query']['limit']);_0xeaaa42[_0x8387('0x1f')]=qs[_0x8387('0x1f')](_0x3fac5c[_0x8387('0x4c')]['offset']);}_0xeaaa42[_0x8387('0x55')]=qs['sort'](_0x3fac5c['query']['sort']);_0xeaaa42[_0x8387('0x59')]=qs[_0x8387('0x4e')](_[_0x8387('0x57')](_0x3fac5c[_0x8387('0x4c')],_0x2dabc7[_0x8387('0x4e')]));_0xeaaa42[_0x8387('0x59')][_0x8387('0x69')]=_0x5f7d52['id'];if(_0x3fac5c[_0x8387('0x4c')][_0x8387('0x58')]){_0xeaaa42[_0x8387('0x59')]=_[_0x8387('0x5a')](_0xeaaa42[_0x8387('0x59')],{'$or':_[_0x8387('0x46')](_0xeaaa42[_0x8387('0x4f')],function(_0x57dc05){var _0x5956df={};_0x5956df[_0x57dc05]={'$like':'%'+_0x3fac5c['query'][_0x8387('0x58')]+'%'};return _0x5956df;})});}_0xeaaa42=_['merge']({},_0xeaaa42,_0x3fac5c[_0x8387('0x5c')]);return db['CannedAnswer']['count']({'where':_0xeaaa42[_0x8387('0x59')]})[_0x8387('0x13')](function(_0xc257ad){_0x7f9424[_0x8387('0x22')]=_0xc257ad;if(_0x3fac5c[_0x8387('0x4c')]['includeAll']){_0xeaaa42[_0x8387('0x5f')]=[{'all':!![]}];}return db[_0x8387('0x71')][_0x8387('0x60')](_0xeaaa42);})[_0x8387('0x13')](function(_0x1be0c4){_0x7f9424[_0x8387('0x61')]=_0x1be0c4;return _0x7f9424;});}})['then'](respondWithFilteredResult(_0x5df639,_0xeaaa42))[_0x8387('0x62')](handleError(_0x5df639,null));};exports['removeAnswers']=function(_0x32ec30,_0x29b0e6){return db['MailAccount']['find']({'where':{'id':_0x32ec30[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x29b0e6,null))[_0x8387('0x13')](function(_0x2e22a0){if(_0x2e22a0){return _0x2e22a0['removeAnswers'](_0x32ec30['query'][_0x8387('0x6f')]);}})[_0x8387('0x13')](respondWithStatusCode(_0x29b0e6,null))[_0x8387('0x62')](handleError(_0x29b0e6,null));};exports['create']=function(_0x3868de,_0x18bac7){var _0x43bc05={'name':_0x3868de[_0x8387('0x66')][_0x8387('0x27')],'key':_0x3868de[_0x8387('0x66')][_0x8387('0x4a')],'provider':_0x3868de['body']['provider']==='custom'?null:_0x3868de['body'][_0x8387('0x73')],'email':_0x3868de[_0x8387('0x66')][_0x8387('0x74')],'ListId':_0x3868de[_0x8387('0x66')]['ListId'],'active':!_[_0x8387('0x75')](_0x3868de[_0x8387('0x66')]['active'])?_0x3868de[_0x8387('0x66')]['active']:!![],'description':_0x3868de['body'][_0x8387('0x76')]||null};var _0x5d849a=getAuthenticationOptions(_0x43bc05[_0x8387('0x73')],_0x3868de[_0x8387('0x66')]);_0x43bc05[_0x8387('0x3f')]=_0x5d849a['Imap'];_0x43bc05['Smtp']=_0x5d849a[_0x8387('0x40')];return db[_0x8387('0x5d')][_0x8387('0x6b')](_0x43bc05,{'include':[{'model':db[_0x8387('0x43')],'as':'Smtp'},{'model':db[_0x8387('0x42')],'as':_0x8387('0x3f')}]})['then'](function(_0x26d78e){var _0x41e862=_0x3868de[_0x8387('0x34')][_0x8387('0x77')]({'plain':!![]});if(!_0x41e862)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41e862[_0x8387('0x78')]==='user'){var _0x101d71=_0x26d78e[_0x8387('0x77')]({'plain':!![]});return db['UserProfileSection'][_0x8387('0x65')]({'where':{'name':_0x8387('0x25'),'userProfileId':_0x41e862['userProfileId']},'raw':!![]})[_0x8387('0x13')](function(_0x27a245){if(_0x27a245&&_0x27a245[_0x8387('0x79')]===0x0){return db[_0x8387('0x26')][_0x8387('0x6b')]({'name':_0x101d71['name'],'resourceId':_0x101d71['id'],'type':_0x27a245['name'],'sectionId':_0x27a245['id']},{})['then'](function(){return _0x26d78e;});}else{return _0x26d78e;}})['catch'](function(_0x303c65){logger[_0x8387('0x19')](_0x8387('0x7a'),_0x303c65);throw _0x303c65;});}return _0x26d78e;})[_0x8387('0x13')](respondWithResult(_0x18bac7,0xc9))[_0x8387('0x62')](handleError(_0x18bac7,null));};exports['getImap']=function(_0x54ace5,_0x469da2){return db[_0x8387('0x5d')][_0x8387('0x6d')]({'where':{'id':_0x54ace5[_0x8387('0x64')]['id']}})['then'](handleEntityNotFound(_0x469da2,null))[_0x8387('0x13')](function(_0x5e8b15){if(_0x5e8b15){return _0x5e8b15[_0x8387('0x7b')]();}return null;})['then'](respondWithResult(_0x469da2,null))[_0x8387('0x62')](handleError(_0x469da2,null));};exports[_0x8387('0x7c')]=function(_0x4042e8,_0x434445){if(_0x4042e8[_0x8387('0x66')]['id']){delete _0x4042e8[_0x8387('0x66')]['id'];}return db[_0x8387('0x5d')][_0x8387('0x65')]({'where':{'id':_0x4042e8[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x434445,null))[_0x8387('0x13')](function(_0x3b9ebf){if(_0x3b9ebf){_0x4042e8[_0x8387('0x66')][_0x8387('0x69')]=_0x3b9ebf['id'];return db[_0x8387('0x42')][_0x8387('0x6b')](_0x4042e8[_0x8387('0x66')]);}})[_0x8387('0x13')](respondWithResult(_0x434445,null))['catch'](handleError(_0x434445,null));};exports[_0x8387('0x7d')]=function(_0x129fb9,_0x3ac177){return db['MailAccount'][_0x8387('0x6d')]({'where':{'id':_0x129fb9['params']['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x3ac177,null))[_0x8387('0x13')](function(_0x3c17b3){if(_0x3c17b3){return _0x3c17b3[_0x8387('0x7e')](null);}return null;})[_0x8387('0x13')](respondWithStatusCode(_0x3ac177,null))[_0x8387('0x62')](handleError(_0x3ac177,null));};exports[_0x8387('0x7f')]=function(_0x7b66b2,_0x32ff87){return db[_0x8387('0x5d')][_0x8387('0x6d')]({'where':{'id':_0x7b66b2[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x32ff87,null))[_0x8387('0x13')](function(_0x1174b2){if(_0x1174b2){return _0x1174b2['getSmtp']();}return null;})[_0x8387('0x13')](respondWithResult(_0x32ff87,null))[_0x8387('0x62')](handleError(_0x32ff87,null));};exports['addSmtp']=function(_0x5bf7c2,_0x1f6e7d){if(_0x5bf7c2[_0x8387('0x66')]['id']){delete _0x5bf7c2[_0x8387('0x66')]['id'];}return db[_0x8387('0x5d')][_0x8387('0x65')]({'where':{'id':_0x5bf7c2['params']['id']}})['then'](handleEntityNotFound(_0x1f6e7d,null))[_0x8387('0x13')](function(_0xe452c1){if(_0xe452c1){_0x5bf7c2[_0x8387('0x66')][_0x8387('0x69')]=_0xe452c1['id'];return db['MailServerOut']['create'](_0x5bf7c2['body']);}})[_0x8387('0x13')](respondWithResult(_0x1f6e7d,null))['catch'](handleError(_0x1f6e7d,null));};exports[_0x8387('0x80')]=function(_0x41ed21,_0x1c06ac){return db[_0x8387('0x5d')][_0x8387('0x6d')]({'where':{'id':_0x41ed21[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x1c06ac,null))[_0x8387('0x13')](function(_0x2b1e1a){if(_0x2b1e1a){return _0x2b1e1a[_0x8387('0x81')](null);}return null;})[_0x8387('0x13')](respondWithStatusCode(_0x1c06ac,null))[_0x8387('0x62')](handleError(_0x1c06ac,null));};exports[_0x8387('0x82')]=function(_0x39f193,_0x51fced){return db['MailInteraction'][_0x8387('0x65')]({'where':{'id':_0x39f193[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x51fced,null))[_0x8387('0x13')](function(_0x1c70e6){if(_0x1c70e6){return _0x1c70e6[_0x8387('0x82')](_0x39f193[_0x8387('0x66')][_0x8387('0x6f')],_[_0x8387('0x83')](_0x39f193['body'],[_0x8387('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x51fced,null))['catch'](handleError(_0x51fced,null));};exports[_0x8387('0x84')]=function(_0x2b1fe7,_0x36a129){var _0x373f44={'raw':![],'where':{}};var _0xe69f82={};var _0x562abf={'count':0x0,'rows':[]};return db[_0x8387('0x5d')]['findOne']({'where':{'id':_0x2b1fe7[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x36a129,null))[_0x8387('0x13')](function(_0x4617b1){if(_0x4617b1){_0xe69f82[_0x8387('0x4b')]=_[_0x8387('0x4d')](db[_0x8387('0x85')]['rawAttributes']);_0xe69f82[_0x8387('0x4c')]=_['keys'](_0x2b1fe7[_0x8387('0x4c')]);_0xe69f82[_0x8387('0x4e')]=_[_0x8387('0x50')](_0xe69f82[_0x8387('0x4b')],_0xe69f82[_0x8387('0x4c')]);_0x373f44[_0x8387('0x4f')]=_['intersection'](_0xe69f82[_0x8387('0x4b')],qs[_0x8387('0x51')](_0x2b1fe7[_0x8387('0x4c')][_0x8387('0x51')]));_0x373f44[_0x8387('0x4f')]=_0x373f44[_0x8387('0x4f')][_0x8387('0x52')]?_0x373f44[_0x8387('0x4f')]:_0xe69f82['model'];if(!_0x2b1fe7[_0x8387('0x4c')]['hasOwnProperty'](_0x8387('0x54'))){_0x373f44[_0x8387('0x21')]=qs[_0x8387('0x21')](_0x2b1fe7['query'][_0x8387('0x21')]);_0x373f44['offset']=qs['offset'](_0x2b1fe7[_0x8387('0x4c')][_0x8387('0x1f')]);}_0x373f44[_0x8387('0x55')]=qs[_0x8387('0x56')](_0x2b1fe7[_0x8387('0x4c')][_0x8387('0x56')]);_0x373f44[_0x8387('0x59')]=qs[_0x8387('0x4e')](_[_0x8387('0x57')](_0x2b1fe7[_0x8387('0x4c')],_0xe69f82['filters']));_0x373f44[_0x8387('0x59')][_0x8387('0x69')]=_0x4617b1['id'];if(_0x2b1fe7[_0x8387('0x4c')]['filter']){_0x373f44[_0x8387('0x59')]=_[_0x8387('0x5a')](_0x373f44[_0x8387('0x59')],{'$or':_['map'](_0x373f44['attributes'],function(_0x16cc94){var _0x3c36ff={};_0x3c36ff[_0x16cc94]={'$like':'%'+_0x2b1fe7[_0x8387('0x4c')]['filter']+'%'};return _0x3c36ff;})});}_0x373f44=_[_0x8387('0x5a')]({},_0x373f44,_0x2b1fe7[_0x8387('0x5c')]);return db[_0x8387('0x85')][_0x8387('0x22')]({'where':_0x373f44[_0x8387('0x59')]})[_0x8387('0x13')](function(_0x33a22a){_0x562abf['count']=_0x33a22a;if(_0x2b1fe7['query'][_0x8387('0x5e')]){_0x373f44['include']=[{'model':db[_0x8387('0x86')],'as':_0x8387('0x87'),'required':![]},{'model':db[_0x8387('0x88')],'as':_0x8387('0x89'),'attributes':['name',_0x8387('0x8a'),_0x8387('0x8b')],'required':![]},{'model':db['Tag'],'as':_0x8387('0x8c'),'attributes':['id','name',_0x8387('0x8d')],'where':_0x2b1fe7[_0x8387('0x4c')][_0x8387('0x8e')]?{'id':_0x2b1fe7['query'][_0x8387('0x8e')]}:undefined,'required':_0x2b1fe7[_0x8387('0x4c')][_0x8387('0x8e')]?!![]:![]}];}return db[_0x8387('0x85')][_0x8387('0x60')](_0x373f44);})['then'](function(_0x1816e1){_0x562abf[_0x8387('0x61')]=_0x1816e1;return _0x562abf;});}})[_0x8387('0x13')](respondWithFilteredResult(_0x36a129,_0x373f44))['catch'](handleError(_0x36a129,null));};exports['addApplications']=function addApplications(_0x23d6a0,_0x7fd27){var _0x3cd733=_0x23d6a0[_0x8387('0x64')]['id'];var _0xac6ff5=_0x23d6a0[_0x8387('0x66')];var _0x142e7f=0xc8;var _0x2844a0=null;return db[_0x8387('0x8f')][_0x8387('0x90')]({'isolationLevel':db[_0x8387('0x8f')]['Transaction'][_0x8387('0x91')][_0x8387('0x92')]},function(_0x3e8a2d){return db[_0x8387('0x5d')]['findOne']({'where':{'id':_0x3cd733},'transaction':_0x3e8a2d})[_0x8387('0x13')](function(_0x2fbf3b){if(_0x2fbf3b){return db[_0x8387('0x93')]['destroy']({'where':{'MailAccountId':_0x3cd733},'transaction':_0x3e8a2d})[_0x8387('0x13')](function(){var _0x3c7475=_['map'](_0xac6ff5,function(_0x2f667e){_0x2f667e['MailAccountId']=_0x3cd733;return _0x2f667e;});return db[_0x8387('0x93')][_0x8387('0x94')](_0x3c7475,{'transaction':_0x3e8a2d});});}else{_0x142e7f=0x194;_0x2844a0=[];}});})[_0x8387('0x13')](function(){if(_0x142e7f!==0x194){return db['MailApplication'][_0x8387('0x95')]({'where':{'MailAccountId':_0x3cd733},'order':_0x8387('0x96')})['then'](function(_0x5f2f34){_0x2844a0=_0x5f2f34;});}})['catch'](function(_0x3f9678){_0x142e7f=0x1f4;logger[_0x8387('0x19')](_0x3f9678[_0x8387('0x97')]);if(_0x3f9678[_0x8387('0x27')]){delete _0x3f9678['name'];}_0x2844a0=_0x3f9678;})[_0x8387('0x98')](function(){if(_0x2844a0===null){_0x7fd27['sendStatus'](_0x142e7f);}else{if(_0x142e7f===0x1f4){_0x7fd27['status'](_0x142e7f)[_0x8387('0x28')](_0x2844a0);}else{_0x7fd27[_0x8387('0x1d')](_0x142e7f)[_0x8387('0x99')](_0x2844a0);}}});};exports['getApplications']=function(_0x576e00,_0x12fe12){var _0x2993ac={};var _0x56188f={};var _0x558104;var _0x4b0b27;return db[_0x8387('0x5d')]['findOne']({'where':{'id':_0x576e00['params']['id']}})['then'](handleEntityNotFound(_0x12fe12,null))[_0x8387('0x13')](function(_0x270ea1){if(_0x270ea1){_0x558104=_0x270ea1;_0x56188f[_0x8387('0x4b')]=_[_0x8387('0x4d')](db[_0x8387('0x93')]['rawAttributes']);_0x56188f['query']=_[_0x8387('0x4d')](_0x576e00[_0x8387('0x4c')]);_0x56188f[_0x8387('0x4e')]=_['intersection'](_0x56188f[_0x8387('0x4b')],_0x56188f[_0x8387('0x4c')]);_0x2993ac[_0x8387('0x4f')]=_['intersection'](_0x56188f['model'],qs[_0x8387('0x51')](_0x576e00[_0x8387('0x4c')][_0x8387('0x51')]));_0x2993ac[_0x8387('0x4f')]=_0x2993ac[_0x8387('0x4f')][_0x8387('0x52')]?_0x2993ac[_0x8387('0x4f')]:_0x56188f[_0x8387('0x4b')];_0x2993ac[_0x8387('0x55')]=qs[_0x8387('0x56')](_0x576e00[_0x8387('0x4c')]['sort']);_0x2993ac[_0x8387('0x59')]=qs[_0x8387('0x4e')](_[_0x8387('0x57')](_0x576e00['query'],_0x56188f[_0x8387('0x4e')]));if(_0x576e00[_0x8387('0x4c')][_0x8387('0x58')]){_0x2993ac[_0x8387('0x59')]=_[_0x8387('0x5a')](_0x2993ac[_0x8387('0x59')],{'$or':_[_0x8387('0x46')](_0x2993ac[_0x8387('0x4f')],function(_0x5d985d){var _0x439e16={};_0x439e16[_0x5d985d]={'$like':'%'+_0x576e00[_0x8387('0x4c')]['filter']+'%'};return _0x439e16;})});}_0x2993ac=_[_0x8387('0x5a')]({},_0x2993ac,_0x576e00[_0x8387('0x5c')]);return _0x558104[_0x8387('0x9a')](_0x2993ac);}})[_0x8387('0x13')](function(_0xf8053e){if(_0xf8053e){_0x4b0b27=_0xf8053e[_0x8387('0x52')];if(!_0x576e00[_0x8387('0x4c')][_0x8387('0x53')](_0x8387('0x54'))){_0x2993ac[_0x8387('0x21')]=qs[_0x8387('0x21')](_0x576e00['query'][_0x8387('0x21')]);_0x2993ac[_0x8387('0x1f')]=qs['offset'](_0x576e00[_0x8387('0x4c')][_0x8387('0x1f')]);}return _0x558104[_0x8387('0x9a')](_0x2993ac);}})['then'](function(_0x1c5971){if(_0x1c5971){return _0x1c5971?{'count':_0x4b0b27,'rows':_0x1c5971}:null;}})[_0x8387('0x13')](respondWithResult(_0x12fe12,null))[_0x8387('0x62')](handleError(_0x12fe12,null));};exports[_0x8387('0x9b')]=function(_0x16bda8,_0x4d54e9){var _0x32014c={'raw':!![],'where':{}};var _0x5690ab={};var _0x2cc49a={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x16bda8[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x4d54e9,null))[_0x8387('0x13')](function(_0x1721b6){if(_0x1721b6){_0x5690ab[_0x8387('0x4b')]=_['keys'](db['MailMessage'][_0x8387('0x47')]);_0x5690ab[_0x8387('0x4c')]=_['keys'](_0x16bda8[_0x8387('0x4c')]);_0x5690ab['filters']=_[_0x8387('0x50')](_0x5690ab['model'],_0x5690ab[_0x8387('0x4c')]);_0x32014c[_0x8387('0x4f')]=_[_0x8387('0x50')](_0x5690ab[_0x8387('0x4b')],qs[_0x8387('0x51')](_0x16bda8['query'][_0x8387('0x51')]));_0x32014c['attributes']=_0x32014c['attributes'][_0x8387('0x52')]?_0x32014c[_0x8387('0x4f')]:_0x5690ab[_0x8387('0x4b')];if(!_0x16bda8['query'][_0x8387('0x53')](_0x8387('0x54'))){_0x32014c[_0x8387('0x21')]=qs[_0x8387('0x21')](_0x16bda8['query'][_0x8387('0x21')]);_0x32014c['offset']=qs['offset'](_0x16bda8[_0x8387('0x4c')][_0x8387('0x1f')]);}_0x32014c['order']=qs['sort'](_0x16bda8[_0x8387('0x4c')]['sort']);_0x32014c[_0x8387('0x59')]=qs[_0x8387('0x4e')](_[_0x8387('0x57')](_0x16bda8['query'],_0x5690ab[_0x8387('0x4e')]));_0x32014c[_0x8387('0x59')][_0x8387('0x69')]=_0x1721b6['id'];if(_0x16bda8[_0x8387('0x4c')][_0x8387('0x58')]){_0x32014c[_0x8387('0x59')]=_[_0x8387('0x5a')](_0x32014c[_0x8387('0x59')],{'$or':_[_0x8387('0x46')](_0x32014c[_0x8387('0x4f')],function(_0x581f1c){var _0x5c81c7={};_0x5c81c7[_0x581f1c]={'$like':'%'+_0x16bda8[_0x8387('0x4c')]['filter']+'%'};return _0x5c81c7;})});}if(_0x16bda8[_0x8387('0x4c')][_0x8387('0x9c')]){var _0x3dce5f=_0x16bda8[_0x8387('0x4c')][_0x8387('0x9c')][_0x8387('0x9d')](',');var _0xa4601f={};_0xa4601f[_0x3dce5f[0x0]]={'$gte':moment(_0x3dce5f[0x1])[_0x8387('0x9e')](_0x8387('0x9f'))};_0x32014c['where']=_['merge'](_0x32014c[_0x8387('0x59')],_0xa4601f);}_0x32014c=_[_0x8387('0x5a')]({},_0x32014c,_0x16bda8[_0x8387('0x5c')]);return db['MailMessage'][_0x8387('0x22')]({'where':_0x32014c[_0x8387('0x59')]})[_0x8387('0x13')](function(_0x5e9a02){_0x2cc49a['count']=_0x5e9a02;if(_0x16bda8[_0x8387('0x4c')][_0x8387('0x5e')]){_0x32014c[_0x8387('0x5f')]=[{'all':!![]}];}return db[_0x8387('0xa0')][_0x8387('0x60')](_0x32014c);})[_0x8387('0x13')](function(_0x45b9e6){if(_0x16bda8['query']['inlineCss']===_0x8387('0xa1')){for(var _0x44742b=0x0;_0x44742b<_0x45b9e6[_0x8387('0x52')];_0x44742b++){_0x45b9e6[_0x44742b][_0x8387('0x66')]=juice(_0x45b9e6[_0x44742b]['body']);}}_0x2cc49a[_0x8387('0x61')]=_0x45b9e6;return _0x2cc49a;});}})[_0x8387('0x13')](respondWithFilteredResult(_0x4d54e9,_0x32014c))[_0x8387('0x62')](handleError(_0x4d54e9,null));};exports[_0x8387('0x28')]=function(_0x10a2a4,_0x23970a){var _0x24eec2,_0x19b03f={},_0x122f3f;if(_0x10a2a4['body']['to']){_0x122f3f=_0x10a2a4[_0x8387('0x66')]['to']['split'](',')[0x0];}return db[_0x8387('0x5d')][_0x8387('0x65')]({'where':{'id':_0x10a2a4[_0x8387('0x64')]['id']},'include':[{'model':db[_0x8387('0xa2')],'as':_0x8387('0xa3'),'include':[{'model':db[_0x8387('0x86')],'as':_0x8387('0xa4'),'where':{'email':_0x122f3f},'limit':0x1,'order':[['updatedAt',_0x8387('0xa5')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8387('0xa6')],'as':_0x8387('0xa6'),'raw':!![]}]}]})[_0x8387('0x13')](handleEntityNotFound(_0x23970a,null))[_0x8387('0x13')](function(_0x6cbead){if(!_0x6cbead)return;_0x24eec2=_0x6cbead;if(!_0x6cbead[_0x8387('0x40')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x8387('0x75')](_0x10a2a4['body'][_0x8387('0xa7')])){_0x10a2a4[_0x8387('0x66')]['from']=util[_0x8387('0x9e')](_0x8387('0xa8'),_0x6cbead[_0x8387('0x27')],_0x6cbead[_0x8387('0x74')]||_0x6cbead[_0x8387('0x40')]['user']);}if(_0x10a2a4[_0x8387('0x66')]['attachments']&&_0x10a2a4[_0x8387('0x66')][_0x8387('0xa9')][_0x8387('0x52')]){for(var _0x12ed11=0x0;_0x12ed11<_0x10a2a4[_0x8387('0x66')][_0x8387('0xa9')][_0x8387('0x52')];_0x12ed11+=0x1){_0x10a2a4[_0x8387('0x66')]['attachments'][_0x12ed11]={'filename':_0x10a2a4[_0x8387('0x66')]['attachments'][_0x12ed11]['name'],'path':path[_0x8387('0xaa')](config[_0x8387('0xab')],_0x8387('0xac'),_0x10a2a4[_0x8387('0x66')][_0x8387('0xa9')][_0x12ed11]['basename'])};}}var _0x1cf803=_0x6cbead[_0x8387('0xad')]();return respondWithRpcPromise(_0x8387('0xae'),_0x8387('0xaf'),{'account':_0x1cf803,'message':_0x10a2a4[_0x8387('0x66')]});})[_0x8387('0x13')](function(_0x4b0d7a){if(!_0x4b0d7a)return;_0x19b03f=_0x4b0d7a;if(!_0x24eec2[_0x8387('0xa3')])throw new Error(_0x8387('0xb0'));if(_0x24eec2[_0x8387('0xa3')][_0x8387('0xa4')][_0x8387('0x52')])return _0x24eec2[_0x8387('0xa3')][_0x8387('0xa4')][0x0];return db[_0x8387('0x86')]['create'](_[_0x8387('0xb1')](_0x10a2a4[_0x8387('0x66')],{'firstName':_0x10a2a4['body']['to'],'email':_0x10a2a4[_0x8387('0x66')]['to'],'phone':_0x10a2a4[_0x8387('0x66')]['to'],'ListId':_0x24eec2[_0x8387('0xb2')]}));})[_0x8387('0x13')](function(_0x3d56ff){if(!_0x3d56ff)return;var _0x50189a={'UserId':_0x10a2a4[_0x8387('0x34')]['id'],'ContactId':_0x3d56ff['id'],'MailAccountId':_0x24eec2['id'],'inReplyTo':_0x19b03f[_0x8387('0xb3')],'to':_0x10a2a4['body']['from'],'cc':_0x10a2a4['body']['cc'],'subject':_0x10a2a4[_0x8387('0x66')][_0x8387('0xb4')],'attach':_0x10a2a4[_0x8387('0x66')]['attach'],'firstMsgDirection':_0x8387('0xb5'),'lastMsgAt':moment()['format'](_0x8387('0x9f')),'lastMsgDirection':'out','Messages':[_[_0x8387('0x5a')](_0x10a2a4[_0x8387('0x66')],{'messageId':_0x19b03f['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x24eec2['id'],'UserId':_0x10a2a4[_0x8387('0x34')]['id'],'ContactId':_0x3d56ff['id']})]};if(_0x10a2a4[_0x8387('0x66')]['Interaction']){_0x50189a=_[_0x8387('0x5a')](_0x50189a,_0x10a2a4[_0x8387('0x66')]['Interaction']);}return db[_0x8387('0x85')][_0x8387('0x6b')](_0x50189a,{'include':[{'model':db[_0x8387('0xa0')],'as':_0x8387('0xb6')}]});})['then'](respondWithResult(_0x23970a,null))[_0x8387('0x62')](handleError(_0x23970a,null));};exports[_0x8387('0xb7')]=function(_0x1d2d2f,_0x3815a2){return db[_0x8387('0x5d')][_0x8387('0x65')]({'where':{'id':_0x1d2d2f[_0x8387('0x64')]['id']},'include':[{'model':db[_0x8387('0x43')],'as':_0x8387('0x40'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8387('0xa6'),'raw':!![]}]}]})[_0x8387('0x13')](handleEntityNotFound(_0x3815a2,null))[_0x8387('0x13')](function(_0x3d0458){if(!_0x3d0458['Smtp'])return;var _0x151ff4=_0x3d0458[_0x8387('0xad')]();return respondWithRpcPromise(_0x8387('0xb8'),_0x8387('0xb7'),{'account':_0x151ff4});})[_0x8387('0x13')](respondWithResult(_0x3815a2,null))[_0x8387('0x62')](handleError(_0x3815a2,null));};exports['destroy']=function(_0x35115a,_0x44d977){return db['MailAccount'][_0x8387('0x65')]({'where':{'id':_0x35115a[_0x8387('0x64')]['id']}})['then'](handleEntityNotFound(_0x44d977,null))[_0x8387('0x13')](function(_0x2585ed){if(_0x2585ed&&_0x2585ed['service']){throw new db[(_0x8387('0xb9'))][(_0x8387('0xba'))](_0x8387('0xbb'));}return _0x2585ed;})[_0x8387('0x13')](removeEntity(_0x44d977,null))['catch'](handleError(_0x44d977,null));};exports[_0x8387('0xbc')]=function(_0x12d653,_0x1f0406){return db[_0x8387('0x5d')][_0x8387('0x65')]({'where':{'id':_0x12d653[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x1f0406,null))[_0x8387('0x13')](function(_0x860bbc){if(_0x860bbc){return _0x860bbc[_0x8387('0xbc')](_0x12d653[_0x8387('0x66')][_0x8387('0x6f')],_[_0x8387('0x83')](_0x12d653[_0x8387('0x66')],[_0x8387('0x6f'),'id'])||{})[_0x8387('0xbd')](function(_0x245e8c){for(var _0x3ceaa1=0x0;_0x3ceaa1<_0x12d653['body'][_0x8387('0x6f')][_0x8387('0x52')];_0x3ceaa1+=0x1){socket[_0x8387('0xbe')](_0x8387('0xbf'),{'UserId':Number(_0x12d653[_0x8387('0x66')][_0x8387('0x6f')][_0x3ceaa1]),'MailAccountId':Number(_0x12d653['params']['id'])});}return _0x245e8c;});}})[_0x8387('0x13')](respondWithResult(_0x1f0406,null))[_0x8387('0x62')](handleError(_0x1f0406,null));};exports[_0x8387('0xc0')]=function(_0xa2de5c,_0xbd791c){return db[_0x8387('0x5d')][_0x8387('0x65')]({'where':{'id':_0xa2de5c[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0xbd791c,null))['then'](function(_0x151193){if(_0x151193){return _0x151193['removeAgents'](_0xa2de5c[_0x8387('0x4c')][_0x8387('0x6f')])['then'](function(){if(_['isArray'](_0xa2de5c[_0x8387('0x4c')][_0x8387('0x6f')])){for(var _0x578636=0x0;_0x578636<_0xa2de5c['query'][_0x8387('0x6f')]['length'];_0x578636+=0x1){socket['emit'](_0x8387('0xc1'),{'UserId':Number(_0xa2de5c[_0x8387('0x4c')]['ids'][_0x578636]),'MailAccountId':Number(_0xa2de5c[_0x8387('0x64')]['id'])});}}else{socket[_0x8387('0xbe')](_0x8387('0xc1'),{'UserId':Number(_0xa2de5c[_0x8387('0x4c')][_0x8387('0x6f')]),'MailAccountId':Number(_0xa2de5c[_0x8387('0x64')]['id'])});}});}})[_0x8387('0x13')](respondWithStatusCode(_0xbd791c,null))['catch'](handleError(_0xbd791c,null));};exports[_0x8387('0xc2')]=function(_0x55fea1,_0x4bac74){var _0x3077be={};var _0x6bd0ec={};var _0x14a269;var _0x39a126;return db['MailAccount'][_0x8387('0x6d')]({'where':{'id':_0x55fea1[_0x8387('0x64')]['id']}})[_0x8387('0x13')](handleEntityNotFound(_0x4bac74,null))[_0x8387('0x13')](function(_0x518216){if(_0x518216){_0x14a269=_0x518216;_0x6bd0ec[_0x8387('0x4b')]=_['keys'](db['User'][_0x8387('0x47')]);_0x6bd0ec[_0x8387('0x4c')]=_[_0x8387('0x4d')](_0x55fea1[_0x8387('0x4c')]);_0x6bd0ec[_0x8387('0x4e')]=_[_0x8387('0x50')](_0x6bd0ec[_0x8387('0x4b')],_0x6bd0ec[_0x8387('0x4c')]);_0x3077be[_0x8387('0x4f')]=_[_0x8387('0x50')](_0x6bd0ec[_0x8387('0x4b')],qs[_0x8387('0x51')](_0x55fea1[_0x8387('0x4c')][_0x8387('0x51')]));_0x3077be[_0x8387('0x4f')]=_0x3077be['attributes'][_0x8387('0x52')]?_0x3077be['attributes']:_0x6bd0ec['model'];_0x3077be[_0x8387('0x55')]=qs['sort'](_0x55fea1[_0x8387('0x4c')][_0x8387('0x56')]);_0x3077be[_0x8387('0x59')]=qs['filters'](_[_0x8387('0x57')](_0x55fea1['query'],_0x6bd0ec[_0x8387('0x4e')]));if(_0x55fea1[_0x8387('0x4c')]['filter']){_0x3077be[_0x8387('0x59')]=_[_0x8387('0x5a')](_0x3077be[_0x8387('0x59')],{'$or':_['map'](_0x3077be['attributes'],function(_0x23176b){var _0x4cb585={};_0x4cb585[_0x23176b]={'$like':'%'+_0x55fea1[_0x8387('0x4c')][_0x8387('0x58')]+'%'};return _0x4cb585;})});}_0x3077be=_[_0x8387('0x5a')]({},_0x3077be,_0x55fea1[_0x8387('0x5c')]);return _0x14a269[_0x8387('0xc2')](_0x3077be);}})['then'](function(_0x21d2c6){if(_0x21d2c6){_0x39a126=_0x21d2c6[_0x8387('0x52')];if(!_0x55fea1[_0x8387('0x4c')][_0x8387('0x53')](_0x8387('0x54'))){_0x3077be['limit']=qs[_0x8387('0x21')](_0x55fea1[_0x8387('0x4c')][_0x8387('0x21')]);_0x3077be['offset']=qs[_0x8387('0x1f')](_0x55fea1['query'][_0x8387('0x1f')]);}return _0x14a269[_0x8387('0xc2')](_0x3077be);}})[_0x8387('0x13')](function(_0x56a263){if(_0x56a263){return _0x56a263?{'count':_0x39a126,'rows':_0x56a263}:null;}})[_0x8387('0x13')](respondWithResult(_0x4bac74,null))[_0x8387('0x62')](handleError(_0x4bac74,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4aa5f59..92a7bb4 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 _0x58ea=['MailAccount','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x17d092,_0x219d74){var _0xae8ac0=function(_0x575487){while(--_0x575487){_0x17d092['push'](_0x17d092['shift']());}};_0xae8ac0(++_0x219d74);}(_0x58ea,0xe7));var _0xa58e=function(_0x361e18,_0x213647){_0x361e18=_0x361e18-0x0;var _0x19d4d3=_0x58ea[_0x361e18];return _0x19d4d3;};'use strict';var EventEmitter=require(_0xa58e('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xa58e('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa58e('0x2'),'afterDestroy':_0xa58e('0x3')};function emitEvent(_0x4be1d8){return function(_0x223b5a,_0x54be28,_0x5a3685){MailAccountEvents[_0xa58e('0x4')](_0x4be1d8+':'+_0x223b5a['id'],_0x223b5a);MailAccountEvents['emit'](_0x4be1d8,_0x223b5a);_0x5a3685(null);};}for(var e in events){if(events[_0xa58e('0x5')](e)){var event=events[e];MailAccount[_0xa58e('0x6')](e,emitEvent(event));}}module[_0xa58e('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xd868=['emit','hasOwnProperty','hook','exports','events','MailAccount','update','remove'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xd868,0x1ec));var _0x8d86=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xd868[_0x34021d];return _0x16597b;};'use strict';var EventEmitter=require(_0x8d86('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8d86('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d86('0x2'),'afterDestroy':_0x8d86('0x3')};function emitEvent(_0xf04d37){return function(_0x5be215,_0x346c2d,_0x3ed3d1){MailAccountEvents['emit'](_0xf04d37+':'+_0x5be215['id'],_0x5be215);MailAccountEvents[_0x8d86('0x4')](_0xf04d37,_0x5be215);_0x3ed3d1(null);};}for(var e in events){if(events[_0x8d86('0x5')](e)){var event=events[e];MailAccount[_0x8d86('0x6')](e,emitEvent(event));}}module[_0x8d86('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 7357526..9c3dec4 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 _0xe59c=['secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','exports','define','provider','custom','service','host','Smtp','port'];(function(_0x4fbc54,_0x47cf65){var _0x5940df=function(_0x6835ff){while(--_0x6835ff){_0x4fbc54['push'](_0x4fbc54['shift']());}};_0x5940df(++_0x47cf65);}(_0xe59c,0xf7));var _0xce59=function(_0x14c6df,_0x2ba34d){_0x14c6df=_0x14c6df-0x0;var _0x3ad547=_0xe59c[_0x14c6df];return _0x3ad547;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xce59('0x0')]=function(_0x2f3f4e){return _0x2f3f4e[_0xce59('0x1')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x310992=this;var _0x3dd856={'id':_0x310992['id'],'tls':{'rejectUnauthorized':![]}};if(_0x310992[_0xce59('0x2')]!==_0xce59('0x3')){_0x3dd856[_0xce59('0x4')]=_0x310992['provider'];}else{_0x3dd856['host']=_0x310992['Smtp'][_0xce59('0x5')];_0x3dd856['port']=_0x310992[_0xce59('0x6')][_0xce59('0x7')];_0x3dd856['secure']=_0x310992[_0xce59('0x6')][_0xce59('0x8')];}if(_0x310992[_0xce59('0x6')][_0xce59('0x9')]){if(_0x310992[_0xce59('0x6')][_0xce59('0xa')]){if(!_0x310992['Smtp']['CloudProvider'])throw new Error(_0xce59('0xb'));_0x3dd856['auth']={'type':_0xce59('0xc'),'user':_0x310992[_0xce59('0x6')][_0xce59('0xd')],'accessToken':_0x310992[_0xce59('0x6')]['CloudProvider'][_0xce59('0xe')]};}else{_0x3dd856[_0xce59('0xf')]={'user':_0x310992[_0xce59('0x6')]['user'],'pass':_0x310992['Smtp'][_0xce59('0x10')]};}}return _0x3dd856;}}});}; \ No newline at end of file +var _0x1693=['auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','Smtp','port','secure','authentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','CloudProvider','data5'];(function(_0x1bb02f,_0x4ec01c){var _0x4300fa=function(_0x2179ab){while(--_0x2179ab){_0x1bb02f['push'](_0x1bb02f['shift']());}};_0x4300fa(++_0x4ec01c);}(_0x1693,0x1de));var _0x3169=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x1693[_0x2df507];return _0x1f7167;};'use strict';var attributes=require(_0x3169('0x0'));module[_0x3169('0x1')]=function(_0x381b93){return _0x381b93[_0x3169('0x2')](_0x3169('0x3'),attributes,{'tableName':_0x3169('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3528fd=this;var _0x41164f={'id':_0x3528fd['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3528fd[_0x3169('0x5')]!=='custom'){_0x41164f['service']=_0x3528fd['provider'];}else{_0x41164f['host']=_0x3528fd[_0x3169('0x6')]['host'];_0x41164f[_0x3169('0x7')]=_0x3528fd[_0x3169('0x6')]['port'];_0x41164f[_0x3169('0x8')]=_0x3528fd[_0x3169('0x6')][_0x3169('0x8')];}if(_0x3528fd['Smtp'][_0x3169('0x9')]){if(_0x3528fd[_0x3169('0x6')]['modernAuthentication']){if(!_0x3528fd[_0x3169('0x6')]['CloudProvider'])throw new Error(_0x3169('0xa'));_0x41164f['auth']={'type':_0x3169('0xb'),'user':_0x3528fd[_0x3169('0x6')][_0x3169('0xc')],'accessToken':_0x3528fd[_0x3169('0x6')][_0x3169('0xd')][_0x3169('0xe')]};}else{_0x41164f[_0x3169('0xf')]={'user':_0x3528fd['Smtp']['user'],'pass':_0x3528fd[_0x3169('0x6')][_0x3169('0x10')]};}}return _0x41164f;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f3180d2..21cf469 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 _0x0295=['setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','priority','asc','autoclose','close','*,*,*,*','length','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','created','create','attachments','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','User','name','agent','Start','startRouting','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','model','map','debug','ShowMailAccount','find','where','smtp'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x0295,0x1f0));var _0x5029=function(_0x41a4bb,_0x36b115){_0x41a4bb=_0x41a4bb-0x0;var _0x4d4239=_0x0295[_0x41a4bb];return _0x4d4239;};'use strict';var _=require(_0x5029('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5029('0x1'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x5029('0x2'))(_0x5029('0x3'));var config=require(_0x5029('0x4'));var jayson=require(_0x5029('0x5'));var client=jayson[_0x5029('0x6')][_0x5029('0x7')]({'port':0x232c});config[_0x5029('0x8')]=_[_0x5029('0x9')](config[_0x5029('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5029('0xa'))['register'](socket);function respondWithRpcPromise(_0x1532e9,_0x5bccfc,_0x14d4ef){return new BPromise(function(_0x520bc3,_0x222ddb){return client[_0x5029('0xb')](_0x1532e9,_0x14d4ef)[_0x5029('0xc')](function(_0x52fa95){logger[_0x5029('0xd')](_0x5029('0xe'),_0x5bccfc,_0x5029('0xf'));logger['debug'](_0x5029('0x10'),_0x5bccfc,_0x5029('0xf'),JSON['stringify'](_0x52fa95));if(_0x52fa95['error']){if(_0x52fa95['error']['code']===0x1f4){logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);return _0x222ddb(_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);}logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);return _0x520bc3(_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);}else{logger[_0x5029('0xd')](_0x5029('0xe'),_0x5bccfc,_0x5029('0xf'));_0x520bc3(_0x52fa95['result'][_0x5029('0x12')]);}})[_0x5029('0x13')](function(_0x35de81){logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x35de81);_0x222ddb(_0x35de81);});});}exports[_0x5029('0x14')]=function(_0xaba461){var _0x4adbb3=this;return new Promise(function(_0x226a5c,_0x5696b1){return db[_0x5029('0x15')][_0x5029('0x16')]({'raw':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xaba461['options']?_0xaba461[_0x5029('0x17')]['where']||null:null,'attributes':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x18')]||null:null,'limit':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x19')]||null:null,'include':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x1a')]?_['map'](_0xaba461['options']['include'],function(_0x588d90){return{'model':db[_0x588d90[_0x5029('0x1b')]],'as':_0x588d90['as'],'attributes':_0x588d90['attributes'],'include':_0x588d90['include']?_[_0x5029('0x1c')](_0x588d90[_0x5029('0x1a')],function(_0x36d810){return{'model':db[_0x36d810['model']],'as':_0x36d810['as'],'attributes':_0x36d810[_0x5029('0x18')],'include':_0x36d810[_0x5029('0x1a')]?_['map'](_0x36d810[_0x5029('0x1a')],function(_0x31f0a0){return{'model':db[_0x31f0a0[_0x5029('0x1b')]],'as':_0x31f0a0['as'],'attributes':_0x31f0a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5029('0xc')](function(_0x251f99){logger[_0x5029('0xd')]('GetMailAccount',_0xaba461);logger[_0x5029('0x1d')](_0x5029('0x14'),_0xaba461,JSON['stringify'](_0x251f99));_0x226a5c(_0x251f99);})[_0x5029('0x13')](function(_0x25032b){logger[_0x5029('0x11')](_0x5029('0x14'),_0x25032b[_0x5029('0x12')],_0xaba461);_0x5696b1(_0x4adbb3[_0x5029('0x11')](0x1f4,_0x25032b[_0x5029('0x12')]));});});};exports[_0x5029('0x1e')]=function(_0x250156){var _0x22559a=this;return new Promise(function(_0x358a2b,_0x4519c8){return db['MailAccount'][_0x5029('0x1f')]({'raw':_0x250156['options']?_0x250156[_0x5029('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x250156['options']?_0x250156[_0x5029('0x17')][_0x5029('0x20')]||null:null,'attributes':_0x250156[_0x5029('0x17')]?_0x250156['options'][_0x5029('0x18')]||null:null,'include':_0x250156[_0x5029('0x17')]?_0x250156[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x250156[_0x5029('0x17')][_0x5029('0x1a')],function(_0x22205e){return{'model':db[_0x22205e[_0x5029('0x1b')]],'as':_0x22205e['as'],'attributes':_0x22205e['attributes'],'include':_0x22205e[_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x22205e[_0x5029('0x1a')],function(_0x1b3817){return{'model':db[_0x1b3817['model']],'as':_0x1b3817['as'],'attributes':_0x1b3817[_0x5029('0x18')],'include':_0x1b3817[_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x1b3817['include'],function(_0x4904cc){return{'model':db[_0x4904cc[_0x5029('0x1b')]],'as':_0x4904cc['as'],'attributes':_0x4904cc[_0x5029('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57784c){if(_0x250156[_0x5029('0x17')][_0x5029('0x21')]===!![])_0x57784c[_0x5029('0x22')](_0x5029('0x23'),_0x57784c[_0x5029('0x24')]());logger[_0x5029('0xd')](_0x5029('0x1e'),_0x250156);logger[_0x5029('0x1d')](_0x5029('0x1e'),_0x250156,JSON[_0x5029('0x25')](_0x57784c));_0x358a2b(_0x57784c);})[_0x5029('0x13')](function(_0xbdb3fa){logger[_0x5029('0x11')](_0x5029('0x1e'),_0xbdb3fa['message'],_0x250156);_0x4519c8(_0x22559a['error'](0x1f4,_0xbdb3fa[_0x5029('0x12')]));});});};exports[_0x5029('0x26')]=function(_0x423ed1){var _0x48c9eb=this;return new Promise(function(_0x32d8a3,_0x39b216){var _0x52572a={'body':_0x423ed1[_0x5029('0x27')],'channel':'mail'};var _0x506f0d=_['difference'](_[_0x5029('0x28')](db[_0x5029('0x29')][_0x5029('0x2a')]),[_0x5029('0x2b'),_0x5029('0x2c'),_0x5029('0x2d'),_0x5029('0x2e')]);var _0x1021ea=![];if(_0x423ed1[_0x5029('0x27')]['id']){delete _0x423ed1['body']['id'];}if(_[_0x5029('0x2f')](_0x423ed1[_0x5029('0x27')][_0x5029('0x30')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x31')));}if(_[_0x5029('0x2f')](_0x423ed1['body'][_0x5029('0x27')])||_0x423ed1[_0x5029('0x27')][_0x5029('0x27')]===''){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x32')));}if(_['isNil'](_0x423ed1[_0x5029('0x27')][_0x5029('0x33')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x34')+_0x506f0d));}if(!_[_0x5029('0x35')](_0x506f0d,_0x423ed1[_0x5029('0x27')][_0x5029('0x33')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x36')+_0x506f0d));}var _0x51514e={};_0x51514e[_0x423ed1[_0x5029('0x27')][_0x5029('0x33')]]=_0x423ed1[_0x5029('0x27')][_0x5029('0x30')];return db['MailAccount']['find']({'where':{'id':_0x423ed1[_0x5029('0x37')]['id']},'include':[{'model':db[_0x5029('0x38')],'as':_0x5029('0x39'),'include':[{'model':db[_0x5029('0x29')],'as':_0x5029('0x3a'),'where':_0x51514e,'limit':0x1,'order':[[_0x5029('0x2c'),_0x5029('0x3b')]]}]},{'model':db[_0x5029('0x3c')],'as':_0x5029('0x3d')},{'model':db[_0x5029('0x3e')],'as':_0x5029('0x3f'),'include':[{'model':db[_0x5029('0x40')],'as':_0x5029('0x40')}]}]})[_0x5029('0xc')](function(_0x3168bd){if(_0x3168bd&&_0x3168bd[_0x5029('0x39')]){var _0x10fc07=_0x3168bd[_0x5029('0x41')]({'plain':!![]});_0x52572a[_0x5029('0x37')]=_[_0x5029('0x42')](_0x10fc07,[_0x5029('0x3d'),'List']);_0x52572a[_0x5029('0x37')]['smtpOptions']=_0x3168bd[_0x5029('0x24')]();_0x52572a[_0x5029('0x43')]=_0x10fc07['Applications'];_0x52572a['list']=_0x10fc07[_0x5029('0x39')];_0x52572a['applications']=_['orderBy'](_0x52572a[_0x5029('0x43')],[_0x5029('0x44')],[_0x5029('0x45')]);if(_0x52572a['account']&&_0x52572a['account'][_0x5029('0x46')]){_0x52572a[_0x5029('0x43')]['push']({'id':0x0,'priority':_0x52572a[_0x5029('0x43')]['length']+0x1,'app':_0x5029('0x47'),'appdata':'autoclose','interval':_0x5029('0x48')});}if(_0x52572a[_0x5029('0x37')][_0x5029('0x3d')]){delete _0x52572a[_0x5029('0x37')][_0x5029('0x3d')];}if(_0x52572a[_0x5029('0x37')][_0x5029('0x39')]){delete _0x52572a[_0x5029('0x37')]['List'];}if(_0x10fc07[_0x5029('0x39')]['Contacts'][_0x5029('0x49')]){return _0x10fc07[_0x5029('0x39')]['Contacts'][0x0];}var _0x2a2da5=_['defaults'](_0x423ed1['body'],{'firstName':_0x423ed1['body'][_0x5029('0x30')],'ListId':_0x10fc07['ListId']});_0x2a2da5[_0x423ed1[_0x5029('0x27')][_0x5029('0x33')]]=_0x423ed1[_0x5029('0x27')]['from'];return db[_0x5029('0x29')]['create'](_0x2a2da5);}else{throw new Error('List\x20not\x20found');}})[_0x5029('0xc')](function(_0x98abd1){_0x52572a[_0x5029('0x4a')]=_0x98abd1;if(_0x98abd1){if(!_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['messageId']){_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4b')]=rs[_0x5029('0x4c')]()+'\x20'+_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x30')];}var _0x4d4a2d={'ContactId':_0x98abd1['id'],'MailAccountId':_0x423ed1['account']['id'],'inReplyTo':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4b')],'to':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x30')],'cc':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['cc'],'subject':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4d')],'attach':_0x423ed1['body']['message'][_0x5029('0x4e')],'lastMsgAt':moment()[_0x5029('0x4f')](_0x5029('0x50')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x5029('0x1f')]({'where':{'closed':![],'MailAccountId':_0x423ed1[_0x5029('0x37')]['id']},'include':[{'model':db[_0x5029('0x51')],'as':_0x5029('0x52'),'attributes':[_0x5029('0x4b')],'where':{'messageId':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x53')]}}]})[_0x5029('0xc')](function(_0x5bf867){if(_0x5bf867){return[_0x5bf867,![]];}return db[_0x5029('0x54')]['create'](_0x4d4a2d)[_0x5029('0xc')](function(_0x4f2f0c){return[_0x4f2f0c,!![]];});});}else{throw new Error(_0x5029('0x55'));}})[_0x5029('0x56')](function(_0x2ad2e3,_0x2f5301){if(_0x2ad2e3){_0x1021ea=_0x2f5301;if(!_0x2f5301){return _0x2ad2e3[_0x5029('0x57')]({'inReplyTo':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4b')],'to':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x30')],'cc':_0x423ed1[_0x5029('0x27')]['message']['cc'],'subject':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4d')],'attach':_0x2ad2e3['attach']?_0x2ad2e3[_0x5029('0x4e')]:_0x423ed1['body'][_0x5029('0x12')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x5029('0x50')),'lastMsgAt':moment()['format'](_0x5029('0x50')),'lastMsgDirection':'in'});}else{return _0x2ad2e3;}}})[_0x5029('0xc')](function(_0x382994){_0x52572a['interaction']=_0x382994[_0x5029('0x41')]({'plain':!![]});_0x52572a['interaction'][_0x5029('0x58')]=_0x1021ea;return db[_0x5029('0x51')][_0x5029('0x59')]({'body':_0x423ed1[_0x5029('0x27')][_0x5029('0x27')],'MailAccountId':_0x423ed1['account']['id'],'MailInteractionId':_0x382994['id'],'direction':'in','ContactId':_0x52572a[_0x5029('0x4a')]['id'],'messageId':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4b')],'from':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x30')],'to':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['to'],'cc':_0x423ed1['body']['message']['cc'],'subject':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4d')],'attach':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4e')],'Attachments':_0x423ed1['body']['message'][_0x5029('0x5a')],'originTo':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x5b')],'originCc':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x5c')],'bcc':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x5d')],'ChatWebsiteId':_0x423ed1['body']['message']['ChatWebsiteId']||null,'originChannel':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x5e')]||_0x5029('0x5f'),'ChatOfflineMessageId':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x60')]||null},{'include':[{'model':db[_0x5029('0x61')],'as':_0x5029('0x62')}]});})['then'](function(_0x4bf5cf){_0x52572a[_0x5029('0x12')]=_0x4bf5cf;if(_0x52572a[_0x5029('0x63')][_0x5029('0x64')]){return db[_0x5029('0x65')][_0x5029('0x1f')]({'attributes':['id',_0x5029('0x66')],'where':{'id':_0x52572a[_0x5029('0x63')]['UserId']}})[_0x5029('0xc')](function(_0x3a0d6f){if(_0x3a0d6f){_0x52572a[_0x5029('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5029('0x67'),'appdata':_0x3a0d6f[_0x5029('0x66')]+','+(_0x52572a[_0x5029('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x5029('0x48')});}return respondWithRpcPromise(_0x5029('0x68'),_0x5029('0x69'),_0x52572a);});}return respondWithRpcPromise('Start',_0x5029('0x69'),_0x52572a);})[_0x5029('0xc')](function(_0x5a35bc){_0x32d8a3(_0x5a35bc);})[_0x5029('0x13')](function(_0x42d795){_0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x42d795[_0x5029('0x12')]));});});}; \ No newline at end of file +var _0x5f66=['../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','request\x20sent','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','where','limit','include','map','model','attributes','stringify','find','smtp','smtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','getSmtpOptions','list','applications','orderBy','priority','autoclose','push','close','defaults','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','MailMessage','create','attachments','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','name','unshift','agent','*,*,*,*','startRouting','Start','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var db=require(_0x65f6('0x3'))['db'];var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x6'));var client=jayson['client'][_0x65f6('0x7')]({'port':0x232c});config[_0x65f6('0x8')]=_['defaults'](config['redis'],{'host':_0x65f6('0x9'),'port':0x18eb});var socket=require(_0x65f6('0xa'))(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0xb'))[_0x65f6('0xc')](socket);function respondWithRpcPromise(_0x14f4c7,_0x48d85c,_0x5123ee){return new BPromise(function(_0x18fea1,_0x2f6d5b){return client[_0x65f6('0xd')](_0x14f4c7,_0x5123ee)[_0x65f6('0xe')](function(_0x50d26d){logger[_0x65f6('0xf')]('MailAccount,\x20%s,\x20%s',_0x48d85c,'request\x20sent');logger[_0x65f6('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x48d85c,_0x65f6('0x11'),JSON['stringify'](_0x50d26d));if(_0x50d26d[_0x65f6('0x12')]){if(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x13')]===0x1f4){logger[_0x65f6('0x12')](_0x65f6('0x14'),_0x48d85c,_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);return _0x2f6d5b(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);}logger[_0x65f6('0x12')]('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x50d26d[_0x65f6('0x12')]['message']);return _0x18fea1(_0x50d26d['error'][_0x65f6('0x15')]);}else{logger[_0x65f6('0xf')](_0x65f6('0x14'),_0x48d85c,_0x65f6('0x11'));_0x18fea1(_0x50d26d[_0x65f6('0x16')][_0x65f6('0x15')]);}})[_0x65f6('0x17')](function(_0x18380e){logger['error']('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x18380e);_0x2f6d5b(_0x18380e);});});}exports[_0x65f6('0x18')]=function(_0x5b4055){var _0x4c81f3=this;return new Promise(function(_0x5c5b91,_0x365159){return db[_0x65f6('0x19')]['findAll']({'raw':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1c')]||null:null,'attributes':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')]['attributes']||null:null,'limit':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1d')]||null:null,'include':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x5b4055[_0x65f6('0x1a')]['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x20')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x21')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x20')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes'],'include':_0x29abdb[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x29abdb['include'],function(_0x325cb4){return{'model':db[_0x325cb4[_0x65f6('0x20')]],'as':_0x325cb4['as'],'attributes':_0x325cb4[_0x65f6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ac04b){logger['info'](_0x65f6('0x18'),_0x5b4055);logger[_0x65f6('0x10')](_0x65f6('0x18'),_0x5b4055,JSON[_0x65f6('0x22')](_0x4ac04b));_0x5c5b91(_0x4ac04b);})[_0x65f6('0x17')](function(_0x14a387){logger[_0x65f6('0x12')]('GetMailAccount',_0x14a387['message'],_0x5b4055);_0x365159(_0x4c81f3[_0x65f6('0x12')](0x1f4,_0x14a387[_0x65f6('0x15')]));});});};exports['ShowMailAccount']=function(_0x4e50c0){var _0x10b368=this;return new Promise(function(_0x1ce43c,_0x11fe3b){return db[_0x65f6('0x19')][_0x65f6('0x23')]({'raw':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0['options'][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')]['where']||null:null,'attributes':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x21')]||null:null,'include':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')]?_['map'](_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x20')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1e')]?_['map'](_0x4f3e22[_0x65f6('0x1e')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x21')],'include':_0x24f7fd[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x24f7fd['include'],function(_0x582c7e){return{'model':db[_0x582c7e[_0x65f6('0x20')]],'as':_0x582c7e['as'],'attributes':_0x582c7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xe')](function(_0x4e6653){if(_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x24')]===!![])_0x4e6653['setDataValue'](_0x65f6('0x25'),_0x4e6653['getSmtpOptions']());logger['info'](_0x65f6('0x26'),_0x4e50c0);logger[_0x65f6('0x10')](_0x65f6('0x26'),_0x4e50c0,JSON[_0x65f6('0x22')](_0x4e6653));_0x1ce43c(_0x4e6653);})[_0x65f6('0x17')](function(_0x28845a){logger[_0x65f6('0x12')](_0x65f6('0x26'),_0x28845a['message'],_0x4e50c0);_0x11fe3b(_0x10b368[_0x65f6('0x12')](0x1f4,_0x28845a['message']));});});};exports[_0x65f6('0x27')]=function(_0xa4394a){var _0x4ba7db=this;return new Promise(function(_0x2ea7f7,_0x5ef5c2){var _0x32148f={'body':_0xa4394a[_0x65f6('0x28')],'channel':_0x65f6('0x29')};var _0x3fb1c6=_[_0x65f6('0x2a')](_[_0x65f6('0x2b')](db[_0x65f6('0x2c')][_0x65f6('0x2d')]),[_0x65f6('0x2e'),'updatedAt',_0x65f6('0x2f'),_0x65f6('0x30')]);var _0x377ae5=![];if(_0xa4394a[_0x65f6('0x28')]['id']){delete _0xa4394a[_0x65f6('0x28')]['id'];}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x65f6('0x33')));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')])||_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')]===''){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3fb1c6));}if(!_[_0x65f6('0x35')](_0x3fb1c6,_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db['error'](0x1f4,_0x65f6('0x36')+_0x3fb1c6));}var _0x3386a2={};_0x3386a2[_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')]]=_0xa4394a['body'][_0x65f6('0x32')];return db['MailAccount'][_0x65f6('0x23')]({'where':{'id':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x65f6('0x38'),'include':[{'model':db['CmContact'],'as':_0x65f6('0x39'),'where':_0x3386a2,'limit':0x1,'order':[[_0x65f6('0x3a'),_0x65f6('0x3b')]]}]},{'model':db[_0x65f6('0x3c')],'as':_0x65f6('0x3d')},{'model':db[_0x65f6('0x3e')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x65f6('0x3f')}]}]})[_0x65f6('0xe')](function(_0x3b647a){if(_0x3b647a&&_0x3b647a[_0x65f6('0x38')]){var _0x3b907c=_0x3b647a[_0x65f6('0x40')]({'plain':!![]});_0x32148f[_0x65f6('0x37')]=_[_0x65f6('0x41')](_0x3b907c,[_0x65f6('0x3d'),'List']);_0x32148f[_0x65f6('0x37')][_0x65f6('0x25')]=_0x3b647a[_0x65f6('0x42')]();_0x32148f['applications']=_0x3b907c[_0x65f6('0x3d')];_0x32148f[_0x65f6('0x43')]=_0x3b907c['List'];_0x32148f[_0x65f6('0x44')]=_[_0x65f6('0x45')](_0x32148f['applications'],[_0x65f6('0x46')],['asc']);if(_0x32148f[_0x65f6('0x37')]&&_0x32148f[_0x65f6('0x37')][_0x65f6('0x47')]){_0x32148f['applications'][_0x65f6('0x48')]({'id':0x0,'priority':_0x32148f[_0x65f6('0x44')]['length']+0x1,'app':_0x65f6('0x49'),'appdata':_0x65f6('0x47'),'interval':'*,*,*,*'});}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')];}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x38')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x38')];}if(_0x3b907c['List']['Contacts']['length']){return _0x3b907c[_0x65f6('0x38')][_0x65f6('0x39')][0x0];}var _0x111a8a=_[_0x65f6('0x4a')](_0xa4394a['body'],{'firstName':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')],'ListId':_0x3b907c[_0x65f6('0x30')]});_0x111a8a[_0xa4394a['body'][_0x65f6('0x34')]]=_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')];return db['CmContact']['create'](_0x111a8a);}else{throw new Error(_0x65f6('0x4b'));}})[_0x65f6('0xe')](function(_0x4125cb){_0x32148f[_0x65f6('0x4c')]=_0x4125cb;if(_0x4125cb){if(!_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]){_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]=rs[_0x65f6('0x4e')]()+'\x20'+_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')];}var _0x5ba9c6={'ContactId':_0x4125cb['id'],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a[_0x65f6('0x28')]['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x50')],'lastMsgAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x65f6('0x52')][_0x65f6('0x23')]({'where':{'closed':![],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x65f6('0x53'),'attributes':[_0x65f6('0x4d')],'where':{'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x54')]}}]})[_0x65f6('0xe')](function(_0x5e4759){if(_0x5e4759){return[_0x5e4759,![]];}return db['MailInteraction']['create'](_0x5ba9c6)[_0x65f6('0xe')](function(_0x367d95){return[_0x367d95,!![]];});});}else{throw new Error(_0x65f6('0x55'));}})[_0x65f6('0x56')](function(_0xab6f0,_0x304cf9){if(_0xab6f0){_0x377ae5=_0x304cf9;if(!_0x304cf9){return _0xab6f0['update']({'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a['body'][_0x65f6('0x15')]['cc'],'subject':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x4f')],'attach':_0xab6f0[_0x65f6('0x50')]?_0xab6f0[_0x65f6('0x50')]:_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'substatus':null,'substatusAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x65f6('0x57')),'lastMsgDirection':'in'});}else{return _0xab6f0;}}})[_0x65f6('0xe')](function(_0x4a9524){_0x32148f[_0x65f6('0x58')]=_0x4a9524['get']({'plain':!![]});_0x32148f[_0x65f6('0x58')]['created']=_0x377ae5;return db[_0x65f6('0x59')][_0x65f6('0x5a')]({'body':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'MailInteractionId':_0x4a9524['id'],'direction':'in','ContactId':_0x32148f[_0x65f6('0x4c')]['id'],'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')],'from':_0xa4394a['body']['message'][_0x65f6('0x32')],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['to'],'cc':_0xa4394a['body']['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'Attachments':_0xa4394a['body']['message'][_0x65f6('0x5b')],'originTo':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x5c')],'originCc':_0xa4394a['body'][_0x65f6('0x15')][_0x65f6('0x5d')],'bcc':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['bcc'],'ChatWebsiteId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x5e')]||null,'originChannel':_0xa4394a['body']['message'][_0x65f6('0x5f')]||'Email','ChatOfflineMessageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x60')]||null},{'include':[{'model':db[_0x65f6('0x61')],'as':'Attachments'}]});})['then'](function(_0x56f7f1){_0x32148f[_0x65f6('0x15')]=_0x56f7f1;if(_0x32148f[_0x65f6('0x58')][_0x65f6('0x62')]){return db['User'][_0x65f6('0x23')]({'attributes':['id',_0x65f6('0x63')],'where':{'id':_0x32148f[_0x65f6('0x58')]['UserId']}})[_0x65f6('0xe')](function(_0x15809e){if(_0x15809e){_0x32148f['applications'][_0x65f6('0x64')]({'id':0x0,'priority':0x0,'app':_0x65f6('0x65'),'appdata':_0x15809e['name']+','+(_0x32148f[_0x65f6('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x65f6('0x66')});}return respondWithRpcPromise('Start',_0x65f6('0x67'),_0x32148f);});}return respondWithRpcPromise(_0x65f6('0x68'),'startRouting',_0x32148f);})[_0x65f6('0xe')](function(_0x442e25){_0x2ea7f7(_0x442e25);})[_0x65f6('0x17')](function(_0x299b85){_0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x299b85[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1086af5..7e00e55 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 _0xceef=['remove','update','emit','removeListener','register','length'];(function(_0x393504,_0x3839ef){var _0x26e12b=function(_0x2f22aa){while(--_0x2f22aa){_0x393504['push'](_0x393504['shift']());}};_0x26e12b(++_0x3839ef);}(_0xceef,0xf6));var _0xfcee=function(_0x39941c,_0x4ad1bb){_0x39941c=_0x39941c-0x0;var _0x52d9c7=_0xceef[_0x39941c];return _0x52d9c7;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0xfcee('0x0'),_0xfcee('0x1')];function createListener(_0x508db3,_0x2c660f){return function(_0x51fa4f){_0x2c660f[_0xfcee('0x2')](_0x508db3,_0x51fa4f);};}function removeListener(_0x216a76,_0x4eed34){return function(){MailAccountEvents[_0xfcee('0x3')](_0x216a76,_0x4eed34);};}exports[_0xfcee('0x4')]=function(_0x4f3321){for(var _0x59b784=0x0,_0x35234a=events[_0xfcee('0x5')];_0x59b784<_0x35234a;_0x59b784++){var _0xd69040=events[_0x59b784];var _0x5b0d2c=createListener('mailAccount:'+_0xd69040,_0x4f3321);MailAccountEvents['on'](_0xd69040,_0x5b0d2c);}}; \ No newline at end of file +var _0xe16d=['update','emit','removeListener','length','mailAccount:','./mailAccount.events','save'];(function(_0x50a0fc,_0x324929){var _0x56188b=function(_0x260b51){while(--_0x260b51){_0x50a0fc['push'](_0x50a0fc['shift']());}};_0x56188b(++_0x324929);}(_0xe16d,0x11d));var _0xde16=function(_0x3122f6,_0x3d61bd){_0x3122f6=_0x3122f6-0x0;var _0x15b6a4=_0xe16d[_0x3122f6];return _0x15b6a4;};'use strict';var MailAccountEvents=require(_0xde16('0x0'));var events=[_0xde16('0x1'),'remove',_0xde16('0x2')];function createListener(_0x2f8135,_0x18871c){return function(_0x390c5e){_0x18871c[_0xde16('0x3')](_0x2f8135,_0x390c5e);};}function removeListener(_0x25c550,_0x1b521d){return function(){MailAccountEvents[_0xde16('0x4')](_0x25c550,_0x1b521d);};}exports['register']=function(_0x22cb02){for(var _0x4ff211=0x0,_0x3756b4=events[_0xde16('0x5')];_0x4ff211<_0x3756b4;_0x4ff211++){var _0x5c713d=events[_0x4ff211];var _0x493b6a=createListener(_0xde16('0x6')+_0x5c713d,_0x22cb02);MailAccountEvents['on'](_0x5c713d,_0x493b6a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e6af0ba..dd98279 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 _0xdac0=['/:id','put','isAuthenticated','update','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdac0,0xbb));var _0x0dac=function(_0x3e807e,_0x3baffa){_0x3e807e=_0x3e807e-0x0;var _0x53785a=_0xdac0[_0x3e807e];return _0x53785a;};'use strict';var multer=require(_0x0dac('0x0'));var util=require(_0x0dac('0x1'));var path=require('path');var timeout=require(_0x0dac('0x2'));var express=require(_0x0dac('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0dac('0x4'));var interaction=require(_0x0dac('0x5'));var config=require(_0x0dac('0x6'));var controller=require(_0x0dac('0x7'));router['get'](_0x0dac('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x0dac('0x9')](_0x0dac('0x8'),auth[_0x0dac('0xa')](),controller[_0x0dac('0xb')]);router[_0x0dac('0xc')]('/:id',auth[_0x0dac('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd7bd=['update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','put'];(function(_0xaac869,_0x5f0c4e){var _0x444220=function(_0x85ec87){while(--_0x85ec87){_0xaac869['push'](_0xaac869['shift']());}};_0x444220(++_0x5f0c4e);}(_0xd7bd,0x144));var _0xdd7b=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0xd7bd[_0x284bc3];return _0x41ac81;};'use strict';var multer=require(_0xdd7b('0x0'));var util=require(_0xdd7b('0x1'));var path=require(_0xdd7b('0x2'));var timeout=require(_0xdd7b('0x3'));var express=require('express');var router=express[_0xdd7b('0x4')]();var fs_extra=require(_0xdd7b('0x5'));var auth=require(_0xdd7b('0x6'));var interaction=require(_0xdd7b('0x7'));var config=require('../../config/environment');var controller=require(_0xdd7b('0x8'));router['get'](_0xdd7b('0x9'),auth[_0xdd7b('0xa')](),controller['show']);router[_0xdd7b('0xb')](_0xdd7b('0x9'),auth[_0xdd7b('0xa')](),controller[_0xdd7b('0xc')]);router['delete'](_0xdd7b('0x9'),auth[_0xdd7b('0xa')](),controller[_0xdd7b('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 16b8f58..bfb856d 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 _0xe689=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x1a4168,_0x7b96fe){var _0x1fdf97=function(_0x52a66a){while(--_0x52a66a){_0x1a4168['push'](_0x1a4168['shift']());}};_0x1fdf97(++_0x7b96fe);}(_0xe689,0xb8));var _0x9e68=function(_0x3584f3,_0xa2a609){_0x3584f3=_0x3584f3-0x0;var _0x19b3a7=_0xe689[_0x3584f3];return _0x19b3a7;};'use strict';var Sequelize=require(_0x9e68('0x0'));module[_0x9e68('0x1')]={'priority':{'type':Sequelize[_0x9e68('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9e68('0x3')},'appdata':{'type':Sequelize[_0x9e68('0x4')]()},'description':{'type':Sequelize[_0x9e68('0x5')]},'interval':{'type':Sequelize[_0x9e68('0x5')],'defaultValue':_0x9e68('0x6')}}; \ No newline at end of file +var _0x28c1=['exports','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x28c1,0x199));var _0x128c=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x28c1[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0x128c('0x0'));module[_0x128c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x128c('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x128c('0x3')]()},'description':{'type':Sequelize[_0x128c('0x2')]},'interval':{'type':Sequelize[_0x128c('0x2')],'defaultValue':_0x128c('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5b83da4..f7da5fa 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 _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x159424,_0x401a52){var _0x1eabe4=function(_0x17a835){while(--_0x17a835){_0x159424['push'](_0x159424['shift']());}};_0x1eabe4(++_0x401a52);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x262892,_0x22a8a7){var _0x2c259d=function(_0x37bae3){while(--_0x37bae3){_0x262892['push'](_0x262892['shift']());}};_0x2c259d(++_0x22a8a7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 81d8d15..d106d12 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 _0x5931=['utf8mb4','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications'];(function(_0x39a04c,_0x2b4002){var _0x580cb0=function(_0x138902){while(--_0x138902){_0x39a04c['push'](_0x39a04c['shift']());}};_0x580cb0(++_0x2b4002);}(_0x5931,0x1b1));var _0x1593=function(_0x810025,_0x34bb04){_0x810025=_0x810025-0x0;var _0x4dbc81=_0x5931[_0x810025];return _0x4dbc81;};'use strict';var _=require(_0x1593('0x0'));var util=require(_0x1593('0x1'));var logger=require('../../config/logger')(_0x1593('0x2'));var moment=require('moment');var BPromise=require(_0x1593('0x3'));var rp=require(_0x1593('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1593('0x5'));var config=require(_0x1593('0x6'));var attributes=require(_0x1593('0x7'));module[_0x1593('0x8')]=function(_0x56b580,_0x21a341){return _0x56b580['define'](_0x1593('0x9'),attributes,{'tableName':_0x1593('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1593('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x954d=['exports','define','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes'];(function(_0x33edc0,_0x14cc05){var _0x5bf415=function(_0x331610){while(--_0x331610){_0x33edc0['push'](_0x33edc0['shift']());}};_0x5bf415(++_0x14cc05);}(_0x954d,0x1ee));var _0xd954=function(_0x38ff2b,_0x3a0316){_0x38ff2b=_0x38ff2b-0x0;var _0x341f5e=_0x954d[_0x38ff2b];return _0x341f5e;};'use strict';var _=require(_0xd954('0x0'));var util=require(_0xd954('0x1'));var logger=require(_0xd954('0x2'))(_0xd954('0x3'));var moment=require(_0xd954('0x4'));var BPromise=require(_0xd954('0x5'));var rp=require(_0xd954('0x6'));var fs=require('fs');var path=require(_0xd954('0x7'));var rimraf=require(_0xd954('0x8'));var config=require('../../config/environment');var attributes=require(_0xd954('0x9'));module[_0xd954('0xa')]=function(_0xb665ec,_0x169eeb){return _0xb665ec[_0xd954('0xb')]('MailApplication',attributes,{'tableName':_0xd954('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd954('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 880d686..87fd792 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 _0xe1ee=['MailApplication','update','body','options','limit','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','request\x20sent','catch','UpdateMailApplication'];(function(_0x215013,_0x409bad){var _0xd13589=function(_0x38bbdf){while(--_0x38bbdf){_0x215013['push'](_0x215013['shift']());}};_0xd13589(++_0x409bad);}(_0xe1ee,0x158));var _0xee1e=function(_0x27ca07,_0x326280){_0x27ca07=_0x27ca07-0x0;var _0x54d51a=_0xe1ee[_0x27ca07];return _0x54d51a;};'use strict';var _=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var moment=require('moment');var BPromise=require(_0xee1e('0x2'));var rs=require(_0xee1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xee1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee1e('0x6'));var client=jayson[_0xee1e('0x7')][_0xee1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dbd99,_0x4dcff2,_0x335d60){return new BPromise(function(_0x5d549e,_0x575700){return client['request'](_0x3dbd99,_0x335d60)[_0xee1e('0x9')](function(_0x14d58b){logger[_0xee1e('0xa')]('MailApplication,\x20%s,\x20%s',_0x4dcff2,'request\x20sent');logger[_0xee1e('0xb')](_0xee1e('0xc'),_0x4dcff2,'request\x20sent',JSON['stringify'](_0x14d58b));if(_0x14d58b[_0xee1e('0xd')]){if(_0x14d58b[_0xee1e('0xd')][_0xee1e('0xe')]===0x1f4){logger[_0xee1e('0xd')](_0xee1e('0xf'),_0x4dcff2,_0x14d58b['error'][_0xee1e('0x10')]);return _0x575700(_0x14d58b[_0xee1e('0xd')][_0xee1e('0x10')]);}logger[_0xee1e('0xd')](_0xee1e('0xf'),_0x4dcff2,_0x14d58b[_0xee1e('0xd')]['message']);return _0x5d549e(_0x14d58b[_0xee1e('0xd')]['message']);}else{logger[_0xee1e('0xa')]('MailApplication,\x20%s,\x20%s',_0x4dcff2,_0xee1e('0x11'));_0x5d549e(_0x14d58b['result'][_0xee1e('0x10')]);}})[_0xee1e('0x12')](function(_0x3f579f){logger[_0xee1e('0xd')](_0xee1e('0xf'),_0x4dcff2,_0x3f579f);_0x575700(_0x3f579f);});});}exports[_0xee1e('0x13')]=function(_0xd6cb33){var _0x518044=this;return new Promise(function(_0x2ceeb1,_0x20c0a1){return db[_0xee1e('0x14')][_0xee1e('0x15')](_0xd6cb33[_0xee1e('0x16')],{'raw':_0xd6cb33[_0xee1e('0x17')]?_0xd6cb33[_0xee1e('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd6cb33[_0xee1e('0x17')]?_0xd6cb33[_0xee1e('0x17')]['where']||null:null,'attributes':_0xd6cb33[_0xee1e('0x17')]?_0xd6cb33[_0xee1e('0x17')]['attributes']||null:null,'limit':_0xd6cb33[_0xee1e('0x17')]?_0xd6cb33[_0xee1e('0x17')][_0xee1e('0x18')]||null:null})[_0xee1e('0x9')](function(_0x2cad73){logger[_0xee1e('0xa')]('UpdateMailApplication',_0xd6cb33);logger[_0xee1e('0xb')](_0xee1e('0x13'),_0xd6cb33,JSON[_0xee1e('0x19')](_0x2cad73));_0x2ceeb1(_0x2cad73);})['catch'](function(_0x1887c7){logger[_0xee1e('0xd')](_0xee1e('0x13'),_0x1887c7['message'],_0xd6cb33);_0x20c0a1(_0x518044['error'](0x1f4,_0x1887c7[_0xee1e('0x10')]));});});}; \ No newline at end of file +var _0x4854=['client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x244a18,_0x1d02d9){var _0x2a337a=function(_0x176a1d){while(--_0x176a1d){_0x244a18['push'](_0x244a18['shift']());}};_0x2a337a(++_0x1d02d9);}(_0x4854,0x10d));var _0x4485=function(_0x599318,_0x319486){_0x599318=_0x599318-0x0;var _0x7b06fa=_0x4854[_0x599318];return _0x7b06fa;};'use strict';var _=require(_0x4485('0x0'));var util=require(_0x4485('0x1'));var moment=require(_0x4485('0x2'));var BPromise=require(_0x4485('0x3'));var rs=require(_0x4485('0x4'));var fs=require('fs');var Redis=require(_0x4485('0x5'));var db=require(_0x4485('0x6'))['db'];var utils=require(_0x4485('0x7'));var logger=require(_0x4485('0x8'))(_0x4485('0x9'));var config=require(_0x4485('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4485('0xb')][_0x4485('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e7100,_0xbe3d11,_0x92c023){return new BPromise(function(_0x4366b8,_0x383718){return client[_0x4485('0xd')](_0x1e7100,_0x92c023)[_0x4485('0xe')](function(_0x59fb96){logger['info'](_0x4485('0xf'),_0xbe3d11,_0x4485('0x10'));logger[_0x4485('0x11')](_0x4485('0x12'),_0xbe3d11,_0x4485('0x10'),JSON[_0x4485('0x13')](_0x59fb96));if(_0x59fb96['error']){if(_0x59fb96[_0x4485('0x14')][_0x4485('0x15')]===0x1f4){logger[_0x4485('0x14')]('MailApplication,\x20%s,\x20%s',_0xbe3d11,_0x59fb96[_0x4485('0x14')][_0x4485('0x16')]);return _0x383718(_0x59fb96[_0x4485('0x14')][_0x4485('0x16')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0xbe3d11,_0x59fb96[_0x4485('0x14')][_0x4485('0x16')]);return _0x4366b8(_0x59fb96['error'][_0x4485('0x16')]);}else{logger[_0x4485('0x17')](_0x4485('0xf'),_0xbe3d11,_0x4485('0x10'));_0x4366b8(_0x59fb96[_0x4485('0x18')][_0x4485('0x16')]);}})[_0x4485('0x19')](function(_0x388929){logger[_0x4485('0x14')](_0x4485('0xf'),_0xbe3d11,_0x388929);_0x383718(_0x388929);});});}exports[_0x4485('0x1a')]=function(_0x4e0859){var _0x27e731=this;return new Promise(function(_0x3b3b34,_0x3a4a9d){return db[_0x4485('0x1b')][_0x4485('0x1c')](_0x4e0859[_0x4485('0x1d')],{'raw':_0x4e0859[_0x4485('0x1e')]?_0x4e0859[_0x4485('0x1e')][_0x4485('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e0859[_0x4485('0x1e')]?_0x4e0859[_0x4485('0x1e')][_0x4485('0x20')]||null:null,'attributes':_0x4e0859[_0x4485('0x1e')]?_0x4e0859[_0x4485('0x1e')][_0x4485('0x21')]||null:null,'limit':_0x4e0859['options']?_0x4e0859['options'][_0x4485('0x22')]||null:null})[_0x4485('0xe')](function(_0x3755d7){logger[_0x4485('0x17')](_0x4485('0x1a'),_0x4e0859);logger['debug']('UpdateMailApplication',_0x4e0859,JSON[_0x4485('0x13')](_0x3755d7));_0x3b3b34(_0x3755d7);})[_0x4485('0x19')](function(_0x4ab678){logger[_0x4485('0x14')](_0x4485('0x1a'),_0x4ab678[_0x4485('0x16')],_0x4e0859);_0x3a4a9d(_0x27e731['error'](0x1f4,_0x4ab678[_0x4485('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index fa1f30a..a7b1b27 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 _0x39d3=['addTags','mailinteraction:update','delete','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','mail','mailinteraction:addtags'];(function(_0x14d924,_0x50705c){var _0x1b506c=function(_0x258078){while(--_0x258078){_0x14d924['push'](_0x14d924['shift']());}};_0x1b506c(++_0x50705c);}(_0x39d3,0x18e));var _0x339d=function(_0x25939a,_0x26fc44){_0x25939a=_0x25939a-0x0;var _0x452374=_0x39d3[_0x25939a];return _0x452374;};'use strict';var express=require(_0x339d('0x0'));var router=express[_0x339d('0x1')]();var auth=require(_0x339d('0x2'));var interaction=require(_0x339d('0x3'));var controller=require(_0x339d('0x4'));router[_0x339d('0x5')]('/',auth['isAuthenticated'](),controller[_0x339d('0x6')]);router[_0x339d('0x5')](_0x339d('0x7'),auth[_0x339d('0x8')](),controller[_0x339d('0x9')]);router[_0x339d('0x5')](_0x339d('0xa'),auth[_0x339d('0x8')](),controller[_0x339d('0xb')]);router[_0x339d('0x5')](_0x339d('0xc'),auth['isAuthenticated'](),controller[_0x339d('0xd')]);router[_0x339d('0x5')](_0x339d('0xe'),auth[_0x339d('0x8')](),controller[_0x339d('0xf')]);router['post']('/',auth[_0x339d('0x8')](),controller[_0x339d('0x10')]);router[_0x339d('0x11')](_0x339d('0xc'),auth[_0x339d('0x8')](),controller['addMessage']);router[_0x339d('0x11')](_0x339d('0x12'),auth[_0x339d('0x8')](),interaction[_0x339d('0x13')](_0x339d('0x14'),_0x339d('0x15')),controller[_0x339d('0x16')]);router['put'](_0x339d('0xa'),auth['isAuthenticated'](),interaction[_0x339d('0x13')]('mail',_0x339d('0x17')),controller['update']);router[_0x339d('0x18')]('/:id',auth[_0x339d('0x8')](),interaction['tracked'](_0x339d('0x14'),_0x339d('0x19')),controller[_0x339d('0x1a')]);router['delete'](_0x339d('0x12'),auth['isAuthenticated'](),controller['removeTags']);module[_0x339d('0x1b')]=router; \ No newline at end of file +var _0x1a99=['mailinteraction:update','delete','/:id','destroy','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','mail','put'];(function(_0x2deb01,_0x4e741c){var _0x3920b3=function(_0x391a64){while(--_0x391a64){_0x2deb01['push'](_0x2deb01['shift']());}};_0x3920b3(++_0x4e741c);}(_0x1a99,0xdd));var _0x91a9=function(_0x1dc0b9,_0x43ffca){_0x1dc0b9=_0x1dc0b9-0x0;var _0x20013a=_0x1a99[_0x1dc0b9];return _0x20013a;};'use strict';var express=require(_0x91a9('0x0'));var router=express['Router']();var auth=require(_0x91a9('0x1'));var interaction=require(_0x91a9('0x2'));var controller=require(_0x91a9('0x3'));router[_0x91a9('0x4')]('/',auth[_0x91a9('0x5')](),controller['index']);router['get'](_0x91a9('0x6'),auth[_0x91a9('0x5')](),controller[_0x91a9('0x7')]);router[_0x91a9('0x4')]('/:id',auth[_0x91a9('0x5')](),controller[_0x91a9('0x8')]);router[_0x91a9('0x4')](_0x91a9('0x9'),auth['isAuthenticated'](),controller[_0x91a9('0xa')]);router[_0x91a9('0x4')]('/:id/download',auth[_0x91a9('0x5')](),controller[_0x91a9('0xb')]);router[_0x91a9('0xc')]('/',auth['isAuthenticated'](),controller[_0x91a9('0xd')]);router[_0x91a9('0xc')](_0x91a9('0x9'),auth[_0x91a9('0x5')](),controller[_0x91a9('0xe')]);router[_0x91a9('0xc')](_0x91a9('0xf'),auth[_0x91a9('0x5')](),interaction[_0x91a9('0x10')](_0x91a9('0x11'),'mailinteraction:addtags'),controller['addTags']);router[_0x91a9('0x12')]('/:id',auth[_0x91a9('0x5')](),interaction['tracked'](_0x91a9('0x11'),_0x91a9('0x13')),controller['update']);router[_0x91a9('0x14')](_0x91a9('0x15'),auth[_0x91a9('0x5')](),interaction['tracked']('mail','mailinteraction:destroy'),controller[_0x91a9('0x16')]);router[_0x91a9('0x14')](_0x91a9('0xf'),auth[_0x91a9('0x5')](),controller['removeTags']);module[_0x91a9('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 0b45668..800e920 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 _0xf7c2=['STRING','TEXT','BOOLEAN','ENUM','out','sequelize','iconv','exports','DATE'];(function(_0x20ea84,_0x32c2f6){var _0x565ab8=function(_0xf9be64){while(--_0xf9be64){_0x20ea84['push'](_0x20ea84['shift']());}};_0x565ab8(++_0x32c2f6);}(_0xf7c2,0x1c7));var _0x2f7c=function(_0x34cc9f,_0x4d891a){_0x34cc9f=_0x34cc9f-0x0;var _0x1991d3=_0xf7c2[_0x34cc9f];return _0x1991d3;};'use strict';var Sequelize=require(_0x2f7c('0x0'));var iconv=require(_0x2f7c('0x1'));module[_0x2f7c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2f7c('0x3')]},'disposition':{'type':Sequelize[_0x2f7c('0x4')]},'secondDisposition':{'type':Sequelize[_0x2f7c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2f7c('0x4')]},'note':{'type':Sequelize[_0x2f7c('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x2f7c('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x2f7c('0x5')]()},'attach':{'type':Sequelize[_0x2f7c('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2f7c('0x3')]},'substatus':{'type':Sequelize[_0x2f7c('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2f7c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2f7c('0x7')]('in',_0x2f7c('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2f7c('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x167e=['exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x167e,0x10c));var _0xe167=function(_0x2c3564,_0x26c96e){_0x2c3564=_0x2c3564-0x0;var _0x1a03af=_0x167e[_0x2c3564];return _0x1a03af;};'use strict';var Sequelize=require(_0xe167('0x0'));var iconv=require(_0xe167('0x1'));module[_0xe167('0x2')]={'closed':{'type':Sequelize[_0xe167('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe167('0x4')]},'disposition':{'type':Sequelize[_0xe167('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe167('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xe167('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xe167('0x6')](_0xe167('0x7'))},'subject':{'type':Sequelize[_0xe167('0x6')]()},'attach':{'type':Sequelize[_0xe167('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe167('0x4')]},'substatus':{'type':Sequelize[_0xe167('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xe167('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe167('0x8')]('in',_0xe167('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe167('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe167('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 239f132..0455d14 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 _0x9c48=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','user','show','params','keys','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','find','create','body','catch','describe','addMessage','MailMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','inlineCss','true','rows','addTags','setTags','omit','spread','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','push','Attachments','Messages','from','bcc','subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','decode','format','headers','Bcc','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','lodash','juice'];(function(_0x257b32,_0x4c1352){var _0x34cf40=function(_0x5665b6){while(--_0x5665b6){_0x257b32['push'](_0x257b32['shift']());}};_0x34cf40(++_0x4c1352);}(_0x9c48,0x6e));var _0x89c4=function(_0x10670a,_0x5a1ab6){_0x10670a=_0x10670a-0x0;var _0xa07feb=_0x9c48[_0x10670a];return _0xa07feb;};'use strict';var emlformat=require(_0x89c4('0x0'));var rimraf=require(_0x89c4('0x1'));var zipdir=require(_0x89c4('0x2'));var moment=require('moment');var BPromise=require(_0x89c4('0x3'));var util=require(_0x89c4('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x89c4('0x5'));var juice=require(_0x89c4('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x89c4('0x7'));var logger=require(_0x89c4('0x8'))(_0x89c4('0x9'));var config=require('../../config/environment');var db=require(_0x89c4('0xa'))['db'];var htmlEntities=require(_0x89c4('0xb'));config[_0x89c4('0xc')]=_[_0x89c4('0xd')](config[_0x89c4('0xc')],{'host':_0x89c4('0xe'),'port':0x18eb});var socket=require(_0x89c4('0xf'))(new Redis(config[_0x89c4('0xc')]));require(_0x89c4('0x10'))[_0x89c4('0x11')](socket);function respondWithStatusCode(_0x58f87d,_0x248de0){_0x248de0=_0x248de0||0xcc;return function(_0x495bc6){if(_0x495bc6){return _0x58f87d['sendStatus'](_0x248de0);}return _0x58f87d['status'](_0x248de0)[_0x89c4('0x12')]();};}function respondWithResult(_0x20400f,_0x1075cb){_0x1075cb=_0x1075cb||0xc8;return function(_0x4c94bc){if(_0x4c94bc){return _0x20400f[_0x89c4('0x13')](_0x1075cb)[_0x89c4('0x14')](_0x4c94bc);}};}function respondWithFilteredResult(_0x5dd359,_0x6e775c){return function(_0x4d3bf6){if(_0x4d3bf6){var _0x1915d3=typeof _0x6e775c[_0x89c4('0x15')]===_0x89c4('0x16')&&typeof _0x6e775c[_0x89c4('0x17')]==='undefined';var _0x312995=_0x4d3bf6[_0x89c4('0x18')];var _0x366b6b=_0x1915d3?0x0:_0x6e775c[_0x89c4('0x15')];var _0x44e1d5=_0x1915d3?_0x4d3bf6[_0x89c4('0x18')]:_0x6e775c[_0x89c4('0x15')]+_0x6e775c[_0x89c4('0x17')];var _0x11baee;if(_0x44e1d5>=_0x312995){_0x44e1d5=_0x312995;_0x11baee=0xc8;}else{_0x11baee=0xce;}_0x5dd359[_0x89c4('0x13')](_0x11baee);return _0x5dd359[_0x89c4('0x19')](_0x89c4('0x1a'),_0x366b6b+'-'+_0x44e1d5+'/'+_0x312995)[_0x89c4('0x14')](_0x4d3bf6);}return null;};}function saveUpdates(_0x56aa30){return function(_0xe167d0){if(_0xe167d0){return _0xe167d0[_0x89c4('0x1b')](_0x56aa30)[_0x89c4('0x1c')](function(_0x600c14){return _0x600c14;});}return null;};}function removeEntity(_0x43528a){return function(_0x501bef){if(_0x501bef){return _0x501bef[_0x89c4('0x1d')]()['then'](function(){_0x43528a['status'](0xcc)[_0x89c4('0x12')]();});}};}function handleEntityNotFound(_0x2c3e5b){return function(_0x5f0084){if(!_0x5f0084){_0x2c3e5b[_0x89c4('0x1e')](0x194);}return _0x5f0084;};}function handleError(_0x24db92,_0x13a73e){_0x13a73e=_0x13a73e||0x1f4;return function(_0x5767e5){logger['error'](_0x5767e5['stack']);if(_0x5767e5[_0x89c4('0x1f')]){delete _0x5767e5[_0x89c4('0x1f')];}_0x24db92[_0x89c4('0x13')](_0x13a73e)[_0x89c4('0x20')](_0x5767e5);};}exports[_0x89c4('0x21')]=function(_0x46ceef,_0x57ae2e){var _0x10aa30={};var _0x24a384=_[_0x89c4('0x22')](db[_0x89c4('0x23')][_0x89c4('0x24')],function(_0x12bc0d){return{'name':_0x12bc0d[_0x89c4('0x25')],'type':_0x12bc0d[_0x89c4('0x26')][_0x89c4('0x27')]};});_0x10aa30=qs['getOptions'](_0x24a384,_0x46ceef);return interaction[_0x89c4('0x28')](_0x89c4('0x29'),_0x46ceef['query'],_0x46ceef[_0x89c4('0x2a')],_0x10aa30,_0x24a384)[_0x89c4('0x1c')](respondWithFilteredResult(_0x57ae2e,_0x10aa30))['catch'](handleError(_0x57ae2e,null));};exports[_0x89c4('0x2b')]=function(_0x271684,_0x36fe69){var _0x169f6b={'raw':![],'where':{'id':_0x271684[_0x89c4('0x2c')]['id']}},_0x169c56={};_0x169c56['model']=_[_0x89c4('0x2d')](db[_0x89c4('0x23')][_0x89c4('0x24')]);_0x169c56[_0x89c4('0x2e')]=_[_0x89c4('0x2d')](_0x271684[_0x89c4('0x2e')]);_0x169c56[_0x89c4('0x2f')]=_[_0x89c4('0x30')](_0x169c56[_0x89c4('0x31')],_0x169c56[_0x89c4('0x2e')]);_0x169f6b[_0x89c4('0x32')]=_[_0x89c4('0x30')](_0x169c56['model'],qs[_0x89c4('0x33')](_0x271684[_0x89c4('0x2e')][_0x89c4('0x33')]));_0x169f6b[_0x89c4('0x32')]=_0x169f6b['attributes'][_0x89c4('0x34')]?_0x169f6b[_0x89c4('0x32')]:_0x169c56[_0x89c4('0x31')];if(_0x271684[_0x89c4('0x2e')][_0x89c4('0x35')]){_0x169f6b[_0x89c4('0x36')]=[{'all':!![]}];}_0x169f6b=_[_0x89c4('0x37')]({},_0x169f6b,_0x271684['options']);return db[_0x89c4('0x23')][_0x89c4('0x38')](_0x169f6b)['then'](handleEntityNotFound(_0x36fe69,null))[_0x89c4('0x1c')](respondWithResult(_0x36fe69,null))['catch'](handleError(_0x36fe69,null));};exports[_0x89c4('0x39')]=function(_0x20933c,_0x26bf2f){return db['MailInteraction'][_0x89c4('0x39')](_0x20933c[_0x89c4('0x3a')],{})[_0x89c4('0x1c')](respondWithResult(_0x26bf2f,0xc9))['catch'](handleError(_0x26bf2f,null));};exports[_0x89c4('0x1b')]=function(_0x3eef96,_0x31e303){if(_0x3eef96[_0x89c4('0x3a')]['id']){delete _0x3eef96['body']['id'];}return db[_0x89c4('0x23')][_0x89c4('0x38')]({'where':{'id':_0x3eef96[_0x89c4('0x2c')]['id']}})[_0x89c4('0x1c')](handleEntityNotFound(_0x31e303,null))[_0x89c4('0x1c')](saveUpdates(_0x3eef96['body'],null))[_0x89c4('0x1c')](respondWithResult(_0x31e303,null))[_0x89c4('0x3b')](handleError(_0x31e303,null));};exports[_0x89c4('0x1d')]=function(_0x456eda,_0xa4e838){return db[_0x89c4('0x23')][_0x89c4('0x38')]({'where':{'id':_0x456eda[_0x89c4('0x2c')]['id']}})[_0x89c4('0x1c')](handleEntityNotFound(_0xa4e838,null))[_0x89c4('0x1c')](removeEntity(_0xa4e838,null))['catch'](handleError(_0xa4e838,null));};exports[_0x89c4('0x3c')]=function(_0x16bd3e,_0x3c515a){return db[_0x89c4('0x23')][_0x89c4('0x3c')]()[_0x89c4('0x1c')](respondWithResult(_0x3c515a,null))['catch'](handleError(_0x3c515a,null));};exports[_0x89c4('0x3d')]=function(_0x504670,_0x149a94){return db[_0x89c4('0x3e')][_0x89c4('0x38')]({'where':{'id':_0x504670[_0x89c4('0x2c')]['id']}})[_0x89c4('0x1c')](handleEntityNotFound(_0x149a94,null))[_0x89c4('0x1c')](function(_0x690a64){if(_0x690a64){return _0x690a64['addMessage'](_0x504670['body'][_0x89c4('0x3f')],_['omit'](_0x504670[_0x89c4('0x3a')],[_0x89c4('0x3f'),'id'])||{});}})[_0x89c4('0x1c')](respondWithResult(_0x149a94,null))[_0x89c4('0x3b')](handleError(_0x149a94,null));};exports[_0x89c4('0x40')]=function(_0x5d33ed,_0x32de76){var _0xe57579={'raw':![],'where':{}};var _0x42a962={};var _0x5d4e37={'count':0x0,'rows':[]};return db[_0x89c4('0x23')][_0x89c4('0x41')]({'where':{'id':_0x5d33ed[_0x89c4('0x2c')]['id']}})['then'](handleEntityNotFound(_0x32de76,null))[_0x89c4('0x1c')](function(_0xf44a89){if(_0xf44a89){_0x42a962['model']=_[_0x89c4('0x2d')](db[_0x89c4('0x3e')][_0x89c4('0x24')]);_0x42a962[_0x89c4('0x2e')]=_[_0x89c4('0x2d')](_0x5d33ed[_0x89c4('0x2e')]);_0x42a962[_0x89c4('0x2f')]=_[_0x89c4('0x30')](_0x42a962[_0x89c4('0x31')],_0x42a962['query']);_0xe57579['attributes']=_['intersection'](_0x42a962['model'],qs[_0x89c4('0x33')](_0x5d33ed[_0x89c4('0x2e')][_0x89c4('0x33')]));_0xe57579[_0x89c4('0x32')]=_0xe57579[_0x89c4('0x32')][_0x89c4('0x34')]?_0xe57579[_0x89c4('0x32')]:_0x42a962[_0x89c4('0x31')];if(!_0x5d33ed['query'][_0x89c4('0x42')](_0x89c4('0x43'))){_0xe57579['limit']=qs[_0x89c4('0x17')](_0x5d33ed[_0x89c4('0x2e')][_0x89c4('0x17')]);_0xe57579[_0x89c4('0x15')]=qs[_0x89c4('0x15')](_0x5d33ed[_0x89c4('0x2e')][_0x89c4('0x15')]);}_0xe57579['order']=qs[_0x89c4('0x44')](_0x5d33ed[_0x89c4('0x2e')]['sort']);_0xe57579[_0x89c4('0x45')]=qs['filters'](_[_0x89c4('0x46')](_0x5d33ed[_0x89c4('0x2e')],_0x42a962['filters']));_0xe57579['where'][_0x89c4('0x47')]=_0xf44a89['id'];if(_0x5d33ed['query']['filter']){_0xe57579[_0x89c4('0x45')]=_['merge'](_0xe57579['where'],{'$or':_[_0x89c4('0x22')](_0xe57579['attributes'],function(_0x3d7aa9){var _0x49d98f={};_0x49d98f[_0x3d7aa9]={'$like':'%'+_0x5d33ed[_0x89c4('0x2e')][_0x89c4('0x48')]+'%'};return _0x49d98f;})});}if(_0x5d33ed['query'][_0x89c4('0x49')]){var _0x1777a7=_0x5d33ed[_0x89c4('0x2e')][_0x89c4('0x49')][_0x89c4('0x4a')](',');var _0x58ea63={};_0x58ea63[_0x1777a7[0x0]]={'$gte':moment(_0x1777a7[0x1])['format'](_0x89c4('0x4b'))};_0xe57579['where']=_[_0x89c4('0x37')](_0xe57579[_0x89c4('0x45')],_0x58ea63);}_0xe57579=_[_0x89c4('0x37')]({},_0xe57579,_0x5d33ed[_0x89c4('0x4c')]);return db[_0x89c4('0x3e')]['count']({'where':_0xe57579[_0x89c4('0x45')]})[_0x89c4('0x1c')](function(_0x358280){_0x5d4e37[_0x89c4('0x18')]=_0x358280;if(_0x5d33ed['query']['includeAll']){_0xe57579['include']=[{'all':!![]}];}return db[_0x89c4('0x3e')][_0x89c4('0x28')](_0xe57579);})[_0x89c4('0x1c')](function(_0x451100){if(_0x5d33ed[_0x89c4('0x2e')][_0x89c4('0x4d')]===_0x89c4('0x4e')){for(var _0x212a3f=0x0;_0x212a3f<_0x451100[_0x89c4('0x34')];_0x212a3f++){_0x451100[_0x212a3f][_0x89c4('0x3a')]=juice(_0x451100[_0x212a3f][_0x89c4('0x3a')]);}}_0x5d4e37[_0x89c4('0x4f')]=_0x451100;return _0x5d4e37;});}})[_0x89c4('0x1c')](respondWithFilteredResult(_0x32de76,_0xe57579))[_0x89c4('0x3b')](handleError(_0x32de76,null));};exports[_0x89c4('0x50')]=function(_0x5ae4e8,_0x2dc0b2){return db['MailInteraction'][_0x89c4('0x38')]({'where':{'id':_0x5ae4e8[_0x89c4('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2dc0b2,null))[_0x89c4('0x1c')](function(_0x3f617d){if(_0x3f617d){return _0x3f617d[_0x89c4('0x51')](_0x5ae4e8[_0x89c4('0x3a')][_0x89c4('0x3f')],_[_0x89c4('0x52')](_0x5ae4e8['body'],['ids','id'])||{})[_0x89c4('0x53')](function(){return db['Tag'][_0x89c4('0x28')]({'attributes':['id',_0x89c4('0x1f'),_0x89c4('0x54')],'where':{'id':_0x5ae4e8['body']['ids']}});})[_0x89c4('0x1c')](function(_0x7489b6){socket[_0x89c4('0x55')](_0x89c4('0x56'),{'id':Number(_0x5ae4e8[_0x89c4('0x2c')]['id']),'tags':_0x7489b6||[]});return{'id':Number(_0x5ae4e8['params']['id']),'tags':_0x7489b6||[]};});}})['then'](respondWithResult(_0x2dc0b2,null))['catch'](handleError(_0x2dc0b2,null));};exports[_0x89c4('0x57')]=function(_0x3c278e,_0x91bf62){return db[_0x89c4('0x23')][_0x89c4('0x38')]({'where':{'id':_0x3c278e[_0x89c4('0x2c')]['id']}})[_0x89c4('0x1c')](handleEntityNotFound(_0x91bf62,null))[_0x89c4('0x1c')](function(_0x240780){if(_0x240780){return _0x240780[_0x89c4('0x57')](_0x3c278e[_0x89c4('0x2e')][_0x89c4('0x3f')]);}})[_0x89c4('0x1c')](respondWithStatusCode(_0x91bf62,null))[_0x89c4('0x3b')](handleError(_0x91bf62,null));};exports[_0x89c4('0x58')]=function(_0x548744,_0x2304a0){var _0x56835c=moment()[_0x89c4('0x59')]()[_0x89c4('0x5a')]();var _0x2a096b=path[_0x89c4('0x5b')](config[_0x89c4('0x5c')],'server',_0x89c4('0x5d'),_0x89c4('0x5e'));var _0x1adbb1=path['join'](config[_0x89c4('0x5c')],_0x89c4('0x5f'),_0x89c4('0x5d'),_0x89c4('0x60'));var _0x65f27f=path[_0x89c4('0x5b')](_0x2a096b,_0x56835c);var _0x2b11b4=util['format']('transcript-%d-%s.zip',_0x548744[_0x89c4('0x2c')]['id'],_0x56835c);var _0x7a5229=path[_0x89c4('0x5b')](_0x2a096b,_0x2b11b4);var _0x2b5cbe=[];if(_0x548744[_0x89c4('0x2e')]['attachments']){_0x2b5cbe[_0x89c4('0x61')]({'model':db['Attachment'],'as':_0x89c4('0x62'),'raw':!![]});}var _0x7a7008=[{'model':db['MailMessage'],'as':_0x89c4('0x63'),'attributes':['id',_0x89c4('0x3a'),_0x89c4('0x64'),'to','cc',_0x89c4('0x65'),_0x89c4('0x66'),_0x89c4('0x67')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x2b5cbe}];return db[_0x89c4('0x23')][_0x89c4('0x38')]({'where':{'id':_0x548744['params']['id']},'include':_0x7a7008})[_0x89c4('0x1c')](handleEntityNotFound(_0x2304a0,null))[_0x89c4('0x1c')](function(_0x432759){if(_0x432759&&_0x432759[_0x89c4('0x63')]){var _0x1df230=_0x432759['get']({'plain':!![]});fs[_0x89c4('0x68')](_0x65f27f);return BPromise[_0x89c4('0x69')](_0x1df230[_0x89c4('0x63')],function(_0x7375f6,_0x21a94e){var _0x43a37c={'from':_0x7375f6[_0x89c4('0x64')],'to':_0x7375f6['to']||_0x89c4('0x6a'),'subject':_0x7375f6['subject'],'html':htmlEntities[_0x89c4('0x6b')](_0x7375f6[_0x89c4('0x3a')]),'headers':{'Date':moment(_0x7375f6[_0x89c4('0x67')])[_0x89c4('0x6c')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x7375f6['cc']){_0x43a37c[_0x89c4('0x6d')]['Cc']=_0x7375f6['cc'];}if(_0x7375f6[_0x89c4('0x65')]){_0x43a37c[_0x89c4('0x6d')][_0x89c4('0x6e')]=_0x7375f6[_0x89c4('0x65')];}return new BPromise(function(_0x14c2fb,_0x2a8975){if(_0x7375f6[_0x89c4('0x62')]){for(var _0xcdd85=0x0;_0xcdd85<_0x7375f6['Attachments'][_0x89c4('0x34')];_0xcdd85++){var _0x1eed17=_0x7375f6['Attachments'][_0xcdd85];var _0x40f3b1=path[_0x89c4('0x5b')](_0x1adbb1,_0x1eed17[_0x89c4('0x6f')]);if(fs[_0x89c4('0x70')](_0x40f3b1)){_0x43a37c[_0x89c4('0x60')]['push']({'name':_0x1eed17['name'],'contentType':_0x1eed17['type'],'data':fs[_0x89c4('0x71')](_0x40f3b1)});}}}emlformat[_0x89c4('0x72')](_0x43a37c,function(_0x5205dd,_0x414996){if(_0x5205dd)return _0x2a8975(_0x5205dd);fs['writeFileSync'](path[_0x89c4('0x5b')](_0x65f27f,util[_0x89c4('0x6c')](_0x89c4('0x73'),_0x21a94e)),_0x414996);return _0x14c2fb(_0x414996);});});})['then'](function(){return new BPromise(function(_0x29947d,_0x5ff07f){zipdir(_0x65f27f,{'saveTo':_0x7a5229},function(_0x890191,_0x4369f8){if(_0x890191)return _0x5ff07f(_0x890191);return _0x29947d(_0x4369f8);});})[_0x89c4('0x1c')](function(){return new BPromise(function(_0x4bb18e,_0xe90c0c){rimraf(_0x65f27f,function(_0x2f3dc7){if(_0x2f3dc7)_0xe90c0c(_0x2f3dc7);return _0x4bb18e();});});})[_0x89c4('0x1c')](function(){return _0x2304a0[_0x89c4('0x58')](_0x7a5229,_0x2b11b4,function(_0x7e509d){if(!_0x7e509d)fs[_0x89c4('0x74')](_0x7a5229);});});});}else{return _0x2304a0[_0x89c4('0x1e')](0xc8);}})[_0x89c4('0x3b')](handleError(_0x2304a0,null));}; \ No newline at end of file +var _0xc25e=['lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','html-entities','redis','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','limit','undefined','count','Content-Range','then','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','mail','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','create','update','body','find','addMessage','ids','omit','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','sort','where','filters','MailInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','rows','addTags','setTags','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','from','bcc','subject','createdAt','Messages','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','unlinkSync','sendStatus','eml-format','zip-dir','moment','bluebird','path'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0xc25e,0xd1));var _0xec25=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xc25e[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0xec25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec25('0x1'));var moment=require(_0xec25('0x2'));var BPromise=require(_0xec25('0x3'));var util=require('util');var path=require(_0xec25('0x4'));var fs=require('fs');var _=require(_0xec25('0x5'));var juice=require('juice');var Redis=require(_0xec25('0x6'));var interaction=require(_0xec25('0x7'));var qs=require(_0xec25('0x8'));var logger=require(_0xec25('0x9'))(_0xec25('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xec25('0xb'));config[_0xec25('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xec25('0xd'))(new Redis(config['redis']));require(_0xec25('0xe'))[_0xec25('0xf')](socket);function respondWithStatusCode(_0x56bc0e,_0x5f46c9){_0x5f46c9=_0x5f46c9||0xcc;return function(_0x19e4e9){if(_0x19e4e9){return _0x56bc0e['sendStatus'](_0x5f46c9);}return _0x56bc0e[_0xec25('0x10')](_0x5f46c9)[_0xec25('0x11')]();};}function respondWithResult(_0x1e7dc9,_0x25a592){_0x25a592=_0x25a592||0xc8;return function(_0x4eb90b){if(_0x4eb90b){return _0x1e7dc9['status'](_0x25a592)[_0xec25('0x12')](_0x4eb90b);}};}function respondWithFilteredResult(_0x3a8e58,_0xcd97dd){return function(_0x5e50ca){if(_0x5e50ca){var _0x564f9e=typeof _0xcd97dd[_0xec25('0x13')]==='undefined'&&typeof _0xcd97dd[_0xec25('0x14')]===_0xec25('0x15');var _0x1013d9=_0x5e50ca[_0xec25('0x16')];var _0x42fcb6=_0x564f9e?0x0:_0xcd97dd[_0xec25('0x13')];var _0xf897f=_0x564f9e?_0x5e50ca[_0xec25('0x16')]:_0xcd97dd[_0xec25('0x13')]+_0xcd97dd[_0xec25('0x14')];var _0x54d16a;if(_0xf897f>=_0x1013d9){_0xf897f=_0x1013d9;_0x54d16a=0xc8;}else{_0x54d16a=0xce;}_0x3a8e58[_0xec25('0x10')](_0x54d16a);return _0x3a8e58['set'](_0xec25('0x17'),_0x42fcb6+'-'+_0xf897f+'/'+_0x1013d9)[_0xec25('0x12')](_0x5e50ca);}return null;};}function saveUpdates(_0x4e47b6){return function(_0x214cd2){if(_0x214cd2){return _0x214cd2['update'](_0x4e47b6)[_0xec25('0x18')](function(_0x482201){return _0x482201;});}return null;};}function removeEntity(_0x3ad3ea){return function(_0x4ed8a2){if(_0x4ed8a2){return _0x4ed8a2['destroy']()['then'](function(){_0x3ad3ea[_0xec25('0x10')](0xcc)[_0xec25('0x11')]();});}};}function handleEntityNotFound(_0x151cde){return function(_0x240743){if(!_0x240743){_0x151cde['sendStatus'](0x194);}return _0x240743;};}function handleError(_0x42bbba,_0x237bd0){_0x237bd0=_0x237bd0||0x1f4;return function(_0x4b3a30){logger['error'](_0x4b3a30[_0xec25('0x19')]);if(_0x4b3a30[_0xec25('0x1a')]){delete _0x4b3a30[_0xec25('0x1a')];}_0x42bbba['status'](_0x237bd0)[_0xec25('0x1b')](_0x4b3a30);};}exports[_0xec25('0x1c')]=function(_0x127956,_0x104d08){var _0x232ba1={};var _0x2603c1=_[_0xec25('0x1d')](db[_0xec25('0x1e')][_0xec25('0x1f')],function(_0x577cbf){return{'name':_0x577cbf[_0xec25('0x20')],'type':_0x577cbf[_0xec25('0x21')][_0xec25('0x22')]};});_0x232ba1=qs['getOptions'](_0x2603c1,_0x127956);return interaction['findAll'](_0xec25('0x23'),_0x127956[_0xec25('0x24')],_0x127956[_0xec25('0x25')],_0x232ba1,_0x2603c1)['then'](respondWithFilteredResult(_0x104d08,_0x232ba1))[_0xec25('0x26')](handleError(_0x104d08,null));};exports[_0xec25('0x27')]=function(_0x402fc0,_0x138302){var _0x12f1b2={'raw':![],'where':{'id':_0x402fc0[_0xec25('0x28')]['id']}},_0x5a07d3={};_0x5a07d3[_0xec25('0x29')]=_['keys'](db[_0xec25('0x1e')][_0xec25('0x1f')]);_0x5a07d3[_0xec25('0x24')]=_[_0xec25('0x2a')](_0x402fc0['query']);_0x5a07d3['filters']=_[_0xec25('0x2b')](_0x5a07d3[_0xec25('0x29')],_0x5a07d3['query']);_0x12f1b2[_0xec25('0x2c')]=_[_0xec25('0x2b')](_0x5a07d3[_0xec25('0x29')],qs[_0xec25('0x2d')](_0x402fc0[_0xec25('0x24')][_0xec25('0x2d')]));_0x12f1b2['attributes']=_0x12f1b2['attributes'][_0xec25('0x2e')]?_0x12f1b2['attributes']:_0x5a07d3['model'];if(_0x402fc0[_0xec25('0x24')][_0xec25('0x2f')]){_0x12f1b2[_0xec25('0x30')]=[{'all':!![]}];}_0x12f1b2=_[_0xec25('0x31')]({},_0x12f1b2,_0x402fc0[_0xec25('0x32')]);return db[_0xec25('0x1e')]['find'](_0x12f1b2)[_0xec25('0x18')](handleEntityNotFound(_0x138302,null))[_0xec25('0x18')](respondWithResult(_0x138302,null))[_0xec25('0x26')](handleError(_0x138302,null));};exports[_0xec25('0x33')]=function(_0x549ab2,_0xc7e6e4){return db[_0xec25('0x1e')]['create'](_0x549ab2['body'],{})[_0xec25('0x18')](respondWithResult(_0xc7e6e4,0xc9))['catch'](handleError(_0xc7e6e4,null));};exports[_0xec25('0x34')]=function(_0x190f92,_0x4798c2){if(_0x190f92[_0xec25('0x35')]['id']){delete _0x190f92['body']['id'];}return db[_0xec25('0x1e')][_0xec25('0x36')]({'where':{'id':_0x190f92[_0xec25('0x28')]['id']}})[_0xec25('0x18')](handleEntityNotFound(_0x4798c2,null))['then'](saveUpdates(_0x190f92['body'],null))['then'](respondWithResult(_0x4798c2,null))[_0xec25('0x26')](handleError(_0x4798c2,null));};exports['destroy']=function(_0x5deaa6,_0x2a5947){return db[_0xec25('0x1e')][_0xec25('0x36')]({'where':{'id':_0x5deaa6[_0xec25('0x28')]['id']}})['then'](handleEntityNotFound(_0x2a5947,null))[_0xec25('0x18')](removeEntity(_0x2a5947,null))[_0xec25('0x26')](handleError(_0x2a5947,null));};exports['describe']=function(_0xbee593,_0x2a38e7){return db[_0xec25('0x1e')]['describe']()[_0xec25('0x18')](respondWithResult(_0x2a38e7,null))[_0xec25('0x26')](handleError(_0x2a38e7,null));};exports[_0xec25('0x37')]=function(_0x36660e,_0x3853a9){return db['MailMessage'][_0xec25('0x36')]({'where':{'id':_0x36660e[_0xec25('0x28')]['id']}})[_0xec25('0x18')](handleEntityNotFound(_0x3853a9,null))[_0xec25('0x18')](function(_0x2bb186){if(_0x2bb186){return _0x2bb186[_0xec25('0x37')](_0x36660e['body'][_0xec25('0x38')],_[_0xec25('0x39')](_0x36660e[_0xec25('0x35')],[_0xec25('0x38'),'id'])||{});}})[_0xec25('0x18')](respondWithResult(_0x3853a9,null))[_0xec25('0x26')](handleError(_0x3853a9,null));};exports[_0xec25('0x3a')]=function(_0x2fe968,_0x35f30f){var _0x489986={'raw':![],'where':{}};var _0x5f414c={};var _0x3fcaa2={'count':0x0,'rows':[]};return db[_0xec25('0x1e')][_0xec25('0x3b')]({'where':{'id':_0x2fe968[_0xec25('0x28')]['id']}})[_0xec25('0x18')](handleEntityNotFound(_0x35f30f,null))['then'](function(_0x2a839e){if(_0x2a839e){_0x5f414c[_0xec25('0x29')]=_[_0xec25('0x2a')](db[_0xec25('0x3c')][_0xec25('0x1f')]);_0x5f414c['query']=_[_0xec25('0x2a')](_0x2fe968[_0xec25('0x24')]);_0x5f414c['filters']=_[_0xec25('0x2b')](_0x5f414c[_0xec25('0x29')],_0x5f414c[_0xec25('0x24')]);_0x489986[_0xec25('0x2c')]=_['intersection'](_0x5f414c[_0xec25('0x29')],qs[_0xec25('0x2d')](_0x2fe968[_0xec25('0x24')][_0xec25('0x2d')]));_0x489986[_0xec25('0x2c')]=_0x489986[_0xec25('0x2c')][_0xec25('0x2e')]?_0x489986[_0xec25('0x2c')]:_0x5f414c[_0xec25('0x29')];if(!_0x2fe968['query'][_0xec25('0x3d')](_0xec25('0x3e'))){_0x489986[_0xec25('0x14')]=qs['limit'](_0x2fe968[_0xec25('0x24')][_0xec25('0x14')]);_0x489986[_0xec25('0x13')]=qs['offset'](_0x2fe968[_0xec25('0x24')][_0xec25('0x13')]);}_0x489986['order']=qs['sort'](_0x2fe968[_0xec25('0x24')][_0xec25('0x3f')]);_0x489986[_0xec25('0x40')]=qs['filters'](_['pick'](_0x2fe968['query'],_0x5f414c[_0xec25('0x41')]));_0x489986[_0xec25('0x40')][_0xec25('0x42')]=_0x2a839e['id'];if(_0x2fe968[_0xec25('0x24')][_0xec25('0x43')]){_0x489986[_0xec25('0x40')]=_[_0xec25('0x31')](_0x489986[_0xec25('0x40')],{'$or':_[_0xec25('0x1d')](_0x489986['attributes'],function(_0x5f3175){var _0x5c169b={};_0x5c169b[_0x5f3175]={'$like':'%'+_0x2fe968['query'][_0xec25('0x43')]+'%'};return _0x5c169b;})});}if(_0x2fe968[_0xec25('0x24')][_0xec25('0x44')]){var _0x51ef74=_0x2fe968['query']['$gte']['split'](',');var _0xcaf690={};_0xcaf690[_0x51ef74[0x0]]={'$gte':moment(_0x51ef74[0x1])['format'](_0xec25('0x45'))};_0x489986[_0xec25('0x40')]=_['merge'](_0x489986[_0xec25('0x40')],_0xcaf690);}_0x489986=_[_0xec25('0x31')]({},_0x489986,_0x2fe968[_0xec25('0x32')]);return db[_0xec25('0x3c')][_0xec25('0x16')]({'where':_0x489986[_0xec25('0x40')]})[_0xec25('0x18')](function(_0x275896){_0x3fcaa2[_0xec25('0x16')]=_0x275896;if(_0x2fe968[_0xec25('0x24')]['includeAll']){_0x489986[_0xec25('0x30')]=[{'all':!![]}];}return db[_0xec25('0x3c')][_0xec25('0x46')](_0x489986);})['then'](function(_0x4ffdac){if(_0x2fe968[_0xec25('0x24')][_0xec25('0x47')]===_0xec25('0x48')){for(var _0x338a5c=0x0;_0x338a5c<_0x4ffdac[_0xec25('0x2e')];_0x338a5c++){_0x4ffdac[_0x338a5c]['body']=juice(_0x4ffdac[_0x338a5c][_0xec25('0x35')]);}}_0x3fcaa2[_0xec25('0x49')]=_0x4ffdac;return _0x3fcaa2;});}})[_0xec25('0x18')](respondWithFilteredResult(_0x35f30f,_0x489986))[_0xec25('0x26')](handleError(_0x35f30f,null));};exports[_0xec25('0x4a')]=function(_0x44014a,_0x17700f){return db[_0xec25('0x1e')][_0xec25('0x36')]({'where':{'id':_0x44014a[_0xec25('0x28')]['id']}})[_0xec25('0x18')](handleEntityNotFound(_0x17700f,null))['then'](function(_0x141a07){if(_0x141a07){return _0x141a07[_0xec25('0x4b')](_0x44014a[_0xec25('0x35')][_0xec25('0x38')],_['omit'](_0x44014a['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xec25('0x46')]({'attributes':['id','name','color'],'where':{'id':_0x44014a[_0xec25('0x35')]['ids']}});})[_0xec25('0x18')](function(_0x43a7d1){socket[_0xec25('0x4c')](_0xec25('0x4d'),{'id':Number(_0x44014a['params']['id']),'tags':_0x43a7d1||[]});return{'id':Number(_0x44014a['params']['id']),'tags':_0x43a7d1||[]};});}})['then'](respondWithResult(_0x17700f,null))['catch'](handleError(_0x17700f,null));};exports[_0xec25('0x4e')]=function(_0x27f6ed,_0x30338){return db['MailInteraction']['find']({'where':{'id':_0x27f6ed[_0xec25('0x28')]['id']}})[_0xec25('0x18')](handleEntityNotFound(_0x30338,null))[_0xec25('0x18')](function(_0x35d0e6){if(_0x35d0e6){return _0x35d0e6['removeTags'](_0x27f6ed['query'][_0xec25('0x38')]);}})[_0xec25('0x18')](respondWithStatusCode(_0x30338,null))[_0xec25('0x26')](handleError(_0x30338,null));};exports[_0xec25('0x4f')]=function(_0x363819,_0x55cd32){var _0x558faf=moment()[_0xec25('0x50')]()[_0xec25('0x51')]();var _0x2ff83a=path[_0xec25('0x52')](config[_0xec25('0x53')],_0xec25('0x54'),_0xec25('0x55'),_0xec25('0x56'));var _0x31e36f=path[_0xec25('0x52')](config['root'],_0xec25('0x54'),_0xec25('0x55'),_0xec25('0x57'));var _0x436f85=path[_0xec25('0x52')](_0x2ff83a,_0x558faf);var _0x4ade76=util['format'](_0xec25('0x58'),_0x363819['params']['id'],_0x558faf);var _0x3a157c=path[_0xec25('0x52')](_0x2ff83a,_0x4ade76);var _0x14490f=[];if(_0x363819[_0xec25('0x24')][_0xec25('0x57')]){_0x14490f[_0xec25('0x59')]({'model':db[_0xec25('0x5a')],'as':_0xec25('0x5b'),'raw':!![]});}var _0x277510=[{'model':db[_0xec25('0x3c')],'as':'Messages','attributes':['id',_0xec25('0x35'),_0xec25('0x5c'),'to','cc',_0xec25('0x5d'),_0xec25('0x5e'),_0xec25('0x5f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x14490f}];return db['MailInteraction'][_0xec25('0x36')]({'where':{'id':_0x363819['params']['id']},'include':_0x277510})[_0xec25('0x18')](handleEntityNotFound(_0x55cd32,null))[_0xec25('0x18')](function(_0xeb1553){if(_0xeb1553&&_0xeb1553[_0xec25('0x60')]){var _0x8dcfd3=_0xeb1553['get']({'plain':!![]});fs['mkdirSync'](_0x436f85);return BPromise[_0xec25('0x61')](_0x8dcfd3[_0xec25('0x60')],function(_0x5ada26,_0x389e5c){var _0x381b87={'from':_0x5ada26['from'],'to':_0x5ada26['to']||'missing.recipient@your.company.com','subject':_0x5ada26[_0xec25('0x5e')],'html':htmlEntities['decode'](_0x5ada26[_0xec25('0x35')]),'headers':{'Date':moment(_0x5ada26['createdAt'])['format'](_0xec25('0x62'))},'attachments':[]};if(_0x5ada26['cc']){_0x381b87[_0xec25('0x63')]['Cc']=_0x5ada26['cc'];}if(_0x5ada26[_0xec25('0x5d')]){_0x381b87[_0xec25('0x63')][_0xec25('0x64')]=_0x5ada26[_0xec25('0x5d')];}return new BPromise(function(_0x3a5984,_0x9bc0da){if(_0x5ada26[_0xec25('0x5b')]){for(var _0x176cd9=0x0;_0x176cd9<_0x5ada26[_0xec25('0x5b')][_0xec25('0x2e')];_0x176cd9++){var _0x45d7b5=_0x5ada26[_0xec25('0x5b')][_0x176cd9];var _0x698449=path[_0xec25('0x52')](_0x31e36f,_0x45d7b5[_0xec25('0x65')]);if(fs[_0xec25('0x66')](_0x698449)){_0x381b87[_0xec25('0x57')][_0xec25('0x59')]({'name':_0x45d7b5[_0xec25('0x1a')],'contentType':_0x45d7b5[_0xec25('0x21')],'data':fs[_0xec25('0x67')](_0x698449)});}}}emlformat[_0xec25('0x68')](_0x381b87,function(_0x40f4e1,_0x5b9c7d){if(_0x40f4e1)return _0x9bc0da(_0x40f4e1);fs['writeFileSync'](path[_0xec25('0x52')](_0x436f85,util['format']('message%d.eml',_0x389e5c)),_0x5b9c7d);return _0x3a5984(_0x5b9c7d);});});})[_0xec25('0x18')](function(){return new BPromise(function(_0x136bf9,_0x232b21){zipdir(_0x436f85,{'saveTo':_0x3a157c},function(_0x3d77b8,_0x369bb4){if(_0x3d77b8)return _0x232b21(_0x3d77b8);return _0x136bf9(_0x369bb4);});})['then'](function(){return new BPromise(function(_0x5553d3,_0x2ea77a){rimraf(_0x436f85,function(_0x55c1d7){if(_0x55c1d7)_0x2ea77a(_0x55c1d7);return _0x5553d3();});});})['then'](function(){return _0x55cd32['download'](_0x3a157c,_0x4ade76,function(_0x3ee996){if(!_0x3ee996)fs[_0xec25('0x69')](_0x3a157c);});});});}else{return _0x55cd32[_0xec25('0x6a')](0xc8);}})[_0xec25('0x26')](handleError(_0x55cd32,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 93ade31..3ad18d0 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 _0x0f8a=['emit','catch','hook','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','setDataValue'];(function(_0x53317c,_0x5dee5e){var _0x2900b9=function(_0x570b24){while(--_0x570b24){_0x53317c['push'](_0x53317c['shift']());}};_0x2900b9(++_0x5dee5e);}(_0x0f8a,0x93));var _0xa0f8=function(_0x3bdde6,_0x242431){_0x3bdde6=_0x3bdde6-0x0;var _0x367b70=_0x0f8a[_0x3bdde6];return _0x367b70;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xa0f8('0x0'))['db'][_0xa0f8('0x1')];var MailMessage=require(_0xa0f8('0x0'))['db'][_0xa0f8('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa0f8('0x3')](0x0);var events={'afterCreate':_0xa0f8('0x4'),'afterUpdate':_0xa0f8('0x5'),'afterDestroy':_0xa0f8('0x6')};function emitEvent(_0x3f8522){return function(_0x3c9619,_0x1d0cca,_0x290e51){_0x3c9619['getUsers']({'attributes':['id'],'raw':!![]})[_0xa0f8('0x7')](function(_0x1b2442){_0x3c9619[_0xa0f8('0x8')]('Users',_0x1b2442['map'](function(_0x5300c7){return{'id':_0x5300c7['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3c9619['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa0f8('0x7')](function(_0x2a3697){_0x3c9619[_0xa0f8('0x8')]('unreadMessages',_0x2a3697['length']);MailInteractionEvents['emit'](_0x3f8522+':'+_0x3c9619['id'],_0x3c9619);MailInteractionEvents[_0xa0f8('0x9')](_0x3f8522,_0x3c9619);_0x290e51(null);})[_0xa0f8('0xa')](_0x290e51(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xa0f8('0xb')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x3133=['Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x4b7d0b,_0x4bcb56){var _0x2b79f5=function(_0x42ff67){while(--_0x42ff67){_0x4b7d0b['push'](_0x4b7d0b['shift']());}};_0x2b79f5(++_0x4bcb56);}(_0x3133,0x149));var _0x3313=function(_0x2bb105,_0x383c60){_0x2bb105=_0x2bb105-0x0;var _0x11ed3c=_0x3133[_0x2bb105];return _0x11ed3c;};'use strict';var EventEmitter=require(_0x3313('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x3313('0x1')];var MailMessage=require(_0x3313('0x2'))['db'][_0x3313('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3313('0x4')](0x0);var events={'afterCreate':_0x3313('0x5'),'afterUpdate':_0x3313('0x6'),'afterDestroy':_0x3313('0x7')};function emitEvent(_0x1f13f0){return function(_0x106d5c,_0x47e988,_0x4f30ff){_0x106d5c[_0x3313('0x8')]({'attributes':['id'],'raw':!![]})[_0x3313('0x9')](function(_0x53e304){_0x106d5c[_0x3313('0xa')](_0x3313('0xb'),_0x53e304[_0x3313('0xc')](function(_0xe06a85){return{'id':_0xe06a85['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x106d5c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3313('0x9')](function(_0x4e0035){_0x106d5c[_0x3313('0xa')](_0x3313('0xd'),_0x4e0035[_0x3313('0xe')]);MailInteractionEvents['emit'](_0x1f13f0+':'+_0x106d5c['id'],_0x106d5c);MailInteractionEvents[_0x3313('0xf')](_0x1f13f0,_0x106d5c);_0x4f30ff(null);})[_0x3313('0x10')](_0x4f30ff(null));};}for(var e in events){if(events[_0x3313('0x11')](e)){var event=events[e];MailInteraction[_0x3313('0x12')](e,emitEvent(event));}}module[_0x3313('0x13')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index b38fb29..7f446b0 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 _0xfb84=['define','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','get','MailMessage','update','then','catch','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1ba9ca,_0x4ea029){var _0x1fa857=function(_0xb0e27){while(--_0xb0e27){_0x1ba9ca['push'](_0x1ba9ca['shift']());}};_0x1fa857(++_0x4ea029);}(_0xfb84,0x115));var _0x4fb8=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0xfb84[_0x2134b7];return _0x6c5914;};'use strict';var _=require(_0x4fb8('0x0'));var util=require(_0x4fb8('0x1'));var logger=require('../../config/logger')(_0x4fb8('0x2'));var moment=require('moment');var BPromise=require(_0x4fb8('0x3'));var rp=require(_0x4fb8('0x4'));var fs=require('fs');var path=require(_0x4fb8('0x5'));var rimraf=require(_0x4fb8('0x6'));var config=require(_0x4fb8('0x7'));var attributes=require('./mailInteraction.attributes');module[_0x4fb8('0x8')]=function(_0x502c74,_0x573e50){return _0x502c74[_0x4fb8('0x9')](_0x4fb8('0xa'),attributes,{'tableName':_0x4fb8('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x4fb8('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x829e9b,_0x417776,_0x43dc90){if(_0x829e9b[_0x4fb8('0xd')]){_0x829e9b[_0x4fb8('0xe')]=moment()['format'](_0x4fb8('0xf'));}if(_0x829e9b[_0x4fb8('0x10')]){_0x829e9b[_0x4fb8('0x11')]=moment()[_0x4fb8('0x12')](_0x4fb8('0xf'));}_0x43dc90(null,_0x417776);},'beforeUpdate':function(_0x3d529a,_0x389160,_0x29419c){if(_0x3d529a[_0x4fb8('0x13')](_0x4fb8('0xd'))){_0x3d529a[_0x4fb8('0xe')]=_0x3d529a['substatus']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3d529a['changed'](_0x4fb8('0x10'))){_0x3d529a[_0x4fb8('0x11')]=moment()[_0x4fb8('0x12')](_0x4fb8('0xf'));_0x3d529a[_0x4fb8('0xd')]=null;_0x3d529a[_0x4fb8('0xe')]=null;}_0x29419c(null,_0x3d529a);},'afterUpdate':function(_0xf27d96,_0x32e93b,_0x1af8ff){var _0x11e6a5=_0x502c74[_0x4fb8('0x14')];var _0x2ad235=_0xf27d96[_0x4fb8('0x15')]({'plain':!![]});if(_0x2ad235['closed']){return _0x11e6a5[_0x4fb8('0x16')][_0x4fb8('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x2ad235['id']}})[_0x4fb8('0x18')](function(){_0x1af8ff();})[_0x4fb8('0x19')](function(_0x1d0fc2){_0x1af8ff(_0x1d0fc2);});}else{_0x1af8ff();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x60ca=['substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','get','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','FULLTEXT'];(function(_0x44d6a1,_0x3498f3){var _0x3c6f24=function(_0x6ad393){while(--_0x6ad393){_0x44d6a1['push'](_0x44d6a1['shift']());}};_0x3c6f24(++_0x3498f3);}(_0x60ca,0x1dd));var _0xa60c=function(_0x1bf1d6,_0x17e007){_0x1bf1d6=_0x1bf1d6-0x0;var _0x49aa7=_0x60ca[_0x1bf1d6];return _0x49aa7;};'use strict';var _=require(_0xa60c('0x0'));var util=require(_0xa60c('0x1'));var logger=require(_0xa60c('0x2'))(_0xa60c('0x3'));var moment=require(_0xa60c('0x4'));var BPromise=require(_0xa60c('0x5'));var rp=require(_0xa60c('0x6'));var fs=require('fs');var path=require(_0xa60c('0x7'));var rimraf=require(_0xa60c('0x8'));var config=require(_0xa60c('0x9'));var attributes=require(_0xa60c('0xa'));module[_0xa60c('0xb')]=function(_0x53be8b,_0x5dad5a){return _0x53be8b[_0xa60c('0xc')]('MailInteraction',attributes,{'tableName':_0xa60c('0xd'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xa60c('0xe'),'to'],'type':_0xa60c('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa281a8,_0x49bc21,_0x2c1f31){if(_0xa281a8['substatus']){_0xa281a8[_0xa60c('0x10')]=moment()[_0xa60c('0x11')](_0xa60c('0x12'));}if(_0xa281a8[_0xa60c('0x13')]){_0xa281a8[_0xa60c('0x14')]=moment()[_0xa60c('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2c1f31(null,_0x49bc21);},'beforeUpdate':function(_0x123e92,_0x1af32d,_0x7bfcc){if(_0x123e92[_0xa60c('0x15')](_0xa60c('0x16'))){_0x123e92[_0xa60c('0x10')]=_0x123e92[_0xa60c('0x16')]?moment()['format'](_0xa60c('0x12')):null;}if(_0x123e92[_0xa60c('0x15')](_0xa60c('0x13'))){_0x123e92[_0xa60c('0x14')]=moment()[_0xa60c('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x123e92[_0xa60c('0x16')]=null;_0x123e92['substatusAt']=null;}_0x7bfcc(null,_0x123e92);},'afterUpdate':function(_0x1f1c00,_0x148748,_0x328564){var _0x267a76=_0x53be8b[_0xa60c('0x17')];var _0x55a305=_0x1f1c00[_0xa60c('0x18')]({'plain':!![]});if(_0x55a305['closed']){return _0x267a76[_0xa60c('0x19')][_0xa60c('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x55a305['id']}})['then'](function(){_0x328564();})['catch'](function(_0xafff9f){_0x328564(_0xafff9f);});}else{_0x328564();}}},'charset':_0xa60c('0x1b'),'collate':_0xa60c('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 48c0bca..42fcafd 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 _0xb5dd=['omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateMailInteraction','MailInteraction','update','options','raw','where','limit','catch','AddTagsToMailInteraction','find','body','ids'];(function(_0x568fa5,_0x2ff6d6){var _0x9c8997=function(_0x411bca){while(--_0x411bca){_0x568fa5['push'](_0x568fa5['shift']());}};_0x9c8997(++_0x2ff6d6);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb5dd[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xdb5d('0x0'));var util=require(_0xdb5d('0x1'));var moment=require(_0xdb5d('0x2'));var BPromise=require(_0xdb5d('0x3'));var rs=require(_0xdb5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb5d('0x5'))['db'];var utils=require(_0xdb5d('0x6'));var logger=require(_0xdb5d('0x7'))('rpc');var config=require(_0xdb5d('0x8'));var jayson=require(_0xdb5d('0x9'));var client=jayson[_0xdb5d('0xa')][_0xdb5d('0xb')]({'port':0x232a});config[_0xdb5d('0xc')]=_[_0xdb5d('0xd')](config[_0xdb5d('0xc')],{'host':_0xdb5d('0xe'),'port':0x18eb});var socket=require(_0xdb5d('0xf'))(new Redis(config[_0xdb5d('0xc')]));require('./mailInteraction.socket')[_0xdb5d('0x10')](socket);function respondWithRpcPromise(_0x288b8f,_0x2a0f4a,_0x4fb3ab){return new BPromise(function(_0x541c31,_0xeb1c09){return client[_0xdb5d('0x11')](_0x288b8f,_0x4fb3ab)[_0xdb5d('0x12')](function(_0x56eb05){logger['info'](_0xdb5d('0x13'),_0x2a0f4a,_0xdb5d('0x14'));logger[_0xdb5d('0x15')](_0xdb5d('0x16'),_0x2a0f4a,_0xdb5d('0x14'),JSON[_0xdb5d('0x17')](_0x56eb05));if(_0x56eb05[_0xdb5d('0x18')]){if(_0x56eb05['error'][_0xdb5d('0x19')]===0x1f4){logger[_0xdb5d('0x18')](_0xdb5d('0x13'),_0x2a0f4a,_0x56eb05['error'][_0xdb5d('0x1a')]);return _0xeb1c09(_0x56eb05[_0xdb5d('0x18')][_0xdb5d('0x1a')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2a0f4a,_0x56eb05[_0xdb5d('0x18')]['message']);return _0x541c31(_0x56eb05[_0xdb5d('0x18')][_0xdb5d('0x1a')]);}else{logger[_0xdb5d('0x1b')](_0xdb5d('0x13'),_0x2a0f4a,_0xdb5d('0x14'));_0x541c31(_0x56eb05[_0xdb5d('0x1c')][_0xdb5d('0x1a')]);}})['catch'](function(_0x21e981){logger['error'](_0xdb5d('0x13'),_0x2a0f4a,_0x21e981);_0xeb1c09(_0x21e981);});});}exports[_0xdb5d('0x1d')]=function(_0x3d286c){var _0x7bfc06=this;return new Promise(function(_0x2980fe,_0x5e7dd2){return db[_0xdb5d('0x1e')][_0xdb5d('0x1f')](_0x3d286c['body'],{'raw':_0x3d286c['options']?_0x3d286c[_0xdb5d('0x20')][_0xdb5d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d286c['options']?_0x3d286c[_0xdb5d('0x20')][_0xdb5d('0x22')]||null:null,'attributes':_0x3d286c['options']?_0x3d286c[_0xdb5d('0x20')]['attributes']||null:null,'limit':_0x3d286c[_0xdb5d('0x20')]?_0x3d286c['options'][_0xdb5d('0x23')]||null:null})['then'](function(_0x485f61){logger[_0xdb5d('0x1b')]('UpdateMailInteraction',_0x3d286c);logger['debug'](_0xdb5d('0x1d'),_0x3d286c,JSON[_0xdb5d('0x17')](_0x485f61));_0x2980fe(_0x485f61);})[_0xdb5d('0x24')](function(_0x1d3444){logger[_0xdb5d('0x18')]('UpdateMailInteraction',_0x1d3444[_0xdb5d('0x1a')],_0x3d286c);_0x5e7dd2(_0x7bfc06[_0xdb5d('0x18')](0x1f4,_0x1d3444[_0xdb5d('0x1a')]));});});};exports[_0xdb5d('0x25')]=function(_0x1984fe){return new Promise(function(_0x3b025d,_0x135359){return db['MailInteraction'][_0xdb5d('0x26')]({'where':_0x1984fe[_0xdb5d('0x20')]?_0x1984fe[_0xdb5d('0x20')]['where']||null:null})['then'](function(_0xfbcbe4){if(_0xfbcbe4){return _0xfbcbe4['addTags'](_0x1984fe[_0xdb5d('0x27')][_0xdb5d('0x28')],_[_0xdb5d('0x29')](_0x1984fe[_0xdb5d('0x27')],[_0xdb5d('0x28'),'id'])||{});}})['spread'](function(_0x4a0aff){logger[_0xdb5d('0x1b')](_0xdb5d('0x2a'),_0x1984fe);logger[_0xdb5d('0x15')](_0xdb5d('0x2a'),_0x1984fe,JSON[_0xdb5d('0x17')](_0x4a0aff));_0x3b025d(_0x4a0aff);})['catch'](function(_0xc08d43){logger[_0xdb5d('0x18')](_0xdb5d('0x2a'),_0xc08d43[_0xdb5d('0x1a')],_0x1984fe);_0x135359(_this[_0xdb5d('0x18')](0x1f4,_0xc08d43[_0xdb5d('0x1a')]));});});}; \ No newline at end of file +var _0xba79=['./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','stringify','catch','where','ids','spread','debug','AddTags','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x5e4e93,_0x19ba8f){var _0x4d936e=function(_0x460179){while(--_0x460179){_0x5e4e93['push'](_0x5e4e93['shift']());}};_0x4d936e(++_0x19ba8f);}(_0xba79,0x153));var _0x9ba7=function(_0x47872a,_0x2919a9){_0x47872a=_0x47872a-0x0;var _0x1cc71b=_0xba79[_0x47872a];return _0x1cc71b;};'use strict';var _=require(_0x9ba7('0x0'));var util=require(_0x9ba7('0x1'));var moment=require(_0x9ba7('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ba7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9ba7('0x4'));var logger=require(_0x9ba7('0x5'))(_0x9ba7('0x6'));var config=require(_0x9ba7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9ba7('0x8')]=_[_0x9ba7('0x9')](config['redis'],{'host':_0x9ba7('0xa'),'port':0x18eb});var socket=require(_0x9ba7('0xb'))(new Redis(config[_0x9ba7('0x8')]));require(_0x9ba7('0xc'))[_0x9ba7('0xd')](socket);function respondWithRpcPromise(_0x54282b,_0x5e017a,_0x514051){return new BPromise(function(_0x59df53,_0x16572b){return client[_0x9ba7('0xe')](_0x54282b,_0x514051)[_0x9ba7('0xf')](function(_0x13eb15){logger[_0x9ba7('0x10')](_0x9ba7('0x11'),_0x5e017a,_0x9ba7('0x12'));logger['debug'](_0x9ba7('0x13'),_0x5e017a,'request\x20sent',JSON['stringify'](_0x13eb15));if(_0x13eb15[_0x9ba7('0x14')]){if(_0x13eb15['error'][_0x9ba7('0x15')]===0x1f4){logger[_0x9ba7('0x14')](_0x9ba7('0x11'),_0x5e017a,_0x13eb15[_0x9ba7('0x14')]['message']);return _0x16572b(_0x13eb15[_0x9ba7('0x14')][_0x9ba7('0x16')]);}logger[_0x9ba7('0x14')]('MailInteraction,\x20%s,\x20%s',_0x5e017a,_0x13eb15[_0x9ba7('0x14')][_0x9ba7('0x16')]);return _0x59df53(_0x13eb15[_0x9ba7('0x14')][_0x9ba7('0x16')]);}else{logger['info'](_0x9ba7('0x11'),_0x5e017a,_0x9ba7('0x12'));_0x59df53(_0x13eb15[_0x9ba7('0x17')][_0x9ba7('0x16')]);}})['catch'](function(_0x20ca2b){logger['error']('MailInteraction,\x20%s,\x20%s',_0x5e017a,_0x20ca2b);_0x16572b(_0x20ca2b);});});}exports[_0x9ba7('0x18')]=function(_0x2f8651){var _0x1f5400=this;return new Promise(function(_0xab25ed,_0x12a97d){return db[_0x9ba7('0x19')][_0x9ba7('0x1a')](_0x2f8651[_0x9ba7('0x1b')],{'raw':_0x2f8651[_0x9ba7('0x1c')]?_0x2f8651[_0x9ba7('0x1c')][_0x9ba7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f8651[_0x9ba7('0x1c')]?_0x2f8651['options']['where']||null:null,'attributes':_0x2f8651['options']?_0x2f8651['options'][_0x9ba7('0x1e')]||null:null,'limit':_0x2f8651[_0x9ba7('0x1c')]?_0x2f8651[_0x9ba7('0x1c')][_0x9ba7('0x1f')]||null:null})[_0x9ba7('0xf')](function(_0x416f7b){logger[_0x9ba7('0x10')](_0x9ba7('0x18'),_0x2f8651);logger['debug'](_0x9ba7('0x18'),_0x2f8651,JSON[_0x9ba7('0x20')](_0x416f7b));_0xab25ed(_0x416f7b);})[_0x9ba7('0x21')](function(_0x479a40){logger[_0x9ba7('0x14')]('UpdateMailInteraction',_0x479a40[_0x9ba7('0x16')],_0x2f8651);_0x12a97d(_0x1f5400['error'](0x1f4,_0x479a40['message']));});});};exports['AddTagsToMailInteraction']=function(_0x23bac4){return new Promise(function(_0x2c0c12,_0x2524b2){return db[_0x9ba7('0x19')]['find']({'where':_0x23bac4[_0x9ba7('0x1c')]?_0x23bac4[_0x9ba7('0x1c')][_0x9ba7('0x22')]||null:null})[_0x9ba7('0xf')](function(_0x2695a4){if(_0x2695a4){return _0x2695a4['addTags'](_0x23bac4['body'][_0x9ba7('0x23')],_['omit'](_0x23bac4['body'],['ids','id'])||{});}})[_0x9ba7('0x24')](function(_0x4307c5){logger[_0x9ba7('0x10')]('AddTags',_0x23bac4);logger[_0x9ba7('0x25')]('AddTags',_0x23bac4,JSON[_0x9ba7('0x20')](_0x4307c5));_0x2c0c12(_0x4307c5);})['catch'](function(_0x5bd178){logger['error'](_0x9ba7('0x26'),_0x5bd178[_0x9ba7('0x16')],_0x23bac4);_0x2524b2(_this[_0x9ba7('0x14')](0x1f4,_0x5bd178[_0x9ba7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index bc6a3a9..1b4cae8 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 _0xcaef=['register','length','mailInteraction:','./mailInteraction.events','remove','update'];(function(_0x2cb4dd,_0x4ef3e4){var _0x3d7b1d=function(_0x22d42e){while(--_0x22d42e){_0x2cb4dd['push'](_0x2cb4dd['shift']());}};_0x3d7b1d(++_0x4ef3e4);}(_0xcaef,0x99));var _0xfcae=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xcaef[_0xaa1b3e];return _0x454d7d;};'use strict';var MailInteractionEvents=require(_0xfcae('0x0'));var events=['save',_0xfcae('0x1'),_0xfcae('0x2')];function createListener(_0x87b372,_0x458a16){return function(_0x2341f1){_0x458a16['emit'](_0x87b372,_0x2341f1);};}function removeListener(_0x3d67d1,_0x352a72){return function(){MailInteractionEvents['removeListener'](_0x3d67d1,_0x352a72);};}exports[_0xfcae('0x3')]=function(_0x198f15){for(var _0x4cb4ff=0x0,_0x47acf8=events[_0xfcae('0x4')];_0x4cb4ff<_0x47acf8;_0x4cb4ff++){var _0x13094d=events[_0x4cb4ff];var _0x2686d6=createListener(_0xfcae('0x5')+_0x13094d,_0x198f15);MailInteractionEvents['on'](_0x13094d,_0x2686d6);}}; \ No newline at end of file +var _0x8ee2=['mailInteraction:','save','remove','update','emit','removeListener','register','length'];(function(_0x31b74c,_0x5adc2c){var _0x134dfb=function(_0x581528){while(--_0x581528){_0x31b74c['push'](_0x31b74c['shift']());}};_0x134dfb(++_0x5adc2c);}(_0x8ee2,0x1c9));var _0x28ee=function(_0x1a5471,_0x19500d){_0x1a5471=_0x1a5471-0x0;var _0x11a184=_0x8ee2[_0x1a5471];return _0x11a184;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x28ee('0x0'),_0x28ee('0x1'),_0x28ee('0x2')];function createListener(_0x457295,_0x166e39){return function(_0x5efbde){_0x166e39[_0x28ee('0x3')](_0x457295,_0x5efbde);};}function removeListener(_0xde1c89,_0x55d4c3){return function(){MailInteractionEvents[_0x28ee('0x4')](_0xde1c89,_0x55d4c3);};}exports[_0x28ee('0x5')]=function(_0xf52582){for(var _0x7bd4bd=0x0,_0x5376d4=events[_0x28ee('0x6')];_0x7bd4bd<_0x5376d4;_0x7bd4bd++){var _0x330945=events[_0x7bd4bd];var _0x311605=createListener(_0x28ee('0x7')+_0x330945,_0xf52582);MailInteractionEvents['on'](_0x330945,_0x311605);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 0b0c7f5..0fdea66 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 _0x0cee=['/:id','update','/:id/accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','tracked','mail','mailmessage:create','create','put'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0cee,0x12f));var _0xe0ce=function(_0x463e23,_0x47e5e1){_0x463e23=_0x463e23-0x0;var _0x55eb4a=_0x0cee[_0x463e23];return _0x55eb4a;};'use strict';var multer=require(_0xe0ce('0x0'));var util=require(_0xe0ce('0x1'));var path=require(_0xe0ce('0x2'));var timeout=require(_0xe0ce('0x3'));var express=require(_0xe0ce('0x4'));var router=express[_0xe0ce('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe0ce('0x6'));var config=require(_0xe0ce('0x7'));var controller=require(_0xe0ce('0x8'));router[_0xe0ce('0x9')]('/',auth[_0xe0ce('0xa')](),controller[_0xe0ce('0xb')]);router[_0xe0ce('0x9')](_0xe0ce('0xc'),auth['isAuthenticated'](),controller[_0xe0ce('0xd')]);router[_0xe0ce('0x9')]('/:id',auth[_0xe0ce('0xa')](),controller[_0xe0ce('0xe')]);router[_0xe0ce('0x9')](_0xe0ce('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xe0ce('0xa')](),interaction[_0xe0ce('0x10')](_0xe0ce('0x11'),_0xe0ce('0x12')),controller[_0xe0ce('0x13')]);router[_0xe0ce('0x14')](_0xe0ce('0x15'),auth[_0xe0ce('0xa')](),controller[_0xe0ce('0x16')]);router[_0xe0ce('0x14')](_0xe0ce('0x17'),auth[_0xe0ce('0xa')](),controller['accept']);router['put'](_0xe0ce('0x18'),auth[_0xe0ce('0xa')](),controller['reject']);router['delete'](_0xe0ce('0x15'),auth[_0xe0ce('0xa')](),controller[_0xe0ce('0x19')]);module[_0xe0ce('0x1a')]=router; \ No newline at end of file +var _0x634d=['/:id','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','show','/:id/download','post','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x35bf5a,_0x2457d4){var _0x48a925=function(_0x2209f0){while(--_0x2209f0){_0x35bf5a['push'](_0x35bf5a['shift']());}};_0x48a925(++_0x2457d4);}(_0x634d,0x120));var _0xd634=function(_0x3f60a2,_0x135b40){_0x3f60a2=_0x3f60a2-0x0;var _0xee4b9f=_0x634d[_0x3f60a2];return _0xee4b9f;};'use strict';var multer=require(_0xd634('0x0'));var util=require(_0xd634('0x1'));var path=require(_0xd634('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd634('0x3'));var auth=require(_0xd634('0x4'));var interaction=require(_0xd634('0x5'));var config=require('../../config/environment');var controller=require(_0xd634('0x6'));router[_0xd634('0x7')]('/',auth['isAuthenticated'](),controller[_0xd634('0x8')]);router[_0xd634('0x7')](_0xd634('0x9'),auth[_0xd634('0xa')](),controller[_0xd634('0xb')]);router[_0xd634('0x7')]('/:id',auth[_0xd634('0xa')](),controller[_0xd634('0xc')]);router['get'](_0xd634('0xd'),auth[_0xd634('0xa')](),controller['download']);router[_0xd634('0xe')]('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0xd634('0xf')),controller[_0xd634('0x10')]);router[_0xd634('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd634('0x12')]);router[_0xd634('0x11')](_0xd634('0x13'),auth['isAuthenticated'](),controller[_0xd634('0x14')]);router[_0xd634('0x11')](_0xd634('0x15'),auth[_0xd634('0xa')](),controller[_0xd634('0x16')]);router[_0xd634('0x17')](_0xd634('0x18'),auth[_0xd634('0xa')](),controller[_0xd634('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 5c7549c..65a469c 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 _0x2e1d=['long','DATE','Email','lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x29b886,_0x3ec7c2){var _0x263ef9=function(_0xf28d06){while(--_0xf28d06){_0x29b886['push'](_0x29b886['shift']());}};_0x263ef9(++_0x3ec7c2);}(_0x2e1d,0x1dc));var _0xd2e1=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0x2e1d[_0xc8a11];return _0x55a500;};'use strict';var Sequelize=require('sequelize');var _=require(_0xd2e1('0x0'));module[_0xd2e1('0x1')]={'body':{'type':Sequelize[_0xd2e1('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd2e1('0x2')](_0xd2e1('0x3'))},'read':{'type':Sequelize[_0xd2e1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd2e1('0x5')]('in',_0xd2e1('0x6')),'defaultValue':_0xd2e1('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd2e1('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd2e1('0x2')](_0xd2e1('0x8'))},'cc':{'type':Sequelize[_0xd2e1('0x2')](_0xd2e1('0x8'))},'bcc':{'type':Sequelize[_0xd2e1('0x2')](_0xd2e1('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xd2e1('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd2e1('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xd2e1('0x2')](_0xd2e1('0x8'))},'originCc':{'type':Sequelize[_0xd2e1('0x2')](_0xd2e1('0x8'))},'originChannel':{'type':Sequelize[_0xd2e1('0x5')](_0xd2e1('0xa'),'Chat'),'defaultValue':_0xd2e1('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x964f=['TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports'];(function(_0x395764,_0x1f57a5){var _0x234be6=function(_0x3a258b){while(--_0x3a258b){_0x395764['push'](_0x395764['shift']());}};_0x234be6(++_0x1f57a5);}(_0x964f,0x185));var _0xf964=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x964f[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0xf964('0x0'));var _=require(_0xf964('0x1'));module[_0xf964('0x2')]={'body':{'type':Sequelize[_0xf964('0x3')](_0xf964('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf964('0x3')](_0xf964('0x5'))},'read':{'type':Sequelize[_0xf964('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf964('0x7')]('in',_0xf964('0x8')),'defaultValue':_0xf964('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf964('0x9')](0x1fe)},'from':{'type':Sequelize[_0xf964('0x9')]},'to':{'type':Sequelize[_0xf964('0x3')](_0xf964('0x4'))},'cc':{'type':Sequelize[_0xf964('0x3')](_0xf964('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0xf964('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xf964('0xa')]},'attach':{'type':Sequelize[_0xf964('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0xf964('0x4'))},'originCc':{'type':Sequelize[_0xf964('0x3')](_0xf964('0x4'))},'originChannel':{'type':Sequelize[_0xf964('0x7')](_0xf964('0xc'),_0xf964('0xd')),'defaultValue':_0xf964('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 ad544f7..4103e0f 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 _0xec7a=['map','MailMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','keys','include','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','read','readAt','UserId','user','agent','get','MailInteraction','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','manual','channel','motionChannel','event','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','interface','SIP/%s','fromString','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','message','MailMessage,\x20%s,\x20%s','info','catch','json','offset','undefined','limit','count','set','Content-Range','update','status','end','sendStatus','stack','name','index'];(function(_0x5a45e3,_0x3362a5){var _0x29a713=function(_0x59218f){while(--_0x59218f){_0x5a45e3['push'](_0x5a45e3['shift']());}};_0x29a713(++_0x3362a5);}(_0xec7a,0x1c5));var _0xaec7=function(_0x37fa2b,_0x3adbf7){_0x37fa2b=_0x37fa2b-0x0;var _0x44efee=_0xec7a[_0x37fa2b];return _0x44efee;};'use strict';var emlformat=require(_0xaec7('0x0'));var moment=require(_0xaec7('0x1'));var BPromise=require(_0xaec7('0x2'));var util=require(_0xaec7('0x3'));var path=require(_0xaec7('0x4'));var fs=require('fs');var _=require(_0xaec7('0x5'));var Redis=require(_0xaec7('0x6'));var htmlToText=require(_0xaec7('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xaec7('0x8'))('api');var interaction_log=require(_0xaec7('0x8'))(_0xaec7('0x9'));var config=require(_0xaec7('0xa'));var db=require(_0xaec7('0xb'))['db'];config[_0xaec7('0xc')]=_['defaults'](config[_0xaec7('0xc')],{'host':_0xaec7('0xd'),'port':0x18eb});var socket=require(_0xaec7('0xe'))(new Redis(config[_0xaec7('0xc')]));var htmlEntities=require(_0xaec7('0xf'));require(_0xaec7('0x10'))[_0xaec7('0x11')](socket);var jayson=require(_0xaec7('0x12'));var client=jayson[_0xaec7('0x13')]['http']({'port':0x232c});var client9003=jayson[_0xaec7('0x13')]['http']({'port':0x232b});var client9002=jayson['client'][_0xaec7('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x5a52ae,_0x18865a,_0x48b69f,_0x575e62){return new BPromise(function(_0x4bb6c7,_0x13903b){var _0x549fdc=_0x575e62||client;return _0x549fdc[_0xaec7('0x15')](_0x5a52ae,_0x48b69f)[_0xaec7('0x16')](function(_0x5f2e97){logger['info']('MailMessage,\x20%s,\x20%s',_0x18865a,_0xaec7('0x17'));logger[_0xaec7('0x18')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x18865a,_0xaec7('0x17'),JSON['stringify'](_0x5f2e97));if(_0x5f2e97[_0xaec7('0x19')]){if(_0x5f2e97[_0xaec7('0x19')][_0xaec7('0x1a')]===0x1f4){logger[_0xaec7('0x19')]('MailMessage,\x20%s,\x20%s',_0x18865a,_0x5f2e97[_0xaec7('0x19')][_0xaec7('0x1b')]);return _0x13903b(_0x5f2e97['error']['message']);}logger[_0xaec7('0x19')](_0xaec7('0x1c'),_0x18865a,_0x5f2e97['error'][_0xaec7('0x1b')]);return _0x4bb6c7(_0x5f2e97[_0xaec7('0x19')][_0xaec7('0x1b')]);}else{logger[_0xaec7('0x1d')](_0xaec7('0x1c'),_0x18865a,_0xaec7('0x17'));_0x4bb6c7(_0x5f2e97['result'][_0xaec7('0x1b')]);}})[_0xaec7('0x1e')](function(_0x5a1e4b){logger[_0xaec7('0x19')](_0xaec7('0x1c'),_0x18865a,_0x5a1e4b);_0x13903b(_0x5a1e4b);});});}function respondWithResult(_0x3a965c,_0xbc02f){_0xbc02f=_0xbc02f||0xc8;return function(_0x31ce26){if(_0x31ce26){return _0x3a965c['status'](_0xbc02f)[_0xaec7('0x1f')](_0x31ce26);}};}function respondWithFilteredResult(_0x39fa97,_0x2a51cb){return function(_0x417d5){if(_0x417d5){var _0x11f450=typeof _0x2a51cb[_0xaec7('0x20')]===_0xaec7('0x21')&&typeof _0x2a51cb[_0xaec7('0x22')]===_0xaec7('0x21');var _0x55702f=_0x417d5[_0xaec7('0x23')];var _0x5260ad=_0x11f450?0x0:_0x2a51cb[_0xaec7('0x20')];var _0x14087b=_0x11f450?_0x417d5[_0xaec7('0x23')]:_0x2a51cb['offset']+_0x2a51cb[_0xaec7('0x22')];var _0x1a239f;if(_0x14087b>=_0x55702f){_0x14087b=_0x55702f;_0x1a239f=0xc8;}else{_0x1a239f=0xce;}_0x39fa97['status'](_0x1a239f);return _0x39fa97[_0xaec7('0x24')](_0xaec7('0x25'),_0x5260ad+'-'+_0x14087b+'/'+_0x55702f)[_0xaec7('0x1f')](_0x417d5);}return null;};}function saveUpdates(_0x207ccd){return function(_0x2b291c){if(_0x2b291c){return _0x2b291c[_0xaec7('0x26')](_0x207ccd)[_0xaec7('0x16')](function(_0x1811bf){return _0x1811bf;});}return null;};}function removeEntity(_0xa24261){return function(_0x9d3a78){if(_0x9d3a78){return _0x9d3a78['destroy']()[_0xaec7('0x16')](function(){_0xa24261[_0xaec7('0x27')](0xcc)[_0xaec7('0x28')]();});}};}function handleEntityNotFound(_0x2d68c3){return function(_0x56c00f){if(!_0x56c00f){_0x2d68c3[_0xaec7('0x29')](0x194);}return _0x56c00f;};}function handleError(_0x2de4f8,_0x1c556a){_0x1c556a=_0x1c556a||0x1f4;return function(_0x27fcdf){logger[_0xaec7('0x19')](_0x27fcdf[_0xaec7('0x2a')]);if(_0x27fcdf[_0xaec7('0x2b')]){delete _0x27fcdf[_0xaec7('0x2b')];}_0x2de4f8['status'](_0x1c556a)['send'](_0x27fcdf);};}exports[_0xaec7('0x2c')]=function(_0x4e618a,_0x2a4923){var _0x402c4f={},_0x3d6b0b={},_0x199e86={'count':0x0,'rows':[]};var _0x9f7a3c=_[_0xaec7('0x2d')](db[_0xaec7('0x2e')][_0xaec7('0x2f')],function(_0x1b9551){return{'name':_0x1b9551[_0xaec7('0x30')],'type':_0x1b9551[_0xaec7('0x31')][_0xaec7('0x32')]};});_0x3d6b0b['model']=_[_0xaec7('0x2d')](_0x9f7a3c,_0xaec7('0x2b'));_0x3d6b0b[_0xaec7('0x33')]=_['keys'](_0x4e618a[_0xaec7('0x33')]);_0x3d6b0b[_0xaec7('0x34')]=_[_0xaec7('0x35')](_0x3d6b0b[_0xaec7('0x36')],_0x3d6b0b[_0xaec7('0x33')]);_0x402c4f[_0xaec7('0x37')]=_[_0xaec7('0x35')](_0x3d6b0b[_0xaec7('0x36')],qs['fields'](_0x4e618a[_0xaec7('0x33')][_0xaec7('0x38')]));_0x402c4f[_0xaec7('0x37')]=_0x402c4f[_0xaec7('0x37')][_0xaec7('0x39')]?_0x402c4f['attributes']:_0x3d6b0b[_0xaec7('0x36')];if(!_0x4e618a[_0xaec7('0x33')][_0xaec7('0x3a')](_0xaec7('0x3b'))){_0x402c4f[_0xaec7('0x22')]=qs[_0xaec7('0x22')](_0x4e618a[_0xaec7('0x33')][_0xaec7('0x22')]);_0x402c4f[_0xaec7('0x20')]=qs['offset'](_0x4e618a[_0xaec7('0x33')][_0xaec7('0x20')]);}_0x402c4f[_0xaec7('0x3c')]=qs[_0xaec7('0x3d')](_0x4e618a[_0xaec7('0x33')][_0xaec7('0x3d')]);_0x402c4f['where']=qs[_0xaec7('0x34')](_[_0xaec7('0x3e')](_0x4e618a[_0xaec7('0x33')],_0x3d6b0b['filters']),_0x9f7a3c);if(_0x4e618a[_0xaec7('0x33')][_0xaec7('0x3f')]){_0x402c4f[_0xaec7('0x40')]=_[_0xaec7('0x41')](_0x402c4f[_0xaec7('0x40')],{'$or':_[_0xaec7('0x2d')](_0x9f7a3c,function(_0x4128a9){if(_0x4128a9['type']!=='VIRTUAL'){var _0x530d95={};_0x530d95[_0x4128a9[_0xaec7('0x2b')]]={'$like':'%'+_0x4e618a[_0xaec7('0x33')]['filter']+'%'};return _0x530d95;}})});}_0x402c4f=_[_0xaec7('0x41')]({},_0x402c4f,_0x4e618a[_0xaec7('0x42')]);var _0x5f17a5={'where':_0x402c4f[_0xaec7('0x40')]};return db[_0xaec7('0x2e')][_0xaec7('0x23')](_0x5f17a5)[_0xaec7('0x16')](function(_0x4fe739){_0x199e86[_0xaec7('0x23')]=_0x4fe739;if(_0x4e618a['query'][_0xaec7('0x43')]){_0x402c4f['include']=[{'all':!![]}];}return db[_0xaec7('0x2e')][_0xaec7('0x44')](_0x402c4f);})[_0xaec7('0x16')](function(_0x326efc){_0x199e86[_0xaec7('0x45')]=_0x326efc;return _0x199e86;})[_0xaec7('0x16')](respondWithFilteredResult(_0x2a4923,_0x402c4f))[_0xaec7('0x1e')](handleError(_0x2a4923,null));};exports[_0xaec7('0x46')]=function(_0x474033,_0xccdc5c){var _0x5e7e9c={'raw':!![],'where':{'id':_0x474033[_0xaec7('0x47')]['id']}},_0xd2210a={};_0xd2210a[_0xaec7('0x36')]=_[_0xaec7('0x48')](db[_0xaec7('0x2e')][_0xaec7('0x2f')]);_0xd2210a[_0xaec7('0x33')]=_[_0xaec7('0x48')](_0x474033[_0xaec7('0x33')]);_0xd2210a[_0xaec7('0x34')]=_[_0xaec7('0x35')](_0xd2210a['model'],_0xd2210a[_0xaec7('0x33')]);_0x5e7e9c[_0xaec7('0x37')]=_[_0xaec7('0x35')](_0xd2210a[_0xaec7('0x36')],qs[_0xaec7('0x38')](_0x474033[_0xaec7('0x33')][_0xaec7('0x38')]));_0x5e7e9c[_0xaec7('0x37')]=_0x5e7e9c[_0xaec7('0x37')][_0xaec7('0x39')]?_0x5e7e9c[_0xaec7('0x37')]:_0xd2210a[_0xaec7('0x36')];if(_0x474033[_0xaec7('0x33')]['includeAll']){_0x5e7e9c[_0xaec7('0x49')]=[{'all':!![]}];}_0x5e7e9c=_[_0xaec7('0x41')]({},_0x5e7e9c,_0x474033[_0xaec7('0x42')]);return db['MailMessage'][_0xaec7('0x4a')](_0x5e7e9c)['then'](handleEntityNotFound(_0xccdc5c,null))[_0xaec7('0x16')](respondWithResult(_0xccdc5c,null))[_0xaec7('0x1e')](handleError(_0xccdc5c,null));};exports['update']=function(_0x417d18,_0x485718){if(_0x417d18[_0xaec7('0x4b')]['id']){delete _0x417d18['body']['id'];}return db[_0xaec7('0x2e')][_0xaec7('0x4a')]({'where':{'id':_0x417d18[_0xaec7('0x47')]['id']}})['then'](handleEntityNotFound(_0x485718,null))[_0xaec7('0x16')](saveUpdates(_0x417d18['body'],null))[_0xaec7('0x16')](respondWithResult(_0x485718,null))['catch'](handleError(_0x485718,null));};exports['destroy']=function(_0x3528dd,_0x318e52){return db['MailMessage'][_0xaec7('0x4a')]({'where':{'id':_0x3528dd[_0xaec7('0x47')]['id']}})['then'](handleEntityNotFound(_0x318e52,null))[_0xaec7('0x16')](removeEntity(_0x318e52,null))[_0xaec7('0x1e')](handleError(_0x318e52,null));};exports[_0xaec7('0x4c')]=function(_0x504b60,_0x244607){return db['MailMessage'][_0xaec7('0x4c')]()[_0xaec7('0x16')](respondWithResult(_0x244607,null))[_0xaec7('0x1e')](handleError(_0x244607,null));};exports['create']=function(_0x2e3483,_0x1bf0a1){return db[_0xaec7('0x2e')][_0xaec7('0x4d')](_0x2e3483['body'])[_0xaec7('0x16')](function(_0x57d0d4){if(_0x57d0d4){if(_0x57d0d4[_0xaec7('0x4e')]===_0xaec7('0x4f')&&!_0x57d0d4[_0xaec7('0x50')]){var _0x92c725,_0x3506e1,_0x5dc0f2;if(_0x2e3483[_0xaec7('0x4b')]['to']){_0x3506e1=_0x2e3483[_0xaec7('0x4b')]['to'][_0xaec7('0x51')](',')[0x0];}return db[_0xaec7('0x52')][_0xaec7('0x53')]({'where':{'id':_0x57d0d4[_0xaec7('0x54')]},'include':[{'model':db[_0xaec7('0x55')],'as':_0xaec7('0x56'),'include':[{'model':db[_0xaec7('0x57')],'as':_0xaec7('0x58'),'where':{'email':_0x3506e1},'limit':0x1,'order':[[_0xaec7('0x59'),'DESC']]}]},{'model':db[_0xaec7('0x5a')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xaec7('0x5b')],'as':_0xaec7('0x5b'),'raw':!![]}]}]})['then'](function(_0x277db6){_0x92c725=_0x277db6;if(!_0x92c725||!_0x92c725[_0xaec7('0x5c')])return;var _0x17a6fe=_0x92c725[_0xaec7('0x5d')]();if(_0x2e3483[_0xaec7('0x4b')][_0xaec7('0x5e')]&&_0x2e3483[_0xaec7('0x4b')][_0xaec7('0x5e')]['length']){for(var _0x5b39f1=0x0;_0x5b39f1<_0x2e3483['body'][_0xaec7('0x5e')][_0xaec7('0x39')];_0x5b39f1+=0x1){_0x2e3483['body'][_0xaec7('0x5e')][_0x5b39f1]={'filename':_0x2e3483[_0xaec7('0x4b')][_0xaec7('0x5e')][_0x5b39f1][_0xaec7('0x2b')],'path':path[_0xaec7('0x5f')](config[_0xaec7('0x60')],_0xaec7('0x61'),_0x2e3483['body'][_0xaec7('0x5e')][_0x5b39f1][_0xaec7('0x62')])};}}_0x5dc0f2={'account':_0x17a6fe,'message':_0x2e3483[_0xaec7('0x4b')]};return;})['then'](function(){if(_0x92c725[_0xaec7('0x56')]){if(_0x92c725[_0xaec7('0x56')][_0xaec7('0x58')][_0xaec7('0x39')]){return _0x92c725[_0xaec7('0x56')][_0xaec7('0x58')][0x0];}else{return db['CmContact'][_0xaec7('0x4d')](_[_0xaec7('0x63')](_0x2e3483[_0xaec7('0x4b')],{'firstName':_0x2e3483[_0xaec7('0x4b')]['to'],'email':_0x2e3483['body']['to'],'phone':_0x2e3483[_0xaec7('0x4b')]['to'],'ListId':_0x92c725[_0xaec7('0x64')]}));}}else{throw new Error(_0xaec7('0x65'));}})[_0xaec7('0x16')](function(){if(_0x5dc0f2){return respondWithRpcPromise(_0xaec7('0x66'),_0xaec7('0x67'),_0x5dc0f2,client9003)['then'](function(_0x36862f){return _0x57d0d4[_0xaec7('0x26')]({'read':!![],'messageId':_0x36862f['messageId'],'sentAt':moment()[_0xaec7('0x68')](_0xaec7('0x69'))});})['catch'](function(_0x24d153){logger[_0xaec7('0x19')]('%s',JSON[_0xaec7('0x6a')](_0x24d153));return _0x57d0d4;});}return _0x57d0d4;});}return _0x57d0d4;}})[_0xaec7('0x16')](respondWithResult(_0x1bf0a1,0xc9))['catch'](handleError(_0x1bf0a1,null));};exports[_0xaec7('0x6b')]=function(_0x546bc0,_0x5395a1){var _0x5dbde5={'agent':{},'channel':'mail'};if(_0x546bc0['body']['id']){delete _0x546bc0['body']['id'];}_0x546bc0[_0xaec7('0x4b')][_0xaec7('0x6c')]=!![];_0x546bc0['body'][_0xaec7('0x6d')]=moment()[_0xaec7('0x68')](_0xaec7('0x69'));_0x546bc0[_0xaec7('0x4b')][_0xaec7('0x6e')]=_0x546bc0[_0xaec7('0x4b')][_0xaec7('0x6e')]||_0x546bc0[_0xaec7('0x6f')]['id'];_0x5dbde5[_0xaec7('0x70')]['id']=_0x546bc0['body']['UserId'];return db['MailMessage'][_0xaec7('0x4a')]({'where':{'id':_0x546bc0[_0xaec7('0x47')]['id'],'UserId':null}})[_0xaec7('0x16')](handleEntityNotFound(_0x5395a1,null))['then'](saveUpdates(_0x546bc0[_0xaec7('0x4b')],null))[_0xaec7('0x16')](function(_0x4dfaad){if(_0x4dfaad){_0x5dbde5[_0xaec7('0x1b')]=_0x4dfaad[_0xaec7('0x71')]({'plain':!![]});return db[_0xaec7('0x72')][_0xaec7('0x4a')]({'where':{'id':_0x4dfaad['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5395a1,null))[_0xaec7('0x16')](function(_0x302993){if(_0x302993){return _0x302993[_0xaec7('0x26')]({'UserId':_0x546bc0[_0xaec7('0x4b')][_0xaec7('0x6e')],'read1stAt':_[_0xaec7('0x73')](_0x302993[_0xaec7('0x74')])?moment()[_0xaec7('0x68')](_0xaec7('0x69')):undefined});}return null;})[_0xaec7('0x16')](function(_0x1d4ed2){if(_0x1d4ed2){_0x5dbde5['interaction']=_0x1d4ed2[_0xaec7('0x71')]({'plain':!![]});interaction_log[_0xaec7('0x1d')](_0xaec7('0x75'),_0x546bc0[_0xaec7('0x6f')]['id'],_0x546bc0[_0xaec7('0x6f')][_0xaec7('0x2b')],_0x546bc0[_0xaec7('0x6f')][_0xaec7('0x76')],_0x5dbde5[_0xaec7('0x77')]['id'],_0x546bc0[_0xaec7('0x4b')]?JSON[_0xaec7('0x6a')](_0x546bc0['body']):_0xaec7('0x78'));return respondWithRpcPromise(_0xaec7('0x79'),_0xaec7('0x7a'),_0x5dbde5);}return null;})[_0xaec7('0x16')](function(_0x1dbff2){var _0x1c9432=_0xaec7('0x7b')+_0x1dbff2['message'][_0xaec7('0x7c')];return db[_0xaec7('0x7d')][_0xaec7('0x33')](_0x1c9432,{'type':db[_0xaec7('0x7e')]['QueryTypes'][_0xaec7('0x7f')],'raw':!![]})[_0xaec7('0x16')](function(_0x3efb41){return _0x3efb41;});})[_0xaec7('0x16')](function(_0x584644){if(_0x584644){_0x5dbde5[_0xaec7('0x1b')][_0xaec7('0x80')]=_0x584644[0x0];if(!_0x546bc0[_0xaec7('0x4b')][_0xaec7('0x6e')])return;return db[_0xaec7('0x81')][_0xaec7('0x4a')]({'where':{'id':_0x546bc0[_0xaec7('0x4b')][_0xaec7('0x6e')],'role':_0xaec7('0x70')},'attributes':['id','name',_0xaec7('0x82'),'email',_0xaec7('0x83')],'raw':!![]});}return null;})[_0xaec7('0x16')](function(_0x555c97){if(!_0x555c97)return null;_0x5dbde5['message'][_0xaec7('0x70')]=_0x555c97;return _0x5dbde5;})[_0xaec7('0x16')](function(_0x3e6e5b){if(_0x3e6e5b){if(_0x546bc0[_0xaec7('0x4b')][_0xaec7('0x84')]){_0x5dbde5[_0xaec7('0x1b')]['interface']=util[_0xaec7('0x68')]('SIP/%s',_0x546bc0['user'][_0xaec7('0x2b')]);_0x5dbde5[_0xaec7('0x1b')][_0xaec7('0x85')]=_0x5dbde5[_0xaec7('0x85')];_0x5dbde5[_0xaec7('0x1b')][_0xaec7('0x86')]=_0x5dbde5[_0xaec7('0x85')];_0x5dbde5['message'][_0xaec7('0x87')]=_0xaec7('0x6b');_0x5dbde5['message'][_0xaec7('0x4b')]=htmlToText['fromString'](_0x5dbde5[_0xaec7('0x1b')][_0xaec7('0x4b')]);return respondWithRpcPromise(_0xaec7('0x88'),'EventManager',{'event':_0xaec7('0x89'),'message':_0x5dbde5[_0xaec7('0x1b')]},client9002)['then'](function(){return _0x5dbde5;});}return _0x5dbde5;}return null;})['then'](respondWithResult(_0x5395a1,null))[_0xaec7('0x1e')](handleError(_0x5395a1,null));};exports[_0xaec7('0x8a')]=function(_0x1ac8fc,_0x39d536){var _0xdeac78={'agent':{},'channel':_0xaec7('0x8b')};if(_0x1ac8fc['body']['id']){delete _0x1ac8fc['body']['id'];}_0x1ac8fc[_0xaec7('0x4b')][_0xaec7('0x6e')]=_0x1ac8fc[_0xaec7('0x4b')][_0xaec7('0x6e')]||_0x1ac8fc[_0xaec7('0x6f')]['id'];_0xdeac78[_0xaec7('0x70')]['id']=_0x1ac8fc[_0xaec7('0x4b')][_0xaec7('0x6e')];return db[_0xaec7('0x2e')][_0xaec7('0x4a')]({'where':{'id':_0x1ac8fc[_0xaec7('0x47')]['id'],'UserId':null}})[_0xaec7('0x16')](handleEntityNotFound(_0x39d536,null))[_0xaec7('0x16')](function(_0xf699ff){if(_0xf699ff){_0xdeac78[_0xaec7('0x1b')]=_0xf699ff[_0xaec7('0x71')]({'plain':!![]});return db[_0xaec7('0x72')][_0xaec7('0x4a')]({'where':{'id':_0xf699ff['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x39d536,null))['then'](function(_0x5401af){if(_0x5401af){_0xdeac78['interaction']=_0x5401af[_0xaec7('0x71')]({'plain':!![]});interaction_log[_0xaec7('0x1d')](_0xaec7('0x8c'),_0x1ac8fc['user']['id'],_0x1ac8fc[_0xaec7('0x6f')][_0xaec7('0x2b')],_0x1ac8fc[_0xaec7('0x6f')][_0xaec7('0x76')],_0xdeac78[_0xaec7('0x77')]['id'],_0x1ac8fc[_0xaec7('0x4b')]?JSON['stringify'](_0x1ac8fc[_0xaec7('0x4b')]):_0xaec7('0x78'));return respondWithRpcPromise(_0xaec7('0x8d'),_0xaec7('0x8e'),_0xdeac78);}return null;})[_0xaec7('0x16')](function(_0x7aecb6){var _0x3065b9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x7aecb6[_0xaec7('0x1b')][_0xaec7('0x7c')];return db[_0xaec7('0x7d')][_0xaec7('0x33')](_0x3065b9,{'type':db[_0xaec7('0x7e')]['QueryTypes'][_0xaec7('0x7f')],'raw':!![]})[_0xaec7('0x16')](function(_0x5f5d10){return _0x5f5d10;});})['then'](function(_0x2f0617){if(_0x2f0617){_0xdeac78[_0xaec7('0x1b')]['contact']=_0x2f0617[0x0];if(!_0x1ac8fc[_0xaec7('0x4b')]['UserId'])return;return db[_0xaec7('0x81')]['find']({'where':{'id':_0x1ac8fc['body'][_0xaec7('0x6e')],'role':_0xaec7('0x70')},'attributes':['id',_0xaec7('0x2b'),_0xaec7('0x82'),_0xaec7('0x8f'),_0xaec7('0x83')],'raw':!![]});}return null;})[_0xaec7('0x16')](function(_0x35a4fd){if(!_0x35a4fd)return null;_0xdeac78[_0xaec7('0x1b')][_0xaec7('0x70')]=_0x35a4fd;return _0xdeac78;})[_0xaec7('0x16')](function(_0x4b2fee){if(_0x4b2fee){_0x4b2fee['message'][_0xaec7('0x90')]=util[_0xaec7('0x68')](_0xaec7('0x91'),_0x1ac8fc[_0xaec7('0x6f')][_0xaec7('0x2b')]);_0x4b2fee[_0xaec7('0x1b')][_0xaec7('0x85')]=_0xdeac78[_0xaec7('0x85')];_0x4b2fee[_0xaec7('0x1b')]['motionChannel']=_0xdeac78[_0xaec7('0x85')];_0x4b2fee[_0xaec7('0x1b')][_0xaec7('0x87')]=_0xaec7('0x8a');_0x4b2fee[_0xaec7('0x1b')][_0xaec7('0x4b')]=htmlToText[_0xaec7('0x92')](_0xdeac78[_0xaec7('0x1b')][_0xaec7('0x4b')]);respondWithRpcPromise(_0xaec7('0x88'),_0xaec7('0x88'),{'event':'rejectmessage','message':_0x4b2fee[_0xaec7('0x1b')]},client9002);return _0xdeac78;}return null;})[_0xaec7('0x16')](respondWithResult(_0x39d536,null))[_0xaec7('0x1e')](handleError(_0x39d536,null));};exports[_0xaec7('0x93')]=function(_0x42e7ba,_0xb15a0e){var _0x59ca5e=moment()[_0xaec7('0x94')]()[_0xaec7('0x95')]();var _0x1e244e=path[_0xaec7('0x5f')](config['root'],_0xaec7('0x96'),_0xaec7('0x97'),_0xaec7('0x98'));var _0x17f43d=path[_0xaec7('0x5f')](config[_0xaec7('0x60')],_0xaec7('0x96'),_0xaec7('0x97'),'attachments');var _0x5ac123=util[_0xaec7('0x68')](_0xaec7('0x99'),_0x59ca5e);return db[_0xaec7('0x2e')][_0xaec7('0x4a')]({'where':{'id':_0x42e7ba['params']['id']},'attributes':['id',_0xaec7('0x4b'),_0xaec7('0x9a'),'to','cc',_0xaec7('0x9b'),'subject',_0xaec7('0x9c')],'include':_0x42e7ba[_0xaec7('0x33')][_0xaec7('0x5e')]?[{'model':db['Attachment'],'as':_0xaec7('0x9d')}]:undefined})[_0xaec7('0x16')](handleEntityNotFound(_0xb15a0e,null))[_0xaec7('0x16')](function(_0x1b348d){if(_0x1b348d){var _0x4376d4=_0x1b348d;var _0xeddc90={'from':_0x4376d4[_0xaec7('0x9a')],'to':_0x4376d4['to'],'subject':_0x4376d4['subject'],'html':htmlEntities[_0xaec7('0x9e')](_0x4376d4[_0xaec7('0x4b')]),'headers':{'Date':moment(_0x4376d4[_0xaec7('0x9c')])[_0xaec7('0x68')](_0xaec7('0x9f'))},'attachments':[]};if(_0x1b348d['cc']){_0xeddc90['headers']['Cc']=_0x1b348d['cc'];}if(_0x1b348d[_0xaec7('0x9b')]){_0xeddc90[_0xaec7('0xa0')][_0xaec7('0xa1')]=_0x1b348d[_0xaec7('0x9b')];}return new BPromise(function(_0x2d2c73,_0x3e487e){if(_0x1b348d[_0xaec7('0x9d')]){for(var _0x5c04d5=0x0;_0x5c04d5<_0x1b348d[_0xaec7('0x9d')][_0xaec7('0x39')];_0x5c04d5++){var _0x24b7b9=_0x1b348d['Attachments'][_0x5c04d5];var _0x564780=path[_0xaec7('0x5f')](_0x17f43d,_0x24b7b9[_0xaec7('0x62')]);if(fs[_0xaec7('0xa2')](_0x564780)){_0xeddc90[_0xaec7('0x5e')][_0xaec7('0xa3')]({'name':_0x24b7b9['name'],'contentType':_0x24b7b9['type'],'data':fs['readFileSync'](_0x564780)});}}}emlformat['build'](_0xeddc90,function(_0x53977b,_0x4f140b){if(_0x53977b)return _0x3e487e(_0x53977b);fs[_0xaec7('0xa4')](path['join'](_0x1e244e,_0x5ac123),_0x4f140b);return _0x2d2c73(_0x4f140b);});});}})[_0xaec7('0x16')](function(_0x28cc65){if(_0x28cc65){return _0xb15a0e[_0xaec7('0x93')](path[_0xaec7('0x5f')](_0x1e244e,_0x5ac123),_0x5ac123,function(_0xe79288){if(!_0xe79288)fs[_0xaec7('0xa5')](path[_0xaec7('0x5f')](_0x1e244e,_0x5ac123));});}})['catch'](handleError(_0xb15a0e,null));}; \ No newline at end of file +var _0x9952=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','create','direction','out','secret','MailAccount','CmList','List','CmContact','Contacts','MailServerOut','CloudProvider','Smtp','attachments','root','server/files/attachments','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','agent','fullname','interface','channel','fromString','EventManager','acceptmessage','reject','MailInteraction','role','RejectMessage','rejectMessage','QueryTypes','contact','User','email','motionChannel','event','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','headers','basename','existsSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','mail-interactions','redis','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','json','undefined','limit','count','offset','update','destroy','status','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9952,0x188));var _0x2995=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x9952[_0x511bd1];return _0x4c48ec;};'use strict';var emlformat=require(_0x2995('0x0'));var moment=require(_0x2995('0x1'));var BPromise=require(_0x2995('0x2'));var util=require(_0x2995('0x3'));var path=require(_0x2995('0x4'));var fs=require('fs');var _=require(_0x2995('0x5'));var Redis=require(_0x2995('0x6'));var htmlToText=require(_0x2995('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x2995('0x8'))('api');var interaction_log=require('../../config/logger')(_0x2995('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2995('0xa')]=_['defaults'](config[_0x2995('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2995('0xb'))(new Redis(config[_0x2995('0xa')]));var htmlEntities=require('html-entities');require(_0x2995('0xc'))['register'](socket);var jayson=require(_0x2995('0xd'));var client=jayson[_0x2995('0xe')][_0x2995('0xf')]({'port':0x232c});var client9003=jayson['client'][_0x2995('0xf')]({'port':0x232b});var client9002=jayson[_0x2995('0xe')][_0x2995('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x5cfa51,_0x1fffe0,_0x14e89f,_0x2c2d17){return new BPromise(function(_0x28eb84,_0x33fd7e){var _0x3f3f65=_0x2c2d17||client;return _0x3f3f65[_0x2995('0x10')](_0x5cfa51,_0x14e89f)[_0x2995('0x11')](function(_0x2148b7){logger['info'](_0x2995('0x12'),_0x1fffe0,_0x2995('0x13'));logger['debug'](_0x2995('0x14'),_0x1fffe0,_0x2995('0x13'),JSON[_0x2995('0x15')](_0x2148b7));if(_0x2148b7['error']){if(_0x2148b7[_0x2995('0x16')]['code']===0x1f4){logger[_0x2995('0x16')]('MailMessage,\x20%s,\x20%s',_0x1fffe0,_0x2148b7[_0x2995('0x16')]['message']);return _0x33fd7e(_0x2148b7[_0x2995('0x16')]['message']);}logger[_0x2995('0x16')](_0x2995('0x12'),_0x1fffe0,_0x2148b7['error'][_0x2995('0x17')]);return _0x28eb84(_0x2148b7['error'][_0x2995('0x17')]);}else{logger[_0x2995('0x18')](_0x2995('0x12'),_0x1fffe0,_0x2995('0x13'));_0x28eb84(_0x2148b7[_0x2995('0x19')][_0x2995('0x17')]);}})['catch'](function(_0x5bbfcb){logger[_0x2995('0x16')](_0x2995('0x12'),_0x1fffe0,_0x5bbfcb);_0x33fd7e(_0x5bbfcb);});});}function respondWithResult(_0x3d4985,_0x3462e5){_0x3462e5=_0x3462e5||0xc8;return function(_0xed2917){if(_0xed2917){return _0x3d4985['status'](_0x3462e5)[_0x2995('0x1a')](_0xed2917);}};}function respondWithFilteredResult(_0x4a9a89,_0x1e20c4){return function(_0x2289c6){if(_0x2289c6){var _0x10255d=typeof _0x1e20c4['offset']===_0x2995('0x1b')&&typeof _0x1e20c4[_0x2995('0x1c')]===_0x2995('0x1b');var _0x727b0d=_0x2289c6[_0x2995('0x1d')];var _0xd496c1=_0x10255d?0x0:_0x1e20c4['offset'];var _0x4a90a5=_0x10255d?_0x2289c6[_0x2995('0x1d')]:_0x1e20c4[_0x2995('0x1e')]+_0x1e20c4[_0x2995('0x1c')];var _0x1031bc;if(_0x4a90a5>=_0x727b0d){_0x4a90a5=_0x727b0d;_0x1031bc=0xc8;}else{_0x1031bc=0xce;}_0x4a9a89['status'](_0x1031bc);return _0x4a9a89['set']('Content-Range',_0xd496c1+'-'+_0x4a90a5+'/'+_0x727b0d)[_0x2995('0x1a')](_0x2289c6);}return null;};}function saveUpdates(_0x1886ff){return function(_0x4cae7c){if(_0x4cae7c){return _0x4cae7c[_0x2995('0x1f')](_0x1886ff)['then'](function(_0x4badc6){return _0x4badc6;});}return null;};}function removeEntity(_0x1ee99f){return function(_0x574abb){if(_0x574abb){return _0x574abb[_0x2995('0x20')]()[_0x2995('0x11')](function(){_0x1ee99f[_0x2995('0x21')](0xcc)[_0x2995('0x22')]();});}};}function handleEntityNotFound(_0x436a3e){return function(_0x4a1714){if(!_0x4a1714){_0x436a3e[_0x2995('0x23')](0x194);}return _0x4a1714;};}function handleError(_0xd857e6,_0x2ad3e7){_0x2ad3e7=_0x2ad3e7||0x1f4;return function(_0x4d161b){logger['error'](_0x4d161b[_0x2995('0x24')]);if(_0x4d161b[_0x2995('0x25')]){delete _0x4d161b[_0x2995('0x25')];}_0xd857e6[_0x2995('0x21')](_0x2ad3e7)[_0x2995('0x26')](_0x4d161b);};}exports[_0x2995('0x27')]=function(_0x30a22c,_0x1e1278){var _0x42652b={},_0x1e1a63={},_0x230d26={'count':0x0,'rows':[]};var _0x781f4b=_['map'](db[_0x2995('0x28')][_0x2995('0x29')],function(_0xbcd105){return{'name':_0xbcd105['fieldName'],'type':_0xbcd105[_0x2995('0x2a')]['key']};});_0x1e1a63['model']=_[_0x2995('0x2b')](_0x781f4b,_0x2995('0x25'));_0x1e1a63[_0x2995('0x2c')]=_[_0x2995('0x2d')](_0x30a22c[_0x2995('0x2c')]);_0x1e1a63[_0x2995('0x2e')]=_[_0x2995('0x2f')](_0x1e1a63[_0x2995('0x30')],_0x1e1a63[_0x2995('0x2c')]);_0x42652b[_0x2995('0x31')]=_['intersection'](_0x1e1a63[_0x2995('0x30')],qs['fields'](_0x30a22c[_0x2995('0x2c')][_0x2995('0x32')]));_0x42652b[_0x2995('0x31')]=_0x42652b[_0x2995('0x31')][_0x2995('0x33')]?_0x42652b[_0x2995('0x31')]:_0x1e1a63[_0x2995('0x30')];if(!_0x30a22c[_0x2995('0x2c')][_0x2995('0x34')](_0x2995('0x35'))){_0x42652b['limit']=qs[_0x2995('0x1c')](_0x30a22c['query'][_0x2995('0x1c')]);_0x42652b[_0x2995('0x1e')]=qs[_0x2995('0x1e')](_0x30a22c['query'][_0x2995('0x1e')]);}_0x42652b[_0x2995('0x36')]=qs[_0x2995('0x37')](_0x30a22c[_0x2995('0x2c')]['sort']);_0x42652b[_0x2995('0x38')]=qs[_0x2995('0x2e')](_[_0x2995('0x39')](_0x30a22c['query'],_0x1e1a63[_0x2995('0x2e')]),_0x781f4b);if(_0x30a22c['query'][_0x2995('0x3a')]){_0x42652b['where']=_[_0x2995('0x3b')](_0x42652b[_0x2995('0x38')],{'$or':_[_0x2995('0x2b')](_0x781f4b,function(_0x5445ee){if(_0x5445ee[_0x2995('0x2a')]!==_0x2995('0x3c')){var _0x58ee56={};_0x58ee56[_0x5445ee[_0x2995('0x25')]]={'$like':'%'+_0x30a22c[_0x2995('0x2c')][_0x2995('0x3a')]+'%'};return _0x58ee56;}})});}_0x42652b=_[_0x2995('0x3b')]({},_0x42652b,_0x30a22c[_0x2995('0x3d')]);var _0x32b02c={'where':_0x42652b[_0x2995('0x38')]};return db[_0x2995('0x28')][_0x2995('0x1d')](_0x32b02c)[_0x2995('0x11')](function(_0x24380f){_0x230d26[_0x2995('0x1d')]=_0x24380f;if(_0x30a22c['query'][_0x2995('0x3e')]){_0x42652b[_0x2995('0x3f')]=[{'all':!![]}];}return db[_0x2995('0x28')][_0x2995('0x40')](_0x42652b);})[_0x2995('0x11')](function(_0x253a2a){_0x230d26[_0x2995('0x41')]=_0x253a2a;return _0x230d26;})[_0x2995('0x11')](respondWithFilteredResult(_0x1e1278,_0x42652b))[_0x2995('0x42')](handleError(_0x1e1278,null));};exports[_0x2995('0x43')]=function(_0xabdbe1,_0x4fc6c4){var _0x57435a={'raw':!![],'where':{'id':_0xabdbe1['params']['id']}},_0x32dd1f={};_0x32dd1f['model']=_[_0x2995('0x2d')](db[_0x2995('0x28')][_0x2995('0x29')]);_0x32dd1f[_0x2995('0x2c')]=_[_0x2995('0x2d')](_0xabdbe1[_0x2995('0x2c')]);_0x32dd1f[_0x2995('0x2e')]=_['intersection'](_0x32dd1f[_0x2995('0x30')],_0x32dd1f[_0x2995('0x2c')]);_0x57435a['attributes']=_[_0x2995('0x2f')](_0x32dd1f[_0x2995('0x30')],qs[_0x2995('0x32')](_0xabdbe1[_0x2995('0x2c')][_0x2995('0x32')]));_0x57435a[_0x2995('0x31')]=_0x57435a[_0x2995('0x31')][_0x2995('0x33')]?_0x57435a[_0x2995('0x31')]:_0x32dd1f['model'];if(_0xabdbe1[_0x2995('0x2c')][_0x2995('0x3e')]){_0x57435a['include']=[{'all':!![]}];}_0x57435a=_['merge']({},_0x57435a,_0xabdbe1['options']);return db[_0x2995('0x28')][_0x2995('0x44')](_0x57435a)[_0x2995('0x11')](handleEntityNotFound(_0x4fc6c4,null))[_0x2995('0x11')](respondWithResult(_0x4fc6c4,null))[_0x2995('0x42')](handleError(_0x4fc6c4,null));};exports['update']=function(_0x30d242,_0x55853f){if(_0x30d242[_0x2995('0x45')]['id']){delete _0x30d242[_0x2995('0x45')]['id'];}return db[_0x2995('0x28')][_0x2995('0x44')]({'where':{'id':_0x30d242[_0x2995('0x46')]['id']}})[_0x2995('0x11')](handleEntityNotFound(_0x55853f,null))[_0x2995('0x11')](saveUpdates(_0x30d242[_0x2995('0x45')],null))[_0x2995('0x11')](respondWithResult(_0x55853f,null))[_0x2995('0x42')](handleError(_0x55853f,null));};exports[_0x2995('0x20')]=function(_0xe042e7,_0xc59d3){return db[_0x2995('0x28')]['find']({'where':{'id':_0xe042e7['params']['id']}})[_0x2995('0x11')](handleEntityNotFound(_0xc59d3,null))[_0x2995('0x11')](removeEntity(_0xc59d3,null))[_0x2995('0x42')](handleError(_0xc59d3,null));};exports[_0x2995('0x47')]=function(_0x4e3515,_0x346496){return db[_0x2995('0x28')][_0x2995('0x47')]()[_0x2995('0x11')](respondWithResult(_0x346496,null))[_0x2995('0x42')](handleError(_0x346496,null));};exports[_0x2995('0x48')]=function(_0x150eed,_0x2e52cd){return db[_0x2995('0x28')][_0x2995('0x48')](_0x150eed[_0x2995('0x45')])['then'](function(_0x1c9e92){if(_0x1c9e92){if(_0x1c9e92[_0x2995('0x49')]===_0x2995('0x4a')&&!_0x1c9e92[_0x2995('0x4b')]){var _0x1e9c44,_0x5a8ea0,_0x479931;if(_0x150eed[_0x2995('0x45')]['to']){_0x5a8ea0=_0x150eed['body']['to']['split'](',')[0x0];}return db[_0x2995('0x4c')]['findOne']({'where':{'id':_0x1c9e92['MailAccountId']},'include':[{'model':db[_0x2995('0x4d')],'as':_0x2995('0x4e'),'include':[{'model':db[_0x2995('0x4f')],'as':_0x2995('0x50'),'where':{'email':_0x5a8ea0},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x2995('0x51')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2995('0x52')],'as':_0x2995('0x52'),'raw':!![]}]}]})[_0x2995('0x11')](function(_0x51b905){_0x1e9c44=_0x51b905;if(!_0x1e9c44||!_0x1e9c44[_0x2995('0x53')])return;var _0x38a864=_0x1e9c44['getSmtpOptions']();if(_0x150eed[_0x2995('0x45')]['attachments']&&_0x150eed[_0x2995('0x45')][_0x2995('0x54')][_0x2995('0x33')]){for(var _0x4ea65d=0x0;_0x4ea65d<_0x150eed[_0x2995('0x45')][_0x2995('0x54')][_0x2995('0x33')];_0x4ea65d+=0x1){_0x150eed[_0x2995('0x45')][_0x2995('0x54')][_0x4ea65d]={'filename':_0x150eed['body'][_0x2995('0x54')][_0x4ea65d]['name'],'path':path['join'](config[_0x2995('0x55')],_0x2995('0x56'),_0x150eed[_0x2995('0x45')][_0x2995('0x54')][_0x4ea65d]['basename'])};}}_0x479931={'account':_0x38a864,'message':_0x150eed['body']};return;})[_0x2995('0x11')](function(){if(_0x1e9c44['List']){if(_0x1e9c44[_0x2995('0x4e')][_0x2995('0x50')]['length']){return _0x1e9c44[_0x2995('0x4e')][_0x2995('0x50')][0x0];}else{return db[_0x2995('0x4f')][_0x2995('0x48')](_['defaults'](_0x150eed[_0x2995('0x45')],{'firstName':_0x150eed['body']['to'],'email':_0x150eed[_0x2995('0x45')]['to'],'phone':_0x150eed[_0x2995('0x45')]['to'],'ListId':_0x1e9c44[_0x2995('0x57')]}));}}else{throw new Error(_0x2995('0x58'));}})['then'](function(){if(_0x479931){return respondWithRpcPromise(_0x2995('0x59'),'sendMail',_0x479931,client9003)[_0x2995('0x11')](function(_0xc66f25){return _0x1c9e92[_0x2995('0x1f')]({'read':!![],'messageId':_0xc66f25['messageId'],'sentAt':moment()[_0x2995('0x5a')](_0x2995('0x5b'))});})['catch'](function(_0x27caf3){logger[_0x2995('0x16')]('%s',JSON[_0x2995('0x15')](_0x27caf3));return _0x1c9e92;});}return _0x1c9e92;});}return _0x1c9e92;}})[_0x2995('0x11')](respondWithResult(_0x2e52cd,0xc9))[_0x2995('0x42')](handleError(_0x2e52cd,null));};exports[_0x2995('0x5c')]=function(_0x194d37,_0x315452){var _0x464fe3={'agent':{},'channel':_0x2995('0x5d')};if(_0x194d37['body']['id']){delete _0x194d37[_0x2995('0x45')]['id'];}_0x194d37[_0x2995('0x45')][_0x2995('0x5e')]=!![];_0x194d37[_0x2995('0x45')][_0x2995('0x5f')]=moment()[_0x2995('0x5a')](_0x2995('0x5b'));_0x194d37[_0x2995('0x45')][_0x2995('0x60')]=_0x194d37[_0x2995('0x45')][_0x2995('0x60')]||_0x194d37[_0x2995('0x61')]['id'];_0x464fe3['agent']['id']=_0x194d37[_0x2995('0x45')][_0x2995('0x60')];return db[_0x2995('0x28')][_0x2995('0x44')]({'where':{'id':_0x194d37[_0x2995('0x46')]['id'],'UserId':null}})[_0x2995('0x11')](handleEntityNotFound(_0x315452,null))[_0x2995('0x11')](saveUpdates(_0x194d37['body'],null))[_0x2995('0x11')](function(_0x1d314f){if(_0x1d314f){_0x464fe3['message']=_0x1d314f['get']({'plain':!![]});return db['MailInteraction'][_0x2995('0x44')]({'where':{'id':_0x1d314f[_0x2995('0x62')]}});}return null;})[_0x2995('0x11')](handleEntityNotFound(_0x315452,null))[_0x2995('0x11')](function(_0x580423){if(_0x580423){return _0x580423[_0x2995('0x1f')]({'UserId':_0x194d37[_0x2995('0x45')][_0x2995('0x60')],'read1stAt':_[_0x2995('0x63')](_0x580423[_0x2995('0x64')])?moment()[_0x2995('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2995('0x11')](function(_0x2d3897){if(_0x2d3897){_0x464fe3[_0x2995('0x65')]=_0x2d3897[_0x2995('0x66')]({'plain':!![]});interaction_log[_0x2995('0x18')](_0x2995('0x67'),_0x194d37[_0x2995('0x61')]['id'],_0x194d37[_0x2995('0x61')][_0x2995('0x25')],_0x194d37['user']['role'],_0x464fe3[_0x2995('0x65')]['id'],_0x194d37[_0x2995('0x45')]?JSON[_0x2995('0x15')](_0x194d37[_0x2995('0x45')]):_0x2995('0x68'));return respondWithRpcPromise(_0x2995('0x69'),_0x2995('0x6a'),_0x464fe3);}return null;})[_0x2995('0x11')](function(_0x31eb9c){var _0x941b25=_0x2995('0x6b')+_0x31eb9c['message'][_0x2995('0x6c')];return db[_0x2995('0x6d')][_0x2995('0x2c')](_0x941b25,{'type':db[_0x2995('0x6e')]['QueryTypes'][_0x2995('0x6f')],'raw':!![]})[_0x2995('0x11')](function(_0x5ee6a5){return _0x5ee6a5;});})[_0x2995('0x11')](function(_0x1eb941){if(_0x1eb941){_0x464fe3[_0x2995('0x17')]['contact']=_0x1eb941[0x0];if(!_0x194d37[_0x2995('0x45')][_0x2995('0x60')])return;return db['User'][_0x2995('0x44')]({'where':{'id':_0x194d37['body']['UserId'],'role':_0x2995('0x70')},'attributes':['id',_0x2995('0x25'),_0x2995('0x71'),'email','internal'],'raw':!![]});}return null;})[_0x2995('0x11')](function(_0x2359a3){if(!_0x2359a3)return null;_0x464fe3[_0x2995('0x17')][_0x2995('0x70')]=_0x2359a3;return _0x464fe3;})[_0x2995('0x11')](function(_0x5933cf){if(_0x5933cf){if(_0x194d37[_0x2995('0x45')]['manual']){_0x464fe3[_0x2995('0x17')][_0x2995('0x72')]=util[_0x2995('0x5a')]('SIP/%s',_0x194d37[_0x2995('0x61')][_0x2995('0x25')]);_0x464fe3[_0x2995('0x17')]['channel']=_0x464fe3[_0x2995('0x73')];_0x464fe3['message']['motionChannel']=_0x464fe3['channel'];_0x464fe3[_0x2995('0x17')]['event']=_0x2995('0x5c');_0x464fe3[_0x2995('0x17')][_0x2995('0x45')]=htmlToText[_0x2995('0x74')](_0x464fe3['message'][_0x2995('0x45')]);return respondWithRpcPromise(_0x2995('0x75'),_0x2995('0x75'),{'event':_0x2995('0x76'),'message':_0x464fe3[_0x2995('0x17')]},client9002)[_0x2995('0x11')](function(){return _0x464fe3;});}return _0x464fe3;}return null;})[_0x2995('0x11')](respondWithResult(_0x315452,null))[_0x2995('0x42')](handleError(_0x315452,null));};exports[_0x2995('0x77')]=function(_0x40bcff,_0xb92b24){var _0x1cee02={'agent':{},'channel':_0x2995('0x5d')};if(_0x40bcff['body']['id']){delete _0x40bcff['body']['id'];}_0x40bcff[_0x2995('0x45')]['UserId']=_0x40bcff[_0x2995('0x45')]['UserId']||_0x40bcff[_0x2995('0x61')]['id'];_0x1cee02[_0x2995('0x70')]['id']=_0x40bcff['body']['UserId'];return db[_0x2995('0x28')][_0x2995('0x44')]({'where':{'id':_0x40bcff[_0x2995('0x46')]['id'],'UserId':null}})[_0x2995('0x11')](handleEntityNotFound(_0xb92b24,null))['then'](function(_0x1e50c9){if(_0x1e50c9){_0x1cee02[_0x2995('0x17')]=_0x1e50c9[_0x2995('0x66')]({'plain':!![]});return db[_0x2995('0x78')][_0x2995('0x44')]({'where':{'id':_0x1e50c9[_0x2995('0x62')]}});}return null;})['then'](handleEntityNotFound(_0xb92b24,null))[_0x2995('0x11')](function(_0x16cfbc){if(_0x16cfbc){_0x1cee02[_0x2995('0x65')]=_0x16cfbc[_0x2995('0x66')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40bcff['user']['id'],_0x40bcff['user']['name'],_0x40bcff[_0x2995('0x61')][_0x2995('0x79')],_0x1cee02[_0x2995('0x65')]['id'],_0x40bcff[_0x2995('0x45')]?JSON[_0x2995('0x15')](_0x40bcff['body']):_0x2995('0x68'));return respondWithRpcPromise(_0x2995('0x7a'),_0x2995('0x7b'),_0x1cee02);}return null;})['then'](function(_0x6e53fd){var _0x10826a=_0x2995('0x6b')+_0x6e53fd[_0x2995('0x17')]['ContactId'];return db[_0x2995('0x6d')][_0x2995('0x2c')](_0x10826a,{'type':db[_0x2995('0x6e')][_0x2995('0x7c')][_0x2995('0x6f')],'raw':!![]})[_0x2995('0x11')](function(_0x5bd6f3){return _0x5bd6f3;});})[_0x2995('0x11')](function(_0x537f18){if(_0x537f18){_0x1cee02[_0x2995('0x17')][_0x2995('0x7d')]=_0x537f18[0x0];if(!_0x40bcff[_0x2995('0x45')][_0x2995('0x60')])return;return db[_0x2995('0x7e')][_0x2995('0x44')]({'where':{'id':_0x40bcff['body'][_0x2995('0x60')],'role':_0x2995('0x70')},'attributes':['id','name',_0x2995('0x71'),_0x2995('0x7f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4becf0){if(!_0x4becf0)return null;_0x1cee02[_0x2995('0x17')][_0x2995('0x70')]=_0x4becf0;return _0x1cee02;})['then'](function(_0x21c7f1){if(_0x21c7f1){_0x21c7f1[_0x2995('0x17')]['interface']=util['format']('SIP/%s',_0x40bcff[_0x2995('0x61')][_0x2995('0x25')]);_0x21c7f1['message']['channel']=_0x1cee02[_0x2995('0x73')];_0x21c7f1[_0x2995('0x17')][_0x2995('0x80')]=_0x1cee02['channel'];_0x21c7f1['message'][_0x2995('0x81')]=_0x2995('0x77');_0x21c7f1[_0x2995('0x17')][_0x2995('0x45')]=htmlToText[_0x2995('0x74')](_0x1cee02[_0x2995('0x17')][_0x2995('0x45')]);respondWithRpcPromise(_0x2995('0x75'),_0x2995('0x75'),{'event':_0x2995('0x82'),'message':_0x21c7f1[_0x2995('0x17')]},client9002);return _0x1cee02;}return null;})['then'](respondWithResult(_0xb92b24,null))[_0x2995('0x42')](handleError(_0xb92b24,null));};exports[_0x2995('0x83')]=function(_0x35db72,_0x373ef8){var _0x50491b=moment()[_0x2995('0x84')]()[_0x2995('0x85')]();var _0x568772=path[_0x2995('0x86')](config[_0x2995('0x55')],_0x2995('0x87'),_0x2995('0x88'),_0x2995('0x89'));var _0x2d9bfa=path[_0x2995('0x86')](config[_0x2995('0x55')],_0x2995('0x87'),_0x2995('0x88'),_0x2995('0x54'));var _0x587555=util[_0x2995('0x5a')](_0x2995('0x8a'),_0x50491b);return db['MailMessage'][_0x2995('0x44')]({'where':{'id':_0x35db72[_0x2995('0x46')]['id']},'attributes':['id','body','from','to','cc',_0x2995('0x8b'),_0x2995('0x8c'),_0x2995('0x8d')],'include':_0x35db72[_0x2995('0x2c')]['attachments']?[{'model':db[_0x2995('0x8e')],'as':_0x2995('0x8f')}]:undefined})[_0x2995('0x11')](handleEntityNotFound(_0x373ef8,null))[_0x2995('0x11')](function(_0xc345bc){if(_0xc345bc){var _0x20095c=_0xc345bc;var _0x5ace38={'from':_0x20095c[_0x2995('0x90')],'to':_0x20095c['to'],'subject':_0x20095c[_0x2995('0x8c')],'html':htmlEntities['decode'](_0x20095c[_0x2995('0x45')]),'headers':{'Date':moment(_0x20095c['createdAt'])[_0x2995('0x5a')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xc345bc['cc']){_0x5ace38[_0x2995('0x91')]['Cc']=_0xc345bc['cc'];}if(_0xc345bc[_0x2995('0x8b')]){_0x5ace38[_0x2995('0x91')]['Bcc']=_0xc345bc[_0x2995('0x8b')];}return new BPromise(function(_0x355885,_0x220be6){if(_0xc345bc[_0x2995('0x8f')]){for(var _0x537a23=0x0;_0x537a23<_0xc345bc[_0x2995('0x8f')]['length'];_0x537a23++){var _0x21a756=_0xc345bc['Attachments'][_0x537a23];var _0x5c644c=path[_0x2995('0x86')](_0x2d9bfa,_0x21a756[_0x2995('0x92')]);if(fs[_0x2995('0x93')](_0x5c644c)){_0x5ace38[_0x2995('0x54')]['push']({'name':_0x21a756[_0x2995('0x25')],'contentType':_0x21a756[_0x2995('0x2a')],'data':fs['readFileSync'](_0x5c644c)});}}}emlformat['build'](_0x5ace38,function(_0x50a39e,_0x123bcd){if(_0x50a39e)return _0x220be6(_0x50a39e);fs[_0x2995('0x94')](path[_0x2995('0x86')](_0x568772,_0x587555),_0x123bcd);return _0x355885(_0x123bcd);});});}})['then'](function(_0x505a00){if(_0x505a00){return _0x373ef8[_0x2995('0x83')](path[_0x2995('0x86')](_0x568772,_0x587555),_0x587555,function(_0x1c54b3){if(!_0x1c54b3)fs[_0x2995('0x95')](path[_0x2995('0x86')](_0x568772,_0x587555));});}})['catch'](handleError(_0x373ef8,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index bdab355..fb1dfe1 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 _0xab6e=['MailMessage','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0xab6e,0x1c9));var _0xeab6=function(_0x5be8cc,_0x4a6037){_0x5be8cc=_0x5be8cc-0x0;var _0x5f1b7e=_0xab6e[_0x5be8cc];return _0x5f1b7e;};'use strict';var EventEmitter=require(_0xeab6('0x0'));var MailMessage=require(_0xeab6('0x1'))['db'][_0xeab6('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xeab6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeab6('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa2b493){return function(_0x348e73,_0x13af96,_0x4f552d){MailMessageEvents[_0xeab6('0x5')](_0xa2b493+':'+_0x348e73['id'],_0x348e73);MailMessageEvents[_0xeab6('0x5')](_0xa2b493,_0x348e73);_0x4f552d(null);};}for(var e in events){if(events[_0xeab6('0x6')](e)){var event=events[e];MailMessage[_0xeab6('0x7')](e,emitEvent(event));}}module[_0xeab6('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x3fff=['../../mysqldb','MailMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0x3fff,0x12f));var _0xf3ff=function(_0x56f1c4,_0x37fe7f){_0x56f1c4=_0x56f1c4-0x0;var _0xa30a8f=_0x3fff[_0x56f1c4];return _0xa30a8f;};'use strict';var EventEmitter=require(_0xf3ff('0x0'));var MailMessage=require(_0xf3ff('0x1'))['db'][_0xf3ff('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf3ff('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf3ff('0x4')};function emitEvent(_0x2c7cde){return function(_0x48e85a,_0x4743a1,_0x40f656){MailMessageEvents[_0xf3ff('0x5')](_0x2c7cde+':'+_0x48e85a['id'],_0x48e85a);MailMessageEvents[_0xf3ff('0x5')](_0x2c7cde,_0x48e85a);_0x40f656(null);};}for(var e in events){if(events[_0xf3ff('0x6')](e)){var event=events[e];MailMessage[_0xf3ff('0x7')](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 e424fb1..785b461 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 _0xc709=['models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','util','api','request-promise','path','rimraf','../../config/environment','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body'];(function(_0x1d5b3d,_0x5c7145){var _0xc810b9=function(_0x2b11fa){while(--_0x2b11fa){_0x1d5b3d['push'](_0x1d5b3d['shift']());}};_0xc810b9(++_0x5c7145);}(_0xc709,0x14e));var _0x9c70=function(_0x56a061,_0x53fb1b){_0x56a061=_0x56a061-0x0;var _0x105fa0=_0xc709[_0x56a061];return _0x105fa0;};'use strict';var _=require('lodash');var util=require(_0x9c70('0x0'));var logger=require('../../config/logger')(_0x9c70('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c70('0x2'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x9c70('0x3'));var rimraf=require(_0x9c70('0x4'));var config=require(_0x9c70('0x5'));var attributes=require('./mailMessage.attributes');module[_0x9c70('0x6')]=function(_0x195d2d,_0x4c9761){return _0x195d2d['define'](_0x9c70('0x7'),attributes,{'tableName':_0x9c70('0x8'),'paranoid':![],'indexes':[{'name':_0x9c70('0x9'),'fields':['messageId']},{'name':_0x9c70('0xa'),'fields':[_0x9c70('0xb'),'subject'],'type':_0x9c70('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3d73a8,_0x1f2c40,_0x2ca85d){if(_0x3d73a8[_0x9c70('0xd')]){_0x3d73a8['plainBody']=htmlToText['fromString'](_0x3d73a8[_0x9c70('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2ca85d(null,_0x1f2c40);},'afterCreate':function(_0x1c416b,_0x595374,_0x5a81c9){var _0x2c19d5=_0x195d2d[_0x9c70('0xe')];var _0x45a95b=_0x1c416b[_0x9c70('0xf')]({'plain':!![]});if(_0x45a95b['direction']['toLowerCase']()==='in'||_0x45a95b[_0x9c70('0x10')][_0x9c70('0x11')]()===_0x9c70('0x12')&&!_0x45a95b[_0x9c70('0x13')]&&!_['isNil'](_0x45a95b[_0x9c70('0x14')])){_0x2c19d5[_0x9c70('0x15')][_0x9c70('0x16')]({'where':{'id':_0x45a95b['MailInteractionId']}})[_0x9c70('0x17')](function(_0x13ce8e){if(_0x13ce8e){_0x13ce8e[_0x9c70('0x18')]({'lastMsgAt':_0x45a95b[_0x9c70('0x19')],'lastMsgDirection':_0x45a95b[_0x9c70('0x10')][_0x9c70('0x11')]()});}})[_0x9c70('0x1a')](function(_0x56813d){console[_0x9c70('0x1b')](_0x56813d);});}_0x5a81c9();}},'charset':_0x9c70('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd406=['then','update','createdAt','error','utf8mb4','lodash','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId'];(function(_0x60e31a,_0xba6b64){var _0x3fb723=function(_0x374ff8){while(--_0x374ff8){_0x60e31a['push'](_0x60e31a['shift']());}};_0x3fb723(++_0xba6b64);}(_0xd406,0xfa));var _0x6d40=function(_0x3c124e,_0x402324){_0x3c124e=_0x3c124e-0x0;var _0x1b65cf=_0xd406[_0x3c124e];return _0x1b65cf;};'use strict';var _=require(_0x6d40('0x0'));var util=require('util');var logger=require(_0x6d40('0x1'))(_0x6d40('0x2'));var moment=require(_0x6d40('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d40('0x4'));var htmlToText=require(_0x6d40('0x5'));var fs=require('fs');var path=require(_0x6d40('0x6'));var rimraf=require(_0x6d40('0x7'));var config=require(_0x6d40('0x8'));var attributes=require('./mailMessage.attributes');module[_0x6d40('0x9')]=function(_0xa5cc71,_0x2c779d){return _0xa5cc71[_0x6d40('0xa')](_0x6d40('0xb'),attributes,{'tableName':_0x6d40('0xc'),'paranoid':![],'indexes':[{'name':_0x6d40('0xd'),'fields':[_0x6d40('0xd')]},{'name':'fti_mail_messages','fields':[_0x6d40('0xe'),_0x6d40('0xf')],'type':_0x6d40('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x30e941,_0x32fd66,_0x1f7022){if(_0x30e941[_0x6d40('0x11')]){_0x30e941['plainBody']=htmlToText[_0x6d40('0x12')](_0x30e941[_0x6d40('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1f7022(null,_0x32fd66);},'afterCreate':function(_0xd5e611,_0x5a0d5e,_0x49e2e9){var _0x7e6ebc=_0xa5cc71[_0x6d40('0x13')];var _0x36b4b4=_0xd5e611[_0x6d40('0x14')]({'plain':!![]});if(_0x36b4b4[_0x6d40('0x15')][_0x6d40('0x16')]()==='in'||_0x36b4b4[_0x6d40('0x15')]['toLowerCase']()===_0x6d40('0x17')&&!_0x36b4b4[_0x6d40('0x18')]&&!_[_0x6d40('0x19')](_0x36b4b4[_0x6d40('0x1a')])){_0x7e6ebc[_0x6d40('0x1b')][_0x6d40('0x1c')]({'where':{'id':_0x36b4b4[_0x6d40('0x1d')]}})[_0x6d40('0x1e')](function(_0x4f2c0a){if(_0x4f2c0a){_0x4f2c0a[_0x6d40('0x1f')]({'lastMsgAt':_0x36b4b4[_0x6d40('0x20')],'lastMsgDirection':_0x36b4b4['direction']['toLowerCase']()});}})['catch'](function(_0x407c8c){console[_0x6d40('0x21')](_0x407c8c);});}_0x49e2e9();}},'charset':_0x6d40('0x22'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index a73fee0..7ca978b 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 _0x32b6=['raw','CreateMailMessage','stringify','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body','options'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x32b6,0x1d1));var _0x632b=function(_0x4bc49b,_0x16bbfb){_0x4bc49b=_0x4bc49b-0x0;var _0x16958f=_0x32b6[_0x4bc49b];return _0x16958f;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});config[_0x632b('0xb')]=_[_0x632b('0xc')](config[_0x632b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x632b('0xd'))(new Redis(config[_0x632b('0xb')]));require(_0x632b('0xe'))[_0x632b('0xf')](socket);function respondWithRpcPromise(_0x4961b1,_0x5904e8,_0x56e7b6){return new BPromise(function(_0x3ce569,_0x484b3a){return client[_0x632b('0x10')](_0x4961b1,_0x56e7b6)[_0x632b('0x11')](function(_0x2eca51){logger[_0x632b('0x12')](_0x632b('0x13'),_0x5904e8,_0x632b('0x14'));logger[_0x632b('0x15')](_0x632b('0x16'),_0x5904e8,_0x632b('0x14'),JSON['stringify'](_0x2eca51));if(_0x2eca51[_0x632b('0x17')]){if(_0x2eca51[_0x632b('0x17')][_0x632b('0x18')]===0x1f4){logger['error'](_0x632b('0x13'),_0x5904e8,_0x2eca51[_0x632b('0x17')][_0x632b('0x19')]);return _0x484b3a(_0x2eca51[_0x632b('0x17')][_0x632b('0x19')]);}logger[_0x632b('0x17')]('MailMessage,\x20%s,\x20%s',_0x5904e8,_0x2eca51[_0x632b('0x17')]['message']);return _0x3ce569(_0x2eca51['error'][_0x632b('0x19')]);}else{logger['info'](_0x632b('0x13'),_0x5904e8,_0x632b('0x14'));_0x3ce569(_0x2eca51[_0x632b('0x1a')]['message']);}})[_0x632b('0x1b')](function(_0x32ca1){logger[_0x632b('0x17')](_0x632b('0x13'),_0x5904e8,_0x32ca1);_0x484b3a(_0x32ca1);});});}exports['CreateMailMessage']=function(_0x472e34){var _0xd9d29f=this;return new Promise(function(_0x4f377f,_0x116f62){return db['MailMessage']['create'](_0x472e34[_0x632b('0x1c')],{'raw':_0x472e34['options']?_0x472e34[_0x632b('0x1d')][_0x632b('0x1e')]===undefined?!![]:![]:!![]})[_0x632b('0x11')](function(_0x540bfb){logger[_0x632b('0x12')](_0x632b('0x1f'),_0x472e34);logger['debug'](_0x632b('0x1f'),_0x472e34,JSON[_0x632b('0x20')](_0x540bfb));_0x4f377f(_0x540bfb);})[_0x632b('0x1b')](function(_0x1e448c){logger[_0x632b('0x17')](_0x632b('0x1f'),_0x1e448c['message'],_0x472e34);_0x116f62(_0xd9d29f['error'](0x1f4,_0x1e448c[_0x632b('0x19')]));});});}; \ No newline at end of file +var _0x0598=['CreateMailMessage','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','MailMessage','create','body','raw'];(function(_0x32874f,_0x2b45c6){var _0x5a89c6=function(_0xce908){while(--_0xce908){_0x32874f['push'](_0x32874f['shift']());}};_0x5a89c6(++_0x2b45c6);}(_0x0598,0x92));var _0x8059=function(_0x5dacbd,_0x26eab4){_0x5dacbd=_0x5dacbd-0x0;var _0x6db1=_0x0598[_0x5dacbd];return _0x6db1;};'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});config['redis']=_[_0x8059('0x7')](config[_0x8059('0x8')],{'host':_0x8059('0x9'),'port':0x18eb});var socket=require(_0x8059('0xa'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x8059('0xb')](socket);function respondWithRpcPromise(_0x1bf5fd,_0x336f85,_0x5097d6){return new BPromise(function(_0x283b63,_0x52a60d){return client['request'](_0x1bf5fd,_0x5097d6)[_0x8059('0xc')](function(_0x4109a9){logger['info']('MailMessage,\x20%s,\x20%s',_0x336f85,'request\x20sent');logger[_0x8059('0xd')](_0x8059('0xe'),_0x336f85,_0x8059('0xf'),JSON[_0x8059('0x10')](_0x4109a9));if(_0x4109a9[_0x8059('0x11')]){if(_0x4109a9['error'][_0x8059('0x12')]===0x1f4){logger['error'](_0x8059('0x13'),_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x52a60d(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x283b63(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}else{logger[_0x8059('0x15')](_0x8059('0x13'),_0x336f85,'request\x20sent');_0x283b63(_0x4109a9[_0x8059('0x16')][_0x8059('0x14')]);}})[_0x8059('0x17')](function(_0x1c4566){logger['error'](_0x8059('0x13'),_0x336f85,_0x1c4566);_0x52a60d(_0x1c4566);});});}exports['CreateMailMessage']=function(_0x113f42){var _0x493825=this;return new Promise(function(_0x1857c1,_0x56d794){return db[_0x8059('0x18')][_0x8059('0x19')](_0x113f42[_0x8059('0x1a')],{'raw':_0x113f42['options']?_0x113f42['options'][_0x8059('0x1b')]===undefined?!![]:![]:!![]})[_0x8059('0xc')](function(_0x32aeda){logger[_0x8059('0x15')]('CreateMailMessage',_0x113f42);logger[_0x8059('0xd')](_0x8059('0x1c'),_0x113f42,JSON[_0x8059('0x10')](_0x32aeda));_0x1857c1(_0x32aeda);})['catch'](function(_0xe9a72d){logger[_0x8059('0x11')](_0x8059('0x1c'),_0xe9a72d[_0x8059('0x14')],_0x113f42);_0x56d794(_0x493825['error'](0x1f4,_0xe9a72d[_0x8059('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 328ed39..4c4a22b 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 _0x43e4=['removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','update','emit'];(function(_0x4905a0,_0x22dbe6){var _0x3e6f4d=function(_0x535a9a){while(--_0x535a9a){_0x4905a0['push'](_0x4905a0['shift']());}};_0x3e6f4d(++_0x22dbe6);}(_0x43e4,0x15a));var _0x443e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x43e4[_0xefd519];return _0x4bb882;};'use strict';var MailMessageEvents=require(_0x443e('0x0'));var events=[_0x443e('0x1'),_0x443e('0x2'),_0x443e('0x3')];function createListener(_0x46da93,_0x145802){return function(_0x402d83){_0x145802[_0x443e('0x4')](_0x46da93,_0x402d83);};}function removeListener(_0x3a57a2,_0x3254d1){return function(){MailMessageEvents[_0x443e('0x5')](_0x3a57a2,_0x3254d1);};}exports[_0x443e('0x6')]=function(_0x313717){for(var _0x580355=0x0,_0x1d942e=events[_0x443e('0x7')];_0x580355<_0x1d942e;_0x580355++){var _0x23780a=events[_0x580355];var _0x50fa75=createListener(_0x443e('0x8')+_0x23780a,_0x313717);MailMessageEvents['on'](_0x23780a,_0x50fa75);}}; \ No newline at end of file +var _0x9634=['update','register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x338710,_0x531e2f){var _0x7b8c89=function(_0x252783){while(--_0x252783){_0x338710['push'](_0x338710['shift']());}};_0x7b8c89(++_0x531e2f);}(_0x9634,0x146));var _0x4963=function(_0x153492,_0x3ab5d2){_0x153492=_0x153492-0x0;var _0x3583fa=_0x9634[_0x153492];return _0x3583fa;};'use strict';var MailMessageEvents=require(_0x4963('0x0'));var events=[_0x4963('0x1'),_0x4963('0x2'),_0x4963('0x3')];function createListener(_0x4d5149,_0x1ca595){return function(_0x339c90){_0x1ca595['emit'](_0x4d5149,_0x339c90);};}function removeListener(_0x321bb5,_0x4b0b01){return function(){MailMessageEvents['removeListener'](_0x321bb5,_0x4b0b01);};}exports[_0x4963('0x4')]=function(_0x58db09){for(var _0x55ba97=0x0,_0x34e06b=events[_0x4963('0x5')];_0x55ba97<_0x34e06b;_0x55ba97++){var _0xb8aaf3=events[_0x55ba97];var _0x3982ea=createListener(_0x4963('0x6')+_0xb8aaf3,_0x58db09);MailMessageEvents['on'](_0xb8aaf3,_0x3982ea);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b068dbc..d7188f1 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 _0x297c=['describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated'];(function(_0x4d17e1,_0x56081c){var _0x3f47c9=function(_0x3c8b39){while(--_0x3c8b39){_0x4d17e1['push'](_0x4d17e1['shift']());}};_0x3f47c9(++_0x56081c);}(_0x297c,0xb2));var _0xc297=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x297c[_0x34021d];return _0x16597b;};'use strict';var multer=require('multer');var util=require(_0xc297('0x0'));var path=require(_0xc297('0x1'));var timeout=require('connect-timeout');var express=require(_0xc297('0x2'));var router=express[_0xc297('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc297('0x4'));var config=require(_0xc297('0x5'));var controller=require(_0xc297('0x6'));router[_0xc297('0x7')]('/',auth['isAuthenticated'](),controller[_0xc297('0x8')]);router[_0xc297('0x7')](_0xc297('0x9'),auth[_0xc297('0xa')](),controller[_0xc297('0xb')]);router['get'](_0xc297('0xc'),auth[_0xc297('0xa')](),controller['show']);router[_0xc297('0x7')](_0xc297('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0xc297('0x7')](_0xc297('0xe'),auth['isAuthenticated'](),controller[_0xc297('0xf')]);router[_0xc297('0x7')](_0xc297('0x10'),auth['isAuthenticated'](),controller[_0xc297('0x11')]);router['post']('/',auth[_0xc297('0xa')](),controller[_0xc297('0x12')]);router[_0xc297('0x13')](_0xc297('0xe'),auth['isAuthenticated'](),controller[_0xc297('0x14')]);router[_0xc297('0x13')]('/:id/users',auth[_0xc297('0xa')](),controller['addAgents']);router[_0xc297('0x15')](_0xc297('0xc'),auth[_0xc297('0xa')](),controller['update']);router[_0xc297('0x16')](_0xc297('0xc'),auth[_0xc297('0xa')](),controller[_0xc297('0x17')]);router[_0xc297('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc297('0x18')]);router['delete'](_0xc297('0x10'),auth['isAuthenticated'](),controller[_0xc297('0x19')]);module[_0xc297('0x1a')]=router; \ No newline at end of file +var _0x1abd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','create','post','/:id/users','addAgents','update','delete','destroy','removeAgents','exports'];(function(_0x3c978d,_0x139dd8){var _0xd91bda=function(_0x1b149e){while(--_0x1b149e){_0x3c978d['push'](_0x3c978d['shift']());}};_0xd91bda(++_0x139dd8);}(_0x1abd,0x1cb));var _0xd1ab=function(_0x13cd99,_0x50bd8d){_0x13cd99=_0x13cd99-0x0;var _0x1d42c7=_0x1abd[_0x13cd99];return _0x1d42c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd1ab('0x0'));var timeout=require(_0xd1ab('0x1'));var express=require(_0xd1ab('0x2'));var router=express[_0xd1ab('0x3')]();var fs_extra=require(_0xd1ab('0x4'));var auth=require(_0xd1ab('0x5'));var interaction=require(_0xd1ab('0x6'));var config=require(_0xd1ab('0x7'));var controller=require('./mailQueue.controller');router[_0xd1ab('0x8')]('/',auth[_0xd1ab('0x9')](),controller['index']);router[_0xd1ab('0x8')](_0xd1ab('0xa'),auth[_0xd1ab('0x9')](),controller[_0xd1ab('0xb')]);router[_0xd1ab('0x8')](_0xd1ab('0xc'),auth[_0xd1ab('0x9')](),controller[_0xd1ab('0xd')]);router[_0xd1ab('0x8')](_0xd1ab('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xd1ab('0x8')](_0xd1ab('0xf'),auth[_0xd1ab('0x9')](),controller[_0xd1ab('0x10')]);router[_0xd1ab('0x8')]('/:id/users',auth[_0xd1ab('0x9')](),controller[_0xd1ab('0x11')]);router['post']('/',auth[_0xd1ab('0x9')](),controller[_0xd1ab('0x12')]);router[_0xd1ab('0x13')]('/:id/teams',auth[_0xd1ab('0x9')](),controller['addTeams']);router[_0xd1ab('0x13')](_0xd1ab('0x14'),auth[_0xd1ab('0x9')](),controller[_0xd1ab('0x15')]);router['put'](_0xd1ab('0xc'),auth[_0xd1ab('0x9')](),controller[_0xd1ab('0x16')]);router[_0xd1ab('0x17')](_0xd1ab('0xc'),auth[_0xd1ab('0x9')](),controller[_0xd1ab('0x18')]);router[_0xd1ab('0x17')](_0xd1ab('0xf'),auth[_0xd1ab('0x9')](),controller['removeTeams']);router[_0xd1ab('0x17')](_0xd1ab('0x14'),auth[_0xd1ab('0x9')](),controller[_0xd1ab('0x19')]);module[_0xd1ab('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9330266..e845a6d 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 _0x456f=['ENUM','beepall','roundrobin','exports','name','INTEGER'];(function(_0x17c451,_0x3a146a){var _0x5d4f73=function(_0x3ea285){while(--_0x3ea285){_0x17c451['push'](_0x17c451['shift']());}};_0x5d4f73(++_0x3a146a);}(_0x456f,0x1ad));var _0xf456=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x456f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf456('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf456('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf456('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf456('0x3')]('rrmemory',_0xf456('0x4'),_0xf456('0x5'))}}; \ No newline at end of file +var _0x1692=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x3082ae,_0x504deb){var _0x4d42fc=function(_0x57853f){while(--_0x57853f){_0x3082ae['push'](_0x3082ae['shift']());}};_0x4d42fc(++_0x504deb);}(_0x1692,0x195));var _0x2169=function(_0x4cda43,_0x3d28fc){_0x4cda43=_0x4cda43-0x0;var _0x21bbb1=_0x1692[_0x4cda43];return _0x21bbb1;};'use strict';var Sequelize=require(_0x2169('0x0'));module['exports']={'name':{'type':Sequelize[_0x2169('0x1')],'unique':_0x2169('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2169('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2169('0x3')](_0x2169('0x4'),_0x2169('0x5'),_0x2169('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 60ba708..d8aed85 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 _0xb458=['role','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','nolimit','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','User','Agents','online','voicePause','interface','sequelize','each','UserMailQueue','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','update','then','get','stack','name','send','index','map','MailQueue','rawAttributes','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x39157f,_0x3d8c1e){var _0x1ae4e2=function(_0x3429af){while(--_0x3429af){_0x39157f['push'](_0x39157f['shift']());}};_0x1ae4e2(++_0x3d8c1e);}(_0xb458,0xca));var _0x8b45=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0xb458[_0x44606e];return _0xe68388;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require(_0x8b45('0x3'));var rp=require('request-promise');var moment=require(_0x8b45('0x4'));var BPromise=require(_0x8b45('0x5'));var Mustache=require(_0x8b45('0x6'));var util=require(_0x8b45('0x7'));var path=require(_0x8b45('0x8'));var sox=require(_0x8b45('0x9'));var csv=require(_0x8b45('0xa'));var ejs=require(_0x8b45('0xb'));var fs=require('fs');var fs_extra=require(_0x8b45('0xc'));var _=require(_0x8b45('0xd'));var squel=require(_0x8b45('0xe'));var crypto=require(_0x8b45('0xf'));var jsforce=require(_0x8b45('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b45('0x11'));var authService=require(_0x8b45('0x12'));var qs=require(_0x8b45('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b45('0x14'));var logger=require('../../config/logger')(_0x8b45('0x15'));var utils=require(_0x8b45('0x16'));var config=require(_0x8b45('0x17'));var licenseUtil=require(_0x8b45('0x18'));var db=require(_0x8b45('0x19'))['db'];config['redis']=_['defaults'](config[_0x8b45('0x1a')],{'host':_0x8b45('0x1b'),'port':0x18eb});var socket=require(_0x8b45('0x1c'))(new Redis(config[_0x8b45('0x1a')]));require(_0x8b45('0x1d'))[_0x8b45('0x1e')](socket);function respondWithStatusCode(_0x1bd228,_0x45a8cc){_0x45a8cc=_0x45a8cc||0xcc;return function(_0x2fb210){if(_0x2fb210){return _0x1bd228[_0x8b45('0x1f')](_0x45a8cc);}return _0x1bd228[_0x8b45('0x20')](_0x45a8cc)[_0x8b45('0x21')]();};}function respondWithResult(_0x29180d,_0x433010){_0x433010=_0x433010||0xc8;return function(_0x3ce169){if(_0x3ce169){return _0x29180d['status'](_0x433010)['json'](_0x3ce169);}};}function respondWithFilteredResult(_0x777072,_0x110e76){return function(_0xfb84af){if(_0xfb84af){var _0x3a832e=typeof _0x110e76[_0x8b45('0x22')]==='undefined'&&typeof _0x110e76[_0x8b45('0x23')]==='undefined';var _0x219c94=_0xfb84af['count'];var _0x17abe6=_0x3a832e?0x0:_0x110e76[_0x8b45('0x22')];var _0x3dfe62=_0x3a832e?_0xfb84af['count']:_0x110e76[_0x8b45('0x22')]+_0x110e76[_0x8b45('0x23')];var _0x48f46a;if(_0x3dfe62>=_0x219c94){_0x3dfe62=_0x219c94;_0x48f46a=0xc8;}else{_0x48f46a=0xce;}_0x777072[_0x8b45('0x20')](_0x48f46a);return _0x777072[_0x8b45('0x24')](_0x8b45('0x25'),_0x17abe6+'-'+_0x3dfe62+'/'+_0x219c94)['json'](_0xfb84af);}return null;};}function patchUpdates(_0xc125c4){return function(_0x3bb575){try{jsonpatch[_0x8b45('0x26')](_0x3bb575,_0xc125c4,!![]);}catch(_0x557f5b){return BPromise[_0x8b45('0x27')](_0x557f5b);}return _0x3bb575['save']();};}function saveUpdates(_0x5cd08a,_0x32bfc5){return function(_0x102dcb){if(_0x102dcb){return _0x102dcb[_0x8b45('0x28')](_0x5cd08a)[_0x8b45('0x29')](function(_0x40510c){return _0x40510c;});}return null;};}function removeEntity(_0x5ce26a,_0x3dc3b8){return function(_0x120b37){if(_0x120b37){return _0x120b37['destroy']()['then'](function(){var _0x5919e2=_0x120b37[_0x8b45('0x2a')]({'plain':!![]});var _0x4160f7='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x4160f7,'resourceId':_0x5919e2['id']}})['then'](function(){return _0x120b37;});})['then'](function(){_0x5ce26a[_0x8b45('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d540,_0x275c07){return function(_0xde6b96){if(!_0xde6b96){_0x28d540[_0x8b45('0x1f')](0x194);}return _0xde6b96;};}function handleError(_0x4b95f4,_0x3308d7){_0x3308d7=_0x3308d7||0x1f4;return function(_0x556ce3){logger['error'](_0x556ce3[_0x8b45('0x2b')]);if(_0x556ce3[_0x8b45('0x2c')]){delete _0x556ce3[_0x8b45('0x2c')];}_0x4b95f4[_0x8b45('0x20')](_0x3308d7)[_0x8b45('0x2d')](_0x556ce3);};}exports[_0x8b45('0x2e')]=function(_0x375ac0,_0x5ea14f){var _0x46ec18={},_0x3cbe18={},_0x2e9a82={'count':0x0,'rows':[]};var _0x29b2f6=_[_0x8b45('0x2f')](db[_0x8b45('0x30')][_0x8b45('0x31')],function(_0xd2b907){return{'name':_0xd2b907['fieldName'],'type':_0xd2b907[_0x8b45('0x32')][_0x8b45('0x33')]};});_0x3cbe18['model']=_[_0x8b45('0x2f')](_0x29b2f6,_0x8b45('0x2c'));_0x3cbe18[_0x8b45('0x34')]=_['keys'](_0x375ac0[_0x8b45('0x34')]);_0x3cbe18[_0x8b45('0x35')]=_['intersection'](_0x3cbe18[_0x8b45('0x36')],_0x3cbe18['query']);_0x46ec18[_0x8b45('0x37')]=_['intersection'](_0x3cbe18['model'],qs['fields'](_0x375ac0[_0x8b45('0x34')][_0x8b45('0x38')]));_0x46ec18[_0x8b45('0x37')]=_0x46ec18[_0x8b45('0x37')][_0x8b45('0x39')]?_0x46ec18[_0x8b45('0x37')]:_0x3cbe18['model'];if(!_0x375ac0[_0x8b45('0x34')][_0x8b45('0x3a')]('nolimit')){_0x46ec18['limit']=qs[_0x8b45('0x23')](_0x375ac0[_0x8b45('0x34')][_0x8b45('0x23')]);_0x46ec18[_0x8b45('0x22')]=qs[_0x8b45('0x22')](_0x375ac0['query']['offset']);}_0x46ec18[_0x8b45('0x3b')]=qs['sort'](_0x375ac0[_0x8b45('0x34')][_0x8b45('0x3c')]);_0x46ec18['where']=qs[_0x8b45('0x35')](_[_0x8b45('0x3d')](_0x375ac0['query'],_0x3cbe18[_0x8b45('0x35')]),_0x29b2f6);if(_0x375ac0['query'][_0x8b45('0x3e')]){_0x46ec18['where']=_[_0x8b45('0x3f')](_0x46ec18[_0x8b45('0x40')],{'$or':_[_0x8b45('0x2f')](_0x29b2f6,function(_0x2ad48f){if(_0x2ad48f[_0x8b45('0x32')]!==_0x8b45('0x41')){var _0x1d9bc2={};_0x1d9bc2[_0x2ad48f[_0x8b45('0x2c')]]={'$like':'%'+_0x375ac0[_0x8b45('0x34')][_0x8b45('0x3e')]+'%'};return _0x1d9bc2;}})});}_0x46ec18=_[_0x8b45('0x3f')]({},_0x46ec18,_0x375ac0[_0x8b45('0x42')]);var _0x2a1b9d={'where':_0x46ec18[_0x8b45('0x40')]};return db['MailQueue'][_0x8b45('0x43')](_0x2a1b9d)[_0x8b45('0x29')](function(_0x330118){_0x2e9a82[_0x8b45('0x43')]=_0x330118;if(_0x375ac0[_0x8b45('0x34')][_0x8b45('0x44')]){_0x46ec18[_0x8b45('0x45')]=[{'all':!![]}];}return db[_0x8b45('0x30')][_0x8b45('0x46')](_0x46ec18);})[_0x8b45('0x29')](function(_0x53a5bc){_0x2e9a82[_0x8b45('0x47')]=_0x53a5bc;return _0x2e9a82;})[_0x8b45('0x29')](respondWithFilteredResult(_0x5ea14f,_0x46ec18))[_0x8b45('0x48')](handleError(_0x5ea14f,null));};exports[_0x8b45('0x49')]=function(_0x4d5390,_0x38fb3f){var _0x43da68={'raw':!![],'where':{'id':_0x4d5390[_0x8b45('0x4a')]['id']}},_0x441cdb={};_0x441cdb[_0x8b45('0x36')]=_[_0x8b45('0x4b')](db[_0x8b45('0x30')][_0x8b45('0x31')]);_0x441cdb['query']=_[_0x8b45('0x4b')](_0x4d5390[_0x8b45('0x34')]);_0x441cdb[_0x8b45('0x35')]=_[_0x8b45('0x4c')](_0x441cdb[_0x8b45('0x36')],_0x441cdb[_0x8b45('0x34')]);_0x43da68[_0x8b45('0x37')]=_[_0x8b45('0x4c')](_0x441cdb['model'],qs[_0x8b45('0x38')](_0x4d5390[_0x8b45('0x34')][_0x8b45('0x38')]));_0x43da68[_0x8b45('0x37')]=_0x43da68['attributes']['length']?_0x43da68[_0x8b45('0x37')]:_0x441cdb[_0x8b45('0x36')];if(_0x4d5390[_0x8b45('0x34')]['includeAll']){_0x43da68[_0x8b45('0x45')]=[{'all':!![]}];}_0x43da68=_[_0x8b45('0x3f')]({},_0x43da68,_0x4d5390[_0x8b45('0x42')]);return db[_0x8b45('0x30')][_0x8b45('0x4d')](_0x43da68)[_0x8b45('0x29')](handleEntityNotFound(_0x38fb3f,null))[_0x8b45('0x29')](respondWithResult(_0x38fb3f,null))['catch'](handleError(_0x38fb3f,null));};exports[_0x8b45('0x4e')]=function(_0x3f01f7,_0x46aa61){return db[_0x8b45('0x30')][_0x8b45('0x4e')](_0x3f01f7[_0x8b45('0x4f')],{})[_0x8b45('0x29')](function(_0xbbe7e2){var _0x1b57eb=_0x3f01f7[_0x8b45('0x50')][_0x8b45('0x2a')]({'plain':!![]});if(!_0x1b57eb)throw new Error(_0x8b45('0x51'));if(_0x1b57eb[_0x8b45('0x52')]===_0x8b45('0x50')){var _0x43bb73=_0xbbe7e2['get']({'plain':!![]});var _0x3d5f7b=_0x8b45('0x53');return db[_0x8b45('0x54')]['find']({'where':{'name':_0x3d5f7b,'userProfileId':_0x1b57eb[_0x8b45('0x55')]},'raw':!![]})[_0x8b45('0x29')](function(_0xfa087b){if(_0xfa087b&&_0xfa087b[_0x8b45('0x56')]===0x0){return db[_0x8b45('0x57')][_0x8b45('0x4e')]({'name':_0x43bb73['name'],'resourceId':_0x43bb73['id'],'type':_0xfa087b[_0x8b45('0x2c')],'sectionId':_0xfa087b['id']},{})['then'](function(){return _0xbbe7e2;});}else{return _0xbbe7e2;}})['catch'](function(_0x290096){logger[_0x8b45('0x58')](_0x8b45('0x59'),_0x290096);throw _0x290096;});}return _0xbbe7e2;})[_0x8b45('0x29')](respondWithResult(_0x46aa61,0xc9))['catch'](handleError(_0x46aa61,null));};exports[_0x8b45('0x28')]=function(_0x4de2a7,_0x2e423d){if(_0x4de2a7[_0x8b45('0x4f')]['id']){delete _0x4de2a7['body']['id'];}return db['MailQueue'][_0x8b45('0x4d')]({'where':{'id':_0x4de2a7['params']['id']}})['then'](handleEntityNotFound(_0x2e423d,null))[_0x8b45('0x29')](saveUpdates(_0x4de2a7[_0x8b45('0x4f')],null))[_0x8b45('0x29')](respondWithResult(_0x2e423d,null))['catch'](handleError(_0x2e423d,null));};exports[_0x8b45('0x5a')]=function(_0x5318da,_0x1bf3e9){return db[_0x8b45('0x30')][_0x8b45('0x4d')]({'where':{'id':_0x5318da[_0x8b45('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1bf3e9,null))[_0x8b45('0x29')](removeEntity(_0x1bf3e9,null))['catch'](handleError(_0x1bf3e9,null));};exports[_0x8b45('0x5b')]=function(_0x3e4354,_0x2a0186){return db[_0x8b45('0x30')][_0x8b45('0x5b')]()[_0x8b45('0x29')](respondWithResult(_0x2a0186,null))[_0x8b45('0x48')](handleError(_0x2a0186,null));};exports[_0x8b45('0x5c')]=function(_0x39f9f9,_0x1abbe3,_0x24819d){var _0x2d1e71={'raw':!![],'where':{}},_0x14e7a7={},_0x416066;return db['MailQueue']['findOne']({'where':{'id':_0x39f9f9['params']['id']}})['then'](handleEntityNotFound(_0x1abbe3,null))[_0x8b45('0x29')](function(_0x4ed0ff){if(_0x4ed0ff){_0x416066=_0x4ed0ff[_0x8b45('0x2a')]({'plain':!![]});_0x14e7a7[_0x8b45('0x36')]=_[_0x8b45('0x4b')](db['UserMailQueue'][_0x8b45('0x31')]);_0x14e7a7[_0x8b45('0x34')]=_[_0x8b45('0x4b')](_0x39f9f9[_0x8b45('0x34')]);_0x14e7a7[_0x8b45('0x35')]=_[_0x8b45('0x4c')](_0x14e7a7[_0x8b45('0x36')],_0x14e7a7[_0x8b45('0x34')]);_0x2d1e71[_0x8b45('0x37')]=_['intersection'](_0x14e7a7[_0x8b45('0x36')],qs[_0x8b45('0x38')](_0x39f9f9[_0x8b45('0x34')][_0x8b45('0x38')]));_0x2d1e71[_0x8b45('0x37')]=_0x2d1e71[_0x8b45('0x37')][_0x8b45('0x39')]?_0x2d1e71[_0x8b45('0x37')]:_0x14e7a7[_0x8b45('0x36')];if(!_0x39f9f9[_0x8b45('0x34')][_0x8b45('0x3a')](_0x8b45('0x5d'))){_0x2d1e71['limit']=qs[_0x8b45('0x23')](_0x39f9f9['query']['limit']);_0x2d1e71['offset']=qs[_0x8b45('0x22')](_0x39f9f9[_0x8b45('0x34')][_0x8b45('0x22')]);}_0x2d1e71[_0x8b45('0x3b')]=qs['sort'](_0x39f9f9[_0x8b45('0x34')][_0x8b45('0x3c')]);_0x2d1e71[_0x8b45('0x40')]=qs['filters'](_[_0x8b45('0x3d')](_0x39f9f9['query'],_0x14e7a7[_0x8b45('0x35')]));_0x2d1e71[_0x8b45('0x40')]['MailQueueId']=_0x4ed0ff['id'];if(_0x39f9f9[_0x8b45('0x34')]['filter']){_0x2d1e71[_0x8b45('0x40')]=_['merge'](_0x2d1e71['where'],{'$or':_[_0x8b45('0x2f')](_0x2d1e71['attributes'],function(_0x17887e){var _0x304a79={};_0x304a79[_0x17887e]={'$like':'%'+_0x39f9f9[_0x8b45('0x34')][_0x8b45('0x3e')]+'%'};return _0x304a79;})});}_0x2d1e71=_['merge']({},_0x2d1e71,_0x39f9f9['options']);return db['UserMailQueue'][_0x8b45('0x46')](_0x2d1e71);}})[_0x8b45('0x29')](function(_0x5a5dd0){if(_0x5a5dd0){return db['User'][_0x8b45('0x5e')]({'where':{'id':_[_0x8b45('0x2f')](_0x5a5dd0,_0x8b45('0x5f')),'role':'agent'},'attributes':['id',_0x8b45('0x2c'),_0x8b45('0x60'),_0x8b45('0x61'),_0x8b45('0x62')]});}})['then'](function(_0xd5ca84){if(_0xd5ca84){return{'count':_0xd5ca84[_0x8b45('0x43')],'rows':_[_0x8b45('0x2f')](_0xd5ca84[_0x8b45('0x47')],function(_0x4b7d94){return{'membername':_0x4b7d94['name'],'UserId':_0x4b7d94['id'],'queue_name':_0x416066[_0x8b45('0x2c')],'MailQueueId':_0x416066['id'],'interface':util[_0x8b45('0x63')](_0x8b45('0x64'),_0x8b45('0x65'),_0x4b7d94[_0x8b45('0x2c')]),'penalty':0x0,'paused':_0x4b7d94[_0x8b45('0x60')],'createdAt':_0x4b7d94[_0x8b45('0x62')],'updatedAt':_0x4b7d94[_0x8b45('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8b45('0x29')](respondWithFilteredResult(_0x1abbe3,_0x2d1e71))[_0x8b45('0x48')](handleError(_0x1abbe3,null));};exports[_0x8b45('0x66')]=function(_0x35c5f4,_0x1c6740,_0x2562c3){var _0x38ac37={};var _0x54694c={};var _0x483d89;var _0x129571;return db[_0x8b45('0x30')][_0x8b45('0x67')]({'where':{'id':_0x35c5f4[_0x8b45('0x4a')]['id']}})[_0x8b45('0x29')](handleEntityNotFound(_0x1c6740,null))[_0x8b45('0x29')](function(_0x3fb5cf){if(_0x3fb5cf){_0x483d89=_0x3fb5cf;_0x54694c[_0x8b45('0x36')]=_[_0x8b45('0x4b')](db[_0x8b45('0x68')][_0x8b45('0x31')]);_0x54694c[_0x8b45('0x34')]=_[_0x8b45('0x4b')](_0x35c5f4[_0x8b45('0x34')]);_0x54694c[_0x8b45('0x35')]=_[_0x8b45('0x4c')](_0x54694c[_0x8b45('0x36')],_0x54694c[_0x8b45('0x34')]);_0x38ac37[_0x8b45('0x37')]=_[_0x8b45('0x4c')](_0x54694c['model'],qs[_0x8b45('0x38')](_0x35c5f4[_0x8b45('0x34')][_0x8b45('0x38')]));_0x38ac37[_0x8b45('0x37')]=_0x38ac37[_0x8b45('0x37')][_0x8b45('0x39')]?_0x38ac37[_0x8b45('0x37')]:_0x54694c[_0x8b45('0x36')];_0x38ac37[_0x8b45('0x3b')]=qs['sort'](_0x35c5f4[_0x8b45('0x34')][_0x8b45('0x3c')]);_0x38ac37[_0x8b45('0x40')]=qs[_0x8b45('0x35')](_['pick'](_0x35c5f4[_0x8b45('0x34')],_0x54694c[_0x8b45('0x35')]));if(_0x35c5f4[_0x8b45('0x34')]['filter']){_0x38ac37[_0x8b45('0x40')]=_[_0x8b45('0x3f')](_0x38ac37[_0x8b45('0x40')],{'$or':_[_0x8b45('0x2f')](_0x38ac37['attributes'],function(_0x20ffef){var _0x3f202f={};_0x3f202f[_0x20ffef]={'$like':'%'+_0x35c5f4[_0x8b45('0x34')][_0x8b45('0x3e')]+'%'};return _0x3f202f;})});}_0x38ac37=_['merge']({},_0x38ac37,_0x35c5f4['options']);return _0x483d89[_0x8b45('0x66')](_0x38ac37);}})[_0x8b45('0x29')](function(_0x541688){if(_0x541688){_0x129571=_0x541688[_0x8b45('0x39')];if(!_0x35c5f4[_0x8b45('0x34')][_0x8b45('0x3a')](_0x8b45('0x5d'))){_0x38ac37[_0x8b45('0x23')]=qs[_0x8b45('0x23')](_0x35c5f4[_0x8b45('0x34')][_0x8b45('0x23')]);_0x38ac37['offset']=qs['offset'](_0x35c5f4['query'][_0x8b45('0x22')]);}return _0x483d89[_0x8b45('0x66')](_0x38ac37);}})[_0x8b45('0x29')](function(_0x5b8fa5){if(_0x5b8fa5){return _0x5b8fa5?{'count':_0x129571,'rows':_0x5b8fa5}:null;}})[_0x8b45('0x29')](respondWithResult(_0x1c6740,null))['catch'](handleError(_0x1c6740,null));};exports[_0x8b45('0x69')]=function(_0x1e6276,_0x38694b,_0x43a231){var _0x366800=_0x1e6276[_0x8b45('0x4f')]['ids'];return db[_0x8b45('0x68')][_0x8b45('0x46')]({'where':{'id':_0x366800},'attributes':['id'],'include':[{'model':db[_0x8b45('0x6a')],'as':_0x8b45('0x6b'),'attributes':['id','name',_0x8b45('0x6c'),_0x8b45('0x6d'),_0x8b45('0x6e')],'raw':!![]}]})[_0x8b45('0x29')](function(_0x3a95a6){if(_0x3a95a6){var _0x37c160=_['flatMap'](_0x3a95a6,function(_0x54f3e9){var _0x3ba46a=_0x54f3e9['get']({'plain':!![]});return _0x3ba46a[_0x8b45('0x6b')];});return db['MailQueue'][_0x8b45('0x4d')]({'where':{'id':_0x1e6276[_0x8b45('0x4a')]['id']}})[_0x8b45('0x29')](function(_0x328da3){return db[_0x8b45('0x6f')]['transaction'](function(_0x4274bb){return _0x328da3[_0x8b45('0x69')](_0x366800,{'transaction':_0x4274bb})[_0x8b45('0x29')](function(){return BPromise[_0x8b45('0x70')](_0x37c160,function(_0xafbab5){return db[_0x8b45('0x71')][_0x8b45('0x72')]({'where':{'UserId':_0xafbab5['id'],'MailQueueId':_0x1e6276['params']['id']},'transaction':_0x4274bb});});})[_0x8b45('0x29')](function(){_0x37c160[_0x8b45('0x73')](function(_0x3478ba){socket[_0x8b45('0x74')](_0x8b45('0x75'),{'UserId':_0x3478ba['id'],'MailQueueId':_0x328da3['id']});});});});});}})[_0x8b45('0x29')](respondWithStatusCode(_0x38694b,null))[_0x8b45('0x48')](handleError(_0x38694b,null));};exports[_0x8b45('0x76')]=function(_0x3b5a47,_0x259f36,_0x1d2989){return db[_0x8b45('0x68')][_0x8b45('0x46')]({'where':{'id':_0x3b5a47[_0x8b45('0x34')][_0x8b45('0x77')]},'attributes':['id'],'include':[{'model':db[_0x8b45('0x6a')],'as':_0x8b45('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x8b45('0x29')](handleEntityNotFound(_0x259f36,null))[_0x8b45('0x29')](function(_0x5d9b08){var _0x16de2d=_[_0x8b45('0x2f')](_0x5d9b08,'id');var _0x33b48b=[];var _0x17ee58=[];var _0x208c2d=squel[_0x8b45('0x78')]();_0x208c2d['field'](_0x8b45('0x79'))[_0x8b45('0x7a')]('team_has_mail_queues','tq')[_0x8b45('0x7b')]('user_has_teams','ut',_0x8b45('0x7c'))[_0x8b45('0x40')]('MailQueueId\x20=\x20?',_0x3b5a47[_0x8b45('0x4a')]['id']);for(var _0x330235=0x0;_0x330235<_0x5d9b08[_0x8b45('0x39')];_0x330235+=0x1){let _0x343fd5=_0x5d9b08[_0x330235];for(var _0x35ab5e=0x0;_0x35ab5e<_0x343fd5[_0x8b45('0x6b')]['length'];_0x35ab5e+=0x1){let _0x2a79a9=_0x343fd5['Agents'][_0x35ab5e];var _0x301f60=_0x208c2d[_0x8b45('0x7d')]();_0x301f60[_0x8b45('0x40')](_0x8b45('0x7e'),_0x2a79a9['id']);_0x17ee58['push'](db[_0x8b45('0x6f')][_0x8b45('0x34')](_0x301f60[_0x8b45('0x7f')](),{'type':db[_0x8b45('0x6f')]['QueryTypes'][_0x8b45('0x80')]})['then'](function(_0x15c6a5){if(_0x15c6a5['length']===0x1){return _0x2a79a9['id'];}else{var _0x15189e=_['every'](_[_0x8b45('0x2f')](_0x15c6a5,_0x8b45('0x81')),function(_0x14c136){return _[_0x8b45('0x82')](_0x16de2d,_0x14c136);});if(_0x15189e){return _0x2a79a9['id'];}}}));}}return BPromise[_0x8b45('0x83')](_0x17ee58)['then'](function(_0xda233f){_0x33b48b=_(_0x33b48b)['union'](_0xda233f)[_0x8b45('0x84')]()[_0x8b45('0x85')]();return db[_0x8b45('0x30')][_0x8b45('0x4d')]({'where':{'id':_0x3b5a47[_0x8b45('0x4a')]['id']}})[_0x8b45('0x29')](function(_0x40e0a7){return db[_0x8b45('0x6f')]['transaction'](function(_0x52c8fc){return _0x40e0a7[_0x8b45('0x76')](_0x3b5a47[_0x8b45('0x34')][_0x8b45('0x77')],{'transaction':_0x52c8fc})['then'](function(){if(!_[_0x8b45('0x86')](_0x33b48b)){return _0x40e0a7[_0x8b45('0x87')](_0x33b48b,{'transaction':_0x52c8fc});}})['then'](function(){_0x33b48b[_0x8b45('0x73')](function(_0x161619){socket[_0x8b45('0x74')](_0x8b45('0x88'),{'UserId':_0x161619,'MailQueueId':_0x40e0a7['id']});});});});});});})[_0x8b45('0x29')](respondWithStatusCode(_0x259f36,null))[_0x8b45('0x48')](handleError(_0x259f36,null));};exports[_0x8b45('0x89')]=function(_0x5be065,_0x3b095e,_0x28aef5){return db['MailQueue'][_0x8b45('0x4d')]({'where':{'id':_0x5be065[_0x8b45('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b095e,null))[_0x8b45('0x29')](function(_0x26a7d1){if(_0x26a7d1){return _0x26a7d1[_0x8b45('0x89')](_0x5be065['body'][_0x8b45('0x77')],_[_0x8b45('0x8a')](_0x5be065[_0x8b45('0x4f')],[_0x8b45('0x77'),'id'])||{})[_0x8b45('0x8b')](function(_0x4d9f87){for(var _0x55bb26=0x0;_0x55bb26<_0x5be065['body'][_0x8b45('0x77')]['length'];_0x55bb26+=0x1){socket['emit'](_0x8b45('0x75'),{'UserId':Number(_0x5be065[_0x8b45('0x4f')]['ids'][_0x55bb26]),'MailQueueId':Number(_0x5be065[_0x8b45('0x4a')]['id'])});}return _0x4d9f87;});}})[_0x8b45('0x29')](respondWithResult(_0x3b095e,null))[_0x8b45('0x48')](handleError(_0x3b095e,null));};exports[_0x8b45('0x87')]=function(_0x48d2f5,_0x302996,_0x1727dd){return db[_0x8b45('0x30')][_0x8b45('0x4d')]({'where':{'id':_0x48d2f5['params']['id']}})['then'](handleEntityNotFound(_0x302996,null))[_0x8b45('0x29')](function(_0x5ab06e){if(_0x5ab06e){return _0x5ab06e[_0x8b45('0x87')](_0x48d2f5[_0x8b45('0x34')][_0x8b45('0x77')])[_0x8b45('0x29')](function(){if(_[_0x8b45('0x8c')](_0x48d2f5[_0x8b45('0x34')][_0x8b45('0x77')])){for(var _0x512305=0x0;_0x512305<_0x48d2f5[_0x8b45('0x34')][_0x8b45('0x77')]['length'];_0x512305+=0x1){socket[_0x8b45('0x74')]('userMailQueue:remove',{'UserId':Number(_0x48d2f5['query'][_0x8b45('0x77')][_0x512305]),'MailQueueId':Number(_0x48d2f5['params']['id'])});}}else{socket[_0x8b45('0x74')](_0x8b45('0x88'),{'UserId':Number(_0x48d2f5['query'][_0x8b45('0x77')]),'MailQueueId':Number(_0x48d2f5[_0x8b45('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x302996,null))['catch'](handleError(_0x302996,null));};exports[_0x8b45('0x8d')]=function(_0x46a7be,_0x456090,_0x4326f3){var _0xb30265={};var _0x23613f={};var _0x441669;var _0x32acb3;return db[_0x8b45('0x30')][_0x8b45('0x67')]({'where':{'id':_0x46a7be[_0x8b45('0x4a')]['id']}})[_0x8b45('0x29')](handleEntityNotFound(_0x456090,null))['then'](function(_0x424e5c){if(_0x424e5c){_0x441669=_0x424e5c;_0x23613f[_0x8b45('0x36')]=_[_0x8b45('0x4b')](db[_0x8b45('0x6a')][_0x8b45('0x31')]);_0x23613f[_0x8b45('0x34')]=_[_0x8b45('0x4b')](_0x46a7be[_0x8b45('0x34')]);_0x23613f[_0x8b45('0x35')]=_[_0x8b45('0x4c')](_0x23613f[_0x8b45('0x36')],_0x23613f[_0x8b45('0x34')]);_0xb30265[_0x8b45('0x37')]=_['intersection'](_0x23613f[_0x8b45('0x36')],qs[_0x8b45('0x38')](_0x46a7be[_0x8b45('0x34')]['fields']));_0xb30265['attributes']=_0xb30265['attributes'][_0x8b45('0x39')]?_0xb30265[_0x8b45('0x37')]:_0x23613f['model'];_0xb30265['order']=qs[_0x8b45('0x3c')](_0x46a7be[_0x8b45('0x34')][_0x8b45('0x3c')]);_0xb30265[_0x8b45('0x40')]=qs[_0x8b45('0x35')](_[_0x8b45('0x3d')](_0x46a7be['query'],_0x23613f[_0x8b45('0x35')]));if(_0x46a7be[_0x8b45('0x34')]['filter']){_0xb30265[_0x8b45('0x40')]=_[_0x8b45('0x3f')](_0xb30265[_0x8b45('0x40')],{'$or':_[_0x8b45('0x2f')](_0xb30265[_0x8b45('0x37')],function(_0x2366ac){var _0x5324ae={};_0x5324ae[_0x2366ac]={'$like':'%'+_0x46a7be['query'][_0x8b45('0x3e')]+'%'};return _0x5324ae;})});}_0xb30265=_[_0x8b45('0x3f')]({},_0xb30265,_0x46a7be['options']);return _0x441669['getAgents'](_0xb30265);}})[_0x8b45('0x29')](function(_0x250ccd){if(_0x250ccd){_0x32acb3=_0x250ccd[_0x8b45('0x39')];if(!_0x46a7be[_0x8b45('0x34')][_0x8b45('0x3a')](_0x8b45('0x5d'))){_0xb30265['limit']=qs[_0x8b45('0x23')](_0x46a7be[_0x8b45('0x34')]['limit']);_0xb30265[_0x8b45('0x22')]=qs[_0x8b45('0x22')](_0x46a7be[_0x8b45('0x34')][_0x8b45('0x22')]);}return _0x441669[_0x8b45('0x8d')](_0xb30265);}})[_0x8b45('0x29')](function(_0x26fc3e){if(_0x26fc3e){return _0x26fc3e?{'count':_0x32acb3,'rows':_0x26fc3e}:null;}})[_0x8b45('0x29')](respondWithResult(_0x456090,null))[_0x8b45('0x48')](handleError(_0x456090,null));}; \ No newline at end of file +var _0xd5f7=['MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','findOne','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','type','model','keys','query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','intersection','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserMailQueue','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','createdAt','rows','format','%s/%s','updatedAt','getTeams','Team','order','addTeams','ids','Agents','interface','find','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x38f6ee,_0xf06a6c){var _0x49aeef=function(_0x1f1262){while(--_0x1f1262){_0x38f6ee['push'](_0x38f6ee['shift']());}};_0x49aeef(++_0xf06a6c);}(_0xd5f7,0x120));var _0x7d5f=function(_0x365ed4,_0x572c95){_0x365ed4=_0x365ed4-0x0;var _0x59bbfe=_0xd5f7[_0x365ed4];return _0x59bbfe;};'use strict';var emlformat=require(_0x7d5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d5f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d5f('0x2'));var moment=require(_0x7d5f('0x3'));var BPromise=require(_0x7d5f('0x4'));var Mustache=require(_0x7d5f('0x5'));var util=require(_0x7d5f('0x6'));var path=require(_0x7d5f('0x7'));var sox=require('sox');var csv=require(_0x7d5f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d5f('0x9'));var _=require('lodash');var squel=require(_0x7d5f('0xa'));var crypto=require(_0x7d5f('0xb'));var jsforce=require(_0x7d5f('0xc'));var deskjs=require(_0x7d5f('0xd'));var toCsv=require(_0x7d5f('0x8'));var querystring=require(_0x7d5f('0xe'));var Papa=require('papaparse');var Redis=require(_0x7d5f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7d5f('0x10'));var as=require(_0x7d5f('0x11'));var hardwareService=require(_0x7d5f('0x12'));var logger=require(_0x7d5f('0x13'))(_0x7d5f('0x14'));var utils=require(_0x7d5f('0x15'));var config=require(_0x7d5f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d5f('0x17'))['db'];config[_0x7d5f('0x18')]=_[_0x7d5f('0x19')](config[_0x7d5f('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d5f('0x1a'))(new Redis(config[_0x7d5f('0x18')]));require(_0x7d5f('0x1b'))[_0x7d5f('0x1c')](socket);function respondWithStatusCode(_0x3ec39f,_0x2121f5){_0x2121f5=_0x2121f5||0xcc;return function(_0x314fb1){if(_0x314fb1){return _0x3ec39f[_0x7d5f('0x1d')](_0x2121f5);}return _0x3ec39f[_0x7d5f('0x1e')](_0x2121f5)[_0x7d5f('0x1f')]();};}function respondWithResult(_0x1a91cd,_0x431dbd){_0x431dbd=_0x431dbd||0xc8;return function(_0x540fef){if(_0x540fef){return _0x1a91cd[_0x7d5f('0x1e')](_0x431dbd)[_0x7d5f('0x20')](_0x540fef);}};}function respondWithFilteredResult(_0x6aef68,_0x45ecb9){return function(_0x2d1f30){if(_0x2d1f30){var _0x1681d5=typeof _0x45ecb9[_0x7d5f('0x21')]===_0x7d5f('0x22')&&typeof _0x45ecb9['limit']==='undefined';var _0x178efa=_0x2d1f30[_0x7d5f('0x23')];var _0x2d87c9=_0x1681d5?0x0:_0x45ecb9[_0x7d5f('0x21')];var _0x500a12=_0x1681d5?_0x2d1f30['count']:_0x45ecb9[_0x7d5f('0x21')]+_0x45ecb9['limit'];var _0x29b7c8;if(_0x500a12>=_0x178efa){_0x500a12=_0x178efa;_0x29b7c8=0xc8;}else{_0x29b7c8=0xce;}_0x6aef68[_0x7d5f('0x1e')](_0x29b7c8);return _0x6aef68['set'](_0x7d5f('0x24'),_0x2d87c9+'-'+_0x500a12+'/'+_0x178efa)[_0x7d5f('0x20')](_0x2d1f30);}return null;};}function patchUpdates(_0x2944fd){return function(_0x875a30){try{jsonpatch['apply'](_0x875a30,_0x2944fd,!![]);}catch(_0x3c394d){return BPromise['reject'](_0x3c394d);}return _0x875a30[_0x7d5f('0x25')]();};}function saveUpdates(_0x1e0344,_0x3c84d0){return function(_0x2310c9){if(_0x2310c9){return _0x2310c9['update'](_0x1e0344)[_0x7d5f('0x26')](function(_0x569749){return _0x569749;});}return null;};}function removeEntity(_0x3429dd,_0x32dde3){return function(_0x27d21e){if(_0x27d21e){return _0x27d21e[_0x7d5f('0x27')]()[_0x7d5f('0x26')](function(){var _0x2ef067=_0x27d21e[_0x7d5f('0x28')]({'plain':!![]});var _0x1d7477='MailQueues';return db[_0x7d5f('0x29')]['destroy']({'where':{'type':_0x1d7477,'resourceId':_0x2ef067['id']}})[_0x7d5f('0x26')](function(){return _0x27d21e;});})[_0x7d5f('0x26')](function(){_0x3429dd[_0x7d5f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cbe32,_0x302452){return function(_0x50fcc1){if(!_0x50fcc1){_0x5cbe32[_0x7d5f('0x1d')](0x194);}return _0x50fcc1;};}function handleError(_0x31273e,_0x54568a){_0x54568a=_0x54568a||0x1f4;return function(_0x465a00){logger[_0x7d5f('0x2a')](_0x465a00[_0x7d5f('0x2b')]);if(_0x465a00['name']){delete _0x465a00[_0x7d5f('0x2c')];}_0x31273e['status'](_0x54568a)[_0x7d5f('0x2d')](_0x465a00);};}exports[_0x7d5f('0x2e')]=function(_0x3ba412,_0x4eaef6){var _0x4c151c={},_0x5931a5={},_0x3ccaa5={'count':0x0,'rows':[]};var _0x2d2928=_[_0x7d5f('0x2f')](db[_0x7d5f('0x30')][_0x7d5f('0x31')],function(_0x58e8a6){return{'name':_0x58e8a6['fieldName'],'type':_0x58e8a6[_0x7d5f('0x32')]['key']};});_0x5931a5[_0x7d5f('0x33')]=_[_0x7d5f('0x2f')](_0x2d2928,_0x7d5f('0x2c'));_0x5931a5['query']=_[_0x7d5f('0x34')](_0x3ba412[_0x7d5f('0x35')]);_0x5931a5['filters']=_['intersection'](_0x5931a5['model'],_0x5931a5[_0x7d5f('0x35')]);_0x4c151c['attributes']=_['intersection'](_0x5931a5[_0x7d5f('0x33')],qs[_0x7d5f('0x36')](_0x3ba412['query'][_0x7d5f('0x36')]));_0x4c151c[_0x7d5f('0x37')]=_0x4c151c['attributes'][_0x7d5f('0x38')]?_0x4c151c[_0x7d5f('0x37')]:_0x5931a5['model'];if(!_0x3ba412[_0x7d5f('0x35')][_0x7d5f('0x39')](_0x7d5f('0x3a'))){_0x4c151c[_0x7d5f('0x3b')]=qs[_0x7d5f('0x3b')](_0x3ba412['query'][_0x7d5f('0x3b')]);_0x4c151c[_0x7d5f('0x21')]=qs[_0x7d5f('0x21')](_0x3ba412[_0x7d5f('0x35')][_0x7d5f('0x21')]);}_0x4c151c['order']=qs['sort'](_0x3ba412[_0x7d5f('0x35')][_0x7d5f('0x3c')]);_0x4c151c[_0x7d5f('0x3d')]=qs[_0x7d5f('0x3e')](_['pick'](_0x3ba412['query'],_0x5931a5[_0x7d5f('0x3e')]),_0x2d2928);if(_0x3ba412[_0x7d5f('0x35')][_0x7d5f('0x3f')]){_0x4c151c[_0x7d5f('0x3d')]=_[_0x7d5f('0x40')](_0x4c151c[_0x7d5f('0x3d')],{'$or':_[_0x7d5f('0x2f')](_0x2d2928,function(_0x33b31d){if(_0x33b31d[_0x7d5f('0x32')]!==_0x7d5f('0x41')){var _0x14862d={};_0x14862d[_0x33b31d[_0x7d5f('0x2c')]]={'$like':'%'+_0x3ba412[_0x7d5f('0x35')][_0x7d5f('0x3f')]+'%'};return _0x14862d;}})});}_0x4c151c=_['merge']({},_0x4c151c,_0x3ba412['options']);var _0x3faf66={'where':_0x4c151c[_0x7d5f('0x3d')]};return db['MailQueue'][_0x7d5f('0x23')](_0x3faf66)[_0x7d5f('0x26')](function(_0x417711){_0x3ccaa5[_0x7d5f('0x23')]=_0x417711;if(_0x3ba412[_0x7d5f('0x35')][_0x7d5f('0x42')]){_0x4c151c['include']=[{'all':!![]}];}return db[_0x7d5f('0x30')][_0x7d5f('0x43')](_0x4c151c);})[_0x7d5f('0x26')](function(_0x4f8827){_0x3ccaa5['rows']=_0x4f8827;return _0x3ccaa5;})[_0x7d5f('0x26')](respondWithFilteredResult(_0x4eaef6,_0x4c151c))[_0x7d5f('0x44')](handleError(_0x4eaef6,null));};exports[_0x7d5f('0x45')]=function(_0x115b92,_0x3d4f6d){var _0x456411={'raw':!![],'where':{'id':_0x115b92[_0x7d5f('0x46')]['id']}},_0x50b586={};_0x50b586['model']=_[_0x7d5f('0x34')](db['MailQueue'][_0x7d5f('0x31')]);_0x50b586[_0x7d5f('0x35')]=_[_0x7d5f('0x34')](_0x115b92[_0x7d5f('0x35')]);_0x50b586[_0x7d5f('0x3e')]=_[_0x7d5f('0x47')](_0x50b586[_0x7d5f('0x33')],_0x50b586[_0x7d5f('0x35')]);_0x456411[_0x7d5f('0x37')]=_[_0x7d5f('0x47')](_0x50b586[_0x7d5f('0x33')],qs['fields'](_0x115b92[_0x7d5f('0x35')][_0x7d5f('0x36')]));_0x456411['attributes']=_0x456411[_0x7d5f('0x37')]['length']?_0x456411['attributes']:_0x50b586[_0x7d5f('0x33')];if(_0x115b92[_0x7d5f('0x35')][_0x7d5f('0x42')]){_0x456411['include']=[{'all':!![]}];}_0x456411=_[_0x7d5f('0x40')]({},_0x456411,_0x115b92[_0x7d5f('0x48')]);return db['MailQueue']['find'](_0x456411)[_0x7d5f('0x26')](handleEntityNotFound(_0x3d4f6d,null))['then'](respondWithResult(_0x3d4f6d,null))[_0x7d5f('0x44')](handleError(_0x3d4f6d,null));};exports[_0x7d5f('0x49')]=function(_0x3469e7,_0x14c262){return db[_0x7d5f('0x30')][_0x7d5f('0x49')](_0x3469e7[_0x7d5f('0x4a')],{})[_0x7d5f('0x26')](function(_0x413cff){var _0x485b99=_0x3469e7[_0x7d5f('0x4b')][_0x7d5f('0x28')]({'plain':!![]});if(!_0x485b99)throw new Error(_0x7d5f('0x4c'));if(_0x485b99[_0x7d5f('0x4d')]===_0x7d5f('0x4b')){var _0x2c52d4=_0x413cff[_0x7d5f('0x28')]({'plain':!![]});var _0x146a86='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x146a86,'userProfileId':_0x485b99['userProfileId']},'raw':!![]})[_0x7d5f('0x26')](function(_0x5740dd){if(_0x5740dd&&_0x5740dd[_0x7d5f('0x4e')]===0x0){return db[_0x7d5f('0x29')][_0x7d5f('0x49')]({'name':_0x2c52d4[_0x7d5f('0x2c')],'resourceId':_0x2c52d4['id'],'type':_0x5740dd[_0x7d5f('0x2c')],'sectionId':_0x5740dd['id']},{})[_0x7d5f('0x26')](function(){return _0x413cff;});}else{return _0x413cff;}})[_0x7d5f('0x44')](function(_0x3c3016){logger['error'](_0x7d5f('0x4f'),_0x3c3016);throw _0x3c3016;});}return _0x413cff;})[_0x7d5f('0x26')](respondWithResult(_0x14c262,0xc9))[_0x7d5f('0x44')](handleError(_0x14c262,null));};exports[_0x7d5f('0x50')]=function(_0x187b47,_0x1906f0){if(_0x187b47[_0x7d5f('0x4a')]['id']){delete _0x187b47['body']['id'];}return db[_0x7d5f('0x30')]['find']({'where':{'id':_0x187b47['params']['id']}})[_0x7d5f('0x26')](handleEntityNotFound(_0x1906f0,null))['then'](saveUpdates(_0x187b47[_0x7d5f('0x4a')],null))[_0x7d5f('0x26')](respondWithResult(_0x1906f0,null))['catch'](handleError(_0x1906f0,null));};exports[_0x7d5f('0x27')]=function(_0x5cde8d,_0x2d797b){return db['MailQueue']['find']({'where':{'id':_0x5cde8d[_0x7d5f('0x46')]['id']}})[_0x7d5f('0x26')](handleEntityNotFound(_0x2d797b,null))['then'](removeEntity(_0x2d797b,null))[_0x7d5f('0x44')](handleError(_0x2d797b,null));};exports['describe']=function(_0xb0fa96,_0x1d1494){return db[_0x7d5f('0x30')][_0x7d5f('0x51')]()[_0x7d5f('0x26')](respondWithResult(_0x1d1494,null))[_0x7d5f('0x44')](handleError(_0x1d1494,null));};exports[_0x7d5f('0x52')]=function(_0x1d7f44,_0x4ed988,_0x5ac645){var _0x269b4f={'raw':!![],'where':{}},_0x45be54={},_0x1d6f0f;return db[_0x7d5f('0x30')]['findOne']({'where':{'id':_0x1d7f44[_0x7d5f('0x46')]['id']}})[_0x7d5f('0x26')](handleEntityNotFound(_0x4ed988,null))[_0x7d5f('0x26')](function(_0x4493ed){if(_0x4493ed){_0x1d6f0f=_0x4493ed[_0x7d5f('0x28')]({'plain':!![]});_0x45be54[_0x7d5f('0x33')]=_['keys'](db[_0x7d5f('0x53')][_0x7d5f('0x31')]);_0x45be54[_0x7d5f('0x35')]=_['keys'](_0x1d7f44[_0x7d5f('0x35')]);_0x45be54[_0x7d5f('0x3e')]=_[_0x7d5f('0x47')](_0x45be54[_0x7d5f('0x33')],_0x45be54[_0x7d5f('0x35')]);_0x269b4f['attributes']=_[_0x7d5f('0x47')](_0x45be54[_0x7d5f('0x33')],qs[_0x7d5f('0x36')](_0x1d7f44[_0x7d5f('0x35')][_0x7d5f('0x36')]));_0x269b4f[_0x7d5f('0x37')]=_0x269b4f[_0x7d5f('0x37')][_0x7d5f('0x38')]?_0x269b4f[_0x7d5f('0x37')]:_0x45be54['model'];if(!_0x1d7f44[_0x7d5f('0x35')][_0x7d5f('0x39')](_0x7d5f('0x3a'))){_0x269b4f[_0x7d5f('0x3b')]=qs['limit'](_0x1d7f44['query'][_0x7d5f('0x3b')]);_0x269b4f[_0x7d5f('0x21')]=qs[_0x7d5f('0x21')](_0x1d7f44[_0x7d5f('0x35')]['offset']);}_0x269b4f['order']=qs[_0x7d5f('0x3c')](_0x1d7f44[_0x7d5f('0x35')]['sort']);_0x269b4f['where']=qs[_0x7d5f('0x3e')](_[_0x7d5f('0x54')](_0x1d7f44[_0x7d5f('0x35')],_0x45be54[_0x7d5f('0x3e')]));_0x269b4f[_0x7d5f('0x3d')][_0x7d5f('0x55')]=_0x4493ed['id'];if(_0x1d7f44[_0x7d5f('0x35')][_0x7d5f('0x3f')]){_0x269b4f['where']=_[_0x7d5f('0x40')](_0x269b4f[_0x7d5f('0x3d')],{'$or':_[_0x7d5f('0x2f')](_0x269b4f['attributes'],function(_0x216615){var _0xcf24f3={};_0xcf24f3[_0x216615]={'$like':'%'+_0x1d7f44[_0x7d5f('0x35')][_0x7d5f('0x3f')]+'%'};return _0xcf24f3;})});}_0x269b4f=_[_0x7d5f('0x40')]({},_0x269b4f,_0x1d7f44['options']);return db[_0x7d5f('0x53')][_0x7d5f('0x43')](_0x269b4f);}})[_0x7d5f('0x26')](function(_0x4fd093){if(_0x4fd093){return db[_0x7d5f('0x56')][_0x7d5f('0x57')]({'where':{'id':_[_0x7d5f('0x2f')](_0x4fd093,_0x7d5f('0x58')),'role':_0x7d5f('0x59')},'attributes':['id',_0x7d5f('0x2c'),_0x7d5f('0x5a'),'updatedAt',_0x7d5f('0x5b')]});}})['then'](function(_0x91606a){if(_0x91606a){return{'count':_0x91606a['count'],'rows':_[_0x7d5f('0x2f')](_0x91606a[_0x7d5f('0x5c')],function(_0x5af6ce){return{'membername':_0x5af6ce[_0x7d5f('0x2c')],'UserId':_0x5af6ce['id'],'queue_name':_0x1d6f0f[_0x7d5f('0x2c')],'MailQueueId':_0x1d6f0f['id'],'interface':util[_0x7d5f('0x5d')](_0x7d5f('0x5e'),'SIP',_0x5af6ce['name']),'penalty':0x0,'paused':_0x5af6ce['mailPause'],'createdAt':_0x5af6ce['createdAt'],'updatedAt':_0x5af6ce[_0x7d5f('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4ed988,_0x269b4f))['catch'](handleError(_0x4ed988,null));};exports[_0x7d5f('0x60')]=function(_0x4f588c,_0x51bc1c,_0x3e9ea7){var _0x51382b={};var _0x46101e={};var _0xef27a2;var _0x1cfc43;return db[_0x7d5f('0x30')]['findOne']({'where':{'id':_0x4f588c[_0x7d5f('0x46')]['id']}})[_0x7d5f('0x26')](handleEntityNotFound(_0x51bc1c,null))[_0x7d5f('0x26')](function(_0x5f2cf3){if(_0x5f2cf3){_0xef27a2=_0x5f2cf3;_0x46101e[_0x7d5f('0x33')]=_['keys'](db[_0x7d5f('0x61')][_0x7d5f('0x31')]);_0x46101e['query']=_[_0x7d5f('0x34')](_0x4f588c[_0x7d5f('0x35')]);_0x46101e[_0x7d5f('0x3e')]=_['intersection'](_0x46101e[_0x7d5f('0x33')],_0x46101e[_0x7d5f('0x35')]);_0x51382b[_0x7d5f('0x37')]=_['intersection'](_0x46101e[_0x7d5f('0x33')],qs[_0x7d5f('0x36')](_0x4f588c[_0x7d5f('0x35')]['fields']));_0x51382b[_0x7d5f('0x37')]=_0x51382b[_0x7d5f('0x37')][_0x7d5f('0x38')]?_0x51382b['attributes']:_0x46101e[_0x7d5f('0x33')];_0x51382b[_0x7d5f('0x62')]=qs[_0x7d5f('0x3c')](_0x4f588c[_0x7d5f('0x35')][_0x7d5f('0x3c')]);_0x51382b[_0x7d5f('0x3d')]=qs['filters'](_[_0x7d5f('0x54')](_0x4f588c[_0x7d5f('0x35')],_0x46101e[_0x7d5f('0x3e')]));if(_0x4f588c[_0x7d5f('0x35')][_0x7d5f('0x3f')]){_0x51382b['where']=_[_0x7d5f('0x40')](_0x51382b[_0x7d5f('0x3d')],{'$or':_['map'](_0x51382b[_0x7d5f('0x37')],function(_0x87b218){var _0x4500b1={};_0x4500b1[_0x87b218]={'$like':'%'+_0x4f588c[_0x7d5f('0x35')]['filter']+'%'};return _0x4500b1;})});}_0x51382b=_[_0x7d5f('0x40')]({},_0x51382b,_0x4f588c[_0x7d5f('0x48')]);return _0xef27a2['getTeams'](_0x51382b);}})['then'](function(_0x2800c2){if(_0x2800c2){_0x1cfc43=_0x2800c2[_0x7d5f('0x38')];if(!_0x4f588c[_0x7d5f('0x35')][_0x7d5f('0x39')]('nolimit')){_0x51382b[_0x7d5f('0x3b')]=qs[_0x7d5f('0x3b')](_0x4f588c['query'][_0x7d5f('0x3b')]);_0x51382b[_0x7d5f('0x21')]=qs[_0x7d5f('0x21')](_0x4f588c[_0x7d5f('0x35')][_0x7d5f('0x21')]);}return _0xef27a2['getTeams'](_0x51382b);}})[_0x7d5f('0x26')](function(_0x87cbff){if(_0x87cbff){return _0x87cbff?{'count':_0x1cfc43,'rows':_0x87cbff}:null;}})['then'](respondWithResult(_0x51bc1c,null))['catch'](handleError(_0x51bc1c,null));};exports[_0x7d5f('0x63')]=function(_0x3e6588,_0x5d4ac8,_0x4c8108){var _0x2cbe6=_0x3e6588['body'][_0x7d5f('0x64')];return db['Team']['findAll']({'where':{'id':_0x2cbe6},'attributes':['id'],'include':[{'model':db[_0x7d5f('0x56')],'as':_0x7d5f('0x65'),'attributes':['id',_0x7d5f('0x2c'),'online','voicePause',_0x7d5f('0x66')],'raw':!![]}]})[_0x7d5f('0x26')](function(_0x39eb14){if(_0x39eb14){var _0x3344c5=_['flatMap'](_0x39eb14,function(_0x6b7bde){var _0x44a7ea=_0x6b7bde[_0x7d5f('0x28')]({'plain':!![]});return _0x44a7ea[_0x7d5f('0x65')];});return db[_0x7d5f('0x30')][_0x7d5f('0x67')]({'where':{'id':_0x3e6588[_0x7d5f('0x46')]['id']}})[_0x7d5f('0x26')](function(_0x1a8d52){return db[_0x7d5f('0x68')]['transaction'](function(_0x4dc4fb){return _0x1a8d52[_0x7d5f('0x63')](_0x2cbe6,{'transaction':_0x4dc4fb})[_0x7d5f('0x26')](function(){return BPromise[_0x7d5f('0x69')](_0x3344c5,function(_0x2ccc5a){return db[_0x7d5f('0x53')][_0x7d5f('0x6a')]({'where':{'UserId':_0x2ccc5a['id'],'MailQueueId':_0x3e6588[_0x7d5f('0x46')]['id']},'transaction':_0x4dc4fb});});})[_0x7d5f('0x26')](function(){_0x3344c5[_0x7d5f('0x6b')](function(_0x5f4e75){socket[_0x7d5f('0x6c')](_0x7d5f('0x6d'),{'UserId':_0x5f4e75['id'],'MailQueueId':_0x1a8d52['id']});});});});});}})[_0x7d5f('0x26')](respondWithStatusCode(_0x5d4ac8,null))[_0x7d5f('0x44')](handleError(_0x5d4ac8,null));};exports['removeTeams']=function(_0x190dd5,_0x178a16,_0x43a071){return db[_0x7d5f('0x61')][_0x7d5f('0x43')]({'where':{'id':_0x190dd5[_0x7d5f('0x35')][_0x7d5f('0x64')]},'attributes':['id'],'include':[{'model':db[_0x7d5f('0x56')],'as':_0x7d5f('0x65'),'attributes':['id'],'raw':!![]}]})[_0x7d5f('0x26')](handleEntityNotFound(_0x178a16,null))[_0x7d5f('0x26')](function(_0x3d11ba){var _0x1aaa8d=_[_0x7d5f('0x2f')](_0x3d11ba,'id');var _0x5bf83f=[];var _0x3bb535=[];var _0x46993c=squel['select']();_0x46993c[_0x7d5f('0x6e')](_0x7d5f('0x6f'))['from']('team_has_mail_queues','tq')[_0x7d5f('0x70')]('user_has_teams','ut',_0x7d5f('0x71'))[_0x7d5f('0x3d')](_0x7d5f('0x72'),_0x190dd5['params']['id']);for(var _0x43cc64=0x0;_0x43cc64<_0x3d11ba[_0x7d5f('0x38')];_0x43cc64+=0x1){let _0x2265d5=_0x3d11ba[_0x43cc64];for(var _0x31a6ff=0x0;_0x31a6ff<_0x2265d5[_0x7d5f('0x65')][_0x7d5f('0x38')];_0x31a6ff+=0x1){let _0x14fa3a=_0x2265d5[_0x7d5f('0x65')][_0x31a6ff];var _0x361c77=_0x46993c[_0x7d5f('0x73')]();_0x361c77[_0x7d5f('0x3d')](_0x7d5f('0x74'),_0x14fa3a['id']);_0x3bb535[_0x7d5f('0x75')](db['sequelize'][_0x7d5f('0x35')](_0x361c77[_0x7d5f('0x76')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x7d5f('0x26')](function(_0x4b60c5){if(_0x4b60c5[_0x7d5f('0x38')]===0x1){return _0x14fa3a['id'];}else{var _0x3be62f=_[_0x7d5f('0x77')](_[_0x7d5f('0x2f')](_0x4b60c5,'TeamId'),function(_0x56f69a){return _[_0x7d5f('0x78')](_0x1aaa8d,_0x56f69a);});if(_0x3be62f){return _0x14fa3a['id'];}}}));}}return BPromise[_0x7d5f('0x79')](_0x3bb535)[_0x7d5f('0x26')](function(_0x2a3491){_0x5bf83f=_(_0x5bf83f)[_0x7d5f('0x7a')](_0x2a3491)[_0x7d5f('0x7b')]()['value']();return db['MailQueue'][_0x7d5f('0x67')]({'where':{'id':_0x190dd5[_0x7d5f('0x46')]['id']}})[_0x7d5f('0x26')](function(_0xb358aa){return db[_0x7d5f('0x68')][_0x7d5f('0x7c')](function(_0x2b7748){return _0xb358aa[_0x7d5f('0x7d')](_0x190dd5[_0x7d5f('0x35')][_0x7d5f('0x64')],{'transaction':_0x2b7748})[_0x7d5f('0x26')](function(){if(!_[_0x7d5f('0x7e')](_0x5bf83f)){return _0xb358aa[_0x7d5f('0x7f')](_0x5bf83f,{'transaction':_0x2b7748});}})[_0x7d5f('0x26')](function(){_0x5bf83f[_0x7d5f('0x6b')](function(_0x47e034){socket['emit'](_0x7d5f('0x80'),{'UserId':_0x47e034,'MailQueueId':_0xb358aa['id']});});});});});});})[_0x7d5f('0x26')](respondWithStatusCode(_0x178a16,null))['catch'](handleError(_0x178a16,null));};exports[_0x7d5f('0x81')]=function(_0x345d80,_0xa5ffa5,_0x2e3bd9){return db[_0x7d5f('0x30')][_0x7d5f('0x67')]({'where':{'id':_0x345d80[_0x7d5f('0x46')]['id']}})[_0x7d5f('0x26')](handleEntityNotFound(_0xa5ffa5,null))[_0x7d5f('0x26')](function(_0x2b173c){if(_0x2b173c){return _0x2b173c[_0x7d5f('0x81')](_0x345d80[_0x7d5f('0x4a')][_0x7d5f('0x64')],_[_0x7d5f('0x82')](_0x345d80[_0x7d5f('0x4a')],[_0x7d5f('0x64'),'id'])||{})[_0x7d5f('0x83')](function(_0x1ec8ee){for(var _0x23e72f=0x0;_0x23e72f<_0x345d80[_0x7d5f('0x4a')]['ids'][_0x7d5f('0x38')];_0x23e72f+=0x1){socket[_0x7d5f('0x6c')](_0x7d5f('0x6d'),{'UserId':Number(_0x345d80[_0x7d5f('0x4a')][_0x7d5f('0x64')][_0x23e72f]),'MailQueueId':Number(_0x345d80['params']['id'])});}return _0x1ec8ee;});}})[_0x7d5f('0x26')](respondWithResult(_0xa5ffa5,null))[_0x7d5f('0x44')](handleError(_0xa5ffa5,null));};exports[_0x7d5f('0x7f')]=function(_0x11557d,_0x14deba,_0x22a9bf){return db[_0x7d5f('0x30')][_0x7d5f('0x67')]({'where':{'id':_0x11557d[_0x7d5f('0x46')]['id']}})[_0x7d5f('0x26')](handleEntityNotFound(_0x14deba,null))['then'](function(_0x2f14ab){if(_0x2f14ab){return _0x2f14ab['removeAgents'](_0x11557d[_0x7d5f('0x35')][_0x7d5f('0x64')])[_0x7d5f('0x26')](function(){if(_['isArray'](_0x11557d[_0x7d5f('0x35')][_0x7d5f('0x64')])){for(var _0x217521=0x0;_0x217521<_0x11557d[_0x7d5f('0x35')][_0x7d5f('0x64')]['length'];_0x217521+=0x1){socket[_0x7d5f('0x6c')]('userMailQueue:remove',{'UserId':Number(_0x11557d['query'][_0x7d5f('0x64')][_0x217521]),'MailQueueId':Number(_0x11557d[_0x7d5f('0x46')]['id'])});}}else{socket[_0x7d5f('0x6c')](_0x7d5f('0x80'),{'UserId':Number(_0x11557d['query']['ids']),'MailQueueId':Number(_0x11557d[_0x7d5f('0x46')]['id'])});}});}})[_0x7d5f('0x26')](respondWithStatusCode(_0x14deba,null))[_0x7d5f('0x44')](handleError(_0x14deba,null));};exports['getAgents']=function(_0x37966f,_0x148fdf,_0x2b9a09){var _0x72f243={};var _0x438e7b={};var _0x1b8f3e;var _0x1eae25;return db['MailQueue'][_0x7d5f('0x84')]({'where':{'id':_0x37966f[_0x7d5f('0x46')]['id']}})[_0x7d5f('0x26')](handleEntityNotFound(_0x148fdf,null))[_0x7d5f('0x26')](function(_0x338ad1){if(_0x338ad1){_0x1b8f3e=_0x338ad1;_0x438e7b[_0x7d5f('0x33')]=_['keys'](db[_0x7d5f('0x56')][_0x7d5f('0x31')]);_0x438e7b[_0x7d5f('0x35')]=_[_0x7d5f('0x34')](_0x37966f[_0x7d5f('0x35')]);_0x438e7b[_0x7d5f('0x3e')]=_[_0x7d5f('0x47')](_0x438e7b[_0x7d5f('0x33')],_0x438e7b['query']);_0x72f243['attributes']=_[_0x7d5f('0x47')](_0x438e7b[_0x7d5f('0x33')],qs[_0x7d5f('0x36')](_0x37966f[_0x7d5f('0x35')][_0x7d5f('0x36')]));_0x72f243[_0x7d5f('0x37')]=_0x72f243[_0x7d5f('0x37')]['length']?_0x72f243[_0x7d5f('0x37')]:_0x438e7b['model'];_0x72f243[_0x7d5f('0x62')]=qs[_0x7d5f('0x3c')](_0x37966f['query'][_0x7d5f('0x3c')]);_0x72f243[_0x7d5f('0x3d')]=qs['filters'](_[_0x7d5f('0x54')](_0x37966f[_0x7d5f('0x35')],_0x438e7b[_0x7d5f('0x3e')]));if(_0x37966f['query']['filter']){_0x72f243[_0x7d5f('0x3d')]=_[_0x7d5f('0x40')](_0x72f243[_0x7d5f('0x3d')],{'$or':_[_0x7d5f('0x2f')](_0x72f243[_0x7d5f('0x37')],function(_0x3982be){var _0x35dee4={};_0x35dee4[_0x3982be]={'$like':'%'+_0x37966f['query'][_0x7d5f('0x3f')]+'%'};return _0x35dee4;})});}_0x72f243=_['merge']({},_0x72f243,_0x37966f['options']);return _0x1b8f3e['getAgents'](_0x72f243);}})['then'](function(_0x5d4309){if(_0x5d4309){_0x1eae25=_0x5d4309['length'];if(!_0x37966f[_0x7d5f('0x35')][_0x7d5f('0x39')](_0x7d5f('0x3a'))){_0x72f243[_0x7d5f('0x3b')]=qs[_0x7d5f('0x3b')](_0x37966f[_0x7d5f('0x35')][_0x7d5f('0x3b')]);_0x72f243['offset']=qs[_0x7d5f('0x21')](_0x37966f[_0x7d5f('0x35')][_0x7d5f('0x21')]);}return _0x1b8f3e[_0x7d5f('0x85')](_0x72f243);}})[_0x7d5f('0x26')](function(_0x1a80a8){if(_0x1a80a8){return _0x1a80a8?{'count':_0x1eae25,'rows':_0x1a80a8}:null;}})['then'](respondWithResult(_0x148fdf,null))[_0x7d5f('0x44')](handleError(_0x148fdf,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 98031ea..3d354fe 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 _0xc8ed=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x8107c2,_0x265035){var _0x11b067=function(_0x1ad8ee){while(--_0x1ad8ee){_0x8107c2['push'](_0x8107c2['shift']());}};_0x11b067(++_0x265035);}(_0xc8ed,0x10a));var _0xdc8e=function(_0x130993,_0x2e7490){_0x130993=_0x130993-0x0;var _0x194cdf=_0xc8ed[_0x130993];return _0x194cdf;};'use strict';var EventEmitter=require(_0xdc8e('0x0'));var MailQueue=require(_0xdc8e('0x1'))['db'][_0xdc8e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xdc8e('0x3')](0x0);var events={'afterCreate':_0xdc8e('0x4'),'afterUpdate':_0xdc8e('0x5'),'afterDestroy':_0xdc8e('0x6')};function emitEvent(_0x21116e){return function(_0x34d0d1,_0x2af4d9,_0x3b6bdf){MailQueueEvents[_0xdc8e('0x7')](_0x21116e+':'+_0x34d0d1['id'],_0x34d0d1);MailQueueEvents['emit'](_0x21116e,_0x34d0d1);_0x3b6bdf(null);};}for(var e in events){if(events[_0xdc8e('0x8')](e)){var event=events[e];MailQueue[_0xdc8e('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x4d14=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x1c2ea4,_0x16ac04){var _0x575866=function(_0x47272b){while(--_0x47272b){_0x1c2ea4['push'](_0x1c2ea4['shift']());}};_0x575866(++_0x16ac04);}(_0x4d14,0x147));var _0x44d1=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x4d14[_0xa3463d];return _0x50fd67;};'use strict';var EventEmitter=require(_0x44d1('0x0'));var MailQueue=require(_0x44d1('0x1'))['db'][_0x44d1('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x44d1('0x3')](0x0);var events={'afterCreate':_0x44d1('0x4'),'afterUpdate':_0x44d1('0x5'),'afterDestroy':_0x44d1('0x6')};function emitEvent(_0x64d166){return function(_0x4f689c,_0x41cc2a,_0x4b529a){MailQueueEvents[_0x44d1('0x7')](_0x64d166+':'+_0x4f689c['id'],_0x4f689c);MailQueueEvents[_0x44d1('0x7')](_0x64d166,_0x4f689c);_0x4b529a(null);};}for(var e in events){if(events[_0x44d1('0x8')](e)){var event=events[e];MailQueue[_0x44d1('0x9')](e,emitEvent(event));}}module[_0x44d1('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 71da9d5..882ee18 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 _0x0f8b=['mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','define'];(function(_0x18e1f8,_0x2b4740){var _0x432f01=function(_0x4fafab){while(--_0x4fafab){_0x18e1f8['push'](_0x18e1f8['shift']());}};_0x432f01(++_0x2b4740);}(_0x0f8b,0x1da));var _0xb0f8=function(_0x1bb3f3,_0x14b021){_0x1bb3f3=_0x1bb3f3-0x0;var _0x11d80a=_0x0f8b[_0x1bb3f3];return _0x11d80a;};'use strict';var _=require(_0xb0f8('0x0'));var util=require(_0xb0f8('0x1'));var logger=require(_0xb0f8('0x2'))('api');var moment=require(_0xb0f8('0x3'));var BPromise=require(_0xb0f8('0x4'));var rp=require(_0xb0f8('0x5'));var fs=require('fs');var path=require(_0xb0f8('0x6'));var rimraf=require(_0xb0f8('0x7'));var config=require('../../config/environment');var attributes=require(_0xb0f8('0x8'));module['exports']=function(_0x14cbaf,_0xb21294){return _0x14cbaf[_0xb0f8('0x9')]('MailQueue',attributes,{'tableName':_0xb0f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce0c=['api','moment','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','lodash','../../config/logger'];(function(_0x235597,_0x53528e){var _0x4a7e96=function(_0x14f144){while(--_0x14f144){_0x235597['push'](_0x235597['shift']());}};_0x4a7e96(++_0x53528e);}(_0xce0c,0x17f));var _0xcce0=function(_0xcbe787,_0x401e4c){_0xcbe787=_0xcbe787-0x0;var _0x4c78fa=_0xce0c[_0xcbe787];return _0x4c78fa;};'use strict';var _=require(_0xcce0('0x0'));var util=require('util');var logger=require(_0xcce0('0x1'))(_0xcce0('0x2'));var moment=require(_0xcce0('0x3'));var BPromise=require('bluebird');var rp=require(_0xcce0('0x4'));var fs=require('fs');var path=require(_0xcce0('0x5'));var rimraf=require(_0xcce0('0x6'));var config=require('../../config/environment');var attributes=require(_0xcce0('0x7'));module[_0xcce0('0x8')]=function(_0x9ae529,_0x36945e){return _0x9ae529[_0xcce0('0x9')](_0xcce0('0xa'),attributes,{'tableName':'mail_queues','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 2b0a7f7..a7999f8 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 _0xd06e=['message','result','catch','MailQueue,\x20%s,\x20%s','MailQueue','findAll','options','where','attributes','limit','include','map','model','GetMailQueue','debug','stringify','ShowMailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x170201,_0x58b8c1){var _0x2686cb=function(_0x539644){while(--_0x539644){_0x170201['push'](_0x170201['shift']());}};_0x2686cb(++_0x58b8c1);}(_0xd06e,0x91));var _0xed06=function(_0x9d07df,_0x469d62){_0x9d07df=_0x9d07df-0x0;var _0x51505d=_0xd06e[_0x9d07df];return _0x51505d;};'use strict';var _=require(_0xed06('0x0'));var util=require(_0xed06('0x1'));var moment=require(_0xed06('0x2'));var BPromise=require(_0xed06('0x3'));var rs=require(_0xed06('0x4'));var fs=require('fs');var Redis=require(_0xed06('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed06('0x6'));var logger=require('../../config/logger')(_0xed06('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed06('0x8')][_0xed06('0x9')]({'port':0x232a});config['redis']=_[_0xed06('0xa')](config[_0xed06('0xb')],{'host':_0xed06('0xc'),'port':0x18eb});var socket=require(_0xed06('0xd'))(new Redis(config[_0xed06('0xb')]));require(_0xed06('0xe'))[_0xed06('0xf')](socket);function respondWithRpcPromise(_0x2156cf,_0x3fe66a,_0x54f5bb){return new BPromise(function(_0x54f57e,_0x1302fd){return client[_0xed06('0x10')](_0x2156cf,_0x54f5bb)[_0xed06('0x11')](function(_0xe13f6b){logger[_0xed06('0x12')]('MailQueue,\x20%s,\x20%s',_0x3fe66a,_0xed06('0x13'));logger['debug'](_0xed06('0x14'),_0x3fe66a,_0xed06('0x13'),JSON['stringify'](_0xe13f6b));if(_0xe13f6b[_0xed06('0x15')]){if(_0xe13f6b[_0xed06('0x15')][_0xed06('0x16')]===0x1f4){logger[_0xed06('0x15')]('MailQueue,\x20%s,\x20%s',_0x3fe66a,_0xe13f6b['error']['message']);return _0x1302fd(_0xe13f6b['error'][_0xed06('0x17')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x3fe66a,_0xe13f6b[_0xed06('0x15')][_0xed06('0x17')]);return _0x54f57e(_0xe13f6b[_0xed06('0x15')][_0xed06('0x17')]);}else{logger[_0xed06('0x12')]('MailQueue,\x20%s,\x20%s',_0x3fe66a,_0xed06('0x13'));_0x54f57e(_0xe13f6b[_0xed06('0x18')][_0xed06('0x17')]);}})[_0xed06('0x19')](function(_0x11c66a){logger[_0xed06('0x15')](_0xed06('0x1a'),_0x3fe66a,_0x11c66a);_0x1302fd(_0x11c66a);});});}exports['GetMailQueue']=function(_0x3bf14b){var _0x89239=this;return new Promise(function(_0x2a348c,_0x2edf42){return db[_0xed06('0x1b')][_0xed06('0x1c')]({'raw':_0x3bf14b[_0xed06('0x1d')]?_0x3bf14b[_0xed06('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3bf14b[_0xed06('0x1d')]?_0x3bf14b['options'][_0xed06('0x1e')]||null:null,'attributes':_0x3bf14b[_0xed06('0x1d')]?_0x3bf14b['options'][_0xed06('0x1f')]||null:null,'limit':_0x3bf14b[_0xed06('0x1d')]?_0x3bf14b[_0xed06('0x1d')][_0xed06('0x20')]||null:null,'include':_0x3bf14b['options']?_0x3bf14b['options'][_0xed06('0x21')]?_[_0xed06('0x22')](_0x3bf14b[_0xed06('0x1d')]['include'],function(_0x26237b){return{'model':db[_0x26237b[_0xed06('0x23')]],'as':_0x26237b['as'],'attributes':_0x26237b[_0xed06('0x1f')],'include':_0x26237b[_0xed06('0x21')]?_[_0xed06('0x22')](_0x26237b[_0xed06('0x21')],function(_0x2684a3){return{'model':db[_0x2684a3[_0xed06('0x23')]],'as':_0x2684a3['as'],'attributes':_0x2684a3['attributes'],'include':_0x2684a3[_0xed06('0x21')]?_['map'](_0x2684a3[_0xed06('0x21')],function(_0xefba37){return{'model':db[_0xefba37['model']],'as':_0xefba37['as'],'attributes':_0xefba37[_0xed06('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f09a2){logger['info'](_0xed06('0x24'),_0x3bf14b);logger[_0xed06('0x25')](_0xed06('0x24'),_0x3bf14b,JSON[_0xed06('0x26')](_0x3f09a2));_0x2a348c(_0x3f09a2);})['catch'](function(_0x3fd095){logger[_0xed06('0x15')](_0xed06('0x24'),_0x3fd095[_0xed06('0x17')],_0x3bf14b);_0x2edf42(_0x89239[_0xed06('0x15')](0x1f4,_0x3fd095[_0xed06('0x17')]));});});};exports[_0xed06('0x27')]=function(_0x2767b2){var _0x4fe0e2=this;return new Promise(function(_0x1ed717,_0x5de24a){return db['MailQueue'][_0xed06('0x28')]({'raw':_0x2767b2[_0xed06('0x1d')]?_0x2767b2['options'][_0xed06('0x29')]===undefined?!![]:![]:!![],'where':_0x2767b2[_0xed06('0x1d')]?_0x2767b2['options'][_0xed06('0x1e')]||null:null,'attributes':_0x2767b2['options']?_0x2767b2[_0xed06('0x1d')][_0xed06('0x1f')]||null:null,'include':_0x2767b2[_0xed06('0x1d')]?_0x2767b2[_0xed06('0x1d')][_0xed06('0x21')]?_[_0xed06('0x22')](_0x2767b2[_0xed06('0x1d')][_0xed06('0x21')],function(_0x4fca2e){return{'model':db[_0x4fca2e[_0xed06('0x23')]],'as':_0x4fca2e['as'],'attributes':_0x4fca2e[_0xed06('0x1f')],'include':_0x4fca2e[_0xed06('0x21')]?_[_0xed06('0x22')](_0x4fca2e[_0xed06('0x21')],function(_0x2d7f14){return{'model':db[_0x2d7f14[_0xed06('0x23')]],'as':_0x2d7f14['as'],'attributes':_0x2d7f14['attributes'],'include':_0x2d7f14['include']?_[_0xed06('0x22')](_0x2d7f14['include'],function(_0x4b15bc){return{'model':db[_0x4b15bc['model']],'as':_0x4b15bc['as'],'attributes':_0x4b15bc[_0xed06('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d4485){logger[_0xed06('0x12')]('ShowMailQueue',_0x2767b2);logger[_0xed06('0x25')](_0xed06('0x27'),_0x2767b2,JSON[_0xed06('0x26')](_0x5d4485));_0x1ed717(_0x5d4485);})[_0xed06('0x19')](function(_0x384d7e){logger[_0xed06('0x15')](_0xed06('0x27'),_0x384d7e[_0xed06('0x17')],_0x2767b2);_0x5de24a(_0x4fe0e2[_0xed06('0x15')](0x1f4,_0x384d7e[_0xed06('0x17')]));});});}; \ No newline at end of file +var _0x4a83=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','MailQueue','options','raw','where','attributes','limit','map','include','model','GetMailQueue','debug','catch','ShowMailQueue','util','moment','bluebird'];(function(_0xfcdda0,_0x32479b){var _0x17ebe3=function(_0x5bfaa3){while(--_0x5bfaa3){_0xfcdda0['push'](_0xfcdda0['shift']());}};_0x17ebe3(++_0x32479b);}(_0x4a83,0x125));var _0x34a8=function(_0x5eb27d,_0xdea543){_0x5eb27d=_0x5eb27d-0x0;var _0x5968ed=_0x4a83[_0x5eb27d];return _0x5968ed;};'use strict';var _=require('lodash');var util=require(_0x34a8('0x0'));var moment=require(_0x34a8('0x1'));var BPromise=require(_0x34a8('0x2'));var rs=require(_0x34a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34a8('0x4'));var logger=require(_0x34a8('0x5'))(_0x34a8('0x6'));var config=require('../../config/environment');var jayson=require(_0x34a8('0x7'));var client=jayson[_0x34a8('0x8')][_0x34a8('0x9')]({'port':0x232a});config[_0x34a8('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x34a8('0xb'))(new Redis(config[_0x34a8('0xa')]));require(_0x34a8('0xc'))[_0x34a8('0xd')](socket);function respondWithRpcPromise(_0x281409,_0x3e446b,_0x2490ce){return new BPromise(function(_0x5dc41b,_0x11aec9){return client[_0x34a8('0xe')](_0x281409,_0x2490ce)[_0x34a8('0xf')](function(_0xf22231){logger['info'](_0x34a8('0x10'),_0x3e446b,_0x34a8('0x11'));logger['debug'](_0x34a8('0x12'),_0x3e446b,_0x34a8('0x11'),JSON[_0x34a8('0x13')](_0xf22231));if(_0xf22231['error']){if(_0xf22231[_0x34a8('0x14')][_0x34a8('0x15')]===0x1f4){logger['error'](_0x34a8('0x10'),_0x3e446b,_0xf22231[_0x34a8('0x14')][_0x34a8('0x16')]);return _0x11aec9(_0xf22231[_0x34a8('0x14')]['message']);}logger[_0x34a8('0x14')](_0x34a8('0x10'),_0x3e446b,_0xf22231[_0x34a8('0x14')][_0x34a8('0x16')]);return _0x5dc41b(_0xf22231['error'][_0x34a8('0x16')]);}else{logger[_0x34a8('0x17')](_0x34a8('0x10'),_0x3e446b,'request\x20sent');_0x5dc41b(_0xf22231['result'][_0x34a8('0x16')]);}})['catch'](function(_0x3e32c5){logger[_0x34a8('0x14')](_0x34a8('0x10'),_0x3e446b,_0x3e32c5);_0x11aec9(_0x3e32c5);});});}exports['GetMailQueue']=function(_0x520713){var _0x3d8d20=this;return new Promise(function(_0x411bff,_0x37f815){return db[_0x34a8('0x18')]['findAll']({'raw':_0x520713[_0x34a8('0x19')]?_0x520713[_0x34a8('0x19')][_0x34a8('0x1a')]===undefined?!![]:![]:!![],'where':_0x520713[_0x34a8('0x19')]?_0x520713[_0x34a8('0x19')][_0x34a8('0x1b')]||null:null,'attributes':_0x520713[_0x34a8('0x19')]?_0x520713[_0x34a8('0x19')][_0x34a8('0x1c')]||null:null,'limit':_0x520713[_0x34a8('0x19')]?_0x520713['options'][_0x34a8('0x1d')]||null:null,'include':_0x520713['options']?_0x520713[_0x34a8('0x19')]['include']?_[_0x34a8('0x1e')](_0x520713[_0x34a8('0x19')][_0x34a8('0x1f')],function(_0x369237){return{'model':db[_0x369237['model']],'as':_0x369237['as'],'attributes':_0x369237['attributes'],'include':_0x369237[_0x34a8('0x1f')]?_['map'](_0x369237[_0x34a8('0x1f')],function(_0x929dcf){return{'model':db[_0x929dcf[_0x34a8('0x20')]],'as':_0x929dcf['as'],'attributes':_0x929dcf[_0x34a8('0x1c')],'include':_0x929dcf[_0x34a8('0x1f')]?_[_0x34a8('0x1e')](_0x929dcf[_0x34a8('0x1f')],function(_0x5af302){return{'model':db[_0x5af302[_0x34a8('0x20')]],'as':_0x5af302['as'],'attributes':_0x5af302[_0x34a8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29f7da){logger[_0x34a8('0x17')](_0x34a8('0x21'),_0x520713);logger[_0x34a8('0x22')](_0x34a8('0x21'),_0x520713,JSON[_0x34a8('0x13')](_0x29f7da));_0x411bff(_0x29f7da);})[_0x34a8('0x23')](function(_0xc133dd){logger['error']('GetMailQueue',_0xc133dd[_0x34a8('0x16')],_0x520713);_0x37f815(_0x3d8d20[_0x34a8('0x14')](0x1f4,_0xc133dd['message']));});});};exports['ShowMailQueue']=function(_0x4633d0){var _0x444e23=this;return new Promise(function(_0x18a20a,_0x1bcfd4){return db[_0x34a8('0x18')]['find']({'raw':_0x4633d0[_0x34a8('0x19')]?_0x4633d0['options'][_0x34a8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4633d0[_0x34a8('0x19')]?_0x4633d0['options'][_0x34a8('0x1b')]||null:null,'attributes':_0x4633d0[_0x34a8('0x19')]?_0x4633d0['options'][_0x34a8('0x1c')]||null:null,'include':_0x4633d0[_0x34a8('0x19')]?_0x4633d0[_0x34a8('0x19')][_0x34a8('0x1f')]?_[_0x34a8('0x1e')](_0x4633d0[_0x34a8('0x19')][_0x34a8('0x1f')],function(_0x55bee3){return{'model':db[_0x55bee3['model']],'as':_0x55bee3['as'],'attributes':_0x55bee3[_0x34a8('0x1c')],'include':_0x55bee3[_0x34a8('0x1f')]?_[_0x34a8('0x1e')](_0x55bee3['include'],function(_0x26470a){return{'model':db[_0x26470a[_0x34a8('0x20')]],'as':_0x26470a['as'],'attributes':_0x26470a[_0x34a8('0x1c')],'include':_0x26470a['include']?_[_0x34a8('0x1e')](_0x26470a[_0x34a8('0x1f')],function(_0x50bb56){return{'model':db[_0x50bb56[_0x34a8('0x20')]],'as':_0x50bb56['as'],'attributes':_0x50bb56[_0x34a8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x325a17){logger[_0x34a8('0x17')](_0x34a8('0x24'),_0x4633d0);logger['debug'](_0x34a8('0x24'),_0x4633d0,JSON[_0x34a8('0x13')](_0x325a17));_0x18a20a(_0x325a17);})[_0x34a8('0x23')](function(_0x4bdbb6){logger[_0x34a8('0x14')](_0x34a8('0x24'),_0x4bdbb6[_0x34a8('0x16')],_0x4633d0);_0x1bcfd4(_0x444e23[_0x34a8('0x14')](0x1f4,_0x4bdbb6[_0x34a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 496ad6c..0617649 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 _0xf43f=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','update'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xf43f,0x135));var _0xff43=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf43f[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0xff43('0x0'));var events=[_0xff43('0x1'),'remove',_0xff43('0x2')];function createListener(_0x5248e3,_0x113142){return function(_0x44c6b9){_0x113142[_0xff43('0x3')](_0x5248e3,_0x44c6b9);};}function removeListener(_0x5795c9,_0x50c7b0){return function(){MailQueueEvents[_0xff43('0x4')](_0x5795c9,_0x50c7b0);};}exports[_0xff43('0x5')]=function(_0x1ecf81){for(var _0x27228a=0x0,_0x2588f8=events[_0xff43('0x6')];_0x27228a<_0x2588f8;_0x27228a++){var _0x3e46db=events[_0x27228a];var _0x17e74e=createListener(_0xff43('0x7')+_0x3e46db,_0x1ecf81);MailQueueEvents['on'](_0x3e46db,_0x17e74e);}}; \ No newline at end of file +var _0x6215=['./mailQueue.events','save','remove','emit','length','mailQueue:'];(function(_0x2d9b50,_0x33c327){var _0x40e20c=function(_0x57eea6){while(--_0x57eea6){_0x2d9b50['push'](_0x2d9b50['shift']());}};_0x40e20c(++_0x33c327);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0x5621('0x0'));var events=[_0x5621('0x1'),_0x5621('0x2'),'update'];function createListener(_0x944eb2,_0x2304a6){return function(_0x24464a){_0x2304a6[_0x5621('0x3')](_0x944eb2,_0x24464a);};}function removeListener(_0x204284,_0x13397a){return function(){MailQueueEvents['removeListener'](_0x204284,_0x13397a);};}exports['register']=function(_0x52f3c6){for(var _0x5ae3af=0x0,_0x431e77=events[_0x5621('0x4')];_0x5ae3af<_0x431e77;_0x5ae3af++){var _0x2b7275=events[_0x5ae3af];var _0x253c0b=createListener(_0x5621('0x5')+_0x2b7275,_0x52f3c6);MailQueueEvents['on'](_0x2b7275,_0x253c0b);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 17162d5..3fd5d92 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 _0x469a=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x26ac69,_0x305ae3){var _0x46a53b=function(_0x4f5f90){while(--_0x4f5f90){_0x26ac69['push'](_0x26ac69['shift']());}};_0x46a53b(++_0x305ae3);}(_0x469a,0xc1));var _0xa469=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x469a[_0x25248b];return _0x509939;};'use strict';var multer=require(_0xa469('0x0'));var util=require(_0xa469('0x1'));var path=require(_0xa469('0x2'));var timeout=require(_0xa469('0x3'));var express=require(_0xa469('0x4'));var router=express['Router']();var fs_extra=require(_0xa469('0x5'));var auth=require(_0xa469('0x6'));var interaction=require(_0xa469('0x7'));var config=require('../../config/environment');var controller=require(_0xa469('0x8'));router[_0xa469('0x9')]('/',auth[_0xa469('0xa')](),controller[_0xa469('0xb')]);router[_0xa469('0x9')](_0xa469('0xc'),auth[_0xa469('0xa')](),controller[_0xa469('0xd')]);router[_0xa469('0x9')](_0xa469('0xe'),auth['isAuthenticated'](),controller[_0xa469('0xf')]);router['post']('/',auth[_0xa469('0xa')](),controller[_0xa469('0x10')]);router[_0xa469('0x11')](_0xa469('0xe'),auth['isAuthenticated'](),controller[_0xa469('0x12')]);router[_0xa469('0x13')](_0xa469('0xe'),auth[_0xa469('0xa')](),controller[_0xa469('0x14')]);module[_0xa469('0x15')]=router; \ No newline at end of file +var _0xa320=['index','/describe','describe','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa320,0x117));var _0x0a32=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xa320[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x0a32('0x0'));var util=require(_0x0a32('0x1'));var path=require(_0x0a32('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a32('0x3'));var router=express[_0x0a32('0x4')]();var fs_extra=require(_0x0a32('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a32('0x6'));var controller=require('./mailQueueReport.controller');router[_0x0a32('0x7')]('/',auth[_0x0a32('0x8')](),controller[_0x0a32('0x9')]);router[_0x0a32('0x7')](_0x0a32('0xa'),auth[_0x0a32('0x8')](),controller[_0x0a32('0xb')]);router[_0x0a32('0x7')]('/:id',auth[_0x0a32('0x8')](),controller['show']);router['post']('/',auth[_0x0a32('0x8')](),controller[_0x0a32('0xc')]);router[_0x0a32('0xd')](_0x0a32('0xe'),auth[_0x0a32('0x8')](),controller[_0x0a32('0xf')]);router['delete']('/:id',auth[_0x0a32('0x8')](),controller[_0x0a32('0x10')]);module[_0x0a32('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 21a7c98..f42922f 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 _0xfd45=['STRING','DATE','moment','sequelize'];(function(_0xa590d5,_0x3fed7e){var _0x279fa8=function(_0xec4546){while(--_0xec4546){_0xa590d5['push'](_0xa590d5['shift']());}};_0x279fa8(++_0x3fed7e);}(_0xfd45,0x156));var _0x5fd4=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xfd45[_0x39c734];return _0xb2a2f9;};'use strict';var moment=require(_0x5fd4('0x0'));var Sequelize=require(_0x5fd4('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5fd4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5fd4('0x2')]},'joinAt':{'type':Sequelize[_0x5fd4('0x3')]},'leaveAt':{'type':Sequelize[_0x5fd4('0x3')]},'acceptAt':{'type':Sequelize[_0x5fd4('0x3')]},'exitAt':{'type':Sequelize[_0x5fd4('0x3')]},'reason':{'type':Sequelize[_0x5fd4('0x2')]}}; \ No newline at end of file +var _0x82aa=['STRING','DATE','moment','exports'];(function(_0x31dd28,_0x1f3523){var _0x139c93=function(_0x12e5d8){while(--_0x12e5d8){_0x31dd28['push'](_0x31dd28['shift']());}};_0x139c93(++_0x1f3523);}(_0x82aa,0x9e));var _0xa82a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x82aa[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0xa82a('0x0'));var Sequelize=require('sequelize');module[_0xa82a('0x1')]={'uniqueid':{'type':Sequelize[_0xa82a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa82a('0x2')]},'joinAt':{'type':Sequelize[_0xa82a('0x3')]},'leaveAt':{'type':Sequelize[_0xa82a('0x3')]},'acceptAt':{'type':Sequelize[_0xa82a('0x3')]},'exitAt':{'type':Sequelize[_0xa82a('0x3')]},'reason':{'type':Sequelize[_0xa82a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 745b1e6..b908a41 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 _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0xba34,0x119));var _0x4ba3=function(_0x1ff816,_0x47d26e){_0x1ff816=_0x1ff816-0x0;var _0x1d20e9=_0xba34[_0x1ff816];return _0x1d20e9;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':!![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['MailQueueReport']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));}; \ No newline at end of file +var _0xf2e3=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','error','stack','name','send','index','MailQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','then','includeAll','include','rows','catch','show','params','create','body','update','destroy','find','describe','eml-format'];(function(_0x45ef17,_0x3eb0e5){var _0x238108=function(_0xbbf16b){while(--_0xbbf16b){_0x45ef17['push'](_0x45ef17['shift']());}};_0x238108(++_0x3eb0e5);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xf2e3[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require(_0x3f2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f2e('0x1'));var jsonpatch=require(_0x3f2e('0x2'));var rp=require(_0x3f2e('0x3'));var moment=require(_0x3f2e('0x4'));var BPromise=require(_0x3f2e('0x5'));var Mustache=require(_0x3f2e('0x6'));var util=require(_0x3f2e('0x7'));var path=require(_0x3f2e('0x8'));var sox=require(_0x3f2e('0x9'));var csv=require('to-csv');var ejs=require(_0x3f2e('0xa'));var fs=require('fs');var fs_extra=require(_0x3f2e('0xb'));var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0x11'));var querystring=require(_0x3f2e('0x12'));var Papa=require(_0x3f2e('0x13'));var Redis=require(_0x3f2e('0x14'));var authService=require(_0x3f2e('0x15'));var qs=require(_0x3f2e('0x16'));var as=require(_0x3f2e('0x17'));var hardwareService=require(_0x3f2e('0x18'));var logger=require(_0x3f2e('0x19'))(_0x3f2e('0x1a'));var utils=require(_0x3f2e('0x1b'));var config=require(_0x3f2e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1d'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1f')](_0x5471f9)[_0x3f2e('0x20')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1f')](_0x57cba7)[_0x3f2e('0x21')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=typeof _0x43f69e[_0x3f2e('0x22')]===_0x3f2e('0x23')&&typeof _0x43f69e[_0x3f2e('0x24')]===_0x3f2e('0x23');var _0x155411=_0x218b44[_0x3f2e('0x25')];var _0xc00add=_0x17ef58?0x0:_0x43f69e[_0x3f2e('0x22')];var _0x5b9989=_0x17ef58?_0x218b44[_0x3f2e('0x25')]:_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x24')];var _0xbe899c;if(_0x5b9989>=_0x155411){_0x5b9989=_0x155411;_0xbe899c=0xc8;}else{_0xbe899c=0xce;}_0x4f2e38[_0x3f2e('0x1f')](_0xbe899c);return _0x4f2e38['set']('Content-Range',_0xc00add+'-'+_0x5b9989+'/'+_0x155411)[_0x3f2e('0x21')](_0x218b44);}return null;};}function patchUpdates(_0x11f84c){return function(_0x38bbae){try{jsonpatch[_0x3f2e('0x26')](_0x38bbae,_0x11f84c,!![]);}catch(_0x4381e5){return BPromise[_0x3f2e('0x27')](_0x4381e5);}return _0x38bbae['save']();};}function saveUpdates(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['update'](_0x5a7047)['then'](function(_0x46bb1c){return _0x46bb1c;});}return null;};}function removeEntity(_0x5646f5,_0x1b8c67){return function(_0x401ed9){if(_0x401ed9){return _0x401ed9['destroy']()['then'](function(){_0x5646f5['status'](0xcc)[_0x3f2e('0x20')]();});}};}function handleEntityNotFound(_0x3d7631,_0x4c61d9){return function(_0x11a7cc){if(!_0x11a7cc){_0x3d7631['sendStatus'](0x194);}return _0x11a7cc;};}function handleError(_0x1ad875,_0x598541){_0x598541=_0x598541||0x1f4;return function(_0x2806d0){logger[_0x3f2e('0x28')](_0x2806d0[_0x3f2e('0x29')]);if(_0x2806d0[_0x3f2e('0x2a')]){delete _0x2806d0[_0x3f2e('0x2a')];}_0x1ad875['status'](_0x598541)[_0x3f2e('0x2b')](_0x2806d0);};}exports[_0x3f2e('0x2c')]=function(_0x5eab38,_0x528063){var _0x2b9fda={},_0x1e5db4={},_0x35f421={'count':0x0,'rows':[]};var _0x22e6ad=_['map'](db[_0x3f2e('0x2d')][_0x3f2e('0x2e')],function(_0x37ddfe){return{'name':_0x37ddfe['fieldName'],'type':_0x37ddfe[_0x3f2e('0x2f')][_0x3f2e('0x30')]};});_0x1e5db4[_0x3f2e('0x31')]=_['map'](_0x22e6ad,_0x3f2e('0x2a'));_0x1e5db4[_0x3f2e('0x32')]=_[_0x3f2e('0x33')](_0x5eab38[_0x3f2e('0x32')]);_0x1e5db4[_0x3f2e('0x34')]=_[_0x3f2e('0x35')](_0x1e5db4['model'],_0x1e5db4[_0x3f2e('0x32')]);_0x2b9fda[_0x3f2e('0x36')]=_[_0x3f2e('0x35')](_0x1e5db4[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x37')]));_0x2b9fda['attributes']=_0x2b9fda[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x2b9fda[_0x3f2e('0x36')]:_0x1e5db4[_0x3f2e('0x31')];if(!_0x5eab38['query']['hasOwnProperty'](_0x3f2e('0x39'))){_0x2b9fda[_0x3f2e('0x24')]=qs[_0x3f2e('0x24')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x24')]);_0x2b9fda[_0x3f2e('0x22')]=qs[_0x3f2e('0x22')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x22')]);}_0x2b9fda[_0x3f2e('0x3a')]=qs['sort'](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3b')]);_0x2b9fda[_0x3f2e('0x3c')]=qs[_0x3f2e('0x34')](_['pick'](_0x5eab38[_0x3f2e('0x32')],_0x1e5db4[_0x3f2e('0x34')]),_0x22e6ad);if(_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3d')]){_0x2b9fda[_0x3f2e('0x3c')]=_[_0x3f2e('0x3e')](_0x2b9fda[_0x3f2e('0x3c')],{'$or':_[_0x3f2e('0x3f')](_0x22e6ad,function(_0x4c5ac2){if(_0x4c5ac2[_0x3f2e('0x2f')]!==_0x3f2e('0x40')){var _0x238b6b={};_0x238b6b[_0x4c5ac2[_0x3f2e('0x2a')]]={'$like':'%'+_0x5eab38['query'][_0x3f2e('0x3d')]+'%'};return _0x238b6b;}})});}_0x2b9fda=_[_0x3f2e('0x3e')]({},_0x2b9fda,_0x5eab38['options']);var _0x3fc694={'where':_0x2b9fda[_0x3f2e('0x3c')]};return db['MailQueueReport'][_0x3f2e('0x25')](_0x3fc694)[_0x3f2e('0x41')](function(_0x849236){_0x35f421[_0x3f2e('0x25')]=_0x849236;if(_0x5eab38['query'][_0x3f2e('0x42')]){_0x2b9fda[_0x3f2e('0x43')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x2b9fda);})[_0x3f2e('0x41')](function(_0x23de01){_0x35f421[_0x3f2e('0x44')]=_0x23de01;return _0x35f421;})['then'](respondWithFilteredResult(_0x528063,_0x2b9fda))[_0x3f2e('0x45')](handleError(_0x528063,null));};exports[_0x3f2e('0x46')]=function(_0x43b35a,_0xe9000a){var _0x24df56={'raw':!![],'where':{'id':_0x43b35a[_0x3f2e('0x47')]['id']}},_0x3668dc={};_0x3668dc[_0x3f2e('0x31')]=_[_0x3f2e('0x33')](db[_0x3f2e('0x2d')]['rawAttributes']);_0x3668dc['query']=_[_0x3f2e('0x33')](_0x43b35a[_0x3f2e('0x32')]);_0x3668dc['filters']=_['intersection'](_0x3668dc[_0x3f2e('0x31')],_0x3668dc[_0x3f2e('0x32')]);_0x24df56[_0x3f2e('0x36')]=_['intersection'](_0x3668dc[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x43b35a[_0x3f2e('0x32')]['fields']));_0x24df56[_0x3f2e('0x36')]=_0x24df56[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x24df56['attributes']:_0x3668dc[_0x3f2e('0x31')];if(_0x43b35a[_0x3f2e('0x32')][_0x3f2e('0x42')]){_0x24df56['include']=[{'all':!![]}];}_0x24df56=_[_0x3f2e('0x3e')]({},_0x24df56,_0x43b35a['options']);return db[_0x3f2e('0x2d')]['find'](_0x24df56)['then'](handleEntityNotFound(_0xe9000a,null))[_0x3f2e('0x41')](respondWithResult(_0xe9000a,null))[_0x3f2e('0x45')](handleError(_0xe9000a,null));};exports[_0x3f2e('0x48')]=function(_0x3d6fd2,_0x3e7fac){return db['MailQueueReport']['create'](_0x3d6fd2[_0x3f2e('0x49')],{})[_0x3f2e('0x41')](respondWithResult(_0x3e7fac,0xc9))[_0x3f2e('0x45')](handleError(_0x3e7fac,null));};exports[_0x3f2e('0x4a')]=function(_0x39dbd1,_0xb891b2){if(_0x39dbd1[_0x3f2e('0x49')]['id']){delete _0x39dbd1[_0x3f2e('0x49')]['id'];}return db[_0x3f2e('0x2d')]['find']({'where':{'id':_0x39dbd1['params']['id']}})[_0x3f2e('0x41')](handleEntityNotFound(_0xb891b2,null))['then'](saveUpdates(_0x39dbd1[_0x3f2e('0x49')],null))[_0x3f2e('0x41')](respondWithResult(_0xb891b2,null))[_0x3f2e('0x45')](handleError(_0xb891b2,null));};exports[_0x3f2e('0x4b')]=function(_0x4b6950,_0xd871da){return db['MailQueueReport'][_0x3f2e('0x4c')]({'where':{'id':_0x4b6950[_0x3f2e('0x47')]['id']}})['then'](handleEntityNotFound(_0xd871da,null))[_0x3f2e('0x41')](removeEntity(_0xd871da,null))['catch'](handleError(_0xd871da,null));};exports[_0x3f2e('0x4d')]=function(_0x336003,_0x9ccf3b){return db['MailQueueReport'][_0x3f2e('0x4d')]()[_0x3f2e('0x41')](respondWithResult(_0x9ccf3b,null))[_0x3f2e('0x45')](handleError(_0x9ccf3b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 99df1e6..d569b47 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 _0x542b=['define','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x47821f,_0x3d216b){var _0x4961c8=function(_0x40f4dc){while(--_0x40f4dc){_0x47821f['push'](_0x47821f['shift']());}};_0x4961c8(++_0x3d216b);}(_0x542b,0x11b));var _0xb542=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x542b[_0x163040];return _0x364667;};'use strict';var _=require(_0xb542('0x0'));var util=require(_0xb542('0x1'));var logger=require(_0xb542('0x2'))('api');var moment=require(_0xb542('0x3'));var BPromise=require(_0xb542('0x4'));var rp=require(_0xb542('0x5'));var fs=require('fs');var path=require(_0xb542('0x6'));var rimraf=require(_0xb542('0x7'));var config=require(_0xb542('0x8'));var attributes=require(_0xb542('0x9'));module[_0xb542('0xa')]=function(_0x3a48c6,_0x4b950d){return _0x3a48c6[_0xb542('0xb')]('MailQueueReport',attributes,{'tableName':_0xb542('0xc'),'paranoid':![],'indexes':[{'name':_0xb542('0xd'),'fields':[_0xb542('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e38=['api','moment','request-promise','path','rimraf','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','util'];(function(_0x6aa9df,_0x4104cd){var _0x2f5130=function(_0x59a302){while(--_0x59a302){_0x6aa9df['push'](_0x6aa9df['shift']());}};_0x2f5130(++_0x4104cd);}(_0x0e38,0x15f));var _0x80e3=function(_0xef7b91,_0x1c1af3){_0xef7b91=_0xef7b91-0x0;var _0x247c9e=_0x0e38[_0xef7b91];return _0x247c9e;};'use strict';var _=require('lodash');var util=require(_0x80e3('0x0'));var logger=require('../../config/logger')(_0x80e3('0x1'));var moment=require(_0x80e3('0x2'));var BPromise=require('bluebird');var rp=require(_0x80e3('0x3'));var fs=require('fs');var path=require(_0x80e3('0x4'));var rimraf=require(_0x80e3('0x5'));var config=require('../../config/environment');var attributes=require(_0x80e3('0x6'));module['exports']=function(_0x5a6f49,_0x3f5949){return _0x5a6f49[_0x80e3('0x7')](_0x80e3('0x8'),attributes,{'tableName':_0x80e3('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x80e3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8842342..945303e 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x57e79f,_0xcf2843){var _0x3c075e=function(_0x12c21d){while(--_0x12c21d){_0x57e79f['push'](_0x57e79f['shift']());}};_0x3c075e(++_0xcf2843);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x1a3f31,_0x59088b){var _0x306a82=function(_0x1f4d9f){while(--_0x1f4d9f){_0x1a3f31['push'](_0x1a3f31['shift']());}};_0x306a82(++_0x59088b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5642f0,_0x36df91){_0x5642f0=_0x5642f0-0x0;var _0x3dea97=_0x5f2f[_0x5642f0];return _0x3dea97;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index cb20e88..660e7cf 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3434d7,_0x4d4eb0){var _0x51eebd=function(_0x37161c){while(--_0x37161c){_0x3434d7['push'](_0x3434d7['shift']());}};_0x51eebd(++_0x4d4eb0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x53468a,_0x286986){var _0x205efd=function(_0x5eb1e9){while(--_0x5eb1e9){_0x53468a['push'](_0x53468a['shift']());}};_0x205efd(++_0x286986);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 0faeaaa..7c655d4 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 _0x2277=['STRING','INTEGER','BOOLEAN','INBOX','sequelize','exports'];(function(_0x48a338,_0x341f07){var _0x5e4fc0=function(_0x567684){while(--_0x567684){_0x48a338['push'](_0x48a338['shift']());}};_0x5e4fc0(++_0x341f07);}(_0x2277,0xa0));var _0x7227=function(_0x49a038,_0x20b6ce){_0x49a038=_0x49a038-0x0;var _0x4c50d5=_0x2277[_0x49a038];return _0x4c50d5;};'use strict';var Sequelize=require(_0x7227('0x0'));module[_0x7227('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7227('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7227('0x2')]},'port':{'type':Sequelize[_0x7227('0x3')]},'tls':{'type':Sequelize[_0x7227('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7227('0x2')],'defaultValue':_0x7227('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x7227('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc940=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x7148b6,_0xa61534){var _0x111019=function(_0x452d96){while(--_0x452d96){_0x7148b6['push'](_0x7148b6['shift']());}};_0x111019(++_0xa61534);}(_0xc940,0xf2));var _0x0c94=function(_0xfe18e9,_0x246475){_0xfe18e9=_0xfe18e9-0x0;var _0x128234=_0xc940[_0xfe18e9];return _0x128234;};'use strict';var Sequelize=require(_0x0c94('0x0'));module[_0x0c94('0x1')]={'description':{'type':Sequelize[_0x0c94('0x2')]},'host':{'type':Sequelize[_0x0c94('0x2')]},'authentication':{'type':Sequelize[_0x0c94('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0c94('0x2')]},'port':{'type':Sequelize[_0x0c94('0x4')]},'tls':{'type':Sequelize[_0x0c94('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0c94('0x2')],'defaultValue':_0x0c94('0x5')},'connTimeout':{'type':Sequelize[_0x0c94('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0c94('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x0c94('0x2')]},'modernAuthentication':{'type':Sequelize[_0x0c94('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 707c0af..cbaf3f5 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 _0x870e=['MailServerIn','mail_servers_in','lodash','util','api','moment','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x870e,0x1ee));var _0xe870=function(_0x2e3881,_0x23acc1){_0x2e3881=_0x2e3881-0x0;var _0x199c83=_0x870e[_0x2e3881];return _0x199c83;};'use strict';var _=require(_0xe870('0x0'));var util=require(_0xe870('0x1'));var logger=require('../../config/logger')(_0xe870('0x2'));var moment=require(_0xe870('0x3'));var BPromise=require('bluebird');var rp=require(_0xe870('0x4'));var fs=require('fs');var path=require(_0xe870('0x5'));var rimraf=require('rimraf');var config=require(_0xe870('0x6'));var attributes=require(_0xe870('0x7'));module[_0xe870('0x8')]=function(_0x17bcd6,_0x11e7e3){return _0x17bcd6[_0xe870('0x9')](_0xe870('0xa'),attributes,{'tableName':_0xe870('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1f=['rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','lodash','util','api','moment','bluebird','path'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x3e1f,0xd6));var _0xf3e1=function(_0x4c2c23,_0x3d8d28){_0x4c2c23=_0x4c2c23-0x0;var _0x5c992e=_0x3e1f[_0x4c2c23];return _0x5c992e;};'use strict';var _=require(_0xf3e1('0x0'));var util=require(_0xf3e1('0x1'));var logger=require('../../config/logger')(_0xf3e1('0x2'));var moment=require(_0xf3e1('0x3'));var BPromise=require(_0xf3e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3e1('0x5'));var rimraf=require(_0xf3e1('0x6'));var config=require(_0xf3e1('0x7'));var attributes=require(_0xf3e1('0x8'));module['exports']=function(_0x3c7461,_0x5f1a21){return _0x3c7461[_0xf3e1('0x9')](_0xf3e1('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 1319a5a..97f39ea 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 _0xc3a1=['where','attributes','include','map','model','stringify','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetMailServerIn','MailServerIn','findAll','options','raw'];(function(_0x274c6f,_0x5ef034){var _0x2078a2=function(_0x103c8e){while(--_0x103c8e){_0x274c6f['push'](_0x274c6f['shift']());}};_0x2078a2(++_0x5ef034);}(_0xc3a1,0x11d));var _0x1c3a=function(_0x2b50e6,_0x116a81){_0x2b50e6=_0x2b50e6-0x0;var _0x3c6db7=_0xc3a1[_0x2b50e6];return _0x3c6db7;};'use strict';var _=require('lodash');var util=require(_0x1c3a('0x0'));var moment=require(_0x1c3a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c3a('0x2'));var db=require(_0x1c3a('0x3'))['db'];var utils=require(_0x1c3a('0x4'));var logger=require('../../config/logger')(_0x1c3a('0x5'));var config=require('../../config/environment');var jayson=require(_0x1c3a('0x6'));var client=jayson[_0x1c3a('0x7')][_0x1c3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11024b,_0x7cccaf,_0xe001bb){return new BPromise(function(_0x3753c9,_0x368a5b){return client[_0x1c3a('0x9')](_0x11024b,_0xe001bb)[_0x1c3a('0xa')](function(_0x4a3940){logger['info'](_0x1c3a('0xb'),_0x7cccaf,_0x1c3a('0xc'));logger[_0x1c3a('0xd')](_0x1c3a('0xe'),_0x7cccaf,_0x1c3a('0xc'),JSON['stringify'](_0x4a3940));if(_0x4a3940[_0x1c3a('0xf')]){if(_0x4a3940[_0x1c3a('0xf')][_0x1c3a('0x10')]===0x1f4){logger[_0x1c3a('0xf')](_0x1c3a('0xb'),_0x7cccaf,_0x4a3940['error'][_0x1c3a('0x11')]);return _0x368a5b(_0x4a3940[_0x1c3a('0xf')]['message']);}logger[_0x1c3a('0xf')](_0x1c3a('0xb'),_0x7cccaf,_0x4a3940[_0x1c3a('0xf')][_0x1c3a('0x11')]);return _0x3753c9(_0x4a3940[_0x1c3a('0xf')][_0x1c3a('0x11')]);}else{logger[_0x1c3a('0x12')](_0x1c3a('0xb'),_0x7cccaf,'request\x20sent');_0x3753c9(_0x4a3940['result'][_0x1c3a('0x11')]);}})[_0x1c3a('0x13')](function(_0x38685b){logger[_0x1c3a('0xf')](_0x1c3a('0xb'),_0x7cccaf,_0x38685b);_0x368a5b(_0x38685b);});});}exports[_0x1c3a('0x14')]=function(_0x31d490){var _0x4cd778=this;return new Promise(function(_0x23b021,_0x2555bd){return db[_0x1c3a('0x15')][_0x1c3a('0x16')]({'raw':_0x31d490['options']?_0x31d490[_0x1c3a('0x17')][_0x1c3a('0x18')]===undefined?!![]:![]:!![],'where':_0x31d490[_0x1c3a('0x17')]?_0x31d490['options'][_0x1c3a('0x19')]||null:null,'attributes':_0x31d490[_0x1c3a('0x17')]?_0x31d490[_0x1c3a('0x17')][_0x1c3a('0x1a')]||null:null,'limit':_0x31d490[_0x1c3a('0x17')]?_0x31d490[_0x1c3a('0x17')]['limit']||null:null,'include':_0x31d490['options']?_0x31d490[_0x1c3a('0x17')][_0x1c3a('0x1b')]?_[_0x1c3a('0x1c')](_0x31d490[_0x1c3a('0x17')]['include'],function(_0x159f6f){return{'model':db[_0x159f6f['model']],'as':_0x159f6f['as'],'attributes':_0x159f6f[_0x1c3a('0x1a')],'include':_0x159f6f['include']?_['map'](_0x159f6f[_0x1c3a('0x1b')],function(_0x65d066){return{'model':db[_0x65d066[_0x1c3a('0x1d')]],'as':_0x65d066['as'],'attributes':_0x65d066[_0x1c3a('0x1a')],'include':_0x65d066[_0x1c3a('0x1b')]?_[_0x1c3a('0x1c')](_0x65d066[_0x1c3a('0x1b')],function(_0x31aa80){return{'model':db[_0x31aa80[_0x1c3a('0x1d')]],'as':_0x31aa80['as'],'attributes':_0x31aa80[_0x1c3a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1c3a('0xa')](function(_0x65c28e){logger[_0x1c3a('0x12')](_0x1c3a('0x14'),_0x31d490);logger[_0x1c3a('0xd')]('GetMailServerIn',_0x31d490,JSON[_0x1c3a('0x1e')](_0x65c28e));_0x23b021(_0x65c28e);})[_0x1c3a('0x13')](function(_0x427fc8){logger['error']('GetMailServerIn',_0x427fc8[_0x1c3a('0x11')],_0x31d490);_0x2555bd(_0x4cd778[_0x1c3a('0xf')](0x1f4,_0x427fc8[_0x1c3a('0x11')]));});});}; \ No newline at end of file +var _0x40cd=['http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','map','include','model','attributes','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x47eae5,_0xc214e4){var _0x4f32e4=function(_0x2fac23){while(--_0x2fac23){_0x47eae5['push'](_0x47eae5['shift']());}};_0x4f32e4(++_0xc214e4);}(_0x40cd,0xa5));var _0xd40c=function(_0x442dd6,_0x2197d5){_0x442dd6=_0x442dd6-0x0;var _0x3f23c1=_0x40cd[_0x442dd6];return _0x3f23c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd40c('0x0'));var BPromise=require(_0xd40c('0x1'));var rs=require(_0xd40c('0x2'));var fs=require('fs');var Redis=require(_0xd40c('0x3'));var db=require(_0xd40c('0x4'))['db'];var utils=require(_0xd40c('0x5'));var logger=require('../../config/logger')(_0xd40c('0x6'));var config=require(_0xd40c('0x7'));var jayson=require(_0xd40c('0x8'));var client=jayson[_0xd40c('0x9')][_0xd40c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9abc4d,_0x1ab028,_0x616e6f){return new BPromise(function(_0x5d383f,_0x234017){return client[_0xd40c('0xb')](_0x9abc4d,_0x616e6f)[_0xd40c('0xc')](function(_0x44de53){logger[_0xd40c('0xd')](_0xd40c('0xe'),_0x1ab028,_0xd40c('0xf'));logger['debug'](_0xd40c('0x10'),_0x1ab028,_0xd40c('0xf'),JSON[_0xd40c('0x11')](_0x44de53));if(_0x44de53[_0xd40c('0x12')]){if(_0x44de53[_0xd40c('0x12')][_0xd40c('0x13')]===0x1f4){logger['error'](_0xd40c('0xe'),_0x1ab028,_0x44de53[_0xd40c('0x12')]['message']);return _0x234017(_0x44de53[_0xd40c('0x12')][_0xd40c('0x14')]);}logger[_0xd40c('0x12')](_0xd40c('0xe'),_0x1ab028,_0x44de53['error'][_0xd40c('0x14')]);return _0x5d383f(_0x44de53[_0xd40c('0x12')][_0xd40c('0x14')]);}else{logger[_0xd40c('0xd')]('MailServerIn,\x20%s,\x20%s',_0x1ab028,'request\x20sent');_0x5d383f(_0x44de53[_0xd40c('0x15')][_0xd40c('0x14')]);}})[_0xd40c('0x16')](function(_0x160da9){logger[_0xd40c('0x12')]('MailServerIn,\x20%s,\x20%s',_0x1ab028,_0x160da9);_0x234017(_0x160da9);});});}exports[_0xd40c('0x17')]=function(_0x26d86d){var _0x74e57c=this;return new Promise(function(_0x2ea918,_0x4060a6){return db[_0xd40c('0x18')][_0xd40c('0x19')]({'raw':_0x26d86d[_0xd40c('0x1a')]?_0x26d86d[_0xd40c('0x1a')][_0xd40c('0x1b')]===undefined?!![]:![]:!![],'where':_0x26d86d['options']?_0x26d86d['options'][_0xd40c('0x1c')]||null:null,'attributes':_0x26d86d[_0xd40c('0x1a')]?_0x26d86d['options']['attributes']||null:null,'limit':_0x26d86d[_0xd40c('0x1a')]?_0x26d86d[_0xd40c('0x1a')][_0xd40c('0x1d')]||null:null,'include':_0x26d86d[_0xd40c('0x1a')]?_0x26d86d['options']['include']?_[_0xd40c('0x1e')](_0x26d86d['options'][_0xd40c('0x1f')],function(_0x60278){return{'model':db[_0x60278[_0xd40c('0x20')]],'as':_0x60278['as'],'attributes':_0x60278[_0xd40c('0x21')],'include':_0x60278[_0xd40c('0x1f')]?_[_0xd40c('0x1e')](_0x60278[_0xd40c('0x1f')],function(_0x1fab4c){return{'model':db[_0x1fab4c[_0xd40c('0x20')]],'as':_0x1fab4c['as'],'attributes':_0x1fab4c['attributes'],'include':_0x1fab4c[_0xd40c('0x1f')]?_['map'](_0x1fab4c['include'],function(_0x5c7255){return{'model':db[_0x5c7255[_0xd40c('0x20')]],'as':_0x5c7255['as'],'attributes':_0x5c7255[_0xd40c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd40c('0xc')](function(_0x36cb20){logger[_0xd40c('0xd')](_0xd40c('0x17'),_0x26d86d);logger[_0xd40c('0x22')]('GetMailServerIn',_0x26d86d,JSON[_0xd40c('0x11')](_0x36cb20));_0x2ea918(_0x36cb20);})[_0xd40c('0x16')](function(_0x32a5ca){logger[_0xd40c('0x12')]('GetMailServerIn',_0x32a5ca[_0xd40c('0x14')],_0x26d86d);_0x4060a6(_0x74e57c[_0xd40c('0x12')](0x1f4,_0x32a5ca['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 320d15c..9f61b9c 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x31626f,_0x43c25a){_0x31626f=_0x31626f-0x0;var _0x3e2216=_0x7a54[_0x31626f];return _0x3e2216;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _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(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 013d290..2f12559 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 _0xd914=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x228275,_0xe9341a){var _0xcd8580=function(_0xde459b){while(--_0xde459b){_0x228275['push'](_0x228275['shift']());}};_0xcd8580(++_0xe9341a);}(_0xd914,0x17f));var _0x4d91=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0xd914[_0x255c48];return _0xaebda3;};'use strict';var Sequelize=require(_0x4d91('0x0'));module[_0x4d91('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4d91('0x2')]},'user':{'type':Sequelize[_0x4d91('0x2')]},'pass':{'type':Sequelize[_0x4d91('0x2')]},'port':{'type':Sequelize[_0x4d91('0x3')]},'secure':{'type':Sequelize[_0x4d91('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4d91('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4d91('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3f8c=['STRING'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x3f8c,0x104));var _0xc3f8=function(_0x2c4bf6,_0x1ba038){_0x2c4bf6=_0x2c4bf6-0x0;var _0x5df629=_0x3f8c[_0x2c4bf6];return _0x5df629;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xc3f8('0x0')]},'host':{'type':Sequelize[_0xc3f8('0x0')]},'user':{'type':Sequelize[_0xc3f8('0x0')]},'pass':{'type':Sequelize[_0xc3f8('0x0')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e4a9e6f..7927134 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 _0x43e7=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils'];(function(_0x2a7b11,_0x34277d){var _0x47f658=function(_0x377600){while(--_0x377600){_0x2a7b11['push'](_0x2a7b11['shift']());}};_0x47f658(++_0x34277d);}(_0x43e7,0x150));var _0x743e=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x43e7[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0x743e('0x0'));var rimraf=require(_0x743e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x743e('0x2'));var rp=require(_0x743e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x743e('0x4'));var util=require(_0x743e('0x5'));var path=require('path');var sox=require(_0x743e('0x6'));var csv=require(_0x743e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x743e('0x8'));var _=require(_0x743e('0x9'));var squel=require(_0x743e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x743e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x743e('0xc'));var Papa=require(_0x743e('0xd'));var Redis=require(_0x743e('0xe'));var authService=require(_0x743e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x743e('0x10'));var logger=require('../../config/logger')(_0x743e('0x11'));var utils=require(_0x743e('0x12'));var config=require(_0x743e('0x13'));var licenseUtil=require(_0x743e('0x14'));var db=require(_0x743e('0x15'))['db'];function respondWithStatusCode(_0x44cab9,_0x506c61){_0x506c61=_0x506c61||0xcc;return function(_0x52a81f){if(_0x52a81f){return _0x44cab9[_0x743e('0x16')](_0x506c61);}return _0x44cab9[_0x743e('0x17')](_0x506c61)[_0x743e('0x18')]();};}function respondWithResult(_0x519628,_0x543a7b){_0x543a7b=_0x543a7b||0xc8;return function(_0x34218e){if(_0x34218e){return _0x519628['status'](_0x543a7b)[_0x743e('0x19')](_0x34218e);}};}function respondWithFilteredResult(_0x21ec32,_0x38918f){return function(_0x4957d5){if(_0x4957d5){var _0xb99741=typeof _0x38918f['offset']===_0x743e('0x1a')&&typeof _0x38918f[_0x743e('0x1b')]===_0x743e('0x1a');var _0x52d57a=_0x4957d5['count'];var _0x46fd72=_0xb99741?0x0:_0x38918f[_0x743e('0x1c')];var _0x59bfe7=_0xb99741?_0x4957d5[_0x743e('0x1d')]:_0x38918f[_0x743e('0x1c')]+_0x38918f[_0x743e('0x1b')];var _0x59011e;if(_0x59bfe7>=_0x52d57a){_0x59bfe7=_0x52d57a;_0x59011e=0xc8;}else{_0x59011e=0xce;}_0x21ec32[_0x743e('0x17')](_0x59011e);return _0x21ec32['set'](_0x743e('0x1e'),_0x46fd72+'-'+_0x59bfe7+'/'+_0x52d57a)[_0x743e('0x19')](_0x4957d5);}return null;};}function patchUpdates(_0xfbf482){return function(_0x33e4f5){try{jsonpatch[_0x743e('0x1f')](_0x33e4f5,_0xfbf482,!![]);}catch(_0x3c4e3f){return BPromise[_0x743e('0x20')](_0x3c4e3f);}return _0x33e4f5['save']();};}function saveUpdates(_0x2012c6,_0x5020d2){return function(_0x3e0540){if(_0x3e0540){return _0x3e0540['update'](_0x2012c6)[_0x743e('0x21')](function(_0xcfde91){return _0xcfde91;});}return null;};}function removeEntity(_0x4f3487,_0x349d21){return function(_0x28fe96){if(_0x28fe96){return _0x28fe96[_0x743e('0x22')]()[_0x743e('0x21')](function(){_0x4f3487[_0x743e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49162b,_0x168b47){return function(_0x5264e6){if(!_0x5264e6){_0x49162b[_0x743e('0x16')](0x194);}return _0x5264e6;};}function handleError(_0x5e41bc,_0x198e5a){_0x198e5a=_0x198e5a||0x1f4;return function(_0x3b5dd6){logger[_0x743e('0x23')](_0x3b5dd6[_0x743e('0x24')]);if(_0x3b5dd6[_0x743e('0x25')]){delete _0x3b5dd6[_0x743e('0x25')];}_0x5e41bc[_0x743e('0x17')](_0x198e5a)[_0x743e('0x26')](_0x3b5dd6);};}exports['index']=function(_0x1f9449,_0x3375af){var _0x29726a={},_0x3eca14={},_0x306802={'count':0x0,'rows':[]};var _0x43d5f7=_[_0x743e('0x27')](db[_0x743e('0x28')]['rawAttributes'],function(_0x333d35){return{'name':_0x333d35[_0x743e('0x29')],'type':_0x333d35[_0x743e('0x2a')][_0x743e('0x2b')]};});_0x3eca14[_0x743e('0x2c')]=_[_0x743e('0x27')](_0x43d5f7,_0x743e('0x25'));_0x3eca14[_0x743e('0x2d')]=_[_0x743e('0x2e')](_0x1f9449[_0x743e('0x2d')]);_0x3eca14[_0x743e('0x2f')]=_[_0x743e('0x30')](_0x3eca14[_0x743e('0x2c')],_0x3eca14['query']);_0x29726a[_0x743e('0x31')]=_[_0x743e('0x30')](_0x3eca14[_0x743e('0x2c')],qs[_0x743e('0x32')](_0x1f9449[_0x743e('0x2d')][_0x743e('0x32')]));_0x29726a[_0x743e('0x31')]=_0x29726a[_0x743e('0x31')]['length']?_0x29726a['attributes']:_0x3eca14[_0x743e('0x2c')];if(!_0x1f9449[_0x743e('0x2d')][_0x743e('0x33')](_0x743e('0x34'))){_0x29726a['limit']=qs[_0x743e('0x1b')](_0x1f9449['query'][_0x743e('0x1b')]);_0x29726a['offset']=qs['offset'](_0x1f9449[_0x743e('0x2d')][_0x743e('0x1c')]);}_0x29726a[_0x743e('0x35')]=qs[_0x743e('0x36')](_0x1f9449[_0x743e('0x2d')]['sort']);_0x29726a[_0x743e('0x37')]=qs['filters'](_['pick'](_0x1f9449[_0x743e('0x2d')],_0x3eca14[_0x743e('0x2f')]),_0x43d5f7);if(_0x1f9449[_0x743e('0x2d')][_0x743e('0x38')]){_0x29726a[_0x743e('0x37')]=_['merge'](_0x29726a[_0x743e('0x37')],{'$or':_['map'](_0x43d5f7,function(_0x53c439){if(_0x53c439[_0x743e('0x2a')]!==_0x743e('0x39')){var _0x1e2d35={};_0x1e2d35[_0x53c439['name']]={'$like':'%'+_0x1f9449[_0x743e('0x2d')][_0x743e('0x38')]+'%'};return _0x1e2d35;}})});}_0x29726a=_[_0x743e('0x3a')]({},_0x29726a,_0x1f9449[_0x743e('0x3b')]);var _0x1ae9ce={'where':_0x29726a['where']};return db['MailServerOut'][_0x743e('0x1d')](_0x1ae9ce)[_0x743e('0x21')](function(_0x4938d2){_0x306802['count']=_0x4938d2;if(_0x1f9449[_0x743e('0x2d')][_0x743e('0x3c')]){_0x29726a[_0x743e('0x3d')]=[{'all':!![]}];}return db[_0x743e('0x28')][_0x743e('0x3e')](_0x29726a);})[_0x743e('0x21')](function(_0x1f33cf){_0x306802[_0x743e('0x3f')]=_0x1f33cf;return _0x306802;})['then'](respondWithFilteredResult(_0x3375af,_0x29726a))[_0x743e('0x40')](handleError(_0x3375af,null));};exports['show']=function(_0x2f91bb,_0x5a3ece){var _0xc2f085={'raw':!![],'where':{'id':_0x2f91bb[_0x743e('0x41')]['id']}},_0x5c6029={};_0x5c6029[_0x743e('0x2c')]=_['keys'](db[_0x743e('0x28')][_0x743e('0x42')]);_0x5c6029[_0x743e('0x2d')]=_[_0x743e('0x2e')](_0x2f91bb[_0x743e('0x2d')]);_0x5c6029[_0x743e('0x2f')]=_[_0x743e('0x30')](_0x5c6029[_0x743e('0x2c')],_0x5c6029['query']);_0xc2f085[_0x743e('0x31')]=_[_0x743e('0x30')](_0x5c6029[_0x743e('0x2c')],qs['fields'](_0x2f91bb['query'][_0x743e('0x32')]));_0xc2f085[_0x743e('0x31')]=_0xc2f085[_0x743e('0x31')][_0x743e('0x43')]?_0xc2f085[_0x743e('0x31')]:_0x5c6029[_0x743e('0x2c')];if(_0x2f91bb[_0x743e('0x2d')]['includeAll']){_0xc2f085['include']=[{'all':!![]}];}_0xc2f085=_[_0x743e('0x3a')]({},_0xc2f085,_0x2f91bb[_0x743e('0x3b')]);return db[_0x743e('0x28')][_0x743e('0x44')](_0xc2f085)[_0x743e('0x21')](handleEntityNotFound(_0x5a3ece,null))[_0x743e('0x21')](respondWithResult(_0x5a3ece,null))[_0x743e('0x40')](handleError(_0x5a3ece,null));};exports[_0x743e('0x45')]=function(_0x5efef9,_0x3ca268){return db[_0x743e('0x28')][_0x743e('0x45')](_0x5efef9['body'],{})[_0x743e('0x21')](respondWithResult(_0x3ca268,0xc9))[_0x743e('0x40')](handleError(_0x3ca268,null));};exports['update']=function(_0x141aa1,_0x346d69){if(_0x141aa1[_0x743e('0x46')]['id']){delete _0x141aa1[_0x743e('0x46')]['id'];}return db[_0x743e('0x28')]['find']({'where':{'id':_0x141aa1[_0x743e('0x41')]['id']}})[_0x743e('0x21')](handleEntityNotFound(_0x346d69,null))['then'](saveUpdates(_0x141aa1[_0x743e('0x46')],null))[_0x743e('0x21')](respondWithResult(_0x346d69,null))[_0x743e('0x40')](handleError(_0x346d69,null));};exports[_0x743e('0x22')]=function(_0x28e837,_0x525034){return db[_0x743e('0x28')][_0x743e('0x44')]({'where':{'id':_0x28e837['params']['id']}})[_0x743e('0x21')](handleEntityNotFound(_0x525034,null))[_0x743e('0x21')](removeEntity(_0x525034,null))[_0x743e('0x40')](handleError(_0x525034,null));}; \ No newline at end of file +var _0xef24=['then','stack','name','send','map','MailServerOut','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','set','apply','reject','save','update'];(function(_0x3db13c,_0x172f58){var _0x27286e=function(_0x1df88d){while(--_0x1df88d){_0x3db13c['push'](_0x3db13c['shift']());}};_0x27286e(++_0x172f58);}(_0xef24,0x14d));var _0x4ef2=function(_0x868c10,_0x57fd58){_0x868c10=_0x868c10-0x0;var _0x2845cb=_0xef24[_0x868c10];return _0x2845cb;};'use strict';var emlformat=require(_0x4ef2('0x0'));var rimraf=require(_0x4ef2('0x1'));var zipdir=require(_0x4ef2('0x2'));var jsonpatch=require(_0x4ef2('0x3'));var rp=require(_0x4ef2('0x4'));var moment=require(_0x4ef2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4ef2('0x6'));var util=require(_0x4ef2('0x7'));var path=require(_0x4ef2('0x8'));var sox=require(_0x4ef2('0x9'));var csv=require('to-csv');var ejs=require(_0x4ef2('0xa'));var fs=require('fs');var fs_extra=require(_0x4ef2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4ef2('0xc'));var jsforce=require(_0x4ef2('0xd'));var deskjs=require(_0x4ef2('0xe'));var toCsv=require(_0x4ef2('0xf'));var querystring=require(_0x4ef2('0x10'));var Papa=require(_0x4ef2('0x11'));var Redis=require(_0x4ef2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4ef2('0x13'));var as=require(_0x4ef2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ef2('0x15'))(_0x4ef2('0x16'));var utils=require(_0x4ef2('0x17'));var config=require(_0x4ef2('0x18'));var licenseUtil=require(_0x4ef2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3da7bf,_0x1ef044){_0x1ef044=_0x1ef044||0xcc;return function(_0x551381){if(_0x551381){return _0x3da7bf['sendStatus'](_0x1ef044);}return _0x3da7bf[_0x4ef2('0x1a')](_0x1ef044)[_0x4ef2('0x1b')]();};}function respondWithResult(_0x553186,_0x443004){_0x443004=_0x443004||0xc8;return function(_0x35433b){if(_0x35433b){return _0x553186[_0x4ef2('0x1a')](_0x443004)[_0x4ef2('0x1c')](_0x35433b);}};}function respondWithFilteredResult(_0x117f04,_0xf9465c){return function(_0xd5e49f){if(_0xd5e49f){var _0x169aa7=typeof _0xf9465c['offset']===_0x4ef2('0x1d')&&typeof _0xf9465c['limit']===_0x4ef2('0x1d');var _0x548e64=_0xd5e49f[_0x4ef2('0x1e')];var _0x5df41e=_0x169aa7?0x0:_0xf9465c[_0x4ef2('0x1f')];var _0xd5d82d=_0x169aa7?_0xd5e49f[_0x4ef2('0x1e')]:_0xf9465c[_0x4ef2('0x1f')]+_0xf9465c['limit'];var _0x3dc0a2;if(_0xd5d82d>=_0x548e64){_0xd5d82d=_0x548e64;_0x3dc0a2=0xc8;}else{_0x3dc0a2=0xce;}_0x117f04[_0x4ef2('0x1a')](_0x3dc0a2);return _0x117f04[_0x4ef2('0x20')]('Content-Range',_0x5df41e+'-'+_0xd5d82d+'/'+_0x548e64)['json'](_0xd5e49f);}return null;};}function patchUpdates(_0x60e3bc){return function(_0x5cc72c){try{jsonpatch[_0x4ef2('0x21')](_0x5cc72c,_0x60e3bc,!![]);}catch(_0x5a4e5e){return BPromise[_0x4ef2('0x22')](_0x5a4e5e);}return _0x5cc72c[_0x4ef2('0x23')]();};}function saveUpdates(_0xdcf336,_0x5a5989){return function(_0x44b0fd){if(_0x44b0fd){return _0x44b0fd[_0x4ef2('0x24')](_0xdcf336)[_0x4ef2('0x25')](function(_0x593078){return _0x593078;});}return null;};}function removeEntity(_0x34a814,_0x24152f){return function(_0x11f409){if(_0x11f409){return _0x11f409['destroy']()['then'](function(){_0x34a814[_0x4ef2('0x1a')](0xcc)[_0x4ef2('0x1b')]();});}};}function handleEntityNotFound(_0x582832,_0x3bd4d8){return function(_0x23668c){if(!_0x23668c){_0x582832['sendStatus'](0x194);}return _0x23668c;};}function handleError(_0x1e688e,_0x1c6647){_0x1c6647=_0x1c6647||0x1f4;return function(_0x5c17c7){logger['error'](_0x5c17c7[_0x4ef2('0x26')]);if(_0x5c17c7[_0x4ef2('0x27')]){delete _0x5c17c7[_0x4ef2('0x27')];}_0x1e688e[_0x4ef2('0x1a')](_0x1c6647)[_0x4ef2('0x28')](_0x5c17c7);};}exports['index']=function(_0x54bf9e,_0x3c210b){var _0x61e570={},_0x5da576={},_0x3b8d78={'count':0x0,'rows':[]};var _0x202b89=_[_0x4ef2('0x29')](db[_0x4ef2('0x2a')][_0x4ef2('0x2b')],function(_0xceb359){return{'name':_0xceb359['fieldName'],'type':_0xceb359[_0x4ef2('0x2c')][_0x4ef2('0x2d')]};});_0x5da576[_0x4ef2('0x2e')]=_[_0x4ef2('0x29')](_0x202b89,_0x4ef2('0x27'));_0x5da576['query']=_[_0x4ef2('0x2f')](_0x54bf9e[_0x4ef2('0x30')]);_0x5da576[_0x4ef2('0x31')]=_[_0x4ef2('0x32')](_0x5da576[_0x4ef2('0x2e')],_0x5da576[_0x4ef2('0x30')]);_0x61e570[_0x4ef2('0x33')]=_['intersection'](_0x5da576['model'],qs['fields'](_0x54bf9e[_0x4ef2('0x30')][_0x4ef2('0x34')]));_0x61e570[_0x4ef2('0x33')]=_0x61e570['attributes'][_0x4ef2('0x35')]?_0x61e570[_0x4ef2('0x33')]:_0x5da576[_0x4ef2('0x2e')];if(!_0x54bf9e[_0x4ef2('0x30')][_0x4ef2('0x36')]('nolimit')){_0x61e570[_0x4ef2('0x37')]=qs['limit'](_0x54bf9e[_0x4ef2('0x30')][_0x4ef2('0x37')]);_0x61e570[_0x4ef2('0x1f')]=qs[_0x4ef2('0x1f')](_0x54bf9e[_0x4ef2('0x30')][_0x4ef2('0x1f')]);}_0x61e570[_0x4ef2('0x38')]=qs['sort'](_0x54bf9e[_0x4ef2('0x30')][_0x4ef2('0x39')]);_0x61e570[_0x4ef2('0x3a')]=qs[_0x4ef2('0x31')](_[_0x4ef2('0x3b')](_0x54bf9e['query'],_0x5da576[_0x4ef2('0x31')]),_0x202b89);if(_0x54bf9e[_0x4ef2('0x30')][_0x4ef2('0x3c')]){_0x61e570[_0x4ef2('0x3a')]=_['merge'](_0x61e570[_0x4ef2('0x3a')],{'$or':_[_0x4ef2('0x29')](_0x202b89,function(_0x256e65){if(_0x256e65[_0x4ef2('0x2c')]!==_0x4ef2('0x3d')){var _0x1f471c={};_0x1f471c[_0x256e65[_0x4ef2('0x27')]]={'$like':'%'+_0x54bf9e[_0x4ef2('0x30')][_0x4ef2('0x3c')]+'%'};return _0x1f471c;}})});}_0x61e570=_[_0x4ef2('0x3e')]({},_0x61e570,_0x54bf9e['options']);var _0x396d4a={'where':_0x61e570[_0x4ef2('0x3a')]};return db[_0x4ef2('0x2a')][_0x4ef2('0x1e')](_0x396d4a)[_0x4ef2('0x25')](function(_0x180185){_0x3b8d78['count']=_0x180185;if(_0x54bf9e[_0x4ef2('0x30')][_0x4ef2('0x3f')]){_0x61e570['include']=[{'all':!![]}];}return db[_0x4ef2('0x2a')][_0x4ef2('0x40')](_0x61e570);})[_0x4ef2('0x25')](function(_0x11d0f6){_0x3b8d78[_0x4ef2('0x41')]=_0x11d0f6;return _0x3b8d78;})[_0x4ef2('0x25')](respondWithFilteredResult(_0x3c210b,_0x61e570))[_0x4ef2('0x42')](handleError(_0x3c210b,null));};exports[_0x4ef2('0x43')]=function(_0x867de6,_0x400f67){var _0x4d1791={'raw':!![],'where':{'id':_0x867de6[_0x4ef2('0x44')]['id']}},_0x2bb45b={};_0x2bb45b[_0x4ef2('0x2e')]=_['keys'](db['MailServerOut'][_0x4ef2('0x2b')]);_0x2bb45b['query']=_[_0x4ef2('0x2f')](_0x867de6['query']);_0x2bb45b[_0x4ef2('0x31')]=_['intersection'](_0x2bb45b[_0x4ef2('0x2e')],_0x2bb45b[_0x4ef2('0x30')]);_0x4d1791[_0x4ef2('0x33')]=_[_0x4ef2('0x32')](_0x2bb45b[_0x4ef2('0x2e')],qs['fields'](_0x867de6[_0x4ef2('0x30')][_0x4ef2('0x34')]));_0x4d1791[_0x4ef2('0x33')]=_0x4d1791[_0x4ef2('0x33')][_0x4ef2('0x35')]?_0x4d1791['attributes']:_0x2bb45b[_0x4ef2('0x2e')];if(_0x867de6[_0x4ef2('0x30')][_0x4ef2('0x3f')]){_0x4d1791['include']=[{'all':!![]}];}_0x4d1791=_[_0x4ef2('0x3e')]({},_0x4d1791,_0x867de6[_0x4ef2('0x45')]);return db[_0x4ef2('0x2a')][_0x4ef2('0x46')](_0x4d1791)['then'](handleEntityNotFound(_0x400f67,null))[_0x4ef2('0x25')](respondWithResult(_0x400f67,null))[_0x4ef2('0x42')](handleError(_0x400f67,null));};exports[_0x4ef2('0x47')]=function(_0x3f8a4e,_0x543bf3){return db['MailServerOut'][_0x4ef2('0x47')](_0x3f8a4e[_0x4ef2('0x48')],{})[_0x4ef2('0x25')](respondWithResult(_0x543bf3,0xc9))[_0x4ef2('0x42')](handleError(_0x543bf3,null));};exports[_0x4ef2('0x24')]=function(_0x355c6c,_0x525233){if(_0x355c6c['body']['id']){delete _0x355c6c[_0x4ef2('0x48')]['id'];}return db[_0x4ef2('0x2a')][_0x4ef2('0x46')]({'where':{'id':_0x355c6c[_0x4ef2('0x44')]['id']}})[_0x4ef2('0x25')](handleEntityNotFound(_0x525233,null))[_0x4ef2('0x25')](saveUpdates(_0x355c6c[_0x4ef2('0x48')],null))[_0x4ef2('0x25')](respondWithResult(_0x525233,null))[_0x4ef2('0x42')](handleError(_0x525233,null));};exports[_0x4ef2('0x49')]=function(_0x1c0bb1,_0x51c226){return db['MailServerOut']['find']({'where':{'id':_0x1c0bb1[_0x4ef2('0x44')]['id']}})[_0x4ef2('0x25')](handleEntityNotFound(_0x51c226,null))[_0x4ef2('0x25')](removeEntity(_0x51c226,null))['catch'](handleError(_0x51c226,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 11c1900..b260bf7 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 _0xfa8e=['lodash','util','api','moment','bluebird','path','../../config/environment','./mailServerOut.attributes','exports','mail_servers_out'];(function(_0x53c8a5,_0x2a6cd1){var _0xc9e75f=function(_0x1ceabb){while(--_0x1ceabb){_0x53c8a5['push'](_0x53c8a5['shift']());}};_0xc9e75f(++_0x2a6cd1);}(_0xfa8e,0xf0));var _0xefa8=function(_0x4301de,_0x53c8ec){_0x4301de=_0x4301de-0x0;var _0x26612c=_0xfa8e[_0x4301de];return _0x26612c;};'use strict';var _=require(_0xefa8('0x0'));var util=require(_0xefa8('0x1'));var logger=require('../../config/logger')(_0xefa8('0x2'));var moment=require(_0xefa8('0x3'));var BPromise=require(_0xefa8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefa8('0x5'));var rimraf=require('rimraf');var config=require(_0xefa8('0x6'));var attributes=require(_0xefa8('0x7'));module[_0xefa8('0x8')]=function(_0x467d5f,_0x135fa3){return _0x467d5f['define']('MailServerOut',attributes,{'tableName':_0xefa8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdafd=['rimraf','../../config/environment','mail_servers_out','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x2030bb,_0x19ecd2){var _0x54e5b4=function(_0x1bacf5){while(--_0x1bacf5){_0x2030bb['push'](_0x2030bb['shift']());}};_0x54e5b4(++_0x19ecd2);}(_0xdafd,0x1e9));var _0xddaf=function(_0x1a964e,_0x540956){_0x1a964e=_0x1a964e-0x0;var _0x4c2717=_0xdafd[_0x1a964e];return _0x4c2717;};'use strict';var _=require(_0xddaf('0x0'));var util=require(_0xddaf('0x1'));var logger=require(_0xddaf('0x2'))(_0xddaf('0x3'));var moment=require('moment');var BPromise=require(_0xddaf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddaf('0x5'));var rimraf=require(_0xddaf('0x6'));var config=require(_0xddaf('0x7'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x4afa27,_0x54fb64){return _0x4afa27['define']('MailServerOut',attributes,{'tableName':_0xddaf('0x8'),'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 5196116..f751bd2 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 _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(_0x3959a9,_0x56430f){var _0x507f1a=function(_0x26f984){while(--_0x26f984){_0x3959a9['push'](_0x3959a9['shift']());}};_0x507f1a(++_0x56430f);}(_0x1261,0x144));var _0x1126=function(_0x1b6c96,_0x30bd30){_0x1b6c96=_0x1b6c96-0x0;var _0x80e240=_0x1261[_0x1b6c96];return _0x80e240;};'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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x191917,_0x552ff4){var _0x52a7ec=function(_0x27ef7f){while(--_0x27ef7f){_0x191917['push'](_0x191917['shift']());}};_0x52a7ec(++_0x552ff4);}(_0xadb5,0xad));var _0x5adb=function(_0x44da70,_0x172da2){_0x44da70=_0x44da70-0x0;var _0x35f130=_0xadb5[_0x44da70];return _0x35f130;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 040d94e..1148a0a 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 _0x9202=['create','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','post'];(function(_0x1fbe36,_0x1aa550){var _0x340632=function(_0x55d136){while(--_0x55d136){_0x1fbe36['push'](_0x1fbe36['shift']());}};_0x340632(++_0x1aa550);}(_0x9202,0xcd));var _0x2920=function(_0x59305a,_0x42d6aa){_0x59305a=_0x59305a-0x0;var _0x30f8cf=_0x9202[_0x59305a];return _0x30f8cf;};'use strict';var multer=require(_0x2920('0x0'));var util=require(_0x2920('0x1'));var path=require(_0x2920('0x2'));var timeout=require(_0x2920('0x3'));var express=require(_0x2920('0x4'));var router=express[_0x2920('0x5')]();var fs_extra=require(_0x2920('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2920('0x7'));var controller=require(_0x2920('0x8'));router[_0x2920('0x9')]('/',auth[_0x2920('0xa')](),controller[_0x2920('0xb')]);router['get'](_0x2920('0xc'),auth[_0x2920('0xa')](),controller[_0x2920('0xd')]);router[_0x2920('0x9')]('/:id',auth[_0x2920('0xa')](),controller['show']);router[_0x2920('0xe')]('/',auth['isAuthenticated'](),controller[_0x2920('0xf')]);router['put']('/:id',auth[_0x2920('0xa')](),controller[_0x2920('0x10')]);router[_0x2920('0x11')](_0x2920('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x2920('0x13')]=router; \ No newline at end of file +var _0xea02=['update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x5249be,_0x251784){var _0x19ba8e=function(_0x253547){while(--_0x253547){_0x5249be['push'](_0x5249be['shift']());}};_0x19ba8e(++_0x251784);}(_0xea02,0x10b));var _0x2ea0=function(_0x1058f7,_0x4fe464){_0x1058f7=_0x1058f7-0x0;var _0x422ecc=_0xea02[_0x1058f7];return _0x422ecc;};'use strict';var multer=require(_0x2ea0('0x0'));var util=require(_0x2ea0('0x1'));var path=require(_0x2ea0('0x2'));var timeout=require('connect-timeout');var express=require(_0x2ea0('0x3'));var router=express[_0x2ea0('0x4')]();var fs_extra=require(_0x2ea0('0x5'));var auth=require(_0x2ea0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2ea0('0x7'));var controller=require(_0x2ea0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2ea0('0x9')]);router[_0x2ea0('0xa')](_0x2ea0('0xb'),auth[_0x2ea0('0xc')](),controller[_0x2ea0('0xd')]);router[_0x2ea0('0xa')](_0x2ea0('0xe'),auth[_0x2ea0('0xc')](),controller[_0x2ea0('0xf')]);router[_0x2ea0('0x10')]('/',auth[_0x2ea0('0xc')](),controller[_0x2ea0('0x11')]);router[_0x2ea0('0x12')](_0x2ea0('0xe'),auth[_0x2ea0('0xc')](),controller[_0x2ea0('0x13')]);router[_0x2ea0('0x14')](_0x2ea0('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x2ea0('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9acf044..2ddf8ac 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 _0xaa37=['exports','STRING','name','sequelize'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xaa37[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0x7aa3('0x0'));module[_0x7aa3('0x1')]={'name':{'type':Sequelize[_0x7aa3('0x2')],'unique':_0x7aa3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7278=['name','sequelize','exports','STRING'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0x7278,0x161));var _0x8727=function(_0xf86849,_0x3fa849){_0xf86849=_0xf86849-0x0;var _0x248352=_0x7278[_0xf86849];return _0x248352;};'use strict';var Sequelize=require(_0x8727('0x0'));module[_0x8727('0x1')]={'name':{'type':Sequelize[_0x8727('0x2')],'unique':_0x8727('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8727('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8ecd801..b7fc742 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 _0xa1ca=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','MailSubstatus','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','rawAttributes','create','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0xa1ca,0x15c));var _0xaa1c=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0xa1ca[_0x265003];return _0x33c743;};'use strict';var emlformat=require(_0xaa1c('0x0'));var rimraf=require(_0xaa1c('0x1'));var zipdir=require(_0xaa1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa1c('0x3'));var moment=require(_0xaa1c('0x4'));var BPromise=require(_0xaa1c('0x5'));var Mustache=require(_0xaa1c('0x6'));var util=require('util');var path=require('path');var sox=require(_0xaa1c('0x7'));var csv=require(_0xaa1c('0x8'));var ejs=require(_0xaa1c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa1c('0xa'));var squel=require('squel');var crypto=require(_0xaa1c('0xb'));var jsforce=require(_0xaa1c('0xc'));var deskjs=require(_0xaa1c('0xd'));var toCsv=require(_0xaa1c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaa1c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa1c('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xaa1c('0x10'));var config=require(_0xaa1c('0x11'));var licenseUtil=require(_0xaa1c('0x12'));var db=require(_0xaa1c('0x13'))['db'];function respondWithStatusCode(_0x51c6a4,_0x15f992){_0x15f992=_0x15f992||0xcc;return function(_0xc9f0ee){if(_0xc9f0ee){return _0x51c6a4[_0xaa1c('0x14')](_0x15f992);}return _0x51c6a4[_0xaa1c('0x15')](_0x15f992)['end']();};}function respondWithResult(_0x14c231,_0x2fe008){_0x2fe008=_0x2fe008||0xc8;return function(_0x2ecdb5){if(_0x2ecdb5){return _0x14c231[_0xaa1c('0x15')](_0x2fe008)[_0xaa1c('0x16')](_0x2ecdb5);}};}function respondWithFilteredResult(_0x439e03,_0x5932ae){return function(_0x23d440){if(_0x23d440){var _0x37844b=typeof _0x5932ae['offset']==='undefined'&&typeof _0x5932ae['limit']===_0xaa1c('0x17');var _0x563234=_0x23d440[_0xaa1c('0x18')];var _0x402989=_0x37844b?0x0:_0x5932ae[_0xaa1c('0x19')];var _0x15d3d0=_0x37844b?_0x23d440['count']:_0x5932ae[_0xaa1c('0x19')]+_0x5932ae[_0xaa1c('0x1a')];var _0x136d55;if(_0x15d3d0>=_0x563234){_0x15d3d0=_0x563234;_0x136d55=0xc8;}else{_0x136d55=0xce;}_0x439e03[_0xaa1c('0x15')](_0x136d55);return _0x439e03['set'](_0xaa1c('0x1b'),_0x402989+'-'+_0x15d3d0+'/'+_0x563234)['json'](_0x23d440);}return null;};}function patchUpdates(_0x59d205){return function(_0x14510a){try{jsonpatch[_0xaa1c('0x1c')](_0x14510a,_0x59d205,!![]);}catch(_0x4ddb39){return BPromise[_0xaa1c('0x1d')](_0x4ddb39);}return _0x14510a[_0xaa1c('0x1e')]();};}function saveUpdates(_0x232bc6,_0x3a05c1){return function(_0x297d2d){if(_0x297d2d){return _0x297d2d[_0xaa1c('0x1f')](_0x232bc6)[_0xaa1c('0x20')](function(_0x5a165a){return _0x5a165a;});}return null;};}function removeEntity(_0x32475b,_0x423278){return function(_0x461f8c){if(_0x461f8c){return _0x461f8c[_0xaa1c('0x21')]()[_0xaa1c('0x20')](function(){_0x32475b[_0xaa1c('0x15')](0xcc)[_0xaa1c('0x22')]();});}};}function handleEntityNotFound(_0x57f3e9,_0x442cfd){return function(_0x1d351a){if(!_0x1d351a){_0x57f3e9[_0xaa1c('0x14')](0x194);}return _0x1d351a;};}function handleError(_0x2a53dc,_0x2c172e){_0x2c172e=_0x2c172e||0x1f4;return function(_0x30c6ef){logger[_0xaa1c('0x23')](_0x30c6ef[_0xaa1c('0x24')]);if(_0x30c6ef[_0xaa1c('0x25')]){delete _0x30c6ef[_0xaa1c('0x25')];}_0x2a53dc[_0xaa1c('0x15')](_0x2c172e)[_0xaa1c('0x26')](_0x30c6ef);};}exports['index']=function(_0x35bae2,_0x2aa8c3){var _0x4f796b={},_0x2f1db7={},_0x112011={'count':0x0,'rows':[]};var _0x488cb6=_[_0xaa1c('0x27')](db[_0xaa1c('0x28')]['rawAttributes'],function(_0x3eec53){return{'name':_0x3eec53[_0xaa1c('0x29')],'type':_0x3eec53[_0xaa1c('0x2a')]['key']};});_0x2f1db7[_0xaa1c('0x2b')]=_[_0xaa1c('0x27')](_0x488cb6,_0xaa1c('0x25'));_0x2f1db7[_0xaa1c('0x2c')]=_[_0xaa1c('0x2d')](_0x35bae2[_0xaa1c('0x2c')]);_0x2f1db7['filters']=_[_0xaa1c('0x2e')](_0x2f1db7[_0xaa1c('0x2b')],_0x2f1db7['query']);_0x4f796b[_0xaa1c('0x2f')]=_['intersection'](_0x2f1db7[_0xaa1c('0x2b')],qs['fields'](_0x35bae2[_0xaa1c('0x2c')][_0xaa1c('0x30')]));_0x4f796b[_0xaa1c('0x2f')]=_0x4f796b[_0xaa1c('0x2f')][_0xaa1c('0x31')]?_0x4f796b['attributes']:_0x2f1db7['model'];if(!_0x35bae2[_0xaa1c('0x2c')][_0xaa1c('0x32')](_0xaa1c('0x33'))){_0x4f796b[_0xaa1c('0x1a')]=qs[_0xaa1c('0x1a')](_0x35bae2['query']['limit']);_0x4f796b['offset']=qs[_0xaa1c('0x19')](_0x35bae2[_0xaa1c('0x2c')][_0xaa1c('0x19')]);}_0x4f796b[_0xaa1c('0x34')]=qs['sort'](_0x35bae2[_0xaa1c('0x2c')][_0xaa1c('0x35')]);_0x4f796b['where']=qs[_0xaa1c('0x36')](_[_0xaa1c('0x37')](_0x35bae2[_0xaa1c('0x2c')],_0x2f1db7['filters']),_0x488cb6);if(_0x35bae2[_0xaa1c('0x2c')][_0xaa1c('0x38')]){_0x4f796b[_0xaa1c('0x39')]=_['merge'](_0x4f796b['where'],{'$or':_[_0xaa1c('0x27')](_0x488cb6,function(_0x11e93d){if(_0x11e93d[_0xaa1c('0x2a')]!==_0xaa1c('0x3a')){var _0x32c9d6={};_0x32c9d6[_0x11e93d[_0xaa1c('0x25')]]={'$like':'%'+_0x35bae2['query'][_0xaa1c('0x38')]+'%'};return _0x32c9d6;}})});}_0x4f796b=_[_0xaa1c('0x3b')]({},_0x4f796b,_0x35bae2[_0xaa1c('0x3c')]);var _0x16129d={'where':_0x4f796b['where']};return db[_0xaa1c('0x28')][_0xaa1c('0x18')](_0x16129d)[_0xaa1c('0x20')](function(_0x3c9f49){_0x112011[_0xaa1c('0x18')]=_0x3c9f49;if(_0x35bae2[_0xaa1c('0x2c')][_0xaa1c('0x3d')]){_0x4f796b[_0xaa1c('0x3e')]=[{'all':!![]}];}return db[_0xaa1c('0x28')]['findAll'](_0x4f796b);})['then'](function(_0x23c790){_0x112011[_0xaa1c('0x3f')]=_0x23c790;return _0x112011;})[_0xaa1c('0x20')](respondWithFilteredResult(_0x2aa8c3,_0x4f796b))[_0xaa1c('0x40')](handleError(_0x2aa8c3,null));};exports['show']=function(_0x49183b,_0x242a9b){var _0x545707={'raw':!![],'where':{'id':_0x49183b[_0xaa1c('0x41')]['id']}},_0x1c2ac7={};_0x1c2ac7['model']=_[_0xaa1c('0x2d')](db[_0xaa1c('0x28')][_0xaa1c('0x42')]);_0x1c2ac7[_0xaa1c('0x2c')]=_[_0xaa1c('0x2d')](_0x49183b[_0xaa1c('0x2c')]);_0x1c2ac7[_0xaa1c('0x36')]=_[_0xaa1c('0x2e')](_0x1c2ac7[_0xaa1c('0x2b')],_0x1c2ac7['query']);_0x545707['attributes']=_[_0xaa1c('0x2e')](_0x1c2ac7[_0xaa1c('0x2b')],qs[_0xaa1c('0x30')](_0x49183b['query'][_0xaa1c('0x30')]));_0x545707[_0xaa1c('0x2f')]=_0x545707['attributes'][_0xaa1c('0x31')]?_0x545707[_0xaa1c('0x2f')]:_0x1c2ac7['model'];if(_0x49183b['query']['includeAll']){_0x545707[_0xaa1c('0x3e')]=[{'all':!![]}];}_0x545707=_[_0xaa1c('0x3b')]({},_0x545707,_0x49183b['options']);return db[_0xaa1c('0x28')]['find'](_0x545707)[_0xaa1c('0x20')](handleEntityNotFound(_0x242a9b,null))[_0xaa1c('0x20')](respondWithResult(_0x242a9b,null))[_0xaa1c('0x40')](handleError(_0x242a9b,null));};exports[_0xaa1c('0x43')]=function(_0x2455b9,_0x10a1ab){return db[_0xaa1c('0x28')]['create'](_0x2455b9['body'],{})[_0xaa1c('0x20')](respondWithResult(_0x10a1ab,0xc9))[_0xaa1c('0x40')](handleError(_0x10a1ab,null));};exports['update']=function(_0xfe088d,_0x436e4f){if(_0xfe088d['body']['id']){delete _0xfe088d['body']['id'];}return db[_0xaa1c('0x28')][_0xaa1c('0x44')]({'where':{'id':_0xfe088d[_0xaa1c('0x41')]['id']}})[_0xaa1c('0x20')](handleEntityNotFound(_0x436e4f,null))['then'](saveUpdates(_0xfe088d[_0xaa1c('0x45')],null))[_0xaa1c('0x20')](respondWithResult(_0x436e4f,null))['catch'](handleError(_0x436e4f,null));};exports[_0xaa1c('0x21')]=function(_0x4d4811,_0x4156fa){return db['MailSubstatus']['find']({'where':{'id':_0x4d4811['params']['id']}})[_0xaa1c('0x20')](handleEntityNotFound(_0x4156fa,null))[_0xaa1c('0x20')](removeEntity(_0x4156fa,null))[_0xaa1c('0x40')](handleError(_0x4156fa,null));};exports[_0xaa1c('0x46')]=function(_0x121d9f,_0x3d4c38){return db['MailSubstatus'][_0xaa1c('0x46')]()[_0xaa1c('0x20')](respondWithResult(_0x3d4c38,null))[_0xaa1c('0x40')](handleError(_0x3d4c38,null));}; \ No newline at end of file +var _0xd301=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','find','catch','create','body','update','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','offset','count','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','intersection'];(function(_0x26d32a,_0x44552d){var _0x1efdab=function(_0x583cc8){while(--_0x583cc8){_0x26d32a['push'](_0x26d32a['shift']());}};_0x1efdab(++_0x44552d);}(_0xd301,0x104));var _0x1d30=function(_0xcc05ed,_0x44eb83){_0xcc05ed=_0xcc05ed-0x0;var _0x24a2f5=_0xd301[_0xcc05ed];return _0x24a2f5;};'use strict';var emlformat=require(_0x1d30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d30('0x1'));var jsonpatch=require(_0x1d30('0x2'));var rp=require('request-promise');var moment=require(_0x1d30('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1d30('0x4'));var util=require('util');var path=require(_0x1d30('0x5'));var sox=require(_0x1d30('0x6'));var csv=require(_0x1d30('0x7'));var ejs=require(_0x1d30('0x8'));var fs=require('fs');var fs_extra=require(_0x1d30('0x9'));var _=require('lodash');var squel=require(_0x1d30('0xa'));var crypto=require(_0x1d30('0xb'));var jsforce=require(_0x1d30('0xc'));var deskjs=require(_0x1d30('0xd'));var toCsv=require(_0x1d30('0x7'));var querystring=require('querystring');var Papa=require(_0x1d30('0xe'));var Redis=require(_0x1d30('0xf'));var authService=require(_0x1d30('0x10'));var qs=require(_0x1d30('0x11'));var as=require(_0x1d30('0x12'));var hardwareService=require(_0x1d30('0x13'));var logger=require(_0x1d30('0x14'))(_0x1d30('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1d30('0x16'));var db=require(_0x1d30('0x17'))['db'];function respondWithStatusCode(_0x1a6b4c,_0x310a2c){_0x310a2c=_0x310a2c||0xcc;return function(_0x1a84fb){if(_0x1a84fb){return _0x1a6b4c[_0x1d30('0x18')](_0x310a2c);}return _0x1a6b4c[_0x1d30('0x19')](_0x310a2c)['end']();};}function respondWithResult(_0x495707,_0x20fd7f){_0x20fd7f=_0x20fd7f||0xc8;return function(_0x2d60f3){if(_0x2d60f3){return _0x495707[_0x1d30('0x19')](_0x20fd7f)['json'](_0x2d60f3);}};}function respondWithFilteredResult(_0x4be4ea,_0x4a4ab8){return function(_0x3e1851){if(_0x3e1851){var _0x2b0246=typeof _0x4a4ab8['offset']==='undefined'&&typeof _0x4a4ab8[_0x1d30('0x1a')]===_0x1d30('0x1b');var _0x1d8ca8=_0x3e1851['count'];var _0x34be31=_0x2b0246?0x0:_0x4a4ab8[_0x1d30('0x1c')];var _0x31e66f=_0x2b0246?_0x3e1851[_0x1d30('0x1d')]:_0x4a4ab8['offset']+_0x4a4ab8[_0x1d30('0x1a')];var _0x52fecd;if(_0x31e66f>=_0x1d8ca8){_0x31e66f=_0x1d8ca8;_0x52fecd=0xc8;}else{_0x52fecd=0xce;}_0x4be4ea[_0x1d30('0x19')](_0x52fecd);return _0x4be4ea[_0x1d30('0x1e')](_0x1d30('0x1f'),_0x34be31+'-'+_0x31e66f+'/'+_0x1d8ca8)['json'](_0x3e1851);}return null;};}function patchUpdates(_0x23bd62){return function(_0x2e959c){try{jsonpatch[_0x1d30('0x20')](_0x2e959c,_0x23bd62,!![]);}catch(_0x3d9fe8){return BPromise[_0x1d30('0x21')](_0x3d9fe8);}return _0x2e959c[_0x1d30('0x22')]();};}function saveUpdates(_0x1aa7f9,_0x4ad2bf){return function(_0x43947d){if(_0x43947d){return _0x43947d['update'](_0x1aa7f9)['then'](function(_0x46dcb2){return _0x46dcb2;});}return null;};}function removeEntity(_0xc8c7b0,_0x4f0929){return function(_0x4dd72b){if(_0x4dd72b){return _0x4dd72b[_0x1d30('0x23')]()[_0x1d30('0x24')](function(){_0xc8c7b0[_0x1d30('0x19')](0xcc)[_0x1d30('0x25')]();});}};}function handleEntityNotFound(_0x515082,_0x558b32){return function(_0x408d56){if(!_0x408d56){_0x515082[_0x1d30('0x18')](0x194);}return _0x408d56;};}function handleError(_0x1578be,_0x32f972){_0x32f972=_0x32f972||0x1f4;return function(_0xe8c13f){logger[_0x1d30('0x26')](_0xe8c13f[_0x1d30('0x27')]);if(_0xe8c13f[_0x1d30('0x28')]){delete _0xe8c13f[_0x1d30('0x28')];}_0x1578be['status'](_0x32f972)[_0x1d30('0x29')](_0xe8c13f);};}exports[_0x1d30('0x2a')]=function(_0x1066c1,_0x283a48){var _0x3f623f={},_0x284fa0={},_0x2f871f={'count':0x0,'rows':[]};var _0x2af595=_[_0x1d30('0x2b')](db[_0x1d30('0x2c')][_0x1d30('0x2d')],function(_0x46b1f5){return{'name':_0x46b1f5[_0x1d30('0x2e')],'type':_0x46b1f5[_0x1d30('0x2f')][_0x1d30('0x30')]};});_0x284fa0[_0x1d30('0x31')]=_['map'](_0x2af595,'name');_0x284fa0[_0x1d30('0x32')]=_['keys'](_0x1066c1[_0x1d30('0x32')]);_0x284fa0['filters']=_[_0x1d30('0x33')](_0x284fa0[_0x1d30('0x31')],_0x284fa0[_0x1d30('0x32')]);_0x3f623f[_0x1d30('0x34')]=_[_0x1d30('0x33')](_0x284fa0[_0x1d30('0x31')],qs[_0x1d30('0x35')](_0x1066c1[_0x1d30('0x32')][_0x1d30('0x35')]));_0x3f623f[_0x1d30('0x34')]=_0x3f623f[_0x1d30('0x34')][_0x1d30('0x36')]?_0x3f623f['attributes']:_0x284fa0[_0x1d30('0x31')];if(!_0x1066c1[_0x1d30('0x32')][_0x1d30('0x37')](_0x1d30('0x38'))){_0x3f623f[_0x1d30('0x1a')]=qs[_0x1d30('0x1a')](_0x1066c1[_0x1d30('0x32')][_0x1d30('0x1a')]);_0x3f623f[_0x1d30('0x1c')]=qs['offset'](_0x1066c1[_0x1d30('0x32')]['offset']);}_0x3f623f[_0x1d30('0x39')]=qs[_0x1d30('0x3a')](_0x1066c1[_0x1d30('0x32')][_0x1d30('0x3a')]);_0x3f623f[_0x1d30('0x3b')]=qs[_0x1d30('0x3c')](_[_0x1d30('0x3d')](_0x1066c1[_0x1d30('0x32')],_0x284fa0['filters']),_0x2af595);if(_0x1066c1[_0x1d30('0x32')][_0x1d30('0x3e')]){_0x3f623f[_0x1d30('0x3b')]=_[_0x1d30('0x3f')](_0x3f623f['where'],{'$or':_[_0x1d30('0x2b')](_0x2af595,function(_0x56a006){if(_0x56a006[_0x1d30('0x2f')]!==_0x1d30('0x40')){var _0x36e5b5={};_0x36e5b5[_0x56a006[_0x1d30('0x28')]]={'$like':'%'+_0x1066c1[_0x1d30('0x32')][_0x1d30('0x3e')]+'%'};return _0x36e5b5;}})});}_0x3f623f=_[_0x1d30('0x3f')]({},_0x3f623f,_0x1066c1[_0x1d30('0x41')]);var _0x28e244={'where':_0x3f623f[_0x1d30('0x3b')]};return db[_0x1d30('0x2c')][_0x1d30('0x1d')](_0x28e244)[_0x1d30('0x24')](function(_0x18813a){_0x2f871f[_0x1d30('0x1d')]=_0x18813a;if(_0x1066c1[_0x1d30('0x32')][_0x1d30('0x42')]){_0x3f623f['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x1d30('0x43')](_0x3f623f);})[_0x1d30('0x24')](function(_0x33c483){_0x2f871f[_0x1d30('0x44')]=_0x33c483;return _0x2f871f;})[_0x1d30('0x24')](respondWithFilteredResult(_0x283a48,_0x3f623f))['catch'](handleError(_0x283a48,null));};exports[_0x1d30('0x45')]=function(_0x251ad9,_0x34701b){var _0x19b067={'raw':!![],'where':{'id':_0x251ad9[_0x1d30('0x46')]['id']}},_0x4034a4={};_0x4034a4[_0x1d30('0x31')]=_[_0x1d30('0x47')](db[_0x1d30('0x2c')][_0x1d30('0x2d')]);_0x4034a4['query']=_[_0x1d30('0x47')](_0x251ad9['query']);_0x4034a4[_0x1d30('0x3c')]=_[_0x1d30('0x33')](_0x4034a4[_0x1d30('0x31')],_0x4034a4[_0x1d30('0x32')]);_0x19b067[_0x1d30('0x34')]=_['intersection'](_0x4034a4['model'],qs['fields'](_0x251ad9[_0x1d30('0x32')][_0x1d30('0x35')]));_0x19b067[_0x1d30('0x34')]=_0x19b067[_0x1d30('0x34')][_0x1d30('0x36')]?_0x19b067['attributes']:_0x4034a4[_0x1d30('0x31')];if(_0x251ad9[_0x1d30('0x32')][_0x1d30('0x42')]){_0x19b067['include']=[{'all':!![]}];}_0x19b067=_[_0x1d30('0x3f')]({},_0x19b067,_0x251ad9['options']);return db['MailSubstatus'][_0x1d30('0x48')](_0x19b067)[_0x1d30('0x24')](handleEntityNotFound(_0x34701b,null))[_0x1d30('0x24')](respondWithResult(_0x34701b,null))[_0x1d30('0x49')](handleError(_0x34701b,null));};exports[_0x1d30('0x4a')]=function(_0x2db694,_0x4c3281){return db[_0x1d30('0x2c')]['create'](_0x2db694[_0x1d30('0x4b')],{})[_0x1d30('0x24')](respondWithResult(_0x4c3281,0xc9))[_0x1d30('0x49')](handleError(_0x4c3281,null));};exports[_0x1d30('0x4c')]=function(_0x2901fb,_0x4d5eae){if(_0x2901fb[_0x1d30('0x4b')]['id']){delete _0x2901fb[_0x1d30('0x4b')]['id'];}return db[_0x1d30('0x2c')][_0x1d30('0x48')]({'where':{'id':_0x2901fb[_0x1d30('0x46')]['id']}})[_0x1d30('0x24')](handleEntityNotFound(_0x4d5eae,null))[_0x1d30('0x24')](saveUpdates(_0x2901fb[_0x1d30('0x4b')],null))[_0x1d30('0x24')](respondWithResult(_0x4d5eae,null))['catch'](handleError(_0x4d5eae,null));};exports[_0x1d30('0x23')]=function(_0x13f721,_0xcbda45){return db[_0x1d30('0x2c')]['find']({'where':{'id':_0x13f721[_0x1d30('0x46')]['id']}})[_0x1d30('0x24')](handleEntityNotFound(_0xcbda45,null))[_0x1d30('0x24')](removeEntity(_0xcbda45,null))['catch'](handleError(_0xcbda45,null));};exports[_0x1d30('0x4d')]=function(_0x1e99d0,_0x4f3122){return db[_0x1d30('0x2c')][_0x1d30('0x4d')]()['then'](respondWithResult(_0x4f3122,null))[_0x1d30('0x49')](handleError(_0x4f3122,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index b8d6c0d..b67bafd 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 _0xd318=['MailSubstatus','setMaxListeners','update','emit','hook','events','../../mysqldb'];(function(_0x187fe2,_0x77b5e1){var _0x535f3a=function(_0x24449b){while(--_0x24449b){_0x187fe2['push'](_0x187fe2['shift']());}};_0x535f3a(++_0x77b5e1);}(_0xd318,0x15c));var _0x8d31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd318[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x8d31('0x0'));var MailSubstatus=require(_0x8d31('0x1'))['db'][_0x8d31('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8d31('0x3')](0x0);var events={'afterUpdate':_0x8d31('0x4')};function emitEvent(_0x5b9a1d){return function(_0x3896b2,_0x2b0a9a,_0x7b235c){MailSubstatusEvents['emit'](_0x5b9a1d+':'+_0x3896b2['id'],_0x3896b2);MailSubstatusEvents[_0x8d31('0x5')](_0x5b9a1d,_0x3896b2);_0x7b235c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x8d31('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x7dc6=['update','emit','hasOwnProperty','hook','MailSubstatus'];(function(_0x3d8130,_0x251d7c){var _0x30f7ba=function(_0x535a09){while(--_0x535a09){_0x3d8130['push'](_0x3d8130['shift']());}};_0x30f7ba(++_0x251d7c);}(_0x7dc6,0x112));var _0x67dc=function(_0x49491f,_0x3f021c){_0x49491f=_0x49491f-0x0;var _0x379a29=_0x7dc6[_0x49491f];return _0x379a29;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x67dc('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x67dc('0x1')};function emitEvent(_0x5c6f4a){return function(_0x3b2bcb,_0x2a72ca,_0x492b48){MailSubstatusEvents[_0x67dc('0x2')](_0x5c6f4a+':'+_0x3b2bcb['id'],_0x3b2bcb);MailSubstatusEvents['emit'](_0x5c6f4a,_0x3b2bcb);_0x492b48(null);};}for(var e in events){if(events[_0x67dc('0x3')](e)){var event=events[e];MailSubstatus[_0x67dc('0x4')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 6db9f83..74b7912 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 _0x2d73=['name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','update'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x2d73,0x185));var _0x32d7=function(_0x371d15,_0xd98587){_0x371d15=_0x371d15-0x0;var _0x32afdf=_0x2d73[_0x371d15];return _0x32afdf;};'use strict';var attributes=require(_0x32d7('0x0'));module[_0x32d7('0x1')]=function(_0x56e1d0){var _0x4c2b95=_0x56e1d0[_0x32d7('0x2')];return _0x56e1d0[_0x32d7('0x3')](_0x32d7('0x4'),attributes,{'tableName':_0x32d7('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x346df6,_0x129392,_0x49b460){return _0x4c2b95['Condition'][_0x32d7('0x6')]({'value':_0x346df6[_0x32d7('0x7')]},{'where':{'field':_0x32d7('0x8'),'value':_0x346df6[_0x32d7('0x9')][_0x32d7('0x7')]}})[_0x32d7('0xa')](function(){_0x49b460();})[_0x32d7('0xb')](function(_0x4720a7){_0x49b460(_0x4720a7);});}}});}; \ No newline at end of file +var _0xb6f3=['then','catch','./mailSubstatus.attributes','exports','models','mail_substatuses','update','name','mailSubstatus'];(function(_0x5eca1c,_0x277b5c){var _0x572570=function(_0x420c74){while(--_0x420c74){_0x5eca1c['push'](_0x5eca1c['shift']());}};_0x572570(++_0x277b5c);}(_0xb6f3,0x146));var _0x3b6f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb6f3[_0x1cc8fe];return _0x230054;};'use strict';var attributes=require(_0x3b6f('0x0'));module[_0x3b6f('0x1')]=function(_0x1e476a){var _0x534d4f=_0x1e476a[_0x3b6f('0x2')];return _0x1e476a['define']('MailSubstatus',attributes,{'tableName':_0x3b6f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2b2854,_0x4df2a1,_0x103ecb){return _0x534d4f['Condition'][_0x3b6f('0x4')]({'value':_0x2b2854[_0x3b6f('0x5')]},{'where':{'field':_0x3b6f('0x6'),'value':_0x2b2854['_previousDataValues'][_0x3b6f('0x5')]}})[_0x3b6f('0x7')](function(){_0x103ecb();})[_0x3b6f('0x8')](function(_0x827921){_0x103ecb(_0x827921);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 5e382a3..c331f97 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 _0xef13=['result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xf363b,_0x1f1f4f){var _0x3ea303=function(_0x22dc5c){while(--_0x22dc5c){_0xf363b['push'](_0xf363b['shift']());}};_0x3ea303(++_0x1f1f4f);}(_0xef13,0x1e4));var _0x3ef1=function(_0xc891b4,_0xb495d1){_0xc891b4=_0xc891b4-0x0;var _0x151c6b=_0xef13[_0xc891b4];return _0x151c6b;};'use strict';var _=require(_0x3ef1('0x0'));var util=require('util');var moment=require(_0x3ef1('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ef1('0x2'));var fs=require('fs');var Redis=require(_0x3ef1('0x3'));var db=require(_0x3ef1('0x4'))['db'];var utils=require(_0x3ef1('0x5'));var logger=require(_0x3ef1('0x6'))(_0x3ef1('0x7'));var config=require(_0x3ef1('0x8'));var jayson=require(_0x3ef1('0x9'));var client=jayson[_0x3ef1('0xa')][_0x3ef1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c391,_0xacbf8b,_0x5749e1){return new BPromise(function(_0x443a81,_0x15b52f){return client['request'](_0x54c391,_0x5749e1)[_0x3ef1('0xc')](function(_0xe37ad6){logger[_0x3ef1('0xd')](_0x3ef1('0xe'),_0xacbf8b,'request\x20sent');logger[_0x3ef1('0xf')](_0x3ef1('0x10'),_0xacbf8b,_0x3ef1('0x11'),JSON[_0x3ef1('0x12')](_0xe37ad6));if(_0xe37ad6[_0x3ef1('0x13')]){if(_0xe37ad6['error'][_0x3ef1('0x14')]===0x1f4){logger['error'](_0x3ef1('0xe'),_0xacbf8b,_0xe37ad6[_0x3ef1('0x13')][_0x3ef1('0x15')]);return _0x15b52f(_0xe37ad6[_0x3ef1('0x13')][_0x3ef1('0x15')]);}logger[_0x3ef1('0x13')]('MailSubstatus,\x20%s,\x20%s',_0xacbf8b,_0xe37ad6['error'][_0x3ef1('0x15')]);return _0x443a81(_0xe37ad6[_0x3ef1('0x13')][_0x3ef1('0x15')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0xacbf8b,_0x3ef1('0x11'));_0x443a81(_0xe37ad6[_0x3ef1('0x16')]['message']);}})['catch'](function(_0x565a1f){logger['error'](_0x3ef1('0xe'),_0xacbf8b,_0x565a1f);_0x15b52f(_0x565a1f);});});} \ No newline at end of file +var _0xf856=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf856,0x1aa));var _0x6f85=function(_0x166f8e,_0x10de26){_0x166f8e=_0x166f8e-0x0;var _0x4bbe83=_0xf856[_0x166f8e];return _0x4bbe83;};'use strict';var _=require(_0x6f85('0x0'));var util=require(_0x6f85('0x1'));var moment=require(_0x6f85('0x2'));var BPromise=require(_0x6f85('0x3'));var rs=require(_0x6f85('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f85('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f85('0x6'))(_0x6f85('0x7'));var config=require(_0x6f85('0x8'));var jayson=require(_0x6f85('0x9'));var client=jayson[_0x6f85('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5667fe,_0x52b22c,_0x15bbfa){return new BPromise(function(_0x29ae28,_0x7a2e9e){return client[_0x6f85('0xb')](_0x5667fe,_0x15bbfa)[_0x6f85('0xc')](function(_0x517927){logger[_0x6f85('0xd')](_0x6f85('0xe'),_0x52b22c,_0x6f85('0xf'));logger[_0x6f85('0x10')](_0x6f85('0x11'),_0x52b22c,_0x6f85('0xf'),JSON['stringify'](_0x517927));if(_0x517927[_0x6f85('0x12')]){if(_0x517927[_0x6f85('0x12')][_0x6f85('0x13')]===0x1f4){logger[_0x6f85('0x12')](_0x6f85('0xe'),_0x52b22c,_0x517927[_0x6f85('0x12')][_0x6f85('0x14')]);return _0x7a2e9e(_0x517927['error'][_0x6f85('0x14')]);}logger[_0x6f85('0x12')](_0x6f85('0xe'),_0x52b22c,_0x517927[_0x6f85('0x12')]['message']);return _0x29ae28(_0x517927[_0x6f85('0x12')][_0x6f85('0x14')]);}else{logger[_0x6f85('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x52b22c,'request\x20sent');_0x29ae28(_0x517927['result'][_0x6f85('0x14')]);}})[_0x6f85('0x15')](function(_0x44620d){logger[_0x6f85('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x52b22c,_0x44620d);_0x7a2e9e(_0x44620d);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fe044fe..654c8bd 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 _0x411b=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','multer','util','path','express','../../components/auth/service'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x411b,0xb6));var _0xb411=function(_0x5480dd,_0x14c645){_0x5480dd=_0x5480dd-0x0;var _0x1ea39f=_0x411b[_0x5480dd];return _0x1ea39f;};'use strict';var multer=require(_0xb411('0x0'));var util=require(_0xb411('0x1'));var path=require(_0xb411('0x2'));var timeout=require('connect-timeout');var express=require(_0xb411('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb411('0x4'));var interaction=require(_0xb411('0x5'));var config=require(_0xb411('0x6'));var controller=require(_0xb411('0x7'));router[_0xb411('0x8')]('/',auth[_0xb411('0x9')](),controller['index']);router[_0xb411('0x8')](_0xb411('0xa'),auth[_0xb411('0x9')](),controller[_0xb411('0xb')]);router[_0xb411('0x8')](_0xb411('0xc'),auth[_0xb411('0x9')](),controller[_0xb411('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb411('0xe')](_0xb411('0xc'),auth[_0xb411('0x9')](),controller[_0xb411('0xf')]);router[_0xb411('0x10')]('/:id',auth[_0xb411('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5f74=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','index','describe','isAuthenticated','show','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x1d1aed,_0x4baa6e){var _0x2fbd18=function(_0x321e49){while(--_0x321e49){_0x1d1aed['push'](_0x1d1aed['shift']());}};_0x2fbd18(++_0x4baa6e);}(_0x5f74,0x124));var _0x45f7=function(_0x26556d,_0x403aba){_0x26556d=_0x26556d-0x0;var _0x331ee=_0x5f74[_0x26556d];return _0x331ee;};'use strict';var multer=require(_0x45f7('0x0'));var util=require(_0x45f7('0x1'));var path=require(_0x45f7('0x2'));var timeout=require(_0x45f7('0x3'));var express=require(_0x45f7('0x4'));var router=express[_0x45f7('0x5')]();var fs_extra=require(_0x45f7('0x6'));var auth=require(_0x45f7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x45f7('0x8'));var controller=require(_0x45f7('0x9'));router[_0x45f7('0xa')]('/',auth['isAuthenticated'](),controller[_0x45f7('0xb')]);router[_0x45f7('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x45f7('0xc')]);router['get']('/:id',auth[_0x45f7('0xd')](),controller[_0x45f7('0xe')]);router['post']('/',auth[_0x45f7('0xd')](),controller[_0x45f7('0xf')]);router[_0x45f7('0x10')](_0x45f7('0x11'),auth['isAuthenticated'](),controller[_0x45f7('0x12')]);router[_0x45f7('0x13')](_0x45f7('0x11'),auth[_0x45f7('0xd')](),controller[_0x45f7('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f1f4273..3e9627b 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x14a3cf,_0xae014f){var _0x5bcffb=function(_0x45fdad){while(--_0x45fdad){_0x14a3cf['push'](_0x14a3cf['shift']());}};_0x5bcffb(++_0xae014f);}(_0x008c,0x188));var _0xc008=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0x008c[_0x5ce8b9];return _0xe34be0;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x478760,_0x1daf59){var _0x2dfdc2=function(_0x32db3f){while(--_0x32db3f){_0x478760['push'](_0x478760['shift']());}};_0x2dfdc2(++_0x1daf59);}(_0x70e0,0x17b));var _0x070e=function(_0x554977,_0x5cdaad){_0x554977=_0x554977-0x0;var _0x29a185=_0x70e0[_0x554977];return _0x29a185;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 2a78caa..72c12a5 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 _0xf487=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','sendStatus','error','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','MailTransferReport','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','destroy','describe','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring'];(function(_0x2a2c0f,_0x3957bc){var _0x259560=function(_0x576312){while(--_0x576312){_0x2a2c0f['push'](_0x2a2c0f['shift']());}};_0x259560(++_0x3957bc);}(_0xf487,0x1aa));var _0x7f48=function(_0x32e141,_0x1c35a9){_0x32e141=_0x32e141-0x0;var _0x3bab6b=_0xf487[_0x32e141];return _0x3bab6b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7f48('0x0'));var rp=require(_0x7f48('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f48('0x2'));var path=require(_0x7f48('0x3'));var sox=require(_0x7f48('0x4'));var csv=require(_0x7f48('0x5'));var ejs=require(_0x7f48('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f48('0x7'));var squel=require(_0x7f48('0x8'));var crypto=require(_0x7f48('0x9'));var jsforce=require(_0x7f48('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7f48('0x5'));var querystring=require(_0x7f48('0xb'));var Papa=require(_0x7f48('0xc'));var Redis=require(_0x7f48('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7f48('0xe'));var as=require(_0x7f48('0xf'));var hardwareService=require(_0x7f48('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x7f48('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7f48('0x12'));var db=require(_0x7f48('0x13'))['db'];function respondWithStatusCode(_0x28639e,_0xca3f8f){_0xca3f8f=_0xca3f8f||0xcc;return function(_0x46b9b4){if(_0x46b9b4){return _0x28639e['sendStatus'](_0xca3f8f);}return _0x28639e['status'](_0xca3f8f)[_0x7f48('0x14')]();};}function respondWithResult(_0x247dda,_0x52b59d){_0x52b59d=_0x52b59d||0xc8;return function(_0x1c7d3f){if(_0x1c7d3f){return _0x247dda[_0x7f48('0x15')](_0x52b59d)[_0x7f48('0x16')](_0x1c7d3f);}};}function respondWithFilteredResult(_0x148d7b,_0x560c2e){return function(_0x15fc1a){if(_0x15fc1a){var _0x12f9f1=typeof _0x560c2e['offset']===_0x7f48('0x17')&&typeof _0x560c2e['limit']===_0x7f48('0x17');var _0x1b996b=_0x15fc1a[_0x7f48('0x18')];var _0x11698e=_0x12f9f1?0x0:_0x560c2e[_0x7f48('0x19')];var _0x53fb97=_0x12f9f1?_0x15fc1a[_0x7f48('0x18')]:_0x560c2e[_0x7f48('0x19')]+_0x560c2e[_0x7f48('0x1a')];var _0x281b62;if(_0x53fb97>=_0x1b996b){_0x53fb97=_0x1b996b;_0x281b62=0xc8;}else{_0x281b62=0xce;}_0x148d7b[_0x7f48('0x15')](_0x281b62);return _0x148d7b[_0x7f48('0x1b')](_0x7f48('0x1c'),_0x11698e+'-'+_0x53fb97+'/'+_0x1b996b)[_0x7f48('0x16')](_0x15fc1a);}return null;};}function patchUpdates(_0x498d69){return function(_0x5755a0){try{jsonpatch[_0x7f48('0x1d')](_0x5755a0,_0x498d69,!![]);}catch(_0x3c2812){return BPromise[_0x7f48('0x1e')](_0x3c2812);}return _0x5755a0['save']();};}function saveUpdates(_0x1e5438,_0x3ce79b){return function(_0x316600){if(_0x316600){return _0x316600['update'](_0x1e5438)[_0x7f48('0x1f')](function(_0x183aad){return _0x183aad;});}return null;};}function removeEntity(_0x3b6496,_0x2e20d0){return function(_0x233e91){if(_0x233e91){return _0x233e91['destroy']()['then'](function(){_0x3b6496[_0x7f48('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee3c4,_0x1ca5d9){return function(_0x2efc73){if(!_0x2efc73){_0xee3c4[_0x7f48('0x20')](0x194);}return _0x2efc73;};}function handleError(_0x362eb1,_0x24c9af){_0x24c9af=_0x24c9af||0x1f4;return function(_0x4e0a84){logger[_0x7f48('0x21')](_0x4e0a84['stack']);if(_0x4e0a84[_0x7f48('0x22')]){delete _0x4e0a84[_0x7f48('0x22')];}_0x362eb1['status'](_0x24c9af)[_0x7f48('0x23')](_0x4e0a84);};}exports[_0x7f48('0x24')]=function(_0x1f3da1,_0x17e088){var _0x22cc84={},_0x31e9a8={},_0x5e2f73={'count':0x0,'rows':[]};var _0x17a18f=_[_0x7f48('0x25')](db['MailTransferReport'][_0x7f48('0x26')],function(_0x542703){return{'name':_0x542703['fieldName'],'type':_0x542703['type'][_0x7f48('0x27')]};});_0x31e9a8[_0x7f48('0x28')]=_['map'](_0x17a18f,_0x7f48('0x22'));_0x31e9a8[_0x7f48('0x29')]=_[_0x7f48('0x2a')](_0x1f3da1[_0x7f48('0x29')]);_0x31e9a8[_0x7f48('0x2b')]=_[_0x7f48('0x2c')](_0x31e9a8[_0x7f48('0x28')],_0x31e9a8['query']);_0x22cc84['attributes']=_['intersection'](_0x31e9a8[_0x7f48('0x28')],qs[_0x7f48('0x2d')](_0x1f3da1[_0x7f48('0x29')][_0x7f48('0x2d')]));_0x22cc84[_0x7f48('0x2e')]=_0x22cc84['attributes'][_0x7f48('0x2f')]?_0x22cc84[_0x7f48('0x2e')]:_0x31e9a8['model'];if(!_0x1f3da1['query'][_0x7f48('0x30')](_0x7f48('0x31'))){_0x22cc84[_0x7f48('0x1a')]=qs[_0x7f48('0x1a')](_0x1f3da1[_0x7f48('0x29')][_0x7f48('0x1a')]);_0x22cc84[_0x7f48('0x19')]=qs[_0x7f48('0x19')](_0x1f3da1['query'][_0x7f48('0x19')]);}_0x22cc84[_0x7f48('0x32')]=qs[_0x7f48('0x33')](_0x1f3da1['query'][_0x7f48('0x33')]);_0x22cc84[_0x7f48('0x34')]=qs[_0x7f48('0x2b')](_[_0x7f48('0x35')](_0x1f3da1['query'],_0x31e9a8['filters']),_0x17a18f);if(_0x1f3da1[_0x7f48('0x29')][_0x7f48('0x36')]){_0x22cc84[_0x7f48('0x34')]=_['merge'](_0x22cc84[_0x7f48('0x34')],{'$or':_[_0x7f48('0x25')](_0x17a18f,function(_0x5b253a){if(_0x5b253a[_0x7f48('0x37')]!==_0x7f48('0x38')){var _0x4786d3={};_0x4786d3[_0x5b253a[_0x7f48('0x22')]]={'$like':'%'+_0x1f3da1[_0x7f48('0x29')][_0x7f48('0x36')]+'%'};return _0x4786d3;}})});}_0x22cc84=_[_0x7f48('0x39')]({},_0x22cc84,_0x1f3da1[_0x7f48('0x3a')]);var _0x36d23b={'where':_0x22cc84[_0x7f48('0x34')]};return db[_0x7f48('0x3b')]['count'](_0x36d23b)[_0x7f48('0x1f')](function(_0x93fc16){_0x5e2f73[_0x7f48('0x18')]=_0x93fc16;if(_0x1f3da1[_0x7f48('0x29')][_0x7f48('0x3c')]){_0x22cc84[_0x7f48('0x3d')]=[{'all':!![]}];}return db['MailTransferReport'][_0x7f48('0x3e')](_0x22cc84);})[_0x7f48('0x1f')](function(_0x17d0e6){_0x5e2f73[_0x7f48('0x3f')]=_0x17d0e6;return _0x5e2f73;})[_0x7f48('0x1f')](respondWithFilteredResult(_0x17e088,_0x22cc84))[_0x7f48('0x40')](handleError(_0x17e088,null));};exports[_0x7f48('0x41')]=function(_0x2aec58,_0x3a3a14){var _0x222b65={'raw':!![],'where':{'id':_0x2aec58['params']['id']}},_0x3ee797={};_0x3ee797[_0x7f48('0x28')]=_[_0x7f48('0x2a')](db['MailTransferReport'][_0x7f48('0x26')]);_0x3ee797['query']=_[_0x7f48('0x2a')](_0x2aec58[_0x7f48('0x29')]);_0x3ee797[_0x7f48('0x2b')]=_[_0x7f48('0x2c')](_0x3ee797[_0x7f48('0x28')],_0x3ee797[_0x7f48('0x29')]);_0x222b65['attributes']=_[_0x7f48('0x2c')](_0x3ee797[_0x7f48('0x28')],qs[_0x7f48('0x2d')](_0x2aec58[_0x7f48('0x29')][_0x7f48('0x2d')]));_0x222b65[_0x7f48('0x2e')]=_0x222b65[_0x7f48('0x2e')][_0x7f48('0x2f')]?_0x222b65[_0x7f48('0x2e')]:_0x3ee797[_0x7f48('0x28')];if(_0x2aec58[_0x7f48('0x29')]['includeAll']){_0x222b65[_0x7f48('0x3d')]=[{'all':!![]}];}_0x222b65=_[_0x7f48('0x39')]({},_0x222b65,_0x2aec58[_0x7f48('0x3a')]);return db[_0x7f48('0x3b')][_0x7f48('0x42')](_0x222b65)['then'](handleEntityNotFound(_0x3a3a14,null))['then'](respondWithResult(_0x3a3a14,null))[_0x7f48('0x40')](handleError(_0x3a3a14,null));};exports[_0x7f48('0x43')]=function(_0x398053,_0x2559b0){return db[_0x7f48('0x3b')]['create'](_0x398053[_0x7f48('0x44')],{})[_0x7f48('0x1f')](respondWithResult(_0x2559b0,0xc9))[_0x7f48('0x40')](handleError(_0x2559b0,null));};exports[_0x7f48('0x45')]=function(_0x30bff8,_0x3ddefe){if(_0x30bff8[_0x7f48('0x44')]['id']){delete _0x30bff8['body']['id'];}return db[_0x7f48('0x3b')][_0x7f48('0x42')]({'where':{'id':_0x30bff8[_0x7f48('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ddefe,null))['then'](saveUpdates(_0x30bff8['body'],null))[_0x7f48('0x1f')](respondWithResult(_0x3ddefe,null))[_0x7f48('0x40')](handleError(_0x3ddefe,null));};exports[_0x7f48('0x47')]=function(_0x20ff3e,_0x2fe0f2){return db[_0x7f48('0x3b')][_0x7f48('0x42')]({'where':{'id':_0x20ff3e['params']['id']}})['then'](handleEntityNotFound(_0x2fe0f2,null))[_0x7f48('0x1f')](removeEntity(_0x2fe0f2,null))[_0x7f48('0x40')](handleError(_0x2fe0f2,null));};exports[_0x7f48('0x48')]=function(_0x218779,_0x572faa){return db[_0x7f48('0x3b')][_0x7f48('0x48')]()[_0x7f48('0x1f')](respondWithResult(_0x572faa,null))[_0x7f48('0x40')](handleError(_0x572faa,null));}; \ No newline at end of file +var _0xcfd3=['merge','type','VIRTUAL','filter','options','includeAll','rows','show','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where'];(function(_0x2b8660,_0x14cfeb){var _0x8252ce=function(_0x5f0ea0){while(--_0x5f0ea0){_0x2b8660['push'](_0x2b8660['shift']());}};_0x8252ce(++_0x14cfeb);}(_0xcfd3,0xf1));var _0x3cfd=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0xcfd3[_0x2a276d];return _0x2914cd;};'use strict';var emlformat=require(_0x3cfd('0x0'));var rimraf=require(_0x3cfd('0x1'));var zipdir=require(_0x3cfd('0x2'));var jsonpatch=require(_0x3cfd('0x3'));var rp=require(_0x3cfd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3cfd('0x5'));var util=require('util');var path=require(_0x3cfd('0x6'));var sox=require(_0x3cfd('0x7'));var csv=require(_0x3cfd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3cfd('0x9'));var _=require(_0x3cfd('0xa'));var squel=require(_0x3cfd('0xb'));var crypto=require(_0x3cfd('0xc'));var jsforce=require(_0x3cfd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3cfd('0xe'));var Redis=require(_0x3cfd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3cfd('0x10'));var as=require(_0x3cfd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cfd('0x12'))(_0x3cfd('0x13'));var utils=require(_0x3cfd('0x14'));var config=require(_0x3cfd('0x15'));var licenseUtil=require(_0x3cfd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x537a14,_0x3a306a){_0x3a306a=_0x3a306a||0xcc;return function(_0x3569bc){if(_0x3569bc){return _0x537a14[_0x3cfd('0x17')](_0x3a306a);}return _0x537a14['status'](_0x3a306a)['end']();};}function respondWithResult(_0x2f0cf9,_0x44f00d){_0x44f00d=_0x44f00d||0xc8;return function(_0x55dc58){if(_0x55dc58){return _0x2f0cf9[_0x3cfd('0x18')](_0x44f00d)[_0x3cfd('0x19')](_0x55dc58);}};}function respondWithFilteredResult(_0x4125cd,_0x56d95c){return function(_0x57b94a){if(_0x57b94a){var _0x406039=typeof _0x56d95c[_0x3cfd('0x1a')]===_0x3cfd('0x1b')&&typeof _0x56d95c['limit']===_0x3cfd('0x1b');var _0x1557b8=_0x57b94a[_0x3cfd('0x1c')];var _0x439c78=_0x406039?0x0:_0x56d95c[_0x3cfd('0x1a')];var _0x5ad9e9=_0x406039?_0x57b94a['count']:_0x56d95c[_0x3cfd('0x1a')]+_0x56d95c[_0x3cfd('0x1d')];var _0x35d7b7;if(_0x5ad9e9>=_0x1557b8){_0x5ad9e9=_0x1557b8;_0x35d7b7=0xc8;}else{_0x35d7b7=0xce;}_0x4125cd[_0x3cfd('0x18')](_0x35d7b7);return _0x4125cd[_0x3cfd('0x1e')](_0x3cfd('0x1f'),_0x439c78+'-'+_0x5ad9e9+'/'+_0x1557b8)[_0x3cfd('0x19')](_0x57b94a);}return null;};}function patchUpdates(_0x14a84f){return function(_0x49c296){try{jsonpatch[_0x3cfd('0x20')](_0x49c296,_0x14a84f,!![]);}catch(_0x53ca44){return BPromise[_0x3cfd('0x21')](_0x53ca44);}return _0x49c296[_0x3cfd('0x22')]();};}function saveUpdates(_0x5cdea9,_0x18f340){return function(_0x5e3752){if(_0x5e3752){return _0x5e3752[_0x3cfd('0x23')](_0x5cdea9)['then'](function(_0x18b758){return _0x18b758;});}return null;};}function removeEntity(_0x5cd532,_0x30667a){return function(_0x32b0be){if(_0x32b0be){return _0x32b0be['destroy']()[_0x3cfd('0x24')](function(){_0x5cd532[_0x3cfd('0x18')](0xcc)[_0x3cfd('0x25')]();});}};}function handleEntityNotFound(_0x44504a,_0x422af4){return function(_0x4d0d28){if(!_0x4d0d28){_0x44504a[_0x3cfd('0x17')](0x194);}return _0x4d0d28;};}function handleError(_0x5ba6b7,_0x1127f6){_0x1127f6=_0x1127f6||0x1f4;return function(_0x2b861a){logger[_0x3cfd('0x26')](_0x2b861a[_0x3cfd('0x27')]);if(_0x2b861a[_0x3cfd('0x28')]){delete _0x2b861a[_0x3cfd('0x28')];}_0x5ba6b7[_0x3cfd('0x18')](_0x1127f6)['send'](_0x2b861a);};}exports[_0x3cfd('0x29')]=function(_0x20b391,_0x2d73b5){var _0xc6e00={},_0x29729f={},_0xda93a8={'count':0x0,'rows':[]};var _0x1e8f72=_[_0x3cfd('0x2a')](db[_0x3cfd('0x2b')][_0x3cfd('0x2c')],function(_0x596361){return{'name':_0x596361[_0x3cfd('0x2d')],'type':_0x596361['type'][_0x3cfd('0x2e')]};});_0x29729f[_0x3cfd('0x2f')]=_[_0x3cfd('0x2a')](_0x1e8f72,_0x3cfd('0x28'));_0x29729f['query']=_[_0x3cfd('0x30')](_0x20b391[_0x3cfd('0x31')]);_0x29729f[_0x3cfd('0x32')]=_['intersection'](_0x29729f[_0x3cfd('0x2f')],_0x29729f[_0x3cfd('0x31')]);_0xc6e00[_0x3cfd('0x33')]=_[_0x3cfd('0x34')](_0x29729f[_0x3cfd('0x2f')],qs['fields'](_0x20b391[_0x3cfd('0x31')][_0x3cfd('0x35')]));_0xc6e00[_0x3cfd('0x33')]=_0xc6e00[_0x3cfd('0x33')][_0x3cfd('0x36')]?_0xc6e00['attributes']:_0x29729f[_0x3cfd('0x2f')];if(!_0x20b391[_0x3cfd('0x31')]['hasOwnProperty'](_0x3cfd('0x37'))){_0xc6e00[_0x3cfd('0x1d')]=qs[_0x3cfd('0x1d')](_0x20b391[_0x3cfd('0x31')][_0x3cfd('0x1d')]);_0xc6e00['offset']=qs[_0x3cfd('0x1a')](_0x20b391[_0x3cfd('0x31')]['offset']);}_0xc6e00[_0x3cfd('0x38')]=qs[_0x3cfd('0x39')](_0x20b391['query']['sort']);_0xc6e00[_0x3cfd('0x3a')]=qs[_0x3cfd('0x32')](_['pick'](_0x20b391[_0x3cfd('0x31')],_0x29729f[_0x3cfd('0x32')]),_0x1e8f72);if(_0x20b391[_0x3cfd('0x31')]['filter']){_0xc6e00[_0x3cfd('0x3a')]=_[_0x3cfd('0x3b')](_0xc6e00[_0x3cfd('0x3a')],{'$or':_[_0x3cfd('0x2a')](_0x1e8f72,function(_0x13ab23){if(_0x13ab23[_0x3cfd('0x3c')]!==_0x3cfd('0x3d')){var _0x1ffa6f={};_0x1ffa6f[_0x13ab23[_0x3cfd('0x28')]]={'$like':'%'+_0x20b391[_0x3cfd('0x31')][_0x3cfd('0x3e')]+'%'};return _0x1ffa6f;}})});}_0xc6e00=_['merge']({},_0xc6e00,_0x20b391[_0x3cfd('0x3f')]);var _0x2272ab={'where':_0xc6e00[_0x3cfd('0x3a')]};return db[_0x3cfd('0x2b')][_0x3cfd('0x1c')](_0x2272ab)[_0x3cfd('0x24')](function(_0x3ebcf8){_0xda93a8[_0x3cfd('0x1c')]=_0x3ebcf8;if(_0x20b391[_0x3cfd('0x31')][_0x3cfd('0x40')]){_0xc6e00['include']=[{'all':!![]}];}return db[_0x3cfd('0x2b')]['findAll'](_0xc6e00);})[_0x3cfd('0x24')](function(_0x18c6bc){_0xda93a8[_0x3cfd('0x41')]=_0x18c6bc;return _0xda93a8;})['then'](respondWithFilteredResult(_0x2d73b5,_0xc6e00))['catch'](handleError(_0x2d73b5,null));};exports[_0x3cfd('0x42')]=function(_0x42a0a1,_0xac7e74){var _0x3aa78f={'raw':!![],'where':{'id':_0x42a0a1[_0x3cfd('0x43')]['id']}},_0x5105e7={};_0x5105e7[_0x3cfd('0x2f')]=_['keys'](db['MailTransferReport'][_0x3cfd('0x2c')]);_0x5105e7[_0x3cfd('0x31')]=_['keys'](_0x42a0a1['query']);_0x5105e7[_0x3cfd('0x32')]=_['intersection'](_0x5105e7[_0x3cfd('0x2f')],_0x5105e7['query']);_0x3aa78f[_0x3cfd('0x33')]=_[_0x3cfd('0x34')](_0x5105e7['model'],qs[_0x3cfd('0x35')](_0x42a0a1[_0x3cfd('0x31')][_0x3cfd('0x35')]));_0x3aa78f[_0x3cfd('0x33')]=_0x3aa78f[_0x3cfd('0x33')]['length']?_0x3aa78f['attributes']:_0x5105e7[_0x3cfd('0x2f')];if(_0x42a0a1[_0x3cfd('0x31')][_0x3cfd('0x40')]){_0x3aa78f[_0x3cfd('0x44')]=[{'all':!![]}];}_0x3aa78f=_[_0x3cfd('0x3b')]({},_0x3aa78f,_0x42a0a1['options']);return db['MailTransferReport'][_0x3cfd('0x45')](_0x3aa78f)[_0x3cfd('0x24')](handleEntityNotFound(_0xac7e74,null))['then'](respondWithResult(_0xac7e74,null))[_0x3cfd('0x46')](handleError(_0xac7e74,null));};exports[_0x3cfd('0x47')]=function(_0x183937,_0xf3b900){return db['MailTransferReport'][_0x3cfd('0x47')](_0x183937[_0x3cfd('0x48')],{})[_0x3cfd('0x24')](respondWithResult(_0xf3b900,0xc9))[_0x3cfd('0x46')](handleError(_0xf3b900,null));};exports[_0x3cfd('0x23')]=function(_0x282228,_0x1c60ca){if(_0x282228[_0x3cfd('0x48')]['id']){delete _0x282228[_0x3cfd('0x48')]['id'];}return db[_0x3cfd('0x2b')][_0x3cfd('0x45')]({'where':{'id':_0x282228[_0x3cfd('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c60ca,null))[_0x3cfd('0x24')](saveUpdates(_0x282228[_0x3cfd('0x48')],null))[_0x3cfd('0x24')](respondWithResult(_0x1c60ca,null))[_0x3cfd('0x46')](handleError(_0x1c60ca,null));};exports[_0x3cfd('0x49')]=function(_0x1c9e9c,_0xe280f0){return db['MailTransferReport'][_0x3cfd('0x45')]({'where':{'id':_0x1c9e9c['params']['id']}})['then'](handleEntityNotFound(_0xe280f0,null))['then'](removeEntity(_0xe280f0,null))[_0x3cfd('0x46')](handleError(_0xe280f0,null));};exports[_0x3cfd('0x4a')]=function(_0x56650f,_0x5025b8){return db['MailTransferReport']['describe']()[_0x3cfd('0x24')](respondWithResult(_0x5025b8,null))['catch'](handleError(_0x5025b8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0478429..6dcd9fc 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 _0x9a19=['exports','define','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x9a19,0x114));var _0x99a1=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x9a19[_0x469a3c];return _0x968f4;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x99a1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','../../config/logger'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x1cb9,0x14e));var _0x91cb=function(_0x55bc03,_0xfe3148){_0x55bc03=_0x55bc03-0x0;var _0x3f8f73=_0x1cb9[_0x55bc03];return _0x3f8f73;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 0a9c7c6..00bceac 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 _0xa77d=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x11ff33,_0x363d9d){var _0x43618e=function(_0x361d82){while(--_0x361d82){_0x11ff33['push'](_0x11ff33['shift']());}};_0x43618e(++_0x363d9d);}(_0xa77d,0xbc));var _0xda77=function(_0x4d3246,_0x2f6788){_0x4d3246=_0x4d3246-0x0;var _0x438750=_0xa77d[_0x4d3246];return _0x438750;};'use strict';var _=require(_0xda77('0x0'));var util=require(_0xda77('0x1'));var moment=require(_0xda77('0x2'));var BPromise=require(_0xda77('0x3'));var rs=require(_0xda77('0x4'));var fs=require('fs');var Redis=require(_0xda77('0x5'));var db=require(_0xda77('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xda77('0x7'))('rpc');var config=require(_0xda77('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xda77('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ace30,_0x559cb3,_0x21583e){return new BPromise(function(_0xbecca5,_0x3024db){return client[_0xda77('0xa')](_0x4ace30,_0x21583e)[_0xda77('0xb')](function(_0x49316e){logger['info'](_0xda77('0xc'),_0x559cb3,_0xda77('0xd'));logger[_0xda77('0xe')](_0xda77('0xf'),_0x559cb3,_0xda77('0xd'),JSON[_0xda77('0x10')](_0x49316e));if(_0x49316e[_0xda77('0x11')]){if(_0x49316e[_0xda77('0x11')][_0xda77('0x12')]===0x1f4){logger[_0xda77('0x11')](_0xda77('0xc'),_0x559cb3,_0x49316e[_0xda77('0x11')][_0xda77('0x13')]);return _0x3024db(_0x49316e[_0xda77('0x11')][_0xda77('0x13')]);}logger[_0xda77('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x559cb3,_0x49316e[_0xda77('0x11')][_0xda77('0x13')]);return _0xbecca5(_0x49316e[_0xda77('0x11')][_0xda77('0x13')]);}else{logger[_0xda77('0x14')](_0xda77('0xc'),_0x559cb3,_0xda77('0xd'));_0xbecca5(_0x49316e[_0xda77('0x15')][_0xda77('0x13')]);}})[_0xda77('0x16')](function(_0x257956){logger[_0xda77('0x11')](_0xda77('0xc'),_0x559cb3,_0x257956);_0x3024db(_0x257956);});});} \ No newline at end of file +var _0xe71f=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xa40002,_0x5ebe34){var _0x3c7268=function(_0x21ac97){while(--_0x21ac97){_0xa40002['push'](_0xa40002['shift']());}};_0x3c7268(++_0x5ebe34);}(_0xe71f,0xa8));var _0xfe71=function(_0x256a47,_0x9519dd){_0x256a47=_0x256a47-0x0;var _0x1dc6e5=_0xe71f[_0x256a47];return _0x1dc6e5;};'use strict';var _=require(_0xfe71('0x0'));var util=require(_0xfe71('0x1'));var moment=require(_0xfe71('0x2'));var BPromise=require(_0xfe71('0x3'));var rs=require(_0xfe71('0x4'));var fs=require('fs');var Redis=require(_0xfe71('0x5'));var db=require(_0xfe71('0x6'))['db'];var utils=require(_0xfe71('0x7'));var logger=require(_0xfe71('0x8'))(_0xfe71('0x9'));var config=require(_0xfe71('0xa'));var jayson=require(_0xfe71('0xb'));var client=jayson[_0xfe71('0xc')][_0xfe71('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x31766d,_0x538b1b,_0x3e0fd0){return new BPromise(function(_0x24ed51,_0x45d2b0){return client[_0xfe71('0xe')](_0x31766d,_0x3e0fd0)[_0xfe71('0xf')](function(_0x36fa9e){logger[_0xfe71('0x10')](_0xfe71('0x11'),_0x538b1b,_0xfe71('0x12'));logger[_0xfe71('0x13')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x538b1b,'request\x20sent',JSON[_0xfe71('0x14')](_0x36fa9e));if(_0x36fa9e[_0xfe71('0x15')]){if(_0x36fa9e['error'][_0xfe71('0x16')]===0x1f4){logger[_0xfe71('0x15')](_0xfe71('0x11'),_0x538b1b,_0x36fa9e['error'][_0xfe71('0x17')]);return _0x45d2b0(_0x36fa9e[_0xfe71('0x15')]['message']);}logger[_0xfe71('0x15')](_0xfe71('0x11'),_0x538b1b,_0x36fa9e[_0xfe71('0x15')]['message']);return _0x24ed51(_0x36fa9e[_0xfe71('0x15')]['message']);}else{logger['info'](_0xfe71('0x11'),_0x538b1b,_0xfe71('0x12'));_0x24ed51(_0x36fa9e[_0xfe71('0x18')][_0xfe71('0x17')]);}})[_0xfe71('0x19')](function(_0x87a2ce){logger['error'](_0xfe71('0x11'),_0x538b1b,_0x87a2ce);_0x45d2b0(_0x87a2ce);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 787a11c..6bbf342 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 _0xa9b8=['isAuthenticated','describe','show','post','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa9b8,0x170));var _0x8a9b=function(_0x23daa8,_0x29f82b){_0x23daa8=_0x23daa8-0x0;var _0x54c3ba=_0xa9b8[_0x23daa8];return _0x54c3ba;};'use strict';var multer=require(_0x8a9b('0x0'));var util=require(_0x8a9b('0x1'));var path=require('path');var timeout=require(_0x8a9b('0x2'));var express=require(_0x8a9b('0x3'));var router=express[_0x8a9b('0x4')]();var fs_extra=require(_0x8a9b('0x5'));var auth=require(_0x8a9b('0x6'));var interaction=require(_0x8a9b('0x7'));var config=require(_0x8a9b('0x8'));var controller=require('./memberReport.controller');router[_0x8a9b('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a9b('0xa')]);router['get'](_0x8a9b('0xb'),auth[_0x8a9b('0xc')](),controller[_0x8a9b('0xd')]);router['get']('/:id',auth[_0x8a9b('0xc')](),controller[_0x8a9b('0xe')]);router[_0x8a9b('0xf')]('/',auth[_0x8a9b('0xc')](),controller['create']);router['put'](_0x8a9b('0x10'),auth[_0x8a9b('0xc')](),controller['update']);router[_0x8a9b('0x11')](_0x8a9b('0x10'),auth[_0x8a9b('0xc')](),controller[_0x8a9b('0x12')]);module[_0x8a9b('0x13')]=router; \ No newline at end of file +var _0x1527=['isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x314822,_0x223351){var _0xb7555b=function(_0x6dcfa){while(--_0x6dcfa){_0x314822['push'](_0x314822['shift']());}};_0xb7555b(++_0x223351);}(_0x1527,0x173));var _0x7152=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0x1527[_0x31b9cf];return _0x357b8a;};'use strict';var multer=require(_0x7152('0x0'));var util=require(_0x7152('0x1'));var path=require('path');var timeout=require(_0x7152('0x2'));var express=require('express');var router=express[_0x7152('0x3')]();var fs_extra=require(_0x7152('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7152('0x5'));var config=require(_0x7152('0x6'));var controller=require(_0x7152('0x7'));router[_0x7152('0x8')]('/',auth[_0x7152('0x9')](),controller[_0x7152('0xa')]);router[_0x7152('0x8')](_0x7152('0xb'),auth['isAuthenticated'](),controller[_0x7152('0xc')]);router['get'](_0x7152('0xd'),auth[_0x7152('0x9')](),controller[_0x7152('0xe')]);router[_0x7152('0xf')]('/',auth['isAuthenticated'](),controller[_0x7152('0x10')]);router['put'](_0x7152('0xd'),auth[_0x7152('0x9')](),controller['update']);router[_0x7152('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7152('0x12')]);module[_0x7152('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index dd330cb..cae806f 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 _0xfe38=['STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','sequelize','moment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe38,0x84));var _0x8fe3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfe38[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x8fe3('0x0'));var moment=require(_0x8fe3('0x1'));module[_0x8fe3('0x2')]={'channel':{'type':Sequelize[_0x8fe3('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8fe3('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x8fe3('0x4')},'duration':{'type':Sequelize[_0x8fe3('0x5')]},'enterAt':{'type':Sequelize[_0x8fe3('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0xdee30f){var _0x3b07b3=moment(_0xdee30f);var _0x4b2bd1=moment(this[_0x8fe3('0x7')]('enterAt'));var _0x2b24f0=_0x3b07b3[_0x8fe3('0x8')](_0x4b2bd1,_0x8fe3('0x9'));this[_0x8fe3('0xa')]('exitAt',_0xdee30f);this[_0x8fe3('0xa')](_0x8fe3('0xb'),_0x2b24f0>=0x0?_0x2b24f0:null);}},'data1':{'type':Sequelize[_0x8fe3('0x3')],'comment':_0x8fe3('0xc')},'data2':{'type':Sequelize[_0x8fe3('0x3')],'comment':_0x8fe3('0xd')},'data3':{'type':Sequelize[_0x8fe3('0x3')],'comment':_0x8fe3('0xe')},'data4':{'type':Sequelize[_0x8fe3('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x8fe3('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x8fe3('0x3')]},'internal':{'type':Sequelize[_0x8fe3('0x5')]},'uniqueid':{'type':Sequelize[_0x8fe3('0x3')]}}; \ No newline at end of file +var _0x6b02=['LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x257b8a,_0x3d8f02){var _0x258dc3=function(_0x196493){while(--_0x196493){_0x257b8a['push'](_0x257b8a['shift']());}};_0x258dc3(++_0x3d8f02);}(_0x6b02,0x10b));var _0x26b0=function(_0x197213,_0x111561){_0x197213=_0x197213-0x0;var _0x3dd54b=_0x6b02[_0x197213];return _0x3dd54b;};'use strict';var Sequelize=require(_0x26b0('0x0'));var moment=require(_0x26b0('0x1'));module[_0x26b0('0x2')]={'channel':{'type':Sequelize[_0x26b0('0x3')]},'membername':{'type':Sequelize[_0x26b0('0x3')]},'interface':{'type':Sequelize[_0x26b0('0x3')]},'type':{'type':Sequelize[_0x26b0('0x3')],'defaultValue':_0x26b0('0x4'),'comment':_0x26b0('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x26b0('0x6')]},'exitAt':{'type':Sequelize[_0x26b0('0x6')],'set':function(_0x1d9f47){var _0x865e3d=moment(_0x1d9f47);var _0x52b442=moment(this[_0x26b0('0x7')]('enterAt'));var _0x1e2348=_0x865e3d['diff'](_0x52b442,_0x26b0('0x8'));this[_0x26b0('0x9')](_0x26b0('0xa'),_0x1d9f47);this[_0x26b0('0x9')]('duration',_0x1e2348>=0x0?_0x1e2348:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x26b0('0xb')},'data2':{'type':Sequelize[_0x26b0('0x3')],'comment':_0x26b0('0xc')},'data3':{'type':Sequelize[_0x26b0('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x26b0('0x3')],'comment':_0x26b0('0xd')},'data5':{'type':Sequelize[_0x26b0('0x3')],'comment':_0x26b0('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x26b0('0xf')]},'uniqueid':{'type':Sequelize[_0x26b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 9f4a430..91c7a07 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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x3878e9,_0x14fcf2){var _0x2ad526=function(_0x1bd76b){while(--_0x1bd76b){_0x3878e9['push'](_0x3878e9['shift']());}};_0x2ad526(++_0x14fcf2);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +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(_0x5bd780,_0x3fdb54){var _0x5a79e5=function(_0x31e3fc){while(--_0x31e3fc){_0x5bd780['push'](_0x5bd780['shift']());}};_0x5a79e5(++_0x3fdb54);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 4036341..8d91b61 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 _0x2eb4=['rimraf','./memberReport.attributes','MemberReport','report_member','membername_interface','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x127954,_0x3e92ea){var _0x37a21e=function(_0x437769){while(--_0x437769){_0x127954['push'](_0x127954['shift']());}};_0x37a21e(++_0x3e92ea);}(_0x2eb4,0x17f));var _0x42eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2eb4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x42eb('0x0'));var util=require('util');var logger=require(_0x42eb('0x1'))(_0x42eb('0x2'));var moment=require(_0x42eb('0x3'));var BPromise=require(_0x42eb('0x4'));var rp=require(_0x42eb('0x5'));var fs=require('fs');var path=require(_0x42eb('0x6'));var rimraf=require(_0x42eb('0x7'));var config=require('../../config/environment');var attributes=require(_0x42eb('0x8'));module['exports']=function(_0x398892,_0x168e79){return _0x398892['define'](_0x42eb('0x9'),attributes,{'tableName':_0x42eb('0xa'),'paranoid':![],'indexes':[{'name':_0x42eb('0xb'),'fields':['membername',_0x42eb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7e7=['membername_interface','membername','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./memberReport.attributes','MemberReport','report_member'];(function(_0x68fdb0,_0x1229f4){var _0x35881d=function(_0x4d07fe){while(--_0x4d07fe){_0x68fdb0['push'](_0x68fdb0['shift']());}};_0x35881d(++_0x1229f4);}(_0xd7e7,0x10a));var _0x7d7e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd7e7[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x7d7e('0x0'));var util=require(_0x7d7e('0x1'));var logger=require(_0x7d7e('0x2'))(_0x7d7e('0x3'));var moment=require(_0x7d7e('0x4'));var BPromise=require(_0x7d7e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d7e('0x6'));var attributes=require(_0x7d7e('0x7'));module['exports']=function(_0x13d0d2,_0x1b4acf){return _0x13d0d2['define'](_0x7d7e('0x8'),attributes,{'tableName':_0x7d7e('0x9'),'paranoid':![],'indexes':[{'name':_0x7d7e('0xa'),'fields':[_0x7d7e('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 2aa7f3a..bb69e20 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 _0xdbcd=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','findAll','options','raw','limit','include','model','attributes','map','info','debug','CreateMemberReport','MemberReport','create','body','update','where','UpdateMemberReport','lodash','util'];(function(_0x39e4cf,_0x11650b){var _0x1b1e67=function(_0x4b2ea4){while(--_0x4b2ea4){_0x39e4cf['push'](_0x39e4cf['shift']());}};_0x1b1e67(++_0x11650b);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x373ba3,_0x265ccc){_0x373ba3=_0x373ba3-0x0;var _0x151f21=_0xdbcd[_0x373ba3];return _0x151f21;};'use strict';var _=require(_0xddbc('0x0'));var util=require(_0xddbc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xddbc('0x2'));var fs=require('fs');var Redis=require(_0xddbc('0x3'));var db=require(_0xddbc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xddbc('0x5'))(_0xddbc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xddbc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d8331,_0x5b9a2f,_0x5bea89){return new BPromise(function(_0x51f0ae,_0x3b637c){return client[_0xddbc('0x8')](_0x4d8331,_0x5bea89)[_0xddbc('0x9')](function(_0x123450){logger['info']('MemberReport,\x20%s,\x20%s',_0x5b9a2f,_0xddbc('0xa'));logger['debug'](_0xddbc('0xb'),_0x5b9a2f,'request\x20sent',JSON[_0xddbc('0xc')](_0x123450));if(_0x123450[_0xddbc('0xd')]){if(_0x123450[_0xddbc('0xd')][_0xddbc('0xe')]===0x1f4){logger[_0xddbc('0xd')](_0xddbc('0xf'),_0x5b9a2f,_0x123450[_0xddbc('0xd')][_0xddbc('0x10')]);return _0x3b637c(_0x123450[_0xddbc('0xd')][_0xddbc('0x10')]);}logger[_0xddbc('0xd')](_0xddbc('0xf'),_0x5b9a2f,_0x123450['error']['message']);return _0x51f0ae(_0x123450[_0xddbc('0xd')][_0xddbc('0x10')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x5b9a2f,_0xddbc('0xa'));_0x51f0ae(_0x123450[_0xddbc('0x11')][_0xddbc('0x10')]);}})[_0xddbc('0x12')](function(_0x5427b0){logger['error'](_0xddbc('0xf'),_0x5b9a2f,_0x5427b0);_0x3b637c(_0x5427b0);});});}exports[_0xddbc('0x13')]=function(_0x5d0a34){var _0x48efdb=this;return new Promise(function(_0x4cf7ea,_0x870da4){return db['MemberReport'][_0xddbc('0x14')]({'raw':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34[_0xddbc('0x15')][_0xddbc('0x16')]===undefined?!![]:![]:!![],'where':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34[_0xddbc('0x15')]['where']||null:null,'attributes':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34['options']['attributes']||null:null,'limit':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34['options'][_0xddbc('0x17')]||null:null,'include':_0x5d0a34[_0xddbc('0x15')]?_0x5d0a34[_0xddbc('0x15')][_0xddbc('0x18')]?_['map'](_0x5d0a34[_0xddbc('0x15')][_0xddbc('0x18')],function(_0x1d0dfc){return{'model':db[_0x1d0dfc[_0xddbc('0x19')]],'as':_0x1d0dfc['as'],'attributes':_0x1d0dfc[_0xddbc('0x1a')],'include':_0x1d0dfc['include']?_['map'](_0x1d0dfc['include'],function(_0x302120){return{'model':db[_0x302120[_0xddbc('0x19')]],'as':_0x302120['as'],'attributes':_0x302120[_0xddbc('0x1a')],'include':_0x302120[_0xddbc('0x18')]?_[_0xddbc('0x1b')](_0x302120[_0xddbc('0x18')],function(_0x177520){return{'model':db[_0x177520['model']],'as':_0x177520['as'],'attributes':_0x177520[_0xddbc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xddbc('0x9')](function(_0x12bf5b){logger[_0xddbc('0x1c')](_0xddbc('0x13'),_0x5d0a34);logger[_0xddbc('0x1d')](_0xddbc('0x13'),_0x5d0a34,JSON['stringify'](_0x12bf5b));_0x4cf7ea(_0x12bf5b);})[_0xddbc('0x12')](function(_0x158cc0){logger[_0xddbc('0xd')](_0xddbc('0x13'),_0x158cc0['message'],_0x5d0a34);_0x870da4(_0x48efdb[_0xddbc('0xd')](0x1f4,_0x158cc0['message']));});});};exports[_0xddbc('0x1e')]=function(_0x95a9c6){var _0x4d6329=this;return new Promise(function(_0x19d2f0,_0x2e261e){return db[_0xddbc('0x1f')][_0xddbc('0x20')](_0x95a9c6[_0xddbc('0x21')],{'raw':_0x95a9c6['options']?_0x95a9c6[_0xddbc('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xddbc('0x9')](function(_0x35cf8e){logger[_0xddbc('0x1c')](_0xddbc('0x1e'),_0x95a9c6);logger[_0xddbc('0x1d')](_0xddbc('0x1e'),_0x95a9c6,JSON[_0xddbc('0xc')](_0x35cf8e));_0x19d2f0(_0x35cf8e);})[_0xddbc('0x12')](function(_0x4c0b3d){logger[_0xddbc('0xd')](_0xddbc('0x1e'),_0x4c0b3d[_0xddbc('0x10')],_0x95a9c6);_0x2e261e(_0x4d6329['error'](0x1f4,_0x4c0b3d[_0xddbc('0x10')]));});});};exports['UpdateMemberReport']=function(_0x267e6f){var _0x3426ca=this;return new Promise(function(_0x5ba5f4,_0x6e2420){return db['MemberReport'][_0xddbc('0x22')](_0x267e6f['body'],{'raw':_0x267e6f['options']?_0x267e6f[_0xddbc('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x267e6f['options']?_0x267e6f[_0xddbc('0x15')][_0xddbc('0x23')]||null:null,'attributes':_0x267e6f[_0xddbc('0x15')]?_0x267e6f['options']['attributes']||null:null,'limit':_0x267e6f[_0xddbc('0x15')]?_0x267e6f['options'][_0xddbc('0x17')]||null:null})[_0xddbc('0x9')](function(_0x44a022){logger[_0xddbc('0x1c')](_0xddbc('0x24'),_0x267e6f);logger[_0xddbc('0x1d')](_0xddbc('0x24'),_0x267e6f,JSON[_0xddbc('0xc')](_0x44a022));_0x5ba5f4(_0x44a022);})[_0xddbc('0x12')](function(_0x9ff701){logger[_0xddbc('0xd')](_0xddbc('0x24'),_0x9ff701[_0xddbc('0x10')],_0x267e6f);_0x6e2420(_0x3426ca[_0xddbc('0xd')](0x1f4,_0x9ff701['message']));});});}; \ No newline at end of file +var _0x5581=['code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','model','map','then','CreateMemberReport','body','UpdateMemberReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x50c9c8,_0x5b01af){var _0x2e7f91=function(_0x13a8b0){while(--_0x13a8b0){_0x50c9c8['push'](_0x50c9c8['shift']());}};_0x2e7f91(++_0x5b01af);}(_0x5581,0x115));var _0x1558=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x5581[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x1558('0x0'));var util=require('util');var moment=require(_0x1558('0x1'));var BPromise=require(_0x1558('0x2'));var rs=require(_0x1558('0x3'));var fs=require('fs');var Redis=require(_0x1558('0x4'));var db=require(_0x1558('0x5'))['db'];var utils=require(_0x1558('0x6'));var logger=require('../../config/logger')(_0x1558('0x7'));var config=require(_0x1558('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1558('0x9')][_0x1558('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5043c0,_0x3d784e,_0x15c3f2){return new BPromise(function(_0x10082c,_0x18f244){return client[_0x1558('0xb')](_0x5043c0,_0x15c3f2)['then'](function(_0x28fd25){logger[_0x1558('0xc')](_0x1558('0xd'),_0x3d784e,_0x1558('0xe'));logger[_0x1558('0xf')](_0x1558('0x10'),_0x3d784e,_0x1558('0xe'),JSON[_0x1558('0x11')](_0x28fd25));if(_0x28fd25[_0x1558('0x12')]){if(_0x28fd25[_0x1558('0x12')][_0x1558('0x13')]===0x1f4){logger[_0x1558('0x12')](_0x1558('0xd'),_0x3d784e,_0x28fd25['error'][_0x1558('0x14')]);return _0x18f244(_0x28fd25[_0x1558('0x12')][_0x1558('0x14')]);}logger[_0x1558('0x12')](_0x1558('0xd'),_0x3d784e,_0x28fd25[_0x1558('0x12')][_0x1558('0x14')]);return _0x10082c(_0x28fd25[_0x1558('0x12')][_0x1558('0x14')]);}else{logger['info'](_0x1558('0xd'),_0x3d784e,_0x1558('0xe'));_0x10082c(_0x28fd25[_0x1558('0x15')]['message']);}})[_0x1558('0x16')](function(_0x1bd63a){logger[_0x1558('0x12')](_0x1558('0xd'),_0x3d784e,_0x1bd63a);_0x18f244(_0x1bd63a);});});}exports[_0x1558('0x17')]=function(_0x54cbb3){var _0x4f1713=this;return new Promise(function(_0x451547,_0x1868a1){return db[_0x1558('0x18')][_0x1558('0x19')]({'raw':_0x54cbb3[_0x1558('0x1a')]?_0x54cbb3[_0x1558('0x1a')][_0x1558('0x1b')]===undefined?!![]:![]:!![],'where':_0x54cbb3[_0x1558('0x1a')]?_0x54cbb3['options']['where']||null:null,'attributes':_0x54cbb3['options']?_0x54cbb3[_0x1558('0x1a')][_0x1558('0x1c')]||null:null,'limit':_0x54cbb3[_0x1558('0x1a')]?_0x54cbb3[_0x1558('0x1a')][_0x1558('0x1d')]||null:null,'include':_0x54cbb3[_0x1558('0x1a')]?_0x54cbb3[_0x1558('0x1a')][_0x1558('0x1e')]?_['map'](_0x54cbb3[_0x1558('0x1a')]['include'],function(_0x2d64aa){return{'model':db[_0x2d64aa[_0x1558('0x1f')]],'as':_0x2d64aa['as'],'attributes':_0x2d64aa[_0x1558('0x1c')],'include':_0x2d64aa[_0x1558('0x1e')]?_[_0x1558('0x20')](_0x2d64aa[_0x1558('0x1e')],function(_0x2ba561){return{'model':db[_0x2ba561['model']],'as':_0x2ba561['as'],'attributes':_0x2ba561[_0x1558('0x1c')],'include':_0x2ba561[_0x1558('0x1e')]?_[_0x1558('0x20')](_0x2ba561[_0x1558('0x1e')],function(_0xca0eac){return{'model':db[_0xca0eac['model']],'as':_0xca0eac['as'],'attributes':_0xca0eac[_0x1558('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1558('0x21')](function(_0x22737a){logger['info'](_0x1558('0x17'),_0x54cbb3);logger[_0x1558('0xf')](_0x1558('0x17'),_0x54cbb3,JSON['stringify'](_0x22737a));_0x451547(_0x22737a);})[_0x1558('0x16')](function(_0x53b11a){logger[_0x1558('0x12')](_0x1558('0x17'),_0x53b11a['message'],_0x54cbb3);_0x1868a1(_0x4f1713[_0x1558('0x12')](0x1f4,_0x53b11a['message']));});});};exports['CreateMemberReport']=function(_0x37c00a){var _0x3b22cc=this;return new Promise(function(_0x34f021,_0x11a405){return db[_0x1558('0x18')]['create'](_0x37c00a['body'],{'raw':_0x37c00a[_0x1558('0x1a')]?_0x37c00a[_0x1558('0x1a')][_0x1558('0x1b')]===undefined?!![]:![]:!![]})[_0x1558('0x21')](function(_0x26f28f){logger[_0x1558('0xc')]('CreateMemberReport',_0x37c00a);logger[_0x1558('0xf')]('CreateMemberReport',_0x37c00a,JSON[_0x1558('0x11')](_0x26f28f));_0x34f021(_0x26f28f);})[_0x1558('0x16')](function(_0x299ff0){logger[_0x1558('0x12')](_0x1558('0x22'),_0x299ff0[_0x1558('0x14')],_0x37c00a);_0x11a405(_0x3b22cc[_0x1558('0x12')](0x1f4,_0x299ff0[_0x1558('0x14')]));});});};exports['UpdateMemberReport']=function(_0x5961e5){var _0x21a2e9=this;return new Promise(function(_0x19adeb,_0x5f27fa){return db['MemberReport']['update'](_0x5961e5[_0x1558('0x23')],{'raw':_0x5961e5['options']?_0x5961e5[_0x1558('0x1a')][_0x1558('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5961e5['options']?_0x5961e5[_0x1558('0x1a')]['where']||null:null,'attributes':_0x5961e5[_0x1558('0x1a')]?_0x5961e5['options'][_0x1558('0x1c')]||null:null,'limit':_0x5961e5['options']?_0x5961e5[_0x1558('0x1a')][_0x1558('0x1d')]||null:null})[_0x1558('0x21')](function(_0x2ab65f){logger[_0x1558('0xc')](_0x1558('0x24'),_0x5961e5);logger[_0x1558('0xf')](_0x1558('0x24'),_0x5961e5,JSON[_0x1558('0x11')](_0x2ab65f));_0x19adeb(_0x2ab65f);})['catch'](function(_0x5d6b2c){logger[_0x1558('0x12')](_0x1558('0x24'),_0x5d6b2c[_0x1558('0x14')],_0x5961e5);_0x5f27fa(_0x21a2e9[_0x1558('0x12')](0x1f4,_0x5d6b2c[_0x1558('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 481cd7e..2a5fb57 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 _0x0637=['Router','fs-extra','../../components/auth/service','./migration.controller','get','exports','multer','path','connect-timeout','express'];(function(_0x5cc71f,_0x4f6f52){var _0x4e1b52=function(_0x1bea3b){while(--_0x1bea3b){_0x5cc71f['push'](_0x5cc71f['shift']());}};_0x4e1b52(++_0x4f6f52);}(_0x0637,0x7e));var _0x7063=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0637[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7063('0x0'));var util=require('util');var path=require(_0x7063('0x1'));var timeout=require(_0x7063('0x2'));var express=require(_0x7063('0x3'));var router=express[_0x7063('0x4')]();var fs_extra=require(_0x7063('0x5'));var auth=require(_0x7063('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7063('0x7'));router[_0x7063('0x8')]('/',controller['index']);module[_0x7063('0x9')]=router; \ No newline at end of file +var _0xd30e=['./migration.controller','get','index','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x27e43d,_0x1d3048){var _0x592640=function(_0x23fcac){while(--_0x23fcac){_0x27e43d['push'](_0x27e43d['shift']());}};_0x592640(++_0x1d3048);}(_0xd30e,0x130));var _0xed30=function(_0x3378a5,_0x317f7f){_0x3378a5=_0x3378a5-0x0;var _0x43235f=_0xd30e[_0x3378a5];return _0x43235f;};'use strict';var multer=require(_0xed30('0x0'));var util=require(_0xed30('0x1'));var path=require('path');var timeout=require(_0xed30('0x2'));var express=require(_0xed30('0x3'));var router=express['Router']();var fs_extra=require(_0xed30('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed30('0x5'));var controller=require(_0xed30('0x6'));router[_0xed30('0x7')]('/',controller[_0xed30('0x8')]);module[_0xed30('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 3e01f64..1fcfbf8 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 _0x33d6=['STRING','version'];(function(_0x2a4cb5,_0x169075){var _0x5c7fb3=function(_0x559c8f){while(--_0x559c8f){_0x2a4cb5['push'](_0x2a4cb5['shift']());}};_0x5c7fb3(++_0x169075);}(_0x33d6,0x12e));var _0x633d=function(_0xc12455,_0x5f3ff5){_0xc12455=_0xc12455-0x0;var _0x4a4aa4=_0x33d6[_0xc12455];return _0x4a4aa4;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x633d('0x0')],'unique':_0x633d('0x1')}}; \ No newline at end of file +var _0x9470=['exports','STRING','version'];(function(_0xb3205f,_0x13694e){var _0x3eac2d=function(_0x55cf08){while(--_0x55cf08){_0xb3205f['push'](_0xb3205f['shift']());}};_0x3eac2d(++_0x13694e);}(_0x9470,0xea));var _0x0947=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0x9470[_0x49ad79];return _0xa4e38a;};'use strict';var Sequelize=require('sequelize');module[_0x0947('0x0')]={'version':{'type':Sequelize[_0x0947('0x1')],'unique':_0x0947('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 091d2e9..a1950b8 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 _0x7919=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','sendStatus','stack','name','map','Migration','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs'];(function(_0x3686f4,_0xd4a373){var _0x168f2b=function(_0x352038){while(--_0x352038){_0x3686f4['push'](_0x3686f4['shift']());}};_0x168f2b(++_0xd4a373);}(_0x7919,0xeb));var _0x9791=function(_0x3b0e1e,_0x31eb24){_0x3b0e1e=_0x3b0e1e-0x0;var _0x2466b8=_0x7919[_0x3b0e1e];return _0x2466b8;};'use strict';var emlformat=require(_0x9791('0x0'));var rimraf=require(_0x9791('0x1'));var zipdir=require(_0x9791('0x2'));var jsonpatch=require(_0x9791('0x3'));var rp=require(_0x9791('0x4'));var moment=require(_0x9791('0x5'));var BPromise=require(_0x9791('0x6'));var Mustache=require('mustache');var util=require(_0x9791('0x7'));var path=require(_0x9791('0x8'));var sox=require('sox');var csv=require(_0x9791('0x9'));var ejs=require(_0x9791('0xa'));var fs=require('fs');var fs_extra=require(_0x9791('0xb'));var _=require(_0x9791('0xc'));var squel=require(_0x9791('0xd'));var crypto=require('crypto');var jsforce=require(_0x9791('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9791('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9791('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9791('0x10'));var as=require(_0x9791('0x11'));var hardwareService=require(_0x9791('0x12'));var logger=require(_0x9791('0x13'))(_0x9791('0x14'));var utils=require(_0x9791('0x15'));var config=require(_0x9791('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9791('0x17'))['db'];function respondWithStatusCode(_0x54b75d,_0xa2d583){_0xa2d583=_0xa2d583||0xcc;return function(_0x3dc66b){if(_0x3dc66b){return _0x54b75d['sendStatus'](_0xa2d583);}return _0x54b75d[_0x9791('0x18')](_0xa2d583)['end']();};}function respondWithResult(_0x197e83,_0x4602fc){_0x4602fc=_0x4602fc||0xc8;return function(_0x1e05a2){if(_0x1e05a2){return _0x197e83[_0x9791('0x18')](_0x4602fc)[_0x9791('0x19')](_0x1e05a2);}};}function respondWithFilteredResult(_0x1672d9,_0x2bd7a6){return function(_0x3e1eca){if(_0x3e1eca){var _0x1b3626=typeof _0x2bd7a6[_0x9791('0x1a')]===_0x9791('0x1b')&&typeof _0x2bd7a6[_0x9791('0x1c')]===_0x9791('0x1b');var _0x566a69=_0x3e1eca[_0x9791('0x1d')];var _0x402c83=_0x1b3626?0x0:_0x2bd7a6[_0x9791('0x1a')];var _0x2962ae=_0x1b3626?_0x3e1eca[_0x9791('0x1d')]:_0x2bd7a6['offset']+_0x2bd7a6[_0x9791('0x1c')];var _0x6d90c9;if(_0x2962ae>=_0x566a69){_0x2962ae=_0x566a69;_0x6d90c9=0xc8;}else{_0x6d90c9=0xce;}_0x1672d9[_0x9791('0x18')](_0x6d90c9);return _0x1672d9[_0x9791('0x1e')](_0x9791('0x1f'),_0x402c83+'-'+_0x2962ae+'/'+_0x566a69)[_0x9791('0x19')](_0x3e1eca);}return null;};}function patchUpdates(_0x36e5f7){return function(_0x377ec9){try{jsonpatch[_0x9791('0x20')](_0x377ec9,_0x36e5f7,!![]);}catch(_0x27a5e4){return BPromise[_0x9791('0x21')](_0x27a5e4);}return _0x377ec9['save']();};}function saveUpdates(_0x2d29f8,_0x4ec262){return function(_0x4fe98f){if(_0x4fe98f){return _0x4fe98f[_0x9791('0x22')](_0x2d29f8)[_0x9791('0x23')](function(_0x557e2b){return _0x557e2b;});}return null;};}function removeEntity(_0x189251,_0x72e127){return function(_0x7f08c8){if(_0x7f08c8){return _0x7f08c8['destroy']()[_0x9791('0x23')](function(){_0x189251[_0x9791('0x18')](0xcc)[_0x9791('0x24')]();});}};}function handleEntityNotFound(_0x4c3c00,_0x1c188b){return function(_0x5264b6){if(!_0x5264b6){_0x4c3c00[_0x9791('0x25')](0x194);}return _0x5264b6;};}function handleError(_0x15beb8,_0x50760e){_0x50760e=_0x50760e||0x1f4;return function(_0x852e59){logger['error'](_0x852e59[_0x9791('0x26')]);if(_0x852e59['name']){delete _0x852e59[_0x9791('0x27')];}_0x15beb8[_0x9791('0x18')](_0x50760e)['send'](_0x852e59);};}exports['index']=function(_0x55614a,_0x339932){var _0x228703={},_0x24bb84={},_0xf84fe3={'count':0x0,'rows':[]};var _0x52a5d7=_[_0x9791('0x28')](db[_0x9791('0x29')]['rawAttributes'],function(_0x1814fa){return{'name':_0x1814fa[_0x9791('0x2a')],'type':_0x1814fa[_0x9791('0x2b')][_0x9791('0x2c')]};});_0x24bb84[_0x9791('0x2d')]=_[_0x9791('0x28')](_0x52a5d7,'name');_0x24bb84[_0x9791('0x2e')]=_[_0x9791('0x2f')](_0x55614a[_0x9791('0x2e')]);_0x24bb84['filters']=_[_0x9791('0x30')](_0x24bb84['model'],_0x24bb84[_0x9791('0x2e')]);_0x228703['attributes']=_['intersection'](_0x24bb84[_0x9791('0x2d')],qs['fields'](_0x55614a[_0x9791('0x2e')][_0x9791('0x31')]));_0x228703['attributes']=_0x228703[_0x9791('0x32')][_0x9791('0x33')]?_0x228703[_0x9791('0x32')]:_0x24bb84['model'];if(!_0x55614a[_0x9791('0x2e')][_0x9791('0x34')](_0x9791('0x35'))){_0x228703['limit']=qs[_0x9791('0x1c')](_0x55614a['query'][_0x9791('0x1c')]);_0x228703['offset']=qs[_0x9791('0x1a')](_0x55614a[_0x9791('0x2e')]['offset']);}_0x228703[_0x9791('0x36')]=qs[_0x9791('0x37')](_0x55614a[_0x9791('0x2e')][_0x9791('0x37')]);_0x228703[_0x9791('0x38')]=qs['filters'](_[_0x9791('0x39')](_0x55614a[_0x9791('0x2e')],_0x24bb84[_0x9791('0x3a')]),_0x52a5d7);if(_0x55614a[_0x9791('0x2e')][_0x9791('0x3b')]){_0x228703[_0x9791('0x38')]=_[_0x9791('0x3c')](_0x228703['where'],{'$or':_[_0x9791('0x28')](_0x52a5d7,function(_0x36aaef){if(_0x36aaef['type']!==_0x9791('0x3d')){var _0x5ae670={};_0x5ae670[_0x36aaef[_0x9791('0x27')]]={'$like':'%'+_0x55614a[_0x9791('0x2e')]['filter']+'%'};return _0x5ae670;}})});}_0x228703=_[_0x9791('0x3c')]({},_0x228703,_0x55614a['options']);var _0x205471={'where':_0x228703['where']};return db[_0x9791('0x29')]['count'](_0x205471)['then'](function(_0xa96c90){_0xf84fe3[_0x9791('0x1d')]=_0xa96c90;if(_0x55614a['query']['includeAll']){_0x228703[_0x9791('0x3e')]=[{'all':!![]}];}return db[_0x9791('0x29')]['findAll'](_0x228703);})[_0x9791('0x23')](function(_0x4497de){_0xf84fe3['rows']=_0x4497de;return _0xf84fe3;})[_0x9791('0x23')](respondWithFilteredResult(_0x339932,_0x228703))['catch'](handleError(_0x339932,null));}; \ No newline at end of file +var _0x81b8=['filter','merge','count','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','index','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0x228f3e,_0x1e9cea){var _0x18ed32=function(_0x4196a4){while(--_0x4196a4){_0x228f3e['push'](_0x228f3e['shift']());}};_0x18ed32(++_0x1e9cea);}(_0x81b8,0x18a));var _0x881b=function(_0x3050c7,_0x1b4752){_0x3050c7=_0x3050c7-0x0;var _0xf19c45=_0x81b8[_0x3050c7];return _0xf19c45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x881b('0x0'));var zipdir=require(_0x881b('0x1'));var jsonpatch=require(_0x881b('0x2'));var rp=require(_0x881b('0x3'));var moment=require('moment');var BPromise=require(_0x881b('0x4'));var Mustache=require(_0x881b('0x5'));var util=require(_0x881b('0x6'));var path=require(_0x881b('0x7'));var sox=require(_0x881b('0x8'));var csv=require(_0x881b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x881b('0xa'));var squel=require(_0x881b('0xb'));var crypto=require(_0x881b('0xc'));var jsforce=require(_0x881b('0xd'));var deskjs=require(_0x881b('0xe'));var toCsv=require(_0x881b('0x9'));var querystring=require(_0x881b('0xf'));var Papa=require(_0x881b('0x10'));var Redis=require(_0x881b('0x11'));var authService=require(_0x881b('0x12'));var qs=require(_0x881b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x881b('0x14'));var logger=require('../../config/logger')(_0x881b('0x15'));var utils=require(_0x881b('0x16'));var config=require(_0x881b('0x17'));var licenseUtil=require(_0x881b('0x18'));var db=require(_0x881b('0x19'))['db'];function respondWithStatusCode(_0x49bbb2,_0x557c6c){_0x557c6c=_0x557c6c||0xcc;return function(_0x4c8904){if(_0x4c8904){return _0x49bbb2['sendStatus'](_0x557c6c);}return _0x49bbb2[_0x881b('0x1a')](_0x557c6c)[_0x881b('0x1b')]();};}function respondWithResult(_0x5b2a0a,_0xd00ba9){_0xd00ba9=_0xd00ba9||0xc8;return function(_0x9beeb){if(_0x9beeb){return _0x5b2a0a['status'](_0xd00ba9)[_0x881b('0x1c')](_0x9beeb);}};}function respondWithFilteredResult(_0x587050,_0x332ee6){return function(_0x2e4e81){if(_0x2e4e81){var _0x56260d=typeof _0x332ee6[_0x881b('0x1d')]===_0x881b('0x1e')&&typeof _0x332ee6[_0x881b('0x1f')]==='undefined';var _0x2b5317=_0x2e4e81['count'];var _0x231cda=_0x56260d?0x0:_0x332ee6['offset'];var _0x4e285d=_0x56260d?_0x2e4e81['count']:_0x332ee6[_0x881b('0x1d')]+_0x332ee6[_0x881b('0x1f')];var _0x171c94;if(_0x4e285d>=_0x2b5317){_0x4e285d=_0x2b5317;_0x171c94=0xc8;}else{_0x171c94=0xce;}_0x587050[_0x881b('0x1a')](_0x171c94);return _0x587050[_0x881b('0x20')](_0x881b('0x21'),_0x231cda+'-'+_0x4e285d+'/'+_0x2b5317)[_0x881b('0x1c')](_0x2e4e81);}return null;};}function patchUpdates(_0x6fcd9b){return function(_0x1d00be){try{jsonpatch['apply'](_0x1d00be,_0x6fcd9b,!![]);}catch(_0x264dcf){return BPromise['reject'](_0x264dcf);}return _0x1d00be[_0x881b('0x22')]();};}function saveUpdates(_0x498bd4,_0x2530a0){return function(_0x1cb75b){if(_0x1cb75b){return _0x1cb75b[_0x881b('0x23')](_0x498bd4)[_0x881b('0x24')](function(_0x1bfd6e){return _0x1bfd6e;});}return null;};}function removeEntity(_0x4900b8,_0x3a9c18){return function(_0x36565a){if(_0x36565a){return _0x36565a[_0x881b('0x25')]()[_0x881b('0x24')](function(){_0x4900b8[_0x881b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2005e6,_0x1f4180){return function(_0x55e7b6){if(!_0x55e7b6){_0x2005e6[_0x881b('0x26')](0x194);}return _0x55e7b6;};}function handleError(_0x556004,_0x20cd54){_0x20cd54=_0x20cd54||0x1f4;return function(_0x2d46f9){logger[_0x881b('0x27')](_0x2d46f9[_0x881b('0x28')]);if(_0x2d46f9[_0x881b('0x29')]){delete _0x2d46f9[_0x881b('0x29')];}_0x556004[_0x881b('0x1a')](_0x20cd54)['send'](_0x2d46f9);};}exports[_0x881b('0x2a')]=function(_0x58b7bb,_0x49964f){var _0x2a742c={},_0x2157f3={},_0x38eb06={'count':0x0,'rows':[]};var _0x26d7e6=_[_0x881b('0x2b')](db[_0x881b('0x2c')][_0x881b('0x2d')],function(_0x339c42){return{'name':_0x339c42[_0x881b('0x2e')],'type':_0x339c42[_0x881b('0x2f')]['key']};});_0x2157f3[_0x881b('0x30')]=_[_0x881b('0x2b')](_0x26d7e6,_0x881b('0x29'));_0x2157f3[_0x881b('0x31')]=_[_0x881b('0x32')](_0x58b7bb['query']);_0x2157f3[_0x881b('0x33')]=_[_0x881b('0x34')](_0x2157f3[_0x881b('0x30')],_0x2157f3[_0x881b('0x31')]);_0x2a742c[_0x881b('0x35')]=_[_0x881b('0x34')](_0x2157f3[_0x881b('0x30')],qs[_0x881b('0x36')](_0x58b7bb[_0x881b('0x31')][_0x881b('0x36')]));_0x2a742c[_0x881b('0x35')]=_0x2a742c[_0x881b('0x35')][_0x881b('0x37')]?_0x2a742c[_0x881b('0x35')]:_0x2157f3[_0x881b('0x30')];if(!_0x58b7bb['query'][_0x881b('0x38')]('nolimit')){_0x2a742c[_0x881b('0x1f')]=qs[_0x881b('0x1f')](_0x58b7bb[_0x881b('0x31')][_0x881b('0x1f')]);_0x2a742c[_0x881b('0x1d')]=qs[_0x881b('0x1d')](_0x58b7bb[_0x881b('0x31')][_0x881b('0x1d')]);}_0x2a742c[_0x881b('0x39')]=qs[_0x881b('0x3a')](_0x58b7bb[_0x881b('0x31')][_0x881b('0x3a')]);_0x2a742c[_0x881b('0x3b')]=qs[_0x881b('0x33')](_[_0x881b('0x3c')](_0x58b7bb[_0x881b('0x31')],_0x2157f3['filters']),_0x26d7e6);if(_0x58b7bb['query'][_0x881b('0x3d')]){_0x2a742c[_0x881b('0x3b')]=_[_0x881b('0x3e')](_0x2a742c[_0x881b('0x3b')],{'$or':_[_0x881b('0x2b')](_0x26d7e6,function(_0x81b115){if(_0x81b115[_0x881b('0x2f')]!=='VIRTUAL'){var _0x4dbc39={};_0x4dbc39[_0x81b115[_0x881b('0x29')]]={'$like':'%'+_0x58b7bb[_0x881b('0x31')]['filter']+'%'};return _0x4dbc39;}})});}_0x2a742c=_[_0x881b('0x3e')]({},_0x2a742c,_0x58b7bb['options']);var _0x13882b={'where':_0x2a742c['where']};return db[_0x881b('0x2c')]['count'](_0x13882b)[_0x881b('0x24')](function(_0x76a1){_0x38eb06[_0x881b('0x3f')]=_0x76a1;if(_0x58b7bb[_0x881b('0x31')]['includeAll']){_0x2a742c['include']=[{'all':!![]}];}return db[_0x881b('0x2c')]['findAll'](_0x2a742c);})[_0x881b('0x24')](function(_0x6b4c44){_0x38eb06['rows']=_0x6b4c44;return _0x38eb06;})[_0x881b('0x24')](respondWithFilteredResult(_0x49964f,_0x2a742c))[_0x881b('0x40')](handleError(_0x49964f,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index aa3d6dd..61ec610 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 _0x84ec=['bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api'];(function(_0x3a0b04,_0x3d0403){var _0x50a72a=function(_0x4b934e){while(--_0x4b934e){_0x3a0b04['push'](_0x3a0b04['shift']());}};_0x50a72a(++_0x3d0403);}(_0x84ec,0xd5));var _0xc84e=function(_0x584085,_0x449cd9){_0x584085=_0x584085-0x0;var _0x105c58=_0x84ec[_0x584085];return _0x105c58;};'use strict';var _=require(_0xc84e('0x0'));var util=require('util');var logger=require(_0xc84e('0x1'))(_0xc84e('0x2'));var moment=require('moment');var BPromise=require(_0xc84e('0x3'));var rp=require(_0xc84e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc84e('0x5'));var config=require(_0xc84e('0x6'));var attributes=require(_0xc84e('0x7'));module[_0xc84e('0x8')]=function(_0xa8239b,_0x524e3e){return _0xa8239b[_0xc84e('0x9')](_0xc84e('0xa'),attributes,{'tableName':_0xc84e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf624=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define','migrations','lodash','util','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf624,0xbd));var _0x4f62=function(_0x18e473,_0x2b36d4){_0x18e473=_0x18e473-0x0;var _0x24864e=_0xf624[_0x18e473];return _0x24864e;};'use strict';var _=require(_0x4f62('0x0'));var util=require(_0x4f62('0x1'));var logger=require(_0x4f62('0x2'))('api');var moment=require(_0x4f62('0x3'));var BPromise=require(_0x4f62('0x4'));var rp=require(_0x4f62('0x5'));var fs=require('fs');var path=require(_0x4f62('0x6'));var rimraf=require(_0x4f62('0x7'));var config=require(_0x4f62('0x8'));var attributes=require(_0x4f62('0x9'));module['exports']=function(_0x55bbea,_0x3e6b5b){return _0x55bbea[_0x4f62('0xa')]('Migration',attributes,{'tableName':_0x4f62('0xb'),'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 86c3cfb..77be341 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 _0x2d58=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2d58,0x186));var _0x82d5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2d58[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x82d5('0x0'));var util=require(_0x82d5('0x1'));var moment=require(_0x82d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x82d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82d5('0x4'))['db'];var utils=require(_0x82d5('0x5'));var logger=require(_0x82d5('0x6'))(_0x82d5('0x7'));var config=require(_0x82d5('0x8'));var jayson=require(_0x82d5('0x9'));var client=jayson[_0x82d5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd636fe,_0x2f5257,_0x24c9cb){return new BPromise(function(_0x3dea8b,_0x3ff208){return client[_0x82d5('0xb')](_0xd636fe,_0x24c9cb)[_0x82d5('0xc')](function(_0x19d045){logger[_0x82d5('0xd')](_0x82d5('0xe'),_0x2f5257,'request\x20sent');logger[_0x82d5('0xf')](_0x82d5('0x10'),_0x2f5257,_0x82d5('0x11'),JSON[_0x82d5('0x12')](_0x19d045));if(_0x19d045['error']){if(_0x19d045['error'][_0x82d5('0x13')]===0x1f4){logger[_0x82d5('0x14')]('Migration,\x20%s,\x20%s',_0x2f5257,_0x19d045[_0x82d5('0x14')]['message']);return _0x3ff208(_0x19d045[_0x82d5('0x14')][_0x82d5('0x15')]);}logger[_0x82d5('0x14')](_0x82d5('0xe'),_0x2f5257,_0x19d045[_0x82d5('0x14')][_0x82d5('0x15')]);return _0x3dea8b(_0x19d045[_0x82d5('0x14')][_0x82d5('0x15')]);}else{logger['info'](_0x82d5('0xe'),_0x2f5257,_0x82d5('0x11'));_0x3dea8b(_0x19d045['result'][_0x82d5('0x15')]);}})[_0x82d5('0x16')](function(_0x421d58){logger[_0x82d5('0x14')](_0x82d5('0xe'),_0x2f5257,_0x421d58);_0x3ff208(_0x421d58);});});} \ No newline at end of file +var _0xb49a=['info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x29782b,_0x33ff83){var _0x5c2c1f=function(_0x57e6b6){while(--_0x57e6b6){_0x29782b['push'](_0x29782b['shift']());}};_0x5c2c1f(++_0x33ff83);}(_0xb49a,0xfb));var _0xab49=function(_0x4003fe,_0x38c382){_0x4003fe=_0x4003fe-0x0;var _0x5af37c=_0xb49a[_0x4003fe];return _0x5af37c;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var moment=require(_0xab49('0x2'));var BPromise=require(_0xab49('0x3'));var rs=require(_0xab49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x5'))['db'];var utils=require(_0xab49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xab49('0x7'));var jayson=require(_0xab49('0x8'));var client=jayson[_0xab49('0x9')][_0xab49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ea72,_0x26a98a,_0xd86a5){return new BPromise(function(_0x4d4d00,_0x15f259){return client[_0xab49('0xb')](_0x57ea72,_0xd86a5)[_0xab49('0xc')](function(_0x79f764){logger[_0xab49('0xd')]('Migration,\x20%s,\x20%s',_0x26a98a,'request\x20sent');logger[_0xab49('0xe')](_0xab49('0xf'),_0x26a98a,_0xab49('0x10'),JSON[_0xab49('0x11')](_0x79f764));if(_0x79f764[_0xab49('0x12')]){if(_0x79f764['error'][_0xab49('0x13')]===0x1f4){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x15f259(_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);}logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x4d4d00(_0x79f764['error'][_0xab49('0x15')]);}else{logger[_0xab49('0xd')](_0xab49('0x14'),_0x26a98a,_0xab49('0x10'));_0x4d4d00(_0x79f764[_0xab49('0x16')]['message']);}})[_0xab49('0x17')](function(_0x2cbcff){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x2cbcff);_0x15f259(_0x2cbcff);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index edaba71..b2e91a2 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 _0xd3ef=['get','/:id','isAuthenticated','show','post','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./network.controller'];(function(_0x4a96f6,_0x53e09b){var _0x413f0c=function(_0x5e07fa){while(--_0x5e07fa){_0x4a96f6['push'](_0x4a96f6['shift']());}};_0x413f0c(++_0x53e09b);}(_0xd3ef,0x69));var _0xfd3e=function(_0x2d07f1,_0x112dc6){_0x2d07f1=_0x2d07f1-0x0;var _0x38701e=_0xd3ef[_0x2d07f1];return _0x38701e;};'use strict';var multer=require(_0xfd3e('0x0'));var util=require('util');var path=require(_0xfd3e('0x1'));var timeout=require(_0xfd3e('0x2'));var express=require(_0xfd3e('0x3'));var router=express['Router']();var fs_extra=require(_0xfd3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfd3e('0x5'));var config=require('../../config/environment');var controller=require(_0xfd3e('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfd3e('0x7')](_0xfd3e('0x8'),auth[_0xfd3e('0x9')](),controller[_0xfd3e('0xa')]);router[_0xfd3e('0xb')]('/',auth[_0xfd3e('0x9')](),controller['create']);router[_0xfd3e('0xc')](_0xfd3e('0x8'),auth[_0xfd3e('0x9')](),controller[_0xfd3e('0xd')]);router[_0xfd3e('0xe')]('/:id',auth[_0xfd3e('0x9')](),controller[_0xfd3e('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd663=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','show','post','isAuthenticated','create','put','/:id','delete','exports'];(function(_0x62b96,_0x303509){var _0x3ec9fb=function(_0x22af14){while(--_0x22af14){_0x62b96['push'](_0x62b96['shift']());}};_0x3ec9fb(++_0x303509);}(_0xd663,0x1ed));var _0x3d66=function(_0x23a22a,_0x1c5507){_0x23a22a=_0x23a22a-0x0;var _0x3dc8e7=_0xd663[_0x23a22a];return _0x3dc8e7;};'use strict';var multer=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var path=require('path');var timeout=require(_0x3d66('0x2'));var express=require(_0x3d66('0x3'));var router=express[_0x3d66('0x4')]();var fs_extra=require(_0x3d66('0x5'));var auth=require(_0x3d66('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3d66('0x7'));var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3d66('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3d66('0x9')]);router[_0x3d66('0xa')]('/',auth[_0x3d66('0xb')](),controller[_0x3d66('0xc')]);router[_0x3d66('0xd')](_0x3d66('0xe'),auth[_0x3d66('0xb')](),controller['update']);router[_0x3d66('0xf')](_0x3d66('0xe'),auth[_0x3d66('0xb')](),controller['destroy']);module[_0x3d66('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 1cfd2de..710c4b8 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 _0x154c=['localnet','stun','turn','STRING','exports','ENUM'];(function(_0x3255ce,_0x47d427){var _0x48c608=function(_0x5e1820){while(--_0x5e1820){_0x3255ce['push'](_0x3255ce['shift']());}};_0x48c608(++_0x47d427);}(_0x154c,0x18a));var _0xc154=function(_0x1ebe55,_0x17e463){_0x1ebe55=_0x1ebe55-0x0;var _0x240610=_0x154c[_0x1ebe55];return _0x240610;};'use strict';var Sequelize=require('sequelize');module[_0xc154('0x0')]={'type':{'type':Sequelize[_0xc154('0x1')](_0xc154('0x2'),'externip',_0xc154('0x3'),_0xc154('0x4'))},'value':{'type':Sequelize[_0xc154('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc154('0x5')]}}; \ No newline at end of file +var _0x1be8=['ENUM','localnet','externip','stun','STRING','sequelize'];(function(_0x4b6747,_0x378386){var _0x18f4a=function(_0x59c341){while(--_0x59c341){_0x4b6747['push'](_0x4b6747['shift']());}};_0x18f4a(++_0x378386);}(_0x1be8,0x13d));var _0x81be=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x1be8[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require(_0x81be('0x0'));module['exports']={'type':{'type':Sequelize[_0x81be('0x1')](_0x81be('0x2'),_0x81be('0x3'),_0x81be('0x4'),'turn')},'value':{'type':Sequelize[_0x81be('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x81be('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 70a0d78..4bbf8d6 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 _0x5a78=['format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','chan_sip.so','find','findAll','util','path','../../components/parsers/qs','../../config/environment','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','offset','undefined','limit','count','status','set','Content-Range','destroy','end','sendStatus','stack','name','send','Network','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','rows','show','params','keys','options','create','body','toUpperCase','STUN','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync'];(function(_0xe0f6a4,_0x53f128){var _0x41693f=function(_0x441288){while(--_0x441288){_0xe0f6a4['push'](_0xe0f6a4['shift']());}};_0x41693f(++_0x53f128);}(_0x5a78,0x14f));var _0x85a7=function(_0x4b9d6d,_0x103d9b){_0x4b9d6d=_0x4b9d6d-0x0;var _0x2ca0ed=_0x5a78[_0x4b9d6d];return _0x2ca0ed;};'use strict';var util=require(_0x85a7('0x0'));var path=require(_0x85a7('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0x85a7('0x2'));var logger=require('../../config/logger')('api');var config=require(_0x85a7('0x3'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x85a7('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357eb4,_0xf0365c,_0x2bc589,_0x37a6fd){return new Promise(function(_0x25cf9f,_0x1993d2){var _0x2a5f6e=_0x37a6fd||client;return _0x2a5f6e[_0x85a7('0x5')](_0x357eb4,_0x2bc589)[_0x85a7('0x6')](function(_0x11a8f7){logger[_0x85a7('0x7')](_0x85a7('0x8'),_0xf0365c,_0x85a7('0x9'));logger['debug'](_0x85a7('0xa'),_0xf0365c,_0x85a7('0x9'),JSON[_0x85a7('0xb')](_0x11a8f7));if(_0x11a8f7['error']){if(_0x11a8f7[_0x85a7('0xc')][_0x85a7('0xd')]===0x1f4){logger['error'](_0x85a7('0x8'),_0xf0365c,_0x11a8f7['error'][_0x85a7('0xe')]);return _0x1993d2(_0x11a8f7[_0x85a7('0xc')][_0x85a7('0xe')]);}logger[_0x85a7('0xc')](_0x85a7('0x8'),_0xf0365c,_0x11a8f7[_0x85a7('0xc')][_0x85a7('0xe')]);return _0x25cf9f(_0x11a8f7['error'][_0x85a7('0xe')]);}else{logger[_0x85a7('0x7')](_0x85a7('0x8'),_0xf0365c,_0x85a7('0x9'));_0x25cf9f(_0x11a8f7[_0x85a7('0xf')][_0x85a7('0xe')]);}})[_0x85a7('0x10')](function(_0x177a97){logger['error'](_0x85a7('0x8'),_0xf0365c,_0x177a97);_0x1993d2(_0x177a97);});});}function respondWithResult(_0xe30f89,_0x694636){_0x694636=_0x694636||0xc8;return function(_0x221194){if(_0x221194){return _0xe30f89['status'](_0x694636)['json'](_0x221194);}};}function respondWithFilteredResult(_0x1aec0a,_0x347e2b){return function(_0x1df4c6){if(_0x1df4c6){var _0x591f46=typeof _0x347e2b[_0x85a7('0x11')]===_0x85a7('0x12')&&typeof _0x347e2b[_0x85a7('0x13')]===_0x85a7('0x12');var _0x176f02=_0x1df4c6[_0x85a7('0x14')];var _0x396255=_0x591f46?0x0:_0x347e2b[_0x85a7('0x11')];var _0x131304=_0x591f46?_0x1df4c6['count']:_0x347e2b['offset']+_0x347e2b['limit'];var _0x205bee;if(_0x131304>=_0x176f02){_0x131304=_0x176f02;_0x205bee=0xc8;}else{_0x205bee=0xce;}_0x1aec0a[_0x85a7('0x15')](_0x205bee);return _0x1aec0a[_0x85a7('0x16')](_0x85a7('0x17'),_0x396255+'-'+_0x131304+'/'+_0x176f02)['json'](_0x1df4c6);}return null;};}function saveUpdates(_0x607b02){return function(_0x11353e){if(_0x11353e){return _0x11353e['update'](_0x607b02)[_0x85a7('0x6')](function(_0xa3e45){return _0xa3e45;});}return null;};}function removeEntity(_0x4f330c){return function(_0xcaa26a){if(_0xcaa26a){return _0xcaa26a[_0x85a7('0x18')]()[_0x85a7('0x6')](function(){_0x4f330c[_0x85a7('0x15')](0xcc)[_0x85a7('0x19')]();});}};}function handleEntityNotFound(_0x35fbe8){return function(_0x1bacbb){if(!_0x1bacbb){_0x35fbe8[_0x85a7('0x1a')](0x194);}return _0x1bacbb;};}function handleError(_0x4c7f05,_0x1258a0){_0x1258a0=_0x1258a0||0x1f4;return function(_0x3490f5){logger[_0x85a7('0xc')](_0x3490f5[_0x85a7('0x1b')]);if(_0x3490f5['name']){delete _0x3490f5[_0x85a7('0x1c')];}_0x4c7f05[_0x85a7('0x15')](_0x1258a0)[_0x85a7('0x1d')](_0x3490f5);};}exports['index']=function(_0x2d1f41,_0x2a3b75){var _0x362caf={},_0x2cc07e={},_0x1a73ee={'count':0x0,'rows':[]};var _0x7a8c5d=_['map'](db[_0x85a7('0x1e')][_0x85a7('0x1f')],function(_0x11e89a){return{'name':_0x11e89a[_0x85a7('0x20')],'type':_0x11e89a[_0x85a7('0x21')][_0x85a7('0x22')]};});_0x2cc07e[_0x85a7('0x23')]=_[_0x85a7('0x24')](_0x7a8c5d,_0x85a7('0x1c'));_0x2cc07e[_0x85a7('0x25')]=_['keys'](_0x2d1f41['query']);_0x2cc07e[_0x85a7('0x26')]=_[_0x85a7('0x27')](_0x2cc07e[_0x85a7('0x23')],_0x2cc07e[_0x85a7('0x25')]);_0x362caf[_0x85a7('0x28')]=_['intersection'](_0x2cc07e['model'],qs[_0x85a7('0x29')](_0x2d1f41[_0x85a7('0x25')][_0x85a7('0x29')]));_0x362caf['attributes']=_0x362caf[_0x85a7('0x28')][_0x85a7('0x2a')]?_0x362caf[_0x85a7('0x28')]:_0x2cc07e[_0x85a7('0x23')];if(!_0x2d1f41[_0x85a7('0x25')][_0x85a7('0x2b')]('nolimit')){_0x362caf['limit']=qs[_0x85a7('0x13')](_0x2d1f41['query'][_0x85a7('0x13')]);_0x362caf[_0x85a7('0x11')]=qs[_0x85a7('0x11')](_0x2d1f41['query'][_0x85a7('0x11')]);}_0x362caf[_0x85a7('0x2c')]=qs[_0x85a7('0x2d')](_0x2d1f41['query'][_0x85a7('0x2d')]);_0x362caf['where']=qs[_0x85a7('0x26')](_[_0x85a7('0x2e')](_0x2d1f41[_0x85a7('0x25')],_0x2cc07e[_0x85a7('0x26')]),_0x7a8c5d);if(_0x2d1f41[_0x85a7('0x25')][_0x85a7('0x2f')]){_0x362caf[_0x85a7('0x30')]=_[_0x85a7('0x31')](_0x362caf[_0x85a7('0x30')],{'$or':_[_0x85a7('0x24')](_0x7a8c5d,function(_0x4c63bf){if(_0x4c63bf[_0x85a7('0x21')]!=='VIRTUAL'){var _0x3ff088={};_0x3ff088[_0x4c63bf[_0x85a7('0x1c')]]={'$like':'%'+_0x2d1f41['query'][_0x85a7('0x2f')]+'%'};return _0x3ff088;}})});}_0x362caf=_[_0x85a7('0x31')]({},_0x362caf,_0x2d1f41['options']);var _0x3876b6={'where':_0x362caf[_0x85a7('0x30')]};return db[_0x85a7('0x1e')][_0x85a7('0x14')](_0x3876b6)[_0x85a7('0x6')](function(_0x951a5f){_0x1a73ee['count']=_0x951a5f;if(_0x2d1f41[_0x85a7('0x25')][_0x85a7('0x32')]){_0x362caf[_0x85a7('0x33')]=[{'all':!![]}];}return db[_0x85a7('0x1e')]['findAll'](_0x362caf);})['then'](function(_0xf20cf7){_0x1a73ee[_0x85a7('0x34')]=_0xf20cf7;return _0x1a73ee;})[_0x85a7('0x6')](respondWithFilteredResult(_0x2a3b75,_0x362caf))[_0x85a7('0x10')](handleError(_0x2a3b75,null));};exports[_0x85a7('0x35')]=function(_0x5b1314,_0x5cf1be){var _0x945812={'raw':!![],'where':{'id':_0x5b1314[_0x85a7('0x36')]['id']}},_0x5dc541={};_0x5dc541[_0x85a7('0x23')]=_[_0x85a7('0x37')](db['Network'][_0x85a7('0x1f')]);_0x5dc541[_0x85a7('0x25')]=_[_0x85a7('0x37')](_0x5b1314[_0x85a7('0x25')]);_0x5dc541['filters']=_[_0x85a7('0x27')](_0x5dc541[_0x85a7('0x23')],_0x5dc541['query']);_0x945812['attributes']=_[_0x85a7('0x27')](_0x5dc541[_0x85a7('0x23')],qs['fields'](_0x5b1314[_0x85a7('0x25')][_0x85a7('0x29')]));_0x945812['attributes']=_0x945812[_0x85a7('0x28')][_0x85a7('0x2a')]?_0x945812[_0x85a7('0x28')]:_0x5dc541[_0x85a7('0x23')];if(_0x5b1314['query'][_0x85a7('0x32')]){_0x945812[_0x85a7('0x33')]=[{'all':!![]}];}_0x945812=_[_0x85a7('0x31')]({},_0x945812,_0x5b1314[_0x85a7('0x38')]);return db['Network']['find'](_0x945812)[_0x85a7('0x6')](handleEntityNotFound(_0x5cf1be,null))[_0x85a7('0x6')](respondWithResult(_0x5cf1be,null))[_0x85a7('0x10')](handleError(_0x5cf1be,null));};exports[_0x85a7('0x39')]=function(_0x587fa7,_0x2e9c0b){var _0x54c545;return db['Network']['create'](_0x587fa7[_0x85a7('0x3a')],{'raw':!![]})[_0x85a7('0x6')](function(_0x25e293){_0x54c545=_0x25e293;return db[_0x85a7('0x1e')]['findAll']({'where':{'type':_0x587fa7[_0x85a7('0x3a')][_0x85a7('0x21')]},'raw':!![]});})['then'](function(_0x2ea9a7){if(_0x54c545[_0x85a7('0x21')][_0x85a7('0x3b')]()==_0x85a7('0x3c')){var _0x180f13=fs['readFileSync'](path['join'](config[_0x85a7('0x3d')],_0x85a7('0x3e')),_0x85a7('0x3f'));var _0x3d8b2e=ejs[_0x85a7('0x40')](_0x180f13,{'networks':_0x2ea9a7||[]});fs['writeFileSync'](_0x85a7('0x41'),_0x3d8b2e);return respondWithRpcPromise(_0x85a7('0x42'),'create',{'module':_0x85a7('0x43')});}else if(_0x54c545[_0x85a7('0x21')]['toUpperCase']()==_0x85a7('0x44')){var _0x1b7cc8=fs[_0x85a7('0x45')](path[_0x85a7('0x46')](config[_0x85a7('0x3d')],_0x85a7('0x47')),_0x85a7('0x3f'));var _0x54ac3d=ejs[_0x85a7('0x40')](_0x1b7cc8,{'networks':_0x2ea9a7||[]});fs['writeFileSync'](_0x85a7('0x48'),_0x54ac3d);return respondWithRpcPromise(_0x85a7('0x42'),'create',{'module':_0x85a7('0x43')});}else{var _0x5c5263=fs['readFileSync'](path[_0x85a7('0x46')](config[_0x85a7('0x3d')],_0x85a7('0x49')),_0x85a7('0x3f'));var _0x2ca5d5=ejs[_0x85a7('0x40')](_0x5c5263,{'networks':_0x2ea9a7||[]});fs[_0x85a7('0x4a')](util[_0x85a7('0x4b')](_0x85a7('0x4c'),_0x587fa7[_0x85a7('0x3a')][_0x85a7('0x21')][_0x85a7('0x4d')]()),_0x2ca5d5);return respondWithRpcPromise(_0x85a7('0x42'),'create',{'module':'chan_sip.so'});}})[_0x85a7('0x6')](function(){return _0x54c545;})[_0x85a7('0x6')](respondWithResult(_0x2e9c0b,0xc9))[_0x85a7('0x10')](handleError(_0x2e9c0b,null));};exports[_0x85a7('0x4e')]=function(_0x1f18c9,_0x35a51c){var _0x501867;return db[_0x85a7('0x1e')]['find']({'where':{'id':_0x1f18c9[_0x85a7('0x36')]['id']}})[_0x85a7('0x6')](handleEntityNotFound(_0x35a51c,null))[_0x85a7('0x6')](saveUpdates(_0x1f18c9[_0x85a7('0x3a')],null))[_0x85a7('0x6')](function(_0x18cde5){if(_0x18cde5){_0x501867=_0x18cde5;return db['Network']['findAll']({'where':{'type':_0x501867[_0x85a7('0x21')]},'raw':!![]});}return null;})[_0x85a7('0x6')](function(_0x5413d3){if(_0x501867[_0x85a7('0x21')][_0x85a7('0x3b')]()=='STUN'){var _0x2d61b0=fs[_0x85a7('0x45')](path[_0x85a7('0x46')](config[_0x85a7('0x3d')],_0x85a7('0x3e')),_0x85a7('0x3f'));var _0x3ac132=ejs[_0x85a7('0x40')](_0x2d61b0,{'networks':_0x5413d3||[]});fs[_0x85a7('0x4a')](_0x85a7('0x41'),_0x3ac132);return respondWithRpcPromise(_0x85a7('0x42'),_0x85a7('0x4e'),{'module':_0x85a7('0x43')});}else if(_0x501867[_0x85a7('0x21')][_0x85a7('0x3b')]()==_0x85a7('0x44')){var _0x2d2406=fs[_0x85a7('0x45')](path[_0x85a7('0x46')](config[_0x85a7('0x3d')],_0x85a7('0x47')),'utf8');var _0x4c144b=ejs[_0x85a7('0x40')](_0x2d2406,{'networks':_0x5413d3||[]});fs[_0x85a7('0x4a')](_0x85a7('0x48'),_0x4c144b);return respondWithRpcPromise('Reload',_0x85a7('0x4e'),{'module':'res_stun_monitor.so'});}else{var _0x1c951e=fs['readFileSync'](path['join'](config['root'],'server/files/templates/network.ejs'),_0x85a7('0x3f'));var _0x490041=ejs[_0x85a7('0x40')](_0x1c951e,{'networks':_0x5413d3||[]});fs[_0x85a7('0x4a')](util[_0x85a7('0x4b')](_0x85a7('0x4c'),_0x1f18c9['body'][_0x85a7('0x21')]['toLowerCase']()),_0x490041);return respondWithRpcPromise(_0x85a7('0x42'),'update',{'module':_0x85a7('0x4f')});}})[_0x85a7('0x6')](function(_0x5f5567){if(_0x5f5567){return _0x501867;}return null;})['then'](respondWithResult(_0x35a51c,null))[_0x85a7('0x10')](handleError(_0x35a51c,null));};exports[_0x85a7('0x18')]=function(_0x4f0ea1,_0x9d9880){var _0xbca9ea;return db[_0x85a7('0x1e')][_0x85a7('0x50')]({'where':{'id':_0x4f0ea1[_0x85a7('0x36')]['id']}})[_0x85a7('0x6')](function(_0x4a7fe2){_0xbca9ea=_0x4a7fe2;return _0x4a7fe2;})[_0x85a7('0x6')](handleEntityNotFound(_0x9d9880,null))['then'](removeEntity(_0x9d9880,null))['then'](function(){if(_0xbca9ea){return db[_0x85a7('0x1e')][_0x85a7('0x51')]({'where':{'type':_0xbca9ea[_0x85a7('0x21')]},'raw':!![]});}})[_0x85a7('0x6')](function(_0x56702a){if(_0xbca9ea[_0x85a7('0x21')][_0x85a7('0x3b')]()==_0x85a7('0x3c')){var _0x4a075c=fs[_0x85a7('0x45')](path['join'](config[_0x85a7('0x3d')],_0x85a7('0x3e')),_0x85a7('0x3f'));var _0x31a51a=ejs[_0x85a7('0x40')](_0x4a075c,{'networks':_0x56702a||[]});fs[_0x85a7('0x4a')](_0x85a7('0x41'),_0x31a51a);return respondWithRpcPromise(_0x85a7('0x42'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0xbca9ea[_0x85a7('0x21')][_0x85a7('0x3b')]()==_0x85a7('0x44')){var _0x330486=fs[_0x85a7('0x45')](path[_0x85a7('0x46')](config[_0x85a7('0x3d')],'server/files/templates/turn_multiple.ejs'),_0x85a7('0x3f'));var _0x5b5f1b=ejs['render'](_0x330486,{'networks':_0x56702a||[]});fs[_0x85a7('0x4a')]('/etc/asterisk/turn_xcally.conf',_0x5b5f1b);return respondWithRpcPromise(_0x85a7('0x42'),_0x85a7('0x18'),{'module':_0x85a7('0x43')});}else{var _0x34987f=fs['readFileSync'](path['join'](config[_0x85a7('0x3d')],_0x85a7('0x49')),_0x85a7('0x3f'));var _0xeac441=ejs[_0x85a7('0x40')](_0x34987f,{'networks':_0x56702a||[]});fs['writeFileSync'](util['format'](_0x85a7('0x4c'),_0xbca9ea['type'][_0x85a7('0x4d')]()),_0xeac441);return respondWithRpcPromise(_0x85a7('0x42'),_0x85a7('0x18'),{'module':_0x85a7('0x4f')});}})[_0x85a7('0x10')](handleError(_0x9d9880,null));}; \ No newline at end of file +var _0x3498=['/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','server/files/templates/network.ejs','format','params','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','destroy','util','path','ejs','lodash','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','sendStatus','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','Network','includeAll','include','findAll','rows','show','options','find','create','body','type','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render'];(function(_0x3ad9b3,_0x5c76e9){var _0x4ef8d1=function(_0x239036){while(--_0x239036){_0x3ad9b3['push'](_0x3ad9b3['shift']());}};_0x4ef8d1(++_0x5c76e9);}(_0x3498,0x10a));var _0x8349=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x3498[_0x13b8f3];return _0x1a6d06;};'use strict';var util=require(_0x8349('0x0'));var path=require(_0x8349('0x1'));var ejs=require(_0x8349('0x2'));var fs=require('fs');var _=require(_0x8349('0x3'));var qs=require(_0x8349('0x4'));var logger=require('../../config/logger')(_0x8349('0x5'));var config=require('../../config/environment');var db=require(_0x8349('0x6'))['db'];var jayson=require(_0x8349('0x7'));var client=jayson[_0x8349('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54ba35,_0x3ce042,_0x563d70,_0x222563){return new Promise(function(_0x30384d,_0x35546c){var _0xeb999=_0x222563||client;return _0xeb999[_0x8349('0x9')](_0x54ba35,_0x563d70)[_0x8349('0xa')](function(_0x2012b5){logger[_0x8349('0xb')](_0x8349('0xc'),_0x3ce042,'request\x20sent');logger[_0x8349('0xd')](_0x8349('0xe'),_0x3ce042,_0x8349('0xf'),JSON[_0x8349('0x10')](_0x2012b5));if(_0x2012b5[_0x8349('0x11')]){if(_0x2012b5[_0x8349('0x11')]['code']===0x1f4){logger[_0x8349('0x11')](_0x8349('0xc'),_0x3ce042,_0x2012b5['error'][_0x8349('0x12')]);return _0x35546c(_0x2012b5[_0x8349('0x11')][_0x8349('0x12')]);}logger['error'](_0x8349('0xc'),_0x3ce042,_0x2012b5[_0x8349('0x11')][_0x8349('0x12')]);return _0x30384d(_0x2012b5[_0x8349('0x11')][_0x8349('0x12')]);}else{logger[_0x8349('0xb')](_0x8349('0xc'),_0x3ce042,_0x8349('0xf'));_0x30384d(_0x2012b5[_0x8349('0x13')]['message']);}})[_0x8349('0x14')](function(_0x131a80){logger[_0x8349('0x11')](_0x8349('0xc'),_0x3ce042,_0x131a80);_0x35546c(_0x131a80);});});}function respondWithResult(_0x25ea5f,_0x3819e6){_0x3819e6=_0x3819e6||0xc8;return function(_0x53b08e){if(_0x53b08e){return _0x25ea5f[_0x8349('0x15')](_0x3819e6)[_0x8349('0x16')](_0x53b08e);}};}function respondWithFilteredResult(_0x491bd2,_0x4f5334){return function(_0x1ea5b3){if(_0x1ea5b3){var _0x586ab3=typeof _0x4f5334[_0x8349('0x17')]===_0x8349('0x18')&&typeof _0x4f5334[_0x8349('0x19')]==='undefined';var _0x5b74c3=_0x1ea5b3[_0x8349('0x1a')];var _0x573c32=_0x586ab3?0x0:_0x4f5334[_0x8349('0x17')];var _0x5c4bdb=_0x586ab3?_0x1ea5b3[_0x8349('0x1a')]:_0x4f5334[_0x8349('0x17')]+_0x4f5334[_0x8349('0x19')];var _0x1c5cf5;if(_0x5c4bdb>=_0x5b74c3){_0x5c4bdb=_0x5b74c3;_0x1c5cf5=0xc8;}else{_0x1c5cf5=0xce;}_0x491bd2['status'](_0x1c5cf5);return _0x491bd2['set'](_0x8349('0x1b'),_0x573c32+'-'+_0x5c4bdb+'/'+_0x5b74c3)[_0x8349('0x16')](_0x1ea5b3);}return null;};}function saveUpdates(_0x216c93){return function(_0x371409){if(_0x371409){return _0x371409[_0x8349('0x1c')](_0x216c93)[_0x8349('0xa')](function(_0x3bc037){return _0x3bc037;});}return null;};}function removeEntity(_0x18ad12){return function(_0x523c05){if(_0x523c05){return _0x523c05['destroy']()[_0x8349('0xa')](function(){_0x18ad12[_0x8349('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ca0f){return function(_0x4a78c4){if(!_0x4a78c4){_0x55ca0f[_0x8349('0x1d')](0x194);}return _0x4a78c4;};}function handleError(_0x445d6f,_0x50577b){_0x50577b=_0x50577b||0x1f4;return function(_0x1db1ed){logger['error'](_0x1db1ed[_0x8349('0x1e')]);if(_0x1db1ed[_0x8349('0x1f')]){delete _0x1db1ed['name'];}_0x445d6f['status'](_0x50577b)[_0x8349('0x20')](_0x1db1ed);};}exports[_0x8349('0x21')]=function(_0x3ebb6c,_0xa3ffa2){var _0x320657={},_0x571c93={},_0x5113a4={'count':0x0,'rows':[]};var _0x4c9bd8=_['map'](db['Network'][_0x8349('0x22')],function(_0x21089e){return{'name':_0x21089e[_0x8349('0x23')],'type':_0x21089e['type']['key']};});_0x571c93[_0x8349('0x24')]=_[_0x8349('0x25')](_0x4c9bd8,_0x8349('0x1f'));_0x571c93[_0x8349('0x26')]=_[_0x8349('0x27')](_0x3ebb6c[_0x8349('0x26')]);_0x571c93[_0x8349('0x28')]=_['intersection'](_0x571c93[_0x8349('0x24')],_0x571c93[_0x8349('0x26')]);_0x320657[_0x8349('0x29')]=_[_0x8349('0x2a')](_0x571c93[_0x8349('0x24')],qs['fields'](_0x3ebb6c[_0x8349('0x26')][_0x8349('0x2b')]));_0x320657[_0x8349('0x29')]=_0x320657['attributes'][_0x8349('0x2c')]?_0x320657[_0x8349('0x29')]:_0x571c93[_0x8349('0x24')];if(!_0x3ebb6c[_0x8349('0x26')]['hasOwnProperty'](_0x8349('0x2d'))){_0x320657[_0x8349('0x19')]=qs[_0x8349('0x19')](_0x3ebb6c[_0x8349('0x26')][_0x8349('0x19')]);_0x320657['offset']=qs[_0x8349('0x17')](_0x3ebb6c[_0x8349('0x26')]['offset']);}_0x320657[_0x8349('0x2e')]=qs[_0x8349('0x2f')](_0x3ebb6c[_0x8349('0x26')]['sort']);_0x320657[_0x8349('0x30')]=qs[_0x8349('0x28')](_['pick'](_0x3ebb6c[_0x8349('0x26')],_0x571c93[_0x8349('0x28')]),_0x4c9bd8);if(_0x3ebb6c['query']['filter']){_0x320657[_0x8349('0x30')]=_['merge'](_0x320657[_0x8349('0x30')],{'$or':_[_0x8349('0x25')](_0x4c9bd8,function(_0x46be0f){if(_0x46be0f['type']!==_0x8349('0x31')){var _0xa64456={};_0xa64456[_0x46be0f[_0x8349('0x1f')]]={'$like':'%'+_0x3ebb6c['query'][_0x8349('0x32')]+'%'};return _0xa64456;}})});}_0x320657=_[_0x8349('0x33')]({},_0x320657,_0x3ebb6c['options']);var _0x4d336b={'where':_0x320657[_0x8349('0x30')]};return db[_0x8349('0x34')][_0x8349('0x1a')](_0x4d336b)[_0x8349('0xa')](function(_0x5347a3){_0x5113a4[_0x8349('0x1a')]=_0x5347a3;if(_0x3ebb6c['query'][_0x8349('0x35')]){_0x320657[_0x8349('0x36')]=[{'all':!![]}];}return db['Network'][_0x8349('0x37')](_0x320657);})[_0x8349('0xa')](function(_0x552fd4){_0x5113a4[_0x8349('0x38')]=_0x552fd4;return _0x5113a4;})['then'](respondWithFilteredResult(_0xa3ffa2,_0x320657))[_0x8349('0x14')](handleError(_0xa3ffa2,null));};exports[_0x8349('0x39')]=function(_0x1f1799,_0x2d5e04){var _0x1ca202={'raw':!![],'where':{'id':_0x1f1799['params']['id']}},_0x5a6f94={};_0x5a6f94[_0x8349('0x24')]=_[_0x8349('0x27')](db['Network'][_0x8349('0x22')]);_0x5a6f94[_0x8349('0x26')]=_[_0x8349('0x27')](_0x1f1799[_0x8349('0x26')]);_0x5a6f94['filters']=_[_0x8349('0x2a')](_0x5a6f94[_0x8349('0x24')],_0x5a6f94[_0x8349('0x26')]);_0x1ca202[_0x8349('0x29')]=_[_0x8349('0x2a')](_0x5a6f94[_0x8349('0x24')],qs['fields'](_0x1f1799['query'][_0x8349('0x2b')]));_0x1ca202[_0x8349('0x29')]=_0x1ca202['attributes'][_0x8349('0x2c')]?_0x1ca202[_0x8349('0x29')]:_0x5a6f94[_0x8349('0x24')];if(_0x1f1799[_0x8349('0x26')]['includeAll']){_0x1ca202[_0x8349('0x36')]=[{'all':!![]}];}_0x1ca202=_['merge']({},_0x1ca202,_0x1f1799[_0x8349('0x3a')]);return db[_0x8349('0x34')][_0x8349('0x3b')](_0x1ca202)[_0x8349('0xa')](handleEntityNotFound(_0x2d5e04,null))['then'](respondWithResult(_0x2d5e04,null))[_0x8349('0x14')](handleError(_0x2d5e04,null));};exports['create']=function(_0x99ffd9,_0x649faf){var _0x4b9e74;return db[_0x8349('0x34')][_0x8349('0x3c')](_0x99ffd9[_0x8349('0x3d')],{'raw':!![]})['then'](function(_0x24ebd7){_0x4b9e74=_0x24ebd7;return db['Network'][_0x8349('0x37')]({'where':{'type':_0x99ffd9[_0x8349('0x3d')][_0x8349('0x3e')]},'raw':!![]});})[_0x8349('0xa')](function(_0x355f7f){if(_0x4b9e74['type'][_0x8349('0x3f')]()==_0x8349('0x40')){var _0x4c97a8=fs[_0x8349('0x41')](path[_0x8349('0x42')](config[_0x8349('0x43')],_0x8349('0x44')),'utf8');var _0x334a5c=ejs[_0x8349('0x45')](_0x4c97a8,{'networks':_0x355f7f||[]});fs['writeFileSync'](_0x8349('0x46'),_0x334a5c);return respondWithRpcPromise(_0x8349('0x47'),_0x8349('0x3c'),{'module':_0x8349('0x48')});}else if(_0x4b9e74['type'][_0x8349('0x3f')]()==_0x8349('0x49')){var _0x4d82d8=fs[_0x8349('0x41')](path[_0x8349('0x42')](config[_0x8349('0x43')],_0x8349('0x4a')),_0x8349('0x4b'));var _0x318a67=ejs['render'](_0x4d82d8,{'networks':_0x355f7f||[]});fs[_0x8349('0x4c')]('/etc/asterisk/turn_xcally.conf',_0x318a67);return respondWithRpcPromise(_0x8349('0x47'),'create',{'module':_0x8349('0x48')});}else{var _0x2c29ac=fs[_0x8349('0x41')](path[_0x8349('0x42')](config[_0x8349('0x43')],_0x8349('0x4d')),'utf8');var _0x206178=ejs[_0x8349('0x45')](_0x2c29ac,{'networks':_0x355f7f||[]});fs[_0x8349('0x4c')](util[_0x8349('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x99ffd9['body'][_0x8349('0x3e')]['toLowerCase']()),_0x206178);return respondWithRpcPromise(_0x8349('0x47'),_0x8349('0x3c'),{'module':'chan_sip.so'});}})[_0x8349('0xa')](function(){return _0x4b9e74;})[_0x8349('0xa')](respondWithResult(_0x649faf,0xc9))[_0x8349('0x14')](handleError(_0x649faf,null));};exports[_0x8349('0x1c')]=function(_0xb795bc,_0x3a9595){var _0x22e5d6;return db[_0x8349('0x34')][_0x8349('0x3b')]({'where':{'id':_0xb795bc[_0x8349('0x4f')]['id']}})[_0x8349('0xa')](handleEntityNotFound(_0x3a9595,null))[_0x8349('0xa')](saveUpdates(_0xb795bc[_0x8349('0x3d')],null))[_0x8349('0xa')](function(_0x5e08a9){if(_0x5e08a9){_0x22e5d6=_0x5e08a9;return db[_0x8349('0x34')][_0x8349('0x37')]({'where':{'type':_0x22e5d6[_0x8349('0x3e')]},'raw':!![]});}return null;})[_0x8349('0xa')](function(_0x4f02d2){if(_0x22e5d6[_0x8349('0x3e')][_0x8349('0x3f')]()=='STUN'){var _0x11ce71=fs[_0x8349('0x41')](path[_0x8349('0x42')](config[_0x8349('0x43')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x44e31e=ejs[_0x8349('0x45')](_0x11ce71,{'networks':_0x4f02d2||[]});fs[_0x8349('0x4c')](_0x8349('0x46'),_0x44e31e);return respondWithRpcPromise('Reload',_0x8349('0x1c'),{'module':_0x8349('0x48')});}else if(_0x22e5d6[_0x8349('0x3e')][_0x8349('0x3f')]()==_0x8349('0x49')){var _0x42d5bc=fs[_0x8349('0x41')](path[_0x8349('0x42')](config['root'],_0x8349('0x4a')),_0x8349('0x4b'));var _0x1f64b3=ejs[_0x8349('0x45')](_0x42d5bc,{'networks':_0x4f02d2||[]});fs['writeFileSync'](_0x8349('0x50'),_0x1f64b3);return respondWithRpcPromise('Reload',_0x8349('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x2dcaf4=fs[_0x8349('0x41')](path[_0x8349('0x42')](config[_0x8349('0x43')],_0x8349('0x4d')),'utf8');var _0xbe25c=ejs[_0x8349('0x45')](_0x2dcaf4,{'networks':_0x4f02d2||[]});fs[_0x8349('0x4c')](util[_0x8349('0x4e')](_0x8349('0x51'),_0xb795bc['body'][_0x8349('0x3e')]['toLowerCase']()),_0xbe25c);return respondWithRpcPromise(_0x8349('0x47'),_0x8349('0x1c'),{'module':_0x8349('0x52')});}})['then'](function(_0x19e45e){if(_0x19e45e){return _0x22e5d6;}return null;})['then'](respondWithResult(_0x3a9595,null))[_0x8349('0x14')](handleError(_0x3a9595,null));};exports[_0x8349('0x53')]=function(_0x212ca5,_0x35403d){var _0x20e0c9;return db[_0x8349('0x34')][_0x8349('0x3b')]({'where':{'id':_0x212ca5[_0x8349('0x4f')]['id']}})[_0x8349('0xa')](function(_0x108d9e){_0x20e0c9=_0x108d9e;return _0x108d9e;})[_0x8349('0xa')](handleEntityNotFound(_0x35403d,null))[_0x8349('0xa')](removeEntity(_0x35403d,null))[_0x8349('0xa')](function(){if(_0x20e0c9){return db[_0x8349('0x34')][_0x8349('0x37')]({'where':{'type':_0x20e0c9['type']},'raw':!![]});}})['then'](function(_0xf2755f){if(_0x20e0c9[_0x8349('0x3e')][_0x8349('0x3f')]()==_0x8349('0x40')){var _0x557881=fs[_0x8349('0x41')](path[_0x8349('0x42')](config[_0x8349('0x43')],'server/files/templates/stun_multiple.ejs'),_0x8349('0x4b'));var _0x402e63=ejs[_0x8349('0x45')](_0x557881,{'networks':_0xf2755f||[]});fs[_0x8349('0x4c')](_0x8349('0x46'),_0x402e63);return respondWithRpcPromise(_0x8349('0x47'),_0x8349('0x53'),{'module':_0x8349('0x48')});}else if(_0x20e0c9[_0x8349('0x3e')][_0x8349('0x3f')]()==_0x8349('0x49')){var _0xbb473=fs[_0x8349('0x41')](path[_0x8349('0x42')](config[_0x8349('0x43')],_0x8349('0x4a')),_0x8349('0x4b'));var _0x2d688d=ejs['render'](_0xbb473,{'networks':_0xf2755f||[]});fs['writeFileSync'](_0x8349('0x50'),_0x2d688d);return respondWithRpcPromise('Reload',_0x8349('0x53'),{'module':_0x8349('0x48')});}else{var _0xad3171=fs[_0x8349('0x41')](path[_0x8349('0x42')](config[_0x8349('0x43')],_0x8349('0x4d')),'utf8');var _0x1bf3ba=ejs['render'](_0xad3171,{'networks':_0xf2755f||[]});fs['writeFileSync'](util[_0x8349('0x4e')](_0x8349('0x51'),_0x20e0c9[_0x8349('0x3e')]['toLowerCase']()),_0x1bf3ba);return respondWithRpcPromise(_0x8349('0x47'),_0x8349('0x53'),{'module':_0x8349('0x52')});}})[_0x8349('0x14')](handleError(_0x35403d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index fa53588..e94e088 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 _0x5db8=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./network.attributes','exports','Network','network'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5db8,0xbb));var _0x85db=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0x5db8[_0x9c8b4a];return _0x198bef;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var moment=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var rp=require(_0x85db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85db('0x6'));var attributes=require(_0x85db('0x7'));module[_0x85db('0x8')]=function(_0x34d71f,_0x48bf16){return _0x34d71f['define'](_0x85db('0x9'),attributes,{'tableName':_0x85db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbee3=['define','Network','network','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xbee3,0xd5));var _0x3bee=function(_0x37644a,_0x1a223a){_0x37644a=_0x37644a-0x0;var _0x48c516=_0xbee3[_0x37644a];return _0x48c516;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3bee('0x1'));var BPromise=require(_0x3bee('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bee('0x3'));var rimraf=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var attributes=require('./network.attributes');module[_0x3bee('0x6')]=function(_0x3baf77,_0x4c5ef5){return _0x3baf77[_0x3bee('0x7')](_0x3bee('0x8'),attributes,{'tableName':_0x3bee('0x9'),'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 94cdfcf..573268a 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3d3039,_0x51322e){var _0x1c26e7=function(_0x45374b){while(--_0x45374b){_0x3d3039['push'](_0x3d3039['shift']());}};_0x1c26e7(++_0x51322e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d59c8,_0x5caf18){var _0x3b1541=function(_0x5c7379){while(--_0x5c7379){_0x1d59c8['push'](_0x1d59c8['shift']());}};_0x3b1541(++_0x5caf18);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 5de952f..08b7ca5 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 _0xadf1=['/:id/notify','notify','addAgents','/:id/send','/:id','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition'];(function(_0x3eccb4,_0x4c62eb){var _0x155772=function(_0x1e06ee){while(--_0x1e06ee){_0x3eccb4['push'](_0x3eccb4['shift']());}};_0x155772(++_0x4c62eb);}(_0xadf1,0x1d1));var _0x1adf=function(_0x4ff542,_0x2b35a9){_0x4ff542=_0x4ff542-0x0;var _0x467ddd=_0xadf1[_0x4ff542];return _0x467ddd;};'use strict';var multer=require(_0x1adf('0x0'));var util=require(_0x1adf('0x1'));var path=require(_0x1adf('0x2'));var timeout=require(_0x1adf('0x3'));var express=require(_0x1adf('0x4'));var router=express['Router']();var fs_extra=require(_0x1adf('0x5'));var auth=require(_0x1adf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1adf('0x7'));var controller=require('./openchannelAccount.controller');router[_0x1adf('0x8')]('/',auth[_0x1adf('0x9')](),controller[_0x1adf('0xa')]);router[_0x1adf('0x8')](_0x1adf('0xb'),auth[_0x1adf('0x9')](),controller['describe']);router[_0x1adf('0x8')]('/:id',auth[_0x1adf('0x9')](),controller['show']);router['get']('/:id/dispositions',auth[_0x1adf('0x9')](),controller[_0x1adf('0xc')]);router[_0x1adf('0x8')](_0x1adf('0xd'),auth[_0x1adf('0x9')](),controller[_0x1adf('0xe')]);router[_0x1adf('0x8')](_0x1adf('0xf'),auth['isAuthenticated'](),controller[_0x1adf('0x10')]);router[_0x1adf('0x8')](_0x1adf('0x11'),auth[_0x1adf('0x9')](),controller[_0x1adf('0x12')]);router[_0x1adf('0x8')](_0x1adf('0x13'),auth[_0x1adf('0x9')](),controller[_0x1adf('0x14')]);router[_0x1adf('0x15')]('/',auth[_0x1adf('0x9')](),controller[_0x1adf('0x16')]);router[_0x1adf('0x15')](_0x1adf('0x17'),auth[_0x1adf('0x9')](),controller[_0x1adf('0x18')]);router['post'](_0x1adf('0xd'),auth[_0x1adf('0x9')](),controller['addAnswer']);router[_0x1adf('0x15')](_0x1adf('0x19'),controller[_0x1adf('0x1a')]);router[_0x1adf('0x15')](_0x1adf('0xf'),auth[_0x1adf('0x9')](),controller['addApplications']);router[_0x1adf('0x15')](_0x1adf('0x13'),auth[_0x1adf('0x9')](),controller[_0x1adf('0x1b')]);router[_0x1adf('0x15')](_0x1adf('0x1c'),auth[_0x1adf('0x9')](),controller['send']);router['put'](_0x1adf('0x1d'),auth[_0x1adf('0x9')](),controller['update']);router[_0x1adf('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x1adf('0x1f')]);router[_0x1adf('0x1e')](_0x1adf('0x17'),auth['isAuthenticated'](),controller[_0x1adf('0x20')]);router[_0x1adf('0x1e')](_0x1adf('0xd'),auth[_0x1adf('0x9')](),controller['removeAnswers']);router['delete'](_0x1adf('0x13'),auth['isAuthenticated'](),controller[_0x1adf('0x21')]);module[_0x1adf('0x22')]=router; \ No newline at end of file +var _0xee71=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','/describe','/:id','show','get','/:id/dispositions','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/canned_answers','notify','addApplications','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports'];(function(_0x34450e,_0x350b08){var _0x348049=function(_0x43e6ef){while(--_0x43e6ef){_0x34450e['push'](_0x34450e['shift']());}};_0x348049(++_0x350b08);}(_0xee71,0x94));var _0x1ee7=function(_0x54b7b3,_0x38c24c){_0x54b7b3=_0x54b7b3-0x0;var _0x194847=_0xee71[_0x54b7b3];return _0x194847;};'use strict';var multer=require(_0x1ee7('0x0'));var util=require(_0x1ee7('0x1'));var path=require(_0x1ee7('0x2'));var timeout=require(_0x1ee7('0x3'));var express=require(_0x1ee7('0x4'));var router=express[_0x1ee7('0x5')]();var fs_extra=require(_0x1ee7('0x6'));var auth=require(_0x1ee7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1ee7('0x8'));var controller=require(_0x1ee7('0x9'));router['get']('/',auth[_0x1ee7('0xa')](),controller[_0x1ee7('0xb')]);router['get'](_0x1ee7('0xc'),auth[_0x1ee7('0xa')](),controller['describe']);router['get'](_0x1ee7('0xd'),auth[_0x1ee7('0xa')](),controller[_0x1ee7('0xe')]);router[_0x1ee7('0xf')](_0x1ee7('0x10'),auth[_0x1ee7('0xa')](),controller['getDispositions']);router[_0x1ee7('0xf')]('/:id/canned_answers',auth[_0x1ee7('0xa')](),controller[_0x1ee7('0x11')]);router[_0x1ee7('0xf')](_0x1ee7('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0x1ee7('0xf')](_0x1ee7('0x13'),auth['isAuthenticated'](),controller[_0x1ee7('0x14')]);router[_0x1ee7('0xf')](_0x1ee7('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0x1ee7('0x16')]('/',auth[_0x1ee7('0xa')](),controller[_0x1ee7('0x17')]);router[_0x1ee7('0x16')](_0x1ee7('0x10'),auth[_0x1ee7('0xa')](),controller[_0x1ee7('0x18')]);router[_0x1ee7('0x16')](_0x1ee7('0x19'),auth[_0x1ee7('0xa')](),controller['addAnswer']);router[_0x1ee7('0x16')]('/:id/notify',controller[_0x1ee7('0x1a')]);router[_0x1ee7('0x16')](_0x1ee7('0x12'),auth[_0x1ee7('0xa')](),controller[_0x1ee7('0x1b')]);router[_0x1ee7('0x16')](_0x1ee7('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0x1ee7('0x16')](_0x1ee7('0x1c'),auth['isAuthenticated'](),controller[_0x1ee7('0x1d')]);router[_0x1ee7('0x1e')](_0x1ee7('0xd'),auth[_0x1ee7('0xa')](),controller[_0x1ee7('0x1f')]);router[_0x1ee7('0x20')](_0x1ee7('0xd'),auth[_0x1ee7('0xa')](),controller[_0x1ee7('0x21')]);router['delete'](_0x1ee7('0x10'),auth[_0x1ee7('0xa')](),controller[_0x1ee7('0x22')]);router[_0x1ee7('0x20')]('/:id/canned_answers',auth[_0x1ee7('0xa')](),controller[_0x1ee7('0x23')]);router[_0x1ee7('0x20')]('/:id/users',auth[_0x1ee7('0xa')](),controller['removeAgents']);module[_0x1ee7('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 563ce83..3c1f546 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 _0x9595=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING','name','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9595,0x156));var _0x5959=function(_0x4f7339,_0x1dc41e){_0x4f7339=_0x4f7339-0x0;var _0x241781=_0x9595[_0x4f7339];return _0x241781;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5959('0x0'));module[_0x5959('0x1')]={'name':{'type':Sequelize[_0x5959('0x2')],'unique':_0x5959('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5959('0x2')]},'token':{'type':Sequelize[_0x5959('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x5959('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5959('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5959('0x4');}},'notificationSound':{'type':Sequelize[_0x5959('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5959('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5959('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5959('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5959('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5959('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5959('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5959('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5959('0x8'),'set':function(_0x16fc42){if(!_0x16fc42)this[_0x5959('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x16fc42);}}}; \ No newline at end of file +var _0x6e28=['generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING'];(function(_0x1f135e,_0x454530){var _0x3dfa1c=function(_0x41d01e){while(--_0x41d01e){_0x1f135e['push'](_0x1f135e['shift']());}};_0x3dfa1c(++_0x454530);}(_0x6e28,0x140));var _0x86e2=function(_0x4cd055,_0x5675c4){_0x4cd055=_0x4cd055-0x0;var _0x1c59ce=_0x6e28[_0x4cd055];return _0x1c59ce;};'use strict';var Sequelize=require(_0x86e2('0x0'));var rs=require(_0x86e2('0x1'));module[_0x86e2('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x86e2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x86e2('0x4')]},'token':{'type':Sequelize[_0x86e2('0x4')],'defaultValue':function(){return rs[_0x86e2('0x5')]();}},'replyUri':{'type':Sequelize[_0x86e2('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x86e2('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x86e2('0x6')],'defaultValue':function(){return _0x86e2('0x7');}},'notificationSound':{'type':Sequelize[_0x86e2('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x86e2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x86e2('0x4')]},'queueTransfer':{'type':Sequelize[_0x86e2('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x86e2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x86e2('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x86e2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x86e2('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x86e2('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x343ee9){if(!_0x343ee9)this[_0x86e2('0xa')](_0x86e2('0xb'),null);this['setDataValue'](_0x86e2('0xc'),_0x343ee9);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index bbee509..0ca730d 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 _0x4944=['order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','Applications','applications','orderBy','priority','asc','account','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','getApplications','Contact','Owner','fullname','internal','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','dataValues','Messages','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x1cbb0b,_0x201c23){var _0x101225=function(_0x405228){while(--_0x405228){_0x1cbb0b['push'](_0x1cbb0b['shift']());}};_0x101225(++_0x201c23);}(_0x4944,0x6d));var _0x4494=function(_0x4aa52e,_0x5ceae4){_0x4aa52e=_0x4aa52e-0x0;var _0x15b9d7=_0x4944[_0x4aa52e];return _0x15b9d7;};'use strict';var emlformat=require(_0x4494('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4494('0x1'));var jsonpatch=require(_0x4494('0x2'));var rp=require(_0x4494('0x3'));var moment=require(_0x4494('0x4'));var BPromise=require(_0x4494('0x5'));var Mustache=require('mustache');var util=require(_0x4494('0x6'));var path=require('path');var sox=require(_0x4494('0x7'));var csv=require(_0x4494('0x8'));var ejs=require(_0x4494('0x9'));var fs=require('fs');var fs_extra=require(_0x4494('0xa'));var _=require(_0x4494('0xb'));var squel=require(_0x4494('0xc'));var crypto=require(_0x4494('0xd'));var jsforce=require(_0x4494('0xe'));var deskjs=require(_0x4494('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4494('0x10'));var Papa=require(_0x4494('0x11'));var Redis=require(_0x4494('0x12'));var authService=require(_0x4494('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4494('0x14'));var logger=require(_0x4494('0x15'))(_0x4494('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4494('0x17'));var db=require(_0x4494('0x18'))['db'];config[_0x4494('0x19')]=_[_0x4494('0x1a')](config[_0x4494('0x19')],{'host':_0x4494('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4494('0x19')]));require(_0x4494('0x1c'))[_0x4494('0x1d')](socket);var jayson=require(_0x4494('0x1e'));var client=jayson[_0x4494('0x1f')][_0x4494('0x20')]({'port':0x232c});var client9002=jayson[_0x4494('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2caa38,_0x5a0985,_0x5570a4,_0x1a93bc){return new BPromise(function(_0x267d0b,_0x5abaa9){var _0x49350a=_0x1a93bc||client;return _0x49350a[_0x4494('0x21')](_0x2caa38,_0x5570a4)['then'](function(_0x4655ce){logger[_0x4494('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x5a0985,_0x4494('0x23'));logger['debug'](_0x4494('0x24'),_0x5a0985,_0x4494('0x23'),JSON['stringify'](_0x4655ce));if(_0x4655ce['error']){if(_0x4655ce[_0x4494('0x25')][_0x4494('0x26')]===0x1f4){logger[_0x4494('0x25')](_0x4494('0x27'),_0x5a0985,_0x4655ce[_0x4494('0x25')][_0x4494('0x28')]);return _0x5abaa9(_0x4655ce[_0x4494('0x25')][_0x4494('0x28')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5a0985,_0x4655ce['error']['message']);return _0x267d0b(_0x4655ce[_0x4494('0x25')][_0x4494('0x28')]);}else{logger[_0x4494('0x22')](_0x4494('0x27'),_0x5a0985,'request\x20sent');_0x267d0b(_0x4655ce[_0x4494('0x29')][_0x4494('0x28')]);}})['catch'](function(_0x10b231){logger[_0x4494('0x25')](_0x4494('0x27'),_0x5a0985,_0x10b231);_0x5abaa9(_0x10b231);});});}function respondWithStatusCode(_0x4abe3c,_0xfc1631){_0xfc1631=_0xfc1631||0xcc;return function(_0x5926fc){if(_0x5926fc){return _0x4abe3c[_0x4494('0x2a')](_0xfc1631);}return _0x4abe3c['status'](_0xfc1631)[_0x4494('0x2b')]();};}function respondWithResult(_0x2fcc43,_0xce3c8d){_0xce3c8d=_0xce3c8d||0xc8;return function(_0x54f1ea){if(_0x54f1ea){return _0x2fcc43[_0x4494('0x2c')](_0xce3c8d)[_0x4494('0x2d')](_0x54f1ea);}};}function respondWithFilteredResult(_0x491027,_0x268f14){return function(_0x303321){if(_0x303321){var _0x3efe5d=typeof _0x268f14['offset']===_0x4494('0x2e')&&typeof _0x268f14[_0x4494('0x2f')]===_0x4494('0x2e');var _0x19f483=_0x303321[_0x4494('0x30')];var _0x13ea90=_0x3efe5d?0x0:_0x268f14[_0x4494('0x31')];var _0xcce4da=_0x3efe5d?_0x303321['count']:_0x268f14[_0x4494('0x31')]+_0x268f14[_0x4494('0x2f')];var _0x51c69d;if(_0xcce4da>=_0x19f483){_0xcce4da=_0x19f483;_0x51c69d=0xc8;}else{_0x51c69d=0xce;}_0x491027['status'](_0x51c69d);return _0x491027[_0x4494('0x32')](_0x4494('0x33'),_0x13ea90+'-'+_0xcce4da+'/'+_0x19f483)[_0x4494('0x2d')](_0x303321);}return null;};}function patchUpdates(_0x34121b){return function(_0x1e4b74){try{jsonpatch[_0x4494('0x34')](_0x1e4b74,_0x34121b,!![]);}catch(_0x279631){return BPromise['reject'](_0x279631);}return _0x1e4b74[_0x4494('0x35')]();};}function saveUpdates(_0x1c6ff8,_0x2f4740){return function(_0x1f3306){if(_0x1f3306){return _0x1f3306[_0x4494('0x36')](_0x1c6ff8)[_0x4494('0x37')](function(_0x5bba31){return _0x5bba31;});}return null;};}function removeEntity(_0x302108,_0x1009a4){return function(_0x3b3cae){if(_0x3b3cae){return _0x3b3cae[_0x4494('0x38')]()[_0x4494('0x37')](function(){var _0x5c70d7=_0x3b3cae[_0x4494('0x39')]({'plain':!![]});var _0x4dbe69='OpenchannelAccounts';return db[_0x4494('0x3a')]['destroy']({'where':{'type':_0x4dbe69,'resourceId':_0x5c70d7['id']}})['then'](function(){return _0x3b3cae;});})['then'](function(){_0x302108[_0x4494('0x2c')](0xcc)[_0x4494('0x2b')]();});}};}function handleEntityNotFound(_0x322748,_0x546133){return function(_0x542359){if(!_0x542359){_0x322748[_0x4494('0x2a')](0x194);}return _0x542359;};}function handleError(_0x21fe70,_0x17726f){_0x17726f=_0x17726f||0x1f4;return function(_0x166d29){logger[_0x4494('0x25')](_0x166d29[_0x4494('0x3b')]);if(_0x166d29[_0x4494('0x3c')]){delete _0x166d29[_0x4494('0x3c')];}_0x21fe70[_0x4494('0x2c')](_0x17726f)[_0x4494('0x3d')](_0x166d29);};}exports[_0x4494('0x3e')]=function(_0x14542e,_0x27d93f){var _0x4a8dc1={'include':[{'model':db[_0x4494('0x3f')],'as':_0x4494('0x40')}]},_0x1b5442={},_0xd09dbb={'count':0x0,'rows':[]};var _0x20b267=_[_0x4494('0x41')](db[_0x4494('0x42')][_0x4494('0x43')],function(_0x231adc){return{'name':_0x231adc['fieldName'],'type':_0x231adc['type'][_0x4494('0x44')]};});_0x1b5442['model']=_[_0x4494('0x41')](_0x20b267,_0x4494('0x3c'));_0x1b5442[_0x4494('0x45')]=_[_0x4494('0x46')](_0x14542e[_0x4494('0x45')]);_0x1b5442['filters']=_['intersection'](_0x1b5442[_0x4494('0x47')],_0x1b5442['query']);_0x4a8dc1[_0x4494('0x48')]=_[_0x4494('0x49')](_0x1b5442[_0x4494('0x47')],qs[_0x4494('0x4a')](_0x14542e[_0x4494('0x45')][_0x4494('0x4a')]));_0x4a8dc1[_0x4494('0x48')]=_0x4a8dc1['attributes'][_0x4494('0x4b')]?_0x4a8dc1[_0x4494('0x48')]:_0x1b5442['model'];if(!_0x14542e[_0x4494('0x45')][_0x4494('0x4c')](_0x4494('0x4d'))){_0x4a8dc1['limit']=qs[_0x4494('0x2f')](_0x14542e[_0x4494('0x45')][_0x4494('0x2f')]);_0x4a8dc1[_0x4494('0x31')]=qs['offset'](_0x14542e['query'][_0x4494('0x31')]);}_0x4a8dc1[_0x4494('0x4e')]=qs[_0x4494('0x4f')](_0x14542e['query']['sort']);_0x4a8dc1[_0x4494('0x50')]=qs[_0x4494('0x51')](_[_0x4494('0x52')](_0x14542e['query'],_0x1b5442[_0x4494('0x51')]),_0x20b267);if(_0x14542e[_0x4494('0x45')]['filter']){_0x4a8dc1[_0x4494('0x50')]=_[_0x4494('0x53')](_0x4a8dc1[_0x4494('0x50')],{'$or':_[_0x4494('0x41')](_0x20b267,function(_0x274d7d){if(_0x274d7d['type']!==_0x4494('0x54')){var _0x3c5475={};_0x3c5475[_0x274d7d[_0x4494('0x3c')]]={'$like':'%'+_0x14542e[_0x4494('0x45')][_0x4494('0x55')]+'%'};return _0x3c5475;}})});}_0x4a8dc1=_[_0x4494('0x53')]({},_0x4a8dc1,_0x14542e[_0x4494('0x56')]);var _0x904f3={'where':_0x4a8dc1[_0x4494('0x50')]};return db[_0x4494('0x42')]['count'](_0x904f3)[_0x4494('0x37')](function(_0x5965f9){_0xd09dbb[_0x4494('0x30')]=_0x5965f9;if(_0x14542e[_0x4494('0x45')][_0x4494('0x57')]){_0x4a8dc1[_0x4494('0x58')]=[{'all':!![]}];}return db[_0x4494('0x42')]['findAll'](_0x4a8dc1);})[_0x4494('0x37')](function(_0x4eb660){_0xd09dbb['rows']=_0x4eb660;return _0xd09dbb;})['then'](respondWithFilteredResult(_0x27d93f,_0x4a8dc1))['catch'](handleError(_0x27d93f,null));};exports['show']=function(_0x2d3ec9,_0x3307cf){var _0x4331c6={'raw':![],'where':{'id':_0x2d3ec9[_0x4494('0x59')]['id']},'include':[{'model':db[_0x4494('0x3f')],'as':_0x4494('0x40')}]},_0x3ffea6={};_0x3ffea6['model']=_['keys'](db['OpenchannelAccount'][_0x4494('0x43')]);_0x3ffea6[_0x4494('0x45')]=_['keys'](_0x2d3ec9[_0x4494('0x45')]);_0x3ffea6[_0x4494('0x51')]=_[_0x4494('0x49')](_0x3ffea6[_0x4494('0x47')],_0x3ffea6[_0x4494('0x45')]);_0x4331c6['attributes']=_[_0x4494('0x49')](_0x3ffea6['model'],qs['fields'](_0x2d3ec9[_0x4494('0x45')]['fields']));_0x4331c6[_0x4494('0x48')]=_0x4331c6[_0x4494('0x48')]['length']?_0x4331c6['attributes']:_0x3ffea6[_0x4494('0x47')];if(_0x2d3ec9[_0x4494('0x45')][_0x4494('0x57')]){_0x4331c6['include']=[{'all':!![]}];}_0x4331c6=_[_0x4494('0x53')]({},_0x4331c6,_0x2d3ec9[_0x4494('0x56')]);return db[_0x4494('0x42')][_0x4494('0x5a')](_0x4331c6)[_0x4494('0x37')](handleEntityNotFound(_0x3307cf,null))[_0x4494('0x37')](respondWithResult(_0x3307cf,null))['catch'](handleError(_0x3307cf,null));};exports['create']=function(_0x5dc638,_0x4e9b7c){return db[_0x4494('0x42')][_0x4494('0x5b')](_0x5dc638[_0x4494('0x5c')],{})['then'](function(_0x4dd3af){var _0x1e1ab4=_0x5dc638[_0x4494('0x5d')][_0x4494('0x39')]({'plain':!![]});if(!_0x1e1ab4)throw new Error(_0x4494('0x5e'));if(_0x1e1ab4[_0x4494('0x5f')]===_0x4494('0x5d')){var _0x3ee4be=_0x4dd3af['get']({'plain':!![]});var _0x314c3a=_0x4494('0x60');return db['UserProfileSection'][_0x4494('0x5a')]({'where':{'name':_0x314c3a,'userProfileId':_0x1e1ab4[_0x4494('0x61')]},'raw':!![]})[_0x4494('0x37')](function(_0x470236){if(_0x470236&&_0x470236[_0x4494('0x62')]===0x0){return db[_0x4494('0x3a')][_0x4494('0x5b')]({'name':_0x3ee4be[_0x4494('0x3c')],'resourceId':_0x3ee4be['id'],'type':_0x470236[_0x4494('0x3c')],'sectionId':_0x470236['id']},{})['then'](function(){return _0x4dd3af;});}else{return _0x4dd3af;}})[_0x4494('0x63')](function(_0x588528){logger['error'](_0x4494('0x64'),_0x588528);throw _0x588528;});}return _0x4dd3af;})[_0x4494('0x37')](respondWithResult(_0x4e9b7c,0xc9))['catch'](handleError(_0x4e9b7c,null));};exports[_0x4494('0x36')]=function(_0x1175a3,_0x386017){if(_0x1175a3[_0x4494('0x5c')]['id']){delete _0x1175a3[_0x4494('0x5c')]['id'];}return db['OpenchannelAccount'][_0x4494('0x5a')]({'where':{'id':_0x1175a3[_0x4494('0x59')]['id']},'include':[{'model':db[_0x4494('0x3f')],'as':_0x4494('0x40')}]})[_0x4494('0x37')](handleEntityNotFound(_0x386017,null))[_0x4494('0x37')](saveUpdates(_0x1175a3['body'],null))['then'](respondWithResult(_0x386017,null))[_0x4494('0x63')](handleError(_0x386017,null));};exports[_0x4494('0x38')]=function(_0x3f62f4,_0x46cb05){return db[_0x4494('0x42')][_0x4494('0x5a')]({'where':{'id':_0x3f62f4[_0x4494('0x59')]['id']}})[_0x4494('0x37')](handleEntityNotFound(_0x46cb05,null))[_0x4494('0x37')](removeEntity(_0x46cb05,null))[_0x4494('0x63')](handleError(_0x46cb05,null));};exports['describe']=function(_0x5562a3,_0x5e900c){return db[_0x4494('0x42')][_0x4494('0x65')]()['then'](respondWithResult(_0x5e900c,null))[_0x4494('0x63')](handleError(_0x5e900c,null));};exports[_0x4494('0x66')]=function(_0x42d062,_0x1ba9ce,_0x12eb81){if(_0x42d062[_0x4494('0x5c')]['id']){delete _0x42d062[_0x4494('0x5c')]['id'];}return db['OpenchannelAccount'][_0x4494('0x5a')]({'where':{'id':_0x42d062[_0x4494('0x59')]['id']}})[_0x4494('0x37')](handleEntityNotFound(_0x1ba9ce,null))[_0x4494('0x37')](function(_0x178f3e){if(_0x178f3e){_0x42d062[_0x4494('0x5c')][_0x4494('0x67')]=_0x178f3e['id'];return db[_0x4494('0x68')]['create'](_0x42d062[_0x4494('0x5c')]);}})['then'](respondWithResult(_0x1ba9ce,null))['catch'](handleError(_0x1ba9ce,null));};exports[_0x4494('0x69')]=function(_0x36714f,_0x4c90e0,_0x5a5edf){var _0x2f8459={'raw':![],'where':{}};var _0xa38100={};var _0x4f6387={'count':0x0,'rows':[]};return db[_0x4494('0x42')][_0x4494('0x6a')]({'where':{'id':_0x36714f[_0x4494('0x59')]['id']}})['then'](handleEntityNotFound(_0x4c90e0,null))['then'](function(_0x4c88e1){if(_0x4c88e1){_0xa38100[_0x4494('0x47')]=_[_0x4494('0x46')](db[_0x4494('0x68')][_0x4494('0x43')]);_0xa38100[_0x4494('0x45')]=_['keys'](_0x36714f[_0x4494('0x45')]);_0xa38100['filters']=_['intersection'](_0xa38100[_0x4494('0x47')],_0xa38100['query']);_0x2f8459[_0x4494('0x48')]=_['intersection'](_0xa38100[_0x4494('0x47')],qs['fields'](_0x36714f['query']['fields']));_0x2f8459['attributes']=_0x2f8459[_0x4494('0x48')][_0x4494('0x4b')]?_0x2f8459[_0x4494('0x48')]:_0xa38100[_0x4494('0x47')];if(!_0x36714f[_0x4494('0x45')][_0x4494('0x4c')](_0x4494('0x4d'))){_0x2f8459[_0x4494('0x2f')]=qs[_0x4494('0x2f')](_0x36714f[_0x4494('0x45')]['limit']);_0x2f8459['offset']=qs['offset'](_0x36714f[_0x4494('0x45')][_0x4494('0x31')]);}_0x2f8459[_0x4494('0x4e')]=qs['sort'](_0x36714f[_0x4494('0x45')][_0x4494('0x4f')]);_0x2f8459[_0x4494('0x50')]=qs[_0x4494('0x51')](_[_0x4494('0x52')](_0x36714f['query'],_0xa38100[_0x4494('0x51')]));_0x2f8459[_0x4494('0x50')]['OpenchannelAccountId']=_0x4c88e1['id'];if(_0x36714f['query']['filter']){_0x2f8459['where']=_['merge'](_0x2f8459['where'],{'$or':_[_0x4494('0x41')](_0x2f8459[_0x4494('0x48')],function(_0x4ee191){var _0x25dc58={};_0x25dc58[_0x4ee191]={'$like':'%'+_0x36714f[_0x4494('0x45')][_0x4494('0x55')]+'%'};return _0x25dc58;})});}_0x2f8459=_[_0x4494('0x53')]({},_0x2f8459,_0x36714f['options']);return db[_0x4494('0x68')]['count']({'where':_0x2f8459[_0x4494('0x50')]})[_0x4494('0x37')](function(_0x143156){_0x4f6387[_0x4494('0x30')]=_0x143156;if(_0x36714f[_0x4494('0x45')]['includeAll']){_0x2f8459[_0x4494('0x58')]=[{'all':!![]}];}return db[_0x4494('0x68')]['findAll'](_0x2f8459);})['then'](function(_0x22f8b3){_0x4f6387[_0x4494('0x6b')]=_0x22f8b3;return _0x4f6387;});}})[_0x4494('0x37')](respondWithFilteredResult(_0x4c90e0,_0x2f8459))[_0x4494('0x63')](handleError(_0x4c90e0,null));};exports[_0x4494('0x6c')]=function(_0xcc8382,_0x3957ff,_0x27c56f){return db[_0x4494('0x42')]['find']({'where':{'id':_0xcc8382[_0x4494('0x59')]['id']}})['then'](handleEntityNotFound(_0x3957ff,null))[_0x4494('0x37')](function(_0x9a945){if(_0x9a945){return _0x9a945[_0x4494('0x6c')](_0xcc8382['query'][_0x4494('0x6d')]);}})['then'](respondWithStatusCode(_0x3957ff,null))[_0x4494('0x63')](handleError(_0x3957ff,null));};exports[_0x4494('0x6e')]=function(_0x652c4b,_0x1d0f01,_0x1796d1){if(_0x652c4b[_0x4494('0x5c')]['id']){delete _0x652c4b['body']['id'];}return db[_0x4494('0x42')][_0x4494('0x5a')]({'where':{'id':_0x652c4b['params']['id']}})[_0x4494('0x37')](handleEntityNotFound(_0x1d0f01,null))['then'](function(_0xd4c3fe){if(_0xd4c3fe){_0x652c4b[_0x4494('0x5c')][_0x4494('0x67')]=_0xd4c3fe['id'];return db[_0x4494('0x6f')]['create'](_0x652c4b[_0x4494('0x5c')]);}})['then'](respondWithResult(_0x1d0f01,null))[_0x4494('0x63')](handleError(_0x1d0f01,null));};exports[_0x4494('0x70')]=function(_0x245a64,_0xcc90e9,_0x2d1a9c){var _0x4d7a31={'raw':![],'where':{}};var _0x5618af={};var _0x45716f={'count':0x0,'rows':[]};return db[_0x4494('0x42')]['findOne']({'where':{'id':_0x245a64[_0x4494('0x59')]['id']}})[_0x4494('0x37')](handleEntityNotFound(_0xcc90e9,null))[_0x4494('0x37')](function(_0x56fa0a){if(_0x56fa0a){_0x5618af[_0x4494('0x47')]=_[_0x4494('0x46')](db[_0x4494('0x6f')][_0x4494('0x43')]);_0x5618af[_0x4494('0x45')]=_['keys'](_0x245a64[_0x4494('0x45')]);_0x5618af[_0x4494('0x51')]=_[_0x4494('0x49')](_0x5618af['model'],_0x5618af['query']);_0x4d7a31[_0x4494('0x48')]=_[_0x4494('0x49')](_0x5618af[_0x4494('0x47')],qs['fields'](_0x245a64[_0x4494('0x45')]['fields']));_0x4d7a31[_0x4494('0x48')]=_0x4d7a31[_0x4494('0x48')][_0x4494('0x4b')]?_0x4d7a31[_0x4494('0x48')]:_0x5618af[_0x4494('0x47')];if(!_0x245a64[_0x4494('0x45')][_0x4494('0x4c')](_0x4494('0x4d'))){_0x4d7a31[_0x4494('0x2f')]=qs[_0x4494('0x2f')](_0x245a64[_0x4494('0x45')]['limit']);_0x4d7a31[_0x4494('0x31')]=qs[_0x4494('0x31')](_0x245a64[_0x4494('0x45')][_0x4494('0x31')]);}_0x4d7a31[_0x4494('0x4e')]=qs[_0x4494('0x4f')](_0x245a64[_0x4494('0x45')][_0x4494('0x4f')]);_0x4d7a31[_0x4494('0x50')]=qs['filters'](_['pick'](_0x245a64[_0x4494('0x45')],_0x5618af[_0x4494('0x51')]));_0x4d7a31[_0x4494('0x50')][_0x4494('0x67')]=_0x56fa0a['id'];if(_0x245a64[_0x4494('0x45')][_0x4494('0x55')]){_0x4d7a31[_0x4494('0x50')]=_[_0x4494('0x53')](_0x4d7a31[_0x4494('0x50')],{'$or':_[_0x4494('0x41')](_0x4d7a31[_0x4494('0x48')],function(_0x3c5c68){var _0xb26abd={};_0xb26abd[_0x3c5c68]={'$like':'%'+_0x245a64[_0x4494('0x45')][_0x4494('0x55')]+'%'};return _0xb26abd;})});}_0x4d7a31=_[_0x4494('0x53')]({},_0x4d7a31,_0x245a64['options']);return db['CannedAnswer'][_0x4494('0x30')]({'where':_0x4d7a31[_0x4494('0x50')]})[_0x4494('0x37')](function(_0x4c6e97){_0x45716f[_0x4494('0x30')]=_0x4c6e97;if(_0x245a64[_0x4494('0x45')]['includeAll']){_0x4d7a31[_0x4494('0x58')]=[{'all':!![]}];}return db[_0x4494('0x6f')][_0x4494('0x71')](_0x4d7a31);})[_0x4494('0x37')](function(_0x5cf870){_0x45716f[_0x4494('0x6b')]=_0x5cf870;return _0x45716f;});}})[_0x4494('0x37')](respondWithFilteredResult(_0xcc90e9,_0x4d7a31))[_0x4494('0x63')](handleError(_0xcc90e9,null));};exports[_0x4494('0x72')]=function(_0x28315d,_0x26ea75,_0x20dbdd){return db['OpenchannelAccount'][_0x4494('0x5a')]({'where':{'id':_0x28315d[_0x4494('0x59')]['id']}})[_0x4494('0x37')](handleEntityNotFound(_0x26ea75,null))[_0x4494('0x37')](function(_0x4c47f1){if(_0x4c47f1){return _0x4c47f1[_0x4494('0x72')](_0x28315d[_0x4494('0x45')][_0x4494('0x6d')]);}})[_0x4494('0x37')](respondWithStatusCode(_0x26ea75,null))[_0x4494('0x63')](handleError(_0x26ea75,null));};exports[_0x4494('0x73')]=function(_0x51c4c6,_0x2dfed2,_0x372890){var _0x3c8cf9={'body':_0x51c4c6[_0x4494('0x5c')],'channel':'openchannel'};var _0x30e38c=[];var _0x2dceeb=[];var _0x24001d={};var _0x15baf1=![];return db[_0x4494('0x74')][_0x4494('0x65')]()[_0x4494('0x37')](function(_0x4e6ab0){if(!_0x4e6ab0){throw new db[(_0x4494('0x75'))]['ValidationError'](_0x4494('0x76'));}_0x30e38c=_['difference'](_['keys'](_0x4e6ab0),[_0x4494('0x77'),_0x4494('0x78')]);_0x2dceeb=_['difference'](_['keys'](_0x4e6ab0),[_0x4494('0x77'),_0x4494('0x78'),_0x4494('0x79'),'ListId']);if(_0x51c4c6[_0x4494('0x5c')]['id']){delete _0x51c4c6[_0x4494('0x5c')]['id'];}if(_[_0x4494('0x7a')](_0x51c4c6[_0x4494('0x5c')][_0x4494('0x7b')])){throw new db['Sequelize'][(_0x4494('0x7c'))](_0x4494('0x7d'));}if(_['isNil'](_0x51c4c6[_0x4494('0x5c')][_0x4494('0x5c')])||_0x51c4c6[_0x4494('0x5c')][_0x4494('0x5c')]===''){throw new db[(_0x4494('0x75'))]['ValidationError'](_0x4494('0x7e'));}if(_['isNil'](_0x51c4c6[_0x4494('0x5c')][_0x4494('0x7f')])){throw new db[(_0x4494('0x75'))]['ValidationError'](_0x4494('0x80')+_0x2dceeb);}if(!_[_0x4494('0x81')](_0x2dceeb,_0x51c4c6['body'][_0x4494('0x7f')])){throw new db[(_0x4494('0x75'))]['ValidationError'](_0x4494('0x82')+_0x2dceeb);}_0x24001d[_0x51c4c6[_0x4494('0x5c')][_0x4494('0x7f')]]=_0x51c4c6['body'][_0x4494('0x7b')];})[_0x4494('0x37')](function(){return db[_0x4494('0x42')][_0x4494('0x5a')]({'where':{'id':_0x51c4c6[_0x4494('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x4494('0x83'),'include':[{'model':db[_0x4494('0x74')],'as':_0x4494('0x84'),'where':_0x24001d,'limit':0x1,'order':[[_0x4494('0x78'),_0x4494('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':_0x4494('0x86')}]});})['then'](handleEntityNotFound(_0x2dfed2,null))[_0x4494('0x37')](function(_0x3f6737){if(_0x3f6737&&_0x3f6737['List']){_0x3c8cf9['account']=_0x3f6737;_0x3c8cf9[_0x4494('0x87')]=_0x3f6737[_0x4494('0x86')];_0x3c8cf9['list']=_0x3f6737[_0x4494('0x83')];_0x3c8cf9[_0x4494('0x87')]=_[_0x4494('0x88')](_0x3c8cf9[_0x4494('0x87')],[_0x4494('0x89')],[_0x4494('0x8a')]);if(_0x3c8cf9['account'][_0x4494('0x86')]){delete _0x3c8cf9[_0x4494('0x8b')][_0x4494('0x86')];}if(_0x3c8cf9[_0x4494('0x8b')][_0x4494('0x83')]&&_0x3c8cf9[_0x4494('0x8b')][_0x4494('0x83')][_0x4494('0x84')][_0x4494('0x4b')]){return _0x3c8cf9[_0x4494('0x8b')]['List'][_0x4494('0x84')][0x0];}var _0x153301=_[_0x4494('0x1a')](_0x51c4c6[_0x4494('0x5c')],{'firstName':_0x51c4c6[_0x4494('0x5c')][_0x4494('0x7b')],'ListId':_0x3f6737[_0x4494('0x8c')]});_0x153301[_0x51c4c6[_0x4494('0x5c')][_0x4494('0x7f')]]=_0x51c4c6['body']['from'];return db[_0x4494('0x74')][_0x4494('0x5b')](_0x153301,{'fields':_0x30e38c,'raw':!![]});}})[_0x4494('0x37')](handleEntityNotFound(_0x2dfed2,null))['then'](function(_0x26b785){_0x3c8cf9[_0x4494('0x8d')]=_0x26b785;if(_0x26b785){var _0x2a9e8f={'ContactId':_0x26b785['id'],'OpenchannelAccountId':_0x51c4c6[_0x4494('0x59')]['id'],'from':(_0x26b785[_0x4494('0x8e')]||'')+'\x20'+(_0x26b785['lastName']||'')};var _0x5e6f41={'OpenchannelAccountId':_0x51c4c6[_0x4494('0x59')]['id'],'closed':![]};if(_0x51c4c6['body'][_0x4494('0x8f')]){_0x5e6f41['threadId']=_0x51c4c6[_0x4494('0x5c')]['threadId'];return db[_0x4494('0x90')][_0x4494('0x5a')]({'where':_0x5e6f41})[_0x4494('0x37')](function(_0x1cb836){if(_0x1cb836){return[_0x1cb836,![]];}_0x2a9e8f[_0x4494('0x8f')]=_0x51c4c6['body'][_0x4494('0x8f')];_0x2a9e8f[_0x4494('0x91')]=_0x51c4c6[_0x4494('0x5c')][_0x4494('0x91')];return db[_0x4494('0x90')][_0x4494('0x5b')](_0x2a9e8f)[_0x4494('0x37')](function(_0x5d0d95){return[_0x5d0d95,!![]];});});}else{_0x5e6f41[_0x4494('0x8f')]=null;}_0x5e6f41['ContactId']=_0x26b785['id'];return db[_0x4494('0x90')][_0x4494('0x5a')]({'where':_0x5e6f41})[_0x4494('0x37')](function(_0x1cd50c){if(_0x1cd50c){return[_0x1cd50c,![]];}return db[_0x4494('0x90')]['create'](_0x2a9e8f)[_0x4494('0x37')](function(_0x138e11){return[_0x138e11,!![]];});});}})[_0x4494('0x92')](function(_0x140acd,_0x2e8286){if(_0x140acd){_0x15baf1=_0x2e8286;if(!_0x2e8286){var _0x44a545={'from':(_0x3c8cf9[_0x4494('0x8d')][_0x4494('0x8e')]||'')+'\x20'+(_0x3c8cf9['contact'][_0x4494('0x93')]||'')};if(_0x51c4c6[_0x4494('0x5c')]['threadId']&&_0x51c4c6[_0x4494('0x5c')][_0x4494('0x94')]&&_0x51c4c6[_0x4494('0x5c')]['threadId']!=_0x51c4c6[_0x4494('0x5c')][_0x4494('0x94')]){_0x44a545[_0x4494('0x8f')]=_0x51c4c6['body'][_0x4494('0x94')];}return _0x140acd['update'](_0x44a545);}else{return _0x140acd;}}})[_0x4494('0x37')](function(_0x2063b1){_0x3c8cf9[_0x4494('0x95')]=_0x2063b1[_0x4494('0x39')]({'plain':!![]});_0x3c8cf9['interaction'][_0x4494('0x96')]=_0x15baf1;if(_0x3c8cf9['interaction'][_0x4494('0x96')]){if(_0x3c8cf9['account'][_0x4494('0x97')]){_0x3c8cf9[_0x4494('0x87')][_0x4494('0x98')]({'id':0x0,'priority':_0x3c8cf9[_0x4494('0x87')][_0x4494('0x4b')]+0x1,'app':_0x4494('0x99'),'appdata':_0x4494('0x9a'),'interval':_0x4494('0x9b')});}}return db[_0x4494('0x9c')]['create']({'body':_0x51c4c6['body'][_0x4494('0x5c')],'OpenchannelAccountId':_0x51c4c6[_0x4494('0x59')]['id'],'OpenchannelInteractionId':_0x2063b1['id'],'direction':'in','ContactId':_0x3c8cf9['contact']['id'],'AttachmentId':_0x51c4c6[_0x4494('0x5c')]['AttachmentId']});})[_0x4494('0x37')](function(_0x52972d){_0x3c8cf9[_0x4494('0x28')]=_0x52972d;if(_0x3c8cf9[_0x4494('0x95')]['UserId']){return db[_0x4494('0x9d')][_0x4494('0x5a')]({'attributes':['id',_0x4494('0x3c')],'where':{'id':_0x3c8cf9[_0x4494('0x95')]['UserId']}})[_0x4494('0x37')](function(_0x4eedd0){if(_0x4eedd0){_0x3c8cf9[_0x4494('0x87')][_0x4494('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4eedd0[_0x4494('0x3c')]+','+(_0x3c8cf9[_0x4494('0x8b')][_0x4494('0x9f')]||0xa),'interval':_0x4494('0x9b')});_0x3c8cf9[_0x4494('0xa0')]=![];}return respondWithRpcPromise(_0x4494('0xa1'),_0x4494('0xa2'),_0x3c8cf9);});}return respondWithRpcPromise(_0x4494('0xa1'),'startRouting',_0x3c8cf9);})[_0x4494('0x37')](function(_0x2706c2){respondWithRpcPromise(_0x4494('0xa3'),_0x4494('0xa3'),{'event':'notify','message':_0x2706c2},client9002);return _0x2706c2;})[_0x4494('0x37')](respondWithResult(_0x2dfed2,null))[_0x4494('0x63')](handleError(_0x2dfed2,null));};exports[_0x4494('0xa4')]=function(_0x3f20a6,_0x360c02){var _0x4d9b09=_0x3f20a6[_0x4494('0x59')]['id'];var _0x366d7a=_0x3f20a6[_0x4494('0x5c')];var _0x5738d6=0xc8;var _0x22dca8=null;return db[_0x4494('0xa5')]['transaction']({'isolationLevel':db[_0x4494('0xa5')][_0x4494('0xa6')][_0x4494('0xa7')][_0x4494('0xa8')]},function(_0x4ebbb7){return db[_0x4494('0x42')]['findOne']({'where':{'id':_0x4d9b09},'transaction':_0x4ebbb7})[_0x4494('0x37')](function(_0x83dac){if(_0x83dac){return db['OpenchannelApplication'][_0x4494('0x38')]({'where':{'OpenchannelAccountId':_0x4d9b09},'transaction':_0x4ebbb7})[_0x4494('0x37')](function(){var _0x2f41e3=_['map'](_0x366d7a,function(_0x5bd9b4){_0x5bd9b4[_0x4494('0x67')]=_0x4d9b09;return _0x5bd9b4;});return db['OpenchannelApplication']['bulkCreate'](_0x2f41e3,{'transaction':_0x4ebbb7});});}else{_0x5738d6=0x194;_0x22dca8=[];}});})[_0x4494('0x37')](function(){if(_0x5738d6!==0x194){return db[_0x4494('0xa9')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x4d9b09},'order':_0x4494('0x89')})['then'](function(_0x1e2e43){_0x22dca8=_0x1e2e43;});}})[_0x4494('0x63')](function(_0x4a5354){_0x5738d6=0x1f4;logger[_0x4494('0x25')](_0x4a5354[_0x4494('0x3b')]);if(_0x4a5354[_0x4494('0x3c')]){delete _0x4a5354[_0x4494('0x3c')];}_0x22dca8=_0x4a5354;})['finally'](function(){if(_0x22dca8===null){_0x360c02[_0x4494('0x2a')](_0x5738d6);}else{if(_0x5738d6===0x1f4){_0x360c02[_0x4494('0x2c')](_0x5738d6)[_0x4494('0x3d')](_0x22dca8);}else{_0x360c02[_0x4494('0x2c')](_0x5738d6)['json'](_0x22dca8);}}});};exports[_0x4494('0xaa')]=function(_0x1cfedf,_0x24e36e,_0x3562eb){var _0x13e395={};var _0xe99b37={};var _0x2c57f3;var _0xf2bea8;return db[_0x4494('0x42')]['findOne']({'where':{'id':_0x1cfedf[_0x4494('0x59')]['id']}})[_0x4494('0x37')](handleEntityNotFound(_0x24e36e,null))[_0x4494('0x37')](function(_0x562ce5){if(_0x562ce5){_0x2c57f3=_0x562ce5;_0xe99b37[_0x4494('0x47')]=_[_0x4494('0x46')](db['OpenchannelApplication']['rawAttributes']);_0xe99b37['query']=_[_0x4494('0x46')](_0x1cfedf[_0x4494('0x45')]);_0xe99b37[_0x4494('0x51')]=_[_0x4494('0x49')](_0xe99b37[_0x4494('0x47')],_0xe99b37[_0x4494('0x45')]);_0x13e395['attributes']=_['intersection'](_0xe99b37[_0x4494('0x47')],qs[_0x4494('0x4a')](_0x1cfedf[_0x4494('0x45')][_0x4494('0x4a')]));_0x13e395['attributes']=_0x13e395[_0x4494('0x48')][_0x4494('0x4b')]?_0x13e395[_0x4494('0x48')]:_0xe99b37[_0x4494('0x47')];_0x13e395['order']=qs[_0x4494('0x4f')](_0x1cfedf[_0x4494('0x45')][_0x4494('0x4f')]);_0x13e395[_0x4494('0x50')]=qs[_0x4494('0x51')](_[_0x4494('0x52')](_0x1cfedf['query'],_0xe99b37['filters']));if(_0x1cfedf[_0x4494('0x45')][_0x4494('0x55')]){_0x13e395[_0x4494('0x50')]=_[_0x4494('0x53')](_0x13e395[_0x4494('0x50')],{'$or':_[_0x4494('0x41')](_0x13e395[_0x4494('0x48')],function(_0x13aa99){var _0x51cec5={};_0x51cec5[_0x13aa99]={'$like':'%'+_0x1cfedf[_0x4494('0x45')]['filter']+'%'};return _0x51cec5;})});}_0x13e395=_[_0x4494('0x53')]({},_0x13e395,_0x1cfedf[_0x4494('0x56')]);return _0x2c57f3['getApplications'](_0x13e395);}})['then'](function(_0x51d113){if(_0x51d113){_0xf2bea8=_0x51d113[_0x4494('0x4b')];if(!_0x1cfedf[_0x4494('0x45')][_0x4494('0x4c')]('nolimit')){_0x13e395['limit']=qs['limit'](_0x1cfedf['query']['limit']);_0x13e395[_0x4494('0x31')]=qs[_0x4494('0x31')](_0x1cfedf['query']['offset']);}return _0x2c57f3['getApplications'](_0x13e395);}})[_0x4494('0x37')](function(_0x447475){if(_0x447475){return _0x447475?{'count':_0xf2bea8,'rows':_0x447475}:null;}})[_0x4494('0x37')](respondWithResult(_0x24e36e,null))[_0x4494('0x63')](handleError(_0x24e36e,null));};exports['getInteractions']=function(_0x45c5d6,_0x193268,_0x54da3c){var _0x2940e0={'raw':![],'where':{}};var _0x2ef21c={};var _0x496da5={'count':0x0,'rows':[]};return db[_0x4494('0x42')][_0x4494('0x6a')]({'where':{'id':_0x45c5d6['params']['id']}})[_0x4494('0x37')](handleEntityNotFound(_0x193268,null))[_0x4494('0x37')](function(_0x8430){if(_0x8430){_0x2ef21c[_0x4494('0x47')]=_[_0x4494('0x46')](db[_0x4494('0x90')][_0x4494('0x43')]);_0x2ef21c[_0x4494('0x45')]=_[_0x4494('0x46')](_0x45c5d6['query']);_0x2ef21c[_0x4494('0x51')]=_[_0x4494('0x49')](_0x2ef21c[_0x4494('0x47')],_0x2ef21c[_0x4494('0x45')]);_0x2940e0['attributes']=_[_0x4494('0x49')](_0x2ef21c['model'],qs[_0x4494('0x4a')](_0x45c5d6[_0x4494('0x45')]['fields']));_0x2940e0[_0x4494('0x48')]=_0x2940e0[_0x4494('0x48')][_0x4494('0x4b')]?_0x2940e0[_0x4494('0x48')]:_0x2ef21c[_0x4494('0x47')];if(!_0x45c5d6[_0x4494('0x45')]['hasOwnProperty'](_0x4494('0x4d'))){_0x2940e0['limit']=qs['limit'](_0x45c5d6[_0x4494('0x45')]['limit']);_0x2940e0[_0x4494('0x31')]=qs['offset'](_0x45c5d6['query'][_0x4494('0x31')]);}_0x2940e0[_0x4494('0x4e')]=qs['sort'](_0x45c5d6['query'][_0x4494('0x4f')]);_0x2940e0[_0x4494('0x50')]=qs[_0x4494('0x51')](_[_0x4494('0x52')](_0x45c5d6[_0x4494('0x45')],_0x2ef21c[_0x4494('0x51')]));_0x2940e0[_0x4494('0x50')][_0x4494('0x67')]=_0x8430['id'];if(_0x45c5d6[_0x4494('0x45')][_0x4494('0x55')]){_0x2940e0[_0x4494('0x50')]=_['merge'](_0x2940e0[_0x4494('0x50')],{'$or':_['map'](_0x2940e0[_0x4494('0x48')],function(_0xbb3786){var _0x14f9c1={};_0x14f9c1[_0xbb3786]={'$like':'%'+_0x45c5d6[_0x4494('0x45')]['filter']+'%'};return _0x14f9c1;})});}_0x2940e0=_['merge']({},_0x2940e0,_0x45c5d6[_0x4494('0x56')]);return db['OpenchannelInteraction'][_0x4494('0x30')]({'where':_0x2940e0[_0x4494('0x50')]})[_0x4494('0x37')](function(_0x33a4c2){_0x496da5['count']=_0x33a4c2;if(_0x45c5d6['query'][_0x4494('0x57')]){_0x2940e0[_0x4494('0x58')]=[{'model':db[_0x4494('0x74')],'as':_0x4494('0xab'),'required':![]},{'model':db['User'],'as':_0x4494('0xac'),'attributes':[_0x4494('0x3c'),_0x4494('0xad'),_0x4494('0xae')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x4494('0x3c'),_0x4494('0xaf')],'where':_0x45c5d6[_0x4494('0x45')][_0x4494('0xb0')]?{'id':_0x45c5d6[_0x4494('0x45')][_0x4494('0xb0')]}:undefined,'required':_0x45c5d6[_0x4494('0x45')][_0x4494('0xb0')]?!![]:![]}];}return db[_0x4494('0x90')][_0x4494('0x71')](_0x2940e0);})[_0x4494('0x37')](function(_0x5476fc){_0x496da5[_0x4494('0x6b')]=_0x5476fc;return _0x496da5;});}})[_0x4494('0x37')](respondWithFilteredResult(_0x193268,_0x2940e0))[_0x4494('0x63')](handleError(_0x193268,null));};exports[_0x4494('0xb1')]=function(_0x6c2379,_0xe64d41,_0x10ae65){return db[_0x4494('0x42')][_0x4494('0x5a')]({'where':{'id':_0x6c2379[_0x4494('0x59')]['id']}})['then'](handleEntityNotFound(_0xe64d41,null))[_0x4494('0x37')](function(_0x1ec4b0){if(_0x1ec4b0){return _0x1ec4b0[_0x4494('0xb1')](_0x6c2379[_0x4494('0x5c')][_0x4494('0x6d')],_['omit'](_0x6c2379[_0x4494('0x5c')],[_0x4494('0x6d'),'id'])||{})[_0x4494('0x92')](function(_0x5f366b){for(var _0x190b80=0x0;_0x190b80<_0x6c2379[_0x4494('0x5c')][_0x4494('0x6d')][_0x4494('0x4b')];_0x190b80+=0x1){socket['emit'](_0x4494('0xb2'),{'UserId':Number(_0x6c2379[_0x4494('0x5c')][_0x4494('0x6d')][_0x190b80]),'OpenchannelAccountId':Number(_0x6c2379[_0x4494('0x59')]['id'])});}return _0x5f366b;});}})[_0x4494('0x37')](respondWithResult(_0xe64d41,null))[_0x4494('0x63')](handleError(_0xe64d41,null));};exports[_0x4494('0xb3')]=function(_0x3292d4,_0x87d5de,_0x3dc5b9){return db[_0x4494('0x42')]['find']({'where':{'id':_0x3292d4[_0x4494('0x59')]['id']}})[_0x4494('0x37')](handleEntityNotFound(_0x87d5de,null))['then'](function(_0x565afd){if(_0x565afd){return _0x565afd['removeAgents'](_0x3292d4[_0x4494('0x45')]['ids'])[_0x4494('0x37')](function(){if(_[_0x4494('0xb4')](_0x3292d4['query']['ids'])){for(var _0x49d936=0x0;_0x49d936<_0x3292d4[_0x4494('0x45')][_0x4494('0x6d')][_0x4494('0x4b')];_0x49d936+=0x1){socket['emit'](_0x4494('0xb5'),{'UserId':Number(_0x3292d4['query'][_0x4494('0x6d')][_0x49d936]),'OpenchannelAccountId':Number(_0x3292d4['params']['id'])});}}else{socket['emit'](_0x4494('0xb5'),{'UserId':Number(_0x3292d4[_0x4494('0x45')][_0x4494('0x6d')]),'OpenchannelAccountId':Number(_0x3292d4[_0x4494('0x59')]['id'])});}});}})[_0x4494('0x37')](respondWithStatusCode(_0x87d5de,null))[_0x4494('0x63')](handleError(_0x87d5de,null));};exports[_0x4494('0xb6')]=function(_0xb42eac,_0x924bfb,_0xc1db12){var _0x397f9d={};var _0x5d7b29={};var _0x27f31f;var _0x70ee0a;return db['OpenchannelAccount'][_0x4494('0x6a')]({'where':{'id':_0xb42eac[_0x4494('0x59')]['id']}})[_0x4494('0x37')](handleEntityNotFound(_0x924bfb,null))[_0x4494('0x37')](function(_0x116eb0){if(_0x116eb0){_0x27f31f=_0x116eb0;_0x5d7b29[_0x4494('0x47')]=_[_0x4494('0x46')](db['User'][_0x4494('0x43')]);_0x5d7b29[_0x4494('0x45')]=_[_0x4494('0x46')](_0xb42eac[_0x4494('0x45')]);_0x5d7b29[_0x4494('0x51')]=_[_0x4494('0x49')](_0x5d7b29[_0x4494('0x47')],_0x5d7b29[_0x4494('0x45')]);_0x397f9d['attributes']=_[_0x4494('0x49')](_0x5d7b29[_0x4494('0x47')],qs['fields'](_0xb42eac[_0x4494('0x45')]['fields']));_0x397f9d[_0x4494('0x48')]=_0x397f9d['attributes'][_0x4494('0x4b')]?_0x397f9d[_0x4494('0x48')]:_0x5d7b29[_0x4494('0x47')];_0x397f9d[_0x4494('0x4e')]=qs[_0x4494('0x4f')](_0xb42eac[_0x4494('0x45')][_0x4494('0x4f')]);_0x397f9d['where']=qs[_0x4494('0x51')](_[_0x4494('0x52')](_0xb42eac['query'],_0x5d7b29[_0x4494('0x51')]));if(_0xb42eac['query']['filter']){_0x397f9d[_0x4494('0x50')]=_[_0x4494('0x53')](_0x397f9d[_0x4494('0x50')],{'$or':_['map'](_0x397f9d[_0x4494('0x48')],function(_0x19317f){var _0x245efd={};_0x245efd[_0x19317f]={'$like':'%'+_0xb42eac[_0x4494('0x45')][_0x4494('0x55')]+'%'};return _0x245efd;})});}_0x397f9d=_[_0x4494('0x53')]({},_0x397f9d,_0xb42eac[_0x4494('0x56')]);return _0x27f31f[_0x4494('0xb6')](_0x397f9d);}})[_0x4494('0x37')](function(_0x4065e9){if(_0x4065e9){_0x70ee0a=_0x4065e9[_0x4494('0x4b')];if(!_0xb42eac[_0x4494('0x45')][_0x4494('0x4c')](_0x4494('0x4d'))){_0x397f9d[_0x4494('0x2f')]=qs['limit'](_0xb42eac['query'][_0x4494('0x2f')]);_0x397f9d['offset']=qs[_0x4494('0x31')](_0xb42eac[_0x4494('0x45')][_0x4494('0x31')]);}return _0x27f31f[_0x4494('0xb6')](_0x397f9d);}})['then'](function(_0x285fdd){if(_0x285fdd){return _0x285fdd?{'count':_0x70ee0a,'rows':_0x285fdd}:null;}})[_0x4494('0x37')](respondWithResult(_0x924bfb,null))[_0x4494('0x63')](handleError(_0x924bfb,null));};exports['send']=function(_0x14367f,_0x3cc03b,_0x5828c9){var _0x12ae67,_0x532b56,_0x183728;if(_['isNil'](_0x14367f[_0x4494('0x5c')][_0x4494('0x5c')])||_0x14367f[_0x4494('0x5c')][_0x4494('0x5c')]===''){throw new db[(_0x4494('0x75'))][(_0x4494('0x7c'))](_0x4494('0x7e'));}if(_[_0x4494('0x7a')](_0x14367f['body']['to'])){}_0x12ae67=_0x14367f['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x14367f[_0x4494('0x59')]['id']}})[_0x4494('0x37')](handleEntityNotFound(_0x3cc03b,null))['then'](function(_0x1aa1b3){if(_0x1aa1b3){return db[_0x4494('0x42')][_0x4494('0x5a')]({'where':{'id':_0x1aa1b3['id']},'include':[{'model':db[_0x4494('0xb7')],'as':_0x4494('0x83'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x1aa1b3[_0x4494('0x7f')]]:_0x12ae67},'limit':0x1,'order':[[_0x4494('0x78'),_0x4494('0x85')]]}]}]})[_0x4494('0x37')](handleEntityNotFound(_0x3cc03b,null))[_0x4494('0x37')](function(_0x4e2e66){if(_0x4e2e66&&_0x4e2e66[_0x4494('0x83')]){_0x532b56=_0x4e2e66[_0x4494('0x39')]({'plain':!![]});if(_0x532b56['List']&&_0x532b56[_0x4494('0x83')]['Contacts'][_0x4494('0x4b')]){return _0x532b56[_0x4494('0x83')]['Contacts'][0x0];}return db[_0x4494('0x74')][_0x4494('0x5b')](_[_0x4494('0x1a')](_0x14367f[_0x4494('0x5c')],{'firstName':_0x12ae67,[_0x4e2e66[_0x4494('0x7f')]]:_0x12ae67,'phone':_0x12ae67,'ListId':_0x532b56['ListId']}));}})[_0x4494('0x37')](handleEntityNotFound(_0x3cc03b,null))[_0x4494('0x37')](function(_0x1342b4){if(_0x1342b4){_0x183728=_0x1342b4;return db[_0x4494('0x90')][_0x4494('0x5a')]({'where':{'ContactId':_0x183728['id'],'closed':![],'OpenchannelAccountId':_0x532b56['id']}})[_0x4494('0x37')](function(_0x180733){if(_0x180733){return[_0x180733,![]];}return db[_0x4494('0x90')][_0x4494('0x5b')]({'UserId':_0x14367f[_0x4494('0x5d')]['id'],'ContactId':_0x183728['id'],'OpenchannelAccountId':_0x532b56['id'],'lastMsgDirection':_0x4494('0xb8'),'firstMsgDirection':_0x4494('0xb8'),'Messages':[_[_0x4494('0x53')](_0x14367f[_0x4494('0x5c')],{'read':![],'body':_0x14367f['body'][_0x4494('0x5c')],'OpenchannelAccountId':_0x532b56['id'],'UserId':_0x14367f[_0x4494('0x5d')]['id'],'ContactId':_0x183728['id']})]},{'include':[{'model':db[_0x4494('0x9c')],'as':'Messages'}]})[_0x4494('0x37')](function(_0x4ff485){return[_0x4ff485,!![]];});});}})['spread'](function(_0x5a50ff,_0x846a46){if(_0x846a46){return _0x5a50ff;}return db[_0x4494('0x9c')][_0x4494('0x5b')](_[_0x4494('0x53')](_0x14367f['body'],{'read':![],'body':_0x14367f[_0x4494('0x5c')]['body'],'OpenchannelAccountId':_0x532b56['id'],'OpenchannelInteractionId':_0x5a50ff['id'],'UserId':_0x14367f[_0x4494('0x5d')]['id'],'ContactId':_0x183728['id']}))['then'](function(_0x256a94){_0x5a50ff[_0x4494('0xb9')]['Messages']=[];_0x5a50ff[_0x4494('0xb9')][_0x4494('0xba')][_0x4494('0x98')](_0x256a94[_0x4494('0xb9')]);return _0x5a50ff;});});}})[_0x4494('0x37')](respondWithResult(_0x3cc03b,null))[_0x4494('0x63')](handleError(_0x3cc03b,null));}; \ No newline at end of file +var _0x1d25=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','count','limit','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','pick','where','VIRTUAL','filter','OpenchannelAccount','includeAll','include','findAll','rows','params','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','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','ValidationError','createdAt','updatedAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','account','Applications','list','orderBy','applications','asc','Contacts','from','contact','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','firstName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','options','Contact','Owner','internal','Tag','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x379893,_0x1c7161){var _0x39cd43=function(_0x48af76){while(--_0x48af76){_0x379893['push'](_0x379893['shift']());}};_0x39cd43(++_0x1c7161);}(_0x1d25,0xba));var _0x51d2=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x1d25[_0x2b91c5];return _0xbd5531;};'use strict';var emlformat=require(_0x51d2('0x0'));var rimraf=require(_0x51d2('0x1'));var zipdir=require(_0x51d2('0x2'));var jsonpatch=require(_0x51d2('0x3'));var rp=require(_0x51d2('0x4'));var moment=require('moment');var BPromise=require(_0x51d2('0x5'));var Mustache=require(_0x51d2('0x6'));var util=require('util');var path=require(_0x51d2('0x7'));var sox=require(_0x51d2('0x8'));var csv=require(_0x51d2('0x9'));var ejs=require(_0x51d2('0xa'));var fs=require('fs');var fs_extra=require(_0x51d2('0xb'));var _=require(_0x51d2('0xc'));var squel=require('squel');var crypto=require(_0x51d2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x51d2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51d2('0xf'));var Redis=require(_0x51d2('0x10'));var authService=require(_0x51d2('0x11'));var qs=require(_0x51d2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51d2('0x13'));var logger=require(_0x51d2('0x14'))(_0x51d2('0x15'));var utils=require(_0x51d2('0x16'));var config=require(_0x51d2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x51d2('0x18'))['db'];config[_0x51d2('0x19')]=_['defaults'](config['redis'],{'host':_0x51d2('0x1a'),'port':0x18eb});var socket=require(_0x51d2('0x1b'))(new Redis(config[_0x51d2('0x19')]));require(_0x51d2('0x1c'))[_0x51d2('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x51d2('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x51d2('0x1e')][_0x51d2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3a607f,_0x4974e2,_0x18b730,_0xc4a3dd){return new BPromise(function(_0x14a682,_0x2ba158){var _0x31772c=_0xc4a3dd||client;return _0x31772c[_0x51d2('0x20')](_0x3a607f,_0x18b730)[_0x51d2('0x21')](function(_0x2349df){logger['info'](_0x51d2('0x22'),_0x4974e2,_0x51d2('0x23'));logger[_0x51d2('0x24')](_0x51d2('0x25'),_0x4974e2,_0x51d2('0x23'),JSON[_0x51d2('0x26')](_0x2349df));if(_0x2349df[_0x51d2('0x27')]){if(_0x2349df[_0x51d2('0x27')][_0x51d2('0x28')]===0x1f4){logger['error'](_0x51d2('0x22'),_0x4974e2,_0x2349df['error'][_0x51d2('0x29')]);return _0x2ba158(_0x2349df[_0x51d2('0x27')][_0x51d2('0x29')]);}logger[_0x51d2('0x27')](_0x51d2('0x22'),_0x4974e2,_0x2349df[_0x51d2('0x27')][_0x51d2('0x29')]);return _0x14a682(_0x2349df[_0x51d2('0x27')]['message']);}else{logger[_0x51d2('0x2a')](_0x51d2('0x22'),_0x4974e2,_0x51d2('0x23'));_0x14a682(_0x2349df['result'][_0x51d2('0x29')]);}})[_0x51d2('0x2b')](function(_0x2ef6bd){logger[_0x51d2('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x4974e2,_0x2ef6bd);_0x2ba158(_0x2ef6bd);});});}function respondWithStatusCode(_0x33508d,_0x4ada82){_0x4ada82=_0x4ada82||0xcc;return function(_0x42889a){if(_0x42889a){return _0x33508d[_0x51d2('0x2c')](_0x4ada82);}return _0x33508d[_0x51d2('0x2d')](_0x4ada82)[_0x51d2('0x2e')]();};}function respondWithResult(_0x16bc70,_0x423039){_0x423039=_0x423039||0xc8;return function(_0x280476){if(_0x280476){return _0x16bc70[_0x51d2('0x2d')](_0x423039)[_0x51d2('0x2f')](_0x280476);}};}function respondWithFilteredResult(_0x73a2f0,_0x49652b){return function(_0x5ceb5c){if(_0x5ceb5c){var _0x4203ca=typeof _0x49652b[_0x51d2('0x30')]==='undefined'&&typeof _0x49652b['limit']===_0x51d2('0x31');var _0x8b2793=_0x5ceb5c[_0x51d2('0x32')];var _0x2255c5=_0x4203ca?0x0:_0x49652b[_0x51d2('0x30')];var _0x4df7ce=_0x4203ca?_0x5ceb5c['count']:_0x49652b[_0x51d2('0x30')]+_0x49652b[_0x51d2('0x33')];var _0x446839;if(_0x4df7ce>=_0x8b2793){_0x4df7ce=_0x8b2793;_0x446839=0xc8;}else{_0x446839=0xce;}_0x73a2f0[_0x51d2('0x2d')](_0x446839);return _0x73a2f0['set']('Content-Range',_0x2255c5+'-'+_0x4df7ce+'/'+_0x8b2793)[_0x51d2('0x2f')](_0x5ceb5c);}return null;};}function patchUpdates(_0x380648){return function(_0x3190e5){try{jsonpatch[_0x51d2('0x34')](_0x3190e5,_0x380648,!![]);}catch(_0x2f677a){return BPromise['reject'](_0x2f677a);}return _0x3190e5[_0x51d2('0x35')]();};}function saveUpdates(_0x5a5092,_0x59d1ce){return function(_0x3fc951){if(_0x3fc951){return _0x3fc951[_0x51d2('0x36')](_0x5a5092)['then'](function(_0x4ad302){return _0x4ad302;});}return null;};}function removeEntity(_0x298015,_0x607ffe){return function(_0x4a4073){if(_0x4a4073){return _0x4a4073[_0x51d2('0x37')]()[_0x51d2('0x21')](function(){var _0x231c5f=_0x4a4073[_0x51d2('0x38')]({'plain':!![]});var _0x12fb40=_0x51d2('0x39');return db[_0x51d2('0x3a')][_0x51d2('0x37')]({'where':{'type':_0x12fb40,'resourceId':_0x231c5f['id']}})[_0x51d2('0x21')](function(){return _0x4a4073;});})[_0x51d2('0x21')](function(){_0x298015[_0x51d2('0x2d')](0xcc)[_0x51d2('0x2e')]();});}};}function handleEntityNotFound(_0x4667b0,_0x4eaac6){return function(_0x52acbd){if(!_0x52acbd){_0x4667b0[_0x51d2('0x2c')](0x194);}return _0x52acbd;};}function handleError(_0x2e058d,_0x4d157d){_0x4d157d=_0x4d157d||0x1f4;return function(_0x403e4d){logger['error'](_0x403e4d['stack']);if(_0x403e4d[_0x51d2('0x3b')]){delete _0x403e4d['name'];}_0x2e058d['status'](_0x4d157d)[_0x51d2('0x3c')](_0x403e4d);};}exports['index']=function(_0x52638d,_0x5a9239){var _0x57fb65={'include':[{'model':db[_0x51d2('0x3d')],'as':_0x51d2('0x3e')}]},_0x4dc493={},_0xe681cb={'count':0x0,'rows':[]};var _0x4f511b=_[_0x51d2('0x3f')](db['OpenchannelAccount'][_0x51d2('0x40')],function(_0x499d96){return{'name':_0x499d96['fieldName'],'type':_0x499d96[_0x51d2('0x41')][_0x51d2('0x42')]};});_0x4dc493['model']=_[_0x51d2('0x3f')](_0x4f511b,_0x51d2('0x3b'));_0x4dc493[_0x51d2('0x43')]=_[_0x51d2('0x44')](_0x52638d[_0x51d2('0x43')]);_0x4dc493[_0x51d2('0x45')]=_[_0x51d2('0x46')](_0x4dc493[_0x51d2('0x47')],_0x4dc493[_0x51d2('0x43')]);_0x57fb65[_0x51d2('0x48')]=_[_0x51d2('0x46')](_0x4dc493['model'],qs[_0x51d2('0x49')](_0x52638d[_0x51d2('0x43')][_0x51d2('0x49')]));_0x57fb65['attributes']=_0x57fb65[_0x51d2('0x48')][_0x51d2('0x4a')]?_0x57fb65[_0x51d2('0x48')]:_0x4dc493['model'];if(!_0x52638d[_0x51d2('0x43')]['hasOwnProperty']('nolimit')){_0x57fb65[_0x51d2('0x33')]=qs['limit'](_0x52638d[_0x51d2('0x43')][_0x51d2('0x33')]);_0x57fb65['offset']=qs[_0x51d2('0x30')](_0x52638d[_0x51d2('0x43')]['offset']);}_0x57fb65[_0x51d2('0x4b')]=qs[_0x51d2('0x4c')](_0x52638d[_0x51d2('0x43')][_0x51d2('0x4c')]);_0x57fb65['where']=qs[_0x51d2('0x45')](_[_0x51d2('0x4d')](_0x52638d[_0x51d2('0x43')],_0x4dc493['filters']),_0x4f511b);if(_0x52638d[_0x51d2('0x43')]['filter']){_0x57fb65[_0x51d2('0x4e')]=_['merge'](_0x57fb65[_0x51d2('0x4e')],{'$or':_[_0x51d2('0x3f')](_0x4f511b,function(_0x1910b0){if(_0x1910b0[_0x51d2('0x41')]!==_0x51d2('0x4f')){var _0x5d9ddd={};_0x5d9ddd[_0x1910b0[_0x51d2('0x3b')]]={'$like':'%'+_0x52638d[_0x51d2('0x43')][_0x51d2('0x50')]+'%'};return _0x5d9ddd;}})});}_0x57fb65=_['merge']({},_0x57fb65,_0x52638d['options']);var _0x74c2db={'where':_0x57fb65['where']};return db[_0x51d2('0x51')][_0x51d2('0x32')](_0x74c2db)[_0x51d2('0x21')](function(_0x461fb2){_0xe681cb[_0x51d2('0x32')]=_0x461fb2;if(_0x52638d[_0x51d2('0x43')][_0x51d2('0x52')]){_0x57fb65[_0x51d2('0x53')]=[{'all':!![]}];}return db[_0x51d2('0x51')][_0x51d2('0x54')](_0x57fb65);})[_0x51d2('0x21')](function(_0x471623){_0xe681cb[_0x51d2('0x55')]=_0x471623;return _0xe681cb;})[_0x51d2('0x21')](respondWithFilteredResult(_0x5a9239,_0x57fb65))[_0x51d2('0x2b')](handleError(_0x5a9239,null));};exports['show']=function(_0x3cf59c,_0x577e4d){var _0x431745={'raw':![],'where':{'id':_0x3cf59c[_0x51d2('0x56')]['id']},'include':[{'model':db[_0x51d2('0x3d')],'as':_0x51d2('0x3e')}]},_0x35fdf0={};_0x35fdf0['model']=_[_0x51d2('0x44')](db[_0x51d2('0x51')][_0x51d2('0x40')]);_0x35fdf0[_0x51d2('0x43')]=_[_0x51d2('0x44')](_0x3cf59c[_0x51d2('0x43')]);_0x35fdf0[_0x51d2('0x45')]=_['intersection'](_0x35fdf0[_0x51d2('0x47')],_0x35fdf0[_0x51d2('0x43')]);_0x431745['attributes']=_[_0x51d2('0x46')](_0x35fdf0[_0x51d2('0x47')],qs[_0x51d2('0x49')](_0x3cf59c[_0x51d2('0x43')][_0x51d2('0x49')]));_0x431745[_0x51d2('0x48')]=_0x431745[_0x51d2('0x48')][_0x51d2('0x4a')]?_0x431745[_0x51d2('0x48')]:_0x35fdf0['model'];if(_0x3cf59c[_0x51d2('0x43')][_0x51d2('0x52')]){_0x431745[_0x51d2('0x53')]=[{'all':!![]}];}_0x431745=_[_0x51d2('0x57')]({},_0x431745,_0x3cf59c['options']);return db['OpenchannelAccount'][_0x51d2('0x58')](_0x431745)[_0x51d2('0x21')](handleEntityNotFound(_0x577e4d,null))['then'](respondWithResult(_0x577e4d,null))['catch'](handleError(_0x577e4d,null));};exports[_0x51d2('0x59')]=function(_0x32b845,_0x470b24){return db[_0x51d2('0x51')][_0x51d2('0x59')](_0x32b845['body'],{})[_0x51d2('0x21')](function(_0xf69dde){var _0x30288d=_0x32b845[_0x51d2('0x5a')]['get']({'plain':!![]});if(!_0x30288d)throw new Error(_0x51d2('0x5b'));if(_0x30288d[_0x51d2('0x5c')]===_0x51d2('0x5a')){var _0x3d7573=_0xf69dde[_0x51d2('0x38')]({'plain':!![]});var _0x1bfe3c=_0x51d2('0x39');return db[_0x51d2('0x5d')][_0x51d2('0x58')]({'where':{'name':_0x1bfe3c,'userProfileId':_0x30288d[_0x51d2('0x5e')]},'raw':!![]})[_0x51d2('0x21')](function(_0x157fbc){if(_0x157fbc&&_0x157fbc[_0x51d2('0x5f')]===0x0){return db[_0x51d2('0x3a')]['create']({'name':_0x3d7573['name'],'resourceId':_0x3d7573['id'],'type':_0x157fbc[_0x51d2('0x3b')],'sectionId':_0x157fbc['id']},{})[_0x51d2('0x21')](function(){return _0xf69dde;});}else{return _0xf69dde;}})[_0x51d2('0x2b')](function(_0x50aa3c){logger[_0x51d2('0x27')](_0x51d2('0x60'),_0x50aa3c);throw _0x50aa3c;});}return _0xf69dde;})['then'](respondWithResult(_0x470b24,0xc9))[_0x51d2('0x2b')](handleError(_0x470b24,null));};exports['update']=function(_0x5bc7c3,_0x2e8521){if(_0x5bc7c3[_0x51d2('0x61')]['id']){delete _0x5bc7c3[_0x51d2('0x61')]['id'];}return db[_0x51d2('0x51')]['find']({'where':{'id':_0x5bc7c3[_0x51d2('0x56')]['id']},'include':[{'model':db[_0x51d2('0x3d')],'as':_0x51d2('0x3e')}]})['then'](handleEntityNotFound(_0x2e8521,null))[_0x51d2('0x21')](saveUpdates(_0x5bc7c3[_0x51d2('0x61')],null))[_0x51d2('0x21')](respondWithResult(_0x2e8521,null))[_0x51d2('0x2b')](handleError(_0x2e8521,null));};exports[_0x51d2('0x37')]=function(_0x9c78ea,_0x4920d2){return db[_0x51d2('0x51')][_0x51d2('0x58')]({'where':{'id':_0x9c78ea[_0x51d2('0x56')]['id']}})['then'](handleEntityNotFound(_0x4920d2,null))[_0x51d2('0x21')](removeEntity(_0x4920d2,null))[_0x51d2('0x2b')](handleError(_0x4920d2,null));};exports[_0x51d2('0x62')]=function(_0x403217,_0x27be95){return db[_0x51d2('0x51')][_0x51d2('0x62')]()[_0x51d2('0x21')](respondWithResult(_0x27be95,null))[_0x51d2('0x2b')](handleError(_0x27be95,null));};exports[_0x51d2('0x63')]=function(_0x3c31a0,_0x5857ab,_0x3ac743){if(_0x3c31a0['body']['id']){delete _0x3c31a0[_0x51d2('0x61')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x3c31a0[_0x51d2('0x56')]['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x5857ab,null))['then'](function(_0x40383a){if(_0x40383a){_0x3c31a0[_0x51d2('0x61')][_0x51d2('0x64')]=_0x40383a['id'];return db[_0x51d2('0x65')][_0x51d2('0x59')](_0x3c31a0[_0x51d2('0x61')]);}})[_0x51d2('0x21')](respondWithResult(_0x5857ab,null))[_0x51d2('0x2b')](handleError(_0x5857ab,null));};exports['getDispositions']=function(_0x2ccead,_0x4e55c1,_0x3a7aab){var _0x21b2c7={'raw':![],'where':{}};var _0x17e05f={};var _0x3aff73={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x51d2('0x66')]({'where':{'id':_0x2ccead[_0x51d2('0x56')]['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x4e55c1,null))[_0x51d2('0x21')](function(_0x4a947b){if(_0x4a947b){_0x17e05f[_0x51d2('0x47')]=_[_0x51d2('0x44')](db[_0x51d2('0x65')]['rawAttributes']);_0x17e05f['query']=_['keys'](_0x2ccead[_0x51d2('0x43')]);_0x17e05f['filters']=_['intersection'](_0x17e05f[_0x51d2('0x47')],_0x17e05f[_0x51d2('0x43')]);_0x21b2c7[_0x51d2('0x48')]=_[_0x51d2('0x46')](_0x17e05f[_0x51d2('0x47')],qs[_0x51d2('0x49')](_0x2ccead[_0x51d2('0x43')][_0x51d2('0x49')]));_0x21b2c7[_0x51d2('0x48')]=_0x21b2c7[_0x51d2('0x48')]['length']?_0x21b2c7[_0x51d2('0x48')]:_0x17e05f['model'];if(!_0x2ccead[_0x51d2('0x43')][_0x51d2('0x67')](_0x51d2('0x68'))){_0x21b2c7['limit']=qs[_0x51d2('0x33')](_0x2ccead[_0x51d2('0x43')]['limit']);_0x21b2c7[_0x51d2('0x30')]=qs['offset'](_0x2ccead[_0x51d2('0x43')]['offset']);}_0x21b2c7[_0x51d2('0x4b')]=qs[_0x51d2('0x4c')](_0x2ccead[_0x51d2('0x43')][_0x51d2('0x4c')]);_0x21b2c7[_0x51d2('0x4e')]=qs[_0x51d2('0x45')](_['pick'](_0x2ccead['query'],_0x17e05f[_0x51d2('0x45')]));_0x21b2c7['where'][_0x51d2('0x64')]=_0x4a947b['id'];if(_0x2ccead['query'][_0x51d2('0x50')]){_0x21b2c7['where']=_['merge'](_0x21b2c7['where'],{'$or':_[_0x51d2('0x3f')](_0x21b2c7['attributes'],function(_0x1d5aab){var _0x3bac83={};_0x3bac83[_0x1d5aab]={'$like':'%'+_0x2ccead['query'][_0x51d2('0x50')]+'%'};return _0x3bac83;})});}_0x21b2c7=_[_0x51d2('0x57')]({},_0x21b2c7,_0x2ccead['options']);return db[_0x51d2('0x65')][_0x51d2('0x32')]({'where':_0x21b2c7[_0x51d2('0x4e')]})[_0x51d2('0x21')](function(_0x37c8e8){_0x3aff73[_0x51d2('0x32')]=_0x37c8e8;if(_0x2ccead['query'][_0x51d2('0x52')]){_0x21b2c7[_0x51d2('0x53')]=[{'all':!![]}];}return db[_0x51d2('0x65')][_0x51d2('0x54')](_0x21b2c7);})['then'](function(_0x5b1508){_0x3aff73['rows']=_0x5b1508;return _0x3aff73;});}})['then'](respondWithFilteredResult(_0x4e55c1,_0x21b2c7))['catch'](handleError(_0x4e55c1,null));};exports[_0x51d2('0x69')]=function(_0xdbf509,_0x1e7ff9,_0x16035b){return db['OpenchannelAccount'][_0x51d2('0x58')]({'where':{'id':_0xdbf509[_0x51d2('0x56')]['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x1e7ff9,null))['then'](function(_0x3325fd){if(_0x3325fd){return _0x3325fd['removeDispositions'](_0xdbf509['query']['ids']);}})[_0x51d2('0x21')](respondWithStatusCode(_0x1e7ff9,null))['catch'](handleError(_0x1e7ff9,null));};exports[_0x51d2('0x6a')]=function(_0x377ca4,_0x319cd1,_0x31a266){if(_0x377ca4[_0x51d2('0x61')]['id']){delete _0x377ca4['body']['id'];}return db[_0x51d2('0x51')][_0x51d2('0x58')]({'where':{'id':_0x377ca4[_0x51d2('0x56')]['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x319cd1,null))[_0x51d2('0x21')](function(_0x398a2c){if(_0x398a2c){_0x377ca4['body'][_0x51d2('0x64')]=_0x398a2c['id'];return db[_0x51d2('0x6b')][_0x51d2('0x59')](_0x377ca4['body']);}})[_0x51d2('0x21')](respondWithResult(_0x319cd1,null))['catch'](handleError(_0x319cd1,null));};exports[_0x51d2('0x6c')]=function(_0x1b10f2,_0x22c002,_0x2a5b1a){var _0x4ed60a={'raw':![],'where':{}};var _0x1182fe={};var _0x2547c8={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x51d2('0x66')]({'where':{'id':_0x1b10f2[_0x51d2('0x56')]['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x22c002,null))[_0x51d2('0x21')](function(_0x3e8e23){if(_0x3e8e23){_0x1182fe['model']=_[_0x51d2('0x44')](db['CannedAnswer'][_0x51d2('0x40')]);_0x1182fe[_0x51d2('0x43')]=_[_0x51d2('0x44')](_0x1b10f2[_0x51d2('0x43')]);_0x1182fe[_0x51d2('0x45')]=_[_0x51d2('0x46')](_0x1182fe[_0x51d2('0x47')],_0x1182fe[_0x51d2('0x43')]);_0x4ed60a[_0x51d2('0x48')]=_[_0x51d2('0x46')](_0x1182fe[_0x51d2('0x47')],qs[_0x51d2('0x49')](_0x1b10f2[_0x51d2('0x43')][_0x51d2('0x49')]));_0x4ed60a[_0x51d2('0x48')]=_0x4ed60a['attributes'][_0x51d2('0x4a')]?_0x4ed60a['attributes']:_0x1182fe[_0x51d2('0x47')];if(!_0x1b10f2['query'][_0x51d2('0x67')](_0x51d2('0x68'))){_0x4ed60a[_0x51d2('0x33')]=qs['limit'](_0x1b10f2[_0x51d2('0x43')][_0x51d2('0x33')]);_0x4ed60a[_0x51d2('0x30')]=qs[_0x51d2('0x30')](_0x1b10f2[_0x51d2('0x43')][_0x51d2('0x30')]);}_0x4ed60a[_0x51d2('0x4b')]=qs[_0x51d2('0x4c')](_0x1b10f2[_0x51d2('0x43')][_0x51d2('0x4c')]);_0x4ed60a[_0x51d2('0x4e')]=qs[_0x51d2('0x45')](_['pick'](_0x1b10f2[_0x51d2('0x43')],_0x1182fe['filters']));_0x4ed60a[_0x51d2('0x4e')][_0x51d2('0x64')]=_0x3e8e23['id'];if(_0x1b10f2['query'][_0x51d2('0x50')]){_0x4ed60a[_0x51d2('0x4e')]=_['merge'](_0x4ed60a['where'],{'$or':_['map'](_0x4ed60a[_0x51d2('0x48')],function(_0xd400b1){var _0x494f5e={};_0x494f5e[_0xd400b1]={'$like':'%'+_0x1b10f2[_0x51d2('0x43')][_0x51d2('0x50')]+'%'};return _0x494f5e;})});}_0x4ed60a=_['merge']({},_0x4ed60a,_0x1b10f2['options']);return db[_0x51d2('0x6b')][_0x51d2('0x32')]({'where':_0x4ed60a['where']})['then'](function(_0x31fcfc){_0x2547c8['count']=_0x31fcfc;if(_0x1b10f2[_0x51d2('0x43')][_0x51d2('0x52')]){_0x4ed60a[_0x51d2('0x53')]=[{'all':!![]}];}return db[_0x51d2('0x6b')]['findAll'](_0x4ed60a);})[_0x51d2('0x21')](function(_0x2a2edb){_0x2547c8[_0x51d2('0x55')]=_0x2a2edb;return _0x2547c8;});}})[_0x51d2('0x21')](respondWithFilteredResult(_0x22c002,_0x4ed60a))[_0x51d2('0x2b')](handleError(_0x22c002,null));};exports[_0x51d2('0x6d')]=function(_0x16d739,_0x2282bd,_0x3e05f5){return db[_0x51d2('0x51')][_0x51d2('0x58')]({'where':{'id':_0x16d739['params']['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x2282bd,null))['then'](function(_0x558799){if(_0x558799){return _0x558799['removeAnswers'](_0x16d739[_0x51d2('0x43')][_0x51d2('0x6e')]);}})[_0x51d2('0x21')](respondWithStatusCode(_0x2282bd,null))['catch'](handleError(_0x2282bd,null));};exports[_0x51d2('0x6f')]=function(_0x29768b,_0x594404,_0x4afbd1){var _0x4eb47b={'body':_0x29768b[_0x51d2('0x61')],'channel':_0x51d2('0x70')};var _0x1a5e57=[];var _0x1d1085=[];var _0xc764ad={};var _0x18bba4=![];return db[_0x51d2('0x71')][_0x51d2('0x62')]()[_0x51d2('0x21')](function(_0x5528d3){if(!_0x5528d3){throw new db['Sequelize'][(_0x51d2('0x72'))]('no\x20available\x20attributes');}_0x1a5e57=_['difference'](_[_0x51d2('0x44')](_0x5528d3),[_0x51d2('0x73'),'updatedAt']);_0x1d1085=_['difference'](_['keys'](_0x5528d3),[_0x51d2('0x73'),_0x51d2('0x74'),_0x51d2('0x75'),_0x51d2('0x76')]);if(_0x29768b[_0x51d2('0x61')]['id']){delete _0x29768b[_0x51d2('0x61')]['id'];}if(_[_0x51d2('0x77')](_0x29768b[_0x51d2('0x61')]['from'])){throw new db[(_0x51d2('0x78'))][(_0x51d2('0x72'))](_0x51d2('0x79'));}if(_['isNil'](_0x29768b[_0x51d2('0x61')][_0x51d2('0x61')])||_0x29768b[_0x51d2('0x61')][_0x51d2('0x61')]===''){throw new db[(_0x51d2('0x78'))]['ValidationError'](_0x51d2('0x7a'));}if(_['isNil'](_0x29768b[_0x51d2('0x61')][_0x51d2('0x7b')])){throw new db[(_0x51d2('0x78'))][(_0x51d2('0x72'))](_0x51d2('0x7c')+_0x1d1085);}if(!_[_0x51d2('0x7d')](_0x1d1085,_0x29768b[_0x51d2('0x61')]['mapKey'])){throw new db[(_0x51d2('0x78'))]['ValidationError'](_0x51d2('0x7e')+_0x1d1085);}_0xc764ad[_0x29768b[_0x51d2('0x61')][_0x51d2('0x7b')]]=_0x29768b['body']['from'];})[_0x51d2('0x21')](function(){return db[_0x51d2('0x51')][_0x51d2('0x58')]({'where':{'id':_0x29768b[_0x51d2('0x56')]['id']},'include':[{'model':db[_0x51d2('0x7f')],'as':_0x51d2('0x80'),'include':[{'model':db[_0x51d2('0x71')],'as':'Contacts','where':_0xc764ad,'limit':0x1,'order':[[_0x51d2('0x74'),_0x51d2('0x81')]]}]},{'model':db[_0x51d2('0x82')],'as':'Applications'}]});})[_0x51d2('0x21')](handleEntityNotFound(_0x594404,null))[_0x51d2('0x21')](function(_0xfe23e7){if(_0xfe23e7&&_0xfe23e7['List']){_0x4eb47b[_0x51d2('0x83')]=_0xfe23e7;_0x4eb47b['applications']=_0xfe23e7[_0x51d2('0x84')];_0x4eb47b[_0x51d2('0x85')]=_0xfe23e7[_0x51d2('0x80')];_0x4eb47b['applications']=_[_0x51d2('0x86')](_0x4eb47b[_0x51d2('0x87')],['priority'],[_0x51d2('0x88')]);if(_0x4eb47b['account'][_0x51d2('0x84')]){delete _0x4eb47b[_0x51d2('0x83')]['Applications'];}if(_0x4eb47b[_0x51d2('0x83')][_0x51d2('0x80')]&&_0x4eb47b[_0x51d2('0x83')][_0x51d2('0x80')][_0x51d2('0x89')]['length']){return _0x4eb47b[_0x51d2('0x83')][_0x51d2('0x80')]['Contacts'][0x0];}var _0x3027fa=_['defaults'](_0x29768b[_0x51d2('0x61')],{'firstName':_0x29768b[_0x51d2('0x61')][_0x51d2('0x8a')],'ListId':_0xfe23e7['ListId']});_0x3027fa[_0x29768b[_0x51d2('0x61')][_0x51d2('0x7b')]]=_0x29768b[_0x51d2('0x61')]['from'];return db[_0x51d2('0x71')]['create'](_0x3027fa,{'fields':_0x1a5e57,'raw':!![]});}})[_0x51d2('0x21')](handleEntityNotFound(_0x594404,null))[_0x51d2('0x21')](function(_0x35c435){_0x4eb47b[_0x51d2('0x8b')]=_0x35c435;if(_0x35c435){var _0x473b2a={'ContactId':_0x35c435['id'],'OpenchannelAccountId':_0x29768b['params']['id'],'from':(_0x35c435['firstName']||'')+'\x20'+(_0x35c435[_0x51d2('0x8c')]||'')};var _0x388cc5={'OpenchannelAccountId':_0x29768b[_0x51d2('0x56')]['id'],'closed':![]};if(_0x29768b[_0x51d2('0x61')][_0x51d2('0x8d')]){_0x388cc5['threadId']=_0x29768b[_0x51d2('0x61')][_0x51d2('0x8d')];return db['OpenchannelInteraction'][_0x51d2('0x58')]({'where':_0x388cc5})[_0x51d2('0x21')](function(_0x103120){if(_0x103120){return[_0x103120,![]];}_0x473b2a['threadId']=_0x29768b[_0x51d2('0x61')][_0x51d2('0x8d')];_0x473b2a[_0x51d2('0x8e')]=_0x29768b[_0x51d2('0x61')][_0x51d2('0x8e')];return db['OpenchannelInteraction'][_0x51d2('0x59')](_0x473b2a)[_0x51d2('0x21')](function(_0x116c21){return[_0x116c21,!![]];});});}else{_0x388cc5['threadId']=null;}_0x388cc5[_0x51d2('0x8f')]=_0x35c435['id'];return db[_0x51d2('0x90')][_0x51d2('0x58')]({'where':_0x388cc5})[_0x51d2('0x21')](function(_0x5597d9){if(_0x5597d9){return[_0x5597d9,![]];}return db[_0x51d2('0x90')][_0x51d2('0x59')](_0x473b2a)['then'](function(_0x2febbe){return[_0x2febbe,!![]];});});}})['spread'](function(_0x4ffaf4,_0x287e9e){if(_0x4ffaf4){_0x18bba4=_0x287e9e;if(!_0x287e9e){var _0x2a12a7={'from':(_0x4eb47b[_0x51d2('0x8b')][_0x51d2('0x91')]||'')+'\x20'+(_0x4eb47b[_0x51d2('0x8b')][_0x51d2('0x8c')]||'')};if(_0x29768b['body']['threadId']&&_0x29768b[_0x51d2('0x61')][_0x51d2('0x92')]&&_0x29768b['body'][_0x51d2('0x8d')]!=_0x29768b['body'][_0x51d2('0x92')]){_0x2a12a7[_0x51d2('0x8d')]=_0x29768b[_0x51d2('0x61')][_0x51d2('0x92')];}return _0x4ffaf4[_0x51d2('0x36')](_0x2a12a7);}else{return _0x4ffaf4;}}})[_0x51d2('0x21')](function(_0x20dd12){_0x4eb47b[_0x51d2('0x93')]=_0x20dd12[_0x51d2('0x38')]({'plain':!![]});_0x4eb47b[_0x51d2('0x93')]['created']=_0x18bba4;if(_0x4eb47b[_0x51d2('0x93')][_0x51d2('0x94')]){if(_0x4eb47b[_0x51d2('0x83')][_0x51d2('0x95')]){_0x4eb47b[_0x51d2('0x87')][_0x51d2('0x96')]({'id':0x0,'priority':_0x4eb47b[_0x51d2('0x87')][_0x51d2('0x4a')]+0x1,'app':'close','appdata':_0x51d2('0x97'),'interval':_0x51d2('0x98')});}}return db['OpenchannelMessage'][_0x51d2('0x59')]({'body':_0x29768b[_0x51d2('0x61')][_0x51d2('0x61')],'OpenchannelAccountId':_0x29768b['params']['id'],'OpenchannelInteractionId':_0x20dd12['id'],'direction':'in','ContactId':_0x4eb47b['contact']['id'],'AttachmentId':_0x29768b['body'][_0x51d2('0x99')]});})['then'](function(_0x2b04e8){_0x4eb47b['message']=_0x2b04e8;if(_0x4eb47b[_0x51d2('0x93')][_0x51d2('0x9a')]){return db[_0x51d2('0x9b')][_0x51d2('0x58')]({'attributes':['id',_0x51d2('0x3b')],'where':{'id':_0x4eb47b['interaction']['UserId']}})['then'](function(_0xd434c3){if(_0xd434c3){_0x4eb47b[_0x51d2('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0x51d2('0x9c'),'appdata':_0xd434c3[_0x51d2('0x3b')]+','+(_0x4eb47b[_0x51d2('0x83')][_0x51d2('0x9d')]||0xa),'interval':_0x51d2('0x98')});_0x4eb47b[_0x51d2('0x9e')]=![];}return respondWithRpcPromise(_0x51d2('0x9f'),'startRouting',_0x4eb47b);});}return respondWithRpcPromise(_0x51d2('0x9f'),'startRouting',_0x4eb47b);})[_0x51d2('0x21')](function(_0xfd8f9d){respondWithRpcPromise('EventManager',_0x51d2('0xa0'),{'event':_0x51d2('0x6f'),'message':_0xfd8f9d},client9002);return _0xfd8f9d;})[_0x51d2('0x21')](respondWithResult(_0x594404,null))[_0x51d2('0x2b')](handleError(_0x594404,null));};exports[_0x51d2('0xa1')]=function(_0xe85bae,_0x2a8e6b){var _0x235b0c=_0xe85bae['params']['id'];var _0x544ae3=_0xe85bae[_0x51d2('0x61')];var _0x44086a=0xc8;var _0x3557f2=null;return db['sequelize'][_0x51d2('0xa2')]({'isolationLevel':db[_0x51d2('0xa3')][_0x51d2('0xa4')]['ISOLATION_LEVELS'][_0x51d2('0xa5')]},function(_0x1b1472){return db[_0x51d2('0x51')][_0x51d2('0x66')]({'where':{'id':_0x235b0c},'transaction':_0x1b1472})[_0x51d2('0x21')](function(_0x492a6c){if(_0x492a6c){return db[_0x51d2('0x82')][_0x51d2('0x37')]({'where':{'OpenchannelAccountId':_0x235b0c},'transaction':_0x1b1472})['then'](function(){var _0x407cb8=_['map'](_0x544ae3,function(_0x268726){_0x268726[_0x51d2('0x64')]=_0x235b0c;return _0x268726;});return db['OpenchannelApplication'][_0x51d2('0xa6')](_0x407cb8,{'transaction':_0x1b1472});});}else{_0x44086a=0x194;_0x3557f2=[];}});})[_0x51d2('0x21')](function(){if(_0x44086a!==0x194){return db[_0x51d2('0x82')][_0x51d2('0xa7')]({'where':{'OpenchannelAccountId':_0x235b0c},'order':_0x51d2('0xa8')})['then'](function(_0x59e903){_0x3557f2=_0x59e903;});}})[_0x51d2('0x2b')](function(_0x3dc9b7){_0x44086a=0x1f4;logger['error'](_0x3dc9b7[_0x51d2('0xa9')]);if(_0x3dc9b7[_0x51d2('0x3b')]){delete _0x3dc9b7['name'];}_0x3557f2=_0x3dc9b7;})[_0x51d2('0xaa')](function(){if(_0x3557f2===null){_0x2a8e6b[_0x51d2('0x2c')](_0x44086a);}else{if(_0x44086a===0x1f4){_0x2a8e6b[_0x51d2('0x2d')](_0x44086a)['send'](_0x3557f2);}else{_0x2a8e6b[_0x51d2('0x2d')](_0x44086a)[_0x51d2('0x2f')](_0x3557f2);}}});};exports[_0x51d2('0xab')]=function(_0x1dabfc,_0x9cb5fd,_0x1922d2){var _0x369768={};var _0xa773c3={};var _0xeed80b;var _0x2facad;return db[_0x51d2('0x51')]['findOne']({'where':{'id':_0x1dabfc[_0x51d2('0x56')]['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x9cb5fd,null))[_0x51d2('0x21')](function(_0x31d9f9){if(_0x31d9f9){_0xeed80b=_0x31d9f9;_0xa773c3['model']=_['keys'](db[_0x51d2('0x82')]['rawAttributes']);_0xa773c3[_0x51d2('0x43')]=_['keys'](_0x1dabfc[_0x51d2('0x43')]);_0xa773c3[_0x51d2('0x45')]=_[_0x51d2('0x46')](_0xa773c3[_0x51d2('0x47')],_0xa773c3[_0x51d2('0x43')]);_0x369768[_0x51d2('0x48')]=_[_0x51d2('0x46')](_0xa773c3['model'],qs[_0x51d2('0x49')](_0x1dabfc[_0x51d2('0x43')][_0x51d2('0x49')]));_0x369768[_0x51d2('0x48')]=_0x369768['attributes'][_0x51d2('0x4a')]?_0x369768[_0x51d2('0x48')]:_0xa773c3['model'];_0x369768[_0x51d2('0x4b')]=qs['sort'](_0x1dabfc[_0x51d2('0x43')][_0x51d2('0x4c')]);_0x369768[_0x51d2('0x4e')]=qs[_0x51d2('0x45')](_[_0x51d2('0x4d')](_0x1dabfc[_0x51d2('0x43')],_0xa773c3[_0x51d2('0x45')]));if(_0x1dabfc[_0x51d2('0x43')]['filter']){_0x369768['where']=_['merge'](_0x369768[_0x51d2('0x4e')],{'$or':_[_0x51d2('0x3f')](_0x369768[_0x51d2('0x48')],function(_0x1f9755){var _0x3a29b8={};_0x3a29b8[_0x1f9755]={'$like':'%'+_0x1dabfc[_0x51d2('0x43')][_0x51d2('0x50')]+'%'};return _0x3a29b8;})});}_0x369768=_['merge']({},_0x369768,_0x1dabfc['options']);return _0xeed80b[_0x51d2('0xab')](_0x369768);}})[_0x51d2('0x21')](function(_0x21b18c){if(_0x21b18c){_0x2facad=_0x21b18c['length'];if(!_0x1dabfc[_0x51d2('0x43')][_0x51d2('0x67')](_0x51d2('0x68'))){_0x369768['limit']=qs['limit'](_0x1dabfc[_0x51d2('0x43')][_0x51d2('0x33')]);_0x369768[_0x51d2('0x30')]=qs[_0x51d2('0x30')](_0x1dabfc['query'][_0x51d2('0x30')]);}return _0xeed80b[_0x51d2('0xab')](_0x369768);}})[_0x51d2('0x21')](function(_0x32c7de){if(_0x32c7de){return _0x32c7de?{'count':_0x2facad,'rows':_0x32c7de}:null;}})[_0x51d2('0x21')](respondWithResult(_0x9cb5fd,null))['catch'](handleError(_0x9cb5fd,null));};exports['getInteractions']=function(_0x10f83e,_0x1099e9,_0x5e7c6b){var _0x4cb46c={'raw':![],'where':{}};var _0x4b2e25={};var _0x74ac23={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x51d2('0x66')]({'where':{'id':_0x10f83e[_0x51d2('0x56')]['id']}})['then'](handleEntityNotFound(_0x1099e9,null))[_0x51d2('0x21')](function(_0x577f80){if(_0x577f80){_0x4b2e25[_0x51d2('0x47')]=_['keys'](db[_0x51d2('0x90')][_0x51d2('0x40')]);_0x4b2e25[_0x51d2('0x43')]=_[_0x51d2('0x44')](_0x10f83e['query']);_0x4b2e25[_0x51d2('0x45')]=_[_0x51d2('0x46')](_0x4b2e25[_0x51d2('0x47')],_0x4b2e25[_0x51d2('0x43')]);_0x4cb46c[_0x51d2('0x48')]=_[_0x51d2('0x46')](_0x4b2e25['model'],qs['fields'](_0x10f83e[_0x51d2('0x43')][_0x51d2('0x49')]));_0x4cb46c[_0x51d2('0x48')]=_0x4cb46c['attributes'][_0x51d2('0x4a')]?_0x4cb46c[_0x51d2('0x48')]:_0x4b2e25[_0x51d2('0x47')];if(!_0x10f83e[_0x51d2('0x43')]['hasOwnProperty'](_0x51d2('0x68'))){_0x4cb46c[_0x51d2('0x33')]=qs['limit'](_0x10f83e['query'][_0x51d2('0x33')]);_0x4cb46c[_0x51d2('0x30')]=qs[_0x51d2('0x30')](_0x10f83e[_0x51d2('0x43')][_0x51d2('0x30')]);}_0x4cb46c[_0x51d2('0x4b')]=qs[_0x51d2('0x4c')](_0x10f83e[_0x51d2('0x43')]['sort']);_0x4cb46c['where']=qs[_0x51d2('0x45')](_['pick'](_0x10f83e[_0x51d2('0x43')],_0x4b2e25['filters']));_0x4cb46c[_0x51d2('0x4e')][_0x51d2('0x64')]=_0x577f80['id'];if(_0x10f83e[_0x51d2('0x43')][_0x51d2('0x50')]){_0x4cb46c['where']=_[_0x51d2('0x57')](_0x4cb46c[_0x51d2('0x4e')],{'$or':_[_0x51d2('0x3f')](_0x4cb46c[_0x51d2('0x48')],function(_0x291634){var _0x46af22={};_0x46af22[_0x291634]={'$like':'%'+_0x10f83e['query'][_0x51d2('0x50')]+'%'};return _0x46af22;})});}_0x4cb46c=_[_0x51d2('0x57')]({},_0x4cb46c,_0x10f83e[_0x51d2('0xac')]);return db['OpenchannelInteraction']['count']({'where':_0x4cb46c[_0x51d2('0x4e')]})[_0x51d2('0x21')](function(_0x15f58e){_0x74ac23[_0x51d2('0x32')]=_0x15f58e;if(_0x10f83e[_0x51d2('0x43')][_0x51d2('0x52')]){_0x4cb46c['include']=[{'model':db[_0x51d2('0x71')],'as':_0x51d2('0xad'),'required':![]},{'model':db[_0x51d2('0x9b')],'as':_0x51d2('0xae'),'attributes':[_0x51d2('0x3b'),'fullname',_0x51d2('0xaf')],'required':![]},{'model':db[_0x51d2('0xb0')],'as':'Tags','attributes':['id','name','color'],'where':_0x10f83e['query'][_0x51d2('0xb1')]?{'id':_0x10f83e['query']['tag']}:undefined,'required':_0x10f83e[_0x51d2('0x43')][_0x51d2('0xb1')]?!![]:![]}];}return db[_0x51d2('0x90')][_0x51d2('0x54')](_0x4cb46c);})[_0x51d2('0x21')](function(_0x53aed3){_0x74ac23['rows']=_0x53aed3;return _0x74ac23;});}})[_0x51d2('0x21')](respondWithFilteredResult(_0x1099e9,_0x4cb46c))[_0x51d2('0x2b')](handleError(_0x1099e9,null));};exports[_0x51d2('0xb2')]=function(_0x45f753,_0x2bae89,_0x36ccc4){return db[_0x51d2('0x51')]['find']({'where':{'id':_0x45f753['params']['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x2bae89,null))[_0x51d2('0x21')](function(_0x16f318){if(_0x16f318){return _0x16f318[_0x51d2('0xb2')](_0x45f753['body']['ids'],_[_0x51d2('0xb3')](_0x45f753['body'],[_0x51d2('0x6e'),'id'])||{})[_0x51d2('0xb4')](function(_0x52f62d){for(var _0x27fd6c=0x0;_0x27fd6c<_0x45f753[_0x51d2('0x61')][_0x51d2('0x6e')][_0x51d2('0x4a')];_0x27fd6c+=0x1){socket[_0x51d2('0xb5')](_0x51d2('0xb6'),{'UserId':Number(_0x45f753['body'][_0x51d2('0x6e')][_0x27fd6c]),'OpenchannelAccountId':Number(_0x45f753['params']['id'])});}return _0x52f62d;});}})['then'](respondWithResult(_0x2bae89,null))[_0x51d2('0x2b')](handleError(_0x2bae89,null));};exports[_0x51d2('0xb7')]=function(_0x4da4c0,_0x3be3cf,_0x557c66){return db[_0x51d2('0x51')][_0x51d2('0x58')]({'where':{'id':_0x4da4c0[_0x51d2('0x56')]['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x3be3cf,null))['then'](function(_0x566683){if(_0x566683){return _0x566683['removeAgents'](_0x4da4c0[_0x51d2('0x43')][_0x51d2('0x6e')])['then'](function(){if(_[_0x51d2('0xb8')](_0x4da4c0[_0x51d2('0x43')][_0x51d2('0x6e')])){for(var _0x1b658c=0x0;_0x1b658c<_0x4da4c0[_0x51d2('0x43')][_0x51d2('0x6e')][_0x51d2('0x4a')];_0x1b658c+=0x1){socket[_0x51d2('0xb5')](_0x51d2('0xb9'),{'UserId':Number(_0x4da4c0[_0x51d2('0x43')][_0x51d2('0x6e')][_0x1b658c]),'OpenchannelAccountId':Number(_0x4da4c0[_0x51d2('0x56')]['id'])});}}else{socket[_0x51d2('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4da4c0[_0x51d2('0x43')][_0x51d2('0x6e')]),'OpenchannelAccountId':Number(_0x4da4c0[_0x51d2('0x56')]['id'])});}});}})[_0x51d2('0x21')](respondWithStatusCode(_0x3be3cf,null))[_0x51d2('0x2b')](handleError(_0x3be3cf,null));};exports[_0x51d2('0xba')]=function(_0x4457fa,_0x1365b2,_0x3d8ed2){var _0x3ece9d={};var _0x4780c8={};var _0x121556;var _0x566b81;return db['OpenchannelAccount'][_0x51d2('0x66')]({'where':{'id':_0x4457fa[_0x51d2('0x56')]['id']}})[_0x51d2('0x21')](handleEntityNotFound(_0x1365b2,null))[_0x51d2('0x21')](function(_0x566528){if(_0x566528){_0x121556=_0x566528;_0x4780c8[_0x51d2('0x47')]=_[_0x51d2('0x44')](db[_0x51d2('0x9b')][_0x51d2('0x40')]);_0x4780c8['query']=_[_0x51d2('0x44')](_0x4457fa[_0x51d2('0x43')]);_0x4780c8[_0x51d2('0x45')]=_['intersection'](_0x4780c8[_0x51d2('0x47')],_0x4780c8['query']);_0x3ece9d[_0x51d2('0x48')]=_[_0x51d2('0x46')](_0x4780c8[_0x51d2('0x47')],qs['fields'](_0x4457fa['query'][_0x51d2('0x49')]));_0x3ece9d['attributes']=_0x3ece9d[_0x51d2('0x48')][_0x51d2('0x4a')]?_0x3ece9d['attributes']:_0x4780c8[_0x51d2('0x47')];_0x3ece9d[_0x51d2('0x4b')]=qs[_0x51d2('0x4c')](_0x4457fa[_0x51d2('0x43')][_0x51d2('0x4c')]);_0x3ece9d[_0x51d2('0x4e')]=qs[_0x51d2('0x45')](_[_0x51d2('0x4d')](_0x4457fa['query'],_0x4780c8[_0x51d2('0x45')]));if(_0x4457fa[_0x51d2('0x43')][_0x51d2('0x50')]){_0x3ece9d[_0x51d2('0x4e')]=_[_0x51d2('0x57')](_0x3ece9d[_0x51d2('0x4e')],{'$or':_['map'](_0x3ece9d['attributes'],function(_0xcfd5db){var _0x5158dc={};_0x5158dc[_0xcfd5db]={'$like':'%'+_0x4457fa[_0x51d2('0x43')][_0x51d2('0x50')]+'%'};return _0x5158dc;})});}_0x3ece9d=_[_0x51d2('0x57')]({},_0x3ece9d,_0x4457fa[_0x51d2('0xac')]);return _0x121556[_0x51d2('0xba')](_0x3ece9d);}})['then'](function(_0x3dd10f){if(_0x3dd10f){_0x566b81=_0x3dd10f['length'];if(!_0x4457fa[_0x51d2('0x43')]['hasOwnProperty'](_0x51d2('0x68'))){_0x3ece9d['limit']=qs[_0x51d2('0x33')](_0x4457fa[_0x51d2('0x43')][_0x51d2('0x33')]);_0x3ece9d[_0x51d2('0x30')]=qs[_0x51d2('0x30')](_0x4457fa[_0x51d2('0x43')][_0x51d2('0x30')]);}return _0x121556['getAgents'](_0x3ece9d);}})[_0x51d2('0x21')](function(_0x26d6bb){if(_0x26d6bb){return _0x26d6bb?{'count':_0x566b81,'rows':_0x26d6bb}:null;}})[_0x51d2('0x21')](respondWithResult(_0x1365b2,null))[_0x51d2('0x2b')](handleError(_0x1365b2,null));};exports['send']=function(_0xe3882e,_0xaac17c,_0x5d3d6c){var _0x2672db,_0x21f59e,_0x1cf224;if(_[_0x51d2('0x77')](_0xe3882e[_0x51d2('0x61')][_0x51d2('0x61')])||_0xe3882e[_0x51d2('0x61')]['body']===''){throw new db[(_0x51d2('0x78'))]['ValidationError'](_0x51d2('0x7a'));}if(_['isNil'](_0xe3882e['body']['to'])){}_0x2672db=_0xe3882e[_0x51d2('0x61')]['to'];return db['OpenchannelAccount'][_0x51d2('0x66')]({'where':{'id':_0xe3882e[_0x51d2('0x56')]['id']}})['then'](handleEntityNotFound(_0xaac17c,null))['then'](function(_0x1ca7ad){if(_0x1ca7ad){return db[_0x51d2('0x51')]['find']({'where':{'id':_0x1ca7ad['id']},'include':[{'model':db[_0x51d2('0x7f')],'as':_0x51d2('0x80'),'include':[{'model':db[_0x51d2('0x71')],'as':_0x51d2('0x89'),'where':{[_0x1ca7ad[_0x51d2('0x7b')]]:_0x2672db},'limit':0x1,'order':[[_0x51d2('0x74'),_0x51d2('0x81')]]}]}]})['then'](handleEntityNotFound(_0xaac17c,null))['then'](function(_0x4917b8){if(_0x4917b8&&_0x4917b8[_0x51d2('0x80')]){_0x21f59e=_0x4917b8[_0x51d2('0x38')]({'plain':!![]});if(_0x21f59e[_0x51d2('0x80')]&&_0x21f59e['List']['Contacts'][_0x51d2('0x4a')]){return _0x21f59e[_0x51d2('0x80')][_0x51d2('0x89')][0x0];}return db[_0x51d2('0x71')]['create'](_['defaults'](_0xe3882e[_0x51d2('0x61')],{'firstName':_0x2672db,[_0x4917b8['mapKey']]:_0x2672db,'phone':_0x2672db,'ListId':_0x21f59e['ListId']}));}})[_0x51d2('0x21')](handleEntityNotFound(_0xaac17c,null))[_0x51d2('0x21')](function(_0x2e0deb){if(_0x2e0deb){_0x1cf224=_0x2e0deb;return db[_0x51d2('0x90')][_0x51d2('0x58')]({'where':{'ContactId':_0x1cf224['id'],'closed':![],'OpenchannelAccountId':_0x21f59e['id']}})[_0x51d2('0x21')](function(_0x1620bd){if(_0x1620bd){return[_0x1620bd,![]];}return db[_0x51d2('0x90')][_0x51d2('0x59')]({'UserId':_0xe3882e[_0x51d2('0x5a')]['id'],'ContactId':_0x1cf224['id'],'OpenchannelAccountId':_0x21f59e['id'],'lastMsgDirection':_0x51d2('0xbb'),'firstMsgDirection':_0x51d2('0xbb'),'Messages':[_[_0x51d2('0x57')](_0xe3882e[_0x51d2('0x61')],{'read':![],'body':_0xe3882e[_0x51d2('0x61')][_0x51d2('0x61')],'OpenchannelAccountId':_0x21f59e['id'],'UserId':_0xe3882e[_0x51d2('0x5a')]['id'],'ContactId':_0x1cf224['id']})]},{'include':[{'model':db[_0x51d2('0xbc')],'as':_0x51d2('0xbd')}]})[_0x51d2('0x21')](function(_0x1a0172){return[_0x1a0172,!![]];});});}})['spread'](function(_0x5abb67,_0x11e87b){if(_0x11e87b){return _0x5abb67;}return db['OpenchannelMessage'][_0x51d2('0x59')](_['merge'](_0xe3882e[_0x51d2('0x61')],{'read':![],'body':_0xe3882e[_0x51d2('0x61')][_0x51d2('0x61')],'OpenchannelAccountId':_0x21f59e['id'],'OpenchannelInteractionId':_0x5abb67['id'],'UserId':_0xe3882e[_0x51d2('0x5a')]['id'],'ContactId':_0x1cf224['id']}))['then'](function(_0x1acc1a){_0x5abb67[_0x51d2('0xbe')][_0x51d2('0xbd')]=[];_0x5abb67[_0x51d2('0xbe')][_0x51d2('0xbd')][_0x51d2('0x96')](_0x1acc1a[_0x51d2('0xbe')]);return _0x5abb67;});});}})[_0x51d2('0x21')](respondWithResult(_0xaac17c,null))[_0x51d2('0x2b')](handleError(_0xaac17c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 50d64c4..056521d 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 _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x48bc0d,_0x30becd){var _0x35f641=function(_0x136926){while(--_0x136926){_0x48bc0d['push'](_0x48bc0d['shift']());}};_0x35f641(++_0x30becd);}(_0x3c81,0x102));var _0x13c8=function(_0x26146c,_0x10aa48){_0x26146c=_0x26146c-0x0;var _0x1b4401=_0x3c81[_0x26146c];return _0x1b4401;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var OpenchannelAccount=require(_0x13c8('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];OpenchannelAccount[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x2dae=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x1c0b23,_0x443ebc){var _0x19deb5=function(_0x495531){while(--_0x495531){_0x1c0b23['push'](_0x1c0b23['shift']());}};_0x19deb5(++_0x443ebc);}(_0x2dae,0xc3));var _0xe2da=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0x2dae[_0x3b7b8a];return _0x441206;};'use strict';var EventEmitter=require(_0xe2da('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xe2da('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe2da('0x2')](0x0);var events={'afterCreate':_0xe2da('0x3'),'afterUpdate':_0xe2da('0x4'),'afterDestroy':_0xe2da('0x5')};function emitEvent(_0x481d97){return function(_0x25b9f2,_0x439b5d,_0x77e45e){OpenchannelAccountEvents[_0xe2da('0x6')](_0x481d97+':'+_0x25b9f2['id'],_0x25b9f2);OpenchannelAccountEvents['emit'](_0x481d97,_0x25b9f2);_0x77e45e(null);};}for(var e in events){if(events[_0xe2da('0x7')](e)){var event=events[e];OpenchannelAccount[_0xe2da('0x8')](e,emitEvent(event));}}module[_0xe2da('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d2c0421..5d0f418 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(_0x4aa33d,_0xa1adf0){var _0x313886=function(_0x3a4c07){while(--_0x3a4c07){_0x4aa33d['push'](_0x4aa33d['shift']());}};_0x313886(++_0xa1adf0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x2378ce,_0x497510){var _0x475b0f=function(_0x2eb507){while(--_0x2eb507){_0x2378ce['push'](_0x2378ce['shift']());}};_0x475b0f(++_0x497510);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 5beb548..a48e9b5 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 _0x8b29=['defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis'];(function(_0x579982,_0x4efe5b){var _0x1e6345=function(_0x495f5c){while(--_0x495f5c){_0x579982['push'](_0x579982['shift']());}};_0x1e6345(++_0x4efe5b);}(_0x8b29,0xbe));var _0x98b2=function(_0x333b5f,_0x1d0f0f){_0x333b5f=_0x333b5f-0x0;var _0x2a89a1=_0x8b29[_0x333b5f];return _0x2a89a1;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var moment=require(_0x98b2('0x1'));var BPromise=require(_0x98b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98b2('0x3'))['db'];var utils=require(_0x98b2('0x4'));var logger=require('../../config/logger')(_0x98b2('0x5'));var config=require('../../config/environment');var jayson=require(_0x98b2('0x6'));var client=jayson[_0x98b2('0x7')][_0x98b2('0x8')]({'port':0x232a});config[_0x98b2('0x9')]=_[_0x98b2('0xa')](config[_0x98b2('0x9')],{'host':_0x98b2('0xb'),'port':0x18eb});var socket=require(_0x98b2('0xc'))(new Redis(config[_0x98b2('0x9')]));require(_0x98b2('0xd'))['register'](socket);function respondWithRpcPromise(_0x48a17e,_0x599bf5,_0x14e049){return new BPromise(function(_0x39617c,_0x22c6c4){return client[_0x98b2('0xe')](_0x48a17e,_0x14e049)[_0x98b2('0xf')](function(_0x54b03c){logger[_0x98b2('0x10')](_0x98b2('0x11'),_0x599bf5,'request\x20sent');logger[_0x98b2('0x12')](_0x98b2('0x13'),_0x599bf5,_0x98b2('0x14'),JSON['stringify'](_0x54b03c));if(_0x54b03c['error']){if(_0x54b03c[_0x98b2('0x15')]['code']===0x1f4){logger[_0x98b2('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x599bf5,_0x54b03c['error']['message']);return _0x22c6c4(_0x54b03c[_0x98b2('0x15')][_0x98b2('0x16')]);}logger[_0x98b2('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x599bf5,_0x54b03c['error']['message']);return _0x39617c(_0x54b03c[_0x98b2('0x15')][_0x98b2('0x16')]);}else{logger[_0x98b2('0x10')](_0x98b2('0x11'),_0x599bf5,'request\x20sent');_0x39617c(_0x54b03c[_0x98b2('0x17')]['message']);}})[_0x98b2('0x18')](function(_0x4931f4){logger[_0x98b2('0x15')](_0x98b2('0x11'),_0x599bf5,_0x4931f4);_0x22c6c4(_0x4931f4);});});} \ No newline at end of file +var _0xeb74=['request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','register'];(function(_0x14dd9e,_0x2cafac){var _0x583c61=function(_0x44d235){while(--_0x44d235){_0x14dd9e['push'](_0x14dd9e['shift']());}};_0x583c61(++_0x2cafac);}(_0xeb74,0xe3));var _0x4eb7=function(_0x254f11,_0x135b84){_0x254f11=_0x254f11-0x0;var _0x19e1b5=_0xeb74[_0x254f11];return _0x19e1b5;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});config[_0x4eb7('0xc')]=_['defaults'](config[_0x4eb7('0xc')],{'host':_0x4eb7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4eb7('0xe'))[_0x4eb7('0xf')](socket);function respondWithRpcPromise(_0x4b3add,_0xa72e98,_0x4ff98e){return new BPromise(function(_0x3326cd,_0x462392){return client[_0x4eb7('0x10')](_0x4b3add,_0x4ff98e)['then'](function(_0x2b32be){logger[_0x4eb7('0x11')](_0x4eb7('0x12'),_0xa72e98,_0x4eb7('0x13'));logger[_0x4eb7('0x14')](_0x4eb7('0x15'),_0xa72e98,_0x4eb7('0x13'),JSON['stringify'](_0x2b32be));if(_0x2b32be['error']){if(_0x2b32be['error'][_0x4eb7('0x16')]===0x1f4){logger['error'](_0x4eb7('0x12'),_0xa72e98,_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);return _0x462392(_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);}logger[_0x4eb7('0x17')](_0x4eb7('0x12'),_0xa72e98,_0x2b32be[_0x4eb7('0x17')][_0x4eb7('0x18')]);return _0x3326cd(_0x2b32be[_0x4eb7('0x17')]['message']);}else{logger[_0x4eb7('0x11')](_0x4eb7('0x12'),_0xa72e98,_0x4eb7('0x13'));_0x3326cd(_0x2b32be[_0x4eb7('0x19')][_0x4eb7('0x18')]);}})[_0x4eb7('0x1a')](function(_0x2d0ea7){logger[_0x4eb7('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0xa72e98,_0x2d0ea7);_0x462392(_0x2d0ea7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 21666a6..35c63ba 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 _0xcab6=['length','openchannelAccount:','./openchannelAccount.events','remove','update','emit','register'];(function(_0x356589,_0x30d81e){var _0x2b85e4=function(_0x17d69b){while(--_0x17d69b){_0x356589['push'](_0x356589['shift']());}};_0x2b85e4(++_0x30d81e);}(_0xcab6,0xd4));var _0x6cab=function(_0x38b34c,_0x1d9eb9){_0x38b34c=_0x38b34c-0x0;var _0x519b74=_0xcab6[_0x38b34c];return _0x519b74;};'use strict';var OpenchannelAccountEvents=require(_0x6cab('0x0'));var events=['save',_0x6cab('0x1'),_0x6cab('0x2')];function createListener(_0x1ff0cd,_0x1b8153){return function(_0xae3b53){_0x1b8153[_0x6cab('0x3')](_0x1ff0cd,_0xae3b53);};}function removeListener(_0x5ea2d8,_0xa8b534){return function(){OpenchannelAccountEvents['removeListener'](_0x5ea2d8,_0xa8b534);};}exports[_0x6cab('0x4')]=function(_0x1953cd){for(var _0x13464a=0x0,_0x53e159=events[_0x6cab('0x5')];_0x13464a<_0x53e159;_0x13464a++){var _0x229e5a=events[_0x13464a];var _0x230f8b=createListener(_0x6cab('0x6')+_0x229e5a,_0x1953cd);OpenchannelAccountEvents['on'](_0x229e5a,_0x230f8b);}}; \ No newline at end of file +var _0x9e0d=['save','remove','update','emit','removeListener','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x106321,_0x27a6f6){var _0x9c83e7=function(_0x2c4a05){while(--_0x2c4a05){_0x106321['push'](_0x106321['shift']());}};_0x9c83e7(++_0x27a6f6);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x2e850b,_0x44a27d){_0x2e850b=_0x2e850b-0x0;var _0x20d68f=_0x9e0d[_0x2e850b];return _0x20d68f;};'use strict';var OpenchannelAccountEvents=require(_0xd9e0('0x0'));var events=[_0xd9e0('0x1'),_0xd9e0('0x2'),_0xd9e0('0x3')];function createListener(_0x5195f8,_0x2c5792){return function(_0x3ec198){_0x2c5792[_0xd9e0('0x4')](_0x5195f8,_0x3ec198);};}function removeListener(_0x1c83df,_0x296774){return function(){OpenchannelAccountEvents[_0xd9e0('0x5')](_0x1c83df,_0x296774);};}exports['register']=function(_0x570a07){for(var _0x22e726=0x0,_0x28ce1e=events[_0xd9e0('0x6')];_0x22e726<_0x28ce1e;_0x22e726++){var _0x3f8bb2=events[_0x22e726];var _0x256df0=createListener(_0xd9e0('0x7')+_0x3f8bb2,_0x570a07);OpenchannelAccountEvents['on'](_0x3f8bb2,_0x256df0);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index d6b59ca..18feb02 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 _0xbb2b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','util','connect-timeout','express'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0xbb2b,0x166));var _0xbbb2=function(_0x2cc5d5,_0x297489){_0x2cc5d5=_0x2cc5d5-0x0;var _0x4b7c0f=_0xbb2b[_0x2cc5d5];return _0x4b7c0f;};'use strict';var multer=require('multer');var util=require(_0xbbb2('0x0'));var path=require('path');var timeout=require(_0xbbb2('0x1'));var express=require(_0xbbb2('0x2'));var router=express[_0xbbb2('0x3')]();var fs_extra=require(_0xbbb2('0x4'));var auth=require(_0xbbb2('0x5'));var interaction=require(_0xbbb2('0x6'));var config=require('../../config/environment');var controller=require(_0xbbb2('0x7'));router[_0xbbb2('0x8')]('/',auth['isAuthenticated'](),controller[_0xbbb2('0x9')]);router['get'](_0xbbb2('0xa'),auth['isAuthenticated'](),controller[_0xbbb2('0xb')]);router[_0xbbb2('0xc')]('/',auth[_0xbbb2('0xd')](),controller[_0xbbb2('0xe')]);router[_0xbbb2('0xf')](_0xbbb2('0xa'),auth[_0xbbb2('0xd')](),controller[_0xbbb2('0x10')]);router['delete'](_0xbbb2('0xa'),auth[_0xbbb2('0xd')](),controller[_0xbbb2('0x11')]);module[_0xbbb2('0x12')]=router; \ No newline at end of file +var _0x2dad=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x2dad,0x86));var _0xd2da=function(_0x57d09d,_0x5da3d2){_0x57d09d=_0x57d09d-0x0;var _0x116a43=_0x2dad[_0x57d09d];return _0x116a43;};'use strict';var multer=require(_0xd2da('0x0'));var util=require(_0xd2da('0x1'));var path=require(_0xd2da('0x2'));var timeout=require(_0xd2da('0x3'));var express=require(_0xd2da('0x4'));var router=express[_0xd2da('0x5')]();var fs_extra=require(_0xd2da('0x6'));var auth=require(_0xd2da('0x7'));var interaction=require(_0xd2da('0x8'));var config=require(_0xd2da('0x9'));var controller=require(_0xd2da('0xa'));router['get']('/',auth[_0xd2da('0xb')](),controller['index']);router[_0xd2da('0xc')](_0xd2da('0xd'),auth[_0xd2da('0xb')](),controller[_0xd2da('0xe')]);router[_0xd2da('0xf')]('/',auth[_0xd2da('0xb')](),controller[_0xd2da('0x10')]);router[_0xd2da('0x11')](_0xd2da('0xd'),auth['isAuthenticated'](),controller[_0xd2da('0x12')]);router[_0xd2da('0x13')](_0xd2da('0xd'),auth[_0xd2da('0xb')](),controller[_0xd2da('0x14')]);module[_0xd2da('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 28b058f..63d52a9 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 _0x1753=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x1753,0xb3));var _0x3175=function(_0x3e1ec3,_0x6dae9b){_0x3e1ec3=_0x3e1ec3-0x0;var _0x257717=_0x1753[_0x3e1ec3];return _0x257717;};'use strict';var Sequelize=require(_0x3175('0x0'));module[_0x3175('0x1')]={'priority':{'type':Sequelize[_0x3175('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3175('0x3')],'allowNull':![],'defaultValue':_0x3175('0x4')},'appdata':{'type':Sequelize[_0x3175('0x5')]()},'description':{'type':Sequelize[_0x3175('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3175('0x6')}}; \ No newline at end of file +var _0xa2f5=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x170b2e,_0x4cbf4e){var _0x4a65e7=function(_0x488a72){while(--_0x488a72){_0x170b2e['push'](_0x170b2e['shift']());}};_0x4a65e7(++_0x4cbf4e);}(_0xa2f5,0x143));var _0x5a2f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa2f5[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5a2f('0x0'));module[_0x5a2f('0x1')]={'priority':{'type':Sequelize[_0x5a2f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5a2f('0x3')],'allowNull':![],'defaultValue':_0x5a2f('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5a2f('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 30e8dae..42dc68c 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 _0x3346=['save','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','update','find','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x3e24e9,_0x1a27e1){var _0x4bf416=function(_0x3c0240){while(--_0x3c0240){_0x3e24e9['push'](_0x3e24e9['shift']());}};_0x4bf416(++_0x1a27e1);}(_0x3346,0x1bc));var _0x6334=function(_0x3bcdf1,_0x20ec77){_0x3bcdf1=_0x3bcdf1-0x0;var _0x2bc4a6=_0x3346[_0x3bcdf1];return _0x2bc4a6;};'use strict';var emlformat=require(_0x6334('0x0'));var rimraf=require(_0x6334('0x1'));var zipdir=require(_0x6334('0x2'));var jsonpatch=require(_0x6334('0x3'));var rp=require('request-promise');var moment=require(_0x6334('0x4'));var BPromise=require(_0x6334('0x5'));var Mustache=require(_0x6334('0x6'));var util=require(_0x6334('0x7'));var path=require(_0x6334('0x8'));var sox=require(_0x6334('0x9'));var csv=require(_0x6334('0xa'));var ejs=require(_0x6334('0xb'));var fs=require('fs');var fs_extra=require(_0x6334('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6334('0xd'));var deskjs=require(_0x6334('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6334('0xf'));var Papa=require(_0x6334('0x10'));var Redis=require('ioredis');var authService=require(_0x6334('0x11'));var qs=require(_0x6334('0x12'));var as=require(_0x6334('0x13'));var hardwareService=require(_0x6334('0x14'));var logger=require(_0x6334('0x15'))('api');var utils=require(_0x6334('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6334('0x17'));var db=require(_0x6334('0x18'))['db'];function respondWithStatusCode(_0x43b4af,_0x1e3e90){_0x1e3e90=_0x1e3e90||0xcc;return function(_0xde9b70){if(_0xde9b70){return _0x43b4af[_0x6334('0x19')](_0x1e3e90);}return _0x43b4af['status'](_0x1e3e90)['end']();};}function respondWithResult(_0x2634fd,_0x23f409){_0x23f409=_0x23f409||0xc8;return function(_0x4ea1e1){if(_0x4ea1e1){return _0x2634fd[_0x6334('0x1a')](_0x23f409)[_0x6334('0x1b')](_0x4ea1e1);}};}function respondWithFilteredResult(_0xf4eb92,_0x3518f7){return function(_0x5ccb3a){if(_0x5ccb3a){var _0x5c355d=typeof _0x3518f7[_0x6334('0x1c')]===_0x6334('0x1d')&&typeof _0x3518f7[_0x6334('0x1e')]===_0x6334('0x1d');var _0x11487=_0x5ccb3a[_0x6334('0x1f')];var _0x3907f9=_0x5c355d?0x0:_0x3518f7[_0x6334('0x1c')];var _0x4dd956=_0x5c355d?_0x5ccb3a[_0x6334('0x1f')]:_0x3518f7[_0x6334('0x1c')]+_0x3518f7[_0x6334('0x1e')];var _0x18da33;if(_0x4dd956>=_0x11487){_0x4dd956=_0x11487;_0x18da33=0xc8;}else{_0x18da33=0xce;}_0xf4eb92[_0x6334('0x1a')](_0x18da33);return _0xf4eb92[_0x6334('0x20')](_0x6334('0x21'),_0x3907f9+'-'+_0x4dd956+'/'+_0x11487)[_0x6334('0x1b')](_0x5ccb3a);}return null;};}function patchUpdates(_0x22a5ba){return function(_0x2b845c){try{jsonpatch[_0x6334('0x22')](_0x2b845c,_0x22a5ba,!![]);}catch(_0x320a59){return BPromise[_0x6334('0x23')](_0x320a59);}return _0x2b845c[_0x6334('0x24')]();};}function saveUpdates(_0xcdbb5c,_0x123678){return function(_0x1fe223){if(_0x1fe223){return _0x1fe223['update'](_0xcdbb5c)[_0x6334('0x25')](function(_0x6635){return _0x6635;});}return null;};}function removeEntity(_0x27499c,_0x414864){return function(_0x3e8ab2){if(_0x3e8ab2){return _0x3e8ab2[_0x6334('0x26')]()['then'](function(){_0x27499c[_0x6334('0x1a')](0xcc)[_0x6334('0x27')]();});}};}function handleEntityNotFound(_0x553a46,_0x925a42){return function(_0x1671d9){if(!_0x1671d9){_0x553a46[_0x6334('0x19')](0x194);}return _0x1671d9;};}function handleError(_0x12af35,_0x25803f){_0x25803f=_0x25803f||0x1f4;return function(_0x10ae77){logger[_0x6334('0x28')](_0x10ae77[_0x6334('0x29')]);if(_0x10ae77[_0x6334('0x2a')]){delete _0x10ae77['name'];}_0x12af35[_0x6334('0x1a')](_0x25803f)[_0x6334('0x2b')](_0x10ae77);};}exports[_0x6334('0x2c')]=function(_0x4c5361,_0x2a999f){var _0x4647ca={},_0x26b6b8={},_0x2a501c={'count':0x0,'rows':[]};var _0x40d976=_[_0x6334('0x2d')](db[_0x6334('0x2e')][_0x6334('0x2f')],function(_0x3784c6){return{'name':_0x3784c6[_0x6334('0x30')],'type':_0x3784c6[_0x6334('0x31')][_0x6334('0x32')]};});_0x26b6b8['model']=_['map'](_0x40d976,_0x6334('0x2a'));_0x26b6b8[_0x6334('0x33')]=_[_0x6334('0x34')](_0x4c5361[_0x6334('0x33')]);_0x26b6b8[_0x6334('0x35')]=_[_0x6334('0x36')](_0x26b6b8[_0x6334('0x37')],_0x26b6b8['query']);_0x4647ca[_0x6334('0x38')]=_[_0x6334('0x36')](_0x26b6b8[_0x6334('0x37')],qs[_0x6334('0x39')](_0x4c5361[_0x6334('0x33')][_0x6334('0x39')]));_0x4647ca['attributes']=_0x4647ca[_0x6334('0x38')]['length']?_0x4647ca['attributes']:_0x26b6b8[_0x6334('0x37')];if(!_0x4c5361['query'][_0x6334('0x3a')](_0x6334('0x3b'))){_0x4647ca[_0x6334('0x1e')]=qs[_0x6334('0x1e')](_0x4c5361[_0x6334('0x33')]['limit']);_0x4647ca[_0x6334('0x1c')]=qs['offset'](_0x4c5361[_0x6334('0x33')][_0x6334('0x1c')]);}_0x4647ca[_0x6334('0x3c')]=qs[_0x6334('0x3d')](_0x4c5361[_0x6334('0x33')][_0x6334('0x3d')]);_0x4647ca[_0x6334('0x3e')]=qs['filters'](_[_0x6334('0x3f')](_0x4c5361[_0x6334('0x33')],_0x26b6b8[_0x6334('0x35')]),_0x40d976);if(_0x4c5361[_0x6334('0x33')][_0x6334('0x40')]){_0x4647ca[_0x6334('0x3e')]=_[_0x6334('0x41')](_0x4647ca[_0x6334('0x3e')],{'$or':_[_0x6334('0x2d')](_0x40d976,function(_0x2f4bfc){if(_0x2f4bfc[_0x6334('0x31')]!==_0x6334('0x42')){var _0x4c3db6={};_0x4c3db6[_0x2f4bfc[_0x6334('0x2a')]]={'$like':'%'+_0x4c5361[_0x6334('0x33')][_0x6334('0x40')]+'%'};return _0x4c3db6;}})});}_0x4647ca=_['merge']({},_0x4647ca,_0x4c5361['options']);var _0x27d82f={'where':_0x4647ca[_0x6334('0x3e')]};return db['OpenchannelApplication'][_0x6334('0x1f')](_0x27d82f)['then'](function(_0x448555){_0x2a501c[_0x6334('0x1f')]=_0x448555;if(_0x4c5361['query'][_0x6334('0x43')]){_0x4647ca[_0x6334('0x44')]=[{'all':!![]}];}return db[_0x6334('0x2e')][_0x6334('0x45')](_0x4647ca);})[_0x6334('0x25')](function(_0x45779c){_0x2a501c[_0x6334('0x46')]=_0x45779c;return _0x2a501c;})[_0x6334('0x25')](respondWithFilteredResult(_0x2a999f,_0x4647ca))[_0x6334('0x47')](handleError(_0x2a999f,null));};exports[_0x6334('0x48')]=function(_0x4680b7,_0x55182e){var _0x173fb4={'raw':!![],'where':{'id':_0x4680b7[_0x6334('0x49')]['id']}},_0x53c188={};_0x53c188[_0x6334('0x37')]=_[_0x6334('0x34')](db[_0x6334('0x2e')][_0x6334('0x2f')]);_0x53c188['query']=_[_0x6334('0x34')](_0x4680b7[_0x6334('0x33')]);_0x53c188['filters']=_[_0x6334('0x36')](_0x53c188[_0x6334('0x37')],_0x53c188[_0x6334('0x33')]);_0x173fb4[_0x6334('0x38')]=_[_0x6334('0x36')](_0x53c188[_0x6334('0x37')],qs[_0x6334('0x39')](_0x4680b7[_0x6334('0x33')][_0x6334('0x39')]));_0x173fb4[_0x6334('0x38')]=_0x173fb4['attributes'][_0x6334('0x4a')]?_0x173fb4[_0x6334('0x38')]:_0x53c188[_0x6334('0x37')];if(_0x4680b7['query'][_0x6334('0x43')]){_0x173fb4[_0x6334('0x44')]=[{'all':!![]}];}_0x173fb4=_[_0x6334('0x41')]({},_0x173fb4,_0x4680b7[_0x6334('0x4b')]);return db[_0x6334('0x2e')]['find'](_0x173fb4)[_0x6334('0x25')](handleEntityNotFound(_0x55182e,null))[_0x6334('0x25')](respondWithResult(_0x55182e,null))['catch'](handleError(_0x55182e,null));};exports[_0x6334('0x4c')]=function(_0x340ce5,_0x3ec712){return db[_0x6334('0x2e')][_0x6334('0x4c')](_0x340ce5[_0x6334('0x4d')],{})[_0x6334('0x25')](respondWithResult(_0x3ec712,0xc9))[_0x6334('0x47')](handleError(_0x3ec712,null));};exports[_0x6334('0x4e')]=function(_0x556986,_0xfdcfde){if(_0x556986['body']['id']){delete _0x556986['body']['id'];}return db[_0x6334('0x2e')][_0x6334('0x4f')]({'where':{'id':_0x556986[_0x6334('0x49')]['id']}})[_0x6334('0x25')](handleEntityNotFound(_0xfdcfde,null))[_0x6334('0x25')](saveUpdates(_0x556986['body'],null))[_0x6334('0x25')](respondWithResult(_0xfdcfde,null))[_0x6334('0x47')](handleError(_0xfdcfde,null));};exports['destroy']=function(_0x2a9a6f,_0x18bc7a){return db[_0x6334('0x2e')][_0x6334('0x4f')]({'where':{'id':_0x2a9a6f[_0x6334('0x49')]['id']}})[_0x6334('0x25')](handleEntityNotFound(_0x18bc7a,null))[_0x6334('0x25')](removeEntity(_0x18bc7a,null))[_0x6334('0x47')](handleError(_0x18bc7a,null));}; \ No newline at end of file +var _0xefbb=['includeAll','include','rows','then','show','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x5e4008,_0x1fe194){var _0x201899=function(_0x5ab373){while(--_0x5ab373){_0x5e4008['push'](_0x5e4008['shift']());}};_0x201899(++_0x1fe194);}(_0xefbb,0x136));var _0xbefb=function(_0x23be60,_0x34e568){_0x23be60=_0x23be60-0x0;var _0x521dd2=_0xefbb[_0x23be60];return _0x521dd2;};'use strict';var emlformat=require(_0xbefb('0x0'));var rimraf=require(_0xbefb('0x1'));var zipdir=require(_0xbefb('0x2'));var jsonpatch=require(_0xbefb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbefb('0x4'));var Mustache=require(_0xbefb('0x5'));var util=require('util');var path=require(_0xbefb('0x6'));var sox=require(_0xbefb('0x7'));var csv=require(_0xbefb('0x8'));var ejs=require(_0xbefb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbefb('0xa'));var squel=require(_0xbefb('0xb'));var crypto=require(_0xbefb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbefb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbefb('0xe'));var Papa=require('papaparse');var Redis=require(_0xbefb('0xf'));var authService=require(_0xbefb('0x10'));var qs=require(_0xbefb('0x11'));var as=require(_0xbefb('0x12'));var hardwareService=require(_0xbefb('0x13'));var logger=require(_0xbefb('0x14'))('api');var utils=require(_0xbefb('0x15'));var config=require(_0xbefb('0x16'));var licenseUtil=require(_0xbefb('0x17'));var db=require(_0xbefb('0x18'))['db'];function respondWithStatusCode(_0x8cb30c,_0x5dd84b){_0x5dd84b=_0x5dd84b||0xcc;return function(_0x2aab01){if(_0x2aab01){return _0x8cb30c[_0xbefb('0x19')](_0x5dd84b);}return _0x8cb30c[_0xbefb('0x1a')](_0x5dd84b)[_0xbefb('0x1b')]();};}function respondWithResult(_0x1638d6,_0x38c259){_0x38c259=_0x38c259||0xc8;return function(_0x13cbe6){if(_0x13cbe6){return _0x1638d6[_0xbefb('0x1a')](_0x38c259)[_0xbefb('0x1c')](_0x13cbe6);}};}function respondWithFilteredResult(_0xacdc74,_0x3c25af){return function(_0xce49b0){if(_0xce49b0){var _0x308682=typeof _0x3c25af[_0xbefb('0x1d')]===_0xbefb('0x1e')&&typeof _0x3c25af[_0xbefb('0x1f')]===_0xbefb('0x1e');var _0x4bcaa2=_0xce49b0[_0xbefb('0x20')];var _0x2410a4=_0x308682?0x0:_0x3c25af['offset'];var _0x3c10f9=_0x308682?_0xce49b0[_0xbefb('0x20')]:_0x3c25af[_0xbefb('0x1d')]+_0x3c25af[_0xbefb('0x1f')];var _0x3dca5c;if(_0x3c10f9>=_0x4bcaa2){_0x3c10f9=_0x4bcaa2;_0x3dca5c=0xc8;}else{_0x3dca5c=0xce;}_0xacdc74[_0xbefb('0x1a')](_0x3dca5c);return _0xacdc74[_0xbefb('0x21')]('Content-Range',_0x2410a4+'-'+_0x3c10f9+'/'+_0x4bcaa2)[_0xbefb('0x1c')](_0xce49b0);}return null;};}function patchUpdates(_0x1d709a){return function(_0x3bda47){try{jsonpatch[_0xbefb('0x22')](_0x3bda47,_0x1d709a,!![]);}catch(_0x53720b){return BPromise['reject'](_0x53720b);}return _0x3bda47[_0xbefb('0x23')]();};}function saveUpdates(_0x3fad31,_0x216df0){return function(_0x17a54e){if(_0x17a54e){return _0x17a54e[_0xbefb('0x24')](_0x3fad31)['then'](function(_0x5808aa){return _0x5808aa;});}return null;};}function removeEntity(_0x587c43,_0x551b80){return function(_0x1bb075){if(_0x1bb075){return _0x1bb075[_0xbefb('0x25')]()['then'](function(){_0x587c43[_0xbefb('0x1a')](0xcc)[_0xbefb('0x1b')]();});}};}function handleEntityNotFound(_0x40d8fb,_0x33e12e){return function(_0x5d6488){if(!_0x5d6488){_0x40d8fb['sendStatus'](0x194);}return _0x5d6488;};}function handleError(_0x3af3df,_0x59b896){_0x59b896=_0x59b896||0x1f4;return function(_0x466939){logger[_0xbefb('0x26')](_0x466939['stack']);if(_0x466939['name']){delete _0x466939[_0xbefb('0x27')];}_0x3af3df['status'](_0x59b896)[_0xbefb('0x28')](_0x466939);};}exports[_0xbefb('0x29')]=function(_0x143ab6,_0x412ebd){var _0x57179d={},_0x425412={},_0x3cde77={'count':0x0,'rows':[]};var _0x380997=_[_0xbefb('0x2a')](db[_0xbefb('0x2b')][_0xbefb('0x2c')],function(_0x42f7ae){return{'name':_0x42f7ae[_0xbefb('0x2d')],'type':_0x42f7ae[_0xbefb('0x2e')][_0xbefb('0x2f')]};});_0x425412[_0xbefb('0x30')]=_['map'](_0x380997,_0xbefb('0x27'));_0x425412[_0xbefb('0x31')]=_[_0xbefb('0x32')](_0x143ab6[_0xbefb('0x31')]);_0x425412[_0xbefb('0x33')]=_[_0xbefb('0x34')](_0x425412[_0xbefb('0x30')],_0x425412[_0xbefb('0x31')]);_0x57179d[_0xbefb('0x35')]=_['intersection'](_0x425412[_0xbefb('0x30')],qs['fields'](_0x143ab6['query'][_0xbefb('0x36')]));_0x57179d[_0xbefb('0x35')]=_0x57179d['attributes'][_0xbefb('0x37')]?_0x57179d[_0xbefb('0x35')]:_0x425412[_0xbefb('0x30')];if(!_0x143ab6['query']['hasOwnProperty'](_0xbefb('0x38'))){_0x57179d[_0xbefb('0x1f')]=qs['limit'](_0x143ab6[_0xbefb('0x31')][_0xbefb('0x1f')]);_0x57179d[_0xbefb('0x1d')]=qs[_0xbefb('0x1d')](_0x143ab6[_0xbefb('0x31')][_0xbefb('0x1d')]);}_0x57179d[_0xbefb('0x39')]=qs[_0xbefb('0x3a')](_0x143ab6['query']['sort']);_0x57179d[_0xbefb('0x3b')]=qs[_0xbefb('0x33')](_[_0xbefb('0x3c')](_0x143ab6[_0xbefb('0x31')],_0x425412[_0xbefb('0x33')]),_0x380997);if(_0x143ab6[_0xbefb('0x31')][_0xbefb('0x3d')]){_0x57179d[_0xbefb('0x3b')]=_[_0xbefb('0x3e')](_0x57179d[_0xbefb('0x3b')],{'$or':_[_0xbefb('0x2a')](_0x380997,function(_0xc567f1){if(_0xc567f1[_0xbefb('0x2e')]!==_0xbefb('0x3f')){var _0x2cb621={};_0x2cb621[_0xc567f1[_0xbefb('0x27')]]={'$like':'%'+_0x143ab6[_0xbefb('0x31')]['filter']+'%'};return _0x2cb621;}})});}_0x57179d=_['merge']({},_0x57179d,_0x143ab6[_0xbefb('0x40')]);var _0x1563c6={'where':_0x57179d[_0xbefb('0x3b')]};return db[_0xbefb('0x2b')]['count'](_0x1563c6)['then'](function(_0x4697f){_0x3cde77[_0xbefb('0x20')]=_0x4697f;if(_0x143ab6[_0xbefb('0x31')][_0xbefb('0x41')]){_0x57179d[_0xbefb('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x57179d);})['then'](function(_0x18105d){_0x3cde77[_0xbefb('0x43')]=_0x18105d;return _0x3cde77;})[_0xbefb('0x44')](respondWithFilteredResult(_0x412ebd,_0x57179d))['catch'](handleError(_0x412ebd,null));};exports[_0xbefb('0x45')]=function(_0x3ea549,_0x407f97){var _0x566565={'raw':!![],'where':{'id':_0x3ea549['params']['id']}},_0x4b2719={};_0x4b2719[_0xbefb('0x30')]=_[_0xbefb('0x32')](db['OpenchannelApplication'][_0xbefb('0x2c')]);_0x4b2719[_0xbefb('0x31')]=_[_0xbefb('0x32')](_0x3ea549[_0xbefb('0x31')]);_0x4b2719[_0xbefb('0x33')]=_[_0xbefb('0x34')](_0x4b2719['model'],_0x4b2719['query']);_0x566565[_0xbefb('0x35')]=_[_0xbefb('0x34')](_0x4b2719[_0xbefb('0x30')],qs[_0xbefb('0x36')](_0x3ea549[_0xbefb('0x31')][_0xbefb('0x36')]));_0x566565[_0xbefb('0x35')]=_0x566565[_0xbefb('0x35')]['length']?_0x566565['attributes']:_0x4b2719[_0xbefb('0x30')];if(_0x3ea549[_0xbefb('0x31')][_0xbefb('0x41')]){_0x566565['include']=[{'all':!![]}];}_0x566565=_[_0xbefb('0x3e')]({},_0x566565,_0x3ea549[_0xbefb('0x40')]);return db['OpenchannelApplication']['find'](_0x566565)[_0xbefb('0x44')](handleEntityNotFound(_0x407f97,null))[_0xbefb('0x44')](respondWithResult(_0x407f97,null))[_0xbefb('0x46')](handleError(_0x407f97,null));};exports[_0xbefb('0x47')]=function(_0x21c11b,_0x5581c3){return db[_0xbefb('0x2b')][_0xbefb('0x47')](_0x21c11b[_0xbefb('0x48')],{})[_0xbefb('0x44')](respondWithResult(_0x5581c3,0xc9))['catch'](handleError(_0x5581c3,null));};exports['update']=function(_0x4d7eba,_0x58b1d8){if(_0x4d7eba[_0xbefb('0x48')]['id']){delete _0x4d7eba[_0xbefb('0x48')]['id'];}return db[_0xbefb('0x2b')][_0xbefb('0x49')]({'where':{'id':_0x4d7eba[_0xbefb('0x4a')]['id']}})[_0xbefb('0x44')](handleEntityNotFound(_0x58b1d8,null))[_0xbefb('0x44')](saveUpdates(_0x4d7eba[_0xbefb('0x48')],null))[_0xbefb('0x44')](respondWithResult(_0x58b1d8,null))[_0xbefb('0x46')](handleError(_0x58b1d8,null));};exports[_0xbefb('0x25')]=function(_0x5e7ec7,_0x2115ac){return db[_0xbefb('0x2b')][_0xbefb('0x49')]({'where':{'id':_0x5e7ec7[_0xbefb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2115ac,null))[_0xbefb('0x44')](removeEntity(_0x2115ac,null))[_0xbefb('0x46')](handleError(_0x2115ac,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 361ae8d..09eec18 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 _0x8e76=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x16e8a7,_0x37a290){var _0x4326c3=function(_0x43f31e){while(--_0x43f31e){_0x16e8a7['push'](_0x16e8a7['shift']());}};_0x4326c3(++_0x37a290);}(_0x8e76,0x17e));var _0x68e7=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x8e76[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x68e7('0x0'));var util=require(_0x68e7('0x1'));var logger=require(_0x68e7('0x2'))(_0x68e7('0x3'));var moment=require(_0x68e7('0x4'));var BPromise=require('bluebird');var rp=require(_0x68e7('0x5'));var fs=require('fs');var path=require(_0x68e7('0x6'));var rimraf=require(_0x68e7('0x7'));var config=require(_0x68e7('0x8'));var attributes=require(_0x68e7('0x9'));module[_0x68e7('0xa')]=function(_0xb784d5,_0x5e48d1){return _0xb784d5[_0x68e7('0xb')](_0x68e7('0xc'),attributes,{'tableName':_0x68e7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x68e7('0xe')});}; \ No newline at end of file +var _0xea3f=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x59d369,_0x56a533){var _0x58c3eb=function(_0x2acb03){while(--_0x2acb03){_0x59d369['push'](_0x59d369['shift']());}};_0x58c3eb(++_0x56a533);}(_0xea3f,0x12b));var _0xfea3=function(_0x3f1861,_0x7b4285){_0x3f1861=_0x3f1861-0x0;var _0x7ca70a=_0xea3f[_0x3f1861];return _0x7ca70a;};'use strict';var _=require(_0xfea3('0x0'));var util=require('util');var logger=require(_0xfea3('0x1'))(_0xfea3('0x2'));var moment=require(_0xfea3('0x3'));var BPromise=require(_0xfea3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfea3('0x5'));var rimraf=require(_0xfea3('0x6'));var config=require(_0xfea3('0x7'));var attributes=require(_0xfea3('0x8'));module[_0xfea3('0x9')]=function(_0x5698a5,_0x5f49a1){return _0x5698a5[_0xfea3('0xa')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfea3('0xb'),'collate':_0xfea3('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 338879c..e1aea6a 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 _0xf3f8=['request\x20sent','stringify','error','code','message','info','OpenchannelApplication,\x20%s,\x20%s','result','catch','OpenchannelApplication','update','body','options','where','attributes','limit','then','UpdateOpenchannelApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug'];(function(_0x214376,_0x1deff9){var _0x5f404c=function(_0x23cafb){while(--_0x23cafb){_0x214376['push'](_0x214376['shift']());}};_0x5f404c(++_0x1deff9);}(_0xf3f8,0x152));var _0x8f3f=function(_0x46dc2f,_0x5bf624){_0x46dc2f=_0x46dc2f-0x0;var _0x9460e=_0xf3f8[_0x46dc2f];return _0x9460e;};'use strict';var _=require(_0x8f3f('0x0'));var util=require(_0x8f3f('0x1'));var moment=require(_0x8f3f('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f3f('0x3'));var fs=require('fs');var Redis=require(_0x8f3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f3f('0x5'));var logger=require(_0x8f3f('0x6'))(_0x8f3f('0x7'));var config=require(_0x8f3f('0x8'));var jayson=require(_0x8f3f('0x9'));var client=jayson[_0x8f3f('0xa')][_0x8f3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a772c,_0x472ab7,_0x5ac277){return new BPromise(function(_0x4d61e9,_0x491d3d){return client[_0x8f3f('0xc')](_0x5a772c,_0x5ac277)['then'](function(_0x137a76){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x472ab7,'request\x20sent');logger[_0x8f3f('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x472ab7,_0x8f3f('0xe'),JSON[_0x8f3f('0xf')](_0x137a76));if(_0x137a76[_0x8f3f('0x10')]){if(_0x137a76[_0x8f3f('0x10')][_0x8f3f('0x11')]===0x1f4){logger[_0x8f3f('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x472ab7,_0x137a76[_0x8f3f('0x10')][_0x8f3f('0x12')]);return _0x491d3d(_0x137a76[_0x8f3f('0x10')][_0x8f3f('0x12')]);}logger[_0x8f3f('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x472ab7,_0x137a76[_0x8f3f('0x10')][_0x8f3f('0x12')]);return _0x4d61e9(_0x137a76[_0x8f3f('0x10')][_0x8f3f('0x12')]);}else{logger[_0x8f3f('0x13')](_0x8f3f('0x14'),_0x472ab7,_0x8f3f('0xe'));_0x4d61e9(_0x137a76[_0x8f3f('0x15')][_0x8f3f('0x12')]);}})[_0x8f3f('0x16')](function(_0x6f7178){logger[_0x8f3f('0x10')](_0x8f3f('0x14'),_0x472ab7,_0x6f7178);_0x491d3d(_0x6f7178);});});}exports['UpdateOpenchannelApplication']=function(_0x4154e8){var _0x131a73=this;return new Promise(function(_0x4498c5,_0x39896d){return db[_0x8f3f('0x17')][_0x8f3f('0x18')](_0x4154e8[_0x8f3f('0x19')],{'raw':_0x4154e8[_0x8f3f('0x1a')]?_0x4154e8[_0x8f3f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4154e8[_0x8f3f('0x1a')]?_0x4154e8['options'][_0x8f3f('0x1b')]||null:null,'attributes':_0x4154e8[_0x8f3f('0x1a')]?_0x4154e8[_0x8f3f('0x1a')][_0x8f3f('0x1c')]||null:null,'limit':_0x4154e8[_0x8f3f('0x1a')]?_0x4154e8['options'][_0x8f3f('0x1d')]||null:null})[_0x8f3f('0x1e')](function(_0x12e371){logger[_0x8f3f('0x13')](_0x8f3f('0x1f'),_0x4154e8);logger[_0x8f3f('0xd')](_0x8f3f('0x1f'),_0x4154e8,JSON[_0x8f3f('0xf')](_0x12e371));_0x4498c5(_0x12e371);})[_0x8f3f('0x16')](function(_0x26eb66){logger[_0x8f3f('0x10')]('UpdateOpenchannelApplication',_0x26eb66[_0x8f3f('0x12')],_0x4154e8);_0x39896d(_0x131a73[_0x8f3f('0x10')](0x1f4,_0x26eb66[_0x8f3f('0x12')]));});});}; \ No newline at end of file +var _0x4521=['jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x4521,0xe8));var _0x1452=function(_0x152fe4,_0x2ec1c8){_0x152fe4=_0x152fe4-0x0;var _0x96e9e8=_0x4521[_0x152fe4];return _0x96e9e8;};'use strict';var _=require(_0x1452('0x0'));var util=require(_0x1452('0x1'));var moment=require(_0x1452('0x2'));var BPromise=require(_0x1452('0x3'));var rs=require(_0x1452('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1452('0x5'));var logger=require('../../config/logger')(_0x1452('0x6'));var config=require(_0x1452('0x7'));var jayson=require(_0x1452('0x8'));var client=jayson[_0x1452('0x9')][_0x1452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc0454f,_0x500a51,_0x2ea365){return new BPromise(function(_0x252427,_0x1d13dc){return client['request'](_0xc0454f,_0x2ea365)[_0x1452('0xb')](function(_0x594e46){logger[_0x1452('0xc')](_0x1452('0xd'),_0x500a51,_0x1452('0xe'));logger[_0x1452('0xf')](_0x1452('0x10'),_0x500a51,_0x1452('0xe'),JSON[_0x1452('0x11')](_0x594e46));if(_0x594e46[_0x1452('0x12')]){if(_0x594e46[_0x1452('0x12')][_0x1452('0x13')]===0x1f4){logger[_0x1452('0x12')](_0x1452('0xd'),_0x500a51,_0x594e46[_0x1452('0x12')]['message']);return _0x1d13dc(_0x594e46[_0x1452('0x12')][_0x1452('0x14')]);}logger[_0x1452('0x12')](_0x1452('0xd'),_0x500a51,_0x594e46['error'][_0x1452('0x14')]);return _0x252427(_0x594e46[_0x1452('0x12')]['message']);}else{logger[_0x1452('0xc')](_0x1452('0xd'),_0x500a51,_0x1452('0xe'));_0x252427(_0x594e46[_0x1452('0x15')][_0x1452('0x14')]);}})['catch'](function(_0x392af4){logger[_0x1452('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x500a51,_0x392af4);_0x1d13dc(_0x392af4);});});}exports[_0x1452('0x16')]=function(_0x452203){var _0xc1114e=this;return new Promise(function(_0x3d6e53,_0x56a363){return db[_0x1452('0x17')][_0x1452('0x18')](_0x452203['body'],{'raw':_0x452203[_0x1452('0x19')]?_0x452203[_0x1452('0x19')][_0x1452('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x452203[_0x1452('0x19')]?_0x452203[_0x1452('0x19')]['where']||null:null,'attributes':_0x452203[_0x1452('0x19')]?_0x452203['options'][_0x1452('0x1b')]||null:null,'limit':_0x452203[_0x1452('0x19')]?_0x452203[_0x1452('0x19')][_0x1452('0x1c')]||null:null})[_0x1452('0xb')](function(_0x44b33c){logger[_0x1452('0xc')]('UpdateOpenchannelApplication',_0x452203);logger[_0x1452('0xf')]('UpdateOpenchannelApplication',_0x452203,JSON[_0x1452('0x11')](_0x44b33c));_0x3d6e53(_0x44b33c);})[_0x1452('0x1d')](function(_0x1add46){logger[_0x1452('0x12')]('UpdateOpenchannelApplication',_0x1add46['message'],_0x452203);_0x56a363(_0xc1114e[_0x1452('0x12')](0x1f4,_0x1add46[_0x1452('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index fe817ef..a82b761 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 _0x0305=['update','openchannelinteraction:destroy','delete','removeTags','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0x0305,0x19a));var _0x5030=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x0305[_0x424a9a];return _0xa7831c;};'use strict';var multer=require(_0x5030('0x0'));var util=require(_0x5030('0x1'));var path=require('path');var timeout=require(_0x5030('0x2'));var express=require('express');var router=express[_0x5030('0x3')]();var fs_extra=require(_0x5030('0x4'));var auth=require(_0x5030('0x5'));var interaction=require(_0x5030('0x6'));var config=require(_0x5030('0x7'));var controller=require(_0x5030('0x8'));router[_0x5030('0x9')]('/',auth[_0x5030('0xa')](),controller[_0x5030('0xb')]);router[_0x5030('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x5030('0xc'),auth[_0x5030('0xa')](),controller[_0x5030('0xd')]);router[_0x5030('0x9')](_0x5030('0xe'),auth['isAuthenticated'](),controller[_0x5030('0xf')]);router[_0x5030('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x5030('0x10')]);router[_0x5030('0x11')]('/',auth[_0x5030('0xa')](),controller[_0x5030('0x12')]);router['post'](_0x5030('0xe'),auth[_0x5030('0xa')](),controller['addMessage']);router[_0x5030('0x11')](_0x5030('0x13'),auth[_0x5030('0xa')](),interaction[_0x5030('0x14')](_0x5030('0x15'),_0x5030('0x16')),controller[_0x5030('0x17')]);router[_0x5030('0x18')](_0x5030('0xc'),auth[_0x5030('0xa')](),interaction[_0x5030('0x14')](_0x5030('0x15'),'openchannelinteraction:update'),controller[_0x5030('0x19')]);router['delete'](_0x5030('0xc'),auth[_0x5030('0xa')](),interaction[_0x5030('0x14')]('openchannel',_0x5030('0x1a')),controller['destroy']);router[_0x5030('0x1b')](_0x5030('0x13'),auth[_0x5030('0xa')](),controller[_0x5030('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb0d0=['/:id/download','download','post','openchannel','openchannelinteraction:addtags','addTags','put','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages'];(function(_0xfb534f,_0x1ea5e7){var _0x3c42eb=function(_0x1aaa07){while(--_0x1aaa07){_0xfb534f['push'](_0xfb534f['shift']());}};_0x3c42eb(++_0x1ea5e7);}(_0xb0d0,0x1dd));var _0x0b0d=function(_0x4e2e85,_0x39b421){_0x4e2e85=_0x4e2e85-0x0;var _0x5978b5=_0xb0d0[_0x4e2e85];return _0x5978b5;};'use strict';var multer=require(_0x0b0d('0x0'));var util=require(_0x0b0d('0x1'));var path=require('path');var timeout=require(_0x0b0d('0x2'));var express=require(_0x0b0d('0x3'));var router=express[_0x0b0d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0b0d('0x5'));var interaction=require(_0x0b0d('0x6'));var config=require('../../config/environment');var controller=require(_0x0b0d('0x7'));router[_0x0b0d('0x8')]('/',auth[_0x0b0d('0x9')](),controller[_0x0b0d('0xa')]);router[_0x0b0d('0x8')](_0x0b0d('0xb'),auth[_0x0b0d('0x9')](),controller['describe']);router[_0x0b0d('0x8')](_0x0b0d('0xc'),auth[_0x0b0d('0x9')](),controller[_0x0b0d('0xd')]);router['get'](_0x0b0d('0xe'),auth[_0x0b0d('0x9')](),controller[_0x0b0d('0xf')]);router[_0x0b0d('0x8')](_0x0b0d('0x10'),auth[_0x0b0d('0x9')](),controller[_0x0b0d('0x11')]);router[_0x0b0d('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0b0d('0x12')](_0x0b0d('0xe'),auth[_0x0b0d('0x9')](),controller['addMessage']);router[_0x0b0d('0x12')]('/:id/tags',auth[_0x0b0d('0x9')](),interaction['tracked'](_0x0b0d('0x13'),_0x0b0d('0x14')),controller[_0x0b0d('0x15')]);router[_0x0b0d('0x16')]('/:id',auth[_0x0b0d('0x9')](),interaction['tracked'](_0x0b0d('0x13'),'openchannelinteraction:update'),controller['update']);router[_0x0b0d('0x17')](_0x0b0d('0xc'),auth[_0x0b0d('0x9')](),interaction['tracked'](_0x0b0d('0x13'),_0x0b0d('0x18')),controller[_0x0b0d('0x19')]);router[_0x0b0d('0x17')](_0x0b0d('0x1a'),auth['isAuthenticated'](),controller[_0x0b0d('0x1b')]);module[_0x0b0d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ee4917f..29fb56c 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 _0x4f88=['STRING','ENUM','out','sequelize','exports','DATE'];(function(_0x37f91a,_0x5a22d6){var _0x33fb6c=function(_0x5cab2b){while(--_0x5cab2b){_0x37f91a['push'](_0x37f91a['shift']());}};_0x33fb6c(++_0x5a22d6);}(_0x4f88,0xf3));var _0x84f8=function(_0x440917,_0x20ea7b){_0x440917=_0x440917-0x0;var _0x5e906b=_0x4f88[_0x440917];return _0x5e906b;};'use strict';var Sequelize=require(_0x84f8('0x0'));module[_0x84f8('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x84f8('0x2')]},'disposition':{'type':Sequelize[_0x84f8('0x3')]},'secondDisposition':{'type':Sequelize[_0x84f8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x84f8('0x2')]},'threadId':{'type':Sequelize[_0x84f8('0x3')]},'externalUrl':{'type':Sequelize[_0x84f8('0x3')]},'lastMsgAt':{'type':Sequelize[_0x84f8('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x84f8('0x4')]('in',_0x84f8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x84f8('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x84f8('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2285=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x3b2331,_0x4c14b8){var _0x9975b3=function(_0x54dc76){while(--_0x54dc76){_0x3b2331['push'](_0x3b2331['shift']());}};_0x9975b3(++_0x4c14b8);}(_0x2285,0x177));var _0x5228=function(_0x18aad7,_0x35b12c){_0x18aad7=_0x18aad7-0x0;var _0x99611=_0x2285[_0x18aad7];return _0x99611;};'use strict';var Sequelize=require('sequelize');module[_0x5228('0x0')]={'closed':{'type':Sequelize[_0x5228('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5228('0x2')]},'disposition':{'type':Sequelize[_0x5228('0x3')]},'secondDisposition':{'type':Sequelize[_0x5228('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5228('0x3')]},'read1stAt':{'type':Sequelize[_0x5228('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x5228('0x3')]},'lastMsgAt':{'type':Sequelize[_0x5228('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5228('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x5228('0x4')]('in',_0x5228('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5228('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x5228('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7ec2cac..7f6bf50 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 _0x752f=['update','then','destroy','error','stack','name','map','OpenchannelInteraction','fieldName','getOptions','query','user','catch','show','type','from','params','model','keys','rawAttributes','filters','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','OpenchannelMessage','intersection','hasOwnProperty','order','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','tmp','root','files','transcript-%d-%s.zip','User','fullname','lastName','push','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','renderFile','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x57411a,_0x59328f){var _0xd487ba=function(_0x2fb456){while(--_0x2fb456){_0x57411a['push'](_0x57411a['shift']());}};_0xd487ba(++_0x59328f);}(_0x752f,0x1ea));var _0xf752=function(_0x148e75,_0x2752f1){_0x148e75=_0x148e75-0x0;var _0x378bde=_0x752f[_0x148e75];return _0x378bde;};'use strict';var rimraf=require(_0xf752('0x0'));var zipdir=require(_0xf752('0x1'));var moment=require(_0xf752('0x2'));var util=require(_0xf752('0x3'));var path=require(_0xf752('0x4'));var ejs=require(_0xf752('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xf752('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xf752('0x7'));var pdf=require(_0xf752('0x8'));var logger=require(_0xf752('0x9'))(_0xf752('0xa'));var config=require('../../config/environment');var db=require(_0xf752('0xb'))['db'];config[_0xf752('0xc')]=_[_0xf752('0xd')](config[_0xf752('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf752('0xe'))(new Redis(config[_0xf752('0xc')]));require(_0xf752('0xf'))['register'](socket);function respondWithStatusCode(_0x571df6,_0x2bea59){_0x2bea59=_0x2bea59||0xcc;return function(_0x2a4036){if(_0x2a4036){return _0x571df6[_0xf752('0x10')](_0x2bea59);}return _0x571df6['status'](_0x2bea59)[_0xf752('0x11')]();};}function respondWithResult(_0x143583,_0x51b183){_0x51b183=_0x51b183||0xc8;return function(_0x4b98dd){if(_0x4b98dd){return _0x143583[_0xf752('0x12')](_0x51b183)[_0xf752('0x13')](_0x4b98dd);}};}function respondWithFilteredResult(_0x3c06bb,_0x414737){return function(_0x4fafc9){if(_0x4fafc9){var _0x16bafd=typeof _0x414737[_0xf752('0x14')]===_0xf752('0x15')&&typeof _0x414737[_0xf752('0x16')]==='undefined';var _0x298539=_0x4fafc9[_0xf752('0x17')];var _0x2947de=_0x16bafd?0x0:_0x414737[_0xf752('0x14')];var _0x10bcec=_0x16bafd?_0x4fafc9[_0xf752('0x17')]:_0x414737[_0xf752('0x14')]+_0x414737['limit'];var _0x283abd;if(_0x10bcec>=_0x298539){_0x10bcec=_0x298539;_0x283abd=0xc8;}else{_0x283abd=0xce;}_0x3c06bb[_0xf752('0x12')](_0x283abd);return _0x3c06bb[_0xf752('0x18')](_0xf752('0x19'),_0x2947de+'-'+_0x10bcec+'/'+_0x298539)[_0xf752('0x13')](_0x4fafc9);}return null;};}function saveUpdates(_0x3fb969){return function(_0xe7c20a){if(_0xe7c20a){return _0xe7c20a[_0xf752('0x1a')](_0x3fb969)[_0xf752('0x1b')](function(_0x24b837){return _0x24b837;});}return null;};}function removeEntity(_0x505c52){return function(_0x36d77b){if(_0x36d77b){return _0x36d77b[_0xf752('0x1c')]()['then'](function(){_0x505c52[_0xf752('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e1a25){return function(_0x19dea5){if(!_0x19dea5){_0x5e1a25[_0xf752('0x10')](0x194);}return _0x19dea5;};}function handleError(_0x39b997,_0x4bd284){_0x4bd284=_0x4bd284||0x1f4;return function(_0x2db7b7){logger[_0xf752('0x1d')](_0x2db7b7[_0xf752('0x1e')]);if(_0x2db7b7['name']){delete _0x2db7b7[_0xf752('0x1f')];}_0x39b997[_0xf752('0x12')](_0x4bd284)['send'](_0x2db7b7);};}exports['index']=function(_0x4ef063,_0x549736){var _0x2b2e68={};var _0x3ebc0a=_[_0xf752('0x20')](db[_0xf752('0x21')]['rawAttributes'],function(_0x1672e7){return{'name':_0x1672e7[_0xf752('0x22')],'type':_0x1672e7['type']['key']};});_0x2b2e68=qs[_0xf752('0x23')](_0x3ebc0a,_0x4ef063);return interaction['findAll']('openchannel',_0x4ef063[_0xf752('0x24')],_0x4ef063[_0xf752('0x25')],_0x2b2e68,_0x3ebc0a)[_0xf752('0x1b')](respondWithFilteredResult(_0x549736,_0x2b2e68))[_0xf752('0x26')](handleError(_0x549736,null));};exports[_0xf752('0x27')]=function(_0x46e8de,_0x41c618){var _0x47fe60={};if(_0x46e8de['query'][_0xf752('0x28')]&&_0x46e8de[_0xf752('0x24')]['type']===_0xf752('0x29')){_0x47fe60[_0xf752('0x29')]=_0x46e8de[_0xf752('0x2a')]['id'];}else{_0x47fe60['id']=_0x46e8de[_0xf752('0x2a')]['id'];}var _0x237e76={'raw':![],'where':_0x47fe60},_0x1a3260={};_0x1a3260[_0xf752('0x2b')]=_[_0xf752('0x2c')](db[_0xf752('0x21')][_0xf752('0x2d')]);_0x1a3260[_0xf752('0x24')]=_[_0xf752('0x2c')](_0x46e8de[_0xf752('0x24')]);_0x1a3260[_0xf752('0x2e')]=_['intersection'](_0x1a3260[_0xf752('0x2b')],_0x1a3260['query']);_0x237e76['attributes']=_['intersection'](_0x1a3260[_0xf752('0x2b')],qs[_0xf752('0x2f')](_0x46e8de[_0xf752('0x24')]['fields']));_0x237e76[_0xf752('0x30')]=_0x237e76['attributes'][_0xf752('0x31')]?_0x237e76['attributes']:_0x1a3260[_0xf752('0x2b')];if(_0x46e8de['query'][_0xf752('0x32')]){_0x237e76[_0xf752('0x33')]=[{'all':!![]}];}_0x237e76=_[_0xf752('0x34')]({},_0x237e76,_0x46e8de[_0xf752('0x35')]);return db['OpenchannelInteraction'][_0xf752('0x36')](_0x237e76)['then'](handleEntityNotFound(_0x41c618,null))[_0xf752('0x1b')](respondWithResult(_0x41c618,null))[_0xf752('0x26')](handleError(_0x41c618,null));};exports['create']=function(_0x24ced5,_0x5bdc5d){return db[_0xf752('0x21')][_0xf752('0x37')](_0x24ced5['body'],{})[_0xf752('0x1b')](respondWithResult(_0x5bdc5d,0xc9))[_0xf752('0x26')](handleError(_0x5bdc5d,null));};exports[_0xf752('0x1a')]=function(_0x8623d,_0x340e19){if(_0x8623d[_0xf752('0x38')]['id']){delete _0x8623d['body']['id'];}return db[_0xf752('0x21')]['find']({'where':{'id':_0x8623d[_0xf752('0x2a')]['id']}})['then'](handleEntityNotFound(_0x340e19,null))[_0xf752('0x1b')](saveUpdates(_0x8623d['body'],null))[_0xf752('0x1b')](respondWithResult(_0x340e19,null))[_0xf752('0x26')](handleError(_0x340e19,null));};exports[_0xf752('0x1c')]=function(_0x2a991c,_0x5ae4ed){return db[_0xf752('0x21')][_0xf752('0x36')]({'where':{'id':_0x2a991c[_0xf752('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5ae4ed,null))[_0xf752('0x1b')](removeEntity(_0x5ae4ed,null))[_0xf752('0x26')](handleError(_0x5ae4ed,null));};exports[_0xf752('0x39')]=function(_0x2105d1,_0x2aac08){return db['OpenchannelInteraction'][_0xf752('0x39')]()[_0xf752('0x1b')](respondWithResult(_0x2aac08,null))[_0xf752('0x26')](handleError(_0x2aac08,null));};exports[_0xf752('0x3a')]=function(_0x6f928f,_0x2c201b){return db['OpenchannelMessage'][_0xf752('0x36')]({'where':{'id':_0x6f928f['params']['id']}})['then'](handleEntityNotFound(_0x2c201b,null))[_0xf752('0x1b')](function(_0x1dd435){if(_0x1dd435){return _0x1dd435[_0xf752('0x3a')](_0x6f928f[_0xf752('0x38')][_0xf752('0x3b')],_[_0xf752('0x3c')](_0x6f928f['body'],[_0xf752('0x3b'),'id'])||{});}})[_0xf752('0x1b')](respondWithResult(_0x2c201b,null))[_0xf752('0x26')](handleError(_0x2c201b,null));};exports[_0xf752('0x3d')]=function(_0x23c4fc,_0x862a79){var _0xd529b9={'raw':![],'where':{}};var _0x5dfe8e={};var _0x187fb1={'count':0x0,'rows':[]};return db[_0xf752('0x21')]['findOne']({'where':{'id':_0x23c4fc[_0xf752('0x2a')]['id']}})[_0xf752('0x1b')](handleEntityNotFound(_0x862a79,null))[_0xf752('0x1b')](function(_0x23b370){if(_0x23b370){_0x5dfe8e[_0xf752('0x2b')]=_[_0xf752('0x2c')](db[_0xf752('0x3e')][_0xf752('0x2d')]);_0x5dfe8e[_0xf752('0x24')]=_[_0xf752('0x2c')](_0x23c4fc[_0xf752('0x24')]);_0x5dfe8e[_0xf752('0x2e')]=_['intersection'](_0x5dfe8e[_0xf752('0x2b')],_0x5dfe8e[_0xf752('0x24')]);_0xd529b9[_0xf752('0x30')]=_[_0xf752('0x3f')](_0x5dfe8e[_0xf752('0x2b')],qs[_0xf752('0x2f')](_0x23c4fc[_0xf752('0x24')][_0xf752('0x2f')]));_0xd529b9['attributes']=_0xd529b9[_0xf752('0x30')][_0xf752('0x31')]?_0xd529b9[_0xf752('0x30')]:_0x5dfe8e[_0xf752('0x2b')];if(!_0x23c4fc[_0xf752('0x24')][_0xf752('0x40')]('nolimit')){_0xd529b9[_0xf752('0x16')]=qs[_0xf752('0x16')](_0x23c4fc[_0xf752('0x24')][_0xf752('0x16')]);_0xd529b9[_0xf752('0x14')]=qs[_0xf752('0x14')](_0x23c4fc[_0xf752('0x24')][_0xf752('0x14')]);}_0xd529b9[_0xf752('0x41')]=qs['sort'](_0x23c4fc[_0xf752('0x24')][_0xf752('0x42')]);_0xd529b9['where']=qs[_0xf752('0x2e')](_['pick'](_0x23c4fc['query'],_0x5dfe8e[_0xf752('0x2e')]));_0xd529b9[_0xf752('0x43')][_0xf752('0x44')]=_0x23b370['id'];if(_0x23c4fc[_0xf752('0x24')][_0xf752('0x45')]){_0xd529b9[_0xf752('0x43')]=_[_0xf752('0x34')](_0xd529b9['where'],{'$or':_[_0xf752('0x20')](_0xd529b9[_0xf752('0x30')],function(_0x54272b){var _0x4546ab={};_0x4546ab[_0x54272b]={'$like':'%'+_0x23c4fc[_0xf752('0x24')][_0xf752('0x45')]+'%'};return _0x4546ab;})});}if(_0x23c4fc[_0xf752('0x24')][_0xf752('0x46')]){var _0x4d80b3=_0x23c4fc['query'][_0xf752('0x46')][_0xf752('0x47')](',');var _0x3afd0a={};_0x3afd0a[_0x4d80b3[0x0]]={'$gte':moment(_0x4d80b3[0x1])[_0xf752('0x48')](_0xf752('0x49'))};_0xd529b9['where']=_['merge'](_0xd529b9[_0xf752('0x43')],_0x3afd0a);}_0xd529b9=_[_0xf752('0x34')]({},_0xd529b9,_0x23c4fc['options']);return db['OpenchannelMessage'][_0xf752('0x17')]({'where':_0xd529b9[_0xf752('0x43')]})[_0xf752('0x1b')](function(_0x46f878){_0x187fb1[_0xf752('0x17')]=_0x46f878;if(_0x23c4fc[_0xf752('0x24')]['includeAll']){_0xd529b9[_0xf752('0x33')]=[{'all':!![]}];}return db[_0xf752('0x3e')][_0xf752('0x4a')](_0xd529b9);})[_0xf752('0x1b')](function(_0x5e07e4){_0x187fb1[_0xf752('0x4b')]=_0x5e07e4;return _0x187fb1;});}})['then'](respondWithFilteredResult(_0x862a79,_0xd529b9))['catch'](handleError(_0x862a79,null));};exports[_0xf752('0x4c')]=function(_0x25d400,_0x29e0b7){return db[_0xf752('0x21')][_0xf752('0x36')]({'where':{'id':_0x25d400[_0xf752('0x2a')]['id']}})['then'](handleEntityNotFound(_0x29e0b7,null))[_0xf752('0x1b')](function(_0x47315c){if(_0x47315c){return _0x47315c['setTags'](_0x25d400[_0xf752('0x38')]['ids'],_[_0xf752('0x3c')](_0x25d400[_0xf752('0x38')],[_0xf752('0x3b'),'id'])||{})[_0xf752('0x4d')](function(){return db[_0xf752('0x4e')]['findAll']({'attributes':['id',_0xf752('0x1f'),_0xf752('0x4f')],'where':{'id':_0x25d400['body'][_0xf752('0x3b')]}});})[_0xf752('0x1b')](function(_0x5d6b58){socket[_0xf752('0x50')](_0xf752('0x51'),{'id':Number(_0x25d400[_0xf752('0x2a')]['id']),'tags':_0x5d6b58||[]});return{'id':Number(_0x25d400[_0xf752('0x2a')]['id']),'tags':_0x5d6b58||[]};});}})[_0xf752('0x1b')](respondWithResult(_0x29e0b7,null))[_0xf752('0x26')](handleError(_0x29e0b7,null));};exports[_0xf752('0x52')]=function(_0x57c16c,_0x31a80e){return db[_0xf752('0x21')][_0xf752('0x36')]({'where':{'id':_0x57c16c['params']['id']}})['then'](handleEntityNotFound(_0x31a80e,null))['then'](function(_0x3db637){if(_0x3db637){return _0x3db637['removeTags'](_0x57c16c[_0xf752('0x24')]['ids']);}})[_0xf752('0x1b')](respondWithStatusCode(_0x31a80e,null))[_0xf752('0x26')](handleError(_0x31a80e,null));};exports[_0xf752('0x53')]=function(_0xf713c5,_0x53e605){var _0x320d39=moment()[_0xf752('0x54')]()[_0xf752('0x55')]();var _0x3609cc=path[_0xf752('0x56')](config['root'],_0xf752('0x57'),'files',_0xf752('0x58'));var _0x38a3f8=path[_0xf752('0x56')](config[_0xf752('0x59')],_0xf752('0x57'),_0xf752('0x5a'),'attachments');var _0xe99d50=path[_0xf752('0x56')](_0x3609cc,_0x320d39);var _0x511bfd=util[_0xf752('0x48')](_0xf752('0x5b'),_0xf713c5['params']['id'],_0x320d39);var _0x145bd5=path[_0xf752('0x56')](_0x3609cc,_0x511bfd);var _0xbc928e=[];_0xbc928e['push']({'model':db[_0xf752('0x5c')],'as':_0xf752('0x5c'),'attributes':['id',_0xf752('0x5d')],'raw':!![]});_0xbc928e['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xf752('0x5e')],'raw':!![]});if(_0xf713c5[_0xf752('0x24')]['attachments']){_0xbc928e[_0xf752('0x5f')]({'model':db[_0xf752('0x60')],'as':'Attachment','raw':!![]});}var _0x3f9d7e=[{'model':db[_0xf752('0x3e')],'as':_0xf752('0x61'),'attributes':['id',_0xf752('0x38'),_0xf752('0x62'),_0xf752('0x63'),_0xf752('0x64'),_0xf752('0x65')],'include':_0xbc928e}];_0x3f9d7e['push']({'model':db[_0xf752('0x66')],'as':_0xf752('0x67'),'attributes':['id','name']});_0x3f9d7e['push']({'model':db[_0xf752('0x5c')],'as':'Owner','attributes':['id',_0xf752('0x5d')]});return db[_0xf752('0x21')]['find']({'where':{'id':_0xf713c5[_0xf752('0x2a')]['id']},'include':_0x3f9d7e})[_0xf752('0x1b')](handleEntityNotFound(_0x53e605,null))[_0xf752('0x1b')](function(_0x247ea0){if(_0x247ea0){var _0xc02319=_0x247ea0[_0xf752('0x68')]({'plain':!![]});fs[_0xf752('0x69')](_0xe99d50);var _0x480e84={'channel':_0xf752('0x6a'),'account':_0xc02319[_0xf752('0x67')][_0xf752('0x1f')],'agent':_0xc02319['Owner']?_0xc02319[_0xf752('0x6b')][_0xf752('0x5d')]:_0xf752('0x6c'),'createdAt':moment(_0xc02319[_0xf752('0x62')])['format'](_0xf752('0x49'))['toString'](),'closedAt':_0xc02319[_0xf752('0x6d')]?moment(_0xc02319[_0xf752('0x6e')])[_0xf752('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf752('0x55')]():'','disposition':_0xc02319['disposition'],'visibility':_0xc02319[_0xf752('0x6f')]?_0xf752('0x70'):_0xf752('0x71'),'messages':_(_0xc02319[_0xf752('0x61')])[_0xf752('0x45')]({'secret':![]})[_0xf752('0x20')](function(_0x1a3220){if(_0x1a3220[_0xf752('0x60')]){var _0x292a4b=path['join'](_0x38a3f8,_0x1a3220[_0xf752('0x60')][_0xf752('0x72')]);if(fs[_0xf752('0x73')](_0x292a4b)){fs[_0xf752('0x74')](_0x292a4b)[_0xf752('0x75')](fs[_0xf752('0x76')](path[_0xf752('0x56')](_0xe99d50,_0x1a3220[_0xf752('0x60')][_0xf752('0x72')])));}}return{'date':moment(_0x1a3220[_0xf752('0x62')])[_0xf752('0x48')](_0xf752('0x49'))[_0xf752('0x55')](),'sender':_0x1a3220[_0xf752('0x63')]===_0xf752('0x77')?_0x1a3220[_0xf752('0x5c')]?_0x1a3220[_0xf752('0x5c')][_0xf752('0x5d')]:_0xf752('0x78'):_0x1a3220[_0xf752('0x79')]['firstName']+(_0x1a3220[_0xf752('0x79')][_0xf752('0x5e')]?'\x20'+_0x1a3220['Contact'][_0xf752('0x5e')]:''),'body':_0x1a3220[_0xf752('0x60')]?_0x1a3220[_0xf752('0x60')][_0xf752('0x72')]:_0x1a3220[_0xf752('0x38')],'direction':_0x1a3220[_0xf752('0x63')]===_0xf752('0x77')?'A':'C','secret':_0x1a3220[_0xf752('0x64')],'read':_0x1a3220[_0xf752('0x65')],'attachment':_0x1a3220[_0xf752('0x60')]};})['value']()};return ejs[_0xf752('0x7a')](path[_0xf752('0x56')](config[_0xf752('0x59')],_0xf752('0x57'),_0xf752('0x7b'),'downloadInteraction.ejs'),{'interaction':_0x480e84})[_0xf752('0x1b')](function(_0x1cbf54){var _0x1bf9dd=path[_0xf752('0x56')](_0xe99d50,_0xf752('0x7c')+_0xc02319['id']+'-'+_0x320d39+_0xf752('0x7d'));var _0x52ac65={'path':_0x1bf9dd,'channel':_0xf752('0x6a'),'interactionId':_0xc02319['id']};return pdf[_0xf752('0x7e')](_0x1cbf54,_0x52ac65);})[_0xf752('0x1b')](function(){return new Promise(function(_0x342879,_0x39466e){zipdir(_0xe99d50,{'saveTo':_0x145bd5},function(_0x19b056,_0x440ee7){if(_0x19b056)return _0x39466e(_0x19b056);return _0x342879(_0x440ee7);});})['then'](function(){return new Promise(function(_0x266e4e,_0x5cd908){rimraf(_0xe99d50,function(_0x4cfb5a){if(_0x4cfb5a)_0x5cd908(_0x4cfb5a);return _0x266e4e();});});})['then'](function(){return _0x53e605[_0xf752('0x53')](_0x145bd5,_0x511bfd,function(_0x167f73){if(_0x167f73){logger[_0xf752('0x1d')](_0xf752('0x7f'),_0x167f73);}else{fs[_0xf752('0x80')](_0x145bd5);}});});});}else{return _0x53e605[_0xf752('0x10')](0xc8);}})[_0xf752('0x26')](handleError(_0x53e605,null));}; \ No newline at end of file +var _0x4745=['find','catch','create','body','describe','addMessage','ids','omit','getMessages','intersection','hasOwnProperty','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','OpenchannelMessage','findAll','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','toString','root','server','tmp','join','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','direction','secret','read','OpenchannelAccount','Account','Openchannel','Owner','createdAt','closed','closedAt','threadId','Public','Private','Messages','basename','createReadStream','pipe','createWriteStream','out','System','views','downloadInteraction.ejs','transcript-','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','type','getOptions','openchannel','query','user','show','from','params','model','keys','rawAttributes','filters','attributes','fields','length','include','merge','options'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4745,0x1cd));var _0x5474=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x4745[_0xea8947];return _0x2455e9;};'use strict';var rimraf=require(_0x5474('0x0'));var zipdir=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var util=require(_0x5474('0x3'));var path=require(_0x5474('0x4'));var ejs=require(_0x5474('0x5'));var fs=require('fs');var _=require(_0x5474('0x6'));var Redis=require(_0x5474('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x5474('0x8'));var pdf=require(_0x5474('0x9'));var logger=require(_0x5474('0xa'))(_0x5474('0xb'));var config=require('../../config/environment');var db=require(_0x5474('0xc'))['db'];config[_0x5474('0xd')]=_['defaults'](config['redis'],{'host':_0x5474('0xe'),'port':0x18eb});var socket=require(_0x5474('0xf'))(new Redis(config[_0x5474('0xd')]));require(_0x5474('0x10'))[_0x5474('0x11')](socket);function respondWithStatusCode(_0x1f5515,_0x21c826){_0x21c826=_0x21c826||0xcc;return function(_0x18673c){if(_0x18673c){return _0x1f5515[_0x5474('0x12')](_0x21c826);}return _0x1f5515[_0x5474('0x13')](_0x21c826)[_0x5474('0x14')]();};}function respondWithResult(_0x53596d,_0x54dac0){_0x54dac0=_0x54dac0||0xc8;return function(_0x1815e6){if(_0x1815e6){return _0x53596d[_0x5474('0x13')](_0x54dac0)[_0x5474('0x15')](_0x1815e6);}};}function respondWithFilteredResult(_0x23fdeb,_0x3d9e1f){return function(_0x288874){if(_0x288874){var _0x2a4d80=typeof _0x3d9e1f[_0x5474('0x16')]==='undefined'&&typeof _0x3d9e1f[_0x5474('0x17')]===_0x5474('0x18');var _0x276fd4=_0x288874[_0x5474('0x19')];var _0x5849be=_0x2a4d80?0x0:_0x3d9e1f[_0x5474('0x16')];var _0x31dc8f=_0x2a4d80?_0x288874[_0x5474('0x19')]:_0x3d9e1f[_0x5474('0x16')]+_0x3d9e1f['limit'];var _0x207056;if(_0x31dc8f>=_0x276fd4){_0x31dc8f=_0x276fd4;_0x207056=0xc8;}else{_0x207056=0xce;}_0x23fdeb[_0x5474('0x13')](_0x207056);return _0x23fdeb[_0x5474('0x1a')]('Content-Range',_0x5849be+'-'+_0x31dc8f+'/'+_0x276fd4)[_0x5474('0x15')](_0x288874);}return null;};}function saveUpdates(_0x4e01cc){return function(_0x244b1d){if(_0x244b1d){return _0x244b1d[_0x5474('0x1b')](_0x4e01cc)[_0x5474('0x1c')](function(_0x208ada){return _0x208ada;});}return null;};}function removeEntity(_0x1a2582){return function(_0x51e3c1){if(_0x51e3c1){return _0x51e3c1[_0x5474('0x1d')]()[_0x5474('0x1c')](function(){_0x1a2582[_0x5474('0x13')](0xcc)[_0x5474('0x14')]();});}};}function handleEntityNotFound(_0x378af0){return function(_0x49e29f){if(!_0x49e29f){_0x378af0[_0x5474('0x12')](0x194);}return _0x49e29f;};}function handleError(_0x341d16,_0x14b8b8){_0x14b8b8=_0x14b8b8||0x1f4;return function(_0x362a7d){logger[_0x5474('0x1e')](_0x362a7d[_0x5474('0x1f')]);if(_0x362a7d[_0x5474('0x20')]){delete _0x362a7d[_0x5474('0x20')];}_0x341d16[_0x5474('0x13')](_0x14b8b8)[_0x5474('0x21')](_0x362a7d);};}exports[_0x5474('0x22')]=function(_0x497023,_0x1683a6){var _0x2693f2={};var _0x8b3f5a=_[_0x5474('0x23')](db[_0x5474('0x24')]['rawAttributes'],function(_0x3224ff){return{'name':_0x3224ff['fieldName'],'type':_0x3224ff[_0x5474('0x25')]['key']};});_0x2693f2=qs[_0x5474('0x26')](_0x8b3f5a,_0x497023);return interaction['findAll'](_0x5474('0x27'),_0x497023[_0x5474('0x28')],_0x497023[_0x5474('0x29')],_0x2693f2,_0x8b3f5a)[_0x5474('0x1c')](respondWithFilteredResult(_0x1683a6,_0x2693f2))['catch'](handleError(_0x1683a6,null));};exports[_0x5474('0x2a')]=function(_0x6572af,_0x55e443){var _0x569cfb={};if(_0x6572af[_0x5474('0x28')][_0x5474('0x25')]&&_0x6572af['query']['type']===_0x5474('0x2b')){_0x569cfb[_0x5474('0x2b')]=_0x6572af['params']['id'];}else{_0x569cfb['id']=_0x6572af[_0x5474('0x2c')]['id'];}var _0x56395c={'raw':![],'where':_0x569cfb},_0x349d48={};_0x349d48[_0x5474('0x2d')]=_[_0x5474('0x2e')](db[_0x5474('0x24')][_0x5474('0x2f')]);_0x349d48[_0x5474('0x28')]=_['keys'](_0x6572af[_0x5474('0x28')]);_0x349d48[_0x5474('0x30')]=_['intersection'](_0x349d48[_0x5474('0x2d')],_0x349d48[_0x5474('0x28')]);_0x56395c[_0x5474('0x31')]=_['intersection'](_0x349d48[_0x5474('0x2d')],qs[_0x5474('0x32')](_0x6572af[_0x5474('0x28')][_0x5474('0x32')]));_0x56395c['attributes']=_0x56395c[_0x5474('0x31')][_0x5474('0x33')]?_0x56395c[_0x5474('0x31')]:_0x349d48['model'];if(_0x6572af[_0x5474('0x28')]['includeAll']){_0x56395c[_0x5474('0x34')]=[{'all':!![]}];}_0x56395c=_[_0x5474('0x35')]({},_0x56395c,_0x6572af[_0x5474('0x36')]);return db['OpenchannelInteraction'][_0x5474('0x37')](_0x56395c)[_0x5474('0x1c')](handleEntityNotFound(_0x55e443,null))[_0x5474('0x1c')](respondWithResult(_0x55e443,null))[_0x5474('0x38')](handleError(_0x55e443,null));};exports[_0x5474('0x39')]=function(_0x2e125b,_0x2f3307){return db[_0x5474('0x24')][_0x5474('0x39')](_0x2e125b['body'],{})[_0x5474('0x1c')](respondWithResult(_0x2f3307,0xc9))[_0x5474('0x38')](handleError(_0x2f3307,null));};exports[_0x5474('0x1b')]=function(_0x21ed98,_0x351f23){if(_0x21ed98[_0x5474('0x3a')]['id']){delete _0x21ed98[_0x5474('0x3a')]['id'];}return db[_0x5474('0x24')]['find']({'where':{'id':_0x21ed98[_0x5474('0x2c')]['id']}})[_0x5474('0x1c')](handleEntityNotFound(_0x351f23,null))['then'](saveUpdates(_0x21ed98[_0x5474('0x3a')],null))[_0x5474('0x1c')](respondWithResult(_0x351f23,null))[_0x5474('0x38')](handleError(_0x351f23,null));};exports[_0x5474('0x1d')]=function(_0xa1b0ea,_0x5ee0a0){return db[_0x5474('0x24')][_0x5474('0x37')]({'where':{'id':_0xa1b0ea[_0x5474('0x2c')]['id']}})[_0x5474('0x1c')](handleEntityNotFound(_0x5ee0a0,null))[_0x5474('0x1c')](removeEntity(_0x5ee0a0,null))['catch'](handleError(_0x5ee0a0,null));};exports[_0x5474('0x3b')]=function(_0x1dced5,_0x423ede){return db[_0x5474('0x24')][_0x5474('0x3b')]()[_0x5474('0x1c')](respondWithResult(_0x423ede,null))['catch'](handleError(_0x423ede,null));};exports[_0x5474('0x3c')]=function(_0x5893f5,_0x3ef0dc){return db['OpenchannelMessage']['find']({'where':{'id':_0x5893f5[_0x5474('0x2c')]['id']}})[_0x5474('0x1c')](handleEntityNotFound(_0x3ef0dc,null))[_0x5474('0x1c')](function(_0x503652){if(_0x503652){return _0x503652['addMessage'](_0x5893f5[_0x5474('0x3a')][_0x5474('0x3d')],_[_0x5474('0x3e')](_0x5893f5['body'],[_0x5474('0x3d'),'id'])||{});}})[_0x5474('0x1c')](respondWithResult(_0x3ef0dc,null))[_0x5474('0x38')](handleError(_0x3ef0dc,null));};exports[_0x5474('0x3f')]=function(_0x250c99,_0x113fb5){var _0x31ceed={'raw':![],'where':{}};var _0x20f167={};var _0x45fab6={'count':0x0,'rows':[]};return db[_0x5474('0x24')]['findOne']({'where':{'id':_0x250c99[_0x5474('0x2c')]['id']}})[_0x5474('0x1c')](handleEntityNotFound(_0x113fb5,null))[_0x5474('0x1c')](function(_0x2a9f9a){if(_0x2a9f9a){_0x20f167['model']=_[_0x5474('0x2e')](db['OpenchannelMessage'][_0x5474('0x2f')]);_0x20f167['query']=_[_0x5474('0x2e')](_0x250c99[_0x5474('0x28')]);_0x20f167[_0x5474('0x30')]=_['intersection'](_0x20f167[_0x5474('0x2d')],_0x20f167['query']);_0x31ceed['attributes']=_[_0x5474('0x40')](_0x20f167[_0x5474('0x2d')],qs[_0x5474('0x32')](_0x250c99[_0x5474('0x28')][_0x5474('0x32')]));_0x31ceed[_0x5474('0x31')]=_0x31ceed[_0x5474('0x31')][_0x5474('0x33')]?_0x31ceed['attributes']:_0x20f167[_0x5474('0x2d')];if(!_0x250c99[_0x5474('0x28')][_0x5474('0x41')]('nolimit')){_0x31ceed['limit']=qs[_0x5474('0x17')](_0x250c99[_0x5474('0x28')]['limit']);_0x31ceed[_0x5474('0x16')]=qs[_0x5474('0x16')](_0x250c99[_0x5474('0x28')][_0x5474('0x16')]);}_0x31ceed[_0x5474('0x42')]=qs[_0x5474('0x43')](_0x250c99[_0x5474('0x28')][_0x5474('0x43')]);_0x31ceed[_0x5474('0x44')]=qs[_0x5474('0x30')](_[_0x5474('0x45')](_0x250c99['query'],_0x20f167['filters']));_0x31ceed[_0x5474('0x44')][_0x5474('0x46')]=_0x2a9f9a['id'];if(_0x250c99[_0x5474('0x28')][_0x5474('0x47')]){_0x31ceed[_0x5474('0x44')]=_[_0x5474('0x35')](_0x31ceed[_0x5474('0x44')],{'$or':_['map'](_0x31ceed['attributes'],function(_0x2b6a41){var _0x46d13b={};_0x46d13b[_0x2b6a41]={'$like':'%'+_0x250c99[_0x5474('0x28')]['filter']+'%'};return _0x46d13b;})});}if(_0x250c99[_0x5474('0x28')]['$gte']){var _0x3c7f18=_0x250c99['query'][_0x5474('0x48')][_0x5474('0x49')](',');var _0x52eda3={};_0x52eda3[_0x3c7f18[0x0]]={'$gte':moment(_0x3c7f18[0x1])[_0x5474('0x4a')](_0x5474('0x4b'))};_0x31ceed[_0x5474('0x44')]=_[_0x5474('0x35')](_0x31ceed[_0x5474('0x44')],_0x52eda3);}_0x31ceed=_[_0x5474('0x35')]({},_0x31ceed,_0x250c99[_0x5474('0x36')]);return db['OpenchannelMessage'][_0x5474('0x19')]({'where':_0x31ceed['where']})[_0x5474('0x1c')](function(_0x287b60){_0x45fab6[_0x5474('0x19')]=_0x287b60;if(_0x250c99[_0x5474('0x28')][_0x5474('0x4c')]){_0x31ceed[_0x5474('0x34')]=[{'all':!![]}];}return db[_0x5474('0x4d')][_0x5474('0x4e')](_0x31ceed);})[_0x5474('0x1c')](function(_0x533660){_0x45fab6[_0x5474('0x4f')]=_0x533660;return _0x45fab6;});}})[_0x5474('0x1c')](respondWithFilteredResult(_0x113fb5,_0x31ceed))[_0x5474('0x38')](handleError(_0x113fb5,null));};exports[_0x5474('0x50')]=function(_0x2b2681,_0x5c1543){return db[_0x5474('0x24')][_0x5474('0x37')]({'where':{'id':_0x2b2681[_0x5474('0x2c')]['id']}})[_0x5474('0x1c')](handleEntityNotFound(_0x5c1543,null))[_0x5474('0x1c')](function(_0x491be1){if(_0x491be1){return _0x491be1[_0x5474('0x51')](_0x2b2681[_0x5474('0x3a')][_0x5474('0x3d')],_[_0x5474('0x3e')](_0x2b2681[_0x5474('0x3a')],[_0x5474('0x3d'),'id'])||{})[_0x5474('0x52')](function(){return db[_0x5474('0x53')][_0x5474('0x4e')]({'attributes':['id',_0x5474('0x20'),_0x5474('0x54')],'where':{'id':_0x2b2681[_0x5474('0x3a')][_0x5474('0x3d')]}});})[_0x5474('0x1c')](function(_0x59b8b8){socket[_0x5474('0x55')](_0x5474('0x56'),{'id':Number(_0x2b2681[_0x5474('0x2c')]['id']),'tags':_0x59b8b8||[]});return{'id':Number(_0x2b2681[_0x5474('0x2c')]['id']),'tags':_0x59b8b8||[]};});}})[_0x5474('0x1c')](respondWithResult(_0x5c1543,null))[_0x5474('0x38')](handleError(_0x5c1543,null));};exports[_0x5474('0x57')]=function(_0x5b2326,_0x47ad6b){return db['OpenchannelInteraction'][_0x5474('0x37')]({'where':{'id':_0x5b2326[_0x5474('0x2c')]['id']}})[_0x5474('0x1c')](handleEntityNotFound(_0x47ad6b,null))[_0x5474('0x1c')](function(_0xbcbf6e){if(_0xbcbf6e){return _0xbcbf6e['removeTags'](_0x5b2326[_0x5474('0x28')][_0x5474('0x3d')]);}})[_0x5474('0x1c')](respondWithStatusCode(_0x47ad6b,null))[_0x5474('0x38')](handleError(_0x47ad6b,null));};exports['download']=function(_0x301177,_0xb3ec64){var _0x752de0=moment()[_0x5474('0x58')]()[_0x5474('0x59')]();var _0x174068=path['join'](config[_0x5474('0x5a')],_0x5474('0x5b'),'files',_0x5474('0x5c'));var _0x525f80=path[_0x5474('0x5d')](config[_0x5474('0x5a')],'server',_0x5474('0x5e'),'attachments');var _0x18a2ec=path['join'](_0x174068,_0x752de0);var _0xa1dbf9=util[_0x5474('0x4a')](_0x5474('0x5f'),_0x301177[_0x5474('0x2c')]['id'],_0x752de0);var _0x2055ca=path[_0x5474('0x5d')](_0x174068,_0xa1dbf9);var _0x4a02a3=[];_0x4a02a3[_0x5474('0x60')]({'model':db[_0x5474('0x61')],'as':_0x5474('0x61'),'attributes':['id',_0x5474('0x62')],'raw':!![]});_0x4a02a3[_0x5474('0x60')]({'model':db[_0x5474('0x63')],'as':_0x5474('0x64'),'attributes':['id',_0x5474('0x65'),_0x5474('0x66')],'raw':!![]});if(_0x301177[_0x5474('0x28')][_0x5474('0x67')]){_0x4a02a3[_0x5474('0x60')]({'model':db[_0x5474('0x68')],'as':_0x5474('0x68'),'raw':!![]});}var _0xaede22=[{'model':db[_0x5474('0x4d')],'as':'Messages','attributes':['id',_0x5474('0x3a'),'createdAt',_0x5474('0x69'),_0x5474('0x6a'),_0x5474('0x6b')],'include':_0x4a02a3}];_0xaede22[_0x5474('0x60')]({'model':db[_0x5474('0x6c')],'as':_0x5474('0x6d'),'attributes':['id',_0x5474('0x20')]});_0xaede22['push']({'model':db[_0x5474('0x61')],'as':'Owner','attributes':['id',_0x5474('0x62')]});return db['OpenchannelInteraction'][_0x5474('0x37')]({'where':{'id':_0x301177['params']['id']},'include':_0xaede22})[_0x5474('0x1c')](handleEntityNotFound(_0xb3ec64,null))[_0x5474('0x1c')](function(_0xbf2a83){if(_0xbf2a83){var _0x3b39da=_0xbf2a83['get']({'plain':!![]});fs['mkdirSync'](_0x18a2ec);var _0xa11033={'channel':_0x5474('0x6e'),'account':_0x3b39da[_0x5474('0x6d')][_0x5474('0x20')],'agent':_0x3b39da[_0x5474('0x6f')]?_0x3b39da[_0x5474('0x6f')]['fullname']:'N.A.','createdAt':moment(_0x3b39da[_0x5474('0x70')])[_0x5474('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5474('0x59')](),'closedAt':_0x3b39da[_0x5474('0x71')]?moment(_0x3b39da[_0x5474('0x72')])['format'](_0x5474('0x4b'))[_0x5474('0x59')]():'','disposition':_0x3b39da['disposition'],'visibility':_0x3b39da[_0x5474('0x73')]?_0x5474('0x74'):_0x5474('0x75'),'messages':_(_0x3b39da[_0x5474('0x76')])[_0x5474('0x47')]({'secret':![]})['map'](function(_0xea0c5b){if(_0xea0c5b[_0x5474('0x68')]){var _0x1714ea=path[_0x5474('0x5d')](_0x525f80,_0xea0c5b['Attachment'][_0x5474('0x77')]);if(fs['existsSync'](_0x1714ea)){fs[_0x5474('0x78')](_0x1714ea)[_0x5474('0x79')](fs[_0x5474('0x7a')](path[_0x5474('0x5d')](_0x18a2ec,_0xea0c5b['Attachment'][_0x5474('0x77')])));}}return{'date':moment(_0xea0c5b[_0x5474('0x70')])[_0x5474('0x4a')](_0x5474('0x4b'))[_0x5474('0x59')](),'sender':_0xea0c5b[_0x5474('0x69')]===_0x5474('0x7b')?_0xea0c5b['User']?_0xea0c5b[_0x5474('0x61')]['fullname']:_0x5474('0x7c'):_0xea0c5b[_0x5474('0x64')][_0x5474('0x65')]+(_0xea0c5b[_0x5474('0x64')][_0x5474('0x66')]?'\x20'+_0xea0c5b['Contact'][_0x5474('0x66')]:''),'body':_0xea0c5b[_0x5474('0x68')]?_0xea0c5b['Attachment'][_0x5474('0x77')]:_0xea0c5b[_0x5474('0x3a')],'direction':_0xea0c5b[_0x5474('0x69')]===_0x5474('0x7b')?'A':'C','secret':_0xea0c5b['secret'],'read':_0xea0c5b['read'],'attachment':_0xea0c5b[_0x5474('0x68')]};})['value']()};return ejs['renderFile'](path[_0x5474('0x5d')](config[_0x5474('0x5a')],_0x5474('0x5b'),_0x5474('0x7d'),_0x5474('0x7e')),{'interaction':_0xa11033})['then'](function(_0x477e50){var _0x48848a=path[_0x5474('0x5d')](_0x18a2ec,_0x5474('0x7f')+_0x3b39da['id']+'-'+_0x752de0+'.pdf');var _0x1a1520={'path':_0x48848a,'channel':'Openchannel','interactionId':_0x3b39da['id']};return pdf['createPdfFromHTML'](_0x477e50,_0x1a1520);})[_0x5474('0x1c')](function(){return new Promise(function(_0x4903cf,_0x5e744d){zipdir(_0x18a2ec,{'saveTo':_0x2055ca},function(_0x558d90,_0x50de39){if(_0x558d90)return _0x5e744d(_0x558d90);return _0x4903cf(_0x50de39);});})['then'](function(){return new Promise(function(_0x2c5a17,_0x46f61a){rimraf(_0x18a2ec,function(_0x3785de){if(_0x3785de)_0x46f61a(_0x3785de);return _0x2c5a17();});});})[_0x5474('0x1c')](function(){return _0xb3ec64['download'](_0x2055ca,_0xa1dbf9,function(_0x4ee357){if(_0x4ee357){logger[_0x5474('0x1e')]('Unable\x20to\x20delete\x20zip\x20file',_0x4ee357);}else{fs[_0x5474('0x80')](_0x2055ca);}});});});}else{return _0xb3ec64[_0x5474('0x12')](0xc8);}})['catch'](handleError(_0xb3ec64,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b958575..07aac7d 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 _0x621b=['findAll','unreadMessages','emit','catch','hook','exports','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x2cd3d1,_0x450a6f){var _0xcb0faa=function(_0x48f988){while(--_0x48f988){_0x2cd3d1['push'](_0x2cd3d1['shift']());}};_0xcb0faa(++_0x450a6f);}(_0x621b,0x17c));var _0xb621=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x621b[_0x2e0443];return _0x52d450;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xb621('0x0')];var OpenchannelMessage=require(_0xb621('0x1'))['db'][_0xb621('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb621('0x3')](0x0);var events={'afterCreate':_0xb621('0x4'),'afterUpdate':_0xb621('0x5'),'afterDestroy':_0xb621('0x6')};function emitEvent(_0x57ade0){return function(_0x4bdfbb,_0x5a416d,_0x5e5fd0){_0x4bdfbb[_0xb621('0x7')]({'attributes':['id'],'raw':!![]})[_0xb621('0x8')](function(_0x4f84c4){_0x4bdfbb[_0xb621('0x9')](_0xb621('0xa'),_0x4f84c4['map'](function(_0x93e467){return{'id':_0x93e467['id']};}));return OpenchannelMessage[_0xb621('0xb')]({'where':{'OpenchannelInteractionId':_0x4bdfbb['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb621('0x8')](function(_0x48bd3b){_0x4bdfbb[_0xb621('0x9')](_0xb621('0xc'),_0x48bd3b['length']);OpenchannelInteractionEvents['emit'](_0x57ade0+':'+_0x4bdfbb['id'],_0x4bdfbb);OpenchannelInteractionEvents[_0xb621('0xd')](_0x57ade0,_0x4bdfbb);_0x5e5fd0(null);})[_0xb621('0xe')](_0x5e5fd0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xb621('0xf')](e,emitEvent(event));}}module[_0xb621('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2aa0=['OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','Users','map','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x2aa0,0x75));var _0x02aa=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2aa0[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x02aa('0x0'));var OpenchannelInteraction=require(_0x02aa('0x1'))['db'][_0x02aa('0x2')];var OpenchannelMessage=require(_0x02aa('0x1'))['db'][_0x02aa('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x02aa('0x4'),'afterUpdate':_0x02aa('0x5'),'afterDestroy':_0x02aa('0x6')};function emitEvent(_0x448c38){return function(_0xa53a05,_0x22458b,_0x52b11d){_0xa53a05[_0x02aa('0x7')]({'attributes':['id'],'raw':!![]})[_0x02aa('0x8')](function(_0x95bc84){_0xa53a05[_0x02aa('0x9')](_0x02aa('0xa'),_0x95bc84[_0x02aa('0xb')](function(_0x1c13a7){return{'id':_0x1c13a7['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xa53a05['id'],'direction':'in','read':![]},'raw':!![]});})[_0x02aa('0x8')](function(_0x27b772){_0xa53a05['setDataValue']('unreadMessages',_0x27b772['length']);OpenchannelInteractionEvents[_0x02aa('0xc')](_0x448c38+':'+_0xa53a05['id'],_0xa53a05);OpenchannelInteractionEvents[_0x02aa('0xc')](_0x448c38,_0xa53a05);_0x52b11d(null);})[_0x02aa('0xd')](_0x52b11d(null));};}for(var e in events){if(events[_0x02aa('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x02aa('0xf')](e,emitEvent(event));}}module[_0x02aa('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 086295f..72b1279 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 _0x23d5=['YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','openchannel_interactions','utf8mb4','changed','closed','closedAt','format'];(function(_0x51d59c,_0x391b66){var _0x5a1e46=function(_0x2a66df){while(--_0x2a66df){_0x51d59c['push'](_0x51d59c['shift']());}};_0x5a1e46(++_0x391b66);}(_0x23d5,0xd1));var _0x523d=function(_0x1ff67d,_0x4383bb){_0x1ff67d=_0x1ff67d-0x0;var _0x14f0ce=_0x23d5[_0x1ff67d];return _0x14f0ce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x523d('0x0'))(_0x523d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x523d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x523d('0x3'));var config=require(_0x523d('0x4'));var attributes=require(_0x523d('0x5'));module['exports']=function(_0x182956,_0x3ab2ef){return _0x182956['define']('OpenchannelInteraction',attributes,{'tableName':_0x523d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x523d('0x7'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x2234bd,_0x1a1dec,_0x4e24c7){if(_0x2234bd[_0x523d('0x8')](_0x523d('0x9'))){_0x2234bd[_0x523d('0xa')]=moment()[_0x523d('0xb')](_0x523d('0xc'));}_0x4e24c7(null,_0x2234bd);}}});}; \ No newline at end of file +var _0x2ad9=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','lodash'];(function(_0x53c739,_0x34dd56){var _0x1cf22e=function(_0x176909){while(--_0x176909){_0x53c739['push'](_0x53c739['shift']());}};_0x1cf22e(++_0x34dd56);}(_0x2ad9,0xfb));var _0x92ad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2ad9[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x92ad('0x0'));var util=require('util');var logger=require(_0x92ad('0x1'))('api');var moment=require('moment');var BPromise=require(_0x92ad('0x2'));var rp=require(_0x92ad('0x3'));var fs=require('fs');var path=require(_0x92ad('0x4'));var rimraf=require(_0x92ad('0x5'));var config=require(_0x92ad('0x6'));var attributes=require(_0x92ad('0x7'));module[_0x92ad('0x8')]=function(_0x56ae33,_0x36c810){return _0x56ae33['define'](_0x92ad('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x92ad('0xa'),'collate':_0x92ad('0xb'),'hooks':{'beforeUpdate':function(_0x5487f5,_0x34c4b4,_0x27d5f6){if(_0x5487f5[_0x92ad('0xc')]('closed')){_0x5487f5[_0x92ad('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x27d5f6(null,_0x5487f5);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 171b164..2a2af9c 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 _0xa822=['AddTags','lodash','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','redis','defaults','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','where','body','ids'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0xa822,0x14b));var _0x2a82=function(_0x3dd0b9,_0x1d6c92){_0x3dd0b9=_0x3dd0b9-0x0;var _0x4c0351=_0xa822[_0x3dd0b9];return _0x4c0351;};'use strict';var _=require(_0x2a82('0x0'));var util=require(_0x2a82('0x1'));var moment=require(_0x2a82('0x2'));var BPromise=require(_0x2a82('0x3'));var rs=require(_0x2a82('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2a82('0x5'));var jayson=require(_0x2a82('0x6'));var client=jayson[_0x2a82('0x7')]['http']({'port':0x232a});config[_0x2a82('0x8')]=_[_0x2a82('0x9')](config[_0x2a82('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a82('0x8')]));require(_0x2a82('0xa'))[_0x2a82('0xb')](socket);function respondWithRpcPromise(_0x2bb627,_0x2afd01,_0x48f318){return new BPromise(function(_0x51e62b,_0xede105){return client['request'](_0x2bb627,_0x48f318)[_0x2a82('0xc')](function(_0x24878d){logger[_0x2a82('0xd')](_0x2a82('0xe'),_0x2afd01,_0x2a82('0xf'));logger[_0x2a82('0x10')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2afd01,_0x2a82('0xf'),JSON[_0x2a82('0x11')](_0x24878d));if(_0x24878d[_0x2a82('0x12')]){if(_0x24878d['error']['code']===0x1f4){logger['error'](_0x2a82('0xe'),_0x2afd01,_0x24878d[_0x2a82('0x12')][_0x2a82('0x13')]);return _0xede105(_0x24878d[_0x2a82('0x12')][_0x2a82('0x13')]);}logger[_0x2a82('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2afd01,_0x24878d[_0x2a82('0x12')][_0x2a82('0x13')]);return _0x51e62b(_0x24878d[_0x2a82('0x12')][_0x2a82('0x13')]);}else{logger[_0x2a82('0xd')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2afd01,_0x2a82('0xf'));_0x51e62b(_0x24878d[_0x2a82('0x14')][_0x2a82('0x13')]);}})[_0x2a82('0x15')](function(_0x11d416){logger[_0x2a82('0x12')](_0x2a82('0xe'),_0x2afd01,_0x11d416);_0xede105(_0x11d416);});});}exports[_0x2a82('0x16')]=function(_0x2fba9b){var _0xb1aaa1=this;return new Promise(function(_0x15eca2,_0x7b934){return db[_0x2a82('0x17')]['update'](_0x2fba9b['body'],{'raw':_0x2fba9b[_0x2a82('0x18')]?_0x2fba9b[_0x2a82('0x18')][_0x2a82('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fba9b['options']?_0x2fba9b[_0x2a82('0x18')]['where']||null:null,'attributes':_0x2fba9b['options']?_0x2fba9b[_0x2a82('0x18')][_0x2a82('0x1a')]||null:null,'limit':_0x2fba9b['options']?_0x2fba9b['options'][_0x2a82('0x1b')]||null:null})[_0x2a82('0xc')](function(_0x12602d){logger[_0x2a82('0xd')]('UpdateOpenchannelInteraction',_0x2fba9b);logger['debug'](_0x2a82('0x16'),_0x2fba9b,JSON[_0x2a82('0x11')](_0x12602d));_0x15eca2(_0x12602d);})[_0x2a82('0x15')](function(_0x5f2c7e){logger['error'](_0x2a82('0x16'),_0x5f2c7e['message'],_0x2fba9b);_0x7b934(_0xb1aaa1[_0x2a82('0x12')](0x1f4,_0x5f2c7e['message']));});});};exports[_0x2a82('0x1c')]=function(_0x28612){return new Promise(function(_0x162d4e,_0x3a028d){return db[_0x2a82('0x17')]['find']({'where':_0x28612[_0x2a82('0x18')]?_0x28612['options'][_0x2a82('0x1d')]||null:null})['then'](function(_0x4b4689){if(_0x4b4689){return _0x4b4689['addTags'](_0x28612[_0x2a82('0x1e')][_0x2a82('0x1f')],_['omit'](_0x28612[_0x2a82('0x1e')],['ids','id'])||{});}})['spread'](function(_0x448c0c){logger[_0x2a82('0xd')](_0x2a82('0x20'),_0x28612);logger['debug']('AddTags',_0x28612,JSON['stringify'](_0x448c0c));_0x162d4e(_0x448c0c);})['catch'](function(_0x5e74c0){logger['error'](_0x2a82('0x20'),_0x5e74c0[_0x2a82('0x13')],_0x28612);_0x3a028d(_this[_0x2a82('0x12')](0x1f4,_0x5e74c0[_0x2a82('0x13')]));});});}; \ No newline at end of file +var _0x3610=['OpenchannelInteraction','update','options','raw','where','attributes','UpdateOpenchannelInteraction','find','addTags','body','ids','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1cf964,_0xfd0e86){var _0x204e82=function(_0x5a6d2e){while(--_0x5a6d2e){_0x1cf964['push'](_0x1cf964['shift']());}};_0x204e82(++_0xfd0e86);}(_0x3610,0x1ed));var _0x0361=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x3610[_0x47fd36];return _0x21a0fc;};'use strict';var _=require('lodash');var util=require(_0x0361('0x0'));var moment=require(_0x0361('0x1'));var BPromise=require('bluebird');var rs=require(_0x0361('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0361('0x3'))['db'];var utils=require(_0x0361('0x4'));var logger=require(_0x0361('0x5'))(_0x0361('0x6'));var config=require(_0x0361('0x7'));var jayson=require(_0x0361('0x8'));var client=jayson[_0x0361('0x9')][_0x0361('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0361('0xb')],{'host':_0x0361('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0361('0xb')]));require('./openchannelInteraction.socket')[_0x0361('0xd')](socket);function respondWithRpcPromise(_0x1759c5,_0x1a7d26,_0x17c007){return new BPromise(function(_0x5c1f0c,_0x4db982){return client[_0x0361('0xe')](_0x1759c5,_0x17c007)[_0x0361('0xf')](function(_0x274d5f){logger['info'](_0x0361('0x10'),_0x1a7d26,_0x0361('0x11'));logger[_0x0361('0x12')](_0x0361('0x13'),_0x1a7d26,_0x0361('0x11'),JSON[_0x0361('0x14')](_0x274d5f));if(_0x274d5f[_0x0361('0x15')]){if(_0x274d5f[_0x0361('0x15')][_0x0361('0x16')]===0x1f4){logger['error'](_0x0361('0x10'),_0x1a7d26,_0x274d5f['error'][_0x0361('0x17')]);return _0x4db982(_0x274d5f[_0x0361('0x15')][_0x0361('0x17')]);}logger['error'](_0x0361('0x10'),_0x1a7d26,_0x274d5f[_0x0361('0x15')][_0x0361('0x17')]);return _0x5c1f0c(_0x274d5f[_0x0361('0x15')][_0x0361('0x17')]);}else{logger[_0x0361('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1a7d26,'request\x20sent');_0x5c1f0c(_0x274d5f[_0x0361('0x19')]['message']);}})[_0x0361('0x1a')](function(_0x4e3b22){logger[_0x0361('0x15')](_0x0361('0x10'),_0x1a7d26,_0x4e3b22);_0x4db982(_0x4e3b22);});});}exports['UpdateOpenchannelInteraction']=function(_0x57ffcc){var _0x23b89d=this;return new Promise(function(_0x3ee043,_0x4e9d83){return db[_0x0361('0x1b')][_0x0361('0x1c')](_0x57ffcc['body'],{'raw':_0x57ffcc[_0x0361('0x1d')]?_0x57ffcc[_0x0361('0x1d')][_0x0361('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57ffcc[_0x0361('0x1d')]?_0x57ffcc[_0x0361('0x1d')][_0x0361('0x1f')]||null:null,'attributes':_0x57ffcc[_0x0361('0x1d')]?_0x57ffcc[_0x0361('0x1d')][_0x0361('0x20')]||null:null,'limit':_0x57ffcc[_0x0361('0x1d')]?_0x57ffcc[_0x0361('0x1d')]['limit']||null:null})[_0x0361('0xf')](function(_0x562c79){logger['info'](_0x0361('0x21'),_0x57ffcc);logger[_0x0361('0x12')](_0x0361('0x21'),_0x57ffcc,JSON[_0x0361('0x14')](_0x562c79));_0x3ee043(_0x562c79);})[_0x0361('0x1a')](function(_0x28a371){logger[_0x0361('0x15')](_0x0361('0x21'),_0x28a371[_0x0361('0x17')],_0x57ffcc);_0x4e9d83(_0x23b89d[_0x0361('0x15')](0x1f4,_0x28a371[_0x0361('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x27f5d9){return new Promise(function(_0x3231ef,_0x625c0f){return db[_0x0361('0x1b')][_0x0361('0x22')]({'where':_0x27f5d9[_0x0361('0x1d')]?_0x27f5d9[_0x0361('0x1d')]['where']||null:null})[_0x0361('0xf')](function(_0x2a37b9){if(_0x2a37b9){return _0x2a37b9[_0x0361('0x23')](_0x27f5d9[_0x0361('0x24')]['ids'],_['omit'](_0x27f5d9[_0x0361('0x24')],[_0x0361('0x25'),'id'])||{});}})[_0x0361('0x26')](function(_0x145c28){logger[_0x0361('0x18')](_0x0361('0x27'),_0x27f5d9);logger['debug'](_0x0361('0x27'),_0x27f5d9,JSON['stringify'](_0x145c28));_0x3231ef(_0x145c28);})[_0x0361('0x1a')](function(_0x1e19f8){logger['error'](_0x0361('0x27'),_0x1e19f8['message'],_0x27f5d9);_0x625c0f(_this[_0x0361('0x15')](0x1f4,_0x1e19f8['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 376894d..39c1942 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 _0xf3b6=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x555617,_0x1cf886){var _0x34d091=function(_0x3a8ea9){while(--_0x3a8ea9){_0x555617['push'](_0x555617['shift']());}};_0x34d091(++_0x1cf886);}(_0xf3b6,0x135));var _0x6f3b=function(_0x5e010d,_0x14008e){_0x5e010d=_0x5e010d-0x0;var _0x5a0824=_0xf3b6[_0x5e010d];return _0x5a0824;};'use strict';var OpenchannelInteractionEvents=require(_0x6f3b('0x0'));var events=[_0x6f3b('0x1'),_0x6f3b('0x2'),'update'];function createListener(_0x5004e3,_0x2391b5){return function(_0xe12f41){_0x2391b5[_0x6f3b('0x3')](_0x5004e3,_0xe12f41);};}function removeListener(_0x397024,_0x479567){return function(){OpenchannelInteractionEvents[_0x6f3b('0x4')](_0x397024,_0x479567);};}exports[_0x6f3b('0x5')]=function(_0x43b85e){for(var _0x3cb6ab=0x0,_0xda5115=events[_0x6f3b('0x6')];_0x3cb6ab<_0xda5115;_0x3cb6ab++){var _0x41d2c2=events[_0x3cb6ab];var _0x5f2a34=createListener(_0x6f3b('0x7')+_0x41d2c2,_0x43b85e);OpenchannelInteractionEvents['on'](_0x41d2c2,_0x5f2a34);}}; \ No newline at end of file +var _0x8361=['register','length','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x16bb9a,_0x17f4d6){var _0x5e4c8e=function(_0x305ce8){while(--_0x305ce8){_0x16bb9a['push'](_0x16bb9a['shift']());}};_0x5e4c8e(++_0x17f4d6);}(_0x8361,0x9a));var _0x1836=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x8361[_0x1a72f3];return _0x57ef47;};'use strict';var OpenchannelInteractionEvents=require(_0x1836('0x0'));var events=[_0x1836('0x1'),_0x1836('0x2'),_0x1836('0x3')];function createListener(_0x1c0323,_0x1d62aa){return function(_0x87d36){_0x1d62aa[_0x1836('0x4')](_0x1c0323,_0x87d36);};}function removeListener(_0x2dc831,_0x6fe561){return function(){OpenchannelInteractionEvents[_0x1836('0x5')](_0x2dc831,_0x6fe561);};}exports[_0x1836('0x6')]=function(_0x3623a3){for(var _0x15c317=0x0,_0x6a8d14=events[_0x1836('0x7')];_0x15c317<_0x6a8d14;_0x15c317++){var _0x3593e5=events[_0x15c317];var _0xd3bf5a=createListener('openchannelInteraction:'+_0x3593e5,_0x3623a3);OpenchannelInteractionEvents['on'](_0x3593e5,_0xd3bf5a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f88e55a..e27025c 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _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(_0x2cf822,_0x25876e){var _0x50c674=function(_0x3564ca){while(--_0x3564ca){_0x2cf822['push'](_0x2cf822['shift']());}};_0x50c674(++_0x25876e);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 059e06a..051f07f 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 _0xeef7=['exports','medium','BOOLEAN','out','DATE','STRING','sequelize'];(function(_0x87ed4f,_0x111180){var _0x48f916=function(_0x548953){while(--_0x548953){_0x87ed4f['push'](_0x87ed4f['shift']());}};_0x48f916(++_0x111180);}(_0xeef7,0x7d));var _0x7eef=function(_0x49d334,_0x2bfab3){_0x49d334=_0x49d334-0x0;var _0x496193=_0xeef7[_0x49d334];return _0x496193;};'use strict';var Sequelize=require(_0x7eef('0x0'));module[_0x7eef('0x1')]={'body':{'type':Sequelize['TEXT'](_0x7eef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7eef('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7eef('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7eef('0x5')]},'providerName':{'type':Sequelize[_0x7eef('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x75dc=['DATE','STRING','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x75dc,0x1d7));var _0xc75d=function(_0x180237,_0xfd4959){_0x180237=_0x180237-0x0;var _0x56fa74=_0x75dc[_0x180237];return _0x56fa74;};'use strict';var Sequelize=require(_0xc75d('0x0'));module[_0xc75d('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xc75d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc75d('0x3')]('in',_0xc75d('0x4')),'defaultValue':_0xc75d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc75d('0x5')]},'providerName':{'type':Sequelize[_0xc75d('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 8ddeed0..596dbb9 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 _0xdaa6=['rawAttributes','find','body','update','describe','openchannel-interactions','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','reject','destroy','stack','name','index','type','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','rows','params'];(function(_0x29311d,_0x3f9e23){var _0xa29b8f=function(_0x2bb490){while(--_0x2bb490){_0x29311d['push'](_0x29311d['shift']());}};_0xa29b8f(++_0x3f9e23);}(_0xdaa6,0x133));var _0x6daa=function(_0x79813c,_0x581f11){_0x79813c=_0x79813c-0x0;var _0x25033e=_0xdaa6[_0x79813c];return _0x25033e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6daa('0x0'));var rp=require(_0x6daa('0x1'));var moment=require('moment');var BPromise=require(_0x6daa('0x2'));var Mustache=require(_0x6daa('0x3'));var util=require(_0x6daa('0x4'));var path=require(_0x6daa('0x5'));var sox=require(_0x6daa('0x6'));var csv=require('to-csv');var ejs=require(_0x6daa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6daa('0x8'));var crypto=require('crypto');var jsforce=require(_0x6daa('0x9'));var deskjs=require(_0x6daa('0xa'));var toCsv=require(_0x6daa('0xb'));var querystring=require(_0x6daa('0xc'));var Papa=require(_0x6daa('0xd'));var Redis=require(_0x6daa('0xe'));var authService=require(_0x6daa('0xf'));var qs=require(_0x6daa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6daa('0x11'))(_0x6daa('0x12'));var utils=require(_0x6daa('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6daa('0x14'))['db'];config[_0x6daa('0x15')]=_['defaults'](config[_0x6daa('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6daa('0x16'))[_0x6daa('0x17')](socket);var jayson=require(_0x6daa('0x18'));var client=jayson[_0x6daa('0x19')]['http']({'port':0x232c});var client9002=jayson[_0x6daa('0x19')][_0x6daa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2ebaf6,_0x406e80,_0x166c9d,_0x34e18d){return new BPromise(function(_0x27174d,_0x272c12){var _0x32c33f=_0x34e18d||client;return _0x32c33f[_0x6daa('0x1b')](_0x2ebaf6,_0x166c9d)[_0x6daa('0x1c')](function(_0x22db73){logger[_0x6daa('0x1d')](_0x6daa('0x1e'),_0x406e80,_0x6daa('0x1f'));logger[_0x6daa('0x20')](_0x6daa('0x21'),_0x406e80,_0x6daa('0x1f'),JSON[_0x6daa('0x22')](_0x22db73));if(_0x22db73[_0x6daa('0x23')]){if(_0x22db73[_0x6daa('0x23')]['code']===0x1f4){logger['error'](_0x6daa('0x1e'),_0x406e80,_0x22db73['error']['message']);return _0x272c12(_0x22db73[_0x6daa('0x23')][_0x6daa('0x24')]);}logger[_0x6daa('0x23')](_0x6daa('0x1e'),_0x406e80,_0x22db73[_0x6daa('0x23')]['message']);return _0x27174d(_0x22db73[_0x6daa('0x23')][_0x6daa('0x24')]);}else{logger[_0x6daa('0x1d')](_0x6daa('0x1e'),_0x406e80,'request\x20sent');_0x27174d(_0x22db73[_0x6daa('0x25')][_0x6daa('0x24')]);}})[_0x6daa('0x26')](function(_0x5b6bae){logger[_0x6daa('0x23')](_0x6daa('0x1e'),_0x406e80,_0x5b6bae);_0x272c12(_0x5b6bae);});});}function respondWithStatusCode(_0x5719ea,_0x1e07d7){_0x1e07d7=_0x1e07d7||0xcc;return function(_0x547f0e){if(_0x547f0e){return _0x5719ea[_0x6daa('0x27')](_0x1e07d7);}return _0x5719ea['status'](_0x1e07d7)[_0x6daa('0x28')]();};}function respondWithResult(_0x3c7d61,_0x18332a){_0x18332a=_0x18332a||0xc8;return function(_0x206e9d){if(_0x206e9d){return _0x3c7d61['status'](_0x18332a)['json'](_0x206e9d);}};}function respondWithFilteredResult(_0x1837dc,_0x2542f3){return function(_0x4e5437){if(_0x4e5437){var _0x58ea32=typeof _0x2542f3[_0x6daa('0x29')]==='undefined'&&typeof _0x2542f3[_0x6daa('0x2a')]===_0x6daa('0x2b');var _0x57d148=_0x4e5437[_0x6daa('0x2c')];var _0x54e1b1=_0x58ea32?0x0:_0x2542f3['offset'];var _0x24be80=_0x58ea32?_0x4e5437[_0x6daa('0x2c')]:_0x2542f3[_0x6daa('0x29')]+_0x2542f3[_0x6daa('0x2a')];var _0x5afc2e;if(_0x24be80>=_0x57d148){_0x24be80=_0x57d148;_0x5afc2e=0xc8;}else{_0x5afc2e=0xce;}_0x1837dc[_0x6daa('0x2d')](_0x5afc2e);return _0x1837dc[_0x6daa('0x2e')](_0x6daa('0x2f'),_0x54e1b1+'-'+_0x24be80+'/'+_0x57d148)[_0x6daa('0x30')](_0x4e5437);}return null;};}function patchUpdates(_0x27d9ff){return function(_0x1844ea){try{jsonpatch[_0x6daa('0x31')](_0x1844ea,_0x27d9ff,!![]);}catch(_0xbb20b3){return BPromise[_0x6daa('0x32')](_0xbb20b3);}return _0x1844ea['save']();};}function saveUpdates(_0x322e9e,_0x42c925){return function(_0x6b6311){if(_0x6b6311){return _0x6b6311['update'](_0x322e9e)[_0x6daa('0x1c')](function(_0x1d964d){return _0x1d964d;});}return null;};}function removeEntity(_0x1663e2,_0x19803e){return function(_0x5deddd){if(_0x5deddd){return _0x5deddd[_0x6daa('0x33')]()['then'](function(){_0x1663e2['status'](0xcc)[_0x6daa('0x28')]();});}};}function handleEntityNotFound(_0x44995b,_0x2081cb){return function(_0x2a3d5f){if(!_0x2a3d5f){_0x44995b[_0x6daa('0x27')](0x194);}return _0x2a3d5f;};}function handleError(_0xfd7d55,_0x19bad0){_0x19bad0=_0x19bad0||0x1f4;return function(_0x1357b5){logger['error'](_0x1357b5[_0x6daa('0x34')]);if(_0x1357b5[_0x6daa('0x35')]){delete _0x1357b5[_0x6daa('0x35')];}_0xfd7d55[_0x6daa('0x2d')](_0x19bad0)['send'](_0x1357b5);};}exports[_0x6daa('0x36')]=function(_0x12cc6c,_0x7bb857){var _0x937863={},_0x411326={},_0x3db16d={'count':0x0,'rows':[]};var _0x28041f=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0xf02e0c){return{'name':_0xf02e0c['fieldName'],'type':_0xf02e0c[_0x6daa('0x37')][_0x6daa('0x38')]};});_0x411326[_0x6daa('0x39')]=_[_0x6daa('0x3a')](_0x28041f,_0x6daa('0x35'));_0x411326[_0x6daa('0x3b')]=_[_0x6daa('0x3c')](_0x12cc6c['query']);_0x411326['filters']=_['intersection'](_0x411326[_0x6daa('0x39')],_0x411326[_0x6daa('0x3b')]);_0x937863['attributes']=_['intersection'](_0x411326[_0x6daa('0x39')],qs[_0x6daa('0x3d')](_0x12cc6c[_0x6daa('0x3b')][_0x6daa('0x3d')]));_0x937863[_0x6daa('0x3e')]=_0x937863[_0x6daa('0x3e')][_0x6daa('0x3f')]?_0x937863['attributes']:_0x411326[_0x6daa('0x39')];if(!_0x12cc6c['query'][_0x6daa('0x40')](_0x6daa('0x41'))){_0x937863['limit']=qs['limit'](_0x12cc6c['query']['limit']);_0x937863[_0x6daa('0x29')]=qs['offset'](_0x12cc6c[_0x6daa('0x3b')]['offset']);}_0x937863[_0x6daa('0x42')]=qs[_0x6daa('0x43')](_0x12cc6c[_0x6daa('0x3b')]['sort']);_0x937863['where']=qs['filters'](_[_0x6daa('0x44')](_0x12cc6c[_0x6daa('0x3b')],_0x411326[_0x6daa('0x45')]),_0x28041f);if(_0x12cc6c['query'][_0x6daa('0x46')]){_0x937863[_0x6daa('0x47')]=_[_0x6daa('0x48')](_0x937863[_0x6daa('0x47')],{'$or':_[_0x6daa('0x3a')](_0x28041f,function(_0x4fa381){if(_0x4fa381[_0x6daa('0x37')]!==_0x6daa('0x49')){var _0x296dbb={};_0x296dbb[_0x4fa381[_0x6daa('0x35')]]={'$like':'%'+_0x12cc6c['query'][_0x6daa('0x46')]+'%'};return _0x296dbb;}})});}_0x937863=_[_0x6daa('0x48')]({},_0x937863,_0x12cc6c[_0x6daa('0x4a')]);var _0x2240cb={'where':_0x937863[_0x6daa('0x47')]};return db[_0x6daa('0x4b')][_0x6daa('0x2c')](_0x2240cb)['then'](function(_0x3d21e8){_0x3db16d[_0x6daa('0x2c')]=_0x3d21e8;if(_0x12cc6c[_0x6daa('0x3b')][_0x6daa('0x4c')]){_0x937863[_0x6daa('0x4d')]=[{'all':!![]}];}return db[_0x6daa('0x4b')]['findAll'](_0x937863);})[_0x6daa('0x1c')](function(_0x8fbe6d){_0x3db16d[_0x6daa('0x4e')]=_0x8fbe6d;return _0x3db16d;})[_0x6daa('0x1c')](respondWithFilteredResult(_0x7bb857,_0x937863))[_0x6daa('0x26')](handleError(_0x7bb857,null));};exports['show']=function(_0x598ca4,_0x570d0c){var _0x671546={'raw':!![],'where':{'id':_0x598ca4[_0x6daa('0x4f')]['id']}},_0x135db4={};_0x135db4[_0x6daa('0x39')]=_[_0x6daa('0x3c')](db[_0x6daa('0x4b')][_0x6daa('0x50')]);_0x135db4[_0x6daa('0x3b')]=_['keys'](_0x598ca4['query']);_0x135db4[_0x6daa('0x45')]=_['intersection'](_0x135db4[_0x6daa('0x39')],_0x135db4[_0x6daa('0x3b')]);_0x671546['attributes']=_['intersection'](_0x135db4[_0x6daa('0x39')],qs['fields'](_0x598ca4[_0x6daa('0x3b')][_0x6daa('0x3d')]));_0x671546[_0x6daa('0x3e')]=_0x671546['attributes'][_0x6daa('0x3f')]?_0x671546[_0x6daa('0x3e')]:_0x135db4[_0x6daa('0x39')];if(_0x598ca4[_0x6daa('0x3b')][_0x6daa('0x4c')]){_0x671546[_0x6daa('0x4d')]=[{'all':!![]}];}_0x671546=_[_0x6daa('0x48')]({},_0x671546,_0x598ca4[_0x6daa('0x4a')]);return db[_0x6daa('0x4b')][_0x6daa('0x51')](_0x671546)[_0x6daa('0x1c')](handleEntityNotFound(_0x570d0c,null))[_0x6daa('0x1c')](respondWithResult(_0x570d0c,null))[_0x6daa('0x26')](handleError(_0x570d0c,null));};exports['create']=function(_0x3302b1,_0x4a5001){return db[_0x6daa('0x4b')]['create'](_0x3302b1[_0x6daa('0x52')],{})[_0x6daa('0x1c')](respondWithResult(_0x4a5001,0xc9))[_0x6daa('0x26')](handleError(_0x4a5001,null));};exports[_0x6daa('0x53')]=function(_0x44f619,_0x41bc89){if(_0x44f619[_0x6daa('0x52')]['id']){delete _0x44f619['body']['id'];}return db['OpenchannelMessage'][_0x6daa('0x51')]({'where':{'id':_0x44f619[_0x6daa('0x4f')]['id']}})[_0x6daa('0x1c')](handleEntityNotFound(_0x41bc89,null))[_0x6daa('0x1c')](saveUpdates(_0x44f619[_0x6daa('0x52')],null))['then'](respondWithResult(_0x41bc89,null))['catch'](handleError(_0x41bc89,null));};exports['destroy']=function(_0x214cf2,_0x309d4d){return db[_0x6daa('0x4b')][_0x6daa('0x51')]({'where':{'id':_0x214cf2[_0x6daa('0x4f')]['id']}})[_0x6daa('0x1c')](handleEntityNotFound(_0x309d4d,null))[_0x6daa('0x1c')](removeEntity(_0x309d4d,null))[_0x6daa('0x26')](handleError(_0x309d4d,null));};exports[_0x6daa('0x54')]=function(_0x3284fc,_0x5cd58c){return db[_0x6daa('0x4b')]['describe']()[_0x6daa('0x1c')](respondWithResult(_0x5cd58c,null))[_0x6daa('0x26')](handleError(_0x5cd58c,null));};var interaction_log=require(_0x6daa('0x11'))(_0x6daa('0x55'));exports['accept']=function(_0x1234fa,_0x525238,_0x541678){var _0x7bcd74={'agent':{},'channel':_0x6daa('0x56')};if(_0x1234fa['body']['id']){delete _0x1234fa[_0x6daa('0x52')]['id'];}_0x1234fa[_0x6daa('0x52')][_0x6daa('0x57')]=!![];_0x1234fa[_0x6daa('0x52')][_0x6daa('0x58')]=moment()['format'](_0x6daa('0x59'));_0x1234fa[_0x6daa('0x52')][_0x6daa('0x5a')]=_0x1234fa[_0x6daa('0x52')][_0x6daa('0x5a')]||_0x1234fa[_0x6daa('0x5b')]['id'];_0x7bcd74[_0x6daa('0x5c')]['id']=_0x1234fa[_0x6daa('0x52')][_0x6daa('0x5a')];return db['OpenchannelMessage']['find']({'where':{'id':_0x1234fa[_0x6daa('0x4f')]['id'],'UserId':null}})[_0x6daa('0x1c')](handleEntityNotFound(_0x525238,null))['then'](saveUpdates(_0x1234fa[_0x6daa('0x52')],null))[_0x6daa('0x1c')](function(_0x24061c){if(_0x24061c){_0x7bcd74['message']=_0x24061c[_0x6daa('0x5d')]({'plain':!![]});return db['OpenchannelInteraction'][_0x6daa('0x51')]({'where':{'id':_0x24061c['OpenchannelInteractionId']}});}return null;})[_0x6daa('0x1c')](handleEntityNotFound(_0x525238,null))[_0x6daa('0x1c')](function(_0x4f8340){if(_0x4f8340){return _0x4f8340['update']({'UserId':_0x1234fa[_0x6daa('0x52')]['UserId'],'read1stAt':_[_0x6daa('0x5e')](_0x4f8340[_0x6daa('0x5f')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6daa('0x1c')](function(_0x3bdab7){if(_0x3bdab7){_0x7bcd74[_0x6daa('0x60')]=_0x3bdab7[_0x6daa('0x5d')]({'plain':!![]});interaction_log[_0x6daa('0x1d')](_0x6daa('0x61'),_0x1234fa[_0x6daa('0x5b')]['id'],_0x1234fa[_0x6daa('0x5b')][_0x6daa('0x35')],_0x1234fa[_0x6daa('0x5b')][_0x6daa('0x62')],_0x7bcd74[_0x6daa('0x60')]['id'],_0x1234fa[_0x6daa('0x52')]?JSON[_0x6daa('0x22')](_0x1234fa[_0x6daa('0x52')]):_0x6daa('0x63'));return respondWithRpcPromise(_0x6daa('0x64'),_0x6daa('0x65'),_0x7bcd74);}return null;})[_0x6daa('0x1c')](function(_0x357914){var _0x3ea3ad=_0x6daa('0x66')+_0x357914['message'][_0x6daa('0x67')];return db[_0x6daa('0x68')][_0x6daa('0x3b')](_0x3ea3ad,{'type':db[_0x6daa('0x69')][_0x6daa('0x6a')][_0x6daa('0x6b')],'raw':!![]})[_0x6daa('0x1c')](function(_0x414b1a){return _0x414b1a;});})['then'](function(_0x154cfc){if(_0x154cfc){_0x7bcd74[_0x6daa('0x24')][_0x6daa('0x6c')]=_0x154cfc[0x0];if(!_0x1234fa[_0x6daa('0x52')][_0x6daa('0x5a')])return;return db[_0x6daa('0x6d')]['find']({'where':{'id':_0x1234fa[_0x6daa('0x52')]['UserId'],'role':_0x6daa('0x5c')},'attributes':['id',_0x6daa('0x35'),_0x6daa('0x6e'),_0x6daa('0x6f'),_0x6daa('0x70')],'raw':!![]});}return null;})[_0x6daa('0x1c')](function(_0xdb3e84){if(!_0xdb3e84)return null;_0x7bcd74[_0x6daa('0x24')]['agent']=_0xdb3e84;return _0x7bcd74;})[_0x6daa('0x1c')](function(_0x14b433){if(_0x14b433){if(_0x1234fa['body'][_0x6daa('0x71')]){_0x7bcd74[_0x6daa('0x24')][_0x6daa('0x72')]=util[_0x6daa('0x73')](_0x6daa('0x74'),_0x1234fa[_0x6daa('0x5b')][_0x6daa('0x35')]);_0x7bcd74[_0x6daa('0x24')][_0x6daa('0x75')]=_0x7bcd74[_0x6daa('0x75')];_0x7bcd74['message'][_0x6daa('0x76')]=_0x7bcd74[_0x6daa('0x75')];_0x7bcd74[_0x6daa('0x24')][_0x6daa('0x77')]=_0x6daa('0x78');return respondWithRpcPromise(_0x6daa('0x79'),_0x6daa('0x79'),{'event':_0x6daa('0x7a'),'message':_0x7bcd74[_0x6daa('0x24')]},client9002)[_0x6daa('0x1c')](function(){return _0x7bcd74;});}return _0x7bcd74;}return null;})['then'](respondWithResult(_0x525238,null))['catch'](handleError(_0x525238,null));};var interaction_log=require(_0x6daa('0x11'))(_0x6daa('0x55'));exports['reject']=function(_0x155bd1,_0x417415,_0xca4395){var _0x2b16ba={'agent':{},'channel':_0x6daa('0x56')};if(_0x155bd1[_0x6daa('0x52')]['id']){delete _0x155bd1[_0x6daa('0x52')]['id'];}_0x155bd1[_0x6daa('0x52')][_0x6daa('0x5a')]=_0x155bd1[_0x6daa('0x52')][_0x6daa('0x5a')]||_0x155bd1[_0x6daa('0x5b')]['id'];_0x2b16ba['agent']['id']=_0x155bd1[_0x6daa('0x52')][_0x6daa('0x5a')];return db[_0x6daa('0x4b')]['find']({'where':{'id':_0x155bd1[_0x6daa('0x4f')]['id'],'UserId':null}})[_0x6daa('0x1c')](handleEntityNotFound(_0x417415,null))[_0x6daa('0x1c')](function(_0x548d74){if(_0x548d74){_0x2b16ba[_0x6daa('0x24')]=_0x548d74[_0x6daa('0x5d')]({'plain':!![]});return db[_0x6daa('0x7b')][_0x6daa('0x51')]({'where':{'id':_0x548d74[_0x6daa('0x7c')]}});}return null;})[_0x6daa('0x1c')](handleEntityNotFound(_0x417415,null))[_0x6daa('0x1c')](function(_0x495f8e){if(_0x495f8e){_0x2b16ba[_0x6daa('0x60')]=_0x495f8e[_0x6daa('0x5d')]({'plain':!![]});interaction_log[_0x6daa('0x1d')](_0x6daa('0x7d'),_0x155bd1['user']['id'],_0x155bd1[_0x6daa('0x5b')]['name'],_0x155bd1[_0x6daa('0x5b')][_0x6daa('0x62')],_0x2b16ba[_0x6daa('0x60')]['id'],_0x155bd1['body']?JSON[_0x6daa('0x22')](_0x155bd1[_0x6daa('0x52')]):'null');return respondWithRpcPromise(_0x6daa('0x7e'),_0x6daa('0x7f'),_0x2b16ba);}return null;})[_0x6daa('0x1c')](function(_0x159a33){var _0x35dab0=_0x6daa('0x66')+_0x159a33[_0x6daa('0x24')][_0x6daa('0x67')];return db[_0x6daa('0x68')][_0x6daa('0x3b')](_0x35dab0,{'type':db[_0x6daa('0x69')]['QueryTypes'][_0x6daa('0x6b')],'raw':!![]})[_0x6daa('0x1c')](function(_0x466b42){return _0x466b42;});})[_0x6daa('0x1c')](function(_0x2ee07c){if(_0x2ee07c){_0x2b16ba['message'][_0x6daa('0x6c')]=_0x2ee07c[0x0];if(!_0x155bd1['body'][_0x6daa('0x5a')])return;return db[_0x6daa('0x6d')][_0x6daa('0x51')]({'where':{'id':_0x155bd1[_0x6daa('0x52')]['UserId'],'role':'agent'},'attributes':['id',_0x6daa('0x35'),_0x6daa('0x6e'),_0x6daa('0x6f'),_0x6daa('0x70')],'raw':!![]});}return null;})['then'](function(_0xf922b7){if(!_0xf922b7)return null;_0x2b16ba[_0x6daa('0x24')][_0x6daa('0x5c')]=_0xf922b7;return _0x2b16ba;})['then'](function(_0x79c574){if(_0x79c574){_0x79c574['message']['interface']=util[_0x6daa('0x73')]('SIP/%s',_0x155bd1['user']['name']);_0x79c574[_0x6daa('0x24')][_0x6daa('0x75')]=_0x2b16ba[_0x6daa('0x75')];_0x79c574[_0x6daa('0x24')][_0x6daa('0x76')]=_0x2b16ba[_0x6daa('0x75')];_0x79c574[_0x6daa('0x24')]['event']=_0x6daa('0x32');respondWithRpcPromise(_0x6daa('0x79'),_0x6daa('0x79'),{'event':_0x6daa('0x80'),'message':_0x79c574[_0x6daa('0x24')]},client9002);return _0x2b16ba;}return null;})[_0x6daa('0x1c')](respondWithResult(_0x417415,null))[_0x6daa('0x26')](handleError(_0x417415,null));}; \ No newline at end of file +var _0xdbfa=['OpenchannelInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel','RejectMessage','rejectMessage','ContactId','QueryTypes','motionChannel','rejectmessage','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./openchannelMessage.socket','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','keys','rawAttributes','includeAll','create','body','update','find','params','describe','openchannel-interactions','accept','read','readAt','format','UserId','agent','get','OpenchannelInteraction'];(function(_0x543dd9,_0x17750a){var _0x3d7f0a=function(_0x3a2dab){while(--_0x3a2dab){_0x543dd9['push'](_0x543dd9['shift']());}};_0x3d7f0a(++_0x17750a);}(_0xdbfa,0x128));var _0xadbf=function(_0x1cd1bf,_0x39f948){_0x1cd1bf=_0x1cd1bf-0x0;var _0x4bf01e=_0xdbfa[_0x1cd1bf];return _0x4bf01e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xadbf('0x0'));var rp=require('request-promise');var moment=require(_0xadbf('0x1'));var BPromise=require(_0xadbf('0x2'));var Mustache=require('mustache');var util=require(_0xadbf('0x3'));var path=require(_0xadbf('0x4'));var sox=require(_0xadbf('0x5'));var csv=require(_0xadbf('0x6'));var ejs=require(_0xadbf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadbf('0x8'));var squel=require(_0xadbf('0x9'));var crypto=require(_0xadbf('0xa'));var jsforce=require(_0xadbf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xadbf('0x6'));var querystring=require(_0xadbf('0xc'));var Papa=require(_0xadbf('0xd'));var Redis=require('ioredis');var authService=require(_0xadbf('0xe'));var qs=require(_0xadbf('0xf'));var as=require(_0xadbf('0x10'));var hardwareService=require(_0xadbf('0x11'));var logger=require(_0xadbf('0x12'))(_0xadbf('0x13'));var utils=require(_0xadbf('0x14'));var config=require(_0xadbf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xadbf('0x16'))['db'];config[_0xadbf('0x17')]=_['defaults'](config[_0xadbf('0x17')],{'host':_0xadbf('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xadbf('0x19'))['register'](socket);var jayson=require(_0xadbf('0x1a'));var client=jayson[_0xadbf('0x1b')][_0xadbf('0x1c')]({'port':0x232c});var client9002=jayson[_0xadbf('0x1b')][_0xadbf('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3c4899,_0x1008e5,_0x11b73f,_0x21ee0f){return new BPromise(function(_0x59712,_0x363a34){var _0x3e9de1=_0x21ee0f||client;return _0x3e9de1['request'](_0x3c4899,_0x11b73f)[_0xadbf('0x1d')](function(_0x353028){logger[_0xadbf('0x1e')](_0xadbf('0x1f'),_0x1008e5,_0xadbf('0x20'));logger[_0xadbf('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1008e5,_0xadbf('0x20'),JSON[_0xadbf('0x22')](_0x353028));if(_0x353028[_0xadbf('0x23')]){if(_0x353028[_0xadbf('0x23')][_0xadbf('0x24')]===0x1f4){logger[_0xadbf('0x23')](_0xadbf('0x1f'),_0x1008e5,_0x353028[_0xadbf('0x23')][_0xadbf('0x25')]);return _0x363a34(_0x353028['error'][_0xadbf('0x25')]);}logger[_0xadbf('0x23')](_0xadbf('0x1f'),_0x1008e5,_0x353028[_0xadbf('0x23')]['message']);return _0x59712(_0x353028[_0xadbf('0x23')][_0xadbf('0x25')]);}else{logger[_0xadbf('0x1e')](_0xadbf('0x1f'),_0x1008e5,_0xadbf('0x20'));_0x59712(_0x353028['result']['message']);}})['catch'](function(_0x52da57){logger[_0xadbf('0x23')](_0xadbf('0x1f'),_0x1008e5,_0x52da57);_0x363a34(_0x52da57);});});}function respondWithStatusCode(_0x428735,_0x3c6946){_0x3c6946=_0x3c6946||0xcc;return function(_0x3d7f06){if(_0x3d7f06){return _0x428735['sendStatus'](_0x3c6946);}return _0x428735[_0xadbf('0x26')](_0x3c6946)[_0xadbf('0x27')]();};}function respondWithResult(_0x3989dc,_0x4c0a5b){_0x4c0a5b=_0x4c0a5b||0xc8;return function(_0x199853){if(_0x199853){return _0x3989dc[_0xadbf('0x26')](_0x4c0a5b)[_0xadbf('0x28')](_0x199853);}};}function respondWithFilteredResult(_0x2dcda1,_0x2f3990){return function(_0x10a0bc){if(_0x10a0bc){var _0x35d8ba=typeof _0x2f3990['offset']==='undefined'&&typeof _0x2f3990[_0xadbf('0x29')]===_0xadbf('0x2a');var _0x46213c=_0x10a0bc['count'];var _0xf422d6=_0x35d8ba?0x0:_0x2f3990[_0xadbf('0x2b')];var _0x2555b0=_0x35d8ba?_0x10a0bc['count']:_0x2f3990[_0xadbf('0x2b')]+_0x2f3990[_0xadbf('0x29')];var _0x57a391;if(_0x2555b0>=_0x46213c){_0x2555b0=_0x46213c;_0x57a391=0xc8;}else{_0x57a391=0xce;}_0x2dcda1[_0xadbf('0x26')](_0x57a391);return _0x2dcda1[_0xadbf('0x2c')](_0xadbf('0x2d'),_0xf422d6+'-'+_0x2555b0+'/'+_0x46213c)[_0xadbf('0x28')](_0x10a0bc);}return null;};}function patchUpdates(_0x1a54f8){return function(_0x177243){try{jsonpatch[_0xadbf('0x2e')](_0x177243,_0x1a54f8,!![]);}catch(_0x12b51b){return BPromise[_0xadbf('0x2f')](_0x12b51b);}return _0x177243[_0xadbf('0x30')]();};}function saveUpdates(_0x27d4c7,_0x20f8ce){return function(_0x7f2934){if(_0x7f2934){return _0x7f2934['update'](_0x27d4c7)[_0xadbf('0x1d')](function(_0x5c6b8f){return _0x5c6b8f;});}return null;};}function removeEntity(_0x829aa5,_0x143497){return function(_0x1fe146){if(_0x1fe146){return _0x1fe146[_0xadbf('0x31')]()[_0xadbf('0x1d')](function(){_0x829aa5[_0xadbf('0x26')](0xcc)[_0xadbf('0x27')]();});}};}function handleEntityNotFound(_0x156a44,_0x1e7ebb){return function(_0x1e453c){if(!_0x1e453c){_0x156a44[_0xadbf('0x32')](0x194);}return _0x1e453c;};}function handleError(_0x31ead8,_0x4dd8b6){_0x4dd8b6=_0x4dd8b6||0x1f4;return function(_0x3d81ec){logger[_0xadbf('0x23')](_0x3d81ec[_0xadbf('0x33')]);if(_0x3d81ec[_0xadbf('0x34')]){delete _0x3d81ec[_0xadbf('0x34')];}_0x31ead8['status'](_0x4dd8b6)[_0xadbf('0x35')](_0x3d81ec);};}exports[_0xadbf('0x36')]=function(_0x3be1be,_0x3ac4c8){var _0x39312f={},_0x478420={},_0x2dd8f0={'count':0x0,'rows':[]};var _0x24fa3a=_[_0xadbf('0x37')](db[_0xadbf('0x38')]['rawAttributes'],function(_0x52ee56){return{'name':_0x52ee56['fieldName'],'type':_0x52ee56['type'][_0xadbf('0x39')]};});_0x478420['model']=_['map'](_0x24fa3a,'name');_0x478420[_0xadbf('0x3a')]=_['keys'](_0x3be1be[_0xadbf('0x3a')]);_0x478420[_0xadbf('0x3b')]=_[_0xadbf('0x3c')](_0x478420['model'],_0x478420['query']);_0x39312f[_0xadbf('0x3d')]=_['intersection'](_0x478420['model'],qs[_0xadbf('0x3e')](_0x3be1be[_0xadbf('0x3a')][_0xadbf('0x3e')]));_0x39312f[_0xadbf('0x3d')]=_0x39312f[_0xadbf('0x3d')][_0xadbf('0x3f')]?_0x39312f[_0xadbf('0x3d')]:_0x478420[_0xadbf('0x40')];if(!_0x3be1be[_0xadbf('0x3a')][_0xadbf('0x41')](_0xadbf('0x42'))){_0x39312f[_0xadbf('0x29')]=qs[_0xadbf('0x29')](_0x3be1be['query'][_0xadbf('0x29')]);_0x39312f[_0xadbf('0x2b')]=qs[_0xadbf('0x2b')](_0x3be1be[_0xadbf('0x3a')][_0xadbf('0x2b')]);}_0x39312f[_0xadbf('0x43')]=qs[_0xadbf('0x44')](_0x3be1be[_0xadbf('0x3a')][_0xadbf('0x44')]);_0x39312f[_0xadbf('0x45')]=qs[_0xadbf('0x3b')](_[_0xadbf('0x46')](_0x3be1be['query'],_0x478420[_0xadbf('0x3b')]),_0x24fa3a);if(_0x3be1be[_0xadbf('0x3a')][_0xadbf('0x47')]){_0x39312f['where']=_[_0xadbf('0x48')](_0x39312f[_0xadbf('0x45')],{'$or':_[_0xadbf('0x37')](_0x24fa3a,function(_0x385b55){if(_0x385b55[_0xadbf('0x49')]!==_0xadbf('0x4a')){var _0x5c5537={};_0x5c5537[_0x385b55[_0xadbf('0x34')]]={'$like':'%'+_0x3be1be[_0xadbf('0x3a')][_0xadbf('0x47')]+'%'};return _0x5c5537;}})});}_0x39312f=_[_0xadbf('0x48')]({},_0x39312f,_0x3be1be[_0xadbf('0x4b')]);var _0x169999={'where':_0x39312f[_0xadbf('0x45')]};return db['OpenchannelMessage'][_0xadbf('0x4c')](_0x169999)[_0xadbf('0x1d')](function(_0x20c25a){_0x2dd8f0[_0xadbf('0x4c')]=_0x20c25a;if(_0x3be1be['query']['includeAll']){_0x39312f[_0xadbf('0x4d')]=[{'all':!![]}];}return db[_0xadbf('0x38')][_0xadbf('0x4e')](_0x39312f);})['then'](function(_0x405257){_0x2dd8f0[_0xadbf('0x4f')]=_0x405257;return _0x2dd8f0;})[_0xadbf('0x1d')](respondWithFilteredResult(_0x3ac4c8,_0x39312f))[_0xadbf('0x50')](handleError(_0x3ac4c8,null));};exports[_0xadbf('0x51')]=function(_0x41cc2e,_0x3e49dd){var _0x299ecb={'raw':!![],'where':{'id':_0x41cc2e['params']['id']}},_0x5b8ffd={};_0x5b8ffd[_0xadbf('0x40')]=_[_0xadbf('0x52')](db[_0xadbf('0x38')][_0xadbf('0x53')]);_0x5b8ffd[_0xadbf('0x3a')]=_[_0xadbf('0x52')](_0x41cc2e['query']);_0x5b8ffd['filters']=_[_0xadbf('0x3c')](_0x5b8ffd[_0xadbf('0x40')],_0x5b8ffd[_0xadbf('0x3a')]);_0x299ecb[_0xadbf('0x3d')]=_[_0xadbf('0x3c')](_0x5b8ffd['model'],qs['fields'](_0x41cc2e['query']['fields']));_0x299ecb[_0xadbf('0x3d')]=_0x299ecb['attributes'][_0xadbf('0x3f')]?_0x299ecb[_0xadbf('0x3d')]:_0x5b8ffd[_0xadbf('0x40')];if(_0x41cc2e[_0xadbf('0x3a')][_0xadbf('0x54')]){_0x299ecb[_0xadbf('0x4d')]=[{'all':!![]}];}_0x299ecb=_[_0xadbf('0x48')]({},_0x299ecb,_0x41cc2e['options']);return db[_0xadbf('0x38')]['find'](_0x299ecb)['then'](handleEntityNotFound(_0x3e49dd,null))[_0xadbf('0x1d')](respondWithResult(_0x3e49dd,null))[_0xadbf('0x50')](handleError(_0x3e49dd,null));};exports['create']=function(_0x3196a7,_0x5422be){return db[_0xadbf('0x38')][_0xadbf('0x55')](_0x3196a7[_0xadbf('0x56')],{})[_0xadbf('0x1d')](respondWithResult(_0x5422be,0xc9))[_0xadbf('0x50')](handleError(_0x5422be,null));};exports[_0xadbf('0x57')]=function(_0x410fed,_0x5c2a4c){if(_0x410fed['body']['id']){delete _0x410fed[_0xadbf('0x56')]['id'];}return db[_0xadbf('0x38')][_0xadbf('0x58')]({'where':{'id':_0x410fed[_0xadbf('0x59')]['id']}})[_0xadbf('0x1d')](handleEntityNotFound(_0x5c2a4c,null))[_0xadbf('0x1d')](saveUpdates(_0x410fed['body'],null))['then'](respondWithResult(_0x5c2a4c,null))[_0xadbf('0x50')](handleError(_0x5c2a4c,null));};exports['destroy']=function(_0x5df68a,_0x2d9b29){return db['OpenchannelMessage']['find']({'where':{'id':_0x5df68a[_0xadbf('0x59')]['id']}})[_0xadbf('0x1d')](handleEntityNotFound(_0x2d9b29,null))[_0xadbf('0x1d')](removeEntity(_0x2d9b29,null))['catch'](handleError(_0x2d9b29,null));};exports['describe']=function(_0x627286,_0x2dacff){return db[_0xadbf('0x38')][_0xadbf('0x5a')]()[_0xadbf('0x1d')](respondWithResult(_0x2dacff,null))[_0xadbf('0x50')](handleError(_0x2dacff,null));};var interaction_log=require('../../config/logger')(_0xadbf('0x5b'));exports[_0xadbf('0x5c')]=function(_0x40aa23,_0x1db04b,_0xa67060){var _0x564162={'agent':{},'channel':'openchannel'};if(_0x40aa23[_0xadbf('0x56')]['id']){delete _0x40aa23[_0xadbf('0x56')]['id'];}_0x40aa23[_0xadbf('0x56')][_0xadbf('0x5d')]=!![];_0x40aa23['body'][_0xadbf('0x5e')]=moment()[_0xadbf('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x40aa23[_0xadbf('0x56')]['UserId']=_0x40aa23[_0xadbf('0x56')][_0xadbf('0x60')]||_0x40aa23['user']['id'];_0x564162[_0xadbf('0x61')]['id']=_0x40aa23[_0xadbf('0x56')][_0xadbf('0x60')];return db[_0xadbf('0x38')][_0xadbf('0x58')]({'where':{'id':_0x40aa23['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1db04b,null))[_0xadbf('0x1d')](saveUpdates(_0x40aa23['body'],null))[_0xadbf('0x1d')](function(_0x1f3be0){if(_0x1f3be0){_0x564162[_0xadbf('0x25')]=_0x1f3be0[_0xadbf('0x62')]({'plain':!![]});return db[_0xadbf('0x63')][_0xadbf('0x58')]({'where':{'id':_0x1f3be0[_0xadbf('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1db04b,null))[_0xadbf('0x1d')](function(_0x43fa39){if(_0x43fa39){return _0x43fa39[_0xadbf('0x57')]({'UserId':_0x40aa23[_0xadbf('0x56')][_0xadbf('0x60')],'read1stAt':_[_0xadbf('0x65')](_0x43fa39['read1stAt'])?moment()['format'](_0xadbf('0x66')):undefined});}return null;})[_0xadbf('0x1d')](function(_0x3870ed){if(_0x3870ed){_0x564162[_0xadbf('0x67')]=_0x3870ed[_0xadbf('0x62')]({'plain':!![]});interaction_log[_0xadbf('0x1e')](_0xadbf('0x68'),_0x40aa23[_0xadbf('0x69')]['id'],_0x40aa23[_0xadbf('0x69')][_0xadbf('0x34')],_0x40aa23['user'][_0xadbf('0x6a')],_0x564162[_0xadbf('0x67')]['id'],_0x40aa23['body']?JSON[_0xadbf('0x22')](_0x40aa23['body']):_0xadbf('0x6b'));return respondWithRpcPromise(_0xadbf('0x6c'),'acceptMessage',_0x564162);}return null;})[_0xadbf('0x1d')](function(_0x1cfe65){var _0x366359=_0xadbf('0x6d')+_0x1cfe65['message']['ContactId'];return db[_0xadbf('0x6e')]['query'](_0x366359,{'type':db[_0xadbf('0x6f')]['QueryTypes'][_0xadbf('0x70')],'raw':!![]})[_0xadbf('0x1d')](function(_0x23c12c){return _0x23c12c;});})[_0xadbf('0x1d')](function(_0x43b275){if(_0x43b275){_0x564162[_0xadbf('0x25')][_0xadbf('0x71')]=_0x43b275[0x0];if(!_0x40aa23[_0xadbf('0x56')][_0xadbf('0x60')])return;return db[_0xadbf('0x72')][_0xadbf('0x58')]({'where':{'id':_0x40aa23[_0xadbf('0x56')]['UserId'],'role':_0xadbf('0x61')},'attributes':['id','name',_0xadbf('0x73'),_0xadbf('0x74'),_0xadbf('0x75')],'raw':!![]});}return null;})[_0xadbf('0x1d')](function(_0x5c0d6d){if(!_0x5c0d6d)return null;_0x564162[_0xadbf('0x25')][_0xadbf('0x61')]=_0x5c0d6d;return _0x564162;})[_0xadbf('0x1d')](function(_0x54f92c){if(_0x54f92c){if(_0x40aa23[_0xadbf('0x56')][_0xadbf('0x76')]){_0x564162[_0xadbf('0x25')][_0xadbf('0x77')]=util['format'](_0xadbf('0x78'),_0x40aa23[_0xadbf('0x69')][_0xadbf('0x34')]);_0x564162[_0xadbf('0x25')][_0xadbf('0x79')]=_0x564162[_0xadbf('0x79')];_0x564162['message']['motionChannel']=_0x564162['channel'];_0x564162[_0xadbf('0x25')][_0xadbf('0x7a')]=_0xadbf('0x5c');return respondWithRpcPromise(_0xadbf('0x7b'),_0xadbf('0x7b'),{'event':_0xadbf('0x7c'),'message':_0x564162[_0xadbf('0x25')]},client9002)[_0xadbf('0x1d')](function(){return _0x564162;});}return _0x564162;}return null;})['then'](respondWithResult(_0x1db04b,null))['catch'](handleError(_0x1db04b,null));};var interaction_log=require(_0xadbf('0x12'))('openchannel-interactions');exports[_0xadbf('0x2f')]=function(_0x42d447,_0x18a609,_0x2ab795){var _0x168269={'agent':{},'channel':_0xadbf('0x7d')};if(_0x42d447[_0xadbf('0x56')]['id']){delete _0x42d447[_0xadbf('0x56')]['id'];}_0x42d447[_0xadbf('0x56')]['UserId']=_0x42d447[_0xadbf('0x56')]['UserId']||_0x42d447[_0xadbf('0x69')]['id'];_0x168269[_0xadbf('0x61')]['id']=_0x42d447[_0xadbf('0x56')][_0xadbf('0x60')];return db['OpenchannelMessage'][_0xadbf('0x58')]({'where':{'id':_0x42d447['params']['id'],'UserId':null}})[_0xadbf('0x1d')](handleEntityNotFound(_0x18a609,null))[_0xadbf('0x1d')](function(_0x398a7d){if(_0x398a7d){_0x168269[_0xadbf('0x25')]=_0x398a7d[_0xadbf('0x62')]({'plain':!![]});return db[_0xadbf('0x63')]['find']({'where':{'id':_0x398a7d[_0xadbf('0x64')]}});}return null;})[_0xadbf('0x1d')](handleEntityNotFound(_0x18a609,null))[_0xadbf('0x1d')](function(_0x1b6af5){if(_0x1b6af5){_0x168269[_0xadbf('0x67')]=_0x1b6af5[_0xadbf('0x62')]({'plain':!![]});interaction_log[_0xadbf('0x1e')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x42d447['user']['id'],_0x42d447['user']['name'],_0x42d447['user'][_0xadbf('0x6a')],_0x168269['interaction']['id'],_0x42d447[_0xadbf('0x56')]?JSON[_0xadbf('0x22')](_0x42d447['body']):_0xadbf('0x6b'));return respondWithRpcPromise(_0xadbf('0x7e'),_0xadbf('0x7f'),_0x168269);}return null;})['then'](function(_0x2c3c6d){var _0x54b0e2=_0xadbf('0x6d')+_0x2c3c6d[_0xadbf('0x25')][_0xadbf('0x80')];return db[_0xadbf('0x6e')][_0xadbf('0x3a')](_0x54b0e2,{'type':db[_0xadbf('0x6f')][_0xadbf('0x81')][_0xadbf('0x70')],'raw':!![]})[_0xadbf('0x1d')](function(_0x2fab32){return _0x2fab32;});})[_0xadbf('0x1d')](function(_0x2d0f0a){if(_0x2d0f0a){_0x168269['message'][_0xadbf('0x71')]=_0x2d0f0a[0x0];if(!_0x42d447[_0xadbf('0x56')][_0xadbf('0x60')])return;return db[_0xadbf('0x72')]['find']({'where':{'id':_0x42d447[_0xadbf('0x56')]['UserId'],'role':_0xadbf('0x61')},'attributes':['id','name',_0xadbf('0x73'),_0xadbf('0x74'),_0xadbf('0x75')],'raw':!![]});}return null;})['then'](function(_0x599df7){if(!_0x599df7)return null;_0x168269['message']['agent']=_0x599df7;return _0x168269;})[_0xadbf('0x1d')](function(_0x456f55){if(_0x456f55){_0x456f55['message']['interface']=util[_0xadbf('0x5f')](_0xadbf('0x78'),_0x42d447['user'][_0xadbf('0x34')]);_0x456f55[_0xadbf('0x25')][_0xadbf('0x79')]=_0x168269[_0xadbf('0x79')];_0x456f55[_0xadbf('0x25')][_0xadbf('0x82')]=_0x168269[_0xadbf('0x79')];_0x456f55[_0xadbf('0x25')][_0xadbf('0x7a')]=_0xadbf('0x2f');respondWithRpcPromise(_0xadbf('0x7b'),_0xadbf('0x7b'),{'event':_0xadbf('0x83'),'message':_0x456f55['message']},client9002);return _0x168269;}return null;})[_0xadbf('0x1d')](respondWithResult(_0x18a609,null))[_0xadbf('0x50')](handleError(_0x18a609,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a43b537..5a1e2ad 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 _0x3b73=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x192772,_0x100b16){var _0x2b50bd=function(_0x3cbf90){while(--_0x3cbf90){_0x192772['push'](_0x192772['shift']());}};_0x2b50bd(++_0x100b16);}(_0x3b73,0x15e));var _0x33b7=function(_0x2c2b54,_0x35a836){_0x2c2b54=_0x2c2b54-0x0;var _0x2f4848=_0x3b73[_0x2c2b54];return _0x2f4848;};'use strict';var EventEmitter=require(_0x33b7('0x0'));var OpenchannelMessage=require(_0x33b7('0x1'))['db'][_0x33b7('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x33b7('0x3')](0x0);var events={'afterCreate':_0x33b7('0x4'),'afterUpdate':_0x33b7('0x5'),'afterDestroy':_0x33b7('0x6')};function emitEvent(_0xb2146a){return function(_0x129eb6,_0x475c51,_0x5924eb){OpenchannelMessageEvents[_0x33b7('0x7')](_0xb2146a+':'+_0x129eb6['id'],_0x129eb6);OpenchannelMessageEvents[_0x33b7('0x7')](_0xb2146a,_0x129eb6);_0x5924eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x33b7('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xb9ab=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1e8c23,_0x3a2cbd){var _0x5545a9=function(_0x5ecd8d){while(--_0x5ecd8d){_0x1e8c23['push'](_0x1e8c23['shift']());}};_0x5545a9(++_0x3a2cbd);}(_0xb9ab,0xef));var _0xbb9a=function(_0x47b80a,_0x14ccc0){_0x47b80a=_0x47b80a-0x0;var _0x35d4e8=_0xb9ab[_0x47b80a];return _0x35d4e8;};'use strict';var EventEmitter=require(_0xbb9a('0x0'));var OpenchannelMessage=require(_0xbb9a('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbb9a('0x2')](0x0);var events={'afterCreate':_0xbb9a('0x3'),'afterUpdate':_0xbb9a('0x4'),'afterDestroy':_0xbb9a('0x5')};function emitEvent(_0xfd35ac){return function(_0x347c21,_0x104caa,_0x3a0120){OpenchannelMessageEvents[_0xbb9a('0x6')](_0xfd35ac+':'+_0x347c21['id'],_0x347c21);OpenchannelMessageEvents['emit'](_0xfd35ac,_0x347c21);_0x3a0120(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xbb9a('0x7')](e,emitEvent(event));}}module[_0xbb9a('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 03d69d2..bd1950f 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 _0x1553=['finally','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','CmContact','describe','find','OpenchannelAccountId','OpenchannelInteraction','Contact','keys','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Interaction','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect'];(function(_0x18281d,_0x28e8db){var _0x2365e8=function(_0x5068aa){while(--_0x5068aa){_0x18281d['push'](_0x18281d['shift']());}};_0x2365e8(++_0x28e8db);}(_0x1553,0xd6));var _0x3155=function(_0xb0f253,_0x476cc1){_0xb0f253=_0xb0f253-0x0;var _0x25dbbe=_0x1553[_0xb0f253];return _0x25dbbe;};'use strict';var _=require('lodash');var util=require(_0x3155('0x0'));var logger=require(_0x3155('0x1'))(_0x3155('0x2'));var moment=require('moment');var BPromise=require(_0x3155('0x3'));var rp=require(_0x3155('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3155('0x5'));var config=require(_0x3155('0x6'));var attributes=require(_0x3155('0x7'));module[_0x3155('0x8')]=function(_0x119217,_0x10b2fc){return _0x119217[_0x3155('0x9')](_0x3155('0xa'),attributes,{'tableName':_0x3155('0xb'),'paranoid':![],'indexes':[{'name':_0x3155('0xc'),'fields':[_0x3155('0xd')],'type':_0x3155('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x221eb6,_0x150eab,_0x25d1b8){var _0x480e18=_0x119217['models'];var _0x2edb4f=_0x221eb6[_0x3155('0xf')]({'plain':!![]});if(_0x2edb4f[_0x3155('0x10')][_0x3155('0x11')]()==='in'||_0x2edb4f[_0x3155('0x10')]['toLowerCase']()===_0x3155('0x12')&&!_0x2edb4f['secret']&&!_[_0x3155('0x13')](_0x2edb4f[_0x3155('0x14')])){_0x480e18['OpenchannelInteraction'][_0x3155('0x15')]({'where':{'id':_0x2edb4f[_0x3155('0x16')]}})[_0x3155('0x17')](function(_0x42afd3){if(_0x42afd3){_0x42afd3[_0x3155('0x18')]({'lastMsgAt':_0x2edb4f[_0x3155('0x19')],'lastMsgDirection':_0x2edb4f[_0x3155('0x10')][_0x3155('0x11')]()});}})[_0x3155('0x1a')](function(_0x391624){console[_0x3155('0x1b')](_0x391624);});}if(_0x2edb4f[_0x3155('0x10')]===_0x3155('0x12')&&!_0x2edb4f[_0x3155('0x1c')]){var _0x256776;_0x480e18[_0x3155('0x1d')][_0x3155('0x1e')]()[_0x3155('0x17')](function(_0xd0c70){return _0x480e18['OpenchannelAccount'][_0x3155('0x1f')]({'where':{'id':_0x2edb4f[_0x3155('0x20')]},'include':[{'model':_0x480e18[_0x3155('0x21')],'as':'Interactions','where':{'id':_0x2edb4f['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x480e18[_0x3155('0x1d')],'as':_0x3155('0x22'),'attributes':_[_0x3155('0x23')](_0xd0c70)}]}]});})[_0x3155('0x17')](function(_0x20892c){_0x256776=_0x20892c[_0x3155('0xf')]({'plain':!![]});if(_0x256776&&_0x256776['replyUri']){logger[_0x3155('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x3155('0x25'),util[_0x3155('0x26')](_0x3155('0x27'),_0x2edb4f['id'],_0x256776[_0x3155('0x28')]));if(_0x256776['Interactions']&&_0x256776[_0x3155('0x29')][_0x3155('0x2a')]){_0x2edb4f[_0x3155('0x2b')]=_['omit'](_0x256776[_0x3155('0x29')][0x0],_0x3155('0x22'));_0x2edb4f['Contact']=_0x256776[_0x3155('0x29')][0x0][_0x3155('0x22')];}var _0x150eab={'method':_0x3155('0x2c'),'uri':encodeURI(_0x256776[_0x3155('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x150eab[_0x3155('0x2d')]){case _0x3155('0x2e'):_0x150eab['qs']=_0x2edb4f;break;case _0x3155('0x2c'):_0x150eab[_0x3155('0xd')]=_0x2edb4f;break;}return rp(_0x150eab)['then'](function(_0x3e36aa){logger[_0x3155('0x24')](_0x3155('0x2f'),_0x3155('0x25'),util[_0x3155('0x26')](_0x3155('0x30'),_0x2edb4f['id'],_0x256776[_0x3155('0x28')]));if(_0x3e36aa[_0x3155('0xd')][_0x3155('0x31')]&&_0x3e36aa[_0x3155('0xd')][_0x3155('0x31')]!=_0x2edb4f[_0x3155('0x2b')][_0x3155('0x31')]){return _0x480e18[_0x3155('0x21')][_0x3155('0x18')]({'threadId':_0x3e36aa[_0x3155('0xd')][_0x3155('0x31')]},{'where':{'id':_0x2edb4f[_0x3155('0x2b')]['id']}});}else{return;}})[_0x3155('0x17')](function(){return _0x221eb6[_0x3155('0x18')]({'read':!![]});})['catch'](function(_0x46303f){logger[_0x3155('0x1b')](_0x3155('0x2f'),_0x3155('0x25'),util[_0x3155('0x32')](_0x46303f,{'showHidden':![],'depth':null}));_0x25d1b8();});}else{_0x25d1b8();}})[_0x3155('0x33')](function(){_0x25d1b8();});}else{_0x25d1b8();}}},'charset':'utf8mb4','collate':_0x3155('0x34')});}; \ No newline at end of file +var _0x403c=['Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','error','OpenchannelMessage,\x20%s,\x20%s','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','catch','describe','find','OpenchannelAccountId','Interactions','CmContact','keys','get','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit'];(function(_0x2a2e72,_0x1de962){var _0x3cfb4a=function(_0x3d435c){while(--_0x3d435c){_0x2a2e72['push'](_0x2a2e72['shift']());}};_0x3cfb4a(++_0x1de962);}(_0x403c,0x1e9));var _0xc403=function(_0x4cadff,_0x1f485a){_0x4cadff=_0x4cadff-0x0;var _0x1cb969=_0x403c[_0x4cadff];return _0x1cb969;};'use strict';var _=require(_0xc403('0x0'));var util=require('util');var logger=require(_0xc403('0x1'))(_0xc403('0x2'));var moment=require(_0xc403('0x3'));var BPromise=require(_0xc403('0x4'));var rp=require(_0xc403('0x5'));var fs=require('fs');var path=require(_0xc403('0x6'));var rimraf=require(_0xc403('0x7'));var config=require(_0xc403('0x8'));var attributes=require(_0xc403('0x9'));module[_0xc403('0xa')]=function(_0x545463,_0x43c905){return _0x545463[_0xc403('0xb')]('OpenchannelMessage',attributes,{'tableName':_0xc403('0xc'),'paranoid':![],'indexes':[{'name':_0xc403('0xd'),'fields':[_0xc403('0xe')],'type':_0xc403('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe9bac6,_0x1b65de,_0x4bf9e0){var _0x2f3708=_0x545463['models'];var _0x3f3cee=_0xe9bac6['get']({'plain':!![]});if(_0x3f3cee[_0xc403('0x10')]['toLowerCase']()==='in'||_0x3f3cee[_0xc403('0x10')][_0xc403('0x11')]()===_0xc403('0x12')&&!_0x3f3cee[_0xc403('0x13')]&&!_[_0xc403('0x14')](_0x3f3cee[_0xc403('0x15')])){_0x2f3708[_0xc403('0x16')][_0xc403('0x17')]({'where':{'id':_0x3f3cee[_0xc403('0x18')]}})[_0xc403('0x19')](function(_0x1bf529){if(_0x1bf529){_0x1bf529['update']({'lastMsgAt':_0x3f3cee['createdAt'],'lastMsgDirection':_0x3f3cee[_0xc403('0x10')][_0xc403('0x11')]()});}})[_0xc403('0x1a')](function(_0x2c4b81){console['error'](_0x2c4b81);});}if(_0x3f3cee[_0xc403('0x10')]==='out'&&!_0x3f3cee[_0xc403('0x13')]){var _0x12c33d;_0x2f3708['CmContact'][_0xc403('0x1b')]()[_0xc403('0x19')](function(_0x3fde18){return _0x2f3708['OpenchannelAccount'][_0xc403('0x1c')]({'where':{'id':_0x3f3cee[_0xc403('0x1d')]},'include':[{'model':_0x2f3708[_0xc403('0x16')],'as':_0xc403('0x1e'),'where':{'id':_0x3f3cee['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x2f3708[_0xc403('0x1f')],'as':'Contact','attributes':_[_0xc403('0x20')](_0x3fde18)}]}]});})[_0xc403('0x19')](function(_0x1aa6fa){_0x12c33d=_0x1aa6fa[_0xc403('0x21')]({'plain':!![]});if(_0x12c33d&&_0x12c33d[_0xc403('0x22')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xc403('0x23'),util[_0xc403('0x24')](_0xc403('0x25'),_0x3f3cee['id'],_0x12c33d[_0xc403('0x22')]));if(_0x12c33d['Interactions']&&_0x12c33d[_0xc403('0x1e')][_0xc403('0x26')]){_0x3f3cee[_0xc403('0x27')]=_[_0xc403('0x28')](_0x12c33d['Interactions'][0x0],_0xc403('0x29'));_0x3f3cee[_0xc403('0x29')]=_0x12c33d[_0xc403('0x1e')][0x0][_0xc403('0x29')];}var _0x1b65de={'method':_0xc403('0x2a'),'uri':encodeURI(_0x12c33d[_0xc403('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1b65de[_0xc403('0x2b')]){case _0xc403('0x2c'):_0x1b65de['qs']=_0x3f3cee;break;case'POST':_0x1b65de[_0xc403('0xe')]=_0x3f3cee;break;}return rp(_0x1b65de)[_0xc403('0x19')](function(_0x320f43){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xc403('0x23'),util[_0xc403('0x24')](_0xc403('0x2d'),_0x3f3cee['id'],_0x12c33d[_0xc403('0x22')]));if(_0x320f43[_0xc403('0xe')][_0xc403('0x2e')]&&_0x320f43[_0xc403('0xe')][_0xc403('0x2e')]!=_0x3f3cee['Interaction'][_0xc403('0x2e')]){return _0x2f3708[_0xc403('0x16')]['update']({'threadId':_0x320f43[_0xc403('0xe')]['threadId']},{'where':{'id':_0x3f3cee[_0xc403('0x27')]['id']}});}else{return;}})[_0xc403('0x19')](function(){return _0xe9bac6[_0xc403('0x2f')]({'read':!![]});})['catch'](function(_0x315059){logger[_0xc403('0x30')](_0xc403('0x31'),_0xc403('0x23'),util[_0xc403('0x32')](_0x315059,{'showHidden':![],'depth':null}));_0x4bf9e0();});}else{_0x4bf9e0();}})['finally'](function(){_0x4bf9e0();});}else{_0x4bf9e0();}}},'charset':_0xc403('0x33'),'collate':_0xc403('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d41ee0c..10a274a 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x58e522,_0x2568d8){var _0x317e70=function(_0x9e0d99){while(--_0x9e0d99){_0x58e522['push'](_0x58e522['shift']());}};_0x317e70(++_0x2568d8);}(_0x7a54,0x106));var _0x47a5=function(_0x2ca28f,_0x22c8c9){_0x2ca28f=_0x2ca28f-0x0;var _0x3aa24c=_0x7a54[_0x2ca28f];return _0x3aa24c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +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(_0x98e5fb,_0x7c666e){var _0x33890d=function(_0x2d6dee){while(--_0x2d6dee){_0x98e5fb['push'](_0x98e5fb['shift']());}};_0x33890d(++_0x7c666e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b969ddf..64451d7 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 _0x67da=['register','./openchannelMessage.events','update','emit','removeListener'];(function(_0x3424bc,_0x465332){var _0x55fe91=function(_0x3c848c){while(--_0x3c848c){_0x3424bc['push'](_0x3424bc['shift']());}};_0x55fe91(++_0x465332);}(_0x67da,0x15f));var _0xa67d=function(_0x2f0846,_0x370a5c){_0x2f0846=_0x2f0846-0x0;var _0x79b37b=_0x67da[_0x2f0846];return _0x79b37b;};'use strict';var OpenchannelMessageEvents=require(_0xa67d('0x0'));var events=['save','remove',_0xa67d('0x1')];function createListener(_0xbc2bb2,_0x24844d){return function(_0x1b0a52){_0x24844d[_0xa67d('0x2')](_0xbc2bb2,_0x1b0a52);};}function removeListener(_0x3ad677,_0x313d2e){return function(){OpenchannelMessageEvents[_0xa67d('0x3')](_0x3ad677,_0x313d2e);};}exports[_0xa67d('0x4')]=function(_0x402df8){for(var _0x34a677=0x0,_0xc590bd=events['length'];_0x34a677<_0xc590bd;_0x34a677++){var _0xed18cc=events[_0x34a677];var _0x3f38e2=createListener('openchannelMessage:'+_0xed18cc,_0x402df8);OpenchannelMessageEvents['on'](_0xed18cc,_0x3f38e2);}}; \ No newline at end of file +var _0x1220=['emit','length','./openchannelMessage.events','save'];(function(_0x1b6af5,_0x2f49be){var _0x42f39b=function(_0x43838d){while(--_0x43838d){_0x1b6af5['push'](_0x1b6af5['shift']());}};_0x42f39b(++_0x2f49be);}(_0x1220,0x8a));var _0x0122=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1220[_0x53ccf2];return _0x5a2964;};'use strict';var OpenchannelMessageEvents=require(_0x0122('0x0'));var events=[_0x0122('0x1'),'remove','update'];function createListener(_0x4842aa,_0x1b23e6){return function(_0xebad2b){_0x1b23e6[_0x0122('0x2')](_0x4842aa,_0xebad2b);};}function removeListener(_0x400a17,_0x2876f4){return function(){OpenchannelMessageEvents['removeListener'](_0x400a17,_0x2876f4);};}exports['register']=function(_0x300dfe){for(var _0x33bd09=0x0,_0x8b4dca=events[_0x0122('0x3')];_0x33bd09<_0x8b4dca;_0x33bd09++){var _0x5b72e5=events[_0x33bd09];var _0x38e810=createListener('openchannelMessage:'+_0x5b72e5,_0x300dfe);OpenchannelMessageEvents['on'](_0x5b72e5,_0x38e810);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4f25cd4..49ebf3f 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 _0x9d59=['/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','put','update','delete','removeTeams','removeAgents','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9d59,0x1bf));var _0x99d5=function(_0x4fbf43,_0x10d6ac){_0x4fbf43=_0x4fbf43-0x0;var _0x59b22c=_0x9d59[_0x4fbf43];return _0x59b22c;};'use strict';var multer=require(_0x99d5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x99d5('0x1'));var router=express[_0x99d5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x99d5('0x3'));var interaction=require(_0x99d5('0x4'));var config=require(_0x99d5('0x5'));var controller=require(_0x99d5('0x6'));router[_0x99d5('0x7')]('/',auth[_0x99d5('0x8')](),controller['index']);router['get'](_0x99d5('0x9'),auth['isAuthenticated'](),controller[_0x99d5('0xa')]);router['get'](_0x99d5('0xb'),auth[_0x99d5('0x8')](),controller[_0x99d5('0xc')]);router[_0x99d5('0x7')]('/:id/members',auth[_0x99d5('0x8')](),controller[_0x99d5('0xd')]);router[_0x99d5('0x7')](_0x99d5('0xe'),auth[_0x99d5('0x8')](),controller[_0x99d5('0xf')]);router[_0x99d5('0x7')](_0x99d5('0x10'),auth[_0x99d5('0x8')](),controller['getAgents']);router[_0x99d5('0x11')]('/',auth[_0x99d5('0x8')](),controller['create']);router[_0x99d5('0x11')](_0x99d5('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x99d5('0x11')]('/:id/users',auth[_0x99d5('0x8')](),controller[_0x99d5('0x12')]);router[_0x99d5('0x13')]('/:id',auth[_0x99d5('0x8')](),controller[_0x99d5('0x14')]);router[_0x99d5('0x15')]('/:id',auth[_0x99d5('0x8')](),controller['destroy']);router[_0x99d5('0x15')](_0x99d5('0xe'),auth['isAuthenticated'](),controller[_0x99d5('0x16')]);router[_0x99d5('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x99d5('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8ba5=['update','delete','destroy','removeTeams','removeAgents','multer','util','path','Router','fs-extra','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/users','getAgents','post','create','addTeams','addAgents'];(function(_0x2c16c2,_0x2b1ed5){var _0x22c7d5=function(_0x1f9196){while(--_0x1f9196){_0x2c16c2['push'](_0x2c16c2['shift']());}};_0x22c7d5(++_0x2b1ed5);}(_0x8ba5,0x9b));var _0x58ba=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0x8ba5[_0x5426e2];return _0x920dc;};'use strict';var multer=require(_0x58ba('0x0'));var util=require(_0x58ba('0x1'));var path=require(_0x58ba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x58ba('0x3')]();var fs_extra=require(_0x58ba('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x58ba('0x5'));router[_0x58ba('0x6')]('/',auth['isAuthenticated'](),controller[_0x58ba('0x7')]);router['get'](_0x58ba('0x8'),auth[_0x58ba('0x9')](),controller[_0x58ba('0xa')]);router['get'](_0x58ba('0xb'),auth[_0x58ba('0x9')](),controller[_0x58ba('0xc')]);router['get']('/:id/members',auth[_0x58ba('0x9')](),controller[_0x58ba('0xd')]);router[_0x58ba('0x6')]('/:id/teams',auth[_0x58ba('0x9')](),controller['getTeams']);router[_0x58ba('0x6')](_0x58ba('0xe'),auth[_0x58ba('0x9')](),controller[_0x58ba('0xf')]);router[_0x58ba('0x10')]('/',auth[_0x58ba('0x9')](),controller[_0x58ba('0x11')]);router[_0x58ba('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0x58ba('0x12')]);router['post'](_0x58ba('0xe'),auth['isAuthenticated'](),controller[_0x58ba('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x58ba('0x14')]);router[_0x58ba('0x15')]('/:id',auth[_0x58ba('0x9')](),controller[_0x58ba('0x16')]);router[_0x58ba('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x58ba('0x17')]);router[_0x58ba('0x15')](_0x58ba('0xe'),auth[_0x58ba('0x9')](),controller[_0x58ba('0x18')]);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 5b3d968..fac5e9a 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 _0x0207=['beepall','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x488b74,_0x1d3896){var _0x1c5d63=function(_0x3fc05f){while(--_0x3fc05f){_0x488b74['push'](_0x488b74['shift']());}};_0x1c5d63(++_0x1d3896);}(_0x0207,0x17b));var _0x7020=function(_0x3d9857,_0x7e310d){_0x3d9857=_0x3d9857-0x0;var _0x1390a5=_0x0207[_0x3d9857];return _0x1390a5;};'use strict';var Sequelize=require('sequelize');module[_0x7020('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7020('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7020('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7020('0x3')](_0x7020('0x4'),_0x7020('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x04ab=['beepall','roundrobin','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x04ab,0x8e));var _0xb04a=function(_0xf54dca,_0x51aef7){_0xf54dca=_0xf54dca-0x0;var _0x58286f=_0x04ab[_0xf54dca];return _0x58286f;};'use strict';var Sequelize=require(_0xb04a('0x0'));module[_0xb04a('0x1')]={'name':{'type':Sequelize[_0xb04a('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb04a('0x3')](_0xb04a('0x4'),_0xb04a('0x5'),_0xb04a('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index cffc9ce..f3df748 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 _0xba88=['localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error','stack','name','send','index','OpenchannelQueue','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','updatedAt','createdAt','rows','format','SIP','getTeams','ids','Team','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xba88,0x104));var _0x8ba8=function(_0xab21fa,_0x582688){_0xab21fa=_0xab21fa-0x0;var _0x39a05a=_0xba88[_0xab21fa];return _0x39a05a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8ba8('0x0'));var jsonpatch=require(_0x8ba8('0x1'));var rp=require('request-promise');var moment=require(_0x8ba8('0x2'));var BPromise=require(_0x8ba8('0x3'));var Mustache=require(_0x8ba8('0x4'));var util=require('util');var path=require(_0x8ba8('0x5'));var sox=require('sox');var csv=require(_0x8ba8('0x6'));var ejs=require(_0x8ba8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ba8('0x8'));var squel=require(_0x8ba8('0x9'));var crypto=require(_0x8ba8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8ba8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8ba8('0xc'));var Papa=require('papaparse');var Redis=require(_0x8ba8('0xd'));var authService=require(_0x8ba8('0xe'));var qs=require(_0x8ba8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ba8('0x10'));var logger=require(_0x8ba8('0x11'))(_0x8ba8('0x12'));var utils=require(_0x8ba8('0x13'));var config=require(_0x8ba8('0x14'));var licenseUtil=require(_0x8ba8('0x15'));var db=require('../../mysqldb')['db'];config[_0x8ba8('0x16')]=_[_0x8ba8('0x17')](config['redis'],{'host':_0x8ba8('0x18'),'port':0x18eb});var socket=require(_0x8ba8('0x19'))(new Redis(config[_0x8ba8('0x16')]));require(_0x8ba8('0x1a'))[_0x8ba8('0x1b')](socket);function respondWithStatusCode(_0x21e2a7,_0xc06a3c){_0xc06a3c=_0xc06a3c||0xcc;return function(_0x47f26d){if(_0x47f26d){return _0x21e2a7[_0x8ba8('0x1c')](_0xc06a3c);}return _0x21e2a7[_0x8ba8('0x1d')](_0xc06a3c)[_0x8ba8('0x1e')]();};}function respondWithResult(_0x4b13da,_0x4d51d0){_0x4d51d0=_0x4d51d0||0xc8;return function(_0x25ea42){if(_0x25ea42){return _0x4b13da['status'](_0x4d51d0)['json'](_0x25ea42);}};}function respondWithFilteredResult(_0x493a41,_0x4b1cc6){return function(_0x5ec916){if(_0x5ec916){var _0x1c630=typeof _0x4b1cc6[_0x8ba8('0x1f')]==='undefined'&&typeof _0x4b1cc6[_0x8ba8('0x20')]===_0x8ba8('0x21');var _0x32c797=_0x5ec916['count'];var _0x5dedf9=_0x1c630?0x0:_0x4b1cc6['offset'];var _0x27fdf2=_0x1c630?_0x5ec916[_0x8ba8('0x22')]:_0x4b1cc6['offset']+_0x4b1cc6[_0x8ba8('0x20')];var _0x3eda7f;if(_0x27fdf2>=_0x32c797){_0x27fdf2=_0x32c797;_0x3eda7f=0xc8;}else{_0x3eda7f=0xce;}_0x493a41[_0x8ba8('0x1d')](_0x3eda7f);return _0x493a41[_0x8ba8('0x23')](_0x8ba8('0x24'),_0x5dedf9+'-'+_0x27fdf2+'/'+_0x32c797)[_0x8ba8('0x25')](_0x5ec916);}return null;};}function patchUpdates(_0x22fa94){return function(_0x2bd2b1){try{jsonpatch[_0x8ba8('0x26')](_0x2bd2b1,_0x22fa94,!![]);}catch(_0x417af4){return BPromise[_0x8ba8('0x27')](_0x417af4);}return _0x2bd2b1[_0x8ba8('0x28')]();};}function saveUpdates(_0x48fc6c,_0x293ba0){return function(_0x5e2dc0){if(_0x5e2dc0){return _0x5e2dc0[_0x8ba8('0x29')](_0x48fc6c)['then'](function(_0x2cab76){return _0x2cab76;});}return null;};}function removeEntity(_0x2e0145,_0x4c3856){return function(_0x4739ac){if(_0x4739ac){return _0x4739ac[_0x8ba8('0x2a')]()[_0x8ba8('0x2b')](function(){var _0x2e52d7=_0x4739ac[_0x8ba8('0x2c')]({'plain':!![]});var _0x186cb4=_0x8ba8('0x2d');return db['UserProfileResource'][_0x8ba8('0x2a')]({'where':{'type':_0x186cb4,'resourceId':_0x2e52d7['id']}})['then'](function(){return _0x4739ac;});})[_0x8ba8('0x2b')](function(){_0x2e0145['status'](0xcc)[_0x8ba8('0x1e')]();});}};}function handleEntityNotFound(_0x226430,_0x537041){return function(_0x5ec287){if(!_0x5ec287){_0x226430[_0x8ba8('0x1c')](0x194);}return _0x5ec287;};}function handleError(_0x28fcf1,_0x3d8a9a){_0x3d8a9a=_0x3d8a9a||0x1f4;return function(_0x3d4608){logger[_0x8ba8('0x2e')](_0x3d4608[_0x8ba8('0x2f')]);if(_0x3d4608[_0x8ba8('0x30')]){delete _0x3d4608['name'];}_0x28fcf1[_0x8ba8('0x1d')](_0x3d8a9a)[_0x8ba8('0x31')](_0x3d4608);};}exports[_0x8ba8('0x32')]=function(_0x1cdfdf,_0x25ce85){var _0x46ff5e={},_0x53dadd={},_0x58b42e={'count':0x0,'rows':[]};var _0x16f299=_['map'](db[_0x8ba8('0x33')]['rawAttributes'],function(_0x20e1ec){return{'name':_0x20e1ec[_0x8ba8('0x34')],'type':_0x20e1ec[_0x8ba8('0x35')][_0x8ba8('0x36')]};});_0x53dadd[_0x8ba8('0x37')]=_[_0x8ba8('0x38')](_0x16f299,_0x8ba8('0x30'));_0x53dadd['query']=_[_0x8ba8('0x39')](_0x1cdfdf['query']);_0x53dadd[_0x8ba8('0x3a')]=_[_0x8ba8('0x3b')](_0x53dadd[_0x8ba8('0x37')],_0x53dadd[_0x8ba8('0x3c')]);_0x46ff5e[_0x8ba8('0x3d')]=_[_0x8ba8('0x3b')](_0x53dadd[_0x8ba8('0x37')],qs['fields'](_0x1cdfdf['query'][_0x8ba8('0x3e')]));_0x46ff5e[_0x8ba8('0x3d')]=_0x46ff5e[_0x8ba8('0x3d')]['length']?_0x46ff5e[_0x8ba8('0x3d')]:_0x53dadd['model'];if(!_0x1cdfdf['query'][_0x8ba8('0x3f')](_0x8ba8('0x40'))){_0x46ff5e[_0x8ba8('0x20')]=qs['limit'](_0x1cdfdf[_0x8ba8('0x3c')][_0x8ba8('0x20')]);_0x46ff5e['offset']=qs[_0x8ba8('0x1f')](_0x1cdfdf[_0x8ba8('0x3c')][_0x8ba8('0x1f')]);}_0x46ff5e[_0x8ba8('0x41')]=qs[_0x8ba8('0x42')](_0x1cdfdf[_0x8ba8('0x3c')]['sort']);_0x46ff5e[_0x8ba8('0x43')]=qs[_0x8ba8('0x3a')](_[_0x8ba8('0x44')](_0x1cdfdf['query'],_0x53dadd[_0x8ba8('0x3a')]),_0x16f299);if(_0x1cdfdf[_0x8ba8('0x3c')][_0x8ba8('0x45')]){_0x46ff5e['where']=_[_0x8ba8('0x46')](_0x46ff5e[_0x8ba8('0x43')],{'$or':_['map'](_0x16f299,function(_0x1e3f21){if(_0x1e3f21['type']!==_0x8ba8('0x47')){var _0x4e8dea={};_0x4e8dea[_0x1e3f21[_0x8ba8('0x30')]]={'$like':'%'+_0x1cdfdf[_0x8ba8('0x3c')]['filter']+'%'};return _0x4e8dea;}})});}_0x46ff5e=_[_0x8ba8('0x46')]({},_0x46ff5e,_0x1cdfdf[_0x8ba8('0x48')]);var _0x4dabb0={'where':_0x46ff5e[_0x8ba8('0x43')]};return db[_0x8ba8('0x33')]['count'](_0x4dabb0)['then'](function(_0x2d72f6){_0x58b42e[_0x8ba8('0x22')]=_0x2d72f6;if(_0x1cdfdf['query'][_0x8ba8('0x49')]){_0x46ff5e[_0x8ba8('0x4a')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x8ba8('0x4b')](_0x46ff5e);})[_0x8ba8('0x2b')](function(_0x5dca80){_0x58b42e['rows']=_0x5dca80;return _0x58b42e;})['then'](respondWithFilteredResult(_0x25ce85,_0x46ff5e))[_0x8ba8('0x4c')](handleError(_0x25ce85,null));};exports[_0x8ba8('0x4d')]=function(_0x2ee7da,_0x2727b4){var _0x17a183={'raw':!![],'where':{'id':_0x2ee7da[_0x8ba8('0x4e')]['id']}},_0x4fb0c8={};_0x4fb0c8[_0x8ba8('0x37')]=_[_0x8ba8('0x39')](db['OpenchannelQueue'][_0x8ba8('0x4f')]);_0x4fb0c8[_0x8ba8('0x3c')]=_['keys'](_0x2ee7da[_0x8ba8('0x3c')]);_0x4fb0c8[_0x8ba8('0x3a')]=_['intersection'](_0x4fb0c8[_0x8ba8('0x37')],_0x4fb0c8['query']);_0x17a183[_0x8ba8('0x3d')]=_[_0x8ba8('0x3b')](_0x4fb0c8[_0x8ba8('0x37')],qs['fields'](_0x2ee7da[_0x8ba8('0x3c')][_0x8ba8('0x3e')]));_0x17a183[_0x8ba8('0x3d')]=_0x17a183['attributes'][_0x8ba8('0x50')]?_0x17a183['attributes']:_0x4fb0c8[_0x8ba8('0x37')];if(_0x2ee7da[_0x8ba8('0x3c')]['includeAll']){_0x17a183[_0x8ba8('0x4a')]=[{'all':!![]}];}_0x17a183=_[_0x8ba8('0x46')]({},_0x17a183,_0x2ee7da['options']);return db[_0x8ba8('0x33')][_0x8ba8('0x51')](_0x17a183)[_0x8ba8('0x2b')](handleEntityNotFound(_0x2727b4,null))[_0x8ba8('0x2b')](respondWithResult(_0x2727b4,null))['catch'](handleError(_0x2727b4,null));};exports[_0x8ba8('0x52')]=function(_0x5ba190,_0x320132){return db[_0x8ba8('0x33')]['create'](_0x5ba190[_0x8ba8('0x53')],{})[_0x8ba8('0x2b')](function(_0x2dc003){var _0x6d57a9=_0x5ba190[_0x8ba8('0x54')]['get']({'plain':!![]});if(!_0x6d57a9)throw new Error(_0x8ba8('0x55'));if(_0x6d57a9['role']===_0x8ba8('0x54')){var _0x27268c=_0x2dc003[_0x8ba8('0x2c')]({'plain':!![]});var _0x6219db='OpenchannelQueues';return db[_0x8ba8('0x56')]['find']({'where':{'name':_0x6219db,'userProfileId':_0x6d57a9[_0x8ba8('0x57')]},'raw':!![]})['then'](function(_0x2392c2){if(_0x2392c2&&_0x2392c2[_0x8ba8('0x58')]===0x0){return db[_0x8ba8('0x59')]['create']({'name':_0x27268c[_0x8ba8('0x30')],'resourceId':_0x27268c['id'],'type':_0x2392c2[_0x8ba8('0x30')],'sectionId':_0x2392c2['id']},{})[_0x8ba8('0x2b')](function(){return _0x2dc003;});}else{return _0x2dc003;}})[_0x8ba8('0x4c')](function(_0x50702f){logger[_0x8ba8('0x2e')](_0x8ba8('0x5a'),_0x50702f);throw _0x50702f;});}return _0x2dc003;})[_0x8ba8('0x2b')](respondWithResult(_0x320132,0xc9))[_0x8ba8('0x4c')](handleError(_0x320132,null));};exports[_0x8ba8('0x29')]=function(_0x13511d,_0x536832){if(_0x13511d[_0x8ba8('0x53')]['id']){delete _0x13511d[_0x8ba8('0x53')]['id'];}return db[_0x8ba8('0x33')]['find']({'where':{'id':_0x13511d[_0x8ba8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x536832,null))[_0x8ba8('0x2b')](saveUpdates(_0x13511d[_0x8ba8('0x53')],null))['then'](respondWithResult(_0x536832,null))[_0x8ba8('0x4c')](handleError(_0x536832,null));};exports[_0x8ba8('0x2a')]=function(_0x135dda,_0xd872ca){return db[_0x8ba8('0x33')][_0x8ba8('0x51')]({'where':{'id':_0x135dda[_0x8ba8('0x4e')]['id']}})[_0x8ba8('0x2b')](handleEntityNotFound(_0xd872ca,null))[_0x8ba8('0x2b')](removeEntity(_0xd872ca,null))[_0x8ba8('0x4c')](handleError(_0xd872ca,null));};exports['describe']=function(_0x5c9188,_0x4ddfd6){return db[_0x8ba8('0x33')][_0x8ba8('0x5b')]()[_0x8ba8('0x2b')](respondWithResult(_0x4ddfd6,null))['catch'](handleError(_0x4ddfd6,null));};exports[_0x8ba8('0x5c')]=function(_0x2f645a,_0x517c2c,_0x5cd041){var _0x573c6d={'raw':!![],'where':{}},_0x107846={},_0x41c2c6;return db['OpenchannelQueue'][_0x8ba8('0x5d')]({'where':{'id':_0x2f645a[_0x8ba8('0x4e')]['id']}})[_0x8ba8('0x2b')](handleEntityNotFound(_0x517c2c,null))[_0x8ba8('0x2b')](function(_0x2615f8){if(_0x2615f8){_0x41c2c6=_0x2615f8[_0x8ba8('0x2c')]({'plain':!![]});_0x107846['model']=_[_0x8ba8('0x39')](db[_0x8ba8('0x5e')][_0x8ba8('0x4f')]);_0x107846[_0x8ba8('0x3c')]=_[_0x8ba8('0x39')](_0x2f645a[_0x8ba8('0x3c')]);_0x107846[_0x8ba8('0x3a')]=_[_0x8ba8('0x3b')](_0x107846[_0x8ba8('0x37')],_0x107846[_0x8ba8('0x3c')]);_0x573c6d[_0x8ba8('0x3d')]=_['intersection'](_0x107846[_0x8ba8('0x37')],qs['fields'](_0x2f645a[_0x8ba8('0x3c')][_0x8ba8('0x3e')]));_0x573c6d[_0x8ba8('0x3d')]=_0x573c6d[_0x8ba8('0x3d')][_0x8ba8('0x50')]?_0x573c6d['attributes']:_0x107846[_0x8ba8('0x37')];if(!_0x2f645a[_0x8ba8('0x3c')]['hasOwnProperty']('nolimit')){_0x573c6d[_0x8ba8('0x20')]=qs[_0x8ba8('0x20')](_0x2f645a[_0x8ba8('0x3c')][_0x8ba8('0x20')]);_0x573c6d[_0x8ba8('0x1f')]=qs[_0x8ba8('0x1f')](_0x2f645a[_0x8ba8('0x3c')]['offset']);}_0x573c6d[_0x8ba8('0x41')]=qs[_0x8ba8('0x42')](_0x2f645a[_0x8ba8('0x3c')][_0x8ba8('0x42')]);_0x573c6d[_0x8ba8('0x43')]=qs[_0x8ba8('0x3a')](_[_0x8ba8('0x44')](_0x2f645a[_0x8ba8('0x3c')],_0x107846[_0x8ba8('0x3a')]));_0x573c6d[_0x8ba8('0x43')][_0x8ba8('0x5f')]=_0x2615f8['id'];if(_0x2f645a[_0x8ba8('0x3c')]['filter']){_0x573c6d['where']=_[_0x8ba8('0x46')](_0x573c6d[_0x8ba8('0x43')],{'$or':_[_0x8ba8('0x38')](_0x573c6d[_0x8ba8('0x3d')],function(_0x2e09aa){var _0x5615e8={};_0x5615e8[_0x2e09aa]={'$like':'%'+_0x2f645a['query'][_0x8ba8('0x45')]+'%'};return _0x5615e8;})});}_0x573c6d=_[_0x8ba8('0x46')]({},_0x573c6d,_0x2f645a[_0x8ba8('0x48')]);return db[_0x8ba8('0x5e')][_0x8ba8('0x4b')](_0x573c6d);}})['then'](function(_0x27452c){if(_0x27452c){return db[_0x8ba8('0x60')]['findAndCountAll']({'where':{'id':_[_0x8ba8('0x38')](_0x27452c,'UserId'),'role':'agent'},'attributes':['id',_0x8ba8('0x30'),'openchannelPause',_0x8ba8('0x61'),_0x8ba8('0x62')]});}})[_0x8ba8('0x2b')](function(_0x2f7d7c){if(_0x2f7d7c){return{'count':_0x2f7d7c['count'],'rows':_['map'](_0x2f7d7c[_0x8ba8('0x63')],function(_0x18beb5){return{'membername':_0x18beb5[_0x8ba8('0x30')],'UserId':_0x18beb5['id'],'queue_name':_0x41c2c6[_0x8ba8('0x30')],'OpenchannelQueueId':_0x41c2c6['id'],'interface':util[_0x8ba8('0x64')]('%s/%s',_0x8ba8('0x65'),_0x18beb5[_0x8ba8('0x30')]),'penalty':0x0,'paused':_0x18beb5['openchannelPause'],'createdAt':_0x18beb5[_0x8ba8('0x62')],'updatedAt':_0x18beb5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x517c2c,_0x573c6d))[_0x8ba8('0x4c')](handleError(_0x517c2c,null));};exports[_0x8ba8('0x66')]=function(_0x30b290,_0x3fbcc9,_0x1ae201){var _0x2e4ed9={};var _0xd1ade9={};var _0x3864f1;var _0x340c72;return db[_0x8ba8('0x33')]['findOne']({'where':{'id':_0x30b290[_0x8ba8('0x4e')]['id']}})[_0x8ba8('0x2b')](handleEntityNotFound(_0x3fbcc9,null))[_0x8ba8('0x2b')](function(_0x466986){if(_0x466986){_0x3864f1=_0x466986;_0xd1ade9[_0x8ba8('0x37')]=_[_0x8ba8('0x39')](db['Team'][_0x8ba8('0x4f')]);_0xd1ade9[_0x8ba8('0x3c')]=_[_0x8ba8('0x39')](_0x30b290['query']);_0xd1ade9[_0x8ba8('0x3a')]=_[_0x8ba8('0x3b')](_0xd1ade9[_0x8ba8('0x37')],_0xd1ade9[_0x8ba8('0x3c')]);_0x2e4ed9[_0x8ba8('0x3d')]=_[_0x8ba8('0x3b')](_0xd1ade9[_0x8ba8('0x37')],qs[_0x8ba8('0x3e')](_0x30b290[_0x8ba8('0x3c')]['fields']));_0x2e4ed9[_0x8ba8('0x3d')]=_0x2e4ed9[_0x8ba8('0x3d')][_0x8ba8('0x50')]?_0x2e4ed9[_0x8ba8('0x3d')]:_0xd1ade9[_0x8ba8('0x37')];_0x2e4ed9[_0x8ba8('0x41')]=qs[_0x8ba8('0x42')](_0x30b290['query'][_0x8ba8('0x42')]);_0x2e4ed9[_0x8ba8('0x43')]=qs[_0x8ba8('0x3a')](_['pick'](_0x30b290[_0x8ba8('0x3c')],_0xd1ade9['filters']));if(_0x30b290[_0x8ba8('0x3c')][_0x8ba8('0x45')]){_0x2e4ed9[_0x8ba8('0x43')]=_[_0x8ba8('0x46')](_0x2e4ed9[_0x8ba8('0x43')],{'$or':_[_0x8ba8('0x38')](_0x2e4ed9[_0x8ba8('0x3d')],function(_0xce6034){var _0x573ca3={};_0x573ca3[_0xce6034]={'$like':'%'+_0x30b290[_0x8ba8('0x3c')][_0x8ba8('0x45')]+'%'};return _0x573ca3;})});}_0x2e4ed9=_[_0x8ba8('0x46')]({},_0x2e4ed9,_0x30b290[_0x8ba8('0x48')]);return _0x3864f1[_0x8ba8('0x66')](_0x2e4ed9);}})['then'](function(_0x50b3dc){if(_0x50b3dc){_0x340c72=_0x50b3dc[_0x8ba8('0x50')];if(!_0x30b290[_0x8ba8('0x3c')][_0x8ba8('0x3f')](_0x8ba8('0x40'))){_0x2e4ed9['limit']=qs['limit'](_0x30b290[_0x8ba8('0x3c')][_0x8ba8('0x20')]);_0x2e4ed9['offset']=qs['offset'](_0x30b290[_0x8ba8('0x3c')][_0x8ba8('0x1f')]);}return _0x3864f1['getTeams'](_0x2e4ed9);}})[_0x8ba8('0x2b')](function(_0xe75bec){if(_0xe75bec){return _0xe75bec?{'count':_0x340c72,'rows':_0xe75bec}:null;}})[_0x8ba8('0x2b')](respondWithResult(_0x3fbcc9,null))['catch'](handleError(_0x3fbcc9,null));};exports['addTeams']=function(_0x582b19,_0x3009ec,_0x3a377d){var _0x2fc508=_0x582b19['body'][_0x8ba8('0x67')];return db[_0x8ba8('0x68')]['findAll']({'where':{'id':_0x2fc508},'attributes':['id'],'include':[{'model':db[_0x8ba8('0x60')],'as':'Agents','attributes':['id','name',_0x8ba8('0x69'),_0x8ba8('0x6a'),_0x8ba8('0x6b')],'raw':!![]}]})[_0x8ba8('0x2b')](function(_0x15eb71){if(_0x15eb71){var _0x162217=_['flatMap'](_0x15eb71,function(_0x566f87){var _0x5a0575=_0x566f87[_0x8ba8('0x2c')]({'plain':!![]});return _0x5a0575['Agents'];});return db[_0x8ba8('0x33')][_0x8ba8('0x51')]({'where':{'id':_0x582b19[_0x8ba8('0x4e')]['id']}})[_0x8ba8('0x2b')](function(_0x56940d){return db[_0x8ba8('0x6c')][_0x8ba8('0x6d')](function(_0x2d1064){return _0x56940d[_0x8ba8('0x6e')](_0x2fc508,{'transaction':_0x2d1064})[_0x8ba8('0x2b')](function(){return BPromise[_0x8ba8('0x6f')](_0x162217,function(_0x34e736){return db[_0x8ba8('0x5e')][_0x8ba8('0x70')]({'where':{'UserId':_0x34e736['id'],'OpenchannelQueueId':_0x582b19[_0x8ba8('0x4e')]['id']},'transaction':_0x2d1064});});})[_0x8ba8('0x2b')](function(){_0x162217[_0x8ba8('0x71')](function(_0x1cbefa){socket[_0x8ba8('0x72')](_0x8ba8('0x73'),{'UserId':_0x1cbefa['id'],'OpenchannelQueueId':_0x56940d['id']});});});});});}})[_0x8ba8('0x2b')](respondWithStatusCode(_0x3009ec,null))[_0x8ba8('0x4c')](handleError(_0x3009ec,null));};exports[_0x8ba8('0x74')]=function(_0x4aa5ad,_0x296d62,_0x1dcdfb){return db['Team'][_0x8ba8('0x4b')]({'where':{'id':_0x4aa5ad[_0x8ba8('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8ba8('0x60')],'as':_0x8ba8('0x75'),'attributes':['id'],'raw':!![]}]})[_0x8ba8('0x2b')](handleEntityNotFound(_0x296d62,null))['then'](function(_0x107a9c){var _0x59e778=_[_0x8ba8('0x38')](_0x107a9c,'id');var _0x29e047=[];var _0x2b7b2d=[];var _0x3bf796=squel[_0x8ba8('0x76')]();_0x3bf796[_0x8ba8('0x77')](_0x8ba8('0x78'))[_0x8ba8('0x79')]('team_has_openchannel_queues','tq')[_0x8ba8('0x7a')](_0x8ba8('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8ba8('0x43')]('OpenchannelQueueId\x20=\x20?',_0x4aa5ad['params']['id']);for(var _0xf8393=0x0;_0xf8393<_0x107a9c[_0x8ba8('0x50')];_0xf8393+=0x1){let _0x4cea71=_0x107a9c[_0xf8393];for(var _0xaca257=0x0;_0xaca257<_0x4cea71[_0x8ba8('0x75')]['length'];_0xaca257+=0x1){let _0x3f70c9=_0x4cea71[_0x8ba8('0x75')][_0xaca257];var _0x4bb56e=_0x3bf796[_0x8ba8('0x7c')]();_0x4bb56e[_0x8ba8('0x43')](_0x8ba8('0x7d'),_0x3f70c9['id']);_0x2b7b2d[_0x8ba8('0x7e')](db[_0x8ba8('0x6c')]['query'](_0x4bb56e[_0x8ba8('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0x8ba8('0x80')]})[_0x8ba8('0x2b')](function(_0x3d3715){if(_0x3d3715[_0x8ba8('0x50')]===0x1){return _0x3f70c9['id'];}else{var _0x2e3854=_[_0x8ba8('0x81')](_['map'](_0x3d3715,_0x8ba8('0x82')),function(_0x326485){return _[_0x8ba8('0x83')](_0x59e778,_0x326485);});if(_0x2e3854){return _0x3f70c9['id'];}}}));}}return BPromise[_0x8ba8('0x84')](_0x2b7b2d)['then'](function(_0x4d479e){_0x29e047=_(_0x29e047)[_0x8ba8('0x85')](_0x4d479e)[_0x8ba8('0x86')]()[_0x8ba8('0x87')]();return db[_0x8ba8('0x33')][_0x8ba8('0x51')]({'where':{'id':_0x4aa5ad[_0x8ba8('0x4e')]['id']}})['then'](function(_0x47fff9){return db[_0x8ba8('0x6c')]['transaction'](function(_0x1c99bb){return _0x47fff9[_0x8ba8('0x74')](_0x4aa5ad[_0x8ba8('0x3c')]['ids'],{'transaction':_0x1c99bb})[_0x8ba8('0x2b')](function(){if(!_['isEmpty'](_0x29e047)){return _0x47fff9[_0x8ba8('0x88')](_0x29e047,{'transaction':_0x1c99bb});}})[_0x8ba8('0x2b')](function(){_0x29e047['forEach'](function(_0x11dbfc){socket['emit'](_0x8ba8('0x89'),{'UserId':_0x11dbfc,'OpenchannelQueueId':_0x47fff9['id']});});});});});});})[_0x8ba8('0x2b')](respondWithStatusCode(_0x296d62,null))[_0x8ba8('0x4c')](handleError(_0x296d62,null));};exports[_0x8ba8('0x8a')]=function(_0x33c798,_0x35c13c,_0x5bd310){return db[_0x8ba8('0x33')][_0x8ba8('0x51')]({'where':{'id':_0x33c798[_0x8ba8('0x4e')]['id']}})[_0x8ba8('0x2b')](handleEntityNotFound(_0x35c13c,null))[_0x8ba8('0x2b')](function(_0x3545c6){if(_0x3545c6){return _0x3545c6['addAgents'](_0x33c798[_0x8ba8('0x53')]['ids'],_[_0x8ba8('0x8b')](_0x33c798[_0x8ba8('0x53')],[_0x8ba8('0x67'),'id'])||{})[_0x8ba8('0x8c')](function(_0xb57953){for(var _0x3fd2d0=0x0;_0x3fd2d0<_0x33c798[_0x8ba8('0x53')][_0x8ba8('0x67')][_0x8ba8('0x50')];_0x3fd2d0+=0x1){socket[_0x8ba8('0x72')]('userOpenchannelQueue:save',{'UserId':Number(_0x33c798[_0x8ba8('0x53')]['ids'][_0x3fd2d0]),'OpenchannelQueueId':Number(_0x33c798[_0x8ba8('0x4e')]['id'])});}return _0xb57953;});}})[_0x8ba8('0x2b')](respondWithResult(_0x35c13c,null))[_0x8ba8('0x4c')](handleError(_0x35c13c,null));};exports[_0x8ba8('0x88')]=function(_0xfbfd1e,_0x382359,_0x447b87){return db[_0x8ba8('0x33')][_0x8ba8('0x51')]({'where':{'id':_0xfbfd1e[_0x8ba8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x382359,null))['then'](function(_0x395ddf){if(_0x395ddf){return _0x395ddf[_0x8ba8('0x88')](_0xfbfd1e[_0x8ba8('0x3c')][_0x8ba8('0x67')])[_0x8ba8('0x2b')](function(){if(_['isArray'](_0xfbfd1e['query'][_0x8ba8('0x67')])){for(var _0x4d1c96=0x0;_0x4d1c96<_0xfbfd1e[_0x8ba8('0x3c')][_0x8ba8('0x67')]['length'];_0x4d1c96+=0x1){socket[_0x8ba8('0x72')](_0x8ba8('0x89'),{'UserId':Number(_0xfbfd1e[_0x8ba8('0x3c')]['ids'][_0x4d1c96]),'OpenchannelQueueId':Number(_0xfbfd1e[_0x8ba8('0x4e')]['id'])});}}else{socket['emit'](_0x8ba8('0x89'),{'UserId':Number(_0xfbfd1e[_0x8ba8('0x3c')]['ids']),'OpenchannelQueueId':Number(_0xfbfd1e[_0x8ba8('0x4e')]['id'])});}});}})[_0x8ba8('0x2b')](respondWithStatusCode(_0x382359,null))['catch'](handleError(_0x382359,null));};exports[_0x8ba8('0x8d')]=function(_0x6dd843,_0x59d1ed,_0x506393){var _0x151733={};var _0x42cd73={};var _0x53bc79;var _0x53ff49;return db['OpenchannelQueue'][_0x8ba8('0x5d')]({'where':{'id':_0x6dd843[_0x8ba8('0x4e')]['id']}})[_0x8ba8('0x2b')](handleEntityNotFound(_0x59d1ed,null))['then'](function(_0x262fab){if(_0x262fab){_0x53bc79=_0x262fab;_0x42cd73[_0x8ba8('0x37')]=_[_0x8ba8('0x39')](db[_0x8ba8('0x60')][_0x8ba8('0x4f')]);_0x42cd73[_0x8ba8('0x3c')]=_[_0x8ba8('0x39')](_0x6dd843['query']);_0x42cd73[_0x8ba8('0x3a')]=_[_0x8ba8('0x3b')](_0x42cd73[_0x8ba8('0x37')],_0x42cd73[_0x8ba8('0x3c')]);_0x151733[_0x8ba8('0x3d')]=_['intersection'](_0x42cd73['model'],qs[_0x8ba8('0x3e')](_0x6dd843[_0x8ba8('0x3c')][_0x8ba8('0x3e')]));_0x151733['attributes']=_0x151733['attributes']['length']?_0x151733[_0x8ba8('0x3d')]:_0x42cd73[_0x8ba8('0x37')];_0x151733[_0x8ba8('0x41')]=qs[_0x8ba8('0x42')](_0x6dd843['query'][_0x8ba8('0x42')]);_0x151733[_0x8ba8('0x43')]=qs[_0x8ba8('0x3a')](_[_0x8ba8('0x44')](_0x6dd843[_0x8ba8('0x3c')],_0x42cd73[_0x8ba8('0x3a')]));if(_0x6dd843[_0x8ba8('0x3c')][_0x8ba8('0x45')]){_0x151733[_0x8ba8('0x43')]=_['merge'](_0x151733[_0x8ba8('0x43')],{'$or':_[_0x8ba8('0x38')](_0x151733[_0x8ba8('0x3d')],function(_0x3b6aa8){var _0x3ae854={};_0x3ae854[_0x3b6aa8]={'$like':'%'+_0x6dd843[_0x8ba8('0x3c')][_0x8ba8('0x45')]+'%'};return _0x3ae854;})});}_0x151733=_[_0x8ba8('0x46')]({},_0x151733,_0x6dd843['options']);return _0x53bc79[_0x8ba8('0x8d')](_0x151733);}})[_0x8ba8('0x2b')](function(_0x22f09c){if(_0x22f09c){_0x53ff49=_0x22f09c[_0x8ba8('0x50')];if(!_0x6dd843[_0x8ba8('0x3c')][_0x8ba8('0x3f')](_0x8ba8('0x40'))){_0x151733[_0x8ba8('0x20')]=qs[_0x8ba8('0x20')](_0x6dd843[_0x8ba8('0x3c')][_0x8ba8('0x20')]);_0x151733['offset']=qs[_0x8ba8('0x1f')](_0x6dd843[_0x8ba8('0x3c')][_0x8ba8('0x1f')]);}return _0x53bc79['getAgents'](_0x151733);}})[_0x8ba8('0x2b')](function(_0x3fedc5){if(_0x3fedc5){return _0x3fedc5?{'count':_0x53ff49,'rows':_0x3fedc5}:null;}})['then'](respondWithResult(_0x59d1ed,null))['catch'](handleError(_0x59d1ed,null));}; \ No newline at end of file +var _0xaac8=['attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','includeAll','findAll','catch','show','params','intersection','length','include','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','order','pick','OpenchannelQueueId','options','UserOpenchannelQueue','User','UserId','agent','openchannelPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','OpenchannelQueues','UserProfileResource','sendStatus','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x5bf586,_0xb4c425){var _0x2c4f11=function(_0x7546f0){while(--_0x7546f0){_0x5bf586['push'](_0x5bf586['shift']());}};_0x2c4f11(++_0xb4c425);}(_0xaac8,0x179));var _0x8aac=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xaac8[_0x87b0ff];return _0x3bc0b2;};'use strict';var emlformat=require(_0x8aac('0x0'));var rimraf=require(_0x8aac('0x1'));var zipdir=require(_0x8aac('0x2'));var jsonpatch=require(_0x8aac('0x3'));var rp=require(_0x8aac('0x4'));var moment=require('moment');var BPromise=require(_0x8aac('0x5'));var Mustache=require('mustache');var util=require(_0x8aac('0x6'));var path=require(_0x8aac('0x7'));var sox=require(_0x8aac('0x8'));var csv=require(_0x8aac('0x9'));var ejs=require(_0x8aac('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8aac('0xb'));var squel=require(_0x8aac('0xc'));var crypto=require(_0x8aac('0xd'));var jsforce=require(_0x8aac('0xe'));var deskjs=require(_0x8aac('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8aac('0x10'));var Papa=require('papaparse');var Redis=require(_0x8aac('0x11'));var authService=require(_0x8aac('0x12'));var qs=require(_0x8aac('0x13'));var as=require(_0x8aac('0x14'));var hardwareService=require(_0x8aac('0x15'));var logger=require(_0x8aac('0x16'))(_0x8aac('0x17'));var utils=require(_0x8aac('0x18'));var config=require(_0x8aac('0x19'));var licenseUtil=require(_0x8aac('0x1a'));var db=require(_0x8aac('0x1b'))['db'];config['redis']=_[_0x8aac('0x1c')](config[_0x8aac('0x1d')],{'host':_0x8aac('0x1e'),'port':0x18eb});var socket=require(_0x8aac('0x1f'))(new Redis(config[_0x8aac('0x1d')]));require(_0x8aac('0x20'))[_0x8aac('0x21')](socket);function respondWithStatusCode(_0x3f3a90,_0xcfd1e4){_0xcfd1e4=_0xcfd1e4||0xcc;return function(_0x13ba71){if(_0x13ba71){return _0x3f3a90['sendStatus'](_0xcfd1e4);}return _0x3f3a90[_0x8aac('0x22')](_0xcfd1e4)[_0x8aac('0x23')]();};}function respondWithResult(_0x362994,_0x582cd3){_0x582cd3=_0x582cd3||0xc8;return function(_0x330414){if(_0x330414){return _0x362994[_0x8aac('0x22')](_0x582cd3)[_0x8aac('0x24')](_0x330414);}};}function respondWithFilteredResult(_0x5490fa,_0x4842b2){return function(_0x10df88){if(_0x10df88){var _0xebd1c1=typeof _0x4842b2[_0x8aac('0x25')]===_0x8aac('0x26')&&typeof _0x4842b2[_0x8aac('0x27')]===_0x8aac('0x26');var _0x4d9cb1=_0x10df88['count'];var _0x2b7257=_0xebd1c1?0x0:_0x4842b2[_0x8aac('0x25')];var _0x36203a=_0xebd1c1?_0x10df88[_0x8aac('0x28')]:_0x4842b2['offset']+_0x4842b2[_0x8aac('0x27')];var _0x4e2ca1;if(_0x36203a>=_0x4d9cb1){_0x36203a=_0x4d9cb1;_0x4e2ca1=0xc8;}else{_0x4e2ca1=0xce;}_0x5490fa[_0x8aac('0x22')](_0x4e2ca1);return _0x5490fa[_0x8aac('0x29')](_0x8aac('0x2a'),_0x2b7257+'-'+_0x36203a+'/'+_0x4d9cb1)['json'](_0x10df88);}return null;};}function patchUpdates(_0x53b91f){return function(_0x15a57e){try{jsonpatch[_0x8aac('0x2b')](_0x15a57e,_0x53b91f,!![]);}catch(_0x58d391){return BPromise[_0x8aac('0x2c')](_0x58d391);}return _0x15a57e[_0x8aac('0x2d')]();};}function saveUpdates(_0x2bd0e0,_0x79f74c){return function(_0x581c5d){if(_0x581c5d){return _0x581c5d[_0x8aac('0x2e')](_0x2bd0e0)['then'](function(_0x15cf7f){return _0x15cf7f;});}return null;};}function removeEntity(_0x5671c5,_0x3fa79a){return function(_0x14c8ba){if(_0x14c8ba){return _0x14c8ba[_0x8aac('0x2f')]()[_0x8aac('0x30')](function(){var _0x17aa79=_0x14c8ba['get']({'plain':!![]});var _0x16dfdb=_0x8aac('0x31');return db[_0x8aac('0x32')]['destroy']({'where':{'type':_0x16dfdb,'resourceId':_0x17aa79['id']}})[_0x8aac('0x30')](function(){return _0x14c8ba;});})[_0x8aac('0x30')](function(){_0x5671c5[_0x8aac('0x22')](0xcc)[_0x8aac('0x23')]();});}};}function handleEntityNotFound(_0x42ad6e,_0x187877){return function(_0x7fe483){if(!_0x7fe483){_0x42ad6e[_0x8aac('0x33')](0x194);}return _0x7fe483;};}function handleError(_0x34f7b5,_0x432d32){_0x432d32=_0x432d32||0x1f4;return function(_0x3bf914){logger['error'](_0x3bf914['stack']);if(_0x3bf914['name']){delete _0x3bf914[_0x8aac('0x34')];}_0x34f7b5[_0x8aac('0x22')](_0x432d32)['send'](_0x3bf914);};}exports[_0x8aac('0x35')]=function(_0x2594bf,_0x596e0e){var _0x4070da={},_0x111b13={},_0x513c93={'count':0x0,'rows':[]};var _0xbc7b71=_[_0x8aac('0x36')](db[_0x8aac('0x37')][_0x8aac('0x38')],function(_0x5616f3){return{'name':_0x5616f3[_0x8aac('0x39')],'type':_0x5616f3[_0x8aac('0x3a')][_0x8aac('0x3b')]};});_0x111b13[_0x8aac('0x3c')]=_[_0x8aac('0x36')](_0xbc7b71,_0x8aac('0x34'));_0x111b13[_0x8aac('0x3d')]=_[_0x8aac('0x3e')](_0x2594bf[_0x8aac('0x3d')]);_0x111b13[_0x8aac('0x3f')]=_['intersection'](_0x111b13[_0x8aac('0x3c')],_0x111b13[_0x8aac('0x3d')]);_0x4070da[_0x8aac('0x40')]=_['intersection'](_0x111b13[_0x8aac('0x3c')],qs[_0x8aac('0x41')](_0x2594bf[_0x8aac('0x3d')][_0x8aac('0x41')]));_0x4070da['attributes']=_0x4070da[_0x8aac('0x40')]['length']?_0x4070da[_0x8aac('0x40')]:_0x111b13['model'];if(!_0x2594bf['query'][_0x8aac('0x42')](_0x8aac('0x43'))){_0x4070da[_0x8aac('0x27')]=qs[_0x8aac('0x27')](_0x2594bf[_0x8aac('0x3d')][_0x8aac('0x27')]);_0x4070da[_0x8aac('0x25')]=qs[_0x8aac('0x25')](_0x2594bf[_0x8aac('0x3d')]['offset']);}_0x4070da['order']=qs[_0x8aac('0x44')](_0x2594bf['query'][_0x8aac('0x44')]);_0x4070da[_0x8aac('0x45')]=qs[_0x8aac('0x3f')](_['pick'](_0x2594bf[_0x8aac('0x3d')],_0x111b13['filters']),_0xbc7b71);if(_0x2594bf[_0x8aac('0x3d')]['filter']){_0x4070da['where']=_['merge'](_0x4070da[_0x8aac('0x45')],{'$or':_[_0x8aac('0x36')](_0xbc7b71,function(_0x1d30e1){if(_0x1d30e1[_0x8aac('0x3a')]!==_0x8aac('0x46')){var _0x3c6186={};_0x3c6186[_0x1d30e1['name']]={'$like':'%'+_0x2594bf['query'][_0x8aac('0x47')]+'%'};return _0x3c6186;}})});}_0x4070da=_['merge']({},_0x4070da,_0x2594bf['options']);var _0x2747b6={'where':_0x4070da[_0x8aac('0x45')]};return db['OpenchannelQueue'][_0x8aac('0x28')](_0x2747b6)['then'](function(_0x409814){_0x513c93[_0x8aac('0x28')]=_0x409814;if(_0x2594bf[_0x8aac('0x3d')][_0x8aac('0x48')]){_0x4070da['include']=[{'all':!![]}];}return db[_0x8aac('0x37')][_0x8aac('0x49')](_0x4070da);})[_0x8aac('0x30')](function(_0x10ecca){_0x513c93['rows']=_0x10ecca;return _0x513c93;})[_0x8aac('0x30')](respondWithFilteredResult(_0x596e0e,_0x4070da))[_0x8aac('0x4a')](handleError(_0x596e0e,null));};exports[_0x8aac('0x4b')]=function(_0x5f149e,_0x313f3f){var _0x2a2f2f={'raw':!![],'where':{'id':_0x5f149e[_0x8aac('0x4c')]['id']}},_0xdd1cdf={};_0xdd1cdf[_0x8aac('0x3c')]=_[_0x8aac('0x3e')](db[_0x8aac('0x37')][_0x8aac('0x38')]);_0xdd1cdf[_0x8aac('0x3d')]=_[_0x8aac('0x3e')](_0x5f149e[_0x8aac('0x3d')]);_0xdd1cdf[_0x8aac('0x3f')]=_['intersection'](_0xdd1cdf[_0x8aac('0x3c')],_0xdd1cdf[_0x8aac('0x3d')]);_0x2a2f2f['attributes']=_[_0x8aac('0x4d')](_0xdd1cdf['model'],qs[_0x8aac('0x41')](_0x5f149e['query'][_0x8aac('0x41')]));_0x2a2f2f[_0x8aac('0x40')]=_0x2a2f2f[_0x8aac('0x40')][_0x8aac('0x4e')]?_0x2a2f2f[_0x8aac('0x40')]:_0xdd1cdf['model'];if(_0x5f149e[_0x8aac('0x3d')][_0x8aac('0x48')]){_0x2a2f2f[_0x8aac('0x4f')]=[{'all':!![]}];}_0x2a2f2f=_[_0x8aac('0x50')]({},_0x2a2f2f,_0x5f149e['options']);return db['OpenchannelQueue'][_0x8aac('0x51')](_0x2a2f2f)['then'](handleEntityNotFound(_0x313f3f,null))[_0x8aac('0x30')](respondWithResult(_0x313f3f,null))[_0x8aac('0x4a')](handleError(_0x313f3f,null));};exports[_0x8aac('0x52')]=function(_0x30ed5e,_0x273eb3){return db[_0x8aac('0x37')][_0x8aac('0x52')](_0x30ed5e['body'],{})[_0x8aac('0x30')](function(_0x459f0b){var _0xe4d9cf=_0x30ed5e[_0x8aac('0x53')][_0x8aac('0x54')]({'plain':!![]});if(!_0xe4d9cf)throw new Error(_0x8aac('0x55'));if(_0xe4d9cf[_0x8aac('0x56')]===_0x8aac('0x53')){var _0x4085f2=_0x459f0b[_0x8aac('0x54')]({'plain':!![]});var _0x2aa0f6=_0x8aac('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x2aa0f6,'userProfileId':_0xe4d9cf['userProfileId']},'raw':!![]})[_0x8aac('0x30')](function(_0x42e3c1){if(_0x42e3c1&&_0x42e3c1[_0x8aac('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x4085f2['name'],'resourceId':_0x4085f2['id'],'type':_0x42e3c1[_0x8aac('0x34')],'sectionId':_0x42e3c1['id']},{})[_0x8aac('0x30')](function(){return _0x459f0b;});}else{return _0x459f0b;}})['catch'](function(_0x100360){logger['error'](_0x8aac('0x58'),_0x100360);throw _0x100360;});}return _0x459f0b;})['then'](respondWithResult(_0x273eb3,0xc9))['catch'](handleError(_0x273eb3,null));};exports['update']=function(_0x3a1d84,_0x37cb8b){if(_0x3a1d84['body']['id']){delete _0x3a1d84[_0x8aac('0x59')]['id'];}return db['OpenchannelQueue'][_0x8aac('0x51')]({'where':{'id':_0x3a1d84[_0x8aac('0x4c')]['id']}})[_0x8aac('0x30')](handleEntityNotFound(_0x37cb8b,null))[_0x8aac('0x30')](saveUpdates(_0x3a1d84[_0x8aac('0x59')],null))[_0x8aac('0x30')](respondWithResult(_0x37cb8b,null))[_0x8aac('0x4a')](handleError(_0x37cb8b,null));};exports[_0x8aac('0x2f')]=function(_0x4db512,_0xb2c70a){return db[_0x8aac('0x37')][_0x8aac('0x51')]({'where':{'id':_0x4db512[_0x8aac('0x4c')]['id']}})[_0x8aac('0x30')](handleEntityNotFound(_0xb2c70a,null))[_0x8aac('0x30')](removeEntity(_0xb2c70a,null))[_0x8aac('0x4a')](handleError(_0xb2c70a,null));};exports[_0x8aac('0x5a')]=function(_0x1b05c6,_0x415500){return db[_0x8aac('0x37')][_0x8aac('0x5a')]()[_0x8aac('0x30')](respondWithResult(_0x415500,null))[_0x8aac('0x4a')](handleError(_0x415500,null));};exports[_0x8aac('0x5b')]=function(_0x42f21b,_0x1cbccd,_0x4cce3e){var _0x323f90={'raw':!![],'where':{}},_0x2aebb0={},_0x1783ca;return db[_0x8aac('0x37')]['findOne']({'where':{'id':_0x42f21b[_0x8aac('0x4c')]['id']}})[_0x8aac('0x30')](handleEntityNotFound(_0x1cbccd,null))['then'](function(_0x26bd1e){if(_0x26bd1e){_0x1783ca=_0x26bd1e[_0x8aac('0x54')]({'plain':!![]});_0x2aebb0[_0x8aac('0x3c')]=_[_0x8aac('0x3e')](db['UserOpenchannelQueue'][_0x8aac('0x38')]);_0x2aebb0[_0x8aac('0x3d')]=_[_0x8aac('0x3e')](_0x42f21b[_0x8aac('0x3d')]);_0x2aebb0['filters']=_[_0x8aac('0x4d')](_0x2aebb0['model'],_0x2aebb0['query']);_0x323f90['attributes']=_['intersection'](_0x2aebb0[_0x8aac('0x3c')],qs[_0x8aac('0x41')](_0x42f21b['query'][_0x8aac('0x41')]));_0x323f90['attributes']=_0x323f90[_0x8aac('0x40')]['length']?_0x323f90[_0x8aac('0x40')]:_0x2aebb0[_0x8aac('0x3c')];if(!_0x42f21b[_0x8aac('0x3d')][_0x8aac('0x42')](_0x8aac('0x43'))){_0x323f90[_0x8aac('0x27')]=qs[_0x8aac('0x27')](_0x42f21b[_0x8aac('0x3d')][_0x8aac('0x27')]);_0x323f90[_0x8aac('0x25')]=qs[_0x8aac('0x25')](_0x42f21b['query'][_0x8aac('0x25')]);}_0x323f90[_0x8aac('0x5c')]=qs['sort'](_0x42f21b[_0x8aac('0x3d')]['sort']);_0x323f90[_0x8aac('0x45')]=qs[_0x8aac('0x3f')](_[_0x8aac('0x5d')](_0x42f21b[_0x8aac('0x3d')],_0x2aebb0[_0x8aac('0x3f')]));_0x323f90[_0x8aac('0x45')][_0x8aac('0x5e')]=_0x26bd1e['id'];if(_0x42f21b[_0x8aac('0x3d')]['filter']){_0x323f90[_0x8aac('0x45')]=_['merge'](_0x323f90[_0x8aac('0x45')],{'$or':_[_0x8aac('0x36')](_0x323f90[_0x8aac('0x40')],function(_0x746fe8){var _0x28f21d={};_0x28f21d[_0x746fe8]={'$like':'%'+_0x42f21b[_0x8aac('0x3d')][_0x8aac('0x47')]+'%'};return _0x28f21d;})});}_0x323f90=_[_0x8aac('0x50')]({},_0x323f90,_0x42f21b[_0x8aac('0x5f')]);return db[_0x8aac('0x60')][_0x8aac('0x49')](_0x323f90);}})['then'](function(_0x25845c){if(_0x25845c){return db[_0x8aac('0x61')]['findAndCountAll']({'where':{'id':_['map'](_0x25845c,_0x8aac('0x62')),'role':_0x8aac('0x63')},'attributes':['id',_0x8aac('0x34'),_0x8aac('0x64'),_0x8aac('0x65'),'createdAt']});}})[_0x8aac('0x30')](function(_0xfe547f){if(_0xfe547f){return{'count':_0xfe547f[_0x8aac('0x28')],'rows':_[_0x8aac('0x36')](_0xfe547f[_0x8aac('0x66')],function(_0x2eb2eb){return{'membername':_0x2eb2eb[_0x8aac('0x34')],'UserId':_0x2eb2eb['id'],'queue_name':_0x1783ca[_0x8aac('0x34')],'OpenchannelQueueId':_0x1783ca['id'],'interface':util[_0x8aac('0x67')](_0x8aac('0x68'),_0x8aac('0x69'),_0x2eb2eb['name']),'penalty':0x0,'paused':_0x2eb2eb[_0x8aac('0x64')],'createdAt':_0x2eb2eb[_0x8aac('0x6a')],'updatedAt':_0x2eb2eb[_0x8aac('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8aac('0x30')](respondWithFilteredResult(_0x1cbccd,_0x323f90))[_0x8aac('0x4a')](handleError(_0x1cbccd,null));};exports[_0x8aac('0x6b')]=function(_0x4a332c,_0x542385,_0x1a9aed){var _0x429b5={};var _0x1041b6={};var _0x5cbf05;var _0x40f9f5;return db[_0x8aac('0x37')][_0x8aac('0x6c')]({'where':{'id':_0x4a332c[_0x8aac('0x4c')]['id']}})[_0x8aac('0x30')](handleEntityNotFound(_0x542385,null))[_0x8aac('0x30')](function(_0x1b5a53){if(_0x1b5a53){_0x5cbf05=_0x1b5a53;_0x1041b6[_0x8aac('0x3c')]=_[_0x8aac('0x3e')](db[_0x8aac('0x6d')][_0x8aac('0x38')]);_0x1041b6['query']=_[_0x8aac('0x3e')](_0x4a332c[_0x8aac('0x3d')]);_0x1041b6[_0x8aac('0x3f')]=_[_0x8aac('0x4d')](_0x1041b6['model'],_0x1041b6[_0x8aac('0x3d')]);_0x429b5['attributes']=_[_0x8aac('0x4d')](_0x1041b6['model'],qs[_0x8aac('0x41')](_0x4a332c[_0x8aac('0x3d')][_0x8aac('0x41')]));_0x429b5[_0x8aac('0x40')]=_0x429b5[_0x8aac('0x40')][_0x8aac('0x4e')]?_0x429b5[_0x8aac('0x40')]:_0x1041b6['model'];_0x429b5[_0x8aac('0x5c')]=qs[_0x8aac('0x44')](_0x4a332c[_0x8aac('0x3d')][_0x8aac('0x44')]);_0x429b5['where']=qs[_0x8aac('0x3f')](_[_0x8aac('0x5d')](_0x4a332c['query'],_0x1041b6[_0x8aac('0x3f')]));if(_0x4a332c[_0x8aac('0x3d')][_0x8aac('0x47')]){_0x429b5['where']=_[_0x8aac('0x50')](_0x429b5[_0x8aac('0x45')],{'$or':_[_0x8aac('0x36')](_0x429b5[_0x8aac('0x40')],function(_0x3c5719){var _0x46434d={};_0x46434d[_0x3c5719]={'$like':'%'+_0x4a332c[_0x8aac('0x3d')][_0x8aac('0x47')]+'%'};return _0x46434d;})});}_0x429b5=_[_0x8aac('0x50')]({},_0x429b5,_0x4a332c[_0x8aac('0x5f')]);return _0x5cbf05[_0x8aac('0x6b')](_0x429b5);}})[_0x8aac('0x30')](function(_0x4a8b5a){if(_0x4a8b5a){_0x40f9f5=_0x4a8b5a[_0x8aac('0x4e')];if(!_0x4a332c[_0x8aac('0x3d')][_0x8aac('0x42')](_0x8aac('0x43'))){_0x429b5[_0x8aac('0x27')]=qs[_0x8aac('0x27')](_0x4a332c['query']['limit']);_0x429b5[_0x8aac('0x25')]=qs[_0x8aac('0x25')](_0x4a332c[_0x8aac('0x3d')]['offset']);}return _0x5cbf05[_0x8aac('0x6b')](_0x429b5);}})[_0x8aac('0x30')](function(_0x4c44d1){if(_0x4c44d1){return _0x4c44d1?{'count':_0x40f9f5,'rows':_0x4c44d1}:null;}})[_0x8aac('0x30')](respondWithResult(_0x542385,null))['catch'](handleError(_0x542385,null));};exports[_0x8aac('0x6e')]=function(_0x1d3b3d,_0x256d47,_0x4330b0){var _0x3d2579=_0x1d3b3d[_0x8aac('0x59')][_0x8aac('0x6f')];return db['Team'][_0x8aac('0x49')]({'where':{'id':_0x3d2579},'attributes':['id'],'include':[{'model':db[_0x8aac('0x61')],'as':_0x8aac('0x70'),'attributes':['id',_0x8aac('0x34'),_0x8aac('0x71'),_0x8aac('0x72'),_0x8aac('0x73')],'raw':!![]}]})[_0x8aac('0x30')](function(_0x4acb8d){if(_0x4acb8d){var _0x5bfa9c=_['flatMap'](_0x4acb8d,function(_0x1f2a40){var _0x48a128=_0x1f2a40[_0x8aac('0x54')]({'plain':!![]});return _0x48a128[_0x8aac('0x70')];});return db['OpenchannelQueue'][_0x8aac('0x51')]({'where':{'id':_0x1d3b3d[_0x8aac('0x4c')]['id']}})[_0x8aac('0x30')](function(_0x5cdab5){return db[_0x8aac('0x74')][_0x8aac('0x75')](function(_0x4e5cf4){return _0x5cdab5['addTeams'](_0x3d2579,{'transaction':_0x4e5cf4})[_0x8aac('0x30')](function(){return BPromise[_0x8aac('0x76')](_0x5bfa9c,function(_0x4209a0){return db[_0x8aac('0x60')][_0x8aac('0x77')]({'where':{'UserId':_0x4209a0['id'],'OpenchannelQueueId':_0x1d3b3d[_0x8aac('0x4c')]['id']},'transaction':_0x4e5cf4});});})[_0x8aac('0x30')](function(){_0x5bfa9c[_0x8aac('0x78')](function(_0x3b1518){socket['emit'](_0x8aac('0x79'),{'UserId':_0x3b1518['id'],'OpenchannelQueueId':_0x5cdab5['id']});});});});});}})[_0x8aac('0x30')](respondWithStatusCode(_0x256d47,null))[_0x8aac('0x4a')](handleError(_0x256d47,null));};exports[_0x8aac('0x7a')]=function(_0x985b40,_0x23618c,_0x4bd1e7){return db[_0x8aac('0x6d')][_0x8aac('0x49')]({'where':{'id':_0x985b40[_0x8aac('0x3d')][_0x8aac('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x8aac('0x61')],'as':_0x8aac('0x70'),'attributes':['id'],'raw':!![]}]})[_0x8aac('0x30')](handleEntityNotFound(_0x23618c,null))['then'](function(_0x131bcc){var _0x3b5536=_['map'](_0x131bcc,'id');var _0x6e92c8=[];var _0x381dd9=[];var _0xd007dc=squel[_0x8aac('0x7b')]();_0xd007dc[_0x8aac('0x7c')](_0x8aac('0x7d'))['from'](_0x8aac('0x7e'),'tq')['join'](_0x8aac('0x7f'),'ut',_0x8aac('0x80'))[_0x8aac('0x45')](_0x8aac('0x81'),_0x985b40['params']['id']);for(var _0x35b00a=0x0;_0x35b00a<_0x131bcc['length'];_0x35b00a+=0x1){let _0xc6ca77=_0x131bcc[_0x35b00a];for(var _0x35dbac=0x0;_0x35dbac<_0xc6ca77[_0x8aac('0x70')][_0x8aac('0x4e')];_0x35dbac+=0x1){let _0x4bb83d=_0xc6ca77[_0x8aac('0x70')][_0x35dbac];var _0xba943f=_0xd007dc[_0x8aac('0x82')]();_0xba943f[_0x8aac('0x45')](_0x8aac('0x83'),_0x4bb83d['id']);_0x381dd9['push'](db[_0x8aac('0x74')][_0x8aac('0x3d')](_0xba943f['toString'](),{'type':db['sequelize'][_0x8aac('0x84')][_0x8aac('0x85')]})[_0x8aac('0x30')](function(_0x1581b6){if(_0x1581b6[_0x8aac('0x4e')]===0x1){return _0x4bb83d['id'];}else{var _0x3262be=_[_0x8aac('0x86')](_['map'](_0x1581b6,_0x8aac('0x87')),function(_0x49e9c1){return _[_0x8aac('0x88')](_0x3b5536,_0x49e9c1);});if(_0x3262be){return _0x4bb83d['id'];}}}));}}return BPromise[_0x8aac('0x89')](_0x381dd9)[_0x8aac('0x30')](function(_0x1291d7){_0x6e92c8=_(_0x6e92c8)[_0x8aac('0x8a')](_0x1291d7)['compact']()[_0x8aac('0x8b')]();return db[_0x8aac('0x37')][_0x8aac('0x51')]({'where':{'id':_0x985b40[_0x8aac('0x4c')]['id']}})[_0x8aac('0x30')](function(_0x76c05){return db[_0x8aac('0x74')][_0x8aac('0x75')](function(_0x22b680){return _0x76c05[_0x8aac('0x7a')](_0x985b40[_0x8aac('0x3d')][_0x8aac('0x6f')],{'transaction':_0x22b680})[_0x8aac('0x30')](function(){if(!_[_0x8aac('0x8c')](_0x6e92c8)){return _0x76c05[_0x8aac('0x8d')](_0x6e92c8,{'transaction':_0x22b680});}})[_0x8aac('0x30')](function(){_0x6e92c8[_0x8aac('0x78')](function(_0x7b6c19){socket[_0x8aac('0x8e')](_0x8aac('0x8f'),{'UserId':_0x7b6c19,'OpenchannelQueueId':_0x76c05['id']});});});});});});})['then'](respondWithStatusCode(_0x23618c,null))[_0x8aac('0x4a')](handleError(_0x23618c,null));};exports['addAgents']=function(_0x384784,_0x464a91,_0x5c71b7){return db[_0x8aac('0x37')]['find']({'where':{'id':_0x384784[_0x8aac('0x4c')]['id']}})[_0x8aac('0x30')](handleEntityNotFound(_0x464a91,null))['then'](function(_0x1c6973){if(_0x1c6973){return _0x1c6973[_0x8aac('0x90')](_0x384784['body'][_0x8aac('0x6f')],_[_0x8aac('0x91')](_0x384784[_0x8aac('0x59')],['ids','id'])||{})['spread'](function(_0x2d66b9){for(var _0x557bfd=0x0;_0x557bfd<_0x384784[_0x8aac('0x59')][_0x8aac('0x6f')][_0x8aac('0x4e')];_0x557bfd+=0x1){socket[_0x8aac('0x8e')](_0x8aac('0x79'),{'UserId':Number(_0x384784[_0x8aac('0x59')][_0x8aac('0x6f')][_0x557bfd]),'OpenchannelQueueId':Number(_0x384784[_0x8aac('0x4c')]['id'])});}return _0x2d66b9;});}})[_0x8aac('0x30')](respondWithResult(_0x464a91,null))['catch'](handleError(_0x464a91,null));};exports['removeAgents']=function(_0x3d5820,_0x5c6d48,_0x3aafd6){return db['OpenchannelQueue'][_0x8aac('0x51')]({'where':{'id':_0x3d5820[_0x8aac('0x4c')]['id']}})[_0x8aac('0x30')](handleEntityNotFound(_0x5c6d48,null))['then'](function(_0x373dd6){if(_0x373dd6){return _0x373dd6[_0x8aac('0x8d')](_0x3d5820[_0x8aac('0x3d')]['ids'])[_0x8aac('0x30')](function(){if(_['isArray'](_0x3d5820['query'][_0x8aac('0x6f')])){for(var _0x2f013e=0x0;_0x2f013e<_0x3d5820[_0x8aac('0x3d')][_0x8aac('0x6f')][_0x8aac('0x4e')];_0x2f013e+=0x1){socket['emit'](_0x8aac('0x8f'),{'UserId':Number(_0x3d5820['query'][_0x8aac('0x6f')][_0x2f013e]),'OpenchannelQueueId':Number(_0x3d5820[_0x8aac('0x4c')]['id'])});}}else{socket['emit'](_0x8aac('0x8f'),{'UserId':Number(_0x3d5820[_0x8aac('0x3d')][_0x8aac('0x6f')]),'OpenchannelQueueId':Number(_0x3d5820[_0x8aac('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c6d48,null))['catch'](handleError(_0x5c6d48,null));};exports[_0x8aac('0x92')]=function(_0x443bd7,_0x25a4db,_0x43d766){var _0x2fec85={};var _0x303743={};var _0x5aa105;var _0x56dfc6;return db[_0x8aac('0x37')]['findOne']({'where':{'id':_0x443bd7[_0x8aac('0x4c')]['id']}})[_0x8aac('0x30')](handleEntityNotFound(_0x25a4db,null))[_0x8aac('0x30')](function(_0x817909){if(_0x817909){_0x5aa105=_0x817909;_0x303743[_0x8aac('0x3c')]=_[_0x8aac('0x3e')](db[_0x8aac('0x61')][_0x8aac('0x38')]);_0x303743[_0x8aac('0x3d')]=_['keys'](_0x443bd7['query']);_0x303743[_0x8aac('0x3f')]=_[_0x8aac('0x4d')](_0x303743[_0x8aac('0x3c')],_0x303743[_0x8aac('0x3d')]);_0x2fec85['attributes']=_[_0x8aac('0x4d')](_0x303743[_0x8aac('0x3c')],qs['fields'](_0x443bd7[_0x8aac('0x3d')][_0x8aac('0x41')]));_0x2fec85[_0x8aac('0x40')]=_0x2fec85['attributes'][_0x8aac('0x4e')]?_0x2fec85['attributes']:_0x303743[_0x8aac('0x3c')];_0x2fec85[_0x8aac('0x5c')]=qs[_0x8aac('0x44')](_0x443bd7[_0x8aac('0x3d')]['sort']);_0x2fec85[_0x8aac('0x45')]=qs[_0x8aac('0x3f')](_[_0x8aac('0x5d')](_0x443bd7[_0x8aac('0x3d')],_0x303743[_0x8aac('0x3f')]));if(_0x443bd7[_0x8aac('0x3d')][_0x8aac('0x47')]){_0x2fec85[_0x8aac('0x45')]=_[_0x8aac('0x50')](_0x2fec85[_0x8aac('0x45')],{'$or':_[_0x8aac('0x36')](_0x2fec85[_0x8aac('0x40')],function(_0x5ebbd1){var _0x5d08c4={};_0x5d08c4[_0x5ebbd1]={'$like':'%'+_0x443bd7[_0x8aac('0x3d')][_0x8aac('0x47')]+'%'};return _0x5d08c4;})});}_0x2fec85=_['merge']({},_0x2fec85,_0x443bd7[_0x8aac('0x5f')]);return _0x5aa105['getAgents'](_0x2fec85);}})[_0x8aac('0x30')](function(_0x316cb){if(_0x316cb){_0x56dfc6=_0x316cb[_0x8aac('0x4e')];if(!_0x443bd7['query'][_0x8aac('0x42')]('nolimit')){_0x2fec85[_0x8aac('0x27')]=qs['limit'](_0x443bd7[_0x8aac('0x3d')][_0x8aac('0x27')]);_0x2fec85[_0x8aac('0x25')]=qs[_0x8aac('0x25')](_0x443bd7[_0x8aac('0x3d')]['offset']);}return _0x5aa105[_0x8aac('0x92')](_0x2fec85);}})[_0x8aac('0x30')](function(_0x3c3d89){if(_0x3c3d89){return _0x3c3d89?{'count':_0x56dfc6,'rows':_0x3c3d89}:null;}})[_0x8aac('0x30')](respondWithResult(_0x25a4db,null))[_0x8aac('0x4a')](handleError(_0x25a4db,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8daaa5c..0043bcb 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 _0xc17b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3420e3,_0x38a6f5){var _0x3d9155=function(_0x37a1e1){while(--_0x37a1e1){_0x3420e3['push'](_0x3420e3['shift']());}};_0x3d9155(++_0x38a6f5);}(_0xc17b,0x1a0));var _0xbc17=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xc17b[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0xbc17('0x0'));var OpenchannelQueue=require(_0xbc17('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xbc17('0x2')](0x0);var events={'afterCreate':_0xbc17('0x3'),'afterUpdate':_0xbc17('0x4'),'afterDestroy':_0xbc17('0x5')};function emitEvent(_0xc8b0c6){return function(_0xc30a55,_0x63eaab,_0x46e03e){OpenchannelQueueEvents[_0xbc17('0x6')](_0xc8b0c6+':'+_0xc30a55['id'],_0xc30a55);OpenchannelQueueEvents[_0xbc17('0x6')](_0xc8b0c6,_0xc30a55);_0x46e03e(null);};}for(var e in events){if(events[_0xbc17('0x7')](e)){var event=events[e];OpenchannelQueue[_0xbc17('0x8')](e,emitEvent(event));}}module[_0xbc17('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6890=['save','remove','emit','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x81ab8b,_0x5677be){var _0x377eba=function(_0x4eb469){while(--_0x4eb469){_0x81ab8b['push'](_0x81ab8b['shift']());}};_0x377eba(++_0x5677be);}(_0x6890,0xc0));var _0x0689=function(_0x24145d,_0xd79373){_0x24145d=_0x24145d-0x0;var _0x37b939=_0x6890[_0x24145d];return _0x37b939;};'use strict';var EventEmitter=require(_0x0689('0x0'));var OpenchannelQueue=require(_0x0689('0x1'))['db'][_0x0689('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0689('0x3')](0x0);var events={'afterCreate':_0x0689('0x4'),'afterUpdate':'update','afterDestroy':_0x0689('0x5')};function emitEvent(_0x55cd2f){return function(_0x51648e,_0x3909c0,_0x959535){OpenchannelQueueEvents[_0x0689('0x6')](_0x55cd2f+':'+_0x51648e['id'],_0x51648e);OpenchannelQueueEvents[_0x0689('0x6')](_0x55cd2f,_0x51648e);_0x959535(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 diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 97734af..6c222fb 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 _0x99fd=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x547fed,_0x5bfc8a){var _0x1a6b71=function(_0x7547a9){while(--_0x7547a9){_0x547fed['push'](_0x547fed['shift']());}};_0x1a6b71(++_0x5bfc8a);}(_0x99fd,0x15e));var _0xd99f=function(_0x3bd49c,_0x584ed9){_0x3bd49c=_0x3bd49c-0x0;var _0x636b9d=_0x99fd[_0x3bd49c];return _0x636b9d;};'use strict';var _=require(_0xd99f('0x0'));var util=require(_0xd99f('0x1'));var logger=require(_0xd99f('0x2'))(_0xd99f('0x3'));var moment=require(_0xd99f('0x4'));var BPromise=require(_0xd99f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd99f('0x6'));var config=require(_0xd99f('0x7'));var attributes=require(_0xd99f('0x8'));module[_0xd99f('0x9')]=function(_0x149074,_0x279bab){return _0x149074[_0xd99f('0xa')](_0xd99f('0xb'),attributes,{'tableName':_0xd99f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb61c=['define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelQueue.attributes','exports'];(function(_0x2d88a5,_0x35f233){var _0x72bd78=function(_0x3367b4){while(--_0x3367b4){_0x2d88a5['push'](_0x2d88a5['shift']());}};_0x72bd78(++_0x35f233);}(_0xb61c,0x182));var _0xcb61=function(_0xfe3069,_0x97f218){_0xfe3069=_0xfe3069-0x0;var _0xd8edbe=_0xb61c[_0xfe3069];return _0xd8edbe;};'use strict';var _=require(_0xcb61('0x0'));var util=require(_0xcb61('0x1'));var logger=require(_0xcb61('0x2'))(_0xcb61('0x3'));var moment=require(_0xcb61('0x4'));var BPromise=require('bluebird');var rp=require(_0xcb61('0x5'));var fs=require('fs');var path=require(_0xcb61('0x6'));var rimraf=require(_0xcb61('0x7'));var config=require('../../config/environment');var attributes=require(_0xcb61('0x8'));module[_0xcb61('0x9')]=function(_0x2147bb,_0x128edc){return _0x2147bb[_0xcb61('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','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 0541956..712b799 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 _0x0dcb=['find','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','ShowOpenchannelQueue'];(function(_0xe0c564,_0x2ff569){var _0x32e0f6=function(_0x3fd0fc){while(--_0x3fd0fc){_0xe0c564['push'](_0xe0c564['shift']());}};_0x32e0f6(++_0x2ff569);}(_0x0dcb,0x74));var _0xb0dc=function(_0x2828b2,_0x4b2485){_0x2828b2=_0x2828b2-0x0;var _0x3422b5=_0x0dcb[_0x2828b2];return _0x3422b5;};'use strict';var _=require(_0xb0dc('0x0'));var util=require('util');var moment=require(_0xb0dc('0x1'));var BPromise=require(_0xb0dc('0x2'));var rs=require(_0xb0dc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0dc('0x4'))['db'];var utils=require(_0xb0dc('0x5'));var logger=require(_0xb0dc('0x6'))('rpc');var config=require(_0xb0dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb0dc('0x8')]['http']({'port':0x232a});config[_0xb0dc('0x9')]=_[_0xb0dc('0xa')](config[_0xb0dc('0x9')],{'host':_0xb0dc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0dc('0x9')]));require(_0xb0dc('0xc'))['register'](socket);function respondWithRpcPromise(_0x4750ed,_0x291697,_0x289ecc){return new BPromise(function(_0x5a4fa7,_0x7d8a85){return client[_0xb0dc('0xd')](_0x4750ed,_0x289ecc)[_0xb0dc('0xe')](function(_0x1852cc){logger[_0xb0dc('0xf')](_0xb0dc('0x10'),_0x291697,_0xb0dc('0x11'));logger[_0xb0dc('0x12')](_0xb0dc('0x13'),_0x291697,_0xb0dc('0x11'),JSON['stringify'](_0x1852cc));if(_0x1852cc[_0xb0dc('0x14')]){if(_0x1852cc[_0xb0dc('0x14')][_0xb0dc('0x15')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x291697,_0x1852cc['error'][_0xb0dc('0x16')]);return _0x7d8a85(_0x1852cc[_0xb0dc('0x14')][_0xb0dc('0x16')]);}logger[_0xb0dc('0x14')](_0xb0dc('0x10'),_0x291697,_0x1852cc[_0xb0dc('0x14')]['message']);return _0x5a4fa7(_0x1852cc[_0xb0dc('0x14')][_0xb0dc('0x16')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x291697,_0xb0dc('0x11'));_0x5a4fa7(_0x1852cc[_0xb0dc('0x17')][_0xb0dc('0x16')]);}})[_0xb0dc('0x18')](function(_0x371762){logger[_0xb0dc('0x14')](_0xb0dc('0x10'),_0x291697,_0x371762);_0x7d8a85(_0x371762);});});}exports[_0xb0dc('0x19')]=function(_0x271b89){var _0xac4c9f=this;return new Promise(function(_0x5f87d8,_0x1b4ec5){return db[_0xb0dc('0x1a')][_0xb0dc('0x1b')]({'raw':_0x271b89[_0xb0dc('0x1c')]?_0x271b89[_0xb0dc('0x1c')][_0xb0dc('0x1d')]===undefined?!![]:![]:!![],'where':_0x271b89['options']?_0x271b89[_0xb0dc('0x1c')][_0xb0dc('0x1e')]||null:null,'attributes':_0x271b89[_0xb0dc('0x1c')]?_0x271b89['options'][_0xb0dc('0x1f')]||null:null,'limit':_0x271b89[_0xb0dc('0x1c')]?_0x271b89['options']['limit']||null:null,'include':_0x271b89['options']?_0x271b89[_0xb0dc('0x1c')][_0xb0dc('0x20')]?_[_0xb0dc('0x21')](_0x271b89['options']['include'],function(_0x57740d){return{'model':db[_0x57740d['model']],'as':_0x57740d['as'],'attributes':_0x57740d['attributes'],'include':_0x57740d['include']?_[_0xb0dc('0x21')](_0x57740d[_0xb0dc('0x20')],function(_0x359dd2){return{'model':db[_0x359dd2[_0xb0dc('0x22')]],'as':_0x359dd2['as'],'attributes':_0x359dd2[_0xb0dc('0x1f')],'include':_0x359dd2[_0xb0dc('0x20')]?_['map'](_0x359dd2[_0xb0dc('0x20')],function(_0x2f5bf5){return{'model':db[_0x2f5bf5[_0xb0dc('0x22')]],'as':_0x2f5bf5['as'],'attributes':_0x2f5bf5[_0xb0dc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb0dc('0xe')](function(_0x40e57b){logger['info'](_0xb0dc('0x19'),_0x271b89);logger[_0xb0dc('0x12')](_0xb0dc('0x19'),_0x271b89,JSON['stringify'](_0x40e57b));_0x5f87d8(_0x40e57b);})[_0xb0dc('0x18')](function(_0x3fb8f6){logger['error'](_0xb0dc('0x19'),_0x3fb8f6[_0xb0dc('0x16')],_0x271b89);_0x1b4ec5(_0xac4c9f[_0xb0dc('0x14')](0x1f4,_0x3fb8f6['message']));});});};exports[_0xb0dc('0x23')]=function(_0x305155){var _0x1d2dc4=this;return new Promise(function(_0x5e127,_0x2e87a0){return db['OpenchannelQueue'][_0xb0dc('0x24')]({'raw':_0x305155['options']?_0x305155[_0xb0dc('0x1c')][_0xb0dc('0x1d')]===undefined?!![]:![]:!![],'where':_0x305155['options']?_0x305155[_0xb0dc('0x1c')][_0xb0dc('0x1e')]||null:null,'attributes':_0x305155[_0xb0dc('0x1c')]?_0x305155[_0xb0dc('0x1c')][_0xb0dc('0x1f')]||null:null,'include':_0x305155[_0xb0dc('0x1c')]?_0x305155[_0xb0dc('0x1c')][_0xb0dc('0x20')]?_[_0xb0dc('0x21')](_0x305155[_0xb0dc('0x1c')][_0xb0dc('0x20')],function(_0x5a556a){return{'model':db[_0x5a556a[_0xb0dc('0x22')]],'as':_0x5a556a['as'],'attributes':_0x5a556a[_0xb0dc('0x1f')],'include':_0x5a556a[_0xb0dc('0x20')]?_[_0xb0dc('0x21')](_0x5a556a['include'],function(_0x359734){return{'model':db[_0x359734['model']],'as':_0x359734['as'],'attributes':_0x359734[_0xb0dc('0x1f')],'include':_0x359734[_0xb0dc('0x20')]?_['map'](_0x359734[_0xb0dc('0x20')],function(_0x460edf){return{'model':db[_0x460edf['model']],'as':_0x460edf['as'],'attributes':_0x460edf[_0xb0dc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb0dc('0xe')](function(_0x47f067){logger[_0xb0dc('0xf')]('ShowOpenchannelQueue',_0x305155);logger[_0xb0dc('0x12')](_0xb0dc('0x23'),_0x305155,JSON[_0xb0dc('0x25')](_0x47f067));_0x5e127(_0x47f067);})['catch'](function(_0x8b4d42){logger['error'](_0xb0dc('0x23'),_0x8b4d42[_0xb0dc('0x16')],_0x305155);_0x2e87a0(_0x1d2dc4[_0xb0dc('0x14')](0x1f4,_0x8b4d42[_0xb0dc('0x16')]));});});}; \ No newline at end of file +var _0x20be=['http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x174773,_0x2ec198){var _0x3fabef=function(_0x2761de){while(--_0x2761de){_0x174773['push'](_0x174773['shift']());}};_0x3fabef(++_0x2ec198);}(_0x20be,0x1d7));var _0xe20b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x20be[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xe20b('0x0'));var util=require(_0xe20b('0x1'));var moment=require(_0xe20b('0x2'));var BPromise=require(_0xe20b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe20b('0x4'))['db'];var utils=require(_0xe20b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe20b('0x6'));var jayson=require(_0xe20b('0x7'));var client=jayson[_0xe20b('0x8')][_0xe20b('0x9')]({'port':0x232a});config[_0xe20b('0xa')]=_[_0xe20b('0xb')](config['redis'],{'host':_0xe20b('0xc'),'port':0x18eb});var socket=require(_0xe20b('0xd'))(new Redis(config[_0xe20b('0xa')]));require(_0xe20b('0xe'))[_0xe20b('0xf')](socket);function respondWithRpcPromise(_0x1d32f6,_0x1dedff,_0x190aef){return new BPromise(function(_0x2d5d62,_0x46b942){return client[_0xe20b('0x10')](_0x1d32f6,_0x190aef)[_0xe20b('0x11')](function(_0x2b98fd){logger[_0xe20b('0x12')](_0xe20b('0x13'),_0x1dedff,_0xe20b('0x14'));logger[_0xe20b('0x15')](_0xe20b('0x16'),_0x1dedff,_0xe20b('0x14'),JSON[_0xe20b('0x17')](_0x2b98fd));if(_0x2b98fd['error']){if(_0x2b98fd[_0xe20b('0x18')][_0xe20b('0x19')]===0x1f4){logger[_0xe20b('0x18')](_0xe20b('0x13'),_0x1dedff,_0x2b98fd[_0xe20b('0x18')][_0xe20b('0x1a')]);return _0x46b942(_0x2b98fd[_0xe20b('0x18')][_0xe20b('0x1a')]);}logger[_0xe20b('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x1dedff,_0x2b98fd[_0xe20b('0x18')][_0xe20b('0x1a')]);return _0x2d5d62(_0x2b98fd[_0xe20b('0x18')]['message']);}else{logger[_0xe20b('0x12')](_0xe20b('0x13'),_0x1dedff,_0xe20b('0x14'));_0x2d5d62(_0x2b98fd[_0xe20b('0x1b')][_0xe20b('0x1a')]);}})[_0xe20b('0x1c')](function(_0x13f962){logger[_0xe20b('0x18')](_0xe20b('0x13'),_0x1dedff,_0x13f962);_0x46b942(_0x13f962);});});}exports[_0xe20b('0x1d')]=function(_0x113a6e){var _0x17d6cd=this;return new Promise(function(_0x474f68,_0x2c0899){return db[_0xe20b('0x1e')]['findAll']({'raw':_0x113a6e[_0xe20b('0x1f')]?_0x113a6e['options'][_0xe20b('0x20')]===undefined?!![]:![]:!![],'where':_0x113a6e[_0xe20b('0x1f')]?_0x113a6e[_0xe20b('0x1f')]['where']||null:null,'attributes':_0x113a6e[_0xe20b('0x1f')]?_0x113a6e[_0xe20b('0x1f')][_0xe20b('0x21')]||null:null,'limit':_0x113a6e[_0xe20b('0x1f')]?_0x113a6e[_0xe20b('0x1f')][_0xe20b('0x22')]||null:null,'include':_0x113a6e[_0xe20b('0x1f')]?_0x113a6e[_0xe20b('0x1f')][_0xe20b('0x23')]?_[_0xe20b('0x24')](_0x113a6e[_0xe20b('0x1f')][_0xe20b('0x23')],function(_0x480e6a){return{'model':db[_0x480e6a[_0xe20b('0x25')]],'as':_0x480e6a['as'],'attributes':_0x480e6a[_0xe20b('0x21')],'include':_0x480e6a[_0xe20b('0x23')]?_[_0xe20b('0x24')](_0x480e6a[_0xe20b('0x23')],function(_0x1aed58){return{'model':db[_0x1aed58[_0xe20b('0x25')]],'as':_0x1aed58['as'],'attributes':_0x1aed58[_0xe20b('0x21')],'include':_0x1aed58['include']?_['map'](_0x1aed58[_0xe20b('0x23')],function(_0x304942){return{'model':db[_0x304942[_0xe20b('0x25')]],'as':_0x304942['as'],'attributes':_0x304942['attributes']};}):[]};}):[]};}):[]:[]})[_0xe20b('0x11')](function(_0x2405d1){logger['info']('GetOpenchannelQueue',_0x113a6e);logger['debug'](_0xe20b('0x1d'),_0x113a6e,JSON['stringify'](_0x2405d1));_0x474f68(_0x2405d1);})[_0xe20b('0x1c')](function(_0x24b732){logger['error'](_0xe20b('0x1d'),_0x24b732[_0xe20b('0x1a')],_0x113a6e);_0x2c0899(_0x17d6cd['error'](0x1f4,_0x24b732[_0xe20b('0x1a')]));});});};exports[_0xe20b('0x26')]=function(_0x1ca615){var _0x3cd099=this;return new Promise(function(_0x1d4b5a,_0x365d42){return db[_0xe20b('0x1e')][_0xe20b('0x27')]({'raw':_0x1ca615[_0xe20b('0x1f')]?_0x1ca615[_0xe20b('0x1f')][_0xe20b('0x20')]===undefined?!![]:![]:!![],'where':_0x1ca615['options']?_0x1ca615['options']['where']||null:null,'attributes':_0x1ca615[_0xe20b('0x1f')]?_0x1ca615[_0xe20b('0x1f')][_0xe20b('0x21')]||null:null,'include':_0x1ca615[_0xe20b('0x1f')]?_0x1ca615[_0xe20b('0x1f')][_0xe20b('0x23')]?_[_0xe20b('0x24')](_0x1ca615[_0xe20b('0x1f')][_0xe20b('0x23')],function(_0x1d9c4c){return{'model':db[_0x1d9c4c['model']],'as':_0x1d9c4c['as'],'attributes':_0x1d9c4c[_0xe20b('0x21')],'include':_0x1d9c4c[_0xe20b('0x23')]?_[_0xe20b('0x24')](_0x1d9c4c[_0xe20b('0x23')],function(_0x34531c){return{'model':db[_0x34531c[_0xe20b('0x25')]],'as':_0x34531c['as'],'attributes':_0x34531c['attributes'],'include':_0x34531c[_0xe20b('0x23')]?_[_0xe20b('0x24')](_0x34531c[_0xe20b('0x23')],function(_0x51d3cb){return{'model':db[_0x51d3cb['model']],'as':_0x51d3cb['as'],'attributes':_0x51d3cb[_0xe20b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23da23){logger['info']('ShowOpenchannelQueue',_0x1ca615);logger[_0xe20b('0x15')](_0xe20b('0x26'),_0x1ca615,JSON[_0xe20b('0x17')](_0x23da23));_0x1d4b5a(_0x23da23);})[_0xe20b('0x1c')](function(_0xe7ecf1){logger[_0xe20b('0x18')](_0xe20b('0x26'),_0xe7ecf1['message'],_0x1ca615);_0x365d42(_0x3cd099['error'](0x1f4,_0xe7ecf1[_0xe20b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index a50651c..8f7d3fa 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 _0x6541=['update','register','openchannelQueue:','save','remove'];(function(_0x15fe6c,_0x50740c){var _0x3026e5=function(_0x4c4ac3){while(--_0x4c4ac3){_0x15fe6c['push'](_0x15fe6c['shift']());}};_0x3026e5(++_0x50740c);}(_0x6541,0xc6));var _0x1654=function(_0x24b911,_0x5cc69c){_0x24b911=_0x24b911-0x0;var _0xe7e9e2=_0x6541[_0x24b911];return _0xe7e9e2;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x1654('0x0'),_0x1654('0x1'),_0x1654('0x2')];function createListener(_0x4f5cdd,_0x5b4cae){return function(_0x56d5d8){_0x5b4cae['emit'](_0x4f5cdd,_0x56d5d8);};}function removeListener(_0x16dcb8,_0x30c5cb){return function(){OpenchannelQueueEvents['removeListener'](_0x16dcb8,_0x30c5cb);};}exports[_0x1654('0x3')]=function(_0x357782){for(var _0x4276ca=0x0,_0x3a03c7=events['length'];_0x4276ca<_0x3a03c7;_0x4276ca++){var _0x3f7d52=events[_0x4276ca];var _0x3beea6=createListener(_0x1654('0x4')+_0x3f7d52,_0x357782);OpenchannelQueueEvents['on'](_0x3f7d52,_0x3beea6);}}; \ No newline at end of file +var _0xc401=['emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc401,0x138));var _0x1c40=function(_0x4938d8,_0x9d674b){_0x4938d8=_0x4938d8-0x0;var _0x5bbf85=_0xc401[_0x4938d8];return _0x5bbf85;};'use strict';var OpenchannelQueueEvents=require(_0x1c40('0x0'));var events=['save',_0x1c40('0x1'),_0x1c40('0x2')];function createListener(_0x47247f,_0x5b064a){return function(_0x17f1b5){_0x5b064a[_0x1c40('0x3')](_0x47247f,_0x17f1b5);};}function removeListener(_0x16f5aa,_0x30b0fc){return function(){OpenchannelQueueEvents[_0x1c40('0x4')](_0x16f5aa,_0x30b0fc);};}exports['register']=function(_0x53cfa0){for(var _0x3d0a98=0x0,_0x485165=events[_0x1c40('0x5')];_0x3d0a98<_0x485165;_0x3d0a98++){var _0x4d1339=events[_0x3d0a98];var _0x3b5046=createListener(_0x1c40('0x6')+_0x4d1339,_0x53cfa0);OpenchannelQueueEvents['on'](_0x4d1339,_0x3b5046);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 660ac29..de738ac 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 _0x7c49=['/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get'];(function(_0x243333,_0x42d7a8){var _0x2a3a13=function(_0x598483){while(--_0x598483){_0x243333['push'](_0x243333['shift']());}};_0x2a3a13(++_0x42d7a8);}(_0x7c49,0xba));var _0x97c4=function(_0x11d10f,_0x275d65){_0x11d10f=_0x11d10f-0x0;var _0x4f3a86=_0x7c49[_0x11d10f];return _0x4f3a86;};'use strict';var multer=require('multer');var util=require(_0x97c4('0x0'));var path=require(_0x97c4('0x1'));var timeout=require(_0x97c4('0x2'));var express=require(_0x97c4('0x3'));var router=express[_0x97c4('0x4')]();var fs_extra=require(_0x97c4('0x5'));var auth=require(_0x97c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x97c4('0x7'));var controller=require(_0x97c4('0x8'));router['get']('/',auth[_0x97c4('0x9')](),controller[_0x97c4('0xa')]);router[_0x97c4('0xb')](_0x97c4('0xc'),auth['isAuthenticated'](),controller[_0x97c4('0xd')]);router['get'](_0x97c4('0xe'),auth[_0x97c4('0x9')](),controller[_0x97c4('0xf')]);router[_0x97c4('0x10')]('/',auth['isAuthenticated'](),controller[_0x97c4('0x11')]);router[_0x97c4('0x12')](_0x97c4('0xe'),auth[_0x97c4('0x9')](),controller[_0x97c4('0x13')]);router[_0x97c4('0x14')]('/:id',auth[_0x97c4('0x9')](),controller['destroy']);module[_0x97c4('0x15')]=router; \ No newline at end of file +var _0xadf5=['create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','show','post'];(function(_0x559937,_0x1194d8){var _0xe56031=function(_0x44011b){while(--_0x44011b){_0x559937['push'](_0x559937['shift']());}};_0xe56031(++_0x1194d8);}(_0xadf5,0x7f));var _0x5adf=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xadf5[_0x421cf8];return _0x145c48;};'use strict';var multer=require(_0x5adf('0x0'));var util=require(_0x5adf('0x1'));var path=require(_0x5adf('0x2'));var timeout=require(_0x5adf('0x3'));var express=require(_0x5adf('0x4'));var router=express[_0x5adf('0x5')]();var fs_extra=require(_0x5adf('0x6'));var auth=require(_0x5adf('0x7'));var interaction=require(_0x5adf('0x8'));var config=require(_0x5adf('0x9'));var controller=require(_0x5adf('0xa'));router[_0x5adf('0xb')]('/',auth[_0x5adf('0xc')](),controller[_0x5adf('0xd')]);router['get'](_0x5adf('0xe'),auth[_0x5adf('0xc')](),controller['describe']);router[_0x5adf('0xb')]('/:id',auth[_0x5adf('0xc')](),controller[_0x5adf('0xf')]);router[_0x5adf('0x10')]('/',auth[_0x5adf('0xc')](),controller[_0x5adf('0x11')]);router[_0x5adf('0x12')]('/:id',auth[_0x5adf('0xc')](),controller[_0x5adf('0x13')]);router[_0x5adf('0x14')](_0x5adf('0x15'),auth[_0x5adf('0xc')](),controller[_0x5adf('0x16')]);module[_0x5adf('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index f729914..2a5974a 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 _0xeee4=['DATE','moment','sequelize','exports','STRING'];(function(_0x4b42aa,_0x51b886){var _0x4a37bd=function(_0x13740f){while(--_0x13740f){_0x4b42aa['push'](_0x4b42aa['shift']());}};_0x4a37bd(++_0x51b886);}(_0xeee4,0xfb));var _0x4eee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeee4[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x4eee('0x0'));var Sequelize=require(_0x4eee('0x1'));module[_0x4eee('0x2')]={'uniqueid':{'type':Sequelize[_0x4eee('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4eee('0x3')]},'joinAt':{'type':Sequelize[_0x4eee('0x4')]},'leaveAt':{'type':Sequelize[_0x4eee('0x4')]},'acceptAt':{'type':Sequelize[_0x4eee('0x4')]},'exitAt':{'type':Sequelize[_0x4eee('0x4')]},'reason':{'type':Sequelize[_0x4eee('0x3')]}}; \ No newline at end of file +var _0xb3f3=['sequelize','STRING','DATE'];(function(_0x9f303f,_0x130e64){var _0x1d64bd=function(_0x5b475f){while(--_0x5b475f){_0x9f303f['push'](_0x9f303f['shift']());}};_0x1d64bd(++_0x130e64);}(_0xb3f3,0xcf));var _0x3b3f=function(_0x78029b,_0x19ce64){_0x78029b=_0x78029b-0x0;var _0x2c1b66=_0xb3f3[_0x78029b];return _0x2c1b66;};'use strict';var moment=require('moment');var Sequelize=require(_0x3b3f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3b3f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3b3f('0x1')]},'joinAt':{'type':Sequelize[_0x3b3f('0x2')]},'leaveAt':{'type':Sequelize[_0x3b3f('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3b3f('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 1f979fa..3c875d8 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 _0xd3af=['Content-Range','apply','reject','update','then','destroy','stack','name','send','OpenchannelQueueReport','rawAttributes','fieldName','type','model','map','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x2e38e0,_0x5841ba){var _0x173804=function(_0x1350cc){while(--_0x1350cc){_0x2e38e0['push'](_0x2e38e0['shift']());}};_0x173804(++_0x5841ba);}(_0xd3af,0x74));var _0xfd3a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd3af[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xfd3a('0x0'));var rimraf=require(_0xfd3a('0x1'));var zipdir=require(_0xfd3a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfd3a('0x3'));var BPromise=require(_0xfd3a('0x4'));var Mustache=require(_0xfd3a('0x5'));var util=require('util');var path=require(_0xfd3a('0x6'));var sox=require(_0xfd3a('0x7'));var csv=require(_0xfd3a('0x8'));var ejs=require(_0xfd3a('0x9'));var fs=require('fs');var fs_extra=require(_0xfd3a('0xa'));var _=require(_0xfd3a('0xb'));var squel=require('squel');var crypto=require(_0xfd3a('0xc'));var jsforce=require(_0xfd3a('0xd'));var deskjs=require(_0xfd3a('0xe'));var toCsv=require(_0xfd3a('0x8'));var querystring=require('querystring');var Papa=require(_0xfd3a('0xf'));var Redis=require(_0xfd3a('0x10'));var authService=require(_0xfd3a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd3a('0x12'));var logger=require(_0xfd3a('0x13'))(_0xfd3a('0x14'));var utils=require(_0xfd3a('0x15'));var config=require(_0xfd3a('0x16'));var licenseUtil=require(_0xfd3a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1818f1,_0x3d1036){_0x3d1036=_0x3d1036||0xcc;return function(_0x395e17){if(_0x395e17){return _0x1818f1[_0xfd3a('0x18')](_0x3d1036);}return _0x1818f1[_0xfd3a('0x19')](_0x3d1036)[_0xfd3a('0x1a')]();};}function respondWithResult(_0xe4b746,_0x408a2b){_0x408a2b=_0x408a2b||0xc8;return function(_0x4bd4be){if(_0x4bd4be){return _0xe4b746['status'](_0x408a2b)[_0xfd3a('0x1b')](_0x4bd4be);}};}function respondWithFilteredResult(_0x38985b,_0x2e71ee){return function(_0x1c2d7a){if(_0x1c2d7a){var _0x3c19bc=typeof _0x2e71ee[_0xfd3a('0x1c')]===_0xfd3a('0x1d')&&typeof _0x2e71ee[_0xfd3a('0x1e')]===_0xfd3a('0x1d');var _0x55bc5a=_0x1c2d7a[_0xfd3a('0x1f')];var _0x4bf6f2=_0x3c19bc?0x0:_0x2e71ee[_0xfd3a('0x1c')];var _0x4f976d=_0x3c19bc?_0x1c2d7a[_0xfd3a('0x1f')]:_0x2e71ee['offset']+_0x2e71ee[_0xfd3a('0x1e')];var _0x161abd;if(_0x4f976d>=_0x55bc5a){_0x4f976d=_0x55bc5a;_0x161abd=0xc8;}else{_0x161abd=0xce;}_0x38985b[_0xfd3a('0x19')](_0x161abd);return _0x38985b['set'](_0xfd3a('0x20'),_0x4bf6f2+'-'+_0x4f976d+'/'+_0x55bc5a)[_0xfd3a('0x1b')](_0x1c2d7a);}return null;};}function patchUpdates(_0x22b5b3){return function(_0x150623){try{jsonpatch[_0xfd3a('0x21')](_0x150623,_0x22b5b3,!![]);}catch(_0x451c2c){return BPromise[_0xfd3a('0x22')](_0x451c2c);}return _0x150623['save']();};}function saveUpdates(_0x4fc8a5,_0x69dfed){return function(_0x4445be){if(_0x4445be){return _0x4445be[_0xfd3a('0x23')](_0x4fc8a5)[_0xfd3a('0x24')](function(_0x3ef6d7){return _0x3ef6d7;});}return null;};}function removeEntity(_0x4a2d1f,_0xcf168a){return function(_0x52ff49){if(_0x52ff49){return _0x52ff49[_0xfd3a('0x25')]()[_0xfd3a('0x24')](function(){_0x4a2d1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x188e88,_0x392191){return function(_0xac88ae){if(!_0xac88ae){_0x188e88[_0xfd3a('0x18')](0x194);}return _0xac88ae;};}function handleError(_0xc2120c,_0x455599){_0x455599=_0x455599||0x1f4;return function(_0x367b9a){logger['error'](_0x367b9a[_0xfd3a('0x26')]);if(_0x367b9a[_0xfd3a('0x27')]){delete _0x367b9a[_0xfd3a('0x27')];}_0xc2120c['status'](_0x455599)[_0xfd3a('0x28')](_0x367b9a);};}exports['index']=function(_0x1a9c5b,_0x7c8875){var _0x58be01={},_0x24f4c0={},_0x3762f7={'count':0x0,'rows':[]};var _0x2d2e71=_['map'](db[_0xfd3a('0x29')][_0xfd3a('0x2a')],function(_0x43db77){return{'name':_0x43db77[_0xfd3a('0x2b')],'type':_0x43db77[_0xfd3a('0x2c')]['key']};});_0x24f4c0[_0xfd3a('0x2d')]=_[_0xfd3a('0x2e')](_0x2d2e71,_0xfd3a('0x27'));_0x24f4c0['query']=_[_0xfd3a('0x2f')](_0x1a9c5b['query']);_0x24f4c0[_0xfd3a('0x30')]=_[_0xfd3a('0x31')](_0x24f4c0[_0xfd3a('0x2d')],_0x24f4c0['query']);_0x58be01[_0xfd3a('0x32')]=_[_0xfd3a('0x31')](_0x24f4c0[_0xfd3a('0x2d')],qs[_0xfd3a('0x33')](_0x1a9c5b[_0xfd3a('0x34')][_0xfd3a('0x33')]));_0x58be01[_0xfd3a('0x32')]=_0x58be01[_0xfd3a('0x32')][_0xfd3a('0x35')]?_0x58be01[_0xfd3a('0x32')]:_0x24f4c0[_0xfd3a('0x2d')];if(!_0x1a9c5b['query'][_0xfd3a('0x36')](_0xfd3a('0x37'))){_0x58be01[_0xfd3a('0x1e')]=qs[_0xfd3a('0x1e')](_0x1a9c5b['query'][_0xfd3a('0x1e')]);_0x58be01[_0xfd3a('0x1c')]=qs[_0xfd3a('0x1c')](_0x1a9c5b[_0xfd3a('0x34')][_0xfd3a('0x1c')]);}_0x58be01[_0xfd3a('0x38')]=qs[_0xfd3a('0x39')](_0x1a9c5b[_0xfd3a('0x34')]['sort']);_0x58be01[_0xfd3a('0x3a')]=qs[_0xfd3a('0x30')](_[_0xfd3a('0x3b')](_0x1a9c5b['query'],_0x24f4c0[_0xfd3a('0x30')]),_0x2d2e71);if(_0x1a9c5b[_0xfd3a('0x34')][_0xfd3a('0x3c')]){_0x58be01[_0xfd3a('0x3a')]=_[_0xfd3a('0x3d')](_0x58be01[_0xfd3a('0x3a')],{'$or':_[_0xfd3a('0x2e')](_0x2d2e71,function(_0x57c8e5){if(_0x57c8e5[_0xfd3a('0x2c')]!=='VIRTUAL'){var _0x1f6cff={};_0x1f6cff[_0x57c8e5[_0xfd3a('0x27')]]={'$like':'%'+_0x1a9c5b['query'][_0xfd3a('0x3c')]+'%'};return _0x1f6cff;}})});}_0x58be01=_[_0xfd3a('0x3d')]({},_0x58be01,_0x1a9c5b[_0xfd3a('0x3e')]);var _0x5c14c5={'where':_0x58be01[_0xfd3a('0x3a')]};return db['OpenchannelQueueReport'][_0xfd3a('0x1f')](_0x5c14c5)['then'](function(_0x5c6467){_0x3762f7[_0xfd3a('0x1f')]=_0x5c6467;if(_0x1a9c5b[_0xfd3a('0x34')]['includeAll']){_0x58be01[_0xfd3a('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xfd3a('0x40')](_0x58be01);})[_0xfd3a('0x24')](function(_0x37eaad){_0x3762f7[_0xfd3a('0x41')]=_0x37eaad;return _0x3762f7;})[_0xfd3a('0x24')](respondWithFilteredResult(_0x7c8875,_0x58be01))[_0xfd3a('0x42')](handleError(_0x7c8875,null));};exports[_0xfd3a('0x43')]=function(_0x4647b5,_0x27fd66){var _0x2bdeb5={'raw':!![],'where':{'id':_0x4647b5[_0xfd3a('0x44')]['id']}},_0x1c1e49={};_0x1c1e49[_0xfd3a('0x2d')]=_[_0xfd3a('0x2f')](db[_0xfd3a('0x29')][_0xfd3a('0x2a')]);_0x1c1e49['query']=_[_0xfd3a('0x2f')](_0x4647b5[_0xfd3a('0x34')]);_0x1c1e49[_0xfd3a('0x30')]=_['intersection'](_0x1c1e49[_0xfd3a('0x2d')],_0x1c1e49[_0xfd3a('0x34')]);_0x2bdeb5[_0xfd3a('0x32')]=_['intersection'](_0x1c1e49[_0xfd3a('0x2d')],qs[_0xfd3a('0x33')](_0x4647b5['query'][_0xfd3a('0x33')]));_0x2bdeb5[_0xfd3a('0x32')]=_0x2bdeb5[_0xfd3a('0x32')][_0xfd3a('0x35')]?_0x2bdeb5['attributes']:_0x1c1e49['model'];if(_0x4647b5[_0xfd3a('0x34')][_0xfd3a('0x45')]){_0x2bdeb5[_0xfd3a('0x3f')]=[{'all':!![]}];}_0x2bdeb5=_[_0xfd3a('0x3d')]({},_0x2bdeb5,_0x4647b5[_0xfd3a('0x3e')]);return db[_0xfd3a('0x29')][_0xfd3a('0x46')](_0x2bdeb5)[_0xfd3a('0x24')](handleEntityNotFound(_0x27fd66,null))[_0xfd3a('0x24')](respondWithResult(_0x27fd66,null))[_0xfd3a('0x42')](handleError(_0x27fd66,null));};exports[_0xfd3a('0x47')]=function(_0x387cf1,_0x5b2974){return db[_0xfd3a('0x29')][_0xfd3a('0x47')](_0x387cf1['body'],{})[_0xfd3a('0x24')](respondWithResult(_0x5b2974,0xc9))[_0xfd3a('0x42')](handleError(_0x5b2974,null));};exports[_0xfd3a('0x23')]=function(_0x2ef0e2,_0x4cb86a){if(_0x2ef0e2[_0xfd3a('0x48')]['id']){delete _0x2ef0e2['body']['id'];}return db[_0xfd3a('0x29')][_0xfd3a('0x46')]({'where':{'id':_0x2ef0e2[_0xfd3a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cb86a,null))[_0xfd3a('0x24')](saveUpdates(_0x2ef0e2[_0xfd3a('0x48')],null))[_0xfd3a('0x24')](respondWithResult(_0x4cb86a,null))[_0xfd3a('0x42')](handleError(_0x4cb86a,null));};exports[_0xfd3a('0x25')]=function(_0x2e6fd5,_0x4f18f0){return db[_0xfd3a('0x29')]['find']({'where':{'id':_0x2e6fd5[_0xfd3a('0x44')]['id']}})[_0xfd3a('0x24')](handleEntityNotFound(_0x4f18f0,null))[_0xfd3a('0x24')](removeEntity(_0x4f18f0,null))[_0xfd3a('0x42')](handleError(_0x4f18f0,null));};exports['describe']=function(_0x27cb43,_0x48bab5){return db[_0xfd3a('0x29')][_0xfd3a('0x49')]()[_0xfd3a('0x24')](respondWithResult(_0x48bab5,null))[_0xfd3a('0x42')](handleError(_0x48bab5,null));}; \ No newline at end of file +var _0xddc3=['describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find'];(function(_0x3bb660,_0x5eae93){var _0x6d4abe=function(_0x819c66){while(--_0x819c66){_0x3bb660['push'](_0x3bb660['shift']());}};_0x6d4abe(++_0x5eae93);}(_0xddc3,0x17d));var _0x3ddc=function(_0x3bdae4,_0x340726){_0x3bdae4=_0x3bdae4-0x0;var _0x10fcbb=_0xddc3[_0x3bdae4];return _0x10fcbb;};'use strict';var emlformat=require(_0x3ddc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ddc('0x1'));var jsonpatch=require(_0x3ddc('0x2'));var rp=require(_0x3ddc('0x3'));var moment=require(_0x3ddc('0x4'));var BPromise=require(_0x3ddc('0x5'));var Mustache=require(_0x3ddc('0x6'));var util=require(_0x3ddc('0x7'));var path=require(_0x3ddc('0x8'));var sox=require(_0x3ddc('0x9'));var csv=require(_0x3ddc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ddc('0xb'));var squel=require(_0x3ddc('0xc'));var crypto=require('crypto');var jsforce=require(_0x3ddc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3ddc('0xe'));var Redis=require(_0x3ddc('0xf'));var authService=require(_0x3ddc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3ddc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ddc('0x12'))(_0x3ddc('0x13'));var utils=require('../../config/utils');var config=require(_0x3ddc('0x14'));var licenseUtil=require(_0x3ddc('0x15'));var db=require(_0x3ddc('0x16'))['db'];function respondWithStatusCode(_0xfbcf56,_0x49296c){_0x49296c=_0x49296c||0xcc;return function(_0x39ce92){if(_0x39ce92){return _0xfbcf56[_0x3ddc('0x17')](_0x49296c);}return _0xfbcf56[_0x3ddc('0x18')](_0x49296c)[_0x3ddc('0x19')]();};}function respondWithResult(_0x42c17d,_0x5d497b){_0x5d497b=_0x5d497b||0xc8;return function(_0x1971d6){if(_0x1971d6){return _0x42c17d[_0x3ddc('0x18')](_0x5d497b)['json'](_0x1971d6);}};}function respondWithFilteredResult(_0x51dc05,_0x39b6b4){return function(_0x3b3620){if(_0x3b3620){var _0x56f58f=typeof _0x39b6b4[_0x3ddc('0x1a')]===_0x3ddc('0x1b')&&typeof _0x39b6b4[_0x3ddc('0x1c')]===_0x3ddc('0x1b');var _0x4a833e=_0x3b3620[_0x3ddc('0x1d')];var _0x5d7d57=_0x56f58f?0x0:_0x39b6b4[_0x3ddc('0x1a')];var _0x1e5180=_0x56f58f?_0x3b3620[_0x3ddc('0x1d')]:_0x39b6b4[_0x3ddc('0x1a')]+_0x39b6b4[_0x3ddc('0x1c')];var _0x267a95;if(_0x1e5180>=_0x4a833e){_0x1e5180=_0x4a833e;_0x267a95=0xc8;}else{_0x267a95=0xce;}_0x51dc05[_0x3ddc('0x18')](_0x267a95);return _0x51dc05[_0x3ddc('0x1e')](_0x3ddc('0x1f'),_0x5d7d57+'-'+_0x1e5180+'/'+_0x4a833e)[_0x3ddc('0x20')](_0x3b3620);}return null;};}function patchUpdates(_0x13f985){return function(_0x3f52ae){try{jsonpatch[_0x3ddc('0x21')](_0x3f52ae,_0x13f985,!![]);}catch(_0x46b8a6){return BPromise[_0x3ddc('0x22')](_0x46b8a6);}return _0x3f52ae['save']();};}function saveUpdates(_0x249138,_0x55502d){return function(_0x3cc2a9){if(_0x3cc2a9){return _0x3cc2a9[_0x3ddc('0x23')](_0x249138)[_0x3ddc('0x24')](function(_0x3c9536){return _0x3c9536;});}return null;};}function removeEntity(_0x37623e,_0x4be575){return function(_0x12344a){if(_0x12344a){return _0x12344a[_0x3ddc('0x25')]()[_0x3ddc('0x24')](function(){_0x37623e['status'](0xcc)[_0x3ddc('0x19')]();});}};}function handleEntityNotFound(_0x394d14,_0x3a20b7){return function(_0x466141){if(!_0x466141){_0x394d14['sendStatus'](0x194);}return _0x466141;};}function handleError(_0x5f359e,_0x12a0c3){_0x12a0c3=_0x12a0c3||0x1f4;return function(_0x29a3d9){logger[_0x3ddc('0x26')](_0x29a3d9[_0x3ddc('0x27')]);if(_0x29a3d9[_0x3ddc('0x28')]){delete _0x29a3d9['name'];}_0x5f359e[_0x3ddc('0x18')](_0x12a0c3)[_0x3ddc('0x29')](_0x29a3d9);};}exports[_0x3ddc('0x2a')]=function(_0x4d220f,_0x5ca807){var _0x238aa2={},_0x37fd7c={},_0x1710d8={'count':0x0,'rows':[]};var _0x157918=_[_0x3ddc('0x2b')](db[_0x3ddc('0x2c')][_0x3ddc('0x2d')],function(_0x5cc406){return{'name':_0x5cc406[_0x3ddc('0x2e')],'type':_0x5cc406['type'][_0x3ddc('0x2f')]};});_0x37fd7c['model']=_[_0x3ddc('0x2b')](_0x157918,_0x3ddc('0x28'));_0x37fd7c[_0x3ddc('0x30')]=_[_0x3ddc('0x31')](_0x4d220f[_0x3ddc('0x30')]);_0x37fd7c[_0x3ddc('0x32')]=_[_0x3ddc('0x33')](_0x37fd7c[_0x3ddc('0x34')],_0x37fd7c[_0x3ddc('0x30')]);_0x238aa2[_0x3ddc('0x35')]=_[_0x3ddc('0x33')](_0x37fd7c[_0x3ddc('0x34')],qs[_0x3ddc('0x36')](_0x4d220f[_0x3ddc('0x30')][_0x3ddc('0x36')]));_0x238aa2[_0x3ddc('0x35')]=_0x238aa2[_0x3ddc('0x35')][_0x3ddc('0x37')]?_0x238aa2['attributes']:_0x37fd7c[_0x3ddc('0x34')];if(!_0x4d220f[_0x3ddc('0x30')][_0x3ddc('0x38')](_0x3ddc('0x39'))){_0x238aa2[_0x3ddc('0x1c')]=qs[_0x3ddc('0x1c')](_0x4d220f[_0x3ddc('0x30')][_0x3ddc('0x1c')]);_0x238aa2['offset']=qs[_0x3ddc('0x1a')](_0x4d220f[_0x3ddc('0x30')][_0x3ddc('0x1a')]);}_0x238aa2['order']=qs['sort'](_0x4d220f[_0x3ddc('0x30')][_0x3ddc('0x3a')]);_0x238aa2[_0x3ddc('0x3b')]=qs[_0x3ddc('0x32')](_[_0x3ddc('0x3c')](_0x4d220f[_0x3ddc('0x30')],_0x37fd7c[_0x3ddc('0x32')]),_0x157918);if(_0x4d220f[_0x3ddc('0x30')][_0x3ddc('0x3d')]){_0x238aa2[_0x3ddc('0x3b')]=_[_0x3ddc('0x3e')](_0x238aa2[_0x3ddc('0x3b')],{'$or':_['map'](_0x157918,function(_0x1f2e26){if(_0x1f2e26['type']!==_0x3ddc('0x3f')){var _0x4e02b4={};_0x4e02b4[_0x1f2e26[_0x3ddc('0x28')]]={'$like':'%'+_0x4d220f['query']['filter']+'%'};return _0x4e02b4;}})});}_0x238aa2=_[_0x3ddc('0x3e')]({},_0x238aa2,_0x4d220f[_0x3ddc('0x40')]);var _0x38127e={'where':_0x238aa2[_0x3ddc('0x3b')]};return db[_0x3ddc('0x2c')]['count'](_0x38127e)['then'](function(_0x2f0daf){_0x1710d8['count']=_0x2f0daf;if(_0x4d220f['query'][_0x3ddc('0x41')]){_0x238aa2[_0x3ddc('0x42')]=[{'all':!![]}];}return db[_0x3ddc('0x2c')][_0x3ddc('0x43')](_0x238aa2);})['then'](function(_0x10cfe3){_0x1710d8[_0x3ddc('0x44')]=_0x10cfe3;return _0x1710d8;})[_0x3ddc('0x24')](respondWithFilteredResult(_0x5ca807,_0x238aa2))[_0x3ddc('0x45')](handleError(_0x5ca807,null));};exports[_0x3ddc('0x46')]=function(_0x53e67e,_0x446f18){var _0x4f0360={'raw':!![],'where':{'id':_0x53e67e[_0x3ddc('0x47')]['id']}},_0x34fece={};_0x34fece[_0x3ddc('0x34')]=_['keys'](db[_0x3ddc('0x2c')][_0x3ddc('0x2d')]);_0x34fece[_0x3ddc('0x30')]=_[_0x3ddc('0x31')](_0x53e67e[_0x3ddc('0x30')]);_0x34fece[_0x3ddc('0x32')]=_[_0x3ddc('0x33')](_0x34fece[_0x3ddc('0x34')],_0x34fece[_0x3ddc('0x30')]);_0x4f0360[_0x3ddc('0x35')]=_['intersection'](_0x34fece[_0x3ddc('0x34')],qs['fields'](_0x53e67e[_0x3ddc('0x30')][_0x3ddc('0x36')]));_0x4f0360[_0x3ddc('0x35')]=_0x4f0360['attributes'][_0x3ddc('0x37')]?_0x4f0360[_0x3ddc('0x35')]:_0x34fece[_0x3ddc('0x34')];if(_0x53e67e[_0x3ddc('0x30')][_0x3ddc('0x41')]){_0x4f0360[_0x3ddc('0x42')]=[{'all':!![]}];}_0x4f0360=_[_0x3ddc('0x3e')]({},_0x4f0360,_0x53e67e[_0x3ddc('0x40')]);return db[_0x3ddc('0x2c')]['find'](_0x4f0360)[_0x3ddc('0x24')](handleEntityNotFound(_0x446f18,null))['then'](respondWithResult(_0x446f18,null))[_0x3ddc('0x45')](handleError(_0x446f18,null));};exports[_0x3ddc('0x48')]=function(_0x4a1970,_0x5c12fa){return db[_0x3ddc('0x2c')][_0x3ddc('0x48')](_0x4a1970[_0x3ddc('0x49')],{})[_0x3ddc('0x24')](respondWithResult(_0x5c12fa,0xc9))[_0x3ddc('0x45')](handleError(_0x5c12fa,null));};exports[_0x3ddc('0x23')]=function(_0x53c7c8,_0x53859b){if(_0x53c7c8[_0x3ddc('0x49')]['id']){delete _0x53c7c8[_0x3ddc('0x49')]['id'];}return db[_0x3ddc('0x2c')][_0x3ddc('0x4a')]({'where':{'id':_0x53c7c8[_0x3ddc('0x47')]['id']}})['then'](handleEntityNotFound(_0x53859b,null))[_0x3ddc('0x24')](saveUpdates(_0x53c7c8[_0x3ddc('0x49')],null))[_0x3ddc('0x24')](respondWithResult(_0x53859b,null))['catch'](handleError(_0x53859b,null));};exports[_0x3ddc('0x25')]=function(_0x302b96,_0x311643){return db[_0x3ddc('0x2c')][_0x3ddc('0x4a')]({'where':{'id':_0x302b96[_0x3ddc('0x47')]['id']}})[_0x3ddc('0x24')](handleEntityNotFound(_0x311643,null))['then'](removeEntity(_0x311643,null))['catch'](handleError(_0x311643,null));};exports[_0x3ddc('0x4b')]=function(_0x15208f,_0x533193){return db[_0x3ddc('0x2c')][_0x3ddc('0x4b')]()[_0x3ddc('0x24')](respondWithResult(_0x533193,null))[_0x3ddc('0x45')](handleError(_0x533193,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 2f1be22..2d4857f 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x57cfd4,_0xf0de94){var _0x3d4eb6=function(_0x4b9082){while(--_0x4b9082){_0x57cfd4['push'](_0x57cfd4['shift']());}};_0x3d4eb6(++_0xf0de94);}(_0x7a54,0x106));var _0x47a5=function(_0x5cae00,_0x680f98){_0x5cae00=_0x5cae00-0x0;var _0x1cc21d=_0x7a54[_0x5cae00];return _0x1cc21d;};'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 +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x814b,0x1a2));var _0xb814=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0x814b[_0x172660];return _0x83204f;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index a177fff..6a4e6df 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b65=['jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','stringify','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xb68695,_0x1881a4){var _0x15a817=function(_0x4d04d6){while(--_0x4d04d6){_0xb68695['push'](_0xb68695['shift']());}};_0x15a817(++_0x1881a4);}(_0x2b65,0x131));var _0x52b6=function(_0x4c7149,_0x335342){_0x4c7149=_0x4c7149-0x0;var _0x200122=_0x2b65[_0x4c7149];return _0x200122;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rs=require(_0x52b6('0x4'));var fs=require('fs');var Redis=require(_0x52b6('0x5'));var db=require(_0x52b6('0x6'))['db'];var utils=require(_0x52b6('0x7'));var logger=require('../../config/logger')(_0x52b6('0x8'));var config=require(_0x52b6('0x9'));var jayson=require(_0x52b6('0xa'));var client=jayson[_0x52b6('0xb')][_0x52b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d451f,_0x70579,_0x1af78f){return new BPromise(function(_0x432726,_0x27c5b9){return client['request'](_0x2d451f,_0x1af78f)[_0x52b6('0xd')](function(_0x1c2cb5){logger[_0x52b6('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x70579,_0x52b6('0xf'));logger[_0x52b6('0x10')](_0x52b6('0x11'),_0x70579,_0x52b6('0xf'),JSON['stringify'](_0x1c2cb5));if(_0x1c2cb5[_0x52b6('0x12')]){if(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x13')]===0x1f4){logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')]['message']);return _0x27c5b9(_0x1c2cb5[_0x52b6('0x12')]['message']);}logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);return _0x432726(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);}else{logger[_0x52b6('0xe')](_0x52b6('0x14'),_0x70579,_0x52b6('0xf'));_0x432726(_0x1c2cb5[_0x52b6('0x16')][_0x52b6('0x15')]);}})[_0x52b6('0x17')](function(_0x307594){logger[_0x52b6('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x70579,_0x307594);_0x27c5b9(_0x307594);});});}exports[_0x52b6('0x18')]=function(_0x2fa3ed){var _0x9bab0a=this;return new Promise(function(_0x47d203,_0x36d376){return db[_0x52b6('0x19')]['create'](_0x2fa3ed['body'],{'raw':_0x2fa3ed[_0x52b6('0x1a')]?_0x2fa3ed['options'][_0x52b6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2e472f){logger[_0x52b6('0xe')](_0x52b6('0x18'),_0x2fa3ed);logger[_0x52b6('0x10')]('CreateOpenchannelQueueReport',_0x2fa3ed,JSON[_0x52b6('0x1c')](_0x2e472f));_0x47d203(_0x2e472f);})[_0x52b6('0x17')](function(_0x1246db){logger[_0x52b6('0x12')](_0x52b6('0x18'),_0x1246db[_0x52b6('0x15')],_0x2fa3ed);_0x36d376(_0x9bab0a[_0x52b6('0x12')](0x1f4,_0x1246db[_0x52b6('0x15')]));});});};exports[_0x52b6('0x1d')]=function(_0x55aa4c){var _0x2a97c0=this;return new Promise(function(_0x2ff6f4,_0x3a2fb0){return db[_0x52b6('0x19')][_0x52b6('0x1e')](_0x55aa4c[_0x52b6('0x1f')],{'raw':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c[_0x52b6('0x1a')][_0x52b6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c[_0x52b6('0x1a')][_0x52b6('0x20')]||null:null,'attributes':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c[_0x52b6('0x1a')][_0x52b6('0x21')]||null:null,'limit':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c['options'][_0x52b6('0x22')]||null:null})[_0x52b6('0xd')](function(_0x1716b6){logger[_0x52b6('0xe')](_0x52b6('0x1d'),_0x55aa4c);logger[_0x52b6('0x10')](_0x52b6('0x1d'),_0x55aa4c,JSON['stringify'](_0x1716b6));_0x2ff6f4(_0x1716b6);})[_0x52b6('0x17')](function(_0x42ac9b){logger['error'](_0x52b6('0x1d'),_0x42ac9b[_0x52b6('0x15')],_0x55aa4c);_0x3a2fb0(_0x2a97c0[_0x52b6('0x12')](0x1f4,_0x42ac9b[_0x52b6('0x15')]));});});}; \ No newline at end of file +var _0x2032=['../../config/environment','jayson/promise','client','http','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x2032,0xd9));var _0x2203=function(_0x2fd7c2,_0x1bf55d){_0x2fd7c2=_0x2fd7c2-0x0;var _0x4562a3=_0x2032[_0x2fd7c2];return _0x4562a3;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['create'](_0x4893ff[_0x2203('0x16')],{'raw':_0x4893ff[_0x2203('0x17')]?_0x4893ff[_0x2203('0x17')][_0x2203('0x18')]===undefined?!![]:![]:!![]})[_0x2203('0x19')](function(_0x449039){logger['info'](_0x2203('0x14'),_0x4893ff);logger['debug']('CreateOpenchannelQueueReport',_0x4893ff,JSON[_0x2203('0x1a')](_0x449039));_0x8906e1(_0x449039);})['catch'](function(_0x3b8ef9){logger[_0x2203('0xe')]('CreateOpenchannelQueueReport',_0x3b8ef9[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6['error'](0x1f4,_0x3b8ef9['message']));});});};exports[_0x2203('0x1b')]=function(_0x2718f5){var _0x21f930=this;return new Promise(function(_0xfd0970,_0x1244f4){return db[_0x2203('0x15')][_0x2203('0x1c')](_0x2718f5[_0x2203('0x16')],{'raw':_0x2718f5['options']?_0x2718f5[_0x2203('0x17')][_0x2203('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2718f5[_0x2203('0x17')]?_0x2718f5['options'][_0x2203('0x1d')]||null:null,'attributes':_0x2718f5[_0x2203('0x17')]?_0x2718f5['options'][_0x2203('0x1e')]||null:null,'limit':_0x2718f5[_0x2203('0x17')]?_0x2718f5[_0x2203('0x17')][_0x2203('0x1f')]||null:null})[_0x2203('0x19')](function(_0x1df508){logger[_0x2203('0x11')]('UpdateOpenchannelQueueReport',_0x2718f5);logger[_0x2203('0xd')](_0x2203('0x1b'),_0x2718f5,JSON[_0x2203('0x1a')](_0x1df508));_0xfd0970(_0x1df508);})[_0x2203('0x13')](function(_0x52a426){logger[_0x2203('0xe')](_0x2203('0x1b'),_0x52a426[_0x2203('0x10')],_0x2718f5);_0x1244f4(_0x21f930[_0x2203('0xe')](0x1f4,_0x52a426['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7443dd5..0160b78 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 _0x4f68=['put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x35a229,_0x2e4ed9){var _0x5dd369=function(_0x1473ce){while(--_0x1473ce){_0x35a229['push'](_0x35a229['shift']());}};_0x5dd369(++_0x2e4ed9);}(_0x4f68,0xd3));var _0x84f6=function(_0x3e7dd5,_0x500bf7){_0x3e7dd5=_0x3e7dd5-0x0;var _0x51affd=_0x4f68[_0x3e7dd5];return _0x51affd;};'use strict';var multer=require(_0x84f6('0x0'));var util=require(_0x84f6('0x1'));var path=require(_0x84f6('0x2'));var timeout=require(_0x84f6('0x3'));var express=require(_0x84f6('0x4'));var router=express[_0x84f6('0x5')]();var fs_extra=require(_0x84f6('0x6'));var auth=require(_0x84f6('0x7'));var interaction=require(_0x84f6('0x8'));var config=require(_0x84f6('0x9'));var controller=require(_0x84f6('0xa'));router[_0x84f6('0xb')]('/',auth[_0x84f6('0xc')](),controller[_0x84f6('0xd')]);router['get'](_0x84f6('0xe'),auth[_0x84f6('0xc')](),controller[_0x84f6('0xf')]);router[_0x84f6('0xb')]('/:id',auth[_0x84f6('0xc')](),controller[_0x84f6('0x10')]);router[_0x84f6('0x11')]('/',auth[_0x84f6('0xc')](),controller[_0x84f6('0x12')]);router[_0x84f6('0x13')](_0x84f6('0x14'),auth[_0x84f6('0xc')](),controller[_0x84f6('0x15')]);router['delete'](_0x84f6('0x14'),auth[_0x84f6('0xc')](),controller['destroy']);module[_0x84f6('0x16')]=router; \ No newline at end of file +var _0x2ccf=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x17d617,_0x58ecef){var _0x37e3a5=function(_0x2bc30f){while(--_0x2bc30f){_0x17d617['push'](_0x17d617['shift']());}};_0x37e3a5(++_0x58ecef);}(_0x2ccf,0xd0));var _0xf2cc=function(_0x3d3db7,_0x170c4b){_0x3d3db7=_0x3d3db7-0x0;var _0x6ee614=_0x2ccf[_0x3d3db7];return _0x6ee614;};'use strict';var multer=require(_0xf2cc('0x0'));var util=require(_0xf2cc('0x1'));var path=require(_0xf2cc('0x2'));var timeout=require(_0xf2cc('0x3'));var express=require(_0xf2cc('0x4'));var router=express['Router']();var fs_extra=require(_0xf2cc('0x5'));var auth=require(_0xf2cc('0x6'));var interaction=require(_0xf2cc('0x7'));var config=require('../../config/environment');var controller=require(_0xf2cc('0x8'));router[_0xf2cc('0x9')]('/',auth[_0xf2cc('0xa')](),controller[_0xf2cc('0xb')]);router[_0xf2cc('0x9')](_0xf2cc('0xc'),auth[_0xf2cc('0xa')](),controller[_0xf2cc('0xd')]);router[_0xf2cc('0x9')](_0xf2cc('0xe'),auth['isAuthenticated'](),controller[_0xf2cc('0xf')]);router['post']('/',auth[_0xf2cc('0xa')](),controller[_0xf2cc('0x10')]);router[_0xf2cc('0x11')](_0xf2cc('0xe'),auth[_0xf2cc('0xa')](),controller[_0xf2cc('0x12')]);router[_0xf2cc('0x13')](_0xf2cc('0xe'),auth['isAuthenticated'](),controller[_0xf2cc('0x14')]);module[_0xf2cc('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 6b3111e..c5e3eea 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xc65d05,_0x68842e){var _0x3bc2d6=function(_0x24b724){while(--_0x24b724){_0xc65d05['push'](_0xc65d05['shift']());}};_0x3bc2d6(++_0x68842e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0xcb91[_0x37c07d];return _0x10dadc;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2b83ee,_0x307b45){_0x2b83ee=_0x2b83ee-0x0;var _0x394cd7=_0xb43b[_0x2b83ee];return _0x394cd7;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8217b9c..fde8e5b 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 _0x4a46=['sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','rawAttributes','keys','find','catch','create','body','update','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','set','Content-Range','reject','then','destroy'];(function(_0x1bba4c,_0x2d2378){var _0x4780a7=function(_0x57613d){while(--_0x57613d){_0x1bba4c['push'](_0x1bba4c['shift']());}};_0x4780a7(++_0x2d2378);}(_0x4a46,0x152));var _0x64a4=function(_0x119032,_0x552f75){_0x119032=_0x119032-0x0;var _0x22ba94=_0x4a46[_0x119032];return _0x22ba94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x64a4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64a4('0x1'));var rp=require(_0x64a4('0x2'));var moment=require(_0x64a4('0x3'));var BPromise=require(_0x64a4('0x4'));var Mustache=require('mustache');var util=require(_0x64a4('0x5'));var path=require(_0x64a4('0x6'));var sox=require(_0x64a4('0x7'));var csv=require(_0x64a4('0x8'));var ejs=require(_0x64a4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64a4('0xa'));var squel=require('squel');var crypto=require(_0x64a4('0xb'));var jsforce=require(_0x64a4('0xc'));var deskjs=require(_0x64a4('0xd'));var toCsv=require(_0x64a4('0x8'));var querystring=require(_0x64a4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x64a4('0xf'));var qs=require(_0x64a4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64a4('0x11'));var logger=require(_0x64a4('0x12'))(_0x64a4('0x13'));var utils=require(_0x64a4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x64a4('0x15'));var db=require(_0x64a4('0x16'))['db'];function respondWithStatusCode(_0x406986,_0x6a3422){_0x6a3422=_0x6a3422||0xcc;return function(_0x4e2500){if(_0x4e2500){return _0x406986['sendStatus'](_0x6a3422);}return _0x406986[_0x64a4('0x17')](_0x6a3422)[_0x64a4('0x18')]();};}function respondWithResult(_0x3d7c9e,_0x2de59f){_0x2de59f=_0x2de59f||0xc8;return function(_0x4feeb0){if(_0x4feeb0){return _0x3d7c9e['status'](_0x2de59f)[_0x64a4('0x19')](_0x4feeb0);}};}function respondWithFilteredResult(_0x3f5f81,_0x2583eb){return function(_0x46f4ce){if(_0x46f4ce){var _0x5b6922=typeof _0x2583eb['offset']==='undefined'&&typeof _0x2583eb[_0x64a4('0x1a')]==='undefined';var _0x241f56=_0x46f4ce['count'];var _0x592483=_0x5b6922?0x0:_0x2583eb['offset'];var _0x4cfcc9=_0x5b6922?_0x46f4ce['count']:_0x2583eb['offset']+_0x2583eb[_0x64a4('0x1a')];var _0x80c5f9;if(_0x4cfcc9>=_0x241f56){_0x4cfcc9=_0x241f56;_0x80c5f9=0xc8;}else{_0x80c5f9=0xce;}_0x3f5f81[_0x64a4('0x17')](_0x80c5f9);return _0x3f5f81[_0x64a4('0x1b')](_0x64a4('0x1c'),_0x592483+'-'+_0x4cfcc9+'/'+_0x241f56)[_0x64a4('0x19')](_0x46f4ce);}return null;};}function patchUpdates(_0x1f664a){return function(_0x5931a4){try{jsonpatch['apply'](_0x5931a4,_0x1f664a,!![]);}catch(_0x31c610){return BPromise[_0x64a4('0x1d')](_0x31c610);}return _0x5931a4['save']();};}function saveUpdates(_0x1f5d98,_0xb86627){return function(_0x475b09){if(_0x475b09){return _0x475b09['update'](_0x1f5d98)[_0x64a4('0x1e')](function(_0x2684c1){return _0x2684c1;});}return null;};}function removeEntity(_0x2ac4ff,_0x472a05){return function(_0x519142){if(_0x519142){return _0x519142[_0x64a4('0x1f')]()[_0x64a4('0x1e')](function(){_0x2ac4ff['status'](0xcc)[_0x64a4('0x18')]();});}};}function handleEntityNotFound(_0x4e2b91,_0x3f2e98){return function(_0x24ccda){if(!_0x24ccda){_0x4e2b91[_0x64a4('0x20')](0x194);}return _0x24ccda;};}function handleError(_0xb9459b,_0x3ebf01){_0x3ebf01=_0x3ebf01||0x1f4;return function(_0x3353e7){logger[_0x64a4('0x21')](_0x3353e7[_0x64a4('0x22')]);if(_0x3353e7[_0x64a4('0x23')]){delete _0x3353e7[_0x64a4('0x23')];}_0xb9459b[_0x64a4('0x17')](_0x3ebf01)[_0x64a4('0x24')](_0x3353e7);};}exports[_0x64a4('0x25')]=function(_0x11b1d4,_0x3f8fc5){var _0x1cf65e={},_0x3bf235={},_0x3411f3={'count':0x0,'rows':[]};var _0x1c7571=_[_0x64a4('0x26')](db[_0x64a4('0x27')]['rawAttributes'],function(_0x5c4b9b){return{'name':_0x5c4b9b['fieldName'],'type':_0x5c4b9b[_0x64a4('0x28')][_0x64a4('0x29')]};});_0x3bf235[_0x64a4('0x2a')]=_['map'](_0x1c7571,_0x64a4('0x23'));_0x3bf235['query']=_['keys'](_0x11b1d4[_0x64a4('0x2b')]);_0x3bf235[_0x64a4('0x2c')]=_[_0x64a4('0x2d')](_0x3bf235['model'],_0x3bf235[_0x64a4('0x2b')]);_0x1cf65e['attributes']=_[_0x64a4('0x2d')](_0x3bf235['model'],qs[_0x64a4('0x2e')](_0x11b1d4[_0x64a4('0x2b')][_0x64a4('0x2e')]));_0x1cf65e[_0x64a4('0x2f')]=_0x1cf65e[_0x64a4('0x2f')][_0x64a4('0x30')]?_0x1cf65e[_0x64a4('0x2f')]:_0x3bf235[_0x64a4('0x2a')];if(!_0x11b1d4[_0x64a4('0x2b')][_0x64a4('0x31')](_0x64a4('0x32'))){_0x1cf65e['limit']=qs[_0x64a4('0x1a')](_0x11b1d4[_0x64a4('0x2b')]['limit']);_0x1cf65e[_0x64a4('0x33')]=qs[_0x64a4('0x33')](_0x11b1d4[_0x64a4('0x2b')]['offset']);}_0x1cf65e[_0x64a4('0x34')]=qs['sort'](_0x11b1d4[_0x64a4('0x2b')][_0x64a4('0x35')]);_0x1cf65e[_0x64a4('0x36')]=qs[_0x64a4('0x2c')](_[_0x64a4('0x37')](_0x11b1d4['query'],_0x3bf235[_0x64a4('0x2c')]),_0x1c7571);if(_0x11b1d4[_0x64a4('0x2b')]['filter']){_0x1cf65e['where']=_[_0x64a4('0x38')](_0x1cf65e[_0x64a4('0x36')],{'$or':_[_0x64a4('0x26')](_0x1c7571,function(_0x26afc3){if(_0x26afc3[_0x64a4('0x28')]!==_0x64a4('0x39')){var _0x4ceb62={};_0x4ceb62[_0x26afc3[_0x64a4('0x23')]]={'$like':'%'+_0x11b1d4[_0x64a4('0x2b')]['filter']+'%'};return _0x4ceb62;}})});}_0x1cf65e=_[_0x64a4('0x38')]({},_0x1cf65e,_0x11b1d4[_0x64a4('0x3a')]);var _0x18244f={'where':_0x1cf65e['where']};return db[_0x64a4('0x27')]['count'](_0x18244f)['then'](function(_0x22533e){_0x3411f3[_0x64a4('0x3b')]=_0x22533e;if(_0x11b1d4['query'][_0x64a4('0x3c')]){_0x1cf65e[_0x64a4('0x3d')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x64a4('0x3e')](_0x1cf65e);})[_0x64a4('0x1e')](function(_0x12a4f8){_0x3411f3[_0x64a4('0x3f')]=_0x12a4f8;return _0x3411f3;})[_0x64a4('0x1e')](respondWithFilteredResult(_0x3f8fc5,_0x1cf65e))['catch'](handleError(_0x3f8fc5,null));};exports[_0x64a4('0x40')]=function(_0x4fb611,_0x4997d7){var _0x9467b7={'raw':!![],'where':{'id':_0x4fb611['params']['id']}},_0x39d8b4={};_0x39d8b4[_0x64a4('0x2a')]=_['keys'](db[_0x64a4('0x27')][_0x64a4('0x41')]);_0x39d8b4[_0x64a4('0x2b')]=_[_0x64a4('0x42')](_0x4fb611[_0x64a4('0x2b')]);_0x39d8b4[_0x64a4('0x2c')]=_['intersection'](_0x39d8b4[_0x64a4('0x2a')],_0x39d8b4[_0x64a4('0x2b')]);_0x9467b7['attributes']=_['intersection'](_0x39d8b4[_0x64a4('0x2a')],qs[_0x64a4('0x2e')](_0x4fb611[_0x64a4('0x2b')]['fields']));_0x9467b7[_0x64a4('0x2f')]=_0x9467b7[_0x64a4('0x2f')][_0x64a4('0x30')]?_0x9467b7[_0x64a4('0x2f')]:_0x39d8b4[_0x64a4('0x2a')];if(_0x4fb611[_0x64a4('0x2b')]['includeAll']){_0x9467b7[_0x64a4('0x3d')]=[{'all':!![]}];}_0x9467b7=_[_0x64a4('0x38')]({},_0x9467b7,_0x4fb611[_0x64a4('0x3a')]);return db[_0x64a4('0x27')][_0x64a4('0x43')](_0x9467b7)[_0x64a4('0x1e')](handleEntityNotFound(_0x4997d7,null))['then'](respondWithResult(_0x4997d7,null))[_0x64a4('0x44')](handleError(_0x4997d7,null));};exports[_0x64a4('0x45')]=function(_0xd3cbf1,_0x5271f4){return db[_0x64a4('0x27')][_0x64a4('0x45')](_0xd3cbf1[_0x64a4('0x46')],{})[_0x64a4('0x1e')](respondWithResult(_0x5271f4,0xc9))['catch'](handleError(_0x5271f4,null));};exports[_0x64a4('0x47')]=function(_0x2aaafd,_0xe4c1a4){if(_0x2aaafd[_0x64a4('0x46')]['id']){delete _0x2aaafd[_0x64a4('0x46')]['id'];}return db[_0x64a4('0x27')][_0x64a4('0x43')]({'where':{'id':_0x2aaafd['params']['id']}})[_0x64a4('0x1e')](handleEntityNotFound(_0xe4c1a4,null))[_0x64a4('0x1e')](saveUpdates(_0x2aaafd[_0x64a4('0x46')],null))[_0x64a4('0x1e')](respondWithResult(_0xe4c1a4,null))['catch'](handleError(_0xe4c1a4,null));};exports[_0x64a4('0x1f')]=function(_0x45d76f,_0x3c5fdd){return db[_0x64a4('0x27')][_0x64a4('0x43')]({'where':{'id':_0x45d76f[_0x64a4('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c5fdd,null))[_0x64a4('0x1e')](removeEntity(_0x3c5fdd,null))['catch'](handleError(_0x3c5fdd,null));};exports[_0x64a4('0x49')]=function(_0x37b8f4,_0x255b4c){return db[_0x64a4('0x27')][_0x64a4('0x49')]()[_0x64a4('0x1e')](respondWithResult(_0x255b4c,null))['catch'](handleError(_0x255b4c,null));}; \ No newline at end of file +var _0xe733=['map','query','keys','filters','attributes','intersection','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','catch','fields','length','includeAll','find','create','body','update','params','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0xe733,0xb3));var _0x3e73=function(_0x57b55f,_0x214ffa){_0x57b55f=_0x57b55f-0x0;var _0x485d1d=_0xe733[_0x57b55f];return _0x485d1d;};'use strict';var emlformat=require(_0x3e73('0x0'));var rimraf=require(_0x3e73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3e73('0x2'));var moment=require(_0x3e73('0x3'));var BPromise=require(_0x3e73('0x4'));var Mustache=require(_0x3e73('0x5'));var util=require(_0x3e73('0x6'));var path=require(_0x3e73('0x7'));var sox=require('sox');var csv=require(_0x3e73('0x8'));var ejs=require(_0x3e73('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e73('0xa'));var squel=require(_0x3e73('0xb'));var crypto=require(_0x3e73('0xc'));var jsforce=require(_0x3e73('0xd'));var deskjs=require(_0x3e73('0xe'));var toCsv=require(_0x3e73('0x8'));var querystring=require(_0x3e73('0xf'));var Papa=require('papaparse');var Redis=require(_0x3e73('0x10'));var authService=require(_0x3e73('0x11'));var qs=require(_0x3e73('0x12'));var as=require(_0x3e73('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e73('0x14'))(_0x3e73('0x15'));var utils=require(_0x3e73('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3e73('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ef5ec,_0x127598){_0x127598=_0x127598||0xcc;return function(_0xbb54bb){if(_0xbb54bb){return _0x2ef5ec[_0x3e73('0x18')](_0x127598);}return _0x2ef5ec[_0x3e73('0x19')](_0x127598)[_0x3e73('0x1a')]();};}function respondWithResult(_0x3038d3,_0x208a03){_0x208a03=_0x208a03||0xc8;return function(_0x3f618c){if(_0x3f618c){return _0x3038d3[_0x3e73('0x19')](_0x208a03)[_0x3e73('0x1b')](_0x3f618c);}};}function respondWithFilteredResult(_0x739b95,_0x3429b4){return function(_0xce8363){if(_0xce8363){var _0x2706a7=typeof _0x3429b4[_0x3e73('0x1c')]===_0x3e73('0x1d')&&typeof _0x3429b4[_0x3e73('0x1e')]===_0x3e73('0x1d');var _0x3d5dbd=_0xce8363[_0x3e73('0x1f')];var _0x56d951=_0x2706a7?0x0:_0x3429b4[_0x3e73('0x1c')];var _0x44bfb2=_0x2706a7?_0xce8363[_0x3e73('0x1f')]:_0x3429b4[_0x3e73('0x1c')]+_0x3429b4[_0x3e73('0x1e')];var _0x56727e;if(_0x44bfb2>=_0x3d5dbd){_0x44bfb2=_0x3d5dbd;_0x56727e=0xc8;}else{_0x56727e=0xce;}_0x739b95['status'](_0x56727e);return _0x739b95[_0x3e73('0x20')](_0x3e73('0x21'),_0x56d951+'-'+_0x44bfb2+'/'+_0x3d5dbd)[_0x3e73('0x1b')](_0xce8363);}return null;};}function patchUpdates(_0x307a71){return function(_0x44be4c){try{jsonpatch[_0x3e73('0x22')](_0x44be4c,_0x307a71,!![]);}catch(_0x450e49){return BPromise[_0x3e73('0x23')](_0x450e49);}return _0x44be4c[_0x3e73('0x24')]();};}function saveUpdates(_0x206977,_0x245fbc){return function(_0x26c880){if(_0x26c880){return _0x26c880['update'](_0x206977)[_0x3e73('0x25')](function(_0x5ed62c){return _0x5ed62c;});}return null;};}function removeEntity(_0x497802,_0x3c2564){return function(_0x28faa8){if(_0x28faa8){return _0x28faa8['destroy']()[_0x3e73('0x25')](function(){_0x497802['status'](0xcc)[_0x3e73('0x1a')]();});}};}function handleEntityNotFound(_0x56d771,_0x411495){return function(_0x80c730){if(!_0x80c730){_0x56d771[_0x3e73('0x18')](0x194);}return _0x80c730;};}function handleError(_0x28474b,_0x292617){_0x292617=_0x292617||0x1f4;return function(_0x4ed11e){logger[_0x3e73('0x26')](_0x4ed11e[_0x3e73('0x27')]);if(_0x4ed11e[_0x3e73('0x28')]){delete _0x4ed11e['name'];}_0x28474b[_0x3e73('0x19')](_0x292617)[_0x3e73('0x29')](_0x4ed11e);};}exports[_0x3e73('0x2a')]=function(_0x5b4d9c,_0x1cad4b){var _0xc0e300={},_0x3768ba={},_0x57c675={'count':0x0,'rows':[]};var _0x55ee98=_['map'](db[_0x3e73('0x2b')][_0x3e73('0x2c')],function(_0x137a49){return{'name':_0x137a49[_0x3e73('0x2d')],'type':_0x137a49[_0x3e73('0x2e')][_0x3e73('0x2f')]};});_0x3768ba[_0x3e73('0x30')]=_[_0x3e73('0x31')](_0x55ee98,_0x3e73('0x28'));_0x3768ba[_0x3e73('0x32')]=_[_0x3e73('0x33')](_0x5b4d9c['query']);_0x3768ba[_0x3e73('0x34')]=_['intersection'](_0x3768ba[_0x3e73('0x30')],_0x3768ba[_0x3e73('0x32')]);_0xc0e300[_0x3e73('0x35')]=_[_0x3e73('0x36')](_0x3768ba[_0x3e73('0x30')],qs['fields'](_0x5b4d9c['query']['fields']));_0xc0e300[_0x3e73('0x35')]=_0xc0e300[_0x3e73('0x35')]['length']?_0xc0e300['attributes']:_0x3768ba[_0x3e73('0x30')];if(!_0x5b4d9c[_0x3e73('0x32')][_0x3e73('0x37')]('nolimit')){_0xc0e300[_0x3e73('0x1e')]=qs['limit'](_0x5b4d9c[_0x3e73('0x32')]['limit']);_0xc0e300[_0x3e73('0x1c')]=qs[_0x3e73('0x1c')](_0x5b4d9c['query'][_0x3e73('0x1c')]);}_0xc0e300[_0x3e73('0x38')]=qs[_0x3e73('0x39')](_0x5b4d9c[_0x3e73('0x32')][_0x3e73('0x39')]);_0xc0e300[_0x3e73('0x3a')]=qs[_0x3e73('0x34')](_[_0x3e73('0x3b')](_0x5b4d9c[_0x3e73('0x32')],_0x3768ba[_0x3e73('0x34')]),_0x55ee98);if(_0x5b4d9c[_0x3e73('0x32')][_0x3e73('0x3c')]){_0xc0e300[_0x3e73('0x3a')]=_[_0x3e73('0x3d')](_0xc0e300[_0x3e73('0x3a')],{'$or':_[_0x3e73('0x31')](_0x55ee98,function(_0x43ba48){if(_0x43ba48[_0x3e73('0x2e')]!=='VIRTUAL'){var _0x1571fd={};_0x1571fd[_0x43ba48['name']]={'$like':'%'+_0x5b4d9c[_0x3e73('0x32')][_0x3e73('0x3c')]+'%'};return _0x1571fd;}})});}_0xc0e300=_[_0x3e73('0x3d')]({},_0xc0e300,_0x5b4d9c[_0x3e73('0x3e')]);var _0x3c2c52={'where':_0xc0e300[_0x3e73('0x3a')]};return db['OpenchannelTransferReport']['count'](_0x3c2c52)[_0x3e73('0x25')](function(_0x4f931a){_0x57c675[_0x3e73('0x1f')]=_0x4f931a;if(_0x5b4d9c[_0x3e73('0x32')]['includeAll']){_0xc0e300[_0x3e73('0x3f')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x3e73('0x40')](_0xc0e300);})['then'](function(_0x594eca){_0x57c675['rows']=_0x594eca;return _0x57c675;})[_0x3e73('0x25')](respondWithFilteredResult(_0x1cad4b,_0xc0e300))[_0x3e73('0x41')](handleError(_0x1cad4b,null));};exports['show']=function(_0x49b627,_0x565bc0){var _0x5c79ca={'raw':!![],'where':{'id':_0x49b627['params']['id']}},_0x1ad643={};_0x1ad643[_0x3e73('0x30')]=_[_0x3e73('0x33')](db['OpenchannelTransferReport']['rawAttributes']);_0x1ad643[_0x3e73('0x32')]=_[_0x3e73('0x33')](_0x49b627[_0x3e73('0x32')]);_0x1ad643[_0x3e73('0x34')]=_[_0x3e73('0x36')](_0x1ad643[_0x3e73('0x30')],_0x1ad643[_0x3e73('0x32')]);_0x5c79ca[_0x3e73('0x35')]=_[_0x3e73('0x36')](_0x1ad643[_0x3e73('0x30')],qs[_0x3e73('0x42')](_0x49b627['query'][_0x3e73('0x42')]));_0x5c79ca[_0x3e73('0x35')]=_0x5c79ca[_0x3e73('0x35')][_0x3e73('0x43')]?_0x5c79ca[_0x3e73('0x35')]:_0x1ad643[_0x3e73('0x30')];if(_0x49b627[_0x3e73('0x32')][_0x3e73('0x44')]){_0x5c79ca[_0x3e73('0x3f')]=[{'all':!![]}];}_0x5c79ca=_[_0x3e73('0x3d')]({},_0x5c79ca,_0x49b627[_0x3e73('0x3e')]);return db[_0x3e73('0x2b')][_0x3e73('0x45')](_0x5c79ca)[_0x3e73('0x25')](handleEntityNotFound(_0x565bc0,null))[_0x3e73('0x25')](respondWithResult(_0x565bc0,null))[_0x3e73('0x41')](handleError(_0x565bc0,null));};exports[_0x3e73('0x46')]=function(_0x1e3775,_0x13657b){return db[_0x3e73('0x2b')][_0x3e73('0x46')](_0x1e3775[_0x3e73('0x47')],{})['then'](respondWithResult(_0x13657b,0xc9))[_0x3e73('0x41')](handleError(_0x13657b,null));};exports[_0x3e73('0x48')]=function(_0x399150,_0x1e9afd){if(_0x399150[_0x3e73('0x47')]['id']){delete _0x399150[_0x3e73('0x47')]['id'];}return db[_0x3e73('0x2b')][_0x3e73('0x45')]({'where':{'id':_0x399150[_0x3e73('0x49')]['id']}})[_0x3e73('0x25')](handleEntityNotFound(_0x1e9afd,null))['then'](saveUpdates(_0x399150[_0x3e73('0x47')],null))[_0x3e73('0x25')](respondWithResult(_0x1e9afd,null))[_0x3e73('0x41')](handleError(_0x1e9afd,null));};exports[_0x3e73('0x4a')]=function(_0x25df31,_0x4796ed){return db[_0x3e73('0x2b')][_0x3e73('0x45')]({'where':{'id':_0x25df31[_0x3e73('0x49')]['id']}})[_0x3e73('0x25')](handleEntityNotFound(_0x4796ed,null))[_0x3e73('0x25')](removeEntity(_0x4796ed,null))[_0x3e73('0x41')](handleError(_0x4796ed,null));};exports[_0x3e73('0x4b')]=function(_0x347309,_0x22f32e){return db[_0x3e73('0x2b')][_0x3e73('0x4b')]()[_0x3e73('0x25')](respondWithResult(_0x22f32e,null))[_0x3e73('0x41')](handleError(_0x22f32e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 56e5cf6..6b60629 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 _0xd896=['bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd896,0x1e8));var _0x6d89=function(_0x35c6b3,_0x34deb0){_0x35c6b3=_0x35c6b3-0x0;var _0x2d0348=_0xd896[_0x35c6b3];return _0x2d0348;};'use strict';var _=require(_0x6d89('0x0'));var util=require(_0x6d89('0x1'));var logger=require(_0x6d89('0x2'))('api');var moment=require(_0x6d89('0x3'));var BPromise=require(_0x6d89('0x4'));var rp=require(_0x6d89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d89('0x6'));var config=require(_0x6d89('0x7'));var attributes=require(_0x6d89('0x8'));module[_0x6d89('0x9')]=function(_0x1e5945,_0x58f04e){return _0x1e5945['define'](_0x6d89('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x6d89('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa25=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x3a0273,_0x330cbd){var _0x6b3ca5=function(_0x3683d2){while(--_0x3683d2){_0x3a0273['push'](_0x3a0273['shift']());}};_0x6b3ca5(++_0x330cbd);}(_0xfa25,0x1ea));var _0x5fa2=function(_0x1c713c,_0x38b3df){_0x1c713c=_0x1c713c-0x0;var _0x36ce75=_0xfa25[_0x1c713c];return _0x36ce75;};'use strict';var _=require(_0x5fa2('0x0'));var util=require(_0x5fa2('0x1'));var logger=require(_0x5fa2('0x2'))(_0x5fa2('0x3'));var moment=require('moment');var BPromise=require(_0x5fa2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fa2('0x5'));var rimraf=require(_0x5fa2('0x6'));var config=require(_0x5fa2('0x7'));var attributes=require(_0x5fa2('0x8'));module[_0x5fa2('0x9')]=function(_0x326928,_0x3057f6){return _0x326928[_0x5fa2('0xa')](_0x5fa2('0xb'),attributes,{'tableName':_0x5fa2('0xc'),'paranoid':![],'indexes':[{'name':_0x5fa2('0xd'),'fields':[_0x5fa2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index dae4a93..9f5a474 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 _0x9f02=['request\x20sent','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','debug','error','message','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x723e79,_0x433a4f){var _0x2887c9=function(_0x5235fb){while(--_0x5235fb){_0x723e79['push'](_0x723e79['shift']());}};_0x2887c9(++_0x433a4f);}(_0x9f02,0x68));var _0x29f0=function(_0x49ab80,_0x1bb853){_0x49ab80=_0x49ab80-0x0;var _0x5855e5=_0x9f02[_0x49ab80];return _0x5855e5;};'use strict';var _=require(_0x29f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x29f0('0x1'));var fs=require('fs');var Redis=require(_0x29f0('0x2'));var db=require(_0x29f0('0x3'))['db'];var utils=require(_0x29f0('0x4'));var logger=require(_0x29f0('0x5'))('rpc');var config=require(_0x29f0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x29f0('0x7')][_0x29f0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4852,_0x53d629,_0x4d47b3){return new BPromise(function(_0x594e30,_0x1da49e){return client['request'](_0x2d4852,_0x4d47b3)[_0x29f0('0x9')](function(_0x232592){logger[_0x29f0('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x53d629,'request\x20sent');logger[_0x29f0('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x53d629,'request\x20sent',JSON['stringify'](_0x232592));if(_0x232592['error']){if(_0x232592[_0x29f0('0xc')]['code']===0x1f4){logger[_0x29f0('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x53d629,_0x232592[_0x29f0('0xc')][_0x29f0('0xd')]);return _0x1da49e(_0x232592[_0x29f0('0xc')][_0x29f0('0xd')]);}logger['error'](_0x29f0('0xe'),_0x53d629,_0x232592[_0x29f0('0xc')]['message']);return _0x594e30(_0x232592[_0x29f0('0xc')]['message']);}else{logger[_0x29f0('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x53d629,_0x29f0('0xf'));_0x594e30(_0x232592[_0x29f0('0x10')]['message']);}})['catch'](function(_0x58e4e2){logger[_0x29f0('0xc')](_0x29f0('0xe'),_0x53d629,_0x58e4e2);_0x1da49e(_0x58e4e2);});});} \ No newline at end of file +var _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x47b007,_0x4d745f){var _0x579054=function(_0x7efd00){while(--_0x7efd00){_0x47b007['push'](_0x47b007['shift']());}};_0x579054(++_0x4d745f);}(_0xee14,0x13a));var _0x4ee1=function(_0x50cbd6,_0x599f73){_0x50cbd6=_0x50cbd6-0x0;var _0xaac6ba=_0xee14[_0x50cbd6];return _0xaac6ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ea20260..cc027a8 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 _0xba77=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x5b697a,_0x280202){var _0x5de43b=function(_0x2bc32f){while(--_0x2bc32f){_0x5b697a['push'](_0x5b697a['shift']());}};_0x5de43b(++_0x280202);}(_0xba77,0x171));var _0x7ba7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xba77[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x7ba7('0x0'));var util=require(_0x7ba7('0x1'));var path=require('path');var timeout=require(_0x7ba7('0x2'));var express=require(_0x7ba7('0x3'));var router=express['Router']();var fs_extra=require(_0x7ba7('0x4'));var auth=require(_0x7ba7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7ba7('0x6'));var controller=require('./pause.controller');router[_0x7ba7('0x7')]('/',auth[_0x7ba7('0x8')](),controller[_0x7ba7('0x9')]);router['get'](_0x7ba7('0xa'),auth[_0x7ba7('0x8')](),controller[_0x7ba7('0xb')]);router[_0x7ba7('0xc')]('/',auth[_0x7ba7('0x8')](),controller[_0x7ba7('0xd')]);router[_0x7ba7('0xe')]('/:id',auth[_0x7ba7('0x8')](),controller[_0x7ba7('0xf')]);router[_0x7ba7('0x10')](_0x7ba7('0xa'),auth[_0x7ba7('0x8')](),controller[_0x7ba7('0x11')]);module[_0x7ba7('0x12')]=router; \ No newline at end of file +var _0xa530=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x590439,_0x2f25ec){var _0x2a0248=function(_0x36809e){while(--_0x36809e){_0x590439['push'](_0x590439['shift']());}};_0x2a0248(++_0x2f25ec);}(_0xa530,0x7a));var _0x0a53=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xa530[_0x45c48f];return _0xaf5037;};'use strict';var multer=require(_0x0a53('0x0'));var util=require(_0x0a53('0x1'));var path=require('path');var timeout=require(_0x0a53('0x2'));var express=require(_0x0a53('0x3'));var router=express[_0x0a53('0x4')]();var fs_extra=require(_0x0a53('0x5'));var auth=require(_0x0a53('0x6'));var interaction=require(_0x0a53('0x7'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x0a53('0x8')]('/',auth[_0x0a53('0x9')](),controller['index']);router[_0x0a53('0x8')](_0x0a53('0xa'),auth[_0x0a53('0x9')](),controller[_0x0a53('0xb')]);router[_0x0a53('0xc')]('/',auth[_0x0a53('0x9')](),controller[_0x0a53('0xd')]);router[_0x0a53('0xe')]('/:id',auth[_0x0a53('0x9')](),controller[_0x0a53('0xf')]);router['delete'](_0x0a53('0xa'),auth['isAuthenticated'](),controller[_0x0a53('0x10')]);module[_0x0a53('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 1603ac6..fd280e1 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 _0x946b=['STRING','name','exports'];(function(_0x3d0198,_0x94b95c){var _0x3488b2=function(_0x1483ba){while(--_0x1483ba){_0x3d0198['push'](_0x3d0198['shift']());}};_0x3488b2(++_0x94b95c);}(_0x946b,0x1b2));var _0xb946=function(_0xf57c8f,_0x2a724d){_0xf57c8f=_0xf57c8f-0x0;var _0x397fe9=_0x946b[_0xf57c8f];return _0x397fe9;};'use strict';var Sequelize=require('sequelize');module[_0xb946('0x0')]={'name':{'type':Sequelize[_0xb946('0x1')],'unique':_0xb946('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb946('0x1')]}}; \ No newline at end of file +var _0x741b=['name','sequelize','STRING'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x741b,0x1bd));var _0xb741=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x741b[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0xb741('0x0'));module['exports']={'name':{'type':Sequelize[_0xb741('0x1')],'unique':_0xb741('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb741('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f74bd51..00b08bf 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 _0x8f7f=['order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','Pause','includeAll','findAll','rows','catch','show','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','index','map','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1fc716,_0x263857){var _0x637fd3=function(_0x1fbfeb){while(--_0x1fbfeb){_0x1fc716['push'](_0x1fc716['shift']());}};_0x637fd3(++_0x263857);}(_0x8f7f,0x19f));var _0xf8f7=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x8f7f[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0xf8f7('0x0'));var rimraf=require(_0xf8f7('0x1'));var zipdir=require(_0xf8f7('0x2'));var jsonpatch=require(_0xf8f7('0x3'));var rp=require(_0xf8f7('0x4'));var moment=require(_0xf8f7('0x5'));var BPromise=require(_0xf8f7('0x6'));var Mustache=require('mustache');var util=require(_0xf8f7('0x7'));var path=require('path');var sox=require(_0xf8f7('0x8'));var csv=require(_0xf8f7('0x9'));var ejs=require(_0xf8f7('0xa'));var fs=require('fs');var fs_extra=require(_0xf8f7('0xb'));var _=require(_0xf8f7('0xc'));var squel=require('squel');var crypto=require(_0xf8f7('0xd'));var jsforce=require(_0xf8f7('0xe'));var deskjs=require(_0xf8f7('0xf'));var toCsv=require(_0xf8f7('0x9'));var querystring=require(_0xf8f7('0x10'));var Papa=require(_0xf8f7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf8f7('0x12'));var as=require(_0xf8f7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8f7('0x14'))('api');var utils=require(_0xf8f7('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bb53c,_0xbb653){_0xbb653=_0xbb653||0xcc;return function(_0x4e3980){if(_0x4e3980){return _0x3bb53c[_0xf8f7('0x16')](_0xbb653);}return _0x3bb53c[_0xf8f7('0x17')](_0xbb653)['end']();};}function respondWithResult(_0x2174e7,_0x199912){_0x199912=_0x199912||0xc8;return function(_0x2b3dd1){if(_0x2b3dd1){return _0x2174e7[_0xf8f7('0x17')](_0x199912)[_0xf8f7('0x18')](_0x2b3dd1);}};}function respondWithFilteredResult(_0x3ee567,_0x1192d7){return function(_0x59d75a){if(_0x59d75a){var _0x36ae50=typeof _0x1192d7[_0xf8f7('0x19')]===_0xf8f7('0x1a')&&typeof _0x1192d7[_0xf8f7('0x1b')]===_0xf8f7('0x1a');var _0x3254d8=_0x59d75a[_0xf8f7('0x1c')];var _0x42a128=_0x36ae50?0x0:_0x1192d7[_0xf8f7('0x19')];var _0x13d4fc=_0x36ae50?_0x59d75a[_0xf8f7('0x1c')]:_0x1192d7[_0xf8f7('0x19')]+_0x1192d7[_0xf8f7('0x1b')];var _0x1759e4;if(_0x13d4fc>=_0x3254d8){_0x13d4fc=_0x3254d8;_0x1759e4=0xc8;}else{_0x1759e4=0xce;}_0x3ee567['status'](_0x1759e4);return _0x3ee567[_0xf8f7('0x1d')](_0xf8f7('0x1e'),_0x42a128+'-'+_0x13d4fc+'/'+_0x3254d8)[_0xf8f7('0x18')](_0x59d75a);}return null;};}function patchUpdates(_0x477589){return function(_0x463c00){try{jsonpatch[_0xf8f7('0x1f')](_0x463c00,_0x477589,!![]);}catch(_0x592327){return BPromise[_0xf8f7('0x20')](_0x592327);}return _0x463c00['save']();};}function saveUpdates(_0x5d707e,_0x5c088f){return function(_0x22f26f){if(_0x22f26f){return _0x22f26f[_0xf8f7('0x21')](_0x5d707e)[_0xf8f7('0x22')](function(_0x1d7f92){return _0x1d7f92;});}return null;};}function removeEntity(_0x292959,_0x41594c){return function(_0x37d89d){if(_0x37d89d){return _0x37d89d[_0xf8f7('0x23')]()[_0xf8f7('0x22')](function(){var _0x2f7fca=_0x37d89d[_0xf8f7('0x24')]({'plain':!![]});var _0x10fdda=_0xf8f7('0x25');return db[_0xf8f7('0x26')][_0xf8f7('0x23')]({'where':{'type':_0x10fdda,'resourceId':_0x2f7fca['id']}})['then'](function(){return _0x37d89d;});})[_0xf8f7('0x22')](function(){_0x292959[_0xf8f7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b9a97,_0x5295a4){return function(_0x469abb){if(!_0x469abb){_0x1b9a97[_0xf8f7('0x16')](0x194);}return _0x469abb;};}function handleError(_0x589912,_0x5ad31a){_0x5ad31a=_0x5ad31a||0x1f4;return function(_0x2f7dda){logger[_0xf8f7('0x27')](_0x2f7dda[_0xf8f7('0x28')]);if(_0x2f7dda[_0xf8f7('0x29')]){delete _0x2f7dda[_0xf8f7('0x29')];}_0x589912[_0xf8f7('0x17')](_0x5ad31a)['send'](_0x2f7dda);};}exports[_0xf8f7('0x2a')]=function(_0x4d656e,_0x5ef79d){var _0x5d425e={},_0x379036={},_0x1e9705={'count':0x0,'rows':[]};var _0x42e070=_[_0xf8f7('0x2b')](db['Pause'][_0xf8f7('0x2c')],function(_0x5718c2){return{'name':_0x5718c2['fieldName'],'type':_0x5718c2['type']['key']};});_0x379036[_0xf8f7('0x2d')]=_[_0xf8f7('0x2b')](_0x42e070,_0xf8f7('0x29'));_0x379036[_0xf8f7('0x2e')]=_[_0xf8f7('0x2f')](_0x4d656e[_0xf8f7('0x2e')]);_0x379036['filters']=_[_0xf8f7('0x30')](_0x379036[_0xf8f7('0x2d')],_0x379036[_0xf8f7('0x2e')]);_0x5d425e[_0xf8f7('0x31')]=_['intersection'](_0x379036[_0xf8f7('0x2d')],qs['fields'](_0x4d656e['query'][_0xf8f7('0x32')]));_0x5d425e[_0xf8f7('0x31')]=_0x5d425e[_0xf8f7('0x31')][_0xf8f7('0x33')]?_0x5d425e[_0xf8f7('0x31')]:_0x379036[_0xf8f7('0x2d')];if(!_0x4d656e[_0xf8f7('0x2e')][_0xf8f7('0x34')]('nolimit')){_0x5d425e[_0xf8f7('0x1b')]=qs['limit'](_0x4d656e[_0xf8f7('0x2e')]['limit']);_0x5d425e[_0xf8f7('0x19')]=qs[_0xf8f7('0x19')](_0x4d656e[_0xf8f7('0x2e')][_0xf8f7('0x19')]);}_0x5d425e[_0xf8f7('0x35')]=qs[_0xf8f7('0x36')](_0x4d656e[_0xf8f7('0x2e')][_0xf8f7('0x36')]);_0x5d425e[_0xf8f7('0x37')]=qs['filters'](_[_0xf8f7('0x38')](_0x4d656e['query'],_0x379036[_0xf8f7('0x39')]),_0x42e070);if(_0x4d656e[_0xf8f7('0x2e')][_0xf8f7('0x3a')]){_0x5d425e['where']=_[_0xf8f7('0x3b')](_0x5d425e[_0xf8f7('0x37')],{'$or':_[_0xf8f7('0x2b')](_0x42e070,function(_0x1e5f11){if(_0x1e5f11[_0xf8f7('0x3c')]!==_0xf8f7('0x3d')){var _0x207e9c={};_0x207e9c[_0x1e5f11[_0xf8f7('0x29')]]={'$like':'%'+_0x4d656e[_0xf8f7('0x2e')][_0xf8f7('0x3a')]+'%'};return _0x207e9c;}})});}_0x5d425e=_['merge']({},_0x5d425e,_0x4d656e[_0xf8f7('0x3e')]);var _0x42eebe={'where':_0x5d425e[_0xf8f7('0x37')]};return db[_0xf8f7('0x3f')][_0xf8f7('0x1c')](_0x42eebe)[_0xf8f7('0x22')](function(_0x1717ef){_0x1e9705[_0xf8f7('0x1c')]=_0x1717ef;if(_0x4d656e[_0xf8f7('0x2e')][_0xf8f7('0x40')]){_0x5d425e['include']=[{'all':!![]}];}return db[_0xf8f7('0x3f')][_0xf8f7('0x41')](_0x5d425e);})['then'](function(_0x2d0a92){_0x1e9705[_0xf8f7('0x42')]=_0x2d0a92;return _0x1e9705;})[_0xf8f7('0x22')](respondWithFilteredResult(_0x5ef79d,_0x5d425e))[_0xf8f7('0x43')](handleError(_0x5ef79d,null));};exports[_0xf8f7('0x44')]=function(_0x4cc53f,_0x5d756f){var _0x33e7f4={'raw':!![],'where':{'id':_0x4cc53f['params']['id']}},_0x5b5df4={};_0x5b5df4['model']=_['keys'](db[_0xf8f7('0x3f')][_0xf8f7('0x2c')]);_0x5b5df4[_0xf8f7('0x2e')]=_['keys'](_0x4cc53f['query']);_0x5b5df4[_0xf8f7('0x39')]=_[_0xf8f7('0x30')](_0x5b5df4[_0xf8f7('0x2d')],_0x5b5df4[_0xf8f7('0x2e')]);_0x33e7f4['attributes']=_[_0xf8f7('0x30')](_0x5b5df4[_0xf8f7('0x2d')],qs['fields'](_0x4cc53f[_0xf8f7('0x2e')][_0xf8f7('0x32')]));_0x33e7f4[_0xf8f7('0x31')]=_0x33e7f4[_0xf8f7('0x31')][_0xf8f7('0x33')]?_0x33e7f4[_0xf8f7('0x31')]:_0x5b5df4['model'];if(_0x4cc53f[_0xf8f7('0x2e')]['includeAll']){_0x33e7f4[_0xf8f7('0x45')]=[{'all':!![]}];}_0x33e7f4=_[_0xf8f7('0x3b')]({},_0x33e7f4,_0x4cc53f[_0xf8f7('0x3e')]);return db[_0xf8f7('0x3f')]['find'](_0x33e7f4)[_0xf8f7('0x22')](handleEntityNotFound(_0x5d756f,null))[_0xf8f7('0x22')](respondWithResult(_0x5d756f,null))['catch'](handleError(_0x5d756f,null));};exports[_0xf8f7('0x46')]=function(_0x5127cd,_0x3cd0fd){return db[_0xf8f7('0x3f')][_0xf8f7('0x46')](_0x5127cd['body'],{})[_0xf8f7('0x22')](function(_0x1bb6fe){var _0x1fbbc1=_0x5127cd[_0xf8f7('0x47')][_0xf8f7('0x24')]({'plain':!![]});if(!_0x1fbbc1)throw new Error(_0xf8f7('0x48'));if(_0x1fbbc1[_0xf8f7('0x49')]===_0xf8f7('0x47')){var _0x33028a=_0x1bb6fe[_0xf8f7('0x24')]({'plain':!![]});var _0x2c65a7='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x2c65a7,'userProfileId':_0x1fbbc1['userProfileId']},'raw':!![]})['then'](function(_0x279828){if(_0x279828&&_0x279828[_0xf8f7('0x4a')]===0x0){return db[_0xf8f7('0x26')][_0xf8f7('0x46')]({'name':_0x33028a[_0xf8f7('0x29')],'resourceId':_0x33028a['id'],'type':_0x279828[_0xf8f7('0x29')],'sectionId':_0x279828['id']},{})[_0xf8f7('0x22')](function(){return _0x1bb6fe;});}else{return _0x1bb6fe;}})['catch'](function(_0x308a3a){logger[_0xf8f7('0x27')](_0xf8f7('0x4b'),_0x308a3a);throw _0x308a3a;});}return _0x1bb6fe;})['then'](respondWithResult(_0x3cd0fd,0xc9))[_0xf8f7('0x43')](handleError(_0x3cd0fd,null));};exports[_0xf8f7('0x21')]=function(_0xd75fef,_0x3a0e9f){if(_0xd75fef['body']['id']){delete _0xd75fef['body']['id'];}return db['Pause']['find']({'where':{'id':_0xd75fef[_0xf8f7('0x4c')]['id']}})[_0xf8f7('0x22')](handleEntityNotFound(_0x3a0e9f,null))[_0xf8f7('0x22')](saveUpdates(_0xd75fef['body'],null))['then'](respondWithResult(_0x3a0e9f,null))[_0xf8f7('0x43')](handleError(_0x3a0e9f,null));};exports['destroy']=function(_0x13d794,_0x5aeefc){return db[_0xf8f7('0x3f')][_0xf8f7('0x4d')]({'where':{'id':_0x13d794[_0xf8f7('0x4c')]['id']}})[_0xf8f7('0x22')](handleEntityNotFound(_0x5aeefc,null))[_0xf8f7('0x22')](removeEntity(_0x5aeefc,null))[_0xf8f7('0x43')](handleError(_0x5aeefc,null));}; \ No newline at end of file +var _0x4994=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','reject','save','update','then','destroy','get','Pauses','UserProfileResource','end','error','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2c4609,_0x2ea0b7){var _0x2309d6=function(_0x4fbcf1){while(--_0x4fbcf1){_0x2c4609['push'](_0x2c4609['shift']());}};_0x2309d6(++_0x2ea0b7);}(_0x4994,0xee));var _0x4499=function(_0xc284bb,_0x264acb){_0xc284bb=_0xc284bb-0x0;var _0x3b361d=_0x4994[_0xc284bb];return _0x3b361d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4499('0x0'));var jsonpatch=require(_0x4499('0x1'));var rp=require(_0x4499('0x2'));var moment=require(_0x4499('0x3'));var BPromise=require(_0x4499('0x4'));var Mustache=require(_0x4499('0x5'));var util=require(_0x4499('0x6'));var path=require(_0x4499('0x7'));var sox=require(_0x4499('0x8'));var csv=require(_0x4499('0x9'));var ejs=require(_0x4499('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4499('0xb'));var squel=require(_0x4499('0xc'));var crypto=require(_0x4499('0xd'));var jsforce=require(_0x4499('0xe'));var deskjs=require(_0x4499('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4499('0x10'));var Papa=require('papaparse');var Redis=require(_0x4499('0x11'));var authService=require(_0x4499('0x12'));var qs=require(_0x4499('0x13'));var as=require(_0x4499('0x14'));var hardwareService=require(_0x4499('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4499('0x17'))['db'];function respondWithStatusCode(_0x1261e2,_0x2b840f){_0x2b840f=_0x2b840f||0xcc;return function(_0x1581c8){if(_0x1581c8){return _0x1261e2[_0x4499('0x18')](_0x2b840f);}return _0x1261e2[_0x4499('0x19')](_0x2b840f)['end']();};}function respondWithResult(_0x70132a,_0x3f3fa7){_0x3f3fa7=_0x3f3fa7||0xc8;return function(_0x13d959){if(_0x13d959){return _0x70132a[_0x4499('0x19')](_0x3f3fa7)[_0x4499('0x1a')](_0x13d959);}};}function respondWithFilteredResult(_0xcf63d3,_0x3eb14a){return function(_0x5f2817){if(_0x5f2817){var _0x14d0e9=typeof _0x3eb14a['offset']===_0x4499('0x1b')&&typeof _0x3eb14a[_0x4499('0x1c')]===_0x4499('0x1b');var _0x171409=_0x5f2817[_0x4499('0x1d')];var _0x55ff78=_0x14d0e9?0x0:_0x3eb14a[_0x4499('0x1e')];var _0x517907=_0x14d0e9?_0x5f2817[_0x4499('0x1d')]:_0x3eb14a['offset']+_0x3eb14a[_0x4499('0x1c')];var _0x4992e9;if(_0x517907>=_0x171409){_0x517907=_0x171409;_0x4992e9=0xc8;}else{_0x4992e9=0xce;}_0xcf63d3[_0x4499('0x19')](_0x4992e9);return _0xcf63d3['set']('Content-Range',_0x55ff78+'-'+_0x517907+'/'+_0x171409)[_0x4499('0x1a')](_0x5f2817);}return null;};}function patchUpdates(_0x29b213){return function(_0x4b507c){try{jsonpatch['apply'](_0x4b507c,_0x29b213,!![]);}catch(_0x22b3f7){return BPromise[_0x4499('0x1f')](_0x22b3f7);}return _0x4b507c[_0x4499('0x20')]();};}function saveUpdates(_0x22aff7,_0x395568){return function(_0x26667e){if(_0x26667e){return _0x26667e[_0x4499('0x21')](_0x22aff7)[_0x4499('0x22')](function(_0x46ae44){return _0x46ae44;});}return null;};}function removeEntity(_0x42b9d4,_0x3b5238){return function(_0x588286){if(_0x588286){return _0x588286[_0x4499('0x23')]()['then'](function(){var _0x4da1a9=_0x588286[_0x4499('0x24')]({'plain':!![]});var _0x29095c=_0x4499('0x25');return db[_0x4499('0x26')]['destroy']({'where':{'type':_0x29095c,'resourceId':_0x4da1a9['id']}})['then'](function(){return _0x588286;});})[_0x4499('0x22')](function(){_0x42b9d4[_0x4499('0x19')](0xcc)[_0x4499('0x27')]();});}};}function handleEntityNotFound(_0x47dc0c,_0x1367ac){return function(_0x2e9506){if(!_0x2e9506){_0x47dc0c[_0x4499('0x18')](0x194);}return _0x2e9506;};}function handleError(_0x2e8cea,_0x1d3841){_0x1d3841=_0x1d3841||0x1f4;return function(_0x49193e){logger[_0x4499('0x28')](_0x49193e[_0x4499('0x29')]);if(_0x49193e[_0x4499('0x2a')]){delete _0x49193e[_0x4499('0x2a')];}_0x2e8cea[_0x4499('0x19')](_0x1d3841)['send'](_0x49193e);};}exports[_0x4499('0x2b')]=function(_0xce9986,_0x5630b9){var _0x1ca7cf={},_0x2fcdb7={},_0x31727d={'count':0x0,'rows':[]};var _0x3a8274=_[_0x4499('0x2c')](db[_0x4499('0x2d')][_0x4499('0x2e')],function(_0x148c25){return{'name':_0x148c25[_0x4499('0x2f')],'type':_0x148c25[_0x4499('0x30')][_0x4499('0x31')]};});_0x2fcdb7[_0x4499('0x32')]=_[_0x4499('0x2c')](_0x3a8274,_0x4499('0x2a'));_0x2fcdb7[_0x4499('0x33')]=_[_0x4499('0x34')](_0xce9986[_0x4499('0x33')]);_0x2fcdb7[_0x4499('0x35')]=_['intersection'](_0x2fcdb7[_0x4499('0x32')],_0x2fcdb7[_0x4499('0x33')]);_0x1ca7cf[_0x4499('0x36')]=_[_0x4499('0x37')](_0x2fcdb7['model'],qs[_0x4499('0x38')](_0xce9986[_0x4499('0x33')][_0x4499('0x38')]));_0x1ca7cf['attributes']=_0x1ca7cf[_0x4499('0x36')][_0x4499('0x39')]?_0x1ca7cf[_0x4499('0x36')]:_0x2fcdb7[_0x4499('0x32')];if(!_0xce9986['query'][_0x4499('0x3a')](_0x4499('0x3b'))){_0x1ca7cf[_0x4499('0x1c')]=qs['limit'](_0xce9986['query'][_0x4499('0x1c')]);_0x1ca7cf[_0x4499('0x1e')]=qs[_0x4499('0x1e')](_0xce9986[_0x4499('0x33')][_0x4499('0x1e')]);}_0x1ca7cf['order']=qs[_0x4499('0x3c')](_0xce9986['query'][_0x4499('0x3c')]);_0x1ca7cf[_0x4499('0x3d')]=qs[_0x4499('0x35')](_[_0x4499('0x3e')](_0xce9986[_0x4499('0x33')],_0x2fcdb7['filters']),_0x3a8274);if(_0xce9986[_0x4499('0x33')]['filter']){_0x1ca7cf[_0x4499('0x3d')]=_[_0x4499('0x3f')](_0x1ca7cf['where'],{'$or':_[_0x4499('0x2c')](_0x3a8274,function(_0x2643b3){if(_0x2643b3[_0x4499('0x30')]!==_0x4499('0x40')){var _0x429f44={};_0x429f44[_0x2643b3[_0x4499('0x2a')]]={'$like':'%'+_0xce9986['query'][_0x4499('0x41')]+'%'};return _0x429f44;}})});}_0x1ca7cf=_['merge']({},_0x1ca7cf,_0xce9986[_0x4499('0x42')]);var _0x58d3ed={'where':_0x1ca7cf[_0x4499('0x3d')]};return db['Pause']['count'](_0x58d3ed)[_0x4499('0x22')](function(_0x424f36){_0x31727d['count']=_0x424f36;if(_0xce9986[_0x4499('0x33')][_0x4499('0x43')]){_0x1ca7cf[_0x4499('0x44')]=[{'all':!![]}];}return db[_0x4499('0x2d')][_0x4499('0x45')](_0x1ca7cf);})[_0x4499('0x22')](function(_0x475256){_0x31727d[_0x4499('0x46')]=_0x475256;return _0x31727d;})['then'](respondWithFilteredResult(_0x5630b9,_0x1ca7cf))[_0x4499('0x47')](handleError(_0x5630b9,null));};exports[_0x4499('0x48')]=function(_0x2b4ea3,_0x464f82){var _0x2cb751={'raw':!![],'where':{'id':_0x2b4ea3[_0x4499('0x49')]['id']}},_0x360134={};_0x360134['model']=_[_0x4499('0x34')](db[_0x4499('0x2d')][_0x4499('0x2e')]);_0x360134['query']=_[_0x4499('0x34')](_0x2b4ea3[_0x4499('0x33')]);_0x360134['filters']=_[_0x4499('0x37')](_0x360134[_0x4499('0x32')],_0x360134[_0x4499('0x33')]);_0x2cb751[_0x4499('0x36')]=_[_0x4499('0x37')](_0x360134[_0x4499('0x32')],qs[_0x4499('0x38')](_0x2b4ea3[_0x4499('0x33')][_0x4499('0x38')]));_0x2cb751[_0x4499('0x36')]=_0x2cb751[_0x4499('0x36')][_0x4499('0x39')]?_0x2cb751[_0x4499('0x36')]:_0x360134[_0x4499('0x32')];if(_0x2b4ea3[_0x4499('0x33')]['includeAll']){_0x2cb751[_0x4499('0x44')]=[{'all':!![]}];}_0x2cb751=_[_0x4499('0x3f')]({},_0x2cb751,_0x2b4ea3[_0x4499('0x42')]);return db[_0x4499('0x2d')][_0x4499('0x4a')](_0x2cb751)[_0x4499('0x22')](handleEntityNotFound(_0x464f82,null))['then'](respondWithResult(_0x464f82,null))['catch'](handleError(_0x464f82,null));};exports[_0x4499('0x4b')]=function(_0x57fba2,_0x59e49a){return db[_0x4499('0x2d')][_0x4499('0x4b')](_0x57fba2['body'],{})['then'](function(_0x824f7){var _0x5ab694=_0x57fba2[_0x4499('0x4c')]['get']({'plain':!![]});if(!_0x5ab694)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ab694[_0x4499('0x4d')]===_0x4499('0x4c')){var _0x58da50=_0x824f7[_0x4499('0x24')]({'plain':!![]});var _0x5a9771=_0x4499('0x25');return db[_0x4499('0x4e')]['find']({'where':{'name':_0x5a9771,'userProfileId':_0x5ab694[_0x4499('0x4f')]},'raw':!![]})[_0x4499('0x22')](function(_0x1d3187){if(_0x1d3187&&_0x1d3187['autoAssociation']===0x0){return db['UserProfileResource'][_0x4499('0x4b')]({'name':_0x58da50[_0x4499('0x2a')],'resourceId':_0x58da50['id'],'type':_0x1d3187['name'],'sectionId':_0x1d3187['id']},{})[_0x4499('0x22')](function(){return _0x824f7;});}else{return _0x824f7;}})[_0x4499('0x47')](function(_0x2da7b5){logger[_0x4499('0x28')](_0x4499('0x50'),_0x2da7b5);throw _0x2da7b5;});}return _0x824f7;})[_0x4499('0x22')](respondWithResult(_0x59e49a,0xc9))['catch'](handleError(_0x59e49a,null));};exports[_0x4499('0x21')]=function(_0x1ba6e1,_0x104286){if(_0x1ba6e1['body']['id']){delete _0x1ba6e1[_0x4499('0x51')]['id'];}return db[_0x4499('0x2d')][_0x4499('0x4a')]({'where':{'id':_0x1ba6e1['params']['id']}})['then'](handleEntityNotFound(_0x104286,null))['then'](saveUpdates(_0x1ba6e1['body'],null))[_0x4499('0x22')](respondWithResult(_0x104286,null))['catch'](handleError(_0x104286,null));};exports[_0x4499('0x23')]=function(_0x23dbe0,_0xa47c62){return db[_0x4499('0x2d')][_0x4499('0x4a')]({'where':{'id':_0x23dbe0[_0x4499('0x49')]['id']}})[_0x4499('0x22')](handleEntityNotFound(_0xa47c62,null))[_0x4499('0x22')](removeEntity(_0xa47c62,null))[_0x4499('0x47')](handleError(_0xa47c62,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 27d2f43..8c2e972 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 _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x488d12,_0x15e266){var _0x2c3eeb=function(_0x1057b4){while(--_0x1057b4){_0x488d12['push'](_0x488d12['shift']());}};_0x2c3eeb(++_0x15e266);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4be201,_0x3e660c){_0x4be201=_0x4be201-0x0;var _0x6fe5a7=_0x1cb9[_0x4be201];return _0x6fe5a7;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x36be29,_0x245e77){var _0xe655bd=function(_0x1a6264){while(--_0x1a6264){_0x36be29['push'](_0x36be29['shift']());}};_0xe655bd(++_0x245e77);}(_0x326f,0xd1));var _0xf326=function(_0x3e6d82,_0x395c0a){_0x3e6d82=_0x3e6d82-0x0;var _0x20ea67=_0x326f[_0x3e6d82];return _0x20ea67;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 6881ee9..b8c36f3 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x589c2b,_0x5580b1){var _0x338c4a=function(_0x143227){while(--_0x143227){_0x589c2b['push'](_0x589c2b['shift']());}};_0x338c4a(++_0x5580b1);}(_0x7a54,0x106));var _0x47a5=function(_0x52c414,_0x4e461e){_0x52c414=_0x52c414-0x0;var _0x3e371c=_0x7a54[_0x52c414];return _0x3e371c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x458586,_0x445fbe){var _0x4eb247=function(_0x5d2fe5){while(--_0x5d2fe5){_0x458586['push'](_0x458586['shift']());}};_0x4eb247(++_0x445fbe);}(_0x7a54,0x106));var _0x47a5=function(_0xea68a3,_0x2af863){_0xea68a3=_0xea68a3-0x0;var _0x30c2d9=_0x7a54[_0xea68a3];return _0x30c2d9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 53cc608..92da900 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 _0x98a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','webhookGet','/:id','show','/:id/download','download','diskStorage','root','format','%s-%s%s','basename','originalname','extname','post','file','webhookPost','put','update','delete'];(function(_0x43dd17,_0x24c962){var _0x455b81=function(_0x2ac46f){while(--_0x2ac46f){_0x43dd17['push'](_0x43dd17['shift']());}};_0x455b81(++_0x24c962);}(_0x98a8,0x12c));var _0x898a=function(_0x449b4e,_0x57aa36){_0x449b4e=_0x449b4e-0x0;var _0x1090d8=_0x98a8[_0x449b4e];return _0x1090d8;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/webhook',controller[_0x898a('0xc')]);router['get'](_0x898a('0xd'),auth[_0x898a('0xb')](),controller[_0x898a('0xe')]);router[_0x898a('0xa')](_0x898a('0xf'),auth[_0x898a('0xb')](),controller[_0x898a('0x10')]);var upload=multer({'storage':multer[_0x898a('0x11')]({'destination':function(_0x3806cb,_0x5d2de4,_0x3e1867){_0x3e1867(null,path['join'](config[_0x898a('0x12')],'server/files/plugins'));},'filename':function(_0x25d7f2,_0x2c76b7,_0x364a23){_0x2c76b7['originalname']=_0x2c76b7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x364a23(null,util[_0x898a('0x13')](_0x898a('0x14'),path[_0x898a('0x15')](_0x2c76b7[_0x898a('0x16')],path[_0x898a('0x17')](_0x2c76b7[_0x898a('0x16')])),Date['now'](),path[_0x898a('0x17')](_0x2c76b7['originalname'])));}})});router[_0x898a('0x18')]('/',upload['single'](_0x898a('0x19')),controller['upload']);router[_0x898a('0x18')]('/webhook',controller[_0x898a('0x1a')]);router[_0x898a('0x1b')](_0x898a('0xd'),auth['isAuthenticated'](),controller[_0x898a('0x1c')]);router['delete']('/:id',auth[_0x898a('0xb')](),controller[_0x898a('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x9b9b=['single','file','webhookPost','put','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','root','server/files/plugins','originalname','format','basename','extname','now','post'];(function(_0x9e127d,_0x9ea671){var _0x307372=function(_0x22a44a){while(--_0x22a44a){_0x9e127d['push'](_0x9e127d['shift']());}};_0x307372(++_0x9ea671);}(_0x9b9b,0x114));var _0xb9b9=function(_0x4c94d1,_0x573a4f){_0x4c94d1=_0x4c94d1-0x0;var _0x48c2c3=_0x9b9b[_0x4c94d1];return _0x48c2c3;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var fs_extra=require(_0xb9b9('0x3'));var auth=require(_0xb9b9('0x4'));var interaction=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var controller=require(_0xb9b9('0x7'));router[_0xb9b9('0x8')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xa')]);router[_0xb9b9('0x8')](_0xb9b9('0xb'),controller[_0xb9b9('0xc')]);router[_0xb9b9('0x8')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['show']);router['get'](_0xb9b9('0xe'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3949d0,_0x3b6bb9,_0x1122bb){_0x1122bb(null,path['join'](config[_0xb9b9('0x10')],_0xb9b9('0x11')));},'filename':function(_0xbc5a42,_0x26fa04,_0x230fea){_0x26fa04[_0xb9b9('0x12')]=_0x26fa04['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x230fea(null,util[_0xb9b9('0x13')]('%s-%s%s',path[_0xb9b9('0x14')](_0x26fa04['originalname'],path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])),Date[_0xb9b9('0x16')](),path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])));}})});router[_0xb9b9('0x17')]('/',upload[_0xb9b9('0x18')](_0xb9b9('0x19')),controller['upload']);router[_0xb9b9('0x17')]('/webhook',controller[_0xb9b9('0x1a')]);router[_0xb9b9('0x1b')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['update']);router[_0xb9b9('0x1c')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0x1c')]);module[_0xb9b9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a264353..6dc34c0 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 _0xbfa8=['agentOnly','always','never','STRING','sequelize','exports','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly'];(function(_0x3ef32c,_0x2d842c){var _0x2b8cc7=function(_0x110df7){while(--_0x110df7){_0x3ef32c['push'](_0x3ef32c['shift']());}};_0x2b8cc7(++_0x2d842c);}(_0xbfa8,0x66));var _0x8bfa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbfa8[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x8bfa('0x0'));module[_0x8bfa('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x8bfa('0x2'),_0x8bfa('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x8bfa('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x8bfa('0x5')},'active':{'type':Sequelize[_0x8bfa('0x6')],'defaultValue':0x0,'comment':_0x8bfa('0x7')},'sidebar':{'type':Sequelize[_0x8bfa('0x8')](_0x8bfa('0x9'),_0x8bfa('0xa'),_0x8bfa('0xb'),_0x8bfa('0xc')),'defaultValue':_0x8bfa('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x8bfa('0xd')]},'adminUrl':{'type':Sequelize[_0x8bfa('0xd')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x8bfa('0xd')]},'scriptPath':{'type':Sequelize[_0x8bfa('0xd')]}}; \ No newline at end of file +var _0x7851=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x5ca94d,_0x18081b){var _0x281e0d=function(_0x1593b9){while(--_0x1593b9){_0x5ca94d['push'](_0x5ca94d['shift']());}};_0x281e0d(++_0x18081b);}(_0x7851,0x194));var _0x1785=function(_0x5244bf,_0x57bdb1){_0x5244bf=_0x5244bf-0x0;var _0x2afba8=_0x7851[_0x5244bf];return _0x2afba8;};'use strict';var Sequelize=require('sequelize');module[_0x1785('0x0')]={'name':{'type':Sequelize[_0x1785('0x1')]},'type':{'type':Sequelize[_0x1785('0x2')]('html',_0x1785('0x3'))},'description':{'type':Sequelize[_0x1785('0x4')]},'version':{'type':Sequelize[_0x1785('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x1785('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1785('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x1785('0x7'),'agentOnly',_0x1785('0x8'),'never'),'defaultValue':'always','comment':_0x1785('0x9')},'icon':{'type':Sequelize[_0x1785('0x1')]},'adminUrl':{'type':Sequelize[_0x1785('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1785('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index c3a5aa6..631709a 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 _0xbf47=['userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','map','Plugin','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','find','params','join','root','format','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role'];(function(_0x4d973c,_0x36153f){var _0x33d408=function(_0x4e1fc3){while(--_0x4e1fc3){_0x4d973c['push'](_0x4d973c['shift']());}};_0x33d408(++_0x36153f);}(_0xbf47,0x182));var _0x7bf4=function(_0x36ccce,_0x52a57e){_0x36ccce=_0x36ccce-0x0;var _0x1e301a=_0xbf47[_0x36ccce];return _0x1e301a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7bf4('0x0'));var zipdir=require(_0x7bf4('0x1'));var jsonpatch=require(_0x7bf4('0x2'));var rp=require(_0x7bf4('0x3'));var moment=require(_0x7bf4('0x4'));var BPromise=require(_0x7bf4('0x5'));var Mustache=require(_0x7bf4('0x6'));var util=require(_0x7bf4('0x7'));var path=require(_0x7bf4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bf4('0x9'));var fs=require('fs');var fs_extra=require(_0x7bf4('0xa'));var _=require('lodash');var squel=require(_0x7bf4('0xb'));var crypto=require(_0x7bf4('0xc'));var jsforce=require(_0x7bf4('0xd'));var deskjs=require(_0x7bf4('0xe'));var toCsv=require(_0x7bf4('0xf'));var querystring=require(_0x7bf4('0x10'));var Papa=require(_0x7bf4('0x11'));var extract=require(_0x7bf4('0x12'));var rimraf=require(_0x7bf4('0x0'));var archiver=require('archiver');var Redis=require(_0x7bf4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7bf4('0x14'));var as=require(_0x7bf4('0x15'));var hardwareService=require(_0x7bf4('0x16'));var logger=require('../../config/logger')(_0x7bf4('0x17'));var utils=require(_0x7bf4('0x18'));var config=require(_0x7bf4('0x19'));var licenseUtil=require(_0x7bf4('0x1a'));var db=require('../../mysqldb')['db'];config[_0x7bf4('0x1b')]=_[_0x7bf4('0x1c')](config[_0x7bf4('0x1b')],{'host':_0x7bf4('0x1d'),'port':0x18eb});var socket=require(_0x7bf4('0x1e'))(new Redis(config[_0x7bf4('0x1b')]));require(_0x7bf4('0x1f'))[_0x7bf4('0x20')](socket);function respondWithStatusCode(_0x3d4e53,_0x46bfaa){_0x46bfaa=_0x46bfaa||0xcc;return function(_0x548f41){if(_0x548f41){return _0x3d4e53[_0x7bf4('0x21')](_0x46bfaa);}return _0x3d4e53['status'](_0x46bfaa)[_0x7bf4('0x22')]();};}function respondWithResult(_0x5dee15,_0x15fbd4){_0x15fbd4=_0x15fbd4||0xc8;return function(_0x333d7e){if(_0x333d7e){return _0x5dee15[_0x7bf4('0x23')](_0x15fbd4)[_0x7bf4('0x24')](_0x333d7e);}};}function respondWithFilteredResult(_0x319568,_0x5d74cd){return function(_0xd7051){if(_0xd7051){var _0x2f4763=typeof _0x5d74cd[_0x7bf4('0x25')]===_0x7bf4('0x26')&&typeof _0x5d74cd[_0x7bf4('0x27')]==='undefined';var _0xaca002=_0xd7051['count'];var _0x1b2449=_0x2f4763?0x0:_0x5d74cd['offset'];var _0x31f7de=_0x2f4763?_0xd7051[_0x7bf4('0x28')]:_0x5d74cd['offset']+_0x5d74cd[_0x7bf4('0x27')];var _0xcb8775;if(_0x31f7de>=_0xaca002){_0x31f7de=_0xaca002;_0xcb8775=0xc8;}else{_0xcb8775=0xce;}_0x319568[_0x7bf4('0x23')](_0xcb8775);return _0x319568[_0x7bf4('0x29')](_0x7bf4('0x2a'),_0x1b2449+'-'+_0x31f7de+'/'+_0xaca002)[_0x7bf4('0x24')](_0xd7051);}return null;};}function patchUpdates(_0x121463){return function(_0x3c5737){try{jsonpatch[_0x7bf4('0x2b')](_0x3c5737,_0x121463,!![]);}catch(_0x32eb81){return BPromise[_0x7bf4('0x2c')](_0x32eb81);}return _0x3c5737['save']();};}function saveUpdates(_0x114c51,_0x47a975){return function(_0x65fbb3){if(_0x65fbb3){return _0x65fbb3[_0x7bf4('0x2d')](_0x114c51)[_0x7bf4('0x2e')](function(_0x29a6ee){return _0x29a6ee;});}return null;};}function removeEntity(_0x3535ce,_0x2ddde8){return function(_0x1f8895){if(_0x1f8895){return _0x1f8895[_0x7bf4('0x2f')]()[_0x7bf4('0x2e')](function(){var _0x44995e=_0x1f8895[_0x7bf4('0x30')]({'plain':!![]});var _0x20836a=_0x7bf4('0x31');return db[_0x7bf4('0x32')][_0x7bf4('0x2f')]({'where':{'type':_0x20836a,'resourceId':_0x44995e['id']}})['then'](function(){return _0x1f8895;});})[_0x7bf4('0x2e')](function(){_0x3535ce['status'](0xcc)[_0x7bf4('0x22')]();});}};}function handleEntityNotFound(_0x4979e6,_0x65946d){return function(_0x1adf11){if(!_0x1adf11){_0x4979e6[_0x7bf4('0x21')](0x194);}return _0x1adf11;};}function handleError(_0x6fa551,_0x518fb4){_0x518fb4=_0x518fb4||0x1f4;return function(_0x1c8ca9){logger[_0x7bf4('0x33')](_0x1c8ca9[_0x7bf4('0x34')]);if(_0x1c8ca9['name']){delete _0x1c8ca9[_0x7bf4('0x35')];}_0x6fa551['status'](_0x518fb4)[_0x7bf4('0x36')](_0x1c8ca9);};}exports['index']=function(_0x54a8db,_0x4eec37){var _0x5848f1={},_0x4469fa={},_0x1e263f={'count':0x0,'rows':[]};var _0x1f6d58=_[_0x7bf4('0x37')](db[_0x7bf4('0x38')][_0x7bf4('0x39')],function(_0x497a24){return{'name':_0x497a24[_0x7bf4('0x3a')],'type':_0x497a24['type'][_0x7bf4('0x3b')]};});_0x4469fa['model']=_[_0x7bf4('0x37')](_0x1f6d58,_0x7bf4('0x35'));_0x4469fa[_0x7bf4('0x3c')]=_[_0x7bf4('0x3d')](_0x54a8db[_0x7bf4('0x3c')]);_0x4469fa[_0x7bf4('0x3e')]=_[_0x7bf4('0x3f')](_0x4469fa['model'],_0x4469fa[_0x7bf4('0x3c')]);_0x5848f1['attributes']=_[_0x7bf4('0x3f')](_0x4469fa[_0x7bf4('0x40')],qs['fields'](_0x54a8db[_0x7bf4('0x3c')][_0x7bf4('0x41')]));_0x5848f1[_0x7bf4('0x42')]=_0x5848f1[_0x7bf4('0x42')][_0x7bf4('0x43')]?_0x5848f1[_0x7bf4('0x42')]:_0x4469fa['model'];if(!_0x54a8db[_0x7bf4('0x3c')][_0x7bf4('0x44')](_0x7bf4('0x45'))){_0x5848f1[_0x7bf4('0x27')]=qs[_0x7bf4('0x27')](_0x54a8db[_0x7bf4('0x3c')][_0x7bf4('0x27')]);_0x5848f1[_0x7bf4('0x25')]=qs[_0x7bf4('0x25')](_0x54a8db[_0x7bf4('0x3c')][_0x7bf4('0x25')]);}_0x5848f1[_0x7bf4('0x46')]=qs[_0x7bf4('0x47')](_0x54a8db[_0x7bf4('0x3c')][_0x7bf4('0x47')]);_0x5848f1[_0x7bf4('0x48')]=qs[_0x7bf4('0x3e')](_[_0x7bf4('0x49')](_0x54a8db['query'],_0x4469fa[_0x7bf4('0x3e')]),_0x1f6d58);if(_0x54a8db[_0x7bf4('0x3c')][_0x7bf4('0x4a')]){_0x5848f1[_0x7bf4('0x48')]=_[_0x7bf4('0x4b')](_0x5848f1[_0x7bf4('0x48')],{'$or':_[_0x7bf4('0x37')](_0x1f6d58,function(_0x46fc9d){if(_0x46fc9d[_0x7bf4('0x4c')]!==_0x7bf4('0x4d')){var _0x5c6686={};_0x5c6686[_0x46fc9d[_0x7bf4('0x35')]]={'$like':'%'+_0x54a8db['query'][_0x7bf4('0x4a')]+'%'};return _0x5c6686;}})});}_0x5848f1=_['merge']({},_0x5848f1,_0x54a8db[_0x7bf4('0x4e')]);var _0x514513={'where':_0x5848f1['where']};return db[_0x7bf4('0x38')][_0x7bf4('0x28')](_0x514513)[_0x7bf4('0x2e')](function(_0xbee8f5){_0x1e263f['count']=_0xbee8f5;if(_0x54a8db[_0x7bf4('0x3c')]['includeAll']){_0x5848f1[_0x7bf4('0x4f')]=[{'all':!![]}];}return db[_0x7bf4('0x38')][_0x7bf4('0x50')](_0x5848f1);})[_0x7bf4('0x2e')](function(_0x2da681){_0x1e263f[_0x7bf4('0x51')]=_0x2da681;return _0x1e263f;})[_0x7bf4('0x2e')](respondWithFilteredResult(_0x4eec37,_0x5848f1))[_0x7bf4('0x52')](handleError(_0x4eec37,null));};exports[_0x7bf4('0x53')]=function(_0x23d0e6,_0xaa8423){var _0x559b61={'raw':!![],'where':{'id':_0x23d0e6['params']['id']}},_0x59fcb7={};_0x59fcb7['model']=_[_0x7bf4('0x3d')](db[_0x7bf4('0x38')]['rawAttributes']);_0x59fcb7[_0x7bf4('0x3c')]=_['keys'](_0x23d0e6['query']);_0x59fcb7[_0x7bf4('0x3e')]=_['intersection'](_0x59fcb7['model'],_0x59fcb7['query']);_0x559b61[_0x7bf4('0x42')]=_['intersection'](_0x59fcb7[_0x7bf4('0x40')],qs['fields'](_0x23d0e6[_0x7bf4('0x3c')][_0x7bf4('0x41')]));_0x559b61[_0x7bf4('0x42')]=_0x559b61['attributes'][_0x7bf4('0x43')]?_0x559b61['attributes']:_0x59fcb7[_0x7bf4('0x40')];if(_0x23d0e6['query']['includeAll']){_0x559b61[_0x7bf4('0x4f')]=[{'all':!![]}];}_0x559b61=_[_0x7bf4('0x4b')]({},_0x559b61,_0x23d0e6[_0x7bf4('0x4e')]);return db['Plugin']['find'](_0x559b61)[_0x7bf4('0x2e')](handleEntityNotFound(_0xaa8423,null))[_0x7bf4('0x2e')](respondWithResult(_0xaa8423,null))[_0x7bf4('0x52')](handleError(_0xaa8423,null));};exports['download']=function(_0x347a1a,_0x2dd788,_0x5b37cc){return db[_0x7bf4('0x38')][_0x7bf4('0x54')]({'where':{'id':_0x347a1a[_0x7bf4('0x55')]['id']},'attributes':['name',_0x7bf4('0x8')],'raw':!![]})['then'](handleEntityNotFound(_0x2dd788,null))['then'](function(_0x38d66d){if(_0x38d66d){var _0xd842d7=path[_0x7bf4('0x56')](config[_0x7bf4('0x57')],'server/files/plugins',util[_0x7bf4('0x58')]('%s.zip',path[_0x7bf4('0x59')](_0x38d66d[_0x7bf4('0x8')])));var _0x493232=fs[_0x7bf4('0x5a')](_0xd842d7);var _0x962b97=archiver(_0x7bf4('0x5b'),{'zlib':{'level':0x9}});_0x962b97['on']('warning',function(_0x509a90){if(_0x509a90[_0x7bf4('0x5c')]===_0x7bf4('0x5d')){logger[_0x7bf4('0x33')](_0x509a90);}else{throw new db[(_0x7bf4('0x5e'))][(_0x7bf4('0x5f'))](_0x7bf4('0x60'));}});_0x962b97['on'](_0x7bf4('0x33'),function(_0x348d02){throw new db['Sequelize'][(_0x7bf4('0x5f'))](_0x7bf4('0x60'));});_0x962b97[_0x7bf4('0x61')](_0x493232);_0x962b97[_0x7bf4('0x62')](_0x7bf4('0x63'),{'cwd':path['join'](config[_0x7bf4('0x57')],'server/files/plugins',path[_0x7bf4('0x64')](_0x38d66d['path'])),'ignore':[path['join'](path[_0x7bf4('0x59')](_0x38d66d['path']),_0x7bf4('0x65')),path[_0x7bf4('0x56')](path['basename'](_0x38d66d[_0x7bf4('0x8')]),_0x7bf4('0x66'))],'nodir':!![]})[_0x7bf4('0x67')]();_0x493232['on']('close',function(){if(!fs[_0x7bf4('0x68')](_0xd842d7)){throw new db['Sequelize'][(_0x7bf4('0x5f'))](_0x7bf4('0x69'));}return _0x2dd788[_0x7bf4('0x6a')](_0xd842d7,util['format']('%s.zip',path[_0x7bf4('0x59')](_0x38d66d['path'])),function(_0xfbf4e){if(_0xfbf4e){throw new db[(_0x7bf4('0x5e'))]['Error'](_0x7bf4('0x6b'));}fs[_0x7bf4('0x6c')](_0xd842d7);logger[_0x7bf4('0x6d')](_0x7bf4('0x6e'));logger[_0x7bf4('0x6d')](_0x7bf4('0x6f'));});});}return null;})['catch'](handleError(_0x2dd788,null));};exports[_0x7bf4('0x70')]=function(_0x5d61b6,_0x461bcf,_0x232ad0){var _0x2a6873=path[_0x7bf4('0x59')](_0x5d61b6['file'][_0x7bf4('0x71')],path[_0x7bf4('0x72')](_0x5d61b6[_0x7bf4('0x73')][_0x7bf4('0x71')]));var _0x37a9be=path[_0x7bf4('0x56')](config[_0x7bf4('0x57')],_0x7bf4('0x74'),_0x5d61b6[_0x7bf4('0x73')][_0x7bf4('0x71')]);var _0x12a1b1=path[_0x7bf4('0x56')](config[_0x7bf4('0x57')],_0x7bf4('0x74'),_0x2a6873);logger[_0x7bf4('0x6d')](_0x7bf4('0x75'),_0x37a9be);logger[_0x7bf4('0x6d')](_0x7bf4('0x76'),_0x12a1b1);try{fs[_0x7bf4('0x77')](_0x37a9be,parseInt(_0x7bf4('0x78'),0x8));extract(_0x37a9be,{'dir':_0x12a1b1},function(_0x273cd0){if(_0x273cd0){logger[_0x7bf4('0x33')](_0x273cd0);handleError(_0x273cd0,!![]);};var _0x48e882=fs[_0x7bf4('0x79')](_0x12a1b1);if(_0x48e882['length']>0x1){removeReferences(_0x37a9be,_0x12a1b1);logger[_0x7bf4('0x33')](_0x7bf4('0x7a'));return _0x232ad0(new Error(_0x7bf4('0x7a')));}var _0x53a162=fs[_0x7bf4('0x7b')](path[_0x7bf4('0x56')](_0x12a1b1,_0x48e882[0x0]));if(_0x53a162[_0x7bf4('0x7c')]()){removeReferences(_0x37a9be,_0x12a1b1);logger['error'](_0x7bf4('0x7a'));return _0x232ad0(new Error(_0x7bf4('0x7a')));}if(_0x53a162[_0x7bf4('0x7d')]()){var _0x118cbc=fs[_0x7bf4('0x79')](path[_0x7bf4('0x56')](_0x12a1b1,_0x48e882[0x0]));if(_0x118cbc[_0x7bf4('0x43')]===0x0){removeReferences(_0x37a9be,_0x12a1b1);logger[_0x7bf4('0x33')](_0x7bf4('0x7a'));return _0x232ad0(new Error('Invalid\x20plugin\x20structure'));}var _0x27f274=_0x118cbc['some'](function(_0x347bb1){return _0x347bb1===_0x7bf4('0x7e');});if(!_0x27f274){return _0x232ad0(new Error(_0x7bf4('0x7f')));}var _0x47d89e=fs[_0x7bf4('0x80')](path[_0x7bf4('0x56')](_0x12a1b1,_0x48e882[0x0],_0x7bf4('0x7e')));var _0x340afc=JSON['parse'](_0x47d89e);if(_0x7bf4('0x26')==typeof _0x340afc['name']){return _0x232ad0(new Error(_0x7bf4('0x81')));}if(_0x7bf4('0x26')==typeof _0x340afc[_0x7bf4('0x4c')]){return _0x232ad0(new Error(_0x7bf4('0x82')));}if(_0x7bf4('0x26')==typeof _0x340afc[_0x7bf4('0x83')]){return _0x232ad0(new Error(_0x7bf4('0x84')));}if(_0x7bf4('0x26')==typeof _0x340afc[_0x7bf4('0x85')]){return _0x232ad0(new Error(_0x7bf4('0x86')));}if(_0x340afc[_0x7bf4('0x4c')]===_0x7bf4('0x87')){if(_0x7bf4('0x26')==typeof _0x340afc[_0x7bf4('0x85')][_0x7bf4('0x88')]){return _0x232ad0(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x7bf4('0x26')==typeof _0x340afc[_0x7bf4('0x85')][_0x7bf4('0x88')][_0x7bf4('0x89')]&&_0x7bf4('0x26')==typeof _0x340afc[_0x7bf4('0x85')][_0x7bf4('0x88')][_0x7bf4('0x8a')]){return _0x232ad0(new Error(_0x7bf4('0x8b')));}}else if(_0x340afc[_0x7bf4('0x4c')]===_0x7bf4('0x8c')){if(_0x7bf4('0x26')==typeof _0x340afc[_0x7bf4('0x85')][_0x7bf4('0x8d')]){return _0x232ad0(new Error(_0x7bf4('0x8e')));}if(_0x7bf4('0x26')==typeof _0x340afc[_0x7bf4('0x85')][_0x7bf4('0x8f')]){return _0x232ad0(new Error(_0x7bf4('0x90')));}}else{return _0x232ad0(new Error(_0x7bf4('0x91')));}var _0x340aad=_0x340afc['name'];var _0x1a454c=_0x340afc[_0x7bf4('0x92')];var _0x233abd=_0x340afc[_0x7bf4('0x4c')];var _0x439242=_0x340afc['sidebar']?_0x340afc[_0x7bf4('0x93')]:_0x7bf4('0x94');var _0x4157b1=_0x340afc['icon']?_0x340afc[_0x7bf4('0x95')]:_0x7bf4('0x96');var _0x43e8fc='';var _0x5ad111='';var _0x2d3b94='';var _0x37ec12='';var _0x58a7ac=_0x340afc[_0x7bf4('0x83')];if(_0x233abd==='html'){if(_0x7bf4('0x26')!=typeof _0x340afc[_0x7bf4('0x85')][_0x7bf4('0x88')][_0x7bf4('0x89')]){var _0x45083e=_0x340afc['parameters'][_0x7bf4('0x88')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7bf4('0x97')](_0x45083e)){_0x43e8fc=path[_0x7bf4('0x56')](_0x7bf4('0x98'),_0x2a6873,_0x48e882[0x0],_0x45083e);}else{_0x43e8fc=_0x45083e;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x340afc[_0x7bf4('0x85')][_0x7bf4('0x88')][_0x7bf4('0x8a')]){var _0x55a54c=_0x340afc[_0x7bf4('0x85')][_0x7bf4('0x88')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x7bf4('0x97')](_0x55a54c)){_0x5ad111=path[_0x7bf4('0x56')](_0x7bf4('0x98'),_0x2a6873,_0x48e882[0x0],_0x55a54c);}else{_0x5ad111=_0x55a54c;}}else{logger[_0x7bf4('0x6d')](_0x7bf4('0x99'));}}else if(_0x233abd==='script'){_0x2d3b94=_0x340afc[_0x7bf4('0x85')][_0x7bf4('0x8d')];_0x37ec12=_0x340afc['parameters'][_0x7bf4('0x8f')];if(_0x7bf4('0x26')!=typeof _0x340afc[_0x7bf4('0x85')]['views']){if(_0x7bf4('0x26')!=typeof _0x340afc[_0x7bf4('0x85')][_0x7bf4('0x88')][_0x7bf4('0x89')]){var _0x45083e=_0x340afc[_0x7bf4('0x85')][_0x7bf4('0x88')][_0x7bf4('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x45083e)){_0x43e8fc=path[_0x7bf4('0x56')](_0x7bf4('0x98'),_0x2a6873,_0x48e882[0x0],_0x45083e);}else{_0x43e8fc=_0x45083e;}}if(_0x7bf4('0x26')!=typeof _0x340afc['parameters']['views'][_0x7bf4('0x8a')]){var _0x55a54c=_0x340afc[_0x7bf4('0x85')][_0x7bf4('0x88')][_0x7bf4('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x7bf4('0x97')](_0x55a54c)){_0x5ad111=path[_0x7bf4('0x56')](_0x7bf4('0x98'),_0x2a6873,_0x48e882[0x0],_0x55a54c);}else{_0x5ad111=_0x55a54c;}}}}var _0x2b890b={'name':_0x340aad,'description':_0x1a454c,'path':path[_0x7bf4('0x56')](_0x2a6873,_0x48e882[0x0]),'type':_0x233abd,'sidebar':_0x439242,'icon':_0x4157b1,'adminUrl':_0x43e8fc,'agentUrl':_0x5ad111,'scriptName':_0x2d3b94,'scriptPath':_0x37ec12,'version':_0x58a7ac};removeReferences(_0x37a9be,null);return db[_0x7bf4('0x38')][_0x7bf4('0x9a')](_0x2b890b)[_0x7bf4('0x2e')](function(_0x2c4e2b){var _0x340cf5={'role':_0x5d61b6[_0x7bf4('0x9b')][_0x7bf4('0x9c')],'userProfileId':_0x5d61b6[_0x7bf4('0x9b')][_0x7bf4('0x9d')]};if(!_0x340cf5)throw new Error(_0x7bf4('0x9e'));if(_0x340cf5[_0x7bf4('0x9c')]===_0x7bf4('0x9f')){var _0x5b6be3=_0x2c4e2b[_0x7bf4('0x30')]({'plain':!![]});return db[_0x7bf4('0xa0')]['find']({'where':{'name':_0x7bf4('0x31'),'userProfileId':_0x340cf5['userProfileId']},'raw':!![]})[_0x7bf4('0x2e')](function(_0x4ba099){if(_0x4ba099&&_0x4ba099[_0x7bf4('0xa1')]===0x0){return db[_0x7bf4('0x32')]['create']({'name':_0x5b6be3[_0x7bf4('0x35')],'resourceId':_0x5b6be3['id'],'type':_0x4ba099[_0x7bf4('0x35')],'sectionId':_0x4ba099['id']},{})[_0x7bf4('0x2e')](function(){return _0x2c4e2b;});}else{return _0x2c4e2b;}})[_0x7bf4('0x52')](function(_0x23a224){logger['error'](_0x7bf4('0xa2'),_0x23a224);throw _0x23a224;});}return _0x2c4e2b;})[_0x7bf4('0x2e')](respondWithResult(_0x461bcf,null))[_0x7bf4('0x52')](handleError(_0x461bcf,null));}});}catch(_0x22da9f){_0x461bcf[_0x7bf4('0x23')](0x1f4)['send'](_0x22da9f);}};function removeReferences(_0x203454,_0x40c39c){try{if(_0x203454){fs[_0x7bf4('0x6c')](_0x203454);logger[_0x7bf4('0x6d')]('Zip\x20archive\x20removed');}if(_0x40c39c){rimraf(_0x40c39c,function(){});logger[_0x7bf4('0x6d')](_0x7bf4('0xa3'));}}catch(_0x5dd1fe){logger[_0x7bf4('0x33')](_0x5dd1fe);}}exports[_0x7bf4('0x2d')]=function(_0x920cc2,_0x274282,_0x3e5c61){return db['Plugin']['find']({'where':{'id':_0x920cc2[_0x7bf4('0x55')]['id']}})[_0x7bf4('0x2e')](handleEntityNotFound(_0x274282,null))[_0x7bf4('0x2e')](saveUpdates(_0x920cc2[_0x7bf4('0x9b')],null))[_0x7bf4('0x2e')](respondWithResult(_0x274282,null))['catch'](handleError(_0x274282,null));};exports[_0x7bf4('0xa4')]=function(_0x368347,_0x1f555e,_0x48f099){return db[_0x7bf4('0x38')]['find']({'where':{'id':_0x368347['params']['id']}})[_0x7bf4('0x2e')](function(_0x48cb4c){if(_0x48cb4c){return _0x48cb4c[_0x7bf4('0x2f')]();}})[_0x7bf4('0x2e')](function(_0x973df4){rimraf(path[_0x7bf4('0x56')](config[_0x7bf4('0x57')],_0x7bf4('0x74'),path['dirname'](_0x973df4[_0x7bf4('0x8')])),function(){});return _0x973df4;})[_0x7bf4('0x2e')](handleEntityNotFound(_0x1f555e,null))[_0x7bf4('0x2e')](respondWithStatusCode(_0x1f555e,null))['catch'](handleError(_0x1f555e,null));};exports[_0x7bf4('0xa5')]=function(_0x2527a8,_0x2f0a14,_0x54f3da){return BPromise['resolve']()['then'](function(){if(!_0x2527a8[_0x7bf4('0x3c')][_0x7bf4('0x8')]){throw new Error(_0x7bf4('0xa6'));}if(!_0x2527a8[_0x7bf4('0x3c')][_0x7bf4('0xa7')]){throw new Error(_0x7bf4('0xa8'));}var _0x4fdb2f=_0x2527a8[_0x7bf4('0x3c')]['hostname']?_0x2527a8[_0x7bf4('0x3c')][_0x7bf4('0xa9')]+':'+_0x2527a8[_0x7bf4('0x3c')]['port']:_0x7bf4('0xaa')+_0x2527a8[_0x7bf4('0x3c')][_0x7bf4('0xa7')];var _0x482be9=_0x2527a8['query'][_0x7bf4('0x24')]?_0x2527a8['query']['json']:!![];var _0x1d677d=_0x2527a8[_0x7bf4('0x3c')][_0x7bf4('0xab')]?_0x2527a8[_0x7bf4('0x3c')]['encoding']:null;var _0x2ceafd={'method':_0x2527a8[_0x7bf4('0xac')],'uri':util[_0x7bf4('0x58')](_0x7bf4('0xad'),_0x4fdb2f,_0x2527a8['query'][_0x7bf4('0x8')]),'json':_0x482be9,'resolveWithFullResponse':!![],'encoding':_0x1d677d,'qs':_0x2527a8['query']};if(_0x2527a8[_0x7bf4('0xae')]){_0x2ceafd[_0x7bf4('0xae')]=_0x2527a8[_0x7bf4('0xae')];if(_0x2ceafd[_0x7bf4('0xae')]['content-length']){delete _0x2ceafd[_0x7bf4('0xae')][_0x7bf4('0xaf')];}}if(_0x2ceafd[_0x7bf4('0xae')][_0x7bf4('0xb0')]){delete _0x2ceafd[_0x7bf4('0xae')][_0x7bf4('0xb0')];}return rp(_0x2ceafd);})[_0x7bf4('0x2e')](function(_0x3fd964){if(_0x3fd964){_0x2f0a14['set'](_0x3fd964[_0x7bf4('0xae')]);logger[_0x7bf4('0x6d')](_0x3fd964[_0x7bf4('0x9b')]);if(_[_0x7bf4('0xb1')](_0x2527a8[_0x7bf4('0x3c')][_0x7bf4('0x8')],'download')&&_0x3fd964[_0x7bf4('0xb2')]==0x1f4){return _0x2f0a14[_0x7bf4('0x21')](_0x3fd964[_0x7bf4('0xb2')]);}else{return _0x2f0a14[_0x7bf4('0x23')](_0x3fd964[_0x7bf4('0xb2')])[_0x7bf4('0x36')](_0x3fd964[_0x7bf4('0x9b')]);}}else{return _0x2f0a14['sendStatus'](0xc8);}})[_0x7bf4('0x52')](handleError(_0x2f0a14,null));};exports[_0x7bf4('0xb3')]=function(_0x301a6a,_0x47e463,_0x62547a){return BPromise[_0x7bf4('0xb4')]()[_0x7bf4('0x2e')](function(){if(!_0x301a6a[_0x7bf4('0x3c')][_0x7bf4('0x8')]){throw new Error(_0x7bf4('0xa6'));}if(!_0x301a6a[_0x7bf4('0x3c')][_0x7bf4('0xa7')]){throw new Error(_0x7bf4('0xa8'));}var _0x205397=_0x301a6a[_0x7bf4('0x3c')][_0x7bf4('0xa9')]?_0x301a6a[_0x7bf4('0x3c')][_0x7bf4('0xa9')]+':'+_0x301a6a['query'][_0x7bf4('0xa7')]:_0x7bf4('0xaa')+_0x301a6a['query'][_0x7bf4('0xa7')];var _0x5b23aa=_0x301a6a['query'][_0x7bf4('0x24')]?_0x301a6a['query'][_0x7bf4('0x24')]:!![];var _0x43a572=_0x301a6a[_0x7bf4('0x3c')][_0x7bf4('0xab')]?_0x301a6a['query'][_0x7bf4('0xab')]:null;var _0x399a7b={'method':_0x301a6a[_0x7bf4('0xac')],'uri':util[_0x7bf4('0x58')](_0x7bf4('0xad'),_0x205397,_0x301a6a['query'][_0x7bf4('0x8')]),'json':_0x5b23aa,'resolveWithFullResponse':!![],'encoding':_0x43a572,'body':_0x301a6a[_0x7bf4('0x9b')]};if(_0x301a6a['headers']){_0x399a7b['headers']=_0x301a6a[_0x7bf4('0xae')];if(_0x399a7b[_0x7bf4('0xae')][_0x7bf4('0xaf')]){delete _0x399a7b[_0x7bf4('0xae')][_0x7bf4('0xaf')];}}if(_0x399a7b['headers'][_0x7bf4('0xb0')]){delete _0x399a7b[_0x7bf4('0xae')]['content-type'];}return rp(_0x399a7b);})[_0x7bf4('0x2e')](function(_0x82c0c5){if(_0x82c0c5){_0x47e463[_0x7bf4('0x29')](_0x82c0c5[_0x7bf4('0xae')]);logger[_0x7bf4('0x6d')](_0x82c0c5['body']);return _0x47e463[_0x7bf4('0x23')](_0x82c0c5[_0x7bf4('0xb2')])[_0x7bf4('0x36')](_0x82c0c5[_0x7bf4('0x9b')]);}else{return _0x47e463[_0x7bf4('0x21')](0xc8);}})[_0x7bf4('0x52')](handleError(_0x47e463,null));}; \ No newline at end of file +var _0x89f3=['file','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','format','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','json','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','redis','register','sendStatus','status','end','limit','undefined','offset','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','Plugin','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Sequelize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname'];(function(_0x48e214,_0xe715e4){var _0x3bda4e=function(_0x52282e){while(--_0x52282e){_0x48e214['push'](_0x48e214['shift']());}};_0x3bda4e(++_0xe715e4);}(_0x89f3,0xe2));var _0x389f=function(_0x21d200,_0x4b2ef9){_0x21d200=_0x21d200-0x0;var _0x76fb3=_0x89f3[_0x21d200];return _0x76fb3;};'use strict';var emlformat=require(_0x389f('0x0'));var rimraf=require(_0x389f('0x1'));var zipdir=require(_0x389f('0x2'));var jsonpatch=require(_0x389f('0x3'));var rp=require('request-promise');var moment=require(_0x389f('0x4'));var BPromise=require(_0x389f('0x5'));var Mustache=require('mustache');var util=require(_0x389f('0x6'));var path=require(_0x389f('0x7'));var sox=require(_0x389f('0x8'));var csv=require(_0x389f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x389f('0xa'));var squel=require(_0x389f('0xb'));var crypto=require('crypto');var jsforce=require(_0x389f('0xc'));var deskjs=require(_0x389f('0xd'));var toCsv=require(_0x389f('0x9'));var querystring=require(_0x389f('0xe'));var Papa=require('papaparse');var extract=require(_0x389f('0xf'));var rimraf=require('rimraf');var archiver=require(_0x389f('0x10'));var Redis=require(_0x389f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x389f('0x12'));var as=require(_0x389f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x389f('0x14'));var utils=require(_0x389f('0x15'));var config=require(_0x389f('0x16'));var licenseUtil=require(_0x389f('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x389f('0x18')](config['redis'],{'host':_0x389f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x389f('0x1a')]));require('./plugin.socket')[_0x389f('0x1b')](socket);function respondWithStatusCode(_0xc92808,_0x5a2f41){_0x5a2f41=_0x5a2f41||0xcc;return function(_0x13975a){if(_0x13975a){return _0xc92808[_0x389f('0x1c')](_0x5a2f41);}return _0xc92808[_0x389f('0x1d')](_0x5a2f41)[_0x389f('0x1e')]();};}function respondWithResult(_0x4a4867,_0xc807c3){_0xc807c3=_0xc807c3||0xc8;return function(_0x2bcb2f){if(_0x2bcb2f){return _0x4a4867[_0x389f('0x1d')](_0xc807c3)['json'](_0x2bcb2f);}};}function respondWithFilteredResult(_0x313429,_0x39fd89){return function(_0x51f14e){if(_0x51f14e){var _0x56f113=typeof _0x39fd89['offset']==='undefined'&&typeof _0x39fd89[_0x389f('0x1f')]===_0x389f('0x20');var _0x4986d3=_0x51f14e['count'];var _0x4d29c2=_0x56f113?0x0:_0x39fd89[_0x389f('0x21')];var _0x2ea1eb=_0x56f113?_0x51f14e[_0x389f('0x22')]:_0x39fd89[_0x389f('0x21')]+_0x39fd89[_0x389f('0x1f')];var _0xd00def;if(_0x2ea1eb>=_0x4986d3){_0x2ea1eb=_0x4986d3;_0xd00def=0xc8;}else{_0xd00def=0xce;}_0x313429[_0x389f('0x1d')](_0xd00def);return _0x313429['set'](_0x389f('0x23'),_0x4d29c2+'-'+_0x2ea1eb+'/'+_0x4986d3)['json'](_0x51f14e);}return null;};}function patchUpdates(_0x4a9ce2){return function(_0x5bbe79){try{jsonpatch[_0x389f('0x24')](_0x5bbe79,_0x4a9ce2,!![]);}catch(_0x581fd1){return BPromise[_0x389f('0x25')](_0x581fd1);}return _0x5bbe79[_0x389f('0x26')]();};}function saveUpdates(_0x471b23,_0x42645b){return function(_0x2444ba){if(_0x2444ba){return _0x2444ba[_0x389f('0x27')](_0x471b23)[_0x389f('0x28')](function(_0x2fcc62){return _0x2fcc62;});}return null;};}function removeEntity(_0x1722be,_0x4768db){return function(_0x35d156){if(_0x35d156){return _0x35d156[_0x389f('0x29')]()['then'](function(){var _0x3f2bf8=_0x35d156[_0x389f('0x2a')]({'plain':!![]});var _0x346bd2='Plugins';return db[_0x389f('0x2b')]['destroy']({'where':{'type':_0x346bd2,'resourceId':_0x3f2bf8['id']}})[_0x389f('0x28')](function(){return _0x35d156;});})[_0x389f('0x28')](function(){_0x1722be[_0x389f('0x1d')](0xcc)[_0x389f('0x1e')]();});}};}function handleEntityNotFound(_0x283c02,_0x39fd65){return function(_0x3a5099){if(!_0x3a5099){_0x283c02[_0x389f('0x1c')](0x194);}return _0x3a5099;};}function handleError(_0x1f91b0,_0xd10d32){_0xd10d32=_0xd10d32||0x1f4;return function(_0x230355){logger['error'](_0x230355[_0x389f('0x2c')]);if(_0x230355[_0x389f('0x2d')]){delete _0x230355[_0x389f('0x2d')];}_0x1f91b0[_0x389f('0x1d')](_0xd10d32)[_0x389f('0x2e')](_0x230355);};}exports[_0x389f('0x2f')]=function(_0x3a79ff,_0x1e54c9){var _0x9fddc={},_0xdf2a80={},_0x432809={'count':0x0,'rows':[]};var _0x1fb9d9=_['map'](db[_0x389f('0x30')][_0x389f('0x31')],function(_0xa20c6c){return{'name':_0xa20c6c[_0x389f('0x32')],'type':_0xa20c6c['type'][_0x389f('0x33')]};});_0xdf2a80['model']=_[_0x389f('0x34')](_0x1fb9d9,'name');_0xdf2a80['query']=_[_0x389f('0x35')](_0x3a79ff[_0x389f('0x36')]);_0xdf2a80[_0x389f('0x37')]=_[_0x389f('0x38')](_0xdf2a80[_0x389f('0x39')],_0xdf2a80[_0x389f('0x36')]);_0x9fddc[_0x389f('0x3a')]=_[_0x389f('0x38')](_0xdf2a80['model'],qs[_0x389f('0x3b')](_0x3a79ff[_0x389f('0x36')][_0x389f('0x3b')]));_0x9fddc[_0x389f('0x3a')]=_0x9fddc['attributes'][_0x389f('0x3c')]?_0x9fddc[_0x389f('0x3a')]:_0xdf2a80[_0x389f('0x39')];if(!_0x3a79ff[_0x389f('0x36')][_0x389f('0x3d')](_0x389f('0x3e'))){_0x9fddc[_0x389f('0x1f')]=qs[_0x389f('0x1f')](_0x3a79ff[_0x389f('0x36')][_0x389f('0x1f')]);_0x9fddc[_0x389f('0x21')]=qs[_0x389f('0x21')](_0x3a79ff[_0x389f('0x36')][_0x389f('0x21')]);}_0x9fddc[_0x389f('0x3f')]=qs[_0x389f('0x40')](_0x3a79ff[_0x389f('0x36')]['sort']);_0x9fddc['where']=qs[_0x389f('0x37')](_['pick'](_0x3a79ff[_0x389f('0x36')],_0xdf2a80['filters']),_0x1fb9d9);if(_0x3a79ff['query'][_0x389f('0x41')]){_0x9fddc['where']=_[_0x389f('0x42')](_0x9fddc[_0x389f('0x43')],{'$or':_[_0x389f('0x34')](_0x1fb9d9,function(_0x90d173){if(_0x90d173[_0x389f('0x44')]!==_0x389f('0x45')){var _0x6e3b78={};_0x6e3b78[_0x90d173[_0x389f('0x2d')]]={'$like':'%'+_0x3a79ff[_0x389f('0x36')][_0x389f('0x41')]+'%'};return _0x6e3b78;}})});}_0x9fddc=_['merge']({},_0x9fddc,_0x3a79ff[_0x389f('0x46')]);var _0x5844ab={'where':_0x9fddc[_0x389f('0x43')]};return db[_0x389f('0x30')][_0x389f('0x22')](_0x5844ab)[_0x389f('0x28')](function(_0x541504){_0x432809[_0x389f('0x22')]=_0x541504;if(_0x3a79ff[_0x389f('0x36')][_0x389f('0x47')]){_0x9fddc[_0x389f('0x48')]=[{'all':!![]}];}return db[_0x389f('0x30')][_0x389f('0x49')](_0x9fddc);})[_0x389f('0x28')](function(_0x5b6b06){_0x432809[_0x389f('0x4a')]=_0x5b6b06;return _0x432809;})[_0x389f('0x28')](respondWithFilteredResult(_0x1e54c9,_0x9fddc))[_0x389f('0x4b')](handleError(_0x1e54c9,null));};exports[_0x389f('0x4c')]=function(_0x359404,_0x30903d){var _0x4c2e72={'raw':!![],'where':{'id':_0x359404[_0x389f('0x4d')]['id']}},_0x1e1810={};_0x1e1810['model']=_['keys'](db['Plugin'][_0x389f('0x31')]);_0x1e1810[_0x389f('0x36')]=_[_0x389f('0x35')](_0x359404[_0x389f('0x36')]);_0x1e1810[_0x389f('0x37')]=_[_0x389f('0x38')](_0x1e1810[_0x389f('0x39')],_0x1e1810[_0x389f('0x36')]);_0x4c2e72[_0x389f('0x3a')]=_[_0x389f('0x38')](_0x1e1810['model'],qs['fields'](_0x359404['query'][_0x389f('0x3b')]));_0x4c2e72['attributes']=_0x4c2e72['attributes'][_0x389f('0x3c')]?_0x4c2e72['attributes']:_0x1e1810['model'];if(_0x359404['query'][_0x389f('0x47')]){_0x4c2e72[_0x389f('0x48')]=[{'all':!![]}];}_0x4c2e72=_[_0x389f('0x42')]({},_0x4c2e72,_0x359404['options']);return db[_0x389f('0x30')][_0x389f('0x4e')](_0x4c2e72)[_0x389f('0x28')](handleEntityNotFound(_0x30903d,null))[_0x389f('0x28')](respondWithResult(_0x30903d,null))[_0x389f('0x4b')](handleError(_0x30903d,null));};exports[_0x389f('0x4f')]=function(_0x4735d1,_0x473c3d,_0x50c6e9){return db[_0x389f('0x30')]['find']({'where':{'id':_0x4735d1[_0x389f('0x4d')]['id']},'attributes':['name',_0x389f('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x473c3d,null))[_0x389f('0x28')](function(_0x3b90b8){if(_0x3b90b8){var _0x133621=path[_0x389f('0x50')](config[_0x389f('0x51')],_0x389f('0x52'),util['format'](_0x389f('0x53'),path[_0x389f('0x54')](_0x3b90b8[_0x389f('0x7')])));var _0x34f090=fs[_0x389f('0x55')](_0x133621);var _0x465e8d=archiver(_0x389f('0x56'),{'zlib':{'level':0x9}});_0x465e8d['on'](_0x389f('0x57'),function(_0xa137b7){if(_0xa137b7['code']===_0x389f('0x58')){logger[_0x389f('0x59')](_0xa137b7);}else{throw new db['Sequelize'][(_0x389f('0x5a'))](_0x389f('0x5b'));}});_0x465e8d['on'](_0x389f('0x59'),function(_0x1944a5){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x465e8d[_0x389f('0x5c')](_0x34f090);_0x465e8d[_0x389f('0x5d')](_0x389f('0x5e'),{'cwd':path['join'](config[_0x389f('0x51')],_0x389f('0x52'),path[_0x389f('0x5f')](_0x3b90b8['path'])),'ignore':[path['join'](path[_0x389f('0x54')](_0x3b90b8[_0x389f('0x7')]),_0x389f('0x60')),path[_0x389f('0x50')](path[_0x389f('0x54')](_0x3b90b8[_0x389f('0x7')]),_0x389f('0x61'))],'nodir':!![]})[_0x389f('0x62')]();_0x34f090['on'](_0x389f('0x63'),function(){if(!fs['existsSync'](_0x133621)){throw new db[(_0x389f('0x64'))][(_0x389f('0x5a'))](_0x389f('0x65'));}return _0x473c3d[_0x389f('0x4f')](_0x133621,util['format'](_0x389f('0x53'),path[_0x389f('0x54')](_0x3b90b8[_0x389f('0x7')])),function(_0x506190){if(_0x506190){throw new db['Sequelize']['Error'](_0x389f('0x66'));}fs[_0x389f('0x67')](_0x133621);logger[_0x389f('0x68')](_0x389f('0x69'));logger['info'](_0x389f('0x6a'));});});}return null;})[_0x389f('0x4b')](handleError(_0x473c3d,null));};exports[_0x389f('0x6b')]=function(_0x15354a,_0x38ef4a,_0x20409f){var _0x55f09c=path[_0x389f('0x54')](_0x15354a['file'][_0x389f('0x6c')],path[_0x389f('0x6d')](_0x15354a[_0x389f('0x6e')][_0x389f('0x6c')]));var _0x2f4176=path[_0x389f('0x50')](config[_0x389f('0x51')],'server/files/plugins',_0x15354a[_0x389f('0x6e')][_0x389f('0x6c')]);var _0x426403=path['join'](config[_0x389f('0x51')],_0x389f('0x52'),_0x55f09c);logger[_0x389f('0x68')]('Plugin\x20upload\x20filepath:\x20%s',_0x2f4176);logger[_0x389f('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x426403);try{fs[_0x389f('0x6f')](_0x2f4176,parseInt(_0x389f('0x70'),0x8));extract(_0x2f4176,{'dir':_0x426403},function(_0x29ce49){if(_0x29ce49){logger['error'](_0x29ce49);handleError(_0x29ce49,!![]);};var _0x13eb32=fs['readdirSync'](_0x426403);if(_0x13eb32['length']>0x1){removeReferences(_0x2f4176,_0x426403);logger[_0x389f('0x59')](_0x389f('0x71'));return _0x20409f(new Error(_0x389f('0x71')));}var _0x252d4a=fs['lstatSync'](path['join'](_0x426403,_0x13eb32[0x0]));if(_0x252d4a[_0x389f('0x72')]()){removeReferences(_0x2f4176,_0x426403);logger[_0x389f('0x59')](_0x389f('0x71'));return _0x20409f(new Error(_0x389f('0x71')));}if(_0x252d4a[_0x389f('0x73')]()){var _0x33c62=fs[_0x389f('0x74')](path[_0x389f('0x50')](_0x426403,_0x13eb32[0x0]));if(_0x33c62['length']===0x0){removeReferences(_0x2f4176,_0x426403);logger['error'](_0x389f('0x71'));return _0x20409f(new Error(_0x389f('0x71')));}var _0x402561=_0x33c62[_0x389f('0x75')](function(_0x2d0b51){return _0x2d0b51===_0x389f('0x76');});if(!_0x402561){return _0x20409f(new Error('Plugin\x20manifest\x20missing'));}var _0x2c6456=fs['readFileSync'](path[_0x389f('0x50')](_0x426403,_0x13eb32[0x0],_0x389f('0x76')));var _0x276413=JSON[_0x389f('0x77')](_0x2c6456);if(_0x389f('0x20')==typeof _0x276413['name']){return _0x20409f(new Error(_0x389f('0x78')));}if('undefined'==typeof _0x276413['type']){return _0x20409f(new Error(_0x389f('0x79')));}if(_0x389f('0x20')==typeof _0x276413['version']){return _0x20409f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x389f('0x20')==typeof _0x276413[_0x389f('0x7a')]){return _0x20409f(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x276413[_0x389f('0x44')]===_0x389f('0x7b')){if(_0x389f('0x20')==typeof _0x276413[_0x389f('0x7a')][_0x389f('0x7c')]){return _0x20409f(new Error(_0x389f('0x7d')));}if(_0x389f('0x20')==typeof _0x276413[_0x389f('0x7a')]['views'][_0x389f('0x7e')]&&'undefined'==typeof _0x276413[_0x389f('0x7a')]['views'][_0x389f('0x7f')]){return _0x20409f(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x276413[_0x389f('0x44')]===_0x389f('0x80')){if('undefined'==typeof _0x276413[_0x389f('0x7a')][_0x389f('0x81')]){return _0x20409f(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x276413[_0x389f('0x7a')][_0x389f('0x82')]){return _0x20409f(new Error(_0x389f('0x83')));}}else{return _0x20409f(new Error(_0x389f('0x84')));}var _0x5b7bf3=_0x276413[_0x389f('0x2d')];var _0x501c5c=_0x276413[_0x389f('0x85')];var _0x3a977e=_0x276413[_0x389f('0x44')];var _0x1074e9=_0x276413['sidebar']?_0x276413['sidebar']:'always';var _0x501e4f=_0x276413[_0x389f('0x86')]?_0x276413['icon']:_0x389f('0x87');var _0x505289='';var _0x538464='';var _0x7b7c33='';var _0x225e14='';var _0x526db8=_0x276413['version'];if(_0x3a977e===_0x389f('0x7b')){if('undefined'!=typeof _0x276413[_0x389f('0x7a')]['views'][_0x389f('0x7e')]){var _0x19ab26=_0x276413[_0x389f('0x7a')][_0x389f('0x7c')][_0x389f('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x389f('0x88')](_0x19ab26)){_0x505289=path['join'](_0x389f('0x89'),_0x55f09c,_0x13eb32[0x0],_0x19ab26);}else{_0x505289=_0x19ab26;}}else{logger[_0x389f('0x68')](_0x389f('0x8a'));}if(_0x389f('0x20')!=typeof _0x276413[_0x389f('0x7a')][_0x389f('0x7c')][_0x389f('0x7f')]){var _0x425dc5=_0x276413[_0x389f('0x7a')][_0x389f('0x7c')][_0x389f('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x425dc5)){_0x538464=path['join'](_0x389f('0x89'),_0x55f09c,_0x13eb32[0x0],_0x425dc5);}else{_0x538464=_0x425dc5;}}else{logger[_0x389f('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x3a977e==='script'){_0x7b7c33=_0x276413[_0x389f('0x7a')]['scriptName'];_0x225e14=_0x276413['parameters']['scriptPath'];if('undefined'!=typeof _0x276413[_0x389f('0x7a')][_0x389f('0x7c')]){if('undefined'!=typeof _0x276413['parameters']['views'][_0x389f('0x7e')]){var _0x19ab26=_0x276413[_0x389f('0x7a')][_0x389f('0x7c')][_0x389f('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x19ab26)){_0x505289=path['join'](_0x389f('0x89'),_0x55f09c,_0x13eb32[0x0],_0x19ab26);}else{_0x505289=_0x19ab26;}}if(_0x389f('0x20')!=typeof _0x276413[_0x389f('0x7a')]['views'][_0x389f('0x7f')]){var _0x425dc5=_0x276413[_0x389f('0x7a')][_0x389f('0x7c')][_0x389f('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x389f('0x88')](_0x425dc5)){_0x538464=path[_0x389f('0x50')](_0x389f('0x89'),_0x55f09c,_0x13eb32[0x0],_0x425dc5);}else{_0x538464=_0x425dc5;}}}}var _0x437bac={'name':_0x5b7bf3,'description':_0x501c5c,'path':path[_0x389f('0x50')](_0x55f09c,_0x13eb32[0x0]),'type':_0x3a977e,'sidebar':_0x1074e9,'icon':_0x501e4f,'adminUrl':_0x505289,'agentUrl':_0x538464,'scriptName':_0x7b7c33,'scriptPath':_0x225e14,'version':_0x526db8};removeReferences(_0x2f4176,null);return db[_0x389f('0x30')]['create'](_0x437bac)[_0x389f('0x28')](function(_0x2f320a){var _0x42bd9b={'role':_0x15354a[_0x389f('0x8b')]['role'],'userProfileId':_0x15354a[_0x389f('0x8b')][_0x389f('0x8c')]};if(!_0x42bd9b)throw new Error(_0x389f('0x8d'));if(_0x42bd9b[_0x389f('0x8e')]==='user'){var _0xd92031=_0x2f320a[_0x389f('0x2a')]({'plain':!![]});return db[_0x389f('0x8f')]['find']({'where':{'name':_0x389f('0x90'),'userProfileId':_0x42bd9b[_0x389f('0x8c')]},'raw':!![]})[_0x389f('0x28')](function(_0x543391){if(_0x543391&&_0x543391[_0x389f('0x91')]===0x0){return db[_0x389f('0x2b')][_0x389f('0x92')]({'name':_0xd92031['name'],'resourceId':_0xd92031['id'],'type':_0x543391[_0x389f('0x2d')],'sectionId':_0x543391['id']},{})[_0x389f('0x28')](function(){return _0x2f320a;});}else{return _0x2f320a;}})['catch'](function(_0x21b1ac){logger[_0x389f('0x59')](_0x389f('0x93'),_0x21b1ac);throw _0x21b1ac;});}return _0x2f320a;})['then'](respondWithResult(_0x38ef4a,null))[_0x389f('0x4b')](handleError(_0x38ef4a,null));}});}catch(_0x44477a){_0x38ef4a[_0x389f('0x1d')](0x1f4)[_0x389f('0x2e')](_0x44477a);}};function removeReferences(_0x1aabd3,_0x19aa8a){try{if(_0x1aabd3){fs[_0x389f('0x67')](_0x1aabd3);logger[_0x389f('0x68')](_0x389f('0x94'));}if(_0x19aa8a){rimraf(_0x19aa8a,function(){});logger['info'](_0x389f('0x95'));}}catch(_0x4d6f70){logger[_0x389f('0x59')](_0x4d6f70);}}exports[_0x389f('0x27')]=function(_0x2f2143,_0x33fdef,_0x3eebd5){return db['Plugin'][_0x389f('0x4e')]({'where':{'id':_0x2f2143[_0x389f('0x4d')]['id']}})[_0x389f('0x28')](handleEntityNotFound(_0x33fdef,null))[_0x389f('0x28')](saveUpdates(_0x2f2143['body'],null))[_0x389f('0x28')](respondWithResult(_0x33fdef,null))[_0x389f('0x4b')](handleError(_0x33fdef,null));};exports[_0x389f('0x96')]=function(_0x50bb1c,_0x2bd2f5,_0xe1fca1){return db[_0x389f('0x30')]['find']({'where':{'id':_0x50bb1c[_0x389f('0x4d')]['id']}})[_0x389f('0x28')](function(_0x5da5a9){if(_0x5da5a9){return _0x5da5a9[_0x389f('0x29')]();}})[_0x389f('0x28')](function(_0x339f4d){rimraf(path[_0x389f('0x50')](config[_0x389f('0x51')],_0x389f('0x52'),path[_0x389f('0x5f')](_0x339f4d['path'])),function(){});return _0x339f4d;})[_0x389f('0x28')](handleEntityNotFound(_0x2bd2f5,null))[_0x389f('0x28')](respondWithStatusCode(_0x2bd2f5,null))['catch'](handleError(_0x2bd2f5,null));};exports['webhookGet']=function(_0x5620ec,_0x39fafa,_0x50d1eb){return BPromise[_0x389f('0x97')]()[_0x389f('0x28')](function(){if(!_0x5620ec['query'][_0x389f('0x7')]){throw new Error(_0x389f('0x98'));}if(!_0x5620ec[_0x389f('0x36')][_0x389f('0x99')]){throw new Error(_0x389f('0x9a'));}var _0x39f776=_0x5620ec['query']['hostname']?_0x5620ec['query'][_0x389f('0x9b')]+':'+_0x5620ec['query'][_0x389f('0x99')]:'http://localhost:'+_0x5620ec[_0x389f('0x36')]['port'];var _0x502a3e=_0x5620ec[_0x389f('0x36')]['json']?_0x5620ec[_0x389f('0x36')]['json']:!![];var _0x3a31af=_0x5620ec['query'][_0x389f('0x9c')]?_0x5620ec[_0x389f('0x36')][_0x389f('0x9c')]:null;var _0x4b2074={'method':_0x5620ec[_0x389f('0x9d')],'uri':util[_0x389f('0x9e')](_0x389f('0x9f'),_0x39f776,_0x5620ec[_0x389f('0x36')][_0x389f('0x7')]),'json':_0x502a3e,'resolveWithFullResponse':!![],'encoding':_0x3a31af,'qs':_0x5620ec['query']};if(_0x5620ec[_0x389f('0xa0')]){_0x4b2074[_0x389f('0xa0')]=_0x5620ec[_0x389f('0xa0')];if(_0x4b2074[_0x389f('0xa0')][_0x389f('0xa1')]){delete _0x4b2074['headers'][_0x389f('0xa1')];}}if(_0x4b2074[_0x389f('0xa0')][_0x389f('0xa2')]){delete _0x4b2074[_0x389f('0xa0')][_0x389f('0xa2')];}return rp(_0x4b2074);})[_0x389f('0x28')](function(_0x1c16e3){if(_0x1c16e3){_0x39fafa[_0x389f('0xa3')](_0x1c16e3[_0x389f('0xa0')]);logger[_0x389f('0x68')](_0x1c16e3[_0x389f('0x8b')]);if(_[_0x389f('0xa4')](_0x5620ec[_0x389f('0x36')][_0x389f('0x7')],_0x389f('0x4f'))&&_0x1c16e3[_0x389f('0xa5')]==0x1f4){return _0x39fafa[_0x389f('0x1c')](_0x1c16e3['statusCode']);}else{return _0x39fafa[_0x389f('0x1d')](_0x1c16e3[_0x389f('0xa5')])['send'](_0x1c16e3['body']);}}else{return _0x39fafa[_0x389f('0x1c')](0xc8);}})[_0x389f('0x4b')](handleError(_0x39fafa,null));};exports[_0x389f('0xa6')]=function(_0x4560b2,_0x2c5e1f,_0x3fba7a){return BPromise[_0x389f('0x97')]()[_0x389f('0x28')](function(){if(!_0x4560b2[_0x389f('0x36')][_0x389f('0x7')]){throw new Error(_0x389f('0x98'));}if(!_0x4560b2[_0x389f('0x36')][_0x389f('0x99')]){throw new Error(_0x389f('0x9a'));}var _0x27061d=_0x4560b2['query']['hostname']?_0x4560b2[_0x389f('0x36')][_0x389f('0x9b')]+':'+_0x4560b2['query'][_0x389f('0x99')]:'http://localhost:'+_0x4560b2['query'][_0x389f('0x99')];var _0xf45206=_0x4560b2['query']['json']?_0x4560b2[_0x389f('0x36')][_0x389f('0xa7')]:!![];var _0x30ce06=_0x4560b2[_0x389f('0x36')][_0x389f('0x9c')]?_0x4560b2[_0x389f('0x36')][_0x389f('0x9c')]:null;var _0x41a0b7={'method':_0x4560b2[_0x389f('0x9d')],'uri':util[_0x389f('0x9e')]('%s%s',_0x27061d,_0x4560b2[_0x389f('0x36')]['path']),'json':_0xf45206,'resolveWithFullResponse':!![],'encoding':_0x30ce06,'body':_0x4560b2[_0x389f('0x8b')]};if(_0x4560b2['headers']){_0x41a0b7[_0x389f('0xa0')]=_0x4560b2[_0x389f('0xa0')];if(_0x41a0b7[_0x389f('0xa0')]['content-length']){delete _0x41a0b7[_0x389f('0xa0')][_0x389f('0xa1')];}}if(_0x41a0b7[_0x389f('0xa0')]['content-type']){delete _0x41a0b7[_0x389f('0xa0')][_0x389f('0xa2')];}return rp(_0x41a0b7);})[_0x389f('0x28')](function(_0x45fbef){if(_0x45fbef){_0x2c5e1f['set'](_0x45fbef[_0x389f('0xa0')]);logger[_0x389f('0x68')](_0x45fbef['body']);return _0x2c5e1f[_0x389f('0x1d')](_0x45fbef[_0x389f('0xa5')])[_0x389f('0x2e')](_0x45fbef['body']);}else{return _0x2c5e1f[_0x389f('0x1c')](0xc8);}})[_0x389f('0x4b')](handleError(_0x2c5e1f,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6a5577b..2d97f53 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 _0xfdcd=['Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x316215,_0x32aabe){var _0x4e974f=function(_0x417224){while(--_0x417224){_0x316215['push'](_0x316215['shift']());}};_0x4e974f(++_0x32aabe);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xdfdc('0x0'))['db'][_0xdfdc('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xdfdc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdfdc('0x3'),'afterDestroy':_0xdfdc('0x4')};function emitEvent(_0x274740){return function(_0x789311,_0x453c75,_0x349d57){PluginEvents[_0xdfdc('0x5')](_0x274740+':'+_0x789311['id'],_0x789311);PluginEvents[_0xdfdc('0x5')](_0x274740,_0x789311);_0x349d57(null);};}for(var e in events){if(events[_0xdfdc('0x6')](e)){var event=events[e];Plugin[_0xdfdc('0x7')](e,emitEvent(event));}}module[_0xdfdc('0x8')]=PluginEvents; \ No newline at end of file +var _0x2d95=['emit','hasOwnProperty','hook','exports','events','Plugin','save','update','remove'];(function(_0x247c5b,_0xc6ed5e){var _0x2ab0df=function(_0x40d14e){while(--_0x40d14e){_0x247c5b['push'](_0x247c5b['shift']());}};_0x2ab0df(++_0xc6ed5e);}(_0x2d95,0xca));var _0x52d9=function(_0x24d3bc,_0x221744){_0x24d3bc=_0x24d3bc-0x0;var _0xba5d70=_0x2d95[_0x24d3bc];return _0xba5d70;};'use strict';var EventEmitter=require(_0x52d9('0x0'));var Plugin=require('../../mysqldb')['db'][_0x52d9('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x52d9('0x2'),'afterUpdate':_0x52d9('0x3'),'afterDestroy':_0x52d9('0x4')};function emitEvent(_0x52750b){return function(_0x323dcd,_0x7aff8f,_0x38acb9){PluginEvents[_0x52d9('0x5')](_0x52750b+':'+_0x323dcd['id'],_0x323dcd);PluginEvents[_0x52d9('0x5')](_0x52750b,_0x323dcd);_0x38acb9(null);};}for(var e in events){if(events[_0x52d9('0x6')](e)){var event=events[e];Plugin[_0x52d9('0x7')](e,emitEvent(event));}}module[_0x52d9('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c1c829c..4a05a03 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 _0x1320=['moment','bluebird','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash','util','../../config/logger','api'];(function(_0x92713a,_0x68f8b0){var _0x1893e1=function(_0xe49768){while(--_0xe49768){_0x92713a['push'](_0x92713a['shift']());}};_0x1893e1(++_0x68f8b0);}(_0x1320,0x128));var _0x0132=function(_0x714a8d,_0x32672a){_0x714a8d=_0x714a8d-0x0;var _0x3f07ac=_0x1320[_0x714a8d];return _0x3f07ac;};'use strict';var _=require(_0x0132('0x0'));var util=require(_0x0132('0x1'));var logger=require(_0x0132('0x2'))(_0x0132('0x3'));var moment=require(_0x0132('0x4'));var BPromise=require(_0x0132('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0132('0x6'));var config=require(_0x0132('0x7'));var attributes=require(_0x0132('0x8'));module[_0x0132('0x9')]=function(_0x1a2a51,_0x34408b){return _0x1a2a51['define'](_0x0132('0xa'),attributes,{'tableName':_0x0132('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x251b=['api','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','plugins','lodash','util'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x251b,0x1e2));var _0xb251=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x251b[_0x11155f];return _0xd07e48;};'use strict';var _=require(_0xb251('0x0'));var util=require(_0xb251('0x1'));var logger=require('../../config/logger')(_0xb251('0x2'));var moment=require('moment');var BPromise=require(_0xb251('0x3'));var rp=require(_0xb251('0x4'));var fs=require('fs');var path=require(_0xb251('0x5'));var rimraf=require(_0xb251('0x6'));var config=require('../../config/environment');var attributes=require(_0xb251('0x7'));module[_0xb251('0x8')]=function(_0x131a2c,_0x2eab2e){return _0x131a2c[_0xb251('0x9')]('Plugin',attributes,{'tableName':_0xb251('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 c2f7096..fd4c78b 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 _0xa0b2=['Plugin,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','stringify','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./plugin.socket','register','request','then','info'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa0b2,0x14f));var _0x2a0b=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0xa0b2[_0x15cdcb];return _0x37b069;};'use strict';var _=require(_0x2a0b('0x0'));var util=require(_0x2a0b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a0b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a0b('0x3'));var logger=require(_0x2a0b('0x4'))(_0x2a0b('0x5'));var config=require(_0x2a0b('0x6'));var jayson=require(_0x2a0b('0x7'));var client=jayson[_0x2a0b('0x8')][_0x2a0b('0x9')]({'port':0x232a});config[_0x2a0b('0xa')]=_['defaults'](config[_0x2a0b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a0b('0xb'))(new Redis(config[_0x2a0b('0xa')]));require(_0x2a0b('0xc'))[_0x2a0b('0xd')](socket);function respondWithRpcPromise(_0x4738d5,_0x14b0c5,_0x5dfdbd){return new BPromise(function(_0x4f9c12,_0x7f646a){return client[_0x2a0b('0xe')](_0x4738d5,_0x5dfdbd)[_0x2a0b('0xf')](function(_0x618919){logger[_0x2a0b('0x10')](_0x2a0b('0x11'),_0x14b0c5,_0x2a0b('0x12'));logger[_0x2a0b('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x14b0c5,_0x2a0b('0x12'),JSON['stringify'](_0x618919));if(_0x618919[_0x2a0b('0x14')]){if(_0x618919['error'][_0x2a0b('0x15')]===0x1f4){logger[_0x2a0b('0x14')](_0x2a0b('0x11'),_0x14b0c5,_0x618919[_0x2a0b('0x14')][_0x2a0b('0x16')]);return _0x7f646a(_0x618919[_0x2a0b('0x14')]['message']);}logger[_0x2a0b('0x14')]('Plugin,\x20%s,\x20%s',_0x14b0c5,_0x618919[_0x2a0b('0x14')]['message']);return _0x4f9c12(_0x618919[_0x2a0b('0x14')][_0x2a0b('0x16')]);}else{logger[_0x2a0b('0x10')](_0x2a0b('0x11'),_0x14b0c5,_0x2a0b('0x12'));_0x4f9c12(_0x618919[_0x2a0b('0x17')][_0x2a0b('0x16')]);}})[_0x2a0b('0x18')](function(_0x4e0bd8){logger['error']('Plugin,\x20%s,\x20%s',_0x14b0c5,_0x4e0bd8);_0x7f646a(_0x4e0bd8);});});}exports[_0x2a0b('0x19')]=function(_0x4dee3c){var _0x56a1b5=this;return new Promise(function(_0x239986,_0x300829){return db[_0x2a0b('0x1a')][_0x2a0b('0x1b')](_0x4dee3c[_0x2a0b('0x1c')],{'raw':_0x4dee3c[_0x2a0b('0x1d')]?_0x4dee3c[_0x2a0b('0x1d')][_0x2a0b('0x1e')]===undefined?!![]:![]:!![]})[_0x2a0b('0xf')](function(_0x4f317e){logger[_0x2a0b('0x10')](_0x2a0b('0x19'),_0x4dee3c);logger[_0x2a0b('0x13')]('CreatePlugin',_0x4dee3c,JSON[_0x2a0b('0x1f')](_0x4f317e));_0x239986(_0x4f317e);})['catch'](function(_0x251741){logger[_0x2a0b('0x14')](_0x2a0b('0x19'),_0x251741['message'],_0x4dee3c);_0x300829(_0x56a1b5[_0x2a0b('0x14')](0x1f4,_0x251741[_0x2a0b('0x16')]));});});}; \ No newline at end of file +var _0x9f3b=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreatePlugin','Plugin','create','body','options','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register'];(function(_0x9666b8,_0x2aa126){var _0x30de06=function(_0x1e56ae){while(--_0x1e56ae){_0x9666b8['push'](_0x9666b8['shift']());}};_0x30de06(++_0x2aa126);}(_0x9f3b,0x184));var _0xb9f3=function(_0x54cd98,_0x3029e6){_0x54cd98=_0x54cd98-0x0;var _0x4abd09=_0x9f3b[_0x54cd98];return _0x4abd09;};'use strict';var _=require('lodash');var util=require(_0xb9f3('0x0'));var moment=require(_0xb9f3('0x1'));var BPromise=require(_0xb9f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9f3('0x4'));var logger=require(_0xb9f3('0x5'))(_0xb9f3('0x6'));var config=require(_0xb9f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9f3('0x8')][_0xb9f3('0x9')]({'port':0x232a});config[_0xb9f3('0xa')]=_['defaults'](config[_0xb9f3('0xa')],{'host':_0xb9f3('0xb'),'port':0x18eb});var socket=require(_0xb9f3('0xc'))(new Redis(config[_0xb9f3('0xa')]));require(_0xb9f3('0xd'))[_0xb9f3('0xe')](socket);function respondWithRpcPromise(_0x358110,_0x4369a5,_0x5415ee){return new BPromise(function(_0x7a7e4f,_0xfc20d2){return client['request'](_0x358110,_0x5415ee)[_0xb9f3('0xf')](function(_0x338602){logger[_0xb9f3('0x10')](_0xb9f3('0x11'),_0x4369a5,_0xb9f3('0x12'));logger[_0xb9f3('0x13')](_0xb9f3('0x14'),_0x4369a5,'request\x20sent',JSON[_0xb9f3('0x15')](_0x338602));if(_0x338602[_0xb9f3('0x16')]){if(_0x338602['error'][_0xb9f3('0x17')]===0x1f4){logger[_0xb9f3('0x16')](_0xb9f3('0x11'),_0x4369a5,_0x338602['error'][_0xb9f3('0x18')]);return _0xfc20d2(_0x338602[_0xb9f3('0x16')]['message']);}logger[_0xb9f3('0x16')](_0xb9f3('0x11'),_0x4369a5,_0x338602[_0xb9f3('0x16')][_0xb9f3('0x18')]);return _0x7a7e4f(_0x338602[_0xb9f3('0x16')][_0xb9f3('0x18')]);}else{logger[_0xb9f3('0x10')](_0xb9f3('0x11'),_0x4369a5,'request\x20sent');_0x7a7e4f(_0x338602[_0xb9f3('0x19')]['message']);}})['catch'](function(_0x588d1a){logger[_0xb9f3('0x16')](_0xb9f3('0x11'),_0x4369a5,_0x588d1a);_0xfc20d2(_0x588d1a);});});}exports[_0xb9f3('0x1a')]=function(_0x49fa1d){var _0x5a9df1=this;return new Promise(function(_0x23ef20,_0x1d4d5e){return db[_0xb9f3('0x1b')][_0xb9f3('0x1c')](_0x49fa1d[_0xb9f3('0x1d')],{'raw':_0x49fa1d[_0xb9f3('0x1e')]?_0x49fa1d[_0xb9f3('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xb9f3('0xf')](function(_0x297af5){logger[_0xb9f3('0x10')](_0xb9f3('0x1a'),_0x49fa1d);logger[_0xb9f3('0x13')](_0xb9f3('0x1a'),_0x49fa1d,JSON[_0xb9f3('0x15')](_0x297af5));_0x23ef20(_0x297af5);})['catch'](function(_0xfab084){logger[_0xb9f3('0x16')](_0xb9f3('0x1a'),_0xfab084[_0xb9f3('0x18')],_0x49fa1d);_0x1d4d5e(_0x5a9df1['error'](0x1f4,_0xfab084[_0xb9f3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 793adf3..965f4a7 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 _0xa62f=['remove','update','removeListener','register','plugin:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa62f,0xef));var _0xfa62=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa62f[_0x1ac595];return _0x455fff;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xfa62('0x0'),_0xfa62('0x1'),_0xfa62('0x2')];function createListener(_0x4a4212,_0x4c62ed){return function(_0x3aa8ed){_0x4c62ed['emit'](_0x4a4212,_0x3aa8ed);};}function removeListener(_0x19548e,_0x1efd37){return function(){PluginEvents[_0xfa62('0x3')](_0x19548e,_0x1efd37);};}exports[_0xfa62('0x4')]=function(_0x20ddd6){for(var _0x3943ee=0x0,_0x3ab7b1=events['length'];_0x3943ee<_0x3ab7b1;_0x3943ee++){var _0x12e3ca=events[_0x3943ee];var _0x510afe=createListener(_0xfa62('0x5')+_0x12e3ca,_0x20ddd6);PluginEvents['on'](_0x12e3ca,_0x510afe);}}; \ No newline at end of file +var _0x6826=['plugin:','./plugin.events','remove','update','emit','removeListener','register','length'];(function(_0x15073c,_0x5ad56e){var _0x2c4636=function(_0x1502b6){while(--_0x1502b6){_0x15073c['push'](_0x15073c['shift']());}};_0x2c4636(++_0x5ad56e);}(_0x6826,0x149));var _0x6682=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0x6826[_0x4d7116];return _0x4593dc;};'use strict';var PluginEvents=require(_0x6682('0x0'));var events=['save',_0x6682('0x1'),_0x6682('0x2')];function createListener(_0x2d716e,_0x49d432){return function(_0x4ba05f){_0x49d432[_0x6682('0x3')](_0x2d716e,_0x4ba05f);};}function removeListener(_0x4fbb2b,_0x30b854){return function(){PluginEvents[_0x6682('0x4')](_0x4fbb2b,_0x30b854);};}exports[_0x6682('0x5')]=function(_0x40aebf){for(var _0x306de3=0x0,_0x2ae399=events[_0x6682('0x6')];_0x306de3<_0x2ae399;_0x306de3++){var _0x4876e0=events[_0x306de3];var _0x5e345a=createListener(_0x6682('0x7')+_0x4876e0,_0x40aebf);PluginEvents['on'](_0x4876e0,_0x5e345a);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 91af8be..a055d89 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(_0x2728de,_0x4e786f){var _0x451950=function(_0x120b38){while(--_0x120b38){_0x2728de['push'](_0x2728de['shift']());}};_0x451950(++_0x4e786f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 3141f50..fcec75a 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 _0xde2c=['start','dump','update','restart','stop','hasOwnProperty','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show','create','body','script','cwd','chdir','dirname'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xde2c,0x7f));var _0xcde2=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0xde2c[_0x53bcc3];return _0x47c959;};'use strict';var _=require(_0xcde2('0x0'));var pm2=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var path=require(_0xcde2('0x4'));var exec=require(_0xcde2('0x5'))[_0xcde2('0x6')];var BPromise=require(_0xcde2('0x7'));function handleEntityNotFound(_0x55c175,_0x4353c8){return function(_0x196898){if(!_0x196898){_0x55c175[_0xcde2('0x8')](0x194);;}return _0x196898;};}function respondWithResult(_0x1398de,_0x401b16){_0x401b16=_0x401b16||0xc8;return function(_0x53c558){if(_0x53c558){return _0x1398de[_0xcde2('0x9')](_0x401b16)[_0xcde2('0xa')](_0x53c558);}return null;};}function handleError(_0x9c7036,_0x544235){_0x544235=_0x544235||0x1f4;return function(_0x582a6c){logger[_0xcde2('0xb')](_0x582a6c[_0xcde2('0xc')]);if(_0x582a6c['name']){delete _0x582a6c[_0xcde2('0xd')];}_0x9c7036[_0xcde2('0x9')](_0x544235)[_0xcde2('0xe')](_0x582a6c);};}function execChildProcess(){return new BPromise(function(_0x127358,_0x54b7c5){exec('npm\x20install',function(_0x25677f,_0x1bc697,_0x3b1333){logger[_0xcde2('0xf')](_0x1bc697);logger[_0xcde2('0xf')](_0x3b1333);if(_0x25677f){logger[_0xcde2('0xb')](_0x25677f);return _0x54b7c5(_0x25677f);}return _0x127358(_0x1bc697);});});}exports['index']=function(_0x211215,_0x577062){return pm2[_0xcde2('0x10')]()['then'](function(_0x4b0e0e){if(_0x4b0e0e){var _0x34e079=_[_0xcde2('0x11')](_0x4b0e0e,function(_0x417505){return _0x417505[_0xcde2('0xd')]===_0xcde2('0x12')||_0x417505['name']===_0xcde2('0x13');});return{'rows':_0x34e079,'count':_0x34e079['length']};}return null;})[_0xcde2('0x14')](respondWithResult(_0x577062,null))[_0xcde2('0x15')](handleError(_0x577062,null));};exports[_0xcde2('0x16')]=function(_0x1f1858,_0x5223f1){return pm2['describe'](_0x1f1858['params']['id'])[_0xcde2('0x14')](respondWithResult(_0x5223f1,null))['then'](handleEntityNotFound(_0x5223f1,null))[_0xcde2('0x15')](handleError(_0x5223f1,null));};exports[_0xcde2('0x17')]=function(_0x252372,_0x481fc0){if(_0x252372[_0xcde2('0x18')][_0xcde2('0xd')]&&_0x252372[_0xcde2('0x18')][_0xcde2('0x19')]){var _0x43df7a=path['join'](__dirname,'../../files/plugins',_0x252372['body'][_0xcde2('0x19')]);var _0x3e5170=process[_0xcde2('0x1a')]();process[_0xcde2('0x1b')](path[_0xcde2('0x1c')](_0x43df7a));return execChildProcess()['then'](function(_0x1104b8){process['chdir'](_0x3e5170);return pm2[_0xcde2('0x1d')]({'name':_0x252372[_0xcde2('0x18')][_0xcde2('0xd')],'script':_0x43df7a});})['then'](function(_0x593aa4){pm2[_0xcde2('0x1e')]();return _0x593aa4[0x0];})[_0xcde2('0x14')](respondWithResult(_0x481fc0,0xc9))[_0xcde2('0x15')](handleError(_0x481fc0,null));}else{return _0x481fc0[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xcde2('0x1f')]=function(_0x45275a,_0x1dce65){if(_0x45275a['body']['id']){delete _0x45275a[_0xcde2('0x18')]['id'];}var _0x348ca1={'online':_0xcde2('0x20'),'stopped':_0xcde2('0x21')};if(_0x348ca1[_0xcde2('0x22')](_0x45275a[_0xcde2('0x18')][_0xcde2('0x9')])){return pm2[_0x348ca1[_0x45275a[_0xcde2('0x18')]['status']]](_0x45275a[_0xcde2('0x23')]['id'])['then'](respondWithResult(_0x1dce65,0xc8))[_0xcde2('0x15')](handleError(_0x1dce65,null));}else{return _0x1dce65[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Unknown\x20status'});}};exports[_0xcde2('0x24')]=function(_0x28fedd,_0x58afb1){if(_0x28fedd[_0xcde2('0x18')]['id']){delete _0x28fedd[_0xcde2('0x18')]['id'];}if(_0x28fedd[_0xcde2('0x23')]['id']){return pm2[_0xcde2('0x25')](_0x28fedd[_0xcde2('0x23')]['id'])[_0xcde2('0x14')](function(_0x11b817){pm2[_0xcde2('0x1e')]();return _0x11b817[0x0];})['then'](respondWithResult(_0x58afb1,null))[_0xcde2('0x15')](handleError(_0x58afb1,null));}else{return _0x58afb1[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':_0xcde2('0x26')});}}; \ No newline at end of file +var _0x5b02=['../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','motion2','catch','show','describe','params','create','body','script','join'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x5b02,0xe9));var _0x25b0=function(_0x5eecc8,_0x4a2cc9){_0x5eecc8=_0x5eecc8-0x0;var _0x339f35=_0x5b02[_0x5eecc8];return _0x339f35;};'use strict';var _=require(_0x25b0('0x0'));var pm2=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var path=require('path');var exec=require('child_process')[_0x25b0('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3e1d20,_0x31c9c2){return function(_0x38dc14){if(!_0x38dc14){_0x3e1d20[_0x25b0('0x5')](0x194);;}return _0x38dc14;};}function respondWithResult(_0x2d84a9,_0x4eea55){_0x4eea55=_0x4eea55||0xc8;return function(_0x1d82c6){if(_0x1d82c6){return _0x2d84a9[_0x25b0('0x6')](_0x4eea55)['json'](_0x1d82c6);}return null;};}function handleError(_0x412954,_0x4d3e71){_0x4d3e71=_0x4d3e71||0x1f4;return function(_0x56feca){logger[_0x25b0('0x7')](_0x56feca[_0x25b0('0x8')]);if(_0x56feca[_0x25b0('0x9')]){delete _0x56feca['name'];}_0x412954[_0x25b0('0x6')](_0x4d3e71)[_0x25b0('0xa')](_0x56feca);};}function execChildProcess(){return new BPromise(function(_0x135afb,_0x250d31){exec(_0x25b0('0xb'),function(_0x2f57af,_0x44afbc,_0x10c3fb){logger[_0x25b0('0xc')](_0x44afbc);logger[_0x25b0('0xc')](_0x10c3fb);if(_0x2f57af){logger[_0x25b0('0x7')](_0x2f57af);return _0x250d31(_0x2f57af);}return _0x135afb(_0x44afbc);});});}exports[_0x25b0('0xd')]=function(_0x2048dc,_0x3655c2){return pm2[_0x25b0('0xe')]()[_0x25b0('0xf')](function(_0x293203){if(_0x293203){var _0x211658=_[_0x25b0('0x10')](_0x293203,function(_0x3b89e7){return _0x3b89e7[_0x25b0('0x9')]==='express'||_0x3b89e7['name']===_0x25b0('0x11');});return{'rows':_0x211658,'count':_0x211658['length']};}return null;})[_0x25b0('0xf')](respondWithResult(_0x3655c2,null))[_0x25b0('0x12')](handleError(_0x3655c2,null));};exports[_0x25b0('0x13')]=function(_0x3267b9,_0x5e3a3a){return pm2[_0x25b0('0x14')](_0x3267b9[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x5e3a3a,null))[_0x25b0('0xf')](handleEntityNotFound(_0x5e3a3a,null))[_0x25b0('0x12')](handleError(_0x5e3a3a,null));};exports[_0x25b0('0x16')]=function(_0x54f458,_0x348d36){if(_0x54f458[_0x25b0('0x17')][_0x25b0('0x9')]&&_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]){var _0xea4162=path[_0x25b0('0x19')](__dirname,_0x25b0('0x1a'),_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]);var _0x2b2eda=process[_0x25b0('0x1b')]();process['chdir'](path[_0x25b0('0x1c')](_0xea4162));return execChildProcess()[_0x25b0('0xf')](function(_0x517ec5){process[_0x25b0('0x1d')](_0x2b2eda);return pm2[_0x25b0('0x1e')]({'name':_0x54f458[_0x25b0('0x17')]['name'],'script':_0xea4162});})['then'](function(_0x50089e){pm2[_0x25b0('0x1f')]();return _0x50089e[0x0];})[_0x25b0('0xf')](respondWithResult(_0x348d36,0xc9))[_0x25b0('0x12')](handleError(_0x348d36,null));}else{return _0x348d36[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x20')});}};exports[_0x25b0('0x21')]=function(_0x75ce7a,_0x22e024){if(_0x75ce7a['body']['id']){delete _0x75ce7a[_0x25b0('0x17')]['id'];}var _0xbfba84={'online':'restart','stopped':'stop'};if(_0xbfba84['hasOwnProperty'](_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')])){return pm2[_0xbfba84[_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')]]](_0x75ce7a[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x22e024,0xc8))[_0x25b0('0x12')](handleError(_0x22e024,null));}else{return _0x22e024[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x22')});}};exports[_0x25b0('0x23')]=function(_0x3161c1,_0x1ea374){if(_0x3161c1['body']['id']){delete _0x3161c1['body']['id'];}if(_0x3161c1[_0x25b0('0x15')]['id']){return pm2['delete'](_0x3161c1['params']['id'])[_0x25b0('0xf')](function(_0x419975){pm2[_0x25b0('0x1f')]();return _0x419975[0x0];})[_0x25b0('0xf')](respondWithResult(_0x1ea374,null))[_0x25b0('0x12')](handleError(_0x1ea374,null));}else{return _0x1ea374['status'](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 432ed41..ec0b8aa 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 _0x9b72=['getQueues','exports','express','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x1e9ad5,_0x3c194e){var _0x54f703=function(_0x4cb3cd){while(--_0x4cb3cd){_0x1e9ad5['push'](_0x1e9ad5['shift']());}};_0x54f703(++_0x3c194e);}(_0x9b72,0x197));var _0x29b7=function(_0x15d82a,_0x24b726){_0x15d82a=_0x15d82a-0x0;var _0x232b2e=_0x9b72[_0x15d82a];return _0x232b2e;};'use strict';var express=require(_0x29b7('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x29b7('0x1'));router[_0x29b7('0x2')](_0x29b7('0x3'),auth[_0x29b7('0x4')](),controller[_0x29b7('0x5')]);router[_0x29b7('0x2')](_0x29b7('0x6'),auth['isAuthenticated'](),controller[_0x29b7('0x7')]);module[_0x29b7('0x8')]=router; \ No newline at end of file +var _0x6f3e=['getQueues','exports','express','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0x6f3e,0x12e));var _0xe6f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f3e[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xe6f3('0x0'));var router=express[_0xe6f3('0x1')]();var auth=require(_0xe6f3('0x2'));var controller=require('./realtime.controller');router[_0xe6f3('0x3')](_0xe6f3('0x4'),auth[_0xe6f3('0x5')](),controller[_0xe6f3('0x6')]);router[_0xe6f3('0x3')](_0xe6f3('0x7'),auth[_0xe6f3('0x5')](),controller[_0xe6f3('0x8')]);module[_0xe6f3('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 50d17b5..267428e 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 _0xca39=['undefined','limit','count','status','set','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','online','getOptions','push','sequelize','forEach','*pause','Pause','where','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','rows','find','merge','voiceStatus','talking','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','voice','dialActive','dialMethod','QueueCampaigns','Queues','filter','findAndCountAll','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset'];(function(_0x555788,_0x207c93){var _0x2ec89b=function(_0x376709){while(--_0x376709){_0x555788['push'](_0x555788['shift']());}};_0x2ec89b(++_0x207c93);}(_0xca39,0xf0));var _0x9ca3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xca39[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9ca3('0x0'));var util=require(_0x9ca3('0x1'));var rta=require(_0x9ca3('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x9ca3('0x3'));var utils=require(_0x9ca3('0x4'));var db=require(_0x9ca3('0x5'))['db'];var APIBadRequestError=require(_0x9ca3('0x6'))[_0x9ca3('0x7')];var APIHandleError=require(_0x9ca3('0x6'))['handleError'];function respondWithFilteredResult(_0x18e72b,_0x392cd2){return function(_0x772b6d){if(_0x772b6d){var _0x36bea6=typeof _0x392cd2[_0x9ca3('0x8')]===_0x9ca3('0x9')&&typeof _0x392cd2[_0x9ca3('0xa')]===_0x9ca3('0x9');var _0x10087f=_0x772b6d[_0x9ca3('0xb')];var _0x48555d=_0x36bea6?0x0:_0x392cd2['offset'];var _0x40b9e6=_0x36bea6?_0x772b6d[_0x9ca3('0xb')]:_0x392cd2[_0x9ca3('0x8')]+_0x392cd2[_0x9ca3('0xa')];var _0x43e976;if(_0x40b9e6>=_0x10087f){_0x40b9e6=_0x10087f;_0x43e976=0xc8;}else{_0x43e976=0xce;}_0x18e72b[_0x9ca3('0xc')](_0x43e976);return _0x18e72b[_0x9ca3('0xd')]('Content-Range',_0x48555d+'-'+_0x40b9e6+'/'+_0x10087f)['json'](_0x772b6d);}return null;};}exports[_0x9ca3('0xe')]=function(_0x107af2,_0x4919db){var _0x154d94={'count':0x0,'rows':[]};var _0x2ee8b3={};var _0x3700d4;var _0x4ff6fa=utils[_0x9ca3('0xf')]();var _0x344c2c;var _0x2f638c;var _0x15021f=_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x11')];var _0x322662=_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x12')];var _0x24153e=_0x107af2['query']['pauseTypeFilter'];var _0x24fc1a=_0x322662===_0x9ca3('0x13')||_0x322662==='*pause'?!![]:![];var _0x29335e=[];var _0x5b9571;var _0x3789c1;Promise['resolve']()[_0x9ca3('0x14')](function(){if(_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x15')]){if(!utils[_0x9ca3('0x16')](_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x15')])){throw new APIBadRequestError(util[_0x9ca3('0x17')](_0x9ca3('0x18'),_0x107af2['query'][_0x9ca3('0x15')]));}_0x3700d4=_0x107af2['query'][_0x9ca3('0x15')][_0x9ca3('0x19')]();}if(!_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x1a')]||!_0x107af2[_0x9ca3('0x10')]['sort'][_0x9ca3('0x1b')](_0x9ca3('0x1c'))){_0x107af2[_0x9ca3('0x10')]['sort']=rta[_0x9ca3('0x1d')](_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x1a')]);return;}var _0x1390f7=rta[_0x9ca3('0x1e')](_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x1a')]);_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x1a')]=_0x1390f7[_0x9ca3('0x1f')][_0x9ca3('0x20')](',');_0x5b9571=_0x1390f7[_0x9ca3('0x21')];})['then'](function(){if(!_0x15021f){return[];}return rta[_0x9ca3('0x22')](_0x15021f,_0x3700d4);})[_0x9ca3('0x14')](function(_0x2a6355){_0x29335e=_0x2a6355;return rta[_0x9ca3('0x23')]();})['then'](function(_0x208c01){_0x2f638c=_0x208c01['rows'];if((!_0x322662||_0x24fc1a)&&!_0x5b9571){return _0x29335e;}if(_0x5b9571&&!_0x322662){return rta['getSortedAgentsIdsByStatus'](_0x2f638c,_0x29335e,_0x5b9571);}else{return rta[_0x9ca3('0x24')](_0x2f638c,_0x29335e,_0x322662);}})[_0x9ca3('0x14')](function(_0x3f3b34){_0x29335e=_0x3f3b34;var _0x2dbf5b=![];if(_0x29335e[_0x9ca3('0x25')]===0x0){if(_0x15021f||_0x322662){_0x2dbf5b=!![];}if(_0x24fc1a){_0x2dbf5b=![];}}if(_0x2dbf5b){return _0x154d94;}var _0x181f8e=_[_0x9ca3('0x26')](db[_0x9ca3('0x27')][_0x9ca3('0x28')],function(_0x330791){return{'name':_0x330791[_0x9ca3('0x29')],'type':_0x330791[_0x9ca3('0x2a')][_0x9ca3('0x2b')]};});_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x2c')]=_0x9ca3('0x2d');_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x2e')]=!![];_0x2ee8b3=qs[_0x9ca3('0x2f')](_0x181f8e,_0x107af2);_0x2ee8b3['raw']=!![];var _0x2d2cdc=[];if(_0x29335e['length']>0x0){_0x2d2cdc[_0x9ca3('0x30')]({'id':{'$in':_0x29335e}});if(_0x5b9571&&!_0x322662){_0x3789c1=[db[_0x9ca3('0x31')]['literal']('FIELD(id,'+_0x29335e+')')];_0x2ee8b3[_0x9ca3('0x21')]=_0x3789c1;}}if(_0x24fc1a){_0x4ff6fa[_0x9ca3('0x32')](function(_0x3f80c){var _0x3d8469=!![];if(_0x322662===_0x9ca3('0x33')&&_0x3700d4!==_0x3f80c){_0x3d8469=![];}_0x2d2cdc[_0x9ca3('0x30')]({[_0x3f80c+_0x9ca3('0x34')]:_0x3d8469});});if(_0x24153e){_0x2d2cdc['push']({'pauseType':_0x24153e});}}else if(_0x322662){_0x4ff6fa[_0x9ca3('0x32')](function(_0x4ddd3b){_0x2d2cdc['push']({[_0x4ddd3b+'Pause']:![]});});}_0x2ee8b3[_0x9ca3('0x35')]=_['merge'](_0x2ee8b3['where'],{'$and':_0x2d2cdc});if(_0x107af2[_0x9ca3('0x36')][_0x9ca3('0x2c')]===_0x9ca3('0x36')){var _0x359432={'params':{'id':_0x107af2[_0x9ca3('0x36')][_0x9ca3('0x37')]},'query':{'section':_0x9ca3('0x38'),'role':'agent','online':!![],'raw':!![],'ids':_0x29335e,'customSorting':_0x3789c1}};if(_0x24fc1a){_0x359432[_0x9ca3('0x10')][_0x9ca3('0x39')]=_0x2d2cdc;}_0x359432[_0x9ca3('0x10')]=Object[_0x9ca3('0x3a')](_0x359432[_0x9ca3('0x10')],_0x107af2[_0x9ca3('0x10')]);delete _0x359432['query']['id'];return db[_0x9ca3('0x3b')][_0x9ca3('0x3c')](_0x359432);}return db['User']['findAndCountAll'](_0x2ee8b3);})[_0x9ca3('0x14')](function(_0x46ab2a){_0x154d94[_0x9ca3('0xb')]=_0x46ab2a[_0x9ca3('0xb')];_0x344c2c=_0x46ab2a[_0x9ca3('0x3d')];return _0x344c2c[_0x9ca3('0x26')](function(_0x5923e0){var _0x1e2fd1=_[_0x9ca3('0x3e')](_0x2f638c,['id',_0x5923e0['id']]);if(_0x1e2fd1){var _0x424efb=rta['filterAgentAttributes'](_0x1e2fd1);_[_0x9ca3('0x3f')](_0x5923e0,_0x424efb);}_0x5923e0[_0x9ca3('0x1c')]=rta['getAgentStatus'](_0x5923e0);if(_0x5923e0[_0x9ca3('0x1c')][_0x9ca3('0x1b')]('pause')){_0x4ff6fa[_0x9ca3('0x32')](function(_0x45138a){if(_0x5923e0[_0x45138a+_0x9ca3('0x34')]){if(_0x45138a==='voice'){if(_0x5923e0[_0x9ca3('0x40')]!==_0x9ca3('0x41')){_0x5923e0[_0x9ca3('0x40')]=_0x9ca3('0x13');}}else{_0x5923e0[_0x45138a+_0x9ca3('0x42')]=_0x9ca3('0x13');}}});}return _0x5923e0;});})[_0x9ca3('0x14')](function(_0x4884fd){if(!_0x5b9571||_0x3789c1){return _0x4884fd;}return rta[_0x9ca3('0x43')](_0x4884fd,_0x5b9571);})[_0x9ca3('0x14')](function(_0x2d89f7){var _0x1d1036=null;if(_0x107af2['query'][_0x9ca3('0x1f')]){var _0x24460b=_0x107af2[_0x9ca3('0x10')][_0x9ca3('0x1f')]['split'](',');_0x1d1036=_0x2d89f7[_0x9ca3('0x26')](function(_0x5c0e5e){return _[_0x9ca3('0x44')](_0x5c0e5e,_0x24460b);});}_0x154d94['rows']=_0x1d1036||_0x2d89f7;return _0x154d94;})[_0x9ca3('0x14')](respondWithFilteredResult(_0x4919db,_0x2ee8b3))[_0x9ca3('0x45')](APIHandleError(_0x4919db));};exports[_0x9ca3('0x46')]=function(_0xe5bf28,_0x15fce6){var _0x1188c6={'count':0x0,'rows':[]};var _0x24564e={};var _0x4963a0;var _0x3f31ed;var _0x829294;Promise['resolve']()[_0x9ca3('0x14')](function(){if(_0xe5bf28['query']['channel']){if(!utils[_0x9ca3('0x16')](_0xe5bf28[_0x9ca3('0x10')]['channel'])){throw new APIBadRequestError(util[_0x9ca3('0x17')](_0x9ca3('0x18'),_0xe5bf28['query'][_0x9ca3('0x15')]));}_0x4963a0=_0xe5bf28[_0x9ca3('0x10')]['channel']['toLowerCase']();}var _0x3c2eea=_[_0x9ca3('0x47')](_0x4963a0)+_0x9ca3('0x48');var _0x36c40f=_['map'](db[_0x3c2eea][_0x9ca3('0x28')],function(_0x5ddbc0){return{'name':_0x5ddbc0[_0x9ca3('0x29')],'type':_0x5ddbc0[_0x9ca3('0x2a')][_0x9ca3('0x2b')]};});if(!_0xe5bf28[_0x9ca3('0x10')][_0x9ca3('0x1f')]){var _0x535f4a=['id',_0x9ca3('0x49')];if(_0x4963a0===_0x9ca3('0x4a')){_0x535f4a[_0x9ca3('0x30')](_0x9ca3('0x2a'));if(_0xe5bf28[_0x9ca3('0x10')]['type']==='outbound'){_0x535f4a[_0x9ca3('0x30')]([_0x9ca3('0x4b'),_0x9ca3('0x4c')]);}}_0xe5bf28['query'][_0x9ca3('0x1f')]=_0x535f4a[_0x9ca3('0x20')](',');}_0x24564e=qs[_0x9ca3('0x2f')](_0x36c40f,_0xe5bf28);if(_0xe5bf28[_0x9ca3('0x36')]['role']===_0x9ca3('0x36')){var _0x46ae92={'params':{'id':_0xe5bf28[_0x9ca3('0x36')][_0x9ca3('0x37')]},'query':{'section':_0x4963a0==='voice'&&_0xe5bf28[_0x9ca3('0x10')][_0x9ca3('0x2a')]==='outbound'?_0x9ca3('0x4d'):_[_0x9ca3('0x47')](_0x4963a0)+_0x9ca3('0x4e'),'type':_0xe5bf28['query'][_0x9ca3('0x2a')],'nolimit':!![],'sort':_0x9ca3('0x49'),'filter':_0xe5bf28[_0x9ca3('0x10')][_0x9ca3('0x4f')]}};_0x46ae92[_0x9ca3('0x10')]=Object[_0x9ca3('0x3a')](_0x46ae92[_0x9ca3('0x10')],_0xe5bf28['query']);delete _0x46ae92[_0x9ca3('0x10')]['id'];return db[_0x9ca3('0x3b')]['getResources'](_0x46ae92);}return db[_0x3c2eea][_0x9ca3('0x50')](_0x24564e);})[_0x9ca3('0x14')](function(_0x5895a4){_0x1188c6['count']=_0x5895a4['count'];_0x3f31ed=_0x5895a4[_0x9ca3('0x3d')];return rtq[_0x9ca3('0x51')](_0xe5bf28,_0x4963a0);})[_0x9ca3('0x14')](function(_0x2d813c){_0x829294=_0x2d813c[_0x9ca3('0x3d')];return rtq[_0x9ca3('0x52')](_0x3f31ed,_0x829294,_0x4963a0,_0xe5bf28[_0x9ca3('0x10')][_0x9ca3('0x2a')]);})['then'](function(_0x2460bd){_0x1188c6[_0x9ca3('0x3d')]=_0x2460bd;return _0x1188c6;})[_0x9ca3('0x14')](respondWithFilteredResult(_0x15fce6,_0x24564e))[_0x9ca3('0x45')](APIHandleError(_0x15fce6));}; \ No newline at end of file +var _0x5de0=['APIBadRequestError','handleError','offset','undefined','limit','count','set','json','getAgents','getChannels','query','globalQueueFilter','pause','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','fields','join','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','key','getOptions','raw','length','literal','FIELD(id,','order','forEach','*pause','push','Pause','where','user','agent','extraQueryConditions','assign','UserProfile','findAndCountAll','find','merge','globalStatus','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','split','pick','catch','getQueues','resolve','Queue','fieldName','name','type','outbound','dialActive','startCase','filter','getResources','initializeQueues','lodash','../../mysqldb','../../errors/api'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x5de0,0x131));var _0x05de=function(_0x35d4cf,_0x3ed3cd){_0x35d4cf=_0x35d4cf-0x0;var _0x2d0941=_0x5de0[_0x35d4cf];return _0x2d0941;};'use strict';var _=require(_0x05de('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require(_0x05de('0x1'))['db'];var APIBadRequestError=require(_0x05de('0x2'))[_0x05de('0x3')];var APIHandleError=require('../../errors/api')[_0x05de('0x4')];function respondWithFilteredResult(_0x427016,_0x1817c7){return function(_0x41da5d){if(_0x41da5d){var _0x47c0ad=typeof _0x1817c7[_0x05de('0x5')]===_0x05de('0x6')&&typeof _0x1817c7[_0x05de('0x7')]===_0x05de('0x6');var _0x597562=_0x41da5d['count'];var _0x5b9183=_0x47c0ad?0x0:_0x1817c7[_0x05de('0x5')];var _0x4a91ff=_0x47c0ad?_0x41da5d[_0x05de('0x8')]:_0x1817c7[_0x05de('0x5')]+_0x1817c7[_0x05de('0x7')];var _0x3fd164;if(_0x4a91ff>=_0x597562){_0x4a91ff=_0x597562;_0x3fd164=0xc8;}else{_0x3fd164=0xce;}_0x427016['status'](_0x3fd164);return _0x427016[_0x05de('0x9')]('Content-Range',_0x5b9183+'-'+_0x4a91ff+'/'+_0x597562)[_0x05de('0xa')](_0x41da5d);}return null;};}exports[_0x05de('0xb')]=function(_0x200484,_0x41c5d3){var _0x321887={'count':0x0,'rows':[]};var _0x140744={};var _0x3c5fb8;var _0x34f10c=utils[_0x05de('0xc')]();var _0x1942d4;var _0x3fe543;var _0x106b6d=_0x200484[_0x05de('0xd')][_0x05de('0xe')];var _0x13742a=_0x200484[_0x05de('0xd')]['globalStatusFilter'];var _0x37f075=_0x200484[_0x05de('0xd')]['pauseTypeFilter'];var _0x2b0650=_0x13742a===_0x05de('0xf')||_0x13742a==='*pause'?!![]:![];var _0x56bf4f=[];var _0x1277cd;var _0x1e2c4a;Promise['resolve']()['then'](function(){if(_0x200484[_0x05de('0xd')][_0x05de('0x10')]){if(!utils[_0x05de('0x11')](_0x200484['query'][_0x05de('0x10')])){throw new APIBadRequestError(util[_0x05de('0x12')](_0x05de('0x13'),_0x200484['query']['channel']));}_0x3c5fb8=_0x200484[_0x05de('0xd')][_0x05de('0x10')][_0x05de('0x14')]();}if(!_0x200484[_0x05de('0xd')]['sort']||!_0x200484[_0x05de('0xd')][_0x05de('0x15')][_0x05de('0x16')]('globalStatus')){_0x200484[_0x05de('0xd')][_0x05de('0x15')]=rta[_0x05de('0x17')](_0x200484[_0x05de('0xd')][_0x05de('0x15')]);return;}var _0x336235=rta['getUpdatedSortOptions'](_0x200484['query'][_0x05de('0x15')]);_0x200484['query'][_0x05de('0x15')]=_0x336235[_0x05de('0x18')][_0x05de('0x19')](',');_0x1277cd=_0x336235['order'];})[_0x05de('0x1a')](function(){if(!_0x106b6d){return[];}return rta[_0x05de('0x1b')](_0x106b6d,_0x3c5fb8);})[_0x05de('0x1a')](function(_0x422c28){_0x56bf4f=_0x422c28;return rta[_0x05de('0x1c')]();})['then'](function(_0xfb0231){_0x3fe543=_0xfb0231[_0x05de('0x1d')];if((!_0x13742a||_0x2b0650)&&!_0x1277cd){return _0x56bf4f;}if(_0x1277cd&&!_0x13742a){return rta[_0x05de('0x1e')](_0x3fe543,_0x56bf4f,_0x1277cd);}else{return rta[_0x05de('0x1f')](_0x3fe543,_0x56bf4f,_0x13742a);}})[_0x05de('0x1a')](function(_0x878487){_0x56bf4f=_0x878487;var _0x33adda=![];if(_0x56bf4f['length']===0x0){if(_0x106b6d||_0x13742a){_0x33adda=!![];}if(_0x2b0650){_0x33adda=![];}}if(_0x33adda){return _0x321887;}var _0x491604=_[_0x05de('0x20')](db[_0x05de('0x21')][_0x05de('0x22')],function(_0x393231){return{'name':_0x393231['fieldName'],'type':_0x393231['type'][_0x05de('0x23')]};});_0x200484[_0x05de('0xd')]['role']='agent';_0x200484['query']['online']=!![];_0x140744=qs[_0x05de('0x24')](_0x491604,_0x200484);_0x140744[_0x05de('0x25')]=!![];var _0xf1aafb=[];if(_0x56bf4f[_0x05de('0x26')]>0x0){_0xf1aafb['push']({'id':{'$in':_0x56bf4f}});if(_0x1277cd&&!_0x13742a){_0x1e2c4a=[db['sequelize'][_0x05de('0x27')](_0x05de('0x28')+_0x56bf4f+')')];_0x140744[_0x05de('0x29')]=_0x1e2c4a;}}if(_0x2b0650){_0x34f10c[_0x05de('0x2a')](function(_0x2370b3){var _0x422344=!![];if(_0x13742a===_0x05de('0x2b')&&_0x3c5fb8!==_0x2370b3){_0x422344=![];}_0xf1aafb[_0x05de('0x2c')]({[_0x2370b3+_0x05de('0x2d')]:_0x422344});});if(_0x37f075){_0xf1aafb[_0x05de('0x2c')]({'pauseType':_0x37f075});}}else if(_0x13742a){_0x34f10c[_0x05de('0x2a')](function(_0x230c54){_0xf1aafb[_0x05de('0x2c')]({[_0x230c54+_0x05de('0x2d')]:![]});});}_0x140744[_0x05de('0x2e')]=_['merge'](_0x140744[_0x05de('0x2e')],{'$and':_0xf1aafb});if(_0x200484[_0x05de('0x2f')]['role']===_0x05de('0x2f')){var _0x985079={'params':{'id':_0x200484[_0x05de('0x2f')]['userProfileId']},'query':{'section':'Agents','role':_0x05de('0x30'),'online':!![],'raw':!![],'ids':_0x56bf4f,'customSorting':_0x1e2c4a}};if(_0x2b0650){_0x985079['query'][_0x05de('0x31')]=_0xf1aafb;}_0x985079['query']=Object[_0x05de('0x32')](_0x985079['query'],_0x200484['query']);delete _0x985079['query']['id'];return db[_0x05de('0x33')]['getResources'](_0x985079);}return db['User'][_0x05de('0x34')](_0x140744);})[_0x05de('0x1a')](function(_0x216de9){_0x321887['count']=_0x216de9[_0x05de('0x8')];_0x1942d4=_0x216de9[_0x05de('0x1d')];return _0x1942d4['map'](function(_0x25f8fc){var _0x763816=_[_0x05de('0x35')](_0x3fe543,['id',_0x25f8fc['id']]);if(_0x763816){var _0x5cd007=rta['filterAgentAttributes'](_0x763816);_[_0x05de('0x36')](_0x25f8fc,_0x5cd007);}_0x25f8fc[_0x05de('0x37')]=rta[_0x05de('0x38')](_0x25f8fc);if(_0x25f8fc[_0x05de('0x37')][_0x05de('0x16')]('pause')){_0x34f10c[_0x05de('0x2a')](function(_0x5cd279){if(_0x25f8fc[_0x5cd279+_0x05de('0x2d')]){if(_0x5cd279===_0x05de('0x39')){if(_0x25f8fc[_0x05de('0x3a')]!==_0x05de('0x3b')){_0x25f8fc[_0x05de('0x3a')]='pause';}}else{_0x25f8fc[_0x5cd279+_0x05de('0x3c')]=_0x05de('0xf');}}});}return _0x25f8fc;});})[_0x05de('0x1a')](function(_0xfe05ec){if(!_0x1277cd||_0x1e2c4a){return _0xfe05ec;}return rta[_0x05de('0x3d')](_0xfe05ec,_0x1277cd);})[_0x05de('0x1a')](function(_0x11c322){var _0x4b96b4=null;if(_0x200484[_0x05de('0xd')][_0x05de('0x18')]){var _0x52e9fe=_0x200484['query']['fields'][_0x05de('0x3e')](',');_0x4b96b4=_0x11c322[_0x05de('0x20')](function(_0x20c2b9){return _[_0x05de('0x3f')](_0x20c2b9,_0x52e9fe);});}_0x321887[_0x05de('0x1d')]=_0x4b96b4||_0x11c322;return _0x321887;})[_0x05de('0x1a')](respondWithFilteredResult(_0x41c5d3,_0x140744))[_0x05de('0x40')](APIHandleError(_0x41c5d3));};exports[_0x05de('0x41')]=function(_0x1b3619,_0x3a4d67){var _0x502023={'count':0x0,'rows':[]};var _0x1d6213={};var _0x176f2c;var _0x250807;var _0x44a1d7;Promise[_0x05de('0x42')]()['then'](function(){if(_0x1b3619[_0x05de('0xd')][_0x05de('0x10')]){if(!utils[_0x05de('0x11')](_0x1b3619['query'][_0x05de('0x10')])){throw new APIBadRequestError(util[_0x05de('0x12')](_0x05de('0x13'),_0x1b3619[_0x05de('0xd')]['channel']));}_0x176f2c=_0x1b3619[_0x05de('0xd')][_0x05de('0x10')][_0x05de('0x14')]();}var _0xd735d6=_['startCase'](_0x176f2c)+_0x05de('0x43');var _0x25f713=_['map'](db[_0xd735d6][_0x05de('0x22')],function(_0x5da9ec){return{'name':_0x5da9ec[_0x05de('0x44')],'type':_0x5da9ec['type'][_0x05de('0x23')]};});if(!_0x1b3619[_0x05de('0xd')]['fields']){var _0x428084=['id',_0x05de('0x45')];if(_0x176f2c===_0x05de('0x39')){_0x428084[_0x05de('0x2c')](_0x05de('0x46'));if(_0x1b3619[_0x05de('0xd')][_0x05de('0x46')]===_0x05de('0x47')){_0x428084[_0x05de('0x2c')]([_0x05de('0x48'),'dialMethod']);}}_0x1b3619[_0x05de('0xd')][_0x05de('0x18')]=_0x428084[_0x05de('0x19')](',');}_0x1d6213=qs[_0x05de('0x24')](_0x25f713,_0x1b3619);if(_0x1b3619[_0x05de('0x2f')]['role']===_0x05de('0x2f')){var _0x9a1881={'params':{'id':_0x1b3619[_0x05de('0x2f')]['userProfileId']},'query':{'section':_0x176f2c===_0x05de('0x39')&&_0x1b3619['query'][_0x05de('0x46')]===_0x05de('0x47')?'QueueCampaigns':_[_0x05de('0x49')](_0x176f2c)+'Queues','type':_0x1b3619['query'][_0x05de('0x46')],'nolimit':!![],'sort':_0x05de('0x45'),'filter':_0x1b3619[_0x05de('0xd')][_0x05de('0x4a')]}};_0x9a1881[_0x05de('0xd')]=Object[_0x05de('0x32')](_0x9a1881[_0x05de('0xd')],_0x1b3619['query']);delete _0x9a1881[_0x05de('0xd')]['id'];return db[_0x05de('0x33')][_0x05de('0x4b')](_0x9a1881);}return db[_0xd735d6][_0x05de('0x34')](_0x1d6213);})['then'](function(_0x19c274){_0x502023['count']=_0x19c274[_0x05de('0x8')];_0x250807=_0x19c274[_0x05de('0x1d')];return rtq['getRealtimeQueues'](_0x1b3619,_0x176f2c);})[_0x05de('0x1a')](function(_0xb4d4ec){_0x44a1d7=_0xb4d4ec['rows'];return rtq[_0x05de('0x4c')](_0x250807,_0x44a1d7,_0x176f2c,_0x1b3619[_0x05de('0xd')][_0x05de('0x46')]);})[_0x05de('0x1a')](function(_0x15d534){_0x502023[_0x05de('0x1d')]=_0x15d534;return _0x502023;})['then'](respondWithFilteredResult(_0x3a4d67,_0x1d6213))[_0x05de('0x40')](APIHandleError(_0x3a4d67));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c883a45..9873038 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(_0x220b0e,_0x1cf544){var _0x475060=function(_0x3a486f){while(--_0x3a486f){_0x220b0e['push'](_0x220b0e['shift']());}};_0x475060(++_0x1cf544);}(_0x70e0,0x17b));var _0x070e=function(_0x5ab8f3,_0x2f3062){_0x5ab8f3=_0x5ab8f3-0x0;var _0x3c0967=_0x70e0[_0x5ab8f3];return _0x3c0967;};'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(_0x25ce42,_0x52470e){var _0x390d9a=function(_0x1a41dd){while(--_0x1a41dd){_0x25ce42['push'](_0x25ce42['shift']());}};_0x390d9a(++_0x52470e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xcb91[_0x25701b];return _0x3a8a2c;};'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 a61ba87..80aff5d 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 _0x4753=['sequelize','exports','INTEGER','DATE','STRING'];(function(_0x1db07e,_0x45547a){var _0x3edfc7=function(_0x596a02){while(--_0x596a02){_0x1db07e['push'](_0x1db07e['shift']());}};_0x3edfc7(++_0x45547a);}(_0x4753,0x1f4));var _0x3475=function(_0x1d5fb2,_0x53c43b){_0x1d5fb2=_0x1d5fb2-0x0;var _0x50c700=_0x4753[_0x1d5fb2];return _0x50c700;};'use strict';var Sequelize=require(_0x3475('0x0'));module[_0x3475('0x1')]={'state':{'type':Sequelize[_0x3475('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x3475('0x3')]},'uniqueid':{'type':Sequelize[_0x3475('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3475('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x38e4=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0x4ce3b8,_0x616767){var _0x302779=function(_0x2c538a){while(--_0x2c538a){_0x4ce3b8['push'](_0x4ce3b8['shift']());}};_0x302779(++_0x616767);}(_0x38e4,0x9e));var _0x438e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x38e4[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x438e('0x0'));module[_0x438e('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x438e('0x2')]},'scheduledat':{'type':Sequelize[_0x438e('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x438e('0x3')]},'responsetime':{'type':Sequelize[_0x438e('0x3')]},'ringtime':{'type':Sequelize[_0x438e('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x438e('0x2')]},'membername':{'type':Sequelize[_0x438e('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 81beeb6..1432d8e 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 _0x5450=['report_agent_preview','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','ReportAgentPreview'];(function(_0x1c4b46,_0x26ba44){var _0x32f50c=function(_0x4593f0){while(--_0x4593f0){_0x1c4b46['push'](_0x1c4b46['shift']());}};_0x32f50c(++_0x26ba44);}(_0x5450,0x79));var _0x0545=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x5450[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x0545('0x0'));var util=require(_0x0545('0x1'));var logger=require(_0x0545('0x2'))(_0x0545('0x3'));var moment=require(_0x0545('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0545('0x5'));var rimraf=require(_0x0545('0x6'));var config=require(_0x0545('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0x0545('0x8')]=function(_0x756063,_0x5b8074){return _0x756063[_0x0545('0x9')](_0x0545('0xa'),attributes,{'tableName':_0x0545('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1efe=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','util','api'];(function(_0xcf8f87,_0x5f5772){var _0x485b48=function(_0x621938){while(--_0x621938){_0xcf8f87['push'](_0xcf8f87['shift']());}};_0x485b48(++_0x5f5772);}(_0x1efe,0x1db));var _0xe1ef=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x1efe[_0x53cf8e];return _0x459197;};'use strict';var _=require('lodash');var util=require(_0xe1ef('0x0'));var logger=require('../../config/logger')(_0xe1ef('0x1'));var moment=require('moment');var BPromise=require(_0xe1ef('0x2'));var rp=require(_0xe1ef('0x3'));var fs=require('fs');var path=require(_0xe1ef('0x4'));var rimraf=require(_0xe1ef('0x5'));var config=require(_0xe1ef('0x6'));var attributes=require(_0xe1ef('0x7'));module['exports']=function(_0x3278be,_0x42e993){return _0x3278be['define'](_0xe1ef('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 133e6e9..e3d078b 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 _0xe4f0=['CreateReportAgentPreview','ReportAgentPreview','options','then','info','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x20554f,_0x4fd638){var _0x116409=function(_0x49ff31){while(--_0x49ff31){_0x20554f['push'](_0x20554f['shift']());}};_0x116409(++_0x4fd638);}(_0xe4f0,0x1b6));var _0x0e4f=function(_0x12df9f,_0x1ce139){_0x12df9f=_0x12df9f-0x0;var _0x33f3a1=_0xe4f0[_0x12df9f];return _0x33f3a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e4f('0x0'));var BPromise=require(_0x0e4f('0x1'));var rs=require(_0x0e4f('0x2'));var fs=require('fs');var Redis=require(_0x0e4f('0x3'));var db=require(_0x0e4f('0x4'))['db'];var utils=require(_0x0e4f('0x5'));var logger=require('../../config/logger')(_0x0e4f('0x6'));var config=require(_0x0e4f('0x7'));var jayson=require(_0x0e4f('0x8'));var client=jayson[_0x0e4f('0x9')][_0x0e4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x313a0d,_0x257de2,_0x10f1e2){return new BPromise(function(_0x1999ed,_0x1411a7){return client[_0x0e4f('0xb')](_0x313a0d,_0x10f1e2)['then'](function(_0x16ec3e){logger['info'](_0x0e4f('0xc'),_0x257de2,_0x0e4f('0xd'));logger['debug'](_0x0e4f('0xe'),_0x257de2,'request\x20sent',JSON[_0x0e4f('0xf')](_0x16ec3e));if(_0x16ec3e['error']){if(_0x16ec3e[_0x0e4f('0x10')][_0x0e4f('0x11')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x257de2,_0x16ec3e[_0x0e4f('0x10')][_0x0e4f('0x12')]);return _0x1411a7(_0x16ec3e['error'][_0x0e4f('0x12')]);}logger[_0x0e4f('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x257de2,_0x16ec3e['error'][_0x0e4f('0x12')]);return _0x1999ed(_0x16ec3e[_0x0e4f('0x10')][_0x0e4f('0x12')]);}else{logger['info'](_0x0e4f('0xc'),_0x257de2,_0x0e4f('0xd'));_0x1999ed(_0x16ec3e[_0x0e4f('0x13')]['message']);}})[_0x0e4f('0x14')](function(_0x39f6aa){logger[_0x0e4f('0x10')](_0x0e4f('0xc'),_0x257de2,_0x39f6aa);_0x1411a7(_0x39f6aa);});});}exports[_0x0e4f('0x15')]=function(_0x412cb8){var _0x1a99e9=this;return new Promise(function(_0x3e08f7,_0x5a4ab6){return db[_0x0e4f('0x16')]['create'](_0x412cb8['body'],{'raw':_0x412cb8[_0x0e4f('0x17')]?_0x412cb8[_0x0e4f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x0e4f('0x18')](function(_0x4de27a){logger[_0x0e4f('0x19')](_0x0e4f('0x15'),_0x412cb8);logger[_0x0e4f('0x1a')](_0x0e4f('0x15'),_0x412cb8,JSON['stringify'](_0x4de27a));_0x3e08f7(_0x4de27a);})[_0x0e4f('0x14')](function(_0x3e20af){logger[_0x0e4f('0x10')]('CreateReportAgentPreview',_0x3e20af[_0x0e4f('0x12')],_0x412cb8);_0x5a4ab6(_0x1a99e9[_0x0e4f('0x10')](0x1f4,_0x3e20af[_0x0e4f('0x12')]));});});}; \ No newline at end of file +var _0xbcb5=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','lodash','moment','bluebird','randomstring'];(function(_0x1bad0c,_0x3adb14){var _0x387601=function(_0x2ffedf){while(--_0x2ffedf){_0x1bad0c['push'](_0x1bad0c['shift']());}};_0x387601(++_0x3adb14);}(_0xbcb5,0x130));var _0x5bcb=function(_0x236951,_0x37dc34){_0x236951=_0x236951-0x0;var _0x2646a0=_0xbcb5[_0x236951];return _0x2646a0;};'use strict';var _=require(_0x5bcb('0x0'));var util=require('util');var moment=require(_0x5bcb('0x1'));var BPromise=require(_0x5bcb('0x2'));var rs=require(_0x5bcb('0x3'));var fs=require('fs');var Redis=require(_0x5bcb('0x4'));var db=require(_0x5bcb('0x5'))['db'];var utils=require(_0x5bcb('0x6'));var logger=require('../../config/logger')(_0x5bcb('0x7'));var config=require(_0x5bcb('0x8'));var jayson=require(_0x5bcb('0x9'));var client=jayson['client'][_0x5bcb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38325a,_0x380997,_0x2c4ab9){return new BPromise(function(_0x2e5cbf,_0x4510e7){return client[_0x5bcb('0xb')](_0x38325a,_0x2c4ab9)[_0x5bcb('0xc')](function(_0xf8d4dc){logger['info'](_0x5bcb('0xd'),_0x380997,_0x5bcb('0xe'));logger[_0x5bcb('0xf')](_0x5bcb('0x10'),_0x380997,_0x5bcb('0xe'),JSON[_0x5bcb('0x11')](_0xf8d4dc));if(_0xf8d4dc[_0x5bcb('0x12')]){if(_0xf8d4dc[_0x5bcb('0x12')][_0x5bcb('0x13')]===0x1f4){logger['error'](_0x5bcb('0xd'),_0x380997,_0xf8d4dc[_0x5bcb('0x12')][_0x5bcb('0x14')]);return _0x4510e7(_0xf8d4dc[_0x5bcb('0x12')][_0x5bcb('0x14')]);}logger['error'](_0x5bcb('0xd'),_0x380997,_0xf8d4dc[_0x5bcb('0x12')][_0x5bcb('0x14')]);return _0x2e5cbf(_0xf8d4dc[_0x5bcb('0x12')][_0x5bcb('0x14')]);}else{logger['info'](_0x5bcb('0xd'),_0x380997,_0x5bcb('0xe'));_0x2e5cbf(_0xf8d4dc[_0x5bcb('0x15')]['message']);}})[_0x5bcb('0x16')](function(_0x1bb2da){logger[_0x5bcb('0x12')](_0x5bcb('0xd'),_0x380997,_0x1bb2da);_0x4510e7(_0x1bb2da);});});}exports[_0x5bcb('0x17')]=function(_0xb32223){var _0xa5fe7d=this;return new Promise(function(_0x3535ac,_0x1abea5){return db[_0x5bcb('0x18')][_0x5bcb('0x19')](_0xb32223[_0x5bcb('0x1a')],{'raw':_0xb32223[_0x5bcb('0x1b')]?_0xb32223['options']['raw']===undefined?!![]:![]:!![]})[_0x5bcb('0xc')](function(_0x1fb533){logger['info'](_0x5bcb('0x17'),_0xb32223);logger[_0x5bcb('0xf')](_0x5bcb('0x17'),_0xb32223,JSON[_0x5bcb('0x11')](_0x1fb533));_0x3535ac(_0x1fb533);})[_0x5bcb('0x16')](function(_0x30be84){logger['error']('CreateReportAgentPreview',_0x30be84[_0x5bcb('0x14')],_0xb32223);_0x1abea5(_0xa5fe7d[_0x5bcb('0x12')](0x1f4,_0x30be84[_0x5bcb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 43a27d1..5473ff4 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 _0x710c=['voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/trunks','trunks','/campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/mail/queues/:id/notify','showMailQueues','post','/chat/queues/:id/notify','queueNotify','chat','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','isAuthenticated','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels'];(function(_0x281d23,_0x20d215){var _0x6b91db=function(_0x3205c4){while(--_0x3205c4){_0x281d23['push'](_0x281d23['shift']());}};_0x6b91db(++_0x20d215);}(_0x710c,0x15f));var _0xc710=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x710c[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require(_0xc710('0x0'));var util=require('util');var path=require(_0xc710('0x1'));var express=require(_0xc710('0x2'));var router=express[_0xc710('0x3')]();var auth=require(_0xc710('0x4'));var controller=require(_0xc710('0x5'));router[_0xc710('0x6')](_0xc710('0x7'),auth['isAuthenticated'](),controller[_0xc710('0x8')]);router[_0xc710('0x6')](_0xc710('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xc710('0x6')](_0xc710('0xa'),auth['isAuthenticated'](),controller[_0xc710('0xb')]);router['get'](_0xc710('0xc'),auth[_0xc710('0xd')](),controller['voiceQueues']);router['get'](_0xc710('0xe'),auth[_0xc710('0xd')](),controller['chatQueues']);router['get'](_0xc710('0xf'),auth[_0xc710('0xd')](),controller[_0xc710('0x10')]);router['get'](_0xc710('0x11'),auth[_0xc710('0xd')](),controller[_0xc710('0x12')]);router['get'](_0xc710('0x13'),auth[_0xc710('0xd')](),controller[_0xc710('0x14')]);router[_0xc710('0x6')](_0xc710('0x15'),auth[_0xc710('0xd')](),controller[_0xc710('0x16')]);router['get'](_0xc710('0x17'),auth[_0xc710('0xd')](),controller['whatsappQueues']);router[_0xc710('0x6')](_0xc710('0x18'),auth[_0xc710('0xd')](),controller[_0xc710('0x19')]);router[_0xc710('0x6')](_0xc710('0x1a'),auth[_0xc710('0xd')](),controller[_0xc710('0x1b')]);router['get'](_0xc710('0x1c'),auth[_0xc710('0xd')](),controller[_0xc710('0x1d')]);router[_0xc710('0x6')](_0xc710('0x1e'),auth[_0xc710('0xd')](),controller[_0xc710('0x1f')]);router[_0xc710('0x6')](_0xc710('0x20'),auth[_0xc710('0xd')](),controller[_0xc710('0x21')]);router[_0xc710('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xc710('0xd')](),controller[_0xc710('0x22')]);router[_0xc710('0x6')](_0xc710('0x23'),auth['isAuthenticated'](),controller[_0xc710('0x24')]);router[_0xc710('0x25')]('/voice/queues/:id',auth[_0xc710('0xd')](),controller['updateVoiceQueue']);router['get'](_0xc710('0x26'),auth[_0xc710('0xd')](),controller[_0xc710('0x27')]);router[_0xc710('0x6')]('/outbound/channels',auth['isAuthenticated'](),controller[_0xc710('0x28')]);router[_0xc710('0x6')](_0xc710('0x29'),auth[_0xc710('0xd')](),controller[_0xc710('0x2a')]);router[_0xc710('0x25')](_0xc710('0x2b'),auth[_0xc710('0xd')](),controller[_0xc710('0x2c')]);router['get']('/telephones',auth[_0xc710('0xd')](),controller['telephones']);router[_0xc710('0x6')](_0xc710('0x2d'),auth['isAuthenticated'](),controller[_0xc710('0x2e')]);router[_0xc710('0x6')](_0xc710('0x2f'),auth['isAuthenticated'](),controller['campaigns']);router[_0xc710('0x6')]('/fax/accounts',auth[_0xc710('0xd')](),controller['faxAccounts']);router[_0xc710('0x6')](_0xc710('0x30'),auth['isAuthenticated'](),controller[_0xc710('0x31')]);router[_0xc710('0x6')]('/mail/queues/waitinginteractions',auth[_0xc710('0xd')](),controller[_0xc710('0x32')]);router[_0xc710('0x6')](_0xc710('0x33'),auth['isAuthenticated'](),controller[_0xc710('0x34')]);router[_0xc710('0x6')](_0xc710('0x35'),auth[_0xc710('0xd')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xc710('0x6')]('/sms/queues/waitinginteractions',auth[_0xc710('0xd')](),controller['smsQueuesWaitingInteractions']);router[_0xc710('0x6')](_0xc710('0x36'),auth['isAuthenticated'](),controller[_0xc710('0x37')]);router[_0xc710('0x6')]('/fax/queues/waitinginteractions',auth[_0xc710('0xd')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xc710('0x38'),auth[_0xc710('0xd')](),controller['queueNotify']('mail'));router[_0xc710('0x6')]('/mail/queues/:id',auth[_0xc710('0xd')](),controller[_0xc710('0x39')]);router[_0xc710('0x3a')](_0xc710('0x3b'),auth[_0xc710('0xd')](),controller[_0xc710('0x3c')](_0xc710('0x3d')));router[_0xc710('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0xc710('0x3a')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0xc710('0x3c')]('fax'));router['get'](_0xc710('0x3e'),auth[_0xc710('0xd')](),controller['showFaxQueues']);router['post'](_0xc710('0x3f'),auth['isAuthenticated'](),controller[_0xc710('0x3c')](_0xc710('0x40')));router['get'](_0xc710('0x41'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xc710('0x3a')](_0xc710('0x42'),auth['isAuthenticated'](),controller['queueNotify'](_0xc710('0x43')));router['post'](_0xc710('0x44'),auth[_0xc710('0xd')](),controller[_0xc710('0x3c')](_0xc710('0x45')));router[_0xc710('0x6')](_0xc710('0x46'),auth[_0xc710('0xd')](),controller[_0xc710('0x47')]);router[_0xc710('0x6')](_0xc710('0x48'),auth[_0xc710('0xd')](),controller['showWhatsappQueues']);router[_0xc710('0x3a')](_0xc710('0x49'),auth[_0xc710('0xd')](),controller[_0xc710('0x4a')]);module[_0xc710('0x4b')]=router; \ No newline at end of file +var _0xf4e6=['telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','exports','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/whatsapp/queues','whatsappQueues','faxQueues','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'];(function(_0x267bb7,_0xf5f1a9){var _0x377ee2=function(_0x383a85){while(--_0x383a85){_0x267bb7['push'](_0x267bb7['shift']());}};_0x377ee2(++_0xf5f1a9);}(_0xf4e6,0x142));var _0x6f4e=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xf4e6[_0x54c9dd];return _0x855156;};'use strict';var multer=require('multer');var util=require(_0x6f4e('0x0'));var path=require(_0x6f4e('0x1'));var express=require(_0x6f4e('0x2'));var router=express[_0x6f4e('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x6f4e('0x4'));router[_0x6f4e('0x5')](_0x6f4e('0x6'),auth[_0x6f4e('0x7')](),controller['voiceChannels']);router[_0x6f4e('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x8')]);router[_0x6f4e('0x5')](_0x6f4e('0x9'),auth[_0x6f4e('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x6f4e('0x5')](_0x6f4e('0xa'),auth['isAuthenticated'](),controller[_0x6f4e('0xb')]);router[_0x6f4e('0x5')](_0x6f4e('0xc'),auth[_0x6f4e('0x7')](),controller['chatQueues']);router[_0x6f4e('0x5')](_0x6f4e('0xd'),auth['isAuthenticated'](),controller[_0x6f4e('0xe')]);router[_0x6f4e('0x5')](_0x6f4e('0xf'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x10')]);router[_0x6f4e('0x5')]('/openchannel/queues',auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x11')]);router[_0x6f4e('0x5')]('/sms/queues',auth[_0x6f4e('0x7')](),controller['smsQueues']);router[_0x6f4e('0x5')](_0x6f4e('0x12'),auth['isAuthenticated'](),controller[_0x6f4e('0x13')]);router[_0x6f4e('0x5')]('/fax/queues',auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x14')]);router[_0x6f4e('0x5')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x6f4e('0x15')]);router[_0x6f4e('0x5')](_0x6f4e('0x16'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router['get'](_0x6f4e('0x17'),auth['isAuthenticated'](),controller[_0x6f4e('0x18')]);router['get'](_0x6f4e('0x19'),auth['isAuthenticated'](),controller[_0x6f4e('0x1a')]);router[_0x6f4e('0x5')](_0x6f4e('0x1b'),auth['isAuthenticated'](),controller[_0x6f4e('0x1c')]);router[_0x6f4e('0x5')](_0x6f4e('0x1d'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x1e')]);router[_0x6f4e('0x1f')](_0x6f4e('0x1d'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x20')]);router[_0x6f4e('0x5')](_0x6f4e('0x21'),auth[_0x6f4e('0x7')](),controller['outbound']);router[_0x6f4e('0x5')](_0x6f4e('0x22'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x23')]);router[_0x6f4e('0x5')](_0x6f4e('0x24'),auth[_0x6f4e('0x7')](),controller['agents']);router[_0x6f4e('0x1f')](_0x6f4e('0x25'),auth[_0x6f4e('0x7')](),controller['agentCapacity']);router[_0x6f4e('0x5')]('/telephones',auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x26')]);router['get'](_0x6f4e('0x27'),auth['isAuthenticated'](),controller[_0x6f4e('0x28')]);router[_0x6f4e('0x5')](_0x6f4e('0x29'),auth[_0x6f4e('0x7')](),controller['campaigns']);router[_0x6f4e('0x5')]('/fax/accounts',auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x2a')]);router[_0x6f4e('0x5')](_0x6f4e('0x2b'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x2c')]);router[_0x6f4e('0x5')](_0x6f4e('0x2d'),auth[_0x6f4e('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x6f4e('0x5')](_0x6f4e('0x2e'),auth[_0x6f4e('0x7')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x6f4e('0x2f'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x30')]);router[_0x6f4e('0x5')](_0x6f4e('0x31'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x32')]);router[_0x6f4e('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x6f4e('0x7')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x6f4e('0x33'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x6f4e('0x34')]('/mail/queues/:id/notify',auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x35')](_0x6f4e('0x36')));router[_0x6f4e('0x5')]('/mail/queues/:id',auth['isAuthenticated'](),controller[_0x6f4e('0x37')]);router['post'](_0x6f4e('0x38'),auth[_0x6f4e('0x7')](),controller['queueNotify'](_0x6f4e('0x39')));router[_0x6f4e('0x5')]('/chat/queues/:id',auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x3a')]);router['post'](_0x6f4e('0x3b'),auth['isAuthenticated'](),controller[_0x6f4e('0x35')](_0x6f4e('0x3c')));router[_0x6f4e('0x5')]('/fax/queues/:id',auth['isAuthenticated'](),controller['showFaxQueues']);router['post'](_0x6f4e('0x3d'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x35')](_0x6f4e('0x3e')));router[_0x6f4e('0x5')]('/openchannel/queues/:id',auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x3f')]);router[_0x6f4e('0x34')](_0x6f4e('0x40'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x35')]('sms'));router[_0x6f4e('0x34')](_0x6f4e('0x41'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x35')](_0x6f4e('0x42')));router['get'](_0x6f4e('0x43'),auth[_0x6f4e('0x7')](),controller[_0x6f4e('0x44')]);router[_0x6f4e('0x5')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x6f4e('0x45')]);router[_0x6f4e('0x34')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x6f4e('0x46')]);module[_0x6f4e('0x47')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index ab471f7..7817e1d 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 _0x1020=['Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','update','queue','MessageId','InteractionId','Interaction','From','QueueId','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','Agent\x20not\x20found','\x20Message\x20not\x20found','TransferReport','bluebird','moment','util','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','Agents','agentCapacity','body','interaction','user','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1020,0x11d));var _0x0102=function(_0x20aae1,_0x51efd4){_0x20aae1=_0x20aae1-0x0;var _0x510601=_0x1020[_0x20aae1];return _0x510601;};'use strict';var BPromise=require(_0x0102('0x0'));var moment=require(_0x0102('0x1'));var _=require('lodash');var util=require(_0x0102('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x0102('0x3'))(_0x0102('0x4'));var jayson=require(_0x0102('0x5'));var amiClient=jayson['client'][_0x0102('0x6')]({'port':0x232a});var mailClient=jayson[_0x0102('0x7')][_0x0102('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0102('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x5d218c,_0x275559,_0xcc3545){return new BPromise(function(_0x574960,_0x8f238c){var _0x39c06d=_0xcc3545?_0xcc3545:amiClient;return _0x39c06d[_0x0102('0x8')](_0x5d218c,_0x275559)[_0x0102('0x9')](function(_0x3426f1){if(_0x3426f1[_0x0102('0xa')]){if(_0x3426f1['error'][_0x0102('0xb')]===0x1f4){return _0x8f238c(_0x3426f1[_0x0102('0xa')][_0x0102('0xc')]);}return _0x574960(_0x3426f1[_0x0102('0xa')][_0x0102('0xc')]);}else{_0x574960(_0x3426f1[_0x0102('0xd')]);}})['catch'](function(_0x5a621c){_0x8f238c(_0x5a621c);});});}function respondWithResult(_0x37e2f8,_0x1adde9){_0x1adde9=_0x1adde9||0xc8;return function(_0x4b1bbe){if(_0x4b1bbe){return _0x37e2f8['status'](_0x1adde9)[_0x0102('0xe')](_0x4b1bbe);}return _0x37e2f8[_0x0102('0xf')](0x194);};}function handleError(_0x1a3ba4,_0x5ba000){_0x5ba000=_0x5ba000||0x1f4;return function(_0x3b0366){logger[_0x0102('0xa')](_0x3b0366[_0x0102('0x10')]);if(_0x3b0366[_0x0102('0x11')]){delete _0x3b0366[_0x0102('0x11')];}_0x1a3ba4['status'](_0x5ba000)[_0x0102('0x12')](_0x3b0366);};}function findById(_0x1a17d3){return function(_0x5613a8){if(!_['isNil'](_0x1a17d3)&&!_[_0x0102('0x13')](_0x5613a8)&&!_[_0x0102('0x13')](_0x5613a8[_0x0102('0x14')])){return _[_0x0102('0x15')](_0x5613a8[_0x0102('0x14')],function(_0x568f5f){return _0x568f5f['id']==_0x1a17d3;});}return null;};}exports[_0x0102('0x16')]=function(_0x2e91e9,_0x59bf6c){return respondWithRpcPromise(_0x0102('0x17'),_0x2e91e9[_0x0102('0x18')])[_0x0102('0x9')](respondWithResult(_0x59bf6c,null))['catch'](handleError(_0x59bf6c,null));};exports[_0x0102('0x19')]=function(_0x54bdab,_0x1f1712){return respondWithRpcPromise(_0x0102('0x1a'),_[_0x0102('0x1b')](_0x54bdab[_0x0102('0x18')],_0x54bdab[_0x0102('0x1c')]))[_0x0102('0x9')](respondWithResult(_0x1f1712,null))[_0x0102('0x1d')](handleError(_0x1f1712,null));};exports[_0x0102('0x1e')]=function(_0x21b162,_0x20a004){return respondWithRpcPromise(_0x0102('0x1f'),_[_0x0102('0x1b')](_0x21b162['query'],_0x21b162['params']))['then'](respondWithResult(_0x20a004,null))[_0x0102('0x1d')](handleError(_0x20a004,null));};exports[_0x0102('0x20')]=function(_0x3529b5,_0x46e4d2){return respondWithRpcPromise(_0x0102('0x21'),_0x3529b5[_0x0102('0x18')])[_0x0102('0x9')](respondWithResult(_0x46e4d2,null))[_0x0102('0x1d')](handleError(_0x46e4d2,null));};exports[_0x0102('0x22')]=function(_0x3523f9,_0x11159d){return respondWithRpcPromise(_0x0102('0x21'),_0x3523f9['query'])[_0x0102('0x9')](findById(_0x3523f9[_0x0102('0x1c')]['id']))['then'](respondWithResult(_0x11159d,null))[_0x0102('0x1d')](handleError(_0x11159d,null));};exports[_0x0102('0x23')]=function(_0x24087d,_0x16ed90){return respondWithRpcPromise(_0x0102('0x24'),_['merge'](_0x24087d['body'],_0x24087d[_0x0102('0x1c')]))['then'](respondWithResult(_0x16ed90,null))[_0x0102('0x1d')](handleError(_0x16ed90,null));};exports[_0x0102('0x25')]=function(_0x2541f3,_0x34f349){return respondWithRpcPromise(_0x0102('0x26'),_['merge'](_0x2541f3[_0x0102('0x18')],_0x2541f3[_0x0102('0x1c')]))[_0x0102('0x9')](respondWithResult(_0x34f349,null))['catch'](handleError(_0x34f349,null));};exports['voiceQueuesChannels']=function(_0x355ae6,_0x51e11f){return respondWithRpcPromise(_0x0102('0x27'),_0x355ae6[_0x0102('0x18')])[_0x0102('0x9')](respondWithResult(_0x51e11f,null))['catch'](handleError(_0x51e11f,null));};exports[_0x0102('0x28')]=function(_0x3ee67b,_0x53b253){return respondWithRpcPromise(_0x0102('0x29'),_[_0x0102('0x1b')](_0x3ee67b[_0x0102('0x18')],_0x3ee67b[_0x0102('0x1c')]))[_0x0102('0x9')](respondWithResult(_0x53b253,null))[_0x0102('0x1d')](handleError(_0x53b253,null));};exports[_0x0102('0x2a')]=function(_0x35a672,_0x52bce8){return respondWithRpcPromise(_0x0102('0x2b'),_['merge'](_0x35a672[_0x0102('0x18')],_0x35a672['params']))[_0x0102('0x9')](respondWithResult(_0x52bce8,null))[_0x0102('0x1d')](handleError(_0x52bce8,null));};exports[_0x0102('0x2c')]=function(_0xc1ec1a,_0x17443b){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x0102('0x1b')](_0xc1ec1a[_0x0102('0x18')],_0xc1ec1a[_0x0102('0x1c')]))[_0x0102('0x9')](respondWithResult(_0x17443b,null))['catch'](handleError(_0x17443b,null));};exports[_0x0102('0x2d')]=function(_0x44f73f,_0x20d821){return respondWithRpcPromise(_0x0102('0x2e'),_0x44f73f[_0x0102('0x18')])[_0x0102('0x9')](respondWithResult(_0x20d821,null))[_0x0102('0x1d')](handleError(_0x20d821,null));};exports['outboundChannels']=function(_0x3304a8,_0x49a801){return respondWithRpcPromise(_0x0102('0x2f'),_0x3304a8[_0x0102('0x18')])[_0x0102('0x9')](respondWithResult(_0x49a801,null))[_0x0102('0x1d')](handleError(_0x49a801,null));};exports['agents']=function(_0x4b7d46,_0x16a361){var _0x4082bb;return respondWithRpcPromise('Agents',_0x4b7d46[_0x0102('0x18')])[_0x0102('0x9')](function(_0xdf17cc){_0x4082bb=_0xdf17cc;return respondWithRpcPromise(_0x0102('0x30'),_0x4b7d46['query'],routingClient);})['then'](function(_0x25c5cc){return _[_0x0102('0x1b')]({},_0x25c5cc,_0x4082bb);})[_0x0102('0x9')](respondWithResult(_0x16a361,null))[_0x0102('0x1d')](handleError(_0x16a361,null));};exports[_0x0102('0x31')]=function(_0x1010e5,_0x3d6728){if(_0x1010e5[_0x0102('0x32')]&&_0x1010e5[_0x0102('0x32')][_0x0102('0x33')]&&_0x1010e5[_0x0102('0x34')]&&_0x1010e5['user'][_0x0102('0x11')]){for(var _0x3de077 in _0x1010e5[_0x0102('0x32')][_0x0102('0x33')]){if(_0x1010e5[_0x0102('0x32')]['interaction']['hasOwnProperty'](_0x3de077)){db['MemberReport'][_0x0102('0x35')]({'where':{'channel':_0x3de077,'membername':_0x1010e5[_0x0102('0x34')]['name'],'type':_0x0102('0x36'),'exitAt':null,'uniqueid':_0x1010e5['body'][_0x0102('0x33')][_0x3de077]&&_0x1010e5[_0x0102('0x32')][_0x0102('0x33')][_0x3de077][_0x0102('0x37')]?{'$notIn':_0x1010e5[_0x0102('0x32')][_0x0102('0x33')][_0x3de077]}:{'$ne':null}}})[_0x0102('0x9')](function(_0x6e7883){var _0x14b5c7=moment()[_0x0102('0x38')](_0x0102('0x39'));for(var _0x9f7696=0x0,_0x339e21=_0x6e7883[_0x0102('0x37')];_0x9f7696<_0x339e21;_0x9f7696+=0x1){_0x6e7883[_0x9f7696]['updateAttributes']({'exitAt':_0x14b5c7});}});for(var _0x2b98f1=0x0;_0x2b98f1<_0x1010e5['body']['interaction'][_0x3de077][_0x0102('0x37')];_0x2b98f1+=0x1){db[_0x0102('0x3a')][_0x0102('0x3b')]({'where':{'channel':_0x3de077,'membername':_0x1010e5['user']['name'],'type':'INTERACTION','uniqueid':_0x1010e5[_0x0102('0x32')][_0x0102('0x33')][_0x3de077][_0x2b98f1],'exitAt':null},'defaults':{'channel':_0x3de077,'membername':_0x1010e5[_0x0102('0x34')]['name'],'interface':_[_0x0102('0x13')](_0x1010e5[_0x0102('0x34')][_0x0102('0x3c')])?util[_0x0102('0x38')](_0x0102('0x3d'),_0x1010e5[_0x0102('0x34')][_0x0102('0x11')]):_0x1010e5[_0x0102('0x34')][_0x0102('0x3c')],'type':_0x0102('0x36'),'enterAt':moment()[_0x0102('0x38')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x0102('0x3e'),'internal':_0x1010e5[_0x0102('0x34')][_0x0102('0x3f')],'uniqueid':_0x1010e5[_0x0102('0x32')][_0x0102('0x33')][_0x3de077][_0x2b98f1]}});}}}}return respondWithRpcPromise(_0x0102('0x40'),{'id':_0x1010e5[_0x0102('0x1c')]['id'],'capacity':_0x1010e5[_0x0102('0x32')][_0x0102('0x41')]},routingClient)[_0x0102('0x9')](respondWithResult(_0x3d6728,null))[_0x0102('0x1d')](handleError(_0x3d6728,null));};exports[_0x0102('0x42')]=function(_0x3502f0,_0x5c2715){return respondWithRpcPromise(_0x0102('0x43'),_0x3502f0[_0x0102('0x18')])[_0x0102('0x9')](respondWithResult(_0x5c2715,null))[_0x0102('0x1d')](handleError(_0x5c2715,null));};exports['trunks']=function(_0x1941a9,_0x4c0ff8){return respondWithRpcPromise(_0x0102('0x44'),_0x1941a9[_0x0102('0x18')])['then'](respondWithResult(_0x4c0ff8,null))[_0x0102('0x1d')](handleError(_0x4c0ff8,null));};exports['campaigns']=function(_0x5e6ac2,_0x207fd4){return respondWithRpcPromise(_0x0102('0x45'),_0x5e6ac2['query'])[_0x0102('0x9')](respondWithResult(_0x207fd4,null))[_0x0102('0x1d')](handleError(_0x207fd4,null));};exports[_0x0102('0x46')]=function(_0x42b6a4,_0x4dd173){return respondWithRpcPromise(_0x0102('0x47'),_0x42b6a4[_0x0102('0x18')],routingClient)[_0x0102('0x9')](respondWithResult(_0x4dd173,null))[_0x0102('0x1d')](handleError(_0x4dd173,null));};exports[_0x0102('0x48')]=function(_0x19d838,_0x547495){return respondWithRpcPromise(_0x0102('0x47'),_0x19d838[_0x0102('0x18')],routingClient)[_0x0102('0x9')](findById(_0x19d838[_0x0102('0x1c')]['id']))['then'](respondWithResult(_0x547495,null))['catch'](handleError(_0x547495,null));};exports['mailQueues']=function(_0xd8bfcb,_0x39d77b){return respondWithRpcPromise(_0x0102('0x49'),_0xd8bfcb[_0x0102('0x18')],routingClient)['then'](respondWithResult(_0x39d77b,null))[_0x0102('0x1d')](handleError(_0x39d77b,null));};exports[_0x0102('0x4a')]=function(_0xd893c5,_0x5a5910){return respondWithRpcPromise('MailQueues',_0xd893c5[_0x0102('0x18')],routingClient)['then'](findById(_0xd893c5[_0x0102('0x1c')]['id']))[_0x0102('0x9')](respondWithResult(_0x5a5910,null))[_0x0102('0x1d')](handleError(_0x5a5910,null));};exports[_0x0102('0x4b')]=function(_0x816369,_0x3d7a57){return respondWithRpcPromise(_0x0102('0x4c'),_0x816369[_0x0102('0x18')],mailClient)[_0x0102('0x9')](respondWithResult(_0x3d7a57,null))[_0x0102('0x1d')](handleError(_0x3d7a57,null));};exports[_0x0102('0x4d')]=function(_0x3d5444,_0x549c6e){return respondWithRpcPromise(_0x0102('0x4e'),_0x3d5444[_0x0102('0x18')],routingClient)['then'](respondWithResult(_0x549c6e,null))[_0x0102('0x1d')](handleError(_0x549c6e,null));};exports[_0x0102('0x4f')]=function(_0x43b801,_0x108e1f){return respondWithRpcPromise(_0x0102('0x4e'),_0x43b801['query'],routingClient)[_0x0102('0x9')](findById(_0x43b801[_0x0102('0x1c')]['id']))[_0x0102('0x9')](respondWithResult(_0x108e1f,null))[_0x0102('0x1d')](handleError(_0x108e1f,null));};exports[_0x0102('0x50')]=function(_0xe84664,_0x495f99){return respondWithRpcPromise(_0x0102('0x51'),_0xe84664[_0x0102('0x18')],routingClient)[_0x0102('0x9')](respondWithResult(_0x495f99,null))[_0x0102('0x1d')](handleError(_0x495f99,null));};exports['showSmsQueues']=function(_0x45ffc3,_0x6240a1){return respondWithRpcPromise(_0x0102('0x51'),_0x45ffc3['query'],routingClient)[_0x0102('0x9')](findById(_0x45ffc3[_0x0102('0x1c')]['id']))[_0x0102('0x9')](respondWithResult(_0x6240a1,null))[_0x0102('0x1d')](handleError(_0x6240a1,null));};exports[_0x0102('0x52')]=function(_0x9b121,_0x4d2eb5){return respondWithRpcPromise('WhatsappQueues',_0x9b121[_0x0102('0x18')],routingClient)[_0x0102('0x9')](respondWithResult(_0x4d2eb5,null))[_0x0102('0x1d')](handleError(_0x4d2eb5,null));};exports[_0x0102('0x53')]=function(_0x1b5b14,_0x2954b4){return respondWithRpcPromise(_0x0102('0x54'),_0x1b5b14[_0x0102('0x18')],routingClient)['then'](findById(_0x1b5b14[_0x0102('0x1c')]['id']))[_0x0102('0x9')](respondWithResult(_0x2954b4,null))[_0x0102('0x1d')](handleError(_0x2954b4,null));};exports['faxQueues']=function(_0x244086,_0x45bdcb){return respondWithRpcPromise(_0x0102('0x55'),_0x244086[_0x0102('0x18')],routingClient)[_0x0102('0x9')](respondWithResult(_0x45bdcb,null))[_0x0102('0x1d')](handleError(_0x45bdcb,null));};exports[_0x0102('0x56')]=function(_0x925261,_0x2986f1){return respondWithRpcPromise(_0x0102('0x55'),_0x925261[_0x0102('0x18')],routingClient)[_0x0102('0x9')](findById(_0x925261[_0x0102('0x1c')]['id']))['then'](respondWithResult(_0x2986f1,null))[_0x0102('0x1d')](handleError(_0x2986f1,null));};exports[_0x0102('0x57')]=function(_0x58e7b5,_0x477a44){return respondWithRpcPromise(_0x0102('0x58'),_0x58e7b5[_0x0102('0x18')])[_0x0102('0x9')](respondWithResult(_0x477a44,null))[_0x0102('0x1d')](handleError(_0x477a44,null));};exports[_0x0102('0x59')]=function(_0x593f00,_0x2fe611){return respondWithRpcPromise(_0x0102('0x5a'),_0x593f00['query'],routingClient)[_0x0102('0x9')](respondWithResult(_0x2fe611,null))[_0x0102('0x1d')](handleError(_0x2fe611,null));};exports[_0x0102('0x5b')]=function(_0x27502f,_0x1f8161){return respondWithRpcPromise(_0x0102('0x5c'),_0x27502f['query'],routingClient)[_0x0102('0x9')](respondWithResult(_0x1f8161,null))[_0x0102('0x1d')](handleError(_0x1f8161,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x215049,_0x1d837f){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x215049[_0x0102('0x18')],routingClient)[_0x0102('0x9')](respondWithResult(_0x1d837f,null))[_0x0102('0x1d')](handleError(_0x1d837f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x229ef3,_0x337c13){return respondWithRpcPromise(_0x0102('0x5d'),_0x229ef3[_0x0102('0x18')],routingClient)[_0x0102('0x9')](function(_0x5eddec){if(_0x229ef3['query']['type']!==undefined){var _0x8fda24=_(_0x5eddec['rows'])[_0x0102('0x5e')]([_0x229ef3[_0x0102('0x18')][_0x0102('0x5f')],_0x229ef3[_0x0102('0x1c')]['id']])[_0x0102('0x60')](_0x0102('0x61'))[_0x0102('0x62')]()[_0x0102('0x63')]();return _0x5eddec[_0x0102('0x14')]['filter'](function(_0x5aa729){return _0x8fda24[_0x0102('0x64')](_0x5aa729['queue_id'])>-0x1;});}else{return _0x5eddec[_0x0102('0x14')][_0x0102('0x5e')](function(_0x3de3ee){return _0x3de3ee[_0x0102('0x61')]===parseInt(_0x229ef3[_0x0102('0x1c')]['id']);});}})[_0x0102('0x9')](respondWithResult(_0x337c13,null))[_0x0102('0x1d')](handleError(_0x337c13,null));};exports[_0x0102('0x65')]=function(_0x1e1535,_0x41994e){return respondWithRpcPromise(_0x0102('0x66'),_0x1e1535[_0x0102('0x18')],routingClient)[_0x0102('0x9')](respondWithResult(_0x41994e,null))[_0x0102('0x1d')](handleError(_0x41994e,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x18125e,_0x525f2f){return respondWithRpcPromise(_0x0102('0x67'),_0x18125e[_0x0102('0x18')],routingClient)[_0x0102('0x9')](respondWithResult(_0x525f2f,null))[_0x0102('0x1d')](handleError(_0x525f2f,null));};exports[_0x0102('0x68')]=function(_0x44945c,_0x5ca297){return respondWithRpcPromise(_0x0102('0x69'),_0x44945c['query'],routingClient)[_0x0102('0x9')](respondWithResult(_0x5ca297,null))[_0x0102('0x1d')](handleError(_0x5ca297,null));};exports[_0x0102('0x6a')]=function(_0x5d690f){return function(_0x4eb13c,_0x36b758){var _0x48af28,_0x5006a7;var _0x19f0ca=_[_0x0102('0x6b')](_0x5d690f);var _0x32e12e=_0x5d690f==='chat'?_0x0102('0x6c'):_0x0102('0x6d');return db[_0x19f0ca+'Queue'][_0x0102('0x6e')]({'raw':!![],'where':{'id':_0x4eb13c[_0x0102('0x1c')]['id']}})['then'](function(_0x35aa5c){if(_[_0x0102('0x13')](_0x35aa5c)){throw new Error(_0x19f0ca+_0x0102('0x6f'));}_0x48af28=_0x35aa5c;return db[_0x19f0ca+_0x0102('0x70')][_0x0102('0x6e')]({'where':{'id':_0x4eb13c[_0x0102('0x32')][_0x0102('0x71')]},'include':[{'model':db[_0x19f0ca+'Interaction'],'as':'Interaction'},{'model':db[_0x19f0ca+_0x32e12e],'as':_0x0102('0x6d')}]});})[_0x0102('0x9')](function(_0x39c8a7){if(_[_0x0102('0x13')](_0x39c8a7)){throw new Error(_0x19f0ca+'\x20Message\x20not\x20found');}_0x5006a7=_0x39c8a7;return _0x39c8a7[_0x0102('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0102('0x9')](function(){var _0x796a19={'uniqueid':_0x5d690f+'.'+_0x5006a7['id']+'.'+_0x5006a7['Interaction']['id'],'FromUserId':_0x4eb13c['user']['id'],'type':_0x0102('0x73')};_0x796a19[_0x19f0ca+_0x0102('0x74')]=_0x5006a7['id'];_0x796a19[_0x19f0ca+_0x0102('0x75')]=_0x5006a7[_0x0102('0x76')]['id'];_0x796a19[_0x0102('0x77')+_0x19f0ca+_0x32e12e+'Id']=_0x5006a7[_0x0102('0x6d')]['id'];_0x796a19['To'+_0x19f0ca+_0x0102('0x78')]=_0x48af28['id'];return db[_0x19f0ca+'TransferReport'][_0x0102('0x79')](_0x796a19);})['then'](function(){return respondWithRpcPromise(_0x0102('0x7a'),{'channel':_0x5d690f,'interaction':_0x5006a7[_0x0102('0x76')],'message':_0x5006a7,'account':_0x5006a7[_0x0102('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x48af28[_0x0102('0x11')]+','+(_0x5006a7[_0x0102('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x0102('0x7b')}]},routingClient);})[_0x0102('0x9')](respondWithResult(_0x36b758,null))['catch'](handleError(_0x36b758,null));};};exports[_0x0102('0x7c')]=function(_0x1f2306,_0x24f5ac){var _0x2ef0c4,_0x43717c;if(_[_0x0102('0x13')](_0x1f2306['body'][_0x0102('0x7d')])){throw new Error(_0x0102('0x7e'));}var _0x35d29c=_0x1f2306[_0x0102('0x32')]['channel'];var _0x1ac437=_[_0x0102('0x6b')](_0x35d29c);var _0x3e4cd5=_0x35d29c===_0x0102('0x7f')?_0x0102('0x6c'):_0x0102('0x6d');return db['User']['findOne']({'raw':!![],'where':{'id':_0x1f2306[_0x0102('0x1c')]['id'],'role':'agent'}})['then'](function(_0x32638e){if(_[_0x0102('0x13')](_0x32638e)){throw new Error(_0x0102('0x80'));}_0x2ef0c4=_0x32638e;return db[_0x1ac437+_0x0102('0x70')][_0x0102('0x6e')]({'where':{'id':_0x1f2306[_0x0102('0x32')][_0x0102('0x71')]},'include':[{'model':db[_0x1ac437+'Interaction'],'as':'Interaction'},{'model':db[_0x1ac437+_0x3e4cd5],'as':_0x0102('0x6d')}]});})[_0x0102('0x9')](function(_0x11f868){if(_['isNil'](_0x11f868)){throw new Error(_0x1ac437+_0x0102('0x81'));}_0x43717c=_0x11f868;return _0x11f868[_0x0102('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0102('0x9')](function(){var _0x510d02={'uniqueid':_0x35d29c+'.'+_0x43717c['id']+'.'+_0x43717c[_0x0102('0x76')]['id'],'FromUserId':_0x1f2306[_0x0102('0x34')]['id'],'type':_0x0102('0x3e'),'ToUserId':_0x2ef0c4['id']};_0x510d02[_0x1ac437+_0x0102('0x74')]=_0x43717c['id'];_0x510d02[_0x1ac437+_0x0102('0x75')]=_0x43717c[_0x0102('0x76')]['id'];_0x510d02[_0x0102('0x77')+_0x1ac437+_0x3e4cd5+'Id']=_0x43717c['Account']['id'];return db[_0x1ac437+_0x0102('0x82')][_0x0102('0x79')](_0x510d02);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x35d29c,'interaction':_0x43717c[_0x0102('0x76')],'message':_0x43717c,'account':_0x43717c['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x0102('0x3e'),'appdata':_0x2ef0c4[_0x0102('0x11')]+','+(_0x43717c['Account']['agentTransferTimeout']||0x12c),'interval':_0x0102('0x7b')}]},routingClient);})[_0x0102('0x9')](respondWithResult(_0x24f5ac,null))['catch'](handleError(_0x24f5ac,null));}; \ No newline at end of file +var _0xcd8d=['agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','message','result','catch','status','json','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','AgentCapacity','capacity','Telephones','trunks','Campaigns','chatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','\x20Message\x20not\x20found'];(function(_0x2c03c5,_0x175c6e){var _0x14b25a=function(_0x596455){while(--_0x596455){_0x2c03c5['push'](_0x2c03c5['shift']());}};_0x14b25a(++_0x175c6e);}(_0xcd8d,0x172));var _0xdcd8=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0xcd8d[_0x56fb33];return _0x435ee4;};'use strict';var BPromise=require(_0xdcd8('0x0'));var moment=require(_0xdcd8('0x1'));var _=require(_0xdcd8('0x2'));var util=require('util');var db=require(_0xdcd8('0x3'))['db'];var logger=require(_0xdcd8('0x4'))(_0xdcd8('0x5'));var jayson=require(_0xdcd8('0x6'));var amiClient=jayson[_0xdcd8('0x7')][_0xdcd8('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0xdcd8('0x8')]({'port':0x232b});var routingClient=jayson[_0xdcd8('0x7')][_0xdcd8('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x4c609d,_0x40af5c,_0x4ced63){return new BPromise(function(_0x2e25f2,_0x5f081a){var _0x393fc8=_0x4ced63?_0x4ced63:amiClient;return _0x393fc8[_0xdcd8('0x9')](_0x4c609d,_0x40af5c)['then'](function(_0x3536eb){if(_0x3536eb[_0xdcd8('0xa')]){if(_0x3536eb[_0xdcd8('0xa')]['code']===0x1f4){return _0x5f081a(_0x3536eb['error']['message']);}return _0x2e25f2(_0x3536eb[_0xdcd8('0xa')][_0xdcd8('0xb')]);}else{_0x2e25f2(_0x3536eb[_0xdcd8('0xc')]);}})[_0xdcd8('0xd')](function(_0x100220){_0x5f081a(_0x100220);});});}function respondWithResult(_0x1d58b0,_0x2a7cb8){_0x2a7cb8=_0x2a7cb8||0xc8;return function(_0x351e84){if(_0x351e84){return _0x1d58b0[_0xdcd8('0xe')](_0x2a7cb8)[_0xdcd8('0xf')](_0x351e84);}return _0x1d58b0['sendStatus'](0x194);};}function handleError(_0x57c8f9,_0x45cfb8){_0x45cfb8=_0x45cfb8||0x1f4;return function(_0x49aeb8){logger['error'](_0x49aeb8['stack']);if(_0x49aeb8['name']){delete _0x49aeb8[_0xdcd8('0x10')];}_0x57c8f9['status'](_0x45cfb8)[_0xdcd8('0x11')](_0x49aeb8);};}function findById(_0x3a9a1d){return function(_0x5230c9){if(!_['isNil'](_0x3a9a1d)&&!_['isNil'](_0x5230c9)&&!_[_0xdcd8('0x12')](_0x5230c9[_0xdcd8('0x13')])){return _[_0xdcd8('0x14')](_0x5230c9['rows'],function(_0x5278f5){return _0x5278f5['id']==_0x3a9a1d;});}return null;};}exports[_0xdcd8('0x15')]=function(_0x33041f,_0x218f91){return respondWithRpcPromise(_0xdcd8('0x16'),_0x33041f[_0xdcd8('0x17')])[_0xdcd8('0x18')](respondWithResult(_0x218f91,null))['catch'](handleError(_0x218f91,null));};exports[_0xdcd8('0x19')]=function(_0x156b97,_0x2e1047){return respondWithRpcPromise(_0xdcd8('0x1a'),_[_0xdcd8('0x1b')](_0x156b97[_0xdcd8('0x17')],_0x156b97[_0xdcd8('0x1c')]))[_0xdcd8('0x18')](respondWithResult(_0x2e1047,null))[_0xdcd8('0xd')](handleError(_0x2e1047,null));};exports['voiceChannelStopMixMonitor']=function(_0x56d397,_0x5213a7){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xdcd8('0x1b')](_0x56d397[_0xdcd8('0x17')],_0x56d397[_0xdcd8('0x1c')]))[_0xdcd8('0x18')](respondWithResult(_0x5213a7,null))['catch'](handleError(_0x5213a7,null));};exports[_0xdcd8('0x1d')]=function(_0x352bfd,_0x57bd77){return respondWithRpcPromise(_0xdcd8('0x1e'),_0x352bfd['query'])[_0xdcd8('0x18')](respondWithResult(_0x57bd77,null))['catch'](handleError(_0x57bd77,null));};exports[_0xdcd8('0x1f')]=function(_0x39549d,_0x484e5a){return respondWithRpcPromise(_0xdcd8('0x1e'),_0x39549d['query'])[_0xdcd8('0x18')](findById(_0x39549d[_0xdcd8('0x1c')]['id']))[_0xdcd8('0x18')](respondWithResult(_0x484e5a,null))[_0xdcd8('0xd')](handleError(_0x484e5a,null));};exports[_0xdcd8('0x20')]=function(_0x83927f,_0x3023f1){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xdcd8('0x1b')](_0x83927f[_0xdcd8('0x21')],_0x83927f[_0xdcd8('0x1c')]))[_0xdcd8('0x18')](respondWithResult(_0x3023f1,null))[_0xdcd8('0xd')](handleError(_0x3023f1,null));};exports[_0xdcd8('0x22')]=function(_0x129e81,_0x3fa943){return respondWithRpcPromise(_0xdcd8('0x23'),_[_0xdcd8('0x1b')](_0x129e81[_0xdcd8('0x17')],_0x129e81[_0xdcd8('0x1c')]))[_0xdcd8('0x18')](respondWithResult(_0x3fa943,null))[_0xdcd8('0xd')](handleError(_0x3fa943,null));};exports[_0xdcd8('0x24')]=function(_0x10b9fd,_0x2c86ef){return respondWithRpcPromise('VoiceQueuesChannels',_0x10b9fd[_0xdcd8('0x17')])[_0xdcd8('0x18')](respondWithResult(_0x2c86ef,null))[_0xdcd8('0xd')](handleError(_0x2c86ef,null));};exports[_0xdcd8('0x25')]=function(_0x4611f0,_0x1b7752){return respondWithRpcPromise(_0xdcd8('0x26'),_[_0xdcd8('0x1b')](_0x4611f0[_0xdcd8('0x17')],_0x4611f0[_0xdcd8('0x1c')]))['then'](respondWithResult(_0x1b7752,null))[_0xdcd8('0xd')](handleError(_0x1b7752,null));};exports[_0xdcd8('0x27')]=function(_0xfebff0,_0x5b17ca){return respondWithRpcPromise(_0xdcd8('0x28'),_['merge'](_0xfebff0['query'],_0xfebff0[_0xdcd8('0x1c')]))[_0xdcd8('0x18')](respondWithResult(_0x5b17ca,null))['catch'](handleError(_0x5b17ca,null));};exports[_0xdcd8('0x29')]=function(_0x32db31,_0x5ebc4d){return respondWithRpcPromise(_0xdcd8('0x2a'),_[_0xdcd8('0x1b')](_0x32db31[_0xdcd8('0x17')],_0x32db31[_0xdcd8('0x1c')]))[_0xdcd8('0x18')](respondWithResult(_0x5ebc4d,null))[_0xdcd8('0xd')](handleError(_0x5ebc4d,null));};exports[_0xdcd8('0x2b')]=function(_0x476bed,_0x3e4803){return respondWithRpcPromise('Outbound',_0x476bed[_0xdcd8('0x17')])[_0xdcd8('0x18')](respondWithResult(_0x3e4803,null))[_0xdcd8('0xd')](handleError(_0x3e4803,null));};exports['outboundChannels']=function(_0x18f938,_0x515661){return respondWithRpcPromise(_0xdcd8('0x2c'),_0x18f938['query'])['then'](respondWithResult(_0x515661,null))[_0xdcd8('0xd')](handleError(_0x515661,null));};exports['agents']=function(_0x562e7c,_0x493942){var _0xb719c7;return respondWithRpcPromise(_0xdcd8('0x2d'),_0x562e7c[_0xdcd8('0x17')])[_0xdcd8('0x18')](function(_0x11258d){_0xb719c7=_0x11258d;return respondWithRpcPromise(_0xdcd8('0x2d'),_0x562e7c[_0xdcd8('0x17')],routingClient);})[_0xdcd8('0x18')](function(_0x472ec0){return _[_0xdcd8('0x1b')]({},_0x472ec0,_0xb719c7);})[_0xdcd8('0x18')](respondWithResult(_0x493942,null))[_0xdcd8('0xd')](handleError(_0x493942,null));};exports[_0xdcd8('0x2e')]=function(_0x5a33c3,_0x4b5345){if(_0x5a33c3['body']&&_0x5a33c3['body']['interaction']&&_0x5a33c3[_0xdcd8('0x2f')]&&_0x5a33c3[_0xdcd8('0x2f')][_0xdcd8('0x10')]){for(var _0x4869c3 in _0x5a33c3[_0xdcd8('0x21')][_0xdcd8('0x30')]){if(_0x5a33c3[_0xdcd8('0x21')][_0xdcd8('0x30')][_0xdcd8('0x31')](_0x4869c3)){db[_0xdcd8('0x32')][_0xdcd8('0x33')]({'where':{'channel':_0x4869c3,'membername':_0x5a33c3['user'][_0xdcd8('0x10')],'type':_0xdcd8('0x34'),'exitAt':null,'uniqueid':_0x5a33c3['body'][_0xdcd8('0x30')][_0x4869c3]&&_0x5a33c3['body'][_0xdcd8('0x30')][_0x4869c3][_0xdcd8('0x35')]?{'$notIn':_0x5a33c3[_0xdcd8('0x21')][_0xdcd8('0x30')][_0x4869c3]}:{'$ne':null}}})[_0xdcd8('0x18')](function(_0x45ab0a){var _0xb3bf7c=moment()[_0xdcd8('0x36')](_0xdcd8('0x37'));for(var _0x2c1c5a=0x0,_0x1e9a67=_0x45ab0a[_0xdcd8('0x35')];_0x2c1c5a<_0x1e9a67;_0x2c1c5a+=0x1){_0x45ab0a[_0x2c1c5a][_0xdcd8('0x38')]({'exitAt':_0xb3bf7c});}});for(var _0x21fdb0=0x0;_0x21fdb0<_0x5a33c3[_0xdcd8('0x21')][_0xdcd8('0x30')][_0x4869c3][_0xdcd8('0x35')];_0x21fdb0+=0x1){db[_0xdcd8('0x32')][_0xdcd8('0x39')]({'where':{'channel':_0x4869c3,'membername':_0x5a33c3['user'][_0xdcd8('0x10')],'type':_0xdcd8('0x34'),'uniqueid':_0x5a33c3[_0xdcd8('0x21')][_0xdcd8('0x30')][_0x4869c3][_0x21fdb0],'exitAt':null},'defaults':{'channel':_0x4869c3,'membername':_0x5a33c3[_0xdcd8('0x2f')][_0xdcd8('0x10')],'interface':_[_0xdcd8('0x12')](_0x5a33c3['user']['interface'])?util[_0xdcd8('0x36')]('SIP/%s',_0x5a33c3['user']['name']):_0x5a33c3[_0xdcd8('0x2f')][_0xdcd8('0x3a')],'type':'INTERACTION','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xdcd8('0x3b'),'internal':_0x5a33c3[_0xdcd8('0x2f')]['internal'],'uniqueid':_0x5a33c3[_0xdcd8('0x21')]['interaction'][_0x4869c3][_0x21fdb0]}});}}}}return respondWithRpcPromise(_0xdcd8('0x3c'),{'id':_0x5a33c3[_0xdcd8('0x1c')]['id'],'capacity':_0x5a33c3[_0xdcd8('0x21')][_0xdcd8('0x3d')]},routingClient)['then'](respondWithResult(_0x4b5345,null))[_0xdcd8('0xd')](handleError(_0x4b5345,null));};exports['telephones']=function(_0xecadb1,_0x1b3c21){return respondWithRpcPromise(_0xdcd8('0x3e'),_0xecadb1[_0xdcd8('0x17')])['then'](respondWithResult(_0x1b3c21,null))['catch'](handleError(_0x1b3c21,null));};exports[_0xdcd8('0x3f')]=function(_0x11e418,_0x53227c){return respondWithRpcPromise('Trunks',_0x11e418[_0xdcd8('0x17')])['then'](respondWithResult(_0x53227c,null))['catch'](handleError(_0x53227c,null));};exports['campaigns']=function(_0x1a2ae7,_0x315f44){return respondWithRpcPromise(_0xdcd8('0x40'),_0x1a2ae7[_0xdcd8('0x17')])[_0xdcd8('0x18')](respondWithResult(_0x315f44,null))[_0xdcd8('0xd')](handleError(_0x315f44,null));};exports[_0xdcd8('0x41')]=function(_0x17b3a5,_0x5920bb){return respondWithRpcPromise(_0xdcd8('0x42'),_0x17b3a5['query'],routingClient)[_0xdcd8('0x18')](respondWithResult(_0x5920bb,null))[_0xdcd8('0xd')](handleError(_0x5920bb,null));};exports['showChatQueues']=function(_0x197243,_0x2936df){return respondWithRpcPromise(_0xdcd8('0x42'),_0x197243[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](findById(_0x197243['params']['id']))[_0xdcd8('0x18')](respondWithResult(_0x2936df,null))[_0xdcd8('0xd')](handleError(_0x2936df,null));};exports['mailQueues']=function(_0xe4d100,_0x596cb0){return respondWithRpcPromise(_0xdcd8('0x43'),_0xe4d100[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](respondWithResult(_0x596cb0,null))[_0xdcd8('0xd')](handleError(_0x596cb0,null));};exports[_0xdcd8('0x44')]=function(_0x59c3ca,_0x430fbb){return respondWithRpcPromise('MailQueues',_0x59c3ca[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](findById(_0x59c3ca[_0xdcd8('0x1c')]['id']))[_0xdcd8('0x18')](respondWithResult(_0x430fbb,null))['catch'](handleError(_0x430fbb,null));};exports[_0xdcd8('0x45')]=function(_0x594453,_0x50926e){return respondWithRpcPromise('MailAccounts',_0x594453[_0xdcd8('0x17')],mailClient)[_0xdcd8('0x18')](respondWithResult(_0x50926e,null))['catch'](handleError(_0x50926e,null));};exports[_0xdcd8('0x46')]=function(_0x55116b,_0xfb953c){return respondWithRpcPromise(_0xdcd8('0x47'),_0x55116b['query'],routingClient)[_0xdcd8('0x18')](respondWithResult(_0xfb953c,null))[_0xdcd8('0xd')](handleError(_0xfb953c,null));};exports[_0xdcd8('0x48')]=function(_0x366fe0,_0xda7b24){return respondWithRpcPromise(_0xdcd8('0x47'),_0x366fe0[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](findById(_0x366fe0[_0xdcd8('0x1c')]['id']))[_0xdcd8('0x18')](respondWithResult(_0xda7b24,null))[_0xdcd8('0xd')](handleError(_0xda7b24,null));};exports['smsQueues']=function(_0x672045,_0x5816d2){return respondWithRpcPromise(_0xdcd8('0x49'),_0x672045[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](respondWithResult(_0x5816d2,null))['catch'](handleError(_0x5816d2,null));};exports[_0xdcd8('0x4a')]=function(_0xe6b9fc,_0x74fc71){return respondWithRpcPromise(_0xdcd8('0x49'),_0xe6b9fc[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](findById(_0xe6b9fc[_0xdcd8('0x1c')]['id']))[_0xdcd8('0x18')](respondWithResult(_0x74fc71,null))['catch'](handleError(_0x74fc71,null));};exports[_0xdcd8('0x4b')]=function(_0x463bde,_0x557f60){return respondWithRpcPromise('WhatsappQueues',_0x463bde[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](respondWithResult(_0x557f60,null))[_0xdcd8('0xd')](handleError(_0x557f60,null));};exports['showWhatsappQueues']=function(_0x53cb75,_0x15deb3){return respondWithRpcPromise('WhatsappQueues',_0x53cb75['query'],routingClient)['then'](findById(_0x53cb75[_0xdcd8('0x1c')]['id']))['then'](respondWithResult(_0x15deb3,null))[_0xdcd8('0xd')](handleError(_0x15deb3,null));};exports['faxQueues']=function(_0x2f6ba3,_0x2c8b7e){return respondWithRpcPromise(_0xdcd8('0x4c'),_0x2f6ba3[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](respondWithResult(_0x2c8b7e,null))[_0xdcd8('0xd')](handleError(_0x2c8b7e,null));};exports[_0xdcd8('0x4d')]=function(_0x2ed7e4,_0x2371f0){return respondWithRpcPromise('FaxQueues',_0x2ed7e4[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](findById(_0x2ed7e4[_0xdcd8('0x1c')]['id']))[_0xdcd8('0x18')](respondWithResult(_0x2371f0,null))[_0xdcd8('0xd')](handleError(_0x2371f0,null));};exports[_0xdcd8('0x4e')]=function(_0x5eca5d,_0x3ccbec){return respondWithRpcPromise(_0xdcd8('0x4f'),_0x5eca5d[_0xdcd8('0x17')])[_0xdcd8('0x18')](respondWithResult(_0x3ccbec,null))[_0xdcd8('0xd')](handleError(_0x3ccbec,null));};exports[_0xdcd8('0x50')]=function(_0x2da24d,_0x3fb1de){return respondWithRpcPromise(_0xdcd8('0x51'),_0x2da24d[_0xdcd8('0x17')],routingClient)['then'](respondWithResult(_0x3fb1de,null))[_0xdcd8('0xd')](handleError(_0x3fb1de,null));};exports[_0xdcd8('0x52')]=function(_0x32d0c6,_0x372dcf){return respondWithRpcPromise(_0xdcd8('0x53'),_0x32d0c6['query'],routingClient)[_0xdcd8('0x18')](respondWithResult(_0x372dcf,null))[_0xdcd8('0xd')](handleError(_0x372dcf,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x19e1a3,_0x4a1c43){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x19e1a3[_0xdcd8('0x17')],routingClient)['then'](respondWithResult(_0x4a1c43,null))[_0xdcd8('0xd')](handleError(_0x4a1c43,null));};exports[_0xdcd8('0x54')]=function(_0xaa08c6,_0x2e3e4d){return respondWithRpcPromise(_0xdcd8('0x55'),_0xaa08c6['query'],routingClient)[_0xdcd8('0x18')](function(_0x53fe9d){if(_0xaa08c6['query']['type']!==undefined){var _0x83244b=_(_0x53fe9d['rows'])[_0xdcd8('0x56')]([_0xaa08c6[_0xdcd8('0x17')][_0xdcd8('0x57')],_0xaa08c6[_0xdcd8('0x1c')]['id']])[_0xdcd8('0x58')](_0xdcd8('0x59'))[_0xdcd8('0x5a')]()[_0xdcd8('0x5b')]();return _0x53fe9d[_0xdcd8('0x13')]['filter'](function(_0xd49cd8){return _0x83244b['indexOf'](_0xd49cd8[_0xdcd8('0x59')])>-0x1;});}else{return _0x53fe9d[_0xdcd8('0x13')][_0xdcd8('0x56')](function(_0x2b282c){return _0x2b282c[_0xdcd8('0x59')]===parseInt(_0xaa08c6[_0xdcd8('0x1c')]['id']);});}})[_0xdcd8('0x18')](respondWithResult(_0x2e3e4d,null))['catch'](handleError(_0x2e3e4d,null));};exports[_0xdcd8('0x5c')]=function(_0x36f7d7,_0x20aed9){return respondWithRpcPromise(_0xdcd8('0x5d'),_0x36f7d7[_0xdcd8('0x17')],routingClient)['then'](respondWithResult(_0x20aed9,null))[_0xdcd8('0xd')](handleError(_0x20aed9,null));};exports[_0xdcd8('0x5e')]=function(_0x4632fa,_0x54afdf){return respondWithRpcPromise(_0xdcd8('0x5f'),_0x4632fa['query'],routingClient)[_0xdcd8('0x18')](respondWithResult(_0x54afdf,null))[_0xdcd8('0xd')](handleError(_0x54afdf,null));};exports[_0xdcd8('0x60')]=function(_0x5075ec,_0xa57dee){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5075ec[_0xdcd8('0x17')],routingClient)[_0xdcd8('0x18')](respondWithResult(_0xa57dee,null))[_0xdcd8('0xd')](handleError(_0xa57dee,null));};exports[_0xdcd8('0x61')]=function(_0x5b776a){return function(_0x222c86,_0x272f1f){var _0x3e0303,_0x263276;var _0x49c24b=_[_0xdcd8('0x62')](_0x5b776a);var _0x338791=_0x5b776a===_0xdcd8('0x63')?_0xdcd8('0x64'):_0xdcd8('0x65');return db[_0x49c24b+_0xdcd8('0x66')][_0xdcd8('0x67')]({'raw':!![],'where':{'id':_0x222c86[_0xdcd8('0x1c')]['id']}})[_0xdcd8('0x18')](function(_0x267d84){if(_[_0xdcd8('0x12')](_0x267d84)){throw new Error(_0x49c24b+'\x20Queue\x20not\x20found');}_0x3e0303=_0x267d84;return db[_0x49c24b+_0xdcd8('0x68')]['findOne']({'where':{'id':_0x222c86[_0xdcd8('0x21')][_0xdcd8('0x69')]},'include':[{'model':db[_0x49c24b+_0xdcd8('0x6a')],'as':_0xdcd8('0x6a')},{'model':db[_0x49c24b+_0x338791],'as':_0xdcd8('0x65')}]});})[_0xdcd8('0x18')](function(_0x1fcf77){if(_[_0xdcd8('0x12')](_0x1fcf77)){throw new Error(_0x49c24b+'\x20Message\x20not\x20found');}_0x263276=_0x1fcf77;return _0x1fcf77[_0xdcd8('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdcd8('0x18')](function(){var _0x349ded={'uniqueid':_0x5b776a+'.'+_0x263276['id']+'.'+_0x263276['Interaction']['id'],'FromUserId':_0x222c86[_0xdcd8('0x2f')]['id'],'type':_0xdcd8('0x6c')};_0x349ded[_0x49c24b+_0xdcd8('0x6d')]=_0x263276['id'];_0x349ded[_0x49c24b+_0xdcd8('0x6e')]=_0x263276[_0xdcd8('0x6a')]['id'];_0x349ded[_0xdcd8('0x6f')+_0x49c24b+_0x338791+'Id']=_0x263276[_0xdcd8('0x65')]['id'];_0x349ded['To'+_0x49c24b+'QueueId']=_0x3e0303['id'];return db[_0x49c24b+_0xdcd8('0x70')][_0xdcd8('0x71')](_0x349ded);})[_0xdcd8('0x18')](function(){return respondWithRpcPromise(_0xdcd8('0x72'),{'channel':_0x5b776a,'interaction':_0x263276[_0xdcd8('0x6a')],'message':_0x263276,'account':_0x263276[_0xdcd8('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xdcd8('0x6c'),'appdata':_0x3e0303['name']+','+(_0x263276[_0xdcd8('0x65')][_0xdcd8('0x73')]||0x12c),'interval':_0xdcd8('0x74')}]},routingClient);})[_0xdcd8('0x18')](respondWithResult(_0x272f1f,null))['catch'](handleError(_0x272f1f,null));};};exports[_0xdcd8('0x75')]=function(_0x258bba,_0x39072c){var _0x2c7623,_0x226eb7;if(_[_0xdcd8('0x12')](_0x258bba['body'][_0xdcd8('0x76')])){throw new Error(_0xdcd8('0x77'));}var _0x55f542=_0x258bba[_0xdcd8('0x21')][_0xdcd8('0x76')];var _0x2c5769=_[_0xdcd8('0x62')](_0x55f542);var _0x5fefaf=_0x55f542==='chat'?_0xdcd8('0x64'):'Account';return db[_0xdcd8('0x78')][_0xdcd8('0x67')]({'raw':!![],'where':{'id':_0x258bba[_0xdcd8('0x1c')]['id'],'role':_0xdcd8('0x3b')}})['then'](function(_0x1976c4){if(_['isNil'](_0x1976c4)){throw new Error('Agent\x20not\x20found');}_0x2c7623=_0x1976c4;return db[_0x2c5769+_0xdcd8('0x68')][_0xdcd8('0x67')]({'where':{'id':_0x258bba[_0xdcd8('0x21')][_0xdcd8('0x69')]},'include':[{'model':db[_0x2c5769+'Interaction'],'as':'Interaction'},{'model':db[_0x2c5769+_0x5fefaf],'as':_0xdcd8('0x65')}]});})[_0xdcd8('0x18')](function(_0x60bbd6){if(_[_0xdcd8('0x12')](_0x60bbd6)){throw new Error(_0x2c5769+_0xdcd8('0x79'));}_0x226eb7=_0x60bbd6;return _0x60bbd6[_0xdcd8('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0xdcd8('0x18')](function(){var _0x44676c={'uniqueid':_0x55f542+'.'+_0x226eb7['id']+'.'+_0x226eb7['Interaction']['id'],'FromUserId':_0x258bba[_0xdcd8('0x2f')]['id'],'type':_0xdcd8('0x3b'),'ToUserId':_0x2c7623['id']};_0x44676c[_0x2c5769+_0xdcd8('0x6d')]=_0x226eb7['id'];_0x44676c[_0x2c5769+_0xdcd8('0x6e')]=_0x226eb7[_0xdcd8('0x6a')]['id'];_0x44676c['From'+_0x2c5769+_0x5fefaf+'Id']=_0x226eb7[_0xdcd8('0x65')]['id'];return db[_0x2c5769+_0xdcd8('0x70')][_0xdcd8('0x71')](_0x44676c);})[_0xdcd8('0x18')](function(){return respondWithRpcPromise(_0xdcd8('0x72'),{'channel':_0x55f542,'interaction':_0x226eb7[_0xdcd8('0x6a')],'message':_0x226eb7,'account':_0x226eb7[_0xdcd8('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xdcd8('0x3b'),'appdata':_0x2c7623['name']+','+(_0x226eb7[_0xdcd8('0x65')][_0xdcd8('0x7a')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xdcd8('0x18')](respondWithResult(_0x39072c,null))[_0xdcd8('0xd')](handleError(_0x39072c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index ed2fa70..d3b7270 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 _0xabb4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','create','delete','destroy','exports','connect-timeout','Router'];(function(_0x11aaee,_0x22a65c){var _0x1f213d=function(_0x4cb35e){while(--_0x4cb35e){_0x11aaee['push'](_0x11aaee['shift']());}};_0x1f213d(++_0x22a65c);}(_0xabb4,0x10e));var _0x4abb=function(_0x1beada,_0x47dc47){_0x1beada=_0x1beada-0x0;var _0x3972eb=_0xabb4[_0x1beada];return _0x3972eb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4abb('0x0'));var express=require('express');var router=express[_0x4abb('0x1')]();var fs_extra=require(_0x4abb('0x2'));var auth=require(_0x4abb('0x3'));var interaction=require(_0x4abb('0x4'));var config=require(_0x4abb('0x5'));var controller=require(_0x4abb('0x6'));router[_0x4abb('0x7')]('/',auth[_0x4abb('0x8')](),controller[_0x4abb('0x9')]);router[_0x4abb('0x7')](_0x4abb('0xa'),auth[_0x4abb('0x8')](),controller['show']);router['get'](_0x4abb('0xb'),auth['isAuthenticated'](),controller[_0x4abb('0xc')]);router['post']('/',auth[_0x4abb('0x8')](),controller[_0x4abb('0xd')]);router['put'](_0x4abb('0xa'),auth[_0x4abb('0x8')](),controller['update']);router[_0x4abb('0xe')](_0x4abb('0xa'),auth[_0x4abb('0x8')](),controller[_0x4abb('0xf')]);module[_0x4abb('0x10')]=router; \ No newline at end of file +var _0xbb58=['/:id/run','run','put','/:id','update','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show'];(function(_0x5a0440,_0x244e9b){var _0x307a43=function(_0x44c84b){while(--_0x44c84b){_0x5a0440['push'](_0x5a0440['shift']());}};_0x307a43(++_0x244e9b);}(_0xbb58,0x97));var _0x8bb5=function(_0xafaf39,_0x1b88d0){_0xafaf39=_0xafaf39-0x0;var _0x37732b=_0xbb58[_0xafaf39];return _0x37732b;};'use strict';var multer=require('multer');var util=require(_0x8bb5('0x0'));var path=require(_0x8bb5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8bb5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8bb5('0x3'));var interaction=require(_0x8bb5('0x4'));var config=require(_0x8bb5('0x5'));var controller=require(_0x8bb5('0x6'));router[_0x8bb5('0x7')]('/',auth[_0x8bb5('0x8')](),controller[_0x8bb5('0x9')]);router[_0x8bb5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8bb5('0xa')]);router[_0x8bb5('0x7')](_0x8bb5('0xb'),auth[_0x8bb5('0x8')](),controller[_0x8bb5('0xc')]);router['post']('/',auth[_0x8bb5('0x8')](),controller['create']);router[_0x8bb5('0xd')](_0x8bb5('0xe'),auth[_0x8bb5('0x8')](),controller[_0x8bb5('0xf')]);router[_0x8bb5('0x10')](_0x8bb5('0xe'),auth['isAuthenticated'](),controller[_0x8bb5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 6908d4c..6d84338 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 _0x2adf=['custom','TEXT','BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours','pdf','csv'];(function(_0x1112be,_0x31587d){var _0x350653=function(_0x20913b){while(--_0x20913b){_0x1112be['push'](_0x1112be['shift']());}};_0x350653(++_0x31587d);}(_0x2adf,0x69));var _0xf2ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2adf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf2ad('0x0'));module[_0xf2ad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf2ad('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf2ad('0x2')],'allowNull':![],'defaultValue':_0xf2ad('0x3')},'startAt':{'type':Sequelize[_0xf2ad('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf2ad('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf2ad('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf2ad('0x6')](_0xf2ad('0x7'),_0xf2ad('0x8'),_0xf2ad('0x9'),'weeks',_0xf2ad('0xa'),_0xf2ad('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xf2ad('0xa')},'output':{'type':Sequelize[_0xf2ad('0x6')]('csv',_0xf2ad('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xf2ad('0xd')},'type':{'type':Sequelize['ENUM'](_0xf2ad('0xe'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xf2ad('0x2')]},'cc':{'type':Sequelize[_0xf2ad('0xf')]},'bcc':{'type':Sequelize[_0xf2ad('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xf2ad('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe017=['pdf','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','days','minutes','ENUM','csv'];(function(_0x3c36e1,_0x423829){var _0x5187a7=function(_0x7b96f8){while(--_0x7b96f8){_0x3c36e1['push'](_0x3c36e1['shift']());}};_0x5187a7(++_0x423829);}(_0xe017,0x89));var _0x7e01=function(_0x22dc5f,_0x482206){_0x22dc5f=_0x22dc5f-0x0;var _0x40d93b=_0xe017[_0x22dc5f];return _0x40d93b;};'use strict';var Sequelize=require(_0x7e01('0x0'));module[_0x7e01('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7e01('0x2')]},'active':{'type':Sequelize[_0x7e01('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7e01('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x7e01('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7e01('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x7e01('0x7'),_0x7e01('0x8'),_0x7e01('0x9'),_0x7e01('0xa'),_0x7e01('0xb'),'hours',_0x7e01('0xc')),'allowNull':![],'defaultValue':_0x7e01('0xb')},'output':{'type':Sequelize[_0x7e01('0xd')](_0x7e01('0xe'),_0x7e01('0xf'),_0x7e01('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom','default'),'allowNull':![],'defaultValue':_0x7e01('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x7e01('0x12')]},'bcc':{'type':Sequelize[_0x7e01('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x7e01('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 91fd381..6ec9913 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 _0x9e29=['VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','end','offset','limit','undefined','reject','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','merge'];(function(_0x5f4613,_0x58bce2){var _0x105875=function(_0x55738d){while(--_0x55738d){_0x5f4613['push'](_0x5f4613['shift']());}};_0x105875(++_0x58bce2);}(_0x9e29,0xac));var _0x99e2=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x9e29[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require(_0x99e2('0x0'));var rimraf=require(_0x99e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99e2('0x2'));var rp=require(_0x99e2('0x3'));var moment=require(_0x99e2('0x4'));var BPromise=require(_0x99e2('0x5'));var Mustache=require(_0x99e2('0x6'));var util=require(_0x99e2('0x7'));var path=require(_0x99e2('0x8'));var sox=require('sox');var csv=require(_0x99e2('0x9'));var ejs=require(_0x99e2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99e2('0xb'));var squel=require('squel');var crypto=require(_0x99e2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x99e2('0xd'));var toCsv=require(_0x99e2('0x9'));var querystring=require(_0x99e2('0xe'));var Papa=require('papaparse');var Redis=require(_0x99e2('0xf'));var authService=require(_0x99e2('0x10'));var qs=require(_0x99e2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x99e2('0x12'));var utils=require(_0x99e2('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x99e2('0x14'))['db'];function respondWithStatusCode(_0x1032ab,_0x189896){_0x189896=_0x189896||0xcc;return function(_0x3cefdd){if(_0x3cefdd){return _0x1032ab['sendStatus'](_0x189896);}return _0x1032ab[_0x99e2('0x15')](_0x189896)[_0x99e2('0x16')]();};}function respondWithResult(_0x585349,_0x503234){_0x503234=_0x503234||0xc8;return function(_0xc0cc8){if(_0xc0cc8){return _0x585349[_0x99e2('0x15')](_0x503234)['json'](_0xc0cc8);}};}function respondWithFilteredResult(_0x3fe636,_0x54ad57){return function(_0x3682dd){if(_0x3682dd){var _0x28c080=typeof _0x54ad57[_0x99e2('0x17')]==='undefined'&&typeof _0x54ad57[_0x99e2('0x18')]===_0x99e2('0x19');var _0x3499ea=_0x3682dd['count'];var _0x309ae3=_0x28c080?0x0:_0x54ad57[_0x99e2('0x17')];var _0x56e1b1=_0x28c080?_0x3682dd['count']:_0x54ad57[_0x99e2('0x17')]+_0x54ad57[_0x99e2('0x18')];var _0x108cf2;if(_0x56e1b1>=_0x3499ea){_0x56e1b1=_0x3499ea;_0x108cf2=0xc8;}else{_0x108cf2=0xce;}_0x3fe636[_0x99e2('0x15')](_0x108cf2);return _0x3fe636['set']('Content-Range',_0x309ae3+'-'+_0x56e1b1+'/'+_0x3499ea)['json'](_0x3682dd);}return null;};}function patchUpdates(_0x57b1dc){return function(_0x963ef5){try{jsonpatch['apply'](_0x963ef5,_0x57b1dc,!![]);}catch(_0x18ba3a){return BPromise[_0x99e2('0x1a')](_0x18ba3a);}return _0x963ef5['save']();};}function saveUpdates(_0x48e9cd,_0x41c900){return function(_0x142fd9){if(_0x142fd9){return _0x142fd9['update'](_0x48e9cd)[_0x99e2('0x1b')](function(_0x39cd9f){return _0x39cd9f;});}return null;};}function removeEntity(_0x223f88,_0x39694c){return function(_0x3d0f63){if(_0x3d0f63){return _0x3d0f63[_0x99e2('0x1c')]()[_0x99e2('0x1b')](function(){var _0x5e242a=_0x3d0f63[_0x99e2('0x1d')]({'plain':!![]});var _0x24f792=_0x99e2('0x1e');return db[_0x99e2('0x1f')][_0x99e2('0x1c')]({'where':{'type':_0x24f792,'resourceId':_0x5e242a['id']}})['then'](function(){return _0x3d0f63;});})[_0x99e2('0x1b')](function(){_0x223f88[_0x99e2('0x15')](0xcc)[_0x99e2('0x16')]();});}};}function handleEntityNotFound(_0x256b8c,_0x40dc98){return function(_0x186bf9){if(!_0x186bf9){_0x256b8c[_0x99e2('0x20')](0x194);}return _0x186bf9;};}function handleError(_0x1a2faa,_0xf5cf1b){_0xf5cf1b=_0xf5cf1b||0x1f4;return function(_0x2c3a9c){logger[_0x99e2('0x21')](_0x2c3a9c['stack']);if(_0x2c3a9c[_0x99e2('0x22')]){delete _0x2c3a9c[_0x99e2('0x22')];}_0x1a2faa['status'](_0xf5cf1b)[_0x99e2('0x23')](_0x2c3a9c);};}exports[_0x99e2('0x24')]=function(_0x1ce074,_0x45fc1f){var _0x32c365={},_0x51f5a5={},_0x2c664a={'count':0x0,'rows':[]};var _0x4ebf75=_[_0x99e2('0x25')](db[_0x99e2('0x26')][_0x99e2('0x27')],function(_0x1852f8){return{'name':_0x1852f8[_0x99e2('0x28')],'type':_0x1852f8[_0x99e2('0x29')][_0x99e2('0x2a')]};});_0x51f5a5[_0x99e2('0x2b')]=_[_0x99e2('0x25')](_0x4ebf75,_0x99e2('0x22'));_0x51f5a5[_0x99e2('0x2c')]=_[_0x99e2('0x2d')](_0x1ce074[_0x99e2('0x2c')]);_0x51f5a5[_0x99e2('0x2e')]=_['intersection'](_0x51f5a5[_0x99e2('0x2b')],_0x51f5a5[_0x99e2('0x2c')]);_0x32c365['attributes']=_[_0x99e2('0x2f')](_0x51f5a5[_0x99e2('0x2b')],qs[_0x99e2('0x30')](_0x1ce074[_0x99e2('0x2c')][_0x99e2('0x30')]));_0x32c365['attributes']=_0x32c365[_0x99e2('0x31')][_0x99e2('0x32')]?_0x32c365[_0x99e2('0x31')]:_0x51f5a5['model'];if(!_0x1ce074['query'][_0x99e2('0x33')]('nolimit')){_0x32c365[_0x99e2('0x18')]=qs['limit'](_0x1ce074[_0x99e2('0x2c')]['limit']);_0x32c365[_0x99e2('0x17')]=qs[_0x99e2('0x17')](_0x1ce074[_0x99e2('0x2c')][_0x99e2('0x17')]);}_0x32c365[_0x99e2('0x34')]=qs['sort'](_0x1ce074[_0x99e2('0x2c')]['sort']);_0x32c365[_0x99e2('0x35')]=qs['filters'](_['pick'](_0x1ce074[_0x99e2('0x2c')],_0x51f5a5[_0x99e2('0x2e')]),_0x4ebf75);if(_0x1ce074[_0x99e2('0x2c')][_0x99e2('0x36')]){_0x32c365[_0x99e2('0x35')]=_[_0x99e2('0x37')](_0x32c365[_0x99e2('0x35')],{'$or':_['map'](_0x4ebf75,function(_0x5a00ee){if(_0x5a00ee['type']!==_0x99e2('0x38')){var _0x219ce9={};_0x219ce9[_0x5a00ee[_0x99e2('0x22')]]={'$like':'%'+_0x1ce074['query'][_0x99e2('0x36')]+'%'};return _0x219ce9;}})});}_0x32c365=_[_0x99e2('0x37')]({},_0x32c365,_0x1ce074[_0x99e2('0x39')]);var _0x42a862={'where':_0x32c365[_0x99e2('0x35')]};return db[_0x99e2('0x26')][_0x99e2('0x3a')](_0x42a862)[_0x99e2('0x1b')](function(_0x3a7378){_0x2c664a[_0x99e2('0x3a')]=_0x3a7378;if(_0x1ce074['query'][_0x99e2('0x3b')]){_0x32c365[_0x99e2('0x3c')]=[{'all':!![]}];}return db[_0x99e2('0x26')][_0x99e2('0x3d')](_0x32c365);})[_0x99e2('0x1b')](function(_0x1e7dd8){_0x2c664a['rows']=_0x1e7dd8;return _0x2c664a;})['then'](respondWithFilteredResult(_0x45fc1f,_0x32c365))['catch'](handleError(_0x45fc1f,null));};exports[_0x99e2('0x3e')]=function(_0x1d21db,_0x5242ad){var _0x48aa26={'raw':![],'where':{'id':_0x1d21db[_0x99e2('0x3f')]['id']}},_0x3b7632={};_0x3b7632['model']=_[_0x99e2('0x2d')](db[_0x99e2('0x26')][_0x99e2('0x27')]);_0x3b7632[_0x99e2('0x2c')]=_['keys'](_0x1d21db[_0x99e2('0x2c')]);_0x3b7632[_0x99e2('0x2e')]=_[_0x99e2('0x2f')](_0x3b7632[_0x99e2('0x2b')],_0x3b7632[_0x99e2('0x2c')]);_0x48aa26[_0x99e2('0x31')]=_[_0x99e2('0x2f')](_0x3b7632['model'],qs[_0x99e2('0x30')](_0x1d21db[_0x99e2('0x2c')][_0x99e2('0x30')]));_0x48aa26[_0x99e2('0x31')]=_0x48aa26[_0x99e2('0x31')]['length']?_0x48aa26['attributes']:_0x3b7632['model'];if(_0x1d21db['query'][_0x99e2('0x3b')]){_0x48aa26[_0x99e2('0x3c')]=[{'all':!![]}];}_0x48aa26=_[_0x99e2('0x37')]({},_0x48aa26,_0x1d21db[_0x99e2('0x39')]);return db[_0x99e2('0x26')][_0x99e2('0x40')](_0x48aa26)[_0x99e2('0x1b')](handleEntityNotFound(_0x5242ad,null))[_0x99e2('0x1b')](respondWithResult(_0x5242ad,null))['catch'](handleError(_0x5242ad,null));};exports[_0x99e2('0x41')]=function(_0x2f9772,_0xc52bfa){return db['Schedule'][_0x99e2('0x41')](_0x2f9772['body'],{})[_0x99e2('0x1b')](function(_0x15d556){var _0xeaf8e3=_0x2f9772[_0x99e2('0x42')][_0x99e2('0x1d')]({'plain':!![]});if(!_0xeaf8e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xeaf8e3[_0x99e2('0x43')]===_0x99e2('0x42')){var _0x3e0542=_0x15d556[_0x99e2('0x1d')]({'plain':!![]});var _0x5b635a='Scheduler';return db[_0x99e2('0x44')][_0x99e2('0x40')]({'where':{'name':_0x5b635a,'userProfileId':_0xeaf8e3['userProfileId']},'raw':!![]})['then'](function(_0x3d32b2){if(_0x3d32b2&&_0x3d32b2[_0x99e2('0x45')]===0x0){return db[_0x99e2('0x1f')]['create']({'name':_0x3e0542[_0x99e2('0x22')],'resourceId':_0x3e0542['id'],'type':_0x3d32b2['name'],'sectionId':_0x3d32b2['id']},{})[_0x99e2('0x1b')](function(){return _0x15d556;});}else{return _0x15d556;}})['catch'](function(_0x4a0d90){logger[_0x99e2('0x21')](_0x99e2('0x46'),_0x4a0d90);throw _0x4a0d90;});}return _0x15d556;})[_0x99e2('0x1b')](respondWithResult(_0xc52bfa,0xc9))[_0x99e2('0x47')](handleError(_0xc52bfa,null));};exports[_0x99e2('0x48')]=function(_0x13c51d,_0x156c0e){if(_0x13c51d[_0x99e2('0x49')]['id']){delete _0x13c51d[_0x99e2('0x49')]['id'];}return db['Schedule'][_0x99e2('0x40')]({'where':{'id':_0x13c51d[_0x99e2('0x3f')]['id']}})[_0x99e2('0x1b')](handleEntityNotFound(_0x156c0e,null))[_0x99e2('0x1b')](saveUpdates(_0x13c51d['body'],null))[_0x99e2('0x1b')](respondWithResult(_0x156c0e,null))[_0x99e2('0x47')](handleError(_0x156c0e,null));};exports[_0x99e2('0x1c')]=function(_0x33e2b2,_0x8ef910){return db[_0x99e2('0x26')][_0x99e2('0x40')]({'where':{'id':_0x33e2b2[_0x99e2('0x3f')]['id']}})[_0x99e2('0x1b')](handleEntityNotFound(_0x8ef910,null))[_0x99e2('0x1b')](removeEntity(_0x8ef910,null))['catch'](handleError(_0x8ef910,null));};exports[_0x99e2('0x4a')]=function(_0x58ce11,_0x391e67,_0x5c3ef3){var _0xc9a801=require(_0x99e2('0x4b'));return db['Schedule']['find']({'where':{'id':_0x58ce11[_0x99e2('0x3f')]['id']},'raw':!![]})[_0x99e2('0x1b')](handleEntityNotFound(_0x391e67,null))['then'](function(){_0xc9a801[_0x99e2('0x4a')](_0x58ce11[_0x99e2('0x3f')]['id']);})[_0x99e2('0x1b')](respondWithStatusCode(_0x391e67,null))['catch'](handleError(_0x391e67,null));}; \ No newline at end of file +var _0x8f02=['map','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','role','user','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','reject','save','then','get','Scheduler','UserProfileResource','destroy','stack','index','Schedule','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge'];(function(_0x265773,_0x5d1b6e){var _0x4ed75d=function(_0x3b7ce7){while(--_0x3b7ce7){_0x265773['push'](_0x265773['shift']());}};_0x4ed75d(++_0x5d1b6e);}(_0x8f02,0x18e));var _0x28f0=function(_0x4243f7,_0x6a5ab6){_0x4243f7=_0x4243f7-0x0;var _0x10d24c=_0x8f02[_0x4243f7];return _0x10d24c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28f0('0x0'));var zipdir=require(_0x28f0('0x1'));var jsonpatch=require(_0x28f0('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(_0x28f0('0x3'));var sox=require(_0x28f0('0x4'));var csv=require('to-csv');var ejs=require(_0x28f0('0x5'));var fs=require('fs');var fs_extra=require(_0x28f0('0x6'));var _=require(_0x28f0('0x7'));var squel=require(_0x28f0('0x8'));var crypto=require('crypto');var jsforce=require(_0x28f0('0x9'));var deskjs=require(_0x28f0('0xa'));var toCsv=require('to-csv');var querystring=require(_0x28f0('0xb'));var Papa=require('papaparse');var Redis=require(_0x28f0('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x28f0('0xd'));var as=require(_0x28f0('0xe'));var hardwareService=require(_0x28f0('0xf'));var logger=require(_0x28f0('0x10'))(_0x28f0('0x11'));var utils=require(_0x28f0('0x12'));var config=require(_0x28f0('0x13'));var licenseUtil=require(_0x28f0('0x14'));var db=require(_0x28f0('0x15'))['db'];function respondWithStatusCode(_0x414171,_0x438f7e){_0x438f7e=_0x438f7e||0xcc;return function(_0x572d1a){if(_0x572d1a){return _0x414171[_0x28f0('0x16')](_0x438f7e);}return _0x414171[_0x28f0('0x17')](_0x438f7e)[_0x28f0('0x18')]();};}function respondWithResult(_0x124dfb,_0x589eaf){_0x589eaf=_0x589eaf||0xc8;return function(_0x5677a2){if(_0x5677a2){return _0x124dfb[_0x28f0('0x17')](_0x589eaf)['json'](_0x5677a2);}};}function respondWithFilteredResult(_0x1cc0af,_0x135755){return function(_0x3bc2c8){if(_0x3bc2c8){var _0x2aef10=typeof _0x135755['offset']==='undefined'&&typeof _0x135755[_0x28f0('0x19')]===_0x28f0('0x1a');var _0x495a2f=_0x3bc2c8[_0x28f0('0x1b')];var _0x1ada13=_0x2aef10?0x0:_0x135755[_0x28f0('0x1c')];var _0x5e48c7=_0x2aef10?_0x3bc2c8[_0x28f0('0x1b')]:_0x135755['offset']+_0x135755[_0x28f0('0x19')];var _0x4c0c0d;if(_0x5e48c7>=_0x495a2f){_0x5e48c7=_0x495a2f;_0x4c0c0d=0xc8;}else{_0x4c0c0d=0xce;}_0x1cc0af[_0x28f0('0x17')](_0x4c0c0d);return _0x1cc0af[_0x28f0('0x1d')]('Content-Range',_0x1ada13+'-'+_0x5e48c7+'/'+_0x495a2f)['json'](_0x3bc2c8);}return null;};}function patchUpdates(_0x54772f){return function(_0x2ea08c){try{jsonpatch['apply'](_0x2ea08c,_0x54772f,!![]);}catch(_0x1dc7fd){return BPromise[_0x28f0('0x1e')](_0x1dc7fd);}return _0x2ea08c[_0x28f0('0x1f')]();};}function saveUpdates(_0x62ffbe,_0x1d9e5b){return function(_0x3f5a35){if(_0x3f5a35){return _0x3f5a35['update'](_0x62ffbe)[_0x28f0('0x20')](function(_0x14a004){return _0x14a004;});}return null;};}function removeEntity(_0x5234e0,_0x4bb63b){return function(_0x242f4e){if(_0x242f4e){return _0x242f4e['destroy']()['then'](function(){var _0x4e493b=_0x242f4e[_0x28f0('0x21')]({'plain':!![]});var _0x145eed=_0x28f0('0x22');return db[_0x28f0('0x23')][_0x28f0('0x24')]({'where':{'type':_0x145eed,'resourceId':_0x4e493b['id']}})[_0x28f0('0x20')](function(){return _0x242f4e;});})[_0x28f0('0x20')](function(){_0x5234e0[_0x28f0('0x17')](0xcc)[_0x28f0('0x18')]();});}};}function handleEntityNotFound(_0x5c9ae4,_0x1799c8){return function(_0x1260de){if(!_0x1260de){_0x5c9ae4[_0x28f0('0x16')](0x194);}return _0x1260de;};}function handleError(_0x10c79a,_0x569817){_0x569817=_0x569817||0x1f4;return function(_0x3de05a){logger['error'](_0x3de05a[_0x28f0('0x25')]);if(_0x3de05a['name']){delete _0x3de05a['name'];}_0x10c79a[_0x28f0('0x17')](_0x569817)['send'](_0x3de05a);};}exports[_0x28f0('0x26')]=function(_0x19133a,_0x2aee61){var _0x40f319={},_0x15250e={},_0x121bef={'count':0x0,'rows':[]};var _0x4a7324=_['map'](db[_0x28f0('0x27')][_0x28f0('0x28')],function(_0x470adc){return{'name':_0x470adc[_0x28f0('0x29')],'type':_0x470adc[_0x28f0('0x2a')][_0x28f0('0x2b')]};});_0x15250e[_0x28f0('0x2c')]=_['map'](_0x4a7324,_0x28f0('0x2d'));_0x15250e[_0x28f0('0x2e')]=_[_0x28f0('0x2f')](_0x19133a[_0x28f0('0x2e')]);_0x15250e[_0x28f0('0x30')]=_[_0x28f0('0x31')](_0x15250e[_0x28f0('0x2c')],_0x15250e[_0x28f0('0x2e')]);_0x40f319[_0x28f0('0x32')]=_[_0x28f0('0x31')](_0x15250e[_0x28f0('0x2c')],qs[_0x28f0('0x33')](_0x19133a[_0x28f0('0x2e')]['fields']));_0x40f319[_0x28f0('0x32')]=_0x40f319[_0x28f0('0x32')][_0x28f0('0x34')]?_0x40f319[_0x28f0('0x32')]:_0x15250e[_0x28f0('0x2c')];if(!_0x19133a[_0x28f0('0x2e')]['hasOwnProperty']('nolimit')){_0x40f319['limit']=qs[_0x28f0('0x19')](_0x19133a[_0x28f0('0x2e')][_0x28f0('0x19')]);_0x40f319[_0x28f0('0x1c')]=qs[_0x28f0('0x1c')](_0x19133a[_0x28f0('0x2e')]['offset']);}_0x40f319[_0x28f0('0x35')]=qs[_0x28f0('0x36')](_0x19133a[_0x28f0('0x2e')][_0x28f0('0x36')]);_0x40f319[_0x28f0('0x37')]=qs[_0x28f0('0x30')](_['pick'](_0x19133a[_0x28f0('0x2e')],_0x15250e['filters']),_0x4a7324);if(_0x19133a[_0x28f0('0x2e')][_0x28f0('0x38')]){_0x40f319[_0x28f0('0x37')]=_[_0x28f0('0x39')](_0x40f319[_0x28f0('0x37')],{'$or':_[_0x28f0('0x3a')](_0x4a7324,function(_0x5e24d7){if(_0x5e24d7[_0x28f0('0x2a')]!==_0x28f0('0x3b')){var _0x279303={};_0x279303[_0x5e24d7[_0x28f0('0x2d')]]={'$like':'%'+_0x19133a[_0x28f0('0x2e')][_0x28f0('0x38')]+'%'};return _0x279303;}})});}_0x40f319=_['merge']({},_0x40f319,_0x19133a[_0x28f0('0x3c')]);var _0x23318d={'where':_0x40f319[_0x28f0('0x37')]};return db['Schedule'][_0x28f0('0x1b')](_0x23318d)['then'](function(_0x2ddaa7){_0x121bef[_0x28f0('0x1b')]=_0x2ddaa7;if(_0x19133a[_0x28f0('0x2e')][_0x28f0('0x3d')]){_0x40f319[_0x28f0('0x3e')]=[{'all':!![]}];}return db[_0x28f0('0x27')][_0x28f0('0x3f')](_0x40f319);})[_0x28f0('0x20')](function(_0x257cfe){_0x121bef['rows']=_0x257cfe;return _0x121bef;})[_0x28f0('0x20')](respondWithFilteredResult(_0x2aee61,_0x40f319))[_0x28f0('0x40')](handleError(_0x2aee61,null));};exports[_0x28f0('0x41')]=function(_0x412a4c,_0x115400){var _0x12f591={'raw':![],'where':{'id':_0x412a4c['params']['id']}},_0x2b6b39={};_0x2b6b39['model']=_[_0x28f0('0x2f')](db[_0x28f0('0x27')][_0x28f0('0x28')]);_0x2b6b39[_0x28f0('0x2e')]=_['keys'](_0x412a4c[_0x28f0('0x2e')]);_0x2b6b39[_0x28f0('0x30')]=_[_0x28f0('0x31')](_0x2b6b39[_0x28f0('0x2c')],_0x2b6b39[_0x28f0('0x2e')]);_0x12f591[_0x28f0('0x32')]=_['intersection'](_0x2b6b39[_0x28f0('0x2c')],qs['fields'](_0x412a4c[_0x28f0('0x2e')][_0x28f0('0x33')]));_0x12f591[_0x28f0('0x32')]=_0x12f591[_0x28f0('0x32')][_0x28f0('0x34')]?_0x12f591['attributes']:_0x2b6b39[_0x28f0('0x2c')];if(_0x412a4c[_0x28f0('0x2e')][_0x28f0('0x3d')]){_0x12f591[_0x28f0('0x3e')]=[{'all':!![]}];}_0x12f591=_[_0x28f0('0x39')]({},_0x12f591,_0x412a4c[_0x28f0('0x3c')]);return db[_0x28f0('0x27')][_0x28f0('0x42')](_0x12f591)[_0x28f0('0x20')](handleEntityNotFound(_0x115400,null))[_0x28f0('0x20')](respondWithResult(_0x115400,null))[_0x28f0('0x40')](handleError(_0x115400,null));};exports[_0x28f0('0x43')]=function(_0x2edd13,_0x447913){return db[_0x28f0('0x27')][_0x28f0('0x43')](_0x2edd13[_0x28f0('0x44')],{})[_0x28f0('0x20')](function(_0x487756){var _0x2b3087=_0x2edd13['user']['get']({'plain':!![]});if(!_0x2b3087)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b3087[_0x28f0('0x45')]===_0x28f0('0x46')){var _0x1000b1=_0x487756['get']({'plain':!![]});var _0x126729=_0x28f0('0x22');return db['UserProfileSection'][_0x28f0('0x42')]({'where':{'name':_0x126729,'userProfileId':_0x2b3087['userProfileId']},'raw':!![]})['then'](function(_0x411e52){if(_0x411e52&&_0x411e52['autoAssociation']===0x0){return db[_0x28f0('0x23')][_0x28f0('0x43')]({'name':_0x1000b1[_0x28f0('0x2d')],'resourceId':_0x1000b1['id'],'type':_0x411e52['name'],'sectionId':_0x411e52['id']},{})[_0x28f0('0x20')](function(){return _0x487756;});}else{return _0x487756;}})[_0x28f0('0x40')](function(_0xa66da0){logger[_0x28f0('0x47')](_0x28f0('0x48'),_0xa66da0);throw _0xa66da0;});}return _0x487756;})['then'](respondWithResult(_0x447913,0xc9))['catch'](handleError(_0x447913,null));};exports['update']=function(_0x33884f,_0x14e31a){if(_0x33884f[_0x28f0('0x44')]['id']){delete _0x33884f[_0x28f0('0x44')]['id'];}return db[_0x28f0('0x27')][_0x28f0('0x42')]({'where':{'id':_0x33884f[_0x28f0('0x49')]['id']}})[_0x28f0('0x20')](handleEntityNotFound(_0x14e31a,null))[_0x28f0('0x20')](saveUpdates(_0x33884f[_0x28f0('0x44')],null))[_0x28f0('0x20')](respondWithResult(_0x14e31a,null))[_0x28f0('0x40')](handleError(_0x14e31a,null));};exports[_0x28f0('0x24')]=function(_0x51101b,_0x1e6f49){return db[_0x28f0('0x27')][_0x28f0('0x42')]({'where':{'id':_0x51101b[_0x28f0('0x49')]['id']}})[_0x28f0('0x20')](handleEntityNotFound(_0x1e6f49,null))[_0x28f0('0x20')](removeEntity(_0x1e6f49,null))[_0x28f0('0x40')](handleError(_0x1e6f49,null));};exports[_0x28f0('0x4a')]=function(_0x259bb6,_0x2e1db1,_0x5423cd){var _0x170b5e=require(_0x28f0('0x4b'));return db[_0x28f0('0x27')][_0x28f0('0x42')]({'where':{'id':_0x259bb6[_0x28f0('0x49')]['id']},'raw':!![]})[_0x28f0('0x20')](handleEntityNotFound(_0x2e1db1,null))[_0x28f0('0x20')](function(){_0x170b5e['run'](_0x259bb6['params']['id']);})[_0x28f0('0x20')](respondWithStatusCode(_0x2e1db1,null))['catch'](handleError(_0x2e1db1,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index cb135b4..fb920b4 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 _0xcce5=['rimraf','../../config/environment','./schedule.attributes','define','tools_schedules','lodash','util','api','moment','request-promise','path'];(function(_0x2cb1bd,_0x42b64c){var _0x393fdf=function(_0x532988){while(--_0x532988){_0x2cb1bd['push'](_0x2cb1bd['shift']());}};_0x393fdf(++_0x42b64c);}(_0xcce5,0x12e));var _0x5cce=function(_0x191db6,_0xfe030d){_0x191db6=_0x191db6-0x0;var _0x493aee=_0xcce5[_0x191db6];return _0x493aee;};'use strict';var _=require(_0x5cce('0x0'));var util=require(_0x5cce('0x1'));var logger=require('../../config/logger')(_0x5cce('0x2'));var moment=require(_0x5cce('0x3'));var BPromise=require('bluebird');var rp=require(_0x5cce('0x4'));var fs=require('fs');var path=require(_0x5cce('0x5'));var rimraf=require(_0x5cce('0x6'));var config=require(_0x5cce('0x7'));var attributes=require(_0x5cce('0x8'));module['exports']=function(_0x53bbc4,_0xc0373d){return _0x53bbc4[_0x5cce('0x9')]('Schedule',attributes,{'tableName':_0x5cce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80a9=['../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x53751f,_0x49f8d7){var _0x16ba35=function(_0x93df3a){while(--_0x93df3a){_0x53751f['push'](_0x53751f['shift']());}};_0x16ba35(++_0x49f8d7);}(_0x80a9,0x1a7));var _0x980a=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x80a9[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x980a('0x0'));var util=require(_0x980a('0x1'));var logger=require(_0x980a('0x2'))(_0x980a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x980a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x980a('0x5'));var config=require(_0x980a('0x6'));var attributes=require(_0x980a('0x7'));module[_0x980a('0x8')]=function(_0x2b7dc4,_0x53d5c){return _0x2b7dc4[_0x980a('0x9')](_0x980a('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 96cf504..fcaf12f 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 _0x75a2=['result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x37fb2a,_0x467263){var _0x5aa2a8=function(_0x4d1dfb){while(--_0x4d1dfb){_0x37fb2a['push'](_0x37fb2a['shift']());}};_0x5aa2a8(++_0x467263);}(_0x75a2,0x105));var _0x275a=function(_0x50c30d,_0x129d69){_0x50c30d=_0x50c30d-0x0;var _0x51b1bc=_0x75a2[_0x50c30d];return _0x51b1bc;};'use strict';var _=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var moment=require(_0x275a('0x2'));var BPromise=require('bluebird');var rs=require(_0x275a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x275a('0x4'))['db'];var utils=require(_0x275a('0x5'));var logger=require(_0x275a('0x6'))(_0x275a('0x7'));var config=require('../../config/environment');var jayson=require(_0x275a('0x8'));var client=jayson[_0x275a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eff4c,_0x125887,_0x4c8413){return new BPromise(function(_0x14d5e2,_0x15f2cc){return client['request'](_0x3eff4c,_0x4c8413)[_0x275a('0xa')](function(_0x2d242e){logger['info'](_0x275a('0xb'),_0x125887,_0x275a('0xc'));logger['debug'](_0x275a('0xd'),_0x125887,_0x275a('0xc'),JSON[_0x275a('0xe')](_0x2d242e));if(_0x2d242e['error']){if(_0x2d242e[_0x275a('0xf')][_0x275a('0x10')]===0x1f4){logger['error'](_0x275a('0xb'),_0x125887,_0x2d242e[_0x275a('0xf')][_0x275a('0x11')]);return _0x15f2cc(_0x2d242e[_0x275a('0xf')][_0x275a('0x11')]);}logger['error'](_0x275a('0xb'),_0x125887,_0x2d242e['error'][_0x275a('0x11')]);return _0x14d5e2(_0x2d242e['error']['message']);}else{logger[_0x275a('0x12')](_0x275a('0xb'),_0x125887,_0x275a('0xc'));_0x14d5e2(_0x2d242e[_0x275a('0x13')][_0x275a('0x11')]);}})['catch'](function(_0x518dff){logger[_0x275a('0xf')](_0x275a('0xb'),_0x125887,_0x518dff);_0x15f2cc(_0x518dff);});});} \ No newline at end of file +var _0xc220=['../../config/logger','rpc','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x231621,_0x1d4ad3){var _0x538673=function(_0xf69867){while(--_0xf69867){_0x231621['push'](_0x231621['shift']());}};_0x538673(++_0x1d4ad3);}(_0xc220,0x149));var _0x0c22=function(_0x7794ac,_0x19c5c6){_0x7794ac=_0x7794ac-0x0;var _0x54b7d4=_0xc220[_0x7794ac];return _0x54b7d4;};'use strict';var _=require(_0x0c22('0x0'));var util=require(_0x0c22('0x1'));var moment=require(_0x0c22('0x2'));var BPromise=require(_0x0c22('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c22('0x4'));var db=require(_0x0c22('0x5'))['db'];var utils=require(_0x0c22('0x6'));var logger=require(_0x0c22('0x7'))(_0x0c22('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0c22('0x9')][_0x0c22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x239816,_0xc21917,_0x35d094){return new BPromise(function(_0x4db0bb,_0x4f65f2){return client[_0x0c22('0xb')](_0x239816,_0x35d094)[_0x0c22('0xc')](function(_0x17a5b6){logger[_0x0c22('0xd')](_0x0c22('0xe'),_0xc21917,_0x0c22('0xf'));logger[_0x0c22('0x10')](_0x0c22('0x11'),_0xc21917,_0x0c22('0xf'),JSON[_0x0c22('0x12')](_0x17a5b6));if(_0x17a5b6[_0x0c22('0x13')]){if(_0x17a5b6['error'][_0x0c22('0x14')]===0x1f4){logger[_0x0c22('0x13')]('Schedule,\x20%s,\x20%s',_0xc21917,_0x17a5b6[_0x0c22('0x13')][_0x0c22('0x15')]);return _0x4f65f2(_0x17a5b6[_0x0c22('0x13')][_0x0c22('0x15')]);}logger[_0x0c22('0x13')]('Schedule,\x20%s,\x20%s',_0xc21917,_0x17a5b6[_0x0c22('0x13')]['message']);return _0x4db0bb(_0x17a5b6[_0x0c22('0x13')][_0x0c22('0x15')]);}else{logger[_0x0c22('0xd')](_0x0c22('0xe'),_0xc21917,_0x0c22('0xf'));_0x4db0bb(_0x17a5b6[_0x0c22('0x16')]['message']);}})[_0x0c22('0x17')](function(_0x5a3376){logger[_0x0c22('0x13')](_0x0c22('0xe'),_0xc21917,_0x5a3376);_0x4f65f2(_0x5a3376);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f6fa9ca..d7e57a9 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 _0x1e7c=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','/:id','/:id/download','download','post','put','update','destroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e7c,0x1f3));var _0xc1e7=function(_0x16814e,_0x4cbe02){_0x16814e=_0x16814e-0x0;var _0x466c3f=_0x1e7c[_0x16814e];return _0x466c3f;};'use strict';var multer=require(_0xc1e7('0x0'));var util=require('util');var path=require(_0xc1e7('0x1'));var timeout=require(_0xc1e7('0x2'));var express=require(_0xc1e7('0x3'));var router=express[_0xc1e7('0x4')]();var fs_extra=require(_0xc1e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc1e7('0x6'));var config=require(_0xc1e7('0x7'));var controller=require(_0xc1e7('0x8'));router[_0xc1e7('0x9')]('/',auth[_0xc1e7('0xa')](),controller['index']);router[_0xc1e7('0x9')](_0xc1e7('0xb'),auth[_0xc1e7('0xa')](),controller['describe']);router[_0xc1e7('0x9')](_0xc1e7('0xc'),auth[_0xc1e7('0xa')](),controller['show']);router[_0xc1e7('0x9')](_0xc1e7('0xd'),auth['isAuthenticated'](),controller[_0xc1e7('0xe')]);router[_0xc1e7('0xf')]('/',auth[_0xc1e7('0xa')](),controller['create']);router[_0xc1e7('0x10')]('/:id',auth[_0xc1e7('0xa')](),controller[_0xc1e7('0x11')]);router['delete'](_0xc1e7('0xc'),auth[_0xc1e7('0xa')](),controller[_0xc1e7('0x12')]);module[_0xc1e7('0x13')]=router; \ No newline at end of file +var _0x603b=['destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','/:id','show','/:id/download','isAuthenticated','download','post','create','update'];(function(_0x2de9a5,_0x1bbbd1){var _0xddd28a=function(_0x2f8c1e){while(--_0x2f8c1e){_0x2de9a5['push'](_0x2de9a5['shift']());}};_0xddd28a(++_0x1bbbd1);}(_0x603b,0xb2));var _0xb603=function(_0x219f85,_0x2d26b9){_0x219f85=_0x219f85-0x0;var _0x4b8115=_0x603b[_0x219f85];return _0x4b8115;};'use strict';var multer=require('multer');var util=require(_0xb603('0x0'));var path=require(_0xb603('0x1'));var timeout=require('connect-timeout');var express=require(_0xb603('0x2'));var router=express[_0xb603('0x3')]();var fs_extra=require(_0xb603('0x4'));var auth=require(_0xb603('0x5'));var interaction=require(_0xb603('0x6'));var config=require(_0xb603('0x7'));var controller=require(_0xb603('0x8'));router[_0xb603('0x9')]('/',auth['isAuthenticated'](),controller[_0xb603('0xa')]);router[_0xb603('0x9')](_0xb603('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb603('0xc'),auth['isAuthenticated'](),controller[_0xb603('0xd')]);router[_0xb603('0x9')](_0xb603('0xe'),auth[_0xb603('0xf')](),controller[_0xb603('0x10')]);router[_0xb603('0x11')]('/',auth[_0xb603('0xf')](),controller[_0xb603('0x12')]);router['put'](_0xb603('0xc'),auth['isAuthenticated'](),controller[_0xb603('0x13')]);router['delete'](_0xb603('0xc'),auth[_0xb603('0xf')](),controller[_0xb603('0x14')]);module[_0xb603('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 85be247..876ff6f 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 _0x47d6=['INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue'];(function(_0x527aab,_0x1bb5d8){var _0x549ef1=function(_0x5a22a0){while(--_0x5a22a0){_0x527aab['push'](_0x527aab['shift']());}};_0x549ef1(++_0x1bb5d8);}(_0x47d6,0x13f));var _0x647d=function(_0x23ce16,_0x53dafd){_0x23ce16=_0x23ce16-0x0;var _0xf8395d=_0x47d6[_0x23ce16];return _0xf8395d;};'use strict';var Sequelize=require(_0x647d('0x0'));var moment=require(_0x647d('0x1'));var path=require(_0x647d('0x2'));var config=require(_0x647d('0x3'));module[_0x647d('0x4')]={'format':{'type':Sequelize[_0x647d('0x5')],'get':function(){return this[_0x647d('0x6')](_0x647d('0x7'))?path[_0x647d('0x8')](this[_0x647d('0x6')](_0x647d('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x647d('0x9')]},'channel':{'type':Sequelize[_0x647d('0x9')]},'value':{'type':Sequelize[_0x647d('0x9')],'set':function(_0x1db1db){var _0x1c6a88=_0x1db1db['replace'](/\\/g,'/');this[_0x647d('0xa')](_0x647d('0x7'),_0x1c6a88);}},'rating':{'type':Sequelize[_0x647d('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x647d('0xb')],'set':function(_0x414518){this[_0x647d('0xa')](_0x647d('0xc'),moment()[_0x647d('0xd')](_0x414518,'ms'));this[_0x647d('0xa')](_0x647d('0xe'),moment());this[_0x647d('0xa')](_0x647d('0xf'),_0x414518);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x647d('0xc')))[_0x647d('0x10')](_0x647d('0x11'))[_0x647d('0x12')]();}},'closedAt':{'type':Sequelize[_0x647d('0x13')],'get':function(){return moment(this[_0x647d('0x6')](_0x647d('0xe')))[_0x647d('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x647d('0x12')]();}},'createdAt':{'type':Sequelize[_0x647d('0x13')],'get':function(){return moment(this['getDataValue'](_0x647d('0x14')))[_0x647d('0x10')](_0x647d('0x11'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x647d('0x6')](_0x647d('0x15')))[_0x647d('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x647d('0x12')]();}}}; \ No newline at end of file +var _0xa880=['path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment'];(function(_0x465aa9,_0x1bf1c8){var _0x4104e4=function(_0x388bb8){while(--_0x388bb8){_0x465aa9['push'](_0x465aa9['shift']());}};_0x4104e4(++_0x1bf1c8);}(_0xa880,0x106));var _0x0a88=function(_0x22e133,_0x527287){_0x22e133=_0x22e133-0x0;var _0x3455ca=_0xa880[_0x22e133];return _0x3455ca;};'use strict';var Sequelize=require(_0x0a88('0x0'));var moment=require(_0x0a88('0x1'));var path=require(_0x0a88('0x2'));var config=require(_0x0a88('0x3'));module[_0x0a88('0x4')]={'format':{'type':Sequelize[_0x0a88('0x5')],'get':function(){return this[_0x0a88('0x6')](_0x0a88('0x7'))?path[_0x0a88('0x8')](this[_0x0a88('0x6')](_0x0a88('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0a88('0x9')]},'value':{'type':Sequelize[_0x0a88('0x9')],'set':function(_0x3a576d){var _0x3f9463=_0x3a576d['replace'](/\\/g,'/');this[_0x0a88('0xa')](_0x0a88('0x7'),_0x3f9463);}},'rating':{'type':Sequelize[_0x0a88('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x512810){this['setDataValue'](_0x0a88('0xc'),moment()[_0x0a88('0xd')](_0x512810,'ms'));this[_0x0a88('0xa')](_0x0a88('0xe'),moment());this[_0x0a88('0xa')](_0x0a88('0xf'),_0x512810);}},'startedAt':{'type':Sequelize[_0x0a88('0x10')],'get':function(){return moment(this[_0x0a88('0x6')](_0x0a88('0xc')))[_0x0a88('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x0a88('0x12')]();}},'closedAt':{'type':Sequelize[_0x0a88('0x10')],'get':function(){return moment(this[_0x0a88('0x6')](_0x0a88('0xe')))['format'](_0x0a88('0x13'))[_0x0a88('0x12')]();}},'createdAt':{'type':Sequelize[_0x0a88('0x10')],'get':function(){return moment(this['getDataValue'](_0x0a88('0x14')))[_0x0a88('0x11')](_0x0a88('0x13'))[_0x0a88('0x12')]();}},'updatedAt':{'type':Sequelize[_0x0a88('0x10')],'get':function(){return moment(this['getDataValue'](_0x0a88('0x15')))[_0x0a88('0x11')](_0x0a88('0x13'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 02b06ff..7e815c5 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 _0xdc97=['join','root','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','sendStatus','error','name','send','index','map','format','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','options','ScreenRecording','includeAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid'];(function(_0x36479c,_0x2af234){var _0x5dafd7=function(_0x4165ac){while(--_0x4165ac){_0x36479c['push'](_0x36479c['shift']());}};_0x5dafd7(++_0x2af234);}(_0xdc97,0x13b));var _0x7dc9=function(_0x375b81,_0x6a7942){_0x375b81=_0x375b81-0x0;var _0x8d479a=_0xdc97[_0x375b81];return _0x8d479a;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){_0xffc080[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x55a482,_0x48c6bc){return function(_0x4b9ba6){if(!_0x4b9ba6){_0x55a482[_0x7dc9('0x22')](0x194);}return _0x4b9ba6;};}function handleError(_0x32d032,_0x5843bf){_0x5843bf=_0x5843bf||0x1f4;return function(_0x585eef){logger[_0x7dc9('0x23')](_0x585eef['stack']);if(_0x585eef[_0x7dc9('0x24')]){delete _0x585eef[_0x7dc9('0x24')];}_0x32d032[_0x7dc9('0x16')](_0x5843bf)[_0x7dc9('0x25')](_0x585eef);};}exports[_0x7dc9('0x26')]=function(_0x450124,_0x236d42){var _0x229f8e={},_0x1fcf0e={},_0x3c4379={'count':0x0,'rows':[]};var _0x14083d=_[_0x7dc9('0x27')](db['ScreenRecording']['rawAttributes'],function(_0x513dd6){return{'name':_0x513dd6['fieldName'],'type':_0x513dd6['type']['key']};});_0x1fcf0e['model']=_['differenceBy'](_[_0x7dc9('0x27')](_0x14083d,_0x7dc9('0x24')),[_0x7dc9('0x28')]);_0x1fcf0e[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x450124[_0x7dc9('0x29')]);_0x1fcf0e['filters']=_['intersection'](_0x1fcf0e['model'],_0x1fcf0e[_0x7dc9('0x29')]);_0x229f8e['attributes']=_[_0x7dc9('0x2b')](_0x1fcf0e[_0x7dc9('0x2c')],qs[_0x7dc9('0x2d')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x229f8e[_0x7dc9('0x2e')]=_0x229f8e[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x229f8e['attributes']:_0x1fcf0e[_0x7dc9('0x2c')];if(!_0x450124['query'][_0x7dc9('0x30')](_0x7dc9('0x31'))){_0x229f8e[_0x7dc9('0x1a')]=qs[_0x7dc9('0x1a')](_0x450124['query'][_0x7dc9('0x1a')]);_0x229f8e['offset']=qs[_0x7dc9('0x18')](_0x450124['query']['offset']);}_0x229f8e[_0x7dc9('0x32')]=qs[_0x7dc9('0x33')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x33')]);_0x229f8e['where']=qs[_0x7dc9('0x34')](_[_0x7dc9('0x35')](_0x450124[_0x7dc9('0x29')],_0x1fcf0e[_0x7dc9('0x34')]),_0x14083d);if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]){_0x229f8e[_0x7dc9('0x37')]=_[_0x7dc9('0x38')](_0x229f8e[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x27')](_0x14083d,function(_0x452aed){if(_0x452aed[_0x7dc9('0x39')]!=='VIRTUAL'){var _0x34b5c9={};_0x34b5c9[_0x452aed[_0x7dc9('0x24')]]={'$like':'%'+_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]+'%'};return _0x34b5c9;}})});}_0x229f8e=_['merge']({},_0x229f8e,_0x450124[_0x7dc9('0x3a')]);var _0x89db0e={'where':_0x229f8e[_0x7dc9('0x37')]};return db[_0x7dc9('0x3b')][_0x7dc9('0x1b')](_0x89db0e)[_0x7dc9('0x21')](function(_0x5a1201){_0x3c4379['count']=_0x5a1201;if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x3c')]){_0x229f8e['include']=[{'all':!![]}];}return db[_0x7dc9('0x3b')]['findAll'](_0x229f8e);})[_0x7dc9('0x21')](function(_0x2a91fe){_0x3c4379[_0x7dc9('0x3d')]=_0x2a91fe;return _0x3c4379;})['then'](respondWithFilteredResult(_0x236d42,_0x229f8e))[_0x7dc9('0x3e')](handleError(_0x236d42,null));};exports[_0x7dc9('0x3f')]=function(_0x1929b6,_0x95513c){var _0x28ffc0={'raw':![],'where':{'id':_0x1929b6[_0x7dc9('0x40')]['id']}},_0x23499a={};_0x23499a['model']=_[_0x7dc9('0x2a')](db['ScreenRecording']['rawAttributes']);_0x23499a[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x1929b6[_0x7dc9('0x29')]);_0x23499a[_0x7dc9('0x34')]=_[_0x7dc9('0x2b')](_0x23499a[_0x7dc9('0x2c')],_0x23499a[_0x7dc9('0x29')]);_0x28ffc0[_0x7dc9('0x2e')]=_[_0x7dc9('0x2b')](_0x23499a['model'],qs[_0x7dc9('0x2d')](_0x1929b6[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x28ffc0[_0x7dc9('0x2e')]=_0x28ffc0[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x28ffc0['attributes']:_0x23499a[_0x7dc9('0x2c')];if(_0x1929b6[_0x7dc9('0x29')]['includeAll']){_0x28ffc0[_0x7dc9('0x41')]=[{'all':!![]}];}_0x28ffc0=_[_0x7dc9('0x38')]({},_0x28ffc0,_0x1929b6[_0x7dc9('0x3a')]);return db['ScreenRecording'][_0x7dc9('0x42')](_0x28ffc0)['then'](handleEntityNotFound(_0x95513c,null))['then'](respondWithResult(_0x95513c,null))[_0x7dc9('0x3e')](handleError(_0x95513c,null));};exports[_0x7dc9('0x43')]=function(_0x36d591,_0x5e0dc5){return db['ScreenRecording'][_0x7dc9('0x43')](_0x36d591['body'],{})[_0x7dc9('0x21')](respondWithResult(_0x5e0dc5,0xc9))[_0x7dc9('0x3e')](handleError(_0x5e0dc5,null));};exports['update']=function(_0x24ccce,_0x1d6c0a){if(_0x24ccce[_0x7dc9('0x44')]['id']){delete _0x24ccce[_0x7dc9('0x44')]['id'];}delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x45')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x46')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x47')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x48')];return db[_0x7dc9('0x3b')]['find']({'where':{'id':_0x24ccce[_0x7dc9('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d6c0a,null))['then'](saveUpdates(_0x24ccce[_0x7dc9('0x44')],null))[_0x7dc9('0x21')](respondWithResult(_0x1d6c0a,null))[_0x7dc9('0x3e')](handleError(_0x1d6c0a,null));};exports[_0x7dc9('0x49')]=function(_0x346d27,_0x510e2a){return db[_0x7dc9('0x3b')][_0x7dc9('0x49')]()[_0x7dc9('0x21')](respondWithResult(_0x510e2a,null))['catch'](handleError(_0x510e2a,null));};exports[_0x7dc9('0x4a')]=function(_0x3fc164,_0x2cf133,_0x32bc31){var _0xf41b8c=require(_0x7dc9('0x4b'));var _0x593132=![];var _0x366b8b={};if(_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]&&_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]===_0x7dc9('0x4c')){_0x366b8b[_0x7dc9('0x4c')]=_0x3fc164[_0x7dc9('0x40')]['id'];}else{_0x366b8b['id']=_0x3fc164[_0x7dc9('0x40')]['id'];}return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':_0x366b8b,'attributes':['id',_0x7dc9('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x2cf133,null))[_0x7dc9('0x21')](function(_0x39be46){if(_0x39be46){var _0x38df9a=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x39be46[_0x7dc9('0x48')]);var _0xd8d327=util[_0x7dc9('0x28')](_0x7dc9('0x4f'),_0x38df9a);if(fs[_0x7dc9('0x50')](_0xd8d327)){_0x593132=!![];return _0xf41b8c[_0x7dc9('0x51')](_0xd8d327,_0x38df9a,config['secrets']['recording'])['then'](function(){return _0x39be46;});}return _0x39be46;}})[_0x7dc9('0x21')](function(_0x3daf33){if(_0x3daf33){var _0x32a64f=path[_0x7dc9('0x4d')](config['root'],'server/files/screen_recordings',_0x3daf33[_0x7dc9('0x48')]);if(!fs[_0x7dc9('0x50')](_0x32a64f)){throw new db[(_0x7dc9('0x52'))][(_0x7dc9('0x53'))](_0x7dc9('0x54'));}if(_0x3daf33[_0x7dc9('0x55')]){return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,_0x3daf33['filename']+path[_0x7dc9('0x56')](_0x32a64f),function(){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}else{return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,function(_0x1dad95){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}}})['catch'](function(_0x175858){if(_0x175858[_0x7dc9('0x58')]===_0x7dc9('0x54')){_0x2cf133[_0x7dc9('0x16')](0x194)[_0x7dc9('0x25')](_0x7dc9('0x59'));}else{return handleError(_0x2cf133,null);}});};exports[_0x7dc9('0x5a')]=function(_0x2a02ed,_0x3463e4){return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':{'id':_0x2a02ed[_0x7dc9('0x40')]['id']}})[_0x7dc9('0x21')](function(_0x5eee27){if(_[_0x7dc9('0x5b')](_0x5eee27)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5eee27;})[_0x7dc9('0x21')](function(_0x15cf19){var _0x48ea37=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x15cf19[_0x7dc9('0x48')]);logger[_0x7dc9('0x5c')](_0x7dc9('0x5d'),_0x48ea37);if(!_['isNil'](_0x15cf19['value'])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger[_0x7dc9('0x5c')](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}_0x48ea37=_0x48ea37+_0x7dc9('0x61');if(!_[_0x7dc9('0x5b')](_0x15cf19[_0x7dc9('0x48')])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger['info'](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}return _0x15cf19;})['then'](function(_0x4f80bd){if(!_0x4f80bd)throw new InternalError();return _0x4f80bd[_0x7dc9('0x5a')]();})[_0x7dc9('0x21')](function(){_0x3463e4[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();})['catch'](handleError(_0x3463e4,null));}; \ No newline at end of file +var _0x7bae=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','find','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','secrets','recording','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x8d4581,_0x2ae516){var _0x5a0c60=function(_0x5850a1){while(--_0x5850a1){_0x8d4581['push'](_0x8d4581['shift']());}};_0x5a0c60(++_0x2ae516);}(_0x7bae,0x13b));var _0xe7ba=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x7bae[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['differenceBy'](_[_0xe7ba('0x2b')](_0x587c7d,'name'),['format']);_0x369451[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x48c869[_0xe7ba('0x31')]);_0x369451['filters']=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7[_0xe7ba('0x34')]=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x48c869['query'][_0xe7ba('0x35')]));_0x92fe7[_0xe7ba('0x34')]=_0x92fe7['attributes'][_0xe7ba('0x36')]?_0x92fe7[_0xe7ba('0x34')]:_0x369451[_0xe7ba('0x30')];if(!_0x48c869['query'][_0xe7ba('0x37')](_0xe7ba('0x38'))){_0x92fe7['limit']=qs[_0xe7ba('0x1e')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x92fe7['offset']=qs[_0xe7ba('0x20')](_0x48c869[_0xe7ba('0x31')]['offset']);}_0x92fe7[_0xe7ba('0x39')]=qs[_0xe7ba('0x3a')](_0x48c869[_0xe7ba('0x31')]['sort']);_0x92fe7['where']=qs[_0xe7ba('0x3b')](_[_0xe7ba('0x3c')](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x3b')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')]['filter']){_0x92fe7[_0xe7ba('0x3d')]=_[_0xe7ba('0x3e')](_0x92fe7[_0xe7ba('0x3d')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x5e9619){if(_0x5e9619[_0xe7ba('0x3f')]!==_0xe7ba('0x40')){var _0x46e31a={};_0x46e31a[_0x5e9619[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x41')]+'%'};return _0x46e31a;}})});}_0x92fe7=_[_0xe7ba('0x3e')]({},_0x92fe7,_0x48c869['options']);var _0x3429fa={'where':_0x92fe7[_0xe7ba('0x3d')]};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x3429fa)[_0xe7ba('0x26')](function(_0x3b3abe){_0x4bf5f9[_0xe7ba('0x1f')]=_0x3b3abe;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x42')]){_0x92fe7['include']=[{'all':!![]}];}return db[_0xe7ba('0x2c')][_0xe7ba('0x43')](_0x92fe7);})['then'](function(_0x5dae52){_0x4bf5f9[_0xe7ba('0x44')]=_0x5dae52;return _0x4bf5f9;})[_0xe7ba('0x26')](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x45')](handleError(_0x102925,null));};exports['show']=function(_0x249e1d,_0x82246e){var _0x3569b6={'raw':![],'where':{'id':_0x249e1d[_0xe7ba('0x46')]['id']}},_0x12770d={};_0x12770d['model']=_[_0xe7ba('0x32')](db['ScreenRecording'][_0xe7ba('0x2d')]);_0x12770d[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x249e1d[_0xe7ba('0x31')]);_0x12770d[_0xe7ba('0x3b')]=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],_0x12770d[_0xe7ba('0x31')]);_0x3569b6['attributes']=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x249e1d[_0xe7ba('0x31')][_0xe7ba('0x35')]));_0x3569b6[_0xe7ba('0x34')]=_0x3569b6[_0xe7ba('0x34')][_0xe7ba('0x36')]?_0x3569b6[_0xe7ba('0x34')]:_0x12770d[_0xe7ba('0x30')];if(_0x249e1d['query'][_0xe7ba('0x42')]){_0x3569b6['include']=[{'all':!![]}];}_0x3569b6=_[_0xe7ba('0x3e')]({},_0x3569b6,_0x249e1d[_0xe7ba('0x47')]);return db[_0xe7ba('0x2c')][_0xe7ba('0x48')](_0x3569b6)[_0xe7ba('0x26')](handleEntityNotFound(_0x82246e,null))[_0xe7ba('0x26')](respondWithResult(_0x82246e,null))['catch'](handleError(_0x82246e,null));};exports[_0xe7ba('0x49')]=function(_0x1cc668,_0x3f17ed){return db[_0xe7ba('0x2c')][_0xe7ba('0x49')](_0x1cc668[_0xe7ba('0x4a')],{})[_0xe7ba('0x26')](respondWithResult(_0x3f17ed,0xc9))[_0xe7ba('0x45')](handleError(_0x3f17ed,null));};exports[_0xe7ba('0x25')]=function(_0x1189bd,_0xbe2a32){if(_0x1189bd['body']['id']){delete _0x1189bd[_0xe7ba('0x4a')]['id'];}delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4b')];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4c')];delete _0x1189bd[_0xe7ba('0x4a')]['closedAt'];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4d')];return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x1189bd[_0xe7ba('0x46')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0xbe2a32,null))[_0xe7ba('0x26')](saveUpdates(_0x1189bd['body'],null))['then'](respondWithResult(_0xbe2a32,null))[_0xe7ba('0x45')](handleError(_0xbe2a32,null));};exports[_0xe7ba('0x4e')]=function(_0x285743,_0x5af106){return db[_0xe7ba('0x2c')][_0xe7ba('0x4e')]()[_0xe7ba('0x26')](respondWithResult(_0x5af106,null))[_0xe7ba('0x45')](handleError(_0x5af106,null));};exports[_0xe7ba('0x4f')]=function(_0x6b6f1,_0xf3a41f,_0x5e6612){var _0x2a6fdd=require(_0xe7ba('0x50'));var _0x316b51=![];var _0x5863c8={};if(_0x6b6f1[_0xe7ba('0x31')][_0xe7ba('0x3f')]&&_0x6b6f1['query'][_0xe7ba('0x3f')]===_0xe7ba('0x51')){_0x5863c8['uniqueid']=_0x6b6f1[_0xe7ba('0x46')]['id'];}else{_0x5863c8['id']=_0x6b6f1['params']['id'];}return db[_0xe7ba('0x2c')][_0xe7ba('0x48')]({'where':_0x5863c8,'attributes':['id',_0xe7ba('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xf3a41f,null))[_0xe7ba('0x26')](function(_0x1128be){if(_0x1128be){var _0x314549=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],'server/files/screen_recordings',_0x1128be[_0xe7ba('0x4d')]);var _0x455e50=util[_0xe7ba('0x54')](_0xe7ba('0x55'),_0x314549);if(fs[_0xe7ba('0x56')](_0x455e50)){_0x316b51=!![];return _0x2a6fdd['decryptFile'](_0x455e50,_0x314549,config[_0xe7ba('0x57')][_0xe7ba('0x58')])[_0xe7ba('0x26')](function(){return _0x1128be;});}return _0x1128be;}})[_0xe7ba('0x26')](function(_0x57b23e){if(_0x57b23e){var _0x3e31c1=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],_0xe7ba('0x59'),_0x57b23e[_0xe7ba('0x4d')]);if(!fs[_0xe7ba('0x56')](_0x3e31c1)){throw new db['Sequelize'][(_0xe7ba('0x5a'))](_0xe7ba('0x5b'));}if(_0x57b23e[_0xe7ba('0x5c')]){return _0xf3a41f['download'](_0x3e31c1,_0x57b23e[_0xe7ba('0x5c')]+path[_0xe7ba('0x5d')](_0x3e31c1),function(){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}else{return _0xf3a41f[_0xe7ba('0x4f')](_0x3e31c1,function(_0x45fb0f){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}}})[_0xe7ba('0x45')](function(_0x3351d5){if(_0x3351d5[_0xe7ba('0x5f')]===_0xe7ba('0x5b')){_0xf3a41f[_0xe7ba('0x1b')](0x194)[_0xe7ba('0x60')]('Not\x20found');}else{return handleError(_0xf3a41f,null);}});};exports[_0xe7ba('0x61')]=function(_0x384cea,_0x357af4){return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x384cea['params']['id']}})[_0xe7ba('0x26')](function(_0x194dff){if(_[_0xe7ba('0x62')](_0x194dff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x194dff;})['then'](function(_0x46d06e){var _0x2812af=path[_0xe7ba('0x52')](config['root'],_0xe7ba('0x59'),_0x46d06e[_0xe7ba('0x4d')]);logger[_0xe7ba('0x63')](_0xe7ba('0x64'),_0x2812af);if(!_[_0xe7ba('0x62')](_0x46d06e['value'])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7ba('0x66')](_0x2812af);}_0x2812af=_0x2812af+_0xe7ba('0x67');if(!_[_0xe7ba('0x62')](_0x46d06e[_0xe7ba('0x4d')])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+_0xe7ba('0x68'));fs[_0xe7ba('0x66')](_0x2812af);}return _0x46d06e;})[_0xe7ba('0x26')](function(_0x5a5394){if(!_0x5a5394)throw new InternalError();return _0x5a5394[_0xe7ba('0x61')]();})[_0xe7ba('0x26')](function(){_0x357af4[_0xe7ba('0x1b')](0xcc)[_0xe7ba('0x1c')]();})['catch'](handleError(_0x357af4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 58dc9eb..8b0db32 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 _0x16b4=['interactionid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0x16b4,0x9b));var _0x416b=function(_0x4f739d,_0x4cf30b){_0x4f739d=_0x4f739d-0x0;var _0x13a228=_0x16b4[_0x4f739d];return _0x13a228;};'use strict';var _=require('lodash');var util=require(_0x416b('0x0'));var logger=require(_0x416b('0x1'))('api');var moment=require(_0x416b('0x2'));var BPromise=require(_0x416b('0x3'));var rp=require(_0x416b('0x4'));var fs=require('fs');var path=require(_0x416b('0x5'));var rimraf=require(_0x416b('0x6'));var config=require(_0x416b('0x7'));var attributes=require(_0x416b('0x8'));module[_0x416b('0x9')]=function(_0x1a2837,_0x3f13ef){return _0x1a2837[_0x416b('0xa')](_0x416b('0xb'),attributes,{'tableName':_0x416b('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x416b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5591=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','define','ScreenRecording'];(function(_0x1598bf,_0x794364){var _0x29c698=function(_0x40fce1){while(--_0x40fce1){_0x1598bf['push'](_0x1598bf['shift']());}};_0x29c698(++_0x794364);}(_0x5591,0xe2));var _0x1559=function(_0x3108a1,_0x39bdc3){_0x3108a1=_0x3108a1-0x0;var _0x7afe76=_0x5591[_0x3108a1];return _0x7afe76;};'use strict';var _=require(_0x1559('0x0'));var util=require(_0x1559('0x1'));var logger=require(_0x1559('0x2'))(_0x1559('0x3'));var moment=require(_0x1559('0x4'));var BPromise=require(_0x1559('0x5'));var rp=require(_0x1559('0x6'));var fs=require('fs');var path=require(_0x1559('0x7'));var rimraf=require('rimraf');var config=require(_0x1559('0x8'));var attributes=require(_0x1559('0x9'));module['exports']=function(_0x3c46cc,_0x4c404a){return _0x3c46cc[_0x1559('0xa')](_0x1559('0xb'),attributes,{'tableName':_0x1559('0xc'),'paranoid':![],'indexes':[{'name':_0x1559('0xd'),'fields':[_0x1559('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 798d165..78cbe37 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 _0x2790=['client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x468c9a,_0x45e9db){var _0x1eb11a=function(_0x4bc4ad){while(--_0x4bc4ad){_0x468c9a['push'](_0x468c9a['shift']());}};_0x1eb11a(++_0x45e9db);}(_0x2790,0x1ef));var _0x0279=function(_0x3a544a,_0x73a217){_0x3a544a=_0x3a544a-0x0;var _0x342f1e=_0x2790[_0x3a544a];return _0x342f1e;};'use strict';var _=require('lodash');var util=require(_0x0279('0x0'));var moment=require(_0x0279('0x1'));var BPromise=require('bluebird');var rs=require(_0x0279('0x2'));var fs=require('fs');var Redis=require(_0x0279('0x3'));var db=require(_0x0279('0x4'))['db'];var utils=require(_0x0279('0x5'));var logger=require('../../config/logger')(_0x0279('0x6'));var config=require(_0x0279('0x7'));var jayson=require(_0x0279('0x8'));var client=jayson[_0x0279('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1715fe,_0x2ca959,_0x3224fd){return new BPromise(function(_0x27bf3f,_0x2ff986){return client[_0x0279('0xa')](_0x1715fe,_0x3224fd)[_0x0279('0xb')](function(_0x5a39c9){logger[_0x0279('0xc')](_0x0279('0xd'),_0x2ca959,_0x0279('0xe'));logger['debug'](_0x0279('0xf'),_0x2ca959,_0x0279('0xe'),JSON[_0x0279('0x10')](_0x5a39c9));if(_0x5a39c9['error']){if(_0x5a39c9[_0x0279('0x11')][_0x0279('0x12')]===0x1f4){logger[_0x0279('0x11')](_0x0279('0xd'),_0x2ca959,_0x5a39c9[_0x0279('0x11')][_0x0279('0x13')]);return _0x2ff986(_0x5a39c9[_0x0279('0x11')]['message']);}logger[_0x0279('0x11')](_0x0279('0xd'),_0x2ca959,_0x5a39c9[_0x0279('0x11')]['message']);return _0x27bf3f(_0x5a39c9[_0x0279('0x11')][_0x0279('0x13')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x2ca959,'request\x20sent');_0x27bf3f(_0x5a39c9['result']['message']);}})[_0x0279('0x14')](function(_0x2ebc7f){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x2ca959,_0x2ebc7f);_0x2ff986(_0x2ebc7f);});});} \ No newline at end of file +var _0x4f3b=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f3b,0x1b8));var _0xb4f3=function(_0x49f67f,_0x4113a4){_0x49f67f=_0x49f67f-0x0;var _0x4779a1=_0x4f3b[_0x49f67f];return _0x4779a1;};'use strict';var _=require(_0xb4f3('0x0'));var util=require(_0xb4f3('0x1'));var moment=require('moment');var BPromise=require(_0xb4f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4f3('0x3'))['db'];var utils=require(_0xb4f3('0x4'));var logger=require(_0xb4f3('0x5'))(_0xb4f3('0x6'));var config=require(_0xb4f3('0x7'));var jayson=require(_0xb4f3('0x8'));var client=jayson[_0xb4f3('0x9')][_0xb4f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd4886c,_0x4a2238,_0x57ddf9){return new BPromise(function(_0x2053e6,_0x5341f0){return client[_0xb4f3('0xb')](_0xd4886c,_0x57ddf9)[_0xb4f3('0xc')](function(_0x589908){logger[_0xb4f3('0xd')](_0xb4f3('0xe'),_0x4a2238,_0xb4f3('0xf'));logger[_0xb4f3('0x10')](_0xb4f3('0x11'),_0x4a2238,_0xb4f3('0xf'),JSON[_0xb4f3('0x12')](_0x589908));if(_0x589908['error']){if(_0x589908[_0xb4f3('0x13')]['code']===0x1f4){logger[_0xb4f3('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x4a2238,_0x589908['error']['message']);return _0x5341f0(_0x589908[_0xb4f3('0x13')][_0xb4f3('0x14')]);}logger[_0xb4f3('0x13')](_0xb4f3('0xe'),_0x4a2238,_0x589908[_0xb4f3('0x13')]['message']);return _0x2053e6(_0x589908[_0xb4f3('0x13')][_0xb4f3('0x14')]);}else{logger[_0xb4f3('0xd')](_0xb4f3('0xe'),_0x4a2238,'request\x20sent');_0x2053e6(_0x589908[_0xb4f3('0x15')][_0xb4f3('0x14')]);}})[_0xb4f3('0x16')](function(_0x545e29){logger[_0xb4f3('0x13')](_0xb4f3('0xe'),_0x4a2238,_0x545e29);_0x5341f0(_0x545e29);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 01d9464..5d3ba5c 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 _0xb50e=['isAuthenticated','index','/now','getDate','/:id','show','/:id/logo_login','gdpr','/:id/preferred','/:id/favicon','diskStorage','join','root','%s%s','logo','originalname','post','/:id/logo','single','file','addLogo','server/files/images/logos/','format','extname','addLogoLogin','favicon','put','update','exports','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get'];(function(_0x37f491,_0x1b848b){var _0x4d3a5a=function(_0x3221d7){while(--_0x3221d7){_0x37f491['push'](_0x37f491['shift']());}};_0x4d3a5a(++_0x1b848b);}(_0xb50e,0x18f));var _0xeb50=function(_0x377217,_0x26b013){_0x377217=_0x377217-0x0;var _0x26258d=_0xb50e[_0x377217];return _0x26258d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb50('0x0'));var timeout=require('connect-timeout');var express=require(_0xeb50('0x1'));var router=express[_0xeb50('0x2')]();var fs_extra=require(_0xeb50('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xeb50('0x4'));var config=require(_0xeb50('0x5'));var controller=require(_0xeb50('0x6'));router[_0xeb50('0x7')]('/',auth[_0xeb50('0x8')](),controller[_0xeb50('0x9')]);router[_0xeb50('0x7')](_0xeb50('0xa'),controller[_0xeb50('0xb')]);router[_0xeb50('0x7')](_0xeb50('0xc'),controller[_0xeb50('0xd')]);router[_0xeb50('0x7')]('/:id/logo',controller['getLogo']);router['get'](_0xeb50('0xe'),controller['getLogoLogin']);router[_0xeb50('0x7')]('/:id/gdpr',controller[_0xeb50('0xf')]);router[_0xeb50('0x7')](_0xeb50('0x10'),controller['getPreferred']);router['get'](_0xeb50('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0xeb50('0x12')]({'destination':function(_0x64122a,_0x384ed0,_0x274974){_0x274974(null,path[_0xeb50('0x13')](config[_0xeb50('0x14')],'server/files/images/logos/'));},'filename':function(_0x10993a,_0x4ac2ee,_0x15bd2b){_0x15bd2b(null,util['format'](_0xeb50('0x15'),_0xeb50('0x16'),path['extname'](_0x4ac2ee[_0xeb50('0x17')])));}})});router[_0xeb50('0x18')](_0xeb50('0x19'),upload[_0xeb50('0x1a')](_0xeb50('0x1b')),controller[_0xeb50('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c962f,_0x119062,_0x5e8b2f){_0x5e8b2f(null,path[_0xeb50('0x13')](config['root'],_0xeb50('0x1d')));},'filename':function(_0x1b132c,_0x278082,_0x1a5629){_0x1a5629(null,util[_0xeb50('0x1e')](_0xeb50('0x15'),'logologin',path[_0xeb50('0x1f')](_0x278082[_0xeb50('0x17')])));}})});router['post']('/:id/logo_login',upload[_0xeb50('0x1a')](_0xeb50('0x1b')),controller[_0xeb50('0x20')]);var upload=multer({'storage':multer[_0xeb50('0x12')]({'destination':function(_0xa4e70d,_0x35b87a,_0x3c6db1){_0x3c6db1(null,path[_0xeb50('0x13')](config[_0xeb50('0x14')],_0xeb50('0x1d')));},'filename':function(_0x5017da,_0x5f234b,_0x41f4ce){_0x41f4ce(null,util[_0xeb50('0x1e')](_0xeb50('0x15'),'preferred',path[_0xeb50('0x1f')](_0x5f234b['originalname'])));}})});router[_0xeb50('0x18')](_0xeb50('0x10'),upload[_0xeb50('0x1a')](_0xeb50('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0xeb50('0x12')]({'destination':function(_0x3c550d,_0x59444d,_0x1577db){_0x1577db(null,path[_0xeb50('0x13')](config[_0xeb50('0x14')],_0xeb50('0x1d')));},'filename':function(_0x6ce7c5,_0x38ee99,_0x1a8dfc){_0x1a8dfc(null,util[_0xeb50('0x1e')](_0xeb50('0x15'),_0xeb50('0x21'),path[_0xeb50('0x1f')](_0x38ee99[_0xeb50('0x17')])));}})});router[_0xeb50('0x18')](_0xeb50('0x11'),upload[_0xeb50('0x1a')]('file'),controller['addFavicon']);router[_0xeb50('0x22')](_0xeb50('0xc'),auth[_0xeb50('0x8')](),controller[_0xeb50('0x23')]);module[_0xeb50('0x24')]=router; \ No newline at end of file +var _0x0ae4=['format','%s%s','originalname','single','addLogo','diskStorage','logologin','extname','post','file','addLogoLogin','preferred','favicon','addFavicon','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/'];(function(_0x1d7bbd,_0x327073){var _0x520685=function(_0x24e215){while(--_0x24e215){_0x1d7bbd['push'](_0x1d7bbd['shift']());}};_0x520685(++_0x327073);}(_0x0ae4,0x14c));var _0x40ae=function(_0x5be766,_0xb099f){_0x5be766=_0x5be766-0x0;var _0xe029=_0x0ae4[_0x5be766];return _0xe029;};'use strict';var multer=require(_0x40ae('0x0'));var util=require(_0x40ae('0x1'));var path=require(_0x40ae('0x2'));var timeout=require(_0x40ae('0x3'));var express=require(_0x40ae('0x4'));var router=express[_0x40ae('0x5')]();var fs_extra=require(_0x40ae('0x6'));var auth=require(_0x40ae('0x7'));var interaction=require(_0x40ae('0x8'));var config=require(_0x40ae('0x9'));var controller=require(_0x40ae('0xa'));router[_0x40ae('0xb')]('/',auth['isAuthenticated'](),controller[_0x40ae('0xc')]);router[_0x40ae('0xb')](_0x40ae('0xd'),controller[_0x40ae('0xe')]);router['get'](_0x40ae('0xf'),controller[_0x40ae('0x10')]);router[_0x40ae('0xb')](_0x40ae('0x11'),controller[_0x40ae('0x12')]);router['get'](_0x40ae('0x13'),controller['getLogoLogin']);router[_0x40ae('0xb')](_0x40ae('0x14'),controller['gdpr']);router[_0x40ae('0xb')](_0x40ae('0x15'),controller[_0x40ae('0x16')]);router[_0x40ae('0xb')](_0x40ae('0x17'),controller[_0x40ae('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x526892,_0x10dbae,_0xfc824d){_0xfc824d(null,path[_0x40ae('0x19')](config[_0x40ae('0x1a')],_0x40ae('0x1b')));},'filename':function(_0x34cc1a,_0x40b859,_0x179bf2){_0x179bf2(null,util[_0x40ae('0x1c')](_0x40ae('0x1d'),'logo',path['extname'](_0x40b859[_0x40ae('0x1e')])));}})});router['post'](_0x40ae('0x11'),upload[_0x40ae('0x1f')]('file'),controller[_0x40ae('0x20')]);var upload=multer({'storage':multer[_0x40ae('0x21')]({'destination':function(_0x28da0e,_0x40c68b,_0x55e91b){_0x55e91b(null,path['join'](config[_0x40ae('0x1a')],_0x40ae('0x1b')));},'filename':function(_0x43af56,_0x57cf42,_0x1ac5f2){_0x1ac5f2(null,util['format']('%s%s',_0x40ae('0x22'),path[_0x40ae('0x23')](_0x57cf42[_0x40ae('0x1e')])));}})});router[_0x40ae('0x24')](_0x40ae('0x13'),upload[_0x40ae('0x1f')](_0x40ae('0x25')),controller[_0x40ae('0x26')]);var upload=multer({'storage':multer[_0x40ae('0x21')]({'destination':function(_0x221b8c,_0x407a6f,_0x498625){_0x498625(null,path['join'](config[_0x40ae('0x1a')],_0x40ae('0x1b')));},'filename':function(_0x486a91,_0x38b055,_0x28bb9b){_0x28bb9b(null,util['format']('%s%s',_0x40ae('0x27'),path[_0x40ae('0x23')](_0x38b055['originalname'])));}})});router[_0x40ae('0x24')](_0x40ae('0x15'),upload[_0x40ae('0x1f')](_0x40ae('0x25')),controller['addPreferred']);var upload=multer({'storage':multer[_0x40ae('0x21')]({'destination':function(_0x4330b3,_0x4fc6df,_0x14b00c){_0x14b00c(null,path[_0x40ae('0x19')](config[_0x40ae('0x1a')],_0x40ae('0x1b')));},'filename':function(_0x4a8975,_0x35ffa9,_0x588004){_0x588004(null,util['format'](_0x40ae('0x1d'),_0x40ae('0x28'),path['extname'](_0x35ffa9[_0x40ae('0x1e')])));}})});router['post'](_0x40ae('0x17'),upload[_0x40ae('0x1f')](_0x40ae('0x25')),controller[_0x40ae('0x29')]);router['put']('/:id',auth[_0x40ae('0x2a')](),controller[_0x40ae('0x2b')]);module[_0x40ae('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 a7bbf0f..e2b9029 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(_0x188b1e,_0x1a91e8){var _0x3df9b5=function(_0x151fa5){while(--_0x151fa5){_0x188b1e['push'](_0x188b1e['shift']());}};_0x3df9b5(++_0x1a91e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x45f6c6,_0x468c48){var _0x32b318=function(_0x230af6){while(--_0x230af6){_0x45f6c6['push'](_0x45f6c6['shift']());}};_0x32b318(++_0x468c48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 eb01f2d..f263625 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 _0x8d37=['type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','include','findAll','show','params','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','upperFirst','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','Setting','rawAttributes','fieldName'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8d37,0xbc));var _0x78d3=function(_0x3cc11a,_0x2817a6){_0x3cc11a=_0x3cc11a-0x0;var _0x797034=_0x8d37[_0x3cc11a];return _0x797034;};'use strict';var emlformat=require(_0x78d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x78d3('0x1'));var jsonpatch=require(_0x78d3('0x2'));var rp=require(_0x78d3('0x3'));var moment=require(_0x78d3('0x4'));var BPromise=require(_0x78d3('0x5'));var Mustache=require(_0x78d3('0x6'));var util=require(_0x78d3('0x7'));var path=require('path');var sox=require(_0x78d3('0x8'));var csv=require(_0x78d3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78d3('0xa'));var _=require(_0x78d3('0xb'));var squel=require('squel');var crypto=require(_0x78d3('0xc'));var jsforce=require(_0x78d3('0xd'));var deskjs=require(_0x78d3('0xe'));var toCsv=require(_0x78d3('0x9'));var querystring=require(_0x78d3('0xf'));var Papa=require(_0x78d3('0x10'));var Redis=require('ioredis');var authService=require(_0x78d3('0x11'));var qs=require(_0x78d3('0x12'));var as=require(_0x78d3('0x13'));var hardwareService=require(_0x78d3('0x14'));var logger=require(_0x78d3('0x15'))('api');var utils=require(_0x78d3('0x16'));var config=require(_0x78d3('0x17'));var licenseUtil=require(_0x78d3('0x18'));var db=require(_0x78d3('0x19'))['db'];var jayson=require(_0x78d3('0x1a'));var client=jayson[_0x78d3('0x1b')][_0x78d3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x55efc1,_0x2df455,_0x3c1a14,_0x151d4a){return new BPromise(function(_0x5b7528,_0x442d41){var _0x4c3a49=_0x151d4a||client;return _0x4c3a49[_0x78d3('0x1d')](_0x55efc1,_0x3c1a14)['then'](function(_0x28152a){logger['info'](_0x78d3('0x1e'),_0x2df455,_0x78d3('0x1f'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x2df455,_0x78d3('0x1f'),JSON[_0x78d3('0x20')](_0x28152a));if(_0x28152a[_0x78d3('0x21')]){if(_0x28152a['error']['code']===0x1f4){logger[_0x78d3('0x21')]('Setting,\x20%s,\x20%s',_0x2df455,_0x28152a['error']['message']);return _0x442d41(_0x28152a[_0x78d3('0x21')][_0x78d3('0x22')]);}logger[_0x78d3('0x21')]('Setting,\x20%s,\x20%s',_0x2df455,_0x28152a[_0x78d3('0x21')][_0x78d3('0x22')]);return _0x5b7528(_0x28152a['error'][_0x78d3('0x22')]);}else{logger[_0x78d3('0x23')](_0x78d3('0x1e'),_0x2df455,_0x78d3('0x1f'));_0x5b7528(_0x28152a[_0x78d3('0x24')][_0x78d3('0x22')]);}})[_0x78d3('0x25')](function(_0x15e16d){logger[_0x78d3('0x21')](_0x78d3('0x1e'),_0x2df455,_0x15e16d);_0x442d41(_0x15e16d);});});}function respondWithStatusCode(_0x55c490,_0x33175c){_0x33175c=_0x33175c||0xcc;return function(_0x484ae6){if(_0x484ae6){return _0x55c490[_0x78d3('0x26')](_0x33175c);}return _0x55c490[_0x78d3('0x27')](_0x33175c)['end']();};}function respondWithResult(_0x574ff8,_0x51b236){_0x51b236=_0x51b236||0xc8;return function(_0x213c35){if(_0x213c35){return _0x574ff8['status'](_0x51b236)['json'](_0x213c35);}};}function respondWithFilteredResult(_0x1aa479,_0x361803){return function(_0x111489){if(_0x111489){var _0x3efacb=typeof _0x361803[_0x78d3('0x28')]==='undefined'&&typeof _0x361803[_0x78d3('0x29')]===_0x78d3('0x2a');var _0x8c240c=_0x111489[_0x78d3('0x2b')];var _0x18dcd4=_0x3efacb?0x0:_0x361803[_0x78d3('0x28')];var _0x291fa8=_0x3efacb?_0x111489[_0x78d3('0x2b')]:_0x361803[_0x78d3('0x28')]+_0x361803[_0x78d3('0x29')];var _0x399728;if(_0x291fa8>=_0x8c240c){_0x291fa8=_0x8c240c;_0x399728=0xc8;}else{_0x399728=0xce;}_0x1aa479[_0x78d3('0x27')](_0x399728);return _0x1aa479[_0x78d3('0x2c')](_0x78d3('0x2d'),_0x18dcd4+'-'+_0x291fa8+'/'+_0x8c240c)['json'](_0x111489);}return null;};}function patchUpdates(_0x245edd){return function(_0x1bf593){try{jsonpatch[_0x78d3('0x2e')](_0x1bf593,_0x245edd,!![]);}catch(_0x1113cb){return BPromise[_0x78d3('0x2f')](_0x1113cb);}return _0x1bf593[_0x78d3('0x30')]();};}function saveUpdates(_0x227574,_0x569cc6){return function(_0x384607){if(_0x384607){return _0x384607[_0x78d3('0x31')](_0x227574)[_0x78d3('0x32')](function(_0x5e219c){return _0x5e219c;});}return null;};}function removeEntity(_0x425ca3,_0x4b457a){return function(_0x1e9b36){if(_0x1e9b36){return _0x1e9b36[_0x78d3('0x33')]()[_0x78d3('0x32')](function(){_0x425ca3[_0x78d3('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x207117,_0x478ddc){return function(_0x1e4611){if(!_0x1e4611){_0x207117['sendStatus'](0x194);}return _0x1e4611;};}function handleError(_0x57ca0e,_0x1a1a45){_0x1a1a45=_0x1a1a45||0x1f4;return function(_0x273f58){logger[_0x78d3('0x21')](_0x273f58['stack']);if(_0x273f58[_0x78d3('0x34')]){delete _0x273f58['name'];}_0x57ca0e[_0x78d3('0x27')](_0x1a1a45)['send'](_0x273f58);};}exports[_0x78d3('0x35')]=function(_0xccd183,_0x41add5){var _0x4dc8b2={},_0x96e7f4={},_0x88ae51={'count':0x0,'rows':[]};var _0x2b0ce1=_[_0x78d3('0x36')](db[_0x78d3('0x37')][_0x78d3('0x38')],function(_0xd77ee6){return{'name':_0xd77ee6[_0x78d3('0x39')],'type':_0xd77ee6[_0x78d3('0x3a')][_0x78d3('0x3b')]};});_0x96e7f4['model']=_['map'](_0x2b0ce1,_0x78d3('0x34'));_0x96e7f4[_0x78d3('0x3c')]=_[_0x78d3('0x3d')](_0xccd183[_0x78d3('0x3c')]);_0x96e7f4[_0x78d3('0x3e')]=_['intersection'](_0x96e7f4[_0x78d3('0x3f')],_0x96e7f4[_0x78d3('0x3c')]);_0x4dc8b2[_0x78d3('0x40')]=_[_0x78d3('0x41')](_0x96e7f4[_0x78d3('0x3f')],qs[_0x78d3('0x42')](_0xccd183['query']['fields']));_0x4dc8b2[_0x78d3('0x40')]=_0x4dc8b2[_0x78d3('0x40')][_0x78d3('0x43')]?_0x4dc8b2[_0x78d3('0x40')]:_0x96e7f4[_0x78d3('0x3f')];if(!_0xccd183[_0x78d3('0x3c')][_0x78d3('0x44')]('nolimit')){_0x4dc8b2[_0x78d3('0x29')]=qs['limit'](_0xccd183['query'][_0x78d3('0x29')]);_0x4dc8b2[_0x78d3('0x28')]=qs[_0x78d3('0x28')](_0xccd183[_0x78d3('0x3c')]['offset']);}_0x4dc8b2[_0x78d3('0x45')]=qs[_0x78d3('0x46')](_0xccd183['query']['sort']);_0x4dc8b2['where']=qs[_0x78d3('0x3e')](_['pick'](_0xccd183[_0x78d3('0x3c')],_0x96e7f4[_0x78d3('0x3e')]),_0x2b0ce1);if(_0xccd183[_0x78d3('0x3c')][_0x78d3('0x47')]){_0x4dc8b2[_0x78d3('0x48')]=_[_0x78d3('0x49')](_0x4dc8b2[_0x78d3('0x48')],{'$or':_[_0x78d3('0x36')](_0x2b0ce1,function(_0x68e73){if(_0x68e73[_0x78d3('0x3a')]!=='VIRTUAL'){var _0x3bc56e={};_0x3bc56e[_0x68e73[_0x78d3('0x34')]]={'$like':'%'+_0xccd183[_0x78d3('0x3c')][_0x78d3('0x47')]+'%'};return _0x3bc56e;}})});}_0x4dc8b2=_[_0x78d3('0x49')]({},_0x4dc8b2,_0xccd183[_0x78d3('0x4a')]);var _0x453683={'where':_0x4dc8b2['where']};return db[_0x78d3('0x37')][_0x78d3('0x2b')](_0x453683)[_0x78d3('0x32')](function(_0x4085f4){_0x88ae51['count']=_0x4085f4;if(_0xccd183[_0x78d3('0x3c')]['includeAll']){_0x4dc8b2[_0x78d3('0x4b')]=[{'all':!![]}];}return db[_0x78d3('0x37')][_0x78d3('0x4c')](_0x4dc8b2);})['then'](function(_0x56463e){_0x88ae51['rows']=_0x56463e;return _0x88ae51;})[_0x78d3('0x32')](respondWithFilteredResult(_0x41add5,_0x4dc8b2))[_0x78d3('0x25')](handleError(_0x41add5,null));};exports[_0x78d3('0x4d')]=function(_0x18b27d,_0x5180ce){var _0x3537c9={'raw':![],'where':{'id':_0x18b27d[_0x78d3('0x4e')]['id']}},_0x162cc4={};_0x162cc4[_0x78d3('0x3f')]=_[_0x78d3('0x3d')](db['Setting'][_0x78d3('0x38')]);_0x162cc4[_0x78d3('0x3c')]=_[_0x78d3('0x3d')](_0x18b27d[_0x78d3('0x3c')]);_0x162cc4[_0x78d3('0x3e')]=_[_0x78d3('0x41')](_0x162cc4[_0x78d3('0x3f')],_0x162cc4[_0x78d3('0x3c')]);_0x3537c9[_0x78d3('0x40')]=_[_0x78d3('0x41')](_0x162cc4[_0x78d3('0x3f')],qs[_0x78d3('0x42')](_0x18b27d['query'][_0x78d3('0x42')]));_0x3537c9[_0x78d3('0x40')]=_0x3537c9[_0x78d3('0x40')][_0x78d3('0x43')]?_0x3537c9[_0x78d3('0x40')]:_0x162cc4[_0x78d3('0x3f')];if(_0x18b27d[_0x78d3('0x3c')]['includeAll']){_0x3537c9[_0x78d3('0x4b')]=[{'all':!![]}];}_0x3537c9=_[_0x78d3('0x49')]({},_0x3537c9,_0x18b27d[_0x78d3('0x4a')]);return db[_0x78d3('0x37')][_0x78d3('0x4f')](_0x3537c9)[_0x78d3('0x32')](handleEntityNotFound(_0x5180ce,null))['then'](respondWithResult(_0x5180ce,null))[_0x78d3('0x25')](handleError(_0x5180ce,null));};exports[_0x78d3('0x31')]=function(_0x575b52,_0x4afcb1){if(_0x575b52[_0x78d3('0x50')]['id']){delete _0x575b52['body']['id'];}return db[_0x78d3('0x37')][_0x78d3('0x4f')]({'where':{'id':_0x575b52[_0x78d3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4afcb1,null))[_0x78d3('0x32')](saveUpdates(_0x575b52[_0x78d3('0x50')],null))[_0x78d3('0x32')](respondWithResult(_0x4afcb1,null))[_0x78d3('0x25')](handleError(_0x4afcb1,null));};exports[_0x78d3('0x51')]=function(_0x2154e3,_0x55f529,_0x1ff30a){if(_0x2154e3[_0x78d3('0x52')]&&_0x2154e3['file']['filename']){_0x2154e3[_0x78d3('0x50')][_0x78d3('0x53')]=_0x2154e3[_0x78d3('0x52')][_0x78d3('0x54')];}return db['Setting'][_0x78d3('0x4f')]({'where':{'id':_0x2154e3[_0x78d3('0x4e')]['id']}})[_0x78d3('0x32')](handleEntityNotFound(_0x55f529,null))[_0x78d3('0x32')](saveUpdates(_0x2154e3[_0x78d3('0x50')],null))['then'](respondWithResult(_0x55f529,null))[_0x78d3('0x25')](handleError(_0x55f529,null));};exports[_0x78d3('0x55')]=function(_0x140b54,_0xdab0bc,_0x863e4c){if(_0x140b54[_0x78d3('0x52')]&&_0x140b54[_0x78d3('0x52')][_0x78d3('0x54')]){_0x140b54[_0x78d3('0x50')][_0x78d3('0x56')]=_0x140b54['file'][_0x78d3('0x54')];}return db[_0x78d3('0x37')][_0x78d3('0x4f')]({'where':{'id':_0x140b54[_0x78d3('0x4e')]['id']}})[_0x78d3('0x32')](handleEntityNotFound(_0xdab0bc,null))[_0x78d3('0x32')](saveUpdates(_0x140b54[_0x78d3('0x50')],null))['then'](respondWithResult(_0xdab0bc,null))['catch'](handleError(_0xdab0bc,null));};var utilLicense=require(_0x78d3('0x18'));exports[_0x78d3('0x57')]=function(_0x5be984,_0x22e6f2,_0x289ea4){var _0x46fb20=_0x78d3('0x58');var _0x90b62={'custom':![]};return utilLicense[_0x78d3('0x59')]()[_0x78d3('0x32')](function(_0x1c311f){if(_0x1c311f){_0x90b62=_0x1c311f;}return db[_0x78d3('0x37')][_0x78d3('0x4f')]({'where':{'id':_0x5be984[_0x78d3('0x4e')]['id']},'attributes':['logo',_0x78d3('0x56'),_0x78d3('0x5a'),_0x78d3('0x5b'),_0x78d3('0x5c'),_0x78d3('0x5d'),_0x78d3('0x5e'),_0x78d3('0x5f')],'raw':!![]});})[_0x78d3('0x32')](handleEntityNotFound(_0x22e6f2,null))[_0x78d3('0x32')](function(_0x41bc7a){if(_0x41bc7a){var _0x1b6907=_0x41bc7a[_0x78d3('0x53')]&&fs[_0x78d3('0x60')](path[_0x78d3('0x61')](config['root'],_0x46fb20,_[_0x78d3('0x62')](_0x41bc7a[_0x78d3('0x53')])))?path[_0x78d3('0x61')](config[_0x78d3('0x63')],_0x46fb20,_[_0x78d3('0x62')](_0x41bc7a[_0x78d3('0x53')])):path[_0x78d3('0x61')](config['root'],_0x46fb20,_['toLower'](_0x78d3('0x64')));var _0x3fed88=_0x78d3('0x65')+_['upperFirst']('logo');if(_0x41bc7a[_0x3fed88]||!_0x90b62[_0x78d3('0x66')]){_0x1b6907=path[_0x78d3('0x61')](config[_0x78d3('0x63')],_0x46fb20,_['toLower']('default_logo.svg'));}if(!fs[_0x78d3('0x60')](_0x1b6907)){throw new db[(_0x78d3('0x67'))][(_0x78d3('0x68'))](_['upperFirst'](_0x78d3('0x53'))+_0x78d3('0x69'));}return _0x22e6f2[_0x78d3('0x6a')](_0x1b6907);}})['catch'](handleError(_0x22e6f2,null));};var utilLicense=require(_0x78d3('0x18'));exports[_0x78d3('0x6b')]=function(_0x594cd2,_0x3b6638,_0x1637eb){var _0x385dbc=_0x78d3('0x58');var _0x37c4f9={'custom':![]};return utilLicense[_0x78d3('0x59')]()[_0x78d3('0x32')](function(_0x4d1b){if(_0x4d1b){_0x37c4f9=_0x4d1b;}return db[_0x78d3('0x37')]['find']({'where':{'id':_0x594cd2[_0x78d3('0x4e')]['id']},'attributes':[_0x78d3('0x53'),'loginLogo',_0x78d3('0x5a'),_0x78d3('0x5b'),_0x78d3('0x5c'),_0x78d3('0x5d'),_0x78d3('0x5e'),_0x78d3('0x5f')],'raw':!![]});})[_0x78d3('0x32')](handleEntityNotFound(_0x3b6638,null))[_0x78d3('0x32')](function(_0x42579c){if(_0x42579c){var _0x469142=_0x42579c[_0x78d3('0x56')]&&fs['existsSync'](path['join'](config[_0x78d3('0x63')],_0x385dbc,_[_0x78d3('0x62')](_0x42579c['loginLogo'])))?path[_0x78d3('0x61')](config[_0x78d3('0x63')],_0x385dbc,_[_0x78d3('0x62')](_0x42579c[_0x78d3('0x56')])):path[_0x78d3('0x61')](config[_0x78d3('0x63')],_0x385dbc,_[_0x78d3('0x62')]('default_loginLogo.svg'));var _0xc740cd=_0x78d3('0x65')+_[_0x78d3('0x6c')](_0x78d3('0x56'));if(_0x42579c[_0xc740cd]||!_0x37c4f9[_0x78d3('0x66')]){_0x469142=path['join'](config['root'],_0x385dbc,_['toLower'](_0x78d3('0x6d')));}if(!fs[_0x78d3('0x60')](_0x469142)){throw new db[(_0x78d3('0x67'))]['ValidationError'](_['upperFirst'](_0x78d3('0x56'))+_0x78d3('0x69'));}return _0x3b6638[_0x78d3('0x6a')](_0x469142);}})[_0x78d3('0x25')](handleError(_0x3b6638,null));};exports[_0x78d3('0x6e')]=function(_0x48a47a,_0x4bc7bb){return db[_0x78d3('0x37')][_0x78d3('0x4f')]({'where':{'id':_0x48a47a[_0x78d3('0x4e')]['id']},'attributes':[_0x78d3('0x6f')]})[_0x78d3('0x32')](respondWithResult(_0x4bc7bb,null))[_0x78d3('0x25')](handleError(_0x4bc7bb,null));};exports[_0x78d3('0x70')]=function(_0xeb54b7,_0x396067,_0x3f89a0){if(_0xeb54b7['file']&&_0xeb54b7[_0x78d3('0x52')]['filename']){_0xeb54b7['body'][_0x78d3('0x5a')]=_0xeb54b7[_0x78d3('0x52')][_0x78d3('0x54')];}return db[_0x78d3('0x37')][_0x78d3('0x4f')]({'where':{'id':_0xeb54b7[_0x78d3('0x4e')]['id']}})[_0x78d3('0x32')](handleEntityNotFound(_0x396067,null))[_0x78d3('0x32')](saveUpdates(_0xeb54b7[_0x78d3('0x50')],null))['then'](respondWithResult(_0x396067,null))[_0x78d3('0x25')](handleError(_0x396067,null));};var utilLicense=require(_0x78d3('0x18'));exports[_0x78d3('0x71')]=function(_0x4f21a0,_0x55bbac,_0xcf068e){var _0xd75195=_0x78d3('0x58');var _0x11aa9d={'custom':![]};return utilLicense['getLicense']()[_0x78d3('0x32')](function(_0x5742a9){if(_0x5742a9){_0x11aa9d=_0x5742a9;}return db[_0x78d3('0x37')][_0x78d3('0x4f')]({'where':{'id':_0x4f21a0['params']['id']},'attributes':[_0x78d3('0x53'),_0x78d3('0x56'),_0x78d3('0x5a'),_0x78d3('0x5b'),_0x78d3('0x5c'),_0x78d3('0x5d'),_0x78d3('0x5e'),_0x78d3('0x5f')],'raw':!![]});})[_0x78d3('0x32')](handleEntityNotFound(_0x55bbac,null))[_0x78d3('0x32')](function(_0x1af7d1){if(_0x1af7d1){var _0x13ea25=_0x1af7d1[_0x78d3('0x5a')]&&fs[_0x78d3('0x60')](path[_0x78d3('0x61')](config[_0x78d3('0x63')],_0xd75195,_['toLower'](_0x1af7d1['preferred'])))?path[_0x78d3('0x61')](config[_0x78d3('0x63')],_0xd75195,_['toLower'](_0x1af7d1[_0x78d3('0x5a')])):path['join'](config['root'],_0xd75195,_[_0x78d3('0x62')]('default_preferred.png'));var _0x3dcf85='default'+_[_0x78d3('0x6c')](_0x78d3('0x5a'));if(_0x1af7d1[_0x3dcf85]||!_0x11aa9d[_0x78d3('0x66')]||!_0x11aa9d[_0x78d3('0x5a')]){_0x13ea25=path[_0x78d3('0x61')](config['root'],_0xd75195,_[_0x78d3('0x62')](_0x78d3('0x72')));}if(!fs[_0x78d3('0x60')](_0x13ea25)){throw new db[(_0x78d3('0x67'))][(_0x78d3('0x68'))](_['upperFirst'](_0x78d3('0x5a'))+_0x78d3('0x69'));}return _0x55bbac[_0x78d3('0x6a')](_0x13ea25);}})[_0x78d3('0x25')](handleError(_0x55bbac,null));};exports[_0x78d3('0x73')]=function(_0x5bfe29,_0xed74c2,_0x503870){if(_0x5bfe29[_0x78d3('0x52')]&&_0x5bfe29[_0x78d3('0x52')][_0x78d3('0x54')]){_0x5bfe29[_0x78d3('0x50')][_0x78d3('0x5b')]=_0x5bfe29[_0x78d3('0x52')][_0x78d3('0x54')];}return db[_0x78d3('0x37')][_0x78d3('0x4f')]({'where':{'id':_0x5bfe29[_0x78d3('0x4e')]['id']}})[_0x78d3('0x32')](handleEntityNotFound(_0xed74c2,null))['then'](saveUpdates(_0x5bfe29[_0x78d3('0x50')],null))[_0x78d3('0x32')](respondWithResult(_0xed74c2,null))[_0x78d3('0x25')](handleError(_0xed74c2,null));};var utilLicense=require(_0x78d3('0x18'));exports[_0x78d3('0x74')]=function(_0x292fe4,_0x13a073,_0x17639d){var _0x8ae1df=_0x78d3('0x58');var _0x4e134e={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x39e2ac){if(_0x39e2ac){_0x4e134e=_0x39e2ac;}return db[_0x78d3('0x37')][_0x78d3('0x4f')]({'where':{'id':_0x292fe4[_0x78d3('0x4e')]['id']},'attributes':['logo','loginLogo',_0x78d3('0x5a'),'favicon','defaultLogo','defaultLoginLogo',_0x78d3('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x78d3('0x32')](handleEntityNotFound(_0x13a073,null))[_0x78d3('0x32')](function(_0x1995d8){if(_0x1995d8){var _0x39d49a=_0x1995d8[_0x78d3('0x5b')]&&fs[_0x78d3('0x60')](path['join'](config[_0x78d3('0x63')],_0x8ae1df,_[_0x78d3('0x62')](_0x1995d8['favicon'])))?path[_0x78d3('0x61')](config[_0x78d3('0x63')],_0x8ae1df,_[_0x78d3('0x62')](_0x1995d8['favicon'])):path[_0x78d3('0x61')](config['root'],_0x8ae1df,_[_0x78d3('0x62')]('default_favicon.ico'));var _0xccaa97='default'+_['upperFirst'](_0x78d3('0x5b'));if(_0x1995d8[_0xccaa97]||!_0x4e134e[_0x78d3('0x66')]){_0x39d49a=path[_0x78d3('0x61')](config[_0x78d3('0x63')],_0x8ae1df,_[_0x78d3('0x62')](_0x78d3('0x75')));}if(!fs[_0x78d3('0x60')](_0x39d49a)){throw new db['Sequelize'][(_0x78d3('0x68'))](_[_0x78d3('0x6c')](_0x78d3('0x5b'))+_0x78d3('0x69'));}return _0x13a073[_0x78d3('0x6a')](_0x39d49a);}})[_0x78d3('0x25')](handleError(_0x13a073,null));};exports[_0x78d3('0x76')]=function(_0x2adacd,_0x3f6f5b){var _0x380d2a={'offset':moment()['utcOffset']()};_0x380d2a[_0x78d3('0x77')]=moment()[_0x78d3('0x78')](_0x380d2a['offset'])[_0x78d3('0x79')](_0x78d3('0x7a'));return _0x3f6f5b[_0x78d3('0x27')](0xc8)['send'](_0x380d2a);}; \ No newline at end of file +var _0x3c6d=['body','find','params','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','join','toLower','root','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','securePassword','getPreferred','default_preferred.png','defaultPreferred','default_favicon.ico','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','destroy','name','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3c6d,0x190));var _0xd3c6=function(_0x5f511f,_0x543310){_0x5f511f=_0x5f511f-0x0;var _0x19bfcf=_0x3c6d[_0x5f511f];return _0x19bfcf;};'use strict';var emlformat=require(_0xd3c6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd3c6('0x1'));var rp=require(_0xd3c6('0x2'));var moment=require(_0xd3c6('0x3'));var BPromise=require(_0xd3c6('0x4'));var Mustache=require(_0xd3c6('0x5'));var util=require(_0xd3c6('0x6'));var path=require(_0xd3c6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd3c6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3c6('0x9'));var squel=require('squel');var crypto=require(_0xd3c6('0xa'));var jsforce=require(_0xd3c6('0xb'));var deskjs=require(_0xd3c6('0xc'));var toCsv=require(_0xd3c6('0xd'));var querystring=require(_0xd3c6('0xe'));var Papa=require(_0xd3c6('0xf'));var Redis=require(_0xd3c6('0x10'));var authService=require(_0xd3c6('0x11'));var qs=require(_0xd3c6('0x12'));var as=require(_0xd3c6('0x13'));var hardwareService=require(_0xd3c6('0x14'));var logger=require('../../config/logger')(_0xd3c6('0x15'));var utils=require(_0xd3c6('0x16'));var config=require(_0xd3c6('0x17'));var licenseUtil=require(_0xd3c6('0x18'));var db=require(_0xd3c6('0x19'))['db'];var jayson=require(_0xd3c6('0x1a'));var client=jayson['client'][_0xd3c6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2c4c,_0x55f959,_0x176bf8,_0x1c45dc){return new BPromise(function(_0x2d24d4,_0x434ad3){var _0x1527c6=_0x1c45dc||client;return _0x1527c6[_0xd3c6('0x1c')](_0x2c4c,_0x176bf8)[_0xd3c6('0x1d')](function(_0x1b8653){logger['info'](_0xd3c6('0x1e'),_0x55f959,_0xd3c6('0x1f'));logger[_0xd3c6('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x55f959,'request\x20sent',JSON[_0xd3c6('0x21')](_0x1b8653));if(_0x1b8653[_0xd3c6('0x22')]){if(_0x1b8653[_0xd3c6('0x22')]['code']===0x1f4){logger[_0xd3c6('0x22')](_0xd3c6('0x1e'),_0x55f959,_0x1b8653[_0xd3c6('0x22')]['message']);return _0x434ad3(_0x1b8653[_0xd3c6('0x22')][_0xd3c6('0x23')]);}logger[_0xd3c6('0x22')]('Setting,\x20%s,\x20%s',_0x55f959,_0x1b8653[_0xd3c6('0x22')][_0xd3c6('0x23')]);return _0x2d24d4(_0x1b8653['error'][_0xd3c6('0x23')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x55f959,_0xd3c6('0x1f'));_0x2d24d4(_0x1b8653[_0xd3c6('0x24')][_0xd3c6('0x23')]);}})['catch'](function(_0x377346){logger[_0xd3c6('0x22')](_0xd3c6('0x1e'),_0x55f959,_0x377346);_0x434ad3(_0x377346);});});}function respondWithStatusCode(_0x5a3357,_0x2e7b31){_0x2e7b31=_0x2e7b31||0xcc;return function(_0x18f608){if(_0x18f608){return _0x5a3357[_0xd3c6('0x25')](_0x2e7b31);}return _0x5a3357[_0xd3c6('0x26')](_0x2e7b31)[_0xd3c6('0x27')]();};}function respondWithResult(_0x101949,_0x38aeef){_0x38aeef=_0x38aeef||0xc8;return function(_0xcfa161){if(_0xcfa161){return _0x101949[_0xd3c6('0x26')](_0x38aeef)[_0xd3c6('0x28')](_0xcfa161);}};}function respondWithFilteredResult(_0x481d70,_0x1e9d99){return function(_0x150406){if(_0x150406){var _0x484652=typeof _0x1e9d99['offset']===_0xd3c6('0x29')&&typeof _0x1e9d99['limit']===_0xd3c6('0x29');var _0x343e54=_0x150406[_0xd3c6('0x2a')];var _0xe1f688=_0x484652?0x0:_0x1e9d99[_0xd3c6('0x2b')];var _0x1fbc60=_0x484652?_0x150406[_0xd3c6('0x2a')]:_0x1e9d99[_0xd3c6('0x2b')]+_0x1e9d99[_0xd3c6('0x2c')];var _0x40721e;if(_0x1fbc60>=_0x343e54){_0x1fbc60=_0x343e54;_0x40721e=0xc8;}else{_0x40721e=0xce;}_0x481d70['status'](_0x40721e);return _0x481d70['set'](_0xd3c6('0x2d'),_0xe1f688+'-'+_0x1fbc60+'/'+_0x343e54)[_0xd3c6('0x28')](_0x150406);}return null;};}function patchUpdates(_0x3c859b){return function(_0x921018){try{jsonpatch[_0xd3c6('0x2e')](_0x921018,_0x3c859b,!![]);}catch(_0x1b917e){return BPromise[_0xd3c6('0x2f')](_0x1b917e);}return _0x921018[_0xd3c6('0x30')]();};}function saveUpdates(_0x67b47d,_0x5cf909){return function(_0x155648){if(_0x155648){return _0x155648[_0xd3c6('0x31')](_0x67b47d)[_0xd3c6('0x1d')](function(_0x49821c){return _0x49821c;});}return null;};}function removeEntity(_0xa557fc,_0xb3f10){return function(_0x76d28c){if(_0x76d28c){return _0x76d28c[_0xd3c6('0x32')]()[_0xd3c6('0x1d')](function(){_0xa557fc['status'](0xcc)[_0xd3c6('0x27')]();});}};}function handleEntityNotFound(_0x4c111d,_0x480de5){return function(_0x140028){if(!_0x140028){_0x4c111d[_0xd3c6('0x25')](0x194);}return _0x140028;};}function handleError(_0x45855e,_0x1fc90b){_0x1fc90b=_0x1fc90b||0x1f4;return function(_0x4676d9){logger[_0xd3c6('0x22')](_0x4676d9['stack']);if(_0x4676d9[_0xd3c6('0x33')]){delete _0x4676d9['name'];}_0x45855e[_0xd3c6('0x26')](_0x1fc90b)['send'](_0x4676d9);};}exports['index']=function(_0x5305da,_0x5e980e){var _0x3e4126={},_0x206fac={},_0x463e54={'count':0x0,'rows':[]};var _0x1f8f91=_[_0xd3c6('0x34')](db[_0xd3c6('0x35')][_0xd3c6('0x36')],function(_0x5476c3){return{'name':_0x5476c3[_0xd3c6('0x37')],'type':_0x5476c3[_0xd3c6('0x38')][_0xd3c6('0x39')]};});_0x206fac[_0xd3c6('0x3a')]=_[_0xd3c6('0x34')](_0x1f8f91,'name');_0x206fac['query']=_[_0xd3c6('0x3b')](_0x5305da[_0xd3c6('0x3c')]);_0x206fac[_0xd3c6('0x3d')]=_['intersection'](_0x206fac[_0xd3c6('0x3a')],_0x206fac['query']);_0x3e4126[_0xd3c6('0x3e')]=_[_0xd3c6('0x3f')](_0x206fac[_0xd3c6('0x3a')],qs['fields'](_0x5305da[_0xd3c6('0x3c')][_0xd3c6('0x40')]));_0x3e4126[_0xd3c6('0x3e')]=_0x3e4126['attributes'][_0xd3c6('0x41')]?_0x3e4126['attributes']:_0x206fac[_0xd3c6('0x3a')];if(!_0x5305da[_0xd3c6('0x3c')]['hasOwnProperty'](_0xd3c6('0x42'))){_0x3e4126[_0xd3c6('0x2c')]=qs['limit'](_0x5305da[_0xd3c6('0x3c')][_0xd3c6('0x2c')]);_0x3e4126[_0xd3c6('0x2b')]=qs[_0xd3c6('0x2b')](_0x5305da[_0xd3c6('0x3c')][_0xd3c6('0x2b')]);}_0x3e4126['order']=qs[_0xd3c6('0x43')](_0x5305da[_0xd3c6('0x3c')][_0xd3c6('0x43')]);_0x3e4126[_0xd3c6('0x44')]=qs[_0xd3c6('0x3d')](_[_0xd3c6('0x45')](_0x5305da['query'],_0x206fac[_0xd3c6('0x3d')]),_0x1f8f91);if(_0x5305da[_0xd3c6('0x3c')][_0xd3c6('0x46')]){_0x3e4126[_0xd3c6('0x44')]=_[_0xd3c6('0x47')](_0x3e4126[_0xd3c6('0x44')],{'$or':_[_0xd3c6('0x34')](_0x1f8f91,function(_0x36a785){if(_0x36a785[_0xd3c6('0x38')]!==_0xd3c6('0x48')){var _0xc926ef={};_0xc926ef[_0x36a785['name']]={'$like':'%'+_0x5305da[_0xd3c6('0x3c')][_0xd3c6('0x46')]+'%'};return _0xc926ef;}})});}_0x3e4126=_[_0xd3c6('0x47')]({},_0x3e4126,_0x5305da[_0xd3c6('0x49')]);var _0x4ac2dd={'where':_0x3e4126[_0xd3c6('0x44')]};return db[_0xd3c6('0x35')]['count'](_0x4ac2dd)['then'](function(_0x39dadb){_0x463e54['count']=_0x39dadb;if(_0x5305da[_0xd3c6('0x3c')]['includeAll']){_0x3e4126[_0xd3c6('0x4a')]=[{'all':!![]}];}return db[_0xd3c6('0x35')][_0xd3c6('0x4b')](_0x3e4126);})[_0xd3c6('0x1d')](function(_0x59317c){_0x463e54[_0xd3c6('0x4c')]=_0x59317c;return _0x463e54;})[_0xd3c6('0x1d')](respondWithFilteredResult(_0x5e980e,_0x3e4126))[_0xd3c6('0x4d')](handleError(_0x5e980e,null));};exports[_0xd3c6('0x4e')]=function(_0x37caff,_0x1a9a5a){var _0x38878a={'raw':![],'where':{'id':_0x37caff['params']['id']}},_0x12ea1f={};_0x12ea1f[_0xd3c6('0x3a')]=_[_0xd3c6('0x3b')](db[_0xd3c6('0x35')][_0xd3c6('0x36')]);_0x12ea1f[_0xd3c6('0x3c')]=_['keys'](_0x37caff[_0xd3c6('0x3c')]);_0x12ea1f[_0xd3c6('0x3d')]=_[_0xd3c6('0x3f')](_0x12ea1f[_0xd3c6('0x3a')],_0x12ea1f['query']);_0x38878a[_0xd3c6('0x3e')]=_['intersection'](_0x12ea1f['model'],qs[_0xd3c6('0x40')](_0x37caff['query'][_0xd3c6('0x40')]));_0x38878a[_0xd3c6('0x3e')]=_0x38878a[_0xd3c6('0x3e')][_0xd3c6('0x41')]?_0x38878a['attributes']:_0x12ea1f[_0xd3c6('0x3a')];if(_0x37caff[_0xd3c6('0x3c')][_0xd3c6('0x4f')]){_0x38878a['include']=[{'all':!![]}];}_0x38878a=_[_0xd3c6('0x47')]({},_0x38878a,_0x37caff[_0xd3c6('0x49')]);return db['Setting']['find'](_0x38878a)[_0xd3c6('0x1d')](handleEntityNotFound(_0x1a9a5a,null))['then'](respondWithResult(_0x1a9a5a,null))[_0xd3c6('0x4d')](handleError(_0x1a9a5a,null));};exports[_0xd3c6('0x31')]=function(_0x5dc17a,_0x3136ac){if(_0x5dc17a[_0xd3c6('0x50')]['id']){delete _0x5dc17a['body']['id'];}return db[_0xd3c6('0x35')][_0xd3c6('0x51')]({'where':{'id':_0x5dc17a[_0xd3c6('0x52')]['id']}})[_0xd3c6('0x1d')](handleEntityNotFound(_0x3136ac,null))[_0xd3c6('0x1d')](saveUpdates(_0x5dc17a['body'],null))[_0xd3c6('0x1d')](respondWithResult(_0x3136ac,null))['catch'](handleError(_0x3136ac,null));};exports['addLogo']=function(_0x4b6a25,_0x5e57af,_0x181a31){if(_0x4b6a25['file']&&_0x4b6a25[_0xd3c6('0x53')]['filename']){_0x4b6a25[_0xd3c6('0x50')][_0xd3c6('0x54')]=_0x4b6a25[_0xd3c6('0x53')][_0xd3c6('0x55')];}return db[_0xd3c6('0x35')][_0xd3c6('0x51')]({'where':{'id':_0x4b6a25[_0xd3c6('0x52')]['id']}})[_0xd3c6('0x1d')](handleEntityNotFound(_0x5e57af,null))[_0xd3c6('0x1d')](saveUpdates(_0x4b6a25[_0xd3c6('0x50')],null))['then'](respondWithResult(_0x5e57af,null))[_0xd3c6('0x4d')](handleError(_0x5e57af,null));};exports[_0xd3c6('0x56')]=function(_0x533ea8,_0x570d88,_0x21e1c6){if(_0x533ea8[_0xd3c6('0x53')]&&_0x533ea8[_0xd3c6('0x53')][_0xd3c6('0x55')]){_0x533ea8[_0xd3c6('0x50')][_0xd3c6('0x57')]=_0x533ea8[_0xd3c6('0x53')][_0xd3c6('0x55')];}return db[_0xd3c6('0x35')][_0xd3c6('0x51')]({'where':{'id':_0x533ea8['params']['id']}})[_0xd3c6('0x1d')](handleEntityNotFound(_0x570d88,null))['then'](saveUpdates(_0x533ea8[_0xd3c6('0x50')],null))[_0xd3c6('0x1d')](respondWithResult(_0x570d88,null))['catch'](handleError(_0x570d88,null));};var utilLicense=require(_0xd3c6('0x18'));exports[_0xd3c6('0x58')]=function(_0x3150d5,_0x13adec,_0x53f924){var _0x5361a7=_0xd3c6('0x59');var _0x42d085={'custom':![]};return utilLicense[_0xd3c6('0x5a')]()['then'](function(_0x119a38){if(_0x119a38){_0x42d085=_0x119a38;}return db[_0xd3c6('0x35')]['find']({'where':{'id':_0x3150d5[_0xd3c6('0x52')]['id']},'attributes':[_0xd3c6('0x54'),'loginLogo',_0xd3c6('0x5b'),_0xd3c6('0x5c'),_0xd3c6('0x5d'),_0xd3c6('0x5e'),'defaultPreferred',_0xd3c6('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x13adec,null))[_0xd3c6('0x1d')](function(_0x342851){if(_0x342851){var _0x168f71=_0x342851['logo']&&fs['existsSync'](path[_0xd3c6('0x60')](config['root'],_0x5361a7,_[_0xd3c6('0x61')](_0x342851['logo'])))?path['join'](config[_0xd3c6('0x62')],_0x5361a7,_[_0xd3c6('0x61')](_0x342851[_0xd3c6('0x54')])):path['join'](config['root'],_0x5361a7,_['toLower'](_0xd3c6('0x63')));var _0x1a7799=_0xd3c6('0x64')+_[_0xd3c6('0x65')](_0xd3c6('0x54'));if(_0x342851[_0x1a7799]||!_0x42d085[_0xd3c6('0x66')]){_0x168f71=path[_0xd3c6('0x60')](config[_0xd3c6('0x62')],_0x5361a7,_[_0xd3c6('0x61')](_0xd3c6('0x63')));}if(!fs[_0xd3c6('0x67')](_0x168f71)){throw new db[(_0xd3c6('0x68'))][(_0xd3c6('0x69'))](_[_0xd3c6('0x65')](_0xd3c6('0x54'))+_0xd3c6('0x6a'));}return _0x13adec[_0xd3c6('0x6b')](_0x168f71);}})[_0xd3c6('0x4d')](handleError(_0x13adec,null));};var utilLicense=require(_0xd3c6('0x18'));exports[_0xd3c6('0x6c')]=function(_0x24572f,_0xadc0a3,_0x51180f){var _0x3441d5=_0xd3c6('0x59');var _0x3ddfa2={'custom':![]};return utilLicense[_0xd3c6('0x5a')]()[_0xd3c6('0x1d')](function(_0x46a78f){if(_0x46a78f){_0x3ddfa2=_0x46a78f;}return db[_0xd3c6('0x35')][_0xd3c6('0x51')]({'where':{'id':_0x24572f['params']['id']},'attributes':[_0xd3c6('0x54'),_0xd3c6('0x57'),_0xd3c6('0x5b'),_0xd3c6('0x5c'),_0xd3c6('0x5d'),_0xd3c6('0x5e'),'defaultPreferred',_0xd3c6('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0xadc0a3,null))[_0xd3c6('0x1d')](function(_0x279c4b){if(_0x279c4b){var _0x2a2df6=_0x279c4b[_0xd3c6('0x57')]&&fs[_0xd3c6('0x67')](path[_0xd3c6('0x60')](config[_0xd3c6('0x62')],_0x3441d5,_[_0xd3c6('0x61')](_0x279c4b[_0xd3c6('0x57')])))?path[_0xd3c6('0x60')](config[_0xd3c6('0x62')],_0x3441d5,_[_0xd3c6('0x61')](_0x279c4b[_0xd3c6('0x57')])):path['join'](config[_0xd3c6('0x62')],_0x3441d5,_[_0xd3c6('0x61')](_0xd3c6('0x6d')));var _0x14c814=_0xd3c6('0x64')+_[_0xd3c6('0x65')](_0xd3c6('0x57'));if(_0x279c4b[_0x14c814]||!_0x3ddfa2['custom']){_0x2a2df6=path[_0xd3c6('0x60')](config[_0xd3c6('0x62')],_0x3441d5,_[_0xd3c6('0x61')](_0xd3c6('0x6d')));}if(!fs['existsSync'](_0x2a2df6)){throw new db['Sequelize'][(_0xd3c6('0x69'))](_[_0xd3c6('0x65')](_0xd3c6('0x57'))+_0xd3c6('0x6a'));}return _0xadc0a3[_0xd3c6('0x6b')](_0x2a2df6);}})[_0xd3c6('0x4d')](handleError(_0xadc0a3,null));};exports[_0xd3c6('0x6e')]=function(_0x111aad,_0x54582a){return db[_0xd3c6('0x35')]['find']({'where':{'id':_0x111aad[_0xd3c6('0x52')]['id']},'attributes':[_0xd3c6('0x6f')]})[_0xd3c6('0x1d')](respondWithResult(_0x54582a,null))[_0xd3c6('0x4d')](handleError(_0x54582a,null));};exports['addPreferred']=function(_0x2340da,_0x37aeb8,_0x188cab){if(_0x2340da['file']&&_0x2340da[_0xd3c6('0x53')][_0xd3c6('0x55')]){_0x2340da[_0xd3c6('0x50')][_0xd3c6('0x5b')]=_0x2340da[_0xd3c6('0x53')][_0xd3c6('0x55')];}return db[_0xd3c6('0x35')]['find']({'where':{'id':_0x2340da[_0xd3c6('0x52')]['id']}})[_0xd3c6('0x1d')](handleEntityNotFound(_0x37aeb8,null))['then'](saveUpdates(_0x2340da['body'],null))[_0xd3c6('0x1d')](respondWithResult(_0x37aeb8,null))[_0xd3c6('0x4d')](handleError(_0x37aeb8,null));};var utilLicense=require(_0xd3c6('0x18'));exports[_0xd3c6('0x70')]=function(_0x52ff9e,_0x3463e2,_0x134fa7){var _0x49d7a3='server/files/images/logos';var _0x2e06bc={'custom':![]};return utilLicense[_0xd3c6('0x5a')]()[_0xd3c6('0x1d')](function(_0x3f3c55){if(_0x3f3c55){_0x2e06bc=_0x3f3c55;}return db[_0xd3c6('0x35')][_0xd3c6('0x51')]({'where':{'id':_0x52ff9e[_0xd3c6('0x52')]['id']},'attributes':[_0xd3c6('0x54'),_0xd3c6('0x57'),_0xd3c6('0x5b'),_0xd3c6('0x5c'),_0xd3c6('0x5d'),_0xd3c6('0x5e'),'defaultPreferred',_0xd3c6('0x5f')],'raw':!![]});})[_0xd3c6('0x1d')](handleEntityNotFound(_0x3463e2,null))['then'](function(_0x284353){if(_0x284353){var _0x133c67=_0x284353['preferred']&&fs['existsSync'](path[_0xd3c6('0x60')](config[_0xd3c6('0x62')],_0x49d7a3,_[_0xd3c6('0x61')](_0x284353[_0xd3c6('0x5b')])))?path[_0xd3c6('0x60')](config[_0xd3c6('0x62')],_0x49d7a3,_[_0xd3c6('0x61')](_0x284353[_0xd3c6('0x5b')])):path[_0xd3c6('0x60')](config[_0xd3c6('0x62')],_0x49d7a3,_[_0xd3c6('0x61')](_0xd3c6('0x71')));var _0x4f1e33='default'+_['upperFirst'](_0xd3c6('0x5b'));if(_0x284353[_0x4f1e33]||!_0x2e06bc[_0xd3c6('0x66')]||!_0x2e06bc[_0xd3c6('0x5b')]){_0x133c67=path['join'](config[_0xd3c6('0x62')],_0x49d7a3,_[_0xd3c6('0x61')](_0xd3c6('0x71')));}if(!fs[_0xd3c6('0x67')](_0x133c67)){throw new db[(_0xd3c6('0x68'))]['ValidationError'](_[_0xd3c6('0x65')](_0xd3c6('0x5b'))+_0xd3c6('0x6a'));}return _0x3463e2[_0xd3c6('0x6b')](_0x133c67);}})[_0xd3c6('0x4d')](handleError(_0x3463e2,null));};exports['addFavicon']=function(_0x3b07c2,_0x1fa573,_0x233f06){if(_0x3b07c2['file']&&_0x3b07c2[_0xd3c6('0x53')][_0xd3c6('0x55')]){_0x3b07c2['body']['favicon']=_0x3b07c2[_0xd3c6('0x53')]['filename'];}return db['Setting'][_0xd3c6('0x51')]({'where':{'id':_0x3b07c2[_0xd3c6('0x52')]['id']}})[_0xd3c6('0x1d')](handleEntityNotFound(_0x1fa573,null))[_0xd3c6('0x1d')](saveUpdates(_0x3b07c2[_0xd3c6('0x50')],null))[_0xd3c6('0x1d')](respondWithResult(_0x1fa573,null))[_0xd3c6('0x4d')](handleError(_0x1fa573,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x4d2582,_0x452a08,_0xcf67ba){var _0x3c676d=_0xd3c6('0x59');var _0x2ff01f={'custom':![]};return utilLicense[_0xd3c6('0x5a')]()[_0xd3c6('0x1d')](function(_0x3492e5){if(_0x3492e5){_0x2ff01f=_0x3492e5;}return db[_0xd3c6('0x35')][_0xd3c6('0x51')]({'where':{'id':_0x4d2582[_0xd3c6('0x52')]['id']},'attributes':['logo',_0xd3c6('0x57'),_0xd3c6('0x5b'),'favicon','defaultLogo',_0xd3c6('0x5e'),_0xd3c6('0x72'),_0xd3c6('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x452a08,null))['then'](function(_0x150e9f){if(_0x150e9f){var _0x2ea699=_0x150e9f[_0xd3c6('0x5c')]&&fs[_0xd3c6('0x67')](path[_0xd3c6('0x60')](config['root'],_0x3c676d,_[_0xd3c6('0x61')](_0x150e9f[_0xd3c6('0x5c')])))?path[_0xd3c6('0x60')](config[_0xd3c6('0x62')],_0x3c676d,_['toLower'](_0x150e9f[_0xd3c6('0x5c')])):path['join'](config['root'],_0x3c676d,_[_0xd3c6('0x61')](_0xd3c6('0x73')));var _0x55e4d5=_0xd3c6('0x64')+_[_0xd3c6('0x65')](_0xd3c6('0x5c'));if(_0x150e9f[_0x55e4d5]||!_0x2ff01f[_0xd3c6('0x66')]){_0x2ea699=path[_0xd3c6('0x60')](config['root'],_0x3c676d,_[_0xd3c6('0x61')](_0xd3c6('0x73')));}if(!fs['existsSync'](_0x2ea699)){throw new db[(_0xd3c6('0x68'))][(_0xd3c6('0x69'))](_[_0xd3c6('0x65')](_0xd3c6('0x5c'))+_0xd3c6('0x6a'));}return _0x452a08[_0xd3c6('0x6b')](_0x2ea699);}})[_0xd3c6('0x4d')](handleError(_0x452a08,null));};exports['getDate']=function(_0x1673f2,_0x3f7da4){var _0x597133={'offset':moment()['utcOffset']()};_0x597133[_0xd3c6('0x74')]=moment()[_0xd3c6('0x75')](_0x597133[_0xd3c6('0x2b')])[_0xd3c6('0x76')](_0xd3c6('0x77'));return _0x3f7da4[_0xd3c6('0x26')](0xc8)['send'](_0x597133);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 4fc8dcd..821b151 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x26c0bb,_0x16ec64){var _0x4ccd7d=function(_0x160dbb){while(--_0x160dbb){_0x26c0bb['push'](_0x26c0bb['shift']());}};_0x4ccd7d(++_0x16ec64);}(_0xedd9,0xfc));var _0x9edd=function(_0x3b88d1,_0x22075b){_0x3b88d1=_0x3b88d1-0x0;var _0x393ed5=_0xedd9[_0x3b88d1];return _0x393ed5;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x55ca,0x126));var _0xa55c=function(_0x2a2137,_0x280212){_0x2a2137=_0x2a2137-0x0;var _0x466f22=_0x55ca[_0x2a2137];return _0x466f22;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('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 8ff31d7..8ff9351 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 _0x9d32=['client','request','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Setting,\x20%s,\x20%s','info','result','catch','Setting','find','options','raw','where','attributes','include','model','map','then','ShowSetting','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0x9d32,0x16c));var _0x29d3=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x9d32[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require(_0x29d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x29d3('0x1'));var rs=require(_0x29d3('0x2'));var fs=require('fs');var Redis=require(_0x29d3('0x3'));var db=require(_0x29d3('0x4'))['db'];var utils=require(_0x29d3('0x5'));var logger=require(_0x29d3('0x6'))(_0x29d3('0x7'));var config=require(_0x29d3('0x8'));var jayson=require(_0x29d3('0x9'));var client=jayson[_0x29d3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9fd5fe,_0x3601fe,_0x57b145){return new BPromise(function(_0xee0ca6,_0x22484e){return client[_0x29d3('0xb')](_0x9fd5fe,_0x57b145)['then'](function(_0x3e5f11){logger['info']('Setting,\x20%s,\x20%s',_0x3601fe,_0x29d3('0xc'));logger['debug'](_0x29d3('0xd'),_0x3601fe,_0x29d3('0xc'),JSON[_0x29d3('0xe')](_0x3e5f11));if(_0x3e5f11['error']){if(_0x3e5f11['error'][_0x29d3('0xf')]===0x1f4){logger[_0x29d3('0x10')]('Setting,\x20%s,\x20%s',_0x3601fe,_0x3e5f11[_0x29d3('0x10')][_0x29d3('0x11')]);return _0x22484e(_0x3e5f11[_0x29d3('0x10')][_0x29d3('0x11')]);}logger[_0x29d3('0x10')](_0x29d3('0x12'),_0x3601fe,_0x3e5f11[_0x29d3('0x10')][_0x29d3('0x11')]);return _0xee0ca6(_0x3e5f11[_0x29d3('0x10')]['message']);}else{logger[_0x29d3('0x13')](_0x29d3('0x12'),_0x3601fe,_0x29d3('0xc'));_0xee0ca6(_0x3e5f11[_0x29d3('0x14')][_0x29d3('0x11')]);}})[_0x29d3('0x15')](function(_0x2c1104){logger[_0x29d3('0x10')](_0x29d3('0x12'),_0x3601fe,_0x2c1104);_0x22484e(_0x2c1104);});});}exports['ShowSetting']=function(_0x35fb77){var _0x1a0ba9=this;return new Promise(function(_0x2937ae,_0x4f76fe){return db[_0x29d3('0x16')][_0x29d3('0x17')]({'raw':_0x35fb77[_0x29d3('0x18')]?_0x35fb77[_0x29d3('0x18')][_0x29d3('0x19')]===undefined?!![]:![]:!![],'where':_0x35fb77['options']?_0x35fb77[_0x29d3('0x18')][_0x29d3('0x1a')]||null:null,'attributes':_0x35fb77[_0x29d3('0x18')]?_0x35fb77['options'][_0x29d3('0x1b')]||null:null,'include':_0x35fb77[_0x29d3('0x18')]?_0x35fb77[_0x29d3('0x18')][_0x29d3('0x1c')]?_['map'](_0x35fb77['options'][_0x29d3('0x1c')],function(_0x19f040){return{'model':db[_0x19f040[_0x29d3('0x1d')]],'as':_0x19f040['as'],'attributes':_0x19f040[_0x29d3('0x1b')],'include':_0x19f040['include']?_[_0x29d3('0x1e')](_0x19f040[_0x29d3('0x1c')],function(_0x3f4f73){return{'model':db[_0x3f4f73[_0x29d3('0x1d')]],'as':_0x3f4f73['as'],'attributes':_0x3f4f73['attributes'],'include':_0x3f4f73[_0x29d3('0x1c')]?_[_0x29d3('0x1e')](_0x3f4f73[_0x29d3('0x1c')],function(_0x1fd000){return{'model':db[_0x1fd000[_0x29d3('0x1d')]],'as':_0x1fd000['as'],'attributes':_0x1fd000[_0x29d3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x29d3('0x1f')](function(_0x2dbd4f){logger['info'](_0x29d3('0x20'),_0x35fb77);logger[_0x29d3('0x21')]('ShowSetting',_0x35fb77,JSON[_0x29d3('0xe')](_0x2dbd4f));_0x2937ae(_0x2dbd4f);})[_0x29d3('0x15')](function(_0x35c6ca){logger[_0x29d3('0x10')]('ShowSetting',_0x35c6ca[_0x29d3('0x11')],_0x35fb77);_0x4f76fe(_0x1a0ba9['error'](0x1f4,_0x35c6ca[_0x29d3('0x11')]));});});}; \ No newline at end of file +var _0xe9fd=['request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSetting','Setting','options','raw','include','map','model','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1835e4,_0x224a46){var _0x5a9d76=function(_0x3ec240){while(--_0x3ec240){_0x1835e4['push'](_0x1835e4['shift']());}};_0x5a9d76(++_0x224a46);}(_0xe9fd,0xb9));var _0xde9f=function(_0x543438,_0x62c5c0){_0x543438=_0x543438-0x0;var _0x83eead=_0xe9fd[_0x543438];return _0x83eead;};'use strict';var _=require(_0xde9f('0x0'));var util=require(_0xde9f('0x1'));var moment=require(_0xde9f('0x2'));var BPromise=require(_0xde9f('0x3'));var rs=require(_0xde9f('0x4'));var fs=require('fs');var Redis=require(_0xde9f('0x5'));var db=require(_0xde9f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xde9f('0x7'))(_0xde9f('0x8'));var config=require(_0xde9f('0x9'));var jayson=require(_0xde9f('0xa'));var client=jayson[_0xde9f('0xb')][_0xde9f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42516e,_0x2a9ff0,_0x4798bf){return new BPromise(function(_0x1888cd,_0x1b01ec){return client[_0xde9f('0xd')](_0x42516e,_0x4798bf)['then'](function(_0x17b7cd){logger[_0xde9f('0xe')](_0xde9f('0xf'),_0x2a9ff0,_0xde9f('0x10'));logger['debug'](_0xde9f('0x11'),_0x2a9ff0,_0xde9f('0x10'),JSON[_0xde9f('0x12')](_0x17b7cd));if(_0x17b7cd['error']){if(_0x17b7cd['error'][_0xde9f('0x13')]===0x1f4){logger[_0xde9f('0x14')](_0xde9f('0xf'),_0x2a9ff0,_0x17b7cd['error']['message']);return _0x1b01ec(_0x17b7cd['error']['message']);}logger[_0xde9f('0x14')](_0xde9f('0xf'),_0x2a9ff0,_0x17b7cd[_0xde9f('0x14')][_0xde9f('0x15')]);return _0x1888cd(_0x17b7cd[_0xde9f('0x14')][_0xde9f('0x15')]);}else{logger[_0xde9f('0xe')]('Setting,\x20%s,\x20%s',_0x2a9ff0,'request\x20sent');_0x1888cd(_0x17b7cd[_0xde9f('0x16')][_0xde9f('0x15')]);}})[_0xde9f('0x17')](function(_0x136e75){logger[_0xde9f('0x14')]('Setting,\x20%s,\x20%s',_0x2a9ff0,_0x136e75);_0x1b01ec(_0x136e75);});});}exports[_0xde9f('0x18')]=function(_0x48cf64){var _0x543dcc=this;return new Promise(function(_0x369ac0,_0x2fa8e6){return db[_0xde9f('0x19')]['find']({'raw':_0x48cf64[_0xde9f('0x1a')]?_0x48cf64[_0xde9f('0x1a')][_0xde9f('0x1b')]===undefined?!![]:![]:!![],'where':_0x48cf64[_0xde9f('0x1a')]?_0x48cf64[_0xde9f('0x1a')]['where']||null:null,'attributes':_0x48cf64['options']?_0x48cf64[_0xde9f('0x1a')]['attributes']||null:null,'include':_0x48cf64[_0xde9f('0x1a')]?_0x48cf64[_0xde9f('0x1a')][_0xde9f('0x1c')]?_[_0xde9f('0x1d')](_0x48cf64[_0xde9f('0x1a')][_0xde9f('0x1c')],function(_0x4a91c4){return{'model':db[_0x4a91c4['model']],'as':_0x4a91c4['as'],'attributes':_0x4a91c4['attributes'],'include':_0x4a91c4[_0xde9f('0x1c')]?_[_0xde9f('0x1d')](_0x4a91c4[_0xde9f('0x1c')],function(_0x5d6552){return{'model':db[_0x5d6552[_0xde9f('0x1e')]],'as':_0x5d6552['as'],'attributes':_0x5d6552[_0xde9f('0x1f')],'include':_0x5d6552['include']?_[_0xde9f('0x1d')](_0x5d6552['include'],function(_0x5a885e){return{'model':db[_0x5a885e[_0xde9f('0x1e')]],'as':_0x5a885e['as'],'attributes':_0x5a885e[_0xde9f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xde9f('0x20')](function(_0x28c47c){logger[_0xde9f('0xe')](_0xde9f('0x18'),_0x48cf64);logger['debug'](_0xde9f('0x18'),_0x48cf64,JSON[_0xde9f('0x12')](_0x28c47c));_0x369ac0(_0x28c47c);})[_0xde9f('0x17')](function(_0x386457){logger[_0xde9f('0x14')](_0xde9f('0x18'),_0x386457[_0xde9f('0x15')],_0x48cf64);_0x2fa8e6(_0x543dcc[_0xde9f('0x14')](0x1f4,_0x386457[_0xde9f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index dc72b87..8e5df3a 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 _0x1cb9=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','/:id/status','status','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x27a179,_0x53a622){_0x27a179=_0x27a179-0x0;var _0x38443e=_0x1cb9[_0x27a179];return _0x38443e;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/status',controller['statusGet']);router[_0x91cb('0x8')](_0x91cb('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x91cb('0x17')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x18')]);router['post'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x19')]);router['post'](_0x91cb('0x1a'),controller[_0x91cb('0x1b')]);router['post'](_0x91cb('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x91cb('0x17')](_0x91cb('0x1d'),auth['isAuthenticated'](),controller['send']);router['post'](_0x91cb('0x1e'),controller[_0x91cb('0x1f')]);router[_0x91cb('0x17')](_0x91cb('0x16'),auth['isAuthenticated'](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0x22')]);router[_0x91cb('0x23')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x24')]);router[_0x91cb('0x23')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x25')]);router['delete']('/:id/canned_answers',auth[_0x91cb('0x9')](),controller['removeAnswers']);router[_0x91cb('0x23')](_0x91cb('0x16'),auth[_0x91cb('0x9')](),controller['removeAgents']);module[_0x91cb('0x26')]=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x16f578,_0x121a69){var _0x591727=function(_0x50760a){while(--_0x50760a){_0x16f578['push'](_0x16f578['shift']());}};_0x591727(++_0x121a69);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c009c6f..d77d5e1 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 _0xf392=['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','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','infobip','intelepeer','TEXT'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf392,0x16c));var _0x2f39=function(_0x142ffd,_0x36cc14){_0x142ffd=_0x142ffd-0x0;var _0x35813a=_0xf392[_0x142ffd];return _0x35813a;};'use strict';var Sequelize=require(_0x2f39('0x0'));var rs=require(_0x2f39('0x1'));module['exports']={'name':{'type':Sequelize[_0x2f39('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x2f39('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x2f39('0x2')],'defaultValue':function(){return rs[_0x2f39('0x3')]();}},'phone':{'type':Sequelize[_0x2f39('0x2')]},'type':{'type':Sequelize[_0x2f39('0x4')](_0x2f39('0x5'),_0x2f39('0x6'),_0x2f39('0x7'),_0x2f39('0x8'),_0x2f39('0x9'),'clickatell',_0x2f39('0xa'),'csc',_0x2f39('0xb'),_0x2f39('0xc'))},'accountSid':{'type':Sequelize[_0x2f39('0x2')]},'authId':{'type':Sequelize[_0x2f39('0x2')]},'authToken':{'type':Sequelize[_0x2f39('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x2f39('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x2f39('0x2')]},'senderString':{'type':Sequelize[_0x2f39('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2f39('0xd')],'defaultValue':function(){return _0x2f39('0xe');}},'notificationSound':{'type':Sequelize[_0x2f39('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2f39('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2f39('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2f39('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2f39('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2f39('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2f39('0x10')],'comment':_0x2f39('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2f39('0x12'),'set':function(_0x529841){if(!_0x529841)this[_0x2f39('0x13')](_0x2f39('0x14'),null);this[_0x2f39('0x13')]('mandatoryDisposition',_0x529841);}}}; \ No newline at end of file +var _0x4dde=['plivo','clickatell','csc','intelepeer','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','generate','ENUM','connectel','clicksend'];(function(_0x5a540f,_0x31e350){var _0x3fcb97=function(_0x15568c){while(--_0x15568c){_0x5a540f['push'](_0x5a540f['shift']());}};_0x3fcb97(++_0x31e350);}(_0x4dde,0x13a));var _0xe4dd=function(_0x4ea09c,_0x2dbfa0){_0x4ea09c=_0x4ea09c-0x0;var _0x5dbdc4=_0x4dde[_0x4ea09c];return _0x5dbdc4;};'use strict';var Sequelize=require(_0xe4dd('0x0'));var rs=require(_0xe4dd('0x1'));module[_0xe4dd('0x2')]={'name':{'type':Sequelize[_0xe4dd('0x3')],'unique':_0xe4dd('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xe4dd('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe4dd('0x3')],'defaultValue':function(){return rs[_0xe4dd('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe4dd('0x6')]('twilio','skebby',_0xe4dd('0x7'),_0xe4dd('0x8'),_0xe4dd('0x9'),_0xe4dd('0xa'),'bandwidth',_0xe4dd('0xb'),'infobip',_0xe4dd('0xc'))},'accountSid':{'type':Sequelize[_0xe4dd('0x3')]},'authId':{'type':Sequelize[_0xe4dd('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xe4dd('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe4dd('0x3')]},'apiKey':{'type':Sequelize[_0xe4dd('0x3')]},'applicationId':{'type':Sequelize[_0xe4dd('0x3')]},'accountId':{'type':Sequelize[_0xe4dd('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe4dd('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe4dd('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe4dd('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe4dd('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe4dd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe4dd('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe4dd('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe4dd('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe4dd('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe4dd('0xe')],'defaultValue':![],'comment':_0xe4dd('0x10'),'set':function(_0x12e9c9){if(!_0x12e9c9)this['setDataValue'](_0xe4dd('0x11'),null);this[_0xe4dd('0x12')]('mandatoryDisposition',_0x12e9c9);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 7df18b7..f5792f7 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 _0x4b49=['Messages','dataValues','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','get','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addDisposition','params','SmsAccountId','keys','Disposition','hasOwnProperty','order','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','notify','SmsApplication','account','applications','orderBy','priority','asc','Applications','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','text','clicksend','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Tag','Tags','color','tag','List','SmsMessage'];(function(_0x310ac9,_0x339ceb){var _0x64e92c=function(_0x516a54){while(--_0x516a54){_0x310ac9['push'](_0x310ac9['shift']());}};_0x64e92c(++_0x339ceb);}(_0x4b49,0x1ea));var _0x94b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b49[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94b4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x94b4('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x94b4('0x2'));var util=require(_0x94b4('0x3'));var path=require(_0x94b4('0x4'));var sox=require(_0x94b4('0x5'));var csv=require(_0x94b4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94b4('0x7'));var _=require(_0x94b4('0x8'));var squel=require(_0x94b4('0x9'));var crypto=require(_0x94b4('0xa'));var jsforce=require(_0x94b4('0xb'));var deskjs=require(_0x94b4('0xc'));var toCsv=require(_0x94b4('0x6'));var querystring=require(_0x94b4('0xd'));var Papa=require(_0x94b4('0xe'));var Redis=require('ioredis');var authService=require(_0x94b4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94b4('0x10'));var logger=require(_0x94b4('0x11'))(_0x94b4('0x12'));var utils=require(_0x94b4('0x13'));var config=require(_0x94b4('0x14'));var licenseUtil=require(_0x94b4('0x15'));var db=require(_0x94b4('0x16'))['db'];config[_0x94b4('0x17')]=_[_0x94b4('0x18')](config[_0x94b4('0x17')],{'host':_0x94b4('0x19'),'port':0x18eb});var socket=require(_0x94b4('0x1a'))(new Redis(config['redis']));require(_0x94b4('0x1b'))[_0x94b4('0x1c')](socket);var jayson=require(_0x94b4('0x1d'));var client=jayson[_0x94b4('0x1e')][_0x94b4('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3e8912,_0x3f8927,_0x5e70a6,_0x46aa9f){return new BPromise(function(_0x34efc5,_0x422c12){var _0x525dd2=_0x46aa9f||client;return _0x525dd2[_0x94b4('0x20')](_0x3e8912,_0x5e70a6)[_0x94b4('0x21')](function(_0xb525a1){logger[_0x94b4('0x22')]('SmsAccount,\x20%s,\x20%s',_0x3f8927,_0x94b4('0x23'));logger[_0x94b4('0x24')](_0x94b4('0x25'),_0x3f8927,_0x94b4('0x23'),JSON[_0x94b4('0x26')](_0xb525a1));if(_0xb525a1['error']){if(_0xb525a1[_0x94b4('0x27')][_0x94b4('0x28')]===0x1f4){logger[_0x94b4('0x27')](_0x94b4('0x29'),_0x3f8927,_0xb525a1[_0x94b4('0x27')][_0x94b4('0x2a')]);return _0x422c12(_0xb525a1[_0x94b4('0x27')]['message']);}logger[_0x94b4('0x27')](_0x94b4('0x29'),_0x3f8927,_0xb525a1['error'][_0x94b4('0x2a')]);return _0x34efc5(_0xb525a1[_0x94b4('0x27')][_0x94b4('0x2a')]);}else{logger[_0x94b4('0x22')]('SmsAccount,\x20%s,\x20%s',_0x3f8927,_0x94b4('0x23'));_0x34efc5(_0xb525a1['result']['message']);}})[_0x94b4('0x2b')](function(_0x243dd1){logger[_0x94b4('0x27')](_0x94b4('0x29'),_0x3f8927,_0x243dd1);_0x422c12(_0x243dd1);});});}function respondWithStatusCode(_0x88551a,_0x4c7382){_0x4c7382=_0x4c7382||0xcc;return function(_0x273fad){if(_0x273fad){return _0x88551a[_0x94b4('0x2c')](_0x4c7382);}return _0x88551a[_0x94b4('0x2d')](_0x4c7382)[_0x94b4('0x2e')]();};}function respondWithResult(_0x4fcb2d,_0x1d7a6e){_0x1d7a6e=_0x1d7a6e||0xc8;return function(_0x3e2d3a){if(_0x3e2d3a){return _0x4fcb2d[_0x94b4('0x2d')](_0x1d7a6e)['json'](_0x3e2d3a);}};}function respondWithFilteredResult(_0x2832fa,_0x3a6c01){return function(_0x46ea21){if(_0x46ea21){var _0x47f097=typeof _0x3a6c01[_0x94b4('0x2f')]===_0x94b4('0x30')&&typeof _0x3a6c01[_0x94b4('0x31')]===_0x94b4('0x30');var _0x3b9f55=_0x46ea21[_0x94b4('0x32')];var _0x1bc0f4=_0x47f097?0x0:_0x3a6c01[_0x94b4('0x2f')];var _0x4500c7=_0x47f097?_0x46ea21[_0x94b4('0x32')]:_0x3a6c01['offset']+_0x3a6c01[_0x94b4('0x31')];var _0x4a8d95;if(_0x4500c7>=_0x3b9f55){_0x4500c7=_0x3b9f55;_0x4a8d95=0xc8;}else{_0x4a8d95=0xce;}_0x2832fa[_0x94b4('0x2d')](_0x4a8d95);return _0x2832fa[_0x94b4('0x33')]('Content-Range',_0x1bc0f4+'-'+_0x4500c7+'/'+_0x3b9f55)[_0x94b4('0x34')](_0x46ea21);}return null;};}function patchUpdates(_0x172215){return function(_0x4ba737){try{jsonpatch[_0x94b4('0x35')](_0x4ba737,_0x172215,!![]);}catch(_0x22683d){return BPromise['reject'](_0x22683d);}return _0x4ba737[_0x94b4('0x36')]();};}function saveUpdates(_0x2e20d8,_0x595cd3){return function(_0x2ce9ca){if(_0x2ce9ca){return _0x2ce9ca[_0x94b4('0x37')](_0x2e20d8)[_0x94b4('0x21')](function(_0x2fe3e6){return _0x2fe3e6;});}return null;};}function removeEntity(_0x1c63c9,_0x5a8f51){return function(_0x14e1f7){if(_0x14e1f7){return _0x14e1f7['destroy']()[_0x94b4('0x21')](function(){var _0x243559=_0x14e1f7[_0x94b4('0x38')]({'plain':!![]});var _0x1e37fb='SmsAccounts';return db['UserProfileResource'][_0x94b4('0x39')]({'where':{'type':_0x1e37fb,'resourceId':_0x243559['id']}})[_0x94b4('0x21')](function(){return _0x14e1f7;});})[_0x94b4('0x21')](function(){_0x1c63c9['status'](0xcc)[_0x94b4('0x2e')]();});}};}function handleEntityNotFound(_0x3fb5ee,_0x992219){return function(_0x3ffb35){if(!_0x3ffb35){_0x3fb5ee[_0x94b4('0x2c')](0x194);}return _0x3ffb35;};}function handleError(_0xfd08a2,_0x1babd4){_0x1babd4=_0x1babd4||0x1f4;return function(_0x120800){logger[_0x94b4('0x27')](_0x120800[_0x94b4('0x3a')]);if(_0x120800[_0x94b4('0x3b')]){delete _0x120800[_0x94b4('0x3b')];}_0xfd08a2[_0x94b4('0x2d')](_0x1babd4)[_0x94b4('0x3c')](_0x120800);};}exports[_0x94b4('0x3d')]=function(_0x382baf,_0x1dfe19){var _0x4769af={'include':[{'model':db[_0x94b4('0x3e')],'as':_0x94b4('0x3f')}]},_0x57bb5b={},_0x16227c={'count':0x0,'rows':[]};var _0x40950f=_[_0x94b4('0x40')](db[_0x94b4('0x41')][_0x94b4('0x42')],function(_0x5035d1){return{'name':_0x5035d1[_0x94b4('0x43')],'type':_0x5035d1[_0x94b4('0x44')][_0x94b4('0x45')]};});_0x57bb5b[_0x94b4('0x46')]=_[_0x94b4('0x40')](_0x40950f,'name');_0x57bb5b[_0x94b4('0x47')]=_['keys'](_0x382baf[_0x94b4('0x47')]);_0x57bb5b[_0x94b4('0x48')]=_[_0x94b4('0x49')](_0x57bb5b[_0x94b4('0x46')],_0x57bb5b[_0x94b4('0x47')]);_0x4769af[_0x94b4('0x4a')]=_[_0x94b4('0x49')](_0x57bb5b[_0x94b4('0x46')],qs[_0x94b4('0x4b')](_0x382baf[_0x94b4('0x47')]['fields']));_0x4769af[_0x94b4('0x4a')]=_0x4769af[_0x94b4('0x4a')]['length']?_0x4769af[_0x94b4('0x4a')]:_0x57bb5b[_0x94b4('0x46')];if(!_0x382baf['query']['hasOwnProperty'](_0x94b4('0x4c'))){_0x4769af[_0x94b4('0x31')]=qs[_0x94b4('0x31')](_0x382baf[_0x94b4('0x47')]['limit']);_0x4769af['offset']=qs[_0x94b4('0x2f')](_0x382baf[_0x94b4('0x47')]['offset']);}_0x4769af['order']=qs['sort'](_0x382baf[_0x94b4('0x47')][_0x94b4('0x4d')]);_0x4769af[_0x94b4('0x4e')]=qs[_0x94b4('0x48')](_[_0x94b4('0x4f')](_0x382baf[_0x94b4('0x47')],_0x57bb5b[_0x94b4('0x48')]),_0x40950f);if(_0x382baf['query'][_0x94b4('0x50')]){_0x4769af[_0x94b4('0x4e')]=_[_0x94b4('0x51')](_0x4769af[_0x94b4('0x4e')],{'$or':_[_0x94b4('0x40')](_0x40950f,function(_0x1ddf77){if(_0x1ddf77[_0x94b4('0x44')]!==_0x94b4('0x52')){var _0x326825={};_0x326825[_0x1ddf77[_0x94b4('0x3b')]]={'$like':'%'+_0x382baf[_0x94b4('0x47')]['filter']+'%'};return _0x326825;}})});}_0x4769af=_[_0x94b4('0x51')]({},_0x4769af,_0x382baf[_0x94b4('0x53')]);var _0x159eea={'where':_0x4769af[_0x94b4('0x4e')]};return db[_0x94b4('0x41')][_0x94b4('0x32')](_0x159eea)[_0x94b4('0x21')](function(_0x5818ca){_0x16227c[_0x94b4('0x32')]=_0x5818ca;if(_0x382baf[_0x94b4('0x47')]['includeAll']){_0x4769af[_0x94b4('0x54')]=[{'all':!![]}];}return db[_0x94b4('0x41')][_0x94b4('0x55')](_0x4769af);})[_0x94b4('0x21')](function(_0x413420){_0x16227c['rows']=_0x413420;return _0x16227c;})[_0x94b4('0x21')](respondWithFilteredResult(_0x1dfe19,_0x4769af))[_0x94b4('0x2b')](handleError(_0x1dfe19,null));};exports[_0x94b4('0x56')]=function(_0x2a9fb1,_0x514c70){var _0x1ec872={'raw':![],'where':{'id':_0x2a9fb1['params']['id']},'include':[{'model':db[_0x94b4('0x3e')],'as':_0x94b4('0x3f')}]},_0x569f25={};_0x569f25[_0x94b4('0x46')]=_['keys'](db[_0x94b4('0x41')][_0x94b4('0x42')]);_0x569f25[_0x94b4('0x47')]=_['keys'](_0x2a9fb1[_0x94b4('0x47')]);_0x569f25[_0x94b4('0x48')]=_[_0x94b4('0x49')](_0x569f25[_0x94b4('0x46')],_0x569f25[_0x94b4('0x47')]);_0x1ec872[_0x94b4('0x4a')]=_[_0x94b4('0x49')](_0x569f25[_0x94b4('0x46')],qs['fields'](_0x2a9fb1[_0x94b4('0x47')][_0x94b4('0x4b')]));_0x1ec872[_0x94b4('0x4a')]=_0x1ec872['attributes'][_0x94b4('0x57')]?_0x1ec872[_0x94b4('0x4a')]:_0x569f25[_0x94b4('0x46')];if(_0x2a9fb1[_0x94b4('0x47')][_0x94b4('0x58')]){_0x1ec872[_0x94b4('0x54')]=[{'all':!![]}];}_0x1ec872=_[_0x94b4('0x51')]({},_0x1ec872,_0x2a9fb1[_0x94b4('0x53')]);return db[_0x94b4('0x41')][_0x94b4('0x59')](_0x1ec872)[_0x94b4('0x21')](handleEntityNotFound(_0x514c70,null))[_0x94b4('0x21')](respondWithResult(_0x514c70,null))['catch'](handleError(_0x514c70,null));};exports[_0x94b4('0x5a')]=function(_0x27078f,_0x5627a0){return db[_0x94b4('0x41')][_0x94b4('0x5a')](_0x27078f[_0x94b4('0x5b')],{})[_0x94b4('0x21')](function(_0xf6bc3e){var _0x598fae=_0x27078f[_0x94b4('0x5c')][_0x94b4('0x38')]({'plain':!![]});if(!_0x598fae)throw new Error(_0x94b4('0x5d'));if(_0x598fae[_0x94b4('0x5e')]==='user'){var _0x228cfc=_0xf6bc3e[_0x94b4('0x38')]({'plain':!![]});var _0x2b92a9=_0x94b4('0x5f');return db[_0x94b4('0x60')][_0x94b4('0x59')]({'where':{'name':_0x2b92a9,'userProfileId':_0x598fae[_0x94b4('0x61')]},'raw':!![]})[_0x94b4('0x21')](function(_0x5f27d5){if(_0x5f27d5&&_0x5f27d5[_0x94b4('0x62')]===0x0){return db[_0x94b4('0x63')][_0x94b4('0x5a')]({'name':_0x228cfc[_0x94b4('0x3b')],'resourceId':_0x228cfc['id'],'type':_0x5f27d5[_0x94b4('0x3b')],'sectionId':_0x5f27d5['id']},{})[_0x94b4('0x21')](function(){return _0xf6bc3e;});}else{return _0xf6bc3e;}})[_0x94b4('0x2b')](function(_0x204308){logger[_0x94b4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204308);throw _0x204308;});}return _0xf6bc3e;})[_0x94b4('0x21')](respondWithResult(_0x5627a0,0xc9))[_0x94b4('0x2b')](handleError(_0x5627a0,null));};exports[_0x94b4('0x37')]=function(_0x3b4161,_0x589cf2){if(_0x3b4161[_0x94b4('0x5b')]['id']){delete _0x3b4161[_0x94b4('0x5b')]['id'];}return db[_0x94b4('0x41')][_0x94b4('0x59')]({'where':{'id':_0x3b4161['params']['id']},'include':[{'model':db[_0x94b4('0x3e')],'as':_0x94b4('0x3f')}]})[_0x94b4('0x21')](handleEntityNotFound(_0x589cf2,null))[_0x94b4('0x21')](saveUpdates(_0x3b4161['body'],null))['then'](respondWithResult(_0x589cf2,null))[_0x94b4('0x2b')](handleError(_0x589cf2,null));};exports['destroy']=function(_0x3746bc,_0x196c63){return db[_0x94b4('0x41')][_0x94b4('0x59')]({'where':{'id':_0x3746bc['params']['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x196c63,null))['then'](removeEntity(_0x196c63,null))[_0x94b4('0x2b')](handleError(_0x196c63,null));};exports['describe']=function(_0x32df31,_0x15132e){return db['SmsAccount']['describe']()[_0x94b4('0x21')](respondWithResult(_0x15132e,null))[_0x94b4('0x2b')](handleError(_0x15132e,null));};exports[_0x94b4('0x64')]=function(_0xe0cae6,_0x5ade5a,_0x3a2985){if(_0xe0cae6[_0x94b4('0x5b')]['id']){delete _0xe0cae6[_0x94b4('0x5b')]['id'];}return db[_0x94b4('0x41')][_0x94b4('0x59')]({'where':{'id':_0xe0cae6[_0x94b4('0x65')]['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x5ade5a,null))['then'](function(_0x4cc551){if(_0x4cc551){_0xe0cae6[_0x94b4('0x5b')][_0x94b4('0x66')]=_0x4cc551['id'];return db['Disposition'][_0x94b4('0x5a')](_0xe0cae6[_0x94b4('0x5b')]);}})[_0x94b4('0x21')](respondWithResult(_0x5ade5a,null))[_0x94b4('0x2b')](handleError(_0x5ade5a,null));};exports['getDispositions']=function(_0xeaa9f6,_0x410633,_0x42b5bc){var _0x3dcba1={'raw':![],'where':{}};var _0x30f2ae={};var _0x5a7180={'count':0x0,'rows':[]};return db[_0x94b4('0x41')]['findOne']({'where':{'id':_0xeaa9f6[_0x94b4('0x65')]['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x410633,null))[_0x94b4('0x21')](function(_0x35cfb1){if(_0x35cfb1){_0x30f2ae[_0x94b4('0x46')]=_[_0x94b4('0x67')](db[_0x94b4('0x68')]['rawAttributes']);_0x30f2ae['query']=_[_0x94b4('0x67')](_0xeaa9f6['query']);_0x30f2ae['filters']=_[_0x94b4('0x49')](_0x30f2ae[_0x94b4('0x46')],_0x30f2ae[_0x94b4('0x47')]);_0x3dcba1[_0x94b4('0x4a')]=_[_0x94b4('0x49')](_0x30f2ae[_0x94b4('0x46')],qs[_0x94b4('0x4b')](_0xeaa9f6[_0x94b4('0x47')][_0x94b4('0x4b')]));_0x3dcba1['attributes']=_0x3dcba1[_0x94b4('0x4a')][_0x94b4('0x57')]?_0x3dcba1[_0x94b4('0x4a')]:_0x30f2ae[_0x94b4('0x46')];if(!_0xeaa9f6[_0x94b4('0x47')][_0x94b4('0x69')](_0x94b4('0x4c'))){_0x3dcba1['limit']=qs[_0x94b4('0x31')](_0xeaa9f6['query']['limit']);_0x3dcba1[_0x94b4('0x2f')]=qs[_0x94b4('0x2f')](_0xeaa9f6[_0x94b4('0x47')][_0x94b4('0x2f')]);}_0x3dcba1[_0x94b4('0x6a')]=qs[_0x94b4('0x4d')](_0xeaa9f6['query'][_0x94b4('0x4d')]);_0x3dcba1[_0x94b4('0x4e')]=qs[_0x94b4('0x48')](_[_0x94b4('0x4f')](_0xeaa9f6[_0x94b4('0x47')],_0x30f2ae[_0x94b4('0x48')]));_0x3dcba1[_0x94b4('0x4e')][_0x94b4('0x66')]=_0x35cfb1['id'];if(_0xeaa9f6[_0x94b4('0x47')][_0x94b4('0x50')]){_0x3dcba1[_0x94b4('0x4e')]=_[_0x94b4('0x51')](_0x3dcba1[_0x94b4('0x4e')],{'$or':_[_0x94b4('0x40')](_0x3dcba1[_0x94b4('0x4a')],function(_0x29cc){var _0x1e1e6c={};_0x1e1e6c[_0x29cc]={'$like':'%'+_0xeaa9f6[_0x94b4('0x47')][_0x94b4('0x50')]+'%'};return _0x1e1e6c;})});}_0x3dcba1=_[_0x94b4('0x51')]({},_0x3dcba1,_0xeaa9f6[_0x94b4('0x53')]);return db['Disposition'][_0x94b4('0x32')]({'where':_0x3dcba1[_0x94b4('0x4e')]})[_0x94b4('0x21')](function(_0x5dfcd9){_0x5a7180[_0x94b4('0x32')]=_0x5dfcd9;if(_0xeaa9f6[_0x94b4('0x47')][_0x94b4('0x58')]){_0x3dcba1[_0x94b4('0x54')]=[{'all':!![]}];}return db[_0x94b4('0x68')]['findAll'](_0x3dcba1);})['then'](function(_0xc91cda){_0x5a7180[_0x94b4('0x6b')]=_0xc91cda;return _0x5a7180;});}})[_0x94b4('0x21')](respondWithFilteredResult(_0x410633,_0x3dcba1))[_0x94b4('0x2b')](handleError(_0x410633,null));};exports[_0x94b4('0x6c')]=function(_0x350248,_0x526a99,_0x41d53c){return db[_0x94b4('0x41')]['find']({'where':{'id':_0x350248[_0x94b4('0x65')]['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x526a99,null))['then'](function(_0x1c542b){if(_0x1c542b){return _0x1c542b['removeDispositions'](_0x350248[_0x94b4('0x47')]['ids']);}})[_0x94b4('0x21')](respondWithStatusCode(_0x526a99,null))['catch'](handleError(_0x526a99,null));};exports[_0x94b4('0x6d')]=function(_0x31c7f8,_0x4eae21,_0x330c1f){if(_0x31c7f8[_0x94b4('0x5b')]['id']){delete _0x31c7f8[_0x94b4('0x5b')]['id'];}return db[_0x94b4('0x41')]['find']({'where':{'id':_0x31c7f8[_0x94b4('0x65')]['id']}})['then'](handleEntityNotFound(_0x4eae21,null))[_0x94b4('0x21')](function(_0x41b2fb){if(_0x41b2fb){_0x31c7f8[_0x94b4('0x5b')]['SmsAccountId']=_0x41b2fb['id'];return db[_0x94b4('0x6e')][_0x94b4('0x5a')](_0x31c7f8[_0x94b4('0x5b')]);}})[_0x94b4('0x21')](respondWithResult(_0x4eae21,null))[_0x94b4('0x2b')](handleError(_0x4eae21,null));};exports[_0x94b4('0x6f')]=function(_0x4c8ceb,_0x116fb0,_0x22a3f3){var _0x37eec8={'raw':![],'where':{}};var _0x3b92af={};var _0x499958={'count':0x0,'rows':[]};return db['SmsAccount'][_0x94b4('0x70')]({'where':{'id':_0x4c8ceb['params']['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x116fb0,null))[_0x94b4('0x21')](function(_0x1f7a5a){if(_0x1f7a5a){_0x3b92af['model']=_['keys'](db[_0x94b4('0x6e')][_0x94b4('0x42')]);_0x3b92af['query']=_[_0x94b4('0x67')](_0x4c8ceb[_0x94b4('0x47')]);_0x3b92af[_0x94b4('0x48')]=_[_0x94b4('0x49')](_0x3b92af[_0x94b4('0x46')],_0x3b92af['query']);_0x37eec8[_0x94b4('0x4a')]=_['intersection'](_0x3b92af[_0x94b4('0x46')],qs[_0x94b4('0x4b')](_0x4c8ceb[_0x94b4('0x47')][_0x94b4('0x4b')]));_0x37eec8[_0x94b4('0x4a')]=_0x37eec8[_0x94b4('0x4a')][_0x94b4('0x57')]?_0x37eec8[_0x94b4('0x4a')]:_0x3b92af[_0x94b4('0x46')];if(!_0x4c8ceb[_0x94b4('0x47')][_0x94b4('0x69')](_0x94b4('0x4c'))){_0x37eec8['limit']=qs[_0x94b4('0x31')](_0x4c8ceb[_0x94b4('0x47')]['limit']);_0x37eec8[_0x94b4('0x2f')]=qs['offset'](_0x4c8ceb[_0x94b4('0x47')][_0x94b4('0x2f')]);}_0x37eec8[_0x94b4('0x6a')]=qs[_0x94b4('0x4d')](_0x4c8ceb[_0x94b4('0x47')][_0x94b4('0x4d')]);_0x37eec8[_0x94b4('0x4e')]=qs[_0x94b4('0x48')](_[_0x94b4('0x4f')](_0x4c8ceb[_0x94b4('0x47')],_0x3b92af[_0x94b4('0x48')]));_0x37eec8[_0x94b4('0x4e')][_0x94b4('0x66')]=_0x1f7a5a['id'];if(_0x4c8ceb[_0x94b4('0x47')][_0x94b4('0x50')]){_0x37eec8[_0x94b4('0x4e')]=_[_0x94b4('0x51')](_0x37eec8[_0x94b4('0x4e')],{'$or':_['map'](_0x37eec8[_0x94b4('0x4a')],function(_0xd26c2){var _0x32da24={};_0x32da24[_0xd26c2]={'$like':'%'+_0x4c8ceb[_0x94b4('0x47')][_0x94b4('0x50')]+'%'};return _0x32da24;})});}_0x37eec8=_['merge']({},_0x37eec8,_0x4c8ceb[_0x94b4('0x53')]);return db['CannedAnswer']['count']({'where':_0x37eec8[_0x94b4('0x4e')]})[_0x94b4('0x21')](function(_0x104ba1){_0x499958[_0x94b4('0x32')]=_0x104ba1;if(_0x4c8ceb[_0x94b4('0x47')][_0x94b4('0x58')]){_0x37eec8[_0x94b4('0x54')]=[{'all':!![]}];}return db[_0x94b4('0x6e')][_0x94b4('0x55')](_0x37eec8);})['then'](function(_0x5b1e51){_0x499958[_0x94b4('0x6b')]=_0x5b1e51;return _0x499958;});}})[_0x94b4('0x21')](respondWithFilteredResult(_0x116fb0,_0x37eec8))[_0x94b4('0x2b')](handleError(_0x116fb0,null));};exports['removeAnswers']=function(_0x149511,_0x96ca91,_0x217620){return db[_0x94b4('0x41')][_0x94b4('0x59')]({'where':{'id':_0x149511[_0x94b4('0x65')]['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x96ca91,null))[_0x94b4('0x21')](function(_0x438660){if(_0x438660){return _0x438660[_0x94b4('0x71')](_0x149511['query'][_0x94b4('0x72')]);}})[_0x94b4('0x21')](respondWithStatusCode(_0x96ca91,null))['catch'](handleError(_0x96ca91,null));};exports[_0x94b4('0x73')]=function(_0x209d4d,_0x141973,_0x17bb2f){var _0x1009df={'channel':'sms'};var _0x5e7b8e=[];var _0xf9ed7b=[];var _0x22ea52={};return db['SmsAccount'][_0x94b4('0x59')]({'where':{'id':_0x209d4d[_0x94b4('0x65')]['id']},'include':[{'model':db[_0x94b4('0x74')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x141973,null))['then'](function(_0x4c3226){_0x1009df[_0x94b4('0x75')]=_0x4c3226;_0x1009df[_0x94b4('0x76')]=_[_0x94b4('0x77')](_0x4c3226['Applications'],[_0x94b4('0x78')],[_0x94b4('0x79')]);if(_0x1009df['account']['Applications']){delete _0x1009df[_0x94b4('0x75')][_0x94b4('0x7a')];}return db['CmContact'][_0x94b4('0x7b')]();})[_0x94b4('0x21')](function(_0x3cd3eb){if(!_0x3cd3eb){throw new db[(_0x94b4('0x7c'))][(_0x94b4('0x7d'))](_0x94b4('0x7e'));}_0x5e7b8e=_[_0x94b4('0x7f')](_[_0x94b4('0x67')](_0x3cd3eb),[_0x94b4('0x80'),_0x94b4('0x81')]);_0xf9ed7b=_[_0x94b4('0x7f')](_[_0x94b4('0x67')](_0x3cd3eb),[_0x94b4('0x80'),_0x94b4('0x81'),_0x94b4('0x82'),_0x94b4('0x83')]);_0x1009df[_0x94b4('0x5b')]={'mapKey':_0x94b4('0x84')};if(_0x1009df['account'][_0x94b4('0x44')]){switch(_0x1009df[_0x94b4('0x75')]['type']){case _0x94b4('0x85'):_0x1009df['body'][_0x94b4('0x86')]=_0x209d4d[_0x94b4('0x5b')]['From'];_0x1009df[_0x94b4('0x5b')]['body']=_0x209d4d['body'][_0x94b4('0x87')];_0x1009df[_0x94b4('0x5b')][_0x94b4('0x88')]=_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x89')];break;case _0x94b4('0x8a'):_0x1009df['body'][_0x94b4('0x86')]='+'+_0x209d4d[_0x94b4('0x5b')]['sender'];_0x1009df[_0x94b4('0x5b')][_0x94b4('0x5b')]=_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x8b')];break;case'connectel':_0x1009df[_0x94b4('0x5b')][_0x94b4('0x86')]=_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x86')];_0x1009df['body'][_0x94b4('0x5b')]=_0x209d4d['body'][_0x94b4('0x2a')];break;case _0x94b4('0x8c'):_0x1009df[_0x94b4('0x5b')][_0x94b4('0x86')]=_0x209d4d[_0x94b4('0x5b')]['from'];_0x1009df['body']['body']=_0x209d4d['body'][_0x94b4('0x5b')];_0x1009df[_0x94b4('0x5b')][_0x94b4('0x88')]=_0x209d4d[_0x94b4('0x5b')]['message_id'];break;case _0x94b4('0x8d'):_0x1009df[_0x94b4('0x5b')]['from']=_0x209d4d['body'][_0x94b4('0x8e')];_0x1009df[_0x94b4('0x5b')][_0x94b4('0x5b')]=_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x8f')];_0x1009df['body'][_0x94b4('0x88')]=_0x209d4d['body'][_0x94b4('0x90')];break;case _0x94b4('0x91'):_0x1009df[_0x94b4('0x5b')][_0x94b4('0x86')]='+'+_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x92')][0x0][_0x94b4('0x86')];_0x1009df[_0x94b4('0x5b')][_0x94b4('0x5b')]=_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x92')][0x0][_0x94b4('0x8b')];_0x1009df[_0x94b4('0x5b')]['messageId']=_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x92')][0x0]['messageId'];break;case _0x94b4('0x93'):_0x1009df['body'][_0x94b4('0x86')]=_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x94')];_0x1009df[_0x94b4('0x5b')][_0x94b4('0x5b')]=_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x95')][_0x94b4('0x2a')];break;case _0x94b4('0x96'):_0x1009df['body']['from']=_0x209d4d[_0x94b4('0x5b')][_0x94b4('0x97')];_0x1009df['body'][_0x94b4('0x5b')]=_0x209d4d[_0x94b4('0x5b')]['text'];_0x1009df[_0x94b4('0x5b')][_0x94b4('0x88')]=_0x209d4d['body'][_0x94b4('0x98')];break;case _0x94b4('0x99'):_0x1009df[_0x94b4('0x5b')]['messageId']=_0x209d4d[_0x94b4('0x5b')][0x0][_0x94b4('0x2a')]['id'];_0x1009df[_0x94b4('0x5b')]['from']=_0x209d4d['body'][0x0][_0x94b4('0x2a')]['from'];_0x1009df[_0x94b4('0x5b')]['body']=_0x209d4d[_0x94b4('0x5b')][0x0]['message'][_0x94b4('0x8b')];break;case _0x94b4('0x9a'):_0x1009df['body'][_0x94b4('0x86')]=_0x209d4d[_0x94b4('0x5b')]['from'];_0x1009df[_0x94b4('0x5b')]['body']=_0x209d4d['body'][_0x94b4('0x2a')];_0x1009df[_0x94b4('0x5b')][_0x94b4('0x88')]=_0x209d4d[_0x94b4('0x5b')]['refid'];break;}}if(_0x1009df[_0x94b4('0x5b')]['id']){delete _0x1009df[_0x94b4('0x5b')]['id'];}if(_[_0x94b4('0x9b')](_0x1009df['body']['from'])){throw new db[(_0x94b4('0x7c'))][(_0x94b4('0x7d'))](_0x94b4('0x9c'));}if(_[_0x94b4('0x9b')](_0x1009df[_0x94b4('0x5b')][_0x94b4('0x5b')])||_0x1009df['body'][_0x94b4('0x5b')]===''){throw new db['Sequelize'][(_0x94b4('0x7d'))](_0x94b4('0x9d'));}if(_[_0x94b4('0x9b')](_0x1009df[_0x94b4('0x5b')]['mapKey'])){throw new db[(_0x94b4('0x7c'))]['ValidationError'](_0x94b4('0x9e')+_0xf9ed7b);}if(!_['includes'](_0xf9ed7b,_0x1009df[_0x94b4('0x5b')][_0x94b4('0x9f')])){throw new db[(_0x94b4('0x7c'))][(_0x94b4('0x7d'))](_0x94b4('0xa0')+_0xf9ed7b);}_0x22ea52[_0x1009df[_0x94b4('0x5b')][_0x94b4('0x9f')]]=_0x1009df[_0x94b4('0x5b')][_0x94b4('0x86')];return db[_0x94b4('0xa1')]['find']({'where':{'id':_0x1009df[_0x94b4('0x75')][_0x94b4('0x83')]},'include':[{'model':db[_0x94b4('0xa2')],'as':_0x94b4('0xa3'),'where':_0x22ea52,'limit':0x1,'order':[[_0x94b4('0x81'),_0x94b4('0xa4')]]}]});})[_0x94b4('0x21')](handleEntityNotFound(_0x141973,null))[_0x94b4('0x21')](function(_0x21c3f0){if(_0x21c3f0){_0x1009df['list']=_[_0x94b4('0xa5')](_0x21c3f0,[_0x94b4('0xa3')]);if(_0x21c3f0[_0x94b4('0xa3')][_0x94b4('0x57')]){return _0x21c3f0['Contacts'][0x0];}var _0x57a4d0=_[_0x94b4('0x18')](_0x1009df[_0x94b4('0x5b')],{'firstName':_0x1009df[_0x94b4('0x5b')][_0x94b4('0x86')],'ListId':_0x21c3f0['id']});_0x57a4d0[_0x1009df[_0x94b4('0x5b')][_0x94b4('0x9f')]]=_0x1009df[_0x94b4('0x5b')][_0x94b4('0x86')];return db['CmContact']['create'](_0x57a4d0,{'fields':_0x5e7b8e,'raw':!![]});}})[_0x94b4('0x21')](handleEntityNotFound(_0x141973,null))[_0x94b4('0x21')](function(_0x16a417){if(_0x16a417){_0x1009df[_0x94b4('0xa6')]=_0x16a417;var _0x3f1e58={'ContactId':_0x16a417['id'],'phone':_0x1009df[_0x94b4('0x5b')][_0x94b4('0x86')],'SmsAccountId':_0x209d4d[_0x94b4('0x65')]['id']};var _0x32198c={'ContactId':_0x16a417['id'],'SmsAccountId':_0x209d4d['params']['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x32198c})['then'](function(_0x159a3f){if(_0x159a3f){return[_0x159a3f,![]];}return db[_0x94b4('0xa7')][_0x94b4('0x5a')](_0x3f1e58)['then'](function(_0x3550f8){return[_0x3550f8,!![]];});});}})[_0x94b4('0xa8')](function(_0x4298c3,_0x87ba8d){_0x1009df['interaction']=_0x4298c3[_0x94b4('0x38')]({'plain':!![]});_0x1009df[_0x94b4('0xa9')][_0x94b4('0xaa')]=![];if(_0x87ba8d){if(_0x1009df[_0x94b4('0x75')][_0x94b4('0xab')]){_0x1009df[_0x94b4('0x76')][_0x94b4('0xac')]({'id':0x0,'priority':_0x1009df[_0x94b4('0x76')][_0x94b4('0x57')]+0x1,'app':_0x94b4('0xad'),'appdata':_0x94b4('0xae'),'interval':_0x94b4('0xaf')});}_0x1009df[_0x94b4('0xa9')]['created']=!![];}return db['SmsMessage']['create']({'phone':_0x1009df[_0x94b4('0x5b')][_0x94b4('0x86')],'messageId':_0x1009df[_0x94b4('0x5b')][_0x94b4('0x88')],'body':_0x1009df[_0x94b4('0x5b')][_0x94b4('0x5b')],'SmsAccountId':_0x209d4d[_0x94b4('0x65')]['id'],'SmsInteractionId':_0x4298c3['id'],'direction':'in','ContactId':_0x4298c3[_0x94b4('0xb0')],'AttachmentId':_0x1009df[_0x94b4('0x5b')][_0x94b4('0xb1')]});})[_0x94b4('0x21')](function(_0x5dcd54){_0x1009df['message']=_0x5dcd54;if(_0x1009df['interaction'][_0x94b4('0xb2')]){return db[_0x94b4('0xb3')]['find']({'attributes':['id',_0x94b4('0x3b')],'where':{'id':_0x1009df[_0x94b4('0xa9')][_0x94b4('0xb2')]}})['then'](function(_0x515d54){if(_0x515d54){_0x1009df[_0x94b4('0x76')]['unshift']({'id':0x0,'priority':0x0,'app':_0x94b4('0xb4'),'appdata':_0x515d54[_0x94b4('0x3b')]+','+(_0x1009df['account'][_0x94b4('0xb5')]||0xa),'interval':_0x94b4('0xaf')});}return respondWithRpcPromise(_0x94b4('0xb6'),'startRouting',_0x1009df);});}return respondWithRpcPromise(_0x94b4('0xb6'),_0x94b4('0xb7'),_0x1009df);})[_0x94b4('0x21')](function(_0x18190e){if(_0x18190e){var _0x22e105=0xc8;var _0x3e48f7=_0x94b4('0xb8');logger['info'](_0x94b4('0x25'),_0x3e48f7,_0x22e105,_0x94b4('0xb9'));logger[_0x94b4('0x24')](_0x94b4('0xba'),_0x3e48f7,_0x22e105,_0x94b4('0xb9'),JSON['stringify'](_0x18190e));if(_0x1009df[_0x94b4('0x75')][_0x94b4('0x44')]===_0x94b4('0x85')){return _0x141973[_0x94b4('0x2d')](_0x22e105)[_0x94b4('0x33')](_0x94b4('0xbb'),_0x94b4('0xbc'))[_0x94b4('0x3c')](_0x94b4('0xbd'));}else{return _0x141973[_0x94b4('0x2d')](_0x22e105)['json'](_0x18190e);}}})[_0x94b4('0x2b')](handleError(_0x141973,null));};exports[_0x94b4('0xbe')]=function(_0x1c99c8,_0x4d3f9d){var _0x1ba305=_0x1c99c8[_0x94b4('0x65')]['id'];var _0x14ddda=_0x1c99c8[_0x94b4('0x5b')];var _0x4374ee=0xc8;var _0xef2a7b=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x94b4('0xbf')][_0x94b4('0xc0')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x24b7d3){return db[_0x94b4('0x41')][_0x94b4('0x70')]({'where':{'id':_0x1ba305},'transaction':_0x24b7d3})['then'](function(_0x11ca20){if(_0x11ca20){return db[_0x94b4('0x74')][_0x94b4('0x39')]({'where':{'SmsAccountId':_0x1ba305},'transaction':_0x24b7d3})[_0x94b4('0x21')](function(){var _0x2062b2=_[_0x94b4('0x40')](_0x14ddda,function(_0x1f8f2a){_0x1f8f2a['SmsAccountId']=_0x1ba305;return _0x1f8f2a;});return db[_0x94b4('0x74')][_0x94b4('0xc1')](_0x2062b2,{'transaction':_0x24b7d3});});}else{_0x4374ee=0x194;_0xef2a7b=[];}});})[_0x94b4('0x21')](function(){if(_0x4374ee!==0x194){return db[_0x94b4('0x74')][_0x94b4('0xc2')]({'where':{'SmsAccountId':_0x1ba305},'order':_0x94b4('0x78')})['then'](function(_0x30061b){_0xef2a7b=_0x30061b;});}})[_0x94b4('0x2b')](function(_0x933f24){_0x4374ee=0x1f4;logger[_0x94b4('0x27')](_0x933f24[_0x94b4('0x3a')]);if(_0x933f24[_0x94b4('0x3b')]){delete _0x933f24[_0x94b4('0x3b')];}_0xef2a7b=_0x933f24;})['finally'](function(){if(_0xef2a7b===null){_0x4d3f9d['sendStatus'](_0x4374ee);}else{if(_0x4374ee===0x1f4){_0x4d3f9d[_0x94b4('0x2d')](_0x4374ee)[_0x94b4('0x3c')](_0xef2a7b);}else{_0x4d3f9d[_0x94b4('0x2d')](_0x4374ee)[_0x94b4('0x34')](_0xef2a7b);}}});};exports['getApplications']=function(_0x37ebed,_0x9bdd4,_0x3528b6){var _0x33f840={};var _0x13ee80={};var _0x4286dd;var _0x1f8f97;return db['SmsAccount']['findOne']({'where':{'id':_0x37ebed[_0x94b4('0x65')]['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x9bdd4,null))[_0x94b4('0x21')](function(_0x61a17c){if(_0x61a17c){_0x4286dd=_0x61a17c;_0x13ee80[_0x94b4('0x46')]=_['keys'](db['SmsApplication'][_0x94b4('0x42')]);_0x13ee80[_0x94b4('0x47')]=_['keys'](_0x37ebed[_0x94b4('0x47')]);_0x13ee80[_0x94b4('0x48')]=_[_0x94b4('0x49')](_0x13ee80['model'],_0x13ee80['query']);_0x33f840['attributes']=_[_0x94b4('0x49')](_0x13ee80[_0x94b4('0x46')],qs[_0x94b4('0x4b')](_0x37ebed[_0x94b4('0x47')][_0x94b4('0x4b')]));_0x33f840[_0x94b4('0x4a')]=_0x33f840['attributes'][_0x94b4('0x57')]?_0x33f840[_0x94b4('0x4a')]:_0x13ee80['model'];_0x33f840[_0x94b4('0x6a')]=qs[_0x94b4('0x4d')](_0x37ebed[_0x94b4('0x47')]['sort']);_0x33f840[_0x94b4('0x4e')]=qs[_0x94b4('0x48')](_['pick'](_0x37ebed[_0x94b4('0x47')],_0x13ee80[_0x94b4('0x48')]));if(_0x37ebed[_0x94b4('0x47')][_0x94b4('0x50')]){_0x33f840[_0x94b4('0x4e')]=_[_0x94b4('0x51')](_0x33f840[_0x94b4('0x4e')],{'$or':_[_0x94b4('0x40')](_0x33f840['attributes'],function(_0x2cdf0e){var _0x430800={};_0x430800[_0x2cdf0e]={'$like':'%'+_0x37ebed[_0x94b4('0x47')][_0x94b4('0x50')]+'%'};return _0x430800;})});}_0x33f840=_[_0x94b4('0x51')]({},_0x33f840,_0x37ebed[_0x94b4('0x53')]);return _0x4286dd[_0x94b4('0xc3')](_0x33f840);}})['then'](function(_0x187b5c){if(_0x187b5c){_0x1f8f97=_0x187b5c[_0x94b4('0x57')];if(!_0x37ebed[_0x94b4('0x47')][_0x94b4('0x69')]('nolimit')){_0x33f840[_0x94b4('0x31')]=qs[_0x94b4('0x31')](_0x37ebed[_0x94b4('0x47')][_0x94b4('0x31')]);_0x33f840[_0x94b4('0x2f')]=qs[_0x94b4('0x2f')](_0x37ebed['query'][_0x94b4('0x2f')]);}return _0x4286dd['getApplications'](_0x33f840);}})[_0x94b4('0x21')](function(_0x4f8210){if(_0x4f8210){return _0x4f8210?{'count':_0x1f8f97,'rows':_0x4f8210}:null;}})[_0x94b4('0x21')](respondWithResult(_0x9bdd4,null))[_0x94b4('0x2b')](handleError(_0x9bdd4,null));};exports[_0x94b4('0xc4')]=function(_0x5ce497,_0x1fc973,_0x499dde){var _0x26293f={'raw':![],'where':{}};var _0x1d0e3b={};var _0x16b5ef={'count':0x0,'rows':[]};return db[_0x94b4('0x41')][_0x94b4('0x70')]({'where':{'id':_0x5ce497[_0x94b4('0x65')]['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x1fc973,null))[_0x94b4('0x21')](function(_0x129450){if(_0x129450){_0x1d0e3b['model']=_['keys'](db['SmsInteraction'][_0x94b4('0x42')]);_0x1d0e3b[_0x94b4('0x47')]=_[_0x94b4('0x67')](_0x5ce497[_0x94b4('0x47')]);_0x1d0e3b[_0x94b4('0x48')]=_[_0x94b4('0x49')](_0x1d0e3b[_0x94b4('0x46')],_0x1d0e3b['query']);_0x26293f[_0x94b4('0x4a')]=_[_0x94b4('0x49')](_0x1d0e3b[_0x94b4('0x46')],qs[_0x94b4('0x4b')](_0x5ce497[_0x94b4('0x47')][_0x94b4('0x4b')]));_0x26293f[_0x94b4('0x4a')]=_0x26293f['attributes'][_0x94b4('0x57')]?_0x26293f['attributes']:_0x1d0e3b['model'];if(!_0x5ce497[_0x94b4('0x47')][_0x94b4('0x69')]('nolimit')){_0x26293f[_0x94b4('0x31')]=qs[_0x94b4('0x31')](_0x5ce497[_0x94b4('0x47')][_0x94b4('0x31')]);_0x26293f[_0x94b4('0x2f')]=qs['offset'](_0x5ce497[_0x94b4('0x47')][_0x94b4('0x2f')]);}_0x26293f[_0x94b4('0x6a')]=qs[_0x94b4('0x4d')](_0x5ce497[_0x94b4('0x47')][_0x94b4('0x4d')]);_0x26293f[_0x94b4('0x4e')]=qs[_0x94b4('0x48')](_['pick'](_0x5ce497['query'],_0x1d0e3b['filters']));_0x26293f['where']['SmsAccountId']=_0x129450['id'];if(_0x5ce497[_0x94b4('0x47')][_0x94b4('0x50')]){_0x26293f['where']=_[_0x94b4('0x51')](_0x26293f['where'],{'$or':_['map'](_0x26293f[_0x94b4('0x4a')],function(_0x259abd){var _0x5a0bb4={};_0x5a0bb4[_0x259abd]={'$like':'%'+_0x5ce497['query'][_0x94b4('0x50')]+'%'};return _0x5a0bb4;})});}_0x26293f=_[_0x94b4('0x51')]({},_0x26293f,_0x5ce497['options']);return db[_0x94b4('0xa7')]['count']({'where':_0x26293f[_0x94b4('0x4e')]})[_0x94b4('0x21')](function(_0x135aef){_0x16b5ef[_0x94b4('0x32')]=_0x135aef;if(_0x5ce497[_0x94b4('0x47')][_0x94b4('0x58')]){_0x26293f[_0x94b4('0x54')]=[{'model':db[_0x94b4('0xa2')],'as':'Contact','required':![]},{'model':db[_0x94b4('0xb3')],'as':'Owner','attributes':[_0x94b4('0x3b'),'fullname','internal'],'required':![]},{'model':db[_0x94b4('0xc5')],'as':_0x94b4('0xc6'),'attributes':['id','name',_0x94b4('0xc7')],'where':_0x5ce497[_0x94b4('0x47')][_0x94b4('0xc8')]?{'id':_0x5ce497[_0x94b4('0x47')][_0x94b4('0xc8')]}:undefined,'required':_0x5ce497[_0x94b4('0x47')]['tag']?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x26293f);})[_0x94b4('0x21')](function(_0xfd6984){_0x16b5ef['rows']=_0xfd6984;return _0x16b5ef;});}})[_0x94b4('0x21')](respondWithFilteredResult(_0x1fc973,_0x26293f))['catch'](handleError(_0x1fc973,null));};exports[_0x94b4('0x3c')]=function(_0xa78b49,_0x57b17f,_0x24a9a6){var _0x702f0a,_0x73aef9,_0xce275b;if(_[_0x94b4('0x9b')](_0xa78b49[_0x94b4('0x5b')][_0x94b4('0x5b')])||_0xa78b49['body']['body']===''){throw new db[(_0x94b4('0x7c'))][(_0x94b4('0x7d'))](_0x94b4('0x9d'));}if(_[_0x94b4('0x9b')](_0xa78b49['body']['to'])){throw new db[(_0x94b4('0x7c'))][(_0x94b4('0x7d'))]('to\x20is\x20mandatory');}_0x702f0a=_0xa78b49['body']['to'];return db[_0x94b4('0x41')][_0x94b4('0x59')]({'where':{'id':_0xa78b49[_0x94b4('0x65')]['id']},'include':[{'model':db[_0x94b4('0xa1')],'as':_0x94b4('0xc9'),'include':[{'model':db[_0x94b4('0xa2')],'as':_0x94b4('0xa3'),'where':{'mobile':_0x702f0a},'limit':0x1,'order':[[_0x94b4('0x81'),_0x94b4('0xa4')]]}]}]})[_0x94b4('0x21')](handleEntityNotFound(_0x57b17f,null))['then'](function(_0x5d3c16){if(_0x5d3c16&&_0x5d3c16[_0x94b4('0xc9')]){_0x73aef9=_0x5d3c16[_0x94b4('0x38')]({'plain':!![]});if(_0x73aef9[_0x94b4('0xc9')]&&_0x73aef9[_0x94b4('0xc9')]['Contacts']['length']){return _0x73aef9['List'][_0x94b4('0xa3')][0x0];}return db[_0x94b4('0xa2')][_0x94b4('0x5a')](_[_0x94b4('0x18')](_0xa78b49['body'],{'firstName':_0x702f0a,'mobile':_0x702f0a,'phone':_0x702f0a,'ListId':_0x73aef9[_0x94b4('0x83')]}));}})[_0x94b4('0x21')](handleEntityNotFound(_0x57b17f,null))['then'](function(_0xda1da8){if(_0xda1da8){_0xce275b=_0xda1da8;return db['SmsInteraction'][_0x94b4('0x59')]({'where':{'ContactId':_0xce275b['id'],'closed':![],'SmsAccountId':_0x73aef9['id']}})['then'](function(_0x5f413b){if(_0x5f413b){return[_0x5f413b,![]];}return db[_0x94b4('0xa7')]['create']({'UserId':_0xa78b49[_0x94b4('0x5c')]['id'],'ContactId':_0xce275b['id'],'SmsAccountId':_0x73aef9['id'],'phone':_0x702f0a,'firstMsgDirection':'out','Messages':[_[_0x94b4('0x51')](_0xa78b49[_0x94b4('0x5b')],{'read':![],'body':_0xa78b49[_0x94b4('0x5b')][_0x94b4('0x5b')],'phone':_0x702f0a,'SmsAccountId':_0x73aef9['id'],'UserId':_0xa78b49[_0x94b4('0x5c')]['id'],'ContactId':_0xce275b['id']})]},{'include':[{'model':db[_0x94b4('0xca')],'as':_0x94b4('0xcb')}]})[_0x94b4('0x21')](function(_0x575211){return[_0x575211,!![]];});});}})[_0x94b4('0xa8')](function(_0x455184,_0x470a5d){if(_0x470a5d){return _0x455184;}return db[_0x94b4('0xca')]['create'](_['merge'](_0xa78b49[_0x94b4('0x5b')],{'read':![],'body':_0xa78b49[_0x94b4('0x5b')][_0x94b4('0x5b')],'phone':_0x702f0a,'SmsAccountId':_0x73aef9['id'],'SmsInteractionId':_0x455184['id'],'UserId':_0xa78b49['user']['id'],'ContactId':_0xce275b['id']}))['then'](function(_0x328106){_0x455184['dataValues'][_0x94b4('0xcb')]=[];_0x455184[_0x94b4('0xcc')][_0x94b4('0xcb')][_0x94b4('0xac')](_0x328106[_0x94b4('0xcc')]);return _0x455184;});})[_0x94b4('0x21')](respondWithResult(_0x57b17f,null))[_0x94b4('0x2b')](handleError(_0x57b17f,null));};exports[_0x94b4('0x2d')]=function(_0x1dd627,_0x57c4ff,_0x3c20a8){if(_0x1dd627[_0x94b4('0x5b')]['id']){delete _0x1dd627['body']['id'];}var _0x44dad0,_0x20d4c4,_0x443d24;return db['SmsAccount'][_0x94b4('0x59')]({'where':{'id':_0x1dd627['params']['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x57c4ff,null))['then'](function(_0xe133ed){if(_0xe133ed){_0x443d24=_0xe133ed;logger[_0x94b4('0x24')](_0x94b4('0x25'),_0x94b4('0x2d'),'received\x20delivery\x20report\x20from',_0xe133ed[_0x94b4('0x44')],util['inspect'](_0x1dd627[_0x94b4('0x5b')],{'showHidden':![],'depth':null}));switch(_0xe133ed[_0x94b4('0x44')]){case _0x94b4('0x8a'):if(_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xcd')]&&_0x1dd627[_0x94b4('0x5b')][_0x94b4('0x2d')]){_0x20d4c4=_0x1dd627[_0x94b4('0x5b')][_0x94b4('0x2d')];return db[_0x94b4('0xca')]['find']({'where':{'messageId':_0x1dd627['body'][_0x94b4('0xcd')]}});}break;case _0x94b4('0xce'):if(_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xcf')]&&_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xd0')]){_0x20d4c4=_0x1dd627['body'][_0x94b4('0xd0')];return db[_0x94b4('0xca')][_0x94b4('0x59')]({'where':{'messageId':_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xcf')]}});}break;case _0x94b4('0x8c'):if(_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xd1')]&&_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xd2')]){_0x20d4c4=_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xd2')];return db['SmsMessage']['find']({'where':{'messageId':_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xd1')]}});}break;case _0x94b4('0x91'):var _0x1950b7=_0x1dd627[_0x94b4('0x5b')][_0x94b4('0x92')][0x0];if(_0x1950b7[_0x94b4('0x88')]&&_0x1950b7[_0x94b4('0x2d')][_0x94b4('0xd3')]===_0x94b4('0xd4')){_0x20d4c4=_0x1950b7[_0x94b4('0x2d')][_0x94b4('0xd3')];return db[_0x94b4('0xca')][_0x94b4('0x59')]({'where':{'messageId':_0x1950b7['messageId']}});}break;case _0x94b4('0x96'):if(_0x1dd627[_0x94b4('0x5b')][_0x94b4('0x88')]&&_0x1dd627['body'][_0x94b4('0x2d')]){_0x20d4c4=_0x1dd627[_0x94b4('0x5b')][_0x94b4('0x2d')];return db[_0x94b4('0xca')][_0x94b4('0x59')]({'where':{'messageId':_0x1dd627['body']['messageId']}});}break;case'bandwidth':if(_0x1dd627[_0x94b4('0x5b')][0x0][_0x94b4('0x2a')]['id']){_0x20d4c4=_0x1dd627[_0x94b4('0x5b')][0x0][_0x94b4('0x44')];return db[_0x94b4('0xca')]['find']({'where':{'messageId':_0x1dd627[_0x94b4('0x5b')][0x0][_0x94b4('0x2a')]['id']}});}break;case _0x94b4('0x9a'):if(_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xd5')]&&_0x1dd627[_0x94b4('0x5b')][_0x94b4('0x2d')]){_0x20d4c4=_0x1dd627['body']['status'];return db[_0x94b4('0xca')][_0x94b4('0x59')]({'where':{'messageId':_0x1dd627['body'][_0x94b4('0xd5')]}});}break;}}})[_0x94b4('0x21')](handleEntityNotFound(_0x57c4ff,null))[_0x94b4('0x21')](function(_0x4a2db0){if(_0x4a2db0){_0x44dad0=_0x4a2db0;switch(_0x443d24[_0x94b4('0x44')]){case'skebby':if(_0x20d4c4==='DELIVERED'){return _0x44dad0[_0x94b4('0x37')]({'read':!![]});}else{logger[_0x94b4('0x27')](_0x94b4('0x25'),'status',_0x94b4('0x8a'),util[_0x94b4('0xd6')](_0x1dd627[_0x94b4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x94b4('0xce'):if(_0x20d4c4==='1'){return _0x44dad0['update']({'read':!![]});}else{logger['error'](_0x94b4('0x25'),_0x94b4('0x2d'),_0x94b4('0x8a'),util[_0x94b4('0xd6')](_0x1dd627[_0x94b4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x94b4('0x8c'):if(!_0x1dd627[_0x94b4('0x5b')][_0x94b4('0xd7')]&&_0x20d4c4>=0xc8&&_0x20d4c4<=0xce){return _0x44dad0[_0x94b4('0x37')]({'read':!![]});}else{logger['error'](_0x94b4('0x25'),_0x94b4('0x2d'),_0x94b4('0x8c'),util[_0x94b4('0xd6')](_0x1dd627[_0x94b4('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3123b8=_0x1dd627[_0x94b4('0x5b')][_0x94b4('0x92')][0x0];if(_0x3123b8['status'][_0x94b4('0xd3')]==='DELIVERED'){return _0x44dad0[_0x94b4('0x37')]({'read':!![]});}else{logger['error'](_0x94b4('0x25'),'status',_0x94b4('0x91'),util[_0x94b4('0xd6')](_0x1dd627['body'],{'showHidden':![],'depth':null}));}break;case _0x94b4('0x96'):if(_0x20d4c4==_0x94b4('0xd8')||_0x20d4c4==_0x94b4('0xd9')){return _0x44dad0[_0x94b4('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','clickatell',util[_0x94b4('0xd6')](_0x1dd627[_0x94b4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x94b4('0x99'):if(_0x20d4c4=='message-delivered'){return _0x44dad0[_0x94b4('0x37')]({'read':!![]});}else{logger[_0x94b4('0x27')](_0x94b4('0x25'),_0x94b4('0x2d'),_0x94b4('0x99'),util['inspect'](_0x1dd627[_0x94b4('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x94b4('0x9a'):if(_0x20d4c4===_0x94b4('0xda')||_0x20d4c4===_0x94b4('0xdb')){return _0x44dad0[_0x94b4('0x37')]({'read':!![]});}else{logger[_0x94b4('0x27')](_0x94b4('0x25'),_0x94b4('0x2d'),_0x94b4('0x9a'),util['inspect'](_0x1dd627[_0x94b4('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x44dad0;}})[_0x94b4('0x21')](respondWithResult(_0x57c4ff,null))['catch'](handleError(_0x57c4ff,null));};exports[_0x94b4('0xdc')]=function(_0x176da5,_0xd4ae11,_0x1f6535){var _0x5bd0dd,_0x43d40e,_0x403548;return db[_0x94b4('0x41')]['find']({'where':{'id':_0x176da5['params']['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0xd4ae11,null))[_0x94b4('0x21')](function(_0x37da0f){if(_0x37da0f){_0x403548=_0x37da0f;logger[_0x94b4('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x94b4('0xdd'),_0x37da0f[_0x94b4('0x44')],util['inspect'](_0x176da5['query'],{'showHidden':![],'depth':null}));switch(_0x37da0f[_0x94b4('0x44')]){case _0x94b4('0x93'):if(_0x176da5[_0x94b4('0x47')][_0x94b4('0xde')]&&_0x176da5[_0x94b4('0x47')]['state']){_0x43d40e=_0x176da5['query'][_0x94b4('0xdf')];return db['SmsMessage'][_0x94b4('0x59')]({'where':{'messageId':_0x176da5['query'][_0x94b4('0xde')]}});}break;}}})[_0x94b4('0x21')](handleEntityNotFound(_0xd4ae11,null))[_0x94b4('0x21')](function(_0x18873c){if(_0x18873c){_0x5bd0dd=_0x18873c;switch(_0x403548[_0x94b4('0x44')]){case _0x94b4('0x93'):if(_0x43d40e==='2'||_0x43d40e==='6'){return _0x5bd0dd['update']({'read':!![]});}else{logger['error'](_0x94b4('0x25'),_0x94b4('0x2d'),_0x94b4('0x93'),util['inspect'](_0x176da5[_0x94b4('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x5bd0dd;}})[_0x94b4('0x21')](respondWithResult(_0xd4ae11,null))[_0x94b4('0x2b')](handleError(_0xd4ae11,null));};exports[_0x94b4('0xe0')]=function(_0x30e655,_0x1246ed,_0x424b15){return db[_0x94b4('0x41')][_0x94b4('0x59')]({'where':{'id':_0x30e655[_0x94b4('0x65')]['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x1246ed,null))[_0x94b4('0x21')](function(_0x3a66b7){if(_0x3a66b7){return _0x3a66b7[_0x94b4('0xe0')](_0x30e655[_0x94b4('0x5b')][_0x94b4('0x72')],_[_0x94b4('0xa5')](_0x30e655[_0x94b4('0x5b')],[_0x94b4('0x72'),'id'])||{})[_0x94b4('0xa8')](function(_0xff9419){for(var _0x41d443=0x0;_0x41d443<_0x30e655[_0x94b4('0x5b')][_0x94b4('0x72')][_0x94b4('0x57')];_0x41d443+=0x1){socket[_0x94b4('0xe1')](_0x94b4('0xe2'),{'UserId':Number(_0x30e655[_0x94b4('0x5b')][_0x94b4('0x72')][_0x41d443]),'SmsAccountId':Number(_0x30e655[_0x94b4('0x65')]['id'])});}return _0xff9419;});}})[_0x94b4('0x21')](respondWithResult(_0x1246ed,null))[_0x94b4('0x2b')](handleError(_0x1246ed,null));};exports[_0x94b4('0xe3')]=function(_0x5e04d9,_0x1c17e1,_0x4fdb2d){return db[_0x94b4('0x41')][_0x94b4('0x59')]({'where':{'id':_0x5e04d9[_0x94b4('0x65')]['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x1c17e1,null))[_0x94b4('0x21')](function(_0x5892c7){if(_0x5892c7){return _0x5892c7[_0x94b4('0xe3')](_0x5e04d9[_0x94b4('0x47')][_0x94b4('0x72')])[_0x94b4('0x21')](function(){if(_[_0x94b4('0xe4')](_0x5e04d9[_0x94b4('0x47')][_0x94b4('0x72')])){for(var _0xdd7c95=0x0;_0xdd7c95<_0x5e04d9[_0x94b4('0x47')][_0x94b4('0x72')][_0x94b4('0x57')];_0xdd7c95+=0x1){socket[_0x94b4('0xe1')](_0x94b4('0xe5'),{'UserId':Number(_0x5e04d9[_0x94b4('0x47')][_0x94b4('0x72')][_0xdd7c95]),'SmsAccountId':Number(_0x5e04d9['params']['id'])});}}else{socket[_0x94b4('0xe1')](_0x94b4('0xe5'),{'UserId':Number(_0x5e04d9[_0x94b4('0x47')]['ids']),'SmsAccountId':Number(_0x5e04d9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1c17e1,null))[_0x94b4('0x2b')](handleError(_0x1c17e1,null));};exports[_0x94b4('0xe6')]=function(_0x2d714d,_0x51c861,_0x39021a){var _0xcaa8a={};var _0x2f4b0d={};var _0x140150;var _0x2c218d;return db[_0x94b4('0x41')][_0x94b4('0x70')]({'where':{'id':_0x2d714d['params']['id']}})[_0x94b4('0x21')](handleEntityNotFound(_0x51c861,null))['then'](function(_0x2e2c6b){if(_0x2e2c6b){_0x140150=_0x2e2c6b;_0x2f4b0d[_0x94b4('0x46')]=_[_0x94b4('0x67')](db[_0x94b4('0xb3')][_0x94b4('0x42')]);_0x2f4b0d[_0x94b4('0x47')]=_[_0x94b4('0x67')](_0x2d714d[_0x94b4('0x47')]);_0x2f4b0d[_0x94b4('0x48')]=_[_0x94b4('0x49')](_0x2f4b0d[_0x94b4('0x46')],_0x2f4b0d[_0x94b4('0x47')]);_0xcaa8a[_0x94b4('0x4a')]=_[_0x94b4('0x49')](_0x2f4b0d[_0x94b4('0x46')],qs[_0x94b4('0x4b')](_0x2d714d['query'][_0x94b4('0x4b')]));_0xcaa8a['attributes']=_0xcaa8a[_0x94b4('0x4a')][_0x94b4('0x57')]?_0xcaa8a['attributes']:_0x2f4b0d[_0x94b4('0x46')];_0xcaa8a[_0x94b4('0x6a')]=qs[_0x94b4('0x4d')](_0x2d714d[_0x94b4('0x47')][_0x94b4('0x4d')]);_0xcaa8a[_0x94b4('0x4e')]=qs[_0x94b4('0x48')](_[_0x94b4('0x4f')](_0x2d714d[_0x94b4('0x47')],_0x2f4b0d[_0x94b4('0x48')]));if(_0x2d714d[_0x94b4('0x47')]['filter']){_0xcaa8a[_0x94b4('0x4e')]=_[_0x94b4('0x51')](_0xcaa8a[_0x94b4('0x4e')],{'$or':_['map'](_0xcaa8a[_0x94b4('0x4a')],function(_0x2e3ea0){var _0x2897f9={};_0x2897f9[_0x2e3ea0]={'$like':'%'+_0x2d714d[_0x94b4('0x47')][_0x94b4('0x50')]+'%'};return _0x2897f9;})});}_0xcaa8a=_[_0x94b4('0x51')]({},_0xcaa8a,_0x2d714d[_0x94b4('0x53')]);return _0x140150[_0x94b4('0xe6')](_0xcaa8a);}})[_0x94b4('0x21')](function(_0x4d8a45){if(_0x4d8a45){_0x2c218d=_0x4d8a45[_0x94b4('0x57')];if(!_0x2d714d[_0x94b4('0x47')][_0x94b4('0x69')](_0x94b4('0x4c'))){_0xcaa8a[_0x94b4('0x31')]=qs[_0x94b4('0x31')](_0x2d714d[_0x94b4('0x47')][_0x94b4('0x31')]);_0xcaa8a[_0x94b4('0x2f')]=qs[_0x94b4('0x2f')](_0x2d714d[_0x94b4('0x47')]['offset']);}return _0x140150['getAgents'](_0xcaa8a);}})['then'](function(_0x54d5c4){if(_0x54d5c4){return _0x54d5c4?{'count':_0x2c218d,'rows':_0x54d5c4}:null;}})[_0x94b4('0x21')](respondWithResult(_0x51c861,null))['catch'](handleError(_0x51c861,null));}; \ No newline at end of file +var _0xe1b5=['attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','SmsAccount','includeAll','include','findAll','rows','params','intersection','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','SmsAccountId','Disposition','getDispositions','findOne','length','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','MessageSid','sender','message_id','plivo','Text','MessageUUID','infobip','results','messageId','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','bandwidth','refid','ValidationError','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','intelepeer','redif','error_code','DELIVRD','ACCEPTD','state','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x478de8,_0x1005eb){var _0xde72a8=function(_0x3b8641){while(--_0x3b8641){_0x478de8['push'](_0x478de8['shift']());}};_0xde72a8(++_0x1005eb);}(_0xe1b5,0x195));var _0x5e1b=function(_0x3ab5cb,_0x5b9e3d){_0x3ab5cb=_0x3ab5cb-0x0;var _0x46facb=_0xe1b5[_0x3ab5cb];return _0x46facb;};'use strict';var emlformat=require(_0x5e1b('0x0'));var rimraf=require(_0x5e1b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5e1b('0x2'));var moment=require(_0x5e1b('0x3'));var BPromise=require(_0x5e1b('0x4'));var Mustache=require(_0x5e1b('0x5'));var util=require(_0x5e1b('0x6'));var path=require(_0x5e1b('0x7'));var sox=require(_0x5e1b('0x8'));var csv=require(_0x5e1b('0x9'));var ejs=require(_0x5e1b('0xa'));var fs=require('fs');var fs_extra=require(_0x5e1b('0xb'));var _=require(_0x5e1b('0xc'));var squel=require(_0x5e1b('0xd'));var crypto=require(_0x5e1b('0xe'));var jsforce=require(_0x5e1b('0xf'));var deskjs=require(_0x5e1b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5e1b('0x11'));var Papa=require(_0x5e1b('0x12'));var Redis=require('ioredis');var authService=require(_0x5e1b('0x13'));var qs=require(_0x5e1b('0x14'));var as=require(_0x5e1b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5e1b('0x16'));var utils=require('../../config/utils');var config=require(_0x5e1b('0x17'));var licenseUtil=require(_0x5e1b('0x18'));var db=require(_0x5e1b('0x19'))['db'];config[_0x5e1b('0x1a')]=_[_0x5e1b('0x1b')](config['redis'],{'host':_0x5e1b('0x1c'),'port':0x18eb});var socket=require(_0x5e1b('0x1d'))(new Redis(config[_0x5e1b('0x1a')]));require(_0x5e1b('0x1e'))[_0x5e1b('0x1f')](socket);var jayson=require(_0x5e1b('0x20'));var client=jayson[_0x5e1b('0x21')][_0x5e1b('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x5650d1,_0x52b778,_0x1e335c,_0x240d01){return new BPromise(function(_0x35f825,_0x3df105){var _0x545edf=_0x240d01||client;return _0x545edf[_0x5e1b('0x23')](_0x5650d1,_0x1e335c)[_0x5e1b('0x24')](function(_0x57e0e8){logger[_0x5e1b('0x25')](_0x5e1b('0x26'),_0x52b778,'request\x20sent');logger[_0x5e1b('0x27')](_0x5e1b('0x28'),_0x52b778,_0x5e1b('0x29'),JSON[_0x5e1b('0x2a')](_0x57e0e8));if(_0x57e0e8[_0x5e1b('0x2b')]){if(_0x57e0e8['error'][_0x5e1b('0x2c')]===0x1f4){logger[_0x5e1b('0x2b')](_0x5e1b('0x26'),_0x52b778,_0x57e0e8[_0x5e1b('0x2b')][_0x5e1b('0x2d')]);return _0x3df105(_0x57e0e8[_0x5e1b('0x2b')][_0x5e1b('0x2d')]);}logger[_0x5e1b('0x2b')](_0x5e1b('0x26'),_0x52b778,_0x57e0e8['error'][_0x5e1b('0x2d')]);return _0x35f825(_0x57e0e8[_0x5e1b('0x2b')][_0x5e1b('0x2d')]);}else{logger[_0x5e1b('0x25')](_0x5e1b('0x26'),_0x52b778,_0x5e1b('0x29'));_0x35f825(_0x57e0e8[_0x5e1b('0x2e')][_0x5e1b('0x2d')]);}})[_0x5e1b('0x2f')](function(_0x5cbba1){logger[_0x5e1b('0x2b')](_0x5e1b('0x26'),_0x52b778,_0x5cbba1);_0x3df105(_0x5cbba1);});});}function respondWithStatusCode(_0x49e648,_0x225a66){_0x225a66=_0x225a66||0xcc;return function(_0x16a0ac){if(_0x16a0ac){return _0x49e648[_0x5e1b('0x30')](_0x225a66);}return _0x49e648[_0x5e1b('0x31')](_0x225a66)[_0x5e1b('0x32')]();};}function respondWithResult(_0xf6cf68,_0x34ea08){_0x34ea08=_0x34ea08||0xc8;return function(_0x597a8d){if(_0x597a8d){return _0xf6cf68[_0x5e1b('0x31')](_0x34ea08)[_0x5e1b('0x33')](_0x597a8d);}};}function respondWithFilteredResult(_0x1c4698,_0x4637ed){return function(_0x1d4bf1){if(_0x1d4bf1){var _0xd20430=typeof _0x4637ed[_0x5e1b('0x34')]===_0x5e1b('0x35')&&typeof _0x4637ed[_0x5e1b('0x36')]===_0x5e1b('0x35');var _0x114dea=_0x1d4bf1[_0x5e1b('0x37')];var _0x702627=_0xd20430?0x0:_0x4637ed[_0x5e1b('0x34')];var _0x5686f4=_0xd20430?_0x1d4bf1[_0x5e1b('0x37')]:_0x4637ed['offset']+_0x4637ed[_0x5e1b('0x36')];var _0x233615;if(_0x5686f4>=_0x114dea){_0x5686f4=_0x114dea;_0x233615=0xc8;}else{_0x233615=0xce;}_0x1c4698[_0x5e1b('0x31')](_0x233615);return _0x1c4698[_0x5e1b('0x38')](_0x5e1b('0x39'),_0x702627+'-'+_0x5686f4+'/'+_0x114dea)[_0x5e1b('0x33')](_0x1d4bf1);}return null;};}function patchUpdates(_0x24b772){return function(_0x104726){try{jsonpatch[_0x5e1b('0x3a')](_0x104726,_0x24b772,!![]);}catch(_0x3ce4bb){return BPromise[_0x5e1b('0x3b')](_0x3ce4bb);}return _0x104726[_0x5e1b('0x3c')]();};}function saveUpdates(_0xd7d7fd,_0x4b84b6){return function(_0x2d97dd){if(_0x2d97dd){return _0x2d97dd[_0x5e1b('0x3d')](_0xd7d7fd)['then'](function(_0x24dc92){return _0x24dc92;});}return null;};}function removeEntity(_0x5e9c0c,_0x40f98d){return function(_0x242875){if(_0x242875){return _0x242875[_0x5e1b('0x3e')]()[_0x5e1b('0x24')](function(){var _0x4808c8=_0x242875[_0x5e1b('0x3f')]({'plain':!![]});var _0x4b7be7=_0x5e1b('0x40');return db['UserProfileResource'][_0x5e1b('0x3e')]({'where':{'type':_0x4b7be7,'resourceId':_0x4808c8['id']}})['then'](function(){return _0x242875;});})[_0x5e1b('0x24')](function(){_0x5e9c0c[_0x5e1b('0x31')](0xcc)[_0x5e1b('0x32')]();});}};}function handleEntityNotFound(_0x577c04,_0x4fec4b){return function(_0x386b42){if(!_0x386b42){_0x577c04[_0x5e1b('0x30')](0x194);}return _0x386b42;};}function handleError(_0xdf9b96,_0x2a3704){_0x2a3704=_0x2a3704||0x1f4;return function(_0x448327){logger[_0x5e1b('0x2b')](_0x448327['stack']);if(_0x448327[_0x5e1b('0x41')]){delete _0x448327[_0x5e1b('0x41')];}_0xdf9b96[_0x5e1b('0x31')](_0x2a3704)[_0x5e1b('0x42')](_0x448327);};}exports[_0x5e1b('0x43')]=function(_0x3256b3,_0x2f6495){var _0xa3cc51={'include':[{'model':db[_0x5e1b('0x44')],'as':_0x5e1b('0x45')}]},_0x3e2f07={},_0x4d344f={'count':0x0,'rows':[]};var _0x6eef3d=_[_0x5e1b('0x46')](db['SmsAccount'][_0x5e1b('0x47')],function(_0x9ef5a5){return{'name':_0x9ef5a5[_0x5e1b('0x48')],'type':_0x9ef5a5[_0x5e1b('0x49')][_0x5e1b('0x4a')]};});_0x3e2f07[_0x5e1b('0x4b')]=_[_0x5e1b('0x46')](_0x6eef3d,_0x5e1b('0x41'));_0x3e2f07[_0x5e1b('0x4c')]=_[_0x5e1b('0x4d')](_0x3256b3['query']);_0x3e2f07[_0x5e1b('0x4e')]=_['intersection'](_0x3e2f07[_0x5e1b('0x4b')],_0x3e2f07[_0x5e1b('0x4c')]);_0xa3cc51[_0x5e1b('0x4f')]=_['intersection'](_0x3e2f07['model'],qs[_0x5e1b('0x50')](_0x3256b3[_0x5e1b('0x4c')]['fields']));_0xa3cc51[_0x5e1b('0x4f')]=_0xa3cc51[_0x5e1b('0x4f')]['length']?_0xa3cc51[_0x5e1b('0x4f')]:_0x3e2f07['model'];if(!_0x3256b3[_0x5e1b('0x4c')][_0x5e1b('0x51')](_0x5e1b('0x52'))){_0xa3cc51['limit']=qs[_0x5e1b('0x36')](_0x3256b3[_0x5e1b('0x4c')][_0x5e1b('0x36')]);_0xa3cc51['offset']=qs[_0x5e1b('0x34')](_0x3256b3[_0x5e1b('0x4c')]['offset']);}_0xa3cc51['order']=qs[_0x5e1b('0x53')](_0x3256b3['query'][_0x5e1b('0x53')]);_0xa3cc51['where']=qs[_0x5e1b('0x4e')](_[_0x5e1b('0x54')](_0x3256b3[_0x5e1b('0x4c')],_0x3e2f07[_0x5e1b('0x4e')]),_0x6eef3d);if(_0x3256b3[_0x5e1b('0x4c')][_0x5e1b('0x55')]){_0xa3cc51[_0x5e1b('0x56')]=_['merge'](_0xa3cc51[_0x5e1b('0x56')],{'$or':_['map'](_0x6eef3d,function(_0x68483f){if(_0x68483f['type']!==_0x5e1b('0x57')){var _0x13a1f2={};_0x13a1f2[_0x68483f['name']]={'$like':'%'+_0x3256b3['query'][_0x5e1b('0x55')]+'%'};return _0x13a1f2;}})});}_0xa3cc51=_[_0x5e1b('0x58')]({},_0xa3cc51,_0x3256b3[_0x5e1b('0x59')]);var _0x446ea8={'where':_0xa3cc51[_0x5e1b('0x56')]};return db[_0x5e1b('0x5a')][_0x5e1b('0x37')](_0x446ea8)[_0x5e1b('0x24')](function(_0x3beaab){_0x4d344f[_0x5e1b('0x37')]=_0x3beaab;if(_0x3256b3['query'][_0x5e1b('0x5b')]){_0xa3cc51[_0x5e1b('0x5c')]=[{'all':!![]}];}return db[_0x5e1b('0x5a')][_0x5e1b('0x5d')](_0xa3cc51);})[_0x5e1b('0x24')](function(_0x23eb68){_0x4d344f[_0x5e1b('0x5e')]=_0x23eb68;return _0x4d344f;})[_0x5e1b('0x24')](respondWithFilteredResult(_0x2f6495,_0xa3cc51))[_0x5e1b('0x2f')](handleError(_0x2f6495,null));};exports['show']=function(_0x7926be,_0x327171){var _0x497c2e={'raw':![],'where':{'id':_0x7926be[_0x5e1b('0x5f')]['id']},'include':[{'model':db[_0x5e1b('0x44')],'as':_0x5e1b('0x45')}]},_0x107607={};_0x107607[_0x5e1b('0x4b')]=_[_0x5e1b('0x4d')](db['SmsAccount'][_0x5e1b('0x47')]);_0x107607['query']=_['keys'](_0x7926be[_0x5e1b('0x4c')]);_0x107607[_0x5e1b('0x4e')]=_[_0x5e1b('0x60')](_0x107607[_0x5e1b('0x4b')],_0x107607[_0x5e1b('0x4c')]);_0x497c2e[_0x5e1b('0x4f')]=_[_0x5e1b('0x60')](_0x107607[_0x5e1b('0x4b')],qs[_0x5e1b('0x50')](_0x7926be['query']['fields']));_0x497c2e['attributes']=_0x497c2e[_0x5e1b('0x4f')]['length']?_0x497c2e[_0x5e1b('0x4f')]:_0x107607[_0x5e1b('0x4b')];if(_0x7926be[_0x5e1b('0x4c')]['includeAll']){_0x497c2e[_0x5e1b('0x5c')]=[{'all':!![]}];}_0x497c2e=_[_0x5e1b('0x58')]({},_0x497c2e,_0x7926be['options']);return db[_0x5e1b('0x5a')][_0x5e1b('0x61')](_0x497c2e)[_0x5e1b('0x24')](handleEntityNotFound(_0x327171,null))[_0x5e1b('0x24')](respondWithResult(_0x327171,null))[_0x5e1b('0x2f')](handleError(_0x327171,null));};exports[_0x5e1b('0x62')]=function(_0x170c0f,_0x5108c8){return db[_0x5e1b('0x5a')]['create'](_0x170c0f[_0x5e1b('0x63')],{})[_0x5e1b('0x24')](function(_0xa1f49c){var _0x2615a1=_0x170c0f[_0x5e1b('0x64')][_0x5e1b('0x3f')]({'plain':!![]});if(!_0x2615a1)throw new Error(_0x5e1b('0x65'));if(_0x2615a1[_0x5e1b('0x66')]===_0x5e1b('0x64')){var _0x2edf06=_0xa1f49c[_0x5e1b('0x3f')]({'plain':!![]});var _0x681905=_0x5e1b('0x40');return db['UserProfileSection']['find']({'where':{'name':_0x681905,'userProfileId':_0x2615a1[_0x5e1b('0x67')]},'raw':!![]})[_0x5e1b('0x24')](function(_0x8e9382){if(_0x8e9382&&_0x8e9382[_0x5e1b('0x68')]===0x0){return db['UserProfileResource'][_0x5e1b('0x62')]({'name':_0x2edf06[_0x5e1b('0x41')],'resourceId':_0x2edf06['id'],'type':_0x8e9382['name'],'sectionId':_0x8e9382['id']},{})[_0x5e1b('0x24')](function(){return _0xa1f49c;});}else{return _0xa1f49c;}})[_0x5e1b('0x2f')](function(_0x5dd228){logger[_0x5e1b('0x2b')](_0x5e1b('0x69'),_0x5dd228);throw _0x5dd228;});}return _0xa1f49c;})[_0x5e1b('0x24')](respondWithResult(_0x5108c8,0xc9))[_0x5e1b('0x2f')](handleError(_0x5108c8,null));};exports[_0x5e1b('0x3d')]=function(_0x174b51,_0x43719b){if(_0x174b51[_0x5e1b('0x63')]['id']){delete _0x174b51[_0x5e1b('0x63')]['id'];}return db[_0x5e1b('0x5a')]['find']({'where':{'id':_0x174b51[_0x5e1b('0x5f')]['id']},'include':[{'model':db[_0x5e1b('0x44')],'as':_0x5e1b('0x45')}]})[_0x5e1b('0x24')](handleEntityNotFound(_0x43719b,null))[_0x5e1b('0x24')](saveUpdates(_0x174b51[_0x5e1b('0x63')],null))[_0x5e1b('0x24')](respondWithResult(_0x43719b,null))['catch'](handleError(_0x43719b,null));};exports[_0x5e1b('0x3e')]=function(_0x261f7d,_0x52f6cc){return db['SmsAccount'][_0x5e1b('0x61')]({'where':{'id':_0x261f7d[_0x5e1b('0x5f')]['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x52f6cc,null))[_0x5e1b('0x24')](removeEntity(_0x52f6cc,null))[_0x5e1b('0x2f')](handleError(_0x52f6cc,null));};exports[_0x5e1b('0x6a')]=function(_0x2e3943,_0xf5823d){return db[_0x5e1b('0x5a')][_0x5e1b('0x6a')]()[_0x5e1b('0x24')](respondWithResult(_0xf5823d,null))[_0x5e1b('0x2f')](handleError(_0xf5823d,null));};exports['addDisposition']=function(_0x197535,_0x19cbff,_0xb56b52){if(_0x197535[_0x5e1b('0x63')]['id']){delete _0x197535[_0x5e1b('0x63')]['id'];}return db[_0x5e1b('0x5a')][_0x5e1b('0x61')]({'where':{'id':_0x197535['params']['id']}})['then'](handleEntityNotFound(_0x19cbff,null))['then'](function(_0x152d2d){if(_0x152d2d){_0x197535[_0x5e1b('0x63')][_0x5e1b('0x6b')]=_0x152d2d['id'];return db[_0x5e1b('0x6c')][_0x5e1b('0x62')](_0x197535['body']);}})[_0x5e1b('0x24')](respondWithResult(_0x19cbff,null))[_0x5e1b('0x2f')](handleError(_0x19cbff,null));};exports[_0x5e1b('0x6d')]=function(_0xf93eed,_0x285cb1,_0x1df536){var _0x351fa9={'raw':![],'where':{}};var _0x5d932d={};var _0x4b6929={'count':0x0,'rows':[]};return db['SmsAccount'][_0x5e1b('0x6e')]({'where':{'id':_0xf93eed[_0x5e1b('0x5f')]['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x285cb1,null))[_0x5e1b('0x24')](function(_0x8b1ed9){if(_0x8b1ed9){_0x5d932d[_0x5e1b('0x4b')]=_[_0x5e1b('0x4d')](db[_0x5e1b('0x6c')][_0x5e1b('0x47')]);_0x5d932d['query']=_[_0x5e1b('0x4d')](_0xf93eed[_0x5e1b('0x4c')]);_0x5d932d[_0x5e1b('0x4e')]=_[_0x5e1b('0x60')](_0x5d932d[_0x5e1b('0x4b')],_0x5d932d['query']);_0x351fa9[_0x5e1b('0x4f')]=_[_0x5e1b('0x60')](_0x5d932d[_0x5e1b('0x4b')],qs['fields'](_0xf93eed['query'][_0x5e1b('0x50')]));_0x351fa9[_0x5e1b('0x4f')]=_0x351fa9[_0x5e1b('0x4f')][_0x5e1b('0x6f')]?_0x351fa9['attributes']:_0x5d932d[_0x5e1b('0x4b')];if(!_0xf93eed[_0x5e1b('0x4c')][_0x5e1b('0x51')](_0x5e1b('0x52'))){_0x351fa9[_0x5e1b('0x36')]=qs[_0x5e1b('0x36')](_0xf93eed[_0x5e1b('0x4c')]['limit']);_0x351fa9['offset']=qs[_0x5e1b('0x34')](_0xf93eed[_0x5e1b('0x4c')][_0x5e1b('0x34')]);}_0x351fa9[_0x5e1b('0x70')]=qs[_0x5e1b('0x53')](_0xf93eed[_0x5e1b('0x4c')][_0x5e1b('0x53')]);_0x351fa9[_0x5e1b('0x56')]=qs[_0x5e1b('0x4e')](_[_0x5e1b('0x54')](_0xf93eed[_0x5e1b('0x4c')],_0x5d932d[_0x5e1b('0x4e')]));_0x351fa9[_0x5e1b('0x56')][_0x5e1b('0x6b')]=_0x8b1ed9['id'];if(_0xf93eed[_0x5e1b('0x4c')][_0x5e1b('0x55')]){_0x351fa9[_0x5e1b('0x56')]=_['merge'](_0x351fa9['where'],{'$or':_['map'](_0x351fa9[_0x5e1b('0x4f')],function(_0xaa6284){var _0x54daf6={};_0x54daf6[_0xaa6284]={'$like':'%'+_0xf93eed[_0x5e1b('0x4c')][_0x5e1b('0x55')]+'%'};return _0x54daf6;})});}_0x351fa9=_[_0x5e1b('0x58')]({},_0x351fa9,_0xf93eed[_0x5e1b('0x59')]);return db['Disposition'][_0x5e1b('0x37')]({'where':_0x351fa9[_0x5e1b('0x56')]})[_0x5e1b('0x24')](function(_0x3d59b3){_0x4b6929['count']=_0x3d59b3;if(_0xf93eed[_0x5e1b('0x4c')][_0x5e1b('0x5b')]){_0x351fa9[_0x5e1b('0x5c')]=[{'all':!![]}];}return db[_0x5e1b('0x6c')]['findAll'](_0x351fa9);})[_0x5e1b('0x24')](function(_0x3325f7){_0x4b6929[_0x5e1b('0x5e')]=_0x3325f7;return _0x4b6929;});}})[_0x5e1b('0x24')](respondWithFilteredResult(_0x285cb1,_0x351fa9))['catch'](handleError(_0x285cb1,null));};exports[_0x5e1b('0x71')]=function(_0x487c80,_0x550029,_0x1ae95a){return db[_0x5e1b('0x5a')][_0x5e1b('0x61')]({'where':{'id':_0x487c80[_0x5e1b('0x5f')]['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x550029,null))['then'](function(_0x2165d4){if(_0x2165d4){return _0x2165d4[_0x5e1b('0x71')](_0x487c80['query'][_0x5e1b('0x72')]);}})[_0x5e1b('0x24')](respondWithStatusCode(_0x550029,null))['catch'](handleError(_0x550029,null));};exports[_0x5e1b('0x73')]=function(_0x20c5c0,_0x60b83,_0x6f5bab){if(_0x20c5c0[_0x5e1b('0x63')]['id']){delete _0x20c5c0[_0x5e1b('0x63')]['id'];}return db[_0x5e1b('0x5a')][_0x5e1b('0x61')]({'where':{'id':_0x20c5c0[_0x5e1b('0x5f')]['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x60b83,null))[_0x5e1b('0x24')](function(_0x273d46){if(_0x273d46){_0x20c5c0['body']['SmsAccountId']=_0x273d46['id'];return db[_0x5e1b('0x74')][_0x5e1b('0x62')](_0x20c5c0[_0x5e1b('0x63')]);}})['then'](respondWithResult(_0x60b83,null))[_0x5e1b('0x2f')](handleError(_0x60b83,null));};exports[_0x5e1b('0x75')]=function(_0x3a5732,_0x5c6290,_0x25d787){var _0x2911fb={'raw':![],'where':{}};var _0x8d8c36={};var _0x490e8e={'count':0x0,'rows':[]};return db[_0x5e1b('0x5a')][_0x5e1b('0x6e')]({'where':{'id':_0x3a5732['params']['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x5c6290,null))['then'](function(_0x29f14f){if(_0x29f14f){_0x8d8c36[_0x5e1b('0x4b')]=_['keys'](db[_0x5e1b('0x74')]['rawAttributes']);_0x8d8c36[_0x5e1b('0x4c')]=_['keys'](_0x3a5732[_0x5e1b('0x4c')]);_0x8d8c36[_0x5e1b('0x4e')]=_['intersection'](_0x8d8c36[_0x5e1b('0x4b')],_0x8d8c36[_0x5e1b('0x4c')]);_0x2911fb[_0x5e1b('0x4f')]=_['intersection'](_0x8d8c36[_0x5e1b('0x4b')],qs[_0x5e1b('0x50')](_0x3a5732[_0x5e1b('0x4c')][_0x5e1b('0x50')]));_0x2911fb['attributes']=_0x2911fb[_0x5e1b('0x4f')]['length']?_0x2911fb[_0x5e1b('0x4f')]:_0x8d8c36['model'];if(!_0x3a5732[_0x5e1b('0x4c')]['hasOwnProperty'](_0x5e1b('0x52'))){_0x2911fb['limit']=qs[_0x5e1b('0x36')](_0x3a5732['query'][_0x5e1b('0x36')]);_0x2911fb[_0x5e1b('0x34')]=qs[_0x5e1b('0x34')](_0x3a5732[_0x5e1b('0x4c')][_0x5e1b('0x34')]);}_0x2911fb['order']=qs['sort'](_0x3a5732[_0x5e1b('0x4c')][_0x5e1b('0x53')]);_0x2911fb['where']=qs[_0x5e1b('0x4e')](_['pick'](_0x3a5732['query'],_0x8d8c36[_0x5e1b('0x4e')]));_0x2911fb['where'][_0x5e1b('0x6b')]=_0x29f14f['id'];if(_0x3a5732['query'][_0x5e1b('0x55')]){_0x2911fb['where']=_['merge'](_0x2911fb['where'],{'$or':_[_0x5e1b('0x46')](_0x2911fb[_0x5e1b('0x4f')],function(_0x3a1c7b){var _0x2d6167={};_0x2d6167[_0x3a1c7b]={'$like':'%'+_0x3a5732[_0x5e1b('0x4c')]['filter']+'%'};return _0x2d6167;})});}_0x2911fb=_['merge']({},_0x2911fb,_0x3a5732[_0x5e1b('0x59')]);return db['CannedAnswer'][_0x5e1b('0x37')]({'where':_0x2911fb[_0x5e1b('0x56')]})[_0x5e1b('0x24')](function(_0x375e82){_0x490e8e[_0x5e1b('0x37')]=_0x375e82;if(_0x3a5732[_0x5e1b('0x4c')]['includeAll']){_0x2911fb[_0x5e1b('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5e1b('0x5d')](_0x2911fb);})[_0x5e1b('0x24')](function(_0x2e00ac){_0x490e8e[_0x5e1b('0x5e')]=_0x2e00ac;return _0x490e8e;});}})['then'](respondWithFilteredResult(_0x5c6290,_0x2911fb))[_0x5e1b('0x2f')](handleError(_0x5c6290,null));};exports['removeAnswers']=function(_0x1bcc1e,_0x26933a,_0x305b0a){return db[_0x5e1b('0x5a')][_0x5e1b('0x61')]({'where':{'id':_0x1bcc1e['params']['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x26933a,null))[_0x5e1b('0x24')](function(_0x48f5d5){if(_0x48f5d5){return _0x48f5d5[_0x5e1b('0x76')](_0x1bcc1e[_0x5e1b('0x4c')]['ids']);}})[_0x5e1b('0x24')](respondWithStatusCode(_0x26933a,null))[_0x5e1b('0x2f')](handleError(_0x26933a,null));};exports[_0x5e1b('0x77')]=function(_0xf06348,_0x4e794a,_0x42618b){var _0x2379cc={'channel':_0x5e1b('0x78')};var _0x479555=[];var _0x185616=[];var _0x345afe={};return db[_0x5e1b('0x5a')][_0x5e1b('0x61')]({'where':{'id':_0xf06348[_0x5e1b('0x5f')]['id']},'include':[{'model':db[_0x5e1b('0x79')],'as':'Applications'}]})[_0x5e1b('0x24')](handleEntityNotFound(_0x4e794a,null))[_0x5e1b('0x24')](function(_0x5a015b){_0x2379cc[_0x5e1b('0x7a')]=_0x5a015b;_0x2379cc[_0x5e1b('0x7b')]=_[_0x5e1b('0x7c')](_0x5a015b[_0x5e1b('0x7d')],[_0x5e1b('0x7e')],[_0x5e1b('0x7f')]);if(_0x2379cc['account'][_0x5e1b('0x7d')]){delete _0x2379cc[_0x5e1b('0x7a')][_0x5e1b('0x7d')];}return db[_0x5e1b('0x80')][_0x5e1b('0x6a')]();})[_0x5e1b('0x24')](function(_0x6a6fdc){if(!_0x6a6fdc){throw new db[(_0x5e1b('0x81'))]['ValidationError'](_0x5e1b('0x82'));}_0x479555=_[_0x5e1b('0x83')](_[_0x5e1b('0x4d')](_0x6a6fdc),[_0x5e1b('0x84'),_0x5e1b('0x85')]);_0x185616=_[_0x5e1b('0x83')](_[_0x5e1b('0x4d')](_0x6a6fdc),[_0x5e1b('0x84'),_0x5e1b('0x85'),_0x5e1b('0x86'),_0x5e1b('0x87')]);_0x2379cc[_0x5e1b('0x63')]={'mapKey':_0x5e1b('0x88')};if(_0x2379cc[_0x5e1b('0x7a')]['type']){switch(_0x2379cc[_0x5e1b('0x7a')][_0x5e1b('0x49')]){case _0x5e1b('0x89'):_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')]=_0xf06348['body'][_0x5e1b('0x8b')];_0x2379cc[_0x5e1b('0x63')]['body']=_0xf06348['body'][_0x5e1b('0x8c')];_0x2379cc['body']['messageId']=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x8d')];break;case'skebby':_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')]='+'+_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x8e')];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x63')]=_0xf06348[_0x5e1b('0x63')]['text'];break;case'connectel':_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')]=_0xf06348[_0x5e1b('0x63')]['from'];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x63')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x2d')];break;case'clicksend':_0x2379cc['body'][_0x5e1b('0x8a')]=_0xf06348['body'][_0x5e1b('0x8a')];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x63')]=_0xf06348['body'][_0x5e1b('0x63')];_0x2379cc[_0x5e1b('0x63')]['messageId']=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x8f')];break;case _0x5e1b('0x90'):_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x8b')];_0x2379cc[_0x5e1b('0x63')]['body']=_0xf06348['body'][_0x5e1b('0x91')];_0x2379cc['body']['messageId']=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x92')];break;case _0x5e1b('0x93'):_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')]='+'+_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x94')][0x0][_0x5e1b('0x8a')];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x63')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x94')][0x0]['text'];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x95')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x94')][0x0][_0x5e1b('0x95')];break;case _0x5e1b('0x96'):_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x97')];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x63')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x98')]['message'];break;case _0x5e1b('0x99'):_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')]=_0xf06348['body'][_0x5e1b('0x9a')];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x63')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x9b')];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x95')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x9c')];break;case _0x5e1b('0x9d'):_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x95')]=_0xf06348['body'][0x0]['message']['id'];_0x2379cc['body']['from']=_0xf06348[_0x5e1b('0x63')][0x0]['message'][_0x5e1b('0x8a')];_0x2379cc[_0x5e1b('0x63')]['body']=_0xf06348[_0x5e1b('0x63')][0x0][_0x5e1b('0x2d')][_0x5e1b('0x9b')];break;case'intelepeer':_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')]=_0xf06348[_0x5e1b('0x63')]['from'];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x63')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x2d')];_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x95')]=_0xf06348[_0x5e1b('0x63')][_0x5e1b('0x9e')];break;}}if(_0x2379cc[_0x5e1b('0x63')]['id']){delete _0x2379cc['body']['id'];}if(_['isNil'](_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')])){throw new db[(_0x5e1b('0x81'))][(_0x5e1b('0x9f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x63')])||_0x2379cc[_0x5e1b('0x63')]['body']===''){throw new db[(_0x5e1b('0x81'))][(_0x5e1b('0x9f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5e1b('0xa0')](_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0xa1')])){throw new db[(_0x5e1b('0x81'))][(_0x5e1b('0x9f'))](_0x5e1b('0xa2')+_0x185616);}if(!_[_0x5e1b('0xa3')](_0x185616,_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0xa1')])){throw new db[(_0x5e1b('0x81'))]['ValidationError'](_0x5e1b('0xa4')+_0x185616);}_0x345afe[_0x2379cc['body'][_0x5e1b('0xa1')]]=_0x2379cc[_0x5e1b('0x63')]['from'];return db[_0x5e1b('0xa5')]['find']({'where':{'id':_0x2379cc[_0x5e1b('0x7a')][_0x5e1b('0x87')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x345afe,'limit':0x1,'order':[[_0x5e1b('0x85'),_0x5e1b('0xa6')]]}]});})['then'](handleEntityNotFound(_0x4e794a,null))[_0x5e1b('0x24')](function(_0x317b03){if(_0x317b03){_0x2379cc[_0x5e1b('0xa7')]=_[_0x5e1b('0xa8')](_0x317b03,[_0x5e1b('0xa9')]);if(_0x317b03['Contacts'][_0x5e1b('0x6f')]){return _0x317b03[_0x5e1b('0xa9')][0x0];}var _0x101616=_['defaults'](_0x2379cc[_0x5e1b('0x63')],{'firstName':_0x2379cc[_0x5e1b('0x63')]['from'],'ListId':_0x317b03['id']});_0x101616[_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0xa1')]]=_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')];return db[_0x5e1b('0x80')][_0x5e1b('0x62')](_0x101616,{'fields':_0x479555,'raw':!![]});}})['then'](handleEntityNotFound(_0x4e794a,null))['then'](function(_0x4b3986){if(_0x4b3986){_0x2379cc['contact']=_0x4b3986;var _0x49d027={'ContactId':_0x4b3986['id'],'phone':_0x2379cc['body'][_0x5e1b('0x8a')],'SmsAccountId':_0xf06348[_0x5e1b('0x5f')]['id']};var _0x4ae9d3={'ContactId':_0x4b3986['id'],'SmsAccountId':_0xf06348[_0x5e1b('0x5f')]['id'],'closed':![]};return db[_0x5e1b('0xaa')][_0x5e1b('0x61')]({'where':_0x4ae9d3})[_0x5e1b('0x24')](function(_0x3f147b){if(_0x3f147b){return[_0x3f147b,![]];}return db[_0x5e1b('0xaa')][_0x5e1b('0x62')](_0x49d027)['then'](function(_0x5ae29c){return[_0x5ae29c,!![]];});});}})[_0x5e1b('0xab')](function(_0x2b32e3,_0x357d5b){_0x2379cc[_0x5e1b('0xac')]=_0x2b32e3[_0x5e1b('0x3f')]({'plain':!![]});_0x2379cc['interaction'][_0x5e1b('0xad')]=![];if(_0x357d5b){if(_0x2379cc[_0x5e1b('0x7a')][_0x5e1b('0xae')]){_0x2379cc[_0x5e1b('0x7b')][_0x5e1b('0xaf')]({'id':0x0,'priority':_0x2379cc[_0x5e1b('0x7b')][_0x5e1b('0x6f')]+0x1,'app':_0x5e1b('0xb0'),'appdata':_0x5e1b('0xb1'),'interval':_0x5e1b('0xb2')});}_0x2379cc['interaction'][_0x5e1b('0xad')]=!![];}return db['SmsMessage']['create']({'phone':_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x8a')],'messageId':_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0x95')],'body':_0x2379cc[_0x5e1b('0x63')]['body'],'SmsAccountId':_0xf06348[_0x5e1b('0x5f')]['id'],'SmsInteractionId':_0x2b32e3['id'],'direction':'in','ContactId':_0x2b32e3[_0x5e1b('0xb3')],'AttachmentId':_0x2379cc[_0x5e1b('0x63')][_0x5e1b('0xb4')]});})[_0x5e1b('0x24')](function(_0x58c856){_0x2379cc[_0x5e1b('0x2d')]=_0x58c856;if(_0x2379cc[_0x5e1b('0xac')][_0x5e1b('0xb5')]){return db['User'][_0x5e1b('0x61')]({'attributes':['id',_0x5e1b('0x41')],'where':{'id':_0x2379cc['interaction'][_0x5e1b('0xb5')]}})[_0x5e1b('0x24')](function(_0x43d856){if(_0x43d856){_0x2379cc['applications'][_0x5e1b('0xb6')]({'id':0x0,'priority':0x0,'app':_0x5e1b('0xb7'),'appdata':_0x43d856['name']+','+(_0x2379cc['account'][_0x5e1b('0xb8')]||0xa),'interval':_0x5e1b('0xb2')});}return respondWithRpcPromise(_0x5e1b('0xb9'),_0x5e1b('0xba'),_0x2379cc);});}return respondWithRpcPromise('Start',_0x5e1b('0xba'),_0x2379cc);})[_0x5e1b('0x24')](function(_0xe64791){if(_0xe64791){var _0x31c3db=0xc8;var _0x4427f3=_0x5e1b('0xbb');logger['info'](_0x5e1b('0x28'),_0x4427f3,_0x31c3db,_0x5e1b('0xbc'));logger[_0x5e1b('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4427f3,_0x31c3db,'entity\x20found',JSON[_0x5e1b('0x2a')](_0xe64791));if(_0x2379cc[_0x5e1b('0x7a')][_0x5e1b('0x49')]==='twilio'){return _0x4e794a[_0x5e1b('0x31')](_0x31c3db)['set'](_0x5e1b('0xbd'),_0x5e1b('0xbe'))['send'](_0x5e1b('0xbf'));}else{return _0x4e794a[_0x5e1b('0x31')](_0x31c3db)[_0x5e1b('0x33')](_0xe64791);}}})[_0x5e1b('0x2f')](handleError(_0x4e794a,null));};exports[_0x5e1b('0xc0')]=function(_0x4a1a7d,_0x45533a){var _0x5a403c=_0x4a1a7d[_0x5e1b('0x5f')]['id'];var _0x5ca27a=_0x4a1a7d['body'];var _0x3959a0=0xc8;var _0x2ea212=null;return db[_0x5e1b('0xc1')][_0x5e1b('0xc2')]({'isolationLevel':db[_0x5e1b('0xc1')]['Transaction'][_0x5e1b('0xc3')][_0x5e1b('0xc4')]},function(_0x22af02){return db[_0x5e1b('0x5a')][_0x5e1b('0x6e')]({'where':{'id':_0x5a403c},'transaction':_0x22af02})[_0x5e1b('0x24')](function(_0x591232){if(_0x591232){return db[_0x5e1b('0x79')][_0x5e1b('0x3e')]({'where':{'SmsAccountId':_0x5a403c},'transaction':_0x22af02})['then'](function(){var _0x135f15=_[_0x5e1b('0x46')](_0x5ca27a,function(_0x2ab5e2){_0x2ab5e2[_0x5e1b('0x6b')]=_0x5a403c;return _0x2ab5e2;});return db[_0x5e1b('0x79')][_0x5e1b('0xc5')](_0x135f15,{'transaction':_0x22af02});});}else{_0x3959a0=0x194;_0x2ea212=[];}});})[_0x5e1b('0x24')](function(){if(_0x3959a0!==0x194){return db[_0x5e1b('0x79')][_0x5e1b('0xc6')]({'where':{'SmsAccountId':_0x5a403c},'order':_0x5e1b('0x7e')})[_0x5e1b('0x24')](function(_0x27732e){_0x2ea212=_0x27732e;});}})[_0x5e1b('0x2f')](function(_0x4b0cbe){_0x3959a0=0x1f4;logger[_0x5e1b('0x2b')](_0x4b0cbe[_0x5e1b('0xc7')]);if(_0x4b0cbe[_0x5e1b('0x41')]){delete _0x4b0cbe[_0x5e1b('0x41')];}_0x2ea212=_0x4b0cbe;})[_0x5e1b('0xc8')](function(){if(_0x2ea212===null){_0x45533a[_0x5e1b('0x30')](_0x3959a0);}else{if(_0x3959a0===0x1f4){_0x45533a[_0x5e1b('0x31')](_0x3959a0)[_0x5e1b('0x42')](_0x2ea212);}else{_0x45533a[_0x5e1b('0x31')](_0x3959a0)[_0x5e1b('0x33')](_0x2ea212);}}});};exports[_0x5e1b('0xc9')]=function(_0x817a98,_0x2dd9c6,_0x3f26c8){var _0x91b20={};var _0x5b5cbc={};var _0x1127f2;var _0x5cd944;return db[_0x5e1b('0x5a')][_0x5e1b('0x6e')]({'where':{'id':_0x817a98[_0x5e1b('0x5f')]['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x2dd9c6,null))[_0x5e1b('0x24')](function(_0x1aa271){if(_0x1aa271){_0x1127f2=_0x1aa271;_0x5b5cbc[_0x5e1b('0x4b')]=_['keys'](db[_0x5e1b('0x79')]['rawAttributes']);_0x5b5cbc[_0x5e1b('0x4c')]=_['keys'](_0x817a98[_0x5e1b('0x4c')]);_0x5b5cbc[_0x5e1b('0x4e')]=_['intersection'](_0x5b5cbc[_0x5e1b('0x4b')],_0x5b5cbc['query']);_0x91b20[_0x5e1b('0x4f')]=_[_0x5e1b('0x60')](_0x5b5cbc[_0x5e1b('0x4b')],qs[_0x5e1b('0x50')](_0x817a98[_0x5e1b('0x4c')][_0x5e1b('0x50')]));_0x91b20[_0x5e1b('0x4f')]=_0x91b20[_0x5e1b('0x4f')][_0x5e1b('0x6f')]?_0x91b20[_0x5e1b('0x4f')]:_0x5b5cbc[_0x5e1b('0x4b')];_0x91b20[_0x5e1b('0x70')]=qs[_0x5e1b('0x53')](_0x817a98[_0x5e1b('0x4c')][_0x5e1b('0x53')]);_0x91b20[_0x5e1b('0x56')]=qs[_0x5e1b('0x4e')](_['pick'](_0x817a98[_0x5e1b('0x4c')],_0x5b5cbc[_0x5e1b('0x4e')]));if(_0x817a98[_0x5e1b('0x4c')]['filter']){_0x91b20['where']=_[_0x5e1b('0x58')](_0x91b20[_0x5e1b('0x56')],{'$or':_['map'](_0x91b20[_0x5e1b('0x4f')],function(_0x46c795){var _0x884d4c={};_0x884d4c[_0x46c795]={'$like':'%'+_0x817a98[_0x5e1b('0x4c')][_0x5e1b('0x55')]+'%'};return _0x884d4c;})});}_0x91b20=_[_0x5e1b('0x58')]({},_0x91b20,_0x817a98[_0x5e1b('0x59')]);return _0x1127f2[_0x5e1b('0xc9')](_0x91b20);}})[_0x5e1b('0x24')](function(_0x1fe628){if(_0x1fe628){_0x5cd944=_0x1fe628[_0x5e1b('0x6f')];if(!_0x817a98['query'][_0x5e1b('0x51')]('nolimit')){_0x91b20['limit']=qs[_0x5e1b('0x36')](_0x817a98[_0x5e1b('0x4c')][_0x5e1b('0x36')]);_0x91b20[_0x5e1b('0x34')]=qs[_0x5e1b('0x34')](_0x817a98[_0x5e1b('0x4c')][_0x5e1b('0x34')]);}return _0x1127f2[_0x5e1b('0xc9')](_0x91b20);}})[_0x5e1b('0x24')](function(_0x304ba5){if(_0x304ba5){return _0x304ba5?{'count':_0x5cd944,'rows':_0x304ba5}:null;}})[_0x5e1b('0x24')](respondWithResult(_0x2dd9c6,null))['catch'](handleError(_0x2dd9c6,null));};exports[_0x5e1b('0xca')]=function(_0x1da74f,_0x15c5e3,_0x7cf6ab){var _0xfce6b2={'raw':![],'where':{}};var _0x22201e={};var _0x1251cb={'count':0x0,'rows':[]};return db['SmsAccount'][_0x5e1b('0x6e')]({'where':{'id':_0x1da74f['params']['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x15c5e3,null))['then'](function(_0x5efd82){if(_0x5efd82){_0x22201e[_0x5e1b('0x4b')]=_[_0x5e1b('0x4d')](db[_0x5e1b('0xaa')][_0x5e1b('0x47')]);_0x22201e[_0x5e1b('0x4c')]=_[_0x5e1b('0x4d')](_0x1da74f[_0x5e1b('0x4c')]);_0x22201e[_0x5e1b('0x4e')]=_[_0x5e1b('0x60')](_0x22201e[_0x5e1b('0x4b')],_0x22201e[_0x5e1b('0x4c')]);_0xfce6b2[_0x5e1b('0x4f')]=_['intersection'](_0x22201e[_0x5e1b('0x4b')],qs[_0x5e1b('0x50')](_0x1da74f['query']['fields']));_0xfce6b2[_0x5e1b('0x4f')]=_0xfce6b2[_0x5e1b('0x4f')][_0x5e1b('0x6f')]?_0xfce6b2[_0x5e1b('0x4f')]:_0x22201e[_0x5e1b('0x4b')];if(!_0x1da74f[_0x5e1b('0x4c')]['hasOwnProperty'](_0x5e1b('0x52'))){_0xfce6b2[_0x5e1b('0x36')]=qs[_0x5e1b('0x36')](_0x1da74f[_0x5e1b('0x4c')][_0x5e1b('0x36')]);_0xfce6b2[_0x5e1b('0x34')]=qs['offset'](_0x1da74f['query'][_0x5e1b('0x34')]);}_0xfce6b2[_0x5e1b('0x70')]=qs[_0x5e1b('0x53')](_0x1da74f[_0x5e1b('0x4c')][_0x5e1b('0x53')]);_0xfce6b2[_0x5e1b('0x56')]=qs[_0x5e1b('0x4e')](_['pick'](_0x1da74f[_0x5e1b('0x4c')],_0x22201e[_0x5e1b('0x4e')]));_0xfce6b2[_0x5e1b('0x56')][_0x5e1b('0x6b')]=_0x5efd82['id'];if(_0x1da74f[_0x5e1b('0x4c')]['filter']){_0xfce6b2[_0x5e1b('0x56')]=_[_0x5e1b('0x58')](_0xfce6b2[_0x5e1b('0x56')],{'$or':_['map'](_0xfce6b2[_0x5e1b('0x4f')],function(_0x580a21){var _0x23521d={};_0x23521d[_0x580a21]={'$like':'%'+_0x1da74f[_0x5e1b('0x4c')][_0x5e1b('0x55')]+'%'};return _0x23521d;})});}_0xfce6b2=_[_0x5e1b('0x58')]({},_0xfce6b2,_0x1da74f['options']);return db[_0x5e1b('0xaa')]['count']({'where':_0xfce6b2[_0x5e1b('0x56')]})['then'](function(_0x1e3bd5){_0x1251cb['count']=_0x1e3bd5;if(_0x1da74f[_0x5e1b('0x4c')][_0x5e1b('0x5b')]){_0xfce6b2['include']=[{'model':db[_0x5e1b('0x80')],'as':_0x5e1b('0xcb'),'required':![]},{'model':db[_0x5e1b('0xcc')],'as':_0x5e1b('0xcd'),'attributes':[_0x5e1b('0x41'),'fullname',_0x5e1b('0xce')],'required':![]},{'model':db[_0x5e1b('0xcf')],'as':_0x5e1b('0xd0'),'attributes':['id',_0x5e1b('0x41'),_0x5e1b('0xd1')],'where':_0x1da74f[_0x5e1b('0x4c')]['tag']?{'id':_0x1da74f['query'][_0x5e1b('0xd2')]}:undefined,'required':_0x1da74f[_0x5e1b('0x4c')][_0x5e1b('0xd2')]?!![]:![]}];}return db['SmsInteraction'][_0x5e1b('0x5d')](_0xfce6b2);})[_0x5e1b('0x24')](function(_0x4d9770){_0x1251cb[_0x5e1b('0x5e')]=_0x4d9770;return _0x1251cb;});}})[_0x5e1b('0x24')](respondWithFilteredResult(_0x15c5e3,_0xfce6b2))[_0x5e1b('0x2f')](handleError(_0x15c5e3,null));};exports['send']=function(_0xb4c0fd,_0x560462,_0x1adf1c){var _0x1e4f7d,_0x1487b5,_0x497b25;if(_[_0x5e1b('0xa0')](_0xb4c0fd['body']['body'])||_0xb4c0fd[_0x5e1b('0x63')][_0x5e1b('0x63')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5e1b('0xa0')](_0xb4c0fd['body']['to'])){throw new db[(_0x5e1b('0x81'))][(_0x5e1b('0x9f'))](_0x5e1b('0xd3'));}_0x1e4f7d=_0xb4c0fd['body']['to'];return db[_0x5e1b('0x5a')]['find']({'where':{'id':_0xb4c0fd[_0x5e1b('0x5f')]['id']},'include':[{'model':db[_0x5e1b('0xa5')],'as':_0x5e1b('0xd4'),'include':[{'model':db['CmContact'],'as':_0x5e1b('0xa9'),'where':{'mobile':_0x1e4f7d},'limit':0x1,'order':[[_0x5e1b('0x85'),_0x5e1b('0xa6')]]}]}]})[_0x5e1b('0x24')](handleEntityNotFound(_0x560462,null))['then'](function(_0x36c88e){if(_0x36c88e&&_0x36c88e[_0x5e1b('0xd4')]){_0x1487b5=_0x36c88e['get']({'plain':!![]});if(_0x1487b5[_0x5e1b('0xd4')]&&_0x1487b5[_0x5e1b('0xd4')][_0x5e1b('0xa9')][_0x5e1b('0x6f')]){return _0x1487b5['List'][_0x5e1b('0xa9')][0x0];}return db[_0x5e1b('0x80')]['create'](_[_0x5e1b('0x1b')](_0xb4c0fd[_0x5e1b('0x63')],{'firstName':_0x1e4f7d,'mobile':_0x1e4f7d,'phone':_0x1e4f7d,'ListId':_0x1487b5['ListId']}));}})[_0x5e1b('0x24')](handleEntityNotFound(_0x560462,null))[_0x5e1b('0x24')](function(_0x3588d6){if(_0x3588d6){_0x497b25=_0x3588d6;return db[_0x5e1b('0xaa')][_0x5e1b('0x61')]({'where':{'ContactId':_0x497b25['id'],'closed':![],'SmsAccountId':_0x1487b5['id']}})[_0x5e1b('0x24')](function(_0x63d42d){if(_0x63d42d){return[_0x63d42d,![]];}return db['SmsInteraction'][_0x5e1b('0x62')]({'UserId':_0xb4c0fd['user']['id'],'ContactId':_0x497b25['id'],'SmsAccountId':_0x1487b5['id'],'phone':_0x1e4f7d,'firstMsgDirection':_0x5e1b('0xd5'),'Messages':[_[_0x5e1b('0x58')](_0xb4c0fd[_0x5e1b('0x63')],{'read':![],'body':_0xb4c0fd['body']['body'],'phone':_0x1e4f7d,'SmsAccountId':_0x1487b5['id'],'UserId':_0xb4c0fd[_0x5e1b('0x64')]['id'],'ContactId':_0x497b25['id']})]},{'include':[{'model':db[_0x5e1b('0xd6')],'as':_0x5e1b('0xd7')}]})['then'](function(_0x1f7434){return[_0x1f7434,!![]];});});}})[_0x5e1b('0xab')](function(_0x483419,_0x6f15be){if(_0x6f15be){return _0x483419;}return db[_0x5e1b('0xd6')][_0x5e1b('0x62')](_[_0x5e1b('0x58')](_0xb4c0fd[_0x5e1b('0x63')],{'read':![],'body':_0xb4c0fd[_0x5e1b('0x63')]['body'],'phone':_0x1e4f7d,'SmsAccountId':_0x1487b5['id'],'SmsInteractionId':_0x483419['id'],'UserId':_0xb4c0fd[_0x5e1b('0x64')]['id'],'ContactId':_0x497b25['id']}))[_0x5e1b('0x24')](function(_0xd19e93){_0x483419[_0x5e1b('0xd8')][_0x5e1b('0xd7')]=[];_0x483419[_0x5e1b('0xd8')]['Messages'][_0x5e1b('0xaf')](_0xd19e93[_0x5e1b('0xd8')]);return _0x483419;});})[_0x5e1b('0x24')](respondWithResult(_0x560462,null))[_0x5e1b('0x2f')](handleError(_0x560462,null));};exports['status']=function(_0x406899,_0x4a7608,_0x11240f){if(_0x406899[_0x5e1b('0x63')]['id']){delete _0x406899[_0x5e1b('0x63')]['id'];}var _0x2eb88c,_0x3533a6,_0x32d1f4;return db[_0x5e1b('0x5a')][_0x5e1b('0x61')]({'where':{'id':_0x406899[_0x5e1b('0x5f')]['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x4a7608,null))['then'](function(_0x369e85){if(_0x369e85){_0x32d1f4=_0x369e85;logger['debug'](_0x5e1b('0x28'),'status',_0x5e1b('0xd9'),_0x369e85['type'],util[_0x5e1b('0xda')](_0x406899[_0x5e1b('0x63')],{'showHidden':![],'depth':null}));switch(_0x369e85[_0x5e1b('0x49')]){case _0x5e1b('0xdb'):if(_0x406899['body']['skebby_dispatch_id']&&_0x406899['body'][_0x5e1b('0x31')]){_0x3533a6=_0x406899[_0x5e1b('0x63')][_0x5e1b('0x31')];return db[_0x5e1b('0xd6')][_0x5e1b('0x61')]({'where':{'messageId':_0x406899[_0x5e1b('0x63')][_0x5e1b('0xdc')]}});}break;case _0x5e1b('0xdd'):if(_0x406899[_0x5e1b('0x63')][_0x5e1b('0xde')]&&_0x406899[_0x5e1b('0x63')][_0x5e1b('0xdf')]){_0x3533a6=_0x406899[_0x5e1b('0x63')][_0x5e1b('0xdf')];return db[_0x5e1b('0xd6')][_0x5e1b('0x61')]({'where':{'messageId':_0x406899[_0x5e1b('0x63')][_0x5e1b('0xde')]}});}break;case _0x5e1b('0xe0'):if(_0x406899[_0x5e1b('0x63')]['message_id']&&_0x406899[_0x5e1b('0x63')][_0x5e1b('0xe1')]){_0x3533a6=_0x406899['body']['status_code'];return db[_0x5e1b('0xd6')][_0x5e1b('0x61')]({'where':{'messageId':_0x406899[_0x5e1b('0x63')][_0x5e1b('0x8f')]}});}break;case _0x5e1b('0x93'):var _0x65ae54=_0x406899[_0x5e1b('0x63')]['results'][0x0];if(_0x65ae54[_0x5e1b('0x95')]&&_0x65ae54[_0x5e1b('0x31')][_0x5e1b('0xe2')]===_0x5e1b('0xe3')){_0x3533a6=_0x65ae54['status']['groupName'];return db[_0x5e1b('0xd6')][_0x5e1b('0x61')]({'where':{'messageId':_0x65ae54[_0x5e1b('0x95')]}});}break;case _0x5e1b('0x99'):if(_0x406899[_0x5e1b('0x63')][_0x5e1b('0x95')]&&_0x406899[_0x5e1b('0x63')][_0x5e1b('0x31')]){_0x3533a6=_0x406899['body']['status'];return db['SmsMessage'][_0x5e1b('0x61')]({'where':{'messageId':_0x406899[_0x5e1b('0x63')][_0x5e1b('0x95')]}});}break;case _0x5e1b('0x9d'):if(_0x406899[_0x5e1b('0x63')][0x0][_0x5e1b('0x2d')]['id']){_0x3533a6=_0x406899['body'][0x0]['type'];return db[_0x5e1b('0xd6')][_0x5e1b('0x61')]({'where':{'messageId':_0x406899['body'][0x0][_0x5e1b('0x2d')]['id']}});}break;case _0x5e1b('0xe4'):if(_0x406899[_0x5e1b('0x63')][_0x5e1b('0xe5')]&&_0x406899[_0x5e1b('0x63')][_0x5e1b('0x31')]){_0x3533a6=_0x406899[_0x5e1b('0x63')][_0x5e1b('0x31')];return db['SmsMessage'][_0x5e1b('0x61')]({'where':{'messageId':_0x406899[_0x5e1b('0x63')]['redif']}});}break;}}})[_0x5e1b('0x24')](handleEntityNotFound(_0x4a7608,null))[_0x5e1b('0x24')](function(_0x50f00e){if(_0x50f00e){_0x2eb88c=_0x50f00e;switch(_0x32d1f4[_0x5e1b('0x49')]){case _0x5e1b('0xdb'):if(_0x3533a6===_0x5e1b('0xe3')){return _0x2eb88c[_0x5e1b('0x3d')]({'read':!![]});}else{logger['error'](_0x5e1b('0x28'),_0x5e1b('0x31'),_0x5e1b('0xdb'),util['inspect'](_0x406899[_0x5e1b('0x63')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3533a6==='1'){return _0x2eb88c[_0x5e1b('0x3d')]({'read':!![]});}else{logger[_0x5e1b('0x2b')](_0x5e1b('0x28'),_0x5e1b('0x31'),_0x5e1b('0xdb'),util['inspect'](_0x406899[_0x5e1b('0x63')],{'showHidden':![],'depth':null}));}break;case _0x5e1b('0xe0'):if(!_0x406899['body'][_0x5e1b('0xe6')]&&_0x3533a6>=0xc8&&_0x3533a6<=0xce){return _0x2eb88c[_0x5e1b('0x3d')]({'read':!![]});}else{logger['error'](_0x5e1b('0x28'),_0x5e1b('0x31'),_0x5e1b('0xe0'),util[_0x5e1b('0xda')](_0x406899[_0x5e1b('0x63')],{'showHidden':![],'depth':null}));}break;case _0x5e1b('0x93'):var _0xe76a54=_0x406899[_0x5e1b('0x63')]['results'][0x0];if(_0xe76a54[_0x5e1b('0x31')][_0x5e1b('0xe2')]==='DELIVERED'){return _0x2eb88c[_0x5e1b('0x3d')]({'read':!![]});}else{logger[_0x5e1b('0x2b')](_0x5e1b('0x28'),'status',_0x5e1b('0x93'),util['inspect'](_0x406899[_0x5e1b('0x63')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3533a6=='DELIVERED_TO_GATEWAY'||_0x3533a6=='RECEIVED_BY_RECIPIENT'){return _0x2eb88c['update']({'read':!![]});}else{logger[_0x5e1b('0x2b')](_0x5e1b('0x28'),_0x5e1b('0x31'),_0x5e1b('0x99'),util[_0x5e1b('0xda')](_0x406899[_0x5e1b('0x63')],{'showHidden':![],'depth':null}));}break;case _0x5e1b('0x9d'):if(_0x3533a6=='message-delivered'){return _0x2eb88c[_0x5e1b('0x3d')]({'read':!![]});}else{logger[_0x5e1b('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e1b('0x31'),'bandwidth',util[_0x5e1b('0xda')](_0x406899[_0x5e1b('0x63')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3533a6===_0x5e1b('0xe7')||_0x3533a6===_0x5e1b('0xe8')){return _0x2eb88c[_0x5e1b('0x3d')]({'read':!![]});}else{logger['error'](_0x5e1b('0x28'),_0x5e1b('0x31'),_0x5e1b('0xe4'),util[_0x5e1b('0xda')](_0x406899['body'],{'showHidden':![],'depth':null}));}break;}return _0x2eb88c;}})['then'](respondWithResult(_0x4a7608,null))[_0x5e1b('0x2f')](handleError(_0x4a7608,null));};exports['statusGet']=function(_0x36aaba,_0x1f42ab,_0x68e3ce){var _0x2a26f6,_0x327ef6,_0x1d8490;return db[_0x5e1b('0x5a')]['find']({'where':{'id':_0x36aaba[_0x5e1b('0x5f')]['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x1f42ab,null))[_0x5e1b('0x24')](function(_0x16ea9e){if(_0x16ea9e){_0x1d8490=_0x16ea9e;logger[_0x5e1b('0x27')](_0x5e1b('0x28'),_0x5e1b('0x31'),_0x5e1b('0xd9'),_0x16ea9e[_0x5e1b('0x49')],util[_0x5e1b('0xda')](_0x36aaba[_0x5e1b('0x4c')],{'showHidden':![],'depth':null}));switch(_0x16ea9e['type']){case _0x5e1b('0x96'):if(_0x36aaba['query']['message-id']&&_0x36aaba[_0x5e1b('0x4c')][_0x5e1b('0xe9')]){_0x327ef6=_0x36aaba[_0x5e1b('0x4c')][_0x5e1b('0xe9')];return db[_0x5e1b('0xd6')][_0x5e1b('0x61')]({'where':{'messageId':_0x36aaba['query'][_0x5e1b('0xea')]}});}break;}}})[_0x5e1b('0x24')](handleEntityNotFound(_0x1f42ab,null))['then'](function(_0x252b9e){if(_0x252b9e){_0x2a26f6=_0x252b9e;switch(_0x1d8490[_0x5e1b('0x49')]){case _0x5e1b('0x96'):if(_0x327ef6==='2'||_0x327ef6==='6'){return _0x2a26f6[_0x5e1b('0x3d')]({'read':!![]});}else{logger[_0x5e1b('0x2b')](_0x5e1b('0x28'),_0x5e1b('0x31'),_0x5e1b('0x96'),util['inspect'](_0x36aaba['query'],{'showHidden':![],'depth':null}));};break;}return _0x2a26f6;}})[_0x5e1b('0x24')](respondWithResult(_0x1f42ab,null))[_0x5e1b('0x2f')](handleError(_0x1f42ab,null));};exports[_0x5e1b('0xeb')]=function(_0x1ea30a,_0x1037d9,_0x508d0c){return db['SmsAccount'][_0x5e1b('0x61')]({'where':{'id':_0x1ea30a['params']['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x1037d9,null))['then'](function(_0x2535ba){if(_0x2535ba){return _0x2535ba[_0x5e1b('0xeb')](_0x1ea30a[_0x5e1b('0x63')][_0x5e1b('0x72')],_[_0x5e1b('0xa8')](_0x1ea30a[_0x5e1b('0x63')],[_0x5e1b('0x72'),'id'])||{})[_0x5e1b('0xab')](function(_0x283a75){for(var _0x290f0a=0x0;_0x290f0a<_0x1ea30a[_0x5e1b('0x63')][_0x5e1b('0x72')]['length'];_0x290f0a+=0x1){socket['emit'](_0x5e1b('0xec'),{'UserId':Number(_0x1ea30a['body'][_0x5e1b('0x72')][_0x290f0a]),'SmsAccountId':Number(_0x1ea30a[_0x5e1b('0x5f')]['id'])});}return _0x283a75;});}})[_0x5e1b('0x24')](respondWithResult(_0x1037d9,null))[_0x5e1b('0x2f')](handleError(_0x1037d9,null));};exports[_0x5e1b('0xed')]=function(_0x18404d,_0x555630,_0x1173f4){return db[_0x5e1b('0x5a')][_0x5e1b('0x61')]({'where':{'id':_0x18404d[_0x5e1b('0x5f')]['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x555630,null))['then'](function(_0x49dc95){if(_0x49dc95){return _0x49dc95[_0x5e1b('0xed')](_0x18404d[_0x5e1b('0x4c')]['ids'])[_0x5e1b('0x24')](function(){if(_[_0x5e1b('0xee')](_0x18404d['query']['ids'])){for(var _0x2c2c0f=0x0;_0x2c2c0f<_0x18404d[_0x5e1b('0x4c')][_0x5e1b('0x72')][_0x5e1b('0x6f')];_0x2c2c0f+=0x1){socket[_0x5e1b('0xef')]('userSmsAccount:remove',{'UserId':Number(_0x18404d['query'][_0x5e1b('0x72')][_0x2c2c0f]),'SmsAccountId':Number(_0x18404d[_0x5e1b('0x5f')]['id'])});}}else{socket[_0x5e1b('0xef')](_0x5e1b('0xf0'),{'UserId':Number(_0x18404d['query'][_0x5e1b('0x72')]),'SmsAccountId':Number(_0x18404d[_0x5e1b('0x5f')]['id'])});}});}})[_0x5e1b('0x24')](respondWithStatusCode(_0x555630,null))[_0x5e1b('0x2f')](handleError(_0x555630,null));};exports['getAgents']=function(_0x3099f8,_0x476645,_0xd2cfe2){var _0x2bf724={};var _0x756363={};var _0x54ede2;var _0x248b77;return db[_0x5e1b('0x5a')][_0x5e1b('0x6e')]({'where':{'id':_0x3099f8[_0x5e1b('0x5f')]['id']}})[_0x5e1b('0x24')](handleEntityNotFound(_0x476645,null))[_0x5e1b('0x24')](function(_0x2fece6){if(_0x2fece6){_0x54ede2=_0x2fece6;_0x756363[_0x5e1b('0x4b')]=_[_0x5e1b('0x4d')](db[_0x5e1b('0xcc')][_0x5e1b('0x47')]);_0x756363['query']=_[_0x5e1b('0x4d')](_0x3099f8[_0x5e1b('0x4c')]);_0x756363['filters']=_['intersection'](_0x756363['model'],_0x756363['query']);_0x2bf724[_0x5e1b('0x4f')]=_['intersection'](_0x756363[_0x5e1b('0x4b')],qs['fields'](_0x3099f8['query'][_0x5e1b('0x50')]));_0x2bf724['attributes']=_0x2bf724['attributes'][_0x5e1b('0x6f')]?_0x2bf724['attributes']:_0x756363[_0x5e1b('0x4b')];_0x2bf724[_0x5e1b('0x70')]=qs[_0x5e1b('0x53')](_0x3099f8[_0x5e1b('0x4c')][_0x5e1b('0x53')]);_0x2bf724[_0x5e1b('0x56')]=qs[_0x5e1b('0x4e')](_[_0x5e1b('0x54')](_0x3099f8[_0x5e1b('0x4c')],_0x756363[_0x5e1b('0x4e')]));if(_0x3099f8[_0x5e1b('0x4c')][_0x5e1b('0x55')]){_0x2bf724[_0x5e1b('0x56')]=_[_0x5e1b('0x58')](_0x2bf724[_0x5e1b('0x56')],{'$or':_[_0x5e1b('0x46')](_0x2bf724[_0x5e1b('0x4f')],function(_0x49b1e2){var _0x18628f={};_0x18628f[_0x49b1e2]={'$like':'%'+_0x3099f8[_0x5e1b('0x4c')]['filter']+'%'};return _0x18628f;})});}_0x2bf724=_[_0x5e1b('0x58')]({},_0x2bf724,_0x3099f8[_0x5e1b('0x59')]);return _0x54ede2[_0x5e1b('0xf1')](_0x2bf724);}})[_0x5e1b('0x24')](function(_0x272eb7){if(_0x272eb7){_0x248b77=_0x272eb7[_0x5e1b('0x6f')];if(!_0x3099f8[_0x5e1b('0x4c')][_0x5e1b('0x51')](_0x5e1b('0x52'))){_0x2bf724['limit']=qs['limit'](_0x3099f8[_0x5e1b('0x4c')][_0x5e1b('0x36')]);_0x2bf724[_0x5e1b('0x34')]=qs['offset'](_0x3099f8[_0x5e1b('0x4c')][_0x5e1b('0x34')]);}return _0x54ede2[_0x5e1b('0xf1')](_0x2bf724);}})[_0x5e1b('0x24')](function(_0x3eeb89){if(_0x3eeb89){return _0x3eeb89?{'count':_0x248b77,'rows':_0x3eeb89}:null;}})['then'](respondWithResult(_0x476645,null))[_0x5e1b('0x2f')](handleError(_0x476645,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 80e3ed6..efc98bb 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 _0x61fd=['save','emit','exports','events','SmsAccount','setMaxListeners'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x61fd,0xe7));var _0xd61f=function(_0xad08b3,_0x2a3003){_0xad08b3=_0xad08b3-0x0;var _0xb6c9b6=_0x61fd[_0xad08b3];return _0xb6c9b6;};'use strict';var EventEmitter=require(_0xd61f('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xd61f('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd61f('0x2')](0x0);var events={'afterCreate':_0xd61f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x114d3f){return function(_0x583440,_0x2b7f3b,_0x50e3c3){SmsAccountEvents[_0xd61f('0x4')](_0x114d3f+':'+_0x583440['id'],_0x583440);SmsAccountEvents[_0xd61f('0x4')](_0x114d3f,_0x583440);_0x50e3c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xd61f('0x5')]=SmsAccountEvents; \ No newline at end of file +var _0x4b2d=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x388b0e,_0x570ae9){var _0x4c1712=function(_0x4146f1){while(--_0x4146f1){_0x388b0e['push'](_0x388b0e['shift']());}};_0x4c1712(++_0x570ae9);}(_0x4b2d,0x175));var _0xd4b2=function(_0x16ed87,_0x1be1a2){_0x16ed87=_0x16ed87-0x0;var _0xc1a1d8=_0x4b2d[_0x16ed87];return _0xc1a1d8;};'use strict';var EventEmitter=require(_0xd4b2('0x0'));var SmsAccount=require(_0xd4b2('0x1'))['db'][_0xd4b2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd4b2('0x3')](0x0);var events={'afterCreate':_0xd4b2('0x4'),'afterUpdate':_0xd4b2('0x5'),'afterDestroy':_0xd4b2('0x6')};function emitEvent(_0x3eeba4){return function(_0x38c379,_0x4da747,_0x287fee){SmsAccountEvents['emit'](_0x3eeba4+':'+_0x38c379['id'],_0x38c379);SmsAccountEvents[_0xd4b2('0x7')](_0x3eeba4,_0x38c379);_0x287fee(null);};}for(var e in events){if(events[_0xd4b2('0x8')](e)){var event=events[e];SmsAccount[_0xd4b2('0x9')](e,emitEvent(event));}}module[_0xd4b2('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 035ed92..ab507de 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 _0xd8d4=['moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash'];(function(_0x1b0eb6,_0x172eb4){var _0x454834=function(_0x75a5d8){while(--_0x75a5d8){_0x1b0eb6['push'](_0x1b0eb6['shift']());}};_0x454834(++_0x172eb4);}(_0xd8d4,0x135));var _0x4d8d=function(_0x450faa,_0x18a5b7){_0x450faa=_0x450faa-0x0;var _0x15853e=_0xd8d4[_0x450faa];return _0x15853e;};'use strict';var _=require(_0x4d8d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4d8d('0x1'));var BPromise=require(_0x4d8d('0x2'));var rp=require(_0x4d8d('0x3'));var fs=require('fs');var path=require(_0x4d8d('0x4'));var rimraf=require('rimraf');var config=require(_0x4d8d('0x5'));var attributes=require(_0x4d8d('0x6'));module[_0x4d8d('0x7')]=function(_0x30d6fc,_0x41719c){return _0x30d6fc[_0x4d8d('0x8')]('SmsAccount',attributes,{'tableName':_0x4d8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90cf=['../../config/environment','./smsAccount.attributes','exports','sms_accounts','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x5df41c,_0x2eeb77){var _0x5c1a7b=function(_0x57da66){while(--_0x57da66){_0x5df41c['push'](_0x5df41c['shift']());}};_0x5c1a7b(++_0x2eeb77);}(_0x90cf,0xca));var _0xf90c=function(_0x50b1e2,_0x47b053){_0x50b1e2=_0x50b1e2-0x0;var _0x3a7c5c=_0x90cf[_0x50b1e2];return _0x3a7c5c;};'use strict';var _=require(_0xf90c('0x0'));var util=require(_0xf90c('0x1'));var logger=require('../../config/logger')(_0xf90c('0x2'));var moment=require(_0xf90c('0x3'));var BPromise=require(_0xf90c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf90c('0x5'));var rimraf=require(_0xf90c('0x6'));var config=require(_0xf90c('0x7'));var attributes=require(_0xf90c('0x8'));module[_0xf90c('0x9')]=function(_0x37b084,_0x156ca9){return _0x37b084['define']('SmsAccount',attributes,{'tableName':_0xf90c('0xa'),'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 2c1c32b..71165ff 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 _0xe1fc=['catch','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe1fc,0x1ec));var _0xce1f=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0xe1fc[_0x3dc68d];return _0xdf7f94;};'use strict';var _=require('lodash');var util=require(_0xce1f('0x0'));var moment=require(_0xce1f('0x1'));var BPromise=require(_0xce1f('0x2'));var rs=require(_0xce1f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce1f('0x4'))['db'];var utils=require(_0xce1f('0x5'));var logger=require(_0xce1f('0x6'))(_0xce1f('0x7'));var config=require(_0xce1f('0x8'));var jayson=require(_0xce1f('0x9'));var client=jayson[_0xce1f('0xa')][_0xce1f('0xb')]({'port':0x232a});config[_0xce1f('0xc')]=_[_0xce1f('0xd')](config[_0xce1f('0xc')],{'host':_0xce1f('0xe'),'port':0x18eb});var socket=require(_0xce1f('0xf'))(new Redis(config[_0xce1f('0xc')]));require(_0xce1f('0x10'))['register'](socket);function respondWithRpcPromise(_0x255d0f,_0x12d69f,_0x50b27f){return new BPromise(function(_0xf69345,_0x24cfc4){return client[_0xce1f('0x11')](_0x255d0f,_0x50b27f)['then'](function(_0x57926e){logger[_0xce1f('0x12')](_0xce1f('0x13'),_0x12d69f,'request\x20sent');logger[_0xce1f('0x14')](_0xce1f('0x15'),_0x12d69f,'request\x20sent',JSON['stringify'](_0x57926e));if(_0x57926e[_0xce1f('0x16')]){if(_0x57926e[_0xce1f('0x16')]['code']===0x1f4){logger[_0xce1f('0x16')]('SmsAccount,\x20%s,\x20%s',_0x12d69f,_0x57926e[_0xce1f('0x16')][_0xce1f('0x17')]);return _0x24cfc4(_0x57926e[_0xce1f('0x16')][_0xce1f('0x17')]);}logger[_0xce1f('0x16')](_0xce1f('0x13'),_0x12d69f,_0x57926e[_0xce1f('0x16')][_0xce1f('0x17')]);return _0xf69345(_0x57926e[_0xce1f('0x16')][_0xce1f('0x17')]);}else{logger[_0xce1f('0x12')](_0xce1f('0x13'),_0x12d69f,_0xce1f('0x18'));_0xf69345(_0x57926e[_0xce1f('0x19')]['message']);}})[_0xce1f('0x1a')](function(_0x5d883d){logger[_0xce1f('0x16')]('SmsAccount,\x20%s,\x20%s',_0x12d69f,_0x5d883d);_0x24cfc4(_0x5d883d);});});}exports[_0xce1f('0x1b')]=function(_0x37accd){var _0x4de5f7=this;return new Promise(function(_0x5bb34c,_0x10c6da){return db['SmsAccount'][_0xce1f('0x1c')]({'raw':_0x37accd[_0xce1f('0x1d')]?_0x37accd['options'][_0xce1f('0x1e')]===undefined?!![]:![]:!![],'where':_0x37accd[_0xce1f('0x1d')]?_0x37accd[_0xce1f('0x1d')][_0xce1f('0x1f')]||null:null,'attributes':_0x37accd[_0xce1f('0x1d')]?_0x37accd[_0xce1f('0x1d')][_0xce1f('0x20')]||null:null,'include':_0x37accd[_0xce1f('0x1d')]?_0x37accd[_0xce1f('0x1d')][_0xce1f('0x21')]?_[_0xce1f('0x22')](_0x37accd['options'][_0xce1f('0x21')],function(_0x56cbb8){return{'model':db[_0x56cbb8[_0xce1f('0x23')]],'as':_0x56cbb8['as'],'attributes':_0x56cbb8[_0xce1f('0x20')],'include':_0x56cbb8[_0xce1f('0x21')]?_[_0xce1f('0x22')](_0x56cbb8[_0xce1f('0x21')],function(_0x4c9ab8){return{'model':db[_0x4c9ab8['model']],'as':_0x4c9ab8['as'],'attributes':_0x4c9ab8[_0xce1f('0x20')],'include':_0x4c9ab8[_0xce1f('0x21')]?_['map'](_0x4c9ab8['include'],function(_0x655412){return{'model':db[_0x655412['model']],'as':_0x655412['as'],'attributes':_0x655412[_0xce1f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xce1f('0x24')](function(_0x2150de){logger['info'](_0xce1f('0x1b'),_0x37accd);logger['debug'](_0xce1f('0x1b'),_0x37accd,JSON['stringify'](_0x2150de));_0x5bb34c(_0x2150de);})[_0xce1f('0x1a')](function(_0x440274){logger[_0xce1f('0x16')](_0xce1f('0x1b'),_0x440274[_0xce1f('0x17')],_0x37accd);_0x10c6da(_0x4de5f7[_0xce1f('0x16')](0x1f4,_0x440274[_0xce1f('0x17')]));});});}; \ No newline at end of file +var _0x6b7c=['ShowSmsAccount','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','options','raw','attributes','include','map','model'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x6b7c,0x1e1));var _0xc6b7=function(_0x3758dd,_0x3608b9){_0x3758dd=_0x3758dd-0x0;var _0x16ba2f=_0x6b7c[_0x3758dd];return _0x16ba2f;};'use strict';var _=require('lodash');var util=require(_0xc6b7('0x0'));var moment=require('moment');var BPromise=require(_0xc6b7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6b7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6b7('0x3'));var logger=require('../../config/logger')(_0xc6b7('0x4'));var config=require(_0xc6b7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc6b7('0x6')][_0xc6b7('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc6b7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6b7('0x9'))(new Redis(config[_0xc6b7('0x8')]));require(_0xc6b7('0xa'))[_0xc6b7('0xb')](socket);function respondWithRpcPromise(_0x144165,_0x28e7ac,_0xc00c6f){return new BPromise(function(_0x24ef34,_0x5bb098){return client['request'](_0x144165,_0xc00c6f)[_0xc6b7('0xc')](function(_0x54d551){logger['info'](_0xc6b7('0xd'),_0x28e7ac,_0xc6b7('0xe'));logger[_0xc6b7('0xf')](_0xc6b7('0x10'),_0x28e7ac,_0xc6b7('0xe'),JSON[_0xc6b7('0x11')](_0x54d551));if(_0x54d551[_0xc6b7('0x12')]){if(_0x54d551['error'][_0xc6b7('0x13')]===0x1f4){logger['error'](_0xc6b7('0xd'),_0x28e7ac,_0x54d551[_0xc6b7('0x12')][_0xc6b7('0x14')]);return _0x5bb098(_0x54d551[_0xc6b7('0x12')]['message']);}logger[_0xc6b7('0x12')]('SmsAccount,\x20%s,\x20%s',_0x28e7ac,_0x54d551['error'][_0xc6b7('0x14')]);return _0x24ef34(_0x54d551[_0xc6b7('0x12')][_0xc6b7('0x14')]);}else{logger[_0xc6b7('0x15')](_0xc6b7('0xd'),_0x28e7ac,_0xc6b7('0xe'));_0x24ef34(_0x54d551['result']['message']);}})[_0xc6b7('0x16')](function(_0x2360a6){logger[_0xc6b7('0x12')](_0xc6b7('0xd'),_0x28e7ac,_0x2360a6);_0x5bb098(_0x2360a6);});});}exports['ShowSmsAccount']=function(_0x8cd5a8){var _0x46f88d=this;return new Promise(function(_0x259781,_0x1d74fe){return db['SmsAccount']['find']({'raw':_0x8cd5a8[_0xc6b7('0x17')]?_0x8cd5a8[_0xc6b7('0x17')][_0xc6b7('0x18')]===undefined?!![]:![]:!![],'where':_0x8cd5a8['options']?_0x8cd5a8[_0xc6b7('0x17')]['where']||null:null,'attributes':_0x8cd5a8[_0xc6b7('0x17')]?_0x8cd5a8[_0xc6b7('0x17')][_0xc6b7('0x19')]||null:null,'include':_0x8cd5a8[_0xc6b7('0x17')]?_0x8cd5a8[_0xc6b7('0x17')][_0xc6b7('0x1a')]?_[_0xc6b7('0x1b')](_0x8cd5a8['options'][_0xc6b7('0x1a')],function(_0x50528e){return{'model':db[_0x50528e[_0xc6b7('0x1c')]],'as':_0x50528e['as'],'attributes':_0x50528e['attributes'],'include':_0x50528e[_0xc6b7('0x1a')]?_[_0xc6b7('0x1b')](_0x50528e[_0xc6b7('0x1a')],function(_0x61fe02){return{'model':db[_0x61fe02['model']],'as':_0x61fe02['as'],'attributes':_0x61fe02['attributes'],'include':_0x61fe02[_0xc6b7('0x1a')]?_[_0xc6b7('0x1b')](_0x61fe02[_0xc6b7('0x1a')],function(_0x5a2fe2){return{'model':db[_0x5a2fe2['model']],'as':_0x5a2fe2['as'],'attributes':_0x5a2fe2['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6b7('0xc')](function(_0x2c9716){logger[_0xc6b7('0x15')](_0xc6b7('0x1d'),_0x8cd5a8);logger[_0xc6b7('0xf')]('ShowSmsAccount',_0x8cd5a8,JSON[_0xc6b7('0x11')](_0x2c9716));_0x259781(_0x2c9716);})['catch'](function(_0x463a96){logger['error'](_0xc6b7('0x1d'),_0x463a96['message'],_0x8cd5a8);_0x1d74fe(_0x46f88d[_0xc6b7('0x12')](0x1f4,_0x463a96[_0xc6b7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 658f7c7..74cf8ff 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 d5585fb..c829a78 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x52697c,_0x4ee005){var _0x3b4860=function(_0x434b50){while(--_0x434b50){_0x52697c['push'](_0x52697c['shift']());}};_0x3b4860(++_0x4ee005);}(_0x008c,0x188));var _0xc008=function(_0x4d0d2d,_0x4b4ca1){_0x4d0d2d=_0x4d0d2d-0x0;var _0x1e1a80=_0x008c[_0x4d0d2d];return _0x1e1a80;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x1bb030,_0x27d05f){var _0x28ef4f=function(_0xb1150e){while(--_0xb1150e){_0x1bb030['push'](_0x1bb030['shift']());}};_0x28ef4f(++_0x27d05f);}(_0x3e74,0x175));var _0x43e7=function(_0x2cb76b,_0x5362d5){_0x2cb76b=_0x2cb76b-0x0;var _0x4c08e4=_0x3e74[_0x2cb76b];return _0x4c08e4;};'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('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 3553403..a88cdb6 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 _0x46bf=['STRING','noop','*,*,*,*'];(function(_0x10197f,_0x5912b6){var _0xfdf813=function(_0x52de02){while(--_0x52de02){_0x10197f['push'](_0x10197f['shift']());}};_0xfdf813(++_0x5912b6);}(_0x46bf,0xcf));var _0xf46b=function(_0x3ef8f7,_0x35359a){_0x3ef8f7=_0x3ef8f7-0x0;var _0x3b097e=_0x46bf[_0x3ef8f7];return _0x3b097e;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf46b('0x0')],'allowNull':![],'defaultValue':_0xf46b('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf46b('0x0')],'defaultValue':_0xf46b('0x2')}}; \ No newline at end of file +var _0x4c0e=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x2490ba,_0x517591){var _0x1097a2=function(_0x31f20e){while(--_0x31f20e){_0x2490ba['push'](_0x2490ba['shift']());}};_0x1097a2(++_0x517591);}(_0x4c0e,0x169));var _0xe4c0=function(_0x492221,_0x9e2521){_0x492221=_0x492221-0x0;var _0x398bf9=_0x4c0e[_0x492221];return _0x398bf9;};'use strict';var Sequelize=require(_0xe4c0('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe4c0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe4c0('0x2')],'allowNull':![],'defaultValue':_0xe4c0('0x3')},'appdata':{'type':Sequelize[_0xe4c0('0x4')]()},'description':{'type':Sequelize[_0xe4c0('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe4c0('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index deac53b..e7f4a34 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 _0xe835=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','query','filters','intersection','fields','attributes','length','model','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','SmsApplication','findAll','rows','show','params','keys','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0xe835,0x126));var _0x5e83=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xe835[_0x4ae829];return _0x256b31;};'use strict';var emlformat=require(_0x5e83('0x0'));var rimraf=require(_0x5e83('0x1'));var zipdir=require(_0x5e83('0x2'));var jsonpatch=require(_0x5e83('0x3'));var rp=require(_0x5e83('0x4'));var moment=require(_0x5e83('0x5'));var BPromise=require(_0x5e83('0x6'));var Mustache=require(_0x5e83('0x7'));var util=require('util');var path=require(_0x5e83('0x8'));var sox=require('sox');var csv=require(_0x5e83('0x9'));var ejs=require(_0x5e83('0xa'));var fs=require('fs');var fs_extra=require(_0x5e83('0xb'));var _=require(_0x5e83('0xc'));var squel=require('squel');var crypto=require(_0x5e83('0xd'));var jsforce=require(_0x5e83('0xe'));var deskjs=require(_0x5e83('0xf'));var toCsv=require(_0x5e83('0x9'));var querystring=require(_0x5e83('0x10'));var Papa=require(_0x5e83('0x11'));var Redis=require(_0x5e83('0x12'));var authService=require(_0x5e83('0x13'));var qs=require(_0x5e83('0x14'));var as=require(_0x5e83('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e83('0x16'))(_0x5e83('0x17'));var utils=require(_0x5e83('0x18'));var config=require(_0x5e83('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e83('0x1a'))['db'];function respondWithStatusCode(_0x5b58b9,_0x2bd999){_0x2bd999=_0x2bd999||0xcc;return function(_0x115751){if(_0x115751){return _0x5b58b9['sendStatus'](_0x2bd999);}return _0x5b58b9[_0x5e83('0x1b')](_0x2bd999)[_0x5e83('0x1c')]();};}function respondWithResult(_0x45e257,_0x554c47){_0x554c47=_0x554c47||0xc8;return function(_0x8e8763){if(_0x8e8763){return _0x45e257[_0x5e83('0x1b')](_0x554c47)['json'](_0x8e8763);}};}function respondWithFilteredResult(_0x31d877,_0x51c856){return function(_0x2535f4){if(_0x2535f4){var _0xdaeb54=typeof _0x51c856['offset']===_0x5e83('0x1d')&&typeof _0x51c856['limit']===_0x5e83('0x1d');var _0x1c9fd1=_0x2535f4[_0x5e83('0x1e')];var _0xaf044f=_0xdaeb54?0x0:_0x51c856['offset'];var _0x84b503=_0xdaeb54?_0x2535f4['count']:_0x51c856[_0x5e83('0x1f')]+_0x51c856[_0x5e83('0x20')];var _0x190067;if(_0x84b503>=_0x1c9fd1){_0x84b503=_0x1c9fd1;_0x190067=0xc8;}else{_0x190067=0xce;}_0x31d877[_0x5e83('0x1b')](_0x190067);return _0x31d877[_0x5e83('0x21')](_0x5e83('0x22'),_0xaf044f+'-'+_0x84b503+'/'+_0x1c9fd1)[_0x5e83('0x23')](_0x2535f4);}return null;};}function patchUpdates(_0x3b8e0f){return function(_0xfa0e8c){try{jsonpatch[_0x5e83('0x24')](_0xfa0e8c,_0x3b8e0f,!![]);}catch(_0x51adea){return BPromise[_0x5e83('0x25')](_0x51adea);}return _0xfa0e8c[_0x5e83('0x26')]();};}function saveUpdates(_0x35b1d6,_0x3cb3e9){return function(_0x27d635){if(_0x27d635){return _0x27d635[_0x5e83('0x27')](_0x35b1d6)[_0x5e83('0x28')](function(_0xce3336){return _0xce3336;});}return null;};}function removeEntity(_0x353669,_0x343f67){return function(_0x2b54a3){if(_0x2b54a3){return _0x2b54a3[_0x5e83('0x29')]()[_0x5e83('0x28')](function(){_0x353669['status'](0xcc)[_0x5e83('0x1c')]();});}};}function handleEntityNotFound(_0x5bdc91,_0x398a4a){return function(_0x3b5e8c){if(!_0x3b5e8c){_0x5bdc91[_0x5e83('0x2a')](0x194);}return _0x3b5e8c;};}function handleError(_0x492197,_0x105494){_0x105494=_0x105494||0x1f4;return function(_0x671e76){logger['error'](_0x671e76[_0x5e83('0x2b')]);if(_0x671e76['name']){delete _0x671e76[_0x5e83('0x2c')];}_0x492197['status'](_0x105494)[_0x5e83('0x2d')](_0x671e76);};}exports[_0x5e83('0x2e')]=function(_0x20e985,_0x27ebb1){var _0x12c895={},_0x3489c7={},_0x131a2c={'count':0x0,'rows':[]};var _0x5b4768=_[_0x5e83('0x2f')](db['SmsApplication'][_0x5e83('0x30')],function(_0x272dd5){return{'name':_0x272dd5['fieldName'],'type':_0x272dd5[_0x5e83('0x31')]['key']};});_0x3489c7['model']=_[_0x5e83('0x2f')](_0x5b4768,'name');_0x3489c7[_0x5e83('0x32')]=_['keys'](_0x20e985[_0x5e83('0x32')]);_0x3489c7[_0x5e83('0x33')]=_[_0x5e83('0x34')](_0x3489c7['model'],_0x3489c7['query']);_0x12c895['attributes']=_[_0x5e83('0x34')](_0x3489c7['model'],qs['fields'](_0x20e985[_0x5e83('0x32')][_0x5e83('0x35')]));_0x12c895[_0x5e83('0x36')]=_0x12c895[_0x5e83('0x36')][_0x5e83('0x37')]?_0x12c895[_0x5e83('0x36')]:_0x3489c7[_0x5e83('0x38')];if(!_0x20e985[_0x5e83('0x32')]['hasOwnProperty'](_0x5e83('0x39'))){_0x12c895[_0x5e83('0x20')]=qs[_0x5e83('0x20')](_0x20e985['query'][_0x5e83('0x20')]);_0x12c895[_0x5e83('0x1f')]=qs[_0x5e83('0x1f')](_0x20e985[_0x5e83('0x32')][_0x5e83('0x1f')]);}_0x12c895[_0x5e83('0x3a')]=qs[_0x5e83('0x3b')](_0x20e985['query'][_0x5e83('0x3b')]);_0x12c895['where']=qs[_0x5e83('0x33')](_['pick'](_0x20e985[_0x5e83('0x32')],_0x3489c7[_0x5e83('0x33')]),_0x5b4768);if(_0x20e985[_0x5e83('0x32')][_0x5e83('0x3c')]){_0x12c895[_0x5e83('0x3d')]=_['merge'](_0x12c895[_0x5e83('0x3d')],{'$or':_['map'](_0x5b4768,function(_0x489438){if(_0x489438[_0x5e83('0x31')]!==_0x5e83('0x3e')){var _0xe2d10f={};_0xe2d10f[_0x489438[_0x5e83('0x2c')]]={'$like':'%'+_0x20e985[_0x5e83('0x32')][_0x5e83('0x3c')]+'%'};return _0xe2d10f;}})});}_0x12c895=_['merge']({},_0x12c895,_0x20e985[_0x5e83('0x3f')]);var _0xea062c={'where':_0x12c895[_0x5e83('0x3d')]};return db['SmsApplication'][_0x5e83('0x1e')](_0xea062c)[_0x5e83('0x28')](function(_0x181bf8){_0x131a2c[_0x5e83('0x1e')]=_0x181bf8;if(_0x20e985['query'][_0x5e83('0x40')]){_0x12c895['include']=[{'all':!![]}];}return db[_0x5e83('0x41')][_0x5e83('0x42')](_0x12c895);})[_0x5e83('0x28')](function(_0x50e27b){_0x131a2c[_0x5e83('0x43')]=_0x50e27b;return _0x131a2c;})[_0x5e83('0x28')](respondWithFilteredResult(_0x27ebb1,_0x12c895))['catch'](handleError(_0x27ebb1,null));};exports[_0x5e83('0x44')]=function(_0x4ebcd5,_0x4580fc){var _0x181b97={'raw':!![],'where':{'id':_0x4ebcd5[_0x5e83('0x45')]['id']}},_0x459d22={};_0x459d22[_0x5e83('0x38')]=_['keys'](db[_0x5e83('0x41')]['rawAttributes']);_0x459d22[_0x5e83('0x32')]=_[_0x5e83('0x46')](_0x4ebcd5[_0x5e83('0x32')]);_0x459d22[_0x5e83('0x33')]=_['intersection'](_0x459d22[_0x5e83('0x38')],_0x459d22['query']);_0x181b97[_0x5e83('0x36')]=_[_0x5e83('0x34')](_0x459d22['model'],qs[_0x5e83('0x35')](_0x4ebcd5[_0x5e83('0x32')][_0x5e83('0x35')]));_0x181b97[_0x5e83('0x36')]=_0x181b97[_0x5e83('0x36')][_0x5e83('0x37')]?_0x181b97[_0x5e83('0x36')]:_0x459d22[_0x5e83('0x38')];if(_0x4ebcd5[_0x5e83('0x32')]['includeAll']){_0x181b97[_0x5e83('0x47')]=[{'all':!![]}];}_0x181b97=_['merge']({},_0x181b97,_0x4ebcd5[_0x5e83('0x3f')]);return db[_0x5e83('0x41')][_0x5e83('0x48')](_0x181b97)[_0x5e83('0x28')](handleEntityNotFound(_0x4580fc,null))[_0x5e83('0x28')](respondWithResult(_0x4580fc,null))[_0x5e83('0x49')](handleError(_0x4580fc,null));};exports['create']=function(_0x3e4bf5,_0x545660){return db[_0x5e83('0x41')][_0x5e83('0x4a')](_0x3e4bf5[_0x5e83('0x4b')],{})[_0x5e83('0x28')](respondWithResult(_0x545660,0xc9))[_0x5e83('0x49')](handleError(_0x545660,null));};exports[_0x5e83('0x27')]=function(_0x21467b,_0x48da9a){if(_0x21467b[_0x5e83('0x4b')]['id']){delete _0x21467b[_0x5e83('0x4b')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x21467b[_0x5e83('0x45')]['id']}})[_0x5e83('0x28')](handleEntityNotFound(_0x48da9a,null))[_0x5e83('0x28')](saveUpdates(_0x21467b['body'],null))['then'](respondWithResult(_0x48da9a,null))[_0x5e83('0x49')](handleError(_0x48da9a,null));};exports[_0x5e83('0x29')]=function(_0x286267,_0xa2b37d){return db['SmsApplication'][_0x5e83('0x48')]({'where':{'id':_0x286267[_0x5e83('0x45')]['id']}})[_0x5e83('0x28')](handleEntityNotFound(_0xa2b37d,null))[_0x5e83('0x28')](removeEntity(_0xa2b37d,null))[_0x5e83('0x49')](handleError(_0xa2b37d,null));}; \ No newline at end of file +var _0x1e9e=['fieldName','type','key','keys','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','rawAttributes'];(function(_0x32c738,_0x399e3b){var _0x3572a8=function(_0x354e8a){while(--_0x354e8a){_0x32c738['push'](_0x32c738['shift']());}};_0x3572a8(++_0x399e3b);}(_0x1e9e,0x69));var _0xe1e9=function(_0x583355,_0x187405){_0x583355=_0x583355-0x0;var _0x3c6561=_0x1e9e[_0x583355];return _0x3c6561;};'use strict';var emlformat=require(_0xe1e9('0x0'));var rimraf=require(_0xe1e9('0x1'));var zipdir=require(_0xe1e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1e9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe1e9('0x4'));var util=require(_0xe1e9('0x5'));var path=require(_0xe1e9('0x6'));var sox=require(_0xe1e9('0x7'));var csv=require(_0xe1e9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe1e9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe1e9('0xa'));var jsforce=require(_0xe1e9('0xb'));var deskjs=require(_0xe1e9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe1e9('0xd'));var Papa=require(_0xe1e9('0xe'));var Redis=require(_0xe1e9('0xf'));var authService=require(_0xe1e9('0x10'));var qs=require(_0xe1e9('0x11'));var as=require(_0xe1e9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1e9('0x13'))('api');var utils=require(_0xe1e9('0x14'));var config=require(_0xe1e9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe1e9('0x16'))['db'];function respondWithStatusCode(_0x41dd98,_0x1ffe23){_0x1ffe23=_0x1ffe23||0xcc;return function(_0x4f497f){if(_0x4f497f){return _0x41dd98['sendStatus'](_0x1ffe23);}return _0x41dd98[_0xe1e9('0x17')](_0x1ffe23)['end']();};}function respondWithResult(_0x4b0e62,_0xb5d126){_0xb5d126=_0xb5d126||0xc8;return function(_0x143c63){if(_0x143c63){return _0x4b0e62[_0xe1e9('0x17')](_0xb5d126)[_0xe1e9('0x18')](_0x143c63);}};}function respondWithFilteredResult(_0x52e528,_0x527834){return function(_0x4e1904){if(_0x4e1904){var _0x40baca=typeof _0x527834['offset']==='undefined'&&typeof _0x527834[_0xe1e9('0x19')]===_0xe1e9('0x1a');var _0x2609b0=_0x4e1904[_0xe1e9('0x1b')];var _0x459f01=_0x40baca?0x0:_0x527834[_0xe1e9('0x1c')];var _0x2757b2=_0x40baca?_0x4e1904[_0xe1e9('0x1b')]:_0x527834['offset']+_0x527834[_0xe1e9('0x19')];var _0xc97406;if(_0x2757b2>=_0x2609b0){_0x2757b2=_0x2609b0;_0xc97406=0xc8;}else{_0xc97406=0xce;}_0x52e528['status'](_0xc97406);return _0x52e528[_0xe1e9('0x1d')](_0xe1e9('0x1e'),_0x459f01+'-'+_0x2757b2+'/'+_0x2609b0)[_0xe1e9('0x18')](_0x4e1904);}return null;};}function patchUpdates(_0x4477f8){return function(_0x411d20){try{jsonpatch[_0xe1e9('0x1f')](_0x411d20,_0x4477f8,!![]);}catch(_0x1b701b){return BPromise[_0xe1e9('0x20')](_0x1b701b);}return _0x411d20[_0xe1e9('0x21')]();};}function saveUpdates(_0x25d396,_0x56ca6e){return function(_0x1b48c5){if(_0x1b48c5){return _0x1b48c5[_0xe1e9('0x22')](_0x25d396)[_0xe1e9('0x23')](function(_0xfb6a6e){return _0xfb6a6e;});}return null;};}function removeEntity(_0x60b3c8,_0x2004d4){return function(_0x339745){if(_0x339745){return _0x339745[_0xe1e9('0x24')]()[_0xe1e9('0x23')](function(){_0x60b3c8[_0xe1e9('0x17')](0xcc)[_0xe1e9('0x25')]();});}};}function handleEntityNotFound(_0x72f9b6,_0x48fc32){return function(_0x3c0557){if(!_0x3c0557){_0x72f9b6[_0xe1e9('0x26')](0x194);}return _0x3c0557;};}function handleError(_0x264959,_0x237ce0){_0x237ce0=_0x237ce0||0x1f4;return function(_0x1a51a4){logger[_0xe1e9('0x27')](_0x1a51a4['stack']);if(_0x1a51a4['name']){delete _0x1a51a4[_0xe1e9('0x28')];}_0x264959[_0xe1e9('0x17')](_0x237ce0)[_0xe1e9('0x29')](_0x1a51a4);};}exports[_0xe1e9('0x2a')]=function(_0x1c4ab2,_0x3633dd){var _0x2971cd={},_0x14fc27={},_0x4a411c={'count':0x0,'rows':[]};var _0x443a51=_[_0xe1e9('0x2b')](db['SmsApplication'][_0xe1e9('0x2c')],function(_0x73eb19){return{'name':_0x73eb19[_0xe1e9('0x2d')],'type':_0x73eb19[_0xe1e9('0x2e')][_0xe1e9('0x2f')]};});_0x14fc27['model']=_['map'](_0x443a51,_0xe1e9('0x28'));_0x14fc27['query']=_[_0xe1e9('0x30')](_0x1c4ab2[_0xe1e9('0x31')]);_0x14fc27['filters']=_[_0xe1e9('0x32')](_0x14fc27['model'],_0x14fc27[_0xe1e9('0x31')]);_0x2971cd[_0xe1e9('0x33')]=_['intersection'](_0x14fc27[_0xe1e9('0x34')],qs['fields'](_0x1c4ab2[_0xe1e9('0x31')][_0xe1e9('0x35')]));_0x2971cd[_0xe1e9('0x33')]=_0x2971cd[_0xe1e9('0x33')][_0xe1e9('0x36')]?_0x2971cd['attributes']:_0x14fc27[_0xe1e9('0x34')];if(!_0x1c4ab2['query']['hasOwnProperty'](_0xe1e9('0x37'))){_0x2971cd[_0xe1e9('0x19')]=qs[_0xe1e9('0x19')](_0x1c4ab2[_0xe1e9('0x31')][_0xe1e9('0x19')]);_0x2971cd[_0xe1e9('0x1c')]=qs[_0xe1e9('0x1c')](_0x1c4ab2[_0xe1e9('0x31')][_0xe1e9('0x1c')]);}_0x2971cd[_0xe1e9('0x38')]=qs[_0xe1e9('0x39')](_0x1c4ab2[_0xe1e9('0x31')][_0xe1e9('0x39')]);_0x2971cd[_0xe1e9('0x3a')]=qs[_0xe1e9('0x3b')](_[_0xe1e9('0x3c')](_0x1c4ab2['query'],_0x14fc27['filters']),_0x443a51);if(_0x1c4ab2['query']['filter']){_0x2971cd[_0xe1e9('0x3a')]=_[_0xe1e9('0x3d')](_0x2971cd[_0xe1e9('0x3a')],{'$or':_[_0xe1e9('0x2b')](_0x443a51,function(_0x211fc7){if(_0x211fc7['type']!==_0xe1e9('0x3e')){var _0x3ac357={};_0x3ac357[_0x211fc7[_0xe1e9('0x28')]]={'$like':'%'+_0x1c4ab2[_0xe1e9('0x31')]['filter']+'%'};return _0x3ac357;}})});}_0x2971cd=_[_0xe1e9('0x3d')]({},_0x2971cd,_0x1c4ab2[_0xe1e9('0x3f')]);var _0x4f2236={'where':_0x2971cd[_0xe1e9('0x3a')]};return db[_0xe1e9('0x40')][_0xe1e9('0x1b')](_0x4f2236)[_0xe1e9('0x23')](function(_0x36218d){_0x4a411c[_0xe1e9('0x1b')]=_0x36218d;if(_0x1c4ab2[_0xe1e9('0x31')][_0xe1e9('0x41')]){_0x2971cd[_0xe1e9('0x42')]=[{'all':!![]}];}return db[_0xe1e9('0x40')][_0xe1e9('0x43')](_0x2971cd);})[_0xe1e9('0x23')](function(_0x4b815e){_0x4a411c[_0xe1e9('0x44')]=_0x4b815e;return _0x4a411c;})['then'](respondWithFilteredResult(_0x3633dd,_0x2971cd))['catch'](handleError(_0x3633dd,null));};exports[_0xe1e9('0x45')]=function(_0x1209c8,_0x56b4c6){var _0xf5d7ac={'raw':!![],'where':{'id':_0x1209c8[_0xe1e9('0x46')]['id']}},_0x614e3f={};_0x614e3f[_0xe1e9('0x34')]=_['keys'](db[_0xe1e9('0x40')][_0xe1e9('0x2c')]);_0x614e3f[_0xe1e9('0x31')]=_['keys'](_0x1209c8[_0xe1e9('0x31')]);_0x614e3f[_0xe1e9('0x3b')]=_['intersection'](_0x614e3f['model'],_0x614e3f[_0xe1e9('0x31')]);_0xf5d7ac[_0xe1e9('0x33')]=_[_0xe1e9('0x32')](_0x614e3f[_0xe1e9('0x34')],qs[_0xe1e9('0x35')](_0x1209c8['query']['fields']));_0xf5d7ac['attributes']=_0xf5d7ac[_0xe1e9('0x33')][_0xe1e9('0x36')]?_0xf5d7ac['attributes']:_0x614e3f[_0xe1e9('0x34')];if(_0x1209c8[_0xe1e9('0x31')]['includeAll']){_0xf5d7ac[_0xe1e9('0x42')]=[{'all':!![]}];}_0xf5d7ac=_['merge']({},_0xf5d7ac,_0x1209c8[_0xe1e9('0x3f')]);return db[_0xe1e9('0x40')][_0xe1e9('0x47')](_0xf5d7ac)[_0xe1e9('0x23')](handleEntityNotFound(_0x56b4c6,null))[_0xe1e9('0x23')](respondWithResult(_0x56b4c6,null))[_0xe1e9('0x48')](handleError(_0x56b4c6,null));};exports[_0xe1e9('0x49')]=function(_0x27ee68,_0x395844){return db[_0xe1e9('0x40')][_0xe1e9('0x49')](_0x27ee68[_0xe1e9('0x4a')],{})[_0xe1e9('0x23')](respondWithResult(_0x395844,0xc9))[_0xe1e9('0x48')](handleError(_0x395844,null));};exports['update']=function(_0x12e96c,_0xa7742e){if(_0x12e96c[_0xe1e9('0x4a')]['id']){delete _0x12e96c[_0xe1e9('0x4a')]['id'];}return db['SmsApplication'][_0xe1e9('0x47')]({'where':{'id':_0x12e96c[_0xe1e9('0x46')]['id']}})[_0xe1e9('0x23')](handleEntityNotFound(_0xa7742e,null))[_0xe1e9('0x23')](saveUpdates(_0x12e96c[_0xe1e9('0x4a')],null))[_0xe1e9('0x23')](respondWithResult(_0xa7742e,null))[_0xe1e9('0x48')](handleError(_0xa7742e,null));};exports[_0xe1e9('0x24')]=function(_0x53f4ed,_0x3fd26d){return db['SmsApplication'][_0xe1e9('0x47')]({'where':{'id':_0x53f4ed[_0xe1e9('0x46')]['id']}})[_0xe1e9('0x23')](handleEntityNotFound(_0x3fd26d,null))[_0xe1e9('0x23')](removeEntity(_0x3fd26d,null))[_0xe1e9('0x48')](handleError(_0x3fd26d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c536690..0d7ba9d 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 _0xe7fb=['utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4'];(function(_0x5b3ab0,_0x39aa94){var _0x55fb9b=function(_0xf9dcd8){while(--_0xf9dcd8){_0x5b3ab0['push'](_0x5b3ab0['shift']());}};_0x55fb9b(++_0x39aa94);}(_0xe7fb,0xa1));var _0xbe7f=function(_0x5dc49e,_0x5a243f){_0x5dc49e=_0x5dc49e-0x0;var _0x3363f1=_0xe7fb[_0x5dc49e];return _0x3363f1;};'use strict';var _=require('lodash');var util=require(_0xbe7f('0x0'));var logger=require(_0xbe7f('0x1'))(_0xbe7f('0x2'));var moment=require('moment');var BPromise=require(_0xbe7f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbe7f('0x4'));var attributes=require(_0xbe7f('0x5'));module['exports']=function(_0x2be9ab,_0x23f603){return _0x2be9ab['define'](_0xbe7f('0x6'),attributes,{'tableName':_0xbe7f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe7f('0x8'),'collate':_0xbe7f('0x9')});}; \ No newline at end of file +var _0x468a=['rimraf','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','path'];(function(_0x234ce7,_0x3e909c){var _0x57c561=function(_0x8ac1bb){while(--_0x8ac1bb){_0x234ce7['push'](_0x234ce7['shift']());}};_0x57c561(++_0x3e909c);}(_0x468a,0x13b));var _0xa468=function(_0x2efa92,_0x2557f6){_0x2efa92=_0x2efa92-0x0;var _0x32704b=_0x468a[_0x2efa92];return _0x32704b;};'use strict';var _=require('lodash');var util=require(_0xa468('0x0'));var logger=require('../../config/logger')(_0xa468('0x1'));var moment=require('moment');var BPromise=require(_0xa468('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa468('0x3'));var rimraf=require(_0xa468('0x4'));var config=require('../../config/environment');var attributes=require(_0xa468('0x5'));module['exports']=function(_0x5c7646,_0x3220f3){return _0x5c7646[_0xa468('0x6')](_0xa468('0x7'),attributes,{'tableName':_0xa468('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa468('0x9'),'collate':_0xa468('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index aaa3b8e..90c91a3 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 _0xbc87=['stringify','error','code','message','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x16c91a,_0x1e6eb6){var _0x885b98=function(_0x1cb353){while(--_0x1cb353){_0x16c91a['push'](_0x16c91a['shift']());}};_0x885b98(++_0x1e6eb6);}(_0xbc87,0x144));var _0x7bc8=function(_0x8a9104,_0x362d20){_0x8a9104=_0x8a9104-0x0;var _0x3401db=_0xbc87[_0x8a9104];return _0x3401db;};'use strict';var _=require(_0x7bc8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7bc8('0x1'));var rs=require(_0x7bc8('0x2'));var fs=require('fs');var Redis=require(_0x7bc8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7bc8('0x4'))(_0x7bc8('0x5'));var config=require(_0x7bc8('0x6'));var jayson=require(_0x7bc8('0x7'));var client=jayson[_0x7bc8('0x8')][_0x7bc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x410b95,_0x2e1d63,_0x1fcc43){return new BPromise(function(_0x466ed5,_0xb87048){return client[_0x7bc8('0xa')](_0x410b95,_0x1fcc43)[_0x7bc8('0xb')](function(_0x368899){logger[_0x7bc8('0xc')](_0x7bc8('0xd'),_0x2e1d63,_0x7bc8('0xe'));logger['debug'](_0x7bc8('0xf'),_0x2e1d63,'request\x20sent',JSON[_0x7bc8('0x10')](_0x368899));if(_0x368899[_0x7bc8('0x11')]){if(_0x368899[_0x7bc8('0x11')][_0x7bc8('0x12')]===0x1f4){logger[_0x7bc8('0x11')](_0x7bc8('0xd'),_0x2e1d63,_0x368899['error'][_0x7bc8('0x13')]);return _0xb87048(_0x368899[_0x7bc8('0x11')]['message']);}logger[_0x7bc8('0x11')]('SmsApplication,\x20%s,\x20%s',_0x2e1d63,_0x368899[_0x7bc8('0x11')][_0x7bc8('0x13')]);return _0x466ed5(_0x368899[_0x7bc8('0x11')][_0x7bc8('0x13')]);}else{logger[_0x7bc8('0xc')]('SmsApplication,\x20%s,\x20%s',_0x2e1d63,_0x7bc8('0xe'));_0x466ed5(_0x368899['result'][_0x7bc8('0x13')]);}})['catch'](function(_0x455f9a){logger[_0x7bc8('0x11')](_0x7bc8('0xd'),_0x2e1d63,_0x455f9a);_0xb87048(_0x455f9a);});});} \ No newline at end of file +var _0x27c8=['code','SmsApplication,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5ec544,_0x31a0c5){var _0x15d14e=function(_0x2435bf){while(--_0x2435bf){_0x5ec544['push'](_0x5ec544['shift']());}};_0x15d14e(++_0x31a0c5);}(_0x27c8,0x6a));var _0x827c=function(_0xbc1cd,_0x171c7c){_0xbc1cd=_0xbc1cd-0x0;var _0x1cbe02=_0x27c8[_0xbc1cd];return _0x1cbe02;};'use strict';var _=require('lodash');var util=require(_0x827c('0x0'));var moment=require(_0x827c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x827c('0x2'));var db=require(_0x827c('0x3'))['db'];var utils=require(_0x827c('0x4'));var logger=require(_0x827c('0x5'))(_0x827c('0x6'));var config=require(_0x827c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x827c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f2817,_0x2fcf22,_0x3c2db5){return new BPromise(function(_0x307a56,_0x3b1a48){return client['request'](_0x2f2817,_0x3c2db5)['then'](function(_0x37449f){logger[_0x827c('0x9')]('SmsApplication,\x20%s,\x20%s',_0x2fcf22,'request\x20sent');logger[_0x827c('0xa')](_0x827c('0xb'),_0x2fcf22,'request\x20sent',JSON[_0x827c('0xc')](_0x37449f));if(_0x37449f[_0x827c('0xd')]){if(_0x37449f[_0x827c('0xd')][_0x827c('0xe')]===0x1f4){logger['error'](_0x827c('0xf'),_0x2fcf22,_0x37449f[_0x827c('0xd')]['message']);return _0x3b1a48(_0x37449f[_0x827c('0xd')][_0x827c('0x10')]);}logger[_0x827c('0xd')](_0x827c('0xf'),_0x2fcf22,_0x37449f[_0x827c('0xd')]['message']);return _0x307a56(_0x37449f['error']['message']);}else{logger[_0x827c('0x9')](_0x827c('0xf'),_0x2fcf22,_0x827c('0x11'));_0x307a56(_0x37449f[_0x827c('0x12')]['message']);}})[_0x827c('0x13')](function(_0x242054){logger[_0x827c('0xd')](_0x827c('0xf'),_0x2fcf22,_0x242054);_0x3b1a48(_0x242054);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 468da1f..c65ba27 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 _0x14a0=['/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','/describe','describe','getMessages'];(function(_0x5f0310,_0x233681){var _0x158e69=function(_0x2d257e){while(--_0x2d257e){_0x5f0310['push'](_0x5f0310['shift']());}};_0x158e69(++_0x233681);}(_0x14a0,0x8e));var _0x014a=function(_0x593f72,_0x24896f){_0x593f72=_0x593f72-0x0;var _0x27df1c=_0x14a0[_0x593f72];return _0x27df1c;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['get']('/:id',auth[_0x014a('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['get'](_0x014a('0xd'),auth[_0x014a('0x9')](),controller['download']);router[_0x014a('0xe')]('/',auth[_0x014a('0x9')](),controller[_0x014a('0xf')]);router[_0x014a('0xe')](_0x014a('0x10'),auth[_0x014a('0x9')](),controller[_0x014a('0x11')]);router[_0x014a('0xe')](_0x014a('0x12'),auth[_0x014a('0x9')](),interaction[_0x014a('0x13')](_0x014a('0x14'),'smsinteraction:addtags'),controller[_0x014a('0x15')]);router[_0x014a('0x16')]('/:id',auth[_0x014a('0x9')](),interaction[_0x014a('0x13')]('sms',_0x014a('0x17')),controller[_0x014a('0x18')]);router[_0x014a('0x19')](_0x014a('0x1a'),auth[_0x014a('0x9')](),interaction[_0x014a('0x13')](_0x014a('0x14'),_0x014a('0x1b')),controller[_0x014a('0x1c')]);router[_0x014a('0x19')](_0x014a('0x12'),auth[_0x014a('0x9')](),controller[_0x014a('0x1d')]);module[_0x014a('0x1e')]=router; \ No newline at end of file +var _0x4fc2=['removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy'];(function(_0x3fe4c1,_0xdf0e5e){var _0x534568=function(_0x140271){while(--_0x140271){_0x3fe4c1['push'](_0x3fe4c1['shift']());}};_0x534568(++_0xdf0e5e);}(_0x4fc2,0x111));var _0x24fc=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x4fc2[_0x459423];return _0x42ed14;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['show']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['post']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['post'](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x18')),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/:id',auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x1b')),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1d')](_0x24fc('0xe'),auth['isAuthenticated'](),interaction[_0x24fc('0x1e')](_0x24fc('0x17'),_0x24fc('0x1f')),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x16'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 60f7b93..6f02367 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 _0x307e=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x338608,_0x1422cd){var _0x585080=function(_0x49fa8e){while(--_0x49fa8e){_0x338608['push'](_0x338608['shift']());}};_0x585080(++_0x1422cd);}(_0x307e,0xc9));var _0xe307=function(_0x1004b5,_0x47439a){_0x1004b5=_0x1004b5-0x0;var _0x6f8cdf=_0x307e[_0x1004b5];return _0x6f8cdf;};'use strict';var Sequelize=require(_0xe307('0x0'));var moment=require(_0xe307('0x1'));module[_0xe307('0x2')]={'closed':{'type':Sequelize[_0xe307('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe307('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe307('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe307('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe307('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe307('0x6')]('in',_0xe307('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe307('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe307('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe307('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5301=['moment','exports','BOOLEAN','DATE','STRING','out','ENUM'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5301,0x157));var _0x1530=function(_0x4edd91,_0x1b546e){_0x4edd91=_0x4edd91-0x0;var _0x1dcc3a=_0x5301[_0x4edd91];return _0x1dcc3a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1530('0x0'));module[_0x1530('0x1')]={'closed':{'type':Sequelize[_0x1530('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1530('0x3')]},'disposition':{'type':Sequelize[_0x1530('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1530('0x4')]},'note':{'type':Sequelize[_0x1530('0x4')]},'phone':{'type':Sequelize[_0x1530('0x4')]},'read1stAt':{'type':Sequelize[_0x1530('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1530('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1530('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1530('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 27f41ef..3511994 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 _0xb059=['status','json','undefined','count','offset','set','update','then','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','sms','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','nolimit','limit','order','sort','where','SmsInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','spread','findAll','color','emit','removeTags','download','unix','toString','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','firstName','Messages','createdAt','direction','secret','push','Account','Owner','get','Sms','N.A.','closed','closedAt','disposition','out','System','Contact','lastName','read','value','join','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus'];(function(_0x164f37,_0x2a018a){var _0x1badb7=function(_0x90734b){while(--_0x90734b){_0x164f37['push'](_0x164f37['shift']());}};_0x1badb7(++_0x2a018a);}(_0xb059,0x14d));var _0x9b05=function(_0x5ab6de,_0x36b5bf){_0x5ab6de=_0x5ab6de-0x0;var _0x25d85e=_0xb059[_0x5ab6de];return _0x25d85e;};'use strict';var rimraf=require(_0x9b05('0x0'));var zipdir=require(_0x9b05('0x1'));var moment=require(_0x9b05('0x2'));var BPromise=require(_0x9b05('0x3'));var util=require(_0x9b05('0x4'));var path=require(_0x9b05('0x5'));var ejs=require(_0x9b05('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x9b05('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x9b05('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x9b05('0x9'))(_0x9b05('0xa'));var config=require(_0x9b05('0xb'));var db=require('../../mysqldb')['db'];config[_0x9b05('0xc')]=_['defaults'](config[_0x9b05('0xc')],{'host':_0x9b05('0xd'),'port':0x18eb});var socket=require(_0x9b05('0xe'))(new Redis(config[_0x9b05('0xc')]));require(_0x9b05('0xf'))[_0x9b05('0x10')](socket);function respondWithStatusCode(_0x54634d,_0x134701){_0x134701=_0x134701||0xcc;return function(_0x20634f){if(_0x20634f){return _0x54634d[_0x9b05('0x11')](_0x134701);}return _0x54634d[_0x9b05('0x12')](_0x134701)['end']();};}function respondWithResult(_0x29f669,_0x9c5a46){_0x9c5a46=_0x9c5a46||0xc8;return function(_0x915b41){if(_0x915b41){return _0x29f669[_0x9b05('0x12')](_0x9c5a46)[_0x9b05('0x13')](_0x915b41);}};}function respondWithFilteredResult(_0x5d4276,_0x2bedab){return function(_0x56d4c){if(_0x56d4c){var _0x4a81aa=typeof _0x2bedab['offset']===_0x9b05('0x14')&&typeof _0x2bedab['limit']===_0x9b05('0x14');var _0x4dc2d3=_0x56d4c[_0x9b05('0x15')];var _0x341f18=_0x4a81aa?0x0:_0x2bedab['offset'];var _0x5b8edf=_0x4a81aa?_0x56d4c[_0x9b05('0x15')]:_0x2bedab[_0x9b05('0x16')]+_0x2bedab['limit'];var _0x1638db;if(_0x5b8edf>=_0x4dc2d3){_0x5b8edf=_0x4dc2d3;_0x1638db=0xc8;}else{_0x1638db=0xce;}_0x5d4276[_0x9b05('0x12')](_0x1638db);return _0x5d4276[_0x9b05('0x17')]('Content-Range',_0x341f18+'-'+_0x5b8edf+'/'+_0x4dc2d3)[_0x9b05('0x13')](_0x56d4c);}return null;};}function saveUpdates(_0x1475d5){return function(_0x520581){if(_0x520581){return _0x520581[_0x9b05('0x18')](_0x1475d5)[_0x9b05('0x19')](function(_0x23bcfc){return _0x23bcfc;});}return null;};}function removeEntity(_0x3cd6dc){return function(_0x24fc81){if(_0x24fc81){return _0x24fc81['destroy']()[_0x9b05('0x19')](function(){_0x3cd6dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xda27a4){return function(_0x470b88){if(!_0x470b88){_0xda27a4[_0x9b05('0x11')](0x194);}return _0x470b88;};}function handleError(_0x5196e2,_0x24ed38){_0x24ed38=_0x24ed38||0x1f4;return function(_0x47aafe){logger['error'](_0x47aafe[_0x9b05('0x1a')]);if(_0x47aafe['name']){delete _0x47aafe[_0x9b05('0x1b')];}_0x5196e2[_0x9b05('0x12')](_0x24ed38)[_0x9b05('0x1c')](_0x47aafe);};}exports[_0x9b05('0x1d')]=function(_0x425469,_0x10732f){var _0x246d1a={};var _0x4cc237=_[_0x9b05('0x1e')](db[_0x9b05('0x1f')][_0x9b05('0x20')],function(_0x15315b){return{'name':_0x15315b[_0x9b05('0x21')],'type':_0x15315b[_0x9b05('0x22')][_0x9b05('0x23')]};});_0x246d1a=qs['getOptions'](_0x4cc237,_0x425469);return interaction['findAll'](_0x9b05('0x24'),_0x425469['query'],_0x425469['user'],_0x246d1a,_0x4cc237)[_0x9b05('0x19')](respondWithFilteredResult(_0x10732f,_0x246d1a))[_0x9b05('0x25')](handleError(_0x10732f,null));};exports[_0x9b05('0x26')]=function(_0x409a51,_0x135db1){var _0x1f2f85={'raw':![],'where':{'id':_0x409a51[_0x9b05('0x27')]['id']}},_0x17ea7d={};_0x17ea7d[_0x9b05('0x28')]=_[_0x9b05('0x29')](db[_0x9b05('0x1f')][_0x9b05('0x20')]);_0x17ea7d[_0x9b05('0x2a')]=_[_0x9b05('0x29')](_0x409a51['query']);_0x17ea7d[_0x9b05('0x2b')]=_[_0x9b05('0x2c')](_0x17ea7d[_0x9b05('0x28')],_0x17ea7d[_0x9b05('0x2a')]);_0x1f2f85[_0x9b05('0x2d')]=_[_0x9b05('0x2c')](_0x17ea7d['model'],qs[_0x9b05('0x2e')](_0x409a51[_0x9b05('0x2a')][_0x9b05('0x2e')]));_0x1f2f85[_0x9b05('0x2d')]=_0x1f2f85[_0x9b05('0x2d')][_0x9b05('0x2f')]?_0x1f2f85[_0x9b05('0x2d')]:_0x17ea7d[_0x9b05('0x28')];if(_0x409a51['query'][_0x9b05('0x30')]){_0x1f2f85[_0x9b05('0x31')]=[{'all':!![]}];}_0x1f2f85=_['merge']({},_0x1f2f85,_0x409a51['options']);return db[_0x9b05('0x1f')][_0x9b05('0x32')](_0x1f2f85)[_0x9b05('0x19')](handleEntityNotFound(_0x135db1,null))[_0x9b05('0x19')](respondWithResult(_0x135db1,null))[_0x9b05('0x25')](handleError(_0x135db1,null));};exports[_0x9b05('0x33')]=function(_0x26ee6,_0x32ae57){return db[_0x9b05('0x1f')][_0x9b05('0x33')](_0x26ee6[_0x9b05('0x34')],{})['then'](respondWithResult(_0x32ae57,0xc9))[_0x9b05('0x25')](handleError(_0x32ae57,null));};exports[_0x9b05('0x18')]=function(_0x23134b,_0x29b843){if(_0x23134b[_0x9b05('0x34')]['id']){delete _0x23134b[_0x9b05('0x34')]['id'];}return db['SmsInteraction'][_0x9b05('0x32')]({'where':{'id':_0x23134b[_0x9b05('0x27')]['id']}})[_0x9b05('0x19')](handleEntityNotFound(_0x29b843,null))[_0x9b05('0x19')](saveUpdates(_0x23134b[_0x9b05('0x34')],null))[_0x9b05('0x19')](respondWithResult(_0x29b843,null))['catch'](handleError(_0x29b843,null));};exports[_0x9b05('0x35')]=function(_0x56ca53,_0x32d0c7){return db['SmsInteraction'][_0x9b05('0x32')]({'where':{'id':_0x56ca53['params']['id']}})['then'](handleEntityNotFound(_0x32d0c7,null))[_0x9b05('0x19')](removeEntity(_0x32d0c7,null))[_0x9b05('0x25')](handleError(_0x32d0c7,null));};exports[_0x9b05('0x36')]=function(_0x5c2ecb,_0x13bd62){return db['SmsInteraction'][_0x9b05('0x36')]()['then'](respondWithResult(_0x13bd62,null))['catch'](handleError(_0x13bd62,null));};exports['addMessage']=function(_0xcc07e1,_0x7cbb66){return db['SmsMessage'][_0x9b05('0x32')]({'where':{'id':_0xcc07e1[_0x9b05('0x27')]['id']}})['then'](handleEntityNotFound(_0x7cbb66,null))[_0x9b05('0x19')](function(_0x535be2){if(_0x535be2){return _0x535be2[_0x9b05('0x37')](_0xcc07e1[_0x9b05('0x34')][_0x9b05('0x38')],_[_0x9b05('0x39')](_0xcc07e1['body'],[_0x9b05('0x38'),'id'])||{});}})[_0x9b05('0x19')](respondWithResult(_0x7cbb66,null))[_0x9b05('0x25')](handleError(_0x7cbb66,null));};exports[_0x9b05('0x3a')]=function(_0x39e991,_0x2650d9){var _0x55d869={'raw':![],'where':{}};var _0x35dfb={};var _0x4eeb34={'count':0x0,'rows':[]};return db[_0x9b05('0x1f')][_0x9b05('0x3b')]({'where':{'id':_0x39e991[_0x9b05('0x27')]['id']}})[_0x9b05('0x19')](handleEntityNotFound(_0x2650d9,null))['then'](function(_0x3ccd94){if(_0x3ccd94){_0x35dfb['model']=_[_0x9b05('0x29')](db[_0x9b05('0x3c')][_0x9b05('0x20')]);_0x35dfb[_0x9b05('0x2a')]=_['keys'](_0x39e991[_0x9b05('0x2a')]);_0x35dfb[_0x9b05('0x2b')]=_[_0x9b05('0x2c')](_0x35dfb[_0x9b05('0x28')],_0x35dfb['query']);_0x55d869['attributes']=_['intersection'](_0x35dfb['model'],qs['fields'](_0x39e991[_0x9b05('0x2a')][_0x9b05('0x2e')]));_0x55d869[_0x9b05('0x2d')]=_0x55d869[_0x9b05('0x2d')][_0x9b05('0x2f')]?_0x55d869[_0x9b05('0x2d')]:_0x35dfb[_0x9b05('0x28')];if(!_0x39e991[_0x9b05('0x2a')]['hasOwnProperty'](_0x9b05('0x3d'))){_0x55d869[_0x9b05('0x3e')]=qs[_0x9b05('0x3e')](_0x39e991[_0x9b05('0x2a')]['limit']);_0x55d869['offset']=qs['offset'](_0x39e991[_0x9b05('0x2a')][_0x9b05('0x16')]);}_0x55d869[_0x9b05('0x3f')]=qs[_0x9b05('0x40')](_0x39e991['query'][_0x9b05('0x40')]);_0x55d869[_0x9b05('0x41')]=qs[_0x9b05('0x2b')](_['pick'](_0x39e991[_0x9b05('0x2a')],_0x35dfb[_0x9b05('0x2b')]));_0x55d869[_0x9b05('0x41')][_0x9b05('0x42')]=_0x3ccd94['id'];if(_0x39e991[_0x9b05('0x2a')][_0x9b05('0x43')]){_0x55d869['where']=_[_0x9b05('0x44')](_0x55d869[_0x9b05('0x41')],{'$or':_[_0x9b05('0x1e')](_0x55d869['attributes'],function(_0x3d581f){var _0x158d38={};_0x158d38[_0x3d581f]={'$like':'%'+_0x39e991[_0x9b05('0x2a')]['filter']+'%'};return _0x158d38;})});}if(_0x39e991[_0x9b05('0x2a')]['$gte']){var _0x5670eb=_0x39e991['query'][_0x9b05('0x45')][_0x9b05('0x46')](',');var _0xa351ee={};_0xa351ee[_0x5670eb[0x0]]={'$gte':moment(_0x5670eb[0x1])[_0x9b05('0x47')](_0x9b05('0x48'))};_0x55d869[_0x9b05('0x41')]=_[_0x9b05('0x44')](_0x55d869['where'],_0xa351ee);}_0x55d869=_[_0x9b05('0x44')]({},_0x55d869,_0x39e991[_0x9b05('0x49')]);return db[_0x9b05('0x3c')][_0x9b05('0x15')]({'where':_0x55d869[_0x9b05('0x41')]})['then'](function(_0x1069b1){_0x4eeb34['count']=_0x1069b1;if(_0x39e991[_0x9b05('0x2a')]['includeAll']){_0x55d869[_0x9b05('0x31')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x55d869);})[_0x9b05('0x19')](function(_0x13ac04){_0x4eeb34[_0x9b05('0x4a')]=_0x13ac04;return _0x4eeb34;});}})[_0x9b05('0x19')](respondWithFilteredResult(_0x2650d9,_0x55d869))[_0x9b05('0x25')](handleError(_0x2650d9,null));};exports['addTags']=function(_0xd7f0c7,_0x50c137){return db[_0x9b05('0x1f')][_0x9b05('0x32')]({'where':{'id':_0xd7f0c7[_0x9b05('0x27')]['id']}})[_0x9b05('0x19')](handleEntityNotFound(_0x50c137,null))[_0x9b05('0x19')](function(_0x17a90a){if(_0x17a90a){return _0x17a90a[_0x9b05('0x4b')](_0xd7f0c7[_0x9b05('0x34')][_0x9b05('0x38')],_[_0x9b05('0x39')](_0xd7f0c7[_0x9b05('0x34')],[_0x9b05('0x38'),'id'])||{})[_0x9b05('0x4c')](function(){return db['Tag'][_0x9b05('0x4d')]({'attributes':['id',_0x9b05('0x1b'),_0x9b05('0x4e')],'where':{'id':_0xd7f0c7['body'][_0x9b05('0x38')]}});})[_0x9b05('0x19')](function(_0x21420f){socket[_0x9b05('0x4f')]('smsInteractionTags:save',{'id':Number(_0xd7f0c7['params']['id']),'tags':_0x21420f||[]});return{'id':Number(_0xd7f0c7[_0x9b05('0x27')]['id']),'tags':_0x21420f||[]};});}})['then'](respondWithResult(_0x50c137,null))[_0x9b05('0x25')](handleError(_0x50c137,null));};exports[_0x9b05('0x50')]=function(_0x581bb2,_0x5d6613){return db[_0x9b05('0x1f')][_0x9b05('0x32')]({'where':{'id':_0x581bb2['params']['id']}})['then'](handleEntityNotFound(_0x5d6613,null))[_0x9b05('0x19')](function(_0x742a63){if(_0x742a63){return _0x742a63[_0x9b05('0x50')](_0x581bb2[_0x9b05('0x2a')][_0x9b05('0x38')]);}})['then'](respondWithStatusCode(_0x5d6613,null))['catch'](handleError(_0x5d6613,null));};exports[_0x9b05('0x51')]=function(_0x513429,_0x1242f1){var _0x31e8d4=moment()[_0x9b05('0x52')]()[_0x9b05('0x53')]();var _0x5bca18=path['join'](config[_0x9b05('0x54')],_0x9b05('0x55'),_0x9b05('0x56'),_0x9b05('0x57'));var _0x99090e=path['join'](_0x5bca18,_0x31e8d4);var _0x28da40=util['format'](_0x9b05('0x58'),_0x513429[_0x9b05('0x27')]['id'],_0x31e8d4);var _0x2cfae6=path['join'](_0x5bca18,_0x28da40);var _0x2f4d72=[];_0x2f4d72['push']({'model':db[_0x9b05('0x59')],'as':'User','attributes':['id',_0x9b05('0x5a')],'raw':!![]});_0x2f4d72['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x9b05('0x5b'),'lastName'],'raw':!![]});var _0x27007d=[{'model':db[_0x9b05('0x3c')],'as':_0x9b05('0x5c'),'attributes':['id','body',_0x9b05('0x5d'),_0x9b05('0x5e'),_0x9b05('0x5f'),'read'],'include':_0x2f4d72}];_0x27007d[_0x9b05('0x60')]({'model':db['SmsAccount'],'as':_0x9b05('0x61'),'attributes':['id',_0x9b05('0x1b')]});_0x27007d['push']({'model':db[_0x9b05('0x59')],'as':_0x9b05('0x62'),'attributes':['id',_0x9b05('0x5a')]});return db['SmsInteraction']['find']({'where':{'id':_0x513429[_0x9b05('0x27')]['id']},'include':_0x27007d})[_0x9b05('0x19')](handleEntityNotFound(_0x1242f1,null))['then'](function(_0x4a894b){if(_0x4a894b){var _0x53b508=_0x4a894b[_0x9b05('0x63')]({'plain':!![]});fs['mkdirSync'](_0x99090e);var _0x21296b={'channel':_0x9b05('0x64'),'account':_0x53b508['Account'][_0x9b05('0x1b')],'agent':_0x53b508[_0x9b05('0x62')]?_0x53b508[_0x9b05('0x62')]['fullname']:_0x9b05('0x65'),'createdAt':moment(_0x53b508['createdAt'])[_0x9b05('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x53b508[_0x9b05('0x66')]?moment(_0x53b508[_0x9b05('0x67')])['format'](_0x9b05('0x48'))[_0x9b05('0x53')]():'','disposition':_0x53b508[_0x9b05('0x68')],'messages':_(_0x53b508['Messages'])[_0x9b05('0x43')]({'secret':![]})['map'](function(_0x56523d){return{'date':moment(_0x56523d[_0x9b05('0x5d')])[_0x9b05('0x47')](_0x9b05('0x48'))[_0x9b05('0x53')](),'sender':_0x56523d[_0x9b05('0x5e')]===_0x9b05('0x69')?_0x56523d[_0x9b05('0x59')]?_0x56523d[_0x9b05('0x59')][_0x9b05('0x5a')]:_0x9b05('0x6a'):_0x56523d[_0x9b05('0x6b')][_0x9b05('0x5b')]+(_0x56523d[_0x9b05('0x6b')][_0x9b05('0x6c')]?'\x20'+_0x56523d['Contact'][_0x9b05('0x6c')]:''),'body':_0x56523d[_0x9b05('0x34')],'direction':_0x56523d[_0x9b05('0x5e')]===_0x9b05('0x69')?'A':'C','secret':_0x56523d[_0x9b05('0x5f')],'read':_0x56523d[_0x9b05('0x6d')]};})[_0x9b05('0x6e')]()};return ejs['renderFile'](path[_0x9b05('0x6f')](config['root'],'server','views',_0x9b05('0x70')),{'interaction':_0x21296b})[_0x9b05('0x19')](function(_0x42dd62){var _0x1f32ea=path[_0x9b05('0x6f')](_0x99090e,_0x9b05('0x71')+_0x53b508['id']+'-'+_0x31e8d4+_0x9b05('0x72'));var _0x294aa2={'path':_0x1f32ea,'channel':_0x9b05('0x64'),'interactionId':_0x53b508['id']};return pdf[_0x9b05('0x73')](_0x42dd62,_0x294aa2);})['then'](function(){return new BPromise(function(_0x280d30,_0x1ce7b){zipdir(_0x99090e,{'saveTo':_0x2cfae6},function(_0x16b183,_0x1dc4eb){if(_0x16b183)return _0x1ce7b(_0x16b183);return _0x280d30(_0x1dc4eb);});})[_0x9b05('0x19')](function(){return new BPromise(function(_0x1d9055,_0xafea92){rimraf(_0x99090e,function(_0x40ddb2){if(_0x40ddb2)_0xafea92(_0x40ddb2);return _0x1d9055();});});})[_0x9b05('0x19')](function(){return _0x1242f1['download'](_0x2cfae6,_0x28da40,function(_0x158349){if(_0x158349){console['log']('err',_0x158349);}else{fs[_0x9b05('0x74')](_0x2cfae6);}});});});}else{return _0x1242f1[_0x9b05('0x11')](0xc8);}})['catch'](handleError(_0x1242f1,null));}; \ No newline at end of file +var _0x172e=['value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','update','then','destroy','end','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','key','findAll','sms','catch','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','include','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','secret','Owner','get','mkdirSync','Sms','createdAt','closed','closedAt','Messages','map','direction','firstName','out','read'];(function(_0x1c2560,_0x1d9304){var _0x2be4de=function(_0x3d6984){while(--_0x3d6984){_0x1c2560['push'](_0x1c2560['shift']());}};_0x2be4de(++_0x1d9304);}(_0x172e,0x16b));var _0xe172=function(_0x1958dd,_0x1b34fc){_0x1958dd=_0x1958dd-0x0;var _0x4c313e=_0x172e[_0x1958dd];return _0x4c313e;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe172('0x0'));var moment=require(_0xe172('0x1'));var BPromise=require(_0xe172('0x2'));var util=require('util');var path=require(_0xe172('0x3'));var ejs=require(_0xe172('0x4'));var fs=require('fs');var _=require(_0xe172('0x5'));var Redis=require(_0xe172('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xe172('0x7'));var pdf=require(_0xe172('0x8'));var logger=require(_0xe172('0x9'))(_0xe172('0xa'));var config=require(_0xe172('0xb'));var db=require(_0xe172('0xc'))['db'];config[_0xe172('0xd')]=_[_0xe172('0xe')](config['redis'],{'host':_0xe172('0xf'),'port':0x18eb});var socket=require(_0xe172('0x10'))(new Redis(config[_0xe172('0xd')]));require(_0xe172('0x11'))[_0xe172('0x12')](socket);function respondWithStatusCode(_0x2f688b,_0x4faf88){_0x4faf88=_0x4faf88||0xcc;return function(_0x57e85d){if(_0x57e85d){return _0x2f688b[_0xe172('0x13')](_0x4faf88);}return _0x2f688b['status'](_0x4faf88)['end']();};}function respondWithResult(_0x847839,_0x522fe7){_0x522fe7=_0x522fe7||0xc8;return function(_0x5260a3){if(_0x5260a3){return _0x847839[_0xe172('0x14')](_0x522fe7)['json'](_0x5260a3);}};}function respondWithFilteredResult(_0x2efeba,_0x2ff97d){return function(_0x5b34db){if(_0x5b34db){var _0x149380=typeof _0x2ff97d['offset']===_0xe172('0x15')&&typeof _0x2ff97d['limit']==='undefined';var _0x5154e1=_0x5b34db[_0xe172('0x16')];var _0x1a270c=_0x149380?0x0:_0x2ff97d[_0xe172('0x17')];var _0x3e3b86=_0x149380?_0x5b34db[_0xe172('0x16')]:_0x2ff97d[_0xe172('0x17')]+_0x2ff97d[_0xe172('0x18')];var _0x3a19bb;if(_0x3e3b86>=_0x5154e1){_0x3e3b86=_0x5154e1;_0x3a19bb=0xc8;}else{_0x3a19bb=0xce;}_0x2efeba[_0xe172('0x14')](_0x3a19bb);return _0x2efeba[_0xe172('0x19')](_0xe172('0x1a'),_0x1a270c+'-'+_0x3e3b86+'/'+_0x5154e1)[_0xe172('0x1b')](_0x5b34db);}return null;};}function saveUpdates(_0x291ec7){return function(_0x5d8763){if(_0x5d8763){return _0x5d8763[_0xe172('0x1c')](_0x291ec7)[_0xe172('0x1d')](function(_0x4b39de){return _0x4b39de;});}return null;};}function removeEntity(_0x55be01){return function(_0x430ba7){if(_0x430ba7){return _0x430ba7[_0xe172('0x1e')]()[_0xe172('0x1d')](function(){_0x55be01[_0xe172('0x14')](0xcc)[_0xe172('0x1f')]();});}};}function handleEntityNotFound(_0x22bd64){return function(_0x6e764){if(!_0x6e764){_0x22bd64['sendStatus'](0x194);}return _0x6e764;};}function handleError(_0x34113a,_0x8ad302){_0x8ad302=_0x8ad302||0x1f4;return function(_0x3ef424){logger['error'](_0x3ef424[_0xe172('0x20')]);if(_0x3ef424[_0xe172('0x21')]){delete _0x3ef424[_0xe172('0x21')];}_0x34113a[_0xe172('0x14')](_0x8ad302)[_0xe172('0x22')](_0x3ef424);};}exports[_0xe172('0x23')]=function(_0x5824e9,_0x641b4){var _0x1783a={};var _0x110966=_['map'](db[_0xe172('0x24')][_0xe172('0x25')],function(_0x1ff736){return{'name':_0x1ff736[_0xe172('0x26')],'type':_0x1ff736['type'][_0xe172('0x27')]};});_0x1783a=qs['getOptions'](_0x110966,_0x5824e9);return interaction[_0xe172('0x28')](_0xe172('0x29'),_0x5824e9['query'],_0x5824e9['user'],_0x1783a,_0x110966)[_0xe172('0x1d')](respondWithFilteredResult(_0x641b4,_0x1783a))[_0xe172('0x2a')](handleError(_0x641b4,null));};exports[_0xe172('0x2b')]=function(_0x4d63c9,_0x4cb433){var _0x1d1f76={'raw':![],'where':{'id':_0x4d63c9[_0xe172('0x2c')]['id']}},_0x300da5={};_0x300da5[_0xe172('0x2d')]=_[_0xe172('0x2e')](db[_0xe172('0x24')][_0xe172('0x25')]);_0x300da5['query']=_[_0xe172('0x2e')](_0x4d63c9[_0xe172('0x2f')]);_0x300da5[_0xe172('0x30')]=_[_0xe172('0x31')](_0x300da5[_0xe172('0x2d')],_0x300da5['query']);_0x1d1f76[_0xe172('0x32')]=_[_0xe172('0x31')](_0x300da5[_0xe172('0x2d')],qs[_0xe172('0x33')](_0x4d63c9[_0xe172('0x2f')]['fields']));_0x1d1f76['attributes']=_0x1d1f76['attributes']['length']?_0x1d1f76[_0xe172('0x32')]:_0x300da5[_0xe172('0x2d')];if(_0x4d63c9['query'][_0xe172('0x34')]){_0x1d1f76[_0xe172('0x35')]=[{'all':!![]}];}_0x1d1f76=_['merge']({},_0x1d1f76,_0x4d63c9[_0xe172('0x36')]);return db[_0xe172('0x24')][_0xe172('0x37')](_0x1d1f76)['then'](handleEntityNotFound(_0x4cb433,null))[_0xe172('0x1d')](respondWithResult(_0x4cb433,null))[_0xe172('0x2a')](handleError(_0x4cb433,null));};exports[_0xe172('0x38')]=function(_0x3e398d,_0x7b20d5){return db[_0xe172('0x24')][_0xe172('0x38')](_0x3e398d[_0xe172('0x39')],{})[_0xe172('0x1d')](respondWithResult(_0x7b20d5,0xc9))[_0xe172('0x2a')](handleError(_0x7b20d5,null));};exports[_0xe172('0x1c')]=function(_0x44d3c1,_0x4e96f5){if(_0x44d3c1[_0xe172('0x39')]['id']){delete _0x44d3c1[_0xe172('0x39')]['id'];}return db[_0xe172('0x24')][_0xe172('0x37')]({'where':{'id':_0x44d3c1[_0xe172('0x2c')]['id']}})[_0xe172('0x1d')](handleEntityNotFound(_0x4e96f5,null))[_0xe172('0x1d')](saveUpdates(_0x44d3c1['body'],null))[_0xe172('0x1d')](respondWithResult(_0x4e96f5,null))['catch'](handleError(_0x4e96f5,null));};exports[_0xe172('0x1e')]=function(_0x58cf69,_0x206c77){return db[_0xe172('0x24')][_0xe172('0x37')]({'where':{'id':_0x58cf69[_0xe172('0x2c')]['id']}})['then'](handleEntityNotFound(_0x206c77,null))[_0xe172('0x1d')](removeEntity(_0x206c77,null))[_0xe172('0x2a')](handleError(_0x206c77,null));};exports[_0xe172('0x3a')]=function(_0x5d5e56,_0xbfe85c){return db[_0xe172('0x24')]['describe']()[_0xe172('0x1d')](respondWithResult(_0xbfe85c,null))['catch'](handleError(_0xbfe85c,null));};exports['addMessage']=function(_0xfec150,_0x34f459){return db['SmsMessage'][_0xe172('0x37')]({'where':{'id':_0xfec150[_0xe172('0x2c')]['id']}})[_0xe172('0x1d')](handleEntityNotFound(_0x34f459,null))[_0xe172('0x1d')](function(_0x2ee20a){if(_0x2ee20a){return _0x2ee20a[_0xe172('0x3b')](_0xfec150['body'][_0xe172('0x3c')],_[_0xe172('0x3d')](_0xfec150[_0xe172('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x34f459,null))[_0xe172('0x2a')](handleError(_0x34f459,null));};exports[_0xe172('0x3e')]=function(_0x5a7ec2,_0x311bd2){var _0x8b657d={'raw':![],'where':{}};var _0x3e4c1d={};var _0x215159={'count':0x0,'rows':[]};return db[_0xe172('0x24')][_0xe172('0x3f')]({'where':{'id':_0x5a7ec2[_0xe172('0x2c')]['id']}})[_0xe172('0x1d')](handleEntityNotFound(_0x311bd2,null))['then'](function(_0x2e74a7){if(_0x2e74a7){_0x3e4c1d[_0xe172('0x2d')]=_[_0xe172('0x2e')](db[_0xe172('0x40')][_0xe172('0x25')]);_0x3e4c1d['query']=_[_0xe172('0x2e')](_0x5a7ec2[_0xe172('0x2f')]);_0x3e4c1d['filters']=_[_0xe172('0x31')](_0x3e4c1d['model'],_0x3e4c1d[_0xe172('0x2f')]);_0x8b657d['attributes']=_[_0xe172('0x31')](_0x3e4c1d['model'],qs[_0xe172('0x33')](_0x5a7ec2[_0xe172('0x2f')][_0xe172('0x33')]));_0x8b657d[_0xe172('0x32')]=_0x8b657d['attributes']['length']?_0x8b657d['attributes']:_0x3e4c1d[_0xe172('0x2d')];if(!_0x5a7ec2[_0xe172('0x2f')][_0xe172('0x41')](_0xe172('0x42'))){_0x8b657d[_0xe172('0x18')]=qs[_0xe172('0x18')](_0x5a7ec2[_0xe172('0x2f')]['limit']);_0x8b657d[_0xe172('0x17')]=qs['offset'](_0x5a7ec2[_0xe172('0x2f')][_0xe172('0x17')]);}_0x8b657d[_0xe172('0x43')]=qs[_0xe172('0x44')](_0x5a7ec2[_0xe172('0x2f')][_0xe172('0x44')]);_0x8b657d[_0xe172('0x45')]=qs[_0xe172('0x30')](_['pick'](_0x5a7ec2[_0xe172('0x2f')],_0x3e4c1d['filters']));_0x8b657d[_0xe172('0x45')][_0xe172('0x46')]=_0x2e74a7['id'];if(_0x5a7ec2[_0xe172('0x2f')][_0xe172('0x47')]){_0x8b657d[_0xe172('0x45')]=_[_0xe172('0x48')](_0x8b657d[_0xe172('0x45')],{'$or':_['map'](_0x8b657d['attributes'],function(_0x4ef7ca){var _0x10b76a={};_0x10b76a[_0x4ef7ca]={'$like':'%'+_0x5a7ec2[_0xe172('0x2f')][_0xe172('0x47')]+'%'};return _0x10b76a;})});}if(_0x5a7ec2[_0xe172('0x2f')][_0xe172('0x49')]){var _0x13d00e=_0x5a7ec2[_0xe172('0x2f')]['$gte'][_0xe172('0x4a')](',');var _0x306ac4={};_0x306ac4[_0x13d00e[0x0]]={'$gte':moment(_0x13d00e[0x1])[_0xe172('0x4b')](_0xe172('0x4c'))};_0x8b657d['where']=_['merge'](_0x8b657d[_0xe172('0x45')],_0x306ac4);}_0x8b657d=_[_0xe172('0x48')]({},_0x8b657d,_0x5a7ec2[_0xe172('0x36')]);return db[_0xe172('0x40')][_0xe172('0x16')]({'where':_0x8b657d['where']})['then'](function(_0x4941ac){_0x215159['count']=_0x4941ac;if(_0x5a7ec2['query'][_0xe172('0x34')]){_0x8b657d[_0xe172('0x35')]=[{'all':!![]}];}return db['SmsMessage'][_0xe172('0x28')](_0x8b657d);})[_0xe172('0x1d')](function(_0x2e11ab){_0x215159[_0xe172('0x4d')]=_0x2e11ab;return _0x215159;});}})[_0xe172('0x1d')](respondWithFilteredResult(_0x311bd2,_0x8b657d))[_0xe172('0x2a')](handleError(_0x311bd2,null));};exports[_0xe172('0x4e')]=function(_0x3eda89,_0x50d7e6){return db[_0xe172('0x24')][_0xe172('0x37')]({'where':{'id':_0x3eda89[_0xe172('0x2c')]['id']}})['then'](handleEntityNotFound(_0x50d7e6,null))['then'](function(_0x47a0dd){if(_0x47a0dd){return _0x47a0dd[_0xe172('0x4f')](_0x3eda89[_0xe172('0x39')][_0xe172('0x3c')],_[_0xe172('0x3d')](_0x3eda89[_0xe172('0x39')],[_0xe172('0x3c'),'id'])||{})[_0xe172('0x50')](function(){return db[_0xe172('0x51')][_0xe172('0x28')]({'attributes':['id','name',_0xe172('0x52')],'where':{'id':_0x3eda89[_0xe172('0x39')]['ids']}});})[_0xe172('0x1d')](function(_0x18c956){socket['emit']('smsInteractionTags:save',{'id':Number(_0x3eda89[_0xe172('0x2c')]['id']),'tags':_0x18c956||[]});return{'id':Number(_0x3eda89[_0xe172('0x2c')]['id']),'tags':_0x18c956||[]};});}})[_0xe172('0x1d')](respondWithResult(_0x50d7e6,null))['catch'](handleError(_0x50d7e6,null));};exports[_0xe172('0x53')]=function(_0x771743,_0x47ce35){return db['SmsInteraction']['find']({'where':{'id':_0x771743['params']['id']}})[_0xe172('0x1d')](handleEntityNotFound(_0x47ce35,null))[_0xe172('0x1d')](function(_0x236780){if(_0x236780){return _0x236780[_0xe172('0x53')](_0x771743[_0xe172('0x2f')][_0xe172('0x3c')]);}})[_0xe172('0x1d')](respondWithStatusCode(_0x47ce35,null))[_0xe172('0x2a')](handleError(_0x47ce35,null));};exports[_0xe172('0x54')]=function(_0x53662e,_0x33c90f){var _0x535e95=moment()[_0xe172('0x55')]()[_0xe172('0x56')]();var _0x27951b=path[_0xe172('0x57')](config[_0xe172('0x58')],_0xe172('0x59'),_0xe172('0x5a'),_0xe172('0x5b'));var _0x506e49=path['join'](_0x27951b,_0x535e95);var _0x9491d5=util[_0xe172('0x4b')](_0xe172('0x5c'),_0x53662e[_0xe172('0x2c')]['id'],_0x535e95);var _0x2f8814=path[_0xe172('0x57')](_0x27951b,_0x9491d5);var _0x4b68b8=[];_0x4b68b8[_0xe172('0x5d')]({'model':db['User'],'as':_0xe172('0x5e'),'attributes':['id',_0xe172('0x5f')],'raw':!![]});_0x4b68b8[_0xe172('0x5d')]({'model':db[_0xe172('0x60')],'as':_0xe172('0x61'),'attributes':['id','firstName',_0xe172('0x62')],'raw':!![]});var _0x925074=[{'model':db[_0xe172('0x40')],'as':'Messages','attributes':['id',_0xe172('0x39'),'createdAt','direction',_0xe172('0x63'),'read'],'include':_0x4b68b8}];_0x925074[_0xe172('0x5d')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xe172('0x21')]});_0x925074[_0xe172('0x5d')]({'model':db[_0xe172('0x5e')],'as':_0xe172('0x64'),'attributes':['id',_0xe172('0x5f')]});return db[_0xe172('0x24')][_0xe172('0x37')]({'where':{'id':_0x53662e[_0xe172('0x2c')]['id']},'include':_0x925074})[_0xe172('0x1d')](handleEntityNotFound(_0x33c90f,null))['then'](function(_0x5b1598){if(_0x5b1598){var _0x1e360a=_0x5b1598[_0xe172('0x65')]({'plain':!![]});fs[_0xe172('0x66')](_0x506e49);var _0x8b3b3d={'channel':_0xe172('0x67'),'account':_0x1e360a['Account']['name'],'agent':_0x1e360a[_0xe172('0x64')]?_0x1e360a[_0xe172('0x64')][_0xe172('0x5f')]:'N.A.','createdAt':moment(_0x1e360a[_0xe172('0x68')])['format'](_0xe172('0x4c'))['toString'](),'closedAt':_0x1e360a[_0xe172('0x69')]?moment(_0x1e360a[_0xe172('0x6a')])[_0xe172('0x4b')](_0xe172('0x4c'))[_0xe172('0x56')]():'','disposition':_0x1e360a['disposition'],'messages':_(_0x1e360a[_0xe172('0x6b')])[_0xe172('0x47')]({'secret':![]})[_0xe172('0x6c')](function(_0x4d6ae1){return{'date':moment(_0x4d6ae1[_0xe172('0x68')])[_0xe172('0x4b')](_0xe172('0x4c'))[_0xe172('0x56')](),'sender':_0x4d6ae1[_0xe172('0x6d')]==='out'?_0x4d6ae1[_0xe172('0x5e')]?_0x4d6ae1[_0xe172('0x5e')]['fullname']:'System':_0x4d6ae1[_0xe172('0x61')][_0xe172('0x6e')]+(_0x4d6ae1[_0xe172('0x61')]['lastName']?'\x20'+_0x4d6ae1[_0xe172('0x61')]['lastName']:''),'body':_0x4d6ae1['body'],'direction':_0x4d6ae1[_0xe172('0x6d')]===_0xe172('0x6f')?'A':'C','secret':_0x4d6ae1[_0xe172('0x63')],'read':_0x4d6ae1[_0xe172('0x70')]};})[_0xe172('0x71')]()};return ejs['renderFile'](path[_0xe172('0x57')](config[_0xe172('0x58')],'server','views',_0xe172('0x72')),{'interaction':_0x8b3b3d})[_0xe172('0x1d')](function(_0x341ded){var _0x287c28=path[_0xe172('0x57')](_0x506e49,_0xe172('0x73')+_0x1e360a['id']+'-'+_0x535e95+_0xe172('0x74'));var _0x5a48f5={'path':_0x287c28,'channel':'Sms','interactionId':_0x1e360a['id']};return pdf[_0xe172('0x75')](_0x341ded,_0x5a48f5);})[_0xe172('0x1d')](function(){return new BPromise(function(_0x609f96,_0x1e004d){zipdir(_0x506e49,{'saveTo':_0x2f8814},function(_0xf79d4a,_0x1d8384){if(_0xf79d4a)return _0x1e004d(_0xf79d4a);return _0x609f96(_0x1d8384);});})[_0xe172('0x1d')](function(){return new BPromise(function(_0x22c226,_0x237fbe){rimraf(_0x506e49,function(_0x30e3bc){if(_0x30e3bc)_0x237fbe(_0x30e3bc);return _0x22c226();});});})[_0xe172('0x1d')](function(){return _0x33c90f['download'](_0x2f8814,_0x9491d5,function(_0x24ad64){if(_0x24ad64){console[_0xe172('0x76')]('err',_0x24ad64);}else{fs['unlinkSync'](_0x2f8814);}});});});}else{return _0x33c90f['sendStatus'](0xc8);}})['catch'](handleError(_0x33c90f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 31ade69..0eadf1b 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 _0x8aad=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x3f40ab,_0xfe6037){var _0x394ac6=function(_0x15b1f3){while(--_0x15b1f3){_0x3f40ab['push'](_0x3f40ab['shift']());}};_0x394ac6(++_0xfe6037);}(_0x8aad,0x146));var _0xd8aa=function(_0x172043,_0x54caeb){_0x172043=_0x172043-0x0;var _0x348ee5=_0x8aad[_0x172043];return _0x348ee5;};'use strict';var EventEmitter=require(_0xd8aa('0x0'));var SmsInteraction=require(_0xd8aa('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xd8aa('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xd8aa('0x2')](0x0);var events={'afterCreate':_0xd8aa('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x401aef){return function(_0x59804a,_0x53248c,_0x16b648){_0x59804a[_0xd8aa('0x4')]({'attributes':['id'],'raw':!![]})[_0xd8aa('0x5')](function(_0x4a4b10){_0x59804a[_0xd8aa('0x6')](_0xd8aa('0x7'),_0x4a4b10[_0xd8aa('0x8')](function(_0x350171){return{'id':_0x350171['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x59804a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x24f3f1){_0x59804a[_0xd8aa('0x6')](_0xd8aa('0x9'),_0x24f3f1[_0xd8aa('0xa')]);SmsInteractionEvents[_0xd8aa('0xb')](_0x401aef+':'+_0x59804a['id'],_0x59804a);SmsInteractionEvents['emit'](_0x401aef,_0x59804a);_0x16b648(null);})[_0xd8aa('0xc')](_0x16b648(null));};}for(var e in events){if(events[_0xd8aa('0xd')](e)){var event=events[e];SmsInteraction[_0xd8aa('0xe')](e,emitEvent(event));}}module[_0xd8aa('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0xd914=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x191a2f,_0x1445ef){var _0xe8675c=function(_0xc9a2dc){while(--_0xc9a2dc){_0x191a2f['push'](_0x191a2f['shift']());}};_0xe8675c(++_0x1445ef);}(_0xd914,0x17f));var _0x4d91=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0xd914[_0x205e5a];return _0x10da58;};'use strict';var EventEmitter=require(_0x4d91('0x0'));var SmsInteraction=require(_0x4d91('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4d91('0x1'))['db'][_0x4d91('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4d91('0x3')](0x0);var events={'afterCreate':_0x4d91('0x4'),'afterUpdate':_0x4d91('0x5'),'afterDestroy':_0x4d91('0x6')};function emitEvent(_0x4875a2){return function(_0x1b256e,_0x5d8af4,_0x3ab6f8){_0x1b256e[_0x4d91('0x7')]({'attributes':['id'],'raw':!![]})[_0x4d91('0x8')](function(_0x27c0d5){_0x1b256e[_0x4d91('0x9')](_0x4d91('0xa'),_0x27c0d5[_0x4d91('0xb')](function(_0x2a3ca1){return{'id':_0x2a3ca1['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1b256e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d91('0x8')](function(_0xa4bb25){_0x1b256e[_0x4d91('0x9')](_0x4d91('0xc'),_0xa4bb25[_0x4d91('0xd')]);SmsInteractionEvents[_0x4d91('0xe')](_0x4875a2+':'+_0x1b256e['id'],_0x1b256e);SmsInteractionEvents['emit'](_0x4875a2,_0x1b256e);_0x3ab6f8(null);})['catch'](_0x3ab6f8(null));};}for(var e in events){if(events[_0x4d91('0xf')](e)){var event=events[e];SmsInteraction[_0x4d91('0x10')](e,emitEvent(event));}}module[_0x4d91('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 6704cee..d01642f 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 _0x99d3=['SmsInteraction','sms_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x502b28,_0x2a5601){var _0x37d680=function(_0x5766c4){while(--_0x5766c4){_0x502b28['push'](_0x502b28['shift']());}};_0x37d680(++_0x2a5601);}(_0x99d3,0x155));var _0x399d=function(_0x203aca,_0x1a3360){_0x203aca=_0x203aca-0x0;var _0x64194=_0x99d3[_0x203aca];return _0x64194;};'use strict';var _=require('lodash');var util=require(_0x399d('0x0'));var logger=require(_0x399d('0x1'))('api');var moment=require(_0x399d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x399d('0x3'));var config=require(_0x399d('0x4'));var attributes=require(_0x399d('0x5'));module[_0x399d('0x6')]=function(_0x1eb595,_0x156fea){return _0x1eb595['define'](_0x399d('0x7'),attributes,{'tableName':_0x399d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6ff7eb,_0x15e66a,_0x44fa60){if(_0x6ff7eb['changed']('closed')){_0x6ff7eb[_0x399d('0x9')]=moment()[_0x399d('0xa')](_0x399d('0xb'));}_0x44fa60(null,_0x6ff7eb);}}});}; \ No newline at end of file +var _0x7711=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0xc64699,_0x1b3076){var _0x40732e=function(_0x23d369){while(--_0x23d369){_0xc64699['push'](_0xc64699['shift']());}};_0x40732e(++_0x1b3076);}(_0x7711,0x1b7));var _0x1771=function(_0x2a8da8,_0x402123){_0x2a8da8=_0x2a8da8-0x0;var _0x532a96=_0x7711[_0x2a8da8];return _0x532a96;};'use strict';var _=require(_0x1771('0x0'));var util=require(_0x1771('0x1'));var logger=require(_0x1771('0x2'))(_0x1771('0x3'));var moment=require(_0x1771('0x4'));var BPromise=require(_0x1771('0x5'));var rp=require(_0x1771('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1771('0x7'));var config=require(_0x1771('0x8'));var attributes=require(_0x1771('0x9'));module['exports']=function(_0x52daaa,_0x10051f){return _0x52daaa[_0x1771('0xa')](_0x1771('0xb'),attributes,{'tableName':_0x1771('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2efe8b,_0xbc995e,_0x4c9ba2){if(_0x2efe8b[_0x1771('0xd')](_0x1771('0xe'))){_0x2efe8b['closedAt']=moment()[_0x1771('0xf')](_0x1771('0x10'));}_0x4c9ba2(null,_0x2efe8b);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6f314c3..0428c0a 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 _0xd03a=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','where','attributes','stringify','AddTagsToSmsInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1527f6,_0x219a71){var _0x298d2d=function(_0x46a4ac){while(--_0x46a4ac){_0x1527f6['push'](_0x1527f6['shift']());}};_0x298d2d(++_0x219a71);}(_0xd03a,0x169));var _0xad03=function(_0x33b656,_0x5ecb2c){_0x33b656=_0x33b656-0x0;var _0x2e6687=_0xd03a[_0x33b656];return _0x2e6687;};'use strict';var _=require(_0xad03('0x0'));var util=require(_0xad03('0x1'));var moment=require(_0xad03('0x2'));var BPromise=require(_0xad03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad03('0x4'));var db=require(_0xad03('0x5'))['db'];var utils=require(_0xad03('0x6'));var logger=require(_0xad03('0x7'))(_0xad03('0x8'));var config=require(_0xad03('0x9'));var jayson=require(_0xad03('0xa'));var client=jayson[_0xad03('0xb')][_0xad03('0xc')]({'port':0x232a});config['redis']=_[_0xad03('0xd')](config[_0xad03('0xe')],{'host':_0xad03('0xf'),'port':0x18eb});var socket=require(_0xad03('0x10'))(new Redis(config[_0xad03('0xe')]));require(_0xad03('0x11'))[_0xad03('0x12')](socket);function respondWithRpcPromise(_0x254223,_0x509adf,_0x26543a){return new BPromise(function(_0x39b9dd,_0xeb9d58){return client['request'](_0x254223,_0x26543a)[_0xad03('0x13')](function(_0x5a0975){logger[_0xad03('0x14')](_0xad03('0x15'),_0x509adf,_0xad03('0x16'));logger[_0xad03('0x17')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x509adf,_0xad03('0x16'),JSON['stringify'](_0x5a0975));if(_0x5a0975[_0xad03('0x18')]){if(_0x5a0975[_0xad03('0x18')][_0xad03('0x19')]===0x1f4){logger['error'](_0xad03('0x15'),_0x509adf,_0x5a0975[_0xad03('0x18')]['message']);return _0xeb9d58(_0x5a0975[_0xad03('0x18')][_0xad03('0x1a')]);}logger[_0xad03('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x509adf,_0x5a0975['error'][_0xad03('0x1a')]);return _0x39b9dd(_0x5a0975['error'][_0xad03('0x1a')]);}else{logger[_0xad03('0x14')](_0xad03('0x15'),_0x509adf,'request\x20sent');_0x39b9dd(_0x5a0975[_0xad03('0x1b')]['message']);}})[_0xad03('0x1c')](function(_0x5aa53e){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x509adf,_0x5aa53e);_0xeb9d58(_0x5aa53e);});});}exports[_0xad03('0x1d')]=function(_0x3a4fec){var _0x5de09c=this;return new Promise(function(_0x55b4f0,_0x3e714e){return db[_0xad03('0x1e')]['update'](_0x3a4fec[_0xad03('0x1f')],{'raw':_0x3a4fec['options']?_0x3a4fec[_0xad03('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4fec[_0xad03('0x20')]?_0x3a4fec[_0xad03('0x20')][_0xad03('0x21')]||null:null,'attributes':_0x3a4fec[_0xad03('0x20')]?_0x3a4fec[_0xad03('0x20')][_0xad03('0x22')]||null:null,'limit':_0x3a4fec[_0xad03('0x20')]?_0x3a4fec[_0xad03('0x20')]['limit']||null:null})['then'](function(_0x3d004d){logger[_0xad03('0x14')](_0xad03('0x1d'),_0x3a4fec);logger[_0xad03('0x17')](_0xad03('0x1d'),_0x3a4fec,JSON[_0xad03('0x23')](_0x3d004d));_0x55b4f0(_0x3d004d);})['catch'](function(_0x56416b){logger[_0xad03('0x18')](_0xad03('0x1d'),_0x56416b['message'],_0x3a4fec);_0x3e714e(_0x5de09c[_0xad03('0x18')](0x1f4,_0x56416b[_0xad03('0x1a')]));});});};exports[_0xad03('0x24')]=function(_0x5ea02b){return new Promise(function(_0x4f4887,_0x1bc7d2){return db[_0xad03('0x1e')][_0xad03('0x25')]({'where':_0x5ea02b['options']?_0x5ea02b[_0xad03('0x20')]['where']||null:null})[_0xad03('0x13')](function(_0x3fb4bc){if(_0x3fb4bc){return _0x3fb4bc['addTags'](_0x5ea02b[_0xad03('0x1f')][_0xad03('0x26')],_[_0xad03('0x27')](_0x5ea02b[_0xad03('0x1f')],[_0xad03('0x26'),'id'])||{});}})['spread'](function(_0x1abb12){logger[_0xad03('0x14')](_0xad03('0x28'),_0x5ea02b);logger[_0xad03('0x17')](_0xad03('0x28'),_0x5ea02b,JSON[_0xad03('0x23')](_0x1abb12));_0x4f4887(_0x1abb12);})[_0xad03('0x1c')](function(_0x320a9c){logger[_0xad03('0x18')](_0xad03('0x28'),_0x320a9c[_0xad03('0x1a')],_0x5ea02b);_0x1bc7d2(_this[_0xad03('0x18')](0x1f4,_0x320a9c[_0xad03('0x1a')]));});});}; \ No newline at end of file +var _0xd311=['message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToSmsInteraction','find','ids','info','AddTags','lodash','util','moment','bluebird','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./smsInteraction.socket','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x15f99a,_0x5145a2){var _0x5b5152=function(_0x524e4d){while(--_0x524e4d){_0x15f99a['push'](_0x15f99a['shift']());}};_0x5b5152(++_0x5145a2);}(_0xd311,0x14b));var _0x1d31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd311[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1d31('0x0'));var util=require(_0x1d31('0x1'));var moment=require(_0x1d31('0x2'));var BPromise=require(_0x1d31('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1d31('0x4'));var config=require(_0x1d31('0x5'));var jayson=require(_0x1d31('0x6'));var client=jayson[_0x1d31('0x7')]['http']({'port':0x232a});config['redis']=_[_0x1d31('0x8')](config[_0x1d31('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d31('0xa'))(new Redis(config[_0x1d31('0x9')]));require(_0x1d31('0xb'))['register'](socket);function respondWithRpcPromise(_0x19348c,_0x365713,_0x1a6364){return new BPromise(function(_0x5e0fa4,_0x1924a4){return client['request'](_0x19348c,_0x1a6364)[_0x1d31('0xc')](function(_0x3f9600){logger['info'](_0x1d31('0xd'),_0x365713,_0x1d31('0xe'));logger['debug'](_0x1d31('0xf'),_0x365713,_0x1d31('0xe'),JSON[_0x1d31('0x10')](_0x3f9600));if(_0x3f9600[_0x1d31('0x11')]){if(_0x3f9600[_0x1d31('0x11')][_0x1d31('0x12')]===0x1f4){logger[_0x1d31('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x365713,_0x3f9600[_0x1d31('0x11')][_0x1d31('0x13')]);return _0x1924a4(_0x3f9600[_0x1d31('0x11')][_0x1d31('0x13')]);}logger[_0x1d31('0x11')](_0x1d31('0xd'),_0x365713,_0x3f9600[_0x1d31('0x11')]['message']);return _0x5e0fa4(_0x3f9600[_0x1d31('0x11')][_0x1d31('0x13')]);}else{logger['info'](_0x1d31('0xd'),_0x365713,_0x1d31('0xe'));_0x5e0fa4(_0x3f9600['result']['message']);}})[_0x1d31('0x14')](function(_0x53969a){logger[_0x1d31('0x11')](_0x1d31('0xd'),_0x365713,_0x53969a);_0x1924a4(_0x53969a);});});}exports[_0x1d31('0x15')]=function(_0x417889){var _0x152a2e=this;return new Promise(function(_0x505856,_0x37ad5d){return db[_0x1d31('0x16')][_0x1d31('0x17')](_0x417889[_0x1d31('0x18')],{'raw':_0x417889[_0x1d31('0x19')]?_0x417889['options'][_0x1d31('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417889[_0x1d31('0x19')]?_0x417889[_0x1d31('0x19')]['where']||null:null,'attributes':_0x417889[_0x1d31('0x19')]?_0x417889[_0x1d31('0x19')][_0x1d31('0x1b')]||null:null,'limit':_0x417889[_0x1d31('0x19')]?_0x417889[_0x1d31('0x19')][_0x1d31('0x1c')]||null:null})['then'](function(_0x4609e7){logger['info']('UpdateSmsInteraction',_0x417889);logger[_0x1d31('0x1d')](_0x1d31('0x15'),_0x417889,JSON['stringify'](_0x4609e7));_0x505856(_0x4609e7);})['catch'](function(_0xe11579){logger['error']('UpdateSmsInteraction',_0xe11579[_0x1d31('0x13')],_0x417889);_0x37ad5d(_0x152a2e[_0x1d31('0x11')](0x1f4,_0xe11579[_0x1d31('0x13')]));});});};exports[_0x1d31('0x1e')]=function(_0x42af11){return new Promise(function(_0x170531,_0x4e2468){return db['SmsInteraction'][_0x1d31('0x1f')]({'where':_0x42af11['options']?_0x42af11[_0x1d31('0x19')]['where']||null:null})[_0x1d31('0xc')](function(_0x8182d7){if(_0x8182d7){return _0x8182d7['addTags'](_0x42af11[_0x1d31('0x18')][_0x1d31('0x20')],_['omit'](_0x42af11[_0x1d31('0x18')],['ids','id'])||{});}})['spread'](function(_0xefa2e8){logger[_0x1d31('0x21')](_0x1d31('0x22'),_0x42af11);logger['debug'](_0x1d31('0x22'),_0x42af11,JSON['stringify'](_0xefa2e8));_0x170531(_0xefa2e8);})[_0x1d31('0x14')](function(_0x1c420e){logger['error']('AddTags',_0x1c420e['message'],_0x42af11);_0x4e2468(_this[_0x1d31('0x11')](0x1f4,_0x1c420e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 2b52c76..56dbd69 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 _0x8531=['./smsInteraction.events','remove','update','register','length'];(function(_0x88450f,_0x43830b){var _0x5ef218=function(_0x99a882){while(--_0x99a882){_0x88450f['push'](_0x88450f['shift']());}};_0x5ef218(++_0x43830b);}(_0x8531,0x10e));var _0x1853=function(_0x57532c,_0x2c75cf){_0x57532c=_0x57532c-0x0;var _0x5cb9a6=_0x8531[_0x57532c];return _0x5cb9a6;};'use strict';var SmsInteractionEvents=require(_0x1853('0x0'));var events=['save',_0x1853('0x1'),_0x1853('0x2')];function createListener(_0x4b8ce7,_0x570681){return function(_0x4e8cbc){_0x570681['emit'](_0x4b8ce7,_0x4e8cbc);};}function removeListener(_0x203dae,_0x380f01){return function(){SmsInteractionEvents['removeListener'](_0x203dae,_0x380f01);};}exports[_0x1853('0x3')]=function(_0x7a7dc){for(var _0x4cc630=0x0,_0x445cc6=events[_0x1853('0x4')];_0x4cc630<_0x445cc6;_0x4cc630++){var _0x13fbd=events[_0x4cc630];var _0xb8cc33=createListener('smsInteraction:'+_0x13fbd,_0x7a7dc);SmsInteractionEvents['on'](_0x13fbd,_0xb8cc33);}}; \ No newline at end of file +var _0x30c3=['remove','removeListener','smsInteraction:','./smsInteraction.events','save'];(function(_0x248aec,_0x4a6955){var _0x1c8a15=function(_0x20c1af){while(--_0x20c1af){_0x248aec['push'](_0x248aec['shift']());}};_0x1c8a15(++_0x4a6955);}(_0x30c3,0xd0));var _0x330c=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0x30c3[_0x379799];return _0x46e431;};'use strict';var SmsInteractionEvents=require(_0x330c('0x0'));var events=[_0x330c('0x1'),_0x330c('0x2'),'update'];function createListener(_0x433f41,_0x29f549){return function(_0x38b827){_0x29f549['emit'](_0x433f41,_0x38b827);};}function removeListener(_0x40c434,_0x12c957){return function(){SmsInteractionEvents[_0x330c('0x3')](_0x40c434,_0x12c957);};}exports['register']=function(_0x125553){for(var _0xfabf9c=0x0,_0x43a114=events['length'];_0xfabf9c<_0x43a114;_0xfabf9c++){var _0x322c80=events[_0xfabf9c];var _0x52b41c=createListener(_0x330c('0x4')+_0x322c80,_0x125553);SmsInteractionEvents['on'](_0x322c80,_0x52b41c);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 097bae3..38e1f91 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 _0x22f3=['../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x2d1881,_0x448271){var _0x161dee=function(_0x529611){while(--_0x529611){_0x2d1881['push'](_0x2d1881['shift']());}};_0x161dee(++_0x448271);}(_0x22f3,0x155));var _0x322f=function(_0xe8f4f7,_0x186f7a){_0xe8f4f7=_0xe8f4f7-0x0;var _0x14b2ce=_0x22f3[_0xe8f4f7];return _0x14b2ce;};'use strict';var multer=require(_0x322f('0x0'));var util=require(_0x322f('0x1'));var path=require(_0x322f('0x2'));var timeout=require(_0x322f('0x3'));var express=require(_0x322f('0x4'));var router=express['Router']();var fs_extra=require(_0x322f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x322f('0x6'));var config=require(_0x322f('0x7'));var controller=require('./smsMessage.controller');router[_0x322f('0x8')]('/',auth['isAuthenticated'](),controller[_0x322f('0x9')]);router['get'](_0x322f('0xa'),auth['isAuthenticated'](),controller[_0x322f('0xb')]);router[_0x322f('0x8')](_0x322f('0xc'),auth[_0x322f('0xd')](),controller[_0x322f('0xe')]);router[_0x322f('0xf')]('/',auth[_0x322f('0xd')](),interaction[_0x322f('0x10')](_0x322f('0x11'),_0x322f('0x12')),controller[_0x322f('0x13')]);router['post'](_0x322f('0x14'),controller[_0x322f('0x15')]);router[_0x322f('0x16')](_0x322f('0xc'),auth[_0x322f('0xd')](),controller[_0x322f('0x17')]);router[_0x322f('0x16')]('/:id/accept',auth[_0x322f('0xd')](),controller[_0x322f('0x18')]);router[_0x322f('0x16')](_0x322f('0x19'),auth[_0x322f('0xd')](),controller[_0x322f('0x1a')]);router[_0x322f('0x1b')](_0x322f('0xc'),auth['isAuthenticated'](),controller[_0x322f('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x4cc7=['put','update','accept','/:id/reject','reject','delete','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status'];(function(_0x27a1e0,_0x3ff2cb){var _0x1ca624=function(_0x435802){while(--_0x435802){_0x27a1e0['push'](_0x27a1e0['shift']());}};_0x1ca624(++_0x3ff2cb);}(_0x4cc7,0xe6));var _0x74cc=function(_0x5e5966,_0x150414){_0x5e5966=_0x5e5966-0x0;var _0x45077f=_0x4cc7[_0x5e5966];return _0x45077f;};'use strict';var multer=require('multer');var util=require(_0x74cc('0x0'));var path=require('path');var timeout=require(_0x74cc('0x1'));var express=require(_0x74cc('0x2'));var router=express[_0x74cc('0x3')]();var fs_extra=require(_0x74cc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x74cc('0x5'));var config=require(_0x74cc('0x6'));var controller=require(_0x74cc('0x7'));router['get']('/',auth[_0x74cc('0x8')](),controller[_0x74cc('0x9')]);router[_0x74cc('0xa')](_0x74cc('0xb'),auth[_0x74cc('0x8')](),controller[_0x74cc('0xc')]);router[_0x74cc('0xa')](_0x74cc('0xd'),auth[_0x74cc('0x8')](),controller[_0x74cc('0xe')]);router[_0x74cc('0xf')]('/',auth[_0x74cc('0x8')](),interaction[_0x74cc('0x10')](_0x74cc('0x11'),_0x74cc('0x12')),controller[_0x74cc('0x13')]);router[_0x74cc('0xf')](_0x74cc('0x14'),controller[_0x74cc('0x15')]);router[_0x74cc('0x16')]('/:id',auth[_0x74cc('0x8')](),controller[_0x74cc('0x17')]);router[_0x74cc('0x16')]('/:id/accept',auth[_0x74cc('0x8')](),controller[_0x74cc('0x18')]);router[_0x74cc('0x16')](_0x74cc('0x19'),auth[_0x74cc('0x8')](),controller[_0x74cc('0x1a')]);router[_0x74cc('0x1b')]('/:id',auth[_0x74cc('0x8')](),controller['destroy']);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 42a0d9f..3284b08 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 _0x468a=['exports','medium','ENUM','out','STRING','DATE','TEXT'];(function(_0x46adce,_0x4ef8ec){var _0x1a2a19=function(_0x50e973){while(--_0x50e973){_0x46adce['push'](_0x46adce['shift']());}};_0x1a2a19(++_0x4ef8ec);}(_0x468a,0x13b));var _0xa468=function(_0x1e94dc,_0x59fa52){_0x1e94dc=_0x1e94dc-0x0;var _0x37b61f=_0x468a[_0x1e94dc];return _0x37b61f;};'use strict';var Sequelize=require('sequelize');module[_0xa468('0x0')]={'body':{'type':Sequelize['TEXT'](_0xa468('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa468('0x2')]('in','out'),'defaultValue':_0xa468('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa468('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa468('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa468('0x6')]}}; \ No newline at end of file +var _0x2908=['exports','TEXT','medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x2a59af,_0x18d558){var _0x3af243=function(_0x5480d6){while(--_0x5480d6){_0x2a59af['push'](_0x2a59af['shift']());}};_0x3af243(++_0x18d558);}(_0x2908,0x1ef));var _0x8290=function(_0x358e0d,_0x32796a){_0x358e0d=_0x358e0d-0x0;var _0xd70075=_0x2908[_0x358e0d];return _0xd70075;};'use strict';var Sequelize=require(_0x8290('0x0'));module[_0x8290('0x1')]={'body':{'type':Sequelize[_0x8290('0x2')](_0x8290('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8290('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x8290('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x8290('0x6')]},'readAt':{'type':Sequelize[_0x8290('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8290('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 2bc71c8..ce2a723 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 _0x14d8=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','show','params','length','find','create','body','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','manual','interface','SIP/%s','motionChannel','event','EventManager','sms','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','internal','channel','rejectmessage','SmsAccount','SmsAccountId','debug','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','squel'];(function(_0x2a5c5e,_0x524268){var _0x48df48=function(_0x4f8ddc){while(--_0x4f8ddc){_0x2a5c5e['push'](_0x2a5c5e['shift']());}};_0x48df48(++_0x524268);}(_0x14d8,0x87));var _0x814d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x14d8[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x814d('0x0'));var rimraf=require(_0x814d('0x1'));var zipdir=require(_0x814d('0x2'));var jsonpatch=require(_0x814d('0x3'));var rp=require(_0x814d('0x4'));var moment=require(_0x814d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x814d('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x814d('0x7'));var ejs=require(_0x814d('0x8'));var fs=require('fs');var fs_extra=require(_0x814d('0x9'));var _=require('lodash');var squel=require(_0x814d('0xa'));var crypto=require(_0x814d('0xb'));var jsforce=require(_0x814d('0xc'));var deskjs=require(_0x814d('0xd'));var toCsv=require(_0x814d('0x7'));var querystring=require(_0x814d('0xe'));var Papa=require(_0x814d('0xf'));var Redis=require('ioredis');var authService=require(_0x814d('0x10'));var qs=require(_0x814d('0x11'));var as=require(_0x814d('0x12'));var hardwareService=require(_0x814d('0x13'));var logger=require(_0x814d('0x14'))(_0x814d('0x15'));var utils=require(_0x814d('0x16'));var config=require(_0x814d('0x17'));var licenseUtil=require(_0x814d('0x18'));var db=require(_0x814d('0x19'))['db'];config[_0x814d('0x1a')]=_[_0x814d('0x1b')](config[_0x814d('0x1a')],{'host':_0x814d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x814d('0x1a')]));require(_0x814d('0x1d'))[_0x814d('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x814d('0x1f')][_0x814d('0x20')]({'port':0x232c});var client9002=jayson[_0x814d('0x1f')][_0x814d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x19ccd8,_0x2b6518,_0x502f27,_0x1641c7){return new BPromise(function(_0x29a4e2,_0x93914){var _0x57ccaa=_0x1641c7||client;return _0x57ccaa[_0x814d('0x21')](_0x19ccd8,_0x502f27)[_0x814d('0x22')](function(_0x54fd21){logger[_0x814d('0x23')](_0x814d('0x24'),_0x2b6518,_0x814d('0x25'));logger['debug'](_0x814d('0x26'),_0x2b6518,_0x814d('0x25'),JSON[_0x814d('0x27')](_0x54fd21));if(_0x54fd21[_0x814d('0x28')]){if(_0x54fd21[_0x814d('0x28')][_0x814d('0x29')]===0x1f4){logger[_0x814d('0x28')]('SmsMessage,\x20%s,\x20%s',_0x2b6518,_0x54fd21[_0x814d('0x28')][_0x814d('0x2a')]);return _0x93914(_0x54fd21[_0x814d('0x28')][_0x814d('0x2a')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x2b6518,_0x54fd21[_0x814d('0x28')][_0x814d('0x2a')]);return _0x29a4e2(_0x54fd21[_0x814d('0x28')][_0x814d('0x2a')]);}else{logger[_0x814d('0x23')]('SmsMessage,\x20%s,\x20%s',_0x2b6518,_0x814d('0x25'));_0x29a4e2(_0x54fd21[_0x814d('0x2b')][_0x814d('0x2a')]);}})[_0x814d('0x2c')](function(_0x56e809){logger[_0x814d('0x28')]('SmsMessage,\x20%s,\x20%s',_0x2b6518,_0x56e809);_0x93914(_0x56e809);});});}function respondWithStatusCode(_0x4d5277,_0x5007d9){_0x5007d9=_0x5007d9||0xcc;return function(_0x50a9e8){if(_0x50a9e8){return _0x4d5277[_0x814d('0x2d')](_0x5007d9);}return _0x4d5277[_0x814d('0x2e')](_0x5007d9)[_0x814d('0x2f')]();};}function respondWithResult(_0x31e143,_0x48afd6){_0x48afd6=_0x48afd6||0xc8;return function(_0x270bb2){if(_0x270bb2){return _0x31e143['status'](_0x48afd6)[_0x814d('0x30')](_0x270bb2);}};}function respondWithFilteredResult(_0x387acb,_0x23c9ab){return function(_0x3522ae){if(_0x3522ae){var _0x1cf59b=typeof _0x23c9ab[_0x814d('0x31')]===_0x814d('0x32')&&typeof _0x23c9ab[_0x814d('0x33')]===_0x814d('0x32');var _0x50326c=_0x3522ae[_0x814d('0x34')];var _0x345173=_0x1cf59b?0x0:_0x23c9ab['offset'];var _0x120d5c=_0x1cf59b?_0x3522ae[_0x814d('0x34')]:_0x23c9ab['offset']+_0x23c9ab['limit'];var _0x3e3d43;if(_0x120d5c>=_0x50326c){_0x120d5c=_0x50326c;_0x3e3d43=0xc8;}else{_0x3e3d43=0xce;}_0x387acb[_0x814d('0x2e')](_0x3e3d43);return _0x387acb['set']('Content-Range',_0x345173+'-'+_0x120d5c+'/'+_0x50326c)[_0x814d('0x30')](_0x3522ae);}return null;};}function patchUpdates(_0x10ac64){return function(_0xccdbd3){try{jsonpatch[_0x814d('0x35')](_0xccdbd3,_0x10ac64,!![]);}catch(_0x5498aa){return BPromise[_0x814d('0x36')](_0x5498aa);}return _0xccdbd3[_0x814d('0x37')]();};}function saveUpdates(_0x13f0c3,_0xc27d4e){return function(_0x424d77){if(_0x424d77){return _0x424d77[_0x814d('0x38')](_0x13f0c3)['then'](function(_0x5eff7f){return _0x5eff7f;});}return null;};}function removeEntity(_0x4a611d,_0x3f50a9){return function(_0x35c5f5){if(_0x35c5f5){return _0x35c5f5[_0x814d('0x39')]()[_0x814d('0x22')](function(){_0x4a611d[_0x814d('0x2e')](0xcc)[_0x814d('0x2f')]();});}};}function handleEntityNotFound(_0xde69fe,_0x2665c4){return function(_0x1a222a){if(!_0x1a222a){_0xde69fe[_0x814d('0x2d')](0x194);}return _0x1a222a;};}function handleError(_0x274ac0,_0x29eb5d){_0x29eb5d=_0x29eb5d||0x1f4;return function(_0x45dee6){logger[_0x814d('0x28')](_0x45dee6[_0x814d('0x3a')]);if(_0x45dee6['name']){delete _0x45dee6[_0x814d('0x3b')];}_0x274ac0[_0x814d('0x2e')](_0x29eb5d)[_0x814d('0x3c')](_0x45dee6);};}exports[_0x814d('0x3d')]=function(_0x39a1ec,_0x1ef068){var _0x4014ec={},_0x41f859={},_0x34a120={'count':0x0,'rows':[]};var _0x10bd7c=_[_0x814d('0x3e')](db[_0x814d('0x3f')][_0x814d('0x40')],function(_0x30b278){return{'name':_0x30b278['fieldName'],'type':_0x30b278[_0x814d('0x41')][_0x814d('0x42')]};});_0x41f859[_0x814d('0x43')]=_['map'](_0x10bd7c,_0x814d('0x3b'));_0x41f859[_0x814d('0x44')]=_[_0x814d('0x45')](_0x39a1ec['query']);_0x41f859[_0x814d('0x46')]=_[_0x814d('0x47')](_0x41f859[_0x814d('0x43')],_0x41f859['query']);_0x4014ec[_0x814d('0x48')]=_[_0x814d('0x47')](_0x41f859['model'],qs[_0x814d('0x49')](_0x39a1ec[_0x814d('0x44')]['fields']));_0x4014ec[_0x814d('0x48')]=_0x4014ec[_0x814d('0x48')]['length']?_0x4014ec[_0x814d('0x48')]:_0x41f859[_0x814d('0x43')];if(!_0x39a1ec[_0x814d('0x44')][_0x814d('0x4a')](_0x814d('0x4b'))){_0x4014ec['limit']=qs[_0x814d('0x33')](_0x39a1ec[_0x814d('0x44')]['limit']);_0x4014ec[_0x814d('0x31')]=qs[_0x814d('0x31')](_0x39a1ec[_0x814d('0x44')]['offset']);}_0x4014ec[_0x814d('0x4c')]=qs['sort'](_0x39a1ec[_0x814d('0x44')][_0x814d('0x4d')]);_0x4014ec[_0x814d('0x4e')]=qs[_0x814d('0x46')](_[_0x814d('0x4f')](_0x39a1ec[_0x814d('0x44')],_0x41f859[_0x814d('0x46')]),_0x10bd7c);if(_0x39a1ec[_0x814d('0x44')]['filter']){_0x4014ec['where']=_[_0x814d('0x50')](_0x4014ec[_0x814d('0x4e')],{'$or':_[_0x814d('0x3e')](_0x10bd7c,function(_0x3f2473){if(_0x3f2473[_0x814d('0x41')]!=='VIRTUAL'){var _0x108a62={};_0x108a62[_0x3f2473[_0x814d('0x3b')]]={'$like':'%'+_0x39a1ec['query']['filter']+'%'};return _0x108a62;}})});}_0x4014ec=_['merge']({},_0x4014ec,_0x39a1ec[_0x814d('0x51')]);var _0x1a4ad5={'where':_0x4014ec[_0x814d('0x4e')]};return db[_0x814d('0x3f')][_0x814d('0x34')](_0x1a4ad5)[_0x814d('0x22')](function(_0x5b2f41){_0x34a120[_0x814d('0x34')]=_0x5b2f41;if(_0x39a1ec['query'][_0x814d('0x52')]){_0x4014ec[_0x814d('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0x814d('0x54')](_0x4014ec);})[_0x814d('0x22')](function(_0xae784f){_0x34a120['rows']=_0xae784f;return _0x34a120;})['then'](respondWithFilteredResult(_0x1ef068,_0x4014ec))[_0x814d('0x2c')](handleError(_0x1ef068,null));};exports[_0x814d('0x55')]=function(_0x40d50a,_0x577c53){var _0x4a54aa={'raw':!![],'where':{'id':_0x40d50a[_0x814d('0x56')]['id']}},_0x21edd5={};_0x21edd5['model']=_[_0x814d('0x45')](db[_0x814d('0x3f')][_0x814d('0x40')]);_0x21edd5[_0x814d('0x44')]=_[_0x814d('0x45')](_0x40d50a[_0x814d('0x44')]);_0x21edd5[_0x814d('0x46')]=_['intersection'](_0x21edd5[_0x814d('0x43')],_0x21edd5['query']);_0x4a54aa[_0x814d('0x48')]=_['intersection'](_0x21edd5[_0x814d('0x43')],qs[_0x814d('0x49')](_0x40d50a[_0x814d('0x44')][_0x814d('0x49')]));_0x4a54aa[_0x814d('0x48')]=_0x4a54aa[_0x814d('0x48')][_0x814d('0x57')]?_0x4a54aa[_0x814d('0x48')]:_0x21edd5[_0x814d('0x43')];if(_0x40d50a[_0x814d('0x44')]['includeAll']){_0x4a54aa['include']=[{'all':!![]}];}_0x4a54aa=_['merge']({},_0x4a54aa,_0x40d50a[_0x814d('0x51')]);return db['SmsMessage'][_0x814d('0x58')](_0x4a54aa)[_0x814d('0x22')](handleEntityNotFound(_0x577c53,null))['then'](respondWithResult(_0x577c53,null))[_0x814d('0x2c')](handleError(_0x577c53,null));};exports['create']=function(_0x2439f1,_0x54db56){return db[_0x814d('0x3f')][_0x814d('0x59')](_0x2439f1[_0x814d('0x5a')],{})[_0x814d('0x22')](respondWithResult(_0x54db56,0xc9))[_0x814d('0x2c')](handleError(_0x54db56,null));};exports[_0x814d('0x38')]=function(_0x4bf2ef,_0x23299b){if(_0x4bf2ef[_0x814d('0x5a')]['id']){delete _0x4bf2ef[_0x814d('0x5a')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x4bf2ef[_0x814d('0x56')]['id']}})[_0x814d('0x22')](handleEntityNotFound(_0x23299b,null))['then'](saveUpdates(_0x4bf2ef['body'],null))['then'](respondWithResult(_0x23299b,null))['catch'](handleError(_0x23299b,null));};exports[_0x814d('0x39')]=function(_0x76475f,_0x4b7940){return db[_0x814d('0x3f')]['find']({'where':{'id':_0x76475f[_0x814d('0x56')]['id']}})[_0x814d('0x22')](handleEntityNotFound(_0x4b7940,null))[_0x814d('0x22')](removeEntity(_0x4b7940,null))[_0x814d('0x2c')](handleError(_0x4b7940,null));};exports['describe']=function(_0x56996a,_0x41f651){return db[_0x814d('0x3f')][_0x814d('0x5b')]()[_0x814d('0x22')](respondWithResult(_0x41f651,null))[_0x814d('0x2c')](handleError(_0x41f651,null));};var interaction_log=require(_0x814d('0x14'))(_0x814d('0x5c'));exports[_0x814d('0x5d')]=function(_0x5a8569,_0xd06c1c,_0xb723db){var _0x3e877a={'agent':{},'channel':'sms'};if(_0x5a8569['body']['id']){delete _0x5a8569['body']['id'];}_0x5a8569[_0x814d('0x5a')][_0x814d('0x5e')]=!![];_0x5a8569[_0x814d('0x5a')][_0x814d('0x5f')]=moment()[_0x814d('0x60')](_0x814d('0x61'));_0x5a8569[_0x814d('0x5a')][_0x814d('0x62')]=_0x5a8569[_0x814d('0x5a')][_0x814d('0x62')]||_0x5a8569[_0x814d('0x63')]['id'];_0x3e877a[_0x814d('0x64')]['id']=_0x5a8569['body'][_0x814d('0x62')];return db[_0x814d('0x3f')][_0x814d('0x58')]({'where':{'id':_0x5a8569[_0x814d('0x56')]['id'],'UserId':null}})[_0x814d('0x22')](handleEntityNotFound(_0xd06c1c,null))[_0x814d('0x22')](saveUpdates(_0x5a8569[_0x814d('0x5a')],null))[_0x814d('0x22')](function(_0x145024){if(_0x145024){_0x3e877a['message']=_0x145024['get']({'plain':!![]});return db[_0x814d('0x65')]['find']({'where':{'id':_0x145024['SmsInteractionId']}});}return null;})[_0x814d('0x22')](handleEntityNotFound(_0xd06c1c,null))[_0x814d('0x22')](function(_0x52df08){if(_0x52df08){return _0x52df08[_0x814d('0x38')]({'UserId':_0x5a8569[_0x814d('0x5a')][_0x814d('0x62')],'read1stAt':_['isNil'](_0x52df08[_0x814d('0x66')])?moment()[_0x814d('0x60')](_0x814d('0x61')):undefined});}return null;})[_0x814d('0x22')](function(_0x4c7a21){if(_0x4c7a21){_0x3e877a[_0x814d('0x67')]=_0x4c7a21[_0x814d('0x68')]({'plain':!![]});interaction_log[_0x814d('0x23')](_0x814d('0x69'),_0x5a8569[_0x814d('0x63')]['id'],_0x5a8569[_0x814d('0x63')]['name'],_0x5a8569[_0x814d('0x63')][_0x814d('0x6a')],_0x3e877a['interaction']['id'],_0x5a8569['body']?JSON['stringify'](_0x5a8569['body']):_0x814d('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x814d('0x6c'),_0x3e877a);}return null;})[_0x814d('0x22')](function(_0x3175cb){var _0x20db6e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3175cb[_0x814d('0x2a')][_0x814d('0x6d')];return db[_0x814d('0x6e')][_0x814d('0x44')](_0x20db6e,{'type':db[_0x814d('0x6f')][_0x814d('0x70')][_0x814d('0x71')],'raw':!![]})['then'](function(_0x131677){return _0x131677;});})[_0x814d('0x22')](function(_0x437072){if(_0x437072){_0x3e877a[_0x814d('0x2a')][_0x814d('0x72')]=_0x437072[0x0];if(!_0x5a8569[_0x814d('0x5a')]['UserId'])return;return db[_0x814d('0x73')][_0x814d('0x58')]({'where':{'id':_0x5a8569[_0x814d('0x5a')][_0x814d('0x62')],'role':_0x814d('0x64')},'attributes':['id',_0x814d('0x3b'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x814d('0x22')](function(_0x3d2403){if(!_0x3d2403)return null;_0x3e877a[_0x814d('0x2a')][_0x814d('0x64')]=_0x3d2403;return _0x3e877a;})[_0x814d('0x22')](function(_0x2981e4){if(_0x2981e4){if(_0x5a8569['body'][_0x814d('0x74')]){_0x3e877a[_0x814d('0x2a')][_0x814d('0x75')]=util[_0x814d('0x60')](_0x814d('0x76'),_0x5a8569[_0x814d('0x63')][_0x814d('0x3b')]);_0x3e877a['message']['channel']=_0x3e877a['channel'];_0x3e877a[_0x814d('0x2a')][_0x814d('0x77')]=_0x3e877a['channel'];_0x3e877a['message'][_0x814d('0x78')]=_0x814d('0x5d');return respondWithRpcPromise(_0x814d('0x79'),'EventManager',{'event':'acceptmessage','message':_0x3e877a[_0x814d('0x2a')]},client9002)['then'](function(){return _0x3e877a;});}return _0x3e877a;}return null;})[_0x814d('0x22')](respondWithResult(_0xd06c1c,null))['catch'](handleError(_0xd06c1c,null));};var interaction_log=require(_0x814d('0x14'))('sms-interactions');exports[_0x814d('0x36')]=function(_0x5d14ec,_0x3f34a6,_0x266e0e){var _0x3e99d9={'agent':{},'channel':_0x814d('0x7a')};if(_0x5d14ec['body']['id']){delete _0x5d14ec[_0x814d('0x5a')]['id'];}_0x5d14ec['body']['UserId']=_0x5d14ec[_0x814d('0x5a')][_0x814d('0x62')]||_0x5d14ec[_0x814d('0x63')]['id'];_0x3e99d9[_0x814d('0x64')]['id']=_0x5d14ec['body'][_0x814d('0x62')];return db['SmsMessage'][_0x814d('0x58')]({'where':{'id':_0x5d14ec[_0x814d('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f34a6,null))['then'](function(_0x412ef4){if(_0x412ef4){_0x3e99d9[_0x814d('0x2a')]=_0x412ef4[_0x814d('0x68')]({'plain':!![]});return db[_0x814d('0x65')]['find']({'where':{'id':_0x412ef4['SmsInteractionId']}});}return null;})[_0x814d('0x22')](handleEntityNotFound(_0x3f34a6,null))[_0x814d('0x22')](function(_0x5a317f){if(_0x5a317f){_0x3e99d9[_0x814d('0x67')]=_0x5a317f[_0x814d('0x68')]({'plain':!![]});interaction_log[_0x814d('0x23')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5d14ec[_0x814d('0x63')]['id'],_0x5d14ec[_0x814d('0x63')]['name'],_0x5d14ec['user'][_0x814d('0x6a')],_0x3e99d9['interaction']['id'],_0x5d14ec[_0x814d('0x5a')]?JSON[_0x814d('0x27')](_0x5d14ec[_0x814d('0x5a')]):_0x814d('0x6b'));return respondWithRpcPromise('RejectMessage',_0x814d('0x7b'),_0x3e99d9);}return null;})['then'](function(_0xe644a2){var _0x88b62d=_0x814d('0x7c')+_0xe644a2['message'][_0x814d('0x6d')];return db[_0x814d('0x6e')][_0x814d('0x44')](_0x88b62d,{'type':db[_0x814d('0x6f')][_0x814d('0x70')]['SELECT'],'raw':!![]})[_0x814d('0x22')](function(_0x5a6af9){return _0x5a6af9;});})[_0x814d('0x22')](function(_0x4c661f){if(_0x4c661f){_0x3e99d9[_0x814d('0x2a')]['contact']=_0x4c661f[0x0];if(!_0x5d14ec[_0x814d('0x5a')][_0x814d('0x62')])return;return db[_0x814d('0x73')][_0x814d('0x58')]({'where':{'id':_0x5d14ec['body'][_0x814d('0x62')],'role':_0x814d('0x64')},'attributes':['id',_0x814d('0x3b'),'fullname',_0x814d('0x7d'),_0x814d('0x7e')],'raw':!![]});}return null;})[_0x814d('0x22')](function(_0x1d6954){if(!_0x1d6954)return null;_0x3e99d9[_0x814d('0x2a')][_0x814d('0x64')]=_0x1d6954;return _0x3e99d9;})[_0x814d('0x22')](function(_0x228ad4){if(_0x228ad4){_0x228ad4[_0x814d('0x2a')][_0x814d('0x75')]=util[_0x814d('0x60')](_0x814d('0x76'),_0x5d14ec[_0x814d('0x63')][_0x814d('0x3b')]);_0x228ad4[_0x814d('0x2a')][_0x814d('0x7f')]=_0x3e99d9[_0x814d('0x7f')];_0x228ad4['message'][_0x814d('0x77')]=_0x3e99d9[_0x814d('0x7f')];_0x228ad4[_0x814d('0x2a')][_0x814d('0x78')]='reject';respondWithRpcPromise(_0x814d('0x79'),_0x814d('0x79'),{'event':_0x814d('0x80'),'message':_0x228ad4[_0x814d('0x2a')]},client9002);return _0x3e99d9;}return null;})[_0x814d('0x22')](respondWithResult(_0x3f34a6,null))[_0x814d('0x2c')](handleError(_0x3f34a6,null));};exports[_0x814d('0x2e')]=function(_0x4500e0,_0x860c14,_0x19f14c){if(_0x4500e0[_0x814d('0x5a')]['id']){delete _0x4500e0[_0x814d('0x5a')]['id'];}var _0x261bf7;return db[_0x814d('0x3f')][_0x814d('0x58')]({'where':{'id':_0x4500e0['params']['id']}})[_0x814d('0x22')](handleEntityNotFound(_0x860c14,null))['then'](function(_0x325e35){if(_0x325e35){_0x261bf7=_0x325e35;return db[_0x814d('0x81')]['find']({'where':{'id':_0x325e35[_0x814d('0x82')]}});}})[_0x814d('0x22')](handleEntityNotFound(_0x860c14,null))[_0x814d('0x22')](function(_0x4fbca3){if(_0x4fbca3){logger[_0x814d('0x83')](_0x814d('0x26'),'status','received\x20delivery\x20report\x20from',_0x4fbca3[_0x814d('0x41')],util[_0x814d('0x84')](_0x4500e0[_0x814d('0x5a')],{'showHidden':![],'depth':null}));switch(_0x4fbca3[_0x814d('0x41')]){case _0x814d('0x85'):if(_0x4500e0['body'][_0x814d('0x86')]&&_0x4500e0['body']['MessageSid']===_0x261bf7[_0x814d('0x87')]){return _0x261bf7['update']({'read':!![]});}else{logger[_0x814d('0x28')](_0x814d('0x88'),_0x814d('0x2e'),_0x814d('0x85'),util['inspect'](_0x4500e0[_0x814d('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x814d('0x89'):if(_0x4500e0[_0x814d('0x5a')]['MessageUUID']&&_0x4500e0[_0x814d('0x5a')][_0x814d('0x8a')]===_0x261bf7[_0x814d('0x87')]&&_[_0x814d('0x8b')]([_0x814d('0x8c'),_0x814d('0x8d')],_0x4500e0[_0x814d('0x5a')][_0x814d('0x8e')])>=0x0){return _0x261bf7['update']({'read':!![]});}else{logger[_0x814d('0x28')](_0x814d('0x88'),_0x814d('0x2e'),_0x814d('0x8f'),util[_0x814d('0x84')](_0x4500e0['body'],{'showHidden':![],'depth':null}));}break;case _0x814d('0x90'):var _0x2f9e7b=_0x4500e0[_0x814d('0x5a')]['results'][0x0];if(_0x2f9e7b[_0x814d('0x2e')]['groupName']===_0x814d('0x91')){return _0x261bf7['update']({'read':!![]});}else{logger[_0x814d('0x28')](_0x814d('0x88'),_0x814d('0x2e'),_0x814d('0x90'),util[_0x814d('0x84')](_0x4500e0['body'],{'showHidden':![],'depth':null}));}break;}return _0x261bf7;}})[_0x814d('0x22')](respondWithResult(_0x860c14,null))[_0x814d('0x2c')](handleError(_0x860c14,null));}; \ No newline at end of file +var _0xce62=['../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','undefined','count','offset','limit','set','json','reject','save','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','update','isNil','read1stAt','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','sms','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','internal','motionChannel','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','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/parsers/qs','../../config/logger'];(function(_0x4a8620,_0x457594){var _0x47ae3b=function(_0x415ed6){while(--_0x415ed6){_0x4a8620['push'](_0x4a8620['shift']());}};_0x47ae3b(++_0x457594);}(_0xce62,0x83));var _0x2ce6=function(_0x4e7fa5,_0x2e5fd6){_0x4e7fa5=_0x4e7fa5-0x0;var _0x15b4b4=_0xce62[_0x4e7fa5];return _0x15b4b4;};'use strict';var emlformat=require(_0x2ce6('0x0'));var rimraf=require(_0x2ce6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ce6('0x2'));var rp=require(_0x2ce6('0x3'));var moment=require(_0x2ce6('0x4'));var BPromise=require(_0x2ce6('0x5'));var Mustache=require(_0x2ce6('0x6'));var util=require(_0x2ce6('0x7'));var path=require('path');var sox=require(_0x2ce6('0x8'));var csv=require(_0x2ce6('0x9'));var ejs=require(_0x2ce6('0xa'));var fs=require('fs');var fs_extra=require(_0x2ce6('0xb'));var _=require(_0x2ce6('0xc'));var squel=require(_0x2ce6('0xd'));var crypto=require('crypto');var jsforce=require(_0x2ce6('0xe'));var deskjs=require(_0x2ce6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2ce6('0x10'));var Papa=require(_0x2ce6('0x11'));var Redis=require(_0x2ce6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2ce6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ce6('0x14'))('api');var utils=require(_0x2ce6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2ce6('0x16'));var db=require(_0x2ce6('0x17'))['db'];config[_0x2ce6('0x18')]=_[_0x2ce6('0x19')](config[_0x2ce6('0x18')],{'host':_0x2ce6('0x1a'),'port':0x18eb});var socket=require(_0x2ce6('0x1b'))(new Redis(config[_0x2ce6('0x18')]));require('./smsMessage.socket')[_0x2ce6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2ce6('0x1d')][_0x2ce6('0x1e')]({'port':0x232c});var client9002=jayson[_0x2ce6('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x312a6e,_0x109981,_0x641c9,_0x3c1b9d){return new BPromise(function(_0x38032e,_0x645ff4){var _0x23a707=_0x3c1b9d||client;return _0x23a707[_0x2ce6('0x1f')](_0x312a6e,_0x641c9)[_0x2ce6('0x20')](function(_0x37b5d1){logger['info'](_0x2ce6('0x21'),_0x109981,_0x2ce6('0x22'));logger[_0x2ce6('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x109981,_0x2ce6('0x22'),JSON[_0x2ce6('0x24')](_0x37b5d1));if(_0x37b5d1[_0x2ce6('0x25')]){if(_0x37b5d1[_0x2ce6('0x25')][_0x2ce6('0x26')]===0x1f4){logger['error'](_0x2ce6('0x21'),_0x109981,_0x37b5d1['error']['message']);return _0x645ff4(_0x37b5d1[_0x2ce6('0x25')][_0x2ce6('0x27')]);}logger[_0x2ce6('0x25')]('SmsMessage,\x20%s,\x20%s',_0x109981,_0x37b5d1[_0x2ce6('0x25')][_0x2ce6('0x27')]);return _0x38032e(_0x37b5d1[_0x2ce6('0x25')][_0x2ce6('0x27')]);}else{logger['info'](_0x2ce6('0x21'),_0x109981,_0x2ce6('0x22'));_0x38032e(_0x37b5d1[_0x2ce6('0x28')][_0x2ce6('0x27')]);}})[_0x2ce6('0x29')](function(_0x366ada){logger[_0x2ce6('0x25')]('SmsMessage,\x20%s,\x20%s',_0x109981,_0x366ada);_0x645ff4(_0x366ada);});});}function respondWithStatusCode(_0x4ba3c4,_0x4eb918){_0x4eb918=_0x4eb918||0xcc;return function(_0x22bf7b){if(_0x22bf7b){return _0x4ba3c4[_0x2ce6('0x2a')](_0x4eb918);}return _0x4ba3c4['status'](_0x4eb918)['end']();};}function respondWithResult(_0x2c609b,_0x126e43){_0x126e43=_0x126e43||0xc8;return function(_0x2a282c){if(_0x2a282c){return _0x2c609b[_0x2ce6('0x2b')](_0x126e43)['json'](_0x2a282c);}};}function respondWithFilteredResult(_0x481cd2,_0x909ada){return function(_0xa78201){if(_0xa78201){var _0x2fd596=typeof _0x909ada['offset']==='undefined'&&typeof _0x909ada['limit']===_0x2ce6('0x2c');var _0x5119c4=_0xa78201[_0x2ce6('0x2d')];var _0x287568=_0x2fd596?0x0:_0x909ada[_0x2ce6('0x2e')];var _0x396092=_0x2fd596?_0xa78201[_0x2ce6('0x2d')]:_0x909ada['offset']+_0x909ada[_0x2ce6('0x2f')];var _0x3715de;if(_0x396092>=_0x5119c4){_0x396092=_0x5119c4;_0x3715de=0xc8;}else{_0x3715de=0xce;}_0x481cd2[_0x2ce6('0x2b')](_0x3715de);return _0x481cd2[_0x2ce6('0x30')]('Content-Range',_0x287568+'-'+_0x396092+'/'+_0x5119c4)[_0x2ce6('0x31')](_0xa78201);}return null;};}function patchUpdates(_0x46ae49){return function(_0xc9325a){try{jsonpatch['apply'](_0xc9325a,_0x46ae49,!![]);}catch(_0x13303c){return BPromise[_0x2ce6('0x32')](_0x13303c);}return _0xc9325a[_0x2ce6('0x33')]();};}function saveUpdates(_0x4f1abb,_0x222387){return function(_0x14fc35){if(_0x14fc35){return _0x14fc35['update'](_0x4f1abb)[_0x2ce6('0x20')](function(_0x4d496b){return _0x4d496b;});}return null;};}function removeEntity(_0x5b75b8,_0x4f646c){return function(_0x2a9374){if(_0x2a9374){return _0x2a9374[_0x2ce6('0x34')]()[_0x2ce6('0x20')](function(){_0x5b75b8[_0x2ce6('0x2b')](0xcc)[_0x2ce6('0x35')]();});}};}function handleEntityNotFound(_0x22e027,_0x1de4cb){return function(_0x1c2a5a){if(!_0x1c2a5a){_0x22e027[_0x2ce6('0x2a')](0x194);}return _0x1c2a5a;};}function handleError(_0x2d9a92,_0x2174fb){_0x2174fb=_0x2174fb||0x1f4;return function(_0x34dd08){logger[_0x2ce6('0x25')](_0x34dd08[_0x2ce6('0x36')]);if(_0x34dd08[_0x2ce6('0x37')]){delete _0x34dd08[_0x2ce6('0x37')];}_0x2d9a92['status'](_0x2174fb)[_0x2ce6('0x38')](_0x34dd08);};}exports[_0x2ce6('0x39')]=function(_0x13346e,_0x18d733){var _0x4b106b={},_0x21e302={},_0x5404c8={'count':0x0,'rows':[]};var _0x33b02f=_[_0x2ce6('0x3a')](db[_0x2ce6('0x3b')][_0x2ce6('0x3c')],function(_0x15c1a5){return{'name':_0x15c1a5[_0x2ce6('0x3d')],'type':_0x15c1a5[_0x2ce6('0x3e')]['key']};});_0x21e302['model']=_[_0x2ce6('0x3a')](_0x33b02f,_0x2ce6('0x37'));_0x21e302['query']=_['keys'](_0x13346e[_0x2ce6('0x3f')]);_0x21e302[_0x2ce6('0x40')]=_[_0x2ce6('0x41')](_0x21e302[_0x2ce6('0x42')],_0x21e302['query']);_0x4b106b[_0x2ce6('0x43')]=_[_0x2ce6('0x41')](_0x21e302[_0x2ce6('0x42')],qs[_0x2ce6('0x44')](_0x13346e[_0x2ce6('0x3f')][_0x2ce6('0x44')]));_0x4b106b[_0x2ce6('0x43')]=_0x4b106b[_0x2ce6('0x43')][_0x2ce6('0x45')]?_0x4b106b['attributes']:_0x21e302['model'];if(!_0x13346e[_0x2ce6('0x3f')][_0x2ce6('0x46')](_0x2ce6('0x47'))){_0x4b106b['limit']=qs[_0x2ce6('0x2f')](_0x13346e['query'][_0x2ce6('0x2f')]);_0x4b106b['offset']=qs[_0x2ce6('0x2e')](_0x13346e[_0x2ce6('0x3f')][_0x2ce6('0x2e')]);}_0x4b106b[_0x2ce6('0x48')]=qs[_0x2ce6('0x49')](_0x13346e['query']['sort']);_0x4b106b[_0x2ce6('0x4a')]=qs[_0x2ce6('0x40')](_[_0x2ce6('0x4b')](_0x13346e[_0x2ce6('0x3f')],_0x21e302[_0x2ce6('0x40')]),_0x33b02f);if(_0x13346e[_0x2ce6('0x3f')][_0x2ce6('0x4c')]){_0x4b106b['where']=_[_0x2ce6('0x4d')](_0x4b106b[_0x2ce6('0x4a')],{'$or':_[_0x2ce6('0x3a')](_0x33b02f,function(_0x2d507a){if(_0x2d507a['type']!==_0x2ce6('0x4e')){var _0x21e14c={};_0x21e14c[_0x2d507a[_0x2ce6('0x37')]]={'$like':'%'+_0x13346e[_0x2ce6('0x3f')][_0x2ce6('0x4c')]+'%'};return _0x21e14c;}})});}_0x4b106b=_[_0x2ce6('0x4d')]({},_0x4b106b,_0x13346e[_0x2ce6('0x4f')]);var _0x501df9={'where':_0x4b106b[_0x2ce6('0x4a')]};return db[_0x2ce6('0x3b')]['count'](_0x501df9)[_0x2ce6('0x20')](function(_0x200345){_0x5404c8[_0x2ce6('0x2d')]=_0x200345;if(_0x13346e[_0x2ce6('0x3f')][_0x2ce6('0x50')]){_0x4b106b[_0x2ce6('0x51')]=[{'all':!![]}];}return db[_0x2ce6('0x3b')][_0x2ce6('0x52')](_0x4b106b);})['then'](function(_0x1bfd87){_0x5404c8[_0x2ce6('0x53')]=_0x1bfd87;return _0x5404c8;})[_0x2ce6('0x20')](respondWithFilteredResult(_0x18d733,_0x4b106b))['catch'](handleError(_0x18d733,null));};exports[_0x2ce6('0x54')]=function(_0x229007,_0x2944e7){var _0x40802b={'raw':!![],'where':{'id':_0x229007['params']['id']}},_0x36a328={};_0x36a328['model']=_[_0x2ce6('0x55')](db[_0x2ce6('0x3b')][_0x2ce6('0x3c')]);_0x36a328[_0x2ce6('0x3f')]=_[_0x2ce6('0x55')](_0x229007[_0x2ce6('0x3f')]);_0x36a328['filters']=_[_0x2ce6('0x41')](_0x36a328[_0x2ce6('0x42')],_0x36a328['query']);_0x40802b[_0x2ce6('0x43')]=_[_0x2ce6('0x41')](_0x36a328[_0x2ce6('0x42')],qs[_0x2ce6('0x44')](_0x229007[_0x2ce6('0x3f')]['fields']));_0x40802b[_0x2ce6('0x43')]=_0x40802b[_0x2ce6('0x43')][_0x2ce6('0x45')]?_0x40802b[_0x2ce6('0x43')]:_0x36a328[_0x2ce6('0x42')];if(_0x229007['query'][_0x2ce6('0x50')]){_0x40802b[_0x2ce6('0x51')]=[{'all':!![]}];}_0x40802b=_['merge']({},_0x40802b,_0x229007[_0x2ce6('0x4f')]);return db['SmsMessage'][_0x2ce6('0x56')](_0x40802b)[_0x2ce6('0x20')](handleEntityNotFound(_0x2944e7,null))['then'](respondWithResult(_0x2944e7,null))[_0x2ce6('0x29')](handleError(_0x2944e7,null));};exports[_0x2ce6('0x57')]=function(_0x5cad75,_0x36d97c){return db[_0x2ce6('0x3b')]['create'](_0x5cad75[_0x2ce6('0x58')],{})[_0x2ce6('0x20')](respondWithResult(_0x36d97c,0xc9))[_0x2ce6('0x29')](handleError(_0x36d97c,null));};exports['update']=function(_0x5d0f79,_0x271edd){if(_0x5d0f79['body']['id']){delete _0x5d0f79['body']['id'];}return db[_0x2ce6('0x3b')]['find']({'where':{'id':_0x5d0f79[_0x2ce6('0x59')]['id']}})[_0x2ce6('0x20')](handleEntityNotFound(_0x271edd,null))[_0x2ce6('0x20')](saveUpdates(_0x5d0f79[_0x2ce6('0x58')],null))[_0x2ce6('0x20')](respondWithResult(_0x271edd,null))[_0x2ce6('0x29')](handleError(_0x271edd,null));};exports[_0x2ce6('0x34')]=function(_0x31b6cd,_0x188cbc){return db[_0x2ce6('0x3b')][_0x2ce6('0x56')]({'where':{'id':_0x31b6cd[_0x2ce6('0x59')]['id']}})[_0x2ce6('0x20')](handleEntityNotFound(_0x188cbc,null))[_0x2ce6('0x20')](removeEntity(_0x188cbc,null))['catch'](handleError(_0x188cbc,null));};exports[_0x2ce6('0x5a')]=function(_0x12aa55,_0x425eda){return db[_0x2ce6('0x3b')][_0x2ce6('0x5a')]()['then'](respondWithResult(_0x425eda,null))[_0x2ce6('0x29')](handleError(_0x425eda,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x2ce6('0x5b')]=function(_0x403454,_0x5a056e,_0xc64250){var _0x1f2482={'agent':{},'channel':'sms'};if(_0x403454['body']['id']){delete _0x403454[_0x2ce6('0x58')]['id'];}_0x403454[_0x2ce6('0x58')][_0x2ce6('0x5c')]=!![];_0x403454[_0x2ce6('0x58')][_0x2ce6('0x5d')]=moment()[_0x2ce6('0x5e')](_0x2ce6('0x5f'));_0x403454['body'][_0x2ce6('0x60')]=_0x403454['body'][_0x2ce6('0x60')]||_0x403454[_0x2ce6('0x61')]['id'];_0x1f2482[_0x2ce6('0x62')]['id']=_0x403454[_0x2ce6('0x58')][_0x2ce6('0x60')];return db[_0x2ce6('0x3b')][_0x2ce6('0x56')]({'where':{'id':_0x403454[_0x2ce6('0x59')]['id'],'UserId':null}})[_0x2ce6('0x20')](handleEntityNotFound(_0x5a056e,null))[_0x2ce6('0x20')](saveUpdates(_0x403454[_0x2ce6('0x58')],null))[_0x2ce6('0x20')](function(_0x2a4002){if(_0x2a4002){_0x1f2482[_0x2ce6('0x27')]=_0x2a4002[_0x2ce6('0x63')]({'plain':!![]});return db[_0x2ce6('0x64')][_0x2ce6('0x56')]({'where':{'id':_0x2a4002['SmsInteractionId']}});}return null;})[_0x2ce6('0x20')](handleEntityNotFound(_0x5a056e,null))['then'](function(_0x33ecad){if(_0x33ecad){return _0x33ecad[_0x2ce6('0x65')]({'UserId':_0x403454[_0x2ce6('0x58')][_0x2ce6('0x60')],'read1stAt':_[_0x2ce6('0x66')](_0x33ecad[_0x2ce6('0x67')])?moment()['format'](_0x2ce6('0x5f')):undefined});}return null;})[_0x2ce6('0x20')](function(_0x5dbe47){if(_0x5dbe47){_0x1f2482[_0x2ce6('0x68')]=_0x5dbe47['get']({'plain':!![]});interaction_log[_0x2ce6('0x69')](_0x2ce6('0x6a'),_0x403454[_0x2ce6('0x61')]['id'],_0x403454[_0x2ce6('0x61')]['name'],_0x403454[_0x2ce6('0x61')]['role'],_0x1f2482[_0x2ce6('0x68')]['id'],_0x403454[_0x2ce6('0x58')]?JSON[_0x2ce6('0x24')](_0x403454['body']):_0x2ce6('0x6b'));return respondWithRpcPromise(_0x2ce6('0x6c'),'acceptMessage',_0x1f2482);}return null;})[_0x2ce6('0x20')](function(_0x5900b6){var _0x282fe5=_0x2ce6('0x6d')+_0x5900b6[_0x2ce6('0x27')][_0x2ce6('0x6e')];return db[_0x2ce6('0x6f')]['query'](_0x282fe5,{'type':db[_0x2ce6('0x70')][_0x2ce6('0x71')][_0x2ce6('0x72')],'raw':!![]})[_0x2ce6('0x20')](function(_0x3f74bf){return _0x3f74bf;});})[_0x2ce6('0x20')](function(_0x32801d){if(_0x32801d){_0x1f2482[_0x2ce6('0x27')][_0x2ce6('0x73')]=_0x32801d[0x0];if(!_0x403454['body'][_0x2ce6('0x60')])return;return db['User'][_0x2ce6('0x56')]({'where':{'id':_0x403454[_0x2ce6('0x58')]['UserId'],'role':_0x2ce6('0x62')},'attributes':['id',_0x2ce6('0x37'),_0x2ce6('0x74'),_0x2ce6('0x75'),'internal'],'raw':!![]});}return null;})[_0x2ce6('0x20')](function(_0x4cdad7){if(!_0x4cdad7)return null;_0x1f2482['message'][_0x2ce6('0x62')]=_0x4cdad7;return _0x1f2482;})[_0x2ce6('0x20')](function(_0x51ddf8){if(_0x51ddf8){if(_0x403454[_0x2ce6('0x58')][_0x2ce6('0x76')]){_0x1f2482['message'][_0x2ce6('0x77')]=util[_0x2ce6('0x5e')](_0x2ce6('0x78'),_0x403454['user']['name']);_0x1f2482[_0x2ce6('0x27')][_0x2ce6('0x79')]=_0x1f2482[_0x2ce6('0x79')];_0x1f2482[_0x2ce6('0x27')]['motionChannel']=_0x1f2482['channel'];_0x1f2482['message'][_0x2ce6('0x7a')]=_0x2ce6('0x5b');return respondWithRpcPromise(_0x2ce6('0x7b'),_0x2ce6('0x7b'),{'event':_0x2ce6('0x7c'),'message':_0x1f2482[_0x2ce6('0x27')]},client9002)[_0x2ce6('0x20')](function(){return _0x1f2482;});}return _0x1f2482;}return null;})[_0x2ce6('0x20')](respondWithResult(_0x5a056e,null))[_0x2ce6('0x29')](handleError(_0x5a056e,null));};var interaction_log=require(_0x2ce6('0x14'))(_0x2ce6('0x7d'));exports['reject']=function(_0x5d4bab,_0x1b54fe,_0x46f4bc){var _0x59db04={'agent':{},'channel':_0x2ce6('0x7e')};if(_0x5d4bab['body']['id']){delete _0x5d4bab['body']['id'];}_0x5d4bab['body'][_0x2ce6('0x60')]=_0x5d4bab[_0x2ce6('0x58')]['UserId']||_0x5d4bab['user']['id'];_0x59db04[_0x2ce6('0x62')]['id']=_0x5d4bab[_0x2ce6('0x58')][_0x2ce6('0x60')];return db[_0x2ce6('0x3b')][_0x2ce6('0x56')]({'where':{'id':_0x5d4bab[_0x2ce6('0x59')]['id'],'UserId':null}})[_0x2ce6('0x20')](handleEntityNotFound(_0x1b54fe,null))[_0x2ce6('0x20')](function(_0x506fa2){if(_0x506fa2){_0x59db04['message']=_0x506fa2[_0x2ce6('0x63')]({'plain':!![]});return db[_0x2ce6('0x64')][_0x2ce6('0x56')]({'where':{'id':_0x506fa2[_0x2ce6('0x7f')]}});}return null;})[_0x2ce6('0x20')](handleEntityNotFound(_0x1b54fe,null))[_0x2ce6('0x20')](function(_0x426852){if(_0x426852){_0x59db04['interaction']=_0x426852[_0x2ce6('0x63')]({'plain':!![]});interaction_log[_0x2ce6('0x69')](_0x2ce6('0x80'),_0x5d4bab['user']['id'],_0x5d4bab[_0x2ce6('0x61')][_0x2ce6('0x37')],_0x5d4bab[_0x2ce6('0x61')][_0x2ce6('0x81')],_0x59db04[_0x2ce6('0x68')]['id'],_0x5d4bab[_0x2ce6('0x58')]?JSON[_0x2ce6('0x24')](_0x5d4bab[_0x2ce6('0x58')]):_0x2ce6('0x6b'));return respondWithRpcPromise(_0x2ce6('0x82'),_0x2ce6('0x83'),_0x59db04);}return null;})[_0x2ce6('0x20')](function(_0x34b050){var _0x118c20=_0x2ce6('0x6d')+_0x34b050[_0x2ce6('0x27')][_0x2ce6('0x6e')];return db[_0x2ce6('0x6f')][_0x2ce6('0x3f')](_0x118c20,{'type':db[_0x2ce6('0x70')][_0x2ce6('0x71')][_0x2ce6('0x72')],'raw':!![]})[_0x2ce6('0x20')](function(_0x202038){return _0x202038;});})[_0x2ce6('0x20')](function(_0x4796c9){if(_0x4796c9){_0x59db04[_0x2ce6('0x27')][_0x2ce6('0x73')]=_0x4796c9[0x0];if(!_0x5d4bab[_0x2ce6('0x58')][_0x2ce6('0x60')])return;return db['User'][_0x2ce6('0x56')]({'where':{'id':_0x5d4bab[_0x2ce6('0x58')][_0x2ce6('0x60')],'role':_0x2ce6('0x62')},'attributes':['id',_0x2ce6('0x37'),_0x2ce6('0x74'),'email',_0x2ce6('0x84')],'raw':!![]});}return null;})[_0x2ce6('0x20')](function(_0x3a85ae){if(!_0x3a85ae)return null;_0x59db04[_0x2ce6('0x27')][_0x2ce6('0x62')]=_0x3a85ae;return _0x59db04;})[_0x2ce6('0x20')](function(_0x1ee536){if(_0x1ee536){_0x1ee536[_0x2ce6('0x27')][_0x2ce6('0x77')]=util[_0x2ce6('0x5e')](_0x2ce6('0x78'),_0x5d4bab[_0x2ce6('0x61')]['name']);_0x1ee536[_0x2ce6('0x27')][_0x2ce6('0x79')]=_0x59db04[_0x2ce6('0x79')];_0x1ee536['message'][_0x2ce6('0x85')]=_0x59db04['channel'];_0x1ee536['message'][_0x2ce6('0x7a')]=_0x2ce6('0x32');respondWithRpcPromise(_0x2ce6('0x7b'),_0x2ce6('0x7b'),{'event':'rejectmessage','message':_0x1ee536['message']},client9002);return _0x59db04;}return null;})['then'](respondWithResult(_0x1b54fe,null))['catch'](handleError(_0x1b54fe,null));};exports[_0x2ce6('0x2b')]=function(_0x58d565,_0x113731,_0x2f17c5){if(_0x58d565[_0x2ce6('0x58')]['id']){delete _0x58d565['body']['id'];}var _0x5cb66a;return db[_0x2ce6('0x3b')][_0x2ce6('0x56')]({'where':{'id':_0x58d565[_0x2ce6('0x59')]['id']}})['then'](handleEntityNotFound(_0x113731,null))[_0x2ce6('0x20')](function(_0x4b47bd){if(_0x4b47bd){_0x5cb66a=_0x4b47bd;return db[_0x2ce6('0x86')][_0x2ce6('0x56')]({'where':{'id':_0x4b47bd[_0x2ce6('0x87')]}});}})[_0x2ce6('0x20')](handleEntityNotFound(_0x113731,null))['then'](function(_0x903cb6){if(_0x903cb6){logger[_0x2ce6('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x2ce6('0x88'),_0x903cb6['type'],util[_0x2ce6('0x89')](_0x58d565[_0x2ce6('0x58')],{'showHidden':![],'depth':null}));switch(_0x903cb6[_0x2ce6('0x3e')]){case _0x2ce6('0x8a'):if(_0x58d565[_0x2ce6('0x58')][_0x2ce6('0x8b')]&&_0x58d565[_0x2ce6('0x58')][_0x2ce6('0x8b')]===_0x5cb66a[_0x2ce6('0x8c')]){return _0x5cb66a[_0x2ce6('0x65')]({'read':!![]});}else{logger[_0x2ce6('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2ce6('0x2b'),'twilio',util[_0x2ce6('0x89')](_0x58d565['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x58d565[_0x2ce6('0x58')][_0x2ce6('0x8d')]&&_0x58d565['body']['MessageUUID']===_0x5cb66a['messageId']&&_[_0x2ce6('0x8e')]([_0x2ce6('0x8f'),_0x2ce6('0x90')],_0x58d565[_0x2ce6('0x58')][_0x2ce6('0x91')])>=0x0){return _0x5cb66a[_0x2ce6('0x65')]({'read':!![]});}else{logger[_0x2ce6('0x25')](_0x2ce6('0x92'),_0x2ce6('0x2b'),_0x2ce6('0x93'),util['inspect'](_0x58d565[_0x2ce6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x2ce6('0x94'):var _0x4bbc9c=_0x58d565[_0x2ce6('0x58')][_0x2ce6('0x95')][0x0];if(_0x4bbc9c[_0x2ce6('0x2b')][_0x2ce6('0x96')]===_0x2ce6('0x97')){return _0x5cb66a['update']({'read':!![]});}else{logger[_0x2ce6('0x25')](_0x2ce6('0x92'),_0x2ce6('0x2b'),'infobip',util[_0x2ce6('0x89')](_0x58d565['body'],{'showHidden':![],'depth':null}));}break;}return _0x5cb66a;}})[_0x2ce6('0x20')](respondWithResult(_0x113731,null))[_0x2ce6('0x29')](handleError(_0x113731,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 45beb6a..83f3203 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 _0x6c07=['update','remove','emit','exports','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x1591f7,_0x5aedd6){var _0x4e1517=function(_0x544aff){while(--_0x544aff){_0x1591f7['push'](_0x1591f7['shift']());}};_0x4e1517(++_0x5aedd6);}(_0x6c07,0xe4));var _0x76c0=function(_0x4deba0,_0x14efda){_0x4deba0=_0x4deba0-0x0;var _0x59a977=_0x6c07[_0x4deba0];return _0x59a977;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x76c0('0x0'))['db'][_0x76c0('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x76c0('0x2')](0x0);var events={'afterCreate':_0x76c0('0x3'),'afterUpdate':_0x76c0('0x4'),'afterDestroy':_0x76c0('0x5')};function emitEvent(_0x5223ae){return function(_0x353b6b,_0x3a83d5,_0x2b5994){SmsMessageEvents[_0x76c0('0x6')](_0x5223ae+':'+_0x353b6b['id'],_0x353b6b);SmsMessageEvents[_0x76c0('0x6')](_0x5223ae,_0x353b6b);_0x2b5994(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x76c0('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x67c8=['emit','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x1301aa,_0x4da5c4){var _0x5146a1=function(_0x417cd1){while(--_0x417cd1){_0x1301aa['push'](_0x1301aa['shift']());}};_0x5146a1(++_0x4da5c4);}(_0x67c8,0x1f1));var _0x867c=function(_0x28d58f,_0x4f7225){_0x28d58f=_0x28d58f-0x0;var _0x209d21=_0x67c8[_0x28d58f];return _0x209d21;};'use strict';var EventEmitter=require(_0x867c('0x0'));var SmsMessage=require(_0x867c('0x1'))['db'][_0x867c('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x867c('0x3')](0x0);var events={'afterCreate':_0x867c('0x4'),'afterUpdate':_0x867c('0x5'),'afterDestroy':_0x867c('0x6')};function emitEvent(_0x1c98bb){return function(_0x2df19e,_0x57042c,_0x2ae4e7){SmsMessageEvents[_0x867c('0x7')](_0x1c98bb+':'+_0x2df19e['id'],_0x2df19e);SmsMessageEvents[_0x867c('0x7')](_0x1c98bb,_0x2df19e);_0x2ae4e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x867c('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6be30fc..1f5073b 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 _0x8049=['update','catch','error','SmsAccount','type','twilio','accountSid','authToken','phone','create','body','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','remote','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','digest','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','bandwidth','/messages','applicationId','intelepeer','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sms_messages','messageId','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then'];(function(_0x28cfbe,_0x473ee3){var _0x3f3916=function(_0x512b05){while(--_0x512b05){_0x28cfbe['push'](_0x28cfbe['shift']());}};_0x3f3916(++_0x473ee3);}(_0x8049,0x150));var _0x9804=function(_0x10a2fa,_0xee2935){_0x10a2fa=_0x10a2fa-0x0;var _0x3f0612=_0x8049[_0x10a2fa];return _0x3f0612;};'use strict';var _=require(_0x9804('0x0'));var util=require(_0x9804('0x1'));var logger=require(_0x9804('0x2'))(_0x9804('0x3'));var moment=require(_0x9804('0x4'));var BPromise=require(_0x9804('0x5'));var rp=require(_0x9804('0x6'));var fs=require('fs');var path=require(_0x9804('0x7'));var rimraf=require(_0x9804('0x8'));var config=require(_0x9804('0x9'));var attributes=require('./smsMessage.attributes');module[_0x9804('0xa')]=function(_0x521bb8,_0x21f569){return _0x521bb8[_0x9804('0xb')]('SmsMessage',attributes,{'tableName':_0x9804('0xc'),'paranoid':![],'indexes':[{'name':_0x9804('0xd'),'fields':[_0x9804('0xd')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x9804('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f65ad,_0x25e3b5,_0x1b482f){var _0x260ddc=_0x521bb8[_0x9804('0xf')];var _0x122031=_0x3f65ad[_0x9804('0x10')]({'plain':!![]});if(_0x122031[_0x9804('0x11')]['toLowerCase']()==='in'||_0x122031[_0x9804('0x11')][_0x9804('0x12')]()===_0x9804('0x13')&&!_0x122031[_0x9804('0x14')]&&!_[_0x9804('0x15')](_0x122031[_0x9804('0x16')])&&!_[_0x9804('0x15')](_0x122031[_0x9804('0x17')])){_0x260ddc[_0x9804('0x18')][_0x9804('0x19')]({'where':{'id':_0x122031[_0x9804('0x17')]}})[_0x9804('0x1a')](function(_0x91194b){if(_0x91194b){_0x91194b[_0x9804('0x1b')]({'lastMsgAt':_0x122031['createdAt'],'lastMsgDirection':_0x122031[_0x9804('0x11')][_0x9804('0x12')]()});}})[_0x9804('0x1c')](function(_0x3552fe){console[_0x9804('0x1d')](_0x3552fe);});}if(_0x122031[_0x9804('0x11')]===_0x9804('0x13')&&!_0x122031[_0x9804('0x14')]){var _0x40f474;_0x260ddc[_0x9804('0x1e')]['find']({'where':{'id':_0x122031['SmsAccountId']},'raw':!![]})[_0x9804('0x1a')](function(_0x2104a5){_0x40f474=_0x2104a5;if(_0x40f474&&_0x40f474[_0x9804('0x1f')]){switch(_0x40f474['type']){case _0x9804('0x20'):var _0x336fc0=require(_0x9804('0x20'));if(_0x40f474[_0x9804('0x21')]&&_0x40f474[_0x9804('0x22')]&&_0x40f474[_0x9804('0x23')]){var _0x910387=new _0x336fc0(_0x40f474[_0x9804('0x21')],_0x40f474['authToken']);_0x910387['messages'][_0x9804('0x24')]({'body':_0x122031[_0x9804('0x25')],'to':_0x122031[_0x9804('0x23')],'from':_0x40f474[_0x9804('0x23')],'statusCallback':_0x40f474['remote']+_0x9804('0x26')+_0x122031['id']+_0x9804('0x27')+_0x40f474[_0x9804('0x28')]})[_0x9804('0x1a')](function(_0x43f262){if(_0x43f262[_0x9804('0x29')]){return _0x3f65ad[_0x9804('0x1b')]({'messageId':_0x43f262[_0x9804('0x29')]});}})['catch'](function(_0xbff4ad){logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),'twilio',util[_0x9804('0x2c')](_0xbff4ad,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),'twilio',_0x9804('0x2d'));}break;case _0x9804('0x2e'):var _0x5b6068='https://api.skebby.it/API/v1.0/REST/';if(_0x40f474[_0x9804('0x2f')]&&_0x40f474[_0x9804('0x30')]){var _0x218c1f={'recipient':[_0x122031[_0x9804('0x23')]],'message':_0x122031[_0x9804('0x25')],'message_type':_0x40f474['smsMethod']};if(_0x40f474[_0x9804('0x31')]&&_0x40f474[_0x9804('0x31')]!=='SI'){_0x218c1f[_0x9804('0x32')]=_0x40f474['phone'];}var _0x1d6827={'url':_0x5b6068+_0x9804('0x33')+_0x40f474['username']+_0x9804('0x34')+_0x40f474[_0x9804('0x30')],'method':'GET'};rp(_0x1d6827)[_0x9804('0x1a')](function(_0x6c5118){var _0xc60ce8=_0x6c5118[_0x9804('0x35')](';');var _0x21d781={'user_key':_0xc60ce8[0x0],'session_key':_0xc60ce8[0x1]};_0x1d6827={'url':_0x5b6068+_0x9804('0x36'),'method':_0x9804('0x37'),'headers':{'user_key':_0x21d781[_0x9804('0x38')],'Session_key':_0x21d781['session_key']},'json':!![],'body':_0x218c1f};return rp(_0x1d6827);})[_0x9804('0x1a')](function(_0x12505e){if(_0x12505e['total_sent']>=0x1){var _0x275d28={'messageId':_0x12505e[_0x9804('0x39')]};if(_0x40f474['smsMethod']!=='GP'||!_0x40f474[_0x9804('0x3a')]){_0x275d28[_0x9804('0x3b')]=!![];}return _0x3f65ad[_0x9804('0x1b')](_0x275d28);}else{return logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),'skebby',util[_0x9804('0x2c')](_0x12505e,{'showHidden':![],'depth':null}));}})[_0x9804('0x1c')](function(_0x512d35){return logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x2e'),util[_0x9804('0x2c')](_0x512d35,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x2e'),_0x9804('0x3c'));}break;case'connectel':if(_0x40f474['authToken']){var _0x596949={'recipient':_0x122031[_0x9804('0x23')],'message':_0x122031[_0x9804('0x25')],'sender':_0x40f474[_0x9804('0x3d')]||_0x40f474[_0x9804('0x23')],'authorization':_0x40f474[_0x9804('0x22')]};var _0x25e3b5={'method':'POST','uri':_0x9804('0x3e'),'body':_0x596949,'json':!![]};rp(_0x25e3b5)['then'](function(_0x4b3243){var _0xf42a34={'messageId':_0x4b3243['requestid']};if(!_0x40f474[_0x9804('0x3a')]){_0xf42a34[_0x9804('0x3b')]=!![];}return _0x3f65ad[_0x9804('0x1b')](_0xf42a34);})[_0x9804('0x1c')](function(_0x45e9ff){logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x3f'),util['inspect'](_0x45e9ff,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9804('0x3f'),_0x9804('0x40'));}break;case _0x9804('0x41'):if(_0x40f474['username']&&_0x40f474[_0x9804('0x30')]){var _0x596949={'messages':[{'source':'xCALLY\x20Motion','to':_0x122031['phone'],'body':_0x122031[_0x9804('0x25')],'from':_0x40f474[_0x9804('0x3d')]||_0x40f474[_0x9804('0x23')]}]};var _0x46735d=util[_0x9804('0x42')](_0x9804('0x43'),_0x40f474[_0x9804('0x2f')],_0x40f474[_0x9804('0x30')]);var _0x25e3b5={'method':_0x9804('0x37'),'uri':_0x9804('0x44'),'body':_0x596949,'headers':{'Authorization':util[_0x9804('0x42')]('Basic\x20%s',new Buffer(_0x46735d)['toString'](_0x9804('0x45')))},'json':!![]};rp(_0x25e3b5)[_0x9804('0x1a')](function(_0x442cf0){if(_0x442cf0['http_code']>=0xc8&&_0x442cf0[_0x9804('0x46')]<=0xce){if(_0x442cf0[_0x9804('0x47')]&&_0x442cf0[_0x9804('0x47')][_0x9804('0x48')]>0x0){var _0x4a1b41=_[_0x9804('0x49')](_0x442cf0[_0x9804('0x47')][_0x9804('0x4a')]);var _0x33cd3b={'messageId':_0x4a1b41[_0x9804('0x4b')]};if(!_0x40f474[_0x9804('0x3a')]){_0x33cd3b['read']=!![];}return _0x3f65ad[_0x9804('0x1b')](_0x33cd3b);}else{logger['error'](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x4c'),util[_0x9804('0x2c')](_0x442cf0,{'showHidden':![],'depth':null}));}}else{logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x4c'),util['inspect'](_0x442cf0,{'showHidden':![],'depth':null}));}})[_0x9804('0x1c')](function(_0x34a5cc){logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x4c'),util[_0x9804('0x2c')](_0x34a5cc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x4c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9804('0x4d'):if(_0x40f474['authId']&&_0x40f474[_0x9804('0x22')]){var _0x596949={'dst':_0x122031[_0x9804('0x23')],'text':_0x122031[_0x9804('0x25')],'src':_0x40f474[_0x9804('0x3d')]||_0x40f474[_0x9804('0x23')],'url':_0x40f474[_0x9804('0x4e')]+'/api/sms/messages/'+_0x122031['id']+_0x9804('0x27')+_0x40f474[_0x9804('0x28')]};var _0x46735d=util['format'](_0x9804('0x43'),_0x40f474[_0x9804('0x4f')],_0x40f474[_0x9804('0x22')]);var _0x25e3b5={'method':_0x9804('0x37'),'uri':util[_0x9804('0x42')](_0x9804('0x50'),_0x40f474['authId']),'body':_0x596949,'headers':{'Authorization':util['format'](_0x9804('0x51'),new Buffer(_0x46735d)[_0x9804('0x52')](_0x9804('0x45')))},'json':!![]};rp(_0x25e3b5)[_0x9804('0x1a')](function(_0x3a1111){var _0xf3c600={'messageId':_0x3a1111[_0x9804('0x53')][0x0]};return _0x3f65ad[_0x9804('0x1b')](_0xf3c600);})[_0x9804('0x1c')](function(_0x490a81){logger['error'](_0x9804('0x2a'),'afterCreate',_0x9804('0x4d'),util[_0x9804('0x2c')](_0x490a81,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x40f474[_0x9804('0x2f')]&&_0x40f474['password']){if(_0x40f474[_0x9804('0x54')]){var _0x25b832={'method':_0x9804('0x37'),'uri':_0x40f474['baseUrl']+_0x9804('0x55'),'body':{'username':_0x40f474[_0x9804('0x2f')],'password':_0x40f474[_0x9804('0x30')]},'json':!![]};return rp(_0x25b832)['then'](function(_0x1ba1d2){var _0x4edac8={'method':'POST','uri':_0x40f474[_0x9804('0x54')]+_0x9804('0x56'),'body':{'messages':[{'from':_0x40f474[_0x9804('0x23')],'destinations':[{'to':_0x122031[_0x9804('0x23')]}],'text':_0x122031[_0x9804('0x25')],'notifyUrl':_0x40f474[_0x9804('0x4e')]+_0x9804('0x26')+_0x122031['id']+'/status?token='+_0x40f474['token'],'notifyContentType':_0x9804('0x57'),'callbackData':_0x40f474[_0x9804('0x23')]+';'+_0x122031[_0x9804('0x25')]}]},'headers':{'Authorization':_0x9804('0x58')+_0x1ba1d2['token']},'json':!![]};return rp(_0x4edac8)['then'](function(_0x2861a2){if(_0x2861a2[_0x9804('0x4a')]){var _0x3c7740={'messageId':_0x2861a2[_0x9804('0x4a')][0x0]['messageId']};if(!_0x40f474['deliveryReport']){_0x3c7740[_0x9804('0x3b')]=!![];}return _0x3f65ad['update'](_0x3c7740);}else{return logger[_0x9804('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x2b'),_0x9804('0x59'),util[_0x9804('0x2c')](_0x2861a2,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x21d816){return logger['error'](_0x9804('0x2a'),'afterCreate',_0x9804('0x59'),util[_0x9804('0x2c')](_0x21d816,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x59'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x9804('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x2b'),_0x9804('0x59'),_0x9804('0x3c'));}break;case _0x9804('0x5a'):var _0x59fabd=require(_0x9804('0x5b'));if(_0x40f474[_0x9804('0x5c')]){var _0x5b719e={};_0x5b719e[_0x9804('0x5d')]=_0x40f474['username'];_0x5b719e['phone']=_0x122031[_0x9804('0x23')];_0x5b719e[_0x9804('0x32')]=_0x40f474[_0x9804('0x23')];_0x5b719e['text']=_0x122031['body'];_0x5b719e[_0x9804('0x5e')]=+new Date();var _0x308183='';var _0x11af9c='';var _0x3e1a16=Object[_0x9804('0x5f')](_0x5b719e);_0x3e1a16[_0x9804('0x60')]();for(var _0x47d881=0x0;_0x47d881<_0x3e1a16[_0x9804('0x61')];_0x47d881++){if(_0x308183!=''){_0x308183+='&';}_0x308183+=_0x3e1a16[_0x47d881]+'='+encodeURIComponent(_0x5b719e[_0x3e1a16[_0x47d881]]);_0x11af9c+=_0x5b719e[_0x3e1a16[_0x47d881]];}_0x11af9c+=_0x40f474[_0x9804('0x5c')];_0x11af9c=_0x59fabd[_0x9804('0x62')](_0x9804('0x63'))[_0x9804('0x1b')](_0x11af9c)[_0x9804('0x64')]('hex');if(_0x308183!==''){_0x308183+='&';}_0x308183+=_0x9804('0x65')+_0x11af9c;var _0x1d6827={'method':_0x9804('0x66'),'uri':_0x40f474[_0x9804('0x54')]+_0x9804('0x67')+_0x308183,'json':!![]};return rp(_0x1d6827)[_0x9804('0x1a')](function(_0x2cfe74){var _0x20f0a7=Object[_0x9804('0x5f')](_0x2cfe74);if(_0x2cfe74[_0x20f0a7[0x0]][_0x9804('0x1d')]&&parseInt(_0x2cfe74[_0x20f0a7[0x0]][_0x9804('0x1d')])===0x0){var _0x138962={'messageId':_0x2cfe74[_0x20f0a7[0x0]][_0x9804('0x68')]};if(!_0x40f474[_0x9804('0x3a')]){_0x138962['read']=!![];}return _0x3f65ad[_0x9804('0x1b')](_0x138962);}else{return logger[_0x9804('0x1d')](_0x9804('0x2a'),'afterCreate',_0x9804('0x5a'),util[_0x9804('0x2c')](_0x2cfe74[_0x9804('0x1d')],{'showHidden':![],'depth':null}));}})[_0x9804('0x1c')](function(_0x5a6f64){return logger[_0x9804('0x1d')](_0x9804('0x2a'),'afterCreate',_0x9804('0x5a'),util[_0x9804('0x2c')](_0x5a6f64,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x2b'),_0x9804('0x5a'),_0x9804('0x69'));}break;case _0x9804('0x6a'):if(_0x40f474['apiKey']){var _0x53eab4={'method':_0x9804('0x37'),'uri':_0x9804('0x6b'),'headers':{'Authorization':_0x40f474[_0x9804('0x5c')]},'body':{'content':_0x122031['body'],'to':[_0x122031['phone']],'from':_0x40f474[_0x9804('0x23')],'binary':![],'clientMessageId':_0x9804('0x6c'),'charset':'UTF-8'},'json':!![]};rp(_0x53eab4)[_0x9804('0x1a')](function(_0x30c3b6){if(!_0x30c3b6['error']){var _0x556cfd={'messageId':_0x30c3b6[_0x9804('0x4a')][0x0]['apiMessageId']};if(!_0x40f474[_0x9804('0x3a')]){_0x556cfd['read']=!![];}return _0x3f65ad[_0x9804('0x1b')](_0x556cfd);}else{return logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x6a'),util['inspect'](_0x30c3b6['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1182e5){return logger[_0x9804('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x2b'),_0x9804('0x6a'),util[_0x9804('0x2c')](_0x1182e5,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x2b'),_0x9804('0x6a'),_0x9804('0x69'));}break;case _0x9804('0x6d'):if(_0x40f474[_0x9804('0x2f')]&&_0x40f474[_0x9804('0x30')]){var _0x46735d=util[_0x9804('0x42')](_0x9804('0x43'),_0x40f474[_0x9804('0x2f')],_0x40f474[_0x9804('0x30')]);var _0x25e3b5={'method':_0x9804('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x40f474['accountId']+_0x9804('0x6e'),'body':{'to':[_0x122031[_0x9804('0x23')]],'text':_0x122031[_0x9804('0x25')],'from':_0x40f474[_0x9804('0x23')],'applicationId':_0x40f474[_0x9804('0x6f')]},'headers':{'Authorization':util[_0x9804('0x42')](_0x9804('0x51'),new Buffer(_0x46735d)[_0x9804('0x52')]('base64'))},'json':!![]};rp(_0x25e3b5)['then'](function(_0x2c6075){if(_0x2c6075['id']){var _0x3e6809={'messageId':_0x2c6075['id']};return _0x3f65ad['update'](_0x3e6809);}else{logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x6d'),util[_0x9804('0x2c')](_0x2c6075,{'showHidden':![],'depth':null}));}})[_0x9804('0x1c')](function(_0x437c5f){logger[_0x9804('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x2b'),'bandwidth',util['inspect'](_0x437c5f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',_0x9804('0x3c'));}break;case _0x9804('0x70'):if(_0x40f474['apiKey']){var _0xa4c736={};var _0x1d6827={'method':_0x9804('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x40f474['apiKey'],'Content-Type':_0x9804('0x57')},'body':{'from':_0x40f474[_0x9804('0x23')],'to':_0x122031[_0x9804('0x23')],'text':_0x122031['body']},'json':!![]};return rp(_0x1d6827)[_0x9804('0x1a')](function(_0x2f4d9f){if(_0x2f4d9f[_0x9804('0x71')]==0xca){_0xa4c736['message']=_0x2f4d9f;var _0x2bbcc6={'method':'POST','uri':_0x9804('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x40f474[_0x9804('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0xa4c736[_0x9804('0x73')]['refid']},'json':!![]};return rp(_0x2bbcc6)[_0x9804('0x1a')](function(_0x25892c){_0xa4c736[_0x9804('0x74')]=_0x25892c;var _0x4ee64c={'messageId':_0xa4c736['message'][_0x9804('0x75')],'read':!![]};return _0x3f65ad[_0x9804('0x1b')](_0x4ee64c);});}else{return logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x70'),util[_0x9804('0x2c')](_0x2f4d9f,{'showHidden':![],'depth':null}));}})[_0x9804('0x1c')](function(_0x1a105c){return logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),'intelepeer',util['inspect'](_0x1a105c,{'showHidden':![],'depth':null}));});}else{return logger[_0x9804('0x1d')](_0x9804('0x2a'),_0x9804('0x2b'),_0x9804('0x70'),_0x9804('0x76'));}break;}}})[_0x9804('0x77')](function(){_0x1b482f();});}else{_0x1b482f();}}},'charset':_0x9804('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0e23=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','deliveryReport','senderString','https://smsapi.connectel.se/api/v2/send/','read','connectel','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','head','messages','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','login','text','timestamp','keys','sort','length','apiKey','md5','digest','hex','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','FULLTEXT','get','toLowerCase','direction','out','isNil','SmsInteractionId','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','body','remote','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect'];(function(_0x396f1e,_0x19bc84){var _0x289999=function(_0x4724ab){while(--_0x4724ab){_0x396f1e['push'](_0x396f1e['shift']());}};_0x289999(++_0x19bc84);}(_0x0e23,0x1c4));var _0x30e2=function(_0x18db3a,_0x523090){_0x18db3a=_0x18db3a-0x0;var _0x18304b=_0x0e23[_0x18db3a];return _0x18304b;};'use strict';var _=require(_0x30e2('0x0'));var util=require('util');var logger=require(_0x30e2('0x1'))(_0x30e2('0x2'));var moment=require(_0x30e2('0x3'));var BPromise=require(_0x30e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30e2('0x5'));var rimraf=require(_0x30e2('0x6'));var config=require(_0x30e2('0x7'));var attributes=require(_0x30e2('0x8'));module[_0x30e2('0x9')]=function(_0x1f12b9,_0x4af5bb){return _0x1f12b9[_0x30e2('0xa')](_0x30e2('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x30e2('0xc'),'fields':[_0x30e2('0xc')]},{'name':_0x30e2('0xd'),'fields':['body'],'type':_0x30e2('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x224b3c,_0x528981,_0x540480){var _0x34b2c6=_0x1f12b9['models'];var _0x503079=_0x224b3c[_0x30e2('0xf')]({'plain':!![]});if(_0x503079['direction'][_0x30e2('0x10')]()==='in'||_0x503079[_0x30e2('0x11')]['toLowerCase']()===_0x30e2('0x12')&&!_0x503079['secret']&&!_[_0x30e2('0x13')](_0x503079['UserId'])&&!_['isNil'](_0x503079['SmsInteractionId'])){_0x34b2c6['SmsInteraction']['findOne']({'where':{'id':_0x503079[_0x30e2('0x14')]}})[_0x30e2('0x15')](function(_0x313c2b){if(_0x313c2b){_0x313c2b[_0x30e2('0x16')]({'lastMsgAt':_0x503079['createdAt'],'lastMsgDirection':_0x503079['direction'][_0x30e2('0x10')]()});}})[_0x30e2('0x17')](function(_0x228b53){console[_0x30e2('0x18')](_0x228b53);});}if(_0x503079[_0x30e2('0x11')]===_0x30e2('0x12')&&!_0x503079['secret']){var _0x2ae908;_0x34b2c6[_0x30e2('0x19')][_0x30e2('0x1a')]({'where':{'id':_0x503079[_0x30e2('0x1b')]},'raw':!![]})[_0x30e2('0x15')](function(_0x2f412b){_0x2ae908=_0x2f412b;if(_0x2ae908&&_0x2ae908[_0x30e2('0x1c')]){switch(_0x2ae908[_0x30e2('0x1c')]){case'twilio':var _0x23a511=require(_0x30e2('0x1d'));if(_0x2ae908[_0x30e2('0x1e')]&&_0x2ae908['authToken']&&_0x2ae908[_0x30e2('0x1f')]){var _0x416568=new _0x23a511(_0x2ae908[_0x30e2('0x1e')],_0x2ae908[_0x30e2('0x20')]);_0x416568['messages']['create']({'body':_0x503079[_0x30e2('0x21')],'to':_0x503079[_0x30e2('0x1f')],'from':_0x2ae908[_0x30e2('0x1f')],'statusCallback':_0x2ae908[_0x30e2('0x22')]+'/api/sms/messages/'+_0x503079['id']+'/status?token='+_0x2ae908[_0x30e2('0x23')]})[_0x30e2('0x15')](function(_0x187eea){if(_0x187eea[_0x30e2('0x24')]){return _0x224b3c[_0x30e2('0x16')]({'messageId':_0x187eea['sid']});}})[_0x30e2('0x17')](function(_0x3d9e17){logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x1d'),util[_0x30e2('0x27')](_0x3d9e17,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x1d'),_0x30e2('0x28'));}break;case _0x30e2('0x29'):var _0x1913a1=_0x30e2('0x2a');if(_0x2ae908[_0x30e2('0x2b')]&&_0x2ae908[_0x30e2('0x2c')]){var _0x394b96={'recipient':[_0x503079['phone']],'message':_0x503079[_0x30e2('0x21')],'message_type':_0x2ae908['smsMethod']};if(_0x2ae908[_0x30e2('0x2d')]&&_0x2ae908[_0x30e2('0x2d')]!=='SI'){_0x394b96[_0x30e2('0x2e')]=_0x2ae908['phone'];}var _0x20735c={'url':_0x1913a1+_0x30e2('0x2f')+_0x2ae908[_0x30e2('0x2b')]+_0x30e2('0x30')+_0x2ae908[_0x30e2('0x2c')],'method':_0x30e2('0x31')};rp(_0x20735c)[_0x30e2('0x15')](function(_0x363f7d){var _0x264087=_0x363f7d['split'](';');var _0xebd0c1={'user_key':_0x264087[0x0],'session_key':_0x264087[0x1]};_0x20735c={'url':_0x1913a1+_0x30e2('0x32'),'method':_0x30e2('0x33'),'headers':{'user_key':_0xebd0c1[_0x30e2('0x34')],'Session_key':_0xebd0c1['session_key']},'json':!![],'body':_0x394b96};return rp(_0x20735c);})[_0x30e2('0x15')](function(_0x195b54){if(_0x195b54['total_sent']>=0x1){var _0x4f112c={'messageId':_0x195b54['internal_order_id']};if(_0x2ae908[_0x30e2('0x2d')]!=='GP'||!_0x2ae908[_0x30e2('0x35')]){_0x4f112c['read']=!![];}return _0x224b3c[_0x30e2('0x16')](_0x4f112c);}else{return logger['error'](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x29'),util['inspect'](_0x195b54,{'showHidden':![],'depth':null}));}})[_0x30e2('0x17')](function(_0x404dc8){return logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),'skebby',util[_0x30e2('0x27')](_0x404dc8,{'showHidden':![],'depth':null}));});}else{logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x29'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x2ae908[_0x30e2('0x20')]){var _0x2f0c72={'recipient':_0x503079[_0x30e2('0x1f')],'message':_0x503079[_0x30e2('0x21')],'sender':_0x2ae908[_0x30e2('0x36')]||_0x2ae908[_0x30e2('0x1f')],'authorization':_0x2ae908[_0x30e2('0x20')]};var _0x528981={'method':_0x30e2('0x33'),'uri':_0x30e2('0x37'),'body':_0x2f0c72,'json':!![]};rp(_0x528981)[_0x30e2('0x15')](function(_0x177ddb){var _0x4b7f52={'messageId':_0x177ddb['requestid']};if(!_0x2ae908[_0x30e2('0x35')]){_0x4b7f52[_0x30e2('0x38')]=!![];}return _0x224b3c[_0x30e2('0x16')](_0x4b7f52);})[_0x30e2('0x17')](function(_0x264634){logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x39'),util[_0x30e2('0x27')](_0x264634,{'showHidden':![],'depth':null}));});}else{logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x39'),_0x30e2('0x3a'));}break;case _0x30e2('0x3b'):if(_0x2ae908[_0x30e2('0x2b')]&&_0x2ae908[_0x30e2('0x2c')]){var _0x2f0c72={'messages':[{'source':_0x30e2('0x3c'),'to':_0x503079[_0x30e2('0x1f')],'body':_0x503079[_0x30e2('0x21')],'from':_0x2ae908[_0x30e2('0x36')]||_0x2ae908[_0x30e2('0x1f')]}]};var _0x405c2a=util[_0x30e2('0x3d')](_0x30e2('0x3e'),_0x2ae908[_0x30e2('0x2b')],_0x2ae908['password']);var _0x528981={'method':_0x30e2('0x33'),'uri':_0x30e2('0x3f'),'body':_0x2f0c72,'headers':{'Authorization':util[_0x30e2('0x3d')](_0x30e2('0x40'),new Buffer(_0x405c2a)[_0x30e2('0x41')](_0x30e2('0x42')))},'json':!![]};rp(_0x528981)[_0x30e2('0x15')](function(_0x53efd2){if(_0x53efd2['http_code']>=0xc8&&_0x53efd2[_0x30e2('0x43')]<=0xce){if(_0x53efd2[_0x30e2('0x44')]&&_0x53efd2[_0x30e2('0x44')][_0x30e2('0x45')]>0x0){var _0x3d22c6=_[_0x30e2('0x46')](_0x53efd2[_0x30e2('0x44')][_0x30e2('0x47')]);var _0x3961fb={'messageId':_0x3d22c6['message_id']};if(!_0x2ae908['deliveryReport']){_0x3961fb[_0x30e2('0x38')]=!![];}return _0x224b3c['update'](_0x3961fb);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x30e2('0x26'),_0x30e2('0x48'),util[_0x30e2('0x27')](_0x53efd2,{'showHidden':![],'depth':null}));}}else{logger[_0x30e2('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x30e2('0x26'),_0x30e2('0x48'),util[_0x30e2('0x27')](_0x53efd2,{'showHidden':![],'depth':null}));}})['catch'](function(_0x499d92){logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x48'),util[_0x30e2('0x27')](_0x499d92,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x30e2('0x25'),'afterCreate',_0x30e2('0x48'),_0x30e2('0x49'));}break;case _0x30e2('0x4a'):if(_0x2ae908[_0x30e2('0x4b')]&&_0x2ae908['authToken']){var _0x2f0c72={'dst':_0x503079['phone'],'text':_0x503079[_0x30e2('0x21')],'src':_0x2ae908[_0x30e2('0x36')]||_0x2ae908['phone'],'url':_0x2ae908[_0x30e2('0x22')]+_0x30e2('0x4c')+_0x503079['id']+_0x30e2('0x4d')+_0x2ae908[_0x30e2('0x23')]};var _0x405c2a=util['format'](_0x30e2('0x3e'),_0x2ae908[_0x30e2('0x4b')],_0x2ae908[_0x30e2('0x20')]);var _0x528981={'method':_0x30e2('0x33'),'uri':util['format'](_0x30e2('0x4e'),_0x2ae908[_0x30e2('0x4b')]),'body':_0x2f0c72,'headers':{'Authorization':util[_0x30e2('0x3d')](_0x30e2('0x40'),new Buffer(_0x405c2a)[_0x30e2('0x41')]('base64'))},'json':!![]};rp(_0x528981)['then'](function(_0x551ed0){var _0x260101={'messageId':_0x551ed0[_0x30e2('0x4f')][0x0]};return _0x224b3c['update'](_0x260101);})['catch'](function(_0x131dc1){logger[_0x30e2('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x30e2('0x26'),_0x30e2('0x4a'),util[_0x30e2('0x27')](_0x131dc1,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x30e2('0x26'),_0x30e2('0x4a'),_0x30e2('0x50'));}break;case _0x30e2('0x51'):if(_0x2ae908[_0x30e2('0x2b')]&&_0x2ae908[_0x30e2('0x2c')]){if(_0x2ae908[_0x30e2('0x52')]){var _0x57ad22={'method':_0x30e2('0x33'),'uri':_0x2ae908['baseUrl']+_0x30e2('0x53'),'body':{'username':_0x2ae908[_0x30e2('0x2b')],'password':_0x2ae908[_0x30e2('0x2c')]},'json':!![]};return rp(_0x57ad22)[_0x30e2('0x15')](function(_0x1ad34a){var _0x46d2e0={'method':_0x30e2('0x33'),'uri':_0x2ae908[_0x30e2('0x52')]+_0x30e2('0x54'),'body':{'messages':[{'from':_0x2ae908[_0x30e2('0x1f')],'destinations':[{'to':_0x503079[_0x30e2('0x1f')]}],'text':_0x503079[_0x30e2('0x21')],'notifyUrl':_0x2ae908[_0x30e2('0x22')]+_0x30e2('0x4c')+_0x503079['id']+_0x30e2('0x4d')+_0x2ae908[_0x30e2('0x23')],'notifyContentType':'application/json','callbackData':_0x2ae908[_0x30e2('0x1f')]+';'+_0x503079[_0x30e2('0x21')]}]},'headers':{'Authorization':_0x30e2('0x55')+_0x1ad34a[_0x30e2('0x23')]},'json':!![]};return rp(_0x46d2e0)[_0x30e2('0x15')](function(_0x59bd2e){if(_0x59bd2e['messages']){var _0x1d4b0a={'messageId':_0x59bd2e[_0x30e2('0x47')][0x0][_0x30e2('0xc')]};if(!_0x2ae908[_0x30e2('0x35')]){_0x1d4b0a[_0x30e2('0x38')]=!![];}return _0x224b3c[_0x30e2('0x16')](_0x1d4b0a);}else{return logger['error'](_0x30e2('0x25'),'afterCreate',_0x30e2('0x51'),util[_0x30e2('0x27')](_0x59bd2e,{'showHidden':![],'depth':null}));}});})[_0x30e2('0x17')](function(_0x5cecd6){return logger[_0x30e2('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x30e2('0x26'),'infobip',util[_0x30e2('0x27')](_0x5cecd6,{'showHidden':![],'depth':null}));});}else{logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x51'),_0x30e2('0x56'));}}else{logger['error'](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x51'),_0x30e2('0x49'));}break;case'csc':var _0x456a56=require(_0x30e2('0x57'));if(_0x2ae908['apiKey']){var _0x2a332b={};_0x2a332b[_0x30e2('0x58')]=_0x2ae908[_0x30e2('0x2b')];_0x2a332b['phone']=_0x503079['phone'];_0x2a332b[_0x30e2('0x2e')]=_0x2ae908[_0x30e2('0x1f')];_0x2a332b[_0x30e2('0x59')]=_0x503079[_0x30e2('0x21')];_0x2a332b[_0x30e2('0x5a')]=+new Date();var _0x3a7f9b='';var _0x2c16df='';var _0x5d4c50=Object[_0x30e2('0x5b')](_0x2a332b);_0x5d4c50[_0x30e2('0x5c')]();for(var _0x506171=0x0;_0x506171<_0x5d4c50[_0x30e2('0x5d')];_0x506171++){if(_0x3a7f9b!=''){_0x3a7f9b+='&';}_0x3a7f9b+=_0x5d4c50[_0x506171]+'='+encodeURIComponent(_0x2a332b[_0x5d4c50[_0x506171]]);_0x2c16df+=_0x2a332b[_0x5d4c50[_0x506171]];}_0x2c16df+=_0x2ae908[_0x30e2('0x5e')];_0x2c16df=_0x456a56['createHash'](_0x30e2('0x5f'))[_0x30e2('0x16')](_0x2c16df)[_0x30e2('0x60')](_0x30e2('0x61'));if(_0x3a7f9b!==''){_0x3a7f9b+='&';}_0x3a7f9b+=_0x30e2('0x62')+_0x2c16df;var _0x20735c={'method':_0x30e2('0x31'),'uri':_0x2ae908[_0x30e2('0x52')]+_0x30e2('0x63')+_0x3a7f9b,'json':!![]};return rp(_0x20735c)['then'](function(_0x29dee7){var _0x3d3192=Object[_0x30e2('0x5b')](_0x29dee7);if(_0x29dee7[_0x3d3192[0x0]][_0x30e2('0x18')]&&parseInt(_0x29dee7[_0x3d3192[0x0]]['error'])===0x0){var _0x4b7b7a={'messageId':_0x29dee7[_0x3d3192[0x0]]['id_sms']};if(!_0x2ae908['deliveryReport']){_0x4b7b7a[_0x30e2('0x38')]=!![];}return _0x224b3c['update'](_0x4b7b7a);}else{return logger[_0x30e2('0x18')](_0x30e2('0x25'),'afterCreate',_0x30e2('0x64'),util[_0x30e2('0x27')](_0x29dee7['error'],{'showHidden':![],'depth':null}));}})[_0x30e2('0x17')](function(_0x45ae81){return logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),'csc',util[_0x30e2('0x27')](_0x45ae81,{'showHidden':![],'depth':null}));});}else{logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x64'),_0x30e2('0x65'));}break;case'clickatell':if(_0x2ae908['apiKey']){var _0x197442={'method':_0x30e2('0x33'),'uri':_0x30e2('0x66'),'headers':{'Authorization':_0x2ae908['apiKey']},'body':{'content':_0x503079[_0x30e2('0x21')],'to':[_0x503079['phone']],'from':_0x2ae908['phone'],'binary':![],'clientMessageId':_0x30e2('0x67'),'charset':_0x30e2('0x68')},'json':!![]};rp(_0x197442)['then'](function(_0x447435){if(!_0x447435[_0x30e2('0x18')]){var _0x53b7b4={'messageId':_0x447435['messages'][0x0][_0x30e2('0x69')]};if(!_0x2ae908[_0x30e2('0x35')]){_0x53b7b4[_0x30e2('0x38')]=!![];}return _0x224b3c['update'](_0x53b7b4);}else{return logger[_0x30e2('0x18')](_0x30e2('0x25'),'afterCreate','clickatell',util[_0x30e2('0x27')](_0x447435[_0x30e2('0x18')],{'showHidden':![],'depth':null}));}})[_0x30e2('0x17')](function(_0x2e1280){return logger[_0x30e2('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x30e2('0x26'),'clickatell',util['inspect'](_0x2e1280,{'showHidden':![],'depth':null}));});}else{logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x30e2('0x6a'):if(_0x2ae908['username']&&_0x2ae908[_0x30e2('0x2c')]){var _0x405c2a=util[_0x30e2('0x3d')]('%s:%s',_0x2ae908['username'],_0x2ae908[_0x30e2('0x2c')]);var _0x528981={'method':'POST','uri':_0x30e2('0x6b')+_0x2ae908[_0x30e2('0x6c')]+_0x30e2('0x6d'),'body':{'to':[_0x503079[_0x30e2('0x1f')]],'text':_0x503079['body'],'from':_0x2ae908['phone'],'applicationId':_0x2ae908[_0x30e2('0x6e')]},'headers':{'Authorization':util['format'](_0x30e2('0x40'),new Buffer(_0x405c2a)['toString'](_0x30e2('0x42')))},'json':!![]};rp(_0x528981)[_0x30e2('0x15')](function(_0x3b0bf8){if(_0x3b0bf8['id']){var _0x1c6e7f={'messageId':_0x3b0bf8['id']};return _0x224b3c[_0x30e2('0x16')](_0x1c6e7f);}else{logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),'bandwidth',util[_0x30e2('0x27')](_0x3b0bf8,{'showHidden':![],'depth':null}));}})[_0x30e2('0x17')](function(_0x1bd6a8){logger[_0x30e2('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x30e2('0x26'),_0x30e2('0x6a'),util[_0x30e2('0x27')](_0x1bd6a8,{'showHidden':![],'depth':null}));});}else{logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x6a'),_0x30e2('0x49'));}break;case _0x30e2('0x6f'):if(_0x2ae908[_0x30e2('0x5e')]){var _0x55e239={};var _0x20735c={'method':_0x30e2('0x33'),'uri':_0x30e2('0x70'),'headers':{'Authorization':_0x30e2('0x71')+_0x2ae908[_0x30e2('0x5e')],'Content-Type':_0x30e2('0x72')},'body':{'from':_0x2ae908['phone'],'to':_0x503079['phone'],'text':_0x503079[_0x30e2('0x21')]},'json':!![]};return rp(_0x20735c)[_0x30e2('0x15')](function(_0x4cd979){if(_0x4cd979[_0x30e2('0x73')]==0xca){_0x55e239[_0x30e2('0x74')]=_0x4cd979;var _0x501dbb={'method':_0x30e2('0x33'),'uri':_0x30e2('0x75'),'headers':{'Authorization':_0x30e2('0x71')+_0x2ae908[_0x30e2('0x5e')],'Content-Type':_0x30e2('0x72')},'body':{'refid':_0x55e239[_0x30e2('0x74')]['refid']},'json':!![]};return rp(_0x501dbb)['then'](function(_0x11d7fa){_0x55e239[_0x30e2('0x76')]=_0x11d7fa;var _0x48858c={'messageId':_0x55e239[_0x30e2('0x74')][_0x30e2('0x77')],'read':!![]};return _0x224b3c['update'](_0x48858c);});}else{return logger[_0x30e2('0x18')](_0x30e2('0x25'),_0x30e2('0x26'),_0x30e2('0x6f'),util[_0x30e2('0x27')](_0x4cd979,{'showHidden':![],'depth':null}));}})[_0x30e2('0x17')](function(_0xb89bb4){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x30e2('0x26'),_0x30e2('0x6f'),util[_0x30e2('0x27')](_0xb89bb4,{'showHidden':![],'depth':null}));});}else{return logger[_0x30e2('0x18')](_0x30e2('0x25'),'afterCreate',_0x30e2('0x6f'),_0x30e2('0x78'));}break;}}})[_0x30e2('0x79')](function(){_0x540480();});}else{_0x540480();}}},'charset':'utf8mb4','collate':_0x30e2('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 427217e..12bf5d9 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 _0x6e83=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x539112,_0x51ba2b){var _0x5841cb=function(_0x3a7031){while(--_0x3a7031){_0x539112['push'](_0x539112['shift']());}};_0x5841cb(++_0x51ba2b);}(_0x6e83,0x6e));var _0x36e8=function(_0x3a85ab,_0x1f3525){_0x3a85ab=_0x3a85ab-0x0;var _0x32d91a=_0x6e83[_0x3a85ab];return _0x32d91a;};'use strict';var _=require(_0x36e8('0x0'));var util=require(_0x36e8('0x1'));var moment=require(_0x36e8('0x2'));var BPromise=require(_0x36e8('0x3'));var rs=require(_0x36e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36e8('0x5'))['db'];var utils=require(_0x36e8('0x6'));var logger=require('../../config/logger')(_0x36e8('0x7'));var config=require(_0x36e8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x36e8('0x9')]({'port':0x232a});config[_0x36e8('0xa')]=_['defaults'](config[_0x36e8('0xa')],{'host':_0x36e8('0xb'),'port':0x18eb});var socket=require(_0x36e8('0xc'))(new Redis(config[_0x36e8('0xa')]));require('./smsMessage.socket')[_0x36e8('0xd')](socket);function respondWithRpcPromise(_0x726762,_0x514057,_0x3950f6){return new BPromise(function(_0xc911c5,_0x49c797){return client[_0x36e8('0xe')](_0x726762,_0x3950f6)[_0x36e8('0xf')](function(_0x3ce109){logger['info'](_0x36e8('0x10'),_0x514057,_0x36e8('0x11'));logger[_0x36e8('0x12')](_0x36e8('0x13'),_0x514057,_0x36e8('0x11'),JSON[_0x36e8('0x14')](_0x3ce109));if(_0x3ce109['error']){if(_0x3ce109['error'][_0x36e8('0x15')]===0x1f4){logger['error'](_0x36e8('0x10'),_0x514057,_0x3ce109[_0x36e8('0x16')]['message']);return _0x49c797(_0x3ce109[_0x36e8('0x16')][_0x36e8('0x17')]);}logger[_0x36e8('0x16')](_0x36e8('0x10'),_0x514057,_0x3ce109[_0x36e8('0x16')][_0x36e8('0x17')]);return _0xc911c5(_0x3ce109[_0x36e8('0x16')][_0x36e8('0x17')]);}else{logger[_0x36e8('0x18')](_0x36e8('0x10'),_0x514057,_0x36e8('0x11'));_0xc911c5(_0x3ce109[_0x36e8('0x19')]['message']);}})[_0x36e8('0x1a')](function(_0x58dcaa){logger[_0x36e8('0x16')]('SmsMessage,\x20%s,\x20%s',_0x514057,_0x58dcaa);_0x49c797(_0x58dcaa);});});}exports[_0x36e8('0x1b')]=function(_0x2e412d){var _0x42ddc5=this;return new Promise(function(_0x2953f6,_0x4c48ab){return db[_0x36e8('0x1c')][_0x36e8('0x1d')](_0x2e412d[_0x36e8('0x1e')],{'raw':_0x2e412d['options']?_0x2e412d[_0x36e8('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4f5b6f){logger[_0x36e8('0x18')](_0x36e8('0x1b'),_0x2e412d);logger['debug']('CreateSmsMessage',_0x2e412d,JSON[_0x36e8('0x14')](_0x4f5b6f));_0x2953f6(_0x4f5b6f);})[_0x36e8('0x1a')](function(_0x1bfdfa){logger['error'](_0x36e8('0x1b'),_0x1bfdfa[_0x36e8('0x17')],_0x2e412d);_0x4c48ab(_0x42ddc5[_0x36e8('0x16')](0x1f4,_0x1bfdfa[_0x36e8('0x17')]));});});}; \ No newline at end of file +var _0xc2ed=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','body','options','raw','lodash','util','moment','bluebird'];(function(_0x5c812,_0x56d270){var _0x251050=function(_0x196cc3){while(--_0x196cc3){_0x5c812['push'](_0x5c812['shift']());}};_0x251050(++_0x56d270);}(_0xc2ed,0x10a));var _0xdc2e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xc2ed[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xdc2e('0x0'));var util=require(_0xdc2e('0x1'));var moment=require(_0xdc2e('0x2'));var BPromise=require(_0xdc2e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc2e('0x4'));var db=require(_0xdc2e('0x5'))['db'];var utils=require(_0xdc2e('0x6'));var logger=require(_0xdc2e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdc2e('0x8'));var client=jayson[_0xdc2e('0x9')]['http']({'port':0x232a});config[_0xdc2e('0xa')]=_[_0xdc2e('0xb')](config[_0xdc2e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc2e('0xc'))(new Redis(config[_0xdc2e('0xa')]));require(_0xdc2e('0xd'))['register'](socket);function respondWithRpcPromise(_0x382850,_0x247891,_0x39b6c9){return new BPromise(function(_0x412139,_0x3c4b0f){return client[_0xdc2e('0xe')](_0x382850,_0x39b6c9)[_0xdc2e('0xf')](function(_0x341af5){logger[_0xdc2e('0x10')](_0xdc2e('0x11'),_0x247891,_0xdc2e('0x12'));logger[_0xdc2e('0x13')](_0xdc2e('0x14'),_0x247891,_0xdc2e('0x12'),JSON[_0xdc2e('0x15')](_0x341af5));if(_0x341af5[_0xdc2e('0x16')]){if(_0x341af5[_0xdc2e('0x16')][_0xdc2e('0x17')]===0x1f4){logger['error'](_0xdc2e('0x11'),_0x247891,_0x341af5['error'][_0xdc2e('0x18')]);return _0x3c4b0f(_0x341af5[_0xdc2e('0x16')][_0xdc2e('0x18')]);}logger[_0xdc2e('0x16')](_0xdc2e('0x11'),_0x247891,_0x341af5[_0xdc2e('0x16')][_0xdc2e('0x18')]);return _0x412139(_0x341af5[_0xdc2e('0x16')]['message']);}else{logger[_0xdc2e('0x10')](_0xdc2e('0x11'),_0x247891,_0xdc2e('0x12'));_0x412139(_0x341af5['result'][_0xdc2e('0x18')]);}})[_0xdc2e('0x19')](function(_0x5b96c9){logger[_0xdc2e('0x16')]('SmsMessage,\x20%s,\x20%s',_0x247891,_0x5b96c9);_0x3c4b0f(_0x5b96c9);});});}exports[_0xdc2e('0x1a')]=function(_0x50895c){var _0x278e4f=this;return new Promise(function(_0x26a4fd,_0x2efcd1){return db['SmsMessage']['create'](_0x50895c[_0xdc2e('0x1b')],{'raw':_0x50895c['options']?_0x50895c[_0xdc2e('0x1c')][_0xdc2e('0x1d')]===undefined?!![]:![]:!![]})[_0xdc2e('0xf')](function(_0x13accd){logger[_0xdc2e('0x10')](_0xdc2e('0x1a'),_0x50895c);logger[_0xdc2e('0x13')](_0xdc2e('0x1a'),_0x50895c,JSON[_0xdc2e('0x15')](_0x13accd));_0x26a4fd(_0x13accd);})['catch'](function(_0x128222){logger['error'](_0xdc2e('0x1a'),_0x128222[_0xdc2e('0x18')],_0x50895c);_0x2efcd1(_0x278e4f['error'](0x1f4,_0x128222[_0xdc2e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 0b8a72e..01b6348 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 _0x3c54=['save','remove','update','emit','removeListener','register','length','./smsMessage.events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3c54,0x17f));var _0x43c5=function(_0x4a1e90,_0xaa5d73){_0x4a1e90=_0x4a1e90-0x0;var _0x110cd8=_0x3c54[_0x4a1e90];return _0x110cd8;};'use strict';var SmsMessageEvents=require(_0x43c5('0x0'));var events=[_0x43c5('0x1'),_0x43c5('0x2'),_0x43c5('0x3')];function createListener(_0x3515f8,_0x4acc7d){return function(_0x5a7b61){_0x4acc7d[_0x43c5('0x4')](_0x3515f8,_0x5a7b61);};}function removeListener(_0x221211,_0x380471){return function(){SmsMessageEvents[_0x43c5('0x5')](_0x221211,_0x380471);};}exports[_0x43c5('0x6')]=function(_0x2ef72e){for(var _0x47957c=0x0,_0x3e6d13=events[_0x43c5('0x7')];_0x47957c<_0x3e6d13;_0x47957c++){var _0x39001d=events[_0x47957c];var _0x2ec3f6=createListener('smsMessage:'+_0x39001d,_0x2ef72e);SmsMessageEvents['on'](_0x39001d,_0x2ec3f6);}}; \ No newline at end of file +var _0x3f8c=['length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x3f8c,0xe6));var _0xc3f8=function(_0x3fb16f,_0x2a1c5f){_0x3fb16f=_0x3fb16f-0x0;var _0x498a97=_0x3f8c[_0x3fb16f];return _0x498a97;};'use strict';var SmsMessageEvents=require(_0xc3f8('0x0'));var events=[_0xc3f8('0x1'),_0xc3f8('0x2'),'update'];function createListener(_0x1fb551,_0x347123){return function(_0x4bb6b4){_0x347123[_0xc3f8('0x3')](_0x1fb551,_0x4bb6b4);};}function removeListener(_0xe20333,_0x5ac2a1){return function(){SmsMessageEvents['removeListener'](_0xe20333,_0x5ac2a1);};}exports['register']=function(_0x24c630){for(var _0x23fe47=0x0,_0x3feee2=events[_0xc3f8('0x4')];_0x23fe47<_0x3feee2;_0x23fe47++){var _0x8d083a=events[_0x23fe47];var _0x41c739=createListener(_0xc3f8('0x5')+_0x8d083a,_0x24c630);SmsMessageEvents['on'](_0x8d083a,_0x41c739);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e7b8f1e..c3bdd66 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 _0x66c4=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','update','delete','destroy','removeAgents'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x66c4,0x88));var _0x466c=function(_0x58e75f,_0x4f0a65){_0x58e75f=_0x58e75f-0x0;var _0x256f39=_0x66c4[_0x58e75f];return _0x256f39;};'use strict';var multer=require(_0x466c('0x0'));var util=require(_0x466c('0x1'));var path=require('path');var timeout=require(_0x466c('0x2'));var express=require(_0x466c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x466c('0x4'));var interaction=require(_0x466c('0x5'));var config=require(_0x466c('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x466c('0x7')](),controller['index']);router['get'](_0x466c('0x8'),auth[_0x466c('0x7')](),controller[_0x466c('0x9')]);router[_0x466c('0xa')](_0x466c('0xb'),auth[_0x466c('0x7')](),controller[_0x466c('0xc')]);router['get'](_0x466c('0xd'),auth[_0x466c('0x7')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x466c('0x7')](),controller[_0x466c('0xe')]);router[_0x466c('0xa')](_0x466c('0xf'),auth[_0x466c('0x7')](),controller[_0x466c('0x10')]);router[_0x466c('0x11')]('/',auth[_0x466c('0x7')](),controller[_0x466c('0x12')]);router[_0x466c('0x11')](_0x466c('0x13'),auth[_0x466c('0x7')](),controller['addTeams']);router[_0x466c('0x11')](_0x466c('0xf'),auth[_0x466c('0x7')](),controller[_0x466c('0x14')]);router[_0x466c('0x15')](_0x466c('0xb'),auth[_0x466c('0x7')](),controller[_0x466c('0x16')]);router[_0x466c('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x466c('0x18')]);router[_0x466c('0x17')](_0x466c('0x13'),auth[_0x466c('0x7')](),controller['removeTeams']);router['delete'](_0x466c('0xf'),auth[_0x466c('0x7')](),controller[_0x466c('0x19')]);module[_0x466c('0x1a')]=router; \ No newline at end of file +var _0xc9bf=['/:id/users','addAgents','put','delete','removeTeams','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','post','create','addTeams'];(function(_0x459e53,_0x58e2b2){var _0x3e7623=function(_0x3dc209){while(--_0x3dc209){_0x459e53['push'](_0x459e53['shift']());}};_0x3e7623(++_0x58e2b2);}(_0xc9bf,0x18c));var _0xfc9b=function(_0x17958f,_0x14b976){_0x17958f=_0x17958f-0x0;var _0x457fc7=_0xc9bf[_0x17958f];return _0x457fc7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfc9b('0x0'));var router=express[_0xfc9b('0x1')]();var fs_extra=require(_0xfc9b('0x2'));var auth=require(_0xfc9b('0x3'));var interaction=require(_0xfc9b('0x4'));var config=require('../../config/environment');var controller=require(_0xfc9b('0x5'));router[_0xfc9b('0x6')]('/',auth[_0xfc9b('0x7')](),controller[_0xfc9b('0x8')]);router[_0xfc9b('0x6')](_0xfc9b('0x9'),auth[_0xfc9b('0x7')](),controller[_0xfc9b('0xa')]);router[_0xfc9b('0x6')](_0xfc9b('0xb'),auth['isAuthenticated'](),controller[_0xfc9b('0xc')]);router[_0xfc9b('0x6')]('/:id/members',auth['isAuthenticated'](),controller[_0xfc9b('0xd')]);router[_0xfc9b('0x6')](_0xfc9b('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0xfc9b('0x6')]('/:id/users',auth[_0xfc9b('0x7')](),controller['getAgents']);router[_0xfc9b('0xf')]('/',auth[_0xfc9b('0x7')](),controller[_0xfc9b('0x10')]);router['post']('/:id/teams',auth[_0xfc9b('0x7')](),controller[_0xfc9b('0x11')]);router[_0xfc9b('0xf')](_0xfc9b('0x12'),auth[_0xfc9b('0x7')](),controller[_0xfc9b('0x13')]);router[_0xfc9b('0x14')](_0xfc9b('0xb'),auth[_0xfc9b('0x7')](),controller['update']);router[_0xfc9b('0x15')](_0xfc9b('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xfc9b('0x15')](_0xfc9b('0xe'),auth['isAuthenticated'](),controller[_0xfc9b('0x16')]);router[_0xfc9b('0x15')]('/:id/users',auth[_0xfc9b('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 96d6f89..c12df7b 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 _0x29fc=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x384e46,_0x42d61b){var _0xcb2382=function(_0x126bb6){while(--_0x126bb6){_0x384e46['push'](_0x384e46['shift']());}};_0xcb2382(++_0x42d61b);}(_0x29fc,0x1db));var _0xc29f=function(_0x8a3931,_0x5ba07e){_0x8a3931=_0x8a3931-0x0;var _0x5f32e6=_0x29fc[_0x8a3931];return _0x5f32e6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc29f('0x0')],'unique':_0xc29f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc29f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc29f('0x3')](_0xc29f('0x4'),'beepall',_0xc29f('0x5'))}}; \ No newline at end of file +var _0x75ca=['rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x1488d1,_0x3ed42e){var _0x4ca2db=function(_0x22d691){while(--_0x22d691){_0x1488d1['push'](_0x1488d1['shift']());}};_0x4ca2db(++_0x3ed42e);}(_0x75ca,0x164));var _0xa75c=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x75ca[_0x4687df];return _0x32eaef;};'use strict';var Sequelize=require(_0xa75c('0x0'));module[_0xa75c('0x1')]={'name':{'type':Sequelize[_0xa75c('0x2')],'unique':_0xa75c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa75c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa75c('0x4'),_0xa75c('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 64517f4..6ed4344 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 _0x94a1=['value','removeAgents','userSmsQueue:remove','omit','getAgents','eml-format','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsQueue.socket','sendStatus','status','json','offset','limit','undefined','count','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','end','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','UserId','updatedAt','createdAt','%s/%s','SIP','smsPause','getTeams','Team','addTeams','ids','User','voicePause','Agents','sequelize','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','compact'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x94a1,0x10d));var _0x194a=function(_0x144f5e,_0x45c196){_0x144f5e=_0x144f5e-0x0;var _0xedc1f1=_0x94a1[_0x144f5e];return _0xedc1f1;};'use strict';var emlformat=require(_0x194a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x194a('0x1'));var rp=require('request-promise');var moment=require(_0x194a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x194a('0x3'));var path=require(_0x194a('0x4'));var sox=require(_0x194a('0x5'));var csv=require(_0x194a('0x6'));var ejs=require(_0x194a('0x7'));var fs=require('fs');var fs_extra=require(_0x194a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x194a('0x9'));var jsforce=require(_0x194a('0xa'));var deskjs=require(_0x194a('0xb'));var toCsv=require(_0x194a('0x6'));var querystring=require(_0x194a('0xc'));var Papa=require(_0x194a('0xd'));var Redis=require(_0x194a('0xe'));var authService=require(_0x194a('0xf'));var qs=require(_0x194a('0x10'));var as=require(_0x194a('0x11'));var hardwareService=require(_0x194a('0x12'));var logger=require('../../config/logger')(_0x194a('0x13'));var utils=require('../../config/utils');var config=require(_0x194a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x194a('0x15'))['db'];config[_0x194a('0x16')]=_['defaults'](config[_0x194a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x194a('0x17'))(new Redis(config[_0x194a('0x16')]));require(_0x194a('0x18'))['register'](socket);function respondWithStatusCode(_0x119f90,_0x4d2006){_0x4d2006=_0x4d2006||0xcc;return function(_0xeeab2b){if(_0xeeab2b){return _0x119f90[_0x194a('0x19')](_0x4d2006);}return _0x119f90[_0x194a('0x1a')](_0x4d2006)['end']();};}function respondWithResult(_0x11774f,_0x434dc7){_0x434dc7=_0x434dc7||0xc8;return function(_0x1da762){if(_0x1da762){return _0x11774f['status'](_0x434dc7)[_0x194a('0x1b')](_0x1da762);}};}function respondWithFilteredResult(_0x1f33be,_0x2f06a8){return function(_0x1ba83f){if(_0x1ba83f){var _0x107349=typeof _0x2f06a8[_0x194a('0x1c')]==='undefined'&&typeof _0x2f06a8[_0x194a('0x1d')]===_0x194a('0x1e');var _0x527986=_0x1ba83f[_0x194a('0x1f')];var _0x29bd98=_0x107349?0x0:_0x2f06a8[_0x194a('0x1c')];var _0x3d0937=_0x107349?_0x1ba83f[_0x194a('0x1f')]:_0x2f06a8['offset']+_0x2f06a8['limit'];var _0x31f39d;if(_0x3d0937>=_0x527986){_0x3d0937=_0x527986;_0x31f39d=0xc8;}else{_0x31f39d=0xce;}_0x1f33be[_0x194a('0x1a')](_0x31f39d);return _0x1f33be['set']('Content-Range',_0x29bd98+'-'+_0x3d0937+'/'+_0x527986)[_0x194a('0x1b')](_0x1ba83f);}return null;};}function patchUpdates(_0xda5b44){return function(_0x28a1a4){try{jsonpatch[_0x194a('0x20')](_0x28a1a4,_0xda5b44,!![]);}catch(_0x217fc8){return BPromise[_0x194a('0x21')](_0x217fc8);}return _0x28a1a4['save']();};}function saveUpdates(_0x1aea98,_0x5164c0){return function(_0x2f9623){if(_0x2f9623){return _0x2f9623[_0x194a('0x22')](_0x1aea98)[_0x194a('0x23')](function(_0x45e56a){return _0x45e56a;});}return null;};}function removeEntity(_0x1964c8,_0x11c974){return function(_0x39f205){if(_0x39f205){return _0x39f205[_0x194a('0x24')]()[_0x194a('0x23')](function(){var _0x210ca7=_0x39f205[_0x194a('0x25')]({'plain':!![]});var _0x162d69=_0x194a('0x26');return db[_0x194a('0x27')][_0x194a('0x24')]({'where':{'type':_0x162d69,'resourceId':_0x210ca7['id']}})[_0x194a('0x23')](function(){return _0x39f205;});})[_0x194a('0x23')](function(){_0x1964c8['status'](0xcc)[_0x194a('0x28')]();});}};}function handleEntityNotFound(_0x5fdb0c,_0x117b72){return function(_0x4701b2){if(!_0x4701b2){_0x5fdb0c[_0x194a('0x19')](0x194);}return _0x4701b2;};}function handleError(_0x5c9240,_0x18d02f){_0x18d02f=_0x18d02f||0x1f4;return function(_0x229957){logger[_0x194a('0x29')](_0x229957[_0x194a('0x2a')]);if(_0x229957[_0x194a('0x2b')]){delete _0x229957[_0x194a('0x2b')];}_0x5c9240['status'](_0x18d02f)[_0x194a('0x2c')](_0x229957);};}exports[_0x194a('0x2d')]=function(_0x1d18a1,_0x5f061e){var _0x55dc2f={},_0xe62bec={},_0x1fcfe9={'count':0x0,'rows':[]};var _0x231ad5=_['map'](db[_0x194a('0x2e')][_0x194a('0x2f')],function(_0x2c7e96){return{'name':_0x2c7e96[_0x194a('0x30')],'type':_0x2c7e96['type'][_0x194a('0x31')]};});_0xe62bec[_0x194a('0x32')]=_[_0x194a('0x33')](_0x231ad5,'name');_0xe62bec[_0x194a('0x34')]=_[_0x194a('0x35')](_0x1d18a1[_0x194a('0x34')]);_0xe62bec[_0x194a('0x36')]=_[_0x194a('0x37')](_0xe62bec[_0x194a('0x32')],_0xe62bec[_0x194a('0x34')]);_0x55dc2f[_0x194a('0x38')]=_['intersection'](_0xe62bec[_0x194a('0x32')],qs['fields'](_0x1d18a1['query'][_0x194a('0x39')]));_0x55dc2f[_0x194a('0x38')]=_0x55dc2f[_0x194a('0x38')]['length']?_0x55dc2f[_0x194a('0x38')]:_0xe62bec[_0x194a('0x32')];if(!_0x1d18a1[_0x194a('0x34')][_0x194a('0x3a')](_0x194a('0x3b'))){_0x55dc2f[_0x194a('0x1d')]=qs[_0x194a('0x1d')](_0x1d18a1[_0x194a('0x34')][_0x194a('0x1d')]);_0x55dc2f[_0x194a('0x1c')]=qs[_0x194a('0x1c')](_0x1d18a1[_0x194a('0x34')][_0x194a('0x1c')]);}_0x55dc2f[_0x194a('0x3c')]=qs[_0x194a('0x3d')](_0x1d18a1[_0x194a('0x34')][_0x194a('0x3d')]);_0x55dc2f['where']=qs[_0x194a('0x36')](_[_0x194a('0x3e')](_0x1d18a1[_0x194a('0x34')],_0xe62bec[_0x194a('0x36')]),_0x231ad5);if(_0x1d18a1['query'][_0x194a('0x3f')]){_0x55dc2f['where']=_[_0x194a('0x40')](_0x55dc2f[_0x194a('0x41')],{'$or':_[_0x194a('0x33')](_0x231ad5,function(_0x2d2374){if(_0x2d2374[_0x194a('0x42')]!==_0x194a('0x43')){var _0x266e06={};_0x266e06[_0x2d2374[_0x194a('0x2b')]]={'$like':'%'+_0x1d18a1['query'][_0x194a('0x3f')]+'%'};return _0x266e06;}})});}_0x55dc2f=_['merge']({},_0x55dc2f,_0x1d18a1[_0x194a('0x44')]);var _0x5137f4={'where':_0x55dc2f['where']};return db[_0x194a('0x2e')][_0x194a('0x1f')](_0x5137f4)[_0x194a('0x23')](function(_0x28a612){_0x1fcfe9[_0x194a('0x1f')]=_0x28a612;if(_0x1d18a1[_0x194a('0x34')][_0x194a('0x45')]){_0x55dc2f['include']=[{'all':!![]}];}return db[_0x194a('0x2e')][_0x194a('0x46')](_0x55dc2f);})[_0x194a('0x23')](function(_0x327b7d){_0x1fcfe9[_0x194a('0x47')]=_0x327b7d;return _0x1fcfe9;})[_0x194a('0x23')](respondWithFilteredResult(_0x5f061e,_0x55dc2f))[_0x194a('0x48')](handleError(_0x5f061e,null));};exports[_0x194a('0x49')]=function(_0x5700ce,_0x2c9a4e){var _0x3ffd17={'raw':!![],'where':{'id':_0x5700ce[_0x194a('0x4a')]['id']}},_0x123563={};_0x123563['model']=_[_0x194a('0x35')](db[_0x194a('0x2e')]['rawAttributes']);_0x123563[_0x194a('0x34')]=_[_0x194a('0x35')](_0x5700ce[_0x194a('0x34')]);_0x123563[_0x194a('0x36')]=_[_0x194a('0x37')](_0x123563['model'],_0x123563[_0x194a('0x34')]);_0x3ffd17[_0x194a('0x38')]=_['intersection'](_0x123563[_0x194a('0x32')],qs[_0x194a('0x39')](_0x5700ce[_0x194a('0x34')]['fields']));_0x3ffd17[_0x194a('0x38')]=_0x3ffd17[_0x194a('0x38')][_0x194a('0x4b')]?_0x3ffd17[_0x194a('0x38')]:_0x123563['model'];if(_0x5700ce['query'][_0x194a('0x45')]){_0x3ffd17[_0x194a('0x4c')]=[{'all':!![]}];}_0x3ffd17=_[_0x194a('0x40')]({},_0x3ffd17,_0x5700ce[_0x194a('0x44')]);return db[_0x194a('0x2e')][_0x194a('0x4d')](_0x3ffd17)[_0x194a('0x23')](handleEntityNotFound(_0x2c9a4e,null))[_0x194a('0x23')](respondWithResult(_0x2c9a4e,null))['catch'](handleError(_0x2c9a4e,null));};exports[_0x194a('0x4e')]=function(_0x54af8f,_0x389238){return db[_0x194a('0x2e')][_0x194a('0x4e')](_0x54af8f[_0x194a('0x4f')],{})['then'](function(_0x2f4d6c){var _0x4d0114=_0x54af8f[_0x194a('0x50')]['get']({'plain':!![]});if(!_0x4d0114)throw new Error(_0x194a('0x51'));if(_0x4d0114[_0x194a('0x52')]==='user'){var _0x5ab612=_0x2f4d6c[_0x194a('0x25')]({'plain':!![]});var _0x1d6fff=_0x194a('0x26');return db[_0x194a('0x53')][_0x194a('0x4d')]({'where':{'name':_0x1d6fff,'userProfileId':_0x4d0114[_0x194a('0x54')]},'raw':!![]})['then'](function(_0x38b05b){if(_0x38b05b&&_0x38b05b[_0x194a('0x55')]===0x0){return db[_0x194a('0x27')][_0x194a('0x4e')]({'name':_0x5ab612[_0x194a('0x2b')],'resourceId':_0x5ab612['id'],'type':_0x38b05b[_0x194a('0x2b')],'sectionId':_0x38b05b['id']},{})['then'](function(){return _0x2f4d6c;});}else{return _0x2f4d6c;}})[_0x194a('0x48')](function(_0x35e4cb){logger[_0x194a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35e4cb);throw _0x35e4cb;});}return _0x2f4d6c;})[_0x194a('0x23')](respondWithResult(_0x389238,0xc9))[_0x194a('0x48')](handleError(_0x389238,null));};exports[_0x194a('0x22')]=function(_0x507ea0,_0xb739ee){if(_0x507ea0['body']['id']){delete _0x507ea0[_0x194a('0x4f')]['id'];}return db[_0x194a('0x2e')][_0x194a('0x4d')]({'where':{'id':_0x507ea0[_0x194a('0x4a')]['id']}})[_0x194a('0x23')](handleEntityNotFound(_0xb739ee,null))['then'](saveUpdates(_0x507ea0['body'],null))[_0x194a('0x23')](respondWithResult(_0xb739ee,null))[_0x194a('0x48')](handleError(_0xb739ee,null));};exports['destroy']=function(_0x246dac,_0x160d67){return db['SmsQueue'][_0x194a('0x4d')]({'where':{'id':_0x246dac[_0x194a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x160d67,null))[_0x194a('0x23')](removeEntity(_0x160d67,null))[_0x194a('0x48')](handleError(_0x160d67,null));};exports[_0x194a('0x56')]=function(_0x2bbca0,_0x734c10){return db[_0x194a('0x2e')][_0x194a('0x56')]()[_0x194a('0x23')](respondWithResult(_0x734c10,null))[_0x194a('0x48')](handleError(_0x734c10,null));};exports[_0x194a('0x57')]=function(_0x29c1f1,_0x4025fb,_0x430a8f){var _0x1e1507={'raw':!![],'where':{}},_0x11d4f2={},_0x2f8189;return db[_0x194a('0x2e')][_0x194a('0x58')]({'where':{'id':_0x29c1f1[_0x194a('0x4a')]['id']}})[_0x194a('0x23')](handleEntityNotFound(_0x4025fb,null))[_0x194a('0x23')](function(_0x2a46b3){if(_0x2a46b3){_0x2f8189=_0x2a46b3[_0x194a('0x25')]({'plain':!![]});_0x11d4f2[_0x194a('0x32')]=_[_0x194a('0x35')](db[_0x194a('0x59')][_0x194a('0x2f')]);_0x11d4f2[_0x194a('0x34')]=_[_0x194a('0x35')](_0x29c1f1['query']);_0x11d4f2['filters']=_[_0x194a('0x37')](_0x11d4f2[_0x194a('0x32')],_0x11d4f2['query']);_0x1e1507['attributes']=_[_0x194a('0x37')](_0x11d4f2['model'],qs[_0x194a('0x39')](_0x29c1f1[_0x194a('0x34')]['fields']));_0x1e1507[_0x194a('0x38')]=_0x1e1507[_0x194a('0x38')]['length']?_0x1e1507['attributes']:_0x11d4f2['model'];if(!_0x29c1f1[_0x194a('0x34')][_0x194a('0x3a')](_0x194a('0x3b'))){_0x1e1507[_0x194a('0x1d')]=qs[_0x194a('0x1d')](_0x29c1f1[_0x194a('0x34')][_0x194a('0x1d')]);_0x1e1507[_0x194a('0x1c')]=qs[_0x194a('0x1c')](_0x29c1f1[_0x194a('0x34')]['offset']);}_0x1e1507[_0x194a('0x3c')]=qs[_0x194a('0x3d')](_0x29c1f1[_0x194a('0x34')]['sort']);_0x1e1507[_0x194a('0x41')]=qs[_0x194a('0x36')](_[_0x194a('0x3e')](_0x29c1f1[_0x194a('0x34')],_0x11d4f2[_0x194a('0x36')]));_0x1e1507[_0x194a('0x41')][_0x194a('0x5a')]=_0x2a46b3['id'];if(_0x29c1f1['query'][_0x194a('0x3f')]){_0x1e1507[_0x194a('0x41')]=_['merge'](_0x1e1507[_0x194a('0x41')],{'$or':_[_0x194a('0x33')](_0x1e1507[_0x194a('0x38')],function(_0x4ab753){var _0x12a83d={};_0x12a83d[_0x4ab753]={'$like':'%'+_0x29c1f1[_0x194a('0x34')]['filter']+'%'};return _0x12a83d;})});}_0x1e1507=_[_0x194a('0x40')]({},_0x1e1507,_0x29c1f1[_0x194a('0x44')]);return db[_0x194a('0x59')][_0x194a('0x46')](_0x1e1507);}})[_0x194a('0x23')](function(_0x551def){if(_0x551def){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x551def,_0x194a('0x5b')),'role':'agent'},'attributes':['id',_0x194a('0x2b'),'smsPause',_0x194a('0x5c'),_0x194a('0x5d')]});}})[_0x194a('0x23')](function(_0x5b4d37){if(_0x5b4d37){return{'count':_0x5b4d37['count'],'rows':_[_0x194a('0x33')](_0x5b4d37[_0x194a('0x47')],function(_0xddad31){return{'membername':_0xddad31[_0x194a('0x2b')],'UserId':_0xddad31['id'],'queue_name':_0x2f8189[_0x194a('0x2b')],'SmsQueueId':_0x2f8189['id'],'interface':util['format'](_0x194a('0x5e'),_0x194a('0x5f'),_0xddad31[_0x194a('0x2b')]),'penalty':0x0,'paused':_0xddad31[_0x194a('0x60')],'createdAt':_0xddad31[_0x194a('0x5d')],'updatedAt':_0xddad31[_0x194a('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x194a('0x23')](respondWithFilteredResult(_0x4025fb,_0x1e1507))[_0x194a('0x48')](handleError(_0x4025fb,null));};exports[_0x194a('0x61')]=function(_0x26828,_0x3bc8f6,_0x21635d){var _0x61f1a7={};var _0x2b3dd4={};var _0x11cc93;var _0x57fbe2;return db[_0x194a('0x2e')][_0x194a('0x58')]({'where':{'id':_0x26828['params']['id']}})[_0x194a('0x23')](handleEntityNotFound(_0x3bc8f6,null))[_0x194a('0x23')](function(_0x40a168){if(_0x40a168){_0x11cc93=_0x40a168;_0x2b3dd4[_0x194a('0x32')]=_[_0x194a('0x35')](db[_0x194a('0x62')][_0x194a('0x2f')]);_0x2b3dd4[_0x194a('0x34')]=_['keys'](_0x26828[_0x194a('0x34')]);_0x2b3dd4[_0x194a('0x36')]=_[_0x194a('0x37')](_0x2b3dd4[_0x194a('0x32')],_0x2b3dd4[_0x194a('0x34')]);_0x61f1a7[_0x194a('0x38')]=_[_0x194a('0x37')](_0x2b3dd4['model'],qs[_0x194a('0x39')](_0x26828['query'][_0x194a('0x39')]));_0x61f1a7['attributes']=_0x61f1a7[_0x194a('0x38')]['length']?_0x61f1a7[_0x194a('0x38')]:_0x2b3dd4[_0x194a('0x32')];_0x61f1a7[_0x194a('0x3c')]=qs[_0x194a('0x3d')](_0x26828[_0x194a('0x34')][_0x194a('0x3d')]);_0x61f1a7[_0x194a('0x41')]=qs['filters'](_[_0x194a('0x3e')](_0x26828[_0x194a('0x34')],_0x2b3dd4[_0x194a('0x36')]));if(_0x26828[_0x194a('0x34')][_0x194a('0x3f')]){_0x61f1a7[_0x194a('0x41')]=_['merge'](_0x61f1a7[_0x194a('0x41')],{'$or':_['map'](_0x61f1a7[_0x194a('0x38')],function(_0x16d0d0){var _0x3f3be3={};_0x3f3be3[_0x16d0d0]={'$like':'%'+_0x26828[_0x194a('0x34')][_0x194a('0x3f')]+'%'};return _0x3f3be3;})});}_0x61f1a7=_[_0x194a('0x40')]({},_0x61f1a7,_0x26828[_0x194a('0x44')]);return _0x11cc93['getTeams'](_0x61f1a7);}})[_0x194a('0x23')](function(_0x28c758){if(_0x28c758){_0x57fbe2=_0x28c758[_0x194a('0x4b')];if(!_0x26828[_0x194a('0x34')][_0x194a('0x3a')](_0x194a('0x3b'))){_0x61f1a7['limit']=qs[_0x194a('0x1d')](_0x26828[_0x194a('0x34')][_0x194a('0x1d')]);_0x61f1a7[_0x194a('0x1c')]=qs[_0x194a('0x1c')](_0x26828[_0x194a('0x34')]['offset']);}return _0x11cc93[_0x194a('0x61')](_0x61f1a7);}})[_0x194a('0x23')](function(_0x325fb5){if(_0x325fb5){return _0x325fb5?{'count':_0x57fbe2,'rows':_0x325fb5}:null;}})[_0x194a('0x23')](respondWithResult(_0x3bc8f6,null))[_0x194a('0x48')](handleError(_0x3bc8f6,null));};exports[_0x194a('0x63')]=function(_0x18237b,_0x2158e1,_0x248dc1){var _0x68bdb3=_0x18237b['body'][_0x194a('0x64')];return db[_0x194a('0x62')][_0x194a('0x46')]({'where':{'id':_0x68bdb3},'attributes':['id'],'include':[{'model':db[_0x194a('0x65')],'as':'Agents','attributes':['id',_0x194a('0x2b'),'online',_0x194a('0x66'),'interface'],'raw':!![]}]})[_0x194a('0x23')](function(_0x27c241){if(_0x27c241){var _0x29adf5=_['flatMap'](_0x27c241,function(_0x496cd1){var _0x267994=_0x496cd1[_0x194a('0x25')]({'plain':!![]});return _0x267994[_0x194a('0x67')];});return db['SmsQueue'][_0x194a('0x4d')]({'where':{'id':_0x18237b['params']['id']}})[_0x194a('0x23')](function(_0x49d539){return db[_0x194a('0x68')]['transaction'](function(_0x985bc5){return _0x49d539[_0x194a('0x63')](_0x68bdb3,{'transaction':_0x985bc5})['then'](function(){return BPromise['each'](_0x29adf5,function(_0x449094){return db[_0x194a('0x59')][_0x194a('0x69')]({'where':{'UserId':_0x449094['id'],'SmsQueueId':_0x18237b['params']['id']},'transaction':_0x985bc5});});})[_0x194a('0x23')](function(){_0x29adf5[_0x194a('0x6a')](function(_0x8b9e88){socket[_0x194a('0x6b')](_0x194a('0x6c'),{'UserId':_0x8b9e88['id'],'SmsQueueId':_0x49d539['id']});});});});});}})['then'](respondWithStatusCode(_0x2158e1,null))[_0x194a('0x48')](handleError(_0x2158e1,null));};exports[_0x194a('0x6d')]=function(_0x85ded7,_0x5ec448,_0x420d7f){return db['Team'][_0x194a('0x46')]({'where':{'id':_0x85ded7[_0x194a('0x34')][_0x194a('0x64')]},'attributes':['id'],'include':[{'model':db[_0x194a('0x65')],'as':_0x194a('0x67'),'attributes':['id'],'raw':!![]}]})[_0x194a('0x23')](handleEntityNotFound(_0x5ec448,null))[_0x194a('0x23')](function(_0x2a8286){var _0x389f4e=_[_0x194a('0x33')](_0x2a8286,'id');var _0x332d6c=[];var _0x280017=[];var _0xd866fa=squel[_0x194a('0x6e')]();_0xd866fa[_0x194a('0x6f')](_0x194a('0x70'))['from'](_0x194a('0x71'),'tq')[_0x194a('0x72')](_0x194a('0x73'),'ut',_0x194a('0x74'))[_0x194a('0x41')](_0x194a('0x75'),_0x85ded7[_0x194a('0x4a')]['id']);for(var _0x33f037=0x0;_0x33f037<_0x2a8286[_0x194a('0x4b')];_0x33f037+=0x1){let _0x6938b6=_0x2a8286[_0x33f037];for(var _0x452d8d=0x0;_0x452d8d<_0x6938b6[_0x194a('0x67')][_0x194a('0x4b')];_0x452d8d+=0x1){let _0x2b6048=_0x6938b6[_0x194a('0x67')][_0x452d8d];var _0x31dbf2=_0xd866fa[_0x194a('0x76')]();_0x31dbf2[_0x194a('0x41')](_0x194a('0x77'),_0x2b6048['id']);_0x280017['push'](db[_0x194a('0x68')][_0x194a('0x34')](_0x31dbf2['toString'](),{'type':db[_0x194a('0x68')][_0x194a('0x78')][_0x194a('0x79')]})[_0x194a('0x23')](function(_0x499958){if(_0x499958[_0x194a('0x4b')]===0x1){return _0x2b6048['id'];}else{var _0x8a9f5b=_[_0x194a('0x7a')](_[_0x194a('0x33')](_0x499958,_0x194a('0x7b')),function(_0x4b0a71){return _[_0x194a('0x7c')](_0x389f4e,_0x4b0a71);});if(_0x8a9f5b){return _0x2b6048['id'];}}}));}}return BPromise[_0x194a('0x7d')](_0x280017)[_0x194a('0x23')](function(_0x1e9984){_0x332d6c=_(_0x332d6c)['union'](_0x1e9984)[_0x194a('0x7e')]()[_0x194a('0x7f')]();return db[_0x194a('0x2e')][_0x194a('0x4d')]({'where':{'id':_0x85ded7[_0x194a('0x4a')]['id']}})[_0x194a('0x23')](function(_0x21339e){return db['sequelize']['transaction'](function(_0x2ecbb8){return _0x21339e[_0x194a('0x6d')](_0x85ded7['query'][_0x194a('0x64')],{'transaction':_0x2ecbb8})[_0x194a('0x23')](function(){if(!_['isEmpty'](_0x332d6c)){return _0x21339e[_0x194a('0x80')](_0x332d6c,{'transaction':_0x2ecbb8});}})['then'](function(){_0x332d6c[_0x194a('0x6a')](function(_0x202973){socket[_0x194a('0x6b')](_0x194a('0x81'),{'UserId':_0x202973,'SmsQueueId':_0x21339e['id']});});});});});});})[_0x194a('0x23')](respondWithStatusCode(_0x5ec448,null))[_0x194a('0x48')](handleError(_0x5ec448,null));};exports['addAgents']=function(_0x4b8b48,_0x5f1246,_0x2fea2d){return db['SmsQueue'][_0x194a('0x4d')]({'where':{'id':_0x4b8b48[_0x194a('0x4a')]['id']}})[_0x194a('0x23')](handleEntityNotFound(_0x5f1246,null))['then'](function(_0x1b412e){if(_0x1b412e){return _0x1b412e['addAgents'](_0x4b8b48['body'][_0x194a('0x64')],_[_0x194a('0x82')](_0x4b8b48[_0x194a('0x4f')],[_0x194a('0x64'),'id'])||{})['spread'](function(_0x14c557){for(var _0x1c9ecb=0x0;_0x1c9ecb<_0x4b8b48['body'][_0x194a('0x64')][_0x194a('0x4b')];_0x1c9ecb+=0x1){socket[_0x194a('0x6b')](_0x194a('0x6c'),{'UserId':Number(_0x4b8b48[_0x194a('0x4f')][_0x194a('0x64')][_0x1c9ecb]),'SmsQueueId':Number(_0x4b8b48[_0x194a('0x4a')]['id'])});}return _0x14c557;});}})[_0x194a('0x23')](respondWithResult(_0x5f1246,null))[_0x194a('0x48')](handleError(_0x5f1246,null));};exports[_0x194a('0x80')]=function(_0x400a1c,_0x488625,_0x4cf277){return db[_0x194a('0x2e')]['find']({'where':{'id':_0x400a1c['params']['id']}})['then'](handleEntityNotFound(_0x488625,null))[_0x194a('0x23')](function(_0x52c4b7){if(_0x52c4b7){return _0x52c4b7['removeAgents'](_0x400a1c[_0x194a('0x34')][_0x194a('0x64')])[_0x194a('0x23')](function(){if(_['isArray'](_0x400a1c[_0x194a('0x34')]['ids'])){for(var _0x544540=0x0;_0x544540<_0x400a1c[_0x194a('0x34')][_0x194a('0x64')][_0x194a('0x4b')];_0x544540+=0x1){socket[_0x194a('0x6b')](_0x194a('0x81'),{'UserId':Number(_0x400a1c[_0x194a('0x34')][_0x194a('0x64')][_0x544540]),'SmsQueueId':Number(_0x400a1c[_0x194a('0x4a')]['id'])});}}else{socket[_0x194a('0x6b')](_0x194a('0x81'),{'UserId':Number(_0x400a1c[_0x194a('0x34')]['ids']),'SmsQueueId':Number(_0x400a1c[_0x194a('0x4a')]['id'])});}});}})[_0x194a('0x23')](respondWithStatusCode(_0x488625,null))[_0x194a('0x48')](handleError(_0x488625,null));};exports[_0x194a('0x83')]=function(_0x380a40,_0x456ec6,_0x43bba0){var _0x244388={};var _0x4cc142={};var _0x4a33c6;var _0x1dfbab;return db[_0x194a('0x2e')][_0x194a('0x58')]({'where':{'id':_0x380a40[_0x194a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x456ec6,null))[_0x194a('0x23')](function(_0x1bafc7){if(_0x1bafc7){_0x4a33c6=_0x1bafc7;_0x4cc142[_0x194a('0x32')]=_[_0x194a('0x35')](db[_0x194a('0x65')][_0x194a('0x2f')]);_0x4cc142['query']=_['keys'](_0x380a40[_0x194a('0x34')]);_0x4cc142['filters']=_[_0x194a('0x37')](_0x4cc142['model'],_0x4cc142[_0x194a('0x34')]);_0x244388[_0x194a('0x38')]=_[_0x194a('0x37')](_0x4cc142['model'],qs[_0x194a('0x39')](_0x380a40['query']['fields']));_0x244388[_0x194a('0x38')]=_0x244388[_0x194a('0x38')][_0x194a('0x4b')]?_0x244388[_0x194a('0x38')]:_0x4cc142['model'];_0x244388[_0x194a('0x3c')]=qs[_0x194a('0x3d')](_0x380a40[_0x194a('0x34')][_0x194a('0x3d')]);_0x244388['where']=qs['filters'](_[_0x194a('0x3e')](_0x380a40[_0x194a('0x34')],_0x4cc142['filters']));if(_0x380a40[_0x194a('0x34')][_0x194a('0x3f')]){_0x244388[_0x194a('0x41')]=_[_0x194a('0x40')](_0x244388['where'],{'$or':_[_0x194a('0x33')](_0x244388[_0x194a('0x38')],function(_0x5188f7){var _0x3c837c={};_0x3c837c[_0x5188f7]={'$like':'%'+_0x380a40[_0x194a('0x34')][_0x194a('0x3f')]+'%'};return _0x3c837c;})});}_0x244388=_[_0x194a('0x40')]({},_0x244388,_0x380a40[_0x194a('0x44')]);return _0x4a33c6[_0x194a('0x83')](_0x244388);}})[_0x194a('0x23')](function(_0x53520d){if(_0x53520d){_0x1dfbab=_0x53520d[_0x194a('0x4b')];if(!_0x380a40['query'][_0x194a('0x3a')](_0x194a('0x3b'))){_0x244388[_0x194a('0x1d')]=qs[_0x194a('0x1d')](_0x380a40['query'][_0x194a('0x1d')]);_0x244388[_0x194a('0x1c')]=qs[_0x194a('0x1c')](_0x380a40['query'][_0x194a('0x1c')]);}return _0x4a33c6[_0x194a('0x83')](_0x244388);}})[_0x194a('0x23')](function(_0x449881){if(_0x449881){return _0x449881?{'count':_0x1dfbab,'rows':_0x449881}:null;}})[_0x194a('0x23')](respondWithResult(_0x456ec6,null))[_0x194a('0x48')](handleError(_0x456ec6,null));}; \ No newline at end of file +var _0x5c96=['forEach','emit','removeTeams','ids','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','filter','options','where','includeAll','SmsQueue','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','userProfileId','autoAssociation','error','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','User','online','interface','flatMap','Agents','sequelize','transaction','findOrCreate'];(function(_0x45f6cb,_0x531af6){var _0x5b7f93=function(_0x1296ba){while(--_0x1296ba){_0x45f6cb['push'](_0x45f6cb['shift']());}};_0x5b7f93(++_0x531af6);}(_0x5c96,0x133));var _0x65c9=function(_0x36d6ae,_0x48f1e6){_0x36d6ae=_0x36d6ae-0x0;var _0x5b53ef=_0x5c96[_0x36d6ae];return _0x5b53ef;};'use strict';var emlformat=require(_0x65c9('0x0'));var rimraf=require(_0x65c9('0x1'));var zipdir=require(_0x65c9('0x2'));var jsonpatch=require(_0x65c9('0x3'));var rp=require('request-promise');var moment=require(_0x65c9('0x4'));var BPromise=require(_0x65c9('0x5'));var Mustache=require(_0x65c9('0x6'));var util=require(_0x65c9('0x7'));var path=require(_0x65c9('0x8'));var sox=require(_0x65c9('0x9'));var csv=require(_0x65c9('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(_0x65c9('0xb'));var jsforce=require(_0x65c9('0xc'));var deskjs=require(_0x65c9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x65c9('0xe'));var Papa=require(_0x65c9('0xf'));var Redis=require(_0x65c9('0x10'));var authService=require(_0x65c9('0x11'));var qs=require(_0x65c9('0x12'));var as=require(_0x65c9('0x13'));var hardwareService=require(_0x65c9('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x65c9('0x15'));var licenseUtil=require(_0x65c9('0x16'));var db=require(_0x65c9('0x17'))['db'];config[_0x65c9('0x18')]=_[_0x65c9('0x19')](config['redis'],{'host':_0x65c9('0x1a'),'port':0x18eb});var socket=require(_0x65c9('0x1b'))(new Redis(config[_0x65c9('0x18')]));require(_0x65c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x171883,_0x1f689e){_0x1f689e=_0x1f689e||0xcc;return function(_0x379f5f){if(_0x379f5f){return _0x171883[_0x65c9('0x1d')](_0x1f689e);}return _0x171883[_0x65c9('0x1e')](_0x1f689e)[_0x65c9('0x1f')]();};}function respondWithResult(_0x46a312,_0x1adc71){_0x1adc71=_0x1adc71||0xc8;return function(_0x3f09e7){if(_0x3f09e7){return _0x46a312[_0x65c9('0x1e')](_0x1adc71)[_0x65c9('0x20')](_0x3f09e7);}};}function respondWithFilteredResult(_0x441989,_0x4d31d3){return function(_0x51f948){if(_0x51f948){var _0x36f667=typeof _0x4d31d3[_0x65c9('0x21')]===_0x65c9('0x22')&&typeof _0x4d31d3[_0x65c9('0x23')]===_0x65c9('0x22');var _0x285850=_0x51f948[_0x65c9('0x24')];var _0x483c1d=_0x36f667?0x0:_0x4d31d3[_0x65c9('0x21')];var _0x4fccab=_0x36f667?_0x51f948['count']:_0x4d31d3['offset']+_0x4d31d3['limit'];var _0x179812;if(_0x4fccab>=_0x285850){_0x4fccab=_0x285850;_0x179812=0xc8;}else{_0x179812=0xce;}_0x441989[_0x65c9('0x1e')](_0x179812);return _0x441989[_0x65c9('0x25')](_0x65c9('0x26'),_0x483c1d+'-'+_0x4fccab+'/'+_0x285850)[_0x65c9('0x20')](_0x51f948);}return null;};}function patchUpdates(_0x106b9e){return function(_0x2a26ca){try{jsonpatch[_0x65c9('0x27')](_0x2a26ca,_0x106b9e,!![]);}catch(_0xd0bf9d){return BPromise[_0x65c9('0x28')](_0xd0bf9d);}return _0x2a26ca[_0x65c9('0x29')]();};}function saveUpdates(_0x5c9593,_0x19d224){return function(_0x28f2b2){if(_0x28f2b2){return _0x28f2b2[_0x65c9('0x2a')](_0x5c9593)[_0x65c9('0x2b')](function(_0x4692b4){return _0x4692b4;});}return null;};}function removeEntity(_0x370e5b,_0x580445){return function(_0x4c6469){if(_0x4c6469){return _0x4c6469[_0x65c9('0x2c')]()[_0x65c9('0x2b')](function(){var _0x5e4b8a=_0x4c6469[_0x65c9('0x2d')]({'plain':!![]});var _0x368e13='SmsQueues';return db[_0x65c9('0x2e')][_0x65c9('0x2c')]({'where':{'type':_0x368e13,'resourceId':_0x5e4b8a['id']}})['then'](function(){return _0x4c6469;});})['then'](function(){_0x370e5b[_0x65c9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x436c32,_0x50fb61){return function(_0x1c8d72){if(!_0x1c8d72){_0x436c32['sendStatus'](0x194);}return _0x1c8d72;};}function handleError(_0x1f4ae7,_0xc02623){_0xc02623=_0xc02623||0x1f4;return function(_0x5780fb){logger['error'](_0x5780fb[_0x65c9('0x2f')]);if(_0x5780fb[_0x65c9('0x30')]){delete _0x5780fb['name'];}_0x1f4ae7[_0x65c9('0x1e')](_0xc02623)['send'](_0x5780fb);};}exports[_0x65c9('0x31')]=function(_0x2ec2d4,_0x242db6){var _0x379a57={},_0x5315f2={},_0x1dcd81={'count':0x0,'rows':[]};var _0x34b80b=_[_0x65c9('0x32')](db['SmsQueue'][_0x65c9('0x33')],function(_0x1da275){return{'name':_0x1da275['fieldName'],'type':_0x1da275[_0x65c9('0x34')]['key']};});_0x5315f2[_0x65c9('0x35')]=_[_0x65c9('0x32')](_0x34b80b,_0x65c9('0x30'));_0x5315f2[_0x65c9('0x36')]=_['keys'](_0x2ec2d4[_0x65c9('0x36')]);_0x5315f2[_0x65c9('0x37')]=_['intersection'](_0x5315f2[_0x65c9('0x35')],_0x5315f2[_0x65c9('0x36')]);_0x379a57[_0x65c9('0x38')]=_[_0x65c9('0x39')](_0x5315f2[_0x65c9('0x35')],qs[_0x65c9('0x3a')](_0x2ec2d4[_0x65c9('0x36')][_0x65c9('0x3a')]));_0x379a57[_0x65c9('0x38')]=_0x379a57[_0x65c9('0x38')][_0x65c9('0x3b')]?_0x379a57[_0x65c9('0x38')]:_0x5315f2[_0x65c9('0x35')];if(!_0x2ec2d4[_0x65c9('0x36')][_0x65c9('0x3c')](_0x65c9('0x3d'))){_0x379a57['limit']=qs[_0x65c9('0x23')](_0x2ec2d4['query'][_0x65c9('0x23')]);_0x379a57[_0x65c9('0x21')]=qs['offset'](_0x2ec2d4['query'][_0x65c9('0x21')]);}_0x379a57[_0x65c9('0x3e')]=qs[_0x65c9('0x3f')](_0x2ec2d4[_0x65c9('0x36')][_0x65c9('0x3f')]);_0x379a57['where']=qs[_0x65c9('0x37')](_['pick'](_0x2ec2d4['query'],_0x5315f2[_0x65c9('0x37')]),_0x34b80b);if(_0x2ec2d4[_0x65c9('0x36')]['filter']){_0x379a57['where']=_[_0x65c9('0x40')](_0x379a57['where'],{'$or':_[_0x65c9('0x32')](_0x34b80b,function(_0x3b76f3){if(_0x3b76f3[_0x65c9('0x34')]!==_0x65c9('0x41')){var _0x3fe16b={};_0x3fe16b[_0x3b76f3[_0x65c9('0x30')]]={'$like':'%'+_0x2ec2d4[_0x65c9('0x36')][_0x65c9('0x42')]+'%'};return _0x3fe16b;}})});}_0x379a57=_['merge']({},_0x379a57,_0x2ec2d4[_0x65c9('0x43')]);var _0x1c88fc={'where':_0x379a57[_0x65c9('0x44')]};return db['SmsQueue']['count'](_0x1c88fc)[_0x65c9('0x2b')](function(_0x5b2e4a){_0x1dcd81[_0x65c9('0x24')]=_0x5b2e4a;if(_0x2ec2d4[_0x65c9('0x36')][_0x65c9('0x45')]){_0x379a57['include']=[{'all':!![]}];}return db[_0x65c9('0x46')][_0x65c9('0x47')](_0x379a57);})[_0x65c9('0x2b')](function(_0x57df04){_0x1dcd81[_0x65c9('0x48')]=_0x57df04;return _0x1dcd81;})[_0x65c9('0x2b')](respondWithFilteredResult(_0x242db6,_0x379a57))[_0x65c9('0x49')](handleError(_0x242db6,null));};exports[_0x65c9('0x4a')]=function(_0x294918,_0x4dda39){var _0x2e556f={'raw':!![],'where':{'id':_0x294918[_0x65c9('0x4b')]['id']}},_0x4f3033={};_0x4f3033['model']=_[_0x65c9('0x4c')](db[_0x65c9('0x46')]['rawAttributes']);_0x4f3033[_0x65c9('0x36')]=_[_0x65c9('0x4c')](_0x294918[_0x65c9('0x36')]);_0x4f3033[_0x65c9('0x37')]=_[_0x65c9('0x39')](_0x4f3033[_0x65c9('0x35')],_0x4f3033['query']);_0x2e556f[_0x65c9('0x38')]=_[_0x65c9('0x39')](_0x4f3033[_0x65c9('0x35')],qs[_0x65c9('0x3a')](_0x294918[_0x65c9('0x36')]['fields']));_0x2e556f['attributes']=_0x2e556f[_0x65c9('0x38')][_0x65c9('0x3b')]?_0x2e556f[_0x65c9('0x38')]:_0x4f3033[_0x65c9('0x35')];if(_0x294918['query'][_0x65c9('0x45')]){_0x2e556f[_0x65c9('0x4d')]=[{'all':!![]}];}_0x2e556f=_[_0x65c9('0x40')]({},_0x2e556f,_0x294918[_0x65c9('0x43')]);return db[_0x65c9('0x46')][_0x65c9('0x4e')](_0x2e556f)[_0x65c9('0x2b')](handleEntityNotFound(_0x4dda39,null))[_0x65c9('0x2b')](respondWithResult(_0x4dda39,null))['catch'](handleError(_0x4dda39,null));};exports[_0x65c9('0x4f')]=function(_0x370782,_0x2d2a27){return db[_0x65c9('0x46')][_0x65c9('0x4f')](_0x370782[_0x65c9('0x50')],{})[_0x65c9('0x2b')](function(_0x3bda0e){var _0x49185e=_0x370782[_0x65c9('0x51')][_0x65c9('0x2d')]({'plain':!![]});if(!_0x49185e)throw new Error(_0x65c9('0x52'));if(_0x49185e['role']==='user'){var _0x427256=_0x3bda0e[_0x65c9('0x2d')]({'plain':!![]});var _0x1d6a9e=_0x65c9('0x53');return db['UserProfileSection']['find']({'where':{'name':_0x1d6a9e,'userProfileId':_0x49185e[_0x65c9('0x54')]},'raw':!![]})[_0x65c9('0x2b')](function(_0x2d3ae5){if(_0x2d3ae5&&_0x2d3ae5[_0x65c9('0x55')]===0x0){return db[_0x65c9('0x2e')][_0x65c9('0x4f')]({'name':_0x427256[_0x65c9('0x30')],'resourceId':_0x427256['id'],'type':_0x2d3ae5[_0x65c9('0x30')],'sectionId':_0x2d3ae5['id']},{})[_0x65c9('0x2b')](function(){return _0x3bda0e;});}else{return _0x3bda0e;}})[_0x65c9('0x49')](function(_0x1ac6ca){logger[_0x65c9('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ac6ca);throw _0x1ac6ca;});}return _0x3bda0e;})[_0x65c9('0x2b')](respondWithResult(_0x2d2a27,0xc9))[_0x65c9('0x49')](handleError(_0x2d2a27,null));};exports['update']=function(_0x5ec50b,_0x3da7d3){if(_0x5ec50b[_0x65c9('0x50')]['id']){delete _0x5ec50b[_0x65c9('0x50')]['id'];}return db['SmsQueue'][_0x65c9('0x4e')]({'where':{'id':_0x5ec50b[_0x65c9('0x4b')]['id']}})[_0x65c9('0x2b')](handleEntityNotFound(_0x3da7d3,null))['then'](saveUpdates(_0x5ec50b[_0x65c9('0x50')],null))[_0x65c9('0x2b')](respondWithResult(_0x3da7d3,null))['catch'](handleError(_0x3da7d3,null));};exports[_0x65c9('0x2c')]=function(_0x36df1a,_0x14dbad){return db[_0x65c9('0x46')][_0x65c9('0x4e')]({'where':{'id':_0x36df1a[_0x65c9('0x4b')]['id']}})[_0x65c9('0x2b')](handleEntityNotFound(_0x14dbad,null))['then'](removeEntity(_0x14dbad,null))[_0x65c9('0x49')](handleError(_0x14dbad,null));};exports[_0x65c9('0x57')]=function(_0x3625ab,_0x1a6c82){return db['SmsQueue'][_0x65c9('0x57')]()['then'](respondWithResult(_0x1a6c82,null))['catch'](handleError(_0x1a6c82,null));};exports[_0x65c9('0x58')]=function(_0x2265a2,_0x4ae956,_0x19afc1){var _0x1526e4={'raw':!![],'where':{}},_0x2ff5bd={},_0x5ba631;return db[_0x65c9('0x46')][_0x65c9('0x59')]({'where':{'id':_0x2265a2['params']['id']}})[_0x65c9('0x2b')](handleEntityNotFound(_0x4ae956,null))[_0x65c9('0x2b')](function(_0x48a44a){if(_0x48a44a){_0x5ba631=_0x48a44a[_0x65c9('0x2d')]({'plain':!![]});_0x2ff5bd[_0x65c9('0x35')]=_[_0x65c9('0x4c')](db[_0x65c9('0x5a')]['rawAttributes']);_0x2ff5bd[_0x65c9('0x36')]=_[_0x65c9('0x4c')](_0x2265a2[_0x65c9('0x36')]);_0x2ff5bd['filters']=_['intersection'](_0x2ff5bd[_0x65c9('0x35')],_0x2ff5bd[_0x65c9('0x36')]);_0x1526e4[_0x65c9('0x38')]=_[_0x65c9('0x39')](_0x2ff5bd[_0x65c9('0x35')],qs[_0x65c9('0x3a')](_0x2265a2[_0x65c9('0x36')]['fields']));_0x1526e4['attributes']=_0x1526e4[_0x65c9('0x38')][_0x65c9('0x3b')]?_0x1526e4['attributes']:_0x2ff5bd[_0x65c9('0x35')];if(!_0x2265a2[_0x65c9('0x36')][_0x65c9('0x3c')]('nolimit')){_0x1526e4[_0x65c9('0x23')]=qs[_0x65c9('0x23')](_0x2265a2[_0x65c9('0x36')][_0x65c9('0x23')]);_0x1526e4[_0x65c9('0x21')]=qs[_0x65c9('0x21')](_0x2265a2[_0x65c9('0x36')][_0x65c9('0x21')]);}_0x1526e4[_0x65c9('0x3e')]=qs['sort'](_0x2265a2['query'][_0x65c9('0x3f')]);_0x1526e4['where']=qs['filters'](_[_0x65c9('0x5b')](_0x2265a2[_0x65c9('0x36')],_0x2ff5bd[_0x65c9('0x37')]));_0x1526e4[_0x65c9('0x44')][_0x65c9('0x5c')]=_0x48a44a['id'];if(_0x2265a2[_0x65c9('0x36')][_0x65c9('0x42')]){_0x1526e4[_0x65c9('0x44')]=_[_0x65c9('0x40')](_0x1526e4[_0x65c9('0x44')],{'$or':_[_0x65c9('0x32')](_0x1526e4['attributes'],function(_0x27a991){var _0x121c7b={};_0x121c7b[_0x27a991]={'$like':'%'+_0x2265a2['query'][_0x65c9('0x42')]+'%'};return _0x121c7b;})});}_0x1526e4=_[_0x65c9('0x40')]({},_0x1526e4,_0x2265a2[_0x65c9('0x43')]);return db[_0x65c9('0x5a')][_0x65c9('0x47')](_0x1526e4);}})[_0x65c9('0x2b')](function(_0x462ef1){if(_0x462ef1){return db['User'][_0x65c9('0x5d')]({'where':{'id':_[_0x65c9('0x32')](_0x462ef1,_0x65c9('0x5e')),'role':_0x65c9('0x5f')},'attributes':['id','name',_0x65c9('0x60'),_0x65c9('0x61'),'createdAt']});}})[_0x65c9('0x2b')](function(_0x3c794b){if(_0x3c794b){return{'count':_0x3c794b['count'],'rows':_[_0x65c9('0x32')](_0x3c794b[_0x65c9('0x48')],function(_0x132651){return{'membername':_0x132651['name'],'UserId':_0x132651['id'],'queue_name':_0x5ba631['name'],'SmsQueueId':_0x5ba631['id'],'interface':util[_0x65c9('0x62')](_0x65c9('0x63'),_0x65c9('0x64'),_0x132651['name']),'penalty':0x0,'paused':_0x132651[_0x65c9('0x60')],'createdAt':_0x132651[_0x65c9('0x65')],'updatedAt':_0x132651[_0x65c9('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65c9('0x2b')](respondWithFilteredResult(_0x4ae956,_0x1526e4))[_0x65c9('0x49')](handleError(_0x4ae956,null));};exports[_0x65c9('0x66')]=function(_0xea0d11,_0x489724,_0x2d96b5){var _0x52b50d={};var _0xb43947={};var _0x541ac4;var _0x27864e;return db[_0x65c9('0x46')][_0x65c9('0x59')]({'where':{'id':_0xea0d11[_0x65c9('0x4b')]['id']}})[_0x65c9('0x2b')](handleEntityNotFound(_0x489724,null))['then'](function(_0x1750f3){if(_0x1750f3){_0x541ac4=_0x1750f3;_0xb43947[_0x65c9('0x35')]=_[_0x65c9('0x4c')](db[_0x65c9('0x67')][_0x65c9('0x33')]);_0xb43947[_0x65c9('0x36')]=_[_0x65c9('0x4c')](_0xea0d11[_0x65c9('0x36')]);_0xb43947[_0x65c9('0x37')]=_[_0x65c9('0x39')](_0xb43947[_0x65c9('0x35')],_0xb43947[_0x65c9('0x36')]);_0x52b50d['attributes']=_['intersection'](_0xb43947['model'],qs[_0x65c9('0x3a')](_0xea0d11['query'][_0x65c9('0x3a')]));_0x52b50d[_0x65c9('0x38')]=_0x52b50d[_0x65c9('0x38')][_0x65c9('0x3b')]?_0x52b50d[_0x65c9('0x38')]:_0xb43947[_0x65c9('0x35')];_0x52b50d['order']=qs[_0x65c9('0x3f')](_0xea0d11['query'][_0x65c9('0x3f')]);_0x52b50d[_0x65c9('0x44')]=qs[_0x65c9('0x37')](_[_0x65c9('0x5b')](_0xea0d11['query'],_0xb43947[_0x65c9('0x37')]));if(_0xea0d11['query'][_0x65c9('0x42')]){_0x52b50d[_0x65c9('0x44')]=_[_0x65c9('0x40')](_0x52b50d['where'],{'$or':_[_0x65c9('0x32')](_0x52b50d['attributes'],function(_0x5a694a){var _0x4cc8aa={};_0x4cc8aa[_0x5a694a]={'$like':'%'+_0xea0d11[_0x65c9('0x36')][_0x65c9('0x42')]+'%'};return _0x4cc8aa;})});}_0x52b50d=_['merge']({},_0x52b50d,_0xea0d11[_0x65c9('0x43')]);return _0x541ac4['getTeams'](_0x52b50d);}})[_0x65c9('0x2b')](function(_0x42a9e6){if(_0x42a9e6){_0x27864e=_0x42a9e6[_0x65c9('0x3b')];if(!_0xea0d11[_0x65c9('0x36')][_0x65c9('0x3c')]('nolimit')){_0x52b50d[_0x65c9('0x23')]=qs[_0x65c9('0x23')](_0xea0d11[_0x65c9('0x36')][_0x65c9('0x23')]);_0x52b50d[_0x65c9('0x21')]=qs[_0x65c9('0x21')](_0xea0d11[_0x65c9('0x36')][_0x65c9('0x21')]);}return _0x541ac4['getTeams'](_0x52b50d);}})['then'](function(_0x48bfcd){if(_0x48bfcd){return _0x48bfcd?{'count':_0x27864e,'rows':_0x48bfcd}:null;}})[_0x65c9('0x2b')](respondWithResult(_0x489724,null))[_0x65c9('0x49')](handleError(_0x489724,null));};exports[_0x65c9('0x68')]=function(_0x39d726,_0x3f14d1,_0x444231){var _0x24d57e=_0x39d726['body']['ids'];return db[_0x65c9('0x67')][_0x65c9('0x47')]({'where':{'id':_0x24d57e},'attributes':['id'],'include':[{'model':db[_0x65c9('0x69')],'as':'Agents','attributes':['id',_0x65c9('0x30'),_0x65c9('0x6a'),'voicePause',_0x65c9('0x6b')],'raw':!![]}]})['then'](function(_0xc4127b){if(_0xc4127b){var _0x284731=_[_0x65c9('0x6c')](_0xc4127b,function(_0x40234e){var _0x52ff56=_0x40234e[_0x65c9('0x2d')]({'plain':!![]});return _0x52ff56[_0x65c9('0x6d')];});return db[_0x65c9('0x46')]['find']({'where':{'id':_0x39d726[_0x65c9('0x4b')]['id']}})[_0x65c9('0x2b')](function(_0x3864d5){return db[_0x65c9('0x6e')][_0x65c9('0x6f')](function(_0x2f5a2c){return _0x3864d5[_0x65c9('0x68')](_0x24d57e,{'transaction':_0x2f5a2c})[_0x65c9('0x2b')](function(){return BPromise['each'](_0x284731,function(_0x4330f0){return db[_0x65c9('0x5a')][_0x65c9('0x70')]({'where':{'UserId':_0x4330f0['id'],'SmsQueueId':_0x39d726[_0x65c9('0x4b')]['id']},'transaction':_0x2f5a2c});});})[_0x65c9('0x2b')](function(){_0x284731[_0x65c9('0x71')](function(_0x2440b4){socket[_0x65c9('0x72')]('userSmsQueue:save',{'UserId':_0x2440b4['id'],'SmsQueueId':_0x3864d5['id']});});});});});}})[_0x65c9('0x2b')](respondWithStatusCode(_0x3f14d1,null))[_0x65c9('0x49')](handleError(_0x3f14d1,null));};exports[_0x65c9('0x73')]=function(_0x1d7f8e,_0x5da49c,_0x52bdb9){return db['Team'][_0x65c9('0x47')]({'where':{'id':_0x1d7f8e[_0x65c9('0x36')][_0x65c9('0x74')]},'attributes':['id'],'include':[{'model':db[_0x65c9('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x65c9('0x2b')](handleEntityNotFound(_0x5da49c,null))[_0x65c9('0x2b')](function(_0x53262f){var _0x176727=_[_0x65c9('0x32')](_0x53262f,'id');var _0x1c2b45=[];var _0x5b4921=[];var _0x477dc2=squel['select']();_0x477dc2['field'](_0x65c9('0x75'))['from'](_0x65c9('0x76'),'tq')[_0x65c9('0x77')](_0x65c9('0x78'),'ut',_0x65c9('0x79'))[_0x65c9('0x44')](_0x65c9('0x7a'),_0x1d7f8e[_0x65c9('0x4b')]['id']);for(var _0x25a136=0x0;_0x25a136<_0x53262f['length'];_0x25a136+=0x1){let _0x3f8b22=_0x53262f[_0x25a136];for(var _0x141961=0x0;_0x141961<_0x3f8b22['Agents'][_0x65c9('0x3b')];_0x141961+=0x1){let _0x4333b7=_0x3f8b22[_0x65c9('0x6d')][_0x141961];var _0x4408bb=_0x477dc2[_0x65c9('0x7b')]();_0x4408bb[_0x65c9('0x44')]('ut.UserId\x20=\x20?',_0x4333b7['id']);_0x5b4921['push'](db['sequelize'][_0x65c9('0x36')](_0x4408bb['toString'](),{'type':db[_0x65c9('0x6e')][_0x65c9('0x7c')][_0x65c9('0x7d')]})[_0x65c9('0x2b')](function(_0x3b7748){if(_0x3b7748['length']===0x1){return _0x4333b7['id'];}else{var _0x12d66c=_[_0x65c9('0x7e')](_[_0x65c9('0x32')](_0x3b7748,_0x65c9('0x7f')),function(_0x31f5c8){return _[_0x65c9('0x80')](_0x176727,_0x31f5c8);});if(_0x12d66c){return _0x4333b7['id'];}}}));}}return BPromise[_0x65c9('0x81')](_0x5b4921)['then'](function(_0x3247ea){_0x1c2b45=_(_0x1c2b45)[_0x65c9('0x82')](_0x3247ea)[_0x65c9('0x83')]()[_0x65c9('0x84')]();return db[_0x65c9('0x46')][_0x65c9('0x4e')]({'where':{'id':_0x1d7f8e['params']['id']}})[_0x65c9('0x2b')](function(_0x19aa87){return db['sequelize'][_0x65c9('0x6f')](function(_0x17cd47){return _0x19aa87[_0x65c9('0x73')](_0x1d7f8e[_0x65c9('0x36')][_0x65c9('0x74')],{'transaction':_0x17cd47})[_0x65c9('0x2b')](function(){if(!_[_0x65c9('0x85')](_0x1c2b45)){return _0x19aa87[_0x65c9('0x86')](_0x1c2b45,{'transaction':_0x17cd47});}})[_0x65c9('0x2b')](function(){_0x1c2b45[_0x65c9('0x71')](function(_0xcc8aa2){socket[_0x65c9('0x72')]('userSmsQueue:remove',{'UserId':_0xcc8aa2,'SmsQueueId':_0x19aa87['id']});});});});});});})[_0x65c9('0x2b')](respondWithStatusCode(_0x5da49c,null))[_0x65c9('0x49')](handleError(_0x5da49c,null));};exports['addAgents']=function(_0x4d0677,_0x318ad9,_0x3299df){return db[_0x65c9('0x46')][_0x65c9('0x4e')]({'where':{'id':_0x4d0677[_0x65c9('0x4b')]['id']}})[_0x65c9('0x2b')](handleEntityNotFound(_0x318ad9,null))[_0x65c9('0x2b')](function(_0x219d1c){if(_0x219d1c){return _0x219d1c[_0x65c9('0x87')](_0x4d0677[_0x65c9('0x50')][_0x65c9('0x74')],_['omit'](_0x4d0677['body'],[_0x65c9('0x74'),'id'])||{})[_0x65c9('0x88')](function(_0x241c2f){for(var _0x1ec42f=0x0;_0x1ec42f<_0x4d0677[_0x65c9('0x50')]['ids'][_0x65c9('0x3b')];_0x1ec42f+=0x1){socket[_0x65c9('0x72')]('userSmsQueue:save',{'UserId':Number(_0x4d0677[_0x65c9('0x50')][_0x65c9('0x74')][_0x1ec42f]),'SmsQueueId':Number(_0x4d0677['params']['id'])});}return _0x241c2f;});}})[_0x65c9('0x2b')](respondWithResult(_0x318ad9,null))[_0x65c9('0x49')](handleError(_0x318ad9,null));};exports[_0x65c9('0x86')]=function(_0x445a68,_0x1e1b72,_0x4dc974){return db['SmsQueue']['find']({'where':{'id':_0x445a68[_0x65c9('0x4b')]['id']}})[_0x65c9('0x2b')](handleEntityNotFound(_0x1e1b72,null))[_0x65c9('0x2b')](function(_0x48930c){if(_0x48930c){return _0x48930c[_0x65c9('0x86')](_0x445a68[_0x65c9('0x36')][_0x65c9('0x74')])['then'](function(){if(_[_0x65c9('0x89')](_0x445a68[_0x65c9('0x36')][_0x65c9('0x74')])){for(var _0x217a46=0x0;_0x217a46<_0x445a68[_0x65c9('0x36')]['ids'][_0x65c9('0x3b')];_0x217a46+=0x1){socket[_0x65c9('0x72')](_0x65c9('0x8a'),{'UserId':Number(_0x445a68['query'][_0x65c9('0x74')][_0x217a46]),'SmsQueueId':Number(_0x445a68[_0x65c9('0x4b')]['id'])});}}else{socket[_0x65c9('0x72')](_0x65c9('0x8a'),{'UserId':Number(_0x445a68['query'][_0x65c9('0x74')]),'SmsQueueId':Number(_0x445a68['params']['id'])});}});}})[_0x65c9('0x2b')](respondWithStatusCode(_0x1e1b72,null))['catch'](handleError(_0x1e1b72,null));};exports[_0x65c9('0x8b')]=function(_0x4b7452,_0x2bbf28,_0x394945){var _0x2fa1e8={};var _0xbf14c2={};var _0x219c05;var _0x9fb7f9;return db['SmsQueue'][_0x65c9('0x59')]({'where':{'id':_0x4b7452[_0x65c9('0x4b')]['id']}})[_0x65c9('0x2b')](handleEntityNotFound(_0x2bbf28,null))['then'](function(_0x251fbd){if(_0x251fbd){_0x219c05=_0x251fbd;_0xbf14c2[_0x65c9('0x35')]=_['keys'](db[_0x65c9('0x69')][_0x65c9('0x33')]);_0xbf14c2[_0x65c9('0x36')]=_[_0x65c9('0x4c')](_0x4b7452[_0x65c9('0x36')]);_0xbf14c2[_0x65c9('0x37')]=_[_0x65c9('0x39')](_0xbf14c2['model'],_0xbf14c2['query']);_0x2fa1e8[_0x65c9('0x38')]=_[_0x65c9('0x39')](_0xbf14c2[_0x65c9('0x35')],qs[_0x65c9('0x3a')](_0x4b7452['query']['fields']));_0x2fa1e8[_0x65c9('0x38')]=_0x2fa1e8[_0x65c9('0x38')][_0x65c9('0x3b')]?_0x2fa1e8[_0x65c9('0x38')]:_0xbf14c2['model'];_0x2fa1e8[_0x65c9('0x3e')]=qs[_0x65c9('0x3f')](_0x4b7452[_0x65c9('0x36')][_0x65c9('0x3f')]);_0x2fa1e8[_0x65c9('0x44')]=qs[_0x65c9('0x37')](_[_0x65c9('0x5b')](_0x4b7452['query'],_0xbf14c2[_0x65c9('0x37')]));if(_0x4b7452[_0x65c9('0x36')][_0x65c9('0x42')]){_0x2fa1e8[_0x65c9('0x44')]=_['merge'](_0x2fa1e8[_0x65c9('0x44')],{'$or':_['map'](_0x2fa1e8[_0x65c9('0x38')],function(_0x108c49){var _0x4813b1={};_0x4813b1[_0x108c49]={'$like':'%'+_0x4b7452[_0x65c9('0x36')]['filter']+'%'};return _0x4813b1;})});}_0x2fa1e8=_[_0x65c9('0x40')]({},_0x2fa1e8,_0x4b7452['options']);return _0x219c05[_0x65c9('0x8b')](_0x2fa1e8);}})[_0x65c9('0x2b')](function(_0x5e8418){if(_0x5e8418){_0x9fb7f9=_0x5e8418[_0x65c9('0x3b')];if(!_0x4b7452[_0x65c9('0x36')]['hasOwnProperty'](_0x65c9('0x3d'))){_0x2fa1e8[_0x65c9('0x23')]=qs[_0x65c9('0x23')](_0x4b7452[_0x65c9('0x36')]['limit']);_0x2fa1e8[_0x65c9('0x21')]=qs[_0x65c9('0x21')](_0x4b7452[_0x65c9('0x36')]['offset']);}return _0x219c05[_0x65c9('0x8b')](_0x2fa1e8);}})[_0x65c9('0x2b')](function(_0xe16038){if(_0xe16038){return _0xe16038?{'count':_0x9fb7f9,'rows':_0xe16038}:null;}})['then'](respondWithResult(_0x2bbf28,null))[_0x65c9('0x49')](handleError(_0x2bbf28,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 07d98e9..f908d1c 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 _0xb5cf=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x2cde8a,_0x18949e){var _0x3e36c2=function(_0x54458c){while(--_0x54458c){_0x2cde8a['push'](_0x2cde8a['shift']());}};_0x3e36c2(++_0x18949e);}(_0xb5cf,0xe4));var _0xfb5c=function(_0x975abb,_0x6fae6a){_0x975abb=_0x975abb-0x0;var _0x5a15ae=_0xb5cf[_0x975abb];return _0x5a15ae;};'use strict';var EventEmitter=require(_0xfb5c('0x0'));var SmsQueue=require(_0xfb5c('0x1'))['db'][_0xfb5c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfb5c('0x3')](0x0);var events={'afterCreate':_0xfb5c('0x4'),'afterUpdate':_0xfb5c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3d85df){return function(_0x4f2fd7,_0x1e1aba,_0x1be397){SmsQueueEvents[_0xfb5c('0x6')](_0x3d85df+':'+_0x4f2fd7['id'],_0x4f2fd7);SmsQueueEvents[_0xfb5c('0x6')](_0x3d85df,_0x4f2fd7);_0x1be397(null);};}for(var e in events){if(events[_0xfb5c('0x7')](e)){var event=events[e];SmsQueue[_0xfb5c('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x562e=['events','save','update','remove','emit','hasOwnProperty'];(function(_0x3832f9,_0x59c443){var _0x37418c=function(_0x133ee9){while(--_0x133ee9){_0x3832f9['push'](_0x3832f9['shift']());}};_0x37418c(++_0x59c443);}(_0x562e,0x13e));var _0xe562=function(_0x27ea95,_0x3dfbe1){_0x27ea95=_0x27ea95-0x0;var _0x12e0a2=_0x562e[_0x27ea95];return _0x12e0a2;};'use strict';var EventEmitter=require(_0xe562('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe562('0x1'),'afterUpdate':_0xe562('0x2'),'afterDestroy':_0xe562('0x3')};function emitEvent(_0x2bbf54){return function(_0x3e547d,_0x137a36,_0x12aa55){SmsQueueEvents[_0xe562('0x4')](_0x2bbf54+':'+_0x3e547d['id'],_0x3e547d);SmsQueueEvents[_0xe562('0x4')](_0x2bbf54,_0x3e547d);_0x12aa55(null);};}for(var e in events){if(events[_0xe562('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 92dc498..b381146 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 _0xc39a=['request-promise','path','rimraf','../../config/environment','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x522b50,_0x50c9b0){var _0xd27b90=function(_0x483dd1){while(--_0x483dd1){_0x522b50['push'](_0x522b50['shift']());}};_0xd27b90(++_0x50c9b0);}(_0xc39a,0x10c));var _0xac39=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0xc39a[_0x1d211b];return _0x47c88b;};'use strict';var _=require(_0xac39('0x0'));var util=require('util');var logger=require(_0xac39('0x1'))(_0xac39('0x2'));var moment=require(_0xac39('0x3'));var BPromise=require(_0xac39('0x4'));var rp=require(_0xac39('0x5'));var fs=require('fs');var path=require(_0xac39('0x6'));var rimraf=require(_0xac39('0x7'));var config=require(_0xac39('0x8'));var attributes=require('./smsQueue.attributes');module[_0xac39('0x9')]=function(_0x3160c,_0x3cbe65){return _0x3160c[_0xac39('0xa')](_0xac39('0xb'),attributes,{'tableName':_0xac39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe523=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','SmsQueue','sms_queues','lodash','util'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0xe523,0x76));var _0x3e52=function(_0x4b069a,_0x526035){_0x4b069a=_0x4b069a-0x0;var _0x49a093=_0xe523[_0x4b069a];return _0x49a093;};'use strict';var _=require(_0x3e52('0x0'));var util=require(_0x3e52('0x1'));var logger=require(_0x3e52('0x2'))(_0x3e52('0x3'));var moment=require(_0x3e52('0x4'));var BPromise=require(_0x3e52('0x5'));var rp=require(_0x3e52('0x6'));var fs=require('fs');var path=require(_0x3e52('0x7'));var rimraf=require(_0x3e52('0x8'));var config=require('../../config/environment');var attributes=require(_0x3e52('0x9'));module['exports']=function(_0x513cce,_0x2eb6ca){return _0x513cce['define'](_0x3e52('0xa'),attributes,{'tableName':_0x3e52('0xb'),'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 706fd16..9b12a36 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 _0xefa6=['SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','SmsQueue','ShowSmsQueue','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','then','info'];(function(_0x25f3cf,_0x1f5a92){var _0x2de129=function(_0x2c6bc0){while(--_0x2c6bc0){_0x25f3cf['push'](_0x25f3cf['shift']());}};_0x2de129(++_0x1f5a92);}(_0xefa6,0xb2));var _0x6efa=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xefa6[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x6efa('0x0'));var util=require(_0x6efa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6efa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6efa('0x3'))['db'];var utils=require(_0x6efa('0x4'));var logger=require('../../config/logger')(_0x6efa('0x5'));var config=require(_0x6efa('0x6'));var jayson=require(_0x6efa('0x7'));var client=jayson['client'][_0x6efa('0x8')]({'port':0x232a});config['redis']=_[_0x6efa('0x9')](config[_0x6efa('0xa')],{'host':_0x6efa('0xb'),'port':0x18eb});var socket=require(_0x6efa('0xc'))(new Redis(config[_0x6efa('0xa')]));require(_0x6efa('0xd'))[_0x6efa('0xe')](socket);function respondWithRpcPromise(_0x3ba03b,_0x3eb829,_0x5dfe0a){return new BPromise(function(_0x33c59e,_0x4deb0d){return client['request'](_0x3ba03b,_0x5dfe0a)[_0x6efa('0xf')](function(_0x3cd468){logger[_0x6efa('0x10')](_0x6efa('0x11'),_0x3eb829,_0x6efa('0x12'));logger[_0x6efa('0x13')](_0x6efa('0x14'),_0x3eb829,_0x6efa('0x12'),JSON[_0x6efa('0x15')](_0x3cd468));if(_0x3cd468['error']){if(_0x3cd468[_0x6efa('0x16')][_0x6efa('0x17')]===0x1f4){logger[_0x6efa('0x16')]('SmsQueue,\x20%s,\x20%s',_0x3eb829,_0x3cd468['error'][_0x6efa('0x18')]);return _0x4deb0d(_0x3cd468['error'][_0x6efa('0x18')]);}logger['error'](_0x6efa('0x11'),_0x3eb829,_0x3cd468['error'][_0x6efa('0x18')]);return _0x33c59e(_0x3cd468[_0x6efa('0x16')][_0x6efa('0x18')]);}else{logger['info'](_0x6efa('0x11'),_0x3eb829,'request\x20sent');_0x33c59e(_0x3cd468[_0x6efa('0x19')][_0x6efa('0x18')]);}})[_0x6efa('0x1a')](function(_0x150634){logger[_0x6efa('0x16')](_0x6efa('0x11'),_0x3eb829,_0x150634);_0x4deb0d(_0x150634);});});}exports[_0x6efa('0x1b')]=function(_0x4459ad){var _0x4234c=this;return new Promise(function(_0x524d19,_0x4c45b){return db['SmsQueue'][_0x6efa('0x1c')]({'raw':_0x4459ad['options']?_0x4459ad[_0x6efa('0x1d')][_0x6efa('0x1e')]===undefined?!![]:![]:!![],'where':_0x4459ad[_0x6efa('0x1d')]?_0x4459ad[_0x6efa('0x1d')][_0x6efa('0x1f')]||null:null,'attributes':_0x4459ad[_0x6efa('0x1d')]?_0x4459ad[_0x6efa('0x1d')][_0x6efa('0x20')]||null:null,'limit':_0x4459ad[_0x6efa('0x1d')]?_0x4459ad[_0x6efa('0x1d')][_0x6efa('0x21')]||null:null,'include':_0x4459ad[_0x6efa('0x1d')]?_0x4459ad['options'][_0x6efa('0x22')]?_[_0x6efa('0x23')](_0x4459ad[_0x6efa('0x1d')][_0x6efa('0x22')],function(_0x5eeea5){return{'model':db[_0x5eeea5['model']],'as':_0x5eeea5['as'],'attributes':_0x5eeea5[_0x6efa('0x20')],'include':_0x5eeea5[_0x6efa('0x22')]?_[_0x6efa('0x23')](_0x5eeea5['include'],function(_0x5b4b84){return{'model':db[_0x5b4b84[_0x6efa('0x24')]],'as':_0x5b4b84['as'],'attributes':_0x5b4b84['attributes'],'include':_0x5b4b84[_0x6efa('0x22')]?_[_0x6efa('0x23')](_0x5b4b84[_0x6efa('0x22')],function(_0x56f755){return{'model':db[_0x56f755['model']],'as':_0x56f755['as'],'attributes':_0x56f755['attributes']};}):[]};}):[]};}):[]:[]})[_0x6efa('0xf')](function(_0xa7a6a3){logger['info'](_0x6efa('0x1b'),_0x4459ad);logger['debug'](_0x6efa('0x1b'),_0x4459ad,JSON[_0x6efa('0x15')](_0xa7a6a3));_0x524d19(_0xa7a6a3);})[_0x6efa('0x1a')](function(_0x2fe97f){logger[_0x6efa('0x16')](_0x6efa('0x1b'),_0x2fe97f[_0x6efa('0x18')],_0x4459ad);_0x4c45b(_0x4234c[_0x6efa('0x16')](0x1f4,_0x2fe97f['message']));});});};exports['ShowSmsQueue']=function(_0x2e030c){var _0x4bddc4=this;return new Promise(function(_0x46f8c7,_0xd30eae){return db[_0x6efa('0x25')]['find']({'raw':_0x2e030c[_0x6efa('0x1d')]?_0x2e030c['options'][_0x6efa('0x1e')]===undefined?!![]:![]:!![],'where':_0x2e030c[_0x6efa('0x1d')]?_0x2e030c['options'][_0x6efa('0x1f')]||null:null,'attributes':_0x2e030c[_0x6efa('0x1d')]?_0x2e030c[_0x6efa('0x1d')][_0x6efa('0x20')]||null:null,'include':_0x2e030c[_0x6efa('0x1d')]?_0x2e030c[_0x6efa('0x1d')][_0x6efa('0x22')]?_['map'](_0x2e030c[_0x6efa('0x1d')][_0x6efa('0x22')],function(_0x3d641c){return{'model':db[_0x3d641c[_0x6efa('0x24')]],'as':_0x3d641c['as'],'attributes':_0x3d641c[_0x6efa('0x20')],'include':_0x3d641c[_0x6efa('0x22')]?_[_0x6efa('0x23')](_0x3d641c[_0x6efa('0x22')],function(_0x4e4a7c){return{'model':db[_0x4e4a7c[_0x6efa('0x24')]],'as':_0x4e4a7c['as'],'attributes':_0x4e4a7c[_0x6efa('0x20')],'include':_0x4e4a7c[_0x6efa('0x22')]?_[_0x6efa('0x23')](_0x4e4a7c[_0x6efa('0x22')],function(_0x386a4b){return{'model':db[_0x386a4b['model']],'as':_0x386a4b['as'],'attributes':_0x386a4b['attributes']};}):[]};}):[]};}):[]:[]})[_0x6efa('0xf')](function(_0x15cc32){logger[_0x6efa('0x10')](_0x6efa('0x26'),_0x2e030c);logger['debug'](_0x6efa('0x26'),_0x2e030c,JSON[_0x6efa('0x15')](_0x15cc32));_0x46f8c7(_0x15cc32);})[_0x6efa('0x1a')](function(_0x3f6cf8){logger['error'](_0x6efa('0x26'),_0x3f6cf8[_0x6efa('0x18')],_0x2e030c);_0xd30eae(_0x4bddc4['error'](0x1f4,_0x3f6cf8[_0x6efa('0x18')]));});});}; \ No newline at end of file +var _0x34fe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','options','raw','where','limit','include','map','model','attributes','then','GetSmsQueue','debug','ShowSmsQueue','SmsQueue','find','lodash','moment','randomstring','ioredis'];(function(_0x3bc678,_0x2f2748){var _0x5b7255=function(_0x477152){while(--_0x477152){_0x3bc678['push'](_0x3bc678['shift']());}};_0x5b7255(++_0x2f2748);}(_0x34fe,0x13c));var _0xe34f=function(_0x4c2241,_0x53e423){_0x4c2241=_0x4c2241-0x0;var _0x53ca72=_0x34fe[_0x4c2241];return _0x53ca72;};'use strict';var _=require(_0xe34f('0x0'));var util=require('util');var moment=require(_0xe34f('0x1'));var BPromise=require('bluebird');var rs=require(_0xe34f('0x2'));var fs=require('fs');var Redis=require(_0xe34f('0x3'));var db=require(_0xe34f('0x4'))['db'];var utils=require(_0xe34f('0x5'));var logger=require(_0xe34f('0x6'))(_0xe34f('0x7'));var config=require(_0xe34f('0x8'));var jayson=require(_0xe34f('0x9'));var client=jayson['client'][_0xe34f('0xa')]({'port':0x232a});config['redis']=_[_0xe34f('0xb')](config[_0xe34f('0xc')],{'host':_0xe34f('0xd'),'port':0x18eb});var socket=require(_0xe34f('0xe'))(new Redis(config[_0xe34f('0xc')]));require(_0xe34f('0xf'))[_0xe34f('0x10')](socket);function respondWithRpcPromise(_0x4cebda,_0x1e55d3,_0x152547){return new BPromise(function(_0x36ec45,_0x71c1a9){return client[_0xe34f('0x11')](_0x4cebda,_0x152547)['then'](function(_0x344cd9){logger[_0xe34f('0x12')](_0xe34f('0x13'),_0x1e55d3,_0xe34f('0x14'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x1e55d3,_0xe34f('0x14'),JSON[_0xe34f('0x15')](_0x344cd9));if(_0x344cd9[_0xe34f('0x16')]){if(_0x344cd9[_0xe34f('0x16')]['code']===0x1f4){logger['error'](_0xe34f('0x13'),_0x1e55d3,_0x344cd9['error'][_0xe34f('0x17')]);return _0x71c1a9(_0x344cd9[_0xe34f('0x16')][_0xe34f('0x17')]);}logger[_0xe34f('0x16')](_0xe34f('0x13'),_0x1e55d3,_0x344cd9['error'][_0xe34f('0x17')]);return _0x36ec45(_0x344cd9[_0xe34f('0x16')][_0xe34f('0x17')]);}else{logger[_0xe34f('0x12')]('SmsQueue,\x20%s,\x20%s',_0x1e55d3,_0xe34f('0x14'));_0x36ec45(_0x344cd9[_0xe34f('0x18')][_0xe34f('0x17')]);}})[_0xe34f('0x19')](function(_0x277072){logger[_0xe34f('0x16')](_0xe34f('0x13'),_0x1e55d3,_0x277072);_0x71c1a9(_0x277072);});});}exports['GetSmsQueue']=function(_0x37ab66){var _0x380447=this;return new Promise(function(_0x583d60,_0x14b870){return db['SmsQueue']['findAll']({'raw':_0x37ab66[_0xe34f('0x1a')]?_0x37ab66[_0xe34f('0x1a')][_0xe34f('0x1b')]===undefined?!![]:![]:!![],'where':_0x37ab66['options']?_0x37ab66[_0xe34f('0x1a')][_0xe34f('0x1c')]||null:null,'attributes':_0x37ab66[_0xe34f('0x1a')]?_0x37ab66['options']['attributes']||null:null,'limit':_0x37ab66[_0xe34f('0x1a')]?_0x37ab66[_0xe34f('0x1a')][_0xe34f('0x1d')]||null:null,'include':_0x37ab66['options']?_0x37ab66['options'][_0xe34f('0x1e')]?_[_0xe34f('0x1f')](_0x37ab66[_0xe34f('0x1a')]['include'],function(_0x3b7c02){return{'model':db[_0x3b7c02[_0xe34f('0x20')]],'as':_0x3b7c02['as'],'attributes':_0x3b7c02[_0xe34f('0x21')],'include':_0x3b7c02[_0xe34f('0x1e')]?_[_0xe34f('0x1f')](_0x3b7c02['include'],function(_0x313fdf){return{'model':db[_0x313fdf[_0xe34f('0x20')]],'as':_0x313fdf['as'],'attributes':_0x313fdf[_0xe34f('0x21')],'include':_0x313fdf['include']?_[_0xe34f('0x1f')](_0x313fdf[_0xe34f('0x1e')],function(_0x49ea61){return{'model':db[_0x49ea61[_0xe34f('0x20')]],'as':_0x49ea61['as'],'attributes':_0x49ea61[_0xe34f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe34f('0x22')](function(_0x3fd689){logger[_0xe34f('0x12')](_0xe34f('0x23'),_0x37ab66);logger[_0xe34f('0x24')](_0xe34f('0x23'),_0x37ab66,JSON[_0xe34f('0x15')](_0x3fd689));_0x583d60(_0x3fd689);})[_0xe34f('0x19')](function(_0x545140){logger['error']('GetSmsQueue',_0x545140[_0xe34f('0x17')],_0x37ab66);_0x14b870(_0x380447[_0xe34f('0x16')](0x1f4,_0x545140[_0xe34f('0x17')]));});});};exports[_0xe34f('0x25')]=function(_0x2b11f6){var _0x384423=this;return new Promise(function(_0x46010f,_0x19d5c7){return db[_0xe34f('0x26')][_0xe34f('0x27')]({'raw':_0x2b11f6['options']?_0x2b11f6['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b11f6['options']?_0x2b11f6[_0xe34f('0x1a')][_0xe34f('0x1c')]||null:null,'attributes':_0x2b11f6[_0xe34f('0x1a')]?_0x2b11f6[_0xe34f('0x1a')][_0xe34f('0x21')]||null:null,'include':_0x2b11f6[_0xe34f('0x1a')]?_0x2b11f6[_0xe34f('0x1a')][_0xe34f('0x1e')]?_[_0xe34f('0x1f')](_0x2b11f6[_0xe34f('0x1a')][_0xe34f('0x1e')],function(_0x579389){return{'model':db[_0x579389[_0xe34f('0x20')]],'as':_0x579389['as'],'attributes':_0x579389[_0xe34f('0x21')],'include':_0x579389[_0xe34f('0x1e')]?_[_0xe34f('0x1f')](_0x579389[_0xe34f('0x1e')],function(_0x4c9a12){return{'model':db[_0x4c9a12[_0xe34f('0x20')]],'as':_0x4c9a12['as'],'attributes':_0x4c9a12[_0xe34f('0x21')],'include':_0x4c9a12[_0xe34f('0x1e')]?_[_0xe34f('0x1f')](_0x4c9a12['include'],function(_0x3edff1){return{'model':db[_0x3edff1[_0xe34f('0x20')]],'as':_0x3edff1['as'],'attributes':_0x3edff1[_0xe34f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe34f('0x22')](function(_0x2401d4){logger[_0xe34f('0x12')]('ShowSmsQueue',_0x2b11f6);logger[_0xe34f('0x24')](_0xe34f('0x25'),_0x2b11f6,JSON[_0xe34f('0x15')](_0x2401d4));_0x46010f(_0x2401d4);})[_0xe34f('0x19')](function(_0x4811f3){logger[_0xe34f('0x16')]('ShowSmsQueue',_0x4811f3[_0xe34f('0x17')],_0x2b11f6);_0x19d5c7(_0x384423[_0xe34f('0x16')](0x1f4,_0x4811f3['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index af6b9e4..48d4f02 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 _0xc0a8=['length','smsQueue:','./smsQueue.events','save','remove','emit','removeListener','register'];(function(_0x4c88c2,_0x3b65d3){var _0x59cd24=function(_0x28b3b0){while(--_0x28b3b0){_0x4c88c2['push'](_0x4c88c2['shift']());}};_0x59cd24(++_0x3b65d3);}(_0xc0a8,0x11a));var _0x8c0a=function(_0xf678a2,_0x1219e5){_0xf678a2=_0xf678a2-0x0;var _0x57a8e7=_0xc0a8[_0xf678a2];return _0x57a8e7;};'use strict';var SmsQueueEvents=require(_0x8c0a('0x0'));var events=[_0x8c0a('0x1'),_0x8c0a('0x2'),'update'];function createListener(_0x3b3b55,_0x1bd3d6){return function(_0x479491){_0x1bd3d6[_0x8c0a('0x3')](_0x3b3b55,_0x479491);};}function removeListener(_0x2a31f2,_0x3d510d){return function(){SmsQueueEvents[_0x8c0a('0x4')](_0x2a31f2,_0x3d510d);};}exports[_0x8c0a('0x5')]=function(_0x154033){for(var _0x8185ab=0x0,_0x2b35d0=events[_0x8c0a('0x6')];_0x8185ab<_0x2b35d0;_0x8185ab++){var _0x4b6cc6=events[_0x8185ab];var _0x29ab74=createListener(_0x8c0a('0x7')+_0x4b6cc6,_0x154033);SmsQueueEvents['on'](_0x4b6cc6,_0x29ab74);}}; \ No newline at end of file +var _0x95be=['smsQueue:','./smsQueue.events','save','update','emit','register','length'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x95be,0xcc));var _0xe95b=function(_0xbfd30a,_0x591969){_0xbfd30a=_0xbfd30a-0x0;var _0x40ee91=_0x95be[_0xbfd30a];return _0x40ee91;};'use strict';var SmsQueueEvents=require(_0xe95b('0x0'));var events=[_0xe95b('0x1'),'remove',_0xe95b('0x2')];function createListener(_0x5cbd48,_0x276c40){return function(_0x39e670){_0x276c40[_0xe95b('0x3')](_0x5cbd48,_0x39e670);};}function removeListener(_0x3bc41d,_0x25549b){return function(){SmsQueueEvents['removeListener'](_0x3bc41d,_0x25549b);};}exports[_0xe95b('0x4')]=function(_0x5ec1b0){for(var _0x1e8dbd=0x0,_0x494ac3=events[_0xe95b('0x5')];_0x1e8dbd<_0x494ac3;_0x1e8dbd++){var _0x37b805=events[_0x1e8dbd];var _0x562298=createListener(_0xe95b('0x6')+_0x37b805,_0x5ec1b0);SmsQueueEvents['on'](_0x37b805,_0x562298);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6d82702..0159932 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 _0xe6cd=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','post','put','/:id','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe6cd,0x159));var _0xde6c=function(_0x57e18a,_0x199383){_0x57e18a=_0x57e18a-0x0;var _0x1181c7=_0xe6cd[_0x57e18a];return _0x1181c7;};'use strict';var multer=require(_0xde6c('0x0'));var util=require(_0xde6c('0x1'));var path=require(_0xde6c('0x2'));var timeout=require(_0xde6c('0x3'));var express=require('express');var router=express[_0xde6c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xde6c('0x5'));var config=require(_0xde6c('0x6'));var controller=require(_0xde6c('0x7'));router[_0xde6c('0x8')]('/',auth[_0xde6c('0x9')](),controller[_0xde6c('0xa')]);router['get']('/describe',auth[_0xde6c('0x9')](),controller['describe']);router[_0xde6c('0x8')]('/:id',auth[_0xde6c('0x9')](),controller['show']);router[_0xde6c('0xb')]('/',auth[_0xde6c('0x9')](),controller['create']);router[_0xde6c('0xc')](_0xde6c('0xd'),auth['isAuthenticated'](),controller[_0xde6c('0xe')]);router[_0xde6c('0xf')](_0xde6c('0xd'),auth[_0xde6c('0x9')](),controller[_0xde6c('0x10')]);module[_0xde6c('0x11')]=router; \ No newline at end of file +var _0x8fb7=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x20025d,_0x2508fb){var _0x569171=function(_0x53075f){while(--_0x53075f){_0x20025d['push'](_0x20025d['shift']());}};_0x569171(++_0x2508fb);}(_0x8fb7,0x1a4));var _0x78fb=function(_0x2f71,_0x1499c6){_0x2f71=_0x2f71-0x0;var _0x5dd425=_0x8fb7[_0x2f71];return _0x5dd425;};'use strict';var multer=require(_0x78fb('0x0'));var util=require(_0x78fb('0x1'));var path=require(_0x78fb('0x2'));var timeout=require(_0x78fb('0x3'));var express=require('express');var router=express[_0x78fb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x78fb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x78fb('0x6'));var controller=require(_0x78fb('0x7'));router[_0x78fb('0x8')]('/',auth[_0x78fb('0x9')](),controller[_0x78fb('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x78fb('0xb')]);router[_0x78fb('0x8')](_0x78fb('0xc'),auth['isAuthenticated'](),controller[_0x78fb('0xd')]);router[_0x78fb('0xe')]('/',auth[_0x78fb('0x9')](),controller[_0x78fb('0xf')]);router[_0x78fb('0x10')](_0x78fb('0xc'),auth[_0x78fb('0x9')](),controller[_0x78fb('0x11')]);router[_0x78fb('0x12')](_0x78fb('0xc'),auth[_0x78fb('0x9')](),controller[_0x78fb('0x13')]);module[_0x78fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c3cb5fc..da5bd87 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 _0xff39=['STRING','DATE','sequelize','exports'];(function(_0x27243d,_0x2dfdbf){var _0x29f44d=function(_0x2adafb){while(--_0x2adafb){_0x27243d['push'](_0x27243d['shift']());}};_0x29f44d(++_0x2dfdbf);}(_0xff39,0xba));var _0x9ff3=function(_0x1eec3a,_0x168828){_0x1eec3a=_0x1eec3a-0x0;var _0x133cf7=_0xff39[_0x1eec3a];return _0x133cf7;};'use strict';var moment=require('moment');var Sequelize=require(_0x9ff3('0x0'));module[_0x9ff3('0x1')]={'uniqueid':{'type':Sequelize[_0x9ff3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9ff3('0x2')]},'joinAt':{'type':Sequelize[_0x9ff3('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9ff3('0x3')]},'exitAt':{'type':Sequelize[_0x9ff3('0x3')]},'reason':{'type':Sequelize[_0x9ff3('0x2')]}}; \ No newline at end of file +var _0x4cad=['DATE','moment','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cad,0xe7));var _0xd4ca=function(_0x34d3fe,_0x43f35d){_0x34d3fe=_0x34d3fe-0x0;var _0x2960af=_0x4cad[_0x34d3fe];return _0x2960af;};'use strict';var moment=require(_0xd4ca('0x0'));var Sequelize=require(_0xd4ca('0x1'));module[_0xd4ca('0x2')]={'uniqueid':{'type':Sequelize[_0xd4ca('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd4ca('0x3')]},'joinAt':{'type':Sequelize[_0xd4ca('0x4')]},'leaveAt':{'type':Sequelize[_0xd4ca('0x4')]},'acceptAt':{'type':Sequelize[_0xd4ca('0x4')]},'exitAt':{'type':Sequelize[_0xd4ca('0x4')]},'reason':{'type':Sequelize[_0xd4ca('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index cbc4e30..0a6a854 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 _0xfe27=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x57a3ef,_0x5dc9ae){var _0x5b5321=function(_0x318dcf){while(--_0x318dcf){_0x57a3ef['push'](_0x57a3ef['shift']());}};_0x5b5321(++_0x5dc9ae);}(_0xfe27,0x1c9));var _0x7fe2=function(_0x3514bc,_0x2688a8){_0x3514bc=_0x3514bc-0x0;var _0x12d9a8=_0xfe27[_0x3514bc];return _0x12d9a8;};'use strict';var emlformat=require(_0x7fe2('0x0'));var rimraf=require(_0x7fe2('0x1'));var zipdir=require(_0x7fe2('0x2'));var jsonpatch=require(_0x7fe2('0x3'));var rp=require(_0x7fe2('0x4'));var moment=require(_0x7fe2('0x5'));var BPromise=require(_0x7fe2('0x6'));var Mustache=require(_0x7fe2('0x7'));var util=require(_0x7fe2('0x8'));var path=require(_0x7fe2('0x9'));var sox=require(_0x7fe2('0xa'));var csv=require(_0x7fe2('0xb'));var ejs=require(_0x7fe2('0xc'));var fs=require('fs');var fs_extra=require(_0x7fe2('0xd'));var _=require(_0x7fe2('0xe'));var squel=require(_0x7fe2('0xf'));var crypto=require(_0x7fe2('0x10'));var jsforce=require(_0x7fe2('0x11'));var deskjs=require(_0x7fe2('0x12'));var toCsv=require(_0x7fe2('0xb'));var querystring=require(_0x7fe2('0x13'));var Papa=require(_0x7fe2('0x14'));var Redis=require('ioredis');var authService=require(_0x7fe2('0x15'));var qs=require(_0x7fe2('0x16'));var as=require(_0x7fe2('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7fe2('0x18'));var utils=require('../../config/utils');var config=require(_0x7fe2('0x19'));var licenseUtil=require(_0x7fe2('0x1a'));var db=require(_0x7fe2('0x1b'))['db'];function respondWithStatusCode(_0xfe9e5d,_0x3c019e){_0x3c019e=_0x3c019e||0xcc;return function(_0x34e536){if(_0x34e536){return _0xfe9e5d[_0x7fe2('0x1c')](_0x3c019e);}return _0xfe9e5d[_0x7fe2('0x1d')](_0x3c019e)[_0x7fe2('0x1e')]();};}function respondWithResult(_0x583084,_0x4f6d94){_0x4f6d94=_0x4f6d94||0xc8;return function(_0x2624fb){if(_0x2624fb){return _0x583084['status'](_0x4f6d94)[_0x7fe2('0x1f')](_0x2624fb);}};}function respondWithFilteredResult(_0x569de1,_0x3f421e){return function(_0x3c38a4){if(_0x3c38a4){var _0x1dfacb=typeof _0x3f421e[_0x7fe2('0x20')]===_0x7fe2('0x21')&&typeof _0x3f421e[_0x7fe2('0x22')]===_0x7fe2('0x21');var _0xecd43f=_0x3c38a4[_0x7fe2('0x23')];var _0x16a625=_0x1dfacb?0x0:_0x3f421e['offset'];var _0x5f0410=_0x1dfacb?_0x3c38a4[_0x7fe2('0x23')]:_0x3f421e[_0x7fe2('0x20')]+_0x3f421e[_0x7fe2('0x22')];var _0xfc4258;if(_0x5f0410>=_0xecd43f){_0x5f0410=_0xecd43f;_0xfc4258=0xc8;}else{_0xfc4258=0xce;}_0x569de1[_0x7fe2('0x1d')](_0xfc4258);return _0x569de1['set'](_0x7fe2('0x24'),_0x16a625+'-'+_0x5f0410+'/'+_0xecd43f)[_0x7fe2('0x1f')](_0x3c38a4);}return null;};}function patchUpdates(_0x2847b5){return function(_0x27b68f){try{jsonpatch[_0x7fe2('0x25')](_0x27b68f,_0x2847b5,!![]);}catch(_0x92a509){return BPromise['reject'](_0x92a509);}return _0x27b68f[_0x7fe2('0x26')]();};}function saveUpdates(_0x16f14e,_0x167689){return function(_0x5a1ca0){if(_0x5a1ca0){return _0x5a1ca0[_0x7fe2('0x27')](_0x16f14e)[_0x7fe2('0x28')](function(_0x357f01){return _0x357f01;});}return null;};}function removeEntity(_0x45c4fc,_0x3d88c0){return function(_0x4bdae7){if(_0x4bdae7){return _0x4bdae7[_0x7fe2('0x29')]()[_0x7fe2('0x28')](function(){_0x45c4fc[_0x7fe2('0x1d')](0xcc)[_0x7fe2('0x1e')]();});}};}function handleEntityNotFound(_0x382551,_0x21c047){return function(_0x2260cd){if(!_0x2260cd){_0x382551['sendStatus'](0x194);}return _0x2260cd;};}function handleError(_0x373838,_0x2d76aa){_0x2d76aa=_0x2d76aa||0x1f4;return function(_0x55bc3d){logger['error'](_0x55bc3d[_0x7fe2('0x2a')]);if(_0x55bc3d[_0x7fe2('0x2b')]){delete _0x55bc3d[_0x7fe2('0x2b')];}_0x373838[_0x7fe2('0x1d')](_0x2d76aa)['send'](_0x55bc3d);};}exports[_0x7fe2('0x2c')]=function(_0x2ccd6b,_0x3e5837){var _0x10a19c={},_0x51fb4e={},_0xf65fa7={'count':0x0,'rows':[]};var _0x30198f=_[_0x7fe2('0x2d')](db[_0x7fe2('0x2e')]['rawAttributes'],function(_0x1c42f9){return{'name':_0x1c42f9[_0x7fe2('0x2f')],'type':_0x1c42f9[_0x7fe2('0x30')][_0x7fe2('0x31')]};});_0x51fb4e[_0x7fe2('0x32')]=_['map'](_0x30198f,_0x7fe2('0x2b'));_0x51fb4e[_0x7fe2('0x33')]=_[_0x7fe2('0x34')](_0x2ccd6b['query']);_0x51fb4e['filters']=_[_0x7fe2('0x35')](_0x51fb4e[_0x7fe2('0x32')],_0x51fb4e[_0x7fe2('0x33')]);_0x10a19c[_0x7fe2('0x36')]=_[_0x7fe2('0x35')](_0x51fb4e[_0x7fe2('0x32')],qs['fields'](_0x2ccd6b[_0x7fe2('0x33')][_0x7fe2('0x37')]));_0x10a19c[_0x7fe2('0x36')]=_0x10a19c['attributes'][_0x7fe2('0x38')]?_0x10a19c['attributes']:_0x51fb4e[_0x7fe2('0x32')];if(!_0x2ccd6b[_0x7fe2('0x33')]['hasOwnProperty'](_0x7fe2('0x39'))){_0x10a19c[_0x7fe2('0x22')]=qs[_0x7fe2('0x22')](_0x2ccd6b[_0x7fe2('0x33')][_0x7fe2('0x22')]);_0x10a19c[_0x7fe2('0x20')]=qs[_0x7fe2('0x20')](_0x2ccd6b[_0x7fe2('0x33')][_0x7fe2('0x20')]);}_0x10a19c[_0x7fe2('0x3a')]=qs[_0x7fe2('0x3b')](_0x2ccd6b['query'][_0x7fe2('0x3b')]);_0x10a19c[_0x7fe2('0x3c')]=qs['filters'](_['pick'](_0x2ccd6b['query'],_0x51fb4e[_0x7fe2('0x3d')]),_0x30198f);if(_0x2ccd6b[_0x7fe2('0x33')][_0x7fe2('0x3e')]){_0x10a19c[_0x7fe2('0x3c')]=_[_0x7fe2('0x3f')](_0x10a19c[_0x7fe2('0x3c')],{'$or':_[_0x7fe2('0x2d')](_0x30198f,function(_0x2545a8){if(_0x2545a8['type']!==_0x7fe2('0x40')){var _0x689a98={};_0x689a98[_0x2545a8[_0x7fe2('0x2b')]]={'$like':'%'+_0x2ccd6b[_0x7fe2('0x33')][_0x7fe2('0x3e')]+'%'};return _0x689a98;}})});}_0x10a19c=_[_0x7fe2('0x3f')]({},_0x10a19c,_0x2ccd6b[_0x7fe2('0x41')]);var _0x17402f={'where':_0x10a19c['where']};return db[_0x7fe2('0x2e')][_0x7fe2('0x23')](_0x17402f)[_0x7fe2('0x28')](function(_0x5a11aa){_0xf65fa7['count']=_0x5a11aa;if(_0x2ccd6b[_0x7fe2('0x33')][_0x7fe2('0x42')]){_0x10a19c[_0x7fe2('0x43')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x7fe2('0x44')](_0x10a19c);})[_0x7fe2('0x28')](function(_0x26d110){_0xf65fa7[_0x7fe2('0x45')]=_0x26d110;return _0xf65fa7;})[_0x7fe2('0x28')](respondWithFilteredResult(_0x3e5837,_0x10a19c))[_0x7fe2('0x46')](handleError(_0x3e5837,null));};exports[_0x7fe2('0x47')]=function(_0x5b7ad5,_0x552df4){var _0x448668={'raw':!![],'where':{'id':_0x5b7ad5['params']['id']}},_0x3f5620={};_0x3f5620[_0x7fe2('0x32')]=_[_0x7fe2('0x34')](db[_0x7fe2('0x2e')]['rawAttributes']);_0x3f5620[_0x7fe2('0x33')]=_[_0x7fe2('0x34')](_0x5b7ad5['query']);_0x3f5620[_0x7fe2('0x3d')]=_[_0x7fe2('0x35')](_0x3f5620[_0x7fe2('0x32')],_0x3f5620[_0x7fe2('0x33')]);_0x448668[_0x7fe2('0x36')]=_[_0x7fe2('0x35')](_0x3f5620[_0x7fe2('0x32')],qs['fields'](_0x5b7ad5[_0x7fe2('0x33')][_0x7fe2('0x37')]));_0x448668['attributes']=_0x448668[_0x7fe2('0x36')][_0x7fe2('0x38')]?_0x448668[_0x7fe2('0x36')]:_0x3f5620[_0x7fe2('0x32')];if(_0x5b7ad5[_0x7fe2('0x33')]['includeAll']){_0x448668[_0x7fe2('0x43')]=[{'all':!![]}];}_0x448668=_[_0x7fe2('0x3f')]({},_0x448668,_0x5b7ad5[_0x7fe2('0x41')]);return db[_0x7fe2('0x2e')][_0x7fe2('0x48')](_0x448668)[_0x7fe2('0x28')](handleEntityNotFound(_0x552df4,null))[_0x7fe2('0x28')](respondWithResult(_0x552df4,null))[_0x7fe2('0x46')](handleError(_0x552df4,null));};exports[_0x7fe2('0x49')]=function(_0x2712e2,_0x51f3be){return db['SmsQueueReport'][_0x7fe2('0x49')](_0x2712e2[_0x7fe2('0x4a')],{})[_0x7fe2('0x28')](respondWithResult(_0x51f3be,0xc9))[_0x7fe2('0x46')](handleError(_0x51f3be,null));};exports[_0x7fe2('0x27')]=function(_0x5cf56d,_0x39eeeb){if(_0x5cf56d['body']['id']){delete _0x5cf56d['body']['id'];}return db[_0x7fe2('0x2e')][_0x7fe2('0x48')]({'where':{'id':_0x5cf56d['params']['id']}})['then'](handleEntityNotFound(_0x39eeeb,null))[_0x7fe2('0x28')](saveUpdates(_0x5cf56d[_0x7fe2('0x4a')],null))['then'](respondWithResult(_0x39eeeb,null))['catch'](handleError(_0x39eeeb,null));};exports[_0x7fe2('0x29')]=function(_0x1e48ca,_0xaaef05){return db[_0x7fe2('0x2e')][_0x7fe2('0x48')]({'where':{'id':_0x1e48ca[_0x7fe2('0x4b')]['id']}})[_0x7fe2('0x28')](handleEntityNotFound(_0xaaef05,null))[_0x7fe2('0x28')](removeEntity(_0xaaef05,null))[_0x7fe2('0x46')](handleError(_0xaaef05,null));};exports[_0x7fe2('0x4c')]=function(_0x14c500,_0x3d3aca){return db[_0x7fe2('0x2e')][_0x7fe2('0x4c')]()[_0x7fe2('0x28')](respondWithResult(_0x3d3aca,null))[_0x7fe2('0x46')](handleError(_0x3d3aca,null));}; \ No newline at end of file +var _0x7ee4=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','name','send','index','SmsQueueReport','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','length','includeAll','find','catch','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x266969,_0x559513){var _0x24f497=function(_0x5e6009){while(--_0x5e6009){_0x266969['push'](_0x266969['shift']());}};_0x24f497(++_0x559513);}(_0x7ee4,0x13f));var _0x47ee=function(_0x8d5844,_0x48eb67){_0x8d5844=_0x8d5844-0x0;var _0x56726c=_0x7ee4[_0x8d5844];return _0x56726c;};'use strict';var emlformat=require(_0x47ee('0x0'));var rimraf=require(_0x47ee('0x1'));var zipdir=require(_0x47ee('0x2'));var jsonpatch=require(_0x47ee('0x3'));var rp=require(_0x47ee('0x4'));var moment=require(_0x47ee('0x5'));var BPromise=require(_0x47ee('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x47ee('0x7'));var csv=require(_0x47ee('0x8'));var ejs=require(_0x47ee('0x9'));var fs=require('fs');var fs_extra=require(_0x47ee('0xa'));var _=require('lodash');var squel=require(_0x47ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x47ee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x47ee('0x8'));var querystring=require(_0x47ee('0xd'));var Papa=require(_0x47ee('0xe'));var Redis=require(_0x47ee('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x47ee('0x10'));var hardwareService=require(_0x47ee('0x11'));var logger=require('../../config/logger')(_0x47ee('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x47ee('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d0fce,_0x4ca9ab){_0x4ca9ab=_0x4ca9ab||0xcc;return function(_0x10543e){if(_0x10543e){return _0x3d0fce[_0x47ee('0x14')](_0x4ca9ab);}return _0x3d0fce[_0x47ee('0x15')](_0x4ca9ab)['end']();};}function respondWithResult(_0x4964dd,_0x17c4a3){_0x17c4a3=_0x17c4a3||0xc8;return function(_0x5a76cf){if(_0x5a76cf){return _0x4964dd[_0x47ee('0x15')](_0x17c4a3)[_0x47ee('0x16')](_0x5a76cf);}};}function respondWithFilteredResult(_0x167a98,_0x3ea133){return function(_0x16c421){if(_0x16c421){var _0xb27a6c=typeof _0x3ea133[_0x47ee('0x17')]===_0x47ee('0x18')&&typeof _0x3ea133[_0x47ee('0x19')]===_0x47ee('0x18');var _0x485caa=_0x16c421['count'];var _0x1947a0=_0xb27a6c?0x0:_0x3ea133[_0x47ee('0x17')];var _0x3e3085=_0xb27a6c?_0x16c421[_0x47ee('0x1a')]:_0x3ea133['offset']+_0x3ea133[_0x47ee('0x19')];var _0xb598cf;if(_0x3e3085>=_0x485caa){_0x3e3085=_0x485caa;_0xb598cf=0xc8;}else{_0xb598cf=0xce;}_0x167a98[_0x47ee('0x15')](_0xb598cf);return _0x167a98[_0x47ee('0x1b')]('Content-Range',_0x1947a0+'-'+_0x3e3085+'/'+_0x485caa)['json'](_0x16c421);}return null;};}function patchUpdates(_0x4b83e8){return function(_0x277253){try{jsonpatch[_0x47ee('0x1c')](_0x277253,_0x4b83e8,!![]);}catch(_0x37b65f){return BPromise[_0x47ee('0x1d')](_0x37b65f);}return _0x277253[_0x47ee('0x1e')]();};}function saveUpdates(_0x884272,_0x376a3b){return function(_0x1a91fc){if(_0x1a91fc){return _0x1a91fc['update'](_0x884272)[_0x47ee('0x1f')](function(_0x49857a){return _0x49857a;});}return null;};}function removeEntity(_0x21838a,_0x5d0b36){return function(_0x284e85){if(_0x284e85){return _0x284e85[_0x47ee('0x20')]()[_0x47ee('0x1f')](function(){_0x21838a[_0x47ee('0x15')](0xcc)[_0x47ee('0x21')]();});}};}function handleEntityNotFound(_0x105cc2,_0x1e43f4){return function(_0x4dab20){if(!_0x4dab20){_0x105cc2[_0x47ee('0x14')](0x194);}return _0x4dab20;};}function handleError(_0x2e1670,_0x3fed49){_0x3fed49=_0x3fed49||0x1f4;return function(_0x598359){logger[_0x47ee('0x22')](_0x598359['stack']);if(_0x598359[_0x47ee('0x23')]){delete _0x598359[_0x47ee('0x23')];}_0x2e1670['status'](_0x3fed49)[_0x47ee('0x24')](_0x598359);};}exports[_0x47ee('0x25')]=function(_0x29cd86,_0xe7d9ee){var _0x4673a9={},_0x26e5fd={},_0x253e22={'count':0x0,'rows':[]};var _0x17809a=_['map'](db[_0x47ee('0x26')]['rawAttributes'],function(_0x463dfb){return{'name':_0x463dfb['fieldName'],'type':_0x463dfb['type']['key']};});_0x26e5fd[_0x47ee('0x27')]=_['map'](_0x17809a,_0x47ee('0x23'));_0x26e5fd[_0x47ee('0x28')]=_[_0x47ee('0x29')](_0x29cd86[_0x47ee('0x28')]);_0x26e5fd[_0x47ee('0x2a')]=_[_0x47ee('0x2b')](_0x26e5fd['model'],_0x26e5fd[_0x47ee('0x28')]);_0x4673a9[_0x47ee('0x2c')]=_[_0x47ee('0x2b')](_0x26e5fd['model'],qs[_0x47ee('0x2d')](_0x29cd86[_0x47ee('0x28')]['fields']));_0x4673a9['attributes']=_0x4673a9[_0x47ee('0x2c')]['length']?_0x4673a9[_0x47ee('0x2c')]:_0x26e5fd[_0x47ee('0x27')];if(!_0x29cd86[_0x47ee('0x28')][_0x47ee('0x2e')](_0x47ee('0x2f'))){_0x4673a9[_0x47ee('0x19')]=qs[_0x47ee('0x19')](_0x29cd86['query'][_0x47ee('0x19')]);_0x4673a9[_0x47ee('0x17')]=qs['offset'](_0x29cd86['query'][_0x47ee('0x17')]);}_0x4673a9[_0x47ee('0x30')]=qs[_0x47ee('0x31')](_0x29cd86['query']['sort']);_0x4673a9[_0x47ee('0x32')]=qs[_0x47ee('0x2a')](_['pick'](_0x29cd86[_0x47ee('0x28')],_0x26e5fd[_0x47ee('0x2a')]),_0x17809a);if(_0x29cd86['query']['filter']){_0x4673a9[_0x47ee('0x32')]=_[_0x47ee('0x33')](_0x4673a9[_0x47ee('0x32')],{'$or':_['map'](_0x17809a,function(_0xdaeaf6){if(_0xdaeaf6['type']!==_0x47ee('0x34')){var _0x5d3a70={};_0x5d3a70[_0xdaeaf6[_0x47ee('0x23')]]={'$like':'%'+_0x29cd86[_0x47ee('0x28')][_0x47ee('0x35')]+'%'};return _0x5d3a70;}})});}_0x4673a9=_[_0x47ee('0x33')]({},_0x4673a9,_0x29cd86[_0x47ee('0x36')]);var _0x251ed8={'where':_0x4673a9[_0x47ee('0x32')]};return db['SmsQueueReport'][_0x47ee('0x1a')](_0x251ed8)[_0x47ee('0x1f')](function(_0x53b47c){_0x253e22[_0x47ee('0x1a')]=_0x53b47c;if(_0x29cd86['query']['includeAll']){_0x4673a9[_0x47ee('0x37')]=[{'all':!![]}];}return db[_0x47ee('0x26')][_0x47ee('0x38')](_0x4673a9);})[_0x47ee('0x1f')](function(_0x371606){_0x253e22[_0x47ee('0x39')]=_0x371606;return _0x253e22;})[_0x47ee('0x1f')](respondWithFilteredResult(_0xe7d9ee,_0x4673a9))['catch'](handleError(_0xe7d9ee,null));};exports[_0x47ee('0x3a')]=function(_0x40cdd8,_0x4845ac){var _0x306d93={'raw':!![],'where':{'id':_0x40cdd8['params']['id']}},_0x51b4c5={};_0x51b4c5[_0x47ee('0x27')]=_['keys'](db[_0x47ee('0x26')]['rawAttributes']);_0x51b4c5[_0x47ee('0x28')]=_['keys'](_0x40cdd8[_0x47ee('0x28')]);_0x51b4c5[_0x47ee('0x2a')]=_[_0x47ee('0x2b')](_0x51b4c5['model'],_0x51b4c5[_0x47ee('0x28')]);_0x306d93[_0x47ee('0x2c')]=_[_0x47ee('0x2b')](_0x51b4c5[_0x47ee('0x27')],qs['fields'](_0x40cdd8[_0x47ee('0x28')][_0x47ee('0x2d')]));_0x306d93[_0x47ee('0x2c')]=_0x306d93['attributes'][_0x47ee('0x3b')]?_0x306d93[_0x47ee('0x2c')]:_0x51b4c5[_0x47ee('0x27')];if(_0x40cdd8['query'][_0x47ee('0x3c')]){_0x306d93['include']=[{'all':!![]}];}_0x306d93=_[_0x47ee('0x33')]({},_0x306d93,_0x40cdd8[_0x47ee('0x36')]);return db['SmsQueueReport'][_0x47ee('0x3d')](_0x306d93)[_0x47ee('0x1f')](handleEntityNotFound(_0x4845ac,null))['then'](respondWithResult(_0x4845ac,null))[_0x47ee('0x3e')](handleError(_0x4845ac,null));};exports['create']=function(_0x5a511f,_0x3f9b6e){return db[_0x47ee('0x26')]['create'](_0x5a511f[_0x47ee('0x3f')],{})[_0x47ee('0x1f')](respondWithResult(_0x3f9b6e,0xc9))[_0x47ee('0x3e')](handleError(_0x3f9b6e,null));};exports[_0x47ee('0x40')]=function(_0x510954,_0x4e5408){if(_0x510954[_0x47ee('0x3f')]['id']){delete _0x510954[_0x47ee('0x3f')]['id'];}return db[_0x47ee('0x26')][_0x47ee('0x3d')]({'where':{'id':_0x510954[_0x47ee('0x41')]['id']}})[_0x47ee('0x1f')](handleEntityNotFound(_0x4e5408,null))['then'](saveUpdates(_0x510954[_0x47ee('0x3f')],null))['then'](respondWithResult(_0x4e5408,null))['catch'](handleError(_0x4e5408,null));};exports[_0x47ee('0x20')]=function(_0x564492,_0x2e9ac0){return db['SmsQueueReport'][_0x47ee('0x3d')]({'where':{'id':_0x564492[_0x47ee('0x41')]['id']}})[_0x47ee('0x1f')](handleEntityNotFound(_0x2e9ac0,null))[_0x47ee('0x1f')](removeEntity(_0x2e9ac0,null))[_0x47ee('0x3e')](handleError(_0x2e9ac0,null));};exports[_0x47ee('0x42')]=function(_0x2813d9,_0xa7e612){return db['SmsQueueReport'][_0x47ee('0x42')]()[_0x47ee('0x1f')](respondWithResult(_0xa7e612,null))[_0x47ee('0x3e')](handleError(_0xa7e612,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 432f43b..bc41105 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x4438eb,_0x4a8625){var _0x9535d1=function(_0x37cc77){while(--_0x37cc77){_0x4438eb['push'](_0x4438eb['shift']());}};_0x9535d1(++_0x4a8625);}(_0x70e0,0x17b));var _0x070e=function(_0x3c75cc,_0x524dda){_0x3c75cc=_0x3c75cc-0x0;var _0xa4df4c=_0x70e0[_0x3c75cc];return _0xa4df4c;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 806e2b5..f39dfe8 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 _0xc4b6=['body','where','attributes','then','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update'];(function(_0x304fbd,_0x401f58){var _0x3a4448=function(_0x261bc9){while(--_0x261bc9){_0x304fbd['push'](_0x304fbd['shift']());}};_0x3a4448(++_0x401f58);}(_0xc4b6,0x18b));var _0x6c4b=function(_0x3419e1,_0x50b81f){_0x3419e1=_0x3419e1-0x0;var _0x478e6a=_0xc4b6[_0x3419e1];return _0x478e6a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c4b('0x0'));var BPromise=require(_0x6c4b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c4b('0x2'))['db'];var utils=require(_0x6c4b('0x3'));var logger=require(_0x6c4b('0x4'))(_0x6c4b('0x5'));var config=require('../../config/environment');var jayson=require(_0x6c4b('0x6'));var client=jayson[_0x6c4b('0x7')][_0x6c4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e1465,_0x113b78,_0x44365c){return new BPromise(function(_0x79383c,_0x422bcd){return client[_0x6c4b('0x9')](_0x5e1465,_0x44365c)['then'](function(_0x2037a1){logger['info'](_0x6c4b('0xa'),_0x113b78,_0x6c4b('0xb'));logger[_0x6c4b('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x113b78,_0x6c4b('0xb'),JSON[_0x6c4b('0xd')](_0x2037a1));if(_0x2037a1[_0x6c4b('0xe')]){if(_0x2037a1['error']['code']===0x1f4){logger[_0x6c4b('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x113b78,_0x2037a1['error'][_0x6c4b('0xf')]);return _0x422bcd(_0x2037a1[_0x6c4b('0xe')][_0x6c4b('0xf')]);}logger[_0x6c4b('0xe')](_0x6c4b('0xa'),_0x113b78,_0x2037a1['error']['message']);return _0x79383c(_0x2037a1[_0x6c4b('0xe')][_0x6c4b('0xf')]);}else{logger[_0x6c4b('0x10')](_0x6c4b('0xa'),_0x113b78,_0x6c4b('0xb'));_0x79383c(_0x2037a1[_0x6c4b('0x11')][_0x6c4b('0xf')]);}})['catch'](function(_0x384fdc){logger[_0x6c4b('0xe')](_0x6c4b('0xa'),_0x113b78,_0x384fdc);_0x422bcd(_0x384fdc);});});}exports[_0x6c4b('0x12')]=function(_0x5ce4da){var _0x108b43=this;return new Promise(function(_0x4727e3,_0x2f02c4){return db[_0x6c4b('0x13')][_0x6c4b('0x14')](_0x5ce4da['body'],{'raw':_0x5ce4da[_0x6c4b('0x15')]?_0x5ce4da[_0x6c4b('0x15')][_0x6c4b('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x237a59){logger[_0x6c4b('0x10')]('CreateSmsQueueReport',_0x5ce4da);logger[_0x6c4b('0xc')](_0x6c4b('0x12'),_0x5ce4da,JSON[_0x6c4b('0xd')](_0x237a59));_0x4727e3(_0x237a59);})['catch'](function(_0x3da3e1){logger[_0x6c4b('0xe')](_0x6c4b('0x12'),_0x3da3e1[_0x6c4b('0xf')],_0x5ce4da);_0x2f02c4(_0x108b43[_0x6c4b('0xe')](0x1f4,_0x3da3e1[_0x6c4b('0xf')]));});});};exports[_0x6c4b('0x17')]=function(_0x4757f3){var _0x13f043=this;return new Promise(function(_0x775059,_0x28857b){return db[_0x6c4b('0x13')][_0x6c4b('0x18')](_0x4757f3[_0x6c4b('0x19')],{'raw':_0x4757f3['options']?_0x4757f3[_0x6c4b('0x15')][_0x6c4b('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4757f3[_0x6c4b('0x15')]?_0x4757f3[_0x6c4b('0x15')][_0x6c4b('0x1a')]||null:null,'attributes':_0x4757f3[_0x6c4b('0x15')]?_0x4757f3[_0x6c4b('0x15')][_0x6c4b('0x1b')]||null:null,'limit':_0x4757f3[_0x6c4b('0x15')]?_0x4757f3[_0x6c4b('0x15')]['limit']||null:null})[_0x6c4b('0x1c')](function(_0x278533){logger['info'](_0x6c4b('0x17'),_0x4757f3);logger['debug'](_0x6c4b('0x17'),_0x4757f3,JSON[_0x6c4b('0xd')](_0x278533));_0x775059(_0x278533);})[_0x6c4b('0x1d')](function(_0x12fdb2){logger['error'](_0x6c4b('0x17'),_0x12fdb2['message'],_0x4757f3);_0x28857b(_0x13f043['error'](0x1f4,_0x12fdb2[_0x6c4b('0xf')]));});});}; \ No newline at end of file +var _0x92df=['jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','catch','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x92df,0x1a5));var _0xf92d=function(_0x5705c7,_0x36e5c2){_0x5705c7=_0x5705c7-0x0;var _0x18b743=_0x92df[_0x5705c7];return _0x18b743;};'use strict';var _=require(_0xf92d('0x0'));var util=require(_0xf92d('0x1'));var moment=require(_0xf92d('0x2'));var BPromise=require(_0xf92d('0x3'));var rs=require(_0xf92d('0x4'));var fs=require('fs');var Redis=require(_0xf92d('0x5'));var db=require(_0xf92d('0x6'))['db'];var utils=require(_0xf92d('0x7'));var logger=require(_0xf92d('0x8'))(_0xf92d('0x9'));var config=require(_0xf92d('0xa'));var jayson=require(_0xf92d('0xb'));var client=jayson[_0xf92d('0xc')][_0xf92d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x591fdb,_0x4d643c,_0x1aeb05){return new BPromise(function(_0x474c47,_0x54b730){return client['request'](_0x591fdb,_0x1aeb05)[_0xf92d('0xe')](function(_0xdb68b5){logger[_0xf92d('0xf')](_0xf92d('0x10'),_0x4d643c,_0xf92d('0x11'));logger[_0xf92d('0x12')](_0xf92d('0x13'),_0x4d643c,_0xf92d('0x11'),JSON['stringify'](_0xdb68b5));if(_0xdb68b5['error']){if(_0xdb68b5[_0xf92d('0x14')][_0xf92d('0x15')]===0x1f4){logger[_0xf92d('0x14')](_0xf92d('0x10'),_0x4d643c,_0xdb68b5[_0xf92d('0x14')][_0xf92d('0x16')]);return _0x54b730(_0xdb68b5[_0xf92d('0x14')]['message']);}logger['error'](_0xf92d('0x10'),_0x4d643c,_0xdb68b5[_0xf92d('0x14')][_0xf92d('0x16')]);return _0x474c47(_0xdb68b5[_0xf92d('0x14')][_0xf92d('0x16')]);}else{logger[_0xf92d('0xf')](_0xf92d('0x10'),_0x4d643c,_0xf92d('0x11'));_0x474c47(_0xdb68b5['result'][_0xf92d('0x16')]);}})['catch'](function(_0x8f4313){logger[_0xf92d('0x14')](_0xf92d('0x10'),_0x4d643c,_0x8f4313);_0x54b730(_0x8f4313);});});}exports[_0xf92d('0x17')]=function(_0x4f02a6){var _0x3db4c7=this;return new Promise(function(_0x4cd923,_0x3cd868){return db[_0xf92d('0x18')][_0xf92d('0x19')](_0x4f02a6[_0xf92d('0x1a')],{'raw':_0x4f02a6[_0xf92d('0x1b')]?_0x4f02a6['options'][_0xf92d('0x1c')]===undefined?!![]:![]:!![]})[_0xf92d('0xe')](function(_0x4c3f91){logger['info'](_0xf92d('0x17'),_0x4f02a6);logger[_0xf92d('0x12')](_0xf92d('0x17'),_0x4f02a6,JSON[_0xf92d('0x1d')](_0x4c3f91));_0x4cd923(_0x4c3f91);})[_0xf92d('0x1e')](function(_0x222aa0){logger[_0xf92d('0x14')]('CreateSmsQueueReport',_0x222aa0[_0xf92d('0x16')],_0x4f02a6);_0x3cd868(_0x3db4c7['error'](0x1f4,_0x222aa0[_0xf92d('0x16')]));});});};exports['UpdateSmsQueueReport']=function(_0x51407d){var _0x10e87e=this;return new Promise(function(_0x27ae47,_0x26ac0b){return db[_0xf92d('0x18')][_0xf92d('0x1f')](_0x51407d[_0xf92d('0x1a')],{'raw':_0x51407d[_0xf92d('0x1b')]?_0x51407d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51407d[_0xf92d('0x1b')]?_0x51407d['options'][_0xf92d('0x20')]||null:null,'attributes':_0x51407d[_0xf92d('0x1b')]?_0x51407d[_0xf92d('0x1b')][_0xf92d('0x21')]||null:null,'limit':_0x51407d[_0xf92d('0x1b')]?_0x51407d[_0xf92d('0x1b')][_0xf92d('0x22')]||null:null})['then'](function(_0x4e5860){logger['info'](_0xf92d('0x23'),_0x51407d);logger['debug'](_0xf92d('0x23'),_0x51407d,JSON[_0xf92d('0x1d')](_0x4e5860));_0x27ae47(_0x4e5860);})[_0xf92d('0x1e')](function(_0x20ee24){logger[_0xf92d('0x14')](_0xf92d('0x23'),_0x20ee24[_0xf92d('0x16')],_0x51407d);_0x26ac0b(_0x10e87e[_0xf92d('0x14')](0x1f4,_0x20ee24['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 6ff96be..7bceba8 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 _0xdd0c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','util','path','connect-timeout','Router'];(function(_0x3a645c,_0x7a5de3){var _0x10cbe6=function(_0x55a218){while(--_0x55a218){_0x3a645c['push'](_0x3a645c['shift']());}};_0x10cbe6(++_0x7a5de3);}(_0xdd0c,0x165));var _0xcdd0=function(_0x593e2b,_0x2d3635){_0x593e2b=_0x593e2b-0x0;var _0x563128=_0xdd0c[_0x593e2b];return _0x563128;};'use strict';var multer=require('multer');var util=require(_0xcdd0('0x0'));var path=require(_0xcdd0('0x1'));var timeout=require(_0xcdd0('0x2'));var express=require('express');var router=express[_0xcdd0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcdd0('0x4'));var interaction=require(_0xcdd0('0x5'));var config=require(_0xcdd0('0x6'));var controller=require(_0xcdd0('0x7'));router[_0xcdd0('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdd0('0x9')]);router[_0xcdd0('0x8')](_0xcdd0('0xa'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xc')]);router['get'](_0xcdd0('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcdd0('0xe')]('/',auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xf')]);router[_0xcdd0('0x10')](_0xcdd0('0xd'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0x11')]);router[_0xcdd0('0x12')](_0xcdd0('0xd'),auth[_0xcdd0('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8b1=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','create','/:id','update','delete','destroy'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0xd8b1,0x105));var _0x1d8b=function(_0x2d4de2,_0x322055){_0x2d4de2=_0x2d4de2-0x0;var _0x121ee1=_0xd8b1[_0x2d4de2];return _0x121ee1;};'use strict';var multer=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var path=require(_0x1d8b('0x2'));var timeout=require(_0x1d8b('0x3'));var express=require(_0x1d8b('0x4'));var router=express['Router']();var fs_extra=require(_0x1d8b('0x5'));var auth=require(_0x1d8b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d8b('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1d8b('0x8')]);router['get'](_0x1d8b('0x9'),auth[_0x1d8b('0xa')](),controller[_0x1d8b('0xb')]);router[_0x1d8b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1d8b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1d8b('0xe')]);router['put'](_0x1d8b('0xf'),auth['isAuthenticated'](),controller[_0x1d8b('0x10')]);router[_0x1d8b('0x11')](_0x1d8b('0xf'),auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x12')]);module[_0x1d8b('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ef1d2b6..0d1cb67 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5db0b4,_0x1bdfc1){var _0x215134=function(_0xc1fea1){while(--_0xc1fea1){_0x5db0b4['push'](_0x5db0b4['shift']());}};_0x215134(++_0x1bdfc1);}(_0xedd9,0xfc));var _0x9edd=function(_0xc4383b,_0x14e237){_0xc4383b=_0xc4383b-0x0;var _0x8c072=_0xedd9[_0xc4383b];return _0x8c072;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x39cc09,_0x500de7){var _0x10eadd=function(_0x553c0d){while(--_0x553c0d){_0x39cc09['push'](_0x39cc09['shift']());}};_0x10eadd(++_0x500de7);}(_0x54ef,0x112));var _0xf54e=function(_0x2c37d8,_0x155581){_0x2c37d8=_0x2c37d8-0x0;var _0x31c2e3=_0x54ef[_0x2c37d8];return _0x31c2e3;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 17b6368..475765b 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 _0xb43c=['fieldName','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','name','SmsTransferReport'];(function(_0x12e9bb,_0x306da0){var _0x135074=function(_0x207f11){while(--_0x207f11){_0x12e9bb['push'](_0x12e9bb['shift']());}};_0x135074(++_0x306da0);}(_0xb43c,0x1ea));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xcb43('0x0'));var rimraf=require(_0xcb43('0x1'));var zipdir=require(_0xcb43('0x2'));var jsonpatch=require(_0xcb43('0x3'));var rp=require(_0xcb43('0x4'));var moment=require(_0xcb43('0x5'));var BPromise=require(_0xcb43('0x6'));var Mustache=require(_0xcb43('0x7'));var util=require(_0xcb43('0x8'));var path=require(_0xcb43('0x9'));var sox=require(_0xcb43('0xa'));var csv=require(_0xcb43('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb43('0xc'));var _=require(_0xcb43('0xd'));var squel=require(_0xcb43('0xe'));var crypto=require(_0xcb43('0xf'));var jsforce=require(_0xcb43('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcb43('0xb'));var querystring=require(_0xcb43('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcb43('0x12'));var qs=require(_0xcb43('0x13'));var as=require(_0xcb43('0x14'));var hardwareService=require(_0xcb43('0x15'));var logger=require(_0xcb43('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcb43('0x17'));var db=require(_0xcb43('0x18'))['db'];function respondWithStatusCode(_0x7355a3,_0x337495){_0x337495=_0x337495||0xcc;return function(_0x58987d){if(_0x58987d){return _0x7355a3[_0xcb43('0x19')](_0x337495);}return _0x7355a3[_0xcb43('0x1a')](_0x337495)[_0xcb43('0x1b')]();};}function respondWithResult(_0x2b9725,_0x1e2fa1){_0x1e2fa1=_0x1e2fa1||0xc8;return function(_0x496a42){if(_0x496a42){return _0x2b9725[_0xcb43('0x1a')](_0x1e2fa1)[_0xcb43('0x1c')](_0x496a42);}};}function respondWithFilteredResult(_0x3484fa,_0x262339){return function(_0x11b5e6){if(_0x11b5e6){var _0x8e4800=typeof _0x262339[_0xcb43('0x1d')]===_0xcb43('0x1e')&&typeof _0x262339['limit']===_0xcb43('0x1e');var _0x301f5f=_0x11b5e6[_0xcb43('0x1f')];var _0x46372e=_0x8e4800?0x0:_0x262339['offset'];var _0x3b6d39=_0x8e4800?_0x11b5e6[_0xcb43('0x1f')]:_0x262339[_0xcb43('0x1d')]+_0x262339[_0xcb43('0x20')];var _0x3660a3;if(_0x3b6d39>=_0x301f5f){_0x3b6d39=_0x301f5f;_0x3660a3=0xc8;}else{_0x3660a3=0xce;}_0x3484fa['status'](_0x3660a3);return _0x3484fa[_0xcb43('0x21')](_0xcb43('0x22'),_0x46372e+'-'+_0x3b6d39+'/'+_0x301f5f)[_0xcb43('0x1c')](_0x11b5e6);}return null;};}function patchUpdates(_0x12115f){return function(_0x8d549e){try{jsonpatch[_0xcb43('0x23')](_0x8d549e,_0x12115f,!![]);}catch(_0x30dc17){return BPromise[_0xcb43('0x24')](_0x30dc17);}return _0x8d549e['save']();};}function saveUpdates(_0x295070,_0x28b0bd){return function(_0x379203){if(_0x379203){return _0x379203[_0xcb43('0x25')](_0x295070)['then'](function(_0x31fa57){return _0x31fa57;});}return null;};}function removeEntity(_0x5ba07b,_0xf860d4){return function(_0x5bf475){if(_0x5bf475){return _0x5bf475['destroy']()[_0xcb43('0x26')](function(){_0x5ba07b[_0xcb43('0x1a')](0xcc)[_0xcb43('0x1b')]();});}};}function handleEntityNotFound(_0x468eb6,_0x32f306){return function(_0x3a5ae3){if(!_0x3a5ae3){_0x468eb6['sendStatus'](0x194);}return _0x3a5ae3;};}function handleError(_0x3aee3d,_0x235a23){_0x235a23=_0x235a23||0x1f4;return function(_0x40e064){logger[_0xcb43('0x27')](_0x40e064['stack']);if(_0x40e064['name']){delete _0x40e064[_0xcb43('0x28')];}_0x3aee3d[_0xcb43('0x1a')](_0x235a23)['send'](_0x40e064);};}exports['index']=function(_0x19cf6f,_0x50b0f8){var _0x596db3={},_0x243ec6={},_0x1385e2={'count':0x0,'rows':[]};var _0x5a3c96=_['map'](db[_0xcb43('0x29')]['rawAttributes'],function(_0xdea1d1){return{'name':_0xdea1d1[_0xcb43('0x2a')],'type':_0xdea1d1['type'][_0xcb43('0x2b')]};});_0x243ec6[_0xcb43('0x2c')]=_[_0xcb43('0x2d')](_0x5a3c96,'name');_0x243ec6['query']=_['keys'](_0x19cf6f[_0xcb43('0x2e')]);_0x243ec6[_0xcb43('0x2f')]=_['intersection'](_0x243ec6[_0xcb43('0x2c')],_0x243ec6['query']);_0x596db3[_0xcb43('0x30')]=_['intersection'](_0x243ec6[_0xcb43('0x2c')],qs[_0xcb43('0x31')](_0x19cf6f[_0xcb43('0x2e')][_0xcb43('0x31')]));_0x596db3[_0xcb43('0x30')]=_0x596db3[_0xcb43('0x30')][_0xcb43('0x32')]?_0x596db3[_0xcb43('0x30')]:_0x243ec6[_0xcb43('0x2c')];if(!_0x19cf6f['query'][_0xcb43('0x33')](_0xcb43('0x34'))){_0x596db3[_0xcb43('0x20')]=qs[_0xcb43('0x20')](_0x19cf6f[_0xcb43('0x2e')][_0xcb43('0x20')]);_0x596db3[_0xcb43('0x1d')]=qs[_0xcb43('0x1d')](_0x19cf6f[_0xcb43('0x2e')][_0xcb43('0x1d')]);}_0x596db3[_0xcb43('0x35')]=qs[_0xcb43('0x36')](_0x19cf6f[_0xcb43('0x2e')]['sort']);_0x596db3[_0xcb43('0x37')]=qs['filters'](_[_0xcb43('0x38')](_0x19cf6f[_0xcb43('0x2e')],_0x243ec6['filters']),_0x5a3c96);if(_0x19cf6f[_0xcb43('0x2e')][_0xcb43('0x39')]){_0x596db3[_0xcb43('0x37')]=_['merge'](_0x596db3[_0xcb43('0x37')],{'$or':_[_0xcb43('0x2d')](_0x5a3c96,function(_0x25ec84){if(_0x25ec84[_0xcb43('0x3a')]!=='VIRTUAL'){var _0x437b99={};_0x437b99[_0x25ec84['name']]={'$like':'%'+_0x19cf6f[_0xcb43('0x2e')]['filter']+'%'};return _0x437b99;}})});}_0x596db3=_[_0xcb43('0x3b')]({},_0x596db3,_0x19cf6f[_0xcb43('0x3c')]);var _0x45847e={'where':_0x596db3['where']};return db[_0xcb43('0x29')][_0xcb43('0x1f')](_0x45847e)[_0xcb43('0x26')](function(_0x11aa19){_0x1385e2[_0xcb43('0x1f')]=_0x11aa19;if(_0x19cf6f[_0xcb43('0x2e')][_0xcb43('0x3d')]){_0x596db3[_0xcb43('0x3e')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xcb43('0x3f')](_0x596db3);})[_0xcb43('0x26')](function(_0x168416){_0x1385e2[_0xcb43('0x40')]=_0x168416;return _0x1385e2;})['then'](respondWithFilteredResult(_0x50b0f8,_0x596db3))[_0xcb43('0x41')](handleError(_0x50b0f8,null));};exports[_0xcb43('0x42')]=function(_0x4680db,_0x432811){var _0x5aefae={'raw':!![],'where':{'id':_0x4680db[_0xcb43('0x43')]['id']}},_0xe91e9c={};_0xe91e9c['model']=_[_0xcb43('0x44')](db[_0xcb43('0x29')][_0xcb43('0x45')]);_0xe91e9c['query']=_[_0xcb43('0x44')](_0x4680db[_0xcb43('0x2e')]);_0xe91e9c['filters']=_[_0xcb43('0x46')](_0xe91e9c[_0xcb43('0x2c')],_0xe91e9c['query']);_0x5aefae[_0xcb43('0x30')]=_[_0xcb43('0x46')](_0xe91e9c[_0xcb43('0x2c')],qs[_0xcb43('0x31')](_0x4680db[_0xcb43('0x2e')][_0xcb43('0x31')]));_0x5aefae[_0xcb43('0x30')]=_0x5aefae[_0xcb43('0x30')]['length']?_0x5aefae[_0xcb43('0x30')]:_0xe91e9c[_0xcb43('0x2c')];if(_0x4680db[_0xcb43('0x2e')]['includeAll']){_0x5aefae[_0xcb43('0x3e')]=[{'all':!![]}];}_0x5aefae=_[_0xcb43('0x3b')]({},_0x5aefae,_0x4680db[_0xcb43('0x3c')]);return db[_0xcb43('0x29')][_0xcb43('0x47')](_0x5aefae)[_0xcb43('0x26')](handleEntityNotFound(_0x432811,null))['then'](respondWithResult(_0x432811,null))[_0xcb43('0x41')](handleError(_0x432811,null));};exports[_0xcb43('0x48')]=function(_0x512164,_0x58f180){return db[_0xcb43('0x29')][_0xcb43('0x48')](_0x512164['body'],{})['then'](respondWithResult(_0x58f180,0xc9))['catch'](handleError(_0x58f180,null));};exports[_0xcb43('0x25')]=function(_0x296f06,_0x98cde6){if(_0x296f06[_0xcb43('0x49')]['id']){delete _0x296f06[_0xcb43('0x49')]['id'];}return db['SmsTransferReport'][_0xcb43('0x47')]({'where':{'id':_0x296f06['params']['id']}})[_0xcb43('0x26')](handleEntityNotFound(_0x98cde6,null))[_0xcb43('0x26')](saveUpdates(_0x296f06[_0xcb43('0x49')],null))[_0xcb43('0x26')](respondWithResult(_0x98cde6,null))['catch'](handleError(_0x98cde6,null));};exports[_0xcb43('0x4a')]=function(_0x4f23d3,_0xf80d48){return db[_0xcb43('0x29')][_0xcb43('0x47')]({'where':{'id':_0x4f23d3[_0xcb43('0x43')]['id']}})[_0xcb43('0x26')](handleEntityNotFound(_0xf80d48,null))[_0xcb43('0x26')](removeEntity(_0xf80d48,null))[_0xcb43('0x41')](handleError(_0xf80d48,null));};exports[_0xcb43('0x4b')]=function(_0x498095,_0x315794){return db['SmsTransferReport'][_0xcb43('0x4b')]()['then'](respondWithResult(_0x315794,null))[_0xcb43('0x41')](handleError(_0x315794,null));}; \ No newline at end of file +var _0x743c=['map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','fields','includeAll','include','find','create','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x743c,0x1d8));var _0xc743=function(_0x1278b6,_0x24252e){_0x1278b6=_0x1278b6-0x0;var _0x2cff42=_0x743c[_0x1278b6];return _0x2cff42;};'use strict';var emlformat=require(_0xc743('0x0'));var rimraf=require(_0xc743('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc743('0x2'));var moment=require(_0xc743('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc743('0x4'));var util=require(_0xc743('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc743('0x6'));var ejs=require(_0xc743('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc743('0x8'));var squel=require(_0xc743('0x9'));var crypto=require(_0xc743('0xa'));var jsforce=require(_0xc743('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc743('0xc'));var Papa=require(_0xc743('0xd'));var Redis=require(_0xc743('0xe'));var authService=require(_0xc743('0xf'));var qs=require(_0xc743('0x10'));var as=require(_0xc743('0x11'));var hardwareService=require(_0xc743('0x12'));var logger=require('../../config/logger')(_0xc743('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc743('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55d0cf,_0x464aee){_0x464aee=_0x464aee||0xcc;return function(_0x13638a){if(_0x13638a){return _0x55d0cf[_0xc743('0x15')](_0x464aee);}return _0x55d0cf[_0xc743('0x16')](_0x464aee)[_0xc743('0x17')]();};}function respondWithResult(_0x2e74f4,_0x137ef6){_0x137ef6=_0x137ef6||0xc8;return function(_0x88ead8){if(_0x88ead8){return _0x2e74f4['status'](_0x137ef6)[_0xc743('0x18')](_0x88ead8);}};}function respondWithFilteredResult(_0xba25c,_0x5a9647){return function(_0x4974bf){if(_0x4974bf){var _0x24fd7a=typeof _0x5a9647['offset']===_0xc743('0x19')&&typeof _0x5a9647[_0xc743('0x1a')]===_0xc743('0x19');var _0x1c74a0=_0x4974bf[_0xc743('0x1b')];var _0xdcc240=_0x24fd7a?0x0:_0x5a9647[_0xc743('0x1c')];var _0x3e1963=_0x24fd7a?_0x4974bf[_0xc743('0x1b')]:_0x5a9647['offset']+_0x5a9647[_0xc743('0x1a')];var _0x110d30;if(_0x3e1963>=_0x1c74a0){_0x3e1963=_0x1c74a0;_0x110d30=0xc8;}else{_0x110d30=0xce;}_0xba25c[_0xc743('0x16')](_0x110d30);return _0xba25c['set'](_0xc743('0x1d'),_0xdcc240+'-'+_0x3e1963+'/'+_0x1c74a0)['json'](_0x4974bf);}return null;};}function patchUpdates(_0x584a85){return function(_0x4b35cd){try{jsonpatch[_0xc743('0x1e')](_0x4b35cd,_0x584a85,!![]);}catch(_0x3fc5c0){return BPromise[_0xc743('0x1f')](_0x3fc5c0);}return _0x4b35cd['save']();};}function saveUpdates(_0x24037c,_0x598b16){return function(_0x74f431){if(_0x74f431){return _0x74f431[_0xc743('0x20')](_0x24037c)[_0xc743('0x21')](function(_0x262c43){return _0x262c43;});}return null;};}function removeEntity(_0x203975,_0x925482){return function(_0x437dcc){if(_0x437dcc){return _0x437dcc[_0xc743('0x22')]()['then'](function(){_0x203975[_0xc743('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d209,_0x2fb1e3){return function(_0x4d1689){if(!_0x4d1689){_0x50d209[_0xc743('0x15')](0x194);}return _0x4d1689;};}function handleError(_0x9fd93c,_0x119e03){_0x119e03=_0x119e03||0x1f4;return function(_0x2c0792){logger[_0xc743('0x23')](_0x2c0792['stack']);if(_0x2c0792[_0xc743('0x24')]){delete _0x2c0792['name'];}_0x9fd93c['status'](_0x119e03)[_0xc743('0x25')](_0x2c0792);};}exports[_0xc743('0x26')]=function(_0x5a7114,_0x4ce7dc){var _0xbbd14b={},_0x5f0ac0={},_0x4737b0={'count':0x0,'rows':[]};var _0x284800=_[_0xc743('0x27')](db[_0xc743('0x28')][_0xc743('0x29')],function(_0x3b4549){return{'name':_0x3b4549[_0xc743('0x2a')],'type':_0x3b4549['type'][_0xc743('0x2b')]};});_0x5f0ac0[_0xc743('0x2c')]=_[_0xc743('0x27')](_0x284800,'name');_0x5f0ac0[_0xc743('0x2d')]=_[_0xc743('0x2e')](_0x5a7114[_0xc743('0x2d')]);_0x5f0ac0[_0xc743('0x2f')]=_[_0xc743('0x30')](_0x5f0ac0[_0xc743('0x2c')],_0x5f0ac0['query']);_0xbbd14b[_0xc743('0x31')]=_[_0xc743('0x30')](_0x5f0ac0[_0xc743('0x2c')],qs['fields'](_0x5a7114['query']['fields']));_0xbbd14b['attributes']=_0xbbd14b[_0xc743('0x31')][_0xc743('0x32')]?_0xbbd14b['attributes']:_0x5f0ac0['model'];if(!_0x5a7114['query'][_0xc743('0x33')](_0xc743('0x34'))){_0xbbd14b[_0xc743('0x1a')]=qs[_0xc743('0x1a')](_0x5a7114[_0xc743('0x2d')][_0xc743('0x1a')]);_0xbbd14b['offset']=qs[_0xc743('0x1c')](_0x5a7114[_0xc743('0x2d')][_0xc743('0x1c')]);}_0xbbd14b[_0xc743('0x35')]=qs[_0xc743('0x36')](_0x5a7114[_0xc743('0x2d')]['sort']);_0xbbd14b[_0xc743('0x37')]=qs[_0xc743('0x2f')](_[_0xc743('0x38')](_0x5a7114[_0xc743('0x2d')],_0x5f0ac0[_0xc743('0x2f')]),_0x284800);if(_0x5a7114['query']['filter']){_0xbbd14b[_0xc743('0x37')]=_[_0xc743('0x39')](_0xbbd14b['where'],{'$or':_[_0xc743('0x27')](_0x284800,function(_0x7eb9e2){if(_0x7eb9e2['type']!==_0xc743('0x3a')){var _0x17827a={};_0x17827a[_0x7eb9e2['name']]={'$like':'%'+_0x5a7114['query'][_0xc743('0x3b')]+'%'};return _0x17827a;}})});}_0xbbd14b=_[_0xc743('0x39')]({},_0xbbd14b,_0x5a7114[_0xc743('0x3c')]);var _0x4c244f={'where':_0xbbd14b[_0xc743('0x37')]};return db[_0xc743('0x28')][_0xc743('0x1b')](_0x4c244f)['then'](function(_0x4a588c){_0x4737b0[_0xc743('0x1b')]=_0x4a588c;if(_0x5a7114[_0xc743('0x2d')]['includeAll']){_0xbbd14b['include']=[{'all':!![]}];}return db[_0xc743('0x28')][_0xc743('0x3d')](_0xbbd14b);})[_0xc743('0x21')](function(_0x29eafa){_0x4737b0[_0xc743('0x3e')]=_0x29eafa;return _0x4737b0;})[_0xc743('0x21')](respondWithFilteredResult(_0x4ce7dc,_0xbbd14b))[_0xc743('0x3f')](handleError(_0x4ce7dc,null));};exports[_0xc743('0x40')]=function(_0x29a868,_0x565a6f){var _0x2540e8={'raw':!![],'where':{'id':_0x29a868[_0xc743('0x41')]['id']}},_0x18a149={};_0x18a149['model']=_[_0xc743('0x2e')](db[_0xc743('0x28')]['rawAttributes']);_0x18a149[_0xc743('0x2d')]=_['keys'](_0x29a868['query']);_0x18a149[_0xc743('0x2f')]=_['intersection'](_0x18a149[_0xc743('0x2c')],_0x18a149[_0xc743('0x2d')]);_0x2540e8[_0xc743('0x31')]=_[_0xc743('0x30')](_0x18a149['model'],qs[_0xc743('0x42')](_0x29a868[_0xc743('0x2d')][_0xc743('0x42')]));_0x2540e8[_0xc743('0x31')]=_0x2540e8[_0xc743('0x31')][_0xc743('0x32')]?_0x2540e8[_0xc743('0x31')]:_0x18a149[_0xc743('0x2c')];if(_0x29a868[_0xc743('0x2d')][_0xc743('0x43')]){_0x2540e8[_0xc743('0x44')]=[{'all':!![]}];}_0x2540e8=_[_0xc743('0x39')]({},_0x2540e8,_0x29a868[_0xc743('0x3c')]);return db[_0xc743('0x28')][_0xc743('0x45')](_0x2540e8)[_0xc743('0x21')](handleEntityNotFound(_0x565a6f,null))[_0xc743('0x21')](respondWithResult(_0x565a6f,null))['catch'](handleError(_0x565a6f,null));};exports[_0xc743('0x46')]=function(_0x5df54c,_0xadaa44){return db[_0xc743('0x28')][_0xc743('0x46')](_0x5df54c[_0xc743('0x47')],{})[_0xc743('0x21')](respondWithResult(_0xadaa44,0xc9))[_0xc743('0x3f')](handleError(_0xadaa44,null));};exports[_0xc743('0x20')]=function(_0x39bdb3,_0x3cf36f){if(_0x39bdb3[_0xc743('0x47')]['id']){delete _0x39bdb3[_0xc743('0x47')]['id'];}return db['SmsTransferReport'][_0xc743('0x45')]({'where':{'id':_0x39bdb3[_0xc743('0x41')]['id']}})[_0xc743('0x21')](handleEntityNotFound(_0x3cf36f,null))[_0xc743('0x21')](saveUpdates(_0x39bdb3['body'],null))[_0xc743('0x21')](respondWithResult(_0x3cf36f,null))[_0xc743('0x3f')](handleError(_0x3cf36f,null));};exports['destroy']=function(_0x426131,_0x4ca5c4){return db['SmsTransferReport'][_0xc743('0x45')]({'where':{'id':_0x426131['params']['id']}})[_0xc743('0x21')](handleEntityNotFound(_0x4ca5c4,null))[_0xc743('0x21')](removeEntity(_0x4ca5c4,null))[_0xc743('0x3f')](handleError(_0x4ca5c4,null));};exports[_0xc743('0x48')]=function(_0x503df4,_0x2c1fab){return db[_0xc743('0x28')][_0xc743('0x48')]()[_0xc743('0x21')](respondWithResult(_0x2c1fab,null))['catch'](handleError(_0x2c1fab,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 364d21f..f967a3d 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 _0xccd7=['moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','uniqueid','util','../../config/logger','api'];(function(_0x551607,_0x3c62b7){var _0xc297c6=function(_0x5d57d8){while(--_0x5d57d8){_0x551607['push'](_0x551607['shift']());}};_0xc297c6(++_0x3c62b7);}(_0xccd7,0x75));var _0x7ccd=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0xccd7[_0x483ab9];return _0x35043b;};'use strict';var _=require('lodash');var util=require(_0x7ccd('0x0'));var logger=require(_0x7ccd('0x1'))(_0x7ccd('0x2'));var moment=require(_0x7ccd('0x3'));var BPromise=require(_0x7ccd('0x4'));var rp=require(_0x7ccd('0x5'));var fs=require('fs');var path=require(_0x7ccd('0x6'));var rimraf=require(_0x7ccd('0x7'));var config=require('../../config/environment');var attributes=require(_0x7ccd('0x8'));module['exports']=function(_0x3a07ce,_0x3644ae){return _0x3a07ce['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x7ccd('0x9'),'fields':[_0x7ccd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f2b=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x2dd092,_0x10a19e){var _0x2c9e3c=function(_0x1e6954){while(--_0x1e6954){_0x2dd092['push'](_0x2dd092['shift']());}};_0x2c9e3c(++_0x10a19e);}(_0x9f2b,0xb7));var _0xb9f2=function(_0x49ac79,_0x526424){_0x49ac79=_0x49ac79-0x0;var _0x40826a=_0x9f2b[_0x49ac79];return _0x40826a;};'use strict';var _=require(_0xb9f2('0x0'));var util=require(_0xb9f2('0x1'));var logger=require(_0xb9f2('0x2'))(_0xb9f2('0x3'));var moment=require(_0xb9f2('0x4'));var BPromise=require(_0xb9f2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9f2('0x6'));var rimraf=require(_0xb9f2('0x7'));var config=require(_0xb9f2('0x8'));var attributes=require(_0xb9f2('0x9'));module[_0xb9f2('0xa')]=function(_0x51c17f,_0x486eca){return _0x51c17f[_0xb9f2('0xb')](_0xb9f2('0xc'),attributes,{'tableName':_0xb9f2('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb9f2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 44b86a6..4852ea4 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 _0x4ce6=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x18f7ca,_0x582dd2){var _0x48cde4=function(_0x1be6d6){while(--_0x1be6d6){_0x18f7ca['push'](_0x18f7ca['shift']());}};_0x48cde4(++_0x582dd2);}(_0x4ce6,0x108));var _0x64ce=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0x4ce6[_0x34d275];return _0x1379cc;};'use strict';var _=require(_0x64ce('0x0'));var util=require('util');var moment=require(_0x64ce('0x1'));var BPromise=require(_0x64ce('0x2'));var rs=require(_0x64ce('0x3'));var fs=require('fs');var Redis=require(_0x64ce('0x4'));var db=require(_0x64ce('0x5'))['db'];var utils=require(_0x64ce('0x6'));var logger=require('../../config/logger')(_0x64ce('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64ce('0x8')][_0x64ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b8f2d,_0x538b74,_0x3c279f){return new BPromise(function(_0x134230,_0x1b253e){return client[_0x64ce('0xa')](_0x5b8f2d,_0x3c279f)[_0x64ce('0xb')](function(_0x135482){logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));logger['debug'](_0x64ce('0xf'),_0x538b74,_0x64ce('0xe'),JSON[_0x64ce('0x10')](_0x135482));if(_0x135482[_0x64ce('0x11')]){if(_0x135482[_0x64ce('0x11')][_0x64ce('0x12')]===0x1f4){logger[_0x64ce('0x11')](_0x64ce('0xd'),_0x538b74,_0x135482['error'][_0x64ce('0x13')]);return _0x1b253e(_0x135482['error']['message']);}logger[_0x64ce('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x538b74,_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);return _0x134230(_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);}else{logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));_0x134230(_0x135482[_0x64ce('0x14')][_0x64ce('0x13')]);}})['catch'](function(_0x4b49be){logger['error'](_0x64ce('0xd'),_0x538b74,_0x4b49be);_0x1b253e(_0x4b49be);});});} \ No newline at end of file +var _0xf483=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xd0ebc9,_0x27f887){var _0x3d57c3=function(_0x548111){while(--_0x548111){_0xd0ebc9['push'](_0xd0ebc9['shift']());}};_0x3d57c3(++_0x27f887);}(_0xf483,0xf2));var _0x3f48=function(_0x231829,_0x376ec3){_0x231829=_0x231829-0x0;var _0x5b6c7d=_0xf483[_0x231829];return _0x5b6c7d;};'use strict';var _=require('lodash');var util=require(_0x3f48('0x0'));var moment=require('moment');var BPromise=require(_0x3f48('0x1'));var rs=require(_0x3f48('0x2'));var fs=require('fs');var Redis=require(_0x3f48('0x3'));var db=require(_0x3f48('0x4'))['db'];var utils=require(_0x3f48('0x5'));var logger=require(_0x3f48('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f48('0x7')][_0x3f48('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x524a4f,_0x76804e,_0x2f1ca5){return new BPromise(function(_0x1746fd,_0x1f8a24){return client[_0x3f48('0x9')](_0x524a4f,_0x2f1ca5)[_0x3f48('0xa')](function(_0x264d15){logger['info'](_0x3f48('0xb'),_0x76804e,_0x3f48('0xc'));logger['debug'](_0x3f48('0xd'),_0x76804e,'request\x20sent',JSON[_0x3f48('0xe')](_0x264d15));if(_0x264d15[_0x3f48('0xf')]){if(_0x264d15[_0x3f48('0xf')][_0x3f48('0x10')]===0x1f4){logger[_0x3f48('0xf')](_0x3f48('0xb'),_0x76804e,_0x264d15[_0x3f48('0xf')][_0x3f48('0x11')]);return _0x1f8a24(_0x264d15[_0x3f48('0xf')][_0x3f48('0x11')]);}logger['error'](_0x3f48('0xb'),_0x76804e,_0x264d15[_0x3f48('0xf')][_0x3f48('0x11')]);return _0x1746fd(_0x264d15['error'][_0x3f48('0x11')]);}else{logger['info'](_0x3f48('0xb'),_0x76804e,_0x3f48('0xc'));_0x1746fd(_0x264d15[_0x3f48('0x12')]['message']);}})[_0x3f48('0x13')](function(_0x319aa5){logger[_0x3f48('0xf')](_0x3f48('0xb'),_0x76804e,_0x319aa5);_0x1f8a24(_0x319aa5);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index c318e39..7fe599b 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 _0xa8a1=['%s-%s%s','extname','now','single','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','diskStorage','join','server/files/sounds/original/','originalname','format'];(function(_0x165799,_0x260585){var _0x41409a=function(_0xe7bf84){while(--_0xe7bf84){_0x165799['push'](_0x165799['shift']());}};_0x41409a(++_0x260585);}(_0xa8a1,0xe1));var _0x1a8a=function(_0x34e491,_0x31d5af){_0x34e491=_0x34e491-0x0;var _0x4a1cbf=_0xa8a1[_0x34e491];return _0x4a1cbf;};'use strict';var multer=require(_0x1a8a('0x0'));var util=require(_0x1a8a('0x1'));var path=require('path');var timeout=require(_0x1a8a('0x2'));var express=require(_0x1a8a('0x3'));var router=express[_0x1a8a('0x4')]();var fs_extra=require(_0x1a8a('0x5'));var auth=require(_0x1a8a('0x6'));var interaction=require(_0x1a8a('0x7'));var config=require('../../config/environment');var controller=require(_0x1a8a('0x8'));router[_0x1a8a('0x9')]('/',auth[_0x1a8a('0xa')](),controller[_0x1a8a('0xb')]);router[_0x1a8a('0x9')](_0x1a8a('0xc'),auth[_0x1a8a('0xa')](),controller['show']);router[_0x1a8a('0x9')]('/:id/download',auth[_0x1a8a('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x1a8a('0xd')]({'destination':function(_0x3c9cf4,_0x17717e,_0x35296d){_0x35296d(null,path[_0x1a8a('0xe')](config['root'],_0x1a8a('0xf')));},'filename':function(_0x28c772,_0x313bd3,_0x352d03){_0x313bd3[_0x1a8a('0x10')]=_0x313bd3['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x352d03(null,util[_0x1a8a('0x11')](_0x1a8a('0x12'),path['basename'](_0x313bd3[_0x1a8a('0x10')],path[_0x1a8a('0x13')](_0x313bd3[_0x1a8a('0x10')])),Date[_0x1a8a('0x14')](),path[_0x1a8a('0x13')](_0x313bd3['originalname'])));}})});router['post']('/',upload[_0x1a8a('0x15')]('file'),controller[_0x1a8a('0x16')]);router[_0x1a8a('0x17')](_0x1a8a('0xc'),auth['isAuthenticated'](),controller[_0x1a8a('0x18')]);router[_0x1a8a('0x19')](_0x1a8a('0xc'),auth[_0x1a8a('0xa')](),controller[_0x1a8a('0x19')]);module[_0x1a8a('0x1a')]=router; \ No newline at end of file +var _0xe914=['replace','format','basename','extname','now','single','file','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/download','download','root','originalname'];(function(_0x3e31e1,_0x5a0b44){var _0x531e27=function(_0x1b99d4){while(--_0x1b99d4){_0x3e31e1['push'](_0x3e31e1['shift']());}};_0x531e27(++_0x5a0b44);}(_0xe914,0x178));var _0x4e91=function(_0x26f69f,_0x1bc94a){_0x26f69f=_0x26f69f-0x0;var _0x2cee15=_0xe914[_0x26f69f];return _0x2cee15;};'use strict';var multer=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var path=require(_0x4e91('0x2'));var timeout=require(_0x4e91('0x3'));var express=require(_0x4e91('0x4'));var router=express[_0x4e91('0x5')]();var fs_extra=require(_0x4e91('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4e91('0x7'));var config=require(_0x4e91('0x8'));var controller=require('./sound.controller');router[_0x4e91('0x9')]('/',auth[_0x4e91('0xa')](),controller['index']);router[_0x4e91('0x9')]('/:id',auth[_0x4e91('0xa')](),controller[_0x4e91('0xb')]);router[_0x4e91('0x9')](_0x4e91('0xc'),auth[_0x4e91('0xa')](),controller[_0x4e91('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4e679b,_0x173054,_0x49e0d3){_0x49e0d3(null,path['join'](config[_0x4e91('0xe')],'server/files/sounds/original/'));},'filename':function(_0x340f74,_0x4bf72d,_0x15b19a){_0x4bf72d['originalname']=_0x4bf72d[_0x4e91('0xf')][_0x4e91('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x15b19a(null,util[_0x4e91('0x11')]('%s-%s%s',path[_0x4e91('0x12')](_0x4bf72d[_0x4e91('0xf')],path[_0x4e91('0x13')](_0x4bf72d['originalname'])),Date[_0x4e91('0x14')](),path['extname'](_0x4bf72d['originalname'])));}})});router['post']('/',upload[_0x4e91('0x15')](_0x4e91('0x16')),controller[_0x4e91('0x17')]);router[_0x4e91('0x18')](_0x4e91('0x19'),auth[_0x4e91('0xa')](),controller[_0x4e91('0x1a')]);router['delete'](_0x4e91('0x19'),auth[_0x4e91('0xa')](),controller[_0x4e91('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index ccd7076..70a407c 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 _0x76e9=['STRING','FLOAT','BIGINT','INTEGER','sequelize','exports','name'];(function(_0x23d1af,_0x55bcc7){var _0x4856c3=function(_0xc6c63){while(--_0xc6c63){_0x23d1af['push'](_0x23d1af['shift']());}};_0x4856c3(++_0x55bcc7);}(_0x76e9,0xcf));var _0x976e=function(_0x350b0b,_0x4deb42){_0x350b0b=_0x350b0b-0x0;var _0x43c54c=_0x76e9[_0x350b0b];return _0x43c54c;};'use strict';var Sequelize=require(_0x976e('0x0'));module[_0x976e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x976e('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x976e('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x976e('0x3')]},'original_format':{'type':Sequelize[_0x976e('0x3')]},'original_duration':{'type':Sequelize[_0x976e('0x4')]},'original_sampleCount':{'type':Sequelize[_0x976e('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x976e('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x976e('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd96f=['STRING','BIGINT','INTEGER','exports','name'];(function(_0x4099b7,_0x5df398){var _0xcbef32=function(_0x54d8ae){while(--_0x54d8ae){_0x4099b7['push'](_0x4099b7['shift']());}};_0xcbef32(++_0x5df398);}(_0xd96f,0x99));var _0xfd96=function(_0x48b39c,_0x2eaadd){_0x48b39c=_0x48b39c-0x0;var _0x1c4876=_0xd96f[_0x48b39c];return _0x1c4876;};'use strict';var Sequelize=require('sequelize');module[_0xfd96('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xfd96('0x1'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xfd96('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xfd96('0x2')]},'original_format':{'type':Sequelize[_0xfd96('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xfd96('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xfd96('0x4')]},'converted_format':{'type':Sequelize[_0xfd96('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xfd96('0x4')]},'converted_bitRate':{'type':Sequelize[_0xfd96('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xfd96('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 11140e9..c3bffc6 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 _0xc3d3=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','Sounds','UserProfileResource','then','end','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','delete','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4104f7,_0x1f8e47){var _0x30c6d5=function(_0x54df95){while(--_0x54df95){_0x4104f7['push'](_0x4104f7['shift']());}};_0x30c6d5(++_0x1f8e47);}(_0xc3d3,0xf2));var _0x3c3d=function(_0x2691ea,_0x169283){_0x2691ea=_0x2691ea-0x0;var _0x5f4840=_0xc3d3[_0x2691ea];return _0x5f4840;};'use strict';var emlformat=require(_0x3c3d('0x0'));var rimraf=require(_0x3c3d('0x1'));var zipdir=require(_0x3c3d('0x2'));var jsonpatch=require(_0x3c3d('0x3'));var rp=require(_0x3c3d('0x4'));var moment=require('moment');var BPromise=require(_0x3c3d('0x5'));var Mustache=require(_0x3c3d('0x6'));var util=require('util');var path=require(_0x3c3d('0x7'));var sox=require(_0x3c3d('0x8'));var csv=require(_0x3c3d('0x9'));var ejs=require(_0x3c3d('0xa'));var fs=require('fs');var fs_extra=require(_0x3c3d('0xb'));var _=require(_0x3c3d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3c3d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3c3d('0x9'));var querystring=require(_0x3c3d('0xe'));var Papa=require(_0x3c3d('0xf'));var Redis=require(_0x3c3d('0x10'));var authService=require(_0x3c3d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3c3d('0x12'));var hardwareService=require(_0x3c3d('0x13'));var logger=require(_0x3c3d('0x14'))('api');var utils=require(_0x3c3d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3c3d('0x16'));var db=require(_0x3c3d('0x17'))['db'];function respondWithStatusCode(_0x22203a,_0x4eba4f){_0x4eba4f=_0x4eba4f||0xcc;return function(_0x43030c){if(_0x43030c){return _0x22203a[_0x3c3d('0x18')](_0x4eba4f);}return _0x22203a[_0x3c3d('0x19')](_0x4eba4f)['end']();};}function respondWithResult(_0x3d0724,_0x2033bd){_0x2033bd=_0x2033bd||0xc8;return function(_0xc5ebcb){if(_0xc5ebcb){return _0x3d0724[_0x3c3d('0x19')](_0x2033bd)[_0x3c3d('0x1a')](_0xc5ebcb);}};}function respondWithFilteredResult(_0x305f69,_0x232d8a){return function(_0x90429d){if(_0x90429d){var _0x3aefaa=typeof _0x232d8a[_0x3c3d('0x1b')]===_0x3c3d('0x1c')&&typeof _0x232d8a[_0x3c3d('0x1d')]===_0x3c3d('0x1c');var _0x11b0d6=_0x90429d[_0x3c3d('0x1e')];var _0xb6f37d=_0x3aefaa?0x0:_0x232d8a['offset'];var _0x42a0a9=_0x3aefaa?_0x90429d['count']:_0x232d8a[_0x3c3d('0x1b')]+_0x232d8a[_0x3c3d('0x1d')];var _0x3482e0;if(_0x42a0a9>=_0x11b0d6){_0x42a0a9=_0x11b0d6;_0x3482e0=0xc8;}else{_0x3482e0=0xce;}_0x305f69['status'](_0x3482e0);return _0x305f69[_0x3c3d('0x1f')](_0x3c3d('0x20'),_0xb6f37d+'-'+_0x42a0a9+'/'+_0x11b0d6)[_0x3c3d('0x1a')](_0x90429d);}return null;};}function patchUpdates(_0x36e5ac){return function(_0x4a9bff){try{jsonpatch[_0x3c3d('0x21')](_0x4a9bff,_0x36e5ac,!![]);}catch(_0x48e913){return BPromise[_0x3c3d('0x22')](_0x48e913);}return _0x4a9bff[_0x3c3d('0x23')]();};}function saveUpdates(_0x2aee5e,_0x4d4f63){return function(_0x5b37a4){if(_0x5b37a4){return _0x5b37a4[_0x3c3d('0x24')](_0x2aee5e)['then'](function(_0x48fbb0){return _0x48fbb0;});}return null;};}function removeEntity(_0x27653f,_0x1df780){return function(_0x58c2bb){if(_0x58c2bb){return _0x58c2bb['destroy']()['then'](function(){var _0x12cabf=_0x58c2bb['get']({'plain':!![]});var _0x17fe64=_0x3c3d('0x25');return db[_0x3c3d('0x26')]['destroy']({'where':{'type':_0x17fe64,'resourceId':_0x12cabf['id']}})[_0x3c3d('0x27')](function(){return _0x58c2bb;});})[_0x3c3d('0x27')](function(){_0x27653f['status'](0xcc)[_0x3c3d('0x28')]();});}};}function handleEntityNotFound(_0x363260,_0x332a5c){return function(_0x412c66){if(!_0x412c66){_0x363260['sendStatus'](0x194);}return _0x412c66;};}function handleError(_0x1d941d,_0xffa54e){_0xffa54e=_0xffa54e||0x1f4;return function(_0x234a2c){logger[_0x3c3d('0x29')](_0x234a2c[_0x3c3d('0x2a')]);if(_0x234a2c[_0x3c3d('0x2b')]){delete _0x234a2c['name'];}_0x1d941d[_0x3c3d('0x19')](_0xffa54e)[_0x3c3d('0x2c')](_0x234a2c);};}exports[_0x3c3d('0x2d')]=function(_0x19594b,_0x2c1ff2){var _0x1aa0bc={},_0x55d35b={},_0x50be39={'count':0x0,'rows':[]};var _0x188938=_[_0x3c3d('0x2e')](db[_0x3c3d('0x2f')][_0x3c3d('0x30')],function(_0x578b5c){return{'name':_0x578b5c[_0x3c3d('0x31')],'type':_0x578b5c[_0x3c3d('0x32')][_0x3c3d('0x33')]};});_0x55d35b['model']=_[_0x3c3d('0x2e')](_0x188938,_0x3c3d('0x2b'));_0x55d35b['query']=_[_0x3c3d('0x34')](_0x19594b[_0x3c3d('0x35')]);_0x55d35b['filters']=_[_0x3c3d('0x36')](_0x55d35b[_0x3c3d('0x37')],_0x55d35b[_0x3c3d('0x35')]);_0x1aa0bc['attributes']=_['intersection'](_0x55d35b['model'],qs['fields'](_0x19594b['query'][_0x3c3d('0x38')]));_0x1aa0bc[_0x3c3d('0x39')]=_0x1aa0bc[_0x3c3d('0x39')][_0x3c3d('0x3a')]?_0x1aa0bc[_0x3c3d('0x39')]:_0x55d35b['model'];if(!_0x19594b[_0x3c3d('0x35')][_0x3c3d('0x3b')](_0x3c3d('0x3c'))){_0x1aa0bc[_0x3c3d('0x1d')]=qs['limit'](_0x19594b[_0x3c3d('0x35')]['limit']);_0x1aa0bc[_0x3c3d('0x1b')]=qs[_0x3c3d('0x1b')](_0x19594b['query'][_0x3c3d('0x1b')]);}_0x1aa0bc[_0x3c3d('0x3d')]=qs[_0x3c3d('0x3e')](_0x19594b[_0x3c3d('0x35')][_0x3c3d('0x3e')]);_0x1aa0bc[_0x3c3d('0x3f')]=qs['filters'](_['pick'](_0x19594b[_0x3c3d('0x35')],_0x55d35b[_0x3c3d('0x40')]),_0x188938);if(_0x19594b[_0x3c3d('0x35')][_0x3c3d('0x41')]){_0x1aa0bc[_0x3c3d('0x3f')]=_[_0x3c3d('0x42')](_0x1aa0bc['where'],{'$or':_['map'](_0x188938,function(_0x59e902){if(_0x59e902[_0x3c3d('0x32')]!==_0x3c3d('0x43')){var _0x2deba5={};_0x2deba5[_0x59e902['name']]={'$like':'%'+_0x19594b[_0x3c3d('0x35')][_0x3c3d('0x41')]+'%'};return _0x2deba5;}})});}_0x1aa0bc=_['merge']({},_0x1aa0bc,_0x19594b[_0x3c3d('0x44')]);var _0x2e22eb={'where':_0x1aa0bc[_0x3c3d('0x3f')]};return db[_0x3c3d('0x2f')]['count'](_0x2e22eb)[_0x3c3d('0x27')](function(_0x220fa3){_0x50be39[_0x3c3d('0x1e')]=_0x220fa3;if(_0x19594b['query'][_0x3c3d('0x45')]){_0x1aa0bc[_0x3c3d('0x46')]=[{'all':!![]}];}return db[_0x3c3d('0x2f')][_0x3c3d('0x47')](_0x1aa0bc);})[_0x3c3d('0x27')](function(_0x29c818){_0x50be39[_0x3c3d('0x48')]=_0x29c818;return _0x50be39;})['then'](respondWithFilteredResult(_0x2c1ff2,_0x1aa0bc))[_0x3c3d('0x49')](handleError(_0x2c1ff2,null));};exports[_0x3c3d('0x4a')]=function(_0x4f206e,_0x525c5e){var _0x4ce5ec={'raw':!![],'where':{'id':_0x4f206e[_0x3c3d('0x4b')]['id']}},_0x448b49={};_0x448b49[_0x3c3d('0x37')]=_['keys'](db[_0x3c3d('0x2f')][_0x3c3d('0x30')]);_0x448b49['query']=_['keys'](_0x4f206e['query']);_0x448b49[_0x3c3d('0x40')]=_[_0x3c3d('0x36')](_0x448b49[_0x3c3d('0x37')],_0x448b49['query']);_0x4ce5ec[_0x3c3d('0x39')]=_['intersection'](_0x448b49[_0x3c3d('0x37')],qs['fields'](_0x4f206e[_0x3c3d('0x35')][_0x3c3d('0x38')]));_0x4ce5ec[_0x3c3d('0x39')]=_0x4ce5ec[_0x3c3d('0x39')]['length']?_0x4ce5ec[_0x3c3d('0x39')]:_0x448b49['model'];if(_0x4f206e[_0x3c3d('0x35')][_0x3c3d('0x45')]){_0x4ce5ec[_0x3c3d('0x46')]=[{'all':!![]}];}_0x4ce5ec=_[_0x3c3d('0x42')]({},_0x4ce5ec,_0x4f206e[_0x3c3d('0x44')]);return db[_0x3c3d('0x2f')][_0x3c3d('0x4c')](_0x4ce5ec)[_0x3c3d('0x27')](handleEntityNotFound(_0x525c5e,null))[_0x3c3d('0x27')](respondWithResult(_0x525c5e,null))[_0x3c3d('0x49')](handleError(_0x525c5e,null));};exports[_0x3c3d('0x4d')]=function(_0x1e004d,_0x541470,_0x392699){return db[_0x3c3d('0x2f')]['find']({'where':{'id':_0x1e004d[_0x3c3d('0x4b')]['id']},'attributes':[_0x3c3d('0x2b'),_0x3c3d('0x4e'),_0x3c3d('0x4f')],'raw':!![]})[_0x3c3d('0x27')](handleEntityNotFound(_0x541470,null))['then'](function(_0x55fbc0){if(_0x55fbc0){if(!fs[_0x3c3d('0x50')](path['join'](config[_0x3c3d('0x51')],_0x3c3d('0x52'),_0x55fbc0[_0x3c3d('0x4e')]+'.'+_0x55fbc0['converted_format']))){throw new db[(_0x3c3d('0x53'))][(_0x3c3d('0x54'))](_0x3c3d('0x55'));}return _0x541470['download'](path[_0x3c3d('0x56')](config[_0x3c3d('0x51')],'server/files/sounds/converted',util[_0x3c3d('0x57')]('%s.%s',_0x55fbc0['save_name'],_0x55fbc0['converted_format'])),util[_0x3c3d('0x57')](_0x3c3d('0x58'),_0x55fbc0['name'],_0x55fbc0[_0x3c3d('0x4f')]));}return null;})['catch'](handleError(_0x541470,null));};exports['create']=function(_0x5326cf,_0x32cb05,_0x479915){var _0x38db3e={'name':path[_0x3c3d('0x59')](_0x5326cf[_0x3c3d('0x5a')][_0x3c3d('0x5b')],path[_0x3c3d('0x5c')](_0x5326cf[_0x3c3d('0x5a')][_0x3c3d('0x5b')])),'save_name':path[_0x3c3d('0x59')](_0x5326cf[_0x3c3d('0x5a')][_0x3c3d('0x5d')],path['extname'](_0x5326cf[_0x3c3d('0x5a')][_0x3c3d('0x5d')])),'original_format':path[_0x3c3d('0x5c')](_0x5326cf[_0x3c3d('0x5a')][_0x3c3d('0x5b')])[_0x3c3d('0x5e')](0x1),'converted_format':_0x3c3d('0x5f')};var _0x2ec787=path[_0x3c3d('0x56')](config[_0x3c3d('0x51')],_0x3c3d('0x60'),_0x5326cf[_0x3c3d('0x5a')][_0x3c3d('0x5d')]);var _0x4b9419=path[_0x3c3d('0x56')](config['root'],_0x3c3d('0x52'),util[_0x3c3d('0x57')](_0x3c3d('0x58'),path['basename'](_0x5326cf[_0x3c3d('0x5a')][_0x3c3d('0x5d')],path[_0x3c3d('0x5c')](_0x5326cf[_0x3c3d('0x5a')][_0x3c3d('0x5d')])),_0x38db3e['converted_format']));logger[_0x3c3d('0x61')]('Sound\x20upload\x20filepath:\x20%s',_0x2ec787);logger[_0x3c3d('0x61')](_0x3c3d('0x62'),_0x4b9419);try{fs[_0x3c3d('0x63')](_0x2ec787,parseInt(_0x3c3d('0x64'),0x8));var _0x47cab5=sox['transcode'](_0x2ec787,_0x4b9419,{'sampleRate':0x1f40,'format':_0x3c3d('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x47cab5['on'](_0x3c3d('0x29'),function(_0x4788bd){fs[_0x3c3d('0x65')](_0x2ec787);_0x32cb05['status'](0x1f4)[_0x3c3d('0x2c')](_0x4788bd);});_0x47cab5['on'](_0x3c3d('0x66'),function(_0x1dba5a){_0x38db3e[_0x3c3d('0x67')]=isNaN(_0x1dba5a['duration'])?null:_0x1dba5a[_0x3c3d('0x68')]*0x3e8;_0x38db3e[_0x3c3d('0x69')]=isNaN(_0x1dba5a[_0x3c3d('0x6a')])?null:_0x1dba5a[_0x3c3d('0x6a')];_0x38db3e['original_channelCount']=isNaN(_0x1dba5a[_0x3c3d('0x6b')])?null:_0x1dba5a[_0x3c3d('0x6b')];_0x38db3e[_0x3c3d('0x6c')]=isNaN(_0x1dba5a[_0x3c3d('0x6d')])?null:_0x1dba5a[_0x3c3d('0x6d')];_0x38db3e[_0x3c3d('0x6e')]=isNaN(_0x1dba5a[_0x3c3d('0x6f')])?null:_0x1dba5a[_0x3c3d('0x6f')];});_0x47cab5['on'](_0x3c3d('0x70'),function(_0x4d3335){_0x38db3e[_0x3c3d('0x71')]=isNaN(_0x4d3335['duration'])?null:_0x4d3335['duration']*0x3e8;_0x38db3e['converted_sampleCount']=isNaN(_0x4d3335[_0x3c3d('0x6a')])?null:_0x4d3335[_0x3c3d('0x6a')];_0x38db3e[_0x3c3d('0x72')]=isNaN(_0x4d3335[_0x3c3d('0x6b')])?null:_0x4d3335['channelCount'];_0x38db3e[_0x3c3d('0x73')]=isNaN(_0x4d3335[_0x3c3d('0x6d')])?null:_0x4d3335[_0x3c3d('0x6d')];_0x38db3e[_0x3c3d('0x74')]=isNaN(_0x4d3335[_0x3c3d('0x6f')])?null:_0x4d3335[_0x3c3d('0x6f')];});_0x47cab5['on']('end',function(){fs[_0x3c3d('0x63')](_0x4b9419,parseInt('0777',0x8));return db[_0x3c3d('0x2f')][_0x3c3d('0x75')](_0x38db3e)[_0x3c3d('0x27')](function(_0x2ca13a){var _0x336520={'role':_0x5326cf[_0x3c3d('0x76')][_0x3c3d('0x77')],'userProfileId':_0x5326cf['body'][_0x3c3d('0x78')]};if(!_0x336520)throw new Error(_0x3c3d('0x79'));if(_0x336520[_0x3c3d('0x77')]===_0x3c3d('0x7a')){var _0x2d39ce=_0x2ca13a[_0x3c3d('0x7b')]({'plain':!![]});return db[_0x3c3d('0x7c')]['find']({'where':{'name':_0x3c3d('0x25'),'userProfileId':_0x336520[_0x3c3d('0x78')]},'raw':!![]})[_0x3c3d('0x27')](function(_0x3c903f){if(_0x3c903f&&_0x3c903f['autoAssociation']===0x0){return db[_0x3c3d('0x26')]['create']({'name':_0x2d39ce[_0x3c3d('0x2b')],'resourceId':_0x2d39ce['id'],'type':_0x3c903f[_0x3c3d('0x2b')],'sectionId':_0x3c903f['id']},{})['then'](function(){return _0x2ca13a;});}else{return _0x2ca13a;}})[_0x3c3d('0x49')](function(_0x1555ce){logger[_0x3c3d('0x29')](_0x3c3d('0x7d'),_0x1555ce);throw _0x1555ce;});}return _0x2ca13a;})[_0x3c3d('0x27')](respondWithResult(_0x32cb05,null))['catch'](handleError(_0x32cb05,null));});_0x47cab5['start']();}catch(_0x55a6a6){_0x32cb05[_0x3c3d('0x19')](0x1f4)[_0x3c3d('0x2c')](_0x55a6a6);}};exports[_0x3c3d('0x24')]=function(_0x2bd99e,_0x3a6972,_0x5a1653){return db[_0x3c3d('0x2f')][_0x3c3d('0x4c')]({'where':{'id':_0x2bd99e[_0x3c3d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a6972,null))['then'](saveUpdates(_[_0x3c3d('0x7e')](_0x2bd99e['body'],[_0x3c3d('0x2b'),_0x3c3d('0x7f')]),null))[_0x3c3d('0x27')](respondWithResult(_0x3a6972,null))['catch'](handleError(_0x3a6972,null));};exports[_0x3c3d('0x80')]=function(_0x28977c,_0x4bd9ed,_0x3bdd9b){return db[_0x3c3d('0x2f')][_0x3c3d('0x4c')]({'where':{'id':_0x28977c[_0x3c3d('0x4b')]['id']}})[_0x3c3d('0x27')](function(_0x512e00){if(_0x512e00){return _0x512e00[_0x3c3d('0x81')]();}})[_0x3c3d('0x27')](function(_0x217cb6){var _0x49dad7=path[_0x3c3d('0x56')](config[_0x3c3d('0x51')],_0x3c3d('0x60'),util['format']('%s.%s',_0x217cb6[_0x3c3d('0x4e')],_0x217cb6['original_format']));var _0x1350c7=path[_0x3c3d('0x56')](config['root'],'server/files/sounds/converted',util[_0x3c3d('0x57')](_0x3c3d('0x58'),_0x217cb6[_0x3c3d('0x4e')],_0x217cb6[_0x3c3d('0x4f')]));fs[_0x3c3d('0x65')](_0x49dad7);fs[_0x3c3d('0x65')](_0x1350c7);return _0x217cb6;})[_0x3c3d('0x27')](function(_0x167c67){if(_0x167c67){return _0x4bd9ed[_0x3c3d('0x19')](0xcc)[_0x3c3d('0x28')]();}})[_0x3c3d('0x27')](handleEntityNotFound(_0x4bd9ed,null))[_0x3c3d('0x49')](handleError(_0x4bd9ed,null));}; \ No newline at end of file +var _0x9f61=['api','../../config/utils','../../config/environment','end','status','json','offset','count','Content-Range','apply','reject','save','update','then','Sounds','UserProfileResource','destroy','sendStatus','name','send','map','Sound','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','model','find','download','save_name','converted_format','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','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','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x521c5e,_0x2a6621){var _0x582e3f=function(_0x370867){while(--_0x370867){_0x521c5e['push'](_0x521c5e['shift']());}};_0x582e3f(++_0x2a6621);}(_0x9f61,0x67));var _0x19f6=function(_0x47b008,_0x4032ea){_0x47b008=_0x47b008-0x0;var _0x4e7359=_0x9f61[_0x47b008];return _0x4e7359;};'use strict';var emlformat=require(_0x19f6('0x0'));var rimraf=require(_0x19f6('0x1'));var zipdir=require(_0x19f6('0x2'));var jsonpatch=require(_0x19f6('0x3'));var rp=require(_0x19f6('0x4'));var moment=require('moment');var BPromise=require(_0x19f6('0x5'));var Mustache=require(_0x19f6('0x6'));var util=require(_0x19f6('0x7'));var path=require(_0x19f6('0x8'));var sox=require('sox');var csv=require(_0x19f6('0x9'));var ejs=require(_0x19f6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x19f6('0xb'));var crypto=require(_0x19f6('0xc'));var jsforce=require(_0x19f6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x19f6('0x9'));var querystring=require(_0x19f6('0xe'));var Papa=require(_0x19f6('0xf'));var Redis=require(_0x19f6('0x10'));var authService=require(_0x19f6('0x11'));var qs=require(_0x19f6('0x12'));var as=require(_0x19f6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x19f6('0x14'))(_0x19f6('0x15'));var utils=require(_0x19f6('0x16'));var config=require(_0x19f6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1339b4,_0xbd9208){_0xbd9208=_0xbd9208||0xcc;return function(_0x17a63f){if(_0x17a63f){return _0x1339b4['sendStatus'](_0xbd9208);}return _0x1339b4['status'](_0xbd9208)[_0x19f6('0x18')]();};}function respondWithResult(_0x4fa938,_0x2e51e8){_0x2e51e8=_0x2e51e8||0xc8;return function(_0x5ef68e){if(_0x5ef68e){return _0x4fa938[_0x19f6('0x19')](_0x2e51e8)[_0x19f6('0x1a')](_0x5ef68e);}};}function respondWithFilteredResult(_0x476df4,_0x3024d7){return function(_0x314e2c){if(_0x314e2c){var _0x7b679e=typeof _0x3024d7[_0x19f6('0x1b')]==='undefined'&&typeof _0x3024d7['limit']==='undefined';var _0x486f86=_0x314e2c[_0x19f6('0x1c')];var _0x190667=_0x7b679e?0x0:_0x3024d7[_0x19f6('0x1b')];var _0x2565e8=_0x7b679e?_0x314e2c[_0x19f6('0x1c')]:_0x3024d7['offset']+_0x3024d7['limit'];var _0x46e864;if(_0x2565e8>=_0x486f86){_0x2565e8=_0x486f86;_0x46e864=0xc8;}else{_0x46e864=0xce;}_0x476df4[_0x19f6('0x19')](_0x46e864);return _0x476df4['set'](_0x19f6('0x1d'),_0x190667+'-'+_0x2565e8+'/'+_0x486f86)[_0x19f6('0x1a')](_0x314e2c);}return null;};}function patchUpdates(_0x3d2a25){return function(_0x25ce2c){try{jsonpatch[_0x19f6('0x1e')](_0x25ce2c,_0x3d2a25,!![]);}catch(_0x4acf50){return BPromise[_0x19f6('0x1f')](_0x4acf50);}return _0x25ce2c[_0x19f6('0x20')]();};}function saveUpdates(_0x29c8c1,_0x263ee2){return function(_0x48ca44){if(_0x48ca44){return _0x48ca44[_0x19f6('0x21')](_0x29c8c1)[_0x19f6('0x22')](function(_0x3ddfc4){return _0x3ddfc4;});}return null;};}function removeEntity(_0x28beb1,_0x5b257a){return function(_0x31715c){if(_0x31715c){return _0x31715c['destroy']()[_0x19f6('0x22')](function(){var _0x19f155=_0x31715c['get']({'plain':!![]});var _0x5c1052=_0x19f6('0x23');return db[_0x19f6('0x24')][_0x19f6('0x25')]({'where':{'type':_0x5c1052,'resourceId':_0x19f155['id']}})['then'](function(){return _0x31715c;});})[_0x19f6('0x22')](function(){_0x28beb1[_0x19f6('0x19')](0xcc)[_0x19f6('0x18')]();});}};}function handleEntityNotFound(_0x195369,_0x3ef1ae){return function(_0x50cfdc){if(!_0x50cfdc){_0x195369[_0x19f6('0x26')](0x194);}return _0x50cfdc;};}function handleError(_0x2c4369,_0x1e552a){_0x1e552a=_0x1e552a||0x1f4;return function(_0x5a35bf){logger['error'](_0x5a35bf['stack']);if(_0x5a35bf[_0x19f6('0x27')]){delete _0x5a35bf[_0x19f6('0x27')];}_0x2c4369[_0x19f6('0x19')](_0x1e552a)[_0x19f6('0x28')](_0x5a35bf);};}exports['index']=function(_0x13132a,_0x332b3c){var _0x2f0ca0={},_0x2e6d33={},_0x4825d8={'count':0x0,'rows':[]};var _0x2a72f2=_[_0x19f6('0x29')](db[_0x19f6('0x2a')][_0x19f6('0x2b')],function(_0x1a910d){return{'name':_0x1a910d[_0x19f6('0x2c')],'type':_0x1a910d['type'][_0x19f6('0x2d')]};});_0x2e6d33['model']=_[_0x19f6('0x29')](_0x2a72f2,_0x19f6('0x27'));_0x2e6d33[_0x19f6('0x2e')]=_[_0x19f6('0x2f')](_0x13132a[_0x19f6('0x2e')]);_0x2e6d33[_0x19f6('0x30')]=_[_0x19f6('0x31')](_0x2e6d33['model'],_0x2e6d33[_0x19f6('0x2e')]);_0x2f0ca0[_0x19f6('0x32')]=_[_0x19f6('0x31')](_0x2e6d33['model'],qs[_0x19f6('0x33')](_0x13132a[_0x19f6('0x2e')][_0x19f6('0x33')]));_0x2f0ca0[_0x19f6('0x32')]=_0x2f0ca0[_0x19f6('0x32')][_0x19f6('0x34')]?_0x2f0ca0[_0x19f6('0x32')]:_0x2e6d33['model'];if(!_0x13132a[_0x19f6('0x2e')][_0x19f6('0x35')]('nolimit')){_0x2f0ca0[_0x19f6('0x36')]=qs[_0x19f6('0x36')](_0x13132a[_0x19f6('0x2e')][_0x19f6('0x36')]);_0x2f0ca0[_0x19f6('0x1b')]=qs[_0x19f6('0x1b')](_0x13132a['query'][_0x19f6('0x1b')]);}_0x2f0ca0[_0x19f6('0x37')]=qs[_0x19f6('0x38')](_0x13132a['query'][_0x19f6('0x38')]);_0x2f0ca0[_0x19f6('0x39')]=qs['filters'](_[_0x19f6('0x3a')](_0x13132a['query'],_0x2e6d33[_0x19f6('0x30')]),_0x2a72f2);if(_0x13132a[_0x19f6('0x2e')][_0x19f6('0x3b')]){_0x2f0ca0[_0x19f6('0x39')]=_[_0x19f6('0x3c')](_0x2f0ca0[_0x19f6('0x39')],{'$or':_[_0x19f6('0x29')](_0x2a72f2,function(_0x398be5){if(_0x398be5[_0x19f6('0x3d')]!==_0x19f6('0x3e')){var _0x3267a0={};_0x3267a0[_0x398be5['name']]={'$like':'%'+_0x13132a[_0x19f6('0x2e')][_0x19f6('0x3b')]+'%'};return _0x3267a0;}})});}_0x2f0ca0=_[_0x19f6('0x3c')]({},_0x2f0ca0,_0x13132a[_0x19f6('0x3f')]);var _0x2a9779={'where':_0x2f0ca0[_0x19f6('0x39')]};return db['Sound'][_0x19f6('0x1c')](_0x2a9779)[_0x19f6('0x22')](function(_0x55acdb){_0x4825d8[_0x19f6('0x1c')]=_0x55acdb;if(_0x13132a[_0x19f6('0x2e')][_0x19f6('0x40')]){_0x2f0ca0['include']=[{'all':!![]}];}return db[_0x19f6('0x2a')]['findAll'](_0x2f0ca0);})['then'](function(_0x1f5519){_0x4825d8['rows']=_0x1f5519;return _0x4825d8;})[_0x19f6('0x22')](respondWithFilteredResult(_0x332b3c,_0x2f0ca0))[_0x19f6('0x41')](handleError(_0x332b3c,null));};exports[_0x19f6('0x42')]=function(_0x463fcf,_0x495950){var _0x54c180={'raw':!![],'where':{'id':_0x463fcf[_0x19f6('0x43')]['id']}},_0x5edcdc={};_0x5edcdc[_0x19f6('0x44')]=_[_0x19f6('0x2f')](db[_0x19f6('0x2a')]['rawAttributes']);_0x5edcdc[_0x19f6('0x2e')]=_[_0x19f6('0x2f')](_0x463fcf[_0x19f6('0x2e')]);_0x5edcdc[_0x19f6('0x30')]=_[_0x19f6('0x31')](_0x5edcdc['model'],_0x5edcdc[_0x19f6('0x2e')]);_0x54c180[_0x19f6('0x32')]=_['intersection'](_0x5edcdc[_0x19f6('0x44')],qs[_0x19f6('0x33')](_0x463fcf[_0x19f6('0x2e')]['fields']));_0x54c180[_0x19f6('0x32')]=_0x54c180[_0x19f6('0x32')]['length']?_0x54c180[_0x19f6('0x32')]:_0x5edcdc[_0x19f6('0x44')];if(_0x463fcf[_0x19f6('0x2e')][_0x19f6('0x40')]){_0x54c180['include']=[{'all':!![]}];}_0x54c180=_[_0x19f6('0x3c')]({},_0x54c180,_0x463fcf[_0x19f6('0x3f')]);return db[_0x19f6('0x2a')][_0x19f6('0x45')](_0x54c180)['then'](handleEntityNotFound(_0x495950,null))[_0x19f6('0x22')](respondWithResult(_0x495950,null))[_0x19f6('0x41')](handleError(_0x495950,null));};exports[_0x19f6('0x46')]=function(_0x5398a6,_0x4d028c,_0x17e7fa){return db['Sound']['find']({'where':{'id':_0x5398a6[_0x19f6('0x43')]['id']},'attributes':[_0x19f6('0x27'),_0x19f6('0x47'),_0x19f6('0x48')],'raw':!![]})[_0x19f6('0x22')](handleEntityNotFound(_0x4d028c,null))[_0x19f6('0x22')](function(_0x43443d){if(_0x43443d){if(!fs['existsSync'](path[_0x19f6('0x49')](config[_0x19f6('0x4a')],_0x19f6('0x4b'),_0x43443d[_0x19f6('0x47')]+'.'+_0x43443d['converted_format']))){throw new db['Sequelize'][(_0x19f6('0x4c'))](_0x19f6('0x4d'));}return _0x4d028c[_0x19f6('0x46')](path['join'](config[_0x19f6('0x4a')],_0x19f6('0x4b'),util[_0x19f6('0x4e')](_0x19f6('0x4f'),_0x43443d[_0x19f6('0x47')],_0x43443d[_0x19f6('0x48')])),util[_0x19f6('0x4e')]('%s.%s',_0x43443d[_0x19f6('0x27')],_0x43443d['converted_format']));}return null;})['catch'](handleError(_0x4d028c,null));};exports[_0x19f6('0x50')]=function(_0x2f00be,_0x26083f,_0x545cea){var _0x2a5d1d={'name':path[_0x19f6('0x51')](_0x2f00be[_0x19f6('0x52')][_0x19f6('0x53')],path[_0x19f6('0x54')](_0x2f00be[_0x19f6('0x52')][_0x19f6('0x53')])),'save_name':path[_0x19f6('0x51')](_0x2f00be[_0x19f6('0x52')][_0x19f6('0x55')],path[_0x19f6('0x54')](_0x2f00be[_0x19f6('0x52')][_0x19f6('0x55')])),'original_format':path[_0x19f6('0x54')](_0x2f00be[_0x19f6('0x52')][_0x19f6('0x53')])['substring'](0x1),'converted_format':_0x19f6('0x56')};var _0x50427c=path['join'](config[_0x19f6('0x4a')],_0x19f6('0x57'),_0x2f00be[_0x19f6('0x52')][_0x19f6('0x55')]);var _0x41f4f3=path[_0x19f6('0x49')](config[_0x19f6('0x4a')],_0x19f6('0x4b'),util[_0x19f6('0x4e')](_0x19f6('0x4f'),path[_0x19f6('0x51')](_0x2f00be[_0x19f6('0x52')][_0x19f6('0x55')],path[_0x19f6('0x54')](_0x2f00be[_0x19f6('0x52')]['filename'])),_0x2a5d1d[_0x19f6('0x48')]));logger[_0x19f6('0x58')](_0x19f6('0x59'),_0x50427c);logger[_0x19f6('0x58')](_0x19f6('0x5a'),_0x41f4f3);try{fs['chmodSync'](_0x50427c,parseInt('0777',0x8));var _0x14f1ea=sox[_0x19f6('0x5b')](_0x50427c,_0x41f4f3,{'sampleRate':0x1f40,'format':_0x19f6('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x14f1ea['on'](_0x19f6('0x5c'),function(_0x4b247b){fs[_0x19f6('0x5d')](_0x50427c);_0x26083f[_0x19f6('0x19')](0x1f4)[_0x19f6('0x28')](_0x4b247b);});_0x14f1ea['on'](_0x19f6('0x5e'),function(_0x566375){_0x2a5d1d[_0x19f6('0x5f')]=isNaN(_0x566375[_0x19f6('0x60')])?null:_0x566375[_0x19f6('0x60')]*0x3e8;_0x2a5d1d[_0x19f6('0x61')]=isNaN(_0x566375[_0x19f6('0x62')])?null:_0x566375[_0x19f6('0x62')];_0x2a5d1d['original_channelCount']=isNaN(_0x566375[_0x19f6('0x63')])?null:_0x566375[_0x19f6('0x63')];_0x2a5d1d[_0x19f6('0x64')]=isNaN(_0x566375[_0x19f6('0x65')])?null:_0x566375['bitRate'];_0x2a5d1d[_0x19f6('0x66')]=isNaN(_0x566375[_0x19f6('0x67')])?null:_0x566375['sampleRate'];});_0x14f1ea['on'](_0x19f6('0x68'),function(_0x18f1f4){_0x2a5d1d[_0x19f6('0x69')]=isNaN(_0x18f1f4[_0x19f6('0x60')])?null:_0x18f1f4[_0x19f6('0x60')]*0x3e8;_0x2a5d1d[_0x19f6('0x6a')]=isNaN(_0x18f1f4[_0x19f6('0x62')])?null:_0x18f1f4[_0x19f6('0x62')];_0x2a5d1d[_0x19f6('0x6b')]=isNaN(_0x18f1f4[_0x19f6('0x63')])?null:_0x18f1f4['channelCount'];_0x2a5d1d[_0x19f6('0x6c')]=isNaN(_0x18f1f4['bitRate'])?null:_0x18f1f4[_0x19f6('0x65')];_0x2a5d1d[_0x19f6('0x6d')]=isNaN(_0x18f1f4[_0x19f6('0x67')])?null:_0x18f1f4[_0x19f6('0x67')];});_0x14f1ea['on']('end',function(){fs['chmodSync'](_0x41f4f3,parseInt(_0x19f6('0x6e'),0x8));return db['Sound']['create'](_0x2a5d1d)[_0x19f6('0x22')](function(_0x490fc4){var _0x4b9da6={'role':_0x2f00be[_0x19f6('0x6f')][_0x19f6('0x70')],'userProfileId':_0x2f00be['body'][_0x19f6('0x71')]};if(!_0x4b9da6)throw new Error(_0x19f6('0x72'));if(_0x4b9da6[_0x19f6('0x70')]===_0x19f6('0x73')){var _0x5a2f6a=_0x490fc4[_0x19f6('0x74')]({'plain':!![]});return db[_0x19f6('0x75')][_0x19f6('0x45')]({'where':{'name':_0x19f6('0x23'),'userProfileId':_0x4b9da6[_0x19f6('0x71')]},'raw':!![]})[_0x19f6('0x22')](function(_0x4b2570){if(_0x4b2570&&_0x4b2570[_0x19f6('0x76')]===0x0){return db[_0x19f6('0x24')][_0x19f6('0x50')]({'name':_0x5a2f6a[_0x19f6('0x27')],'resourceId':_0x5a2f6a['id'],'type':_0x4b2570[_0x19f6('0x27')],'sectionId':_0x4b2570['id']},{})['then'](function(){return _0x490fc4;});}else{return _0x490fc4;}})[_0x19f6('0x41')](function(_0xd6b924){logger[_0x19f6('0x5c')](_0x19f6('0x77'),_0xd6b924);throw _0xd6b924;});}return _0x490fc4;})[_0x19f6('0x22')](respondWithResult(_0x26083f,null))[_0x19f6('0x41')](handleError(_0x26083f,null));});_0x14f1ea[_0x19f6('0x78')]();}catch(_0x2b2d57){_0x26083f[_0x19f6('0x19')](0x1f4)[_0x19f6('0x28')](_0x2b2d57);}};exports['update']=function(_0x564bfd,_0x5253ed,_0x13ae48){return db[_0x19f6('0x2a')][_0x19f6('0x45')]({'where':{'id':_0x564bfd['params']['id']}})[_0x19f6('0x22')](handleEntityNotFound(_0x5253ed,null))['then'](saveUpdates(_[_0x19f6('0x3a')](_0x564bfd[_0x19f6('0x6f')],[_0x19f6('0x27'),_0x19f6('0x79')]),null))[_0x19f6('0x22')](respondWithResult(_0x5253ed,null))[_0x19f6('0x41')](handleError(_0x5253ed,null));};exports[_0x19f6('0x7a')]=function(_0x3522d0,_0x3c9cee,_0x2740cd){return db['Sound']['find']({'where':{'id':_0x3522d0[_0x19f6('0x43')]['id']}})[_0x19f6('0x22')](function(_0xf112c){if(_0xf112c){return _0xf112c['destroy']();}})[_0x19f6('0x22')](function(_0x5a2431){var _0x94ad80=path['join'](config[_0x19f6('0x4a')],'server/files/sounds/original',util[_0x19f6('0x4e')]('%s.%s',_0x5a2431[_0x19f6('0x47')],_0x5a2431[_0x19f6('0x7b')]));var _0x357fd8=path['join'](config[_0x19f6('0x4a')],_0x19f6('0x4b'),util['format'](_0x19f6('0x4f'),_0x5a2431[_0x19f6('0x47')],_0x5a2431['converted_format']));fs[_0x19f6('0x5d')](_0x94ad80);fs['unlinkSync'](_0x357fd8);return _0x5a2431;})[_0x19f6('0x22')](function(_0x169121){if(_0x169121){return _0x3c9cee[_0x19f6('0x19')](0xcc)['end']();}})[_0x19f6('0x22')](handleEntityNotFound(_0x3c9cee,null))[_0x19f6('0x41')](handleError(_0x3c9cee,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a45a933..c6fe723 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 _0xe6c8=['define','tools_sounds','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0xe6c8,0xe9));var _0x8e6c=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xe6c8[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x8e6c('0x0'));var util=require(_0x8e6c('0x1'));var logger=require(_0x8e6c('0x2'))('api');var moment=require(_0x8e6c('0x3'));var BPromise=require(_0x8e6c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e6c('0x5'));var rimraf=require(_0x8e6c('0x6'));var config=require(_0x8e6c('0x7'));var attributes=require('./sound.attributes');module[_0x8e6c('0x8')]=function(_0x40f9d4,_0x3b6bc5){return _0x40f9d4[_0x8e6c('0x9')]('Sound',attributes,{'tableName':_0x8e6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x615e=['exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./sound.attributes'];(function(_0x1cc0bc,_0x1aca38){var _0x4e8a5f=function(_0x125592){while(--_0x125592){_0x1cc0bc['push'](_0x1cc0bc['shift']());}};_0x4e8a5f(++_0x1aca38);}(_0x615e,0x1b1));var _0xe615=function(_0x247652,_0x47ba86){_0x247652=_0x247652-0x0;var _0x28a0f0=_0x615e[_0x247652];return _0x28a0f0;};'use strict';var _=require(_0xe615('0x0'));var util=require(_0xe615('0x1'));var logger=require(_0xe615('0x2'))(_0xe615('0x3'));var moment=require(_0xe615('0x4'));var BPromise=require(_0xe615('0x5'));var rp=require(_0xe615('0x6'));var fs=require('fs');var path=require(_0xe615('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe615('0x8'));module[_0xe615('0x9')]=function(_0xe104ed,_0x592cfa){return _0xe104ed[_0xe615('0xa')](_0xe615('0xb'),attributes,{'tableName':_0xe615('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index b32c9d8..454f964 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 _0x5513=['util','moment','bluebird','randomstring','ioredis','rpc','client','http','request','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','ShowSound','find','options','raw','where','attributes','include','map','model','then','lodash'];(function(_0x3217f8,_0x4ecd2f){var _0x3804ba=function(_0x33bb79){while(--_0x33bb79){_0x3217f8['push'](_0x3217f8['shift']());}};_0x3804ba(++_0x4ecd2f);}(_0x5513,0x195));var _0x3551=function(_0x4df85c,_0x248dfb){_0x4df85c=_0x4df85c-0x0;var _0x4e2a61=_0x5513[_0x4df85c];return _0x4e2a61;};'use strict';var _=require(_0x3551('0x0'));var util=require(_0x3551('0x1'));var moment=require(_0x3551('0x2'));var BPromise=require(_0x3551('0x3'));var rs=require(_0x3551('0x4'));var fs=require('fs');var Redis=require(_0x3551('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3551('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3551('0x7')][_0x3551('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdbced9,_0x4a5157,_0x539486){return new BPromise(function(_0x3e4d65,_0x54d152){return client[_0x3551('0x9')](_0xdbced9,_0x539486)['then'](function(_0x24bc89){logger['info'](_0x3551('0xa'),_0x4a5157,'request\x20sent');logger['debug'](_0x3551('0xb'),_0x4a5157,_0x3551('0xc'),JSON['stringify'](_0x24bc89));if(_0x24bc89[_0x3551('0xd')]){if(_0x24bc89[_0x3551('0xd')][_0x3551('0xe')]===0x1f4){logger[_0x3551('0xd')]('Sound,\x20%s,\x20%s',_0x4a5157,_0x24bc89[_0x3551('0xd')][_0x3551('0xf')]);return _0x54d152(_0x24bc89[_0x3551('0xd')]['message']);}logger[_0x3551('0xd')](_0x3551('0xa'),_0x4a5157,_0x24bc89[_0x3551('0xd')][_0x3551('0xf')]);return _0x3e4d65(_0x24bc89[_0x3551('0xd')]['message']);}else{logger[_0x3551('0x10')](_0x3551('0xa'),_0x4a5157,_0x3551('0xc'));_0x3e4d65(_0x24bc89[_0x3551('0x11')][_0x3551('0xf')]);}})[_0x3551('0x12')](function(_0x2715dc){logger[_0x3551('0xd')]('Sound,\x20%s,\x20%s',_0x4a5157,_0x2715dc);_0x54d152(_0x2715dc);});});}exports[_0x3551('0x13')]=function(_0x199027){var _0x1e69b2=this;return new Promise(function(_0x4bdcba,_0x45b06b){return db['Sound'][_0x3551('0x14')]({'raw':_0x199027[_0x3551('0x15')]?_0x199027[_0x3551('0x15')][_0x3551('0x16')]===undefined?!![]:![]:!![],'where':_0x199027[_0x3551('0x15')]?_0x199027[_0x3551('0x15')][_0x3551('0x17')]||null:null,'attributes':_0x199027[_0x3551('0x15')]?_0x199027[_0x3551('0x15')][_0x3551('0x18')]||null:null,'include':_0x199027[_0x3551('0x15')]?_0x199027['options'][_0x3551('0x19')]?_[_0x3551('0x1a')](_0x199027['options'][_0x3551('0x19')],function(_0x42cdbf){return{'model':db[_0x42cdbf['model']],'as':_0x42cdbf['as'],'attributes':_0x42cdbf[_0x3551('0x18')],'include':_0x42cdbf[_0x3551('0x19')]?_['map'](_0x42cdbf['include'],function(_0x2d42cb){return{'model':db[_0x2d42cb['model']],'as':_0x2d42cb['as'],'attributes':_0x2d42cb[_0x3551('0x18')],'include':_0x2d42cb[_0x3551('0x19')]?_[_0x3551('0x1a')](_0x2d42cb[_0x3551('0x19')],function(_0x176043){return{'model':db[_0x176043[_0x3551('0x1b')]],'as':_0x176043['as'],'attributes':_0x176043['attributes']};}):[]};}):[]};}):[]:[]})[_0x3551('0x1c')](function(_0x2da811){logger[_0x3551('0x10')](_0x3551('0x13'),_0x199027);logger['debug'](_0x3551('0x13'),_0x199027,JSON['stringify'](_0x2da811));_0x4bdcba(_0x2da811);})[_0x3551('0x12')](function(_0x1ff518){logger[_0x3551('0xd')](_0x3551('0x13'),_0x1ff518[_0x3551('0xf')],_0x199027);_0x45b06b(_0x1e69b2[_0x3551('0xd')](0x1f4,_0x1ff518[_0x3551('0xf')]));});});}; \ No newline at end of file +var _0xd5b2=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSound','Sound','find','options','raw','attributes','include','map','model'];(function(_0x3d6e68,_0x455d10){var _0x51f6e4=function(_0x1d067c){while(--_0x1d067c){_0x3d6e68['push'](_0x3d6e68['shift']());}};_0x51f6e4(++_0x455d10);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd5b2[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x2d5b('0x0'));var moment=require(_0x2d5b('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d5b('0x2'));var fs=require('fs');var Redis=require(_0x2d5b('0x3'));var db=require(_0x2d5b('0x4'))['db'];var utils=require(_0x2d5b('0x5'));var logger=require(_0x2d5b('0x6'))(_0x2d5b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e2a74,_0x394645,_0x4c7873){return new BPromise(function(_0x1c2150,_0x5baf74){return client[_0x2d5b('0x9')](_0x5e2a74,_0x4c7873)[_0x2d5b('0xa')](function(_0x362c09){logger[_0x2d5b('0xb')](_0x2d5b('0xc'),_0x394645,_0x2d5b('0xd'));logger[_0x2d5b('0xe')](_0x2d5b('0xf'),_0x394645,_0x2d5b('0xd'),JSON[_0x2d5b('0x10')](_0x362c09));if(_0x362c09[_0x2d5b('0x11')]){if(_0x362c09[_0x2d5b('0x11')][_0x2d5b('0x12')]===0x1f4){logger[_0x2d5b('0x11')]('Sound,\x20%s,\x20%s',_0x394645,_0x362c09['error'][_0x2d5b('0x13')]);return _0x5baf74(_0x362c09[_0x2d5b('0x11')][_0x2d5b('0x13')]);}logger[_0x2d5b('0x11')](_0x2d5b('0xc'),_0x394645,_0x362c09[_0x2d5b('0x11')]['message']);return _0x1c2150(_0x362c09[_0x2d5b('0x11')]['message']);}else{logger[_0x2d5b('0xb')](_0x2d5b('0xc'),_0x394645,'request\x20sent');_0x1c2150(_0x362c09[_0x2d5b('0x14')][_0x2d5b('0x13')]);}})['catch'](function(_0x10652d){logger[_0x2d5b('0x11')]('Sound,\x20%s,\x20%s',_0x394645,_0x10652d);_0x5baf74(_0x10652d);});});}exports[_0x2d5b('0x15')]=function(_0x2d4715){var _0x4aa2d5=this;return new Promise(function(_0x8c32cc,_0x292b8a){return db[_0x2d5b('0x16')][_0x2d5b('0x17')]({'raw':_0x2d4715['options']?_0x2d4715[_0x2d5b('0x18')][_0x2d5b('0x19')]===undefined?!![]:![]:!![],'where':_0x2d4715[_0x2d5b('0x18')]?_0x2d4715[_0x2d5b('0x18')]['where']||null:null,'attributes':_0x2d4715[_0x2d5b('0x18')]?_0x2d4715['options'][_0x2d5b('0x1a')]||null:null,'include':_0x2d4715[_0x2d5b('0x18')]?_0x2d4715[_0x2d5b('0x18')][_0x2d5b('0x1b')]?_[_0x2d5b('0x1c')](_0x2d4715['options'][_0x2d5b('0x1b')],function(_0x120273){return{'model':db[_0x120273['model']],'as':_0x120273['as'],'attributes':_0x120273['attributes'],'include':_0x120273[_0x2d5b('0x1b')]?_[_0x2d5b('0x1c')](_0x120273['include'],function(_0x47f01e){return{'model':db[_0x47f01e[_0x2d5b('0x1d')]],'as':_0x47f01e['as'],'attributes':_0x47f01e[_0x2d5b('0x1a')],'include':_0x47f01e[_0x2d5b('0x1b')]?_[_0x2d5b('0x1c')](_0x47f01e[_0x2d5b('0x1b')],function(_0x409dd1){return{'model':db[_0x409dd1[_0x2d5b('0x1d')]],'as':_0x409dd1['as'],'attributes':_0x409dd1[_0x2d5b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x478f4f){logger[_0x2d5b('0xb')](_0x2d5b('0x15'),_0x2d4715);logger[_0x2d5b('0xe')](_0x2d5b('0x15'),_0x2d4715,JSON[_0x2d5b('0x10')](_0x478f4f));_0x8c32cc(_0x478f4f);})['catch'](function(_0x8e8fbc){logger[_0x2d5b('0x11')](_0x2d5b('0x15'),_0x8e8fbc[_0x2d5b('0x13')],_0x2d4715);_0x292b8a(_0x4aa2d5['error'](0x1f4,_0x8e8fbc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9ad3c4d..b21edaf 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x191121,_0x70499d){var _0x11b7bc=function(_0x939f1a){while(--_0x939f1a){_0x191121['push'](_0x191121['shift']());}};_0x11b7bc(++_0x70499d);}(_0xda3f,0xec));var _0xfda3=function(_0x292889,_0xa68dbc){_0x292889=_0x292889-0x0;var _0x58a1a4=_0xda3f[_0x292889];return _0x58a1a4;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0x4fc2,0x111));var _0x24fc=function(_0x3f4414,_0x3258ae){_0x3f4414=_0x3f4414-0x0;var _0x1d7e34=_0x4fc2[_0x3f4414];return _0x1d7e34;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e972f5b..e7052b0 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 _0xb3de=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x2ae4af,_0x5e8f10){var _0x34d9d3=function(_0x5d7a99){while(--_0x5d7a99){_0x2ae4af['push'](_0x2ae4af['shift']());}};_0x34d9d3(++_0x5e8f10);}(_0xb3de,0xd9));var _0xeb3d=function(_0x591d60,_0x543ae7){_0x591d60=_0x591d60-0x0;var _0x3294ca=_0xb3de[_0x591d60];return _0x3294ca;};'use strict';var Sequelize=require(_0xeb3d('0x0'));module[_0xeb3d('0x1')]={'uniqueid':{'type':Sequelize[_0xeb3d('0x2')]},'body':{'type':Sequelize[_0xeb3d('0x3')](_0xeb3d('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xeb3d('0x5')]('in',_0xeb3d('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5b86=['medium','out','TEXT','sequelize','exports','STRING'];(function(_0x2d2012,_0xf091b5){var _0x9e4e9e=function(_0x20fc64){while(--_0x20fc64){_0x2d2012['push'](_0x2d2012['shift']());}};_0x9e4e9e(++_0xf091b5);}(_0x5b86,0xf3));var _0x65b8=function(_0x2fb17c,_0x1158f4){_0x2fb17c=_0x2fb17c-0x0;var _0x3d5e2c=_0x5b86[_0x2fb17c];return _0x3d5e2c;};'use strict';var Sequelize=require(_0x65b8('0x0'));module[_0x65b8('0x1')]={'uniqueid':{'type':Sequelize[_0x65b8('0x2')]},'body':{'type':Sequelize['TEXT'](_0x65b8('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x65b8('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x65b8('0x2')]},'providerResponse':{'type':Sequelize[_0x65b8('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 4c859be..82812dc 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 _0xaac7=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','error','name','send','index','SquareMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x20f50d,_0x450e24){var _0x1895c8=function(_0x19d8f0){while(--_0x19d8f0){_0x20f50d['push'](_0x20f50d['shift']());}};_0x1895c8(++_0x450e24);}(_0xaac7,0x122));var _0x7aac=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xaac7[_0xb1cf84];return _0x4bad2e;};'use strict';var emlformat=require(_0x7aac('0x0'));var rimraf=require(_0x7aac('0x1'));var zipdir=require(_0x7aac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7aac('0x3'));var BPromise=require(_0x7aac('0x4'));var Mustache=require(_0x7aac('0x5'));var util=require(_0x7aac('0x6'));var path=require(_0x7aac('0x7'));var sox=require(_0x7aac('0x8'));var csv=require(_0x7aac('0x9'));var ejs=require(_0x7aac('0xa'));var fs=require('fs');var fs_extra=require(_0x7aac('0xb'));var _=require(_0x7aac('0xc'));var squel=require(_0x7aac('0xd'));var crypto=require(_0x7aac('0xe'));var jsforce=require(_0x7aac('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7aac('0x9'));var querystring=require(_0x7aac('0x10'));var Papa=require(_0x7aac('0x11'));var Redis=require(_0x7aac('0x12'));var authService=require(_0x7aac('0x13'));var qs=require(_0x7aac('0x14'));var as=require(_0x7aac('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7aac('0x16'))(_0x7aac('0x17'));var utils=require(_0x7aac('0x18'));var config=require(_0x7aac('0x19'));var licenseUtil=require(_0x7aac('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71cd4d,_0x2bdf68){_0x2bdf68=_0x2bdf68||0xcc;return function(_0x3bb359){if(_0x3bb359){return _0x71cd4d[_0x7aac('0x1b')](_0x2bdf68);}return _0x71cd4d['status'](_0x2bdf68)[_0x7aac('0x1c')]();};}function respondWithResult(_0x30758a,_0x3245bf){_0x3245bf=_0x3245bf||0xc8;return function(_0x28b111){if(_0x28b111){return _0x30758a[_0x7aac('0x1d')](_0x3245bf)['json'](_0x28b111);}};}function respondWithFilteredResult(_0x16d06f,_0x465920){return function(_0x1b85ea){if(_0x1b85ea){var _0x3a69de=typeof _0x465920[_0x7aac('0x1e')]===_0x7aac('0x1f')&&typeof _0x465920[_0x7aac('0x20')]===_0x7aac('0x1f');var _0x19e933=_0x1b85ea[_0x7aac('0x21')];var _0x4e4711=_0x3a69de?0x0:_0x465920[_0x7aac('0x1e')];var _0x524c86=_0x3a69de?_0x1b85ea[_0x7aac('0x21')]:_0x465920[_0x7aac('0x1e')]+_0x465920[_0x7aac('0x20')];var _0x1a5cf5;if(_0x524c86>=_0x19e933){_0x524c86=_0x19e933;_0x1a5cf5=0xc8;}else{_0x1a5cf5=0xce;}_0x16d06f[_0x7aac('0x1d')](_0x1a5cf5);return _0x16d06f['set'](_0x7aac('0x22'),_0x4e4711+'-'+_0x524c86+'/'+_0x19e933)[_0x7aac('0x23')](_0x1b85ea);}return null;};}function patchUpdates(_0xcbc650){return function(_0x89e9c9){try{jsonpatch[_0x7aac('0x24')](_0x89e9c9,_0xcbc650,!![]);}catch(_0x18a180){return BPromise['reject'](_0x18a180);}return _0x89e9c9[_0x7aac('0x25')]();};}function saveUpdates(_0x27c9f3,_0x14bb25){return function(_0x3bbb74){if(_0x3bbb74){return _0x3bbb74[_0x7aac('0x26')](_0x27c9f3)[_0x7aac('0x27')](function(_0x3aaace){return _0x3aaace;});}return null;};}function removeEntity(_0x537788,_0x782d46){return function(_0x4e3171){if(_0x4e3171){return _0x4e3171['destroy']()['then'](function(){_0x537788[_0x7aac('0x1d')](0xcc)[_0x7aac('0x1c')]();});}};}function handleEntityNotFound(_0x5712cb,_0x486266){return function(_0x9768fc){if(!_0x9768fc){_0x5712cb[_0x7aac('0x1b')](0x194);}return _0x9768fc;};}function handleError(_0x3e5244,_0x1edbb7){_0x1edbb7=_0x1edbb7||0x1f4;return function(_0x5eeb8f){logger[_0x7aac('0x28')](_0x5eeb8f['stack']);if(_0x5eeb8f[_0x7aac('0x29')]){delete _0x5eeb8f[_0x7aac('0x29')];}_0x3e5244['status'](_0x1edbb7)[_0x7aac('0x2a')](_0x5eeb8f);};}exports[_0x7aac('0x2b')]=function(_0x532584,_0x2bf355){var _0x53a015={},_0x3c8181={},_0x50ef2a={'count':0x0,'rows':[]};var _0x265807=_['map'](db[_0x7aac('0x2c')][_0x7aac('0x2d')],function(_0x1eb8bf){return{'name':_0x1eb8bf['fieldName'],'type':_0x1eb8bf[_0x7aac('0x2e')]['key']};});_0x3c8181[_0x7aac('0x2f')]=_['map'](_0x265807,'name');_0x3c8181[_0x7aac('0x30')]=_[_0x7aac('0x31')](_0x532584[_0x7aac('0x30')]);_0x3c8181[_0x7aac('0x32')]=_[_0x7aac('0x33')](_0x3c8181[_0x7aac('0x2f')],_0x3c8181['query']);_0x53a015[_0x7aac('0x34')]=_[_0x7aac('0x33')](_0x3c8181[_0x7aac('0x2f')],qs[_0x7aac('0x35')](_0x532584[_0x7aac('0x30')][_0x7aac('0x35')]));_0x53a015[_0x7aac('0x34')]=_0x53a015[_0x7aac('0x34')]['length']?_0x53a015['attributes']:_0x3c8181[_0x7aac('0x2f')];if(!_0x532584['query'][_0x7aac('0x36')]('nolimit')){_0x53a015[_0x7aac('0x20')]=qs[_0x7aac('0x20')](_0x532584[_0x7aac('0x30')][_0x7aac('0x20')]);_0x53a015[_0x7aac('0x1e')]=qs[_0x7aac('0x1e')](_0x532584[_0x7aac('0x30')][_0x7aac('0x1e')]);}_0x53a015['order']=qs[_0x7aac('0x37')](_0x532584[_0x7aac('0x30')][_0x7aac('0x37')]);_0x53a015['where']=qs[_0x7aac('0x32')](_['pick'](_0x532584[_0x7aac('0x30')],_0x3c8181[_0x7aac('0x32')]),_0x265807);if(_0x532584[_0x7aac('0x30')][_0x7aac('0x38')]){_0x53a015[_0x7aac('0x39')]=_[_0x7aac('0x3a')](_0x53a015[_0x7aac('0x39')],{'$or':_[_0x7aac('0x3b')](_0x265807,function(_0x1723cb){if(_0x1723cb[_0x7aac('0x2e')]!==_0x7aac('0x3c')){var _0x41544d={};_0x41544d[_0x1723cb[_0x7aac('0x29')]]={'$like':'%'+_0x532584[_0x7aac('0x30')][_0x7aac('0x38')]+'%'};return _0x41544d;}})});}_0x53a015=_[_0x7aac('0x3a')]({},_0x53a015,_0x532584['options']);var _0x4fb1ab={'where':_0x53a015[_0x7aac('0x39')]};return db[_0x7aac('0x2c')][_0x7aac('0x21')](_0x4fb1ab)[_0x7aac('0x27')](function(_0x223892){_0x50ef2a[_0x7aac('0x21')]=_0x223892;if(_0x532584['query'][_0x7aac('0x3d')]){_0x53a015[_0x7aac('0x3e')]=[{'all':!![]}];}return db[_0x7aac('0x2c')][_0x7aac('0x3f')](_0x53a015);})[_0x7aac('0x27')](function(_0x1ebfc9){_0x50ef2a[_0x7aac('0x40')]=_0x1ebfc9;return _0x50ef2a;})['then'](respondWithFilteredResult(_0x2bf355,_0x53a015))[_0x7aac('0x41')](handleError(_0x2bf355,null));};exports[_0x7aac('0x42')]=function(_0x3fd7c8,_0x18d1ed){var _0x285bf7={'raw':!![],'where':{'id':_0x3fd7c8[_0x7aac('0x43')]['id']}},_0x89ff50={};_0x89ff50['model']=_['keys'](db[_0x7aac('0x2c')][_0x7aac('0x2d')]);_0x89ff50[_0x7aac('0x30')]=_[_0x7aac('0x31')](_0x3fd7c8[_0x7aac('0x30')]);_0x89ff50[_0x7aac('0x32')]=_[_0x7aac('0x33')](_0x89ff50[_0x7aac('0x2f')],_0x89ff50[_0x7aac('0x30')]);_0x285bf7[_0x7aac('0x34')]=_[_0x7aac('0x33')](_0x89ff50[_0x7aac('0x2f')],qs['fields'](_0x3fd7c8['query'][_0x7aac('0x35')]));_0x285bf7[_0x7aac('0x34')]=_0x285bf7[_0x7aac('0x34')][_0x7aac('0x44')]?_0x285bf7[_0x7aac('0x34')]:_0x89ff50[_0x7aac('0x2f')];if(_0x3fd7c8['query'][_0x7aac('0x3d')]){_0x285bf7[_0x7aac('0x3e')]=[{'all':!![]}];}_0x285bf7=_[_0x7aac('0x3a')]({},_0x285bf7,_0x3fd7c8[_0x7aac('0x45')]);return db[_0x7aac('0x2c')][_0x7aac('0x46')](_0x285bf7)[_0x7aac('0x27')](handleEntityNotFound(_0x18d1ed,null))[_0x7aac('0x27')](respondWithResult(_0x18d1ed,null))[_0x7aac('0x41')](handleError(_0x18d1ed,null));};exports['create']=function(_0x30aaab,_0x5b6c59){return db[_0x7aac('0x2c')][_0x7aac('0x47')](_0x30aaab[_0x7aac('0x48')],{})[_0x7aac('0x27')](respondWithResult(_0x5b6c59,0xc9))['catch'](handleError(_0x5b6c59,null));};exports['update']=function(_0x1ce03a,_0x4afdf3){if(_0x1ce03a[_0x7aac('0x48')]['id']){delete _0x1ce03a[_0x7aac('0x48')]['id'];}return db['SquareMessage'][_0x7aac('0x46')]({'where':{'id':_0x1ce03a[_0x7aac('0x43')]['id']}})[_0x7aac('0x27')](handleEntityNotFound(_0x4afdf3,null))['then'](saveUpdates(_0x1ce03a['body'],null))['then'](respondWithResult(_0x4afdf3,null))[_0x7aac('0x41')](handleError(_0x4afdf3,null));};exports[_0x7aac('0x49')]=function(_0x77fe9f,_0x1b88c8){return db[_0x7aac('0x2c')][_0x7aac('0x46')]({'where':{'id':_0x77fe9f['params']['id']}})[_0x7aac('0x27')](handleEntityNotFound(_0x1b88c8,null))[_0x7aac('0x27')](removeEntity(_0x1b88c8,null))[_0x7aac('0x41')](handleError(_0x1b88c8,null));}; \ No newline at end of file +var _0x8e6b=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','keys','includeAll','include','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','key','map','query','filters','intersection','model'];(function(_0x41b0e4,_0x12e503){var _0x1b94ac=function(_0x266936){while(--_0x266936){_0x41b0e4['push'](_0x41b0e4['shift']());}};_0x1b94ac(++_0x12e503);}(_0x8e6b,0x66));var _0xb8e6=function(_0x39f466,_0x2813a4){_0x39f466=_0x39f466-0x0;var _0x230a29=_0x8e6b[_0x39f466];return _0x230a29;};'use strict';var emlformat=require(_0xb8e6('0x0'));var rimraf=require(_0xb8e6('0x1'));var zipdir=require(_0xb8e6('0x2'));var jsonpatch=require(_0xb8e6('0x3'));var rp=require('request-promise');var moment=require(_0xb8e6('0x4'));var BPromise=require(_0xb8e6('0x5'));var Mustache=require('mustache');var util=require(_0xb8e6('0x6'));var path=require(_0xb8e6('0x7'));var sox=require(_0xb8e6('0x8'));var csv=require(_0xb8e6('0x9'));var ejs=require(_0xb8e6('0xa'));var fs=require('fs');var fs_extra=require(_0xb8e6('0xb'));var _=require(_0xb8e6('0xc'));var squel=require('squel');var crypto=require(_0xb8e6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb8e6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb8e6('0xf'));var qs=require(_0xb8e6('0x10'));var as=require(_0xb8e6('0x11'));var hardwareService=require(_0xb8e6('0x12'));var logger=require(_0xb8e6('0x13'))(_0xb8e6('0x14'));var utils=require(_0xb8e6('0x15'));var config=require(_0xb8e6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8e6('0x17'))['db'];function respondWithStatusCode(_0x55c3fc,_0xcf0a47){_0xcf0a47=_0xcf0a47||0xcc;return function(_0x35b6b6){if(_0x35b6b6){return _0x55c3fc[_0xb8e6('0x18')](_0xcf0a47);}return _0x55c3fc[_0xb8e6('0x19')](_0xcf0a47)[_0xb8e6('0x1a')]();};}function respondWithResult(_0x207fc,_0x981753){_0x981753=_0x981753||0xc8;return function(_0x49a2b8){if(_0x49a2b8){return _0x207fc[_0xb8e6('0x19')](_0x981753)[_0xb8e6('0x1b')](_0x49a2b8);}};}function respondWithFilteredResult(_0x2d8eab,_0x2e6d99){return function(_0x508e4b){if(_0x508e4b){var _0x433fbf=typeof _0x2e6d99[_0xb8e6('0x1c')]===_0xb8e6('0x1d')&&typeof _0x2e6d99['limit']===_0xb8e6('0x1d');var _0x2e4a6f=_0x508e4b[_0xb8e6('0x1e')];var _0x911ef9=_0x433fbf?0x0:_0x2e6d99[_0xb8e6('0x1c')];var _0x1f2f2d=_0x433fbf?_0x508e4b[_0xb8e6('0x1e')]:_0x2e6d99['offset']+_0x2e6d99[_0xb8e6('0x1f')];var _0x59f9ff;if(_0x1f2f2d>=_0x2e4a6f){_0x1f2f2d=_0x2e4a6f;_0x59f9ff=0xc8;}else{_0x59f9ff=0xce;}_0x2d8eab['status'](_0x59f9ff);return _0x2d8eab['set'](_0xb8e6('0x20'),_0x911ef9+'-'+_0x1f2f2d+'/'+_0x2e4a6f)[_0xb8e6('0x1b')](_0x508e4b);}return null;};}function patchUpdates(_0x42bb32){return function(_0x4a96b3){try{jsonpatch[_0xb8e6('0x21')](_0x4a96b3,_0x42bb32,!![]);}catch(_0x142473){return BPromise[_0xb8e6('0x22')](_0x142473);}return _0x4a96b3[_0xb8e6('0x23')]();};}function saveUpdates(_0x42f7a5,_0x47362f){return function(_0x1881ed){if(_0x1881ed){return _0x1881ed[_0xb8e6('0x24')](_0x42f7a5)[_0xb8e6('0x25')](function(_0x3d7cbb){return _0x3d7cbb;});}return null;};}function removeEntity(_0x12fccd,_0x4926ec){return function(_0x2c7b61){if(_0x2c7b61){return _0x2c7b61['destroy']()[_0xb8e6('0x25')](function(){_0x12fccd[_0xb8e6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd048b2,_0x5207a2){return function(_0x4a8a19){if(!_0x4a8a19){_0xd048b2[_0xb8e6('0x18')](0x194);}return _0x4a8a19;};}function handleError(_0x14034b,_0xf7573f){_0xf7573f=_0xf7573f||0x1f4;return function(_0x2730f9){logger[_0xb8e6('0x26')](_0x2730f9[_0xb8e6('0x27')]);if(_0x2730f9[_0xb8e6('0x28')]){delete _0x2730f9[_0xb8e6('0x28')];}_0x14034b['status'](_0xf7573f)[_0xb8e6('0x29')](_0x2730f9);};}exports[_0xb8e6('0x2a')]=function(_0x5af1f2,_0x3ea472){var _0x50dbea={},_0x2954af={},_0x2f5f01={'count':0x0,'rows':[]};var _0x4a93f3=_['map'](db[_0xb8e6('0x2b')][_0xb8e6('0x2c')],function(_0x5d5dff){return{'name':_0x5d5dff[_0xb8e6('0x2d')],'type':_0x5d5dff['type'][_0xb8e6('0x2e')]};});_0x2954af['model']=_[_0xb8e6('0x2f')](_0x4a93f3,_0xb8e6('0x28'));_0x2954af[_0xb8e6('0x30')]=_['keys'](_0x5af1f2[_0xb8e6('0x30')]);_0x2954af[_0xb8e6('0x31')]=_[_0xb8e6('0x32')](_0x2954af['model'],_0x2954af[_0xb8e6('0x30')]);_0x50dbea['attributes']=_['intersection'](_0x2954af[_0xb8e6('0x33')],qs[_0xb8e6('0x34')](_0x5af1f2[_0xb8e6('0x30')]['fields']));_0x50dbea[_0xb8e6('0x35')]=_0x50dbea['attributes'][_0xb8e6('0x36')]?_0x50dbea['attributes']:_0x2954af[_0xb8e6('0x33')];if(!_0x5af1f2['query'][_0xb8e6('0x37')](_0xb8e6('0x38'))){_0x50dbea['limit']=qs[_0xb8e6('0x1f')](_0x5af1f2[_0xb8e6('0x30')][_0xb8e6('0x1f')]);_0x50dbea[_0xb8e6('0x1c')]=qs[_0xb8e6('0x1c')](_0x5af1f2[_0xb8e6('0x30')]['offset']);}_0x50dbea[_0xb8e6('0x39')]=qs[_0xb8e6('0x3a')](_0x5af1f2[_0xb8e6('0x30')]['sort']);_0x50dbea['where']=qs['filters'](_[_0xb8e6('0x3b')](_0x5af1f2[_0xb8e6('0x30')],_0x2954af[_0xb8e6('0x31')]),_0x4a93f3);if(_0x5af1f2['query'][_0xb8e6('0x3c')]){_0x50dbea[_0xb8e6('0x3d')]=_[_0xb8e6('0x3e')](_0x50dbea[_0xb8e6('0x3d')],{'$or':_[_0xb8e6('0x2f')](_0x4a93f3,function(_0x35ced8){if(_0x35ced8['type']!==_0xb8e6('0x3f')){var _0x116593={};_0x116593[_0x35ced8[_0xb8e6('0x28')]]={'$like':'%'+_0x5af1f2[_0xb8e6('0x30')]['filter']+'%'};return _0x116593;}})});}_0x50dbea=_[_0xb8e6('0x3e')]({},_0x50dbea,_0x5af1f2[_0xb8e6('0x40')]);var _0x2f6028={'where':_0x50dbea[_0xb8e6('0x3d')]};return db[_0xb8e6('0x2b')][_0xb8e6('0x1e')](_0x2f6028)[_0xb8e6('0x25')](function(_0x20993d){_0x2f5f01[_0xb8e6('0x1e')]=_0x20993d;if(_0x5af1f2['query']['includeAll']){_0x50dbea['include']=[{'all':!![]}];}return db[_0xb8e6('0x2b')][_0xb8e6('0x41')](_0x50dbea);})['then'](function(_0x4efa5e){_0x2f5f01[_0xb8e6('0x42')]=_0x4efa5e;return _0x2f5f01;})[_0xb8e6('0x25')](respondWithFilteredResult(_0x3ea472,_0x50dbea))[_0xb8e6('0x43')](handleError(_0x3ea472,null));};exports[_0xb8e6('0x44')]=function(_0x56a3d8,_0x2f4add){var _0x543907={'raw':!![],'where':{'id':_0x56a3d8['params']['id']}},_0x442de1={};_0x442de1[_0xb8e6('0x33')]=_[_0xb8e6('0x45')](db[_0xb8e6('0x2b')][_0xb8e6('0x2c')]);_0x442de1[_0xb8e6('0x30')]=_[_0xb8e6('0x45')](_0x56a3d8[_0xb8e6('0x30')]);_0x442de1[_0xb8e6('0x31')]=_[_0xb8e6('0x32')](_0x442de1['model'],_0x442de1[_0xb8e6('0x30')]);_0x543907[_0xb8e6('0x35')]=_[_0xb8e6('0x32')](_0x442de1[_0xb8e6('0x33')],qs[_0xb8e6('0x34')](_0x56a3d8['query'][_0xb8e6('0x34')]));_0x543907[_0xb8e6('0x35')]=_0x543907[_0xb8e6('0x35')]['length']?_0x543907['attributes']:_0x442de1['model'];if(_0x56a3d8['query'][_0xb8e6('0x46')]){_0x543907[_0xb8e6('0x47')]=[{'all':!![]}];}_0x543907=_['merge']({},_0x543907,_0x56a3d8[_0xb8e6('0x40')]);return db[_0xb8e6('0x2b')][_0xb8e6('0x48')](_0x543907)[_0xb8e6('0x25')](handleEntityNotFound(_0x2f4add,null))['then'](respondWithResult(_0x2f4add,null))['catch'](handleError(_0x2f4add,null));};exports[_0xb8e6('0x49')]=function(_0x343842,_0x45b830){return db['SquareMessage'][_0xb8e6('0x49')](_0x343842[_0xb8e6('0x4a')],{})[_0xb8e6('0x25')](respondWithResult(_0x45b830,0xc9))[_0xb8e6('0x43')](handleError(_0x45b830,null));};exports[_0xb8e6('0x24')]=function(_0x4c6372,_0x2f8e97){if(_0x4c6372[_0xb8e6('0x4a')]['id']){delete _0x4c6372[_0xb8e6('0x4a')]['id'];}return db[_0xb8e6('0x2b')][_0xb8e6('0x48')]({'where':{'id':_0x4c6372[_0xb8e6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2f8e97,null))[_0xb8e6('0x25')](saveUpdates(_0x4c6372[_0xb8e6('0x4a')],null))[_0xb8e6('0x25')](respondWithResult(_0x2f8e97,null))[_0xb8e6('0x43')](handleError(_0x2f8e97,null));};exports[_0xb8e6('0x4c')]=function(_0x449dde,_0x3c6e12){return db[_0xb8e6('0x2b')]['find']({'where':{'id':_0x449dde[_0xb8e6('0x4b')]['id']}})[_0xb8e6('0x25')](handleEntityNotFound(_0x3c6e12,null))[_0xb8e6('0x25')](removeEntity(_0x3c6e12,null))[_0xb8e6('0x43')](handleError(_0x3c6e12,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e528ee9..93d8325 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 _0xa5ae=['define','SquareMessage','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x477303,_0x4f065e){var _0x3a43bc=function(_0x302553){while(--_0x302553){_0x477303['push'](_0x477303['shift']());}};_0x3a43bc(++_0x4f065e);}(_0xa5ae,0x134));var _0xea5a=function(_0x2de0ab,_0x353746){_0x2de0ab=_0x2de0ab-0x0;var _0x7f8af9=_0xa5ae[_0x2de0ab];return _0x7f8af9;};'use strict';var _=require('lodash');var util=require(_0xea5a('0x0'));var logger=require(_0xea5a('0x1'))(_0xea5a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea5a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea5a('0x4'));var config=require(_0xea5a('0x5'));var attributes=require(_0xea5a('0x6'));module['exports']=function(_0x672704,_0x227efa){return _0x672704[_0xea5a('0x7')](_0xea5a('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaeff=['exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x2c8855,_0x31b81f){var _0x4ce819=function(_0x3ddbaf){while(--_0x3ddbaf){_0x2c8855['push'](_0x2c8855['shift']());}};_0x4ce819(++_0x31b81f);}(_0xaeff,0x10e));var _0xfaef=function(_0x4889db,_0x10f3f3){_0x4889db=_0x4889db-0x0;var _0x4e178f=_0xaeff[_0x4889db];return _0x4e178f;};'use strict';var _=require(_0xfaef('0x0'));var util=require(_0xfaef('0x1'));var logger=require(_0xfaef('0x2'))(_0xfaef('0x3'));var moment=require(_0xfaef('0x4'));var BPromise=require(_0xfaef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfaef('0x6'));var rimraf=require(_0xfaef('0x7'));var config=require(_0xfaef('0x8'));var attributes=require(_0xfaef('0x9'));module[_0xfaef('0xa')]=function(_0x3d131e,_0x1ac48c){return _0x3d131e[_0xfaef('0xb')](_0xfaef('0xc'),attributes,{'tableName':_0xfaef('0xd'),'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 0377c25..c7307d8 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 _0xd5ae=['SquareMessage','create','body','options','CreateSquareMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x4eb4ad,_0x183488){var _0x1312b2=function(_0x19aabe){while(--_0x19aabe){_0x4eb4ad['push'](_0x4eb4ad['shift']());}};_0x1312b2(++_0x183488);}(_0xd5ae,0x171));var _0xed5a=function(_0x2966fc,_0x5c30ed){_0x2966fc=_0x2966fc-0x0;var _0x54e656=_0xd5ae[_0x2966fc];return _0x54e656;};'use strict';var _=require(_0xed5a('0x0'));var util=require('util');var moment=require(_0xed5a('0x1'));var BPromise=require(_0xed5a('0x2'));var rs=require(_0xed5a('0x3'));var fs=require('fs');var Redis=require(_0xed5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed5a('0x5'))(_0xed5a('0x6'));var config=require(_0xed5a('0x7'));var jayson=require(_0xed5a('0x8'));var client=jayson[_0xed5a('0x9')][_0xed5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x306545,_0x4b1684,_0x360890){return new BPromise(function(_0x5c3f69,_0x504ac9){return client['request'](_0x306545,_0x360890)[_0xed5a('0xb')](function(_0x9ba75e){logger['info'](_0xed5a('0xc'),_0x4b1684,_0xed5a('0xd'));logger[_0xed5a('0xe')](_0xed5a('0xf'),_0x4b1684,_0xed5a('0xd'),JSON[_0xed5a('0x10')](_0x9ba75e));if(_0x9ba75e[_0xed5a('0x11')]){if(_0x9ba75e['error'][_0xed5a('0x12')]===0x1f4){logger[_0xed5a('0x11')](_0xed5a('0xc'),_0x4b1684,_0x9ba75e[_0xed5a('0x11')][_0xed5a('0x13')]);return _0x504ac9(_0x9ba75e[_0xed5a('0x11')]['message']);}logger[_0xed5a('0x11')](_0xed5a('0xc'),_0x4b1684,_0x9ba75e['error'][_0xed5a('0x13')]);return _0x5c3f69(_0x9ba75e[_0xed5a('0x11')][_0xed5a('0x13')]);}else{logger[_0xed5a('0x14')](_0xed5a('0xc'),_0x4b1684,'request\x20sent');_0x5c3f69(_0x9ba75e[_0xed5a('0x15')][_0xed5a('0x13')]);}})[_0xed5a('0x16')](function(_0x1c0f01){logger[_0xed5a('0x11')]('SquareMessage,\x20%s,\x20%s',_0x4b1684,_0x1c0f01);_0x504ac9(_0x1c0f01);});});}exports['CreateSquareMessage']=function(_0x5b545f){var _0x3f103c=this;return new Promise(function(_0x29019a,_0x4d3a75){return db[_0xed5a('0x17')][_0xed5a('0x18')](_0x5b545f[_0xed5a('0x19')],{'raw':_0x5b545f[_0xed5a('0x1a')]?_0x5b545f[_0xed5a('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xed5a('0xb')](function(_0x1b5a90){logger[_0xed5a('0x14')](_0xed5a('0x1b'),_0x5b545f);logger[_0xed5a('0xe')](_0xed5a('0x1b'),_0x5b545f,JSON[_0xed5a('0x10')](_0x1b5a90));_0x29019a(_0x1b5a90);})[_0xed5a('0x16')](function(_0x1327ba){logger[_0xed5a('0x11')](_0xed5a('0x1b'),_0x1327ba[_0xed5a('0x13')],_0x5b545f);_0x4d3a75(_0x3f103c[_0xed5a('0x11')](0x1f4,_0x1327ba['message']));});});}; \ No newline at end of file +var _0x9183=['../../config/utils','rpc','../../config/environment','client','http','request','then','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateSquareMessage','body','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x9183,0x7c));var _0x3918=function(_0x2ee63c,_0x20faa9){_0x2ee63c=_0x2ee63c-0x0;var _0x242f9c=_0x9183[_0x2ee63c];return _0x242f9c;};'use strict';var _=require(_0x3918('0x0'));var util=require(_0x3918('0x1'));var moment=require(_0x3918('0x2'));var BPromise=require(_0x3918('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3918('0x4'));var db=require(_0x3918('0x5'))['db'];var utils=require(_0x3918('0x6'));var logger=require('../../config/logger')(_0x3918('0x7'));var config=require(_0x3918('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3918('0x9')][_0x3918('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d8088,_0x249f79,_0x2c874a){return new BPromise(function(_0x102d4d,_0x3f334e){return client[_0x3918('0xb')](_0x5d8088,_0x2c874a)[_0x3918('0xc')](function(_0x16f6cb){logger['info'](_0x3918('0xd'),_0x249f79,'request\x20sent');logger[_0x3918('0xe')](_0x3918('0xf'),_0x249f79,_0x3918('0x10'),JSON[_0x3918('0x11')](_0x16f6cb));if(_0x16f6cb[_0x3918('0x12')]){if(_0x16f6cb[_0x3918('0x12')][_0x3918('0x13')]===0x1f4){logger[_0x3918('0x12')](_0x3918('0xd'),_0x249f79,_0x16f6cb[_0x3918('0x12')]['message']);return _0x3f334e(_0x16f6cb[_0x3918('0x12')][_0x3918('0x14')]);}logger[_0x3918('0x12')](_0x3918('0xd'),_0x249f79,_0x16f6cb['error'][_0x3918('0x14')]);return _0x102d4d(_0x16f6cb[_0x3918('0x12')]['message']);}else{logger[_0x3918('0x15')](_0x3918('0xd'),_0x249f79,_0x3918('0x10'));_0x102d4d(_0x16f6cb['result'][_0x3918('0x14')]);}})[_0x3918('0x16')](function(_0x169815){logger[_0x3918('0x12')](_0x3918('0xd'),_0x249f79,_0x169815);_0x3f334e(_0x169815);});});}exports[_0x3918('0x17')]=function(_0x41ab9c){var _0x3c8981=this;return new Promise(function(_0x494433,_0x4dcf12){return db['SquareMessage']['create'](_0x41ab9c[_0x3918('0x18')],{'raw':_0x41ab9c['options']?_0x41ab9c['options'][_0x3918('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3b2b81){logger[_0x3918('0x15')](_0x3918('0x17'),_0x41ab9c);logger[_0x3918('0xe')]('CreateSquareMessage',_0x41ab9c,JSON[_0x3918('0x11')](_0x3b2b81));_0x494433(_0x3b2b81);})[_0x3918('0x16')](function(_0x40ba05){logger[_0x3918('0x12')](_0x3918('0x17'),_0x40ba05[_0x3918('0x14')],_0x41ab9c);_0x4dcf12(_0x3c8981[_0x3918('0x12')](0x1f4,_0x40ba05[_0x3918('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 8046259..dc49f8c 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 _0xd130=['/:id','isAuthenticated','show','/:id/test','15s','test','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0xd130,0x170));var _0x0d13=function(_0x25d419,_0x46affa){_0x25d419=_0x25d419-0x0;var _0x382be5=_0xd130[_0x25d419];return _0x382be5;};'use strict';var multer=require(_0x0d13('0x0'));var util=require(_0x0d13('0x1'));var path=require(_0x0d13('0x2'));var timeout=require(_0x0d13('0x3'));var express=require(_0x0d13('0x4'));var router=express['Router']();var fs_extra=require(_0x0d13('0x5'));var auth=require(_0x0d13('0x6'));var interaction=require(_0x0d13('0x7'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0d13('0x8')]);router[_0x0d13('0x9')](_0x0d13('0xa'),auth[_0x0d13('0xb')](),controller[_0x0d13('0xc')]);router['get'](_0x0d13('0xd'),auth[_0x0d13('0xb')](),timeout(_0x0d13('0xe')),controller[_0x0d13('0xf')]);router[_0x0d13('0x10')]('/',auth[_0x0d13('0xb')](),controller[_0x0d13('0x11')]);router[_0x0d13('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x0d13('0xa'),auth[_0x0d13('0xb')](),controller[_0x0d13('0x13')]);module[_0x0d13('0x14')]=router; \ No newline at end of file +var _0xcfed=['/:id','/:id/test','15s','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfed,0x76));var _0xdcfe=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcfed[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xdcfe('0x0'));var util=require(_0xdcfe('0x1'));var path=require('path');var timeout=require(_0xdcfe('0x2'));var express=require('express');var router=express[_0xdcfe('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdcfe('0x4'));var config=require('../../config/environment');var controller=require(_0xdcfe('0x5'));router[_0xdcfe('0x6')]('/',auth[_0xdcfe('0x7')](),controller['index']);router[_0xdcfe('0x6')](_0xdcfe('0x8'),auth[_0xdcfe('0x7')](),controller['show']);router[_0xdcfe('0x6')](_0xdcfe('0x9'),auth[_0xdcfe('0x7')](),timeout(_0xdcfe('0xa')),controller['test']);router[_0xdcfe('0xb')]('/',auth[_0xdcfe('0x7')](),controller[_0xdcfe('0xc')]);router[_0xdcfe('0xd')](_0xdcfe('0x8'),auth['isAuthenticated'](),controller[_0xdcfe('0xe')]);router[_0xdcfe('0xf')](_0xdcfe('0x8'),auth['isAuthenticated'](),controller[_0xdcfe('0x10')]);module[_0xdcfe('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 026014f..d4e1b68 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 _0x835a=['sequelize','exports','STRING'];(function(_0x4bf23b,_0x31c3a1){var _0x5a96e9=function(_0x29927c){while(--_0x29927c){_0x4bf23b['push'](_0x4bf23b['shift']());}};_0x5a96e9(++_0x31c3a1);}(_0x835a,0x186));var _0xa835=function(_0x30627d,_0x36a829){_0x30627d=_0x30627d-0x0;var _0x167a23=_0x835a[_0x30627d];return _0x167a23;};'use strict';var Sequelize=require(_0xa835('0x0'));module[_0xa835('0x1')]={'name':{'type':Sequelize[_0xa835('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xa835('0x2')]},'description':{'type':Sequelize[_0xa835('0x2')]}}; \ No newline at end of file +var _0x13e9=['name','exports','STRING'];(function(_0x185df2,_0x5077f6){var _0x1ff96c=function(_0x325e3b){while(--_0x325e3b){_0x185df2['push'](_0x185df2['shift']());}};_0x1ff96c(++_0x5077f6);}(_0x13e9,0x1e7));var _0x913e=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x13e9[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require('sequelize');module[_0x913e('0x0')]={'name':{'type':Sequelize[_0x913e('0x1')],'unique':_0x913e('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x913e('0x1')]},'description':{'type':Sequelize[_0x913e('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index fe33cf4..093d2ba 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 _0x15d7=['SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','body','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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','count','set','apply','reject','update','then','destroy','get','error','name','send','index','map'];(function(_0x4a2b2c,_0x1f22e8){var _0x5a1fad=function(_0x2b7016){while(--_0x2b7016){_0x4a2b2c['push'](_0x4a2b2c['shift']());}};_0x5a1fad(++_0x1f22e8);}(_0x15d7,0x86));var _0x715d=function(_0x3b5608,_0x3fc642){_0x3b5608=_0x3b5608-0x0;var _0xe4d2d5=_0x15d7[_0x3b5608];return _0xe4d2d5;};'use strict';var emlformat=require(_0x715d('0x0'));var rimraf=require(_0x715d('0x1'));var zipdir=require(_0x715d('0x2'));var jsonpatch=require(_0x715d('0x3'));var rp=require(_0x715d('0x4'));var moment=require(_0x715d('0x5'));var BPromise=require(_0x715d('0x6'));var Mustache=require(_0x715d('0x7'));var util=require('util');var path=require(_0x715d('0x8'));var sox=require(_0x715d('0x9'));var csv=require(_0x715d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x715d('0xb'));var _=require(_0x715d('0xc'));var squel=require(_0x715d('0xd'));var crypto=require(_0x715d('0xe'));var jsforce=require(_0x715d('0xf'));var deskjs=require(_0x715d('0x10'));var toCsv=require(_0x715d('0xa'));var querystring=require(_0x715d('0x11'));var Papa=require(_0x715d('0x12'));var Redis=require(_0x715d('0x13'));var authService=require(_0x715d('0x14'));var qs=require(_0x715d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x715d('0x16'));var logger=require(_0x715d('0x17'))(_0x715d('0x18'));var utils=require(_0x715d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x715d('0x1a'));var db=require(_0x715d('0x1b'))['db'];function respondWithStatusCode(_0x88ba52,_0x312e07){_0x312e07=_0x312e07||0xcc;return function(_0x5d035e){if(_0x5d035e){return _0x88ba52[_0x715d('0x1c')](_0x312e07);}return _0x88ba52[_0x715d('0x1d')](_0x312e07)[_0x715d('0x1e')]();};}function respondWithResult(_0x545140,_0x4dfbd3){_0x4dfbd3=_0x4dfbd3||0xc8;return function(_0xd226b1){if(_0xd226b1){return _0x545140[_0x715d('0x1d')](_0x4dfbd3)[_0x715d('0x1f')](_0xd226b1);}};}function respondWithFilteredResult(_0x2309ce,_0x2c8cf7){return function(_0x3e3187){if(_0x3e3187){var _0x321236=typeof _0x2c8cf7[_0x715d('0x20')]===_0x715d('0x21')&&typeof _0x2c8cf7[_0x715d('0x22')]===_0x715d('0x21');var _0x38ec99=_0x3e3187[_0x715d('0x23')];var _0x59ff74=_0x321236?0x0:_0x2c8cf7['offset'];var _0x4a253c=_0x321236?_0x3e3187[_0x715d('0x23')]:_0x2c8cf7[_0x715d('0x20')]+_0x2c8cf7[_0x715d('0x22')];var _0x588bd0;if(_0x4a253c>=_0x38ec99){_0x4a253c=_0x38ec99;_0x588bd0=0xc8;}else{_0x588bd0=0xce;}_0x2309ce['status'](_0x588bd0);return _0x2309ce[_0x715d('0x24')]('Content-Range',_0x59ff74+'-'+_0x4a253c+'/'+_0x38ec99)[_0x715d('0x1f')](_0x3e3187);}return null;};}function patchUpdates(_0x4584e4){return function(_0x476dd0){try{jsonpatch[_0x715d('0x25')](_0x476dd0,_0x4584e4,!![]);}catch(_0x4cf35d){return BPromise[_0x715d('0x26')](_0x4cf35d);}return _0x476dd0['save']();};}function saveUpdates(_0x340470,_0x330d0a){return function(_0x2b89be){if(_0x2b89be){return _0x2b89be[_0x715d('0x27')](_0x340470)[_0x715d('0x28')](function(_0x443156){return _0x443156;});}return null;};}function removeEntity(_0x18320f,_0x26b7b5){return function(_0x2865bb){if(_0x2865bb){return _0x2865bb[_0x715d('0x29')]()[_0x715d('0x28')](function(){var _0x251337=_0x2865bb[_0x715d('0x2a')]({'plain':!![]});var _0x304bb7='ODBC';return db['UserProfileResource'][_0x715d('0x29')]({'where':{'type':_0x304bb7,'resourceId':_0x251337['id']}})[_0x715d('0x28')](function(){return _0x2865bb;});})[_0x715d('0x28')](function(){_0x18320f[_0x715d('0x1d')](0xcc)[_0x715d('0x1e')]();});}};}function handleEntityNotFound(_0x3c150c,_0x4c9cc8){return function(_0x11f5b8){if(!_0x11f5b8){_0x3c150c[_0x715d('0x1c')](0x194);}return _0x11f5b8;};}function handleError(_0x200b02,_0x174f68){_0x174f68=_0x174f68||0x1f4;return function(_0x467248){logger[_0x715d('0x2b')](_0x467248['stack']);if(_0x467248[_0x715d('0x2c')]){delete _0x467248[_0x715d('0x2c')];}_0x200b02[_0x715d('0x1d')](_0x174f68)[_0x715d('0x2d')](_0x467248);};}exports[_0x715d('0x2e')]=function(_0xeb9529,_0x12401e){var _0x10a9a9={},_0x37315d={},_0x171fc4={'count':0x0,'rows':[]};var _0x3c04c7=_[_0x715d('0x2f')](db[_0x715d('0x30')][_0x715d('0x31')],function(_0x2ad018){return{'name':_0x2ad018[_0x715d('0x32')],'type':_0x2ad018[_0x715d('0x33')][_0x715d('0x34')]};});_0x37315d[_0x715d('0x35')]=_[_0x715d('0x2f')](_0x3c04c7,_0x715d('0x2c'));_0x37315d[_0x715d('0x36')]=_[_0x715d('0x37')](_0xeb9529[_0x715d('0x36')]);_0x37315d['filters']=_[_0x715d('0x38')](_0x37315d[_0x715d('0x35')],_0x37315d[_0x715d('0x36')]);_0x10a9a9[_0x715d('0x39')]=_[_0x715d('0x38')](_0x37315d[_0x715d('0x35')],qs['fields'](_0xeb9529[_0x715d('0x36')][_0x715d('0x3a')]));_0x10a9a9[_0x715d('0x39')]=_0x10a9a9[_0x715d('0x39')]['length']?_0x10a9a9[_0x715d('0x39')]:_0x37315d['model'];if(!_0xeb9529[_0x715d('0x36')][_0x715d('0x3b')](_0x715d('0x3c'))){_0x10a9a9[_0x715d('0x22')]=qs[_0x715d('0x22')](_0xeb9529[_0x715d('0x36')]['limit']);_0x10a9a9[_0x715d('0x20')]=qs[_0x715d('0x20')](_0xeb9529['query']['offset']);}_0x10a9a9[_0x715d('0x3d')]=qs[_0x715d('0x3e')](_0xeb9529[_0x715d('0x36')]['sort']);_0x10a9a9[_0x715d('0x3f')]=qs[_0x715d('0x40')](_[_0x715d('0x41')](_0xeb9529[_0x715d('0x36')],_0x37315d[_0x715d('0x40')]),_0x3c04c7);if(_0xeb9529[_0x715d('0x36')]['filter']){_0x10a9a9['where']=_[_0x715d('0x42')](_0x10a9a9['where'],{'$or':_[_0x715d('0x2f')](_0x3c04c7,function(_0x5f3baf){if(_0x5f3baf[_0x715d('0x33')]!=='VIRTUAL'){var _0x84015a={};_0x84015a[_0x5f3baf[_0x715d('0x2c')]]={'$like':'%'+_0xeb9529[_0x715d('0x36')][_0x715d('0x43')]+'%'};return _0x84015a;}})});}_0x10a9a9=_[_0x715d('0x42')]({},_0x10a9a9,_0xeb9529[_0x715d('0x44')]);var _0x2fc62e={'where':_0x10a9a9[_0x715d('0x3f')]};return db[_0x715d('0x30')][_0x715d('0x23')](_0x2fc62e)[_0x715d('0x28')](function(_0x3cac96){_0x171fc4[_0x715d('0x23')]=_0x3cac96;if(_0xeb9529[_0x715d('0x36')][_0x715d('0x45')]){_0x10a9a9[_0x715d('0x46')]=[{'all':!![]}];}return db['SquareOdbc'][_0x715d('0x47')](_0x10a9a9);})[_0x715d('0x28')](function(_0x40dd56){_0x171fc4[_0x715d('0x48')]=_0x40dd56;return _0x171fc4;})[_0x715d('0x28')](respondWithFilteredResult(_0x12401e,_0x10a9a9))['catch'](handleError(_0x12401e,null));};exports[_0x715d('0x49')]=function(_0xa74994,_0x3a32fa){var _0x170f01={'raw':!![],'where':{'id':_0xa74994[_0x715d('0x4a')]['id']}},_0x20ef53={};_0x20ef53[_0x715d('0x35')]=_['keys'](db[_0x715d('0x30')][_0x715d('0x31')]);_0x20ef53[_0x715d('0x36')]=_['keys'](_0xa74994['query']);_0x20ef53[_0x715d('0x40')]=_[_0x715d('0x38')](_0x20ef53[_0x715d('0x35')],_0x20ef53[_0x715d('0x36')]);_0x170f01[_0x715d('0x39')]=_[_0x715d('0x38')](_0x20ef53[_0x715d('0x35')],qs[_0x715d('0x3a')](_0xa74994[_0x715d('0x36')][_0x715d('0x3a')]));_0x170f01[_0x715d('0x39')]=_0x170f01[_0x715d('0x39')][_0x715d('0x4b')]?_0x170f01[_0x715d('0x39')]:_0x20ef53[_0x715d('0x35')];if(_0xa74994[_0x715d('0x36')][_0x715d('0x45')]){_0x170f01[_0x715d('0x46')]=[{'all':!![]}];}_0x170f01=_[_0x715d('0x42')]({},_0x170f01,_0xa74994['options']);return db[_0x715d('0x30')][_0x715d('0x4c')](_0x170f01)[_0x715d('0x28')](handleEntityNotFound(_0x3a32fa,null))['then'](respondWithResult(_0x3a32fa,null))['catch'](handleError(_0x3a32fa,null));};exports[_0x715d('0x4d')]=function(_0x3b6739,_0x52be65){return db['SquareOdbc'][_0x715d('0x4d')](_0x3b6739['body'],{})['then'](function(_0x520286){var _0x3d99e8=_0x3b6739[_0x715d('0x4e')][_0x715d('0x2a')]({'plain':!![]});if(!_0x3d99e8)throw new Error(_0x715d('0x4f'));if(_0x3d99e8[_0x715d('0x50')]===_0x715d('0x4e')){var _0x2daaf6=_0x520286[_0x715d('0x2a')]({'plain':!![]});var _0x577be6='ODBC';return db[_0x715d('0x51')][_0x715d('0x4c')]({'where':{'name':_0x577be6,'userProfileId':_0x3d99e8['userProfileId']},'raw':!![]})['then'](function(_0x1009ab){if(_0x1009ab&&_0x1009ab[_0x715d('0x52')]===0x0){return db[_0x715d('0x53')][_0x715d('0x4d')]({'name':_0x2daaf6[_0x715d('0x2c')],'resourceId':_0x2daaf6['id'],'type':_0x1009ab[_0x715d('0x2c')],'sectionId':_0x1009ab['id']},{})[_0x715d('0x28')](function(){return _0x520286;});}else{return _0x520286;}})[_0x715d('0x54')](function(_0x1eddf3){logger[_0x715d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1eddf3);throw _0x1eddf3;});}return _0x520286;})[_0x715d('0x28')](respondWithResult(_0x52be65,0xc9))[_0x715d('0x54')](handleError(_0x52be65,null));};exports[_0x715d('0x27')]=function(_0x4a0a8c,_0x2a2df9){if(_0x4a0a8c[_0x715d('0x55')]['id']){delete _0x4a0a8c[_0x715d('0x55')]['id'];}return db[_0x715d('0x30')][_0x715d('0x4c')]({'where':{'id':_0x4a0a8c[_0x715d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a2df9,null))['then'](saveUpdates(_0x4a0a8c[_0x715d('0x55')],null))[_0x715d('0x28')](respondWithResult(_0x2a2df9,null))[_0x715d('0x54')](handleError(_0x2a2df9,null));};exports[_0x715d('0x29')]=function(_0x523988,_0x3be0cd){return db['SquareOdbc'][_0x715d('0x4c')]({'where':{'id':_0x523988[_0x715d('0x4a')]['id']}})[_0x715d('0x28')](handleEntityNotFound(_0x3be0cd,null))[_0x715d('0x28')](removeEntity(_0x3be0cd,null))[_0x715d('0x54')](handleError(_0x3be0cd,null));};exports[_0x715d('0x56')]=function(_0x42d6dc,_0x1afaf8,_0x45ffad){var _0x5562df;return db['SquareOdbc'][_0x715d('0x4c')]({'where':{'id':_0x42d6dc[_0x715d('0x4a')]['id']},'attributes':['id',_0x715d('0x57')]})[_0x715d('0x28')](handleEntityNotFound(_0x1afaf8,null))[_0x715d('0x28')](function(_0x188af4){if(_0x188af4){var _0x323c2b=require(_0x715d('0x58'))();_0x323c2b[_0x715d('0x59')](_0x188af4[_0x715d('0x57')]);_0x323c2b[_0x715d('0x5a')]();return _0x188af4;}})[_0x715d('0x28')](respondWithResult(_0x1afaf8,null))['catch'](handleError(_0x1afaf8,null));}; \ No newline at end of file +var _0x02e6=['error','test','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','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/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','stack','name','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','rows','catch','params','intersection','include','merge','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x222bcc,_0x278c0e){var _0x4803df=function(_0x233f28){while(--_0x233f28){_0x222bcc['push'](_0x222bcc['shift']());}};_0x4803df(++_0x278c0e);}(_0x02e6,0x106));var _0x602e=function(_0x37a831,_0x58ff60){_0x37a831=_0x37a831-0x0;var _0x1a7cc6=_0x02e6[_0x37a831];return _0x1a7cc6;};'use strict';var emlformat=require(_0x602e('0x0'));var rimraf=require(_0x602e('0x1'));var zipdir=require(_0x602e('0x2'));var jsonpatch=require(_0x602e('0x3'));var rp=require(_0x602e('0x4'));var moment=require(_0x602e('0x5'));var BPromise=require(_0x602e('0x6'));var Mustache=require(_0x602e('0x7'));var util=require(_0x602e('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x602e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x602e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x602e('0xb'));var deskjs=require(_0x602e('0xc'));var toCsv=require(_0x602e('0xd'));var querystring=require(_0x602e('0xe'));var Papa=require('papaparse');var Redis=require(_0x602e('0xf'));var authService=require(_0x602e('0x10'));var qs=require(_0x602e('0x11'));var as=require(_0x602e('0x12'));var hardwareService=require(_0x602e('0x13'));var logger=require(_0x602e('0x14'))(_0x602e('0x15'));var utils=require(_0x602e('0x16'));var config=require(_0x602e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x602e('0x18'))['db'];function respondWithStatusCode(_0x54cd61,_0x76398a){_0x76398a=_0x76398a||0xcc;return function(_0x213205){if(_0x213205){return _0x54cd61[_0x602e('0x19')](_0x76398a);}return _0x54cd61[_0x602e('0x1a')](_0x76398a)['end']();};}function respondWithResult(_0x542efe,_0x2eca90){_0x2eca90=_0x2eca90||0xc8;return function(_0x38a5b7){if(_0x38a5b7){return _0x542efe[_0x602e('0x1a')](_0x2eca90)[_0x602e('0x1b')](_0x38a5b7);}};}function respondWithFilteredResult(_0x29b9dc,_0x508cf7){return function(_0x4976d0){if(_0x4976d0){var _0x516c30=typeof _0x508cf7[_0x602e('0x1c')]===_0x602e('0x1d')&&typeof _0x508cf7['limit']===_0x602e('0x1d');var _0x37d3c8=_0x4976d0['count'];var _0x253916=_0x516c30?0x0:_0x508cf7['offset'];var _0x3e9ed8=_0x516c30?_0x4976d0[_0x602e('0x1e')]:_0x508cf7[_0x602e('0x1c')]+_0x508cf7[_0x602e('0x1f')];var _0xe6d949;if(_0x3e9ed8>=_0x37d3c8){_0x3e9ed8=_0x37d3c8;_0xe6d949=0xc8;}else{_0xe6d949=0xce;}_0x29b9dc[_0x602e('0x1a')](_0xe6d949);return _0x29b9dc[_0x602e('0x20')](_0x602e('0x21'),_0x253916+'-'+_0x3e9ed8+'/'+_0x37d3c8)['json'](_0x4976d0);}return null;};}function patchUpdates(_0x4f0232){return function(_0xe8f69e){try{jsonpatch[_0x602e('0x22')](_0xe8f69e,_0x4f0232,!![]);}catch(_0x14daac){return BPromise[_0x602e('0x23')](_0x14daac);}return _0xe8f69e[_0x602e('0x24')]();};}function saveUpdates(_0x4cf2ca,_0x1208f0){return function(_0x3f5e81){if(_0x3f5e81){return _0x3f5e81['update'](_0x4cf2ca)[_0x602e('0x25')](function(_0x33e416){return _0x33e416;});}return null;};}function removeEntity(_0x3d139d,_0xe33995){return function(_0x51e062){if(_0x51e062){return _0x51e062[_0x602e('0x26')]()['then'](function(){var _0x32cabd=_0x51e062[_0x602e('0x27')]({'plain':!![]});var _0x1b2664='ODBC';return db[_0x602e('0x28')][_0x602e('0x26')]({'where':{'type':_0x1b2664,'resourceId':_0x32cabd['id']}})[_0x602e('0x25')](function(){return _0x51e062;});})['then'](function(){_0x3d139d[_0x602e('0x1a')](0xcc)[_0x602e('0x29')]();});}};}function handleEntityNotFound(_0x11f9b5,_0x5720d6){return function(_0x56f033){if(!_0x56f033){_0x11f9b5[_0x602e('0x19')](0x194);}return _0x56f033;};}function handleError(_0x29ff67,_0x268be2){_0x268be2=_0x268be2||0x1f4;return function(_0x5c8e0a){logger['error'](_0x5c8e0a[_0x602e('0x2a')]);if(_0x5c8e0a[_0x602e('0x2b')]){delete _0x5c8e0a[_0x602e('0x2b')];}_0x29ff67['status'](_0x268be2)['send'](_0x5c8e0a);};}exports[_0x602e('0x2c')]=function(_0x26466f,_0x5defcc){var _0x5c43d7={},_0xa5be35={},_0x187515={'count':0x0,'rows':[]};var _0x4c8a88=_['map'](db[_0x602e('0x2d')][_0x602e('0x2e')],function(_0x2ce850){return{'name':_0x2ce850[_0x602e('0x2f')],'type':_0x2ce850[_0x602e('0x30')][_0x602e('0x31')]};});_0xa5be35[_0x602e('0x32')]=_[_0x602e('0x33')](_0x4c8a88,'name');_0xa5be35[_0x602e('0x34')]=_[_0x602e('0x35')](_0x26466f['query']);_0xa5be35[_0x602e('0x36')]=_['intersection'](_0xa5be35[_0x602e('0x32')],_0xa5be35[_0x602e('0x34')]);_0x5c43d7[_0x602e('0x37')]=_['intersection'](_0xa5be35[_0x602e('0x32')],qs['fields'](_0x26466f[_0x602e('0x34')][_0x602e('0x38')]));_0x5c43d7[_0x602e('0x37')]=_0x5c43d7[_0x602e('0x37')][_0x602e('0x39')]?_0x5c43d7[_0x602e('0x37')]:_0xa5be35[_0x602e('0x32')];if(!_0x26466f[_0x602e('0x34')][_0x602e('0x3a')](_0x602e('0x3b'))){_0x5c43d7['limit']=qs[_0x602e('0x1f')](_0x26466f[_0x602e('0x34')]['limit']);_0x5c43d7['offset']=qs['offset'](_0x26466f['query'][_0x602e('0x1c')]);}_0x5c43d7[_0x602e('0x3c')]=qs[_0x602e('0x3d')](_0x26466f[_0x602e('0x34')][_0x602e('0x3d')]);_0x5c43d7[_0x602e('0x3e')]=qs[_0x602e('0x36')](_[_0x602e('0x3f')](_0x26466f[_0x602e('0x34')],_0xa5be35['filters']),_0x4c8a88);if(_0x26466f['query']['filter']){_0x5c43d7[_0x602e('0x3e')]=_['merge'](_0x5c43d7[_0x602e('0x3e')],{'$or':_[_0x602e('0x33')](_0x4c8a88,function(_0x160858){if(_0x160858[_0x602e('0x30')]!==_0x602e('0x40')){var _0x55f91d={};_0x55f91d[_0x160858['name']]={'$like':'%'+_0x26466f[_0x602e('0x34')][_0x602e('0x41')]+'%'};return _0x55f91d;}})});}_0x5c43d7=_['merge']({},_0x5c43d7,_0x26466f['options']);var _0xed33c2={'where':_0x5c43d7[_0x602e('0x3e')]};return db[_0x602e('0x2d')][_0x602e('0x1e')](_0xed33c2)[_0x602e('0x25')](function(_0x436a4b){_0x187515['count']=_0x436a4b;if(_0x26466f[_0x602e('0x34')][_0x602e('0x42')]){_0x5c43d7['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x5c43d7);})[_0x602e('0x25')](function(_0x404835){_0x187515[_0x602e('0x43')]=_0x404835;return _0x187515;})[_0x602e('0x25')](respondWithFilteredResult(_0x5defcc,_0x5c43d7))[_0x602e('0x44')](handleError(_0x5defcc,null));};exports['show']=function(_0x16f0e6,_0x207173){var _0x16934c={'raw':!![],'where':{'id':_0x16f0e6[_0x602e('0x45')]['id']}},_0x31a1a1={};_0x31a1a1[_0x602e('0x32')]=_['keys'](db[_0x602e('0x2d')][_0x602e('0x2e')]);_0x31a1a1[_0x602e('0x34')]=_[_0x602e('0x35')](_0x16f0e6[_0x602e('0x34')]);_0x31a1a1[_0x602e('0x36')]=_['intersection'](_0x31a1a1[_0x602e('0x32')],_0x31a1a1['query']);_0x16934c[_0x602e('0x37')]=_[_0x602e('0x46')](_0x31a1a1[_0x602e('0x32')],qs[_0x602e('0x38')](_0x16f0e6[_0x602e('0x34')][_0x602e('0x38')]));_0x16934c[_0x602e('0x37')]=_0x16934c[_0x602e('0x37')]['length']?_0x16934c[_0x602e('0x37')]:_0x31a1a1[_0x602e('0x32')];if(_0x16f0e6[_0x602e('0x34')][_0x602e('0x42')]){_0x16934c[_0x602e('0x47')]=[{'all':!![]}];}_0x16934c=_[_0x602e('0x48')]({},_0x16934c,_0x16f0e6[_0x602e('0x49')]);return db['SquareOdbc']['find'](_0x16934c)[_0x602e('0x25')](handleEntityNotFound(_0x207173,null))[_0x602e('0x25')](respondWithResult(_0x207173,null))[_0x602e('0x44')](handleError(_0x207173,null));};exports['create']=function(_0xdd6eb4,_0x79ba3c){return db['SquareOdbc'][_0x602e('0x4a')](_0xdd6eb4[_0x602e('0x4b')],{})[_0x602e('0x25')](function(_0x17431a){var _0x574b62=_0xdd6eb4[_0x602e('0x4c')]['get']({'plain':!![]});if(!_0x574b62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x574b62[_0x602e('0x4d')]===_0x602e('0x4c')){var _0x5982bf=_0x17431a[_0x602e('0x27')]({'plain':!![]});var _0x1ec39c='ODBC';return db[_0x602e('0x4e')][_0x602e('0x4f')]({'where':{'name':_0x1ec39c,'userProfileId':_0x574b62[_0x602e('0x50')]},'raw':!![]})[_0x602e('0x25')](function(_0x3f3507){if(_0x3f3507&&_0x3f3507[_0x602e('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x5982bf[_0x602e('0x2b')],'resourceId':_0x5982bf['id'],'type':_0x3f3507[_0x602e('0x2b')],'sectionId':_0x3f3507['id']},{})[_0x602e('0x25')](function(){return _0x17431a;});}else{return _0x17431a;}})[_0x602e('0x44')](function(_0x484dd1){logger[_0x602e('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x484dd1);throw _0x484dd1;});}return _0x17431a;})[_0x602e('0x25')](respondWithResult(_0x79ba3c,0xc9))['catch'](handleError(_0x79ba3c,null));};exports['update']=function(_0x10bc8f,_0x1aace3){if(_0x10bc8f[_0x602e('0x4b')]['id']){delete _0x10bc8f[_0x602e('0x4b')]['id'];}return db[_0x602e('0x2d')][_0x602e('0x4f')]({'where':{'id':_0x10bc8f[_0x602e('0x45')]['id']}})[_0x602e('0x25')](handleEntityNotFound(_0x1aace3,null))['then'](saveUpdates(_0x10bc8f[_0x602e('0x4b')],null))[_0x602e('0x25')](respondWithResult(_0x1aace3,null))[_0x602e('0x44')](handleError(_0x1aace3,null));};exports[_0x602e('0x26')]=function(_0x45a5c5,_0x1088e1){return db[_0x602e('0x2d')][_0x602e('0x4f')]({'where':{'id':_0x45a5c5[_0x602e('0x45')]['id']}})['then'](handleEntityNotFound(_0x1088e1,null))[_0x602e('0x25')](removeEntity(_0x1088e1,null))['catch'](handleError(_0x1088e1,null));};exports[_0x602e('0x53')]=function(_0x1b2867,_0xbcf93a,_0xde3496){var _0x1d0a6a;return db[_0x602e('0x2d')][_0x602e('0x4f')]({'where':{'id':_0x1b2867[_0x602e('0x45')]['id']},'attributes':['id','dsn']})[_0x602e('0x25')](handleEntityNotFound(_0xbcf93a,null))['then'](function(_0x3f288b){if(_0x3f288b){var _0x3ad6a6=require(_0x602e('0x54'))();_0x3ad6a6[_0x602e('0x55')](_0x3f288b['dsn']);_0x3ad6a6['closeSync']();return _0x3f288b;}})['then'](respondWithResult(_0xbcf93a,null))[_0x602e('0x44')](handleError(_0xbcf93a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3001b84..6f463e9 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 _0x2f98=['api','moment','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger'];(function(_0x4e661b,_0xbed4e5){var _0x32671b=function(_0x3fa4db){while(--_0x3fa4db){_0x4e661b['push'](_0x4e661b['shift']());}};_0x32671b(++_0xbed4e5);}(_0x2f98,0x69));var _0x82f9=function(_0x1d81ec,_0x141f23){_0x1d81ec=_0x1d81ec-0x0;var _0x3f255f=_0x2f98[_0x1d81ec];return _0x3f255f;};'use strict';var _=require(_0x82f9('0x0'));var util=require(_0x82f9('0x1'));var logger=require(_0x82f9('0x2'))(_0x82f9('0x3'));var moment=require(_0x82f9('0x4'));var BPromise=require('bluebird');var rp=require(_0x82f9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82f9('0x6'));var config=require(_0x82f9('0x7'));var attributes=require(_0x82f9('0x8'));module[_0x82f9('0x9')]=function(_0x51c9c4,_0x1cd0d0){return _0x51c9c4[_0x82f9('0xa')](_0x82f9('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ae5=['moment','bluebird','request-promise','path','exports','SquareOdbc','lodash','util','../../config/logger','api'];(function(_0x25fd7f,_0x1fc310){var _0x558eac=function(_0x47c161){while(--_0x47c161){_0x25fd7f['push'](_0x25fd7f['shift']());}};_0x558eac(++_0x1fc310);}(_0x8ae5,0x74));var _0x58ae=function(_0x7aea70,_0x4c89e1){_0x7aea70=_0x7aea70-0x0;var _0x358c35=_0x8ae5[_0x7aea70];return _0x358c35;};'use strict';var _=require(_0x58ae('0x0'));var util=require(_0x58ae('0x1'));var logger=require(_0x58ae('0x2'))(_0x58ae('0x3'));var moment=require(_0x58ae('0x4'));var BPromise=require(_0x58ae('0x5'));var rp=require(_0x58ae('0x6'));var fs=require('fs');var path=require(_0x58ae('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x58ae('0x8')]=function(_0x1f7a09,_0x1c981d){return _0x1f7a09['define'](_0x58ae('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index b503709..c19d3a2 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 _0x4fee=['map','include','attributes','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw'];(function(_0x232006,_0x3d75e3){var _0x2d483c=function(_0x319c55){while(--_0x319c55){_0x232006['push'](_0x232006['shift']());}};_0x2d483c(++_0x3d75e3);}(_0x4fee,0xb4));var _0xe4fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe4fe('0x0'));var util=require(_0xe4fe('0x1'));var moment=require(_0xe4fe('0x2'));var BPromise=require(_0xe4fe('0x3'));var rs=require(_0xe4fe('0x4'));var fs=require('fs');var Redis=require(_0xe4fe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4fe('0x6'));var logger=require(_0xe4fe('0x7'))(_0xe4fe('0x8'));var config=require(_0xe4fe('0x9'));var jayson=require(_0xe4fe('0xa'));var client=jayson[_0xe4fe('0xb')][_0xe4fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x287bb0,_0x407d93,_0x107502){return new BPromise(function(_0x17a5fc,_0x33949d){return client[_0xe4fe('0xd')](_0x287bb0,_0x107502)[_0xe4fe('0xe')](function(_0x1ec666){logger[_0xe4fe('0xf')](_0xe4fe('0x10'),_0x407d93,_0xe4fe('0x11'));logger['debug'](_0xe4fe('0x12'),_0x407d93,_0xe4fe('0x11'),JSON[_0xe4fe('0x13')](_0x1ec666));if(_0x1ec666[_0xe4fe('0x14')]){if(_0x1ec666[_0xe4fe('0x14')][_0xe4fe('0x15')]===0x1f4){logger[_0xe4fe('0x14')](_0xe4fe('0x10'),_0x407d93,_0x1ec666['error'][_0xe4fe('0x16')]);return _0x33949d(_0x1ec666[_0xe4fe('0x14')][_0xe4fe('0x16')]);}logger[_0xe4fe('0x14')](_0xe4fe('0x10'),_0x407d93,_0x1ec666[_0xe4fe('0x14')][_0xe4fe('0x16')]);return _0x17a5fc(_0x1ec666['error'][_0xe4fe('0x16')]);}else{logger[_0xe4fe('0xf')](_0xe4fe('0x10'),_0x407d93,'request\x20sent');_0x17a5fc(_0x1ec666[_0xe4fe('0x17')][_0xe4fe('0x16')]);}})[_0xe4fe('0x18')](function(_0x409a2a){logger[_0xe4fe('0x14')](_0xe4fe('0x10'),_0x407d93,_0x409a2a);_0x33949d(_0x409a2a);});});}exports[_0xe4fe('0x19')]=function(_0x52f741){var _0x25376f=this;return new Promise(function(_0x18fe59,_0x2fed92){return db[_0xe4fe('0x1a')][_0xe4fe('0x1b')]({'raw':_0x52f741[_0xe4fe('0x1c')]?_0x52f741[_0xe4fe('0x1c')][_0xe4fe('0x1d')]===undefined?!![]:![]:!![],'where':_0x52f741[_0xe4fe('0x1c')]?_0x52f741[_0xe4fe('0x1c')]['where']||null:null,'attributes':_0x52f741[_0xe4fe('0x1c')]?_0x52f741[_0xe4fe('0x1c')]['attributes']||null:null,'include':_0x52f741['options']?_0x52f741[_0xe4fe('0x1c')]['include']?_[_0xe4fe('0x1e')](_0x52f741[_0xe4fe('0x1c')][_0xe4fe('0x1f')],function(_0x5c8627){return{'model':db[_0x5c8627['model']],'as':_0x5c8627['as'],'attributes':_0x5c8627[_0xe4fe('0x20')],'include':_0x5c8627[_0xe4fe('0x1f')]?_[_0xe4fe('0x1e')](_0x5c8627[_0xe4fe('0x1f')],function(_0x20ac8c){return{'model':db[_0x20ac8c[_0xe4fe('0x21')]],'as':_0x20ac8c['as'],'attributes':_0x20ac8c['attributes'],'include':_0x20ac8c[_0xe4fe('0x1f')]?_[_0xe4fe('0x1e')](_0x20ac8c[_0xe4fe('0x1f')],function(_0xf885dc){return{'model':db[_0xf885dc[_0xe4fe('0x21')]],'as':_0xf885dc['as'],'attributes':_0xf885dc[_0xe4fe('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe4fe('0xe')](function(_0x3bbb93){logger[_0xe4fe('0xf')](_0xe4fe('0x19'),_0x52f741);logger[_0xe4fe('0x22')](_0xe4fe('0x19'),_0x52f741,JSON[_0xe4fe('0x13')](_0x3bbb93));_0x18fe59(_0x3bbb93);})['catch'](function(_0x4e46b6){logger[_0xe4fe('0x14')](_0xe4fe('0x19'),_0x4e46b6[_0xe4fe('0x16')],_0x52f741);_0x2fed92(_0x25376f[_0xe4fe('0x14')](0x1f4,_0x4e46b6[_0xe4fe('0x16')]));});});}; \ No newline at end of file +var _0x146c=['result','catch','ShowSquareOdbc','SquareOdbc','options','where','map','model','attributes','include','debug','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3f5bf5,_0x498786){var _0x59e229=function(_0x57aac2){while(--_0x57aac2){_0x3f5bf5['push'](_0x3f5bf5['shift']());}};_0x59e229(++_0x498786);}(_0x146c,0x9c));var _0xc146=function(_0x48c9de,_0x3c47bb){_0x48c9de=_0x48c9de-0x0;var _0x2a315e=_0x146c[_0x48c9de];return _0x2a315e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc146('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc146('0x1'));var db=require(_0xc146('0x2'))['db'];var utils=require(_0xc146('0x3'));var logger=require(_0xc146('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc146('0x5'));var client=jayson[_0xc146('0x6')][_0xc146('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2dc1d1,_0x1bdba7,_0x95af0){return new BPromise(function(_0x98328d,_0x5a6d0d){return client[_0xc146('0x8')](_0x2dc1d1,_0x95af0)[_0xc146('0x9')](function(_0x2c1c10){logger['info'](_0xc146('0xa'),_0x1bdba7,_0xc146('0xb'));logger['debug'](_0xc146('0xc'),_0x1bdba7,'request\x20sent',JSON[_0xc146('0xd')](_0x2c1c10));if(_0x2c1c10[_0xc146('0xe')]){if(_0x2c1c10[_0xc146('0xe')][_0xc146('0xf')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1bdba7,_0x2c1c10[_0xc146('0xe')][_0xc146('0x10')]);return _0x5a6d0d(_0x2c1c10[_0xc146('0xe')][_0xc146('0x10')]);}logger[_0xc146('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x1bdba7,_0x2c1c10['error'][_0xc146('0x10')]);return _0x98328d(_0x2c1c10[_0xc146('0xe')][_0xc146('0x10')]);}else{logger[_0xc146('0x11')](_0xc146('0xa'),_0x1bdba7,_0xc146('0xb'));_0x98328d(_0x2c1c10[_0xc146('0x12')][_0xc146('0x10')]);}})[_0xc146('0x13')](function(_0x41fe57){logger[_0xc146('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x1bdba7,_0x41fe57);_0x5a6d0d(_0x41fe57);});});}exports[_0xc146('0x14')]=function(_0x24ffcc){var _0x239cd8=this;return new Promise(function(_0x7994f9,_0x4b3a5a){return db[_0xc146('0x15')]['find']({'raw':_0x24ffcc[_0xc146('0x16')]?_0x24ffcc[_0xc146('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x24ffcc['options']?_0x24ffcc[_0xc146('0x16')][_0xc146('0x17')]||null:null,'attributes':_0x24ffcc[_0xc146('0x16')]?_0x24ffcc[_0xc146('0x16')]['attributes']||null:null,'include':_0x24ffcc[_0xc146('0x16')]?_0x24ffcc[_0xc146('0x16')]['include']?_[_0xc146('0x18')](_0x24ffcc['options']['include'],function(_0x1f4819){return{'model':db[_0x1f4819[_0xc146('0x19')]],'as':_0x1f4819['as'],'attributes':_0x1f4819[_0xc146('0x1a')],'include':_0x1f4819[_0xc146('0x1b')]?_[_0xc146('0x18')](_0x1f4819[_0xc146('0x1b')],function(_0x4daadb){return{'model':db[_0x4daadb[_0xc146('0x19')]],'as':_0x4daadb['as'],'attributes':_0x4daadb[_0xc146('0x1a')],'include':_0x4daadb[_0xc146('0x1b')]?_['map'](_0x4daadb[_0xc146('0x1b')],function(_0x4bcbc4){return{'model':db[_0x4bcbc4[_0xc146('0x19')]],'as':_0x4bcbc4['as'],'attributes':_0x4bcbc4[_0xc146('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc146('0x9')](function(_0x5adae6){logger[_0xc146('0x11')](_0xc146('0x14'),_0x24ffcc);logger[_0xc146('0x1c')](_0xc146('0x14'),_0x24ffcc,JSON['stringify'](_0x5adae6));_0x7994f9(_0x5adae6);})['catch'](function(_0x4db86f){logger[_0xc146('0xe')]('ShowSquareOdbc',_0x4db86f[_0xc146('0x10')],_0x24ffcc);_0x4b3a5a(_0x239cd8[_0xc146('0xe')](0x1f4,_0x4db86f[_0xc146('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index cc746f4..7886f19 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 _0x84bb=['./squareProject.controller','isAuthenticated','index','get','/:id','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x598eec,_0x3a359c){var _0x15efed=function(_0x5c7d92){while(--_0x5c7d92){_0x598eec['push'](_0x598eec['shift']());}};_0x15efed(++_0x3a359c);}(_0x84bb,0x1a2));var _0xb84b=function(_0x4222e4,_0x25096f){_0x4222e4=_0x4222e4-0x0;var _0x4bfa29=_0x84bb[_0x4222e4];return _0x4bfa29;};'use strict';var multer=require('multer');var util=require(_0xb84b('0x0'));var path=require('path');var timeout=require(_0xb84b('0x1'));var express=require('express');var router=express[_0xb84b('0x2')]();var fs_extra=require(_0xb84b('0x3'));var auth=require(_0xb84b('0x4'));var interaction=require(_0xb84b('0x5'));var config=require(_0xb84b('0x6'));var controller=require(_0xb84b('0x7'));router['get']('/',auth[_0xb84b('0x8')](),controller[_0xb84b('0x9')]);router[_0xb84b('0xa')](_0xb84b('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb84b('0x8')](),controller[_0xb84b('0xc')]);router[_0xb84b('0xd')]('/:id',auth[_0xb84b('0x8')](),controller[_0xb84b('0xe')]);router['delete']('/:id',auth[_0xb84b('0x8')](),controller[_0xb84b('0xf')]);module[_0xb84b('0x10')]=router; \ No newline at end of file +var _0xff69=['../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a8a92,_0x3d6e3b){var _0xb00996=function(_0x3d79c1){while(--_0x3d79c1){_0x2a8a92['push'](_0x2a8a92['shift']());}};_0xb00996(++_0x3d6e3b);}(_0xff69,0x10b));var _0x9ff6=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0xff69[_0x406e46];return _0x4a3742;};'use strict';var multer=require(_0x9ff6('0x0'));var util=require('util');var path=require(_0x9ff6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9ff6('0x2'));var auth=require(_0x9ff6('0x3'));var interaction=require(_0x9ff6('0x4'));var config=require(_0x9ff6('0x5'));var controller=require(_0x9ff6('0x6'));router[_0x9ff6('0x7')]('/',auth[_0x9ff6('0x8')](),controller['index']);router['get'](_0x9ff6('0x9'),auth[_0x9ff6('0x8')](),controller[_0x9ff6('0xa')]);router[_0x9ff6('0xb')]('/',auth[_0x9ff6('0x8')](),controller[_0x9ff6('0xc')]);router['put'](_0x9ff6('0x9'),auth[_0x9ff6('0x8')](),controller['update']);router[_0x9ff6('0xd')](_0x9ff6('0x9'),auth[_0x9ff6('0x8')](),controller[_0x9ff6('0xe')]);module[_0x9ff6('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 2b9a38b..af60436 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 _0xd72d=['BLOB','long','getDataValue','preproduction','utf8','production','toString','DATE','sequelize','STRING','TEXT'];(function(_0x18c4a8,_0x96c52e){var _0x189ff1=function(_0x4a3ea8){while(--_0x4a3ea8){_0x18c4a8['push'](_0x18c4a8['shift']());}};_0x189ff1(++_0x96c52e);}(_0xd72d,0x17e));var _0xdd72=function(_0x85ba5c,_0x57a633){_0x85ba5c=_0x85ba5c-0x0;var _0x1e4934=_0xd72d[_0x85ba5c];return _0x1e4934;};'use strict';var Sequelize=require(_0xdd72('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xdd72('0x1')]},'notes':{'type':Sequelize[_0xdd72('0x2')]},'preproduction':{'type':Sequelize[_0xdd72('0x3')](_0xdd72('0x4')),'get':function(){if(this[_0xdd72('0x5')](_0xdd72('0x6'))){return this[_0xdd72('0x5')](_0xdd72('0x6'))['toString'](_0xdd72('0x7'));}}},'production':{'type':Sequelize[_0xdd72('0x3')]('long'),'get':function(){if(this[_0xdd72('0x5')](_0xdd72('0x8'))){return this['getDataValue']('production')[_0xdd72('0x9')](_0xdd72('0x7'));}}},'savedAt':{'type':Sequelize[_0xdd72('0xa')]},'publishedAt':{'type':Sequelize[_0xdd72('0xa')]}}; \ No newline at end of file +var _0x9976=['getDataValue','preproduction','production','toString','DATE','exports','STRING','TEXT','BLOB','long'];(function(_0x132aed,_0x2a163c){var _0x3fefa2=function(_0x202948){while(--_0x202948){_0x132aed['push'](_0x132aed['shift']());}};_0x3fefa2(++_0x2a163c);}(_0x9976,0x113));var _0x6997=function(_0x433711,_0x5b2510){_0x433711=_0x433711-0x0;var _0x5447fb=_0x9976[_0x433711];return _0x5447fb;};'use strict';var Sequelize=require('sequelize');module[_0x6997('0x0')]={'name':{'type':Sequelize[_0x6997('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6997('0x1')]},'notes':{'type':Sequelize[_0x6997('0x2')]},'preproduction':{'type':Sequelize[_0x6997('0x3')](_0x6997('0x4')),'get':function(){if(this[_0x6997('0x5')](_0x6997('0x6'))){return this['getDataValue'](_0x6997('0x6'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x6997('0x3')]('long'),'get':function(){if(this[_0x6997('0x5')](_0x6997('0x7'))){return this['getDataValue']('production')[_0x6997('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x6997('0x9')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 849390e..7f1cc00 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 _0xf3e9=['name','send','index','SquareProject','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','map','type','filter','merge','findAll','rows','show','params','includeAll','include','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','pick','production','lodash','ioredis','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','publish','stringify','end','sendStatus','stack'];(function(_0x560f19,_0x42c7cd){var _0x216495=function(_0x1c938e){while(--_0x1c938e){_0x560f19['push'](_0x560f19['shift']());}};_0x216495(++_0x42c7cd);}(_0xf3e9,0xf8));var _0x9f3e=function(_0x58ef48,_0x19b43f){_0x58ef48=_0x58ef48-0x0;var _0x5a1431=_0xf3e9[_0x58ef48];return _0x5a1431;};'use strict';var _=require(_0x9f3e('0x0'));var Redis=require(_0x9f3e('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x9f3e('0x2'));var db=require(_0x9f3e('0x3'))['db'];config['redis']=_[_0x9f3e('0x4')](config[_0x9f3e('0x5')],{'host':_0x9f3e('0x6'),'port':0x18eb});var socket=require(_0x9f3e('0x7'))(new Redis(config[_0x9f3e('0x5')]));require(_0x9f3e('0x8'))[_0x9f3e('0x9')](socket);function respondWithResult(_0x57d50e,_0x220956){_0x220956=_0x220956||0xc8;return function(_0x31d925){if(_0x31d925){return _0x57d50e[_0x9f3e('0xa')](_0x220956)[_0x9f3e('0xb')](_0x31d925);}};}function respondWithFilteredResult(_0x13cdd7,_0x1b0121){return function(_0x106eee){if(_0x106eee){var _0x8bfe2e=typeof _0x1b0121[_0x9f3e('0xc')]==='undefined'&&typeof _0x1b0121[_0x9f3e('0xd')]===_0x9f3e('0xe');var _0x34626f=_0x106eee[_0x9f3e('0xf')];var _0x328d41=_0x8bfe2e?0x0:_0x1b0121['offset'];var _0x3eefd4=_0x8bfe2e?_0x106eee['count']:_0x1b0121[_0x9f3e('0xc')]+_0x1b0121[_0x9f3e('0xd')];var _0x56e99e;if(_0x3eefd4>=_0x34626f){_0x3eefd4=_0x34626f;_0x56e99e=0xc8;}else{_0x56e99e=0xce;}_0x13cdd7[_0x9f3e('0xa')](_0x56e99e);return _0x13cdd7[_0x9f3e('0x10')](_0x9f3e('0x11'),_0x328d41+'-'+_0x3eefd4+'/'+_0x34626f)[_0x9f3e('0xb')](_0x106eee);}return null;};}function saveUpdates(_0x335f7b){return function(_0x350c34){if(_0x350c34){return _0x350c34[_0x9f3e('0x12')](_0x335f7b)[_0x9f3e('0x13')](function(_0x4432ab){return _0x4432ab;});}return null;};}function removeEntity(_0x559e8d){return function(_0x3eec5e){if(_0x3eec5e){return _0x3eec5e[_0x9f3e('0x14')]()['then'](function(){var _0x5b5691=_0x3eec5e['get']({'plain':!![]});var _0x912ddc=_0x9f3e('0x15');return db[_0x9f3e('0x16')][_0x9f3e('0x14')]({'where':{'type':_0x912ddc,'resourceId':_0x5b5691['id']}})[_0x9f3e('0x13')](function(){return _0x3eec5e;});})[_0x9f3e('0x13')](function(){var _0x2ac1bf=new Redis(config[_0x9f3e('0x5')]);_0x2ac1bf[_0x9f3e('0x17')]('agi',JSON[_0x9f3e('0x18')]({'id':_0x3eec5e['id'],'deleted':!![]}));})[_0x9f3e('0x13')](function(){_0x559e8d[_0x9f3e('0xa')](0xcc)[_0x9f3e('0x19')]();});}};}function handleEntityNotFound(_0x3d180e){return function(_0x62d35c){if(!_0x62d35c){_0x3d180e[_0x9f3e('0x1a')](0x194);}return _0x62d35c;};}function handleError(_0x4ebf05,_0x351f54){_0x351f54=_0x351f54||0x1f4;return function(_0x36224d){logger['error'](_0x36224d[_0x9f3e('0x1b')]);if(_0x36224d[_0x9f3e('0x1c')]){delete _0x36224d[_0x9f3e('0x1c')];}_0x4ebf05[_0x9f3e('0xa')](_0x351f54)[_0x9f3e('0x1d')](_0x36224d);};}exports[_0x9f3e('0x1e')]=function(_0x5850c4,_0x4de942){var _0x313bde={},_0x7c97a2={},_0x16f32f={'count':0x0,'rows':[]};var _0x208881=_['map'](db[_0x9f3e('0x1f')][_0x9f3e('0x20')],function(_0x35667a){return{'name':_0x35667a['fieldName'],'type':_0x35667a['type']['key']};});_0x7c97a2['model']=_['map'](_0x208881,_0x9f3e('0x1c'));_0x7c97a2['query']=_[_0x9f3e('0x21')](_0x5850c4[_0x9f3e('0x22')]);_0x7c97a2[_0x9f3e('0x23')]=_[_0x9f3e('0x24')](_0x7c97a2[_0x9f3e('0x25')],_0x7c97a2['query']);_0x313bde[_0x9f3e('0x26')]=_['intersection'](_0x7c97a2['model'],qs[_0x9f3e('0x27')](_0x5850c4[_0x9f3e('0x22')]['fields']));_0x313bde[_0x9f3e('0x26')]=_0x313bde[_0x9f3e('0x26')][_0x9f3e('0x28')]?_0x313bde['attributes']:_0x7c97a2[_0x9f3e('0x25')];if(!_0x5850c4['query'][_0x9f3e('0x29')](_0x9f3e('0x2a'))){_0x313bde[_0x9f3e('0xd')]=qs[_0x9f3e('0xd')](_0x5850c4[_0x9f3e('0x22')][_0x9f3e('0xd')]);_0x313bde[_0x9f3e('0xc')]=qs['offset'](_0x5850c4['query'][_0x9f3e('0xc')]);}_0x313bde[_0x9f3e('0x2b')]=qs[_0x9f3e('0x2c')](_0x5850c4[_0x9f3e('0x22')]['sort']);_0x313bde[_0x9f3e('0x2d')]=qs['filters'](_['pick'](_0x5850c4[_0x9f3e('0x22')],_0x7c97a2['filters']),_0x208881);if(_0x5850c4[_0x9f3e('0x22')]['filter']){_0x313bde['where']=_['merge'](_0x313bde[_0x9f3e('0x2d')],{'$or':_[_0x9f3e('0x2e')](_0x208881,function(_0x31af06){if(_0x31af06[_0x9f3e('0x2f')]!=='VIRTUAL'){var _0x56f00d={};_0x56f00d[_0x31af06[_0x9f3e('0x1c')]]={'$like':'%'+_0x5850c4[_0x9f3e('0x22')][_0x9f3e('0x30')]+'%'};return _0x56f00d;}})});}_0x313bde=_[_0x9f3e('0x31')]({},_0x313bde,_0x5850c4['options']);var _0x31787e={'where':_0x313bde['where']};return db['SquareProject']['count'](_0x31787e)[_0x9f3e('0x13')](function(_0x32a7ca){_0x16f32f[_0x9f3e('0xf')]=_0x32a7ca;if(_0x5850c4[_0x9f3e('0x22')]['includeAll']){_0x313bde['include']=[{'all':!![]}];}return db[_0x9f3e('0x1f')][_0x9f3e('0x32')](_0x313bde);})[_0x9f3e('0x13')](function(_0x3b9010){_0x16f32f[_0x9f3e('0x33')]=_0x3b9010;return _0x16f32f;})[_0x9f3e('0x13')](respondWithFilteredResult(_0x4de942,_0x313bde))['catch'](handleError(_0x4de942,null));};exports[_0x9f3e('0x34')]=function(_0x1139e9,_0x42bc7c){var _0x2ea4c9={'raw':![],'where':{'id':_0x1139e9[_0x9f3e('0x35')]['id']}},_0xfef91d={};_0xfef91d[_0x9f3e('0x25')]=_[_0x9f3e('0x21')](db[_0x9f3e('0x1f')][_0x9f3e('0x20')]);_0xfef91d[_0x9f3e('0x22')]=_['keys'](_0x1139e9[_0x9f3e('0x22')]);_0xfef91d[_0x9f3e('0x23')]=_[_0x9f3e('0x24')](_0xfef91d[_0x9f3e('0x25')],_0xfef91d[_0x9f3e('0x22')]);_0x2ea4c9[_0x9f3e('0x26')]=_['intersection'](_0xfef91d[_0x9f3e('0x25')],qs[_0x9f3e('0x27')](_0x1139e9['query'][_0x9f3e('0x27')]));_0x2ea4c9[_0x9f3e('0x26')]=_0x2ea4c9[_0x9f3e('0x26')]['length']?_0x2ea4c9['attributes']:_0xfef91d['model'];if(_0x1139e9['query'][_0x9f3e('0x36')]){_0x2ea4c9[_0x9f3e('0x37')]=[{'all':!![]}];}_0x2ea4c9=_['merge']({},_0x2ea4c9,_0x1139e9['options']);return db['SquareProject'][_0x9f3e('0x38')](_0x2ea4c9)[_0x9f3e('0x13')](handleEntityNotFound(_0x42bc7c,null))['then'](respondWithResult(_0x42bc7c,null))[_0x9f3e('0x39')](handleError(_0x42bc7c,null));};exports[_0x9f3e('0x3a')]=function(_0x50439d,_0x3ac8a6){return db[_0x9f3e('0x1f')][_0x9f3e('0x3a')](_0x50439d['body'],{})[_0x9f3e('0x13')](function(_0x5d454d){var _0xcb15c1=_0x50439d[_0x9f3e('0x3b')][_0x9f3e('0x3c')]({'plain':!![]});if(!_0xcb15c1)throw new Error(_0x9f3e('0x3d'));if(_0xcb15c1['role']===_0x9f3e('0x3b')){var _0x277c71=_0x5d454d[_0x9f3e('0x3c')]({'plain':!![]});var _0x5ea1bf=_0x9f3e('0x15');return db[_0x9f3e('0x3e')][_0x9f3e('0x38')]({'where':{'name':_0x5ea1bf,'userProfileId':_0xcb15c1[_0x9f3e('0x3f')]},'raw':!![]})['then'](function(_0x20b429){if(_0x20b429&&_0x20b429['autoAssociation']===0x0){return db[_0x9f3e('0x16')]['create']({'name':_0x277c71['name'],'resourceId':_0x277c71['id'],'type':_0x20b429[_0x9f3e('0x1c')],'sectionId':_0x20b429['id']},{})[_0x9f3e('0x13')](function(){return _0x5d454d;});}else{return _0x5d454d;}})[_0x9f3e('0x39')](function(_0x16304b){logger[_0x9f3e('0x40')](_0x9f3e('0x41'),_0x16304b);throw _0x16304b;});}return _0x5d454d;})[_0x9f3e('0x13')](respondWithResult(_0x3ac8a6,0xc9))['catch'](handleError(_0x3ac8a6,null));};exports[_0x9f3e('0x12')]=function(_0x3085b1,_0x3886b0){if(_0x3085b1[_0x9f3e('0x42')]['id']){delete _0x3085b1[_0x9f3e('0x42')]['id'];}return db[_0x9f3e('0x1f')]['find']({'where':{'id':_0x3085b1[_0x9f3e('0x35')]['id']}})['then'](handleEntityNotFound(_0x3886b0,null))[_0x9f3e('0x13')](saveUpdates(_0x3085b1[_0x9f3e('0x42')],null))[_0x9f3e('0x13')](function(_0x273e30){if(!_0x273e30)return;var _0x588c2c=_0x273e30[_0x9f3e('0x3c')]({'plain':!![]});return _0x588c2c;})[_0x9f3e('0x13')](function(_0x4e11c1){var _0x31fe6b=new Redis(config['redis']);_0x31fe6b[_0x9f3e('0x17')]('agi',JSON['stringify'](_[_0x9f3e('0x43')](_0x4e11c1,['id','name',_0x9f3e('0x44')])));return _0x4e11c1;})[_0x9f3e('0x13')](respondWithResult(_0x3886b0,null))[_0x9f3e('0x39')](handleError(_0x3886b0,null));};exports[_0x9f3e('0x14')]=function(_0x53c7f4,_0x410963){return db['SquareProject'][_0x9f3e('0x38')]({'where':{'id':_0x53c7f4['params']['id']}})[_0x9f3e('0x13')](handleEntityNotFound(_0x410963,null))[_0x9f3e('0x13')](removeEntity(_0x410963,null))[_0x9f3e('0x39')](handleError(_0x410963,null));}; \ No newline at end of file +var _0x57f7=['map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','filter','where','merge','options','SquareProject','includeAll','include','findAll','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','production','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','json','undefined','limit','count','offset','status','set','Content-Range','update','then','get','destroy','publish','agi','end','sendStatus','error','stack','name','send','index'];(function(_0x82158f,_0x4e103e){var _0x5f475f=function(_0x473255){while(--_0x473255){_0x82158f['push'](_0x82158f['shift']());}};_0x5f475f(++_0x4e103e);}(_0x57f7,0xad));var _0x757f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x57f7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x757f('0x0'));var Redis=require('ioredis');var qs=require(_0x757f('0x1'));var logger=require('../../config/logger')(_0x757f('0x2'));var config=require(_0x757f('0x3'));var db=require(_0x757f('0x4'))['db'];config[_0x757f('0x5')]=_['defaults'](config[_0x757f('0x5')],{'host':_0x757f('0x6'),'port':0x18eb});var socket=require(_0x757f('0x7'))(new Redis(config[_0x757f('0x5')]));require(_0x757f('0x8'))[_0x757f('0x9')](socket);function respondWithResult(_0x27c756,_0x27a038){_0x27a038=_0x27a038||0xc8;return function(_0x6060fa){if(_0x6060fa){return _0x27c756['status'](_0x27a038)[_0x757f('0xa')](_0x6060fa);}};}function respondWithFilteredResult(_0x26b7da,_0x33acb7){return function(_0xd30eb8){if(_0xd30eb8){var _0x245d2a=typeof _0x33acb7['offset']===_0x757f('0xb')&&typeof _0x33acb7[_0x757f('0xc')]===_0x757f('0xb');var _0x2c4b5f=_0xd30eb8[_0x757f('0xd')];var _0x114b05=_0x245d2a?0x0:_0x33acb7[_0x757f('0xe')];var _0x2b616c=_0x245d2a?_0xd30eb8[_0x757f('0xd')]:_0x33acb7['offset']+_0x33acb7['limit'];var _0x5bea97;if(_0x2b616c>=_0x2c4b5f){_0x2b616c=_0x2c4b5f;_0x5bea97=0xc8;}else{_0x5bea97=0xce;}_0x26b7da[_0x757f('0xf')](_0x5bea97);return _0x26b7da[_0x757f('0x10')](_0x757f('0x11'),_0x114b05+'-'+_0x2b616c+'/'+_0x2c4b5f)[_0x757f('0xa')](_0xd30eb8);}return null;};}function saveUpdates(_0x4deb1c){return function(_0x442240){if(_0x442240){return _0x442240[_0x757f('0x12')](_0x4deb1c)[_0x757f('0x13')](function(_0x130555){return _0x130555;});}return null;};}function removeEntity(_0x2a0dcb){return function(_0x108b93){if(_0x108b93){return _0x108b93['destroy']()[_0x757f('0x13')](function(){var _0x35d32e=_0x108b93[_0x757f('0x14')]({'plain':!![]});var _0x4f4099='SquareProjects';return db['UserProfileResource'][_0x757f('0x15')]({'where':{'type':_0x4f4099,'resourceId':_0x35d32e['id']}})[_0x757f('0x13')](function(){return _0x108b93;});})['then'](function(){var _0x1facff=new Redis(config[_0x757f('0x5')]);_0x1facff[_0x757f('0x16')](_0x757f('0x17'),JSON['stringify']({'id':_0x108b93['id'],'deleted':!![]}));})['then'](function(){_0x2a0dcb[_0x757f('0xf')](0xcc)[_0x757f('0x18')]();});}};}function handleEntityNotFound(_0x1e891f){return function(_0x352353){if(!_0x352353){_0x1e891f[_0x757f('0x19')](0x194);}return _0x352353;};}function handleError(_0x2d11e7,_0x441eeb){_0x441eeb=_0x441eeb||0x1f4;return function(_0x5af28c){logger[_0x757f('0x1a')](_0x5af28c[_0x757f('0x1b')]);if(_0x5af28c[_0x757f('0x1c')]){delete _0x5af28c[_0x757f('0x1c')];}_0x2d11e7[_0x757f('0xf')](_0x441eeb)[_0x757f('0x1d')](_0x5af28c);};}exports[_0x757f('0x1e')]=function(_0x2c8ff0,_0x40543a){var _0x322591={},_0xbdcf1={},_0x25a5a5={'count':0x0,'rows':[]};var _0xf634df=_[_0x757f('0x1f')](db['SquareProject'][_0x757f('0x20')],function(_0x23dbfa){return{'name':_0x23dbfa['fieldName'],'type':_0x23dbfa[_0x757f('0x21')][_0x757f('0x22')]};});_0xbdcf1[_0x757f('0x23')]=_[_0x757f('0x1f')](_0xf634df,_0x757f('0x1c'));_0xbdcf1['query']=_[_0x757f('0x24')](_0x2c8ff0[_0x757f('0x25')]);_0xbdcf1[_0x757f('0x26')]=_['intersection'](_0xbdcf1['model'],_0xbdcf1[_0x757f('0x25')]);_0x322591['attributes']=_[_0x757f('0x27')](_0xbdcf1[_0x757f('0x23')],qs[_0x757f('0x28')](_0x2c8ff0['query'][_0x757f('0x28')]));_0x322591[_0x757f('0x29')]=_0x322591[_0x757f('0x29')]['length']?_0x322591[_0x757f('0x29')]:_0xbdcf1[_0x757f('0x23')];if(!_0x2c8ff0['query'][_0x757f('0x2a')]('nolimit')){_0x322591[_0x757f('0xc')]=qs[_0x757f('0xc')](_0x2c8ff0['query']['limit']);_0x322591['offset']=qs[_0x757f('0xe')](_0x2c8ff0[_0x757f('0x25')]['offset']);}_0x322591['order']=qs[_0x757f('0x2b')](_0x2c8ff0[_0x757f('0x25')]['sort']);_0x322591['where']=qs['filters'](_[_0x757f('0x2c')](_0x2c8ff0[_0x757f('0x25')],_0xbdcf1[_0x757f('0x26')]),_0xf634df);if(_0x2c8ff0[_0x757f('0x25')][_0x757f('0x2d')]){_0x322591[_0x757f('0x2e')]=_[_0x757f('0x2f')](_0x322591[_0x757f('0x2e')],{'$or':_[_0x757f('0x1f')](_0xf634df,function(_0xb6b638){if(_0xb6b638[_0x757f('0x21')]!=='VIRTUAL'){var _0x212b23={};_0x212b23[_0xb6b638['name']]={'$like':'%'+_0x2c8ff0['query'][_0x757f('0x2d')]+'%'};return _0x212b23;}})});}_0x322591=_[_0x757f('0x2f')]({},_0x322591,_0x2c8ff0[_0x757f('0x30')]);var _0x51c311={'where':_0x322591[_0x757f('0x2e')]};return db[_0x757f('0x31')][_0x757f('0xd')](_0x51c311)['then'](function(_0x3ee8ae){_0x25a5a5['count']=_0x3ee8ae;if(_0x2c8ff0[_0x757f('0x25')][_0x757f('0x32')]){_0x322591[_0x757f('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x757f('0x34')](_0x322591);})[_0x757f('0x13')](function(_0x46313f){_0x25a5a5['rows']=_0x46313f;return _0x25a5a5;})['then'](respondWithFilteredResult(_0x40543a,_0x322591))['catch'](handleError(_0x40543a,null));};exports['show']=function(_0xf508ef,_0x175efc){var _0x47b075={'raw':![],'where':{'id':_0xf508ef[_0x757f('0x35')]['id']}},_0x524beb={};_0x524beb['model']=_[_0x757f('0x24')](db['SquareProject']['rawAttributes']);_0x524beb[_0x757f('0x25')]=_[_0x757f('0x24')](_0xf508ef[_0x757f('0x25')]);_0x524beb[_0x757f('0x26')]=_[_0x757f('0x27')](_0x524beb[_0x757f('0x23')],_0x524beb[_0x757f('0x25')]);_0x47b075['attributes']=_['intersection'](_0x524beb[_0x757f('0x23')],qs[_0x757f('0x28')](_0xf508ef[_0x757f('0x25')][_0x757f('0x28')]));_0x47b075[_0x757f('0x29')]=_0x47b075['attributes']['length']?_0x47b075[_0x757f('0x29')]:_0x524beb[_0x757f('0x23')];if(_0xf508ef['query'][_0x757f('0x32')]){_0x47b075[_0x757f('0x33')]=[{'all':!![]}];}_0x47b075=_[_0x757f('0x2f')]({},_0x47b075,_0xf508ef[_0x757f('0x30')]);return db['SquareProject'][_0x757f('0x36')](_0x47b075)[_0x757f('0x13')](handleEntityNotFound(_0x175efc,null))[_0x757f('0x13')](respondWithResult(_0x175efc,null))[_0x757f('0x37')](handleError(_0x175efc,null));};exports[_0x757f('0x38')]=function(_0x275a07,_0x3190fb){return db['SquareProject'][_0x757f('0x38')](_0x275a07[_0x757f('0x39')],{})[_0x757f('0x13')](function(_0x389d96){var _0x333346=_0x275a07[_0x757f('0x3a')][_0x757f('0x14')]({'plain':!![]});if(!_0x333346)throw new Error(_0x757f('0x3b'));if(_0x333346['role']==='user'){var _0x4ee923=_0x389d96[_0x757f('0x14')]({'plain':!![]});var _0x266e04=_0x757f('0x3c');return db[_0x757f('0x3d')][_0x757f('0x36')]({'where':{'name':_0x266e04,'userProfileId':_0x333346[_0x757f('0x3e')]},'raw':!![]})[_0x757f('0x13')](function(_0x1370d1){if(_0x1370d1&&_0x1370d1[_0x757f('0x3f')]===0x0){return db[_0x757f('0x40')][_0x757f('0x38')]({'name':_0x4ee923[_0x757f('0x1c')],'resourceId':_0x4ee923['id'],'type':_0x1370d1['name'],'sectionId':_0x1370d1['id']},{})[_0x757f('0x13')](function(){return _0x389d96;});}else{return _0x389d96;}})[_0x757f('0x37')](function(_0x542c7a){logger['error'](_0x757f('0x41'),_0x542c7a);throw _0x542c7a;});}return _0x389d96;})['then'](respondWithResult(_0x3190fb,0xc9))[_0x757f('0x37')](handleError(_0x3190fb,null));};exports[_0x757f('0x12')]=function(_0x5e8fbb,_0x268ca3){if(_0x5e8fbb[_0x757f('0x39')]['id']){delete _0x5e8fbb['body']['id'];}return db[_0x757f('0x31')][_0x757f('0x36')]({'where':{'id':_0x5e8fbb[_0x757f('0x35')]['id']}})[_0x757f('0x13')](handleEntityNotFound(_0x268ca3,null))[_0x757f('0x13')](saveUpdates(_0x5e8fbb[_0x757f('0x39')],null))[_0x757f('0x13')](function(_0x1e8be8){if(!_0x1e8be8)return;var _0x5d5ce6=_0x1e8be8[_0x757f('0x14')]({'plain':!![]});return _0x5d5ce6;})['then'](function(_0x443e4e){var _0x2e6545=new Redis(config[_0x757f('0x5')]);_0x2e6545[_0x757f('0x16')]('agi',JSON[_0x757f('0x42')](_[_0x757f('0x2c')](_0x443e4e,['id',_0x757f('0x1c'),_0x757f('0x43')])));return _0x443e4e;})['then'](respondWithResult(_0x268ca3,null))[_0x757f('0x37')](handleError(_0x268ca3,null));};exports[_0x757f('0x15')]=function(_0x30c618,_0x3aee7d){return db['SquareProject'][_0x757f('0x36')]({'where':{'id':_0x30c618[_0x757f('0x35')]['id']}})['then'](handleEntityNotFound(_0x3aee7d,null))['then'](removeEntity(_0x3aee7d,null))[_0x757f('0x37')](handleError(_0x3aee7d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a8ee7a4..09c690d 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 _0x3f05=['SquareProject','setMaxListeners','save','remove','emit','hook','events','../../mysqldb'];(function(_0x5b319a,_0x52a137){var _0x3f93ff=function(_0xfe0ce){while(--_0xfe0ce){_0x5b319a['push'](_0x5b319a['shift']());}};_0x3f93ff(++_0x52a137);}(_0x3f05,0x13e));var _0x53f0=function(_0xbc929d,_0x162e94){_0xbc929d=_0xbc929d-0x0;var _0x5317f0=_0x3f05[_0xbc929d];return _0x5317f0;};'use strict';var EventEmitter=require(_0x53f0('0x0'));var SquareProject=require(_0x53f0('0x1'))['db'][_0x53f0('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x53f0('0x3')](0x0);var events={'afterCreate':_0x53f0('0x4'),'afterUpdate':'update','afterDestroy':_0x53f0('0x5')};function emitEvent(_0x55f7a9){return function(_0x1d0432,_0x5297ba,_0x272b99){SquareProjectEvents[_0x53f0('0x6')](_0x55f7a9+':'+_0x1d0432['id'],_0x1d0432);SquareProjectEvents[_0x53f0('0x6')](_0x55f7a9,_0x1d0432);_0x272b99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x53f0('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x5008=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2681f4,_0x3f39b3){var _0x4619ae=function(_0x15a7f9){while(--_0x15a7f9){_0x2681f4['push'](_0x2681f4['shift']());}};_0x4619ae(++_0x3f39b3);}(_0x5008,0x150));var _0x8500=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x5008[_0x4d07cc];return _0x42de3b;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x8500('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8500('0x1')](0x0);var events={'afterCreate':_0x8500('0x2'),'afterUpdate':_0x8500('0x3'),'afterDestroy':_0x8500('0x4')};function emitEvent(_0x24bd73){return function(_0x14cb38,_0x2fff8,_0x788ad7){SquareProjectEvents[_0x8500('0x5')](_0x24bd73+':'+_0x14cb38['id'],_0x14cb38);SquareProjectEvents[_0x8500('0x5')](_0x24bd73,_0x14cb38);_0x788ad7(null);};}for(var e in events){if(events[_0x8500('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x8500('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 48b1bca..0a0af11 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 _0x50c1=['SquareProject','square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareProject.attributes','exports','define'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0x50c1,0x1e3));var _0x150c=function(_0x597bef,_0x5a701a){_0x597bef=_0x597bef-0x0;var _0x28f3b5=_0x50c1[_0x597bef];return _0x28f3b5;};'use strict';var _=require(_0x150c('0x0'));var util=require(_0x150c('0x1'));var logger=require(_0x150c('0x2'))(_0x150c('0x3'));var moment=require(_0x150c('0x4'));var BPromise=require(_0x150c('0x5'));var rp=require(_0x150c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x150c('0x7'));var config=require('../../config/environment');var attributes=require(_0x150c('0x8'));module[_0x150c('0x9')]=function(_0x1793da,_0x49d832){return _0x1793da[_0x150c('0xa')](_0x150c('0xb'),attributes,{'tableName':_0x150c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x74afe5,_0x3f5d33,_0xca6ef5){if(_0x74afe5['changed'](_0x150c('0xd'))){_0x74afe5['savedAt']=moment()[_0x150c('0xe')](_0x150c('0xf'));}if(_0x74afe5[_0x150c('0x10')](_0x150c('0x11'))){_0x74afe5[_0x150c('0x12')]=moment()[_0x150c('0xe')](_0x150c('0xf'));}_0xca6ef5(null,_0x74afe5);}}});}; \ No newline at end of file +var _0xba91=['SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define'];(function(_0xa56e55,_0x4e81db){var _0x4c1453=function(_0x395022){while(--_0x395022){_0xa56e55['push'](_0xa56e55['shift']());}};_0x4c1453(++_0x4e81db);}(_0xba91,0x80));var _0x1ba9=function(_0x16c98f,_0x570b2b){_0x16c98f=_0x16c98f-0x0;var _0xc95937=_0xba91[_0x16c98f];return _0xc95937;};'use strict';var _=require(_0x1ba9('0x0'));var util=require(_0x1ba9('0x1'));var logger=require(_0x1ba9('0x2'))('api');var moment=require(_0x1ba9('0x3'));var BPromise=require(_0x1ba9('0x4'));var rp=require(_0x1ba9('0x5'));var fs=require('fs');var path=require(_0x1ba9('0x6'));var rimraf=require(_0x1ba9('0x7'));var config=require(_0x1ba9('0x8'));var attributes=require(_0x1ba9('0x9'));module[_0x1ba9('0xa')]=function(_0x27308d,_0x5796ed){return _0x27308d[_0x1ba9('0xb')](_0x1ba9('0xc'),attributes,{'tableName':_0x1ba9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33fdc7,_0x4ae37b,_0x316782){if(_0x33fdc7[_0x1ba9('0xe')](_0x1ba9('0xf'))){_0x33fdc7[_0x1ba9('0x10')]=moment()[_0x1ba9('0x11')](_0x1ba9('0x12'));}if(_0x33fdc7['changed']('production')){_0x33fdc7[_0x1ba9('0x13')]=moment()[_0x1ba9('0x11')](_0x1ba9('0x12'));}_0x316782(null,_0x33fdc7);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7947e78..7bf10d3 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 _0xf293=['lodash','ioredis','../../mysqldb','rpc','../../config/environment','redis','defaults','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','raw','ShowSquareProject'];(function(_0x3a6409,_0x4d9dc1){var _0x3d5585=function(_0x5192de){while(--_0x5192de){_0x3a6409['push'](_0x3a6409['shift']());}};_0x3d5585(++_0x4d9dc1);}(_0xf293,0x118));var _0x3f29=function(_0x63cafe,_0x16015d){_0x63cafe=_0x63cafe-0x0;var _0x3409d4=_0xf293[_0x63cafe];return _0x3409d4;};'use strict';var _=require(_0x3f29('0x0'));var Redis=require(_0x3f29('0x1'));var db=require(_0x3f29('0x2'))['db'];var logger=require('../../config/logger')(_0x3f29('0x3'));var config=require(_0x3f29('0x4'));config[_0x3f29('0x5')]=_[_0x3f29('0x6')](config[_0x3f29('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f29('0x5')]));require(_0x3f29('0x7'))[_0x3f29('0x8')](socket);exports[_0x3f29('0x9')]=function(_0x1c733a){var _0x5c807f=this;return new Promise(function(_0x1bdb48,_0x2928d9){return db[_0x3f29('0xa')][_0x3f29('0xb')]({'raw':_0x1c733a[_0x3f29('0xc')]?_0x1c733a['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c733a[_0x3f29('0xc')]?_0x1c733a[_0x3f29('0xc')][_0x3f29('0xd')]||null:null,'attributes':_0x1c733a[_0x3f29('0xc')]?_0x1c733a[_0x3f29('0xc')][_0x3f29('0xe')]||null:null,'limit':_0x1c733a[_0x3f29('0xc')]?_0x1c733a[_0x3f29('0xc')][_0x3f29('0xf')]||null:null,'include':_0x1c733a[_0x3f29('0xc')]?_0x1c733a[_0x3f29('0xc')]['include']?_['map'](_0x1c733a[_0x3f29('0xc')]['include'],function(_0x3ea4e0){return{'model':db[_0x3ea4e0['model']],'as':_0x3ea4e0['as'],'attributes':_0x3ea4e0[_0x3f29('0xe')],'include':_0x3ea4e0[_0x3f29('0x10')]?_[_0x3f29('0x11')](_0x3ea4e0[_0x3f29('0x10')],function(_0x4ac5a0){return{'model':db[_0x4ac5a0[_0x3f29('0x12')]],'as':_0x4ac5a0['as'],'attributes':_0x4ac5a0['attributes'],'include':_0x4ac5a0[_0x3f29('0x10')]?_[_0x3f29('0x11')](_0x4ac5a0[_0x3f29('0x10')],function(_0x1e80f0){return{'model':db[_0x1e80f0[_0x3f29('0x12')]],'as':_0x1e80f0['as'],'attributes':_0x1e80f0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f29('0x13')](function(_0xdce1d2){logger[_0x3f29('0x14')](_0x3f29('0x9'),_0x1c733a);logger[_0x3f29('0x15')](_0x3f29('0x9'),_0x1c733a,JSON[_0x3f29('0x16')](_0xdce1d2));_0x1bdb48(_0xdce1d2);})[_0x3f29('0x17')](function(_0x45bfe4){logger[_0x3f29('0x18')]('GetSquareProjects',_0x45bfe4[_0x3f29('0x19')],_0x1c733a);_0x2928d9(_0x5c807f['error'](0x1f4,_0x45bfe4[_0x3f29('0x19')]));});});};exports['ShowSquareProject']=function(_0x3a0329){var _0x24cd8a=this;return new Promise(function(_0x24c528,_0x3498cf){return db[_0x3f29('0xa')]['find']({'raw':_0x3a0329[_0x3f29('0xc')]?_0x3a0329[_0x3f29('0xc')][_0x3f29('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a0329[_0x3f29('0xc')]?_0x3a0329[_0x3f29('0xc')][_0x3f29('0xd')]||null:null,'attributes':_0x3a0329['options']?_0x3a0329['options']['attributes']||null:null,'include':_0x3a0329['options']?_0x3a0329[_0x3f29('0xc')]['include']?_['map'](_0x3a0329[_0x3f29('0xc')]['include'],function(_0x378172){return{'model':db[_0x378172['model']],'as':_0x378172['as'],'attributes':_0x378172[_0x3f29('0xe')],'include':_0x378172[_0x3f29('0x10')]?_[_0x3f29('0x11')](_0x378172['include'],function(_0xfc3baa){return{'model':db[_0xfc3baa['model']],'as':_0xfc3baa['as'],'attributes':_0xfc3baa[_0x3f29('0xe')],'include':_0xfc3baa[_0x3f29('0x10')]?_['map'](_0xfc3baa['include'],function(_0xc098ce){return{'model':db[_0xc098ce[_0x3f29('0x12')]],'as':_0xc098ce['as'],'attributes':_0xc098ce['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f29('0x13')](function(_0xcb56dd){logger[_0x3f29('0x14')](_0x3f29('0x1b'),_0x3a0329);logger[_0x3f29('0x15')]('ShowSquareProject',_0x3a0329,JSON[_0x3f29('0x16')](_0xcb56dd));_0x24c528(_0xcb56dd);})[_0x3f29('0x17')](function(_0x1b4ac9){logger[_0x3f29('0x18')](_0x3f29('0x1b'),_0x1b4ac9[_0x3f29('0x19')],_0x3a0329);_0x3498cf(_0x24cd8a[_0x3f29('0x18')](0x1f4,_0x1b4ac9['message']));});});}; \ No newline at end of file +var _0x92f2=['register','GetSquareProjects','SquareProject','findAll','options','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','error','ShowSquareProject','raw','lodash','../../mysqldb','../../config/logger','rpc','redis','localhost','socket.io-emitter','./squareProject.socket'];(function(_0x2adae0,_0x4fa150){var _0x4bbb68=function(_0x5952bb){while(--_0x5952bb){_0x2adae0['push'](_0x2adae0['shift']());}};_0x4bbb68(++_0x4fa150);}(_0x92f2,0x1de));var _0x292f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x92f2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x292f('0x0'));var Redis=require('ioredis');var db=require(_0x292f('0x1'))['db'];var logger=require(_0x292f('0x2'))(_0x292f('0x3'));var config=require('../../config/environment');config['redis']=_['defaults'](config[_0x292f('0x4')],{'host':_0x292f('0x5'),'port':0x18eb});var socket=require(_0x292f('0x6'))(new Redis(config[_0x292f('0x4')]));require(_0x292f('0x7'))[_0x292f('0x8')](socket);exports[_0x292f('0x9')]=function(_0x1016f1){var _0x510a06=this;return new Promise(function(_0x54020c,_0x4f3700){return db[_0x292f('0xa')][_0x292f('0xb')]({'raw':_0x1016f1[_0x292f('0xc')]?_0x1016f1[_0x292f('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x1016f1[_0x292f('0xc')]?_0x1016f1['options']['where']||null:null,'attributes':_0x1016f1[_0x292f('0xc')]?_0x1016f1[_0x292f('0xc')][_0x292f('0xd')]||null:null,'limit':_0x1016f1[_0x292f('0xc')]?_0x1016f1['options'][_0x292f('0xe')]||null:null,'include':_0x1016f1['options']?_0x1016f1[_0x292f('0xc')][_0x292f('0xf')]?_[_0x292f('0x10')](_0x1016f1[_0x292f('0xc')]['include'],function(_0x4ecac2){return{'model':db[_0x4ecac2[_0x292f('0x11')]],'as':_0x4ecac2['as'],'attributes':_0x4ecac2[_0x292f('0xd')],'include':_0x4ecac2[_0x292f('0xf')]?_['map'](_0x4ecac2[_0x292f('0xf')],function(_0x238e3f){return{'model':db[_0x238e3f['model']],'as':_0x238e3f['as'],'attributes':_0x238e3f[_0x292f('0xd')],'include':_0x238e3f[_0x292f('0xf')]?_[_0x292f('0x10')](_0x238e3f[_0x292f('0xf')],function(_0x304db7){return{'model':db[_0x304db7[_0x292f('0x11')]],'as':_0x304db7['as'],'attributes':_0x304db7[_0x292f('0xd')]};}):[]};}):[]};}):[]:[]})[_0x292f('0x12')](function(_0x2239ae){logger[_0x292f('0x13')]('GetSquareProjects',_0x1016f1);logger[_0x292f('0x14')](_0x292f('0x9'),_0x1016f1,JSON[_0x292f('0x15')](_0x2239ae));_0x54020c(_0x2239ae);})[_0x292f('0x16')](function(_0x14d301){logger['error']('GetSquareProjects',_0x14d301[_0x292f('0x17')],_0x1016f1);_0x4f3700(_0x510a06[_0x292f('0x18')](0x1f4,_0x14d301['message']));});});};exports[_0x292f('0x19')]=function(_0xd24bd0){var _0x4a113e=this;return new Promise(function(_0x5c14da,_0x14a5c3){return db['SquareProject']['find']({'raw':_0xd24bd0[_0x292f('0xc')]?_0xd24bd0[_0x292f('0xc')][_0x292f('0x1a')]===undefined?!![]:![]:!![],'where':_0xd24bd0['options']?_0xd24bd0[_0x292f('0xc')]['where']||null:null,'attributes':_0xd24bd0[_0x292f('0xc')]?_0xd24bd0[_0x292f('0xc')][_0x292f('0xd')]||null:null,'include':_0xd24bd0[_0x292f('0xc')]?_0xd24bd0[_0x292f('0xc')][_0x292f('0xf')]?_[_0x292f('0x10')](_0xd24bd0[_0x292f('0xc')]['include'],function(_0x11344e){return{'model':db[_0x11344e['model']],'as':_0x11344e['as'],'attributes':_0x11344e[_0x292f('0xd')],'include':_0x11344e['include']?_[_0x292f('0x10')](_0x11344e[_0x292f('0xf')],function(_0x1292dc){return{'model':db[_0x1292dc[_0x292f('0x11')]],'as':_0x1292dc['as'],'attributes':_0x1292dc[_0x292f('0xd')],'include':_0x1292dc[_0x292f('0xf')]?_['map'](_0x1292dc[_0x292f('0xf')],function(_0x2e7767){return{'model':db[_0x2e7767[_0x292f('0x11')]],'as':_0x2e7767['as'],'attributes':_0x2e7767['attributes']};}):[]};}):[]};}):[]:[]})[_0x292f('0x12')](function(_0x1e9581){logger[_0x292f('0x13')](_0x292f('0x19'),_0xd24bd0);logger['debug'](_0x292f('0x19'),_0xd24bd0,JSON['stringify'](_0x1e9581));_0x5c14da(_0x1e9581);})[_0x292f('0x16')](function(_0x1e85bc){logger[_0x292f('0x18')](_0x292f('0x19'),_0x1e85bc[_0x292f('0x17')],_0xd24bd0);_0x14a5c3(_0x4a113e[_0x292f('0x18')](0x1f4,_0x1e85bc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 1418a82..bb2368d 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 _0x39b8=['register','length','squareProject:','./squareProject.events','remove'];(function(_0x493cea,_0x144c6a){var _0x1c32ba=function(_0x47c0f9){while(--_0x47c0f9){_0x493cea['push'](_0x493cea['shift']());}};_0x1c32ba(++_0x144c6a);}(_0x39b8,0x175));var _0x839b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x39b8[_0x501510];return _0x1e6ee5;};'use strict';var SquareProjectEvents=require(_0x839b('0x0'));var events=['save',_0x839b('0x1'),'update'];function createListener(_0x587142,_0x540210){return function(_0x2c85eb){_0x540210['emit'](_0x587142,_0x2c85eb);};}function removeListener(_0x415fce,_0x365d2b){return function(){SquareProjectEvents['removeListener'](_0x415fce,_0x365d2b);};}exports[_0x839b('0x2')]=function(_0xfba766){for(var _0x514a73=0x0,_0x1c8e0d=events[_0x839b('0x3')];_0x514a73<_0x1c8e0d;_0x514a73++){var _0x543794=events[_0x514a73];var _0x48dfa3=createListener(_0x839b('0x4')+_0x543794,_0xfba766);SquareProjectEvents['on'](_0x543794,_0x48dfa3);}}; \ No newline at end of file +var _0xdfec=['remove','update','emit','length','./squareProject.events','save'];(function(_0x59e32f,_0x4a7bcf){var _0x4719bc=function(_0x32f4d0){while(--_0x32f4d0){_0x59e32f['push'](_0x59e32f['shift']());}};_0x4719bc(++_0x4a7bcf);}(_0xdfec,0x12a));var _0xcdfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdfec[_0x321bb2];return _0x9c12ed;};'use strict';var SquareProjectEvents=require(_0xcdfe('0x0'));var events=[_0xcdfe('0x1'),_0xcdfe('0x2'),_0xcdfe('0x3')];function createListener(_0x476b7e,_0x1bc5f8){return function(_0x161af7){_0x1bc5f8[_0xcdfe('0x4')](_0x476b7e,_0x161af7);};}function removeListener(_0x43f959,_0x2c2c73){return function(){SquareProjectEvents['removeListener'](_0x43f959,_0x2c2c73);};}exports['register']=function(_0x4e927d){for(var _0x4e79dc=0x0,_0xd54986=events[_0xcdfe('0x5')];_0x4e79dc<_0xd54986;_0x4e79dc++){var _0x582260=events[_0x4e79dc];var _0x2b47dd=createListener('squareProject:'+_0x582260,_0x4e927d);SquareProjectEvents['on'](_0x582260,_0x2b47dd);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 2fd4f64..31d9377 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x332779,_0x397ecb){var _0x391e43=function(_0x468eb3){while(--_0x468eb3){_0x332779['push'](_0x332779['shift']());}};_0x391e43(++_0x397ecb);}(_0xabce,0x103));var _0xeabc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xabce[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x2e4497,_0x20109b){var _0x3183c6=function(_0x420f8c){while(--_0x420f8c){_0x2e4497['push'](_0x2e4497['shift']());}};_0x3183c6(++_0x20109b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x5fc3[_0x2a8860];return _0x2f47a4;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 6b6373b..d38d273 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 _0x425d=['getDataValue','savePath','substring','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x3dfa51,_0x261871){var _0x479461=function(_0x57a7ad){while(--_0x57a7ad){_0x3dfa51['push'](_0x3dfa51['shift']());}};_0x479461(++_0x261871);}(_0x425d,0x1e0));var _0xd425=function(_0x3802f3,_0x4364e7){_0x3802f3=_0x3802f3-0x0;var _0x212c72=_0x425d[_0x3802f3];return _0x212c72;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'callerid':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'extension':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd425('0x1')]},'saveName':{'type':Sequelize[_0xd425('0x1')]},'filename':{'type':Sequelize[_0xd425('0x1')]},'savePath':{'type':Sequelize[_0xd425('0x1')]},'format':{'type':Sequelize[_0xd425('0x2')],'get':function(){var _0x1d2ed0='';var _0x50b061=this[_0xd425('0x3')](_0xd425('0x4'));if(_0x50b061){_0x1d2ed0=_0x50b061[_0xd425('0x5')](_0x50b061[_0xd425('0x6')]('.'));}return _0x1d2ed0;}}}; \ No newline at end of file +var _0x814b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x32343c,_0x56c119){var _0x218e0e=function(_0x21e89b){while(--_0x21e89b){_0x32343c['push'](_0x32343c['shift']());}};_0x218e0e(++_0x56c119);}(_0x814b,0x1a2));var _0xb814=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0x814b[_0x379799];return _0x46e431;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'callerid':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize[_0xb814('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb814('0x2')]},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'dnid':{'type':Sequelize[_0xb814('0x2')]},'projectName':{'type':Sequelize[_0xb814('0x2')]},'saveName':{'type':Sequelize[_0xb814('0x2')]},'filename':{'type':Sequelize[_0xb814('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb814('0x3')],'get':function(){var _0x2e6272='';var _0x5c8539=this[_0xb814('0x4')](_0xb814('0x5'));if(_0x5c8539){_0x2e6272=_0x5c8539[_0xb814('0x6')](_0x5c8539[_0xb814('0x7')]('.'));}return _0x2e6272;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1c7ba6f..c3443e3 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 _0xdf42=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0xdf42,0x116));var _0x2df4=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xdf42[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0x2df4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2df4('0x1'));var rp=require(_0x2df4('0x2'));var moment=require('moment');var BPromise=require(_0x2df4('0x3'));var Mustache=require(_0x2df4('0x4'));var util=require(_0x2df4('0x5'));var path=require('path');var sox=require(_0x2df4('0x6'));var csv=require(_0x2df4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2df4('0x8'));var squel=require(_0x2df4('0x9'));var crypto=require(_0x2df4('0xa'));var jsforce=require(_0x2df4('0xb'));var deskjs=require(_0x2df4('0xc'));var toCsv=require(_0x2df4('0x7'));var querystring=require(_0x2df4('0xd'));var Papa=require('papaparse');var Redis=require(_0x2df4('0xe'));var authService=require(_0x2df4('0xf'));var qs=require(_0x2df4('0x10'));var as=require(_0x2df4('0x11'));var hardwareService=require(_0x2df4('0x12'));var logger=require('../../config/logger')(_0x2df4('0x13'));var utils=require(_0x2df4('0x14'));var config=require(_0x2df4('0x15'));var licenseUtil=require(_0x2df4('0x16'));var db=require(_0x2df4('0x17'))['db'];function respondWithStatusCode(_0x469a06,_0x29b3a6){_0x29b3a6=_0x29b3a6||0xcc;return function(_0x2d1931){if(_0x2d1931){return _0x469a06[_0x2df4('0x18')](_0x29b3a6);}return _0x469a06[_0x2df4('0x19')](_0x29b3a6)[_0x2df4('0x1a')]();};}function respondWithResult(_0x3e89ab,_0x2a85f3){_0x2a85f3=_0x2a85f3||0xc8;return function(_0x525ca5){if(_0x525ca5){return _0x3e89ab[_0x2df4('0x19')](_0x2a85f3)['json'](_0x525ca5);}};}function respondWithFilteredResult(_0x3de263,_0x5b4a56){return function(_0x4b4b01){if(_0x4b4b01){var _0x1dd192=typeof _0x5b4a56['offset']==='undefined'&&typeof _0x5b4a56[_0x2df4('0x1b')]===_0x2df4('0x1c');var _0x374891=_0x4b4b01[_0x2df4('0x1d')];var _0x2e13b0=_0x1dd192?0x0:_0x5b4a56[_0x2df4('0x1e')];var _0x804ff=_0x1dd192?_0x4b4b01[_0x2df4('0x1d')]:_0x5b4a56[_0x2df4('0x1e')]+_0x5b4a56['limit'];var _0x300430;if(_0x804ff>=_0x374891){_0x804ff=_0x374891;_0x300430=0xc8;}else{_0x300430=0xce;}_0x3de263['status'](_0x300430);return _0x3de263[_0x2df4('0x1f')]('Content-Range',_0x2e13b0+'-'+_0x804ff+'/'+_0x374891)['json'](_0x4b4b01);}return null;};}function patchUpdates(_0x3741fa){return function(_0x5c0c91){try{jsonpatch[_0x2df4('0x20')](_0x5c0c91,_0x3741fa,!![]);}catch(_0x5dcd49){return BPromise[_0x2df4('0x21')](_0x5dcd49);}return _0x5c0c91[_0x2df4('0x22')]();};}function saveUpdates(_0x5182d5,_0x5bd624){return function(_0x502afb){if(_0x502afb){return _0x502afb[_0x2df4('0x23')](_0x5182d5)[_0x2df4('0x24')](function(_0x1eddc8){return _0x1eddc8;});}return null;};}function removeEntity(_0x15e27c,_0x3d1a82){return function(_0x1b6529){if(_0x1b6529){return _0x1b6529[_0x2df4('0x25')]()['then'](function(){_0x15e27c[_0x2df4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56c88d,_0x5e46a7){return function(_0xeab923){if(!_0xeab923){_0x56c88d['sendStatus'](0x194);}return _0xeab923;};}function handleError(_0x22621c,_0x3b053f){_0x3b053f=_0x3b053f||0x1f4;return function(_0x3a5d8d){logger[_0x2df4('0x26')](_0x3a5d8d[_0x2df4('0x27')]);if(_0x3a5d8d[_0x2df4('0x28')]){delete _0x3a5d8d['name'];}_0x22621c['status'](_0x3b053f)[_0x2df4('0x29')](_0x3a5d8d);};}exports[_0x2df4('0x2a')]=function(_0x5c25ab,_0x33ca97){var _0x55ef90={},_0xbeaf02={},_0x26749d={'count':0x0,'rows':[]};var _0xbd7d4c=_[_0x2df4('0x2b')](db[_0x2df4('0x2c')][_0x2df4('0x2d')],function(_0x12db8e){return{'name':_0x12db8e[_0x2df4('0x2e')],'type':_0x12db8e[_0x2df4('0x2f')]['key']};});_0xbeaf02[_0x2df4('0x30')]=_[_0x2df4('0x2b')](_0xbd7d4c,'name');_0xbeaf02[_0x2df4('0x31')]=_[_0x2df4('0x32')](_0x5c25ab[_0x2df4('0x31')]);_0xbeaf02[_0x2df4('0x33')]=_[_0x2df4('0x34')](_0xbeaf02[_0x2df4('0x30')],_0xbeaf02[_0x2df4('0x31')]);_0x55ef90[_0x2df4('0x35')]=_['intersection'](_0xbeaf02[_0x2df4('0x30')],qs[_0x2df4('0x36')](_0x5c25ab[_0x2df4('0x31')][_0x2df4('0x36')]));_0x55ef90[_0x2df4('0x35')]=_0x55ef90['attributes'][_0x2df4('0x37')]?_0x55ef90['attributes']:_0xbeaf02[_0x2df4('0x30')];if(!_0x5c25ab[_0x2df4('0x31')][_0x2df4('0x38')](_0x2df4('0x39'))){_0x55ef90[_0x2df4('0x1b')]=qs[_0x2df4('0x1b')](_0x5c25ab[_0x2df4('0x31')][_0x2df4('0x1b')]);_0x55ef90[_0x2df4('0x1e')]=qs['offset'](_0x5c25ab[_0x2df4('0x31')][_0x2df4('0x1e')]);}_0x55ef90['order']=qs[_0x2df4('0x3a')](_0x5c25ab[_0x2df4('0x31')][_0x2df4('0x3a')]);_0x55ef90[_0x2df4('0x3b')]=qs[_0x2df4('0x33')](_[_0x2df4('0x3c')](_0x5c25ab[_0x2df4('0x31')],_0xbeaf02[_0x2df4('0x33')]),_0xbd7d4c);if(_0x5c25ab['query']['filter']){_0x55ef90[_0x2df4('0x3b')]=_[_0x2df4('0x3d')](_0x55ef90[_0x2df4('0x3b')],{'$or':_[_0x2df4('0x2b')](_0xbd7d4c,function(_0x363451){if(_0x363451[_0x2df4('0x2f')]!=='VIRTUAL'){var _0xedee7e={};_0xedee7e[_0x363451[_0x2df4('0x28')]]={'$like':'%'+_0x5c25ab[_0x2df4('0x31')][_0x2df4('0x3e')]+'%'};return _0xedee7e;}})});}_0x55ef90=_[_0x2df4('0x3d')]({},_0x55ef90,_0x5c25ab[_0x2df4('0x3f')]);var _0x19bbbf={'where':_0x55ef90[_0x2df4('0x3b')]};return db[_0x2df4('0x2c')]['count'](_0x19bbbf)['then'](function(_0x1142f2){_0x26749d[_0x2df4('0x1d')]=_0x1142f2;if(_0x5c25ab['query'][_0x2df4('0x40')]){_0x55ef90[_0x2df4('0x41')]=[{'all':!![]}];}return db[_0x2df4('0x2c')][_0x2df4('0x42')](_0x55ef90);})[_0x2df4('0x24')](function(_0xc84660){_0x26749d[_0x2df4('0x43')]=_0xc84660;return _0x26749d;})['then'](respondWithFilteredResult(_0x33ca97,_0x55ef90))[_0x2df4('0x44')](handleError(_0x33ca97,null));};exports['show']=function(_0x5593bc,_0xef2727){var _0xc45b6c={'raw':!![],'where':{'id':_0x5593bc[_0x2df4('0x45')]['id']}},_0x7c7128={};_0x7c7128[_0x2df4('0x30')]=_[_0x2df4('0x32')](db[_0x2df4('0x2c')][_0x2df4('0x2d')]);_0x7c7128[_0x2df4('0x31')]=_['keys'](_0x5593bc['query']);_0x7c7128[_0x2df4('0x33')]=_[_0x2df4('0x34')](_0x7c7128[_0x2df4('0x30')],_0x7c7128[_0x2df4('0x31')]);_0xc45b6c[_0x2df4('0x35')]=_[_0x2df4('0x34')](_0x7c7128[_0x2df4('0x30')],qs['fields'](_0x5593bc[_0x2df4('0x31')][_0x2df4('0x36')]));_0xc45b6c[_0x2df4('0x35')]=_0xc45b6c[_0x2df4('0x35')][_0x2df4('0x37')]?_0xc45b6c[_0x2df4('0x35')]:_0x7c7128[_0x2df4('0x30')];if(_0x5593bc[_0x2df4('0x31')][_0x2df4('0x40')]){_0xc45b6c[_0x2df4('0x41')]=[{'all':!![]}];}_0xc45b6c=_[_0x2df4('0x3d')]({},_0xc45b6c,_0x5593bc[_0x2df4('0x3f')]);return db[_0x2df4('0x2c')][_0x2df4('0x46')](_0xc45b6c)[_0x2df4('0x24')](handleEntityNotFound(_0xef2727,null))[_0x2df4('0x24')](respondWithResult(_0xef2727,null))[_0x2df4('0x44')](handleError(_0xef2727,null));};exports['create']=function(_0x2ef884,_0xd27977){return db[_0x2df4('0x2c')][_0x2df4('0x47')](_0x2ef884[_0x2df4('0x48')],{})[_0x2df4('0x24')](respondWithResult(_0xd27977,0xc9))[_0x2df4('0x44')](handleError(_0xd27977,null));};exports[_0x2df4('0x23')]=function(_0x3f55f4,_0x54389c){if(_0x3f55f4[_0x2df4('0x48')]['id']){delete _0x3f55f4[_0x2df4('0x48')]['id'];}return db[_0x2df4('0x2c')][_0x2df4('0x46')]({'where':{'id':_0x3f55f4[_0x2df4('0x45')]['id']}})['then'](handleEntityNotFound(_0x54389c,null))['then'](saveUpdates(_0x3f55f4[_0x2df4('0x48')],null))['then'](respondWithResult(_0x54389c,null))['catch'](handleError(_0x54389c,null));};exports[_0x2df4('0x49')]=function(_0x5abf61,_0x39bcfe,_0x438b2){var _0xae8af=require('../../components/encryptor');var _0x32450d=![];var _0x5aae99={};if(_0x5abf61[_0x2df4('0x31')][_0x2df4('0x2f')]&&_0x5abf61[_0x2df4('0x31')][_0x2df4('0x2f')]===_0x2df4('0x4a')){_0x5aae99['uniqueid']=_0x5abf61[_0x2df4('0x45')]['id'];}else{_0x5aae99['id']=_0x5abf61[_0x2df4('0x45')]['id'];}return db[_0x2df4('0x2c')][_0x2df4('0x46')]({'where':_0x5aae99,'attributes':['id',_0x2df4('0x4b'),_0x2df4('0x4c')],'raw':!![]})[_0x2df4('0x24')](handleEntityNotFound(_0x39bcfe,null))['then'](function(_0x17d6b1){if(_0x17d6b1){var _0x5cf5f7=_0x17d6b1[_0x2df4('0x4b')];var _0x3126fe=util[_0x2df4('0x4d')](_0x2df4('0x4e'),_0x5cf5f7);if(fs[_0x2df4('0x4f')](_0x3126fe)){_0x32450d=!![];return _0xae8af[_0x2df4('0x50')](_0x3126fe,_0x5cf5f7,config[_0x2df4('0x51')][_0x2df4('0x52')])[_0x2df4('0x24')](function(){return _0x17d6b1;});}return _0x17d6b1;}})['then'](function(_0x16c809){if(_0x16c809){var _0x4d337e=_0x16c809[_0x2df4('0x4b')];if(!fs[_0x2df4('0x4f')](_0x4d337e)){throw new db[(_0x2df4('0x53'))][(_0x2df4('0x54'))](_0x2df4('0x55'));}if(_0x16c809[_0x2df4('0x4c')]){return _0x39bcfe[_0x2df4('0x49')](_0x4d337e,_0x16c809[_0x2df4('0x4c')]+path[_0x2df4('0x56')](_0x4d337e),function(){if(_0x32450d){fs['unlink'](_0x4d337e);}});}else{return _0x39bcfe[_0x2df4('0x49')](_0x4d337e,function(_0x10a5ed){if(_0x32450d){fs['unlink'](_0x4d337e);}});}}})[_0x2df4('0x44')](function(_0x592298){if(_0x592298['message']===_0x2df4('0x55')){_0x39bcfe['status'](0x194)['send'](_0x2df4('0x57'));}else{return handleError(_0x39bcfe,null);}});};exports[_0x2df4('0x25')]=function(_0x5199c3,_0x37b698){return db['SquareRecording'][_0x2df4('0x46')]({'where':{'id':_0x5199c3[_0x2df4('0x45')]['id']}})['then'](function(_0x5c54b1){if(_[_0x2df4('0x58')](_0x5c54b1)){throw new ReferenceError(_0x2df4('0x59'));}return _0x5c54b1;})[_0x2df4('0x24')](function(_0x4935e9){var _0x5d04ae=_0x4935e9[_0x2df4('0x4b')];logger[_0x2df4('0x5a')](_0x2df4('0x5b'),_0x5d04ae);if(!_[_0x2df4('0x58')](_0x4935e9[_0x2df4('0x4b')])&&fs['existsSync'](_0x5d04ae)){logger[_0x2df4('0x5a')](_0x2df4('0x5c')+_0x5d04ae+_0x2df4('0x5d'));fs[_0x2df4('0x5e')](_0x5d04ae);}_0x5d04ae=_0x5d04ae+_0x2df4('0x5f');if(!_[_0x2df4('0x58')](_0x4935e9[_0x2df4('0x4b')])&&fs[_0x2df4('0x4f')](_0x5d04ae)){logger['info'](_0x2df4('0x5c')+_0x5d04ae+_0x2df4('0x5d'));fs[_0x2df4('0x5e')](_0x5d04ae);}return _0x4935e9;})[_0x2df4('0x24')](function(_0x3eefcc){if(!_0x3eefcc)throw new InternalError();return _0x3eefcc['destroy']();})[_0x2df4('0x24')](function(){_0x37b698[_0x2df4('0x19')](0xcc)[_0x2df4('0x1a')]();})['catch'](handleError(_0x37b698,null));}; \ No newline at end of file +var _0x0618=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','catch','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','SquareRecording\x20not\x20found','send','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','error','stack','name','index','map','SquareRecording','fieldName','type','key','model','query','keys','filters'];(function(_0x55c5df,_0xb567d8){var _0x173316=function(_0x3f87ed){while(--_0x3f87ed){_0x55c5df['push'](_0x55c5df['shift']());}};_0x173316(++_0xb567d8);}(_0x0618,0x8e));var _0x8061=function(_0x259dbe,_0x1cb9f4){_0x259dbe=_0x259dbe-0x0;var _0x2e0f46=_0x0618[_0x259dbe];return _0x2e0f46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8061('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8061('0x1'));var rp=require(_0x8061('0x2'));var moment=require('moment');var BPromise=require(_0x8061('0x3'));var Mustache=require(_0x8061('0x4'));var util=require(_0x8061('0x5'));var path=require(_0x8061('0x6'));var sox=require('sox');var csv=require(_0x8061('0x7'));var ejs=require(_0x8061('0x8'));var fs=require('fs');var fs_extra=require(_0x8061('0x9'));var _=require(_0x8061('0xa'));var squel=require(_0x8061('0xb'));var crypto=require(_0x8061('0xc'));var jsforce=require(_0x8061('0xd'));var deskjs=require(_0x8061('0xe'));var toCsv=require(_0x8061('0x7'));var querystring=require(_0x8061('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8061('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8061('0x11'));var hardwareService=require(_0x8061('0x12'));var logger=require(_0x8061('0x13'))(_0x8061('0x14'));var utils=require('../../config/utils');var config=require(_0x8061('0x15'));var licenseUtil=require(_0x8061('0x16'));var db=require(_0x8061('0x17'))['db'];function respondWithStatusCode(_0x11b57e,_0x5911ae){_0x5911ae=_0x5911ae||0xcc;return function(_0x4bb2f6){if(_0x4bb2f6){return _0x11b57e[_0x8061('0x18')](_0x5911ae);}return _0x11b57e[_0x8061('0x19')](_0x5911ae)[_0x8061('0x1a')]();};}function respondWithResult(_0x148164,_0xac44b9){_0xac44b9=_0xac44b9||0xc8;return function(_0x3731e6){if(_0x3731e6){return _0x148164['status'](_0xac44b9)[_0x8061('0x1b')](_0x3731e6);}};}function respondWithFilteredResult(_0x3bdaa1,_0x17e50c){return function(_0x6c4986){if(_0x6c4986){var _0x4d451d=typeof _0x17e50c[_0x8061('0x1c')]===_0x8061('0x1d')&&typeof _0x17e50c[_0x8061('0x1e')]===_0x8061('0x1d');var _0x1f08c4=_0x6c4986[_0x8061('0x1f')];var _0xf30af4=_0x4d451d?0x0:_0x17e50c[_0x8061('0x1c')];var _0xce2eb7=_0x4d451d?_0x6c4986[_0x8061('0x1f')]:_0x17e50c[_0x8061('0x1c')]+_0x17e50c['limit'];var _0x5bf365;if(_0xce2eb7>=_0x1f08c4){_0xce2eb7=_0x1f08c4;_0x5bf365=0xc8;}else{_0x5bf365=0xce;}_0x3bdaa1[_0x8061('0x19')](_0x5bf365);return _0x3bdaa1[_0x8061('0x20')](_0x8061('0x21'),_0xf30af4+'-'+_0xce2eb7+'/'+_0x1f08c4)[_0x8061('0x1b')](_0x6c4986);}return null;};}function patchUpdates(_0x4cc5fd){return function(_0x4588d4){try{jsonpatch['apply'](_0x4588d4,_0x4cc5fd,!![]);}catch(_0x3ae259){return BPromise[_0x8061('0x22')](_0x3ae259);}return _0x4588d4['save']();};}function saveUpdates(_0x565d09,_0x5903bf){return function(_0x29b4ef){if(_0x29b4ef){return _0x29b4ef['update'](_0x565d09)['then'](function(_0x3df7a3){return _0x3df7a3;});}return null;};}function removeEntity(_0x3fa277,_0x603cac){return function(_0x561b10){if(_0x561b10){return _0x561b10[_0x8061('0x23')]()[_0x8061('0x24')](function(){_0x3fa277[_0x8061('0x19')](0xcc)[_0x8061('0x1a')]();});}};}function handleEntityNotFound(_0x5a3034,_0x3d8a29){return function(_0xda7395){if(!_0xda7395){_0x5a3034[_0x8061('0x18')](0x194);}return _0xda7395;};}function handleError(_0xbb7a98,_0x252330){_0x252330=_0x252330||0x1f4;return function(_0x5de74f){logger[_0x8061('0x25')](_0x5de74f[_0x8061('0x26')]);if(_0x5de74f['name']){delete _0x5de74f[_0x8061('0x27')];}_0xbb7a98[_0x8061('0x19')](_0x252330)['send'](_0x5de74f);};}exports[_0x8061('0x28')]=function(_0xb95edb,_0x371fee){var _0xa623ed={},_0x4e9996={},_0x59224c={'count':0x0,'rows':[]};var _0x6f41c9=_[_0x8061('0x29')](db[_0x8061('0x2a')]['rawAttributes'],function(_0x274987){return{'name':_0x274987[_0x8061('0x2b')],'type':_0x274987[_0x8061('0x2c')][_0x8061('0x2d')]};});_0x4e9996[_0x8061('0x2e')]=_[_0x8061('0x29')](_0x6f41c9,_0x8061('0x27'));_0x4e9996[_0x8061('0x2f')]=_[_0x8061('0x30')](_0xb95edb[_0x8061('0x2f')]);_0x4e9996[_0x8061('0x31')]=_['intersection'](_0x4e9996['model'],_0x4e9996['query']);_0xa623ed[_0x8061('0x32')]=_[_0x8061('0x33')](_0x4e9996[_0x8061('0x2e')],qs[_0x8061('0x34')](_0xb95edb[_0x8061('0x2f')][_0x8061('0x34')]));_0xa623ed[_0x8061('0x32')]=_0xa623ed[_0x8061('0x32')][_0x8061('0x35')]?_0xa623ed[_0x8061('0x32')]:_0x4e9996[_0x8061('0x2e')];if(!_0xb95edb[_0x8061('0x2f')][_0x8061('0x36')](_0x8061('0x37'))){_0xa623ed['limit']=qs[_0x8061('0x1e')](_0xb95edb['query'][_0x8061('0x1e')]);_0xa623ed['offset']=qs[_0x8061('0x1c')](_0xb95edb['query'][_0x8061('0x1c')]);}_0xa623ed[_0x8061('0x38')]=qs[_0x8061('0x39')](_0xb95edb[_0x8061('0x2f')]['sort']);_0xa623ed[_0x8061('0x3a')]=qs[_0x8061('0x31')](_['pick'](_0xb95edb[_0x8061('0x2f')],_0x4e9996[_0x8061('0x31')]),_0x6f41c9);if(_0xb95edb[_0x8061('0x2f')][_0x8061('0x3b')]){_0xa623ed[_0x8061('0x3a')]=_[_0x8061('0x3c')](_0xa623ed[_0x8061('0x3a')],{'$or':_[_0x8061('0x29')](_0x6f41c9,function(_0x103869){if(_0x103869[_0x8061('0x2c')]!=='VIRTUAL'){var _0x415879={};_0x415879[_0x103869[_0x8061('0x27')]]={'$like':'%'+_0xb95edb[_0x8061('0x2f')][_0x8061('0x3b')]+'%'};return _0x415879;}})});}_0xa623ed=_[_0x8061('0x3c')]({},_0xa623ed,_0xb95edb[_0x8061('0x3d')]);var _0x322c08={'where':_0xa623ed[_0x8061('0x3a')]};return db['SquareRecording']['count'](_0x322c08)[_0x8061('0x24')](function(_0x24d1d2){_0x59224c[_0x8061('0x1f')]=_0x24d1d2;if(_0xb95edb['query'][_0x8061('0x3e')]){_0xa623ed[_0x8061('0x3f')]=[{'all':!![]}];}return db[_0x8061('0x2a')]['findAll'](_0xa623ed);})[_0x8061('0x24')](function(_0x20e7d2){_0x59224c[_0x8061('0x40')]=_0x20e7d2;return _0x59224c;})[_0x8061('0x24')](respondWithFilteredResult(_0x371fee,_0xa623ed))['catch'](handleError(_0x371fee,null));};exports[_0x8061('0x41')]=function(_0x2b0438,_0x5877e0){var _0x4ba86c={'raw':!![],'where':{'id':_0x2b0438[_0x8061('0x42')]['id']}},_0x38a83c={};_0x38a83c[_0x8061('0x2e')]=_[_0x8061('0x30')](db['SquareRecording'][_0x8061('0x43')]);_0x38a83c[_0x8061('0x2f')]=_[_0x8061('0x30')](_0x2b0438[_0x8061('0x2f')]);_0x38a83c[_0x8061('0x31')]=_[_0x8061('0x33')](_0x38a83c['model'],_0x38a83c[_0x8061('0x2f')]);_0x4ba86c[_0x8061('0x32')]=_['intersection'](_0x38a83c[_0x8061('0x2e')],qs['fields'](_0x2b0438[_0x8061('0x2f')][_0x8061('0x34')]));_0x4ba86c[_0x8061('0x32')]=_0x4ba86c['attributes'][_0x8061('0x35')]?_0x4ba86c['attributes']:_0x38a83c[_0x8061('0x2e')];if(_0x2b0438[_0x8061('0x2f')]['includeAll']){_0x4ba86c[_0x8061('0x3f')]=[{'all':!![]}];}_0x4ba86c=_[_0x8061('0x3c')]({},_0x4ba86c,_0x2b0438['options']);return db[_0x8061('0x2a')][_0x8061('0x44')](_0x4ba86c)['then'](handleEntityNotFound(_0x5877e0,null))[_0x8061('0x24')](respondWithResult(_0x5877e0,null))['catch'](handleError(_0x5877e0,null));};exports[_0x8061('0x45')]=function(_0x6b0bd8,_0x7c269b){return db[_0x8061('0x2a')][_0x8061('0x45')](_0x6b0bd8[_0x8061('0x46')],{})[_0x8061('0x24')](respondWithResult(_0x7c269b,0xc9))[_0x8061('0x47')](handleError(_0x7c269b,null));};exports['update']=function(_0x29ad04,_0x99a3d9){if(_0x29ad04[_0x8061('0x46')]['id']){delete _0x29ad04['body']['id'];}return db[_0x8061('0x2a')][_0x8061('0x44')]({'where':{'id':_0x29ad04[_0x8061('0x42')]['id']}})[_0x8061('0x24')](handleEntityNotFound(_0x99a3d9,null))[_0x8061('0x24')](saveUpdates(_0x29ad04['body'],null))[_0x8061('0x24')](respondWithResult(_0x99a3d9,null))['catch'](handleError(_0x99a3d9,null));};exports[_0x8061('0x48')]=function(_0x514865,_0x4fd666,_0x5d5ef9){var _0x6ba088=require(_0x8061('0x49'));var _0x173c0a=![];var _0x2cb97f={};if(_0x514865[_0x8061('0x2f')][_0x8061('0x2c')]&&_0x514865[_0x8061('0x2f')][_0x8061('0x2c')]===_0x8061('0x4a')){_0x2cb97f['uniqueid']=_0x514865[_0x8061('0x42')]['id'];}else{_0x2cb97f['id']=_0x514865[_0x8061('0x42')]['id'];}return db[_0x8061('0x2a')]['find']({'where':_0x2cb97f,'attributes':['id',_0x8061('0x4b'),'filename'],'raw':!![]})[_0x8061('0x24')](handleEntityNotFound(_0x4fd666,null))[_0x8061('0x24')](function(_0x3a6687){if(_0x3a6687){var _0x4794b6=_0x3a6687[_0x8061('0x4b')];var _0x194d2e=util['format'](_0x8061('0x4c'),_0x4794b6);if(fs[_0x8061('0x4d')](_0x194d2e)){_0x173c0a=!![];return _0x6ba088[_0x8061('0x4e')](_0x194d2e,_0x4794b6,config[_0x8061('0x4f')][_0x8061('0x50')])['then'](function(){return _0x3a6687;});}return _0x3a6687;}})['then'](function(_0x26831a){if(_0x26831a){var _0x1df95e=_0x26831a[_0x8061('0x4b')];if(!fs[_0x8061('0x4d')](_0x1df95e)){throw new db[(_0x8061('0x51'))][(_0x8061('0x52'))]('SquareRecording\x20not\x20found');}if(_0x26831a[_0x8061('0x53')]){return _0x4fd666[_0x8061('0x48')](_0x1df95e,_0x26831a[_0x8061('0x53')]+path[_0x8061('0x54')](_0x1df95e),function(){if(_0x173c0a){fs[_0x8061('0x55')](_0x1df95e);}});}else{return _0x4fd666[_0x8061('0x48')](_0x1df95e,function(_0x111e53){if(_0x173c0a){fs[_0x8061('0x55')](_0x1df95e);}});}}})[_0x8061('0x47')](function(_0xd22472){if(_0xd22472[_0x8061('0x56')]===_0x8061('0x57')){_0x4fd666[_0x8061('0x19')](0x194)[_0x8061('0x58')](_0x8061('0x59'));}else{return handleError(_0x4fd666,null);}});};exports[_0x8061('0x23')]=function(_0xceca18,_0x39ae0d){return db['SquareRecording']['find']({'where':{'id':_0xceca18['params']['id']}})[_0x8061('0x24')](function(_0x3687c5){if(_[_0x8061('0x5a')](_0x3687c5)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3687c5;})[_0x8061('0x24')](function(_0x1f811a){var _0x5affcf=_0x1f811a[_0x8061('0x4b')];logger[_0x8061('0x5b')](_0x8061('0x5c'),_0x5affcf);if(!_[_0x8061('0x5a')](_0x1f811a[_0x8061('0x4b')])&&fs[_0x8061('0x4d')](_0x5affcf)){logger[_0x8061('0x5b')](_0x8061('0x5d')+_0x5affcf+_0x8061('0x5e'));fs[_0x8061('0x5f')](_0x5affcf);}_0x5affcf=_0x5affcf+'.cypher';if(!_[_0x8061('0x5a')](_0x1f811a['savePath'])&&fs['existsSync'](_0x5affcf)){logger[_0x8061('0x5b')](_0x8061('0x5d')+_0x5affcf+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8061('0x5f')](_0x5affcf);}return _0x1f811a;})[_0x8061('0x24')](function(_0x20727){if(!_0x20727)throw new InternalError();return _0x20727['destroy']();})['then'](function(){_0x39ae0d['status'](0xcc)[_0x8061('0x1a')]();})[_0x8061('0x47')](handleError(_0x39ae0d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6decfad..b9760e5 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 _0xf777=['api','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger'];(function(_0x41f7f1,_0x50cb58){var _0x46b865=function(_0x36b14d){while(--_0x36b14d){_0x41f7f1['push'](_0x41f7f1['shift']());}};_0x46b865(++_0x50cb58);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var logger=require(_0x7f77('0x2'))(_0x7f77('0x3'));var moment=require(_0x7f77('0x4'));var BPromise=require(_0x7f77('0x5'));var rp=require(_0x7f77('0x6'));var fs=require('fs');var path=require(_0x7f77('0x7'));var rimraf=require(_0x7f77('0x8'));var config=require('../../config/environment');var attributes=require(_0x7f77('0x9'));module[_0x7f77('0xa')]=function(_0x5ad140,_0x3b0afc){return _0x5ad140['define'](_0x7f77('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4351=['exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x4351,0x1b5));var _0x1435=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4351[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var logger=require(_0x1435('0x2'))(_0x1435('0x3'));var moment=require(_0x1435('0x4'));var BPromise=require(_0x1435('0x5'));var rp=require(_0x1435('0x6'));var fs=require('fs');var path=require(_0x1435('0x7'));var rimraf=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var attributes=require(_0x1435('0xa'));module[_0x1435('0xb')]=function(_0x1f0838,_0x3a9f9a){return _0x1f0838[_0x1435('0xc')]('SquareRecording',attributes,{'tableName':_0x1435('0xd'),'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 48e7e21..ed27b71 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 _0x8e93=['body','options','raw','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording','create'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8e93,0xba));var _0x38e9=function(_0x40afde,_0x50bd36){_0x40afde=_0x40afde-0x0;var _0x37d62b=_0x8e93[_0x40afde];return _0x37d62b;};'use strict';var _=require('lodash');var util=require(_0x38e9('0x0'));var moment=require(_0x38e9('0x1'));var BPromise=require(_0x38e9('0x2'));var rs=require(_0x38e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38e9('0x4'))['db'];var utils=require(_0x38e9('0x5'));var logger=require(_0x38e9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x38e9('0x7')][_0x38e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x107001,_0x4a2856,_0x3a3237){return new BPromise(function(_0x4ee09,_0xbf3e86){return client[_0x38e9('0x9')](_0x107001,_0x3a3237)[_0x38e9('0xa')](function(_0x3e6436){logger[_0x38e9('0xb')](_0x38e9('0xc'),_0x4a2856,_0x38e9('0xd'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4a2856,_0x38e9('0xd'),JSON[_0x38e9('0xe')](_0x3e6436));if(_0x3e6436[_0x38e9('0xf')]){if(_0x3e6436[_0x38e9('0xf')][_0x38e9('0x10')]===0x1f4){logger['error'](_0x38e9('0xc'),_0x4a2856,_0x3e6436[_0x38e9('0xf')][_0x38e9('0x11')]);return _0xbf3e86(_0x3e6436[_0x38e9('0xf')][_0x38e9('0x11')]);}logger[_0x38e9('0xf')](_0x38e9('0xc'),_0x4a2856,_0x3e6436[_0x38e9('0xf')][_0x38e9('0x11')]);return _0x4ee09(_0x3e6436['error'][_0x38e9('0x11')]);}else{logger[_0x38e9('0xb')](_0x38e9('0xc'),_0x4a2856,_0x38e9('0xd'));_0x4ee09(_0x3e6436[_0x38e9('0x12')]['message']);}})[_0x38e9('0x13')](function(_0x67cc54){logger[_0x38e9('0xf')](_0x38e9('0xc'),_0x4a2856,_0x67cc54);_0xbf3e86(_0x67cc54);});});}exports[_0x38e9('0x14')]=function(_0x5b72e4){var _0x37c866=this;return new Promise(function(_0x174b98,_0x4a61e7){return db['SquareRecording'][_0x38e9('0x15')](_0x5b72e4[_0x38e9('0x16')],{'raw':_0x5b72e4[_0x38e9('0x17')]?_0x5b72e4['options'][_0x38e9('0x18')]===undefined?!![]:![]:!![]})[_0x38e9('0xa')](function(_0x5a4054){logger[_0x38e9('0xb')]('CreateSquareRecording',_0x5b72e4);logger[_0x38e9('0x19')](_0x38e9('0x14'),_0x5b72e4,JSON[_0x38e9('0xe')](_0x5a4054));_0x174b98(_0x5a4054);})[_0x38e9('0x13')](function(_0x3bcd2c){logger['error']('CreateSquareRecording',_0x3bcd2c['message'],_0x5b72e4);_0x4a61e7(_0x37c866['error'](0x1f4,_0x3bcd2c[_0x38e9('0x11')]));});});}; \ No newline at end of file +var _0xa6f8=['raw','then','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareRecording','body','options'];(function(_0x465bcc,_0x16272c){var _0x3943e3=function(_0xd87261){while(--_0xd87261){_0x465bcc['push'](_0x465bcc['shift']());}};_0x3943e3(++_0x16272c);}(_0xa6f8,0x1d4));var _0x8a6f=function(_0x33d63e,_0x3268e5){_0x33d63e=_0x33d63e-0x0;var _0x30ed75=_0xa6f8[_0x33d63e];return _0x30ed75;};'use strict';var _=require(_0x8a6f('0x0'));var util=require(_0x8a6f('0x1'));var moment=require(_0x8a6f('0x2'));var BPromise=require(_0x8a6f('0x3'));var rs=require(_0x8a6f('0x4'));var fs=require('fs');var Redis=require(_0x8a6f('0x5'));var db=require(_0x8a6f('0x6'))['db'];var utils=require(_0x8a6f('0x7'));var logger=require(_0x8a6f('0x8'))(_0x8a6f('0x9'));var config=require(_0x8a6f('0xa'));var jayson=require(_0x8a6f('0xb'));var client=jayson[_0x8a6f('0xc')][_0x8a6f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1418ee,_0x3e93a6,_0x30333c){return new BPromise(function(_0x7061c9,_0x32ea7e){return client[_0x8a6f('0xe')](_0x1418ee,_0x30333c)['then'](function(_0x41d2ca){logger[_0x8a6f('0xf')](_0x8a6f('0x10'),_0x3e93a6,_0x8a6f('0x11'));logger[_0x8a6f('0x12')](_0x8a6f('0x13'),_0x3e93a6,_0x8a6f('0x11'),JSON[_0x8a6f('0x14')](_0x41d2ca));if(_0x41d2ca[_0x8a6f('0x15')]){if(_0x41d2ca[_0x8a6f('0x15')]['code']===0x1f4){logger[_0x8a6f('0x15')](_0x8a6f('0x10'),_0x3e93a6,_0x41d2ca['error']['message']);return _0x32ea7e(_0x41d2ca[_0x8a6f('0x15')][_0x8a6f('0x16')]);}logger[_0x8a6f('0x15')](_0x8a6f('0x10'),_0x3e93a6,_0x41d2ca[_0x8a6f('0x15')][_0x8a6f('0x16')]);return _0x7061c9(_0x41d2ca[_0x8a6f('0x15')][_0x8a6f('0x16')]);}else{logger[_0x8a6f('0xf')](_0x8a6f('0x10'),_0x3e93a6,_0x8a6f('0x11'));_0x7061c9(_0x41d2ca[_0x8a6f('0x17')]['message']);}})[_0x8a6f('0x18')](function(_0x2751dc){logger[_0x8a6f('0x15')](_0x8a6f('0x10'),_0x3e93a6,_0x2751dc);_0x32ea7e(_0x2751dc);});});}exports['CreateSquareRecording']=function(_0x36c9ee){var _0x597243=this;return new Promise(function(_0xb6cbbc,_0x19c59a){return db[_0x8a6f('0x19')]['create'](_0x36c9ee[_0x8a6f('0x1a')],{'raw':_0x36c9ee['options']?_0x36c9ee[_0x8a6f('0x1b')][_0x8a6f('0x1c')]===undefined?!![]:![]:!![]})[_0x8a6f('0x1d')](function(_0x337293){logger[_0x8a6f('0xf')](_0x8a6f('0x1e'),_0x36c9ee);logger[_0x8a6f('0x12')](_0x8a6f('0x1e'),_0x36c9ee,JSON[_0x8a6f('0x14')](_0x337293));_0xb6cbbc(_0x337293);})[_0x8a6f('0x18')](function(_0x5ef5d7){logger['error'](_0x8a6f('0x1e'),_0x5ef5d7[_0x8a6f('0x16')],_0x36c9ee);_0x19c59a(_0x597243[_0x8a6f('0x15')](0x1f4,_0x5ef5d7[_0x8a6f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index f88744e..306b7ed 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x596e98,_0xc326c9){var _0x1c09ac=function(_0x3d839d){while(--_0x3d839d){_0x596e98['push'](_0x596e98['shift']());}};_0x1c09ac(++_0xc326c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x7b4397,_0x50ab04){var _0x16de0b=function(_0x26a130){while(--_0x26a130){_0x7b4397['push'](_0x7b4397['shift']());}};_0x16de0b(++_0x50ab04);}(_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 ed8a2c3..b523e22 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 _0xee2b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x42181c,_0x267642){var _0x2e2e20=function(_0x430bad){while(--_0x430bad){_0x42181c['push'](_0x42181c['shift']());}};_0x2e2e20(++_0x267642);}(_0xee2b,0x122));var _0xbee2=function(_0x217507,_0x4858d8){_0x217507=_0x217507-0x0;var _0x3d5481=_0xee2b[_0x217507];return _0x3d5481;};'use strict';var Sequelize=require(_0xbee2('0x0'));module[_0xbee2('0x1')]={'network':{'type':Sequelize[_0xbee2('0x2')]},'network_script':{'type':Sequelize[_0xbee2('0x2')]},'request':{'type':Sequelize[_0xbee2('0x2')]},'channel':{'type':Sequelize[_0xbee2('0x2')]},'language':{'type':Sequelize[_0xbee2('0x2')]},'type':{'type':Sequelize[_0xbee2('0x2')]},'uniqueid':{'type':Sequelize[_0xbee2('0x2')]},'version':{'type':Sequelize[_0xbee2('0x2')]},'callerid':{'type':Sequelize[_0xbee2('0x2')]},'calleridname':{'type':Sequelize[_0xbee2('0x2')]},'callingpres':{'type':Sequelize[_0xbee2('0x2')]},'callingani2':{'type':Sequelize[_0xbee2('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xbee2('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xbee2('0x2')]},'context':{'type':Sequelize[_0xbee2('0x2')]},'extension':{'type':Sequelize[_0xbee2('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xbee2('0x2')]},'accountcode':{'type':Sequelize[_0xbee2('0x2')]},'threadid':{'type':Sequelize[_0xbee2('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xbee2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1728=['STRING','DATE','sequelize','exports'];(function(_0x980e52,_0x2c9bfb){var _0x27168e=function(_0x2e9c47){while(--_0x2e9c47){_0x980e52['push'](_0x980e52['shift']());}};_0x27168e(++_0x2c9bfb);}(_0x1728,0x19a));var _0x8172=function(_0x53a905,_0x3c4e73){_0x53a905=_0x53a905-0x0;var _0x3e9a13=_0x1728[_0x53a905];return _0x3e9a13;};'use strict';var Sequelize=require(_0x8172('0x0'));module[_0x8172('0x1')]={'network':{'type':Sequelize[_0x8172('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x8172('0x2')]},'channel':{'type':Sequelize[_0x8172('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8172('0x2')]},'version':{'type':Sequelize[_0x8172('0x2')]},'callerid':{'type':Sequelize[_0x8172('0x2')]},'calleridname':{'type':Sequelize[_0x8172('0x2')]},'callingpres':{'type':Sequelize[_0x8172('0x2')]},'callingani2':{'type':Sequelize[_0x8172('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x8172('0x2')]},'dnid':{'type':Sequelize[_0x8172('0x2')]},'rdnis':{'type':Sequelize[_0x8172('0x2')]},'context':{'type':Sequelize[_0x8172('0x2')]},'extension':{'type':Sequelize[_0x8172('0x2')]},'priority':{'type':Sequelize[_0x8172('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8172('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x8172('0x2')]},'joinAt':{'type':Sequelize[_0x8172('0x3')]},'leaveAt':{'type':Sequelize[_0x8172('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 4fc6118..dab1490 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 _0xdfcc=['fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','SquareReport','count','then','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xdfcc,0x8f));var _0xcdfc=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xdfcc[_0xccf869];return _0x21a9db;};'use strict';var emlformat=require(_0xcdfc('0x0'));var rimraf=require(_0xcdfc('0x1'));var zipdir=require(_0xcdfc('0x2'));var jsonpatch=require(_0xcdfc('0x3'));var rp=require(_0xcdfc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcdfc('0x5'));var util=require(_0xcdfc('0x6'));var path=require(_0xcdfc('0x7'));var sox=require(_0xcdfc('0x8'));var csv=require(_0xcdfc('0x9'));var ejs=require(_0xcdfc('0xa'));var fs=require('fs');var fs_extra=require(_0xcdfc('0xb'));var _=require(_0xcdfc('0xc'));var squel=require(_0xcdfc('0xd'));var crypto=require('crypto');var jsforce=require(_0xcdfc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcdfc('0x9'));var querystring=require(_0xcdfc('0xf'));var Papa=require(_0xcdfc('0x10'));var Redis=require('ioredis');var authService=require(_0xcdfc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcdfc('0x12'));var hardwareService=require(_0xcdfc('0x13'));var logger=require('../../config/logger')(_0xcdfc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcdfc('0x15'));var db=require(_0xcdfc('0x16'))['db'];function respondWithStatusCode(_0x5a123f,_0x577f1c){_0x577f1c=_0x577f1c||0xcc;return function(_0x2801a8){if(_0x2801a8){return _0x5a123f[_0xcdfc('0x17')](_0x577f1c);}return _0x5a123f[_0xcdfc('0x18')](_0x577f1c)[_0xcdfc('0x19')]();};}function respondWithResult(_0x208a12,_0x51f0d4){_0x51f0d4=_0x51f0d4||0xc8;return function(_0xafd4ad){if(_0xafd4ad){return _0x208a12[_0xcdfc('0x18')](_0x51f0d4)[_0xcdfc('0x1a')](_0xafd4ad);}};}function respondWithFilteredResult(_0x42bf97,_0x15e2ad){return function(_0x159617){if(_0x159617){var _0x4e5c56=typeof _0x15e2ad[_0xcdfc('0x1b')]==='undefined'&&typeof _0x15e2ad[_0xcdfc('0x1c')]===_0xcdfc('0x1d');var _0xebc401=_0x159617['count'];var _0x23f74b=_0x4e5c56?0x0:_0x15e2ad[_0xcdfc('0x1b')];var _0x47fa3d=_0x4e5c56?_0x159617['count']:_0x15e2ad[_0xcdfc('0x1b')]+_0x15e2ad[_0xcdfc('0x1c')];var _0x3fc4e0;if(_0x47fa3d>=_0xebc401){_0x47fa3d=_0xebc401;_0x3fc4e0=0xc8;}else{_0x3fc4e0=0xce;}_0x42bf97[_0xcdfc('0x18')](_0x3fc4e0);return _0x42bf97[_0xcdfc('0x1e')]('Content-Range',_0x23f74b+'-'+_0x47fa3d+'/'+_0xebc401)[_0xcdfc('0x1a')](_0x159617);}return null;};}function patchUpdates(_0x641a9c){return function(_0x3cea4d){try{jsonpatch[_0xcdfc('0x1f')](_0x3cea4d,_0x641a9c,!![]);}catch(_0x4a82f7){return BPromise[_0xcdfc('0x20')](_0x4a82f7);}return _0x3cea4d[_0xcdfc('0x21')]();};}function saveUpdates(_0x7819c2,_0x4b01b5){return function(_0x204f80){if(_0x204f80){return _0x204f80[_0xcdfc('0x22')](_0x7819c2)['then'](function(_0x110056){return _0x110056;});}return null;};}function removeEntity(_0x373b32,_0xcf5181){return function(_0x59358a){if(_0x59358a){return _0x59358a[_0xcdfc('0x23')]()['then'](function(){_0x373b32['status'](0xcc)[_0xcdfc('0x19')]();});}};}function handleEntityNotFound(_0x1d55e9,_0x5ce15b){return function(_0x2afd26){if(!_0x2afd26){_0x1d55e9[_0xcdfc('0x17')](0x194);}return _0x2afd26;};}function handleError(_0x5e8dee,_0xb5bc0a){_0xb5bc0a=_0xb5bc0a||0x1f4;return function(_0x329819){logger[_0xcdfc('0x24')](_0x329819[_0xcdfc('0x25')]);if(_0x329819['name']){delete _0x329819['name'];}_0x5e8dee[_0xcdfc('0x18')](_0xb5bc0a)[_0xcdfc('0x26')](_0x329819);};}exports['index']=function(_0x2f730c,_0x1cd931){var _0x56e3ed={},_0x3ca6bf={},_0x3a0726={'count':0x0,'rows':[]};var _0x5dfb65=_[_0xcdfc('0x27')](db['SquareReport'][_0xcdfc('0x28')],function(_0x54c3e9){return{'name':_0x54c3e9[_0xcdfc('0x29')],'type':_0x54c3e9[_0xcdfc('0x2a')][_0xcdfc('0x2b')]};});_0x3ca6bf[_0xcdfc('0x2c')]=_[_0xcdfc('0x27')](_0x5dfb65,_0xcdfc('0x2d'));_0x3ca6bf[_0xcdfc('0x2e')]=_[_0xcdfc('0x2f')](_0x2f730c[_0xcdfc('0x2e')]);_0x3ca6bf[_0xcdfc('0x30')]=_['intersection'](_0x3ca6bf['model'],_0x3ca6bf[_0xcdfc('0x2e')]);_0x56e3ed[_0xcdfc('0x31')]=_[_0xcdfc('0x32')](_0x3ca6bf[_0xcdfc('0x2c')],qs[_0xcdfc('0x33')](_0x2f730c[_0xcdfc('0x2e')][_0xcdfc('0x33')]));_0x56e3ed[_0xcdfc('0x31')]=_0x56e3ed[_0xcdfc('0x31')][_0xcdfc('0x34')]?_0x56e3ed['attributes']:_0x3ca6bf[_0xcdfc('0x2c')];if(!_0x2f730c[_0xcdfc('0x2e')][_0xcdfc('0x35')](_0xcdfc('0x36'))){_0x56e3ed['limit']=qs['limit'](_0x2f730c[_0xcdfc('0x2e')]['limit']);_0x56e3ed[_0xcdfc('0x1b')]=qs[_0xcdfc('0x1b')](_0x2f730c[_0xcdfc('0x2e')]['offset']);}_0x56e3ed['order']=qs[_0xcdfc('0x37')](_0x2f730c[_0xcdfc('0x2e')][_0xcdfc('0x37')]);_0x56e3ed['where']=qs['filters'](_[_0xcdfc('0x38')](_0x2f730c['query'],_0x3ca6bf['filters']),_0x5dfb65);if(_0x2f730c[_0xcdfc('0x2e')]['filter']){_0x56e3ed[_0xcdfc('0x39')]=_[_0xcdfc('0x3a')](_0x56e3ed[_0xcdfc('0x39')],{'$or':_[_0xcdfc('0x27')](_0x5dfb65,function(_0x22bf48){if(_0x22bf48[_0xcdfc('0x2a')]!=='VIRTUAL'){var _0x627782={};_0x627782[_0x22bf48[_0xcdfc('0x2d')]]={'$like':'%'+_0x2f730c['query']['filter']+'%'};return _0x627782;}})});}_0x56e3ed=_[_0xcdfc('0x3a')]({},_0x56e3ed,_0x2f730c[_0xcdfc('0x3b')]);var _0x279737={'where':_0x56e3ed[_0xcdfc('0x39')]};return db[_0xcdfc('0x3c')][_0xcdfc('0x3d')](_0x279737)[_0xcdfc('0x3e')](function(_0x3c7f20){_0x3a0726[_0xcdfc('0x3d')]=_0x3c7f20;if(_0x2f730c['query'][_0xcdfc('0x3f')]){_0x56e3ed[_0xcdfc('0x40')]=[{'all':!![]}];}return db[_0xcdfc('0x3c')]['findAll'](_0x56e3ed);})[_0xcdfc('0x3e')](function(_0x78f95){_0x3a0726[_0xcdfc('0x41')]=_0x78f95;return _0x3a0726;})[_0xcdfc('0x3e')](respondWithFilteredResult(_0x1cd931,_0x56e3ed))[_0xcdfc('0x42')](handleError(_0x1cd931,null));};exports[_0xcdfc('0x43')]=function(_0x38666d,_0xb4ea6a){var _0x49312c={'raw':!![],'where':{'id':_0x38666d[_0xcdfc('0x44')]['id']}},_0x28b38c={};_0x28b38c['model']=_['keys'](db[_0xcdfc('0x3c')]['rawAttributes']);_0x28b38c[_0xcdfc('0x2e')]=_[_0xcdfc('0x2f')](_0x38666d[_0xcdfc('0x2e')]);_0x28b38c['filters']=_[_0xcdfc('0x32')](_0x28b38c[_0xcdfc('0x2c')],_0x28b38c['query']);_0x49312c[_0xcdfc('0x31')]=_[_0xcdfc('0x32')](_0x28b38c[_0xcdfc('0x2c')],qs[_0xcdfc('0x33')](_0x38666d[_0xcdfc('0x2e')]['fields']));_0x49312c[_0xcdfc('0x31')]=_0x49312c['attributes'][_0xcdfc('0x34')]?_0x49312c[_0xcdfc('0x31')]:_0x28b38c[_0xcdfc('0x2c')];if(_0x38666d[_0xcdfc('0x2e')]['includeAll']){_0x49312c[_0xcdfc('0x40')]=[{'all':!![]}];}_0x49312c=_['merge']({},_0x49312c,_0x38666d['options']);return db[_0xcdfc('0x3c')][_0xcdfc('0x45')](_0x49312c)[_0xcdfc('0x3e')](handleEntityNotFound(_0xb4ea6a,null))[_0xcdfc('0x3e')](respondWithResult(_0xb4ea6a,null))[_0xcdfc('0x42')](handleError(_0xb4ea6a,null));};exports[_0xcdfc('0x46')]=function(_0x536a8f,_0xe383cd){return db['SquareReport'][_0xcdfc('0x46')](_0x536a8f[_0xcdfc('0x47')],{})[_0xcdfc('0x3e')](respondWithResult(_0xe383cd,0xc9))[_0xcdfc('0x42')](handleError(_0xe383cd,null));};exports[_0xcdfc('0x22')]=function(_0x284d50,_0x2db5cd){if(_0x284d50[_0xcdfc('0x47')]['id']){delete _0x284d50[_0xcdfc('0x47')]['id'];}return db[_0xcdfc('0x3c')]['find']({'where':{'id':_0x284d50[_0xcdfc('0x44')]['id']}})[_0xcdfc('0x3e')](handleEntityNotFound(_0x2db5cd,null))[_0xcdfc('0x3e')](saveUpdates(_0x284d50[_0xcdfc('0x47')],null))[_0xcdfc('0x3e')](respondWithResult(_0x2db5cd,null))[_0xcdfc('0x42')](handleError(_0x2db5cd,null));};exports[_0xcdfc('0x23')]=function(_0x421edb,_0x20b28f){return db[_0xcdfc('0x3c')][_0xcdfc('0x45')]({'where':{'id':_0x421edb[_0xcdfc('0x44')]['id']}})['then'](handleEntityNotFound(_0x20b28f,null))[_0xcdfc('0x3e')](removeEntity(_0x20b28f,null))[_0xcdfc('0x42')](handleError(_0x20b28f,null));};exports[_0xcdfc('0x48')]=function(_0xbbdffd,_0x50e738){return db[_0xcdfc('0x3c')][_0xcdfc('0x48')]()[_0xcdfc('0x3e')](respondWithResult(_0x50e738,null))[_0xcdfc('0x42')](handleError(_0x50e738,null));}; \ No newline at end of file +var _0x64d6=['includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x2d4308,_0x24b39b){var _0x26d7f7=function(_0xc1a964){while(--_0xc1a964){_0x2d4308['push'](_0x2d4308['shift']());}};_0x26d7f7(++_0x24b39b);}(_0x64d6,0xeb));var _0x664d=function(_0x3a4685,_0x59eb84){_0x3a4685=_0x3a4685-0x0;var _0x174993=_0x64d6[_0x3a4685];return _0x174993;};'use strict';var emlformat=require(_0x664d('0x0'));var rimraf=require(_0x664d('0x1'));var zipdir=require(_0x664d('0x2'));var jsonpatch=require(_0x664d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x664d('0x4'));var Mustache=require(_0x664d('0x5'));var util=require(_0x664d('0x6'));var path=require(_0x664d('0x7'));var sox=require(_0x664d('0x8'));var csv=require('to-csv');var ejs=require(_0x664d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x664d('0xa'));var squel=require(_0x664d('0xb'));var crypto=require(_0x664d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x664d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x664d('0xe'));var Papa=require(_0x664d('0xf'));var Redis=require(_0x664d('0x10'));var authService=require(_0x664d('0x11'));var qs=require(_0x664d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x664d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x664d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12fc51,_0x515047){_0x515047=_0x515047||0xcc;return function(_0x47a49c){if(_0x47a49c){return _0x12fc51[_0x664d('0x15')](_0x515047);}return _0x12fc51[_0x664d('0x16')](_0x515047)[_0x664d('0x17')]();};}function respondWithResult(_0x1ee8b7,_0xc119b4){_0xc119b4=_0xc119b4||0xc8;return function(_0x5c7c23){if(_0x5c7c23){return _0x1ee8b7[_0x664d('0x16')](_0xc119b4)['json'](_0x5c7c23);}};}function respondWithFilteredResult(_0x191565,_0x22ebd6){return function(_0x4886dc){if(_0x4886dc){var _0x28af9c=typeof _0x22ebd6[_0x664d('0x18')]===_0x664d('0x19')&&typeof _0x22ebd6[_0x664d('0x1a')]===_0x664d('0x19');var _0x3e1794=_0x4886dc['count'];var _0x278b90=_0x28af9c?0x0:_0x22ebd6[_0x664d('0x18')];var _0x2a0b9d=_0x28af9c?_0x4886dc[_0x664d('0x1b')]:_0x22ebd6[_0x664d('0x18')]+_0x22ebd6[_0x664d('0x1a')];var _0x752b94;if(_0x2a0b9d>=_0x3e1794){_0x2a0b9d=_0x3e1794;_0x752b94=0xc8;}else{_0x752b94=0xce;}_0x191565[_0x664d('0x16')](_0x752b94);return _0x191565[_0x664d('0x1c')](_0x664d('0x1d'),_0x278b90+'-'+_0x2a0b9d+'/'+_0x3e1794)[_0x664d('0x1e')](_0x4886dc);}return null;};}function patchUpdates(_0x6b938f){return function(_0x71386d){try{jsonpatch[_0x664d('0x1f')](_0x71386d,_0x6b938f,!![]);}catch(_0x366307){return BPromise[_0x664d('0x20')](_0x366307);}return _0x71386d[_0x664d('0x21')]();};}function saveUpdates(_0x277b2f,_0x3ac190){return function(_0x12b878){if(_0x12b878){return _0x12b878[_0x664d('0x22')](_0x277b2f)[_0x664d('0x23')](function(_0x46fc43){return _0x46fc43;});}return null;};}function removeEntity(_0x36ebdd,_0x577dd3){return function(_0x1d9ff1){if(_0x1d9ff1){return _0x1d9ff1[_0x664d('0x24')]()[_0x664d('0x23')](function(){_0x36ebdd[_0x664d('0x16')](0xcc)[_0x664d('0x17')]();});}};}function handleEntityNotFound(_0x48f440,_0x55ce4e){return function(_0x4a1339){if(!_0x4a1339){_0x48f440[_0x664d('0x15')](0x194);}return _0x4a1339;};}function handleError(_0x12b0bd,_0x3a9ba3){_0x3a9ba3=_0x3a9ba3||0x1f4;return function(_0xa7a7f0){logger[_0x664d('0x25')](_0xa7a7f0[_0x664d('0x26')]);if(_0xa7a7f0['name']){delete _0xa7a7f0[_0x664d('0x27')];}_0x12b0bd[_0x664d('0x16')](_0x3a9ba3)[_0x664d('0x28')](_0xa7a7f0);};}exports[_0x664d('0x29')]=function(_0x39aabc,_0x1d35f0){var _0x3ac4b0={},_0x13fe2a={},_0x37b99c={'count':0x0,'rows':[]};var _0x33297f=_[_0x664d('0x2a')](db[_0x664d('0x2b')][_0x664d('0x2c')],function(_0x3b97f3){return{'name':_0x3b97f3[_0x664d('0x2d')],'type':_0x3b97f3[_0x664d('0x2e')][_0x664d('0x2f')]};});_0x13fe2a[_0x664d('0x30')]=_[_0x664d('0x2a')](_0x33297f,'name');_0x13fe2a[_0x664d('0x31')]=_[_0x664d('0x32')](_0x39aabc[_0x664d('0x31')]);_0x13fe2a[_0x664d('0x33')]=_[_0x664d('0x34')](_0x13fe2a[_0x664d('0x30')],_0x13fe2a['query']);_0x3ac4b0[_0x664d('0x35')]=_[_0x664d('0x34')](_0x13fe2a[_0x664d('0x30')],qs[_0x664d('0x36')](_0x39aabc[_0x664d('0x31')][_0x664d('0x36')]));_0x3ac4b0[_0x664d('0x35')]=_0x3ac4b0[_0x664d('0x35')][_0x664d('0x37')]?_0x3ac4b0[_0x664d('0x35')]:_0x13fe2a[_0x664d('0x30')];if(!_0x39aabc['query'][_0x664d('0x38')](_0x664d('0x39'))){_0x3ac4b0['limit']=qs[_0x664d('0x1a')](_0x39aabc[_0x664d('0x31')][_0x664d('0x1a')]);_0x3ac4b0[_0x664d('0x18')]=qs['offset'](_0x39aabc['query']['offset']);}_0x3ac4b0[_0x664d('0x3a')]=qs[_0x664d('0x3b')](_0x39aabc[_0x664d('0x31')][_0x664d('0x3b')]);_0x3ac4b0['where']=qs['filters'](_[_0x664d('0x3c')](_0x39aabc['query'],_0x13fe2a[_0x664d('0x33')]),_0x33297f);if(_0x39aabc[_0x664d('0x31')][_0x664d('0x3d')]){_0x3ac4b0[_0x664d('0x3e')]=_[_0x664d('0x3f')](_0x3ac4b0[_0x664d('0x3e')],{'$or':_[_0x664d('0x2a')](_0x33297f,function(_0x336953){if(_0x336953[_0x664d('0x2e')]!==_0x664d('0x40')){var _0x5d176c={};_0x5d176c[_0x336953[_0x664d('0x27')]]={'$like':'%'+_0x39aabc['query']['filter']+'%'};return _0x5d176c;}})});}_0x3ac4b0=_[_0x664d('0x3f')]({},_0x3ac4b0,_0x39aabc[_0x664d('0x41')]);var _0x8a6151={'where':_0x3ac4b0[_0x664d('0x3e')]};return db[_0x664d('0x2b')][_0x664d('0x1b')](_0x8a6151)[_0x664d('0x23')](function(_0x567d12){_0x37b99c[_0x664d('0x1b')]=_0x567d12;if(_0x39aabc[_0x664d('0x31')]['includeAll']){_0x3ac4b0[_0x664d('0x42')]=[{'all':!![]}];}return db[_0x664d('0x2b')][_0x664d('0x43')](_0x3ac4b0);})[_0x664d('0x23')](function(_0x455181){_0x37b99c[_0x664d('0x44')]=_0x455181;return _0x37b99c;})[_0x664d('0x23')](respondWithFilteredResult(_0x1d35f0,_0x3ac4b0))['catch'](handleError(_0x1d35f0,null));};exports['show']=function(_0x32311e,_0x1df84a){var _0x47d4a0={'raw':!![],'where':{'id':_0x32311e['params']['id']}},_0x3ad25d={};_0x3ad25d[_0x664d('0x30')]=_[_0x664d('0x32')](db['SquareReport'][_0x664d('0x2c')]);_0x3ad25d['query']=_['keys'](_0x32311e[_0x664d('0x31')]);_0x3ad25d[_0x664d('0x33')]=_['intersection'](_0x3ad25d['model'],_0x3ad25d[_0x664d('0x31')]);_0x47d4a0[_0x664d('0x35')]=_['intersection'](_0x3ad25d[_0x664d('0x30')],qs[_0x664d('0x36')](_0x32311e[_0x664d('0x31')][_0x664d('0x36')]));_0x47d4a0[_0x664d('0x35')]=_0x47d4a0[_0x664d('0x35')]['length']?_0x47d4a0[_0x664d('0x35')]:_0x3ad25d[_0x664d('0x30')];if(_0x32311e[_0x664d('0x31')][_0x664d('0x45')]){_0x47d4a0[_0x664d('0x42')]=[{'all':!![]}];}_0x47d4a0=_[_0x664d('0x3f')]({},_0x47d4a0,_0x32311e['options']);return db[_0x664d('0x2b')][_0x664d('0x46')](_0x47d4a0)[_0x664d('0x23')](handleEntityNotFound(_0x1df84a,null))[_0x664d('0x23')](respondWithResult(_0x1df84a,null))[_0x664d('0x47')](handleError(_0x1df84a,null));};exports[_0x664d('0x48')]=function(_0x218b1d,_0x4b10fa){return db[_0x664d('0x2b')][_0x664d('0x48')](_0x218b1d[_0x664d('0x49')],{})[_0x664d('0x23')](respondWithResult(_0x4b10fa,0xc9))[_0x664d('0x47')](handleError(_0x4b10fa,null));};exports[_0x664d('0x22')]=function(_0x24678e,_0x2f6854){if(_0x24678e['body']['id']){delete _0x24678e['body']['id'];}return db[_0x664d('0x2b')][_0x664d('0x46')]({'where':{'id':_0x24678e[_0x664d('0x4a')]['id']}})[_0x664d('0x23')](handleEntityNotFound(_0x2f6854,null))['then'](saveUpdates(_0x24678e['body'],null))['then'](respondWithResult(_0x2f6854,null))[_0x664d('0x47')](handleError(_0x2f6854,null));};exports[_0x664d('0x24')]=function(_0x38cb4c,_0x50e659){return db['SquareReport'][_0x664d('0x46')]({'where':{'id':_0x38cb4c[_0x664d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50e659,null))[_0x664d('0x23')](removeEntity(_0x50e659,null))[_0x664d('0x47')](handleError(_0x50e659,null));};exports[_0x664d('0x4b')]=function(_0x5edb1e,_0x582d8b){return db[_0x664d('0x2b')]['describe']()[_0x664d('0x23')](respondWithResult(_0x582d8b,null))[_0x664d('0x47')](handleError(_0x582d8b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 5c7a7fd..8508d17 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 _0xb52f=['define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./squareReport.attributes','exports'];(function(_0x1cbd2e,_0x379208){var _0x46a880=function(_0x2578cd){while(--_0x2578cd){_0x1cbd2e['push'](_0x1cbd2e['shift']());}};_0x46a880(++_0x379208);}(_0xb52f,0x1e6));var _0xfb52=function(_0x488586,_0x3a0a29){_0x488586=_0x488586-0x0;var _0x19d735=_0xb52f[_0x488586];return _0x19d735;};'use strict';var _=require(_0xfb52('0x0'));var util=require('util');var logger=require(_0xfb52('0x1'))(_0xfb52('0x2'));var moment=require(_0xfb52('0x3'));var BPromise=require(_0xfb52('0x4'));var rp=require(_0xfb52('0x5'));var fs=require('fs');var path=require(_0xfb52('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfb52('0x7'));module[_0xfb52('0x8')]=function(_0x4ae5f0,_0x470223){return _0x4ae5f0[_0xfb52('0x9')](_0xfb52('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xfb52('0xb'),'fields':[_0xfb52('0xc'),_0xfb52('0xd')]},{'name':_0xfb52('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6928=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x6928,0x141));var _0x8692=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6928[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x8692('0x0'));var util=require(_0x8692('0x1'));var logger=require(_0x8692('0x2'))(_0x8692('0x3'));var moment=require(_0x8692('0x4'));var BPromise=require(_0x8692('0x5'));var rp=require(_0x8692('0x6'));var fs=require('fs');var path=require(_0x8692('0x7'));var rimraf=require(_0x8692('0x8'));var config=require(_0x8692('0x9'));var attributes=require(_0x8692('0xa'));module[_0x8692('0xb')]=function(_0x2f244f,_0x14b04c){return _0x2f244f['define'](_0x8692('0xc'),attributes,{'tableName':_0x8692('0xd'),'paranoid':![],'indexes':[{'name':_0x8692('0xe'),'fields':[_0x8692('0xf'),_0x8692('0x10')]},{'name':_0x8692('0x11'),'fields':[_0x8692('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 7f5039d..effc00b 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 _0x4d18=['options','raw','debug','UpdateSquareReport','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x4d18,0x15b));var _0x84d1=function(_0x1e6fe4,_0x3a6e8e){_0x1e6fe4=_0x1e6fe4-0x0;var _0x404758=_0x4d18[_0x1e6fe4];return _0x404758;};'use strict';var _=require('lodash');var util=require(_0x84d1('0x0'));var moment=require(_0x84d1('0x1'));var BPromise=require(_0x84d1('0x2'));var rs=require(_0x84d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84d1('0x4'))['db'];var utils=require(_0x84d1('0x5'));var logger=require(_0x84d1('0x6'))(_0x84d1('0x7'));var config=require(_0x84d1('0x8'));var jayson=require(_0x84d1('0x9'));var client=jayson[_0x84d1('0xa')][_0x84d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32bae1,_0x34c251,_0x557b18){return new BPromise(function(_0x96243d,_0x1f1f95){return client[_0x84d1('0xc')](_0x32bae1,_0x557b18)[_0x84d1('0xd')](function(_0x5026ee){logger[_0x84d1('0xe')]('SquareReport,\x20%s,\x20%s',_0x34c251,_0x84d1('0xf'));logger['debug'](_0x84d1('0x10'),_0x34c251,_0x84d1('0xf'),JSON[_0x84d1('0x11')](_0x5026ee));if(_0x5026ee[_0x84d1('0x12')]){if(_0x5026ee[_0x84d1('0x12')][_0x84d1('0x13')]===0x1f4){logger[_0x84d1('0x12')](_0x84d1('0x14'),_0x34c251,_0x5026ee['error'][_0x84d1('0x15')]);return _0x1f1f95(_0x5026ee[_0x84d1('0x12')][_0x84d1('0x15')]);}logger['error'](_0x84d1('0x14'),_0x34c251,_0x5026ee[_0x84d1('0x12')][_0x84d1('0x15')]);return _0x96243d(_0x5026ee[_0x84d1('0x12')][_0x84d1('0x15')]);}else{logger[_0x84d1('0xe')](_0x84d1('0x14'),_0x34c251,_0x84d1('0xf'));_0x96243d(_0x5026ee[_0x84d1('0x16')][_0x84d1('0x15')]);}})[_0x84d1('0x17')](function(_0x1a3f96){logger[_0x84d1('0x12')]('SquareReport,\x20%s,\x20%s',_0x34c251,_0x1a3f96);_0x1f1f95(_0x1a3f96);});});}exports[_0x84d1('0x18')]=function(_0x5d7e5a){var _0x23ac27=this;return new Promise(function(_0x47891c,_0x1ec70d){return db[_0x84d1('0x19')][_0x84d1('0x1a')](_0x5d7e5a['body'],{'raw':_0x5d7e5a[_0x84d1('0x1b')]?_0x5d7e5a[_0x84d1('0x1b')][_0x84d1('0x1c')]===undefined?!![]:![]:!![]})[_0x84d1('0xd')](function(_0x3d6770){logger[_0x84d1('0xe')](_0x84d1('0x18'),_0x5d7e5a);logger[_0x84d1('0x1d')](_0x84d1('0x18'),_0x5d7e5a,JSON['stringify'](_0x3d6770));_0x47891c(_0x3d6770);})['catch'](function(_0x8a69e8){logger['error'](_0x84d1('0x18'),_0x8a69e8[_0x84d1('0x15')],_0x5d7e5a);_0x1ec70d(_0x23ac27[_0x84d1('0x12')](0x1f4,_0x8a69e8[_0x84d1('0x15')]));});});};exports[_0x84d1('0x1e')]=function(_0x4354a7){var _0x3b9f33=this;return new Promise(function(_0x5f3b64,_0x52ffc3){return db['SquareReport']['update'](_0x4354a7['body'],{'raw':_0x4354a7[_0x84d1('0x1b')]?_0x4354a7[_0x84d1('0x1b')][_0x84d1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4354a7[_0x84d1('0x1b')]?_0x4354a7[_0x84d1('0x1b')][_0x84d1('0x1f')]||null:null,'attributes':_0x4354a7['options']?_0x4354a7['options'][_0x84d1('0x20')]||null:null,'limit':_0x4354a7[_0x84d1('0x1b')]?_0x4354a7[_0x84d1('0x1b')][_0x84d1('0x21')]||null:null})[_0x84d1('0xd')](function(_0xa450a5){logger[_0x84d1('0xe')](_0x84d1('0x1e'),_0x4354a7);logger[_0x84d1('0x1d')](_0x84d1('0x1e'),_0x4354a7,JSON['stringify'](_0xa450a5));_0x5f3b64(_0xa450a5);})[_0x84d1('0x17')](function(_0x163cdb){logger[_0x84d1('0x12')](_0x84d1('0x1e'),_0x163cdb[_0x84d1('0x15')],_0x4354a7);_0x52ffc3(_0x3b9f33['error'](0x1f4,_0x163cdb[_0x84d1('0x15')]));});});}; \ No newline at end of file +var _0xbf90=['create','options','then','debug','catch','UpdateSquareReport','update','raw','where','attributes','limit','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateSquareReport','SquareReport'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbf90,0x1c5));var _0x0bf9=function(_0x8bb39,_0x1211f0){_0x8bb39=_0x8bb39-0x0;var _0x47901d=_0xbf90[_0x8bb39];return _0x47901d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0bf9('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0bf9('0x1'));var logger=require(_0x0bf9('0x2'))('rpc');var config=require(_0x0bf9('0x3'));var jayson=require(_0x0bf9('0x4'));var client=jayson['client'][_0x0bf9('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x43562c,_0x1f6ec1,_0x205992){return new BPromise(function(_0x234d50,_0x10ba6a){return client['request'](_0x43562c,_0x205992)['then'](function(_0x336552){logger[_0x0bf9('0x6')](_0x0bf9('0x7'),_0x1f6ec1,_0x0bf9('0x8'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x1f6ec1,'request\x20sent',JSON[_0x0bf9('0x9')](_0x336552));if(_0x336552['error']){if(_0x336552[_0x0bf9('0xa')][_0x0bf9('0xb')]===0x1f4){logger[_0x0bf9('0xa')](_0x0bf9('0x7'),_0x1f6ec1,_0x336552[_0x0bf9('0xa')][_0x0bf9('0xc')]);return _0x10ba6a(_0x336552[_0x0bf9('0xa')][_0x0bf9('0xc')]);}logger[_0x0bf9('0xa')](_0x0bf9('0x7'),_0x1f6ec1,_0x336552[_0x0bf9('0xa')][_0x0bf9('0xc')]);return _0x234d50(_0x336552[_0x0bf9('0xa')]['message']);}else{logger['info'](_0x0bf9('0x7'),_0x1f6ec1,_0x0bf9('0x8'));_0x234d50(_0x336552['result'][_0x0bf9('0xc')]);}})['catch'](function(_0x8e7e89){logger[_0x0bf9('0xa')](_0x0bf9('0x7'),_0x1f6ec1,_0x8e7e89);_0x10ba6a(_0x8e7e89);});});}exports[_0x0bf9('0xd')]=function(_0x129e77){var _0x15c002=this;return new Promise(function(_0x3f0d23,_0x23c60b){return db[_0x0bf9('0xe')][_0x0bf9('0xf')](_0x129e77['body'],{'raw':_0x129e77['options']?_0x129e77[_0x0bf9('0x10')]['raw']===undefined?!![]:![]:!![]})[_0x0bf9('0x11')](function(_0x5c2916){logger[_0x0bf9('0x6')]('CreateSquareReport',_0x129e77);logger[_0x0bf9('0x12')](_0x0bf9('0xd'),_0x129e77,JSON[_0x0bf9('0x9')](_0x5c2916));_0x3f0d23(_0x5c2916);})[_0x0bf9('0x13')](function(_0x4e2ac6){logger[_0x0bf9('0xa')](_0x0bf9('0xd'),_0x4e2ac6[_0x0bf9('0xc')],_0x129e77);_0x23c60b(_0x15c002['error'](0x1f4,_0x4e2ac6['message']));});});};exports[_0x0bf9('0x14')]=function(_0x24fcad){var _0x535865=this;return new Promise(function(_0x2b7adf,_0x4d6755){return db['SquareReport'][_0x0bf9('0x15')](_0x24fcad['body'],{'raw':_0x24fcad[_0x0bf9('0x10')]?_0x24fcad[_0x0bf9('0x10')][_0x0bf9('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24fcad[_0x0bf9('0x10')]?_0x24fcad[_0x0bf9('0x10')][_0x0bf9('0x17')]||null:null,'attributes':_0x24fcad[_0x0bf9('0x10')]?_0x24fcad[_0x0bf9('0x10')][_0x0bf9('0x18')]||null:null,'limit':_0x24fcad['options']?_0x24fcad[_0x0bf9('0x10')][_0x0bf9('0x19')]||null:null})[_0x0bf9('0x11')](function(_0x3f8bce){logger['info'](_0x0bf9('0x14'),_0x24fcad);logger[_0x0bf9('0x12')](_0x0bf9('0x14'),_0x24fcad,JSON[_0x0bf9('0x9')](_0x3f8bce));_0x2b7adf(_0x3f8bce);})[_0x0bf9('0x13')](function(_0x50b62c){logger[_0x0bf9('0xa')]('UpdateSquareReport',_0x50b62c[_0x0bf9('0xc')],_0x24fcad);_0x4d6755(_0x535865[_0x0bf9('0xa')](0x1f4,_0x50b62c[_0x0bf9('0xc')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8f756b0..478c3ee 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 _0x935d=['Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x4d8789,_0x3fdff1){var _0x404e41=function(_0x33d5a6){while(--_0x33d5a6){_0x4d8789['push'](_0x4d8789['shift']());}};_0x404e41(++_0x3fdff1);}(_0x935d,0x103));var _0xd935=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x935d[_0x1a21ff];return _0x25afc1;};'use strict';var multer=require(_0xd935('0x0'));var util=require(_0xd935('0x1'));var path=require(_0xd935('0x2'));var timeout=require(_0xd935('0x3'));var express=require(_0xd935('0x4'));var router=express[_0xd935('0x5')]();var fs_extra=require(_0xd935('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd935('0x7'));var config=require(_0xd935('0x8'));var controller=require(_0xd935('0x9'));router[_0xd935('0xa')]('/',auth[_0xd935('0xb')](),controller[_0xd935('0xc')]);router[_0xd935('0xa')](_0xd935('0xd'),auth[_0xd935('0xb')](),controller[_0xd935('0xe')]);router[_0xd935('0xa')](_0xd935('0xf'),auth['isAuthenticated'](),controller[_0xd935('0x10')]);router[_0xd935('0x11')]('/',auth[_0xd935('0xb')](),controller['create']);router[_0xd935('0x12')](_0xd935('0xf'),auth['isAuthenticated'](),controller[_0xd935('0x13')]);router[_0xd935('0x14')](_0xd935('0xf'),auth[_0xd935('0xb')](),controller[_0xd935('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5667=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util'];(function(_0x2b92bc,_0x47a3a6){var _0x2d0c39=function(_0x4bf9a1){while(--_0x4bf9a1){_0x2b92bc['push'](_0x2b92bc['shift']());}};_0x2d0c39(++_0x47a3a6);}(_0x5667,0xda));var _0x7566=function(_0x22eb80,_0x4122fd){_0x22eb80=_0x22eb80-0x0;var _0x466aa8=_0x5667[_0x22eb80];return _0x466aa8;};'use strict';var multer=require(_0x7566('0x0'));var util=require(_0x7566('0x1'));var path=require(_0x7566('0x2'));var timeout=require(_0x7566('0x3'));var express=require('express');var router=express[_0x7566('0x4')]();var fs_extra=require(_0x7566('0x5'));var auth=require(_0x7566('0x6'));var interaction=require(_0x7566('0x7'));var config=require(_0x7566('0x8'));var controller=require('./squareReportDetail.controller');router[_0x7566('0x9')]('/',auth[_0x7566('0xa')](),controller['index']);router[_0x7566('0x9')](_0x7566('0xb'),auth[_0x7566('0xa')](),controller[_0x7566('0xc')]);router['get'](_0x7566('0xd'),auth[_0x7566('0xa')](),controller[_0x7566('0xe')]);router['post']('/',auth[_0x7566('0xa')](),controller[_0x7566('0xf')]);router[_0x7566('0x10')](_0x7566('0xd'),auth[_0x7566('0xa')](),controller[_0x7566('0x11')]);router['delete'](_0x7566('0xd'),auth[_0x7566('0xa')](),controller[_0x7566('0x12')]);module[_0x7566('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 b18dac1..6a046a3 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 _0x770b=['STRING','TEXT','sequelize','exports'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0x770b,0xba));var _0xb770=function(_0x28d7b5,_0x1305a4){_0x28d7b5=_0x28d7b5-0x0;var _0x1ed035=_0x770b[_0x28d7b5];return _0x1ed035;};'use strict';var Sequelize=require(_0xb770('0x0'));module[_0xb770('0x1')]={'uniqueid':{'type':Sequelize[_0xb770('0x2')]},'node':{'type':Sequelize[_0xb770('0x2')]},'application':{'type':Sequelize[_0xb770('0x2')]},'data':{'type':Sequelize[_0xb770('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb770('0x2')]}}; \ No newline at end of file +var _0x73ec=['STRING','exports'];(function(_0xf570c4,_0x3c81e0){var _0x1f9ec6=function(_0x4ab41c){while(--_0x4ab41c){_0xf570c4['push'](_0xf570c4['shift']());}};_0x1f9ec6(++_0x3c81e0);}(_0x73ec,0x1b1));var _0xc73e=function(_0x3d3199,_0x3a6410){_0x3d3199=_0x3d3199-0x0;var _0xe3c62d=_0x73ec[_0x3d3199];return _0xe3c62d;};'use strict';var Sequelize=require('sequelize');module[_0xc73e('0x0')]={'uniqueid':{'type':Sequelize[_0xc73e('0x1')]},'node':{'type':Sequelize[_0xc73e('0x1')]},'application':{'type':Sequelize[_0xc73e('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xc73e('0x1')]},'callerid':{'type':Sequelize[_0xc73e('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 2cd844d..c2eeb23 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 _0x1e0d=['create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','update','then','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','limit','order','sort','filters','pick','VIRTUAL','filter','merge','options','SquareDetailsReport','includeAll','params','include','find','catch'];(function(_0x436141,_0x57ff93){var _0x1b23d9=function(_0x1d9cbc){while(--_0x1d9cbc){_0x436141['push'](_0x436141['shift']());}};_0x1b23d9(++_0x57ff93);}(_0x1e0d,0x17b));var _0xd1e0=function(_0x2d8356,_0xfdf077){_0x2d8356=_0x2d8356-0x0;var _0x1d4fb5=_0x1e0d[_0x2d8356];return _0x1d4fb5;};'use strict';var emlformat=require(_0xd1e0('0x0'));var rimraf=require(_0xd1e0('0x1'));var zipdir=require(_0xd1e0('0x2'));var jsonpatch=require(_0xd1e0('0x3'));var rp=require(_0xd1e0('0x4'));var moment=require(_0xd1e0('0x5'));var BPromise=require(_0xd1e0('0x6'));var Mustache=require(_0xd1e0('0x7'));var util=require(_0xd1e0('0x8'));var path=require(_0xd1e0('0x9'));var sox=require(_0xd1e0('0xa'));var csv=require('to-csv');var ejs=require(_0xd1e0('0xb'));var fs=require('fs');var fs_extra=require(_0xd1e0('0xc'));var _=require(_0xd1e0('0xd'));var squel=require(_0xd1e0('0xe'));var crypto=require(_0xd1e0('0xf'));var jsforce=require(_0xd1e0('0x10'));var deskjs=require(_0xd1e0('0x11'));var toCsv=require(_0xd1e0('0x12'));var querystring=require(_0xd1e0('0x13'));var Papa=require(_0xd1e0('0x14'));var Redis=require(_0xd1e0('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xd1e0('0x16'));var as=require(_0xd1e0('0x17'));var hardwareService=require(_0xd1e0('0x18'));var logger=require(_0xd1e0('0x19'))(_0xd1e0('0x1a'));var utils=require(_0xd1e0('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xd1e0('0x1c'));var db=require(_0xd1e0('0x1d'))['db'];function respondWithStatusCode(_0x531d44,_0x1bebc8){_0x1bebc8=_0x1bebc8||0xcc;return function(_0x258577){if(_0x258577){return _0x531d44[_0xd1e0('0x1e')](_0x1bebc8);}return _0x531d44[_0xd1e0('0x1f')](_0x1bebc8)[_0xd1e0('0x20')]();};}function respondWithResult(_0x212601,_0x4abe14){_0x4abe14=_0x4abe14||0xc8;return function(_0x393a88){if(_0x393a88){return _0x212601['status'](_0x4abe14)[_0xd1e0('0x21')](_0x393a88);}};}function respondWithFilteredResult(_0x2d916c,_0xe099c9){return function(_0x5038fb){if(_0x5038fb){var _0x55a1e2=typeof _0xe099c9[_0xd1e0('0x22')]===_0xd1e0('0x23')&&typeof _0xe099c9['limit']==='undefined';var _0x3ef1cb=_0x5038fb['count'];var _0x546e3d=_0x55a1e2?0x0:_0xe099c9[_0xd1e0('0x22')];var _0x3a2f18=_0x55a1e2?_0x5038fb['count']:_0xe099c9[_0xd1e0('0x22')]+_0xe099c9['limit'];var _0xef253b;if(_0x3a2f18>=_0x3ef1cb){_0x3a2f18=_0x3ef1cb;_0xef253b=0xc8;}else{_0xef253b=0xce;}_0x2d916c[_0xd1e0('0x1f')](_0xef253b);return _0x2d916c[_0xd1e0('0x24')](_0xd1e0('0x25'),_0x546e3d+'-'+_0x3a2f18+'/'+_0x3ef1cb)[_0xd1e0('0x21')](_0x5038fb);}return null;};}function patchUpdates(_0x79a4ee){return function(_0x4c827e){try{jsonpatch[_0xd1e0('0x26')](_0x4c827e,_0x79a4ee,!![]);}catch(_0xfb130f){return BPromise['reject'](_0xfb130f);}return _0x4c827e['save']();};}function saveUpdates(_0x2a8f1f,_0x667e1f){return function(_0x26f5c8){if(_0x26f5c8){return _0x26f5c8[_0xd1e0('0x27')](_0x2a8f1f)['then'](function(_0x54f11c){return _0x54f11c;});}return null;};}function removeEntity(_0x1968f4,_0x424356){return function(_0x20bf79){if(_0x20bf79){return _0x20bf79['destroy']()[_0xd1e0('0x28')](function(){_0x1968f4[_0xd1e0('0x1f')](0xcc)[_0xd1e0('0x20')]();});}};}function handleEntityNotFound(_0x3188a6,_0x18a275){return function(_0x4ad493){if(!_0x4ad493){_0x3188a6[_0xd1e0('0x1e')](0x194);}return _0x4ad493;};}function handleError(_0x474dff,_0xc9fd96){_0xc9fd96=_0xc9fd96||0x1f4;return function(_0x35e9b7){logger['error'](_0x35e9b7[_0xd1e0('0x29')]);if(_0x35e9b7['name']){delete _0x35e9b7[_0xd1e0('0x2a')];}_0x474dff['status'](_0xc9fd96)[_0xd1e0('0x2b')](_0x35e9b7);};}exports['index']=function(_0x4053d4,_0x2c1d93){var _0xfd6a9f={},_0x639e0d={},_0x2dab2a={'count':0x0,'rows':[]};var _0x12f20a=_['map'](db['SquareDetailsReport'][_0xd1e0('0x2c')],function(_0x4d40e5){return{'name':_0x4d40e5[_0xd1e0('0x2d')],'type':_0x4d40e5[_0xd1e0('0x2e')][_0xd1e0('0x2f')]};});_0x639e0d[_0xd1e0('0x30')]=_[_0xd1e0('0x31')](_0x12f20a,_0xd1e0('0x2a'));_0x639e0d[_0xd1e0('0x32')]=_[_0xd1e0('0x33')](_0x4053d4[_0xd1e0('0x32')]);_0x639e0d['filters']=_[_0xd1e0('0x34')](_0x639e0d[_0xd1e0('0x30')],_0x639e0d[_0xd1e0('0x32')]);_0xfd6a9f[_0xd1e0('0x35')]=_[_0xd1e0('0x34')](_0x639e0d[_0xd1e0('0x30')],qs[_0xd1e0('0x36')](_0x4053d4[_0xd1e0('0x32')][_0xd1e0('0x36')]));_0xfd6a9f[_0xd1e0('0x35')]=_0xfd6a9f[_0xd1e0('0x35')][_0xd1e0('0x37')]?_0xfd6a9f[_0xd1e0('0x35')]:_0x639e0d[_0xd1e0('0x30')];if(!_0x4053d4[_0xd1e0('0x32')]['hasOwnProperty']('nolimit')){_0xfd6a9f[_0xd1e0('0x38')]=qs[_0xd1e0('0x38')](_0x4053d4['query'][_0xd1e0('0x38')]);_0xfd6a9f[_0xd1e0('0x22')]=qs['offset'](_0x4053d4[_0xd1e0('0x32')]['offset']);}_0xfd6a9f[_0xd1e0('0x39')]=qs[_0xd1e0('0x3a')](_0x4053d4[_0xd1e0('0x32')]['sort']);_0xfd6a9f['where']=qs[_0xd1e0('0x3b')](_[_0xd1e0('0x3c')](_0x4053d4['query'],_0x639e0d['filters']),_0x12f20a);if(_0x4053d4[_0xd1e0('0x32')]['filter']){_0xfd6a9f['where']=_['merge'](_0xfd6a9f['where'],{'$or':_[_0xd1e0('0x31')](_0x12f20a,function(_0x58822d){if(_0x58822d[_0xd1e0('0x2e')]!==_0xd1e0('0x3d')){var _0x5b49f1={};_0x5b49f1[_0x58822d['name']]={'$like':'%'+_0x4053d4['query'][_0xd1e0('0x3e')]+'%'};return _0x5b49f1;}})});}_0xfd6a9f=_[_0xd1e0('0x3f')]({},_0xfd6a9f,_0x4053d4[_0xd1e0('0x40')]);var _0x2002d7={'where':_0xfd6a9f['where']};return db[_0xd1e0('0x41')]['count'](_0x2002d7)[_0xd1e0('0x28')](function(_0x3e1c05){_0x2dab2a['count']=_0x3e1c05;if(_0x4053d4[_0xd1e0('0x32')][_0xd1e0('0x42')]){_0xfd6a9f['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0xfd6a9f);})[_0xd1e0('0x28')](function(_0x5dfd85){_0x2dab2a['rows']=_0x5dfd85;return _0x2dab2a;})['then'](respondWithFilteredResult(_0x2c1d93,_0xfd6a9f))['catch'](handleError(_0x2c1d93,null));};exports['show']=function(_0x5a4b78,_0x3134ef){var _0x41563d={'raw':!![],'where':{'id':_0x5a4b78[_0xd1e0('0x43')]['id']}},_0x516ee3={};_0x516ee3[_0xd1e0('0x30')]=_[_0xd1e0('0x33')](db[_0xd1e0('0x41')][_0xd1e0('0x2c')]);_0x516ee3[_0xd1e0('0x32')]=_[_0xd1e0('0x33')](_0x5a4b78[_0xd1e0('0x32')]);_0x516ee3[_0xd1e0('0x3b')]=_[_0xd1e0('0x34')](_0x516ee3[_0xd1e0('0x30')],_0x516ee3[_0xd1e0('0x32')]);_0x41563d[_0xd1e0('0x35')]=_['intersection'](_0x516ee3['model'],qs['fields'](_0x5a4b78[_0xd1e0('0x32')]['fields']));_0x41563d[_0xd1e0('0x35')]=_0x41563d[_0xd1e0('0x35')][_0xd1e0('0x37')]?_0x41563d[_0xd1e0('0x35')]:_0x516ee3['model'];if(_0x5a4b78['query'][_0xd1e0('0x42')]){_0x41563d[_0xd1e0('0x44')]=[{'all':!![]}];}_0x41563d=_[_0xd1e0('0x3f')]({},_0x41563d,_0x5a4b78['options']);return db[_0xd1e0('0x41')][_0xd1e0('0x45')](_0x41563d)[_0xd1e0('0x28')](handleEntityNotFound(_0x3134ef,null))['then'](respondWithResult(_0x3134ef,null))[_0xd1e0('0x46')](handleError(_0x3134ef,null));};exports[_0xd1e0('0x47')]=function(_0x5489bc,_0x58a864){return db['SquareDetailsReport']['create'](_0x5489bc[_0xd1e0('0x48')],{})[_0xd1e0('0x28')](respondWithResult(_0x58a864,0xc9))[_0xd1e0('0x46')](handleError(_0x58a864,null));};exports[_0xd1e0('0x27')]=function(_0x12e3dd,_0x5b6b8e){if(_0x12e3dd[_0xd1e0('0x48')]['id']){delete _0x12e3dd[_0xd1e0('0x48')]['id'];}return db[_0xd1e0('0x41')][_0xd1e0('0x45')]({'where':{'id':_0x12e3dd[_0xd1e0('0x43')]['id']}})[_0xd1e0('0x28')](handleEntityNotFound(_0x5b6b8e,null))[_0xd1e0('0x28')](saveUpdates(_0x12e3dd['body'],null))[_0xd1e0('0x28')](respondWithResult(_0x5b6b8e,null))[_0xd1e0('0x46')](handleError(_0x5b6b8e,null));};exports[_0xd1e0('0x49')]=function(_0x215755,_0x2a0bb0){return db[_0xd1e0('0x41')][_0xd1e0('0x45')]({'where':{'id':_0x215755[_0xd1e0('0x43')]['id']}})[_0xd1e0('0x28')](handleEntityNotFound(_0x2a0bb0,null))[_0xd1e0('0x28')](removeEntity(_0x2a0bb0,null))[_0xd1e0('0x46')](handleError(_0x2a0bb0,null));};exports[_0xd1e0('0x4a')]=function(_0x5606e7,_0x18d088){return db[_0xd1e0('0x41')]['describe']()[_0xd1e0('0x28')](respondWithResult(_0x18d088,null))[_0xd1e0('0x46')](handleError(_0x18d088,null));}; \ No newline at end of file +var _0x5808=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','SquareDetailsReport','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5808,0x7f));var _0x8580=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0x5808[_0x462fe4];return _0x82b23a;};'use strict';var emlformat=require(_0x8580('0x0'));var rimraf=require(_0x8580('0x1'));var zipdir=require(_0x8580('0x2'));var jsonpatch=require(_0x8580('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8580('0x4'));var path=require(_0x8580('0x5'));var sox=require(_0x8580('0x6'));var csv=require(_0x8580('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8580('0x8'));var _=require(_0x8580('0x9'));var squel=require('squel');var crypto=require(_0x8580('0xa'));var jsforce=require(_0x8580('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8580('0x7'));var querystring=require(_0x8580('0xc'));var Papa=require(_0x8580('0xd'));var Redis=require('ioredis');var authService=require(_0x8580('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8580('0xf'));var hardwareService=require(_0x8580('0x10'));var logger=require(_0x8580('0x11'))(_0x8580('0x12'));var utils=require('../../config/utils');var config=require(_0x8580('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x8580('0x14'))['db'];function respondWithStatusCode(_0x1d7e45,_0x26d523){_0x26d523=_0x26d523||0xcc;return function(_0x1b3ef1){if(_0x1b3ef1){return _0x1d7e45[_0x8580('0x15')](_0x26d523);}return _0x1d7e45[_0x8580('0x16')](_0x26d523)['end']();};}function respondWithResult(_0x53090a,_0x6e7a7){_0x6e7a7=_0x6e7a7||0xc8;return function(_0x487a9c){if(_0x487a9c){return _0x53090a[_0x8580('0x16')](_0x6e7a7)['json'](_0x487a9c);}};}function respondWithFilteredResult(_0x435086,_0x386a7e){return function(_0xe0818f){if(_0xe0818f){var _0x18cbdc=typeof _0x386a7e[_0x8580('0x17')]===_0x8580('0x18')&&typeof _0x386a7e['limit']==='undefined';var _0x1697fc=_0xe0818f[_0x8580('0x19')];var _0x2d6ea0=_0x18cbdc?0x0:_0x386a7e['offset'];var _0x5acb23=_0x18cbdc?_0xe0818f[_0x8580('0x19')]:_0x386a7e[_0x8580('0x17')]+_0x386a7e[_0x8580('0x1a')];var _0x52cd94;if(_0x5acb23>=_0x1697fc){_0x5acb23=_0x1697fc;_0x52cd94=0xc8;}else{_0x52cd94=0xce;}_0x435086[_0x8580('0x16')](_0x52cd94);return _0x435086[_0x8580('0x1b')](_0x8580('0x1c'),_0x2d6ea0+'-'+_0x5acb23+'/'+_0x1697fc)[_0x8580('0x1d')](_0xe0818f);}return null;};}function patchUpdates(_0x3f398c){return function(_0x22499b){try{jsonpatch['apply'](_0x22499b,_0x3f398c,!![]);}catch(_0x398a8d){return BPromise[_0x8580('0x1e')](_0x398a8d);}return _0x22499b[_0x8580('0x1f')]();};}function saveUpdates(_0x217f5a,_0x1a1bc1){return function(_0x12d1e4){if(_0x12d1e4){return _0x12d1e4['update'](_0x217f5a)['then'](function(_0x56201a){return _0x56201a;});}return null;};}function removeEntity(_0x3e21d7,_0x18c80c){return function(_0x433646){if(_0x433646){return _0x433646[_0x8580('0x20')]()[_0x8580('0x21')](function(){_0x3e21d7[_0x8580('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ed0c,_0x382162){return function(_0x209c19){if(!_0x209c19){_0x23ed0c[_0x8580('0x15')](0x194);}return _0x209c19;};}function handleError(_0x342a83,_0x4d64f1){_0x4d64f1=_0x4d64f1||0x1f4;return function(_0x5e59a6){logger[_0x8580('0x22')](_0x5e59a6[_0x8580('0x23')]);if(_0x5e59a6[_0x8580('0x24')]){delete _0x5e59a6[_0x8580('0x24')];}_0x342a83[_0x8580('0x16')](_0x4d64f1)[_0x8580('0x25')](_0x5e59a6);};}exports['index']=function(_0x432d6b,_0x28ca8a){var _0x2603bb={},_0x2ffb02={},_0x2a77ca={'count':0x0,'rows':[]};var _0xfb5fd6=_[_0x8580('0x26')](db['SquareDetailsReport']['rawAttributes'],function(_0x3a19a8){return{'name':_0x3a19a8[_0x8580('0x27')],'type':_0x3a19a8[_0x8580('0x28')][_0x8580('0x29')]};});_0x2ffb02[_0x8580('0x2a')]=_[_0x8580('0x26')](_0xfb5fd6,_0x8580('0x24'));_0x2ffb02[_0x8580('0x2b')]=_[_0x8580('0x2c')](_0x432d6b[_0x8580('0x2b')]);_0x2ffb02[_0x8580('0x2d')]=_[_0x8580('0x2e')](_0x2ffb02[_0x8580('0x2a')],_0x2ffb02['query']);_0x2603bb[_0x8580('0x2f')]=_['intersection'](_0x2ffb02[_0x8580('0x2a')],qs[_0x8580('0x30')](_0x432d6b[_0x8580('0x2b')][_0x8580('0x30')]));_0x2603bb[_0x8580('0x2f')]=_0x2603bb[_0x8580('0x2f')][_0x8580('0x31')]?_0x2603bb['attributes']:_0x2ffb02[_0x8580('0x2a')];if(!_0x432d6b[_0x8580('0x2b')][_0x8580('0x32')]('nolimit')){_0x2603bb[_0x8580('0x1a')]=qs[_0x8580('0x1a')](_0x432d6b[_0x8580('0x2b')]['limit']);_0x2603bb[_0x8580('0x17')]=qs[_0x8580('0x17')](_0x432d6b[_0x8580('0x2b')]['offset']);}_0x2603bb[_0x8580('0x33')]=qs['sort'](_0x432d6b[_0x8580('0x2b')][_0x8580('0x34')]);_0x2603bb['where']=qs[_0x8580('0x2d')](_[_0x8580('0x35')](_0x432d6b[_0x8580('0x2b')],_0x2ffb02[_0x8580('0x2d')]),_0xfb5fd6);if(_0x432d6b[_0x8580('0x2b')][_0x8580('0x36')]){_0x2603bb[_0x8580('0x37')]=_[_0x8580('0x38')](_0x2603bb[_0x8580('0x37')],{'$or':_[_0x8580('0x26')](_0xfb5fd6,function(_0x588da2){if(_0x588da2[_0x8580('0x28')]!==_0x8580('0x39')){var _0x4c5ddb={};_0x4c5ddb[_0x588da2['name']]={'$like':'%'+_0x432d6b[_0x8580('0x2b')][_0x8580('0x36')]+'%'};return _0x4c5ddb;}})});}_0x2603bb=_['merge']({},_0x2603bb,_0x432d6b['options']);var _0x1a4b06={'where':_0x2603bb['where']};return db['SquareDetailsReport'][_0x8580('0x19')](_0x1a4b06)[_0x8580('0x21')](function(_0x51e4a4){_0x2a77ca[_0x8580('0x19')]=_0x51e4a4;if(_0x432d6b[_0x8580('0x2b')][_0x8580('0x3a')]){_0x2603bb[_0x8580('0x3b')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x8580('0x3c')](_0x2603bb);})['then'](function(_0x243f69){_0x2a77ca[_0x8580('0x3d')]=_0x243f69;return _0x2a77ca;})[_0x8580('0x21')](respondWithFilteredResult(_0x28ca8a,_0x2603bb))['catch'](handleError(_0x28ca8a,null));};exports[_0x8580('0x3e')]=function(_0x114d72,_0x42e769){var _0x59d969={'raw':!![],'where':{'id':_0x114d72[_0x8580('0x3f')]['id']}},_0x26a6db={};_0x26a6db[_0x8580('0x2a')]=_[_0x8580('0x2c')](db['SquareDetailsReport'][_0x8580('0x40')]);_0x26a6db[_0x8580('0x2b')]=_[_0x8580('0x2c')](_0x114d72[_0x8580('0x2b')]);_0x26a6db[_0x8580('0x2d')]=_[_0x8580('0x2e')](_0x26a6db[_0x8580('0x2a')],_0x26a6db[_0x8580('0x2b')]);_0x59d969[_0x8580('0x2f')]=_[_0x8580('0x2e')](_0x26a6db['model'],qs['fields'](_0x114d72['query'][_0x8580('0x30')]));_0x59d969['attributes']=_0x59d969[_0x8580('0x2f')]['length']?_0x59d969[_0x8580('0x2f')]:_0x26a6db[_0x8580('0x2a')];if(_0x114d72['query'][_0x8580('0x3a')]){_0x59d969[_0x8580('0x3b')]=[{'all':!![]}];}_0x59d969=_[_0x8580('0x38')]({},_0x59d969,_0x114d72['options']);return db[_0x8580('0x41')][_0x8580('0x42')](_0x59d969)[_0x8580('0x21')](handleEntityNotFound(_0x42e769,null))[_0x8580('0x21')](respondWithResult(_0x42e769,null))[_0x8580('0x43')](handleError(_0x42e769,null));};exports[_0x8580('0x44')]=function(_0x1cb166,_0xfe0f77){return db[_0x8580('0x41')]['create'](_0x1cb166[_0x8580('0x45')],{})[_0x8580('0x21')](respondWithResult(_0xfe0f77,0xc9))[_0x8580('0x43')](handleError(_0xfe0f77,null));};exports[_0x8580('0x46')]=function(_0x28d1e2,_0x4f48aa){if(_0x28d1e2[_0x8580('0x45')]['id']){delete _0x28d1e2[_0x8580('0x45')]['id'];}return db['SquareDetailsReport'][_0x8580('0x42')]({'where':{'id':_0x28d1e2[_0x8580('0x3f')]['id']}})[_0x8580('0x21')](handleEntityNotFound(_0x4f48aa,null))[_0x8580('0x21')](saveUpdates(_0x28d1e2[_0x8580('0x45')],null))['then'](respondWithResult(_0x4f48aa,null))['catch'](handleError(_0x4f48aa,null));};exports[_0x8580('0x20')]=function(_0x2fec0b,_0x58b258){return db[_0x8580('0x41')]['find']({'where':{'id':_0x2fec0b[_0x8580('0x3f')]['id']}})[_0x8580('0x21')](handleEntityNotFound(_0x58b258,null))[_0x8580('0x21')](removeEntity(_0x58b258,null))[_0x8580('0x43')](handleError(_0x58b258,null));};exports[_0x8580('0x47')]=function(_0x587245,_0x432deb){return db['SquareDetailsReport']['describe']()[_0x8580('0x21')](respondWithResult(_0x432deb,null))[_0x8580('0x43')](handleError(_0x432deb,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 59234fc..6a4cd4d 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 _0x82fc=['path','rimraf','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x82fc,0x162));var _0xc82f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x82fc[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xc82f('0x0'));var util=require(_0xc82f('0x1'));var logger=require(_0xc82f('0x2'))(_0xc82f('0x3'));var moment=require('moment');var BPromise=require(_0xc82f('0x4'));var rp=require(_0xc82f('0x5'));var fs=require('fs');var path=require(_0xc82f('0x6'));var rimraf=require(_0xc82f('0x7'));var config=require('../../config/environment');var attributes=require(_0xc82f('0x8'));module[_0xc82f('0x9')]=function(_0x53b643,_0x1e1c0f){return _0x53b643['define'](_0xc82f('0xa'),attributes,{'tableName':_0xc82f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba32=['define','SquareDetailsReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x58d71e,_0x47c4b8){var _0x17aaf4=function(_0x14e6df){while(--_0x14e6df){_0x58d71e['push'](_0x58d71e['shift']());}};_0x17aaf4(++_0x47c4b8);}(_0xba32,0x18e));var _0x2ba3=function(_0x15e983,_0x5824c8){_0x15e983=_0x15e983-0x0;var _0x3a1ec0=_0xba32[_0x15e983];return _0x3a1ec0;};'use strict';var _=require(_0x2ba3('0x0'));var util=require(_0x2ba3('0x1'));var logger=require(_0x2ba3('0x2'))('api');var moment=require(_0x2ba3('0x3'));var BPromise=require(_0x2ba3('0x4'));var rp=require(_0x2ba3('0x5'));var fs=require('fs');var path=require(_0x2ba3('0x6'));var rimraf=require('rimraf');var config=require(_0x2ba3('0x7'));var attributes=require(_0x2ba3('0x8'));module[_0x2ba3('0x9')]=function(_0x387dfb,_0x26e6d9){return _0x387dfb[_0x2ba3('0xa')](_0x2ba3('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index c0d8eba..5833308 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 _0xa7fa=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0xcba291,_0x10e9d5){var _0x162274=function(_0x38100e){while(--_0x38100e){_0xcba291['push'](_0xcba291['shift']());}};_0x162274(++_0x10e9d5);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa7f('0x1'));var rs=require(_0xaa7f('0x2'));var fs=require('fs');var Redis=require(_0xaa7f('0x3'));var db=require(_0xaa7f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa7f('0x5'))(_0xaa7f('0x6'));var config=require(_0xaa7f('0x7'));var jayson=require(_0xaa7f('0x8'));var client=jayson['client'][_0xaa7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48105b,_0x50bab6,_0x3898a3){return new BPromise(function(_0x506a91,_0x3ac236){return client[_0xaa7f('0xa')](_0x48105b,_0x3898a3)[_0xaa7f('0xb')](function(_0x2dbcb6){logger['info'](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));logger['debug'](_0xaa7f('0xe'),_0x50bab6,_0xaa7f('0xd'),JSON[_0xaa7f('0xf')](_0x2dbcb6));if(_0x2dbcb6[_0xaa7f('0x10')]){if(_0x2dbcb6['error']['code']===0x1f4){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);return _0x3ac236(_0x2dbcb6[_0xaa7f('0x10')][_0xaa7f('0x11')]);}logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x2dbcb6[_0xaa7f('0x10')]['message']);return _0x506a91(_0x2dbcb6[_0xaa7f('0x10')]['message']);}else{logger[_0xaa7f('0x12')](_0xaa7f('0xc'),_0x50bab6,_0xaa7f('0xd'));_0x506a91(_0x2dbcb6['result'][_0xaa7f('0x11')]);}})[_0xaa7f('0x13')](function(_0x1bd3f9){logger[_0xaa7f('0x10')](_0xaa7f('0xc'),_0x50bab6,_0x1bd3f9);_0x3ac236(_0x1bd3f9);});});}exports[_0xaa7f('0x14')]=function(_0x2c17c4){var _0x4fbd09=this;return new Promise(function(_0x90863a,_0x1e18a6){return db[_0xaa7f('0x15')][_0xaa7f('0x16')](_0x2c17c4['body'],{'raw':_0x2c17c4['options']?_0x2c17c4[_0xaa7f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaa7f('0xb')](function(_0x21e870){logger['info'](_0xaa7f('0x14'),_0x2c17c4);logger['debug'](_0xaa7f('0x14'),_0x2c17c4,JSON[_0xaa7f('0xf')](_0x21e870));_0x90863a(_0x21e870);})[_0xaa7f('0x13')](function(_0x516d7e){logger[_0xaa7f('0x10')](_0xaa7f('0x14'),_0x516d7e[_0xaa7f('0x11')],_0x2c17c4);_0x1e18a6(_0x4fbd09[_0xaa7f('0x10')](0x1f4,_0x516d7e['message']));});});}; \ No newline at end of file +var _0x6a95=['message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2409c0,_0x4978d4){var _0x2d433e=function(_0x4dc218){while(--_0x4dc218){_0x2409c0['push'](_0x2409c0['shift']());}};_0x2d433e(++_0x4978d4);}(_0x6a95,0x1db));var _0x56a9=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x6a95[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')](_0x576bdf[_0x56a9('0x1b')],{'raw':_0x576bdf[_0x56a9('0x1c')]?_0x576bdf[_0x56a9('0x1c')][_0x56a9('0x1d')]===undefined?!![]:![]:!![]})[_0x56a9('0x1e')](function(_0x5f145f){logger['info'](_0x56a9('0x18'),_0x576bdf);logger[_0x56a9('0x10')](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x5f145f));_0x105fe5(_0x5f145f);})['catch'](function(_0x6100fe){logger[_0x56a9('0x13')](_0x56a9('0x18'),_0x6100fe[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x6100fe[_0x56a9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f82d8b7..a3ca9a5 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 _0x6b87=['index','/process/:pid/kill','killProcess','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x6b87,0x1ce));var _0x76b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b87[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x76b8('0x0'));var router=express[_0x76b8('0x1')]();var auth=require(_0x76b8('0x2'));var controller=require(_0x76b8('0x3'));router[_0x76b8('0x4')]('/',auth[_0x76b8('0x5')](),controller[_0x76b8('0x6')]);router['get'](_0x76b8('0x7'),auth[_0x76b8('0x5')](),controller[_0x76b8('0x8')]);module['exports']=router; \ No newline at end of file +var _0xda8c=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess','exports','express'];(function(_0x59e30a,_0x5db941){var _0x24f9d6=function(_0x59be26){while(--_0x59be26){_0x59e30a['push'](_0x59e30a['shift']());}};_0x24f9d6(++_0x5db941);}(_0xda8c,0x170));var _0xcda8=function(_0x1028f2,_0x334f6f){_0x1028f2=_0x1028f2-0x0;var _0x1e4f8f=_0xda8c[_0x1028f2];return _0x1e4f8f;};'use strict';var express=require(_0xcda8('0x0'));var router=express[_0xcda8('0x1')]();var auth=require(_0xcda8('0x2'));var controller=require(_0xcda8('0x3'));router[_0xcda8('0x4')]('/',auth[_0xcda8('0x5')](),controller[_0xcda8('0x6')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xcda8('0x7')]);module[_0xcda8('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 6a471dc..5b3b264 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 _0x8862=['inspect','name','status','send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird','lodash','error'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x8862,0x157));var _0x2886=function(_0x2acc67,_0x3c3b9f){_0x2acc67=_0x2acc67-0x0;var _0x43bd92=_0x8862[_0x2acc67];return _0x43bd92;};'use strict';var info=require(_0x2886('0x0'));var exec=require(_0x2886('0x1'))[_0x2886('0x2')];var logger=require('../../config/logger')(_0x2886('0x3'));var util=require(_0x2886('0x4'));var BPromise=require(_0x2886('0x5'));var _=require(_0x2886('0x6'));function handleError(_0x419342,_0x16ec9d,_0x4570c4){_0x16ec9d=_0x16ec9d||0x1f4;return function(_0x216fe6){logger[_0x2886('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4570c4,_0x16ec9d,util[_0x2886('0x8')](_0x216fe6,{'showHidden':![],'depth':null}));delete _0x216fe6[_0x2886('0x9')];_0x419342[_0x2886('0xa')](_0x16ec9d)[_0x2886('0xb')](_0x216fe6);};}exports[_0x2886('0xc')]=function(_0x2e8d91,_0x18e423){return info['getAllData']()[_0x2886('0xd')](function(_0x9a6c0b){return _0x18e423[_0x2886('0xa')](0xc8)[_0x2886('0xe')](_0x9a6c0b);})[_0x2886('0xf')](function(_0x5e9d15){return _0x18e423[_0x2886('0xa')](0x1f4)[_0x2886('0xe')](_0x5e9d15);});};exports[_0x2886('0x10')]=function(_0xb0eb10,_0x5ce340){var _0x569a00=['components/import/cm'];return new BPromise(function(_0x8c88d8,_0x107702){return exec(util[_0x2886('0x11')](_0x2886('0x12'),_0xb0eb10['params'][_0x2886('0x13')]),function(_0x1f9831,_0x762a53,_0x557900){if(_0x1f9831){return _0x107702(_0x1f9831);}return _0x8c88d8(_0x762a53);});})['then'](function(_0x58a1ee){var _0x58f3ed=![];var _0x46f5ef=_0x58a1ee[_0x2886('0x14')](/\n/);for(var _0x1b5908=0x0,_0x50688c=_0x569a00[_0x2886('0x15')];_0x1b5908<_0x50688c,_0x58f3ed===![];_0x1b5908+=0x1){if(_0x58a1ee['indexOf'](_0x569a00[_0x1b5908])>=0x0){_0x58f3ed=!![];}}if(!_0x58f3ed){throw new Error(util['format'](_0x2886('0x16'),_0xb0eb10[_0x2886('0x17')][_0x2886('0x13')]));}process[_0x2886('0x18')](_0xb0eb10['params']['pid'],_0x2886('0x19'));return _0x5ce340[_0x2886('0xa')](0xc8)['json']({'message':util[_0x2886('0x11')](_0x2886('0x1a'),_0xb0eb10['params'][_0x2886('0x13')])});})[_0x2886('0xf')](handleError(_0x5ce340,null,'killProcess'));}; \ No newline at end of file +var _0xf491=['Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x7de1ec,_0x11271b){var _0x453cf4=function(_0x4b7c30){while(--_0x4b7c30){_0x7de1ec['push'](_0x7de1ec['shift']());}};_0x453cf4(++_0x11271b);}(_0xf491,0x15f));var _0x1f49=function(_0x39316c,_0x4bc4c1){_0x39316c=_0x39316c-0x0;var _0x1a0099=_0xf491[_0x39316c];return _0x1a0099;};'use strict';var info=require(_0x1f49('0x0'));var exec=require(_0x1f49('0x1'))['exec'];var logger=require(_0x1f49('0x2'))('api');var util=require('util');var BPromise=require(_0x1f49('0x3'));var _=require(_0x1f49('0x4'));function handleError(_0x107aff,_0x525445,_0x356f3d){_0x525445=_0x525445||0x1f4;return function(_0x222bfb){logger[_0x1f49('0x5')](_0x1f49('0x6'),_0x356f3d,_0x525445,util['inspect'](_0x222bfb,{'showHidden':![],'depth':null}));delete _0x222bfb[_0x1f49('0x7')];_0x107aff[_0x1f49('0x8')](_0x525445)[_0x1f49('0x9')](_0x222bfb);};}exports[_0x1f49('0xa')]=function(_0x3ace69,_0x59a5b9){return info[_0x1f49('0xb')]()[_0x1f49('0xc')](function(_0x45a3ba){return _0x59a5b9[_0x1f49('0x8')](0xc8)[_0x1f49('0xd')](_0x45a3ba);})[_0x1f49('0xe')](function(_0x773314){return _0x59a5b9['status'](0x1f4)[_0x1f49('0xd')](_0x773314);});};exports[_0x1f49('0xf')]=function(_0x402531,_0x5f11b8){var _0x24a29f=[_0x1f49('0x10')];return new BPromise(function(_0x4603f8,_0x4c3e41){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x402531[_0x1f49('0x11')][_0x1f49('0x12')]),function(_0x12c67d,_0x2b52e1,_0x5408d2){if(_0x12c67d){return _0x4c3e41(_0x12c67d);}return _0x4603f8(_0x2b52e1);});})[_0x1f49('0xc')](function(_0x1e8281){var _0x132a3a=![];var _0x4011f8=_0x1e8281[_0x1f49('0x13')](/\n/);for(var _0x3ad719=0x0,_0x51d77e=_0x24a29f[_0x1f49('0x14')];_0x3ad719<_0x51d77e,_0x132a3a===![];_0x3ad719+=0x1){if(_0x1e8281[_0x1f49('0x15')](_0x24a29f[_0x3ad719])>=0x0){_0x132a3a=!![];}}if(!_0x132a3a){throw new Error(util[_0x1f49('0x16')](_0x1f49('0x17'),_0x402531[_0x1f49('0x11')]['pid']));}process['kill'](_0x402531[_0x1f49('0x11')][_0x1f49('0x12')],'SIGINT');return _0x5f11b8[_0x1f49('0x8')](0xc8)['json']({'message':util[_0x1f49('0x16')](_0x1f49('0x18'),_0x402531[_0x1f49('0x11')]['pid'])});})[_0x1f49('0xe')](handleError(_0x5f11b8,null,_0x1f49('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 50d96d7..32fca4a 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 _0x95ef=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','update','delete','exports','multer'];(function(_0x56bcfb,_0x3a67aa){var _0x168a1f=function(_0x31f896){while(--_0x31f896){_0x56bcfb['push'](_0x56bcfb['shift']());}};_0x168a1f(++_0x3a67aa);}(_0x95ef,0x12a));var _0xf95e=function(_0x5af864,_0x39d122){_0x5af864=_0x5af864-0x0;var _0x202486=_0x95ef[_0x5af864];return _0x202486;};'use strict';var multer=require(_0xf95e('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(_0xf95e('0x1'));var auth=require(_0xf95e('0x2'));var interaction=require(_0xf95e('0x3'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0xf95e('0x4')]('/',auth[_0xf95e('0x5')](),controller[_0xf95e('0x6')]);router[_0xf95e('0x4')](_0xf95e('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xf95e('0x8')]('/',auth['isAuthenticated'](),controller[_0xf95e('0x9')]);router['put'](_0xf95e('0x7'),auth[_0xf95e('0x5')](),controller[_0xf95e('0xa')]);router[_0xf95e('0xb')](_0xf95e('0x7'),auth[_0xf95e('0x5')](),controller['destroy']);module[_0xf95e('0xc')]=router; \ No newline at end of file +var _0x4f3d=['index','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4f3d,0x171));var _0xd4f3=function(_0x581df3,_0x3d22eb){_0x581df3=_0x581df3-0x0;var _0x5f4581=_0x4f3d[_0x581df3];return _0x5f4581;};'use strict';var multer=require(_0xd4f3('0x0'));var util=require('util');var path=require(_0xd4f3('0x1'));var timeout=require(_0xd4f3('0x2'));var express=require(_0xd4f3('0x3'));var router=express[_0xd4f3('0x4')]();var fs_extra=require(_0xd4f3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd4f3('0x6'));var config=require(_0xd4f3('0x7'));var controller=require(_0xd4f3('0x8'));router[_0xd4f3('0x9')]('/',auth[_0xd4f3('0xa')](),controller[_0xd4f3('0xb')]);router[_0xd4f3('0x9')](_0xd4f3('0xc'),auth['isAuthenticated'](),controller[_0xd4f3('0xd')]);router[_0xd4f3('0xe')]('/',auth[_0xd4f3('0xa')](),controller[_0xd4f3('0xf')]);router[_0xd4f3('0x10')](_0xd4f3('0xc'),auth[_0xd4f3('0xa')](),controller[_0xd4f3('0x11')]);router['delete'](_0xd4f3('0xc'),auth[_0xd4f3('0xa')](),controller['destroy']);module[_0xd4f3('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index c1d6f0a..bbdcc80 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 _0xe820=['sequelize','STRING','#0091EA'];(function(_0x35ebf0,_0x173204){var _0x4d73f6=function(_0x4591d1){while(--_0x4591d1){_0x35ebf0['push'](_0x35ebf0['shift']());}};_0x4d73f6(++_0x173204);}(_0xe820,0xd2));var _0x0e82=function(_0x4a12b2,_0x4ec9fc){_0x4a12b2=_0x4a12b2-0x0;var _0x368397=_0xe820[_0x4a12b2];return _0x368397;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0e82('0x2')},'description':{'type':Sequelize[_0x0e82('0x1')]}}; \ No newline at end of file +var _0x585e=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x585e,0x1c2));var _0xe585=function(_0x6e79e0,_0x42f212){_0x6e79e0=_0x6e79e0-0x0;var _0x5d28c2=_0x585e[_0x6e79e0];return _0x5d28c2;};'use strict';var Sequelize=require(_0xe585('0x0'));module[_0xe585('0x1')]={'name':{'type':Sequelize[_0xe585('0x2')],'unique':_0xe585('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe585('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index b172066..25406ca 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 _0x9649=['find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','Tags','UserProfileResource','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll'];(function(_0x19d569,_0x429e52){var _0x5f33ba=function(_0x3de20c){while(--_0x3de20c){_0x19d569['push'](_0x19d569['shift']());}};_0x5f33ba(++_0x429e52);}(_0x9649,0x19f));var _0x9964=function(_0x145b5a,_0x34db46){_0x145b5a=_0x145b5a-0x0;var _0x73102d=_0x9649[_0x145b5a];return _0x73102d;};'use strict';var emlformat=require(_0x9964('0x0'));var rimraf=require(_0x9964('0x1'));var zipdir=require(_0x9964('0x2'));var jsonpatch=require(_0x9964('0x3'));var rp=require('request-promise');var moment=require(_0x9964('0x4'));var BPromise=require(_0x9964('0x5'));var Mustache=require('mustache');var util=require(_0x9964('0x6'));var path=require('path');var sox=require(_0x9964('0x7'));var csv=require(_0x9964('0x8'));var ejs=require(_0x9964('0x9'));var fs=require('fs');var fs_extra=require(_0x9964('0xa'));var _=require(_0x9964('0xb'));var squel=require(_0x9964('0xc'));var crypto=require(_0x9964('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9964('0xe'));var toCsv=require(_0x9964('0x8'));var querystring=require('querystring');var Papa=require(_0x9964('0xf'));var Redis=require(_0x9964('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9964('0x11'));var hardwareService=require(_0x9964('0x12'));var logger=require(_0x9964('0x13'))(_0x9964('0x14'));var utils=require(_0x9964('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9964('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56a69d,_0x39c624){_0x39c624=_0x39c624||0xcc;return function(_0x547b98){if(_0x547b98){return _0x56a69d[_0x9964('0x17')](_0x39c624);}return _0x56a69d[_0x9964('0x18')](_0x39c624)['end']();};}function respondWithResult(_0x1fd4b4,_0x463dbf){_0x463dbf=_0x463dbf||0xc8;return function(_0x11dfc9){if(_0x11dfc9){return _0x1fd4b4[_0x9964('0x18')](_0x463dbf)[_0x9964('0x19')](_0x11dfc9);}};}function respondWithFilteredResult(_0x5f002e,_0x411544){return function(_0x226e78){if(_0x226e78){var _0x57b330=typeof _0x411544[_0x9964('0x1a')]===_0x9964('0x1b')&&typeof _0x411544['limit']===_0x9964('0x1b');var _0x2e7e07=_0x226e78[_0x9964('0x1c')];var _0x4c18a4=_0x57b330?0x0:_0x411544['offset'];var _0x40b3dd=_0x57b330?_0x226e78[_0x9964('0x1c')]:_0x411544['offset']+_0x411544[_0x9964('0x1d')];var _0x3f6472;if(_0x40b3dd>=_0x2e7e07){_0x40b3dd=_0x2e7e07;_0x3f6472=0xc8;}else{_0x3f6472=0xce;}_0x5f002e[_0x9964('0x18')](_0x3f6472);return _0x5f002e[_0x9964('0x1e')](_0x9964('0x1f'),_0x4c18a4+'-'+_0x40b3dd+'/'+_0x2e7e07)[_0x9964('0x19')](_0x226e78);}return null;};}function patchUpdates(_0x400bb5){return function(_0x414649){try{jsonpatch[_0x9964('0x20')](_0x414649,_0x400bb5,!![]);}catch(_0xbd5197){return BPromise['reject'](_0xbd5197);}return _0x414649[_0x9964('0x21')]();};}function saveUpdates(_0x447026,_0x4c479f){return function(_0x2b03a8){if(_0x2b03a8){return _0x2b03a8['update'](_0x447026)[_0x9964('0x22')](function(_0xdc3ba){return _0xdc3ba;});}return null;};}function removeEntity(_0x1c5e34,_0x167525){return function(_0x2d049c){if(_0x2d049c){return _0x2d049c[_0x9964('0x23')]()['then'](function(){var _0x452c96=_0x2d049c[_0x9964('0x24')]({'plain':!![]});var _0x5961e9=_0x9964('0x25');return db[_0x9964('0x26')][_0x9964('0x23')]({'where':{'type':_0x5961e9,'resourceId':_0x452c96['id']}})[_0x9964('0x22')](function(){return _0x2d049c;});})[_0x9964('0x22')](function(){_0x1c5e34['status'](0xcc)[_0x9964('0x27')]();});}};}function handleEntityNotFound(_0x4c2b44,_0x44cb60){return function(_0x512f6b){if(!_0x512f6b){_0x4c2b44[_0x9964('0x17')](0x194);}return _0x512f6b;};}function handleError(_0x5dc789,_0x432f81){_0x432f81=_0x432f81||0x1f4;return function(_0x162b83){logger[_0x9964('0x28')](_0x162b83[_0x9964('0x29')]);if(_0x162b83[_0x9964('0x2a')]){delete _0x162b83[_0x9964('0x2a')];}_0x5dc789[_0x9964('0x18')](_0x432f81)[_0x9964('0x2b')](_0x162b83);};}exports[_0x9964('0x2c')]=function(_0x58ce2c,_0x498014){var _0x5444a8={},_0x483092={},_0x36220b={'count':0x0,'rows':[]};var _0x31398d=_[_0x9964('0x2d')](db[_0x9964('0x2e')][_0x9964('0x2f')],function(_0x3092b2){return{'name':_0x3092b2[_0x9964('0x30')],'type':_0x3092b2[_0x9964('0x31')][_0x9964('0x32')]};});_0x483092['model']=_[_0x9964('0x2d')](_0x31398d,_0x9964('0x2a'));_0x483092['query']=_[_0x9964('0x33')](_0x58ce2c[_0x9964('0x34')]);_0x483092[_0x9964('0x35')]=_[_0x9964('0x36')](_0x483092['model'],_0x483092['query']);_0x5444a8[_0x9964('0x37')]=_['intersection'](_0x483092['model'],qs[_0x9964('0x38')](_0x58ce2c[_0x9964('0x34')]['fields']));_0x5444a8['attributes']=_0x5444a8[_0x9964('0x37')][_0x9964('0x39')]?_0x5444a8['attributes']:_0x483092[_0x9964('0x3a')];if(!_0x58ce2c['query']['hasOwnProperty']('nolimit')){_0x5444a8[_0x9964('0x1d')]=qs[_0x9964('0x1d')](_0x58ce2c[_0x9964('0x34')][_0x9964('0x1d')]);_0x5444a8[_0x9964('0x1a')]=qs[_0x9964('0x1a')](_0x58ce2c[_0x9964('0x34')][_0x9964('0x1a')]);}_0x5444a8[_0x9964('0x3b')]=qs['sort'](_0x58ce2c[_0x9964('0x34')][_0x9964('0x3c')]);_0x5444a8[_0x9964('0x3d')]=qs[_0x9964('0x35')](_['pick'](_0x58ce2c['query'],_0x483092[_0x9964('0x35')]),_0x31398d);if(_0x58ce2c[_0x9964('0x34')][_0x9964('0x3e')]){_0x5444a8[_0x9964('0x3d')]=_[_0x9964('0x3f')](_0x5444a8['where'],{'$or':_[_0x9964('0x2d')](_0x31398d,function(_0xca740f){if(_0xca740f[_0x9964('0x31')]!==_0x9964('0x40')){var _0x24d5d9={};_0x24d5d9[_0xca740f[_0x9964('0x2a')]]={'$like':'%'+_0x58ce2c[_0x9964('0x34')][_0x9964('0x3e')]+'%'};return _0x24d5d9;}})});}_0x5444a8=_[_0x9964('0x3f')]({},_0x5444a8,_0x58ce2c[_0x9964('0x41')]);var _0x12e696={'where':_0x5444a8[_0x9964('0x3d')]};return db[_0x9964('0x2e')][_0x9964('0x1c')](_0x12e696)[_0x9964('0x22')](function(_0x2f625e){_0x36220b['count']=_0x2f625e;if(_0x58ce2c[_0x9964('0x34')]['includeAll']){_0x5444a8[_0x9964('0x42')]=[{'all':!![]}];}return db[_0x9964('0x2e')][_0x9964('0x43')](_0x5444a8);})['then'](function(_0xf4a80e){_0x36220b['rows']=_0xf4a80e;return _0x36220b;})[_0x9964('0x22')](respondWithFilteredResult(_0x498014,_0x5444a8))['catch'](handleError(_0x498014,null));};exports[_0x9964('0x44')]=function(_0x4ad7a6,_0x46b64b){var _0x21b810={'raw':!![],'where':{'id':_0x4ad7a6[_0x9964('0x45')]['id']}},_0x121059={};_0x121059[_0x9964('0x3a')]=_[_0x9964('0x33')](db['Tag'][_0x9964('0x2f')]);_0x121059[_0x9964('0x34')]=_[_0x9964('0x33')](_0x4ad7a6[_0x9964('0x34')]);_0x121059[_0x9964('0x35')]=_[_0x9964('0x36')](_0x121059[_0x9964('0x3a')],_0x121059[_0x9964('0x34')]);_0x21b810[_0x9964('0x37')]=_[_0x9964('0x36')](_0x121059['model'],qs['fields'](_0x4ad7a6[_0x9964('0x34')]['fields']));_0x21b810[_0x9964('0x37')]=_0x21b810['attributes']['length']?_0x21b810['attributes']:_0x121059[_0x9964('0x3a')];if(_0x4ad7a6[_0x9964('0x34')][_0x9964('0x46')]){_0x21b810['include']=[{'all':!![]}];}_0x21b810=_['merge']({},_0x21b810,_0x4ad7a6[_0x9964('0x41')]);return db['Tag'][_0x9964('0x47')](_0x21b810)[_0x9964('0x22')](handleEntityNotFound(_0x46b64b,null))[_0x9964('0x22')](respondWithResult(_0x46b64b,null))[_0x9964('0x48')](handleError(_0x46b64b,null));};exports[_0x9964('0x49')]=function(_0x5b0fa7,_0x521d03){return db[_0x9964('0x2e')][_0x9964('0x49')](_0x5b0fa7[_0x9964('0x4a')],{})[_0x9964('0x22')](function(_0x1c575b){var _0x506c24=_0x5b0fa7[_0x9964('0x4b')][_0x9964('0x24')]({'plain':!![]});if(!_0x506c24)throw new Error(_0x9964('0x4c'));if(_0x506c24['role']===_0x9964('0x4b')){var _0x2649cc=_0x1c575b[_0x9964('0x24')]({'plain':!![]});var _0x2e8dec=_0x9964('0x25');return db[_0x9964('0x4d')][_0x9964('0x47')]({'where':{'name':_0x2e8dec,'userProfileId':_0x506c24[_0x9964('0x4e')]},'raw':!![]})['then'](function(_0x67f068){if(_0x67f068&&_0x67f068['autoAssociation']===0x0){return db['UserProfileResource'][_0x9964('0x49')]({'name':_0x2649cc['name'],'resourceId':_0x2649cc['id'],'type':_0x67f068[_0x9964('0x2a')],'sectionId':_0x67f068['id']},{})[_0x9964('0x22')](function(){return _0x1c575b;});}else{return _0x1c575b;}})[_0x9964('0x48')](function(_0x4b9325){logger[_0x9964('0x28')](_0x9964('0x4f'),_0x4b9325);throw _0x4b9325;});}return _0x1c575b;})[_0x9964('0x22')](respondWithResult(_0x521d03,0xc9))[_0x9964('0x48')](handleError(_0x521d03,null));};exports[_0x9964('0x50')]=function(_0x454d97,_0x25db0d){if(_0x454d97[_0x9964('0x4a')]['id']){delete _0x454d97[_0x9964('0x4a')]['id'];}return db['Tag'][_0x9964('0x47')]({'where':{'id':_0x454d97['params']['id']}})[_0x9964('0x22')](handleEntityNotFound(_0x25db0d,null))[_0x9964('0x22')](saveUpdates(_0x454d97[_0x9964('0x4a')],null))['then'](respondWithResult(_0x25db0d,null))[_0x9964('0x48')](handleError(_0x25db0d,null));};exports[_0x9964('0x23')]=function(_0x238867,_0x375ad6){return db[_0x9964('0x2e')]['find']({'where':{'id':_0x238867[_0x9964('0x45')]['id']}})[_0x9964('0x22')](handleEntityNotFound(_0x375ad6,null))[_0x9964('0x22')](removeEntity(_0x375ad6,null))[_0x9964('0x48')](handleError(_0x375ad6,null));}; \ No newline at end of file +var _0x8b29=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','limit','undefined','count','offset','status','set','json','reject','then','Tags','UserProfileResource','sendStatus','error','stack','name','index','map','Tag','rawAttributes','type','key','model','query','filters','intersection','attributes'];(function(_0x4e4fde,_0xc57ec8){var _0x2272e9=function(_0x5786d4){while(--_0x5786d4){_0x4e4fde['push'](_0x4e4fde['shift']());}};_0x2272e9(++_0xc57ec8);}(_0x8b29,0xbe));var _0x98b2=function(_0x53b990,_0x4b3ba3){_0x53b990=_0x53b990-0x0;var _0x33783b=_0x8b29[_0x53b990];return _0x33783b;};'use strict';var emlformat=require(_0x98b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98b2('0x1'));var jsonpatch=require(_0x98b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x98b2('0x3'));var Mustache=require(_0x98b2('0x4'));var util=require('util');var path=require(_0x98b2('0x5'));var sox=require('sox');var csv=require(_0x98b2('0x6'));var ejs=require(_0x98b2('0x7'));var fs=require('fs');var fs_extra=require(_0x98b2('0x8'));var _=require(_0x98b2('0x9'));var squel=require(_0x98b2('0xa'));var crypto=require(_0x98b2('0xb'));var jsforce=require(_0x98b2('0xc'));var deskjs=require(_0x98b2('0xd'));var toCsv=require(_0x98b2('0x6'));var querystring=require(_0x98b2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98b2('0xf'));var qs=require(_0x98b2('0x10'));var as=require(_0x98b2('0x11'));var hardwareService=require(_0x98b2('0x12'));var logger=require(_0x98b2('0x13'))(_0x98b2('0x14'));var utils=require('../../config/utils');var config=require(_0x98b2('0x15'));var licenseUtil=require(_0x98b2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27865e,_0x1180fe){_0x1180fe=_0x1180fe||0xcc;return function(_0x2a6337){if(_0x2a6337){return _0x27865e['sendStatus'](_0x1180fe);}return _0x27865e['status'](_0x1180fe)[_0x98b2('0x17')]();};}function respondWithResult(_0x56bcbd,_0x2966e2){_0x2966e2=_0x2966e2||0xc8;return function(_0x49b151){if(_0x49b151){return _0x56bcbd['status'](_0x2966e2)['json'](_0x49b151);}};}function respondWithFilteredResult(_0x831ee8,_0x413464){return function(_0xe49e9a){if(_0xe49e9a){var _0x5ecea1=typeof _0x413464['offset']==='undefined'&&typeof _0x413464[_0x98b2('0x18')]===_0x98b2('0x19');var _0x145d65=_0xe49e9a[_0x98b2('0x1a')];var _0x4b9f2c=_0x5ecea1?0x0:_0x413464[_0x98b2('0x1b')];var _0x588837=_0x5ecea1?_0xe49e9a[_0x98b2('0x1a')]:_0x413464['offset']+_0x413464[_0x98b2('0x18')];var _0x1dfc04;if(_0x588837>=_0x145d65){_0x588837=_0x145d65;_0x1dfc04=0xc8;}else{_0x1dfc04=0xce;}_0x831ee8[_0x98b2('0x1c')](_0x1dfc04);return _0x831ee8[_0x98b2('0x1d')]('Content-Range',_0x4b9f2c+'-'+_0x588837+'/'+_0x145d65)[_0x98b2('0x1e')](_0xe49e9a);}return null;};}function patchUpdates(_0x242cbd){return function(_0x5dfdf7){try{jsonpatch['apply'](_0x5dfdf7,_0x242cbd,!![]);}catch(_0x5d6b38){return BPromise[_0x98b2('0x1f')](_0x5d6b38);}return _0x5dfdf7['save']();};}function saveUpdates(_0x4ddded,_0x3796c0){return function(_0x37fc18){if(_0x37fc18){return _0x37fc18['update'](_0x4ddded)[_0x98b2('0x20')](function(_0x13d149){return _0x13d149;});}return null;};}function removeEntity(_0xfae112,_0x4f33d8){return function(_0x2a5587){if(_0x2a5587){return _0x2a5587['destroy']()[_0x98b2('0x20')](function(){var _0x4c34f1=_0x2a5587['get']({'plain':!![]});var _0x7b6ebc=_0x98b2('0x21');return db[_0x98b2('0x22')]['destroy']({'where':{'type':_0x7b6ebc,'resourceId':_0x4c34f1['id']}})['then'](function(){return _0x2a5587;});})['then'](function(){_0xfae112[_0x98b2('0x1c')](0xcc)[_0x98b2('0x17')]();});}};}function handleEntityNotFound(_0x50aafb,_0xecb32b){return function(_0x28db65){if(!_0x28db65){_0x50aafb[_0x98b2('0x23')](0x194);}return _0x28db65;};}function handleError(_0x56efb6,_0x2e1ea4){_0x2e1ea4=_0x2e1ea4||0x1f4;return function(_0x1dee11){logger[_0x98b2('0x24')](_0x1dee11[_0x98b2('0x25')]);if(_0x1dee11[_0x98b2('0x26')]){delete _0x1dee11['name'];}_0x56efb6[_0x98b2('0x1c')](_0x2e1ea4)['send'](_0x1dee11);};}exports[_0x98b2('0x27')]=function(_0x1aa42a,_0x4d197c){var _0x2f5156={},_0x363174={},_0x526637={'count':0x0,'rows':[]};var _0x1a676e=_[_0x98b2('0x28')](db[_0x98b2('0x29')][_0x98b2('0x2a')],function(_0x4aee2a){return{'name':_0x4aee2a['fieldName'],'type':_0x4aee2a[_0x98b2('0x2b')][_0x98b2('0x2c')]};});_0x363174[_0x98b2('0x2d')]=_[_0x98b2('0x28')](_0x1a676e,_0x98b2('0x26'));_0x363174[_0x98b2('0x2e')]=_['keys'](_0x1aa42a[_0x98b2('0x2e')]);_0x363174[_0x98b2('0x2f')]=_[_0x98b2('0x30')](_0x363174[_0x98b2('0x2d')],_0x363174[_0x98b2('0x2e')]);_0x2f5156[_0x98b2('0x31')]=_[_0x98b2('0x30')](_0x363174[_0x98b2('0x2d')],qs[_0x98b2('0x32')](_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x32')]));_0x2f5156[_0x98b2('0x31')]=_0x2f5156[_0x98b2('0x31')]['length']?_0x2f5156['attributes']:_0x363174[_0x98b2('0x2d')];if(!_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x33')](_0x98b2('0x34'))){_0x2f5156[_0x98b2('0x18')]=qs[_0x98b2('0x18')](_0x1aa42a['query'][_0x98b2('0x18')]);_0x2f5156[_0x98b2('0x1b')]=qs[_0x98b2('0x1b')](_0x1aa42a[_0x98b2('0x2e')]['offset']);}_0x2f5156[_0x98b2('0x35')]=qs[_0x98b2('0x36')](_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x36')]);_0x2f5156[_0x98b2('0x37')]=qs[_0x98b2('0x2f')](_[_0x98b2('0x38')](_0x1aa42a['query'],_0x363174[_0x98b2('0x2f')]),_0x1a676e);if(_0x1aa42a['query'][_0x98b2('0x39')]){_0x2f5156[_0x98b2('0x37')]=_[_0x98b2('0x3a')](_0x2f5156[_0x98b2('0x37')],{'$or':_['map'](_0x1a676e,function(_0x5aa34b){if(_0x5aa34b[_0x98b2('0x2b')]!==_0x98b2('0x3b')){var _0x42c69c={};_0x42c69c[_0x5aa34b['name']]={'$like':'%'+_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x39')]+'%'};return _0x42c69c;}})});}_0x2f5156=_[_0x98b2('0x3a')]({},_0x2f5156,_0x1aa42a[_0x98b2('0x3c')]);var _0x311fa7={'where':_0x2f5156[_0x98b2('0x37')]};return db['Tag'][_0x98b2('0x1a')](_0x311fa7)[_0x98b2('0x20')](function(_0x197749){_0x526637['count']=_0x197749;if(_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x3d')]){_0x2f5156[_0x98b2('0x3e')]=[{'all':!![]}];}return db[_0x98b2('0x29')][_0x98b2('0x3f')](_0x2f5156);})[_0x98b2('0x20')](function(_0x4a6c03){_0x526637[_0x98b2('0x40')]=_0x4a6c03;return _0x526637;})['then'](respondWithFilteredResult(_0x4d197c,_0x2f5156))[_0x98b2('0x41')](handleError(_0x4d197c,null));};exports[_0x98b2('0x42')]=function(_0x410094,_0x1d262d){var _0x44d858={'raw':!![],'where':{'id':_0x410094[_0x98b2('0x43')]['id']}},_0x32e14b={};_0x32e14b[_0x98b2('0x2d')]=_[_0x98b2('0x44')](db['Tag'][_0x98b2('0x2a')]);_0x32e14b['query']=_[_0x98b2('0x44')](_0x410094[_0x98b2('0x2e')]);_0x32e14b[_0x98b2('0x2f')]=_[_0x98b2('0x30')](_0x32e14b[_0x98b2('0x2d')],_0x32e14b[_0x98b2('0x2e')]);_0x44d858['attributes']=_[_0x98b2('0x30')](_0x32e14b[_0x98b2('0x2d')],qs[_0x98b2('0x32')](_0x410094[_0x98b2('0x2e')][_0x98b2('0x32')]));_0x44d858['attributes']=_0x44d858['attributes'][_0x98b2('0x45')]?_0x44d858[_0x98b2('0x31')]:_0x32e14b[_0x98b2('0x2d')];if(_0x410094[_0x98b2('0x2e')]['includeAll']){_0x44d858['include']=[{'all':!![]}];}_0x44d858=_['merge']({},_0x44d858,_0x410094[_0x98b2('0x3c')]);return db[_0x98b2('0x29')][_0x98b2('0x46')](_0x44d858)[_0x98b2('0x20')](handleEntityNotFound(_0x1d262d,null))[_0x98b2('0x20')](respondWithResult(_0x1d262d,null))[_0x98b2('0x41')](handleError(_0x1d262d,null));};exports[_0x98b2('0x47')]=function(_0x2b08ed,_0x3c2477){return db['Tag'][_0x98b2('0x47')](_0x2b08ed['body'],{})[_0x98b2('0x20')](function(_0x6369ca){var _0x3c3c64=_0x2b08ed[_0x98b2('0x48')]['get']({'plain':!![]});if(!_0x3c3c64)throw new Error(_0x98b2('0x49'));if(_0x3c3c64[_0x98b2('0x4a')]===_0x98b2('0x48')){var _0x1e13b8=_0x6369ca[_0x98b2('0x4b')]({'plain':!![]});var _0x54f7ba=_0x98b2('0x21');return db[_0x98b2('0x4c')][_0x98b2('0x46')]({'where':{'name':_0x54f7ba,'userProfileId':_0x3c3c64[_0x98b2('0x4d')]},'raw':!![]})[_0x98b2('0x20')](function(_0x3d6a4e){if(_0x3d6a4e&&_0x3d6a4e[_0x98b2('0x4e')]===0x0){return db[_0x98b2('0x22')][_0x98b2('0x47')]({'name':_0x1e13b8[_0x98b2('0x26')],'resourceId':_0x1e13b8['id'],'type':_0x3d6a4e[_0x98b2('0x26')],'sectionId':_0x3d6a4e['id']},{})[_0x98b2('0x20')](function(){return _0x6369ca;});}else{return _0x6369ca;}})['catch'](function(_0x3b083a){logger[_0x98b2('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b083a);throw _0x3b083a;});}return _0x6369ca;})['then'](respondWithResult(_0x3c2477,0xc9))[_0x98b2('0x41')](handleError(_0x3c2477,null));};exports['update']=function(_0x20ddfd,_0x1cad33){if(_0x20ddfd[_0x98b2('0x4f')]['id']){delete _0x20ddfd[_0x98b2('0x4f')]['id'];}return db[_0x98b2('0x29')][_0x98b2('0x46')]({'where':{'id':_0x20ddfd['params']['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x1cad33,null))['then'](saveUpdates(_0x20ddfd['body'],null))[_0x98b2('0x20')](respondWithResult(_0x1cad33,null))[_0x98b2('0x41')](handleError(_0x1cad33,null));};exports['destroy']=function(_0x12a72e,_0x1253e2){return db['Tag'][_0x98b2('0x46')]({'where':{'id':_0x12a72e[_0x98b2('0x43')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x1253e2,null))[_0x98b2('0x20')](removeEntity(_0x1253e2,null))['catch'](handleError(_0x1253e2,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7de96a7..aabae78 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 _0x6057=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','tools_tags'];(function(_0x56224a,_0x1bbf8b){var _0x52fdd6=function(_0x138b67){while(--_0x138b67){_0x56224a['push'](_0x56224a['shift']());}};_0x52fdd6(++_0x1bbf8b);}(_0x6057,0x8c));var _0x7605=function(_0x1e7345,_0x18bcce){_0x1e7345=_0x1e7345-0x0;var _0x33017c=_0x6057[_0x1e7345];return _0x33017c;};'use strict';var _=require(_0x7605('0x0'));var util=require(_0x7605('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7605('0x2'));var rp=require(_0x7605('0x3'));var fs=require('fs');var path=require(_0x7605('0x4'));var rimraf=require(_0x7605('0x5'));var config=require(_0x7605('0x6'));var attributes=require(_0x7605('0x7'));module[_0x7605('0x8')]=function(_0x4b6138,_0x3f934e){return _0x4b6138['define']('Tag',attributes,{'tableName':_0x7605('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09d9=['rimraf','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x09d9,0xaf));var _0x909d=function(_0x167115,_0x45d8d8){_0x167115=_0x167115-0x0;var _0x4f0e49=_0x09d9[_0x167115];return _0x4f0e49;};'use strict';var _=require(_0x909d('0x0'));var util=require(_0x909d('0x1'));var logger=require(_0x909d('0x2'))('api');var moment=require(_0x909d('0x3'));var BPromise=require(_0x909d('0x4'));var rp=require(_0x909d('0x5'));var fs=require('fs');var path=require(_0x909d('0x6'));var rimraf=require(_0x909d('0x7'));var config=require('../../config/environment');var attributes=require(_0x909d('0x8'));module[_0x909d('0x9')]=function(_0x1aac58,_0x138832){return _0x1aac58[_0x909d('0xa')](_0x909d('0xb'),attributes,{'tableName':_0x909d('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 654eb4f..0e17efc 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 _0x66fa=['../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x198d38,_0x3ea78f){var _0xed38c5=function(_0x26f1f8){while(--_0x26f1f8){_0x198d38['push'](_0x198d38['shift']());}};_0xed38c5(++_0x3ea78f);}(_0x66fa,0x168));var _0xa66f=function(_0x11b2af,_0x2e7717){_0x11b2af=_0x11b2af-0x0;var _0x152890=_0x66fa[_0x11b2af];return _0x152890;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require(_0xa66f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var utils=require(_0xa66f('0x5'));var logger=require(_0xa66f('0x6'))(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var jayson=require(_0xa66f('0x9'));var client=jayson[_0xa66f('0xa')][_0xa66f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33bd0d,_0x150f73,_0x5b7cf7){return new BPromise(function(_0x1cf624,_0x5ec156){return client[_0xa66f('0xc')](_0x33bd0d,_0x5b7cf7)[_0xa66f('0xd')](function(_0x5ad336){logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,_0xa66f('0x10'));logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x150f73,_0xa66f('0x10'),JSON['stringify'](_0x5ad336));if(_0x5ad336['error']){if(_0x5ad336[_0xa66f('0x13')]['code']===0x1f4){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')]['message']);return _0x5ec156(_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);}logger['error'](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);return _0x1cf624(_0x5ad336[_0xa66f('0x13')]['message']);}else{logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,'request\x20sent');_0x1cf624(_0x5ad336[_0xa66f('0x15')][_0xa66f('0x14')]);}})[_0xa66f('0x16')](function(_0x76af81){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x76af81);_0x5ec156(_0x76af81);});});} \ No newline at end of file +var _0xd382=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x107df9,_0x4d1825){var _0x2df84a=function(_0x3330ed){while(--_0x3330ed){_0x107df9['push'](_0x107df9['shift']());}};_0x2df84a(++_0x4d1825);}(_0xd382,0x1b6));var _0x2d38=function(_0x12356a,_0x1f4335){_0x12356a=_0x12356a-0x0;var _0x1bca30=_0xd382[_0x12356a];return _0x1bca30;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require(_0x2d38('0x2'));var BPromise=require(_0x2d38('0x3'));var rs=require(_0x2d38('0x4'));var fs=require('fs');var Redis=require(_0x2d38('0x5'));var db=require(_0x2d38('0x6'))['db'];var utils=require(_0x2d38('0x7'));var logger=require(_0x2d38('0x8'))(_0x2d38('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2919,_0x55ae65,_0x1296cb){return new BPromise(function(_0x3fb88f,_0x39ebfd){return client['request'](_0x1e2919,_0x1296cb)['then'](function(_0x5f20a4){logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,'request\x20sent');logger[_0x2d38('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x55ae65,_0x2d38('0xe'),JSON[_0x2d38('0xf')](_0x5f20a4));if(_0x5f20a4[_0x2d38('0x10')]){if(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x11')]===0x1f4){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x39ebfd(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x3fb88f(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}else{logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,_0x2d38('0xe'));_0x3fb88f(_0x5f20a4[_0x2d38('0x13')][_0x2d38('0x12')]);}})[_0x2d38('0x14')](function(_0x6d2a9a){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x6d2a9a);_0x39ebfd(_0x6d2a9a);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index c488758..6a71a3b 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(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +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(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 a555195..d8643a9 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 _0xd8b0=['exports','sequelize'];(function(_0x49158d,_0x8d8808){var _0x14984c=function(_0x44dba8){while(--_0x44dba8){_0x49158d['push'](_0x49158d['shift']());}};_0x14984c(++_0x8d8808);}(_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 _0xbaf0=['name','exports','STRING'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 1ed3586..b99f55c 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 _0x4a90=['WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','QueueId','TeamVoiceQueue','Queue','emit','Queue:save','User','findAll','voicePause','interface','upsert','format','SIP/%s','penalty','all','spread','removeAgents','UserVoiceQueueRt','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','defaults','redis','./team.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','map','Team','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','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','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x4a90,0x15d));var _0x04a9=function(_0x2bb859,_0x1b5d9a){_0x2bb859=_0x2bb859-0x0;var _0x421558=_0x4a90[_0x2bb859];return _0x421558;};'use strict';var emlformat=require(_0x04a9('0x0'));var rimraf=require(_0x04a9('0x1'));var zipdir=require(_0x04a9('0x2'));var jsonpatch=require(_0x04a9('0x3'));var rp=require('request-promise');var moment=require(_0x04a9('0x4'));var BPromise=require(_0x04a9('0x5'));var Mustache=require(_0x04a9('0x6'));var util=require(_0x04a9('0x7'));var path=require(_0x04a9('0x8'));var sox=require(_0x04a9('0x9'));var csv=require('to-csv');var ejs=require(_0x04a9('0xa'));var fs=require('fs');var fs_extra=require(_0x04a9('0xb'));var _=require(_0x04a9('0xc'));var squel=require(_0x04a9('0xd'));var crypto=require('crypto');var jsforce=require(_0x04a9('0xe'));var deskjs=require(_0x04a9('0xf'));var toCsv=require(_0x04a9('0x10'));var querystring=require(_0x04a9('0x11'));var Papa=require(_0x04a9('0x12'));var Redis=require(_0x04a9('0x13'));var authService=require(_0x04a9('0x14'));var qs=require(_0x04a9('0x15'));var as=require(_0x04a9('0x16'));var hardwareService=require(_0x04a9('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x04a9('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x04a9('0x19')](config[_0x04a9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x04a9('0x1b'))['register'](socket);function respondWithStatusCode(_0x184256,_0xc0f287){_0xc0f287=_0xc0f287||0xcc;return function(_0x313f11){if(_0x313f11){return _0x184256[_0x04a9('0x1c')](_0xc0f287);}return _0x184256[_0x04a9('0x1d')](_0xc0f287)[_0x04a9('0x1e')]();};}function respondWithResult(_0xf7385c,_0x5781ed){_0x5781ed=_0x5781ed||0xc8;return function(_0x33e3d7){if(_0x33e3d7){return _0xf7385c['status'](_0x5781ed)[_0x04a9('0x1f')](_0x33e3d7);}};}function respondWithFilteredResult(_0x3b8262,_0x5cd465){return function(_0x2efd61){if(_0x2efd61){var _0x154d2b=typeof _0x5cd465[_0x04a9('0x20')]===_0x04a9('0x21')&&typeof _0x5cd465[_0x04a9('0x22')]===_0x04a9('0x21');var _0x1c48d2=_0x2efd61[_0x04a9('0x23')];var _0x4ebb8d=_0x154d2b?0x0:_0x5cd465[_0x04a9('0x20')];var _0x273d8d=_0x154d2b?_0x2efd61[_0x04a9('0x23')]:_0x5cd465['offset']+_0x5cd465[_0x04a9('0x22')];var _0x3f2458;if(_0x273d8d>=_0x1c48d2){_0x273d8d=_0x1c48d2;_0x3f2458=0xc8;}else{_0x3f2458=0xce;}_0x3b8262['status'](_0x3f2458);return _0x3b8262['set'](_0x04a9('0x24'),_0x4ebb8d+'-'+_0x273d8d+'/'+_0x1c48d2)[_0x04a9('0x1f')](_0x2efd61);}return null;};}function patchUpdates(_0x220d96){return function(_0x4a7e1a){try{jsonpatch['apply'](_0x4a7e1a,_0x220d96,!![]);}catch(_0x17eb0a){return BPromise[_0x04a9('0x25')](_0x17eb0a);}return _0x4a7e1a[_0x04a9('0x26')]();};}function saveUpdates(_0x1f7fae,_0x56daf5){return function(_0x5e181a){if(_0x5e181a){return _0x5e181a[_0x04a9('0x27')](_0x1f7fae)[_0x04a9('0x28')](function(_0x3a5b12){return _0x3a5b12;});}return null;};}function handleEntityNotFound(_0x15aece,_0x331813){return function(_0x355926){if(!_0x355926){_0x15aece[_0x04a9('0x1c')](0x194);}return _0x355926;};}function handleError(_0x55684f,_0x384a35){_0x384a35=_0x384a35||0x1f4;return function(_0x10e322){logger[_0x04a9('0x29')](_0x10e322[_0x04a9('0x2a')]);if(_0x10e322[_0x04a9('0x2b')]){delete _0x10e322['name'];}_0x55684f[_0x04a9('0x1d')](_0x384a35)[_0x04a9('0x2c')](_0x10e322);};}exports['index']=function(_0x2c431e,_0x339369){var _0x56cc8e={},_0x4891ca={},_0x30e14c={'count':0x0,'rows':[]};var _0x3856e8=_[_0x04a9('0x2d')](db[_0x04a9('0x2e')][_0x04a9('0x2f')],function(_0x339314){return{'name':_0x339314['fieldName'],'type':_0x339314[_0x04a9('0x30')][_0x04a9('0x31')]};});_0x4891ca[_0x04a9('0x32')]=_[_0x04a9('0x2d')](_0x3856e8,_0x04a9('0x2b'));_0x4891ca[_0x04a9('0x33')]=_['keys'](_0x2c431e[_0x04a9('0x33')]);_0x4891ca[_0x04a9('0x34')]=_['intersection'](_0x4891ca[_0x04a9('0x32')],_0x4891ca[_0x04a9('0x33')]);_0x56cc8e[_0x04a9('0x35')]=_[_0x04a9('0x36')](_0x4891ca[_0x04a9('0x32')],qs[_0x04a9('0x37')](_0x2c431e[_0x04a9('0x33')][_0x04a9('0x37')]));_0x56cc8e[_0x04a9('0x35')]=_0x56cc8e['attributes'][_0x04a9('0x38')]?_0x56cc8e[_0x04a9('0x35')]:_0x4891ca['model'];if(!_0x2c431e[_0x04a9('0x33')][_0x04a9('0x39')]('nolimit')){_0x56cc8e[_0x04a9('0x22')]=qs[_0x04a9('0x22')](_0x2c431e[_0x04a9('0x33')][_0x04a9('0x22')]);_0x56cc8e[_0x04a9('0x20')]=qs[_0x04a9('0x20')](_0x2c431e['query'][_0x04a9('0x20')]);}_0x56cc8e[_0x04a9('0x3a')]=qs[_0x04a9('0x3b')](_0x2c431e[_0x04a9('0x33')]['sort']);_0x56cc8e[_0x04a9('0x3c')]=qs['filters'](_[_0x04a9('0x3d')](_0x2c431e['query'],_0x4891ca[_0x04a9('0x34')]),_0x3856e8);if(_0x2c431e[_0x04a9('0x33')][_0x04a9('0x3e')]){_0x56cc8e[_0x04a9('0x3c')]=_[_0x04a9('0x3f')](_0x56cc8e[_0x04a9('0x3c')],{'$or':_['map'](_0x3856e8,function(_0x3a1b4b){if(_0x3a1b4b[_0x04a9('0x30')]!==_0x04a9('0x40')){var _0x50cca9={};_0x50cca9[_0x3a1b4b[_0x04a9('0x2b')]]={'$like':'%'+_0x2c431e['query'][_0x04a9('0x3e')]+'%'};return _0x50cca9;}})});}_0x56cc8e=_[_0x04a9('0x3f')]({},_0x56cc8e,_0x2c431e[_0x04a9('0x41')]);var _0x50e839={'where':_0x56cc8e[_0x04a9('0x3c')]};return db[_0x04a9('0x2e')][_0x04a9('0x23')](_0x50e839)[_0x04a9('0x28')](function(_0x1520a4){_0x30e14c[_0x04a9('0x23')]=_0x1520a4;if(_0x2c431e[_0x04a9('0x33')][_0x04a9('0x42')]){_0x56cc8e['include']=[{'all':!![]}];}return db[_0x04a9('0x2e')]['findAll'](_0x56cc8e);})[_0x04a9('0x28')](function(_0x15be3a){_0x30e14c[_0x04a9('0x43')]=_0x15be3a;return _0x30e14c;})[_0x04a9('0x28')](respondWithFilteredResult(_0x339369,_0x56cc8e))['catch'](handleError(_0x339369,null));};exports[_0x04a9('0x44')]=function(_0x1fbabd,_0x2116a8){var _0x34ee61={'raw':![],'where':{'id':_0x1fbabd[_0x04a9('0x45')]['id']}},_0x43d481={};_0x43d481[_0x04a9('0x32')]=_[_0x04a9('0x46')](db[_0x04a9('0x2e')][_0x04a9('0x2f')]);_0x43d481[_0x04a9('0x33')]=_[_0x04a9('0x46')](_0x1fbabd[_0x04a9('0x33')]);_0x43d481['filters']=_['intersection'](_0x43d481[_0x04a9('0x32')],_0x43d481['query']);_0x34ee61[_0x04a9('0x35')]=_['intersection'](_0x43d481[_0x04a9('0x32')],qs[_0x04a9('0x37')](_0x1fbabd['query'][_0x04a9('0x37')]));_0x34ee61[_0x04a9('0x35')]=_0x34ee61[_0x04a9('0x35')][_0x04a9('0x38')]?_0x34ee61['attributes']:_0x43d481[_0x04a9('0x32')];if(_0x1fbabd['query'][_0x04a9('0x42')]){_0x34ee61[_0x04a9('0x47')]=[{'all':!![]}];}_0x34ee61=_[_0x04a9('0x3f')]({},_0x34ee61,_0x1fbabd[_0x04a9('0x41')]);return db['Team'][_0x04a9('0x48')](_0x34ee61)[_0x04a9('0x28')](handleEntityNotFound(_0x2116a8,null))[_0x04a9('0x28')](respondWithResult(_0x2116a8,null))[_0x04a9('0x49')](handleError(_0x2116a8,null));};exports['create']=function(_0x37be5e,_0x243256){return db['Team'][_0x04a9('0x4a')](_0x37be5e[_0x04a9('0x4b')],{})[_0x04a9('0x28')](function(_0x261a63){var _0x1d85e7=_0x37be5e[_0x04a9('0x4c')][_0x04a9('0x4d')]({'plain':!![]});if(!_0x1d85e7)throw new Error(_0x04a9('0x4e'));if(_0x1d85e7[_0x04a9('0x4f')]==='user'){var _0x5e09b6=_0x261a63[_0x04a9('0x4d')]({'plain':!![]});var _0x15447f=_0x04a9('0x50');return db['UserProfileSection'][_0x04a9('0x48')]({'where':{'name':_0x15447f,'userProfileId':_0x1d85e7[_0x04a9('0x51')]},'raw':!![]})['then'](function(_0x2cc702){if(_0x2cc702&&_0x2cc702[_0x04a9('0x52')]===0x0){return db[_0x04a9('0x53')][_0x04a9('0x4a')]({'name':_0x5e09b6['name'],'resourceId':_0x5e09b6['id'],'type':_0x2cc702[_0x04a9('0x2b')],'sectionId':_0x2cc702['id']},{})[_0x04a9('0x28')](function(){return _0x261a63;});}else{return _0x261a63;}})[_0x04a9('0x49')](function(_0x7309f4){logger[_0x04a9('0x29')](_0x04a9('0x54'),_0x7309f4);throw _0x7309f4;});}return _0x261a63;})['then'](respondWithResult(_0x243256,0xc9))[_0x04a9('0x49')](handleError(_0x243256,null));};exports[_0x04a9('0x27')]=function(_0xccfa09,_0x1e4668){if(_0xccfa09[_0x04a9('0x4b')]['id']){delete _0xccfa09[_0x04a9('0x4b')]['id'];}return db[_0x04a9('0x2e')]['find']({'where':{'id':_0xccfa09[_0x04a9('0x45')]['id']}})[_0x04a9('0x28')](handleEntityNotFound(_0x1e4668,null))[_0x04a9('0x28')](saveUpdates(_0xccfa09[_0x04a9('0x4b')],null))[_0x04a9('0x28')](respondWithResult(_0x1e4668,null))[_0x04a9('0x49')](handleError(_0x1e4668,null));};exports[_0x04a9('0x55')]=function(_0x66d45c,_0x4a4958){var _0x55944a=_0x66d45c['params']['id'];var _0x72a96d=[];return db['sequelize'][_0x04a9('0x56')](function(_0x1f20fb){var _0x1dc99a=_0x04a9('0x57')+_0x55944a;return db[_0x04a9('0x58')][_0x04a9('0x33')](_0x1dc99a,{'type':db[_0x04a9('0x59')]['QueryTypes'][_0x04a9('0x5a')],'raw':!![],'transaction':_0x1f20fb})[_0x04a9('0x28')](function(_0x3ac4ba){_0x72a96d=_[_0x04a9('0x2d')](_0x3ac4ba,function(_0x9531d){return Number(_0x9531d[_0x04a9('0x5b')]);});})[_0x04a9('0x28')](function(){var _0x5204c9=_0x04a9('0x5c')+_0x55944a;return db[_0x04a9('0x58')][_0x04a9('0x33')](_0x5204c9,{'type':db['Sequelize'][_0x04a9('0x5d')][_0x04a9('0x5a')],'raw':!![],'transaction':_0x1f20fb});})['then'](function(_0x4c71a1){var _0x40c63e=_['map'](_0x4c71a1,function(_0x11178c){return Number(_0x11178c['VoiceQueueId']);});return db[_0x04a9('0x5e')][_0x04a9('0x55')]({'where':{'UserId':{'$in':_0x72a96d},'VoiceQueueId':{'$in':_0x40c63e}},'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(){var _0x5b17c2=_0x04a9('0x5f')+_0x55944a;return db[_0x04a9('0x58')][_0x04a9('0x33')](_0x5b17c2,{'type':db[_0x04a9('0x59')][_0x04a9('0x5d')][_0x04a9('0x5a')],'raw':!![],'transaction':_0x1f20fb});})['then'](function(_0x55aef9){var _0x590252=_[_0x04a9('0x2d')](_0x55aef9,function(_0x4929db){return Number(_0x4929db['MailQueueId']);});return db[_0x04a9('0x60')]['destroy']({'where':{'UserId':{'$in':_0x72a96d},'MailQueueId':{'$in':_0x590252}},'transaction':_0x1f20fb});})['then'](function(){var _0x3e9959=_0x04a9('0x61')+_0x55944a;return db['sequelize']['query'](_0x3e9959,{'type':db[_0x04a9('0x59')][_0x04a9('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(_0x3ffb05){var _0xbc8cc5=_[_0x04a9('0x2d')](_0x3ffb05,function(_0x1735b8){return Number(_0x1735b8[_0x04a9('0x62')]);});return db[_0x04a9('0x63')][_0x04a9('0x55')]({'where':{'UserId':{'$in':_0x72a96d},'SmsQueueId':{'$in':_0xbc8cc5}},'transaction':_0x1f20fb});})['then'](function(){var _0x2c74ee=_0x04a9('0x64')+_0x55944a;return db[_0x04a9('0x58')][_0x04a9('0x33')](_0x2c74ee,{'type':db['Sequelize'][_0x04a9('0x5d')][_0x04a9('0x5a')],'raw':!![],'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(_0xa20d94){var _0x595e3d=_[_0x04a9('0x2d')](_0xa20d94,function(_0x43eac1){return Number(_0x43eac1['ChatQueueId']);});return db[_0x04a9('0x65')][_0x04a9('0x55')]({'where':{'UserId':{'$in':_0x72a96d},'ChatQueueId':{'$in':_0x595e3d}},'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(){var _0x1b4260=_0x04a9('0x66')+_0x55944a;return db[_0x04a9('0x58')][_0x04a9('0x33')](_0x1b4260,{'type':db['Sequelize'][_0x04a9('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1f20fb});})['then'](function(_0x4e40e2){var _0x4682ea=_[_0x04a9('0x2d')](_0x4e40e2,function(_0x10ae94){return Number(_0x10ae94[_0x04a9('0x67')]);});return db[_0x04a9('0x68')][_0x04a9('0x55')]({'where':{'UserId':{'$in':_0x72a96d},'FaxQueueId':{'$in':_0x4682ea}},'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(){var _0x3b36ad=_0x04a9('0x69')+_0x55944a;return db[_0x04a9('0x58')][_0x04a9('0x33')](_0x3b36ad,{'type':db['Sequelize'][_0x04a9('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(_0x17f032){var _0xb7a34=_[_0x04a9('0x2d')](_0x17f032,function(_0x5bd954){return Number(_0x5bd954[_0x04a9('0x6a')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x72a96d},'OpenchannelQueueId':{'$in':_0xb7a34}},'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(){var _0x4698eb='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x55944a;return db[_0x04a9('0x58')][_0x04a9('0x33')](_0x4698eb,{'type':db[_0x04a9('0x59')][_0x04a9('0x5d')][_0x04a9('0x5a')],'raw':!![],'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(_0x4b62a2){var _0x2be213=_[_0x04a9('0x2d')](_0x4b62a2,function(_0x2ca154){return Number(_0x2ca154[_0x04a9('0x6b')]);});return db[_0x04a9('0x6c')][_0x04a9('0x55')]({'where':{'UserId':{'$in':_0x72a96d},'WhatsappQueueId':{'$in':_0x2be213}},'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(){return db[_0x04a9('0x6d')][_0x04a9('0x48')]({'where':{'TeamId':_0x55944a}});})[_0x04a9('0x28')](function(_0x3c173d){if(_0x3c173d===null){return;}return db[_0x04a9('0x6e')][_0x04a9('0x55')]({'where':{'UserId':{'$in':_0x72a96d},'VoicePrefixId':_0x3c173d[_0x04a9('0x6f')]},'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(){return db[_0x04a9('0x2e')][_0x04a9('0x55')]({'where':{'id':_0x55944a},'cascade':!![],'transaction':_0x1f20fb});})[_0x04a9('0x28')](function(_0x59dff8){if(_0x59dff8===0x0){_0x4a4958[_0x04a9('0x1c')](0x194);}else{return db[_0x04a9('0x53')][_0x04a9('0x55')]({'where':{'type':'Teams','resourceId':_0x55944a},'cascade':!![],'transaction':_0x1f20fb})[_0x04a9('0x28')](function(){_0x4a4958[_0x04a9('0x1d')](0xcc)[_0x04a9('0x1e')]();});}})[_0x04a9('0x49')](function(_0x2741b0){_0x4a4958['status'](0x1f4)[_0x04a9('0x2c')](_0x2741b0);});});};exports['getQueues']=function(_0x5e0843,_0x37c16c,_0x4dc76b){return db[_0x04a9('0x2e')][_0x04a9('0x70')]({'where':{'id':_0x5e0843['params']['id']}})[_0x04a9('0x28')](handleEntityNotFound(_0x37c16c,null))[_0x04a9('0x28')](function(_0x51415a){if(!_0x5e0843[_0x04a9('0x33')][_0x04a9('0x71')]||!utils[_0x04a9('0x72')](_0x5e0843[_0x04a9('0x33')][_0x04a9('0x71')])){throw new db[(_0x04a9('0x59'))][(_0x04a9('0x73'))](_0x04a9('0x74'));}var _0x19fee4={};var _0x375076={};_0x375076[_0x04a9('0x32')]=_[_0x04a9('0x46')](db[_[_0x04a9('0x75')](_0x5e0843[_0x04a9('0x33')][_0x04a9('0x71')][_0x04a9('0x76')]())+'Queue'][_0x04a9('0x2f')]);_0x375076[_0x04a9('0x33')]=_[_0x04a9('0x46')](_0x5e0843[_0x04a9('0x33')]);_0x375076[_0x04a9('0x34')]=_[_0x04a9('0x36')](_0x375076['model'],_0x375076[_0x04a9('0x33')]);_0x19fee4[_0x04a9('0x35')]=_['intersection'](_0x375076[_0x04a9('0x32')],qs[_0x04a9('0x37')](_0x5e0843[_0x04a9('0x33')][_0x04a9('0x37')]));_0x19fee4['attributes']=_0x19fee4['attributes']['length']?_0x19fee4[_0x04a9('0x35')]:_0x375076[_0x04a9('0x32')];_0x19fee4[_0x04a9('0x22')]=qs['limit'](_0x5e0843[_0x04a9('0x33')][_0x04a9('0x22')]);_0x19fee4['offset']=qs['offset'](_0x5e0843[_0x04a9('0x33')][_0x04a9('0x20')]);_0x19fee4[_0x04a9('0x3a')]=qs[_0x04a9('0x3b')](_0x5e0843[_0x04a9('0x33')][_0x04a9('0x3b')]);_0x19fee4[_0x04a9('0x3c')]=qs['filters'](_['pick'](_0x5e0843[_0x04a9('0x33')],_0x375076[_0x04a9('0x34')]));_0x19fee4=_[_0x04a9('0x3f')]({},_0x19fee4,_0x5e0843['options']);return _0x51415a[_0x04a9('0x4d')+_[_0x04a9('0x75')](_0x5e0843[_0x04a9('0x33')]['channel'][_0x04a9('0x76')]())+_0x04a9('0x77')](_0x19fee4);})[_0x04a9('0x28')](respondWithResult(_0x37c16c,null))[_0x04a9('0x49')](handleError(_0x37c16c,null));};exports['addQueues']=function(_0x5240d4,_0x18140c,_0x49ad94){return db[_0x04a9('0x2e')][_0x04a9('0x70')]({'where':{'id':_0x5240d4['params']['id']}})[_0x04a9('0x28')](function(_0x9b8625){if(_0x9b8625){if(!_0x5240d4[_0x04a9('0x4b')][_0x04a9('0x71')]||!utils[_0x04a9('0x72')](_0x5240d4[_0x04a9('0x4b')][_0x04a9('0x71')])){throw new db[(_0x04a9('0x59'))]['ValidationError'](_0x04a9('0x74'));}return _0x9b8625[_0x04a9('0x78')+_['capitalize'](_0x5240d4['body'][_0x04a9('0x71')][_0x04a9('0x76')]())+_0x04a9('0x77')](_0x5240d4['body'][_0x04a9('0x79')]);}return null;})['then'](handleEntityNotFound(_0x18140c,null))['then'](respondWithStatusCode(_0x18140c,null))[_0x04a9('0x49')](handleError(_0x18140c,null));};exports[_0x04a9('0x7a')]=function(_0x3ea6f2,_0x5e2c68,_0x32be78){return db[_0x04a9('0x2e')][_0x04a9('0x70')]({'where':{'id':_0x3ea6f2[_0x04a9('0x45')]['id']}})[_0x04a9('0x28')](function(_0x5b4615){if(_0x5b4615){if(!_0x3ea6f2[_0x04a9('0x33')][_0x04a9('0x71')]||!utils[_0x04a9('0x72')](_0x3ea6f2['query'][_0x04a9('0x71')])){throw new db['Sequelize'][(_0x04a9('0x73'))](_0x04a9('0x74'));}return _0x5b4615[_0x04a9('0x7b')+_['capitalize'](_0x3ea6f2[_0x04a9('0x33')]['channel'][_0x04a9('0x76')]())+_0x04a9('0x77')](_0x3ea6f2[_0x04a9('0x33')][_0x04a9('0x79')]);}return null;})['then'](handleEntityNotFound(_0x5e2c68,null))[_0x04a9('0x28')](respondWithStatusCode(_0x5e2c68,null))['catch'](handleError(_0x5e2c68,null));};exports[_0x04a9('0x7c')]=function(_0x19c888,_0x292772){var _0x15e2fd=_[_0x04a9('0x7d')](_0x19c888[_0x04a9('0x4b')][_0x04a9('0x79')])?_0x19c888[_0x04a9('0x4b')][_0x04a9('0x79')]:[_0x19c888[_0x04a9('0x4b')][_0x04a9('0x79')]];var _0xa51081=_0x19c888['params']['id'];return db[_0x04a9('0x2e')][_0x04a9('0x48')]({'where':{'id':_0xa51081}})[_0x04a9('0x28')](handleEntityNotFound(_0x292772,null))['then'](function(_0x2370e8){if(_0x2370e8){var _0x414b30=[_0x04a9('0x7e'),_0x04a9('0x7f'),_0x04a9('0x80'),_0x04a9('0x81'),_0x04a9('0x82'),_0x04a9('0x83'),_0x04a9('0x84')];return db[_0x04a9('0x58')][_0x04a9('0x56')](function(_0x27c989){var _0x57932b=_[_0x04a9('0x2d')](_0x414b30,function(_0x587a9c){var _0x4e836f={'attributes':['id',_0x04a9('0x2b')]};if(_0x587a9c===_0x04a9('0x7e')){_0x4e836f['through']={'attributes':['penalty']};}return _0x2370e8[_0x04a9('0x4d')+_0x587a9c+'Queues'](_0x4e836f)[_0x04a9('0x28')](function(_0x4d6e6d){var _0x254d60=_['map'](_0x4d6e6d,function(_0xc0d659){var _0x3a9492=_[_0x04a9('0x2d')](_0x15e2fd,function(_0x4bfac5){var _0x1dac8a={'where':{'UserId':_0x4bfac5,[_0x587a9c+_0x04a9('0x85')]:_0xc0d659['id']},'transaction':_0x27c989};if(_0x587a9c===_0x04a9('0x7e')){_0x1dac8a[_0x04a9('0x19')]={'penalty':_0xc0d659[_0x04a9('0x86')]['penalty']};}return db['User'+_0x587a9c+_0x04a9('0x87')]['findOrCreate'](_0x1dac8a)['then'](function(){socket[_0x04a9('0x88')]('user'+_0x587a9c+_0x04a9('0x89'),{'UserId':_0x4bfac5,[_0x587a9c+_0x04a9('0x85')]:_0xc0d659['id']});if(_0x587a9c!=='Voice'){return;}return db[_0x04a9('0x8a')][_0x04a9('0x8b')]({'where':{'id':_0x15e2fd,'online':0x1},'attributes':['id',_0x04a9('0x2b'),'online',_0x04a9('0x8c'),_0x04a9('0x8d')],'raw':!![]})[_0x04a9('0x28')](function(_0x360f4c){var _0x245346=_[_0x04a9('0x2d')](_0x360f4c,function(_0x3e77f6){return db['UserVoiceQueueRt'][_0x04a9('0x8e')]({'membername':_0x3e77f6[_0x04a9('0x2b')],'UserId':_0x3e77f6['id'],'queue_name':_0xc0d659['name'],'VoiceQueueId':_0xc0d659['id'],'interface':_['isNil'](_0x3e77f6[_0x04a9('0x8d')])?util[_0x04a9('0x8f')](_0x04a9('0x90'),_0x3e77f6[_0x04a9('0x2b')]):_0x3e77f6['interface'],'paused':_0x3e77f6[_0x04a9('0x8c')]||![],'penalty':_0xc0d659[_0x04a9('0x86')][_0x04a9('0x91')]},{'transaction':_0x27c989});});return Promise['all'](_0x245346);});});});return Promise[_0x04a9('0x92')](_0x3a9492);});return Promise[_0x04a9('0x92')](_0x254d60);})['then'](function(){return db[_0x04a9('0x6d')][_0x04a9('0x70')]({'where':{'teamId':_0xa51081}})['then'](function(_0x3a43f0){if(_0x3a43f0){var _0x776e58=_[_0x04a9('0x2d')](_0x15e2fd,function(_0x418d87){db[_0x04a9('0x6e')][_0x04a9('0x8e')]({'UserId':_0x418d87,'VoicePrefixId':_0x3a43f0[_0x04a9('0x6f')]});});return Promise['all'](_0x776e58);}});});});return Promise[_0x04a9('0x92')](_0x57932b)[_0x04a9('0x28')](function(){return _0x2370e8['addAgents'](_0x15e2fd,{'transaction':_0x27c989})[_0x04a9('0x93')](function(_0x427284){return _0x427284;});});});}})[_0x04a9('0x28')](respondWithResult(_0x292772,null))['catch'](handleError(_0x292772,null));};exports[_0x04a9('0x94')]=function(_0x52af6e,_0x5c839c){var _0x560e2b=_['isArray'](_0x52af6e['query'][_0x04a9('0x79')])?_0x52af6e[_0x04a9('0x33')]['ids']:[_0x52af6e[_0x04a9('0x33')][_0x04a9('0x79')]];var _0x6c0526=_0x52af6e[_0x04a9('0x45')]['id'];return db[_0x04a9('0x2e')][_0x04a9('0x48')]({'where':{'id':_0x6c0526}})[_0x04a9('0x28')](handleEntityNotFound(_0x5c839c,null))['then'](function(_0x25913a){if(_0x25913a){var _0x436608=['Voice',_0x04a9('0x7f'),_0x04a9('0x80'),_0x04a9('0x81'),'Fax','Openchannel',_0x04a9('0x84')];return db[_0x04a9('0x58')][_0x04a9('0x56')](function(_0x599d53){var _0x3fac0c=_[_0x04a9('0x2d')](_0x436608,function(_0x55a6bf){var _0x3f8183={'attributes':['id',_0x04a9('0x2b')]};return _0x25913a[_0x04a9('0x4d')+_0x55a6bf+'Queues'](_0x3f8183)[_0x04a9('0x28')](function(_0x5e8bc8){var _0x4b0731=_[_0x04a9('0x2d')](_0x5e8bc8,function(_0x46098c){return _0x46098c['removeAgents'](_0x560e2b,{'transaction':_0x599d53})[_0x04a9('0x28')](function(){var _0xe1f1fb=_[_0x04a9('0x2d')](_0x560e2b,function(_0x1041a9){socket[_0x04a9('0x88')](_0x04a9('0x4c')+_0x55a6bf+'Queue:remove',{'UserId':Number(_0x1041a9),[_0x55a6bf+_0x04a9('0x85')]:_0x46098c['id']});if(_0x55a6bf!==_0x04a9('0x7e')){return;}return db[_0x04a9('0x95')][_0x04a9('0x55')]({'where':{'VoiceQueueId':_0x46098c['id'],'UserId':_0x1041a9},'transaction':_0x599d53});});return Promise[_0x04a9('0x92')](_0xe1f1fb);});});return Promise[_0x04a9('0x92')](_0x4b0731);});});return Promise[_0x04a9('0x92')](_0x3fac0c)[_0x04a9('0x28')](function(){return _0x25913a[_0x04a9('0x94')](_0x560e2b,{'transaction':_0x599d53});})[_0x04a9('0x28')](function(){return db['TeamVoicePrefix'][_0x04a9('0x70')]({'where':{'teamId':_0x6c0526}})[_0x04a9('0x28')](function(_0x818299){if(_0x818299){var _0x23ab60=_[_0x04a9('0x2d')](_0x560e2b,function(_0x257378){db[_0x04a9('0x6e')][_0x04a9('0x55')]({'where':{'UserId':_0x257378,'VoicePrefixId':_0x818299[_0x04a9('0x6f')]}});});return Promise['all'](_0x23ab60);}});});});}})[_0x04a9('0x28')](respondWithStatusCode(_0x5c839c,null))[_0x04a9('0x49')](handleError(_0x5c839c,null));};exports[_0x04a9('0x96')]=function(_0x15f31c,_0x35d92c,_0x1d371f){var _0x355e75={};var _0xc7a201={};var _0x2fc712;var _0x537316;return db[_0x04a9('0x2e')][_0x04a9('0x70')]({'where':{'id':_0x15f31c[_0x04a9('0x45')]['id']}})['then'](handleEntityNotFound(_0x35d92c,null))[_0x04a9('0x28')](function(_0x30740d){if(_0x30740d){_0x2fc712=_0x30740d;_0xc7a201['model']=_[_0x04a9('0x46')](db[_0x04a9('0x8a')][_0x04a9('0x2f')]);_0xc7a201[_0x04a9('0x33')]=_[_0x04a9('0x46')](_0x15f31c[_0x04a9('0x33')]);_0xc7a201[_0x04a9('0x34')]=_[_0x04a9('0x36')](_0xc7a201[_0x04a9('0x32')],_0xc7a201[_0x04a9('0x33')]);_0x355e75[_0x04a9('0x35')]=_[_0x04a9('0x36')](_0xc7a201[_0x04a9('0x32')],qs[_0x04a9('0x37')](_0x15f31c[_0x04a9('0x33')][_0x04a9('0x37')]));_0x355e75[_0x04a9('0x35')]=_0x355e75[_0x04a9('0x35')][_0x04a9('0x38')]?_0x355e75[_0x04a9('0x35')]:_0xc7a201[_0x04a9('0x32')];_0x355e75['order']=qs[_0x04a9('0x3b')](_0x15f31c[_0x04a9('0x33')][_0x04a9('0x3b')]);_0x355e75[_0x04a9('0x3c')]=qs[_0x04a9('0x34')](_[_0x04a9('0x3d')](_0x15f31c[_0x04a9('0x33')],_0xc7a201[_0x04a9('0x34')]));if(_0x15f31c[_0x04a9('0x33')][_0x04a9('0x3e')]){_0x355e75[_0x04a9('0x3c')]=_['merge'](_0x355e75[_0x04a9('0x3c')],{'$or':_[_0x04a9('0x2d')](_0x355e75[_0x04a9('0x35')],function(_0x369760){var _0x143364={};_0x143364[_0x369760]={'$like':'%'+_0x15f31c[_0x04a9('0x33')][_0x04a9('0x3e')]+'%'};return _0x143364;})});}_0x355e75=_[_0x04a9('0x3f')]({},_0x355e75,_0x15f31c['options']);return _0x2fc712['getAgents'](_0x355e75);}})[_0x04a9('0x28')](function(_0x566953){if(_0x566953){_0x537316=_0x566953['length'];if(!_0x15f31c[_0x04a9('0x33')][_0x04a9('0x39')](_0x04a9('0x97'))){_0x355e75[_0x04a9('0x22')]=qs[_0x04a9('0x22')](_0x15f31c[_0x04a9('0x33')][_0x04a9('0x22')]);_0x355e75[_0x04a9('0x20')]=qs[_0x04a9('0x20')](_0x15f31c[_0x04a9('0x33')][_0x04a9('0x20')]);}return _0x2fc712[_0x04a9('0x96')](_0x355e75);}})[_0x04a9('0x28')](function(_0x5a6bb6){if(_0x5a6bb6){return _0x5a6bb6?{'count':_0x537316,'rows':_0x5a6bb6}:null;}})['then'](respondWithResult(_0x35d92c,null))['catch'](handleError(_0x35d92c,null));}; \ No newline at end of file +var _0xd5a6=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./team.socket','sendStatus','status','json','offset','undefined','limit','count','apply','save','then','error','stack','name','send','map','Team','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','destroy','params','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserChatQueue','FaxQueueId','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','isValidChannel','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','through','penalty','User','Queue:save','QueueId','online','interface','UserVoiceQueueRt','upsert','isNil','format','voicePause','TeamVoiceQueue','all','TeamVoicePrefix','removeAgents','Sms','emit','Queue:remove','getAgents','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','papaparse','ioredis'];(function(_0x1f5c7e,_0x5df39b){var _0x2c7b76=function(_0x3aaef3){while(--_0x3aaef3){_0x1f5c7e['push'](_0x1f5c7e['shift']());}};_0x2c7b76(++_0x5df39b);}(_0xd5a6,0x120));var _0x6d5a=function(_0x46b230,_0x2feb1d){_0x46b230=_0x46b230-0x0;var _0xbf0768=_0xd5a6[_0x46b230];return _0xbf0768;};'use strict';var emlformat=require(_0x6d5a('0x0'));var rimraf=require(_0x6d5a('0x1'));var zipdir=require(_0x6d5a('0x2'));var jsonpatch=require(_0x6d5a('0x3'));var rp=require(_0x6d5a('0x4'));var moment=require(_0x6d5a('0x5'));var BPromise=require(_0x6d5a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6d5a('0x7'));var sox=require(_0x6d5a('0x8'));var csv=require(_0x6d5a('0x9'));var ejs=require(_0x6d5a('0xa'));var fs=require('fs');var fs_extra=require(_0x6d5a('0xb'));var _=require(_0x6d5a('0xc'));var squel=require(_0x6d5a('0xd'));var crypto=require(_0x6d5a('0xe'));var jsforce=require(_0x6d5a('0xf'));var deskjs=require(_0x6d5a('0x10'));var toCsv=require(_0x6d5a('0x9'));var querystring=require(_0x6d5a('0x11'));var Papa=require(_0x6d5a('0x12'));var Redis=require(_0x6d5a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6d5a('0x14'));var as=require(_0x6d5a('0x15'));var hardwareService=require(_0x6d5a('0x16'));var logger=require(_0x6d5a('0x17'))(_0x6d5a('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6d5a('0x19'));var db=require(_0x6d5a('0x1a'))['db'];config['redis']=_[_0x6d5a('0x1b')](config['redis'],{'host':_0x6d5a('0x1c'),'port':0x18eb});var socket=require(_0x6d5a('0x1d'))(new Redis(config[_0x6d5a('0x1e')]));require(_0x6d5a('0x1f'))['register'](socket);function respondWithStatusCode(_0x2bcda1,_0x3d3f21){_0x3d3f21=_0x3d3f21||0xcc;return function(_0x4684cf){if(_0x4684cf){return _0x2bcda1[_0x6d5a('0x20')](_0x3d3f21);}return _0x2bcda1[_0x6d5a('0x21')](_0x3d3f21)['end']();};}function respondWithResult(_0x11d7f6,_0x120f19){_0x120f19=_0x120f19||0xc8;return function(_0x5354f1){if(_0x5354f1){return _0x11d7f6[_0x6d5a('0x21')](_0x120f19)[_0x6d5a('0x22')](_0x5354f1);}};}function respondWithFilteredResult(_0x3ffb08,_0x56c303){return function(_0x4cbc0c){if(_0x4cbc0c){var _0x2cfb17=typeof _0x56c303[_0x6d5a('0x23')]===_0x6d5a('0x24')&&typeof _0x56c303[_0x6d5a('0x25')]===_0x6d5a('0x24');var _0x5a36f7=_0x4cbc0c['count'];var _0x40bce5=_0x2cfb17?0x0:_0x56c303['offset'];var _0x8c3af=_0x2cfb17?_0x4cbc0c[_0x6d5a('0x26')]:_0x56c303[_0x6d5a('0x23')]+_0x56c303[_0x6d5a('0x25')];var _0x3c8d3f;if(_0x8c3af>=_0x5a36f7){_0x8c3af=_0x5a36f7;_0x3c8d3f=0xc8;}else{_0x3c8d3f=0xce;}_0x3ffb08[_0x6d5a('0x21')](_0x3c8d3f);return _0x3ffb08['set']('Content-Range',_0x40bce5+'-'+_0x8c3af+'/'+_0x5a36f7)[_0x6d5a('0x22')](_0x4cbc0c);}return null;};}function patchUpdates(_0x8643e2){return function(_0x244b58){try{jsonpatch[_0x6d5a('0x27')](_0x244b58,_0x8643e2,!![]);}catch(_0x2f66a2){return BPromise['reject'](_0x2f66a2);}return _0x244b58[_0x6d5a('0x28')]();};}function saveUpdates(_0x8a22bd,_0x3595b3){return function(_0x19837a){if(_0x19837a){return _0x19837a['update'](_0x8a22bd)[_0x6d5a('0x29')](function(_0x5970e5){return _0x5970e5;});}return null;};}function handleEntityNotFound(_0x3acc4a,_0x48a3e5){return function(_0x3d028a){if(!_0x3d028a){_0x3acc4a[_0x6d5a('0x20')](0x194);}return _0x3d028a;};}function handleError(_0xd6ae0f,_0x3b7c18){_0x3b7c18=_0x3b7c18||0x1f4;return function(_0x3477f7){logger[_0x6d5a('0x2a')](_0x3477f7[_0x6d5a('0x2b')]);if(_0x3477f7['name']){delete _0x3477f7[_0x6d5a('0x2c')];}_0xd6ae0f[_0x6d5a('0x21')](_0x3b7c18)[_0x6d5a('0x2d')](_0x3477f7);};}exports['index']=function(_0x2f68ed,_0x4ed004){var _0x4bbb7f={},_0x1a21bc={},_0x3f5027={'count':0x0,'rows':[]};var _0x2022c9=_[_0x6d5a('0x2e')](db[_0x6d5a('0x2f')][_0x6d5a('0x30')],function(_0x415c82){return{'name':_0x415c82['fieldName'],'type':_0x415c82[_0x6d5a('0x31')][_0x6d5a('0x32')]};});_0x1a21bc[_0x6d5a('0x33')]=_[_0x6d5a('0x2e')](_0x2022c9,_0x6d5a('0x2c'));_0x1a21bc['query']=_[_0x6d5a('0x34')](_0x2f68ed[_0x6d5a('0x35')]);_0x1a21bc[_0x6d5a('0x36')]=_['intersection'](_0x1a21bc['model'],_0x1a21bc['query']);_0x4bbb7f['attributes']=_[_0x6d5a('0x37')](_0x1a21bc['model'],qs[_0x6d5a('0x38')](_0x2f68ed[_0x6d5a('0x35')][_0x6d5a('0x38')]));_0x4bbb7f[_0x6d5a('0x39')]=_0x4bbb7f[_0x6d5a('0x39')]['length']?_0x4bbb7f[_0x6d5a('0x39')]:_0x1a21bc[_0x6d5a('0x33')];if(!_0x2f68ed[_0x6d5a('0x35')][_0x6d5a('0x3a')]('nolimit')){_0x4bbb7f[_0x6d5a('0x25')]=qs[_0x6d5a('0x25')](_0x2f68ed[_0x6d5a('0x35')][_0x6d5a('0x25')]);_0x4bbb7f['offset']=qs[_0x6d5a('0x23')](_0x2f68ed[_0x6d5a('0x35')][_0x6d5a('0x23')]);}_0x4bbb7f[_0x6d5a('0x3b')]=qs[_0x6d5a('0x3c')](_0x2f68ed[_0x6d5a('0x35')][_0x6d5a('0x3c')]);_0x4bbb7f[_0x6d5a('0x3d')]=qs['filters'](_[_0x6d5a('0x3e')](_0x2f68ed[_0x6d5a('0x35')],_0x1a21bc[_0x6d5a('0x36')]),_0x2022c9);if(_0x2f68ed[_0x6d5a('0x35')][_0x6d5a('0x3f')]){_0x4bbb7f[_0x6d5a('0x3d')]=_[_0x6d5a('0x40')](_0x4bbb7f[_0x6d5a('0x3d')],{'$or':_[_0x6d5a('0x2e')](_0x2022c9,function(_0x45d923){if(_0x45d923[_0x6d5a('0x31')]!==_0x6d5a('0x41')){var _0x52303b={};_0x52303b[_0x45d923[_0x6d5a('0x2c')]]={'$like':'%'+_0x2f68ed[_0x6d5a('0x35')][_0x6d5a('0x3f')]+'%'};return _0x52303b;}})});}_0x4bbb7f=_[_0x6d5a('0x40')]({},_0x4bbb7f,_0x2f68ed[_0x6d5a('0x42')]);var _0x549a24={'where':_0x4bbb7f['where']};return db[_0x6d5a('0x2f')][_0x6d5a('0x26')](_0x549a24)[_0x6d5a('0x29')](function(_0x15c0f9){_0x3f5027[_0x6d5a('0x26')]=_0x15c0f9;if(_0x2f68ed[_0x6d5a('0x35')]['includeAll']){_0x4bbb7f[_0x6d5a('0x43')]=[{'all':!![]}];}return db['Team'][_0x6d5a('0x44')](_0x4bbb7f);})[_0x6d5a('0x29')](function(_0x1da48d){_0x3f5027[_0x6d5a('0x45')]=_0x1da48d;return _0x3f5027;})[_0x6d5a('0x29')](respondWithFilteredResult(_0x4ed004,_0x4bbb7f))[_0x6d5a('0x46')](handleError(_0x4ed004,null));};exports[_0x6d5a('0x47')]=function(_0x455d81,_0x2c8fac){var _0x35de6f={'raw':![],'where':{'id':_0x455d81['params']['id']}},_0x369801={};_0x369801['model']=_['keys'](db['Team'][_0x6d5a('0x30')]);_0x369801[_0x6d5a('0x35')]=_[_0x6d5a('0x34')](_0x455d81[_0x6d5a('0x35')]);_0x369801[_0x6d5a('0x36')]=_[_0x6d5a('0x37')](_0x369801[_0x6d5a('0x33')],_0x369801[_0x6d5a('0x35')]);_0x35de6f[_0x6d5a('0x39')]=_[_0x6d5a('0x37')](_0x369801[_0x6d5a('0x33')],qs[_0x6d5a('0x38')](_0x455d81[_0x6d5a('0x35')]['fields']));_0x35de6f[_0x6d5a('0x39')]=_0x35de6f[_0x6d5a('0x39')][_0x6d5a('0x48')]?_0x35de6f[_0x6d5a('0x39')]:_0x369801[_0x6d5a('0x33')];if(_0x455d81[_0x6d5a('0x35')][_0x6d5a('0x49')]){_0x35de6f[_0x6d5a('0x43')]=[{'all':!![]}];}_0x35de6f=_[_0x6d5a('0x40')]({},_0x35de6f,_0x455d81[_0x6d5a('0x42')]);return db[_0x6d5a('0x2f')][_0x6d5a('0x4a')](_0x35de6f)[_0x6d5a('0x29')](handleEntityNotFound(_0x2c8fac,null))['then'](respondWithResult(_0x2c8fac,null))[_0x6d5a('0x46')](handleError(_0x2c8fac,null));};exports[_0x6d5a('0x4b')]=function(_0x26eede,_0x50b2df){return db[_0x6d5a('0x2f')][_0x6d5a('0x4b')](_0x26eede[_0x6d5a('0x4c')],{})['then'](function(_0x41d0a6){var _0x1a40a0=_0x26eede[_0x6d5a('0x4d')][_0x6d5a('0x4e')]({'plain':!![]});if(!_0x1a40a0)throw new Error(_0x6d5a('0x4f'));if(_0x1a40a0[_0x6d5a('0x50')]===_0x6d5a('0x4d')){var _0x895c8f=_0x41d0a6[_0x6d5a('0x4e')]({'plain':!![]});var _0x3b6907=_0x6d5a('0x51');return db[_0x6d5a('0x52')][_0x6d5a('0x4a')]({'where':{'name':_0x3b6907,'userProfileId':_0x1a40a0[_0x6d5a('0x53')]},'raw':!![]})[_0x6d5a('0x29')](function(_0x3d6481){if(_0x3d6481&&_0x3d6481[_0x6d5a('0x54')]===0x0){return db[_0x6d5a('0x55')]['create']({'name':_0x895c8f[_0x6d5a('0x2c')],'resourceId':_0x895c8f['id'],'type':_0x3d6481[_0x6d5a('0x2c')],'sectionId':_0x3d6481['id']},{})['then'](function(){return _0x41d0a6;});}else{return _0x41d0a6;}})[_0x6d5a('0x46')](function(_0x403522){logger[_0x6d5a('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x403522);throw _0x403522;});}return _0x41d0a6;})[_0x6d5a('0x29')](respondWithResult(_0x50b2df,0xc9))['catch'](handleError(_0x50b2df,null));};exports[_0x6d5a('0x56')]=function(_0x4c9ef1,_0x3d6afa){if(_0x4c9ef1['body']['id']){delete _0x4c9ef1[_0x6d5a('0x4c')]['id'];}return db[_0x6d5a('0x2f')][_0x6d5a('0x4a')]({'where':{'id':_0x4c9ef1['params']['id']}})[_0x6d5a('0x29')](handleEntityNotFound(_0x3d6afa,null))['then'](saveUpdates(_0x4c9ef1['body'],null))[_0x6d5a('0x29')](respondWithResult(_0x3d6afa,null))[_0x6d5a('0x46')](handleError(_0x3d6afa,null));};exports[_0x6d5a('0x57')]=function(_0x54771d,_0x9faca4){var _0x2d8721=_0x54771d[_0x6d5a('0x58')]['id'];var _0x3ecae9=[];return db[_0x6d5a('0x59')][_0x6d5a('0x5a')](function(_0x551380){var _0x594b4f=_0x6d5a('0x5b')+_0x2d8721;return db[_0x6d5a('0x59')][_0x6d5a('0x35')](_0x594b4f,{'type':db[_0x6d5a('0x5c')]['QueryTypes'][_0x6d5a('0x5d')],'raw':!![],'transaction':_0x551380})['then'](function(_0x258009){_0x3ecae9=_['map'](_0x258009,function(_0x20ac28){return Number(_0x20ac28[_0x6d5a('0x5e')]);});})['then'](function(){var _0x4e39fe=_0x6d5a('0x5f')+_0x2d8721;return db['sequelize']['query'](_0x4e39fe,{'type':db[_0x6d5a('0x5c')][_0x6d5a('0x60')][_0x6d5a('0x5d')],'raw':!![],'transaction':_0x551380});})[_0x6d5a('0x29')](function(_0x26534f){var _0x2eb4b9=_[_0x6d5a('0x2e')](_0x26534f,function(_0x208b9e){return Number(_0x208b9e[_0x6d5a('0x61')]);});return db[_0x6d5a('0x62')]['destroy']({'where':{'UserId':{'$in':_0x3ecae9},'VoiceQueueId':{'$in':_0x2eb4b9}},'transaction':_0x551380});})['then'](function(){var _0x47f964=_0x6d5a('0x63')+_0x2d8721;return db[_0x6d5a('0x59')][_0x6d5a('0x35')](_0x47f964,{'type':db[_0x6d5a('0x5c')][_0x6d5a('0x60')][_0x6d5a('0x5d')],'raw':!![],'transaction':_0x551380});})[_0x6d5a('0x29')](function(_0x1c3095){var _0x57cee5=_[_0x6d5a('0x2e')](_0x1c3095,function(_0x2002b9){return Number(_0x2002b9[_0x6d5a('0x64')]);});return db[_0x6d5a('0x65')][_0x6d5a('0x57')]({'where':{'UserId':{'$in':_0x3ecae9},'MailQueueId':{'$in':_0x57cee5}},'transaction':_0x551380});})[_0x6d5a('0x29')](function(){var _0x5ec378='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2d8721;return db[_0x6d5a('0x59')][_0x6d5a('0x35')](_0x5ec378,{'type':db['Sequelize'][_0x6d5a('0x60')][_0x6d5a('0x5d')],'raw':!![],'transaction':_0x551380});})['then'](function(_0x59ff56){var _0x39b873=_['map'](_0x59ff56,function(_0x5d2f5d){return Number(_0x5d2f5d[_0x6d5a('0x66')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x3ecae9},'SmsQueueId':{'$in':_0x39b873}},'transaction':_0x551380});})[_0x6d5a('0x29')](function(){var _0x567660='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2d8721;return db[_0x6d5a('0x59')][_0x6d5a('0x35')](_0x567660,{'type':db[_0x6d5a('0x5c')][_0x6d5a('0x60')][_0x6d5a('0x5d')],'raw':!![],'transaction':_0x551380});})[_0x6d5a('0x29')](function(_0x14956b){var _0x348633=_[_0x6d5a('0x2e')](_0x14956b,function(_0x46237f){return Number(_0x46237f['ChatQueueId']);});return db[_0x6d5a('0x67')]['destroy']({'where':{'UserId':{'$in':_0x3ecae9},'ChatQueueId':{'$in':_0x348633}},'transaction':_0x551380});})[_0x6d5a('0x29')](function(){var _0x596b7d='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2d8721;return db['sequelize'][_0x6d5a('0x35')](_0x596b7d,{'type':db['Sequelize'][_0x6d5a('0x60')]['SELECT'],'raw':!![],'transaction':_0x551380});})['then'](function(_0x7e03ae){var _0x5aa461=_[_0x6d5a('0x2e')](_0x7e03ae,function(_0x431dda){return Number(_0x431dda[_0x6d5a('0x68')]);});return db['UserFaxQueue'][_0x6d5a('0x57')]({'where':{'UserId':{'$in':_0x3ecae9},'FaxQueueId':{'$in':_0x5aa461}},'transaction':_0x551380});})[_0x6d5a('0x29')](function(){var _0x26bf33='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2d8721;return db[_0x6d5a('0x59')]['query'](_0x26bf33,{'type':db[_0x6d5a('0x5c')][_0x6d5a('0x60')][_0x6d5a('0x5d')],'raw':!![],'transaction':_0x551380});})[_0x6d5a('0x29')](function(_0x2e6514){var _0x3d1ff0=_[_0x6d5a('0x2e')](_0x2e6514,function(_0x5167b7){return Number(_0x5167b7[_0x6d5a('0x69')]);});return db[_0x6d5a('0x6a')][_0x6d5a('0x57')]({'where':{'UserId':{'$in':_0x3ecae9},'OpenchannelQueueId':{'$in':_0x3d1ff0}},'transaction':_0x551380});})['then'](function(){var _0x2c9f55=_0x6d5a('0x6b')+_0x2d8721;return db['sequelize'][_0x6d5a('0x35')](_0x2c9f55,{'type':db['Sequelize'][_0x6d5a('0x60')][_0x6d5a('0x5d')],'raw':!![],'transaction':_0x551380});})[_0x6d5a('0x29')](function(_0x32d1a5){var _0x57b47b=_[_0x6d5a('0x2e')](_0x32d1a5,function(_0x2ef56e){return Number(_0x2ef56e[_0x6d5a('0x6c')]);});return db[_0x6d5a('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x3ecae9},'WhatsappQueueId':{'$in':_0x57b47b}},'transaction':_0x551380});})['then'](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x2d8721}});})[_0x6d5a('0x29')](function(_0x5547e0){if(_0x5547e0===null){return;}return db[_0x6d5a('0x6e')][_0x6d5a('0x57')]({'where':{'UserId':{'$in':_0x3ecae9},'VoicePrefixId':_0x5547e0[_0x6d5a('0x6f')]},'transaction':_0x551380});})['then'](function(){return db[_0x6d5a('0x2f')][_0x6d5a('0x57')]({'where':{'id':_0x2d8721},'cascade':!![],'transaction':_0x551380});})['then'](function(_0xbc1a29){if(_0xbc1a29===0x0){_0x9faca4[_0x6d5a('0x20')](0x194);}else{return db[_0x6d5a('0x55')][_0x6d5a('0x57')]({'where':{'type':_0x6d5a('0x51'),'resourceId':_0x2d8721},'cascade':!![],'transaction':_0x551380})[_0x6d5a('0x29')](function(){_0x9faca4['status'](0xcc)[_0x6d5a('0x70')]();});}})[_0x6d5a('0x46')](function(_0x2e4806){_0x9faca4['status'](0x1f4)['send'](_0x2e4806);});});};exports[_0x6d5a('0x71')]=function(_0x162f82,_0x379fa4,_0x233759){return db[_0x6d5a('0x2f')][_0x6d5a('0x72')]({'where':{'id':_0x162f82[_0x6d5a('0x58')]['id']}})[_0x6d5a('0x29')](handleEntityNotFound(_0x379fa4,null))['then'](function(_0x2a0279){if(!_0x162f82[_0x6d5a('0x35')][_0x6d5a('0x73')]||!utils['isValidChannel'](_0x162f82['query'][_0x6d5a('0x73')])){throw new db[(_0x6d5a('0x5c'))][(_0x6d5a('0x74'))](_0x6d5a('0x75'));}var _0x2a8658={};var _0x8c6d00={};_0x8c6d00[_0x6d5a('0x33')]=_['keys'](db[_[_0x6d5a('0x76')](_0x162f82[_0x6d5a('0x35')]['channel'][_0x6d5a('0x77')]())+_0x6d5a('0x78')]['rawAttributes']);_0x8c6d00[_0x6d5a('0x35')]=_['keys'](_0x162f82['query']);_0x8c6d00[_0x6d5a('0x36')]=_[_0x6d5a('0x37')](_0x8c6d00[_0x6d5a('0x33')],_0x8c6d00[_0x6d5a('0x35')]);_0x2a8658[_0x6d5a('0x39')]=_[_0x6d5a('0x37')](_0x8c6d00[_0x6d5a('0x33')],qs['fields'](_0x162f82['query']['fields']));_0x2a8658[_0x6d5a('0x39')]=_0x2a8658[_0x6d5a('0x39')][_0x6d5a('0x48')]?_0x2a8658[_0x6d5a('0x39')]:_0x8c6d00[_0x6d5a('0x33')];_0x2a8658['limit']=qs[_0x6d5a('0x25')](_0x162f82[_0x6d5a('0x35')][_0x6d5a('0x25')]);_0x2a8658['offset']=qs[_0x6d5a('0x23')](_0x162f82['query'][_0x6d5a('0x23')]);_0x2a8658[_0x6d5a('0x3b')]=qs[_0x6d5a('0x3c')](_0x162f82[_0x6d5a('0x35')][_0x6d5a('0x3c')]);_0x2a8658[_0x6d5a('0x3d')]=qs[_0x6d5a('0x36')](_[_0x6d5a('0x3e')](_0x162f82[_0x6d5a('0x35')],_0x8c6d00[_0x6d5a('0x36')]));_0x2a8658=_[_0x6d5a('0x40')]({},_0x2a8658,_0x162f82[_0x6d5a('0x42')]);return _0x2a0279[_0x6d5a('0x4e')+_['capitalize'](_0x162f82[_0x6d5a('0x35')]['channel'][_0x6d5a('0x77')]())+_0x6d5a('0x79')](_0x2a8658);})['then'](respondWithResult(_0x379fa4,null))['catch'](handleError(_0x379fa4,null));};exports[_0x6d5a('0x7a')]=function(_0x110112,_0x4914ec,_0x1a6751){return db['Team']['findOne']({'where':{'id':_0x110112[_0x6d5a('0x58')]['id']}})[_0x6d5a('0x29')](function(_0x214897){if(_0x214897){if(!_0x110112[_0x6d5a('0x4c')][_0x6d5a('0x73')]||!utils['isValidChannel'](_0x110112['body'][_0x6d5a('0x73')])){throw new db[(_0x6d5a('0x5c'))][(_0x6d5a('0x74'))](_0x6d5a('0x75'));}return _0x214897[_0x6d5a('0x7b')+_[_0x6d5a('0x76')](_0x110112['body'][_0x6d5a('0x73')][_0x6d5a('0x77')]())+'Queues'](_0x110112[_0x6d5a('0x4c')][_0x6d5a('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x4914ec,null))[_0x6d5a('0x29')](respondWithStatusCode(_0x4914ec,null))[_0x6d5a('0x46')](handleError(_0x4914ec,null));};exports[_0x6d5a('0x7d')]=function(_0x71d060,_0x25f0bd,_0x1234b0){return db['Team']['findOne']({'where':{'id':_0x71d060[_0x6d5a('0x58')]['id']}})['then'](function(_0x5919b0){if(_0x5919b0){if(!_0x71d060[_0x6d5a('0x35')][_0x6d5a('0x73')]||!utils[_0x6d5a('0x7e')](_0x71d060[_0x6d5a('0x35')][_0x6d5a('0x73')])){throw new db[(_0x6d5a('0x5c'))][(_0x6d5a('0x74'))](_0x6d5a('0x75'));}return _0x5919b0['remove'+_[_0x6d5a('0x76')](_0x71d060[_0x6d5a('0x35')][_0x6d5a('0x73')]['toLowerCase']())+'Queues'](_0x71d060[_0x6d5a('0x35')][_0x6d5a('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x25f0bd,null))[_0x6d5a('0x29')](respondWithStatusCode(_0x25f0bd,null))[_0x6d5a('0x46')](handleError(_0x25f0bd,null));};exports[_0x6d5a('0x7f')]=function(_0x2631c0,_0x8ff822){var _0x46769a=_[_0x6d5a('0x80')](_0x2631c0[_0x6d5a('0x4c')][_0x6d5a('0x7c')])?_0x2631c0['body']['ids']:[_0x2631c0[_0x6d5a('0x4c')][_0x6d5a('0x7c')]];var _0x53fdef=_0x2631c0[_0x6d5a('0x58')]['id'];return db[_0x6d5a('0x2f')][_0x6d5a('0x4a')]({'where':{'id':_0x53fdef}})[_0x6d5a('0x29')](handleEntityNotFound(_0x8ff822,null))[_0x6d5a('0x29')](function(_0x47b28b){if(_0x47b28b){var _0x373c16=[_0x6d5a('0x81'),_0x6d5a('0x82'),_0x6d5a('0x83'),'Sms',_0x6d5a('0x84'),_0x6d5a('0x85'),'Whatsapp'];return db[_0x6d5a('0x59')][_0x6d5a('0x5a')](function(_0x390a6f){var _0x54b8d0=_['map'](_0x373c16,function(_0x5b5cac){var _0x450d2d={'attributes':['id',_0x6d5a('0x2c')]};if(_0x5b5cac===_0x6d5a('0x81')){_0x450d2d[_0x6d5a('0x86')]={'attributes':[_0x6d5a('0x87')]};}return _0x47b28b[_0x6d5a('0x4e')+_0x5b5cac+_0x6d5a('0x79')](_0x450d2d)[_0x6d5a('0x29')](function(_0x9fb51f){var _0x6fe3b2=_[_0x6d5a('0x2e')](_0x9fb51f,function(_0x38ffb7){var _0x10ee6d=_[_0x6d5a('0x2e')](_0x46769a,function(_0x214154){var _0x5bb950={'where':{'UserId':_0x214154,[_0x5b5cac+'QueueId']:_0x38ffb7['id']},'transaction':_0x390a6f};if(_0x5b5cac===_0x6d5a('0x81')){_0x5bb950[_0x6d5a('0x1b')]={'penalty':_0x38ffb7['TeamVoiceQueue'][_0x6d5a('0x87')]};}return db[_0x6d5a('0x88')+_0x5b5cac+_0x6d5a('0x78')]['findOrCreate'](_0x5bb950)[_0x6d5a('0x29')](function(){socket['emit']('user'+_0x5b5cac+_0x6d5a('0x89'),{'UserId':_0x214154,[_0x5b5cac+_0x6d5a('0x8a')]:_0x38ffb7['id']});if(_0x5b5cac!==_0x6d5a('0x81')){return;}return db[_0x6d5a('0x88')]['findAll']({'where':{'id':_0x46769a,'online':0x1},'attributes':['id','name',_0x6d5a('0x8b'),'voicePause',_0x6d5a('0x8c')],'raw':!![]})['then'](function(_0x33148c){var _0x264209=_[_0x6d5a('0x2e')](_0x33148c,function(_0x15d508){return db[_0x6d5a('0x8d')][_0x6d5a('0x8e')]({'membername':_0x15d508[_0x6d5a('0x2c')],'UserId':_0x15d508['id'],'queue_name':_0x38ffb7[_0x6d5a('0x2c')],'VoiceQueueId':_0x38ffb7['id'],'interface':_[_0x6d5a('0x8f')](_0x15d508['interface'])?util[_0x6d5a('0x90')]('SIP/%s',_0x15d508[_0x6d5a('0x2c')]):_0x15d508[_0x6d5a('0x8c')],'paused':_0x15d508[_0x6d5a('0x91')]||![],'penalty':_0x38ffb7[_0x6d5a('0x92')][_0x6d5a('0x87')]},{'transaction':_0x390a6f});});return Promise[_0x6d5a('0x93')](_0x264209);});});});return Promise['all'](_0x10ee6d);});return Promise[_0x6d5a('0x93')](_0x6fe3b2);})[_0x6d5a('0x29')](function(){return db[_0x6d5a('0x94')][_0x6d5a('0x72')]({'where':{'teamId':_0x53fdef}})['then'](function(_0x205a0e){if(_0x205a0e){var _0x1ab9c4=_[_0x6d5a('0x2e')](_0x46769a,function(_0x2dca4e){db['UserVoicePrefix'][_0x6d5a('0x8e')]({'UserId':_0x2dca4e,'VoicePrefixId':_0x205a0e['VoicePrefixId']});});return Promise[_0x6d5a('0x93')](_0x1ab9c4);}});});});return Promise[_0x6d5a('0x93')](_0x54b8d0)[_0x6d5a('0x29')](function(){return _0x47b28b[_0x6d5a('0x7f')](_0x46769a,{'transaction':_0x390a6f})['spread'](function(_0x222f01){return _0x222f01;});});});}})[_0x6d5a('0x29')](respondWithResult(_0x8ff822,null))['catch'](handleError(_0x8ff822,null));};exports[_0x6d5a('0x95')]=function(_0x32b7ed,_0x1c7c3e){var _0x387ac8=_[_0x6d5a('0x80')](_0x32b7ed[_0x6d5a('0x35')][_0x6d5a('0x7c')])?_0x32b7ed[_0x6d5a('0x35')][_0x6d5a('0x7c')]:[_0x32b7ed['query'][_0x6d5a('0x7c')]];var _0x2f1718=_0x32b7ed[_0x6d5a('0x58')]['id'];return db[_0x6d5a('0x2f')]['find']({'where':{'id':_0x2f1718}})[_0x6d5a('0x29')](handleEntityNotFound(_0x1c7c3e,null))[_0x6d5a('0x29')](function(_0x3a6dd8){if(_0x3a6dd8){var _0x4e61eb=['Voice','Chat',_0x6d5a('0x83'),_0x6d5a('0x96'),_0x6d5a('0x84'),_0x6d5a('0x85'),'Whatsapp'];return db['sequelize'][_0x6d5a('0x5a')](function(_0x197fad){var _0x51c503=_['map'](_0x4e61eb,function(_0x2e37ab){var _0x48b09c={'attributes':['id','name']};return _0x3a6dd8[_0x6d5a('0x4e')+_0x2e37ab+'Queues'](_0x48b09c)[_0x6d5a('0x29')](function(_0x593513){var _0x18d970=_[_0x6d5a('0x2e')](_0x593513,function(_0x494a23){return _0x494a23[_0x6d5a('0x95')](_0x387ac8,{'transaction':_0x197fad})[_0x6d5a('0x29')](function(){var _0x4e17b1=_[_0x6d5a('0x2e')](_0x387ac8,function(_0x36a731){socket[_0x6d5a('0x97')](_0x6d5a('0x4d')+_0x2e37ab+_0x6d5a('0x98'),{'UserId':Number(_0x36a731),[_0x2e37ab+_0x6d5a('0x8a')]:_0x494a23['id']});if(_0x2e37ab!==_0x6d5a('0x81')){return;}return db[_0x6d5a('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x494a23['id'],'UserId':_0x36a731},'transaction':_0x197fad});});return Promise[_0x6d5a('0x93')](_0x4e17b1);});});return Promise[_0x6d5a('0x93')](_0x18d970);});});return Promise['all'](_0x51c503)[_0x6d5a('0x29')](function(){return _0x3a6dd8[_0x6d5a('0x95')](_0x387ac8,{'transaction':_0x197fad});})[_0x6d5a('0x29')](function(){return db[_0x6d5a('0x94')][_0x6d5a('0x72')]({'where':{'teamId':_0x2f1718}})[_0x6d5a('0x29')](function(_0x5de73d){if(_0x5de73d){var _0x4a666f=_[_0x6d5a('0x2e')](_0x387ac8,function(_0xfd3f38){db['UserVoicePrefix'][_0x6d5a('0x57')]({'where':{'UserId':_0xfd3f38,'VoicePrefixId':_0x5de73d[_0x6d5a('0x6f')]}});});return Promise['all'](_0x4a666f);}});});});}})[_0x6d5a('0x29')](respondWithStatusCode(_0x1c7c3e,null))[_0x6d5a('0x46')](handleError(_0x1c7c3e,null));};exports[_0x6d5a('0x99')]=function(_0x51e7e1,_0x118535,_0x26b963){var _0x5b95aa={};var _0x33c2ce={};var _0x15aec6;var _0x505a58;return db[_0x6d5a('0x2f')][_0x6d5a('0x72')]({'where':{'id':_0x51e7e1[_0x6d5a('0x58')]['id']}})[_0x6d5a('0x29')](handleEntityNotFound(_0x118535,null))[_0x6d5a('0x29')](function(_0x2cb0e3){if(_0x2cb0e3){_0x15aec6=_0x2cb0e3;_0x33c2ce[_0x6d5a('0x33')]=_[_0x6d5a('0x34')](db[_0x6d5a('0x88')][_0x6d5a('0x30')]);_0x33c2ce['query']=_[_0x6d5a('0x34')](_0x51e7e1[_0x6d5a('0x35')]);_0x33c2ce[_0x6d5a('0x36')]=_['intersection'](_0x33c2ce['model'],_0x33c2ce[_0x6d5a('0x35')]);_0x5b95aa[_0x6d5a('0x39')]=_[_0x6d5a('0x37')](_0x33c2ce[_0x6d5a('0x33')],qs[_0x6d5a('0x38')](_0x51e7e1[_0x6d5a('0x35')]['fields']));_0x5b95aa[_0x6d5a('0x39')]=_0x5b95aa[_0x6d5a('0x39')][_0x6d5a('0x48')]?_0x5b95aa['attributes']:_0x33c2ce['model'];_0x5b95aa[_0x6d5a('0x3b')]=qs[_0x6d5a('0x3c')](_0x51e7e1[_0x6d5a('0x35')]['sort']);_0x5b95aa[_0x6d5a('0x3d')]=qs[_0x6d5a('0x36')](_[_0x6d5a('0x3e')](_0x51e7e1[_0x6d5a('0x35')],_0x33c2ce[_0x6d5a('0x36')]));if(_0x51e7e1[_0x6d5a('0x35')][_0x6d5a('0x3f')]){_0x5b95aa[_0x6d5a('0x3d')]=_[_0x6d5a('0x40')](_0x5b95aa[_0x6d5a('0x3d')],{'$or':_[_0x6d5a('0x2e')](_0x5b95aa[_0x6d5a('0x39')],function(_0x325ed9){var _0x630f83={};_0x630f83[_0x325ed9]={'$like':'%'+_0x51e7e1[_0x6d5a('0x35')][_0x6d5a('0x3f')]+'%'};return _0x630f83;})});}_0x5b95aa=_[_0x6d5a('0x40')]({},_0x5b95aa,_0x51e7e1['options']);return _0x15aec6[_0x6d5a('0x99')](_0x5b95aa);}})[_0x6d5a('0x29')](function(_0x33d567){if(_0x33d567){_0x505a58=_0x33d567[_0x6d5a('0x48')];if(!_0x51e7e1[_0x6d5a('0x35')][_0x6d5a('0x3a')]('nolimit')){_0x5b95aa[_0x6d5a('0x25')]=qs[_0x6d5a('0x25')](_0x51e7e1['query'][_0x6d5a('0x25')]);_0x5b95aa[_0x6d5a('0x23')]=qs[_0x6d5a('0x23')](_0x51e7e1['query'][_0x6d5a('0x23')]);}return _0x15aec6[_0x6d5a('0x99')](_0x5b95aa);}})[_0x6d5a('0x29')](function(_0x10ebe3){if(_0x10ebe3){return _0x10ebe3?{'count':_0x505a58,'rows':_0x10ebe3}:null;}})['then'](respondWithResult(_0x118535,null))['catch'](handleError(_0x118535,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 796a6eb..d5c1a22 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 _0xadc3=['hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','emit'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0xadc3,0x83));var _0x3adc=function(_0xbc64e0,_0x477e96){_0xbc64e0=_0xbc64e0-0x0;var _0x264e16=_0xadc3[_0xbc64e0];return _0x264e16;};'use strict';var EventEmitter=require(_0x3adc('0x0'));var Team=require(_0x3adc('0x1'))['db'][_0x3adc('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x3adc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x14be96){return function(_0x117d58,_0x18488a,_0x2b4397){TeamEvents[_0x3adc('0x4')](_0x14be96+':'+_0x117d58['id'],_0x117d58);TeamEvents[_0x3adc('0x4')](_0x14be96,_0x117d58);_0x2b4397(null);};}for(var e in events){if(events[_0x3adc('0x5')](e)){var event=events[e];Team[_0x3adc('0x6')](e,emitEvent(event));}}module[_0x3adc('0x7')]=TeamEvents; \ No newline at end of file +var _0x282b=['../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x38f777,_0xa3598b){var _0x4b6778=function(_0x441e68){while(--_0x441e68){_0x38f777['push'](_0x38f777['shift']());}};_0x4b6778(++_0xa3598b);}(_0x282b,0x180));var _0xb282=function(_0xd85b65,_0x4a51db){_0xd85b65=_0xd85b65-0x0;var _0x2de517=_0x282b[_0xd85b65];return _0x2de517;};'use strict';var EventEmitter=require(_0xb282('0x0'));var Team=require(_0xb282('0x1'))['db'][_0xb282('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb282('0x3')](0x0);var events={'afterCreate':_0xb282('0x4'),'afterUpdate':_0xb282('0x5'),'afterDestroy':_0xb282('0x6')};function emitEvent(_0x1eb696){return function(_0x21551a,_0x21c8bf,_0x431479){TeamEvents[_0xb282('0x7')](_0x1eb696+':'+_0x21551a['id'],_0x21551a);TeamEvents[_0xb282('0x7')](_0x1eb696,_0x21551a);_0x431479(null);};}for(var e in events){if(events[_0xb282('0x8')](e)){var event=events[e];Team[_0xb282('0x9')](e,emitEvent(event));}}module[_0xb282('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index fd5cdb1..4d01be1 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 _0xe3db=['teams','Chat','Fax','Mail','Openchannel','Sms','catch','lodash','./team.attributes','get','Queues','then','map','setDataValue','exports','define','Team'];(function(_0x503c6,_0x186ff5){var _0xff6205=function(_0xcb0061){while(--_0xcb0061){_0x503c6['push'](_0x503c6['shift']());}};_0xff6205(++_0x186ff5);}(_0xe3db,0x139));var _0xbe3d=function(_0xf771d7,_0x5e0b50){_0xf771d7=_0xf771d7-0x0;var _0x4dd1c8=_0xe3db[_0xf771d7];return _0x4dd1c8;};'use strict';var _=require(_0xbe3d('0x0'));var attributes=require(_0xbe3d('0x1'));function getQueuesByChannel(_0x1b5738,_0x4098bc){var _0x1301db=_0xbe3d('0x2')+_0x4098bc+_0xbe3d('0x3');return _0x1b5738[_0x1301db]()[_0xbe3d('0x4')](function(_0x30fa6f){return _[_0xbe3d('0x5')](_0x30fa6f,function(_0x32f2a4){_0x32f2a4[_0xbe3d('0x6')]('channel',_0x4098bc);return _0x32f2a4;});})['catch'](function(_0x1250db){throw _0x1250db;});}module[_0xbe3d('0x7')]=function(_0x134f79){return _0x134f79[_0xbe3d('0x8')](_0xbe3d('0x9'),attributes,{'tableName':_0xbe3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x183617=this;var _0x1ea8fe=[_0xbe3d('0xb'),_0xbe3d('0xc'),_0xbe3d('0xd'),_0xbe3d('0xe'),_0xbe3d('0xf'),'Voice','Whatsapp'];return Promise['resolve']()[_0xbe3d('0x4')](function(){var _0x2e07bc=_[_0xbe3d('0x5')](_0x1ea8fe,function(_0x1ede94){return getQueuesByChannel(_0x183617,_0x1ede94);});return Promise['all'](_0x2e07bc);})[_0xbe3d('0x10')](function(_0x554060){throw _0x554060;});}}});}; \ No newline at end of file +var _0x0d33=['setDataValue','channel','exports','define','Team','teams','Chat','Fax','Openchannel','Sms','Voice','all','catch','lodash','./team.attributes','then','map'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0x0d33,0x84));var _0x30d3=function(_0x2b216b,_0xdce1bf){_0x2b216b=_0x2b216b-0x0;var _0x15d243=_0x0d33[_0x2b216b];return _0x15d243;};'use strict';var _=require(_0x30d3('0x0'));var attributes=require(_0x30d3('0x1'));function getQueuesByChannel(_0x5e2aad,_0x15e202){var _0x5ceafa='get'+_0x15e202+'Queues';return _0x5e2aad[_0x5ceafa]()[_0x30d3('0x2')](function(_0x3937bc){return _[_0x30d3('0x3')](_0x3937bc,function(_0x1c851a){_0x1c851a[_0x30d3('0x4')](_0x30d3('0x5'),_0x15e202);return _0x1c851a;});})['catch'](function(_0x3d8aa3){throw _0x3d8aa3;});}module[_0x30d3('0x6')]=function(_0x53a37f){return _0x53a37f[_0x30d3('0x7')](_0x30d3('0x8'),attributes,{'tableName':_0x30d3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x291b40=this;var _0x28d754=[_0x30d3('0xa'),_0x30d3('0xb'),'Mail',_0x30d3('0xc'),_0x30d3('0xd'),_0x30d3('0xe'),'Whatsapp'];return Promise['resolve']()[_0x30d3('0x2')](function(){var _0x2ecdfd=_[_0x30d3('0x3')](_0x28d754,function(_0x3c541f){return getQueuesByChannel(_0x291b40,_0x3c541f);});return Promise[_0x30d3('0xf')](_0x2ecdfd);})[_0x30d3('0x10')](function(_0x1b0882){throw _0x1b0882;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 3b807c7..81cdb4e 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 _0xd4b2=['then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','redis','socket.io-emitter','./team.socket','register','request'];(function(_0x50c290,_0x24101b){var _0x227ef2=function(_0x4e6f1c){while(--_0x4e6f1c){_0x50c290['push'](_0x50c290['shift']());}};_0x227ef2(++_0x24101b);}(_0xd4b2,0x95));var _0x2d4b=function(_0x21f934,_0x4d0bc5){_0x21f934=_0x21f934-0x0;var _0x30dac2=_0xd4b2[_0x21f934];return _0x30dac2;};'use strict';var _=require(_0x2d4b('0x0'));var util=require(_0x2d4b('0x1'));var moment=require(_0x2d4b('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d4b('0x4'))['db'];var utils=require(_0x2d4b('0x5'));var logger=require(_0x2d4b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2d4b('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2d4b('0x8'))(new Redis(config[_0x2d4b('0x7')]));require(_0x2d4b('0x9'))[_0x2d4b('0xa')](socket);function respondWithRpcPromise(_0x21ed91,_0x42646f,_0xfd0a9a){return new BPromise(function(_0x4dcff8,_0x448668){return client[_0x2d4b('0xb')](_0x21ed91,_0xfd0a9a)[_0x2d4b('0xc')](function(_0x3c61c4){logger[_0x2d4b('0xd')](_0x2d4b('0xe'),_0x42646f,_0x2d4b('0xf'));logger[_0x2d4b('0x10')](_0x2d4b('0x11'),_0x42646f,_0x2d4b('0xf'),JSON[_0x2d4b('0x12')](_0x3c61c4));if(_0x3c61c4[_0x2d4b('0x13')]){if(_0x3c61c4[_0x2d4b('0x13')][_0x2d4b('0x14')]===0x1f4){logger[_0x2d4b('0x13')](_0x2d4b('0xe'),_0x42646f,_0x3c61c4[_0x2d4b('0x13')][_0x2d4b('0x15')]);return _0x448668(_0x3c61c4['error'][_0x2d4b('0x15')]);}logger[_0x2d4b('0x13')](_0x2d4b('0xe'),_0x42646f,_0x3c61c4[_0x2d4b('0x13')][_0x2d4b('0x15')]);return _0x4dcff8(_0x3c61c4[_0x2d4b('0x13')][_0x2d4b('0x15')]);}else{logger['info'](_0x2d4b('0xe'),_0x42646f,_0x2d4b('0xf'));_0x4dcff8(_0x3c61c4[_0x2d4b('0x16')][_0x2d4b('0x15')]);}})['catch'](function(_0x4a7872){logger[_0x2d4b('0x13')](_0x2d4b('0xe'),_0x42646f,_0x4a7872);_0x448668(_0x4a7872);});});} \ No newline at end of file +var _0x240d=['register','request','then','info','request\x20sent','debug','stringify','error','code','Team,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket'];(function(_0x3ff923,_0x235056){var _0xb6f30=function(_0x428dd0){while(--_0x428dd0){_0x3ff923['push'](_0x3ff923['shift']());}};_0xb6f30(++_0x235056);}(_0x240d,0xa2));var _0xd240=function(_0xf77d55,_0xe5d480){_0xf77d55=_0xf77d55-0x0;var _0x45a265=_0x240d[_0xf77d55];return _0x45a265;};'use strict';var _=require(_0xd240('0x0'));var util=require(_0xd240('0x1'));var moment=require(_0xd240('0x2'));var BPromise=require(_0xd240('0x3'));var rs=require(_0xd240('0x4'));var fs=require('fs');var Redis=require(_0xd240('0x5'));var db=require(_0xd240('0x6'))['db'];var utils=require(_0xd240('0x7'));var logger=require(_0xd240('0x8'))('rpc');var config=require(_0xd240('0x9'));var jayson=require(_0xd240('0xa'));var client=jayson[_0xd240('0xb')][_0xd240('0xc')]({'port':0x232a});config[_0xd240('0xd')]=_[_0xd240('0xe')](config[_0xd240('0xd')],{'host':_0xd240('0xf'),'port':0x18eb});var socket=require(_0xd240('0x10'))(new Redis(config[_0xd240('0xd')]));require(_0xd240('0x11'))[_0xd240('0x12')](socket);function respondWithRpcPromise(_0x85e5fb,_0x184cd4,_0xb54e90){return new BPromise(function(_0x4eb088,_0x2a8ade){return client[_0xd240('0x13')](_0x85e5fb,_0xb54e90)[_0xd240('0x14')](function(_0x5d9c9f){logger[_0xd240('0x15')]('Team,\x20%s,\x20%s',_0x184cd4,_0xd240('0x16'));logger[_0xd240('0x17')]('Team,\x20%s,\x20%s,\x20%s',_0x184cd4,_0xd240('0x16'),JSON[_0xd240('0x18')](_0x5d9c9f));if(_0x5d9c9f['error']){if(_0x5d9c9f[_0xd240('0x19')][_0xd240('0x1a')]===0x1f4){logger[_0xd240('0x19')](_0xd240('0x1b'),_0x184cd4,_0x5d9c9f['error']['message']);return _0x2a8ade(_0x5d9c9f[_0xd240('0x19')][_0xd240('0x1c')]);}logger[_0xd240('0x19')](_0xd240('0x1b'),_0x184cd4,_0x5d9c9f['error'][_0xd240('0x1c')]);return _0x4eb088(_0x5d9c9f[_0xd240('0x19')][_0xd240('0x1c')]);}else{logger[_0xd240('0x15')](_0xd240('0x1b'),_0x184cd4,'request\x20sent');_0x4eb088(_0x5d9c9f[_0xd240('0x1d')][_0xd240('0x1c')]);}})['catch'](function(_0x2ee0c8){logger[_0xd240('0x19')]('Team,\x20%s,\x20%s',_0x184cd4,_0x2ee0c8);_0x2a8ade(_0x2ee0c8);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index cdd164d..e64bb2e 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 _0x6085=['register','./team.events','save','update','emit','removeListener'];(function(_0x563169,_0x10d4cb){var _0x5612b8=function(_0x1b0acb){while(--_0x1b0acb){_0x563169['push'](_0x563169['shift']());}};_0x5612b8(++_0x10d4cb);}(_0x6085,0x15d));var _0x5608=function(_0x25d5d8,_0x4f5bb0){_0x25d5d8=_0x25d5d8-0x0;var _0x2afb75=_0x6085[_0x25d5d8];return _0x2afb75;};'use strict';var TeamEvents=require(_0x5608('0x0'));var events=[_0x5608('0x1'),'remove',_0x5608('0x2')];function createListener(_0x5b9809,_0x4c71a3){return function(_0x4e7187){_0x4c71a3[_0x5608('0x3')](_0x5b9809,_0x4e7187);};}function removeListener(_0x166d29,_0x4bf72f){return function(){TeamEvents[_0x5608('0x4')](_0x166d29,_0x4bf72f);};}exports[_0x5608('0x5')]=function(_0x4dae1f){for(var _0x72b6a5=0x0,_0x3e5a94=events['length'];_0x72b6a5<_0x3e5a94;_0x72b6a5++){var _0x1a25f2=events[_0x72b6a5];var _0x322c9b=createListener('team:'+_0x1a25f2,_0x4dae1f);TeamEvents['on'](_0x1a25f2,_0x322c9b);}}; \ No newline at end of file +var _0x80db=['team:','./team.events','save','update','emit','removeListener','register'];(function(_0x26ff26,_0x5f3ed1){var _0x52f904=function(_0x40aa12){while(--_0x40aa12){_0x26ff26['push'](_0x26ff26['shift']());}};_0x52f904(++_0x5f3ed1);}(_0x80db,0x174));var _0xb80d=function(_0x477fb2,_0x404fb6){_0x477fb2=_0x477fb2-0x0;var _0x589040=_0x80db[_0x477fb2];return _0x589040;};'use strict';var TeamEvents=require(_0xb80d('0x0'));var events=[_0xb80d('0x1'),'remove',_0xb80d('0x2')];function createListener(_0x470302,_0x497be0){return function(_0x2ed1ea){_0x497be0[_0xb80d('0x3')](_0x470302,_0x2ed1ea);};}function removeListener(_0x33ebd2,_0x2c2fda){return function(){TeamEvents[_0xb80d('0x4')](_0x33ebd2,_0x2c2fda);};}exports[_0xb80d('0x5')]=function(_0x44e212){for(var _0x2ad3df=0x0,_0x40bd8a=events['length'];_0x2ad3df<_0x40bd8a;_0x2ad3df++){var _0x6d08f8=events[_0x2ad3df];var _0x26a38a=createListener(_0xb80d('0x6')+_0x6d08f8,_0x44e212);TeamEvents['on'](_0x6d08f8,_0x26a38a);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 4758de1..504afc8 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 _0x2116=['INTEGER','exports'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x2116,0x67));var _0x6211=function(_0x12d917,_0x59ddd4){_0x12d917=_0x12d917-0x0;var _0x576d1a=_0x2116[_0x12d917];return _0x576d1a;};'use strict';var Sequelize=require('sequelize');module[_0x6211('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x6211('0x1')]}}; \ No newline at end of file +var _0xbf1a=['INTEGER','sequelize','exports'];(function(_0x1673b0,_0x202793){var _0x584f60=function(_0x26a323){while(--_0x26a323){_0x1673b0['push'](_0x1673b0['shift']());}};_0x584f60(++_0x202793);}(_0xbf1a,0x7c));var _0xabf1=function(_0x25aa87,_0x35e92c){_0x25aa87=_0x25aa87-0x0;var _0x1a79c6=_0xbf1a[_0x25aa87];return _0x1a79c6;};'use strict';var Sequelize=require(_0xabf1('0x0'));module[_0xabf1('0x1')]={'TeamId':{'type':Sequelize[_0xabf1('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xabf1('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 1ec4b22..2ca1eed 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 _0x4f9b=['team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','TeamVoicePrefix'];(function(_0x332be0,_0x3eed2f){var _0x55ad93=function(_0x2805ce){while(--_0x2805ce){_0x332be0['push'](_0x332be0['shift']());}};_0x55ad93(++_0x3eed2f);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x20d2a0,_0x13bb4f){_0x20d2a0=_0x20d2a0-0x0;var _0x3849c6=_0x4f9b[_0x20d2a0];return _0x3849c6;};'use strict';var _=require(_0xb4f9('0x0'));var util=require(_0xb4f9('0x1'));var logger=require(_0xb4f9('0x2'))(_0xb4f9('0x3'));var moment=require(_0xb4f9('0x4'));var BPromise=require(_0xb4f9('0x5'));var rp=require(_0xb4f9('0x6'));var fs=require('fs');var path=require(_0xb4f9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0xb4f9('0x8')]=function(_0x38c813,_0x2fa71b){return _0x38c813[_0xb4f9('0x9')](_0xb4f9('0xa'),attributes,{'tableName':_0xb4f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3870=['TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3870,0x146));var _0x0387=function(_0x3772f6,_0x5b8d1b){_0x3772f6=_0x3772f6-0x0;var _0x38dc11=_0x3870[_0x3772f6];return _0x38dc11;};'use strict';var _=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var logger=require(_0x0387('0x2'))('api');var moment=require(_0x0387('0x3'));var BPromise=require('bluebird');var rp=require(_0x0387('0x4'));var fs=require('fs');var path=require(_0x0387('0x5'));var rimraf=require('rimraf');var config=require(_0x0387('0x6'));var attributes=require(_0x0387('0x7'));module[_0x0387('0x8')]=function(_0x59294e,_0x18976e){return _0x59294e[_0x0387('0x9')](_0x0387('0xa'),attributes,{'tableName':_0x0387('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 22f1ac7..82f6d55 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x531722,_0x161aa9){var _0x3f1769=function(_0x44e0d8){while(--_0x44e0d8){_0x531722['push'](_0x531722['shift']());}};_0x3f1769(++_0x161aa9);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x16ad9c,_0x5a7883){var _0x403295=function(_0x1968db){while(--_0x1968db){_0x16ad9c['push'](_0x16ad9c['shift']());}};_0x403295(++_0x5a7883);}(_0x70e0,0x17b));var _0x070e=function(_0x48d07a,_0x1e8d22){_0x48d07a=_0x48d07a-0x0;var _0x576038=_0x70e0[_0x48d07a];return _0x576038;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 14154aa..9b48ce0 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 _0xd51a=['exports','INTEGER','sequelize'];(function(_0x157de3,_0x431a79){var _0x38f1a9=function(_0x1bf497){while(--_0x1bf497){_0x157de3['push'](_0x157de3['shift']());}};_0x38f1a9(++_0x431a79);}(_0xd51a,0x1c1));var _0xad51=function(_0x42d06a,_0x131189){_0x42d06a=_0x42d06a-0x0;var _0x53c1cc=_0xd51a[_0x42d06a];return _0x53c1cc;};'use strict';var Sequelize=require(_0xad51('0x0'));module[_0xad51('0x1')]={'penalty':{'type':Sequelize[_0xad51('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b82=['exports','INTEGER','sequelize'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x2b82,0x11f));var _0x22b8=function(_0x57cc3a,_0x2033fa){_0x57cc3a=_0x57cc3a-0x0;var _0x4c8e58=_0x2b82[_0x57cc3a];return _0x4c8e58;};'use strict';var Sequelize=require(_0x22b8('0x0'));module[_0x22b8('0x1')]={'penalty':{'type':Sequelize[_0x22b8('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 82665b7..e3f6e76 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 _0x5d70=['api','moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','team_has_voice_queues','lodash','util'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x5d70,0x8d));var _0x05d7=function(_0x33e78c,_0x19149f){_0x33e78c=_0x33e78c-0x0;var _0x1d80af=_0x5d70[_0x33e78c];return _0x1d80af;};'use strict';var _=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var logger=require('../../config/logger')(_0x05d7('0x2'));var moment=require(_0x05d7('0x3'));var BPromise=require(_0x05d7('0x4'));var rp=require(_0x05d7('0x5'));var fs=require('fs');var path=require(_0x05d7('0x6'));var rimraf=require(_0x05d7('0x7'));var config=require('../../config/environment');var attributes=require(_0x05d7('0x8'));module[_0x05d7('0x9')]=function(_0x416de3,_0x2fe205){return _0x416de3['define']('TeamVoiceQueue',attributes,{'tableName':_0x05d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c4b=['rimraf','../../config/environment','define','TeamVoiceQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5350ec,_0x316fd1){var _0x47da97=function(_0x213cae){while(--_0x213cae){_0x5350ec['push'](_0x5350ec['shift']());}};_0x47da97(++_0x316fd1);}(_0x6c4b,0x93));var _0xb6c4=function(_0x1cfca7,_0x5b73b4){_0x1cfca7=_0x1cfca7-0x0;var _0x3bf2fb=_0x6c4b[_0x1cfca7];return _0x3bf2fb;};'use strict';var _=require(_0xb6c4('0x0'));var util=require(_0xb6c4('0x1'));var logger=require(_0xb6c4('0x2'))('api');var moment=require(_0xb6c4('0x3'));var BPromise=require(_0xb6c4('0x4'));var rp=require(_0xb6c4('0x5'));var fs=require('fs');var path=require(_0xb6c4('0x6'));var rimraf=require(_0xb6c4('0x7'));var config=require(_0xb6c4('0x8'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x1f7abc,_0x5a290a){return _0x1f7abc[_0xb6c4('0x9')](_0xb6c4('0xa'),attributes,{'tableName':'team_has_voice_queues','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 19dc488..088d377 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 _0xf2fa=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x50c668,_0x115007){var _0x29effc=function(_0x4a8690){while(--_0x4a8690){_0x50c668['push'](_0x50c668['shift']());}};_0x29effc(++_0x115007);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaf2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaf2f('0x1'));var rs=require(_0xaf2f('0x2'));var fs=require('fs');var Redis=require(_0xaf2f('0x3'));var db=require(_0xaf2f('0x4'))['db'];var utils=require(_0xaf2f('0x5'));var logger=require(_0xaf2f('0x6'))(_0xaf2f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45e164,_0x2dfba7,_0x1c3cfa){return new BPromise(function(_0x312d3b,_0x2b65f2){return client['request'](_0x45e164,_0x1c3cfa)['then'](function(_0x50c838){logger[_0xaf2f('0x9')](_0xaf2f('0xa'),_0x2dfba7,_0xaf2f('0xb'));logger[_0xaf2f('0xc')](_0xaf2f('0xd'),_0x2dfba7,_0xaf2f('0xb'),JSON[_0xaf2f('0xe')](_0x50c838));if(_0x50c838[_0xaf2f('0xf')]){if(_0x50c838['error'][_0xaf2f('0x10')]===0x1f4){logger[_0xaf2f('0xf')](_0xaf2f('0xa'),_0x2dfba7,_0x50c838['error']['message']);return _0x2b65f2(_0x50c838['error'][_0xaf2f('0x11')]);}logger[_0xaf2f('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2dfba7,_0x50c838[_0xaf2f('0xf')][_0xaf2f('0x11')]);return _0x312d3b(_0x50c838['error'][_0xaf2f('0x11')]);}else{logger['info'](_0xaf2f('0xa'),_0x2dfba7,_0xaf2f('0xb'));_0x312d3b(_0x50c838[_0xaf2f('0x12')][_0xaf2f('0x11')]);}})[_0xaf2f('0x13')](function(_0x32e829){logger[_0xaf2f('0xf')](_0xaf2f('0xa'),_0x2dfba7,_0x32e829);_0x2b65f2(_0x32e829);});});} \ No newline at end of file +var _0xdeb3=['../../config/utils','../../config/logger','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3a2744,_0xb87152){var _0x374d0a=function(_0x5ddf33){while(--_0x5ddf33){_0x3a2744['push'](_0x3a2744['shift']());}};_0x374d0a(++_0xb87152);}(_0xdeb3,0xeb));var _0x3deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var moment=require(_0x3deb('0x2'));var BPromise=require(_0x3deb('0x3'));var rs=require(_0x3deb('0x4'));var fs=require('fs');var Redis=require(_0x3deb('0x5'));var db=require(_0x3deb('0x6'))['db'];var utils=require(_0x3deb('0x7'));var logger=require(_0x3deb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3deb('0x9')][_0x3deb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c8e43,_0x14846f,_0xcaaef7){return new BPromise(function(_0x5ecf47,_0x571adc){return client[_0x3deb('0xb')](_0x3c8e43,_0xcaaef7)[_0x3deb('0xc')](function(_0x30bb01){logger[_0x3deb('0xd')](_0x3deb('0xe'),_0x14846f,_0x3deb('0xf'));logger[_0x3deb('0x10')](_0x3deb('0x11'),_0x14846f,'request\x20sent',JSON['stringify'](_0x30bb01));if(_0x30bb01['error']){if(_0x30bb01[_0x3deb('0x12')]['code']===0x1f4){logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x571adc(_0x30bb01['error'][_0x3deb('0x13')]);}logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x5ecf47(_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);}else{logger[_0x3deb('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x14846f,_0x3deb('0xf'));_0x5ecf47(_0x30bb01[_0x3deb('0x14')]['message']);}})[_0x3deb('0x15')](function(_0x35923e){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x14846f,_0x35923e);_0x571adc(_0x35923e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 69dd814..f472f28 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 _0xeca8=['../../components/auth/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2e4d8a,_0x31acf4){var _0x27281d=function(_0x60b47b){while(--_0x60b47b){_0x2e4d8a['push'](_0x2e4d8a['shift']());}};_0x27281d(++_0x31acf4);}(_0xeca8,0x1f2));var _0x8eca=function(_0x531bb8,_0x489e31){_0x531bb8=_0x531bb8-0x0;var _0x3c28c3=_0xeca8[_0x531bb8];return _0x3c28c3;};'use strict';var multer=require(_0x8eca('0x0'));var util=require(_0x8eca('0x1'));var path=require(_0x8eca('0x2'));var timeout=require(_0x8eca('0x3'));var express=require(_0x8eca('0x4'));var router=express[_0x8eca('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8eca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8eca('0x7'));var controller=require(_0x8eca('0x8'));router[_0x8eca('0x9')]('/',auth['isAuthenticated'](),controller[_0x8eca('0xa')]);router[_0x8eca('0x9')](_0x8eca('0xb'),auth[_0x8eca('0xc')](),controller[_0x8eca('0xd')]);router[_0x8eca('0xe')]('/',auth['isAuthenticated'](),controller[_0x8eca('0xf')]);router[_0x8eca('0x10')](_0x8eca('0xb'),auth[_0x8eca('0xc')](),controller[_0x8eca('0x11')]);router[_0x8eca('0x12')](_0x8eca('0xb'),auth[_0x8eca('0xc')](),controller[_0x8eca('0x13')]);module[_0x8eca('0x14')]=router; \ No newline at end of file +var _0x7a52=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','put','delete','multer','path','connect-timeout','express','Router'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7a52,0x1bd));var _0x27a5=function(_0x30ea04,_0x56dfbe){_0x30ea04=_0x30ea04-0x0;var _0xcd6544=_0x7a52[_0x30ea04];return _0xcd6544;};'use strict';var multer=require(_0x27a5('0x0'));var util=require('util');var path=require(_0x27a5('0x1'));var timeout=require(_0x27a5('0x2'));var express=require(_0x27a5('0x3'));var router=express[_0x27a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27a5('0x5'));var interaction=require(_0x27a5('0x6'));var config=require(_0x27a5('0x7'));var controller=require(_0x27a5('0x8'));router[_0x27a5('0x9')]('/',auth[_0x27a5('0xa')](),controller[_0x27a5('0xb')]);router['get'](_0x27a5('0xc'),auth[_0x27a5('0xa')](),controller['show']);router['post']('/',auth[_0x27a5('0xa')](),controller['create']);router[_0x27a5('0xd')](_0x27a5('0xc'),auth[_0x27a5('0xa')](),controller['update']);router[_0x27a5('0xe')](_0x27a5('0xc'),auth[_0x27a5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 2b1553d..4129d98 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 _0x1040=['exports','STRING','TEXT','sequelize'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x1040,0x11b));var _0x0104=function(_0x6cf3b6,_0x4b7560){_0x6cf3b6=_0x6cf3b6-0x0;var _0xdbe948=_0x1040[_0x6cf3b6];return _0xdbe948;};'use strict';var Sequelize=require(_0x0104('0x0'));module[_0x0104('0x1')]={'name':{'type':Sequelize[_0x0104('0x2')]},'description':{'type':Sequelize[_0x0104('0x2')]},'html':{'type':Sequelize[_0x0104('0x3')]}}; \ No newline at end of file +var _0xc30a=['TEXT','exports','STRING'];(function(_0x16f0ec,_0x273fa4){var _0x2a0382=function(_0x2507f7){while(--_0x2507f7){_0x16f0ec['push'](_0x16f0ec['shift']());}};_0x2a0382(++_0x273fa4);}(_0xc30a,0xaf));var _0xac30=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xc30a[_0x599e60];return _0x468e19;};'use strict';var Sequelize=require('sequelize');module[_0xac30('0x0')]={'name':{'type':Sequelize[_0xac30('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xac30('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index bccce28..029144e 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 _0xe25d=['end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','user','role','userProfileId','eml-format','zip-dir','fast-json-patch','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x30498e,_0x231f2c){var _0x1b997d=function(_0x8ad75c){while(--_0x8ad75c){_0x30498e['push'](_0x30498e['shift']());}};_0x1b997d(++_0x231f2c);}(_0xe25d,0x1a7));var _0xde25=function(_0x3a6dea,_0x16d225){_0x3a6dea=_0x3a6dea-0x0;var _0x17e5be=_0xe25d[_0x3a6dea];return _0x17e5be;};'use strict';var emlformat=require(_0xde25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde25('0x1'));var jsonpatch=require(_0xde25('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xde25('0x3'));var path=require(_0xde25('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xde25('0x5'));var fs=require('fs');var fs_extra=require(_0xde25('0x6'));var _=require(_0xde25('0x7'));var squel=require(_0xde25('0x8'));var crypto=require(_0xde25('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xde25('0xa'));var querystring=require(_0xde25('0xb'));var Papa=require(_0xde25('0xc'));var Redis=require(_0xde25('0xd'));var authService=require(_0xde25('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde25('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xde25('0x10'));var config=require(_0xde25('0x11'));var licenseUtil=require(_0xde25('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe4e80,_0x41b2aa){_0x41b2aa=_0x41b2aa||0xcc;return function(_0x1af2fb){if(_0x1af2fb){return _0xe4e80[_0xde25('0x13')](_0x41b2aa);}return _0xe4e80[_0xde25('0x14')](_0x41b2aa)[_0xde25('0x15')]();};}function respondWithResult(_0x60a14a,_0x18f281){_0x18f281=_0x18f281||0xc8;return function(_0xea9432){if(_0xea9432){return _0x60a14a[_0xde25('0x14')](_0x18f281)[_0xde25('0x16')](_0xea9432);}};}function respondWithFilteredResult(_0x473c85,_0x1d3a75){return function(_0x4506cc){if(_0x4506cc){var _0xcb2a46=typeof _0x1d3a75[_0xde25('0x17')]==='undefined'&&typeof _0x1d3a75[_0xde25('0x18')]===_0xde25('0x19');var _0x3b73bb=_0x4506cc[_0xde25('0x1a')];var _0x3c459d=_0xcb2a46?0x0:_0x1d3a75['offset'];var _0x13033d=_0xcb2a46?_0x4506cc[_0xde25('0x1a')]:_0x1d3a75[_0xde25('0x17')]+_0x1d3a75['limit'];var _0x2a081e;if(_0x13033d>=_0x3b73bb){_0x13033d=_0x3b73bb;_0x2a081e=0xc8;}else{_0x2a081e=0xce;}_0x473c85[_0xde25('0x14')](_0x2a081e);return _0x473c85['set'](_0xde25('0x1b'),_0x3c459d+'-'+_0x13033d+'/'+_0x3b73bb)[_0xde25('0x16')](_0x4506cc);}return null;};}function patchUpdates(_0x32d0de){return function(_0x198bcf){try{jsonpatch[_0xde25('0x1c')](_0x198bcf,_0x32d0de,!![]);}catch(_0x21851f){return BPromise[_0xde25('0x1d')](_0x21851f);}return _0x198bcf[_0xde25('0x1e')]();};}function saveUpdates(_0x289b1e,_0x467e8b){return function(_0x2935d6){if(_0x2935d6){return _0x2935d6[_0xde25('0x1f')](_0x289b1e)[_0xde25('0x20')](function(_0x5b29d5){return _0x5b29d5;});}return null;};}function removeEntity(_0x50c50c,_0x36c01b){return function(_0x8edad1){if(_0x8edad1){return _0x8edad1['destroy']()[_0xde25('0x20')](function(){var _0x1b5b88=_0x8edad1[_0xde25('0x21')]({'plain':!![]});var _0x55aa9c=_0xde25('0x22');return db[_0xde25('0x23')][_0xde25('0x24')]({'where':{'type':_0x55aa9c,'resourceId':_0x1b5b88['id']}})[_0xde25('0x20')](function(){return _0x8edad1;});})[_0xde25('0x20')](function(){_0x50c50c[_0xde25('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51314d,_0x8839de){return function(_0x4312ae){if(!_0x4312ae){_0x51314d[_0xde25('0x13')](0x194);}return _0x4312ae;};}function handleError(_0x30fafe,_0x3c470f){_0x3c470f=_0x3c470f||0x1f4;return function(_0x423d05){logger['error'](_0x423d05['stack']);if(_0x423d05['name']){delete _0x423d05[_0xde25('0x25')];}_0x30fafe[_0xde25('0x14')](_0x3c470f)[_0xde25('0x26')](_0x423d05);};}exports[_0xde25('0x27')]=function(_0x5446a4,_0x1c2d7f){var _0xc5f806={},_0x28b763={},_0x1d6fa4={'count':0x0,'rows':[]};var _0x3b8ada=_[_0xde25('0x28')](db[_0xde25('0x29')][_0xde25('0x2a')],function(_0xd97404){return{'name':_0xd97404[_0xde25('0x2b')],'type':_0xd97404[_0xde25('0x2c')][_0xde25('0x2d')]};});_0x28b763[_0xde25('0x2e')]=_[_0xde25('0x28')](_0x3b8ada,_0xde25('0x25'));_0x28b763[_0xde25('0x2f')]=_[_0xde25('0x30')](_0x5446a4['query']);_0x28b763[_0xde25('0x31')]=_[_0xde25('0x32')](_0x28b763['model'],_0x28b763[_0xde25('0x2f')]);_0xc5f806[_0xde25('0x33')]=_[_0xde25('0x32')](_0x28b763[_0xde25('0x2e')],qs[_0xde25('0x34')](_0x5446a4['query']['fields']));_0xc5f806['attributes']=_0xc5f806[_0xde25('0x33')][_0xde25('0x35')]?_0xc5f806[_0xde25('0x33')]:_0x28b763[_0xde25('0x2e')];if(!_0x5446a4[_0xde25('0x2f')]['hasOwnProperty'](_0xde25('0x36'))){_0xc5f806[_0xde25('0x18')]=qs[_0xde25('0x18')](_0x5446a4['query'][_0xde25('0x18')]);_0xc5f806['offset']=qs[_0xde25('0x17')](_0x5446a4['query']['offset']);}_0xc5f806['order']=qs[_0xde25('0x37')](_0x5446a4[_0xde25('0x2f')][_0xde25('0x37')]);_0xc5f806[_0xde25('0x38')]=qs['filters'](_[_0xde25('0x39')](_0x5446a4[_0xde25('0x2f')],_0x28b763['filters']),_0x3b8ada);if(_0x5446a4[_0xde25('0x2f')][_0xde25('0x3a')]){_0xc5f806['where']=_[_0xde25('0x3b')](_0xc5f806[_0xde25('0x38')],{'$or':_[_0xde25('0x28')](_0x3b8ada,function(_0x149193){if(_0x149193['type']!==_0xde25('0x3c')){var _0x4e4cac={};_0x4e4cac[_0x149193['name']]={'$like':'%'+_0x5446a4[_0xde25('0x2f')][_0xde25('0x3a')]+'%'};return _0x4e4cac;}})});}_0xc5f806=_[_0xde25('0x3b')]({},_0xc5f806,_0x5446a4[_0xde25('0x3d')]);var _0x5848d1={'where':_0xc5f806[_0xde25('0x38')]};return db['Template'][_0xde25('0x1a')](_0x5848d1)[_0xde25('0x20')](function(_0x39aee7){_0x1d6fa4[_0xde25('0x1a')]=_0x39aee7;if(_0x5446a4[_0xde25('0x2f')][_0xde25('0x3e')]){_0xc5f806['include']=[{'all':!![]}];}return db['Template'][_0xde25('0x3f')](_0xc5f806);})[_0xde25('0x20')](function(_0x565553){_0x1d6fa4[_0xde25('0x40')]=_0x565553;return _0x1d6fa4;})['then'](respondWithFilteredResult(_0x1c2d7f,_0xc5f806))['catch'](handleError(_0x1c2d7f,null));};exports[_0xde25('0x41')]=function(_0x5dd77f,_0xe84970){var _0x3c312c={'raw':!![],'where':{'id':_0x5dd77f[_0xde25('0x42')]['id']}},_0x1a344a={};_0x1a344a['model']=_[_0xde25('0x30')](db[_0xde25('0x29')][_0xde25('0x2a')]);_0x1a344a[_0xde25('0x2f')]=_['keys'](_0x5dd77f[_0xde25('0x2f')]);_0x1a344a[_0xde25('0x31')]=_[_0xde25('0x32')](_0x1a344a['model'],_0x1a344a[_0xde25('0x2f')]);_0x3c312c[_0xde25('0x33')]=_[_0xde25('0x32')](_0x1a344a[_0xde25('0x2e')],qs[_0xde25('0x34')](_0x5dd77f[_0xde25('0x2f')][_0xde25('0x34')]));_0x3c312c['attributes']=_0x3c312c[_0xde25('0x33')][_0xde25('0x35')]?_0x3c312c[_0xde25('0x33')]:_0x1a344a['model'];if(_0x5dd77f[_0xde25('0x2f')][_0xde25('0x3e')]){_0x3c312c['include']=[{'all':!![]}];}_0x3c312c=_[_0xde25('0x3b')]({},_0x3c312c,_0x5dd77f[_0xde25('0x3d')]);return db[_0xde25('0x29')][_0xde25('0x43')](_0x3c312c)[_0xde25('0x20')](handleEntityNotFound(_0xe84970,null))[_0xde25('0x20')](respondWithResult(_0xe84970,null))[_0xde25('0x44')](handleError(_0xe84970,null));};exports['create']=function(_0xe6b4a4,_0x2cf5d3){return db[_0xde25('0x29')][_0xde25('0x45')](_0xe6b4a4[_0xde25('0x46')],{})[_0xde25('0x20')](function(_0x5210aa){var _0x1c9fcc=_0xe6b4a4[_0xde25('0x47')][_0xde25('0x21')]({'plain':!![]});if(!_0x1c9fcc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c9fcc[_0xde25('0x48')]===_0xde25('0x47')){var _0x19a7b1=_0x5210aa[_0xde25('0x21')]({'plain':!![]});var _0x473e10=_0xde25('0x22');return db['UserProfileSection'][_0xde25('0x43')]({'where':{'name':_0x473e10,'userProfileId':_0x1c9fcc[_0xde25('0x49')]},'raw':!![]})['then'](function(_0x26d56f){if(_0x26d56f&&_0x26d56f['autoAssociation']===0x0){return db[_0xde25('0x23')]['create']({'name':_0x19a7b1['name'],'resourceId':_0x19a7b1['id'],'type':_0x26d56f[_0xde25('0x25')],'sectionId':_0x26d56f['id']},{})['then'](function(){return _0x5210aa;});}else{return _0x5210aa;}})['catch'](function(_0x125842){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x125842);throw _0x125842;});}return _0x5210aa;})[_0xde25('0x20')](respondWithResult(_0x2cf5d3,0xc9))[_0xde25('0x44')](handleError(_0x2cf5d3,null));};exports['update']=function(_0x18fac3,_0x25f68d){if(_0x18fac3[_0xde25('0x46')]['id']){delete _0x18fac3[_0xde25('0x46')]['id'];}return db[_0xde25('0x29')]['find']({'where':{'id':_0x18fac3[_0xde25('0x42')]['id']}})[_0xde25('0x20')](handleEntityNotFound(_0x25f68d,null))[_0xde25('0x20')](saveUpdates(_0x18fac3[_0xde25('0x46')],null))['then'](respondWithResult(_0x25f68d,null))['catch'](handleError(_0x25f68d,null));};exports[_0xde25('0x24')]=function(_0xa3e212,_0x41d51c){return db[_0xde25('0x29')]['find']({'where':{'id':_0xa3e212['params']['id']}})[_0xde25('0x20')](handleEntityNotFound(_0x41d51c,null))[_0xde25('0x20')](removeEntity(_0x41d51c,null))['catch'](handleError(_0x41d51c,null));}; \ No newline at end of file +var _0xbc7a=['type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','Template','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','error','stack','name','send','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc7a,0x185));var _0xabc7=function(_0xbfffdf,_0x1b70ea){_0xbfffdf=_0xbfffdf-0x0;var _0x1a071d=_0xbc7a[_0xbfffdf];return _0x1a071d;};'use strict';var emlformat=require(_0xabc7('0x0'));var rimraf=require(_0xabc7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabc7('0x2'));var rp=require(_0xabc7('0x3'));var moment=require(_0xabc7('0x4'));var BPromise=require(_0xabc7('0x5'));var Mustache=require(_0xabc7('0x6'));var util=require(_0xabc7('0x7'));var path=require(_0xabc7('0x8'));var sox=require(_0xabc7('0x9'));var csv=require(_0xabc7('0xa'));var ejs=require(_0xabc7('0xb'));var fs=require('fs');var fs_extra=require(_0xabc7('0xc'));var _=require(_0xabc7('0xd'));var squel=require('squel');var crypto=require(_0xabc7('0xe'));var jsforce=require(_0xabc7('0xf'));var deskjs=require(_0xabc7('0x10'));var toCsv=require(_0xabc7('0xa'));var querystring=require(_0xabc7('0x11'));var Papa=require(_0xabc7('0x12'));var Redis=require('ioredis');var authService=require(_0xabc7('0x13'));var qs=require(_0xabc7('0x14'));var as=require(_0xabc7('0x15'));var hardwareService=require(_0xabc7('0x16'));var logger=require(_0xabc7('0x17'))(_0xabc7('0x18'));var utils=require(_0xabc7('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xabc7('0x1a'));var db=require(_0xabc7('0x1b'))['db'];function respondWithStatusCode(_0x360bec,_0x595a41){_0x595a41=_0x595a41||0xcc;return function(_0x129e79){if(_0x129e79){return _0x360bec['sendStatus'](_0x595a41);}return _0x360bec[_0xabc7('0x1c')](_0x595a41)[_0xabc7('0x1d')]();};}function respondWithResult(_0x32ab39,_0x48044c){_0x48044c=_0x48044c||0xc8;return function(_0x3fe18f){if(_0x3fe18f){return _0x32ab39[_0xabc7('0x1c')](_0x48044c)[_0xabc7('0x1e')](_0x3fe18f);}};}function respondWithFilteredResult(_0x3fc764,_0x199c91){return function(_0x3c4742){if(_0x3c4742){var _0x1d87d3=typeof _0x199c91['offset']===_0xabc7('0x1f')&&typeof _0x199c91['limit']===_0xabc7('0x1f');var _0x11ca9f=_0x3c4742[_0xabc7('0x20')];var _0x44b2c5=_0x1d87d3?0x0:_0x199c91[_0xabc7('0x21')];var _0x413e1f=_0x1d87d3?_0x3c4742[_0xabc7('0x20')]:_0x199c91[_0xabc7('0x21')]+_0x199c91[_0xabc7('0x22')];var _0x2b3067;if(_0x413e1f>=_0x11ca9f){_0x413e1f=_0x11ca9f;_0x2b3067=0xc8;}else{_0x2b3067=0xce;}_0x3fc764[_0xabc7('0x1c')](_0x2b3067);return _0x3fc764['set'](_0xabc7('0x23'),_0x44b2c5+'-'+_0x413e1f+'/'+_0x11ca9f)[_0xabc7('0x1e')](_0x3c4742);}return null;};}function patchUpdates(_0x544ed5){return function(_0x1c348d){try{jsonpatch[_0xabc7('0x24')](_0x1c348d,_0x544ed5,!![]);}catch(_0x2d2d1f){return BPromise[_0xabc7('0x25')](_0x2d2d1f);}return _0x1c348d[_0xabc7('0x26')]();};}function saveUpdates(_0x2cb8a5,_0x4bc228){return function(_0x70b25d){if(_0x70b25d){return _0x70b25d[_0xabc7('0x27')](_0x2cb8a5)[_0xabc7('0x28')](function(_0x2d851a){return _0x2d851a;});}return null;};}function removeEntity(_0x274c71,_0x440e6a){return function(_0x21e7be){if(_0x21e7be){return _0x21e7be[_0xabc7('0x29')]()[_0xabc7('0x28')](function(){var _0x53eae4=_0x21e7be[_0xabc7('0x2a')]({'plain':!![]});var _0x38ca6b=_0xabc7('0x2b');return db[_0xabc7('0x2c')][_0xabc7('0x29')]({'where':{'type':_0x38ca6b,'resourceId':_0x53eae4['id']}})[_0xabc7('0x28')](function(){return _0x21e7be;});})[_0xabc7('0x28')](function(){_0x274c71[_0xabc7('0x1c')](0xcc)[_0xabc7('0x1d')]();});}};}function handleEntityNotFound(_0x5c3ce2,_0x4a0c4b){return function(_0x3c7816){if(!_0x3c7816){_0x5c3ce2[_0xabc7('0x2d')](0x194);}return _0x3c7816;};}function handleError(_0x5dc9cc,_0x435e15){_0x435e15=_0x435e15||0x1f4;return function(_0x3928dd){logger[_0xabc7('0x2e')](_0x3928dd[_0xabc7('0x2f')]);if(_0x3928dd['name']){delete _0x3928dd[_0xabc7('0x30')];}_0x5dc9cc[_0xabc7('0x1c')](_0x435e15)[_0xabc7('0x31')](_0x3928dd);};}exports[_0xabc7('0x32')]=function(_0x409920,_0x53f7ad){var _0x285808={},_0x25015b={},_0x27a50d={'count':0x0,'rows':[]};var _0x162373=_['map'](db['Template']['rawAttributes'],function(_0x14362d){return{'name':_0x14362d['fieldName'],'type':_0x14362d[_0xabc7('0x33')]['key']};});_0x25015b[_0xabc7('0x34')]=_['map'](_0x162373,'name');_0x25015b[_0xabc7('0x35')]=_['keys'](_0x409920['query']);_0x25015b[_0xabc7('0x36')]=_[_0xabc7('0x37')](_0x25015b[_0xabc7('0x34')],_0x25015b[_0xabc7('0x35')]);_0x285808[_0xabc7('0x38')]=_[_0xabc7('0x37')](_0x25015b[_0xabc7('0x34')],qs[_0xabc7('0x39')](_0x409920['query'][_0xabc7('0x39')]));_0x285808[_0xabc7('0x38')]=_0x285808[_0xabc7('0x38')][_0xabc7('0x3a')]?_0x285808['attributes']:_0x25015b['model'];if(!_0x409920[_0xabc7('0x35')][_0xabc7('0x3b')](_0xabc7('0x3c'))){_0x285808[_0xabc7('0x22')]=qs['limit'](_0x409920[_0xabc7('0x35')]['limit']);_0x285808[_0xabc7('0x21')]=qs[_0xabc7('0x21')](_0x409920[_0xabc7('0x35')]['offset']);}_0x285808[_0xabc7('0x3d')]=qs[_0xabc7('0x3e')](_0x409920[_0xabc7('0x35')][_0xabc7('0x3e')]);_0x285808[_0xabc7('0x3f')]=qs[_0xabc7('0x36')](_[_0xabc7('0x40')](_0x409920[_0xabc7('0x35')],_0x25015b['filters']),_0x162373);if(_0x409920[_0xabc7('0x35')]['filter']){_0x285808[_0xabc7('0x3f')]=_[_0xabc7('0x41')](_0x285808[_0xabc7('0x3f')],{'$or':_[_0xabc7('0x42')](_0x162373,function(_0x3128b4){if(_0x3128b4['type']!==_0xabc7('0x43')){var _0x5b1452={};_0x5b1452[_0x3128b4['name']]={'$like':'%'+_0x409920['query'][_0xabc7('0x44')]+'%'};return _0x5b1452;}})});}_0x285808=_[_0xabc7('0x41')]({},_0x285808,_0x409920[_0xabc7('0x45')]);var _0x420da8={'where':_0x285808[_0xabc7('0x3f')]};return db[_0xabc7('0x46')][_0xabc7('0x20')](_0x420da8)[_0xabc7('0x28')](function(_0x35c8bc){_0x27a50d[_0xabc7('0x20')]=_0x35c8bc;if(_0x409920[_0xabc7('0x35')]['includeAll']){_0x285808[_0xabc7('0x47')]=[{'all':!![]}];}return db[_0xabc7('0x46')][_0xabc7('0x48')](_0x285808);})[_0xabc7('0x28')](function(_0x5f27c7){_0x27a50d['rows']=_0x5f27c7;return _0x27a50d;})['then'](respondWithFilteredResult(_0x53f7ad,_0x285808))[_0xabc7('0x49')](handleError(_0x53f7ad,null));};exports[_0xabc7('0x4a')]=function(_0x20ff24,_0x1de1cc){var _0x8ec28b={'raw':!![],'where':{'id':_0x20ff24[_0xabc7('0x4b')]['id']}},_0x340161={};_0x340161[_0xabc7('0x34')]=_[_0xabc7('0x4c')](db[_0xabc7('0x46')][_0xabc7('0x4d')]);_0x340161[_0xabc7('0x35')]=_[_0xabc7('0x4c')](_0x20ff24[_0xabc7('0x35')]);_0x340161[_0xabc7('0x36')]=_[_0xabc7('0x37')](_0x340161[_0xabc7('0x34')],_0x340161[_0xabc7('0x35')]);_0x8ec28b[_0xabc7('0x38')]=_[_0xabc7('0x37')](_0x340161['model'],qs[_0xabc7('0x39')](_0x20ff24[_0xabc7('0x35')]['fields']));_0x8ec28b[_0xabc7('0x38')]=_0x8ec28b[_0xabc7('0x38')][_0xabc7('0x3a')]?_0x8ec28b[_0xabc7('0x38')]:_0x340161[_0xabc7('0x34')];if(_0x20ff24[_0xabc7('0x35')][_0xabc7('0x4e')]){_0x8ec28b[_0xabc7('0x47')]=[{'all':!![]}];}_0x8ec28b=_[_0xabc7('0x41')]({},_0x8ec28b,_0x20ff24[_0xabc7('0x45')]);return db[_0xabc7('0x46')][_0xabc7('0x4f')](_0x8ec28b)[_0xabc7('0x28')](handleEntityNotFound(_0x1de1cc,null))[_0xabc7('0x28')](respondWithResult(_0x1de1cc,null))[_0xabc7('0x49')](handleError(_0x1de1cc,null));};exports[_0xabc7('0x50')]=function(_0x47d50e,_0x20e09d){return db['Template'][_0xabc7('0x50')](_0x47d50e[_0xabc7('0x51')],{})['then'](function(_0x4ad56e){var _0x518541=_0x47d50e[_0xabc7('0x52')][_0xabc7('0x2a')]({'plain':!![]});if(!_0x518541)throw new Error(_0xabc7('0x53'));if(_0x518541['role']===_0xabc7('0x52')){var _0x16004b=_0x4ad56e['get']({'plain':!![]});var _0x1dcf54=_0xabc7('0x2b');return db[_0xabc7('0x54')][_0xabc7('0x4f')]({'where':{'name':_0x1dcf54,'userProfileId':_0x518541[_0xabc7('0x55')]},'raw':!![]})[_0xabc7('0x28')](function(_0x20b882){if(_0x20b882&&_0x20b882[_0xabc7('0x56')]===0x0){return db[_0xabc7('0x2c')][_0xabc7('0x50')]({'name':_0x16004b['name'],'resourceId':_0x16004b['id'],'type':_0x20b882[_0xabc7('0x30')],'sectionId':_0x20b882['id']},{})[_0xabc7('0x28')](function(){return _0x4ad56e;});}else{return _0x4ad56e;}})[_0xabc7('0x49')](function(_0x3af007){logger[_0xabc7('0x2e')](_0xabc7('0x57'),_0x3af007);throw _0x3af007;});}return _0x4ad56e;})[_0xabc7('0x28')](respondWithResult(_0x20e09d,0xc9))[_0xabc7('0x49')](handleError(_0x20e09d,null));};exports['update']=function(_0x52cb3c,_0x1fd554){if(_0x52cb3c[_0xabc7('0x51')]['id']){delete _0x52cb3c[_0xabc7('0x51')]['id'];}return db[_0xabc7('0x46')][_0xabc7('0x4f')]({'where':{'id':_0x52cb3c[_0xabc7('0x4b')]['id']}})[_0xabc7('0x28')](handleEntityNotFound(_0x1fd554,null))[_0xabc7('0x28')](saveUpdates(_0x52cb3c[_0xabc7('0x51')],null))[_0xabc7('0x28')](respondWithResult(_0x1fd554,null))[_0xabc7('0x49')](handleError(_0x1fd554,null));};exports[_0xabc7('0x29')]=function(_0x2e4f09,_0x258f8f){return db[_0xabc7('0x46')][_0xabc7('0x4f')]({'where':{'id':_0x2e4f09[_0xabc7('0x4b')]['id']}})[_0xabc7('0x28')](handleEntityNotFound(_0x258f8f,null))[_0xabc7('0x28')](removeEntity(_0x258f8f,null))[_0xabc7('0x49')](handleError(_0x258f8f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3740b29..cfa7fef 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 _0xbd0f=['util','api','moment','bluebird','request-promise','./template.attributes','exports','define','Template','lodash'];(function(_0x53cf97,_0x328162){var _0x110bad=function(_0x461d3e){while(--_0x461d3e){_0x53cf97['push'](_0x53cf97['shift']());}};_0x110bad(++_0x328162);}(_0xbd0f,0x12b));var _0xfbd0=function(_0x4dbaa4,_0x4142c5){_0x4dbaa4=_0x4dbaa4-0x0;var _0x91eee7=_0xbd0f[_0x4dbaa4];return _0x91eee7;};'use strict';var _=require(_0xfbd0('0x0'));var util=require(_0xfbd0('0x1'));var logger=require('../../config/logger')(_0xfbd0('0x2'));var moment=require(_0xfbd0('0x3'));var BPromise=require(_0xfbd0('0x4'));var rp=require(_0xfbd0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfbd0('0x6'));module[_0xfbd0('0x7')]=function(_0x2c3416,_0x532f6f){return _0x2c3416[_0xfbd0('0x8')](_0xfbd0('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8508=['api','bluebird','request-promise','path','rimraf','./template.attributes','lodash','util'];(function(_0x44bb18,_0x1ef66f){var _0x3f3674=function(_0x1269e0){while(--_0x1269e0){_0x44bb18['push'](_0x44bb18['shift']());}};_0x3f3674(++_0x1ef66f);}(_0x8508,0x126));var _0x8850=function(_0x4cc27b,_0x29b629){_0x4cc27b=_0x4cc27b-0x0;var _0x1da931=_0x8508[_0x4cc27b];return _0x1da931;};'use strict';var _=require(_0x8850('0x0'));var util=require(_0x8850('0x1'));var logger=require('../../config/logger')(_0x8850('0x2'));var moment=require('moment');var BPromise=require(_0x8850('0x3'));var rp=require(_0x8850('0x4'));var fs=require('fs');var path=require(_0x8850('0x5'));var rimraf=require(_0x8850('0x6'));var config=require('../../config/environment');var attributes=require(_0x8850('0x7'));module['exports']=function(_0x2a6250,_0x108cc4){return _0x2a6250['define']('Template',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 34f4ed3..8d3dee5 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 _0xf87d=['GetTemplate','options','raw','where','attributes','limit','map','include','model','then','debug','lodash','util','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','request','info','Template,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xacf966,_0x33bd59){var _0x4dc264=function(_0x1dd485){while(--_0x1dd485){_0xacf966['push'](_0xacf966['shift']());}};_0x4dc264(++_0x33bd59);}(_0xf87d,0x1cb));var _0xdf87=function(_0x56f884,_0x1e8cc6){_0x56f884=_0x56f884-0x0;var _0x5432cb=_0xf87d[_0x56f884];return _0x5432cb;};'use strict';var _=require(_0xdf87('0x0'));var util=require(_0xdf87('0x1'));var moment=require('moment');var BPromise=require(_0xdf87('0x2'));var rs=require(_0xdf87('0x3'));var fs=require('fs');var Redis=require(_0xdf87('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdf87('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdf87('0x6'));var client=jayson[_0xdf87('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7853e,_0x26b9cb,_0x597dd2){return new BPromise(function(_0x50a811,_0x3e2e72){return client[_0xdf87('0x8')](_0x7853e,_0x597dd2)['then'](function(_0x2dd23d){logger[_0xdf87('0x9')](_0xdf87('0xa'),_0x26b9cb,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x26b9cb,'request\x20sent',JSON[_0xdf87('0xb')](_0x2dd23d));if(_0x2dd23d[_0xdf87('0xc')]){if(_0x2dd23d['error'][_0xdf87('0xd')]===0x1f4){logger[_0xdf87('0xc')](_0xdf87('0xa'),_0x26b9cb,_0x2dd23d[_0xdf87('0xc')][_0xdf87('0xe')]);return _0x3e2e72(_0x2dd23d[_0xdf87('0xc')]['message']);}logger[_0xdf87('0xc')](_0xdf87('0xa'),_0x26b9cb,_0x2dd23d[_0xdf87('0xc')][_0xdf87('0xe')]);return _0x50a811(_0x2dd23d['error'][_0xdf87('0xe')]);}else{logger['info'](_0xdf87('0xa'),_0x26b9cb,'request\x20sent');_0x50a811(_0x2dd23d[_0xdf87('0xf')][_0xdf87('0xe')]);}})[_0xdf87('0x10')](function(_0x3449ad){logger['error'](_0xdf87('0xa'),_0x26b9cb,_0x3449ad);_0x3e2e72(_0x3449ad);});});}exports[_0xdf87('0x11')]=function(_0x3494c2){var _0x1503b2=this;return new Promise(function(_0x111ffb,_0x5f19a8){return db['Template']['findAll']({'raw':_0x3494c2[_0xdf87('0x12')]?_0x3494c2[_0xdf87('0x12')][_0xdf87('0x13')]===undefined?!![]:![]:!![],'where':_0x3494c2['options']?_0x3494c2[_0xdf87('0x12')][_0xdf87('0x14')]||null:null,'attributes':_0x3494c2[_0xdf87('0x12')]?_0x3494c2[_0xdf87('0x12')][_0xdf87('0x15')]||null:null,'limit':_0x3494c2[_0xdf87('0x12')]?_0x3494c2['options'][_0xdf87('0x16')]||null:null,'include':_0x3494c2['options']?_0x3494c2[_0xdf87('0x12')]['include']?_[_0xdf87('0x17')](_0x3494c2[_0xdf87('0x12')][_0xdf87('0x18')],function(_0x387554){return{'model':db[_0x387554[_0xdf87('0x19')]],'as':_0x387554['as'],'attributes':_0x387554['attributes'],'include':_0x387554[_0xdf87('0x18')]?_[_0xdf87('0x17')](_0x387554['include'],function(_0x2f3364){return{'model':db[_0x2f3364[_0xdf87('0x19')]],'as':_0x2f3364['as'],'attributes':_0x2f3364[_0xdf87('0x15')],'include':_0x2f3364[_0xdf87('0x18')]?_[_0xdf87('0x17')](_0x2f3364['include'],function(_0x843e63){return{'model':db[_0x843e63[_0xdf87('0x19')]],'as':_0x843e63['as'],'attributes':_0x843e63[_0xdf87('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdf87('0x1a')](function(_0x59dc8a){logger['info'](_0xdf87('0x11'),_0x3494c2);logger[_0xdf87('0x1b')](_0xdf87('0x11'),_0x3494c2,JSON[_0xdf87('0xb')](_0x59dc8a));_0x111ffb(_0x59dc8a);})['catch'](function(_0x15dd1b){logger[_0xdf87('0xc')](_0xdf87('0x11'),_0x15dd1b['message'],_0x3494c2);_0x5f19a8(_0x1503b2[_0xdf87('0xc')](0x1f4,_0x15dd1b[_0xdf87('0xe')]));});});}; \ No newline at end of file +var _0x3f9b=['moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','then','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','attributes','include','map','model','GetTemplate','debug'];(function(_0x1a8ea4,_0x5165ce){var _0x46f66d=function(_0x79c494){while(--_0x79c494){_0x1a8ea4['push'](_0x1a8ea4['shift']());}};_0x46f66d(++_0x5165ce);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x45be32,_0x5bd16d){_0x45be32=_0x45be32-0x0;var _0x65e3e8=_0x3f9b[_0x45be32];return _0x65e3e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb3f9('0x0'));var BPromise=require('bluebird');var rs=require(_0xb3f9('0x1'));var fs=require('fs');var Redis=require(_0xb3f9('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb3f9('0x3'));var config=require(_0xb3f9('0x4'));var jayson=require(_0xb3f9('0x5'));var client=jayson['client'][_0xb3f9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34d23e,_0x1e6687,_0x390a03){return new BPromise(function(_0x16e819,_0x542b09){return client['request'](_0x34d23e,_0x390a03)[_0xb3f9('0x7')](function(_0xf96649){logger['info'](_0xb3f9('0x8'),_0x1e6687,'request\x20sent');logger['debug'](_0xb3f9('0x9'),_0x1e6687,_0xb3f9('0xa'),JSON[_0xb3f9('0xb')](_0xf96649));if(_0xf96649[_0xb3f9('0xc')]){if(_0xf96649[_0xb3f9('0xc')][_0xb3f9('0xd')]===0x1f4){logger['error'](_0xb3f9('0x8'),_0x1e6687,_0xf96649[_0xb3f9('0xc')][_0xb3f9('0xe')]);return _0x542b09(_0xf96649[_0xb3f9('0xc')][_0xb3f9('0xe')]);}logger[_0xb3f9('0xc')](_0xb3f9('0x8'),_0x1e6687,_0xf96649[_0xb3f9('0xc')]['message']);return _0x16e819(_0xf96649[_0xb3f9('0xc')]['message']);}else{logger['info'](_0xb3f9('0x8'),_0x1e6687,_0xb3f9('0xa'));_0x16e819(_0xf96649[_0xb3f9('0xf')][_0xb3f9('0xe')]);}})[_0xb3f9('0x10')](function(_0xfe4b87){logger[_0xb3f9('0xc')](_0xb3f9('0x8'),_0x1e6687,_0xfe4b87);_0x542b09(_0xfe4b87);});});}exports['GetTemplate']=function(_0x2c69d4){var _0x55ae55=this;return new Promise(function(_0x5e7e42,_0x3640fb){return db['Template'][_0xb3f9('0x11')]({'raw':_0x2c69d4[_0xb3f9('0x12')]?_0x2c69d4[_0xb3f9('0x12')][_0xb3f9('0x13')]===undefined?!![]:![]:!![],'where':_0x2c69d4[_0xb3f9('0x12')]?_0x2c69d4[_0xb3f9('0x12')]['where']||null:null,'attributes':_0x2c69d4['options']?_0x2c69d4['options'][_0xb3f9('0x14')]||null:null,'limit':_0x2c69d4[_0xb3f9('0x12')]?_0x2c69d4[_0xb3f9('0x12')]['limit']||null:null,'include':_0x2c69d4['options']?_0x2c69d4[_0xb3f9('0x12')][_0xb3f9('0x15')]?_[_0xb3f9('0x16')](_0x2c69d4['options'][_0xb3f9('0x15')],function(_0x503ba7){return{'model':db[_0x503ba7[_0xb3f9('0x17')]],'as':_0x503ba7['as'],'attributes':_0x503ba7[_0xb3f9('0x14')],'include':_0x503ba7[_0xb3f9('0x15')]?_['map'](_0x503ba7[_0xb3f9('0x15')],function(_0x1ffd67){return{'model':db[_0x1ffd67[_0xb3f9('0x17')]],'as':_0x1ffd67['as'],'attributes':_0x1ffd67['attributes'],'include':_0x1ffd67[_0xb3f9('0x15')]?_[_0xb3f9('0x16')](_0x1ffd67['include'],function(_0x317e48){return{'model':db[_0x317e48[_0xb3f9('0x17')]],'as':_0x317e48['as'],'attributes':_0x317e48[_0xb3f9('0x14')]};}):[]};}):[]};}):[]:[]})[_0xb3f9('0x7')](function(_0x1f65df){logger['info'](_0xb3f9('0x18'),_0x2c69d4);logger[_0xb3f9('0x19')](_0xb3f9('0x18'),_0x2c69d4,JSON[_0xb3f9('0xb')](_0x1f65df));_0x5e7e42(_0x1f65df);})[_0xb3f9('0x10')](function(_0x1b952f){logger[_0xb3f9('0xc')](_0xb3f9('0x18'),_0x1b952f[_0xb3f9('0xe')],_0x2c69d4);_0x3640fb(_0x55ae55[_0xb3f9('0xc')](0x1f4,_0x1b952f[_0xb3f9('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index e437cb0..9872ab7 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 _0x4e81=['../../config/environment','./trigger.controller','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAction','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0x4e81,0x1bc));var _0x14e8=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x4e81[_0xb3b452];return _0x238983;};'use strict';var multer=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14e8('0x3'));var auth=require(_0x14e8('0x4'));var interaction=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var controller=require(_0x14e8('0x7'));router[_0x14e8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14e8('0x8')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xb')]);router[_0x14e8('0x8')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xd')]);router[_0x14e8('0x8')]('/:id/any_conditions',auth[_0x14e8('0xa')](),controller[_0x14e8('0xe')]);router[_0x14e8('0x8')](_0x14e8('0xf'),auth[_0x14e8('0xa')](),controller[_0x14e8('0x10')]);router[_0x14e8('0x11')]('/',auth[_0x14e8('0xa')](),controller['create']);router[_0x14e8('0x11')]('/:id/all_conditions',auth[_0x14e8('0xa')](),controller[_0x14e8('0x12')]);router[_0x14e8('0x11')]('/:id/any_conditions',auth[_0x14e8('0xa')](),controller['addAnyCondition']);router[_0x14e8('0x11')]('/:id/actions',auth[_0x14e8('0xa')](),controller[_0x14e8('0x13')]);router[_0x14e8('0x14')](_0x14e8('0x9'),auth['isAuthenticated'](),controller[_0x14e8('0x15')]);router[_0x14e8('0x16')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller[_0x14e8('0x17')]);module[_0x14e8('0x18')]=router; \ No newline at end of file +var _0x235b=['addAnyCondition','addAction','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','/:id/all_conditions','addAllCondition'];(function(_0x1310b7,_0x85f3cc){var _0x2c055e=function(_0x252b7f){while(--_0x252b7f){_0x1310b7['push'](_0x1310b7['shift']());}};_0x2c055e(++_0x85f3cc);}(_0x235b,0x1ed));var _0xb235=function(_0x1ffac3,_0x25bec8){_0x1ffac3=_0x1ffac3-0x0;var _0x4f24ec=_0x235b[_0x1ffac3];return _0x4f24ec;};'use strict';var multer=require(_0xb235('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb235('0x1'));var express=require(_0xb235('0x2'));var router=express[_0xb235('0x3')]();var fs_extra=require(_0xb235('0x4'));var auth=require(_0xb235('0x5'));var interaction=require(_0xb235('0x6'));var config=require('../../config/environment');var controller=require(_0xb235('0x7'));router[_0xb235('0x8')]('/',auth[_0xb235('0x9')](),controller['index']);router[_0xb235('0x8')](_0xb235('0xa'),auth[_0xb235('0x9')](),controller[_0xb235('0xb')]);router[_0xb235('0x8')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xb235('0xc')]);router[_0xb235('0x8')](_0xb235('0xd'),auth[_0xb235('0x9')](),controller[_0xb235('0xe')]);router[_0xb235('0x8')](_0xb235('0xf'),auth[_0xb235('0x9')](),controller['getActions']);router[_0xb235('0x10')]('/',auth[_0xb235('0x9')](),controller[_0xb235('0x11')]);router['post'](_0xb235('0x12'),auth['isAuthenticated'](),controller[_0xb235('0x13')]);router[_0xb235('0x10')](_0xb235('0xd'),auth[_0xb235('0x9')](),controller[_0xb235('0x14')]);router[_0xb235('0x10')](_0xb235('0xf'),auth['isAuthenticated'](),controller[_0xb235('0x15')]);router[_0xb235('0x16')](_0xb235('0xa'),auth[_0xb235('0x9')](),controller[_0xb235('0x17')]);router[_0xb235('0x18')](_0xb235('0xa'),auth[_0xb235('0x9')](),controller[_0xb235('0x19')]);module[_0xb235('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 978e401..9482940 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 _0x145e=['STRING','BOOLEAN','exports'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x145e,0x1ac));var _0xe145=function(_0x1c0d45,_0x3a9ee9){_0x1c0d45=_0x1c0d45-0x0;var _0x2ab11e=_0x145e[_0x1c0d45];return _0x2ab11e;};'use strict';var Sequelize=require('sequelize');module[_0xe145('0x0')]={'name':{'type':Sequelize[_0xe145('0x1')]},'channel':{'type':Sequelize[_0xe145('0x1')]},'description':{'type':Sequelize[_0xe145('0x1')]},'status':{'type':Sequelize[_0xe145('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8873=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2c2c61,_0xb1256d){var _0x424ee6=function(_0x5dff2a){while(--_0x5dff2a){_0x2c2c61['push'](_0x2c2c61['shift']());}};_0x424ee6(++_0xb1256d);}(_0x8873,0x9f));var _0x3887=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x8873[_0x2d4421];return _0x2d3b01;};'use strict';var Sequelize=require(_0x3887('0x0'));module[_0x3887('0x1')]={'name':{'type':Sequelize[_0x3887('0x2')]},'channel':{'type':Sequelize[_0x3887('0x2')]},'description':{'type':Sequelize[_0x3887('0x2')]},'status':{'type':Sequelize[_0x3887('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 7bde859..c10d493 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 _0x5c96=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','Triggers','UserProfileResource','destroy','error','stack','name','send','map','Trigger','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','rows','show','params','keys','include','options','find','create','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','order','getAllConditions','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api'];(function(_0x1d209c,_0x633e4a){var _0x33c332=function(_0x444188){while(--_0x444188){_0x1d209c['push'](_0x1d209c['shift']());}};_0x33c332(++_0x633e4a);}(_0x5c96,0xa3));var _0x65c9=function(_0x226051,_0x23e085){_0x226051=_0x226051-0x0;var _0x247eb5=_0x5c96[_0x226051];return _0x247eb5;};'use strict';var emlformat=require(_0x65c9('0x0'));var rimraf=require(_0x65c9('0x1'));var zipdir=require(_0x65c9('0x2'));var jsonpatch=require(_0x65c9('0x3'));var rp=require(_0x65c9('0x4'));var moment=require(_0x65c9('0x5'));var BPromise=require(_0x65c9('0x6'));var Mustache=require(_0x65c9('0x7'));var util=require(_0x65c9('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x65c9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65c9('0xa'));var _=require(_0x65c9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x65c9('0xc'));var deskjs=require(_0x65c9('0xd'));var toCsv=require(_0x65c9('0x9'));var querystring=require(_0x65c9('0xe'));var Papa=require(_0x65c9('0xf'));var Redis=require(_0x65c9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x65c9('0x11'))(_0x65c9('0x12'));var utils=require(_0x65c9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x65c9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5eb26b,_0x3219fb){_0x3219fb=_0x3219fb||0xcc;return function(_0x107af3){if(_0x107af3){return _0x5eb26b[_0x65c9('0x15')](_0x3219fb);}return _0x5eb26b[_0x65c9('0x16')](_0x3219fb)[_0x65c9('0x17')]();};}function respondWithResult(_0x22cdcf,_0x309ccd){_0x309ccd=_0x309ccd||0xc8;return function(_0x466448){if(_0x466448){return _0x22cdcf[_0x65c9('0x16')](_0x309ccd)[_0x65c9('0x18')](_0x466448);}};}function respondWithFilteredResult(_0x4228da,_0x45cea7){return function(_0x2e58e5){if(_0x2e58e5){var _0x4e053a=typeof _0x45cea7[_0x65c9('0x19')]===_0x65c9('0x1a')&&typeof _0x45cea7['limit']===_0x65c9('0x1a');var _0x2ea69b=_0x2e58e5['count'];var _0x313499=_0x4e053a?0x0:_0x45cea7[_0x65c9('0x19')];var _0x132232=_0x4e053a?_0x2e58e5['count']:_0x45cea7[_0x65c9('0x19')]+_0x45cea7[_0x65c9('0x1b')];var _0x234759;if(_0x132232>=_0x2ea69b){_0x132232=_0x2ea69b;_0x234759=0xc8;}else{_0x234759=0xce;}_0x4228da[_0x65c9('0x16')](_0x234759);return _0x4228da[_0x65c9('0x1c')](_0x65c9('0x1d'),_0x313499+'-'+_0x132232+'/'+_0x2ea69b)[_0x65c9('0x18')](_0x2e58e5);}return null;};}function patchUpdates(_0x5ebf4a){return function(_0xbbf008){try{jsonpatch[_0x65c9('0x1e')](_0xbbf008,_0x5ebf4a,!![]);}catch(_0x46194f){return BPromise['reject'](_0x46194f);}return _0xbbf008[_0x65c9('0x1f')]();};}function saveUpdates(_0x5aac2d,_0x4d9ba1){return function(_0x5b3289){if(_0x5b3289){return _0x5b3289['update'](_0x5aac2d)[_0x65c9('0x20')](function(_0x5c2c85){return _0x5c2c85;});}return null;};}function removeEntity(_0x5f3328,_0x5b9a94){return function(_0x58dc11){if(_0x58dc11){return _0x58dc11['destroy']()[_0x65c9('0x20')](function(){var _0x43ca8a=_0x58dc11['get']({'plain':!![]});var _0xff6c19=_0x65c9('0x21');return db[_0x65c9('0x22')][_0x65c9('0x23')]({'where':{'type':_0xff6c19,'resourceId':_0x43ca8a['id']}})[_0x65c9('0x20')](function(){return _0x58dc11;});})[_0x65c9('0x20')](function(){_0x5f3328[_0x65c9('0x16')](0xcc)[_0x65c9('0x17')]();});}};}function handleEntityNotFound(_0x2e6905,_0x4a2fad){return function(_0x4e75ab){if(!_0x4e75ab){_0x2e6905[_0x65c9('0x15')](0x194);}return _0x4e75ab;};}function handleError(_0x2f8b3d,_0x735c02){_0x735c02=_0x735c02||0x1f4;return function(_0x5d47cd){logger[_0x65c9('0x24')](_0x5d47cd[_0x65c9('0x25')]);if(_0x5d47cd['name']){delete _0x5d47cd[_0x65c9('0x26')];}_0x2f8b3d['status'](_0x735c02)[_0x65c9('0x27')](_0x5d47cd);};}exports['index']=function(_0x3e2936,_0x3a3ff3){var _0x5f4ac1={},_0xcff050={},_0x3be074={'count':0x0,'rows':[]};var _0x93cbec=_[_0x65c9('0x28')](db[_0x65c9('0x29')][_0x65c9('0x2a')],function(_0x45ae8b){return{'name':_0x45ae8b[_0x65c9('0x2b')],'type':_0x45ae8b[_0x65c9('0x2c')][_0x65c9('0x2d')]};});_0xcff050[_0x65c9('0x2e')]=_[_0x65c9('0x28')](_0x93cbec,'name');_0xcff050[_0x65c9('0x2f')]=_['keys'](_0x3e2936['query']);_0xcff050['filters']=_[_0x65c9('0x30')](_0xcff050[_0x65c9('0x2e')],_0xcff050[_0x65c9('0x2f')]);_0x5f4ac1[_0x65c9('0x31')]=_[_0x65c9('0x30')](_0xcff050[_0x65c9('0x2e')],qs[_0x65c9('0x32')](_0x3e2936[_0x65c9('0x2f')][_0x65c9('0x32')]));_0x5f4ac1[_0x65c9('0x31')]=_0x5f4ac1[_0x65c9('0x31')][_0x65c9('0x33')]?_0x5f4ac1['attributes']:_0xcff050['model'];if(!_0x3e2936[_0x65c9('0x2f')][_0x65c9('0x34')](_0x65c9('0x35'))){_0x5f4ac1[_0x65c9('0x1b')]=qs[_0x65c9('0x1b')](_0x3e2936[_0x65c9('0x2f')]['limit']);_0x5f4ac1[_0x65c9('0x19')]=qs[_0x65c9('0x19')](_0x3e2936[_0x65c9('0x2f')][_0x65c9('0x19')]);}_0x5f4ac1['order']=qs[_0x65c9('0x36')](_0x3e2936[_0x65c9('0x2f')][_0x65c9('0x36')]);_0x5f4ac1[_0x65c9('0x37')]=qs[_0x65c9('0x38')](_[_0x65c9('0x39')](_0x3e2936[_0x65c9('0x2f')],_0xcff050['filters']),_0x93cbec);if(_0x3e2936[_0x65c9('0x2f')][_0x65c9('0x3a')]){_0x5f4ac1['where']=_[_0x65c9('0x3b')](_0x5f4ac1['where'],{'$or':_[_0x65c9('0x28')](_0x93cbec,function(_0x3968cc){if(_0x3968cc[_0x65c9('0x2c')]!==_0x65c9('0x3c')){var _0x4891f8={};_0x4891f8[_0x3968cc['name']]={'$like':'%'+_0x3e2936[_0x65c9('0x2f')][_0x65c9('0x3a')]+'%'};return _0x4891f8;}})});}_0x5f4ac1=_['merge']({},_0x5f4ac1,_0x3e2936['options']);var _0x282d47={'where':_0x5f4ac1[_0x65c9('0x37')]};return db[_0x65c9('0x29')][_0x65c9('0x3d')](_0x282d47)[_0x65c9('0x20')](function(_0x22aeed){_0x3be074[_0x65c9('0x3d')]=_0x22aeed;if(_0x3e2936['query'][_0x65c9('0x3e')]){_0x5f4ac1['include']=[{'all':!![]}];}return db[_0x65c9('0x29')]['findAll'](_0x5f4ac1);})[_0x65c9('0x20')](function(_0x3b27af){_0x3be074[_0x65c9('0x3f')]=_0x3b27af;return _0x3be074;})[_0x65c9('0x20')](respondWithFilteredResult(_0x3a3ff3,_0x5f4ac1))['catch'](handleError(_0x3a3ff3,null));};exports[_0x65c9('0x40')]=function(_0x49c269,_0x4ec6b9){var _0x5e2800={'raw':![],'where':{'id':_0x49c269[_0x65c9('0x41')]['id']}},_0x4e8d50={};_0x4e8d50[_0x65c9('0x2e')]=_[_0x65c9('0x42')](db[_0x65c9('0x29')][_0x65c9('0x2a')]);_0x4e8d50['query']=_[_0x65c9('0x42')](_0x49c269['query']);_0x4e8d50[_0x65c9('0x38')]=_[_0x65c9('0x30')](_0x4e8d50['model'],_0x4e8d50[_0x65c9('0x2f')]);_0x5e2800[_0x65c9('0x31')]=_[_0x65c9('0x30')](_0x4e8d50[_0x65c9('0x2e')],qs['fields'](_0x49c269['query'][_0x65c9('0x32')]));_0x5e2800[_0x65c9('0x31')]=_0x5e2800[_0x65c9('0x31')][_0x65c9('0x33')]?_0x5e2800['attributes']:_0x4e8d50[_0x65c9('0x2e')];if(_0x49c269[_0x65c9('0x2f')][_0x65c9('0x3e')]){_0x5e2800[_0x65c9('0x43')]=[{'all':!![]}];}_0x5e2800=_[_0x65c9('0x3b')]({},_0x5e2800,_0x49c269[_0x65c9('0x44')]);return db[_0x65c9('0x29')][_0x65c9('0x45')](_0x5e2800)[_0x65c9('0x20')](handleEntityNotFound(_0x4ec6b9,null))[_0x65c9('0x20')](respondWithResult(_0x4ec6b9,null))['catch'](handleError(_0x4ec6b9,null));};exports[_0x65c9('0x46')]=function(_0xd8a4ef,_0x235639){return db[_0x65c9('0x29')][_0x65c9('0x46')](_0xd8a4ef['body'],{})[_0x65c9('0x20')](function(_0x494dc1){var _0x43fcff=_0xd8a4ef[_0x65c9('0x47')][_0x65c9('0x48')]({'plain':!![]});if(!_0x43fcff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43fcff[_0x65c9('0x49')]===_0x65c9('0x47')){var _0x5b27a3=_0x494dc1[_0x65c9('0x48')]({'plain':!![]});var _0x1fbd65=_0x65c9('0x21');return db[_0x65c9('0x4a')][_0x65c9('0x45')]({'where':{'name':_0x1fbd65,'userProfileId':_0x43fcff[_0x65c9('0x4b')]},'raw':!![]})[_0x65c9('0x20')](function(_0x3fa4df){if(_0x3fa4df&&_0x3fa4df['autoAssociation']===0x0){return db[_0x65c9('0x22')][_0x65c9('0x46')]({'name':_0x5b27a3[_0x65c9('0x26')],'resourceId':_0x5b27a3['id'],'type':_0x3fa4df[_0x65c9('0x26')],'sectionId':_0x3fa4df['id']},{})[_0x65c9('0x20')](function(){return _0x494dc1;});}else{return _0x494dc1;}})['catch'](function(_0x14a25b){logger['error'](_0x65c9('0x4c'),_0x14a25b);throw _0x14a25b;});}return _0x494dc1;})[_0x65c9('0x20')](respondWithResult(_0x235639,0xc9))[_0x65c9('0x4d')](handleError(_0x235639,null));};exports[_0x65c9('0x4e')]=function(_0x2cd428,_0x2cb9bf){if(_0x2cd428['body']['id']){delete _0x2cd428[_0x65c9('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x2cd428[_0x65c9('0x41')]['id']}})['then'](handleEntityNotFound(_0x2cb9bf,null))[_0x65c9('0x20')](saveUpdates(_0x2cd428[_0x65c9('0x4f')],null))[_0x65c9('0x20')](respondWithResult(_0x2cb9bf,null))[_0x65c9('0x4d')](handleError(_0x2cb9bf,null));};exports[_0x65c9('0x23')]=function(_0x3a8067,_0x338c78){return db[_0x65c9('0x29')][_0x65c9('0x45')]({'where':{'id':_0x3a8067[_0x65c9('0x41')]['id']}})[_0x65c9('0x20')](handleEntityNotFound(_0x338c78,null))[_0x65c9('0x20')](removeEntity(_0x338c78,null))[_0x65c9('0x4d')](handleError(_0x338c78,null));};exports['addAllCondition']=function(_0x2a08a2,_0x4db1f0,_0x142048){if(_0x2a08a2[_0x65c9('0x4f')]['id']){delete _0x2a08a2[_0x65c9('0x4f')]['id'];}return db['Trigger'][_0x65c9('0x45')]({'where':{'id':_0x2a08a2[_0x65c9('0x41')]['id']}})[_0x65c9('0x20')](handleEntityNotFound(_0x4db1f0,null))[_0x65c9('0x20')](function(_0x389c9c){if(_0x389c9c){_0x2a08a2[_0x65c9('0x4f')][_0x65c9('0x50')]=_0x389c9c['id'];return db['Condition']['create'](_0x2a08a2[_0x65c9('0x4f')]);}})['then'](respondWithResult(_0x4db1f0,null))[_0x65c9('0x4d')](handleError(_0x4db1f0,null));};exports[_0x65c9('0x51')]=function(_0x7c52b,_0x18c387,_0x21ed5b){if(_0x7c52b['body']['id']){delete _0x7c52b[_0x65c9('0x4f')]['id'];}return db[_0x65c9('0x29')][_0x65c9('0x45')]({'where':{'id':_0x7c52b[_0x65c9('0x41')]['id']}})[_0x65c9('0x20')](handleEntityNotFound(_0x18c387,null))[_0x65c9('0x20')](function(_0x58024e){if(_0x58024e){_0x7c52b['body'][_0x65c9('0x52')]=_0x58024e['id'];return db[_0x65c9('0x53')][_0x65c9('0x46')](_0x7c52b['body']);}})['then'](respondWithResult(_0x18c387,null))[_0x65c9('0x4d')](handleError(_0x18c387,null));};exports['getAllConditions']=function(_0x2559bb,_0x508406,_0xa3000e){var _0x5e7775={};var _0x3fcd6b={};var _0x45f7fc;var _0x5d94a7;return db[_0x65c9('0x29')][_0x65c9('0x54')]({'where':{'id':_0x2559bb[_0x65c9('0x41')]['id']}})[_0x65c9('0x20')](handleEntityNotFound(_0x508406,null))[_0x65c9('0x20')](function(_0x40db60){if(_0x40db60){_0x45f7fc=_0x40db60;_0x3fcd6b[_0x65c9('0x2e')]=_[_0x65c9('0x42')](db[_0x65c9('0x53')]['rawAttributes']);_0x3fcd6b['query']=_[_0x65c9('0x42')](_0x2559bb['query']);_0x3fcd6b[_0x65c9('0x38')]=_[_0x65c9('0x30')](_0x3fcd6b[_0x65c9('0x2e')],_0x3fcd6b[_0x65c9('0x2f')]);_0x5e7775['attributes']=_[_0x65c9('0x30')](_0x3fcd6b[_0x65c9('0x2e')],qs[_0x65c9('0x32')](_0x2559bb[_0x65c9('0x2f')][_0x65c9('0x32')]));_0x5e7775[_0x65c9('0x31')]=_0x5e7775[_0x65c9('0x31')][_0x65c9('0x33')]?_0x5e7775[_0x65c9('0x31')]:_0x3fcd6b[_0x65c9('0x2e')];_0x5e7775[_0x65c9('0x55')]=qs[_0x65c9('0x36')](_0x2559bb[_0x65c9('0x2f')][_0x65c9('0x36')]);_0x5e7775['where']=qs[_0x65c9('0x38')](_[_0x65c9('0x39')](_0x2559bb[_0x65c9('0x2f')],_0x3fcd6b['filters']));if(_0x2559bb['query'][_0x65c9('0x3a')]){_0x5e7775[_0x65c9('0x37')]=_[_0x65c9('0x3b')](_0x5e7775['where'],{'$or':_['map'](_0x5e7775[_0x65c9('0x31')],function(_0x4ae5d4){var _0x5c3cf7={};_0x5c3cf7[_0x4ae5d4]={'$like':'%'+_0x2559bb[_0x65c9('0x2f')][_0x65c9('0x3a')]+'%'};return _0x5c3cf7;})});}_0x5e7775=_[_0x65c9('0x3b')]({},_0x5e7775,_0x2559bb[_0x65c9('0x44')]);return _0x45f7fc[_0x65c9('0x56')](_0x5e7775);}})[_0x65c9('0x20')](function(_0x28b669){if(_0x28b669){_0x5d94a7=_0x28b669['length'];if(!_0x2559bb[_0x65c9('0x2f')][_0x65c9('0x34')](_0x65c9('0x35'))){_0x5e7775[_0x65c9('0x1b')]=qs['limit'](_0x2559bb[_0x65c9('0x2f')][_0x65c9('0x1b')]);_0x5e7775[_0x65c9('0x19')]=qs[_0x65c9('0x19')](_0x2559bb['query'][_0x65c9('0x19')]);}return _0x45f7fc[_0x65c9('0x56')](_0x5e7775);}})['then'](function(_0x13388c){if(_0x13388c){return _0x13388c?{'count':_0x5d94a7,'rows':_0x13388c}:null;}})[_0x65c9('0x20')](respondWithResult(_0x508406,null))['catch'](handleError(_0x508406,null));};exports[_0x65c9('0x57')]=function(_0x599d81,_0x800e5b,_0x4046f1){var _0x199250={};var _0x51e1e={};var _0x477d9b;var _0x4f01c0;return db[_0x65c9('0x29')]['findOne']({'where':{'id':_0x599d81[_0x65c9('0x41')]['id']}})[_0x65c9('0x20')](handleEntityNotFound(_0x800e5b,null))[_0x65c9('0x20')](function(_0x333820){if(_0x333820){_0x477d9b=_0x333820;_0x51e1e[_0x65c9('0x2e')]=_[_0x65c9('0x42')](db[_0x65c9('0x53')][_0x65c9('0x2a')]);_0x51e1e[_0x65c9('0x2f')]=_[_0x65c9('0x42')](_0x599d81['query']);_0x51e1e['filters']=_[_0x65c9('0x30')](_0x51e1e[_0x65c9('0x2e')],_0x51e1e[_0x65c9('0x2f')]);_0x199250[_0x65c9('0x31')]=_[_0x65c9('0x30')](_0x51e1e[_0x65c9('0x2e')],qs[_0x65c9('0x32')](_0x599d81[_0x65c9('0x2f')]['fields']));_0x199250[_0x65c9('0x31')]=_0x199250[_0x65c9('0x31')][_0x65c9('0x33')]?_0x199250['attributes']:_0x51e1e[_0x65c9('0x2e')];_0x199250[_0x65c9('0x55')]=qs[_0x65c9('0x36')](_0x599d81[_0x65c9('0x2f')][_0x65c9('0x36')]);_0x199250[_0x65c9('0x37')]=qs[_0x65c9('0x38')](_[_0x65c9('0x39')](_0x599d81[_0x65c9('0x2f')],_0x51e1e['filters']));if(_0x599d81[_0x65c9('0x2f')][_0x65c9('0x3a')]){_0x199250[_0x65c9('0x37')]=_[_0x65c9('0x3b')](_0x199250[_0x65c9('0x37')],{'$or':_[_0x65c9('0x28')](_0x199250[_0x65c9('0x31')],function(_0x3b73b3){var _0x4ff0ab={};_0x4ff0ab[_0x3b73b3]={'$like':'%'+_0x599d81['query'][_0x65c9('0x3a')]+'%'};return _0x4ff0ab;})});}_0x199250=_[_0x65c9('0x3b')]({},_0x199250,_0x599d81[_0x65c9('0x44')]);return _0x477d9b[_0x65c9('0x57')](_0x199250);}})[_0x65c9('0x20')](function(_0x19f5cb){if(_0x19f5cb){_0x4f01c0=_0x19f5cb['length'];if(!_0x599d81[_0x65c9('0x2f')][_0x65c9('0x34')](_0x65c9('0x35'))){_0x199250['limit']=qs['limit'](_0x599d81[_0x65c9('0x2f')][_0x65c9('0x1b')]);_0x199250[_0x65c9('0x19')]=qs['offset'](_0x599d81[_0x65c9('0x2f')][_0x65c9('0x19')]);}return _0x477d9b['getAnyConditions'](_0x199250);}})[_0x65c9('0x20')](function(_0x11c74d){if(_0x11c74d){return _0x11c74d?{'count':_0x4f01c0,'rows':_0x11c74d}:null;}})[_0x65c9('0x20')](respondWithResult(_0x800e5b,null))[_0x65c9('0x4d')](handleError(_0x800e5b,null));};exports['addAction']=function(_0x296f1f,_0x1a3e81,_0x45fcff){if(_0x296f1f[_0x65c9('0x4f')]['id']){delete _0x296f1f[_0x65c9('0x4f')]['id'];}return db[_0x65c9('0x29')][_0x65c9('0x45')]({'where':{'id':_0x296f1f[_0x65c9('0x41')]['id']}})[_0x65c9('0x20')](handleEntityNotFound(_0x1a3e81,null))[_0x65c9('0x20')](function(_0xbbde2b){if(_0xbbde2b){_0x296f1f[_0x65c9('0x4f')][_0x65c9('0x58')]=_0xbbde2b['id'];return db[_0x65c9('0x59')][_0x65c9('0x46')](_0x296f1f[_0x65c9('0x4f')]);}})[_0x65c9('0x20')](respondWithResult(_0x1a3e81,null))['catch'](handleError(_0x1a3e81,null));};exports[_0x65c9('0x5a')]=function(_0xac5e7a,_0x5cc5ce,_0x54054f){var _0x24ddad={};var _0x2f0d64={};var _0x48853b;var _0x3a4aeb;return db[_0x65c9('0x29')][_0x65c9('0x54')]({'where':{'id':_0xac5e7a[_0x65c9('0x41')]['id']}})['then'](handleEntityNotFound(_0x5cc5ce,null))[_0x65c9('0x20')](function(_0xeb09be){if(_0xeb09be){_0x48853b=_0xeb09be;_0x2f0d64[_0x65c9('0x2e')]=_[_0x65c9('0x42')](db[_0x65c9('0x59')]['rawAttributes']);_0x2f0d64['query']=_[_0x65c9('0x42')](_0xac5e7a[_0x65c9('0x2f')]);_0x2f0d64['filters']=_[_0x65c9('0x30')](_0x2f0d64['model'],_0x2f0d64[_0x65c9('0x2f')]);_0x24ddad[_0x65c9('0x31')]=_[_0x65c9('0x30')](_0x2f0d64[_0x65c9('0x2e')],qs[_0x65c9('0x32')](_0xac5e7a[_0x65c9('0x2f')][_0x65c9('0x32')]));_0x24ddad['attributes']=_0x24ddad[_0x65c9('0x31')][_0x65c9('0x33')]?_0x24ddad[_0x65c9('0x31')]:_0x2f0d64[_0x65c9('0x2e')];_0x24ddad[_0x65c9('0x55')]=qs[_0x65c9('0x36')](_0xac5e7a[_0x65c9('0x2f')][_0x65c9('0x36')]);_0x24ddad[_0x65c9('0x37')]=qs[_0x65c9('0x38')](_['pick'](_0xac5e7a[_0x65c9('0x2f')],_0x2f0d64[_0x65c9('0x38')]));if(_0xac5e7a[_0x65c9('0x2f')][_0x65c9('0x3a')]){_0x24ddad[_0x65c9('0x37')]=_[_0x65c9('0x3b')](_0x24ddad[_0x65c9('0x37')],{'$or':_[_0x65c9('0x28')](_0x24ddad[_0x65c9('0x31')],function(_0x3049e8){var _0x4725d7={};_0x4725d7[_0x3049e8]={'$like':'%'+_0xac5e7a[_0x65c9('0x2f')]['filter']+'%'};return _0x4725d7;})});}_0x24ddad=_[_0x65c9('0x3b')]({},_0x24ddad,_0xac5e7a[_0x65c9('0x44')]);return _0x48853b[_0x65c9('0x5a')](_0x24ddad);}})[_0x65c9('0x20')](function(_0x25ee7a){if(_0x25ee7a){_0x3a4aeb=_0x25ee7a[_0x65c9('0x33')];if(!_0xac5e7a[_0x65c9('0x2f')][_0x65c9('0x34')](_0x65c9('0x35'))){_0x24ddad['limit']=qs['limit'](_0xac5e7a[_0x65c9('0x2f')]['limit']);_0x24ddad['offset']=qs[_0x65c9('0x19')](_0xac5e7a['query'][_0x65c9('0x19')]);}return _0x48853b[_0x65c9('0x5a')](_0x24ddad);}})['then'](function(_0x4a97a5){if(_0x4a97a5){return _0x4a97a5?{'count':_0x3a4aeb,'rows':_0x4a97a5}:null;}})['then'](respondWithResult(_0x5cc5ce,null))[_0x65c9('0x4d')](handleError(_0x5cc5ce,null));}; \ No newline at end of file +var _0x9468=['order','sort','filters','filter','where','merge','options','Trigger','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','limit','count','offset','status','Content-Range','json','apply','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x3c5e3b,_0xda12a2){var _0x4f681f=function(_0x44e0e2){while(--_0x44e0e2){_0x3c5e3b['push'](_0x3c5e3b['shift']());}};_0x4f681f(++_0xda12a2);}(_0x9468,0x87));var _0x8946=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x9468[_0x3f6565];return _0x4abd23;};'use strict';var emlformat=require(_0x8946('0x0'));var rimraf=require(_0x8946('0x1'));var zipdir=require(_0x8946('0x2'));var jsonpatch=require(_0x8946('0x3'));var rp=require(_0x8946('0x4'));var moment=require('moment');var BPromise=require(_0x8946('0x5'));var Mustache=require(_0x8946('0x6'));var util=require(_0x8946('0x7'));var path=require(_0x8946('0x8'));var sox=require(_0x8946('0x9'));var csv=require(_0x8946('0xa'));var ejs=require(_0x8946('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8946('0xc'));var crypto=require(_0x8946('0xd'));var jsforce=require(_0x8946('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8946('0xa'));var querystring=require('querystring');var Papa=require(_0x8946('0xf'));var Redis=require(_0x8946('0x10'));var authService=require(_0x8946('0x11'));var qs=require(_0x8946('0x12'));var as=require(_0x8946('0x13'));var hardwareService=require(_0x8946('0x14'));var logger=require('../../config/logger')(_0x8946('0x15'));var utils=require(_0x8946('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8946('0x17'));var db=require(_0x8946('0x18'))['db'];function respondWithStatusCode(_0xb9e0c,_0x11071a){_0x11071a=_0x11071a||0xcc;return function(_0x4c9b0b){if(_0x4c9b0b){return _0xb9e0c['sendStatus'](_0x11071a);}return _0xb9e0c['status'](_0x11071a)[_0x8946('0x19')]();};}function respondWithResult(_0x285a1d,_0x4017ac){_0x4017ac=_0x4017ac||0xc8;return function(_0x2656ca){if(_0x2656ca){return _0x285a1d['status'](_0x4017ac)['json'](_0x2656ca);}};}function respondWithFilteredResult(_0x25a5ee,_0x15ae96){return function(_0x3103f5){if(_0x3103f5){var _0x1cb38e=typeof _0x15ae96['offset']===_0x8946('0x1a')&&typeof _0x15ae96[_0x8946('0x1b')]===_0x8946('0x1a');var _0x397824=_0x3103f5[_0x8946('0x1c')];var _0x44ea9=_0x1cb38e?0x0:_0x15ae96[_0x8946('0x1d')];var _0x1b4673=_0x1cb38e?_0x3103f5[_0x8946('0x1c')]:_0x15ae96[_0x8946('0x1d')]+_0x15ae96[_0x8946('0x1b')];var _0x1ec6fa;if(_0x1b4673>=_0x397824){_0x1b4673=_0x397824;_0x1ec6fa=0xc8;}else{_0x1ec6fa=0xce;}_0x25a5ee[_0x8946('0x1e')](_0x1ec6fa);return _0x25a5ee['set'](_0x8946('0x1f'),_0x44ea9+'-'+_0x1b4673+'/'+_0x397824)[_0x8946('0x20')](_0x3103f5);}return null;};}function patchUpdates(_0x3aeaf3){return function(_0xa226f4){try{jsonpatch[_0x8946('0x21')](_0xa226f4,_0x3aeaf3,!![]);}catch(_0x12059a){return BPromise['reject'](_0x12059a);}return _0xa226f4['save']();};}function saveUpdates(_0x27353c,_0x4006b1){return function(_0x19bb8e){if(_0x19bb8e){return _0x19bb8e[_0x8946('0x22')](_0x27353c)[_0x8946('0x23')](function(_0x44d843){return _0x44d843;});}return null;};}function removeEntity(_0x4b581d,_0x338871){return function(_0x94d102){if(_0x94d102){return _0x94d102[_0x8946('0x24')]()[_0x8946('0x23')](function(){var _0x3ee022=_0x94d102[_0x8946('0x25')]({'plain':!![]});var _0x277c0f=_0x8946('0x26');return db[_0x8946('0x27')]['destroy']({'where':{'type':_0x277c0f,'resourceId':_0x3ee022['id']}})[_0x8946('0x23')](function(){return _0x94d102;});})['then'](function(){_0x4b581d[_0x8946('0x1e')](0xcc)[_0x8946('0x19')]();});}};}function handleEntityNotFound(_0x252cf9,_0x46d877){return function(_0x2f051f){if(!_0x2f051f){_0x252cf9[_0x8946('0x28')](0x194);}return _0x2f051f;};}function handleError(_0x9a7c0b,_0x467c7b){_0x467c7b=_0x467c7b||0x1f4;return function(_0x2700c9){logger[_0x8946('0x29')](_0x2700c9[_0x8946('0x2a')]);if(_0x2700c9[_0x8946('0x2b')]){delete _0x2700c9['name'];}_0x9a7c0b[_0x8946('0x1e')](_0x467c7b)[_0x8946('0x2c')](_0x2700c9);};}exports[_0x8946('0x2d')]=function(_0x2e1e83,_0x397584){var _0x3c53c7={},_0x5bd855={},_0x3ebf3a={'count':0x0,'rows':[]};var _0x9d2bad=_[_0x8946('0x2e')](db['Trigger'][_0x8946('0x2f')],function(_0x426753){return{'name':_0x426753['fieldName'],'type':_0x426753[_0x8946('0x30')][_0x8946('0x31')]};});_0x5bd855[_0x8946('0x32')]=_['map'](_0x9d2bad,_0x8946('0x2b'));_0x5bd855[_0x8946('0x33')]=_['keys'](_0x2e1e83[_0x8946('0x33')]);_0x5bd855['filters']=_[_0x8946('0x34')](_0x5bd855[_0x8946('0x32')],_0x5bd855[_0x8946('0x33')]);_0x3c53c7[_0x8946('0x35')]=_[_0x8946('0x34')](_0x5bd855[_0x8946('0x32')],qs[_0x8946('0x36')](_0x2e1e83[_0x8946('0x33')][_0x8946('0x36')]));_0x3c53c7[_0x8946('0x35')]=_0x3c53c7['attributes']['length']?_0x3c53c7[_0x8946('0x35')]:_0x5bd855['model'];if(!_0x2e1e83[_0x8946('0x33')][_0x8946('0x37')](_0x8946('0x38'))){_0x3c53c7[_0x8946('0x1b')]=qs[_0x8946('0x1b')](_0x2e1e83[_0x8946('0x33')][_0x8946('0x1b')]);_0x3c53c7[_0x8946('0x1d')]=qs[_0x8946('0x1d')](_0x2e1e83['query']['offset']);}_0x3c53c7[_0x8946('0x39')]=qs[_0x8946('0x3a')](_0x2e1e83[_0x8946('0x33')][_0x8946('0x3a')]);_0x3c53c7['where']=qs[_0x8946('0x3b')](_['pick'](_0x2e1e83['query'],_0x5bd855['filters']),_0x9d2bad);if(_0x2e1e83['query'][_0x8946('0x3c')]){_0x3c53c7[_0x8946('0x3d')]=_[_0x8946('0x3e')](_0x3c53c7['where'],{'$or':_[_0x8946('0x2e')](_0x9d2bad,function(_0xec7ce9){if(_0xec7ce9[_0x8946('0x30')]!=='VIRTUAL'){var _0x16c7e7={};_0x16c7e7[_0xec7ce9[_0x8946('0x2b')]]={'$like':'%'+_0x2e1e83['query'][_0x8946('0x3c')]+'%'};return _0x16c7e7;}})});}_0x3c53c7=_['merge']({},_0x3c53c7,_0x2e1e83[_0x8946('0x3f')]);var _0x37a683={'where':_0x3c53c7['where']};return db[_0x8946('0x40')][_0x8946('0x1c')](_0x37a683)[_0x8946('0x23')](function(_0x38ea1a){_0x3ebf3a[_0x8946('0x1c')]=_0x38ea1a;if(_0x2e1e83[_0x8946('0x33')][_0x8946('0x41')]){_0x3c53c7[_0x8946('0x42')]=[{'all':!![]}];}return db[_0x8946('0x40')][_0x8946('0x43')](_0x3c53c7);})['then'](function(_0x1bc6ce){_0x3ebf3a[_0x8946('0x44')]=_0x1bc6ce;return _0x3ebf3a;})[_0x8946('0x23')](respondWithFilteredResult(_0x397584,_0x3c53c7))[_0x8946('0x45')](handleError(_0x397584,null));};exports[_0x8946('0x46')]=function(_0x41e3a0,_0x25e580){var _0x329428={'raw':![],'where':{'id':_0x41e3a0[_0x8946('0x47')]['id']}},_0x47a4fd={};_0x47a4fd[_0x8946('0x32')]=_[_0x8946('0x48')](db['Trigger'][_0x8946('0x2f')]);_0x47a4fd[_0x8946('0x33')]=_[_0x8946('0x48')](_0x41e3a0['query']);_0x47a4fd[_0x8946('0x3b')]=_[_0x8946('0x34')](_0x47a4fd['model'],_0x47a4fd[_0x8946('0x33')]);_0x329428[_0x8946('0x35')]=_[_0x8946('0x34')](_0x47a4fd[_0x8946('0x32')],qs[_0x8946('0x36')](_0x41e3a0[_0x8946('0x33')][_0x8946('0x36')]));_0x329428['attributes']=_0x329428['attributes'][_0x8946('0x49')]?_0x329428[_0x8946('0x35')]:_0x47a4fd[_0x8946('0x32')];if(_0x41e3a0[_0x8946('0x33')][_0x8946('0x41')]){_0x329428['include']=[{'all':!![]}];}_0x329428=_[_0x8946('0x3e')]({},_0x329428,_0x41e3a0['options']);return db['Trigger']['find'](_0x329428)['then'](handleEntityNotFound(_0x25e580,null))[_0x8946('0x23')](respondWithResult(_0x25e580,null))['catch'](handleError(_0x25e580,null));};exports['create']=function(_0x15fe43,_0x23c80b){return db[_0x8946('0x40')][_0x8946('0x4a')](_0x15fe43[_0x8946('0x4b')],{})[_0x8946('0x23')](function(_0x3dcf34){var _0x2d86f4=_0x15fe43[_0x8946('0x4c')][_0x8946('0x25')]({'plain':!![]});if(!_0x2d86f4)throw new Error(_0x8946('0x4d'));if(_0x2d86f4[_0x8946('0x4e')]===_0x8946('0x4c')){var _0x2b5387=_0x3dcf34[_0x8946('0x25')]({'plain':!![]});var _0x207448=_0x8946('0x26');return db[_0x8946('0x4f')][_0x8946('0x50')]({'where':{'name':_0x207448,'userProfileId':_0x2d86f4[_0x8946('0x51')]},'raw':!![]})[_0x8946('0x23')](function(_0x163c75){if(_0x163c75&&_0x163c75[_0x8946('0x52')]===0x0){return db[_0x8946('0x27')][_0x8946('0x4a')]({'name':_0x2b5387[_0x8946('0x2b')],'resourceId':_0x2b5387['id'],'type':_0x163c75[_0x8946('0x2b')],'sectionId':_0x163c75['id']},{})[_0x8946('0x23')](function(){return _0x3dcf34;});}else{return _0x3dcf34;}})[_0x8946('0x45')](function(_0x4850f7){logger[_0x8946('0x29')](_0x8946('0x53'),_0x4850f7);throw _0x4850f7;});}return _0x3dcf34;})[_0x8946('0x23')](respondWithResult(_0x23c80b,0xc9))[_0x8946('0x45')](handleError(_0x23c80b,null));};exports[_0x8946('0x22')]=function(_0x5b6ea5,_0xb31e57){if(_0x5b6ea5[_0x8946('0x4b')]['id']){delete _0x5b6ea5[_0x8946('0x4b')]['id'];}return db[_0x8946('0x40')]['find']({'where':{'id':_0x5b6ea5[_0x8946('0x47')]['id']}})[_0x8946('0x23')](handleEntityNotFound(_0xb31e57,null))[_0x8946('0x23')](saveUpdates(_0x5b6ea5[_0x8946('0x4b')],null))['then'](respondWithResult(_0xb31e57,null))[_0x8946('0x45')](handleError(_0xb31e57,null));};exports['destroy']=function(_0x55fc33,_0x160c2d){return db[_0x8946('0x40')][_0x8946('0x50')]({'where':{'id':_0x55fc33['params']['id']}})[_0x8946('0x23')](handleEntityNotFound(_0x160c2d,null))[_0x8946('0x23')](removeEntity(_0x160c2d,null))[_0x8946('0x45')](handleError(_0x160c2d,null));};exports[_0x8946('0x54')]=function(_0x223c93,_0x2dcf92,_0x35a1e9){if(_0x223c93[_0x8946('0x4b')]['id']){delete _0x223c93[_0x8946('0x4b')]['id'];}return db[_0x8946('0x40')][_0x8946('0x50')]({'where':{'id':_0x223c93[_0x8946('0x47')]['id']}})['then'](handleEntityNotFound(_0x2dcf92,null))['then'](function(_0x52d82b){if(_0x52d82b){_0x223c93[_0x8946('0x4b')][_0x8946('0x55')]=_0x52d82b['id'];return db[_0x8946('0x56')]['create'](_0x223c93['body']);}})['then'](respondWithResult(_0x2dcf92,null))[_0x8946('0x45')](handleError(_0x2dcf92,null));};exports[_0x8946('0x57')]=function(_0x441f44,_0x4a64c0,_0x55d9da){if(_0x441f44['body']['id']){delete _0x441f44['body']['id'];}return db[_0x8946('0x40')][_0x8946('0x50')]({'where':{'id':_0x441f44[_0x8946('0x47')]['id']}})[_0x8946('0x23')](handleEntityNotFound(_0x4a64c0,null))[_0x8946('0x23')](function(_0x1dae45){if(_0x1dae45){_0x441f44['body'][_0x8946('0x58')]=_0x1dae45['id'];return db[_0x8946('0x56')][_0x8946('0x4a')](_0x441f44['body']);}})['then'](respondWithResult(_0x4a64c0,null))[_0x8946('0x45')](handleError(_0x4a64c0,null));};exports[_0x8946('0x59')]=function(_0x1d4ad5,_0x1493ad,_0x295e27){var _0x6e6f59={};var _0xaff61f={};var _0x343310;var _0x2f4abe;return db[_0x8946('0x40')][_0x8946('0x5a')]({'where':{'id':_0x1d4ad5[_0x8946('0x47')]['id']}})['then'](handleEntityNotFound(_0x1493ad,null))[_0x8946('0x23')](function(_0x4569ef){if(_0x4569ef){_0x343310=_0x4569ef;_0xaff61f['model']=_['keys'](db[_0x8946('0x56')][_0x8946('0x2f')]);_0xaff61f[_0x8946('0x33')]=_[_0x8946('0x48')](_0x1d4ad5[_0x8946('0x33')]);_0xaff61f[_0x8946('0x3b')]=_['intersection'](_0xaff61f['model'],_0xaff61f[_0x8946('0x33')]);_0x6e6f59[_0x8946('0x35')]=_[_0x8946('0x34')](_0xaff61f[_0x8946('0x32')],qs[_0x8946('0x36')](_0x1d4ad5['query']['fields']));_0x6e6f59[_0x8946('0x35')]=_0x6e6f59[_0x8946('0x35')][_0x8946('0x49')]?_0x6e6f59['attributes']:_0xaff61f['model'];_0x6e6f59['order']=qs[_0x8946('0x3a')](_0x1d4ad5[_0x8946('0x33')][_0x8946('0x3a')]);_0x6e6f59[_0x8946('0x3d')]=qs[_0x8946('0x3b')](_['pick'](_0x1d4ad5[_0x8946('0x33')],_0xaff61f[_0x8946('0x3b')]));if(_0x1d4ad5['query'][_0x8946('0x3c')]){_0x6e6f59[_0x8946('0x3d')]=_['merge'](_0x6e6f59[_0x8946('0x3d')],{'$or':_[_0x8946('0x2e')](_0x6e6f59[_0x8946('0x35')],function(_0x296dbf){var _0x1b9f84={};_0x1b9f84[_0x296dbf]={'$like':'%'+_0x1d4ad5[_0x8946('0x33')][_0x8946('0x3c')]+'%'};return _0x1b9f84;})});}_0x6e6f59=_[_0x8946('0x3e')]({},_0x6e6f59,_0x1d4ad5['options']);return _0x343310[_0x8946('0x59')](_0x6e6f59);}})['then'](function(_0x1d7240){if(_0x1d7240){_0x2f4abe=_0x1d7240['length'];if(!_0x1d4ad5[_0x8946('0x33')]['hasOwnProperty'](_0x8946('0x38'))){_0x6e6f59[_0x8946('0x1b')]=qs[_0x8946('0x1b')](_0x1d4ad5[_0x8946('0x33')]['limit']);_0x6e6f59[_0x8946('0x1d')]=qs['offset'](_0x1d4ad5[_0x8946('0x33')][_0x8946('0x1d')]);}return _0x343310[_0x8946('0x59')](_0x6e6f59);}})[_0x8946('0x23')](function(_0x2617e1){if(_0x2617e1){return _0x2617e1?{'count':_0x2f4abe,'rows':_0x2617e1}:null;}})[_0x8946('0x23')](respondWithResult(_0x1493ad,null))[_0x8946('0x45')](handleError(_0x1493ad,null));};exports['getAnyConditions']=function(_0x212c61,_0x325545,_0x374156){var _0x1ef1cd={};var _0x53f51={};var _0xfc7ced;var _0x2ba191;return db['Trigger'][_0x8946('0x5a')]({'where':{'id':_0x212c61[_0x8946('0x47')]['id']}})[_0x8946('0x23')](handleEntityNotFound(_0x325545,null))[_0x8946('0x23')](function(_0x1884ce){if(_0x1884ce){_0xfc7ced=_0x1884ce;_0x53f51['model']=_['keys'](db[_0x8946('0x56')]['rawAttributes']);_0x53f51['query']=_[_0x8946('0x48')](_0x212c61['query']);_0x53f51[_0x8946('0x3b')]=_[_0x8946('0x34')](_0x53f51[_0x8946('0x32')],_0x53f51[_0x8946('0x33')]);_0x1ef1cd['attributes']=_[_0x8946('0x34')](_0x53f51[_0x8946('0x32')],qs[_0x8946('0x36')](_0x212c61[_0x8946('0x33')][_0x8946('0x36')]));_0x1ef1cd[_0x8946('0x35')]=_0x1ef1cd[_0x8946('0x35')]['length']?_0x1ef1cd['attributes']:_0x53f51['model'];_0x1ef1cd[_0x8946('0x39')]=qs[_0x8946('0x3a')](_0x212c61[_0x8946('0x33')]['sort']);_0x1ef1cd[_0x8946('0x3d')]=qs[_0x8946('0x3b')](_[_0x8946('0x5b')](_0x212c61[_0x8946('0x33')],_0x53f51[_0x8946('0x3b')]));if(_0x212c61['query'][_0x8946('0x3c')]){_0x1ef1cd[_0x8946('0x3d')]=_[_0x8946('0x3e')](_0x1ef1cd[_0x8946('0x3d')],{'$or':_['map'](_0x1ef1cd[_0x8946('0x35')],function(_0x33c0fb){var _0x12355d={};_0x12355d[_0x33c0fb]={'$like':'%'+_0x212c61['query'][_0x8946('0x3c')]+'%'};return _0x12355d;})});}_0x1ef1cd=_[_0x8946('0x3e')]({},_0x1ef1cd,_0x212c61[_0x8946('0x3f')]);return _0xfc7ced['getAnyConditions'](_0x1ef1cd);}})['then'](function(_0x2d1890){if(_0x2d1890){_0x2ba191=_0x2d1890['length'];if(!_0x212c61['query'][_0x8946('0x37')](_0x8946('0x38'))){_0x1ef1cd[_0x8946('0x1b')]=qs['limit'](_0x212c61['query'][_0x8946('0x1b')]);_0x1ef1cd[_0x8946('0x1d')]=qs[_0x8946('0x1d')](_0x212c61['query'][_0x8946('0x1d')]);}return _0xfc7ced[_0x8946('0x5c')](_0x1ef1cd);}})[_0x8946('0x23')](function(_0x167a19){if(_0x167a19){return _0x167a19?{'count':_0x2ba191,'rows':_0x167a19}:null;}})['then'](respondWithResult(_0x325545,null))[_0x8946('0x45')](handleError(_0x325545,null));};exports[_0x8946('0x5d')]=function(_0xeb2dc0,_0x5dd1d0,_0x448d8b){if(_0xeb2dc0[_0x8946('0x4b')]['id']){delete _0xeb2dc0[_0x8946('0x4b')]['id'];}return db[_0x8946('0x40')][_0x8946('0x50')]({'where':{'id':_0xeb2dc0[_0x8946('0x47')]['id']}})['then'](handleEntityNotFound(_0x5dd1d0,null))[_0x8946('0x23')](function(_0x1d37aa){if(_0x1d37aa){_0xeb2dc0['body'][_0x8946('0x5e')]=_0x1d37aa['id'];return db[_0x8946('0x5f')]['create'](_0xeb2dc0[_0x8946('0x4b')]);}})['then'](respondWithResult(_0x5dd1d0,null))['catch'](handleError(_0x5dd1d0,null));};exports['getActions']=function(_0x27b56e,_0x2ccd3f,_0x2aa5c5){var _0x448850={};var _0x13e6bf={};var _0x344edf;var _0x3c7ffc;return db['Trigger'][_0x8946('0x5a')]({'where':{'id':_0x27b56e['params']['id']}})[_0x8946('0x23')](handleEntityNotFound(_0x2ccd3f,null))[_0x8946('0x23')](function(_0x1e47e4){if(_0x1e47e4){_0x344edf=_0x1e47e4;_0x13e6bf[_0x8946('0x32')]=_[_0x8946('0x48')](db[_0x8946('0x5f')][_0x8946('0x2f')]);_0x13e6bf[_0x8946('0x33')]=_[_0x8946('0x48')](_0x27b56e[_0x8946('0x33')]);_0x13e6bf[_0x8946('0x3b')]=_[_0x8946('0x34')](_0x13e6bf[_0x8946('0x32')],_0x13e6bf[_0x8946('0x33')]);_0x448850[_0x8946('0x35')]=_[_0x8946('0x34')](_0x13e6bf[_0x8946('0x32')],qs[_0x8946('0x36')](_0x27b56e[_0x8946('0x33')][_0x8946('0x36')]));_0x448850[_0x8946('0x35')]=_0x448850[_0x8946('0x35')][_0x8946('0x49')]?_0x448850[_0x8946('0x35')]:_0x13e6bf[_0x8946('0x32')];_0x448850[_0x8946('0x39')]=qs['sort'](_0x27b56e[_0x8946('0x33')][_0x8946('0x3a')]);_0x448850[_0x8946('0x3d')]=qs[_0x8946('0x3b')](_[_0x8946('0x5b')](_0x27b56e[_0x8946('0x33')],_0x13e6bf[_0x8946('0x3b')]));if(_0x27b56e[_0x8946('0x33')]['filter']){_0x448850[_0x8946('0x3d')]=_[_0x8946('0x3e')](_0x448850[_0x8946('0x3d')],{'$or':_[_0x8946('0x2e')](_0x448850[_0x8946('0x35')],function(_0x485a83){var _0x3b83ac={};_0x3b83ac[_0x485a83]={'$like':'%'+_0x27b56e['query'][_0x8946('0x3c')]+'%'};return _0x3b83ac;})});}_0x448850=_[_0x8946('0x3e')]({},_0x448850,_0x27b56e[_0x8946('0x3f')]);return _0x344edf['getActions'](_0x448850);}})[_0x8946('0x23')](function(_0x59aeab){if(_0x59aeab){_0x3c7ffc=_0x59aeab[_0x8946('0x49')];if(!_0x27b56e[_0x8946('0x33')][_0x8946('0x37')]('nolimit')){_0x448850[_0x8946('0x1b')]=qs[_0x8946('0x1b')](_0x27b56e['query']['limit']);_0x448850[_0x8946('0x1d')]=qs[_0x8946('0x1d')](_0x27b56e[_0x8946('0x33')][_0x8946('0x1d')]);}return _0x344edf['getActions'](_0x448850);}})['then'](function(_0x5883f8){if(_0x5883f8){return _0x5883f8?{'count':_0x3c7ffc,'rows':_0x5883f8}:null;}})[_0x8946('0x23')](respondWithResult(_0x2ccd3f,null))[_0x8946('0x45')](handleError(_0x2ccd3f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 5b3d8b0..838c37e 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 _0x3468=['path','rimraf','define','Trigger','tools_triggers','lodash','api','request-promise'];(function(_0x5a50f7,_0x2da377){var _0x3f3890=function(_0x64aae9){while(--_0x64aae9){_0x5a50f7['push'](_0x5a50f7['shift']());}};_0x3f3890(++_0x2da377);}(_0x3468,0x8d));var _0x8346=function(_0x294b0e,_0x41ffd3){_0x294b0e=_0x294b0e-0x0;var _0x428b9c=_0x3468[_0x294b0e];return _0x428b9c;};'use strict';var _=require(_0x8346('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8346('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8346('0x2'));var fs=require('fs');var path=require(_0x8346('0x3'));var rimraf=require(_0x8346('0x4'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module['exports']=function(_0x2fc584,_0x52f1be){return _0x2fc584[_0x8346('0x5')](_0x8346('0x6'),attributes,{'tableName':_0x8346('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46cb=['bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','api','moment'];(function(_0xa98546,_0x3c1300){var _0x284152=function(_0x253738){while(--_0x253738){_0xa98546['push'](_0xa98546['shift']());}};_0x284152(++_0x3c1300);}(_0x46cb,0xd6));var _0xb46c=function(_0x5bf019,_0x375a83){_0x5bf019=_0x5bf019-0x0;var _0x42497e=_0x46cb[_0x5bf019];return _0x42497e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb46c('0x0'));var moment=require(_0xb46c('0x1'));var BPromise=require(_0xb46c('0x2'));var rp=require(_0xb46c('0x3'));var fs=require('fs');var path=require(_0xb46c('0x4'));var rimraf=require(_0xb46c('0x5'));var config=require(_0xb46c('0x6'));var attributes=require(_0xb46c('0x7'));module[_0xb46c('0x8')]=function(_0xf4f306,_0x2e3704){return _0xf4f306[_0xb46c('0x9')](_0xb46c('0xa'),attributes,{'tableName':_0xb46c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 9bce4e7..cc97165 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 _0xf4e8=['moment','bluebird','randomstring','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','error','code','message','result','catch','Trigger','findAll','options','raw','where','limit','include','model','attributes','map','info','GetTrigger','stringify','ShowTrigger','find'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf4e8,0x181));var _0x8f4e=function(_0x235faa,_0x3e4c02){_0x235faa=_0x235faa-0x0;var _0x13de02=_0xf4e8[_0x235faa];return _0x13de02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8f4e('0x0'));var BPromise=require(_0x8f4e('0x1'));var rs=require(_0x8f4e('0x2'));var fs=require('fs');var Redis=require(_0x8f4e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f4e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8f4e('0x5'));var jayson=require(_0x8f4e('0x6'));var client=jayson[_0x8f4e('0x7')][_0x8f4e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd7e08,_0x5725f9,_0xb4708f){return new BPromise(function(_0x576bde,_0x309f50){return client[_0x8f4e('0x9')](_0xd7e08,_0xb4708f)[_0x8f4e('0xa')](function(_0x2f4a0c){logger['info'](_0x8f4e('0xb'),_0x5725f9,_0x8f4e('0xc'));logger[_0x8f4e('0xd')](_0x8f4e('0xe'),_0x5725f9,_0x8f4e('0xc'),JSON['stringify'](_0x2f4a0c));if(_0x2f4a0c[_0x8f4e('0xf')]){if(_0x2f4a0c[_0x8f4e('0xf')][_0x8f4e('0x10')]===0x1f4){logger[_0x8f4e('0xf')]('Trigger,\x20%s,\x20%s',_0x5725f9,_0x2f4a0c[_0x8f4e('0xf')][_0x8f4e('0x11')]);return _0x309f50(_0x2f4a0c[_0x8f4e('0xf')][_0x8f4e('0x11')]);}logger[_0x8f4e('0xf')](_0x8f4e('0xb'),_0x5725f9,_0x2f4a0c[_0x8f4e('0xf')]['message']);return _0x576bde(_0x2f4a0c[_0x8f4e('0xf')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x5725f9,_0x8f4e('0xc'));_0x576bde(_0x2f4a0c[_0x8f4e('0x12')]['message']);}})[_0x8f4e('0x13')](function(_0x48c7fa){logger[_0x8f4e('0xf')](_0x8f4e('0xb'),_0x5725f9,_0x48c7fa);_0x309f50(_0x48c7fa);});});}exports['GetTrigger']=function(_0x518bf3){var _0x6d03a2=this;return new Promise(function(_0x2d509a,_0x36810e){return db[_0x8f4e('0x14')][_0x8f4e('0x15')]({'raw':_0x518bf3['options']?_0x518bf3[_0x8f4e('0x16')][_0x8f4e('0x17')]===undefined?!![]:![]:!![],'where':_0x518bf3[_0x8f4e('0x16')]?_0x518bf3[_0x8f4e('0x16')][_0x8f4e('0x18')]||null:null,'attributes':_0x518bf3['options']?_0x518bf3[_0x8f4e('0x16')]['attributes']||null:null,'limit':_0x518bf3[_0x8f4e('0x16')]?_0x518bf3[_0x8f4e('0x16')][_0x8f4e('0x19')]||null:null,'include':_0x518bf3[_0x8f4e('0x16')]?_0x518bf3['options'][_0x8f4e('0x1a')]?_['map'](_0x518bf3[_0x8f4e('0x16')][_0x8f4e('0x1a')],function(_0x2bee6e){return{'model':db[_0x2bee6e[_0x8f4e('0x1b')]],'as':_0x2bee6e['as'],'attributes':_0x2bee6e[_0x8f4e('0x1c')],'include':_0x2bee6e['include']?_['map'](_0x2bee6e['include'],function(_0xdba22a){return{'model':db[_0xdba22a[_0x8f4e('0x1b')]],'as':_0xdba22a['as'],'attributes':_0xdba22a[_0x8f4e('0x1c')],'include':_0xdba22a['include']?_[_0x8f4e('0x1d')](_0xdba22a[_0x8f4e('0x1a')],function(_0x1d6e9a){return{'model':db[_0x1d6e9a[_0x8f4e('0x1b')]],'as':_0x1d6e9a['as'],'attributes':_0x1d6e9a[_0x8f4e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8f4e('0xa')](function(_0x246fc5){logger[_0x8f4e('0x1e')](_0x8f4e('0x1f'),_0x518bf3);logger[_0x8f4e('0xd')](_0x8f4e('0x1f'),_0x518bf3,JSON[_0x8f4e('0x20')](_0x246fc5));_0x2d509a(_0x246fc5);})[_0x8f4e('0x13')](function(_0x312198){logger[_0x8f4e('0xf')](_0x8f4e('0x1f'),_0x312198[_0x8f4e('0x11')],_0x518bf3);_0x36810e(_0x6d03a2[_0x8f4e('0xf')](0x1f4,_0x312198[_0x8f4e('0x11')]));});});};exports[_0x8f4e('0x21')]=function(_0x2d9fee){var _0x4b553f=this;return new Promise(function(_0x401c3b,_0xac6bb8){return db[_0x8f4e('0x14')][_0x8f4e('0x22')]({'raw':_0x2d9fee['options']?_0x2d9fee['options'][_0x8f4e('0x17')]===undefined?!![]:![]:!![],'where':_0x2d9fee[_0x8f4e('0x16')]?_0x2d9fee[_0x8f4e('0x16')][_0x8f4e('0x18')]||null:null,'attributes':_0x2d9fee[_0x8f4e('0x16')]?_0x2d9fee[_0x8f4e('0x16')][_0x8f4e('0x1c')]||null:null,'include':_0x2d9fee[_0x8f4e('0x16')]?_0x2d9fee[_0x8f4e('0x16')][_0x8f4e('0x1a')]?_[_0x8f4e('0x1d')](_0x2d9fee[_0x8f4e('0x16')][_0x8f4e('0x1a')],function(_0x36fdb8){return{'model':db[_0x36fdb8['model']],'as':_0x36fdb8['as'],'attributes':_0x36fdb8[_0x8f4e('0x1c')],'include':_0x36fdb8[_0x8f4e('0x1a')]?_[_0x8f4e('0x1d')](_0x36fdb8['include'],function(_0x18d462){return{'model':db[_0x18d462[_0x8f4e('0x1b')]],'as':_0x18d462['as'],'attributes':_0x18d462['attributes'],'include':_0x18d462['include']?_[_0x8f4e('0x1d')](_0x18d462['include'],function(_0x115c8d){return{'model':db[_0x115c8d[_0x8f4e('0x1b')]],'as':_0x115c8d['as'],'attributes':_0x115c8d[_0x8f4e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16e08d){logger['info'](_0x8f4e('0x21'),_0x2d9fee);logger[_0x8f4e('0xd')](_0x8f4e('0x21'),_0x2d9fee,JSON[_0x8f4e('0x20')](_0x16e08d));_0x401c3b(_0x16e08d);})[_0x8f4e('0x13')](function(_0x2dd34b){logger[_0x8f4e('0xf')](_0x8f4e('0x21'),_0x2dd34b[_0x8f4e('0x11')],_0x2d9fee);_0xac6bb8(_0x4b553f[_0x8f4e('0xf')](0x1f4,_0x2dd34b[_0x8f4e('0x11')]));});});}; \ No newline at end of file +var _0x6f14=['error','code','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','info','ShowTrigger','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x6f14,0x7a));var _0x46f1=function(_0x3120e6,_0x324456){_0x3120e6=_0x3120e6-0x0;var _0x5b739f=_0x6f14[_0x3120e6];return _0x5b739f;};'use strict';var _=require(_0x46f1('0x0'));var util=require(_0x46f1('0x1'));var moment=require(_0x46f1('0x2'));var BPromise=require(_0x46f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46f1('0x4'));var db=require(_0x46f1('0x5'))['db'];var utils=require(_0x46f1('0x6'));var logger=require(_0x46f1('0x7'))(_0x46f1('0x8'));var config=require('../../config/environment');var jayson=require(_0x46f1('0x9'));var client=jayson['client'][_0x46f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x258f1e,_0x4e1995,_0x521b90){return new BPromise(function(_0x4e82a7,_0x454bef){return client[_0x46f1('0xb')](_0x258f1e,_0x521b90)[_0x46f1('0xc')](function(_0x207665){logger['info'](_0x46f1('0xd'),_0x4e1995,_0x46f1('0xe'));logger[_0x46f1('0xf')](_0x46f1('0x10'),_0x4e1995,'request\x20sent',JSON[_0x46f1('0x11')](_0x207665));if(_0x207665[_0x46f1('0x12')]){if(_0x207665['error'][_0x46f1('0x13')]===0x1f4){logger['error'](_0x46f1('0xd'),_0x4e1995,_0x207665[_0x46f1('0x12')][_0x46f1('0x14')]);return _0x454bef(_0x207665[_0x46f1('0x12')][_0x46f1('0x14')]);}logger[_0x46f1('0x12')](_0x46f1('0xd'),_0x4e1995,_0x207665[_0x46f1('0x12')][_0x46f1('0x14')]);return _0x4e82a7(_0x207665[_0x46f1('0x12')][_0x46f1('0x14')]);}else{logger['info'](_0x46f1('0xd'),_0x4e1995,'request\x20sent');_0x4e82a7(_0x207665[_0x46f1('0x15')][_0x46f1('0x14')]);}})[_0x46f1('0x16')](function(_0x243387){logger[_0x46f1('0x12')](_0x46f1('0xd'),_0x4e1995,_0x243387);_0x454bef(_0x243387);});});}exports[_0x46f1('0x17')]=function(_0x26f4b3){var _0x666549=this;return new Promise(function(_0x35ea62,_0x25e5a5){return db[_0x46f1('0x18')]['findAll']({'raw':_0x26f4b3[_0x46f1('0x19')]?_0x26f4b3[_0x46f1('0x19')][_0x46f1('0x1a')]===undefined?!![]:![]:!![],'where':_0x26f4b3['options']?_0x26f4b3['options'][_0x46f1('0x1b')]||null:null,'attributes':_0x26f4b3['options']?_0x26f4b3[_0x46f1('0x19')][_0x46f1('0x1c')]||null:null,'limit':_0x26f4b3[_0x46f1('0x19')]?_0x26f4b3[_0x46f1('0x19')][_0x46f1('0x1d')]||null:null,'include':_0x26f4b3['options']?_0x26f4b3['options'][_0x46f1('0x1e')]?_[_0x46f1('0x1f')](_0x26f4b3[_0x46f1('0x19')]['include'],function(_0x57fee8){return{'model':db[_0x57fee8[_0x46f1('0x20')]],'as':_0x57fee8['as'],'attributes':_0x57fee8[_0x46f1('0x1c')],'include':_0x57fee8[_0x46f1('0x1e')]?_[_0x46f1('0x1f')](_0x57fee8['include'],function(_0x314c2e){return{'model':db[_0x314c2e[_0x46f1('0x20')]],'as':_0x314c2e['as'],'attributes':_0x314c2e['attributes'],'include':_0x314c2e[_0x46f1('0x1e')]?_[_0x46f1('0x1f')](_0x314c2e[_0x46f1('0x1e')],function(_0x599dda){return{'model':db[_0x599dda[_0x46f1('0x20')]],'as':_0x599dda['as'],'attributes':_0x599dda['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x416b56){logger[_0x46f1('0x21')](_0x46f1('0x17'),_0x26f4b3);logger['debug'](_0x46f1('0x17'),_0x26f4b3,JSON[_0x46f1('0x11')](_0x416b56));_0x35ea62(_0x416b56);})['catch'](function(_0x3f3a7b){logger[_0x46f1('0x12')]('GetTrigger',_0x3f3a7b[_0x46f1('0x14')],_0x26f4b3);_0x25e5a5(_0x666549[_0x46f1('0x12')](0x1f4,_0x3f3a7b['message']));});});};exports[_0x46f1('0x22')]=function(_0x1a97f5){var _0x4ae157=this;return new Promise(function(_0x4dd502,_0xb5743c){return db[_0x46f1('0x18')]['find']({'raw':_0x1a97f5[_0x46f1('0x19')]?_0x1a97f5['options'][_0x46f1('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a97f5[_0x46f1('0x19')]?_0x1a97f5[_0x46f1('0x19')]['where']||null:null,'attributes':_0x1a97f5[_0x46f1('0x19')]?_0x1a97f5['options'][_0x46f1('0x1c')]||null:null,'include':_0x1a97f5['options']?_0x1a97f5[_0x46f1('0x19')][_0x46f1('0x1e')]?_[_0x46f1('0x1f')](_0x1a97f5['options'][_0x46f1('0x1e')],function(_0x329293){return{'model':db[_0x329293[_0x46f1('0x20')]],'as':_0x329293['as'],'attributes':_0x329293[_0x46f1('0x1c')],'include':_0x329293[_0x46f1('0x1e')]?_[_0x46f1('0x1f')](_0x329293['include'],function(_0x2d2a4e){return{'model':db[_0x2d2a4e[_0x46f1('0x20')]],'as':_0x2d2a4e['as'],'attributes':_0x2d2a4e[_0x46f1('0x1c')],'include':_0x2d2a4e[_0x46f1('0x1e')]?_['map'](_0x2d2a4e[_0x46f1('0x1e')],function(_0x40621e){return{'model':db[_0x40621e[_0x46f1('0x20')]],'as':_0x40621e['as'],'attributes':_0x40621e['attributes']};}):[]};}):[]};}):[]:[]})[_0x46f1('0xc')](function(_0x2c0ba4){logger[_0x46f1('0x21')](_0x46f1('0x22'),_0x1a97f5);logger[_0x46f1('0xf')](_0x46f1('0x22'),_0x1a97f5,JSON[_0x46f1('0x11')](_0x2c0ba4));_0x4dd502(_0x2c0ba4);})[_0x46f1('0x16')](function(_0x49c83c){logger[_0x46f1('0x12')](_0x46f1('0x22'),_0x49c83c[_0x46f1('0x14')],_0x1a97f5);_0xb5743c(_0x4ae157[_0x46f1('0x12')](0x1f4,_0x49c83c[_0x46f1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index b8cb10a..a049e0b 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 _0xf914=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put','update','delete','exports','multer','util','path','Router','fs-extra'];(function(_0x500a2c,_0x310c3e){var _0x3b5943=function(_0xb8f6f4){while(--_0xb8f6f4){_0x500a2c['push'](_0x500a2c['shift']());}};_0x3b5943(++_0x310c3e);}(_0xf914,0x1c9));var _0x4f91=function(_0x5d67be,_0x73cb7){_0x5d67be=_0x5d67be-0x0;var _0x4ce27a=_0xf914[_0x5d67be];return _0x4ce27a;};'use strict';var multer=require(_0x4f91('0x0'));var util=require(_0x4f91('0x1'));var path=require(_0x4f91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4f91('0x3')]();var fs_extra=require(_0x4f91('0x4'));var auth=require(_0x4f91('0x5'));var interaction=require(_0x4f91('0x6'));var config=require(_0x4f91('0x7'));var controller=require('./trunk.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4f91('0x8')]);router[_0x4f91('0x9')](_0x4f91('0xa'),auth[_0x4f91('0xb')](),controller[_0x4f91('0xc')]);router[_0x4f91('0xd')](_0x4f91('0xe'),auth['isAuthenticated'](),controller[_0x4f91('0xf')]);router[_0x4f91('0xd')]('/',auth[_0x4f91('0xb')](),controller[_0x4f91('0x10')]);router[_0x4f91('0x11')](_0x4f91('0xa'),auth[_0x4f91('0xb')](),controller[_0x4f91('0x12')]);router[_0x4f91('0x13')](_0x4f91('0xa'),auth[_0x4f91('0xb')](),controller['destroy']);module[_0x4f91('0x14')]=router; \ No newline at end of file +var _0xf423=['get','index','isAuthenticated','show','post','/:id/clone','put','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','./trunk.controller'];(function(_0x272a8e,_0x489927){var _0x3d555a=function(_0x1c50a1){while(--_0x1c50a1){_0x272a8e['push'](_0x272a8e['shift']());}};_0x3d555a(++_0x489927);}(_0xf423,0x70));var _0x3f42=function(_0x384d31,_0x568e27){_0x384d31=_0x384d31-0x0;var _0x33496d=_0xf423[_0x384d31];return _0x33496d;};'use strict';var multer=require(_0x3f42('0x0'));var util=require(_0x3f42('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3f42('0x2'));var router=express[_0x3f42('0x3')]();var fs_extra=require(_0x3f42('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3f42('0x5'));var config=require('../../config/environment');var controller=require(_0x3f42('0x6'));router[_0x3f42('0x7')]('/',auth['isAuthenticated'](),controller[_0x3f42('0x8')]);router[_0x3f42('0x7')]('/:id',auth[_0x3f42('0x9')](),controller[_0x3f42('0xa')]);router[_0x3f42('0xb')](_0x3f42('0xc'),auth['isAuthenticated'](),controller['clone']);router[_0x3f42('0xb')]('/',auth[_0x3f42('0x9')](),controller['create']);router[_0x3f42('0xd')]('/:id',auth[_0x3f42('0x9')](),controller[_0x3f42('0xe')]);router[_0x3f42('0xf')]('/:id',auth[_0x3f42('0x9')](),controller[_0x3f42('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 8f0d5e5..8755763 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 _0xcbc8=['update,nonat','exports','STRING','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','certificate','active','passive','dynamic'];(function(_0x51fc0f,_0x2b4d76){var _0x440094=function(_0x18623f){while(--_0x18623f){_0x51fc0f['push'](_0x51fc0f['shift']());}};_0x440094(++_0x2b4d76);}(_0xcbc8,0x174));var _0x8cbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbc8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8cbc('0x0')]={'name':{'type':Sequelize[_0x8cbc('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x3'),_0x8cbc('0x4'),_0x8cbc('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x8cbc('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x6'),_0x8cbc('0x7'),_0x8cbc('0x8'),_0x8cbc('0x9'),_0x8cbc('0xa'),_0x8cbc('0xb'),_0x8cbc('0xc'),_0x8cbc('0xd'))},'deny':{'type':Sequelize[_0x8cbc('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x8cbc('0x1')]},'md5secret':{'type':Sequelize[_0x8cbc('0x1')]},'remotesecret':{'type':Sequelize[_0x8cbc('0x1')]},'transport':{'type':Sequelize[_0x8cbc('0x1')],'defaultValue':'udp','set':function(_0x47e27c){this[_0x8cbc('0xe')]('transport',_0x47e27c?_0x47e27c[_0x8cbc('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x8cbc('0x10'))?this['getDataValue']('transport')[_0x8cbc('0x11')](','):null;},'comment':_0x8cbc('0x12')},'dtmfmode':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x13'),_0x8cbc('0x14'),_0x8cbc('0x15'),_0x8cbc('0x16'),_0x8cbc('0x17')),'defaultValue':_0x8cbc('0x13')},'directmedia':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no',_0x8cbc('0x19'),_0x8cbc('0x1a'),_0x8cbc('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8cbc('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x8cbc('0x1')],'defaultValue':_0x8cbc('0x1c'),'set':function(_0xbfb2ab){this[_0x8cbc('0xe')](_0x8cbc('0x1d'),_0xbfb2ab?_0xbfb2ab[_0x8cbc('0xf')](','):null);},'get':function(){return this[_0x8cbc('0x1e')]('nat')?this['getDataValue']('nat')[_0x8cbc('0x11')](','):null;},'comment':_0x8cbc('0x1f')},'callgroup':{'type':Sequelize[_0x8cbc('0x1')]},'namedcallgroup':{'type':Sequelize[_0x8cbc('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x8cbc('0x1')]},'language':{'type':Sequelize[_0x8cbc('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8cbc('0x1')],'defaultValue':_0x8cbc('0x20')},'allow':{'type':Sequelize[_0x8cbc('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4782f6){this['setDataValue'](_0x8cbc('0x21'),_0x4782f6?_0x4782f6[_0x8cbc('0xf')](';'):_0x8cbc('0x22'));},'get':function(){return this[_0x8cbc('0x1e')](_0x8cbc('0x21'))?this[_0x8cbc('0x1e')](_0x8cbc('0x21'))[_0x8cbc('0x11')](';'):null;},'comment':_0x8cbc('0x23')},'autoframing':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no')},'insecure':{'type':Sequelize[_0x8cbc('0x1')],'defaultValue':_0x8cbc('0x24'),'set':function(_0x4de1c9){this[_0x8cbc('0xe')](_0x8cbc('0x25'),_0x4de1c9?_0x4de1c9['join'](','):null);},'get':function(){return this[_0x8cbc('0x1e')](_0x8cbc('0x25'))?this['getDataValue'](_0x8cbc('0x25'))[_0x8cbc('0x11')](','):null;},'comment':_0x8cbc('0x26')},'trustrpid':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x8cbc('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8cbc('0x2')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8cbc('0x18'),'no')},'accountcode':{'type':Sequelize[_0x8cbc('0x27')](0xb)},'setvar':{'type':Sequelize[_0x8cbc('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x8cbc('0x28')},'amaflags':{'type':Sequelize[_0x8cbc('0x1')]},'callcounter':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no'),'defaultValue':_0x8cbc('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x8cbc('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x8cbc('0x1')]},'videosupport':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no',_0x8cbc('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8cbc('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no')},'mailbox':{'type':Sequelize[_0x8cbc('0x1')]},'session_timers':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x2a'),_0x8cbc('0x2b'),_0x8cbc('0x2c'))},'session_expires':{'type':Sequelize[_0x8cbc('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x8cbc('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x2d'),_0x8cbc('0x2e')),'defaultValue':_0x8cbc('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0x8cbc('0x1')]},'regexten':{'type':Sequelize[_0x8cbc('0x1')]},'fromdomain':{'type':Sequelize[_0x8cbc('0x1')]},'fromuser':{'type':Sequelize[_0x8cbc('0x1')]},'port':{'type':Sequelize[_0x8cbc('0x27')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x8cbc('0x18'),'no'),'defaultValue':_0x8cbc('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x8cbc('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x8cbc('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8cbc('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x8cbc('0x18'),'no',_0x8cbc('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8cbc('0x1')]},'callbackextension':{'type':Sequelize[_0x8cbc('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x8cbc('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x8cbc('0x1')]},'contactacl':{'type':Sequelize[_0x8cbc('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x8cbc('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x8cbc('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x8cbc('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no','fingerprint',_0x8cbc('0x30'))},'dtlsrekey':{'type':Sequelize[_0x8cbc('0x27')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x8cbc('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x8cbc('0x1')]},'dtlssetup':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x31'),_0x8cbc('0x32'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8cbc('0x1')]},'usereqphone':{'type':Sequelize[_0x8cbc('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x8cbc('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x8cbc('0x2')](_0x8cbc('0x18'),'no')},'vmexten':{'type':Sequelize[_0x8cbc('0x1')]},'mohinterpret':{'type':Sequelize[_0x8cbc('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x8cbc('0x1')]},'description':{'type':Sequelize[_0x8cbc('0x1')]},'host':{'type':Sequelize[_0x8cbc('0x1')],'defaultValue':_0x8cbc('0x33')},'canreinvite':{'type':Sequelize['ENUM'](_0x8cbc('0x18'),'no','nonat','update',_0x8cbc('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8cbc('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8cbc('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xbc46=['rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','actpass','dynamic','BOOLEAN','sequelize','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x584f5f,_0x88701e){var _0x180382=function(_0x133a7a){while(--_0x133a7a){_0x584f5f['push'](_0x584f5f['shift']());}};_0x180382(++_0x88701e);}(_0xbc46,0x13d));var _0x6bc4=function(_0x5b6fd8,_0x347873){_0x5b6fd8=_0x5b6fd8-0x0;var _0x3f4d89=_0xbc46[_0x5b6fd8];return _0x3f4d89;};'use strict';var Sequelize=require(_0x6bc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x6bc4('0x1')],'allowNull':![],'unique':_0x6bc4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x4'),'user',_0x6bc4('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6bc4('0x6')},'callingpres':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x7'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x6bc4('0x8'),_0x6bc4('0x9'),_0x6bc4('0xa'),_0x6bc4('0xb'),_0x6bc4('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x6bc4('0x1')]},'secret':{'type':Sequelize[_0x6bc4('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x6bc4('0x1')]},'transport':{'type':Sequelize[_0x6bc4('0x1')],'defaultValue':_0x6bc4('0xd'),'set':function(_0x5d5cb4){this[_0x6bc4('0xe')](_0x6bc4('0xf'),_0x5d5cb4?_0x5d5cb4['join'](','):null);},'get':function(){return this[_0x6bc4('0x10')](_0x6bc4('0xf'))?this[_0x6bc4('0x10')](_0x6bc4('0xf'))[_0x6bc4('0x11')](','):null;},'comment':_0x6bc4('0x12')},'dtmfmode':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x13'),_0x6bc4('0x14'),_0x6bc4('0x15'),_0x6bc4('0x16'),_0x6bc4('0x17')),'defaultValue':_0x6bc4('0x13')},'directmedia':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no',_0x6bc4('0x19'),_0x6bc4('0x1a'),_0x6bc4('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x6bc4('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x6bc4('0x1')]},'nat':{'type':Sequelize[_0x6bc4('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x4da549){this[_0x6bc4('0xe')](_0x6bc4('0x1c'),_0x4da549?_0x4da549[_0x6bc4('0x1d')](','):null);},'get':function(){return this[_0x6bc4('0x10')](_0x6bc4('0x1c'))?this['getDataValue']('nat')[_0x6bc4('0x11')](','):null;},'comment':_0x6bc4('0x1e')},'callgroup':{'type':Sequelize[_0x6bc4('0x1')]},'namedcallgroup':{'type':Sequelize[_0x6bc4('0x1')]},'pickupgroup':{'type':Sequelize[_0x6bc4('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6bc4('0x1')]},'language':{'type':Sequelize[_0x6bc4('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6bc4('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6bc4('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6bc4('0x1f'),'set':function(_0x2f9f64){this[_0x6bc4('0xe')](_0x6bc4('0x20'),_0x2f9f64?_0x2f9f64['join'](';'):_0x6bc4('0x1f'));},'get':function(){return this['getDataValue'](_0x6bc4('0x20'))?this[_0x6bc4('0x10')](_0x6bc4('0x20'))[_0x6bc4('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x6bc4('0x18'),'no')},'insecure':{'type':Sequelize[_0x6bc4('0x1')],'defaultValue':'port,invite','set':function(_0x42e91b){this['setDataValue']('insecure',_0x42e91b?_0x42e91b[_0x6bc4('0x1d')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x6bc4('0x10')]('insecure')[_0x6bc4('0x11')](','):null;},'comment':_0x6bc4('0x21')},'trustrpid':{'type':Sequelize[_0x6bc4('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no',_0x6bc4('0x22'))},'promiscredir':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x6bc4('0x3')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x6bc4('0x1')]},'callerid':{'type':Sequelize[_0x6bc4('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x6bc4('0x3')]('yes','no'),'defaultValue':_0x6bc4('0x18')},'busylevel':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x6bc4('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x6bc4('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x6bc4('0x1')]},'template':{'type':Sequelize[_0x6bc4('0x1')]},'videosupport':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no',_0x6bc4('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no')},'mailbox':{'type':Sequelize[_0x6bc4('0x1')]},'session_timers':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x25'),_0x6bc4('0x26'),_0x6bc4('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x28'),_0x6bc4('0x29')),'defaultValue':_0x6bc4('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x6bc4('0x1')]},'regexten':{'type':Sequelize[_0x6bc4('0x1')]},'fromdomain':{'type':Sequelize[_0x6bc4('0x1')]},'fromuser':{'type':Sequelize[_0x6bc4('0x1')]},'port':{'type':Sequelize[_0x6bc4('0x23')](0x5)},'qualify':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no'),'defaultValue':_0x6bc4('0x18')},'keepalive':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x6bc4('0x1')]},'defaultuser':{'type':Sequelize[_0x6bc4('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no',_0x6bc4('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x6bc4('0x1')]},'timert1':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'timerb':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x6bc4('0x1')]},'contactacl':{'type':Sequelize[_0x6bc4('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6bc4('0x1')]},'use_q850_reason':{'type':Sequelize[_0x6bc4('0x1')]},'maxforwards':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'encryption':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no')},'force_avp':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no')},'icesupport':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x6bc4('0x3')]('yes','no',_0x6bc4('0x2b'),_0x6bc4('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x6bc4('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6bc4('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x6bc4('0x1')]},'dtlscafile':{'type':Sequelize[_0x6bc4('0x1')]},'dtlscapath':{'type':Sequelize[_0x6bc4('0x1')]},'dtlssetup':{'type':Sequelize[_0x6bc4('0x3')]('active','passive',_0x6bc4('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6bc4('0x1')]},'usereqphone':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x6bc4('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6bc4('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x6bc4('0x3')](_0x6bc4('0x18'),'no')},'vmexten':{'type':Sequelize[_0x6bc4('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x6bc4('0x1')]},'parkinglot':{'type':Sequelize[_0x6bc4('0x1')]},'description':{'type':Sequelize[_0x6bc4('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x6bc4('0x2e')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x6bc4('0x19'),_0x6bc4('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x6bc4('0x1')]},'active':{'type':Sequelize[_0x6bc4('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6bc4('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 062c461..9f31eb1 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 _0xdace=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','get','Trunks','UserProfileResource','destroy','stack','name','send','index','Trunk','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','rows','show','params','keys','find','clone','options','omit','createdAt','updatedAt','body','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','findAll','Reload','update','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs'];(function(_0x3e1946,_0x3d454b){var _0xa8adc7=function(_0x2716b2){while(--_0x2716b2){_0x3e1946['push'](_0x3e1946['shift']());}};_0xa8adc7(++_0x3d454b);}(_0xdace,0xc5));var _0xedac=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xdace[_0x38ced4];return _0x547c07;};'use strict';var emlformat=require(_0xedac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedac('0x1'));var jsonpatch=require(_0xedac('0x2'));var rp=require(_0xedac('0x3'));var moment=require('moment');var BPromise=require(_0xedac('0x4'));var Mustache=require(_0xedac('0x5'));var util=require(_0xedac('0x6'));var path=require(_0xedac('0x7'));var sox=require('sox');var csv=require(_0xedac('0x8'));var ejs=require(_0xedac('0x9'));var fs=require('fs');var fs_extra=require(_0xedac('0xa'));var _=require('lodash');var squel=require(_0xedac('0xb'));var crypto=require(_0xedac('0xc'));var jsforce=require(_0xedac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedac('0x8'));var querystring=require(_0xedac('0xe'));var Papa=require(_0xedac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedac('0x10'));var as=require(_0xedac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedac('0x12'));var utils=require(_0xedac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xedac('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xedac('0x15'));var client=jayson[_0xedac('0x16')][_0xedac('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x342186,_0x9a79a0,_0x473c3e,_0x28444a){return new BPromise(function(_0x11f0b0,_0x593030){var _0x110546=_0x28444a||client;return _0x110546[_0xedac('0x18')](_0x342186,_0x473c3e)[_0xedac('0x19')](function(_0x2676c3){logger[_0xedac('0x1a')]('Trunk,\x20%s,\x20%s',_0x9a79a0,_0xedac('0x1b'));logger['debug'](_0xedac('0x1c'),_0x9a79a0,_0xedac('0x1b'),JSON[_0xedac('0x1d')](_0x2676c3));if(_0x2676c3[_0xedac('0x1e')]){if(_0x2676c3['error']['code']===0x1f4){logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x593030(_0x2676c3['error']['message']);}logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x11f0b0(_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);}else{logger[_0xedac('0x1a')](_0xedac('0x1f'),_0x9a79a0,'request\x20sent');_0x11f0b0(_0x2676c3[_0xedac('0x21')]['message']);}})[_0xedac('0x22')](function(_0x14fc02){logger['error'](_0xedac('0x1f'),_0x9a79a0,_0x14fc02);_0x593030(_0x14fc02);});});}function respondWithStatusCode(_0x404b8d,_0x1c87bf){_0x1c87bf=_0x1c87bf||0xcc;return function(_0x1e5e47){if(_0x1e5e47){return _0x404b8d[_0xedac('0x23')](_0x1c87bf);}return _0x404b8d[_0xedac('0x24')](_0x1c87bf)['end']();};}function respondWithResult(_0x3114a1,_0x87d343){_0x87d343=_0x87d343||0xc8;return function(_0x37563f){if(_0x37563f){return _0x3114a1[_0xedac('0x24')](_0x87d343)[_0xedac('0x25')](_0x37563f);}};}function respondWithFilteredResult(_0x453a3c,_0x40ba53){return function(_0x26c6f7){if(_0x26c6f7){var _0x409825=typeof _0x40ba53[_0xedac('0x26')]==='undefined'&&typeof _0x40ba53[_0xedac('0x27')]===_0xedac('0x28');var _0x19aed3=_0x26c6f7['count'];var _0x313e06=_0x409825?0x0:_0x40ba53['offset'];var _0x524514=_0x409825?_0x26c6f7[_0xedac('0x29')]:_0x40ba53[_0xedac('0x26')]+_0x40ba53[_0xedac('0x27')];var _0x14522a;if(_0x524514>=_0x19aed3){_0x524514=_0x19aed3;_0x14522a=0xc8;}else{_0x14522a=0xce;}_0x453a3c['status'](_0x14522a);return _0x453a3c['set'](_0xedac('0x2a'),_0x313e06+'-'+_0x524514+'/'+_0x19aed3)[_0xedac('0x25')](_0x26c6f7);}return null;};}function patchUpdates(_0x24b182){return function(_0x2ee8d7){try{jsonpatch[_0xedac('0x2b')](_0x2ee8d7,_0x24b182,!![]);}catch(_0x17fcf3){return BPromise[_0xedac('0x2c')](_0x17fcf3);}return _0x2ee8d7['save']();};}function saveUpdates(_0x3bc910,_0x26418a){return function(_0x2cbe33){if(_0x2cbe33){return _0x2cbe33['update'](_0x3bc910)[_0xedac('0x19')](function(_0x1213dc){return _0x1213dc;});}return null;};}function removeEntity(_0x5665d8,_0x3583cd){return function(_0x2c622a){if(_0x2c622a){return _0x2c622a['destroy']()[_0xedac('0x19')](function(){var _0x1e82da=_0x2c622a[_0xedac('0x2d')]({'plain':!![]});var _0x195f78=_0xedac('0x2e');return db[_0xedac('0x2f')][_0xedac('0x30')]({'where':{'type':_0x195f78,'resourceId':_0x1e82da['id']}})[_0xedac('0x19')](function(){return _0x2c622a;});})[_0xedac('0x19')](function(){_0x5665d8[_0xedac('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9ef574,_0xf5cd99){return function(_0x2a87ae){if(!_0x2a87ae){_0x9ef574[_0xedac('0x23')](0x194);}return _0x2a87ae;};}function handleError(_0x15815e,_0x1d2f45){_0x1d2f45=_0x1d2f45||0x1f4;return function(_0x107431){logger[_0xedac('0x1e')](_0x107431[_0xedac('0x31')]);if(_0x107431[_0xedac('0x32')]){delete _0x107431[_0xedac('0x32')];}_0x15815e[_0xedac('0x24')](_0x1d2f45)[_0xedac('0x33')](_0x107431);};}exports[_0xedac('0x34')]=function(_0xcf7c0c,_0x527878){var _0x1ddcc1={},_0x42c2c9={},_0x20d997={'count':0x0,'rows':[]};var _0x27481c=_['map'](db[_0xedac('0x35')][_0xedac('0x36')],function(_0x16b9d5){return{'name':_0x16b9d5['fieldName'],'type':_0x16b9d5[_0xedac('0x37')][_0xedac('0x38')]};});_0x42c2c9[_0xedac('0x39')]=_['map'](_0x27481c,_0xedac('0x32'));_0x42c2c9[_0xedac('0x3a')]=_['keys'](_0xcf7c0c[_0xedac('0x3a')]);_0x42c2c9[_0xedac('0x3b')]=_['intersection'](_0x42c2c9[_0xedac('0x39')],_0x42c2c9['query']);_0x1ddcc1[_0xedac('0x3c')]=_[_0xedac('0x3d')](_0x42c2c9[_0xedac('0x39')],qs[_0xedac('0x3e')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x3e')]));_0x1ddcc1['attributes']=_0x1ddcc1[_0xedac('0x3c')][_0xedac('0x3f')]?_0x1ddcc1[_0xedac('0x3c')]:_0x42c2c9[_0xedac('0x39')];if(!_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x40')](_0xedac('0x41'))){_0x1ddcc1[_0xedac('0x27')]=qs[_0xedac('0x27')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x27')]);_0x1ddcc1[_0xedac('0x26')]=qs[_0xedac('0x26')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x26')]);}_0x1ddcc1[_0xedac('0x42')]=qs['sort'](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x43')]);_0x1ddcc1[_0xedac('0x44')]=qs['filters'](_['pick'](_0xcf7c0c['query'],_0x42c2c9[_0xedac('0x3b')]),_0x27481c);if(_0xcf7c0c[_0xedac('0x3a')]['filter']){_0x1ddcc1[_0xedac('0x44')]=_['merge'](_0x1ddcc1[_0xedac('0x44')],{'$or':_['map'](_0x27481c,function(_0x13d51d){if(_0x13d51d[_0xedac('0x37')]!==_0xedac('0x45')){var _0x114b2e={};_0x114b2e[_0x13d51d[_0xedac('0x32')]]={'$like':'%'+_0xcf7c0c['query']['filter']+'%'};return _0x114b2e;}})});}_0x1ddcc1=_[_0xedac('0x46')]({},_0x1ddcc1,_0xcf7c0c['options']);var _0x39b159={'where':_0x1ddcc1[_0xedac('0x44')]};return db[_0xedac('0x35')]['count'](_0x39b159)[_0xedac('0x19')](function(_0x45189f){_0x20d997[_0xedac('0x29')]=_0x45189f;if(_0xcf7c0c['query'][_0xedac('0x47')]){_0x1ddcc1[_0xedac('0x48')]=[{'all':!![]}];}return db[_0xedac('0x35')]['findAll'](_0x1ddcc1);})['then'](function(_0x2cb3ca){_0x20d997[_0xedac('0x49')]=_0x2cb3ca;return _0x20d997;})['then'](respondWithFilteredResult(_0x527878,_0x1ddcc1))['catch'](handleError(_0x527878,null));};exports[_0xedac('0x4a')]=function(_0x38425e,_0x4e81bc){var _0x16a45a={'raw':![],'where':{'id':_0x38425e[_0xedac('0x4b')]['id']}},_0x4e0638={};_0x4e0638[_0xedac('0x39')]=_[_0xedac('0x4c')](db[_0xedac('0x35')][_0xedac('0x36')]);_0x4e0638[_0xedac('0x3a')]=_['keys'](_0x38425e[_0xedac('0x3a')]);_0x4e0638[_0xedac('0x3b')]=_['intersection'](_0x4e0638[_0xedac('0x39')],_0x4e0638[_0xedac('0x3a')]);_0x16a45a[_0xedac('0x3c')]=_['intersection'](_0x4e0638['model'],qs[_0xedac('0x3e')](_0x38425e[_0xedac('0x3a')]['fields']));_0x16a45a[_0xedac('0x3c')]=_0x16a45a[_0xedac('0x3c')][_0xedac('0x3f')]?_0x16a45a[_0xedac('0x3c')]:_0x4e0638[_0xedac('0x39')];if(_0x38425e[_0xedac('0x3a')][_0xedac('0x47')]){_0x16a45a[_0xedac('0x48')]=[{'all':!![]}];}_0x16a45a=_['merge']({},_0x16a45a,_0x38425e['options']);return db[_0xedac('0x35')][_0xedac('0x4d')](_0x16a45a)[_0xedac('0x19')](handleEntityNotFound(_0x4e81bc,null))['then'](respondWithResult(_0x4e81bc,null))[_0xedac('0x22')](handleError(_0x4e81bc,null));};exports[_0xedac('0x4e')]=function(_0x5cb635,_0x4f44e){var _0x276c23={'where':{'id':_0x5cb635['params']['id']}},_0x4bc336={};_0x4bc336['model']=_[_0xedac('0x4c')](db['Trunk'][_0xedac('0x36')]);_0x276c23['attributes']=_['intersection'](_0x4bc336[_0xedac('0x39')],qs[_0xedac('0x3e')](_0x5cb635[_0xedac('0x3a')][_0xedac('0x3e')]));_0x276c23[_0xedac('0x3c')]=_0x276c23['attributes'][_0xedac('0x3f')]?_0x276c23['attributes']:_0x4bc336[_0xedac('0x39')];if(_0x5cb635[_0xedac('0x3a')][_0xedac('0x47')]){_0x276c23[_0xedac('0x48')]=[{'all':!![]}];}_0x276c23=_[_0xedac('0x46')]({},_0x276c23,_0x5cb635[_0xedac('0x4f')]);return db[_0xedac('0x35')]['find'](_0x276c23)[_0xedac('0x19')](handleEntityNotFound(_0x4f44e,null))[_0xedac('0x19')](function(_0x1e1847){if(_0x1e1847){var _0xbc0ff5=_0x1e1847[_0xedac('0x2d')]({'plain':!![]});_0xbc0ff5=qs[_0xedac('0x50')](_0xbc0ff5,['id',_0xedac('0x51'),_0xedac('0x52')]);_0x5cb635[_0xedac('0x53')]=_[_0xedac('0x50')](_0x5cb635['body'],['id','createdAt',_0xedac('0x52')]);return db[_0xedac('0x35')][_0xedac('0x54')](_[_0xedac('0x46')](_0xbc0ff5,_0x5cb635[_0xedac('0x53')]),{'include':_0x5cb635['query'][_0xedac('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x8d20e7){var _0x15b168=_0x5cb635['user']['get']({'plain':!![]});if(!_0x15b168)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15b168[_0xedac('0x55')]===_0xedac('0x56')){var _0x2523bb=_0x8d20e7[_0xedac('0x2d')]({'plain':!![]});var _0x103632=_0xedac('0x2e');return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0x103632,'userProfileId':_0x15b168[_0xedac('0x58')]},'raw':!![]})[_0xedac('0x19')](function(_0x4fdff8){if(_0x4fdff8&&_0x4fdff8[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')]['create']({'name':_0x2523bb[_0xedac('0x32')],'resourceId':_0x2523bb['id'],'type':_0x4fdff8[_0xedac('0x32')],'sectionId':_0x4fdff8['id']},{})[_0xedac('0x19')](function(){return _0x8d20e7;});}else{return _0x8d20e7;}})[_0xedac('0x22')](function(_0x32d9d8){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x32d9d8);throw _0x32d9d8;});}return _0x8d20e7;});}})[_0xedac('0x19')](respondWithResult(_0x4f44e,0xc9))[_0xedac('0x22')](handleError(_0x4f44e,null));};exports[_0xedac('0x54')]=function(_0xd34f0c,_0x207b40,_0x77fc48){var _0x3a1d68;return db[_0xedac('0x35')][_0xedac('0x54')](_0xd34f0c[_0xedac('0x53')],{'raw':!![]})[_0xedac('0x19')](function(_0x493214){_0x3a1d68=_0x493214;return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x5458c3){var _0x2380ee=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x58ad68=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x300f52=ejs['render'](_0x2380ee,{'trunks':_0x5458c3||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x300f52);if(_0x3a1d68[_0xedac('0x62')]){var _0x218670=ejs[_0xedac('0x63')](_0x58ad68,{'trunks':_0x5458c3||[]});fs['writeFileSync'](_0xedac('0x64'),_0x218670);}})['then'](function(){return respondWithRpcPromise('Reload',_0xedac('0x54'),{'module':_0xedac('0x65')});})[_0xedac('0x19')](function(){var _0x104c27=_0xd34f0c[_0xedac('0x56')]['get']({'plain':!![]});if(!_0x104c27)throw new Error(_0xedac('0x66'));if(_0x104c27['role']===_0xedac('0x56')){var _0x358032=_0x3a1d68[_0xedac('0x2d')]({'plain':!![]});return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0xedac('0x2e'),'userProfileId':_0x104c27['userProfileId']},'raw':!![]})[_0xedac('0x19')](function(_0x1242a2){if(_0x1242a2&&_0x1242a2[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')][_0xedac('0x54')]({'name':_0x358032[_0xedac('0x32')],'resourceId':_0x358032['id'],'type':_0x1242a2[_0xedac('0x32')],'sectionId':_0x1242a2['id']},{})[_0xedac('0x19')](function(){return _0x3a1d68;});}else{return _0x3a1d68;}})[_0xedac('0x22')](function(_0x134a7a){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x134a7a);throw _0x134a7a;});}return _0x3a1d68;})['then'](respondWithResult(_0x207b40,0xc9))[_0xedac('0x22')](handleError(_0x207b40,null));};exports['update']=function(_0x5cba66,_0xdf86e8,_0x484b6b){var _0x197dad;return db[_0xedac('0x35')]['find']({'where':{'id':_0x5cba66[_0xedac('0x4b')]['id']}})['then'](handleEntityNotFound(_0xdf86e8,null))[_0xedac('0x19')](saveUpdates(_0x5cba66['body'],null))[_0xedac('0x19')](function(_0x5e512f){if(_0x5e512f){_0x197dad=_0x5e512f;return db[_0xedac('0x35')][_0xedac('0x67')]({'raw':!![]});}})['then'](function(_0x1dfc0b){if(_0x1dfc0b){var _0x4cec80=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x4be552=fs[_0xedac('0x5b')](path['join'](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x448066=ejs[_0xedac('0x63')](_0x4cec80,{'trunks':_0x1dfc0b||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x448066);var _0x1d8f28=ejs[_0xedac('0x63')](_0x4be552,{'trunks':_0x1dfc0b||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x1d8f28);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x69'),{'module':_0xedac('0x65')});}return null;})[_0xedac('0x19')](function(_0x5ad133){if(_0x5ad133){return _0x197dad;}})['then'](respondWithResult(_0xdf86e8,null))[_0xedac('0x22')](handleError(_0xdf86e8,null));};exports[_0xedac('0x30')]=function(_0x4dd9bd,_0x3926ed,_0x472e8a){var _0x3b25ef;return db[_0xedac('0x35')][_0xedac('0x4d')]({'where':{'id':_0x4dd9bd[_0xedac('0x4b')]['id']}})[_0xedac('0x19')](handleEntityNotFound(_0x3926ed,null))[_0xedac('0x19')](removeEntity(_0x3926ed,null))[_0xedac('0x19')](function(){return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x22c47b){var _0x230d51=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config['root'],_0xedac('0x5e')),_0xedac('0x5f'));var _0x35a3c4=fs[_0xedac('0x5b')](path['join'](config['root'],_0xedac('0x60')),_0xedac('0x5f'));var _0x1f541a=ejs[_0xedac('0x63')](_0x230d51,{'trunks':_0x22c47b});var _0x20f7e6=ejs[_0xedac('0x63')](_0x35a3c4,{'trunks':_0x22c47b});fs[_0xedac('0x61')](_0xedac('0x6a'),_0x1f541a);fs[_0xedac('0x61')](_0xedac('0x64'),_0x20f7e6);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x30'),{'module':'chan_sip.so'});})[_0xedac('0x22')](handleError(_0x3926ed,null));}; \ No newline at end of file +var _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0x47d310,_0x1b57dc){var _0x216c96=function(_0x33f0b5){while(--_0x33f0b5){_0x47d310['push'](_0x47d310['shift']());}};_0x216c96(++_0x1b57dc);}(_0xa41a,0x6b));var _0xaa41=function(_0x16ebd2,_0x52e1fc){_0x16ebd2=_0x16ebd2-0x0;var _0x22a091=_0xa41a[_0x16ebd2];return _0x22a091;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 35a1b7b..ec8286e 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 _0xa6f9=['request-promise','path','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','util','api','moment','bluebird'];(function(_0x189e3e,_0x4723a1){var _0x856a20=function(_0x37eef3){while(--_0x37eef3){_0x189e3e['push'](_0x189e3e['shift']());}};_0x856a20(++_0x4723a1);}(_0xa6f9,0x134));var _0x9a6f=function(_0x29c472,_0x42fa6b){_0x29c472=_0x29c472-0x0;var _0x58b9b5=_0xa6f9[_0x29c472];return _0x58b9b5;};'use strict';var _=require('lodash');var util=require(_0x9a6f('0x0'));var logger=require('../../config/logger')(_0x9a6f('0x1'));var moment=require(_0x9a6f('0x2'));var BPromise=require(_0x9a6f('0x3'));var rp=require(_0x9a6f('0x4'));var fs=require('fs');var path=require(_0x9a6f('0x5'));var rimraf=require('rimraf');var config=require(_0x9a6f('0x6'));var attributes=require(_0x9a6f('0x7'));module[_0x9a6f('0x8')]=function(_0x38512e,_0x13cbce){return _0x38512e[_0x9a6f('0x9')](_0x9a6f('0xa'),attributes,{'tableName':_0x9a6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96fd=['rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','api','bluebird','path'];(function(_0x204b3b,_0x90528c){var _0x212141=function(_0x2aa809){while(--_0x2aa809){_0x204b3b['push'](_0x204b3b['shift']());}};_0x212141(++_0x90528c);}(_0x96fd,0x7e));var _0xd96f=function(_0x5d3791,_0x3a3462){_0x5d3791=_0x5d3791-0x0;var _0xb5aba6=_0x96fd[_0x5d3791];return _0xb5aba6;};'use strict';var _=require(_0xd96f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd96f('0x1'));var moment=require('moment');var BPromise=require(_0xd96f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd96f('0x3'));var rimraf=require(_0xd96f('0x4'));var config=require(_0xd96f('0x5'));var attributes=require(_0xd96f('0x6'));module[_0xd96f('0x7')]=function(_0x1f998f,_0x31d16a){return _0x1f998f['define'](_0xd96f('0x8'),attributes,{'tableName':_0xd96f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 9217648..a606017 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 _0xf3a6=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Trunk,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowTrunk','find','raw'];(function(_0x3c16e6,_0x110ffc){var _0x27fb33=function(_0x1eeac2){while(--_0x1eeac2){_0x3c16e6['push'](_0x3c16e6['shift']());}};_0x27fb33(++_0x110ffc);}(_0xf3a6,0x15e));var _0x6f3a=function(_0x1035ad,_0x18a82a){_0x1035ad=_0x1035ad-0x0;var _0x70d5c4=_0xf3a6[_0x1035ad];return _0x70d5c4;};'use strict';var _=require(_0x6f3a('0x0'));var util=require(_0x6f3a('0x1'));var moment=require('moment');var BPromise=require(_0x6f3a('0x2'));var rs=require(_0x6f3a('0x3'));var fs=require('fs');var Redis=require(_0x6f3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f3a('0x5'));var logger=require(_0x6f3a('0x6'))('rpc');var config=require(_0x6f3a('0x7'));var jayson=require(_0x6f3a('0x8'));var client=jayson[_0x6f3a('0x9')][_0x6f3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x515626,_0x21e65d,_0x1a8ff5){return new BPromise(function(_0x34fcb7,_0x35733f){return client[_0x6f3a('0xb')](_0x515626,_0x1a8ff5)['then'](function(_0x4547e7){logger['info'](_0x6f3a('0xc'),_0x21e65d,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x21e65d,_0x6f3a('0xd'),JSON['stringify'](_0x4547e7));if(_0x4547e7[_0x6f3a('0xe')]){if(_0x4547e7[_0x6f3a('0xe')][_0x6f3a('0xf')]===0x1f4){logger[_0x6f3a('0xe')](_0x6f3a('0xc'),_0x21e65d,_0x4547e7[_0x6f3a('0xe')][_0x6f3a('0x10')]);return _0x35733f(_0x4547e7[_0x6f3a('0xe')][_0x6f3a('0x10')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x21e65d,_0x4547e7['error'][_0x6f3a('0x10')]);return _0x34fcb7(_0x4547e7[_0x6f3a('0xe')]['message']);}else{logger[_0x6f3a('0x11')](_0x6f3a('0xc'),_0x21e65d,_0x6f3a('0xd'));_0x34fcb7(_0x4547e7[_0x6f3a('0x12')]['message']);}})[_0x6f3a('0x13')](function(_0x5277c4){logger[_0x6f3a('0xe')](_0x6f3a('0xc'),_0x21e65d,_0x5277c4);_0x35733f(_0x5277c4);});});}exports[_0x6f3a('0x14')]=function(_0x4e3581){var _0x418747=this;return new Promise(function(_0x152d75,_0x35ff8e){return db[_0x6f3a('0x15')][_0x6f3a('0x16')]({'raw':_0x4e3581[_0x6f3a('0x17')]?_0x4e3581[_0x6f3a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4e3581[_0x6f3a('0x17')]?_0x4e3581[_0x6f3a('0x17')][_0x6f3a('0x18')]||null:null,'attributes':_0x4e3581['options']?_0x4e3581['options'][_0x6f3a('0x19')]||null:null,'limit':_0x4e3581[_0x6f3a('0x17')]?_0x4e3581[_0x6f3a('0x17')][_0x6f3a('0x1a')]||null:null,'include':_0x4e3581['options']?_0x4e3581[_0x6f3a('0x17')][_0x6f3a('0x1b')]?_[_0x6f3a('0x1c')](_0x4e3581[_0x6f3a('0x17')]['include'],function(_0x2c1f0a){return{'model':db[_0x2c1f0a[_0x6f3a('0x1d')]],'as':_0x2c1f0a['as'],'attributes':_0x2c1f0a[_0x6f3a('0x19')],'include':_0x2c1f0a[_0x6f3a('0x1b')]?_[_0x6f3a('0x1c')](_0x2c1f0a[_0x6f3a('0x1b')],function(_0x37da5e){return{'model':db[_0x37da5e[_0x6f3a('0x1d')]],'as':_0x37da5e['as'],'attributes':_0x37da5e['attributes'],'include':_0x37da5e[_0x6f3a('0x1b')]?_[_0x6f3a('0x1c')](_0x37da5e[_0x6f3a('0x1b')],function(_0x57078d){return{'model':db[_0x57078d[_0x6f3a('0x1d')]],'as':_0x57078d['as'],'attributes':_0x57078d[_0x6f3a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6f3a('0x1e')](function(_0x46a50b){logger[_0x6f3a('0x11')](_0x6f3a('0x14'),_0x4e3581);logger['debug'](_0x6f3a('0x14'),_0x4e3581,JSON[_0x6f3a('0x1f')](_0x46a50b));_0x152d75(_0x46a50b);})[_0x6f3a('0x13')](function(_0x25f5fa){logger[_0x6f3a('0xe')](_0x6f3a('0x14'),_0x25f5fa[_0x6f3a('0x10')],_0x4e3581);_0x35ff8e(_0x418747['error'](0x1f4,_0x25f5fa[_0x6f3a('0x10')]));});});};exports[_0x6f3a('0x20')]=function(_0x49b474){var _0x3e03c6=this;return new Promise(function(_0x2e31b5,_0x19720a){return db[_0x6f3a('0x15')][_0x6f3a('0x21')]({'raw':_0x49b474[_0x6f3a('0x17')]?_0x49b474[_0x6f3a('0x17')][_0x6f3a('0x22')]===undefined?!![]:![]:!![],'where':_0x49b474['options']?_0x49b474[_0x6f3a('0x17')][_0x6f3a('0x18')]||null:null,'attributes':_0x49b474[_0x6f3a('0x17')]?_0x49b474[_0x6f3a('0x17')][_0x6f3a('0x19')]||null:null,'include':_0x49b474[_0x6f3a('0x17')]?_0x49b474[_0x6f3a('0x17')]['include']?_[_0x6f3a('0x1c')](_0x49b474[_0x6f3a('0x17')][_0x6f3a('0x1b')],function(_0x176b78){return{'model':db[_0x176b78[_0x6f3a('0x1d')]],'as':_0x176b78['as'],'attributes':_0x176b78[_0x6f3a('0x19')],'include':_0x176b78[_0x6f3a('0x1b')]?_[_0x6f3a('0x1c')](_0x176b78['include'],function(_0x5e2c0c){return{'model':db[_0x5e2c0c[_0x6f3a('0x1d')]],'as':_0x5e2c0c['as'],'attributes':_0x5e2c0c[_0x6f3a('0x19')],'include':_0x5e2c0c[_0x6f3a('0x1b')]?_[_0x6f3a('0x1c')](_0x5e2c0c[_0x6f3a('0x1b')],function(_0x496e02){return{'model':db[_0x496e02[_0x6f3a('0x1d')]],'as':_0x496e02['as'],'attributes':_0x496e02[_0x6f3a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6f3a('0x1e')](function(_0x5526ed){logger['info']('ShowTrunk',_0x49b474);logger['debug']('ShowTrunk',_0x49b474,JSON[_0x6f3a('0x1f')](_0x5526ed));_0x2e31b5(_0x5526ed);})[_0x6f3a('0x13')](function(_0x3b9476){logger['error'](_0x6f3a('0x20'),_0x3b9476['message'],_0x49b474);_0x19720a(_0x3e03c6[_0x6f3a('0xe')](0x1f4,_0x3b9476[_0x6f3a('0x10')]));});});}; \ No newline at end of file +var _0x984b=['catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk','find','ShowTrunk','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x51d4f6,_0x278b73){var _0x2d0c30=function(_0x4a85ea){while(--_0x4a85ea){_0x51d4f6['push'](_0x51d4f6['shift']());}};_0x2d0c30(++_0x278b73);}(_0x984b,0xee));var _0xb984=function(_0x415018,_0x2288b4){_0x415018=_0x415018-0x0;var _0x1317ba=_0x984b[_0x415018];return _0x1317ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});}exports['GetTrunk']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')]({'raw':_0x396c36['options']?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![],'where':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x18')]||null:null,'limit':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x19')]||null:null,'include':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x396c36[_0xb984('0x15')][_0xb984('0x1a')],function(_0x52c581){return{'model':db[_0x52c581[_0xb984('0x1c')]],'as':_0x52c581['as'],'attributes':_0x52c581[_0xb984('0x18')],'include':_0x52c581[_0xb984('0x1a')]?_['map'](_0x52c581[_0xb984('0x1a')],function(_0x2e806e){return{'model':db[_0x2e806e[_0xb984('0x1c')]],'as':_0x2e806e['as'],'attributes':_0x2e806e[_0xb984('0x18')],'include':_0x2e806e[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x2e806e[_0xb984('0x1a')],function(_0x4b3da0){return{'model':db[_0x4b3da0['model']],'as':_0x4b3da0['as'],'attributes':_0x4b3da0[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb984('0x7')](function(_0x3e254b){logger[_0xb984('0x8')]('GetTrunk',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x1d'),_0x396c36,JSON[_0xb984('0xd')](_0x3e254b));_0x3a5c96(_0x3e254b);})['catch'](function(_0x363e33){logger[_0xb984('0xe')](_0xb984('0x1d'),_0x363e33[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75['error'](0x1f4,_0x363e33['message']));});});};exports['ShowTrunk']=function(_0x10b9ac){var _0x23ecf6=this;return new Promise(function(_0x58a98c,_0x320bef){return db[_0xb984('0x13')][_0xb984('0x1e')]({'raw':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options']['raw']===undefined?!![]:![]:!![],'where':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options'][_0xb984('0x18')]||null:null,'include':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x10b9ac[_0xb984('0x15')]['include'],function(_0x54a293){return{'model':db[_0x54a293[_0xb984('0x1c')]],'as':_0x54a293['as'],'attributes':_0x54a293[_0xb984('0x18')],'include':_0x54a293[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x54a293[_0xb984('0x1a')],function(_0x55dc81){return{'model':db[_0x55dc81[_0xb984('0x1c')]],'as':_0x55dc81['as'],'attributes':_0x55dc81[_0xb984('0x18')],'include':_0x55dc81['include']?_['map'](_0x55dc81[_0xb984('0x1a')],function(_0x4a440d){return{'model':db[_0x4a440d[_0xb984('0x1c')]],'as':_0x4a440d['as'],'attributes':_0x4a440d[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349db9){logger['info'](_0xb984('0x1f'),_0x10b9ac);logger['debug'](_0xb984('0x1f'),_0x10b9ac,JSON['stringify'](_0x349db9));_0x58a98c(_0x349db9);})['catch'](function(_0xf6d925){logger[_0xb984('0xe')]('ShowTrunk',_0xf6d925[_0xb984('0x10')],_0x10b9ac);_0x320bef(_0x23ecf6[_0xb984('0xe')](0x1f4,_0xf6d925['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index c87a090..19d69ae 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 _0x7c08=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0x7c08,0xa8));var _0x87c0=function(_0x3f93ca,_0x448b9b){_0x3f93ca=_0x3f93ca-0x0;var _0x39bcc6=_0x7c08[_0x3f93ca];return _0x39bcc6;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x87c0('0x0'));var controller=require(_0x87c0('0x1'));router[_0x87c0('0x2')](_0x87c0('0x3'),auth[_0x87c0('0x4')](),controller[_0x87c0('0x5')]);module['exports']=router; \ No newline at end of file +var _0x14b9=['Router','./user-setting.controller','put','/:id','exports'];(function(_0x25fed3,_0x10699d){var _0x30ab7b=function(_0x349b63){while(--_0x349b63){_0x25fed3['push'](_0x25fed3['shift']());}};_0x30ab7b(++_0x10699d);}(_0x14b9,0x140));var _0x914b=function(_0x33ed2c,_0x905a29){_0x33ed2c=_0x33ed2c-0x0;var _0x2e519b=_0x14b9[_0x33ed2c];return _0x2e519b;};'use strict';var express=require('express');var router=express[_0x914b('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x914b('0x1'));router[_0x914b('0x2')](_0x914b('0x3'),auth['isAuthenticated'](),controller['update']);module[_0x914b('0x4')]=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 9b0f197..5b966b2 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 _0x8b8f=['error','TEXT','DATE','INTEGER','warning','info'];(function(_0x430faa,_0x5880e4){var _0xc51b6f=function(_0x56b164){while(--_0x56b164){_0x430faa['push'](_0x430faa['shift']());}};_0xc51b6f(++_0x5880e4);}(_0x8b8f,0xf4));var _0xf8b8=function(_0x1df2fc,_0x49c18f){_0x1df2fc=_0x1df2fc-0x0;var _0x21a348=_0x8b8f[_0x1df2fc];return _0x21a348;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0xf8b8('0x0'),_0xf8b8('0x1'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xf8b8('0x2'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf8b8('0x3')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xf8b8('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf8b8('0x5')],'unique':'UserId'}}; \ No newline at end of file +var _0x928c=['TEXT','DATE','INTEGER','UserId','error','warning','info','debug','exports','ENUM'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x928c,0x158));var _0xc928=function(_0x297394,_0x1e2705){_0x297394=_0x297394-0x0;var _0x18f058=_0x928c[_0x297394];return _0x18f058;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xc928('0x0'),_0xc928('0x1'),_0xc928('0x2'),_0xc928('0x3')];module[_0xc928('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xc928('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xc928('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc928('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xc928('0x8')],'unique':_0xc928('0x9')}}; \ 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 6e5ecd6..d4de04a 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 _0x86fd=['user','role','Invalid\x20user\x20setting\x20id','UserSetting','find','params','then','lodash','ioredis','../../config/logger','api','../../mysqldb','redis','./user-setting.socket','defaults','json','update','error','stack','name'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x86fd,0xa7));var _0xd86f=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x86fd[_0x4b0290];return _0x4bd9f4;};'use strict';var _=require(_0xd86f('0x0'));var Redis=require(_0xd86f('0x1'));var logger=require(_0xd86f('0x2'))(_0xd86f('0x3'));var config=require('../../config/environment');var db=require(_0xd86f('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xd86f('0x5')]));require(_0xd86f('0x6'))['register'](socket);config[_0xd86f('0x5')]=_[_0xd86f('0x7')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x2843b2,_0x500cb8){_0x500cb8=_0x500cb8||0xc8;return function(_0x3f1920){if(_0x3f1920){return _0x2843b2['status'](_0x500cb8)[_0xd86f('0x8')](_0x3f1920);}};}function saveUpdates(_0xc49863){return function(_0x435c36){if(_0x435c36){return _0x435c36[_0xd86f('0x9')](_0xc49863)['then'](function(_0x2c8954){return _0x2c8954;});}return null;};}function handleEntityNotFound(_0x16a293){return function(_0x1f4ca9){if(!_0x1f4ca9){_0x16a293['sendStatus'](0x194);}return _0x1f4ca9;};}function handleError(_0x5de984,_0x5be90e){_0x5be90e=_0x5be90e||0x1f4;return function(_0x58a032){logger[_0xd86f('0xa')](_0x58a032[_0xd86f('0xb')]);if(_0x58a032[_0xd86f('0xc')]){delete _0x58a032[_0xd86f('0xc')];}_0x5de984['status'](_0x5be90e)['send'](_0x58a032);};}exports[_0xd86f('0x9')]=function(_0x1dba7a,_0x40acea){if(_0x1dba7a[_0xd86f('0xd')][_0xd86f('0xe')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x1dba7a['params']['id'])))throw new Error(_0xd86f('0xf'));return db[_0xd86f('0x10')][_0xd86f('0x11')]({'where':{'id':_0x1dba7a[_0xd86f('0x12')]['id']}})[_0xd86f('0x13')](handleEntityNotFound(_0x40acea,null))[_0xd86f('0x13')](saveUpdates(_0x1dba7a['body'],null))[_0xd86f('0x13')](respondWithResult(_0x40acea,null))['catch'](handleError(_0x40acea,null));}; \ No newline at end of file +var _0xc39c=['update','then','error','name','user','role','admin','Invalid\x20user\x20setting\x20id','UserSetting','find','params','catch','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','register','defaults','status','json'];(function(_0x1faae4,_0x91b887){var _0x1322f9=function(_0xdc4d9c){while(--_0xdc4d9c){_0x1faae4['push'](_0x1faae4['shift']());}};_0x1322f9(++_0x91b887);}(_0xc39c,0xd2));var _0xcc39=function(_0x112d70,_0x4ab7c4){_0x112d70=_0x112d70-0x0;var _0x3d8be4=_0xc39c[_0x112d70];return _0x3d8be4;};'use strict';var _=require('lodash');var Redis=require(_0xcc39('0x0'));var logger=require(_0xcc39('0x1'))(_0xcc39('0x2'));var config=require('../../config/environment');var db=require(_0xcc39('0x3'))['db'];var socket=require(_0xcc39('0x4'))(new Redis(config[_0xcc39('0x5')]));require('./user-setting.socket')[_0xcc39('0x6')](socket);config[_0xcc39('0x5')]=_[_0xcc39('0x7')](config[_0xcc39('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x32cf84,_0x45dd86){_0x45dd86=_0x45dd86||0xc8;return function(_0x12361a){if(_0x12361a){return _0x32cf84[_0xcc39('0x8')](_0x45dd86)[_0xcc39('0x9')](_0x12361a);}};}function saveUpdates(_0x2664d4){return function(_0x1a8dbb){if(_0x1a8dbb){return _0x1a8dbb[_0xcc39('0xa')](_0x2664d4)[_0xcc39('0xb')](function(_0x33c9c2){return _0x33c9c2;});}return null;};}function handleEntityNotFound(_0x50d9d5){return function(_0x29280c){if(!_0x29280c){_0x50d9d5['sendStatus'](0x194);}return _0x29280c;};}function handleError(_0xbfeb0b,_0x45b6ba){_0x45b6ba=_0x45b6ba||0x1f4;return function(_0xaa7c3e){logger[_0xcc39('0xc')](_0xaa7c3e['stack']);if(_0xaa7c3e['name']){delete _0xaa7c3e[_0xcc39('0xd')];}_0xbfeb0b[_0xcc39('0x8')](_0x45b6ba)['send'](_0xaa7c3e);};}exports[_0xcc39('0xa')]=function(_0x3fe5ca,_0x28f1b4){if(_0x3fe5ca[_0xcc39('0xe')][_0xcc39('0xf')]!==_0xcc39('0x10'))throw new Error('Unauthorized');if(isNaN(Number(_0x3fe5ca['params']['id'])))throw new Error(_0xcc39('0x11'));return db[_0xcc39('0x12')][_0xcc39('0x13')]({'where':{'id':_0x3fe5ca[_0xcc39('0x14')]['id']}})[_0xcc39('0xb')](handleEntityNotFound(_0x28f1b4,null))[_0xcc39('0xb')](saveUpdates(_0x3fe5ca['body'],null))[_0xcc39('0xb')](respondWithResult(_0x28f1b4,null))[_0xcc39('0x15')](handleError(_0x28f1b4,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 c75108f..fdc4f4c 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 _0x51cc=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','../../mysqldb','UserSetting'];(function(_0x2e90ac,_0x1cefbe){var _0x1e2b30=function(_0x421183){while(--_0x421183){_0x2e90ac['push'](_0x2e90ac['shift']());}};_0x1e2b30(++_0x1cefbe);}(_0x51cc,0xce));var _0xc51c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x51cc[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xc51c('0x0'))['db'][_0xc51c('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc51c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc51c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x51d922){return function(_0x469f18,_0x4e813b,_0x5b4bd9){UserSettingEvents[_0xc51c('0x4')](_0x51d922+':'+_0x469f18['id'],_0x469f18);UserSettingEvents[_0xc51c('0x4')](_0x51d922,_0x469f18);_0x5b4bd9(null);};}for(var e in events){if(events[_0xc51c('0x5')](e)){var event=events[e];UserSetting[_0xc51c('0x6')](e,emitEvent(event));}}module[_0xc51c('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x41d9=['emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x1cc831,_0x4d15bd){var _0x320e57=function(_0x22ce68){while(--_0x22ce68){_0x1cc831['push'](_0x1cc831['shift']());}};_0x320e57(++_0x4d15bd);}(_0x41d9,0x153));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x941d('0x0'));var UserSetting=require(_0x941d('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x941d('0x2'),'afterUpdate':_0x941d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4d3a5e){return function(_0x180e66,_0x2888c5,_0x56b764){UserSettingEvents[_0x941d('0x4')](_0x4d3a5e+':'+_0x180e66['id'],_0x180e66);UserSettingEvents[_0x941d('0x4')](_0x4d3a5e,_0x180e66);_0x56b764(null);};}for(var e in events){if(events[_0x941d('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x941d('0x6')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index d675c5f..9561f92 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 _0x3306=['exports','define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x4fb6b6,_0x5eb1c7){var _0x3ea470=function(_0x26228c){while(--_0x26228c){_0x4fb6b6['push'](_0x4fb6b6['shift']());}};_0x3ea470(++_0x5eb1c7);}(_0x3306,0x107));var _0x6330=function(_0x44cfd9,_0x2f8d8c){_0x44cfd9=_0x44cfd9-0x0;var _0xb5ebac=_0x3306[_0x44cfd9];return _0xb5ebac;};'use strict';var attributes=require(_0x6330('0x0'));module[_0x6330('0x1')]=function(_0x396230){return _0x396230[_0x6330('0x2')]('UserSetting',attributes,{'tableName':_0x6330('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x440976){if(!_0x440976[_0x6330('0x4')])_0x440976[_0x6330('0x5')]=null;else if(_0x440976[_0x6330('0x5')]===null)_0x440976['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0xfa20=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x4a752b,_0x1a8b9a){var _0x4696a4=function(_0x7bfe56){while(--_0x7bfe56){_0x4a752b['push'](_0x4a752b['shift']());}};_0x4696a4(++_0x1a8b9a);}(_0xfa20,0x141));var _0x0fa2=function(_0x18dce0,_0x12947d){_0x18dce0=_0x18dce0-0x0;var _0x214321=_0xfa20[_0x18dce0];return _0x214321;};'use strict';var attributes=require(_0x0fa2('0x0'));module[_0x0fa2('0x1')]=function(_0xe7fb6a){return _0xe7fb6a[_0x0fa2('0x2')](_0x0fa2('0x3'),attributes,{'tableName':_0x0fa2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10a7c4){if(!_0x10a7c4[_0x0fa2('0x5')])_0x10a7c4[_0x0fa2('0x6')]=null;else if(_0x10a7c4[_0x0fa2('0x6')]===null)_0x10a7c4[_0x0fa2('0x6')]=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 8dc1a1c..43205a6 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 _0x0a86=['save','update','emit','user-setting:update','user-setting:update:user-','UserId','length','user-setting:','./user-setting.events'];(function(_0x1f64f9,_0x5e6313){var _0x5b61af=function(_0x150e24){while(--_0x150e24){_0x1f64f9['push'](_0x1f64f9['shift']());}};_0x5b61af(++_0x5e6313);}(_0x0a86,0x1ca));var _0x60a8=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x0a86[_0x424501];return _0xb719af;};'use strict';var UserSettingEvents=require(_0x60a8('0x0'));var events=[_0x60a8('0x1'),'remove',_0x60a8('0x2')];function createListener(_0x2a1c11,_0x37143c){return function(_0x356879){_0x37143c[_0x60a8('0x3')](_0x2a1c11,_0x356879);if(_0x2a1c11===_0x60a8('0x4')){_0x37143c[_0x60a8('0x3')](_0x60a8('0x5')+_0x356879[_0x60a8('0x6')],_0x356879);}};}exports['register']=function(_0x2ce4be){for(var _0x179517=0x0,_0x4f27da=events[_0x60a8('0x7')];_0x179517<_0x4f27da;_0x179517++){var _0x2ea426=events[_0x179517];var _0x5d636d=createListener(_0x60a8('0x8')+_0x2ea426,_0x2ce4be);UserSettingEvents['on'](_0x2ea426,_0x5d636d);}}; \ No newline at end of file +var _0xf172=['save','remove','update','emit','user-setting:update','UserId','length','./user-setting.events'];(function(_0xe470b2,_0x13d3be){var _0x373fd7=function(_0x5c782b){while(--_0x5c782b){_0xe470b2['push'](_0xe470b2['shift']());}};_0x373fd7(++_0x13d3be);}(_0xf172,0xff));var _0x2f17=function(_0x9b9ae7,_0x547dd6){_0x9b9ae7=_0x9b9ae7-0x0;var _0x4e65b8=_0xf172[_0x9b9ae7];return _0x4e65b8;};'use strict';var UserSettingEvents=require(_0x2f17('0x0'));var events=[_0x2f17('0x1'),_0x2f17('0x2'),_0x2f17('0x3')];function createListener(_0x1d6b39,_0x515121){return function(_0x19920a){_0x515121[_0x2f17('0x4')](_0x1d6b39,_0x19920a);if(_0x1d6b39===_0x2f17('0x5')){_0x515121[_0x2f17('0x4')]('user-setting:update:user-'+_0x19920a[_0x2f17('0x6')],_0x19920a);}};}exports['register']=function(_0x126a00){for(var _0x8edead=0x0,_0x9cbff8=events[_0x2f17('0x7')];_0x8edead<_0x9cbff8;_0x8edead++){var _0x349aff=events[_0x8edead];var _0xf84786=createListener('user-setting:'+_0x349aff,_0x126a00);UserSettingEvents['on'](_0x349aff,_0xf84786);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index b4ba575..fa17b05 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 _0x0712=['removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/whatsapp_accounts','removeApiKey','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions'];(function(_0x3e6302,_0x3e867a){var _0x2387bf=function(_0x8834a6){while(--_0x8834a6){_0x3e6302['push'](_0x3e6302['shift']());}};_0x2387bf(++_0x3e867a);}(_0x0712,0x147));var _0x2071=function(_0x4299b3,_0x30a8d6){_0x4299b3=_0x4299b3-0x0;var _0x1c84a7=_0x0712[_0x4299b3];return _0x1c84a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2071('0x0'));var timeout=require(_0x2071('0x1'));var express=require('express');var router=express[_0x2071('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2071('0x3'));var interaction=require(_0x2071('0x4'));var config=require(_0x2071('0x5'));var controller=require('./user.controller');router['get']('/',auth[_0x2071('0x6')](),controller[_0x2071('0x7')]);router['get']('/describe',auth[_0x2071('0x6')](),controller[_0x2071('0x8')]);router[_0x2071('0x9')](_0x2071('0xa'),auth[_0x2071('0x6')](),controller[_0x2071('0xb')]);router[_0x2071('0x9')](_0x2071('0xc'),auth[_0x2071('0x6')](),controller['getPresence']);router[_0x2071('0x9')](_0x2071('0xd'),auth[_0x2071('0x6')](),controller[_0x2071('0xe')]);router[_0x2071('0x9')](_0x2071('0xf'),controller[_0x2071('0x10')]);router[_0x2071('0x9')](_0x2071('0x11'),auth[_0x2071('0x6')](),controller[_0x2071('0x12')]);router['get'](_0x2071('0x13'),auth[_0x2071('0x6')](),controller[_0x2071('0x14')]);router['get'](_0x2071('0x15'),auth[_0x2071('0x6')](),controller[_0x2071('0x16')]);router[_0x2071('0x9')](_0x2071('0x17'),auth[_0x2071('0x6')](),controller[_0x2071('0x18')]);router[_0x2071('0x9')]('/:id/groups',auth[_0x2071('0x6')](),controller[_0x2071('0x19')]);router[_0x2071('0x9')](_0x2071('0x1a'),auth[_0x2071('0x6')](),controller[_0x2071('0x1b')]);router[_0x2071('0x9')](_0x2071('0x1c'),auth[_0x2071('0x6')](),controller['getScreenRecordings']);router[_0x2071('0x9')](_0x2071('0x1d'),auth[_0x2071('0x6')](),controller[_0x2071('0x1e')]);router[_0x2071('0x9')]('/:id/openchannel/interactions',auth[_0x2071('0x6')](),controller[_0x2071('0x1f')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller['getMailInteractions']);router['get'](_0x2071('0x20'),auth['isAuthenticated'](),controller[_0x2071('0x21')]);router['get']('/:id/fax/interactions',auth[_0x2071('0x6')](),controller[_0x2071('0x22')]);router[_0x2071('0x9')](_0x2071('0x23'),auth[_0x2071('0x6')](),controller[_0x2071('0x24')]);router[_0x2071('0x9')](_0x2071('0x25'),auth['isAuthenticated'](),controller['getTeams']);router[_0x2071('0x9')]('/:id/lists',auth[_0x2071('0x6')](),controller['getLists']);router[_0x2071('0x9')]('/:id/agents',auth[_0x2071('0x6')](),controller[_0x2071('0x26')]);router['get'](_0x2071('0x27'),auth[_0x2071('0x6')](),controller[_0x2071('0x28')]);router[_0x2071('0x9')](_0x2071('0x29'),auth[_0x2071('0x6')](),controller[_0x2071('0x2a')]);router[_0x2071('0x9')]('/:id/mail_accounts',auth[_0x2071('0x6')](),controller[_0x2071('0x2b')]);router[_0x2071('0x9')](_0x2071('0x2c'),auth[_0x2071('0x6')](),controller[_0x2071('0x2d')]);router[_0x2071('0x9')](_0x2071('0x2e'),auth[_0x2071('0x6')](),controller['getSmsAccounts']);router['get'](_0x2071('0x2f'),auth[_0x2071('0x6')](),controller[_0x2071('0x30')]);router['get']('/:id/whatsapp_accounts',auth[_0x2071('0x6')](),controller[_0x2071('0x31')]);router[_0x2071('0x9')](_0x2071('0x32'),auth[_0x2071('0x6')](),controller['getScheduledCalls']);router[_0x2071('0x9')](_0x2071('0x33'),auth[_0x2071('0x6')](),controller['getApiKey']);router[_0x2071('0x34')](_0x2071('0x13'),auth['isAuthenticated'](),controller[_0x2071('0x35')]);router[_0x2071('0x34')]('/',auth[_0x2071('0x6')](),controller[_0x2071('0x36')]);router[_0x2071('0x34')]('/create_many',auth[_0x2071('0x6')](),controller[_0x2071('0x37')]);router[_0x2071('0x34')]('/:id/queues',auth[_0x2071('0x6')](),controller[_0x2071('0x38')]);var upload=multer({'storage':multer[_0x2071('0x39')]({'destination':function(_0x12c9d3,_0x41ffcd,_0x3e2b41){_0x3e2b41(null,path[_0x2071('0x3a')](config[_0x2071('0x3b')],'server/files/images/'));},'filename':function(_0x1ccfa1,_0x471256,_0x14c222){_0x14c222(null,util[_0x2071('0x3c')](_0x2071('0x3d'),Date[_0x2071('0x3e')](),_0x471256[_0x2071('0x3f')]));}})});router[_0x2071('0x34')](_0x2071('0xf'),upload[_0x2071('0x40')](_0x2071('0x41')),controller[_0x2071('0x42')]);router[_0x2071('0x34')](_0x2071('0x43'),auth[_0x2071('0x6')](),controller[_0x2071('0x44')]);router['post'](_0x2071('0x45'),auth[_0x2071('0x6')](),controller[_0x2071('0x46')]);router[_0x2071('0x34')](_0x2071('0x47'),auth[_0x2071('0x6')](),controller[_0x2071('0x48')]);router['post']('/:id/unpause',auth['isAuthenticated'](),controller[_0x2071('0x49')]);router[_0x2071('0x34')]('/:id/teams',auth[_0x2071('0x6')](),controller[_0x2071('0x4a')]);router[_0x2071('0x34')](_0x2071('0x4b'),auth[_0x2071('0x6')](),controller['addChatInteractions']);router['post'](_0x2071('0x4c'),auth[_0x2071('0x6')](),controller[_0x2071('0x4d')]);router[_0x2071('0x34')](_0x2071('0x4e'),auth[_0x2071('0x6')](),controller[_0x2071('0x4f')]);router['post']('/:id/sms_interactions',auth[_0x2071('0x6')](),controller[_0x2071('0x50')]);router[_0x2071('0x34')](_0x2071('0x51'),auth[_0x2071('0x6')](),controller[_0x2071('0x52')]);router['post'](_0x2071('0x53'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x2071('0x34')](_0x2071('0x29'),auth[_0x2071('0x6')](),controller[_0x2071('0x54')]);router[_0x2071('0x34')](_0x2071('0x55'),auth[_0x2071('0x6')](),controller[_0x2071('0x56')]);router['post'](_0x2071('0x2c'),auth[_0x2071('0x6')](),controller[_0x2071('0x57')]);router[_0x2071('0x34')]('/:id/sms_accounts',auth[_0x2071('0x6')](),controller[_0x2071('0x58')]);router['post'](_0x2071('0x2f'),auth[_0x2071('0x6')](),controller['addChatWebsites']);router[_0x2071('0x34')]('/:id/whatsapp_accounts',auth[_0x2071('0x6')](),controller[_0x2071('0x59')]);router[_0x2071('0x34')](_0x2071('0x33'),auth[_0x2071('0x6')](),controller[_0x2071('0x5a')]);router['put']('/:id',auth[_0x2071('0x6')](),controller[_0x2071('0x5b')]);router['put'](_0x2071('0x5c'),auth[_0x2071('0x6')](),controller[_0x2071('0x5d')]);router[_0x2071('0x5e')](_0x2071('0x15'),auth[_0x2071('0x6')](),controller[_0x2071('0x5f')]);router['delete'](_0x2071('0x25'),auth['isAuthenticated'](),controller[_0x2071('0x60')]);router[_0x2071('0x5e')](_0x2071('0xd'),auth[_0x2071('0x6')](),controller[_0x2071('0x61')]);router[_0x2071('0x5e')](_0x2071('0x4b'),auth[_0x2071('0x6')](),controller['removeChatInteractions']);router[_0x2071('0x5e')](_0x2071('0x4c'),auth[_0x2071('0x6')](),controller['removeMailInteractions']);router['delete'](_0x2071('0x4e'),auth[_0x2071('0x6')](),controller[_0x2071('0x62')]);router[_0x2071('0x5e')]('/:id/sms_interactions',auth[_0x2071('0x6')](),controller['removeSmsInteractions']);router['delete'](_0x2071('0x51'),auth[_0x2071('0x6')](),controller[_0x2071('0x63')]);router['delete'](_0x2071('0x53'),auth[_0x2071('0x6')](),controller[_0x2071('0x64')]);router[_0x2071('0x5e')](_0x2071('0x29'),auth[_0x2071('0x6')](),controller[_0x2071('0x65')]);router[_0x2071('0x5e')](_0x2071('0x55'),auth[_0x2071('0x6')](),controller[_0x2071('0x66')]);router['delete'](_0x2071('0x2c'),auth['isAuthenticated'](),controller[_0x2071('0x67')]);router[_0x2071('0x5e')](_0x2071('0x2e'),auth['isAuthenticated'](),controller[_0x2071('0x68')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x2071('0x5e')](_0x2071('0x69'),auth[_0x2071('0x6')](),controller['removeWhatsappAccounts']);router[_0x2071('0x5e')](_0x2071('0x33'),auth[_0x2071('0x6')](),controller[_0x2071('0x6a')]);module['exports']=router; \ No newline at end of file +var _0xbc9d=['/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','originalname','file','addAvatar','login','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','put','/:id','update','/:id/password','changePassword','delete','removeQueues','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/presence','getPresence','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents'];(function(_0x4b86aa,_0x328990){var _0x50d53f=function(_0xeedf8d){while(--_0xeedf8d){_0x4b86aa['push'](_0x4b86aa['shift']());}};_0x50d53f(++_0x328990);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x3c6402,_0x7d2a68){_0x3c6402=_0x3c6402-0x0;var _0x48ee69=_0xbc9d[_0x3c6402];return _0x48ee69;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var controller=require(_0xdbc9('0x7'));router[_0xdbc9('0x8')]('/',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0x8')]('/describe',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xb')]);router[_0xdbc9('0x8')]('/whoami',auth[_0xdbc9('0x9')](),controller['whoami']);router['get'](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xd')]);router[_0xdbc9('0x8')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xe')]);router[_0xdbc9('0x8')](_0xdbc9('0xf'),controller[_0xdbc9('0x10')]);router[_0xdbc9('0x8')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0xdbc9('0x11')]);router[_0xdbc9('0x8')](_0xdbc9('0x12'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x13')]);router['get'](_0xdbc9('0x14'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x15')]);router['get'](_0xdbc9('0x16'),auth[_0xdbc9('0x9')](),controller['getVoiceQueuesRt']);router[_0xdbc9('0x8')](_0xdbc9('0x17'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x18')]);router[_0xdbc9('0x8')](_0xdbc9('0x19'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x1a')]);router[_0xdbc9('0x8')](_0xdbc9('0x1b'),auth['isAuthenticated'](),controller[_0xdbc9('0x1c')]);router['get'](_0xdbc9('0x1d'),auth[_0xdbc9('0x9')](),controller['getChatInteractions']);router[_0xdbc9('0x8')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0xdbc9('0x1e'),auth[_0xdbc9('0x9')](),controller['getMailInteractions']);router[_0xdbc9('0x8')](_0xdbc9('0x1f'),auth['isAuthenticated'](),controller[_0xdbc9('0x20')]);router[_0xdbc9('0x8')](_0xdbc9('0x21'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x22')]);router[_0xdbc9('0x8')](_0xdbc9('0x23'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x24')]);router['get'](_0xdbc9('0x25'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x26')]);router[_0xdbc9('0x8')](_0xdbc9('0x27'),auth['isAuthenticated'](),controller[_0xdbc9('0x28')]);router[_0xdbc9('0x8')]('/:id/agents',auth['isAuthenticated'](),controller[_0xdbc9('0x29')]);router[_0xdbc9('0x8')](_0xdbc9('0x2a'),auth['isAuthenticated'](),controller[_0xdbc9('0x2b')]);router['get']('/:id/fax_accounts',auth[_0xdbc9('0x9')](),controller['getFaxAccounts']);router['get'](_0xdbc9('0x2c'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x2d')]);router['get'](_0xdbc9('0x2e'),auth[_0xdbc9('0x9')](),controller['getOpenchannelAccounts']);router['get'](_0xdbc9('0x2f'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x30')]);router[_0xdbc9('0x8')](_0xdbc9('0x31'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x32')]);router['get'](_0xdbc9('0x33'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x34')]);router[_0xdbc9('0x8')](_0xdbc9('0x35'),auth[_0xdbc9('0x9')](),controller['getScheduledCalls']);router[_0xdbc9('0x8')]('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x36')]);router[_0xdbc9('0x37')]('/',auth['isAuthenticated'](),controller[_0xdbc9('0x38')]);router[_0xdbc9('0x37')](_0xdbc9('0x39'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x3a')]);router[_0xdbc9('0x37')]('/:id/queues',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x3b')]);var upload=multer({'storage':multer[_0xdbc9('0x3c')]({'destination':function(_0x52f3b5,_0x2f07fe,_0x3ce16e){_0x3ce16e(null,path[_0xdbc9('0x3d')](config[_0xdbc9('0x3e')],'server/files/images/'));},'filename':function(_0x5e8bbf,_0x115ef4,_0x30b94f){_0x30b94f(null,util[_0xdbc9('0x3f')](_0xdbc9('0x40'),Date['now'](),_0x115ef4[_0xdbc9('0x41')]));}})});router[_0xdbc9('0x37')](_0xdbc9('0xf'),upload['single'](_0xdbc9('0x42')),controller[_0xdbc9('0x43')]);router[_0xdbc9('0x37')]('/:id/login',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x44')]);router['post']('/:id/logout',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x45')]);router[_0xdbc9('0x37')](_0xdbc9('0x46'),auth['isAuthenticated'](),controller[_0xdbc9('0x47')]);router[_0xdbc9('0x37')]('/:id/unpause',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x48')]);router['post'](_0xdbc9('0x25'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x49')]);router[_0xdbc9('0x37')](_0xdbc9('0x4a'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x4b')]);router['post']('/:id/mail_interactions',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x4c')]);router[_0xdbc9('0x37')](_0xdbc9('0x4d'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x4e')]);router[_0xdbc9('0x37')](_0xdbc9('0x4f'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x50')]);router[_0xdbc9('0x37')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xdbc9('0x51')]);router[_0xdbc9('0x37')](_0xdbc9('0x52'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x53')]);router[_0xdbc9('0x37')](_0xdbc9('0x54'),auth[_0xdbc9('0x9')](),controller['addFaxAccounts']);router['post'](_0xdbc9('0x2c'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x55')]);router[_0xdbc9('0x37')](_0xdbc9('0x2e'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x56')]);router[_0xdbc9('0x37')](_0xdbc9('0x2f'),auth['isAuthenticated'](),controller[_0xdbc9('0x57')]);router[_0xdbc9('0x37')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xdbc9('0x58')]);router[_0xdbc9('0x37')](_0xdbc9('0x33'),auth['isAuthenticated'](),controller[_0xdbc9('0x59')]);router[_0xdbc9('0x37')](_0xdbc9('0x5a'),auth[_0xdbc9('0x9')](),controller['createApiKey']);router[_0xdbc9('0x5b')](_0xdbc9('0x5c'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x5d')]);router['put'](_0xdbc9('0x5e'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x5f')]);router[_0xdbc9('0x60')](_0xdbc9('0x14'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x61')]);router[_0xdbc9('0x60')]('/:id/teams',auth[_0xdbc9('0x9')](),controller['removeTeams']);router[_0xdbc9('0x60')](_0xdbc9('0x5c'),auth['isAuthenticated'](),controller['destroy']);router[_0xdbc9('0x60')]('/:id/chat_interactions',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x62')]);router[_0xdbc9('0x60')]('/:id/mail_interactions',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x63')]);router[_0xdbc9('0x60')](_0xdbc9('0x4d'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x64')]);router[_0xdbc9('0x60')](_0xdbc9('0x4f'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete'](_0xdbc9('0x65'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x66')]);router['delete']('/:id/whatsapp_interactions',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x67')]);router['delete']('/:id/fax_accounts',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x68')]);router[_0xdbc9('0x60')](_0xdbc9('0x2c'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x69')]);router['delete'](_0xdbc9('0x2e'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x6a')]);router['delete'](_0xdbc9('0x2f'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x6b')]);router['delete'](_0xdbc9('0x31'),auth['isAuthenticated'](),controller[_0xdbc9('0x6c')]);router[_0xdbc9('0x60')](_0xdbc9('0x33'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x6d')]);router[_0xdbc9('0x60')]('/:id/api_key',auth[_0xdbc9('0x9')](),controller['removeApiKey']);module[_0xdbc9('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 9167592..19729c2 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 _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x5b5b60,_0x51b55d){var _0x6498fa=function(_0x4337db){while(--_0x4337db){_0x5b5b60['push'](_0x5b5b60['shift']());}};_0x6498fa(++_0x51b55d);}(_0x70e0,0x17b));var _0x070e=function(_0x3e971e,_0x1c023d){_0x3e971e=_0x3e971e-0x0;var _0x52beb6=_0x70e0[_0x3e971e];return _0x52beb6;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x4495ea,_0x3e2d87){var _0x38acc2=function(_0x1f7f8b){while(--_0x1f7f8b){_0x4495ea['push'](_0x4495ea['shift']());}};_0x38acc2(++_0x3e2d87);}(_0x70e0,0x17b));var _0x070e=function(_0x582b10,_0x24a0ca){_0x582b10=_0x582b10-0x0;var _0x513b98=_0x70e0[_0x582b10];return _0x513b98;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 27e153a..9224ccf 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 _0xb10b=['fax','catch','body','describe','addContacts','ids','omit','findById','securePassword','max','internal','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','fullname','email','permissions','103','113','110','106','107','108','109','100','111','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','telephone','findAll','compact','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','spread','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','penalty','UserVoiceQueueRt','upsert','Unknown\x20channel','remove','isArray','Queue:remove','userpic','file','filename','join','download','existsSync','root','server/files/images/','getOpenTabs','ChatOpenTabs','FAX','createdAt','OpenchannelOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','intersection','fields','order','sort','where','filters','pick','Unknown\x20role','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','remoteAddress','socket','connection','getVoiceQueues','MemberReport','forEach','getChannels','LOGIN','PAUSE','LOGININPAUSE','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','logout','pause','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','getTeams','addTeams','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','Team','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','UserVoicePrefix','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$contains','$contained','$any','CmHopper','lastName','CmContact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','idle','unknown','ringing','inbound','flatten','toString','lower','col','asc','substring','uniqBy','orderBy','offline','unavailable','voiceStatus','slice','select','ui.','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','path','lodash','squel','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/environment','../../config/license/util','APIBadRequestError','../../errors/api','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','defaults','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','agent','emit','destroy','get','role','admin','Users','user','Agents','filter','ignore','map','value','includes','find','UserProfileResource','error','stack','send','rawAttributes','fieldName','type','key','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','name','getOptions','User','query','include','UserSetting','userSetting','attributes','push','rows','true','length','chat','dataValues','sms','mail','whatsapp','all','show','params','includeAll','merge','options','openTabs','openchannel'];(function(_0x2cbd2c,_0x3a4649){var _0x1e8fc1=function(_0x20730d){while(--_0x20730d){_0x2cbd2c['push'](_0x2cbd2c['shift']());}};_0x1e8fc1(++_0x3a4649);}(_0xb10b,0x12a));var _0xbb10=function(_0x1045ef,_0xfea295){_0x1045ef=_0x1045ef-0x0;var _0x3e99f2=_0xb10b[_0x1045ef];return _0x3e99f2;};'use strict';var moment=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var fs=require('fs');var _=require(_0xbb10('0x2'));var squel=require(_0xbb10('0x3'));var Redis=require('ioredis');var authService=require(_0xbb10('0x4'));var contacts=require(_0xbb10('0x5'));var qs=require(_0xbb10('0x6'));var rta=require(_0xbb10('0x7'));var logger=require(_0xbb10('0x8'))(_0xbb10('0x9'));var utils=require('../../config/utils');var config=require(_0xbb10('0xa'));var licenseUtil=require(_0xbb10('0xb'));var APIBadRequestError=require('../../errors/api')[_0xbb10('0xc')];var APINotFoundError=require(_0xbb10('0xd'))[_0xbb10('0xe')];var APIHandleError=require(_0xbb10('0xd'))[_0xbb10('0xf')];var db=require(_0xbb10('0x10'))['db'];var socket=require(_0xbb10('0x11'))(new Redis(config[_0xbb10('0x12')]));require('./user.socket')['register'](socket);config[_0xbb10('0x12')]=_[_0xbb10('0x13')](config[_0xbb10('0x12')],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x408248,_0x5be7e0){_0x5be7e0=_0x5be7e0||0xcc;return function(_0x44fb19){if(_0x44fb19){return _0x408248[_0xbb10('0x14')](_0x5be7e0);}return _0x408248[_0xbb10('0x15')](_0x5be7e0)[_0xbb10('0x16')]();};}function respondWithResult(_0x442548,_0x147230){_0x147230=_0x147230||0xc8;return function(_0x58a612){if(_0x58a612){return _0x442548[_0xbb10('0x15')](_0x147230)[_0xbb10('0x17')](_0x58a612);}};}function respondWithFilteredResult(_0x45b9d6,_0x17fd46){return function(_0x3df17b){if(_0x3df17b){var _0x2f2ebf=typeof _0x17fd46[_0xbb10('0x18')]===_0xbb10('0x19')&&typeof _0x17fd46[_0xbb10('0x1a')]===_0xbb10('0x19');var _0x4a2bfc=_0x3df17b[_0xbb10('0x1b')];var _0x1145f1=_0x2f2ebf?0x0:_0x17fd46[_0xbb10('0x18')];var _0x42db98=_0x2f2ebf?_0x3df17b[_0xbb10('0x1b')]:_0x17fd46[_0xbb10('0x18')]+_0x17fd46[_0xbb10('0x1a')];var _0x30efc6;if(_0x42db98>=_0x4a2bfc){_0x42db98=_0x4a2bfc;_0x30efc6=0xc8;}else{_0x30efc6=0xce;}_0x45b9d6[_0xbb10('0x15')](_0x30efc6);return _0x45b9d6[_0xbb10('0x1c')]('Content-Range',_0x1145f1+'-'+_0x42db98+'/'+_0x4a2bfc)[_0xbb10('0x17')](_0x3df17b);}return null;};}function saveUpdates(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')](_0x19f48d)[_0xbb10('0x1e')](function(_0x44e563){if(_0x44e563['role']===_0xbb10('0x1f')){socket[_0xbb10('0x20')]('userNotification:recalc:'+_0x44e563['id'],_0x44e563);}return _0x44e563;});}return null;};}function removeEntity(_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x21')]()[_0xbb10('0x1e')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x22')]({'plain':!![]});if(_0x317da4[_0xbb10('0x23')]===_0xbb10('0x24'))return;var _0x436104=[{'name':_0xbb10('0x25'),'value':_0xbb10('0x26'),'ignore':!![]},{'name':_0xbb10('0x27'),'value':_0xbb10('0x1f'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x4fb5e0=_(_0x436104)[_0xbb10('0x28')](_0xbb10('0x29'))[_0xbb10('0x2a')]('value')[_0xbb10('0x2b')]();if(_[_0xbb10('0x2c')](_0x4fb5e0,_0x317da4[_0xbb10('0x23')])){return;}var _0x1d5e95=_[_0xbb10('0x2d')](_0x436104,[_0xbb10('0x2b'),_0x317da4[_0xbb10('0x23')]])['name'];return db[_0xbb10('0x2e')][_0xbb10('0x21')]({'where':{'type':_0x1d5e95,'resourceId':_0x317da4['id']}})[_0xbb10('0x1e')](function(){return _0x8e2b97;});})[_0xbb10('0x1e')](function(){_0x4c4b0d[_0xbb10('0x15')](0xcc)[_0xbb10('0x16')]();});}};}function handleEntityNotFound(_0x5d5c80){return function(_0x221624){if(!_0x221624){_0x5d5c80['sendStatus'](0x194);}return _0x221624;};}function handleError(_0x448d5c,_0x56f2da){_0x56f2da=_0x56f2da||0x1f4;return function(_0x16ad2a){logger[_0xbb10('0x2f')](_0x16ad2a[_0xbb10('0x30')]);if(_0x16ad2a['name']){delete _0x16ad2a['name'];}_0x448d5c[_0xbb10('0x15')](_0x56f2da)[_0xbb10('0x31')](_0x16ad2a);};}function getUserAttributes(){return _(db['User'][_0xbb10('0x32')])[_0xbb10('0x2a')](function(_0x2f653f){return{'name':_0x2f653f[_0xbb10('0x33')],'type':_0x2f653f[_0xbb10('0x34')][_0xbb10('0x35')]};})[_0xbb10('0x28')](function(_0x4975f5){return![_0xbb10('0x36'),_0xbb10('0x37'),_0xbb10('0x38'),_0xbb10('0x39'),_0xbb10('0x3a'),_0xbb10('0x3b')][_0xbb10('0x2c')](_0x4975f5[_0xbb10('0x3c')]);})[_0xbb10('0x2b')]();}exports['index']=function(_0x2b5352,_0x150107){var _0x1ddd9e={},_0x3c3c45={'count':0x0,'rows':[]};var _0x570f5a=getUserAttributes();_0x1ddd9e=qs[_0xbb10('0x3d')](_0x570f5a,_0x2b5352);var _0x5de37b={'where':_0x1ddd9e['where']};return db[_0xbb10('0x3e')][_0xbb10('0x1b')](_0x5de37b)[_0xbb10('0x1e')](function(_0x120d21){_0x3c3c45[_0xbb10('0x1b')]=_0x120d21;if(_0x2b5352[_0xbb10('0x3f')]['includeAll']){_0x1ddd9e[_0xbb10('0x40')]=[{'all':!![]}];}if(_0x2b5352[_0xbb10('0x3f')]['userSetting']==='true'){_0x1ddd9e['include']=[{'model':db[_0xbb10('0x41')],'as':_0xbb10('0x42')}];}if(!_[_0xbb10('0x2c')](_0x1ddd9e['attributes'],'id')){_0x1ddd9e[_0xbb10('0x43')][_0xbb10('0x44')]('id');}return db[_0xbb10('0x3e')]['findAll'](_0x1ddd9e);})[_0xbb10('0x1e')](function(_0x12238a){_0x3c3c45[_0xbb10('0x45')]=_0x12238a;if(_0x2b5352[_0xbb10('0x3f')]['openTabs']===_0xbb10('0x46')){var _0x110eb5=[];for(var _0x5835fd=0x0;_0x5835fd<_0x3c3c45[_0xbb10('0x45')][_0xbb10('0x47')];_0x5835fd++){_0x110eb5[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x48'),_0x3c3c45[_0xbb10('0x45')][_0x5835fd][_0xbb10('0x49')]));_0x110eb5['push'](get_open_tabs(_0xbb10('0x4a'),_0x3c3c45[_0xbb10('0x45')][_0x5835fd][_0xbb10('0x49')]));_0x110eb5[_0xbb10('0x44')](get_open_tabs('fax',_0x3c3c45[_0xbb10('0x45')][_0x5835fd][_0xbb10('0x49')]));_0x110eb5[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x4b'),_0x3c3c45['rows'][_0x5835fd][_0xbb10('0x49')]));_0x110eb5[_0xbb10('0x44')](get_open_tabs('openchannel',_0x3c3c45['rows'][_0x5835fd][_0xbb10('0x49')]));_0x110eb5['push'](get_open_tabs(_0xbb10('0x4c'),_0x3c3c45[_0xbb10('0x45')][_0x5835fd]['dataValues']));}return Promise[_0xbb10('0x4d')](_0x110eb5)[_0xbb10('0x1e')](function(){return _0x3c3c45;});}else{return _0x3c3c45;}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x150107,_0x1ddd9e))['catch'](handleError(_0x150107,null));};exports[_0xbb10('0x4e')]=function(_0xebd70c,_0x3b9fdf){var _0x32b729=getUserAttributes();_0xebd70c[_0xbb10('0x3f')]['id']=_0xebd70c[_0xbb10('0x4f')]['id'];var _0x190781=qs[_0xbb10('0x3d')](_0x32b729,_0xebd70c);if(_0xebd70c[_0xbb10('0x3f')][_0xbb10('0x50')]){_0x190781[_0xbb10('0x40')]=[{'all':!![]}];}if(_0xebd70c[_0xbb10('0x3f')]['userSetting']===_0xbb10('0x46')){_0x190781[_0xbb10('0x40')]=[{'model':db['UserSetting'],'as':_0xbb10('0x42')}];}_0x190781=_[_0xbb10('0x51')]({},_0x190781,_0xebd70c[_0xbb10('0x52')]);if(!_[_0xbb10('0x2c')](_0x190781[_0xbb10('0x43')],'id')){_0x190781[_0xbb10('0x43')][_0xbb10('0x44')]('id');}return db['User']['find'](_0x190781)[_0xbb10('0x1e')](handleEntityNotFound(_0x3b9fdf,null))[_0xbb10('0x1e')](function(_0x2b12bd){var _0x57d2c0=[];values=_0x2b12bd;if(_0xebd70c['query'][_0xbb10('0x53')]===_0xbb10('0x46')){_0x57d2c0[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x48'),_0x2b12bd[_0xbb10('0x49')]));_0x57d2c0[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x4a'),_0x2b12bd[_0xbb10('0x49')]));_0x57d2c0[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x54'),_0x2b12bd['dataValues']));_0x57d2c0['push'](get_open_tabs(_0xbb10('0x4c'),_0x2b12bd[_0xbb10('0x49')]));_0x57d2c0[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x55'),_0x2b12bd[_0xbb10('0x49')]));_0x57d2c0[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x4b'),_0x2b12bd[_0xbb10('0x49')]));return Promise[_0xbb10('0x4d')](_0x57d2c0);}else{return values;}})[_0xbb10('0x1e')](function(){return values;})[_0xbb10('0x1e')](respondWithResult(_0x3b9fdf,null))[_0xbb10('0x56')](handleError(_0x3b9fdf,null));};exports[_0xbb10('0x1d')]=function(_0x2e6fd9,_0x1d15f4){if(_0x2e6fd9['body']['id']){delete _0x2e6fd9[_0xbb10('0x57')]['id'];}delete _0x2e6fd9['body'][_0xbb10('0x23')];return db[_0xbb10('0x3e')][_0xbb10('0x2d')]({'where':{'id':_0x2e6fd9[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x1d15f4,null))[_0xbb10('0x1e')](saveUpdates(_0x2e6fd9[_0xbb10('0x57')],null))[_0xbb10('0x1e')](respondWithResult(_0x1d15f4,null))[_0xbb10('0x56')](handleError(_0x1d15f4,null));};exports[_0xbb10('0x58')]=function(_0x44a056,_0x1c2dce){return db[_0xbb10('0x3e')][_0xbb10('0x58')]()[_0xbb10('0x1e')](respondWithResult(_0x1c2dce,null))['catch'](handleError(_0x1c2dce,null));};exports[_0xbb10('0x59')]=function(_0x466eb7,_0x1b83a9){return db[_0xbb10('0x3e')][_0xbb10('0x2d')]({'where':{'id':_0x466eb7[_0xbb10('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1b83a9,null))[_0xbb10('0x1e')](function(_0x4731ce){if(_0x4731ce){return _0x4731ce[_0xbb10('0x59')](_0x466eb7[_0xbb10('0x57')][_0xbb10('0x5a')],_[_0xbb10('0x5b')](_0x466eb7[_0xbb10('0x57')],[_0xbb10('0x5a'),'id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x1b83a9,null))[_0xbb10('0x56')](handleError(_0x1b83a9,null));};function validateUser(_0x2eb05a){return new Promise(function(_0x2a1ce1,_0x16932f){if(_0x2eb05a['internal'])return _0x2a1ce1(_0x2eb05a);return db['Setting'][_0xbb10('0x5c')](0x1)[_0xbb10('0x1e')](function(_0x3d0cb7){if(_0x3d0cb7[_0xbb10('0x5d')])authService['validatePasswordPattern'](_0x2eb05a['password']);db[_0xbb10('0x3e')][_0xbb10('0x5e')](_0xbb10('0x5f'))[_0xbb10('0x1e')](function(_0x412f13){if(_[_0xbb10('0x60')](_0x412f13)){_0x2eb05a[_0xbb10('0x5f')]=_0x3d0cb7['min_internal']||0x1;return;}if(_[_0xbb10('0x60')](_0x3d0cb7[_0xbb10('0x61')])||_0x3d0cb7['min_internal']===_0x412f13){_0x2eb05a['internal']=_0x412f13+0x1;return;}if(_0x3d0cb7['min_internal']>_0x412f13){_0x2eb05a[_0xbb10('0x5f')]=_0x3d0cb7[_0xbb10('0x61')];return;}return db[_0xbb10('0x62')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0xbb10('0x63')][_0xbb10('0x64')]})[_0xbb10('0x1e')](function(_0x4e9fbd){if(_0x4e9fbd&&_0x4e9fbd[_0xbb10('0x47')]){for(var _0x13131c=0x0,_0x5a6538=_0x4e9fbd['length'];_0x13131c<_0x5a6538&&_[_0xbb10('0x60')](_0x2eb05a[_0xbb10('0x5f')]);_0x13131c++){if(_0x3d0cb7[_0xbb10('0x61')]<=_0x4e9fbd[_0x13131c][_0xbb10('0x65')]){_0x2eb05a['internal']=_0x4e9fbd[_0x13131c][_0xbb10('0x65')];}else if(_0x3d0cb7[_0xbb10('0x61')]>_0x4e9fbd[_0x13131c][_0xbb10('0x65')]&&_0x3d0cb7['min_internal']<=_0x4e9fbd[_0x13131c]['to']){_0x2eb05a[_0xbb10('0x5f')]=_0x3d0cb7[_0xbb10('0x61')];}}}if(_[_0xbb10('0x60')](_0x2eb05a['internal'])){_0x2eb05a[_0xbb10('0x5f')]=_0x412f13+0x1;}return _0x2a1ce1(_0x2eb05a);});});})[_0xbb10('0x56')](function(_0x3b0f08){_0x16932f(_0x3b0f08);});});}function updateUser(_0x37b65f){return new Promise(function(_0x5e4a6e,_0x251417){try{if(_0x37b65f[_0xbb10('0x66')]){_0x37b65f[_0xbb10('0x67')]=_0x37b65f[_0xbb10('0x5f')];_0x37b65f['VoiceMail']={'mailbox':_0x37b65f[_0xbb10('0x5f')],'password':_0x37b65f[_0xbb10('0x36')],'fullname':_0x37b65f[_0xbb10('0x68')],'email':_0x37b65f[_0xbb10('0x69')]};}if(_0x37b65f[_0xbb10('0x23')]===_0xbb10('0x1f')){if(!_0x37b65f[_0xbb10('0x6a')])_0x37b65f['permissions']=['101','102',_0xbb10('0x6b'),_0xbb10('0x6c'),_0xbb10('0x6d'),'104','105',_0xbb10('0x6e'),_0xbb10('0x6f'),_0xbb10('0x70'),_0xbb10('0x71'),_0xbb10('0x72'),_0xbb10('0x73'),'114',_0xbb10('0x74')];}_0x5e4a6e(_0x37b65f);}catch(_0x15fae2){_0x251417(_0x15fae2);}});}exports[_0xbb10('0x75')]=function(_0x14f16b,_0x2aaaa6){if(_0x14f16b['user']['role']==='agent')throw new Error(_0xbb10('0x76'));if(_0x14f16b[_0xbb10('0x57')][_0xbb10('0x23')]===_0xbb10('0x26')&&_0x14f16b[_0xbb10('0x26')][_0xbb10('0x23')]!=='admin'){throw new Error(_0xbb10('0x77'));}if(_0x14f16b['body']['role']==='admin'&&_0x14f16b[_0xbb10('0x26')][_0xbb10('0x23')]!==_0xbb10('0x24')){throw new Error(_0xbb10('0x78'));}return licenseUtil['checkUserLimits']([_0x14f16b[_0xbb10('0x57')]])['then'](function(){return validateUser(_0x14f16b['body']);})[_0xbb10('0x1e')](function(_0xfe3db0){return updateUser(_0xfe3db0)[_0xbb10('0x1e')](function(_0x2bd2ab){if(_0x2bd2ab[_0xbb10('0x23')]==='admin'){_0x2bd2ab[_0xbb10('0x79')]=_0x14f16b[_0xbb10('0x26')][_0xbb10('0x79')];delete _0x2bd2ab[_0xbb10('0x7a')];}return _0x2bd2ab;});})[_0xbb10('0x1e')](function(_0x27f42f){return db[_0xbb10('0x3e')]['create'](_0x27f42f,{'include':[{'model':db[_0xbb10('0x7b')],'as':_0xbb10('0x7b')}]});})[_0xbb10('0x1e')](function(_0x322b41){if(_0x14f16b[_0xbb10('0x57')][_0xbb10('0x23')]===_0xbb10('0x26'))return _0x322b41;if(_0x14f16b[_0xbb10('0x26')]['role']!==_0xbb10('0x26'))return _0x322b41;return db[_0xbb10('0x7c')][_0xbb10('0x2d')]({'where':{'name':_0x322b41['role']==='agent'?'Agents':_0xbb10('0x7d'),'userProfileId':_0x14f16b['user']['userProfileId']},'raw':!![]})[_0xbb10('0x1e')](function(_0x3ee56b){if(!_0x3ee56b||_0x3ee56b[_0xbb10('0x7e')]!=0x0)return _0x322b41;return db[_0xbb10('0x2e')][_0xbb10('0x75')]({'name':_0x322b41[_0xbb10('0x3c')],'resourceId':_0x322b41['id'],'type':_0x3ee56b[_0xbb10('0x3c')],'sectionId':_0x3ee56b['id']},{})[_0xbb10('0x1e')](function(){return _0x322b41;});})[_0xbb10('0x56')](function(_0x5206e1){logger[_0xbb10('0x2f')](_0xbb10('0x7f'),_0x5206e1);throw _0x5206e1;});})[_0xbb10('0x1e')](respondWithResult(_0x2aaaa6,0xc9))[_0xbb10('0x56')](handleError(_0x2aaaa6,null));};exports['bulkCreate']=function(_0x4c0795,_0x3547a3){var _0x2280bd=_0x4c0795[_0xbb10('0x57')];var _0x32bb25=[];if(_0x4c0795['user'][_0xbb10('0x23')]===_0xbb10('0x1f'))throw new Error(_0xbb10('0x76'));if(_[_0xbb10('0x80')](_0x2280bd,[_0xbb10('0x23'),'user'])&&_0x4c0795['user'][_0xbb10('0x23')]!==_0xbb10('0x24')){throw new Error(_0xbb10('0x77'));}if(_['some'](_0x2280bd,[_0xbb10('0x23'),_0xbb10('0x24')])&&_0x4c0795['user']['role']!==_0xbb10('0x24')){throw new Error(_0xbb10('0x81'));}return licenseUtil[_0xbb10('0x82')](_0x2280bd)['then'](function(){return validateUser(_0x2280bd[0x0]);})[_0xbb10('0x1e')](function(){for(var _0x3a17fc=0x1;_0x3a17fc<_0x2280bd[_0xbb10('0x47')];_0x3a17fc++){var _0x2d1805=_0x2280bd[_0x3a17fc-0x1][_0xbb10('0x5f')];if(!_0x2280bd[_0x3a17fc][_0xbb10('0x5f')])_0x2280bd[_0x3a17fc][_0xbb10('0x5f')]=_0x2d1805+0x1;_0x32bb25[_0xbb10('0x44')](validateUser(_0x2280bd[_0x3a17fc]));}return Promise[_0xbb10('0x4d')](_0x32bb25);})['then'](function(){_0x32bb25=[];for(var _0x3367d4=0x0;_0x3367d4<_0x2280bd[_0xbb10('0x47')];_0x3367d4++){_0x32bb25[_0xbb10('0x44')](updateUser(_0x2280bd[_0x3367d4]));}return Promise[_0xbb10('0x4d')](_0x32bb25);})[_0xbb10('0x1e')](function(){_0x32bb25=_0x2280bd[_0xbb10('0x2a')](function(_0x33a6fc){return db[_0xbb10('0x3e')][_0xbb10('0x75')](_0x33a6fc,{'include':[{'model':db[_0xbb10('0x7b')],'as':_0xbb10('0x7b')}]})[_0xbb10('0x1e')](function(_0x59e985){_0x33a6fc['id']=_0x59e985['id'];return _0x33a6fc;});});return Promise['all'](_0x32bb25);})[_0xbb10('0x1e')](function(_0x3fa344){if(_0x4c0795[_0xbb10('0x57')][_0xbb10('0x23')]===_0xbb10('0x26'))return _0x3fa344;if(_0x4c0795['user'][_0xbb10('0x23')]!==_0xbb10('0x26'))return _0x3fa344;var _0x3b4d0b=_[_0xbb10('0x80')](_0x3fa344,function(_0x19694d){return _0x19694d[_0xbb10('0x23')]==='agent'||_0x19694d[_0xbb10('0x23')]===_0xbb10('0x83');});if(!_0x3b4d0b)return _0x3fa344;return db['UserProfileSection'][_0xbb10('0x84')]({'where':{'name':{'$or':['Agents',_0xbb10('0x7d')]},'userProfileId':_0x4c0795[_0xbb10('0x26')][_0xbb10('0x7a')]},'raw':!![]})[_0xbb10('0x1e')](function(_0x3a4a6e){if(_['isEmpty'](_0x3a4a6e)||!_[_0xbb10('0x80')](_0x3a4a6e,['autoAssociation',0x0]))return _0x3fa344;_0x32bb25=[];var _0x3fcc55=_(_0x3a4a6e)[_0xbb10('0x2a')](function(_0x5d767f){if(_0x5d767f['autoAssociation']===0x1)return;return _0x5d767f[_0xbb10('0x3c')]===_0xbb10('0x27')?_0xbb10('0x1f'):_0xbb10('0x83');})[_0xbb10('0x85')]()[_0xbb10('0x2b')]();for(var _0x1b6ebc=0x0;_0x1b6ebc<_0x3fa344[_0xbb10('0x47')];_0x1b6ebc++){if(!_[_0xbb10('0x2c')](_0x3fcc55,_0x3fa344[_0x1b6ebc][_0xbb10('0x23')]))return;var _0x2bf9dd=_0x3fa344[_0x1b6ebc]['role']===_0xbb10('0x1f')?_0xbb10('0x27'):_0xbb10('0x7d');_0x32bb25[_0xbb10('0x44')](db[_0xbb10('0x2e')][_0xbb10('0x75')]({'name':_0x3fa344[_0x1b6ebc][_0xbb10('0x3c')],'resourceId':_0x3fa344[_0x1b6ebc]['id'],'type':_0x2bf9dd,'sectionId':_[_0xbb10('0x2d')](_0x3a4a6e,[_0xbb10('0x3c'),_0x2bf9dd])['id']},{}));}return Promise[_0xbb10('0x4d')](_0x32bb25);});})[_0xbb10('0x1e')](respondWithResult(_0x3547a3,0xc9))[_0xbb10('0x56')](handleError(_0x3547a3,null));};exports['changePassword']=function(_0xe1d006,_0x5e0741){if(_0xe1d006[_0xbb10('0x57')]['id']){delete _0xe1d006[_0xbb10('0x57')]['id'];}return db[_0xbb10('0x3e')][_0xbb10('0x2d')]({'where':{'id':_0xe1d006[_0xbb10('0x4f')]['id']}})['then'](function(_0x28bd78){if(!_0x28bd78)return null;if(_0x28bd78['id']===_0xe1d006[_0xbb10('0x26')]['id']){if(!_0xe1d006[_0xbb10('0x57')][_0xbb10('0x86')]||!_0xe1d006[_0xbb10('0x57')][_0xbb10('0x87')]){throw new db['Sequelize']['ValidationError'](_0xbb10('0x88'));}if(!_0x28bd78[_0xbb10('0x89')](_0xe1d006[_0xbb10('0x57')]['oldPassword'])){throw new db[(_0xbb10('0x8a'))][(_0xbb10('0x8b'))]('Wrong\x20credentials');}if(_0xe1d006[_0xbb10('0x57')][_0xbb10('0x86')]===_0xe1d006['body'][_0xbb10('0x87')]){throw new db['Sequelize'][(_0xbb10('0x8b'))](_0xbb10('0x8c'));}}else if(_0xe1d006['user'][_0xbb10('0x23')]===_0xbb10('0x24')){if(!_0xe1d006['body']['newPassword']){throw new db[(_0xbb10('0x8a'))][(_0xbb10('0x8b'))](_0xbb10('0x8d'));}}else if(_0xe1d006[_0xbb10('0x26')][_0xbb10('0x23')]==='user'){if(!_0xe1d006[_0xbb10('0x57')][_0xbb10('0x87')]){throw new db[(_0xbb10('0x8a'))]['ValidationError'](_0xbb10('0x8d'));}if(_0x28bd78[_0xbb10('0x23')]!==_0xbb10('0x1f')){throw new db[(_0xbb10('0x8a'))][(_0xbb10('0x8b'))](_0xbb10('0x76'));}}else{throw new db[(_0xbb10('0x8a'))][(_0xbb10('0x8b'))](_0xbb10('0x76'));}return _0x28bd78;})['then'](handleEntityNotFound(_0x5e0741,null))['then'](function(_0x37e40c){return db[_0xbb10('0x8e')][_0xbb10('0x8f')]({'attributes':['id',_0xbb10('0x5d'),_0xbb10('0x90'),_0xbb10('0x91')]})[_0xbb10('0x1e')](function(_0x1674f7){if(_0x1674f7[_0xbb10('0x5d')])authService[_0xbb10('0x92')](_0xe1d006[_0xbb10('0x57')][_0xbb10('0x87')]);if(!_0x1674f7[_0xbb10('0x90')]||!_0x37e40c['previousPasswords'])return _0x37e40c;authService[_0xbb10('0x93')](_0xe1d006[_0xbb10('0x57')][_0xbb10('0x87')],_0x37e40c[_0xbb10('0x38')],_0x1674f7[_0xbb10('0x91')]);return _0x37e40c;})[_0xbb10('0x1e')](saveUpdates({'password':_0xe1d006[_0xbb10('0x57')][_0xbb10('0x87')],'passwordResetAt':_0xe1d006[_0xbb10('0x26')]['id']==_0xe1d006[_0xbb10('0x4f')]['id']?moment():null,'previousPasswords':authService[_0xbb10('0x94')](_0xe1d006['body'][_0xbb10('0x87')],_0x37e40c['previousPasswords'])},null));})[_0xbb10('0x1e')](respondWithResult(_0x5e0741,null))[_0xbb10('0x56')](handleError(_0x5e0741,null));};exports[_0xbb10('0x95')]=function(_0x112261,_0x2b6e27){var _0xd2fff8=_0x112261['body'][_0xbb10('0x96')];return db['User'][_0xbb10('0x2d')]({'where':{'id':_0x112261[_0xbb10('0x4f')]['id']},'attributes':['id',_0xbb10('0x3c'),_0xbb10('0x23'),_0xbb10('0x97'),_0xbb10('0x98'),_0xbb10('0x99'),_0xbb10('0x9a')]})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b6e27,null))[_0xbb10('0x1e')](function(_0x13efa1){if(_0x13efa1){if(!utils[_0xbb10('0x9b')](_0xd2fff8)){throw new db['Sequelize'][(_0xbb10('0x8b'))]('Unknown\x20channel');}return _0x13efa1[_0xbb10('0x9c')+_[_0xbb10('0x9d')](_0xd2fff8[_0xbb10('0x9e')]())+_0xbb10('0x9f')](_0x112261[_0xbb10('0x57')][_0xbb10('0x5a')],{'penalty':_0x112261[_0xbb10('0x57')]['penalty']||0x0})[_0xbb10('0xa0')](function(_0x5ca9a0){for(var _0x51063a=0x0;_0x51063a<_0x112261[_0xbb10('0x57')][_0xbb10('0x5a')][_0xbb10('0x47')];_0x51063a+=0x1){var _0x1fd88a={'UserId':Number(_0x112261[_0xbb10('0x4f')]['id'])};_0x1fd88a[_[_0xbb10('0x9d')](_0xd2fff8['toLowerCase']())+_0xbb10('0xa1')]=Number(_0x112261[_0xbb10('0x57')][_0xbb10('0x5a')][_0x51063a]);socket[_0xbb10('0x20')](_0xbb10('0x26')+_[_0xbb10('0x9d')](_0xd2fff8['toLowerCase']())+_0xbb10('0xa2'),_0x1fd88a);}return _0x5ca9a0;})[_0xbb10('0x1e')](function(){if(_0xd2fff8===_0xbb10('0xa3')){return db[_0xbb10('0xa4')][_0xbb10('0x84')]({'where':{'id':_0x112261[_0xbb10('0x57')][_0xbb10('0x5a')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xbb10('0x1e')](function(_0x5e4ae9){var _0x3afbcf=_0x13efa1['get']({'plain':!![]});var _0x4c8b68=[];if(_0xd2fff8===_0xbb10('0xa3')&&_0x3afbcf[_0xbb10('0x23')]===_0xbb10('0x1f')&&_0x3afbcf[_0xbb10('0x97')]){for(let _0x2ad286=0x0;_0x2ad286<_0x5e4ae9['length'];_0x2ad286+=0x1){_0x4c8b68[_0xbb10('0x44')]({'membername':_0x3afbcf['name'],'UserId':_0x3afbcf['id'],'queue_name':_0x5e4ae9[_0x2ad286]['name'],'VoiceQueueId':_0x5e4ae9[_0x2ad286]['id'],'interface':_['isNil'](_0x3afbcf[_0xbb10('0x9a')])?util[_0xbb10('0xa5')](_0xbb10('0xa6'),_0x3afbcf[_0xbb10('0x3c')]):_0x3afbcf[_0xbb10('0x9a')],'paused':_0x3afbcf['voicePause']||![],'penalty':_0x112261[_0xbb10('0x57')][_0xbb10('0xa7')]||0x0});}return Promise[_0xbb10('0x4d')](_0x4c8b68[_0xbb10('0x2a')](function(_0x4b3b21){return db[_0xbb10('0xa8')][_0xbb10('0xa9')](_0x4b3b21);}));}return _0x13efa1;});}})['then'](respondWithStatusCode(_0x2b6e27,null))['catch'](handleError(_0x2b6e27,null));};exports['removeQueues']=function(_0x386eac,_0x1581ef){var _0x2ae3c6,_0x3125c3;return db[_0xbb10('0x3e')][_0xbb10('0x2d')]({'where':{'id':_0x386eac[_0xbb10('0x4f')]['id']},'attributes':['id',_0xbb10('0x3c'),_0xbb10('0x23')]})[_0xbb10('0x1e')](handleEntityNotFound(_0x1581ef,null))['then'](function(_0x58295f){if(_0x58295f){_0x2ae3c6=_0x58295f;if(!_0x386eac['query'][_0xbb10('0x96')]||!utils[_0xbb10('0x9b')](_0x386eac[_0xbb10('0x3f')]['channel'])){throw new db[(_0xbb10('0x8a'))][(_0xbb10('0x8b'))](_0xbb10('0xaa'));}return _0x58295f[_0xbb10('0xab')+_[_0xbb10('0x9d')](_0x386eac[_0xbb10('0x3f')]['channel']['toLowerCase']())+_0xbb10('0x9f')](_0x386eac['query'][_0xbb10('0x5a')]);}})[_0xbb10('0x1e')](function(_0x152ca9){if(_[_0xbb10('0xac')](_0x386eac[_0xbb10('0x3f')][_0xbb10('0x5a')])){for(var _0x13a29e=0x0;_0x13a29e<_0x386eac[_0xbb10('0x3f')][_0xbb10('0x5a')][_0xbb10('0x47')];_0x13a29e+=0x1){_0x3125c3={'UserId':Number(_0x386eac['params']['id'])};_0x3125c3[_[_0xbb10('0x9d')](_0x386eac['query'][_0xbb10('0x96')]['toLowerCase']())+_0xbb10('0xa1')]=Number(_0x386eac[_0xbb10('0x3f')][_0xbb10('0x5a')][_0x13a29e]);socket[_0xbb10('0x20')]('user'+_[_0xbb10('0x9d')](_0x386eac['query'][_0xbb10('0x96')][_0xbb10('0x9e')]())+_0xbb10('0xad'),_0x3125c3);}}else{_0x3125c3={'UserId':Number(_0x386eac['params']['id'])};_0x3125c3[_[_0xbb10('0x9d')](_0x386eac[_0xbb10('0x3f')][_0xbb10('0x96')][_0xbb10('0x9e')]())+_0xbb10('0xa1')]=Number(_0x386eac[_0xbb10('0x3f')]['ids']);socket['emit']('user'+_[_0xbb10('0x9d')](_0x386eac['query'][_0xbb10('0x96')]['toLowerCase']())+_0xbb10('0xad'),_0x3125c3);}return _0x152ca9;})[_0xbb10('0x1e')](function(){if(_0x386eac[_0xbb10('0x3f')]['channel']==='voice'){return db[_0xbb10('0xa8')][_0xbb10('0x21')]({'where':{'UserId':_0x386eac[_0xbb10('0x4f')]['id'],'VoiceQueueId':_0x386eac['query'][_0xbb10('0x5a')]},'individualHooks':!![]})[_0xbb10('0x1e')](function(){return _0x2ae3c6;});}return _0x2ae3c6;})[_0xbb10('0x1e')](respondWithStatusCode(_0x1581ef,null))['catch'](handleError(_0x1581ef,null));};exports['addAvatar']=function(_0x5a685d,_0x2980b7){_0x5a685d['body'][_0xbb10('0xae')]=_0x5a685d[_0xbb10('0xaf')][_0xbb10('0xb0')];return db[_0xbb10('0x3e')][_0xbb10('0x2d')]({'where':{'id':_0x5a685d[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2980b7,null))[_0xbb10('0x1e')](saveUpdates(_0x5a685d[_0xbb10('0x57')],null))[_0xbb10('0x1e')](respondWithResult(_0x2980b7,null))[_0xbb10('0x56')](handleError(_0x2980b7,null));};exports['getAvatar']=function(_0xaa2353,_0x1d4abd){var _0x5c58be=path[_0xbb10('0xb1')](config['root'],'server/files/images/logos/default_profile.png');return db[_0xbb10('0x3e')][_0xbb10('0x2d')]({'where':{'id':_0xaa2353[_0xbb10('0x4f')]['id']},'attributes':['id',_0xbb10('0xae')],'raw':!![]})[_0xbb10('0x1e')](handleEntityNotFound(_0x1d4abd,null))['then'](function(_0x161171){if(_0x161171){if(_[_0xbb10('0x60')](_0x161171['userpic'])){return _0x1d4abd[_0xbb10('0xb2')](_0x5c58be);}else{if(!fs[_0xbb10('0xb3')](path['join'](config[_0xbb10('0xb4')],'server/files/images/',_0x161171[_0xbb10('0xae')]))){return _0x1d4abd[_0xbb10('0xb2')](_0x5c58be);}return _0x1d4abd[_0xbb10('0xb2')](path[_0xbb10('0xb1')](config[_0xbb10('0xb4')],_0xbb10('0xb5'),_0x161171[_0xbb10('0xae')]));}}})['catch'](handleError(_0x1d4abd,null));};exports[_0xbb10('0xb6')]=function(_0x4720a1,_0x1cdad0){return db[_0xbb10('0x3e')][_0xbb10('0x2d')]({'where':{'id':_0x4720a1[_0xbb10('0x4f')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1cdad0,null))['then'](function(_0x5a40e8){var _0x23849e=[];values=_0x5a40e8[_0xbb10('0x49')];_0x23849e[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x48'),_0x5a40e8['dataValues']));_0x23849e[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x4a'),_0x5a40e8[_0xbb10('0x49')]));_0x23849e['push'](get_open_tabs('openchannel',_0x5a40e8[_0xbb10('0x49')]));_0x23849e['push'](get_open_tabs(_0xbb10('0x4c'),_0x5a40e8[_0xbb10('0x49')]));_0x23849e[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x55'),_0x5a40e8[_0xbb10('0x49')]));_0x23849e[_0xbb10('0x44')](get_open_tabs(_0xbb10('0x4b'),_0x5a40e8['dataValues']));return Promise[_0xbb10('0x4d')](_0x23849e);})[_0xbb10('0x1e')](function(_0x577a40){if(_0x577a40){var _0x23301a=_[_0xbb10('0x2a')](values[_0xbb10('0xb7')],function(_0x5b11a2){return{'channel':'CHAT','id':_0x5b11a2['id'],'createdAt':_0x5b11a2['createdAt']};});var _0x3571ba=_[_0xbb10('0x2a')](values['FaxOpenTabs'],function(_0x149bbe){return{'channel':_0xbb10('0xb8'),'id':_0x149bbe['id'],'createdAt':_0x149bbe[_0xbb10('0xb9')]};});var _0x24b0ea=_[_0xbb10('0x2a')](values[_0xbb10('0xba')],function(_0x34225f){return{'channel':'OPENCHANNEL','id':_0x34225f['id'],'createdAt':_0x34225f[_0xbb10('0xb9')]};});var _0x4fe7e4=_['map'](values['MailOpenTabs'],function(_0x142b84){return{'channel':_0xbb10('0xbb'),'id':_0x142b84['id'],'createdAt':_0x142b84['createdAt']};});var _0x1f09f1=_['map'](values[_0xbb10('0xbc')],function(_0x350fb2){return{'channel':_0xbb10('0xbd'),'id':_0x350fb2['id'],'createdAt':_0x350fb2['createdAt']};});var _0x4d10ea=_[_0xbb10('0x2a')](values['WhatsappOpenTabs'],function(_0x4a8cd){return{'channel':_0xbb10('0xbe'),'id':_0x4a8cd['id'],'createdAt':_0x4a8cd['createdAt']};});var _0x50cd00=_[_0xbb10('0xbf')](_0x23301a,_0x3571ba,_0x24b0ea,_0x4fe7e4,_0x1f09f1,_0x4d10ea);var _0x385bab={'count':_0x50cd00[_0xbb10('0x47')],'rows':_0x50cd00};return _0x385bab;}else return null;})['then'](respondWithResult(_0x1cdad0,null))[_0xbb10('0x56')](handleError(_0x1cdad0,null));};exports[_0xbb10('0xc0')]=function(_0x22f153,_0x4d47cc){var _0x414066={};return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x22f153[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1e')](function(_0x29bd42){if(!_0x29bd42){throw new APINotFoundError(util[_0xbb10('0xa5')](_0xbb10('0xc1'),_0x22f153[_0xbb10('0x4f')]['id']));}return contacts[_0xbb10('0x58')]();})[_0xbb10('0x1e')](function(_0x20712c){_0x22f153[_0xbb10('0x3f')]['User']=_0x22f153['params']['id'];_0x414066=qs[_0xbb10('0x3d')](_0x20712c,_0x22f153);if(_0x22f153['query'][_0xbb10('0xc2')](_0xbb10('0x50'))){_0x414066[_0xbb10('0x40')]=[{'model':db['CmList'],'as':_0xbb10('0xc3'),'required':![]},{'model':db[_0xbb10('0xc4')],'as':_0xbb10('0xc5'),'attributes':['id',_0xbb10('0x3c'),_0xbb10('0xc6')],'where':_0x22f153['query'][_0xbb10('0xc7')]?{'id':_0x22f153[_0xbb10('0x3f')][_0xbb10('0xc7')]}:undefined,'required':_0x22f153[_0xbb10('0x3f')][_0xbb10('0xc7')]?!![]:![]}];}return contacts[_0xbb10('0x84')](_0x22f153['query'],_0x22f153[_0xbb10('0x26')],_0x414066,_0x20712c);})[_0xbb10('0x1e')](respondWithFilteredResult(_0x4d47cc,_0x414066))['catch'](APIHandleError(_0x4d47cc));};exports[_0xbb10('0xc8')]=function(_0x2a6b41,_0x2d0de5){var _0x3bfba9;var _0x3abc15={};var _0x43df3c;return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x2a6b41[_0xbb10('0x4f')]['id']},'attributes':['id',_0xbb10('0x3c'),_0xbb10('0x23')]})[_0xbb10('0x1e')](handleEntityNotFound(_0x2d0de5,null))[_0xbb10('0x1e')](function(_0x3d1ebb){if(!utils[_0xbb10('0x9b')](_0x2a6b41['query'][_0xbb10('0x96')])){throw new db[(_0xbb10('0x8a'))]['ValidationError']('Unknown\x20channel');}_0x3bfba9=_0x3d1ebb;var _0x237258={};_0x237258[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db[_[_0xbb10('0x9d')](_0x2a6b41[_0xbb10('0x3f')][_0xbb10('0x96')])+_0xbb10('0xcb')][_0xbb10('0x32')]);_0x237258[_0xbb10('0x3f')]=_['keys'](_0x2a6b41['query']);_0x237258['filters']=_['intersection'](_0x237258['model'],_0x237258['query']);_0x3abc15[_0xbb10('0x43')]=_[_0xbb10('0xcc')](_0x237258[_0xbb10('0xc9')],qs[_0xbb10('0xcd')](_0x2a6b41['query'][_0xbb10('0xcd')]));_0x3abc15[_0xbb10('0x43')]=_0x3abc15[_0xbb10('0x43')][_0xbb10('0x47')]?_0x3abc15['attributes']:_0x237258['model'];_0x3abc15[_0xbb10('0xce')]=qs[_0xbb10('0xcf')](_0x2a6b41['query']['sort']);_0x3abc15[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_[_0xbb10('0xd2')](_0x2a6b41[_0xbb10('0x3f')],_0x237258[_0xbb10('0xd1')]));if(_0x2a6b41['query'][_0xbb10('0x28')]){_0x3abc15['where']=_['merge'](_0x3abc15[_0xbb10('0xd0')],{'$or':_[_0xbb10('0x2a')](_0x3abc15[_0xbb10('0x43')],function(_0x17a135){var _0x3b1e6f={};_0x3b1e6f[_0x17a135]={'$like':'%'+_0x2a6b41[_0xbb10('0x3f')]['filter']+'%'};return _0x3b1e6f;})});}_0x3abc15=_[_0xbb10('0x51')]({},_0x3abc15,_0x2a6b41[_0xbb10('0x52')]);switch(_0x3bfba9[_0xbb10('0x23')]){case _0xbb10('0x24'):return db[_[_0xbb10('0x9d')](_0x2a6b41[_0xbb10('0x3f')][_0xbb10('0x96')])+_0xbb10('0xcb')][_0xbb10('0x84')](_0x3abc15);case _0xbb10('0x26'):case _0xbb10('0x1f'):return _0x3bfba9[_0xbb10('0x22')+_[_0xbb10('0x9d')](_0x2a6b41[_0xbb10('0x3f')][_0xbb10('0x96')])+_0xbb10('0x9f')](_0x3abc15);default:throw new db[(_0xbb10('0x8a'))][(_0xbb10('0x8b'))](_0xbb10('0xd3'));}})[_0xbb10('0x1e')](function(_0x1ca43e){_0x43df3c=_0x1ca43e[_0xbb10('0x47')];if(!_0x2a6b41['query'][_0xbb10('0xc2')]('nolimit')){_0x3abc15[_0xbb10('0x1a')]=qs[_0xbb10('0x1a')](_0x2a6b41[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x3abc15[_0xbb10('0x18')]=qs['offset'](_0x2a6b41['query']['offset']);}switch(_0x3bfba9[_0xbb10('0x23')]){case _0xbb10('0x24'):return db[_['capitalize'](_0x2a6b41[_0xbb10('0x3f')][_0xbb10('0x96')])+_0xbb10('0xcb')]['findAll'](_0x3abc15);case _0xbb10('0x26'):case _0xbb10('0x1f'):return _0x3bfba9[_0xbb10('0x22')+_['capitalize'](_0x2a6b41[_0xbb10('0x3f')]['channel'])+_0xbb10('0x9f')](_0x3abc15);}})['then'](function(_0x55b881){return{'count':_0x43df3c,'rows':_0x55b881};})['then'](respondWithResult(_0x2d0de5,null))['catch'](handleError(_0x2d0de5,null));};exports['getVoiceQueuesRt']=function(_0x54b427,_0x113b96){var _0x2cfd28={};var _0x2d0f51={};var _0x17f300;var _0x583889;return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x54b427[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x113b96,null))[_0xbb10('0x1e')](function(_0x17bff6){if(_0x17bff6){_0x17f300=_0x17bff6;_0x2d0f51[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db[_0xbb10('0xa8')][_0xbb10('0x32')]);_0x2d0f51['query']=_[_0xbb10('0xca')](_0x54b427[_0xbb10('0x3f')]);_0x2d0f51[_0xbb10('0xd1')]=_['intersection'](_0x2d0f51[_0xbb10('0xc9')],_0x2d0f51[_0xbb10('0x3f')]);_0x2cfd28[_0xbb10('0x43')]=_[_0xbb10('0xcc')](_0x2d0f51['model'],qs[_0xbb10('0xcd')](_0x54b427[_0xbb10('0x3f')][_0xbb10('0xcd')]));_0x2cfd28[_0xbb10('0x43')]=_0x2cfd28[_0xbb10('0x43')][_0xbb10('0x47')]?_0x2cfd28[_0xbb10('0x43')]:_0x2d0f51[_0xbb10('0xc9')];_0x2cfd28[_0xbb10('0xce')]=qs[_0xbb10('0xcf')](_0x54b427[_0xbb10('0x3f')]['sort']);_0x2cfd28[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_['pick'](_0x54b427['query'],_0x2d0f51[_0xbb10('0xd1')]));if(_0x54b427[_0xbb10('0x3f')]['filter']){_0x2cfd28[_0xbb10('0xd0')]=_[_0xbb10('0x51')](_0x2cfd28['where'],{'$or':_[_0xbb10('0x2a')](_0x2cfd28[_0xbb10('0x43')],function(_0xb563e5){var _0x4297b9={};_0x4297b9[_0xb563e5]={'$like':'%'+_0x54b427[_0xbb10('0x3f')]['filter']+'%'};return _0x4297b9;})});}_0x2cfd28=_['merge']({},_0x2cfd28,_0x54b427['options']);return _0x17f300[_0xbb10('0xd4')](_0x2cfd28);}})['then'](function(_0x43deea){if(_0x43deea){_0x583889=_0x43deea['length'];if(!_0x54b427['query'][_0xbb10('0xc2')](_0xbb10('0xd5'))){_0x2cfd28[_0xbb10('0x1a')]=qs[_0xbb10('0x1a')](_0x54b427[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x2cfd28['offset']=qs['offset'](_0x54b427['query'][_0xbb10('0x18')]);}return _0x17f300[_0xbb10('0xd4')](_0x2cfd28);}})[_0xbb10('0x1e')](function(_0x2991a9){if(_0x2991a9){return _0x2991a9?{'count':_0x583889,'rows':_0x2991a9}:null;}})[_0xbb10('0x1e')](respondWithResult(_0x113b96,null))[_0xbb10('0x56')](handleError(_0x113b96,null));};exports[_0xbb10('0xd6')]=function(_0x4a6a69,_0x2189ae){var _0x207bbb={};var _0x35586a={};var _0x84a51c;var _0x52b8fa;return db[_0xbb10('0x3e')]['findOne']({'where':{'id':_0x4a6a69['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2189ae,null))[_0xbb10('0x1e')](function(_0x449e7e){if(_0x449e7e){_0x84a51c=_0x449e7e;_0x35586a[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db[_0xbb10('0xd7')]['rawAttributes']);_0x35586a[_0xbb10('0x3f')]=_[_0xbb10('0xca')](_0x4a6a69[_0xbb10('0x3f')]);_0x35586a[_0xbb10('0xd1')]=_[_0xbb10('0xcc')](_0x35586a[_0xbb10('0xc9')],_0x35586a[_0xbb10('0x3f')]);_0x207bbb['attributes']=_[_0xbb10('0xcc')](_0x35586a[_0xbb10('0xc9')],qs[_0xbb10('0xcd')](_0x4a6a69['query']['fields']));_0x207bbb[_0xbb10('0x43')]=_0x207bbb[_0xbb10('0x43')][_0xbb10('0x47')]?_0x207bbb[_0xbb10('0x43')]:_0x35586a[_0xbb10('0xc9')];_0x207bbb[_0xbb10('0xce')]=qs[_0xbb10('0xcf')](_0x4a6a69['query'][_0xbb10('0xcf')]);_0x207bbb[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_['pick'](_0x4a6a69['query'],_0x35586a['filters']));if(_0x4a6a69['query'][_0xbb10('0x28')]){_0x207bbb[_0xbb10('0xd0')]=_[_0xbb10('0x51')](_0x207bbb[_0xbb10('0xd0')],{'$or':_['map'](_0x207bbb[_0xbb10('0x43')],function(_0x4f6b12){var _0x1f071e={};_0x1f071e[_0x4f6b12]={'$like':'%'+_0x4a6a69[_0xbb10('0x3f')][_0xbb10('0x28')]+'%'};return _0x1f071e;})});}_0x207bbb=_[_0xbb10('0x51')]({},_0x207bbb,_0x4a6a69[_0xbb10('0x52')]);return _0x84a51c[_0xbb10('0xd6')](_0x207bbb);}})[_0xbb10('0x1e')](function(_0x4541f2){if(_0x4541f2){_0x52b8fa=_0x4541f2[_0xbb10('0x47')];if(!_0x4a6a69[_0xbb10('0x3f')][_0xbb10('0xc2')](_0xbb10('0xd5'))){_0x207bbb['limit']=qs[_0xbb10('0x1a')](_0x4a6a69[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x207bbb['offset']=qs[_0xbb10('0x18')](_0x4a6a69['query'][_0xbb10('0x18')]);}return _0x84a51c[_0xbb10('0xd6')](_0x207bbb);}})[_0xbb10('0x1e')](function(_0x252833){if(_0x252833){return _0x252833?{'count':_0x52b8fa,'rows':_0x252833}:null;}})[_0xbb10('0x1e')](respondWithResult(_0x2189ae,null))['catch'](handleError(_0x2189ae,null));};exports['getRecordings']=function(_0x842d94,_0x4cf5cc){var _0x553bb8={'raw':!![],'where':{}};var _0x2ff72a={};var _0x5621b1={'count':0x0,'rows':[]};return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x842d94[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x4cf5cc,null))[_0xbb10('0x1e')](function(_0x326fa9){if(_0x326fa9){_0x2ff72a[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db['VoiceRecording'][_0xbb10('0x32')]);_0x2ff72a['query']=_[_0xbb10('0xca')](_0x842d94['query']);_0x2ff72a[_0xbb10('0xd1')]=_[_0xbb10('0xcc')](_0x2ff72a['model'],_0x2ff72a[_0xbb10('0x3f')]);_0x553bb8[_0xbb10('0x43')]=_[_0xbb10('0xcc')](_0x2ff72a['model'],qs[_0xbb10('0xcd')](_0x842d94[_0xbb10('0x3f')][_0xbb10('0xcd')]));_0x553bb8['attributes']=_0x553bb8[_0xbb10('0x43')][_0xbb10('0x47')]?_0x553bb8[_0xbb10('0x43')]:_0x2ff72a['model'];if(!_0x842d94[_0xbb10('0x3f')]['hasOwnProperty'](_0xbb10('0xd5'))){_0x553bb8[_0xbb10('0x1a')]=qs[_0xbb10('0x1a')](_0x842d94[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x553bb8[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x842d94[_0xbb10('0x3f')][_0xbb10('0x18')]);}_0x553bb8[_0xbb10('0xce')]=qs['sort'](_0x842d94['query'][_0xbb10('0xcf')]);_0x553bb8[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_['pick'](_0x842d94[_0xbb10('0x3f')],_0x2ff72a[_0xbb10('0xd1')]));_0x553bb8[_0xbb10('0xd0')][_0xbb10('0xd8')]=_0x326fa9['id'];if(_0x842d94[_0xbb10('0x3f')][_0xbb10('0x28')]){_0x553bb8[_0xbb10('0xd0')]=_[_0xbb10('0x51')](_0x553bb8[_0xbb10('0xd0')],{'$or':_['map'](_0x553bb8[_0xbb10('0x43')],function(_0x954840){var _0x4102af={};_0x4102af[_0x954840]={'$like':'%'+_0x842d94[_0xbb10('0x3f')]['filter']+'%'};return _0x4102af;})});}_0x553bb8=_[_0xbb10('0x51')]({},_0x553bb8,_0x842d94[_0xbb10('0x52')]);return db[_0xbb10('0xd9')]['count']({'where':_0x553bb8['where']})[_0xbb10('0x1e')](function(_0x4f4157){_0x5621b1[_0xbb10('0x1b')]=_0x4f4157;if(_0x842d94['query'][_0xbb10('0x50')]){_0x553bb8[_0xbb10('0x40')]=[{'all':!![]}];}return db[_0xbb10('0xd9')][_0xbb10('0x84')](_0x553bb8);})[_0xbb10('0x1e')](function(_0x3c5a97){_0x5621b1[_0xbb10('0x45')]=_0x3c5a97;return _0x5621b1;});}})['then'](respondWithFilteredResult(_0x4cf5cc,_0x553bb8))[_0xbb10('0x56')](handleError(_0x4cf5cc,null));};exports[_0xbb10('0xda')]=function(_0x28271e,_0x2807d2){var _0x2f0a58={'raw':!![],'where':{}};var _0xfe1846={};var _0x4de6ec={'count':0x0,'rows':[]};return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x28271e[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2807d2,null))[_0xbb10('0x1e')](function(_0x16edac){if(_0x16edac){_0xfe1846[_0xbb10('0xc9')]=_['keys'](db[_0xbb10('0xdb')][_0xbb10('0x32')]);_0xfe1846[_0xbb10('0x3f')]=_['keys'](_0x28271e[_0xbb10('0x3f')]);_0xfe1846['filters']=_[_0xbb10('0xcc')](_0xfe1846[_0xbb10('0xc9')],_0xfe1846[_0xbb10('0x3f')]);_0x2f0a58['attributes']=_['intersection'](_0xfe1846[_0xbb10('0xc9')],qs[_0xbb10('0xcd')](_0x28271e[_0xbb10('0x3f')][_0xbb10('0xcd')]));_0x2f0a58[_0xbb10('0x43')]=_0x2f0a58[_0xbb10('0x43')][_0xbb10('0x47')]?_0x2f0a58[_0xbb10('0x43')]:_0xfe1846[_0xbb10('0xc9')];if(!_0x28271e[_0xbb10('0x3f')][_0xbb10('0xc2')]('nolimit')){_0x2f0a58['limit']=qs[_0xbb10('0x1a')](_0x28271e[_0xbb10('0x3f')]['limit']);_0x2f0a58['offset']=qs[_0xbb10('0x18')](_0x28271e[_0xbb10('0x3f')][_0xbb10('0x18')]);}_0x2f0a58['order']=qs[_0xbb10('0xcf')](_0x28271e[_0xbb10('0x3f')]['sort']);_0x2f0a58[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_['pick'](_0x28271e['query'],_0xfe1846[_0xbb10('0xd1')]));_0x2f0a58[_0xbb10('0xd0')][_0xbb10('0xd8')]=_0x16edac['id'];if(_0x28271e['query']['filter']){_0x2f0a58[_0xbb10('0xd0')]=_[_0xbb10('0x51')](_0x2f0a58['where'],{'$or':_[_0xbb10('0x2a')](_0x2f0a58[_0xbb10('0x43')],function(_0x59eb5f){var _0xecba74={};_0xecba74[_0x59eb5f]={'$like':'%'+_0x28271e[_0xbb10('0x3f')][_0xbb10('0x28')]+'%'};return _0xecba74;})});}_0x2f0a58=_[_0xbb10('0x51')]({},_0x2f0a58,_0x28271e['options']);return db[_0xbb10('0xdb')]['count']({'where':_0x2f0a58[_0xbb10('0xd0')]})[_0xbb10('0x1e')](function(_0x2aaf70){_0x4de6ec[_0xbb10('0x1b')]=_0x2aaf70;if(_0x28271e[_0xbb10('0x3f')][_0xbb10('0x50')]){_0x2f0a58[_0xbb10('0x40')]=[{'all':!![]}];}return db[_0xbb10('0xdb')]['findAll'](_0x2f0a58);})[_0xbb10('0x1e')](function(_0x304905){_0x4de6ec[_0xbb10('0x45')]=_0x304905;return _0x4de6ec;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x2807d2,_0x2f0a58))['catch'](handleError(_0x2807d2,null));};exports['getChatInteractions']=function(_0xd23108,_0x2c2cb5){var _0x183503={};var _0x18bf29={};var _0x5b2e0b;var _0x215028;return db[_0xbb10('0x3e')]['findOne']({'where':{'id':_0xd23108[_0xbb10('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2c2cb5,null))['then'](function(_0x1a9be4){if(_0x1a9be4){_0x5b2e0b=_0x1a9be4;_0x18bf29[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db[_0xbb10('0xdc')][_0xbb10('0x32')]);_0x18bf29['query']=_[_0xbb10('0xca')](_0xd23108[_0xbb10('0x3f')]);_0x18bf29[_0xbb10('0xd1')]=_[_0xbb10('0xcc')](_0x18bf29[_0xbb10('0xc9')],_0x18bf29[_0xbb10('0x3f')]);_0x183503[_0xbb10('0x43')]=_[_0xbb10('0xcc')](_0x18bf29[_0xbb10('0xc9')],qs[_0xbb10('0xcd')](_0xd23108[_0xbb10('0x3f')][_0xbb10('0xcd')]));_0x183503[_0xbb10('0x43')]=_0x183503[_0xbb10('0x43')][_0xbb10('0x47')]?_0x183503[_0xbb10('0x43')]:_0x18bf29[_0xbb10('0xc9')];_0x183503[_0xbb10('0xce')]=qs[_0xbb10('0xcf')](_0xd23108[_0xbb10('0x3f')][_0xbb10('0xcf')]);_0x183503[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_[_0xbb10('0xd2')](_0xd23108[_0xbb10('0x3f')],_0x18bf29[_0xbb10('0xd1')]));if(_0xd23108[_0xbb10('0x3f')]['filter']){_0x183503[_0xbb10('0xd0')]=_[_0xbb10('0x51')](_0x183503['where'],{'$or':_[_0xbb10('0x2a')](_0x183503[_0xbb10('0x43')],function(_0x4d2ada){var _0x3a20c0={};_0x3a20c0[_0x4d2ada]={'$like':'%'+_0xd23108[_0xbb10('0x3f')]['filter']+'%'};return _0x3a20c0;})});}_0x183503=_[_0xbb10('0x51')]({},_0x183503,_0xd23108[_0xbb10('0x52')]);return _0x5b2e0b[_0xbb10('0xdd')](_0x183503);}})[_0xbb10('0x1e')](function(_0x54462f){if(_0x54462f){_0x215028=_0x54462f[_0xbb10('0x47')];if(!_0xd23108[_0xbb10('0x3f')][_0xbb10('0xc2')](_0xbb10('0xd5'))){_0x183503['limit']=qs[_0xbb10('0x1a')](_0xd23108[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x183503[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xd23108[_0xbb10('0x3f')][_0xbb10('0x18')]);}return _0x5b2e0b[_0xbb10('0xdd')](_0x183503);}})[_0xbb10('0x1e')](function(_0x22900c){if(_0x22900c){return _0x22900c?{'count':_0x215028,'rows':_0x22900c}:null;}})[_0xbb10('0x1e')](respondWithResult(_0x2c2cb5,null))['catch'](handleError(_0x2c2cb5,null));};exports[_0xbb10('0xde')]=function(_0x2c19cb,_0x7a82c0){var _0x5bd5c5={};var _0x57d03c={};var _0x5116d8;var _0x8bfc0f;return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x2c19cb[_0xbb10('0x4f')]['id']}})['then'](handleEntityNotFound(_0x7a82c0,null))[_0xbb10('0x1e')](function(_0x3cf414){if(_0x3cf414){_0x5116d8=_0x3cf414;_0x57d03c[_0xbb10('0xc9')]=_['keys'](db['OpenchannelInteraction'][_0xbb10('0x32')]);_0x57d03c[_0xbb10('0x3f')]=_['keys'](_0x2c19cb['query']);_0x57d03c[_0xbb10('0xd1')]=_[_0xbb10('0xcc')](_0x57d03c[_0xbb10('0xc9')],_0x57d03c[_0xbb10('0x3f')]);_0x5bd5c5[_0xbb10('0x43')]=_[_0xbb10('0xcc')](_0x57d03c['model'],qs[_0xbb10('0xcd')](_0x2c19cb[_0xbb10('0x3f')][_0xbb10('0xcd')]));_0x5bd5c5[_0xbb10('0x43')]=_0x5bd5c5[_0xbb10('0x43')][_0xbb10('0x47')]?_0x5bd5c5[_0xbb10('0x43')]:_0x57d03c[_0xbb10('0xc9')];_0x5bd5c5[_0xbb10('0xce')]=qs[_0xbb10('0xcf')](_0x2c19cb['query'][_0xbb10('0xcf')]);_0x5bd5c5[_0xbb10('0xd0')]=qs['filters'](_['pick'](_0x2c19cb['query'],_0x57d03c['filters']));if(_0x2c19cb['query']['filter']){_0x5bd5c5['where']=_['merge'](_0x5bd5c5[_0xbb10('0xd0')],{'$or':_[_0xbb10('0x2a')](_0x5bd5c5['attributes'],function(_0x3906f6){var _0xd69821={};_0xd69821[_0x3906f6]={'$like':'%'+_0x2c19cb[_0xbb10('0x3f')][_0xbb10('0x28')]+'%'};return _0xd69821;})});}_0x5bd5c5=_[_0xbb10('0x51')]({},_0x5bd5c5,_0x2c19cb[_0xbb10('0x52')]);return _0x5116d8[_0xbb10('0xde')](_0x5bd5c5);}})[_0xbb10('0x1e')](function(_0x405428){if(_0x405428){_0x8bfc0f=_0x405428[_0xbb10('0x47')];if(!_0x2c19cb[_0xbb10('0x3f')][_0xbb10('0xc2')]('nolimit')){_0x5bd5c5[_0xbb10('0x1a')]=qs[_0xbb10('0x1a')](_0x2c19cb[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x5bd5c5[_0xbb10('0x18')]=qs['offset'](_0x2c19cb[_0xbb10('0x3f')]['offset']);}return _0x5116d8['getOpenchannelInteractions'](_0x5bd5c5);}})[_0xbb10('0x1e')](function(_0xf4ebf8){if(_0xf4ebf8){return _0xf4ebf8?{'count':_0x8bfc0f,'rows':_0xf4ebf8}:null;}})['then'](respondWithResult(_0x7a82c0,null))[_0xbb10('0x56')](handleError(_0x7a82c0,null));};exports[_0xbb10('0xdf')]=function(_0x201e05,_0xf5fce2){var _0x3333cb={'raw':!![],'where':{}};var _0x4d3e88={};var _0x486a2f={'count':0x0,'rows':[]};return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x201e05['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0xf5fce2,null))[_0xbb10('0x1e')](function(_0x5a83de){if(_0x5a83de){_0x4d3e88[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db[_0xbb10('0xe0')][_0xbb10('0x32')]);_0x4d3e88[_0xbb10('0x3f')]=_[_0xbb10('0xca')](_0x201e05['query']);_0x4d3e88[_0xbb10('0xd1')]=_[_0xbb10('0xcc')](_0x4d3e88[_0xbb10('0xc9')],_0x4d3e88[_0xbb10('0x3f')]);_0x3333cb['attributes']=_[_0xbb10('0xcc')](_0x4d3e88[_0xbb10('0xc9')],qs['fields'](_0x201e05['query'][_0xbb10('0xcd')]));_0x3333cb['attributes']=_0x3333cb[_0xbb10('0x43')][_0xbb10('0x47')]?_0x3333cb[_0xbb10('0x43')]:_0x4d3e88[_0xbb10('0xc9')];if(!_0x201e05['query'][_0xbb10('0xc2')]('nolimit')){_0x3333cb[_0xbb10('0x1a')]=qs[_0xbb10('0x1a')](_0x201e05[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x3333cb[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x201e05[_0xbb10('0x3f')][_0xbb10('0x18')]);}_0x3333cb[_0xbb10('0xce')]=qs['sort'](_0x201e05[_0xbb10('0x3f')][_0xbb10('0xcf')]);_0x3333cb[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_[_0xbb10('0xd2')](_0x201e05['query'],_0x4d3e88[_0xbb10('0xd1')]));_0x3333cb[_0xbb10('0xd0')][_0xbb10('0xd8')]=_0x5a83de['id'];if(_0x201e05[_0xbb10('0x3f')][_0xbb10('0x28')]){_0x3333cb['where']=_['merge'](_0x3333cb['where'],{'$or':_[_0xbb10('0x2a')](_0x3333cb['attributes'],function(_0x5dd7bb){var _0x83ee60={};_0x83ee60[_0x5dd7bb]={'$like':'%'+_0x201e05['query'][_0xbb10('0x28')]+'%'};return _0x83ee60;})});}_0x3333cb=_[_0xbb10('0x51')]({},_0x3333cb,_0x201e05['options']);return db[_0xbb10('0xe0')][_0xbb10('0x1b')]({'where':_0x3333cb[_0xbb10('0xd0')]})[_0xbb10('0x1e')](function(_0x59f392){_0x486a2f['count']=_0x59f392;if(_0x201e05['query'][_0xbb10('0x50')]){_0x3333cb[_0xbb10('0x40')]=[{'all':!![]}];}return db['MailInteraction'][_0xbb10('0x84')](_0x3333cb);})[_0xbb10('0x1e')](function(_0x3d2e5f){_0x486a2f[_0xbb10('0x45')]=_0x3d2e5f;return _0x486a2f;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0xf5fce2,_0x3333cb))['catch'](handleError(_0xf5fce2,null));};exports[_0xbb10('0xe1')]=function(_0x7e9e52,_0x1b3783){var _0x4aa311={};var _0x1523ef={};var _0x4d28d1;var _0xd7cdd6;return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x7e9e52['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x1b3783,null))[_0xbb10('0x1e')](function(_0x4ba58f){if(_0x4ba58f){_0x4d28d1=_0x4ba58f;_0x1523ef[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db[_0xbb10('0xe2')][_0xbb10('0x32')]);_0x1523ef[_0xbb10('0x3f')]=_['keys'](_0x7e9e52['query']);_0x1523ef[_0xbb10('0xd1')]=_[_0xbb10('0xcc')](_0x1523ef[_0xbb10('0xc9')],_0x1523ef[_0xbb10('0x3f')]);_0x4aa311[_0xbb10('0x43')]=_['intersection'](_0x1523ef[_0xbb10('0xc9')],qs[_0xbb10('0xcd')](_0x7e9e52[_0xbb10('0x3f')][_0xbb10('0xcd')]));_0x4aa311[_0xbb10('0x43')]=_0x4aa311['attributes']['length']?_0x4aa311[_0xbb10('0x43')]:_0x1523ef[_0xbb10('0xc9')];_0x4aa311[_0xbb10('0xce')]=qs[_0xbb10('0xcf')](_0x7e9e52['query']['sort']);_0x4aa311[_0xbb10('0xd0')]=qs['filters'](_['pick'](_0x7e9e52['query'],_0x1523ef['filters']));if(_0x7e9e52[_0xbb10('0x3f')][_0xbb10('0x28')]){_0x4aa311[_0xbb10('0xd0')]=_[_0xbb10('0x51')](_0x4aa311[_0xbb10('0xd0')],{'$or':_['map'](_0x4aa311[_0xbb10('0x43')],function(_0x10c2cb){var _0x2594d0={};_0x2594d0[_0x10c2cb]={'$like':'%'+_0x7e9e52['query'][_0xbb10('0x28')]+'%'};return _0x2594d0;})});}_0x4aa311=_[_0xbb10('0x51')]({},_0x4aa311,_0x7e9e52[_0xbb10('0x52')]);return _0x4d28d1[_0xbb10('0xe1')](_0x4aa311);}})[_0xbb10('0x1e')](function(_0xe9f36f){if(_0xe9f36f){_0xd7cdd6=_0xe9f36f[_0xbb10('0x47')];if(!_0x7e9e52[_0xbb10('0x3f')][_0xbb10('0xc2')](_0xbb10('0xd5'))){_0x4aa311[_0xbb10('0x1a')]=qs[_0xbb10('0x1a')](_0x7e9e52[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x4aa311[_0xbb10('0x18')]=qs['offset'](_0x7e9e52['query']['offset']);}return _0x4d28d1[_0xbb10('0xe1')](_0x4aa311);}})['then'](function(_0x1ae32c){if(_0x1ae32c){return _0x1ae32c?{'count':_0xd7cdd6,'rows':_0x1ae32c}:null;}})['then'](respondWithResult(_0x1b3783,null))[_0xbb10('0x56')](handleError(_0x1b3783,null));};exports['getFaxInteractions']=function(_0x492d17,_0x1c5d6a){var _0x2c81ff={};var _0x49670b={};var _0xb48ae7;var _0x131d48;return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x492d17['params']['id']}})['then'](handleEntityNotFound(_0x1c5d6a,null))[_0xbb10('0x1e')](function(_0x18c663){if(_0x18c663){_0xb48ae7=_0x18c663;_0x49670b[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db[_0xbb10('0xe3')][_0xbb10('0x32')]);_0x49670b[_0xbb10('0x3f')]=_['keys'](_0x492d17[_0xbb10('0x3f')]);_0x49670b['filters']=_['intersection'](_0x49670b[_0xbb10('0xc9')],_0x49670b['query']);_0x2c81ff[_0xbb10('0x43')]=_[_0xbb10('0xcc')](_0x49670b[_0xbb10('0xc9')],qs[_0xbb10('0xcd')](_0x492d17[_0xbb10('0x3f')]['fields']));_0x2c81ff[_0xbb10('0x43')]=_0x2c81ff[_0xbb10('0x43')][_0xbb10('0x47')]?_0x2c81ff[_0xbb10('0x43')]:_0x49670b[_0xbb10('0xc9')];_0x2c81ff[_0xbb10('0xce')]=qs['sort'](_0x492d17['query'][_0xbb10('0xcf')]);_0x2c81ff[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_[_0xbb10('0xd2')](_0x492d17[_0xbb10('0x3f')],_0x49670b['filters']));if(_0x492d17['query'][_0xbb10('0x28')]){_0x2c81ff[_0xbb10('0xd0')]=_['merge'](_0x2c81ff['where'],{'$or':_[_0xbb10('0x2a')](_0x2c81ff[_0xbb10('0x43')],function(_0x2c1112){var _0x450772={};_0x450772[_0x2c1112]={'$like':'%'+_0x492d17[_0xbb10('0x3f')][_0xbb10('0x28')]+'%'};return _0x450772;})});}_0x2c81ff=_['merge']({},_0x2c81ff,_0x492d17[_0xbb10('0x52')]);return _0xb48ae7[_0xbb10('0xe4')](_0x2c81ff);}})[_0xbb10('0x1e')](function(_0x232794){if(_0x232794){_0x131d48=_0x232794[_0xbb10('0x47')];if(!_0x492d17[_0xbb10('0x3f')][_0xbb10('0xc2')](_0xbb10('0xd5'))){_0x2c81ff[_0xbb10('0x1a')]=qs['limit'](_0x492d17['query']['limit']);_0x2c81ff[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x492d17[_0xbb10('0x3f')][_0xbb10('0x18')]);}return _0xb48ae7['getFaxInteractions'](_0x2c81ff);}})['then'](function(_0x595ac6){if(_0x595ac6){return _0x595ac6?{'count':_0x131d48,'rows':_0x595ac6}:null;}})[_0xbb10('0x1e')](respondWithResult(_0x1c5d6a,null))[_0xbb10('0x56')](handleError(_0x1c5d6a,null));};exports[_0xbb10('0xe5')]=function(_0x36e71c,_0x2d7640){var _0x4065f5={};var _0x17a49e={};var _0x466cf0;var _0x4381bc;return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x36e71c[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2d7640,null))[_0xbb10('0x1e')](function(_0x5f074d){if(_0x5f074d){_0x466cf0=_0x5f074d;_0x17a49e[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db[_0xbb10('0xe6')][_0xbb10('0x32')]);_0x17a49e[_0xbb10('0x3f')]=_[_0xbb10('0xca')](_0x36e71c['query']);_0x17a49e[_0xbb10('0xd1')]=_[_0xbb10('0xcc')](_0x17a49e[_0xbb10('0xc9')],_0x17a49e[_0xbb10('0x3f')]);_0x4065f5[_0xbb10('0x43')]=_[_0xbb10('0xcc')](_0x17a49e[_0xbb10('0xc9')],qs[_0xbb10('0xcd')](_0x36e71c[_0xbb10('0x3f')]['fields']));_0x4065f5[_0xbb10('0x43')]=_0x4065f5[_0xbb10('0x43')][_0xbb10('0x47')]?_0x4065f5[_0xbb10('0x43')]:_0x17a49e[_0xbb10('0xc9')];_0x4065f5[_0xbb10('0xce')]=qs[_0xbb10('0xcf')](_0x36e71c[_0xbb10('0x3f')][_0xbb10('0xcf')]);_0x4065f5['where']=qs[_0xbb10('0xd1')](_['pick'](_0x36e71c[_0xbb10('0x3f')],_0x17a49e[_0xbb10('0xd1')]));if(_0x36e71c['query']['filter']){_0x4065f5[_0xbb10('0xd0')]=_[_0xbb10('0x51')](_0x4065f5[_0xbb10('0xd0')],{'$or':_[_0xbb10('0x2a')](_0x4065f5[_0xbb10('0x43')],function(_0x431381){var _0x2b69f9={};_0x2b69f9[_0x431381]={'$like':'%'+_0x36e71c[_0xbb10('0x3f')][_0xbb10('0x28')]+'%'};return _0x2b69f9;})});}_0x4065f5=_[_0xbb10('0x51')]({},_0x4065f5,_0x36e71c[_0xbb10('0x52')]);return _0x466cf0[_0xbb10('0xe5')](_0x4065f5);}})[_0xbb10('0x1e')](function(_0x2f76){if(_0x2f76){_0x4381bc=_0x2f76[_0xbb10('0x47')];if(!_0x36e71c['query'][_0xbb10('0xc2')]('nolimit')){_0x4065f5[_0xbb10('0x1a')]=qs[_0xbb10('0x1a')](_0x36e71c[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x4065f5[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x36e71c[_0xbb10('0x3f')][_0xbb10('0x18')]);}return _0x466cf0[_0xbb10('0xe5')](_0x4065f5);}})['then'](function(_0x4b7bdb){if(_0x4b7bdb){return _0x4b7bdb?{'count':_0x4381bc,'rows':_0x4b7bdb}:null;}})[_0xbb10('0x1e')](respondWithResult(_0x2d7640,null))[_0xbb10('0x56')](handleError(_0x2d7640,null));};exports[_0xbb10('0xe7')]=function(_0x54c61c,_0x21b00e,_0x4e6eb8){var _0x283310;var _0x3ddf1f;var _0x4b0ab0;var _0x11154d=!_[_0xbb10('0x60')](_0x54c61c[_0xbb10('0x4f')]['id'])?_0x54c61c[_0xbb10('0x4f')]['id']:!_[_0xbb10('0x60')](_0x54c61c['user']['id'])?_0x54c61c[_0xbb10('0x26')]['id']:null;return db[_0xbb10('0x3e')]['find']({'where':{'id':_0x11154d,'role':{'$or':[_0xbb10('0x24'),_0xbb10('0x26'),'agent']}},'attributes':['id',_0xbb10('0x3c'),_0xbb10('0xe8'),_0xbb10('0xe9'),_0xbb10('0x23'),'internal',_0xbb10('0x98')]})[_0xbb10('0x1e')](function(_0x17f44f){if(_0x17f44f){if(_0x17f44f['role']==='agent'){_0x283310=_0x17f44f;if(_0x54c61c[_0xbb10('0x57')][_0xbb10('0x9a')]){_0x4b0ab0=util[_0xbb10('0xa5')](_0xbb10('0xea'),_0x283310[_0x54c61c['body'][_0xbb10('0x9a')]]);}else if(_0x54c61c[_0xbb10('0x57')][_0xbb10('0xeb')]){_0x4b0ab0=util[_0xbb10('0xa5')](_0xbb10('0xa6'),_0x54c61c['body']['intrf']);}else{_0x4b0ab0=util[_0xbb10('0xa5')](_0xbb10('0xa6'),_0x283310['name']);}socket['to'](util['format'](_0xbb10('0xec'),_0x283310[_0xbb10('0x3c')]))[_0xbb10('0x20')](_0xbb10('0xed'),{'user':{'id':_0x283310['id'],'name':_0x283310[_0xbb10('0x3c')]},'ip':_0x54c61c[_0xbb10('0xee')]['x-forwarded-for']||_0x54c61c['connection'][_0xbb10('0xef')]||_0x54c61c[_0xbb10('0xf0')][_0xbb10('0xef')]||_0x54c61c[_0xbb10('0xf1')][_0xbb10('0xf0')][_0xbb10('0xef')]});return db['UserVoiceQueueRt'][_0xbb10('0x21')]({'where':{'membername':_0x283310[_0xbb10('0x3c')]},'individualHooks':!![]});}}else{throw new db[(_0xbb10('0x8a'))][(_0xbb10('0x8b'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xbb10('0x1e')](function(){if(_0x283310){return _0x283310[_0xbb10('0xf2')]({'raw':!![]});}})[_0xbb10('0x1e')](function(_0x18c138){if(_0x283310){if(_0x18c138){_0x3ddf1f=_0x18c138;if(_0x3ddf1f[_0xbb10('0x47')]){var _0x26769b=_0x3ddf1f[_0xbb10('0x2a')](function(_0x1e107f){var _0x2b363c={'membername':_0x283310[_0xbb10('0x3c')],'UserId':_0x283310['id'],'queue_name':_0x1e107f[_0xbb10('0x3c')],'VoiceQueueId':_0x1e107f['id'],'interface':_0x4b0ab0,'paused':_0x283310[_0xbb10('0x98')]||![],'penalty':_0x1e107f['UserVoiceQueue.penalty']||0x0};return db[_0xbb10('0xa8')][_0xbb10('0xa9')](_0x2b363c);});return Promise['all'](_0x26769b);}}}})[_0xbb10('0x1e')](function(){if(_0x283310){return db[_0xbb10('0xf3')][_0xbb10('0x84')]({'where':{'membername':_0x283310['name'],'exitAt':null}});}})[_0xbb10('0x1e')](function(_0x2f397f){if(_0x283310){var _0x124fbe=[];_0x2f397f[_0xbb10('0xf4')](function(_0x23b237){_0x124fbe[_0xbb10('0x44')](_0x23b237['update']({'exitAt':moment()[_0xbb10('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xbb10('0x4d')](_0x124fbe);}})[_0xbb10('0x1e')](function(){if(_0x283310){var _0x2e453a=[];var _0x3f2843=[];var _0x55e1a6=utils[_0xbb10('0xf5')]();var _0x1a4d19={'membername':_0x283310['name'],'interface':_0x4b0ab0,'enterAt':moment()[_0xbb10('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x283310[_0xbb10('0x23')],'internal':_0x283310[_0xbb10('0x5f')]};_0x55e1a6[_0xbb10('0xf4')](function(_0x3c5149){_0x2e453a[_0xbb10('0x44')](_[_0xbb10('0x51')]({'channel':_0x3c5149,'type':_0xbb10('0xf6'),'data1':_0x54c61c[_0xbb10('0x57')]['device'],'data2':_0x4b0ab0},_0x1a4d19));if(_0x283310['loginInPause']){_0x3f2843[_0xbb10('0x44')](_[_0xbb10('0x51')]({'channel':_0x3c5149,'type':_0xbb10('0xf7'),'data1':_0xbb10('0xf8')},_0x1a4d19));}});return db[_0xbb10('0xf3')][_0xbb10('0xf9')](_0x2e453a[_0xbb10('0xbf')](_0x3f2843),{'individualHooks':!![]});}})[_0xbb10('0x1e')](function(){if(_0x283310){return _0x283310[_0xbb10('0x1d')]({'online':!![],'lastLoginAt':moment()['format'](_0xbb10('0xfa')),'voicePause':_0x283310['loginInPause']||![],'mailPause':_0x283310[_0xbb10('0x98')]||![],'chatPause':_0x283310[_0xbb10('0x98')]||![],'faxPause':_0x283310['loginInPause']||![],'smsPause':_0x283310[_0xbb10('0x98')]||![],'openchannelPause':_0x283310[_0xbb10('0x98')]||![],'whatsappPause':_0x283310[_0xbb10('0x98')]||![],'pauseType':_0x283310[_0xbb10('0x98')]?_0xbb10('0xf8'):null,'interface':_0x4b0ab0,'lastPauseAt':moment()[_0xbb10('0xa5')](_0xbb10('0xfa'))});}})[_0xbb10('0x1e')](function(_0x31875c){if(_0x54c61c[_0xbb10('0xfb')]){return _0x4e6eb8();}else{return Promise['resolve'](_0x31875c)[_0xbb10('0x1e')](respondWithResult(_0x21b00e,null));}})[_0xbb10('0x56')](handleError(_0x21b00e,null));};exports[_0xbb10('0xfc')]=function(_0x4cca3,_0x42c942){var _0x3a37d4;return db[_0xbb10('0x3e')][_0xbb10('0x2d')]({'where':{'id':_0x4cca3[_0xbb10('0x4f')]['id'],'role':_0xbb10('0x1f')},'attributes':['id',_0xbb10('0x3c'),'role']})[_0xbb10('0x1e')](handleEntityNotFound(_0x42c942,null))[_0xbb10('0x1e')](function(_0x46c448){if(_0x46c448){_0x3a37d4=_0x46c448;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x3a37d4[_0xbb10('0x3c')]},'individualHooks':!![]});}})['then'](function(){return db[_0xbb10('0xf3')][_0xbb10('0x84')]({'where':{'membername':_0x3a37d4[_0xbb10('0x3c')],'exitAt':null}});})[_0xbb10('0x1e')](function(_0x15a2f2){var _0x5d7e2e=[];_0x15a2f2[_0xbb10('0xf4')](function(_0x47c274){_0x5d7e2e[_0xbb10('0x44')](_0x47c274[_0xbb10('0x1d')]({'exitAt':moment()[_0xbb10('0xa5')](_0xbb10('0xfa'))}));});return Promise[_0xbb10('0x4d')](_0x5d7e2e);})['then'](function(){return _0x3a37d4[_0xbb10('0x1d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xbb10('0x1e')](respondWithResult(_0x42c942,null))[_0xbb10('0x56')](handleError(_0x42c942,null));};exports[_0xbb10('0xfd')]=function(_0x128ecc,_0x4ccc28){var _0x2f9277;return db[_0xbb10('0xa8')][_0xbb10('0x1d')]({'paused':0x1},{'where':{'UserId':_0x128ecc[_0xbb10('0x4f')]['id']},'individualHooks':!![]})[_0xbb10('0x1e')](function(){return db['User'][_0xbb10('0x2d')]({'where':{'id':_0x128ecc[_0xbb10('0x4f')]['id'],'role':_0xbb10('0x1f')},'attributes':['id',_0xbb10('0x3c'),_0xbb10('0x23'),_0xbb10('0x5f'),_0xbb10('0x9a'),'online']});})['then'](handleEntityNotFound(_0x4ccc28,null))[_0xbb10('0x1e')](function(_0x157ddf){if(_0x157ddf){_0x2f9277=_0x157ddf;return db['MemberReport'][_0xbb10('0x84')]({'where':{'membername':_0x2f9277[_0xbb10('0x3c')],'type':_0xbb10('0xf7'),'exitAt':null}});}})[_0xbb10('0x1e')](function(_0xfefcca){if(_0xfefcca[_0xbb10('0x47')]){var _0x49f94b=moment()[_0xbb10('0xa5')](_0xbb10('0xfa'));for(var _0x2d4461=0x0,_0x6a9308=_0xfefcca['length'];_0x2d4461<_0x6a9308;_0x2d4461++){_0xfefcca[_0x2d4461]['updateAttributes']({'exitAt':_0x49f94b});}}})[_0xbb10('0x1e')](function(){var _0x2c2b0e=[];var _0x2e4e80=utils[_0xbb10('0xf5')]();_0x2e4e80[_0xbb10('0xf4')](function(_0xc9b13a){_0x2c2b0e[_0xbb10('0x44')]({'channel':_0xc9b13a,'membername':_0x2f9277[_0xbb10('0x3c')],'interface':_[_0xbb10('0x60')](_0x2f9277[_0xbb10('0x9a')])?util[_0xbb10('0xa5')](_0xbb10('0xa6'),_0x2f9277[_0xbb10('0x3c')]):_0x2f9277[_0xbb10('0x9a')],'type':'PAUSE','enterAt':moment()[_0xbb10('0xa5')](_0xbb10('0xfa')),'data1':_0x128ecc[_0xbb10('0x57')][_0xbb10('0x34')]||_0xbb10('0xfe'),'role':_0x2f9277[_0xbb10('0x23')],'internal':_0x2f9277['internal']});});return db[_0xbb10('0xf3')][_0xbb10('0xf9')](_0x2c2b0e,{'individualHooks':!![]});})[_0xbb10('0x1e')](function(){return _0x2f9277['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x128ecc['body'][_0xbb10('0x34')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xbb10('0xa5')](_0xbb10('0xfa'))});})['then'](respondWithResult(_0x4ccc28,null))['catch'](handleError(_0x4ccc28,null));};exports[_0xbb10('0xff')]=function(_0x14daaa,_0x590ce9){if(_0x14daaa[_0xbb10('0x57')][_0xbb10('0x96')]&&!utils[_0xbb10('0x9b')](_0x14daaa['body'][_0xbb10('0x96')])){throw new APIBadRequestError(util[_0xbb10('0xa5')](_0xbb10('0x100'),_0x14daaa['body'][_0xbb10('0x96')]));}return db['User'][_0xbb10('0x2d')]({'where':{'id':_0x14daaa[_0xbb10('0x4f')]['id']},'attributes':['id','name',_0xbb10('0x23'),_0xbb10('0x5f'),_0xbb10('0x9a'),_0xbb10('0x97'),_0xbb10('0x99'),_0xbb10('0x101'),_0xbb10('0x102'),_0xbb10('0x103'),_0xbb10('0x104'),_0xbb10('0x105'),_0xbb10('0x106'),'pauseType',_0xbb10('0x107')]})[_0xbb10('0x1e')](function(_0x2ff1a2){if(!_0x2ff1a2){throw new APINotFoundError(util['format'](_0xbb10('0xc1'),_0x14daaa[_0xbb10('0x4f')]['id']));}return _0x2ff1a2[_0xbb10('0xff')](_0x14daaa[_0xbb10('0x57')]['channel']);})[_0xbb10('0x1e')](respondWithResult(_0x590ce9,null))[_0xbb10('0x56')](APIHandleError(_0x590ce9));};exports[_0xbb10('0x108')]=function(_0x10b57b,_0x2a77ab){var _0x158851={};var _0x2f1e85={};var _0x43201c;var _0x2e5f55;return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x10b57b[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2a77ab,null))[_0xbb10('0x1e')](function(_0x3c801a){if(_0x3c801a){_0x43201c=_0x3c801a;_0x2f1e85['model']=_[_0xbb10('0xca')](db['Team']['rawAttributes']);_0x2f1e85['query']=_[_0xbb10('0xca')](_0x10b57b['query']);_0x2f1e85[_0xbb10('0xd1')]=_['intersection'](_0x2f1e85['model'],_0x2f1e85[_0xbb10('0x3f')]);_0x158851['attributes']=_[_0xbb10('0xcc')](_0x2f1e85[_0xbb10('0xc9')],qs[_0xbb10('0xcd')](_0x10b57b[_0xbb10('0x3f')]['fields']));_0x158851[_0xbb10('0x43')]=_0x158851[_0xbb10('0x43')][_0xbb10('0x47')]?_0x158851[_0xbb10('0x43')]:_0x2f1e85[_0xbb10('0xc9')];_0x158851[_0xbb10('0xce')]=qs['sort'](_0x10b57b[_0xbb10('0x3f')][_0xbb10('0xcf')]);_0x158851[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_[_0xbb10('0xd2')](_0x10b57b[_0xbb10('0x3f')],_0x2f1e85[_0xbb10('0xd1')]));if(_0x10b57b[_0xbb10('0x3f')][_0xbb10('0x28')]){_0x158851[_0xbb10('0xd0')]=_['merge'](_0x158851[_0xbb10('0xd0')],{'$or':_['map'](_0x158851[_0xbb10('0x43')],function(_0x3547b6){var _0x58cdc9={};_0x58cdc9[_0x3547b6]={'$like':'%'+_0x10b57b[_0xbb10('0x3f')][_0xbb10('0x28')]+'%'};return _0x58cdc9;})});}_0x158851=_['merge']({},_0x158851,_0x10b57b[_0xbb10('0x52')]);return _0x43201c[_0xbb10('0x108')](_0x158851);}})[_0xbb10('0x1e')](function(_0x3b484e){if(_0x3b484e){_0x2e5f55=_0x3b484e[_0xbb10('0x47')];if(!_0x10b57b[_0xbb10('0x3f')][_0xbb10('0xc2')](_0xbb10('0xd5'))){_0x158851[_0xbb10('0x1a')]=qs['limit'](_0x10b57b[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x158851[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x10b57b['query'][_0xbb10('0x18')]);}return _0x43201c[_0xbb10('0x108')](_0x158851);}})[_0xbb10('0x1e')](function(_0x415e33){if(_0x415e33){return _0x415e33?{'count':_0x2e5f55,'rows':_0x415e33}:null;}})[_0xbb10('0x1e')](respondWithResult(_0x2a77ab,null))[_0xbb10('0x56')](handleError(_0x2a77ab,null));};exports[_0xbb10('0x109')]=function(_0x173949,_0x5ab96b){var _0x3c99c4=_0x173949['params']['id'];var _0x1bcee4=_0x173949[_0xbb10('0x57')]?_0x173949[_0xbb10('0x57')]['ids']:null;var _0x1f8730=[];return Promise[_0xbb10('0x10a')]()[_0xbb10('0x1e')](function(){if(!_0x1bcee4)throw new APIBadRequestError(_0xbb10('0x10b'));})[_0xbb10('0x1e')](function(){return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x3c99c4}});})[_0xbb10('0x1e')](function(_0x258add){if(!_0x258add)throw new APINotFoundError(util['format'](_0xbb10('0xc1'),_0x173949['params']['id']));return db[_0xbb10('0x62')][_0xbb10('0x10c')](function(_0x205cce){return _0x258add[_0xbb10('0x109')](_0x1bcee4,{'transaction':_0x205cce})['then'](function(){return db[_0xbb10('0x10d')][_0xbb10('0x84')]({'where':{'id':{'$in':_0x1bcee4}}});})['then'](function(_0x220d39){var _0xf8b732=_[_0xbb10('0x2a')](_0x220d39,function(_0x3ec649){return _0x3ec649['getAssociatedQueues']();});return Promise[_0xbb10('0x4d')](_0xf8b732);})['then'](function(_0x3fdfcd){_0x1f8730=_['flattenDeep'](_0x3fdfcd);var _0x14fdd8=_[_0xbb10('0x2a')](_0x1f8730,function(_0xc9f18e){return _0xc9f18e[_0xbb10('0x10e')](_0x258add['id'],{'transaction':_0x205cce});});return Promise[_0xbb10('0x4d')](_0x14fdd8);})[_0xbb10('0x1e')](function(){if(!_0x258add[_0xbb10('0x97')])return;var _0x3bd545=_[_0xbb10('0x28')](_0x1f8730,function(_0x4200e7){return _0x4200e7[_0xbb10('0x10f')](_0xbb10('0x96'))===_0xbb10('0x110');});var _0x13e36e=_['map'](_0x3bd545,function(_0x572521){return db['UserVoiceQueueRt'][_0xbb10('0xa9')]({'membername':_0x258add[_0xbb10('0x3c')],'UserId':_0x258add['id'],'queue_name':_0x572521[_0xbb10('0x3c')],'VoiceQueueId':_0x572521['id'],'interface':_['isNil'](_0x258add[_0xbb10('0x9a')])?util[_0xbb10('0xa5')](_0xbb10('0xa6'),_0x258add[_0xbb10('0x3c')]):_0x258add['interface'],'paused':_0x258add['voicePause']||![],'penalty':_0x258add[_0xbb10('0xa7')]},{'transaction':_0x205cce});});return Promise[_0xbb10('0x4d')](_0x13e36e);})[_0xbb10('0x1e')](function(){return db[_0xbb10('0x111')]['findAll']({'where':{'teamId':{'$in':_0x1bcee4}}});})[_0xbb10('0x1e')](function(_0x3f881c){var _0x477b58=_['map'](_0x3f881c,function(_0x550c90){return db['UserVoicePrefix']['create']({'UserId':_0x258add['id'],'VoicePrefixId':_0x550c90[_0xbb10('0x112')]},{'transaction':_0x205cce});});return Promise[_0xbb10('0x4d')](_0x477b58);});});})['then'](function(){for(var _0x4092d8=0x0;_0x4092d8<_0x1f8730[_0xbb10('0x47')];_0x4092d8++){var _0x3a6936=_0x1f8730[_0x4092d8]['getDataValue']('channel');var _0x51179e=_0x3a6936+_0xbb10('0xa1');socket[_0xbb10('0x20')]('user'+_0x3a6936+_0xbb10('0xa2'),{'UserId':_0x3c99c4,['queueField']:_0x1f8730[_0x4092d8]['id']});}})[_0xbb10('0x1e')](respondWithStatusCode(_0x5ab96b,null))[_0xbb10('0x56')](APIHandleError(_0x5ab96b));};exports[_0xbb10('0x113')]=function(_0x4a6c8b,_0x2969b0){var _0x45f333=_0x4a6c8b[_0xbb10('0x4f')]['id'];var _0x5f47d7=null;if(_0x4a6c8b[_0xbb10('0x3f')][_0xbb10('0x5a')]){_0x5f47d7=_[_0xbb10('0xac')](_0x4a6c8b[_0xbb10('0x3f')][_0xbb10('0x5a')])?_0x4a6c8b[_0xbb10('0x3f')]['ids']:[_0x4a6c8b['query'][_0xbb10('0x5a')]];}var _0x5bcd3f=[];return Promise['resolve']()[_0xbb10('0x1e')](function(){if(!_0x5f47d7)throw new APIBadRequestError(_0xbb10('0x114'));})[_0xbb10('0x1e')](function(){return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x45f333}});})[_0xbb10('0x1e')](function(_0x99ee46){if(!_0x99ee46)throw new APINotFoundError(util['format'](_0xbb10('0xc1'),_0x4a6c8b[_0xbb10('0x4f')]['id']));return db[_0xbb10('0x62')][_0xbb10('0x10c')](function(_0x2def3e){return _0x99ee46[_0xbb10('0x113')](_0x5f47d7,{'transaction':_0x2def3e})[_0xbb10('0x1e')](function(){return db[_0xbb10('0x10d')][_0xbb10('0x84')]({'where':{'id':{'$in':_0x5f47d7}}});})[_0xbb10('0x1e')](function(_0xd18c7b){var _0x37fb44=_['map'](_0xd18c7b,function(_0x565b97){return _0x565b97[_0xbb10('0x115')]();});return Promise['all'](_0x37fb44);})[_0xbb10('0x1e')](function(_0xa42f0a){_0x5bcd3f=_['flattenDeep'](_0xa42f0a);var _0x593acb=_[_0xbb10('0x2a')](_0x5bcd3f,function(_0x3a69b3){return _0x3a69b3[_0xbb10('0x116')](_0x99ee46['id'],{'transaction':_0x2def3e});});return Promise[_0xbb10('0x4d')](_0x593acb);})[_0xbb10('0x1e')](function(){if(!_0x99ee46[_0xbb10('0x97')])return;var _0x59a25e=_[_0xbb10('0x28')](_0x5bcd3f,function(_0xb9d795){return _0xb9d795[_0xbb10('0x10f')](_0xbb10('0x96'))==='Voice';});var _0x5bc002=_[_0xbb10('0x2a')](_0x59a25e,function(_0x2833f3){return db[_0xbb10('0xa8')][_0xbb10('0x21')]({'where':{'VoiceQueueId':_0x2833f3['id'],'UserId':_0x99ee46['id']},'transaction':_0x2def3e});});return Promise[_0xbb10('0x4d')](_0x5bc002);})[_0xbb10('0x1e')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x5f47d7}}});})[_0xbb10('0x1e')](function(_0x3af4a9){var _0xba99b6=_[_0xbb10('0x2a')](_0x3af4a9,function(_0x58e537){return db[_0xbb10('0x117')][_0xbb10('0x21')]({'where':{'UserId':_0x99ee46['id'],'VoicePrefixId':_0x58e537[_0xbb10('0x112')]}},{'transaction':_0x2def3e});});return Promise[_0xbb10('0x4d')](_0xba99b6);});});})[_0xbb10('0x1e')](function(){for(var _0x3f2f0a=0x0;_0x3f2f0a<_0x5bcd3f[_0xbb10('0x47')];_0x3f2f0a++){var _0x55f9af=_0x5bcd3f[_0x3f2f0a][_0xbb10('0x10f')](_0xbb10('0x96'));var _0x26f413=_0x55f9af+_0xbb10('0xa1');socket[_0xbb10('0x20')](_0xbb10('0x26')+_0x55f9af+_0xbb10('0xad'),{'UserId':_0x45f333,['queueField']:_0x5bcd3f[_0x3f2f0a]['id']});}})[_0xbb10('0x1e')](respondWithStatusCode(_0x2969b0,null))['catch'](APIHandleError(_0x2969b0));};exports[_0xbb10('0x118')]=function(_0x3a96ca,_0x299cae){var _0x4adacc={};var _0x5457ed={};var _0x152c97;var _0x2d81db;return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x3a96ca['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x299cae,null))[_0xbb10('0x1e')](function(_0x991554){if(_0x991554){_0x152c97=_0x991554;_0x5457ed[_0xbb10('0xc9')]=_['keys'](db[_0xbb10('0x119')][_0xbb10('0x32')]);_0x5457ed[_0xbb10('0x3f')]=_[_0xbb10('0xca')](_0x3a96ca[_0xbb10('0x3f')]);_0x5457ed['filters']=_[_0xbb10('0xcc')](_0x5457ed[_0xbb10('0xc9')],_0x5457ed[_0xbb10('0x3f')]);_0x4adacc['attributes']=_['intersection'](_0x5457ed[_0xbb10('0xc9')],qs['fields'](_0x3a96ca[_0xbb10('0x3f')]['fields']));_0x4adacc[_0xbb10('0x43')]=_0x4adacc[_0xbb10('0x43')][_0xbb10('0x47')]?_0x4adacc['attributes']:_0x5457ed[_0xbb10('0xc9')];_0x4adacc[_0xbb10('0xce')]=qs['sort'](_0x3a96ca[_0xbb10('0x3f')][_0xbb10('0xcf')]);_0x4adacc[_0xbb10('0xd0')]=qs['filters'](_[_0xbb10('0xd2')](_0x3a96ca['query'],_0x5457ed[_0xbb10('0xd1')]));if(_0x3a96ca[_0xbb10('0x3f')][_0xbb10('0x28')]){_0x4adacc['where']=_['merge'](_0x4adacc['where'],{'$or':_[_0xbb10('0x2a')](_0x4adacc['attributes'],function(_0x3f4a4f){var _0x4fbd6c={};_0x4fbd6c[_0x3f4a4f]={'$like':'%'+_0x3a96ca[_0xbb10('0x3f')][_0xbb10('0x28')]+'%'};return _0x4fbd6c;})});}_0x4adacc=_['merge']({},_0x4adacc,_0x3a96ca['options']);return _0x152c97[_0xbb10('0x118')](_0x4adacc);}})[_0xbb10('0x1e')](function(_0x53bc2a){if(_0x53bc2a){_0x2d81db=_0x53bc2a[_0xbb10('0x47')];if(!_0x3a96ca[_0xbb10('0x3f')][_0xbb10('0xc2')]('nolimit')){_0x4adacc[_0xbb10('0x1a')]=qs[_0xbb10('0x1a')](_0x3a96ca[_0xbb10('0x3f')][_0xbb10('0x1a')]);_0x4adacc[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x3a96ca[_0xbb10('0x3f')]['offset']);}return _0x152c97[_0xbb10('0x118')](_0x4adacc);}})[_0xbb10('0x1e')](function(_0x25ee83){if(_0x25ee83){return _0x25ee83?{'count':_0x2d81db,'rows':_0x25ee83}:null;}})['then'](respondWithResult(_0x299cae,null))[_0xbb10('0x56')](handleError(_0x299cae,null));};exports[_0xbb10('0x11a')]=function(_0x521aa3,_0x41b6b2){var _0x233b58={};var _0x2637c8={};var _0x347821;return db[_0xbb10('0x3e')][_0xbb10('0x8f')]({'where':{'id':_0x521aa3[_0xbb10('0x4f')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x41b6b2,null))[_0xbb10('0x1e')](function(_0xf47d92){if(_0xf47d92){_0x347821=_0xf47d92;_0x2637c8[_0xbb10('0xc9')]=_[_0xbb10('0xca')](db[_0xbb10('0x3e')]['rawAttributes']);_0x2637c8[_0xbb10('0x3f')]=_[_0xbb10('0xca')](_0x521aa3['query']);_0x2637c8['filters']=_[_0xbb10('0xcc')](_0x2637c8[_0xbb10('0xc9')],_0x2637c8[_0xbb10('0x3f')]);_0x233b58[_0xbb10('0x43')]=_['intersection'](_0x2637c8[_0xbb10('0xc9')],qs['fields'](_0x521aa3['query']['fields']));_0x233b58[_0xbb10('0x43')]=_0x233b58[_0xbb10('0x43')][_0xbb10('0x47')]?_0x233b58[_0xbb10('0x43')]:_0x2637c8['model'];_0x233b58[_0xbb10('0xce')]=qs['sort'](_0x521aa3[_0xbb10('0x3f')][_0xbb10('0xcf')]);_0x233b58[_0xbb10('0xd0')]=qs[_0xbb10('0xd1')](_[_0xbb10('0xd2')](_0x521aa3[_0xbb10('0x3f')],_0x2637c8['filters']));if(_0x521aa3['query'][_0xbb10('0x28')]){_0x233b58['where']=_[_0xbb10('0x51')](_0x233b58[_0xbb10('0xd0')],{'$or':_[_0xbb10('0x2a')](_0x233b58['attributes'],function(_0x177f7b){var _0x12b0cb={};_0x12b0cb[_0x177f7b]={'$like':'%'+_0x521aa3[_0xbb10('0x3f')][_0xbb10('0x28')]+'%'};return _0x12b0cb;})});}_0x233b58[_0xbb10('0xc9')]=db[_0xbb10('0x3e')];_0x233b58['as']=_0xbb10('0x27');_0x233b58=_['merge']({},_0x233b58,_0x521aa3[_0xbb10('0x52')]);return _0x347821['getVoiceQueues']({'include':[_0x233b58]});}})[_0xbb10('0x1e')](function(_0x15371f){if(_0x15371f){var _0x2ad54a={},_0x21139c=[];for(var _0x4276d6=0x0;_0x4276d6<_0x15371f[_0xbb10('0x47')];_0x4276d6+=0x1){for(var _0x550911=0x0,_0x2ddf65;_0x550911<_0x15371f[_0x4276d6][_0xbb10('0x27')][_0xbb10('0x47')];_0x550911+=0x1){_0x2ddf65=_0x15371f[_0x4276d6]['Agents'][_0x550911]['get']({'plain':!![]});_0x2ad54a[_0x2ddf65['id']]=_0x2ddf65;}}_0x2ad54a=_[_0xbb10('0x11b')](_0x2ad54a);for(var _0x3134a6=qs['offset'](_0x521aa3['query'][_0xbb10('0x18')]);_0x3134a6<_0x2ad54a[_0xbb10('0x47')]&&_0x21139c[_0xbb10('0x47')]=_0x1c0f97){_0xb953a6=_0x1c0f97;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xf82f72['status'](_0x1d9e86);return _0xf82f72[_0x5adb('0x1d')]('Content-Range',_0xa29dc+'-'+_0xb953a6+'/'+_0x1c0f97)['json'](_0x2312de);}return null;};}function saveUpdates(_0x1fbaa5){return function(_0x1bed20){if(_0x1bed20){return _0x1bed20[_0x5adb('0x1e')](_0x1fbaa5)[_0x5adb('0x1f')](function(_0x99bc6c){if(_0x99bc6c['role']===_0x5adb('0x20')){socket['emit']('userNotification:recalc:'+_0x99bc6c['id'],_0x99bc6c);}return _0x99bc6c;});}return null;};}function removeEntity(_0x3754cc){return function(_0x379b33){if(_0x379b33){return _0x379b33[_0x5adb('0x21')]()[_0x5adb('0x1f')](function(){var _0x1e9ccf=_0x379b33[_0x5adb('0x22')]({'plain':!![]});if(_0x1e9ccf[_0x5adb('0x23')]==='admin')return;var _0x4b1957=[{'name':_0x5adb('0x24'),'value':_0x5adb('0x25'),'ignore':!![]},{'name':_0x5adb('0x26'),'value':_0x5adb('0x20'),'ignore':![]},{'name':'Telephones','value':_0x5adb('0x27'),'ignore':![]}];var _0x2e1e63=_(_0x4b1957)['filter'](_0x5adb('0x28'))[_0x5adb('0x29')](_0x5adb('0x2a'))['value']();if(_[_0x5adb('0x2b')](_0x2e1e63,_0x1e9ccf[_0x5adb('0x23')])){return;}var _0x3a4fca=_[_0x5adb('0x2c')](_0x4b1957,[_0x5adb('0x2a'),_0x1e9ccf[_0x5adb('0x23')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x3a4fca,'resourceId':_0x1e9ccf['id']}})[_0x5adb('0x1f')](function(){return _0x379b33;});})[_0x5adb('0x1f')](function(){_0x3754cc[_0x5adb('0x17')](0xcc)[_0x5adb('0x16')]();});}};}function handleEntityNotFound(_0x137a5c){return function(_0x4de310){if(!_0x4de310){_0x137a5c[_0x5adb('0x15')](0x194);}return _0x4de310;};}function handleError(_0x34b793,_0x372da1){_0x372da1=_0x372da1||0x1f4;return function(_0x3b1fed){logger[_0x5adb('0x2d')](_0x3b1fed[_0x5adb('0x2e')]);if(_0x3b1fed[_0x5adb('0x2f')]){delete _0x3b1fed[_0x5adb('0x2f')];}_0x34b793[_0x5adb('0x17')](_0x372da1)[_0x5adb('0x30')](_0x3b1fed);};}function getUserAttributes(){return _(db['User'][_0x5adb('0x31')])['map'](function(_0x12424d){return{'name':_0x12424d[_0x5adb('0x32')],'type':_0x12424d['type'][_0x5adb('0x33')]};})[_0x5adb('0x34')](function(_0x461a39){return!['password',_0x5adb('0x35'),_0x5adb('0x36'),'resetPasswordToken','resetPasswordExpires',_0x5adb('0x37')]['includes'](_0x461a39[_0x5adb('0x2f')]);})[_0x5adb('0x2a')]();}exports[_0x5adb('0x38')]=function(_0x2da912,_0x9bdece){var _0x5ece39={},_0x2f7abe={'count':0x0,'rows':[]};var _0x215b88=getUserAttributes();_0x5ece39=qs[_0x5adb('0x39')](_0x215b88,_0x2da912);var _0x54851b={'where':_0x5ece39['where']};return db[_0x5adb('0x3a')][_0x5adb('0x1c')](_0x54851b)['then'](function(_0x2355bc){_0x2f7abe['count']=_0x2355bc;if(_0x2da912[_0x5adb('0x3b')]['includeAll']){_0x5ece39[_0x5adb('0x3c')]=[{'all':!![]}];}if(_0x2da912['query'][_0x5adb('0x3d')]===_0x5adb('0x3e')){_0x5ece39['include']=[{'model':db[_0x5adb('0x3f')],'as':'userSetting'}];}if(!_[_0x5adb('0x2b')](_0x5ece39[_0x5adb('0x40')],'id')){_0x5ece39[_0x5adb('0x40')]['push']('id');}return db[_0x5adb('0x3a')][_0x5adb('0x41')](_0x5ece39);})[_0x5adb('0x1f')](function(_0x132803){_0x2f7abe[_0x5adb('0x42')]=_0x132803;if(_0x2da912['query']['openTabs']==='true'){var _0x599999=[];for(var _0x427c71=0x0;_0x427c71<_0x2f7abe[_0x5adb('0x42')][_0x5adb('0x43')];_0x427c71++){_0x599999[_0x5adb('0x44')](get_open_tabs(_0x5adb('0x45'),_0x2f7abe[_0x5adb('0x42')][_0x427c71][_0x5adb('0x46')]));_0x599999[_0x5adb('0x44')](get_open_tabs('sms',_0x2f7abe['rows'][_0x427c71][_0x5adb('0x46')]));_0x599999['push'](get_open_tabs(_0x5adb('0x47'),_0x2f7abe[_0x5adb('0x42')][_0x427c71][_0x5adb('0x46')]));_0x599999[_0x5adb('0x44')](get_open_tabs(_0x5adb('0x48'),_0x2f7abe['rows'][_0x427c71][_0x5adb('0x46')]));_0x599999[_0x5adb('0x44')](get_open_tabs('openchannel',_0x2f7abe[_0x5adb('0x42')][_0x427c71][_0x5adb('0x46')]));_0x599999['push'](get_open_tabs(_0x5adb('0x49'),_0x2f7abe[_0x5adb('0x42')][_0x427c71][_0x5adb('0x46')]));}return Promise[_0x5adb('0x4a')](_0x599999)[_0x5adb('0x1f')](function(){return _0x2f7abe;});}else{return _0x2f7abe;}})[_0x5adb('0x1f')](respondWithFilteredResult(_0x9bdece,_0x5ece39))[_0x5adb('0x4b')](handleError(_0x9bdece,null));};exports['show']=function(_0x5bfd74,_0x26a656){var _0x37f230=getUserAttributes();_0x5bfd74[_0x5adb('0x3b')]['id']=_0x5bfd74[_0x5adb('0x4c')]['id'];var _0x57b8af=qs['getOptions'](_0x37f230,_0x5bfd74);if(_0x5bfd74[_0x5adb('0x3b')][_0x5adb('0x4d')]){_0x57b8af[_0x5adb('0x3c')]=[{'all':!![]}];}if(_0x5bfd74[_0x5adb('0x3b')][_0x5adb('0x3d')]==='true'){_0x57b8af[_0x5adb('0x3c')]=[{'model':db[_0x5adb('0x3f')],'as':'userSetting'}];}_0x57b8af=_[_0x5adb('0x4e')]({},_0x57b8af,_0x5bfd74[_0x5adb('0x4f')]);if(!_[_0x5adb('0x2b')](_0x57b8af[_0x5adb('0x40')],'id')){_0x57b8af[_0x5adb('0x40')][_0x5adb('0x44')]('id');}return db[_0x5adb('0x3a')][_0x5adb('0x2c')](_0x57b8af)['then'](handleEntityNotFound(_0x26a656,null))[_0x5adb('0x1f')](function(_0x57dc8b){var _0x51bc49=[];values=_0x57dc8b;if(_0x5bfd74['query'][_0x5adb('0x50')]===_0x5adb('0x3e')){_0x51bc49[_0x5adb('0x44')](get_open_tabs('chat',_0x57dc8b[_0x5adb('0x46')]));_0x51bc49['push'](get_open_tabs(_0x5adb('0x51'),_0x57dc8b[_0x5adb('0x46')]));_0x51bc49[_0x5adb('0x44')](get_open_tabs('openchannel',_0x57dc8b[_0x5adb('0x46')]));_0x51bc49['push'](get_open_tabs(_0x5adb('0x49'),_0x57dc8b[_0x5adb('0x46')]));_0x51bc49['push'](get_open_tabs(_0x5adb('0x47'),_0x57dc8b[_0x5adb('0x46')]));_0x51bc49[_0x5adb('0x44')](get_open_tabs(_0x5adb('0x48'),_0x57dc8b[_0x5adb('0x46')]));return Promise['all'](_0x51bc49);}else{return values;}})[_0x5adb('0x1f')](function(){return values;})[_0x5adb('0x1f')](respondWithResult(_0x26a656,null))[_0x5adb('0x4b')](handleError(_0x26a656,null));};exports[_0x5adb('0x1e')]=function(_0x5bb91f,_0x2dfb5e){if(_0x5bb91f[_0x5adb('0x52')]['id']){delete _0x5bb91f[_0x5adb('0x52')]['id'];}delete _0x5bb91f['body'][_0x5adb('0x23')];return db[_0x5adb('0x3a')][_0x5adb('0x2c')]({'where':{'id':_0x5bb91f[_0x5adb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2dfb5e,null))[_0x5adb('0x1f')](saveUpdates(_0x5bb91f[_0x5adb('0x52')],null))[_0x5adb('0x1f')](respondWithResult(_0x2dfb5e,null))[_0x5adb('0x4b')](handleError(_0x2dfb5e,null));};exports[_0x5adb('0x53')]=function(_0x5c570b,_0x378938){return db['User'][_0x5adb('0x53')]()['then'](respondWithResult(_0x378938,null))[_0x5adb('0x4b')](handleError(_0x378938,null));};exports[_0x5adb('0x54')]=function(_0x1a9358,_0x42f6d9){return db['User'][_0x5adb('0x2c')]({'where':{'id':_0x1a9358[_0x5adb('0x4c')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x42f6d9,null))['then'](function(_0x5b005d){if(_0x5b005d){return _0x5b005d['addContacts'](_0x1a9358[_0x5adb('0x52')][_0x5adb('0x55')],_[_0x5adb('0x56')](_0x1a9358[_0x5adb('0x52')],[_0x5adb('0x55'),'id'])||{});}})[_0x5adb('0x1f')](respondWithResult(_0x42f6d9,null))[_0x5adb('0x4b')](handleError(_0x42f6d9,null));};function validateUser(_0x8d7810){return new Promise(function(_0xc880af,_0x380d76){if(_0x8d7810[_0x5adb('0x57')])return _0xc880af(_0x8d7810);return db[_0x5adb('0x58')][_0x5adb('0x59')](0x1)['then'](function(_0x49f4c8){if(_0x49f4c8[_0x5adb('0x5a')])authService[_0x5adb('0x5b')](_0x8d7810[_0x5adb('0x5c')]);db[_0x5adb('0x3a')]['max'](_0x5adb('0x57'))[_0x5adb('0x1f')](function(_0x5d2d2f){if(_[_0x5adb('0x5d')](_0x5d2d2f)){_0x8d7810[_0x5adb('0x57')]=_0x49f4c8[_0x5adb('0x5e')]||0x1;return;}if(_['isNil'](_0x49f4c8[_0x5adb('0x5e')])||_0x49f4c8[_0x5adb('0x5e')]===_0x5d2d2f){_0x8d7810[_0x5adb('0x57')]=_0x5d2d2f+0x1;return;}if(_0x49f4c8[_0x5adb('0x5e')]>_0x5d2d2f){_0x8d7810[_0x5adb('0x57')]=_0x49f4c8[_0x5adb('0x5e')];return;}return db['sequelize'][_0x5adb('0x3b')](_0x5adb('0x5f'),{'type':db[_0x5adb('0x60')]['QueryTypes'][_0x5adb('0x61')]})[_0x5adb('0x1f')](function(_0x343aa4){if(_0x343aa4&&_0x343aa4['length']){for(var _0x7287ac=0x0,_0x4d8cfa=_0x343aa4[_0x5adb('0x43')];_0x7287ac<_0x4d8cfa&&_[_0x5adb('0x5d')](_0x8d7810[_0x5adb('0x57')]);_0x7287ac++){if(_0x49f4c8['min_internal']<=_0x343aa4[_0x7287ac][_0x5adb('0x62')]){_0x8d7810[_0x5adb('0x57')]=_0x343aa4[_0x7287ac]['from'];}else if(_0x49f4c8[_0x5adb('0x5e')]>_0x343aa4[_0x7287ac][_0x5adb('0x62')]&&_0x49f4c8[_0x5adb('0x5e')]<=_0x343aa4[_0x7287ac]['to']){_0x8d7810[_0x5adb('0x57')]=_0x49f4c8['min_internal'];}}}if(_[_0x5adb('0x5d')](_0x8d7810[_0x5adb('0x57')])){_0x8d7810[_0x5adb('0x57')]=_0x5d2d2f+0x1;}return _0xc880af(_0x8d7810);});});})[_0x5adb('0x4b')](function(_0x5b7556){_0x380d76(_0x5b7556);});});}function updateUser(_0x53a4bc){return new Promise(function(_0x304512,_0x531e20){try{if(_0x53a4bc['voicemail']){_0x53a4bc['mailbox']=_0x53a4bc[_0x5adb('0x57')];_0x53a4bc[_0x5adb('0x63')]={'mailbox':_0x53a4bc['internal'],'password':_0x53a4bc[_0x5adb('0x5c')],'fullname':_0x53a4bc[_0x5adb('0x64')],'email':_0x53a4bc[_0x5adb('0x65')]};}if(_0x53a4bc[_0x5adb('0x23')]===_0x5adb('0x20')){if(!_0x53a4bc[_0x5adb('0x66')])_0x53a4bc[_0x5adb('0x66')]=[_0x5adb('0x67'),'102','103','113',_0x5adb('0x68'),_0x5adb('0x69'),_0x5adb('0x6a'),_0x5adb('0x6b'),_0x5adb('0x6c'),_0x5adb('0x6d'),_0x5adb('0x6e'),_0x5adb('0x6f'),'111','114',_0x5adb('0x70')];}_0x304512(_0x53a4bc);}catch(_0x56df90){_0x531e20(_0x56df90);}});}exports[_0x5adb('0x71')]=function(_0x3d78e3,_0x2146f0){if(_0x3d78e3[_0x5adb('0x25')][_0x5adb('0x23')]===_0x5adb('0x20'))throw new Error(_0x5adb('0x72'));if(_0x3d78e3[_0x5adb('0x52')]['role']===_0x5adb('0x25')&&_0x3d78e3[_0x5adb('0x25')][_0x5adb('0x23')]!=='admin'){throw new Error(_0x5adb('0x73'));}if(_0x3d78e3[_0x5adb('0x52')]['role']===_0x5adb('0x74')&&_0x3d78e3['user'][_0x5adb('0x23')]!==_0x5adb('0x74')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x5adb('0x75')]([_0x3d78e3[_0x5adb('0x52')]])[_0x5adb('0x1f')](function(){return validateUser(_0x3d78e3[_0x5adb('0x52')]);})[_0x5adb('0x1f')](function(_0x10f54a){return updateUser(_0x10f54a)[_0x5adb('0x1f')](function(_0xad8e0c){if(_0xad8e0c['role']===_0x5adb('0x74')){_0xad8e0c[_0x5adb('0x76')]=_0x3d78e3[_0x5adb('0x25')]['settingsEnabled'];delete _0xad8e0c['userProfileId'];}return _0xad8e0c;});})[_0x5adb('0x1f')](function(_0x4fd8f7){return db[_0x5adb('0x3a')][_0x5adb('0x71')](_0x4fd8f7,{'include':[{'model':db[_0x5adb('0x63')],'as':'VoiceMail'}]});})[_0x5adb('0x1f')](function(_0x288e4f){if(_0x3d78e3[_0x5adb('0x52')][_0x5adb('0x23')]===_0x5adb('0x25'))return _0x288e4f;if(_0x3d78e3['user'][_0x5adb('0x23')]!==_0x5adb('0x25'))return _0x288e4f;return db[_0x5adb('0x77')][_0x5adb('0x2c')]({'where':{'name':_0x288e4f['role']===_0x5adb('0x20')?_0x5adb('0x26'):_0x5adb('0x78'),'userProfileId':_0x3d78e3[_0x5adb('0x25')][_0x5adb('0x79')]},'raw':!![]})[_0x5adb('0x1f')](function(_0x1aae66){if(!_0x1aae66||_0x1aae66['autoAssociation']!=0x0)return _0x288e4f;return db[_0x5adb('0x7a')][_0x5adb('0x71')]({'name':_0x288e4f['name'],'resourceId':_0x288e4f['id'],'type':_0x1aae66[_0x5adb('0x2f')],'sectionId':_0x1aae66['id']},{})[_0x5adb('0x1f')](function(){return _0x288e4f;});})['catch'](function(_0x462fa0){logger['error'](_0x5adb('0x7b'),_0x462fa0);throw _0x462fa0;});})[_0x5adb('0x1f')](respondWithResult(_0x2146f0,0xc9))['catch'](handleError(_0x2146f0,null));};exports[_0x5adb('0x7c')]=function(_0x54c2c8,_0x2f6415){var _0x118968=_0x54c2c8[_0x5adb('0x52')];var _0x3a4a28=[];if(_0x54c2c8[_0x5adb('0x25')]['role']===_0x5adb('0x20'))throw new Error(_0x5adb('0x72'));if(_[_0x5adb('0x7d')](_0x118968,[_0x5adb('0x23'),'user'])&&_0x54c2c8['user'][_0x5adb('0x23')]!==_0x5adb('0x74')){throw new Error(_0x5adb('0x73'));}if(_[_0x5adb('0x7d')](_0x118968,[_0x5adb('0x23'),_0x5adb('0x74')])&&_0x54c2c8[_0x5adb('0x25')]['role']!==_0x5adb('0x74')){throw new Error(_0x5adb('0x7e'));}return licenseUtil[_0x5adb('0x75')](_0x118968)[_0x5adb('0x1f')](function(){return validateUser(_0x118968[0x0]);})['then'](function(){for(var _0x450f90=0x1;_0x450f90<_0x118968[_0x5adb('0x43')];_0x450f90++){var _0x243016=_0x118968[_0x450f90-0x1][_0x5adb('0x57')];if(!_0x118968[_0x450f90][_0x5adb('0x57')])_0x118968[_0x450f90][_0x5adb('0x57')]=_0x243016+0x1;_0x3a4a28[_0x5adb('0x44')](validateUser(_0x118968[_0x450f90]));}return Promise[_0x5adb('0x4a')](_0x3a4a28);})[_0x5adb('0x1f')](function(){_0x3a4a28=[];for(var _0x51ea1e=0x0;_0x51ea1e<_0x118968[_0x5adb('0x43')];_0x51ea1e++){_0x3a4a28[_0x5adb('0x44')](updateUser(_0x118968[_0x51ea1e]));}return Promise['all'](_0x3a4a28);})[_0x5adb('0x1f')](function(){_0x3a4a28=_0x118968[_0x5adb('0x29')](function(_0x2b8915){return db[_0x5adb('0x3a')][_0x5adb('0x71')](_0x2b8915,{'include':[{'model':db[_0x5adb('0x63')],'as':_0x5adb('0x63')}]})[_0x5adb('0x1f')](function(_0x57f557){_0x2b8915['id']=_0x57f557['id'];return _0x2b8915;});});return Promise[_0x5adb('0x4a')](_0x3a4a28);})[_0x5adb('0x1f')](function(_0x4ed4b1){if(_0x54c2c8[_0x5adb('0x52')][_0x5adb('0x23')]===_0x5adb('0x25'))return _0x4ed4b1;if(_0x54c2c8['user']['role']!==_0x5adb('0x25'))return _0x4ed4b1;var _0x328851=_[_0x5adb('0x7d')](_0x4ed4b1,function(_0x5af801){return _0x5af801[_0x5adb('0x23')]===_0x5adb('0x20')||_0x5af801[_0x5adb('0x23')]===_0x5adb('0x27');});if(!_0x328851)return _0x4ed4b1;return db[_0x5adb('0x77')][_0x5adb('0x41')]({'where':{'name':{'$or':[_0x5adb('0x26'),_0x5adb('0x78')]},'userProfileId':_0x54c2c8[_0x5adb('0x25')][_0x5adb('0x79')]},'raw':!![]})[_0x5adb('0x1f')](function(_0x1509e0){if(_['isEmpty'](_0x1509e0)||!_['some'](_0x1509e0,[_0x5adb('0x7f'),0x0]))return _0x4ed4b1;_0x3a4a28=[];var _0x44756a=_(_0x1509e0)['map'](function(_0x3f6975){if(_0x3f6975[_0x5adb('0x7f')]===0x1)return;return _0x3f6975[_0x5adb('0x2f')]===_0x5adb('0x26')?_0x5adb('0x20'):_0x5adb('0x27');})[_0x5adb('0x80')]()[_0x5adb('0x2a')]();for(var _0x42dddf=0x0;_0x42dddf<_0x4ed4b1['length'];_0x42dddf++){if(!_[_0x5adb('0x2b')](_0x44756a,_0x4ed4b1[_0x42dddf][_0x5adb('0x23')]))return;var _0x273785=_0x4ed4b1[_0x42dddf]['role']===_0x5adb('0x20')?_0x5adb('0x26'):_0x5adb('0x78');_0x3a4a28[_0x5adb('0x44')](db[_0x5adb('0x7a')][_0x5adb('0x71')]({'name':_0x4ed4b1[_0x42dddf]['name'],'resourceId':_0x4ed4b1[_0x42dddf]['id'],'type':_0x273785,'sectionId':_[_0x5adb('0x2c')](_0x1509e0,[_0x5adb('0x2f'),_0x273785])['id']},{}));}return Promise[_0x5adb('0x4a')](_0x3a4a28);});})[_0x5adb('0x1f')](respondWithResult(_0x2f6415,0xc9))[_0x5adb('0x4b')](handleError(_0x2f6415,null));};exports[_0x5adb('0x81')]=function(_0x95fb11,_0x30ff55){if(_0x95fb11[_0x5adb('0x52')]['id']){delete _0x95fb11[_0x5adb('0x52')]['id'];}return db['User'][_0x5adb('0x2c')]({'where':{'id':_0x95fb11['params']['id']}})[_0x5adb('0x1f')](function(_0x2e0a49){if(!_0x2e0a49)return null;if(_0x2e0a49['id']===_0x95fb11[_0x5adb('0x25')]['id']){if(!_0x95fb11[_0x5adb('0x52')][_0x5adb('0x82')]||!_0x95fb11['body']['newPassword']){throw new db[(_0x5adb('0x83'))][(_0x5adb('0x84'))](_0x5adb('0x85'));}if(!_0x2e0a49[_0x5adb('0x86')](_0x95fb11[_0x5adb('0x52')][_0x5adb('0x82')])){throw new db['Sequelize']['ValidationError'](_0x5adb('0x87'));}if(_0x95fb11[_0x5adb('0x52')][_0x5adb('0x82')]===_0x95fb11['body']['newPassword']){throw new db[(_0x5adb('0x83'))]['ValidationError'](_0x5adb('0x88'));}}else if(_0x95fb11[_0x5adb('0x25')]['role']==='admin'){if(!_0x95fb11[_0x5adb('0x52')]['newPassword']){throw new db['Sequelize'][(_0x5adb('0x84'))](_0x5adb('0x89'));}}else if(_0x95fb11[_0x5adb('0x25')][_0x5adb('0x23')]===_0x5adb('0x25')){if(!_0x95fb11[_0x5adb('0x52')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x83'))][(_0x5adb('0x84'))](_0x5adb('0x89'));}if(_0x2e0a49[_0x5adb('0x23')]!==_0x5adb('0x20')){throw new db[(_0x5adb('0x83'))]['ValidationError'](_0x5adb('0x72'));}}else{throw new db['Sequelize'][(_0x5adb('0x84'))](_0x5adb('0x72'));}return _0x2e0a49;})[_0x5adb('0x1f')](handleEntityNotFound(_0x30ff55,null))[_0x5adb('0x1f')](function(_0x460a76){return db[_0x5adb('0x58')][_0x5adb('0x8b')]({'attributes':['id',_0x5adb('0x5a'),_0x5adb('0x8c'),_0x5adb('0x8d')]})[_0x5adb('0x1f')](function(_0x18fc00){if(_0x18fc00['securePassword'])authService[_0x5adb('0x5b')](_0x95fb11[_0x5adb('0x52')][_0x5adb('0x8a')]);if(!_0x18fc00[_0x5adb('0x8c')]||!_0x460a76[_0x5adb('0x36')])return _0x460a76;authService[_0x5adb('0x8e')](_0x95fb11[_0x5adb('0x52')][_0x5adb('0x8a')],_0x460a76['previousPasswords'],_0x18fc00[_0x5adb('0x8d')]);return _0x460a76;})[_0x5adb('0x1f')](saveUpdates({'password':_0x95fb11[_0x5adb('0x52')]['newPassword'],'passwordResetAt':_0x95fb11[_0x5adb('0x25')]['id']==_0x95fb11['params']['id']?moment():null,'previousPasswords':authService[_0x5adb('0x8f')](_0x95fb11['body']['newPassword'],_0x460a76[_0x5adb('0x36')])},null));})[_0x5adb('0x1f')](respondWithResult(_0x30ff55,null))[_0x5adb('0x4b')](handleError(_0x30ff55,null));};exports[_0x5adb('0x90')]=function(_0x21c46a,_0xcd014e){var _0xcd9c97=_0x21c46a[_0x5adb('0x52')][_0x5adb('0x91')];return db[_0x5adb('0x3a')][_0x5adb('0x2c')]({'where':{'id':_0x21c46a[_0x5adb('0x4c')]['id']},'attributes':['id','name',_0x5adb('0x23'),'online',_0x5adb('0x92'),_0x5adb('0x93'),'interface']})[_0x5adb('0x1f')](handleEntityNotFound(_0xcd014e,null))[_0x5adb('0x1f')](function(_0x55dd31){if(_0x55dd31){if(!utils['isValidChannel'](_0xcd9c97)){throw new db[(_0x5adb('0x83'))][(_0x5adb('0x84'))](_0x5adb('0x94'));}return _0x55dd31[_0x5adb('0x95')+_[_0x5adb('0x96')](_0xcd9c97[_0x5adb('0x97')]())+'Queues'](_0x21c46a[_0x5adb('0x52')][_0x5adb('0x55')],{'penalty':_0x21c46a[_0x5adb('0x52')][_0x5adb('0x98')]||0x0})[_0x5adb('0x99')](function(_0x4c3448){for(var _0x51f9ef=0x0;_0x51f9ef<_0x21c46a[_0x5adb('0x52')][_0x5adb('0x55')][_0x5adb('0x43')];_0x51f9ef+=0x1){var _0xaf0b4={'UserId':Number(_0x21c46a[_0x5adb('0x4c')]['id'])};_0xaf0b4[_[_0x5adb('0x96')](_0xcd9c97[_0x5adb('0x97')]())+_0x5adb('0x9a')]=Number(_0x21c46a[_0x5adb('0x52')]['ids'][_0x51f9ef]);socket[_0x5adb('0x9b')](_0x5adb('0x25')+_['capitalize'](_0xcd9c97['toLowerCase']())+'Queue:save',_0xaf0b4);}return _0x4c3448;})[_0x5adb('0x1f')](function(){if(_0xcd9c97===_0x5adb('0x9c')){return db[_0x5adb('0x9d')]['findAll']({'where':{'id':_0x21c46a['body'][_0x5adb('0x55')]||[]},'raw':!![],'attributes':['id',_0x5adb('0x2f')]});}})[_0x5adb('0x1f')](function(_0x3d2a5b){var _0x3b367f=_0x55dd31[_0x5adb('0x22')]({'plain':!![]});var _0x566445=[];if(_0xcd9c97==='voice'&&_0x3b367f[_0x5adb('0x23')]==='agent'&&_0x3b367f[_0x5adb('0x9e')]){for(let _0x545504=0x0;_0x545504<_0x3d2a5b['length'];_0x545504+=0x1){_0x566445[_0x5adb('0x44')]({'membername':_0x3b367f[_0x5adb('0x2f')],'UserId':_0x3b367f['id'],'queue_name':_0x3d2a5b[_0x545504][_0x5adb('0x2f')],'VoiceQueueId':_0x3d2a5b[_0x545504]['id'],'interface':_[_0x5adb('0x5d')](_0x3b367f['interface'])?util[_0x5adb('0x9f')](_0x5adb('0xa0'),_0x3b367f[_0x5adb('0x2f')]):_0x3b367f[_0x5adb('0xa1')],'paused':_0x3b367f['voicePause']||![],'penalty':_0x21c46a[_0x5adb('0x52')]['penalty']||0x0});}return Promise[_0x5adb('0x4a')](_0x566445[_0x5adb('0x29')](function(_0x2c7167){return db[_0x5adb('0xa2')][_0x5adb('0xa3')](_0x2c7167);}));}return _0x55dd31;});}})[_0x5adb('0x1f')](respondWithStatusCode(_0xcd014e,null))['catch'](handleError(_0xcd014e,null));};exports[_0x5adb('0xa4')]=function(_0x49e908,_0x3b1dfb){var _0x26cd17,_0x5d7bc2;return db[_0x5adb('0x3a')]['find']({'where':{'id':_0x49e908['params']['id']},'attributes':['id','name',_0x5adb('0x23')]})['then'](handleEntityNotFound(_0x3b1dfb,null))['then'](function(_0x1d3771){if(_0x1d3771){_0x26cd17=_0x1d3771;if(!_0x49e908[_0x5adb('0x3b')][_0x5adb('0x91')]||!utils[_0x5adb('0xa5')](_0x49e908[_0x5adb('0x3b')][_0x5adb('0x91')])){throw new db[(_0x5adb('0x83'))]['ValidationError'](_0x5adb('0x94'));}return _0x1d3771[_0x5adb('0xa6')+_['capitalize'](_0x49e908[_0x5adb('0x3b')][_0x5adb('0x91')][_0x5adb('0x97')]())+_0x5adb('0xa7')](_0x49e908[_0x5adb('0x3b')][_0x5adb('0x55')]);}})[_0x5adb('0x1f')](function(_0x70e873){if(_[_0x5adb('0xa8')](_0x49e908[_0x5adb('0x3b')][_0x5adb('0x55')])){for(var _0x2f64ef=0x0;_0x2f64ef<_0x49e908['query']['ids'][_0x5adb('0x43')];_0x2f64ef+=0x1){_0x5d7bc2={'UserId':Number(_0x49e908[_0x5adb('0x4c')]['id'])};_0x5d7bc2[_[_0x5adb('0x96')](_0x49e908[_0x5adb('0x3b')]['channel'][_0x5adb('0x97')]())+_0x5adb('0x9a')]=Number(_0x49e908[_0x5adb('0x3b')][_0x5adb('0x55')][_0x2f64ef]);socket[_0x5adb('0x9b')]('user'+_['capitalize'](_0x49e908[_0x5adb('0x3b')]['channel'][_0x5adb('0x97')]())+_0x5adb('0xa9'),_0x5d7bc2);}}else{_0x5d7bc2={'UserId':Number(_0x49e908[_0x5adb('0x4c')]['id'])};_0x5d7bc2[_[_0x5adb('0x96')](_0x49e908[_0x5adb('0x3b')][_0x5adb('0x91')]['toLowerCase']())+_0x5adb('0x9a')]=Number(_0x49e908[_0x5adb('0x3b')][_0x5adb('0x55')]);socket[_0x5adb('0x9b')](_0x5adb('0x25')+_[_0x5adb('0x96')](_0x49e908[_0x5adb('0x3b')]['channel']['toLowerCase']())+'Queue:remove',_0x5d7bc2);}return _0x70e873;})[_0x5adb('0x1f')](function(){if(_0x49e908['query'][_0x5adb('0x91')]==='voice'){return db['UserVoiceQueueRt'][_0x5adb('0x21')]({'where':{'UserId':_0x49e908[_0x5adb('0x4c')]['id'],'VoiceQueueId':_0x49e908['query']['ids']},'individualHooks':!![]})[_0x5adb('0x1f')](function(){return _0x26cd17;});}return _0x26cd17;})[_0x5adb('0x1f')](respondWithStatusCode(_0x3b1dfb,null))[_0x5adb('0x4b')](handleError(_0x3b1dfb,null));};exports['addAvatar']=function(_0xef36c8,_0x57f0ea){_0xef36c8['body'][_0x5adb('0xaa')]=_0xef36c8[_0x5adb('0xab')][_0x5adb('0xac')];return db['User']['find']({'where':{'id':_0xef36c8[_0x5adb('0x4c')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x57f0ea,null))['then'](saveUpdates(_0xef36c8['body'],null))[_0x5adb('0x1f')](respondWithResult(_0x57f0ea,null))[_0x5adb('0x4b')](handleError(_0x57f0ea,null));};exports['getAvatar']=function(_0x44842b,_0x550969){var _0x1e25a9=path['join'](config[_0x5adb('0xad')],_0x5adb('0xae'));return db[_0x5adb('0x3a')][_0x5adb('0x2c')]({'where':{'id':_0x44842b[_0x5adb('0x4c')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x5adb('0x1f')](handleEntityNotFound(_0x550969,null))[_0x5adb('0x1f')](function(_0x23c07a){if(_0x23c07a){if(_['isNil'](_0x23c07a[_0x5adb('0xaa')])){return _0x550969[_0x5adb('0xaf')](_0x1e25a9);}else{if(!fs[_0x5adb('0xb0')](path[_0x5adb('0xb1')](config['root'],_0x5adb('0xb2'),_0x23c07a[_0x5adb('0xaa')]))){return _0x550969[_0x5adb('0xaf')](_0x1e25a9);}return _0x550969['download'](path[_0x5adb('0xb1')](config['root'],_0x5adb('0xb2'),_0x23c07a[_0x5adb('0xaa')]));}}})[_0x5adb('0x4b')](handleError(_0x550969,null));};exports[_0x5adb('0xb3')]=function(_0xa201a3,_0x52803b){return db['User']['find']({'where':{'id':_0xa201a3[_0x5adb('0x4c')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x52803b,null))['then'](function(_0x2c18b3){var _0xcd7836=[];values=_0x2c18b3[_0x5adb('0x46')];_0xcd7836[_0x5adb('0x44')](get_open_tabs(_0x5adb('0x45'),_0x2c18b3[_0x5adb('0x46')]));_0xcd7836[_0x5adb('0x44')](get_open_tabs(_0x5adb('0x51'),_0x2c18b3['dataValues']));_0xcd7836[_0x5adb('0x44')](get_open_tabs(_0x5adb('0xb4'),_0x2c18b3['dataValues']));_0xcd7836[_0x5adb('0x44')](get_open_tabs(_0x5adb('0x49'),_0x2c18b3['dataValues']));_0xcd7836[_0x5adb('0x44')](get_open_tabs('fax',_0x2c18b3[_0x5adb('0x46')]));_0xcd7836[_0x5adb('0x44')](get_open_tabs(_0x5adb('0x48'),_0x2c18b3[_0x5adb('0x46')]));return Promise[_0x5adb('0x4a')](_0xcd7836);})[_0x5adb('0x1f')](function(_0x7b0fdc){if(_0x7b0fdc){var _0x1d8434=_['map'](values[_0x5adb('0xb5')],function(_0x4ab6b8){return{'channel':_0x5adb('0xb6'),'id':_0x4ab6b8['id'],'createdAt':_0x4ab6b8['createdAt']};});var _0x4456e=_['map'](values[_0x5adb('0xb7')],function(_0x2eebb1){return{'channel':_0x5adb('0xb8'),'id':_0x2eebb1['id'],'createdAt':_0x2eebb1[_0x5adb('0xb9')]};});var _0x1ee869=_[_0x5adb('0x29')](values[_0x5adb('0xba')],function(_0x443f5a){return{'channel':_0x5adb('0xbb'),'id':_0x443f5a['id'],'createdAt':_0x443f5a[_0x5adb('0xb9')]};});var _0x35e182=_[_0x5adb('0x29')](values[_0x5adb('0xbc')],function(_0x5150e5){return{'channel':_0x5adb('0xbd'),'id':_0x5150e5['id'],'createdAt':_0x5150e5['createdAt']};});var _0x1eb7dc=_[_0x5adb('0x29')](values[_0x5adb('0xbe')],function(_0x5cd580){return{'channel':'SMS','id':_0x5cd580['id'],'createdAt':_0x5cd580['createdAt']};});var _0x54d865=_[_0x5adb('0x29')](values[_0x5adb('0xbf')],function(_0x290077){return{'channel':_0x5adb('0xc0'),'id':_0x290077['id'],'createdAt':_0x290077[_0x5adb('0xb9')]};});var _0x452e5e=_[_0x5adb('0xc1')](_0x1d8434,_0x4456e,_0x1ee869,_0x35e182,_0x1eb7dc,_0x54d865);var _0x3d3a36={'count':_0x452e5e[_0x5adb('0x43')],'rows':_0x452e5e};return _0x3d3a36;}else return null;})['then'](respondWithResult(_0x52803b,null))[_0x5adb('0x4b')](handleError(_0x52803b,null));};exports[_0x5adb('0xc2')]=function(_0x171fb9,_0x17801d){var _0x1ba4ba={};return db[_0x5adb('0x3a')]['findOne']({'where':{'id':_0x171fb9['params']['id']}})['then'](function(_0x25f1f7){if(!_0x25f1f7){throw new APINotFoundError(util[_0x5adb('0x9f')](_0x5adb('0xc3'),_0x171fb9[_0x5adb('0x4c')]['id']));}return contacts[_0x5adb('0x53')]();})['then'](function(_0x160966){_0x171fb9[_0x5adb('0x3b')][_0x5adb('0x3a')]=_0x171fb9[_0x5adb('0x4c')]['id'];_0x1ba4ba=qs[_0x5adb('0x39')](_0x160966,_0x171fb9);if(_0x171fb9[_0x5adb('0x3b')][_0x5adb('0xc4')](_0x5adb('0x4d'))){_0x1ba4ba[_0x5adb('0x3c')]=[{'model':db[_0x5adb('0xc5')],'as':_0x5adb('0xc6'),'required':![]},{'model':db[_0x5adb('0xc7')],'as':_0x5adb('0xc8'),'attributes':['id','name',_0x5adb('0xc9')],'where':_0x171fb9['query'][_0x5adb('0xca')]?{'id':_0x171fb9[_0x5adb('0x3b')][_0x5adb('0xca')]}:undefined,'required':_0x171fb9[_0x5adb('0x3b')][_0x5adb('0xca')]?!![]:![]}];}return contacts[_0x5adb('0x41')](_0x171fb9[_0x5adb('0x3b')],_0x171fb9[_0x5adb('0x25')],_0x1ba4ba,_0x160966);})['then'](respondWithFilteredResult(_0x17801d,_0x1ba4ba))[_0x5adb('0x4b')](APIHandleError(_0x17801d));};exports['getQueues']=function(_0x59fb0c,_0x2346ee){var _0x1ef5c2;var _0x5dcd59={};var _0x1ee930;return db['User'][_0x5adb('0x8b')]({'where':{'id':_0x59fb0c[_0x5adb('0x4c')]['id']},'attributes':['id','name',_0x5adb('0x23')]})['then'](handleEntityNotFound(_0x2346ee,null))[_0x5adb('0x1f')](function(_0x426cc2){if(!utils[_0x5adb('0xa5')](_0x59fb0c[_0x5adb('0x3b')][_0x5adb('0x91')])){throw new db['Sequelize']['ValidationError'](_0x5adb('0x94'));}_0x1ef5c2=_0x426cc2;var _0x4069ff={};_0x4069ff['model']=_[_0x5adb('0xcb')](db[_[_0x5adb('0x96')](_0x59fb0c[_0x5adb('0x3b')][_0x5adb('0x91')])+_0x5adb('0xcc')][_0x5adb('0x31')]);_0x4069ff[_0x5adb('0x3b')]=_[_0x5adb('0xcb')](_0x59fb0c['query']);_0x4069ff[_0x5adb('0xcd')]=_[_0x5adb('0xce')](_0x4069ff[_0x5adb('0xcf')],_0x4069ff['query']);_0x5dcd59['attributes']=_[_0x5adb('0xce')](_0x4069ff['model'],qs['fields'](_0x59fb0c[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0x5dcd59[_0x5adb('0x40')]=_0x5dcd59[_0x5adb('0x40')]['length']?_0x5dcd59[_0x5adb('0x40')]:_0x4069ff[_0x5adb('0xcf')];_0x5dcd59['order']=qs[_0x5adb('0xd1')](_0x59fb0c[_0x5adb('0x3b')]['sort']);_0x5dcd59[_0x5adb('0xd2')]=qs[_0x5adb('0xcd')](_[_0x5adb('0xd3')](_0x59fb0c['query'],_0x4069ff[_0x5adb('0xcd')]));if(_0x59fb0c[_0x5adb('0x3b')]['filter']){_0x5dcd59[_0x5adb('0xd2')]=_[_0x5adb('0x4e')](_0x5dcd59[_0x5adb('0xd2')],{'$or':_[_0x5adb('0x29')](_0x5dcd59[_0x5adb('0x40')],function(_0x478f87){var _0x5a8edb={};_0x5a8edb[_0x478f87]={'$like':'%'+_0x59fb0c[_0x5adb('0x3b')][_0x5adb('0x34')]+'%'};return _0x5a8edb;})});}_0x5dcd59=_[_0x5adb('0x4e')]({},_0x5dcd59,_0x59fb0c[_0x5adb('0x4f')]);switch(_0x1ef5c2[_0x5adb('0x23')]){case _0x5adb('0x74'):return db[_[_0x5adb('0x96')](_0x59fb0c['query'][_0x5adb('0x91')])+_0x5adb('0xcc')][_0x5adb('0x41')](_0x5dcd59);case _0x5adb('0x25'):case _0x5adb('0x20'):return _0x1ef5c2['get'+_[_0x5adb('0x96')](_0x59fb0c[_0x5adb('0x3b')]['channel'])+'Queues'](_0x5dcd59);default:throw new db[(_0x5adb('0x83'))][(_0x5adb('0x84'))](_0x5adb('0xd4'));}})[_0x5adb('0x1f')](function(_0x2d7c4b){_0x1ee930=_0x2d7c4b[_0x5adb('0x43')];if(!_0x59fb0c['query'][_0x5adb('0xc4')](_0x5adb('0xd5'))){_0x5dcd59['limit']=qs[_0x5adb('0x1b')](_0x59fb0c['query'][_0x5adb('0x1b')]);_0x5dcd59[_0x5adb('0x19')]=qs[_0x5adb('0x19')](_0x59fb0c[_0x5adb('0x3b')]['offset']);}switch(_0x1ef5c2['role']){case _0x5adb('0x74'):return db[_[_0x5adb('0x96')](_0x59fb0c[_0x5adb('0x3b')]['channel'])+_0x5adb('0xcc')]['findAll'](_0x5dcd59);case'user':case _0x5adb('0x20'):return _0x1ef5c2[_0x5adb('0x22')+_['capitalize'](_0x59fb0c[_0x5adb('0x3b')][_0x5adb('0x91')])+_0x5adb('0xa7')](_0x5dcd59);}})['then'](function(_0x40555c){return{'count':_0x1ee930,'rows':_0x40555c};})[_0x5adb('0x1f')](respondWithResult(_0x2346ee,null))[_0x5adb('0x4b')](handleError(_0x2346ee,null));};exports[_0x5adb('0xd6')]=function(_0x517820,_0x4a01e3){var _0x5dc269={};var _0x303c9c={};var _0x273fb8;var _0x1e70d6;return db['User'][_0x5adb('0x8b')]({'where':{'id':_0x517820[_0x5adb('0x4c')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x4a01e3,null))[_0x5adb('0x1f')](function(_0x11f4da){if(_0x11f4da){_0x273fb8=_0x11f4da;_0x303c9c[_0x5adb('0xcf')]=_['keys'](db['UserVoiceQueueRt'][_0x5adb('0x31')]);_0x303c9c['query']=_[_0x5adb('0xcb')](_0x517820['query']);_0x303c9c[_0x5adb('0xcd')]=_[_0x5adb('0xce')](_0x303c9c[_0x5adb('0xcf')],_0x303c9c[_0x5adb('0x3b')]);_0x5dc269[_0x5adb('0x40')]=_[_0x5adb('0xce')](_0x303c9c[_0x5adb('0xcf')],qs[_0x5adb('0xd0')](_0x517820[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0x5dc269[_0x5adb('0x40')]=_0x5dc269[_0x5adb('0x40')][_0x5adb('0x43')]?_0x5dc269['attributes']:_0x303c9c[_0x5adb('0xcf')];_0x5dc269[_0x5adb('0xd7')]=qs[_0x5adb('0xd1')](_0x517820[_0x5adb('0x3b')][_0x5adb('0xd1')]);_0x5dc269[_0x5adb('0xd2')]=qs['filters'](_[_0x5adb('0xd3')](_0x517820[_0x5adb('0x3b')],_0x303c9c[_0x5adb('0xcd')]));if(_0x517820[_0x5adb('0x3b')][_0x5adb('0x34')]){_0x5dc269[_0x5adb('0xd2')]=_[_0x5adb('0x4e')](_0x5dc269[_0x5adb('0xd2')],{'$or':_['map'](_0x5dc269[_0x5adb('0x40')],function(_0x23de7f){var _0x5cc6e1={};_0x5cc6e1[_0x23de7f]={'$like':'%'+_0x517820[_0x5adb('0x3b')]['filter']+'%'};return _0x5cc6e1;})});}_0x5dc269=_[_0x5adb('0x4e')]({},_0x5dc269,_0x517820[_0x5adb('0x4f')]);return _0x273fb8[_0x5adb('0xd6')](_0x5dc269);}})[_0x5adb('0x1f')](function(_0x3d1484){if(_0x3d1484){_0x1e70d6=_0x3d1484['length'];if(!_0x517820['query']['hasOwnProperty'](_0x5adb('0xd5'))){_0x5dc269[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x517820['query']['limit']);_0x5dc269[_0x5adb('0x19')]=qs[_0x5adb('0x19')](_0x517820[_0x5adb('0x3b')]['offset']);}return _0x273fb8['getVoiceQueuesRt'](_0x5dc269);}})[_0x5adb('0x1f')](function(_0x300f75){if(_0x300f75){return _0x300f75?{'count':_0x1e70d6,'rows':_0x300f75}:null;}})[_0x5adb('0x1f')](respondWithResult(_0x4a01e3,null))[_0x5adb('0x4b')](handleError(_0x4a01e3,null));};exports[_0x5adb('0xd8')]=function(_0x35efbc,_0x521a01){var _0x5af6db={};var _0x26210b={};var _0x3ebaae;var _0x107dec;return db[_0x5adb('0x3a')][_0x5adb('0x8b')]({'where':{'id':_0x35efbc['params']['id']}})['then'](handleEntityNotFound(_0x521a01,null))['then'](function(_0x326d04){if(_0x326d04){_0x3ebaae=_0x326d04;_0x26210b[_0x5adb('0xcf')]=_[_0x5adb('0xcb')](db['ChatGroup'][_0x5adb('0x31')]);_0x26210b[_0x5adb('0x3b')]=_[_0x5adb('0xcb')](_0x35efbc[_0x5adb('0x3b')]);_0x26210b[_0x5adb('0xcd')]=_[_0x5adb('0xce')](_0x26210b[_0x5adb('0xcf')],_0x26210b[_0x5adb('0x3b')]);_0x5af6db['attributes']=_[_0x5adb('0xce')](_0x26210b[_0x5adb('0xcf')],qs[_0x5adb('0xd0')](_0x35efbc[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0x5af6db[_0x5adb('0x40')]=_0x5af6db[_0x5adb('0x40')][_0x5adb('0x43')]?_0x5af6db['attributes']:_0x26210b[_0x5adb('0xcf')];_0x5af6db['order']=qs[_0x5adb('0xd1')](_0x35efbc['query']['sort']);_0x5af6db['where']=qs['filters'](_[_0x5adb('0xd3')](_0x35efbc[_0x5adb('0x3b')],_0x26210b[_0x5adb('0xcd')]));if(_0x35efbc[_0x5adb('0x3b')][_0x5adb('0x34')]){_0x5af6db['where']=_[_0x5adb('0x4e')](_0x5af6db[_0x5adb('0xd2')],{'$or':_[_0x5adb('0x29')](_0x5af6db[_0x5adb('0x40')],function(_0xa3233c){var _0x542329={};_0x542329[_0xa3233c]={'$like':'%'+_0x35efbc['query']['filter']+'%'};return _0x542329;})});}_0x5af6db=_[_0x5adb('0x4e')]({},_0x5af6db,_0x35efbc['options']);return _0x3ebaae['getGroups'](_0x5af6db);}})['then'](function(_0x4a1cd2){if(_0x4a1cd2){_0x107dec=_0x4a1cd2[_0x5adb('0x43')];if(!_0x35efbc[_0x5adb('0x3b')][_0x5adb('0xc4')](_0x5adb('0xd5'))){_0x5af6db['limit']=qs[_0x5adb('0x1b')](_0x35efbc[_0x5adb('0x3b')][_0x5adb('0x1b')]);_0x5af6db[_0x5adb('0x19')]=qs[_0x5adb('0x19')](_0x35efbc['query']['offset']);}return _0x3ebaae[_0x5adb('0xd8')](_0x5af6db);}})[_0x5adb('0x1f')](function(_0xaacfe9){if(_0xaacfe9){return _0xaacfe9?{'count':_0x107dec,'rows':_0xaacfe9}:null;}})[_0x5adb('0x1f')](respondWithResult(_0x521a01,null))[_0x5adb('0x4b')](handleError(_0x521a01,null));};exports[_0x5adb('0xd9')]=function(_0x1eea98,_0x17ae02){var _0x9e204d={'raw':!![],'where':{}};var _0x1dd7aa={};var _0x2aac56={'count':0x0,'rows':[]};return db['User'][_0x5adb('0x8b')]({'where':{'id':_0x1eea98['params']['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x17ae02,null))[_0x5adb('0x1f')](function(_0x5b93c7){if(_0x5b93c7){_0x1dd7aa[_0x5adb('0xcf')]=_[_0x5adb('0xcb')](db[_0x5adb('0xda')]['rawAttributes']);_0x1dd7aa['query']=_[_0x5adb('0xcb')](_0x1eea98[_0x5adb('0x3b')]);_0x1dd7aa['filters']=_['intersection'](_0x1dd7aa['model'],_0x1dd7aa[_0x5adb('0x3b')]);_0x9e204d[_0x5adb('0x40')]=_[_0x5adb('0xce')](_0x1dd7aa[_0x5adb('0xcf')],qs[_0x5adb('0xd0')](_0x1eea98[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0x9e204d[_0x5adb('0x40')]=_0x9e204d[_0x5adb('0x40')][_0x5adb('0x43')]?_0x9e204d['attributes']:_0x1dd7aa['model'];if(!_0x1eea98[_0x5adb('0x3b')][_0x5adb('0xc4')](_0x5adb('0xd5'))){_0x9e204d[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x1eea98['query'][_0x5adb('0x1b')]);_0x9e204d[_0x5adb('0x19')]=qs[_0x5adb('0x19')](_0x1eea98[_0x5adb('0x3b')]['offset']);}_0x9e204d[_0x5adb('0xd7')]=qs['sort'](_0x1eea98[_0x5adb('0x3b')][_0x5adb('0xd1')]);_0x9e204d[_0x5adb('0xd2')]=qs['filters'](_[_0x5adb('0xd3')](_0x1eea98[_0x5adb('0x3b')],_0x1dd7aa[_0x5adb('0xcd')]));_0x9e204d[_0x5adb('0xd2')]['UserId']=_0x5b93c7['id'];if(_0x1eea98['query'][_0x5adb('0x34')]){_0x9e204d[_0x5adb('0xd2')]=_[_0x5adb('0x4e')](_0x9e204d[_0x5adb('0xd2')],{'$or':_['map'](_0x9e204d[_0x5adb('0x40')],function(_0x1283ff){var _0x1e234={};_0x1e234[_0x1283ff]={'$like':'%'+_0x1eea98[_0x5adb('0x3b')]['filter']+'%'};return _0x1e234;})});}_0x9e204d=_['merge']({},_0x9e204d,_0x1eea98['options']);return db[_0x5adb('0xda')][_0x5adb('0x1c')]({'where':_0x9e204d[_0x5adb('0xd2')]})[_0x5adb('0x1f')](function(_0x2f6e6e){_0x2aac56[_0x5adb('0x1c')]=_0x2f6e6e;if(_0x1eea98[_0x5adb('0x3b')][_0x5adb('0x4d')]){_0x9e204d[_0x5adb('0x3c')]=[{'all':!![]}];}return db[_0x5adb('0xda')][_0x5adb('0x41')](_0x9e204d);})[_0x5adb('0x1f')](function(_0x1bf854){_0x2aac56[_0x5adb('0x42')]=_0x1bf854;return _0x2aac56;});}})[_0x5adb('0x1f')](respondWithFilteredResult(_0x17ae02,_0x9e204d))['catch'](handleError(_0x17ae02,null));};exports[_0x5adb('0xdb')]=function(_0x1ae29c,_0x1788ab){var _0x5e6b42={'raw':!![],'where':{}};var _0x68364f={};var _0x58a6e3={'count':0x0,'rows':[]};return db[_0x5adb('0x3a')][_0x5adb('0x8b')]({'where':{'id':_0x1ae29c[_0x5adb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1788ab,null))[_0x5adb('0x1f')](function(_0x1df872){if(_0x1df872){_0x68364f[_0x5adb('0xcf')]=_[_0x5adb('0xcb')](db[_0x5adb('0xdc')]['rawAttributes']);_0x68364f[_0x5adb('0x3b')]=_[_0x5adb('0xcb')](_0x1ae29c[_0x5adb('0x3b')]);_0x68364f[_0x5adb('0xcd')]=_[_0x5adb('0xce')](_0x68364f['model'],_0x68364f['query']);_0x5e6b42[_0x5adb('0x40')]=_[_0x5adb('0xce')](_0x68364f[_0x5adb('0xcf')],qs[_0x5adb('0xd0')](_0x1ae29c['query'][_0x5adb('0xd0')]));_0x5e6b42[_0x5adb('0x40')]=_0x5e6b42[_0x5adb('0x40')][_0x5adb('0x43')]?_0x5e6b42[_0x5adb('0x40')]:_0x68364f[_0x5adb('0xcf')];if(!_0x1ae29c['query'][_0x5adb('0xc4')](_0x5adb('0xd5'))){_0x5e6b42['limit']=qs[_0x5adb('0x1b')](_0x1ae29c[_0x5adb('0x3b')][_0x5adb('0x1b')]);_0x5e6b42[_0x5adb('0x19')]=qs[_0x5adb('0x19')](_0x1ae29c['query'][_0x5adb('0x19')]);}_0x5e6b42[_0x5adb('0xd7')]=qs[_0x5adb('0xd1')](_0x1ae29c[_0x5adb('0x3b')][_0x5adb('0xd1')]);_0x5e6b42['where']=qs[_0x5adb('0xcd')](_[_0x5adb('0xd3')](_0x1ae29c[_0x5adb('0x3b')],_0x68364f[_0x5adb('0xcd')]));_0x5e6b42[_0x5adb('0xd2')][_0x5adb('0xdd')]=_0x1df872['id'];if(_0x1ae29c[_0x5adb('0x3b')][_0x5adb('0x34')]){_0x5e6b42['where']=_['merge'](_0x5e6b42[_0x5adb('0xd2')],{'$or':_['map'](_0x5e6b42[_0x5adb('0x40')],function(_0xb81992){var _0x300456={};_0x300456[_0xb81992]={'$like':'%'+_0x1ae29c['query'][_0x5adb('0x34')]+'%'};return _0x300456;})});}_0x5e6b42=_[_0x5adb('0x4e')]({},_0x5e6b42,_0x1ae29c[_0x5adb('0x4f')]);return db[_0x5adb('0xdc')]['count']({'where':_0x5e6b42[_0x5adb('0xd2')]})[_0x5adb('0x1f')](function(_0x2ff7a8){_0x58a6e3[_0x5adb('0x1c')]=_0x2ff7a8;if(_0x1ae29c[_0x5adb('0x3b')][_0x5adb('0x4d')]){_0x5e6b42[_0x5adb('0x3c')]=[{'all':!![]}];}return db[_0x5adb('0xdc')][_0x5adb('0x41')](_0x5e6b42);})['then'](function(_0x3fa541){_0x58a6e3[_0x5adb('0x42')]=_0x3fa541;return _0x58a6e3;});}})[_0x5adb('0x1f')](respondWithFilteredResult(_0x1788ab,_0x5e6b42))['catch'](handleError(_0x1788ab,null));};exports[_0x5adb('0xde')]=function(_0x87e632,_0x5a7745){var _0x5804a4={};var _0x3da83f={};var _0x441ef7;var _0x53e74d;return db['User']['findOne']({'where':{'id':_0x87e632[_0x5adb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a7745,null))[_0x5adb('0x1f')](function(_0x572e16){if(_0x572e16){_0x441ef7=_0x572e16;_0x3da83f[_0x5adb('0xcf')]=_['keys'](db[_0x5adb('0xdf')][_0x5adb('0x31')]);_0x3da83f['query']=_[_0x5adb('0xcb')](_0x87e632[_0x5adb('0x3b')]);_0x3da83f['filters']=_[_0x5adb('0xce')](_0x3da83f['model'],_0x3da83f[_0x5adb('0x3b')]);_0x5804a4[_0x5adb('0x40')]=_[_0x5adb('0xce')](_0x3da83f['model'],qs['fields'](_0x87e632[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0x5804a4[_0x5adb('0x40')]=_0x5804a4[_0x5adb('0x40')][_0x5adb('0x43')]?_0x5804a4[_0x5adb('0x40')]:_0x3da83f[_0x5adb('0xcf')];_0x5804a4[_0x5adb('0xd7')]=qs['sort'](_0x87e632['query'][_0x5adb('0xd1')]);_0x5804a4[_0x5adb('0xd2')]=qs['filters'](_[_0x5adb('0xd3')](_0x87e632['query'],_0x3da83f[_0x5adb('0xcd')]));if(_0x87e632[_0x5adb('0x3b')]['filter']){_0x5804a4['where']=_[_0x5adb('0x4e')](_0x5804a4[_0x5adb('0xd2')],{'$or':_[_0x5adb('0x29')](_0x5804a4[_0x5adb('0x40')],function(_0x22266a){var _0x51230={};_0x51230[_0x22266a]={'$like':'%'+_0x87e632[_0x5adb('0x3b')][_0x5adb('0x34')]+'%'};return _0x51230;})});}_0x5804a4=_[_0x5adb('0x4e')]({},_0x5804a4,_0x87e632[_0x5adb('0x4f')]);return _0x441ef7['getChatInteractions'](_0x5804a4);}})['then'](function(_0x489b5d){if(_0x489b5d){_0x53e74d=_0x489b5d[_0x5adb('0x43')];if(!_0x87e632[_0x5adb('0x3b')][_0x5adb('0xc4')]('nolimit')){_0x5804a4[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x87e632['query'][_0x5adb('0x1b')]);_0x5804a4[_0x5adb('0x19')]=qs['offset'](_0x87e632['query'][_0x5adb('0x19')]);}return _0x441ef7[_0x5adb('0xde')](_0x5804a4);}})[_0x5adb('0x1f')](function(_0x4b8ed5){if(_0x4b8ed5){return _0x4b8ed5?{'count':_0x53e74d,'rows':_0x4b8ed5}:null;}})[_0x5adb('0x1f')](respondWithResult(_0x5a7745,null))['catch'](handleError(_0x5a7745,null));};exports['getOpenchannelInteractions']=function(_0x26051c,_0x10aa15){var _0x15dbc9={};var _0x497808={};var _0xa7a1ae;var _0x1df63c;return db[_0x5adb('0x3a')]['findOne']({'where':{'id':_0x26051c[_0x5adb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x10aa15,null))[_0x5adb('0x1f')](function(_0x25bf5b){if(_0x25bf5b){_0xa7a1ae=_0x25bf5b;_0x497808['model']=_[_0x5adb('0xcb')](db[_0x5adb('0xe0')][_0x5adb('0x31')]);_0x497808[_0x5adb('0x3b')]=_[_0x5adb('0xcb')](_0x26051c['query']);_0x497808['filters']=_['intersection'](_0x497808[_0x5adb('0xcf')],_0x497808[_0x5adb('0x3b')]);_0x15dbc9[_0x5adb('0x40')]=_['intersection'](_0x497808[_0x5adb('0xcf')],qs['fields'](_0x26051c[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0x15dbc9[_0x5adb('0x40')]=_0x15dbc9[_0x5adb('0x40')]['length']?_0x15dbc9[_0x5adb('0x40')]:_0x497808[_0x5adb('0xcf')];_0x15dbc9[_0x5adb('0xd7')]=qs['sort'](_0x26051c[_0x5adb('0x3b')][_0x5adb('0xd1')]);_0x15dbc9[_0x5adb('0xd2')]=qs['filters'](_['pick'](_0x26051c[_0x5adb('0x3b')],_0x497808['filters']));if(_0x26051c[_0x5adb('0x3b')]['filter']){_0x15dbc9['where']=_[_0x5adb('0x4e')](_0x15dbc9['where'],{'$or':_['map'](_0x15dbc9['attributes'],function(_0x48cbcf){var _0x349f60={};_0x349f60[_0x48cbcf]={'$like':'%'+_0x26051c[_0x5adb('0x3b')][_0x5adb('0x34')]+'%'};return _0x349f60;})});}_0x15dbc9=_[_0x5adb('0x4e')]({},_0x15dbc9,_0x26051c['options']);return _0xa7a1ae[_0x5adb('0xe1')](_0x15dbc9);}})['then'](function(_0x1af660){if(_0x1af660){_0x1df63c=_0x1af660['length'];if(!_0x26051c[_0x5adb('0x3b')][_0x5adb('0xc4')](_0x5adb('0xd5'))){_0x15dbc9['limit']=qs[_0x5adb('0x1b')](_0x26051c[_0x5adb('0x3b')]['limit']);_0x15dbc9[_0x5adb('0x19')]=qs['offset'](_0x26051c[_0x5adb('0x3b')][_0x5adb('0x19')]);}return _0xa7a1ae['getOpenchannelInteractions'](_0x15dbc9);}})[_0x5adb('0x1f')](function(_0x2ec22d){if(_0x2ec22d){return _0x2ec22d?{'count':_0x1df63c,'rows':_0x2ec22d}:null;}})[_0x5adb('0x1f')](respondWithResult(_0x10aa15,null))[_0x5adb('0x4b')](handleError(_0x10aa15,null));};exports[_0x5adb('0xe2')]=function(_0xf22905,_0x14e101){var _0x34dcc5={'raw':!![],'where':{}};var _0x24bd21={};var _0x3d9d4a={'count':0x0,'rows':[]};return db['User'][_0x5adb('0x8b')]({'where':{'id':_0xf22905[_0x5adb('0x4c')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x14e101,null))[_0x5adb('0x1f')](function(_0x4d5fa3){if(_0x4d5fa3){_0x24bd21['model']=_['keys'](db[_0x5adb('0xe3')][_0x5adb('0x31')]);_0x24bd21[_0x5adb('0x3b')]=_[_0x5adb('0xcb')](_0xf22905[_0x5adb('0x3b')]);_0x24bd21[_0x5adb('0xcd')]=_[_0x5adb('0xce')](_0x24bd21['model'],_0x24bd21[_0x5adb('0x3b')]);_0x34dcc5[_0x5adb('0x40')]=_[_0x5adb('0xce')](_0x24bd21[_0x5adb('0xcf')],qs['fields'](_0xf22905[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0x34dcc5[_0x5adb('0x40')]=_0x34dcc5['attributes'][_0x5adb('0x43')]?_0x34dcc5[_0x5adb('0x40')]:_0x24bd21['model'];if(!_0xf22905[_0x5adb('0x3b')][_0x5adb('0xc4')](_0x5adb('0xd5'))){_0x34dcc5['limit']=qs[_0x5adb('0x1b')](_0xf22905[_0x5adb('0x3b')][_0x5adb('0x1b')]);_0x34dcc5[_0x5adb('0x19')]=qs[_0x5adb('0x19')](_0xf22905[_0x5adb('0x3b')][_0x5adb('0x19')]);}_0x34dcc5[_0x5adb('0xd7')]=qs['sort'](_0xf22905['query'][_0x5adb('0xd1')]);_0x34dcc5[_0x5adb('0xd2')]=qs['filters'](_[_0x5adb('0xd3')](_0xf22905[_0x5adb('0x3b')],_0x24bd21[_0x5adb('0xcd')]));_0x34dcc5[_0x5adb('0xd2')]['UserId']=_0x4d5fa3['id'];if(_0xf22905[_0x5adb('0x3b')][_0x5adb('0x34')]){_0x34dcc5['where']=_['merge'](_0x34dcc5[_0x5adb('0xd2')],{'$or':_[_0x5adb('0x29')](_0x34dcc5[_0x5adb('0x40')],function(_0x54ad10){var _0x5408d4={};_0x5408d4[_0x54ad10]={'$like':'%'+_0xf22905['query'][_0x5adb('0x34')]+'%'};return _0x5408d4;})});}_0x34dcc5=_[_0x5adb('0x4e')]({},_0x34dcc5,_0xf22905[_0x5adb('0x4f')]);return db[_0x5adb('0xe3')]['count']({'where':_0x34dcc5[_0x5adb('0xd2')]})['then'](function(_0x3a1db2){_0x3d9d4a['count']=_0x3a1db2;if(_0xf22905[_0x5adb('0x3b')][_0x5adb('0x4d')]){_0x34dcc5[_0x5adb('0x3c')]=[{'all':!![]}];}return db[_0x5adb('0xe3')][_0x5adb('0x41')](_0x34dcc5);})['then'](function(_0x5e7437){_0x3d9d4a['rows']=_0x5e7437;return _0x3d9d4a;});}})[_0x5adb('0x1f')](respondWithFilteredResult(_0x14e101,_0x34dcc5))['catch'](handleError(_0x14e101,null));};exports[_0x5adb('0xe4')]=function(_0x5b4c89,_0x1bf7a6){var _0x56c69a={};var _0x4c7c33={};var _0x574b6e;var _0xc2bf82;return db['User'][_0x5adb('0x8b')]({'where':{'id':_0x5b4c89['params']['id']}})['then'](handleEntityNotFound(_0x1bf7a6,null))[_0x5adb('0x1f')](function(_0x118226){if(_0x118226){_0x574b6e=_0x118226;_0x4c7c33[_0x5adb('0xcf')]=_['keys'](db[_0x5adb('0xe5')]['rawAttributes']);_0x4c7c33[_0x5adb('0x3b')]=_[_0x5adb('0xcb')](_0x5b4c89[_0x5adb('0x3b')]);_0x4c7c33[_0x5adb('0xcd')]=_[_0x5adb('0xce')](_0x4c7c33[_0x5adb('0xcf')],_0x4c7c33[_0x5adb('0x3b')]);_0x56c69a['attributes']=_[_0x5adb('0xce')](_0x4c7c33[_0x5adb('0xcf')],qs['fields'](_0x5b4c89[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0x56c69a['attributes']=_0x56c69a['attributes']['length']?_0x56c69a['attributes']:_0x4c7c33[_0x5adb('0xcf')];_0x56c69a['order']=qs['sort'](_0x5b4c89[_0x5adb('0x3b')][_0x5adb('0xd1')]);_0x56c69a[_0x5adb('0xd2')]=qs['filters'](_[_0x5adb('0xd3')](_0x5b4c89[_0x5adb('0x3b')],_0x4c7c33[_0x5adb('0xcd')]));if(_0x5b4c89[_0x5adb('0x3b')][_0x5adb('0x34')]){_0x56c69a[_0x5adb('0xd2')]=_[_0x5adb('0x4e')](_0x56c69a[_0x5adb('0xd2')],{'$or':_['map'](_0x56c69a[_0x5adb('0x40')],function(_0x1cec7d){var _0x17859d={};_0x17859d[_0x1cec7d]={'$like':'%'+_0x5b4c89['query'][_0x5adb('0x34')]+'%'};return _0x17859d;})});}_0x56c69a=_['merge']({},_0x56c69a,_0x5b4c89['options']);return _0x574b6e[_0x5adb('0xe4')](_0x56c69a);}})[_0x5adb('0x1f')](function(_0x40d22a){if(_0x40d22a){_0xc2bf82=_0x40d22a[_0x5adb('0x43')];if(!_0x5b4c89[_0x5adb('0x3b')][_0x5adb('0xc4')](_0x5adb('0xd5'))){_0x56c69a[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x5b4c89['query'][_0x5adb('0x1b')]);_0x56c69a[_0x5adb('0x19')]=qs['offset'](_0x5b4c89[_0x5adb('0x3b')][_0x5adb('0x19')]);}return _0x574b6e[_0x5adb('0xe4')](_0x56c69a);}})['then'](function(_0x35b158){if(_0x35b158){return _0x35b158?{'count':_0xc2bf82,'rows':_0x35b158}:null;}})[_0x5adb('0x1f')](respondWithResult(_0x1bf7a6,null))[_0x5adb('0x4b')](handleError(_0x1bf7a6,null));};exports[_0x5adb('0xe6')]=function(_0x40e0a6,_0x284306){var _0x37dec0={};var _0x1fc31b={};var _0x4fa77a;var _0x3a844d;return db['User'][_0x5adb('0x8b')]({'where':{'id':_0x40e0a6[_0x5adb('0x4c')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x284306,null))[_0x5adb('0x1f')](function(_0x4b0119){if(_0x4b0119){_0x4fa77a=_0x4b0119;_0x1fc31b[_0x5adb('0xcf')]=_[_0x5adb('0xcb')](db[_0x5adb('0xe7')][_0x5adb('0x31')]);_0x1fc31b['query']=_[_0x5adb('0xcb')](_0x40e0a6[_0x5adb('0x3b')]);_0x1fc31b[_0x5adb('0xcd')]=_[_0x5adb('0xce')](_0x1fc31b[_0x5adb('0xcf')],_0x1fc31b[_0x5adb('0x3b')]);_0x37dec0[_0x5adb('0x40')]=_[_0x5adb('0xce')](_0x1fc31b['model'],qs['fields'](_0x40e0a6[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0x37dec0[_0x5adb('0x40')]=_0x37dec0[_0x5adb('0x40')][_0x5adb('0x43')]?_0x37dec0['attributes']:_0x1fc31b['model'];_0x37dec0['order']=qs[_0x5adb('0xd1')](_0x40e0a6['query'][_0x5adb('0xd1')]);_0x37dec0['where']=qs['filters'](_[_0x5adb('0xd3')](_0x40e0a6[_0x5adb('0x3b')],_0x1fc31b[_0x5adb('0xcd')]));if(_0x40e0a6[_0x5adb('0x3b')][_0x5adb('0x34')]){_0x37dec0[_0x5adb('0xd2')]=_[_0x5adb('0x4e')](_0x37dec0['where'],{'$or':_[_0x5adb('0x29')](_0x37dec0[_0x5adb('0x40')],function(_0x4d8c90){var _0x4117bc={};_0x4117bc[_0x4d8c90]={'$like':'%'+_0x40e0a6[_0x5adb('0x3b')][_0x5adb('0x34')]+'%'};return _0x4117bc;})});}_0x37dec0=_[_0x5adb('0x4e')]({},_0x37dec0,_0x40e0a6['options']);return _0x4fa77a[_0x5adb('0xe6')](_0x37dec0);}})[_0x5adb('0x1f')](function(_0x34cdae){if(_0x34cdae){_0x3a844d=_0x34cdae[_0x5adb('0x43')];if(!_0x40e0a6['query']['hasOwnProperty']('nolimit')){_0x37dec0[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x40e0a6[_0x5adb('0x3b')][_0x5adb('0x1b')]);_0x37dec0[_0x5adb('0x19')]=qs[_0x5adb('0x19')](_0x40e0a6['query'][_0x5adb('0x19')]);}return _0x4fa77a[_0x5adb('0xe6')](_0x37dec0);}})[_0x5adb('0x1f')](function(_0x165665){if(_0x165665){return _0x165665?{'count':_0x3a844d,'rows':_0x165665}:null;}})[_0x5adb('0x1f')](respondWithResult(_0x284306,null))[_0x5adb('0x4b')](handleError(_0x284306,null));};exports[_0x5adb('0xe8')]=function(_0x2ebb64,_0x1e65c9){var _0x1ea2e1={};var _0x382fc1={};var _0x4e1395;var _0x16915a;return db[_0x5adb('0x3a')][_0x5adb('0x8b')]({'where':{'id':_0x2ebb64[_0x5adb('0x4c')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x1e65c9,null))['then'](function(_0x3902a2){if(_0x3902a2){_0x4e1395=_0x3902a2;_0x382fc1[_0x5adb('0xcf')]=_[_0x5adb('0xcb')](db['WhatsappInteraction'][_0x5adb('0x31')]);_0x382fc1[_0x5adb('0x3b')]=_[_0x5adb('0xcb')](_0x2ebb64[_0x5adb('0x3b')]);_0x382fc1['filters']=_['intersection'](_0x382fc1[_0x5adb('0xcf')],_0x382fc1['query']);_0x1ea2e1[_0x5adb('0x40')]=_['intersection'](_0x382fc1['model'],qs['fields'](_0x2ebb64[_0x5adb('0x3b')]['fields']));_0x1ea2e1[_0x5adb('0x40')]=_0x1ea2e1[_0x5adb('0x40')][_0x5adb('0x43')]?_0x1ea2e1[_0x5adb('0x40')]:_0x382fc1[_0x5adb('0xcf')];_0x1ea2e1['order']=qs['sort'](_0x2ebb64[_0x5adb('0x3b')][_0x5adb('0xd1')]);_0x1ea2e1[_0x5adb('0xd2')]=qs[_0x5adb('0xcd')](_[_0x5adb('0xd3')](_0x2ebb64[_0x5adb('0x3b')],_0x382fc1['filters']));if(_0x2ebb64[_0x5adb('0x3b')][_0x5adb('0x34')]){_0x1ea2e1[_0x5adb('0xd2')]=_[_0x5adb('0x4e')](_0x1ea2e1[_0x5adb('0xd2')],{'$or':_[_0x5adb('0x29')](_0x1ea2e1['attributes'],function(_0x74e89){var _0x577ab5={};_0x577ab5[_0x74e89]={'$like':'%'+_0x2ebb64[_0x5adb('0x3b')][_0x5adb('0x34')]+'%'};return _0x577ab5;})});}_0x1ea2e1=_[_0x5adb('0x4e')]({},_0x1ea2e1,_0x2ebb64['options']);return _0x4e1395[_0x5adb('0xe8')](_0x1ea2e1);}})[_0x5adb('0x1f')](function(_0x34750b){if(_0x34750b){_0x16915a=_0x34750b[_0x5adb('0x43')];if(!_0x2ebb64[_0x5adb('0x3b')][_0x5adb('0xc4')](_0x5adb('0xd5'))){_0x1ea2e1[_0x5adb('0x1b')]=qs['limit'](_0x2ebb64[_0x5adb('0x3b')][_0x5adb('0x1b')]);_0x1ea2e1[_0x5adb('0x19')]=qs[_0x5adb('0x19')](_0x2ebb64[_0x5adb('0x3b')][_0x5adb('0x19')]);}return _0x4e1395['getWhatsappInteractions'](_0x1ea2e1);}})[_0x5adb('0x1f')](function(_0x2fd728){if(_0x2fd728){return _0x2fd728?{'count':_0x16915a,'rows':_0x2fd728}:null;}})['then'](respondWithResult(_0x1e65c9,null))['catch'](handleError(_0x1e65c9,null));};exports[_0x5adb('0xe9')]=function(_0x4c2543,_0x1f13bf,_0xd05c71){var _0x5a908f;var _0x49af36;var _0x59f296;var _0x5676ac=!_[_0x5adb('0x5d')](_0x4c2543[_0x5adb('0x4c')]['id'])?_0x4c2543[_0x5adb('0x4c')]['id']:!_[_0x5adb('0x5d')](_0x4c2543[_0x5adb('0x25')]['id'])?_0x4c2543['user']['id']:null;return db[_0x5adb('0x3a')][_0x5adb('0x2c')]({'where':{'id':_0x5676ac,'role':{'$or':[_0x5adb('0x74'),_0x5adb('0x25'),'agent']}},'attributes':['id',_0x5adb('0x2f'),_0x5adb('0xea'),'mobile',_0x5adb('0x23'),_0x5adb('0x57'),_0x5adb('0x92')]})[_0x5adb('0x1f')](function(_0x332966){if(_0x332966){if(_0x332966['role']==='agent'){_0x5a908f=_0x332966;if(_0x4c2543[_0x5adb('0x52')][_0x5adb('0xa1')]){_0x59f296=util[_0x5adb('0x9f')](_0x5adb('0xeb'),_0x5a908f[_0x4c2543[_0x5adb('0x52')]['interface']]);}else if(_0x4c2543[_0x5adb('0x52')][_0x5adb('0xec')]){_0x59f296=util[_0x5adb('0x9f')](_0x5adb('0xa0'),_0x4c2543[_0x5adb('0x52')]['intrf']);}else{_0x59f296=util['format'](_0x5adb('0xa0'),_0x5a908f['name']);}socket['to'](util['format'](_0x5adb('0xed'),_0x5a908f[_0x5adb('0x2f')]))['emit'](_0x5adb('0xee'),{'user':{'id':_0x5a908f['id'],'name':_0x5a908f['name']},'ip':_0x4c2543[_0x5adb('0xef')][_0x5adb('0xf0')]||_0x4c2543[_0x5adb('0xf1')][_0x5adb('0xf2')]||_0x4c2543[_0x5adb('0xf3')]['remoteAddress']||_0x4c2543[_0x5adb('0xf1')][_0x5adb('0xf3')][_0x5adb('0xf2')]});return db[_0x5adb('0xa2')][_0x5adb('0x21')]({'where':{'membername':_0x5a908f[_0x5adb('0x2f')]},'individualHooks':!![]});}}else{throw new db[(_0x5adb('0x83'))][(_0x5adb('0x84'))](_0x5adb('0xf4'));}})[_0x5adb('0x1f')](function(){if(_0x5a908f){return _0x5a908f[_0x5adb('0xf5')]({'raw':!![]});}})[_0x5adb('0x1f')](function(_0x5a7c61){if(_0x5a908f){if(_0x5a7c61){_0x49af36=_0x5a7c61;if(_0x49af36[_0x5adb('0x43')]){var _0x521788=_0x49af36['map'](function(_0x20cbd3){var _0x3f277a={'membername':_0x5a908f[_0x5adb('0x2f')],'UserId':_0x5a908f['id'],'queue_name':_0x20cbd3[_0x5adb('0x2f')],'VoiceQueueId':_0x20cbd3['id'],'interface':_0x59f296,'paused':_0x5a908f['loginInPause']||![],'penalty':_0x20cbd3[_0x5adb('0xf6')]||0x0};return db[_0x5adb('0xa2')][_0x5adb('0xa3')](_0x3f277a);});return Promise[_0x5adb('0x4a')](_0x521788);}}}})[_0x5adb('0x1f')](function(){if(_0x5a908f){return db[_0x5adb('0xf7')][_0x5adb('0x41')]({'where':{'membername':_0x5a908f['name'],'exitAt':null}});}})['then'](function(_0x2f3e58){if(_0x5a908f){var _0x19da42=[];_0x2f3e58[_0x5adb('0xf8')](function(_0x354da1){_0x19da42[_0x5adb('0x44')](_0x354da1[_0x5adb('0x1e')]({'exitAt':moment()['format'](_0x5adb('0xf9'))}));});return Promise['all'](_0x19da42);}})[_0x5adb('0x1f')](function(){if(_0x5a908f){var _0x52a90b=[];var _0x531d65=[];var _0x477b31=utils['getChannels']();var _0x2e4a18={'membername':_0x5a908f[_0x5adb('0x2f')],'interface':_0x59f296,'enterAt':moment()[_0x5adb('0x9f')](_0x5adb('0xf9')),'role':_0x5a908f[_0x5adb('0x23')],'internal':_0x5a908f[_0x5adb('0x57')]};_0x477b31[_0x5adb('0xf8')](function(_0x9258b8){_0x52a90b['push'](_[_0x5adb('0x4e')]({'channel':_0x9258b8,'type':'LOGIN','data1':_0x4c2543[_0x5adb('0x52')]['device'],'data2':_0x59f296},_0x2e4a18));if(_0x5a908f[_0x5adb('0x92')]){_0x531d65[_0x5adb('0x44')](_[_0x5adb('0x4e')]({'channel':_0x9258b8,'type':'PAUSE','data1':_0x5adb('0xfa')},_0x2e4a18));}});return db[_0x5adb('0xf7')][_0x5adb('0x7c')](_0x52a90b[_0x5adb('0xc1')](_0x531d65),{'individualHooks':!![]});}})[_0x5adb('0x1f')](function(){if(_0x5a908f){return _0x5a908f[_0x5adb('0x1e')]({'online':!![],'lastLoginAt':moment()[_0x5adb('0x9f')](_0x5adb('0xf9')),'voicePause':_0x5a908f['loginInPause']||![],'mailPause':_0x5a908f[_0x5adb('0x92')]||![],'chatPause':_0x5a908f['loginInPause']||![],'faxPause':_0x5a908f['loginInPause']||![],'smsPause':_0x5a908f[_0x5adb('0x92')]||![],'openchannelPause':_0x5a908f['loginInPause']||![],'whatsappPause':_0x5a908f['loginInPause']||![],'pauseType':_0x5a908f['loginInPause']?'LOGININPAUSE':null,'interface':_0x59f296,'lastPauseAt':moment()[_0x5adb('0x9f')](_0x5adb('0xf9'))});}})[_0x5adb('0x1f')](function(_0x5748e5){if(_0x4c2543[_0x5adb('0xfb')]){return _0xd05c71();}else{return Promise[_0x5adb('0xfc')](_0x5748e5)[_0x5adb('0x1f')](respondWithResult(_0x1f13bf,null));}})[_0x5adb('0x4b')](handleError(_0x1f13bf,null));};exports[_0x5adb('0xfd')]=function(_0x1f66f8,_0xea1f6a){var _0xafc0e0;return db[_0x5adb('0x3a')][_0x5adb('0x2c')]({'where':{'id':_0x1f66f8[_0x5adb('0x4c')]['id'],'role':'agent'},'attributes':['id',_0x5adb('0x2f'),_0x5adb('0x23')]})[_0x5adb('0x1f')](handleEntityNotFound(_0xea1f6a,null))[_0x5adb('0x1f')](function(_0x1c78d5){if(_0x1c78d5){_0xafc0e0=_0x1c78d5;return db[_0x5adb('0xa2')][_0x5adb('0x21')]({'where':{'membername':_0xafc0e0[_0x5adb('0x2f')]},'individualHooks':!![]});}})[_0x5adb('0x1f')](function(){return db['MemberReport'][_0x5adb('0x41')]({'where':{'membername':_0xafc0e0['name'],'exitAt':null}});})[_0x5adb('0x1f')](function(_0x8238a4){var _0x32ea02=[];_0x8238a4[_0x5adb('0xf8')](function(_0x33ef30){_0x32ea02['push'](_0x33ef30[_0x5adb('0x1e')]({'exitAt':moment()[_0x5adb('0x9f')](_0x5adb('0xf9'))}));});return Promise[_0x5adb('0x4a')](_0x32ea02);})['then'](function(){return _0xafc0e0['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x5adb('0x1f')](respondWithResult(_0xea1f6a,null))[_0x5adb('0x4b')](handleError(_0xea1f6a,null));};exports[_0x5adb('0xfe')]=function(_0x26dae6,_0x52afe4){var _0x14082b;return db[_0x5adb('0xa2')][_0x5adb('0x1e')]({'paused':0x1},{'where':{'UserId':_0x26dae6[_0x5adb('0x4c')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x5adb('0x3a')]['find']({'where':{'id':_0x26dae6['params']['id'],'role':'agent'},'attributes':['id',_0x5adb('0x2f'),_0x5adb('0x23'),_0x5adb('0x57'),_0x5adb('0xa1'),'online']});})[_0x5adb('0x1f')](handleEntityNotFound(_0x52afe4,null))[_0x5adb('0x1f')](function(_0x10e73c){if(_0x10e73c){_0x14082b=_0x10e73c;return db[_0x5adb('0xf7')][_0x5adb('0x41')]({'where':{'membername':_0x14082b[_0x5adb('0x2f')],'type':'PAUSE','exitAt':null}});}})[_0x5adb('0x1f')](function(_0x367de1){if(_0x367de1['length']){var _0x143674=moment()[_0x5adb('0x9f')](_0x5adb('0xf9'));for(var _0x56699a=0x0,_0x608aa1=_0x367de1[_0x5adb('0x43')];_0x56699a<_0x608aa1;_0x56699a++){_0x367de1[_0x56699a][_0x5adb('0xff')]({'exitAt':_0x143674});}}})['then'](function(){var _0x578cb9=[];var _0x5b91ff=utils['getChannels']();_0x5b91ff[_0x5adb('0xf8')](function(_0x17772f){_0x578cb9[_0x5adb('0x44')]({'channel':_0x17772f,'membername':_0x14082b[_0x5adb('0x2f')],'interface':_[_0x5adb('0x5d')](_0x14082b[_0x5adb('0xa1')])?util['format'](_0x5adb('0xa0'),_0x14082b[_0x5adb('0x2f')]):_0x14082b[_0x5adb('0xa1')],'type':'PAUSE','enterAt':moment()[_0x5adb('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x26dae6['body'][_0x5adb('0x100')]||'DEFAULT\x20PAUSE','role':_0x14082b['role'],'internal':_0x14082b[_0x5adb('0x57')]});});return db[_0x5adb('0xf7')][_0x5adb('0x7c')](_0x578cb9,{'individualHooks':!![]});})[_0x5adb('0x1f')](function(){return _0x14082b[_0x5adb('0x1e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x26dae6[_0x5adb('0x52')]['type']||_0x5adb('0x101'),'lastPauseAt':moment()[_0x5adb('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5adb('0x1f')](respondWithResult(_0x52afe4,null))[_0x5adb('0x4b')](handleError(_0x52afe4,null));};exports[_0x5adb('0x102')]=function(_0x1457e0,_0x2937f4){if(_0x1457e0[_0x5adb('0x52')][_0x5adb('0x91')]&&!utils[_0x5adb('0xa5')](_0x1457e0[_0x5adb('0x52')]['channel'])){throw new APIBadRequestError(util[_0x5adb('0x9f')](_0x5adb('0x103'),_0x1457e0[_0x5adb('0x52')]['channel']));}return db[_0x5adb('0x3a')]['find']({'where':{'id':_0x1457e0[_0x5adb('0x4c')]['id']},'attributes':['id',_0x5adb('0x2f'),'role',_0x5adb('0x57'),_0x5adb('0xa1'),'online',_0x5adb('0x93'),_0x5adb('0x104'),_0x5adb('0x105'),_0x5adb('0x106'),'openchannelPause',_0x5adb('0x107'),_0x5adb('0x108'),_0x5adb('0x109'),_0x5adb('0x10a')]})['then'](function(_0x184906){if(!_0x184906){throw new APINotFoundError(util[_0x5adb('0x9f')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1457e0[_0x5adb('0x4c')]['id']));}return _0x184906[_0x5adb('0x102')](_0x1457e0[_0x5adb('0x52')][_0x5adb('0x91')]);})['then'](respondWithResult(_0x2937f4,null))[_0x5adb('0x4b')](APIHandleError(_0x2937f4));};exports[_0x5adb('0x10b')]=function(_0x6b8d2b,_0x3afa9b){var _0x459d52={};var _0x529cf9={};var _0x5f43af;var _0x10200d;return db['User'][_0x5adb('0x8b')]({'where':{'id':_0x6b8d2b[_0x5adb('0x4c')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x3afa9b,null))[_0x5adb('0x1f')](function(_0x2db3fe){if(_0x2db3fe){_0x5f43af=_0x2db3fe;_0x529cf9['model']=_['keys'](db[_0x5adb('0x10c')][_0x5adb('0x31')]);_0x529cf9[_0x5adb('0x3b')]=_['keys'](_0x6b8d2b[_0x5adb('0x3b')]);_0x529cf9['filters']=_[_0x5adb('0xce')](_0x529cf9['model'],_0x529cf9[_0x5adb('0x3b')]);_0x459d52[_0x5adb('0x40')]=_[_0x5adb('0xce')](_0x529cf9[_0x5adb('0xcf')],qs[_0x5adb('0xd0')](_0x6b8d2b['query'][_0x5adb('0xd0')]));_0x459d52[_0x5adb('0x40')]=_0x459d52[_0x5adb('0x40')][_0x5adb('0x43')]?_0x459d52[_0x5adb('0x40')]:_0x529cf9[_0x5adb('0xcf')];_0x459d52[_0x5adb('0xd7')]=qs[_0x5adb('0xd1')](_0x6b8d2b[_0x5adb('0x3b')]['sort']);_0x459d52[_0x5adb('0xd2')]=qs['filters'](_[_0x5adb('0xd3')](_0x6b8d2b[_0x5adb('0x3b')],_0x529cf9[_0x5adb('0xcd')]));if(_0x6b8d2b['query'][_0x5adb('0x34')]){_0x459d52[_0x5adb('0xd2')]=_['merge'](_0x459d52[_0x5adb('0xd2')],{'$or':_[_0x5adb('0x29')](_0x459d52[_0x5adb('0x40')],function(_0x3f50ba){var _0x46e5fd={};_0x46e5fd[_0x3f50ba]={'$like':'%'+_0x6b8d2b['query'][_0x5adb('0x34')]+'%'};return _0x46e5fd;})});}_0x459d52=_[_0x5adb('0x4e')]({},_0x459d52,_0x6b8d2b[_0x5adb('0x4f')]);return _0x5f43af[_0x5adb('0x10b')](_0x459d52);}})[_0x5adb('0x1f')](function(_0x262632){if(_0x262632){_0x10200d=_0x262632['length'];if(!_0x6b8d2b[_0x5adb('0x3b')][_0x5adb('0xc4')](_0x5adb('0xd5'))){_0x459d52[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x6b8d2b[_0x5adb('0x3b')]['limit']);_0x459d52[_0x5adb('0x19')]=qs[_0x5adb('0x19')](_0x6b8d2b['query'][_0x5adb('0x19')]);}return _0x5f43af[_0x5adb('0x10b')](_0x459d52);}})[_0x5adb('0x1f')](function(_0x4817e1){if(_0x4817e1){return _0x4817e1?{'count':_0x10200d,'rows':_0x4817e1}:null;}})['then'](respondWithResult(_0x3afa9b,null))[_0x5adb('0x4b')](handleError(_0x3afa9b,null));};exports['addTeams']=function(_0x5ebf2d,_0x648abf){var _0x447cc4=_0x5ebf2d['params']['id'];var _0x1e70e3=_0x5ebf2d['body']?_0x5ebf2d[_0x5adb('0x52')]['ids']:null;var _0x2ed021=[];return Promise[_0x5adb('0xfc')]()[_0x5adb('0x1f')](function(){if(!_0x1e70e3)throw new APIBadRequestError(_0x5adb('0x10d'));})[_0x5adb('0x1f')](function(){return db[_0x5adb('0x3a')][_0x5adb('0x8b')]({'where':{'id':_0x447cc4}});})[_0x5adb('0x1f')](function(_0x21b7db){if(!_0x21b7db)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x5ebf2d[_0x5adb('0x4c')]['id']));return db[_0x5adb('0x60')]['transaction'](function(_0x2be05a){return _0x21b7db[_0x5adb('0x10e')](_0x1e70e3,{'transaction':_0x2be05a})[_0x5adb('0x1f')](function(){return db[_0x5adb('0x10c')]['findAll']({'where':{'id':{'$in':_0x1e70e3}}});})[_0x5adb('0x1f')](function(_0x432066){var _0x34b459=_['map'](_0x432066,function(_0x1ecaa5){return _0x1ecaa5['getAssociatedQueues']();});return Promise[_0x5adb('0x4a')](_0x34b459);})[_0x5adb('0x1f')](function(_0x3a7e73){_0x2ed021=_['flattenDeep'](_0x3a7e73);var _0x2eedbc=_[_0x5adb('0x29')](_0x2ed021,function(_0x19cc18){return _0x19cc18[_0x5adb('0x10f')](_0x21b7db['id'],{'transaction':_0x2be05a});});return Promise[_0x5adb('0x4a')](_0x2eedbc);})[_0x5adb('0x1f')](function(){if(!_0x21b7db[_0x5adb('0x9e')])return;var _0x1012a7=_['filter'](_0x2ed021,function(_0x5b5346){return _0x5b5346[_0x5adb('0x110')](_0x5adb('0x91'))==='Voice';});var _0x3ecedc=_['map'](_0x1012a7,function(_0x43683e){return db[_0x5adb('0xa2')][_0x5adb('0xa3')]({'membername':_0x21b7db['name'],'UserId':_0x21b7db['id'],'queue_name':_0x43683e[_0x5adb('0x2f')],'VoiceQueueId':_0x43683e['id'],'interface':_['isNil'](_0x21b7db[_0x5adb('0xa1')])?util[_0x5adb('0x9f')]('SIP/%s',_0x21b7db['name']):_0x21b7db[_0x5adb('0xa1')],'paused':_0x21b7db[_0x5adb('0x93')]||![],'penalty':_0x21b7db[_0x5adb('0x98')]},{'transaction':_0x2be05a});});return Promise['all'](_0x3ecedc);})[_0x5adb('0x1f')](function(){return db[_0x5adb('0x111')][_0x5adb('0x41')]({'where':{'teamId':{'$in':_0x1e70e3}}});})[_0x5adb('0x1f')](function(_0x5d3ea2){var _0x2296e8=_[_0x5adb('0x29')](_0x5d3ea2,function(_0x22a566){return db[_0x5adb('0x112')][_0x5adb('0x71')]({'UserId':_0x21b7db['id'],'VoicePrefixId':_0x22a566['VoicePrefixId']},{'transaction':_0x2be05a});});return Promise[_0x5adb('0x4a')](_0x2296e8);});});})[_0x5adb('0x1f')](function(){for(var _0x291f54=0x0;_0x291f54<_0x2ed021[_0x5adb('0x43')];_0x291f54++){var _0x1fc49f=_0x2ed021[_0x291f54][_0x5adb('0x110')](_0x5adb('0x91'));var _0x58109d=_0x1fc49f+'QueueId';socket[_0x5adb('0x9b')](_0x5adb('0x25')+_0x1fc49f+_0x5adb('0x113'),{'UserId':_0x447cc4,['queueField']:_0x2ed021[_0x291f54]['id']});}})[_0x5adb('0x1f')](respondWithStatusCode(_0x648abf,null))['catch'](APIHandleError(_0x648abf));};exports[_0x5adb('0x114')]=function(_0x53251a,_0x1c3b4a){var _0x43349e=_0x53251a['params']['id'];var _0x152162=null;if(_0x53251a[_0x5adb('0x3b')]['ids']){_0x152162=_['isArray'](_0x53251a[_0x5adb('0x3b')]['ids'])?_0x53251a[_0x5adb('0x3b')][_0x5adb('0x55')]:[_0x53251a['query'][_0x5adb('0x55')]];}var _0x30f613=[];return Promise['resolve']()[_0x5adb('0x1f')](function(){if(!_0x152162)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x5adb('0x1f')](function(){return db[_0x5adb('0x3a')][_0x5adb('0x8b')]({'where':{'id':_0x43349e}});})[_0x5adb('0x1f')](function(_0xec37cc){if(!_0xec37cc)throw new APINotFoundError(util[_0x5adb('0x9f')]('User\x20with\x20id\x20%s\x20not\x20found',_0x53251a['params']['id']));return db[_0x5adb('0x60')]['transaction'](function(_0x2ed43d){return _0xec37cc[_0x5adb('0x114')](_0x152162,{'transaction':_0x2ed43d})['then'](function(){return db[_0x5adb('0x10c')]['findAll']({'where':{'id':{'$in':_0x152162}}});})[_0x5adb('0x1f')](function(_0xd7c1c){var _0x20fca2=_[_0x5adb('0x29')](_0xd7c1c,function(_0xe0c7cc){return _0xe0c7cc[_0x5adb('0x115')]();});return Promise['all'](_0x20fca2);})[_0x5adb('0x1f')](function(_0x319570){_0x30f613=_[_0x5adb('0x116')](_0x319570);var _0x38936=_['map'](_0x30f613,function(_0xe6b84b){return _0xe6b84b[_0x5adb('0x117')](_0xec37cc['id'],{'transaction':_0x2ed43d});});return Promise['all'](_0x38936);})['then'](function(){if(!_0xec37cc['online'])return;var _0x246810=_[_0x5adb('0x34')](_0x30f613,function(_0x1c194b){return _0x1c194b[_0x5adb('0x110')](_0x5adb('0x91'))===_0x5adb('0x118');});var _0x41dab4=_[_0x5adb('0x29')](_0x246810,function(_0x10a131){return db['UserVoiceQueueRt'][_0x5adb('0x21')]({'where':{'VoiceQueueId':_0x10a131['id'],'UserId':_0xec37cc['id']},'transaction':_0x2ed43d});});return Promise['all'](_0x41dab4);})[_0x5adb('0x1f')](function(){return db['TeamVoicePrefix'][_0x5adb('0x41')]({'where':{'teamId':{'$in':_0x152162}}});})['then'](function(_0x4fc3dc){var _0x4c2cb9=_['map'](_0x4fc3dc,function(_0x26cec1){return db[_0x5adb('0x112')]['destroy']({'where':{'UserId':_0xec37cc['id'],'VoicePrefixId':_0x26cec1[_0x5adb('0x119')]}},{'transaction':_0x2ed43d});});return Promise[_0x5adb('0x4a')](_0x4c2cb9);});});})['then'](function(){for(var _0x5d9562=0x0;_0x5d9562<_0x30f613[_0x5adb('0x43')];_0x5d9562++){var _0x3cd6cf=_0x30f613[_0x5d9562][_0x5adb('0x110')](_0x5adb('0x91'));var _0x5a81e0=_0x3cd6cf+_0x5adb('0x9a');socket[_0x5adb('0x9b')](_0x5adb('0x25')+_0x3cd6cf+_0x5adb('0xa9'),{'UserId':_0x43349e,['queueField']:_0x30f613[_0x5d9562]['id']});}})[_0x5adb('0x1f')](respondWithStatusCode(_0x1c3b4a,null))['catch'](APIHandleError(_0x1c3b4a));};exports['getLists']=function(_0x37fccb,_0x11607e){var _0xf3a6d={};var _0x32b724={};var _0x2262cd;var _0x526ad3;return db[_0x5adb('0x3a')]['findOne']({'where':{'id':_0x37fccb[_0x5adb('0x4c')]['id']}})[_0x5adb('0x1f')](handleEntityNotFound(_0x11607e,null))['then'](function(_0x484313){if(_0x484313){_0x2262cd=_0x484313;_0x32b724[_0x5adb('0xcf')]=_[_0x5adb('0xcb')](db[_0x5adb('0xc5')][_0x5adb('0x31')]);_0x32b724[_0x5adb('0x3b')]=_[_0x5adb('0xcb')](_0x37fccb[_0x5adb('0x3b')]);_0x32b724[_0x5adb('0xcd')]=_[_0x5adb('0xce')](_0x32b724[_0x5adb('0xcf')],_0x32b724[_0x5adb('0x3b')]);_0xf3a6d[_0x5adb('0x40')]=_['intersection'](_0x32b724['model'],qs['fields'](_0x37fccb[_0x5adb('0x3b')][_0x5adb('0xd0')]));_0xf3a6d[_0x5adb('0x40')]=_0xf3a6d['attributes'][_0x5adb('0x43')]?_0xf3a6d['attributes']:_0x32b724['model'];_0xf3a6d[_0x5adb('0xd7')]=qs[_0x5adb('0xd1')](_0x37fccb[_0x5adb('0x3b')]['sort']);_0xf3a6d[_0x5adb('0xd2')]=qs[_0x5adb('0xcd')](_[_0x5adb('0xd3')](_0x37fccb[_0x5adb('0x3b')],_0x32b724[_0x5adb('0xcd')]));if(_0x37fccb['query'][_0x5adb('0x34')]){_0xf3a6d['where']=_[_0x5adb('0x4e')](_0xf3a6d[_0x5adb('0xd2')],{'$or':_[_0x5adb('0x29')](_0xf3a6d[_0x5adb('0x40')],function(_0x3d631f){var _0x324fdd={};_0x324fdd[_0x3d631f]={'$like':'%'+_0x37fccb[_0x5adb('0x3b')]['filter']+'%'};return _0x324fdd;})});}_0xf3a6d=_[_0x5adb('0x4e')]({},_0xf3a6d,_0x37fccb['options']);return _0x2262cd['getLists'](_0xf3a6d);}})[_0x5adb('0x1f')](function(_0x25645f){if(_0x25645f){_0x526ad3=_0x25645f['length'];if(!_0x37fccb['query']['hasOwnProperty']('nolimit')){_0xf3a6d[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x37fccb['query'][_0x5adb('0x1b')]);_0xf3a6d['offset']=qs[_0x5adb('0x19')](_0x37fccb['query']['offset']);}return _0x2262cd[_0x5adb('0x11a')](_0xf3a6d);}})['then'](function(_0x5b6b66){if(_0x5b6b66){return _0x5b6b66?{'count':_0x526ad3,'rows':_0x5b6b66}:null;}})[_0x5adb('0x1f')](respondWithResult(_0x11607e,null))['catch'](handleError(_0x11607e,null));};exports[_0x5adb('0x11b')]=function(_0x299649,_0x5f1d16){var _0x3940dc={};var _0x27aa4a={};var _0x44fe5a;return db[_0x5adb('0x3a')][_0x5adb('0x8b')]({'where':{'id':_0x299649[_0x5adb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5f1d16,null))['then'](function(_0x42a55a){if(_0x42a55a){_0x44fe5a=_0x42a55a;_0x27aa4a[_0x5adb('0xcf')]=_[_0x5adb('0xcb')](db['User'][_0x5adb('0x31')]);_0x27aa4a[_0x5adb('0x3b')]=_['keys'](_0x299649[_0x5adb('0x3b')]);_0x27aa4a[_0x5adb('0xcd')]=_[_0x5adb('0xce')](_0x27aa4a[_0x5adb('0xcf')],_0x27aa4a['query']);_0x3940dc['attributes']=_[_0x5adb('0xce')](_0x27aa4a[_0x5adb('0xcf')],qs['fields'](_0x299649['query'][_0x5adb('0xd0')]));_0x3940dc[_0x5adb('0x40')]=_0x3940dc[_0x5adb('0x40')][_0x5adb('0x43')]?_0x3940dc[_0x5adb('0x40')]:_0x27aa4a[_0x5adb('0xcf')];_0x3940dc[_0x5adb('0xd7')]=qs['sort'](_0x299649[_0x5adb('0x3b')]['sort']);_0x3940dc['where']=qs['filters'](_[_0x5adb('0xd3')](_0x299649['query'],_0x27aa4a[_0x5adb('0xcd')]));if(_0x299649[_0x5adb('0x3b')][_0x5adb('0x34')]){_0x3940dc[_0x5adb('0xd2')]=_[_0x5adb('0x4e')](_0x3940dc['where'],{'$or':_[_0x5adb('0x29')](_0x3940dc[_0x5adb('0x40')],function(_0xf441fa){var _0xecc16b={};_0xecc16b[_0xf441fa]={'$like':'%'+_0x299649[_0x5adb('0x3b')]['filter']+'%'};return _0xecc16b;})});}_0x3940dc[_0x5adb('0xcf')]=db['User'];_0x3940dc['as']=_0x5adb('0x26');_0x3940dc=_[_0x5adb('0x4e')]({},_0x3940dc,_0x299649[_0x5adb('0x4f')]);return _0x44fe5a[_0x5adb('0xf5')]({'include':[_0x3940dc]});}})[_0x5adb('0x1f')](function(_0x282177){if(_0x282177){var _0x1d60d5={},_0x14dcb5=[];for(var _0x103e3a=0x0;_0x103e3a<_0x282177[_0x5adb('0x43')];_0x103e3a+=0x1){for(var _0x2add2d=0x0,_0xe5ced9;_0x2add2d<_0x282177[_0x103e3a]['Agents'][_0x5adb('0x43')];_0x2add2d+=0x1){_0xe5ced9=_0x282177[_0x103e3a]['Agents'][_0x2add2d][_0x5adb('0x22')]({'plain':!![]});_0x1d60d5[_0xe5ced9['id']]=_0xe5ced9;}}_0x1d60d5=_['values'](_0x1d60d5);for(var _0x46be5d=qs[_0x5adb('0x19')](_0x299649['query'][_0x5adb('0x19')]);_0x46be5d<_0x1d60d5['length']&&_0x14dcb5[_0x5adb('0x43')]=_0x316ea1[_0xa49a('0x4f')]){throw new Error(_0xa49a('0x50'));}})[_0xa49a('0x26')](function(){if(_0x3b12a6){return db['UserVoiceQueueRt'][_0xa49a('0x47')]({'where':{'membername':_0x3b12a6[_0xa49a('0x2a')]},'individualHooks':!![]});}})[_0xa49a('0x26')](function(){if(_0x3b12a6){return _0x3b12a6[_0xa49a('0x51')]({'raw':!![]});}})[_0xa49a('0x26')](function(_0x49e529){if(_0x3b12a6){if(_0x49e529){var _0x45a9c6=[];_0xc376cd=_0x49e529;if(_0xc376cd[_0xa49a('0x2d')]){for(var _0x39221f=0x0;_0x39221f<_0xc376cd[_0xa49a('0x2d')];_0x39221f++){_0x45a9c6[_0xa49a('0x31')](db[_0xa49a('0x46')]['upsert']({'membername':_0x3b12a6[_0xa49a('0x2a')],'UserId':_0x3b12a6['id'],'queue_name':_0xc376cd[_0x39221f]['name'],'VoiceQueueId':_0xc376cd[_0x39221f]['id'],'interface':_0x199beb,'paused':_0x3b12a6['loginInPause']||![],'penalty':_0xc376cd[_0x39221f][_0xa49a('0x52')]||0x0}));}return BPromise[_0xa49a('0x48')](_0x45a9c6);}}}})[_0xa49a('0x26')](function(){if(_0x3b12a6){return db[_0xa49a('0x34')][_0xa49a('0x11')]({'where':{'membername':_0x3b12a6[_0xa49a('0x2a')],'exitAt':null}});}})['then'](function(_0x14352c){if(_0x3b12a6){if(_0x14352c&&_0x14352c['length']){var _0x5c5c5a=[];_0x14352c['forEach'](function(_0x5b0104){_0x5c5c5a['push'](_0x5b0104[_0xa49a('0x29')]({'exitAt':moment()[_0xa49a('0x27')](_0xa49a('0x2c'))}));});return BPromise[_0xa49a('0x48')](_0x5c5c5a);}}})[_0xa49a('0x26')](function(){if(_0x3b12a6){var _0x1c19bf=[];var _0x5d3019=[];var _0x307770=utils[_0xa49a('0x2f')]();var _0x11c376={'membername':_0x3b12a6[_0xa49a('0x2a')],'interface':_0x199beb,'enterAt':moment()['format'](_0xa49a('0x2c')),'role':_0x3b12a6[_0xa49a('0x23')],'internal':_0x3b12a6[_0xa49a('0x24')]};_0x307770[_0xa49a('0x30')](function(_0x3e3c2f){_0x1c19bf[_0xa49a('0x31')](_[_0xa49a('0x53')]({'channel':_0x3e3c2f,'type':_0xa49a('0x54'),'data1':'callysquare','data2':_0x199beb},_0x11c376));if(_0x3b12a6[_0xa49a('0x4b')]){_0x5d3019[_0xa49a('0x31')](_[_0xa49a('0x53')]({'channel':_0x3e3c2f,'type':_0xa49a('0x2b'),'data1':'LOGININPAUSE'},_0x11c376));}});return db['MemberReport'][_0xa49a('0x35')](_0x1c19bf[_0xa49a('0x55')](_0x5d3019),{'individualHooks':!![]});}})[_0xa49a('0x26')](function(){if(_0x3b12a6){return _0x3b12a6[_0xa49a('0x29')]({'online':!![],'lastLoginAt':moment()['format'](_0xa49a('0x2c')),'voicePause':_0x3b12a6[_0xa49a('0x4b')]||![],'mailPause':_0x3b12a6[_0xa49a('0x4b')]||![],'chatPause':_0x3b12a6[_0xa49a('0x4b')]||![],'faxPause':_0x3b12a6[_0xa49a('0x4b')]||![],'smsPause':_0x3b12a6[_0xa49a('0x4b')]||![],'openchannelPause':_0x3b12a6[_0xa49a('0x4b')]||![],'pauseType':_0x3b12a6[_0xa49a('0x4b')]?_0xa49a('0x56'):null,'lastPauseAt':moment()['format'](_0xa49a('0x2c')),'interface':_0x199beb});}})[_0xa49a('0x26')](function(_0x21f3f7){_0x522b81(_0x21f3f7);})[_0xa49a('0x1b')](function(_0xfaa6bb){_0x59aa6a(_0x17c927[_0xa49a('0x21')](0x1f4,_0xfaa6bb['message']));});});}; \ No newline at end of file +var _0x7ef2=['message','error','find','raw','ShowUser','catch','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','isNil','SIP/%s','body','type','uniqueid','DEFAULT\x20PAUSE','resolve','channel','findOne','online','voicePause','mailPause','faxPause','smsPause','whatsappPause','lastPauseAt','unpause','system','LogoutUser','forEach','push','all','LoginUser','mobile','phone','loginInPause','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGININPAUSE','bulkCreate','concat','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','register','GetUser','User','findAll','options','where','attributes','limit','include','map','model','then','info','debug','stringify'];(function(_0x48683f,_0x3cd4d5){var _0x2e0ea7=function(_0x131e68){while(--_0x131e68){_0x48683f['push'](_0x48683f['shift']());}};_0x2e0ea7(++_0x3cd4d5);}(_0x7ef2,0x1e5));var _0x27ef=function(_0x30953f,_0x3667e7){_0x30953f=_0x30953f-0x0;var _0x436d2d=_0x7ef2[_0x30953f];return _0x436d2d;};'use strict';var _=require(_0x27ef('0x0'));var util=require('util');var moment=require(_0x27ef('0x1'));var BPromise=require(_0x27ef('0x2'));var Redis=require(_0x27ef('0x3'));var db=require(_0x27ef('0x4'))['db'];var utils=require(_0x27ef('0x5'));var logger=require(_0x27ef('0x6'))('rpc');var config=require(_0x27ef('0x7'));config[_0x27ef('0x8')]=_[_0x27ef('0x9')](config[_0x27ef('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0x27ef('0xa')](socket);exports[_0x27ef('0xb')]=function(_0x2399d0){var _0xd45c50=this;return new Promise(function(_0x24eec1,_0x40e6f9){return db[_0x27ef('0xc')][_0x27ef('0xd')]({'raw':_0x2399d0['options']?_0x2399d0[_0x27ef('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x2399d0[_0x27ef('0xe')]?_0x2399d0['options'][_0x27ef('0xf')]||null:null,'attributes':_0x2399d0[_0x27ef('0xe')]?_0x2399d0['options'][_0x27ef('0x10')]||null:null,'limit':_0x2399d0[_0x27ef('0xe')]?_0x2399d0[_0x27ef('0xe')][_0x27ef('0x11')]||null:null,'include':_0x2399d0[_0x27ef('0xe')]?_0x2399d0[_0x27ef('0xe')][_0x27ef('0x12')]?_[_0x27ef('0x13')](_0x2399d0[_0x27ef('0xe')][_0x27ef('0x12')],function(_0x364121){return{'model':db[_0x364121[_0x27ef('0x14')]],'as':_0x364121['as'],'attributes':_0x364121['attributes'],'include':_0x364121[_0x27ef('0x12')]?_['map'](_0x364121[_0x27ef('0x12')],function(_0x2544c5){return{'model':db[_0x2544c5[_0x27ef('0x14')]],'as':_0x2544c5['as'],'attributes':_0x2544c5['attributes'],'include':_0x2544c5[_0x27ef('0x12')]?_[_0x27ef('0x13')](_0x2544c5[_0x27ef('0x12')],function(_0x5945a2){return{'model':db[_0x5945a2[_0x27ef('0x14')]],'as':_0x5945a2['as'],'attributes':_0x5945a2[_0x27ef('0x10')]};}):[]};}):[]};}):[]:[]})[_0x27ef('0x15')](function(_0x4caebe){logger[_0x27ef('0x16')]('GetUser',_0x2399d0);logger[_0x27ef('0x17')](_0x27ef('0xb'),_0x2399d0,JSON[_0x27ef('0x18')](_0x4caebe));_0x24eec1(_0x4caebe);})['catch'](function(_0x5127cc){logger['error']('GetUser',_0x5127cc[_0x27ef('0x19')],_0x2399d0);_0x40e6f9(_0xd45c50[_0x27ef('0x1a')](0x1f4,_0x5127cc[_0x27ef('0x19')]));});});};exports['ShowUser']=function(_0x1c4698){var _0x1e6017=this;return new Promise(function(_0x52fd62,_0x4ec5ee){return db[_0x27ef('0xc')][_0x27ef('0x1b')]({'raw':_0x1c4698['options']?_0x1c4698[_0x27ef('0xe')][_0x27ef('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c4698['options']?_0x1c4698[_0x27ef('0xe')][_0x27ef('0xf')]||null:null,'attributes':_0x1c4698[_0x27ef('0xe')]?_0x1c4698['options'][_0x27ef('0x10')]||null:null,'include':_0x1c4698[_0x27ef('0xe')]?_0x1c4698[_0x27ef('0xe')]['include']?_['map'](_0x1c4698[_0x27ef('0xe')]['include'],function(_0x444316){return{'model':db[_0x444316[_0x27ef('0x14')]],'as':_0x444316['as'],'attributes':_0x444316[_0x27ef('0x10')],'include':_0x444316[_0x27ef('0x12')]?_[_0x27ef('0x13')](_0x444316['include'],function(_0x3f7632){return{'model':db[_0x3f7632[_0x27ef('0x14')]],'as':_0x3f7632['as'],'attributes':_0x3f7632[_0x27ef('0x10')],'include':_0x3f7632[_0x27ef('0x12')]?_[_0x27ef('0x13')](_0x3f7632[_0x27ef('0x12')],function(_0x2c570e){return{'model':db[_0x2c570e[_0x27ef('0x14')]],'as':_0x2c570e['as'],'attributes':_0x2c570e[_0x27ef('0x10')]};}):[]};}):[]};}):[]:[]})[_0x27ef('0x15')](function(_0x201de5){logger[_0x27ef('0x16')](_0x27ef('0x1d'),_0x1c4698);logger['debug']('ShowUser',_0x1c4698,JSON[_0x27ef('0x18')](_0x201de5));_0x52fd62(_0x201de5);})[_0x27ef('0x1e')](function(_0x2462f4){logger[_0x27ef('0x1a')](_0x27ef('0x1d'),_0x2462f4['message'],_0x1c4698);_0x4ec5ee(_0x1e6017['error'](0x1f4,_0x2462f4[_0x27ef('0x19')]));});});};exports['PauseUser']=function(_0x246c6f){var _0x41e3b6;return db[_0x27ef('0xc')]['find']({'where':_0x246c6f[_0x27ef('0xe')][_0x27ef('0xf')]||{},'attributes':['id','name',_0x27ef('0x1f'),_0x27ef('0x20'),_0x27ef('0x21')]})['then'](function(_0x44e962){if(!_0x44e962){throw new Error(util[_0x27ef('0x22')](_0x27ef('0x23'),_0x246c6f[_0x27ef('0x24')]['id']));}_0x41e3b6=_0x44e962;return db[_0x27ef('0x25')][_0x27ef('0x26')]({'paused':0x1},{'where':{'UserId':_0x41e3b6['id']},'individualHooks':!![]});})[_0x27ef('0x15')](function(){return db[_0x27ef('0x27')][_0x27ef('0xd')]({'where':{'membername':_0x41e3b6[_0x27ef('0x28')],'type':_0x27ef('0x29'),'exitAt':null}});})[_0x27ef('0x15')](function(_0x2617ee){if(_0x2617ee&&_0x2617ee[_0x27ef('0x2a')]){var _0x19e2db=moment()['format'](_0x27ef('0x2b'));for(var _0x56ec84=0x0,_0x24567e=_0x2617ee['length'];_0x56ec84<_0x24567e;_0x56ec84++){_0x2617ee[_0x56ec84][_0x27ef('0x2c')]({'exitAt':_0x19e2db});}}})[_0x27ef('0x15')](function(){var _0x2b3ab5=[];var _0x423c7b=utils[_0x27ef('0x2d')]();_0x423c7b['forEach'](function(_0x591c28){_0x2b3ab5['push']({'channel':_0x591c28,'membername':_0x41e3b6[_0x27ef('0x28')],'interface':_[_0x27ef('0x2e')](_0x41e3b6[_0x27ef('0x21')])?util[_0x27ef('0x22')](_0x27ef('0x2f'),_0x41e3b6[_0x27ef('0x28')]):_0x41e3b6['interface'],'type':_0x27ef('0x29'),'enterAt':moment()[_0x27ef('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x246c6f[_0x27ef('0x30')][_0x27ef('0x31')]||'DEFAULT\x20PAUSE','role':_0x41e3b6[_0x27ef('0x1f')],'internal':_0x41e3b6[_0x27ef('0x20')],'uniqueid':_0x246c6f[_0x27ef('0x30')][_0x27ef('0x32')]||null});});return db[_0x27ef('0x27')]['bulkCreate'](_0x2b3ab5,{'individualHooks':!![]});})['then'](function(){return _0x41e3b6[_0x27ef('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x246c6f[_0x27ef('0x30')][_0x27ef('0x31')]||_0x27ef('0x33'),'lastPauseAt':moment()[_0x27ef('0x22')](_0x27ef('0x2b'))});})[_0x27ef('0x1e')](function(_0x2c1092){throw _0x2c1092;});};exports['UnpauseUser']=function(_0x122909){return Promise[_0x27ef('0x34')]()[_0x27ef('0x15')](function(){if(_0x122909[_0x27ef('0x30')][_0x27ef('0x35')]&&!utils['isValidChannel'](_0x122909[_0x27ef('0x30')][_0x27ef('0x35')])){throw new Error(util[_0x27ef('0x22')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x122909['body'][_0x27ef('0x35')]));}return db[_0x27ef('0xc')][_0x27ef('0x36')]({'where':_0x122909[_0x27ef('0xe')][_0x27ef('0xf')]||{},'attributes':['id',_0x27ef('0x28'),_0x27ef('0x1f'),'internal',_0x27ef('0x21'),_0x27ef('0x37'),_0x27ef('0x38'),_0x27ef('0x39'),'chatPause',_0x27ef('0x3a'),'openchannelPause',_0x27ef('0x3b'),_0x27ef('0x3c'),'pauseType',_0x27ef('0x3d')]});})[_0x27ef('0x15')](function(_0x3d410d){if(!_0x3d410d){throw new Error(util['format'](_0x27ef('0x23'),_0x122909[_0x27ef('0x24')]['id']));}return _0x3d410d[_0x27ef('0x3e')](_0x122909['body'][_0x27ef('0x35')],_0x27ef('0x3f'));})['catch'](function(_0xdc774e){throw _0xdc774e;});};exports[_0x27ef('0x40')]=function(_0x5a7464){var _0x504e53=this;return new Promise(function(_0x33f9ed,_0x65d0ef){var _0x31d5f2;return db[_0x27ef('0xc')]['findOne']({'where':_0x5a7464[_0x27ef('0xe')][_0x27ef('0xf')]||{},'attributes':['id',_0x27ef('0x28')]})['then'](function(_0x4f9268){if(_0x4f9268){_0x31d5f2=_0x4f9268;return db[_0x27ef('0x25')]['destroy']({'where':{'membername':_0x31d5f2[_0x27ef('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x31d5f2){return db['MemberReport'][_0x27ef('0xd')]({'where':{'membername':_0x31d5f2[_0x27ef('0x28')],'exitAt':null}});}})[_0x27ef('0x15')](function(_0x5daed5){if(_0x31d5f2){if(_0x5daed5&&_0x5daed5[_0x27ef('0x2a')]){var _0x5d2101=[];_0x5daed5[_0x27ef('0x41')](function(_0x2b3421){_0x5d2101[_0x27ef('0x42')](_0x2b3421['update']({'exitAt':moment()[_0x27ef('0x22')](_0x27ef('0x2b'))}));});return BPromise[_0x27ef('0x43')](_0x5d2101);}}})[_0x27ef('0x15')](function(){if(_0x31d5f2){return _0x31d5f2['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x27ef('0x15')](function(_0x347113){_0x33f9ed(_0x347113);})[_0x27ef('0x1e')](function(_0x2a04ab){_0x65d0ef(_0x504e53[_0x27ef('0x1a')](0x1f4,_0x2a04ab[_0x27ef('0x19')]));});});};exports[_0x27ef('0x44')]=function(_0x41a9d4){var _0x2baba8=this;return new Promise(function(_0x662942,_0x475ff2){var _0x25a682;var _0x56bc37;var _0x142a6a;var _0x2d37c9;return db['User'][_0x27ef('0x36')]({'where':_0x41a9d4[_0x27ef('0xe')]['where']||{},'attributes':['id',_0x27ef('0x28'),_0x27ef('0x1f'),_0x27ef('0x45'),_0x27ef('0x46'),'internal',_0x27ef('0x47'),_0x27ef('0x21')]})[_0x27ef('0x15')](function(_0x231ccf){if(_0x231ccf){_0x25a682=_0x231ccf;_0x2d37c9=_0x41a9d4[_0x27ef('0x30')]['interface']?_0x41a9d4['body'][_0x27ef('0x21')]:util[_0x27ef('0x22')]('SIP/%s',_0x25a682[_0x27ef('0x28')]);return db[_0x27ef('0xc')][_0x27ef('0x48')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x25a682['id']}}});}})[_0x27ef('0x15')](function(_0x2d85b8){if(_0x2d85b8){_0x142a6a=_0x2d85b8;return require(_0x27ef('0x49'))[_0x27ef('0x4a')]();}})[_0x27ef('0x15')](function(_0x6e57a6){if(_0x6e57a6&&_0x6e57a6['agents']&&_0x142a6a>=_0x6e57a6[_0x27ef('0x4b')]){throw new Error(_0x27ef('0x4c'));}})[_0x27ef('0x15')](function(){if(_0x25a682){return db['UserVoiceQueueRt'][_0x27ef('0x4d')]({'where':{'membername':_0x25a682[_0x27ef('0x28')]},'individualHooks':!![]});}})[_0x27ef('0x15')](function(){if(_0x25a682){return _0x25a682[_0x27ef('0x4e')]({'raw':!![]});}})[_0x27ef('0x15')](function(_0x356c73){if(_0x25a682){if(_0x356c73){var _0x52c146=[];_0x56bc37=_0x356c73;if(_0x56bc37[_0x27ef('0x2a')]){for(var _0x5c3e30=0x0;_0x5c3e30<_0x56bc37[_0x27ef('0x2a')];_0x5c3e30++){_0x52c146[_0x27ef('0x42')](db[_0x27ef('0x25')][_0x27ef('0x4f')]({'membername':_0x25a682[_0x27ef('0x28')],'UserId':_0x25a682['id'],'queue_name':_0x56bc37[_0x5c3e30][_0x27ef('0x28')],'VoiceQueueId':_0x56bc37[_0x5c3e30]['id'],'interface':_0x2d37c9,'paused':_0x25a682['loginInPause']||![],'penalty':_0x56bc37[_0x5c3e30][_0x27ef('0x50')]||0x0}));}return BPromise[_0x27ef('0x43')](_0x52c146);}}}})[_0x27ef('0x15')](function(){if(_0x25a682){return db[_0x27ef('0x27')][_0x27ef('0xd')]({'where':{'membername':_0x25a682[_0x27ef('0x28')],'exitAt':null}});}})[_0x27ef('0x15')](function(_0x25e210){if(_0x25a682){if(_0x25e210&&_0x25e210['length']){var _0x169088=[];_0x25e210[_0x27ef('0x41')](function(_0x4b67d5){_0x169088[_0x27ef('0x42')](_0x4b67d5[_0x27ef('0x26')]({'exitAt':moment()[_0x27ef('0x22')](_0x27ef('0x2b'))}));});return BPromise[_0x27ef('0x43')](_0x169088);}}})[_0x27ef('0x15')](function(){if(_0x25a682){var _0x5b76d3=[];var _0x46df21=[];var _0x4fc030=utils['getChannels']();var _0xdf7f9f={'membername':_0x25a682['name'],'interface':_0x2d37c9,'enterAt':moment()[_0x27ef('0x22')](_0x27ef('0x2b')),'role':_0x25a682[_0x27ef('0x1f')],'internal':_0x25a682[_0x27ef('0x20')]};_0x4fc030[_0x27ef('0x41')](function(_0x3b633f){_0x5b76d3[_0x27ef('0x42')](_[_0x27ef('0x51')]({'channel':_0x3b633f,'type':'LOGIN','data1':'callysquare','data2':_0x2d37c9},_0xdf7f9f));if(_0x25a682['loginInPause']){_0x46df21[_0x27ef('0x42')](_[_0x27ef('0x51')]({'channel':_0x3b633f,'type':_0x27ef('0x29'),'data1':_0x27ef('0x52')},_0xdf7f9f));}});return db[_0x27ef('0x27')][_0x27ef('0x53')](_0x5b76d3[_0x27ef('0x54')](_0x46df21),{'individualHooks':!![]});}})[_0x27ef('0x15')](function(){if(_0x25a682){return _0x25a682['update']({'online':!![],'lastLoginAt':moment()[_0x27ef('0x22')](_0x27ef('0x2b')),'voicePause':_0x25a682[_0x27ef('0x47')]||![],'mailPause':_0x25a682['loginInPause']||![],'chatPause':_0x25a682[_0x27ef('0x47')]||![],'faxPause':_0x25a682[_0x27ef('0x47')]||![],'smsPause':_0x25a682[_0x27ef('0x47')]||![],'openchannelPause':_0x25a682[_0x27ef('0x47')]||![],'pauseType':_0x25a682[_0x27ef('0x47')]?_0x27ef('0x52'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2d37c9});}})[_0x27ef('0x15')](function(_0x3fbaa0){_0x662942(_0x3fbaa0);})[_0x27ef('0x1e')](function(_0x54e52c){_0x475ff2(_0x2baba8[_0x27ef('0x1a')](0x1f4,_0x54e52c[_0x27ef('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 16983b8..7c16ff7 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 _0xc87d=['user:','./user.events','save','remove','removeListener','length'];(function(_0xa0be1c,_0x152d5d){var _0x546eec=function(_0x371eae){while(--_0x371eae){_0xa0be1c['push'](_0xa0be1c['shift']());}};_0x546eec(++_0x152d5d);}(_0xc87d,0x121));var _0xdc87=function(_0x2e223b,_0x354b69){_0x2e223b=_0x2e223b-0x0;var _0x50aabd=_0xc87d[_0x2e223b];return _0x50aabd;};'use strict';var UserEvents=require(_0xdc87('0x0'));var events=[_0xdc87('0x1'),_0xdc87('0x2'),'update'];function createListener(_0x2fac3b,_0x2b80c4){return function(_0xb2fcaf){_0x2b80c4['emit'](_0x2fac3b,_0xb2fcaf);};}function removeListener(_0x20d7da,_0x189e23){return function(){UserEvents[_0xdc87('0x3')](_0x20d7da,_0x189e23);};}exports['register']=function(_0x1e4332){for(var _0x428ecc=0x0,_0x48b68f=events[_0xdc87('0x4')];_0x428ecc<_0x48b68f;_0x428ecc++){var _0x18a5ad=events[_0x428ecc];var _0x4d3709=createListener(_0xdc87('0x5')+_0x18a5ad,_0x1e4332);UserEvents['on'](_0x18a5ad,_0x4d3709);}}; \ No newline at end of file +var _0xe9eb=['user:','./user.events','save','update','emit','removeListener','length'];(function(_0x112db5,_0x38a06d){var _0x1d7d06=function(_0x44571e){while(--_0x44571e){_0x112db5['push'](_0x112db5['shift']());}};_0x1d7d06(++_0x38a06d);}(_0xe9eb,0xcc));var _0xbe9e=function(_0x177a45,_0x2311f6){_0x177a45=_0x177a45-0x0;var _0x4ce3a9=_0xe9eb[_0x177a45];return _0x4ce3a9;};'use strict';var UserEvents=require(_0xbe9e('0x0'));var events=[_0xbe9e('0x1'),'remove',_0xbe9e('0x2')];function createListener(_0xacbacd,_0x15b261){return function(_0x7446aa){_0x15b261[_0xbe9e('0x3')](_0xacbacd,_0x7446aa);};}function removeListener(_0x480813,_0x1026e6){return function(){UserEvents[_0xbe9e('0x4')](_0x480813,_0x1026e6);};}exports['register']=function(_0x717273){for(var _0x34e2f1=0x0,_0x55b62f=events[_0xbe9e('0x5')];_0x34e2f1<_0x55b62f;_0x34e2f1++){var _0x419a11=events[_0x34e2f1];var _0x139873=createListener(_0xbe9e('0x6')+_0x419a11,_0x717273);UserEvents['on'](_0x419a11,_0x139873);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ae11da5..6f570f0 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c8963,_0x1dde86){var _0x676c70=function(_0x21aec2){while(--_0x21aec2){_0x5c8963['push'](_0x5c8963['shift']());}};_0x676c70(++_0x1dde86);}(_0xe706,0xa3));var _0x6e70=function(_0x543429,_0x140390){_0x543429=_0x543429-0x0;var _0x112a46=_0xe706[_0x543429];return _0x112a46;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x293fb8,_0x4dfd99){var _0x2e0121=function(_0xaa1a66){while(--_0xaa1a66){_0x293fb8['push'](_0x293fb8['shift']());}};_0x2e0121(++_0x4dfd99);}(_0x70e0,0x17b));var _0x070e=function(_0x2725bc,_0x4283ac){_0x2725bc=_0x2725bc-0x0;var _0x366342=_0x70e0[_0x2725bc];return _0x366342;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d7b228d..6b59c42 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 _0xdefc=['sequelize','exports','INTEGER'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xdefc,0x1b3));var _0xcdef=function(_0x2f2d46,_0x389f36){_0x2f2d46=_0x2f2d46-0x0;var _0x151b03=_0xdefc[_0x2f2d46];return _0x151b03;};'use strict';var Sequelize=require(_0xcdef('0x0'));module[_0xcdef('0x1')]={'penalty':{'type':Sequelize[_0xcdef('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5573=['sequelize','INTEGER'];(function(_0x3e8082,_0x481707){var _0x58794=function(_0x25fb94){while(--_0x25fb94){_0x3e8082['push'](_0x3e8082['shift']());}};_0x58794(++_0x481707);}(_0x5573,0x9e));var _0x3557=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x5573[_0x2353fe];return _0x4d43f6;};'use strict';var Sequelize=require(_0x3557('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3557('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 3ea4c9b..136032e 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 _0xf141=['request-promise','rimraf','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3480c6,_0x17ce40){var _0x37e903=function(_0x518681){while(--_0x518681){_0x3480c6['push'](_0x3480c6['shift']());}};_0x37e903(++_0x17ce40);}(_0xf141,0xde));var _0x1f14=function(_0x2650bd,_0x457df4){_0x2650bd=_0x2650bd-0x0;var _0x4f34b3=_0xf141[_0x2650bd];return _0x4f34b3;};'use strict';var _=require(_0x1f14('0x0'));var util=require(_0x1f14('0x1'));var logger=require(_0x1f14('0x2'))(_0x1f14('0x3'));var moment=require(_0x1f14('0x4'));var BPromise=require(_0x1f14('0x5'));var rp=require(_0x1f14('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f14('0x7'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x1f14('0x8')]=function(_0x246efd,_0x4162ea){return _0x246efd[_0x1f14('0x9')](_0x1f14('0xa'),attributes,{'tableName':_0x1f14('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0710=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','lodash','util','../../config/logger','api','moment'];(function(_0x3f1037,_0x50f5ec){var _0x5db5a4=function(_0x3fe86d){while(--_0x3fe86d){_0x3f1037['push'](_0x3f1037['shift']());}};_0x5db5a4(++_0x50f5ec);}(_0x0710,0x119));var _0x0071=function(_0x527372,_0x173b25){_0x527372=_0x527372-0x0;var _0x4f88b2=_0x0710[_0x527372];return _0x4f88b2;};'use strict';var _=require(_0x0071('0x0'));var util=require(_0x0071('0x1'));var logger=require(_0x0071('0x2'))(_0x0071('0x3'));var moment=require(_0x0071('0x4'));var BPromise=require(_0x0071('0x5'));var rp=require(_0x0071('0x6'));var fs=require('fs');var path=require(_0x0071('0x7'));var rimraf=require(_0x0071('0x8'));var config=require(_0x0071('0x9'));var attributes=require(_0x0071('0xa'));module['exports']=function(_0x42fccd,_0x59d53f){return _0x42fccd[_0x0071('0xb')](_0x0071('0xc'),attributes,{'tableName':'user_has_chat_queues','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 b91b760..be74e42 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 _0xe872=['message','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x448252,_0x15f4d4){var _0x3ca106=function(_0x179a20){while(--_0x179a20){_0x448252['push'](_0x448252['shift']());}};_0x3ca106(++_0x15f4d4);}(_0xe872,0x107));var _0x2e87=function(_0x521ba7,_0x4ee31a){_0x521ba7=_0x521ba7-0x0;var _0x5a5f2a=_0xe872[_0x521ba7];return _0x5a5f2a;};'use strict';var _=require(_0x2e87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2e87('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e87('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e87('0x3'));var logger=require(_0x2e87('0x4'))(_0x2e87('0x5'));var config=require(_0x2e87('0x6'));var jayson=require(_0x2e87('0x7'));var client=jayson['client'][_0x2e87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30ec99,_0x33e3e9,_0x10f716){return new BPromise(function(_0xf6190a,_0x509f6b){return client[_0x2e87('0x9')](_0x30ec99,_0x10f716)[_0x2e87('0xa')](function(_0x23638f){logger[_0x2e87('0xb')](_0x2e87('0xc'),_0x33e3e9,_0x2e87('0xd'));logger['debug'](_0x2e87('0xe'),_0x33e3e9,_0x2e87('0xd'),JSON['stringify'](_0x23638f));if(_0x23638f[_0x2e87('0xf')]){if(_0x23638f['error'][_0x2e87('0x10')]===0x1f4){logger[_0x2e87('0xf')](_0x2e87('0xc'),_0x33e3e9,_0x23638f[_0x2e87('0xf')][_0x2e87('0x11')]);return _0x509f6b(_0x23638f[_0x2e87('0xf')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x33e3e9,_0x23638f[_0x2e87('0xf')][_0x2e87('0x11')]);return _0xf6190a(_0x23638f[_0x2e87('0xf')]['message']);}else{logger[_0x2e87('0xb')](_0x2e87('0xc'),_0x33e3e9,_0x2e87('0xd'));_0xf6190a(_0x23638f[_0x2e87('0x12')]['message']);}})[_0x2e87('0x13')](function(_0x4666c2){logger[_0x2e87('0xf')](_0x2e87('0xc'),_0x33e3e9,_0x4666c2);_0x509f6b(_0x4666c2);});});} \ No newline at end of file +var _0xefb4=['randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x757d10,_0x40fbd9){var _0x498cc6=function(_0x11cfcc){while(--_0x11cfcc){_0x757d10['push'](_0x757d10['shift']());}};_0x498cc6(++_0x40fbd9);}(_0xefb4,0x1db));var _0x4efb=function(_0x36991b,_0x1b8059){_0x36991b=_0x36991b-0x0;var _0x14828e=_0xefb4[_0x36991b];return _0x14828e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4efb('0x0'));var BPromise=require('bluebird');var rs=require(_0x4efb('0x1'));var fs=require('fs');var Redis=require(_0x4efb('0x2'));var db=require(_0x4efb('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4efb('0x4'));var config=require('../../config/environment');var jayson=require(_0x4efb('0x5'));var client=jayson[_0x4efb('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d3a77,_0x3b31c4,_0x2386c0){return new BPromise(function(_0x1780c3,_0x10ff2e){return client[_0x4efb('0x7')](_0x2d3a77,_0x2386c0)[_0x4efb('0x8')](function(_0x5d97ed){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x3b31c4,_0x4efb('0x9'));logger[_0x4efb('0xa')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3b31c4,_0x4efb('0x9'),JSON[_0x4efb('0xb')](_0x5d97ed));if(_0x5d97ed['error']){if(_0x5d97ed['error']['code']===0x1f4){logger[_0x4efb('0xc')](_0x4efb('0xd'),_0x3b31c4,_0x5d97ed[_0x4efb('0xc')][_0x4efb('0xe')]);return _0x10ff2e(_0x5d97ed['error'][_0x4efb('0xe')]);}logger[_0x4efb('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x3b31c4,_0x5d97ed['error']['message']);return _0x1780c3(_0x5d97ed[_0x4efb('0xc')]['message']);}else{logger['info'](_0x4efb('0xd'),_0x3b31c4,_0x4efb('0x9'));_0x1780c3(_0x5d97ed[_0x4efb('0xf')][_0x4efb('0xe')]);}})[_0x4efb('0x10')](function(_0x15d382){logger[_0x4efb('0xc')](_0x4efb('0xd'),_0x3b31c4,_0x15d382);_0x10ff2e(_0x15d382);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1410758..9ee71a6 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x548fa7,_0x1f5d1d){var _0x17dac7=function(_0xa20292){while(--_0xa20292){_0x548fa7['push'](_0x548fa7['shift']());}};_0x17dac7(++_0x1f5d1d);}(_0x70e0,0x17b));var _0x070e=function(_0x5464f5,_0x3039cc){_0x5464f5=_0x5464f5-0x0;var _0x12a029=_0x70e0[_0x5464f5];return _0x12a029;};'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(_0x202a76,_0x52775d){var _0xa6433b=function(_0x1b5061){while(--_0x1b5061){_0x202a76['push'](_0x202a76['shift']());}};_0xa6433b(++_0x52775d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b8eeaf7..3f07e8e 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 _0x90e3=['STRING','exports','INTEGER'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x90e3,0xca));var _0x390e=function(_0x2c63a4,_0x18a34f){_0x2c63a4=_0x2c63a4-0x0;var _0x210eb8=_0x90e3[_0x2c63a4];return _0x210eb8;};'use strict';var Sequelize=require('sequelize');module[_0x390e('0x0')]={'penalty':{'type':Sequelize[_0x390e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x390e('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x390e('0x2')]}}; \ No newline at end of file +var _0xaaf0=['STRING','sequelize','exports','INTEGER'];(function(_0x9f47b2,_0x4b2b64){var _0x164886=function(_0x396c41){while(--_0x396c41){_0x9f47b2['push'](_0x9f47b2['shift']());}};_0x164886(++_0x4b2b64);}(_0xaaf0,0x105));var _0x0aaf=function(_0x308134,_0x588a85){_0x308134=_0x308134-0x0;var _0x15873a=_0xaaf0[_0x308134];return _0x15873a;};'use strict';var Sequelize=require(_0x0aaf('0x0'));module[_0x0aaf('0x1')]={'penalty':{'type':Sequelize[_0x0aaf('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0aaf('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0aaf('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 90ba840..dbced36 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 _0xca31=['define','lodash','util','api','moment','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x471886,_0x6dbb2e){var _0x39b585=function(_0x1e212e){while(--_0x1e212e){_0x471886['push'](_0x471886['shift']());}};_0x39b585(++_0x6dbb2e);}(_0xca31,0x173));var _0x1ca3=function(_0x1427ab,_0x4978fb){_0x1427ab=_0x1427ab-0x0;var _0x426299=_0xca31[_0x1427ab];return _0x426299;};'use strict';var _=require(_0x1ca3('0x0'));var util=require(_0x1ca3('0x1'));var logger=require('../../config/logger')(_0x1ca3('0x2'));var moment=require(_0x1ca3('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ca3('0x4'));var fs=require('fs');var path=require(_0x1ca3('0x5'));var rimraf=require('rimraf');var config=require(_0x1ca3('0x6'));var attributes=require(_0x1ca3('0x7'));module[_0x1ca3('0x8')]=function(_0x586d49,_0x5b4523){return _0x586d49[_0x1ca3('0x9')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc208=['path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger','api','bluebird'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc208,0x8b));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8c20('0x0'));var util=require('util');var logger=require(_0x8c20('0x1'))(_0x8c20('0x2'));var moment=require('moment');var BPromise=require(_0x8c20('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c20('0x4'));var rimraf=require(_0x8c20('0x5'));var config=require(_0x8c20('0x6'));var attributes=require(_0x8c20('0x7'));module[_0x8c20('0x8')]=function(_0x4cbac5,_0x176f63){return _0x4cbac5[_0x8c20('0x9')]('UserFaxQueue',attributes,{'tableName':_0x8c20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index f426b56..1d65862 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 _0x008d=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5e9755,_0x3f9347){var _0x14064f=function(_0x20a79c){while(--_0x20a79c){_0x5e9755['push'](_0x5e9755['shift']());}};_0x14064f(++_0x3f9347);}(_0x008d,0x1d3));var _0xd008=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x008d[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xd008('0x0'));var moment=require(_0xd008('0x1'));var BPromise=require(_0xd008('0x2'));var rs=require(_0xd008('0x3'));var fs=require('fs');var Redis=require(_0xd008('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd008('0x5'));var logger=require(_0xd008('0x6'))(_0xd008('0x7'));var config=require(_0xd008('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd008('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5790d6,_0x5741e8,_0x569cc5){return new BPromise(function(_0x8c5ba9,_0x36a28f){return client[_0xd008('0xa')](_0x5790d6,_0x569cc5)[_0xd008('0xb')](function(_0x3730f4){logger[_0xd008('0xc')](_0xd008('0xd'),_0x5741e8,'request\x20sent');logger[_0xd008('0xe')](_0xd008('0xf'),_0x5741e8,_0xd008('0x10'),JSON['stringify'](_0x3730f4));if(_0x3730f4['error']){if(_0x3730f4[_0xd008('0x11')][_0xd008('0x12')]===0x1f4){logger[_0xd008('0x11')](_0xd008('0xd'),_0x5741e8,_0x3730f4[_0xd008('0x11')][_0xd008('0x13')]);return _0x36a28f(_0x3730f4[_0xd008('0x11')][_0xd008('0x13')]);}logger['error'](_0xd008('0xd'),_0x5741e8,_0x3730f4[_0xd008('0x11')]['message']);return _0x8c5ba9(_0x3730f4[_0xd008('0x11')]['message']);}else{logger[_0xd008('0xc')](_0xd008('0xd'),_0x5741e8,_0xd008('0x10'));_0x8c5ba9(_0x3730f4[_0xd008('0x14')][_0xd008('0x13')]);}})[_0xd008('0x15')](function(_0x3447b0){logger[_0xd008('0x11')](_0xd008('0xd'),_0x5741e8,_0x3447b0);_0x36a28f(_0x3447b0);});});} \ No newline at end of file +var _0xe597=['client','request','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x17fcae,_0x1390f4){var _0x491865=function(_0x15d1aa){while(--_0x15d1aa){_0x17fcae['push'](_0x17fcae['shift']());}};_0x491865(++_0x1390f4);}(_0xe597,0xe7));var _0x7e59=function(_0x400dbb,_0x3fad05){_0x400dbb=_0x400dbb-0x0;var _0x5d784b=_0xe597[_0x400dbb];return _0x5d784b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e59('0x0'));var BPromise=require(_0x7e59('0x1'));var rs=require(_0x7e59('0x2'));var fs=require('fs');var Redis=require(_0x7e59('0x3'));var db=require(_0x7e59('0x4'))['db'];var utils=require(_0x7e59('0x5'));var logger=require('../../config/logger')(_0x7e59('0x6'));var config=require(_0x7e59('0x7'));var jayson=require(_0x7e59('0x8'));var client=jayson[_0x7e59('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x465299,_0x2284fa,_0x2ad9dd){return new BPromise(function(_0x55114f,_0x150782){return client[_0x7e59('0xa')](_0x465299,_0x2ad9dd)['then'](function(_0x4b82da){logger[_0x7e59('0xb')](_0x7e59('0xc'),_0x2284fa,'request\x20sent');logger[_0x7e59('0xd')](_0x7e59('0xe'),_0x2284fa,_0x7e59('0xf'),JSON['stringify'](_0x4b82da));if(_0x4b82da[_0x7e59('0x10')]){if(_0x4b82da['error'][_0x7e59('0x11')]===0x1f4){logger[_0x7e59('0x10')](_0x7e59('0xc'),_0x2284fa,_0x4b82da[_0x7e59('0x10')][_0x7e59('0x12')]);return _0x150782(_0x4b82da[_0x7e59('0x10')][_0x7e59('0x12')]);}logger[_0x7e59('0x10')](_0x7e59('0xc'),_0x2284fa,_0x4b82da[_0x7e59('0x10')][_0x7e59('0x12')]);return _0x55114f(_0x4b82da[_0x7e59('0x10')][_0x7e59('0x12')]);}else{logger[_0x7e59('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x2284fa,_0x7e59('0xf'));_0x55114f(_0x4b82da[_0x7e59('0x13')][_0x7e59('0x12')]);}})['catch'](function(_0x492cf2){logger[_0x7e59('0x10')](_0x7e59('0xc'),_0x2284fa,_0x492cf2);_0x150782(_0x492cf2);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 50bfa0e..b239103 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(_0x304d85,_0x3bd383){var _0x570077=function(_0x59944d){while(--_0x59944d){_0x304d85['push'](_0x304d85['shift']());}};_0x570077(++_0x3bd383);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'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(_0x521ff9,_0x5080a0){var _0x5723af=function(_0x23b1b7){while(--_0x23b1b7){_0x521ff9['push'](_0x521ff9['shift']());}};_0x5723af(++_0x5080a0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xcb91[_0x5cc8b9];return _0x58892e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 339e49e..53e5df0 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 _0x441d=['exports','sequelize'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x441d,0x13f));var _0xd441=function(_0x3d778c,_0x37dc79){_0x3d778c=_0x3d778c-0x0;var _0x2a3c30=_0x441d[_0x3d778c];return _0x2a3c30;};'use strict';var Sequelize=require(_0xd441('0x0'));module[_0xd441('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xacc3=['exports','INTEGER','sequelize'];(function(_0x4eceac,_0x40faec){var _0x154ffd=function(_0x279562){while(--_0x279562){_0x4eceac['push'](_0x4eceac['shift']());}};_0x154ffd(++_0x40faec);}(_0xacc3,0x1a6));var _0x3acc=function(_0x3ab928,_0x2b990b){_0x3ab928=_0x3ab928-0x0;var _0xf47692=_0xacc3[_0x3ab928];return _0xf47692;};'use strict';var Sequelize=require(_0x3acc('0x0'));module[_0x3acc('0x1')]={'penalty':{'type':Sequelize[_0x3acc('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index b96a529..0283fda 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 _0x2f7c=['define','UserMailQueue','user_has_mail_queues','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x4e1564,_0x52117a){var _0x1f3cd2=function(_0x354fc3){while(--_0x354fc3){_0x4e1564['push'](_0x4e1564['shift']());}};_0x1f3cd2(++_0x52117a);}(_0x2f7c,0x12c));var _0xc2f7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2f7c[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xc2f7('0x0'));var logger=require(_0xc2f7('0x1'))('api');var moment=require(_0xc2f7('0x2'));var BPromise=require('bluebird');var rp=require(_0xc2f7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc2f7('0x4'));var config=require(_0xc2f7('0x5'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3eaa1a,_0x2932b1){return _0x3eaa1a[_0xc2f7('0x6')](_0xc2f7('0x7'),attributes,{'tableName':_0xc2f7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7598=['user_has_mail_queues','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7598,0x14b));var _0x8759=function(_0x3c32b0,_0x46d6ef){_0x3c32b0=_0x3c32b0-0x0;var _0x55ea41=_0x7598[_0x3c32b0];return _0x55ea41;};'use strict';var _=require(_0x8759('0x0'));var util=require('util');var logger=require(_0x8759('0x1'))('api');var moment=require(_0x8759('0x2'));var BPromise=require('bluebird');var rp=require(_0x8759('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8759('0x4'));var config=require(_0x8759('0x5'));var attributes=require(_0x8759('0x6'));module[_0x8759('0x7')]=function(_0x4a9c40,_0x543dda){return _0x4a9c40[_0x8759('0x8')](_0x8759('0x9'),attributes,{'tableName':_0x8759('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 7de5d4d..af0e011 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x184f20,_0x106935){var _0x546b1a=function(_0x4bc7ae){while(--_0x4bc7ae){_0x184f20['push'](_0x184f20['shift']());}};_0x546b1a(++_0x106935);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x4b84[_0x3fa296];return _0x10b19f;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0xabc570,_0x5036a0){var _0x5447ad=function(_0x10e7d6){while(--_0x10e7d6){_0xabc570['push'](_0xabc570['shift']());}};_0x5447ad(++_0x5036a0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x00bb[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 309307e..9efcc35 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 _0x5ac3=['post','isAuthenticated','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8c7574,_0x39d50){var _0x7f8310=function(_0x1b817e){while(--_0x1b817e){_0x8c7574['push'](_0x8c7574['shift']());}};_0x7f8310(++_0x39d50);}(_0x5ac3,0x163));var _0x35ac=function(_0x38f801,_0x371163){_0x38f801=_0x38f801-0x0;var _0x2df472=_0x5ac3[_0x38f801];return _0x2df472;};'use strict';var multer=require(_0x35ac('0x0'));var util=require(_0x35ac('0x1'));var path=require('path');var timeout=require(_0x35ac('0x2'));var express=require('express');var router=express[_0x35ac('0x3')]();var fs_extra=require(_0x35ac('0x4'));var auth=require(_0x35ac('0x5'));var interaction=require(_0x35ac('0x6'));var config=require(_0x35ac('0x7'));var controller=require('./userNotification.controller');router[_0x35ac('0x8')]('/',auth[_0x35ac('0x9')](),controller['sendUserNotification']);module[_0x35ac('0xa')]=router; \ No newline at end of file +var _0x6d60=['./userNotification.controller','post','exports','multer','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x53845a,_0x3025fa){var _0x310d8e=function(_0x3bc71d){while(--_0x3bc71d){_0x53845a['push'](_0x53845a['shift']());}};_0x310d8e(++_0x3025fa);}(_0x6d60,0xc0));var _0x06d6=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x6d60[_0x1ca4c3];return _0x4426a6;};'use strict';var multer=require(_0x06d6('0x0'));var util=require(_0x06d6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x06d6('0x2'));var router=express[_0x06d6('0x3')]();var fs_extra=require(_0x06d6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x06d6('0x5'));var config=require('../../config/environment');var controller=require(_0x06d6('0x6'));router[_0x06d6('0x7')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x06d6('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 156d38e..7bb9369 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 _0x4995=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x4995,0x137));var _0x5499=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4995[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5499('0x0'));module[_0x5499('0x1')]={'body':{'type':Sequelize[_0x5499('0x2')]},'senderName':{'type':Sequelize[_0x5499('0x3')]},'recipientsId':{'type':Sequelize[_0x5499('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x5499('0x4')]}}; \ No newline at end of file +var _0x9ba1=['STRING','exports','TEXT'];(function(_0x20f152,_0x4cffb1){var _0x39ddac=function(_0x44430c){while(--_0x44430c){_0x20f152['push'](_0x20f152['shift']());}};_0x39ddac(++_0x4cffb1);}(_0x9ba1,0xcd));var _0x19ba=function(_0x274b75,_0x1bf6dc){_0x274b75=_0x274b75-0x0;var _0x248f5c=_0x9ba1[_0x274b75];return _0x248f5c;};'use strict';var Sequelize=require('sequelize');module[_0x19ba('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x19ba('0x1')]},'recipientsDescription':{'type':Sequelize[_0x19ba('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 32cdbfc..8717356 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 _0xe1ea=['../../mysqldb','redis','defaults','localhost','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','name','send','sendUserNotification','hasOwnProperty','body','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','create','recipient','emit','userNotification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','forEach','startCase','User','union','ids','includes','queue','Queue','all','flatten','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','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/utils','../../config/license/util'];(function(_0x374f02,_0x5e44ea){var _0x1b4621=function(_0x492fe1){while(--_0x492fe1){_0x374f02['push'](_0x374f02['shift']());}};_0x1b4621(++_0x5e44ea);}(_0xe1ea,0x1b6));var _0xae1e=function(_0x4e5414,_0x31ffc5){_0x4e5414=_0x4e5414-0x0;var _0x4567fc=_0xe1ea[_0x4e5414];return _0x4567fc;};'use strict';var emlformat=require(_0xae1e('0x0'));var rimraf=require(_0xae1e('0x1'));var zipdir=require(_0xae1e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae1e('0x3'));var moment=require(_0xae1e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xae1e('0x5'));var sox=require(_0xae1e('0x6'));var csv=require('to-csv');var ejs=require(_0xae1e('0x7'));var fs=require('fs');var fs_extra=require(_0xae1e('0x8'));var _=require(_0xae1e('0x9'));var squel=require(_0xae1e('0xa'));var crypto=require(_0xae1e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xae1e('0xc'));var toCsv=require(_0xae1e('0xd'));var querystring=require(_0xae1e('0xe'));var Papa=require(_0xae1e('0xf'));var Redis=require(_0xae1e('0x10'));var authService=require(_0xae1e('0x11'));var qs=require(_0xae1e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae1e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xae1e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xae1e('0x15'));var db=require(_0xae1e('0x16'))['db'];config[_0xae1e('0x17')]=_[_0xae1e('0x18')](config[_0xae1e('0x17')],{'host':_0xae1e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae1e('0x17')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x38884a,_0x2793d2){_0x2793d2=_0x2793d2||0xcc;return function(_0x3c42fe){if(_0x3c42fe){return _0x38884a['sendStatus'](_0x2793d2);}return _0x38884a[_0xae1e('0x1a')](_0x2793d2)['end']();};}function respondWithResult(_0x3e4f95,_0x3515b1){_0x3515b1=_0x3515b1||0xc8;return function(_0x387be1){if(_0x387be1){return _0x3e4f95['status'](_0x3515b1)[_0xae1e('0x1b')](_0x387be1);}};}function respondWithFilteredResult(_0x1bd482,_0x1794bc){return function(_0x4d77df){if(_0x4d77df){var _0x249894=typeof _0x1794bc[_0xae1e('0x1c')]===_0xae1e('0x1d')&&typeof _0x1794bc['limit']===_0xae1e('0x1d');var _0x59ad48=_0x4d77df[_0xae1e('0x1e')];var _0x5aa7cd=_0x249894?0x0:_0x1794bc[_0xae1e('0x1c')];var _0x48698e=_0x249894?_0x4d77df[_0xae1e('0x1e')]:_0x1794bc[_0xae1e('0x1c')]+_0x1794bc['limit'];var _0x551cf1;if(_0x48698e>=_0x59ad48){_0x48698e=_0x59ad48;_0x551cf1=0xc8;}else{_0x551cf1=0xce;}_0x1bd482[_0xae1e('0x1a')](_0x551cf1);return _0x1bd482[_0xae1e('0x1f')](_0xae1e('0x20'),_0x5aa7cd+'-'+_0x48698e+'/'+_0x59ad48)[_0xae1e('0x1b')](_0x4d77df);}return null;};}function patchUpdates(_0x234b2d){return function(_0x4fc376){try{jsonpatch[_0xae1e('0x21')](_0x4fc376,_0x234b2d,!![]);}catch(_0x249293){return BPromise[_0xae1e('0x22')](_0x249293);}return _0x4fc376[_0xae1e('0x23')]();};}function saveUpdates(_0x2619eb,_0x19e4a6){return function(_0x47294f){if(_0x47294f){return _0x47294f[_0xae1e('0x24')](_0x2619eb)['then'](function(_0x2ea258){return _0x2ea258;});}return null;};}function removeEntity(_0x4c145f,_0x2f3083){return function(_0x5bf55b){if(_0x5bf55b){return _0x5bf55b['destroy']()[_0xae1e('0x25')](function(){_0x4c145f[_0xae1e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56b4ed,_0x21837e){return function(_0xf1f522){if(!_0xf1f522){_0x56b4ed['sendStatus'](0x194);}return _0xf1f522;};}function handleError(_0x4ffb54,_0x4b8f54){_0x4b8f54=_0x4b8f54||0x1f4;return function(_0xb6ed59){logger[_0xae1e('0x26')](_0xb6ed59['stack']);if(_0xb6ed59[_0xae1e('0x27')]){delete _0xb6ed59[_0xae1e('0x27')];}_0x4ffb54[_0xae1e('0x1a')](_0x4b8f54)[_0xae1e('0x28')](_0xb6ed59);};}exports[_0xae1e('0x29')]=function(_0x39862c,_0x4990bc,_0x22acbe){if(!_0x39862c['body'][_0xae1e('0x2a')]('text')&&!_0x39862c[_0xae1e('0x2b')][_0xae1e('0x2a')](_0xae1e('0x2c'))){throw new db['Sequelize']['ValidationError'](_0xae1e('0x2d'));}else{if(_0x39862c['body'][_0xae1e('0x2a')](_0xae1e('0x2c'))&&!_0x39862c[_0xae1e('0x2b')][_0xae1e('0x2a')](_0xae1e('0x2e'))){throw new db[(_0xae1e('0x2f'))][(_0xae1e('0x30'))](_0xae1e('0x31'));}if(!_0x39862c[_0xae1e('0x2b')][_0xae1e('0x2a')](_0xae1e('0x32'))){throw new db['Sequelize']['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x44cfe6=JSON[_0xae1e('0x33')](_0x39862c[_0xae1e('0x2b')][_0xae1e('0x32')]);}catch(_0x18bbbc){logger[_0xae1e('0x26')](_0x18bbbc);throw new db['Sequelize'][(_0xae1e('0x30'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x297067=[_0xae1e('0x34'),_0xae1e('0x35'),_0xae1e('0x36'),_0xae1e('0x37'),_0xae1e('0x38'),_0xae1e('0x39'),_0xae1e('0x3a'),'team','user'];if(_[_0xae1e('0x3b')](_0x44cfe6,function(_0x1f10c7){return!_['includes'](_0x297067,_0x1f10c7[_0xae1e('0x3c')][_0xae1e('0x3d')]());})){throw new db['Sequelize'][(_0xae1e('0x30'))](_0xae1e('0x3e'));}}}var _0x373f1a={};_0x373f1a[_0xae1e('0x3f')]=_0x39862c[_0xae1e('0x2b')][_0xae1e('0x2a')](_0xae1e('0x3f'))?_0x39862c[_0xae1e('0x2b')]['senderName']:_0x39862c['user'][_0xae1e('0x40')];_0x373f1a['recipientsDescription']=_['isEmpty'](_0x39862c['body'][_0xae1e('0x41')])?null:_0x39862c[_0xae1e('0x2b')][_0xae1e('0x41')];_0x373f1a[_0xae1e('0x42')]=_0x39862c[_0xae1e('0x2b')][_0xae1e('0x42')]||![];_0x373f1a[_0xae1e('0x43')]=_0x39862c['user']['id'];return getContent(_0x39862c[_0xae1e('0x2b')])[_0xae1e('0x25')](function(_0x2ebf66){_0x373f1a[_0xae1e('0x2b')]=_0x2ebf66;return getRecipients(_0x44cfe6);})[_0xae1e('0x25')](function(_0x33132a){_0x373f1a[_0xae1e('0x44')]=_[_0xae1e('0x45')](_0x33132a)['join'](',');return db[_0xae1e('0x46')][_0xae1e('0x47')](function(_0x474eda){return db['UserNotification'][_0xae1e('0x48')](_0x373f1a,{'raw':!![],'transaction':_0x474eda})['then'](function(_0x1389ee){var _0x4ec3a9={'sender':_0x373f1a[_0xae1e('0x3f')],'description':_0x373f1a[_0xae1e('0x41')],'content':_0x373f1a[_0xae1e('0x2b')],'beep':_0x373f1a[_0xae1e('0x42')]};_0x33132a['forEach'](function(_0x515b53){_0x4ec3a9[_0xae1e('0x49')]=_0x515b53;socket[_0xae1e('0x4a')](_0xae1e('0x4b'),_0x4ec3a9);});return _0x1389ee;});});})['then'](respondWithResult(_0x4990bc,0xc9))[_0xae1e('0x4c')](handleError(_0x4990bc,null));};function getContent(_0x52ed96){return new BPromise(function(_0x54f515,_0x180a7f){if(_0x52ed96[_0xae1e('0x4d')]){_0x54f515(_0x52ed96[_0xae1e('0x4d')]);return;}return db[_0xae1e('0x4e')][_0xae1e('0x4f')]({'attributes':['html'],'where':{'id':_0x52ed96[_0xae1e('0x2c')]},'raw':!![]})[_0xae1e('0x25')](function(_0x57cd80){if(!_0x57cd80)throw new db['Sequelize'][(_0xae1e('0x30'))](_0xae1e('0x50'));var _0x806eb7=Mustache['render'](_0x57cd80['html'],_0x52ed96[_0xae1e('0x2e')]);_0x54f515(_0x806eb7);})['catch'](function(_0x422952){_0x180a7f(_0x422952);});});}function getRecipients(_0x74fea9){return new BPromise(function(_0x2fb641,_0xe0064d){var _0x4cd500=[];var _0x163c4d=[];_0x74fea9[_0xae1e('0x51')](function(_0x58924e){var _0x1f60e5=_[_0xae1e('0x52')](_0x58924e[_0xae1e('0x3c')]['toLowerCase']());if(_0x1f60e5===_0xae1e('0x53')){_0x4cd500=_[_0xae1e('0x54')](_0x4cd500,_0x58924e[_0xae1e('0x55')]);}else{if(_[_0xae1e('0x56')](_0x1f60e5,'queue'))_0x1f60e5=_0x1f60e5['replace'](_0xae1e('0x57'),_0xae1e('0x58'));_0x58924e[_0xae1e('0x55')]['forEach'](function(_0x4ac782){_0x163c4d['push'](getAgents(_0x1f60e5,_0x4ac782));});}});return BPromise[_0xae1e('0x59')](_0x163c4d)[_0xae1e('0x25')](function(_0x54baae){_0x4cd500=_['union'](_0x4cd500,_[_0xae1e('0x5a')](_0x54baae));_0x2fb641(_0x4cd500);})[_0xae1e('0x4c')](function(_0x37d196){_0xe0064d(_0x37d196);});});}function getAgents(_0x70890f,_0xef59c9){return new BPromise(function(_0x4c7aea,_0x5c3632){return db[_0x70890f]['findOne']({'where':{'id':_0xef59c9}})[_0xae1e('0x25')](function(_0x420a0d){return _0x420a0d[_0xae1e('0x5b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3e3793){var _0x1e15c5=_['map'](_0x3e3793,'id');_0x4c7aea(_0x1e15c5);});})[_0xae1e('0x4c')](function(_0x21d0a8){_0x5c3632(_0x21d0a8);});});} \ No newline at end of file +var _0x3322=['zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','./userNotification.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','User','union','ids','queue','replace','push','all','map','eml-format'];(function(_0x4c06ac,_0x568788){var _0x2333cb=function(_0xdb5c64){while(--_0xdb5c64){_0x4c06ac['push'](_0x4c06ac['shift']());}};_0x2333cb(++_0x568788);}(_0x3322,0x1e9));var _0x2332=function(_0x1d2c05,_0x2ea867){_0x1d2c05=_0x1d2c05-0x0;var _0x18ac6c=_0x3322[_0x1d2c05];return _0x18ac6c;};'use strict';var emlformat=require(_0x2332('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2332('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2332('0x2'));var moment=require(_0x2332('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2332('0x4'));var util=require(_0x2332('0x5'));var path=require('path');var sox=require(_0x2332('0x6'));var csv=require(_0x2332('0x7'));var ejs=require(_0x2332('0x8'));var fs=require('fs');var fs_extra=require(_0x2332('0x9'));var _=require(_0x2332('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2332('0xb'));var deskjs=require(_0x2332('0xc'));var toCsv=require(_0x2332('0x7'));var querystring=require(_0x2332('0xd'));var Papa=require(_0x2332('0xe'));var Redis=require(_0x2332('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2332('0x10'));var as=require(_0x2332('0x11'));var hardwareService=require(_0x2332('0x12'));var logger=require(_0x2332('0x13'))(_0x2332('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2332('0x15'));var db=require('../../mysqldb')['db'];config[_0x2332('0x16')]=_[_0x2332('0x17')](config[_0x2332('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2332('0x18'))[_0x2332('0x19')](socket);function respondWithStatusCode(_0x16bb7c,_0x2276a6){_0x2276a6=_0x2276a6||0xcc;return function(_0x3613b1){if(_0x3613b1){return _0x16bb7c[_0x2332('0x1a')](_0x2276a6);}return _0x16bb7c[_0x2332('0x1b')](_0x2276a6)['end']();};}function respondWithResult(_0x28b6bb,_0x24f2f8){_0x24f2f8=_0x24f2f8||0xc8;return function(_0x38d0fc){if(_0x38d0fc){return _0x28b6bb[_0x2332('0x1b')](_0x24f2f8)['json'](_0x38d0fc);}};}function respondWithFilteredResult(_0x2ba783,_0x52ca72){return function(_0x240db9){if(_0x240db9){var _0x3eb7d0=typeof _0x52ca72[_0x2332('0x1c')]===_0x2332('0x1d')&&typeof _0x52ca72[_0x2332('0x1e')]===_0x2332('0x1d');var _0x35a4e1=_0x240db9[_0x2332('0x1f')];var _0x4ebdcd=_0x3eb7d0?0x0:_0x52ca72[_0x2332('0x1c')];var _0x1882c5=_0x3eb7d0?_0x240db9[_0x2332('0x1f')]:_0x52ca72[_0x2332('0x1c')]+_0x52ca72[_0x2332('0x1e')];var _0x4c3b8c;if(_0x1882c5>=_0x35a4e1){_0x1882c5=_0x35a4e1;_0x4c3b8c=0xc8;}else{_0x4c3b8c=0xce;}_0x2ba783[_0x2332('0x1b')](_0x4c3b8c);return _0x2ba783[_0x2332('0x20')](_0x2332('0x21'),_0x4ebdcd+'-'+_0x1882c5+'/'+_0x35a4e1)[_0x2332('0x22')](_0x240db9);}return null;};}function patchUpdates(_0x2391fd){return function(_0x3874ea){try{jsonpatch[_0x2332('0x23')](_0x3874ea,_0x2391fd,!![]);}catch(_0x100bc2){return BPromise[_0x2332('0x24')](_0x100bc2);}return _0x3874ea['save']();};}function saveUpdates(_0x20505e,_0x42901a){return function(_0x8e0c58){if(_0x8e0c58){return _0x8e0c58[_0x2332('0x25')](_0x20505e)[_0x2332('0x26')](function(_0x3754a9){return _0x3754a9;});}return null;};}function removeEntity(_0x476282,_0x457368){return function(_0xeaf24d){if(_0xeaf24d){return _0xeaf24d[_0x2332('0x27')]()['then'](function(){_0x476282[_0x2332('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9e1c91,_0x216290){return function(_0x1321a0){if(!_0x1321a0){_0x9e1c91[_0x2332('0x1a')](0x194);}return _0x1321a0;};}function handleError(_0x22b4a0,_0xe85565){_0xe85565=_0xe85565||0x1f4;return function(_0x3d8602){logger['error'](_0x3d8602['stack']);if(_0x3d8602[_0x2332('0x28')]){delete _0x3d8602[_0x2332('0x28')];}_0x22b4a0[_0x2332('0x1b')](_0xe85565)[_0x2332('0x29')](_0x3d8602);};}exports[_0x2332('0x2a')]=function(_0x2e4228,_0x67f06f,_0x5c7ae7){if(!_0x2e4228[_0x2332('0x2b')][_0x2332('0x2c')]('text')&&!_0x2e4228[_0x2332('0x2b')]['hasOwnProperty'](_0x2332('0x2d'))){throw new db[(_0x2332('0x2e'))][(_0x2332('0x2f'))](_0x2332('0x30'));}else{if(_0x2e4228[_0x2332('0x2b')]['hasOwnProperty'](_0x2332('0x2d'))&&!_0x2e4228[_0x2332('0x2b')][_0x2332('0x2c')]('view')){throw new db[(_0x2332('0x2e'))][(_0x2332('0x2f'))](_0x2332('0x31'));}if(!_0x2e4228[_0x2332('0x2b')][_0x2332('0x2c')](_0x2332('0x32'))){throw new db[(_0x2332('0x2e'))][(_0x2332('0x2f'))](_0x2332('0x33'));}else{try{var _0x29f305=JSON[_0x2332('0x34')](_0x2e4228[_0x2332('0x2b')]['recipients']);}catch(_0x287642){logger[_0x2332('0x35')](_0x287642);throw new db[(_0x2332('0x2e'))][(_0x2332('0x2f'))](_0x2332('0x36'));}var _0x58714e=[_0x2332('0x37'),_0x2332('0x38'),_0x2332('0x39'),'openchannelqueue',_0x2332('0x3a'),_0x2332('0x3b'),_0x2332('0x3c'),_0x2332('0x3d'),_0x2332('0x3e')];if(_[_0x2332('0x3f')](_0x29f305,function(_0x2a7a46){return!_['includes'](_0x58714e,_0x2a7a46[_0x2332('0x40')][_0x2332('0x41')]());})){throw new db[(_0x2332('0x2e'))][(_0x2332('0x2f'))](_0x2332('0x42'));}}}var _0x164513={};_0x164513[_0x2332('0x43')]=_0x2e4228[_0x2332('0x2b')][_0x2332('0x2c')](_0x2332('0x43'))?_0x2e4228[_0x2332('0x2b')]['senderName']:_0x2e4228[_0x2332('0x3e')][_0x2332('0x44')];_0x164513['recipientsDescription']=_[_0x2332('0x45')](_0x2e4228[_0x2332('0x2b')][_0x2332('0x46')])?null:_0x2e4228[_0x2332('0x2b')][_0x2332('0x46')];_0x164513[_0x2332('0x47')]=_0x2e4228[_0x2332('0x2b')]['beep']||![];_0x164513['SenderId']=_0x2e4228[_0x2332('0x3e')]['id'];return getContent(_0x2e4228['body'])[_0x2332('0x26')](function(_0x1c8f17){_0x164513[_0x2332('0x2b')]=_0x1c8f17;return getRecipients(_0x29f305);})[_0x2332('0x26')](function(_0x419b7e){_0x164513[_0x2332('0x48')]=_[_0x2332('0x49')](_0x419b7e)[_0x2332('0x4a')](',');return db[_0x2332('0x4b')][_0x2332('0x4c')](function(_0x126360){return db[_0x2332('0x4d')][_0x2332('0x4e')](_0x164513,{'raw':!![],'transaction':_0x126360})['then'](function(_0x26ee92){var _0x313622={'sender':_0x164513[_0x2332('0x43')],'description':_0x164513[_0x2332('0x46')],'content':_0x164513[_0x2332('0x2b')],'beep':_0x164513[_0x2332('0x47')]};_0x419b7e[_0x2332('0x4f')](function(_0x84abdc){_0x313622[_0x2332('0x50')]=_0x84abdc;socket[_0x2332('0x51')](_0x2332('0x52'),_0x313622);});return _0x26ee92;});});})[_0x2332('0x26')](respondWithResult(_0x67f06f,0xc9))[_0x2332('0x53')](handleError(_0x67f06f,null));};function getContent(_0x13c445){return new BPromise(function(_0x2208ab,_0x1d8bcd){if(_0x13c445[_0x2332('0x54')]){_0x2208ab(_0x13c445['text']);return;}return db[_0x2332('0x55')][_0x2332('0x56')]({'attributes':['html'],'where':{'id':_0x13c445['TemplateId']},'raw':!![]})[_0x2332('0x26')](function(_0x5a15fb){if(!_0x5a15fb)throw new db[(_0x2332('0x2e'))]['ValidationError'](_0x2332('0x57'));var _0x5578ae=Mustache['render'](_0x5a15fb[_0x2332('0x58')],_0x13c445['view']);_0x2208ab(_0x5578ae);})['catch'](function(_0xd5f459){_0x1d8bcd(_0xd5f459);});});}function getRecipients(_0x58db4c){return new BPromise(function(_0x51f59c,_0x4decce){var _0x31dad7=[];var _0xdf68d7=[];_0x58db4c['forEach'](function(_0x516844){var _0x462f5a=_[_0x2332('0x59')](_0x516844[_0x2332('0x40')][_0x2332('0x41')]());if(_0x462f5a===_0x2332('0x5a')){_0x31dad7=_[_0x2332('0x5b')](_0x31dad7,_0x516844[_0x2332('0x5c')]);}else{if(_['includes'](_0x462f5a,_0x2332('0x5d')))_0x462f5a=_0x462f5a[_0x2332('0x5e')](_0x2332('0x5d'),'Queue');_0x516844['ids']['forEach'](function(_0x639d1a){_0xdf68d7[_0x2332('0x5f')](getAgents(_0x462f5a,_0x639d1a));});}});return BPromise[_0x2332('0x60')](_0xdf68d7)['then'](function(_0xee125e){_0x31dad7=_[_0x2332('0x5b')](_0x31dad7,_['flatten'](_0xee125e));_0x51f59c(_0x31dad7);})[_0x2332('0x53')](function(_0x425b0e){_0x4decce(_0x425b0e);});});}function getAgents(_0x5d930e,_0x4cb130){return new BPromise(function(_0x5de61a,_0x1886fa){return db[_0x5d930e][_0x2332('0x56')]({'where':{'id':_0x4cb130}})[_0x2332('0x26')](function(_0xe6780d){return _0xe6780d['getAgents']({'attributes':['id'],'raw':!![]})[_0x2332('0x26')](function(_0x34fe3e){var _0x50fd33=_[_0x2332('0x61')](_0x34fe3e,'id');_0x5de61a(_0x50fd33);});})[_0x2332('0x53')](function(_0x5261fa){_0x1886fa(_0x5261fa);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index dc93bee..965d085 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 _0xa67a=['remove','emit','hook','exports','events','UserNotification','setMaxListeners','save','update'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xa67a,0x8b));var _0xaa67=function(_0x342c95,_0x4dbc7a){_0x342c95=_0x342c95-0x0;var _0xaa7370=_0xa67a[_0x342c95];return _0xaa7370;};'use strict';var EventEmitter=require(_0xaa67('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xaa67('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xaa67('0x2')](0x0);var events={'afterCreate':_0xaa67('0x3'),'afterUpdate':_0xaa67('0x4'),'afterDestroy':_0xaa67('0x5')};function emitEvent(_0x582334){return function(_0x462e54,_0x1098df,_0x2f7f31){UserNotificationEvents['emit'](_0x582334+':'+_0x462e54['id'],_0x462e54);UserNotificationEvents[_0xaa67('0x6')](_0x582334,_0x462e54);_0x2f7f31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xaa67('0x7')](e,emitEvent(event));}}module[_0xaa67('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x61bb=['hasOwnProperty','exports','../../mysqldb','UserNotification','setMaxListeners','save','emit'];(function(_0x2979ac,_0x2aac47){var _0x474c9b=function(_0x659094){while(--_0x659094){_0x2979ac['push'](_0x2979ac['shift']());}};_0x474c9b(++_0x2aac47);}(_0x61bb,0xf7));var _0xb61b=function(_0x28ec6b,_0x9878c){_0x28ec6b=_0x28ec6b-0x0;var _0x48b5d2=_0x61bb[_0x28ec6b];return _0x48b5d2;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xb61b('0x0'))['db'][_0xb61b('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb61b('0x2')](0x0);var events={'afterCreate':_0xb61b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x56e2a2){return function(_0x4034ef,_0x29c676,_0x353a09){UserNotificationEvents['emit'](_0x56e2a2+':'+_0x4034ef['id'],_0x4034ef);UserNotificationEvents[_0xb61b('0x4')](_0x56e2a2,_0x4034ef);_0x353a09(null);};}for(var e in events){if(events[_0xb61b('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xb61b('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 2aa557f..5a8e754 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 _0x8c66=['exports','define','UserNotification','utf8mb4','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x8c66,0x126));var _0x68c6=function(_0x5f76e3,_0x977880){_0x5f76e3=_0x5f76e3-0x0;var _0x4a5558=_0x8c66[_0x5f76e3];return _0x4a5558;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x68c6('0x0'));var moment=require(_0x68c6('0x1'));var BPromise=require('bluebird');var rp=require(_0x68c6('0x2'));var fs=require('fs');var path=require(_0x68c6('0x3'));var rimraf=require(_0x68c6('0x4'));var config=require(_0x68c6('0x5'));var attributes=require('./userNotification.attributes');module[_0x68c6('0x6')]=function(_0x22f201,_0x321c9a){return _0x22f201[_0x68c6('0x7')](_0x68c6('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x68c6('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x981c=['define','UserNotification','utf8mb4','util','api','bluebird','path','../../config/environment','./userNotification.attributes'];(function(_0x44f836,_0x281d47){var _0x4888e6=function(_0x58b783){while(--_0x58b783){_0x44f836['push'](_0x44f836['shift']());}};_0x4888e6(++_0x281d47);}(_0x981c,0x16b));var _0xc981=function(_0x1111e4,_0x85a415){_0x1111e4=_0x1111e4-0x0;var _0x561df6=_0x981c[_0x1111e4];return _0x561df6;};'use strict';var _=require('lodash');var util=require(_0xc981('0x0'));var logger=require('../../config/logger')(_0xc981('0x1'));var moment=require('moment');var BPromise=require(_0xc981('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc981('0x3'));var rimraf=require('rimraf');var config=require(_0xc981('0x4'));var attributes=require(_0xc981('0x5'));module['exports']=function(_0x55abdb,_0x454cc3){return _0x55abdb[_0xc981('0x6')](_0xc981('0x7'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc981('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 6087893..bf62232 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 _0xaf04=['info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','UserNotification,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register'];(function(_0x371fdd,_0x546ace){var _0x1bbc92=function(_0x11dbd1){while(--_0x11dbd1){_0x371fdd['push'](_0x371fdd['shift']());}};_0x1bbc92(++_0x546ace);}(_0xaf04,0x9a));var _0x4af0=function(_0xac3f8d,_0x53355b){_0xac3f8d=_0xac3f8d-0x0;var _0xcc2597=_0xaf04[_0xac3f8d];return _0xcc2597;};'use strict';var _=require(_0x4af0('0x0'));var util=require(_0x4af0('0x1'));var moment=require('moment');var BPromise=require(_0x4af0('0x2'));var rs=require(_0x4af0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4af0('0x4'));var config=require(_0x4af0('0x5'));var jayson=require(_0x4af0('0x6'));var client=jayson[_0x4af0('0x7')][_0x4af0('0x8')]({'port':0x232a});config[_0x4af0('0x9')]=_['defaults'](config[_0x4af0('0x9')],{'host':_0x4af0('0xa'),'port':0x18eb});var socket=require(_0x4af0('0xb'))(new Redis(config[_0x4af0('0x9')]));require(_0x4af0('0xc'))[_0x4af0('0xd')](socket);function respondWithRpcPromise(_0x1a9bf2,_0x4ecb05,_0x3556f1){return new BPromise(function(_0x101b67,_0x3eae65){return client['request'](_0x1a9bf2,_0x3556f1)['then'](function(_0x17c6c9){logger[_0x4af0('0xe')]('UserNotification,\x20%s,\x20%s',_0x4ecb05,_0x4af0('0xf'));logger[_0x4af0('0x10')](_0x4af0('0x11'),_0x4ecb05,'request\x20sent',JSON['stringify'](_0x17c6c9));if(_0x17c6c9['error']){if(_0x17c6c9[_0x4af0('0x12')][_0x4af0('0x13')]===0x1f4){logger[_0x4af0('0x12')]('UserNotification,\x20%s,\x20%s',_0x4ecb05,_0x17c6c9['error'][_0x4af0('0x14')]);return _0x3eae65(_0x17c6c9[_0x4af0('0x12')][_0x4af0('0x14')]);}logger[_0x4af0('0x12')](_0x4af0('0x15'),_0x4ecb05,_0x17c6c9[_0x4af0('0x12')][_0x4af0('0x14')]);return _0x101b67(_0x17c6c9[_0x4af0('0x12')][_0x4af0('0x14')]);}else{logger[_0x4af0('0xe')]('UserNotification,\x20%s,\x20%s',_0x4ecb05,'request\x20sent');_0x101b67(_0x17c6c9[_0x4af0('0x16')]['message']);}})[_0x4af0('0x17')](function(_0x57e2c0){logger[_0x4af0('0x12')](_0x4af0('0x15'),_0x4ecb05,_0x57e2c0);_0x3eae65(_0x57e2c0);});});} \ No newline at end of file +var _0x83e0=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x10c7eb,_0x175dea){var _0x1a0362=function(_0x2eb028){while(--_0x2eb028){_0x10c7eb['push'](_0x10c7eb['shift']());}};_0x1a0362(++_0x175dea);}(_0x83e0,0x1a2));var _0x083e=function(_0xe52c2c,_0x475c16){_0xe52c2c=_0xe52c2c-0x0;var _0x53b931=_0x83e0[_0xe52c2c];return _0x53b931;};'use strict';var _=require(_0x083e('0x0'));var util=require(_0x083e('0x1'));var moment=require(_0x083e('0x2'));var BPromise=require('bluebird');var rs=require(_0x083e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x083e('0x4'))['db'];var utils=require(_0x083e('0x5'));var logger=require('../../config/logger')(_0x083e('0x6'));var config=require('../../config/environment');var jayson=require(_0x083e('0x7'));var client=jayson[_0x083e('0x8')]['http']({'port':0x232a});config[_0x083e('0x9')]=_[_0x083e('0xa')](config[_0x083e('0x9')],{'host':_0x083e('0xb'),'port':0x18eb});var socket=require(_0x083e('0xc'))(new Redis(config[_0x083e('0x9')]));require(_0x083e('0xd'))[_0x083e('0xe')](socket);function respondWithRpcPromise(_0x1752e3,_0x2bc519,_0x588125){return new BPromise(function(_0x6689e3,_0x3ed1d8){return client['request'](_0x1752e3,_0x588125)['then'](function(_0x30a0b2){logger[_0x083e('0xf')]('UserNotification,\x20%s,\x20%s',_0x2bc519,_0x083e('0x10'));logger[_0x083e('0x11')](_0x083e('0x12'),_0x2bc519,_0x083e('0x10'),JSON['stringify'](_0x30a0b2));if(_0x30a0b2[_0x083e('0x13')]){if(_0x30a0b2[_0x083e('0x13')][_0x083e('0x14')]===0x1f4){logger[_0x083e('0x13')](_0x083e('0x15'),_0x2bc519,_0x30a0b2[_0x083e('0x13')][_0x083e('0x16')]);return _0x3ed1d8(_0x30a0b2[_0x083e('0x13')][_0x083e('0x16')]);}logger[_0x083e('0x13')](_0x083e('0x15'),_0x2bc519,_0x30a0b2[_0x083e('0x13')][_0x083e('0x16')]);return _0x6689e3(_0x30a0b2[_0x083e('0x13')][_0x083e('0x16')]);}else{logger[_0x083e('0xf')](_0x083e('0x15'),_0x2bc519,_0x083e('0x10'));_0x6689e3(_0x30a0b2[_0x083e('0x17')][_0x083e('0x16')]);}})[_0x083e('0x18')](function(_0x44affe){logger[_0x083e('0x13')](_0x083e('0x15'),_0x2bc519,_0x44affe);_0x3ed1d8(_0x44affe);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 494ad85..24c9d19 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 _0x6f6b=['remove','update','emit','removeListener','register','length','userNotification:','./userNotification.events','save'];(function(_0x4c706a,_0x562598){var _0xbd9907=function(_0x413215){while(--_0x413215){_0x4c706a['push'](_0x4c706a['shift']());}};_0xbd9907(++_0x562598);}(_0x6f6b,0x1a5));var _0xb6f6=function(_0x3592ab,_0x4f669a){_0x3592ab=_0x3592ab-0x0;var _0x13298a=_0x6f6b[_0x3592ab];return _0x13298a;};'use strict';var UserNotificationEvents=require(_0xb6f6('0x0'));var events=[_0xb6f6('0x1'),_0xb6f6('0x2'),_0xb6f6('0x3')];function createListener(_0x4d324e,_0x57732f){return function(_0x1c14b4){_0x57732f[_0xb6f6('0x4')](_0x4d324e,_0x1c14b4);};}function removeListener(_0x4be813,_0x166694){return function(){UserNotificationEvents[_0xb6f6('0x5')](_0x4be813,_0x166694);};}exports[_0xb6f6('0x6')]=function(_0x9dbafb){for(var _0xe834af=0x0,_0x5d03fb=events[_0xb6f6('0x7')];_0xe834af<_0x5d03fb;_0xe834af++){var _0x10c1e8=events[_0xe834af];var _0x287515=createListener(_0xb6f6('0x8')+_0x10c1e8,_0x9dbafb);UserNotificationEvents['on'](_0x10c1e8,_0x287515);}}; \ No newline at end of file +var _0x7744=['remove','removeListener','length','./userNotification.events','save'];(function(_0x43d25b,_0x3bbd28){var _0x16707e=function(_0xce7cec){while(--_0xce7cec){_0x43d25b['push'](_0x43d25b['shift']());}};_0x16707e(++_0x3bbd28);}(_0x7744,0x1a7));var _0x4774=function(_0xc838b8,_0x2f4309){_0xc838b8=_0xc838b8-0x0;var _0x18c0be=_0x7744[_0xc838b8];return _0x18c0be;};'use strict';var UserNotificationEvents=require(_0x4774('0x0'));var events=[_0x4774('0x1'),_0x4774('0x2'),'update'];function createListener(_0x4b0953,_0x2b975f){return function(_0x5d27b7){_0x2b975f['emit'](_0x4b0953,_0x5d27b7);};}function removeListener(_0x5b6a3b,_0x3c8845){return function(){UserNotificationEvents[_0x4774('0x3')](_0x5b6a3b,_0x3c8845);};}exports['register']=function(_0xf2dcd4){for(var _0x1e1bf1=0x0,_0x4cd12f=events[_0x4774('0x4')];_0x1e1bf1<_0x4cd12f;_0x1e1bf1++){var _0xdfd56d=events[_0x1e1bf1];var _0x2057d5=createListener('userNotification:'+_0xdfd56d,_0xf2dcd4);UserNotificationEvents['on'](_0xdfd56d,_0x2057d5);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index eed30ca..da90756 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x480d09,_0x213894){var _0xc0a574=function(_0x5a5f43){while(--_0x5a5f43){_0x480d09['push'](_0x480d09['shift']());}};_0xc0a574(++_0x213894);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a58cbdb..9006424 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 _0x3329=['sequelize','exports','INTEGER'];(function(_0x24eb15,_0x4abbc9){var _0x3a2ef5=function(_0x2805f5){while(--_0x2805f5){_0x24eb15['push'](_0x24eb15['shift']());}};_0x3a2ef5(++_0x4abbc9);}(_0x3329,0x96));var _0x9332=function(_0x4a6421,_0x5b6000){_0x4a6421=_0x4a6421-0x0;var _0x22fbb7=_0x3329[_0x4a6421];return _0x22fbb7;};'use strict';var Sequelize=require(_0x9332('0x0'));module[_0x9332('0x1')]={'penalty':{'type':Sequelize[_0x9332('0x2')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 53239fc..64d8376 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 _0x4183=['exports','define','UserOpenchannelQueue','lodash','api','moment','bluebird','request-promise','path','./userOpenchannelQueue.attributes'];(function(_0x4ffd20,_0x1e83b6){var _0x49b5e2=function(_0xfdd1a6){while(--_0xfdd1a6){_0x4ffd20['push'](_0x4ffd20['shift']());}};_0x49b5e2(++_0x1e83b6);}(_0x4183,0x189));var _0x3418=function(_0x4d59bb,_0x1cb2d3){_0x4d59bb=_0x4d59bb-0x0;var _0x50e219=_0x4183[_0x4d59bb];return _0x50e219;};'use strict';var _=require(_0x3418('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3418('0x1'));var moment=require(_0x3418('0x2'));var BPromise=require(_0x3418('0x3'));var rp=require(_0x3418('0x4'));var fs=require('fs');var path=require(_0x3418('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3418('0x6'));module[_0x3418('0x7')]=function(_0x5e4f6b,_0x2610cb){return _0x5e4f6b[_0x3418('0x8')](_0x3418('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x903d=['user_has_openchannel_queues','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0x903d,0x161));var _0xd903=function(_0x482c97,_0x312802){_0x482c97=_0x482c97-0x0;var _0x11f1ee=_0x903d[_0x482c97];return _0x11f1ee;};'use strict';var _=require(_0xd903('0x0'));var util=require('util');var logger=require(_0xd903('0x1'))(_0xd903('0x2'));var moment=require(_0xd903('0x3'));var BPromise=require('bluebird');var rp=require(_0xd903('0x4'));var fs=require('fs');var path=require(_0xd903('0x5'));var rimraf=require('rimraf');var config=require(_0xd903('0x6'));var attributes=require(_0xd903('0x7'));module['exports']=function(_0x131e19,_0x52d194){return _0x131e19[_0xd903('0x8')](_0xd903('0x9'),attributes,{'tableName':_0xd903('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index c28cc46..10c0170 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 _0x5e41=['jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5e41,0x1ef));var _0x15e4=function(_0x6e3cf0,_0x300334){_0x6e3cf0=_0x6e3cf0-0x0;var _0x42aa81=_0x5e41[_0x6e3cf0];return _0x42aa81;};'use strict';var _=require(_0x15e4('0x0'));var util=require('util');var moment=require(_0x15e4('0x1'));var BPromise=require(_0x15e4('0x2'));var rs=require(_0x15e4('0x3'));var fs=require('fs');var Redis=require(_0x15e4('0x4'));var db=require(_0x15e4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15e4('0x6'))(_0x15e4('0x7'));var config=require(_0x15e4('0x8'));var jayson=require(_0x15e4('0x9'));var client=jayson[_0x15e4('0xa')][_0x15e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34d717,_0x43d75a,_0x11e03b){return new BPromise(function(_0x409fe0,_0x497808){return client[_0x15e4('0xc')](_0x34d717,_0x11e03b)[_0x15e4('0xd')](function(_0x489e01){logger[_0x15e4('0xe')](_0x15e4('0xf'),_0x43d75a,_0x15e4('0x10'));logger[_0x15e4('0x11')](_0x15e4('0x12'),_0x43d75a,'request\x20sent',JSON[_0x15e4('0x13')](_0x489e01));if(_0x489e01[_0x15e4('0x14')]){if(_0x489e01[_0x15e4('0x14')]['code']===0x1f4){logger[_0x15e4('0x14')](_0x15e4('0xf'),_0x43d75a,_0x489e01[_0x15e4('0x14')]['message']);return _0x497808(_0x489e01[_0x15e4('0x14')][_0x15e4('0x15')]);}logger[_0x15e4('0x14')](_0x15e4('0xf'),_0x43d75a,_0x489e01[_0x15e4('0x14')][_0x15e4('0x15')]);return _0x409fe0(_0x489e01['error']['message']);}else{logger['info'](_0x15e4('0xf'),_0x43d75a,_0x15e4('0x10'));_0x409fe0(_0x489e01[_0x15e4('0x16')][_0x15e4('0x15')]);}})[_0x15e4('0x17')](function(_0x2de19c){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x43d75a,_0x2de19c);_0x497808(_0x2de19c);});});} \ No newline at end of file +var _0x9c72=['client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x30d345,_0xb6e29c){var _0x1024ad=function(_0x553644){while(--_0x553644){_0x30d345['push'](_0x30d345['shift']());}};_0x1024ad(++_0xb6e29c);}(_0x9c72,0x14d));var _0x29c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9c72[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x29c7('0x0'));var util=require(_0x29c7('0x1'));var moment=require('moment');var BPromise=require(_0x29c7('0x2'));var rs=require(_0x29c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29c7('0x4'))['db'];var utils=require(_0x29c7('0x5'));var logger=require('../../config/logger')(_0x29c7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x29c7('0x7')][_0x29c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40bf02,_0x4ac619,_0x27dd34){return new BPromise(function(_0xb096fd,_0x480a75){return client[_0x29c7('0x9')](_0x40bf02,_0x27dd34)['then'](function(_0x505a12){logger[_0x29c7('0xa')](_0x29c7('0xb'),_0x4ac619,_0x29c7('0xc'));logger[_0x29c7('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4ac619,_0x29c7('0xc'),JSON[_0x29c7('0xe')](_0x505a12));if(_0x505a12['error']){if(_0x505a12[_0x29c7('0xf')][_0x29c7('0x10')]===0x1f4){logger[_0x29c7('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4ac619,_0x505a12[_0x29c7('0xf')][_0x29c7('0x11')]);return _0x480a75(_0x505a12[_0x29c7('0xf')][_0x29c7('0x11')]);}logger[_0x29c7('0xf')](_0x29c7('0xb'),_0x4ac619,_0x505a12[_0x29c7('0xf')]['message']);return _0xb096fd(_0x505a12[_0x29c7('0xf')][_0x29c7('0x11')]);}else{logger[_0x29c7('0xa')](_0x29c7('0xb'),_0x4ac619,_0x29c7('0xc'));_0xb096fd(_0x505a12[_0x29c7('0x12')]['message']);}})[_0x29c7('0x13')](function(_0x5782b9){logger['error'](_0x29c7('0xb'),_0x4ac619,_0x5782b9);_0x480a75(_0x5782b9);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index b0fa6c4..2327f4a 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 _0x7788=['describe','/:id','/:id/sections','getResources','post','create','addSections','/:id/resources','put','update','delete','destroy','removeResources','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7788,0x152));var _0x8778=function(_0x4a96d2,_0x689504){_0x4a96d2=_0x4a96d2-0x0;var _0x38af04=_0x7788[_0x4a96d2];return _0x38af04;};'use strict';var multer=require(_0x8778('0x0'));var util=require('util');var path=require(_0x8778('0x1'));var timeout=require(_0x8778('0x2'));var express=require(_0x8778('0x3'));var router=express['Router']();var fs_extra=require(_0x8778('0x4'));var auth=require(_0x8778('0x5'));var interaction=require(_0x8778('0x6'));var config=require(_0x8778('0x7'));var controller=require(_0x8778('0x8'));router[_0x8778('0x9')]('/',auth['isAuthenticated'](),controller[_0x8778('0xa')]);router['get'](_0x8778('0xb'),auth[_0x8778('0xc')](),controller[_0x8778('0xd')]);router[_0x8778('0x9')](_0x8778('0xe'),auth[_0x8778('0xc')](),controller['show']);router[_0x8778('0x9')](_0x8778('0xf'),auth[_0x8778('0xc')](),controller['getSections']);router[_0x8778('0x9')]('/:id/resources',auth[_0x8778('0xc')](),controller[_0x8778('0x10')]);router[_0x8778('0x11')]('/',auth[_0x8778('0xc')](),controller[_0x8778('0x12')]);router['post']('/:id/clone',auth[_0x8778('0xc')](),controller['clone']);router[_0x8778('0x11')](_0x8778('0xf'),auth[_0x8778('0xc')](),controller[_0x8778('0x13')]);router['post'](_0x8778('0x14'),auth['isAuthenticated'](),controller['addResources']);router[_0x8778('0x15')](_0x8778('0xe'),auth['isAuthenticated'](),controller[_0x8778('0x16')]);router[_0x8778('0x17')](_0x8778('0xe'),auth['isAuthenticated'](),controller[_0x8778('0x18')]);router[_0x8778('0x17')]('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router[_0x8778('0x17')](_0x8778('0x14'),auth[_0x8778('0xc')](),controller[_0x8778('0x19')]);module[_0x8778('0x1a')]=router; \ No newline at end of file +var _0x3bf4=['./userProfile.controller','get','isAuthenticated','index','/describe','/:id','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x6cc1eb,_0x18a40b){var _0x589a8d=function(_0x18d0c2){while(--_0x18d0c2){_0x6cc1eb['push'](_0x6cc1eb['shift']());}};_0x589a8d(++_0x18a40b);}(_0x3bf4,0x1e1));var _0x43bf=function(_0x55089a,_0x481478){_0x55089a=_0x55089a-0x0;var _0x34bc0e=_0x3bf4[_0x55089a];return _0x34bc0e;};'use strict';var multer=require('multer');var util=require(_0x43bf('0x0'));var path=require('path');var timeout=require(_0x43bf('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x43bf('0x2'));var auth=require(_0x43bf('0x3'));var interaction=require(_0x43bf('0x4'));var config=require('../../config/environment');var controller=require(_0x43bf('0x5'));router[_0x43bf('0x6')]('/',auth[_0x43bf('0x7')](),controller[_0x43bf('0x8')]);router[_0x43bf('0x6')](_0x43bf('0x9'),auth[_0x43bf('0x7')](),controller['describe']);router[_0x43bf('0x6')](_0x43bf('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x43bf('0x6')](_0x43bf('0xb'),auth[_0x43bf('0x7')](),controller[_0x43bf('0xc')]);router['get'](_0x43bf('0xd'),auth[_0x43bf('0x7')](),controller['getResources']);router[_0x43bf('0xe')]('/',auth[_0x43bf('0x7')](),controller[_0x43bf('0xf')]);router['post'](_0x43bf('0x10'),auth['isAuthenticated'](),controller[_0x43bf('0x11')]);router[_0x43bf('0xe')](_0x43bf('0xb'),auth[_0x43bf('0x7')](),controller[_0x43bf('0x12')]);router[_0x43bf('0xe')](_0x43bf('0xd'),auth[_0x43bf('0x7')](),controller[_0x43bf('0x13')]);router[_0x43bf('0x14')]('/:id',auth[_0x43bf('0x7')](),controller[_0x43bf('0x15')]);router[_0x43bf('0x16')](_0x43bf('0xa'),auth['isAuthenticated'](),controller[_0x43bf('0x17')]);router['delete'](_0x43bf('0xb'),auth[_0x43bf('0x7')](),controller[_0x43bf('0x18')]);router[_0x43bf('0x16')](_0x43bf('0xd'),auth['isAuthenticated'](),controller[_0x43bf('0x19')]);module[_0x43bf('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b28d65c..22f358b 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 _0xa5e5=['crudPermissions','BOOLEAN','sequelize','STRING','name','setDataValue','join','getDataValue'];(function(_0x4e918d,_0x2f3f41){var _0x544e82=function(_0x19e3ca){while(--_0x19e3ca){_0x4e918d['push'](_0x4e918d['shift']());}};_0x544e82(++_0x2f3f41);}(_0xa5e5,0x19a));var _0x5a5e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa5e5[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x5a5e('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a5e('0x1')],'allowNull':![],'unique':_0x5a5e('0x2')},'crudPermissions':{'type':Sequelize[_0x5a5e('0x1')],'set':function(_0x1706b3){this[_0x5a5e('0x3')]('crudPermissions',_0x1706b3?_0x1706b3[_0x5a5e('0x4')](''):[]);},'get':function(){return this[_0x5a5e('0x5')](_0x5a5e('0x6'))?this[_0x5a5e('0x5')](_0x5a5e('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5a5e('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5a5e('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5a5e('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5a5e('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xf916=['name','crudPermissions','join','split','BOOLEAN','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf916,0x108));var _0x6f91=function(_0x566e62,_0x834b1a){_0x566e62=_0x566e62-0x0;var _0x3d2039=_0xf916[_0x566e62];return _0x3d2039;};'use strict';var Sequelize=require(_0x6f91('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f91('0x1')],'allowNull':![],'unique':_0x6f91('0x2')},'crudPermissions':{'type':Sequelize[_0x6f91('0x1')],'set':function(_0xecb802){this['setDataValue'](_0x6f91('0x3'),_0xecb802?_0xecb802[_0x6f91('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x6f91('0x3'))?this['getDataValue'](_0x6f91('0x3'))[_0x6f91('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x6f91('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6f91('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x6f91('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x6f91('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x6f91('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 76fb3cb..7315112 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 _0x41dd=['attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','catch','length','omit','createdAt','updatedAt','body','sequelize','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','transaction','push','removeSections','ids','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','stack','name','send','index','map','UserProfile','fieldName','type','model','keys','query','filters','intersection'];(function(_0x3f239d,_0x1e4675){var _0x46f035=function(_0x4d80a3){while(--_0x4d80a3){_0x3f239d['push'](_0x3f239d['shift']());}};_0x46f035(++_0x1e4675);}(_0x41dd,0x11c));var _0xd41d=function(_0x25decf,_0x1db2e1){_0x25decf=_0x25decf-0x0;var _0x5a42f2=_0x41dd[_0x25decf];return _0x5a42f2;};'use strict';var emlformat=require(_0xd41d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd41d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd41d('0x2'));var BPromise=require(_0xd41d('0x3'));var Mustache=require(_0xd41d('0x4'));var util=require(_0xd41d('0x5'));var path=require(_0xd41d('0x6'));var sox=require(_0xd41d('0x7'));var csv=require('to-csv');var ejs=require(_0xd41d('0x8'));var fs=require('fs');var fs_extra=require(_0xd41d('0x9'));var _=require(_0xd41d('0xa'));var squel=require(_0xd41d('0xb'));var crypto=require(_0xd41d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd41d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd41d('0xe'));var Papa=require('papaparse');var Redis=require(_0xd41d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd41d('0x10'));var as=require(_0xd41d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd41d('0x12'))(_0xd41d('0x13'));var utils=require(_0xd41d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd41d('0x15'));var db=require(_0xd41d('0x16'))['db'];config[_0xd41d('0x17')]=_['defaults'](config[_0xd41d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xd41d('0x18'))(new Redis(config['redis']));require(_0xd41d('0x19'))[_0xd41d('0x1a')](socket);function respondWithStatusCode(_0x434185,_0x4bea93){_0x4bea93=_0x4bea93||0xcc;return function(_0x82edf3){if(_0x82edf3){return _0x434185[_0xd41d('0x1b')](_0x4bea93);}return _0x434185[_0xd41d('0x1c')](_0x4bea93)['end']();};}function respondWithResult(_0x224b7a,_0x526ce7){_0x526ce7=_0x526ce7||0xc8;return function(_0x2c4843){if(_0x2c4843){return _0x224b7a['status'](_0x526ce7)['json'](_0x2c4843);}};}function respondWithFilteredResult(_0x1aeb23,_0x16bc50){return function(_0x1d2a7d){if(_0x1d2a7d){var _0x3148fa=typeof _0x16bc50[_0xd41d('0x1d')]===_0xd41d('0x1e')&&typeof _0x16bc50[_0xd41d('0x1f')]==='undefined';var _0x5e60e0=_0x1d2a7d[_0xd41d('0x20')];var _0x3cf5a4=_0x3148fa?0x0:_0x16bc50[_0xd41d('0x1d')];var _0x37b0ce=_0x3148fa?_0x1d2a7d[_0xd41d('0x20')]:_0x16bc50[_0xd41d('0x1d')]+_0x16bc50[_0xd41d('0x1f')];var _0x3f5c4e;if(_0x37b0ce>=_0x5e60e0){_0x37b0ce=_0x5e60e0;_0x3f5c4e=0xc8;}else{_0x3f5c4e=0xce;}_0x1aeb23['status'](_0x3f5c4e);return _0x1aeb23[_0xd41d('0x21')](_0xd41d('0x22'),_0x3cf5a4+'-'+_0x37b0ce+'/'+_0x5e60e0)[_0xd41d('0x23')](_0x1d2a7d);}return null;};}function patchUpdates(_0x4db182){return function(_0x1c9b03){try{jsonpatch[_0xd41d('0x24')](_0x1c9b03,_0x4db182,!![]);}catch(_0x5606a3){return BPromise['reject'](_0x5606a3);}return _0x1c9b03[_0xd41d('0x25')]();};}function saveUpdates(_0x29aaf3,_0x4023e0){return function(_0x55cf28){if(_0x55cf28){return _0x55cf28[_0xd41d('0x26')](_0x29aaf3)[_0xd41d('0x27')](function(_0x32d1d4){return _0x32d1d4;});}return null;};}function removeEntity(_0x2728cb,_0x26d1d7){return function(_0x331d7e){if(_0x331d7e){return _0x331d7e[_0xd41d('0x28')]()[_0xd41d('0x27')](function(){_0x2728cb['status'](0xcc)[_0xd41d('0x29')]();});}};}function handleEntityNotFound(_0xf61caa,_0x1e039e){return function(_0x13f48c){if(!_0x13f48c){_0xf61caa['sendStatus'](0x194);}return _0x13f48c;};}function handleError(_0x436814,_0x1c57a6){_0x1c57a6=_0x1c57a6||0x1f4;return function(_0x18557b){logger['error'](_0x18557b[_0xd41d('0x2a')]);if(_0x18557b[_0xd41d('0x2b')]){delete _0x18557b['name'];}_0x436814[_0xd41d('0x1c')](_0x1c57a6)[_0xd41d('0x2c')](_0x18557b);};}exports[_0xd41d('0x2d')]=function(_0x3a6265,_0x3c83d1){var _0x43030f={},_0x354a10={},_0x286393={'count':0x0,'rows':[]};var _0x2f9e4c=_[_0xd41d('0x2e')](db[_0xd41d('0x2f')]['rawAttributes'],function(_0x26d667){return{'name':_0x26d667[_0xd41d('0x30')],'type':_0x26d667[_0xd41d('0x31')]['key']};});_0x354a10[_0xd41d('0x32')]=_[_0xd41d('0x2e')](_0x2f9e4c,_0xd41d('0x2b'));_0x354a10['query']=_[_0xd41d('0x33')](_0x3a6265[_0xd41d('0x34')]);_0x354a10[_0xd41d('0x35')]=_[_0xd41d('0x36')](_0x354a10[_0xd41d('0x32')],_0x354a10[_0xd41d('0x34')]);_0x43030f[_0xd41d('0x37')]=_[_0xd41d('0x36')](_0x354a10[_0xd41d('0x32')],qs['fields'](_0x3a6265[_0xd41d('0x34')][_0xd41d('0x38')]));_0x43030f['attributes']=_0x43030f['attributes']['length']?_0x43030f[_0xd41d('0x37')]:_0x354a10[_0xd41d('0x32')];if(!_0x3a6265[_0xd41d('0x34')]['hasOwnProperty'](_0xd41d('0x39'))){_0x43030f[_0xd41d('0x1f')]=qs[_0xd41d('0x1f')](_0x3a6265[_0xd41d('0x34')][_0xd41d('0x1f')]);_0x43030f[_0xd41d('0x1d')]=qs['offset'](_0x3a6265[_0xd41d('0x34')][_0xd41d('0x1d')]);}_0x43030f[_0xd41d('0x3a')]=qs[_0xd41d('0x3b')](_0x3a6265[_0xd41d('0x34')]['sort']);_0x43030f[_0xd41d('0x3c')]=qs[_0xd41d('0x35')](_[_0xd41d('0x3d')](_0x3a6265[_0xd41d('0x34')],_0x354a10[_0xd41d('0x35')]),_0x2f9e4c);if(_0x3a6265[_0xd41d('0x34')][_0xd41d('0x3e')]){_0x43030f[_0xd41d('0x3c')]=_['merge'](_0x43030f['where'],{'$or':_[_0xd41d('0x2e')](_0x2f9e4c,function(_0x371b34){if(_0x371b34['type']!==_0xd41d('0x3f')){var _0x250c93={};_0x250c93[_0x371b34[_0xd41d('0x2b')]]={'$like':'%'+_0x3a6265[_0xd41d('0x34')][_0xd41d('0x3e')]+'%'};return _0x250c93;}})});}_0x43030f=_[_0xd41d('0x40')]({},_0x43030f,_0x3a6265[_0xd41d('0x41')]);var _0x8e988d={'where':_0x43030f['where']};return db[_0xd41d('0x2f')][_0xd41d('0x20')](_0x8e988d)[_0xd41d('0x27')](function(_0x7201b9){_0x286393['count']=_0x7201b9;if(_0x3a6265[_0xd41d('0x34')][_0xd41d('0x42')]){_0x43030f[_0xd41d('0x43')]=[{'all':!![]}];}return db[_0xd41d('0x2f')][_0xd41d('0x44')](_0x43030f);})['then'](function(_0x3bbf7d){_0x286393[_0xd41d('0x45')]=_0x3bbf7d;return _0x286393;})[_0xd41d('0x27')](respondWithFilteredResult(_0x3c83d1,_0x43030f))['catch'](handleError(_0x3c83d1,null));};exports[_0xd41d('0x46')]=function(_0x3bfa6a,_0xd65420){var _0x49285e={'raw':![],'where':{'id':_0x3bfa6a[_0xd41d('0x47')]['id']}},_0xafc63e={};_0xafc63e[_0xd41d('0x32')]=_[_0xd41d('0x33')](db[_0xd41d('0x2f')][_0xd41d('0x48')]);_0xafc63e['query']=_[_0xd41d('0x33')](_0x3bfa6a[_0xd41d('0x34')]);_0xafc63e['filters']=_[_0xd41d('0x36')](_0xafc63e[_0xd41d('0x32')],_0xafc63e[_0xd41d('0x34')]);_0x49285e[_0xd41d('0x37')]=_[_0xd41d('0x36')](_0xafc63e[_0xd41d('0x32')],qs['fields'](_0x3bfa6a[_0xd41d('0x34')][_0xd41d('0x38')]));_0x49285e[_0xd41d('0x37')]=_0x49285e[_0xd41d('0x37')]['length']?_0x49285e[_0xd41d('0x37')]:_0xafc63e[_0xd41d('0x32')];if(_0x3bfa6a[_0xd41d('0x34')][_0xd41d('0x42')]){_0x49285e['include']=[{'all':!![]}];}_0x49285e=_[_0xd41d('0x40')]({},_0x49285e,_0x3bfa6a[_0xd41d('0x41')]);return db[_0xd41d('0x2f')][_0xd41d('0x49')](_0x49285e)[_0xd41d('0x27')](handleEntityNotFound(_0xd65420,null))[_0xd41d('0x27')](respondWithResult(_0xd65420,null))['catch'](handleError(_0xd65420,null));};exports['create']=function(_0xe4e9a7,_0x12088d){return db[_0xd41d('0x2f')][_0xd41d('0x4a')](_0xe4e9a7['body'],{})[_0xd41d('0x27')](respondWithResult(_0x12088d,0xc9))[_0xd41d('0x4b')](handleError(_0x12088d,null));};exports['clone']=function(_0x3d02a1,_0x3e8553){var _0x30fa68={'where':{'id':_0x3d02a1['params']['id']}},_0x4fac1d={};_0x4fac1d[_0xd41d('0x32')]=_[_0xd41d('0x33')](db[_0xd41d('0x2f')]['rawAttributes']);_0x30fa68[_0xd41d('0x37')]=_['intersection'](_0x4fac1d[_0xd41d('0x32')],qs[_0xd41d('0x38')](_0x3d02a1['query'][_0xd41d('0x38')]));_0x30fa68[_0xd41d('0x37')]=_0x30fa68[_0xd41d('0x37')][_0xd41d('0x4c')]?_0x30fa68[_0xd41d('0x37')]:_0x4fac1d[_0xd41d('0x32')];if(_0x3d02a1[_0xd41d('0x34')]['includeAll']){_0x30fa68[_0xd41d('0x43')]=[{'all':!![]}];}_0x30fa68=_['merge']({},_0x30fa68,_0x3d02a1[_0xd41d('0x41')]);return db['UserProfile'][_0xd41d('0x49')](_0x30fa68)[_0xd41d('0x27')](handleEntityNotFound(_0x3e8553,null))['then'](function(_0x2d68d8){if(_0x2d68d8){var _0x318964=_0x2d68d8['get']({'plain':!![]});_0x318964=qs[_0xd41d('0x4d')](_0x318964,['id',_0xd41d('0x4e'),_0xd41d('0x4f'),'crudPermissions']);_0x3d02a1[_0xd41d('0x50')]=_['omit'](_0x3d02a1[_0xd41d('0x50')],['id','createdAt',_0xd41d('0x4f')]);return db[_0xd41d('0x51')]['transaction'](function(_0x53dcde){return db['UserProfile'][_0xd41d('0x4a')](_[_0xd41d('0x40')](_0x318964,_0x3d02a1[_0xd41d('0x50')]),{'include':_0x3d02a1['query'][_0xd41d('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x53dcde})[_0xd41d('0x27')](function(_0x5d57d9){var _0x2cc726=_0x5d57d9[_0xd41d('0x52')]({'plain':!![]});return db[_0xd41d('0x53')]['findAll']({'where':{'userProfileId':_0x3d02a1[_0xd41d('0x47')]['id']},'raw':!![]})[_0xd41d('0x27')](function(_0xff425d){if(_0xff425d){return BPromise[_0xd41d('0x54')](_0xff425d,function(_0x564f85){return new BPromise(function(_0x36fd7b,_0x12aaaf){if(_0x564f85['autoAssociation']===null||_0x564f85[_0xd41d('0x55')]===0x1)_0x36fd7b(null);return db[_0xd41d('0x56')][_0xd41d('0x44')]({'where':{'sectionId':_0x564f85['id']},'raw':!![]})[_0xd41d('0x27')](function(_0x1b703c){var _0xd679d=_[_0xd41d('0x2e')](_0x1b703c,function(_0x10560f){return qs['omit'](_0x10560f,['id',_0xd41d('0x4e'),_0xd41d('0x4f'),_0xd41d('0x57')]);});_0x36fd7b(_0xd679d);})[_0xd41d('0x4b')](function(_0x790c8b){_0x12aaaf(_0x790c8b);});})[_0xd41d('0x27')](function(_0x22d7fe){var _0x89f6d6=qs[_0xd41d('0x4d')](_0x564f85,['id',_0xd41d('0x4e'),'updatedAt']);_0x89f6d6[_0xd41d('0x58')]=_0x2cc726['id'];if(_0x22d7fe)_0x89f6d6[_0xd41d('0x59')]=_0x22d7fe;return _0x89f6d6;})[_0xd41d('0x27')](function(_0x486e04){return db[_0xd41d('0x53')][_0xd41d('0x4a')](_0x486e04,{'include':[{'model':db[_0xd41d('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x53dcde});});})[_0xd41d('0x27')](function(){return _0x2cc726;});}});});});}})[_0xd41d('0x27')](respondWithResult(_0x3e8553,0xc9))[_0xd41d('0x4b')](handleError(_0x3e8553,null));};exports[_0xd41d('0x26')]=function(_0x9688e3,_0x33ce49){if(_0x9688e3[_0xd41d('0x50')]['id']){delete _0x9688e3[_0xd41d('0x50')]['id'];}return db[_0xd41d('0x2f')]['find']({'where':{'id':_0x9688e3[_0xd41d('0x47')]['id']}})['then'](handleEntityNotFound(_0x33ce49,null))[_0xd41d('0x27')](saveUpdates(_0x9688e3[_0xd41d('0x50')],null))[_0xd41d('0x27')](respondWithResult(_0x33ce49,null))[_0xd41d('0x4b')](handleError(_0x33ce49,null));};exports[_0xd41d('0x28')]=function(_0x2ccb0f,_0x4096dc){return db[_0xd41d('0x2f')][_0xd41d('0x49')]({'where':{'id':_0x2ccb0f['params']['id']}})[_0xd41d('0x27')](handleEntityNotFound(_0x4096dc,null))['then'](removeEntity(_0x4096dc,null))[_0xd41d('0x4b')](handleError(_0x4096dc,null));};exports[_0xd41d('0x5a')]=function(_0x1f37a0,_0x524b2b){return db[_0xd41d('0x2f')]['describe']()['then'](respondWithResult(_0x524b2b,null))[_0xd41d('0x4b')](handleError(_0x524b2b,null));};exports[_0xd41d('0x5b')]=function(_0x974556,_0x36b516){var _0x1c235d=_0x974556[_0xd41d('0x50')];return db['UserProfile'][_0xd41d('0x49')]({'where':{'id':_0x974556[_0xd41d('0x47')]['id']}})[_0xd41d('0x27')](handleEntityNotFound(_0x36b516,null))[_0xd41d('0x27')](function(_0x17624b){if(_0x17624b){return db[_0xd41d('0x51')][_0xd41d('0x5c')](function(_0x553fdb){return db[_0xd41d('0x53')][_0xd41d('0x28')]({'where':{'userProfileId':_0x974556[_0xd41d('0x47')]['id'],'sectionId':_['map'](_0x1c235d,function(_0x5dd002){return _0x5dd002[_0xd41d('0x57')];})},'transaction':_0x553fdb})['then'](function(){var _0x1fa29a=_[_0xd41d('0x2e')](_0x1c235d,function(_0x4f8d13){_0x4f8d13[_0xd41d('0x58')]=_0x974556['params']['id'];return _0x4f8d13;});var _0x4f838c=[];return BPromise[_0xd41d('0x54')](_0x1fa29a,function(_0x50d2a2){return db[_0xd41d('0x53')]['create'](_0x50d2a2,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x553fdb})[_0xd41d('0x27')](function(_0xc572a6){_0x4f838c[_0xd41d('0x5d')](_0xc572a6[_0xd41d('0x52')]({'plain':!![]}));});})[_0xd41d('0x27')](function(){return _0x4f838c;});});});}})[_0xd41d('0x27')](function(_0xf2181){return _0xf2181;})[_0xd41d('0x27')](respondWithResult(_0x36b516,null))[_0xd41d('0x4b')](handleError(_0x36b516,null));};exports[_0xd41d('0x5e')]=function(_0x3d2cd0,_0x25cf57){var _0x2a2cf7;return db['UserProfile'][_0xd41d('0x49')]({'where':{'id':_0x3d2cd0[_0xd41d('0x47')]['id']},'attributes':['id',_0xd41d('0x2b')]})['then'](handleEntityNotFound(_0x25cf57,null))[_0xd41d('0x27')](function(_0x3638f2){if(_0x3638f2){_0x2a2cf7=_0x3638f2;return db[_0xd41d('0x53')]['destroy']({'where':{'userProfileId':_0x3d2cd0[_0xd41d('0x47')]['id'],'sectionId':_0x3d2cd0[_0xd41d('0x34')][_0xd41d('0x5f')]}});}})[_0xd41d('0x27')](function(){return _0x2a2cf7;})[_0xd41d('0x27')](respondWithStatusCode(_0x25cf57,null))[_0xd41d('0x4b')](handleError(_0x25cf57,null));};exports['getSections']=function(_0x28ee6e,_0x3e4d74){var _0x3ca2f3=[];var _0x523100=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x28ee6e[_0xd41d('0x47')]['id']},'raw':!![]})[_0xd41d('0x27')](function(_0x91f4e){_0x3ca2f3=_[_0xd41d('0x3e')](_0x91f4e,function(_0x59b055){return _0x59b055[_0xd41d('0x60')]===0x1||_[_0xd41d('0x61')]([0x3eb,0x709],_0x59b055[_0xd41d('0x57')]);});if(!_[_0xd41d('0x62')](_0x3ca2f3)){return _[_0xd41d('0x2e')](_0x3ca2f3,function(_0x3bca1e){return _0x3bca1e['sectionId'];});}else{return;}})[_0xd41d('0x27')](function(_0x310857){if(_0x310857)_0x523100=_0x310857;if(_['includes'](_0x523100,0x64)){var _0x45918e=_[_0xd41d('0x49')](_0x3ca2f3,{'sectionId':0x64});return hasDefaultDashboard(_0x45918e)[_0xd41d('0x27')](function(_0x3770e6){return _[_0xd41d('0x2e')](_0x3ca2f3,function(_0x8b9d06){if(_0x8b9d06['sectionId']===0x64){_0x8b9d06[_0xd41d('0x63')]=_0x3770e6;}return _0x8b9d06;});});}else{return;}})[_0xd41d('0x27')](function(_0x2155c8){if(_0x2155c8)_0x3ca2f3=_0x2155c8;if(_['includes'](_0x523100,0x3eb)){var _0x4b5357=_[_0xd41d('0x49')](_0x3ca2f3,{'sectionId':0x3eb});return getCustomDashboards(_0x4b5357)[_0xd41d('0x27')](function(_0x211be2){return _[_0xd41d('0x2e')](_0x3ca2f3,function(_0x11cdb3){if(_0x4b5357[_0xd41d('0x60')]){if(_0x11cdb3[_0xd41d('0x57')]===0x3eb){_0x11cdb3[_0xd41d('0x63')]=_0x211be2;}}else{if(_0x11cdb3[_0xd41d('0x57')]===0x64){if(!_0x11cdb3[_0xd41d('0x63')]){_0x11cdb3['subsections']=[];}_0x11cdb3[_0xd41d('0x63')]=_0x11cdb3[_0xd41d('0x63')][_0xd41d('0x64')](_0x211be2);}}return _0x11cdb3;});});}else{return;}})[_0xd41d('0x27')](function(_0x1d174b){if(_0x1d174b)_0x3ca2f3=_0x1d174b;if(_[_0xd41d('0x61')](_0x523100,0x709)){var _0x1411fb=_['find'](_0x3ca2f3,{'sectionId':0x709});return getPlugins(_0x1411fb)[_0xd41d('0x27')](function(_0x5b8451){if(_0x1411fb[_0xd41d('0x60')]){return _[_0xd41d('0x2e')](_0x3ca2f3,function(_0x5704d7){if(_0x5704d7[_0xd41d('0x57')]===0x709){_0x5704d7['subsections']=_0x5b8451;}return _0x5704d7;});}else{var _0x17c657={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5b8451};var _0x29b7f5=_[_0xd41d('0x2e')](_0x3ca2f3);_0x29b7f5[_0xd41d('0x5d')](_0x17c657);return _0x29b7f5;}});}else{return;}})[_0xd41d('0x27')](function(_0x70d4ef){if(_0x70d4ef)_0x3ca2f3=_0x70d4ef;return _['filter'](_0x3ca2f3,[_0xd41d('0x60'),0x1]);})[_0xd41d('0x27')](respondWithResult(_0x3e4d74,null))['catch'](handleError(_0x3e4d74,null));};function hasDefaultDashboard(_0x4c7e8e){var _0x55799f=[0x65];return new BPromise(function(_0xebc6ef,_0x50dc32){try{if(_0x4c7e8e[_0xd41d('0x55')]){_0xebc6ef(_0x55799f);}else{return db[_0xd41d('0x56')][_0xd41d('0x65')]({'where':{'sectionId':_0x4c7e8e['id']},'raw':!![]})[_0xd41d('0x27')](function(_0x20f6bd){_0x20f6bd?_0xebc6ef(_0x55799f):_0xebc6ef();});}}catch(_0x755ae1){_0x50dc32(_0x755ae1);}});}function getCustomDashboards(_0x3eaeee){var _0x47f6e0=[];return new BPromise(function(_0x2e0cc2,_0x3d14ac){try{if(_0x3eaeee['autoAssociation']){return db[_0xd41d('0x66')][_0xd41d('0x44')]({'raw':!![]})[_0xd41d('0x27')](function(_0x21fda4){_0x21fda4[_0xd41d('0x67')](function(_0xd292c2){_0x47f6e0['push'](_0xd292c2['id']+0x1869f);});_0x2e0cc2(_0x47f6e0);});}else{return db['UserProfileResource'][_0xd41d('0x44')]({'where':{'sectionId':_0x3eaeee['id']},'raw':!![]})[_0xd41d('0x27')](function(_0x18d6f2){_0x18d6f2['forEach'](function(_0x74bee8){_0x47f6e0['push'](_0x74bee8['resourceId']+0x1869f);});_0x2e0cc2(_0x47f6e0);});}}catch(_0x7b67c2){_0x3d14ac(_0x7b67c2);}});}function getPlugins(_0x29a58b){var _0x5c6d12=[];return new BPromise(function(_0xe58ccc,_0x2c8a88){try{if(_0x29a58b[_0xd41d('0x55')]){return db[_0xd41d('0x68')][_0xd41d('0x44')]({'raw':!![]})[_0xd41d('0x27')](function(_0x2b585c){_0x2b585c[_0xd41d('0x67')](function(_0x32c042){_0x5c6d12['push'](_0x32c042['id']+0x15b38);});_0xe58ccc(_0x5c6d12);});}else{return db[_0xd41d('0x56')]['findAll']({'where':{'sectionId':_0x29a58b['id']},'raw':!![]})[_0xd41d('0x27')](function(_0x2ca47c){_0x2ca47c[_0xd41d('0x67')](function(_0x30b8a1){_0x5c6d12[_0xd41d('0x5d')](_0x30b8a1['resourceId']+0x15b38);});_0xe58ccc(_0x5c6d12);});}}catch(_0x415286){_0x2c8a88(_0x415286);}});}exports[_0xd41d('0x69')]=function(_0x156469,_0x5207b8){return db[_0xd41d('0x2f')][_0xd41d('0x49')]({'where':{'id':_0x156469[_0xd41d('0x47')]['id']}})['then'](handleEntityNotFound(_0x5207b8,null))[_0xd41d('0x27')](function(_0x4b98f4){if(_0x4b98f4){return db['sequelize'][_0xd41d('0x5c')](function(_0x47d12f){return db['UserProfileSection'][_0xd41d('0x44')]({'where':{'userProfileId':_0x156469['params']['id']},'attributes':['id'],'raw':!![]})[_0xd41d('0x27')](function(_0x1cef04){if(_0x1cef04){return db[_0xd41d('0x53')]['destroy']({'where':{'userProfileId':_0x156469[_0xd41d('0x47')]['id'],'id':_['map'](_0x1cef04,function(_0x57e084){return _0x57e084['id'];})},'transaction':_0x47d12f});}})[_0xd41d('0x27')](function(_0xda24d6){var _0x38e7e6=_[_0xd41d('0x2e')](_0x156469[_0xd41d('0x50')],function(_0x1f2210){_0x1f2210[_0xd41d('0x58')]=_0x156469[_0xd41d('0x47')]['id'];return _0x1f2210;});return db[_0xd41d('0x53')][_0xd41d('0x6a')](_0x38e7e6,{'raw':!![],'transaction':_0x47d12f});})[_0xd41d('0x27')](function(_0x490c07){var _0x21e492=_['filter'](_[_0xd41d('0x2e')](_0x490c07,function(_0x437b97){return _0x437b97[_0xd41d('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x21e492){return db[_0xd41d('0x53')][_0xd41d('0x44')]({'where':{'userProfileId':_0x156469[_0xd41d('0x47')]['id'],'sectionId':_[_0xd41d('0x2e')](_0x21e492,function(_0x1b8bde){return _0x1b8bde[_0xd41d('0x57')];})},'attributes':['id',_0xd41d('0x57')],'raw':!![]})[_0xd41d('0x27')](function(_0x367cea){var _0x2580b3=_[_0xd41d('0x2e')](_0x156469['body'],function(_0x2d8ad4){_0x2d8ad4[_0xd41d('0x58')]=_0x156469['params']['id'];return _0x2d8ad4;});return db[_0xd41d('0x56')]['bulkCreate'](_0x2580b3,{'raw':!![],'transaction':_0x47d12f});});}})['catch'](handleError(_0x5207b8,null));});}})['then'](function(_0x13c288){var _0x38f3b0=_['map'](_0x13c288,function(_0x3025fe){return _0x3025fe['get']({'plain':!![]});});})[_0xd41d('0x27')](respondWithResult(_0x5207b8,null))[_0xd41d('0x4b')](handleError(_0x5207b8,null));};exports[_0xd41d('0x6b')]=function(_0x123ead,_0x29d15b,_0x109fde){return db['UserProfile']['find']({'where':{'id':_0x123ead['params']['id']}})['then'](handleEntityNotFound(_0x29d15b,null))['then'](function(_0x23ce59){if(_0x23ce59){return _0x23ce59['removeResources'](_0x123ead[_0xd41d('0x34')][_0xd41d('0x5f')]);}})['then'](respondWithStatusCode(_0x29d15b,null))[_0xd41d('0x4b')](handleError(_0x29d15b,null));};exports['getResources']=function(_0xb757fb,_0x4bbfc2){var _0x1815fe={};if(!_0xb757fb['query'][_0xd41d('0x6c')])throw new Error(_0xd41d('0x6d'));if(!_0xb757fb[_0xd41d('0x34')][_0xd41d('0x6e')](_0xd41d('0x39'))){_0x1815fe[_0xd41d('0x1f')]=qs[_0xd41d('0x1f')](_0xb757fb[_0xd41d('0x34')][_0xd41d('0x1f')]);_0x1815fe['offset']=qs['offset'](_0xb757fb[_0xd41d('0x34')][_0xd41d('0x1d')]);}return db['UserProfile'][_0xd41d('0x49')]({'where':{'id':_0xb757fb[_0xd41d('0x47')]['id']}})[_0xd41d('0x27')](function(_0x3fab9c){if(!_0x3fab9c)throw new Error(_0xd41d('0x6f')+_0xb757fb[_0xd41d('0x47')]['id']);return db[_0xd41d('0x2f')][_0xd41d('0x70')](_0xb757fb);})[_0xd41d('0x27')](respondWithFilteredResult(_0x4bbfc2,_0x1815fe))['catch'](handleError(_0x4bbfc2,null));}; \ No newline at end of file +var _0xfd2f=['map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','count','include','rows','catch','show','params','includeAll','create','body','options','find','get','omit','updatedAt','crudPermissions','createdAt','transaction','findAll','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','update','describe','addSections','sequelize','each','push','removeSections','ids','getSections','enabled','includes','subsections','concat','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','limit','offset','json','apply','reject','save','destroy','then','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model'];(function(_0x5628d5,_0x390bbe){var _0x5c8a2e=function(_0x84386){while(--_0x84386){_0x5628d5['push'](_0x5628d5['shift']());}};_0x5c8a2e(++_0x390bbe);}(_0xfd2f,0x11c));var _0xffd2=function(_0x29d91c,_0x399588){_0x29d91c=_0x29d91c-0x0;var _0x502451=_0xfd2f[_0x29d91c];return _0x502451;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xffd2('0x0'));var zipdir=require(_0xffd2('0x1'));var jsonpatch=require(_0xffd2('0x2'));var rp=require(_0xffd2('0x3'));var moment=require('moment');var BPromise=require(_0xffd2('0x4'));var Mustache=require(_0xffd2('0x5'));var util=require(_0xffd2('0x6'));var path=require(_0xffd2('0x7'));var sox=require(_0xffd2('0x8'));var csv=require(_0xffd2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xffd2('0xa'));var crypto=require('crypto');var jsforce=require(_0xffd2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xffd2('0x9'));var querystring=require(_0xffd2('0xc'));var Papa=require('papaparse');var Redis=require(_0xffd2('0xd'));var authService=require(_0xffd2('0xe'));var qs=require(_0xffd2('0xf'));var as=require(_0xffd2('0x10'));var hardwareService=require(_0xffd2('0x11'));var logger=require(_0xffd2('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xffd2('0x13'));var licenseUtil=require(_0xffd2('0x14'));var db=require(_0xffd2('0x15'))['db'];config[_0xffd2('0x16')]=_[_0xffd2('0x17')](config[_0xffd2('0x16')],{'host':_0xffd2('0x18'),'port':0x18eb});var socket=require(_0xffd2('0x19'))(new Redis(config[_0xffd2('0x16')]));require(_0xffd2('0x1a'))[_0xffd2('0x1b')](socket);function respondWithStatusCode(_0x94b5cf,_0x42e33c){_0x42e33c=_0x42e33c||0xcc;return function(_0x5da64b){if(_0x5da64b){return _0x94b5cf[_0xffd2('0x1c')](_0x42e33c);}return _0x94b5cf[_0xffd2('0x1d')](_0x42e33c)[_0xffd2('0x1e')]();};}function respondWithResult(_0x441f01,_0x38c0d2){_0x38c0d2=_0x38c0d2||0xc8;return function(_0x10f94c){if(_0x10f94c){return _0x441f01['status'](_0x38c0d2)['json'](_0x10f94c);}};}function respondWithFilteredResult(_0x542191,_0x1b9fbd){return function(_0x3a8731){if(_0x3a8731){var _0x177c0e=typeof _0x1b9fbd['offset']==='undefined'&&typeof _0x1b9fbd[_0xffd2('0x1f')]==='undefined';var _0x240200=_0x3a8731['count'];var _0x4a190f=_0x177c0e?0x0:_0x1b9fbd[_0xffd2('0x20')];var _0x1cfa08=_0x177c0e?_0x3a8731['count']:_0x1b9fbd[_0xffd2('0x20')]+_0x1b9fbd[_0xffd2('0x1f')];var _0x180fc4;if(_0x1cfa08>=_0x240200){_0x1cfa08=_0x240200;_0x180fc4=0xc8;}else{_0x180fc4=0xce;}_0x542191[_0xffd2('0x1d')](_0x180fc4);return _0x542191['set']('Content-Range',_0x4a190f+'-'+_0x1cfa08+'/'+_0x240200)[_0xffd2('0x21')](_0x3a8731);}return null;};}function patchUpdates(_0x2e229e){return function(_0x38217f){try{jsonpatch[_0xffd2('0x22')](_0x38217f,_0x2e229e,!![]);}catch(_0x16d534){return BPromise[_0xffd2('0x23')](_0x16d534);}return _0x38217f[_0xffd2('0x24')]();};}function saveUpdates(_0x15ba53,_0x340462){return function(_0x24cb06){if(_0x24cb06){return _0x24cb06['update'](_0x15ba53)['then'](function(_0x3ccb41){return _0x3ccb41;});}return null;};}function removeEntity(_0x14dd91,_0x527513){return function(_0x84d8d9){if(_0x84d8d9){return _0x84d8d9[_0xffd2('0x25')]()[_0xffd2('0x26')](function(){_0x14dd91[_0xffd2('0x1d')](0xcc)[_0xffd2('0x1e')]();});}};}function handleEntityNotFound(_0x2ffddc,_0x400f43){return function(_0x4baab8){if(!_0x4baab8){_0x2ffddc[_0xffd2('0x1c')](0x194);}return _0x4baab8;};}function handleError(_0x3342e1,_0x1592c6){_0x1592c6=_0x1592c6||0x1f4;return function(_0x4634cd){logger['error'](_0x4634cd[_0xffd2('0x27')]);if(_0x4634cd[_0xffd2('0x28')]){delete _0x4634cd['name'];}_0x3342e1[_0xffd2('0x1d')](_0x1592c6)[_0xffd2('0x29')](_0x4634cd);};}exports[_0xffd2('0x2a')]=function(_0x42b06d,_0x8430c1){var _0x18890a={},_0x3adad4={},_0x1e6bdd={'count':0x0,'rows':[]};var _0x2032ef=_['map'](db[_0xffd2('0x2b')][_0xffd2('0x2c')],function(_0x17a2eb){return{'name':_0x17a2eb[_0xffd2('0x2d')],'type':_0x17a2eb[_0xffd2('0x2e')][_0xffd2('0x2f')]};});_0x3adad4[_0xffd2('0x30')]=_[_0xffd2('0x31')](_0x2032ef,_0xffd2('0x28'));_0x3adad4[_0xffd2('0x32')]=_[_0xffd2('0x33')](_0x42b06d[_0xffd2('0x32')]);_0x3adad4[_0xffd2('0x34')]=_[_0xffd2('0x35')](_0x3adad4['model'],_0x3adad4[_0xffd2('0x32')]);_0x18890a['attributes']=_[_0xffd2('0x35')](_0x3adad4[_0xffd2('0x30')],qs['fields'](_0x42b06d['query'][_0xffd2('0x36')]));_0x18890a[_0xffd2('0x37')]=_0x18890a[_0xffd2('0x37')][_0xffd2('0x38')]?_0x18890a['attributes']:_0x3adad4[_0xffd2('0x30')];if(!_0x42b06d[_0xffd2('0x32')]['hasOwnProperty'](_0xffd2('0x39'))){_0x18890a[_0xffd2('0x1f')]=qs['limit'](_0x42b06d['query'][_0xffd2('0x1f')]);_0x18890a[_0xffd2('0x20')]=qs[_0xffd2('0x20')](_0x42b06d['query'][_0xffd2('0x20')]);}_0x18890a[_0xffd2('0x3a')]=qs[_0xffd2('0x3b')](_0x42b06d[_0xffd2('0x32')][_0xffd2('0x3b')]);_0x18890a[_0xffd2('0x3c')]=qs[_0xffd2('0x34')](_[_0xffd2('0x3d')](_0x42b06d[_0xffd2('0x32')],_0x3adad4['filters']),_0x2032ef);if(_0x42b06d[_0xffd2('0x32')]['filter']){_0x18890a['where']=_[_0xffd2('0x3e')](_0x18890a[_0xffd2('0x3c')],{'$or':_[_0xffd2('0x31')](_0x2032ef,function(_0x7d1c26){if(_0x7d1c26['type']!=='VIRTUAL'){var _0xa3c019={};_0xa3c019[_0x7d1c26[_0xffd2('0x28')]]={'$like':'%'+_0x42b06d[_0xffd2('0x32')][_0xffd2('0x3f')]+'%'};return _0xa3c019;}})});}_0x18890a=_[_0xffd2('0x3e')]({},_0x18890a,_0x42b06d['options']);var _0x444bc7={'where':_0x18890a[_0xffd2('0x3c')]};return db['UserProfile']['count'](_0x444bc7)[_0xffd2('0x26')](function(_0x25dbd7){_0x1e6bdd[_0xffd2('0x40')]=_0x25dbd7;if(_0x42b06d[_0xffd2('0x32')]['includeAll']){_0x18890a[_0xffd2('0x41')]=[{'all':!![]}];}return db[_0xffd2('0x2b')]['findAll'](_0x18890a);})[_0xffd2('0x26')](function(_0x51f669){_0x1e6bdd[_0xffd2('0x42')]=_0x51f669;return _0x1e6bdd;})[_0xffd2('0x26')](respondWithFilteredResult(_0x8430c1,_0x18890a))[_0xffd2('0x43')](handleError(_0x8430c1,null));};exports[_0xffd2('0x44')]=function(_0x475d8a,_0x2c9c56){var _0x5ca24a={'raw':![],'where':{'id':_0x475d8a[_0xffd2('0x45')]['id']}},_0x502923={};_0x502923[_0xffd2('0x30')]=_[_0xffd2('0x33')](db[_0xffd2('0x2b')]['rawAttributes']);_0x502923[_0xffd2('0x32')]=_['keys'](_0x475d8a[_0xffd2('0x32')]);_0x502923['filters']=_[_0xffd2('0x35')](_0x502923[_0xffd2('0x30')],_0x502923['query']);_0x5ca24a[_0xffd2('0x37')]=_[_0xffd2('0x35')](_0x502923[_0xffd2('0x30')],qs[_0xffd2('0x36')](_0x475d8a['query'][_0xffd2('0x36')]));_0x5ca24a['attributes']=_0x5ca24a[_0xffd2('0x37')]['length']?_0x5ca24a[_0xffd2('0x37')]:_0x502923[_0xffd2('0x30')];if(_0x475d8a[_0xffd2('0x32')][_0xffd2('0x46')]){_0x5ca24a[_0xffd2('0x41')]=[{'all':!![]}];}_0x5ca24a=_[_0xffd2('0x3e')]({},_0x5ca24a,_0x475d8a['options']);return db[_0xffd2('0x2b')]['find'](_0x5ca24a)['then'](handleEntityNotFound(_0x2c9c56,null))[_0xffd2('0x26')](respondWithResult(_0x2c9c56,null))[_0xffd2('0x43')](handleError(_0x2c9c56,null));};exports[_0xffd2('0x47')]=function(_0x2ff302,_0x525b31){return db['UserProfile']['create'](_0x2ff302[_0xffd2('0x48')],{})['then'](respondWithResult(_0x525b31,0xc9))[_0xffd2('0x43')](handleError(_0x525b31,null));};exports['clone']=function(_0x538d3b,_0x4cc5e1){var _0x5c4460={'where':{'id':_0x538d3b[_0xffd2('0x45')]['id']}},_0x9acdb={};_0x9acdb[_0xffd2('0x30')]=_['keys'](db['UserProfile']['rawAttributes']);_0x5c4460[_0xffd2('0x37')]=_[_0xffd2('0x35')](_0x9acdb[_0xffd2('0x30')],qs[_0xffd2('0x36')](_0x538d3b[_0xffd2('0x32')]['fields']));_0x5c4460[_0xffd2('0x37')]=_0x5c4460[_0xffd2('0x37')][_0xffd2('0x38')]?_0x5c4460[_0xffd2('0x37')]:_0x9acdb[_0xffd2('0x30')];if(_0x538d3b[_0xffd2('0x32')][_0xffd2('0x46')]){_0x5c4460['include']=[{'all':!![]}];}_0x5c4460=_[_0xffd2('0x3e')]({},_0x5c4460,_0x538d3b[_0xffd2('0x49')]);return db[_0xffd2('0x2b')][_0xffd2('0x4a')](_0x5c4460)[_0xffd2('0x26')](handleEntityNotFound(_0x4cc5e1,null))[_0xffd2('0x26')](function(_0x1367b2){if(_0x1367b2){var _0x36be00=_0x1367b2[_0xffd2('0x4b')]({'plain':!![]});_0x36be00=qs[_0xffd2('0x4c')](_0x36be00,['id','createdAt',_0xffd2('0x4d'),_0xffd2('0x4e')]);_0x538d3b[_0xffd2('0x48')]=_[_0xffd2('0x4c')](_0x538d3b[_0xffd2('0x48')],['id',_0xffd2('0x4f'),_0xffd2('0x4d')]);return db['sequelize'][_0xffd2('0x50')](function(_0x13f745){return db[_0xffd2('0x2b')][_0xffd2('0x47')](_[_0xffd2('0x3e')](_0x36be00,_0x538d3b[_0xffd2('0x48')]),{'include':_0x538d3b[_0xffd2('0x32')][_0xffd2('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x13f745})['then'](function(_0x41958b){var _0x39f81b=_0x41958b[_0xffd2('0x4b')]({'plain':!![]});return db['UserProfileSection'][_0xffd2('0x51')]({'where':{'userProfileId':_0x538d3b[_0xffd2('0x45')]['id']},'raw':!![]})['then'](function(_0x50efb4){if(_0x50efb4){return BPromise['each'](_0x50efb4,function(_0x1a6464){return new BPromise(function(_0x25a91d,_0x2508c0){if(_0x1a6464[_0xffd2('0x52')]===null||_0x1a6464[_0xffd2('0x52')]===0x1)_0x25a91d(null);return db[_0xffd2('0x53')][_0xffd2('0x51')]({'where':{'sectionId':_0x1a6464['id']},'raw':!![]})['then'](function(_0x290745){var _0x2a5432=_['map'](_0x290745,function(_0x946259){return qs['omit'](_0x946259,['id',_0xffd2('0x4f'),_0xffd2('0x4d'),_0xffd2('0x54')]);});_0x25a91d(_0x2a5432);})['catch'](function(_0x1876ae){_0x2508c0(_0x1876ae);});})['then'](function(_0x20ffd2){var _0x1f75c1=qs[_0xffd2('0x4c')](_0x1a6464,['id',_0xffd2('0x4f'),_0xffd2('0x4d')]);_0x1f75c1[_0xffd2('0x55')]=_0x39f81b['id'];if(_0x20ffd2)_0x1f75c1[_0xffd2('0x56')]=_0x20ffd2;return _0x1f75c1;})[_0xffd2('0x26')](function(_0x2fdd94){return db[_0xffd2('0x57')]['create'](_0x2fdd94,{'include':[{'model':db[_0xffd2('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x13f745});});})[_0xffd2('0x26')](function(){return _0x39f81b;});}});});});}})[_0xffd2('0x26')](respondWithResult(_0x4cc5e1,0xc9))['catch'](handleError(_0x4cc5e1,null));};exports[_0xffd2('0x58')]=function(_0xce4b29,_0x43aff5){if(_0xce4b29[_0xffd2('0x48')]['id']){delete _0xce4b29['body']['id'];}return db[_0xffd2('0x2b')]['find']({'where':{'id':_0xce4b29['params']['id']}})['then'](handleEntityNotFound(_0x43aff5,null))['then'](saveUpdates(_0xce4b29[_0xffd2('0x48')],null))[_0xffd2('0x26')](respondWithResult(_0x43aff5,null))[_0xffd2('0x43')](handleError(_0x43aff5,null));};exports[_0xffd2('0x25')]=function(_0x1e84d7,_0x4dd5ec){return db['UserProfile'][_0xffd2('0x4a')]({'where':{'id':_0x1e84d7[_0xffd2('0x45')]['id']}})[_0xffd2('0x26')](handleEntityNotFound(_0x4dd5ec,null))['then'](removeEntity(_0x4dd5ec,null))[_0xffd2('0x43')](handleError(_0x4dd5ec,null));};exports[_0xffd2('0x59')]=function(_0x2fb5d0,_0x5136f7){return db['UserProfile'][_0xffd2('0x59')]()[_0xffd2('0x26')](respondWithResult(_0x5136f7,null))[_0xffd2('0x43')](handleError(_0x5136f7,null));};exports[_0xffd2('0x5a')]=function(_0x1e1075,_0x29fe03){var _0x27041d=_0x1e1075[_0xffd2('0x48')];return db['UserProfile'][_0xffd2('0x4a')]({'where':{'id':_0x1e1075['params']['id']}})[_0xffd2('0x26')](handleEntityNotFound(_0x29fe03,null))[_0xffd2('0x26')](function(_0x13d623){if(_0x13d623){return db[_0xffd2('0x5b')]['transaction'](function(_0x496cad){return db[_0xffd2('0x57')][_0xffd2('0x25')]({'where':{'userProfileId':_0x1e1075[_0xffd2('0x45')]['id'],'sectionId':_[_0xffd2('0x31')](_0x27041d,function(_0x2eb77){return _0x2eb77[_0xffd2('0x54')];})},'transaction':_0x496cad})[_0xffd2('0x26')](function(){var _0x36488f=_[_0xffd2('0x31')](_0x27041d,function(_0x5d01b1){_0x5d01b1['userProfileId']=_0x1e1075[_0xffd2('0x45')]['id'];return _0x5d01b1;});var _0x367a52=[];return BPromise[_0xffd2('0x5c')](_0x36488f,function(_0x635621){return db[_0xffd2('0x57')][_0xffd2('0x47')](_0x635621,{'include':[{'model':db[_0xffd2('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x496cad})[_0xffd2('0x26')](function(_0xc56742){_0x367a52[_0xffd2('0x5d')](_0xc56742[_0xffd2('0x4b')]({'plain':!![]}));});})[_0xffd2('0x26')](function(){return _0x367a52;});});});}})[_0xffd2('0x26')](function(_0x1c2ed1){return _0x1c2ed1;})[_0xffd2('0x26')](respondWithResult(_0x29fe03,null))[_0xffd2('0x43')](handleError(_0x29fe03,null));};exports[_0xffd2('0x5e')]=function(_0x5090a4,_0x21939c){var _0x59a4d5;return db['UserProfile'][_0xffd2('0x4a')]({'where':{'id':_0x5090a4[_0xffd2('0x45')]['id']},'attributes':['id',_0xffd2('0x28')]})['then'](handleEntityNotFound(_0x21939c,null))[_0xffd2('0x26')](function(_0x4cd508){if(_0x4cd508){_0x59a4d5=_0x4cd508;return db[_0xffd2('0x57')][_0xffd2('0x25')]({'where':{'userProfileId':_0x5090a4[_0xffd2('0x45')]['id'],'sectionId':_0x5090a4['query'][_0xffd2('0x5f')]}});}})[_0xffd2('0x26')](function(){return _0x59a4d5;})[_0xffd2('0x26')](respondWithStatusCode(_0x21939c,null))['catch'](handleError(_0x21939c,null));};exports[_0xffd2('0x60')]=function(_0x41fd30,_0x2428f7){var _0xd3430d=[];var _0xf67cd9=[];return db[_0xffd2('0x57')]['findAll']({'where':{'userProfileId':_0x41fd30[_0xffd2('0x45')]['id']},'raw':!![]})[_0xffd2('0x26')](function(_0x33ec5a){_0xd3430d=_[_0xffd2('0x3f')](_0x33ec5a,function(_0x5337a5){return _0x5337a5[_0xffd2('0x61')]===0x1||_[_0xffd2('0x62')]([0x3eb,0x709],_0x5337a5[_0xffd2('0x54')]);});if(!_['isEmpty'](_0xd3430d)){return _[_0xffd2('0x31')](_0xd3430d,function(_0x54e1e9){return _0x54e1e9['sectionId'];});}else{return;}})['then'](function(_0x19c2e8){if(_0x19c2e8)_0xf67cd9=_0x19c2e8;if(_[_0xffd2('0x62')](_0xf67cd9,0x64)){var _0x29fc4b=_[_0xffd2('0x4a')](_0xd3430d,{'sectionId':0x64});return hasDefaultDashboard(_0x29fc4b)['then'](function(_0x2124b3){return _['map'](_0xd3430d,function(_0x58e438){if(_0x58e438['sectionId']===0x64){_0x58e438['subsections']=_0x2124b3;}return _0x58e438;});});}else{return;}})[_0xffd2('0x26')](function(_0x41435f){if(_0x41435f)_0xd3430d=_0x41435f;if(_[_0xffd2('0x62')](_0xf67cd9,0x3eb)){var _0x102b99=_[_0xffd2('0x4a')](_0xd3430d,{'sectionId':0x3eb});return getCustomDashboards(_0x102b99)[_0xffd2('0x26')](function(_0x583959){return _[_0xffd2('0x31')](_0xd3430d,function(_0x582222){if(_0x102b99['enabled']){if(_0x582222[_0xffd2('0x54')]===0x3eb){_0x582222[_0xffd2('0x63')]=_0x583959;}}else{if(_0x582222['sectionId']===0x64){if(!_0x582222[_0xffd2('0x63')]){_0x582222[_0xffd2('0x63')]=[];}_0x582222[_0xffd2('0x63')]=_0x582222['subsections'][_0xffd2('0x64')](_0x583959);}}return _0x582222;});});}else{return;}})[_0xffd2('0x26')](function(_0x16fcd5){if(_0x16fcd5)_0xd3430d=_0x16fcd5;if(_[_0xffd2('0x62')](_0xf67cd9,0x709)){var _0x1dab05=_[_0xffd2('0x4a')](_0xd3430d,{'sectionId':0x709});return getPlugins(_0x1dab05)[_0xffd2('0x26')](function(_0x114bb8){if(_0x1dab05[_0xffd2('0x61')]){return _[_0xffd2('0x31')](_0xd3430d,function(_0x84da30){if(_0x84da30['sectionId']===0x709){_0x84da30[_0xffd2('0x63')]=_0x114bb8;}return _0x84da30;});}else{var _0x3c42f0={'sectionId':0x76c,'enabled':0x1,'subsections':_0x114bb8};var _0x5ccb49=_[_0xffd2('0x31')](_0xd3430d);_0x5ccb49[_0xffd2('0x5d')](_0x3c42f0);return _0x5ccb49;}});}else{return;}})[_0xffd2('0x26')](function(_0x3c13f2){if(_0x3c13f2)_0xd3430d=_0x3c13f2;return _[_0xffd2('0x3f')](_0xd3430d,['enabled',0x1]);})['then'](respondWithResult(_0x2428f7,null))[_0xffd2('0x43')](handleError(_0x2428f7,null));};function hasDefaultDashboard(_0x34d525){var _0x1e4957=[0x65];return new BPromise(function(_0x5345dd,_0x5f10fc){try{if(_0x34d525[_0xffd2('0x52')]){_0x5345dd(_0x1e4957);}else{return db[_0xffd2('0x53')][_0xffd2('0x65')]({'where':{'sectionId':_0x34d525['id']},'raw':!![]})[_0xffd2('0x26')](function(_0xc7c08c){_0xc7c08c?_0x5345dd(_0x1e4957):_0x5345dd();});}}catch(_0xc4572b){_0x5f10fc(_0xc4572b);}});}function getCustomDashboards(_0x3a3078){var _0x1eb17f=[];return new BPromise(function(_0x466336,_0x43e1d2){try{if(_0x3a3078[_0xffd2('0x52')]){return db['Dashboard'][_0xffd2('0x51')]({'raw':!![]})[_0xffd2('0x26')](function(_0x56eac1){_0x56eac1['forEach'](function(_0x6defa8){_0x1eb17f['push'](_0x6defa8['id']+0x1869f);});_0x466336(_0x1eb17f);});}else{return db[_0xffd2('0x53')][_0xffd2('0x51')]({'where':{'sectionId':_0x3a3078['id']},'raw':!![]})[_0xffd2('0x26')](function(_0x33cc7f){_0x33cc7f[_0xffd2('0x66')](function(_0xb05245){_0x1eb17f['push'](_0xb05245[_0xffd2('0x67')]+0x1869f);});_0x466336(_0x1eb17f);});}}catch(_0x7f5576){_0x43e1d2(_0x7f5576);}});}function getPlugins(_0x1b67f6){var _0x412a15=[];return new BPromise(function(_0x525a2d,_0x1d9fe0){try{if(_0x1b67f6[_0xffd2('0x52')]){return db[_0xffd2('0x68')][_0xffd2('0x51')]({'raw':!![]})[_0xffd2('0x26')](function(_0x16d168){_0x16d168['forEach'](function(_0x3542c){_0x412a15[_0xffd2('0x5d')](_0x3542c['id']+0x15b38);});_0x525a2d(_0x412a15);});}else{return db[_0xffd2('0x53')][_0xffd2('0x51')]({'where':{'sectionId':_0x1b67f6['id']},'raw':!![]})[_0xffd2('0x26')](function(_0xaebcaa){_0xaebcaa['forEach'](function(_0x3e415d){_0x412a15[_0xffd2('0x5d')](_0x3e415d[_0xffd2('0x67')]+0x15b38);});_0x525a2d(_0x412a15);});}}catch(_0x2e8cfb){_0x1d9fe0(_0x2e8cfb);}});}exports['addResources']=function(_0x2e7e22,_0x3973a5){return db['UserProfile']['find']({'where':{'id':_0x2e7e22[_0xffd2('0x45')]['id']}})['then'](handleEntityNotFound(_0x3973a5,null))[_0xffd2('0x26')](function(_0x199224){if(_0x199224){return db[_0xffd2('0x5b')][_0xffd2('0x50')](function(_0x1d828a){return db['UserProfileSection'][_0xffd2('0x51')]({'where':{'userProfileId':_0x2e7e22[_0xffd2('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0xffd2('0x26')](function(_0x5159a9){if(_0x5159a9){return db[_0xffd2('0x57')][_0xffd2('0x25')]({'where':{'userProfileId':_0x2e7e22['params']['id'],'id':_[_0xffd2('0x31')](_0x5159a9,function(_0x239d45){return _0x239d45['id'];})},'transaction':_0x1d828a});}})[_0xffd2('0x26')](function(_0x198d48){var _0xfa2b93=_[_0xffd2('0x31')](_0x2e7e22[_0xffd2('0x48')],function(_0x5a4773){_0x5a4773[_0xffd2('0x55')]=_0x2e7e22[_0xffd2('0x45')]['id'];return _0x5a4773;});return db[_0xffd2('0x57')][_0xffd2('0x69')](_0xfa2b93,{'raw':!![],'transaction':_0x1d828a});})[_0xffd2('0x26')](function(_0x8f5a58){var _0x60544d=_[_0xffd2('0x3f')](_['map'](_0x8f5a58,function(_0xc33865){return _0xc33865['get']({'plain':!![]});}),{'includeAll':![]});if(_0x60544d){return db[_0xffd2('0x57')][_0xffd2('0x51')]({'where':{'userProfileId':_0x2e7e22['params']['id'],'sectionId':_['map'](_0x60544d,function(_0x52e73c){return _0x52e73c[_0xffd2('0x54')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xffd2('0x26')](function(_0x54b794){var _0x3141e2=_['map'](_0x2e7e22[_0xffd2('0x48')],function(_0x280d9e){_0x280d9e[_0xffd2('0x55')]=_0x2e7e22[_0xffd2('0x45')]['id'];return _0x280d9e;});return db['UserProfileResource'][_0xffd2('0x69')](_0x3141e2,{'raw':!![],'transaction':_0x1d828a});});}})['catch'](handleError(_0x3973a5,null));});}})[_0xffd2('0x26')](function(_0xd5bd31){var _0x107245=_[_0xffd2('0x31')](_0xd5bd31,function(_0x3014c7){return _0x3014c7['get']({'plain':!![]});});})[_0xffd2('0x26')](respondWithResult(_0x3973a5,null))[_0xffd2('0x43')](handleError(_0x3973a5,null));};exports['removeResources']=function(_0x228c76,_0x513965,_0x4ba2f1){return db['UserProfile']['find']({'where':{'id':_0x228c76[_0xffd2('0x45')]['id']}})[_0xffd2('0x26')](handleEntityNotFound(_0x513965,null))[_0xffd2('0x26')](function(_0x3cb16c){if(_0x3cb16c){return _0x3cb16c[_0xffd2('0x6a')](_0x228c76[_0xffd2('0x32')][_0xffd2('0x5f')]);}})[_0xffd2('0x26')](respondWithStatusCode(_0x513965,null))[_0xffd2('0x43')](handleError(_0x513965,null));};exports[_0xffd2('0x6b')]=function(_0x559f06,_0x835e3){var _0x41010f={};if(!_0x559f06[_0xffd2('0x32')]['section'])throw new Error(_0xffd2('0x6c'));if(!_0x559f06['query'][_0xffd2('0x6d')]('nolimit')){_0x41010f[_0xffd2('0x1f')]=qs[_0xffd2('0x1f')](_0x559f06[_0xffd2('0x32')][_0xffd2('0x1f')]);_0x41010f[_0xffd2('0x20')]=qs[_0xffd2('0x20')](_0x559f06[_0xffd2('0x32')][_0xffd2('0x20')]);}return db[_0xffd2('0x2b')][_0xffd2('0x4a')]({'where':{'id':_0x559f06[_0xffd2('0x45')]['id']}})[_0xffd2('0x26')](function(_0x56d6d8){if(!_0x56d6d8)throw new Error(_0xffd2('0x6e')+_0x559f06['params']['id']);return db['UserProfile'][_0xffd2('0x6b')](_0x559f06);})[_0xffd2('0x26')](respondWithFilteredResult(_0x835e3,_0x41010f))['catch'](handleError(_0x835e3,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 48da78d..31ecf13 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 _0xb091=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','UserProfile'];(function(_0x4770da,_0x346592){var _0x419134=function(_0xae6bb7){while(--_0xae6bb7){_0x4770da['push'](_0x4770da['shift']());}};_0x419134(++_0x346592);}(_0xb091,0x16e));var _0x1b09=function(_0x14a820,_0x951a52){_0x14a820=_0x14a820-0x0;var _0x194dbe=_0xb091[_0x14a820];return _0x194dbe;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x1b09('0x0'))['db'][_0x1b09('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1b09('0x2')](0x0);var events={'afterCreate':_0x1b09('0x3'),'afterUpdate':'update','afterDestroy':_0x1b09('0x4')};function emitEvent(_0x59af61){return function(_0x5aa3b0,_0x295863,_0x24d22c){UserProfileEvents['emit'](_0x59af61+':'+_0x5aa3b0['id'],_0x5aa3b0);UserProfileEvents[_0x1b09('0x5')](_0x59af61,_0x5aa3b0);_0x24d22c(null);};}for(var e in events){if(events[_0x1b09('0x6')](e)){var event=events[e];UserProfile[_0x1b09('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x6f44=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6f44,0x1ea));var _0x46f4=function(_0x691df,_0x2419c3){_0x691df=_0x691df-0x0;var _0x54aef6=_0x6f44[_0x691df];return _0x54aef6;};'use strict';var EventEmitter=require(_0x46f4('0x0'));var UserProfile=require(_0x46f4('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x46f4('0x2')](0x0);var events={'afterCreate':_0x46f4('0x3'),'afterUpdate':_0x46f4('0x4'),'afterDestroy':_0x46f4('0x5')};function emitEvent(_0x4099a9){return function(_0x1e2554,_0x26f749,_0x200f8b){UserProfileEvents[_0x46f4('0x6')](_0x4099a9+':'+_0x1e2554['id'],_0x1e2554);UserProfileEvents['emit'](_0x4099a9,_0x1e2554);_0x200f8b(null);};}for(var e in events){if(events[_0x46f4('0x7')](e)){var event=events[e];UserProfile[_0x46f4('0x8')](e,emitEvent(event));}}module[_0x46f4('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a719c4f..d5c783f 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 _0x57a3=['AnalyticExtractedReport','resourceId','type','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','parentSections','SquareProjects','name','projects','JscriptyProject','contacts','CmContact','Lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','QueueCampaigns','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','_interactions','sequelize','define','UserProfile','user_profiles','query','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','autoAssociation','model','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','where','merge','key','VIRTUAL','foreignKey','forEach','options','reportType','default','DefaultReports','custom','CustomReports','rows','ids','extraQueryConditions','count','Tags','tag','Tag','ThroughTags','color','include','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','findAll','associatedResources','map','field','then','catch','resolve','UserProfileResource'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x57a3,0x17f));var _0x357a=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x57a3[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x357a('0x0'));var attributes=require(_0x357a('0x1'));var qs=require(_0x357a('0x2'));var squel=require(_0x357a('0x3'));module[_0x357a('0x4')]=function(_0x2895aa){var _0x328cc0=_0x2895aa[_0x357a('0x5')];function _0x371cf4(_0x89c60a,_0x5096ea){return new Promise(function(_0x1c3fd8,_0x2f0552){if(!_0x5096ea)return _0x1c3fd8(null);var _0x1ce333=_0x5096ea[_0x357a('0x6')]?{[_0x5096ea[_0x357a('0x6')]['field']]:_0x5096ea[_0x357a('0x6')]['value']}:undefined;return _0x328cc0[_0x89c60a][_0x357a('0x7')]({'where':_0x1ce333,'raw':!![]})['then'](function(_0x26fcc7){_0x5096ea[_0x357a('0x8')]=_[_0x357a('0x9')](_0x26fcc7,'id');_0x1c3fd8(_0x5096ea);})['catch'](function(_0xd5a6f8){_0x2f0552(_0xd5a6f8);});});}function _0x4b12b3(_0x2338e5,_0xfdf5f6){return new Promise(function(_0x5180d0,_0x5d600d){var _0x286335=_0x2338e5['filter']?{[_0x2338e5[_0x357a('0x6')][_0x357a('0xa')]]:_0x2338e5[_0x357a('0x6')]['value']}:undefined;return _0x328cc0[_0x2338e5['model']]['findAll']({'where':_0x286335,'raw':!![]})[_0x357a('0xb')](function(_0x5e77fd){_0xfdf5f6[_0x357a('0x8')]=_['map'](_0x5e77fd,function(_0x58998c){return _0x58998c['name'];});_0x5180d0(_0xfdf5f6);})[_0x357a('0xc')](function(_0x3d0636){_0x5d600d(_0x3d0636);});});}function _0x30820f(_0x11f278,_0x4437bf,_0x3ec761){if(!_0x4437bf)return Promise[_0x357a('0xd')](null);return new Promise(function(_0x5e0250,_0x3055c1){return _0x328cc0[_0x357a('0xe')][_0x357a('0x7')]({'where':{'sectionId':_0x4437bf['id']},'raw':!![]})[_0x357a('0xb')](function(_0x2fa03a){if(_0x11f278[_0x357a('0xa')]&&_0x11f278[_0x357a('0xa')]!=='id'){_0x4437bf[_0x357a('0x8')]=_[_0x357a('0x9')](_0x2fa03a,function(_0x260663){return _0x260663[_0x11f278[_0x357a('0xa')]];});}else{if(_0x3ec761===_0x357a('0xf')){_0x4437bf['associatedResources']=_[_0x357a('0x9')](_0x2fa03a,function(_0x3cd524){return{'id':_0x3cd524[_0x357a('0x10')],'type':_0x3cd524[_0x357a('0x11')]};});}else{_0x4437bf[_0x357a('0x8')]=_['map'](_0x2fa03a,function(_0x1298fb){return _0x1298fb['resourceId'];});}}_0x5e0250(_0x4437bf);})[_0x357a('0xc')](function(_0x425258){_0x3055c1(_0x425258);});});}function _0x2aaefe(_0xaed495,_0x436252){var _0x5a0e4c={'parentSections':[]};switch(_0xaed495[_0x357a('0x12')]()){case'squareprojects':_0x5a0e4c['childModel']=_0x357a('0x13');break;case _0x357a('0x14'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x16');break;case'squarerecordings':_0x5a0e4c[_0x357a('0x15')]='SquareRecording';_0x5a0e4c[_0x357a('0x17')]=[{'name':_0x357a('0x18'),'field':_0x357a('0x19'),'foreignKey':'projectName'}];break;case _0x357a('0x1a'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x1b');break;case _0x357a('0x1c'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x1d');_0x5a0e4c[_0x357a('0x17')]=[{'name':_0x357a('0x1e'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x1f');break;case _0x357a('0x20'):_0x5a0e4c[_0x357a('0x15')]='CmCompany';break;case _0x357a('0x21'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x22');break;case _0x357a('0x23'):_0x5a0e4c['childModel']=_0x357a('0x24');break;case _0x357a('0x25'):_0x5a0e4c['childModel']=_0x357a('0x26');break;case _0x357a('0x27'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x28');break;case _0x357a('0x29'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x2a');break;case _0x357a('0x2b'):case'internalroutes':case _0x357a('0x2c'):_0x5a0e4c['childModel']=_0x357a('0x2d');break;case _0x357a('0x2e'):_0x5a0e4c['childModel']=_0x357a('0x2f');break;case _0x357a('0x30'):_0x5a0e4c[_0x357a('0x15')]='VoiceMail';break;case'voicerecordings':_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x31');_0x5a0e4c[_0x357a('0x17')]=[{'name':_0x357a('0x32'),'field':_0x357a('0x19'),'foreignKey':_0x357a('0x33'),'model':_0x357a('0x34'),'filter':{'field':'role','value':[_0x357a('0x35')]}},{'name':_0x357a('0x36'),'field':_0x357a('0x19'),'foreignKey':_0x357a('0x33'),'model':_0x357a('0x34'),'filter':{'field':_0x357a('0x37'),'value':[_0x357a('0x38')]}},{'name':_0x357a('0x39'),'field':_0x357a('0x19'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x357a('0x11'),'value':['inbound']}},{'name':_0x357a('0x3a'),'field':'name','foreignKey':_0x357a('0x3b'),'model':_0x357a('0x3c'),'filter':{'field':_0x357a('0x11'),'value':[_0x357a('0x3d')]}}];break;case _0x357a('0x3e'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x3f');break;case _0x357a('0x40'):_0x5a0e4c['childModel']=_0x357a('0x41');break;case _0x357a('0x42'):_0x5a0e4c['childModel']=_0x357a('0x43');break;case _0x357a('0x44'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x45');break;case'mailqueues':_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x46');break;case _0x357a('0x47'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x48');break;case _0x357a('0x49'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x4a');break;case _0x357a('0x4b'):_0x5a0e4c[_0x357a('0x15')]='OpenchannelQueue';break;case'openchannelaccounts':_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x4c');break;case _0x357a('0x4d'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x4e');break;case _0x357a('0x4f'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x50');break;case _0x357a('0x51'):_0x5a0e4c[_0x357a('0x15')]='WhatsappQueue';break;case _0x357a('0x52'):_0x5a0e4c['childModel']=_0x357a('0x53');break;case _0x357a('0x54'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x55');break;case _0x357a('0x56'):case'queuecampaigns':_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x3c');if(_0x436252){_0x5a0e4c[_0x357a('0x17')]=[{'name':_0x357a('0x39')},{'name':_0x357a('0x3a')}];}break;case _0x357a('0x57'):case _0x357a('0x58'):case _0x357a('0x59'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x34');if(_0x436252){_0x5a0e4c[_0x357a('0x17')]=[{'name':'Users','filter':{'field':_0x357a('0x37'),'value':['admin',_0x357a('0x5a')]},'ignore':!![]},{'name':'Agents'},{'name':_0x357a('0x36')}];}break;case _0x357a('0x5b'):_0x5a0e4c['childModel']=_0x357a('0x5c');break;case _0x357a('0x5d'):_0x5a0e4c['childModel']=_0x357a('0x5e');break;case _0x357a('0x5f'):_0x5a0e4c[_0x357a('0x15')]='FreshdeskAccount';break;case _0x357a('0x60'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x61');break;case _0x357a('0x62'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x63');break;case _0x357a('0x64'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x65');break;case _0x357a('0x66'):_0x5a0e4c[_0x357a('0x15')]='User';break;case _0x357a('0x67'):_0x5a0e4c['childModel']=_0x357a('0x68');break;case _0x357a('0x69'):_0x5a0e4c['childModel']=_0x357a('0x6a');break;case _0x357a('0x6b'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x6c');break;case _0x357a('0x6d'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x6e');break;case _0x357a('0x6f'):_0x5a0e4c['childModel']=_0x357a('0x70');break;case _0x357a('0x71'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x72');break;case _0x357a('0x73'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x74');break;case _0x357a('0x75'):_0x5a0e4c['childModel']='Tag';break;case _0x357a('0x76'):_0x5a0e4c['childModel']=_0x357a('0x77');break;case _0x357a('0x78'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x79');break;case'trunks':_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x7a');break;case _0x357a('0x7b'):_0x5a0e4c[_0x357a('0x15')]=_0x357a('0x7c');break;case _0x357a('0x7d'):_0x5a0e4c['childModel']=_0x357a('0x7e');break;case _0x357a('0x7f'):_0x5a0e4c['childModel']=_0x357a('0xf');_0x5a0e4c['parentSections']=[{'name':_0x357a('0x80'),'field':'id','foreignKey':_0x357a('0x81')}];break;case'metrics':_0x5a0e4c['childModel']=_0x357a('0x82');break;}return _0x5a0e4c;}function _0x1f2723(_0x2e2694,_0x49e1f2){var _0x1dc4d1=_0x2e2694[_0x357a('0x83')](0x0)['toUpperCase']()+_0x2e2694[_0x357a('0x84')](0x1);var _0x3dbc86={'type':_0x328cc0[_0x357a('0x85')][_0x357a('0x86')][_0x357a('0x87')],'raw':!![]};return new Promise(function(_0x278a85,_0x3e0f30){var _0x1d4120=squel[_0x357a('0x88')]()[_0x357a('0xa')](_0x357a('0x89')+_0x1dc4d1+_0x357a('0x8a'),'id')['field'](_0x357a('0x8b'))[_0x357a('0x8c')]('user_has_'+_0x2e2694+_0x357a('0x8d'),'ui')['where']('ui.UserId\x20=\x20?',_0x49e1f2['id']);return _0x328cc0[_0x357a('0x8e')]['query'](_0x1d4120['toString'](),_0x3dbc86)[_0x357a('0xb')](function(_0x486c45){_0x49e1f2[_0x1dc4d1+'OpenTabs']=_0x486c45;_0x278a85(_0x486c45);})[_0x357a('0xc')](function(_0x2a935e){_0x3e0f30(_0x2a935e);});});}return _0x2895aa[_0x357a('0x8f')](_0x357a('0x90'),attributes,{'tableName':_0x357a('0x91'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x39652f){var _0x487b6c={'raw':_0x39652f[_0x357a('0x92')][_0x357a('0x93')],'where':{}};var _0x27297f={};var _0x2aa642={'count':0x0,'rows':[]};var _0x35b3b6=_0x39652f[_0x357a('0x92')][_0x357a('0x94')];var _0x5b1a20=_0x39652f[_0x357a('0x92')]['mergeResources']||![];var _0x2617f9=_0x2aaefe(_0x35b3b6,_0x5b1a20);if(!_0x2617f9[_0x357a('0x15')])throw new Error(_0x357a('0x95')+_0x35b3b6+'\x27');var _0x254676=[{'name':_0x35b3b6}];if(!_[_0x357a('0x96')](_0x2617f9[_0x357a('0x17')]))_0x254676=_0x2617f9['parentSections'];var _0x211296=[];for(var _0x2de0ae=0x0;_0x2de0ae<_0x254676[_0x357a('0x97')];_0x2de0ae++){_0x211296[_0x357a('0x98')](_0x328cc0['UserProfileSection'][_0x357a('0x99')]({'where':{'userProfileId':_0x39652f[_0x357a('0x9a')]['id'],'name':_0x254676[_0x2de0ae][_0x357a('0x19')]},'raw':!![]}));}return Promise[_0x357a('0x9b')](_0x211296)[_0x357a('0xb')](function(_0x20f3d1){var _0x35564a=_[_0x357a('0x6')](_0x20f3d1,function(_0x28daf5){return _0x28daf5?_0x28daf5:undefined;});var _0x4a8b60=_[_0x357a('0x6')](_0x254676,[_0x357a('0x9c'),!![]]);var _0x3cc87f=_[_0x357a('0x96')](_0x35564a)&&_[_0x357a('0x96')](_0x4a8b60)?null:_['union'](_0x4a8b60,_0x35564a);if(!_0x3cc87f)return null;var _0x20f7b9=[];for(var _0x3605d4=0x0;_0x3605d4<_0x3cc87f[_0x357a('0x97')];_0x3605d4++){var _0x115654=_[_0x357a('0x99')](_0x254676,function(_0x56e1b9){return _0x3cc87f[_0x3605d4]?_0x56e1b9['name']===_0x3cc87f[_0x3605d4]['name']:null;});if(_0x115654){if(_0x3cc87f[_0x3605d4]['ignore']){_0x20f7b9[_0x357a('0x98')](_0x371cf4(_0x2617f9[_0x357a('0x15')],_0x3cc87f[_0x3605d4]));}else{if(!_0x3cc87f[_0x3605d4][_0x357a('0x9d')]){_0x20f7b9['push'](_0x30820f(_0x115654,_0x3cc87f[_0x3605d4],_0x2617f9['childModel']));}else{if(_0x115654['model']){_0x20f7b9[_0x357a('0x98')](_0x4b12b3(_0x115654,_0x3cc87f[_0x3605d4]));}}}}}return Promise['all'](_0x20f7b9);})[_0x357a('0xb')](function(_0x33bed8){var _0x890df2=_0x33bed8;var _0x49628a=null;if(_0x890df2){_0x49628a=_0x890df2['length']===0x1?_0x890df2[0x0]:null;}if(!_0x49628a&&!_0x890df2)return _0x2aa642;var _0x27afa7=_0x328cc0[_0x2617f9[_0x357a('0x15')]]['rawAttributes'];_0x27297f[_0x357a('0x9e')]=_[_0x357a('0x9f')](_0x27afa7);_0x27297f[_0x357a('0x92')]=_['keys'](_0x39652f['query']);_0x27297f[_0x357a('0xa0')]=_[_0x357a('0xa1')](_0x27297f[_0x357a('0x9e')],_0x27297f[_0x357a('0x92')]);_0x487b6c['attributes']=_[_0x357a('0xa1')](_0x27297f[_0x357a('0x9e')],qs[_0x357a('0xa2')](_0x39652f['query']['fields']));_0x487b6c['attributes']=_0x487b6c[_0x357a('0xa3')][_0x357a('0x97')]?_0x487b6c[_0x357a('0xa3')]:_0x27297f[_0x357a('0x9e')];if(!_0x39652f[_0x357a('0x92')][_0x357a('0xa4')](_0x357a('0xa5'))){_0x487b6c[_0x357a('0xa6')]=qs['limit'](_0x39652f[_0x357a('0x92')][_0x357a('0xa6')]);_0x487b6c[_0x357a('0xa7')]=qs[_0x357a('0xa7')](_0x39652f[_0x357a('0x92')][_0x357a('0xa7')]);}_0x487b6c[_0x357a('0xa8')]=qs[_0x357a('0xa9')](_0x39652f[_0x357a('0x92')]['sort']);_0x487b6c[_0x357a('0xaa')]=qs[_0x357a('0xa0')](_['pick'](_0x39652f[_0x357a('0x92')],_0x27297f[_0x357a('0xa0')]));if(_0x39652f['query'][_0x357a('0x6')]){_0x487b6c['where']=_[_0x357a('0xab')](_0x487b6c[_0x357a('0xaa')],{'$or':_[_0x357a('0x9')](_0x27afa7,function(_0x58139b){if(_0x58139b[_0x357a('0x11')][_0x357a('0xac')]!==_0x357a('0xad')){var _0x2b8c81={};_0x2b8c81[_0x58139b['field']]={'$like':'%'+_0x39652f[_0x357a('0x92')][_0x357a('0x6')]+'%'};return _0x2b8c81;}})});}var _0x1e2a46=[];var _0xaed572=null;var _0x2cf87c={};if(_0x49628a){_0xaed572=_[_0x357a('0x99')](_0x254676,['name',_0x49628a[_0x357a('0x19')]]);if(_0xaed572['field']){_0x2cf87c={};if(_0x2617f9[_0x357a('0x15')]===_0x357a('0xf')){_0x2cf87c[_0xaed572[_0x357a('0xae')]]=_['map'](_0x49628a[_0x357a('0x8')],'id');}else{_0x2cf87c[_0xaed572['foreignKey']]=_0x49628a[_0x357a('0x8')];}_0x1e2a46[_0x357a('0x98')](_0x2cf87c);}else{_0x487b6c[_0x357a('0xaa')]['id']=_0x49628a['associatedResources'];}}else{for(var _0x398101=0x0;_0x398101<_0x890df2[_0x357a('0x97')];_0x398101++){_0xaed572=_[_0x357a('0x99')](_0x254676,[_0x357a('0x19'),_0x890df2[_0x398101]['name']]);if(_0xaed572[_0x357a('0xa')]){_0x2cf87c={};_0x2cf87c[_0xaed572[_0x357a('0xae')]]=_0x890df2[_0x398101][_0x357a('0x8')];_0x1e2a46[_0x357a('0x98')](_0x2cf87c);}else{if(!_0x487b6c['where']['id'])_0x487b6c[_0x357a('0xaa')]['id']=[];_0x890df2[_0x398101][_0x357a('0x8')][_0x357a('0xaf')](function(_0x269286){_0x487b6c[_0x357a('0xaa')]['id']['push'](_0x269286);});}}}if(!_['isEmpty'](_0x1e2a46)){_0x487b6c['where']=_[_0x357a('0xab')](_0x487b6c[_0x357a('0xaa')],{'$and':{'$or':_0x1e2a46}});}_0x487b6c=_['merge']({},_0x487b6c,_0x39652f[_0x357a('0xb0')]);if(_0x49628a&&!_0x49628a[_0x357a('0x9d')]&&_0x2617f9[_0x357a('0x15')]===_0x357a('0xf')){if(_0x39652f['query']['includeAll']){_0x487b6c['include']=[{'all':!![]}];}return _0x328cc0[_0x2617f9[_0x357a('0x15')]][_0x357a('0x7')](_0x487b6c)['then'](function(_0x1613a2){var _0x2a1715=[];_0x1613a2['forEach'](function(_0x4f239c){var _0x440ae6;switch(_0x4f239c[_0x357a('0xb1')]){case _0x357a('0xb2'):_0x440ae6=_['find'](_0x49628a[_0x357a('0x8')],function(_0x53e673){return _0x53e673['id']===_0x4f239c[_0x357a('0x81')]&&_0x53e673[_0x357a('0x11')]===_0x357a('0xb3');});break;case _0x357a('0xb4'):_0x440ae6=_[_0x357a('0x99')](_0x49628a[_0x357a('0x8')],function(_0x361e76){return _0x361e76['id']===_0x4f239c['reportId']&&_0x361e76[_0x357a('0x11')]===_0x357a('0xb5');});break;}if(_0x440ae6)_0x2a1715[_0x357a('0x98')](_0x4f239c);});_0x2aa642['count']=_0x2a1715[_0x357a('0x97')];_0x2aa642[_0x357a('0xb6')]=_0x2a1715;return _0x2aa642;});}else{if(!_[_0x357a('0x96')](_0x39652f[_0x357a('0x92')]['ids'])){_0x487b6c['where']['id']=_0x487b6c[_0x357a('0xaa')]['id']?_[_0x357a('0xa1')](_0x487b6c[_0x357a('0xaa')]['id'],_0x39652f[_0x357a('0x92')][_0x357a('0xb7')]):_0x39652f[_0x357a('0x92')][_0x357a('0xb7')];if(_0x39652f[_0x357a('0x92')]['customSorting']){_0x487b6c['order']=_0x39652f['query']['customSorting'];}}if(_0x39652f[_0x357a('0x92')][_0x357a('0xb8')]){_0x487b6c['where']=_[_0x357a('0xab')](_0x487b6c['where'],{'$and':_0x39652f[_0x357a('0x92')][_0x357a('0xb8')]});}return _0x328cc0[_0x2617f9[_0x357a('0x15')]][_0x357a('0xb9')]({'where':_0x487b6c[_0x357a('0xaa')]})[_0x357a('0xb')](function(_0x2ed372){_0x2aa642['count']=_0x2ed372;if(_0x39652f[_0x357a('0x92')]['includeAll']){if(_0x2617f9['childModel']===_0x357a('0x1d')){_0x487b6c['include']=[{'model':_0x328cc0['Tag'],'as':_0x357a('0xba'),'attributes':['id',_0x357a('0x19'),'color'],'required':_0x39652f[_0x357a('0x92')][_0x357a('0xbb')]?!![]:![]},{'model':_0x328cc0[_0x357a('0xbc')],'as':_0x357a('0xbd'),'attributes':['id',_0x357a('0x19'),_0x357a('0xbe')],'through':_0x39652f['query'][_0x357a('0xbb')]?{'attributes':[],'where':{'TagId':_0x39652f[_0x357a('0x92')]['tag']||undefined}}:{},'required':_0x39652f[_0x357a('0x92')][_0x357a('0xbb')]?!![]:![]}];}else{_0x487b6c[_0x357a('0xbf')]=[{'all':!![]}];}}return _0x328cc0[_0x2617f9[_0x357a('0x15')]][_0x357a('0x7')](_0x487b6c);})[_0x357a('0xb')](function(_0x133c1e){_0x2aa642[_0x357a('0xb6')]=_0x133c1e;if(_0x35b3b6===_0x357a('0x32')&&_0x39652f[_0x357a('0x92')]['openTabs']===_0x357a('0xc0')){var _0x5d50b1=[];for(var _0x291e3a=0x0;_0x291e3a<_0x2aa642[_0x357a('0xb6')][_0x357a('0x97')];_0x291e3a++){_0x5d50b1[_0x357a('0x98')](_0x1f2723(_0x357a('0xc1'),_0x2aa642[_0x357a('0xb6')][_0x291e3a][_0x357a('0xc2')]));_0x5d50b1[_0x357a('0x98')](_0x1f2723(_0x357a('0xc3'),_0x2aa642['rows'][_0x291e3a]['dataValues']));_0x5d50b1['push'](_0x1f2723(_0x357a('0xc4'),_0x2aa642[_0x357a('0xb6')][_0x291e3a][_0x357a('0xc2')]));_0x5d50b1[_0x357a('0x98')](_0x1f2723(_0x357a('0xc5'),_0x2aa642[_0x357a('0xb6')][_0x291e3a][_0x357a('0xc2')]));_0x5d50b1[_0x357a('0x98')](_0x1f2723('openchannel',_0x2aa642[_0x357a('0xb6')][_0x291e3a]['dataValues']));_0x5d50b1['push'](_0x1f2723(_0x357a('0xc6'),_0x2aa642[_0x357a('0xb6')][_0x291e3a][_0x357a('0xc2')]));}return Promise[_0x357a('0x9b')](_0x5d50b1)[_0x357a('0xb')](function(){return _0x2aa642;});}return _0x2aa642;});}});}}});}; \ No newline at end of file +var _0xcf6a=['intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Template','Trigger','trunks','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','section','mergeResources','Invalid\x20section\x20\x27','length','push','find','all','ignore','isEmpty','union','autoAssociation','rawAttributes','model','keys','filters','attributes','intersection','fields','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','forEach','options','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tag','Tags','tag','ThroughTags','openTabs','true','dataValues','fax','mail','whatsapp','./userProfile.attributes','squel','exports','filter','field','then','associatedResources','map','value','findAll','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','Lists','lists','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','Telephones','role','VoiceQueues','queue','VoiceQueue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','QueueCampaigns','users','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','User','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard'];(function(_0xa1eec8,_0x64be51){var _0x431002=function(_0x59972b){while(--_0x59972b){_0xa1eec8['push'](_0xa1eec8['shift']());}};_0x431002(++_0x64be51);}(_0xcf6a,0x114));var _0xacf6=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xcf6a[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var attributes=require(_0xacf6('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0xacf6('0x1'));module[_0xacf6('0x2')]=function(_0x53a111){var _0x99d788=_0x53a111['models'];function _0x333e93(_0x54ebf9,_0x3f8bc1){return new Promise(function(_0x56db1c,_0x169f90){if(!_0x3f8bc1)return _0x56db1c(null);var _0x1288ef=_0x3f8bc1[_0xacf6('0x3')]?{[_0x3f8bc1[_0xacf6('0x3')][_0xacf6('0x4')]]:_0x3f8bc1[_0xacf6('0x3')]['value']}:undefined;return _0x99d788[_0x54ebf9]['findAll']({'where':_0x1288ef,'raw':!![]})[_0xacf6('0x5')](function(_0x48bfe3){_0x3f8bc1[_0xacf6('0x6')]=_[_0xacf6('0x7')](_0x48bfe3,'id');_0x56db1c(_0x3f8bc1);})['catch'](function(_0x287fc1){_0x169f90(_0x287fc1);});});}function _0x4f99ec(_0x49647e,_0x3efe30){return new Promise(function(_0xe894e3,_0x4cad96){var _0x409b18=_0x49647e[_0xacf6('0x3')]?{[_0x49647e['filter'][_0xacf6('0x4')]]:_0x49647e[_0xacf6('0x3')][_0xacf6('0x8')]}:undefined;return _0x99d788[_0x49647e['model']][_0xacf6('0x9')]({'where':_0x409b18,'raw':!![]})[_0xacf6('0x5')](function(_0x17e5aa){_0x3efe30[_0xacf6('0x6')]=_[_0xacf6('0x7')](_0x17e5aa,function(_0x320b46){return _0x320b46[_0xacf6('0xa')];});_0xe894e3(_0x3efe30);})[_0xacf6('0xb')](function(_0x4757bf){_0x4cad96(_0x4757bf);});});}function _0xffd84f(_0x1f4017,_0x2795d1,_0x219229){if(!_0x2795d1)return Promise[_0xacf6('0xc')](null);return new Promise(function(_0x3b6ee1,_0x52fea2){return _0x99d788[_0xacf6('0xd')]['findAll']({'where':{'sectionId':_0x2795d1['id']},'raw':!![]})['then'](function(_0x4f6908){if(_0x1f4017['field']&&_0x1f4017[_0xacf6('0x4')]!=='id'){_0x2795d1[_0xacf6('0x6')]=_[_0xacf6('0x7')](_0x4f6908,function(_0x1d42d2){return _0x1d42d2[_0x1f4017[_0xacf6('0x4')]];});}else{if(_0x219229===_0xacf6('0xe')){_0x2795d1[_0xacf6('0x6')]=_[_0xacf6('0x7')](_0x4f6908,function(_0x35e3fc){return{'id':_0x35e3fc[_0xacf6('0xf')],'type':_0x35e3fc[_0xacf6('0x10')]};});}else{_0x2795d1[_0xacf6('0x6')]=_['map'](_0x4f6908,function(_0x5da860){return _0x5da860[_0xacf6('0xf')];});}}_0x3b6ee1(_0x2795d1);})['catch'](function(_0x3bdc17){_0x52fea2(_0x3bdc17);});});}function _0x111352(_0x33c58a,_0x5ea71c){var _0x2850ed={'parentSections':[]};switch(_0x33c58a[_0xacf6('0x11')]()){case'squareprojects':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x13');break;case'odbc':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x14');break;case _0xacf6('0x15'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x16');_0x2850ed[_0xacf6('0x17')]=[{'name':'SquareProjects','field':'name','foreignKey':_0xacf6('0x18')}];break;case _0xacf6('0x19'):_0x2850ed['childModel']=_0xacf6('0x1a');break;case _0xacf6('0x1b'):_0x2850ed[_0xacf6('0x12')]='CmContact';_0x2850ed[_0xacf6('0x17')]=[{'name':_0xacf6('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0xacf6('0x1d'):_0x2850ed[_0xacf6('0x12')]='CmList';break;case'companies':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x1e');break;case _0xacf6('0x1f'):_0x2850ed['childModel']=_0xacf6('0x20');break;case'chatqueues':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x21');break;case _0xacf6('0x22'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x23');break;case _0xacf6('0x24'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x25');break;case _0xacf6('0x26'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x27');break;case _0xacf6('0x28'):case _0xacf6('0x29'):case _0xacf6('0x2a'):_0x2850ed[_0xacf6('0x12')]='VoiceExtension';break;case _0xacf6('0x2b'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x2c');break;case _0xacf6('0x2d'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x2e');break;case'voicerecordings':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x2f');_0x2850ed['parentSections']=[{'name':_0xacf6('0x30'),'field':_0xacf6('0xa'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':['agent']}},{'name':_0xacf6('0x31'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':_0xacf6('0x32'),'value':['telephone']}},{'name':_0xacf6('0x33'),'field':_0xacf6('0xa'),'foreignKey':_0xacf6('0x34'),'model':_0xacf6('0x35'),'filter':{'field':_0xacf6('0x10'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0xacf6('0xa'),'foreignKey':'queue','model':_0xacf6('0x35'),'filter':{'field':_0xacf6('0x10'),'value':[_0xacf6('0x36')]}}];break;case'musiconholds':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x37');break;case _0xacf6('0x38'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x39');break;case _0xacf6('0x3a'):_0x2850ed[_0xacf6('0x12')]='VoicePrefix';break;case _0xacf6('0x3b'):_0x2850ed[_0xacf6('0x12')]='Campaign';break;case _0xacf6('0x3c'):_0x2850ed['childModel']='MailQueue';break;case'mailaccounts':_0x2850ed['childModel']=_0xacf6('0x3d');break;case'mailsubstatuses':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x3e');break;case _0xacf6('0x3f'):_0x2850ed[_0xacf6('0x12')]='OpenchannelQueue';break;case _0xacf6('0x40'):_0x2850ed[_0xacf6('0x12')]='OpenchannelAccount';break;case _0xacf6('0x41'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x42');break;case _0xacf6('0x43'):_0x2850ed['childModel']='SmsAccount';break;case _0xacf6('0x44'):_0x2850ed['childModel']=_0xacf6('0x45');break;case _0xacf6('0x46'):_0x2850ed['childModel']=_0xacf6('0x47');break;case'teams':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x48');break;case _0xacf6('0x49'):case'queuecampaigns':_0x2850ed['childModel']='VoiceQueue';if(_0x5ea71c){_0x2850ed[_0xacf6('0x17')]=[{'name':_0xacf6('0x33')},{'name':_0xacf6('0x4a')}];}break;case _0xacf6('0x4b'):case _0xacf6('0x4c'):case _0xacf6('0x4d'):_0x2850ed[_0xacf6('0x12')]='User';if(_0x5ea71c){_0x2850ed[_0xacf6('0x17')]=[{'name':_0xacf6('0x4e'),'filter':{'field':_0xacf6('0x32'),'value':[_0xacf6('0x4f'),_0xacf6('0x50')]},'ignore':!![]},{'name':_0xacf6('0x30')},{'name':_0xacf6('0x31')}];}break;case'zendeskaccounts':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x51');break;case _0xacf6('0x52'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x53');break;case _0xacf6('0x54'):_0x2850ed['childModel']=_0xacf6('0x55');break;case _0xacf6('0x56'):_0x2850ed[_0xacf6('0x12')]='SugarcrmAccount';break;case'deskaccounts':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x57');break;case _0xacf6('0x58'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x59');break;case _0xacf6('0x5a'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x5b');break;case _0xacf6('0x5c'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x5d');break;case _0xacf6('0x5e'):_0x2850ed['childModel']=_0xacf6('0x5f');break;case _0xacf6('0x60'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x61');break;case _0xacf6('0x62'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x63');break;case _0xacf6('0x64'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x65');break;case _0xacf6('0x66'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x67');break;case _0xacf6('0x68'):_0x2850ed['childModel']=_0xacf6('0x69');break;case _0xacf6('0x6a'):_0x2850ed['childModel']='Tag';break;case'templates':_0x2850ed['childModel']=_0xacf6('0x6b');break;case'triggers':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x6c');break;case _0xacf6('0x6d'):_0x2850ed['childModel']='Trunk';break;case'variables':_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x6e');break;case _0xacf6('0x6f'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0x70');break;case _0xacf6('0x71'):_0x2850ed[_0xacf6('0x12')]=_0xacf6('0xe');_0x2850ed[_0xacf6('0x17')]=[{'name':_0xacf6('0x72'),'field':'id','foreignKey':_0xacf6('0x73')}];break;case _0xacf6('0x74'):_0x2850ed['childModel']=_0xacf6('0x75');break;}return _0x2850ed;}function _0x117dd4(_0x3d1ecd,_0x3ccd87){var _0xb5f1b6=_0x3d1ecd[_0xacf6('0x76')](0x0)[_0xacf6('0x77')]()+_0x3d1ecd[_0xacf6('0x78')](0x1);var _0x5c92c9={'type':_0x99d788['Sequelize'][_0xacf6('0x79')][_0xacf6('0x7a')],'raw':!![]};return new Promise(function(_0x1870e5,_0x1b54aa){var _0x471762=squel[_0xacf6('0x7b')]()['field'](_0xacf6('0x7c')+_0xb5f1b6+'InteractionId','id')[_0xacf6('0x4')](_0xacf6('0x7d'))[_0xacf6('0x7e')](_0xacf6('0x7f')+_0x3d1ecd+_0xacf6('0x80'),'ui')[_0xacf6('0x81')](_0xacf6('0x82'),_0x3ccd87['id']);return _0x99d788[_0xacf6('0x83')][_0xacf6('0x84')](_0x471762['toString'](),_0x5c92c9)[_0xacf6('0x5')](function(_0x304508){_0x3ccd87[_0xb5f1b6+_0xacf6('0x85')]=_0x304508;_0x1870e5(_0x304508);})[_0xacf6('0xb')](function(_0x3ff868){_0x1b54aa(_0x3ff868);});});}return _0x53a111[_0xacf6('0x86')](_0xacf6('0x87'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xf730c0){var _0x366ae2={'raw':_0xf730c0['query']['raw'],'where':{}};var _0x24aaca={};var _0x235490={'count':0x0,'rows':[]};var _0x31b825=_0xf730c0[_0xacf6('0x84')][_0xacf6('0x88')];var _0x42d293=_0xf730c0[_0xacf6('0x84')][_0xacf6('0x89')]||![];var _0x3f7ae4=_0x111352(_0x31b825,_0x42d293);if(!_0x3f7ae4['childModel'])throw new Error(_0xacf6('0x8a')+_0x31b825+'\x27');var _0x561ab7=[{'name':_0x31b825}];if(!_['isEmpty'](_0x3f7ae4[_0xacf6('0x17')]))_0x561ab7=_0x3f7ae4[_0xacf6('0x17')];var _0x170360=[];for(var _0x12fcce=0x0;_0x12fcce<_0x561ab7[_0xacf6('0x8b')];_0x12fcce++){_0x170360[_0xacf6('0x8c')](_0x99d788['UserProfileSection'][_0xacf6('0x8d')]({'where':{'userProfileId':_0xf730c0['params']['id'],'name':_0x561ab7[_0x12fcce][_0xacf6('0xa')]},'raw':!![]}));}return Promise[_0xacf6('0x8e')](_0x170360)[_0xacf6('0x5')](function(_0x12fd77){var _0x1c7a02=_[_0xacf6('0x3')](_0x12fd77,function(_0x247190){return _0x247190?_0x247190:undefined;});var _0x347e4f=_[_0xacf6('0x3')](_0x561ab7,[_0xacf6('0x8f'),!![]]);var _0x42c184=_[_0xacf6('0x90')](_0x1c7a02)&&_['isEmpty'](_0x347e4f)?null:_[_0xacf6('0x91')](_0x347e4f,_0x1c7a02);if(!_0x42c184)return null;var _0x49795a=[];for(var _0x5a894f=0x0;_0x5a894f<_0x42c184['length'];_0x5a894f++){var _0x44a842=_[_0xacf6('0x8d')](_0x561ab7,function(_0x1e0b44){return _0x42c184[_0x5a894f]?_0x1e0b44[_0xacf6('0xa')]===_0x42c184[_0x5a894f][_0xacf6('0xa')]:null;});if(_0x44a842){if(_0x42c184[_0x5a894f][_0xacf6('0x8f')]){_0x49795a['push'](_0x333e93(_0x3f7ae4[_0xacf6('0x12')],_0x42c184[_0x5a894f]));}else{if(!_0x42c184[_0x5a894f][_0xacf6('0x92')]){_0x49795a[_0xacf6('0x8c')](_0xffd84f(_0x44a842,_0x42c184[_0x5a894f],_0x3f7ae4['childModel']));}else{if(_0x44a842['model']){_0x49795a['push'](_0x4f99ec(_0x44a842,_0x42c184[_0x5a894f]));}}}}}return Promise[_0xacf6('0x8e')](_0x49795a);})['then'](function(_0x1da812){var _0x1ae3ed=_0x1da812;var _0x55acbe=null;if(_0x1ae3ed){_0x55acbe=_0x1ae3ed[_0xacf6('0x8b')]===0x1?_0x1ae3ed[0x0]:null;}if(!_0x55acbe&&!_0x1ae3ed)return _0x235490;var _0x258ed4=_0x99d788[_0x3f7ae4[_0xacf6('0x12')]][_0xacf6('0x93')];_0x24aaca[_0xacf6('0x94')]=_['keys'](_0x258ed4);_0x24aaca[_0xacf6('0x84')]=_[_0xacf6('0x95')](_0xf730c0[_0xacf6('0x84')]);_0x24aaca[_0xacf6('0x96')]=_['intersection'](_0x24aaca[_0xacf6('0x94')],_0x24aaca[_0xacf6('0x84')]);_0x366ae2[_0xacf6('0x97')]=_[_0xacf6('0x98')](_0x24aaca[_0xacf6('0x94')],qs[_0xacf6('0x99')](_0xf730c0['query'][_0xacf6('0x99')]));_0x366ae2['attributes']=_0x366ae2[_0xacf6('0x97')]['length']?_0x366ae2['attributes']:_0x24aaca[_0xacf6('0x94')];if(!_0xf730c0[_0xacf6('0x84')]['hasOwnProperty'](_0xacf6('0x9a'))){_0x366ae2['limit']=qs[_0xacf6('0x9b')](_0xf730c0['query'][_0xacf6('0x9b')]);_0x366ae2[_0xacf6('0x9c')]=qs[_0xacf6('0x9c')](_0xf730c0[_0xacf6('0x84')]['offset']);}_0x366ae2[_0xacf6('0x9d')]=qs[_0xacf6('0x9e')](_0xf730c0[_0xacf6('0x84')][_0xacf6('0x9e')]);_0x366ae2[_0xacf6('0x81')]=qs[_0xacf6('0x96')](_[_0xacf6('0x9f')](_0xf730c0[_0xacf6('0x84')],_0x24aaca[_0xacf6('0x96')]));if(_0xf730c0['query'][_0xacf6('0x3')]){_0x366ae2[_0xacf6('0x81')]=_[_0xacf6('0xa0')](_0x366ae2[_0xacf6('0x81')],{'$or':_[_0xacf6('0x7')](_0x258ed4,function(_0x33bab3){if(_0x33bab3[_0xacf6('0x10')][_0xacf6('0xa1')]!=='VIRTUAL'){var _0x117f9c={};_0x117f9c[_0x33bab3[_0xacf6('0x4')]]={'$like':'%'+_0xf730c0[_0xacf6('0x84')]['filter']+'%'};return _0x117f9c;}})});}var _0x18f1e3=[];var _0x4204f1=null;var _0x43bce6={};if(_0x55acbe){_0x4204f1=_[_0xacf6('0x8d')](_0x561ab7,['name',_0x55acbe['name']]);if(_0x4204f1['field']){_0x43bce6={};if(_0x3f7ae4['childModel']===_0xacf6('0xe')){_0x43bce6[_0x4204f1[_0xacf6('0xa2')]]=_[_0xacf6('0x7')](_0x55acbe['associatedResources'],'id');}else{_0x43bce6[_0x4204f1[_0xacf6('0xa2')]]=_0x55acbe[_0xacf6('0x6')];}_0x18f1e3[_0xacf6('0x8c')](_0x43bce6);}else{_0x366ae2[_0xacf6('0x81')]['id']=_0x55acbe['associatedResources'];}}else{for(var _0x549dc4=0x0;_0x549dc4<_0x1ae3ed[_0xacf6('0x8b')];_0x549dc4++){_0x4204f1=_[_0xacf6('0x8d')](_0x561ab7,[_0xacf6('0xa'),_0x1ae3ed[_0x549dc4][_0xacf6('0xa')]]);if(_0x4204f1[_0xacf6('0x4')]){_0x43bce6={};_0x43bce6[_0x4204f1[_0xacf6('0xa2')]]=_0x1ae3ed[_0x549dc4][_0xacf6('0x6')];_0x18f1e3[_0xacf6('0x8c')](_0x43bce6);}else{if(!_0x366ae2['where']['id'])_0x366ae2[_0xacf6('0x81')]['id']=[];_0x1ae3ed[_0x549dc4][_0xacf6('0x6')][_0xacf6('0xa3')](function(_0x36f431){_0x366ae2[_0xacf6('0x81')]['id'][_0xacf6('0x8c')](_0x36f431);});}}}if(!_[_0xacf6('0x90')](_0x18f1e3)){_0x366ae2['where']=_['merge'](_0x366ae2[_0xacf6('0x81')],{'$and':{'$or':_0x18f1e3}});}_0x366ae2=_[_0xacf6('0xa0')]({},_0x366ae2,_0xf730c0[_0xacf6('0xa4')]);if(_0x55acbe&&!_0x55acbe[_0xacf6('0x92')]&&_0x3f7ae4[_0xacf6('0x12')]===_0xacf6('0xe')){if(_0xf730c0[_0xacf6('0x84')][_0xacf6('0xa5')]){_0x366ae2[_0xacf6('0xa6')]=[{'all':!![]}];}return _0x99d788[_0x3f7ae4[_0xacf6('0x12')]][_0xacf6('0x9')](_0x366ae2)[_0xacf6('0x5')](function(_0x4dcbf3){var _0x17d13d=[];_0x4dcbf3['forEach'](function(_0x193fdf){var _0x43a71f;switch(_0x193fdf[_0xacf6('0xa7')]){case'default':_0x43a71f=_[_0xacf6('0x8d')](_0x55acbe[_0xacf6('0x6')],function(_0x51e920){return _0x51e920['id']===_0x193fdf[_0xacf6('0x73')]&&_0x51e920[_0xacf6('0x10')]===_0xacf6('0xa8');});break;case _0xacf6('0xa9'):_0x43a71f=_['find'](_0x55acbe[_0xacf6('0x6')],function(_0x1d6e36){return _0x1d6e36['id']===_0x193fdf['reportId']&&_0x1d6e36['type']===_0xacf6('0xaa');});break;}if(_0x43a71f)_0x17d13d[_0xacf6('0x8c')](_0x193fdf);});_0x235490[_0xacf6('0xab')]=_0x17d13d[_0xacf6('0x8b')];_0x235490[_0xacf6('0xac')]=_0x17d13d;return _0x235490;});}else{if(!_[_0xacf6('0x90')](_0xf730c0['query']['ids'])){_0x366ae2['where']['id']=_0x366ae2[_0xacf6('0x81')]['id']?_[_0xacf6('0x98')](_0x366ae2['where']['id'],_0xf730c0['query'][_0xacf6('0xad')]):_0xf730c0['query'][_0xacf6('0xad')];if(_0xf730c0[_0xacf6('0x84')][_0xacf6('0xae')]){_0x366ae2[_0xacf6('0x9d')]=_0xf730c0[_0xacf6('0x84')][_0xacf6('0xae')];}}if(_0xf730c0[_0xacf6('0x84')][_0xacf6('0xaf')]){_0x366ae2[_0xacf6('0x81')]=_[_0xacf6('0xa0')](_0x366ae2[_0xacf6('0x81')],{'$and':_0xf730c0['query'][_0xacf6('0xaf')]});}return _0x99d788[_0x3f7ae4[_0xacf6('0x12')]]['count']({'where':_0x366ae2[_0xacf6('0x81')]})[_0xacf6('0x5')](function(_0x13628c){_0x235490[_0xacf6('0xab')]=_0x13628c;if(_0xf730c0[_0xacf6('0x84')][_0xacf6('0xa5')]){if(_0x3f7ae4[_0xacf6('0x12')]===_0xacf6('0xb0')){_0x366ae2[_0xacf6('0xa6')]=[{'model':_0x99d788[_0xacf6('0xb1')],'as':_0xacf6('0xb2'),'attributes':['id',_0xacf6('0xa'),'color'],'required':_0xf730c0[_0xacf6('0x84')][_0xacf6('0xb3')]?!![]:![]},{'model':_0x99d788[_0xacf6('0xb1')],'as':_0xacf6('0xb4'),'attributes':['id',_0xacf6('0xa'),'color'],'through':_0xf730c0[_0xacf6('0x84')][_0xacf6('0xb3')]?{'attributes':[],'where':{'TagId':_0xf730c0[_0xacf6('0x84')][_0xacf6('0xb3')]||undefined}}:{},'required':_0xf730c0[_0xacf6('0x84')]['tag']?!![]:![]}];}else{_0x366ae2[_0xacf6('0xa6')]=[{'all':!![]}];}}return _0x99d788[_0x3f7ae4['childModel']][_0xacf6('0x9')](_0x366ae2);})[_0xacf6('0x5')](function(_0x23f45f){_0x235490[_0xacf6('0xac')]=_0x23f45f;if(_0x31b825===_0xacf6('0x30')&&_0xf730c0[_0xacf6('0x84')][_0xacf6('0xb5')]===_0xacf6('0xb6')){var _0x2b04c9=[];for(var _0x313493=0x0;_0x313493<_0x235490[_0xacf6('0xac')][_0xacf6('0x8b')];_0x313493++){_0x2b04c9['push'](_0x117dd4('chat',_0x235490['rows'][_0x313493][_0xacf6('0xb7')]));_0x2b04c9[_0xacf6('0x8c')](_0x117dd4('sms',_0x235490[_0xacf6('0xac')][_0x313493]['dataValues']));_0x2b04c9['push'](_0x117dd4(_0xacf6('0xb8'),_0x235490['rows'][_0x313493][_0xacf6('0xb7')]));_0x2b04c9['push'](_0x117dd4(_0xacf6('0xb9'),_0x235490[_0xacf6('0xac')][_0x313493][_0xacf6('0xb7')]));_0x2b04c9[_0xacf6('0x8c')](_0x117dd4('openchannel',_0x235490['rows'][_0x313493][_0xacf6('0xb7')]));_0x2b04c9[_0xacf6('0x8c')](_0x117dd4(_0xacf6('0xba'),_0x235490['rows'][_0x313493]['dataValues']));}return Promise[_0xacf6('0x8e')](_0x2b04c9)['then'](function(){return _0x235490;});}return _0x235490;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2611af4..d41352f 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 _0xacc6=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x471183,_0x51188f){var _0x38dcf7=function(_0x48546b){while(--_0x48546b){_0x471183['push'](_0x471183['shift']());}};_0x38dcf7(++_0x51188f);}(_0xacc6,0x150));var _0x6acc=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0xacc6[_0x56756b];return _0xa3002;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var moment=require(_0x6acc('0x2'));var BPromise=require(_0x6acc('0x3'));var rs=require(_0x6acc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6acc('0x5'))['db'];var utils=require(_0x6acc('0x6'));var logger=require(_0x6acc('0x7'))('rpc');var config=require(_0x6acc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6acc('0x9')][_0x6acc('0xa')]({'port':0x232a});config['redis']=_[_0x6acc('0xb')](config['redis'],{'host':_0x6acc('0xc'),'port':0x18eb});var socket=require(_0x6acc('0xd'))(new Redis(config[_0x6acc('0xe')]));require(_0x6acc('0xf'))['register'](socket);function respondWithRpcPromise(_0x1343cb,_0x4cf4c7,_0x3c1a24){return new BPromise(function(_0x21b624,_0xb8647d){return client[_0x6acc('0x10')](_0x1343cb,_0x3c1a24)[_0x6acc('0x11')](function(_0x15b64b){logger['info'](_0x6acc('0x12'),_0x4cf4c7,_0x6acc('0x13'));logger[_0x6acc('0x14')](_0x6acc('0x15'),_0x4cf4c7,_0x6acc('0x13'),JSON['stringify'](_0x15b64b));if(_0x15b64b['error']){if(_0x15b64b[_0x6acc('0x16')][_0x6acc('0x17')]===0x1f4){logger[_0x6acc('0x16')](_0x6acc('0x12'),_0x4cf4c7,_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);return _0xb8647d(_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);}logger[_0x6acc('0x16')](_0x6acc('0x12'),_0x4cf4c7,_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);return _0x21b624(_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);}else{logger[_0x6acc('0x19')](_0x6acc('0x12'),_0x4cf4c7,_0x6acc('0x13'));_0x21b624(_0x15b64b[_0x6acc('0x1a')]['message']);}})[_0x6acc('0x1b')](function(_0x43b8ca){logger[_0x6acc('0x16')](_0x6acc('0x12'),_0x4cf4c7,_0x43b8ca);_0xb8647d(_0x43b8ca);});});} \ No newline at end of file +var _0xb491=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','UserProfile,\x20%s,\x20%s'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0xb491,0x18c));var _0x1b49=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb491[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x1b49('0x0'));var util=require(_0x1b49('0x1'));var moment=require(_0x1b49('0x2'));var BPromise=require(_0x1b49('0x3'));var rs=require(_0x1b49('0x4'));var fs=require('fs');var Redis=require(_0x1b49('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b49('0x6'));var logger=require(_0x1b49('0x7'))('rpc');var config=require(_0x1b49('0x8'));var jayson=require(_0x1b49('0x9'));var client=jayson[_0x1b49('0xa')]['http']({'port':0x232a});config[_0x1b49('0xb')]=_['defaults'](config[_0x1b49('0xb')],{'host':_0x1b49('0xc'),'port':0x18eb});var socket=require(_0x1b49('0xd'))(new Redis(config[_0x1b49('0xb')]));require(_0x1b49('0xe'))[_0x1b49('0xf')](socket);function respondWithRpcPromise(_0x36e294,_0x3dc13d,_0x2768e1){return new BPromise(function(_0x1174c3,_0x2ca75f){return client[_0x1b49('0x10')](_0x36e294,_0x2768e1)[_0x1b49('0x11')](function(_0x13ba5c){logger['info']('UserProfile,\x20%s,\x20%s',_0x3dc13d,_0x1b49('0x12'));logger[_0x1b49('0x13')](_0x1b49('0x14'),_0x3dc13d,_0x1b49('0x12'),JSON[_0x1b49('0x15')](_0x13ba5c));if(_0x13ba5c['error']){if(_0x13ba5c[_0x1b49('0x16')]['code']===0x1f4){logger[_0x1b49('0x16')](_0x1b49('0x17'),_0x3dc13d,_0x13ba5c[_0x1b49('0x16')][_0x1b49('0x18')]);return _0x2ca75f(_0x13ba5c['error'][_0x1b49('0x18')]);}logger[_0x1b49('0x16')](_0x1b49('0x17'),_0x3dc13d,_0x13ba5c[_0x1b49('0x16')][_0x1b49('0x18')]);return _0x1174c3(_0x13ba5c[_0x1b49('0x16')][_0x1b49('0x18')]);}else{logger[_0x1b49('0x19')]('UserProfile,\x20%s,\x20%s',_0x3dc13d,_0x1b49('0x12'));_0x1174c3(_0x13ba5c[_0x1b49('0x1a')]['message']);}})[_0x1b49('0x1b')](function(_0x20c51f){logger[_0x1b49('0x16')](_0x1b49('0x17'),_0x3dc13d,_0x20c51f);_0x2ca75f(_0x20c51f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a1b3b22..c903a70 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 _0xd343=['userProfile:','./userProfile.events','save','remove','update','length'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd343,0xf7));var _0x3d34=function(_0xbae391,_0x498a88){_0xbae391=_0xbae391-0x0;var _0x1ba6d0=_0xd343[_0xbae391];return _0x1ba6d0;};'use strict';var UserProfileEvents=require(_0x3d34('0x0'));var events=[_0x3d34('0x1'),_0x3d34('0x2'),_0x3d34('0x3')];function createListener(_0x4a4925,_0x17b772){return function(_0x13b283){_0x17b772['emit'](_0x4a4925,_0x13b283);};}function removeListener(_0xaa5f03,_0x3bfb9b){return function(){UserProfileEvents['removeListener'](_0xaa5f03,_0x3bfb9b);};}exports['register']=function(_0x328fb7){for(var _0x168aa0=0x0,_0x5a51c3=events[_0x3d34('0x4')];_0x168aa0<_0x5a51c3;_0x168aa0++){var _0x5ceefa=events[_0x168aa0];var _0x113f68=createListener(_0x3d34('0x5')+_0x5ceefa,_0x328fb7);UserProfileEvents['on'](_0x5ceefa,_0x113f68);}}; \ No newline at end of file +var _0xc3ca=['userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5d7a93,_0x38fc62){var _0xb8fd1b=function(_0x318bff){while(--_0x318bff){_0x5d7a93['push'](_0x5d7a93['shift']());}};_0xb8fd1b(++_0x38fc62);}(_0xc3ca,0xfd));var _0xac3c=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc3ca[_0x68c979];return _0x4f0001;};'use strict';var UserProfileEvents=require(_0xac3c('0x0'));var events=[_0xac3c('0x1'),_0xac3c('0x2'),_0xac3c('0x3')];function createListener(_0x5e9af3,_0x4a0268){return function(_0x5f059e){_0x4a0268[_0xac3c('0x4')](_0x5e9af3,_0x5f059e);};}function removeListener(_0x1212c1,_0x23a305){return function(){UserProfileEvents[_0xac3c('0x5')](_0x1212c1,_0x23a305);};}exports[_0xac3c('0x6')]=function(_0x17803b){for(var _0x18f133=0x0,_0x1847b3=events[_0xac3c('0x7')];_0x18f133<_0x1847b3;_0x18f133++){var _0x1b8792=events[_0x18f133];var _0x327853=createListener(_0xac3c('0x8')+_0x1b8792,_0x17803b);UserProfileEvents['on'](_0x1b8792,_0x327853);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 35e5b49..1d90eb7 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 _0x1b6e=['put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x11c8b1,_0x1a6ea0){var _0x25c9df=function(_0x2a2e2c){while(--_0x2a2e2c){_0x11c8b1['push'](_0x11c8b1['shift']());}};_0x25c9df(++_0x1a6ea0);}(_0x1b6e,0x91));var _0xe1b6=function(_0x677118,_0x1fcbc2){_0x677118=_0x677118-0x0;var _0x3ba241=_0x1b6e[_0x677118];return _0x3ba241;};'use strict';var multer=require('multer');var util=require(_0xe1b6('0x0'));var path=require(_0xe1b6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe1b6('0x2')]();var fs_extra=require(_0xe1b6('0x3'));var auth=require(_0xe1b6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe1b6('0x5'));var controller=require(_0xe1b6('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe1b6('0x7')](_0xe1b6('0x8'),auth[_0xe1b6('0x9')](),controller[_0xe1b6('0xa')]);router[_0xe1b6('0x7')](_0xe1b6('0xb'),auth['isAuthenticated'](),controller[_0xe1b6('0xc')]);router[_0xe1b6('0xd')]('/',auth[_0xe1b6('0x9')](),controller[_0xe1b6('0xe')]);router[_0xe1b6('0xf')]('/:id',auth[_0xe1b6('0x9')](),controller[_0xe1b6('0x10')]);router[_0xe1b6('0x11')](_0xe1b6('0xb'),auth[_0xe1b6('0x9')](),controller[_0xe1b6('0x12')]);module[_0xe1b6('0x13')]=router; \ No newline at end of file +var _0x8825=['isAuthenticated','index','get','describe','show','post','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller'];(function(_0x31828,_0x68ddcb){var _0x5ea187=function(_0x340f95){while(--_0x340f95){_0x31828['push'](_0x31828['shift']());}};_0x5ea187(++_0x68ddcb);}(_0x8825,0x146));var _0x5882=function(_0x3967fa,_0x3fe8e5){_0x3967fa=_0x3967fa-0x0;var _0x42df13=_0x8825[_0x3967fa];return _0x42df13;};'use strict';var multer=require('multer');var util=require(_0x5882('0x0'));var path=require(_0x5882('0x1'));var timeout=require(_0x5882('0x2'));var express=require(_0x5882('0x3'));var router=express[_0x5882('0x4')]();var fs_extra=require(_0x5882('0x5'));var auth=require(_0x5882('0x6'));var interaction=require(_0x5882('0x7'));var config=require(_0x5882('0x8'));var controller=require(_0x5882('0x9'));router['get']('/',auth[_0x5882('0xa')](),controller[_0x5882('0xb')]);router[_0x5882('0xc')]('/describe',auth[_0x5882('0xa')](),controller[_0x5882('0xd')]);router[_0x5882('0xc')]('/:id',auth[_0x5882('0xa')](),controller[_0x5882('0xe')]);router[_0x5882('0xf')]('/',auth[_0x5882('0xa')](),controller['create']);router['put'](_0x5882('0x10'),auth[_0x5882('0xa')](),controller[_0x5882('0x11')]);router[_0x5882('0x12')]('/:id',auth[_0x5882('0xa')](),controller[_0x5882('0x13')]);module[_0x5882('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index b71efbb..912e4fe 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 _0x2e7a=['sequelize','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2e7a,0x170));var _0xa2e7=function(_0x2be0e0,_0x3c39b1){_0x2be0e0=_0x2be0e0-0x0;var _0x567bd6=_0x2e7a[_0x2be0e0];return _0x567bd6;};'use strict';var Sequelize=require(_0xa2e7('0x0'));module[_0xa2e7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2b8b=['INTEGER','STRING','sequelize','exports'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x2b8b,0xba));var _0xb2b8=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2b8b[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xb2b8('0x0'));module[_0xb2b8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb2b8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb2b8('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1dcdda8..92ffcfd 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 _0x8e3f=['save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','UserProfileResource','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','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','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=typeof _0x40c196['offset']===_0xf8e3('0x1d')&&typeof _0x40c196[_0xf8e3('0x1e')]===_0xf8e3('0x1d');var _0x3b01ac=_0x460629[_0xf8e3('0x1f')];var _0x11d4cc=_0x570ee3?0x0:_0x40c196[_0xf8e3('0x20')];var _0x2e27e3=_0x570ee3?_0x460629[_0xf8e3('0x1f')]:_0x40c196[_0xf8e3('0x20')]+_0x40c196['limit'];var _0x20cc64;if(_0x2e27e3>=_0x3b01ac){_0x2e27e3=_0x3b01ac;_0x20cc64=0xc8;}else{_0x20cc64=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x20cc64);return _0x1ec773[_0xf8e3('0x21')](_0xf8e3('0x22'),_0x11d4cc+'-'+_0x2e27e3+'/'+_0x3b01ac)[_0xf8e3('0x23')](_0x460629);}return null;};}function patchUpdates(_0x11c58e){return function(_0x1cae53){try{jsonpatch[_0xf8e3('0x24')](_0x1cae53,_0x11c58e,!![]);}catch(_0x5b99b1){return BPromise[_0xf8e3('0x25')](_0x5b99b1);}return _0x1cae53[_0xf8e3('0x26')]();};}function saveUpdates(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')](_0x3c636d)['then'](function(_0x286059){return _0x286059;});}return null;};}function removeEntity(_0x225a1b,_0x33d526){return function(_0x2dc856){if(_0x2dc856){return _0x2dc856[_0xf8e3('0x28')]()[_0xf8e3('0x29')](function(){_0x225a1b['status'](0xcc)[_0xf8e3('0x1b')]();});}};}function handleEntityNotFound(_0x2fc674,_0x3373ca){return function(_0x417b42){if(!_0x417b42){_0x2fc674[_0xf8e3('0x1a')](0x194);}return _0x417b42;};}function handleError(_0x3b41a1,_0x2963ed){_0x2963ed=_0x2963ed||0x1f4;return function(_0x157a2d){logger['error'](_0x157a2d[_0xf8e3('0x2a')]);if(_0x157a2d[_0xf8e3('0x2b')]){delete _0x157a2d[_0xf8e3('0x2b')];}_0x3b41a1[_0xf8e3('0x1c')](_0x2963ed)[_0xf8e3('0x2c')](_0x157a2d);};}exports[_0xf8e3('0x2d')]=function(_0x16485e,_0xfaf15d){var _0x4f2ae9={},_0x21e1c0={},_0x243e28={'count':0x0,'rows':[]};var _0x492694=_[_0xf8e3('0x2e')](db['UserProfileResource'][_0xf8e3('0x2f')],function(_0x10cf28){return{'name':_0x10cf28[_0xf8e3('0x30')],'type':_0x10cf28[_0xf8e3('0x31')][_0xf8e3('0x32')]};});_0x21e1c0[_0xf8e3('0x33')]=_[_0xf8e3('0x2e')](_0x492694,_0xf8e3('0x2b'));_0x21e1c0['query']=_[_0xf8e3('0x34')](_0x16485e[_0xf8e3('0x35')]);_0x21e1c0['filters']=_['intersection'](_0x21e1c0['model'],_0x21e1c0[_0xf8e3('0x35')]);_0x4f2ae9['attributes']=_[_0xf8e3('0x36')](_0x21e1c0[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x16485e[_0xf8e3('0x35')]['fields']));_0x4f2ae9['attributes']=_0x4f2ae9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0x4f2ae9[_0xf8e3('0x38')]:_0x21e1c0[_0xf8e3('0x33')];if(!_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x3a')]('nolimit')){_0x4f2ae9[_0xf8e3('0x1e')]=qs['limit'](_0x16485e['query'][_0xf8e3('0x1e')]);_0x4f2ae9[_0xf8e3('0x20')]=qs[_0xf8e3('0x20')](_0x16485e[_0xf8e3('0x35')]['offset']);}_0x4f2ae9['order']=qs[_0xf8e3('0x3b')](_0x16485e[_0xf8e3('0x35')]['sort']);_0x4f2ae9[_0xf8e3('0x3c')]=qs[_0xf8e3('0x3d')](_[_0xf8e3('0x3e')](_0x16485e[_0xf8e3('0x35')],_0x21e1c0['filters']),_0x492694);if(_0x16485e['query']['filter']){_0x4f2ae9[_0xf8e3('0x3c')]=_[_0xf8e3('0x3f')](_0x4f2ae9[_0xf8e3('0x3c')],{'$or':_[_0xf8e3('0x2e')](_0x492694,function(_0x53160a){if(_0x53160a[_0xf8e3('0x31')]!=='VIRTUAL'){var _0x20909b={};_0x20909b[_0x53160a[_0xf8e3('0x2b')]]={'$like':'%'+_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x40')]+'%'};return _0x20909b;}})});}_0x4f2ae9=_[_0xf8e3('0x3f')]({},_0x4f2ae9,_0x16485e[_0xf8e3('0x41')]);var _0x82e778={'where':_0x4f2ae9[_0xf8e3('0x3c')]};return db[_0xf8e3('0x42')]['count'](_0x82e778)[_0xf8e3('0x29')](function(_0x537089){_0x243e28[_0xf8e3('0x1f')]=_0x537089;if(_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x43')]){_0x4f2ae9[_0xf8e3('0x44')]=[{'all':!![]}];}return db[_0xf8e3('0x42')][_0xf8e3('0x45')](_0x4f2ae9);})[_0xf8e3('0x29')](function(_0x2f05b7){_0x243e28['rows']=_0x2f05b7;return _0x243e28;})[_0xf8e3('0x29')](respondWithFilteredResult(_0xfaf15d,_0x4f2ae9))[_0xf8e3('0x46')](handleError(_0xfaf15d,null));};exports[_0xf8e3('0x47')]=function(_0x382dbb,_0x6dd110){var _0xe7fcb9={'raw':![],'where':{'id':_0x382dbb[_0xf8e3('0x48')]['id']}},_0x792190={};_0x792190['model']=_['keys'](db['UserProfileResource'][_0xf8e3('0x2f')]);_0x792190[_0xf8e3('0x35')]=_['keys'](_0x382dbb[_0xf8e3('0x35')]);_0x792190['filters']=_[_0xf8e3('0x36')](_0x792190[_0xf8e3('0x33')],_0x792190['query']);_0xe7fcb9[_0xf8e3('0x38')]=_['intersection'](_0x792190[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x382dbb['query'][_0xf8e3('0x37')]));_0xe7fcb9[_0xf8e3('0x38')]=_0xe7fcb9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0xe7fcb9['attributes']:_0x792190['model'];if(_0x382dbb['query'][_0xf8e3('0x43')]){_0xe7fcb9[_0xf8e3('0x44')]=[{'all':!![]}];}_0xe7fcb9=_[_0xf8e3('0x3f')]({},_0xe7fcb9,_0x382dbb['options']);return db[_0xf8e3('0x42')]['find'](_0xe7fcb9)[_0xf8e3('0x29')](handleEntityNotFound(_0x6dd110,null))[_0xf8e3('0x29')](respondWithResult(_0x6dd110,null))['catch'](handleError(_0x6dd110,null));};exports['create']=function(_0x128234,_0x2939e6){return db[_0xf8e3('0x42')][_0xf8e3('0x49')](_0x128234[_0xf8e3('0x4a')],{})[_0xf8e3('0x29')](respondWithResult(_0x2939e6,0xc9))[_0xf8e3('0x46')](handleError(_0x2939e6,null));};exports[_0xf8e3('0x27')]=function(_0xdc2430,_0x81898e){if(_0xdc2430[_0xf8e3('0x4a')]['id']){delete _0xdc2430['body']['id'];}return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0xdc2430[_0xf8e3('0x48')]['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x81898e,null))[_0xf8e3('0x29')](saveUpdates(_0xdc2430[_0xf8e3('0x4a')],null))['then'](respondWithResult(_0x81898e,null))[_0xf8e3('0x46')](handleError(_0x81898e,null));};exports[_0xf8e3('0x28')]=function(_0x39caae,_0x3e60a6){return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0x39caae['params']['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x3e60a6,null))[_0xf8e3('0x29')](removeEntity(_0x3e60a6,null))[_0xf8e3('0x46')](handleError(_0x3e60a6,null));};exports[_0xf8e3('0x4c')]=function(_0x113404,_0x2fef16){return db['UserProfileResource'][_0xf8e3('0x4c')]()[_0xf8e3('0x29')](respondWithResult(_0x2fef16,null))[_0xf8e3('0x46')](handleError(_0x2fef16,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','UserProfileResource','includeAll','rows','catch','show'];(function(_0x223b0c,_0x371c5a){var _0x4ce5ed=function(_0x528c8b){while(--_0x528c8b){_0x223b0c['push'](_0x223b0c['shift']());}};_0x4ce5ed(++_0x371c5a);}(_0x0295,0x1f0));var _0x5029=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0x0295[_0x2f3d29];return _0x53d69d;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['UserProfileResource'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['UserProfileResource'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 18dab6f..69e9339 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 _0x391f=['util','../../config/logger','moment','path','rimraf','../../config/environment','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x13461f,_0x496fc3){var _0x39131d=function(_0x9e9a72){while(--_0x9e9a72){_0x13461f['push'](_0x13461f['shift']());}};_0x39131d(++_0x496fc3);}(_0x391f,0x1a4));var _0xf391=function(_0x24208d,_0x56509d){_0x24208d=_0x24208d-0x0;var _0x89cb83=_0x391f[_0x24208d];return _0x89cb83;};'use strict';var _=require('lodash');var util=require(_0xf391('0x0'));var logger=require(_0xf391('0x1'))('api');var moment=require(_0xf391('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf391('0x3'));var rimraf=require(_0xf391('0x4'));var config=require(_0xf391('0x5'));var attributes=require('./userProfileResource.attributes');module[_0xf391('0x6')]=function(_0x5680d1,_0x2d58e9){return _0x5680d1['define'](_0xf391('0x7'),attributes,{'tableName':_0xf391('0x8'),'paranoid':![],'indexes':[{'name':_0xf391('0x9'),'fields':[_0xf391('0xa'),_0xf391('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcfb5=['util','../../config/logger','api','bluebird','request-promise','path','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0xcfb5,0x192));var _0x5cfb=function(_0x1a9c36,_0x2c8872){_0x1a9c36=_0x1a9c36-0x0;var _0x4397f7=_0xcfb5[_0x1a9c36];return _0x4397f7;};'use strict';var _=require(_0x5cfb('0x0'));var util=require(_0x5cfb('0x1'));var logger=require(_0x5cfb('0x2'))(_0x5cfb('0x3'));var moment=require('moment');var BPromise=require(_0x5cfb('0x4'));var rp=require(_0x5cfb('0x5'));var fs=require('fs');var path=require(_0x5cfb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x5a9584,_0x9085a5){return _0x5a9584[_0x5cfb('0x7')](_0x5cfb('0x8'),attributes,{'tableName':_0x5cfb('0x9'),'paranoid':![],'indexes':[{'name':_0x5cfb('0xa'),'fields':[_0x5cfb('0xb'),_0x5cfb('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 3da49a4..e7a29e2 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 _0x94ca=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','UserProfileResource,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x94ca,0x105));var _0xa94c=function(_0x381cc4,_0x1694f2){_0x381cc4=_0x381cc4-0x0;var _0x1fdac0=_0x94ca[_0x381cc4];return _0x1fdac0;};'use strict';var _=require(_0xa94c('0x0'));var util=require(_0xa94c('0x1'));var moment=require(_0xa94c('0x2'));var BPromise=require(_0xa94c('0x3'));var rs=require(_0xa94c('0x4'));var fs=require('fs');var Redis=require(_0xa94c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa94c('0x6'));var logger=require(_0xa94c('0x7'))(_0xa94c('0x8'));var config=require(_0xa94c('0x9'));var jayson=require(_0xa94c('0xa'));var client=jayson[_0xa94c('0xb')][_0xa94c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x153398,_0x47d350,_0x530f8c){return new BPromise(function(_0x414b31,_0x426983){return client[_0xa94c('0xd')](_0x153398,_0x530f8c)['then'](function(_0x5701c6){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x47d350,_0xa94c('0xe'));logger[_0xa94c('0xf')](_0xa94c('0x10'),_0x47d350,_0xa94c('0xe'),JSON['stringify'](_0x5701c6));if(_0x5701c6[_0xa94c('0x11')]){if(_0x5701c6[_0xa94c('0x11')]['code']===0x1f4){logger['error'](_0xa94c('0x12'),_0x47d350,_0x5701c6[_0xa94c('0x11')]['message']);return _0x426983(_0x5701c6[_0xa94c('0x11')][_0xa94c('0x13')]);}logger[_0xa94c('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x47d350,_0x5701c6[_0xa94c('0x11')][_0xa94c('0x13')]);return _0x414b31(_0x5701c6[_0xa94c('0x11')][_0xa94c('0x13')]);}else{logger[_0xa94c('0x14')](_0xa94c('0x12'),_0x47d350,_0xa94c('0xe'));_0x414b31(_0x5701c6[_0xa94c('0x15')][_0xa94c('0x13')]);}})[_0xa94c('0x16')](function(_0x1058f7){logger[_0xa94c('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x47d350,_0x1058f7);_0x426983(_0x1058f7);});});} \ No newline at end of file +var _0x7d88=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x4745fd,_0x43820a){var _0x461f1e=function(_0x5db9ec){while(--_0x5db9ec){_0x4745fd['push'](_0x4745fd['shift']());}};_0x461f1e(++_0x43820a);}(_0x7d88,0x7d));var _0x87d8=function(_0xbc66e6,_0x2e42eb){_0xbc66e6=_0xbc66e6-0x0;var _0x1c075a=_0x7d88[_0xbc66e6];return _0x1c075a;};'use strict';var _=require(_0x87d8('0x0'));var util=require(_0x87d8('0x1'));var moment=require(_0x87d8('0x2'));var BPromise=require(_0x87d8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87d8('0x4'));var db=require(_0x87d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x87d8('0x6'))(_0x87d8('0x7'));var config=require(_0x87d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x87d8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34e5fe,_0x1eb736,_0x5ccdaa){return new BPromise(function(_0x5650bf,_0x567471){return client[_0x87d8('0xa')](_0x34e5fe,_0x5ccdaa)[_0x87d8('0xb')](function(_0x2d095f){logger['info'](_0x87d8('0xc'),_0x1eb736,'request\x20sent');logger['debug'](_0x87d8('0xd'),_0x1eb736,_0x87d8('0xe'),JSON[_0x87d8('0xf')](_0x2d095f));if(_0x2d095f[_0x87d8('0x10')]){if(_0x2d095f['error'][_0x87d8('0x11')]===0x1f4){logger[_0x87d8('0x10')](_0x87d8('0xc'),_0x1eb736,_0x2d095f[_0x87d8('0x10')]['message']);return _0x567471(_0x2d095f[_0x87d8('0x10')][_0x87d8('0x12')]);}logger[_0x87d8('0x10')](_0x87d8('0xc'),_0x1eb736,_0x2d095f['error']['message']);return _0x5650bf(_0x2d095f[_0x87d8('0x10')][_0x87d8('0x12')]);}else{logger['info'](_0x87d8('0xc'),_0x1eb736,_0x87d8('0xe'));_0x5650bf(_0x2d095f[_0x87d8('0x13')]['message']);}})[_0x87d8('0x14')](function(_0x8bed82){logger[_0x87d8('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x1eb736,_0x8bed82);_0x567471(_0x8bed82);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index f86f4d2..0d54dee 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 _0x532f=['Router','fs-extra','../../components/interaction/service','./userProfileSection.controller','index','get','/describe','describe','isAuthenticated','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1a4268,_0xcbe63f){var _0x3247a3=function(_0x5bf2c1){while(--_0x5bf2c1){_0x1a4268['push'](_0x1a4268['shift']());}};_0x3247a3(++_0xcbe63f);}(_0x532f,0x175));var _0xf532=function(_0x359e4d,_0xf04805){_0x359e4d=_0x359e4d-0x0;var _0x2b5f45=_0x532f[_0x359e4d];return _0x2b5f45;};'use strict';var multer=require(_0xf532('0x0'));var util=require(_0xf532('0x1'));var path=require(_0xf532('0x2'));var timeout=require(_0xf532('0x3'));var express=require(_0xf532('0x4'));var router=express[_0xf532('0x5')]();var fs_extra=require(_0xf532('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf532('0x7'));var config=require('../../config/environment');var controller=require(_0xf532('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf532('0x9')]);router[_0xf532('0xa')](_0xf532('0xb'),auth['isAuthenticated'](),controller[_0xf532('0xc')]);router['get']('/:id',auth[_0xf532('0xd')](),controller['show']);router[_0xf532('0xe')]('/',auth[_0xf532('0xd')](),controller[_0xf532('0xf')]);router[_0xf532('0x10')](_0xf532('0x11'),auth[_0xf532('0xd')](),controller[_0xf532('0x12')]);router['delete'](_0xf532('0x11'),auth[_0xf532('0xd')](),controller[_0xf532('0x13')]);module[_0xf532('0x14')]=router; \ No newline at end of file +var _0x197f=['isAuthenticated','index','describe','get','post','put','/:id','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller'];(function(_0x374bbb,_0x1a2762){var _0x15a2a7=function(_0xf25592){while(--_0xf25592){_0x374bbb['push'](_0x374bbb['shift']());}};_0x15a2a7(++_0x1a2762);}(_0x197f,0x184));var _0xf197=function(_0x28c9cf,_0x7f4530){_0x28c9cf=_0x28c9cf-0x0;var _0x72da3=_0x197f[_0x28c9cf];return _0x72da3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf197('0x0'));var express=require(_0xf197('0x1'));var router=express[_0xf197('0x2')]();var fs_extra=require(_0xf197('0x3'));var auth=require(_0xf197('0x4'));var interaction=require(_0xf197('0x5'));var config=require(_0xf197('0x6'));var controller=require(_0xf197('0x7'));router['get']('/',auth[_0xf197('0x8')](),controller[_0xf197('0x9')]);router['get']('/describe',auth[_0xf197('0x8')](),controller[_0xf197('0xa')]);router[_0xf197('0xb')]('/:id',auth[_0xf197('0x8')](),controller['show']);router[_0xf197('0xc')]('/',auth[_0xf197('0x8')](),controller['create']);router[_0xf197('0xd')](_0xf197('0xe'),auth[_0xf197('0x8')](),controller[_0xf197('0xf')]);router[_0xf197('0x10')]('/:id',auth[_0xf197('0x8')](),controller['destroy']);module[_0xf197('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e648760..6888b64 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 _0xd7d1=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x120534,_0x5e8d08){_0x120534=_0x120534-0x0;var _0x5898b9=_0xd7d1[_0x120534];return _0x5898b9;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x1d7d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x1d7d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x1d7d('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x1d7d('0x2')],'set':function(_0x1ac097){this[_0x1d7d('0x5')](_0x1d7d('0x6'),_0x1ac097?_0x1ac097[_0x1d7d('0x7')](''):[]);},'get':function(){return this[_0x1d7d('0x8')]('crudPermissions')?this[_0x1d7d('0x8')](_0x1d7d('0x6'))[_0x1d7d('0x9')](''):[];}}}; \ No newline at end of file +var _0x9c00=['STRING','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9c00,0x1a0));var _0x09c0=function(_0x40124e,_0x47920b){_0x40124e=_0x40124e-0x0;var _0x2e8dc2=_0x9c00[_0x40124e];return _0x2e8dc2;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x09c0('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x09c0('0x4')],'set':function(_0x2c702c){this[_0x09c0('0x5')](_0x09c0('0x6'),_0x2c702c?_0x2c702c[_0x09c0('0x7')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x09c0('0x8')](_0x09c0('0x6'))[_0x09c0('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 922a4b0..dfaa152 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 _0x65e5=['undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','order','sort','where','pick','filter','merge','map','VIRTUAL','options','UserProfileSection','includeAll','include','rows','show','params','length','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x65e5,0xc2));var _0x565e=function(_0xf1507c,_0x23f2a9){_0xf1507c=_0xf1507c-0x0;var _0xc0c469=_0x65e5[_0xf1507c];return _0xc0c469;};'use strict';var emlformat=require(_0x565e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x565e('0x1'));var jsonpatch=require(_0x565e('0x2'));var rp=require(_0x565e('0x3'));var moment=require(_0x565e('0x4'));var BPromise=require(_0x565e('0x5'));var Mustache=require(_0x565e('0x6'));var util=require(_0x565e('0x7'));var path=require(_0x565e('0x8'));var sox=require('sox');var csv=require(_0x565e('0x9'));var ejs=require(_0x565e('0xa'));var fs=require('fs');var fs_extra=require(_0x565e('0xb'));var _=require(_0x565e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x565e('0xd'));var deskjs=require(_0x565e('0xe'));var toCsv=require(_0x565e('0x9'));var querystring=require(_0x565e('0xf'));var Papa=require(_0x565e('0x10'));var Redis=require(_0x565e('0x11'));var authService=require(_0x565e('0x12'));var qs=require(_0x565e('0x13'));var as=require(_0x565e('0x14'));var hardwareService=require(_0x565e('0x15'));var logger=require(_0x565e('0x16'))(_0x565e('0x17'));var utils=require('../../config/utils');var config=require(_0x565e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x565e('0x19'))['db'];function respondWithStatusCode(_0x566cd0,_0x5d80f0){_0x5d80f0=_0x5d80f0||0xcc;return function(_0x3e097b){if(_0x3e097b){return _0x566cd0[_0x565e('0x1a')](_0x5d80f0);}return _0x566cd0[_0x565e('0x1b')](_0x5d80f0)[_0x565e('0x1c')]();};}function respondWithResult(_0x33f0c8,_0x3ed8cc){_0x3ed8cc=_0x3ed8cc||0xc8;return function(_0x5bd1a2){if(_0x5bd1a2){return _0x33f0c8[_0x565e('0x1b')](_0x3ed8cc)[_0x565e('0x1d')](_0x5bd1a2);}};}function respondWithFilteredResult(_0x42a4b2,_0x120c1e){return function(_0x45f7e1){if(_0x45f7e1){var _0x2ead59=typeof _0x120c1e[_0x565e('0x1e')]===_0x565e('0x1f')&&typeof _0x120c1e[_0x565e('0x20')]==='undefined';var _0x2c0caf=_0x45f7e1[_0x565e('0x21')];var _0x34700d=_0x2ead59?0x0:_0x120c1e[_0x565e('0x1e')];var _0x19113b=_0x2ead59?_0x45f7e1[_0x565e('0x21')]:_0x120c1e['offset']+_0x120c1e[_0x565e('0x20')];var _0x404b69;if(_0x19113b>=_0x2c0caf){_0x19113b=_0x2c0caf;_0x404b69=0xc8;}else{_0x404b69=0xce;}_0x42a4b2[_0x565e('0x1b')](_0x404b69);return _0x42a4b2[_0x565e('0x22')]('Content-Range',_0x34700d+'-'+_0x19113b+'/'+_0x2c0caf)[_0x565e('0x1d')](_0x45f7e1);}return null;};}function patchUpdates(_0x3a09e9){return function(_0x2273c1){try{jsonpatch[_0x565e('0x23')](_0x2273c1,_0x3a09e9,!![]);}catch(_0x5e6f2e){return BPromise[_0x565e('0x24')](_0x5e6f2e);}return _0x2273c1[_0x565e('0x25')]();};}function saveUpdates(_0x2bf915,_0x36e5bc){return function(_0x2493c7){if(_0x2493c7){return _0x2493c7[_0x565e('0x26')](_0x2bf915)[_0x565e('0x27')](function(_0x4c5238){return _0x4c5238;});}return null;};}function removeEntity(_0x36e882,_0x446a88){return function(_0x1c0f7c){if(_0x1c0f7c){return _0x1c0f7c[_0x565e('0x28')]()[_0x565e('0x27')](function(){_0x36e882['status'](0xcc)[_0x565e('0x1c')]();});}};}function handleEntityNotFound(_0x4053fb,_0x5695ee){return function(_0x261ede){if(!_0x261ede){_0x4053fb['sendStatus'](0x194);}return _0x261ede;};}function handleError(_0x3ea373,_0xa357f1){_0xa357f1=_0xa357f1||0x1f4;return function(_0x4b5ce8){logger['error'](_0x4b5ce8[_0x565e('0x29')]);if(_0x4b5ce8[_0x565e('0x2a')]){delete _0x4b5ce8[_0x565e('0x2a')];}_0x3ea373[_0x565e('0x1b')](_0xa357f1)['send'](_0x4b5ce8);};}exports[_0x565e('0x2b')]=function(_0x3d3972,_0x2271eb){var _0x1bf92e={},_0x15b46b={},_0x707d0b={'count':0x0,'rows':[]};var _0x3868f2=_['map'](db['UserProfileSection'][_0x565e('0x2c')],function(_0x2c0110){return{'name':_0x2c0110[_0x565e('0x2d')],'type':_0x2c0110[_0x565e('0x2e')][_0x565e('0x2f')]};});_0x15b46b[_0x565e('0x30')]=_['map'](_0x3868f2,_0x565e('0x2a'));_0x15b46b['query']=_['keys'](_0x3d3972['query']);_0x15b46b[_0x565e('0x31')]=_[_0x565e('0x32')](_0x15b46b[_0x565e('0x30')],_0x15b46b[_0x565e('0x33')]);_0x1bf92e[_0x565e('0x34')]=_['intersection'](_0x15b46b['model'],qs[_0x565e('0x35')](_0x3d3972[_0x565e('0x33')][_0x565e('0x35')]));_0x1bf92e[_0x565e('0x34')]=_0x1bf92e[_0x565e('0x34')]['length']?_0x1bf92e[_0x565e('0x34')]:_0x15b46b['model'];if(!_0x3d3972[_0x565e('0x33')]['hasOwnProperty']('nolimit')){_0x1bf92e['limit']=qs[_0x565e('0x20')](_0x3d3972[_0x565e('0x33')][_0x565e('0x20')]);_0x1bf92e[_0x565e('0x1e')]=qs['offset'](_0x3d3972[_0x565e('0x33')]['offset']);}_0x1bf92e[_0x565e('0x36')]=qs['sort'](_0x3d3972[_0x565e('0x33')][_0x565e('0x37')]);_0x1bf92e[_0x565e('0x38')]=qs[_0x565e('0x31')](_[_0x565e('0x39')](_0x3d3972[_0x565e('0x33')],_0x15b46b[_0x565e('0x31')]),_0x3868f2);if(_0x3d3972[_0x565e('0x33')][_0x565e('0x3a')]){_0x1bf92e[_0x565e('0x38')]=_[_0x565e('0x3b')](_0x1bf92e['where'],{'$or':_[_0x565e('0x3c')](_0x3868f2,function(_0x4608e0){if(_0x4608e0[_0x565e('0x2e')]!==_0x565e('0x3d')){var _0x5113a3={};_0x5113a3[_0x4608e0[_0x565e('0x2a')]]={'$like':'%'+_0x3d3972[_0x565e('0x33')]['filter']+'%'};return _0x5113a3;}})});}_0x1bf92e=_[_0x565e('0x3b')]({},_0x1bf92e,_0x3d3972[_0x565e('0x3e')]);var _0x55894d={'where':_0x1bf92e[_0x565e('0x38')]};return db[_0x565e('0x3f')][_0x565e('0x21')](_0x55894d)['then'](function(_0x639b35){_0x707d0b[_0x565e('0x21')]=_0x639b35;if(_0x3d3972['query'][_0x565e('0x40')]){_0x1bf92e[_0x565e('0x41')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1bf92e);})['then'](function(_0x38b0b6){_0x707d0b[_0x565e('0x42')]=_0x38b0b6;return _0x707d0b;})[_0x565e('0x27')](respondWithFilteredResult(_0x2271eb,_0x1bf92e))['catch'](handleError(_0x2271eb,null));};exports[_0x565e('0x43')]=function(_0x2ed29c,_0x26bf14){var _0x4ee4f2={'raw':![],'where':{'id':_0x2ed29c[_0x565e('0x44')]['id']}},_0x4db473={};_0x4db473['model']=_['keys'](db[_0x565e('0x3f')][_0x565e('0x2c')]);_0x4db473['query']=_['keys'](_0x2ed29c[_0x565e('0x33')]);_0x4db473[_0x565e('0x31')]=_[_0x565e('0x32')](_0x4db473[_0x565e('0x30')],_0x4db473[_0x565e('0x33')]);_0x4ee4f2['attributes']=_[_0x565e('0x32')](_0x4db473['model'],qs[_0x565e('0x35')](_0x2ed29c['query'][_0x565e('0x35')]));_0x4ee4f2[_0x565e('0x34')]=_0x4ee4f2[_0x565e('0x34')][_0x565e('0x45')]?_0x4ee4f2[_0x565e('0x34')]:_0x4db473[_0x565e('0x30')];if(_0x2ed29c[_0x565e('0x33')]['includeAll']){_0x4ee4f2[_0x565e('0x41')]=[{'all':!![]}];}_0x4ee4f2=_['merge']({},_0x4ee4f2,_0x2ed29c[_0x565e('0x3e')]);return db[_0x565e('0x3f')][_0x565e('0x46')](_0x4ee4f2)[_0x565e('0x27')](handleEntityNotFound(_0x26bf14,null))[_0x565e('0x27')](respondWithResult(_0x26bf14,null))[_0x565e('0x47')](handleError(_0x26bf14,null));};exports['create']=function(_0x3f1f77,_0x5af636){return db[_0x565e('0x3f')][_0x565e('0x48')](_0x3f1f77[_0x565e('0x49')],{})['then'](respondWithResult(_0x5af636,0xc9))[_0x565e('0x47')](handleError(_0x5af636,null));};exports[_0x565e('0x26')]=function(_0x5f40eb,_0x408b7d){if(_0x5f40eb[_0x565e('0x49')]['id']){delete _0x5f40eb[_0x565e('0x49')]['id'];}return db[_0x565e('0x3f')][_0x565e('0x46')]({'where':{'id':_0x5f40eb[_0x565e('0x44')]['id']}})['then'](handleEntityNotFound(_0x408b7d,null))[_0x565e('0x27')](saveUpdates(_0x5f40eb[_0x565e('0x49')],null))[_0x565e('0x27')](respondWithResult(_0x408b7d,null))['catch'](handleError(_0x408b7d,null));};exports[_0x565e('0x28')]=function(_0x433506,_0x268819){return db[_0x565e('0x3f')][_0x565e('0x46')]({'where':{'id':_0x433506['params']['id']}})['then'](handleEntityNotFound(_0x268819,null))[_0x565e('0x27')](removeEntity(_0x268819,null))[_0x565e('0x47')](handleError(_0x268819,null));};exports[_0x565e('0x4a')]=function(_0x1f9fb7,_0x32ff9a){return db[_0x565e('0x3f')][_0x565e('0x4a')]()[_0x565e('0x27')](respondWithResult(_0x32ff9a,null))[_0x565e('0x47')](handleError(_0x32ff9a,null));}; \ No newline at end of file +var _0xc63a=['count','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc63a,0x1c4));var _0xac63=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xc63a[_0x261522];return _0x98a25a;};'use strict';var emlformat=require(_0xac63('0x0'));var rimraf=require(_0xac63('0x1'));var zipdir=require(_0xac63('0x2'));var jsonpatch=require(_0xac63('0x3'));var rp=require(_0xac63('0x4'));var moment=require('moment');var BPromise=require(_0xac63('0x5'));var Mustache=require('mustache');var util=require(_0xac63('0x6'));var path=require(_0xac63('0x7'));var sox=require('sox');var csv=require(_0xac63('0x8'));var ejs=require(_0xac63('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xac63('0xa'));var crypto=require('crypto');var jsforce=require(_0xac63('0xb'));var deskjs=require(_0xac63('0xc'));var toCsv=require(_0xac63('0x8'));var querystring=require(_0xac63('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xac63('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xac63('0xf'));var hardwareService=require(_0xac63('0x10'));var logger=require(_0xac63('0x11'))(_0xac63('0x12'));var utils=require(_0xac63('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xac63('0x14'));var db=require(_0xac63('0x15'))['db'];function respondWithStatusCode(_0xea6f18,_0x1f4297){_0x1f4297=_0x1f4297||0xcc;return function(_0x3741ff){if(_0x3741ff){return _0xea6f18['sendStatus'](_0x1f4297);}return _0xea6f18[_0xac63('0x16')](_0x1f4297)[_0xac63('0x17')]();};}function respondWithResult(_0x1f70da,_0x1c6fb1){_0x1c6fb1=_0x1c6fb1||0xc8;return function(_0x1799c6){if(_0x1799c6){return _0x1f70da[_0xac63('0x16')](_0x1c6fb1)[_0xac63('0x18')](_0x1799c6);}};}function respondWithFilteredResult(_0x9e8663,_0x34548c){return function(_0x33ed3f){if(_0x33ed3f){var _0x124800=typeof _0x34548c['offset']===_0xac63('0x19')&&typeof _0x34548c[_0xac63('0x1a')]===_0xac63('0x19');var _0x924f90=_0x33ed3f['count'];var _0x2ef0b6=_0x124800?0x0:_0x34548c['offset'];var _0x2d88c8=_0x124800?_0x33ed3f['count']:_0x34548c[_0xac63('0x1b')]+_0x34548c[_0xac63('0x1a')];var _0x52b950;if(_0x2d88c8>=_0x924f90){_0x2d88c8=_0x924f90;_0x52b950=0xc8;}else{_0x52b950=0xce;}_0x9e8663[_0xac63('0x16')](_0x52b950);return _0x9e8663[_0xac63('0x1c')]('Content-Range',_0x2ef0b6+'-'+_0x2d88c8+'/'+_0x924f90)[_0xac63('0x18')](_0x33ed3f);}return null;};}function patchUpdates(_0x13589f){return function(_0x3bfb0d){try{jsonpatch[_0xac63('0x1d')](_0x3bfb0d,_0x13589f,!![]);}catch(_0x5ec2cb){return BPromise[_0xac63('0x1e')](_0x5ec2cb);}return _0x3bfb0d[_0xac63('0x1f')]();};}function saveUpdates(_0x5dd3c8,_0x2ddc1c){return function(_0xbe504f){if(_0xbe504f){return _0xbe504f['update'](_0x5dd3c8)['then'](function(_0x2b6834){return _0x2b6834;});}return null;};}function removeEntity(_0x55c4cf,_0x52d06f){return function(_0x26fa6f){if(_0x26fa6f){return _0x26fa6f[_0xac63('0x20')]()[_0xac63('0x21')](function(){_0x55c4cf['status'](0xcc)[_0xac63('0x17')]();});}};}function handleEntityNotFound(_0x2b8db6,_0x474e3b){return function(_0x566789){if(!_0x566789){_0x2b8db6[_0xac63('0x22')](0x194);}return _0x566789;};}function handleError(_0x4c0198,_0x27e7cf){_0x27e7cf=_0x27e7cf||0x1f4;return function(_0x4d1922){logger[_0xac63('0x23')](_0x4d1922[_0xac63('0x24')]);if(_0x4d1922[_0xac63('0x25')]){delete _0x4d1922[_0xac63('0x25')];}_0x4c0198[_0xac63('0x16')](_0x27e7cf)[_0xac63('0x26')](_0x4d1922);};}exports[_0xac63('0x27')]=function(_0x37348e,_0x19ef7c){var _0xfd04fd={},_0x22bc7b={},_0x5d9910={'count':0x0,'rows':[]};var _0x213e9d=_[_0xac63('0x28')](db[_0xac63('0x29')][_0xac63('0x2a')],function(_0x36c276){return{'name':_0x36c276['fieldName'],'type':_0x36c276[_0xac63('0x2b')]['key']};});_0x22bc7b['model']=_[_0xac63('0x28')](_0x213e9d,_0xac63('0x25'));_0x22bc7b[_0xac63('0x2c')]=_[_0xac63('0x2d')](_0x37348e[_0xac63('0x2c')]);_0x22bc7b['filters']=_[_0xac63('0x2e')](_0x22bc7b['model'],_0x22bc7b[_0xac63('0x2c')]);_0xfd04fd[_0xac63('0x2f')]=_[_0xac63('0x2e')](_0x22bc7b[_0xac63('0x30')],qs[_0xac63('0x31')](_0x37348e['query']['fields']));_0xfd04fd[_0xac63('0x2f')]=_0xfd04fd[_0xac63('0x2f')]['length']?_0xfd04fd[_0xac63('0x2f')]:_0x22bc7b[_0xac63('0x30')];if(!_0x37348e[_0xac63('0x2c')][_0xac63('0x32')](_0xac63('0x33'))){_0xfd04fd[_0xac63('0x1a')]=qs[_0xac63('0x1a')](_0x37348e['query'][_0xac63('0x1a')]);_0xfd04fd[_0xac63('0x1b')]=qs[_0xac63('0x1b')](_0x37348e['query'][_0xac63('0x1b')]);}_0xfd04fd['order']=qs[_0xac63('0x34')](_0x37348e[_0xac63('0x2c')][_0xac63('0x34')]);_0xfd04fd[_0xac63('0x35')]=qs[_0xac63('0x36')](_[_0xac63('0x37')](_0x37348e['query'],_0x22bc7b['filters']),_0x213e9d);if(_0x37348e[_0xac63('0x2c')][_0xac63('0x38')]){_0xfd04fd['where']=_['merge'](_0xfd04fd[_0xac63('0x35')],{'$or':_[_0xac63('0x28')](_0x213e9d,function(_0x11f5c4){if(_0x11f5c4['type']!=='VIRTUAL'){var _0x13651f={};_0x13651f[_0x11f5c4[_0xac63('0x25')]]={'$like':'%'+_0x37348e[_0xac63('0x2c')][_0xac63('0x38')]+'%'};return _0x13651f;}})});}_0xfd04fd=_[_0xac63('0x39')]({},_0xfd04fd,_0x37348e[_0xac63('0x3a')]);var _0x103092={'where':_0xfd04fd[_0xac63('0x35')]};return db[_0xac63('0x29')]['count'](_0x103092)[_0xac63('0x21')](function(_0x97dd43){_0x5d9910[_0xac63('0x3b')]=_0x97dd43;if(_0x37348e[_0xac63('0x2c')][_0xac63('0x3c')]){_0xfd04fd[_0xac63('0x3d')]=[{'all':!![]}];}return db[_0xac63('0x29')][_0xac63('0x3e')](_0xfd04fd);})[_0xac63('0x21')](function(_0x1896d6){_0x5d9910[_0xac63('0x3f')]=_0x1896d6;return _0x5d9910;})['then'](respondWithFilteredResult(_0x19ef7c,_0xfd04fd))[_0xac63('0x40')](handleError(_0x19ef7c,null));};exports[_0xac63('0x41')]=function(_0x53670f,_0x3d1e36){var _0xa179e3={'raw':![],'where':{'id':_0x53670f['params']['id']}},_0x5a892a={};_0x5a892a['model']=_[_0xac63('0x2d')](db[_0xac63('0x29')][_0xac63('0x2a')]);_0x5a892a[_0xac63('0x2c')]=_[_0xac63('0x2d')](_0x53670f[_0xac63('0x2c')]);_0x5a892a[_0xac63('0x36')]=_['intersection'](_0x5a892a['model'],_0x5a892a['query']);_0xa179e3[_0xac63('0x2f')]=_[_0xac63('0x2e')](_0x5a892a['model'],qs[_0xac63('0x31')](_0x53670f['query'][_0xac63('0x31')]));_0xa179e3[_0xac63('0x2f')]=_0xa179e3[_0xac63('0x2f')][_0xac63('0x42')]?_0xa179e3[_0xac63('0x2f')]:_0x5a892a[_0xac63('0x30')];if(_0x53670f['query']['includeAll']){_0xa179e3[_0xac63('0x3d')]=[{'all':!![]}];}_0xa179e3=_['merge']({},_0xa179e3,_0x53670f[_0xac63('0x3a')]);return db[_0xac63('0x29')][_0xac63('0x43')](_0xa179e3)[_0xac63('0x21')](handleEntityNotFound(_0x3d1e36,null))['then'](respondWithResult(_0x3d1e36,null))['catch'](handleError(_0x3d1e36,null));};exports[_0xac63('0x44')]=function(_0x29b116,_0x446d03){return db['UserProfileSection'][_0xac63('0x44')](_0x29b116[_0xac63('0x45')],{})[_0xac63('0x21')](respondWithResult(_0x446d03,0xc9))[_0xac63('0x40')](handleError(_0x446d03,null));};exports[_0xac63('0x46')]=function(_0x16cbba,_0x4190fc){if(_0x16cbba[_0xac63('0x45')]['id']){delete _0x16cbba[_0xac63('0x45')]['id'];}return db[_0xac63('0x29')]['find']({'where':{'id':_0x16cbba[_0xac63('0x47')]['id']}})['then'](handleEntityNotFound(_0x4190fc,null))[_0xac63('0x21')](saveUpdates(_0x16cbba[_0xac63('0x45')],null))['then'](respondWithResult(_0x4190fc,null))[_0xac63('0x40')](handleError(_0x4190fc,null));};exports['destroy']=function(_0x2528ac,_0xf0c297){return db[_0xac63('0x29')][_0xac63('0x43')]({'where':{'id':_0x2528ac[_0xac63('0x47')]['id']}})[_0xac63('0x21')](handleEntityNotFound(_0xf0c297,null))[_0xac63('0x21')](removeEntity(_0xf0c297,null))[_0xac63('0x40')](handleError(_0xf0c297,null));};exports['describe']=function(_0x4c7780,_0xf52a20){return db[_0xac63('0x29')][_0xac63('0x48')]()['then'](respondWithResult(_0xf52a20,null))[_0xac63('0x40')](handleError(_0xf52a20,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ae8cd60..ef4ea25 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 _0xe556=['moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','sectionId','userProfileId','lodash','util','api'];(function(_0x544362,_0xc31c04){var _0x5c12f9=function(_0x365c8b){while(--_0x365c8b){_0x544362['push'](_0x544362['shift']());}};_0x5c12f9(++_0xc31c04);}(_0xe556,0xb3));var _0x6e55=function(_0x137a87,_0x433e7e){_0x137a87=_0x137a87-0x0;var _0x59cabc=_0xe556[_0x137a87];return _0x59cabc;};'use strict';var _=require(_0x6e55('0x0'));var util=require(_0x6e55('0x1'));var logger=require('../../config/logger')(_0x6e55('0x2'));var moment=require(_0x6e55('0x3'));var BPromise=require(_0x6e55('0x4'));var rp=require(_0x6e55('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e55('0x6'));var config=require(_0x6e55('0x7'));var attributes=require(_0x6e55('0x8'));module[_0x6e55('0x9')]=function(_0x32bd75,_0x5121a3){return _0x32bd75[_0x6e55('0xa')]('UserProfileSection',attributes,{'tableName':_0x6e55('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6e55('0xc'),_0x6e55('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x74bf=['../../config/logger','api','bluebird','request-promise','rimraf','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','userProfileId','util'];(function(_0x558e82,_0x3f810d){var _0x2f57fa=function(_0x58fe04){while(--_0x58fe04){_0x558e82['push'](_0x558e82['shift']());}};_0x2f57fa(++_0x3f810d);}(_0x74bf,0xaf));var _0xf74b=function(_0x48d093,_0x309068){_0x48d093=_0x48d093-0x0;var _0x34f8c0=_0x74bf[_0x48d093];return _0x34f8c0;};'use strict';var _=require('lodash');var util=require(_0xf74b('0x0'));var logger=require(_0xf74b('0x1'))(_0xf74b('0x2'));var moment=require('moment');var BPromise=require(_0xf74b('0x3'));var rp=require(_0xf74b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf74b('0x5'));var config=require('../../config/environment');var attributes=require(_0xf74b('0x6'));module[_0xf74b('0x7')]=function(_0x2e6b47,_0x4ccd15){return _0x2e6b47['define']('UserProfileSection',attributes,{'tableName':_0xf74b('0x8'),'paranoid':![],'indexes':[{'name':_0xf74b('0x9'),'fields':['sectionId',_0xf74b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6fc6182..9f19065 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 _0xf354=['lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x4ff87c,_0x306e82){var _0x356289=function(_0x50fdb8){while(--_0x50fdb8){_0x4ff87c['push'](_0x4ff87c['shift']());}};_0x356289(++_0x306e82);}(_0xf354,0x17c));var _0x4f35=function(_0x55ad15,_0x40fd20){_0x55ad15=_0x55ad15-0x0;var _0xcecadb=_0xf354[_0x55ad15];return _0xcecadb;};'use strict';var _=require(_0x4f35('0x0'));var util=require(_0x4f35('0x1'));var moment=require('moment');var BPromise=require(_0x4f35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f35('0x3'));var db=require(_0x4f35('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f35('0x5'));var config=require(_0x4f35('0x6'));var jayson=require(_0x4f35('0x7'));var client=jayson[_0x4f35('0x8')][_0x4f35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3644d2,_0x37a5da,_0x1ea44b){return new BPromise(function(_0x3ac6f6,_0x4c8b77){return client[_0x4f35('0xa')](_0x3644d2,_0x1ea44b)[_0x4f35('0xb')](function(_0x2be5d0){logger[_0x4f35('0xc')](_0x4f35('0xd'),_0x37a5da,_0x4f35('0xe'));logger[_0x4f35('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x37a5da,_0x4f35('0xe'),JSON[_0x4f35('0x10')](_0x2be5d0));if(_0x2be5d0[_0x4f35('0x11')]){if(_0x2be5d0['error']['code']===0x1f4){logger[_0x4f35('0x11')](_0x4f35('0xd'),_0x37a5da,_0x2be5d0[_0x4f35('0x11')]['message']);return _0x4c8b77(_0x2be5d0[_0x4f35('0x11')]['message']);}logger[_0x4f35('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x37a5da,_0x2be5d0[_0x4f35('0x11')][_0x4f35('0x12')]);return _0x3ac6f6(_0x2be5d0[_0x4f35('0x11')][_0x4f35('0x12')]);}else{logger[_0x4f35('0xc')](_0x4f35('0xd'),_0x37a5da,_0x4f35('0xe'));_0x3ac6f6(_0x2be5d0[_0x4f35('0x13')]['message']);}})['catch'](function(_0x24ce4b){logger[_0x4f35('0x11')](_0x4f35('0xd'),_0x37a5da,_0x24ce4b);_0x4c8b77(_0x24ce4b);});});} \ No newline at end of file +var _0x6761=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','UserProfileSection,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x47ac5d,_0x3b07b6){var _0x11f03b=function(_0x31a878){while(--_0x31a878){_0x47ac5d['push'](_0x47ac5d['shift']());}};_0x11f03b(++_0x3b07b6);}(_0x6761,0xc0));var _0x1676=function(_0x37cccd,_0x4a6d1f){_0x37cccd=_0x37cccd-0x0;var _0x1b285a=_0x6761[_0x37cccd];return _0x1b285a;};'use strict';var _=require(_0x1676('0x0'));var util=require('util');var moment=require(_0x1676('0x1'));var BPromise=require(_0x1676('0x2'));var rs=require(_0x1676('0x3'));var fs=require('fs');var Redis=require(_0x1676('0x4'));var db=require(_0x1676('0x5'))['db'];var utils=require(_0x1676('0x6'));var logger=require(_0x1676('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1676('0x8'));var client=jayson[_0x1676('0x9')][_0x1676('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x591088,_0x4eccec,_0x406f7f){return new BPromise(function(_0x3df338,_0x58fb8e){return client['request'](_0x591088,_0x406f7f)[_0x1676('0xb')](function(_0x5e9b9e){logger[_0x1676('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x4eccec,_0x1676('0xd'));logger[_0x1676('0xe')](_0x1676('0xf'),_0x4eccec,'request\x20sent',JSON[_0x1676('0x10')](_0x5e9b9e));if(_0x5e9b9e[_0x1676('0x11')]){if(_0x5e9b9e['error']['code']===0x1f4){logger[_0x1676('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x4eccec,_0x5e9b9e[_0x1676('0x11')][_0x1676('0x12')]);return _0x58fb8e(_0x5e9b9e[_0x1676('0x11')]['message']);}logger[_0x1676('0x11')](_0x1676('0x13'),_0x4eccec,_0x5e9b9e['error'][_0x1676('0x12')]);return _0x3df338(_0x5e9b9e[_0x1676('0x11')][_0x1676('0x12')]);}else{logger[_0x1676('0xc')](_0x1676('0x13'),_0x4eccec,_0x1676('0xd'));_0x3df338(_0x5e9b9e[_0x1676('0x14')]['message']);}})[_0x1676('0x15')](function(_0x3d88fc){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4eccec,_0x3d88fc);_0x58fb8e(_0x3d88fc);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d772f1f..bdcc884 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x57834a,_0xfac574){var _0x5788d9=function(_0x290392){while(--_0x290392){_0x57834a['push'](_0x57834a['shift']());}};_0x5788d9(++_0xfac574);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x278948,_0x85b993){var _0x59fecb=function(_0x49141d){while(--_0x49141d){_0x278948['push'](_0x278948['shift']());}};_0x59fecb(++_0x85b993);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 d483dda..d0d3877 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 _0x0c9c=['exports','INTEGER','sequelize'];(function(_0x153e7d,_0x10a35f){var _0x3c22dd=function(_0x4d33f6){while(--_0x4d33f6){_0x153e7d['push'](_0x153e7d['shift']());}};_0x3c22dd(++_0x10a35f);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc0c9('0x0'));module[_0xc0c9('0x1')]={'penalty':{'type':Sequelize[_0xc0c9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc6f8=['sequelize','exports','INTEGER'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0xc6f8,0x87));var _0x8c6f=function(_0x55b5bd,_0x240cfb){_0x55b5bd=_0x55b5bd-0x0;var _0x3bd4e7=_0xc6f8[_0x55b5bd];return _0x3bd4e7;};'use strict';var Sequelize=require(_0x8c6f('0x0'));module[_0x8c6f('0x1')]={'penalty':{'type':Sequelize[_0x8c6f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 6bd063f..5dc1924 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 _0x41d0=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','util'];(function(_0x578fdc,_0x184671){var _0x3366d2=function(_0x2335d4){while(--_0x2335d4){_0x578fdc['push'](_0x578fdc['shift']());}};_0x3366d2(++_0x184671);}(_0x41d0,0x1c6));var _0x041d=function(_0x141e5f,_0x216927){_0x141e5f=_0x141e5f-0x0;var _0x5bea96=_0x41d0[_0x141e5f];return _0x5bea96;};'use strict';var _=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var logger=require(_0x041d('0x2'))(_0x041d('0x3'));var moment=require('moment');var BPromise=require(_0x041d('0x4'));var rp=require(_0x041d('0x5'));var fs=require('fs');var path=require(_0x041d('0x6'));var rimraf=require(_0x041d('0x7'));var config=require(_0x041d('0x8'));var attributes=require(_0x041d('0x9'));module[_0x041d('0xa')]=function(_0x14907f,_0x196419){return _0x14907f['define'](_0x041d('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x553a=['bluebird','rimraf','exports','define','UserSmsQueue','user_has_sms_queues','util','api','moment'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x553a,0x192));var _0xa553=function(_0x549996,_0xd04634){_0x549996=_0x549996-0x0;var _0x4de5d1=_0x553a[_0x549996];return _0x4de5d1;};'use strict';var _=require('lodash');var util=require(_0xa553('0x0'));var logger=require('../../config/logger')(_0xa553('0x1'));var moment=require(_0xa553('0x2'));var BPromise=require(_0xa553('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa553('0x4'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xa553('0x5')]=function(_0x53190d,_0x5ddf5e){return _0x53190d[_0xa553('0x6')](_0xa553('0x7'),attributes,{'tableName':_0xa553('0x8'),'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 bf2336b..6edcbcf 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 _0x2198=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x2198,0x1ee));var _0x8219=function(_0x2ab644,_0x304b86){_0x2ab644=_0x2ab644-0x0;var _0x4d43dc=_0x2198[_0x2ab644];return _0x4d43dc;};'use strict';var _=require(_0x8219('0x0'));var util=require(_0x8219('0x1'));var moment=require(_0x8219('0x2'));var BPromise=require(_0x8219('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8219('0x4'));var db=require(_0x8219('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8219('0x6'));var config=require(_0x8219('0x7'));var jayson=require(_0x8219('0x8'));var client=jayson['client'][_0x8219('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ceb2e,_0xede098,_0x932139){return new BPromise(function(_0x218b57,_0x4683c4){return client[_0x8219('0xa')](_0x3ceb2e,_0x932139)[_0x8219('0xb')](function(_0x469cd8){logger[_0x8219('0xc')](_0x8219('0xd'),_0xede098,_0x8219('0xe'));logger[_0x8219('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0xede098,_0x8219('0xe'),JSON['stringify'](_0x469cd8));if(_0x469cd8[_0x8219('0x10')]){if(_0x469cd8['error'][_0x8219('0x11')]===0x1f4){logger[_0x8219('0x10')](_0x8219('0xd'),_0xede098,_0x469cd8[_0x8219('0x10')][_0x8219('0x12')]);return _0x4683c4(_0x469cd8[_0x8219('0x10')][_0x8219('0x12')]);}logger[_0x8219('0x10')](_0x8219('0xd'),_0xede098,_0x469cd8['error'][_0x8219('0x12')]);return _0x218b57(_0x469cd8[_0x8219('0x10')][_0x8219('0x12')]);}else{logger[_0x8219('0xc')](_0x8219('0xd'),_0xede098,'request\x20sent');_0x218b57(_0x469cd8['result'][_0x8219('0x12')]);}})[_0x8219('0x13')](function(_0x316ebf){logger[_0x8219('0x10')](_0x8219('0xd'),_0xede098,_0x316ebf);_0x4683c4(_0x316ebf);});});} \ No newline at end of file +var _0x6130=['info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x4b78f6,_0x3e5ed4){var _0x5ef31f=function(_0x37409f){while(--_0x37409f){_0x4b78f6['push'](_0x4b78f6['shift']());}};_0x5ef31f(++_0x3e5ed4);}(_0x6130,0x1eb));var _0x0613=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x6130[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require(_0x0613('0x0'));var moment=require(_0x0613('0x1'));var BPromise=require(_0x0613('0x2'));var rs=require(_0x0613('0x3'));var fs=require('fs');var Redis=require(_0x0613('0x4'));var db=require(_0x0613('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0613('0x6'))(_0x0613('0x7'));var config=require(_0x0613('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0613('0x9')][_0x0613('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa093af,_0x106a63,_0x2db340){return new BPromise(function(_0x44f6fe,_0x2e7a1f){return client[_0x0613('0xb')](_0xa093af,_0x2db340)[_0x0613('0xc')](function(_0x2fd28d){logger[_0x0613('0xd')](_0x0613('0xe'),_0x106a63,_0x0613('0xf'));logger[_0x0613('0x10')](_0x0613('0x11'),_0x106a63,_0x0613('0xf'),JSON[_0x0613('0x12')](_0x2fd28d));if(_0x2fd28d[_0x0613('0x13')]){if(_0x2fd28d[_0x0613('0x13')][_0x0613('0x14')]===0x1f4){logger[_0x0613('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x106a63,_0x2fd28d[_0x0613('0x13')][_0x0613('0x15')]);return _0x2e7a1f(_0x2fd28d[_0x0613('0x13')][_0x0613('0x15')]);}logger[_0x0613('0x13')](_0x0613('0xe'),_0x106a63,_0x2fd28d[_0x0613('0x13')][_0x0613('0x15')]);return _0x44f6fe(_0x2fd28d[_0x0613('0x13')]['message']);}else{logger[_0x0613('0xd')](_0x0613('0xe'),_0x106a63,_0x0613('0xf'));_0x44f6fe(_0x2fd28d[_0x0613('0x16')]['message']);}})[_0x0613('0x17')](function(_0x4e4eee){logger[_0x0613('0x13')](_0x0613('0xe'),_0x106a63,_0x4e4eee);_0x2e7a1f(_0x4e4eee);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 5b49b52..ddb10a8 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 _0x89e3=['exports','INTEGER','sequelize'];(function(_0x1b4cdb,_0x5c475c){var _0x4db1bc=function(_0x4b2fb5){while(--_0x4b2fb5){_0x1b4cdb['push'](_0x1b4cdb['shift']());}};_0x4db1bc(++_0x5c475c);}(_0x89e3,0x1d9));var _0x389e=function(_0x2b89a2,_0x14b213){_0x2b89a2=_0x2b89a2-0x0;var _0x213544=_0x89e3[_0x2b89a2];return _0x213544;};'use strict';var Sequelize=require(_0x389e('0x0'));module[_0x389e('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x389e('0x2')]}}; \ No newline at end of file +var _0x17d3=['INTEGER','sequelize'];(function(_0x4fd2bd,_0x468364){var _0x1eee13=function(_0x140b3d){while(--_0x140b3d){_0x4fd2bd['push'](_0x4fd2bd['shift']());}};_0x1eee13(++_0x468364);}(_0x17d3,0x1e1));var _0x317d=function(_0x197e6c,_0x72c110){_0x197e6c=_0x197e6c-0x0;var _0x4241cc=_0x17d3[_0x197e6c];return _0x4241cc;};'use strict';var Sequelize=require(_0x317d('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x317d('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x317d('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index af80fc6..bae9285 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(_0x37bef6,_0x6a9859){var _0x2919a4=function(_0x9ddf11){while(--_0x9ddf11){_0x37bef6['push'](_0x37bef6['shift']());}};_0x2919a4(++_0x6a9859);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2b2472,_0x8af1aa){var _0x2b8c89=function(_0x473883){while(--_0x473883){_0x2b2472['push'](_0x2b2472['shift']());}};_0x2b8c89(++_0x8af1aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 b2470c9..51d9ed3 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x14ef64,_0x25597b){var _0x57d34d=function(_0x21c52b){while(--_0x21c52b){_0x14ef64['push'](_0x14ef64['shift']());}};_0x57d34d(++_0x25597b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xcb91[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x16cf22,_0x504218){var _0x113c09=function(_0x34df3f){while(--_0x34df3f){_0x16cf22['push'](_0x16cf22['shift']());}};_0x113c09(++_0x504218);}(_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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b03f11b..5997d3c 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 _0x209a=['INTEGER','sequelize','exports'];(function(_0x51958d,_0x45d997){var _0x738ce4=function(_0x217e08){while(--_0x217e08){_0x51958d['push'](_0x51958d['shift']());}};_0x738ce4(++_0x45d997);}(_0x209a,0x85));var _0xa209=function(_0x375964,_0x52a8a1){_0x375964=_0x375964-0x0;var _0x2c63e6=_0x209a[_0x375964];return _0x2c63e6;};'use strict';var Sequelize=require(_0xa209('0x0'));module[_0xa209('0x1')]={'penalty':{'type':Sequelize[_0xa209('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfc91=['sequelize','exports'];(function(_0x1a2213,_0x4ee71f){var _0x198310=function(_0x278896){while(--_0x278896){_0x1a2213['push'](_0x1a2213['shift']());}};_0x198310(++_0x4ee71f);}(_0xfc91,0x72));var _0x1fc9=function(_0x1cf432,_0x254967){_0x1cf432=_0x1cf432-0x0;var _0x5b6b6d=_0xfc91[_0x1cf432];return _0x5b6b6d;};'use strict';var Sequelize=require(_0x1fc9('0x0'));module[_0x1fc9('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 8578c8c..d7d2720 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 _0x57cc=['../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x3cadd1,_0x4d68a5){var _0x2fee81=function(_0x4fdd22){while(--_0x4fdd22){_0x3cadd1['push'](_0x3cadd1['shift']());}};_0x2fee81(++_0x4d68a5);}(_0x57cc,0x14b));var _0xc57c=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x57cc[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0xc57c('0x0'));var util=require(_0xc57c('0x1'));var logger=require(_0xc57c('0x2'))(_0xc57c('0x3'));var moment=require('moment');var BPromise=require(_0xc57c('0x4'));var rp=require(_0xc57c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc57c('0x6'));var config=require(_0xc57c('0x7'));var attributes=require(_0xc57c('0x8'));module[_0xc57c('0x9')]=function(_0x470a8f,_0x21208b){return _0x470a8f[_0xc57c('0xa')](_0xc57c('0xb'),attributes,{'tableName':_0xc57c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d8e=['exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1a73ff,_0x5c55e8){var _0x200c4e=function(_0x361ae2){while(--_0x361ae2){_0x1a73ff['push'](_0x1a73ff['shift']());}};_0x200c4e(++_0x5c55e8);}(_0x5d8e,0x1bc));var _0xe5d8=function(_0x140da7,_0x572aa6){_0x140da7=_0x140da7-0x0;var _0x2ad752=_0x5d8e[_0x140da7];return _0x2ad752;};'use strict';var _=require('lodash');var util=require(_0xe5d8('0x0'));var logger=require(_0xe5d8('0x1'))(_0xe5d8('0x2'));var moment=require(_0xe5d8('0x3'));var BPromise=require('bluebird');var rp=require(_0xe5d8('0x4'));var fs=require('fs');var path=require(_0xe5d8('0x5'));var rimraf=require(_0xe5d8('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xe5d8('0x7')]=function(_0x3c83f6,_0x1206d7){return _0x3c83f6[_0xe5d8('0x8')](_0xe5d8('0x9'),attributes,{'tableName':_0xe5d8('0xa'),'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 279a415..66384b8 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 _0xa8a9=['info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4c0748,_0x4f8f86){var _0x1db33=function(_0x5014d6){while(--_0x5014d6){_0x4c0748['push'](_0x4c0748['shift']());}};_0x1db33(++_0x4f8f86);}(_0xa8a9,0x1d7));var _0x9a8a=function(_0x2d3e57,_0x5d190){_0x2d3e57=_0x2d3e57-0x0;var _0x21490a=_0xa8a9[_0x2d3e57];return _0x21490a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9a8a('0x0'));var BPromise=require(_0x9a8a('0x1'));var rs=require(_0x9a8a('0x2'));var fs=require('fs');var Redis=require(_0x9a8a('0x3'));var db=require(_0x9a8a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a8a('0x5'))(_0x9a8a('0x6'));var config=require(_0x9a8a('0x7'));var jayson=require(_0x9a8a('0x8'));var client=jayson[_0x9a8a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48ff1f,_0x1b8344,_0xab9358){return new BPromise(function(_0x4a11ae,_0x597d85){return client[_0x9a8a('0xa')](_0x48ff1f,_0xab9358)[_0x9a8a('0xb')](function(_0x4de62f){logger[_0x9a8a('0xc')](_0x9a8a('0xd'),_0x1b8344,'request\x20sent');logger[_0x9a8a('0xe')](_0x9a8a('0xf'),_0x1b8344,'request\x20sent',JSON[_0x9a8a('0x10')](_0x4de62f));if(_0x4de62f[_0x9a8a('0x11')]){if(_0x4de62f[_0x9a8a('0x11')][_0x9a8a('0x12')]===0x1f4){logger[_0x9a8a('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x1b8344,_0x4de62f['error'][_0x9a8a('0x13')]);return _0x597d85(_0x4de62f[_0x9a8a('0x11')]['message']);}logger[_0x9a8a('0x11')](_0x9a8a('0xd'),_0x1b8344,_0x4de62f[_0x9a8a('0x11')][_0x9a8a('0x13')]);return _0x4a11ae(_0x4de62f[_0x9a8a('0x11')][_0x9a8a('0x13')]);}else{logger[_0x9a8a('0xc')](_0x9a8a('0xd'),_0x1b8344,_0x9a8a('0x14'));_0x4a11ae(_0x4de62f[_0x9a8a('0x15')][_0x9a8a('0x13')]);}})[_0x9a8a('0x16')](function(_0x19464a){logger[_0x9a8a('0x11')](_0x9a8a('0xd'),_0x1b8344,_0x19464a);_0x597d85(_0x19464a);});});} \ No newline at end of file +var _0x28c4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3acfee,_0x28a0c9){var _0x4a2323=function(_0x294fc0){while(--_0x294fc0){_0x3acfee['push'](_0x3acfee['shift']());}};_0x4a2323(++_0x28a0c9);}(_0x28c4,0x1db));var _0x428c=function(_0x3f4315,_0xd6ec89){_0x3f4315=_0x3f4315-0x0;var _0x5842e3=_0x28c4[_0x3f4315];return _0x5842e3;};'use strict';var _=require(_0x428c('0x0'));var util=require('util');var moment=require(_0x428c('0x1'));var BPromise=require(_0x428c('0x2'));var rs=require(_0x428c('0x3'));var fs=require('fs');var Redis=require(_0x428c('0x4'));var db=require(_0x428c('0x5'))['db'];var utils=require(_0x428c('0x6'));var logger=require(_0x428c('0x7'))(_0x428c('0x8'));var config=require(_0x428c('0x9'));var jayson=require(_0x428c('0xa'));var client=jayson[_0x428c('0xb')][_0x428c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c60fb,_0x5e1144,_0xe06283){return new BPromise(function(_0x25f30d,_0x13d5ac){return client['request'](_0x3c60fb,_0xe06283)[_0x428c('0xd')](function(_0x9f2c7b){logger[_0x428c('0xe')](_0x428c('0xf'),_0x5e1144,'request\x20sent');logger[_0x428c('0x10')](_0x428c('0x11'),_0x5e1144,_0x428c('0x12'),JSON[_0x428c('0x13')](_0x9f2c7b));if(_0x9f2c7b['error']){if(_0x9f2c7b[_0x428c('0x14')][_0x428c('0x15')]===0x1f4){logger['error'](_0x428c('0xf'),_0x5e1144,_0x9f2c7b['error'][_0x428c('0x16')]);return _0x13d5ac(_0x9f2c7b[_0x428c('0x14')][_0x428c('0x16')]);}logger['error'](_0x428c('0xf'),_0x5e1144,_0x9f2c7b[_0x428c('0x14')][_0x428c('0x16')]);return _0x25f30d(_0x9f2c7b[_0x428c('0x14')][_0x428c('0x16')]);}else{logger[_0x428c('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x5e1144,_0x428c('0x12'));_0x25f30d(_0x9f2c7b['result'][_0x428c('0x16')]);}})[_0x428c('0x17')](function(_0x45d422){logger[_0x428c('0x14')](_0x428c('0xf'),_0x5e1144,_0x45d422);_0x13d5ac(_0x45d422);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 57608fe..f3d94f5 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x117926,_0x268445){var _0xc34604=function(_0x67f9c5){while(--_0x67f9c5){_0x117926['push'](_0x117926['shift']());}};_0xc34604(++_0x268445);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1270df,_0x542aa1){var _0x28d6d4=function(_0x1279e0){while(--_0x1279e0){_0x1270df['push'](_0x1270df['shift']());}};_0x28d6d4(++_0x542aa1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0xcb91[_0x230e39];return _0xa804e;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 9663d23..cbd25e8 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 _0xadba=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x568779,_0x4ea269){var _0x50d203=function(_0x2af551){while(--_0x2af551){_0x568779['push'](_0x568779['shift']());}};_0x50d203(++_0x4ea269);}(_0xadba,0x1e6));var _0xaadb=function(_0x1644e1,_0x47348d){_0x1644e1=_0x1644e1-0x0;var _0x587978=_0xadba[_0x1644e1];return _0x587978;};'use strict';var Sequelize=require(_0xaadb('0x0'));module[_0xaadb('0x1')]={'uniqueid':{'type':Sequelize[_0xaadb('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xaadb('0x3')},'membername':{'type':Sequelize[_0xaadb('0x4')],'allowNull':![],'comment':_0xaadb('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xaadb('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xaadb('0x3')},'VoiceQueueId':{'type':Sequelize[_0xaadb('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xaadb('0x4')],'allowNull':![],'unique':_0xaadb('0x5'),'comment':_0xaadb('0x3')},'penalty':{'type':Sequelize[_0xaadb('0x2')](0xb),'defaultValue':0x0,'comment':_0xaadb('0x3')},'paused':{'type':Sequelize[_0xaadb('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x4e6c=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x4e3ee4,_0x4891c4){var _0x2bae47=function(_0x3a78af){while(--_0x3a78af){_0x4e3ee4['push'](_0x4e3ee4['shift']());}};_0x2bae47(++_0x4891c4);}(_0x4e6c,0x8d));var _0xc4e6=function(_0x878a3,_0x3c75ef){_0x878a3=_0x878a3-0x0;var _0x3336d4=_0x4e6c[_0x878a3];return _0x3336d4;};'use strict';var Sequelize=require(_0xc4e6('0x0'));module[_0xc4e6('0x1')]={'uniqueid':{'type':Sequelize[_0xc4e6('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc4e6('0x3')},'membername':{'type':Sequelize[_0xc4e6('0x4')],'allowNull':![],'comment':_0xc4e6('0x3')},'UserId':{'type':Sequelize[_0xc4e6('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc4e6('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xc4e6('0x4')],'allowNull':![],'unique':_0xc4e6('0x5'),'comment':_0xc4e6('0x3')},'penalty':{'type':Sequelize[_0xc4e6('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xc4e6('0x2')](0xb),'defaultValue':0x0,'comment':_0xc4e6('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ac8a069..c727a29 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 _0x538c=['hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x1da3fe,_0x52ea14){var _0x34e204=function(_0x4d21c8){while(--_0x4d21c8){_0x1da3fe['push'](_0x1da3fe['shift']());}};_0x34e204(++_0x52ea14);}(_0x538c,0x1ac));var _0xc538=function(_0x462252,_0x122578){_0x462252=_0x462252-0x0;var _0x54ada0=_0x538c[_0x462252];return _0x54ada0;};'use strict';var EventEmitter=require(_0xc538('0x0'));var UserVoiceQueueRt=require(_0xc538('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc538('0x2')](0x0);var events={'afterCreate':_0xc538('0x3'),'afterUpdate':'update','afterDestroy':_0xc538('0x4')};function emitEvent(_0x3ab186){return function(_0x4ea552,_0x2025e0,_0x4676e6){UserVoiceQueueRtEvents[_0xc538('0x5')](_0x3ab186+':'+_0x4ea552['id'],_0x4ea552);UserVoiceQueueRtEvents[_0xc538('0x5')](_0x3ab186,_0x4ea552);_0x4676e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xc538('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x18a4=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','save','update'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x18a4,0x187));var _0x418a=function(_0x5d50c8,_0x2cfa52){_0x5d50c8=_0x5d50c8-0x0;var _0x19a9d4=_0x18a4[_0x5d50c8];return _0x19a9d4;};'use strict';var EventEmitter=require(_0x418a('0x0'));var UserVoiceQueueRt=require(_0x418a('0x1'))['db'][_0x418a('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x418a('0x3'),'afterUpdate':_0x418a('0x4'),'afterDestroy':_0x418a('0x5')};function emitEvent(_0x384ea3){return function(_0x57151f,_0x31267c,_0x62fd2){UserVoiceQueueRtEvents[_0x418a('0x6')](_0x384ea3+':'+_0x57151f['id'],_0x57151f);UserVoiceQueueRtEvents[_0x418a('0x6')](_0x384ea3,_0x57151f);_0x62fd2(null);};}for(var e in events){if(events[_0x418a('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x418a('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index e2c580c..ff1d1e4 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 _0xce33=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x44da17,_0xd9d6d2){var _0x34d7ad=function(_0x3dbabd){while(--_0x3dbabd){_0x44da17['push'](_0x44da17['shift']());}};_0x34d7ad(++_0xd9d6d2);}(_0xce33,0x1d1));var _0x3ce3=function(_0x53be66,_0x9ec3be){_0x53be66=_0x53be66-0x0;var _0x9e5520=_0xce33[_0x53be66];return _0x9e5520;};'use strict';var _=require(_0x3ce3('0x0'));var util=require(_0x3ce3('0x1'));var logger=require(_0x3ce3('0x2'))(_0x3ce3('0x3'));var moment=require(_0x3ce3('0x4'));var BPromise=require(_0x3ce3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ce3('0x6'));var rimraf=require(_0x3ce3('0x7'));var config=require(_0x3ce3('0x8'));var attributes=require(_0x3ce3('0x9'));module[_0x3ce3('0xa')]=function(_0x2cf1be,_0x101c10){return _0x2cf1be[_0x3ce3('0xb')](_0x3ce3('0xc'),attributes,{'tableName':_0x3ce3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3a3=['UserVoiceQueueRt','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x5a4136,_0xc20ef){var _0x3c426a=function(_0x5715e7){while(--_0x5715e7){_0x5a4136['push'](_0x5a4136['shift']());}};_0x3c426a(++_0xc20ef);}(_0xe3a3,0x169));var _0x3e3a=function(_0x1616ca,_0xf20a91){_0x1616ca=_0x1616ca-0x0;var _0x4a1e34=_0xe3a3[_0x1616ca];return _0x4a1e34;};'use strict';var _=require(_0x3e3a('0x0'));var util=require(_0x3e3a('0x1'));var logger=require(_0x3e3a('0x2'))('api');var moment=require(_0x3e3a('0x3'));var BPromise=require(_0x3e3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e3a('0x5'));var rimraf=require(_0x3e3a('0x6'));var config=require(_0x3e3a('0x7'));var attributes=require(_0x3e3a('0x8'));module[_0x3e3a('0x9')]=function(_0x27702f,_0x840496){return _0x27702f[_0x3e3a('0xa')](_0x3e3a('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 9ea19d9..300db4f 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 _0xaccf=['./userVoiceQueueRt.socket','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','info','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x411e56,_0x16c6fc){var _0x286f6b=function(_0x59b5f8){while(--_0x59b5f8){_0x411e56['push'](_0x411e56['shift']());}};_0x286f6b(++_0x16c6fc);}(_0xaccf,0x16c));var _0xfacc=function(_0x5a8154,_0x268346){_0x5a8154=_0x5a8154-0x0;var _0x5aa1b4=_0xaccf[_0x5a8154];return _0x5aa1b4;};'use strict';var _=require(_0xfacc('0x0'));var util=require(_0xfacc('0x1'));var moment=require(_0xfacc('0x2'));var BPromise=require(_0xfacc('0x3'));var rs=require(_0xfacc('0x4'));var fs=require('fs');var Redis=require(_0xfacc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfacc('0x6'));var logger=require('../../config/logger')(_0xfacc('0x7'));var config=require(_0xfacc('0x8'));var jayson=require(_0xfacc('0x9'));var client=jayson[_0xfacc('0xa')][_0xfacc('0xb')]({'port':0x232a});config[_0xfacc('0xc')]=_[_0xfacc('0xd')](config[_0xfacc('0xc')],{'host':_0xfacc('0xe'),'port':0x18eb});var socket=require(_0xfacc('0xf'))(new Redis(config[_0xfacc('0xc')]));require(_0xfacc('0x10'))[_0xfacc('0x11')](socket);function respondWithRpcPromise(_0x9ef50d,_0x5cab2a,_0x22c12a){return new BPromise(function(_0x21116f,_0x5af336){return client['request'](_0x9ef50d,_0x22c12a)[_0xfacc('0x12')](function(_0x56804c){logger['info'](_0xfacc('0x13'),_0x5cab2a,'request\x20sent');logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x5cab2a,_0xfacc('0x14'),JSON[_0xfacc('0x15')](_0x56804c));if(_0x56804c[_0xfacc('0x16')]){if(_0x56804c[_0xfacc('0x16')]['code']===0x1f4){logger[_0xfacc('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5cab2a,_0x56804c[_0xfacc('0x16')][_0xfacc('0x17')]);return _0x5af336(_0x56804c[_0xfacc('0x16')][_0xfacc('0x17')]);}logger[_0xfacc('0x16')](_0xfacc('0x13'),_0x5cab2a,_0x56804c[_0xfacc('0x16')][_0xfacc('0x17')]);return _0x21116f(_0x56804c['error'][_0xfacc('0x17')]);}else{logger['info'](_0xfacc('0x13'),_0x5cab2a,'request\x20sent');_0x21116f(_0x56804c[_0xfacc('0x18')][_0xfacc('0x17')]);}})[_0xfacc('0x19')](function(_0x28c636){logger['error'](_0xfacc('0x13'),_0x5cab2a,_0x28c636);_0x5af336(_0x28c636);});});}exports[_0xfacc('0x1a')]=function(_0x3a3e46){var _0x2efa8=this;return new Promise(function(_0x374fd4,_0x466711){return db[_0xfacc('0x1b')][_0xfacc('0x1c')]({'raw':_0x3a3e46[_0xfacc('0x1d')]?_0x3a3e46[_0xfacc('0x1d')][_0xfacc('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a3e46[_0xfacc('0x1d')]?_0x3a3e46[_0xfacc('0x1d')][_0xfacc('0x1f')]||null:null,'attributes':[[db[_0xfacc('0x20')]['fn'](_0xfacc('0x21'),db[_0xfacc('0x20')]['fn']('IF',db['sequelize'][_0xfacc('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0xfacc('0x23')]]})['then'](function(_0x2763b0){logger[_0xfacc('0x24')](_0xfacc('0x1a'),_0x3a3e46);logger[_0xfacc('0x25')]('GetVoiceQueueRtPauses',_0x3a3e46,JSON[_0xfacc('0x15')](_0x2763b0));_0x374fd4(_0x2763b0);})[_0xfacc('0x19')](function(_0x19618b){logger['error'](_0xfacc('0x1a'),_0x19618b['message'],_0x3a3e46);_0x466711(_0x2efa8[_0xfacc('0x16')](0x1f4,_0x19618b[_0xfacc('0x17')]));});});}; \ No newline at end of file +var _0xf41d=['./userVoiceQueueRt.socket','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','UserVoiceQueueRt','options','raw','sequelize','GetVoiceQueueRtPauses','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x312def,_0x43bb34){var _0x3c0cfa=function(_0x2fc95d){while(--_0x2fc95d){_0x312def['push'](_0x312def['shift']());}};_0x3c0cfa(++_0x43bb34);}(_0xf41d,0xbf));var _0xdf41=function(_0x1364fe,_0x10a39c){_0x1364fe=_0x1364fe-0x0;var _0x236bcc=_0xf41d[_0x1364fe];return _0x236bcc;};'use strict';var _=require(_0xdf41('0x0'));var util=require('util');var moment=require(_0xdf41('0x1'));var BPromise=require(_0xdf41('0x2'));var rs=require(_0xdf41('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf41('0x4'))['db'];var utils=require(_0xdf41('0x5'));var logger=require(_0xdf41('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf41('0x7')]['http']({'port':0x232a});config[_0xdf41('0x8')]=_[_0xdf41('0x9')](config['redis'],{'host':_0xdf41('0xa'),'port':0x18eb});var socket=require(_0xdf41('0xb'))(new Redis(config[_0xdf41('0x8')]));require(_0xdf41('0xc'))['register'](socket);function respondWithRpcPromise(_0x4cc377,_0x2ebe31,_0x1d81f4){return new BPromise(function(_0x5d430a,_0x4271c9){return client['request'](_0x4cc377,_0x1d81f4)[_0xdf41('0xd')](function(_0x48141d){logger['info'](_0xdf41('0xe'),_0x2ebe31,_0xdf41('0xf'));logger['debug'](_0xdf41('0x10'),_0x2ebe31,'request\x20sent',JSON[_0xdf41('0x11')](_0x48141d));if(_0x48141d['error']){if(_0x48141d['error'][_0xdf41('0x12')]===0x1f4){logger[_0xdf41('0x13')](_0xdf41('0xe'),_0x2ebe31,_0x48141d[_0xdf41('0x13')]['message']);return _0x4271c9(_0x48141d['error'][_0xdf41('0x14')]);}logger['error'](_0xdf41('0xe'),_0x2ebe31,_0x48141d['error'][_0xdf41('0x14')]);return _0x5d430a(_0x48141d['error'][_0xdf41('0x14')]);}else{logger[_0xdf41('0x15')](_0xdf41('0xe'),_0x2ebe31,_0xdf41('0xf'));_0x5d430a(_0x48141d[_0xdf41('0x16')][_0xdf41('0x14')]);}})[_0xdf41('0x17')](function(_0x1ec168){logger[_0xdf41('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2ebe31,_0x1ec168);_0x4271c9(_0x1ec168);});});}exports['GetVoiceQueueRtPauses']=function(_0x439f07){var _0x49428a=this;return new Promise(function(_0x2ddbd8,_0x370017){return db[_0xdf41('0x18')]['findAll']({'raw':_0x439f07['options']?_0x439f07[_0xdf41('0x19')][_0xdf41('0x1a')]===undefined?!![]:![]:!![],'where':_0x439f07['options']?_0x439f07[_0xdf41('0x19')]['where']||null:null,'attributes':[[db[_0xdf41('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdf41('0x1b')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xdf41('0xd')](function(_0x5d9820){logger[_0xdf41('0x15')](_0xdf41('0x1c'),_0x439f07);logger['debug'](_0xdf41('0x1c'),_0x439f07,JSON[_0xdf41('0x11')](_0x5d9820));_0x2ddbd8(_0x5d9820);})['catch'](function(_0x56a047){logger[_0xdf41('0x13')]('GetVoiceQueueRtPauses',_0x56a047[_0xdf41('0x14')],_0x439f07);_0x370017(_0x49428a['error'](0x1f4,_0x56a047[_0xdf41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index b6f14ff..e7766dc 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 _0x3f1c=['removeListener','length','./userVoiceQueueRt.events','update','emit'];(function(_0x5cd8d8,_0x5a3296){var _0x2ed341=function(_0xe127e7){while(--_0xe127e7){_0x5cd8d8['push'](_0x5cd8d8['shift']());}};_0x2ed341(++_0x5a3296);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x492750,_0x1f9353){_0x492750=_0x492750-0x0;var _0x1f50bd=_0x3f1c[_0x492750];return _0x1f50bd;};'use strict';var UserVoiceQueueRtEvents=require(_0xc3f1('0x0'));var events=['save','remove',_0xc3f1('0x1')];function createListener(_0x47b765,_0x59396e){return function(_0x2679d9){_0x59396e[_0xc3f1('0x2')](_0x47b765,_0x2679d9);};}function removeListener(_0x9f016d,_0xaa09ea){return function(){UserVoiceQueueRtEvents[_0xc3f1('0x3')](_0x9f016d,_0xaa09ea);};}exports['register']=function(_0x12e78a){for(var _0x4ebd4c=0x0,_0x1f0b80=events[_0xc3f1('0x4')];_0x4ebd4c<_0x1f0b80;_0x4ebd4c++){var _0x1060e6=events[_0x4ebd4c];var _0x5e4bfe=createListener('userVoiceQueueRt:'+_0x1060e6,_0x12e78a);UserVoiceQueueRtEvents['on'](_0x1060e6,_0x5e4bfe);}}; \ No newline at end of file +var _0x7eff=['emit','register','length','userVoiceQueueRt:','save','remove','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7eff,0x162));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xf7ef('0x0'),_0xf7ef('0x1'),_0xf7ef('0x2')];function createListener(_0x557e34,_0x270a48){return function(_0x1d3300){_0x270a48[_0xf7ef('0x3')](_0x557e34,_0x1d3300);};}function removeListener(_0x4db614,_0x58a651){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4db614,_0x58a651);};}exports[_0xf7ef('0x4')]=function(_0x130e65){for(var _0x41864d=0x0,_0x21eb16=events[_0xf7ef('0x5')];_0x41864d<_0x21eb16;_0x41864d++){var _0xcf20c7=events[_0x41864d];var _0x1022af=createListener(_0xf7ef('0x6')+_0xcf20c7,_0x130e65);UserVoiceQueueRtEvents['on'](_0xcf20c7,_0x1022af);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ab9213d..b85aabc 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(_0x5aa65c,_0x4a62fd){var _0x40326b=function(_0x116655){while(--_0x116655){_0x5aa65c['push'](_0x5aa65c['shift']());}};_0x40326b(++_0x4a62fd);}(_0xe706,0xa3));var _0x6e70=function(_0x5d77fb,_0x2616e8){_0x5d77fb=_0x5d77fb-0x0;var _0x270181=_0xe706[_0x5d77fb];return _0x270181;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3a5153,_0x1cd85c){var _0x1d417e=function(_0x2794c0){while(--_0x2794c0){_0x3a5153['push'](_0x3a5153['shift']());}};_0x1d417e(++_0x1cd85c);}(_0xedd9,0xfc));var _0x9edd=function(_0xfcbb84,_0x119ffb){_0xfcbb84=_0xfcbb84-0x0;var _0x58ff22=_0xedd9[_0xfcbb84];return _0x58ff22;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 73e1ff0..6436eb9 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 _0x5c91=['sequelize','exports','INTEGER'];(function(_0x351975,_0x1bf8d6){var _0x38957b=function(_0x12be1f){while(--_0x12be1f){_0x351975['push'](_0x351975['shift']());}};_0x38957b(++_0x1bf8d6);}(_0x5c91,0x1e9));var _0x15c9=function(_0x33a4f5,_0xf23675){_0x33a4f5=_0x33a4f5-0x0;var _0x28e9e8=_0x5c91[_0x33a4f5];return _0x28e9e8;};'use strict';var Sequelize=require(_0x15c9('0x0'));module[_0x15c9('0x1')]={'penalty':{'type':Sequelize[_0x15c9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc053=['sequelize','exports','INTEGER'];(function(_0x202376,_0x361127){var _0x1a7997=function(_0x5eee40){while(--_0x5eee40){_0x202376['push'](_0x202376['shift']());}};_0x1a7997(++_0x361127);}(_0xc053,0xff));var _0x3c05=function(_0x2e90e5,_0x25117c){_0x2e90e5=_0x2e90e5-0x0;var _0x1271b1=_0xc053[_0x2e90e5];return _0x1271b1;};'use strict';var Sequelize=require(_0x3c05('0x0'));module[_0x3c05('0x1')]={'penalty':{'type':Sequelize[_0x3c05('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 55186b7..1344588 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 _0xdde6=['bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x5ddb24,_0x81cab2){var _0x3578b8=function(_0x63522b){while(--_0x63522b){_0x5ddb24['push'](_0x5ddb24['shift']());}};_0x3578b8(++_0x81cab2);}(_0xdde6,0xb8));var _0x6dde=function(_0x5eabd8,_0x5268c8){_0x5eabd8=_0x5eabd8-0x0;var _0x29170b=_0xdde6[_0x5eabd8];return _0x29170b;};'use strict';var _=require(_0x6dde('0x0'));var util=require(_0x6dde('0x1'));var logger=require(_0x6dde('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6dde('0x3'));var rp=require(_0x6dde('0x4'));var fs=require('fs');var path=require(_0x6dde('0x5'));var rimraf=require(_0x6dde('0x6'));var config=require('../../config/environment');var attributes=require(_0x6dde('0x7'));module[_0x6dde('0x8')]=function(_0x3c7247,_0x440be7){return _0x3c7247['define'](_0x6dde('0x9'),attributes,{'tableName':_0x6dde('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46f2=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x46f2,0x11e));var _0x246f=function(_0x73c82f,_0x4c5fc4){_0x73c82f=_0x73c82f-0x0;var _0x3b3da8=_0x46f2[_0x73c82f];return _0x3b3da8;};'use strict';var _=require(_0x246f('0x0'));var util=require('util');var logger=require(_0x246f('0x1'))(_0x246f('0x2'));var moment=require(_0x246f('0x3'));var BPromise=require(_0x246f('0x4'));var rp=require(_0x246f('0x5'));var fs=require('fs');var path=require(_0x246f('0x6'));var rimraf=require(_0x246f('0x7'));var config=require(_0x246f('0x8'));var attributes=require('./userWhatsappQueue.attributes');module[_0x246f('0x9')]=function(_0x35f08,_0x229635){return _0x35f08[_0x246f('0xa')](_0x246f('0xb'),attributes,{'tableName':_0x246f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index c6596d7..1eabf6c 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 _0x4aa4=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x3d68d5,_0xa5611f){var _0x3080f2=function(_0x3b7f20){while(--_0x3b7f20){_0x3d68d5['push'](_0x3d68d5['shift']());}};_0x3080f2(++_0xa5611f);}(_0x4aa4,0x66));var _0x44aa=function(_0x254bdf,_0x561453){_0x254bdf=_0x254bdf-0x0;var _0x4bca58=_0x4aa4[_0x254bdf];return _0x4bca58;};'use strict';var _=require(_0x44aa('0x0'));var util=require(_0x44aa('0x1'));var moment=require(_0x44aa('0x2'));var BPromise=require(_0x44aa('0x3'));var rs=require(_0x44aa('0x4'));var fs=require('fs');var Redis=require(_0x44aa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x44aa('0x6'));var logger=require(_0x44aa('0x7'))(_0x44aa('0x8'));var config=require(_0x44aa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x44aa('0xa')][_0x44aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb6506f,_0xed6bbd,_0x50fa98){return new BPromise(function(_0x29a294,_0x222381){return client[_0x44aa('0xc')](_0xb6506f,_0x50fa98)[_0x44aa('0xd')](function(_0x4e14f8){logger[_0x44aa('0xe')](_0x44aa('0xf'),_0xed6bbd,'request\x20sent');logger[_0x44aa('0x10')](_0x44aa('0x11'),_0xed6bbd,'request\x20sent',JSON[_0x44aa('0x12')](_0x4e14f8));if(_0x4e14f8[_0x44aa('0x13')]){if(_0x4e14f8[_0x44aa('0x13')][_0x44aa('0x14')]===0x1f4){logger['error'](_0x44aa('0xf'),_0xed6bbd,_0x4e14f8['error']['message']);return _0x222381(_0x4e14f8['error']['message']);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0xed6bbd,_0x4e14f8[_0x44aa('0x13')][_0x44aa('0x15')]);return _0x29a294(_0x4e14f8[_0x44aa('0x13')][_0x44aa('0x15')]);}else{logger['info'](_0x44aa('0xf'),_0xed6bbd,_0x44aa('0x16'));_0x29a294(_0x4e14f8[_0x44aa('0x17')]['message']);}})[_0x44aa('0x18')](function(_0x1de5b7){logger[_0x44aa('0x13')](_0x44aa('0xf'),_0xed6bbd,_0x1de5b7);_0x222381(_0x1de5b7);});});} \ No newline at end of file +var _0xa52d=['then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request'];(function(_0x189ea0,_0x5275d0){var _0x2a4de3=function(_0x30edac){while(--_0x30edac){_0x189ea0['push'](_0x189ea0['shift']());}};_0x2a4de3(++_0x5275d0);}(_0xa52d,0xe7));var _0xda52=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa52d[_0x92c450];return _0x2a9599;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda52('0x0'));var BPromise=require(_0xda52('0x1'));var rs=require(_0xda52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda52('0x3'))['db'];var utils=require(_0xda52('0x4'));var logger=require('../../config/logger')(_0xda52('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xda52('0x6')][_0xda52('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d622d,_0x3c08ea,_0x4076e4){return new BPromise(function(_0x4a10d5,_0x39ba76){return client[_0xda52('0x8')](_0x1d622d,_0x4076e4)[_0xda52('0x9')](function(_0x353d8e){logger[_0xda52('0xa')](_0xda52('0xb'),_0x3c08ea,_0xda52('0xc'));logger[_0xda52('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3c08ea,_0xda52('0xc'),JSON[_0xda52('0xe')](_0x353d8e));if(_0x353d8e[_0xda52('0xf')]){if(_0x353d8e['error'][_0xda52('0x10')]===0x1f4){logger[_0xda52('0xf')](_0xda52('0xb'),_0x3c08ea,_0x353d8e[_0xda52('0xf')]['message']);return _0x39ba76(_0x353d8e[_0xda52('0xf')][_0xda52('0x11')]);}logger['error'](_0xda52('0xb'),_0x3c08ea,_0x353d8e[_0xda52('0xf')][_0xda52('0x11')]);return _0x4a10d5(_0x353d8e[_0xda52('0xf')][_0xda52('0x11')]);}else{logger['info'](_0xda52('0xb'),_0x3c08ea,'request\x20sent');_0x4a10d5(_0x353d8e[_0xda52('0x12')][_0xda52('0x11')]);}})[_0xda52('0x13')](function(_0x554211){logger[_0xda52('0xf')](_0xda52('0xb'),_0x3c08ea,_0x554211);_0x39ba76(_0x554211);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 94ddb6d..5271264 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 _0xa3e6=['../../components/interaction/service','./variable.controller','get','isAuthenticated','index','show','create','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x29b2ae,_0x1e1761){var _0x374bd1=function(_0xa48c7b){while(--_0xa48c7b){_0x29b2ae['push'](_0x29b2ae['shift']());}};_0x374bd1(++_0x1e1761);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x7e3fee,_0x1f0b2b){_0x7e3fee=_0x7e3fee-0x0;var _0xeea5f5=_0xa3e6[_0x7e3fee];return _0xeea5f5;};'use strict';var multer=require(_0x6a3e('0x0'));var util=require('util');var path=require(_0x6a3e('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a3e('0x2'));var router=express[_0x6a3e('0x3')]();var fs_extra=require(_0x6a3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a3e('0x5'));var config=require('../../config/environment');var controller=require(_0x6a3e('0x6'));router[_0x6a3e('0x7')]('/',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0x9')]);router[_0x6a3e('0x7')]('/:id',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6a3e('0xb')]);router['put']('/:id',auth[_0x6a3e('0x8')](),controller['update']);router[_0x6a3e('0xc')]('/:id',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xd')]);module[_0x6a3e('0xe')]=router; \ No newline at end of file +var _0xcea5=['isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2f53a6,_0x3edc96){var _0x4e9a0a=function(_0x3426c6){while(--_0x3426c6){_0x2f53a6['push'](_0x2f53a6['shift']());}};_0x4e9a0a(++_0x3edc96);}(_0xcea5,0xed));var _0x5cea=function(_0x31e2a0,_0x3ddfaa){_0x31e2a0=_0x31e2a0-0x0;var _0x1e9de2=_0xcea5[_0x31e2a0];return _0x1e9de2;};'use strict';var multer=require(_0x5cea('0x0'));var util=require(_0x5cea('0x1'));var path=require(_0x5cea('0x2'));var timeout=require(_0x5cea('0x3'));var express=require(_0x5cea('0x4'));var router=express['Router']();var fs_extra=require(_0x5cea('0x5'));var auth=require(_0x5cea('0x6'));var interaction=require(_0x5cea('0x7'));var config=require(_0x5cea('0x8'));var controller=require('./variable.controller');router[_0x5cea('0x9')]('/',auth[_0x5cea('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5cea('0xb')]);router[_0x5cea('0xc')]('/',auth['isAuthenticated'](),controller[_0x5cea('0xd')]);router['put'](_0x5cea('0xe'),auth[_0x5cea('0xa')](),controller[_0x5cea('0xf')]);router[_0x5cea('0x10')](_0x5cea('0xe'),auth[_0x5cea('0xa')](),controller[_0x5cea('0x11')]);module[_0x5cea('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 0297423..b772b28 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 _0xc8f7=['name','sequelize','exports','STRING'];(function(_0x1b4057,_0x58212a){var _0x1d749a=function(_0x1fa30b){while(--_0x1fa30b){_0x1b4057['push'](_0x1b4057['shift']());}};_0x1d749a(++_0x58212a);}(_0xc8f7,0xbd));var _0x7c8f=function(_0x5b1df5,_0x25e738){_0x5b1df5=_0x5b1df5-0x0;var _0x158df4=_0xc8f7[_0x5b1df5];return _0x158df4;};'use strict';var Sequelize=require(_0x7c8f('0x0'));module[_0x7c8f('0x1')]={'name':{'type':Sequelize[_0x7c8f('0x2')],'unique':_0x7c8f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7c8f('0x2')]}}; \ No newline at end of file +var _0x2bd6=['sequelize','exports','STRING','name'];(function(_0x3ed4db,_0x4332fe){var _0x3c2069=function(_0x438e8e){while(--_0x438e8e){_0x3ed4db['push'](_0x3ed4db['shift']());}};_0x3c2069(++_0x4332fe);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x2bd6[_0x30b0d8];return _0x459c09;};'use strict';var Sequelize=require(_0x62bd('0x0'));module[_0x62bd('0x1')]={'name':{'type':Sequelize[_0x62bd('0x2')],'unique':_0x62bd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x62bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 56f0e8b..1837b1c 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 _0xc92a=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes','type','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','create','body','role','Variables','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc92a,0x9f));var _0xac92=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc92a[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac92('0x0'));var zipdir=require(_0xac92('0x1'));var jsonpatch=require(_0xac92('0x2'));var rp=require(_0xac92('0x3'));var moment=require(_0xac92('0x4'));var BPromise=require(_0xac92('0x5'));var Mustache=require(_0xac92('0x6'));var util=require(_0xac92('0x7'));var path=require(_0xac92('0x8'));var sox=require(_0xac92('0x9'));var csv=require(_0xac92('0xa'));var ejs=require(_0xac92('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xac92('0xc'));var crypto=require(_0xac92('0xd'));var jsforce=require(_0xac92('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xac92('0xa'));var querystring=require('querystring');var Papa=require(_0xac92('0xf'));var Redis=require('ioredis');var authService=require(_0xac92('0x10'));var qs=require(_0xac92('0x11'));var as=require(_0xac92('0x12'));var hardwareService=require(_0xac92('0x13'));var logger=require(_0xac92('0x14'))('api');var utils=require(_0xac92('0x15'));var config=require(_0xac92('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x501d49,_0x43a9c5){_0x43a9c5=_0x43a9c5||0xcc;return function(_0x4b4113){if(_0x4b4113){return _0x501d49['sendStatus'](_0x43a9c5);}return _0x501d49[_0xac92('0x17')](_0x43a9c5)['end']();};}function respondWithResult(_0x36b43b,_0xc85767){_0xc85767=_0xc85767||0xc8;return function(_0x4beae7){if(_0x4beae7){return _0x36b43b[_0xac92('0x17')](_0xc85767)[_0xac92('0x18')](_0x4beae7);}};}function respondWithFilteredResult(_0x5d312c,_0x7c4062){return function(_0x42260d){if(_0x42260d){var _0x541aef=typeof _0x7c4062[_0xac92('0x19')]===_0xac92('0x1a')&&typeof _0x7c4062[_0xac92('0x1b')]===_0xac92('0x1a');var _0x3af3da=_0x42260d[_0xac92('0x1c')];var _0x4a48bb=_0x541aef?0x0:_0x7c4062['offset'];var _0x4cb71d=_0x541aef?_0x42260d[_0xac92('0x1c')]:_0x7c4062['offset']+_0x7c4062[_0xac92('0x1b')];var _0x1321c6;if(_0x4cb71d>=_0x3af3da){_0x4cb71d=_0x3af3da;_0x1321c6=0xc8;}else{_0x1321c6=0xce;}_0x5d312c['status'](_0x1321c6);return _0x5d312c[_0xac92('0x1d')]('Content-Range',_0x4a48bb+'-'+_0x4cb71d+'/'+_0x3af3da)[_0xac92('0x18')](_0x42260d);}return null;};}function patchUpdates(_0x48e682){return function(_0x47ef49){try{jsonpatch[_0xac92('0x1e')](_0x47ef49,_0x48e682,!![]);}catch(_0x4b6c00){return BPromise[_0xac92('0x1f')](_0x4b6c00);}return _0x47ef49[_0xac92('0x20')]();};}function saveUpdates(_0x2db14c,_0x25167a){return function(_0xdda6e2){if(_0xdda6e2){return _0xdda6e2[_0xac92('0x21')](_0x2db14c)[_0xac92('0x22')](function(_0x249a9b){return _0x249a9b;});}return null;};}function removeEntity(_0x428ff7,_0x481efb){return function(_0x3c0f85){if(_0x3c0f85){return _0x3c0f85[_0xac92('0x23')]()[_0xac92('0x22')](function(){var _0xee439f=_0x3c0f85[_0xac92('0x24')]({'plain':!![]});var _0x2b4607='Variables';return db[_0xac92('0x25')][_0xac92('0x23')]({'where':{'type':_0x2b4607,'resourceId':_0xee439f['id']}})[_0xac92('0x22')](function(){return _0x3c0f85;});})[_0xac92('0x22')](function(){_0x428ff7['status'](0xcc)[_0xac92('0x26')]();});}};}function handleEntityNotFound(_0x1d80cf,_0x201e79){return function(_0x148b32){if(!_0x148b32){_0x1d80cf[_0xac92('0x27')](0x194);}return _0x148b32;};}function handleError(_0x139fdc,_0x1a483f){_0x1a483f=_0x1a483f||0x1f4;return function(_0x3f1af8){logger[_0xac92('0x28')](_0x3f1af8[_0xac92('0x29')]);if(_0x3f1af8['name']){delete _0x3f1af8[_0xac92('0x2a')];}_0x139fdc[_0xac92('0x17')](_0x1a483f)[_0xac92('0x2b')](_0x3f1af8);};}exports[_0xac92('0x2c')]=function(_0x2181e0,_0x2dc99b){var _0x2758c7={},_0x354868={},_0xd6c45a={'count':0x0,'rows':[]};var _0x22246a=_[_0xac92('0x2d')](db[_0xac92('0x2e')][_0xac92('0x2f')],function(_0x568291){return{'name':_0x568291['fieldName'],'type':_0x568291[_0xac92('0x30')]['key']};});_0x354868['model']=_[_0xac92('0x2d')](_0x22246a,'name');_0x354868['query']=_[_0xac92('0x31')](_0x2181e0[_0xac92('0x32')]);_0x354868['filters']=_['intersection'](_0x354868['model'],_0x354868['query']);_0x2758c7[_0xac92('0x33')]=_[_0xac92('0x34')](_0x354868[_0xac92('0x35')],qs[_0xac92('0x36')](_0x2181e0['query'][_0xac92('0x36')]));_0x2758c7[_0xac92('0x33')]=_0x2758c7[_0xac92('0x33')][_0xac92('0x37')]?_0x2758c7[_0xac92('0x33')]:_0x354868['model'];if(!_0x2181e0[_0xac92('0x32')][_0xac92('0x38')](_0xac92('0x39'))){_0x2758c7[_0xac92('0x1b')]=qs[_0xac92('0x1b')](_0x2181e0['query']['limit']);_0x2758c7[_0xac92('0x19')]=qs[_0xac92('0x19')](_0x2181e0[_0xac92('0x32')][_0xac92('0x19')]);}_0x2758c7[_0xac92('0x3a')]=qs[_0xac92('0x3b')](_0x2181e0['query'][_0xac92('0x3b')]);_0x2758c7[_0xac92('0x3c')]=qs['filters'](_['pick'](_0x2181e0['query'],_0x354868[_0xac92('0x3d')]),_0x22246a);if(_0x2181e0[_0xac92('0x32')][_0xac92('0x3e')]){_0x2758c7[_0xac92('0x3c')]=_[_0xac92('0x3f')](_0x2758c7[_0xac92('0x3c')],{'$or':_[_0xac92('0x2d')](_0x22246a,function(_0x2ad5bf){if(_0x2ad5bf[_0xac92('0x30')]!==_0xac92('0x40')){var _0x1bf064={};_0x1bf064[_0x2ad5bf[_0xac92('0x2a')]]={'$like':'%'+_0x2181e0[_0xac92('0x32')][_0xac92('0x3e')]+'%'};return _0x1bf064;}})});}_0x2758c7=_[_0xac92('0x3f')]({},_0x2758c7,_0x2181e0[_0xac92('0x41')]);var _0x5c297d={'where':_0x2758c7[_0xac92('0x3c')]};return db['Variable'][_0xac92('0x1c')](_0x5c297d)[_0xac92('0x22')](function(_0x1f3a7e){_0xd6c45a[_0xac92('0x1c')]=_0x1f3a7e;if(_0x2181e0[_0xac92('0x32')][_0xac92('0x42')]){_0x2758c7['include']=[{'all':!![]}];}return db[_0xac92('0x2e')][_0xac92('0x43')](_0x2758c7);})[_0xac92('0x22')](function(_0x117611){_0xd6c45a[_0xac92('0x44')]=_0x117611;return _0xd6c45a;})[_0xac92('0x22')](respondWithFilteredResult(_0x2dc99b,_0x2758c7))[_0xac92('0x45')](handleError(_0x2dc99b,null));};exports['show']=function(_0x33e498,_0x3fb20f){var _0x3c37a9={'raw':!![],'where':{'id':_0x33e498[_0xac92('0x46')]['id']}},_0x1e5f9c={};_0x1e5f9c[_0xac92('0x35')]=_[_0xac92('0x31')](db[_0xac92('0x2e')]['rawAttributes']);_0x1e5f9c[_0xac92('0x32')]=_[_0xac92('0x31')](_0x33e498[_0xac92('0x32')]);_0x1e5f9c[_0xac92('0x3d')]=_[_0xac92('0x34')](_0x1e5f9c[_0xac92('0x35')],_0x1e5f9c[_0xac92('0x32')]);_0x3c37a9['attributes']=_[_0xac92('0x34')](_0x1e5f9c[_0xac92('0x35')],qs[_0xac92('0x36')](_0x33e498['query'][_0xac92('0x36')]));_0x3c37a9[_0xac92('0x33')]=_0x3c37a9[_0xac92('0x33')][_0xac92('0x37')]?_0x3c37a9[_0xac92('0x33')]:_0x1e5f9c[_0xac92('0x35')];if(_0x33e498[_0xac92('0x32')][_0xac92('0x42')]){_0x3c37a9['include']=[{'all':!![]}];}_0x3c37a9=_[_0xac92('0x3f')]({},_0x3c37a9,_0x33e498[_0xac92('0x41')]);return db['Variable']['find'](_0x3c37a9)['then'](handleEntityNotFound(_0x3fb20f,null))['then'](respondWithResult(_0x3fb20f,null))['catch'](handleError(_0x3fb20f,null));};exports[_0xac92('0x47')]=function(_0x2f72d3,_0x13527f){return db['Variable']['create'](_0x2f72d3[_0xac92('0x48')],{})['then'](function(_0x80aaae){var _0x26f3e3=_0x2f72d3['user'][_0xac92('0x24')]({'plain':!![]});if(!_0x26f3e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26f3e3[_0xac92('0x49')]==='user'){var _0x3bfdcb=_0x80aaae['get']({'plain':!![]});var _0x3fc77d=_0xac92('0x4a');return db[_0xac92('0x4b')][_0xac92('0x4c')]({'where':{'name':_0x3fc77d,'userProfileId':_0x26f3e3[_0xac92('0x4d')]},'raw':!![]})[_0xac92('0x22')](function(_0x5d3cea){if(_0x5d3cea&&_0x5d3cea[_0xac92('0x4e')]===0x0){return db[_0xac92('0x25')][_0xac92('0x47')]({'name':_0x3bfdcb[_0xac92('0x2a')],'resourceId':_0x3bfdcb['id'],'type':_0x5d3cea[_0xac92('0x2a')],'sectionId':_0x5d3cea['id']},{})[_0xac92('0x22')](function(){return _0x80aaae;});}else{return _0x80aaae;}})['catch'](function(_0x2ff7c5){logger[_0xac92('0x28')](_0xac92('0x4f'),_0x2ff7c5);throw _0x2ff7c5;});}return _0x80aaae;})[_0xac92('0x22')](respondWithResult(_0x13527f,0xc9))[_0xac92('0x45')](handleError(_0x13527f,null));};exports['update']=function(_0x3eb4e4,_0x405ba6){if(_0x3eb4e4[_0xac92('0x48')]['id']){delete _0x3eb4e4[_0xac92('0x48')]['id'];}return db[_0xac92('0x2e')][_0xac92('0x4c')]({'where':{'id':_0x3eb4e4[_0xac92('0x46')]['id']}})[_0xac92('0x22')](handleEntityNotFound(_0x405ba6,null))['then'](saveUpdates(_0x3eb4e4[_0xac92('0x48')],null))[_0xac92('0x22')](respondWithResult(_0x405ba6,null))[_0xac92('0x45')](handleError(_0x405ba6,null));};exports['destroy']=function(_0x502acb,_0x449731){return db[_0xac92('0x2e')][_0xac92('0x4c')]({'where':{'id':_0x502acb[_0xac92('0x46')]['id']}})[_0xac92('0x22')](handleEntityNotFound(_0x449731,null))[_0xac92('0x22')](removeEntity(_0x449731,null))[_0xac92('0x45')](handleError(_0x449731,null));}; \ No newline at end of file +var _0x970f=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','offset','count','limit','set','Content-Range','apply','reject','then','get','Variables','UserProfileResource','destroy','stack','name','index','map','Variable','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','create','body','user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x669ee8,_0x56f432){var _0x533836=function(_0x25fb39){while(--_0x25fb39){_0x669ee8['push'](_0x669ee8['shift']());}};_0x533836(++_0x56f432);}(_0x970f,0xe4));var _0xf970=function(_0x21b960,_0x52676a){_0x21b960=_0x21b960-0x0;var _0x4f0c18=_0x970f[_0x21b960];return _0x4f0c18;};'use strict';var emlformat=require(_0xf970('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf970('0x1'));var rp=require(_0xf970('0x2'));var moment=require(_0xf970('0x3'));var BPromise=require(_0xf970('0x4'));var Mustache=require(_0xf970('0x5'));var util=require(_0xf970('0x6'));var path=require(_0xf970('0x7'));var sox=require(_0xf970('0x8'));var csv=require(_0xf970('0x9'));var ejs=require(_0xf970('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf970('0xb'));var squel=require(_0xf970('0xc'));var crypto=require(_0xf970('0xd'));var jsforce=require(_0xf970('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf970('0x9'));var querystring=require(_0xf970('0xf'));var Papa=require(_0xf970('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf970('0x11'));var as=require(_0xf970('0x12'));var hardwareService=require(_0xf970('0x13'));var logger=require(_0xf970('0x14'))(_0xf970('0x15'));var utils=require(_0xf970('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf970('0x17'));var db=require(_0xf970('0x18'))['db'];function respondWithStatusCode(_0x14faa5,_0x19dd48){_0x19dd48=_0x19dd48||0xcc;return function(_0x4543ab){if(_0x4543ab){return _0x14faa5[_0xf970('0x19')](_0x19dd48);}return _0x14faa5['status'](_0x19dd48)[_0xf970('0x1a')]();};}function respondWithResult(_0x18a354,_0x44cb8a){_0x44cb8a=_0x44cb8a||0xc8;return function(_0x2eb812){if(_0x2eb812){return _0x18a354[_0xf970('0x1b')](_0x44cb8a)['json'](_0x2eb812);}};}function respondWithFilteredResult(_0x55ee39,_0x326e7c){return function(_0x2aff41){if(_0x2aff41){var _0x5dc826=typeof _0x326e7c['offset']==='undefined'&&typeof _0x326e7c['limit']===_0xf970('0x1c');var _0x1880fa=_0x2aff41['count'];var _0x311552=_0x5dc826?0x0:_0x326e7c[_0xf970('0x1d')];var _0x32a80e=_0x5dc826?_0x2aff41[_0xf970('0x1e')]:_0x326e7c[_0xf970('0x1d')]+_0x326e7c[_0xf970('0x1f')];var _0x32cdbb;if(_0x32a80e>=_0x1880fa){_0x32a80e=_0x1880fa;_0x32cdbb=0xc8;}else{_0x32cdbb=0xce;}_0x55ee39[_0xf970('0x1b')](_0x32cdbb);return _0x55ee39[_0xf970('0x20')](_0xf970('0x21'),_0x311552+'-'+_0x32a80e+'/'+_0x1880fa)['json'](_0x2aff41);}return null;};}function patchUpdates(_0x34af89){return function(_0x3fde8c){try{jsonpatch[_0xf970('0x22')](_0x3fde8c,_0x34af89,!![]);}catch(_0x2caa8c){return BPromise[_0xf970('0x23')](_0x2caa8c);}return _0x3fde8c['save']();};}function saveUpdates(_0x4e1e21,_0x313c0d){return function(_0x22ca2f){if(_0x22ca2f){return _0x22ca2f['update'](_0x4e1e21)[_0xf970('0x24')](function(_0x515438){return _0x515438;});}return null;};}function removeEntity(_0x365e61,_0x6f05bd){return function(_0x5105ab){if(_0x5105ab){return _0x5105ab['destroy']()['then'](function(){var _0x527762=_0x5105ab[_0xf970('0x25')]({'plain':!![]});var _0x319371=_0xf970('0x26');return db[_0xf970('0x27')][_0xf970('0x28')]({'where':{'type':_0x319371,'resourceId':_0x527762['id']}})['then'](function(){return _0x5105ab;});})['then'](function(){_0x365e61[_0xf970('0x1b')](0xcc)[_0xf970('0x1a')]();});}};}function handleEntityNotFound(_0x139229,_0x59d5c1){return function(_0x30319e){if(!_0x30319e){_0x139229['sendStatus'](0x194);}return _0x30319e;};}function handleError(_0x5d0fcf,_0x1d2fd7){_0x1d2fd7=_0x1d2fd7||0x1f4;return function(_0x5b17f6){logger['error'](_0x5b17f6[_0xf970('0x29')]);if(_0x5b17f6[_0xf970('0x2a')]){delete _0x5b17f6['name'];}_0x5d0fcf[_0xf970('0x1b')](_0x1d2fd7)['send'](_0x5b17f6);};}exports[_0xf970('0x2b')]=function(_0x2b3a57,_0x27df36){var _0x5a6d88={},_0x40922e={},_0x1d02b6={'count':0x0,'rows':[]};var _0x3c2ab4=_[_0xf970('0x2c')](db[_0xf970('0x2d')][_0xf970('0x2e')],function(_0x2724a2){return{'name':_0x2724a2[_0xf970('0x2f')],'type':_0x2724a2[_0xf970('0x30')]['key']};});_0x40922e[_0xf970('0x31')]=_[_0xf970('0x2c')](_0x3c2ab4,'name');_0x40922e[_0xf970('0x32')]=_[_0xf970('0x33')](_0x2b3a57[_0xf970('0x32')]);_0x40922e['filters']=_[_0xf970('0x34')](_0x40922e['model'],_0x40922e['query']);_0x5a6d88[_0xf970('0x35')]=_[_0xf970('0x34')](_0x40922e[_0xf970('0x31')],qs[_0xf970('0x36')](_0x2b3a57[_0xf970('0x32')][_0xf970('0x36')]));_0x5a6d88['attributes']=_0x5a6d88[_0xf970('0x35')][_0xf970('0x37')]?_0x5a6d88[_0xf970('0x35')]:_0x40922e[_0xf970('0x31')];if(!_0x2b3a57[_0xf970('0x32')][_0xf970('0x38')](_0xf970('0x39'))){_0x5a6d88[_0xf970('0x1f')]=qs[_0xf970('0x1f')](_0x2b3a57[_0xf970('0x32')][_0xf970('0x1f')]);_0x5a6d88['offset']=qs[_0xf970('0x1d')](_0x2b3a57[_0xf970('0x32')][_0xf970('0x1d')]);}_0x5a6d88[_0xf970('0x3a')]=qs['sort'](_0x2b3a57['query'][_0xf970('0x3b')]);_0x5a6d88['where']=qs[_0xf970('0x3c')](_[_0xf970('0x3d')](_0x2b3a57[_0xf970('0x32')],_0x40922e[_0xf970('0x3c')]),_0x3c2ab4);if(_0x2b3a57['query']['filter']){_0x5a6d88[_0xf970('0x3e')]=_[_0xf970('0x3f')](_0x5a6d88[_0xf970('0x3e')],{'$or':_[_0xf970('0x2c')](_0x3c2ab4,function(_0x3273ef){if(_0x3273ef[_0xf970('0x30')]!==_0xf970('0x40')){var _0x1e3258={};_0x1e3258[_0x3273ef[_0xf970('0x2a')]]={'$like':'%'+_0x2b3a57[_0xf970('0x32')]['filter']+'%'};return _0x1e3258;}})});}_0x5a6d88=_[_0xf970('0x3f')]({},_0x5a6d88,_0x2b3a57['options']);var _0x4d3222={'where':_0x5a6d88[_0xf970('0x3e')]};return db[_0xf970('0x2d')][_0xf970('0x1e')](_0x4d3222)[_0xf970('0x24')](function(_0xb26c06){_0x1d02b6[_0xf970('0x1e')]=_0xb26c06;if(_0x2b3a57[_0xf970('0x32')][_0xf970('0x41')]){_0x5a6d88[_0xf970('0x42')]=[{'all':!![]}];}return db[_0xf970('0x2d')][_0xf970('0x43')](_0x5a6d88);})['then'](function(_0x5e2809){_0x1d02b6[_0xf970('0x44')]=_0x5e2809;return _0x1d02b6;})['then'](respondWithFilteredResult(_0x27df36,_0x5a6d88))[_0xf970('0x45')](handleError(_0x27df36,null));};exports['show']=function(_0x2f0c4a,_0x43d821){var _0x4cbc56={'raw':!![],'where':{'id':_0x2f0c4a[_0xf970('0x46')]['id']}},_0x1d0ea0={};_0x1d0ea0[_0xf970('0x31')]=_[_0xf970('0x33')](db['Variable'][_0xf970('0x2e')]);_0x1d0ea0[_0xf970('0x32')]=_[_0xf970('0x33')](_0x2f0c4a[_0xf970('0x32')]);_0x1d0ea0[_0xf970('0x3c')]=_[_0xf970('0x34')](_0x1d0ea0[_0xf970('0x31')],_0x1d0ea0[_0xf970('0x32')]);_0x4cbc56['attributes']=_[_0xf970('0x34')](_0x1d0ea0['model'],qs['fields'](_0x2f0c4a[_0xf970('0x32')][_0xf970('0x36')]));_0x4cbc56[_0xf970('0x35')]=_0x4cbc56[_0xf970('0x35')]['length']?_0x4cbc56[_0xf970('0x35')]:_0x1d0ea0[_0xf970('0x31')];if(_0x2f0c4a[_0xf970('0x32')][_0xf970('0x41')]){_0x4cbc56['include']=[{'all':!![]}];}_0x4cbc56=_[_0xf970('0x3f')]({},_0x4cbc56,_0x2f0c4a[_0xf970('0x47')]);return db[_0xf970('0x2d')]['find'](_0x4cbc56)['then'](handleEntityNotFound(_0x43d821,null))['then'](respondWithResult(_0x43d821,null))[_0xf970('0x45')](handleError(_0x43d821,null));};exports[_0xf970('0x48')]=function(_0x20324b,_0x5bc608){return db[_0xf970('0x2d')][_0xf970('0x48')](_0x20324b[_0xf970('0x49')],{})[_0xf970('0x24')](function(_0x2fc84c){var _0x1eb909=_0x20324b[_0xf970('0x4a')]['get']({'plain':!![]});if(!_0x1eb909)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1eb909[_0xf970('0x4b')]==='user'){var _0x780fc2=_0x2fc84c[_0xf970('0x25')]({'plain':!![]});var _0x12489a=_0xf970('0x26');return db[_0xf970('0x4c')][_0xf970('0x4d')]({'where':{'name':_0x12489a,'userProfileId':_0x1eb909['userProfileId']},'raw':!![]})['then'](function(_0x246adb){if(_0x246adb&&_0x246adb[_0xf970('0x4e')]===0x0){return db[_0xf970('0x27')][_0xf970('0x48')]({'name':_0x780fc2[_0xf970('0x2a')],'resourceId':_0x780fc2['id'],'type':_0x246adb['name'],'sectionId':_0x246adb['id']},{})[_0xf970('0x24')](function(){return _0x2fc84c;});}else{return _0x2fc84c;}})[_0xf970('0x45')](function(_0x3def79){logger[_0xf970('0x4f')](_0xf970('0x50'),_0x3def79);throw _0x3def79;});}return _0x2fc84c;})['then'](respondWithResult(_0x5bc608,0xc9))[_0xf970('0x45')](handleError(_0x5bc608,null));};exports['update']=function(_0x4ced80,_0x6dd02d){if(_0x4ced80[_0xf970('0x49')]['id']){delete _0x4ced80[_0xf970('0x49')]['id'];}return db[_0xf970('0x2d')][_0xf970('0x4d')]({'where':{'id':_0x4ced80[_0xf970('0x46')]['id']}})[_0xf970('0x24')](handleEntityNotFound(_0x6dd02d,null))['then'](saveUpdates(_0x4ced80[_0xf970('0x49')],null))[_0xf970('0x24')](respondWithResult(_0x6dd02d,null))[_0xf970('0x45')](handleError(_0x6dd02d,null));};exports['destroy']=function(_0x53aac,_0x3755e7){return db[_0xf970('0x2d')]['find']({'where':{'id':_0x53aac[_0xf970('0x46')]['id']}})[_0xf970('0x24')](handleEntityNotFound(_0x3755e7,null))['then'](removeEntity(_0x3755e7,null))[_0xf970('0x45')](handleError(_0x3755e7,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index dff4853..99cdbb9 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 _0x4754=['request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ad901,_0x852d9e){var _0x3c0249=function(_0x319eda){while(--_0x319eda){_0x1ad901['push'](_0x1ad901['shift']());}};_0x3c0249(++_0x852d9e);}(_0x4754,0x120));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4475('0x0'));var util=require(_0x4475('0x1'));var logger=require(_0x4475('0x2'))(_0x4475('0x3'));var moment=require(_0x4475('0x4'));var BPromise=require(_0x4475('0x5'));var rp=require(_0x4475('0x6'));var fs=require('fs');var path=require(_0x4475('0x7'));var rimraf=require('rimraf');var config=require(_0x4475('0x8'));var attributes=require(_0x4475('0x9'));module[_0x4475('0xa')]=function(_0x1f1185,_0xdfb01d){return _0x1f1185[_0x4475('0xb')](_0x4475('0xc'),attributes,{'tableName':_0x4475('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f67=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./variable.attributes','define','Variable'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x6f67,0x19a));var _0x76f6=function(_0x57c972,_0x510be5){_0x57c972=_0x57c972-0x0;var _0x2c5861=_0x6f67[_0x57c972];return _0x2c5861;};'use strict';var _=require(_0x76f6('0x0'));var util=require(_0x76f6('0x1'));var logger=require(_0x76f6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x76f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76f6('0x4'));var rimraf=require(_0x76f6('0x5'));var config=require(_0x76f6('0x6'));var attributes=require(_0x76f6('0x7'));module['exports']=function(_0x4e7e83,_0x45b90f){return _0x4e7e83[_0x76f6('0x8')](_0x76f6('0x9'),attributes,{'tableName':'tools_variables','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 f8f49e7..4a4cd9e 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 _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../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'];(function(_0xe66cc1,_0x5886c8){var _0x2deaed=function(_0xba5792){while(--_0xba5792){_0xe66cc1['push'](_0xe66cc1['shift']());}};_0x2deaed(++_0x5886c8);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x57eaa0,_0x32aae5){_0x57eaa0=_0x57eaa0-0x0;var _0x9d53d2=_0x7fbe[_0x57eaa0];return _0x9d53d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x4df896,_0x2f3d22){var _0x3ce5b0=function(_0x1617bd){while(--_0x1617bd){_0x4df896['push'](_0x4df896['shift']());}};_0x3ce5b0(++_0x2f3d22);}(_0x6aa7,0x178));var _0x76aa=function(_0x55b7fe,_0x708f94){_0x55b7fe=_0x55b7fe-0x0;var _0x2f2cdc=_0x6aa7[_0x55b7fe];return _0x2f2cdc;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index cd9726f..dc655b0 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 _0xccc1=['express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','reset','/pull','pull','restart','/migrations','migrations'];(function(_0x228518,_0x31969a){var _0x48d6df=function(_0x1eaf76){while(--_0x1eaf76){_0x228518['push'](_0x228518['shift']());}};_0x48d6df(++_0x31969a);}(_0xccc1,0x177));var _0x1ccc=function(_0x4d6991,_0x522735){_0x4d6991=_0x4d6991-0x0;var _0x3d3512=_0xccc1[_0x4d6991];return _0x3d3512;};'use strict';var express=require(_0x1ccc('0x0'));var router=express[_0x1ccc('0x1')]();var auth=require(_0x1ccc('0x2'));var controller=require(_0x1ccc('0x3'));router[_0x1ccc('0x4')]('/',controller[_0x1ccc('0x5')]);router['get'](_0x1ccc('0x6'),auth[_0x1ccc('0x7')](),auth[_0x1ccc('0x8')](),controller['fetch']);router[_0x1ccc('0x4')]('/reset',auth['isAuthenticated'](),auth[_0x1ccc('0x8')](),controller[_0x1ccc('0x9')]);router['get'](_0x1ccc('0xa'),auth[_0x1ccc('0x7')](),auth[_0x1ccc('0x8')](),controller[_0x1ccc('0xb')]);router[_0x1ccc('0x4')]('/restart',auth['isAuthenticated'](),controller[_0x1ccc('0xc')]);router[_0x1ccc('0x4')](_0x1ccc('0xd'),controller[_0x1ccc('0xe')]);module['exports']=router; \ No newline at end of file +var _0x17ac=['exports','express','Router','../../components/auth/service','index','get','isAuthenticated','/reset','canUpdate','reset','/pull','pull','/restart','restart','/migrations'];(function(_0x1be67f,_0x2de2f3){var _0x2abef4=function(_0x57dd81){while(--_0x57dd81){_0x1be67f['push'](_0x1be67f['shift']());}};_0x2abef4(++_0x2de2f3);}(_0x17ac,0x1f0));var _0xc17a=function(_0x4c6fb5,_0x32c84b){_0x4c6fb5=_0x4c6fb5-0x0;var _0x2d42b2=_0x17ac[_0x4c6fb5];return _0x2d42b2;};'use strict';var express=require(_0xc17a('0x0'));var router=express[_0xc17a('0x1')]();var auth=require(_0xc17a('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0xc17a('0x3')]);router[_0xc17a('0x4')]('/fetch',auth[_0xc17a('0x5')](),auth['canUpdate'](),controller['fetch']);router['get'](_0xc17a('0x6'),auth[_0xc17a('0x5')](),auth[_0xc17a('0x7')](),controller[_0xc17a('0x8')]);router[_0xc17a('0x4')](_0xc17a('0x9'),auth[_0xc17a('0x5')](),auth[_0xc17a('0x7')](),controller[_0xc17a('0xa')]);router[_0xc17a('0x4')](_0xc17a('0xb'),auth[_0xc17a('0x5')](),controller[_0xc17a('0xc')]);router[_0xc17a('0x4')](_0xc17a('0xd'),controller['migrations']);module[_0xc17a('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 3f3cec3..f7eb8d4 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 _0xf4da=['Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sort','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/pm2','update','simple-git','root','query','fetch','tags','latest','exports','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4da,0x1cc));var _0xaf4d=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xf4da[_0x5783f4];return _0x28e380;};'use strict';var Umzug=require(_0xaf4d('0x0'));var path=require(_0xaf4d('0x1'));var fs=require('fs');var _=require(_0xaf4d('0x2'));var pkginfo=require(_0xaf4d('0x3'))(module,_0xaf4d('0x4'));var compareVersions=require(_0xaf4d('0x5'));var exec=require('child_process')[_0xaf4d('0x6')];var db=require(_0xaf4d('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xaf4d('0x8'));var logger=require('../../config/logger')(_0xaf4d('0x9'));var git=require(_0xaf4d('0xa'))(config[_0xaf4d('0xb')]);exports['index']=function(_0x3ca2e7,_0x5034ac){var _0x2c2c2f={'current':module['exports'][_0xaf4d('0x4')],'phonebar':0x2};if(_0x3ca2e7['query']&&_0x3ca2e7[_0xaf4d('0xc')]['latest']){return git[_0xaf4d('0xd')]()[_0xaf4d('0xe')](function(_0x1d2cfa,_0x138b47){_0x2c2c2f[_0xaf4d('0xf')]=(_0x1d2cfa?module[_0xaf4d('0x10')][_0xaf4d('0x4')]:_0x138b47[_0xaf4d('0xf')])||_0xaf4d('0x11');return _0x5034ac[_0xaf4d('0x12')](0xc8)[_0xaf4d('0x13')](_0x2c2c2f);});}else{return _0x5034ac[_0xaf4d('0x12')](0xc8)['json'](_0x2c2c2f);}};exports[_0xaf4d('0xd')]=function(_0x5423a1,_0x1448c6){return git['fetch']([_0xaf4d('0x14'),'master'],function(_0x439c08){if(_0x439c08){logger[_0xaf4d('0x15')](_0x439c08);return _0x1448c6[_0xaf4d('0x12')](0x1f4)[_0xaf4d('0x13')](_0x439c08);}logger[_0xaf4d('0x16')](_0xaf4d('0x17'));return _0x1448c6[_0xaf4d('0x12')](0xc8)[_0xaf4d('0x13')]({'output':_0xaf4d('0x18')});});};exports[_0xaf4d('0x19')]=function(_0xb2fada,_0x46e334){return git[_0xaf4d('0x19')]([_0xaf4d('0x1a'),_0xaf4d('0x1b')],function(_0x2456ad){if(_0x2456ad){logger[_0xaf4d('0x15')](_0x2456ad);return _0x46e334[_0xaf4d('0x12')](0x1f4)['json'](_0x2456ad);}logger[_0xaf4d('0x16')](_0xaf4d('0x1c'));return _0x46e334['status'](0xc8)[_0xaf4d('0x13')]({'output':_0xaf4d('0x1d')});});};exports['pull']=function(_0x5d02c0,_0x251b83){exec(_0xaf4d('0x1e'),function(_0x21203a,_0x30c3e3,_0x4ded65){logger[_0xaf4d('0x16')](_0x30c3e3);logger['info'](_0x4ded65);if(_0x21203a){logger[_0xaf4d('0x15')](_0x21203a);return _0x251b83['status'](0x1f4)[_0xaf4d('0x13')](_0x21203a);}return _0x251b83[_0xaf4d('0x12')](0xc8)['json']({'output':_0x30c3e3});});};exports[_0xaf4d('0x1f')]=function(_0x5ae467,_0x4a0c26){return pm2[_0xaf4d('0x1f')](_0xaf4d('0x20'))[_0xaf4d('0x21')](function(_0x50668a){logger[_0xaf4d('0x16')](_0xaf4d('0x22'),_0x50668a);return _0x4a0c26[_0xaf4d('0x12')](0xc8)[_0xaf4d('0x13')]({'output':_0xaf4d('0x23')});})[_0xaf4d('0x24')](function(_0x79e821){logger['error'](_0x79e821);return _0x4a0c26[_0xaf4d('0x12')](0x1f4)[_0xaf4d('0x13')](_0x79e821);});};exports[_0xaf4d('0x25')]=function(_0x20d811,_0x678e61){var _0x452684=fs[_0xaf4d('0x26')](path[_0xaf4d('0x27')](config[_0xaf4d('0xb')],_0xaf4d('0x28'),'migrations'));var _0x338165=[];for(var _0x4bcfd7=0x0;_0x4bcfd7<_0x452684[_0xaf4d('0x29')];_0x4bcfd7++){var _0xfb00ce=_0x452684[_0x4bcfd7]['replace'](_0xaf4d('0x2a'),'');if(compareVersions(module[_0xaf4d('0x10')]['version'],_0xfb00ce)===-0x1){_0x338165[_0xaf4d('0x2b')](_0xfb00ce);}}if(_0x338165[_0xaf4d('0x29')]){var _0x5c43ec=_0x338165[_0xaf4d('0x2c')](compareVersions);var _0xcd60e0=new Umzug({'storage':_0xaf4d('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0xaf4d('0x4')},'migrations':{'params':[db['sequelize'][_0xaf4d('0x2e')](),db[_0xaf4d('0x2d')][_0xaf4d('0x2f')],function(){throw new Error(_0xaf4d('0x30'));}],'path':path['join'](config[_0xaf4d('0xb')],_0xaf4d('0x28'),_0xaf4d('0x25')),'pattern':/\.js$/}});_0xcd60e0['up']({'migrations':_[_0xaf4d('0x31')](_0x5c43ec,function(_0xb911d5){return _0xb911d5+_0xaf4d('0x2a');})})[_0xaf4d('0x21')](function(){return _0x678e61['status'](0xc8)['json']({'output':_0xaf4d('0x32')+module[_0xaf4d('0x10')][_0xaf4d('0x4')]+_0xaf4d('0x33')+_[_0xaf4d('0x34')](_0x5c43ec),'migrations':_[_0xaf4d('0x27')](_0x5c43ec)});})['catch'](function(_0x5bd701){if(_0x5bd701 instanceof db['sequelize'][_0xaf4d('0x35')]){return _0x678e61[_0xaf4d('0x12')](0xc8)[_0xaf4d('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x678e61[_0xaf4d('0x12')](0x1f4)[_0xaf4d('0x13')](_0x5bd701);}});}else{return _0x678e61[_0xaf4d('0x12')](0xc8)[_0xaf4d('0x13')]({'output':_0xaf4d('0x36')});}}; \ No newline at end of file +var _0xb98b=['umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','tags','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','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','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date'];(function(_0x141ad8,_0x2fcd0a){var _0x136419=function(_0x18e88e){while(--_0x18e88e){_0x141ad8['push'](_0x141ad8['shift']());}};_0x136419(++_0x2fcd0a);}(_0xb98b,0x162));var _0xbb98=function(_0x1d25ec,_0x212c09){_0x1d25ec=_0x1d25ec-0x0;var _0x400672=_0xb98b[_0x1d25ec];return _0x400672;};'use strict';var Umzug=require(_0xbb98('0x0'));var path=require(_0xbb98('0x1'));var fs=require('fs');var _=require(_0xbb98('0x2'));var pkginfo=require(_0xbb98('0x3'))(module,_0xbb98('0x4'));var compareVersions=require(_0xbb98('0x5'));var exec=require('child_process')[_0xbb98('0x6')];var db=require(_0xbb98('0x7'))['db'];var config=require(_0xbb98('0x8'));var pm2=require(_0xbb98('0x9'));var logger=require(_0xbb98('0xa'))(_0xbb98('0xb'));var git=require(_0xbb98('0xc'))(config[_0xbb98('0xd')]);exports['index']=function(_0x37470b,_0x50ef2b){var _0x360667={'current':module[_0xbb98('0xe')][_0xbb98('0x4')],'phonebar':0x2};if(_0x37470b[_0xbb98('0xf')]&&_0x37470b[_0xbb98('0xf')][_0xbb98('0x10')]){return git['fetch']()[_0xbb98('0x11')](function(_0x44dbce,_0x132e0f){_0x360667['latest']=(_0x44dbce?module[_0xbb98('0xe')]['version']:_0x132e0f[_0xbb98('0x10')])||_0xbb98('0x12');return _0x50ef2b[_0xbb98('0x13')](0xc8)[_0xbb98('0x14')](_0x360667);});}else{return _0x50ef2b[_0xbb98('0x13')](0xc8)[_0xbb98('0x14')](_0x360667);}};exports['fetch']=function(_0x43200a,_0x340802){return git[_0xbb98('0x15')]([_0xbb98('0x16'),_0xbb98('0x17')],function(_0x7e0b3f){if(_0x7e0b3f){logger[_0xbb98('0x18')](_0x7e0b3f);return _0x340802[_0xbb98('0x13')](0x1f4)[_0xbb98('0x14')](_0x7e0b3f);}logger[_0xbb98('0x19')](_0xbb98('0x1a'));return _0x340802[_0xbb98('0x13')](0xc8)[_0xbb98('0x14')]({'output':_0xbb98('0x1b')});});};exports[_0xbb98('0x1c')]=function(_0xe9e2e,_0x292e4a){return git[_0xbb98('0x1c')](['--hard',_0xbb98('0x1d')],function(_0x2df0ba){if(_0x2df0ba){logger[_0xbb98('0x18')](_0x2df0ba);return _0x292e4a[_0xbb98('0x13')](0x1f4)['json'](_0x2df0ba);}logger[_0xbb98('0x19')](_0xbb98('0x1e'));return _0x292e4a['status'](0xc8)[_0xbb98('0x14')]({'output':_0xbb98('0x1f')});});};exports[_0xbb98('0x20')]=function(_0x436a77,_0x349062){exec(_0xbb98('0x21'),function(_0x5dd944,_0x2e206b,_0x5d583c){logger[_0xbb98('0x19')](_0x2e206b);logger[_0xbb98('0x19')](_0x5d583c);if(_0x5dd944){logger[_0xbb98('0x18')](_0x5dd944);return _0x349062[_0xbb98('0x13')](0x1f4)['json'](_0x5dd944);}return _0x349062[_0xbb98('0x13')](0xc8)['json']({'output':_0x2e206b});});};exports[_0xbb98('0x22')]=function(_0x59e6d5,_0x306854){return pm2[_0xbb98('0x22')](_0xbb98('0x23'))[_0xbb98('0x24')](function(_0x1f1110){logger[_0xbb98('0x19')](_0xbb98('0x25'),_0x1f1110);return _0x306854[_0xbb98('0x13')](0xc8)[_0xbb98('0x14')]({'output':_0xbb98('0x26')});})[_0xbb98('0x27')](function(_0x237833){logger[_0xbb98('0x18')](_0x237833);return _0x306854[_0xbb98('0x13')](0x1f4)[_0xbb98('0x14')](_0x237833);});};exports[_0xbb98('0x28')]=function(_0x398f7f,_0x39f4aa){var _0xaaf7b4=fs[_0xbb98('0x29')](path[_0xbb98('0x2a')](config[_0xbb98('0xd')],_0xbb98('0x2b'),'migrations'));var _0x30533e=[];for(var _0x442220=0x0;_0x442220<_0xaaf7b4['length'];_0x442220++){var _0x37e9f6=_0xaaf7b4[_0x442220][_0xbb98('0x2c')](_0xbb98('0x2d'),'');if(compareVersions(module[_0xbb98('0xe')][_0xbb98('0x4')],_0x37e9f6)===-0x1){_0x30533e[_0xbb98('0x2e')](_0x37e9f6);}}if(_0x30533e[_0xbb98('0x2f')]){var _0x122979=_0x30533e[_0xbb98('0x30')](compareVersions);var _0x4cd4a5=new Umzug({'storage':_0xbb98('0x31'),'storageOptions':{'model':db[_0xbb98('0x32')],'modelName':_0xbb98('0x32'),'columnName':_0xbb98('0x4')},'migrations':{'params':[db[_0xbb98('0x31')][_0xbb98('0x33')](),db['sequelize'][_0xbb98('0x34')],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['join'](config['root'],_0xbb98('0x2b'),_0xbb98('0x28')),'pattern':/\.js$/}});_0x4cd4a5['up']({'migrations':_[_0xbb98('0x35')](_0x122979,function(_0x2d5706){return _0x2d5706+_0xbb98('0x2d');})})['then'](function(){return _0x39f4aa[_0xbb98('0x13')](0xc8)[_0xbb98('0x14')]({'output':_0xbb98('0x36')+module[_0xbb98('0xe')][_0xbb98('0x4')]+_0xbb98('0x37')+_[_0xbb98('0x38')](_0x122979),'migrations':_[_0xbb98('0x2a')](_0x122979)});})[_0xbb98('0x27')](function(_0x3ff30f){if(_0x3ff30f instanceof db[_0xbb98('0x31')][_0xbb98('0x39')]){return _0x39f4aa[_0xbb98('0x13')](0xc8)['json']({'output':_0xbb98('0x3a')});}else{return _0x39f4aa['status'](0x1f4)[_0xbb98('0x14')](_0x3ff30f);}});}else{return _0x39f4aa[_0xbb98('0x13')](0xc8)[_0xbb98('0x14')]({'output':_0xbb98('0x3a')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 6b37782..ba0723f 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 _0x7a6e=['./voiceAgentReport.controller','index','get','/describe','describe','/:id','isAuthenticated','post','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x4acebe,_0x5768d8){var _0x27b407=function(_0x31ee0d){while(--_0x31ee0d){_0x4acebe['push'](_0x4acebe['shift']());}};_0x27b407(++_0x5768d8);}(_0x7a6e,0xfb));var _0xe7a6=function(_0x405dc0,_0x5f2898){_0x405dc0=_0x405dc0-0x0;var _0x1ed46d=_0x7a6e[_0x405dc0];return _0x1ed46d;};'use strict';var multer=require(_0xe7a6('0x0'));var util=require(_0xe7a6('0x1'));var path=require(_0xe7a6('0x2'));var timeout=require(_0xe7a6('0x3'));var express=require(_0xe7a6('0x4'));var router=express['Router']();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(_0xe7a6('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xe7a6('0x6')]);router[_0xe7a6('0x7')](_0xe7a6('0x8'),auth['isAuthenticated'](),controller[_0xe7a6('0x9')]);router['get'](_0xe7a6('0xa'),auth[_0xe7a6('0xb')](),controller['show']);router[_0xe7a6('0xc')]('/',auth[_0xe7a6('0xb')](),controller['create']);router[_0xe7a6('0xd')]('/:id',auth[_0xe7a6('0xb')](),controller[_0xe7a6('0xe')]);router['delete'](_0xe7a6('0xa'),auth[_0xe7a6('0xb')](),controller[_0xe7a6('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe2c7=['./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x305d1f,_0x2c457a){var _0x27fdcc=function(_0x4d65ed){while(--_0x4d65ed){_0x305d1f['push'](_0x305d1f['shift']());}};_0x27fdcc(++_0x2c457a);}(_0xe2c7,0x1ac));var _0x7e2c=function(_0xf64026,_0x43afd3){_0xf64026=_0xf64026-0x0;var _0x1050be=_0xe2c7[_0xf64026];return _0x1050be;};'use strict';var multer=require(_0x7e2c('0x0'));var util=require(_0x7e2c('0x1'));var path=require(_0x7e2c('0x2'));var timeout=require(_0x7e2c('0x3'));var express=require(_0x7e2c('0x4'));var router=express[_0x7e2c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7e2c('0x6'));var interaction=require(_0x7e2c('0x7'));var config=require(_0x7e2c('0x8'));var controller=require(_0x7e2c('0x9'));router['get']('/',auth[_0x7e2c('0xa')](),controller[_0x7e2c('0xb')]);router[_0x7e2c('0xc')](_0x7e2c('0xd'),auth[_0x7e2c('0xa')](),controller[_0x7e2c('0xe')]);router[_0x7e2c('0xc')](_0x7e2c('0xf'),auth[_0x7e2c('0xa')](),controller[_0x7e2c('0x10')]);router[_0x7e2c('0x11')]('/',auth['isAuthenticated'](),controller[_0x7e2c('0x12')]);router[_0x7e2c('0x13')](_0x7e2c('0xf'),auth[_0x7e2c('0xa')](),controller['update']);router[_0x7e2c('0x14')](_0x7e2c('0xf'),auth['isAuthenticated'](),controller[_0x7e2c('0x15')]);module[_0x7e2c('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 01a9d61..bb562b2 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 _0x4024=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x31c9b2,_0x3d9d43){var _0x1e0b48=function(_0x443174){while(--_0x443174){_0x31c9b2['push'](_0x31c9b2['shift']());}};_0x1e0b48(++_0x3d9d43);}(_0x4024,0x89));var _0x4402=function(_0x5c0e21,_0x138725){_0x5c0e21=_0x5c0e21-0x0;var _0x54f5ee=_0x4024[_0x5c0e21];return _0x54f5ee;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4402('0x2')]},'calleridnum':{'type':Sequelize[_0x4402('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4402('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4402('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4402('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x4402('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4402('0x3')]},'holdtime':{'type':Sequelize[_0x4402('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4402('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x4402('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x4402('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4402('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4402('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4402('0x2')]},'accountcode':{'type':Sequelize[_0x4402('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4402('0x2')]},'priority':{'type':Sequelize[_0x4402('0x2')]},'destchannel':{'type':Sequelize[_0x4402('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4402('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4402('0x2')]},'destcalleridname':{'type':Sequelize[_0x4402('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4402('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4402('0x2')]},'destlanguage':{'type':Sequelize[_0x4402('0x2')]},'destaccountcode':{'type':Sequelize[_0x4402('0x2')]},'destcontext':{'type':Sequelize[_0x4402('0x2')]},'destexten':{'type':Sequelize[_0x4402('0x2')]},'destpriority':{'type':Sequelize[_0x4402('0x2')]},'destuniqueid':{'type':Sequelize[_0x4402('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4402('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4402('0x2')]},'transfer':{'type':Sequelize[_0x4402('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4402('0x2')],'comment':_0x4402('0x6')},'transferexten':{'type':Sequelize[_0x4402('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4402('0x2')]},'agententerreason':{'type':Sequelize[_0x4402('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4f3c=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x180217,_0x25675d){var _0x41644e=function(_0x22a332){while(--_0x22a332){_0x180217['push'](_0x180217['shift']());}};_0x41644e(++_0x25675d);}(_0x4f3c,0x15d));var _0xc4f3=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x4f3c[_0xf48cce];return _0x2a5c38;};'use strict';var Sequelize=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]={'type':{'type':Sequelize[_0xc4f3('0x2')]},'uniqueid':{'type':Sequelize[_0xc4f3('0x2')]},'calleridnum':{'type':Sequelize[_0xc4f3('0x2')]},'calleridname':{'type':Sequelize[_0xc4f3('0x2')]},'queue':{'type':Sequelize[_0xc4f3('0x2')]},'interface':{'type':Sequelize[_0xc4f3('0x2')]},'membername':{'type':Sequelize[_0xc4f3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc4f3('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xc4f3('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc4f3('0x3')]},'holdtime':{'type':Sequelize[_0xc4f3('0x4')]},'agentcomplete':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc4f3('0x4')]},'agentacw':{'type':Sequelize[_0xc4f3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc4f3('0x4')]},'reason':{'type':Sequelize[_0xc4f3('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc4f3('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc4f3('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc4f3('0x2')]},'accountcode':{'type':Sequelize[_0xc4f3('0x2')]},'context':{'type':Sequelize[_0xc4f3('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc4f3('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc4f3('0x2')]},'destcalleridname':{'type':Sequelize[_0xc4f3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc4f3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc4f3('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc4f3('0x2')]},'destcontext':{'type':Sequelize[_0xc4f3('0x2')]},'destexten':{'type':Sequelize[_0xc4f3('0x2')]},'destpriority':{'type':Sequelize[_0xc4f3('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc4f3('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc4f3('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc4f3('0x2')],'comment':_0xc4f3('0x6')},'transferexten':{'type':Sequelize[_0xc4f3('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index ccc5697..c1c03ca 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(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 68f5aa0..58abe93 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 _0x9576=['request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api'];(function(_0x2077be,_0x26136a){var _0x198bbf=function(_0x2fd7e3){while(--_0x2fd7e3){_0x2077be['push'](_0x2077be['shift']());}};_0x198bbf(++_0x26136a);}(_0x9576,0x182));var _0x6957=function(_0x4c4a63,_0x28fc1c){_0x4c4a63=_0x4c4a63-0x0;var _0x1060f7=_0x9576[_0x4c4a63];return _0x1060f7;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var logger=require(_0x6957('0x2'))(_0x6957('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6957('0x4'));var fs=require('fs');var path=require(_0x6957('0x5'));var rimraf=require(_0x6957('0x6'));var config=require(_0x6957('0x7'));var attributes=require(_0x6957('0x8'));module[_0x6957('0x9')]=function(_0x2eb79e,_0x49e08a){return _0x2eb79e[_0x6957('0xa')](_0x6957('0xb'),attributes,{'tableName':_0x6957('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6957('0xd'),_0x6957('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbeea=['moment','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','api'];(function(_0x20a5d6,_0x160fb9){var _0x453f6d=function(_0x32b54e){while(--_0x32b54e){_0x20a5d6['push'](_0x20a5d6['shift']());}};_0x453f6d(++_0x160fb9);}(_0xbeea,0xb1));var _0xabee=function(_0x147af8,_0x3c5a48){_0x147af8=_0x147af8-0x0;var _0x37c3ce=_0xbeea[_0x147af8];return _0x37c3ce;};'use strict';var _=require(_0xabee('0x0'));var util=require('util');var logger=require(_0xabee('0x1'))(_0xabee('0x2'));var moment=require(_0xabee('0x3'));var BPromise=require('bluebird');var rp=require(_0xabee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var attributes=require(_0xabee('0x7'));module[_0xabee('0x8')]=function(_0x1ea258,_0x58c9ef){return _0x1ea258['define'](_0xabee('0x9'),attributes,{'tableName':_0xabee('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xabee('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e0c325d..1e577b4 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 _0x259a=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3344c0,_0x18a644){var _0x409cb7=function(_0x305ae8){while(--_0x305ae8){_0x3344c0['push'](_0x3344c0['shift']());}};_0x409cb7(++_0x18a644);}(_0x259a,0x131));var _0xa259=function(_0xb40f40,_0x41708a){_0xb40f40=_0xb40f40-0x0;var _0x55c108=_0x259a[_0xb40f40];return _0x55c108;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa259('0x0'));var rs=require(_0xa259('0x1'));var fs=require('fs');var Redis=require(_0xa259('0x2'));var db=require(_0xa259('0x3'))['db'];var utils=require(_0xa259('0x4'));var logger=require(_0xa259('0x5'))(_0xa259('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa259('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11ffff,_0x259fff,_0x3f9084){return new BPromise(function(_0x1271ea,_0x5af71d){return client[_0xa259('0x8')](_0x11ffff,_0x3f9084)[_0xa259('0x9')](function(_0x38de45){logger[_0xa259('0xa')](_0xa259('0xb'),_0x259fff,_0xa259('0xc'));logger[_0xa259('0xd')](_0xa259('0xe'),_0x259fff,_0xa259('0xc'),JSON[_0xa259('0xf')](_0x38de45));if(_0x38de45[_0xa259('0x10')]){if(_0x38de45[_0xa259('0x10')][_0xa259('0x11')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x259fff,_0x38de45['error'][_0xa259('0x12')]);return _0x5af71d(_0x38de45[_0xa259('0x10')][_0xa259('0x12')]);}logger[_0xa259('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x259fff,_0x38de45[_0xa259('0x10')][_0xa259('0x12')]);return _0x1271ea(_0x38de45[_0xa259('0x10')][_0xa259('0x12')]);}else{logger[_0xa259('0xa')](_0xa259('0xb'),_0x259fff,_0xa259('0xc'));_0x1271ea(_0x38de45['result'][_0xa259('0x12')]);}})[_0xa259('0x13')](function(_0xd97cfd){logger[_0xa259('0x10')](_0xa259('0xb'),_0x259fff,_0xd97cfd);_0x5af71d(_0xd97cfd);});});}exports['CreateVoiceAgentReport']=function(_0x3dbe50){var _0x48601d=this;return new Promise(function(_0xd0443c,_0x3d1080){return db['VoiceAgentReport'][_0xa259('0x14')](_0x3dbe50['body'],{'raw':_0x3dbe50[_0xa259('0x15')]?_0x3dbe50[_0xa259('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xa259('0x9')](function(_0x1f6c40){logger[_0xa259('0xa')](_0xa259('0x16'),_0x3dbe50);logger[_0xa259('0xd')](_0xa259('0x16'),_0x3dbe50,JSON[_0xa259('0xf')](_0x1f6c40));_0xd0443c(_0x1f6c40);})['catch'](function(_0x4bd973){logger[_0xa259('0x10')]('CreateVoiceAgentReport',_0x4bd973['message'],_0x3dbe50);_0x3d1080(_0x48601d['error'](0x1f4,_0x4bd973[_0xa259('0x12')]));});});};exports[_0xa259('0x17')]=function(_0x50af83){var _0xbea847=this;return new Promise(function(_0x2b9137,_0x123486){return db[_0xa259('0x18')][_0xa259('0x19')](_0x50af83['body'],{'raw':_0x50af83[_0xa259('0x15')]?_0x50af83[_0xa259('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50af83[_0xa259('0x15')]?_0x50af83[_0xa259('0x15')][_0xa259('0x1a')]||null:null,'attributes':_0x50af83['options']?_0x50af83[_0xa259('0x15')][_0xa259('0x1b')]||null:null,'limit':_0x50af83[_0xa259('0x15')]?_0x50af83[_0xa259('0x15')][_0xa259('0x1c')]||null:null})[_0xa259('0x9')](function(_0x40b778){logger[_0xa259('0xa')]('UpdateVoiceAgentReport',_0x50af83);logger[_0xa259('0xd')](_0xa259('0x17'),_0x50af83,JSON[_0xa259('0xf')](_0x40b778));_0x2b9137(_0x40b778);})['catch'](function(_0x23374d){logger[_0xa259('0x10')](_0xa259('0x17'),_0x23374d[_0xa259('0x12')],_0x50af83);_0x123486(_0xbea847[_0xa259('0x10')](0x1f4,_0x23374d[_0xa259('0x12')]));});});}; \ No newline at end of file +var _0x4383=['stringify','UpdateVoiceAgentReport','update','body','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','VoiceAgentReport','create','options','raw','then','CreateVoiceAgentReport','debug'];(function(_0x5b34f7,_0x3b4cd1){var _0x55fc97=function(_0x3266ea){while(--_0x3266ea){_0x5b34f7['push'](_0x5b34f7['shift']());}};_0x55fc97(++_0x3b4cd1);}(_0x4383,0x8e));var _0x3438=function(_0x2d2e30,_0x355e23){_0x2d2e30=_0x2d2e30-0x0;var _0x3e89e4=_0x4383[_0x2d2e30];return _0x3e89e4;};'use strict';var _=require(_0x3438('0x0'));var util=require(_0x3438('0x1'));var moment=require(_0x3438('0x2'));var BPromise=require(_0x3438('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3438('0x4'));var db=require(_0x3438('0x5'))['db'];var utils=require(_0x3438('0x6'));var logger=require(_0x3438('0x7'))('rpc');var config=require(_0x3438('0x8'));var jayson=require(_0x3438('0x9'));var client=jayson[_0x3438('0xa')][_0x3438('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb6d716,_0x281116,_0x493015){return new BPromise(function(_0x4210a2,_0x246008){return client[_0x3438('0xc')](_0xb6d716,_0x493015)['then'](function(_0x2d3006){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x281116,_0x3438('0xd'));logger['debug'](_0x3438('0xe'),_0x281116,'request\x20sent',JSON['stringify'](_0x2d3006));if(_0x2d3006[_0x3438('0xf')]){if(_0x2d3006[_0x3438('0xf')][_0x3438('0x10')]===0x1f4){logger[_0x3438('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x281116,_0x2d3006[_0x3438('0xf')][_0x3438('0x11')]);return _0x246008(_0x2d3006[_0x3438('0xf')][_0x3438('0x11')]);}logger[_0x3438('0xf')](_0x3438('0x12'),_0x281116,_0x2d3006[_0x3438('0xf')][_0x3438('0x11')]);return _0x4210a2(_0x2d3006[_0x3438('0xf')][_0x3438('0x11')]);}else{logger['info'](_0x3438('0x12'),_0x281116,_0x3438('0xd'));_0x4210a2(_0x2d3006[_0x3438('0x13')][_0x3438('0x11')]);}})[_0x3438('0x14')](function(_0x1194bf){logger[_0x3438('0xf')](_0x3438('0x12'),_0x281116,_0x1194bf);_0x246008(_0x1194bf);});});}exports['CreateVoiceAgentReport']=function(_0x3c54cc){var _0x39c943=this;return new Promise(function(_0x48dbd2,_0x1400d3){return db[_0x3438('0x15')][_0x3438('0x16')](_0x3c54cc['body'],{'raw':_0x3c54cc[_0x3438('0x17')]?_0x3c54cc[_0x3438('0x17')][_0x3438('0x18')]===undefined?!![]:![]:!![]})[_0x3438('0x19')](function(_0x430f2c){logger['info'](_0x3438('0x1a'),_0x3c54cc);logger[_0x3438('0x1b')](_0x3438('0x1a'),_0x3c54cc,JSON[_0x3438('0x1c')](_0x430f2c));_0x48dbd2(_0x430f2c);})[_0x3438('0x14')](function(_0x10de9f){logger[_0x3438('0xf')](_0x3438('0x1a'),_0x10de9f[_0x3438('0x11')],_0x3c54cc);_0x1400d3(_0x39c943[_0x3438('0xf')](0x1f4,_0x10de9f[_0x3438('0x11')]));});});};exports[_0x3438('0x1d')]=function(_0x1e6700){var _0x148611=this;return new Promise(function(_0x5c81ef,_0x45f897){return db[_0x3438('0x15')][_0x3438('0x1e')](_0x1e6700[_0x3438('0x1f')],{'raw':_0x1e6700['options']?_0x1e6700[_0x3438('0x17')][_0x3438('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e6700[_0x3438('0x17')]?_0x1e6700['options'][_0x3438('0x20')]||null:null,'attributes':_0x1e6700['options']?_0x1e6700[_0x3438('0x17')]['attributes']||null:null,'limit':_0x1e6700[_0x3438('0x17')]?_0x1e6700[_0x3438('0x17')][_0x3438('0x21')]||null:null})[_0x3438('0x19')](function(_0x50bea2){logger['info']('UpdateVoiceAgentReport',_0x1e6700);logger[_0x3438('0x1b')]('UpdateVoiceAgentReport',_0x1e6700,JSON[_0x3438('0x1c')](_0x50bea2));_0x5c81ef(_0x50bea2);})[_0x3438('0x14')](function(_0x5c6869){logger['error'](_0x3438('0x1d'),_0x5c6869[_0x3438('0x11')],_0x1e6700);_0x45f897(_0x148611[_0x3438('0xf')](0x1f4,_0x5c6869[_0x3438('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index fa5ae1a..d2647b3 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 _0xed1f=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update'];(function(_0x48f2ca,_0x9c9128){var _0x50b14c=function(_0x16203f){while(--_0x16203f){_0x48f2ca['push'](_0x48f2ca['shift']());}};_0x50b14c(++_0x9c9128);}(_0xed1f,0x6a));var _0xfed1=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xed1f[_0x5627e1];return _0x2f013f;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')]('/',auth[_0xfed1('0xc')](),controller[_0xfed1('0xd')]);router[_0xfed1('0xb')](_0xfed1('0xe'),auth[_0xfed1('0xc')](),controller[_0xfed1('0xf')]);router['get'](_0xfed1('0x10'),auth[_0xfed1('0xc')](),controller['show']);router[_0xfed1('0x11')]('/',auth[_0xfed1('0xc')](),controller['create']);router[_0xfed1('0x12')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x13')]);router['delete']('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9957=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x268f36,_0x27146b){var _0x4408ea=function(_0x2e558f){while(--_0x2e558f){_0x268f36['push'](_0x268f36['shift']());}};_0x4408ea(++_0x27146b);}(_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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')](_0x7995('0x12'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);module[_0x7995('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f385943..51a1117 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 _0x3cd5=['inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','inbound','outbound'];(function(_0xe08054,_0x22c584){var _0x5c3e9d=function(_0x3e461a){while(--_0x3e461a){_0xe08054['push'](_0xe08054['shift']());}};_0x5c3e9d(++_0x22c584);}(_0x3cd5,0x1c8));var _0x53cd=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0x3cd5[_0xd1c39b];return _0x58f5bc;};'use strict';var Sequelize=require(_0x53cd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x53cd('0x1')]},'type':{'type':Sequelize['ENUM'](_0x53cd('0x2'),'internal',_0x53cd('0x3'),_0x53cd('0x4'),_0x53cd('0x5'),_0x53cd('0x6'))},'tag':{'type':Sequelize[_0x53cd('0x1')]},'accountcode':{'type':Sequelize[_0x53cd('0x1')]},'source':{'type':Sequelize[_0x53cd('0x1')]},'destination':{'type':Sequelize[_0x53cd('0x1')]},'destinationcontext':{'type':Sequelize[_0x53cd('0x1')]},'callerid':{'type':Sequelize[_0x53cd('0x1')]},'channel':{'type':Sequelize[_0x53cd('0x1')]},'destinationchannel':{'type':Sequelize[_0x53cd('0x1')]},'lastapplication':{'type':Sequelize[_0x53cd('0x1')]},'lastdata':{'type':Sequelize[_0x53cd('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x53cd('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x53cd('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x53cd('0x9')]},'mohtime':{'type':Sequelize[_0x53cd('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x53cd('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x53cd('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x53cd('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x49d9=['inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound'];(function(_0x1c9191,_0x85472b){var _0x38458b=function(_0x1a45f5){while(--_0x1a45f5){_0x1c9191['push'](_0x1c9191['shift']());}};_0x38458b(++_0x85472b);}(_0x49d9,0x13e));var _0x949d=function(_0x5220d1,_0x2fee19){_0x5220d1=_0x5220d1-0x0;var _0x34f83a=_0x49d9[_0x5220d1];return _0x34f83a;};'use strict';var Sequelize=require(_0x949d('0x0'));module[_0x949d('0x1')]={'uniqueid':{'type':Sequelize[_0x949d('0x2')]},'type':{'type':Sequelize[_0x949d('0x3')](_0x949d('0x4'),'internal',_0x949d('0x5'),_0x949d('0x6'),_0x949d('0x7'),_0x949d('0x8'))},'tag':{'type':Sequelize[_0x949d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x949d('0x2')]},'destination':{'type':Sequelize[_0x949d('0x2')]},'destinationcontext':{'type':Sequelize[_0x949d('0x2')]},'callerid':{'type':Sequelize[_0x949d('0x2')]},'channel':{'type':Sequelize[_0x949d('0x2')]},'destinationchannel':{'type':Sequelize[_0x949d('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x949d('0x9')]},'starttime':{'type':Sequelize[_0x949d('0xa')]},'systemanswertime':{'type':Sequelize[_0x949d('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x949d('0xa')]},'duration':{'type':Sequelize[_0x949d('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x949d('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x949d('0x2')]},'amaflags':{'type':Sequelize[_0x949d('0x2')]},'userfield':{'type':Sequelize[_0x949d('0x2')]},'userDisposition':{'type':Sequelize[_0x949d('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x949d('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x949d('0x2')]},'note':{'type':Sequelize[_0x949d('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x949d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 3dac68c..0c3411e 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0x5f2f,0x73));var _0xf5f2=function(_0x61c36f,_0x57f97d){_0x61c36f=_0x61c36f-0x0;var _0x1c29d4=_0x5f2f[_0x61c36f];return _0x1c29d4;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e008070..7e2d35d 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 _0x564c=['api','moment','path','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x362cac,_0x1a15e2){var _0x460846=function(_0x210e3b){while(--_0x210e3b){_0x362cac['push'](_0x362cac['shift']());}};_0x460846(++_0x1a15e2);}(_0x564c,0xe7));var _0xc564=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0x564c[_0x25f805];return _0xf6628f;};'use strict';var _=require(_0xc564('0x0'));var util=require(_0xc564('0x1'));var logger=require(_0xc564('0x2'))(_0xc564('0x3'));var moment=require(_0xc564('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc564('0x5'));var rimraf=require(_0xc564('0x6'));var config=require(_0xc564('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xc564('0x8')]=function(_0x32bbc9,_0x147c03){return _0x32bbc9[_0xc564('0x9')](_0xc564('0xa'),attributes,{'tableName':_0xc564('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc564('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9179=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x25805b,_0x20d043){var _0x360b08=function(_0x360d6a){while(--_0x360d6a){_0x25805b['push'](_0x25805b['shift']());}};_0x360b08(++_0x20d043);}(_0x9179,0x1d2));var _0x9917=function(_0x2e7ad7,_0x2972b4){_0x2e7ad7=_0x2e7ad7-0x0;var _0x5c92c7=_0x9179[_0x2e7ad7];return _0x5c92c7;};'use strict';var _=require(_0x9917('0x0'));var util=require(_0x9917('0x1'));var logger=require(_0x9917('0x2'))(_0x9917('0x3'));var moment=require('moment');var BPromise=require(_0x9917('0x4'));var rp=require(_0x9917('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x9917('0x6')]=function(_0x1e908a,_0x4c3e15){return _0x1e908a[_0x9917('0x7')]('VoiceCallReport',attributes,{'tableName':'report_call','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 148c947..4a79555 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 _0x1a80=['CreateVoiceCallReport','VoiceCallReport','body','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','catch'];(function(_0x50c0cb,_0xb0ef8d){var _0xb645ae=function(_0x515948){while(--_0x515948){_0x50c0cb['push'](_0x50c0cb['shift']());}};_0xb645ae(++_0xb0ef8d);}(_0x1a80,0x190));var _0x01a8=function(_0x437f94,_0x194806){_0x437f94=_0x437f94-0x0;var _0x22e474=_0x1a80[_0x437f94];return _0x22e474;};'use strict';var _=require(_0x01a8('0x0'));var util=require(_0x01a8('0x1'));var moment=require(_0x01a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x01a8('0x3'));var fs=require('fs');var Redis=require(_0x01a8('0x4'));var db=require(_0x01a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x01a8('0x6'))(_0x01a8('0x7'));var config=require(_0x01a8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x01a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x205c05,_0x14e062,_0x2c8bfe){return new BPromise(function(_0x40e993,_0xfa3d3f){return client[_0x01a8('0xa')](_0x205c05,_0x2c8bfe)[_0x01a8('0xb')](function(_0x405a17){logger[_0x01a8('0xc')](_0x01a8('0xd'),_0x14e062,'request\x20sent');logger[_0x01a8('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x14e062,_0x01a8('0xf'),JSON[_0x01a8('0x10')](_0x405a17));if(_0x405a17[_0x01a8('0x11')]){if(_0x405a17[_0x01a8('0x11')][_0x01a8('0x12')]===0x1f4){logger['error'](_0x01a8('0xd'),_0x14e062,_0x405a17[_0x01a8('0x11')][_0x01a8('0x13')]);return _0xfa3d3f(_0x405a17[_0x01a8('0x11')][_0x01a8('0x13')]);}logger[_0x01a8('0x11')](_0x01a8('0xd'),_0x14e062,_0x405a17[_0x01a8('0x11')][_0x01a8('0x13')]);return _0x40e993(_0x405a17[_0x01a8('0x11')][_0x01a8('0x13')]);}else{logger[_0x01a8('0xc')](_0x01a8('0xd'),_0x14e062,_0x01a8('0xf'));_0x40e993(_0x405a17[_0x01a8('0x14')][_0x01a8('0x13')]);}})['catch'](function(_0x35c7f5){logger['error'](_0x01a8('0xd'),_0x14e062,_0x35c7f5);_0xfa3d3f(_0x35c7f5);});});}exports[_0x01a8('0x15')]=function(_0x4c7fb5){var _0x3a745c=this;return new Promise(function(_0x2f6b52,_0x2f575a){return db['VoiceCallReport'][_0x01a8('0x16')]({'raw':_0x4c7fb5['options']?_0x4c7fb5[_0x01a8('0x17')][_0x01a8('0x18')]===undefined?!![]:![]:!![],'where':_0x4c7fb5[_0x01a8('0x17')]?_0x4c7fb5[_0x01a8('0x17')][_0x01a8('0x19')]||null:null,'attributes':_0x4c7fb5[_0x01a8('0x17')]?_0x4c7fb5[_0x01a8('0x17')][_0x01a8('0x1a')]||null:null,'limit':_0x4c7fb5[_0x01a8('0x17')]?_0x4c7fb5[_0x01a8('0x17')][_0x01a8('0x1b')]||null:null,'include':_0x4c7fb5[_0x01a8('0x17')]?_0x4c7fb5[_0x01a8('0x17')]['include']?_[_0x01a8('0x1c')](_0x4c7fb5[_0x01a8('0x17')][_0x01a8('0x1d')],function(_0x38c647){return{'model':db[_0x38c647[_0x01a8('0x1e')]],'as':_0x38c647['as'],'attributes':_0x38c647['attributes'],'include':_0x38c647[_0x01a8('0x1d')]?_['map'](_0x38c647[_0x01a8('0x1d')],function(_0x1337f4){return{'model':db[_0x1337f4[_0x01a8('0x1e')]],'as':_0x1337f4['as'],'attributes':_0x1337f4['attributes'],'include':_0x1337f4[_0x01a8('0x1d')]?_[_0x01a8('0x1c')](_0x1337f4['include'],function(_0x30f637){return{'model':db[_0x30f637[_0x01a8('0x1e')]],'as':_0x30f637['as'],'attributes':_0x30f637[_0x01a8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59e378){logger[_0x01a8('0xc')](_0x01a8('0x15'),_0x4c7fb5);logger[_0x01a8('0xe')](_0x01a8('0x15'),_0x4c7fb5,JSON[_0x01a8('0x10')](_0x59e378));_0x2f6b52(_0x59e378);})[_0x01a8('0x1f')](function(_0x304a0c){logger[_0x01a8('0x11')]('GetVoiceCallReport',_0x304a0c[_0x01a8('0x13')],_0x4c7fb5);_0x2f575a(_0x3a745c[_0x01a8('0x11')](0x1f4,_0x304a0c[_0x01a8('0x13')]));});});};exports[_0x01a8('0x20')]=function(_0x29d577){var _0x593975=this;return new Promise(function(_0x2bd944,_0x438c5d){return db[_0x01a8('0x21')]['create'](_0x29d577[_0x01a8('0x22')],{'raw':_0x29d577[_0x01a8('0x17')]?_0x29d577['options']['raw']===undefined?!![]:![]:!![]})[_0x01a8('0xb')](function(_0x49bda2){logger[_0x01a8('0xc')](_0x01a8('0x20'),_0x29d577);logger['debug'](_0x01a8('0x20'),_0x29d577,JSON['stringify'](_0x49bda2));_0x2bd944(_0x49bda2);})['catch'](function(_0x18bedc){logger[_0x01a8('0x11')]('CreateVoiceCallReport',_0x18bedc[_0x01a8('0x13')],_0x29d577);_0x438c5d(_0x593975['error'](0x1f4,_0x18bedc[_0x01a8('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x12d483){var _0x873f2=this;return new Promise(function(_0x47e80d,_0x3da81d){return db[_0x01a8('0x21')][_0x01a8('0x23')](_0x12d483[_0x01a8('0x22')],{'raw':_0x12d483[_0x01a8('0x17')]?_0x12d483[_0x01a8('0x17')][_0x01a8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12d483[_0x01a8('0x17')]?_0x12d483[_0x01a8('0x17')][_0x01a8('0x19')]||null:null,'attributes':_0x12d483[_0x01a8('0x17')]?_0x12d483[_0x01a8('0x17')][_0x01a8('0x1a')]||null:null,'limit':_0x12d483[_0x01a8('0x17')]?_0x12d483[_0x01a8('0x17')][_0x01a8('0x1b')]||null:null})['then'](function(_0x3702ff){logger[_0x01a8('0xc')]('UpdateVoiceCallReport',_0x12d483);logger[_0x01a8('0xe')]('UpdateVoiceCallReport',_0x12d483,JSON[_0x01a8('0x10')](_0x3702ff));_0x47e80d(_0x3702ff);})['catch'](function(_0x5ebbc8){logger['error']('UpdateVoiceCallReport',_0x5ebbc8[_0x01a8('0x13')],_0x12d483);_0x3da81d(_0x873f2['error'](0x1f4,_0x5ebbc8[_0x01a8('0x13')]));});});}; \ No newline at end of file +var _0xff1f=['UpdateVoiceCallReport','raw','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','attributes','limit','include','map','model','CreateVoiceCallReport','create','body'];(function(_0x370195,_0x55b7d3){var _0x4c7960=function(_0x1048e0){while(--_0x1048e0){_0x370195['push'](_0x370195['shift']());}};_0x4c7960(++_0x55b7d3);}(_0xff1f,0x9d));var _0xfff1=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xff1f[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0xfff1('0x0'));var util=require('util');var moment=require(_0xfff1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfff1('0x2'));var db=require(_0xfff1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfff1('0x4'))(_0xfff1('0x5'));var config=require('../../config/environment');var jayson=require(_0xfff1('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x112753,_0x3df2a8,_0x2c0ad8){return new BPromise(function(_0x440a81,_0x3e85cf){return client['request'](_0x112753,_0x2c0ad8)[_0xfff1('0x7')](function(_0x5415ec){logger['info'](_0xfff1('0x8'),_0x3df2a8,'request\x20sent');logger[_0xfff1('0x9')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3df2a8,_0xfff1('0xa'),JSON[_0xfff1('0xb')](_0x5415ec));if(_0x5415ec[_0xfff1('0xc')]){if(_0x5415ec[_0xfff1('0xc')][_0xfff1('0xd')]===0x1f4){logger[_0xfff1('0xc')](_0xfff1('0x8'),_0x3df2a8,_0x5415ec['error']['message']);return _0x3e85cf(_0x5415ec['error'][_0xfff1('0xe')]);}logger[_0xfff1('0xc')](_0xfff1('0x8'),_0x3df2a8,_0x5415ec[_0xfff1('0xc')][_0xfff1('0xe')]);return _0x440a81(_0x5415ec['error'][_0xfff1('0xe')]);}else{logger[_0xfff1('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x3df2a8,_0xfff1('0xa'));_0x440a81(_0x5415ec[_0xfff1('0x10')][_0xfff1('0xe')]);}})[_0xfff1('0x11')](function(_0x371417){logger[_0xfff1('0xc')](_0xfff1('0x8'),_0x3df2a8,_0x371417);_0x3e85cf(_0x371417);});});}exports[_0xfff1('0x12')]=function(_0x216c60){var _0x41106f=this;return new Promise(function(_0x1b1246,_0x405413){return db[_0xfff1('0x13')]['findAll']({'raw':_0x216c60['options']?_0x216c60[_0xfff1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x216c60[_0xfff1('0x14')]?_0x216c60[_0xfff1('0x14')]['where']||null:null,'attributes':_0x216c60[_0xfff1('0x14')]?_0x216c60['options'][_0xfff1('0x15')]||null:null,'limit':_0x216c60[_0xfff1('0x14')]?_0x216c60['options'][_0xfff1('0x16')]||null:null,'include':_0x216c60[_0xfff1('0x14')]?_0x216c60['options'][_0xfff1('0x17')]?_[_0xfff1('0x18')](_0x216c60[_0xfff1('0x14')][_0xfff1('0x17')],function(_0x57727e){return{'model':db[_0x57727e[_0xfff1('0x19')]],'as':_0x57727e['as'],'attributes':_0x57727e['attributes'],'include':_0x57727e['include']?_[_0xfff1('0x18')](_0x57727e[_0xfff1('0x17')],function(_0x4fb310){return{'model':db[_0x4fb310[_0xfff1('0x19')]],'as':_0x4fb310['as'],'attributes':_0x4fb310['attributes'],'include':_0x4fb310[_0xfff1('0x17')]?_['map'](_0x4fb310['include'],function(_0x25b20d){return{'model':db[_0x25b20d['model']],'as':_0x25b20d['as'],'attributes':_0x25b20d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e4b84){logger['info']('GetVoiceCallReport',_0x216c60);logger[_0xfff1('0x9')]('GetVoiceCallReport',_0x216c60,JSON['stringify'](_0x4e4b84));_0x1b1246(_0x4e4b84);})['catch'](function(_0x200b3c){logger[_0xfff1('0xc')](_0xfff1('0x12'),_0x200b3c[_0xfff1('0xe')],_0x216c60);_0x405413(_0x41106f[_0xfff1('0xc')](0x1f4,_0x200b3c['message']));});});};exports[_0xfff1('0x1a')]=function(_0x326a66){var _0x4a69e9=this;return new Promise(function(_0x46b2f3,_0x119723){return db['VoiceCallReport'][_0xfff1('0x1b')](_0x326a66[_0xfff1('0x1c')],{'raw':_0x326a66[_0xfff1('0x14')]?_0x326a66['options']['raw']===undefined?!![]:![]:!![]})[_0xfff1('0x7')](function(_0xa65757){logger[_0xfff1('0xf')](_0xfff1('0x1a'),_0x326a66);logger[_0xfff1('0x9')](_0xfff1('0x1a'),_0x326a66,JSON[_0xfff1('0xb')](_0xa65757));_0x46b2f3(_0xa65757);})[_0xfff1('0x11')](function(_0x14fc7e){logger['error'](_0xfff1('0x1a'),_0x14fc7e[_0xfff1('0xe')],_0x326a66);_0x119723(_0x4a69e9[_0xfff1('0xc')](0x1f4,_0x14fc7e[_0xfff1('0xe')]));});});};exports[_0xfff1('0x1d')]=function(_0x779bbf){var _0x2dc83f=this;return new Promise(function(_0x2f5642,_0x274ba2){return db[_0xfff1('0x13')]['update'](_0x779bbf[_0xfff1('0x1c')],{'raw':_0x779bbf[_0xfff1('0x14')]?_0x779bbf[_0xfff1('0x14')][_0xfff1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x779bbf[_0xfff1('0x14')]?_0x779bbf[_0xfff1('0x14')]['where']||null:null,'attributes':_0x779bbf[_0xfff1('0x14')]?_0x779bbf[_0xfff1('0x14')][_0xfff1('0x15')]||null:null,'limit':_0x779bbf['options']?_0x779bbf['options'][_0xfff1('0x16')]||null:null})[_0xfff1('0x7')](function(_0x23e83f){logger[_0xfff1('0xf')](_0xfff1('0x1d'),_0x779bbf);logger[_0xfff1('0x9')](_0xfff1('0x1d'),_0x779bbf,JSON['stringify'](_0x23e83f));_0x2f5642(_0x23e83f);})[_0xfff1('0x11')](function(_0x5834ff){logger[_0xfff1('0xc')](_0xfff1('0x1d'),_0x5834ff[_0xfff1('0xe')],_0x779bbf);_0x274ba2(_0x2dc83f[_0xfff1('0xc')](0x1f4,_0x5834ff[_0xfff1('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b09ddcb..43698fb 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 _0x3ea0=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','put','update','destroy'];(function(_0xc7e833,_0x1cef92){var _0x331b1e=function(_0x1403a4){while(--_0x1403a4){_0xc7e833['push'](_0xc7e833['shift']());}};_0x331b1e(++_0x1cef92);}(_0x3ea0,0x154));var _0x03ea=function(_0x38eb22,_0x458a8c){_0x38eb22=_0x38eb22-0x0;var _0x49553e=_0x3ea0[_0x38eb22];return _0x49553e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x03ea('0x0'));var timeout=require(_0x03ea('0x1'));var express=require(_0x03ea('0x2'));var router=express[_0x03ea('0x3')]();var fs_extra=require(_0x03ea('0x4'));var auth=require(_0x03ea('0x5'));var interaction=require(_0x03ea('0x6'));var config=require(_0x03ea('0x7'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x03ea('0x8')]);router[_0x03ea('0x9')](_0x03ea('0xa'),auth[_0x03ea('0xb')](),controller[_0x03ea('0xc')]);router[_0x03ea('0xd')]('/',auth[_0x03ea('0xb')](),controller['create']);router[_0x03ea('0xe')]('/:id',auth[_0x03ea('0xb')](),controller[_0x03ea('0xf')]);router['delete']('/:id',auth[_0x03ea('0xb')](),controller[_0x03ea('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb768=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','get','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','util','path'];(function(_0x1b866c,_0x49d928){var _0xcc899=function(_0x11ec67){while(--_0x11ec67){_0x1b866c['push'](_0x1b866c['shift']());}};_0xcc899(++_0x49d928);}(_0xb768,0x18d));var _0x8b76=function(_0x7e544f,_0x111b3a){_0x7e544f=_0x7e544f-0x0;var _0x2c628c=_0xb768[_0x7e544f];return _0x2c628c;};'use strict';var multer=require('multer');var util=require(_0x8b76('0x0'));var path=require(_0x8b76('0x1'));var timeout=require(_0x8b76('0x2'));var express=require(_0x8b76('0x3'));var router=express[_0x8b76('0x4')]();var fs_extra=require(_0x8b76('0x5'));var auth=require(_0x8b76('0x6'));var interaction=require(_0x8b76('0x7'));var config=require(_0x8b76('0x8'));var controller=require(_0x8b76('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b76('0xa')]);router[_0x8b76('0xb')](_0x8b76('0xc'),auth['isAuthenticated'](),controller[_0x8b76('0xd')]);router[_0x8b76('0xe')]('/',auth[_0x8b76('0xf')](),controller['create']);router[_0x8b76('0x10')]('/:id',auth[_0x8b76('0xf')](),controller[_0x8b76('0x11')]);router[_0x8b76('0x12')](_0x8b76('0xc'),auth[_0x8b76('0xf')](),controller[_0x8b76('0x13')]);module[_0x8b76('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 099ec11..3de3e52 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 _0xe71d=['options','join','getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue'];(function(_0x19b8c1,_0x4b0823){var _0x24b112=function(_0x462e03){while(--_0x462e03){_0x19b8c1['push'](_0x19b8c1['shift']());}};_0x24b112(++_0x4b0823);}(_0xe71d,0x95));var _0xde71=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xe71d[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0xde71('0x0'));module['exports']={'name':{'type':Sequelize[_0xde71('0x1')]},'prefix':{'type':Sequelize[_0xde71('0x1')],'unique':_0xde71('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xd71c5){this[_0xde71('0x3')](_0xde71('0x4'),_0xd71c5?_0xd71c5[_0xde71('0x5')](''):[]);},'get':function(){return this[_0xde71('0x6')](_0xde71('0x4'))?this[_0xde71('0x6')](_0xde71('0x4'))[_0xde71('0x7')](''):[];}},'auth':{'type':Sequelize[_0xde71('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xde71('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xde71('0x1')]}}; \ No newline at end of file +var _0x8e8f=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x16aa60,_0x1adc7e){var _0x55ee9e=function(_0x4a0481){while(--_0x4a0481){_0x16aa60['push'](_0x16aa60['shift']());}};_0x55ee9e(++_0x1adc7e);}(_0x8e8f,0x6b));var _0xf8e8=function(_0x4579dc,_0xff67f8){_0x4579dc=_0x4579dc-0x0;var _0x458962=_0x8e8f[_0x4579dc];return _0x458962;};'use strict';var Sequelize=require(_0xf8e8('0x0'));module[_0xf8e8('0x1')]={'name':{'type':Sequelize[_0xf8e8('0x2')]},'prefix':{'type':Sequelize[_0xf8e8('0x2')],'unique':_0xf8e8('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x25671d){this[_0xf8e8('0x4')](_0xf8e8('0x5'),_0x25671d?_0x25671d[_0xf8e8('0x6')](''):[]);},'get':function(){return this[_0xf8e8('0x7')]('options')?this[_0xf8e8('0x7')](_0xf8e8('0x5'))[_0xf8e8('0x8')](''):[];}},'auth':{'type':Sequelize[_0xf8e8('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xf8e8('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf8e8('0x2')]},'description':{'type':Sequelize[_0xf8e8('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 58b7d18..a13c2c9 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 _0xe3ed=['../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','error','name','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','body','user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xe3ed,0x8d));var _0xde3e=function(_0x300876,_0x339ae1){_0x300876=_0x300876-0x0;var _0x358284=_0xe3ed[_0x300876];return _0x358284;};'use strict';var emlformat=require(_0xde3e('0x0'));var rimraf=require(_0xde3e('0x1'));var zipdir=require(_0xde3e('0x2'));var jsonpatch=require(_0xde3e('0x3'));var rp=require(_0xde3e('0x4'));var moment=require(_0xde3e('0x5'));var BPromise=require(_0xde3e('0x6'));var Mustache=require(_0xde3e('0x7'));var util=require('util');var path=require(_0xde3e('0x8'));var sox=require(_0xde3e('0x9'));var csv=require('to-csv');var ejs=require(_0xde3e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde3e('0xb'));var squel=require(_0xde3e('0xc'));var crypto=require('crypto');var jsforce=require(_0xde3e('0xd'));var deskjs=require(_0xde3e('0xe'));var toCsv=require(_0xde3e('0xf'));var querystring=require(_0xde3e('0x10'));var Papa=require(_0xde3e('0x11'));var Redis=require('ioredis');var authService=require(_0xde3e('0x12'));var qs=require(_0xde3e('0x13'));var as=require(_0xde3e('0x14'));var hardwareService=require(_0xde3e('0x15'));var logger=require('../../config/logger')(_0xde3e('0x16'));var utils=require(_0xde3e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde3e('0x18'));var db=require(_0xde3e('0x19'))['db'];function respondWithStatusCode(_0x5d0240,_0x22ffc2){_0x22ffc2=_0x22ffc2||0xcc;return function(_0x4e0f23){if(_0x4e0f23){return _0x5d0240[_0xde3e('0x1a')](_0x22ffc2);}return _0x5d0240[_0xde3e('0x1b')](_0x22ffc2)[_0xde3e('0x1c')]();};}function respondWithResult(_0x4fe882,_0x167fa7){_0x167fa7=_0x167fa7||0xc8;return function(_0x1fee7b){if(_0x1fee7b){return _0x4fe882['status'](_0x167fa7)['json'](_0x1fee7b);}};}function respondWithFilteredResult(_0x120077,_0x11db96){return function(_0x6543f7){if(_0x6543f7){var _0x552fc4=typeof _0x11db96['offset']===_0xde3e('0x1d')&&typeof _0x11db96['limit']==='undefined';var _0xc3ee05=_0x6543f7[_0xde3e('0x1e')];var _0x4aa02c=_0x552fc4?0x0:_0x11db96[_0xde3e('0x1f')];var _0x276e83=_0x552fc4?_0x6543f7[_0xde3e('0x1e')]:_0x11db96['offset']+_0x11db96['limit'];var _0x4fa0d2;if(_0x276e83>=_0xc3ee05){_0x276e83=_0xc3ee05;_0x4fa0d2=0xc8;}else{_0x4fa0d2=0xce;}_0x120077[_0xde3e('0x1b')](_0x4fa0d2);return _0x120077[_0xde3e('0x20')](_0xde3e('0x21'),_0x4aa02c+'-'+_0x276e83+'/'+_0xc3ee05)['json'](_0x6543f7);}return null;};}function patchUpdates(_0x2ceb3e){return function(_0x11dd22){try{jsonpatch[_0xde3e('0x22')](_0x11dd22,_0x2ceb3e,!![]);}catch(_0x8c8ace){return BPromise[_0xde3e('0x23')](_0x8c8ace);}return _0x11dd22[_0xde3e('0x24')]();};}function saveUpdates(_0x26c5ca,_0x1eda88){return function(_0x443e8d){if(_0x443e8d){return _0x443e8d['update'](_0x26c5ca)[_0xde3e('0x25')](function(_0x334093){return _0x334093;});}return null;};}function removeEntity(_0x37615f,_0x57df9e){return function(_0x361511){if(_0x361511){return _0x361511[_0xde3e('0x26')]()[_0xde3e('0x25')](function(){var _0x5c58ae=_0x361511[_0xde3e('0x27')]({'plain':!![]});var _0x78647=_0xde3e('0x28');return db[_0xde3e('0x29')][_0xde3e('0x26')]({'where':{'type':_0x78647,'resourceId':_0x5c58ae['id']}})['then'](function(){return _0x361511;});})['then'](function(){_0x37615f[_0xde3e('0x1b')](0xcc)[_0xde3e('0x1c')]();});}};}function handleEntityNotFound(_0x40b702,_0x4d2176){return function(_0x3d1404){if(!_0x3d1404){_0x40b702[_0xde3e('0x1a')](0x194);}return _0x3d1404;};}function handleError(_0x4d2e18,_0x59dfc7){_0x59dfc7=_0x59dfc7||0x1f4;return function(_0x245fbc){logger[_0xde3e('0x2a')](_0x245fbc['stack']);if(_0x245fbc[_0xde3e('0x2b')]){delete _0x245fbc[_0xde3e('0x2b')];}_0x4d2e18[_0xde3e('0x1b')](_0x59dfc7)['send'](_0x245fbc);};}exports['index']=function(_0x29bbcf,_0x596589){var _0x49c77a={},_0x2c4548={},_0x3657d1={'count':0x0,'rows':[]};var _0x23c798=_[_0xde3e('0x2c')](db[_0xde3e('0x2d')][_0xde3e('0x2e')],function(_0x379e65){return{'name':_0x379e65[_0xde3e('0x2f')],'type':_0x379e65[_0xde3e('0x30')][_0xde3e('0x31')]};});_0x2c4548[_0xde3e('0x32')]=_[_0xde3e('0x2c')](_0x23c798,_0xde3e('0x2b'));_0x2c4548[_0xde3e('0x33')]=_[_0xde3e('0x34')](_0x29bbcf[_0xde3e('0x33')]);_0x2c4548[_0xde3e('0x35')]=_['intersection'](_0x2c4548[_0xde3e('0x32')],_0x2c4548[_0xde3e('0x33')]);_0x49c77a[_0xde3e('0x36')]=_[_0xde3e('0x37')](_0x2c4548[_0xde3e('0x32')],qs[_0xde3e('0x38')](_0x29bbcf[_0xde3e('0x33')][_0xde3e('0x38')]));_0x49c77a['attributes']=_0x49c77a['attributes'][_0xde3e('0x39')]?_0x49c77a['attributes']:_0x2c4548['model'];if(!_0x29bbcf[_0xde3e('0x33')][_0xde3e('0x3a')](_0xde3e('0x3b'))){_0x49c77a[_0xde3e('0x3c')]=qs[_0xde3e('0x3c')](_0x29bbcf[_0xde3e('0x33')]['limit']);_0x49c77a['offset']=qs[_0xde3e('0x1f')](_0x29bbcf[_0xde3e('0x33')][_0xde3e('0x1f')]);}_0x49c77a[_0xde3e('0x3d')]=qs[_0xde3e('0x3e')](_0x29bbcf[_0xde3e('0x33')]['sort']);_0x49c77a[_0xde3e('0x3f')]=qs['filters'](_[_0xde3e('0x40')](_0x29bbcf[_0xde3e('0x33')],_0x2c4548[_0xde3e('0x35')]),_0x23c798);if(_0x29bbcf[_0xde3e('0x33')]['filter']){_0x49c77a[_0xde3e('0x3f')]=_[_0xde3e('0x41')](_0x49c77a['where'],{'$or':_[_0xde3e('0x2c')](_0x23c798,function(_0x6bd476){if(_0x6bd476[_0xde3e('0x30')]!==_0xde3e('0x42')){var _0x35fb56={};_0x35fb56[_0x6bd476[_0xde3e('0x2b')]]={'$like':'%'+_0x29bbcf[_0xde3e('0x33')][_0xde3e('0x43')]+'%'};return _0x35fb56;}})});}_0x49c77a=_[_0xde3e('0x41')]({},_0x49c77a,_0x29bbcf[_0xde3e('0x44')]);var _0x53385f={'where':_0x49c77a[_0xde3e('0x3f')]};return db['VoiceChanSpy'][_0xde3e('0x1e')](_0x53385f)[_0xde3e('0x25')](function(_0x2a4faf){_0x3657d1[_0xde3e('0x1e')]=_0x2a4faf;if(_0x29bbcf[_0xde3e('0x33')][_0xde3e('0x45')]){_0x49c77a[_0xde3e('0x46')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xde3e('0x47')](_0x49c77a);})[_0xde3e('0x25')](function(_0x2d2ab7){_0x3657d1['rows']=_0x2d2ab7;return _0x3657d1;})[_0xde3e('0x25')](respondWithFilteredResult(_0x596589,_0x49c77a))[_0xde3e('0x48')](handleError(_0x596589,null));};exports[_0xde3e('0x49')]=function(_0x5b6c7d,_0x166243){var _0x3e3777={'raw':![],'where':{'id':_0x5b6c7d[_0xde3e('0x4a')]['id']}},_0x31d10c={};_0x31d10c['model']=_[_0xde3e('0x34')](db[_0xde3e('0x2d')]['rawAttributes']);_0x31d10c[_0xde3e('0x33')]=_[_0xde3e('0x34')](_0x5b6c7d[_0xde3e('0x33')]);_0x31d10c['filters']=_[_0xde3e('0x37')](_0x31d10c['model'],_0x31d10c['query']);_0x3e3777['attributes']=_['intersection'](_0x31d10c[_0xde3e('0x32')],qs[_0xde3e('0x38')](_0x5b6c7d[_0xde3e('0x33')]['fields']));_0x3e3777[_0xde3e('0x36')]=_0x3e3777['attributes'][_0xde3e('0x39')]?_0x3e3777['attributes']:_0x31d10c['model'];if(_0x5b6c7d[_0xde3e('0x33')]['includeAll']){_0x3e3777['include']=[{'all':!![]}];}_0x3e3777=_[_0xde3e('0x41')]({},_0x3e3777,_0x5b6c7d[_0xde3e('0x44')]);return db[_0xde3e('0x2d')][_0xde3e('0x4b')](_0x3e3777)[_0xde3e('0x25')](handleEntityNotFound(_0x166243,null))[_0xde3e('0x25')](respondWithResult(_0x166243,null))['catch'](handleError(_0x166243,null));};exports['create']=function(_0x117ab6,_0x66449d){return db[_0xde3e('0x2d')]['create'](_0x117ab6[_0xde3e('0x4c')],{})[_0xde3e('0x25')](function(_0x5722ce){var _0x3b5f3e=_0x117ab6[_0xde3e('0x4d')][_0xde3e('0x27')]({'plain':!![]});if(!_0x3b5f3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b5f3e[_0xde3e('0x4e')]===_0xde3e('0x4d')){var _0x24acda=_0x5722ce[_0xde3e('0x27')]({'plain':!![]});var _0x341f73=_0xde3e('0x28');return db[_0xde3e('0x4f')][_0xde3e('0x4b')]({'where':{'name':_0x341f73,'userProfileId':_0x3b5f3e['userProfileId']},'raw':!![]})[_0xde3e('0x25')](function(_0x4f385c){if(_0x4f385c&&_0x4f385c[_0xde3e('0x50')]===0x0){return db[_0xde3e('0x29')][_0xde3e('0x51')]({'name':_0x24acda[_0xde3e('0x2b')],'resourceId':_0x24acda['id'],'type':_0x4f385c[_0xde3e('0x2b')],'sectionId':_0x4f385c['id']},{})[_0xde3e('0x25')](function(){return _0x5722ce;});}else{return _0x5722ce;}})['catch'](function(_0x3118fd){logger['error'](_0xde3e('0x52'),_0x3118fd);throw _0x3118fd;});}return _0x5722ce;})[_0xde3e('0x25')](respondWithResult(_0x66449d,0xc9))[_0xde3e('0x48')](handleError(_0x66449d,null));};exports['update']=function(_0x556025,_0x17ab23){if(_0x556025[_0xde3e('0x4c')]['id']){delete _0x556025[_0xde3e('0x4c')]['id'];}return db[_0xde3e('0x2d')][_0xde3e('0x4b')]({'where':{'id':_0x556025[_0xde3e('0x4a')]['id']}})[_0xde3e('0x25')](handleEntityNotFound(_0x17ab23,null))[_0xde3e('0x25')](saveUpdates(_0x556025[_0xde3e('0x4c')],null))[_0xde3e('0x25')](respondWithResult(_0x17ab23,null))[_0xde3e('0x48')](handleError(_0x17ab23,null));};exports['destroy']=function(_0x2083c7,_0x5d2fe4){return db[_0xde3e('0x2d')][_0xde3e('0x4b')]({'where':{'id':_0x2083c7[_0xde3e('0x4a')]['id']}})[_0xde3e('0x25')](handleEntityNotFound(_0x5d2fe4,null))['then'](removeEntity(_0x5d2fe4,null))[_0xde3e('0x48')](handleError(_0x5d2fe4,null));}; \ No newline at end of file +var _0x9585=['type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','VoiceChanSpy','findAll','catch','show','params','keys','find','create','body','user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','get','ChanSpies','stack','name','send','index','rawAttributes','fieldName'];(function(_0x4782fb,_0x378639){var _0x388653=function(_0x37faf2){while(--_0x37faf2){_0x4782fb['push'](_0x4782fb['shift']());}};_0x388653(++_0x378639);}(_0x9585,0x15e));var _0x5958=function(_0x43d2fb,_0x5264ad){_0x43d2fb=_0x43d2fb-0x0;var _0x25bb68=_0x9585[_0x43d2fb];return _0x25bb68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5958('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5958('0x1'));var rp=require(_0x5958('0x2'));var moment=require(_0x5958('0x3'));var BPromise=require(_0x5958('0x4'));var Mustache=require(_0x5958('0x5'));var util=require(_0x5958('0x6'));var path=require(_0x5958('0x7'));var sox=require(_0x5958('0x8'));var csv=require('to-csv');var ejs=require(_0x5958('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5958('0xa'));var squel=require(_0x5958('0xb'));var crypto=require(_0x5958('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5958('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5958('0xe'));var Papa=require(_0x5958('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5958('0x10'));var as=require(_0x5958('0x11'));var hardwareService=require(_0x5958('0x12'));var logger=require(_0x5958('0x13'))(_0x5958('0x14'));var utils=require('../../config/utils');var config=require(_0x5958('0x15'));var licenseUtil=require(_0x5958('0x16'));var db=require(_0x5958('0x17'))['db'];function respondWithStatusCode(_0x5040e5,_0x5d1c68){_0x5d1c68=_0x5d1c68||0xcc;return function(_0x4c298b){if(_0x4c298b){return _0x5040e5['sendStatus'](_0x5d1c68);}return _0x5040e5[_0x5958('0x18')](_0x5d1c68)[_0x5958('0x19')]();};}function respondWithResult(_0x2c5570,_0x4b8c0a){_0x4b8c0a=_0x4b8c0a||0xc8;return function(_0x3c5d2b){if(_0x3c5d2b){return _0x2c5570[_0x5958('0x18')](_0x4b8c0a)[_0x5958('0x1a')](_0x3c5d2b);}};}function respondWithFilteredResult(_0x254811,_0x4cb05c){return function(_0x37d01f){if(_0x37d01f){var _0x1d2805=typeof _0x4cb05c[_0x5958('0x1b')]===_0x5958('0x1c')&&typeof _0x4cb05c[_0x5958('0x1d')]===_0x5958('0x1c');var _0x5e9e97=_0x37d01f[_0x5958('0x1e')];var _0x7cd01c=_0x1d2805?0x0:_0x4cb05c[_0x5958('0x1b')];var _0x26c29d=_0x1d2805?_0x37d01f[_0x5958('0x1e')]:_0x4cb05c['offset']+_0x4cb05c[_0x5958('0x1d')];var _0x19000b;if(_0x26c29d>=_0x5e9e97){_0x26c29d=_0x5e9e97;_0x19000b=0xc8;}else{_0x19000b=0xce;}_0x254811[_0x5958('0x18')](_0x19000b);return _0x254811[_0x5958('0x1f')](_0x5958('0x20'),_0x7cd01c+'-'+_0x26c29d+'/'+_0x5e9e97)['json'](_0x37d01f);}return null;};}function patchUpdates(_0x22ddd7){return function(_0x4b9301){try{jsonpatch['apply'](_0x4b9301,_0x22ddd7,!![]);}catch(_0x220f33){return BPromise['reject'](_0x220f33);}return _0x4b9301[_0x5958('0x21')]();};}function saveUpdates(_0x40c4c4,_0x282c7a){return function(_0x36ff66){if(_0x36ff66){return _0x36ff66[_0x5958('0x22')](_0x40c4c4)['then'](function(_0x5a6789){return _0x5a6789;});}return null;};}function removeEntity(_0x5c5b8a,_0x154aa3){return function(_0x1f1a87){if(_0x1f1a87){return _0x1f1a87[_0x5958('0x23')]()[_0x5958('0x24')](function(){var _0x47f1df=_0x1f1a87[_0x5958('0x25')]({'plain':!![]});var _0x46888d=_0x5958('0x26');return db['UserProfileResource'][_0x5958('0x23')]({'where':{'type':_0x46888d,'resourceId':_0x47f1df['id']}})[_0x5958('0x24')](function(){return _0x1f1a87;});})[_0x5958('0x24')](function(){_0x5c5b8a[_0x5958('0x18')](0xcc)[_0x5958('0x19')]();});}};}function handleEntityNotFound(_0x2ca399,_0x3afb9e){return function(_0x54ab3c){if(!_0x54ab3c){_0x2ca399['sendStatus'](0x194);}return _0x54ab3c;};}function handleError(_0xb93ced,_0x3d28d6){_0x3d28d6=_0x3d28d6||0x1f4;return function(_0x45cd86){logger['error'](_0x45cd86[_0x5958('0x27')]);if(_0x45cd86[_0x5958('0x28')]){delete _0x45cd86[_0x5958('0x28')];}_0xb93ced[_0x5958('0x18')](_0x3d28d6)[_0x5958('0x29')](_0x45cd86);};}exports[_0x5958('0x2a')]=function(_0x2a020e,_0x579635){var _0x499b19={},_0x9725ce={},_0x1b65d3={'count':0x0,'rows':[]};var _0x1bcceb=_['map'](db['VoiceChanSpy'][_0x5958('0x2b')],function(_0x432326){return{'name':_0x432326[_0x5958('0x2c')],'type':_0x432326[_0x5958('0x2d')][_0x5958('0x2e')]};});_0x9725ce[_0x5958('0x2f')]=_[_0x5958('0x30')](_0x1bcceb,'name');_0x9725ce[_0x5958('0x31')]=_['keys'](_0x2a020e[_0x5958('0x31')]);_0x9725ce[_0x5958('0x32')]=_['intersection'](_0x9725ce['model'],_0x9725ce[_0x5958('0x31')]);_0x499b19[_0x5958('0x33')]=_[_0x5958('0x34')](_0x9725ce[_0x5958('0x2f')],qs[_0x5958('0x35')](_0x2a020e['query'][_0x5958('0x35')]));_0x499b19[_0x5958('0x33')]=_0x499b19[_0x5958('0x33')][_0x5958('0x36')]?_0x499b19[_0x5958('0x33')]:_0x9725ce[_0x5958('0x2f')];if(!_0x2a020e['query'][_0x5958('0x37')](_0x5958('0x38'))){_0x499b19[_0x5958('0x1d')]=qs[_0x5958('0x1d')](_0x2a020e['query']['limit']);_0x499b19[_0x5958('0x1b')]=qs[_0x5958('0x1b')](_0x2a020e['query'][_0x5958('0x1b')]);}_0x499b19[_0x5958('0x39')]=qs[_0x5958('0x3a')](_0x2a020e['query'][_0x5958('0x3a')]);_0x499b19[_0x5958('0x3b')]=qs[_0x5958('0x32')](_['pick'](_0x2a020e[_0x5958('0x31')],_0x9725ce[_0x5958('0x32')]),_0x1bcceb);if(_0x2a020e[_0x5958('0x31')][_0x5958('0x3c')]){_0x499b19[_0x5958('0x3b')]=_[_0x5958('0x3d')](_0x499b19[_0x5958('0x3b')],{'$or':_['map'](_0x1bcceb,function(_0x21a2b4){if(_0x21a2b4[_0x5958('0x2d')]!=='VIRTUAL'){var _0x4524c4={};_0x4524c4[_0x21a2b4['name']]={'$like':'%'+_0x2a020e[_0x5958('0x31')]['filter']+'%'};return _0x4524c4;}})});}_0x499b19=_[_0x5958('0x3d')]({},_0x499b19,_0x2a020e[_0x5958('0x3e')]);var _0x2b1b26={'where':_0x499b19[_0x5958('0x3b')]};return db['VoiceChanSpy'][_0x5958('0x1e')](_0x2b1b26)[_0x5958('0x24')](function(_0x57f528){_0x1b65d3[_0x5958('0x1e')]=_0x57f528;if(_0x2a020e['query'][_0x5958('0x3f')]){_0x499b19[_0x5958('0x40')]=[{'all':!![]}];}return db[_0x5958('0x41')][_0x5958('0x42')](_0x499b19);})[_0x5958('0x24')](function(_0x147712){_0x1b65d3['rows']=_0x147712;return _0x1b65d3;})[_0x5958('0x24')](respondWithFilteredResult(_0x579635,_0x499b19))[_0x5958('0x43')](handleError(_0x579635,null));};exports[_0x5958('0x44')]=function(_0x7cf813,_0x587f52){var _0x8495fb={'raw':![],'where':{'id':_0x7cf813[_0x5958('0x45')]['id']}},_0x54716f={};_0x54716f[_0x5958('0x2f')]=_['keys'](db[_0x5958('0x41')][_0x5958('0x2b')]);_0x54716f[_0x5958('0x31')]=_[_0x5958('0x46')](_0x7cf813[_0x5958('0x31')]);_0x54716f[_0x5958('0x32')]=_[_0x5958('0x34')](_0x54716f['model'],_0x54716f[_0x5958('0x31')]);_0x8495fb[_0x5958('0x33')]=_[_0x5958('0x34')](_0x54716f['model'],qs[_0x5958('0x35')](_0x7cf813[_0x5958('0x31')][_0x5958('0x35')]));_0x8495fb[_0x5958('0x33')]=_0x8495fb['attributes'][_0x5958('0x36')]?_0x8495fb[_0x5958('0x33')]:_0x54716f[_0x5958('0x2f')];if(_0x7cf813['query'][_0x5958('0x3f')]){_0x8495fb['include']=[{'all':!![]}];}_0x8495fb=_[_0x5958('0x3d')]({},_0x8495fb,_0x7cf813['options']);return db[_0x5958('0x41')][_0x5958('0x47')](_0x8495fb)[_0x5958('0x24')](handleEntityNotFound(_0x587f52,null))[_0x5958('0x24')](respondWithResult(_0x587f52,null))[_0x5958('0x43')](handleError(_0x587f52,null));};exports[_0x5958('0x48')]=function(_0x134dfa,_0x55d3b2){return db[_0x5958('0x41')][_0x5958('0x48')](_0x134dfa[_0x5958('0x49')],{})[_0x5958('0x24')](function(_0x3b5b4c){var _0x1e0704=_0x134dfa[_0x5958('0x4a')][_0x5958('0x25')]({'plain':!![]});if(!_0x1e0704)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e0704[_0x5958('0x4b')]===_0x5958('0x4a')){var _0x1627e6=_0x3b5b4c['get']({'plain':!![]});var _0x436a68=_0x5958('0x26');return db[_0x5958('0x4c')]['find']({'where':{'name':_0x436a68,'userProfileId':_0x1e0704['userProfileId']},'raw':!![]})[_0x5958('0x24')](function(_0x45ef69){if(_0x45ef69&&_0x45ef69['autoAssociation']===0x0){return db[_0x5958('0x4d')][_0x5958('0x48')]({'name':_0x1627e6[_0x5958('0x28')],'resourceId':_0x1627e6['id'],'type':_0x45ef69[_0x5958('0x28')],'sectionId':_0x45ef69['id']},{})[_0x5958('0x24')](function(){return _0x3b5b4c;});}else{return _0x3b5b4c;}})[_0x5958('0x43')](function(_0xcbbc39){logger['error'](_0x5958('0x4e'),_0xcbbc39);throw _0xcbbc39;});}return _0x3b5b4c;})[_0x5958('0x24')](respondWithResult(_0x55d3b2,0xc9))['catch'](handleError(_0x55d3b2,null));};exports[_0x5958('0x22')]=function(_0x579372,_0x5db20d){if(_0x579372[_0x5958('0x49')]['id']){delete _0x579372['body']['id'];}return db[_0x5958('0x41')]['find']({'where':{'id':_0x579372[_0x5958('0x45')]['id']}})[_0x5958('0x24')](handleEntityNotFound(_0x5db20d,null))[_0x5958('0x24')](saveUpdates(_0x579372[_0x5958('0x49')],null))[_0x5958('0x24')](respondWithResult(_0x5db20d,null))['catch'](handleError(_0x5db20d,null));};exports[_0x5958('0x23')]=function(_0x2991c6,_0x57185b){return db[_0x5958('0x41')][_0x5958('0x47')]({'where':{'id':_0x2991c6[_0x5958('0x45')]['id']}})['then'](handleEntityNotFound(_0x57185b,null))[_0x5958('0x24')](removeEntity(_0x57185b,null))[_0x5958('0x43')](handleError(_0x57185b,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index edb25d8..05473d1 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 _0xba05=['User','findAll','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','context','format','%s%s','prefix','system','push','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','internal','concat'];(function(_0x3a088a,_0xe58af4){var _0xfa6837=function(_0x1ea5a5){while(--_0x1ea5a5){_0x3a088a['push'](_0x3a088a['shift']());}};_0xfa6837(++_0xe58af4);}(_0xba05,0x146));var _0x5ba0=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xba05[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x5ba0('0x0'));var util=require(_0x5ba0('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x42dcf2,_0x2ddc46,_0x3a6c1c){var _0x334aef=0x1;var _0x2385ac=[];var _0x4386f0={'context':_0x2ddc46[_0x5ba0('0x2')]||'from-sip','exten':util[_0x5ba0('0x3')](_0x5ba0('0x4'),_0x42dcf2[_0x5ba0('0x5')],_0x3a6c1c),'type':_0x5ba0('0x6'),'isApp':![],'ChanSpyId':_0x42dcf2['id'],'UserId':_0x2ddc46['id']};_0x2385ac[_0x5ba0('0x7')](_['merge']({'app':'Set','appdata':util[_0x5ba0('0x3')](_0x5ba0('0x8'),_0x5ba0('0x9')),'priority':_0x334aef++},_0x4386f0));if(_0x42dcf2[_0x5ba0('0xa')]){_0x2385ac['push'](_[_0x5ba0('0xb')]({'app':_0x5ba0('0xc'),'appdata':util['format'](_0x5ba0('0xd'),_0x42dcf2['recordingFormat']),'priority':_0x334aef++},_0x4386f0));}if(_0x42dcf2[_0x5ba0('0xe')]){_0x2385ac[_0x5ba0('0x7')](_[_0x5ba0('0xb')]({'app':'Authenticate','appdata':_0x42dcf2[_0x5ba0('0xf')],'priority':_0x334aef++},_0x4386f0));}_0x2385ac[_0x5ba0('0x7')](_[_0x5ba0('0xb')]({'app':_0x5ba0('0x10'),'appdata':util[_0x5ba0('0x3')](_0x5ba0('0x11'),_0x2ddc46[_0x5ba0('0x12')],_0x42dcf2[_0x5ba0('0x13')]?_0x42dcf2[_0x5ba0('0x13')][_0x5ba0('0x14')](''):''),'priority':_0x334aef++},_0x4386f0));if(_0x42dcf2[_0x5ba0('0xa')]){_0x2385ac['push'](_['merge']({'app':'StopMixMonitor','priority':_0x334aef++},_0x4386f0));}return _0x2385ac;};var getChanSpyApplications=function(_0x592dbf,_0x157308){var _0x191fb7=[];for(var _0x463e5c=0x0,_0x339abe=0x1;_0x463e5c<_0x157308[_0x5ba0('0x15')];_0x463e5c++,_0x339abe=0x1){_0x191fb7=_0x191fb7['concat'](getUserApplications(_0x592dbf,_0x157308[_0x463e5c],_0x157308[_0x463e5c][_0x5ba0('0x16')]));if(_0x157308[_0x463e5c][_0x5ba0('0x16')]!=_0x157308[_0x463e5c]['name']){_0x191fb7=_0x191fb7[_0x5ba0('0x17')](getUserApplications(_0x592dbf,_0x157308[_0x463e5c],_0x157308[_0x463e5c]['name']));}}return _0x191fb7;};var getChanSpyPromise=function(_0x59c5fe,_0x483e46){return new BPromise(function(_0x5081d5,_0x8da865){return _0x59c5fe[_0x5ba0('0x18')][_0x5ba0('0x19')]({'attributes':['id',_0x5ba0('0x12'),_0x5ba0('0x16')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x5ba0('0x1a')](function(_0x6bc9a3){if(_0x6bc9a3){return _0x5081d5(getChanSpyApplications(_0x483e46,_0x6bc9a3));}return _0x5081d5([]);})[_0x5ba0('0x1b')](function(_0x13acc1){_0x8da865(_0x13acc1);});});};module['exports']=function(_0x5133dc,_0x1a64af){var _0x1389c7=_0x5133dc[_0x5ba0('0x1c')];return _0x5133dc[_0x5ba0('0x1d')](_0x5ba0('0x1e'),attributes,{'tableName':_0x5ba0('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x50d50f,_0x496ff7,_0x192d36){return getChanSpyPromise(_0x1389c7,_0x50d50f)[_0x5ba0('0x1a')](function(_0x3a2106){if(_0x3a2106&&_0x3a2106['length']){return _0x1389c7[_0x5ba0('0x20')][_0x5ba0('0x21')](_0x3a2106);}})[_0x5ba0('0x1a')](function(){_0x192d36();})[_0x5ba0('0x1b')](function(_0x2b7ac4){_0x192d36(_0x2b7ac4);});},'afterUpdate':function(_0x1d6654,_0x3fe31,_0x1636c3){return _0x1389c7[_0x5ba0('0x20')][_0x5ba0('0x22')]({'where':{'ChanSpyId':_0x1d6654['id']}})[_0x5ba0('0x1a')](function(){return getChanSpyPromise(_0x1389c7,_0x1d6654);})['then'](function(_0x539d03){if(_0x539d03&&_0x539d03[_0x5ba0('0x15')]){return _0x1389c7[_0x5ba0('0x20')]['bulkCreate'](_0x539d03);}})[_0x5ba0('0x1a')](function(){_0x1636c3();})[_0x5ba0('0x1b')](function(_0x660420){_0x1636c3(_0x660420);});},'afterDestroy':function(_0x45f167,_0x433222,_0x5d7129){return _0x1389c7['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x45f167['id']}})[_0x5ba0('0x1a')](function(){_0x5d7129();})[_0x5ba0('0x1b')](function(_0x49f7b2){_0x5d7129(_0x49f7b2);});}}});}; \ No newline at end of file +var _0x32d0=['util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','User','findAll','agent','then','models','VoiceChanSpy','bulkCreate','catch','VoiceExtension','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x32d0,0x71));var _0x032d=function(_0x477544,_0x517931){_0x477544=_0x477544-0x0;var _0x28a4b9=_0x32d0[_0x477544];return _0x28a4b9;};'use strict';var _=require(_0x032d('0x0'));var util=require(_0x032d('0x1'));var BPromise=require(_0x032d('0x2'));var attributes=require(_0x032d('0x3'));var getUserApplications=function(_0x383245,_0x5e0506,_0x5bb867){var _0xaf21db=0x1;var _0x5a734b=[];var _0x2a3ad4={'context':_0x5e0506[_0x032d('0x4')]||_0x032d('0x5'),'exten':util[_0x032d('0x6')](_0x032d('0x7'),_0x383245[_0x032d('0x8')],_0x5bb867),'type':_0x032d('0x9'),'isApp':![],'ChanSpyId':_0x383245['id'],'UserId':_0x5e0506['id']};_0x5a734b[_0x032d('0xa')](_[_0x032d('0xb')]({'app':_0x032d('0xc'),'appdata':util[_0x032d('0x6')](_0x032d('0xd'),_0x032d('0xe')),'priority':_0xaf21db++},_0x2a3ad4));if(_0x383245[_0x032d('0xf')]){_0x5a734b['push'](_[_0x032d('0xb')]({'app':_0x032d('0x10'),'appdata':util[_0x032d('0x6')](_0x032d('0x11'),_0x383245[_0x032d('0x12')]),'priority':_0xaf21db++},_0x2a3ad4));}if(_0x383245[_0x032d('0x13')]){_0x5a734b[_0x032d('0xa')](_[_0x032d('0xb')]({'app':_0x032d('0x14'),'appdata':_0x383245['password'],'priority':_0xaf21db++},_0x2a3ad4));}_0x5a734b[_0x032d('0xa')](_[_0x032d('0xb')]({'app':_0x032d('0x15'),'appdata':util[_0x032d('0x6')](_0x032d('0x16'),_0x5e0506[_0x032d('0x17')],_0x383245[_0x032d('0x18')]?_0x383245['options']['join'](''):''),'priority':_0xaf21db++},_0x2a3ad4));if(_0x383245['record']){_0x5a734b[_0x032d('0xa')](_[_0x032d('0xb')]({'app':_0x032d('0x19'),'priority':_0xaf21db++},_0x2a3ad4));}return _0x5a734b;};var getChanSpyApplications=function(_0x53b067,_0x805034){var _0x1eea83=[];for(var _0x246faa=0x0,_0x22f4aa=0x1;_0x246faa<_0x805034[_0x032d('0x1a')];_0x246faa++,_0x22f4aa=0x1){_0x1eea83=_0x1eea83[_0x032d('0x1b')](getUserApplications(_0x53b067,_0x805034[_0x246faa],_0x805034[_0x246faa]['internal']));if(_0x805034[_0x246faa][_0x032d('0x1c')]!=_0x805034[_0x246faa][_0x032d('0x17')]){_0x1eea83=_0x1eea83[_0x032d('0x1b')](getUserApplications(_0x53b067,_0x805034[_0x246faa],_0x805034[_0x246faa][_0x032d('0x17')]));}}return _0x1eea83;};var getChanSpyPromise=function(_0x54dd0d,_0x48399b){return new BPromise(function(_0x277a3c,_0x3848b4){return _0x54dd0d[_0x032d('0x1d')][_0x032d('0x1e')]({'attributes':['id',_0x032d('0x17'),_0x032d('0x1c')],'where':{'role':_0x032d('0x1f'),'chanspy':!![]},'raw':!![]})[_0x032d('0x20')](function(_0x52ba13){if(_0x52ba13){return _0x277a3c(getChanSpyApplications(_0x48399b,_0x52ba13));}return _0x277a3c([]);})['catch'](function(_0x443d2e){_0x3848b4(_0x443d2e);});});};module['exports']=function(_0x2f8d15,_0x56f965){var _0x120701=_0x2f8d15[_0x032d('0x21')];return _0x2f8d15['define'](_0x032d('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x309063,_0x308182,_0x5a1aca){return getChanSpyPromise(_0x120701,_0x309063)['then'](function(_0x44828b){if(_0x44828b&&_0x44828b[_0x032d('0x1a')]){return _0x120701['VoiceExtension'][_0x032d('0x23')](_0x44828b);}})[_0x032d('0x20')](function(){_0x5a1aca();})[_0x032d('0x24')](function(_0x3f265c){_0x5a1aca(_0x3f265c);});},'afterUpdate':function(_0x7d18ca,_0x336d11,_0x2e16e6){return _0x120701['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x7d18ca['id']}})['then'](function(){return getChanSpyPromise(_0x120701,_0x7d18ca);})['then'](function(_0x3c3d8d){if(_0x3c3d8d&&_0x3c3d8d[_0x032d('0x1a')]){return _0x120701[_0x032d('0x25')][_0x032d('0x23')](_0x3c3d8d);}})['then'](function(){_0x2e16e6();})[_0x032d('0x24')](function(_0x211bff){_0x2e16e6(_0x211bff);});},'afterDestroy':function(_0x5deb0b,_0x224abf,_0x5a1365){return _0x120701[_0x032d('0x25')]['destroy']({'where':{'ChanSpyId':_0x5deb0b['id']}})[_0x032d('0x20')](function(){_0x5a1365();})[_0x032d('0x24')](function(_0x2f8573){_0x5a1365(_0x2f8573);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8560531..c4bf317 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 _0x2750=['jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x7be637,_0x45395e){var _0x51decd=function(_0x43bb8d){while(--_0x43bb8d){_0x7be637['push'](_0x7be637['shift']());}};_0x51decd(++_0x45395e);}(_0x2750,0x13b));var _0x0275=function(_0x516346,_0x45d4a6){_0x516346=_0x516346-0x0;var _0x22f625=_0x2750[_0x516346];return _0x22f625;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file +var _0x76dc=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x4b1c8a,_0x228d80){var _0x46ed6e=function(_0x3c00a1){while(--_0x3c00a1){_0x4b1c8a['push'](_0x4b1c8a['shift']());}};_0x46ed6e(++_0x228d80);}(_0x76dc,0x1f2));var _0xc76d=function(_0xf8e1eb,_0x4acf3e){_0xf8e1eb=_0xf8e1eb-0x0;var _0x2c6c22=_0x76dc[_0xf8e1eb];return _0x2c6c22;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76d('0x4'));var db=require(_0xc76d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc76d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc76d('0x7'));var client=jayson[_0xc76d('0x8')][_0xc76d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4832bd,_0x4ce0bd,_0x119f38){return new BPromise(function(_0x114572,_0x18574f){return client['request'](_0x4832bd,_0x119f38)['then'](function(_0x1dc996){logger[_0xc76d('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ce0bd,_0xc76d('0xb'));logger['debug'](_0xc76d('0xc'),_0x4ce0bd,_0xc76d('0xb'),JSON[_0xc76d('0xd')](_0x1dc996));if(_0x1dc996[_0xc76d('0xe')]){if(_0x1dc996[_0xc76d('0xe')][_0xc76d('0xf')]===0x1f4){logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);return _0x18574f(_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);}logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996['error'][_0xc76d('0x11')]);return _0x114572(_0x1dc996[_0xc76d('0xe')]['message']);}else{logger[_0xc76d('0xa')](_0xc76d('0x10'),_0x4ce0bd,_0xc76d('0xb'));_0x114572(_0x1dc996[_0xc76d('0x12')]['message']);}})[_0xc76d('0x13')](function(_0x5d881c){logger['error'](_0xc76d('0x10'),_0x4ce0bd,_0x5d881c);_0x18574f(_0x5d881c);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 5013243..fbaa44f 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 _0xd626=['/:id','isAuthenticated','show','put','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd626,0xd9));var _0x6d62=function(_0x5e8cb9,_0x2b5224){_0x5e8cb9=_0x5e8cb9-0x0;var _0x2c1db8=_0xd626[_0x5e8cb9];return _0x2c1db8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6d62('0x0'));var express=require(_0x6d62('0x1'));var router=express[_0x6d62('0x2')]();var fs_extra=require(_0x6d62('0x3'));var auth=require(_0x6d62('0x4'));var interaction=require(_0x6d62('0x5'));var config=require('../../config/environment');var controller=require(_0x6d62('0x6'));router[_0x6d62('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6d62('0x7')](_0x6d62('0x8'),auth[_0x6d62('0x9')](),controller[_0x6d62('0xa')]);router['post']('/',auth[_0x6d62('0x9')](),controller['create']);router[_0x6d62('0xb')]('/:id',auth[_0x6d62('0x9')](),controller['update']);router[_0x6d62('0xc')](_0x6d62('0x8'),auth[_0x6d62('0x9')](),controller[_0x6d62('0xd')]);module[_0x6d62('0xe')]=router; \ No newline at end of file +var _0x4d50=['delete','destroy','exports','util','path','fs-extra','../../components/auth/service','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0xc5f6df,_0x553b26){var _0x4455a9=function(_0x6e8d8c){while(--_0x6e8d8c){_0xc5f6df['push'](_0xc5f6df['shift']());}};_0x4455a9(++_0x553b26);}(_0x4d50,0x1ac));var _0x04d5=function(_0x527ea7,_0x92232){_0x527ea7=_0x527ea7-0x0;var _0x1b3913=_0x4d50[_0x527ea7];return _0x1b3913;};'use strict';var multer=require('multer');var util=require(_0x04d5('0x0'));var path=require(_0x04d5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x04d5('0x2'));var auth=require(_0x04d5('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04d5('0x4'));router['get']('/',auth[_0x04d5('0x5')](),controller[_0x04d5('0x6')]);router[_0x04d5('0x7')](_0x04d5('0x8'),auth[_0x04d5('0x5')](),controller[_0x04d5('0x9')]);router[_0x04d5('0xa')]('/',auth[_0x04d5('0x5')](),controller[_0x04d5('0xb')]);router[_0x04d5('0xc')](_0x04d5('0x8'),auth[_0x04d5('0x5')](),controller[_0x04d5('0xd')]);router[_0x04d5('0xe')](_0x04d5('0x8'),auth['isAuthenticated'](),controller[_0x04d5('0xf')]);module[_0x04d5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index adb82db..31639d3 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 _0xb6b1=['name','sequelize','exports'];(function(_0x5d73c2,_0x52f48c){var _0x3ce2df=function(_0x4f42fc){while(--_0x4f42fc){_0x5d73c2['push'](_0x5d73c2['shift']());}};_0x3ce2df(++_0x52f48c);}(_0xb6b1,0x1ba));var _0x1b6b=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xb6b1[_0x946518];return _0x909b69;};'use strict';var Sequelize=require(_0x1b6b('0x0'));module[_0x1b6b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1b6b('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe287=['sequelize','exports','STRING','BOOLEAN'];(function(_0x526280,_0x586685){var _0x468a76=function(_0x1c4e1b){while(--_0x1c4e1b){_0x526280['push'](_0x526280['shift']());}};_0x468a76(++_0x586685);}(_0xe287,0x198));var _0x7e28=function(_0x19ca39,_0x467bab){_0x19ca39=_0x19ca39-0x0;var _0x4fa034=_0xe287[_0x19ca39];return _0x4fa034;};'use strict';var Sequelize=require(_0x7e28('0x0'));module[_0x7e28('0x1')]={'name':{'type':Sequelize[_0x7e28('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x7e28('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7e28('0x3')],'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 1c877b0..792bde7 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 _0x7551=['../../mysqldb','jayson/promise','client','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','Contexts','stack','name','send','index','map','VoiceContext','fieldName','type','key','keys','query','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x44bf1d,_0x45ca7c){var _0x48b495=function(_0x5be678){while(--_0x5be678){_0x44bf1d['push'](_0x44bf1d['shift']());}};_0x48b495(++_0x45ca7c);}(_0x7551,0xb8));var _0x1755=function(_0x5e0ee5,_0x21d640){_0x5e0ee5=_0x5e0ee5-0x0;var _0x111937=_0x7551[_0x5e0ee5];return _0x111937;};'use strict';var emlformat=require(_0x1755('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1755('0x1'));var moment=require(_0x1755('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1755('0x3'));var util=require(_0x1755('0x4'));var path=require(_0x1755('0x5'));var sox=require(_0x1755('0x6'));var csv=require(_0x1755('0x7'));var ejs=require(_0x1755('0x8'));var fs=require('fs');var fs_extra=require(_0x1755('0x9'));var _=require(_0x1755('0xa'));var squel=require(_0x1755('0xb'));var crypto=require('crypto');var jsforce=require(_0x1755('0xc'));var deskjs=require(_0x1755('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1755('0xe'));var authService=require(_0x1755('0xf'));var qs=require(_0x1755('0x10'));var as=require(_0x1755('0x11'));var hardwareService=require(_0x1755('0x12'));var logger=require(_0x1755('0x13'))(_0x1755('0x14'));var utils=require(_0x1755('0x15'));var config=require(_0x1755('0x16'));var licenseUtil=require(_0x1755('0x17'));var db=require(_0x1755('0x18'))['db'];var jayson=require(_0x1755('0x19'));var client=jayson[_0x1755('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cf0cd,_0x46dd11,_0x5361e6,_0x2bc67d){return new BPromise(function(_0x3d387b,_0x3669b4){var _0x125dce=_0x2bc67d||client;return _0x125dce['request'](_0x1cf0cd,_0x5361e6)['then'](function(_0xc030cb){logger[_0x1755('0x1b')](_0x1755('0x1c'),_0x46dd11,_0x1755('0x1d'));logger[_0x1755('0x1e')](_0x1755('0x1f'),_0x46dd11,_0x1755('0x1d'),JSON[_0x1755('0x20')](_0xc030cb));if(_0xc030cb['error']){if(_0xc030cb[_0x1755('0x21')]['code']===0x1f4){logger[_0x1755('0x21')]('VoiceContext,\x20%s,\x20%s',_0x46dd11,_0xc030cb['error'][_0x1755('0x22')]);return _0x3669b4(_0xc030cb['error']['message']);}logger[_0x1755('0x21')](_0x1755('0x1c'),_0x46dd11,_0xc030cb[_0x1755('0x21')][_0x1755('0x22')]);return _0x3d387b(_0xc030cb['error'][_0x1755('0x22')]);}else{logger[_0x1755('0x1b')](_0x1755('0x1c'),_0x46dd11,_0x1755('0x1d'));_0x3d387b(_0xc030cb['result'][_0x1755('0x22')]);}})['catch'](function(_0x495a06){logger[_0x1755('0x21')](_0x1755('0x1c'),_0x46dd11,_0x495a06);_0x3669b4(_0x495a06);});});}function respondWithStatusCode(_0x33fceb,_0x3b1d52){_0x3b1d52=_0x3b1d52||0xcc;return function(_0xe55383){if(_0xe55383){return _0x33fceb[_0x1755('0x23')](_0x3b1d52);}return _0x33fceb['status'](_0x3b1d52)[_0x1755('0x24')]();};}function respondWithResult(_0x43c545,_0x41fa35){_0x41fa35=_0x41fa35||0xc8;return function(_0x10170b){if(_0x10170b){return _0x43c545[_0x1755('0x25')](_0x41fa35)[_0x1755('0x26')](_0x10170b);}};}function respondWithFilteredResult(_0x2d63f1,_0x5ea834){return function(_0x41ea64){if(_0x41ea64){var _0x5eb90e=typeof _0x5ea834['offset']===_0x1755('0x27')&&typeof _0x5ea834[_0x1755('0x28')]===_0x1755('0x27');var _0x447717=_0x41ea64[_0x1755('0x29')];var _0x5847ac=_0x5eb90e?0x0:_0x5ea834[_0x1755('0x2a')];var _0x3a1c47=_0x5eb90e?_0x41ea64[_0x1755('0x29')]:_0x5ea834[_0x1755('0x2a')]+_0x5ea834['limit'];var _0x530061;if(_0x3a1c47>=_0x447717){_0x3a1c47=_0x447717;_0x530061=0xc8;}else{_0x530061=0xce;}_0x2d63f1['status'](_0x530061);return _0x2d63f1[_0x1755('0x2b')]('Content-Range',_0x5847ac+'-'+_0x3a1c47+'/'+_0x447717)[_0x1755('0x26')](_0x41ea64);}return null;};}function patchUpdates(_0x3ea32b){return function(_0xf7bc5){try{jsonpatch[_0x1755('0x2c')](_0xf7bc5,_0x3ea32b,!![]);}catch(_0x97d9f4){return BPromise[_0x1755('0x2d')](_0x97d9f4);}return _0xf7bc5['save']();};}function saveUpdates(_0x381f1e,_0x289566){return function(_0x278771){if(_0x278771){return _0x278771[_0x1755('0x2e')](_0x381f1e)[_0x1755('0x2f')](function(_0x816446){return _0x816446;});}return null;};}function removeEntity(_0x43ddb4,_0x4351a6){return function(_0x231131){if(_0x231131){return _0x231131[_0x1755('0x30')]()[_0x1755('0x2f')](function(){var _0x1659f8=_0x231131[_0x1755('0x31')]({'plain':!![]});var _0x53af43=_0x1755('0x32');return db['UserProfileResource']['destroy']({'where':{'type':_0x53af43,'resourceId':_0x1659f8['id']}})['then'](function(){return _0x231131;});})[_0x1755('0x2f')](function(){_0x43ddb4['status'](0xcc)[_0x1755('0x24')]();});}};}function handleEntityNotFound(_0x509506,_0x156128){return function(_0x291135){if(!_0x291135){_0x509506[_0x1755('0x23')](0x194);}return _0x291135;};}function handleError(_0x495300,_0x4de514){_0x4de514=_0x4de514||0x1f4;return function(_0xde8ed6){logger[_0x1755('0x21')](_0xde8ed6[_0x1755('0x33')]);if(_0xde8ed6[_0x1755('0x34')]){delete _0xde8ed6[_0x1755('0x34')];}_0x495300[_0x1755('0x25')](_0x4de514)[_0x1755('0x35')](_0xde8ed6);};}exports[_0x1755('0x36')]=function(_0x442dde,_0x4c2146){var _0x3b2b3c={},_0x44b86b={},_0xb0fc85={'count':0x0,'rows':[]};var _0x3a313a=_[_0x1755('0x37')](db[_0x1755('0x38')]['rawAttributes'],function(_0x12a939){return{'name':_0x12a939[_0x1755('0x39')],'type':_0x12a939[_0x1755('0x3a')][_0x1755('0x3b')]};});_0x44b86b['model']=_[_0x1755('0x37')](_0x3a313a,_0x1755('0x34'));_0x44b86b['query']=_[_0x1755('0x3c')](_0x442dde[_0x1755('0x3d')]);_0x44b86b['filters']=_['intersection'](_0x44b86b['model'],_0x44b86b[_0x1755('0x3d')]);_0x3b2b3c[_0x1755('0x3e')]=_[_0x1755('0x3f')](_0x44b86b[_0x1755('0x40')],qs['fields'](_0x442dde[_0x1755('0x3d')][_0x1755('0x41')]));_0x3b2b3c[_0x1755('0x3e')]=_0x3b2b3c[_0x1755('0x3e')]['length']?_0x3b2b3c['attributes']:_0x44b86b[_0x1755('0x40')];if(!_0x442dde['query'][_0x1755('0x42')](_0x1755('0x43'))){_0x3b2b3c['limit']=qs[_0x1755('0x28')](_0x442dde[_0x1755('0x3d')]['limit']);_0x3b2b3c[_0x1755('0x2a')]=qs[_0x1755('0x2a')](_0x442dde[_0x1755('0x3d')][_0x1755('0x2a')]);}_0x3b2b3c['order']=qs[_0x1755('0x44')](_0x442dde[_0x1755('0x3d')]['sort']);_0x3b2b3c[_0x1755('0x45')]=qs[_0x1755('0x46')](_[_0x1755('0x47')](_0x442dde['query'],_0x44b86b[_0x1755('0x46')]),_0x3a313a);if(_0x442dde['query'][_0x1755('0x48')]){_0x3b2b3c[_0x1755('0x45')]=_[_0x1755('0x49')](_0x3b2b3c[_0x1755('0x45')],{'$or':_[_0x1755('0x37')](_0x3a313a,function(_0x2d7b82){if(_0x2d7b82[_0x1755('0x3a')]!==_0x1755('0x4a')){var _0x4e3e0d={};_0x4e3e0d[_0x2d7b82[_0x1755('0x34')]]={'$like':'%'+_0x442dde[_0x1755('0x3d')]['filter']+'%'};return _0x4e3e0d;}})});}_0x3b2b3c=_[_0x1755('0x49')]({},_0x3b2b3c,_0x442dde['options']);var _0x13ab27={'where':_0x3b2b3c[_0x1755('0x45')]};return db['VoiceContext'][_0x1755('0x29')](_0x13ab27)[_0x1755('0x2f')](function(_0x278bd7){_0xb0fc85['count']=_0x278bd7;if(_0x442dde[_0x1755('0x3d')][_0x1755('0x4b')]){_0x3b2b3c[_0x1755('0x4c')]=[{'all':!![]}];}return db['VoiceContext'][_0x1755('0x4d')](_0x3b2b3c);})[_0x1755('0x2f')](function(_0x18fde9){_0xb0fc85[_0x1755('0x4e')]=_0x18fde9;return _0xb0fc85;})[_0x1755('0x2f')](respondWithFilteredResult(_0x4c2146,_0x3b2b3c))[_0x1755('0x4f')](handleError(_0x4c2146,null));};exports[_0x1755('0x50')]=function(_0x15088b,_0x8b2b70){var _0x26cc6e={'raw':![],'where':{'id':_0x15088b[_0x1755('0x51')]['id']}},_0x3725b8={};_0x3725b8['model']=_[_0x1755('0x3c')](db[_0x1755('0x38')][_0x1755('0x52')]);_0x3725b8['query']=_[_0x1755('0x3c')](_0x15088b['query']);_0x3725b8[_0x1755('0x46')]=_[_0x1755('0x3f')](_0x3725b8['model'],_0x3725b8[_0x1755('0x3d')]);_0x26cc6e[_0x1755('0x3e')]=_[_0x1755('0x3f')](_0x3725b8['model'],qs[_0x1755('0x41')](_0x15088b[_0x1755('0x3d')][_0x1755('0x41')]));_0x26cc6e[_0x1755('0x3e')]=_0x26cc6e[_0x1755('0x3e')]['length']?_0x26cc6e[_0x1755('0x3e')]:_0x3725b8['model'];if(_0x15088b['query'][_0x1755('0x4b')]){_0x26cc6e[_0x1755('0x4c')]=[{'all':!![]}];}_0x26cc6e=_[_0x1755('0x49')]({},_0x26cc6e,_0x15088b['options']);return db[_0x1755('0x38')][_0x1755('0x53')](_0x26cc6e)[_0x1755('0x2f')](handleEntityNotFound(_0x8b2b70,null))[_0x1755('0x2f')](respondWithResult(_0x8b2b70,null))['catch'](handleError(_0x8b2b70,null));};exports['create']=function(_0x5c4959,_0x5e570b,_0x3768c9){var _0x4e52e5;return db[_0x1755('0x38')][_0x1755('0x54')](_0x5c4959[_0x1755('0x55')],{'raw':!![]})[_0x1755('0x2f')](function(_0x940cd8){_0x4e52e5=_0x940cd8;return db[_0x1755('0x38')]['findAll']({'raw':!![]});})[_0x1755('0x2f')](function(_0x4048f9){var _0x198093=fs[_0x1755('0x56')](path[_0x1755('0x57')](config[_0x1755('0x58')],_0x1755('0x59')),_0x1755('0x5a'));var _0x8909b=ejs[_0x1755('0x5b')](_0x198093,{'contexts':_0x4048f9||[]});fs[_0x1755('0x5c')](_0x1755('0x5d'),_0x8909b);})[_0x1755('0x2f')](function(){return respondWithRpcPromise(_0x1755('0x5e'),_0x1755('0x54'),{'module':_0x1755('0x5f')});})['then'](function(){var _0x1a6ae3=_0x5c4959[_0x1755('0x60')][_0x1755('0x31')]({'plain':!![]});if(!_0x1a6ae3)throw new Error(_0x1755('0x61'));if(_0x1a6ae3[_0x1755('0x62')]==='user'){var _0x5a7781=_0x4e52e5[_0x1755('0x31')]({'plain':!![]});return db[_0x1755('0x63')][_0x1755('0x53')]({'where':{'name':_0x1755('0x32'),'userProfileId':_0x1a6ae3[_0x1755('0x64')]},'raw':!![]})['then'](function(_0x396d9a){if(_0x396d9a&&_0x396d9a[_0x1755('0x65')]===0x0){return db[_0x1755('0x66')][_0x1755('0x54')]({'name':_0x5a7781[_0x1755('0x34')],'resourceId':_0x5a7781['id'],'type':_0x396d9a[_0x1755('0x34')],'sectionId':_0x396d9a['id']},{})[_0x1755('0x2f')](function(){return _0x4e52e5;});}else{return _0x4e52e5;}})[_0x1755('0x4f')](function(_0x595d4e){logger['error'](_0x1755('0x67'),_0x595d4e);throw _0x595d4e;});}return _0x4e52e5;})['then'](respondWithResult(_0x5e570b,0xc9))[_0x1755('0x4f')](handleError(_0x5e570b,null));};exports[_0x1755('0x2e')]=function(_0x51ce37,_0xd0342c,_0x3e9fbe){var _0x321d49;return db['VoiceContext'][_0x1755('0x53')]({'where':{'id':_0x51ce37['params']['id']}})[_0x1755('0x2f')](handleEntityNotFound(_0xd0342c,null))[_0x1755('0x2f')](saveUpdates(_0x51ce37['body'],null))['then'](function(_0x1703e0){if(_0x1703e0){_0x321d49=_0x1703e0;return db[_0x1755('0x38')][_0x1755('0x4d')]({'raw':!![]});}})[_0x1755('0x2f')](function(_0x13de71){var _0xf190e=fs[_0x1755('0x56')](path[_0x1755('0x57')](config['root'],_0x1755('0x59')),'utf8');var _0x2b2c8d=ejs[_0x1755('0x5b')](_0xf190e,{'contexts':_0x13de71||[]});fs[_0x1755('0x5c')](_0x1755('0x5d'),_0x2b2c8d);})[_0x1755('0x2f')](function(){return respondWithRpcPromise('Reload',_0x1755('0x2e'),{'module':_0x1755('0x5f')});})['then'](function(){return _0x321d49;})[_0x1755('0x2f')](respondWithResult(_0xd0342c,null))[_0x1755('0x4f')](handleError(_0xd0342c,null));};exports[_0x1755('0x30')]=function(_0x4ef8a3,_0x236a90,_0x1447ea){var _0x3bc66a;return db[_0x1755('0x38')][_0x1755('0x53')]({'where':{'id':_0x4ef8a3['params']['id']}})[_0x1755('0x2f')](handleEntityNotFound(_0x236a90,null))[_0x1755('0x2f')](removeEntity(_0x236a90,null))[_0x1755('0x2f')](function(){return db[_0x1755('0x38')][_0x1755('0x4d')]({'raw':!![]});})[_0x1755('0x2f')](function(_0x3a67af){var _0x204f6f=fs['readFileSync'](path['join'](config[_0x1755('0x58')],_0x1755('0x59')),'utf8');var _0x3b9ae3=ejs[_0x1755('0x5b')](_0x204f6f,{'contexts':_0x3a67af});fs[_0x1755('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3b9ae3);return respondWithRpcPromise(_0x1755('0x5e'),_0x1755('0x30'),{'module':_0x1755('0x5f')});})[_0x1755('0x4f')](handleError(_0x236a90,null));}; \ No newline at end of file +var _0xab8a=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','UserProfileSection','userProfileId','UserProfileResource','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','Contexts','stack','name','send','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection','fields'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xab8a,0xfa));var _0xaab8=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xab8a[_0x220f3f];return _0x1f170e;};'use strict';var emlformat=require(_0xaab8('0x0'));var rimraf=require(_0xaab8('0x1'));var zipdir=require(_0xaab8('0x2'));var jsonpatch=require(_0xaab8('0x3'));var rp=require(_0xaab8('0x4'));var moment=require(_0xaab8('0x5'));var BPromise=require(_0xaab8('0x6'));var Mustache=require(_0xaab8('0x7'));var util=require(_0xaab8('0x8'));var path=require(_0xaab8('0x9'));var sox=require(_0xaab8('0xa'));var csv=require(_0xaab8('0xb'));var ejs=require(_0xaab8('0xc'));var fs=require('fs');var fs_extra=require(_0xaab8('0xd'));var _=require(_0xaab8('0xe'));var squel=require(_0xaab8('0xf'));var crypto=require(_0xaab8('0x10'));var jsforce=require(_0xaab8('0x11'));var deskjs=require(_0xaab8('0x12'));var toCsv=require(_0xaab8('0xb'));var querystring=require(_0xaab8('0x13'));var Papa=require('papaparse');var Redis=require(_0xaab8('0x14'));var authService=require(_0xaab8('0x15'));var qs=require(_0xaab8('0x16'));var as=require(_0xaab8('0x17'));var hardwareService=require(_0xaab8('0x18'));var logger=require(_0xaab8('0x19'))(_0xaab8('0x1a'));var utils=require(_0xaab8('0x1b'));var config=require(_0xaab8('0x1c'));var licenseUtil=require(_0xaab8('0x1d'));var db=require('../../mysqldb')['db'];var jayson=require(_0xaab8('0x1e'));var client=jayson[_0xaab8('0x1f')][_0xaab8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x51b2cc,_0x1e7f6f,_0x5cf8e0,_0x4aa98c){return new BPromise(function(_0x189c86,_0x4feb14){var _0x1ba43a=_0x4aa98c||client;return _0x1ba43a[_0xaab8('0x21')](_0x51b2cc,_0x5cf8e0)[_0xaab8('0x22')](function(_0x4b6b7f){logger[_0xaab8('0x23')](_0xaab8('0x24'),_0x1e7f6f,_0xaab8('0x25'));logger[_0xaab8('0x26')](_0xaab8('0x27'),_0x1e7f6f,_0xaab8('0x25'),JSON[_0xaab8('0x28')](_0x4b6b7f));if(_0x4b6b7f[_0xaab8('0x29')]){if(_0x4b6b7f[_0xaab8('0x29')][_0xaab8('0x2a')]===0x1f4){logger[_0xaab8('0x29')](_0xaab8('0x24'),_0x1e7f6f,_0x4b6b7f[_0xaab8('0x29')]['message']);return _0x4feb14(_0x4b6b7f['error'][_0xaab8('0x2b')]);}logger[_0xaab8('0x29')](_0xaab8('0x24'),_0x1e7f6f,_0x4b6b7f[_0xaab8('0x29')][_0xaab8('0x2b')]);return _0x189c86(_0x4b6b7f[_0xaab8('0x29')][_0xaab8('0x2b')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x1e7f6f,'request\x20sent');_0x189c86(_0x4b6b7f['result'][_0xaab8('0x2b')]);}})[_0xaab8('0x2c')](function(_0x3e2983){logger['error'](_0xaab8('0x24'),_0x1e7f6f,_0x3e2983);_0x4feb14(_0x3e2983);});});}function respondWithStatusCode(_0x53c678,_0x2c1ed9){_0x2c1ed9=_0x2c1ed9||0xcc;return function(_0x38963c){if(_0x38963c){return _0x53c678[_0xaab8('0x2d')](_0x2c1ed9);}return _0x53c678[_0xaab8('0x2e')](_0x2c1ed9)['end']();};}function respondWithResult(_0x5d2d4f,_0x4ee8d0){_0x4ee8d0=_0x4ee8d0||0xc8;return function(_0x5eb733){if(_0x5eb733){return _0x5d2d4f[_0xaab8('0x2e')](_0x4ee8d0)[_0xaab8('0x2f')](_0x5eb733);}};}function respondWithFilteredResult(_0x4ae2f0,_0x5eee74){return function(_0x33faf7){if(_0x33faf7){var _0x43f8fb=typeof _0x5eee74[_0xaab8('0x30')]===_0xaab8('0x31')&&typeof _0x5eee74[_0xaab8('0x32')]==='undefined';var _0x282e88=_0x33faf7[_0xaab8('0x33')];var _0x1b19cc=_0x43f8fb?0x0:_0x5eee74[_0xaab8('0x30')];var _0x133512=_0x43f8fb?_0x33faf7[_0xaab8('0x33')]:_0x5eee74[_0xaab8('0x30')]+_0x5eee74[_0xaab8('0x32')];var _0x5822c4;if(_0x133512>=_0x282e88){_0x133512=_0x282e88;_0x5822c4=0xc8;}else{_0x5822c4=0xce;}_0x4ae2f0[_0xaab8('0x2e')](_0x5822c4);return _0x4ae2f0[_0xaab8('0x34')](_0xaab8('0x35'),_0x1b19cc+'-'+_0x133512+'/'+_0x282e88)[_0xaab8('0x2f')](_0x33faf7);}return null;};}function patchUpdates(_0x4567e5){return function(_0x6f4041){try{jsonpatch[_0xaab8('0x36')](_0x6f4041,_0x4567e5,!![]);}catch(_0x3ff9df){return BPromise['reject'](_0x3ff9df);}return _0x6f4041[_0xaab8('0x37')]();};}function saveUpdates(_0x495be0,_0x34882b){return function(_0xda7c82){if(_0xda7c82){return _0xda7c82[_0xaab8('0x38')](_0x495be0)['then'](function(_0x14132d){return _0x14132d;});}return null;};}function removeEntity(_0x366096,_0xd8a784){return function(_0x2b180f){if(_0x2b180f){return _0x2b180f[_0xaab8('0x39')]()[_0xaab8('0x22')](function(){var _0x179349=_0x2b180f[_0xaab8('0x3a')]({'plain':!![]});var _0xd0487d=_0xaab8('0x3b');return db['UserProfileResource']['destroy']({'where':{'type':_0xd0487d,'resourceId':_0x179349['id']}})[_0xaab8('0x22')](function(){return _0x2b180f;});})['then'](function(){_0x366096[_0xaab8('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c243,_0x5ade15){return function(_0x13bf70){if(!_0x13bf70){_0x10c243[_0xaab8('0x2d')](0x194);}return _0x13bf70;};}function handleError(_0x5682fe,_0x53364b){_0x53364b=_0x53364b||0x1f4;return function(_0x18d47b){logger['error'](_0x18d47b[_0xaab8('0x3c')]);if(_0x18d47b[_0xaab8('0x3d')]){delete _0x18d47b[_0xaab8('0x3d')];}_0x5682fe[_0xaab8('0x2e')](_0x53364b)[_0xaab8('0x3e')](_0x18d47b);};}exports['index']=function(_0x130e16,_0x327887){var _0x596488={},_0x512ef6={},_0x4c4956={'count':0x0,'rows':[]};var _0x5dae54=_[_0xaab8('0x3f')](db[_0xaab8('0x40')][_0xaab8('0x41')],function(_0x53c751){return{'name':_0x53c751['fieldName'],'type':_0x53c751[_0xaab8('0x42')][_0xaab8('0x43')]};});_0x512ef6[_0xaab8('0x44')]=_[_0xaab8('0x3f')](_0x5dae54,_0xaab8('0x3d'));_0x512ef6[_0xaab8('0x45')]=_[_0xaab8('0x46')](_0x130e16[_0xaab8('0x45')]);_0x512ef6[_0xaab8('0x47')]=_[_0xaab8('0x48')](_0x512ef6[_0xaab8('0x44')],_0x512ef6[_0xaab8('0x45')]);_0x596488['attributes']=_['intersection'](_0x512ef6[_0xaab8('0x44')],qs['fields'](_0x130e16[_0xaab8('0x45')][_0xaab8('0x49')]));_0x596488[_0xaab8('0x4a')]=_0x596488[_0xaab8('0x4a')][_0xaab8('0x4b')]?_0x596488[_0xaab8('0x4a')]:_0x512ef6[_0xaab8('0x44')];if(!_0x130e16[_0xaab8('0x45')][_0xaab8('0x4c')](_0xaab8('0x4d'))){_0x596488[_0xaab8('0x32')]=qs[_0xaab8('0x32')](_0x130e16['query'][_0xaab8('0x32')]);_0x596488[_0xaab8('0x30')]=qs['offset'](_0x130e16[_0xaab8('0x45')][_0xaab8('0x30')]);}_0x596488[_0xaab8('0x4e')]=qs[_0xaab8('0x4f')](_0x130e16[_0xaab8('0x45')][_0xaab8('0x4f')]);_0x596488[_0xaab8('0x50')]=qs[_0xaab8('0x47')](_[_0xaab8('0x51')](_0x130e16[_0xaab8('0x45')],_0x512ef6[_0xaab8('0x47')]),_0x5dae54);if(_0x130e16['query'][_0xaab8('0x52')]){_0x596488[_0xaab8('0x50')]=_[_0xaab8('0x53')](_0x596488['where'],{'$or':_[_0xaab8('0x3f')](_0x5dae54,function(_0x2650e7){if(_0x2650e7[_0xaab8('0x42')]!=='VIRTUAL'){var _0x111d8a={};_0x111d8a[_0x2650e7[_0xaab8('0x3d')]]={'$like':'%'+_0x130e16[_0xaab8('0x45')][_0xaab8('0x52')]+'%'};return _0x111d8a;}})});}_0x596488=_[_0xaab8('0x53')]({},_0x596488,_0x130e16[_0xaab8('0x54')]);var _0x465e88={'where':_0x596488[_0xaab8('0x50')]};return db[_0xaab8('0x40')][_0xaab8('0x33')](_0x465e88)['then'](function(_0x147f09){_0x4c4956[_0xaab8('0x33')]=_0x147f09;if(_0x130e16[_0xaab8('0x45')]['includeAll']){_0x596488[_0xaab8('0x55')]=[{'all':!![]}];}return db['VoiceContext'][_0xaab8('0x56')](_0x596488);})[_0xaab8('0x22')](function(_0x6bbdf2){_0x4c4956[_0xaab8('0x57')]=_0x6bbdf2;return _0x4c4956;})[_0xaab8('0x22')](respondWithFilteredResult(_0x327887,_0x596488))[_0xaab8('0x2c')](handleError(_0x327887,null));};exports[_0xaab8('0x58')]=function(_0x1ba6be,_0x4e6058){var _0x397e44={'raw':![],'where':{'id':_0x1ba6be[_0xaab8('0x59')]['id']}},_0x401bc1={};_0x401bc1[_0xaab8('0x44')]=_[_0xaab8('0x46')](db[_0xaab8('0x40')]['rawAttributes']);_0x401bc1[_0xaab8('0x45')]=_[_0xaab8('0x46')](_0x1ba6be[_0xaab8('0x45')]);_0x401bc1[_0xaab8('0x47')]=_['intersection'](_0x401bc1['model'],_0x401bc1['query']);_0x397e44['attributes']=_['intersection'](_0x401bc1['model'],qs[_0xaab8('0x49')](_0x1ba6be[_0xaab8('0x45')]['fields']));_0x397e44[_0xaab8('0x4a')]=_0x397e44['attributes'][_0xaab8('0x4b')]?_0x397e44[_0xaab8('0x4a')]:_0x401bc1['model'];if(_0x1ba6be[_0xaab8('0x45')][_0xaab8('0x5a')]){_0x397e44[_0xaab8('0x55')]=[{'all':!![]}];}_0x397e44=_['merge']({},_0x397e44,_0x1ba6be[_0xaab8('0x54')]);return db[_0xaab8('0x40')][_0xaab8('0x5b')](_0x397e44)['then'](handleEntityNotFound(_0x4e6058,null))['then'](respondWithResult(_0x4e6058,null))['catch'](handleError(_0x4e6058,null));};exports[_0xaab8('0x5c')]=function(_0x59e0f6,_0x14dcd6,_0xf74dc8){var _0x5640ad;return db['VoiceContext']['create'](_0x59e0f6[_0xaab8('0x5d')],{'raw':!![]})[_0xaab8('0x22')](function(_0x177ef3){_0x5640ad=_0x177ef3;return db[_0xaab8('0x40')][_0xaab8('0x56')]({'raw':!![]});})['then'](function(_0x3960f1){var _0x3da717=fs[_0xaab8('0x5e')](path[_0xaab8('0x5f')](config['root'],_0xaab8('0x60')),_0xaab8('0x61'));var _0x4d8dc9=ejs[_0xaab8('0x62')](_0x3da717,{'contexts':_0x3960f1||[]});fs[_0xaab8('0x63')](_0xaab8('0x64'),_0x4d8dc9);})[_0xaab8('0x22')](function(){return respondWithRpcPromise(_0xaab8('0x65'),_0xaab8('0x5c'),{'module':_0xaab8('0x66')});})['then'](function(){var _0x5c0109=_0x59e0f6['user'][_0xaab8('0x3a')]({'plain':!![]});if(!_0x5c0109)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c0109['role']===_0xaab8('0x67')){var _0x3503ae=_0x5640ad[_0xaab8('0x3a')]({'plain':!![]});return db[_0xaab8('0x68')]['find']({'where':{'name':'Contexts','userProfileId':_0x5c0109[_0xaab8('0x69')]},'raw':!![]})[_0xaab8('0x22')](function(_0x577a78){if(_0x577a78&&_0x577a78['autoAssociation']===0x0){return db[_0xaab8('0x6a')]['create']({'name':_0x3503ae[_0xaab8('0x3d')],'resourceId':_0x3503ae['id'],'type':_0x577a78[_0xaab8('0x3d')],'sectionId':_0x577a78['id']},{})['then'](function(){return _0x5640ad;});}else{return _0x5640ad;}})['catch'](function(_0x27217d){logger[_0xaab8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27217d);throw _0x27217d;});}return _0x5640ad;})[_0xaab8('0x22')](respondWithResult(_0x14dcd6,0xc9))[_0xaab8('0x2c')](handleError(_0x14dcd6,null));};exports['update']=function(_0x2b9dd7,_0x3cdeb8,_0x2341b6){var _0x51775e;return db[_0xaab8('0x40')][_0xaab8('0x5b')]({'where':{'id':_0x2b9dd7['params']['id']}})[_0xaab8('0x22')](handleEntityNotFound(_0x3cdeb8,null))[_0xaab8('0x22')](saveUpdates(_0x2b9dd7[_0xaab8('0x5d')],null))['then'](function(_0x278020){if(_0x278020){_0x51775e=_0x278020;return db[_0xaab8('0x40')][_0xaab8('0x56')]({'raw':!![]});}})[_0xaab8('0x22')](function(_0x38ef38){var _0x13c38b=fs[_0xaab8('0x5e')](path[_0xaab8('0x5f')](config[_0xaab8('0x6b')],_0xaab8('0x60')),_0xaab8('0x61'));var _0x28eafd=ejs['render'](_0x13c38b,{'contexts':_0x38ef38||[]});fs[_0xaab8('0x63')](_0xaab8('0x64'),_0x28eafd);})[_0xaab8('0x22')](function(){return respondWithRpcPromise('Reload',_0xaab8('0x38'),{'module':_0xaab8('0x66')});})[_0xaab8('0x22')](function(){return _0x51775e;})[_0xaab8('0x22')](respondWithResult(_0x3cdeb8,null))[_0xaab8('0x2c')](handleError(_0x3cdeb8,null));};exports[_0xaab8('0x39')]=function(_0x8187df,_0xe4b4e6,_0x187efc){var _0x398975;return db['VoiceContext'][_0xaab8('0x5b')]({'where':{'id':_0x8187df[_0xaab8('0x59')]['id']}})[_0xaab8('0x22')](handleEntityNotFound(_0xe4b4e6,null))['then'](removeEntity(_0xe4b4e6,null))[_0xaab8('0x22')](function(){return db[_0xaab8('0x40')][_0xaab8('0x56')]({'raw':!![]});})[_0xaab8('0x22')](function(_0x2b1a8e){var _0x55bec1=fs[_0xaab8('0x5e')](path['join'](config['root'],'server/files/templates/context.ejs'),_0xaab8('0x61'));var _0x282e9f=ejs[_0xaab8('0x62')](_0x55bec1,{'contexts':_0x2b1a8e});fs[_0xaab8('0x63')](_0xaab8('0x64'),_0x282e9f);return respondWithRpcPromise(_0xaab8('0x65'),_0xaab8('0x39'),{'module':_0xaab8('0x66')});})[_0xaab8('0x2c')](handleError(_0xe4b4e6,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 9127ad2..7f40af1 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 _0x154d=['lodash','api','moment','bluebird','rimraf','./voiceContext.attributes','exports','define','VoiceContext'];(function(_0x5cc24b,_0xc74cb1){var _0x69dcba=function(_0x5f169b){while(--_0x5f169b){_0x5cc24b['push'](_0x5cc24b['shift']());}};_0x69dcba(++_0xc74cb1);}(_0x154d,0xe1));var _0xd154=function(_0x4b0eac,_0x490f14){_0x4b0eac=_0x4b0eac-0x0;var _0x7246a4=_0x154d[_0x4b0eac];return _0x7246a4;};'use strict';var _=require(_0xd154('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd154('0x1'));var moment=require(_0xd154('0x2'));var BPromise=require(_0xd154('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd154('0x4'));var config=require('../../config/environment');var attributes=require(_0xd154('0x5'));module[_0xd154('0x6')]=function(_0xa54e5f,_0x7523c5){return _0xa54e5f[_0xd154('0x7')](_0xd154('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce2f=['api','moment','bluebird','request-promise','rimraf','./voiceContext.attributes','define','VoiceContext','voice_contexts','util','../../config/logger'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0xce2f,0x18a));var _0xfce2=function(_0x3fc4c1,_0x37bf97){_0x3fc4c1=_0x3fc4c1-0x0;var _0x4cf10f=_0xce2f[_0x3fc4c1];return _0x4cf10f;};'use strict';var _=require('lodash');var util=require(_0xfce2('0x0'));var logger=require(_0xfce2('0x1'))(_0xfce2('0x2'));var moment=require(_0xfce2('0x3'));var BPromise=require(_0xfce2('0x4'));var rp=require(_0xfce2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfce2('0x6'));var config=require('../../config/environment');var attributes=require(_0xfce2('0x7'));module['exports']=function(_0x22efae,_0xeffde2){return _0x22efae[_0xfce2('0x8')](_0xfce2('0x9'),attributes,{'tableName':_0xfce2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 05bd115..cedbabe 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 _0x29b1=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','info','message','catch','lodash','util','moment'];(function(_0x4b985c,_0x3b863b){var _0x3e55a4=function(_0x46a3d6){while(--_0x46a3d6){_0x4b985c['push'](_0x4b985c['shift']());}};_0x3e55a4(++_0x3b863b);}(_0x29b1,0x16d));var _0x129b=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x29b1[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0x129b('0x0'));var util=require(_0x129b('0x1'));var moment=require(_0x129b('0x2'));var BPromise=require(_0x129b('0x3'));var rs=require(_0x129b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x129b('0x5'))['db'];var utils=require(_0x129b('0x6'));var logger=require(_0x129b('0x7'))(_0x129b('0x8'));var config=require(_0x129b('0x9'));var jayson=require(_0x129b('0xa'));var client=jayson[_0x129b('0xb')][_0x129b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ce8f9,_0x3ef769,_0x5ac368){return new BPromise(function(_0x2c99a1,_0x1e29d6){return client['request'](_0x5ce8f9,_0x5ac368)[_0x129b('0xd')](function(_0x1abf45){logger['info'](_0x129b('0xe'),_0x3ef769,'request\x20sent');logger[_0x129b('0xf')](_0x129b('0x10'),_0x3ef769,_0x129b('0x11'),JSON['stringify'](_0x1abf45));if(_0x1abf45[_0x129b('0x12')]){if(_0x1abf45[_0x129b('0x12')][_0x129b('0x13')]===0x1f4){logger[_0x129b('0x12')]('VoiceContext,\x20%s,\x20%s',_0x3ef769,_0x1abf45['error']['message']);return _0x1e29d6(_0x1abf45[_0x129b('0x12')]['message']);}logger[_0x129b('0x12')](_0x129b('0xe'),_0x3ef769,_0x1abf45[_0x129b('0x12')]['message']);return _0x2c99a1(_0x1abf45[_0x129b('0x12')]['message']);}else{logger[_0x129b('0x14')](_0x129b('0xe'),_0x3ef769,_0x129b('0x11'));_0x2c99a1(_0x1abf45['result'][_0x129b('0x15')]);}})[_0x129b('0x16')](function(_0x1364f8){logger[_0x129b('0x12')](_0x129b('0xe'),_0x3ef769,_0x1364f8);_0x1e29d6(_0x1364f8);});});} \ No newline at end of file +var _0x1646=['info','request\x20sent','debug','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x1646,0x1bd));var _0x6164=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x1646[_0x4c73ac];return _0x9839ee;};'use strict';var _=require(_0x6164('0x0'));var util=require(_0x6164('0x1'));var moment=require(_0x6164('0x2'));var BPromise=require(_0x6164('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6164('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6164('0x5'));var logger=require('../../config/logger')(_0x6164('0x6'));var config=require('../../config/environment');var jayson=require(_0x6164('0x7'));var client=jayson[_0x6164('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45107a,_0x490e94,_0x2048a2){return new BPromise(function(_0x3d6867,_0x23636f){return client[_0x6164('0x9')](_0x45107a,_0x2048a2)[_0x6164('0xa')](function(_0x3ece0b){logger[_0x6164('0xb')]('VoiceContext,\x20%s,\x20%s',_0x490e94,_0x6164('0xc'));logger[_0x6164('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x490e94,_0x6164('0xc'),JSON[_0x6164('0xe')](_0x3ece0b));if(_0x3ece0b[_0x6164('0xf')]){if(_0x3ece0b[_0x6164('0xf')]['code']===0x1f4){logger[_0x6164('0xf')](_0x6164('0x10'),_0x490e94,_0x3ece0b[_0x6164('0xf')]['message']);return _0x23636f(_0x3ece0b[_0x6164('0xf')][_0x6164('0x11')]);}logger['error'](_0x6164('0x10'),_0x490e94,_0x3ece0b[_0x6164('0xf')]['message']);return _0x3d6867(_0x3ece0b[_0x6164('0xf')]['message']);}else{logger[_0x6164('0xb')](_0x6164('0x10'),_0x490e94,_0x6164('0xc'));_0x3d6867(_0x3ece0b[_0x6164('0x12')][_0x6164('0x11')]);}})['catch'](function(_0x14d729){logger[_0x6164('0xf')](_0x6164('0x10'),_0x490e94,_0x14d729);_0x23636f(_0x14d729);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index dcb1b6d..d673de7 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 _0x950a=['get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0xbe6185,_0x351e0c){var _0x52e089=function(_0x5e1785){while(--_0x5e1785){_0xbe6185['push'](_0xbe6185['shift']());}};_0x52e089(++_0x351e0c);}(_0x950a,0x174));var _0xa950=function(_0x2bb3e8,_0x1ca208){_0x2bb3e8=_0x2bb3e8-0x0;var _0x16855d=_0x950a[_0x2bb3e8];return _0x16855d;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require('connect-timeout');var express=require(_0xa950('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa950('0x4'));var interaction=require(_0xa950('0x5'));var config=require(_0xa950('0x6'));var controller=require(_0xa950('0x7'));router[_0xa950('0x8')]('/',auth[_0xa950('0x9')](),controller[_0xa950('0xa')]);router['get'](_0xa950('0xb'),auth[_0xa950('0x9')](),controller[_0xa950('0xc')]);router[_0xa950('0x8')](_0xa950('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa950('0x9')](),controller[_0xa950('0xe')]);router[_0xa950('0xf')](_0xa950('0xd'),auth[_0xa950('0x9')](),controller[_0xa950('0x10')]);router[_0xa950('0x11')](_0xa950('0xd'),auth[_0xa950('0x9')](),controller[_0xa950('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb9bd=['post','create','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0xb9bd,0x9d));var _0xdb9b=function(_0x582fd7,_0x306601){_0x582fd7=_0x582fd7-0x0;var _0x4ab313=_0xb9bd[_0x582fd7];return _0x4ab313;};'use strict';var multer=require(_0xdb9b('0x0'));var util=require(_0xdb9b('0x1'));var path=require(_0xdb9b('0x2'));var timeout=require(_0xdb9b('0x3'));var express=require(_0xdb9b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdb9b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb9b('0x6'));var controller=require(_0xdb9b('0x7'));router[_0xdb9b('0x8')]('/',auth['isAuthenticated'](),controller[_0xdb9b('0x9')]);router[_0xdb9b('0x8')]('/describe',auth[_0xdb9b('0xa')](),controller[_0xdb9b('0xb')]);router['get'](_0xdb9b('0xc'),auth[_0xdb9b('0xa')](),controller[_0xdb9b('0xd')]);router[_0xdb9b('0xe')]('/',auth[_0xdb9b('0xa')](),controller[_0xdb9b('0xf')]);router[_0xdb9b('0x10')](_0xdb9b('0xc'),auth[_0xdb9b('0xa')](),controller[_0xdb9b('0x11')]);router[_0xdb9b('0x12')](_0xdb9b('0xc'),auth[_0xdb9b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6d0ee17..1882922 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 _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x12ffaf,_0x217342){var _0x54a5f4=function(_0x5eae16){while(--_0x5eae16){_0x12ffaf['push'](_0x12ffaf['shift']());}};_0x54a5f4(++_0x217342);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x151ca7,_0x48e81a){_0x151ca7=_0x151ca7-0x0;var _0x36ea01=_0x8d0e[_0x151ca7];return _0x36ea01;};'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 +var _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x5ecac1,_0x2d7338){var _0x1fe487=function(_0x94c196){while(--_0x94c196){_0x5ecac1['push'](_0x5ecac1['shift']());}};_0x1fe487(++_0x2d7338);}(_0x84ab,0x12f));var _0xb84a=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0x84ab[_0x172133];return _0x2460e5;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index cb61a9a..c068880 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 _0x986f=['show','options','find','create','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0x4d3016,_0x3e170d){var _0x4c513c=function(_0xd73a0b){while(--_0xd73a0b){_0x4d3016['push'](_0x4d3016['shift']());}};_0x4c513c(++_0x3e170d);}(_0x986f,0xe7));var _0xf986=function(_0xc0b17,_0x524848){_0xc0b17=_0xc0b17-0x0;var _0xeb64c1=_0x986f[_0xc0b17];return _0xeb64c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf986('0x0'));var zipdir=require(_0xf986('0x1'));var jsonpatch=require(_0xf986('0x2'));var rp=require(_0xf986('0x3'));var moment=require(_0xf986('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf986('0x5'));var util=require(_0xf986('0x6'));var path=require(_0xf986('0x7'));var sox=require('sox');var csv=require(_0xf986('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf986('0x9'));var _=require(_0xf986('0xa'));var squel=require(_0xf986('0xb'));var crypto=require('crypto');var jsforce=require(_0xf986('0xc'));var deskjs=require(_0xf986('0xd'));var toCsv=require(_0xf986('0x8'));var querystring=require(_0xf986('0xe'));var Papa=require(_0xf986('0xf'));var Redis=require(_0xf986('0x10'));var authService=require(_0xf986('0x11'));var qs=require(_0xf986('0x12'));var as=require(_0xf986('0x13'));var hardwareService=require(_0xf986('0x14'));var logger=require(_0xf986('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf986('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31bdca,_0x31f7e7){_0x31f7e7=_0x31f7e7||0xcc;return function(_0x323d6b){if(_0x323d6b){return _0x31bdca['sendStatus'](_0x31f7e7);}return _0x31bdca[_0xf986('0x17')](_0x31f7e7)[_0xf986('0x18')]();};}function respondWithResult(_0x3a1537,_0x317f20){_0x317f20=_0x317f20||0xc8;return function(_0x4c6aab){if(_0x4c6aab){return _0x3a1537[_0xf986('0x17')](_0x317f20)[_0xf986('0x19')](_0x4c6aab);}};}function respondWithFilteredResult(_0x32e123,_0x5625b8){return function(_0x586a8a){if(_0x586a8a){var _0x1702f0=typeof _0x5625b8[_0xf986('0x1a')]===_0xf986('0x1b')&&typeof _0x5625b8[_0xf986('0x1c')]===_0xf986('0x1b');var _0x913cb2=_0x586a8a[_0xf986('0x1d')];var _0x53de2e=_0x1702f0?0x0:_0x5625b8[_0xf986('0x1a')];var _0x450bec=_0x1702f0?_0x586a8a[_0xf986('0x1d')]:_0x5625b8['offset']+_0x5625b8['limit'];var _0x1abb44;if(_0x450bec>=_0x913cb2){_0x450bec=_0x913cb2;_0x1abb44=0xc8;}else{_0x1abb44=0xce;}_0x32e123['status'](_0x1abb44);return _0x32e123[_0xf986('0x1e')](_0xf986('0x1f'),_0x53de2e+'-'+_0x450bec+'/'+_0x913cb2)[_0xf986('0x19')](_0x586a8a);}return null;};}function patchUpdates(_0x5e1297){return function(_0x467d70){try{jsonpatch['apply'](_0x467d70,_0x5e1297,!![]);}catch(_0x17cf91){return BPromise[_0xf986('0x20')](_0x17cf91);}return _0x467d70[_0xf986('0x21')]();};}function saveUpdates(_0x2e97bb,_0x581403){return function(_0x31de99){if(_0x31de99){return _0x31de99[_0xf986('0x22')](_0x2e97bb)['then'](function(_0x52f926){return _0x52f926;});}return null;};}function removeEntity(_0x189d16,_0x3d58c6){return function(_0x2024e0){if(_0x2024e0){return _0x2024e0[_0xf986('0x23')]()[_0xf986('0x24')](function(){_0x189d16['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x777733,_0x26c2ee){return function(_0x25147c){if(!_0x25147c){_0x777733[_0xf986('0x25')](0x194);}return _0x25147c;};}function handleError(_0x4233ca,_0x1bd45b){_0x1bd45b=_0x1bd45b||0x1f4;return function(_0xcbbe9e){logger['error'](_0xcbbe9e[_0xf986('0x26')]);if(_0xcbbe9e[_0xf986('0x27')]){delete _0xcbbe9e[_0xf986('0x27')];}_0x4233ca[_0xf986('0x17')](_0x1bd45b)[_0xf986('0x28')](_0xcbbe9e);};}exports[_0xf986('0x29')]=function(_0x4dcb99,_0x2796f2){var _0x21f926={},_0x2548c8={},_0x2ad212={'count':0x0,'rows':[]};var _0x3d2329=_[_0xf986('0x2a')](db[_0xf986('0x2b')][_0xf986('0x2c')],function(_0x3ef431){return{'name':_0x3ef431[_0xf986('0x2d')],'type':_0x3ef431[_0xf986('0x2e')][_0xf986('0x2f')]};});_0x2548c8['model']=_[_0xf986('0x2a')](_0x3d2329,_0xf986('0x27'));_0x2548c8[_0xf986('0x30')]=_[_0xf986('0x31')](_0x4dcb99['query']);_0x2548c8[_0xf986('0x32')]=_['intersection'](_0x2548c8[_0xf986('0x33')],_0x2548c8[_0xf986('0x30')]);_0x21f926[_0xf986('0x34')]=_[_0xf986('0x35')](_0x2548c8[_0xf986('0x33')],qs[_0xf986('0x36')](_0x4dcb99['query'][_0xf986('0x36')]));_0x21f926[_0xf986('0x34')]=_0x21f926[_0xf986('0x34')][_0xf986('0x37')]?_0x21f926[_0xf986('0x34')]:_0x2548c8[_0xf986('0x33')];if(!_0x4dcb99['query'][_0xf986('0x38')](_0xf986('0x39'))){_0x21f926[_0xf986('0x1c')]=qs[_0xf986('0x1c')](_0x4dcb99[_0xf986('0x30')][_0xf986('0x1c')]);_0x21f926[_0xf986('0x1a')]=qs['offset'](_0x4dcb99[_0xf986('0x30')][_0xf986('0x1a')]);}_0x21f926[_0xf986('0x3a')]=qs[_0xf986('0x3b')](_0x4dcb99[_0xf986('0x30')]['sort']);_0x21f926[_0xf986('0x3c')]=qs[_0xf986('0x32')](_[_0xf986('0x3d')](_0x4dcb99[_0xf986('0x30')],_0x2548c8[_0xf986('0x32')]),_0x3d2329);if(_0x4dcb99[_0xf986('0x30')]['filter']){_0x21f926[_0xf986('0x3c')]=_[_0xf986('0x3e')](_0x21f926['where'],{'$or':_[_0xf986('0x2a')](_0x3d2329,function(_0x5ecb36){if(_0x5ecb36[_0xf986('0x2e')]!==_0xf986('0x3f')){var _0x419a97={};_0x419a97[_0x5ecb36[_0xf986('0x27')]]={'$like':'%'+_0x4dcb99[_0xf986('0x30')][_0xf986('0x40')]+'%'};return _0x419a97;}})});}_0x21f926=_['merge']({},_0x21f926,_0x4dcb99['options']);var _0x296336={'where':_0x21f926[_0xf986('0x3c')]};return db[_0xf986('0x2b')][_0xf986('0x1d')](_0x296336)['then'](function(_0x33a3cf){_0x2ad212[_0xf986('0x1d')]=_0x33a3cf;if(_0x4dcb99[_0xf986('0x30')][_0xf986('0x41')]){_0x21f926[_0xf986('0x42')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xf986('0x43')](_0x21f926);})['then'](function(_0x2d1bfe){_0x2ad212[_0xf986('0x44')]=_0x2d1bfe;return _0x2ad212;})['then'](respondWithFilteredResult(_0x2796f2,_0x21f926))['catch'](handleError(_0x2796f2,null));};exports[_0xf986('0x45')]=function(_0x21c59e,_0x311bf9){var _0x3f0f46={'raw':!![],'where':{'id':_0x21c59e['params']['id']}},_0x3c42a5={};_0x3c42a5[_0xf986('0x33')]=_[_0xf986('0x31')](db[_0xf986('0x2b')][_0xf986('0x2c')]);_0x3c42a5[_0xf986('0x30')]=_[_0xf986('0x31')](_0x21c59e[_0xf986('0x30')]);_0x3c42a5[_0xf986('0x32')]=_[_0xf986('0x35')](_0x3c42a5[_0xf986('0x33')],_0x3c42a5['query']);_0x3f0f46[_0xf986('0x34')]=_['intersection'](_0x3c42a5['model'],qs[_0xf986('0x36')](_0x21c59e[_0xf986('0x30')][_0xf986('0x36')]));_0x3f0f46['attributes']=_0x3f0f46['attributes'][_0xf986('0x37')]?_0x3f0f46[_0xf986('0x34')]:_0x3c42a5['model'];if(_0x21c59e[_0xf986('0x30')]['includeAll']){_0x3f0f46['include']=[{'all':!![]}];}_0x3f0f46=_[_0xf986('0x3e')]({},_0x3f0f46,_0x21c59e[_0xf986('0x46')]);return db[_0xf986('0x2b')][_0xf986('0x47')](_0x3f0f46)[_0xf986('0x24')](handleEntityNotFound(_0x311bf9,null))[_0xf986('0x24')](respondWithResult(_0x311bf9,null))['catch'](handleError(_0x311bf9,null));};exports[_0xf986('0x48')]=function(_0x2d371a,_0x558d5a){return db[_0xf986('0x2b')]['create'](_0x2d371a['body'],{})['then'](respondWithResult(_0x558d5a,0xc9))['catch'](handleError(_0x558d5a,null));};exports[_0xf986('0x22')]=function(_0x2d6417,_0x1cb2ff){if(_0x2d6417['body']['id']){delete _0x2d6417['body']['id'];}return db[_0xf986('0x2b')]['find']({'where':{'id':_0x2d6417[_0xf986('0x49')]['id']}})[_0xf986('0x24')](handleEntityNotFound(_0x1cb2ff,null))[_0xf986('0x24')](saveUpdates(_0x2d6417['body'],null))[_0xf986('0x24')](respondWithResult(_0x1cb2ff,null))['catch'](handleError(_0x1cb2ff,null));};exports['destroy']=function(_0x2ce421,_0x33681d){return db['VoiceDialReport'][_0xf986('0x47')]({'where':{'id':_0x2ce421[_0xf986('0x49')]['id']}})['then'](handleEntityNotFound(_0x33681d,null))[_0xf986('0x24')](removeEntity(_0x33681d,null))['catch'](handleError(_0x33681d,null));};exports['describe']=function(_0x5f37ea,_0x3dfdc2){return db[_0xf986('0x2b')][_0xf986('0x4a')]()[_0xf986('0x24')](respondWithResult(_0x3dfdc2,null))['catch'](handleError(_0x3dfdc2,null));}; \ No newline at end of file +var _0xec42=['end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','map','VoiceDialReport','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0xec42,0x1d3));var _0x2ec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec42[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2ec4('0x0'));var rimraf=require(_0x2ec4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ec4('0x2'));var rp=require(_0x2ec4('0x3'));var moment=require('moment');var BPromise=require(_0x2ec4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2ec4('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2ec4('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ec4('0x7'));var squel=require(_0x2ec4('0x8'));var crypto=require(_0x2ec4('0x9'));var jsforce=require(_0x2ec4('0xa'));var deskjs=require(_0x2ec4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2ec4('0xc'));var Papa=require(_0x2ec4('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2ec4('0xe'));var hardwareService=require(_0x2ec4('0xf'));var logger=require(_0x2ec4('0x10'))(_0x2ec4('0x11'));var utils=require(_0x2ec4('0x12'));var config=require(_0x2ec4('0x13'));var licenseUtil=require(_0x2ec4('0x14'));var db=require(_0x2ec4('0x15'))['db'];function respondWithStatusCode(_0x285c9f,_0x941208){_0x941208=_0x941208||0xcc;return function(_0x5d55c4){if(_0x5d55c4){return _0x285c9f['sendStatus'](_0x941208);}return _0x285c9f[_0x2ec4('0x16')](_0x941208)[_0x2ec4('0x17')]();};}function respondWithResult(_0x225aef,_0x4e9352){_0x4e9352=_0x4e9352||0xc8;return function(_0x5dd06d){if(_0x5dd06d){return _0x225aef['status'](_0x4e9352)[_0x2ec4('0x18')](_0x5dd06d);}};}function respondWithFilteredResult(_0x6f291b,_0x142df0){return function(_0x44772c){if(_0x44772c){var _0x40acb5=typeof _0x142df0[_0x2ec4('0x19')]===_0x2ec4('0x1a')&&typeof _0x142df0[_0x2ec4('0x1b')]===_0x2ec4('0x1a');var _0x28a845=_0x44772c[_0x2ec4('0x1c')];var _0x21362c=_0x40acb5?0x0:_0x142df0[_0x2ec4('0x19')];var _0x2763ef=_0x40acb5?_0x44772c[_0x2ec4('0x1c')]:_0x142df0[_0x2ec4('0x19')]+_0x142df0['limit'];var _0x44a718;if(_0x2763ef>=_0x28a845){_0x2763ef=_0x28a845;_0x44a718=0xc8;}else{_0x44a718=0xce;}_0x6f291b[_0x2ec4('0x16')](_0x44a718);return _0x6f291b['set'](_0x2ec4('0x1d'),_0x21362c+'-'+_0x2763ef+'/'+_0x28a845)[_0x2ec4('0x18')](_0x44772c);}return null;};}function patchUpdates(_0x48a518){return function(_0x5cd33e){try{jsonpatch['apply'](_0x5cd33e,_0x48a518,!![]);}catch(_0x2f9706){return BPromise[_0x2ec4('0x1e')](_0x2f9706);}return _0x5cd33e[_0x2ec4('0x1f')]();};}function saveUpdates(_0x5c2f0a,_0x11d003){return function(_0x2c36aa){if(_0x2c36aa){return _0x2c36aa[_0x2ec4('0x20')](_0x5c2f0a)['then'](function(_0x48eb18){return _0x48eb18;});}return null;};}function removeEntity(_0x31d149,_0x326c9f){return function(_0x5b05e5){if(_0x5b05e5){return _0x5b05e5[_0x2ec4('0x21')]()['then'](function(){_0x31d149[_0x2ec4('0x16')](0xcc)[_0x2ec4('0x17')]();});}};}function handleEntityNotFound(_0xdd95d3,_0x28dfe2){return function(_0x1032c6){if(!_0x1032c6){_0xdd95d3[_0x2ec4('0x22')](0x194);}return _0x1032c6;};}function handleError(_0x57f9cd,_0xd9c959){_0xd9c959=_0xd9c959||0x1f4;return function(_0x551474){logger[_0x2ec4('0x23')](_0x551474[_0x2ec4('0x24')]);if(_0x551474[_0x2ec4('0x25')]){delete _0x551474[_0x2ec4('0x25')];}_0x57f9cd[_0x2ec4('0x16')](_0xd9c959)['send'](_0x551474);};}exports['index']=function(_0x388881,_0x6bd17a){var _0x4e644b={},_0x343c78={},_0x86264e={'count':0x0,'rows':[]};var _0x207c2d=_[_0x2ec4('0x26')](db[_0x2ec4('0x27')][_0x2ec4('0x28')],function(_0x1f8e5c){return{'name':_0x1f8e5c['fieldName'],'type':_0x1f8e5c['type']['key']};});_0x343c78[_0x2ec4('0x29')]=_[_0x2ec4('0x26')](_0x207c2d,'name');_0x343c78['query']=_['keys'](_0x388881[_0x2ec4('0x2a')]);_0x343c78['filters']=_[_0x2ec4('0x2b')](_0x343c78[_0x2ec4('0x29')],_0x343c78[_0x2ec4('0x2a')]);_0x4e644b[_0x2ec4('0x2c')]=_[_0x2ec4('0x2b')](_0x343c78[_0x2ec4('0x29')],qs['fields'](_0x388881[_0x2ec4('0x2a')][_0x2ec4('0x2d')]));_0x4e644b[_0x2ec4('0x2c')]=_0x4e644b[_0x2ec4('0x2c')][_0x2ec4('0x2e')]?_0x4e644b[_0x2ec4('0x2c')]:_0x343c78[_0x2ec4('0x29')];if(!_0x388881[_0x2ec4('0x2a')][_0x2ec4('0x2f')](_0x2ec4('0x30'))){_0x4e644b['limit']=qs[_0x2ec4('0x1b')](_0x388881[_0x2ec4('0x2a')]['limit']);_0x4e644b[_0x2ec4('0x19')]=qs[_0x2ec4('0x19')](_0x388881[_0x2ec4('0x2a')][_0x2ec4('0x19')]);}_0x4e644b[_0x2ec4('0x31')]=qs[_0x2ec4('0x32')](_0x388881['query'][_0x2ec4('0x32')]);_0x4e644b[_0x2ec4('0x33')]=qs[_0x2ec4('0x34')](_[_0x2ec4('0x35')](_0x388881[_0x2ec4('0x2a')],_0x343c78['filters']),_0x207c2d);if(_0x388881[_0x2ec4('0x2a')][_0x2ec4('0x36')]){_0x4e644b['where']=_[_0x2ec4('0x37')](_0x4e644b['where'],{'$or':_[_0x2ec4('0x26')](_0x207c2d,function(_0x47b860){if(_0x47b860[_0x2ec4('0x38')]!==_0x2ec4('0x39')){var _0x84fbd2={};_0x84fbd2[_0x47b860['name']]={'$like':'%'+_0x388881[_0x2ec4('0x2a')]['filter']+'%'};return _0x84fbd2;}})});}_0x4e644b=_[_0x2ec4('0x37')]({},_0x4e644b,_0x388881[_0x2ec4('0x3a')]);var _0x3f1732={'where':_0x4e644b[_0x2ec4('0x33')]};return db[_0x2ec4('0x27')][_0x2ec4('0x1c')](_0x3f1732)[_0x2ec4('0x3b')](function(_0x1e5a2e){_0x86264e['count']=_0x1e5a2e;if(_0x388881['query'][_0x2ec4('0x3c')]){_0x4e644b[_0x2ec4('0x3d')]=[{'all':!![]}];}return db[_0x2ec4('0x27')]['findAll'](_0x4e644b);})[_0x2ec4('0x3b')](function(_0x2567f3){_0x86264e['rows']=_0x2567f3;return _0x86264e;})[_0x2ec4('0x3b')](respondWithFilteredResult(_0x6bd17a,_0x4e644b))['catch'](handleError(_0x6bd17a,null));};exports[_0x2ec4('0x3e')]=function(_0x18300c,_0x550249){var _0x525026={'raw':!![],'where':{'id':_0x18300c[_0x2ec4('0x3f')]['id']}},_0x504e72={};_0x504e72[_0x2ec4('0x29')]=_[_0x2ec4('0x40')](db[_0x2ec4('0x27')][_0x2ec4('0x28')]);_0x504e72[_0x2ec4('0x2a')]=_[_0x2ec4('0x40')](_0x18300c[_0x2ec4('0x2a')]);_0x504e72[_0x2ec4('0x34')]=_['intersection'](_0x504e72[_0x2ec4('0x29')],_0x504e72[_0x2ec4('0x2a')]);_0x525026[_0x2ec4('0x2c')]=_[_0x2ec4('0x2b')](_0x504e72[_0x2ec4('0x29')],qs[_0x2ec4('0x2d')](_0x18300c['query'][_0x2ec4('0x2d')]));_0x525026[_0x2ec4('0x2c')]=_0x525026[_0x2ec4('0x2c')]['length']?_0x525026['attributes']:_0x504e72[_0x2ec4('0x29')];if(_0x18300c[_0x2ec4('0x2a')][_0x2ec4('0x3c')]){_0x525026[_0x2ec4('0x3d')]=[{'all':!![]}];}_0x525026=_['merge']({},_0x525026,_0x18300c[_0x2ec4('0x3a')]);return db['VoiceDialReport'][_0x2ec4('0x41')](_0x525026)['then'](handleEntityNotFound(_0x550249,null))[_0x2ec4('0x3b')](respondWithResult(_0x550249,null))[_0x2ec4('0x42')](handleError(_0x550249,null));};exports[_0x2ec4('0x43')]=function(_0x3efa67,_0x50a3f4){return db['VoiceDialReport'][_0x2ec4('0x43')](_0x3efa67[_0x2ec4('0x44')],{})[_0x2ec4('0x3b')](respondWithResult(_0x50a3f4,0xc9))[_0x2ec4('0x42')](handleError(_0x50a3f4,null));};exports['update']=function(_0x5e8e64,_0x100c44){if(_0x5e8e64['body']['id']){delete _0x5e8e64[_0x2ec4('0x44')]['id'];}return db[_0x2ec4('0x27')][_0x2ec4('0x41')]({'where':{'id':_0x5e8e64['params']['id']}})[_0x2ec4('0x3b')](handleEntityNotFound(_0x100c44,null))[_0x2ec4('0x3b')](saveUpdates(_0x5e8e64[_0x2ec4('0x44')],null))[_0x2ec4('0x3b')](respondWithResult(_0x100c44,null))[_0x2ec4('0x42')](handleError(_0x100c44,null));};exports[_0x2ec4('0x21')]=function(_0x35001b,_0x59020b){return db[_0x2ec4('0x27')][_0x2ec4('0x41')]({'where':{'id':_0x35001b['params']['id']}})['then'](handleEntityNotFound(_0x59020b,null))[_0x2ec4('0x3b')](removeEntity(_0x59020b,null))['catch'](handleError(_0x59020b,null));};exports[_0x2ec4('0x45')]=function(_0x894a85,_0x98a1a1){return db['VoiceDialReport'][_0x2ec4('0x45')]()[_0x2ec4('0x3b')](respondWithResult(_0x98a1a1,null))[_0x2ec4('0x42')](handleError(_0x98a1a1,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 3788919..0d6d457 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 _0xef8e=['path','rimraf','exports','define','VoiceDialReport','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46012c,_0x66bacf){var _0x26d30f=function(_0x3a281a){while(--_0x3a281a){_0x46012c['push'](_0x46012c['shift']());}};_0x26d30f(++_0x66bacf);}(_0xef8e,0x17b));var _0xeef8=function(_0x4f8603,_0x2ee40d){_0x4f8603=_0x4f8603-0x0;var _0x4247fa=_0xef8e[_0x4f8603];return _0x4247fa;};'use strict';var _=require(_0xeef8('0x0'));var util=require('util');var logger=require(_0xeef8('0x1'))(_0xeef8('0x2'));var moment=require(_0xeef8('0x3'));var BPromise=require(_0xeef8('0x4'));var rp=require(_0xeef8('0x5'));var fs=require('fs');var path=require(_0xeef8('0x6'));var rimraf=require(_0xeef8('0x7'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xeef8('0x8')]=function(_0x2919c4,_0x247bf1){return _0x2919c4[_0xeef8('0x9')](_0xeef8('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdec1=['moment','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','../../config/logger','api'];(function(_0x3e6f6a,_0x3bba5c){var _0x2bb136=function(_0x363cd9){while(--_0x363cd9){_0x3e6f6a['push'](_0x3e6f6a['shift']());}};_0x2bb136(++_0x3bba5c);}(_0xdec1,0x105));var _0x1dec=function(_0x3a730a,_0x1a3c00){_0x3a730a=_0x3a730a-0x0;var _0x289e88=_0xdec1[_0x3a730a];return _0x289e88;};'use strict';var _=require(_0x1dec('0x0'));var util=require('util');var logger=require(_0x1dec('0x1'))(_0x1dec('0x2'));var moment=require(_0x1dec('0x3'));var BPromise=require('bluebird');var rp=require(_0x1dec('0x4'));var fs=require('fs');var path=require(_0x1dec('0x5'));var rimraf=require(_0x1dec('0x6'));var config=require('../../config/environment');var attributes=require(_0x1dec('0x7'));module[_0x1dec('0x8')]=function(_0x5b842b,_0x345cab){return _0x5b842b[_0x1dec('0x9')]('VoiceDialReport',attributes,{'tableName':_0x1dec('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1dec('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d9d044f..49a0cf2 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 _0xbcd7=['stringify','error','code','message','result','catch','CreateVoiceDialReport','body','options','UpdateVoiceDialReport','VoiceDialReport','update','raw','attributes','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3fb021,_0xee60de){var _0x1789e3=function(_0xea9b14){while(--_0xea9b14){_0x3fb021['push'](_0x3fb021['shift']());}};_0x1789e3(++_0xee60de);}(_0xbcd7,0xf0));var _0x7bcd=function(_0x1b9d1c,_0x5e9367){_0x1b9d1c=_0x1b9d1c-0x0;var _0x57b62e=_0xbcd7[_0x1b9d1c];return _0x57b62e;};'use strict';var _=require(_0x7bcd('0x0'));var util=require('util');var moment=require(_0x7bcd('0x1'));var BPromise=require(_0x7bcd('0x2'));var rs=require(_0x7bcd('0x3'));var fs=require('fs');var Redis=require(_0x7bcd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bcd('0x5'));var logger=require(_0x7bcd('0x6'))(_0x7bcd('0x7'));var config=require(_0x7bcd('0x8'));var jayson=require(_0x7bcd('0x9'));var client=jayson[_0x7bcd('0xa')][_0x7bcd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29bf32,_0x11a299,_0x440cb0){return new BPromise(function(_0x351693,_0x587105){return client['request'](_0x29bf32,_0x440cb0)['then'](function(_0x398242){logger[_0x7bcd('0xc')](_0x7bcd('0xd'),_0x11a299,'request\x20sent');logger[_0x7bcd('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x11a299,_0x7bcd('0xf'),JSON[_0x7bcd('0x10')](_0x398242));if(_0x398242['error']){if(_0x398242[_0x7bcd('0x11')][_0x7bcd('0x12')]===0x1f4){logger[_0x7bcd('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x11a299,_0x398242[_0x7bcd('0x11')][_0x7bcd('0x13')]);return _0x587105(_0x398242[_0x7bcd('0x11')][_0x7bcd('0x13')]);}logger[_0x7bcd('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x11a299,_0x398242[_0x7bcd('0x11')][_0x7bcd('0x13')]);return _0x351693(_0x398242[_0x7bcd('0x11')]['message']);}else{logger[_0x7bcd('0xc')](_0x7bcd('0xd'),_0x11a299,_0x7bcd('0xf'));_0x351693(_0x398242[_0x7bcd('0x14')][_0x7bcd('0x13')]);}})[_0x7bcd('0x15')](function(_0x20fa04){logger['error'](_0x7bcd('0xd'),_0x11a299,_0x20fa04);_0x587105(_0x20fa04);});});}exports[_0x7bcd('0x16')]=function(_0x40c61f){var _0x2d6675=this;return new Promise(function(_0x41071c,_0x4b3cfe){return db['VoiceDialReport']['create'](_0x40c61f[_0x7bcd('0x17')],{'raw':_0x40c61f[_0x7bcd('0x18')]?_0x40c61f[_0x7bcd('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x25cf3b){logger[_0x7bcd('0xc')](_0x7bcd('0x16'),_0x40c61f);logger[_0x7bcd('0xe')](_0x7bcd('0x16'),_0x40c61f,JSON['stringify'](_0x25cf3b));_0x41071c(_0x25cf3b);})[_0x7bcd('0x15')](function(_0x5dac87){logger[_0x7bcd('0x11')](_0x7bcd('0x16'),_0x5dac87['message'],_0x40c61f);_0x4b3cfe(_0x2d6675[_0x7bcd('0x11')](0x1f4,_0x5dac87[_0x7bcd('0x13')]));});});};exports[_0x7bcd('0x19')]=function(_0x5e1b78){var _0x4ecd9e=this;return new Promise(function(_0x22d7ed,_0x538672){return db[_0x7bcd('0x1a')][_0x7bcd('0x1b')](_0x5e1b78[_0x7bcd('0x17')],{'raw':_0x5e1b78['options']?_0x5e1b78[_0x7bcd('0x18')][_0x7bcd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e1b78[_0x7bcd('0x18')]?_0x5e1b78[_0x7bcd('0x18')]['where']||null:null,'attributes':_0x5e1b78[_0x7bcd('0x18')]?_0x5e1b78[_0x7bcd('0x18')][_0x7bcd('0x1d')]||null:null,'limit':_0x5e1b78[_0x7bcd('0x18')]?_0x5e1b78[_0x7bcd('0x18')][_0x7bcd('0x1e')]||null:null})[_0x7bcd('0x1f')](function(_0x58298f){logger[_0x7bcd('0xc')](_0x7bcd('0x19'),_0x5e1b78);logger['debug'](_0x7bcd('0x19'),_0x5e1b78,JSON['stringify'](_0x58298f));_0x22d7ed(_0x58298f);})['catch'](function(_0x284e71){logger['error'](_0x7bcd('0x19'),_0x284e71[_0x7bcd('0x13')],_0x5e1b78);_0x538672(_0x4ecd9e[_0x7bcd('0x11')](0x1f4,_0x284e71[_0x7bcd('0x13')]));});});}; \ No newline at end of file +var _0xcff1=['VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','body','where','attributes','limit','stringify','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xcff1,0xa6));var _0x1cff=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0xcff1[_0x5a7112];return _0x3147f7;};'use strict';var _=require(_0x1cff('0x0'));var util=require(_0x1cff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1cff('0x2'));var fs=require('fs');var Redis=require(_0x1cff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cff('0x4'));var logger=require(_0x1cff('0x5'))('rpc');var config=require(_0x1cff('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1cff('0x7')][_0x1cff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cecda,_0x4afe3e,_0x5ecd06){return new BPromise(function(_0xb44a42,_0x3bc435){return client[_0x1cff('0x9')](_0x5cecda,_0x5ecd06)['then'](function(_0x52f0e3){logger[_0x1cff('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x4afe3e,'request\x20sent');logger[_0x1cff('0xb')](_0x1cff('0xc'),_0x4afe3e,_0x1cff('0xd'),JSON['stringify'](_0x52f0e3));if(_0x52f0e3['error']){if(_0x52f0e3[_0x1cff('0xe')][_0x1cff('0xf')]===0x1f4){logger[_0x1cff('0xe')](_0x1cff('0x10'),_0x4afe3e,_0x52f0e3[_0x1cff('0xe')][_0x1cff('0x11')]);return _0x3bc435(_0x52f0e3[_0x1cff('0xe')][_0x1cff('0x11')]);}logger[_0x1cff('0xe')](_0x1cff('0x10'),_0x4afe3e,_0x52f0e3[_0x1cff('0xe')][_0x1cff('0x11')]);return _0xb44a42(_0x52f0e3[_0x1cff('0xe')][_0x1cff('0x11')]);}else{logger[_0x1cff('0xa')](_0x1cff('0x10'),_0x4afe3e,_0x1cff('0xd'));_0xb44a42(_0x52f0e3['result']['message']);}})[_0x1cff('0x12')](function(_0x1a92e0){logger[_0x1cff('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x4afe3e,_0x1a92e0);_0x3bc435(_0x1a92e0);});});}exports[_0x1cff('0x13')]=function(_0x198362){var _0x37847c=this;return new Promise(function(_0x3fe533,_0x3e4c86){return db[_0x1cff('0x14')][_0x1cff('0x15')](_0x198362['body'],{'raw':_0x198362[_0x1cff('0x16')]?_0x198362['options'][_0x1cff('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x414219){logger[_0x1cff('0xa')](_0x1cff('0x13'),_0x198362);logger[_0x1cff('0xb')](_0x1cff('0x13'),_0x198362,JSON['stringify'](_0x414219));_0x3fe533(_0x414219);})[_0x1cff('0x12')](function(_0x4dcd8b){logger[_0x1cff('0xe')]('CreateVoiceDialReport',_0x4dcd8b['message'],_0x198362);_0x3e4c86(_0x37847c[_0x1cff('0xe')](0x1f4,_0x4dcd8b[_0x1cff('0x11')]));});});};exports[_0x1cff('0x18')]=function(_0xce1523){var _0x5a52ef=this;return new Promise(function(_0x2822aa,_0x2ddba8){return db[_0x1cff('0x14')][_0x1cff('0x19')](_0xce1523[_0x1cff('0x1a')],{'raw':_0xce1523[_0x1cff('0x16')]?_0xce1523[_0x1cff('0x16')][_0x1cff('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce1523['options']?_0xce1523[_0x1cff('0x16')][_0x1cff('0x1b')]||null:null,'attributes':_0xce1523[_0x1cff('0x16')]?_0xce1523[_0x1cff('0x16')][_0x1cff('0x1c')]||null:null,'limit':_0xce1523[_0x1cff('0x16')]?_0xce1523[_0x1cff('0x16')][_0x1cff('0x1d')]||null:null})['then'](function(_0x3687a4){logger[_0x1cff('0xa')]('UpdateVoiceDialReport',_0xce1523);logger[_0x1cff('0xb')](_0x1cff('0x18'),_0xce1523,JSON[_0x1cff('0x1e')](_0x3687a4));_0x2822aa(_0x3687a4);})['catch'](function(_0x31089b){logger[_0x1cff('0xe')](_0x1cff('0x18'),_0x31089b[_0x1cff('0x11')],_0xce1523);_0x2ddba8(_0x5a52ef[_0x1cff('0xe')](0x1f4,_0x31089b[_0x1cff('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 870bc67..9c55852 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 _0x560f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','addApplications','put','update'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x560f,0x155));var _0xf560=function(_0x5bc9b5,_0x514d45){_0x5bc9b5=_0x5bc9b5-0x0;var _0x3dfe42=_0x560f[_0x5bc9b5];return _0x3dfe42;};'use strict';var multer=require(_0xf560('0x0'));var util=require(_0xf560('0x1'));var path=require(_0xf560('0x2'));var timeout=require(_0xf560('0x3'));var express=require(_0xf560('0x4'));var router=express[_0xf560('0x5')]();var fs_extra=require(_0xf560('0x6'));var auth=require(_0xf560('0x7'));var interaction=require(_0xf560('0x8'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xf560('0x9')]('/',auth[_0xf560('0xa')](),controller[_0xf560('0xb')]);router[_0xf560('0x9')](_0xf560('0xc'),auth[_0xf560('0xa')](),controller[_0xf560('0xd')]);router[_0xf560('0xe')]('/',auth[_0xf560('0xa')](),controller[_0xf560('0xf')]);router[_0xf560('0xe')]('/:id/applications',auth[_0xf560('0xa')](),controller[_0xf560('0x10')]);router[_0xf560('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf560('0x12')]);router['delete'](_0xf560('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xf560('0x13')]=router; \ No newline at end of file +var _0x50b2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','/:id','show','post','isAuthenticated','create','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x375d0f,_0x26c984){var _0x5e20aa=function(_0x215b82){while(--_0x215b82){_0x375d0f['push'](_0x375d0f['shift']());}};_0x5e20aa(++_0x26c984);}(_0x50b2,0x1f4));var _0x250b=function(_0x41e758,_0xc6ee4c){_0x41e758=_0x41e758-0x0;var _0x2d6eb5=_0x50b2[_0x41e758];return _0x2d6eb5;};'use strict';var multer=require(_0x250b('0x0'));var util=require(_0x250b('0x1'));var path=require(_0x250b('0x2'));var timeout=require(_0x250b('0x3'));var express=require(_0x250b('0x4'));var router=express[_0x250b('0x5')]();var fs_extra=require(_0x250b('0x6'));var auth=require(_0x250b('0x7'));var interaction=require(_0x250b('0x8'));var config=require(_0x250b('0x9'));var controller=require(_0x250b('0xa'));router[_0x250b('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x250b('0xb')](_0x250b('0xc'),auth['isAuthenticated'](),controller[_0x250b('0xd')]);router[_0x250b('0xe')]('/',auth[_0x250b('0xf')](),controller[_0x250b('0x10')]);router[_0x250b('0xe')]('/:id/applications',auth[_0x250b('0xf')](),controller[_0x250b('0x11')]);router[_0x250b('0x12')](_0x250b('0xc'),auth[_0x250b('0xf')](),controller[_0x250b('0x13')]);router[_0x250b('0x14')](_0x250b('0xc'),auth[_0x250b('0xf')](),controller[_0x250b('0x15')]);module[_0x250b('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 8a51dc0..35cad20 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 _0x32ef=['inbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','compositeIndex','STRING','NoOp','ENUM'];(function(_0x4cad64,_0x13a1d1){var _0x1ebb2d=function(_0x564d94){while(--_0x564d94){_0x4cad64['push'](_0x4cad64['shift']());}};_0x1ebb2d(++_0x13a1d1);}(_0x32ef,0xdc));var _0xf32e=function(_0x189532,_0x497143){_0x189532=_0x189532-0x0;var _0xd2c96a=_0x32ef[_0x189532];return _0xd2c96a;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf32e('0x0'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf32e('0x1')],'allowNull':![],'unique':_0xf32e('0x0')},'priority':{'type':Sequelize[_0xf32e('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xf32e('0x0')},'tag':{'type':Sequelize[_0xf32e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf32e('0x2')},'appdata':{'type':Sequelize[_0xf32e('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf32e('0x3')](_0xf32e('0x4'),'outbound','internal',_0xf32e('0x5'),_0xf32e('0x6'),'system',_0xf32e('0x7')),'allowNull':![]},'description':{'type':Sequelize[_0xf32e('0x1')]},'interval':{'type':Sequelize[_0xf32e('0x1')],'allowNull':![],'defaultValue':_0xf32e('0x8')},'IntervalId':{'type':Sequelize[_0xf32e('0x9')]},'isApp':{'type':Sequelize[_0xf32e('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xf32e('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf32e('0x9')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xf32e('0xb')},'answer':{'type':Sequelize[_0xf32e('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf32e('0xc')],'get':function(_0x254759){return this[_0xf32e('0xd')]('exten');}},'alias':{'type':Sequelize[_0xf32e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x2575=['inbound-fax','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x2575,0x190));var _0x5257=function(_0x51372a,_0x51b3c3){_0x51372a=_0x51372a-0x0;var _0x5107c2=_0x2575[_0x51372a];return _0x5107c2;};'use strict';var Sequelize=require(_0x5257('0x0'));module[_0x5257('0x1')]={'context':{'type':Sequelize[_0x5257('0x2')],'allowNull':![],'unique':_0x5257('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5257('0x2')],'allowNull':![],'unique':_0x5257('0x3')},'priority':{'type':Sequelize[_0x5257('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x5257('0x3')},'tag':{'type':Sequelize[_0x5257('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x5257('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5257('0x4')](_0x5257('0x5'),'outbound','internal',_0x5257('0x6'),'outbound-fax','system','any'),'allowNull':![]},'description':{'type':Sequelize[_0x5257('0x2')]},'interval':{'type':Sequelize[_0x5257('0x2')],'allowNull':![],'defaultValue':_0x5257('0x7')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x5257('0x8')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x5257('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x5257('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x5257('0x8')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5257('0x9')]},'recordingFormat':{'type':Sequelize[_0x5257('0x2')],'defaultValue':_0x5257('0xa')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x5257('0xb')],'get':function(_0x23429a){return this[_0x5257('0xc')](_0x5257('0xd'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 1dd3d66..958f7fd 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 _0xec45=['recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','status','offset','undefined','count','set','Content-Range','json','destroy','get','InboundRoutes','OutboundRoutes','InternalRoutes','internal','filter','ignore','type','find','name','UserProfileResource','then','sendStatus','error','index','VoiceExtension','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','value','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description'];(function(_0x1cca82,_0x5c2d29){var _0xe5527d=function(_0x308708){while(--_0x308708){_0x1cca82['push'](_0x1cca82['shift']());}};_0xe5527d(++_0x5c2d29);}(_0xec45,0x6c));var _0x5ec4=function(_0x403994,_0x10a131){_0x403994=_0x403994-0x0;var _0x175751=_0xec45[_0x403994];return _0x175751;};'use strict';var _=require(_0x5ec4('0x0'));var Redis=require(_0x5ec4('0x1'));var qs=require(_0x5ec4('0x2'));var logger=require(_0x5ec4('0x3'))('api');var config=require(_0x5ec4('0x4'));var db=require(_0x5ec4('0x5'))['db'];config[_0x5ec4('0x6')]=_[_0x5ec4('0x7')](config[_0x5ec4('0x6')],{'host':_0x5ec4('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5ec4('0x9'))[_0x5ec4('0xa')](socket);function respondWithStatusCode(_0x18aa90,_0x37661d){_0x37661d=_0x37661d||0xcc;return function(_0x425e1b){if(_0x425e1b){return _0x18aa90['sendStatus'](_0x37661d);}return _0x18aa90[_0x5ec4('0xb')](_0x37661d)['end']();};}function respondWithResult(_0x15e21d,_0x4a2e30){_0x4a2e30=_0x4a2e30||0xc8;return function(_0x292b51){if(_0x292b51){return _0x15e21d[_0x5ec4('0xb')](_0x4a2e30)['json'](_0x292b51);}};}function respondWithFilteredResult(_0x349a38,_0x53fcd5){return function(_0x2559ed){if(_0x2559ed){var _0x5a92cc=typeof _0x53fcd5[_0x5ec4('0xc')]===_0x5ec4('0xd')&&typeof _0x53fcd5['limit']===_0x5ec4('0xd');var _0x58b486=_0x2559ed[_0x5ec4('0xe')];var _0x288f3a=_0x5a92cc?0x0:_0x53fcd5[_0x5ec4('0xc')];var _0x2548f4=_0x5a92cc?_0x2559ed[_0x5ec4('0xe')]:_0x53fcd5[_0x5ec4('0xc')]+_0x53fcd5['limit'];var _0x4b2fd7;if(_0x2548f4>=_0x58b486){_0x2548f4=_0x58b486;_0x4b2fd7=0xc8;}else{_0x4b2fd7=0xce;}_0x349a38['status'](_0x4b2fd7);return _0x349a38[_0x5ec4('0xf')](_0x5ec4('0x10'),_0x288f3a+'-'+_0x2548f4+'/'+_0x58b486)[_0x5ec4('0x11')](_0x2559ed);}return null;};}function removeEntity(_0x4cc63a){return function(_0x3c83c6){if(_0x3c83c6){return _0x3c83c6[_0x5ec4('0x12')]()['then'](function(){var _0x9c400b=_0x3c83c6[_0x5ec4('0x13')]({'plain':!![]});var _0x302c6b=[{'name':_0x5ec4('0x14'),'value':'inbound','ignore':![]},{'name':_0x5ec4('0x15'),'value':'outbound','ignore':![]},{'name':_0x5ec4('0x16'),'value':_0x5ec4('0x17'),'ignore':![]}];var _0x5b6288=_(_0x302c6b)[_0x5ec4('0x18')](_0x5ec4('0x19'))['map']('value')['value']();if(_['includes'](_0x5b6288,_0x9c400b[_0x5ec4('0x1a')])){return;}var _0x602a25=_[_0x5ec4('0x1b')](_0x302c6b,['value',_0x9c400b['type']])[_0x5ec4('0x1c')];return db[_0x5ec4('0x1d')][_0x5ec4('0x12')]({'where':{'type':_0x602a25,'resourceId':_0x9c400b['id']}})[_0x5ec4('0x1e')](function(){return _0x3c83c6;});})[_0x5ec4('0x1e')](function(){_0x4cc63a[_0x5ec4('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2966ad){return function(_0x186e62){if(!_0x186e62){_0x2966ad[_0x5ec4('0x1f')](0x194);}return _0x186e62;};}function handleError(_0x2581be,_0x22ada9){_0x22ada9=_0x22ada9||0x1f4;return function(_0x1a3102){logger[_0x5ec4('0x20')](_0x1a3102['stack']);if(_0x1a3102[_0x5ec4('0x1c')]){delete _0x1a3102[_0x5ec4('0x1c')];}_0x2581be[_0x5ec4('0xb')](_0x22ada9)['send'](_0x1a3102);};}exports[_0x5ec4('0x21')]=function(_0x36cf5f,_0x13abb8){var _0x34a208={},_0x150937={},_0x438a5f={'count':0x0,'rows':[]};var _0x12afd8=_['map'](db[_0x5ec4('0x22')][_0x5ec4('0x23')],function(_0x330121){return{'name':_0x330121['fieldName'],'type':_0x330121[_0x5ec4('0x1a')][_0x5ec4('0x24')]};});_0x150937[_0x5ec4('0x25')]=_[_0x5ec4('0x26')](_0x12afd8,_0x5ec4('0x1c'));_0x150937[_0x5ec4('0x27')]=_[_0x5ec4('0x28')](_0x36cf5f['query']);_0x150937[_0x5ec4('0x29')]=_['intersection'](_0x150937['model'],_0x150937[_0x5ec4('0x27')]);_0x34a208[_0x5ec4('0x2a')]=_[_0x5ec4('0x2b')](_0x150937[_0x5ec4('0x25')],qs['fields'](_0x36cf5f[_0x5ec4('0x27')][_0x5ec4('0x2c')]));_0x34a208[_0x5ec4('0x2a')]=_0x34a208[_0x5ec4('0x2a')][_0x5ec4('0x2d')]?_0x34a208[_0x5ec4('0x2a')]:_0x150937[_0x5ec4('0x25')];if(!_0x36cf5f[_0x5ec4('0x27')][_0x5ec4('0x2e')](_0x5ec4('0x2f'))){_0x34a208[_0x5ec4('0x30')]=qs[_0x5ec4('0x30')](_0x36cf5f[_0x5ec4('0x27')]['limit']);_0x34a208[_0x5ec4('0xc')]=qs['offset'](_0x36cf5f[_0x5ec4('0x27')]['offset']);}_0x34a208[_0x5ec4('0x31')]=qs[_0x5ec4('0x32')](_0x36cf5f[_0x5ec4('0x27')][_0x5ec4('0x32')]);_0x34a208['where']=qs[_0x5ec4('0x29')](_['pick'](_0x36cf5f[_0x5ec4('0x27')],_0x150937['filters']),_0x12afd8);if(_0x36cf5f[_0x5ec4('0x27')][_0x5ec4('0x18')]){_0x34a208[_0x5ec4('0x33')]=_[_0x5ec4('0x34')](_0x34a208[_0x5ec4('0x33')],{'$or':_['map'](_0x12afd8,function(_0x41b5cf){if(_0x41b5cf['type']!==_0x5ec4('0x35')){var _0x1c11d6={};_0x1c11d6[_0x41b5cf[_0x5ec4('0x1c')]]={'$like':'%'+_0x36cf5f[_0x5ec4('0x27')]['filter']+'%'};return _0x1c11d6;}})});}_0x34a208=_['merge']({},_0x34a208,_0x36cf5f[_0x5ec4('0x36')]);var _0x294105={'where':_0x34a208[_0x5ec4('0x33')]};return db['VoiceExtension'][_0x5ec4('0xe')](_0x294105)[_0x5ec4('0x1e')](function(_0x18d809){_0x438a5f[_0x5ec4('0xe')]=_0x18d809;if(_0x36cf5f[_0x5ec4('0x27')][_0x5ec4('0x37')]){_0x34a208[_0x5ec4('0x38')]=[{'all':!![]}];}return db[_0x5ec4('0x22')][_0x5ec4('0x39')](_0x34a208);})[_0x5ec4('0x1e')](function(_0x293b64){_0x438a5f[_0x5ec4('0x3a')]=_0x293b64;return _0x438a5f;})[_0x5ec4('0x1e')](respondWithFilteredResult(_0x13abb8,_0x34a208))[_0x5ec4('0x3b')](handleError(_0x13abb8,null));};exports[_0x5ec4('0x3c')]=function(_0x475c39,_0x2615c3){var _0x48f203={'raw':![],'where':{'id':_0x475c39[_0x5ec4('0x3d')]['id']}},_0x48facb={};_0x48facb[_0x5ec4('0x25')]=_['keys'](db['VoiceExtension'][_0x5ec4('0x23')]);_0x48facb[_0x5ec4('0x27')]=_[_0x5ec4('0x28')](_0x475c39['query']);_0x48facb[_0x5ec4('0x29')]=_[_0x5ec4('0x2b')](_0x48facb[_0x5ec4('0x25')],_0x48facb[_0x5ec4('0x27')]);_0x48f203[_0x5ec4('0x2a')]=_[_0x5ec4('0x2b')](_0x48facb[_0x5ec4('0x25')],qs[_0x5ec4('0x2c')](_0x475c39[_0x5ec4('0x27')][_0x5ec4('0x2c')]));_0x48f203['attributes']=_0x48f203['attributes']['length']?_0x48f203['attributes']:_0x48facb[_0x5ec4('0x25')];if(_0x475c39[_0x5ec4('0x27')][_0x5ec4('0x37')]){_0x48f203[_0x5ec4('0x38')]=[{'all':!![]}];}_0x48f203=_[_0x5ec4('0x34')]({},_0x48f203,_0x475c39['options']);return db[_0x5ec4('0x22')][_0x5ec4('0x1b')](_0x48f203)[_0x5ec4('0x1e')](handleEntityNotFound(_0x2615c3,null))[_0x5ec4('0x1e')](respondWithResult(_0x2615c3,null))[_0x5ec4('0x3b')](handleError(_0x2615c3,null));};exports[_0x5ec4('0x12')]=function(_0x50df32,_0x15d626){return db['VoiceExtension'][_0x5ec4('0x1b')]({'where':{'id':_0x50df32['params']['id']}})[_0x5ec4('0x1e')](handleEntityNotFound(_0x15d626,null))[_0x5ec4('0x1e')](removeEntity(_0x15d626,null))['catch'](handleError(_0x15d626,null));};exports[_0x5ec4('0x3e')]=function(_0x6f34c2,_0x4466b1){if(_0x6f34c2[_0x5ec4('0x3f')][_0x5ec4('0x1a')]===_0x5ec4('0x40')&&!_[_0x5ec4('0x41')](_0x6f34c2['body'][_0x5ec4('0x42')],'_')){_0x6f34c2['body'][_0x5ec4('0x42')]='_'[_0x5ec4('0x43')](_0x6f34c2[_0x5ec4('0x3f')][_0x5ec4('0x42')]);}return db[_0x5ec4('0x22')][_0x5ec4('0x3e')](_0x6f34c2['body'],{'raw':![]})[_0x5ec4('0x1e')](function(_0x69bda8){var _0x13b7ca=_0x6f34c2[_0x5ec4('0x44')][_0x5ec4('0x13')]({'plain':!![]});if(!_0x13b7ca)throw new Error(_0x5ec4('0x45'));if(_0x13b7ca['role']===_0x5ec4('0x44')){var _0x154d00=_0x69bda8['get']({'plain':!![]});var _0x57d85f=[{'name':_0x5ec4('0x14'),'value':_0x5ec4('0x46')},{'name':_0x5ec4('0x15'),'value':_0x5ec4('0x40')},{'name':_0x5ec4('0x16'),'value':'internal'}];var _0x1413be=_[_0x5ec4('0x1b')](_0x57d85f,[_0x5ec4('0x47'),_0x154d00[_0x5ec4('0x1a')]])['name'];return db[_0x5ec4('0x48')][_0x5ec4('0x1b')]({'where':{'name':_0x1413be,'userProfileId':_0x13b7ca[_0x5ec4('0x49')]},'raw':!![]})['then'](function(_0x4e4f09){if(_0x4e4f09&&_0x4e4f09[_0x5ec4('0x4a')]===0x0){return db[_0x5ec4('0x1d')][_0x5ec4('0x3e')]({'name':_0x154d00['name'],'resourceId':_0x154d00['id'],'type':_0x4e4f09[_0x5ec4('0x1c')],'sectionId':_0x4e4f09['id']},{})[_0x5ec4('0x1e')](function(){return _0x69bda8;});}else{return _0x69bda8;}})[_0x5ec4('0x3b')](function(_0x4ec765){logger[_0x5ec4('0x20')](_0x5ec4('0x4b'),_0x4ec765);throw _0x4ec765;});}return _0x69bda8;})[_0x5ec4('0x1e')](respondWithResult(_0x4466b1,0xc9))[_0x5ec4('0x3b')](handleError(_0x4466b1,null));};exports['update']=function(_0x4ebdb5,_0x41cf3d){if(_0x4ebdb5[_0x5ec4('0x3f')]['id']){delete _0x4ebdb5[_0x5ec4('0x3f')]['id'];}return db[_0x5ec4('0x22')][_0x5ec4('0x1b')]({'where':{'id':_0x4ebdb5[_0x5ec4('0x3d')]['id']}})[_0x5ec4('0x1e')](handleEntityNotFound(_0x41cf3d,null))[_0x5ec4('0x1e')](function(_0x5e2617){if(_0x5e2617){return db[_0x5ec4('0x22')][_0x5ec4('0x4c')](_[_0x5ec4('0x4d')](_0x4ebdb5['body'],['exten',_0x5ec4('0x4e'),_0x5ec4('0x4f'),_0x5ec4('0x50'),_0x5ec4('0x51'),_0x5ec4('0x52'),_0x5ec4('0x53')]),{'where':{'context':_0x5e2617['context'],'exten':_0x5e2617['exten']},'individualHooks':!![]})['then'](function(_0x482427){return _0x482427;});}return null;})[_0x5ec4('0x1e')](respondWithStatusCode(_0x41cf3d,null))[_0x5ec4('0x3b')](handleError(_0x41cf3d,null));};exports[_0x5ec4('0x54')]=function(_0x248ad5,_0x54e7f7){var _0x12df9f=_0x248ad5['params']['id'];var _0x247bfa=_0x248ad5[_0x5ec4('0x3f')];var _0xd6c1fb=0xc8;var _0x48bcab=null;return db[_0x5ec4('0x55')]['transaction']({'isolationLevel':db[_0x5ec4('0x55')]['Transaction']['ISOLATION_LEVELS'][_0x5ec4('0x56')]},function(_0x5ec952){return db[_0x5ec4('0x22')]['findOne']({'where':{'id':_0x12df9f},'transaction':_0x5ec952})[_0x5ec4('0x1e')](function(_0x2719bc){if(_0x2719bc){return db[_0x5ec4('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x12df9f},'transaction':_0x5ec952})['then'](function(){var _0xe1e9ba=_['map'](_0x247bfa,function(_0x5ff30c){_0x5ff30c[_0x5ec4('0x57')]=_0x12df9f;_0x5ff30c[_0x5ec4('0x58')]=!![];return _0x5ff30c;});return _0x2719bc['createRouting'](_0xe1e9ba);})[_0x5ec4('0x1e')](function(_0x219d8e){return db[_0x5ec4('0x22')][_0x5ec4('0x59')](_0x219d8e,{'transaction':_0x5ec952});});}else{_0xd6c1fb=0x194;_0x48bcab=[];}});})[_0x5ec4('0x1e')](function(){if(_0xd6c1fb!==0x194){return db['VoiceExtension'][_0x5ec4('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x12df9f},'order':_0x5ec4('0x5b')})[_0x5ec4('0x1e')](function(_0x237eea){_0x48bcab=_0x237eea;});}})[_0x5ec4('0x3b')](function(_0x1f76d0){_0xd6c1fb=0x1f4;logger['error'](_0x1f76d0[_0x5ec4('0x5c')]);if(_0x1f76d0['name']){delete _0x1f76d0[_0x5ec4('0x1c')];}_0x48bcab=_0x1f76d0;})['finally'](function(){if(_0x48bcab===null){_0x54e7f7['sendStatus'](_0xd6c1fb);}else{if(_0xd6c1fb===0x1f4){_0x54e7f7[_0x5ec4('0xb')](_0xd6c1fb)[_0x5ec4('0x5d')](_0x48bcab);}else{_0x54e7f7[_0x5ec4('0xb')](_0xd6c1fb)[_0x5ec4('0x11')](_0x48bcab);}}});}; \ No newline at end of file +var _0xa5bf=['end','json','undefined','count','offset','limit','set','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','find','type','name','UserProfileResource','destroy','sendStatus','error','stack','send','index','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','show','params','keys','rawAttributes','catch','body','startsWith','exten','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa5bf,0x111));var _0xfa5b=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xa5bf[_0x543084];return _0x306a57;};'use strict';var _=require(_0xfa5b('0x0'));var Redis=require('ioredis');var qs=require(_0xfa5b('0x1'));var logger=require(_0xfa5b('0x2'))(_0xfa5b('0x3'));var config=require(_0xfa5b('0x4'));var db=require(_0xfa5b('0x5'))['db'];config[_0xfa5b('0x6')]=_[_0xfa5b('0x7')](config[_0xfa5b('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa5b('0x8'))(new Redis(config['redis']));require(_0xfa5b('0x9'))[_0xfa5b('0xa')](socket);function respondWithStatusCode(_0x5e67fc,_0x31d1b8){_0x31d1b8=_0x31d1b8||0xcc;return function(_0x1e605a){if(_0x1e605a){return _0x5e67fc['sendStatus'](_0x31d1b8);}return _0x5e67fc[_0xfa5b('0xb')](_0x31d1b8)[_0xfa5b('0xc')]();};}function respondWithResult(_0x5c6316,_0x1fe496){_0x1fe496=_0x1fe496||0xc8;return function(_0x39ea08){if(_0x39ea08){return _0x5c6316['status'](_0x1fe496)[_0xfa5b('0xd')](_0x39ea08);}};}function respondWithFilteredResult(_0x2fcf9d,_0x35fc68){return function(_0x332be1){if(_0x332be1){var _0x3fafc2=typeof _0x35fc68['offset']===_0xfa5b('0xe')&&typeof _0x35fc68['limit']===_0xfa5b('0xe');var _0x44354c=_0x332be1[_0xfa5b('0xf')];var _0x1a7ead=_0x3fafc2?0x0:_0x35fc68[_0xfa5b('0x10')];var _0x38cac2=_0x3fafc2?_0x332be1[_0xfa5b('0xf')]:_0x35fc68[_0xfa5b('0x10')]+_0x35fc68[_0xfa5b('0x11')];var _0x157afc;if(_0x38cac2>=_0x44354c){_0x38cac2=_0x44354c;_0x157afc=0xc8;}else{_0x157afc=0xce;}_0x2fcf9d[_0xfa5b('0xb')](_0x157afc);return _0x2fcf9d[_0xfa5b('0x12')](_0xfa5b('0x13'),_0x1a7ead+'-'+_0x38cac2+'/'+_0x44354c)[_0xfa5b('0xd')](_0x332be1);}return null;};}function removeEntity(_0x4639d9){return function(_0x5f2329){if(_0x5f2329){return _0x5f2329['destroy']()[_0xfa5b('0x14')](function(){var _0x86c970=_0x5f2329[_0xfa5b('0x15')]({'plain':!![]});var _0x4ca797=[{'name':_0xfa5b('0x16'),'value':_0xfa5b('0x17'),'ignore':![]},{'name':_0xfa5b('0x18'),'value':_0xfa5b('0x19'),'ignore':![]},{'name':_0xfa5b('0x1a'),'value':_0xfa5b('0x1b'),'ignore':![]}];var _0x23815e=_(_0x4ca797)[_0xfa5b('0x1c')]('ignore')[_0xfa5b('0x1d')](_0xfa5b('0x1e'))[_0xfa5b('0x1e')]();if(_['includes'](_0x23815e,_0x86c970['type'])){return;}var _0x3b235c=_[_0xfa5b('0x1f')](_0x4ca797,[_0xfa5b('0x1e'),_0x86c970[_0xfa5b('0x20')]])[_0xfa5b('0x21')];return db[_0xfa5b('0x22')][_0xfa5b('0x23')]({'where':{'type':_0x3b235c,'resourceId':_0x86c970['id']}})['then'](function(){return _0x5f2329;});})[_0xfa5b('0x14')](function(){_0x4639d9[_0xfa5b('0xb')](0xcc)[_0xfa5b('0xc')]();});}};}function handleEntityNotFound(_0x777558){return function(_0x5c4369){if(!_0x5c4369){_0x777558[_0xfa5b('0x24')](0x194);}return _0x5c4369;};}function handleError(_0x45bd31,_0x568a3f){_0x568a3f=_0x568a3f||0x1f4;return function(_0xa2f9d1){logger[_0xfa5b('0x25')](_0xa2f9d1[_0xfa5b('0x26')]);if(_0xa2f9d1[_0xfa5b('0x21')]){delete _0xa2f9d1['name'];}_0x45bd31[_0xfa5b('0xb')](_0x568a3f)[_0xfa5b('0x27')](_0xa2f9d1);};}exports[_0xfa5b('0x28')]=function(_0x29b9e1,_0x12ec14){var _0x21e132={},_0x4d8797={},_0x199ffc={'count':0x0,'rows':[]};var _0x442454=_['map'](db['VoiceExtension']['rawAttributes'],function(_0x172c76){return{'name':_0x172c76['fieldName'],'type':_0x172c76[_0xfa5b('0x20')][_0xfa5b('0x29')]};});_0x4d8797[_0xfa5b('0x2a')]=_[_0xfa5b('0x1d')](_0x442454,_0xfa5b('0x21'));_0x4d8797[_0xfa5b('0x2b')]=_['keys'](_0x29b9e1[_0xfa5b('0x2b')]);_0x4d8797[_0xfa5b('0x2c')]=_[_0xfa5b('0x2d')](_0x4d8797[_0xfa5b('0x2a')],_0x4d8797['query']);_0x21e132['attributes']=_[_0xfa5b('0x2d')](_0x4d8797[_0xfa5b('0x2a')],qs[_0xfa5b('0x2e')](_0x29b9e1['query'][_0xfa5b('0x2e')]));_0x21e132[_0xfa5b('0x2f')]=_0x21e132[_0xfa5b('0x2f')][_0xfa5b('0x30')]?_0x21e132[_0xfa5b('0x2f')]:_0x4d8797[_0xfa5b('0x2a')];if(!_0x29b9e1['query']['hasOwnProperty'](_0xfa5b('0x31'))){_0x21e132[_0xfa5b('0x11')]=qs[_0xfa5b('0x11')](_0x29b9e1['query'][_0xfa5b('0x11')]);_0x21e132['offset']=qs[_0xfa5b('0x10')](_0x29b9e1[_0xfa5b('0x2b')]['offset']);}_0x21e132[_0xfa5b('0x32')]=qs[_0xfa5b('0x33')](_0x29b9e1[_0xfa5b('0x2b')][_0xfa5b('0x33')]);_0x21e132[_0xfa5b('0x34')]=qs[_0xfa5b('0x2c')](_[_0xfa5b('0x35')](_0x29b9e1['query'],_0x4d8797['filters']),_0x442454);if(_0x29b9e1['query'][_0xfa5b('0x1c')]){_0x21e132['where']=_[_0xfa5b('0x36')](_0x21e132[_0xfa5b('0x34')],{'$or':_[_0xfa5b('0x1d')](_0x442454,function(_0x4f3c05){if(_0x4f3c05[_0xfa5b('0x20')]!==_0xfa5b('0x37')){var _0x4e1ce2={};_0x4e1ce2[_0x4f3c05[_0xfa5b('0x21')]]={'$like':'%'+_0x29b9e1[_0xfa5b('0x2b')][_0xfa5b('0x1c')]+'%'};return _0x4e1ce2;}})});}_0x21e132=_[_0xfa5b('0x36')]({},_0x21e132,_0x29b9e1[_0xfa5b('0x38')]);var _0x492cc6={'where':_0x21e132[_0xfa5b('0x34')]};return db[_0xfa5b('0x39')]['count'](_0x492cc6)[_0xfa5b('0x14')](function(_0x25c040){_0x199ffc[_0xfa5b('0xf')]=_0x25c040;if(_0x29b9e1['query'][_0xfa5b('0x3a')]){_0x21e132[_0xfa5b('0x3b')]=[{'all':!![]}];}return db[_0xfa5b('0x39')][_0xfa5b('0x3c')](_0x21e132);})['then'](function(_0x75df63){_0x199ffc['rows']=_0x75df63;return _0x199ffc;})[_0xfa5b('0x14')](respondWithFilteredResult(_0x12ec14,_0x21e132))['catch'](handleError(_0x12ec14,null));};exports[_0xfa5b('0x3d')]=function(_0x59289a,_0x347ace){var _0x50be73={'raw':![],'where':{'id':_0x59289a[_0xfa5b('0x3e')]['id']}},_0x2e38f2={};_0x2e38f2['model']=_[_0xfa5b('0x3f')](db[_0xfa5b('0x39')][_0xfa5b('0x40')]);_0x2e38f2[_0xfa5b('0x2b')]=_[_0xfa5b('0x3f')](_0x59289a[_0xfa5b('0x2b')]);_0x2e38f2[_0xfa5b('0x2c')]=_[_0xfa5b('0x2d')](_0x2e38f2[_0xfa5b('0x2a')],_0x2e38f2[_0xfa5b('0x2b')]);_0x50be73[_0xfa5b('0x2f')]=_[_0xfa5b('0x2d')](_0x2e38f2['model'],qs[_0xfa5b('0x2e')](_0x59289a['query'][_0xfa5b('0x2e')]));_0x50be73[_0xfa5b('0x2f')]=_0x50be73['attributes']['length']?_0x50be73['attributes']:_0x2e38f2['model'];if(_0x59289a['query'][_0xfa5b('0x3a')]){_0x50be73[_0xfa5b('0x3b')]=[{'all':!![]}];}_0x50be73=_[_0xfa5b('0x36')]({},_0x50be73,_0x59289a[_0xfa5b('0x38')]);return db['VoiceExtension'][_0xfa5b('0x1f')](_0x50be73)[_0xfa5b('0x14')](handleEntityNotFound(_0x347ace,null))[_0xfa5b('0x14')](respondWithResult(_0x347ace,null))[_0xfa5b('0x41')](handleError(_0x347ace,null));};exports[_0xfa5b('0x23')]=function(_0xa8fb18,_0x150998){return db[_0xfa5b('0x39')][_0xfa5b('0x1f')]({'where':{'id':_0xa8fb18[_0xfa5b('0x3e')]['id']}})[_0xfa5b('0x14')](handleEntityNotFound(_0x150998,null))[_0xfa5b('0x14')](removeEntity(_0x150998,null))[_0xfa5b('0x41')](handleError(_0x150998,null));};exports['create']=function(_0x14ec36,_0x1bc0d3){if(_0x14ec36[_0xfa5b('0x42')]['type']===_0xfa5b('0x19')&&!_[_0xfa5b('0x43')](_0x14ec36[_0xfa5b('0x42')][_0xfa5b('0x44')],'_')){_0x14ec36['body'][_0xfa5b('0x44')]='_'['concat'](_0x14ec36[_0xfa5b('0x42')][_0xfa5b('0x44')]);}return db[_0xfa5b('0x39')][_0xfa5b('0x45')](_0x14ec36[_0xfa5b('0x42')],{'raw':![]})[_0xfa5b('0x14')](function(_0x2803b3){var _0x20f43b=_0x14ec36['user']['get']({'plain':!![]});if(!_0x20f43b)throw new Error(_0xfa5b('0x46'));if(_0x20f43b[_0xfa5b('0x47')]===_0xfa5b('0x48')){var _0x1c3f41=_0x2803b3['get']({'plain':!![]});var _0x220a10=[{'name':_0xfa5b('0x16'),'value':'inbound'},{'name':_0xfa5b('0x18'),'value':_0xfa5b('0x19')},{'name':_0xfa5b('0x1a'),'value':_0xfa5b('0x1b')}];var _0xbd33e7=_[_0xfa5b('0x1f')](_0x220a10,[_0xfa5b('0x1e'),_0x1c3f41[_0xfa5b('0x20')]])[_0xfa5b('0x21')];return db[_0xfa5b('0x49')][_0xfa5b('0x1f')]({'where':{'name':_0xbd33e7,'userProfileId':_0x20f43b[_0xfa5b('0x4a')]},'raw':!![]})[_0xfa5b('0x14')](function(_0x1c0709){if(_0x1c0709&&_0x1c0709[_0xfa5b('0x4b')]===0x0){return db[_0xfa5b('0x22')][_0xfa5b('0x45')]({'name':_0x1c3f41[_0xfa5b('0x21')],'resourceId':_0x1c3f41['id'],'type':_0x1c0709['name'],'sectionId':_0x1c0709['id']},{})[_0xfa5b('0x14')](function(){return _0x2803b3;});}else{return _0x2803b3;}})['catch'](function(_0x2475ca){logger['error'](_0xfa5b('0x4c'),_0x2475ca);throw _0x2475ca;});}return _0x2803b3;})[_0xfa5b('0x14')](respondWithResult(_0x1bc0d3,0xc9))[_0xfa5b('0x41')](handleError(_0x1bc0d3,null));};exports[_0xfa5b('0x4d')]=function(_0xfa547b,_0x536ce2){if(_0xfa547b[_0xfa5b('0x42')]['id']){delete _0xfa547b[_0xfa5b('0x42')]['id'];}return db[_0xfa5b('0x39')][_0xfa5b('0x1f')]({'where':{'id':_0xfa547b[_0xfa5b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x536ce2,null))[_0xfa5b('0x14')](function(_0x8bbe73){if(_0x8bbe73){return db[_0xfa5b('0x39')]['update'](_[_0xfa5b('0x35')](_0xfa547b[_0xfa5b('0x42')],[_0xfa5b('0x44'),'context',_0xfa5b('0x4e'),_0xfa5b('0x4f'),_0xfa5b('0x50'),_0xfa5b('0x51'),'alias']),{'where':{'context':_0x8bbe73[_0xfa5b('0x52')],'exten':_0x8bbe73[_0xfa5b('0x44')]},'individualHooks':!![]})[_0xfa5b('0x14')](function(_0x1df647){return _0x1df647;});}return null;})['then'](respondWithStatusCode(_0x536ce2,null))[_0xfa5b('0x41')](handleError(_0x536ce2,null));};exports[_0xfa5b('0x53')]=function(_0x49544f,_0x8b816){var _0x3f354c=_0x49544f['params']['id'];var _0x2634af=_0x49544f[_0xfa5b('0x42')];var _0xa58e04=0xc8;var _0x437d84=null;return db['sequelize'][_0xfa5b('0x54')]({'isolationLevel':db[_0xfa5b('0x55')][_0xfa5b('0x56')][_0xfa5b('0x57')][_0xfa5b('0x58')]},function(_0x5041cc){return db['VoiceExtension']['findOne']({'where':{'id':_0x3f354c},'transaction':_0x5041cc})[_0xfa5b('0x14')](function(_0x1441c8){if(_0x1441c8){return db['VoiceExtension'][_0xfa5b('0x23')]({'where':{'VoiceExtensionId':_0x3f354c},'transaction':_0x5041cc})[_0xfa5b('0x14')](function(){var _0x543492=_[_0xfa5b('0x1d')](_0x2634af,function(_0xda62a8){_0xda62a8[_0xfa5b('0x59')]=_0x3f354c;_0xda62a8[_0xfa5b('0x5a')]=!![];return _0xda62a8;});return _0x1441c8['createRouting'](_0x543492);})[_0xfa5b('0x14')](function(_0x32cd44){return db[_0xfa5b('0x39')][_0xfa5b('0x5b')](_0x32cd44,{'transaction':_0x5041cc});});}else{_0xa58e04=0x194;_0x437d84=[];}});})[_0xfa5b('0x14')](function(){if(_0xa58e04!==0x194){return db[_0xfa5b('0x39')][_0xfa5b('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3f354c},'order':_0xfa5b('0x5d')})['then'](function(_0x4c1eba){_0x437d84=_0x4c1eba;});}})[_0xfa5b('0x41')](function(_0x259a09){_0xa58e04=0x1f4;logger[_0xfa5b('0x25')](_0x259a09[_0xfa5b('0x26')]);if(_0x259a09[_0xfa5b('0x21')]){delete _0x259a09[_0xfa5b('0x21')];}_0x437d84=_0x259a09;})[_0xfa5b('0x5e')](function(){if(_0x437d84===null){_0x8b816[_0xfa5b('0x24')](_0xa58e04);}else{if(_0xa58e04===0x1f4){_0x8b816[_0xfa5b('0xb')](_0xa58e04)[_0xfa5b('0x27')](_0x437d84);}else{_0x8b816[_0xfa5b('0xb')](_0xa58e04)[_0xfa5b('0xd')](_0x437d84);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 084162e..32a2d1a 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 _0x597c=['remove','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x37a9fb,_0x101bcc){var _0x4f0571=function(_0x479d10){while(--_0x479d10){_0x37a9fb['push'](_0x37a9fb['shift']());}};_0x4f0571(++_0x101bcc);}(_0x597c,0x92));var _0xc597=function(_0x5a702e,_0x5f5c55){_0x5a702e=_0x5a702e-0x0;var _0x3ed709=_0x597c[_0x5a702e];return _0x3ed709;};'use strict';var EventEmitter=require(_0xc597('0x0'));var VoiceExtension=require(_0xc597('0x1'))['db'][_0xc597('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc597('0x3')](0x0);var events={'afterCreate':_0xc597('0x4'),'afterUpdate':_0xc597('0x5'),'afterDestroy':_0xc597('0x6')};function emitEvent(_0x4189f0){return function(_0x2133c8,_0x3d4eca,_0x2a9ebd){VoiceExtensionEvents['emit'](_0x4189f0+':'+_0x2133c8['id'],_0x2133c8);VoiceExtensionEvents['emit'](_0x4189f0,_0x2133c8);_0x2a9ebd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xc597('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xdd11=['events','VoiceExtension','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x27954f,_0x432ceb){var _0x9f7af3=function(_0x390c81){while(--_0x390c81){_0x27954f['push'](_0x27954f['shift']());}};_0x9f7af3(++_0x432ceb);}(_0xdd11,0x19e));var _0x1dd1=function(_0x8957d,_0x1a2301){_0x8957d=_0x8957d-0x0;var _0x33f12f=_0xdd11[_0x8957d];return _0x33f12f;};'use strict';var EventEmitter=require(_0x1dd1('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x1dd1('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1dd1('0x2'),'afterUpdate':_0x1dd1('0x3'),'afterDestroy':_0x1dd1('0x4')};function emitEvent(_0x291504){return function(_0xc903a8,_0x34c17b,_0x5c1619){VoiceExtensionEvents[_0x1dd1('0x5')](_0x291504+':'+_0xc903a8['id'],_0xc903a8);VoiceExtensionEvents[_0x1dd1('0x5')](_0x291504,_0xc903a8);_0x5c1619(null);};}for(var e in events){if(events[_0x1dd1('0x6')](e)){var event=events[e];VoiceExtension[_0x1dd1('0x7')](e,emitEvent(event));}}module[_0x1dd1('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 9718522..bdf98aa 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 _0xb681=['CDR(routeAlias)=','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','timeout','options','url','split','length','trunk','phone','param','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','VoiceExtension','get','concat','Hangup','models','Set','CDR(type)=','type','exten','alias','NoOp'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb681,0x1f1));var _0x1b68=function(_0x2f22a8,_0x31ddf8){_0x2f22a8=_0x2f22a8-0x0;var _0x556f8b=_0xb681[_0x2f22a8];return _0x556f8b;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x2cc050){var _0x465420=_0x2cc050[_0x1b68('0x0')];function _0x57e3c3(_0x415ff5){var _0x3c7e64=0x2;var _0x57fab8=[{'type':_0x415ff5['type'],'app':_0x1b68('0x1'),'appdata':_0x1b68('0x2')+_0x415ff5[_0x1b68('0x3')],'context':_0x415ff5['context'],'exten':_0x415ff5[_0x1b68('0x4')],'priority':_0x3c7e64++,'VoiceExtensionId':_0x415ff5['id']},{'type':_0x415ff5['type'],'app':_0x415ff5[_0x1b68('0x5')]?'Set':_0x1b68('0x6'),'appdata':_0x415ff5['alias']?_0x1b68('0x7')+_0x415ff5[_0x1b68('0x5')]:'No\x20alias\x20set','context':_0x415ff5[_0x1b68('0x8')],'exten':_0x415ff5['exten'],'priority':_0x3c7e64++,'VoiceExtensionId':_0x415ff5['id']}];if(_0x415ff5['type']===_0x1b68('0x9')){_0x57fab8[_0x1b68('0xa')]({'type':_0x1b68('0x9'),'app':_0x1b68('0x1'),'appdata':_0x1b68('0xb')+_0x415ff5['id'],'context':_0x415ff5[_0x1b68('0x8')],'exten':_0x415ff5['exten'],'priority':_0x3c7e64++,'VoiceExtensionId':_0x415ff5['id']});}_0x57fab8[_0x1b68('0xa')]({'type':_0x415ff5[_0x1b68('0x3')],'app':_0x1b68('0x1'),'appdata':_0x1b68('0xc'),'context':_0x415ff5[_0x1b68('0x8')],'exten':_0x415ff5[_0x1b68('0x4')],'priority':_0x3c7e64++,'VoiceExtensionId':_0x415ff5['id']},{'type':_0x415ff5[_0x1b68('0x3')],'app':_0x1b68('0x1'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x415ff5['context'],'exten':_0x415ff5[_0x1b68('0x4')],'priority':_0x3c7e64++,'VoiceExtensionId':_0x415ff5['id']},{'type':_0x415ff5[_0x1b68('0x3')],'app':'Set','appdata':_0x1b68('0xd'),'context':_0x415ff5[_0x1b68('0x8')],'exten':_0x415ff5[_0x1b68('0x4')],'priority':_0x3c7e64++,'VoiceExtensionId':_0x415ff5['id']});return _0x57fab8;}function _0x381a8f(_0xecc273){var _0x283614=0x2;var _0x5b96a8=[{'type':'outbound','app':_0x1b68('0x1'),'appdata':'CDR(type)=outbound','context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':_0x1b68('0xe'),'app':_0xecc273[_0x1b68('0x5')]?_0x1b68('0x1'):_0x1b68('0x6'),'appdata':_0xecc273[_0x1b68('0x5')]?'CDR(routeAlias)='+_0xecc273[_0x1b68('0x5')]:_0x1b68('0xf'),'context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':_0x1b68('0xe'),'app':_0x1b68('0x1'),'appdata':_0x1b68('0x10')+(_0xecc273[_0x1b68('0x11')]?_0x1b68('0x12')+_0xecc273['cutdigits']+'}':_0x1b68('0x13')),'context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':_0x1b68('0xe'),'app':_0x1b68('0x1'),'appdata':_0x1b68('0xb')+_0xecc273['id'],'context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273['exten'],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':'outbound','app':_0x1b68('0x14'),'appdata':_0x1b68('0x15')+(_0x283614+0x2)+_0x1b68('0x16')+(_0x283614+0x1)+')','context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':_0x1b68('0xe'),'app':_0x1b68('0x1'),'appdata':_0xecc273[_0x1b68('0x11')]?_0x1b68('0x17')+_0xecc273[_0x1b68('0x11')]+'}':_0x1b68('0x18'),'context':_0xecc273['context'],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':'outbound','app':_0x1b68('0x1'),'appdata':_0x1b68('0xc'),'context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':_0x1b68('0xe'),'app':'Set','appdata':_0x1b68('0x19'),'context':_0xecc273['context'],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':_0x1b68('0xe'),'app':_0x1b68('0x1'),'appdata':_0x1b68('0xd'),'context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':_0x1b68('0xe'),'app':_0x1b68('0x1'),'appdata':'outboundrouteid='+_0xecc273['id'],'context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']}];if(_0xecc273[_0x1b68('0x1a')]('recordingFormat')&&_0xecc273[_0x1b68('0x1b')]!==_0x1b68('0x1c')){_0x5b96a8[_0x1b68('0xa')]({'type':_0x1b68('0xe'),'app':_0x1b68('0x1'),'appdata':_0x1b68('0x1d'),'context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']},{'type':_0x1b68('0xe'),'app':_0x1b68('0x1'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xecc273[_0x1b68('0x1b')]||_0x1b68('0x1e'),'context':_0xecc273[_0x1b68('0x8')],'exten':_0xecc273[_0x1b68('0x4')],'priority':_0x283614++,'VoiceExtensionId':_0xecc273['id']});}return _0x5b96a8;}function _0x1a5cbb(_0x223a37,_0x71c846){var _0x20433e=[{'name':'trunk','param':0x0},{'name':_0x1b68('0x1f'),'param':0x1},{'name':_0x1b68('0x20'),'param':0x2},{'name':_0x1b68('0x21'),'param':0x3}];var _0x102d9c={};var _0x19d8cc=_0x71c846[_0x1b68('0x22')](',');var _0x1d1170=[];for(var _0x1add76=0x0;_0x1add76<_0x20433e[_0x1b68('0x23')];_0x1add76++){switch(_0x20433e[_0x1add76]['name']){case _0x1b68('0x24'):_0x102d9c['trunk']=_0x19d8cc[_0x20433e[_0x1add76]['param']][_0x1b68('0x22')]('/')[0x1];_0x102d9c[_0x1b68('0x25')]=_0x19d8cc[_0x20433e[_0x1add76][_0x1b68('0x26')]][_0x1b68('0x22')]('/')[0x2];_0x102d9c[_0x1b68('0x27')]=_0x102d9c[_0x1b68('0x25')]?_0x102d9c[_0x1b68('0x25')]['split']('$')[0x0]:undefined;_0x102d9c[_0x1b68('0x25')]=_0x223a37[_0x1b68('0x11')]?(_0x102d9c['prefix']||'')+_0x1b68('0x12')+_0x223a37[_0x1b68('0x11')]+'}':(_0x102d9c['prefix']||'')+_0x1b68('0x13');_0x1d1170[_0x20433e[_0x1add76]['param']]=[_0x1b68('0x28'),_0x102d9c[_0x1b68('0x24')],_0x102d9c[_0x1b68('0x25')]][_0x1b68('0x29')]('/');break;case _0x1b68('0x20'):_0x102d9c[_0x1b68('0x20')]=_0x19d8cc[_0x20433e[_0x1add76][_0x1b68('0x26')]];if(_0x223a37['recordingFormat']!==_0x1b68('0x1c')){if(_0x102d9c[_0x1b68('0x20')][_0x1b68('0x2a')](_0x1b68('0x2b'))<0x0){_0x102d9c['options']+='U(xcally-mixmonitor-context)';}}else{_0x102d9c['options']=_0x102d9c['options'][_0x1b68('0x2c')](_0x1b68('0x2b'),'');}_0x1d1170[_0x20433e[_0x1add76][_0x1b68('0x26')]]=_0x102d9c[_0x1b68('0x20')];break;default:_0x1d1170[_0x20433e[_0x1add76]['param']]=_0x19d8cc[_0x20433e[_0x1add76][_0x1b68('0x26')]];}}return _0x1d1170[_0x1b68('0x29')](',');}function _0x56aa24(_0x3e775a,_0x24c4b5,_0xda7405){return new Promise(function(_0x101536,_0x535dbf){var _0x56a3e4=[];if(_['isEmpty'](_0x24c4b5))return _0x101536(_0x56a3e4);_0x465420[_0x1b68('0x2d')][_0x1b68('0x2e')]({'attributes':['id',_0x1b68('0x2f'),_0x1b68('0x30')],'raw':!![]})[_0x1b68('0x31')](function(_0x199ac4){for(var _0x28a8e3=0x0,_0xf86692=0x0;_0x28a8e3<_0x24c4b5[_0x1b68('0x23')];_0x28a8e3++,_0xf86692=0x0){var _0x5c167f=_0x24c4b5[_0x28a8e3];var _0x46635e=[];var _0x4da173=[];delete _0x5c167f['id'];if(_0x5c167f[_0x1b68('0x2f')]!==_0x1b68('0x32')){_0x5c167f['intervals']=[_0x5c167f[_0x1b68('0x2f')]];}else{_0x5c167f[_0x1b68('0x33')]=_0x5c167f[_0x1b68('0x30')]?_['map'](_[_0x1b68('0x34')](_0x199ac4,{'IntervalId':_0x5c167f[_0x1b68('0x30')]}),_0x1b68('0x2f')):[];}_0x5c167f['context']=_0x3e775a[_0x1b68('0x8')];_0x5c167f[_0x1b68('0x4')]=_0x3e775a[_0x1b68('0x4')];if(_0x5c167f[_0x1b68('0x3')])_0x5c167f[_0x1b68('0x3')]=_0x5c167f['type'][_0x1b68('0x35')]();if(_0x3e775a[_0x1b68('0x3')]===_0x1b68('0xe')){if(_0x5c167f['hasOwnProperty'](_0x1b68('0x36'))&&_0x5c167f['tag']&&_0x5c167f[_0x1b68('0x36')]!=='--'){_0x46635e[_0x1b68('0xa')]({'type':_0x5c167f['type'][_0x1b68('0x35')](),'app':_0x1b68('0x1'),'appdata':_0x1b68('0x37')+_0x5c167f['tag'],'context':_0x3e775a[_0x1b68('0x8')],'exten':_0x3e775a[_0x1b68('0x4')],'priority':_0x5c167f[_0x1b68('0x33')][_0x1b68('0x23')]+_0xda7405+_0xf86692++,'VoiceExtensionId':_0x3e775a['id']});}_0x46635e['push']({'type':_0x5c167f[_0x1b68('0x3')][_0x1b68('0x35')](),'app':_0x1b68('0x14'),'appdata':_0x1b68('0x38')+(_0x5c167f[_0x1b68('0x39')]?_0x1b68('0x3a')+_0x5c167f[_0x1b68('0x39')]+')':_0x1b68('0x3b')),'context':_0x3e775a[_0x1b68('0x8')],'exten':_0x3e775a[_0x1b68('0x4')],'priority':_0x5c167f[_0x1b68('0x33')][_0x1b68('0x23')]+_0xda7405+_0xf86692++,'VoiceExtensionId':_0x3e775a['id']});}else{if(_0x5c167f[_0x1b68('0x1a')]('answer')){if(['queue',_0x1b68('0x3c')][_0x1b68('0x3d')](_0x5c167f[_0x1b68('0x3e')][_0x1b68('0x35')]())&&_0x5c167f[_0x1b68('0x3f')]!==_0x1b68('0x40')){if(_0x5c167f[_0x1b68('0x41')]){_0x46635e[_0x1b68('0xa')]({'type':_0x5c167f[_0x1b68('0x3')][_0x1b68('0x35')](),'app':'ExecIf','appdata':_0x1b68('0x42'),'context':_0x3e775a[_0x1b68('0x8')],'exten':_0x3e775a['exten'],'priority':_0x5c167f[_0x1b68('0x33')]['length']+_0xda7405+_0xf86692++,'VoiceExtensionId':_0x3e775a['id']});_0x46635e['push']({'type':_0x5c167f[_0x1b68('0x3')][_0x1b68('0x35')](),'app':_0x1b68('0x1'),'appdata':_0x1b68('0x43'),'context':_0x3e775a['context'],'exten':_0x3e775a[_0x1b68('0x4')],'priority':_0x5c167f[_0x1b68('0x33')]['length']+_0xda7405+_0xf86692++,'VoiceExtensionId':_0x3e775a['id']});}else{_0x46635e[_0x1b68('0xa')]({'type':_0x5c167f[_0x1b68('0x3')][_0x1b68('0x35')](),'app':_0x1b68('0x14'),'appdata':_0x1b68('0x44'),'context':_0x3e775a[_0x1b68('0x8')],'exten':_0x3e775a[_0x1b68('0x4')],'priority':_0x5c167f[_0x1b68('0x33')][_0x1b68('0x23')]+_0xda7405+_0xf86692++,'VoiceExtensionId':_0x3e775a['id']});_0x46635e[_0x1b68('0xa')]({'type':_0x5c167f['type'][_0x1b68('0x35')](),'app':'Set','appdata':_0x1b68('0x45'),'context':_0x3e775a[_0x1b68('0x8')],'exten':_0x3e775a[_0x1b68('0x4')],'priority':_0x5c167f[_0x1b68('0x33')]['length']+_0xda7405+_0xf86692++,'VoiceExtensionId':_0x3e775a['id']});}}}}for(var _0x5ec004=0x0;_0x5ec004<_0x5c167f['intervals'][_0x1b68('0x23')];_0x5ec004++){var _0x30f981=_0xda7405+_0x5c167f['intervals'][_0x1b68('0x23')];var _0xd77293=_0x5ec004===_0x5c167f[_0x1b68('0x33')]['length']-0x1?_0xda7405+_0x46635e[_0x1b68('0x23')]+_0x4da173[_0x1b68('0x23')]+0x2:_0xda7405+_0x5ec004+0x1;_0x46635e['splice'](_0x5ec004,0x0,{'type':_0x3e775a[_0x1b68('0x3')],'app':_0x1b68('0x46'),'appdata':_0x5c167f['intervals'][_0x5ec004]+'?'+_0x3e775a['context']+_0x1b68('0x47')+_0x30f981+':'+_0x3e775a[_0x1b68('0x8')]+_0x1b68('0x47')+_0xd77293,'exten':_0x3e775a[_0x1b68('0x4')],'context':_0x3e775a[_0x1b68('0x8')],'priority':_0xda7405+_0x5ec004,'VoiceExtensionId':_0x3e775a['id']});}if(_0x5c167f[_0x1b68('0x3f')]===_0x1b68('0x48')){_0x5c167f[_0x1b68('0x49')]=_0x1a5cbb(_0x3e775a,_0x5c167f['appdata']);}if(_0x5c167f[_0x1b68('0x3f')]===_0x1b68('0x4a')){_0x46635e[_0x1b68('0xa')]({'type':_0x5c167f['type'][_0x1b68('0x35')](),'app':_0x1b68('0x1'),'appdata':_0x1b68('0x4b'),'context':_0x3e775a[_0x1b68('0x8')],'exten':_0x3e775a['exten'],'priority':_0x5c167f[_0x1b68('0x33')][_0x1b68('0x23')]+_0xda7405+_0xf86692++,'VoiceExtensionId':_0x3e775a['id']});}_0x5c167f[_0x1b68('0x4c')]=_0x46635e[_0x1b68('0x23')]?_[_0x1b68('0x4d')](_0x46635e)[_0x1b68('0x4c')]+0x1:_0xda7405;_0x56a3e4=_['concat'](_0x56a3e4,_0x46635e,[_0x5c167f],_0x4da173);_0xda7405=_['last'](_0x56a3e4)[_0x1b68('0x4c')]+0x1;}return _0x101536(_0x56a3e4);})[_0x1b68('0x4e')](function(_0x2130ef){_0x535dbf(_0x2130ef);});});}return _0x2cc050[_0x1b68('0x4f')](_0x1b68('0x50'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4537d4){var _0x36df6c=this[_0x1b68('0x51')]({'plain':!![]});var _0x4b6543=_0x36df6c[_0x1b68('0x3')]===_0x1b68('0xe')?_0x381a8f(_0x36df6c):_0x57e3c3(_0x36df6c);return _0x56aa24(_0x36df6c,_0x4537d4,_['last'](_0x4b6543)[_0x1b68('0x4c')]+0x1)[_0x1b68('0x31')](function(_0x5ee2da){var _0x16cb3e=_[_0x1b68('0x52')](_0x4b6543,_0x5ee2da);_0x16cb3e[_0x1b68('0xa')]({'type':_0x36df6c['type'],'app':_0x1b68('0x53'),'exten':_0x36df6c[_0x1b68('0x4')],'context':_0x36df6c[_0x1b68('0x8')],'priority':_[_0x1b68('0x4d')](_0x16cb3e)[_0x1b68('0x4c')]+0x1,'VoiceExtensionId':_0x36df6c['id']});return _0x16cb3e;});}}});}; \ No newline at end of file +var _0xf026=['voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','models','type','Set','context','exten','NoOp','alias','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','timeout','options','url','split','name','param','phone','prefix','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','IntervalId','then','length','interval','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appdata','agi','priority','last','catch','VoiceExtension'];(function(_0x43e4df,_0x2e2c86){var _0x1387d7=function(_0x3bfffd){while(--_0x3bfffd){_0x43e4df['push'](_0x43e4df['shift']());}};_0x1387d7(++_0x2e2c86);}(_0xf026,0x106));var _0x6f02=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xf026[_0x307d86];return _0x361745;};'use strict';var _=require(_0x6f02('0x0'));var attributes=require(_0x6f02('0x1'));module['exports']=function(_0x415d37){var _0xb2171b=_0x415d37[_0x6f02('0x2')];function _0x23b8ab(_0x2028c9){var _0x15eb77=0x2;var _0x3f883b=[{'type':_0x2028c9[_0x6f02('0x3')],'app':_0x6f02('0x4'),'appdata':'CDR(type)='+_0x2028c9[_0x6f02('0x3')],'context':_0x2028c9[_0x6f02('0x5')],'exten':_0x2028c9[_0x6f02('0x6')],'priority':_0x15eb77++,'VoiceExtensionId':_0x2028c9['id']},{'type':_0x2028c9['type'],'app':_0x2028c9['alias']?'Set':_0x6f02('0x7'),'appdata':_0x2028c9[_0x6f02('0x8')]?'CDR(routeAlias)='+_0x2028c9[_0x6f02('0x8')]:_0x6f02('0x9'),'context':_0x2028c9[_0x6f02('0x5')],'exten':_0x2028c9[_0x6f02('0x6')],'priority':_0x15eb77++,'VoiceExtensionId':_0x2028c9['id']}];if(_0x2028c9[_0x6f02('0x3')]===_0x6f02('0xa')){_0x3f883b[_0x6f02('0xb')]({'type':_0x6f02('0xa'),'app':_0x6f02('0x4'),'appdata':_0x6f02('0xc')+_0x2028c9['id'],'context':_0x2028c9[_0x6f02('0x5')],'exten':_0x2028c9[_0x6f02('0x6')],'priority':_0x15eb77++,'VoiceExtensionId':_0x2028c9['id']});}_0x3f883b[_0x6f02('0xb')]({'type':_0x2028c9['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2028c9[_0x6f02('0x5')],'exten':_0x2028c9[_0x6f02('0x6')],'priority':_0x15eb77++,'VoiceExtensionId':_0x2028c9['id']},{'type':_0x2028c9['type'],'app':_0x6f02('0x4'),'appdata':_0x6f02('0xd'),'context':_0x2028c9['context'],'exten':_0x2028c9[_0x6f02('0x6')],'priority':_0x15eb77++,'VoiceExtensionId':_0x2028c9['id']},{'type':_0x2028c9[_0x6f02('0x3')],'app':'Set','appdata':_0x6f02('0xe'),'context':_0x2028c9[_0x6f02('0x5')],'exten':_0x2028c9[_0x6f02('0x6')],'priority':_0x15eb77++,'VoiceExtensionId':_0x2028c9['id']});return _0x3f883b;}function _0x27e605(_0x9d5fae){var _0x5d0df1=0x2;var _0x38aba0=[{'type':_0x6f02('0xf'),'app':_0x6f02('0x4'),'appdata':_0x6f02('0x10'),'context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae['exten'],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':'outbound','app':_0x9d5fae[_0x6f02('0x8')]?'Set':_0x6f02('0x7'),'appdata':_0x9d5fae['alias']?_0x6f02('0x11')+_0x9d5fae['alias']:_0x6f02('0x9'),'context':_0x9d5fae['context'],'exten':_0x9d5fae['exten'],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':'outbound','app':_0x6f02('0x4'),'appdata':_0x6f02('0x12')+(_0x9d5fae['cutdigits']?'${EXTEN:'+_0x9d5fae[_0x6f02('0x13')]+'}':_0x6f02('0x14')),'context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae['exten'],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':_0x6f02('0xf'),'app':_0x6f02('0x4'),'appdata':_0x6f02('0xc')+_0x9d5fae['id'],'context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae[_0x6f02('0x6')],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':'outbound','app':_0x6f02('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5d0df1+0x2)+_0x6f02('0x16')+(_0x5d0df1+0x1)+')','context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae['exten'],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':_0x6f02('0xf'),'app':_0x6f02('0x4'),'appdata':_0x9d5fae[_0x6f02('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x9d5fae[_0x6f02('0x13')]+'}':_0x6f02('0x17'),'context':_0x9d5fae['context'],'exten':_0x9d5fae[_0x6f02('0x6')],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':_0x6f02('0xf'),'app':_0x6f02('0x4'),'appdata':_0x6f02('0x18'),'context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae[_0x6f02('0x6')],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':_0x6f02('0xf'),'app':_0x6f02('0x4'),'appdata':_0x6f02('0xd'),'context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae[_0x6f02('0x6')],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':_0x6f02('0xf'),'app':_0x6f02('0x4'),'appdata':_0x6f02('0xe'),'context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae[_0x6f02('0x6')],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':_0x6f02('0xf'),'app':_0x6f02('0x4'),'appdata':_0x6f02('0x19')+_0x9d5fae['id'],'context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae[_0x6f02('0x6')],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']}];if(_0x9d5fae[_0x6f02('0x1a')]('recordingFormat')&&_0x9d5fae['recordingFormat']!==_0x6f02('0x1b')){_0x38aba0[_0x6f02('0xb')]({'type':_0x6f02('0xf'),'app':_0x6f02('0x4'),'appdata':_0x6f02('0x1c'),'context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae[_0x6f02('0x6')],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']},{'type':'outbound','app':_0x6f02('0x4'),'appdata':_0x6f02('0x1d')+_0x9d5fae[_0x6f02('0x1e')]||_0x6f02('0x1f'),'context':_0x9d5fae[_0x6f02('0x5')],'exten':_0x9d5fae[_0x6f02('0x6')],'priority':_0x5d0df1++,'VoiceExtensionId':_0x9d5fae['id']});}return _0x38aba0;}function _0x1d8a06(_0x26b616,_0x1c6fd4){var _0x5dc1dd=[{'name':_0x6f02('0x20'),'param':0x0},{'name':_0x6f02('0x21'),'param':0x1},{'name':_0x6f02('0x22'),'param':0x2},{'name':_0x6f02('0x23'),'param':0x3}];var _0x4c744e={};var _0x28ffd7=_0x1c6fd4[_0x6f02('0x24')](',');var _0xa528cd=[];for(var _0x58f948=0x0;_0x58f948<_0x5dc1dd['length'];_0x58f948++){switch(_0x5dc1dd[_0x58f948][_0x6f02('0x25')]){case'trunk':_0x4c744e[_0x6f02('0x20')]=_0x28ffd7[_0x5dc1dd[_0x58f948][_0x6f02('0x26')]]['split']('/')[0x1];_0x4c744e[_0x6f02('0x27')]=_0x28ffd7[_0x5dc1dd[_0x58f948]['param']][_0x6f02('0x24')]('/')[0x2];_0x4c744e['prefix']=_0x4c744e[_0x6f02('0x27')]?_0x4c744e[_0x6f02('0x27')]['split']('$')[0x0]:undefined;_0x4c744e[_0x6f02('0x27')]=_0x26b616['cutdigits']?(_0x4c744e['prefix']||'')+'${EXTEN:'+_0x26b616[_0x6f02('0x13')]+'}':(_0x4c744e[_0x6f02('0x28')]||'')+_0x6f02('0x14');_0xa528cd[_0x5dc1dd[_0x58f948][_0x6f02('0x26')]]=[_0x6f02('0x29'),_0x4c744e[_0x6f02('0x20')],_0x4c744e[_0x6f02('0x27')]]['join']('/');break;case _0x6f02('0x22'):_0x4c744e[_0x6f02('0x22')]=_0x28ffd7[_0x5dc1dd[_0x58f948][_0x6f02('0x26')]];if(_0x26b616[_0x6f02('0x1e')]!=='none'){if(_0x4c744e[_0x6f02('0x22')][_0x6f02('0x2a')](_0x6f02('0x2b'))<0x0){_0x4c744e[_0x6f02('0x22')]+='U(xcally-mixmonitor-context)';}}else{_0x4c744e[_0x6f02('0x22')]=_0x4c744e[_0x6f02('0x22')][_0x6f02('0x2c')](_0x6f02('0x2b'),'');}_0xa528cd[_0x5dc1dd[_0x58f948][_0x6f02('0x26')]]=_0x4c744e[_0x6f02('0x22')];break;default:_0xa528cd[_0x5dc1dd[_0x58f948]['param']]=_0x28ffd7[_0x5dc1dd[_0x58f948][_0x6f02('0x26')]];}}return _0xa528cd[_0x6f02('0x2d')](',');}function _0x2811ac(_0x3bc7c8,_0x540469,_0x5c79e9){return new Promise(function(_0x3bdc5d,_0x127a20){var _0x3b808b=[];if(_[_0x6f02('0x2e')](_0x540469))return _0x3bdc5d(_0x3b808b);_0xb2171b[_0x6f02('0x2f')][_0x6f02('0x30')]({'attributes':['id','interval',_0x6f02('0x31')],'raw':!![]})[_0x6f02('0x32')](function(_0x311554){for(var _0x1a96bd=0x0,_0x1c4254=0x0;_0x1a96bd<_0x540469[_0x6f02('0x33')];_0x1a96bd++,_0x1c4254=0x0){var _0x45b8ee=_0x540469[_0x1a96bd];var _0x45f51d=[];var _0x1514f9=[];delete _0x45b8ee['id'];if(_0x45b8ee[_0x6f02('0x34')]!=='*,*,*,*'){_0x45b8ee['intervals']=[_0x45b8ee[_0x6f02('0x34')]];}else{_0x45b8ee[_0x6f02('0x35')]=_0x45b8ee[_0x6f02('0x31')]?_[_0x6f02('0x36')](_[_0x6f02('0x37')](_0x311554,{'IntervalId':_0x45b8ee['IntervalId']}),'interval'):[];}_0x45b8ee[_0x6f02('0x5')]=_0x3bc7c8[_0x6f02('0x5')];_0x45b8ee[_0x6f02('0x6')]=_0x3bc7c8[_0x6f02('0x6')];if(_0x45b8ee[_0x6f02('0x3')])_0x45b8ee[_0x6f02('0x3')]=_0x45b8ee[_0x6f02('0x3')][_0x6f02('0x38')]();if(_0x3bc7c8[_0x6f02('0x3')]==='outbound'){if(_0x45b8ee[_0x6f02('0x1a')](_0x6f02('0x39'))&&_0x45b8ee[_0x6f02('0x39')]&&_0x45b8ee[_0x6f02('0x39')]!=='--'){_0x45f51d['push']({'type':_0x45b8ee[_0x6f02('0x3')][_0x6f02('0x38')](),'app':_0x6f02('0x4'),'appdata':_0x6f02('0x3a')+_0x45b8ee['tag'],'context':_0x3bc7c8[_0x6f02('0x5')],'exten':_0x3bc7c8['exten'],'priority':_0x45b8ee[_0x6f02('0x35')]['length']+_0x5c79e9+_0x1c4254++,'VoiceExtensionId':_0x3bc7c8['id']});}_0x45f51d[_0x6f02('0xb')]({'type':_0x45b8ee[_0x6f02('0x3')][_0x6f02('0x38')](),'app':_0x6f02('0x15'),'appdata':_0x6f02('0x3b')+(_0x45b8ee[_0x6f02('0x3c')]?_0x6f02('0x3d')+_0x45b8ee[_0x6f02('0x3c')]+')':_0x6f02('0x3e')),'context':_0x3bc7c8[_0x6f02('0x5')],'exten':_0x3bc7c8['exten'],'priority':_0x45b8ee[_0x6f02('0x35')][_0x6f02('0x33')]+_0x5c79e9+_0x1c4254++,'VoiceExtensionId':_0x3bc7c8['id']});}else{if(_0x45b8ee[_0x6f02('0x1a')]('answer')){if([_0x6f02('0x3f'),_0x6f02('0x40')][_0x6f02('0x41')](_0x45b8ee[_0x6f02('0x42')][_0x6f02('0x38')]())&&_0x45b8ee[_0x6f02('0x43')]!==_0x6f02('0x44')){if(_0x45b8ee[_0x6f02('0x45')]){_0x45f51d['push']({'type':_0x45b8ee[_0x6f02('0x3')][_0x6f02('0x38')](),'app':_0x6f02('0x15'),'appdata':_0x6f02('0x46'),'context':_0x3bc7c8[_0x6f02('0x5')],'exten':_0x3bc7c8['exten'],'priority':_0x45b8ee[_0x6f02('0x35')]['length']+_0x5c79e9+_0x1c4254++,'VoiceExtensionId':_0x3bc7c8['id']});_0x45f51d['push']({'type':_0x45b8ee[_0x6f02('0x3')][_0x6f02('0x38')](),'app':_0x6f02('0x4'),'appdata':_0x6f02('0x47'),'context':_0x3bc7c8[_0x6f02('0x5')],'exten':_0x3bc7c8[_0x6f02('0x6')],'priority':_0x45b8ee[_0x6f02('0x35')][_0x6f02('0x33')]+_0x5c79e9+_0x1c4254++,'VoiceExtensionId':_0x3bc7c8['id']});}else{_0x45f51d[_0x6f02('0xb')]({'type':_0x45b8ee[_0x6f02('0x3')][_0x6f02('0x38')](),'app':_0x6f02('0x15'),'appdata':_0x6f02('0x48'),'context':_0x3bc7c8['context'],'exten':_0x3bc7c8[_0x6f02('0x6')],'priority':_0x45b8ee[_0x6f02('0x35')][_0x6f02('0x33')]+_0x5c79e9+_0x1c4254++,'VoiceExtensionId':_0x3bc7c8['id']});_0x45f51d['push']({'type':_0x45b8ee['type']['toLowerCase'](),'app':'Set','appdata':_0x6f02('0x49'),'context':_0x3bc7c8['context'],'exten':_0x3bc7c8[_0x6f02('0x6')],'priority':_0x45b8ee[_0x6f02('0x35')][_0x6f02('0x33')]+_0x5c79e9+_0x1c4254++,'VoiceExtensionId':_0x3bc7c8['id']});}}}}for(var _0x4eebdc=0x0;_0x4eebdc<_0x45b8ee['intervals'][_0x6f02('0x33')];_0x4eebdc++){var _0x239255=_0x5c79e9+_0x45b8ee[_0x6f02('0x35')][_0x6f02('0x33')];var _0x2ee4d8=_0x4eebdc===_0x45b8ee['intervals'][_0x6f02('0x33')]-0x1?_0x5c79e9+_0x45f51d[_0x6f02('0x33')]+_0x1514f9[_0x6f02('0x33')]+0x2:_0x5c79e9+_0x4eebdc+0x1;_0x45f51d['splice'](_0x4eebdc,0x0,{'type':_0x3bc7c8[_0x6f02('0x3')],'app':_0x6f02('0x4a'),'appdata':_0x45b8ee[_0x6f02('0x35')][_0x4eebdc]+'?'+_0x3bc7c8[_0x6f02('0x5')]+_0x6f02('0x4b')+_0x239255+':'+_0x3bc7c8['context']+_0x6f02('0x4b')+_0x2ee4d8,'exten':_0x3bc7c8[_0x6f02('0x6')],'context':_0x3bc7c8['context'],'priority':_0x5c79e9+_0x4eebdc,'VoiceExtensionId':_0x3bc7c8['id']});}if(_0x45b8ee[_0x6f02('0x43')]==='outboundDial'){_0x45b8ee[_0x6f02('0x4c')]=_0x1d8a06(_0x3bc7c8,_0x45b8ee[_0x6f02('0x4c')]);}if(_0x45b8ee[_0x6f02('0x43')]===_0x6f02('0x4d')){_0x45f51d[_0x6f02('0xb')]({'type':_0x45b8ee[_0x6f02('0x3')][_0x6f02('0x38')](),'app':_0x6f02('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x3bc7c8['context'],'exten':_0x3bc7c8[_0x6f02('0x6')],'priority':_0x45b8ee['intervals'][_0x6f02('0x33')]+_0x5c79e9+_0x1c4254++,'VoiceExtensionId':_0x3bc7c8['id']});}_0x45b8ee[_0x6f02('0x4e')]=_0x45f51d[_0x6f02('0x33')]?_[_0x6f02('0x4f')](_0x45f51d)[_0x6f02('0x4e')]+0x1:_0x5c79e9;_0x3b808b=_['concat'](_0x3b808b,_0x45f51d,[_0x45b8ee],_0x1514f9);_0x5c79e9=_['last'](_0x3b808b)[_0x6f02('0x4e')]+0x1;}return _0x3bdc5d(_0x3b808b);})[_0x6f02('0x50')](function(_0x7d7e22){_0x127a20(_0x7d7e22);});});}return _0x415d37['define'](_0x6f02('0x51'),attributes,{'tableName':_0x6f02('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x305a37){var _0x4a7c02=this[_0x6f02('0x53')]({'plain':!![]});var _0x4c3b6a=_0x4a7c02[_0x6f02('0x3')]===_0x6f02('0xf')?_0x27e605(_0x4a7c02):_0x23b8ab(_0x4a7c02);return _0x2811ac(_0x4a7c02,_0x305a37,_[_0x6f02('0x4f')](_0x4c3b6a)[_0x6f02('0x4e')]+0x1)['then'](function(_0x3a3510){var _0x412310=_[_0x6f02('0x54')](_0x4c3b6a,_0x3a3510);_0x412310[_0x6f02('0xb')]({'type':_0x4a7c02[_0x6f02('0x3')],'app':_0x6f02('0x55'),'exten':_0x4a7c02[_0x6f02('0x6')],'context':_0x4a7c02[_0x6f02('0x5')],'priority':_[_0x6f02('0x4f')](_0x412310)[_0x6f02('0x4e')]+0x1,'VoiceExtensionId':_0x4a7c02['id']});return _0x412310;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 28cc5cb..b3bff37 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 _0x9b2c=['./voiceExtension.socket','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','where','attributes','limit','include','model','map','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x420b9f,_0x4e7941){var _0x469c6f=function(_0x216585){while(--_0x216585){_0x420b9f['push'](_0x420b9f['shift']());}};_0x469c6f(++_0x4e7941);}(_0x9b2c,0x189));var _0xc9b2=function(_0x26df48,_0x22aa50){_0x26df48=_0x26df48-0x0;var _0x209047=_0x9b2c[_0x26df48];return _0x209047;};'use strict';var _=require('lodash');var util=require(_0xc9b2('0x0'));var moment=require(_0xc9b2('0x1'));var BPromise=require('bluebird');var rs=require(_0xc9b2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9b2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9b2('0x4'))(_0xc9b2('0x5'));var config=require(_0xc9b2('0x6'));var jayson=require(_0xc9b2('0x7'));var client=jayson[_0xc9b2('0x8')][_0xc9b2('0x9')]({'port':0x232a});config[_0xc9b2('0xa')]=_[_0xc9b2('0xb')](config[_0xc9b2('0xa')],{'host':_0xc9b2('0xc'),'port':0x18eb});var socket=require(_0xc9b2('0xd'))(new Redis(config['redis']));require(_0xc9b2('0xe'))['register'](socket);function respondWithRpcPromise(_0x54d7f9,_0x115350,_0x392e79){return new BPromise(function(_0x137e38,_0x110c87){return client[_0xc9b2('0xf')](_0x54d7f9,_0x392e79)[_0xc9b2('0x10')](function(_0x367025){logger[_0xc9b2('0x11')](_0xc9b2('0x12'),_0x115350,_0xc9b2('0x13'));logger[_0xc9b2('0x14')](_0xc9b2('0x15'),_0x115350,'request\x20sent',JSON[_0xc9b2('0x16')](_0x367025));if(_0x367025[_0xc9b2('0x17')]){if(_0x367025[_0xc9b2('0x17')][_0xc9b2('0x18')]===0x1f4){logger['error'](_0xc9b2('0x12'),_0x115350,_0x367025[_0xc9b2('0x17')][_0xc9b2('0x19')]);return _0x110c87(_0x367025[_0xc9b2('0x17')][_0xc9b2('0x19')]);}logger[_0xc9b2('0x17')](_0xc9b2('0x12'),_0x115350,_0x367025[_0xc9b2('0x17')]['message']);return _0x137e38(_0x367025[_0xc9b2('0x17')][_0xc9b2('0x19')]);}else{logger[_0xc9b2('0x11')](_0xc9b2('0x12'),_0x115350,'request\x20sent');_0x137e38(_0x367025[_0xc9b2('0x1a')][_0xc9b2('0x19')]);}})[_0xc9b2('0x1b')](function(_0x352995){logger[_0xc9b2('0x17')](_0xc9b2('0x12'),_0x115350,_0x352995);_0x110c87(_0x352995);});});}exports[_0xc9b2('0x1c')]=function(_0x50352c){var _0x474970=this;return new Promise(function(_0x58e1ba,_0x13739a){return db[_0xc9b2('0x1d')]['findAll']({'raw':_0x50352c[_0xc9b2('0x1e')]?_0x50352c[_0xc9b2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x50352c[_0xc9b2('0x1e')]?_0x50352c['options'][_0xc9b2('0x1f')]||null:null,'attributes':_0x50352c[_0xc9b2('0x1e')]?_0x50352c[_0xc9b2('0x1e')][_0xc9b2('0x20')]||null:null,'limit':_0x50352c[_0xc9b2('0x1e')]?_0x50352c[_0xc9b2('0x1e')][_0xc9b2('0x21')]||null:null,'include':_0x50352c[_0xc9b2('0x1e')]?_0x50352c[_0xc9b2('0x1e')][_0xc9b2('0x22')]?_['map'](_0x50352c[_0xc9b2('0x1e')][_0xc9b2('0x22')],function(_0x444181){return{'model':db[_0x444181[_0xc9b2('0x23')]],'as':_0x444181['as'],'attributes':_0x444181['attributes'],'include':_0x444181[_0xc9b2('0x22')]?_['map'](_0x444181[_0xc9b2('0x22')],function(_0xa07875){return{'model':db[_0xa07875[_0xc9b2('0x23')]],'as':_0xa07875['as'],'attributes':_0xa07875[_0xc9b2('0x20')],'include':_0xa07875[_0xc9b2('0x22')]?_[_0xc9b2('0x24')](_0xa07875[_0xc9b2('0x22')],function(_0x3d735a){return{'model':db[_0x3d735a[_0xc9b2('0x23')]],'as':_0x3d735a['as'],'attributes':_0x3d735a[_0xc9b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc9b2('0x10')](function(_0x2ab823){logger[_0xc9b2('0x11')](_0xc9b2('0x1c'),_0x50352c);logger[_0xc9b2('0x14')](_0xc9b2('0x1c'),_0x50352c,JSON['stringify'](_0x2ab823));_0x58e1ba(_0x2ab823);})['catch'](function(_0x3df56f){logger[_0xc9b2('0x17')](_0xc9b2('0x1c'),_0x3df56f['message'],_0x50352c);_0x13739a(_0x474970[_0xc9b2('0x17')](0x1f4,_0x3df56f['message']));});});}; \ No newline at end of file +var _0x15cb=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','util','bluebird','ioredis'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x15cb,0x16f));var _0xb15c=function(_0x5a4455,_0x19407d){_0x5a4455=_0x5a4455-0x0;var _0x1f23d5=_0x15cb[_0x5a4455];return _0x1f23d5;};'use strict';var _=require('lodash');var util=require(_0xb15c('0x0'));var moment=require('moment');var BPromise=require(_0xb15c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb15c('0x2'));var db=require(_0xb15c('0x3'))['db'];var utils=require(_0xb15c('0x4'));var logger=require(_0xb15c('0x5'))('rpc');var config=require(_0xb15c('0x6'));var jayson=require(_0xb15c('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xb15c('0x8')]=_[_0xb15c('0x9')](config[_0xb15c('0x8')],{'host':_0xb15c('0xa'),'port':0x18eb});var socket=require(_0xb15c('0xb'))(new Redis(config[_0xb15c('0x8')]));require(_0xb15c('0xc'))[_0xb15c('0xd')](socket);function respondWithRpcPromise(_0x5bd0a5,_0x399b9d,_0x559610){return new BPromise(function(_0x50389a,_0x4980fd){return client[_0xb15c('0xe')](_0x5bd0a5,_0x559610)[_0xb15c('0xf')](function(_0x16f806){logger[_0xb15c('0x10')](_0xb15c('0x11'),_0x399b9d,_0xb15c('0x12'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x399b9d,_0xb15c('0x12'),JSON['stringify'](_0x16f806));if(_0x16f806[_0xb15c('0x13')]){if(_0x16f806[_0xb15c('0x13')][_0xb15c('0x14')]===0x1f4){logger[_0xb15c('0x13')](_0xb15c('0x11'),_0x399b9d,_0x16f806[_0xb15c('0x13')][_0xb15c('0x15')]);return _0x4980fd(_0x16f806[_0xb15c('0x13')][_0xb15c('0x15')]);}logger[_0xb15c('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x399b9d,_0x16f806[_0xb15c('0x13')][_0xb15c('0x15')]);return _0x50389a(_0x16f806['error'][_0xb15c('0x15')]);}else{logger[_0xb15c('0x10')](_0xb15c('0x11'),_0x399b9d,_0xb15c('0x12'));_0x50389a(_0x16f806[_0xb15c('0x16')][_0xb15c('0x15')]);}})[_0xb15c('0x17')](function(_0x47aa5e){logger[_0xb15c('0x13')](_0xb15c('0x11'),_0x399b9d,_0x47aa5e);_0x4980fd(_0x47aa5e);});});}exports[_0xb15c('0x18')]=function(_0x56ac6b){var _0x2be437=this;return new Promise(function(_0x4ad313,_0x7304ba){return db[_0xb15c('0x19')][_0xb15c('0x1a')]({'raw':_0x56ac6b[_0xb15c('0x1b')]?_0x56ac6b[_0xb15c('0x1b')][_0xb15c('0x1c')]===undefined?!![]:![]:!![],'where':_0x56ac6b[_0xb15c('0x1b')]?_0x56ac6b[_0xb15c('0x1b')][_0xb15c('0x1d')]||null:null,'attributes':_0x56ac6b[_0xb15c('0x1b')]?_0x56ac6b[_0xb15c('0x1b')][_0xb15c('0x1e')]||null:null,'limit':_0x56ac6b[_0xb15c('0x1b')]?_0x56ac6b[_0xb15c('0x1b')][_0xb15c('0x1f')]||null:null,'include':_0x56ac6b[_0xb15c('0x1b')]?_0x56ac6b[_0xb15c('0x1b')][_0xb15c('0x20')]?_[_0xb15c('0x21')](_0x56ac6b[_0xb15c('0x1b')][_0xb15c('0x20')],function(_0x160646){return{'model':db[_0x160646[_0xb15c('0x22')]],'as':_0x160646['as'],'attributes':_0x160646['attributes'],'include':_0x160646[_0xb15c('0x20')]?_['map'](_0x160646[_0xb15c('0x20')],function(_0x6cd04a){return{'model':db[_0x6cd04a[_0xb15c('0x22')]],'as':_0x6cd04a['as'],'attributes':_0x6cd04a[_0xb15c('0x1e')],'include':_0x6cd04a[_0xb15c('0x20')]?_[_0xb15c('0x21')](_0x6cd04a[_0xb15c('0x20')],function(_0xf59691){return{'model':db[_0xf59691['model']],'as':_0xf59691['as'],'attributes':_0xf59691[_0xb15c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb15c('0xf')](function(_0x4d9db6){logger['info']('GetVoiceExtension',_0x56ac6b);logger[_0xb15c('0x23')](_0xb15c('0x18'),_0x56ac6b,JSON[_0xb15c('0x24')](_0x4d9db6));_0x4ad313(_0x4d9db6);})[_0xb15c('0x17')](function(_0x2110f2){logger['error'](_0xb15c('0x18'),_0x2110f2[_0xb15c('0x15')],_0x56ac6b);_0x7304ba(_0x2be437[_0xb15c('0x13')](0x1f4,_0x2110f2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f99a2cf..deceadd 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x16f26a,_0xd56133){var _0x29a6c4=function(_0x1c1879){while(--_0x1c1879){_0x16f26a['push'](_0x16f26a['shift']());}};_0x29a6c4(++_0xd56133);}(_0x1261,0x144));var _0x1126=function(_0x23ca2f,_0x271c2b){_0x23ca2f=_0x23ca2f-0x0;var _0x4f4b51=_0x1261[_0x23ca2f];return _0x4f4b51;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x814b,0x1a2));var _0xb814=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0x814b[_0x459a0a];return _0x4ab46c;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 2f9aa85..eac9ce6 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 _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post'];(function(_0xfd19cf,_0x48cd71){var _0x33be44=function(_0x5def88){while(--_0x5def88){_0xfd19cf['push'](_0xfd19cf['shift']());}};_0x33be44(++_0x48cd71);}(_0x57ca,0x108));var _0xa57c=function(_0x230141,_0x5c7ba2){_0x230141=_0x230141-0x0;var _0x2d5430=_0x57ca[_0x230141];return _0x2d5430;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x0295,0x1f0));var _0x5029=function(_0x40798d,_0x3d4bbb){_0x40798d=_0x40798d-0x0;var _0x6a942=_0x0295[_0x40798d];return _0x6a942;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/messages',auth[_0x5029('0x8')](),controller['getMessages']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index dc4464c..d912355 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 _0x192b=['fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x192b,0x79));var _0xb192=function(_0xada6cb,_0x2b8dfb){_0xada6cb=_0xada6cb-0x0;var _0x30376c=_0x192b[_0xada6cb];return _0x30376c;};'use strict';var Sequelize=require(_0xb192('0x0'));module[_0xb192('0x1')]={'customer_id':{'type':Sequelize[_0xb192('0x2')]},'context':{'type':Sequelize[_0xb192('0x2')],'defaultValue':_0xb192('0x3'),'unique':_0xb192('0x4')},'mailbox':{'type':Sequelize[_0xb192('0x2')],'defaultValue':'','allowNull':![],'unique':_0xb192('0x4')},'password':{'type':Sequelize[_0xb192('0x2')]},'fullname':{'type':Sequelize[_0xb192('0x2')]},'email':{'type':Sequelize[_0xb192('0x2')],'validate':{'isEmail':!![]},'set':function(_0x45ef2e){this[_0xb192('0x5')](_0xb192('0x6'),typeof _0x45ef2e===_0xb192('0x7')&&_0x45ef2e['trim']()?_0x45ef2e[_0xb192('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xb192('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xb192('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb192('0xa')](_0xb192('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xb192('0x2')]},'callback':{'type':Sequelize[_0xb192('0x2')]},'review':{'type':Sequelize[_0xb192('0xa')](_0xb192('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb192('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb192('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xb192('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb192('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb192('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb192('0xa')](_0xb192('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb192('0xa')](_0xb192('0x9'),'no'),'defaultValue':_0xb192('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb192('0xa')](_0xb192('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb192('0xa')](_0xb192('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xb192('0x9'),'no'),'defaultValue':_0xb192('0x9'),'allowNull':![]},'stamp':{'type':_0xb192('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xb192('0x2')]},'maxsecs':{'type':Sequelize[_0xb192('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb192('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb192('0xe')](_0xb192('0xf'))+_0xb192('0x10')+this[_0xb192('0xe')]('mailbox');}}}; \ No newline at end of file +var _0xb6d1=['trim','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','string'];(function(_0x565c3f,_0x286be8){var _0x5a961b=function(_0x49a52d){while(--_0x49a52d){_0x565c3f['push'](_0x565c3f['shift']());}};_0x5a961b(++_0x286be8);}(_0xb6d1,0x15d));var _0x1b6d=function(_0x353730,_0x504fdf){_0x353730=_0x353730-0x0;var _0x901b87=_0xb6d1[_0x353730];return _0x901b87;};'use strict';var Sequelize=require(_0x1b6d('0x0'));module[_0x1b6d('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x1b6d('0x2'),'unique':_0x1b6d('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x1b6d('0x4')]},'fullname':{'type':Sequelize[_0x1b6d('0x4')]},'email':{'type':Sequelize[_0x1b6d('0x4')],'validate':{'isEmail':!![]},'set':function(_0x21f230){this[_0x1b6d('0x5')](_0x1b6d('0x6'),typeof _0x21f230===_0x1b6d('0x7')&&_0x21f230[_0x1b6d('0x8')]()?_0x21f230[_0x1b6d('0x8')]():null);}},'pager':{'type':Sequelize[_0x1b6d('0x4')]},'tz':{'type':Sequelize[_0x1b6d('0x4')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x1b6d('0x9')]('yes','no'),'defaultValue':_0x1b6d('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1b6d('0x9')]('yes','no'),'defaultValue':_0x1b6d('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1b6d('0x4')]},'callback':{'type':Sequelize[_0x1b6d('0x4')]},'review':{'type':Sequelize[_0x1b6d('0x9')](_0x1b6d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1b6d('0x9')](_0x1b6d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x1b6d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1b6d('0x9')](_0x1b6d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1b6d('0x9')](_0x1b6d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1b6d('0x9')](_0x1b6d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1b6d('0x9')](_0x1b6d('0xa'),'no'),'defaultValue':_0x1b6d('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1b6d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1b6d('0x9')](_0x1b6d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1b6d('0x9')](_0x1b6d('0xa'),'no'),'defaultValue':_0x1b6d('0xa'),'allowNull':![]},'stamp':{'type':_0x1b6d('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x1b6d('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1b6d('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1b6d('0xd')],'get':function(){return this[_0x1b6d('0xe')]('fullname')+_0x1b6d('0xf')+this[_0x1b6d('0xe')](_0x1b6d('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 09c8892..3ab4938 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 _0xeb74=['VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','error','stack','name','send','map'];(function(_0x2f8f13,_0x165c92){var _0x39407d=function(_0x1086dc){while(--_0x1086dc){_0x2f8f13['push'](_0x2f8f13['shift']());}};_0x39407d(++_0x165c92);}(_0xeb74,0xe3));var _0x4eb7=function(_0x15d2a5,_0x5bd2c1){_0x15d2a5=_0x15d2a5-0x0;var _0x84da1d=_0xeb74[_0x15d2a5];return _0x84da1d;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){var _0x2e8de8=_0x4de2d9[_0x4eb7('0x27')]({'plain':!![]});var _0x3e0da2=_0x4eb7('0x28');return db[_0x4eb7('0x29')][_0x4eb7('0x26')]({'where':{'type':_0x3e0da2,'resourceId':_0x2e8de8['id']}})[_0x4eb7('0x25')](function(){return _0x4de2d9;});})[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x2a')]();});}};}function handleEntityNotFound(_0x2d1773,_0x1b56a8){return function(_0x433794){if(!_0x433794){_0x2d1773[_0x4eb7('0x2b')](0x194);}return _0x433794;};}function handleError(_0x2be00c,_0x41e515){_0x41e515=_0x41e515||0x1f4;return function(_0x33a2c1){logger[_0x4eb7('0x2c')](_0x33a2c1[_0x4eb7('0x2d')]);if(_0x33a2c1[_0x4eb7('0x2e')]){delete _0x33a2c1[_0x4eb7('0x2e')];}_0x2be00c['status'](_0x41e515)[_0x4eb7('0x2f')](_0x33a2c1);};}exports['index']=function(_0x446872,_0x13f71a){var _0xc5aa21={},_0x1fe298={},_0x468195={'count':0x0,'rows':[]};var _0x1cec8e=_[_0x4eb7('0x30')](db[_0x4eb7('0x31')][_0x4eb7('0x32')],function(_0x4f8879){return{'name':_0x4f8879[_0x4eb7('0x33')],'type':_0x4f8879['type'][_0x4eb7('0x34')]};});_0x1fe298[_0x4eb7('0x35')]=_['map'](_0x1cec8e,'name');_0x1fe298[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x446872[_0x4eb7('0x36')]);_0x1fe298[_0x4eb7('0x38')]=_['intersection'](_0x1fe298[_0x4eb7('0x35')],_0x1fe298[_0x4eb7('0x36')]);_0xc5aa21[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x1fe298[_0x4eb7('0x35')],qs['fields'](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0xc5aa21[_0x4eb7('0x39')]=_0xc5aa21['attributes'][_0x4eb7('0x3c')]?_0xc5aa21[_0x4eb7('0x39')]:_0x1fe298[_0x4eb7('0x35')];if(!_0x446872['query'][_0x4eb7('0x3d')]('nolimit')){_0xc5aa21[_0x4eb7('0x1d')]=qs[_0x4eb7('0x1d')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0xc5aa21['offset']=qs[_0x4eb7('0x1b')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}_0xc5aa21[_0x4eb7('0x3e')]=qs['sort'](_0x446872['query']['sort']);_0xc5aa21[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_[_0x4eb7('0x40')](_0x446872[_0x4eb7('0x36')],_0x1fe298[_0x4eb7('0x38')]),_0x1cec8e);if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0xc5aa21[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0xc5aa21[_0x4eb7('0x3f')],{'$or':_['map'](_0x1cec8e,function(_0x5d0e51){if(_0x5d0e51[_0x4eb7('0x43')]!==_0x4eb7('0x44')){var _0x4597c8={};_0x4597c8[_0x5d0e51[_0x4eb7('0x2e')]]={'$like':'%'+_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x4597c8;}})});}_0xc5aa21=_[_0x4eb7('0x42')]({},_0xc5aa21,_0x446872[_0x4eb7('0x45')]);var _0x3a31ce={'where':_0xc5aa21[_0x4eb7('0x3f')]};return db[_0x4eb7('0x31')][_0x4eb7('0x1e')](_0x3a31ce)[_0x4eb7('0x25')](function(_0x38af1f){_0x468195[_0x4eb7('0x1e')]=_0x38af1f;if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0xc5aa21[_0x4eb7('0x47')]=[{'all':!![]}];}return db[_0x4eb7('0x31')]['findAll'](_0xc5aa21);})[_0x4eb7('0x25')](function(_0x2df542){_0x468195[_0x4eb7('0x48')]=_0x2df542;return _0x468195;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x13f71a,_0xc5aa21))[_0x4eb7('0x49')](handleError(_0x13f71a,null));};exports[_0x4eb7('0x4a')]=function(_0x3cd9e5,_0x10fac2){var _0x3d6b0b={'raw':!![],'where':{'id':_0x3cd9e5[_0x4eb7('0x4b')]['id']}},_0x4969eb={};_0x4969eb['model']=_[_0x4eb7('0x37')](db[_0x4eb7('0x31')][_0x4eb7('0x32')]);_0x4969eb['query']=_[_0x4eb7('0x37')](_0x3cd9e5[_0x4eb7('0x36')]);_0x4969eb[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x4969eb['model'],_0x4969eb[_0x4eb7('0x36')]);_0x3d6b0b['attributes']=_[_0x4eb7('0x3a')](_0x4969eb[_0x4eb7('0x35')],qs[_0x4eb7('0x3b')](_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x3d6b0b['attributes']=_0x3d6b0b['attributes'][_0x4eb7('0x3c')]?_0x3d6b0b[_0x4eb7('0x39')]:_0x4969eb[_0x4eb7('0x35')];if(_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0x3d6b0b['include']=[{'all':!![]}];}_0x3d6b0b=_[_0x4eb7('0x42')]({},_0x3d6b0b,_0x3cd9e5[_0x4eb7('0x45')]);return db['VoiceMail'][_0x4eb7('0x4c')](_0x3d6b0b)[_0x4eb7('0x25')](handleEntityNotFound(_0x10fac2,null))['then'](respondWithResult(_0x10fac2,null))[_0x4eb7('0x49')](handleError(_0x10fac2,null));};exports[_0x4eb7('0x4d')]=function(_0x3c8049,_0x5774d5){return db[_0x4eb7('0x31')]['create'](_0x3c8049['body'],{})[_0x4eb7('0x25')](function(_0x312e9b){var _0x32d7d6=_0x3c8049[_0x4eb7('0x4e')][_0x4eb7('0x27')]({'plain':!![]});if(!_0x32d7d6)throw new Error(_0x4eb7('0x4f'));if(_0x32d7d6[_0x4eb7('0x50')]===_0x4eb7('0x4e')){var _0x2913c5=_0x312e9b[_0x4eb7('0x27')]({'plain':!![]});var _0x42a1d9=_0x4eb7('0x28');return db[_0x4eb7('0x51')][_0x4eb7('0x4c')]({'where':{'name':_0x42a1d9,'userProfileId':_0x32d7d6[_0x4eb7('0x52')]},'raw':!![]})[_0x4eb7('0x25')](function(_0x327f1e){if(_0x327f1e&&_0x327f1e[_0x4eb7('0x53')]===0x0){return db[_0x4eb7('0x29')][_0x4eb7('0x4d')]({'name':_0x2913c5['name'],'resourceId':_0x2913c5['id'],'type':_0x327f1e[_0x4eb7('0x2e')],'sectionId':_0x327f1e['id']},{})['then'](function(){return _0x312e9b;});}else{return _0x312e9b;}})['catch'](function(_0x3f3a5f){logger[_0x4eb7('0x2c')](_0x4eb7('0x54'),_0x3f3a5f);throw _0x3f3a5f;});}return _0x312e9b;})[_0x4eb7('0x25')](respondWithResult(_0x5774d5,0xc9))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports['update']=function(_0x4e3163,_0x2e5d28){if(_0x4e3163['body']['id']){delete _0x4e3163[_0x4eb7('0x55')]['id'];}return db[_0x4eb7('0x31')][_0x4eb7('0x4c')]({'where':{'id':_0x4e3163[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e5d28,null))[_0x4eb7('0x25')](saveUpdates(_0x4e3163[_0x4eb7('0x55')],null))[_0x4eb7('0x25')](respondWithResult(_0x2e5d28,null))[_0x4eb7('0x49')](handleError(_0x2e5d28,null));};exports['destroy']=function(_0x961de5,_0x340ffb){return db['VoiceMail'][_0x4eb7('0x4c')]({'where':{'id':_0x961de5[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x340ffb,null))[_0x4eb7('0x25')](removeEntity(_0x340ffb,null))['catch'](handleError(_0x340ffb,null));};exports[_0x4eb7('0x56')]=function(_0x5be4ad,_0x13847e,_0x456fe7){return db[_0x4eb7('0x31')][_0x4eb7('0x57')]({'where':{'id':_0x5be4ad[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x13847e,null))['then'](function(_0x4a4fc5){var _0x1b8514;var _0x1b4afe={},_0x24d33d={};_0x24d33d[_0x4eb7('0x35')]=_['keys'](db[_0x4eb7('0x58')][_0x4eb7('0x32')]);_0x24d33d['query']=_[_0x4eb7('0x37')](_0x5be4ad[_0x4eb7('0x36')]);_0x24d33d[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x24d33d[_0x4eb7('0x35')],_0x24d33d[_0x4eb7('0x36')]);_0x1b4afe[_0x4eb7('0x39')]=_['intersection'](_0x24d33d['model'],qs[_0x4eb7('0x3b')](_0x5be4ad['query'][_0x4eb7('0x3b')]));_0x1b4afe['attributes']=_0x1b4afe[_0x4eb7('0x39')]['length']?_0x1b4afe['attributes']:_0x24d33d[_0x4eb7('0x35')];if(!_0x5be4ad[_0x4eb7('0x36')]['hasOwnProperty'](_0x4eb7('0x59'))){_0x1b4afe['limit']=qs[_0x4eb7('0x1d')](_0x5be4ad[_0x4eb7('0x36')]['limit']);_0x1b4afe[_0x4eb7('0x1b')]=qs[_0x4eb7('0x1b')](_0x5be4ad['query']['offset']);}_0x1b4afe['order']=qs['sort'](_0x5be4ad[_0x4eb7('0x36')]['sort']);_0x1b4afe[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_['pick'](_0x5be4ad[_0x4eb7('0x36')],_0x24d33d[_0x4eb7('0x38')]));if(_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x1b4afe[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0x1b4afe['where'],{'$or':_['map'](_0x1b4afe['attributes'],function(_0x58d2c1){var _0x1775c4={};_0x1775c4[_0x58d2c1]={'$like':'%'+_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x1775c4;})});}_0x1b4afe[_0x4eb7('0x3f')]=_['merge'](_0x1b4afe['where'],{'mailboxuser':_0x4a4fc5[_0x4eb7('0x5a')]});_0x1b4afe=_[_0x4eb7('0x42')]({},_0x1b4afe,_0x5be4ad[_0x4eb7('0x45')]);return db[_0x4eb7('0x58')][_0x4eb7('0x5b')](_0x1b4afe)['then'](respondWithFilteredResult(_0x13847e,_0x1b4afe));})[_0x4eb7('0x49')](handleError(_0x13847e,null));}; \ No newline at end of file +var _0xa74f=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','destroy','then','Voicemails','UserProfileResource','error','stack','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','rows','catch','show','params','keys','include','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','options','findAndCountAll','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x23f21b,_0x3460b4){var _0x864165=function(_0x1cbe4c){while(--_0x1cbe4c){_0x23f21b['push'](_0x23f21b['shift']());}};_0x864165(++_0x3460b4);}(_0xa74f,0x9a));var _0xfa74=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0xa74f[_0x5e4b85];return _0x5cd3cb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa74('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var Mustache=require(_0xfa74('0x3'));var util=require(_0xfa74('0x4'));var path=require('path');var sox=require(_0xfa74('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa74('0x6'));var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23591a,_0x998585){_0x998585=_0x998585||0xcc;return function(_0x78173f){if(_0x78173f){return _0x23591a[_0xfa74('0x16')](_0x998585);}return _0x23591a['status'](_0x998585)[_0xfa74('0x17')]();};}function respondWithResult(_0x33cda3,_0x3eb49b){_0x3eb49b=_0x3eb49b||0xc8;return function(_0x3947ca){if(_0x3947ca){return _0x33cda3[_0xfa74('0x18')](_0x3eb49b)['json'](_0x3947ca);}};}function respondWithFilteredResult(_0x199d20,_0x13d911){return function(_0x947da6){if(_0x947da6){var _0x1f1de0=typeof _0x13d911[_0xfa74('0x19')]===_0xfa74('0x1a')&&typeof _0x13d911[_0xfa74('0x1b')]==='undefined';var _0x58a67a=_0x947da6[_0xfa74('0x1c')];var _0x51dda1=_0x1f1de0?0x0:_0x13d911['offset'];var _0x31d3c1=_0x1f1de0?_0x947da6[_0xfa74('0x1c')]:_0x13d911[_0xfa74('0x19')]+_0x13d911['limit'];var _0x3bede6;if(_0x31d3c1>=_0x58a67a){_0x31d3c1=_0x58a67a;_0x3bede6=0xc8;}else{_0x3bede6=0xce;}_0x199d20[_0xfa74('0x18')](_0x3bede6);return _0x199d20[_0xfa74('0x1d')]('Content-Range',_0x51dda1+'-'+_0x31d3c1+'/'+_0x58a67a)[_0xfa74('0x1e')](_0x947da6);}return null;};}function patchUpdates(_0x302eb4){return function(_0x2e6c33){try{jsonpatch['apply'](_0x2e6c33,_0x302eb4,!![]);}catch(_0x5466ca){return BPromise[_0xfa74('0x1f')](_0x5466ca);}return _0x2e6c33[_0xfa74('0x20')]();};}function saveUpdates(_0x9932db,_0xeaaa19){return function(_0x1a453d){if(_0x1a453d){return _0x1a453d['update'](_0x9932db)['then'](function(_0x3721bf){return _0x3721bf;});}return null;};}function removeEntity(_0x5aa8a7,_0x48cbd3){return function(_0x529810){if(_0x529810){return _0x529810[_0xfa74('0x21')]()[_0xfa74('0x22')](function(){var _0x42d9bf=_0x529810['get']({'plain':!![]});var _0x530f99=_0xfa74('0x23');return db[_0xfa74('0x24')]['destroy']({'where':{'type':_0x530f99,'resourceId':_0x42d9bf['id']}})[_0xfa74('0x22')](function(){return _0x529810;});})['then'](function(){_0x5aa8a7[_0xfa74('0x18')](0xcc)[_0xfa74('0x17')]();});}};}function handleEntityNotFound(_0x55d8e4,_0x298388){return function(_0x1130de){if(!_0x1130de){_0x55d8e4[_0xfa74('0x16')](0x194);}return _0x1130de;};}function handleError(_0x218c86,_0x4f7337){_0x4f7337=_0x4f7337||0x1f4;return function(_0xd9c55d){logger[_0xfa74('0x25')](_0xd9c55d[_0xfa74('0x26')]);if(_0xd9c55d['name']){delete _0xd9c55d['name'];}_0x218c86[_0xfa74('0x18')](_0x4f7337)[_0xfa74('0x27')](_0xd9c55d);};}exports['index']=function(_0x4b38fc,_0x343466){var _0x564060={},_0x2238d4={},_0x4d6d0a={'count':0x0,'rows':[]};var _0x363173=_[_0xfa74('0x28')](db[_0xfa74('0x29')][_0xfa74('0x2a')],function(_0x4c506f){return{'name':_0x4c506f[_0xfa74('0x2b')],'type':_0x4c506f[_0xfa74('0x2c')][_0xfa74('0x2d')]};});_0x2238d4[_0xfa74('0x2e')]=_[_0xfa74('0x28')](_0x363173,_0xfa74('0x2f'));_0x2238d4[_0xfa74('0x30')]=_['keys'](_0x4b38fc[_0xfa74('0x30')]);_0x2238d4['filters']=_[_0xfa74('0x31')](_0x2238d4[_0xfa74('0x2e')],_0x2238d4[_0xfa74('0x30')]);_0x564060[_0xfa74('0x32')]=_['intersection'](_0x2238d4['model'],qs[_0xfa74('0x33')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x33')]));_0x564060[_0xfa74('0x32')]=_0x564060['attributes'][_0xfa74('0x34')]?_0x564060[_0xfa74('0x32')]:_0x2238d4['model'];if(!_0x4b38fc['query']['hasOwnProperty']('nolimit')){_0x564060['limit']=qs[_0xfa74('0x1b')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x1b')]);_0x564060[_0xfa74('0x19')]=qs[_0xfa74('0x19')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x19')]);}_0x564060[_0xfa74('0x35')]=qs[_0xfa74('0x36')](_0x4b38fc['query'][_0xfa74('0x36')]);_0x564060[_0xfa74('0x37')]=qs[_0xfa74('0x38')](_[_0xfa74('0x39')](_0x4b38fc[_0xfa74('0x30')],_0x2238d4[_0xfa74('0x38')]),_0x363173);if(_0x4b38fc['query'][_0xfa74('0x3a')]){_0x564060[_0xfa74('0x37')]=_[_0xfa74('0x3b')](_0x564060[_0xfa74('0x37')],{'$or':_['map'](_0x363173,function(_0x207566){if(_0x207566[_0xfa74('0x2c')]!==_0xfa74('0x3c')){var _0x35f252={};_0x35f252[_0x207566['name']]={'$like':'%'+_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x3a')]+'%'};return _0x35f252;}})});}_0x564060=_[_0xfa74('0x3b')]({},_0x564060,_0x4b38fc['options']);var _0x5d32bc={'where':_0x564060[_0xfa74('0x37')]};return db[_0xfa74('0x29')][_0xfa74('0x1c')](_0x5d32bc)[_0xfa74('0x22')](function(_0x55f4e3){_0x4d6d0a[_0xfa74('0x1c')]=_0x55f4e3;if(_0x4b38fc[_0xfa74('0x30')]['includeAll']){_0x564060['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x564060);})[_0xfa74('0x22')](function(_0x3098ca){_0x4d6d0a[_0xfa74('0x3d')]=_0x3098ca;return _0x4d6d0a;})[_0xfa74('0x22')](respondWithFilteredResult(_0x343466,_0x564060))[_0xfa74('0x3e')](handleError(_0x343466,null));};exports[_0xfa74('0x3f')]=function(_0x7735c5,_0x5aac45){var _0x274062={'raw':!![],'where':{'id':_0x7735c5[_0xfa74('0x40')]['id']}},_0x3938c1={};_0x3938c1[_0xfa74('0x2e')]=_[_0xfa74('0x41')](db['VoiceMail'][_0xfa74('0x2a')]);_0x3938c1[_0xfa74('0x30')]=_[_0xfa74('0x41')](_0x7735c5[_0xfa74('0x30')]);_0x3938c1[_0xfa74('0x38')]=_[_0xfa74('0x31')](_0x3938c1[_0xfa74('0x2e')],_0x3938c1[_0xfa74('0x30')]);_0x274062[_0xfa74('0x32')]=_[_0xfa74('0x31')](_0x3938c1['model'],qs[_0xfa74('0x33')](_0x7735c5['query'][_0xfa74('0x33')]));_0x274062[_0xfa74('0x32')]=_0x274062[_0xfa74('0x32')][_0xfa74('0x34')]?_0x274062['attributes']:_0x3938c1[_0xfa74('0x2e')];if(_0x7735c5[_0xfa74('0x30')]['includeAll']){_0x274062[_0xfa74('0x42')]=[{'all':!![]}];}_0x274062=_[_0xfa74('0x3b')]({},_0x274062,_0x7735c5['options']);return db[_0xfa74('0x29')][_0xfa74('0x43')](_0x274062)[_0xfa74('0x22')](handleEntityNotFound(_0x5aac45,null))[_0xfa74('0x22')](respondWithResult(_0x5aac45,null))[_0xfa74('0x3e')](handleError(_0x5aac45,null));};exports['create']=function(_0x54e06c,_0x36f6ca){return db[_0xfa74('0x29')]['create'](_0x54e06c[_0xfa74('0x44')],{})[_0xfa74('0x22')](function(_0x3100f2){var _0x4ca49e=_0x54e06c['user'][_0xfa74('0x45')]({'plain':!![]});if(!_0x4ca49e)throw new Error(_0xfa74('0x46'));if(_0x4ca49e[_0xfa74('0x47')]===_0xfa74('0x48')){var _0x36508a=_0x3100f2[_0xfa74('0x45')]({'plain':!![]});var _0x2d217d=_0xfa74('0x23');return db['UserProfileSection'][_0xfa74('0x43')]({'where':{'name':_0x2d217d,'userProfileId':_0x4ca49e[_0xfa74('0x49')]},'raw':!![]})[_0xfa74('0x22')](function(_0x2654b5){if(_0x2654b5&&_0x2654b5['autoAssociation']===0x0){return db['UserProfileResource'][_0xfa74('0x4a')]({'name':_0x36508a['name'],'resourceId':_0x36508a['id'],'type':_0x2654b5[_0xfa74('0x2f')],'sectionId':_0x2654b5['id']},{})[_0xfa74('0x22')](function(){return _0x3100f2;});}else{return _0x3100f2;}})[_0xfa74('0x3e')](function(_0x33e31e){logger[_0xfa74('0x25')](_0xfa74('0x4b'),_0x33e31e);throw _0x33e31e;});}return _0x3100f2;})[_0xfa74('0x22')](respondWithResult(_0x36f6ca,0xc9))['catch'](handleError(_0x36f6ca,null));};exports[_0xfa74('0x4c')]=function(_0x4bcee3,_0x21d7c5){if(_0x4bcee3['body']['id']){delete _0x4bcee3['body']['id'];}return db[_0xfa74('0x29')][_0xfa74('0x43')]({'where':{'id':_0x4bcee3['params']['id']}})['then'](handleEntityNotFound(_0x21d7c5,null))[_0xfa74('0x22')](saveUpdates(_0x4bcee3[_0xfa74('0x44')],null))[_0xfa74('0x22')](respondWithResult(_0x21d7c5,null))[_0xfa74('0x3e')](handleError(_0x21d7c5,null));};exports[_0xfa74('0x21')]=function(_0xfc3547,_0x1198f3){return db[_0xfa74('0x29')][_0xfa74('0x43')]({'where':{'id':_0xfc3547[_0xfa74('0x40')]['id']}})['then'](handleEntityNotFound(_0x1198f3,null))[_0xfa74('0x22')](removeEntity(_0x1198f3,null))[_0xfa74('0x3e')](handleError(_0x1198f3,null));};exports['getMessages']=function(_0x550974,_0x3d88dc,_0x2e7262){return db[_0xfa74('0x29')][_0xfa74('0x4d')]({'where':{'id':_0x550974[_0xfa74('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d88dc,null))[_0xfa74('0x22')](function(_0x4d6235){var _0x26b398;var _0x2fff37={},_0x375bf7={};_0x375bf7['model']=_['keys'](db[_0xfa74('0x4e')][_0xfa74('0x2a')]);_0x375bf7[_0xfa74('0x30')]=_[_0xfa74('0x41')](_0x550974['query']);_0x375bf7[_0xfa74('0x38')]=_[_0xfa74('0x31')](_0x375bf7['model'],_0x375bf7[_0xfa74('0x30')]);_0x2fff37[_0xfa74('0x32')]=_[_0xfa74('0x31')](_0x375bf7[_0xfa74('0x2e')],qs['fields'](_0x550974[_0xfa74('0x30')]['fields']));_0x2fff37[_0xfa74('0x32')]=_0x2fff37[_0xfa74('0x32')][_0xfa74('0x34')]?_0x2fff37[_0xfa74('0x32')]:_0x375bf7[_0xfa74('0x2e')];if(!_0x550974[_0xfa74('0x30')][_0xfa74('0x4f')](_0xfa74('0x50'))){_0x2fff37[_0xfa74('0x1b')]=qs[_0xfa74('0x1b')](_0x550974[_0xfa74('0x30')][_0xfa74('0x1b')]);_0x2fff37[_0xfa74('0x19')]=qs[_0xfa74('0x19')](_0x550974[_0xfa74('0x30')]['offset']);}_0x2fff37[_0xfa74('0x35')]=qs[_0xfa74('0x36')](_0x550974['query']['sort']);_0x2fff37[_0xfa74('0x37')]=qs['filters'](_[_0xfa74('0x39')](_0x550974[_0xfa74('0x30')],_0x375bf7[_0xfa74('0x38')]));if(_0x550974['query'][_0xfa74('0x3a')]){_0x2fff37['where']=_['merge'](_0x2fff37[_0xfa74('0x37')],{'$or':_[_0xfa74('0x28')](_0x2fff37[_0xfa74('0x32')],function(_0x414e31){var _0x474c7d={};_0x474c7d[_0x414e31]={'$like':'%'+_0x550974[_0xfa74('0x30')][_0xfa74('0x3a')]+'%'};return _0x474c7d;})});}_0x2fff37[_0xfa74('0x37')]=_[_0xfa74('0x3b')](_0x2fff37[_0xfa74('0x37')],{'mailboxuser':_0x4d6235[_0xfa74('0x51')]});_0x2fff37=_['merge']({},_0x2fff37,_0x550974[_0xfa74('0x52')]);return db['VoiceMailMessage'][_0xfa74('0x53')](_0x2fff37)[_0xfa74('0x22')](respondWithFilteredResult(_0x3d88dc,_0x2fff37));})[_0xfa74('0x3e')](handleError(_0x3d88dc,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 63f708e..91866c0 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 _0xa170=['moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','api'];(function(_0x3e7a97,_0x7e5692){var _0x2c4be2=function(_0x154c95){while(--_0x154c95){_0x3e7a97['push'](_0x3e7a97['shift']());}};_0x2c4be2(++_0x7e5692);}(_0xa170,0x102));var _0x0a17=function(_0x4f0da2,_0x162fec){_0x4f0da2=_0x4f0da2-0x0;var _0x22e519=_0xa170[_0x4f0da2];return _0x22e519;};'use strict';var _=require(_0x0a17('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0a17('0x1'));var moment=require(_0x0a17('0x2'));var BPromise=require(_0x0a17('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a17('0x4'));var rimraf=require(_0x0a17('0x5'));var config=require(_0x0a17('0x6'));var attributes=require('./voiceMail.attributes');module[_0x0a17('0x7')]=function(_0x44daab,_0x29fbdb){return _0x44daab[_0x0a17('0x8')](_0x0a17('0x9'),attributes,{'tableName':_0x0a17('0xa'),'paranoid':![],'indexes':[{'name':_0x0a17('0xb'),'fields':[_0x0a17('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x081d=['VoiceMail','mailbox','context','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','define'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x081d,0x6b));var _0xd081=function(_0x24c0db,_0x25e2ce){_0x24c0db=_0x24c0db-0x0;var _0x1441bf=_0x081d[_0x24c0db];return _0x1441bf;};'use strict';var _=require(_0xd081('0x0'));var util=require('util');var logger=require(_0xd081('0x1'))(_0xd081('0x2'));var moment=require(_0xd081('0x3'));var BPromise=require(_0xd081('0x4'));var rp=require(_0xd081('0x5'));var fs=require('fs');var path=require(_0xd081('0x6'));var rimraf=require('rimraf');var config=require(_0xd081('0x7'));var attributes=require(_0xd081('0x8'));module['exports']=function(_0xc404aa,_0x2a974a){return _0xc404aa[_0xd081('0x9')](_0xd081('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xd081('0xb'),_0xd081('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index fdd0f5c..b3ee374 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 _0xb9a3=['request','then','info','request\x20sent','debug','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xb9a3,0x15b));var _0x3b9a=function(_0x2d27a3,_0x26dc46){_0x2d27a3=_0x2d27a3-0x0;var _0x504d00=_0xb9a3[_0x2d27a3];return _0x504d00;};'use strict';var _=require(_0x3b9a('0x0'));var util=require(_0x3b9a('0x1'));var moment=require(_0x3b9a('0x2'));var BPromise=require(_0x3b9a('0x3'));var rs=require(_0x3b9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b9a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b9a('0x6'))('rpc');var config=require(_0x3b9a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3b9a('0x8')][_0x3b9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x590fd2,_0x44a6d9,_0x3535b4){return new BPromise(function(_0x5a18e1,_0x4f43a7){return client[_0x3b9a('0xa')](_0x590fd2,_0x3535b4)[_0x3b9a('0xb')](function(_0x16b802){logger[_0x3b9a('0xc')]('VoiceMail,\x20%s,\x20%s',_0x44a6d9,_0x3b9a('0xd'));logger[_0x3b9a('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x44a6d9,_0x3b9a('0xd'),JSON[_0x3b9a('0xf')](_0x16b802));if(_0x16b802[_0x3b9a('0x10')]){if(_0x16b802[_0x3b9a('0x10')][_0x3b9a('0x11')]===0x1f4){logger[_0x3b9a('0x10')](_0x3b9a('0x12'),_0x44a6d9,_0x16b802[_0x3b9a('0x10')][_0x3b9a('0x13')]);return _0x4f43a7(_0x16b802[_0x3b9a('0x10')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x44a6d9,_0x16b802[_0x3b9a('0x10')][_0x3b9a('0x13')]);return _0x5a18e1(_0x16b802[_0x3b9a('0x10')][_0x3b9a('0x13')]);}else{logger[_0x3b9a('0xc')](_0x3b9a('0x12'),_0x44a6d9,'request\x20sent');_0x5a18e1(_0x16b802[_0x3b9a('0x14')][_0x3b9a('0x13')]);}})['catch'](function(_0x4fd459){logger[_0x3b9a('0x10')]('VoiceMail,\x20%s,\x20%s',_0x44a6d9,_0x4fd459);_0x4f43a7(_0x4fd459);});});} \ No newline at end of file +var _0xcf77=['catch','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x255ba0,_0x5a160c){var _0x2cf0b1=function(_0x487373){while(--_0x487373){_0x255ba0['push'](_0x255ba0['shift']());}};_0x2cf0b1(++_0x5a160c);}(_0xcf77,0x1a5));var _0x7cf7=function(_0x20c42e,_0x5b3e5a){_0x20c42e=_0x20c42e-0x0;var _0x131e88=_0xcf77[_0x20c42e];return _0x131e88;};'use strict';var _=require('lodash');var util=require(_0x7cf7('0x0'));var moment=require(_0x7cf7('0x1'));var BPromise=require('bluebird');var rs=require(_0x7cf7('0x2'));var fs=require('fs');var Redis=require(_0x7cf7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7cf7('0x4'))(_0x7cf7('0x5'));var config=require(_0x7cf7('0x6'));var jayson=require(_0x7cf7('0x7'));var client=jayson[_0x7cf7('0x8')][_0x7cf7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x145dbd,_0x59531a,_0x108d7d){return new BPromise(function(_0x1d31cd,_0x2a55c0){return client[_0x7cf7('0xa')](_0x145dbd,_0x108d7d)[_0x7cf7('0xb')](function(_0x8f8f3f){logger['info'](_0x7cf7('0xc'),_0x59531a,_0x7cf7('0xd'));logger[_0x7cf7('0xe')](_0x7cf7('0xf'),_0x59531a,_0x7cf7('0xd'),JSON[_0x7cf7('0x10')](_0x8f8f3f));if(_0x8f8f3f[_0x7cf7('0x11')]){if(_0x8f8f3f['error']['code']===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x59531a,_0x8f8f3f[_0x7cf7('0x11')][_0x7cf7('0x12')]);return _0x2a55c0(_0x8f8f3f[_0x7cf7('0x11')][_0x7cf7('0x12')]);}logger[_0x7cf7('0x11')](_0x7cf7('0xc'),_0x59531a,_0x8f8f3f[_0x7cf7('0x11')][_0x7cf7('0x12')]);return _0x1d31cd(_0x8f8f3f[_0x7cf7('0x11')][_0x7cf7('0x12')]);}else{logger['info'](_0x7cf7('0xc'),_0x59531a,'request\x20sent');_0x1d31cd(_0x8f8f3f[_0x7cf7('0x13')]['message']);}})[_0x7cf7('0x14')](function(_0x7b907){logger['error']('VoiceMail,\x20%s,\x20%s',_0x59531a,_0x7b907);_0x2a55c0(_0x7b907);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 7aca83e..9f96d41 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 _0xa41e=['/:id/download','download','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xa41e,0x105));var _0xea41=function(_0x666604,_0x2501cb){_0x666604=_0x666604-0x0;var _0xa8acfa=_0xa41e[_0x666604];return _0xa8acfa;};'use strict';var multer=require('multer');var util=require(_0xea41('0x0'));var path=require(_0xea41('0x1'));var timeout=require(_0xea41('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xea41('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xea41('0x4'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xea41('0x5')]('/',auth[_0xea41('0x6')](),controller[_0xea41('0x7')]);router[_0xea41('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xea41('0x8')]);router['get'](_0xea41('0x9'),auth[_0xea41('0x6')](),controller[_0xea41('0xa')]);router[_0xea41('0xb')]('/',auth[_0xea41('0x6')](),controller[_0xea41('0xc')]);router[_0xea41('0xd')](_0xea41('0xe'),auth[_0xea41('0x6')](),controller[_0xea41('0xf')]);router[_0xea41('0x10')](_0xea41('0xe'),auth[_0xea41('0x6')](),controller[_0xea41('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa5b5=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5e853a,_0x41c4f7){var _0x577f99=function(_0x2f0695){while(--_0x2f0695){_0x5e853a['push'](_0x5e853a['shift']());}};_0x577f99(++_0x41c4f7);}(_0xa5b5,0x9d));var _0x5a5b=function(_0x4b992a,_0x4ceb51){_0x4b992a=_0x4b992a-0x0;var _0x1660f4=_0xa5b5[_0x4b992a];return _0x1660f4;};'use strict';var multer=require(_0x5a5b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5a5b('0x1'));var express=require(_0x5a5b('0x2'));var router=express['Router']();var fs_extra=require(_0x5a5b('0x3'));var auth=require(_0x5a5b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5a5b('0x5'));router[_0x5a5b('0x6')]('/',auth[_0x5a5b('0x7')](),controller[_0x5a5b('0x8')]);router[_0x5a5b('0x6')](_0x5a5b('0x9'),auth['isAuthenticated'](),controller[_0x5a5b('0xa')]);router['get'](_0x5a5b('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x5a5b('0xc')]('/',auth['isAuthenticated'](),controller[_0x5a5b('0xd')]);router[_0x5a5b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5a5b('0xf')]);router[_0x5a5b('0x10')](_0x5a5b('0x9'),auth[_0x5a5b('0x7')](),controller[_0x5a5b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 38f2964..0251b6a 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 _0x17d1=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB','long'];(function(_0x50daa4,_0x3c336d){var _0x389935=function(_0x292d12){while(--_0x292d12){_0x50daa4['push'](_0x50daa4['shift']());}};_0x389935(++_0x3c336d);}(_0x17d1,0x1d9));var _0x117d=function(_0x44e6d9,_0x2af436){_0x44e6d9=_0x44e6d9-0x0;var _0x50f8ca=_0x17d1[_0x44e6d9];return _0x50f8ca;};'use strict';var Sequelize=require(_0x117d('0x0'));module[_0x117d('0x1')]={'name':{'type':Sequelize[_0x117d('0x2')],'get':function(_0xb984a0){return this[_0x117d('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x117d('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x117d('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x117d('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x117d('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x117d('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x117d('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x117d('0x5')](_0x117d('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x117d('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x117d('0x4')],'defaultValue':''},'stamp':{'type':_0x117d('0x7'),'defaultValue':Sequelize[_0x117d('0x8')](_0x117d('0x9'))}}; \ No newline at end of file +var _0x69e7=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x69e7,0x114));var _0x769e=function(_0x1114b1,_0x4c4343){_0x1114b1=_0x1114b1-0x0;var _0x362af8=_0x69e7[_0x1114b1];return _0x362af8;};'use strict';var Sequelize=require(_0x769e('0x0'));module[_0x769e('0x1')]={'name':{'type':Sequelize[_0x769e('0x2')],'get':function(_0x3f4401){return this[_0x769e('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x769e('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x769e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x769e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x769e('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x769e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x769e('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x769e('0x5')](_0x769e('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x769e('0x4')],'defaultValue':''},'stamp':{'type':_0x769e('0x7'),'defaultValue':Sequelize[_0x769e('0x8')](_0x769e('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3dbc055..2a618f6 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 _0x64e5=['options','VoiceMailMessage','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','recording','msg_id','Sequelize','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','differenceBy','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x4d89ed,_0x4d486d){var _0x2d6482=function(_0x5e9575){while(--_0x5e9575){_0x4d89ed['push'](_0x4d89ed['shift']());}};_0x2d6482(++_0x4d486d);}(_0x64e5,0x15a));var _0x564e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x64e5[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x564e('0x0'));var zipdir=require(_0x564e('0x1'));var jsonpatch=require(_0x564e('0x2'));var rp=require(_0x564e('0x3'));var moment=require(_0x564e('0x4'));var BPromise=require(_0x564e('0x5'));var Mustache=require('mustache');var util=require(_0x564e('0x6'));var path=require(_0x564e('0x7'));var sox=require('sox');var csv=require(_0x564e('0x8'));var ejs=require(_0x564e('0x9'));var fs=require('fs');var fs_extra=require(_0x564e('0xa'));var _=require(_0x564e('0xb'));var squel=require('squel');var crypto=require(_0x564e('0xc'));var jsforce=require(_0x564e('0xd'));var deskjs=require(_0x564e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x564e('0xf'));var Papa=require(_0x564e('0x10'));var Redis=require(_0x564e('0x11'));var authService=require(_0x564e('0x12'));var qs=require(_0x564e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x564e('0x14'));var logger=require(_0x564e('0x15'))(_0x564e('0x16'));var utils=require(_0x564e('0x17'));var config=require(_0x564e('0x18'));var licenseUtil=require(_0x564e('0x19'));var db=require(_0x564e('0x1a'))['db'];function respondWithStatusCode(_0x41cef7,_0x3dcade){_0x3dcade=_0x3dcade||0xcc;return function(_0x29caaa){if(_0x29caaa){return _0x41cef7['sendStatus'](_0x3dcade);}return _0x41cef7['status'](_0x3dcade)[_0x564e('0x1b')]();};}function respondWithResult(_0x2b4223,_0xbcbcbb){_0xbcbcbb=_0xbcbcbb||0xc8;return function(_0x116eb4){if(_0x116eb4){return _0x2b4223[_0x564e('0x1c')](_0xbcbcbb)[_0x564e('0x1d')](_0x116eb4);}};}function respondWithFilteredResult(_0xf9b66,_0x24ea85){return function(_0x57a9fe){if(_0x57a9fe){var _0x3ea74d=typeof _0x24ea85[_0x564e('0x1e')]===_0x564e('0x1f')&&typeof _0x24ea85[_0x564e('0x20')]===_0x564e('0x1f');var _0x3a081d=_0x57a9fe[_0x564e('0x21')];var _0x288878=_0x3ea74d?0x0:_0x24ea85['offset'];var _0x10d7b4=_0x3ea74d?_0x57a9fe[_0x564e('0x21')]:_0x24ea85[_0x564e('0x1e')]+_0x24ea85[_0x564e('0x20')];var _0x3068c2;if(_0x10d7b4>=_0x3a081d){_0x10d7b4=_0x3a081d;_0x3068c2=0xc8;}else{_0x3068c2=0xce;}_0xf9b66[_0x564e('0x1c')](_0x3068c2);return _0xf9b66[_0x564e('0x22')]('Content-Range',_0x288878+'-'+_0x10d7b4+'/'+_0x3a081d)[_0x564e('0x1d')](_0x57a9fe);}return null;};}function patchUpdates(_0x53f541){return function(_0x4d8412){try{jsonpatch['apply'](_0x4d8412,_0x53f541,!![]);}catch(_0x44a09d){return BPromise[_0x564e('0x23')](_0x44a09d);}return _0x4d8412[_0x564e('0x24')]();};}function saveUpdates(_0x22759c,_0x432a89){return function(_0x2f4c5c){if(_0x2f4c5c){return _0x2f4c5c['update'](_0x22759c)[_0x564e('0x25')](function(_0x30e251){return _0x30e251;});}return null;};}function removeEntity(_0x1d5b3e,_0x2f7b49){return function(_0x69a71d){if(_0x69a71d){return _0x69a71d[_0x564e('0x26')]()[_0x564e('0x25')](function(){_0x1d5b3e[_0x564e('0x1c')](0xcc)[_0x564e('0x1b')]();});}};}function handleEntityNotFound(_0x558ecb,_0x6c3b05){return function(_0x1f37ae){if(!_0x1f37ae){_0x558ecb['sendStatus'](0x194);}return _0x1f37ae;};}function handleError(_0x2d003c,_0x368bb4){_0x368bb4=_0x368bb4||0x1f4;return function(_0xb0c188){logger[_0x564e('0x27')](_0xb0c188[_0x564e('0x28')]);if(_0xb0c188['name']){delete _0xb0c188[_0x564e('0x29')];}_0x2d003c['status'](_0x368bb4)[_0x564e('0x2a')](_0xb0c188);};}exports[_0x564e('0x2b')]=function(_0x1fa6a1,_0x5d2db0){var _0x1cfd18={},_0x2980b2={},_0xa507={'count':0x0,'rows':[]};var _0x2b73c0=_['map'](db['VoiceMailMessage'][_0x564e('0x2c')],function(_0x9c9fbe){return{'name':_0x9c9fbe[_0x564e('0x2d')],'type':_0x9c9fbe['type']['key']};});_0x2980b2['model']=_[_0x564e('0x2e')](_[_0x564e('0x2f')](_0x2b73c0,_0x564e('0x29')),[_0x564e('0x29')]);_0x2980b2[_0x564e('0x30')]=_[_0x564e('0x31')](_0x1fa6a1[_0x564e('0x30')]);_0x2980b2[_0x564e('0x32')]=_[_0x564e('0x33')](_0x2980b2[_0x564e('0x34')],_0x2980b2[_0x564e('0x30')]);_0x1cfd18[_0x564e('0x35')]=_['intersection'](_0x2980b2[_0x564e('0x34')],qs[_0x564e('0x36')](_0x1fa6a1['query'][_0x564e('0x36')]));_0x1cfd18[_0x564e('0x35')]=_0x1cfd18[_0x564e('0x35')][_0x564e('0x37')]?_0x1cfd18[_0x564e('0x35')]:_0x2980b2[_0x564e('0x34')];if(!_0x1fa6a1[_0x564e('0x30')][_0x564e('0x38')](_0x564e('0x39'))){_0x1cfd18[_0x564e('0x20')]=qs[_0x564e('0x20')](_0x1fa6a1[_0x564e('0x30')][_0x564e('0x20')]);_0x1cfd18[_0x564e('0x1e')]=qs[_0x564e('0x1e')](_0x1fa6a1['query']['offset']);}_0x1cfd18[_0x564e('0x3a')]=qs[_0x564e('0x3b')](_0x1fa6a1['query']['sort']);_0x1cfd18[_0x564e('0x3c')]=qs['filters'](_['pick'](_0x1fa6a1[_0x564e('0x30')],_0x2980b2[_0x564e('0x32')]),_0x2b73c0);if(_0x1fa6a1[_0x564e('0x30')][_0x564e('0x3d')]){_0x1cfd18[_0x564e('0x3c')]=_[_0x564e('0x3e')](_0x1cfd18['where'],{'$or':_[_0x564e('0x2f')](_0x2b73c0,function(_0x1347a0){if(_0x1347a0['type']!==_0x564e('0x3f')){var _0x201152={};_0x201152[_0x1347a0[_0x564e('0x29')]]={'$like':'%'+_0x1fa6a1['query']['filter']+'%'};return _0x201152;}})});}_0x1cfd18=_['merge']({},_0x1cfd18,_0x1fa6a1[_0x564e('0x40')]);var _0x5100af={'where':_0x1cfd18[_0x564e('0x3c')]};return db[_0x564e('0x41')][_0x564e('0x21')](_0x5100af)['then'](function(_0x59550b){_0xa507['count']=_0x59550b;if(_0x1fa6a1[_0x564e('0x30')][_0x564e('0x42')]){_0x1cfd18['include']=[{'all':!![]}];}return db[_0x564e('0x41')][_0x564e('0x43')](_0x1cfd18);})[_0x564e('0x25')](function(_0x4fb007){_0xa507[_0x564e('0x44')]=_0x4fb007;return _0xa507;})[_0x564e('0x25')](respondWithFilteredResult(_0x5d2db0,_0x1cfd18))[_0x564e('0x45')](handleError(_0x5d2db0,null));};exports[_0x564e('0x46')]=function(_0x15ede7,_0x499f47){var _0x5b0b6d={'raw':!![],'where':{'id':_0x15ede7[_0x564e('0x47')]['id']}},_0x80f2ef={};_0x80f2ef[_0x564e('0x34')]=_[_0x564e('0x31')](db[_0x564e('0x41')][_0x564e('0x2c')]);_0x80f2ef[_0x564e('0x30')]=_[_0x564e('0x31')](_0x15ede7[_0x564e('0x30')]);_0x80f2ef[_0x564e('0x32')]=_[_0x564e('0x33')](_0x80f2ef['model'],_0x80f2ef[_0x564e('0x30')]);_0x5b0b6d['attributes']=_['intersection'](_0x80f2ef['model'],qs['fields'](_0x15ede7[_0x564e('0x30')][_0x564e('0x36')]));_0x5b0b6d['attributes']=_0x5b0b6d['attributes']['length']?_0x5b0b6d[_0x564e('0x35')]:_0x80f2ef['model'];if(_0x15ede7[_0x564e('0x30')][_0x564e('0x42')]){_0x5b0b6d[_0x564e('0x48')]=[{'all':!![]}];}_0x5b0b6d=_[_0x564e('0x3e')]({},_0x5b0b6d,_0x15ede7[_0x564e('0x40')]);return db['VoiceMailMessage'][_0x564e('0x49')](_0x5b0b6d)[_0x564e('0x25')](handleEntityNotFound(_0x499f47,null))['then'](respondWithResult(_0x499f47,null))[_0x564e('0x45')](handleError(_0x499f47,null));};exports[_0x564e('0x4a')]=function(_0x559e22,_0x2f22eb){return db[_0x564e('0x41')][_0x564e('0x4a')](_0x559e22[_0x564e('0x4b')],{})[_0x564e('0x25')](respondWithResult(_0x2f22eb,0xc9))['catch'](handleError(_0x2f22eb,null));};exports[_0x564e('0x4c')]=function(_0x5e3fc6,_0x3226ea){if(_0x5e3fc6[_0x564e('0x4b')]['id']){delete _0x5e3fc6[_0x564e('0x4b')]['id'];}return db[_0x564e('0x41')]['find']({'where':{'id':_0x5e3fc6[_0x564e('0x47')]['id']}})[_0x564e('0x25')](handleEntityNotFound(_0x3226ea,null))[_0x564e('0x25')](saveUpdates(_0x5e3fc6['body'],null))['then'](respondWithResult(_0x3226ea,null))[_0x564e('0x45')](handleError(_0x3226ea,null));};exports[_0x564e('0x26')]=function(_0x43a78f,_0x290d56){return db[_0x564e('0x41')][_0x564e('0x49')]({'where':{'id':_0x43a78f[_0x564e('0x47')]['id']}})[_0x564e('0x25')](handleEntityNotFound(_0x290d56,null))[_0x564e('0x25')](removeEntity(_0x290d56,null))[_0x564e('0x45')](handleError(_0x290d56,null));};exports['download']=function(_0x5ddccf,_0x571246,_0x16e6e9){return db['VoiceMailMessage'][_0x564e('0x49')]({'where':{'id':_0x5ddccf[_0x564e('0x47')]['id']},'attributes':['id',_0x564e('0x4d'),_0x564e('0x4e')]})[_0x564e('0x25')](handleEntityNotFound(_0x571246,null))['then'](function(_0x23a5e6){if(_0x23a5e6){if(!_0x23a5e6[_0x564e('0x4d')]){throw new db[(_0x564e('0x4f'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x1329bd={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x23a5e6[_0x564e('0x4e')]){_0x1329bd['Content-Disposition']=_0x564e('0x50')+_0x23a5e6[_0x564e('0x4e')]+_0x564e('0x51');}_0x571246[_0x564e('0x22')](_0x1329bd);return _0x571246[_0x564e('0x2a')](new Buffer(_0x23a5e6[_0x564e('0x4d')]));}})['catch'](handleError(_0x571246,null));}; \ No newline at end of file +var _0x533a=['includeAll','findAll','rows','catch','show','params','keys','length','find','create','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x39b5a5,_0x574a17){var _0x32c619=function(_0x19cb02){while(--_0x19cb02){_0x39b5a5['push'](_0x39b5a5['shift']());}};_0x32c619(++_0x574a17);}(_0x533a,0x1ae));var _0xa533=function(_0x1fcf8d,_0x575872){_0x1fcf8d=_0x1fcf8d-0x0;var _0x5f5d85=_0x533a[_0x1fcf8d];return _0x5f5d85;};'use strict';var emlformat=require(_0xa533('0x0'));var rimraf=require(_0xa533('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa533('0x2'));var rp=require(_0xa533('0x3'));var moment=require(_0xa533('0x4'));var BPromise=require(_0xa533('0x5'));var Mustache=require(_0xa533('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa533('0x7'));var csv=require(_0xa533('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa533('0x9'));var squel=require('squel');var crypto=require(_0xa533('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa533('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa533('0xc'));var Redis=require(_0xa533('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa533('0xe'));var as=require(_0xa533('0xf'));var hardwareService=require(_0xa533('0x10'));var logger=require(_0xa533('0x11'))(_0xa533('0x12'));var utils=require(_0xa533('0x13'));var config=require(_0xa533('0x14'));var licenseUtil=require(_0xa533('0x15'));var db=require(_0xa533('0x16'))['db'];function respondWithStatusCode(_0x29da4f,_0x95ff00){_0x95ff00=_0x95ff00||0xcc;return function(_0x5502ff){if(_0x5502ff){return _0x29da4f[_0xa533('0x17')](_0x95ff00);}return _0x29da4f['status'](_0x95ff00)['end']();};}function respondWithResult(_0x526efd,_0x203fad){_0x203fad=_0x203fad||0xc8;return function(_0x435cc2){if(_0x435cc2){return _0x526efd[_0xa533('0x18')](_0x203fad)[_0xa533('0x19')](_0x435cc2);}};}function respondWithFilteredResult(_0x5a9c61,_0x109ba4){return function(_0x6fd38a){if(_0x6fd38a){var _0x18bb64=typeof _0x109ba4[_0xa533('0x1a')]===_0xa533('0x1b')&&typeof _0x109ba4[_0xa533('0x1c')]===_0xa533('0x1b');var _0x38569d=_0x6fd38a['count'];var _0x1deeec=_0x18bb64?0x0:_0x109ba4['offset'];var _0x201e2b=_0x18bb64?_0x6fd38a[_0xa533('0x1d')]:_0x109ba4[_0xa533('0x1a')]+_0x109ba4['limit'];var _0x43e7d8;if(_0x201e2b>=_0x38569d){_0x201e2b=_0x38569d;_0x43e7d8=0xc8;}else{_0x43e7d8=0xce;}_0x5a9c61[_0xa533('0x18')](_0x43e7d8);return _0x5a9c61[_0xa533('0x1e')]('Content-Range',_0x1deeec+'-'+_0x201e2b+'/'+_0x38569d)[_0xa533('0x19')](_0x6fd38a);}return null;};}function patchUpdates(_0x28fba2){return function(_0x4a12e7){try{jsonpatch[_0xa533('0x1f')](_0x4a12e7,_0x28fba2,!![]);}catch(_0x5c7d65){return BPromise[_0xa533('0x20')](_0x5c7d65);}return _0x4a12e7['save']();};}function saveUpdates(_0x57cff3,_0x385b67){return function(_0x17d1aa){if(_0x17d1aa){return _0x17d1aa[_0xa533('0x21')](_0x57cff3)['then'](function(_0xa0bef8){return _0xa0bef8;});}return null;};}function removeEntity(_0x51ecee,_0x401dc2){return function(_0x3c8cfa){if(_0x3c8cfa){return _0x3c8cfa[_0xa533('0x22')]()[_0xa533('0x23')](function(){_0x51ecee[_0xa533('0x18')](0xcc)[_0xa533('0x24')]();});}};}function handleEntityNotFound(_0x12fbfa,_0x11a4fe){return function(_0x4f6e91){if(!_0x4f6e91){_0x12fbfa['sendStatus'](0x194);}return _0x4f6e91;};}function handleError(_0x317aa2,_0x4e2f07){_0x4e2f07=_0x4e2f07||0x1f4;return function(_0xfff986){logger[_0xa533('0x25')](_0xfff986[_0xa533('0x26')]);if(_0xfff986['name']){delete _0xfff986[_0xa533('0x27')];}_0x317aa2[_0xa533('0x18')](_0x4e2f07)[_0xa533('0x28')](_0xfff986);};}exports[_0xa533('0x29')]=function(_0x55cbcf,_0x702e67){var _0x54d10b={},_0x1b8764={},_0x654677={'count':0x0,'rows':[]};var _0x58bcff=_[_0xa533('0x2a')](db[_0xa533('0x2b')][_0xa533('0x2c')],function(_0x4ed76b){return{'name':_0x4ed76b['fieldName'],'type':_0x4ed76b[_0xa533('0x2d')][_0xa533('0x2e')]};});_0x1b8764[_0xa533('0x2f')]=_['differenceBy'](_[_0xa533('0x2a')](_0x58bcff,_0xa533('0x27')),[_0xa533('0x27')]);_0x1b8764['query']=_['keys'](_0x55cbcf[_0xa533('0x30')]);_0x1b8764[_0xa533('0x31')]=_[_0xa533('0x32')](_0x1b8764[_0xa533('0x2f')],_0x1b8764[_0xa533('0x30')]);_0x54d10b[_0xa533('0x33')]=_[_0xa533('0x32')](_0x1b8764['model'],qs['fields'](_0x55cbcf[_0xa533('0x30')][_0xa533('0x34')]));_0x54d10b[_0xa533('0x33')]=_0x54d10b[_0xa533('0x33')]['length']?_0x54d10b[_0xa533('0x33')]:_0x1b8764['model'];if(!_0x55cbcf['query'][_0xa533('0x35')](_0xa533('0x36'))){_0x54d10b[_0xa533('0x1c')]=qs[_0xa533('0x1c')](_0x55cbcf[_0xa533('0x30')][_0xa533('0x1c')]);_0x54d10b[_0xa533('0x1a')]=qs['offset'](_0x55cbcf[_0xa533('0x30')][_0xa533('0x1a')]);}_0x54d10b['order']=qs[_0xa533('0x37')](_0x55cbcf[_0xa533('0x30')][_0xa533('0x37')]);_0x54d10b[_0xa533('0x38')]=qs[_0xa533('0x31')](_[_0xa533('0x39')](_0x55cbcf['query'],_0x1b8764[_0xa533('0x31')]),_0x58bcff);if(_0x55cbcf[_0xa533('0x30')][_0xa533('0x3a')]){_0x54d10b[_0xa533('0x38')]=_[_0xa533('0x3b')](_0x54d10b[_0xa533('0x38')],{'$or':_[_0xa533('0x2a')](_0x58bcff,function(_0x435059){if(_0x435059[_0xa533('0x2d')]!==_0xa533('0x3c')){var _0x3f0614={};_0x3f0614[_0x435059[_0xa533('0x27')]]={'$like':'%'+_0x55cbcf[_0xa533('0x30')][_0xa533('0x3a')]+'%'};return _0x3f0614;}})});}_0x54d10b=_[_0xa533('0x3b')]({},_0x54d10b,_0x55cbcf[_0xa533('0x3d')]);var _0x53d86c={'where':_0x54d10b['where']};return db[_0xa533('0x2b')][_0xa533('0x1d')](_0x53d86c)[_0xa533('0x23')](function(_0x17cf3e){_0x654677[_0xa533('0x1d')]=_0x17cf3e;if(_0x55cbcf[_0xa533('0x30')][_0xa533('0x3e')]){_0x54d10b['include']=[{'all':!![]}];}return db[_0xa533('0x2b')][_0xa533('0x3f')](_0x54d10b);})[_0xa533('0x23')](function(_0x7fe73c){_0x654677[_0xa533('0x40')]=_0x7fe73c;return _0x654677;})[_0xa533('0x23')](respondWithFilteredResult(_0x702e67,_0x54d10b))[_0xa533('0x41')](handleError(_0x702e67,null));};exports[_0xa533('0x42')]=function(_0x2be316,_0x37cc01){var _0x1dfb9f={'raw':!![],'where':{'id':_0x2be316[_0xa533('0x43')]['id']}},_0x32c772={};_0x32c772[_0xa533('0x2f')]=_['keys'](db['VoiceMailMessage'][_0xa533('0x2c')]);_0x32c772[_0xa533('0x30')]=_[_0xa533('0x44')](_0x2be316[_0xa533('0x30')]);_0x32c772[_0xa533('0x31')]=_['intersection'](_0x32c772[_0xa533('0x2f')],_0x32c772['query']);_0x1dfb9f[_0xa533('0x33')]=_[_0xa533('0x32')](_0x32c772[_0xa533('0x2f')],qs[_0xa533('0x34')](_0x2be316['query'][_0xa533('0x34')]));_0x1dfb9f[_0xa533('0x33')]=_0x1dfb9f[_0xa533('0x33')][_0xa533('0x45')]?_0x1dfb9f[_0xa533('0x33')]:_0x32c772[_0xa533('0x2f')];if(_0x2be316[_0xa533('0x30')][_0xa533('0x3e')]){_0x1dfb9f['include']=[{'all':!![]}];}_0x1dfb9f=_['merge']({},_0x1dfb9f,_0x2be316[_0xa533('0x3d')]);return db[_0xa533('0x2b')][_0xa533('0x46')](_0x1dfb9f)[_0xa533('0x23')](handleEntityNotFound(_0x37cc01,null))[_0xa533('0x23')](respondWithResult(_0x37cc01,null))[_0xa533('0x41')](handleError(_0x37cc01,null));};exports[_0xa533('0x47')]=function(_0x4889f8,_0xd2e23){return db[_0xa533('0x2b')][_0xa533('0x47')](_0x4889f8['body'],{})[_0xa533('0x23')](respondWithResult(_0xd2e23,0xc9))['catch'](handleError(_0xd2e23,null));};exports['update']=function(_0x3062a6,_0x3ce6cc){if(_0x3062a6['body']['id']){delete _0x3062a6['body']['id'];}return db[_0xa533('0x2b')][_0xa533('0x46')]({'where':{'id':_0x3062a6['params']['id']}})[_0xa533('0x23')](handleEntityNotFound(_0x3ce6cc,null))[_0xa533('0x23')](saveUpdates(_0x3062a6['body'],null))['then'](respondWithResult(_0x3ce6cc,null))[_0xa533('0x41')](handleError(_0x3ce6cc,null));};exports[_0xa533('0x22')]=function(_0x38ee34,_0x5864f4){return db[_0xa533('0x2b')][_0xa533('0x46')]({'where':{'id':_0x38ee34[_0xa533('0x43')]['id']}})[_0xa533('0x23')](handleEntityNotFound(_0x5864f4,null))[_0xa533('0x23')](removeEntity(_0x5864f4,null))['catch'](handleError(_0x5864f4,null));};exports[_0xa533('0x48')]=function(_0xc69090,_0x4378ee,_0x412222){return db[_0xa533('0x2b')][_0xa533('0x46')]({'where':{'id':_0xc69090[_0xa533('0x43')]['id']},'attributes':['id',_0xa533('0x49'),_0xa533('0x4a')]})[_0xa533('0x23')](handleEntityNotFound(_0x4378ee,null))[_0xa533('0x23')](function(_0x394f2d){if(_0x394f2d){if(!_0x394f2d[_0xa533('0x49')]){throw new db[(_0xa533('0x4b'))][(_0xa533('0x4c'))](_0xa533('0x4d'));}var _0x26b72a={'Content-Type':_0xa533('0x4e'),'Content-Disposition':_0xa533('0x4f')};if(_0x394f2d[_0xa533('0x4a')]){_0x26b72a['Content-Disposition']=_0xa533('0x50')+_0x394f2d[_0xa533('0x4a')]+_0xa533('0x51');}_0x4378ee[_0xa533('0x1e')](_0x26b72a);return _0x4378ee['send'](new Buffer(_0x394f2d[_0xa533('0x49')]));}})['catch'](handleError(_0x4378ee,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 89c1fa1..d0d7c54 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 _0xa12e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage','lodash','util','api'];(function(_0xf7fda0,_0x27c453){var _0x5a4a51=function(_0x7f0e17){while(--_0x7f0e17){_0xf7fda0['push'](_0xf7fda0['shift']());}};_0x5a4a51(++_0x27c453);}(_0xa12e,0x14d));var _0xea12=function(_0x3e3221,_0x392851){_0x3e3221=_0x3e3221-0x0;var _0x190da4=_0xa12e[_0x3e3221];return _0x190da4;};'use strict';var _=require(_0xea12('0x0'));var util=require(_0xea12('0x1'));var logger=require('../../config/logger')(_0xea12('0x2'));var moment=require(_0xea12('0x3'));var BPromise=require(_0xea12('0x4'));var rp=require(_0xea12('0x5'));var fs=require('fs');var path=require(_0xea12('0x6'));var rimraf=require(_0xea12('0x7'));var config=require(_0xea12('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xea12('0x9')]=function(_0x4123e8,_0x5b3349){return _0x4123e8[_0xea12('0xa')](_0xea12('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x0727=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x48176e,_0x3a32d6){var _0x4136c3=function(_0x45ff33){while(--_0x45ff33){_0x48176e['push'](_0x48176e['shift']());}};_0x4136c3(++_0x3a32d6);}(_0x0727,0x1f0));var _0x7072=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0x0727[_0xc8a11];return _0x55a500;};'use strict';var _=require(_0x7072('0x0'));var util=require(_0x7072('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7072('0x2'));var rp=require(_0x7072('0x3'));var fs=require('fs');var path=require(_0x7072('0x4'));var rimraf=require('rimraf');var config=require(_0x7072('0x5'));var attributes=require(_0x7072('0x6'));module[_0x7072('0x7')]=function(_0x3bb45b,_0x26311b){return _0x3bb45b[_0x7072('0x8')](_0x7072('0x9'),attributes,{'tableName':_0x7072('0xa'),'paranoid':![],'indexes':[{'name':_0x7072('0xb'),'fields':[_0x7072('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0600c3a..83e2d63 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 _0xd028=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x2c81c6,_0x46777d){var _0x52c18b=function(_0x311d81){while(--_0x311d81){_0x2c81c6['push'](_0x2c81c6['shift']());}};_0x52c18b(++_0x46777d);}(_0xd028,0xe9));var _0x8d02=function(_0x4f76b4,_0x345bb6){_0x4f76b4=_0x4f76b4-0x0;var _0x42b993=_0xd028[_0x4f76b4];return _0x42b993;};'use strict';var _=require(_0x8d02('0x0'));var util=require(_0x8d02('0x1'));var moment=require(_0x8d02('0x2'));var BPromise=require(_0x8d02('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d02('0x4'));var db=require(_0x8d02('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8d02('0x6'));var config=require(_0x8d02('0x7'));var jayson=require(_0x8d02('0x8'));var client=jayson[_0x8d02('0x9')][_0x8d02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ab375,_0x45fbf8,_0x5d9bf4){return new BPromise(function(_0x3dc27d,_0x3e72b9){return client[_0x8d02('0xb')](_0x2ab375,_0x5d9bf4)[_0x8d02('0xc')](function(_0x32431c){logger[_0x8d02('0xd')](_0x8d02('0xe'),_0x45fbf8,_0x8d02('0xf'));logger['debug'](_0x8d02('0x10'),_0x45fbf8,_0x8d02('0xf'),JSON[_0x8d02('0x11')](_0x32431c));if(_0x32431c['error']){if(_0x32431c['error'][_0x8d02('0x12')]===0x1f4){logger[_0x8d02('0x13')](_0x8d02('0xe'),_0x45fbf8,_0x32431c[_0x8d02('0x13')][_0x8d02('0x14')]);return _0x3e72b9(_0x32431c['error'][_0x8d02('0x14')]);}logger[_0x8d02('0x13')](_0x8d02('0xe'),_0x45fbf8,_0x32431c['error'][_0x8d02('0x14')]);return _0x3dc27d(_0x32431c[_0x8d02('0x13')]['message']);}else{logger[_0x8d02('0xd')](_0x8d02('0xe'),_0x45fbf8,_0x8d02('0xf'));_0x3dc27d(_0x32431c[_0x8d02('0x15')][_0x8d02('0x14')]);}})[_0x8d02('0x16')](function(_0x5615bd){logger[_0x8d02('0x13')](_0x8d02('0xe'),_0x45fbf8,_0x5615bd);_0x3e72b9(_0x5615bd);});});} \ No newline at end of file +var _0xabea=['message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2bfbba,_0x246c18){var _0x57dafa=function(_0x11751f){while(--_0x11751f){_0x2bfbba['push'](_0x2bfbba['shift']());}};_0x57dafa(++_0x246c18);}(_0xabea,0x120));var _0xaabe=function(_0x52c091,_0x1aa363){_0x52c091=_0x52c091-0x0;var _0x397790=_0xabea[_0x52c091];return _0x397790;};'use strict';var _=require('lodash');var util=require(_0xaabe('0x0'));var moment=require(_0xaabe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaabe('0x2'))['db'];var utils=require(_0xaabe('0x3'));var logger=require(_0xaabe('0x4'))('rpc');var config=require(_0xaabe('0x5'));var jayson=require(_0xaabe('0x6'));var client=jayson[_0xaabe('0x7')][_0xaabe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34f963,_0x1c25da,_0x5c525c){return new BPromise(function(_0x3ed859,_0xa7df1b){return client[_0xaabe('0x9')](_0x34f963,_0x5c525c)['then'](function(_0x3aa5d5){logger[_0xaabe('0xa')](_0xaabe('0xb'),_0x1c25da,_0xaabe('0xc'));logger['debug'](_0xaabe('0xd'),_0x1c25da,'request\x20sent',JSON['stringify'](_0x3aa5d5));if(_0x3aa5d5[_0xaabe('0xe')]){if(_0x3aa5d5[_0xaabe('0xe')][_0xaabe('0xf')]===0x1f4){logger['error'](_0xaabe('0xb'),_0x1c25da,_0x3aa5d5['error']['message']);return _0xa7df1b(_0x3aa5d5[_0xaabe('0xe')][_0xaabe('0x10')]);}logger['error'](_0xaabe('0xb'),_0x1c25da,_0x3aa5d5[_0xaabe('0xe')][_0xaabe('0x10')]);return _0x3ed859(_0x3aa5d5[_0xaabe('0xe')][_0xaabe('0x10')]);}else{logger[_0xaabe('0xa')](_0xaabe('0xb'),_0x1c25da,_0xaabe('0xc'));_0x3ed859(_0x3aa5d5[_0xaabe('0x11')][_0xaabe('0x10')]);}})[_0xaabe('0x12')](function(_0x231ab1){logger[_0xaabe('0xe')](_0xaabe('0xb'),_0x1c25da,_0x231ab1);_0xa7df1b(_0x231ab1);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4fe7416..d89a0f9 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 _0x672a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','show','getSounds','post','/:id/sounds','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x672a,0x172));var _0xa672=function(_0x41cd72,_0x21ec2d){_0x41cd72=_0x41cd72-0x0;var _0x135784=_0x672a[_0x41cd72];return _0x135784;};'use strict';var multer=require(_0xa672('0x0'));var util=require(_0xa672('0x1'));var path=require(_0xa672('0x2'));var timeout=require(_0xa672('0x3'));var express=require(_0xa672('0x4'));var router=express[_0xa672('0x5')]();var fs_extra=require(_0xa672('0x6'));var auth=require(_0xa672('0x7'));var interaction=require(_0xa672('0x8'));var config=require(_0xa672('0x9'));var controller=require(_0xa672('0xa'));router['get']('/',auth[_0xa672('0xb')](),controller['index']);router[_0xa672('0xc')](_0xa672('0xd'),auth['isAuthenticated'](),controller[_0xa672('0xe')]);router[_0xa672('0xc')]('/:id/sounds',auth[_0xa672('0xb')](),controller[_0xa672('0xf')]);router[_0xa672('0x10')]('/',auth[_0xa672('0xb')](),controller['create']);router['post'](_0xa672('0x11'),auth[_0xa672('0xb')](),controller['addSound']);router[_0xa672('0x12')](_0xa672('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa672('0x13')](_0xa672('0xd'),auth[_0xa672('0xb')](),controller[_0xa672('0x14')]);router[_0xa672('0x13')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller['removeSound']);module[_0xa672('0x15')]=router; \ No newline at end of file +var _0xe15f=['post','addSound','delete','destroy','removeSound','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds'];(function(_0x26af5e,_0x2f4a71){var _0x153198=function(_0x1c22d1){while(--_0x1c22d1){_0x26af5e['push'](_0x26af5e['shift']());}};_0x153198(++_0x2f4a71);}(_0xe15f,0x195));var _0xfe15=function(_0x31c64b,_0x2f81bd){_0x31c64b=_0x31c64b-0x0;var _0x40fe98=_0xe15f[_0x31c64b];return _0x40fe98;};'use strict';var multer=require(_0xfe15('0x0'));var util=require('util');var path=require(_0xfe15('0x1'));var timeout=require(_0xfe15('0x2'));var express=require(_0xfe15('0x3'));var router=express['Router']();var fs_extra=require(_0xfe15('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfe15('0x5'));var config=require(_0xfe15('0x6'));var controller=require(_0xfe15('0x7'));router[_0xfe15('0x8')]('/',auth[_0xfe15('0x9')](),controller[_0xfe15('0xa')]);router['get'](_0xfe15('0xb'),auth[_0xfe15('0x9')](),controller[_0xfe15('0xc')]);router[_0xfe15('0x8')](_0xfe15('0xd'),auth[_0xfe15('0x9')](),controller[_0xfe15('0xe')]);router[_0xfe15('0xf')]('/',auth[_0xfe15('0x9')](),controller['create']);router[_0xfe15('0xf')](_0xfe15('0xd'),auth[_0xfe15('0x9')](),controller[_0xfe15('0x10')]);router['put'](_0xfe15('0xb'),auth[_0xfe15('0x9')](),controller['update']);router[_0xfe15('0x11')](_0xfe15('0xb'),auth[_0xfe15('0x9')](),controller[_0xfe15('0x12')]);router[_0xfe15('0x11')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xfe15('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c977c35..e4a2cbe 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 _0x2c54=['name','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x9aff40,_0x5dc76c){var _0x1d21df=function(_0x506f9c){while(--_0x506f9c){_0x9aff40['push'](_0x9aff40['shift']());}};_0x1d21df(++_0x5dc76c);}(_0x2c54,0x1b7));var _0x42c5=function(_0x4fb2a3,_0x23bad6){_0x4fb2a3=_0x4fb2a3-0x0;var _0x2bd915=_0x2c54[_0x4fb2a3];return _0x2bd915;};'use strict';var Sequelize=require(_0x42c5('0x0'));module[_0x42c5('0x1')]={'name':{'type':Sequelize[_0x42c5('0x2')],'allowNull':![],'unique':_0x42c5('0x3')},'mode':{'type':Sequelize['ENUM'](_0x42c5('0x4'),_0x42c5('0x5'),_0x42c5('0x6'),_0x42c5('0x7'),_0x42c5('0x8'),_0x42c5('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x42c5('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x42c5('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x42c5('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x42c5('0x2')],'allowNull':!![],'defaultValue':_0x42c5('0xa')},'format':{'type':Sequelize[_0x42c5('0x2')],'allowNull':!![]},'stamp':{'type':_0x42c5('0xb')},'defaultEntry':{'type':Sequelize[_0x42c5('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6998=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','custom','files','mp3nb','quietmp3nb','mp3','alpha'];(function(_0x4c35e5,_0x19e791){var _0x2ffcd1=function(_0x20c5cc){while(--_0x20c5cc){_0x4c35e5['push'](_0x4c35e5['shift']());}};_0x2ffcd1(++_0x19e791);}(_0x6998,0x86));var _0x8699=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x6998[_0x1793de];return _0x4f0309;};'use strict';var Sequelize=require(_0x8699('0x0'));module[_0x8699('0x1')]={'name':{'type':Sequelize[_0x8699('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x8699('0x3')](_0x8699('0x4'),_0x8699('0x5'),_0x8699('0x6'),_0x8699('0x7'),'quietmp3',_0x8699('0x8')),'allowNull':!![],'defaultValue':_0x8699('0x5')},'directory':{'type':Sequelize[_0x8699('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x8699('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8699('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8699('0x9')},'format':{'type':Sequelize[_0x8699('0x2')],'allowNull':!![]},'stamp':{'type':_0x8699('0xa')},'defaultEntry':{'type':Sequelize[_0x8699('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index d4c06fb..dd7b129 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 _0x7498=['status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','VoiceMusicOnHold','includeAll','include','findAll','catch','show','params','length','options','find','update','body','create','transaction','mode','files','join','root','server/files/moh','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','directory','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','extname','symlinkSync','removeSound','id2','ValidationError','getSounds','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x7498,0xca));var _0x8749=function(_0x7838d9,_0x1087ff){_0x7838d9=_0x7838d9-0x0;var _0x5b25eb=_0x7498[_0x7838d9];return _0x5b25eb;};'use strict';var emlformat=require(_0x8749('0x0'));var rimraf=require(_0x8749('0x1'));var zipdir=require(_0x8749('0x2'));var jsonpatch=require(_0x8749('0x3'));var rp=require(_0x8749('0x4'));var moment=require(_0x8749('0x5'));var BPromise=require(_0x8749('0x6'));var Mustache=require(_0x8749('0x7'));var util=require(_0x8749('0x8'));var path=require('path');var sox=require(_0x8749('0x9'));var csv=require(_0x8749('0xa'));var ejs=require(_0x8749('0xb'));var fs=require('fs');var fs_extra=require(_0x8749('0xc'));var _=require('lodash');var squel=require(_0x8749('0xd'));var crypto=require(_0x8749('0xe'));var jsforce=require(_0x8749('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8749('0x10'));var Papa=require(_0x8749('0x11'));var Redis=require(_0x8749('0x12'));var authService=require(_0x8749('0x13'));var qs=require(_0x8749('0x14'));var as=require(_0x8749('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8749('0x16'))(_0x8749('0x17'));var utils=require(_0x8749('0x18'));var config=require(_0x8749('0x19'));var licenseUtil=require(_0x8749('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24cb9f,_0x4aab64){_0x4aab64=_0x4aab64||0xcc;return function(_0x2618bd){if(_0x2618bd){return _0x24cb9f[_0x8749('0x1b')](_0x4aab64);}return _0x24cb9f[_0x8749('0x1c')](_0x4aab64)[_0x8749('0x1d')]();};}function respondWithResult(_0x65ee6c,_0x1e38ae){_0x1e38ae=_0x1e38ae||0xc8;return function(_0x3901c3){if(_0x3901c3){return _0x65ee6c[_0x8749('0x1c')](_0x1e38ae)[_0x8749('0x1e')](_0x3901c3);}};}function respondWithFilteredResult(_0x1f6497,_0x8af162){return function(_0x489907){if(_0x489907){var _0x2da99a=typeof _0x8af162[_0x8749('0x1f')]===_0x8749('0x20')&&typeof _0x8af162['limit']==='undefined';var _0x346ea9=_0x489907[_0x8749('0x21')];var _0x27af2a=_0x2da99a?0x0:_0x8af162[_0x8749('0x1f')];var _0x4301e5=_0x2da99a?_0x489907['count']:_0x8af162[_0x8749('0x1f')]+_0x8af162[_0x8749('0x22')];var _0x1c9bcf;if(_0x4301e5>=_0x346ea9){_0x4301e5=_0x346ea9;_0x1c9bcf=0xc8;}else{_0x1c9bcf=0xce;}_0x1f6497[_0x8749('0x1c')](_0x1c9bcf);return _0x1f6497['set'](_0x8749('0x23'),_0x27af2a+'-'+_0x4301e5+'/'+_0x346ea9)[_0x8749('0x1e')](_0x489907);}return null;};}function patchUpdates(_0x5f135b){return function(_0x18bfbe){try{jsonpatch[_0x8749('0x24')](_0x18bfbe,_0x5f135b,!![]);}catch(_0xc540f7){return BPromise[_0x8749('0x25')](_0xc540f7);}return _0x18bfbe['save']();};}function saveUpdates(_0x293260,_0x5ee85e){return function(_0x140f24){if(_0x140f24){return _0x140f24['update'](_0x293260)[_0x8749('0x26')](function(_0x43698d){return _0x43698d;});}return null;};}function removeEntity(_0x20703d,_0xf2fcf){return function(_0x2c6d6f){if(_0x2c6d6f){return _0x2c6d6f[_0x8749('0x27')]()['then'](function(){var _0x30216b=_0x2c6d6f[_0x8749('0x28')]({'plain':!![]});var _0xd037c1=_0x8749('0x29');return db[_0x8749('0x2a')]['destroy']({'where':{'type':_0xd037c1,'resourceId':_0x30216b['id']}})[_0x8749('0x26')](function(){return _0x2c6d6f;});})[_0x8749('0x26')](function(){_0x20703d[_0x8749('0x1c')](0xcc)[_0x8749('0x1d')]();});}};}function handleEntityNotFound(_0x4aca89,_0x105a00){return function(_0xe6cc4c){if(!_0xe6cc4c){_0x4aca89[_0x8749('0x1b')](0x194);}return _0xe6cc4c;};}function handleError(_0x5b4563,_0x9bd7ae){_0x9bd7ae=_0x9bd7ae||0x1f4;return function(_0x46d9c5){logger[_0x8749('0x2b')](_0x46d9c5[_0x8749('0x2c')]);if(_0x46d9c5[_0x8749('0x2d')]){delete _0x46d9c5[_0x8749('0x2d')];}_0x5b4563[_0x8749('0x1c')](_0x9bd7ae)['send'](_0x46d9c5);};}exports[_0x8749('0x2e')]=function(_0x1231d9,_0x4a6c1a){var _0x49876f={},_0x3525b4={},_0x55f655={'count':0x0,'rows':[]};var _0x59be15=_['map'](db['VoiceMusicOnHold'][_0x8749('0x2f')],function(_0x5ca71a){return{'name':_0x5ca71a[_0x8749('0x30')],'type':_0x5ca71a['type'][_0x8749('0x31')]};});_0x3525b4[_0x8749('0x32')]=_[_0x8749('0x33')](_0x59be15,'name');_0x3525b4[_0x8749('0x34')]=_[_0x8749('0x35')](_0x1231d9[_0x8749('0x34')]);_0x3525b4[_0x8749('0x36')]=_[_0x8749('0x37')](_0x3525b4[_0x8749('0x32')],_0x3525b4[_0x8749('0x34')]);_0x49876f['attributes']=_['intersection'](_0x3525b4[_0x8749('0x32')],qs[_0x8749('0x38')](_0x1231d9[_0x8749('0x34')][_0x8749('0x38')]));_0x49876f[_0x8749('0x39')]=_0x49876f[_0x8749('0x39')]['length']?_0x49876f[_0x8749('0x39')]:_0x3525b4['model'];if(!_0x1231d9[_0x8749('0x34')][_0x8749('0x3a')](_0x8749('0x3b'))){_0x49876f[_0x8749('0x22')]=qs['limit'](_0x1231d9['query'][_0x8749('0x22')]);_0x49876f[_0x8749('0x1f')]=qs[_0x8749('0x1f')](_0x1231d9['query']['offset']);}_0x49876f[_0x8749('0x3c')]=qs[_0x8749('0x3d')](_0x1231d9[_0x8749('0x34')][_0x8749('0x3d')]);delete _0x1231d9[_0x8749('0x34')][_0x8749('0x3d')];_0x49876f[_0x8749('0x3e')]=qs[_0x8749('0x36')](_['pick'](_0x1231d9[_0x8749('0x34')],_0x3525b4[_0x8749('0x36')]),_0x59be15);if(_0x1231d9[_0x8749('0x34')]['filter']){_0x49876f[_0x8749('0x3e')]=_[_0x8749('0x3f')](_0x49876f[_0x8749('0x3e')],{'$or':_[_0x8749('0x33')](_0x59be15,function(_0x16a893){if(_0x16a893[_0x8749('0x40')]!==_0x8749('0x41')){var _0x2031f0={};_0x2031f0[_0x16a893[_0x8749('0x2d')]]={'$like':'%'+_0x1231d9[_0x8749('0x34')]['filter']+'%'};return _0x2031f0;}})});}_0x49876f=_[_0x8749('0x3f')]({},_0x49876f,_0x1231d9['options']);var _0x5e5338={'where':_0x49876f[_0x8749('0x3e')]};return db[_0x8749('0x42')][_0x8749('0x21')](_0x5e5338)[_0x8749('0x26')](function(_0x3f3374){_0x55f655[_0x8749('0x21')]=_0x3f3374;if(_0x1231d9[_0x8749('0x34')][_0x8749('0x43')]){_0x49876f[_0x8749('0x44')]=[{'all':!![]}];}return db[_0x8749('0x42')][_0x8749('0x45')](_0x49876f);})[_0x8749('0x26')](function(_0x557b3f){_0x55f655['rows']=_0x557b3f;return _0x55f655;})['then'](respondWithFilteredResult(_0x4a6c1a,_0x49876f))[_0x8749('0x46')](handleError(_0x4a6c1a,null));};exports[_0x8749('0x47')]=function(_0x5ac17b,_0x2963fc){var _0x41dd03={'raw':![],'where':{'id':_0x5ac17b[_0x8749('0x48')]['id']}},_0x5ca08f={};_0x5ca08f[_0x8749('0x32')]=_[_0x8749('0x35')](db[_0x8749('0x42')]['rawAttributes']);_0x5ca08f[_0x8749('0x34')]=_[_0x8749('0x35')](_0x5ac17b[_0x8749('0x34')]);_0x5ca08f[_0x8749('0x36')]=_[_0x8749('0x37')](_0x5ca08f['model'],_0x5ca08f[_0x8749('0x34')]);_0x41dd03[_0x8749('0x39')]=_['intersection'](_0x5ca08f[_0x8749('0x32')],qs[_0x8749('0x38')](_0x5ac17b[_0x8749('0x34')][_0x8749('0x38')]));_0x41dd03[_0x8749('0x39')]=_0x41dd03[_0x8749('0x39')][_0x8749('0x49')]?_0x41dd03['attributes']:_0x5ca08f['model'];if(_0x5ac17b[_0x8749('0x34')][_0x8749('0x43')]){_0x41dd03[_0x8749('0x44')]=[{'all':!![]}];}_0x41dd03=_[_0x8749('0x3f')]({},_0x41dd03,_0x5ac17b[_0x8749('0x4a')]);return db[_0x8749('0x42')][_0x8749('0x4b')](_0x41dd03)[_0x8749('0x26')](handleEntityNotFound(_0x2963fc,null))[_0x8749('0x26')](respondWithResult(_0x2963fc,null))['catch'](handleError(_0x2963fc,null));};exports[_0x8749('0x4c')]=function(_0x5cb9a6,_0x1c998c){if(_0x5cb9a6[_0x8749('0x4d')]['id']){delete _0x5cb9a6[_0x8749('0x4d')]['id'];}return db[_0x8749('0x42')][_0x8749('0x4b')]({'where':{'id':_0x5cb9a6[_0x8749('0x48')]['id']}})[_0x8749('0x26')](handleEntityNotFound(_0x1c998c,null))[_0x8749('0x26')](saveUpdates(_0x5cb9a6[_0x8749('0x4d')],null))[_0x8749('0x26')](respondWithResult(_0x1c998c,null))[_0x8749('0x46')](handleError(_0x1c998c,null));};exports[_0x8749('0x4e')]=function(_0x2cb8a8,_0x53b295,_0x10dbc7){return db['sequelize'][_0x8749('0x4f')](function(_0xfcad62){if(_0x2cb8a8['body'][_0x8749('0x50')]===_0x8749('0x51')){_0x2cb8a8[_0x8749('0x4d')]['directory']=path[_0x8749('0x52')](config[_0x8749('0x53')],_0x8749('0x54'),_0x2cb8a8[_0x8749('0x4d')]['name']);}return db[_0x8749('0x42')][_0x8749('0x4e')](_0x2cb8a8[_0x8749('0x4d')],{'transaction':_0xfcad62})[_0x8749('0x26')](function(_0xdb778c){if(_0x2cb8a8[_0x8749('0x4d')][_0x8749('0x50')]==='files'){fs['mkdirSync'](_0xdb778c['directory'],parseInt('0777',0x8));}var _0x1d9006=_0x2cb8a8['user'][_0x8749('0x28')]({'plain':!![]});if(!_0x1d9006)throw new Error(_0x8749('0x55'));if(_0x1d9006['role']===_0x8749('0x56')){var _0x2a4e73=_0xdb778c[_0x8749('0x28')]({'plain':!![]});return db[_0x8749('0x57')]['find']({'where':{'name':_0x8749('0x29'),'userProfileId':_0x1d9006[_0x8749('0x58')]},'raw':!![]})['then'](function(_0x78351e){if(_0x78351e&&_0x78351e[_0x8749('0x59')]===0x0){return db['UserProfileResource'][_0x8749('0x4e')]({'name':_0x2a4e73[_0x8749('0x2d')],'resourceId':_0x2a4e73['id'],'type':_0x78351e[_0x8749('0x2d')],'sectionId':_0x78351e['id']},{})['then'](function(){return _0xdb778c;});}else{return _0xdb778c;}})[_0x8749('0x46')](function(_0x592141){logger[_0x8749('0x2b')](_0x8749('0x5a'),_0x592141);});}return _0xdb778c;});})[_0x8749('0x26')](respondWithResult(_0x53b295,0xc9))['catch'](handleError(_0x53b295,null));};exports[_0x8749('0x27')]=function(_0x4307c2,_0x2a9b77,_0x28dd70){var _0x562fcc;return db['VoiceMusicOnHold'][_0x8749('0x4b')]({'where':{'id':_0x4307c2[_0x8749('0x48')]['id']}})[_0x8749('0x26')](function(_0x75a9f6){if(_0x75a9f6){return db[_0x8749('0x5b')][_0x8749('0x4f')](function(_0x12979b){return _0x75a9f6[_0x8749('0x27')]({'transaction':_0x12979b,'raw':!![]})[_0x8749('0x26')](function(_0x128666){if(_0x128666[_0x8749('0x5c')]){fs[_0x8749('0x5d')](_0x128666[_0x8749('0x5c')])[_0x8749('0x5e')](function(_0x2a7463){fs[_0x8749('0x5f')](path[_0x8749('0x52')](_0x128666[_0x8749('0x5c')],_0x2a7463));});fs[_0x8749('0x60')](_0x128666['directory']);}return _0x128666;});})[_0x8749('0x46')](function(_0x162efd){throw new db[(_0x8749('0x61'))]['ValidationError'](_0x162efd[_0x8749('0x62')]);});}})['then'](handleEntityNotFound(_0x2a9b77,null))[_0x8749('0x26')](removeEntity(_0x2a9b77,null))['catch'](handleError(_0x2a9b77,null));};exports[_0x8749('0x63')]=function(_0x5b4d6a,_0x1b3d93,_0x2a6107){return db[_0x8749('0x5b')][_0x8749('0x4f')](function(_0x2e73ac){var _0x5e4d13;return db[_0x8749('0x42')][_0x8749('0x4b')]({'where':{'id':_0x5b4d6a[_0x8749('0x48')]['id']}})[_0x8749('0x26')](function(_0x324cbd){if(_0x324cbd){_0x5e4d13=_0x324cbd;return _0x324cbd[_0x8749('0x63')](_0x5b4d6a[_0x8749('0x4d')]['id'],{'transaction':_0x2e73ac});}})[_0x8749('0x26')](function(_0x52321c){if(_0x52321c){return db[_0x8749('0x64')][_0x8749('0x65')]({'where':{'id':_0x5b4d6a[_0x8749('0x4d')]['id']},'attributes':['id',_0x8749('0x2d'),'save_name',_0x8749('0x66'),_0x8749('0x67')],'raw':!![]});}})[_0x8749('0x26')](function(_0x43b5a8){if(_0x43b5a8){var _0x9fba08=path['join'](config[_0x8749('0x53')],'server/files/sounds/converted',util[_0x8749('0x68')](_0x8749('0x69'),path[_0x8749('0x6a')](_0x43b5a8[_0x8749('0x6b')],path[_0x8749('0x6c')](_0x43b5a8[_0x8749('0x6b')])),_0x43b5a8[_0x8749('0x66')]));var _0x5f11a6=path[_0x8749('0x52')](config[_0x8749('0x53')],_0x8749('0x54'),_0x5e4d13[_0x8749('0x2d')],util[_0x8749('0x68')](_0x8749('0x69'),_0x43b5a8[_0x8749('0x2d')],_0x43b5a8[_0x8749('0x66')]));fs[_0x8749('0x6d')](_0x9fba08,_0x5f11a6);return _0x43b5a8;}})['catch'](function(_0x4b1399){throw new db[(_0x8749('0x61'))]['ValidationError'](_0x4b1399[_0x8749('0x62')]);});})[_0x8749('0x26')](handleEntityNotFound(_0x1b3d93,null))[_0x8749('0x26')](respondWithResult(_0x1b3d93,0xc9))[_0x8749('0x46')](handleError(_0x1b3d93,null));};exports[_0x8749('0x6e')]=function(_0x2e32bf,_0x13355e,_0x4aa4b4){return db['sequelize'][_0x8749('0x4f')](function(_0x110cfc){var _0x31cb1d;return db[_0x8749('0x42')][_0x8749('0x65')]({'where':{'id':_0x2e32bf['params']['id']}})['then'](handleEntityNotFound(_0x13355e,null))['then'](function(_0x47b807){if(_0x47b807){_0x31cb1d=_0x47b807;return _0x47b807[_0x8749('0x6e')](_0x2e32bf['params']['id2']);}})[_0x8749('0x26')](function(_0x549e67){if(_0x549e67){return db[_0x8749('0x64')][_0x8749('0x65')]({'where':{'id':_0x2e32bf[_0x8749('0x48')][_0x8749('0x6f')]},'attributes':['id',_0x8749('0x2d'),_0x8749('0x6b'),_0x8749('0x66'),_0x8749('0x67')],'raw':!![]});}})['then'](function(_0x394e25){if(_0x394e25){fs[_0x8749('0x5f')](path[_0x8749('0x52')](_0x31cb1d[_0x8749('0x5c')],util[_0x8749('0x68')](_0x8749('0x69'),_0x394e25[_0x8749('0x2d')],_0x394e25[_0x8749('0x66')])));return _0x394e25;}})[_0x8749('0x46')](function(_0x3c0dc5){throw new db[(_0x8749('0x61'))][(_0x8749('0x70'))](_0x3c0dc5[_0x8749('0x62')]);});})['then'](handleEntityNotFound(_0x13355e,null))[_0x8749('0x26')](respondWithStatusCode(_0x13355e,0xcc))[_0x8749('0x46')](handleError(_0x13355e,null));};exports[_0x8749('0x71')]=function(_0x3c3d34,_0x2654b7,_0x2f13c1){var _0x48702a={};var _0x8e4ae6={};var _0x17c6fe;var _0x56d5ec;return db[_0x8749('0x42')][_0x8749('0x65')]({'where':{'id':_0x3c3d34[_0x8749('0x48')]['id']}})['then'](handleEntityNotFound(_0x2654b7,null))[_0x8749('0x26')](function(_0x4e269e){if(_0x4e269e){_0x17c6fe=_0x4e269e;_0x8e4ae6[_0x8749('0x32')]=_[_0x8749('0x35')](db['Sound'][_0x8749('0x2f')]);_0x8e4ae6['query']=_[_0x8749('0x35')](_0x3c3d34[_0x8749('0x34')]);_0x8e4ae6['filters']=_[_0x8749('0x37')](_0x8e4ae6[_0x8749('0x32')],_0x8e4ae6[_0x8749('0x34')]);_0x48702a[_0x8749('0x39')]=_[_0x8749('0x37')](_0x8e4ae6[_0x8749('0x32')],qs[_0x8749('0x38')](_0x3c3d34[_0x8749('0x34')][_0x8749('0x38')]));_0x48702a[_0x8749('0x39')]=_0x48702a[_0x8749('0x39')]['length']?_0x48702a[_0x8749('0x39')]:_0x8e4ae6[_0x8749('0x32')];_0x48702a[_0x8749('0x3c')]=qs[_0x8749('0x3d')](_0x3c3d34[_0x8749('0x34')]['sort']);_0x48702a[_0x8749('0x3e')]=qs[_0x8749('0x36')](_[_0x8749('0x72')](_0x3c3d34['query'],_0x8e4ae6['filters']));if(_0x3c3d34['query']['filter']){_0x48702a[_0x8749('0x3e')]=_['merge'](_0x48702a[_0x8749('0x3e')],{'$or':_[_0x8749('0x33')](_0x48702a[_0x8749('0x39')],function(_0x5f5859){var _0x2a9bb5={};_0x2a9bb5[_0x5f5859]={'$like':'%'+_0x3c3d34[_0x8749('0x34')]['filter']+'%'};return _0x2a9bb5;})});}_0x48702a=_['merge']({},_0x48702a,_0x3c3d34['options']);return _0x17c6fe[_0x8749('0x71')](_0x48702a);}})[_0x8749('0x26')](function(_0x761fe8){if(_0x761fe8){_0x56d5ec=_0x761fe8[_0x8749('0x49')];if(!_0x3c3d34[_0x8749('0x34')][_0x8749('0x3a')](_0x8749('0x3b'))){_0x48702a[_0x8749('0x22')]=qs[_0x8749('0x22')](_0x3c3d34[_0x8749('0x34')]['limit']);_0x48702a[_0x8749('0x1f')]=qs['offset'](_0x3c3d34[_0x8749('0x34')]['offset']);}return _0x17c6fe[_0x8749('0x71')](_0x48702a);}})[_0x8749('0x26')](function(_0x3611b5){if(_0x3611b5){return _0x3611b5?{'count':_0x56d5ec,'rows':_0x3611b5}:null;}})[_0x8749('0x26')](respondWithResult(_0x2654b7,null))[_0x8749('0x46')](handleError(_0x2654b7,null));}; \ No newline at end of file +var _0xd728=['create','sequelize','transaction','mode','join','root','server/files/moh','mkdirSync','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','message','removeSound','Sound','getSounds','hasOwnProperty','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','undefined','limit','offset','count','set','Content-Range','json','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','options','VoiceMusicOnHold','findAll','catch','show','params','keys','rawAttributes','include','find','body'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xd728,0x98));var _0x8d72=function(_0x2e885f,_0x4a71dd){_0x2e885f=_0x2e885f-0x0;var _0x1fe294=_0xd728[_0x2e885f];return _0x1fe294;};'use strict';var emlformat=require(_0x8d72('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d72('0x1'));var jsonpatch=require(_0x8d72('0x2'));var rp=require(_0x8d72('0x3'));var moment=require('moment');var BPromise=require(_0x8d72('0x4'));var Mustache=require(_0x8d72('0x5'));var util=require(_0x8d72('0x6'));var path=require(_0x8d72('0x7'));var sox=require(_0x8d72('0x8'));var csv=require(_0x8d72('0x9'));var ejs=require(_0x8d72('0xa'));var fs=require('fs');var fs_extra=require(_0x8d72('0xb'));var _=require(_0x8d72('0xc'));var squel=require('squel');var crypto=require(_0x8d72('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8d72('0xe'));var toCsv=require(_0x8d72('0x9'));var querystring=require(_0x8d72('0xf'));var Papa=require(_0x8d72('0x10'));var Redis=require(_0x8d72('0x11'));var authService=require(_0x8d72('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8d72('0x13'));var utils=require(_0x8d72('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8d72('0x15'));var db=require(_0x8d72('0x16'))['db'];function respondWithStatusCode(_0xd5042e,_0x575317){_0x575317=_0x575317||0xcc;return function(_0x5cfa0f){if(_0x5cfa0f){return _0xd5042e['sendStatus'](_0x575317);}return _0xd5042e['status'](_0x575317)[_0x8d72('0x17')]();};}function respondWithResult(_0x37d72b,_0x1df0d9){_0x1df0d9=_0x1df0d9||0xc8;return function(_0x35a339){if(_0x35a339){return _0x37d72b[_0x8d72('0x18')](_0x1df0d9)['json'](_0x35a339);}};}function respondWithFilteredResult(_0x10db84,_0x109552){return function(_0x427c03){if(_0x427c03){var _0x149eef=typeof _0x109552['offset']===_0x8d72('0x19')&&typeof _0x109552[_0x8d72('0x1a')]===_0x8d72('0x19');var _0x192a60=_0x427c03['count'];var _0x13d397=_0x149eef?0x0:_0x109552[_0x8d72('0x1b')];var _0x10814d=_0x149eef?_0x427c03[_0x8d72('0x1c')]:_0x109552[_0x8d72('0x1b')]+_0x109552['limit'];var _0x295c02;if(_0x10814d>=_0x192a60){_0x10814d=_0x192a60;_0x295c02=0xc8;}else{_0x295c02=0xce;}_0x10db84[_0x8d72('0x18')](_0x295c02);return _0x10db84[_0x8d72('0x1d')](_0x8d72('0x1e'),_0x13d397+'-'+_0x10814d+'/'+_0x192a60)[_0x8d72('0x1f')](_0x427c03);}return null;};}function patchUpdates(_0x2e0610){return function(_0xd75e4f){try{jsonpatch['apply'](_0xd75e4f,_0x2e0610,!![]);}catch(_0xad9382){return BPromise[_0x8d72('0x20')](_0xad9382);}return _0xd75e4f[_0x8d72('0x21')]();};}function saveUpdates(_0x47c389,_0x63bbe5){return function(_0x28dbc0){if(_0x28dbc0){return _0x28dbc0[_0x8d72('0x22')](_0x47c389)['then'](function(_0x20d76c){return _0x20d76c;});}return null;};}function removeEntity(_0xabc037,_0x162b0a){return function(_0x4b5fbd){if(_0x4b5fbd){return _0x4b5fbd[_0x8d72('0x23')]()[_0x8d72('0x24')](function(){var _0x411119=_0x4b5fbd['get']({'plain':!![]});var _0x10411c=_0x8d72('0x25');return db[_0x8d72('0x26')]['destroy']({'where':{'type':_0x10411c,'resourceId':_0x411119['id']}})[_0x8d72('0x24')](function(){return _0x4b5fbd;});})['then'](function(){_0xabc037[_0x8d72('0x18')](0xcc)[_0x8d72('0x17')]();});}};}function handleEntityNotFound(_0x3dfe3b,_0x370c23){return function(_0xdab5dd){if(!_0xdab5dd){_0x3dfe3b[_0x8d72('0x27')](0x194);}return _0xdab5dd;};}function handleError(_0x2b2ab6,_0x5e0c43){_0x5e0c43=_0x5e0c43||0x1f4;return function(_0x1e56e0){logger[_0x8d72('0x28')](_0x1e56e0[_0x8d72('0x29')]);if(_0x1e56e0[_0x8d72('0x2a')]){delete _0x1e56e0[_0x8d72('0x2a')];}_0x2b2ab6[_0x8d72('0x18')](_0x5e0c43)[_0x8d72('0x2b')](_0x1e56e0);};}exports[_0x8d72('0x2c')]=function(_0x2edc20,_0xc1e880){var _0x247967={},_0x165af2={},_0x4f55fe={'count':0x0,'rows':[]};var _0x5c03ac=_[_0x8d72('0x2d')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x109a31){return{'name':_0x109a31[_0x8d72('0x2e')],'type':_0x109a31['type'][_0x8d72('0x2f')]};});_0x165af2[_0x8d72('0x30')]=_[_0x8d72('0x2d')](_0x5c03ac,_0x8d72('0x2a'));_0x165af2['query']=_['keys'](_0x2edc20[_0x8d72('0x31')]);_0x165af2[_0x8d72('0x32')]=_[_0x8d72('0x33')](_0x165af2[_0x8d72('0x30')],_0x165af2[_0x8d72('0x31')]);_0x247967[_0x8d72('0x34')]=_[_0x8d72('0x33')](_0x165af2[_0x8d72('0x30')],qs[_0x8d72('0x35')](_0x2edc20[_0x8d72('0x31')][_0x8d72('0x35')]));_0x247967[_0x8d72('0x34')]=_0x247967['attributes'][_0x8d72('0x36')]?_0x247967[_0x8d72('0x34')]:_0x165af2[_0x8d72('0x30')];if(!_0x2edc20[_0x8d72('0x31')]['hasOwnProperty']('nolimit')){_0x247967[_0x8d72('0x1a')]=qs['limit'](_0x2edc20[_0x8d72('0x31')][_0x8d72('0x1a')]);_0x247967[_0x8d72('0x1b')]=qs[_0x8d72('0x1b')](_0x2edc20['query'][_0x8d72('0x1b')]);}_0x247967[_0x8d72('0x37')]=qs[_0x8d72('0x38')](_0x2edc20[_0x8d72('0x31')][_0x8d72('0x38')]);delete _0x2edc20[_0x8d72('0x31')][_0x8d72('0x38')];_0x247967[_0x8d72('0x39')]=qs[_0x8d72('0x32')](_[_0x8d72('0x3a')](_0x2edc20[_0x8d72('0x31')],_0x165af2[_0x8d72('0x32')]),_0x5c03ac);if(_0x2edc20[_0x8d72('0x31')][_0x8d72('0x3b')]){_0x247967[_0x8d72('0x39')]=_['merge'](_0x247967[_0x8d72('0x39')],{'$or':_[_0x8d72('0x2d')](_0x5c03ac,function(_0x169e6e){if(_0x169e6e[_0x8d72('0x3c')]!==_0x8d72('0x3d')){var _0x113970={};_0x113970[_0x169e6e[_0x8d72('0x2a')]]={'$like':'%'+_0x2edc20[_0x8d72('0x31')][_0x8d72('0x3b')]+'%'};return _0x113970;}})});}_0x247967=_[_0x8d72('0x3e')]({},_0x247967,_0x2edc20[_0x8d72('0x3f')]);var _0x43cc84={'where':_0x247967[_0x8d72('0x39')]};return db['VoiceMusicOnHold'][_0x8d72('0x1c')](_0x43cc84)[_0x8d72('0x24')](function(_0x5271ee){_0x4f55fe[_0x8d72('0x1c')]=_0x5271ee;if(_0x2edc20[_0x8d72('0x31')]['includeAll']){_0x247967['include']=[{'all':!![]}];}return db[_0x8d72('0x40')][_0x8d72('0x41')](_0x247967);})[_0x8d72('0x24')](function(_0x489127){_0x4f55fe['rows']=_0x489127;return _0x4f55fe;})[_0x8d72('0x24')](respondWithFilteredResult(_0xc1e880,_0x247967))[_0x8d72('0x42')](handleError(_0xc1e880,null));};exports[_0x8d72('0x43')]=function(_0x39fc68,_0xee559f){var _0x116589={'raw':![],'where':{'id':_0x39fc68[_0x8d72('0x44')]['id']}},_0x2cec55={};_0x2cec55[_0x8d72('0x30')]=_[_0x8d72('0x45')](db[_0x8d72('0x40')][_0x8d72('0x46')]);_0x2cec55['query']=_[_0x8d72('0x45')](_0x39fc68[_0x8d72('0x31')]);_0x2cec55['filters']=_[_0x8d72('0x33')](_0x2cec55[_0x8d72('0x30')],_0x2cec55[_0x8d72('0x31')]);_0x116589[_0x8d72('0x34')]=_[_0x8d72('0x33')](_0x2cec55['model'],qs['fields'](_0x39fc68['query']['fields']));_0x116589[_0x8d72('0x34')]=_0x116589[_0x8d72('0x34')]['length']?_0x116589[_0x8d72('0x34')]:_0x2cec55[_0x8d72('0x30')];if(_0x39fc68[_0x8d72('0x31')]['includeAll']){_0x116589[_0x8d72('0x47')]=[{'all':!![]}];}_0x116589=_[_0x8d72('0x3e')]({},_0x116589,_0x39fc68['options']);return db[_0x8d72('0x40')][_0x8d72('0x48')](_0x116589)[_0x8d72('0x24')](handleEntityNotFound(_0xee559f,null))[_0x8d72('0x24')](respondWithResult(_0xee559f,null))[_0x8d72('0x42')](handleError(_0xee559f,null));};exports[_0x8d72('0x22')]=function(_0x5a87bc,_0x891a75){if(_0x5a87bc[_0x8d72('0x49')]['id']){delete _0x5a87bc[_0x8d72('0x49')]['id'];}return db[_0x8d72('0x40')][_0x8d72('0x48')]({'where':{'id':_0x5a87bc[_0x8d72('0x44')]['id']}})[_0x8d72('0x24')](handleEntityNotFound(_0x891a75,null))['then'](saveUpdates(_0x5a87bc[_0x8d72('0x49')],null))[_0x8d72('0x24')](respondWithResult(_0x891a75,null))[_0x8d72('0x42')](handleError(_0x891a75,null));};exports[_0x8d72('0x4a')]=function(_0x352412,_0x1f4056,_0x172721){return db[_0x8d72('0x4b')][_0x8d72('0x4c')](function(_0x13532f){if(_0x352412['body'][_0x8d72('0x4d')]==='files'){_0x352412[_0x8d72('0x49')]['directory']=path[_0x8d72('0x4e')](config[_0x8d72('0x4f')],_0x8d72('0x50'),_0x352412[_0x8d72('0x49')][_0x8d72('0x2a')]);}return db[_0x8d72('0x40')][_0x8d72('0x4a')](_0x352412[_0x8d72('0x49')],{'transaction':_0x13532f})[_0x8d72('0x24')](function(_0x442a0f){if(_0x352412[_0x8d72('0x49')][_0x8d72('0x4d')]==='files'){fs[_0x8d72('0x51')](_0x442a0f[_0x8d72('0x52')],parseInt(_0x8d72('0x53'),0x8));}var _0x3cb134=_0x352412[_0x8d72('0x54')][_0x8d72('0x55')]({'plain':!![]});if(!_0x3cb134)throw new Error(_0x8d72('0x56'));if(_0x3cb134[_0x8d72('0x57')]===_0x8d72('0x54')){var _0x12ec3d=_0x442a0f['get']({'plain':!![]});return db['UserProfileSection'][_0x8d72('0x48')]({'where':{'name':_0x8d72('0x25'),'userProfileId':_0x3cb134[_0x8d72('0x58')]},'raw':!![]})[_0x8d72('0x24')](function(_0xccdeba){if(_0xccdeba&&_0xccdeba[_0x8d72('0x59')]===0x0){return db[_0x8d72('0x26')]['create']({'name':_0x12ec3d[_0x8d72('0x2a')],'resourceId':_0x12ec3d['id'],'type':_0xccdeba[_0x8d72('0x2a')],'sectionId':_0xccdeba['id']},{})[_0x8d72('0x24')](function(){return _0x442a0f;});}else{return _0x442a0f;}})[_0x8d72('0x42')](function(_0x410b22){logger[_0x8d72('0x28')](_0x8d72('0x5a'),_0x410b22);});}return _0x442a0f;});})[_0x8d72('0x24')](respondWithResult(_0x1f4056,0xc9))['catch'](handleError(_0x1f4056,null));};exports[_0x8d72('0x23')]=function(_0x1e07da,_0x4ac39e,_0x58fd67){var _0x25b039;return db['VoiceMusicOnHold'][_0x8d72('0x48')]({'where':{'id':_0x1e07da['params']['id']}})[_0x8d72('0x24')](function(_0x29f65f){if(_0x29f65f){return db[_0x8d72('0x4b')][_0x8d72('0x4c')](function(_0x550322){return _0x29f65f[_0x8d72('0x23')]({'transaction':_0x550322,'raw':!![]})['then'](function(_0x2e4f0a){if(_0x2e4f0a[_0x8d72('0x52')]){fs[_0x8d72('0x5b')](_0x2e4f0a[_0x8d72('0x52')])[_0x8d72('0x5c')](function(_0x47ca7e){fs[_0x8d72('0x5d')](path[_0x8d72('0x4e')](_0x2e4f0a['directory'],_0x47ca7e));});fs['rmdirSync'](_0x2e4f0a[_0x8d72('0x52')]);}return _0x2e4f0a;});})[_0x8d72('0x42')](function(_0x172522){throw new db[(_0x8d72('0x5e'))][(_0x8d72('0x5f'))](_0x172522['message']);});}})[_0x8d72('0x24')](handleEntityNotFound(_0x4ac39e,null))[_0x8d72('0x24')](removeEntity(_0x4ac39e,null))['catch'](handleError(_0x4ac39e,null));};exports[_0x8d72('0x60')]=function(_0xa3787f,_0x2222e1,_0x33f514){return db['sequelize'][_0x8d72('0x4c')](function(_0x54ec53){var _0x4a26e2;return db[_0x8d72('0x40')][_0x8d72('0x48')]({'where':{'id':_0xa3787f[_0x8d72('0x44')]['id']}})[_0x8d72('0x24')](function(_0x38afd7){if(_0x38afd7){_0x4a26e2=_0x38afd7;return _0x38afd7[_0x8d72('0x60')](_0xa3787f[_0x8d72('0x49')]['id'],{'transaction':_0x54ec53});}})[_0x8d72('0x24')](function(_0x34be80){if(_0x34be80){return db['Sound'][_0x8d72('0x61')]({'where':{'id':_0xa3787f[_0x8d72('0x49')]['id']},'attributes':['id',_0x8d72('0x2a'),_0x8d72('0x62'),_0x8d72('0x63'),_0x8d72('0x64')],'raw':!![]});}})[_0x8d72('0x24')](function(_0x3bd33a){if(_0x3bd33a){var _0x4e91e8=path['join'](config[_0x8d72('0x4f')],_0x8d72('0x65'),util[_0x8d72('0x66')](_0x8d72('0x67'),path[_0x8d72('0x68')](_0x3bd33a[_0x8d72('0x62')],path[_0x8d72('0x69')](_0x3bd33a['save_name'])),_0x3bd33a[_0x8d72('0x63')]));var _0x1ad599=path['join'](config[_0x8d72('0x4f')],_0x8d72('0x50'),_0x4a26e2['name'],util[_0x8d72('0x66')]('%s.%s',_0x3bd33a[_0x8d72('0x2a')],_0x3bd33a[_0x8d72('0x63')]));fs[_0x8d72('0x6a')](_0x4e91e8,_0x1ad599);return _0x3bd33a;}})[_0x8d72('0x42')](function(_0x29c50f){throw new db[(_0x8d72('0x5e'))][(_0x8d72('0x5f'))](_0x29c50f[_0x8d72('0x6b')]);});})[_0x8d72('0x24')](handleEntityNotFound(_0x2222e1,null))['then'](respondWithResult(_0x2222e1,0xc9))[_0x8d72('0x42')](handleError(_0x2222e1,null));};exports[_0x8d72('0x6c')]=function(_0x1b0e6d,_0xc57332,_0x5e6fba){return db[_0x8d72('0x4b')][_0x8d72('0x4c')](function(_0x1bf41e){var _0x30c745;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x1b0e6d[_0x8d72('0x44')]['id']}})[_0x8d72('0x24')](handleEntityNotFound(_0xc57332,null))[_0x8d72('0x24')](function(_0x378043){if(_0x378043){_0x30c745=_0x378043;return _0x378043[_0x8d72('0x6c')](_0x1b0e6d[_0x8d72('0x44')]['id2']);}})['then'](function(_0x3fada1){if(_0x3fada1){return db[_0x8d72('0x6d')][_0x8d72('0x61')]({'where':{'id':_0x1b0e6d[_0x8d72('0x44')]['id2']},'attributes':['id',_0x8d72('0x2a'),_0x8d72('0x62'),_0x8d72('0x63'),_0x8d72('0x64')],'raw':!![]});}})[_0x8d72('0x24')](function(_0x14cb81){if(_0x14cb81){fs['unlinkSync'](path[_0x8d72('0x4e')](_0x30c745[_0x8d72('0x52')],util[_0x8d72('0x66')](_0x8d72('0x67'),_0x14cb81['name'],_0x14cb81[_0x8d72('0x63')])));return _0x14cb81;}})['catch'](function(_0x36a10d){throw new db['Sequelize'][(_0x8d72('0x5f'))](_0x36a10d['message']);});})[_0x8d72('0x24')](handleEntityNotFound(_0xc57332,null))[_0x8d72('0x24')](respondWithStatusCode(_0xc57332,0xcc))[_0x8d72('0x42')](handleError(_0xc57332,null));};exports[_0x8d72('0x6e')]=function(_0x1f717c,_0x5ec8ee,_0x4866f8){var _0x3bb2bd={};var _0x2f118f={};var _0x27a1c8;var _0x193c15;return db[_0x8d72('0x40')][_0x8d72('0x61')]({'where':{'id':_0x1f717c[_0x8d72('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ec8ee,null))[_0x8d72('0x24')](function(_0x1527c6){if(_0x1527c6){_0x27a1c8=_0x1527c6;_0x2f118f[_0x8d72('0x30')]=_[_0x8d72('0x45')](db['Sound'][_0x8d72('0x46')]);_0x2f118f[_0x8d72('0x31')]=_[_0x8d72('0x45')](_0x1f717c[_0x8d72('0x31')]);_0x2f118f['filters']=_[_0x8d72('0x33')](_0x2f118f[_0x8d72('0x30')],_0x2f118f[_0x8d72('0x31')]);_0x3bb2bd[_0x8d72('0x34')]=_['intersection'](_0x2f118f[_0x8d72('0x30')],qs['fields'](_0x1f717c[_0x8d72('0x31')][_0x8d72('0x35')]));_0x3bb2bd[_0x8d72('0x34')]=_0x3bb2bd['attributes'][_0x8d72('0x36')]?_0x3bb2bd[_0x8d72('0x34')]:_0x2f118f[_0x8d72('0x30')];_0x3bb2bd['order']=qs[_0x8d72('0x38')](_0x1f717c[_0x8d72('0x31')][_0x8d72('0x38')]);_0x3bb2bd[_0x8d72('0x39')]=qs[_0x8d72('0x32')](_['pick'](_0x1f717c[_0x8d72('0x31')],_0x2f118f[_0x8d72('0x32')]));if(_0x1f717c[_0x8d72('0x31')][_0x8d72('0x3b')]){_0x3bb2bd['where']=_['merge'](_0x3bb2bd[_0x8d72('0x39')],{'$or':_[_0x8d72('0x2d')](_0x3bb2bd[_0x8d72('0x34')],function(_0x5d9139){var _0x1f8357={};_0x1f8357[_0x5d9139]={'$like':'%'+_0x1f717c[_0x8d72('0x31')][_0x8d72('0x3b')]+'%'};return _0x1f8357;})});}_0x3bb2bd=_[_0x8d72('0x3e')]({},_0x3bb2bd,_0x1f717c['options']);return _0x27a1c8[_0x8d72('0x6e')](_0x3bb2bd);}})[_0x8d72('0x24')](function(_0x3c74d1){if(_0x3c74d1){_0x193c15=_0x3c74d1[_0x8d72('0x36')];if(!_0x1f717c[_0x8d72('0x31')][_0x8d72('0x6f')](_0x8d72('0x70'))){_0x3bb2bd[_0x8d72('0x1a')]=qs[_0x8d72('0x1a')](_0x1f717c['query'][_0x8d72('0x1a')]);_0x3bb2bd[_0x8d72('0x1b')]=qs[_0x8d72('0x1b')](_0x1f717c[_0x8d72('0x31')]['offset']);}return _0x27a1c8['getSounds'](_0x3bb2bd);}})[_0x8d72('0x24')](function(_0x534259){if(_0x534259){return _0x534259?{'count':_0x193c15,'rows':_0x534259}:null;}})['then'](respondWithResult(_0x5ec8ee,null))[_0x8d72('0x42')](handleError(_0x5ec8ee,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index f3e519b..954347f 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 _0xff52=['exports','define','VoiceMusicOnHold','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x4c9b08,_0xba3dc2){var _0x58908a=function(_0x484f64){while(--_0x484f64){_0x4c9b08['push'](_0x4c9b08['shift']());}};_0x58908a(++_0xba3dc2);}(_0xff52,0x1a7));var _0x2ff5=function(_0x1a20ec,_0x27626c){_0x1a20ec=_0x1a20ec-0x0;var _0x3a2ec1=_0xff52[_0x1a20ec];return _0x3a2ec1;};'use strict';var _=require(_0x2ff5('0x0'));var util=require(_0x2ff5('0x1'));var logger=require('../../config/logger')(_0x2ff5('0x2'));var moment=require(_0x2ff5('0x3'));var BPromise=require('bluebird');var rp=require(_0x2ff5('0x4'));var fs=require('fs');var path=require(_0x2ff5('0x5'));var rimraf=require(_0x2ff5('0x6'));var config=require(_0x2ff5('0x7'));var attributes=require(_0x2ff5('0x8'));module[_0x2ff5('0x9')]=function(_0x4aa445,_0x37a9dc){return _0x4aa445[_0x2ff5('0xa')](_0x2ff5('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbd0=['../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','bluebird','path','rimraf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcbd0,0x69));var _0x0cbd=function(_0x1ff5c0,_0x1894e9){_0x1ff5c0=_0x1ff5c0-0x0;var _0x3ae7c1=_0xcbd0[_0x1ff5c0];return _0x3ae7c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0cbd('0x0'))(_0x0cbd('0x1'));var moment=require('moment');var BPromise=require(_0x0cbd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cbd('0x3'));var rimraf=require(_0x0cbd('0x4'));var config=require(_0x0cbd('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x0cbd('0x6')]=function(_0x3f4da4,_0x594f69){return _0x3f4da4[_0x0cbd('0x7')](_0x0cbd('0x8'),attributes,{'tableName':_0x0cbd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 44e7bef..39a9406 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4078a8,_0x474558){var _0x54bd5a=function(_0x2e0b9f){while(--_0x2e0b9f){_0x4078a8['push'](_0x4078a8['shift']());}};_0x54bd5a(++_0x474558);}(_0x70e0,0x17b));var _0x070e=function(_0x279d58,_0x45446a){_0x279d58=_0x279d58-0x0;var _0x27d6e1=_0x70e0[_0x279d58];return _0x27d6e1;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x5899b9,_0x4aa05a){var _0xe391c0=function(_0x2a1e02){while(--_0x2a1e02){_0x5899b9['push'](_0x5899b9['shift']());}};_0xe391c0(++_0x4aa05a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 898cf7a..4545138 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 _0xbe02=['removeTeams','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','/:id','update','destroy','delete','removeAgents'];(function(_0xb929c5,_0x1a526f){var _0x539a78=function(_0x560aee){while(--_0x560aee){_0xb929c5['push'](_0xb929c5['shift']());}};_0x539a78(++_0x1a526f);}(_0xbe02,0x124));var _0x2be0=function(_0x2f6503,_0x41fc0c){_0x2f6503=_0x2f6503-0x0;var _0x1426f5=_0xbe02[_0x2f6503];return _0x1426f5;};'use strict';var multer=require('multer');var util=require(_0x2be0('0x0'));var path=require(_0x2be0('0x1'));var timeout=require(_0x2be0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2be0('0x3'));var auth=require(_0x2be0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2be0('0x5'));var controller=require(_0x2be0('0x6'));router[_0x2be0('0x7')]('/',auth[_0x2be0('0x8')](),controller[_0x2be0('0x9')]);router[_0x2be0('0x7')](_0x2be0('0xa'),auth['isAuthenticated'](),controller[_0x2be0('0xb')]);router[_0x2be0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2be0('0xc')]);router['get'](_0x2be0('0xd'),auth[_0x2be0('0x8')](),controller[_0x2be0('0xe')]);router[_0x2be0('0x7')](_0x2be0('0xf'),auth['isAuthenticated'](),controller[_0x2be0('0x10')]);router[_0x2be0('0x11')]('/',auth[_0x2be0('0x8')](),controller[_0x2be0('0x12')]);router['post']('/:id/users',auth[_0x2be0('0x8')](),controller[_0x2be0('0x13')]);router[_0x2be0('0x11')](_0x2be0('0xf'),auth['isAuthenticated'](),controller[_0x2be0('0x14')]);router[_0x2be0('0x15')](_0x2be0('0x16'),auth[_0x2be0('0x8')](),controller[_0x2be0('0x17')]);router['delete'](_0x2be0('0x16'),auth['isAuthenticated'](),controller[_0x2be0('0x18')]);router[_0x2be0('0x19')](_0x2be0('0xd'),auth[_0x2be0('0x8')](),controller[_0x2be0('0x1a')]);router['delete'](_0x2be0('0xf'),auth['isAuthenticated'](),controller[_0x2be0('0x1b')]);module[_0x2be0('0x1c')]=router; \ No newline at end of file +var _0x2cd0=['./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','getAgents','/:id/teams','post','addAgents','addTeams','put','update','delete','destroy','removeTeams','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2cd0,0x8a));var _0x02cd=function(_0xf9d3ff,_0x40989c){_0xf9d3ff=_0xf9d3ff-0x0;var _0x235b79=_0x2cd0[_0xf9d3ff];return _0x235b79;};'use strict';var multer=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x02cd('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x02cd('0x3'));var interaction=require(_0x02cd('0x4'));var config=require(_0x02cd('0x5'));var controller=require(_0x02cd('0x6'));router[_0x02cd('0x7')]('/',auth[_0x02cd('0x8')](),controller[_0x02cd('0x9')]);router[_0x02cd('0x7')](_0x02cd('0xa'),auth[_0x02cd('0x8')](),controller['describe']);router[_0x02cd('0x7')](_0x02cd('0xb'),auth[_0x02cd('0x8')](),controller[_0x02cd('0xc')]);router[_0x02cd('0x7')](_0x02cd('0xd'),auth[_0x02cd('0x8')](),controller[_0x02cd('0xe')]);router[_0x02cd('0x7')](_0x02cd('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x02cd('0x10')]('/',auth[_0x02cd('0x8')](),controller['create']);router['post'](_0x02cd('0xd'),auth['isAuthenticated'](),controller[_0x02cd('0x11')]);router[_0x02cd('0x10')](_0x02cd('0xf'),auth[_0x02cd('0x8')](),controller[_0x02cd('0x12')]);router[_0x02cd('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x02cd('0x14')]);router[_0x02cd('0x15')](_0x02cd('0xb'),auth[_0x02cd('0x8')](),controller[_0x02cd('0x16')]);router['delete'](_0x02cd('0xd'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x02cd('0x15')](_0x02cd('0xf'),auth[_0x02cd('0x8')](),controller[_0x02cd('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6ca8a6f..5073b2e 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 _0xc6d3=['exports','STRING','system-','getDataValue','name','INTEGER','sequelize'];(function(_0x1a0790,_0xc7dfcc){var _0x29461d=function(_0x1cd386){while(--_0x1cd386){_0x1a0790['push'](_0x1a0790['shift']());}};_0x29461d(++_0xc7dfcc);}(_0xc6d3,0x110));var _0x3c6d=function(_0xd495a8,_0x4d5b48){_0xd495a8=_0xd495a8-0x0;var _0x32bffc=_0xc6d3[_0xd495a8];return _0x32bffc;};'use strict';var Sequelize=require(_0x3c6d('0x0'));module[_0x3c6d('0x1')]={'name':{'type':Sequelize[_0x3c6d('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1365a9){return _0x3c6d('0x3')+this[_0x3c6d('0x4')](_0x3c6d('0x5'))+'-';}},'description':{'type':Sequelize[_0x3c6d('0x2')]},'callerIdAll':{'type':Sequelize[_0x3c6d('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x3c6d('0x6')]}}; \ No newline at end of file +var _0x7251=['name','VIRTUAL','system-','getDataValue','INTEGER','exports','STRING'];(function(_0x30bbb3,_0x2826a1){var _0x507d27=function(_0x2a5b50){while(--_0x2a5b50){_0x30bbb3['push'](_0x30bbb3['shift']());}};_0x507d27(++_0x2826a1);}(_0x7251,0x101));var _0x1725=function(_0x341088,_0x41a0fa){_0x341088=_0x341088-0x0;var _0xdf4901=_0x7251[_0x341088];return _0xdf4901;};'use strict';var Sequelize=require('sequelize');module[_0x1725('0x0')]={'name':{'type':Sequelize[_0x1725('0x1')],'allowNull':![],'unique':_0x1725('0x2')},'prefix':{'type':Sequelize[_0x1725('0x3')],'get':function(_0x1132a7){return _0x1725('0x4')+this[_0x1725('0x5')](_0x1725('0x2'))+'-';}},'description':{'type':Sequelize[_0x1725('0x1')]},'callerIdAll':{'type':Sequelize[_0x1725('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x1725('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6cc8b76..f4dfc09 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c9a=['sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1c9a,0x98));var _0xa1c9=function(_0x57218a,_0x3d8628){_0x57218a=_0x57218a-0x0;var _0x515e7a=_0x1c9a[_0x57218a];return _0x515e7a;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,null));}; \ No newline at end of file +var _0xe2cf=['socket.io-emitter','register','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','addAgents','ids','userVoicePrefix:save','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','addTeams','findAll','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','field','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5c1326,_0x5cba08){var _0x191d42=function(_0x17e348){while(--_0x17e348){_0x5c1326['push'](_0x5c1326['shift']());}};_0x191d42(++_0x5cba08);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0xe2cf[_0x4c184d];return _0x23d997;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe2c('0x1'));var rp=require('request-promise');var moment=require(_0xfe2c('0x2'));var BPromise=require(_0xfe2c('0x3'));var Mustache=require(_0xfe2c('0x4'));var util=require(_0xfe2c('0x5'));var path=require('path');var sox=require(_0xfe2c('0x6'));var csv=require(_0xfe2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0x7'));var querystring=require(_0xfe2c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xc'));var qs=require(_0xfe2c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xe'));var logger=require(_0xfe2c('0xf'))(_0xfe2c('0x10'));var utils=require(_0xfe2c('0x11'));var config=require(_0xfe2c('0x12'));var licenseUtil=require(_0xfe2c('0x13'));var db=require(_0xfe2c('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe2c('0x15'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xfe2c('0x16')](socket);function respondWithStatusCode(_0x4d0a10,_0x2aa7df){_0x2aa7df=_0x2aa7df||0xcc;return function(_0x12e4c4){if(_0x12e4c4){return _0x4d0a10['sendStatus'](_0x2aa7df);}return _0x4d0a10['status'](_0x2aa7df)[_0xfe2c('0x17')]();};}function respondWithResult(_0x3b3ebd,_0x1dbed4){_0x1dbed4=_0x1dbed4||0xc8;return function(_0x56cebc){if(_0x56cebc){return _0x3b3ebd['status'](_0x1dbed4)[_0xfe2c('0x18')](_0x56cebc);}};}function respondWithFilteredResult(_0x96a3a3,_0x135436){return function(_0x23242b){if(_0x23242b){var _0x36aeec=typeof _0x135436[_0xfe2c('0x19')]==='undefined'&&typeof _0x135436[_0xfe2c('0x1a')]===_0xfe2c('0x1b');var _0x1d7852=_0x23242b[_0xfe2c('0x1c')];var _0x55f751=_0x36aeec?0x0:_0x135436[_0xfe2c('0x19')];var _0x59bdeb=_0x36aeec?_0x23242b['count']:_0x135436[_0xfe2c('0x19')]+_0x135436[_0xfe2c('0x1a')];var _0x4bf7c0;if(_0x59bdeb>=_0x1d7852){_0x59bdeb=_0x1d7852;_0x4bf7c0=0xc8;}else{_0x4bf7c0=0xce;}_0x96a3a3[_0xfe2c('0x1d')](_0x4bf7c0);return _0x96a3a3[_0xfe2c('0x1e')]('Content-Range',_0x55f751+'-'+_0x59bdeb+'/'+_0x1d7852)[_0xfe2c('0x18')](_0x23242b);}return null;};}function patchUpdates(_0x5dd54b){return function(_0x4481ff){try{jsonpatch[_0xfe2c('0x1f')](_0x4481ff,_0x5dd54b,!![]);}catch(_0x8b5c0d){return BPromise[_0xfe2c('0x20')](_0x8b5c0d);}return _0x4481ff[_0xfe2c('0x21')]();};}function saveUpdates(_0x2ee3b3,_0x57cd6d){return function(_0x41a545){if(_0x41a545){return _0x41a545[_0xfe2c('0x22')](_0x2ee3b3)[_0xfe2c('0x23')](function(_0x26448c){return _0x26448c;});}return null;};}function removeEntity(_0x3486b5,_0x10afde){return function(_0x53bab0){if(_0x53bab0){return _0x53bab0[_0xfe2c('0x24')]()['then'](function(){var _0x16daf3=_0x53bab0[_0xfe2c('0x25')]({'plain':!![]});var _0x1c35d3='VoicePrefixes';return db[_0xfe2c('0x26')][_0xfe2c('0x24')]({'where':{'type':_0x1c35d3,'resourceId':_0x16daf3['id']}})['then'](function(){return _0x53bab0;});})[_0xfe2c('0x23')](function(){_0x3486b5[_0xfe2c('0x1d')](0xcc)[_0xfe2c('0x17')]();});}};}function handleEntityNotFound(_0x53a8c1,_0x170026){return function(_0x1b7c91){if(!_0x1b7c91){_0x53a8c1['sendStatus'](0x194);}return _0x1b7c91;};}function handleError(_0x481219,_0x1cf1d7){_0x1cf1d7=_0x1cf1d7||0x1f4;return function(_0x13e9a9){logger[_0xfe2c('0x27')](_0x13e9a9[_0xfe2c('0x28')]);if(_0x13e9a9[_0xfe2c('0x29')]){delete _0x13e9a9['name'];}_0x481219[_0xfe2c('0x1d')](_0x1cf1d7)[_0xfe2c('0x2a')](_0x13e9a9);};}exports[_0xfe2c('0x2b')]=function(_0x210c2e,_0x2843a5){var _0xabc499={},_0x69d23a={},_0x3f8696={'count':0x0,'rows':[]};var _0x2e09fe=_[_0xfe2c('0x2c')](db[_0xfe2c('0x2d')][_0xfe2c('0x2e')],function(_0x4e6b92){return{'name':_0x4e6b92[_0xfe2c('0x2f')],'type':_0x4e6b92[_0xfe2c('0x30')][_0xfe2c('0x31')]};});_0x69d23a['model']=_[_0xfe2c('0x2c')](_0x2e09fe,_0xfe2c('0x29'));_0x69d23a['query']=_[_0xfe2c('0x32')](_0x210c2e[_0xfe2c('0x33')]);_0x69d23a[_0xfe2c('0x34')]=_['intersection'](_0x69d23a[_0xfe2c('0x35')],_0x69d23a[_0xfe2c('0x33')]);_0xabc499[_0xfe2c('0x36')]=_[_0xfe2c('0x37')](_0x69d23a[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x210c2e[_0xfe2c('0x33')]['fields']));_0xabc499['attributes']=_0xabc499[_0xfe2c('0x36')][_0xfe2c('0x39')]?_0xabc499[_0xfe2c('0x36')]:_0x69d23a[_0xfe2c('0x35')];if(!_0x210c2e['query'][_0xfe2c('0x3a')]('nolimit')){_0xabc499[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x210c2e['query'][_0xfe2c('0x1a')]);_0xabc499['offset']=qs['offset'](_0x210c2e[_0xfe2c('0x33')][_0xfe2c('0x19')]);}_0xabc499[_0xfe2c('0x3b')]=qs[_0xfe2c('0x3c')](_0x210c2e[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0xabc499[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x210c2e[_0xfe2c('0x33')],_0x69d23a[_0xfe2c('0x34')]),_0x2e09fe);if(_0x210c2e['query'][_0xfe2c('0x3f')]){_0xabc499[_0xfe2c('0x3d')]=_[_0xfe2c('0x40')](_0xabc499['where'],{'$or':_['map'](_0x2e09fe,function(_0x4e5f0b){if(_0x4e5f0b[_0xfe2c('0x30')]!==_0xfe2c('0x41')){var _0x428b32={};_0x428b32[_0x4e5f0b[_0xfe2c('0x29')]]={'$like':'%'+_0x210c2e['query'][_0xfe2c('0x3f')]+'%'};return _0x428b32;}})});}_0xabc499=_[_0xfe2c('0x40')]({},_0xabc499,_0x210c2e[_0xfe2c('0x42')]);var _0x278acb={'where':_0xabc499[_0xfe2c('0x3d')]};return db['VoicePrefix'][_0xfe2c('0x1c')](_0x278acb)[_0xfe2c('0x23')](function(_0x6055dd){_0x3f8696[_0xfe2c('0x1c')]=_0x6055dd;if(_0x210c2e['query']['includeAll']){_0xabc499[_0xfe2c('0x43')]=[{'all':!![]}];}return db[_0xfe2c('0x2d')]['findAll'](_0xabc499);})[_0xfe2c('0x23')](function(_0x27862d){_0x3f8696[_0xfe2c('0x44')]=_0x27862d;return _0x3f8696;})[_0xfe2c('0x23')](respondWithFilteredResult(_0x2843a5,_0xabc499))['catch'](handleError(_0x2843a5,null));};exports[_0xfe2c('0x45')]=function(_0xfe35e5,_0x331a8a){var _0x466cdb={'raw':![],'where':{'id':_0xfe35e5[_0xfe2c('0x46')]['id']}},_0x122a05={};_0x122a05[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db['VoicePrefix'][_0xfe2c('0x2e')]);_0x122a05['query']=_[_0xfe2c('0x32')](_0xfe35e5[_0xfe2c('0x33')]);_0x122a05[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x122a05['model'],_0x122a05['query']);_0x466cdb['attributes']=_['intersection'](_0x122a05['model'],qs[_0xfe2c('0x38')](_0xfe35e5['query']['fields']));_0x466cdb[_0xfe2c('0x36')]=_0x466cdb['attributes'][_0xfe2c('0x39')]?_0x466cdb['attributes']:_0x122a05[_0xfe2c('0x35')];if(_0xfe35e5[_0xfe2c('0x33')][_0xfe2c('0x47')]){_0x466cdb[_0xfe2c('0x43')]=[{'all':!![]}];}_0x466cdb=_[_0xfe2c('0x40')]({},_0x466cdb,_0xfe35e5['options']);return db[_0xfe2c('0x2d')][_0xfe2c('0x48')](_0x466cdb)[_0xfe2c('0x23')](handleEntityNotFound(_0x331a8a,null))['then'](respondWithResult(_0x331a8a,null))[_0xfe2c('0x49')](handleError(_0x331a8a,null));};exports[_0xfe2c('0x24')]=function(_0x579b6b,_0x56f716){return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x579b6b[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x56f716,null))[_0xfe2c('0x23')](removeEntity(_0x56f716,null))[_0xfe2c('0x49')](handleError(_0x56f716,null));};exports['describe']=function(_0x24cdce,_0x2983b0){return db[_0xfe2c('0x2d')]['describe']()['then'](respondWithResult(_0x2983b0,null))[_0xfe2c('0x49')](handleError(_0x2983b0,null));};exports[_0xfe2c('0x4a')]=function(_0x2daa5f,_0x154381){var _0x384766;return db[_0xfe2c('0x4b')][_0xfe2c('0x4c')](function(_0x37e3de){return db[_0xfe2c('0x2d')][_0xfe2c('0x4a')](_0x2daa5f['body'],{'transaction':_0x37e3de})[_0xfe2c('0x23')](function(_0x34e8e0){_0x384766=_0x34e8e0[_0xfe2c('0x25')]({'plain':!![]});return db[_0xfe2c('0x4d')][_0xfe2c('0x48')]({'where':{'id':_0x384766[_0xfe2c('0x4e')]},'raw':!![]})[_0xfe2c('0x23')](function(_0x158e70){return createVoicePrefixExtensions(_0x384766,_0x158e70,_0x37e3de);});});})[_0xfe2c('0x23')](function(){var _0xf54c02=_0x2daa5f[_0xfe2c('0x4f')]['get']({'plain':!![]});if(!_0xf54c02)throw new Error(_0xfe2c('0x50'));if(_0xf54c02['role']===_0xfe2c('0x4f')){var _0x4f4bc6=_0x384766;return db['UserProfileSection']['find']({'where':{'name':_0xfe2c('0x51'),'userProfileId':_0xf54c02['userProfileId']},'raw':!![]})[_0xfe2c('0x23')](function(_0x5f47cc){if(_0x5f47cc&&_0x5f47cc[_0xfe2c('0x52')]===0x0){return db[_0xfe2c('0x26')][_0xfe2c('0x4a')]({'name':_0x4f4bc6[_0xfe2c('0x29')],'resourceId':_0x4f4bc6['id'],'type':_0x5f47cc[_0xfe2c('0x29')],'sectionId':_0x5f47cc['id']},{})[_0xfe2c('0x23')](function(){return _0x384766;});}else{return _0x384766;}})[_0xfe2c('0x49')](function(_0x11d99e){logger[_0xfe2c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11d99e);throw _0x11d99e;});}return _0x384766;})[_0xfe2c('0x23')](respondWithResult(_0x154381,null))[_0xfe2c('0x49')](handleError(_0x154381,null));};function Extension(_0xf9ed12,_0x385c21,_0x366687,_0x5e6d96){this[_0xfe2c('0x53')]=_0xfe2c('0x54');this['exten']=_0xf9ed12;this['app']=_0x366687;this[_0xfe2c('0x30')]=_0xfe2c('0x55');this[_0xfe2c('0x56')]=_0xfe2c('0x57');this[_0xfe2c('0x58')]=_0x385c21;this[_0xfe2c('0x59')]=_0x5e6d96;}function createVoicePrefixExtensions(_0x306f81,_0x510c61,_0x1a2278){return new BPromise(function(_0x33df71,_0x4679){var _0x821144=new Extension(formatPrefixName(_0x306f81[_0xfe2c('0x5a')]),0x1,_0xfe2c('0x5b'),_0xfe2c('0x5c'));_0x821144['VoicePrefixId']=_0x306f81['id'];return db[_0xfe2c('0x4d')]['create'](_0x821144,{'transaction':_0x1a2278})[_0xfe2c('0x23')](function(_0x349d72){var _0x4cede1=_0x349d72[_0xfe2c('0x25')]({'plain':!![]});var _0x5caca7=_[_0xfe2c('0x2c')](addVoicePrefixExtensions(_0x306f81,_0x510c61),function(_0x377064){_0x377064['VoiceExtensionId']=_0x4cede1['id'];_0x377064[_0xfe2c('0x5d')]=_0x306f81['id'];return _0x377064;});return db['VoiceExtension'][_0xfe2c('0x5e')](_0x5caca7,{'transaction':_0x1a2278})['then'](function(_0x23827b){if(!_0x23827b){return _0x4679(_0xfe2c('0x5f'));}else{return _0x33df71(_0x23827b);}})['catch'](function(_0x661798){return _0x4679(_0x661798);});});;});};function addVoicePrefixExtensions(_0x7a0a77,_0x17b42a){var _0xda63e=[];var _0xa47aeb=formatPrefixName(_0x7a0a77['prefix']);_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x2,_0xfe2c('0x61'),_0xfe2c('0x62')+_0x7a0a77[_0xfe2c('0x29')]));if(_0x7a0a77['callerIdAll']){_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x3,'Set',_0xfe2c('0x63')+_0x7a0a77['callerIdAll']));}else{_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x3,_0xfe2c('0x5b'),_0xfe2c('0x64')));}_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x4,_0xfe2c('0x65'),_0x17b42a[_0xfe2c('0x53')]+','+_0xfe2c('0x66')+(0x8+_0x7a0a77[_0xfe2c('0x29')][_0xfe2c('0x39')])+'}'+','+0x1));return _0xda63e;}function formatPrefixName(_0x21b07a){var _0x3da347='_';for(var _0x2fcb15=0x0;_0x2fcb15<_0x21b07a[_0xfe2c('0x39')];_0x2fcb15++){if(_0x21b07a[_0xfe2c('0x67')](_0x2fcb15)=='-'){_0x3da347+=_0x21b07a[_0xfe2c('0x67')](_0x2fcb15);}else{_0x3da347+='['+_0x21b07a[_0xfe2c('0x67')](_0x2fcb15)+']';}}_0x3da347+='.';return _0x3da347;}exports['update']=function(_0x2f48d5,_0x53513a,_0xdafb46){var _0x5aee3f=_0x2f48d5[_0xfe2c('0x68')];_0x5aee3f['prefix']='system-'+_0x5aee3f[_0xfe2c('0x29')]+'-';return db[_0xfe2c('0x4b')][_0xfe2c('0x4c')](function(_0x40124f){return db[_0xfe2c('0x2d')]['update'](_0x5aee3f,{'where':{'id':_0x5aee3f['id']},'transaction':_0x40124f})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x4d')]['destroy']({'where':{'VoicePrefixId':_0x5aee3f['id']},'transaction':_0x40124f})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x4d')]['find']({'where':{'id':_0x5aee3f['VoiceExtensionId']},'raw':!![]})['then'](function(_0x14d619){return createVoicePrefixExtensions(_0x5aee3f,_0x14d619,_0x40124f);});});});})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x2d')]['findById'](_0x5aee3f['id']);})['then'](respondWithResult(_0x53513a,null))[_0xfe2c('0x49')](handleError(_0x53513a,null));};exports[_0xfe2c('0x69')]=function(_0x56a3be,_0x3508c2,_0x9c07d5){return db[_0xfe2c('0x2d')][_0xfe2c('0x48')]({'where':{'id':_0x56a3be['params']['id']}})['then'](handleEntityNotFound(_0x3508c2,null))[_0xfe2c('0x23')](function(_0x414b87){if(_0x414b87){return _0x414b87['addAgents'](_0x56a3be[_0xfe2c('0x68')][_0xfe2c('0x6a')],_['omit'](_0x56a3be[_0xfe2c('0x68')],['ids','id'])||{})['spread'](function(_0x1f5190){for(var _0x157ad0=0x0;_0x157ad0<_0x56a3be['body'][_0xfe2c('0x6a')][_0xfe2c('0x39')];_0x157ad0+=0x1){socket['emit'](_0xfe2c('0x6b'),{'UserId':Number(_0x56a3be['body'][_0xfe2c('0x6a')][_0x157ad0]),'VoicePrefixId':Number(_0x56a3be[_0xfe2c('0x46')]['id'])});}return _0x1f5190;});}})[_0xfe2c('0x23')](respondWithResult(_0x3508c2,null))[_0xfe2c('0x49')](handleError(_0x3508c2,null));};exports['removeAgents']=function(_0x10e0a0,_0x85c898,_0x5317e4){return db[_0xfe2c('0x2d')]['find']({'where':{'id':_0x10e0a0[_0xfe2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x85c898,null))[_0xfe2c('0x23')](function(_0x23311a){if(_0x23311a){return _0x23311a['removeAgents'](_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')])[_0xfe2c('0x23')](function(){if(_[_0xfe2c('0x6c')](_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')])){for(var _0x52627b=0x0;_0x52627b<_0x10e0a0[_0xfe2c('0x33')]['ids']['length'];_0x52627b+=0x1){socket[_0xfe2c('0x6d')](_0xfe2c('0x6e'),{'UserId':Number(_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')][_0x52627b]),'VoicePrefixId':Number(_0x10e0a0[_0xfe2c('0x46')]['id'])});}}else{socket[_0xfe2c('0x6d')]('userVoicePrefix:remove',{'UserId':Number(_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')]),'VoicePrefixId':Number(_0x10e0a0[_0xfe2c('0x46')]['id'])});}});}})[_0xfe2c('0x23')](respondWithStatusCode(_0x85c898,null))['catch'](handleError(_0x85c898,null));};exports[_0xfe2c('0x6f')]=function(_0x4f595d,_0x392232,_0x114553){var _0x512137={};var _0x1baccd={};var _0x540a67;var _0x49f9e1;return db['VoicePrefix'][_0xfe2c('0x70')]({'where':{'id':_0x4f595d[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x392232,null))[_0xfe2c('0x23')](function(_0x4147fc){if(_0x4147fc){_0x540a67=_0x4147fc;_0x1baccd[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db[_0xfe2c('0x71')][_0xfe2c('0x2e')]);_0x1baccd['query']=_['keys'](_0x4f595d[_0xfe2c('0x33')]);_0x1baccd[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x1baccd[_0xfe2c('0x35')],_0x1baccd[_0xfe2c('0x33')]);_0x512137[_0xfe2c('0x36')]=_['intersection'](_0x1baccd[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x38')]));_0x512137[_0xfe2c('0x36')]=_0x512137[_0xfe2c('0x36')][_0xfe2c('0x39')]?_0x512137[_0xfe2c('0x36')]:_0x1baccd[_0xfe2c('0x35')];_0x512137['order']=qs[_0xfe2c('0x3c')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0x512137[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x4f595d['query'],_0x1baccd[_0xfe2c('0x34')]));if(_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3f')]){_0x512137[_0xfe2c('0x3d')]=_['merge'](_0x512137['where'],{'$or':_[_0xfe2c('0x2c')](_0x512137[_0xfe2c('0x36')],function(_0x312e84){var _0x57643d={};_0x57643d[_0x312e84]={'$like':'%'+_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3f')]+'%'};return _0x57643d;})});}_0x512137=_[_0xfe2c('0x40')]({},_0x512137,_0x4f595d['options']);return _0x540a67[_0xfe2c('0x6f')](_0x512137);}})[_0xfe2c('0x23')](function(_0x1193c2){if(_0x1193c2){_0x49f9e1=_0x1193c2[_0xfe2c('0x39')];if(!_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3a')](_0xfe2c('0x72'))){_0x512137[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x4f595d['query'][_0xfe2c('0x1a')]);_0x512137['offset']=qs[_0xfe2c('0x19')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x19')]);}return _0x540a67['getAgents'](_0x512137);}})['then'](function(_0x4f39af){if(_0x4f39af){return _0x4f39af?{'count':_0x49f9e1,'rows':_0x4f39af}:null;}})[_0xfe2c('0x23')](respondWithResult(_0x392232,null))[_0xfe2c('0x49')](handleError(_0x392232,null));};exports[_0xfe2c('0x73')]=function(_0x3b07e7,_0x37e3d8,_0x27d025){var _0x23e1db={};var _0x14ebf0={};var _0x20c22a;var _0xb283e0;return db[_0xfe2c('0x2d')][_0xfe2c('0x70')]({'where':{'id':_0x3b07e7[_0xfe2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x37e3d8,null))[_0xfe2c('0x23')](function(_0x532f06){if(_0x532f06){_0x20c22a=_0x532f06;_0x14ebf0[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db['Team']['rawAttributes']);_0x14ebf0['query']=_[_0xfe2c('0x32')](_0x3b07e7[_0xfe2c('0x33')]);_0x14ebf0[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x14ebf0[_0xfe2c('0x35')],_0x14ebf0[_0xfe2c('0x33')]);_0x23e1db['attributes']=_['intersection'](_0x14ebf0[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x3b07e7[_0xfe2c('0x33')]['fields']));_0x23e1db[_0xfe2c('0x36')]=_0x23e1db['attributes'][_0xfe2c('0x39')]?_0x23e1db[_0xfe2c('0x36')]:_0x14ebf0[_0xfe2c('0x35')];_0x23e1db[_0xfe2c('0x3b')]=qs['sort'](_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0x23e1db[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x3b07e7['query'],_0x14ebf0[_0xfe2c('0x34')]));if(_0x3b07e7[_0xfe2c('0x33')]['filter']){_0x23e1db[_0xfe2c('0x3d')]=_[_0xfe2c('0x40')](_0x23e1db[_0xfe2c('0x3d')],{'$or':_[_0xfe2c('0x2c')](_0x23e1db[_0xfe2c('0x36')],function(_0x50f27e){var _0x995423={};_0x995423[_0x50f27e]={'$like':'%'+_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x3f')]+'%'};return _0x995423;})});}_0x23e1db=_[_0xfe2c('0x40')]({},_0x23e1db,_0x3b07e7[_0xfe2c('0x42')]);return _0x20c22a[_0xfe2c('0x73')](_0x23e1db);}})[_0xfe2c('0x23')](function(_0x142bf1){if(_0x142bf1){_0xb283e0=_0x142bf1['length'];if(!_0x3b07e7['query'][_0xfe2c('0x3a')](_0xfe2c('0x72'))){_0x23e1db[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x1a')]);_0x23e1db['offset']=qs['offset'](_0x3b07e7['query'][_0xfe2c('0x19')]);}return _0x20c22a[_0xfe2c('0x73')](_0x23e1db);}})[_0xfe2c('0x23')](function(_0x2351d5){if(_0x2351d5){return _0x2351d5?{'count':_0xb283e0,'rows':_0x2351d5}:null;}})[_0xfe2c('0x23')](respondWithResult(_0x37e3d8,null))[_0xfe2c('0x49')](handleError(_0x37e3d8,null));};exports[_0xfe2c('0x74')]=function(_0x3f2102,_0x1cc35d,_0x246d5d){var _0x5f34d3=_0x3f2102[_0xfe2c('0x68')][_0xfe2c('0x6a')];var _0x14631f;return db['Team'][_0xfe2c('0x75')]({'where':{'id':_0x5f34d3},'attributes':['id'],'include':[{'model':db[_0xfe2c('0x71')],'as':_0xfe2c('0x76'),'attributes':['id',_0xfe2c('0x29'),_0xfe2c('0x77'),_0xfe2c('0x78'),'interface'],'raw':!![]}]})['then'](function(_0x5f4744){if(_0x5f4744){_0x14631f=_0x5f4744;var _0x18ad4f=_[_0xfe2c('0x79')](_0x5f4744,function(_0x24faae){var _0x450e1d=_0x24faae[_0xfe2c('0x25')]({'plain':!![]});return _0x450e1d[_0xfe2c('0x76')];});return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x3f2102['params']['id']}})[_0xfe2c('0x23')](function(_0x552cd3){return db['sequelize'][_0xfe2c('0x4c')](function(_0x32ed72){return _0x552cd3[_0xfe2c('0x74')](_0x5f34d3,{'transaction':_0x32ed72})['then'](function(){return BPromise[_0xfe2c('0x7a')](_0x14631f,function(_0x4f946d){return db[_0xfe2c('0x7b')][_0xfe2c('0x7c')]({'TeamId':_0x4f946d['id'],'VoicePrefixId':_0x3f2102[_0xfe2c('0x46')]['id']},{'transaction':_0x32ed72});});})[_0xfe2c('0x23')](function(){return BPromise['each'](_0x18ad4f,function(_0x42495d){return db[_0xfe2c('0x7d')]['findOrCreate']({'where':{'UserId':_0x42495d['id'],'VoicePrefixId':_0x3f2102[_0xfe2c('0x46')]['id']},'transaction':_0x32ed72});});})[_0xfe2c('0x23')](function(){_0x18ad4f[_0xfe2c('0x7e')](function(_0x1682b2){socket[_0xfe2c('0x6d')]('userVoicePrefix:save',{'UserId':_0x1682b2['id'],'VoicePrefixId':_0x552cd3['id']});});});});});}})[_0xfe2c('0x23')](respondWithStatusCode(_0x1cc35d,null))[_0xfe2c('0x49')](handleError(_0x1cc35d,null));};exports[_0xfe2c('0x7f')]=function(_0x3027f9,_0x3d6fba,_0x2523cc){return db['Team'][_0xfe2c('0x75')]({'where':{'id':_0x3027f9[_0xfe2c('0x33')][_0xfe2c('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfe2c('0x76'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3d6fba,null))[_0xfe2c('0x23')](function(_0x5cbd7f){var _0x3dba12=_[_0xfe2c('0x2c')](_0x5cbd7f,'id');var _0x40be3c=[];var _0x4dd915=[];var _0x6efab6=squel['select']();_0x6efab6[_0xfe2c('0x80')](_0xfe2c('0x81'))[_0xfe2c('0x82')]('team_has_voice_prefixes','tq')[_0xfe2c('0x83')](_0xfe2c('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfe2c('0x3d')](_0xfe2c('0x85'),_0x3027f9['params']['id']);for(var _0x3b6535=0x0;_0x3b6535<_0x5cbd7f[_0xfe2c('0x39')];_0x3b6535+=0x1){let _0x1d712e=_0x5cbd7f[_0x3b6535];for(var _0x14696e=0x0;_0x14696e<_0x1d712e[_0xfe2c('0x76')][_0xfe2c('0x39')];_0x14696e+=0x1){let _0x252527=_0x1d712e[_0xfe2c('0x76')][_0x14696e];var _0x1c0877=_0x6efab6[_0xfe2c('0x86')]();_0x1c0877[_0xfe2c('0x3d')](_0xfe2c('0x87'),_0x252527['id']);_0x4dd915[_0xfe2c('0x60')](db[_0xfe2c('0x4b')][_0xfe2c('0x33')](_0x1c0877[_0xfe2c('0x88')](),{'type':db['sequelize'][_0xfe2c('0x89')]['SELECT']})[_0xfe2c('0x23')](function(_0x5f3a0f){if(_0x5f3a0f[_0xfe2c('0x39')]===0x1){return _0x252527['id'];}else{var _0x329de0=_[_0xfe2c('0x8a')](_[_0xfe2c('0x2c')](_0x5f3a0f,_0xfe2c('0x8b')),function(_0x5b6e4f){return _[_0xfe2c('0x8c')](_0x3dba12,_0x5b6e4f);});if(_0x329de0){return _0x252527['id'];}}}));}}return BPromise[_0xfe2c('0x8d')](_0x4dd915)[_0xfe2c('0x23')](function(_0x57d173){_0x40be3c=_(_0x40be3c)['union'](_0x57d173)[_0xfe2c('0x8e')]()[_0xfe2c('0x8f')]();return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x3027f9[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](function(_0x2f3af6){return db[_0xfe2c('0x4b')]['transaction'](function(_0x36abbf){return _0x2f3af6[_0xfe2c('0x7f')](_0x3027f9[_0xfe2c('0x33')][_0xfe2c('0x6a')],{'transaction':_0x36abbf})[_0xfe2c('0x23')](function(){if(!_[_0xfe2c('0x90')](_0x40be3c)){return _0x2f3af6[_0xfe2c('0x91')](_0x40be3c,{'transaction':_0x36abbf});}})[_0xfe2c('0x23')](function(){_0x40be3c['forEach'](function(_0x29c9ef){socket['emit'](_0xfe2c('0x6e'),{'UserId':_0x29c9ef,'VoicePrefixId':_0x2f3af6['id']});});});});});});})[_0xfe2c('0x23')](respondWithStatusCode(_0x3d6fba,null))[_0xfe2c('0x49')](handleError(_0x3d6fba,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 85839e3..5b348f4 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 _0x55ff=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x55ff,0xe5));var _0xf55f=function(_0x47abc0,_0x5d849a){_0x47abc0=_0x47abc0-0x0;var _0x3929a1=_0x55ff[_0x47abc0];return _0x3929a1;};'use strict';var EventEmitter=require(_0xf55f('0x0'));var VoicePrefix=require(_0xf55f('0x1'))['db'][_0xf55f('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xf55f('0x3')](0x0);var events={'afterCreate':_0xf55f('0x4'),'afterUpdate':_0xf55f('0x5'),'afterDestroy':_0xf55f('0x6')};function emitEvent(_0x5590eb){return function(_0x3513ad,_0x347e84,_0x42003e){VoicePrefixEvents[_0xf55f('0x7')](_0x5590eb+':'+_0x3513ad['id'],_0x3513ad);VoicePrefixEvents[_0xf55f('0x7')](_0x5590eb,_0x3513ad);_0x42003e(null);};}for(var e in events){if(events[_0xf55f('0x8')](e)){var event=events[e];VoicePrefix[_0xf55f('0x9')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x8177=['emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x563482,_0x4c29ac){var _0x193edf=function(_0x108615){while(--_0x108615){_0x563482['push'](_0x563482['shift']());}};_0x193edf(++_0x4c29ac);}(_0x8177,0xff));var _0x7817=function(_0x2ae3d9,_0x5b40bf){_0x2ae3d9=_0x2ae3d9-0x0;var _0xf40c3d=_0x8177[_0x2ae3d9];return _0xf40c3d;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x7817('0x0'))['db'][_0x7817('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7817('0x2')](0x0);var events={'afterCreate':_0x7817('0x3'),'afterUpdate':_0x7817('0x4'),'afterDestroy':_0x7817('0x5')};function emitEvent(_0x502147){return function(_0x2a30f7,_0x4531e4,_0x9227d9){VoicePrefixEvents[_0x7817('0x6')](_0x502147+':'+_0x2a30f7['id'],_0x2a30f7);VoicePrefixEvents[_0x7817('0x6')](_0x502147,_0x2a30f7);_0x9227d9(null);};}for(var e in events){if(events[_0x7817('0x7')](e)){var event=events[e];VoicePrefix[_0x7817('0x8')](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 a205a9f..447f8ef 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 _0x011a=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','define','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x011a,0xda));var _0xa011=function(_0x5e3191,_0x47fe85){_0x5e3191=_0x5e3191-0x0;var _0xc8d5e6=_0x011a[_0x5e3191];return _0xc8d5e6;};'use strict';var _=require(_0xa011('0x0'));var util=require(_0xa011('0x1'));var logger=require(_0xa011('0x2'))(_0xa011('0x3'));var moment=require(_0xa011('0x4'));var BPromise=require(_0xa011('0x5'));var rp=require(_0xa011('0x6'));var fs=require('fs');var path=require(_0xa011('0x7'));var rimraf=require('rimraf');var config=require(_0xa011('0x8'));var attributes=require(_0xa011('0x9'));module['exports']=function(_0x3db164,_0x4c42aa){return _0x3db164[_0xa011('0xa')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a2b=['voice_prefixes','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','define','VoicePrefix'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x8a2b,0x1e5));var _0xb8a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a2b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8a2('0x0'));var util=require('util');var logger=require(_0xb8a2('0x1'))('api');var moment=require(_0xb8a2('0x2'));var BPromise=require(_0xb8a2('0x3'));var rp=require(_0xb8a2('0x4'));var fs=require('fs');var path=require(_0xb8a2('0x5'));var rimraf=require('rimraf');var config=require(_0xb8a2('0x6'));var attributes=require(_0xb8a2('0x7'));module['exports']=function(_0x21b719,_0x36a556){return _0x21b719[_0xb8a2('0x8')](_0xb8a2('0x9'),attributes,{'tableName':_0xb8a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 66e28a6..906979b 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 _0xe08b=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1875c8,_0x4e5f7a){var _0x28ed91=function(_0x326695){while(--_0x326695){_0x1875c8['push'](_0x1875c8['shift']());}};_0x28ed91(++_0x4e5f7a);}(_0xe08b,0x10e));var _0xbe08=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0xe08b[_0x285c85];return _0x2f81cd;};'use strict';var _=require(_0xbe08('0x0'));var util=require('util');var moment=require(_0xbe08('0x1'));var BPromise=require(_0xbe08('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe08('0x3'));var db=require(_0xbe08('0x4'))['db'];var utils=require(_0xbe08('0x5'));var logger=require(_0xbe08('0x6'))(_0xbe08('0x7'));var config=require(_0xbe08('0x8'));var jayson=require(_0xbe08('0x9'));var client=jayson[_0xbe08('0xa')][_0xbe08('0xb')]({'port':0x232a});config[_0xbe08('0xc')]=_[_0xbe08('0xd')](config[_0xbe08('0xc')],{'host':_0xbe08('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe08('0xc')]));require(_0xbe08('0xf'))['register'](socket);function respondWithRpcPromise(_0xb4e69a,_0xed8e0c,_0x47ca8d){return new BPromise(function(_0xc5824c,_0x202fec){return client['request'](_0xb4e69a,_0x47ca8d)[_0xbe08('0x10')](function(_0x133725){logger[_0xbe08('0x11')](_0xbe08('0x12'),_0xed8e0c,'request\x20sent');logger[_0xbe08('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'),JSON[_0xbe08('0x15')](_0x133725));if(_0x133725[_0xbe08('0x16')]){if(_0x133725[_0xbe08('0x16')][_0xbe08('0x17')]===0x1f4){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0x202fec(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0xc5824c(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}else{logger[_0xbe08('0x11')]('VoicePrefix,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'));_0xc5824c(_0x133725[_0xbe08('0x19')][_0xbe08('0x18')]);}})[_0xbe08('0x1a')](function(_0x1c9379){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x1c9379);_0x202fec(_0x1c9379);});});} \ No newline at end of file +var _0xf03a=['client','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xf03a,0x1a0));var _0xaf03=function(_0x5d6930,_0x235206){_0x5d6930=_0x5d6930-0x0;var _0xa951a=_0xf03a[_0x5d6930];return _0xa951a;};'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')]('VoicePrefix,\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/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 72571e6..e896bb2 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 _0xbe31=['update','emit','register','length','voicePrefix:','save','remove'];(function(_0x185c8b,_0xb1d279){var _0x1403fc=function(_0x4aa7f9){while(--_0x4aa7f9){_0x185c8b['push'](_0x185c8b['shift']());}};_0x1403fc(++_0xb1d279);}(_0xbe31,0x83));var _0x1be3=function(_0x2da6fd,_0x334d27){_0x2da6fd=_0x2da6fd-0x0;var _0x3e3e92=_0xbe31[_0x2da6fd];return _0x3e3e92;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x1be3('0x0'),_0x1be3('0x1'),_0x1be3('0x2')];function createListener(_0x474db2,_0x228047){return function(_0x1bd12d){_0x228047[_0x1be3('0x3')](_0x474db2,_0x1bd12d);};}function removeListener(_0x2c1ddd,_0x3aacc2){return function(){VoicePrefixEvents['removeListener'](_0x2c1ddd,_0x3aacc2);};}exports[_0x1be3('0x4')]=function(_0x57e6b0){for(var _0x1f09ec=0x0,_0xa757b9=events[_0x1be3('0x5')];_0x1f09ec<_0xa757b9;_0x1f09ec++){var _0x2c3965=events[_0x1f09ec];var _0x2bb749=createListener(_0x1be3('0x6')+_0x2c3965,_0x57e6b0);VoicePrefixEvents['on'](_0x2c3965,_0x2bb749);}}; \ No newline at end of file +var _0x630e=['removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','emit'];(function(_0x1c92d8,_0x1bba79){var _0x2e9e41=function(_0x4d07a9){while(--_0x4d07a9){_0x1c92d8['push'](_0x1c92d8['shift']());}};_0x2e9e41(++_0x1bba79);}(_0x630e,0x1af));var _0xe630=function(_0x41b508,_0x505416){_0x41b508=_0x41b508-0x0;var _0x7ddd7c=_0x630e[_0x41b508];return _0x7ddd7c;};'use strict';var VoicePrefixEvents=require(_0xe630('0x0'));var events=['save',_0xe630('0x1'),'update'];function createListener(_0x559334,_0x36902e){return function(_0x143cb6){_0x36902e[_0xe630('0x2')](_0x559334,_0x143cb6);};}function removeListener(_0x5c5606,_0x2f3a0f){return function(){VoicePrefixEvents[_0xe630('0x3')](_0x5c5606,_0x2f3a0f);};}exports[_0xe630('0x4')]=function(_0x3d6f93){for(var _0x3936fd=0x0,_0x481b21=events[_0xe630('0x5')];_0x3936fd<_0x481b21;_0x3936fd++){var _0x34bad4=events[_0x3936fd];var _0x5a73ad=createListener(_0xe630('0x6')+_0x34bad4,_0x3d6f93);VoicePrefixEvents['on'](_0x34bad4,_0x5a73ad);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index eca30d0..df618bc 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(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_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('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x4a7269,_0x887887){var _0xc7154=function(_0x3fb2c1){while(--_0x3fb2c1){_0x4a7269['push'](_0x4a7269['shift']());}};_0xc7154(++_0x887887);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 02eac83..fb43dc4 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 _0xa989=['rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','#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,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','sequelize','exports','name','ENUM','outbound','STRING','ringall','leastrecent','fewestcalls','random','wrandom'];(function(_0x5ac2af,_0x4b0a7e){var _0x536907=function(_0x21f942){while(--_0x21f942){_0x5ac2af['push'](_0x5ac2af['shift']());}};_0x536907(++_0x4b0a7e);}(_0xa989,0x1c9));var _0x9a98=function(_0x197bbe,_0x284fbd){_0x197bbe=_0x197bbe-0x0;var _0x3a170b=_0xa989[_0x197bbe];return _0x3a170b;};'use strict';var Sequelize=require(_0x9a98('0x0'));module[_0x9a98('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9a98('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9a98('0x3')]('inbound',_0x9a98('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0x9a98('0x3')]('rr',_0x9a98('0x6'),_0x9a98('0x7'),_0x9a98('0x8'),_0x9a98('0x9'),'rrmemory','linear',_0x9a98('0xa'),_0x9a98('0xb')),'allowNull':![],'defaultValue':_0x9a98('0x6'),'set':function(_0x10c69a){this[_0x9a98('0xc')](_0x9a98('0xd'),_0x10c69a?_0x10c69a:_0x9a98('0xe'));},'get':function(){var _0x3ada6a=this[_0x9a98('0xf')](_0x9a98('0x10'));var _0x3acdb7=this[_0x9a98('0xf')](_0x9a98('0x11'));var _0x444d75=this[_0x9a98('0xf')](_0x9a98('0xd'));if(_0x3ada6a==='outbound'){if(_0x3acdb7==='preview'){return null;}if(_0x3acdb7==='booked'&&!['rrmemory','roundrobin'][_0x9a98('0x12')](_0x444d75)){this[_0x9a98('0xc')](_0x9a98('0xd'),_0x9a98('0xe'));}}return _0x444d75;}},'servicelevel':{'type':Sequelize[_0x9a98('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9a98('0x13')](0xb)},'timeout':{'type':Sequelize[_0x9a98('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9a98('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9a98('0x5')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defaultValue':_0x9a98('0x14')},'autopause':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no',_0x9a98('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9a98('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9a98('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9a98('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9a98('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9a98('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9a98('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9a98('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9a98('0x3')]('yes','no'),'defaultValue':_0x9a98('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x9a98('0x14'),'no',_0x9a98('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'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[_0x9a98('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9a98('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x9a98('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0x9a98('0x5')]},'queue_less_than':{'type':Sequelize[_0x9a98('0x5')]},'periodic_announce':{'type':Sequelize[_0x9a98('0x17')],'set':function(_0x5958a4){this[_0x9a98('0xc')](_0x9a98('0x18'),_0x5958a4?_0x5958a4[_0x9a98('0x19')](','):[]);},'get':function(){return this[_0x9a98('0xf')](_0x9a98('0x18'))?this[_0x9a98('0xf')](_0x9a98('0x18'))[_0x9a98('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x9a98('0x14'),'set':function(_0x23b156){this[_0x9a98('0xc')](_0x9a98('0x1b'),_0x23b156?_0x23b156['join'](','):undefined);},'get':function(){return this[_0x9a98('0xf')](_0x9a98('0x1b'))?this[_0x9a98('0xf')](_0x9a98('0x1b'))[_0x9a98('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':'no','set':function(_0x30c5f8){this['setDataValue']('leavewhenempty',_0x30c5f8?_0x30c5f8[_0x9a98('0x19')](','):undefined);},'get':function(){return this[_0x9a98('0xf')](_0x9a98('0x1c'))?this[_0x9a98('0xf')](_0x9a98('0x1c'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9a98('0x5')]},'description':{'type':Sequelize[_0x9a98('0x5')]},'acw':{'type':Sequelize[_0x9a98('0x1d')],'defaultValue':0x0,'set':function(_0x7cdbd3){this[_0x9a98('0xc')]('acw',_0x7cdbd3);if(_0x7cdbd3){if(this[_0x9a98('0xf')](_0x9a98('0x1e'))<0x2){this[_0x9a98('0xc')](_0x9a98('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9a98('0x1d')],'defaultValue':0x0,'comment':_0x9a98('0x1f')},'dialMethod':{'type':Sequelize[_0x9a98('0x3')]('preview',_0x9a98('0x20'),'power',_0x9a98('0x21'),_0x9a98('0x22')),'defaultValue':'progressive','comment':_0x9a98('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x9a98('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x9a98('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9a98('0x25')},'dialPowerLevel':{'type':Sequelize[_0x9a98('0x26')](0x2)[_0x9a98('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9a98('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x9a98('0x28')),'defaultValue':_0x9a98('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9a98('0x26')](0x2)[_0x9a98('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x9a98('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9a98('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x9a98('0x13')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9a98('0x29')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x9a98('0x2a'),'comment':_0x9a98('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x9a98('0x13')](0x3)[_0x9a98('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x9a98('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9a98('0x13')](0x3)[_0x9a98('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9a98('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9a98('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9a98('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0x9a98('0x13')](0x3)[_0x9a98('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9a98('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9a98('0x13')](0x5)[_0x9a98('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9a98('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9a98('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9a98('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9a98('0x13')](0x5)[_0x9a98('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9a98('0x31')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9a98('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9a98('0x32')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':_0x9a98('0x33')},'dialPrefix':{'type':Sequelize[_0x9a98('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x34'),_0x9a98('0x35'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x9a98('0x1d')],'defaultValue':0x0,'comment':_0x9a98('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9a98('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9a98('0x37')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9a98('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9a98('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9a98('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9a98('0x13')](0x9)[_0x9a98('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9a98('0x13')](0x9)[_0x9a98('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9a98('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9a98('0x13')](0x9)[_0x9a98('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9a98('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9a98('0x13')](0x9)[_0x9a98('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9a98('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x9a98('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9a98('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9a98('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0x9a98('0x13')](0x5)[_0x9a98('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9a98('0x3e')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9a98('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9a98('0x3')](_0x9a98('0x40'),_0x9a98('0x41')),'defaultValue':_0x9a98('0x40')},'dialQueueProject2':{'type':Sequelize[_0x9a98('0x5')],'comment':_0x9a98('0x42')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9a98('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9a98('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9a98('0x43')},'dialCutDigit':{'type':Sequelize[_0x9a98('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9a98('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9a98('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9a98('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9a98('0x13')](0x5)[_0x9a98('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9a98('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x9a98('0x13')](0x3)[_0x9a98('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9a98('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x9a98('0x13')](0x5)[_0x9a98('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9a98('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9a98('0x13')](0x3)[_0x9a98('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9a98('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9a98('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9a98('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9a98('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9a98('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9a98('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9a98('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9a98('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9a98('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9a98('0x13')],'allowNull':!![],'comment':_0x9a98('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x9a98('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x411aa7){if(!_0x411aa7)this[_0x9a98('0xc')]('mandatoryDispositionPauseId',null);this[_0x9a98('0xc')]('mandatoryDisposition',_0x411aa7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9a98('0x13')](0x3)[_0x9a98('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9a98('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9a98('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9a98('0x13')](0x3)[_0x9a98('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8123=['mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','random','rrmemory','wrandom','ringall','getDataValue','type','strategy','preview','booked','roundrobin','includes','INTEGER','yes','all','join','periodic_announce','split','setDataValue','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#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','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x2073d4,_0xb06852){var _0x41d787=function(_0x56447b){while(--_0x56447b){_0x2073d4['push'](_0x2073d4['shift']());}};_0x41d787(++_0xb06852);}(_0x8123,0x164));var _0x3812=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x8123[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0x3812('0x0'));module[_0x3812('0x1')]={'name':{'type':Sequelize[_0x3812('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x4'),_0x3812('0x5')),'allowNull':![],'defaultValue':_0x3812('0x4')},'musiconhold':{'type':Sequelize[_0x3812('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x3812('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x3812('0x3')]('rr','ringall','leastrecent','fewestcalls',_0x3812('0x6'),_0x3812('0x7'),'linear',_0x3812('0x8'),'rrordered'),'allowNull':![],'defaultValue':_0x3812('0x9'),'set':function(_0x203d9a){this['setDataValue']('strategy',_0x203d9a?_0x203d9a:_0x3812('0x7'));},'get':function(){var _0x5d88f1=this[_0x3812('0xa')](_0x3812('0xb'));var _0x1cc501=this[_0x3812('0xa')]('dialMethod');var _0x42841c=this['getDataValue'](_0x3812('0xc'));if(_0x5d88f1==='outbound'){if(_0x1cc501===_0x3812('0xd')){return null;}if(_0x1cc501===_0x3812('0xe')&&![_0x3812('0x7'),_0x3812('0xf')][_0x3812('0x10')](_0x42841c)){this['setDataValue']('strategy',_0x3812('0x7'));}}return _0x42841c;}},'servicelevel':{'type':Sequelize[_0x3812('0x11')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3812('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3812('0x11')](0xb)},'timeout':{'type':Sequelize[_0x3812('0x11')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3812('0x11')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x3812('0x11')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x12'),'no'),'defaultValue':_0x3812('0x12')},'autopause':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x12'),'no',_0x3812('0x13')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x3812('0x12'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x12'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3812('0x11')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x12'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x12'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x12'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3812('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3812('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3812('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3812('0x11')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3812('0x11')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x3812('0x12'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x3812('0x12'),'no'),'defaultValue':_0x3812('0x12')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x3812('0x12'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3812('0x3')]('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[_0x3812('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3812('0x2')]},'queue_youarenext':{'type':Sequelize[_0x3812('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3812('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3812('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3812('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3812('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3812('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3812('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x3812('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x3812('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x207c6e){this['setDataValue']('periodic_announce',_0x207c6e?_0x207c6e[_0x3812('0x14')](','):[]);},'get':function(){return this['getDataValue'](_0x3812('0x15'))?this[_0x3812('0xa')](_0x3812('0x15'))[_0x3812('0x16')](','):[];}},'joinempty':{'type':Sequelize[_0x3812('0x2')],'defaultValue':'yes','set':function(_0x2e12f2){this[_0x3812('0x17')](_0x3812('0x18'),_0x2e12f2?_0x2e12f2[_0x3812('0x14')](','):undefined);},'get':function(){return this[_0x3812('0xa')](_0x3812('0x18'))?this[_0x3812('0xa')]('joinempty')[_0x3812('0x16')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3812('0x2')],'defaultValue':'no','set':function(_0x1278eb){this[_0x3812('0x17')](_0x3812('0x19'),_0x1278eb?_0x1278eb['join'](','):undefined);},'get':function(){return this[_0x3812('0xa')](_0x3812('0x19'))?this[_0x3812('0xa')](_0x3812('0x19'))[_0x3812('0x16')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x12'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3812('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3812('0x11')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x12'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3812('0x2')]},'description':{'type':Sequelize[_0x3812('0x2')]},'acw':{'type':Sequelize[_0x3812('0x1a')],'defaultValue':0x0,'set':function(_0x1fbfc9){this['setDataValue'](_0x3812('0x1b'),_0x1fbfc9);if(_0x1fbfc9){if(this['getDataValue'](_0x3812('0x1c'))<0x2){this[_0x3812('0x17')](_0x3812('0x1c'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3812('0x1a')],'defaultValue':0x0,'comment':_0x3812('0x1d')},'dialMethod':{'type':Sequelize[_0x3812('0x3')]('preview',_0x3812('0x1e'),_0x3812('0x1f'),_0x3812('0x20'),_0x3812('0xe')),'defaultValue':_0x3812('0x1e'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x3812('0x11')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x3812('0x11')](0x4)[_0x3812('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3812('0x22')},'dialPowerLevel':{'type':Sequelize[_0x3812('0x23')](0x2)[_0x3812('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x3812('0x3')]('agentBusyFactor','dropRate'),'defaultValue':_0x3812('0x24'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x3812('0x23')](0x2)[_0x3812('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3812('0x25')},'dialPredictiveInterval':{'type':Sequelize[_0x3812('0x11')](0x3)[_0x3812('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x3812('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x3812('0x2')],'defaultValue':_0x3812('0x26'),'comment':_0x3812('0x27')},'dialQueueTimeout':{'type':Sequelize[_0x3812('0x11')](0x3)[_0x3812('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x3812('0x2')],'comment':_0x3812('0x28')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3812('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3812('0x11')](0x5)[_0x3812('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x3812('0x11')](0x3)[_0x3812('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3812('0x29')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3812('0x11')](0x5)[_0x3812('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3812('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x3812('0x2a')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3812('0x11')](0x5)[_0x3812('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3812('0x2b')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3812('0x11')](0x3)[_0x3812('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3812('0x2c')},'dialTimezone':{'type':Sequelize[_0x3812('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3812('0x2')],'defaultValue':_0x3812('0x2d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x3812('0x3')]('always',_0x3812('0x2e'),_0x3812('0x2f')),'defaultValue':_0x3812('0x30')},'dialAMDActive':{'type':Sequelize[_0x3812('0x1a')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x3812('0x11')](0x9)[_0x3812('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3812('0x11')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3812('0x31')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3812('0x11')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3812('0x32')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3812('0x11')](0x9)[_0x3812('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3812('0x33')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3812('0x11')](0x9)[_0x3812('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3812('0x34')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3812('0x11')](0x5)[_0x3812('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3812('0x11')](0x9)[_0x3812('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3812('0x35')},'dialRecallMeTimeout':{'type':Sequelize[_0x3812('0x11')](0x5)[_0x3812('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3812('0x36')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x3812('0x3')](_0x3812('0x37'),_0x3812('0x38')),'defaultValue':_0x3812('0x37')},'dialQueueProject2':{'type':Sequelize[_0x3812('0x2')],'comment':_0x3812('0x28')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3812('0x1a')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3812('0x1a')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3812('0x11')](0x3)[_0x3812('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3812('0x39')},'dialCutDigit':{'type':Sequelize[_0x3812('0x11')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3812('0x3a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3812('0x11')](0x3)[_0x3812('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3812('0x3b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3812('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3812('0x3c')},'dialDropMaxRetry':{'type':Sequelize[_0x3812('0x11')](0x3)[_0x3812('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3812('0x3d')},'dialDropRetryFrequency':{'type':Sequelize[_0x3812('0x11')](0x5)[_0x3812('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3812('0x3e')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3812('0x11')](0x5)[_0x3812('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3812('0x3f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3812('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3812('0x40')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3812('0x11')](0x5)[_0x3812('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3812('0x41')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3812('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3812('0x42')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3812('0x11')](0x5)[_0x3812('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3812('0x11')],'allowNull':!![],'comment':_0x3812('0x43')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3812('0x44'),'set':function(_0x57e983){if(!_0x57e983)this['setDataValue'](_0x3812('0x45'),null);this['setDataValue'](_0x3812('0x46'),_0x57e983);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3812('0x11')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3812('0x11')](0x3)[_0x3812('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3812('0x1a')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3812('0x11')](0x3)[_0x3812('0x21')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3812('0x1a')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 1b53816..281e144 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 _0x4c9d=['VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','create','role','UserProfileSection','userProfileId','getHoppers','CmHopper','pick','getHopperHistories','findOne','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','interface','flatMap','forEach','penalty','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','union','isEmpty','removeAgents','addAgents','spread','online','upsert','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','CmListId','ListId','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','select','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','deletedAt\x20IS\x20NULL','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','name','destroy','stack','index','VoiceQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0xd758b6,_0x225982){var _0x1dd8f3=function(_0x5b2999){while(--_0x5b2999){_0xd758b6['push'](_0xd758b6['shift']());}};_0x1dd8f3(++_0x225982);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c9d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd4c9('0x0'));var rimraf=require(_0xd4c9('0x1'));var zipdir=require(_0xd4c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4c9('0x3'));var moment=require(_0xd4c9('0x4'));var BPromise=require(_0xd4c9('0x5'));var Mustache=require(_0xd4c9('0x6'));var util=require(_0xd4c9('0x7'));var path=require(_0xd4c9('0x8'));var sox=require(_0xd4c9('0x9'));var csv=require(_0xd4c9('0xa'));var ejs=require(_0xd4c9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd4c9('0xc'));var crypto=require(_0xd4c9('0xd'));var jsforce=require(_0xd4c9('0xe'));var deskjs=require(_0xd4c9('0xf'));var toCsv=require(_0xd4c9('0xa'));var querystring=require('querystring');var Papa=require(_0xd4c9('0x10'));var Redis=require(_0xd4c9('0x11'));var authService=require(_0xd4c9('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4c9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd4c9('0x14'));var db=require(_0xd4c9('0x15'))['db'];config[_0xd4c9('0x16')]=_['defaults'](config[_0xd4c9('0x16')],{'host':_0xd4c9('0x17'),'port':0x18eb});var socket=require(_0xd4c9('0x18'))(new Redis(config[_0xd4c9('0x16')]));require(_0xd4c9('0x19'))[_0xd4c9('0x1a')](socket);function respondWithStatusCode(_0x2f5f5d,_0x3d268a){_0x3d268a=_0x3d268a||0xcc;return function(_0x1e8953){if(_0x1e8953){return _0x2f5f5d[_0xd4c9('0x1b')](_0x3d268a);}return _0x2f5f5d[_0xd4c9('0x1c')](_0x3d268a)['end']();};}function respondWithResult(_0xf0246a,_0x39e486){_0x39e486=_0x39e486||0xc8;return function(_0x5ef24e){if(_0x5ef24e){return _0xf0246a[_0xd4c9('0x1c')](_0x39e486)[_0xd4c9('0x1d')](_0x5ef24e);}};}function respondWithFilteredResult(_0x4806bd,_0x4057d0){return function(_0x42fd51){if(_0x42fd51){var _0x3ca10b=typeof _0x4057d0[_0xd4c9('0x1e')]===_0xd4c9('0x1f')&&typeof _0x4057d0[_0xd4c9('0x20')]===_0xd4c9('0x1f');var _0x209dc6=_0x42fd51[_0xd4c9('0x21')];var _0x2b1e15=_0x3ca10b?0x0:_0x4057d0[_0xd4c9('0x1e')];var _0x5b70d6=_0x3ca10b?_0x42fd51['count']:_0x4057d0['offset']+_0x4057d0[_0xd4c9('0x20')];var _0x3edfc7;if(_0x5b70d6>=_0x209dc6){_0x5b70d6=_0x209dc6;_0x3edfc7=0xc8;}else{_0x3edfc7=0xce;}_0x4806bd[_0xd4c9('0x1c')](_0x3edfc7);return _0x4806bd[_0xd4c9('0x22')](_0xd4c9('0x23'),_0x2b1e15+'-'+_0x5b70d6+'/'+_0x209dc6)[_0xd4c9('0x1d')](_0x42fd51);}return null;};}function patchUpdates(_0x4cf000){return function(_0x3b9542){try{jsonpatch[_0xd4c9('0x24')](_0x3b9542,_0x4cf000,!![]);}catch(_0x1aa321){return BPromise[_0xd4c9('0x25')](_0x1aa321);}return _0x3b9542[_0xd4c9('0x26')]();};}function saveUpdates(_0x3edab5,_0x5e89fc){return function(_0x572d99){if(_0x572d99){return _0x572d99[_0xd4c9('0x27')](_0x3edab5)[_0xd4c9('0x28')](function(_0x154fdc){return _0x154fdc;});}return null;};}function removeEntity(_0x80466b,_0x52f8e4){return function(_0x423de2){if(_0x423de2){return _0x423de2['destroy']()[_0xd4c9('0x28')](function(){var _0x2eedc9=_0x423de2[_0xd4c9('0x29')]({'plain':!![]});var _0x2ded54=[{'name':_0xd4c9('0x2a'),'value':_0xd4c9('0x2b'),'ignore':![]},{'name':_0xd4c9('0x2c'),'value':_0xd4c9('0x2d'),'ignore':![]}];var _0x222c78=_(_0x2ded54)['filter'](_0xd4c9('0x2e'))[_0xd4c9('0x2f')](_0xd4c9('0x30'))[_0xd4c9('0x30')]();if(_[_0xd4c9('0x31')](_0x222c78,_0x2eedc9['type'])){return;}var _0x38d22f=_['find'](_0x2ded54,[_0xd4c9('0x30'),_0x2eedc9['type']])[_0xd4c9('0x32')];return db['UserProfileResource'][_0xd4c9('0x33')]({'where':{'type':_0x38d22f,'resourceId':_0x2eedc9['id']}})[_0xd4c9('0x28')](function(){return _0x423de2;});})[_0xd4c9('0x28')](function(){_0x80466b[_0xd4c9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e2510,_0x349cc5){return function(_0x430322){if(!_0x430322){_0x2e2510[_0xd4c9('0x1b')](0x194);}return _0x430322;};}function handleError(_0x110c17,_0x2b7a10){_0x2b7a10=_0x2b7a10||0x1f4;return function(_0x51355c){logger['error'](_0x51355c[_0xd4c9('0x34')]);if(_0x51355c[_0xd4c9('0x32')]){delete _0x51355c[_0xd4c9('0x32')];}_0x110c17[_0xd4c9('0x1c')](_0x2b7a10)['send'](_0x51355c);};}exports[_0xd4c9('0x35')]=function(_0x141e6c,_0x8f4623){var _0x6fb1bc={},_0x372c34={},_0x426a34={'count':0x0,'rows':[]};var _0x3c13a6=_[_0xd4c9('0x2f')](db[_0xd4c9('0x36')][_0xd4c9('0x37')],function(_0x5e3d10){return{'name':_0x5e3d10[_0xd4c9('0x38')],'type':_0x5e3d10[_0xd4c9('0x39')][_0xd4c9('0x3a')]};});_0x372c34[_0xd4c9('0x3b')]=_[_0xd4c9('0x2f')](_0x3c13a6,'name');_0x372c34['query']=_[_0xd4c9('0x3c')](_0x141e6c[_0xd4c9('0x3d')]);_0x372c34[_0xd4c9('0x3e')]=_[_0xd4c9('0x3f')](_0x372c34[_0xd4c9('0x3b')],_0x372c34['query']);_0x6fb1bc[_0xd4c9('0x40')]=_['intersection'](_0x372c34['model'],qs[_0xd4c9('0x41')](_0x141e6c[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x6fb1bc['attributes']=_0x6fb1bc['attributes'][_0xd4c9('0x42')]?_0x6fb1bc[_0xd4c9('0x40')]:_0x372c34[_0xd4c9('0x3b')];if(!_0x141e6c['query'][_0xd4c9('0x43')](_0xd4c9('0x44'))){_0x6fb1bc[_0xd4c9('0x20')]=qs[_0xd4c9('0x20')](_0x141e6c['query'][_0xd4c9('0x20')]);_0x6fb1bc['offset']=qs[_0xd4c9('0x1e')](_0x141e6c[_0xd4c9('0x3d')][_0xd4c9('0x1e')]);}_0x6fb1bc[_0xd4c9('0x45')]=qs[_0xd4c9('0x46')](_0x141e6c[_0xd4c9('0x3d')]['sort']);_0x6fb1bc[_0xd4c9('0x47')]=qs[_0xd4c9('0x3e')](_['pick'](_0x141e6c['query'],_0x372c34[_0xd4c9('0x3e')]),_0x3c13a6);if(_0x141e6c[_0xd4c9('0x3d')][_0xd4c9('0x48')]){_0x6fb1bc[_0xd4c9('0x47')]=_[_0xd4c9('0x49')](_0x6fb1bc[_0xd4c9('0x47')],{'$or':_[_0xd4c9('0x2f')](_0x3c13a6,function(_0xb5f160){if(_0xb5f160[_0xd4c9('0x39')]!==_0xd4c9('0x4a')){var _0x6e4ad0={};_0x6e4ad0[_0xb5f160[_0xd4c9('0x32')]]={'$like':'%'+_0x141e6c[_0xd4c9('0x3d')]['filter']+'%'};return _0x6e4ad0;}})});}_0x6fb1bc=_[_0xd4c9('0x49')]({},_0x6fb1bc,_0x141e6c[_0xd4c9('0x4b')]);var _0x16846c={'where':_0x6fb1bc[_0xd4c9('0x47')]};return db['VoiceQueue'][_0xd4c9('0x21')](_0x16846c)['then'](function(_0x471352){_0x426a34[_0xd4c9('0x21')]=_0x471352;if(_0x141e6c[_0xd4c9('0x3d')]['includeAll']){_0x6fb1bc['include']=[{'all':!![]}];}return db['VoiceQueue'][_0xd4c9('0x4c')](_0x6fb1bc);})[_0xd4c9('0x28')](function(_0x32a717){_0x426a34[_0xd4c9('0x4d')]=_0x32a717;return _0x426a34;})['then'](respondWithFilteredResult(_0x8f4623,_0x6fb1bc))[_0xd4c9('0x4e')](handleError(_0x8f4623,null));};exports[_0xd4c9('0x4f')]=function(_0x430036,_0x4def78){var _0x4a7fd2={'raw':![],'where':{'id':_0x430036[_0xd4c9('0x50')]['id']}},_0x345602={};_0x345602['model']=_[_0xd4c9('0x3c')](db['VoiceQueue'][_0xd4c9('0x37')]);_0x345602[_0xd4c9('0x3d')]=_[_0xd4c9('0x3c')](_0x430036[_0xd4c9('0x3d')]);_0x345602['filters']=_[_0xd4c9('0x3f')](_0x345602[_0xd4c9('0x3b')],_0x345602[_0xd4c9('0x3d')]);_0x4a7fd2[_0xd4c9('0x40')]=_[_0xd4c9('0x3f')](_0x345602['model'],qs[_0xd4c9('0x41')](_0x430036[_0xd4c9('0x3d')]['fields']));_0x4a7fd2[_0xd4c9('0x40')]=_0x4a7fd2['attributes'][_0xd4c9('0x42')]?_0x4a7fd2[_0xd4c9('0x40')]:_0x345602[_0xd4c9('0x3b')];if(_0x430036[_0xd4c9('0x3d')][_0xd4c9('0x51')]){_0x4a7fd2[_0xd4c9('0x52')]=[{'all':!![]}];}_0x4a7fd2=_[_0xd4c9('0x49')]({},_0x4a7fd2,_0x430036[_0xd4c9('0x4b')]);return db[_0xd4c9('0x36')][_0xd4c9('0x53')](_0x4a7fd2)[_0xd4c9('0x28')](handleEntityNotFound(_0x4def78,null))[_0xd4c9('0x28')](respondWithResult(_0x4def78,null))[_0xd4c9('0x4e')](handleError(_0x4def78,null));};exports['create']=function(_0x37288f,_0x12b5b3){return db[_0xd4c9('0x36')]['create'](_0x37288f[_0xd4c9('0x54')],{})[_0xd4c9('0x28')](function(_0x417d86){var _0x34f0ea=_0x37288f[_0xd4c9('0x55')][_0xd4c9('0x29')]({'plain':!![]});if(!_0x34f0ea)throw new Error(_0xd4c9('0x56'));if(_0x34f0ea['role']===_0xd4c9('0x55')){var _0x3404a8=_0x417d86[_0xd4c9('0x29')]({'plain':!![]});var _0xb3fd88=[{'name':_0xd4c9('0x2a'),'value':'inbound'},{'name':_0xd4c9('0x2c'),'value':_0xd4c9('0x2d')}];var _0x59bb1b=_[_0xd4c9('0x53')](_0xb3fd88,[_0xd4c9('0x30'),_0x3404a8[_0xd4c9('0x39')]])['name'];return db['UserProfileSection'][_0xd4c9('0x53')]({'where':{'name':_0x59bb1b,'userProfileId':_0x34f0ea['userProfileId']},'raw':!![]})[_0xd4c9('0x28')](function(_0x193644){if(_0x193644&&_0x193644[_0xd4c9('0x57')]===0x0){return db[_0xd4c9('0x58')]['create']({'name':_0x3404a8[_0xd4c9('0x32')],'resourceId':_0x3404a8['id'],'type':_0x193644[_0xd4c9('0x32')],'sectionId':_0x193644['id']},{})[_0xd4c9('0x28')](function(){return _0x417d86;});}else{return _0x417d86;}})[_0xd4c9('0x4e')](function(_0x76ed18){logger[_0xd4c9('0x59')](_0xd4c9('0x5a'),_0x76ed18);throw _0x76ed18;});}return _0x417d86;})[_0xd4c9('0x28')](respondWithResult(_0x12b5b3,0xc9))['catch'](handleError(_0x12b5b3,null));};exports[_0xd4c9('0x5b')]=function(_0x42dd26,_0x8791ac){var _0x1b365a={'where':{'id':_0x42dd26[_0xd4c9('0x50')]['id']}},_0x3bffe5={};_0x3bffe5[_0xd4c9('0x3b')]=_[_0xd4c9('0x3c')](db[_0xd4c9('0x36')][_0xd4c9('0x37')]);_0x1b365a['attributes']=_[_0xd4c9('0x3f')](_0x3bffe5[_0xd4c9('0x3b')],qs[_0xd4c9('0x41')](_0x42dd26[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x1b365a[_0xd4c9('0x40')]=_0x1b365a[_0xd4c9('0x40')]['length']?_0x1b365a[_0xd4c9('0x40')]:_0x3bffe5['model'];if(_0x42dd26[_0xd4c9('0x3d')]['includeAll']){_0x1b365a[_0xd4c9('0x52')]=[{'all':!![]}];}_0x1b365a=_[_0xd4c9('0x49')]({},_0x1b365a,_0x42dd26[_0xd4c9('0x4b')]);return db['VoiceQueue']['find'](_0x1b365a)[_0xd4c9('0x28')](handleEntityNotFound(_0x8791ac,null))[_0xd4c9('0x28')](function(_0x4d9478){if(_0x4d9478){var _0x4c81f6=_0x4d9478['get']({'plain':!![]});_0x4c81f6=qs[_0xd4c9('0x5c')](_0x4c81f6,['id',_0xd4c9('0x5d'),_0xd4c9('0x5e')]);_0x42dd26[_0xd4c9('0x54')]=_['omit'](_0x42dd26['body'],['id',_0xd4c9('0x5d'),_0xd4c9('0x5e')]);return db[_0xd4c9('0x36')][_0xd4c9('0x5f')](_[_0xd4c9('0x49')](_0x4c81f6,_0x42dd26[_0xd4c9('0x54')]),{'include':_0x42dd26[_0xd4c9('0x3d')][_0xd4c9('0x51')]?[{'all':!![]}]:undefined})[_0xd4c9('0x28')](function(_0x26dc49){var _0xd1a042=_0x42dd26[_0xd4c9('0x55')][_0xd4c9('0x29')]({'plain':!![]});if(!_0xd1a042)throw new Error(_0xd4c9('0x56'));if(_0xd1a042[_0xd4c9('0x60')]===_0xd4c9('0x55')){var _0x572e5e=_0x26dc49[_0xd4c9('0x29')]({'plain':!![]});var _0x34a68c=[{'name':'VoiceQueues','value':'inbound'},{'name':_0xd4c9('0x2c'),'value':_0xd4c9('0x2d')}];var _0x24efee=_[_0xd4c9('0x53')](_0x34a68c,[_0xd4c9('0x30'),_0x572e5e['type']])[_0xd4c9('0x32')];return db[_0xd4c9('0x61')]['find']({'where':{'name':_0x24efee,'userProfileId':_0xd1a042[_0xd4c9('0x62')]},'raw':!![]})['then'](function(_0x16859c){if(_0x16859c&&_0x16859c[_0xd4c9('0x57')]===0x0){return db[_0xd4c9('0x58')][_0xd4c9('0x5f')]({'name':_0x572e5e[_0xd4c9('0x32')],'resourceId':_0x572e5e['id'],'type':_0x16859c[_0xd4c9('0x32')],'sectionId':_0x16859c['id']},{})[_0xd4c9('0x28')](function(){return _0x26dc49;});}else{return _0x26dc49;}})[_0xd4c9('0x4e')](function(_0x527c1b){logger[_0xd4c9('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x527c1b);throw _0x527c1b;});}return _0x26dc49;});}})[_0xd4c9('0x28')](respondWithResult(_0x8791ac,0xc9))[_0xd4c9('0x4e')](handleError(_0x8791ac,null));};exports['update']=function(_0x516085,_0x320206){if(_0x516085[_0xd4c9('0x54')]['id']){delete _0x516085[_0xd4c9('0x54')]['id'];}return db[_0xd4c9('0x36')][_0xd4c9('0x53')]({'where':{'id':_0x516085[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x320206,null))[_0xd4c9('0x28')](saveUpdates(_0x516085['body'],null))[_0xd4c9('0x28')](respondWithResult(_0x320206,null))['catch'](handleError(_0x320206,null));};exports['destroy']=function(_0x99f8a6,_0xeb0131){return db['VoiceQueue'][_0xd4c9('0x53')]({'where':{'id':_0x99f8a6[_0xd4c9('0x50')]['id']}})['then'](handleEntityNotFound(_0xeb0131,null))[_0xd4c9('0x28')](removeEntity(_0xeb0131,null))['catch'](handleError(_0xeb0131,null));};exports[_0xd4c9('0x63')]=function(_0x184828,_0x380fe7,_0x542e8f){var _0x3a3ad5={'raw':![],'where':{}};var _0x58396b={};var _0x44ddf7={'count':0x0,'rows':[]};return db[_0xd4c9('0x36')]['findOne']({'where':{'id':_0x184828[_0xd4c9('0x50')]['id']}})['then'](handleEntityNotFound(_0x380fe7,null))['then'](function(_0x7d26ca){if(_0x7d26ca){_0x58396b['model']=_[_0xd4c9('0x3c')](db[_0xd4c9('0x64')][_0xd4c9('0x37')]);_0x58396b[_0xd4c9('0x3d')]=_[_0xd4c9('0x3c')](_0x184828[_0xd4c9('0x3d')]);_0x58396b[_0xd4c9('0x3e')]=_[_0xd4c9('0x3f')](_0x58396b[_0xd4c9('0x3b')],_0x58396b[_0xd4c9('0x3d')]);_0x3a3ad5['attributes']=_[_0xd4c9('0x3f')](_0x58396b[_0xd4c9('0x3b')],qs['fields'](_0x184828[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x3a3ad5[_0xd4c9('0x40')]=_0x3a3ad5['attributes'][_0xd4c9('0x42')]?_0x3a3ad5[_0xd4c9('0x40')]:_0x58396b['model'];if(!_0x184828[_0xd4c9('0x3d')][_0xd4c9('0x43')](_0xd4c9('0x44'))){_0x3a3ad5['limit']=qs[_0xd4c9('0x20')](_0x184828[_0xd4c9('0x3d')][_0xd4c9('0x20')]);_0x3a3ad5['offset']=qs[_0xd4c9('0x1e')](_0x184828[_0xd4c9('0x3d')][_0xd4c9('0x1e')]);}_0x3a3ad5[_0xd4c9('0x45')]=qs[_0xd4c9('0x46')](_0x184828[_0xd4c9('0x3d')][_0xd4c9('0x46')]);_0x3a3ad5[_0xd4c9('0x47')]=qs[_0xd4c9('0x3e')](_[_0xd4c9('0x65')](_0x184828[_0xd4c9('0x3d')],_0x58396b['filters']));_0x3a3ad5[_0xd4c9('0x47')]['VoiceQueueId']=_0x7d26ca['id'];if(_0x184828[_0xd4c9('0x3d')]['filter']){_0x3a3ad5[_0xd4c9('0x47')]=_['merge'](_0x3a3ad5[_0xd4c9('0x47')],{'$or':_[_0xd4c9('0x2f')](_0x3a3ad5[_0xd4c9('0x40')],function(_0xfec80a){var _0x22b311={};_0x22b311[_0xfec80a]={'$like':'%'+_0x184828[_0xd4c9('0x3d')][_0xd4c9('0x48')]+'%'};return _0x22b311;})});}_0x3a3ad5=_[_0xd4c9('0x49')]({},_0x3a3ad5,_0x184828['options']);return db[_0xd4c9('0x64')][_0xd4c9('0x21')]({'where':_0x3a3ad5['where']})[_0xd4c9('0x28')](function(_0x3b6f8b){_0x44ddf7[_0xd4c9('0x21')]=_0x3b6f8b;if(_0x184828[_0xd4c9('0x3d')][_0xd4c9('0x51')]){_0x3a3ad5['include']=[{'all':!![]}];}return db[_0xd4c9('0x64')][_0xd4c9('0x4c')](_0x3a3ad5);})[_0xd4c9('0x28')](function(_0x48b82a){_0x44ddf7[_0xd4c9('0x4d')]=_0x48b82a;return _0x44ddf7;});}})[_0xd4c9('0x28')](respondWithFilteredResult(_0x380fe7,_0x3a3ad5))[_0xd4c9('0x4e')](handleError(_0x380fe7,null));};exports[_0xd4c9('0x66')]=function(_0x4e66ff,_0x5386ad,_0x27dbc5){var _0x3ca82d={'raw':!![],'where':{}};var _0x2d612b={};var _0x468694={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd4c9('0x67')]({'where':{'id':_0x4e66ff[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x5386ad,null))[_0xd4c9('0x28')](function(_0x591f14){if(_0x591f14){_0x2d612b[_0xd4c9('0x3b')]=_[_0xd4c9('0x3c')](db['CmHopperHistory'][_0xd4c9('0x37')]);_0x2d612b[_0xd4c9('0x3d')]=_['keys'](_0x4e66ff['query']);_0x2d612b['filters']=_[_0xd4c9('0x3f')](_0x2d612b[_0xd4c9('0x3b')],_0x2d612b[_0xd4c9('0x3d')]);_0x3ca82d[_0xd4c9('0x40')]=_['intersection'](_0x2d612b[_0xd4c9('0x3b')],qs[_0xd4c9('0x41')](_0x4e66ff[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x3ca82d[_0xd4c9('0x40')]=_0x3ca82d[_0xd4c9('0x40')]['length']?_0x3ca82d[_0xd4c9('0x40')]:_0x2d612b[_0xd4c9('0x3b')];if(!_0x4e66ff[_0xd4c9('0x3d')]['hasOwnProperty'](_0xd4c9('0x44'))){_0x3ca82d[_0xd4c9('0x20')]=qs[_0xd4c9('0x20')](_0x4e66ff[_0xd4c9('0x3d')][_0xd4c9('0x20')]);_0x3ca82d['offset']=qs[_0xd4c9('0x1e')](_0x4e66ff[_0xd4c9('0x3d')][_0xd4c9('0x1e')]);}_0x3ca82d['order']=qs[_0xd4c9('0x46')](_0x4e66ff[_0xd4c9('0x3d')][_0xd4c9('0x46')]);_0x3ca82d[_0xd4c9('0x47')]=qs['filters'](_[_0xd4c9('0x65')](_0x4e66ff[_0xd4c9('0x3d')],_0x2d612b['filters']));_0x3ca82d[_0xd4c9('0x47')][_0xd4c9('0x68')]=_0x591f14['id'];if(_0x4e66ff[_0xd4c9('0x3d')][_0xd4c9('0x48')]){_0x3ca82d[_0xd4c9('0x47')]=_['merge'](_0x3ca82d[_0xd4c9('0x47')],{'$or':_[_0xd4c9('0x2f')](_0x3ca82d['attributes'],function(_0x2d5987){var _0x3beb8a={};_0x3beb8a[_0x2d5987]={'$like':'%'+_0x4e66ff['query']['filter']+'%'};return _0x3beb8a;})});}_0x3ca82d=_['merge']({},_0x3ca82d,_0x4e66ff[_0xd4c9('0x4b')]);return db['CmHopperHistory'][_0xd4c9('0x21')]({'where':_0x3ca82d[_0xd4c9('0x47')]})[_0xd4c9('0x28')](function(_0x1ab8b5){_0x468694[_0xd4c9('0x21')]=_0x1ab8b5;if(_0x4e66ff['query'][_0xd4c9('0x51')]){_0x3ca82d[_0xd4c9('0x52')]=[{'all':!![]}];}return db[_0xd4c9('0x69')]['findAll'](_0x3ca82d);})[_0xd4c9('0x28')](function(_0x1e7e23){_0x468694[_0xd4c9('0x4d')]=_0x1e7e23;return _0x468694;});}})[_0xd4c9('0x28')](respondWithFilteredResult(_0x5386ad,_0x3ca82d))['catch'](handleError(_0x5386ad,null));};exports[_0xd4c9('0x6a')]=function(_0x1eb9f9,_0x3aec29,_0x28fb96){var _0x5b2419={'raw':!![],'where':{}};var _0xaba5b5={};var _0x113bf7={'count':0x0,'rows':[]};return db[_0xd4c9('0x36')][_0xd4c9('0x67')]({'where':{'id':_0x1eb9f9['params']['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x3aec29,null))[_0xd4c9('0x28')](function(_0x5d5f75){if(_0x5d5f75){_0xaba5b5[_0xd4c9('0x3b')]=_[_0xd4c9('0x3c')](db[_0xd4c9('0x6b')][_0xd4c9('0x37')]);_0xaba5b5[_0xd4c9('0x3d')]=_['keys'](_0x1eb9f9[_0xd4c9('0x3d')]);_0xaba5b5['filters']=_['intersection'](_0xaba5b5[_0xd4c9('0x3b')],_0xaba5b5[_0xd4c9('0x3d')]);_0x5b2419[_0xd4c9('0x40')]=_[_0xd4c9('0x3f')](_0xaba5b5['model'],qs[_0xd4c9('0x41')](_0x1eb9f9[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x5b2419['attributes']=_0x5b2419[_0xd4c9('0x40')][_0xd4c9('0x42')]?_0x5b2419[_0xd4c9('0x40')]:_0xaba5b5[_0xd4c9('0x3b')];if(!_0x1eb9f9[_0xd4c9('0x3d')][_0xd4c9('0x43')](_0xd4c9('0x44'))){_0x5b2419[_0xd4c9('0x20')]=qs[_0xd4c9('0x20')](_0x1eb9f9[_0xd4c9('0x3d')]['limit']);_0x5b2419[_0xd4c9('0x1e')]=qs[_0xd4c9('0x1e')](_0x1eb9f9['query'][_0xd4c9('0x1e')]);}_0x5b2419[_0xd4c9('0x45')]=qs[_0xd4c9('0x46')](_0x1eb9f9['query'][_0xd4c9('0x46')]);_0x5b2419[_0xd4c9('0x47')]=qs[_0xd4c9('0x3e')](_[_0xd4c9('0x65')](_0x1eb9f9[_0xd4c9('0x3d')],_0xaba5b5[_0xd4c9('0x3e')]));_0x5b2419[_0xd4c9('0x47')]['VoiceQueueId']=_0x5d5f75['id'];if(_0x1eb9f9[_0xd4c9('0x3d')][_0xd4c9('0x48')]){_0x5b2419['where']=_['merge'](_0x5b2419[_0xd4c9('0x47')],{'$or':_[_0xd4c9('0x2f')](_0x5b2419['attributes'],function(_0x2de98d){var _0x36f43d={};_0x36f43d[_0x2de98d]={'$like':'%'+_0x1eb9f9[_0xd4c9('0x3d')]['filter']+'%'};return _0x36f43d;})});}_0x5b2419=_[_0xd4c9('0x49')]({},_0x5b2419,_0x1eb9f9[_0xd4c9('0x4b')]);return db[_0xd4c9('0x6b')]['count']({'where':_0x5b2419[_0xd4c9('0x47')]})[_0xd4c9('0x28')](function(_0x37316a){_0x113bf7['count']=_0x37316a;if(_0x1eb9f9[_0xd4c9('0x3d')][_0xd4c9('0x51')]){_0x5b2419[_0xd4c9('0x52')]=[{'all':!![]}];}return db[_0xd4c9('0x6b')]['findAll'](_0x5b2419);})[_0xd4c9('0x28')](function(_0x28dd99){_0x113bf7[_0xd4c9('0x4d')]=_0x28dd99;return _0x113bf7;});}})[_0xd4c9('0x28')](respondWithFilteredResult(_0x3aec29,_0x5b2419))[_0xd4c9('0x4e')](handleError(_0x3aec29,null));};exports[_0xd4c9('0x6c')]=function(_0xbcd485,_0x3b8795,_0x978ad4){var _0x56aa98={'raw':!![],'where':{}};var _0x18a5f6={};var _0x505600={'count':0x0,'rows':[]};return db[_0xd4c9('0x36')][_0xd4c9('0x67')]({'where':{'id':_0xbcd485[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x3b8795,null))['then'](function(_0x51805a){if(_0x51805a){_0x18a5f6['model']=_['keys'](db[_0xd4c9('0x6d')][_0xd4c9('0x37')]);_0x18a5f6[_0xd4c9('0x3d')]=_['keys'](_0xbcd485[_0xd4c9('0x3d')]);_0x18a5f6[_0xd4c9('0x3e')]=_[_0xd4c9('0x3f')](_0x18a5f6[_0xd4c9('0x3b')],_0x18a5f6[_0xd4c9('0x3d')]);_0x56aa98[_0xd4c9('0x40')]=_[_0xd4c9('0x3f')](_0x18a5f6[_0xd4c9('0x3b')],qs[_0xd4c9('0x41')](_0xbcd485[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x56aa98[_0xd4c9('0x40')]=_0x56aa98['attributes'][_0xd4c9('0x42')]?_0x56aa98[_0xd4c9('0x40')]:_0x18a5f6[_0xd4c9('0x3b')];if(!_0xbcd485[_0xd4c9('0x3d')][_0xd4c9('0x43')](_0xd4c9('0x44'))){_0x56aa98['limit']=qs[_0xd4c9('0x20')](_0xbcd485['query']['limit']);_0x56aa98['offset']=qs[_0xd4c9('0x1e')](_0xbcd485[_0xd4c9('0x3d')][_0xd4c9('0x1e')]);}_0x56aa98['order']=qs[_0xd4c9('0x46')](_0xbcd485['query'][_0xd4c9('0x46')]);_0x56aa98['where']=qs[_0xd4c9('0x3e')](_['pick'](_0xbcd485['query'],_0x18a5f6[_0xd4c9('0x3e')]));_0x56aa98[_0xd4c9('0x47')][_0xd4c9('0x68')]=_0x51805a['id'];if(_0xbcd485[_0xd4c9('0x3d')][_0xd4c9('0x48')]){_0x56aa98[_0xd4c9('0x47')]=_['merge'](_0x56aa98[_0xd4c9('0x47')],{'$or':_[_0xd4c9('0x2f')](_0x56aa98['attributes'],function(_0x382b89){var _0x5044cf={};_0x5044cf[_0x382b89]={'$like':'%'+_0xbcd485[_0xd4c9('0x3d')][_0xd4c9('0x48')]+'%'};return _0x5044cf;})});}_0x56aa98=_['merge']({},_0x56aa98,_0xbcd485[_0xd4c9('0x4b')]);return db[_0xd4c9('0x6d')][_0xd4c9('0x21')]({'where':_0x56aa98['where']})[_0xd4c9('0x28')](function(_0x46236f){_0x505600['count']=_0x46236f;if(_0xbcd485[_0xd4c9('0x3d')]['includeAll']){_0x56aa98[_0xd4c9('0x52')]=[{'all':!![]}];}return db[_0xd4c9('0x6d')]['findAll'](_0x56aa98);})[_0xd4c9('0x28')](function(_0xeef927){_0x505600[_0xd4c9('0x4d')]=_0xeef927;return _0x505600;});}})['then'](respondWithFilteredResult(_0x3b8795,_0x56aa98))[_0xd4c9('0x4e')](handleError(_0x3b8795,null));};exports[_0xd4c9('0x6e')]=function(_0x18665b,_0x42e2d7,_0xfc1caa){var _0x491c73={};var _0x29363d={};var _0x3a8cf9;var _0x395738;return db[_0xd4c9('0x36')][_0xd4c9('0x67')]({'where':{'id':_0x18665b[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x42e2d7,null))[_0xd4c9('0x28')](function(_0x15b34f){if(_0x15b34f){_0x3a8cf9=_0x15b34f;_0x29363d[_0xd4c9('0x3b')]=_[_0xd4c9('0x3c')](db[_0xd4c9('0x6f')][_0xd4c9('0x37')]);_0x29363d['query']=_[_0xd4c9('0x3c')](_0x18665b['query']);_0x29363d['filters']=_[_0xd4c9('0x3f')](_0x29363d['model'],_0x29363d['query']);_0x491c73[_0xd4c9('0x40')]=_[_0xd4c9('0x3f')](_0x29363d['model'],qs[_0xd4c9('0x41')](_0x18665b[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x491c73[_0xd4c9('0x40')]=_0x491c73[_0xd4c9('0x40')]['length']?_0x491c73['attributes']:_0x29363d[_0xd4c9('0x3b')];_0x491c73[_0xd4c9('0x45')]=qs[_0xd4c9('0x46')](_0x18665b[_0xd4c9('0x3d')]['sort']);_0x491c73[_0xd4c9('0x47')]=qs['filters'](_[_0xd4c9('0x65')](_0x18665b[_0xd4c9('0x3d')],_0x29363d[_0xd4c9('0x3e')]));if(_0x18665b[_0xd4c9('0x3d')][_0xd4c9('0x48')]){_0x491c73[_0xd4c9('0x47')]=_[_0xd4c9('0x49')](_0x491c73[_0xd4c9('0x47')],{'$or':_[_0xd4c9('0x2f')](_0x491c73[_0xd4c9('0x40')],function(_0x1d7fa9){var _0x521d56={};_0x521d56[_0x1d7fa9]={'$like':'%'+_0x18665b[_0xd4c9('0x3d')][_0xd4c9('0x48')]+'%'};return _0x521d56;})});}_0x491c73=_[_0xd4c9('0x49')]({},_0x491c73,_0x18665b['options']);return _0x3a8cf9['getTeams'](_0x491c73);}})['then'](function(_0x5961f7){if(_0x5961f7){_0x395738=_0x5961f7[_0xd4c9('0x42')];if(!_0x18665b[_0xd4c9('0x3d')][_0xd4c9('0x43')](_0xd4c9('0x44'))){_0x491c73[_0xd4c9('0x20')]=qs[_0xd4c9('0x20')](_0x18665b['query'][_0xd4c9('0x20')]);_0x491c73['offset']=qs[_0xd4c9('0x1e')](_0x18665b[_0xd4c9('0x3d')]['offset']);}return _0x3a8cf9['getTeams'](_0x491c73);}})[_0xd4c9('0x28')](function(_0x3f4828){if(_0x3f4828){return _0x3f4828?{'count':_0x395738,'rows':_0x3f4828}:null;}})[_0xd4c9('0x28')](respondWithResult(_0x42e2d7,null))[_0xd4c9('0x4e')](handleError(_0x42e2d7,null));};exports[_0xd4c9('0x70')]=function(_0x2cb5d9,_0x16f26e,_0x83fbd0){var _0x5dc572=_0x2cb5d9[_0xd4c9('0x54')][_0xd4c9('0x71')];var _0x13e290=_['map'](_0x5dc572,'id');return db[_0xd4c9('0x6f')]['findAll']({'where':{'id':_0x13e290},'attributes':['id'],'include':[{'model':db[_0xd4c9('0x72')],'as':_0xd4c9('0x73'),'attributes':['id',_0xd4c9('0x32'),'online',_0xd4c9('0x74'),_0xd4c9('0x75')],'raw':!![]}]})[_0xd4c9('0x28')](function(_0x12f2d5){if(_0x12f2d5){var _0x90cd55=_[_0xd4c9('0x76')](_0x12f2d5,function(_0x12f31e){var _0x3e1ca0=_0x12f31e['get']({'plain':!![]});_0x3e1ca0[_0xd4c9('0x73')][_0xd4c9('0x77')](function(_0x3d26fb){_0x3d26fb[_0xd4c9('0x78')]=_[_0xd4c9('0x53')](_0x5dc572,{'id':_0x3e1ca0['id']})[_0xd4c9('0x78')];});return _0x3e1ca0['Agents'];});return db[_0xd4c9('0x36')]['find']({'where':{'id':_0x2cb5d9[_0xd4c9('0x50')]['id']}})['then'](function(_0x1dc7fe){return db['sequelize']['transaction'](function(_0x52f30c){return _0x1dc7fe[_0xd4c9('0x70')](_0x13e290,{'transaction':_0x52f30c})[_0xd4c9('0x28')](function(){return BPromise[_0xd4c9('0x79')](_0x5dc572,function(_0x35e5b7){return db[_0xd4c9('0x7a')]['upsert']({'TeamId':_0x35e5b7['id'],'VoiceQueueId':_0x2cb5d9['params']['id'],'penalty':_0x35e5b7['penalty']},{'transaction':_0x52f30c});});})['then'](function(){return BPromise[_0xd4c9('0x79')](_0x90cd55,function(_0x4f62ca){return db[_0xd4c9('0x7b')][_0xd4c9('0x7c')]({'where':{'UserId':_0x4f62ca['id'],'VoiceQueueId':_0x2cb5d9[_0xd4c9('0x50')]['id']},'defaults':{'penalty':_0x4f62ca['penalty']},'transaction':_0x52f30c});});})[_0xd4c9('0x28')](function(){return BPromise[_0xd4c9('0x79')](_[_0xd4c9('0x48')](_0x90cd55,{'online':!![]}),function(_0x40814c){return db[_0xd4c9('0x7d')]['upsert']({'membername':_0x40814c[_0xd4c9('0x32')],'UserId':_0x40814c['id'],'queue_name':_0x1dc7fe[_0xd4c9('0x32')],'VoiceQueueId':_0x1dc7fe['id'],'interface':_[_0xd4c9('0x7e')](_0x40814c[_0xd4c9('0x75')])?util[_0xd4c9('0x7f')](_0xd4c9('0x80'),_0x40814c[_0xd4c9('0x32')]):_0x40814c[_0xd4c9('0x75')],'paused':_0x40814c[_0xd4c9('0x74')]||![],'penalty':_0x40814c[_0xd4c9('0x78')]},{'transaction':_0x52f30c});});})[_0xd4c9('0x28')](function(){_0x90cd55[_0xd4c9('0x77')](function(_0x46975e){socket[_0xd4c9('0x81')](_0xd4c9('0x82'),{'UserId':_0x46975e['id'],'VoiceQueueId':_0x1dc7fe['id']});});});});});}})[_0xd4c9('0x28')](respondWithStatusCode(_0x16f26e,null))[_0xd4c9('0x4e')](handleError(_0x16f26e,null));};exports[_0xd4c9('0x83')]=function(_0x474468,_0x4ba87b,_0x4b8fa0){return db['Team'][_0xd4c9('0x4c')]({'where':{'id':_0x474468[_0xd4c9('0x3d')][_0xd4c9('0x84')]},'attributes':['id'],'include':[{'model':db[_0xd4c9('0x72')],'as':_0xd4c9('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4ba87b,null))['then'](function(_0x823583){var _0x385786=_[_0xd4c9('0x2f')](_0x823583,'id');var _0x4ddbcb=[];var _0x1862c1=[];var _0xb2d0e9=squel['select']();_0xb2d0e9[_0xd4c9('0x85')](_0xd4c9('0x86'))['from'](_0xd4c9('0x87'),'tq')[_0xd4c9('0x88')](_0xd4c9('0x89'),'ut',_0xd4c9('0x8a'))[_0xd4c9('0x47')](_0xd4c9('0x8b'),_0x474468[_0xd4c9('0x50')]['id']);for(var _0x5ac5a2=0x0;_0x5ac5a2<_0x823583[_0xd4c9('0x42')];_0x5ac5a2+=0x1){let _0x3e134d=_0x823583[_0x5ac5a2];for(var _0x510e0c=0x0;_0x510e0c<_0x3e134d['Agents'][_0xd4c9('0x42')];_0x510e0c+=0x1){let _0x10405b=_0x3e134d[_0xd4c9('0x73')][_0x510e0c];var _0x1d0c34=_0xb2d0e9[_0xd4c9('0x5b')]();_0x1d0c34[_0xd4c9('0x47')](_0xd4c9('0x8c'),_0x10405b['id']);_0x1862c1[_0xd4c9('0x8d')](db[_0xd4c9('0x8e')][_0xd4c9('0x3d')](_0x1d0c34[_0xd4c9('0x8f')](),{'type':db[_0xd4c9('0x8e')]['QueryTypes'][_0xd4c9('0x90')]})[_0xd4c9('0x28')](function(_0x6b0b51){if(_0x6b0b51[_0xd4c9('0x42')]===0x1){return _0x10405b['id'];}else{var _0x3cfa2c=_[_0xd4c9('0x91')](_[_0xd4c9('0x2f')](_0x6b0b51,_0xd4c9('0x92')),function(_0x282c91){return _[_0xd4c9('0x31')](_0x385786,_0x282c91);});if(_0x3cfa2c){return _0x10405b['id'];}}}));}}return BPromise['all'](_0x1862c1)['then'](function(_0x5a4613){_0x4ddbcb=_(_0x4ddbcb)[_0xd4c9('0x93')](_0x5a4613)['compact']()[_0xd4c9('0x30')]();return db[_0xd4c9('0x36')][_0xd4c9('0x53')]({'where':{'id':_0x474468[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](function(_0x56a551){return db[_0xd4c9('0x8e')]['transaction'](function(_0x5778f3){return _0x56a551[_0xd4c9('0x83')](_0x474468[_0xd4c9('0x3d')][_0xd4c9('0x84')],{'transaction':_0x5778f3})[_0xd4c9('0x28')](function(){if(!_[_0xd4c9('0x94')](_0x4ddbcb)){return _0x56a551[_0xd4c9('0x95')](_0x4ddbcb,{'transaction':_0x5778f3})[_0xd4c9('0x28')](function(){return db['UserVoiceQueueRt'][_0xd4c9('0x33')]({'where':{'VoiceQueueId':_0x474468[_0xd4c9('0x50')]['id'],'UserId':_0x4ddbcb},'transaction':_0x5778f3});});}})[_0xd4c9('0x28')](function(){_0x4ddbcb[_0xd4c9('0x77')](function(_0x57f86c){socket[_0xd4c9('0x81')]('userVoiceQueue:remove',{'UserId':_0x57f86c,'VoiceQueueId':_0x56a551['id']});});});});});});})[_0xd4c9('0x28')](respondWithStatusCode(_0x4ba87b,null))[_0xd4c9('0x4e')](handleError(_0x4ba87b,null));};exports[_0xd4c9('0x96')]=function(_0x46e215,_0x1abb27,_0x2e1d9b){var _0x27c08d,_0x523358;return db['VoiceQueue']['find']({'where':{'id':_0x46e215[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x1abb27,null))[_0xd4c9('0x28')](function(_0x3df9f5){if(_0x3df9f5){_0x523358=_0x3df9f5;return _0x3df9f5[_0xd4c9('0x96')](_0x46e215[_0xd4c9('0x54')][_0xd4c9('0x84')],_['omit'](_0x46e215['body'],[_0xd4c9('0x84'),'id'])||{})[_0xd4c9('0x97')](function(_0x267e73){for(var _0x58df28=0x0;_0x58df28<_0x46e215['body'][_0xd4c9('0x84')]['length'];_0x58df28+=0x1){socket[_0xd4c9('0x81')](_0xd4c9('0x82'),{'UserId':Number(_0x46e215[_0xd4c9('0x54')][_0xd4c9('0x84')][_0x58df28]),'VoiceQueueId':Number(_0x46e215[_0xd4c9('0x50')]['id'])});}return _0x267e73;});}})[_0xd4c9('0x28')](function(_0x22e24f){_0x27c08d=_0x22e24f||[];if(_0x523358){return db[_0xd4c9('0x72')][_0xd4c9('0x4c')]({'where':{'id':_0x46e215[_0xd4c9('0x54')]['ids']},'attributes':['id','name','online','voicePause',_0xd4c9('0x75')],'raw':!![]});}})[_0xd4c9('0x28')](function(_0x34144d){if(!_[_0xd4c9('0x94')](_0x34144d)){var _0x1da725=[];for(var _0x3b5300=0x0;_0x3b5300<_0x34144d[_0xd4c9('0x42')];_0x3b5300++){if(_0x34144d[_0x3b5300][_0xd4c9('0x98')]){_0x1da725[_0xd4c9('0x8d')](db[_0xd4c9('0x7d')][_0xd4c9('0x99')]({'membername':_0x34144d[_0x3b5300][_0xd4c9('0x32')],'UserId':_0x34144d[_0x3b5300]['id'],'queue_name':_0x523358[_0xd4c9('0x32')],'VoiceQueueId':_0x523358['id'],'interface':_[_0xd4c9('0x7e')](_0x34144d[_0x3b5300][_0xd4c9('0x75')])?util['format'](_0xd4c9('0x80'),_0x34144d[_0x3b5300][_0xd4c9('0x32')]):_0x34144d[_0x3b5300][_0xd4c9('0x75')],'paused':_0x34144d[_0x3b5300][_0xd4c9('0x74')]||![],'penalty':_0x46e215[_0xd4c9('0x54')][_0xd4c9('0x78')]||0x0}));}}return BPromise[_0xd4c9('0x9a')](_0x1da725);}})[_0xd4c9('0x28')](function(){return _0x27c08d;})[_0xd4c9('0x28')](respondWithResult(_0x1abb27,null))['catch'](handleError(_0x1abb27,null));};exports[_0xd4c9('0x95')]=function(_0x588ee5,_0xd23d8d,_0xc449cb){return db[_0xd4c9('0x36')]['find']({'where':{'id':_0x588ee5[_0xd4c9('0x50')]['id']}})['then'](handleEntityNotFound(_0xd23d8d,null))[_0xd4c9('0x28')](function(_0x470509){if(_0x470509){return _0x470509['removeAgents'](_0x588ee5[_0xd4c9('0x3d')][_0xd4c9('0x84')])[_0xd4c9('0x28')](function(){if(_[_0xd4c9('0x9b')](_0x588ee5[_0xd4c9('0x3d')][_0xd4c9('0x84')])){for(var _0x49fa98=0x0;_0x49fa98<_0x588ee5[_0xd4c9('0x3d')][_0xd4c9('0x84')]['length'];_0x49fa98+=0x1){socket[_0xd4c9('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x588ee5['query'][_0xd4c9('0x84')][_0x49fa98]),'VoiceQueueId':Number(_0x588ee5[_0xd4c9('0x50')]['id'])});}}else{socket['emit'](_0xd4c9('0x9c'),{'UserId':Number(_0x588ee5[_0xd4c9('0x3d')][_0xd4c9('0x84')]),'VoiceQueueId':Number(_0x588ee5[_0xd4c9('0x50')]['id'])});}});}})[_0xd4c9('0x28')](function(_0x3f2f48){return db[_0xd4c9('0x7d')][_0xd4c9('0x33')]({'where':{'VoiceQueueId':_0x588ee5[_0xd4c9('0x50')]['id'],'UserId':_0x588ee5[_0xd4c9('0x3d')]['ids']}})['then'](function(){return _0x3f2f48;});})['then'](respondWithStatusCode(_0xd23d8d,null))[_0xd4c9('0x4e')](handleError(_0xd23d8d,null));};exports['getAgents']=function(_0x56f39b,_0x407c76,_0x577299){var _0x5025d1={};var _0x34d896={};var _0x305478;var _0x8cea73;return db[_0xd4c9('0x36')][_0xd4c9('0x67')]({'where':{'id':_0x56f39b[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x407c76,null))[_0xd4c9('0x28')](function(_0x56e617){if(_0x56e617){_0x305478=_0x56e617;_0x34d896[_0xd4c9('0x3b')]=_[_0xd4c9('0x3c')](db[_0xd4c9('0x72')]['rawAttributes']);_0x34d896[_0xd4c9('0x3d')]=_['keys'](_0x56f39b[_0xd4c9('0x3d')]);_0x34d896[_0xd4c9('0x3e')]=_[_0xd4c9('0x3f')](_0x34d896['model'],_0x34d896[_0xd4c9('0x3d')]);_0x5025d1[_0xd4c9('0x40')]=_[_0xd4c9('0x3f')](_0x34d896[_0xd4c9('0x3b')],qs[_0xd4c9('0x41')](_0x56f39b[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x5025d1[_0xd4c9('0x40')]=_0x5025d1[_0xd4c9('0x40')][_0xd4c9('0x42')]?_0x5025d1['attributes']:_0x34d896[_0xd4c9('0x3b')];_0x5025d1[_0xd4c9('0x45')]=qs[_0xd4c9('0x46')](_0x56f39b[_0xd4c9('0x3d')][_0xd4c9('0x46')]);_0x5025d1[_0xd4c9('0x47')]=qs[_0xd4c9('0x3e')](_[_0xd4c9('0x65')](_0x56f39b[_0xd4c9('0x3d')],_0x34d896[_0xd4c9('0x3e')]));if(_0x56f39b[_0xd4c9('0x3d')][_0xd4c9('0x48')]){_0x5025d1[_0xd4c9('0x47')]=_['merge'](_0x5025d1[_0xd4c9('0x47')],{'$or':_['map'](_0x5025d1['attributes'],function(_0x17260e){var _0x5dbb37={};_0x5dbb37[_0x17260e]={'$like':'%'+_0x56f39b['query'][_0xd4c9('0x48')]+'%'};return _0x5dbb37;})});}_0x5025d1=_[_0xd4c9('0x49')]({},_0x5025d1,_0x56f39b[_0xd4c9('0x4b')]);return _0x305478[_0xd4c9('0x9d')](_0x5025d1);}})[_0xd4c9('0x28')](function(_0x16cd95){if(_0x16cd95){_0x8cea73=_0x16cd95[_0xd4c9('0x42')];if(!_0x56f39b['query'][_0xd4c9('0x43')](_0xd4c9('0x44'))){_0x5025d1['limit']=qs['limit'](_0x56f39b[_0xd4c9('0x3d')]['limit']);_0x5025d1[_0xd4c9('0x1e')]=qs['offset'](_0x56f39b['query'][_0xd4c9('0x1e')]);}return _0x305478[_0xd4c9('0x9d')](_0x5025d1);}})[_0xd4c9('0x28')](function(_0x4149ad){if(_0x4149ad){return _0x4149ad?{'count':_0x8cea73,'rows':_0x4149ad}:null;}})[_0xd4c9('0x28')](respondWithResult(_0x407c76,null))[_0xd4c9('0x4e')](handleError(_0x407c76,null));};exports[_0xd4c9('0x9e')]=function(_0x191638,_0x893ca0,_0x54eb95){var _0x457393={};var _0xeab832={};var _0x39aef4;var _0x286bb0;return db[_0xd4c9('0x36')][_0xd4c9('0x67')]({'where':{'id':_0x191638[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x893ca0,null))[_0xd4c9('0x28')](function(_0x44590b){if(_0x44590b){_0x39aef4=_0x44590b;_0xeab832[_0xd4c9('0x3b')]=_[_0xd4c9('0x3c')](db[_0xd4c9('0x7d')]['rawAttributes']);_0xeab832[_0xd4c9('0x3d')]=_[_0xd4c9('0x3c')](_0x191638[_0xd4c9('0x3d')]);_0xeab832[_0xd4c9('0x3e')]=_['intersection'](_0xeab832[_0xd4c9('0x3b')],_0xeab832[_0xd4c9('0x3d')]);_0x457393[_0xd4c9('0x40')]=_['intersection'](_0xeab832[_0xd4c9('0x3b')],qs[_0xd4c9('0x41')](_0x191638[_0xd4c9('0x3d')]['fields']));_0x457393[_0xd4c9('0x40')]=_0x457393[_0xd4c9('0x40')][_0xd4c9('0x42')]?_0x457393[_0xd4c9('0x40')]:_0xeab832[_0xd4c9('0x3b')];_0x457393[_0xd4c9('0x45')]=qs['sort'](_0x191638[_0xd4c9('0x3d')][_0xd4c9('0x46')]);_0x457393[_0xd4c9('0x47')]=qs[_0xd4c9('0x3e')](_[_0xd4c9('0x65')](_0x191638['query'],_0xeab832['filters']));if(_0x191638[_0xd4c9('0x3d')][_0xd4c9('0x48')]){_0x457393[_0xd4c9('0x47')]=_[_0xd4c9('0x49')](_0x457393[_0xd4c9('0x47')],{'$or':_[_0xd4c9('0x2f')](_0x457393[_0xd4c9('0x40')],function(_0xc513f0){var _0x250a66={};_0x250a66[_0xc513f0]={'$like':'%'+_0x191638[_0xd4c9('0x3d')][_0xd4c9('0x48')]+'%'};return _0x250a66;})});}_0x457393=_[_0xd4c9('0x49')]({},_0x457393,_0x191638[_0xd4c9('0x4b')]);return _0x39aef4['getMembers'](_0x457393);}})[_0xd4c9('0x28')](function(_0x3be21a){if(_0x3be21a){_0x286bb0=_0x3be21a['length'];if(!_0x191638[_0xd4c9('0x3d')][_0xd4c9('0x43')](_0xd4c9('0x44'))){_0x457393[_0xd4c9('0x20')]=qs['limit'](_0x191638[_0xd4c9('0x3d')][_0xd4c9('0x20')]);_0x457393[_0xd4c9('0x1e')]=qs['offset'](_0x191638['query'][_0xd4c9('0x1e')]);}return _0x39aef4['getMembers'](_0x457393);}})[_0xd4c9('0x28')](function(_0x32ccc0){return _0x32ccc0?{'count':_0x286bb0,'rows':_0x32ccc0}:null;})[_0xd4c9('0x28')](respondWithResult(_0x893ca0,null))[_0xd4c9('0x4e')](handleError(_0x893ca0,null));};exports['getLists']=function(_0x1ab36d,_0x23a87f,_0x37e515){var _0x1ca87a={};var _0x3b1cab={};var _0x2d112d;var _0x236de1;return db['VoiceQueue'][_0xd4c9('0x67')]({'where':{'id':_0x1ab36d[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x23a87f,null))[_0xd4c9('0x28')](function(_0x1d823b){if(_0x1d823b){_0x2d112d=_0x1d823b;_0x3b1cab[_0xd4c9('0x3b')]=_[_0xd4c9('0x3c')](db['CmList'][_0xd4c9('0x37')]);_0x3b1cab[_0xd4c9('0x3d')]=_[_0xd4c9('0x3c')](_0x1ab36d[_0xd4c9('0x3d')]);_0x3b1cab[_0xd4c9('0x3e')]=_['intersection'](_0x3b1cab[_0xd4c9('0x3b')],_0x3b1cab[_0xd4c9('0x3d')]);_0x1ca87a[_0xd4c9('0x40')]=_['intersection'](_0x3b1cab[_0xd4c9('0x3b')],qs[_0xd4c9('0x41')](_0x1ab36d[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x1ca87a['attributes']=_0x1ca87a[_0xd4c9('0x40')][_0xd4c9('0x42')]?_0x1ca87a['attributes']:_0x3b1cab[_0xd4c9('0x3b')];_0x1ca87a['order']=qs[_0xd4c9('0x46')](_0x1ab36d[_0xd4c9('0x3d')][_0xd4c9('0x46')]);_0x1ca87a[_0xd4c9('0x47')]=qs[_0xd4c9('0x3e')](_[_0xd4c9('0x65')](_0x1ab36d[_0xd4c9('0x3d')],_0x3b1cab[_0xd4c9('0x3e')]));if(_0x1ab36d[_0xd4c9('0x3d')][_0xd4c9('0x48')]){_0x1ca87a[_0xd4c9('0x47')]=_[_0xd4c9('0x49')](_0x1ca87a['where'],{'$or':_['map'](_0x1ca87a['attributes'],function(_0xa4cbd8){var _0x125f5b={};_0x125f5b[_0xa4cbd8]={'$like':'%'+_0x1ab36d[_0xd4c9('0x3d')][_0xd4c9('0x48')]+'%'};return _0x125f5b;})});}_0x1ca87a=_['merge']({},_0x1ca87a,_0x1ab36d[_0xd4c9('0x4b')]);return _0x2d112d[_0xd4c9('0x9f')](_0x1ca87a);}})[_0xd4c9('0x28')](function(_0x1d25cf){if(_0x1d25cf){_0x236de1=_0x1d25cf[_0xd4c9('0x42')];if(!_0x1ab36d[_0xd4c9('0x3d')][_0xd4c9('0x43')](_0xd4c9('0x44'))){_0x1ca87a[_0xd4c9('0x20')]=qs['limit'](_0x1ab36d[_0xd4c9('0x3d')][_0xd4c9('0x20')]);_0x1ca87a[_0xd4c9('0x1e')]=qs[_0xd4c9('0x1e')](_0x1ab36d['query'][_0xd4c9('0x1e')]);}return _0x2d112d['getLists'](_0x1ca87a);}})[_0xd4c9('0x28')](function(_0x455e82){if(_0x455e82){return _0x455e82?{'count':_0x236de1,'rows':_0x455e82}:null;}})[_0xd4c9('0x28')](respondWithResult(_0x23a87f,null))[_0xd4c9('0x4e')](handleError(_0x23a87f,null));};exports[_0xd4c9('0xa0')]=function(_0x2590b7,_0x290fab,_0x46fae4){var _0x94ff80=moment()[_0xd4c9('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3943f0,_0x3140db;return db[_0xd4c9('0x36')][_0xd4c9('0x53')]({'where':{'id':_0x2590b7[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x290fab,null))[_0xd4c9('0x28')](function(_0x157a1b){if(_0x157a1b){_0x3140db=_0x157a1b;return _0x157a1b[_0xd4c9('0xa0')](_0x2590b7[_0xd4c9('0x54')]['ids'],_[_0xd4c9('0x5c')](_0x2590b7['body'],[_0xd4c9('0x84'),'id'])||{});}return null;})[_0xd4c9('0x97')](function(_0xd7c3cf){var _0x199a1b;_0x3943f0=_0xd7c3cf||[];var _0x35b712=[];if(_0xd7c3cf){for(var _0x576896=0x0;_0x576896<_0xd7c3cf['length'];_0x576896+=0x1){var _0x42c1aa=_0xd7c3cf[_0x576896]['get']({'plain':!![]});_0x3140db[_0xd4c9('0xa1')]=_0x2590b7[_0xd4c9('0x54')][_0xd4c9('0xa1')]?_0x2590b7[_0xd4c9('0x54')][_0xd4c9('0xa1')]:_0x3140db[_0xd4c9('0xa1')];switch(_0x3140db[_0xd4c9('0xa1')]){case _0xd4c9('0xa2'):_0x199a1b=squel[_0xd4c9('0xa3')]()[_0xd4c9('0xa4')](_0xd4c9('0xa5'))[_0xd4c9('0xa6')]([_0xd4c9('0xa7'),_0xd4c9('0xa8'),_0xd4c9('0xa9'),'ListId',_0xd4c9('0x68'),_0xd4c9('0x5d'),_0xd4c9('0x5e')],squel['select']()['field'](_0xd4c9('0xa7'),_0xd4c9('0xa7'))['field']('\x27'+_0x94ff80+'\x27',_0xd4c9('0xa8'))['field']('id',_0xd4c9('0xa9'))[_0xd4c9('0x85')](_0x42c1aa[_0xd4c9('0xaa')][_0xd4c9('0x8f')](),_0xd4c9('0xab'))['field'](_0x2590b7[_0xd4c9('0x50')]['id'][_0xd4c9('0x8f')](),_0xd4c9('0x68'))['field']('\x27'+_0x94ff80+'\x27','createdAt')[_0xd4c9('0x85')]('\x27'+_0x94ff80+'\x27',_0xd4c9('0x5e'))[_0xd4c9('0xac')](_0xd4c9('0xad'))[_0xd4c9('0x47')]('deletedAt\x20IS\x20NULL')[_0xd4c9('0x47')]('ListId\x20=\x20?',_0x42c1aa[_0xd4c9('0xaa')]['toString']())['where'](_0xd4c9('0xae'))[_0xd4c9('0x47')](_0xd4c9('0xaf'),squel['select']()['field'](_0xd4c9('0xb0'))[_0xd4c9('0xac')](_0xd4c9('0xb1'))[_0xd4c9('0x47')](_0xd4c9('0x8b'),_0x2590b7[_0xd4c9('0x50')]['id'][_0xd4c9('0x8f')]()))[_0xd4c9('0x47')](_0xd4c9('0xaf'),squel[_0xd4c9('0xb2')]()[_0xd4c9('0x85')](_0xd4c9('0xb3'))[_0xd4c9('0xac')]('cm_hopper')[_0xd4c9('0x47')]('VoiceQueueId\x20=\x20?',_0x2590b7[_0xd4c9('0x50')]['id'][_0xd4c9('0x8f')]())))['toString']();break;case _0xd4c9('0xb4'):_0x199a1b=squel[_0xd4c9('0xa3')]()[_0xd4c9('0xa4')]('cm_hopper')[_0xd4c9('0xa6')]([_0xd4c9('0xa7'),_0xd4c9('0xa8'),_0xd4c9('0xa9'),_0xd4c9('0xab'),_0xd4c9('0x68'),_0xd4c9('0x5d'),'updatedAt'],squel[_0xd4c9('0xb2')]()[_0xd4c9('0x85')]('phone','phone')[_0xd4c9('0x85')]('\x27'+_0x94ff80+'\x27',_0xd4c9('0xa8'))['field']('id','ContactId')[_0xd4c9('0x85')](_0x42c1aa['CmListId'][_0xd4c9('0x8f')](),'ListId')[_0xd4c9('0x85')](_0x2590b7[_0xd4c9('0x50')]['id'][_0xd4c9('0x8f')](),_0xd4c9('0x68'))[_0xd4c9('0x85')]('\x27'+_0x94ff80+'\x27',_0xd4c9('0x5d'))[_0xd4c9('0x85')]('\x27'+_0x94ff80+'\x27',_0xd4c9('0x5e'))[_0xd4c9('0xac')]('cm_contacts')[_0xd4c9('0x47')]('deletedAt\x20IS\x20NULL')[_0xd4c9('0x47')]('ListId\x20=\x20?',_0x42c1aa[_0xd4c9('0xaa')]['toString']())[_0xd4c9('0x47')](_0xd4c9('0xae'))[_0xd4c9('0x47')](_0xd4c9('0xaf'),squel[_0xd4c9('0xb2')]()[_0xd4c9('0x85')]('COALESCE(phone,\x27\x27)')[_0xd4c9('0xac')](_0xd4c9('0xa5'))[_0xd4c9('0x47')](_0xd4c9('0x8b'),_0x2590b7[_0xd4c9('0x50')]['id']['toString']())))[_0xd4c9('0x8f')]();break;default:_0x199a1b=squel[_0xd4c9('0xa3')]()[_0xd4c9('0xa4')](_0xd4c9('0xa5'))[_0xd4c9('0xa6')]([_0xd4c9('0xa7'),_0xd4c9('0xa8'),'ContactId',_0xd4c9('0xab'),_0xd4c9('0x68'),_0xd4c9('0x5d'),'updatedAt'],squel[_0xd4c9('0xb2')]()[_0xd4c9('0x85')]('phone',_0xd4c9('0xa7'))['field']('\x27'+_0x94ff80+'\x27',_0xd4c9('0xa8'))[_0xd4c9('0x85')]('id',_0xd4c9('0xa9'))['field'](_0x42c1aa[_0xd4c9('0xaa')][_0xd4c9('0x8f')](),_0xd4c9('0xab'))[_0xd4c9('0x85')](_0x2590b7[_0xd4c9('0x50')]['id'][_0xd4c9('0x8f')](),'VoiceQueueId')[_0xd4c9('0x85')]('\x27'+_0x94ff80+'\x27','createdAt')['field']('\x27'+_0x94ff80+'\x27',_0xd4c9('0x5e'))[_0xd4c9('0xac')](_0xd4c9('0xad'))[_0xd4c9('0x47')]('deletedAt\x20IS\x20NULL')[_0xd4c9('0x47')]('ListId\x20=\x20?',_0x42c1aa[_0xd4c9('0xaa')][_0xd4c9('0x8f')]())[_0xd4c9('0x47')](_0xd4c9('0xae')))[_0xd4c9('0x8f')]();}_0x35b712['push'](db[_0xd4c9('0x8e')][_0xd4c9('0x3d')](_0x199a1b));}return BPromise['all'](_0x35b712);}})[_0xd4c9('0x28')](function(){var _0x10d7ff=[];var _0x3cec7f=squel[_0xd4c9('0xa3')]()[_0xd4c9('0xa4')](_0xd4c9('0xb5'))['fromQuery']([_0xd4c9('0xb6'),_0xd4c9('0xa7'),_0xd4c9('0xb7'),_0xd4c9('0x5d'),'updatedAt'],squel[_0xd4c9('0xb2')]()[_0xd4c9('0x85')](_0xd4c9('0xb8'))[_0xd4c9('0x85')](_0xd4c9('0xb9'))[_0xd4c9('0x85')]('ci.OrderBy+1')[_0xd4c9('0x85')]('\x27'+_0x94ff80+'\x27','createdAt')['field']('\x27'+_0x94ff80+'\x27',_0xd4c9('0x5e'))[_0xd4c9('0xac')](_0xd4c9('0xba'),'ci')['join']('cm_hopper','h',_0xd4c9('0xbb'))['where'](_0xd4c9('0xbc'),_0x94ff80)[_0xd4c9('0x47')](_0xd4c9('0xbd'),_0xd4c9('0xbe')))[_0xd4c9('0x8f')]();_0x10d7ff[_0xd4c9('0x8d')](db[_0xd4c9('0x8e')][_0xd4c9('0x3d')](_0x3cec7f));return BPromise['all'](_0x10d7ff);})[_0xd4c9('0x28')](function(){return _0x3943f0;})[_0xd4c9('0x28')](respondWithResult(_0x290fab,null))[_0xd4c9('0x4e')](handleError(_0x290fab,null));};exports[_0xd4c9('0xbf')]=function(_0x462d38,_0x330dfa,_0x33d2f0){return db[_0xd4c9('0x36')][_0xd4c9('0x53')]({'where':{'id':_0x462d38[_0xd4c9('0x50')]['id']}})['then'](handleEntityNotFound(_0x330dfa,null))[_0xd4c9('0x28')](function(_0x30715b){if(_0x30715b){return _0x30715b['removeLists'](_0x462d38[_0xd4c9('0x3d')][_0xd4c9('0x84')]);}})[_0xd4c9('0x28')](function(_0x2edf15){if(_0x2edf15){return db[_0xd4c9('0x64')]['destroy']({'where':{'ListId':_0x462d38['query'][_0xd4c9('0x84')],'VoiceQueueId':_0x462d38[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](function(){return _0x2edf15;});}})[_0xd4c9('0x28')](respondWithStatusCode(_0x330dfa,null))[_0xd4c9('0x4e')](handleError(_0x330dfa,null));};exports[_0xd4c9('0xc0')]=function(_0x2d63f5,_0x3bebd0,_0x344763){var _0x269bfb={};var _0x55c780={};var _0x3b2f0b;var _0x3db387;return db[_0xd4c9('0x36')][_0xd4c9('0x67')]({'where':{'id':_0x2d63f5[_0xd4c9('0x50')]['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x3bebd0,null))['then'](function(_0x713c9){if(_0x713c9){_0x3b2f0b=_0x713c9;_0x55c780[_0xd4c9('0x3b')]=_['keys'](db['CmList'][_0xd4c9('0x37')]);_0x55c780['query']=_['keys'](_0x2d63f5[_0xd4c9('0x3d')]);_0x55c780[_0xd4c9('0x3e')]=_[_0xd4c9('0x3f')](_0x55c780[_0xd4c9('0x3b')],_0x55c780[_0xd4c9('0x3d')]);_0x269bfb[_0xd4c9('0x40')]=_[_0xd4c9('0x3f')](_0x55c780[_0xd4c9('0x3b')],qs[_0xd4c9('0x41')](_0x2d63f5[_0xd4c9('0x3d')][_0xd4c9('0x41')]));_0x269bfb[_0xd4c9('0x40')]=_0x269bfb['attributes'][_0xd4c9('0x42')]?_0x269bfb[_0xd4c9('0x40')]:_0x55c780[_0xd4c9('0x3b')];_0x269bfb['order']=qs[_0xd4c9('0x46')](_0x2d63f5[_0xd4c9('0x3d')][_0xd4c9('0x46')]);_0x269bfb[_0xd4c9('0x47')]=qs[_0xd4c9('0x3e')](_['pick'](_0x2d63f5['query'],_0x55c780[_0xd4c9('0x3e')]));if(_0x2d63f5[_0xd4c9('0x3d')][_0xd4c9('0x48')]){_0x269bfb[_0xd4c9('0x47')]=_[_0xd4c9('0x49')](_0x269bfb['where'],{'$or':_[_0xd4c9('0x2f')](_0x269bfb[_0xd4c9('0x40')],function(_0x5642c2){var _0x1cb283={};_0x1cb283[_0x5642c2]={'$like':'%'+_0x2d63f5[_0xd4c9('0x3d')]['filter']+'%'};return _0x1cb283;})});}_0x269bfb=_[_0xd4c9('0x49')]({},_0x269bfb,_0x2d63f5['options']);return _0x3b2f0b['getBlackLists'](_0x269bfb);}})[_0xd4c9('0x28')](function(_0x170f38){if(_0x170f38){_0x3db387=_0x170f38['length'];if(!_0x2d63f5[_0xd4c9('0x3d')]['hasOwnProperty'](_0xd4c9('0x44'))){_0x269bfb[_0xd4c9('0x20')]=qs['limit'](_0x2d63f5['query'][_0xd4c9('0x20')]);_0x269bfb[_0xd4c9('0x1e')]=qs[_0xd4c9('0x1e')](_0x2d63f5[_0xd4c9('0x3d')][_0xd4c9('0x1e')]);}return _0x3b2f0b['getBlackLists'](_0x269bfb);}})['then'](function(_0x48e27c){if(_0x48e27c){return _0x48e27c?{'count':_0x3db387,'rows':_0x48e27c}:null;}})[_0xd4c9('0x28')](respondWithResult(_0x3bebd0,null))['catch'](handleError(_0x3bebd0,null));};exports[_0xd4c9('0xc1')]=function(_0x1537e2,_0x1c0573,_0x28feff){var _0x34bd19,_0x540e97;return db[_0xd4c9('0x36')][_0xd4c9('0x53')]({'where':{'id':_0x1537e2['params']['id']}})['then'](handleEntityNotFound(_0x1c0573,null))['then'](function(_0x39c291){if(_0x39c291){_0x540e97=_0x39c291;return _0x39c291['addBlackLists'](_0x1537e2[_0xd4c9('0x54')]['ids'],_['omit'](_0x1537e2[_0xd4c9('0x54')],['ids','id'])||{});}return null;})[_0xd4c9('0x97')](function(_0x406b90){var _0xf9703;_0x34bd19=_0x406b90||[];var _0x110099=[];if(_0x406b90){for(var _0x5e50c6=0x0;_0x5e50c6<_0x406b90[_0xd4c9('0x42')];_0x5e50c6+=0x1){var _0x249c63=_0x406b90[_0x5e50c6][_0xd4c9('0x29')]({'plain':!![]});_0xf9703=squel[_0xd4c9('0xa3')]()[_0xd4c9('0xa4')](_0xd4c9('0xc2'))[_0xd4c9('0xa6')](['phone',_0xd4c9('0xa9'),_0xd4c9('0xab'),_0xd4c9('0x68'),_0xd4c9('0x5d'),_0xd4c9('0x5e')],squel[_0xd4c9('0xb2')]()[_0xd4c9('0x85')]('phone',_0xd4c9('0xa7'))[_0xd4c9('0x85')]('id',_0xd4c9('0xa9'))['field'](_0x249c63[_0xd4c9('0xaa')]['toString'](),_0xd4c9('0xab'))[_0xd4c9('0x85')](_0x1537e2['params']['id'][_0xd4c9('0x8f')](),_0xd4c9('0x68'))['field'](_0xd4c9('0xc3'),'createdAt')[_0xd4c9('0x85')]('NOW()',_0xd4c9('0x5e'))['from'](_0xd4c9('0xad'))[_0xd4c9('0x47')](_0xd4c9('0xc4'))[_0xd4c9('0x47')]('ListId\x20=\x20?',_0x249c63[_0xd4c9('0xaa')][_0xd4c9('0x8f')]())['where'](_0xd4c9('0xae')))[_0xd4c9('0x8f')]();_0x110099[_0xd4c9('0x8d')](db['sequelize']['query'](_0xf9703));}return BPromise[_0xd4c9('0x9a')](_0x110099);}})[_0xd4c9('0x28')](function(){return _0x34bd19;})[_0xd4c9('0x28')](respondWithResult(_0x1c0573,null))['catch'](handleError(_0x1c0573,null));};exports['removeBlackLists']=function(_0x43e8b2,_0x18779d,_0x7f2f9e){return db[_0xd4c9('0x36')][_0xd4c9('0x53')]({'where':{'id':_0x43e8b2['params']['id']}})[_0xd4c9('0x28')](handleEntityNotFound(_0x18779d,null))[_0xd4c9('0x28')](function(_0x7d9422){if(_0x7d9422){return _0x7d9422[_0xd4c9('0xc5')](_0x43e8b2[_0xd4c9('0x3d')][_0xd4c9('0x84')]);}})[_0xd4c9('0x28')](function(_0x8157f7){if(_0x8157f7){return db['CmHopperBlack'][_0xd4c9('0x33')]({'where':{'ListId':_0x43e8b2[_0xd4c9('0x3d')][_0xd4c9('0x84')],'VoiceQueueId':_0x43e8b2[_0xd4c9('0x50')]['id']}})['then'](function(){return _0x8157f7;});}})[_0xd4c9('0x28')](respondWithStatusCode(_0x18779d,null))['catch'](handleError(_0x18779d,null));}; \ No newline at end of file +var _0xd634=['ids','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','CmListId','ListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','select','onlyIfOpen','cm_hopper','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','cm_contacts','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','create','body','user','role','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','length','order','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','emit','userVoiceQueue:save'];(function(_0x2c6424,_0x5f071c){var _0x36cf2f=function(_0x2684d0){while(--_0x2684d0){_0x2c6424['push'](_0x2c6424['shift']());}};_0x36cf2f(++_0x5f071c);}(_0xd634,0xf4));var _0x4d63=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xd634[_0x5280f4];return _0xba93e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d63('0x0'));var zipdir=require(_0x4d63('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4d63('0x2'));var BPromise=require(_0x4d63('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d63('0x4'));var sox=require(_0x4d63('0x5'));var csv=require(_0x4d63('0x6'));var ejs=require(_0x4d63('0x7'));var fs=require('fs');var fs_extra=require(_0x4d63('0x8'));var _=require(_0x4d63('0x9'));var squel=require(_0x4d63('0xa'));var crypto=require(_0x4d63('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d63('0xc'));var authService=require(_0x4d63('0xd'));var qs=require(_0x4d63('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d63('0xf'));var logger=require(_0x4d63('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4d63('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d63('0x12'))['db'];config[_0x4d63('0x13')]=_[_0x4d63('0x14')](config[_0x4d63('0x13')],{'host':_0x4d63('0x15'),'port':0x18eb});var socket=require(_0x4d63('0x16'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x29065c,_0x42571c){_0x42571c=_0x42571c||0xcc;return function(_0x251970){if(_0x251970){return _0x29065c[_0x4d63('0x17')](_0x42571c);}return _0x29065c['status'](_0x42571c)[_0x4d63('0x18')]();};}function respondWithResult(_0x2ca49a,_0x26d6fa){_0x26d6fa=_0x26d6fa||0xc8;return function(_0x44c1d8){if(_0x44c1d8){return _0x2ca49a[_0x4d63('0x19')](_0x26d6fa)[_0x4d63('0x1a')](_0x44c1d8);}};}function respondWithFilteredResult(_0x43dc31,_0x165c17){return function(_0x53bbb8){if(_0x53bbb8){var _0x4fe175=typeof _0x165c17[_0x4d63('0x1b')]==='undefined'&&typeof _0x165c17[_0x4d63('0x1c')]===_0x4d63('0x1d');var _0x37a03f=_0x53bbb8[_0x4d63('0x1e')];var _0x1cf455=_0x4fe175?0x0:_0x165c17['offset'];var _0x2feb4d=_0x4fe175?_0x53bbb8[_0x4d63('0x1e')]:_0x165c17['offset']+_0x165c17[_0x4d63('0x1c')];var _0xc2d3ab;if(_0x2feb4d>=_0x37a03f){_0x2feb4d=_0x37a03f;_0xc2d3ab=0xc8;}else{_0xc2d3ab=0xce;}_0x43dc31[_0x4d63('0x19')](_0xc2d3ab);return _0x43dc31['set'](_0x4d63('0x1f'),_0x1cf455+'-'+_0x2feb4d+'/'+_0x37a03f)[_0x4d63('0x1a')](_0x53bbb8);}return null;};}function patchUpdates(_0xcc4333){return function(_0x4702aa){try{jsonpatch['apply'](_0x4702aa,_0xcc4333,!![]);}catch(_0x3bb2f5){return BPromise['reject'](_0x3bb2f5);}return _0x4702aa['save']();};}function saveUpdates(_0x2ce377,_0x240d7d){return function(_0x63f87d){if(_0x63f87d){return _0x63f87d[_0x4d63('0x20')](_0x2ce377)[_0x4d63('0x21')](function(_0x2b4423){return _0x2b4423;});}return null;};}function removeEntity(_0x2beb3b,_0x2195a9){return function(_0x147150){if(_0x147150){return _0x147150[_0x4d63('0x22')]()['then'](function(){var _0x410bd9=_0x147150[_0x4d63('0x23')]({'plain':!![]});var _0x475c08=[{'name':_0x4d63('0x24'),'value':_0x4d63('0x25'),'ignore':![]},{'name':_0x4d63('0x26'),'value':_0x4d63('0x27'),'ignore':![]}];var _0x1e7047=_(_0x475c08)[_0x4d63('0x28')](_0x4d63('0x29'))[_0x4d63('0x2a')](_0x4d63('0x2b'))[_0x4d63('0x2b')]();if(_[_0x4d63('0x2c')](_0x1e7047,_0x410bd9[_0x4d63('0x2d')])){return;}var _0x26968f=_['find'](_0x475c08,[_0x4d63('0x2b'),_0x410bd9[_0x4d63('0x2d')]])[_0x4d63('0x2e')];return db[_0x4d63('0x2f')][_0x4d63('0x22')]({'where':{'type':_0x26968f,'resourceId':_0x410bd9['id']}})[_0x4d63('0x21')](function(){return _0x147150;});})['then'](function(){_0x2beb3b[_0x4d63('0x19')](0xcc)[_0x4d63('0x18')]();});}};}function handleEntityNotFound(_0x3def9c,_0x21d6cd){return function(_0x670658){if(!_0x670658){_0x3def9c['sendStatus'](0x194);}return _0x670658;};}function handleError(_0x17d11b,_0x3b231c){_0x3b231c=_0x3b231c||0x1f4;return function(_0x50d9e6){logger[_0x4d63('0x30')](_0x50d9e6[_0x4d63('0x31')]);if(_0x50d9e6[_0x4d63('0x2e')]){delete _0x50d9e6['name'];}_0x17d11b[_0x4d63('0x19')](_0x3b231c)[_0x4d63('0x32')](_0x50d9e6);};}exports['index']=function(_0x282b15,_0x511ff5){var _0x50d5ae={},_0x2ed2dd={},_0x2a70e3={'count':0x0,'rows':[]};var _0x27affe=_[_0x4d63('0x2a')](db[_0x4d63('0x33')][_0x4d63('0x34')],function(_0x5026ff){return{'name':_0x5026ff[_0x4d63('0x35')],'type':_0x5026ff[_0x4d63('0x2d')][_0x4d63('0x36')]};});_0x2ed2dd[_0x4d63('0x37')]=_['map'](_0x27affe,_0x4d63('0x2e'));_0x2ed2dd[_0x4d63('0x38')]=_[_0x4d63('0x39')](_0x282b15[_0x4d63('0x38')]);_0x2ed2dd[_0x4d63('0x3a')]=_['intersection'](_0x2ed2dd['model'],_0x2ed2dd[_0x4d63('0x38')]);_0x50d5ae[_0x4d63('0x3b')]=_['intersection'](_0x2ed2dd['model'],qs[_0x4d63('0x3c')](_0x282b15['query'][_0x4d63('0x3c')]));_0x50d5ae[_0x4d63('0x3b')]=_0x50d5ae[_0x4d63('0x3b')]['length']?_0x50d5ae[_0x4d63('0x3b')]:_0x2ed2dd[_0x4d63('0x37')];if(!_0x282b15['query'][_0x4d63('0x3d')](_0x4d63('0x3e'))){_0x50d5ae[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x282b15[_0x4d63('0x38')][_0x4d63('0x1c')]);_0x50d5ae[_0x4d63('0x1b')]=qs[_0x4d63('0x1b')](_0x282b15[_0x4d63('0x38')][_0x4d63('0x1b')]);}_0x50d5ae['order']=qs[_0x4d63('0x3f')](_0x282b15[_0x4d63('0x38')][_0x4d63('0x3f')]);_0x50d5ae[_0x4d63('0x40')]=qs['filters'](_[_0x4d63('0x41')](_0x282b15['query'],_0x2ed2dd[_0x4d63('0x3a')]),_0x27affe);if(_0x282b15[_0x4d63('0x38')][_0x4d63('0x28')]){_0x50d5ae['where']=_[_0x4d63('0x42')](_0x50d5ae['where'],{'$or':_[_0x4d63('0x2a')](_0x27affe,function(_0x116eb5){if(_0x116eb5[_0x4d63('0x2d')]!==_0x4d63('0x43')){var _0x12b48c={};_0x12b48c[_0x116eb5[_0x4d63('0x2e')]]={'$like':'%'+_0x282b15['query'][_0x4d63('0x28')]+'%'};return _0x12b48c;}})});}_0x50d5ae=_[_0x4d63('0x42')]({},_0x50d5ae,_0x282b15[_0x4d63('0x44')]);var _0x54a3f1={'where':_0x50d5ae[_0x4d63('0x40')]};return db[_0x4d63('0x33')][_0x4d63('0x1e')](_0x54a3f1)[_0x4d63('0x21')](function(_0x46e82f){_0x2a70e3[_0x4d63('0x1e')]=_0x46e82f;if(_0x282b15['query'][_0x4d63('0x45')]){_0x50d5ae[_0x4d63('0x46')]=[{'all':!![]}];}return db[_0x4d63('0x33')][_0x4d63('0x47')](_0x50d5ae);})[_0x4d63('0x21')](function(_0x2f86f8){_0x2a70e3[_0x4d63('0x48')]=_0x2f86f8;return _0x2a70e3;})['then'](respondWithFilteredResult(_0x511ff5,_0x50d5ae))[_0x4d63('0x49')](handleError(_0x511ff5,null));};exports['show']=function(_0x5634db,_0x4e954b){var _0x5a972d={'raw':![],'where':{'id':_0x5634db[_0x4d63('0x4a')]['id']}},_0x687738={};_0x687738[_0x4d63('0x37')]=_[_0x4d63('0x39')](db['VoiceQueue'][_0x4d63('0x34')]);_0x687738[_0x4d63('0x38')]=_[_0x4d63('0x39')](_0x5634db[_0x4d63('0x38')]);_0x687738[_0x4d63('0x3a')]=_[_0x4d63('0x4b')](_0x687738[_0x4d63('0x37')],_0x687738[_0x4d63('0x38')]);_0x5a972d[_0x4d63('0x3b')]=_[_0x4d63('0x4b')](_0x687738[_0x4d63('0x37')],qs[_0x4d63('0x3c')](_0x5634db[_0x4d63('0x38')]['fields']));_0x5a972d[_0x4d63('0x3b')]=_0x5a972d[_0x4d63('0x3b')]['length']?_0x5a972d['attributes']:_0x687738[_0x4d63('0x37')];if(_0x5634db['query'][_0x4d63('0x45')]){_0x5a972d[_0x4d63('0x46')]=[{'all':!![]}];}_0x5a972d=_[_0x4d63('0x42')]({},_0x5a972d,_0x5634db['options']);return db[_0x4d63('0x33')]['find'](_0x5a972d)[_0x4d63('0x21')](handleEntityNotFound(_0x4e954b,null))['then'](respondWithResult(_0x4e954b,null))[_0x4d63('0x49')](handleError(_0x4e954b,null));};exports[_0x4d63('0x4c')]=function(_0x435bc8,_0x3cb5c8){return db['VoiceQueue'][_0x4d63('0x4c')](_0x435bc8[_0x4d63('0x4d')],{})[_0x4d63('0x21')](function(_0x1ffbef){var _0x2cdca2=_0x435bc8[_0x4d63('0x4e')][_0x4d63('0x23')]({'plain':!![]});if(!_0x2cdca2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cdca2[_0x4d63('0x4f')]===_0x4d63('0x4e')){var _0x2e7114=_0x1ffbef[_0x4d63('0x23')]({'plain':!![]});var _0x3bad26=[{'name':_0x4d63('0x24'),'value':_0x4d63('0x25')},{'name':_0x4d63('0x26'),'value':_0x4d63('0x27')}];var _0x52a963=_[_0x4d63('0x50')](_0x3bad26,[_0x4d63('0x2b'),_0x2e7114[_0x4d63('0x2d')]])[_0x4d63('0x2e')];return db[_0x4d63('0x51')][_0x4d63('0x50')]({'where':{'name':_0x52a963,'userProfileId':_0x2cdca2[_0x4d63('0x52')]},'raw':!![]})[_0x4d63('0x21')](function(_0x267d48){if(_0x267d48&&_0x267d48[_0x4d63('0x53')]===0x0){return db[_0x4d63('0x2f')][_0x4d63('0x4c')]({'name':_0x2e7114['name'],'resourceId':_0x2e7114['id'],'type':_0x267d48[_0x4d63('0x2e')],'sectionId':_0x267d48['id']},{})[_0x4d63('0x21')](function(){return _0x1ffbef;});}else{return _0x1ffbef;}})[_0x4d63('0x49')](function(_0x1fdc95){logger[_0x4d63('0x30')](_0x4d63('0x54'),_0x1fdc95);throw _0x1fdc95;});}return _0x1ffbef;})['then'](respondWithResult(_0x3cb5c8,0xc9))[_0x4d63('0x49')](handleError(_0x3cb5c8,null));};exports[_0x4d63('0x55')]=function(_0x23166e,_0x3f29e0){var _0x939273={'where':{'id':_0x23166e[_0x4d63('0x4a')]['id']}},_0x3f4caf={};_0x3f4caf[_0x4d63('0x37')]=_[_0x4d63('0x39')](db[_0x4d63('0x33')][_0x4d63('0x34')]);_0x939273['attributes']=_[_0x4d63('0x4b')](_0x3f4caf[_0x4d63('0x37')],qs[_0x4d63('0x3c')](_0x23166e['query'][_0x4d63('0x3c')]));_0x939273[_0x4d63('0x3b')]=_0x939273[_0x4d63('0x3b')]['length']?_0x939273[_0x4d63('0x3b')]:_0x3f4caf['model'];if(_0x23166e[_0x4d63('0x38')]['includeAll']){_0x939273['include']=[{'all':!![]}];}_0x939273=_[_0x4d63('0x42')]({},_0x939273,_0x23166e[_0x4d63('0x44')]);return db[_0x4d63('0x33')][_0x4d63('0x50')](_0x939273)[_0x4d63('0x21')](handleEntityNotFound(_0x3f29e0,null))[_0x4d63('0x21')](function(_0x34ee39){if(_0x34ee39){var _0x470aec=_0x34ee39[_0x4d63('0x23')]({'plain':!![]});_0x470aec=qs[_0x4d63('0x56')](_0x470aec,['id','createdAt',_0x4d63('0x57')]);_0x23166e[_0x4d63('0x4d')]=_[_0x4d63('0x56')](_0x23166e[_0x4d63('0x4d')],['id',_0x4d63('0x58'),_0x4d63('0x57')]);return db[_0x4d63('0x33')][_0x4d63('0x4c')](_[_0x4d63('0x42')](_0x470aec,_0x23166e[_0x4d63('0x4d')]),{'include':_0x23166e[_0x4d63('0x38')][_0x4d63('0x45')]?[{'all':!![]}]:undefined})[_0x4d63('0x21')](function(_0x2d2070){var _0x521e19=_0x23166e['user'][_0x4d63('0x23')]({'plain':!![]});if(!_0x521e19)throw new Error(_0x4d63('0x59'));if(_0x521e19['role']===_0x4d63('0x4e')){var _0xaccb49=_0x2d2070['get']({'plain':!![]});var _0x222d33=[{'name':_0x4d63('0x24'),'value':'inbound'},{'name':_0x4d63('0x26'),'value':_0x4d63('0x27')}];var _0x157420=_['find'](_0x222d33,[_0x4d63('0x2b'),_0xaccb49[_0x4d63('0x2d')]])[_0x4d63('0x2e')];return db[_0x4d63('0x51')][_0x4d63('0x50')]({'where':{'name':_0x157420,'userProfileId':_0x521e19[_0x4d63('0x52')]},'raw':!![]})[_0x4d63('0x21')](function(_0x31daa6){if(_0x31daa6&&_0x31daa6[_0x4d63('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0xaccb49[_0x4d63('0x2e')],'resourceId':_0xaccb49['id'],'type':_0x31daa6[_0x4d63('0x2e')],'sectionId':_0x31daa6['id']},{})[_0x4d63('0x21')](function(){return _0x2d2070;});}else{return _0x2d2070;}})['catch'](function(_0x1d8944){logger[_0x4d63('0x30')](_0x4d63('0x54'),_0x1d8944);throw _0x1d8944;});}return _0x2d2070;});}})[_0x4d63('0x21')](respondWithResult(_0x3f29e0,0xc9))[_0x4d63('0x49')](handleError(_0x3f29e0,null));};exports[_0x4d63('0x20')]=function(_0x26dbea,_0xaf226b){if(_0x26dbea[_0x4d63('0x4d')]['id']){delete _0x26dbea[_0x4d63('0x4d')]['id'];}return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x26dbea[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0xaf226b,null))[_0x4d63('0x21')](saveUpdates(_0x26dbea[_0x4d63('0x4d')],null))[_0x4d63('0x21')](respondWithResult(_0xaf226b,null))[_0x4d63('0x49')](handleError(_0xaf226b,null));};exports[_0x4d63('0x22')]=function(_0x2a830e,_0x3abb8a){return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x2a830e[_0x4d63('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3abb8a,null))[_0x4d63('0x21')](removeEntity(_0x3abb8a,null))['catch'](handleError(_0x3abb8a,null));};exports[_0x4d63('0x5a')]=function(_0xbe49f5,_0x3bf227,_0x485be0){var _0x578471={'raw':![],'where':{}};var _0x39b27d={};var _0x51a9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x4d63('0x5b')]({'where':{'id':_0xbe49f5[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x3bf227,null))['then'](function(_0x38b7b1){if(_0x38b7b1){_0x39b27d[_0x4d63('0x37')]=_[_0x4d63('0x39')](db[_0x4d63('0x5c')][_0x4d63('0x34')]);_0x39b27d[_0x4d63('0x38')]=_[_0x4d63('0x39')](_0xbe49f5[_0x4d63('0x38')]);_0x39b27d[_0x4d63('0x3a')]=_['intersection'](_0x39b27d[_0x4d63('0x37')],_0x39b27d['query']);_0x578471[_0x4d63('0x3b')]=_['intersection'](_0x39b27d['model'],qs[_0x4d63('0x3c')](_0xbe49f5[_0x4d63('0x38')]['fields']));_0x578471[_0x4d63('0x3b')]=_0x578471[_0x4d63('0x3b')][_0x4d63('0x5d')]?_0x578471[_0x4d63('0x3b')]:_0x39b27d[_0x4d63('0x37')];if(!_0xbe49f5['query'][_0x4d63('0x3d')](_0x4d63('0x3e'))){_0x578471['limit']=qs[_0x4d63('0x1c')](_0xbe49f5[_0x4d63('0x38')][_0x4d63('0x1c')]);_0x578471[_0x4d63('0x1b')]=qs[_0x4d63('0x1b')](_0xbe49f5['query'][_0x4d63('0x1b')]);}_0x578471[_0x4d63('0x5e')]=qs[_0x4d63('0x3f')](_0xbe49f5[_0x4d63('0x38')][_0x4d63('0x3f')]);_0x578471['where']=qs[_0x4d63('0x3a')](_['pick'](_0xbe49f5[_0x4d63('0x38')],_0x39b27d[_0x4d63('0x3a')]));_0x578471[_0x4d63('0x40')][_0x4d63('0x5f')]=_0x38b7b1['id'];if(_0xbe49f5[_0x4d63('0x38')][_0x4d63('0x28')]){_0x578471[_0x4d63('0x40')]=_[_0x4d63('0x42')](_0x578471[_0x4d63('0x40')],{'$or':_[_0x4d63('0x2a')](_0x578471[_0x4d63('0x3b')],function(_0x4459e0){var _0xe70302={};_0xe70302[_0x4459e0]={'$like':'%'+_0xbe49f5[_0x4d63('0x38')][_0x4d63('0x28')]+'%'};return _0xe70302;})});}_0x578471=_['merge']({},_0x578471,_0xbe49f5[_0x4d63('0x44')]);return db['CmHopper'][_0x4d63('0x1e')]({'where':_0x578471[_0x4d63('0x40')]})[_0x4d63('0x21')](function(_0x31d5b4){_0x51a9[_0x4d63('0x1e')]=_0x31d5b4;if(_0xbe49f5[_0x4d63('0x38')][_0x4d63('0x45')]){_0x578471[_0x4d63('0x46')]=[{'all':!![]}];}return db[_0x4d63('0x5c')][_0x4d63('0x47')](_0x578471);})[_0x4d63('0x21')](function(_0x359532){_0x51a9[_0x4d63('0x48')]=_0x359532;return _0x51a9;});}})[_0x4d63('0x21')](respondWithFilteredResult(_0x3bf227,_0x578471))[_0x4d63('0x49')](handleError(_0x3bf227,null));};exports[_0x4d63('0x60')]=function(_0x55c1e1,_0x3a40ea,_0x54a0b8){var _0x531c10={'raw':!![],'where':{}};var _0x289b6c={};var _0x580ad3={'count':0x0,'rows':[]};return db[_0x4d63('0x33')][_0x4d63('0x5b')]({'where':{'id':_0x55c1e1['params']['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x3a40ea,null))[_0x4d63('0x21')](function(_0x4d1f0f){if(_0x4d1f0f){_0x289b6c[_0x4d63('0x37')]=_[_0x4d63('0x39')](db[_0x4d63('0x61')][_0x4d63('0x34')]);_0x289b6c[_0x4d63('0x38')]=_['keys'](_0x55c1e1[_0x4d63('0x38')]);_0x289b6c[_0x4d63('0x3a')]=_['intersection'](_0x289b6c[_0x4d63('0x37')],_0x289b6c['query']);_0x531c10[_0x4d63('0x3b')]=_[_0x4d63('0x4b')](_0x289b6c[_0x4d63('0x37')],qs[_0x4d63('0x3c')](_0x55c1e1[_0x4d63('0x38')]['fields']));_0x531c10['attributes']=_0x531c10[_0x4d63('0x3b')][_0x4d63('0x5d')]?_0x531c10[_0x4d63('0x3b')]:_0x289b6c[_0x4d63('0x37')];if(!_0x55c1e1['query'][_0x4d63('0x3d')]('nolimit')){_0x531c10[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x55c1e1['query']['limit']);_0x531c10[_0x4d63('0x1b')]=qs['offset'](_0x55c1e1[_0x4d63('0x38')][_0x4d63('0x1b')]);}_0x531c10[_0x4d63('0x5e')]=qs['sort'](_0x55c1e1['query'][_0x4d63('0x3f')]);_0x531c10[_0x4d63('0x40')]=qs['filters'](_['pick'](_0x55c1e1[_0x4d63('0x38')],_0x289b6c[_0x4d63('0x3a')]));_0x531c10[_0x4d63('0x40')][_0x4d63('0x5f')]=_0x4d1f0f['id'];if(_0x55c1e1[_0x4d63('0x38')][_0x4d63('0x28')]){_0x531c10[_0x4d63('0x40')]=_[_0x4d63('0x42')](_0x531c10[_0x4d63('0x40')],{'$or':_[_0x4d63('0x2a')](_0x531c10[_0x4d63('0x3b')],function(_0x33bd3f){var _0x675298={};_0x675298[_0x33bd3f]={'$like':'%'+_0x55c1e1[_0x4d63('0x38')][_0x4d63('0x28')]+'%'};return _0x675298;})});}_0x531c10=_['merge']({},_0x531c10,_0x55c1e1['options']);return db[_0x4d63('0x61')][_0x4d63('0x1e')]({'where':_0x531c10[_0x4d63('0x40')]})[_0x4d63('0x21')](function(_0x40ac84){_0x580ad3[_0x4d63('0x1e')]=_0x40ac84;if(_0x55c1e1['query'][_0x4d63('0x45')]){_0x531c10[_0x4d63('0x46')]=[{'all':!![]}];}return db[_0x4d63('0x61')][_0x4d63('0x47')](_0x531c10);})['then'](function(_0x23c2fb){_0x580ad3['rows']=_0x23c2fb;return _0x580ad3;});}})[_0x4d63('0x21')](respondWithFilteredResult(_0x3a40ea,_0x531c10))[_0x4d63('0x49')](handleError(_0x3a40ea,null));};exports[_0x4d63('0x62')]=function(_0x5fac2e,_0x13149e,_0x4a83c6){var _0x32259d={'raw':!![],'where':{}};var _0x52e8cc={};var _0x63f36d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x4d63('0x5b')]({'where':{'id':_0x5fac2e['params']['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x13149e,null))[_0x4d63('0x21')](function(_0x41576c){if(_0x41576c){_0x52e8cc['model']=_[_0x4d63('0x39')](db[_0x4d63('0x63')][_0x4d63('0x34')]);_0x52e8cc[_0x4d63('0x38')]=_[_0x4d63('0x39')](_0x5fac2e[_0x4d63('0x38')]);_0x52e8cc[_0x4d63('0x3a')]=_[_0x4d63('0x4b')](_0x52e8cc[_0x4d63('0x37')],_0x52e8cc['query']);_0x32259d[_0x4d63('0x3b')]=_[_0x4d63('0x4b')](_0x52e8cc[_0x4d63('0x37')],qs[_0x4d63('0x3c')](_0x5fac2e[_0x4d63('0x38')][_0x4d63('0x3c')]));_0x32259d[_0x4d63('0x3b')]=_0x32259d['attributes'][_0x4d63('0x5d')]?_0x32259d[_0x4d63('0x3b')]:_0x52e8cc[_0x4d63('0x37')];if(!_0x5fac2e['query'][_0x4d63('0x3d')]('nolimit')){_0x32259d[_0x4d63('0x1c')]=qs['limit'](_0x5fac2e[_0x4d63('0x38')][_0x4d63('0x1c')]);_0x32259d[_0x4d63('0x1b')]=qs[_0x4d63('0x1b')](_0x5fac2e['query']['offset']);}_0x32259d[_0x4d63('0x5e')]=qs['sort'](_0x5fac2e[_0x4d63('0x38')]['sort']);_0x32259d[_0x4d63('0x40')]=qs[_0x4d63('0x3a')](_[_0x4d63('0x41')](_0x5fac2e[_0x4d63('0x38')],_0x52e8cc[_0x4d63('0x3a')]));_0x32259d['where'][_0x4d63('0x5f')]=_0x41576c['id'];if(_0x5fac2e[_0x4d63('0x38')]['filter']){_0x32259d['where']=_['merge'](_0x32259d['where'],{'$or':_[_0x4d63('0x2a')](_0x32259d[_0x4d63('0x3b')],function(_0x3b6d95){var _0x240bd2={};_0x240bd2[_0x3b6d95]={'$like':'%'+_0x5fac2e[_0x4d63('0x38')][_0x4d63('0x28')]+'%'};return _0x240bd2;})});}_0x32259d=_[_0x4d63('0x42')]({},_0x32259d,_0x5fac2e[_0x4d63('0x44')]);return db[_0x4d63('0x63')][_0x4d63('0x1e')]({'where':_0x32259d[_0x4d63('0x40')]})[_0x4d63('0x21')](function(_0x5708b0){_0x63f36d[_0x4d63('0x1e')]=_0x5708b0;if(_0x5fac2e['query'][_0x4d63('0x45')]){_0x32259d[_0x4d63('0x46')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x32259d);})[_0x4d63('0x21')](function(_0x38df36){_0x63f36d[_0x4d63('0x48')]=_0x38df36;return _0x63f36d;});}})['then'](respondWithFilteredResult(_0x13149e,_0x32259d))[_0x4d63('0x49')](handleError(_0x13149e,null));};exports[_0x4d63('0x64')]=function(_0x1cdacd,_0x483a1c,_0x14b53){var _0x3301d7={'raw':!![],'where':{}};var _0x325abf={};var _0x47dcb4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x4d63('0x5b')]({'where':{'id':_0x1cdacd[_0x4d63('0x4a')]['id']}})['then'](handleEntityNotFound(_0x483a1c,null))['then'](function(_0x10b7ce){if(_0x10b7ce){_0x325abf[_0x4d63('0x37')]=_['keys'](db['CmHopperBlack'][_0x4d63('0x34')]);_0x325abf[_0x4d63('0x38')]=_[_0x4d63('0x39')](_0x1cdacd[_0x4d63('0x38')]);_0x325abf[_0x4d63('0x3a')]=_['intersection'](_0x325abf['model'],_0x325abf['query']);_0x3301d7[_0x4d63('0x3b')]=_[_0x4d63('0x4b')](_0x325abf['model'],qs[_0x4d63('0x3c')](_0x1cdacd[_0x4d63('0x38')][_0x4d63('0x3c')]));_0x3301d7['attributes']=_0x3301d7[_0x4d63('0x3b')]['length']?_0x3301d7[_0x4d63('0x3b')]:_0x325abf[_0x4d63('0x37')];if(!_0x1cdacd[_0x4d63('0x38')][_0x4d63('0x3d')](_0x4d63('0x3e'))){_0x3301d7[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x1cdacd[_0x4d63('0x38')][_0x4d63('0x1c')]);_0x3301d7[_0x4d63('0x1b')]=qs['offset'](_0x1cdacd['query']['offset']);}_0x3301d7[_0x4d63('0x5e')]=qs[_0x4d63('0x3f')](_0x1cdacd[_0x4d63('0x38')][_0x4d63('0x3f')]);_0x3301d7['where']=qs[_0x4d63('0x3a')](_[_0x4d63('0x41')](_0x1cdacd[_0x4d63('0x38')],_0x325abf['filters']));_0x3301d7['where'][_0x4d63('0x5f')]=_0x10b7ce['id'];if(_0x1cdacd['query'][_0x4d63('0x28')]){_0x3301d7[_0x4d63('0x40')]=_[_0x4d63('0x42')](_0x3301d7[_0x4d63('0x40')],{'$or':_[_0x4d63('0x2a')](_0x3301d7[_0x4d63('0x3b')],function(_0x27d390){var _0x5d3b38={};_0x5d3b38[_0x27d390]={'$like':'%'+_0x1cdacd[_0x4d63('0x38')][_0x4d63('0x28')]+'%'};return _0x5d3b38;})});}_0x3301d7=_[_0x4d63('0x42')]({},_0x3301d7,_0x1cdacd[_0x4d63('0x44')]);return db[_0x4d63('0x65')]['count']({'where':_0x3301d7[_0x4d63('0x40')]})['then'](function(_0x5ca785){_0x47dcb4[_0x4d63('0x1e')]=_0x5ca785;if(_0x1cdacd['query'][_0x4d63('0x45')]){_0x3301d7[_0x4d63('0x46')]=[{'all':!![]}];}return db[_0x4d63('0x65')][_0x4d63('0x47')](_0x3301d7);})['then'](function(_0x999a83){_0x47dcb4['rows']=_0x999a83;return _0x47dcb4;});}})[_0x4d63('0x21')](respondWithFilteredResult(_0x483a1c,_0x3301d7))['catch'](handleError(_0x483a1c,null));};exports['getTeams']=function(_0x393454,_0x256d2a,_0xa2a747){var _0x11c18f={};var _0x2a6573={};var _0x12c5a6;var _0x4d40f5;return db[_0x4d63('0x33')][_0x4d63('0x5b')]({'where':{'id':_0x393454[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x256d2a,null))[_0x4d63('0x21')](function(_0xdbe2e1){if(_0xdbe2e1){_0x12c5a6=_0xdbe2e1;_0x2a6573[_0x4d63('0x37')]=_[_0x4d63('0x39')](db[_0x4d63('0x66')][_0x4d63('0x34')]);_0x2a6573['query']=_[_0x4d63('0x39')](_0x393454[_0x4d63('0x38')]);_0x2a6573[_0x4d63('0x3a')]=_['intersection'](_0x2a6573[_0x4d63('0x37')],_0x2a6573[_0x4d63('0x38')]);_0x11c18f[_0x4d63('0x3b')]=_[_0x4d63('0x4b')](_0x2a6573[_0x4d63('0x37')],qs['fields'](_0x393454[_0x4d63('0x38')][_0x4d63('0x3c')]));_0x11c18f[_0x4d63('0x3b')]=_0x11c18f[_0x4d63('0x3b')]['length']?_0x11c18f['attributes']:_0x2a6573[_0x4d63('0x37')];_0x11c18f[_0x4d63('0x5e')]=qs['sort'](_0x393454[_0x4d63('0x38')][_0x4d63('0x3f')]);_0x11c18f['where']=qs['filters'](_[_0x4d63('0x41')](_0x393454[_0x4d63('0x38')],_0x2a6573['filters']));if(_0x393454[_0x4d63('0x38')][_0x4d63('0x28')]){_0x11c18f['where']=_[_0x4d63('0x42')](_0x11c18f[_0x4d63('0x40')],{'$or':_[_0x4d63('0x2a')](_0x11c18f[_0x4d63('0x3b')],function(_0x805ad7){var _0x261c8f={};_0x261c8f[_0x805ad7]={'$like':'%'+_0x393454[_0x4d63('0x38')][_0x4d63('0x28')]+'%'};return _0x261c8f;})});}_0x11c18f=_[_0x4d63('0x42')]({},_0x11c18f,_0x393454[_0x4d63('0x44')]);return _0x12c5a6['getTeams'](_0x11c18f);}})[_0x4d63('0x21')](function(_0x51c357){if(_0x51c357){_0x4d40f5=_0x51c357[_0x4d63('0x5d')];if(!_0x393454[_0x4d63('0x38')]['hasOwnProperty'](_0x4d63('0x3e'))){_0x11c18f['limit']=qs[_0x4d63('0x1c')](_0x393454[_0x4d63('0x38')][_0x4d63('0x1c')]);_0x11c18f[_0x4d63('0x1b')]=qs[_0x4d63('0x1b')](_0x393454[_0x4d63('0x38')]['offset']);}return _0x12c5a6[_0x4d63('0x67')](_0x11c18f);}})[_0x4d63('0x21')](function(_0x34784c){if(_0x34784c){return _0x34784c?{'count':_0x4d40f5,'rows':_0x34784c}:null;}})[_0x4d63('0x21')](respondWithResult(_0x256d2a,null))['catch'](handleError(_0x256d2a,null));};exports[_0x4d63('0x68')]=function(_0x905114,_0x28d132,_0x10059b){var _0x4e6a7c=_0x905114[_0x4d63('0x4d')]['teams'];var _0x5efd67=_['map'](_0x4e6a7c,'id');return db['Team']['findAll']({'where':{'id':_0x5efd67},'attributes':['id'],'include':[{'model':db[_0x4d63('0x69')],'as':_0x4d63('0x6a'),'attributes':['id',_0x4d63('0x2e'),_0x4d63('0x6b'),_0x4d63('0x6c'),'interface'],'raw':!![]}]})['then'](function(_0xd927e){if(_0xd927e){var _0x3c9e86=_[_0x4d63('0x6d')](_0xd927e,function(_0x56c85b){var _0x849653=_0x56c85b['get']({'plain':!![]});_0x849653[_0x4d63('0x6a')][_0x4d63('0x6e')](function(_0x5af8e1){_0x5af8e1['penalty']=_['find'](_0x4e6a7c,{'id':_0x849653['id']})[_0x4d63('0x6f')];});return _0x849653[_0x4d63('0x6a')];});return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x905114['params']['id']}})[_0x4d63('0x21')](function(_0x369c92){return db[_0x4d63('0x70')][_0x4d63('0x71')](function(_0x3c233d){return _0x369c92[_0x4d63('0x68')](_0x5efd67,{'transaction':_0x3c233d})[_0x4d63('0x21')](function(){return BPromise[_0x4d63('0x72')](_0x4e6a7c,function(_0x38ca07){return db[_0x4d63('0x73')][_0x4d63('0x74')]({'TeamId':_0x38ca07['id'],'VoiceQueueId':_0x905114[_0x4d63('0x4a')]['id'],'penalty':_0x38ca07[_0x4d63('0x6f')]},{'transaction':_0x3c233d});});})['then'](function(){return BPromise[_0x4d63('0x72')](_0x3c9e86,function(_0x50eb4b){return db['UserVoiceQueue'][_0x4d63('0x75')]({'where':{'UserId':_0x50eb4b['id'],'VoiceQueueId':_0x905114['params']['id']},'defaults':{'penalty':_0x50eb4b[_0x4d63('0x6f')]},'transaction':_0x3c233d});});})['then'](function(){return BPromise[_0x4d63('0x72')](_[_0x4d63('0x28')](_0x3c9e86,{'online':!![]}),function(_0x40e6f3){return db[_0x4d63('0x76')][_0x4d63('0x74')]({'membername':_0x40e6f3[_0x4d63('0x2e')],'UserId':_0x40e6f3['id'],'queue_name':_0x369c92[_0x4d63('0x2e')],'VoiceQueueId':_0x369c92['id'],'interface':_[_0x4d63('0x77')](_0x40e6f3[_0x4d63('0x78')])?util[_0x4d63('0x79')]('SIP/%s',_0x40e6f3[_0x4d63('0x2e')]):_0x40e6f3[_0x4d63('0x78')],'paused':_0x40e6f3[_0x4d63('0x6c')]||![],'penalty':_0x40e6f3[_0x4d63('0x6f')]},{'transaction':_0x3c233d});});})[_0x4d63('0x21')](function(){_0x3c9e86[_0x4d63('0x6e')](function(_0x844d94){socket[_0x4d63('0x7a')](_0x4d63('0x7b'),{'UserId':_0x844d94['id'],'VoiceQueueId':_0x369c92['id']});});});});});}})[_0x4d63('0x21')](respondWithStatusCode(_0x28d132,null))[_0x4d63('0x49')](handleError(_0x28d132,null));};exports['removeTeams']=function(_0x1803ab,_0x4e5008,_0x13dbba){return db[_0x4d63('0x66')][_0x4d63('0x47')]({'where':{'id':_0x1803ab['query'][_0x4d63('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x4d63('0x69')],'as':_0x4d63('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x4d63('0x21')](handleEntityNotFound(_0x4e5008,null))['then'](function(_0x560ff8){var _0x4c136b=_[_0x4d63('0x2a')](_0x560ff8,'id');var _0x2fc8f4=[];var _0x11e0b4=[];var _0x2d2ce3=squel['select']();_0x2d2ce3[_0x4d63('0x7d')]('tq.TeamId')[_0x4d63('0x7e')](_0x4d63('0x7f'),'tq')[_0x4d63('0x80')](_0x4d63('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x4d63('0x82'),_0x1803ab['params']['id']);for(var _0x10af7d=0x0;_0x10af7d<_0x560ff8[_0x4d63('0x5d')];_0x10af7d+=0x1){let _0x79dd71=_0x560ff8[_0x10af7d];for(var _0x533a2c=0x0;_0x533a2c<_0x79dd71[_0x4d63('0x6a')][_0x4d63('0x5d')];_0x533a2c+=0x1){let _0x38016b=_0x79dd71['Agents'][_0x533a2c];var _0x1354e6=_0x2d2ce3[_0x4d63('0x55')]();_0x1354e6[_0x4d63('0x40')](_0x4d63('0x83'),_0x38016b['id']);_0x11e0b4[_0x4d63('0x84')](db[_0x4d63('0x70')]['query'](_0x1354e6[_0x4d63('0x85')](),{'type':db[_0x4d63('0x70')][_0x4d63('0x86')][_0x4d63('0x87')]})[_0x4d63('0x21')](function(_0x19c707){if(_0x19c707[_0x4d63('0x5d')]===0x1){return _0x38016b['id'];}else{var _0x436cb8=_['every'](_['map'](_0x19c707,_0x4d63('0x88')),function(_0x567da3){return _[_0x4d63('0x2c')](_0x4c136b,_0x567da3);});if(_0x436cb8){return _0x38016b['id'];}}}));}}return BPromise[_0x4d63('0x89')](_0x11e0b4)[_0x4d63('0x21')](function(_0x1f66b7){_0x2fc8f4=_(_0x2fc8f4)[_0x4d63('0x8a')](_0x1f66b7)[_0x4d63('0x8b')]()['value']();return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x1803ab[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](function(_0x306272){return db[_0x4d63('0x70')][_0x4d63('0x71')](function(_0x26ef5e){return _0x306272[_0x4d63('0x8c')](_0x1803ab[_0x4d63('0x38')]['ids'],{'transaction':_0x26ef5e})[_0x4d63('0x21')](function(){if(!_[_0x4d63('0x8d')](_0x2fc8f4)){return _0x306272[_0x4d63('0x8e')](_0x2fc8f4,{'transaction':_0x26ef5e})['then'](function(){return db[_0x4d63('0x76')][_0x4d63('0x22')]({'where':{'VoiceQueueId':_0x1803ab[_0x4d63('0x4a')]['id'],'UserId':_0x2fc8f4},'transaction':_0x26ef5e});});}})[_0x4d63('0x21')](function(){_0x2fc8f4[_0x4d63('0x6e')](function(_0x5ec5ee){socket[_0x4d63('0x7a')](_0x4d63('0x8f'),{'UserId':_0x5ec5ee,'VoiceQueueId':_0x306272['id']});});});});});});})['then'](respondWithStatusCode(_0x4e5008,null))[_0x4d63('0x49')](handleError(_0x4e5008,null));};exports[_0x4d63('0x90')]=function(_0x431b84,_0xbecffb,_0x414442){var _0x1dceb3,_0x28ebd0;return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x431b84[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0xbecffb,null))[_0x4d63('0x21')](function(_0x255556){if(_0x255556){_0x28ebd0=_0x255556;return _0x255556[_0x4d63('0x90')](_0x431b84[_0x4d63('0x4d')][_0x4d63('0x7c')],_['omit'](_0x431b84['body'],[_0x4d63('0x7c'),'id'])||{})[_0x4d63('0x91')](function(_0x12c221){for(var _0x450eed=0x0;_0x450eed<_0x431b84['body']['ids'][_0x4d63('0x5d')];_0x450eed+=0x1){socket[_0x4d63('0x7a')](_0x4d63('0x7b'),{'UserId':Number(_0x431b84[_0x4d63('0x4d')][_0x4d63('0x7c')][_0x450eed]),'VoiceQueueId':Number(_0x431b84[_0x4d63('0x4a')]['id'])});}return _0x12c221;});}})[_0x4d63('0x21')](function(_0x1116a1){_0x1dceb3=_0x1116a1||[];if(_0x28ebd0){return db['User'][_0x4d63('0x47')]({'where':{'id':_0x431b84[_0x4d63('0x4d')][_0x4d63('0x7c')]},'attributes':['id',_0x4d63('0x2e'),_0x4d63('0x6b'),'voicePause',_0x4d63('0x78')],'raw':!![]});}})[_0x4d63('0x21')](function(_0x4de8a2){if(!_[_0x4d63('0x8d')](_0x4de8a2)){var _0xdd1863=[];for(var _0x1a041b=0x0;_0x1a041b<_0x4de8a2[_0x4d63('0x5d')];_0x1a041b++){if(_0x4de8a2[_0x1a041b][_0x4d63('0x6b')]){_0xdd1863[_0x4d63('0x84')](db[_0x4d63('0x76')][_0x4d63('0x74')]({'membername':_0x4de8a2[_0x1a041b][_0x4d63('0x2e')],'UserId':_0x4de8a2[_0x1a041b]['id'],'queue_name':_0x28ebd0[_0x4d63('0x2e')],'VoiceQueueId':_0x28ebd0['id'],'interface':_[_0x4d63('0x77')](_0x4de8a2[_0x1a041b][_0x4d63('0x78')])?util[_0x4d63('0x79')]('SIP/%s',_0x4de8a2[_0x1a041b][_0x4d63('0x2e')]):_0x4de8a2[_0x1a041b][_0x4d63('0x78')],'paused':_0x4de8a2[_0x1a041b][_0x4d63('0x6c')]||![],'penalty':_0x431b84[_0x4d63('0x4d')]['penalty']||0x0}));}}return BPromise[_0x4d63('0x89')](_0xdd1863);}})[_0x4d63('0x21')](function(){return _0x1dceb3;})['then'](respondWithResult(_0xbecffb,null))[_0x4d63('0x49')](handleError(_0xbecffb,null));};exports[_0x4d63('0x8e')]=function(_0x137a28,_0x12777f,_0x4e73f7){return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x137a28[_0x4d63('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12777f,null))[_0x4d63('0x21')](function(_0x196c6e){if(_0x196c6e){return _0x196c6e[_0x4d63('0x8e')](_0x137a28['query'][_0x4d63('0x7c')])[_0x4d63('0x21')](function(){if(_[_0x4d63('0x92')](_0x137a28[_0x4d63('0x38')][_0x4d63('0x7c')])){for(var _0xb91d9e=0x0;_0xb91d9e<_0x137a28['query'][_0x4d63('0x7c')][_0x4d63('0x5d')];_0xb91d9e+=0x1){socket[_0x4d63('0x7a')](_0x4d63('0x8f'),{'UserId':Number(_0x137a28[_0x4d63('0x38')]['ids'][_0xb91d9e]),'VoiceQueueId':Number(_0x137a28[_0x4d63('0x4a')]['id'])});}}else{socket[_0x4d63('0x7a')](_0x4d63('0x8f'),{'UserId':Number(_0x137a28['query'][_0x4d63('0x7c')]),'VoiceQueueId':Number(_0x137a28[_0x4d63('0x4a')]['id'])});}});}})['then'](function(_0x19be36){return db[_0x4d63('0x76')][_0x4d63('0x22')]({'where':{'VoiceQueueId':_0x137a28[_0x4d63('0x4a')]['id'],'UserId':_0x137a28[_0x4d63('0x38')][_0x4d63('0x7c')]}})[_0x4d63('0x21')](function(){return _0x19be36;});})['then'](respondWithStatusCode(_0x12777f,null))[_0x4d63('0x49')](handleError(_0x12777f,null));};exports[_0x4d63('0x93')]=function(_0x11dedb,_0x32fd4a,_0x4a6e90){var _0x1d3605={};var _0x4edda4={};var _0x21d36b;var _0x16d7c6;return db[_0x4d63('0x33')][_0x4d63('0x5b')]({'where':{'id':_0x11dedb['params']['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x32fd4a,null))[_0x4d63('0x21')](function(_0x4b03e1){if(_0x4b03e1){_0x21d36b=_0x4b03e1;_0x4edda4[_0x4d63('0x37')]=_[_0x4d63('0x39')](db[_0x4d63('0x69')][_0x4d63('0x34')]);_0x4edda4[_0x4d63('0x38')]=_[_0x4d63('0x39')](_0x11dedb[_0x4d63('0x38')]);_0x4edda4['filters']=_[_0x4d63('0x4b')](_0x4edda4[_0x4d63('0x37')],_0x4edda4[_0x4d63('0x38')]);_0x1d3605['attributes']=_[_0x4d63('0x4b')](_0x4edda4[_0x4d63('0x37')],qs[_0x4d63('0x3c')](_0x11dedb[_0x4d63('0x38')][_0x4d63('0x3c')]));_0x1d3605[_0x4d63('0x3b')]=_0x1d3605[_0x4d63('0x3b')][_0x4d63('0x5d')]?_0x1d3605[_0x4d63('0x3b')]:_0x4edda4[_0x4d63('0x37')];_0x1d3605['order']=qs['sort'](_0x11dedb['query']['sort']);_0x1d3605[_0x4d63('0x40')]=qs[_0x4d63('0x3a')](_[_0x4d63('0x41')](_0x11dedb[_0x4d63('0x38')],_0x4edda4[_0x4d63('0x3a')]));if(_0x11dedb[_0x4d63('0x38')][_0x4d63('0x28')]){_0x1d3605[_0x4d63('0x40')]=_[_0x4d63('0x42')](_0x1d3605[_0x4d63('0x40')],{'$or':_[_0x4d63('0x2a')](_0x1d3605[_0x4d63('0x3b')],function(_0x15205b){var _0x2495b4={};_0x2495b4[_0x15205b]={'$like':'%'+_0x11dedb['query'][_0x4d63('0x28')]+'%'};return _0x2495b4;})});}_0x1d3605=_[_0x4d63('0x42')]({},_0x1d3605,_0x11dedb[_0x4d63('0x44')]);return _0x21d36b[_0x4d63('0x93')](_0x1d3605);}})[_0x4d63('0x21')](function(_0x17e178){if(_0x17e178){_0x16d7c6=_0x17e178[_0x4d63('0x5d')];if(!_0x11dedb[_0x4d63('0x38')][_0x4d63('0x3d')](_0x4d63('0x3e'))){_0x1d3605[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x11dedb[_0x4d63('0x38')][_0x4d63('0x1c')]);_0x1d3605[_0x4d63('0x1b')]=qs['offset'](_0x11dedb[_0x4d63('0x38')][_0x4d63('0x1b')]);}return _0x21d36b[_0x4d63('0x93')](_0x1d3605);}})[_0x4d63('0x21')](function(_0x2920d1){if(_0x2920d1){return _0x2920d1?{'count':_0x16d7c6,'rows':_0x2920d1}:null;}})['then'](respondWithResult(_0x32fd4a,null))['catch'](handleError(_0x32fd4a,null));};exports[_0x4d63('0x94')]=function(_0x25294b,_0x50f96f,_0x4e4f69){var _0x53f44c={};var _0x33f09c={};var _0x44b1a7;var _0x14be3d;return db['VoiceQueue'][_0x4d63('0x5b')]({'where':{'id':_0x25294b[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x50f96f,null))[_0x4d63('0x21')](function(_0x16319c){if(_0x16319c){_0x44b1a7=_0x16319c;_0x33f09c[_0x4d63('0x37')]=_['keys'](db['UserVoiceQueueRt']['rawAttributes']);_0x33f09c[_0x4d63('0x38')]=_[_0x4d63('0x39')](_0x25294b[_0x4d63('0x38')]);_0x33f09c[_0x4d63('0x3a')]=_[_0x4d63('0x4b')](_0x33f09c[_0x4d63('0x37')],_0x33f09c[_0x4d63('0x38')]);_0x53f44c[_0x4d63('0x3b')]=_[_0x4d63('0x4b')](_0x33f09c[_0x4d63('0x37')],qs[_0x4d63('0x3c')](_0x25294b['query']['fields']));_0x53f44c['attributes']=_0x53f44c[_0x4d63('0x3b')][_0x4d63('0x5d')]?_0x53f44c[_0x4d63('0x3b')]:_0x33f09c[_0x4d63('0x37')];_0x53f44c[_0x4d63('0x5e')]=qs[_0x4d63('0x3f')](_0x25294b[_0x4d63('0x38')][_0x4d63('0x3f')]);_0x53f44c[_0x4d63('0x40')]=qs['filters'](_[_0x4d63('0x41')](_0x25294b['query'],_0x33f09c[_0x4d63('0x3a')]));if(_0x25294b[_0x4d63('0x38')]['filter']){_0x53f44c[_0x4d63('0x40')]=_['merge'](_0x53f44c['where'],{'$or':_[_0x4d63('0x2a')](_0x53f44c['attributes'],function(_0x2d0915){var _0x148a74={};_0x148a74[_0x2d0915]={'$like':'%'+_0x25294b[_0x4d63('0x38')][_0x4d63('0x28')]+'%'};return _0x148a74;})});}_0x53f44c=_['merge']({},_0x53f44c,_0x25294b['options']);return _0x44b1a7[_0x4d63('0x94')](_0x53f44c);}})['then'](function(_0x52428b){if(_0x52428b){_0x14be3d=_0x52428b[_0x4d63('0x5d')];if(!_0x25294b[_0x4d63('0x38')][_0x4d63('0x3d')]('nolimit')){_0x53f44c[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x25294b[_0x4d63('0x38')][_0x4d63('0x1c')]);_0x53f44c[_0x4d63('0x1b')]=qs[_0x4d63('0x1b')](_0x25294b['query'][_0x4d63('0x1b')]);}return _0x44b1a7[_0x4d63('0x94')](_0x53f44c);}})['then'](function(_0x53a229){return _0x53a229?{'count':_0x14be3d,'rows':_0x53a229}:null;})[_0x4d63('0x21')](respondWithResult(_0x50f96f,null))[_0x4d63('0x49')](handleError(_0x50f96f,null));};exports[_0x4d63('0x95')]=function(_0x2d7382,_0xb07e46,_0x8b926a){var _0x475cb1={};var _0x308f69={};var _0x3757ef;var _0x59477e;return db['VoiceQueue'][_0x4d63('0x5b')]({'where':{'id':_0x2d7382[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0xb07e46,null))['then'](function(_0x1c0e28){if(_0x1c0e28){_0x3757ef=_0x1c0e28;_0x308f69[_0x4d63('0x37')]=_[_0x4d63('0x39')](db[_0x4d63('0x96')][_0x4d63('0x34')]);_0x308f69[_0x4d63('0x38')]=_['keys'](_0x2d7382[_0x4d63('0x38')]);_0x308f69[_0x4d63('0x3a')]=_[_0x4d63('0x4b')](_0x308f69[_0x4d63('0x37')],_0x308f69[_0x4d63('0x38')]);_0x475cb1[_0x4d63('0x3b')]=_['intersection'](_0x308f69[_0x4d63('0x37')],qs[_0x4d63('0x3c')](_0x2d7382['query'][_0x4d63('0x3c')]));_0x475cb1[_0x4d63('0x3b')]=_0x475cb1[_0x4d63('0x3b')][_0x4d63('0x5d')]?_0x475cb1[_0x4d63('0x3b')]:_0x308f69[_0x4d63('0x37')];_0x475cb1['order']=qs['sort'](_0x2d7382['query'][_0x4d63('0x3f')]);_0x475cb1[_0x4d63('0x40')]=qs[_0x4d63('0x3a')](_[_0x4d63('0x41')](_0x2d7382[_0x4d63('0x38')],_0x308f69[_0x4d63('0x3a')]));if(_0x2d7382[_0x4d63('0x38')]['filter']){_0x475cb1['where']=_[_0x4d63('0x42')](_0x475cb1[_0x4d63('0x40')],{'$or':_[_0x4d63('0x2a')](_0x475cb1['attributes'],function(_0x21823f){var _0x9c4133={};_0x9c4133[_0x21823f]={'$like':'%'+_0x2d7382[_0x4d63('0x38')][_0x4d63('0x28')]+'%'};return _0x9c4133;})});}_0x475cb1=_['merge']({},_0x475cb1,_0x2d7382[_0x4d63('0x44')]);return _0x3757ef[_0x4d63('0x95')](_0x475cb1);}})['then'](function(_0x4e8467){if(_0x4e8467){_0x59477e=_0x4e8467[_0x4d63('0x5d')];if(!_0x2d7382[_0x4d63('0x38')][_0x4d63('0x3d')](_0x4d63('0x3e'))){_0x475cb1[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x2d7382['query'][_0x4d63('0x1c')]);_0x475cb1[_0x4d63('0x1b')]=qs[_0x4d63('0x1b')](_0x2d7382[_0x4d63('0x38')][_0x4d63('0x1b')]);}return _0x3757ef['getLists'](_0x475cb1);}})['then'](function(_0x1c4272){if(_0x1c4272){return _0x1c4272?{'count':_0x59477e,'rows':_0x1c4272}:null;}})[_0x4d63('0x21')](respondWithResult(_0xb07e46,null))[_0x4d63('0x49')](handleError(_0xb07e46,null));};exports['addLists']=function(_0x598843,_0x230581,_0xf5a1ac){var _0xd81895=moment()[_0x4d63('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2d6416,_0x174063;return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x598843[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x230581,null))[_0x4d63('0x21')](function(_0x10a52d){if(_0x10a52d){_0x174063=_0x10a52d;return _0x10a52d[_0x4d63('0x97')](_0x598843[_0x4d63('0x4d')]['ids'],_[_0x4d63('0x56')](_0x598843[_0x4d63('0x4d')],[_0x4d63('0x7c'),'id'])||{});}return null;})[_0x4d63('0x91')](function(_0x78a4d9){var _0x2ee86f;_0x2d6416=_0x78a4d9||[];var _0xe5d186=[];if(_0x78a4d9){for(var _0x49405a=0x0;_0x49405a<_0x78a4d9[_0x4d63('0x5d')];_0x49405a+=0x1){var _0x25cc8c=_0x78a4d9[_0x49405a][_0x4d63('0x23')]({'plain':!![]});_0x174063[_0x4d63('0x98')]=_0x598843[_0x4d63('0x4d')][_0x4d63('0x98')]?_0x598843[_0x4d63('0x4d')][_0x4d63('0x98')]:_0x174063[_0x4d63('0x98')];switch(_0x174063['dialCheckDuplicateType']){case'always':_0x2ee86f=squel[_0x4d63('0x99')]()[_0x4d63('0x9a')]('cm_hopper')[_0x4d63('0x9b')]([_0x4d63('0x9c'),'scheduledAt','ContactId','ListId',_0x4d63('0x5f'),_0x4d63('0x58'),_0x4d63('0x57')],squel['select']()[_0x4d63('0x7d')](_0x4d63('0x9c'),'phone')[_0x4d63('0x7d')]('\x27'+_0xd81895+'\x27',_0x4d63('0x9d'))[_0x4d63('0x7d')]('id',_0x4d63('0x9e'))[_0x4d63('0x7d')](_0x25cc8c[_0x4d63('0x9f')][_0x4d63('0x85')](),_0x4d63('0xa0'))[_0x4d63('0x7d')](_0x598843[_0x4d63('0x4a')]['id'][_0x4d63('0x85')](),_0x4d63('0x5f'))[_0x4d63('0x7d')]('\x27'+_0xd81895+'\x27','createdAt')['field']('\x27'+_0xd81895+'\x27','updatedAt')['from']('cm_contacts')[_0x4d63('0x40')]('deletedAt\x20IS\x20NULL')[_0x4d63('0x40')](_0x4d63('0xa1'),_0x25cc8c[_0x4d63('0x9f')][_0x4d63('0x85')]())['where'](_0x4d63('0xa2'))[_0x4d63('0x40')](_0x4d63('0xa3'),squel['select']()[_0x4d63('0x7d')](_0x4d63('0xa4'))[_0x4d63('0x7e')]('cm_hopper_final')[_0x4d63('0x40')]('VoiceQueueId\x20=\x20?',_0x598843[_0x4d63('0x4a')]['id'][_0x4d63('0x85')]()))[_0x4d63('0x40')](_0x4d63('0xa3'),squel[_0x4d63('0xa5')]()['field']('COALESCE(phone,\x27\x27)')[_0x4d63('0x7e')]('cm_hopper')[_0x4d63('0x40')]('VoiceQueueId\x20=\x20?',_0x598843[_0x4d63('0x4a')]['id'][_0x4d63('0x85')]())))['toString']();break;case _0x4d63('0xa6'):_0x2ee86f=squel[_0x4d63('0x99')]()[_0x4d63('0x9a')](_0x4d63('0xa7'))[_0x4d63('0x9b')]([_0x4d63('0x9c'),_0x4d63('0x9d'),'ContactId',_0x4d63('0xa0'),_0x4d63('0x5f'),_0x4d63('0x58'),'updatedAt'],squel['select']()['field']('phone',_0x4d63('0x9c'))[_0x4d63('0x7d')]('\x27'+_0xd81895+'\x27',_0x4d63('0x9d'))[_0x4d63('0x7d')]('id',_0x4d63('0x9e'))[_0x4d63('0x7d')](_0x25cc8c[_0x4d63('0x9f')][_0x4d63('0x85')](),'ListId')[_0x4d63('0x7d')](_0x598843[_0x4d63('0x4a')]['id'][_0x4d63('0x85')](),_0x4d63('0x5f'))[_0x4d63('0x7d')]('\x27'+_0xd81895+'\x27',_0x4d63('0x58'))[_0x4d63('0x7d')]('\x27'+_0xd81895+'\x27',_0x4d63('0x57'))[_0x4d63('0x7e')]('cm_contacts')[_0x4d63('0x40')](_0x4d63('0xa8'))['where'](_0x4d63('0xa1'),_0x25cc8c[_0x4d63('0x9f')][_0x4d63('0x85')]())[_0x4d63('0x40')](_0x4d63('0xa2'))[_0x4d63('0x40')](_0x4d63('0xa3'),squel['select']()[_0x4d63('0x7d')](_0x4d63('0xa9'))[_0x4d63('0x7e')](_0x4d63('0xa7'))[_0x4d63('0x40')]('VoiceQueueId\x20=\x20?',_0x598843[_0x4d63('0x4a')]['id'][_0x4d63('0x85')]())))[_0x4d63('0x85')]();break;default:_0x2ee86f=squel['insert']()[_0x4d63('0x9a')](_0x4d63('0xa7'))[_0x4d63('0x9b')]([_0x4d63('0x9c'),'scheduledAt','ContactId',_0x4d63('0xa0'),_0x4d63('0x5f'),_0x4d63('0x58'),_0x4d63('0x57')],squel['select']()['field'](_0x4d63('0x9c'),_0x4d63('0x9c'))[_0x4d63('0x7d')]('\x27'+_0xd81895+'\x27','scheduledAt')[_0x4d63('0x7d')]('id',_0x4d63('0x9e'))[_0x4d63('0x7d')](_0x25cc8c[_0x4d63('0x9f')][_0x4d63('0x85')](),_0x4d63('0xa0'))[_0x4d63('0x7d')](_0x598843['params']['id'][_0x4d63('0x85')](),'VoiceQueueId')['field']('\x27'+_0xd81895+'\x27',_0x4d63('0x58'))['field']('\x27'+_0xd81895+'\x27',_0x4d63('0x57'))[_0x4d63('0x7e')](_0x4d63('0xaa'))[_0x4d63('0x40')](_0x4d63('0xa8'))[_0x4d63('0x40')](_0x4d63('0xa1'),_0x25cc8c[_0x4d63('0x9f')][_0x4d63('0x85')]())[_0x4d63('0x40')](_0x4d63('0xa2')))[_0x4d63('0x85')]();}_0xe5d186[_0x4d63('0x84')](db['sequelize'][_0x4d63('0x38')](_0x2ee86f));}return BPromise['all'](_0xe5d186);}})[_0x4d63('0x21')](function(){var _0x3263a6=[];var _0x184ba2=squel[_0x4d63('0x99')]()[_0x4d63('0x9a')]('cm_hopper_additional_phones')[_0x4d63('0x9b')]([_0x4d63('0xab'),_0x4d63('0x9c'),_0x4d63('0xac'),_0x4d63('0x58'),_0x4d63('0x57')],squel['select']()[_0x4d63('0x7d')](_0x4d63('0xad'))['field'](_0x4d63('0xae'))[_0x4d63('0x7d')](_0x4d63('0xaf'))[_0x4d63('0x7d')]('\x27'+_0xd81895+'\x27',_0x4d63('0x58'))[_0x4d63('0x7d')]('\x27'+_0xd81895+'\x27',_0x4d63('0x57'))[_0x4d63('0x7e')]('cm_contact_has_items','ci')[_0x4d63('0x80')]('cm_hopper','h',_0x4d63('0xb0'))[_0x4d63('0x40')]('h.scheduledat=?',_0xd81895)[_0x4d63('0x40')]('ci.ItemClass=?',_0x4d63('0xb1')))['toString']();_0x3263a6['push'](db[_0x4d63('0x70')][_0x4d63('0x38')](_0x184ba2));return BPromise[_0x4d63('0x89')](_0x3263a6);})[_0x4d63('0x21')](function(){return _0x2d6416;})['then'](respondWithResult(_0x230581,null))[_0x4d63('0x49')](handleError(_0x230581,null));};exports[_0x4d63('0xb2')]=function(_0x4bd424,_0x39bc49,_0x7be4a2){return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x4bd424['params']['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x39bc49,null))[_0x4d63('0x21')](function(_0x11453e){if(_0x11453e){return _0x11453e[_0x4d63('0xb2')](_0x4bd424['query'][_0x4d63('0x7c')]);}})[_0x4d63('0x21')](function(_0x60c727){if(_0x60c727){return db[_0x4d63('0x5c')][_0x4d63('0x22')]({'where':{'ListId':_0x4bd424[_0x4d63('0x38')][_0x4d63('0x7c')],'VoiceQueueId':_0x4bd424[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](function(){return _0x60c727;});}})[_0x4d63('0x21')](respondWithStatusCode(_0x39bc49,null))[_0x4d63('0x49')](handleError(_0x39bc49,null));};exports[_0x4d63('0xb3')]=function(_0x3499ac,_0x8bb1e0,_0x348167){var _0x5dcc36={};var _0x370585={};var _0x190e67;var _0x2c5b87;return db[_0x4d63('0x33')][_0x4d63('0x5b')]({'where':{'id':_0x3499ac[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x8bb1e0,null))[_0x4d63('0x21')](function(_0x192dc4){if(_0x192dc4){_0x190e67=_0x192dc4;_0x370585['model']=_[_0x4d63('0x39')](db[_0x4d63('0x96')]['rawAttributes']);_0x370585[_0x4d63('0x38')]=_['keys'](_0x3499ac[_0x4d63('0x38')]);_0x370585[_0x4d63('0x3a')]=_[_0x4d63('0x4b')](_0x370585[_0x4d63('0x37')],_0x370585[_0x4d63('0x38')]);_0x5dcc36[_0x4d63('0x3b')]=_[_0x4d63('0x4b')](_0x370585[_0x4d63('0x37')],qs[_0x4d63('0x3c')](_0x3499ac[_0x4d63('0x38')][_0x4d63('0x3c')]));_0x5dcc36[_0x4d63('0x3b')]=_0x5dcc36['attributes']['length']?_0x5dcc36[_0x4d63('0x3b')]:_0x370585[_0x4d63('0x37')];_0x5dcc36[_0x4d63('0x5e')]=qs[_0x4d63('0x3f')](_0x3499ac[_0x4d63('0x38')]['sort']);_0x5dcc36[_0x4d63('0x40')]=qs[_0x4d63('0x3a')](_[_0x4d63('0x41')](_0x3499ac[_0x4d63('0x38')],_0x370585[_0x4d63('0x3a')]));if(_0x3499ac[_0x4d63('0x38')][_0x4d63('0x28')]){_0x5dcc36[_0x4d63('0x40')]=_[_0x4d63('0x42')](_0x5dcc36[_0x4d63('0x40')],{'$or':_[_0x4d63('0x2a')](_0x5dcc36[_0x4d63('0x3b')],function(_0x2180c6){var _0x496532={};_0x496532[_0x2180c6]={'$like':'%'+_0x3499ac['query']['filter']+'%'};return _0x496532;})});}_0x5dcc36=_[_0x4d63('0x42')]({},_0x5dcc36,_0x3499ac['options']);return _0x190e67[_0x4d63('0xb3')](_0x5dcc36);}})[_0x4d63('0x21')](function(_0x107d35){if(_0x107d35){_0x2c5b87=_0x107d35[_0x4d63('0x5d')];if(!_0x3499ac[_0x4d63('0x38')][_0x4d63('0x3d')](_0x4d63('0x3e'))){_0x5dcc36[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x3499ac[_0x4d63('0x38')]['limit']);_0x5dcc36[_0x4d63('0x1b')]=qs[_0x4d63('0x1b')](_0x3499ac[_0x4d63('0x38')][_0x4d63('0x1b')]);}return _0x190e67['getBlackLists'](_0x5dcc36);}})[_0x4d63('0x21')](function(_0x11b836){if(_0x11b836){return _0x11b836?{'count':_0x2c5b87,'rows':_0x11b836}:null;}})[_0x4d63('0x21')](respondWithResult(_0x8bb1e0,null))[_0x4d63('0x49')](handleError(_0x8bb1e0,null));};exports[_0x4d63('0xb4')]=function(_0x382d6b,_0x33a957,_0x1489c0){var _0x29e09d,_0x264062;return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x382d6b[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x33a957,null))[_0x4d63('0x21')](function(_0x2d2e7b){if(_0x2d2e7b){_0x264062=_0x2d2e7b;return _0x2d2e7b['addBlackLists'](_0x382d6b['body'][_0x4d63('0x7c')],_['omit'](_0x382d6b[_0x4d63('0x4d')],[_0x4d63('0x7c'),'id'])||{});}return null;})[_0x4d63('0x91')](function(_0x1972a1){var _0x7c0c40;_0x29e09d=_0x1972a1||[];var _0x232648=[];if(_0x1972a1){for(var _0x43c10b=0x0;_0x43c10b<_0x1972a1[_0x4d63('0x5d')];_0x43c10b+=0x1){var _0x4c9d90=_0x1972a1[_0x43c10b][_0x4d63('0x23')]({'plain':!![]});_0x7c0c40=squel[_0x4d63('0x99')]()[_0x4d63('0x9a')](_0x4d63('0xb5'))[_0x4d63('0x9b')]([_0x4d63('0x9c'),_0x4d63('0x9e'),_0x4d63('0xa0'),'VoiceQueueId',_0x4d63('0x58'),'updatedAt'],squel[_0x4d63('0xa5')]()['field'](_0x4d63('0x9c'),_0x4d63('0x9c'))[_0x4d63('0x7d')]('id','ContactId')[_0x4d63('0x7d')](_0x4c9d90[_0x4d63('0x9f')][_0x4d63('0x85')](),_0x4d63('0xa0'))['field'](_0x382d6b[_0x4d63('0x4a')]['id'][_0x4d63('0x85')](),_0x4d63('0x5f'))[_0x4d63('0x7d')](_0x4d63('0xb6'),'createdAt')['field'](_0x4d63('0xb6'),'updatedAt')[_0x4d63('0x7e')](_0x4d63('0xaa'))[_0x4d63('0x40')]('deletedAt\x20IS\x20NULL')[_0x4d63('0x40')](_0x4d63('0xa1'),_0x4c9d90[_0x4d63('0x9f')]['toString']())['where'](_0x4d63('0xa2')))['toString']();_0x232648[_0x4d63('0x84')](db[_0x4d63('0x70')][_0x4d63('0x38')](_0x7c0c40));}return BPromise['all'](_0x232648);}})[_0x4d63('0x21')](function(){return _0x29e09d;})['then'](respondWithResult(_0x33a957,null))[_0x4d63('0x49')](handleError(_0x33a957,null));};exports[_0x4d63('0xb7')]=function(_0x4b7423,_0x3afa38,_0x553646){return db[_0x4d63('0x33')][_0x4d63('0x50')]({'where':{'id':_0x4b7423[_0x4d63('0x4a')]['id']}})[_0x4d63('0x21')](handleEntityNotFound(_0x3afa38,null))[_0x4d63('0x21')](function(_0x27fce0){if(_0x27fce0){return _0x27fce0[_0x4d63('0xb7')](_0x4b7423[_0x4d63('0x38')][_0x4d63('0x7c')]);}})[_0x4d63('0x21')](function(_0x3ae70b){if(_0x3ae70b){return db[_0x4d63('0x65')][_0x4d63('0x22')]({'where':{'ListId':_0x4b7423[_0x4d63('0x38')][_0x4d63('0x7c')],'VoiceQueueId':_0x4b7423['params']['id']}})[_0x4d63('0x21')](function(){return _0x3ae70b;});}})[_0x4d63('0x21')](respondWithStatusCode(_0x3afa38,null))[_0x4d63('0x49')](handleError(_0x3afa38,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e1ac59a..d8d6583 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 _0xdead=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xdead,0x1ce));var _0xddea=function(_0x1fae3c,_0x41a75c){_0x1fae3c=_0x1fae3c-0x0;var _0x384ddf=_0xdead[_0x1fae3c];return _0x384ddf;};'use strict';var EventEmitter=require(_0xddea('0x0'));var VoiceQueue=require(_0xddea('0x1'))['db'][_0xddea('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xddea('0x3')](0x0);var events={'afterCreate':_0xddea('0x4'),'afterUpdate':_0xddea('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1cc1e5){return function(_0x4786e1,_0x425c9f,_0x26618f){VoiceQueueEvents[_0xddea('0x6')](_0x1cc1e5+':'+_0x4786e1['id'],_0x4786e1);VoiceQueueEvents[_0xddea('0x6')](_0x1cc1e5,_0x4786e1);_0x26618f(null);};}for(var e in events){if(events[_0xddea('0x7')](e)){var event=events[e];VoiceQueue[_0xddea('0x8')](e,emitEvent(event));}}module[_0xddea('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xd89f=['hasOwnProperty','events','../../mysqldb','VoiceQueue','update','remove','emit'];(function(_0x6278d6,_0x279722){var _0x5a9e69=function(_0x368eee){while(--_0x368eee){_0x6278d6['push'](_0x6278d6['shift']());}};_0x5a9e69(++_0x279722);}(_0xd89f,0x15f));var _0xfd89=function(_0x29a979,_0x328325){_0x29a979=_0x29a979-0x0;var _0x4cfbd6=_0xd89f[_0x29a979];return _0x4cfbd6;};'use strict';var EventEmitter=require(_0xfd89('0x0'));var VoiceQueue=require(_0xfd89('0x1'))['db'][_0xfd89('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd89('0x3'),'afterDestroy':_0xfd89('0x4')};function emitEvent(_0x8e6f60){return function(_0x5729e5,_0x46a765,_0x1aebe7){VoiceQueueEvents['emit'](_0x8e6f60+':'+_0x5729e5['id'],_0x5729e5);VoiceQueueEvents[_0xfd89('0x5')](_0x8e6f60,_0x5729e5);_0x1aebe7(null);};}for(var e in events){if(events[_0xfd89('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 8c0cb13..4365f19 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(_0x3c2542,_0x5738e5){var _0x4482f9=function(_0x40b0d4){while(--_0x40b0d4){_0x3c2542['push'](_0x3c2542['shift']());}};_0x4482f9(++_0x5738e5);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a7b83,_0x3b4250){_0x4a7b83=_0x4a7b83-0x0;var _0x376a86=_0xedd9[_0x4a7b83];return _0x376a86;};'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(_0x3123e9,_0x171dc8){var _0xb5a650=function(_0x3e9a3f){while(--_0x3e9a3f){_0x3123e9['push'](_0x3123e9['shift']());}};_0xb5a650(++_0x171dc8);}(_0xedd9,0xfc));var _0x9edd=function(_0x188b76,_0x35ea5e){_0x188b76=_0x188b76-0x0;var _0xc850c8=_0xedd9[_0x188b76];return _0xc850c8;};'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 6cef08a..e3c7c18 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 _0xdc8b=['VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','map','include','model','ShowVoiceQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info'];(function(_0x46baf5,_0x555a71){var _0x22b878=function(_0x1f9bad){while(--_0x1f9bad){_0x46baf5['push'](_0x46baf5['shift']());}};_0x22b878(++_0x555a71);}(_0xdc8b,0x119));var _0xbdc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc8b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbdc8('0x0'));var util=require('util');var moment=require(_0xbdc8('0x1'));var BPromise=require(_0xbdc8('0x2'));var rs=require(_0xbdc8('0x3'));var fs=require('fs');var Redis=require(_0xbdc8('0x4'));var db=require(_0xbdc8('0x5'))['db'];var utils=require(_0xbdc8('0x6'));var logger=require(_0xbdc8('0x7'))(_0xbdc8('0x8'));var config=require('../../config/environment');var jayson=require(_0xbdc8('0x9'));var client=jayson[_0xbdc8('0xa')][_0xbdc8('0xb')]({'port':0x232a});config[_0xbdc8('0xc')]=_[_0xbdc8('0xd')](config['redis'],{'host':_0xbdc8('0xe'),'port':0x18eb});var socket=require(_0xbdc8('0xf'))(new Redis(config[_0xbdc8('0xc')]));require(_0xbdc8('0x10'))['register'](socket);function respondWithRpcPromise(_0x587650,_0x4cf29b,_0x37ba4f){return new BPromise(function(_0x138704,_0x266113){return client[_0xbdc8('0x11')](_0x587650,_0x37ba4f)[_0xbdc8('0x12')](function(_0x13626d){logger[_0xbdc8('0x13')](_0xbdc8('0x14'),_0x4cf29b,_0xbdc8('0x15'));logger[_0xbdc8('0x16')](_0xbdc8('0x17'),_0x4cf29b,_0xbdc8('0x15'),JSON[_0xbdc8('0x18')](_0x13626d));if(_0x13626d['error']){if(_0x13626d[_0xbdc8('0x19')][_0xbdc8('0x1a')]===0x1f4){logger[_0xbdc8('0x19')](_0xbdc8('0x14'),_0x4cf29b,_0x13626d[_0xbdc8('0x19')][_0xbdc8('0x1b')]);return _0x266113(_0x13626d[_0xbdc8('0x19')][_0xbdc8('0x1b')]);}logger[_0xbdc8('0x19')](_0xbdc8('0x14'),_0x4cf29b,_0x13626d[_0xbdc8('0x19')]['message']);return _0x138704(_0x13626d[_0xbdc8('0x19')][_0xbdc8('0x1b')]);}else{logger[_0xbdc8('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x4cf29b,_0xbdc8('0x15'));_0x138704(_0x13626d[_0xbdc8('0x1c')][_0xbdc8('0x1b')]);}})[_0xbdc8('0x1d')](function(_0x5a076f){logger[_0xbdc8('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x4cf29b,_0x5a076f);_0x266113(_0x5a076f);});});}exports[_0xbdc8('0x1e')]=function(_0x4391e6){var _0x6a4739=this;return new Promise(function(_0x27d6a2,_0x3f1c57){return db[_0xbdc8('0x1f')][_0xbdc8('0x20')]({'raw':_0x4391e6['options']?_0x4391e6['options']['raw']===undefined?!![]:![]:!![],'where':_0x4391e6[_0xbdc8('0x21')]?_0x4391e6['options'][_0xbdc8('0x22')]||null:null,'attributes':_0x4391e6[_0xbdc8('0x21')]?_0x4391e6[_0xbdc8('0x21')][_0xbdc8('0x23')]||null:null,'limit':_0x4391e6['options']?_0x4391e6[_0xbdc8('0x21')][_0xbdc8('0x24')]||null:null,'include':_0x4391e6['options']?_0x4391e6[_0xbdc8('0x21')]['include']?_[_0xbdc8('0x25')](_0x4391e6[_0xbdc8('0x21')][_0xbdc8('0x26')],function(_0x5e93e1){return{'model':db[_0x5e93e1[_0xbdc8('0x27')]],'as':_0x5e93e1['as'],'attributes':_0x5e93e1[_0xbdc8('0x23')],'include':_0x5e93e1[_0xbdc8('0x26')]?_[_0xbdc8('0x25')](_0x5e93e1[_0xbdc8('0x26')],function(_0x35e4ee){return{'model':db[_0x35e4ee[_0xbdc8('0x27')]],'as':_0x35e4ee['as'],'attributes':_0x35e4ee[_0xbdc8('0x23')],'include':_0x35e4ee[_0xbdc8('0x26')]?_[_0xbdc8('0x25')](_0x35e4ee[_0xbdc8('0x26')],function(_0x5b3c61){return{'model':db[_0x5b3c61[_0xbdc8('0x27')]],'as':_0x5b3c61['as'],'attributes':_0x5b3c61[_0xbdc8('0x23')]};}):[]};}):[]};}):[]:[]})[_0xbdc8('0x12')](function(_0x562647){logger['info'](_0xbdc8('0x1e'),_0x4391e6);logger['debug'](_0xbdc8('0x1e'),_0x4391e6,JSON[_0xbdc8('0x18')](_0x562647));_0x27d6a2(_0x562647);})[_0xbdc8('0x1d')](function(_0x15f40e){logger[_0xbdc8('0x19')](_0xbdc8('0x1e'),_0x15f40e[_0xbdc8('0x1b')],_0x4391e6);_0x3f1c57(_0x6a4739['error'](0x1f4,_0x15f40e[_0xbdc8('0x1b')]));});});};exports[_0xbdc8('0x28')]=function(_0x1747a9){var _0x6488ae=this;return new Promise(function(_0x325fa3,_0x4fbe07){return db[_0xbdc8('0x1f')][_0xbdc8('0x29')]({'raw':_0x1747a9['options']?_0x1747a9[_0xbdc8('0x21')][_0xbdc8('0x2a')]===undefined?!![]:![]:!![],'where':_0x1747a9[_0xbdc8('0x21')]?_0x1747a9['options'][_0xbdc8('0x22')]||null:null,'attributes':_0x1747a9[_0xbdc8('0x21')]?_0x1747a9[_0xbdc8('0x21')]['attributes']||null:null,'include':_0x1747a9[_0xbdc8('0x21')]?_0x1747a9[_0xbdc8('0x21')][_0xbdc8('0x26')]?_[_0xbdc8('0x25')](_0x1747a9[_0xbdc8('0x21')]['include'],function(_0x1443aa){return{'model':db[_0x1443aa[_0xbdc8('0x27')]],'as':_0x1443aa['as'],'attributes':_0x1443aa[_0xbdc8('0x23')],'include':_0x1443aa['include']?_['map'](_0x1443aa[_0xbdc8('0x26')],function(_0x4cb568){return{'model':db[_0x4cb568[_0xbdc8('0x27')]],'as':_0x4cb568['as'],'attributes':_0x4cb568[_0xbdc8('0x23')],'include':_0x4cb568[_0xbdc8('0x26')]?_[_0xbdc8('0x25')](_0x4cb568[_0xbdc8('0x26')],function(_0x1f043c){return{'model':db[_0x1f043c[_0xbdc8('0x27')]],'as':_0x1f043c['as'],'attributes':_0x1f043c['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdc8('0x12')](function(_0x518912){logger[_0xbdc8('0x13')](_0xbdc8('0x28'),_0x1747a9);logger[_0xbdc8('0x16')](_0xbdc8('0x28'),_0x1747a9,JSON[_0xbdc8('0x18')](_0x518912));_0x325fa3(_0x518912);})[_0xbdc8('0x1d')](function(_0x448343){logger[_0xbdc8('0x19')](_0xbdc8('0x28'),_0x448343[_0xbdc8('0x1b')],_0x1747a9);_0x4fbe07(_0x6488ae[_0xbdc8('0x19')](0x1f4,_0x448343[_0xbdc8('0x1b')]));});});}; \ No newline at end of file +var _0x9db1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','model','attributes','map','then','ShowVoiceQueue','find','lodash'];(function(_0x2ff950,_0x1823b3){var _0x366db1=function(_0x593611){while(--_0x593611){_0x2ff950['push'](_0x2ff950['shift']());}};_0x366db1(++_0x1823b3);}(_0x9db1,0x199));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x19db('0x0'));var util=require('util');var moment=require(_0x19db('0x1'));var BPromise=require(_0x19db('0x2'));var rs=require(_0x19db('0x3'));var fs=require('fs');var Redis=require(_0x19db('0x4'));var db=require(_0x19db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x19db('0x6'))('rpc');var config=require(_0x19db('0x7'));var jayson=require(_0x19db('0x8'));var client=jayson[_0x19db('0x9')][_0x19db('0xa')]({'port':0x232a});config[_0x19db('0xb')]=_[_0x19db('0xc')](config[_0x19db('0xb')],{'host':_0x19db('0xd'),'port':0x18eb});var socket=require(_0x19db('0xe'))(new Redis(config[_0x19db('0xb')]));require(_0x19db('0xf'))['register'](socket);function respondWithRpcPromise(_0x5a4f9d,_0x269661,_0x505583){return new BPromise(function(_0x3ceac8,_0xe83c8b){return client['request'](_0x5a4f9d,_0x505583)['then'](function(_0x3e9986){logger[_0x19db('0x10')](_0x19db('0x11'),_0x269661,_0x19db('0x12'));logger[_0x19db('0x13')](_0x19db('0x14'),_0x269661,_0x19db('0x12'),JSON[_0x19db('0x15')](_0x3e9986));if(_0x3e9986[_0x19db('0x16')]){if(_0x3e9986['error'][_0x19db('0x17')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x269661,_0x3e9986['error'][_0x19db('0x18')]);return _0xe83c8b(_0x3e9986['error']['message']);}logger['error'](_0x19db('0x11'),_0x269661,_0x3e9986['error']['message']);return _0x3ceac8(_0x3e9986[_0x19db('0x16')][_0x19db('0x18')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x269661,_0x19db('0x12'));_0x3ceac8(_0x3e9986[_0x19db('0x19')][_0x19db('0x18')]);}})[_0x19db('0x1a')](function(_0x5b2ce3){logger['error'](_0x19db('0x11'),_0x269661,_0x5b2ce3);_0xe83c8b(_0x5b2ce3);});});}exports[_0x19db('0x1b')]=function(_0x475013){var _0x313b38=this;return new Promise(function(_0x487276,_0x37cb1b){return db[_0x19db('0x1c')][_0x19db('0x1d')]({'raw':_0x475013['options']?_0x475013[_0x19db('0x1e')][_0x19db('0x1f')]===undefined?!![]:![]:!![],'where':_0x475013[_0x19db('0x1e')]?_0x475013[_0x19db('0x1e')][_0x19db('0x20')]||null:null,'attributes':_0x475013[_0x19db('0x1e')]?_0x475013[_0x19db('0x1e')]['attributes']||null:null,'limit':_0x475013[_0x19db('0x1e')]?_0x475013['options'][_0x19db('0x21')]||null:null,'include':_0x475013['options']?_0x475013[_0x19db('0x1e')][_0x19db('0x22')]?_['map'](_0x475013['options'][_0x19db('0x22')],function(_0x713de1){return{'model':db[_0x713de1[_0x19db('0x23')]],'as':_0x713de1['as'],'attributes':_0x713de1[_0x19db('0x24')],'include':_0x713de1[_0x19db('0x22')]?_['map'](_0x713de1[_0x19db('0x22')],function(_0x4058ec){return{'model':db[_0x4058ec[_0x19db('0x23')]],'as':_0x4058ec['as'],'attributes':_0x4058ec[_0x19db('0x24')],'include':_0x4058ec[_0x19db('0x22')]?_[_0x19db('0x25')](_0x4058ec['include'],function(_0x3a2b21){return{'model':db[_0x3a2b21['model']],'as':_0x3a2b21['as'],'attributes':_0x3a2b21[_0x19db('0x24')]};}):[]};}):[]};}):[]:[]})[_0x19db('0x26')](function(_0x372ba5){logger['info']('GetVoiceQueue',_0x475013);logger[_0x19db('0x13')](_0x19db('0x1b'),_0x475013,JSON[_0x19db('0x15')](_0x372ba5));_0x487276(_0x372ba5);})['catch'](function(_0x46050d){logger[_0x19db('0x16')](_0x19db('0x1b'),_0x46050d[_0x19db('0x18')],_0x475013);_0x37cb1b(_0x313b38['error'](0x1f4,_0x46050d['message']));});});};exports[_0x19db('0x27')]=function(_0x171cd7){var _0x4f70be=this;return new Promise(function(_0x5104a9,_0x3e7ef9){return db[_0x19db('0x1c')][_0x19db('0x28')]({'raw':_0x171cd7[_0x19db('0x1e')]?_0x171cd7['options'][_0x19db('0x1f')]===undefined?!![]:![]:!![],'where':_0x171cd7[_0x19db('0x1e')]?_0x171cd7[_0x19db('0x1e')][_0x19db('0x20')]||null:null,'attributes':_0x171cd7['options']?_0x171cd7[_0x19db('0x1e')][_0x19db('0x24')]||null:null,'include':_0x171cd7[_0x19db('0x1e')]?_0x171cd7[_0x19db('0x1e')]['include']?_[_0x19db('0x25')](_0x171cd7['options'][_0x19db('0x22')],function(_0x3d2001){return{'model':db[_0x3d2001[_0x19db('0x23')]],'as':_0x3d2001['as'],'attributes':_0x3d2001[_0x19db('0x24')],'include':_0x3d2001['include']?_['map'](_0x3d2001['include'],function(_0x3ddde4){return{'model':db[_0x3ddde4[_0x19db('0x23')]],'as':_0x3ddde4['as'],'attributes':_0x3ddde4[_0x19db('0x24')],'include':_0x3ddde4[_0x19db('0x22')]?_[_0x19db('0x25')](_0x3ddde4[_0x19db('0x22')],function(_0x39e764){return{'model':db[_0x39e764['model']],'as':_0x39e764['as'],'attributes':_0x39e764['attributes']};}):[]};}):[]};}):[]:[]})[_0x19db('0x26')](function(_0x3a97b1){logger[_0x19db('0x10')](_0x19db('0x27'),_0x171cd7);logger[_0x19db('0x13')]('ShowVoiceQueue',_0x171cd7,JSON[_0x19db('0x15')](_0x3a97b1));_0x5104a9(_0x3a97b1);})[_0x19db('0x1a')](function(_0x1d6814){logger['error'](_0x19db('0x27'),_0x1d6814[_0x19db('0x18')],_0x171cd7);_0x3e7ef9(_0x4f70be[_0x19db('0x16')](0x1f4,_0x1d6814[_0x19db('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3ceac25..493bc1c 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 _0x4fb5=['removeListener','register','length','voiceQueue:','./voiceQueue.events','save','update','emit'];(function(_0x12af58,_0x5ebe31){var _0x517d57=function(_0x30a2be){while(--_0x30a2be){_0x12af58['push'](_0x12af58['shift']());}};_0x517d57(++_0x5ebe31);}(_0x4fb5,0x64));var _0x54fb=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x4fb5[_0x42bc91];return _0x3f5507;};'use strict';var VoiceQueueEvents=require(_0x54fb('0x0'));var events=[_0x54fb('0x1'),'remove',_0x54fb('0x2')];function createListener(_0x3f5bba,_0x1d692d){return function(_0xca5ce3){_0x1d692d[_0x54fb('0x3')](_0x3f5bba,_0xca5ce3);};}function removeListener(_0x31f652,_0x269307){return function(){VoiceQueueEvents[_0x54fb('0x4')](_0x31f652,_0x269307);};}exports[_0x54fb('0x5')]=function(_0x294ed5){for(var _0x30795a=0x0,_0x318bc4=events[_0x54fb('0x6')];_0x30795a<_0x318bc4;_0x30795a++){var _0x55f2b6=events[_0x30795a];var _0x225bac=createListener(_0x54fb('0x7')+_0x55f2b6,_0x294ed5);VoiceQueueEvents['on'](_0x55f2b6,_0x225bac);}}; \ No newline at end of file +var _0xa002=['update','emit','removeListener','register','length','./voiceQueue.events','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa002,0x65));var _0x2a00=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa002[_0x42cae2];return _0x5f256f;};'use strict';var VoiceQueueEvents=require(_0x2a00('0x0'));var events=[_0x2a00('0x1'),_0x2a00('0x2'),_0x2a00('0x3')];function createListener(_0x4565b6,_0x470e22){return function(_0x3118b5){_0x470e22[_0x2a00('0x4')](_0x4565b6,_0x3118b5);};}function removeListener(_0x48af91,_0x460e22){return function(){VoiceQueueEvents[_0x2a00('0x5')](_0x48af91,_0x460e22);};}exports[_0x2a00('0x6')]=function(_0x348ade){for(var _0x4006fb=0x0,_0x13f243=events[_0x2a00('0x7')];_0x4006fb<_0x13f243;_0x4006fb++){var _0x5877d6=events[_0x4006fb];var _0x5eab91=createListener('voiceQueue:'+_0x5877d6,_0x348ade);VoiceQueueEvents['on'](_0x5877d6,_0x5eab91);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 6766219..376a466 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 _0xa4d5=['update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id'];(function(_0x3b6648,_0x2d723a){var _0x5a0a0d=function(_0x133dea){while(--_0x133dea){_0x3b6648['push'](_0x3b6648['shift']());}};_0x5a0a0d(++_0x2d723a);}(_0xa4d5,0x16c));var _0x5a4d=function(_0x4dc763,_0x22bff4){_0x4dc763=_0x4dc763-0x0;var _0x292fe1=_0xa4d5[_0x4dc763];return _0x292fe1;};'use strict';var multer=require(_0x5a4d('0x0'));var util=require(_0x5a4d('0x1'));var path=require(_0x5a4d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5a4d('0x3'));var auth=require(_0x5a4d('0x4'));var interaction=require(_0x5a4d('0x5'));var config=require(_0x5a4d('0x6'));var controller=require(_0x5a4d('0x7'));router[_0x5a4d('0x8')]('/',auth[_0x5a4d('0x9')](),controller[_0x5a4d('0xa')]);router[_0x5a4d('0x8')](_0x5a4d('0xb'),auth[_0x5a4d('0x9')](),controller[_0x5a4d('0xc')]);router[_0x5a4d('0x8')](_0x5a4d('0xd'),auth['isAuthenticated'](),controller[_0x5a4d('0xe')]);router[_0x5a4d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5a4d('0xf')]);router[_0x5a4d('0x10')]('/',auth[_0x5a4d('0x9')](),controller[_0x5a4d('0x11')]);router[_0x5a4d('0x12')](_0x5a4d('0x13'),auth[_0x5a4d('0x9')](),controller[_0x5a4d('0x14')]);router[_0x5a4d('0x15')](_0x5a4d('0x13'),auth[_0x5a4d('0x9')](),controller[_0x5a4d('0x16')]);module[_0x5a4d('0x17')]=router; \ No newline at end of file +var _0xdb51=['index','/describe','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0xd5ff03,_0x44b2ef){var _0x57db38=function(_0xc49b46){while(--_0xc49b46){_0xd5ff03['push'](_0xd5ff03['shift']());}};_0x57db38(++_0x44b2ef);}(_0xdb51,0x1d9));var _0x1db5=function(_0x5e9c7c,_0x36c48f){_0x5e9c7c=_0x5e9c7c-0x0;var _0x1100de=_0xdb51[_0x5e9c7c];return _0x1100de;};'use strict';var multer=require(_0x1db5('0x0'));var util=require(_0x1db5('0x1'));var path=require(_0x1db5('0x2'));var timeout=require(_0x1db5('0x3'));var express=require(_0x1db5('0x4'));var router=express[_0x1db5('0x5')]();var fs_extra=require(_0x1db5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1db5('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x1db5('0x8')]('/',auth[_0x1db5('0x9')](),controller[_0x1db5('0xa')]);router[_0x1db5('0x8')](_0x1db5('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x1db5('0x8')]('/index',auth[_0x1db5('0x9')](),controller[_0x1db5('0xc')]);router[_0x1db5('0x8')](_0x1db5('0xd'),auth[_0x1db5('0x9')](),controller[_0x1db5('0xe')]);router[_0x1db5('0xf')]('/',auth[_0x1db5('0x9')](),controller[_0x1db5('0x10')]);router[_0x1db5('0x11')](_0x1db5('0xd'),auth[_0x1db5('0x9')](),controller[_0x1db5('0x12')]);router[_0x1db5('0x13')](_0x1db5('0xd'),auth[_0x1db5('0x9')](),controller['destroy']);module[_0x1db5('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 3411bb1..84e33e3 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 _0x9827=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0xb276fc,_0x43d5e8){var _0x319478=function(_0x20deaa){while(--_0x20deaa){_0xb276fc['push'](_0xb276fc['shift']());}};_0x319478(++_0x43d5e8);}(_0x9827,0x13d));var _0x7982=function(_0x243f79,_0x429e45){_0x243f79=_0x243f79-0x0;var _0x460321=_0x9827[_0x243f79];return _0x460321;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7982('0x0'));module['exports']={'type':{'type':Sequelize[_0x7982('0x1')]},'uniqueid':{'type':Sequelize[_0x7982('0x1')]},'calleridnum':{'type':Sequelize[_0x7982('0x1')]},'calleridname':{'type':Sequelize[_0x7982('0x1')]},'queue':{'type':Sequelize[_0x7982('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x7982('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x1e7edf){var _0x4fc7cc=moment(_0x1e7edf);var _0x5b769e=moment(this[_0x7982('0x3')](_0x7982('0x4')))['format'](_0x7982('0x5'));var _0x37ee61=_0x4fc7cc[_0x7982('0x6')](_0x5b769e,_0x7982('0x7'));this['setDataValue']('queuecallerleaveAt',_0x1e7edf);this['setDataValue'](_0x7982('0x8'),_0x37ee61||null);}},'position':{'type':Sequelize[_0x7982('0x9')]},'count':{'type':Sequelize[_0x7982('0x9')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7982('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x7982('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7982('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x7982('0x1')],'comment':_0x7982('0xb')},'originalposition':{'type':Sequelize[_0x7982('0x9')]},'channel':{'type':Sequelize[_0x7982('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7982('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7982('0x1')]},'context':{'type':Sequelize[_0x7982('0x1')]},'exten':{'type':Sequelize[_0x7982('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7982('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x7982('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7982('0x1')],'comment':_0x7982('0xc')},'transferexten':{'type':Sequelize[_0x7982('0x1')]},'transferuniqueid':{'type':Sequelize[_0x7982('0x1')]},'disposition':{'type':Sequelize[_0x7982('0x1')]},'secondDisposition':{'type':Sequelize[_0x7982('0x1')]},'thirdDisposition':{'type':Sequelize[_0x7982('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x7982('0x9')],'defaultValue':0x0},'note':{'type':Sequelize[_0x7982('0x1')]}}; \ No newline at end of file +var _0xdcbc=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','setDataValue','holdtime','INTEGER','BOOLEAN'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xdcbc,0x114));var _0xcdcb=function(_0x5e3c52,_0x1a9b59){_0x5e3c52=_0x5e3c52-0x0;var _0x28fa43=_0xdcbc[_0x5e3c52];return _0x28fa43;};'use strict';var Sequelize=require(_0xcdcb('0x0'));var moment=require(_0xcdcb('0x1'));module[_0xcdcb('0x2')]={'type':{'type':Sequelize[_0xcdcb('0x3')]},'uniqueid':{'type':Sequelize[_0xcdcb('0x3')]},'calleridnum':{'type':Sequelize[_0xcdcb('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xcdcb('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xcdcb('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xcdcb('0x4')],'set':function(_0x2731cf){var _0x549f17=moment(_0x2731cf);var _0x427911=moment(this[_0xcdcb('0x5')]('queuecallerjoinAt'))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x30c689=_0x549f17['diff'](_0x427911,'seconds');this[_0xcdcb('0x6')]('queuecallerleaveAt',_0x2731cf);this[_0xcdcb('0x6')](_0xcdcb('0x7'),_0x30c689||null);}},'position':{'type':Sequelize[_0xcdcb('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xcdcb('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xcdcb('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xcdcb('0x4')]},'queuecallerexit':{'type':Sequelize[_0xcdcb('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xcdcb('0x3')],'comment':_0xcdcb('0xa')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xcdcb('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xcdcb('0x3')]},'accountcode':{'type':Sequelize[_0xcdcb('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xcdcb('0x3')]},'priority':{'type':Sequelize[_0xcdcb('0x3')]},'holdtime':{'type':Sequelize[_0xcdcb('0x8')]},'mohtime':{'type':Sequelize[_0xcdcb('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcdcb('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcdcb('0x3')]},'transfer':{'type':Sequelize[_0xcdcb('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xcdcb('0x3')]},'transferuniqueid':{'type':Sequelize[_0xcdcb('0x3')]},'disposition':{'type':Sequelize[_0xcdcb('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcdcb('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xcdcb('0x8')],'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 001892c..aa4737b 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 _0x6ccf=['create','body','update','describe','pick','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','sendStatus','status','end','json','offset','limit','count','save','then','destroy','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find'];(function(_0x12e613,_0xbdde12){var _0x19d255=function(_0x419e98){while(--_0x419e98){_0x12e613['push'](_0x12e613['shift']());}};_0x19d255(++_0xbdde12);}(_0x6ccf,0x1e0));var _0xf6cc=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x6ccf[_0x31ced5];return _0x10d9e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6cc('0x0'));var zipdir=require(_0xf6cc('0x1'));var jsonpatch=require(_0xf6cc('0x2'));var rp=require(_0xf6cc('0x3'));var moment=require(_0xf6cc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf6cc('0x5'));var path=require(_0xf6cc('0x6'));var sox=require(_0xf6cc('0x7'));var csv=require(_0xf6cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6cc('0x9'));var _=require(_0xf6cc('0xa'));var squel=require(_0xf6cc('0xb'));var crypto=require('crypto');var jsforce=require(_0xf6cc('0xc'));var deskjs=require(_0xf6cc('0xd'));var toCsv=require(_0xf6cc('0x8'));var querystring=require(_0xf6cc('0xe'));var Papa=require(_0xf6cc('0xf'));var Redis=require(_0xf6cc('0x10'));var authService=require(_0xf6cc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6cc('0x12'))(_0xf6cc('0x13'));var utils=require(_0xf6cc('0x14'));var config=require(_0xf6cc('0x15'));var licenseUtil=require(_0xf6cc('0x16'));var db=require(_0xf6cc('0x17'))['db'];config[_0xf6cc('0x18')]=_[_0xf6cc('0x19')](config['redis'],{'host':_0xf6cc('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6cc('0x18')]));require(_0xf6cc('0x1b'))['register'](socket);function respondWithStatusCode(_0x1a3be1,_0x241123){_0x241123=_0x241123||0xcc;return function(_0x508cc6){if(_0x508cc6){return _0x1a3be1[_0xf6cc('0x1c')](_0x241123);}return _0x1a3be1[_0xf6cc('0x1d')](_0x241123)[_0xf6cc('0x1e')]();};}function respondWithResult(_0xe4337d,_0x42af87){_0x42af87=_0x42af87||0xc8;return function(_0x58a5c8){if(_0x58a5c8){return _0xe4337d[_0xf6cc('0x1d')](_0x42af87)[_0xf6cc('0x1f')](_0x58a5c8);}};}function respondWithFilteredResult(_0x578257,_0x4bfad9){return function(_0x3c01cf){if(_0x3c01cf){var _0x3c7957=typeof _0x4bfad9[_0xf6cc('0x20')]==='undefined'&&typeof _0x4bfad9[_0xf6cc('0x21')]==='undefined';var _0x5344ea=_0x3c01cf[_0xf6cc('0x22')];var _0x5cd529=_0x3c7957?0x0:_0x4bfad9['offset'];var _0x42d3df=_0x3c7957?_0x3c01cf['count']:_0x4bfad9[_0xf6cc('0x20')]+_0x4bfad9[_0xf6cc('0x21')];var _0x1db912;if(_0x42d3df>=_0x5344ea){_0x42d3df=_0x5344ea;_0x1db912=0xc8;}else{_0x1db912=0xce;}_0x578257[_0xf6cc('0x1d')](_0x1db912);return _0x578257['set']('Content-Range',_0x5cd529+'-'+_0x42d3df+'/'+_0x5344ea)[_0xf6cc('0x1f')](_0x3c01cf);}return null;};}function patchUpdates(_0x301c29){return function(_0x37c14a){try{jsonpatch['apply'](_0x37c14a,_0x301c29,!![]);}catch(_0x2c4433){return BPromise['reject'](_0x2c4433);}return _0x37c14a[_0xf6cc('0x23')]();};}function saveUpdates(_0x58896e,_0x1e4b91){return function(_0x528ab6){if(_0x528ab6){return _0x528ab6['update'](_0x58896e)[_0xf6cc('0x24')](function(_0x284c4e){return _0x284c4e;});}return null;};}function removeEntity(_0x444c6d,_0x3587a1){return function(_0x3a2e2b){if(_0x3a2e2b){return _0x3a2e2b[_0xf6cc('0x25')]()[_0xf6cc('0x24')](function(){_0x444c6d[_0xf6cc('0x1d')](0xcc)[_0xf6cc('0x1e')]();});}};}function handleEntityNotFound(_0x31cc1a,_0x2e3556){return function(_0x7e6cb2){if(!_0x7e6cb2){_0x31cc1a[_0xf6cc('0x1c')](0x194);}return _0x7e6cb2;};}function handleError(_0xbd9a81,_0x17d38f){_0x17d38f=_0x17d38f||0x1f4;return function(_0x2ae97d){logger['error'](_0x2ae97d[_0xf6cc('0x26')]);if(_0x2ae97d[_0xf6cc('0x27')]){delete _0x2ae97d[_0xf6cc('0x27')];}_0xbd9a81['status'](_0x17d38f)[_0xf6cc('0x28')](_0x2ae97d);};}exports[_0xf6cc('0x29')]=function(_0x22cc96,_0x577984){var _0x492d3d={},_0x35eb93={},_0x2ebd7d={'count':0x0,'rows':[]};var _0x160f5d=_[_0xf6cc('0x2a')](db[_0xf6cc('0x2b')][_0xf6cc('0x2c')],function(_0x2f4aa7){return{'name':_0x2f4aa7[_0xf6cc('0x2d')],'type':_0x2f4aa7[_0xf6cc('0x2e')][_0xf6cc('0x2f')]};});_0x35eb93[_0xf6cc('0x30')]=_[_0xf6cc('0x2a')](_0x160f5d,'name');_0x35eb93[_0xf6cc('0x31')]=_[_0xf6cc('0x32')](_0x22cc96[_0xf6cc('0x31')]);_0x35eb93[_0xf6cc('0x33')]=_['intersection'](_0x35eb93['model'],_0x35eb93[_0xf6cc('0x31')]);_0x492d3d[_0xf6cc('0x34')]=_[_0xf6cc('0x35')](_0x35eb93[_0xf6cc('0x30')],qs[_0xf6cc('0x36')](_0x22cc96['query'][_0xf6cc('0x36')]));_0x492d3d[_0xf6cc('0x34')]=_0x492d3d[_0xf6cc('0x34')][_0xf6cc('0x37')]?_0x492d3d[_0xf6cc('0x34')]:_0x35eb93['model'];if(!_0x22cc96[_0xf6cc('0x31')][_0xf6cc('0x38')](_0xf6cc('0x39'))){_0x492d3d[_0xf6cc('0x21')]=qs['limit'](_0x22cc96[_0xf6cc('0x31')][_0xf6cc('0x21')]);_0x492d3d[_0xf6cc('0x20')]=qs[_0xf6cc('0x20')](_0x22cc96['query']['offset']);}_0x492d3d[_0xf6cc('0x3a')]=qs[_0xf6cc('0x3b')](_0x22cc96[_0xf6cc('0x31')][_0xf6cc('0x3b')]);_0x492d3d[_0xf6cc('0x3c')]=qs['filters'](_['pick'](_0x22cc96[_0xf6cc('0x31')],_0x35eb93['filters']),_0x160f5d);if(_0x22cc96['query'][_0xf6cc('0x3d')]){_0x492d3d[_0xf6cc('0x3c')]=_['merge'](_0x492d3d[_0xf6cc('0x3c')],{'$or':_['map'](_0x160f5d,function(_0x1e8838){if(_0x1e8838[_0xf6cc('0x2e')]!==_0xf6cc('0x3e')){var _0x7bb1df={};_0x7bb1df[_0x1e8838['name']]={'$like':'%'+_0x22cc96[_0xf6cc('0x31')][_0xf6cc('0x3d')]+'%'};return _0x7bb1df;}})});}_0x492d3d=_[_0xf6cc('0x3f')]({},_0x492d3d,_0x22cc96[_0xf6cc('0x40')]);var _0x4bc025={'where':_0x492d3d[_0xf6cc('0x3c')]};return db[_0xf6cc('0x2b')][_0xf6cc('0x22')](_0x4bc025)[_0xf6cc('0x24')](function(_0x1069cc){_0x2ebd7d[_0xf6cc('0x22')]=_0x1069cc;if(_0x22cc96[_0xf6cc('0x31')]['includeAll']){_0x492d3d['include']=[{'all':!![]}];}return db[_0xf6cc('0x2b')][_0xf6cc('0x41')](_0x492d3d);})['then'](function(_0x5e84d1){_0x2ebd7d[_0xf6cc('0x42')]=_0x5e84d1;return _0x2ebd7d;})['then'](respondWithFilteredResult(_0x577984,_0x492d3d))[_0xf6cc('0x43')](handleError(_0x577984,null));};exports[_0xf6cc('0x44')]=function(_0x899fd6,_0x54cd2b){var _0x5d1484={'raw':![],'where':{'id':_0x899fd6[_0xf6cc('0x45')]['id']}},_0x66980f={};_0x66980f['model']=_[_0xf6cc('0x32')](db[_0xf6cc('0x2b')][_0xf6cc('0x2c')]);_0x66980f[_0xf6cc('0x31')]=_['keys'](_0x899fd6[_0xf6cc('0x31')]);_0x66980f['filters']=_['intersection'](_0x66980f[_0xf6cc('0x30')],_0x66980f[_0xf6cc('0x31')]);_0x5d1484['attributes']=_[_0xf6cc('0x35')](_0x66980f[_0xf6cc('0x30')],qs[_0xf6cc('0x36')](_0x899fd6[_0xf6cc('0x31')]['fields']));_0x5d1484['attributes']=_0x5d1484[_0xf6cc('0x34')][_0xf6cc('0x37')]?_0x5d1484['attributes']:_0x66980f[_0xf6cc('0x30')];if(_0x899fd6[_0xf6cc('0x31')][_0xf6cc('0x46')]){_0x5d1484[_0xf6cc('0x47')]=[{'all':!![]}];}_0x5d1484=_[_0xf6cc('0x3f')]({},_0x5d1484,_0x899fd6['options']);return db['VoiceQueueReport'][_0xf6cc('0x48')](_0x5d1484)[_0xf6cc('0x24')](handleEntityNotFound(_0x54cd2b,null))[_0xf6cc('0x24')](respondWithResult(_0x54cd2b,null))['catch'](handleError(_0x54cd2b,null));};exports['create']=function(_0x41512e,_0x4a6da2){return db[_0xf6cc('0x2b')][_0xf6cc('0x49')](_0x41512e[_0xf6cc('0x4a')],{})[_0xf6cc('0x24')](respondWithResult(_0x4a6da2,0xc9))[_0xf6cc('0x43')](handleError(_0x4a6da2,null));};exports[_0xf6cc('0x4b')]=function(_0x50e9e3,_0x491608){if(_0x50e9e3[_0xf6cc('0x4a')]['id']){delete _0x50e9e3[_0xf6cc('0x4a')]['id'];}return db[_0xf6cc('0x2b')]['find']({'where':{'id':_0x50e9e3[_0xf6cc('0x45')]['id']}})[_0xf6cc('0x24')](handleEntityNotFound(_0x491608,null))[_0xf6cc('0x24')](saveUpdates(_0x50e9e3[_0xf6cc('0x4a')],null))['then'](respondWithResult(_0x491608,null))[_0xf6cc('0x43')](handleError(_0x491608,null));};exports['destroy']=function(_0x1fb5dc,_0x3988bc){return db[_0xf6cc('0x2b')][_0xf6cc('0x48')]({'where':{'id':_0x1fb5dc[_0xf6cc('0x45')]['id']}})[_0xf6cc('0x24')](handleEntityNotFound(_0x3988bc,null))[_0xf6cc('0x24')](removeEntity(_0x3988bc,null))['catch'](handleError(_0x3988bc,null));};exports[_0xf6cc('0x4c')]=function(_0x2e5da3,_0x21f52f){return db[_0xf6cc('0x2b')]['describe']()[_0xf6cc('0x24')](respondWithResult(_0x21f52f,null))[_0xf6cc('0x43')](handleError(_0x21f52f,null));};exports['getVoiceQueuesReport']=function(_0x1b491c,_0x3a59a2){var _0xa1dab1={},_0x43f2c1={},_0x3075b7={'count':0x0,'rows':[]};_0x43f2c1[_0xf6cc('0x30')]=_[_0xf6cc('0x32')](db['VoiceQueueReport'][_0xf6cc('0x2c')]);_0x43f2c1['query']=_[_0xf6cc('0x32')](_0x1b491c['query']);_0x43f2c1[_0xf6cc('0x33')]=_['intersection'](_0x43f2c1[_0xf6cc('0x30')],_0x43f2c1['query']);_0xa1dab1['attributes']=_[_0xf6cc('0x35')](_0x43f2c1[_0xf6cc('0x30')],qs['fields'](_0x1b491c[_0xf6cc('0x31')][_0xf6cc('0x36')]));_0xa1dab1['attributes']=_0xa1dab1[_0xf6cc('0x34')][_0xf6cc('0x37')]?_0xa1dab1[_0xf6cc('0x34')]:_0x43f2c1['model'];if(!_0x1b491c[_0xf6cc('0x31')][_0xf6cc('0x38')](_0xf6cc('0x39'))){_0xa1dab1[_0xf6cc('0x21')]=qs[_0xf6cc('0x21')](_0x1b491c[_0xf6cc('0x31')][_0xf6cc('0x21')]);_0xa1dab1[_0xf6cc('0x20')]=qs[_0xf6cc('0x20')](_0x1b491c[_0xf6cc('0x31')][_0xf6cc('0x20')]);}_0xa1dab1[_0xf6cc('0x3a')]=qs['sort'](_0x1b491c['query']['sort']);_0xa1dab1[_0xf6cc('0x3c')]=qs[_0xf6cc('0x33')](_[_0xf6cc('0x4d')](_0x1b491c[_0xf6cc('0x31')],_0x43f2c1[_0xf6cc('0x33')]));if(_0x1b491c[_0xf6cc('0x31')][_0xf6cc('0x3d')]){_0xa1dab1[_0xf6cc('0x3c')]=_[_0xf6cc('0x3f')](_0xa1dab1['where'],{'$or':_['map'](_0xa1dab1[_0xf6cc('0x34')],function(_0xc83f96){var _0x356829={};_0x356829[_0xc83f96]={'$like':'%'+_0x1b491c[_0xf6cc('0x31')][_0xf6cc('0x3d')]+'%'};return _0x356829;})});}_0xa1dab1=_['merge']({},_0xa1dab1,_0x1b491c['options']);var _0x44adf1={'where':_0xa1dab1['where']};return db[_0xf6cc('0x2b')][_0xf6cc('0x22')](_0x44adf1)[_0xf6cc('0x24')](function(_0x293f93){_0x3075b7[_0xf6cc('0x22')]=_0x293f93;if(_0x1b491c[_0xf6cc('0x31')][_0xf6cc('0x46')]){_0xa1dab1[_0xf6cc('0x47')]=[{'all':!![]}];}return db[_0xf6cc('0x2b')]['findAll'](_0xa1dab1);})[_0xf6cc('0x24')](function(_0x55ebc1){_0x3075b7[_0xf6cc('0x42')]=_0x55ebc1;return _0x3075b7;})[_0xf6cc('0x24')](respondWithFilteredResult(_0x3a59a2,_0xa1dab1,_0xf6cc('0x4e')))['catch'](handleError(_0x3a59a2,null,_0xf6cc('0x4e')));}; \ No newline at end of file +var _0xc770=['merge','find','create','body','catch','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','index','VoiceQueueReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','rows','show','params','keys','rawAttributes','length','includeAll','include'];(function(_0x8ef07b,_0x58e645){var _0x4a2402=function(_0x1dce76){while(--_0x1dce76){_0x8ef07b['push'](_0x8ef07b['shift']());}};_0x4a2402(++_0x58e645);}(_0xc770,0x103));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0c77('0x0'));var rimraf=require(_0x0c77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c77('0x2'));var rp=require(_0x0c77('0x3'));var moment=require('moment');var BPromise=require(_0x0c77('0x4'));var Mustache=require('mustache');var util=require(_0x0c77('0x5'));var path=require(_0x0c77('0x6'));var sox=require(_0x0c77('0x7'));var csv=require(_0x0c77('0x8'));var ejs=require(_0x0c77('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c77('0xa'));var squel=require(_0x0c77('0xb'));var crypto=require(_0x0c77('0xc'));var jsforce=require(_0x0c77('0xd'));var deskjs=require(_0x0c77('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0c77('0xf'));var Papa=require('papaparse');var Redis=require(_0x0c77('0x10'));var authService=require(_0x0c77('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0c77('0x12'));var hardwareService=require(_0x0c77('0x13'));var logger=require(_0x0c77('0x14'))(_0x0c77('0x15'));var utils=require('../../config/utils');var config=require(_0x0c77('0x16'));var licenseUtil=require(_0x0c77('0x17'));var db=require(_0x0c77('0x18'))['db'];config[_0x0c77('0x19')]=_[_0x0c77('0x1a')](config[_0x0c77('0x19')],{'host':_0x0c77('0x1b'),'port':0x18eb});var socket=require(_0x0c77('0x1c'))(new Redis(config[_0x0c77('0x19')]));require(_0x0c77('0x1d'))[_0x0c77('0x1e')](socket);function respondWithStatusCode(_0x55846d,_0x3014dc){_0x3014dc=_0x3014dc||0xcc;return function(_0x3b73e2){if(_0x3b73e2){return _0x55846d[_0x0c77('0x1f')](_0x3014dc);}return _0x55846d[_0x0c77('0x20')](_0x3014dc)[_0x0c77('0x21')]();};}function respondWithResult(_0x172e1d,_0x4d3d5c){_0x4d3d5c=_0x4d3d5c||0xc8;return function(_0x3a0d00){if(_0x3a0d00){return _0x172e1d[_0x0c77('0x20')](_0x4d3d5c)[_0x0c77('0x22')](_0x3a0d00);}};}function respondWithFilteredResult(_0x1dac06,_0x56bf11){return function(_0x120ffe){if(_0x120ffe){var _0x4b33d7=typeof _0x56bf11['offset']===_0x0c77('0x23')&&typeof _0x56bf11[_0x0c77('0x24')]===_0x0c77('0x23');var _0x43a038=_0x120ffe[_0x0c77('0x25')];var _0x120853=_0x4b33d7?0x0:_0x56bf11['offset'];var _0x13325b=_0x4b33d7?_0x120ffe[_0x0c77('0x25')]:_0x56bf11[_0x0c77('0x26')]+_0x56bf11[_0x0c77('0x24')];var _0x19281d;if(_0x13325b>=_0x43a038){_0x13325b=_0x43a038;_0x19281d=0xc8;}else{_0x19281d=0xce;}_0x1dac06[_0x0c77('0x20')](_0x19281d);return _0x1dac06['set']('Content-Range',_0x120853+'-'+_0x13325b+'/'+_0x43a038)[_0x0c77('0x22')](_0x120ffe);}return null;};}function patchUpdates(_0x43bd41){return function(_0x3c63cb){try{jsonpatch[_0x0c77('0x27')](_0x3c63cb,_0x43bd41,!![]);}catch(_0xab0384){return BPromise[_0x0c77('0x28')](_0xab0384);}return _0x3c63cb[_0x0c77('0x29')]();};}function saveUpdates(_0x3805b3,_0x4c3c86){return function(_0xe6f5cc){if(_0xe6f5cc){return _0xe6f5cc[_0x0c77('0x2a')](_0x3805b3)[_0x0c77('0x2b')](function(_0x552f60){return _0x552f60;});}return null;};}function removeEntity(_0x13a931,_0x16af7f){return function(_0x37a689){if(_0x37a689){return _0x37a689[_0x0c77('0x2c')]()['then'](function(){_0x13a931['status'](0xcc)[_0x0c77('0x21')]();});}};}function handleEntityNotFound(_0x265807,_0x41105a){return function(_0x1f6319){if(!_0x1f6319){_0x265807['sendStatus'](0x194);}return _0x1f6319;};}function handleError(_0x576920,_0x5a6203){_0x5a6203=_0x5a6203||0x1f4;return function(_0x4c83e6){logger[_0x0c77('0x2d')](_0x4c83e6[_0x0c77('0x2e')]);if(_0x4c83e6[_0x0c77('0x2f')]){delete _0x4c83e6[_0x0c77('0x2f')];}_0x576920[_0x0c77('0x20')](_0x5a6203)['send'](_0x4c83e6);};}exports[_0x0c77('0x30')]=function(_0x235b7f,_0x3bd77b){var _0x4a27e7={},_0x4bf1e1={},_0x100531={'count':0x0,'rows':[]};var _0x2e03cb=_['map'](db[_0x0c77('0x31')]['rawAttributes'],function(_0x4934fe){return{'name':_0x4934fe[_0x0c77('0x32')],'type':_0x4934fe[_0x0c77('0x33')][_0x0c77('0x34')]};});_0x4bf1e1[_0x0c77('0x35')]=_[_0x0c77('0x36')](_0x2e03cb,'name');_0x4bf1e1[_0x0c77('0x37')]=_['keys'](_0x235b7f[_0x0c77('0x37')]);_0x4bf1e1[_0x0c77('0x38')]=_[_0x0c77('0x39')](_0x4bf1e1['model'],_0x4bf1e1[_0x0c77('0x37')]);_0x4a27e7[_0x0c77('0x3a')]=_['intersection'](_0x4bf1e1[_0x0c77('0x35')],qs[_0x0c77('0x3b')](_0x235b7f['query'][_0x0c77('0x3b')]));_0x4a27e7['attributes']=_0x4a27e7['attributes']['length']?_0x4a27e7[_0x0c77('0x3a')]:_0x4bf1e1[_0x0c77('0x35')];if(!_0x235b7f[_0x0c77('0x37')][_0x0c77('0x3c')](_0x0c77('0x3d'))){_0x4a27e7[_0x0c77('0x24')]=qs['limit'](_0x235b7f[_0x0c77('0x37')][_0x0c77('0x24')]);_0x4a27e7[_0x0c77('0x26')]=qs[_0x0c77('0x26')](_0x235b7f[_0x0c77('0x37')][_0x0c77('0x26')]);}_0x4a27e7[_0x0c77('0x3e')]=qs[_0x0c77('0x3f')](_0x235b7f[_0x0c77('0x37')][_0x0c77('0x3f')]);_0x4a27e7[_0x0c77('0x40')]=qs['filters'](_[_0x0c77('0x41')](_0x235b7f[_0x0c77('0x37')],_0x4bf1e1[_0x0c77('0x38')]),_0x2e03cb);if(_0x235b7f['query'][_0x0c77('0x42')]){_0x4a27e7[_0x0c77('0x40')]=_['merge'](_0x4a27e7[_0x0c77('0x40')],{'$or':_[_0x0c77('0x36')](_0x2e03cb,function(_0x37bb7a){if(_0x37bb7a['type']!==_0x0c77('0x43')){var _0x2f9a3b={};_0x2f9a3b[_0x37bb7a['name']]={'$like':'%'+_0x235b7f[_0x0c77('0x37')][_0x0c77('0x42')]+'%'};return _0x2f9a3b;}})});}_0x4a27e7=_['merge']({},_0x4a27e7,_0x235b7f[_0x0c77('0x44')]);var _0x35e57d={'where':_0x4a27e7[_0x0c77('0x40')]};return db[_0x0c77('0x31')][_0x0c77('0x25')](_0x35e57d)['then'](function(_0x19eb8f){_0x100531[_0x0c77('0x25')]=_0x19eb8f;if(_0x235b7f[_0x0c77('0x37')]['includeAll']){_0x4a27e7['include']=[{'all':!![]}];}return db[_0x0c77('0x31')]['findAll'](_0x4a27e7);})[_0x0c77('0x2b')](function(_0x3d2764){_0x100531[_0x0c77('0x45')]=_0x3d2764;return _0x100531;})[_0x0c77('0x2b')](respondWithFilteredResult(_0x3bd77b,_0x4a27e7))['catch'](handleError(_0x3bd77b,null));};exports[_0x0c77('0x46')]=function(_0x9c3f94,_0x1cf897){var _0x3c6179={'raw':![],'where':{'id':_0x9c3f94[_0x0c77('0x47')]['id']}},_0xff3dd9={};_0xff3dd9['model']=_[_0x0c77('0x48')](db['VoiceQueueReport'][_0x0c77('0x49')]);_0xff3dd9[_0x0c77('0x37')]=_['keys'](_0x9c3f94[_0x0c77('0x37')]);_0xff3dd9[_0x0c77('0x38')]=_[_0x0c77('0x39')](_0xff3dd9['model'],_0xff3dd9['query']);_0x3c6179['attributes']=_[_0x0c77('0x39')](_0xff3dd9['model'],qs[_0x0c77('0x3b')](_0x9c3f94['query']['fields']));_0x3c6179['attributes']=_0x3c6179[_0x0c77('0x3a')][_0x0c77('0x4a')]?_0x3c6179[_0x0c77('0x3a')]:_0xff3dd9[_0x0c77('0x35')];if(_0x9c3f94[_0x0c77('0x37')][_0x0c77('0x4b')]){_0x3c6179[_0x0c77('0x4c')]=[{'all':!![]}];}_0x3c6179=_[_0x0c77('0x4d')]({},_0x3c6179,_0x9c3f94[_0x0c77('0x44')]);return db[_0x0c77('0x31')][_0x0c77('0x4e')](_0x3c6179)['then'](handleEntityNotFound(_0x1cf897,null))[_0x0c77('0x2b')](respondWithResult(_0x1cf897,null))['catch'](handleError(_0x1cf897,null));};exports[_0x0c77('0x4f')]=function(_0xaacfbd,_0x5d5ef8){return db[_0x0c77('0x31')]['create'](_0xaacfbd[_0x0c77('0x50')],{})['then'](respondWithResult(_0x5d5ef8,0xc9))[_0x0c77('0x51')](handleError(_0x5d5ef8,null));};exports['update']=function(_0x493c90,_0x4527d5){if(_0x493c90[_0x0c77('0x50')]['id']){delete _0x493c90[_0x0c77('0x50')]['id'];}return db[_0x0c77('0x31')]['find']({'where':{'id':_0x493c90['params']['id']}})[_0x0c77('0x2b')](handleEntityNotFound(_0x4527d5,null))[_0x0c77('0x2b')](saveUpdates(_0x493c90[_0x0c77('0x50')],null))['then'](respondWithResult(_0x4527d5,null))[_0x0c77('0x51')](handleError(_0x4527d5,null));};exports[_0x0c77('0x2c')]=function(_0x5c2400,_0x223578){return db[_0x0c77('0x31')][_0x0c77('0x4e')]({'where':{'id':_0x5c2400[_0x0c77('0x47')]['id']}})[_0x0c77('0x2b')](handleEntityNotFound(_0x223578,null))[_0x0c77('0x2b')](removeEntity(_0x223578,null))[_0x0c77('0x51')](handleError(_0x223578,null));};exports['describe']=function(_0x4f447e,_0x4c7719){return db[_0x0c77('0x31')][_0x0c77('0x52')]()[_0x0c77('0x2b')](respondWithResult(_0x4c7719,null))[_0x0c77('0x51')](handleError(_0x4c7719,null));};exports[_0x0c77('0x53')]=function(_0x56a566,_0x1fe7a1){var _0x540d71={},_0x478b2b={},_0x307d23={'count':0x0,'rows':[]};_0x478b2b[_0x0c77('0x35')]=_[_0x0c77('0x48')](db['VoiceQueueReport'][_0x0c77('0x49')]);_0x478b2b[_0x0c77('0x37')]=_[_0x0c77('0x48')](_0x56a566['query']);_0x478b2b['filters']=_[_0x0c77('0x39')](_0x478b2b[_0x0c77('0x35')],_0x478b2b[_0x0c77('0x37')]);_0x540d71[_0x0c77('0x3a')]=_[_0x0c77('0x39')](_0x478b2b[_0x0c77('0x35')],qs[_0x0c77('0x3b')](_0x56a566[_0x0c77('0x37')]['fields']));_0x540d71[_0x0c77('0x3a')]=_0x540d71[_0x0c77('0x3a')][_0x0c77('0x4a')]?_0x540d71[_0x0c77('0x3a')]:_0x478b2b[_0x0c77('0x35')];if(!_0x56a566[_0x0c77('0x37')]['hasOwnProperty'](_0x0c77('0x3d'))){_0x540d71[_0x0c77('0x24')]=qs[_0x0c77('0x24')](_0x56a566['query'][_0x0c77('0x24')]);_0x540d71['offset']=qs['offset'](_0x56a566[_0x0c77('0x37')]['offset']);}_0x540d71[_0x0c77('0x3e')]=qs[_0x0c77('0x3f')](_0x56a566[_0x0c77('0x37')][_0x0c77('0x3f')]);_0x540d71[_0x0c77('0x40')]=qs[_0x0c77('0x38')](_[_0x0c77('0x41')](_0x56a566[_0x0c77('0x37')],_0x478b2b['filters']));if(_0x56a566[_0x0c77('0x37')]['filter']){_0x540d71[_0x0c77('0x40')]=_[_0x0c77('0x4d')](_0x540d71[_0x0c77('0x40')],{'$or':_[_0x0c77('0x36')](_0x540d71['attributes'],function(_0x34289b){var _0x1ac8a5={};_0x1ac8a5[_0x34289b]={'$like':'%'+_0x56a566['query'][_0x0c77('0x42')]+'%'};return _0x1ac8a5;})});}_0x540d71=_[_0x0c77('0x4d')]({},_0x540d71,_0x56a566[_0x0c77('0x44')]);var _0x49a9ea={'where':_0x540d71['where']};return db['VoiceQueueReport']['count'](_0x49a9ea)['then'](function(_0x1c77c6){_0x307d23[_0x0c77('0x25')]=_0x1c77c6;if(_0x56a566[_0x0c77('0x37')][_0x0c77('0x4b')]){_0x540d71[_0x0c77('0x4c')]=[{'all':!![]}];}return db[_0x0c77('0x31')]['findAll'](_0x540d71);})[_0x0c77('0x2b')](function(_0x42e445){_0x307d23[_0x0c77('0x45')]=_0x42e445;return _0x307d23;})[_0x0c77('0x2b')](respondWithFilteredResult(_0x1fe7a1,_0x540d71,_0x0c77('0x53')))[_0x0c77('0x51')](handleError(_0x1fe7a1,null,_0x0c77('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index a6a6c81..216db05 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 _0x898b=['exports','events','../../mysqldb','update','remove','emit','hasOwnProperty'];(function(_0x3dc5d9,_0x1d0c6b){var _0x578c96=function(_0x40a7d5){while(--_0x40a7d5){_0x3dc5d9['push'](_0x3dc5d9['shift']());}};_0x578c96(++_0x1d0c6b);}(_0x898b,0xa9));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb898('0x0'));var VoiceQueueReport=require(_0xb898('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb898('0x2'),'afterDestroy':_0xb898('0x3')};function emitEvent(_0x10982d){return function(_0x3e2c4b,_0x387635,_0x4b85c8){VoiceQueueReportEvents[_0xb898('0x4')](_0x10982d+':'+_0x3e2c4b['id'],_0x3e2c4b);VoiceQueueReportEvents[_0xb898('0x4')](_0x10982d,_0x3e2c4b);_0x4b85c8(null);};}for(var e in events){if(events[_0xb898('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xb898('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x2802=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x160b82,_0x314981){var _0x230ee4=function(_0x26b422){while(--_0x26b422){_0x160b82['push'](_0x160b82['shift']());}};_0x230ee4(++_0x314981);}(_0x2802,0x1b5));var _0x2280=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x2802[_0x8e9386];return _0x4abf26;};'use strict';var EventEmitter=require(_0x2280('0x0'));var VoiceQueueReport=require(_0x2280('0x1'))['db'][_0x2280('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2280('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2280('0x4')};function emitEvent(_0x30002c){return function(_0x32ecad,_0x22e260,_0x42b7b0){VoiceQueueReportEvents[_0x2280('0x5')](_0x30002c+':'+_0x32ecad['id'],_0x32ecad);VoiceQueueReportEvents[_0x2280('0x5')](_0x30002c,_0x32ecad);_0x42b7b0(null);};}for(var e in events){if(events[_0x2280('0x6')](e)){var event=events[e];VoiceQueueReport[_0x2280('0x7')](e,emitEvent(event));}}module[_0x2280('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 338adbe..85f38ad 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 _0xea92=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceQueueReport.attributes','exports'];(function(_0x3714c1,_0x47cf2b){var _0x26f4fa=function(_0xcce39a){while(--_0xcce39a){_0x3714c1['push'](_0x3714c1['shift']());}};_0x26f4fa(++_0x47cf2b);}(_0xea92,0x171));var _0x2ea9=function(_0x2486ff,_0x1a01bc){_0x2486ff=_0x2486ff-0x0;var _0x54a044=_0xea92[_0x2486ff];return _0x54a044;};'use strict';var _=require('lodash');var util=require(_0x2ea9('0x0'));var logger=require(_0x2ea9('0x1'))(_0x2ea9('0x2'));var moment=require(_0x2ea9('0x3'));var BPromise=require('bluebird');var rp=require(_0x2ea9('0x4'));var fs=require('fs');var path=require(_0x2ea9('0x5'));var rimraf=require(_0x2ea9('0x6'));var config=require('../../config/environment');var attributes=require(_0x2ea9('0x7'));module[_0x2ea9('0x8')]=function(_0x2493cb,_0x43930c){return _0x2493cb[_0x2ea9('0x9')](_0x2ea9('0xa'),attributes,{'tableName':_0x2ea9('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2ea9('0xc')]},{'fields':[_0x2ea9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9016=['exports','define','uniqueid','calleridnum','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x580ad9,_0xd0f6f){var _0x3b4511=function(_0x29c6da){while(--_0x29c6da){_0x580ad9['push'](_0x580ad9['shift']());}};_0x3b4511(++_0xd0f6f);}(_0x9016,0x190));var _0x6901=function(_0x2ebeb9,_0x3d324a){_0x2ebeb9=_0x2ebeb9-0x0;var _0x4d54a4=_0x9016[_0x2ebeb9];return _0x4d54a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6901('0x0'))(_0x6901('0x1'));var moment=require(_0x6901('0x2'));var BPromise=require('bluebird');var rp=require(_0x6901('0x3'));var fs=require('fs');var path=require(_0x6901('0x4'));var rimraf=require(_0x6901('0x5'));var config=require(_0x6901('0x6'));var attributes=require(_0x6901('0x7'));module[_0x6901('0x8')]=function(_0x2da325,_0x170a6b){return _0x2da325[_0x6901('0x9')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x6901('0xa')]},{'fields':[_0x6901('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 7fa3d78..40336d8 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 _0x98a5=['limit','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','include','map','model','then','debug','CreateVoiceQueueReport','body','raw','catch'];(function(_0x14e589,_0x5d5c97){var _0x4ceb8c=function(_0x55f065){while(--_0x55f065){_0x14e589['push'](_0x14e589['shift']());}};_0x4ceb8c(++_0x5d5c97);}(_0x98a5,0x18e));var _0x598a=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x98a5[_0xfa634c];return _0x73e478;};'use strict';var _=require('lodash');var util=require(_0x598a('0x0'));var moment=require(_0x598a('0x1'));var BPromise=require(_0x598a('0x2'));var rs=require(_0x598a('0x3'));var fs=require('fs');var Redis=require(_0x598a('0x4'));var db=require(_0x598a('0x5'))['db'];var utils=require(_0x598a('0x6'));var logger=require(_0x598a('0x7'))(_0x598a('0x8'));var config=require(_0x598a('0x9'));var jayson=require(_0x598a('0xa'));var client=jayson[_0x598a('0xb')][_0x598a('0xc')]({'port':0x232a});config[_0x598a('0xd')]=_[_0x598a('0xe')](config['redis'],{'host':_0x598a('0xf'),'port':0x18eb});var socket=require(_0x598a('0x10'))(new Redis(config[_0x598a('0xd')]));require(_0x598a('0x11'))['register'](socket);function respondWithRpcPromise(_0x5767cb,_0x539d01,_0x3cd27e){return new BPromise(function(_0x1a8b87,_0x2765e7){return client[_0x598a('0x12')](_0x5767cb,_0x3cd27e)['then'](function(_0x472f9b){logger[_0x598a('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x539d01,_0x598a('0x14'));logger['debug'](_0x598a('0x15'),_0x539d01,'request\x20sent',JSON[_0x598a('0x16')](_0x472f9b));if(_0x472f9b[_0x598a('0x17')]){if(_0x472f9b[_0x598a('0x17')]['code']===0x1f4){logger[_0x598a('0x17')](_0x598a('0x18'),_0x539d01,_0x472f9b[_0x598a('0x17')][_0x598a('0x19')]);return _0x2765e7(_0x472f9b[_0x598a('0x17')][_0x598a('0x19')]);}logger[_0x598a('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x539d01,_0x472f9b[_0x598a('0x17')][_0x598a('0x19')]);return _0x1a8b87(_0x472f9b['error'][_0x598a('0x19')]);}else{logger[_0x598a('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x539d01,_0x598a('0x14'));_0x1a8b87(_0x472f9b[_0x598a('0x1a')][_0x598a('0x19')]);}})['catch'](function(_0x15200e){logger[_0x598a('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x539d01,_0x15200e);_0x2765e7(_0x15200e);});});}exports[_0x598a('0x1b')]=function(_0x41acd7){var _0x2a4901=this;return new Promise(function(_0x1a6795,_0x3ccf58){return db[_0x598a('0x1c')][_0x598a('0x1d')]({'raw':_0x41acd7['options']?_0x41acd7[_0x598a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x41acd7[_0x598a('0x1e')]?_0x41acd7[_0x598a('0x1e')][_0x598a('0x1f')]||null:null,'attributes':_0x41acd7[_0x598a('0x1e')]?_0x41acd7[_0x598a('0x1e')][_0x598a('0x20')]||null:null,'limit':_0x41acd7['options']?_0x41acd7[_0x598a('0x1e')]['limit']||null:null,'include':_0x41acd7[_0x598a('0x1e')]?_0x41acd7[_0x598a('0x1e')][_0x598a('0x21')]?_[_0x598a('0x22')](_0x41acd7['options'][_0x598a('0x21')],function(_0x2e3caa){return{'model':db[_0x2e3caa[_0x598a('0x23')]],'as':_0x2e3caa['as'],'attributes':_0x2e3caa[_0x598a('0x20')],'include':_0x2e3caa['include']?_[_0x598a('0x22')](_0x2e3caa[_0x598a('0x21')],function(_0x496e17){return{'model':db[_0x496e17['model']],'as':_0x496e17['as'],'attributes':_0x496e17[_0x598a('0x20')],'include':_0x496e17['include']?_[_0x598a('0x22')](_0x496e17['include'],function(_0x71c238){return{'model':db[_0x71c238[_0x598a('0x23')]],'as':_0x71c238['as'],'attributes':_0x71c238['attributes']};}):[]};}):[]};}):[]:[]})[_0x598a('0x24')](function(_0x1495ab){logger[_0x598a('0x13')](_0x598a('0x1b'),_0x41acd7);logger[_0x598a('0x25')](_0x598a('0x1b'),_0x41acd7,JSON[_0x598a('0x16')](_0x1495ab));_0x1a6795(_0x1495ab);})['catch'](function(_0x4e89a3){logger[_0x598a('0x17')](_0x598a('0x1b'),_0x4e89a3['message'],_0x41acd7);_0x3ccf58(_0x2a4901[_0x598a('0x17')](0x1f4,_0x4e89a3['message']));});});};exports[_0x598a('0x26')]=function(_0x3a7fdf){var _0x39aaba=this;return new Promise(function(_0x2bab7e,_0x2a02c4){return db[_0x598a('0x1c')]['create'](_0x3a7fdf[_0x598a('0x27')],{'raw':_0x3a7fdf[_0x598a('0x1e')]?_0x3a7fdf[_0x598a('0x1e')][_0x598a('0x28')]===undefined?!![]:![]:!![]})[_0x598a('0x24')](function(_0x499d68){logger[_0x598a('0x13')]('CreateVoiceQueueReport',_0x3a7fdf);logger[_0x598a('0x25')]('CreateVoiceQueueReport',_0x3a7fdf,JSON['stringify'](_0x499d68));_0x2bab7e(_0x499d68);})[_0x598a('0x29')](function(_0xfdf4ca){logger['error'](_0x598a('0x26'),_0xfdf4ca[_0x598a('0x19')],_0x3a7fdf);_0x2a02c4(_0x39aaba[_0x598a('0x17')](0x1f4,_0xfdf4ca[_0x598a('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x1ca2ad){var _0x4bd3d0=this;return new Promise(function(_0x22ed80,_0x14fa30){return db[_0x598a('0x1c')]['update'](_0x1ca2ad[_0x598a('0x27')],{'raw':_0x1ca2ad['options']?_0x1ca2ad['options'][_0x598a('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ca2ad[_0x598a('0x1e')]?_0x1ca2ad[_0x598a('0x1e')][_0x598a('0x1f')]||null:null,'attributes':_0x1ca2ad[_0x598a('0x1e')]?_0x1ca2ad['options']['attributes']||null:null,'limit':_0x1ca2ad[_0x598a('0x1e')]?_0x1ca2ad[_0x598a('0x1e')][_0x598a('0x2a')]||null:null})[_0x598a('0x24')](function(_0x2a0fd3){logger[_0x598a('0x13')](_0x598a('0x2b'),_0x1ca2ad);logger[_0x598a('0x25')](_0x598a('0x2b'),_0x1ca2ad,JSON[_0x598a('0x16')](_0x2a0fd3));_0x22ed80(_0x2a0fd3);})[_0x598a('0x29')](function(_0x16b10e){logger[_0x598a('0x17')](_0x598a('0x2b'),_0x16b10e['message'],_0x1ca2ad);_0x14fa30(_0x4bd3d0['error'](0x1f4,_0x16b10e[_0x598a('0x19')]));});});}; \ No newline at end of file +var _0x8ae3=['socket.io-emitter','./voiceQueueReport.socket','register','then','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','map','model','stringify','catch','CreateVoiceQueueReport','body','update','raw','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x8ae3,0x74));var _0x38ae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ae3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x38ae('0x0'));var util=require(_0x38ae('0x1'));var moment=require(_0x38ae('0x2'));var BPromise=require(_0x38ae('0x3'));var rs=require(_0x38ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38ae('0x5'))['db'];var utils=require(_0x38ae('0x6'));var logger=require(_0x38ae('0x7'))(_0x38ae('0x8'));var config=require(_0x38ae('0x9'));var jayson=require(_0x38ae('0xa'));var client=jayson[_0x38ae('0xb')][_0x38ae('0xc')]({'port':0x232a});config[_0x38ae('0xd')]=_[_0x38ae('0xe')](config[_0x38ae('0xd')],{'host':_0x38ae('0xf'),'port':0x18eb});var socket=require(_0x38ae('0x10'))(new Redis(config['redis']));require(_0x38ae('0x11'))[_0x38ae('0x12')](socket);function respondWithRpcPromise(_0x1b7baa,_0x107c60,_0xc3cde9){return new BPromise(function(_0x28db4e,_0x31c129){return client['request'](_0x1b7baa,_0xc3cde9)[_0x38ae('0x13')](function(_0x4a1949){logger[_0x38ae('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x107c60,'request\x20sent');logger[_0x38ae('0x15')](_0x38ae('0x16'),_0x107c60,_0x38ae('0x17'),JSON['stringify'](_0x4a1949));if(_0x4a1949[_0x38ae('0x18')]){if(_0x4a1949[_0x38ae('0x18')]['code']===0x1f4){logger[_0x38ae('0x18')](_0x38ae('0x19'),_0x107c60,_0x4a1949[_0x38ae('0x18')][_0x38ae('0x1a')]);return _0x31c129(_0x4a1949[_0x38ae('0x18')][_0x38ae('0x1a')]);}logger[_0x38ae('0x18')](_0x38ae('0x19'),_0x107c60,_0x4a1949['error'][_0x38ae('0x1a')]);return _0x28db4e(_0x4a1949[_0x38ae('0x18')][_0x38ae('0x1a')]);}else{logger[_0x38ae('0x14')](_0x38ae('0x19'),_0x107c60,_0x38ae('0x17'));_0x28db4e(_0x4a1949[_0x38ae('0x1b')][_0x38ae('0x1a')]);}})['catch'](function(_0x3b36b1){logger[_0x38ae('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x107c60,_0x3b36b1);_0x31c129(_0x3b36b1);});});}exports[_0x38ae('0x1c')]=function(_0x4c3631){var _0x20613d=this;return new Promise(function(_0x108fd3,_0x3a2a37){return db[_0x38ae('0x1d')]['findAll']({'raw':_0x4c3631[_0x38ae('0x1e')]?_0x4c3631[_0x38ae('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4c3631[_0x38ae('0x1e')]?_0x4c3631[_0x38ae('0x1e')][_0x38ae('0x1f')]||null:null,'attributes':_0x4c3631[_0x38ae('0x1e')]?_0x4c3631['options'][_0x38ae('0x20')]||null:null,'limit':_0x4c3631['options']?_0x4c3631[_0x38ae('0x1e')][_0x38ae('0x21')]||null:null,'include':_0x4c3631[_0x38ae('0x1e')]?_0x4c3631[_0x38ae('0x1e')][_0x38ae('0x22')]?_[_0x38ae('0x23')](_0x4c3631[_0x38ae('0x1e')][_0x38ae('0x22')],function(_0x1fc2b3){return{'model':db[_0x1fc2b3[_0x38ae('0x24')]],'as':_0x1fc2b3['as'],'attributes':_0x1fc2b3[_0x38ae('0x20')],'include':_0x1fc2b3[_0x38ae('0x22')]?_[_0x38ae('0x23')](_0x1fc2b3[_0x38ae('0x22')],function(_0x2089ca){return{'model':db[_0x2089ca[_0x38ae('0x24')]],'as':_0x2089ca['as'],'attributes':_0x2089ca['attributes'],'include':_0x2089ca[_0x38ae('0x22')]?_[_0x38ae('0x23')](_0x2089ca[_0x38ae('0x22')],function(_0x54d494){return{'model':db[_0x54d494[_0x38ae('0x24')]],'as':_0x54d494['as'],'attributes':_0x54d494[_0x38ae('0x20')]};}):[]};}):[]};}):[]:[]})[_0x38ae('0x13')](function(_0x57f3d1){logger[_0x38ae('0x14')](_0x38ae('0x1c'),_0x4c3631);logger['debug']('GetVoiceQueueReport',_0x4c3631,JSON[_0x38ae('0x25')](_0x57f3d1));_0x108fd3(_0x57f3d1);})[_0x38ae('0x26')](function(_0x3a59f8){logger[_0x38ae('0x18')](_0x38ae('0x1c'),_0x3a59f8[_0x38ae('0x1a')],_0x4c3631);_0x3a2a37(_0x20613d[_0x38ae('0x18')](0x1f4,_0x3a59f8[_0x38ae('0x1a')]));});});};exports[_0x38ae('0x27')]=function(_0x425765){var _0x4376e2=this;return new Promise(function(_0x37abfd,_0x25d34c){return db[_0x38ae('0x1d')]['create'](_0x425765[_0x38ae('0x28')],{'raw':_0x425765[_0x38ae('0x1e')]?_0x425765[_0x38ae('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x38ae('0x13')](function(_0x7c7c91){logger[_0x38ae('0x14')]('CreateVoiceQueueReport',_0x425765);logger[_0x38ae('0x15')](_0x38ae('0x27'),_0x425765,JSON[_0x38ae('0x25')](_0x7c7c91));_0x37abfd(_0x7c7c91);})[_0x38ae('0x26')](function(_0x5a20cc){logger['error'](_0x38ae('0x27'),_0x5a20cc[_0x38ae('0x1a')],_0x425765);_0x25d34c(_0x4376e2[_0x38ae('0x18')](0x1f4,_0x5a20cc[_0x38ae('0x1a')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3c74c6){var _0x32179a=this;return new Promise(function(_0x56268b,_0x2245f6){return db['VoiceQueueReport'][_0x38ae('0x29')](_0x3c74c6[_0x38ae('0x28')],{'raw':_0x3c74c6[_0x38ae('0x1e')]?_0x3c74c6[_0x38ae('0x1e')][_0x38ae('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c74c6[_0x38ae('0x1e')]?_0x3c74c6[_0x38ae('0x1e')]['where']||null:null,'attributes':_0x3c74c6['options']?_0x3c74c6[_0x38ae('0x1e')]['attributes']||null:null,'limit':_0x3c74c6[_0x38ae('0x1e')]?_0x3c74c6[_0x38ae('0x1e')][_0x38ae('0x21')]||null:null})[_0x38ae('0x13')](function(_0x33c00f){logger[_0x38ae('0x14')]('UpdateVoiceQueueReport',_0x3c74c6);logger[_0x38ae('0x15')](_0x38ae('0x2b'),_0x3c74c6,JSON[_0x38ae('0x25')](_0x33c00f));_0x56268b(_0x33c00f);})[_0x38ae('0x26')](function(_0x2201db){logger['error'](_0x38ae('0x2b'),_0x2201db[_0x38ae('0x1a')],_0x3c74c6);_0x2245f6(_0x32179a[_0x38ae('0x18')](0x1f4,_0x2201db[_0x38ae('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 63d3479..5ad0a44 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 _0xfd7b=['removeListener','register','length','save','remove','update','emit'];(function(_0x4c24c9,_0x491e1b){var _0x5ade62=function(_0x55263f){while(--_0x55263f){_0x4c24c9['push'](_0x4c24c9['shift']());}};_0x5ade62(++_0x491e1b);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xfd7b[_0x580576];return _0x3f55a0;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xbfd7('0x0'),_0xbfd7('0x1'),_0xbfd7('0x2')];function createListener(_0x27db01,_0x1ea39e){return function(_0x1f9ae1){_0x1ea39e[_0xbfd7('0x3')](_0x27db01,_0x1f9ae1);};}function removeListener(_0x221ad1,_0x249e59){return function(){VoiceQueueReportEvents[_0xbfd7('0x4')](_0x221ad1,_0x249e59);};}exports[_0xbfd7('0x5')]=function(_0x2ad158){for(var _0x639dd4=0x0,_0x5f3067=events[_0xbfd7('0x6')];_0x639dd4<_0x5f3067;_0x639dd4++){var _0x48f2aa=events[_0x639dd4];var _0x33dab1=createListener('voiceQueueReport:'+_0x48f2aa,_0x2ad158);VoiceQueueReportEvents['on'](_0x48f2aa,_0x33dab1);}}; \ No newline at end of file +var _0xf5cd=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x22a1ad,_0x4aed38){var _0x293e80=function(_0x58791e){while(--_0x58791e){_0x22a1ad['push'](_0x22a1ad['shift']());}};_0x293e80(++_0x4aed38);}(_0xf5cd,0x1bf));var _0xdf5c=function(_0x3c9f8d,_0x2856b6){_0x3c9f8d=_0x3c9f8d-0x0;var _0x203682=_0xf5cd[_0x3c9f8d];return _0x203682;};'use strict';var VoiceQueueReportEvents=require(_0xdf5c('0x0'));var events=[_0xdf5c('0x1'),_0xdf5c('0x2'),_0xdf5c('0x3')];function createListener(_0x24a764,_0x451a36){return function(_0x516def){_0x451a36[_0xdf5c('0x4')](_0x24a764,_0x516def);};}function removeListener(_0x5a9de3,_0x417206){return function(){VoiceQueueReportEvents[_0xdf5c('0x5')](_0x5a9de3,_0x417206);};}exports[_0xdf5c('0x6')]=function(_0x1dc4a7){for(var _0x3c994f=0x0,_0x986cf1=events[_0xdf5c('0x7')];_0x3c994f<_0x986cf1;_0x3c994f++){var _0x14337a=events[_0x3c994f];var _0x1d766a=createListener(_0xdf5c('0x8')+_0x14337a,_0x1dc4a7);VoiceQueueReportEvents['on'](_0x14337a,_0x1d766a);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 384ce62..16b1a72 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 _0xe3ee=['/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x1a3c13,_0x5c8291){var _0x3858f8=function(_0x430567){while(--_0x430567){_0x1a3c13['push'](_0x1a3c13['shift']());}};_0x3858f8(++_0x5c8291);}(_0xe3ee,0x116));var _0xee3e=function(_0x1352c9,_0x425163){_0x1352c9=_0x1352c9-0x0;var _0x31342d=_0xe3ee[_0x1352c9];return _0x31342d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee3e('0x0'));var timeout=require(_0xee3e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xee3e('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xee3e('0x3'));var controller=require('./voiceQueuesLog.controller');router[_0xee3e('0x4')]('/',auth[_0xee3e('0x5')](),controller[_0xee3e('0x6')]);router[_0xee3e('0x4')](_0xee3e('0x7'),auth[_0xee3e('0x5')](),controller[_0xee3e('0x8')]);router[_0xee3e('0x9')]('/',auth['isAuthenticated'](),controller[_0xee3e('0xa')]);router[_0xee3e('0xb')]('/:id',auth[_0xee3e('0x5')](),controller[_0xee3e('0xc')]);router['delete'](_0xee3e('0x7'),auth[_0xee3e('0x5')](),controller[_0xee3e('0xd')]);module[_0xee3e('0xe')]=router; \ No newline at end of file +var _0x2911=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2911,0x90));var _0x1291=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0x2911[_0x3dc538];return _0x72c2fd;};'use strict';var multer=require(_0x1291('0x0'));var util=require(_0x1291('0x1'));var path=require(_0x1291('0x2'));var timeout=require(_0x1291('0x3'));var express=require(_0x1291('0x4'));var router=express[_0x1291('0x5')]();var fs_extra=require(_0x1291('0x6'));var auth=require(_0x1291('0x7'));var interaction=require(_0x1291('0x8'));var config=require('../../config/environment');var controller=require(_0x1291('0x9'));router[_0x1291('0xa')]('/',auth[_0x1291('0xb')](),controller[_0x1291('0xc')]);router[_0x1291('0xa')](_0x1291('0xd'),auth[_0x1291('0xb')](),controller[_0x1291('0xe')]);router[_0x1291('0xf')]('/',auth[_0x1291('0xb')](),controller['create']);router[_0x1291('0x10')](_0x1291('0xd'),auth[_0x1291('0xb')](),controller[_0x1291('0x11')]);router[_0x1291('0x12')]('/:id',auth[_0x1291('0xb')](),controller['destroy']);module[_0x1291('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 393c0c0..52438fa 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 _0xc23a=['exports','STRING','literal','sequelize','moment'];(function(_0x397396,_0x4f2b10){var _0x3c1c53=function(_0x13e18b){while(--_0x13e18b){_0x397396['push'](_0x397396['shift']());}};_0x3c1c53(++_0x4f2b10);}(_0xc23a,0xda));var _0xac23=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0xc23a[_0x3b3cc6];return _0x1161e4;};'use strict';var Sequelize=require(_0xac23('0x0'));var moment=require(_0xac23('0x1'));module[_0xac23('0x2')]={'time':{'type':Sequelize[_0xac23('0x3')]},'callid':{'type':Sequelize[_0xac23('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xac23('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xac23('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xac23('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xac23('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xac23('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xac23('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xac23('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xac23('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x64e9=['sequelize','moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x64e9,0x17a));var _0x964e=function(_0x384295,_0x1f5064){_0x384295=_0x384295-0x0;var _0x39e77f=_0x64e9[_0x384295];return _0x39e77f;};'use strict';var Sequelize=require(_0x964e('0x0'));var moment=require(_0x964e('0x1'));module[_0x964e('0x2')]={'time':{'type':Sequelize[_0x964e('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x964e('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x964e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x964e('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x964e('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x964e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x964e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x964e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x964e('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x964e('0x5')](_0x964e('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 0d00b7b..bcf5378 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 _0xcb68=['merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','VoiceQueuesLog','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','filter','where'];(function(_0x284443,_0xa59ea6){var _0x5cfd68=function(_0x3cd619){while(--_0x3cd619){_0x284443['push'](_0x284443['shift']());}};_0x5cfd68(++_0xa59ea6);}(_0xcb68,0x1bd));var _0x8cb6=function(_0x4641b2,_0x11560b){_0x4641b2=_0x4641b2-0x0;var _0x12b66b=_0xcb68[_0x4641b2];return _0x12b66b;};'use strict';var emlformat=require(_0x8cb6('0x0'));var rimraf=require(_0x8cb6('0x1'));var zipdir=require(_0x8cb6('0x2'));var jsonpatch=require(_0x8cb6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8cb6('0x4'));var Mustache=require(_0x8cb6('0x5'));var util=require(_0x8cb6('0x6'));var path=require(_0x8cb6('0x7'));var sox=require(_0x8cb6('0x8'));var csv=require(_0x8cb6('0x9'));var ejs=require(_0x8cb6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cb6('0xb'));var squel=require(_0x8cb6('0xc'));var crypto=require(_0x8cb6('0xd'));var jsforce=require(_0x8cb6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8cb6('0x9'));var querystring=require(_0x8cb6('0xf'));var Papa=require('papaparse');var Redis=require(_0x8cb6('0x10'));var authService=require(_0x8cb6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cb6('0x12'))(_0x8cb6('0x13'));var utils=require(_0x8cb6('0x14'));var config=require(_0x8cb6('0x15'));var licenseUtil=require(_0x8cb6('0x16'));var db=require(_0x8cb6('0x17'))['db'];function respondWithStatusCode(_0x2c9bf6,_0x4acd4d){_0x4acd4d=_0x4acd4d||0xcc;return function(_0x2fc986){if(_0x2fc986){return _0x2c9bf6[_0x8cb6('0x18')](_0x4acd4d);}return _0x2c9bf6[_0x8cb6('0x19')](_0x4acd4d)[_0x8cb6('0x1a')]();};}function respondWithResult(_0x95ce10,_0x3cc3df){_0x3cc3df=_0x3cc3df||0xc8;return function(_0x11debd){if(_0x11debd){return _0x95ce10['status'](_0x3cc3df)[_0x8cb6('0x1b')](_0x11debd);}};}function respondWithFilteredResult(_0x2f1583,_0xb2ac72){return function(_0x1f82f9){if(_0x1f82f9){var _0x394af8=typeof _0xb2ac72['offset']===_0x8cb6('0x1c')&&typeof _0xb2ac72['limit']===_0x8cb6('0x1c');var _0x24dc3a=_0x1f82f9['count'];var _0x363276=_0x394af8?0x0:_0xb2ac72[_0x8cb6('0x1d')];var _0x6cd40a=_0x394af8?_0x1f82f9[_0x8cb6('0x1e')]:_0xb2ac72['offset']+_0xb2ac72[_0x8cb6('0x1f')];var _0x1d7382;if(_0x6cd40a>=_0x24dc3a){_0x6cd40a=_0x24dc3a;_0x1d7382=0xc8;}else{_0x1d7382=0xce;}_0x2f1583[_0x8cb6('0x19')](_0x1d7382);return _0x2f1583[_0x8cb6('0x20')](_0x8cb6('0x21'),_0x363276+'-'+_0x6cd40a+'/'+_0x24dc3a)[_0x8cb6('0x1b')](_0x1f82f9);}return null;};}function patchUpdates(_0x580821){return function(_0xc2e374){try{jsonpatch[_0x8cb6('0x22')](_0xc2e374,_0x580821,!![]);}catch(_0x5f3425){return BPromise[_0x8cb6('0x23')](_0x5f3425);}return _0xc2e374['save']();};}function saveUpdates(_0x4f228b,_0x26346c){return function(_0x26dc2f){if(_0x26dc2f){return _0x26dc2f[_0x8cb6('0x24')](_0x4f228b)[_0x8cb6('0x25')](function(_0x219464){return _0x219464;});}return null;};}function removeEntity(_0x3e1f1a,_0x4011b2){return function(_0x5df34d){if(_0x5df34d){return _0x5df34d[_0x8cb6('0x26')]()[_0x8cb6('0x25')](function(){_0x3e1f1a[_0x8cb6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e558e,_0x5adb6c){return function(_0x5b4bb6){if(!_0x5b4bb6){_0x3e558e[_0x8cb6('0x18')](0x194);}return _0x5b4bb6;};}function handleError(_0x57d966,_0x33d928){_0x33d928=_0x33d928||0x1f4;return function(_0x5b7cfd){logger[_0x8cb6('0x27')](_0x5b7cfd[_0x8cb6('0x28')]);if(_0x5b7cfd[_0x8cb6('0x29')]){delete _0x5b7cfd['name'];}_0x57d966[_0x8cb6('0x19')](_0x33d928)['send'](_0x5b7cfd);};}exports[_0x8cb6('0x2a')]=function(_0x268d48,_0x524837){var _0x2fb8fd={},_0x458dfe={},_0x2d9990={'count':0x0,'rows':[]};var _0x325b06=_['map'](db[_0x8cb6('0x2b')]['rawAttributes'],function(_0x28b182){return{'name':_0x28b182['fieldName'],'type':_0x28b182[_0x8cb6('0x2c')][_0x8cb6('0x2d')]};});_0x458dfe[_0x8cb6('0x2e')]=_[_0x8cb6('0x2f')](_0x325b06,_0x8cb6('0x29'));_0x458dfe[_0x8cb6('0x30')]=_[_0x8cb6('0x31')](_0x268d48[_0x8cb6('0x30')]);_0x458dfe[_0x8cb6('0x32')]=_[_0x8cb6('0x33')](_0x458dfe['model'],_0x458dfe[_0x8cb6('0x30')]);_0x2fb8fd['attributes']=_[_0x8cb6('0x33')](_0x458dfe['model'],qs[_0x8cb6('0x34')](_0x268d48[_0x8cb6('0x30')]['fields']));_0x2fb8fd[_0x8cb6('0x35')]=_0x2fb8fd['attributes']['length']?_0x2fb8fd[_0x8cb6('0x35')]:_0x458dfe[_0x8cb6('0x2e')];if(!_0x268d48[_0x8cb6('0x30')][_0x8cb6('0x36')]('nolimit')){_0x2fb8fd['limit']=qs[_0x8cb6('0x1f')](_0x268d48[_0x8cb6('0x30')]['limit']);_0x2fb8fd[_0x8cb6('0x1d')]=qs[_0x8cb6('0x1d')](_0x268d48[_0x8cb6('0x30')]['offset']);}_0x2fb8fd['order']=qs['sort'](_0x268d48[_0x8cb6('0x30')][_0x8cb6('0x37')]);_0x2fb8fd['where']=qs[_0x8cb6('0x32')](_[_0x8cb6('0x38')](_0x268d48[_0x8cb6('0x30')],_0x458dfe[_0x8cb6('0x32')]),_0x325b06);if(_0x268d48[_0x8cb6('0x30')][_0x8cb6('0x39')]){_0x2fb8fd[_0x8cb6('0x3a')]=_[_0x8cb6('0x3b')](_0x2fb8fd[_0x8cb6('0x3a')],{'$or':_[_0x8cb6('0x2f')](_0x325b06,function(_0x5eed12){if(_0x5eed12[_0x8cb6('0x2c')]!=='VIRTUAL'){var _0x48ea08={};_0x48ea08[_0x5eed12[_0x8cb6('0x29')]]={'$like':'%'+_0x268d48[_0x8cb6('0x30')]['filter']+'%'};return _0x48ea08;}})});}_0x2fb8fd=_['merge']({},_0x2fb8fd,_0x268d48[_0x8cb6('0x3c')]);var _0x56c10d={'where':_0x2fb8fd[_0x8cb6('0x3a')]};return db['VoiceQueuesLog'][_0x8cb6('0x1e')](_0x56c10d)[_0x8cb6('0x25')](function(_0x1a60e4){_0x2d9990[_0x8cb6('0x1e')]=_0x1a60e4;if(_0x268d48['query'][_0x8cb6('0x3d')]){_0x2fb8fd[_0x8cb6('0x3e')]=[{'all':!![]}];}return db[_0x8cb6('0x2b')][_0x8cb6('0x3f')](_0x2fb8fd);})[_0x8cb6('0x25')](function(_0x13cebf){_0x2d9990[_0x8cb6('0x40')]=_0x13cebf;return _0x2d9990;})[_0x8cb6('0x25')](respondWithFilteredResult(_0x524837,_0x2fb8fd))[_0x8cb6('0x41')](handleError(_0x524837,null));};exports[_0x8cb6('0x42')]=function(_0x157301,_0x3e9866){var _0x252376={'raw':!![],'where':{'id':_0x157301[_0x8cb6('0x43')]['id']}},_0x1a618e={};_0x1a618e[_0x8cb6('0x2e')]=_[_0x8cb6('0x31')](db[_0x8cb6('0x2b')]['rawAttributes']);_0x1a618e[_0x8cb6('0x30')]=_[_0x8cb6('0x31')](_0x157301[_0x8cb6('0x30')]);_0x1a618e[_0x8cb6('0x32')]=_[_0x8cb6('0x33')](_0x1a618e[_0x8cb6('0x2e')],_0x1a618e['query']);_0x252376[_0x8cb6('0x35')]=_[_0x8cb6('0x33')](_0x1a618e['model'],qs[_0x8cb6('0x34')](_0x157301[_0x8cb6('0x30')][_0x8cb6('0x34')]));_0x252376['attributes']=_0x252376[_0x8cb6('0x35')][_0x8cb6('0x44')]?_0x252376[_0x8cb6('0x35')]:_0x1a618e[_0x8cb6('0x2e')];if(_0x157301[_0x8cb6('0x30')][_0x8cb6('0x3d')]){_0x252376['include']=[{'all':!![]}];}_0x252376=_[_0x8cb6('0x3b')]({},_0x252376,_0x157301[_0x8cb6('0x3c')]);return db[_0x8cb6('0x2b')]['find'](_0x252376)[_0x8cb6('0x25')](handleEntityNotFound(_0x3e9866,null))[_0x8cb6('0x25')](respondWithResult(_0x3e9866,null))[_0x8cb6('0x41')](handleError(_0x3e9866,null));};exports['create']=function(_0x19b3ac,_0x153c9a){return db[_0x8cb6('0x2b')][_0x8cb6('0x45')](_0x19b3ac[_0x8cb6('0x46')],{})[_0x8cb6('0x25')](respondWithResult(_0x153c9a,0xc9))['catch'](handleError(_0x153c9a,null));};exports[_0x8cb6('0x24')]=function(_0x545c24,_0x3bd7e7){if(_0x545c24[_0x8cb6('0x46')]['id']){delete _0x545c24[_0x8cb6('0x46')]['id'];}return db[_0x8cb6('0x2b')][_0x8cb6('0x47')]({'where':{'id':_0x545c24[_0x8cb6('0x43')]['id']}})['then'](handleEntityNotFound(_0x3bd7e7,null))['then'](saveUpdates(_0x545c24['body'],null))[_0x8cb6('0x25')](respondWithResult(_0x3bd7e7,null))[_0x8cb6('0x41')](handleError(_0x3bd7e7,null));};exports['destroy']=function(_0x121d8d,_0x13662e){return db[_0x8cb6('0x2b')][_0x8cb6('0x47')]({'where':{'id':_0x121d8d[_0x8cb6('0x43')]['id']}})[_0x8cb6('0x25')](handleEntityNotFound(_0x13662e,null))[_0x8cb6('0x25')](removeEntity(_0x13662e,null))[_0x8cb6('0x41')](handleError(_0x13662e,null));}; \ No newline at end of file +var _0x5b89=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','update','destroy','then','error','stack','name','index','VoiceQueuesLog','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','include','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x5c9212,_0x1a8da3){var _0x4c734d=function(_0x33f563){while(--_0x33f563){_0x5c9212['push'](_0x5c9212['shift']());}};_0x4c734d(++_0x1a8da3);}(_0x5b89,0x1e3));var _0x95b8=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0x5b89[_0x390a19];return _0x5d8230;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95b8('0x1'));var rp=require(_0x95b8('0x2'));var moment=require(_0x95b8('0x3'));var BPromise=require(_0x95b8('0x4'));var Mustache=require(_0x95b8('0x5'));var util=require(_0x95b8('0x6'));var path=require(_0x95b8('0x7'));var sox=require(_0x95b8('0x8'));var csv=require(_0x95b8('0x9'));var ejs=require(_0x95b8('0xa'));var fs=require('fs');var fs_extra=require(_0x95b8('0xb'));var _=require(_0x95b8('0xc'));var squel=require('squel');var crypto=require(_0x95b8('0xd'));var jsforce=require(_0x95b8('0xe'));var deskjs=require(_0x95b8('0xf'));var toCsv=require(_0x95b8('0x9'));var querystring=require('querystring');var Papa=require(_0x95b8('0x10'));var Redis=require(_0x95b8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x95b8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95b8('0x13'))(_0x95b8('0x14'));var utils=require(_0x95b8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x95b8('0x16'));var db=require(_0x95b8('0x17'))['db'];function respondWithStatusCode(_0x5b96ff,_0x4912){_0x4912=_0x4912||0xcc;return function(_0x353f6a){if(_0x353f6a){return _0x5b96ff[_0x95b8('0x18')](_0x4912);}return _0x5b96ff[_0x95b8('0x19')](_0x4912)[_0x95b8('0x1a')]();};}function respondWithResult(_0x3518fa,_0x188f62){_0x188f62=_0x188f62||0xc8;return function(_0x5bb330){if(_0x5bb330){return _0x3518fa[_0x95b8('0x19')](_0x188f62)[_0x95b8('0x1b')](_0x5bb330);}};}function respondWithFilteredResult(_0x372d3c,_0xa40b26){return function(_0x31908a){if(_0x31908a){var _0x255ca1=typeof _0xa40b26['offset']==='undefined'&&typeof _0xa40b26[_0x95b8('0x1c')]===_0x95b8('0x1d');var _0x527944=_0x31908a[_0x95b8('0x1e')];var _0x2c8469=_0x255ca1?0x0:_0xa40b26[_0x95b8('0x1f')];var _0x19ecdb=_0x255ca1?_0x31908a['count']:_0xa40b26[_0x95b8('0x1f')]+_0xa40b26['limit'];var _0x55172e;if(_0x19ecdb>=_0x527944){_0x19ecdb=_0x527944;_0x55172e=0xc8;}else{_0x55172e=0xce;}_0x372d3c[_0x95b8('0x19')](_0x55172e);return _0x372d3c['set'](_0x95b8('0x20'),_0x2c8469+'-'+_0x19ecdb+'/'+_0x527944)[_0x95b8('0x1b')](_0x31908a);}return null;};}function patchUpdates(_0x2bd4a9){return function(_0x41affc){try{jsonpatch['apply'](_0x41affc,_0x2bd4a9,!![]);}catch(_0x32d30d){return BPromise[_0x95b8('0x21')](_0x32d30d);}return _0x41affc['save']();};}function saveUpdates(_0x5f2701,_0x4e219b){return function(_0x16c608){if(_0x16c608){return _0x16c608[_0x95b8('0x22')](_0x5f2701)['then'](function(_0x4e3a00){return _0x4e3a00;});}return null;};}function removeEntity(_0x4b436f,_0x196580){return function(_0x46b81d){if(_0x46b81d){return _0x46b81d[_0x95b8('0x23')]()[_0x95b8('0x24')](function(){_0x4b436f['status'](0xcc)[_0x95b8('0x1a')]();});}};}function handleEntityNotFound(_0x18f06e,_0x374920){return function(_0xca9e4a){if(!_0xca9e4a){_0x18f06e[_0x95b8('0x18')](0x194);}return _0xca9e4a;};}function handleError(_0x298811,_0x3f4eba){_0x3f4eba=_0x3f4eba||0x1f4;return function(_0xdaa887){logger[_0x95b8('0x25')](_0xdaa887[_0x95b8('0x26')]);if(_0xdaa887['name']){delete _0xdaa887[_0x95b8('0x27')];}_0x298811[_0x95b8('0x19')](_0x3f4eba)['send'](_0xdaa887);};}exports[_0x95b8('0x28')]=function(_0x1a04a2,_0x3f6c91){var _0x14c25f={},_0x42d038={},_0x3fdd4b={'count':0x0,'rows':[]};var _0x3d647e=_['map'](db[_0x95b8('0x29')][_0x95b8('0x2a')],function(_0x55228b){return{'name':_0x55228b[_0x95b8('0x2b')],'type':_0x55228b[_0x95b8('0x2c')]['key']};});_0x42d038[_0x95b8('0x2d')]=_[_0x95b8('0x2e')](_0x3d647e,_0x95b8('0x27'));_0x42d038[_0x95b8('0x2f')]=_[_0x95b8('0x30')](_0x1a04a2[_0x95b8('0x2f')]);_0x42d038[_0x95b8('0x31')]=_[_0x95b8('0x32')](_0x42d038['model'],_0x42d038[_0x95b8('0x2f')]);_0x14c25f[_0x95b8('0x33')]=_[_0x95b8('0x32')](_0x42d038[_0x95b8('0x2d')],qs[_0x95b8('0x34')](_0x1a04a2[_0x95b8('0x2f')][_0x95b8('0x34')]));_0x14c25f[_0x95b8('0x33')]=_0x14c25f[_0x95b8('0x33')][_0x95b8('0x35')]?_0x14c25f['attributes']:_0x42d038['model'];if(!_0x1a04a2['query'][_0x95b8('0x36')](_0x95b8('0x37'))){_0x14c25f[_0x95b8('0x1c')]=qs[_0x95b8('0x1c')](_0x1a04a2[_0x95b8('0x2f')][_0x95b8('0x1c')]);_0x14c25f[_0x95b8('0x1f')]=qs['offset'](_0x1a04a2['query'][_0x95b8('0x1f')]);}_0x14c25f['order']=qs[_0x95b8('0x38')](_0x1a04a2['query']['sort']);_0x14c25f[_0x95b8('0x39')]=qs[_0x95b8('0x31')](_[_0x95b8('0x3a')](_0x1a04a2[_0x95b8('0x2f')],_0x42d038['filters']),_0x3d647e);if(_0x1a04a2[_0x95b8('0x2f')][_0x95b8('0x3b')]){_0x14c25f[_0x95b8('0x39')]=_[_0x95b8('0x3c')](_0x14c25f[_0x95b8('0x39')],{'$or':_[_0x95b8('0x2e')](_0x3d647e,function(_0x3e6609){if(_0x3e6609[_0x95b8('0x2c')]!=='VIRTUAL'){var _0xba6b56={};_0xba6b56[_0x3e6609['name']]={'$like':'%'+_0x1a04a2[_0x95b8('0x2f')]['filter']+'%'};return _0xba6b56;}})});}_0x14c25f=_[_0x95b8('0x3c')]({},_0x14c25f,_0x1a04a2[_0x95b8('0x3d')]);var _0x593cdf={'where':_0x14c25f[_0x95b8('0x39')]};return db[_0x95b8('0x29')][_0x95b8('0x1e')](_0x593cdf)[_0x95b8('0x24')](function(_0x54ae64){_0x3fdd4b[_0x95b8('0x1e')]=_0x54ae64;if(_0x1a04a2[_0x95b8('0x2f')][_0x95b8('0x3e')]){_0x14c25f['include']=[{'all':!![]}];}return db[_0x95b8('0x29')]['findAll'](_0x14c25f);})[_0x95b8('0x24')](function(_0x12af55){_0x3fdd4b[_0x95b8('0x3f')]=_0x12af55;return _0x3fdd4b;})[_0x95b8('0x24')](respondWithFilteredResult(_0x3f6c91,_0x14c25f))[_0x95b8('0x40')](handleError(_0x3f6c91,null));};exports[_0x95b8('0x41')]=function(_0x16ba9d,_0x43e906){var _0x5962db={'raw':!![],'where':{'id':_0x16ba9d[_0x95b8('0x42')]['id']}},_0x2d4103={};_0x2d4103[_0x95b8('0x2d')]=_[_0x95b8('0x30')](db[_0x95b8('0x29')][_0x95b8('0x2a')]);_0x2d4103[_0x95b8('0x2f')]=_['keys'](_0x16ba9d[_0x95b8('0x2f')]);_0x2d4103[_0x95b8('0x31')]=_[_0x95b8('0x32')](_0x2d4103[_0x95b8('0x2d')],_0x2d4103['query']);_0x5962db[_0x95b8('0x33')]=_['intersection'](_0x2d4103[_0x95b8('0x2d')],qs['fields'](_0x16ba9d[_0x95b8('0x2f')]['fields']));_0x5962db[_0x95b8('0x33')]=_0x5962db[_0x95b8('0x33')][_0x95b8('0x35')]?_0x5962db[_0x95b8('0x33')]:_0x2d4103[_0x95b8('0x2d')];if(_0x16ba9d[_0x95b8('0x2f')][_0x95b8('0x3e')]){_0x5962db[_0x95b8('0x43')]=[{'all':!![]}];}_0x5962db=_[_0x95b8('0x3c')]({},_0x5962db,_0x16ba9d['options']);return db[_0x95b8('0x29')][_0x95b8('0x44')](_0x5962db)[_0x95b8('0x24')](handleEntityNotFound(_0x43e906,null))[_0x95b8('0x24')](respondWithResult(_0x43e906,null))[_0x95b8('0x40')](handleError(_0x43e906,null));};exports[_0x95b8('0x45')]=function(_0x2f0ecc,_0x231366){return db['VoiceQueuesLog'][_0x95b8('0x45')](_0x2f0ecc[_0x95b8('0x46')],{})[_0x95b8('0x24')](respondWithResult(_0x231366,0xc9))[_0x95b8('0x40')](handleError(_0x231366,null));};exports[_0x95b8('0x22')]=function(_0x1b95e9,_0x1218ff){if(_0x1b95e9[_0x95b8('0x46')]['id']){delete _0x1b95e9['body']['id'];}return db[_0x95b8('0x29')][_0x95b8('0x44')]({'where':{'id':_0x1b95e9[_0x95b8('0x42')]['id']}})[_0x95b8('0x24')](handleEntityNotFound(_0x1218ff,null))['then'](saveUpdates(_0x1b95e9[_0x95b8('0x46')],null))[_0x95b8('0x24')](respondWithResult(_0x1218ff,null))[_0x95b8('0x40')](handleError(_0x1218ff,null));};exports[_0x95b8('0x23')]=function(_0x12f47c,_0x267010){return db[_0x95b8('0x29')][_0x95b8('0x44')]({'where':{'id':_0x12f47c[_0x95b8('0x42')]['id']}})['then'](handleEntityNotFound(_0x267010,null))[_0x95b8('0x24')](removeEntity(_0x267010,null))['catch'](handleError(_0x267010,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3f327e5..45ddc88 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 _0xc792=['exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes'];(function(_0x23c844,_0x43ada0){var _0x1eeead=function(_0x51625e){while(--_0x51625e){_0x23c844['push'](_0x23c844['shift']());}};_0x1eeead(++_0x43ada0);}(_0xc792,0x1e5));var _0x2c79=function(_0x2390e5,_0x369025){_0x2390e5=_0x2390e5-0x0;var _0xa6038f=_0xc792[_0x2390e5];return _0xa6038f;};'use strict';var _=require(_0x2c79('0x0'));var util=require(_0x2c79('0x1'));var logger=require(_0x2c79('0x2'))(_0x2c79('0x3'));var moment=require(_0x2c79('0x4'));var BPromise=require(_0x2c79('0x5'));var rp=require(_0x2c79('0x6'));var fs=require('fs');var path=require(_0x2c79('0x7'));var rimraf=require(_0x2c79('0x8'));var config=require('../../config/environment');var attributes=require(_0x2c79('0x9'));module[_0x2c79('0xa')]=function(_0x4d031c,_0x490807){return _0x4d031c[_0x2c79('0xb')](_0x2c79('0xc'),attributes,{'tableName':_0x2c79('0xd'),'paranoid':![],'indexes':[{'name':_0x2c79('0xe'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xab55=['../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x340b3c,_0x119c87){var _0x183fff=function(_0x6d0f90){while(--_0x6d0f90){_0x340b3c['push'](_0x340b3c['shift']());}};_0x183fff(++_0x119c87);}(_0xab55,0x139));var _0x5ab5=function(_0x3b1967,_0x229b28){_0x3b1967=_0x3b1967-0x0;var _0x100bc1=_0xab55[_0x3b1967];return _0x100bc1;};'use strict';var _=require(_0x5ab5('0x0'));var util=require(_0x5ab5('0x1'));var logger=require(_0x5ab5('0x2'))(_0x5ab5('0x3'));var moment=require('moment');var BPromise=require(_0x5ab5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ab5('0x5'));var rimraf=require(_0x5ab5('0x6'));var config=require(_0x5ab5('0x7'));var attributes=require(_0x5ab5('0x8'));module[_0x5ab5('0x9')]=function(_0x37fce1,_0x27d170){return _0x37fce1[_0x5ab5('0xa')](_0x5ab5('0xb'),attributes,{'tableName':_0x5ab5('0xc'),'paranoid':![],'indexes':[{'name':_0x5ab5('0xd'),'fields':[_0x5ab5('0xe'),_0x5ab5('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0901c3a..8970350 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 _0xd898=['request\x20sent','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug'];(function(_0x246402,_0x3b17aa){var _0x4af878=function(_0x2f3cd5){while(--_0x2f3cd5){_0x246402['push'](_0x246402['shift']());}};_0x4af878(++_0x3b17aa);}(_0xd898,0x133));var _0x8d89=function(_0x380d7a,_0x32ffac){_0x380d7a=_0x380d7a-0x0;var _0x8e929d=_0xd898[_0x380d7a];return _0x8e929d;};'use strict';var _=require(_0x8d89('0x0'));var util=require(_0x8d89('0x1'));var moment=require('moment');var BPromise=require(_0x8d89('0x2'));var rs=require(_0x8d89('0x3'));var fs=require('fs');var Redis=require(_0x8d89('0x4'));var db=require(_0x8d89('0x5'))['db'];var utils=require(_0x8d89('0x6'));var logger=require('../../config/logger')(_0x8d89('0x7'));var config=require(_0x8d89('0x8'));var jayson=require(_0x8d89('0x9'));var client=jayson[_0x8d89('0xa')][_0x8d89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52ea51,_0x5f1085,_0x11ff40){return new BPromise(function(_0x4728f3,_0x111c1c){return client[_0x8d89('0xc')](_0x52ea51,_0x11ff40)[_0x8d89('0xd')](function(_0x1a4dda){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x5f1085,'request\x20sent');logger[_0x8d89('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x5f1085,_0x8d89('0xf'),JSON['stringify'](_0x1a4dda));if(_0x1a4dda[_0x8d89('0x10')]){if(_0x1a4dda[_0x8d89('0x10')][_0x8d89('0x11')]===0x1f4){logger['error'](_0x8d89('0x12'),_0x5f1085,_0x1a4dda[_0x8d89('0x10')][_0x8d89('0x13')]);return _0x111c1c(_0x1a4dda['error'][_0x8d89('0x13')]);}logger[_0x8d89('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5f1085,_0x1a4dda['error'][_0x8d89('0x13')]);return _0x4728f3(_0x1a4dda[_0x8d89('0x10')]['message']);}else{logger[_0x8d89('0x14')](_0x8d89('0x12'),_0x5f1085,_0x8d89('0xf'));_0x4728f3(_0x1a4dda[_0x8d89('0x15')]['message']);}})[_0x8d89('0x16')](function(_0x15828f){logger[_0x8d89('0x10')](_0x8d89('0x12'),_0x5f1085,_0x15828f);_0x111c1c(_0x15828f);});});} \ No newline at end of file +var _0x357b=['util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x228f06,_0x187279){var _0x51fe32=function(_0xee73e7){while(--_0xee73e7){_0x228f06['push'](_0x228f06['shift']());}};_0x51fe32(++_0x187279);}(_0x357b,0x164));var _0xb357=function(_0x1a8f31,_0x3817a7){_0x1a8f31=_0x1a8f31-0x0;var _0x3a9467=_0x357b[_0x1a8f31];return _0x3a9467;};'use strict';var _=require(_0xb357('0x0'));var util=require(_0xb357('0x1'));var moment=require('moment');var BPromise=require(_0xb357('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb357('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb357('0x4'));var logger=require('../../config/logger')(_0xb357('0x5'));var config=require(_0xb357('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb357('0x7')][_0xb357('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17fd6e,_0x40cc01,_0x4d1f38){return new BPromise(function(_0xe9f645,_0x112f80){return client[_0xb357('0x9')](_0x17fd6e,_0x4d1f38)[_0xb357('0xa')](function(_0x2d8e49){logger[_0xb357('0xb')](_0xb357('0xc'),_0x40cc01,_0xb357('0xd'));logger['debug'](_0xb357('0xe'),_0x40cc01,'request\x20sent',JSON[_0xb357('0xf')](_0x2d8e49));if(_0x2d8e49['error']){if(_0x2d8e49[_0xb357('0x10')][_0xb357('0x11')]===0x1f4){logger[_0xb357('0x10')](_0xb357('0xc'),_0x40cc01,_0x2d8e49[_0xb357('0x10')][_0xb357('0x12')]);return _0x112f80(_0x2d8e49[_0xb357('0x10')]['message']);}logger[_0xb357('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x40cc01,_0x2d8e49[_0xb357('0x10')][_0xb357('0x12')]);return _0xe9f645(_0x2d8e49[_0xb357('0x10')][_0xb357('0x12')]);}else{logger['info'](_0xb357('0xc'),_0x40cc01,_0xb357('0xd'));_0xe9f645(_0x2d8e49[_0xb357('0x13')][_0xb357('0x12')]);}})[_0xb357('0x14')](function(_0x5ded98){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x40cc01,_0x5ded98);_0x112f80(_0x5ded98);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4ded54d..c2d3b16 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 _0x95fd=['isAuthenticated','/describe','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','create','post','runTranscribe','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x5af433,_0x128be5){var _0x89f8b7=function(_0x3ac05c){while(--_0x3ac05c){_0x5af433['push'](_0x5af433['shift']());}};_0x89f8b7(++_0x128be5);}(_0x95fd,0x17b));var _0xd95f=function(_0x524602,_0x22a63b){_0x524602=_0x524602-0x0;var _0x3536e0=_0x95fd[_0x524602];return _0x3536e0;};'use strict';var multer=require(_0xd95f('0x0'));var util=require('util');var path=require(_0xd95f('0x1'));var timeout=require(_0xd95f('0x2'));var express=require(_0xd95f('0x3'));var router=express[_0xd95f('0x4')]();var fs_extra=require(_0xd95f('0x5'));var auth=require(_0xd95f('0x6'));var interaction=require(_0xd95f('0x7'));var config=require(_0xd95f('0x8'));var controller=require(_0xd95f('0x9'));router[_0xd95f('0xa')]('/',auth[_0xd95f('0xb')](),controller['index']);router[_0xd95f('0xa')](_0xd95f('0xc'),auth['isAuthenticated'](),controller[_0xd95f('0xd')]);router[_0xd95f('0xa')](_0xd95f('0xe'),auth[_0xd95f('0xb')](),controller[_0xd95f('0xf')]);router[_0xd95f('0xa')]('/:id/download',auth[_0xd95f('0xb')](),controller[_0xd95f('0x10')]);router[_0xd95f('0xa')](_0xd95f('0x11'),controller[_0xd95f('0x12')]);router[_0xd95f('0xa')](_0xd95f('0x13'),auth['isAuthenticated'](),controller['downloadTranscribe']);router['post']('/',auth[_0xd95f('0xb')](),controller[_0xd95f('0x14')]);router[_0xd95f('0x15')](_0xd95f('0x13'),auth['isAuthenticated'](),controller[_0xd95f('0x16')]);router[_0xd95f('0x17')](_0xd95f('0xe'),auth['isAuthenticated'](),controller[_0xd95f('0x18')]);router['delete']('/:id',auth[_0xd95f('0xb')](),controller['destroy']);module[_0xd95f('0x19')]=router; \ No newline at end of file +var _0x2424=['../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','describe','get','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x2424,0x125));var _0x4242=function(_0x57e39b,_0x278e4d){_0x57e39b=_0x57e39b-0x0;var _0x5bf0d2=_0x2424[_0x57e39b];return _0x5bf0d2;};'use strict';var multer=require(_0x4242('0x0'));var util=require(_0x4242('0x1'));var path=require('path');var timeout=require(_0x4242('0x2'));var express=require(_0x4242('0x3'));var router=express[_0x4242('0x4')]();var fs_extra=require(_0x4242('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4242('0x6'));var config=require(_0x4242('0x7'));var controller=require(_0x4242('0x8'));router['get']('/',auth[_0x4242('0x9')](),controller[_0x4242('0xa')]);router['get'](_0x4242('0xb'),auth[_0x4242('0x9')](),controller[_0x4242('0xc')]);router[_0x4242('0xd')]('/:id',auth[_0x4242('0x9')](),controller['show']);router[_0x4242('0xd')]('/:id/download',auth[_0x4242('0x9')](),controller['download']);router[_0x4242('0xd')](_0x4242('0xe'),controller[_0x4242('0xf')]);router[_0x4242('0xd')](_0x4242('0x10'),auth[_0x4242('0x9')](),controller[_0x4242('0x11')]);router[_0x4242('0x12')]('/',auth[_0x4242('0x9')](),controller[_0x4242('0x13')]);router['post'](_0x4242('0x10'),auth[_0x4242('0x9')](),controller[_0x4242('0x14')]);router['put'](_0x4242('0x15'),auth[_0x4242('0x9')](),controller['update']);router[_0x4242('0x16')](_0x4242('0x15'),auth[_0x4242('0x9')](),controller[_0x4242('0x17')]);module[_0x4242('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 960beac..2e78726 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(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 28a28a5..0d86374 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 _0xea8c=['[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','VoiceRecording','rawAttributes','type','key','model','format','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','length','merge','create','body','update','find','params','describe','download','uniqueid','value','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','push','$and','decryptFile','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','Bucket','location'];(function(_0x42cd6c,_0x55c5ca){var _0x10ba47=function(_0x6c526f){while(--_0x6c526f){_0x42cd6c['push'](_0x42cd6c['shift']());}};_0x10ba47(++_0x55c5ca);}(_0xea8c,0x15e));var _0xcea8=function(_0x5f2132,_0x3eb524){_0x5f2132=_0x5f2132-0x0;var _0x347271=_0xea8c[_0x5f2132];return _0x347271;};'use strict';var emlformat=require(_0xcea8('0x0'));var rimraf=require(_0xcea8('0x1'));var zipdir=require(_0xcea8('0x2'));var jsonpatch=require(_0xcea8('0x3'));var rp=require(_0xcea8('0x4'));var moment=require(_0xcea8('0x5'));var BPromise=require(_0xcea8('0x6'));var Mustache=require(_0xcea8('0x7'));var util=require(_0xcea8('0x8'));var path=require(_0xcea8('0x9'));var sox=require(_0xcea8('0xa'));var csv=require(_0xcea8('0xb'));var ejs=require(_0xcea8('0xc'));var fs=require('fs');var fs_extra=require(_0xcea8('0xd'));var _=require('lodash');var squel=require(_0xcea8('0xe'));var crypto=require('crypto');var jsforce=require(_0xcea8('0xf'));var deskjs=require(_0xcea8('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcea8('0x11'));var Papa=require(_0xcea8('0x12'));var AWS=require('aws-sdk');var uuidv4=require(_0xcea8('0x13'));var Redis=require(_0xcea8('0x14'));var authService=require(_0xcea8('0x15'));var qs=require(_0xcea8('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcea8('0x17'));var logger=require(_0xcea8('0x18'))(_0xcea8('0x19'));var utils=require(_0xcea8('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29b691,_0x467a54){_0x467a54=_0x467a54||0xcc;return function(_0x50b8f9){if(_0x50b8f9){return _0x29b691[_0xcea8('0x1b')](_0x467a54);}return _0x29b691[_0xcea8('0x1c')](_0x467a54)['end']();};}function respondWithResult(_0x47c192,_0x3f37c3){_0x3f37c3=_0x3f37c3||0xc8;return function(_0x3dea5d){if(_0x3dea5d){return _0x47c192[_0xcea8('0x1c')](_0x3f37c3)[_0xcea8('0x1d')](_0x3dea5d);}};}function respondWithFilteredResult(_0x1f32fa,_0x29f602){return function(_0x2d48eb){if(_0x2d48eb){var _0x443e3d=typeof _0x29f602[_0xcea8('0x1e')]===_0xcea8('0x1f')&&typeof _0x29f602['limit']==='undefined';var _0x3ce429=_0x2d48eb[_0xcea8('0x20')];var _0x25f364=_0x443e3d?0x0:_0x29f602[_0xcea8('0x1e')];var _0x8a8199=_0x443e3d?_0x2d48eb[_0xcea8('0x20')]:_0x29f602[_0xcea8('0x1e')]+_0x29f602['limit'];var _0x59e1e8;if(_0x8a8199>=_0x3ce429){_0x8a8199=_0x3ce429;_0x59e1e8=0xc8;}else{_0x59e1e8=0xce;}_0x1f32fa[_0xcea8('0x1c')](_0x59e1e8);return _0x1f32fa[_0xcea8('0x21')](_0xcea8('0x22'),_0x25f364+'-'+_0x8a8199+'/'+_0x3ce429)[_0xcea8('0x1d')](_0x2d48eb);}return null;};}function patchUpdates(_0x3702af){return function(_0x451b5a){try{jsonpatch[_0xcea8('0x23')](_0x451b5a,_0x3702af,!![]);}catch(_0xbdb687){return BPromise[_0xcea8('0x24')](_0xbdb687);}return _0x451b5a[_0xcea8('0x25')]();};}function saveUpdates(_0x38e9db,_0xfd5112){return function(_0x16467c){if(_0x16467c){return _0x16467c['update'](_0x38e9db)[_0xcea8('0x26')](function(_0x5869f1){return _0x5869f1;});}return null;};}function removeEntity(_0x2a98e6,_0xcd5193){return function(_0x2db2fd){if(_0x2db2fd){return _0x2db2fd[_0xcea8('0x27')]()['then'](function(){_0x2a98e6['status'](0xcc)[_0xcea8('0x28')]();});}};}function handleEntityNotFound(_0x415f01,_0x24a795){return function(_0x4842ed){if(!_0x4842ed){_0x415f01['sendStatus'](0x194);}return _0x4842ed;};}function handleError(_0x1f6dd4,_0x233927){_0x233927=_0x233927||0x1f4;return function(_0x5d26c6){logger[_0xcea8('0x29')](_0x5d26c6[_0xcea8('0x2a')]);if(_0x5d26c6[_0xcea8('0x2b')]){delete _0x5d26c6[_0xcea8('0x2b')];}_0x1f6dd4[_0xcea8('0x1c')](_0x233927)['send'](_0x5d26c6);};}exports[_0xcea8('0x2c')]=function(_0x2d3d91,_0xea7f6f){var _0x21264d={},_0x5378fd={},_0x5cd0a7={'count':0x0,'rows':[]};var _0x74d1e3=_[_0xcea8('0x2d')](db[_0xcea8('0x2e')][_0xcea8('0x2f')],function(_0x5cc8c7){return{'name':_0x5cc8c7['fieldName'],'type':_0x5cc8c7[_0xcea8('0x30')][_0xcea8('0x31')]};});_0x5378fd[_0xcea8('0x32')]=_['differenceBy'](_[_0xcea8('0x2d')](_0x74d1e3,_0xcea8('0x2b')),[_0xcea8('0x33')]);_0x5378fd[_0xcea8('0x34')]=_[_0xcea8('0x35')](_0x2d3d91[_0xcea8('0x34')]);_0x5378fd[_0xcea8('0x36')]=_['intersection'](_0x5378fd[_0xcea8('0x32')],_0x5378fd[_0xcea8('0x34')]);_0x21264d[_0xcea8('0x37')]=_[_0xcea8('0x38')](_0x5378fd[_0xcea8('0x32')],qs[_0xcea8('0x39')](_0x2d3d91[_0xcea8('0x34')]['fields']));_0x21264d['attributes']=_0x21264d[_0xcea8('0x37')]['length']?_0x21264d[_0xcea8('0x37')]:_0x5378fd['model'];if(!_0x2d3d91['query'][_0xcea8('0x3a')]('nolimit')){_0x21264d['limit']=qs[_0xcea8('0x3b')](_0x2d3d91[_0xcea8('0x34')][_0xcea8('0x3b')]);_0x21264d[_0xcea8('0x1e')]=qs[_0xcea8('0x1e')](_0x2d3d91[_0xcea8('0x34')][_0xcea8('0x1e')]);}_0x21264d[_0xcea8('0x3c')]=qs['sort'](_0x2d3d91['query'][_0xcea8('0x3d')]);_0x21264d[_0xcea8('0x3e')]=qs[_0xcea8('0x36')](_[_0xcea8('0x3f')](_0x2d3d91[_0xcea8('0x34')],_0x5378fd[_0xcea8('0x36')]),_0x74d1e3);if(_0x2d3d91[_0xcea8('0x34')][_0xcea8('0x40')]){_0x21264d[_0xcea8('0x3e')]=_['merge'](_0x21264d[_0xcea8('0x3e')],{'$or':_['map'](_0x74d1e3,function(_0x4695f6){if(_0x4695f6['type']!==_0xcea8('0x41')){var _0x333649={};_0x333649[_0x4695f6[_0xcea8('0x2b')]]={'$like':'%'+_0x2d3d91['query'][_0xcea8('0x40')]+'%'};return _0x333649;}})});}_0x21264d=_['merge']({},_0x21264d,_0x2d3d91[_0xcea8('0x42')]);var _0x2463be={'where':_0x21264d[_0xcea8('0x3e')]};return db[_0xcea8('0x2e')]['count'](_0x2463be)[_0xcea8('0x26')](function(_0x155495){_0x5cd0a7[_0xcea8('0x20')]=_0x155495;if(_0x2d3d91[_0xcea8('0x34')]['includeAll']){_0x21264d[_0xcea8('0x43')]=[{'all':!![]}];}return db[_0xcea8('0x2e')][_0xcea8('0x44')](_0x21264d);})['then'](function(_0x2c5ea6){_0x5cd0a7[_0xcea8('0x45')]=_0x2c5ea6;return _0x5cd0a7;})['then'](respondWithFilteredResult(_0xea7f6f,_0x21264d))[_0xcea8('0x46')](handleError(_0xea7f6f,null));};exports['show']=function(_0x43c517,_0x11dff8){var _0x3ae857={'raw':![],'where':{'id':_0x43c517['params']['id']}},_0x33a2e0={};_0x33a2e0[_0xcea8('0x32')]=_[_0xcea8('0x35')](db[_0xcea8('0x2e')][_0xcea8('0x2f')]);_0x33a2e0[_0xcea8('0x34')]=_[_0xcea8('0x35')](_0x43c517['query']);_0x33a2e0[_0xcea8('0x36')]=_[_0xcea8('0x38')](_0x33a2e0[_0xcea8('0x32')],_0x33a2e0[_0xcea8('0x34')]);_0x3ae857[_0xcea8('0x37')]=_[_0xcea8('0x38')](_0x33a2e0['model'],qs[_0xcea8('0x39')](_0x43c517['query'][_0xcea8('0x39')]));_0x3ae857['attributes']=_0x3ae857[_0xcea8('0x37')][_0xcea8('0x47')]?_0x3ae857[_0xcea8('0x37')]:_0x33a2e0[_0xcea8('0x32')];if(_0x43c517[_0xcea8('0x34')]['includeAll']){_0x3ae857[_0xcea8('0x43')]=[{'all':!![]}];}_0x3ae857=_[_0xcea8('0x48')]({},_0x3ae857,_0x43c517[_0xcea8('0x42')]);return db[_0xcea8('0x2e')]['find'](_0x3ae857)[_0xcea8('0x26')](handleEntityNotFound(_0x11dff8,null))[_0xcea8('0x26')](respondWithResult(_0x11dff8,null))['catch'](handleError(_0x11dff8,null));};exports[_0xcea8('0x49')]=function(_0x5a8236,_0x23b39c){return db['VoiceRecording'][_0xcea8('0x49')](_0x5a8236[_0xcea8('0x4a')],{})[_0xcea8('0x26')](respondWithResult(_0x23b39c,0xc9))[_0xcea8('0x46')](handleError(_0x23b39c,null));};exports[_0xcea8('0x4b')]=function(_0x3d01b5,_0x25fe8f){if(_0x3d01b5[_0xcea8('0x4a')]['id']){delete _0x3d01b5[_0xcea8('0x4a')]['id'];}return db[_0xcea8('0x2e')][_0xcea8('0x4c')]({'where':{'id':_0x3d01b5[_0xcea8('0x4d')]['id']}})[_0xcea8('0x26')](handleEntityNotFound(_0x25fe8f,null))[_0xcea8('0x26')](saveUpdates(_0x3d01b5[_0xcea8('0x4a')],null))['then'](respondWithResult(_0x25fe8f,null))[_0xcea8('0x46')](handleError(_0x25fe8f,null));};exports[_0xcea8('0x4e')]=function(_0x314b01,_0x25e21b){return db[_0xcea8('0x2e')][_0xcea8('0x4e')]()['then'](respondWithResult(_0x25e21b,null))[_0xcea8('0x46')](handleError(_0x25e21b,null));};exports[_0xcea8('0x4f')]=function(_0x3dfab8,_0x4d4e5a,_0x4fd75d){var _0x4ec579=require('../../components/encryptor');var _0x54ddc3=![];var _0x27552c={};if(_0x3dfab8['query'][_0xcea8('0x30')]&&_0x3dfab8[_0xcea8('0x34')]['type']===_0xcea8('0x50')){_0x27552c[_0xcea8('0x50')]=_0x3dfab8['params']['id'];}else{_0x27552c['id']=_0x3dfab8[_0xcea8('0x4d')]['id'];}return db[_0xcea8('0x2e')][_0xcea8('0x4c')]({'where':_0x27552c,'attributes':['id',_0xcea8('0x51')],'raw':!![]})[_0xcea8('0x26')](handleEntityNotFound(_0x4d4e5a,null))[_0xcea8('0x26')](function(_0x582e03){if(_0x582e03){var _0x3a4b27=_0x582e03['value'];var _0x475c0c=util['format'](_0xcea8('0x52'),_0x3a4b27);if(fs['existsSync'](_0x475c0c)){_0x54ddc3=!![];return _0x4ec579['decryptFile'](_0x475c0c,_0x3a4b27,config[_0xcea8('0x53')][_0xcea8('0x54')])[_0xcea8('0x26')](function(){return _0x582e03;});}return _0x582e03;}})[_0xcea8('0x26')](function(_0x21b9d7){if(_0x21b9d7){var _0x77ac33=_0x21b9d7[_0xcea8('0x51')];if(!fs[_0xcea8('0x55')](_0x77ac33)){throw new db[(_0xcea8('0x56'))][(_0xcea8('0x57'))](_0xcea8('0x58'));}if(_0x21b9d7[_0xcea8('0x59')]){return _0x4d4e5a[_0xcea8('0x4f')](_0x77ac33,_0x21b9d7['filename']+path[_0xcea8('0x5a')](_0x77ac33),function(){if(_0x54ddc3){fs[_0xcea8('0x5b')](_0x77ac33);}});}else{return _0x4d4e5a['download'](_0x77ac33,function(_0x10ff39){if(_0x54ddc3){fs[_0xcea8('0x5b')](_0x77ac33);}});}}})[_0xcea8('0x46')](function(_0x1f03e0){if(_0x1f03e0[_0xcea8('0x5c')]==='VoiceRecording\x20not\x20found'){_0x4d4e5a[_0xcea8('0x1c')](0x194)[_0xcea8('0x5d')](_0xcea8('0x5e'));}else{return handleError(_0x4d4e5a,null);}});};exports[_0xcea8('0x5f')]=function(_0x20fea9,_0x714b1,_0xf0f0d8){var _0x3b5f74=require('../../components/encryptor');var _0x47676d=![];var _0x57f31d={'$and':[db[_0xcea8('0x60')][_0xcea8('0x3e')](db['sequelize']['fn'](_0xcea8('0x61'),db[_0xcea8('0x60')]['col'](_0xcea8('0x50'))),_0x20fea9[_0xcea8('0x34')]['token'])]};if(_0x20fea9[_0xcea8('0x34')][_0xcea8('0x30')]&&_0x20fea9[_0xcea8('0x34')][_0xcea8('0x30')]===_0xcea8('0x50')){_0x57f31d['$and'][_0xcea8('0x62')]({'uniqueid':_0x20fea9[_0xcea8('0x4d')]['id']});}else{_0x57f31d[_0xcea8('0x63')][_0xcea8('0x62')]({'id':_0x20fea9[_0xcea8('0x4d')]['id']});}return db['VoiceRecording'][_0xcea8('0x4c')]({'where':_0x57f31d,'attributes':['id','value'],'raw':!![]})[_0xcea8('0x26')](handleEntityNotFound(_0x714b1,null))[_0xcea8('0x26')](function(_0x1e00be){if(_0x1e00be){var _0x38513d=util['format'](_0xcea8('0x52'),_0x1e00be[_0xcea8('0x51')]);if(fs[_0xcea8('0x55')](_0x38513d)){_0x47676d=!![];return _0x3b5f74[_0xcea8('0x64')](_0x38513d,_0x1e00be[_0xcea8('0x51')],config['secrets'][_0xcea8('0x54')])[_0xcea8('0x26')](function(){return _0x1e00be;});}return _0x1e00be;}})[_0xcea8('0x26')](function(_0x4c6934){if(_0x4c6934){if(!fs['existsSync'](_0x4c6934[_0xcea8('0x51')])){throw new db[(_0xcea8('0x56'))][(_0xcea8('0x57'))](_0xcea8('0x58'));}if(_0x4c6934[_0xcea8('0x59')]){return _0x714b1[_0xcea8('0x4f')](_0x4c6934[_0xcea8('0x51')],_0x4c6934['filename']+path[_0xcea8('0x5a')](_0x4c6934['value']),function(){if(_0x47676d){fs[_0xcea8('0x5b')](_0x4c6934[_0xcea8('0x51')]);}});}else{return _0x714b1[_0xcea8('0x4f')](_0x4c6934['value'],function(_0x416458){if(_0x47676d){fs[_0xcea8('0x5b')](_0x4c6934[_0xcea8('0x51')]);}});}}})[_0xcea8('0x46')](handleError(_0x714b1,null));};exports[_0xcea8('0x27')]=function(_0xab3d84,_0x47f53c){return db[_0xcea8('0x2e')][_0xcea8('0x4c')]({'where':{'id':_0xab3d84[_0xcea8('0x4d')]['id']}})[_0xcea8('0x26')](function(_0x1bcb5d){if(_[_0xcea8('0x65')](_0x1bcb5d)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1bcb5d;})[_0xcea8('0x26')](function(_0x187cb4){var _0x16d3d7=_0x187cb4[_0xcea8('0x51')];logger[_0xcea8('0x66')](_0xcea8('0x67'),_0x16d3d7);if(!_[_0xcea8('0x65')](_0x187cb4[_0xcea8('0x51')])&&fs[_0xcea8('0x55')](_0x16d3d7)){logger['info'](_0xcea8('0x68')+_0x16d3d7+_0xcea8('0x69'));fs[_0xcea8('0x6a')](_0x16d3d7);}_0x16d3d7=_0x16d3d7+_0xcea8('0x6b');if(!_['isNil'](_0x187cb4[_0xcea8('0x51')])&&fs[_0xcea8('0x55')](_0x16d3d7)){logger[_0xcea8('0x66')](_0xcea8('0x68')+_0x16d3d7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcea8('0x6a')](_0x16d3d7);}return _0x187cb4;})['then'](function(_0x3d1109){if(!_0x3d1109)throw new InternalError();return _0x3d1109['destroy']();})[_0xcea8('0x26')](function(){_0x47f53c['status'](0xcc)[_0xcea8('0x28')]();})['catch'](handleError(_0x47f53c,null));};function getBucketslist(_0x4b2c8a,_0x25708f,_0x58b517){return new Promise(function(_0x418ad6,_0x5b5aed){var _0x47e00b=new AWS['S3']({'accessKeyId':_0x25708f,'secretAccessKey':_0x4b2c8a,'region':_0x58b517});_0x47e00b[_0xcea8('0x6c')]({},function(_0x3d99a7,_0x565814){if(_0x3d99a7){return _0x5b5aed(_0x3d99a7);}else{return _0x418ad6(_0x565814);}});});}function createBucket(_0x5c44e6,_0xed1499,_0x254ddc,_0x227ef4){return new Promise(function(_0x10099a,_0x1b843e){var _0x474983=new AWS['S3']({'accessKeyId':_0xed1499,'secretAccessKey':_0x5c44e6,'region':_0x254ddc});_0x474983[_0xcea8('0x6d')]({'Bucket':_0x227ef4},function(_0x20769b,_0xdeba62){if(_0x20769b){return _0x1b843e(_0x20769b);}else{return _0x10099a(_0xdeba62);}});});}function uploadFile(_0xdc3772,_0x159901,_0x258426,_0x4ed39b,_0x1ebdb2,_0x55a2dc){return new Promise(function(_0x3e0b33,_0x2772af){var _0x10e68b=new AWS['S3']({'accessKeyId':_0x159901,'secretAccessKey':_0xdc3772,'region':_0x258426});_0x10e68b[_0xcea8('0x6e')]({'Bucket':_0x4ed39b,'Key':_0x1ebdb2,'Body':_0x55a2dc},function(_0x2fd2ae,_0x7b50df){if(_0x2fd2ae){return _0x2772af(_0x2fd2ae);}else{return _0x3e0b33(_0x7b50df);}});});}function startTranscribe(_0x4bea69,_0x122cb7,_0x447ed2,_0x40c1a7,_0x4cb75f,_0x2536bd){return new Promise(function(_0x766fa7,_0x3334d6){var _0x3d3720=new AWS[(_0xcea8('0x6f'))]({'accessKeyId':_0x122cb7,'secretAccessKey':_0x4bea69,'region':_0x447ed2});_0x3d3720[_0xcea8('0x70')]({'TranscriptionJobName':_0x40c1a7,'LanguageCode':_0x4cb75f,'Media':{'MediaFileUri':_0x2536bd}},function(_0x6ec2f6,_0x13b2f4){if(_0x6ec2f6){return _0x3334d6(_0x6ec2f6);}else{return _0x766fa7(_0x13b2f4);}});});}function transcribe(_0x36fbfa,_0x147f6a,_0x5d03ba,_0x5fe77f,_0xd2295c,_0x11d783,_0x5551a9){return new Promise(function(_0x522a6b,_0x51e3f7){var _0x2835e7={};logger[_0xcea8('0x66')](util[_0xcea8('0x33')](_0xcea8('0x71'),_0x36fbfa,_0xd2295c));return uploadFile(_0x147f6a,_0x5d03ba,_0x5fe77f,_0xd2295c,path['basename'](_0x11d783),fs[_0xcea8('0x72')](_0x11d783))['then'](function(_0x55a1a2){logger[_0xcea8('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x36fbfa,_0xd2295c,_0x55a1a2[_0xcea8('0x73')]));_0x2835e7['bucket']=_0x55a1a2[_0xcea8('0x74')];_0x2835e7[_0xcea8('0x75')]=_0x55a1a2[_0xcea8('0x73')];logger[_0xcea8('0x66')](util[_0xcea8('0x33')](_0xcea8('0x76'),_0x36fbfa));return startTranscribe(_0x147f6a,_0x5d03ba,_0x5fe77f,uuidv4(),_0x5551a9,_0x55a1a2[_0xcea8('0x73')]);})['then'](function(_0x1dde82){logger[_0xcea8('0x66')](util[_0xcea8('0x33')](_0xcea8('0x77'),_0x36fbfa,_0x1dde82[_0xcea8('0x78')]['TranscriptionJobName']));_0x2835e7[_0xcea8('0x79')]=_0x1dde82[_0xcea8('0x78')]['TranscriptionJobName'];_0x2835e7[_0xcea8('0x7a')]=_0x1dde82[_0xcea8('0x78')][_0xcea8('0x7b')];return _0x522a6b(_0x2835e7);})[_0xcea8('0x46')](function(_0xbca69c){return _0x51e3f7(_0xbca69c);});});}exports[_0xcea8('0x7c')]=function(_0x1afac1,_0xf2f050,_0x1b3ff4){var _0x210a20;var _0x523885;var _0x67873;var _0x54e35a=require(_0xcea8('0x7d'));return db['VoiceRecording'][_0xcea8('0x7e')]({'where':{'id':_0x1afac1[_0xcea8('0x4d')]['id']}})[_0xcea8('0x26')](function(_0x5774cc){if(_0x5774cc){var _0x3261d1=util[_0xcea8('0x33')](_0xcea8('0x52'),_0x5774cc['value']);if(fs[_0xcea8('0x55')](_0x3261d1)){cypher=!![];return _0x54e35a[_0xcea8('0x64')](_0x3261d1,_0x5774cc[_0xcea8('0x51')],config['secrets'][_0xcea8('0x54')])[_0xcea8('0x26')](function(){return _0x5774cc;});}return _0x5774cc;}})[_0xcea8('0x26')](function(_0x16b096){if(!_0x16b096){throw new db[(_0xcea8('0x56'))][(_0xcea8('0x57'))](_0xcea8('0x7f'));}_0x523885=_0x16b096;return db[_0xcea8('0x80')][_0xcea8('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xf2f050,null))['then'](function(_0x594211){if(_0x594211){_0x210a20=_0x594211;if(!_0x210a20[_0xcea8('0x81')]||!_0x210a20[_0xcea8('0x82')]||!_0x210a20['transcribeRegion']||!_0x210a20['language']||!_0x210a20['bucket']){throw new db['Sequelize'][(_0xcea8('0x57'))](_0xcea8('0x83'));}if(_0x1afac1[_0xcea8('0x4a')][_0xcea8('0x84')]&&(!_0x210a20['sentiment']||!_0x210a20[_0xcea8('0x85')]||!_0x210a20['sentimentRegion']||!_0x210a20[_0xcea8('0x86')]||!_0x210a20['bucket'])){throw new db[(_0xcea8('0x56'))][(_0xcea8('0x57'))](_0xcea8('0x87'));}return db[_0xcea8('0x88')]['findOne']({'where':{'id':_0x210a20[_0xcea8('0x82')]}});}})[_0xcea8('0x26')](function(_0x22e90c){if(!_0x22e90c){throw new db['Sequelize'][(_0xcea8('0x57'))](_0xcea8('0x89'));}if(!_0x22e90c[_0xcea8('0x8a')]||!_0x22e90c[_0xcea8('0x8b')]){throw new db[(_0xcea8('0x56'))][(_0xcea8('0x57'))](_0xcea8('0x8c'));}_0x67873=_0x22e90c;return getBucketslist(_0x67873['data1'],_0x67873[_0xcea8('0x8b')],_0x210a20[_0xcea8('0x8d')]);})[_0xcea8('0x26')](function(_0x1b62fb){if(_0x1b62fb&&_0x1b62fb[_0xcea8('0x8e')]){var _0x17b339=_[_0xcea8('0x4c')](_0x1b62fb[_0xcea8('0x8e')],function(_0x2f6a96){return _0x2f6a96[_0xcea8('0x8f')]===_0x210a20[_0xcea8('0x90')];});if(!_0x17b339){logger['info'](util[_0xcea8('0x33')](_0xcea8('0x91'),_0x1afac1['params']['id'],_0x210a20[_0xcea8('0x90')]));return createBucket(_0x67873['data1'],_0x67873[_0xcea8('0x8b')],_0x210a20['transcribeRegion'],_0x210a20['bucket']);}logger[_0xcea8('0x66')](util[_0xcea8('0x33')](_0xcea8('0x92'),_0x1afac1[_0xcea8('0x4d')]['id'],_0x210a20[_0xcea8('0x90')]));return;}})[_0xcea8('0x26')](function(_0xe278e3){if(_0x523885[_0xcea8('0x7a')]===_0xcea8('0x93')){return transcribe(_0x1afac1['params']['id'],_0x67873[_0xcea8('0x8a')],_0x67873[_0xcea8('0x8b')],_0x210a20[_0xcea8('0x8d')],_0x210a20[_0xcea8('0x90')],_0x523885['value'],_0x210a20[_0xcea8('0x86')]);}else{logger[_0xcea8('0x66')](util['format'](_0xcea8('0x94'),_0x1afac1[_0xcea8('0x4d')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xcea8('0x26')](function(_0x193808){if(_0x193808){_0x193808[_0xcea8('0x95')]=_0x1afac1[_0xcea8('0x4a')]['runSentiment'];return _0x523885[_0xcea8('0x96')](_0x193808);}})[_0xcea8('0x26')](respondWithResult(_0xf2f050,null))[_0xcea8('0x46')](handleError(_0xf2f050,null));};function writeFile(_0x438e06,_0x570d54){return new Promise(function(_0x306125,_0x4e866f){fs['writeFile'](_0x570d54,_0x438e06,function(_0x590065,_0x138e7a){if(_0x590065){return _0x4e866f(_0x590065);}else{return _0x306125(_0x138e7a);}});});}exports[_0xcea8('0x97')]=function(_0x4e48f4,_0x56917d,_0x373952){return db[_0xcea8('0x2e')][_0xcea8('0x7e')]({'where':{'id':_0x4e48f4['params']['id']}})['then'](handleEntityNotFound(_0x56917d))['then'](function(_0x725d60){if(_0x725d60&&_0x725d60['fileText']){var _0x4b4f45=_0x725d60[_0xcea8('0x98')];var _0x133c85=config[_0xcea8('0x99')]+_0xcea8('0x9a')+_0x725d60['id']+'.txt';if(fs[_0xcea8('0x55')](_0x133c85)){return _0x133c85;}return writeFile(_0x4b4f45,_0x133c85)[_0xcea8('0x26')](function(){return _0x133c85;});}else{throw new db[(_0xcea8('0x56'))][(_0xcea8('0x57'))](_0xcea8('0x9b'));}})['then'](function(_0xeb13be){return _0x56917d[_0xcea8('0x4f')](_0xeb13be);})[_0xcea8('0x46')](handleError(_0x56917d));}; \ No newline at end of file +var _0x9ac7=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','VoiceRecording','rawAttributes','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','catch','show','params','include','create','body','find','describe','download','type','uniqueid','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','Not\x20found','../../components/encryptor','sequelize','MD5','$and','push','value','Sequelize','filename','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9ac7,0x96));var _0x79ac=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9ac7[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x79ac('0x0'));var zipdir=require(_0x79ac('0x1'));var jsonpatch=require(_0x79ac('0x2'));var rp=require(_0x79ac('0x3'));var moment=require(_0x79ac('0x4'));var BPromise=require(_0x79ac('0x5'));var Mustache=require(_0x79ac('0x6'));var util=require(_0x79ac('0x7'));var path=require(_0x79ac('0x8'));var sox=require(_0x79ac('0x9'));var csv=require('to-csv');var ejs=require(_0x79ac('0xa'));var fs=require('fs');var fs_extra=require(_0x79ac('0xb'));var _=require('lodash');var squel=require(_0x79ac('0xc'));var crypto=require(_0x79ac('0xd'));var jsforce=require(_0x79ac('0xe'));var deskjs=require(_0x79ac('0xf'));var toCsv=require('to-csv');var querystring=require(_0x79ac('0x10'));var Papa=require(_0x79ac('0x11'));var AWS=require(_0x79ac('0x12'));var uuidv4=require(_0x79ac('0x13'));var Redis=require(_0x79ac('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x79ac('0x15'));var as=require(_0x79ac('0x16'));var hardwareService=require(_0x79ac('0x17'));var logger=require(_0x79ac('0x18'))(_0x79ac('0x19'));var utils=require(_0x79ac('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x79ac('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c2488,_0x10097b){_0x10097b=_0x10097b||0xcc;return function(_0xe8a22a){if(_0xe8a22a){return _0x2c2488[_0x79ac('0x1c')](_0x10097b);}return _0x2c2488['status'](_0x10097b)[_0x79ac('0x1d')]();};}function respondWithResult(_0x126867,_0x51c34a){_0x51c34a=_0x51c34a||0xc8;return function(_0x18edde){if(_0x18edde){return _0x126867[_0x79ac('0x1e')](_0x51c34a)[_0x79ac('0x1f')](_0x18edde);}};}function respondWithFilteredResult(_0x1b92c4,_0x3457d1){return function(_0x29bf83){if(_0x29bf83){var _0x5d8bab=typeof _0x3457d1[_0x79ac('0x20')]===_0x79ac('0x21')&&typeof _0x3457d1[_0x79ac('0x22')]===_0x79ac('0x21');var _0x44791f=_0x29bf83['count'];var _0x3feb7a=_0x5d8bab?0x0:_0x3457d1[_0x79ac('0x20')];var _0x5785fb=_0x5d8bab?_0x29bf83['count']:_0x3457d1[_0x79ac('0x20')]+_0x3457d1[_0x79ac('0x22')];var _0x5c1ee2;if(_0x5785fb>=_0x44791f){_0x5785fb=_0x44791f;_0x5c1ee2=0xc8;}else{_0x5c1ee2=0xce;}_0x1b92c4[_0x79ac('0x1e')](_0x5c1ee2);return _0x1b92c4[_0x79ac('0x23')](_0x79ac('0x24'),_0x3feb7a+'-'+_0x5785fb+'/'+_0x44791f)[_0x79ac('0x1f')](_0x29bf83);}return null;};}function patchUpdates(_0x1ea12f){return function(_0x550422){try{jsonpatch[_0x79ac('0x25')](_0x550422,_0x1ea12f,!![]);}catch(_0x52ed22){return BPromise[_0x79ac('0x26')](_0x52ed22);}return _0x550422[_0x79ac('0x27')]();};}function saveUpdates(_0x1d2af4,_0x40fbce){return function(_0x37715b){if(_0x37715b){return _0x37715b[_0x79ac('0x28')](_0x1d2af4)['then'](function(_0x20810f){return _0x20810f;});}return null;};}function removeEntity(_0x4bcff6,_0x39fcc9){return function(_0x12daf4){if(_0x12daf4){return _0x12daf4[_0x79ac('0x29')]()[_0x79ac('0x2a')](function(){_0x4bcff6[_0x79ac('0x1e')](0xcc)[_0x79ac('0x1d')]();});}};}function handleEntityNotFound(_0xd54cf9,_0x3b299f){return function(_0x39b72f){if(!_0x39b72f){_0xd54cf9[_0x79ac('0x1c')](0x194);}return _0x39b72f;};}function handleError(_0x206f35,_0x142b5a){_0x142b5a=_0x142b5a||0x1f4;return function(_0xe4a5b7){logger[_0x79ac('0x2b')](_0xe4a5b7[_0x79ac('0x2c')]);if(_0xe4a5b7[_0x79ac('0x2d')]){delete _0xe4a5b7[_0x79ac('0x2d')];}_0x206f35[_0x79ac('0x1e')](_0x142b5a)['send'](_0xe4a5b7);};}exports[_0x79ac('0x2e')]=function(_0x1fb920,_0x32a29e){var _0x5a06f5={},_0x3cd6e4={},_0x3d9005={'count':0x0,'rows':[]};var _0x35c9ae=_[_0x79ac('0x2f')](db[_0x79ac('0x30')][_0x79ac('0x31')],function(_0x4939fd){return{'name':_0x4939fd['fieldName'],'type':_0x4939fd['type'][_0x79ac('0x32')]};});_0x3cd6e4['model']=_[_0x79ac('0x33')](_['map'](_0x35c9ae,_0x79ac('0x2d')),['format']);_0x3cd6e4[_0x79ac('0x34')]=_[_0x79ac('0x35')](_0x1fb920[_0x79ac('0x34')]);_0x3cd6e4[_0x79ac('0x36')]=_[_0x79ac('0x37')](_0x3cd6e4[_0x79ac('0x38')],_0x3cd6e4[_0x79ac('0x34')]);_0x5a06f5[_0x79ac('0x39')]=_[_0x79ac('0x37')](_0x3cd6e4[_0x79ac('0x38')],qs['fields'](_0x1fb920[_0x79ac('0x34')][_0x79ac('0x3a')]));_0x5a06f5[_0x79ac('0x39')]=_0x5a06f5[_0x79ac('0x39')][_0x79ac('0x3b')]?_0x5a06f5[_0x79ac('0x39')]:_0x3cd6e4[_0x79ac('0x38')];if(!_0x1fb920[_0x79ac('0x34')][_0x79ac('0x3c')]('nolimit')){_0x5a06f5[_0x79ac('0x22')]=qs[_0x79ac('0x22')](_0x1fb920['query'][_0x79ac('0x22')]);_0x5a06f5[_0x79ac('0x20')]=qs[_0x79ac('0x20')](_0x1fb920[_0x79ac('0x34')]['offset']);}_0x5a06f5[_0x79ac('0x3d')]=qs[_0x79ac('0x3e')](_0x1fb920['query']['sort']);_0x5a06f5[_0x79ac('0x3f')]=qs[_0x79ac('0x36')](_[_0x79ac('0x40')](_0x1fb920['query'],_0x3cd6e4[_0x79ac('0x36')]),_0x35c9ae);if(_0x1fb920[_0x79ac('0x34')][_0x79ac('0x41')]){_0x5a06f5['where']=_[_0x79ac('0x42')](_0x5a06f5[_0x79ac('0x3f')],{'$or':_[_0x79ac('0x2f')](_0x35c9ae,function(_0x25feb9){if(_0x25feb9['type']!==_0x79ac('0x43')){var _0x3b473c={};_0x3b473c[_0x25feb9[_0x79ac('0x2d')]]={'$like':'%'+_0x1fb920['query'][_0x79ac('0x41')]+'%'};return _0x3b473c;}})});}_0x5a06f5=_[_0x79ac('0x42')]({},_0x5a06f5,_0x1fb920[_0x79ac('0x44')]);var _0x5af756={'where':_0x5a06f5[_0x79ac('0x3f')]};return db[_0x79ac('0x30')]['count'](_0x5af756)['then'](function(_0x53c22e){_0x3d9005[_0x79ac('0x45')]=_0x53c22e;if(_0x1fb920[_0x79ac('0x34')][_0x79ac('0x46')]){_0x5a06f5['include']=[{'all':!![]}];}return db[_0x79ac('0x30')][_0x79ac('0x47')](_0x5a06f5);})[_0x79ac('0x2a')](function(_0x519022){_0x3d9005['rows']=_0x519022;return _0x3d9005;})[_0x79ac('0x2a')](respondWithFilteredResult(_0x32a29e,_0x5a06f5))[_0x79ac('0x48')](handleError(_0x32a29e,null));};exports[_0x79ac('0x49')]=function(_0x46f8ff,_0x253e68){var _0x4c8a9f={'raw':![],'where':{'id':_0x46f8ff[_0x79ac('0x4a')]['id']}},_0x5babc6={};_0x5babc6['model']=_[_0x79ac('0x35')](db['VoiceRecording'][_0x79ac('0x31')]);_0x5babc6[_0x79ac('0x34')]=_[_0x79ac('0x35')](_0x46f8ff[_0x79ac('0x34')]);_0x5babc6[_0x79ac('0x36')]=_[_0x79ac('0x37')](_0x5babc6[_0x79ac('0x38')],_0x5babc6[_0x79ac('0x34')]);_0x4c8a9f[_0x79ac('0x39')]=_[_0x79ac('0x37')](_0x5babc6['model'],qs[_0x79ac('0x3a')](_0x46f8ff[_0x79ac('0x34')][_0x79ac('0x3a')]));_0x4c8a9f[_0x79ac('0x39')]=_0x4c8a9f[_0x79ac('0x39')][_0x79ac('0x3b')]?_0x4c8a9f['attributes']:_0x5babc6[_0x79ac('0x38')];if(_0x46f8ff[_0x79ac('0x34')][_0x79ac('0x46')]){_0x4c8a9f[_0x79ac('0x4b')]=[{'all':!![]}];}_0x4c8a9f=_['merge']({},_0x4c8a9f,_0x46f8ff[_0x79ac('0x44')]);return db[_0x79ac('0x30')]['find'](_0x4c8a9f)['then'](handleEntityNotFound(_0x253e68,null))['then'](respondWithResult(_0x253e68,null))[_0x79ac('0x48')](handleError(_0x253e68,null));};exports[_0x79ac('0x4c')]=function(_0x34ac5a,_0xd1ebc5){return db['VoiceRecording'][_0x79ac('0x4c')](_0x34ac5a[_0x79ac('0x4d')],{})[_0x79ac('0x2a')](respondWithResult(_0xd1ebc5,0xc9))[_0x79ac('0x48')](handleError(_0xd1ebc5,null));};exports[_0x79ac('0x28')]=function(_0x262614,_0x56b771){if(_0x262614[_0x79ac('0x4d')]['id']){delete _0x262614[_0x79ac('0x4d')]['id'];}return db[_0x79ac('0x30')][_0x79ac('0x4e')]({'where':{'id':_0x262614[_0x79ac('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56b771,null))['then'](saveUpdates(_0x262614[_0x79ac('0x4d')],null))[_0x79ac('0x2a')](respondWithResult(_0x56b771,null))[_0x79ac('0x48')](handleError(_0x56b771,null));};exports[_0x79ac('0x4f')]=function(_0x12d454,_0x282827){return db[_0x79ac('0x30')]['describe']()[_0x79ac('0x2a')](respondWithResult(_0x282827,null))['catch'](handleError(_0x282827,null));};exports[_0x79ac('0x50')]=function(_0x1d84d4,_0x195a5c,_0x412a33){var _0x18aa91=require('../../components/encryptor');var _0x4a74ff=![];var _0x1ae6d0={};if(_0x1d84d4[_0x79ac('0x34')][_0x79ac('0x51')]&&_0x1d84d4[_0x79ac('0x34')]['type']==='uniqueid'){_0x1ae6d0[_0x79ac('0x52')]=_0x1d84d4[_0x79ac('0x4a')]['id'];}else{_0x1ae6d0['id']=_0x1d84d4[_0x79ac('0x4a')]['id'];}return db[_0x79ac('0x30')][_0x79ac('0x4e')]({'where':_0x1ae6d0,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x195a5c,null))[_0x79ac('0x2a')](function(_0x2e7b9f){if(_0x2e7b9f){var _0x41a9d3=_0x2e7b9f['value'];var _0x365e3e=util[_0x79ac('0x53')](_0x79ac('0x54'),_0x41a9d3);if(fs[_0x79ac('0x55')](_0x365e3e)){_0x4a74ff=!![];return _0x18aa91[_0x79ac('0x56')](_0x365e3e,_0x41a9d3,config[_0x79ac('0x57')][_0x79ac('0x58')])[_0x79ac('0x2a')](function(){return _0x2e7b9f;});}return _0x2e7b9f;}})[_0x79ac('0x2a')](function(_0x480a32){if(_0x480a32){var _0x5b6f5c=_0x480a32['value'];if(!fs[_0x79ac('0x55')](_0x5b6f5c)){throw new db['Sequelize'][(_0x79ac('0x59'))](_0x79ac('0x5a'));}if(_0x480a32['filename']){return _0x195a5c[_0x79ac('0x50')](_0x5b6f5c,_0x480a32['filename']+path[_0x79ac('0x5b')](_0x5b6f5c),function(){if(_0x4a74ff){fs[_0x79ac('0x5c')](_0x5b6f5c);}});}else{return _0x195a5c[_0x79ac('0x50')](_0x5b6f5c,function(_0x2d4b62){if(_0x4a74ff){fs['unlink'](_0x5b6f5c);}});}}})['catch'](function(_0x3d871a){if(_0x3d871a['message']===_0x79ac('0x5a')){_0x195a5c[_0x79ac('0x1e')](0x194)['send'](_0x79ac('0x5d'));}else{return handleError(_0x195a5c,null);}});};exports['downloads']=function(_0x352720,_0x3d16bb,_0xbe43fa){var _0x1ee4dc=require(_0x79ac('0x5e'));var _0x40e257=![];var _0x280650={'$and':[db[_0x79ac('0x5f')]['where'](db['sequelize']['fn'](_0x79ac('0x60'),db['sequelize']['col'](_0x79ac('0x52'))),_0x352720[_0x79ac('0x34')]['token'])]};if(_0x352720[_0x79ac('0x34')][_0x79ac('0x51')]&&_0x352720[_0x79ac('0x34')][_0x79ac('0x51')]===_0x79ac('0x52')){_0x280650[_0x79ac('0x61')][_0x79ac('0x62')]({'uniqueid':_0x352720[_0x79ac('0x4a')]['id']});}else{_0x280650['$and']['push']({'id':_0x352720[_0x79ac('0x4a')]['id']});}return db[_0x79ac('0x30')][_0x79ac('0x4e')]({'where':_0x280650,'attributes':['id',_0x79ac('0x63')],'raw':!![]})['then'](handleEntityNotFound(_0x3d16bb,null))['then'](function(_0x4edc14){if(_0x4edc14){var _0x416851=util[_0x79ac('0x53')](_0x79ac('0x54'),_0x4edc14[_0x79ac('0x63')]);if(fs[_0x79ac('0x55')](_0x416851)){_0x40e257=!![];return _0x1ee4dc[_0x79ac('0x56')](_0x416851,_0x4edc14[_0x79ac('0x63')],config[_0x79ac('0x57')]['recording'])[_0x79ac('0x2a')](function(){return _0x4edc14;});}return _0x4edc14;}})[_0x79ac('0x2a')](function(_0x22fa9b){if(_0x22fa9b){if(!fs[_0x79ac('0x55')](_0x22fa9b[_0x79ac('0x63')])){throw new db[(_0x79ac('0x64'))][(_0x79ac('0x59'))](_0x79ac('0x5a'));}if(_0x22fa9b[_0x79ac('0x65')]){return _0x3d16bb['download'](_0x22fa9b['value'],_0x22fa9b[_0x79ac('0x65')]+path[_0x79ac('0x5b')](_0x22fa9b[_0x79ac('0x63')]),function(){if(_0x40e257){fs[_0x79ac('0x5c')](_0x22fa9b[_0x79ac('0x63')]);}});}else{return _0x3d16bb[_0x79ac('0x50')](_0x22fa9b[_0x79ac('0x63')],function(_0x112dde){if(_0x40e257){fs[_0x79ac('0x5c')](_0x22fa9b['value']);}});}}})[_0x79ac('0x48')](handleError(_0x3d16bb,null));};exports[_0x79ac('0x29')]=function(_0x279a07,_0x43410c){return db[_0x79ac('0x30')][_0x79ac('0x4e')]({'where':{'id':_0x279a07['params']['id']}})[_0x79ac('0x2a')](function(_0x5c51e9){if(_['isNil'](_0x5c51e9)){throw new ReferenceError(_0x79ac('0x66'));}return _0x5c51e9;})['then'](function(_0xcc8561){var _0x3824e8=_0xcc8561[_0x79ac('0x63')];logger[_0x79ac('0x67')](_0x79ac('0x68'),_0x3824e8);if(!_[_0x79ac('0x69')](_0xcc8561['value'])&&fs['existsSync'](_0x3824e8)){logger[_0x79ac('0x67')](_0x79ac('0x6a')+_0x3824e8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x79ac('0x6b')](_0x3824e8);}_0x3824e8=_0x3824e8+_0x79ac('0x6c');if(!_[_0x79ac('0x69')](_0xcc8561[_0x79ac('0x63')])&&fs[_0x79ac('0x55')](_0x3824e8)){logger[_0x79ac('0x67')](_0x79ac('0x6a')+_0x3824e8+_0x79ac('0x6d'));fs[_0x79ac('0x6b')](_0x3824e8);}return _0xcc8561;})['then'](function(_0x1dc888){if(!_0x1dc888)throw new InternalError();return _0x1dc888[_0x79ac('0x29')]();})['then'](function(){_0x43410c[_0x79ac('0x1e')](0xcc)[_0x79ac('0x1d')]();})['catch'](handleError(_0x43410c,null));};function getBucketslist(_0x226423,_0x548d63,_0x5e1b28){return new Promise(function(_0x38cc58,_0x15783c){var _0x5bb390=new AWS['S3']({'accessKeyId':_0x548d63,'secretAccessKey':_0x226423,'region':_0x5e1b28});_0x5bb390['listBuckets']({},function(_0x5cf56c,_0x440708){if(_0x5cf56c){return _0x15783c(_0x5cf56c);}else{return _0x38cc58(_0x440708);}});});}function createBucket(_0x2d7f8b,_0x3fd963,_0x2e60a3,_0x1476bc){return new Promise(function(_0x56e8bc,_0x24d7ee){var _0x54e21a=new AWS['S3']({'accessKeyId':_0x3fd963,'secretAccessKey':_0x2d7f8b,'region':_0x2e60a3});_0x54e21a['createBucket']({'Bucket':_0x1476bc},function(_0x389d74,_0x24c9b5){if(_0x389d74){return _0x24d7ee(_0x389d74);}else{return _0x56e8bc(_0x24c9b5);}});});}function uploadFile(_0x17ee56,_0x2f9008,_0x2b10d6,_0x24281d,_0x379f5f,_0x3999cc){return new Promise(function(_0x54e875,_0x29c2f1){var _0x221656=new AWS['S3']({'accessKeyId':_0x2f9008,'secretAccessKey':_0x17ee56,'region':_0x2b10d6});_0x221656[_0x79ac('0x6e')]({'Bucket':_0x24281d,'Key':_0x379f5f,'Body':_0x3999cc},function(_0x98a10,_0x331a72){if(_0x98a10){return _0x29c2f1(_0x98a10);}else{return _0x54e875(_0x331a72);}});});}function startTranscribe(_0x1b7005,_0xd6c70b,_0x4db3f5,_0x366abc,_0x3b5439,_0x2ca083){return new Promise(function(_0x5831af,_0x3dfc43){var _0x5874e6=new AWS['TranscribeService']({'accessKeyId':_0xd6c70b,'secretAccessKey':_0x1b7005,'region':_0x4db3f5});_0x5874e6[_0x79ac('0x6f')]({'TranscriptionJobName':_0x366abc,'LanguageCode':_0x3b5439,'Media':{'MediaFileUri':_0x2ca083}},function(_0x50f982,_0x57c70f){if(_0x50f982){return _0x3dfc43(_0x50f982);}else{return _0x5831af(_0x57c70f);}});});}function transcribe(_0x389c90,_0xfec8d1,_0x4cd246,_0x2453f0,_0x267e0e,_0x1d1887,_0x287e21){return new Promise(function(_0x2abe9c,_0x31603e){var _0x5869c7={};logger['info'](util[_0x79ac('0x53')](_0x79ac('0x70'),_0x389c90,_0x267e0e));return uploadFile(_0xfec8d1,_0x4cd246,_0x2453f0,_0x267e0e,path[_0x79ac('0x71')](_0x1d1887),fs[_0x79ac('0x72')](_0x1d1887))['then'](function(_0x5402f4){logger[_0x79ac('0x67')](util[_0x79ac('0x53')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x389c90,_0x267e0e,_0x5402f4['Location']));_0x5869c7['bucket']=_0x5402f4['Bucket'];_0x5869c7[_0x79ac('0x73')]=_0x5402f4[_0x79ac('0x74')];logger['info'](util['format'](_0x79ac('0x75'),_0x389c90));return startTranscribe(_0xfec8d1,_0x4cd246,_0x2453f0,uuidv4(),_0x287e21,_0x5402f4[_0x79ac('0x74')]);})[_0x79ac('0x2a')](function(_0x4d6a74){logger[_0x79ac('0x67')](util[_0x79ac('0x53')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x389c90,_0x4d6a74[_0x79ac('0x76')][_0x79ac('0x77')]));_0x5869c7[_0x79ac('0x78')]=_0x4d6a74[_0x79ac('0x76')][_0x79ac('0x77')];_0x5869c7[_0x79ac('0x79')]=_0x4d6a74[_0x79ac('0x76')][_0x79ac('0x7a')];return _0x2abe9c(_0x5869c7);})['catch'](function(_0x34699c){return _0x31603e(_0x34699c);});});}exports['runTranscribe']=function(_0x41b089,_0x41a979,_0x1932da){var _0x19283a;var _0x205fd4;var _0x27cc31;var _0x3b913a=require(_0x79ac('0x5e'));return db['VoiceRecording'][_0x79ac('0x7b')]({'where':{'id':_0x41b089[_0x79ac('0x4a')]['id']}})[_0x79ac('0x2a')](function(_0xf87fe6){if(_0xf87fe6){var _0x689d3c=util[_0x79ac('0x53')](_0x79ac('0x54'),_0xf87fe6['value']);if(fs[_0x79ac('0x55')](_0x689d3c)){cypher=!![];return _0x3b913a[_0x79ac('0x56')](_0x689d3c,_0xf87fe6['value'],config[_0x79ac('0x57')][_0x79ac('0x58')])['then'](function(){return _0xf87fe6;});}return _0xf87fe6;}})[_0x79ac('0x2a')](function(_0x34870e){if(!_0x34870e){throw new db[(_0x79ac('0x64'))][(_0x79ac('0x59'))](_0x79ac('0x7c'));}_0x205fd4=_0x34870e;return db[_0x79ac('0x7d')][_0x79ac('0x7b')]({'where':{'id':0x1}});})[_0x79ac('0x2a')](handleEntityNotFound(_0x41a979,null))[_0x79ac('0x2a')](function(_0x42eed2){if(_0x42eed2){_0x19283a=_0x42eed2;if(!_0x19283a[_0x79ac('0x7e')]||!_0x19283a[_0x79ac('0x7f')]||!_0x19283a[_0x79ac('0x80')]||!_0x19283a[_0x79ac('0x81')]||!_0x19283a[_0x79ac('0x82')]){throw new db['Sequelize']['ValidationError'](_0x79ac('0x83'));}if(_0x41b089[_0x79ac('0x4d')]['runSentiment']&&(!_0x19283a[_0x79ac('0x84')]||!_0x19283a[_0x79ac('0x85')]||!_0x19283a[_0x79ac('0x86')]||!_0x19283a[_0x79ac('0x81')]||!_0x19283a[_0x79ac('0x82')])){throw new db['Sequelize'][(_0x79ac('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x79ac('0x87')][_0x79ac('0x7b')]({'where':{'id':_0x19283a[_0x79ac('0x7f')]}});}})['then'](function(_0x32146b){if(!_0x32146b){throw new db['Sequelize'][(_0x79ac('0x59'))](_0x79ac('0x88'));}if(!_0x32146b[_0x79ac('0x89')]||!_0x32146b['data2']){throw new db[(_0x79ac('0x64'))][(_0x79ac('0x59'))](_0x79ac('0x8a'));}_0x27cc31=_0x32146b;return getBucketslist(_0x27cc31[_0x79ac('0x89')],_0x27cc31[_0x79ac('0x8b')],_0x19283a[_0x79ac('0x80')]);})[_0x79ac('0x2a')](function(_0x16984d){if(_0x16984d&&_0x16984d[_0x79ac('0x8c')]){var _0x24ac6d=_[_0x79ac('0x4e')](_0x16984d[_0x79ac('0x8c')],function(_0x3b923a){return _0x3b923a['Name']===_0x19283a['bucket'];});if(!_0x24ac6d){logger['info'](util[_0x79ac('0x53')](_0x79ac('0x8d'),_0x41b089[_0x79ac('0x4a')]['id'],_0x19283a[_0x79ac('0x82')]));return createBucket(_0x27cc31[_0x79ac('0x89')],_0x27cc31[_0x79ac('0x8b')],_0x19283a['transcribeRegion'],_0x19283a[_0x79ac('0x82')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x41b089[_0x79ac('0x4a')]['id'],_0x19283a[_0x79ac('0x82')]));return;}})['then'](function(_0x1acc5f){if(_0x205fd4['transcribeStatus']==='NEW'){return transcribe(_0x41b089['params']['id'],_0x27cc31['data1'],_0x27cc31[_0x79ac('0x8b')],_0x19283a[_0x79ac('0x80')],_0x19283a['bucket'],_0x205fd4[_0x79ac('0x63')],_0x19283a[_0x79ac('0x81')]);}else{logger[_0x79ac('0x67')](util['format'](_0x79ac('0x8e'),_0x41b089[_0x79ac('0x4a')]['id']));return{'transcribeStatus':_0x79ac('0x8f')};}})[_0x79ac('0x2a')](function(_0x18d384){if(_0x18d384){_0x18d384[_0x79ac('0x90')]=_0x41b089[_0x79ac('0x4d')]['runSentiment'];return _0x205fd4[_0x79ac('0x91')](_0x18d384);}})[_0x79ac('0x2a')](respondWithResult(_0x41a979,null))[_0x79ac('0x48')](handleError(_0x41a979,null));};function writeFile(_0x9de2a,_0x1c9536){return new Promise(function(_0x2dc911,_0x179378){fs[_0x79ac('0x92')](_0x1c9536,_0x9de2a,function(_0x27f835,_0xb3d62d){if(_0x27f835){return _0x179378(_0x27f835);}else{return _0x2dc911(_0xb3d62d);}});});}exports[_0x79ac('0x93')]=function(_0x5899fb,_0x528bd3,_0x2eb7a3){return db['VoiceRecording'][_0x79ac('0x7b')]({'where':{'id':_0x5899fb[_0x79ac('0x4a')]['id']}})[_0x79ac('0x2a')](handleEntityNotFound(_0x528bd3))['then'](function(_0x1954b2){if(_0x1954b2&&_0x1954b2['fileText']){var _0xcb06c0=_0x1954b2[_0x79ac('0x94')];var _0x184109=config[_0x79ac('0x95')]+_0x79ac('0x96')+_0x1954b2['id']+_0x79ac('0x97');if(fs[_0x79ac('0x55')](_0x184109)){return _0x184109;}return writeFile(_0xcb06c0,_0x184109)['then'](function(){return _0x184109;});}else{throw new db[(_0x79ac('0x64'))][(_0x79ac('0x59'))](_0x79ac('0x98'));}})[_0x79ac('0x2a')](function(_0x2af87e){return _0x528bd3['download'](_0x2af87e);})[_0x79ac('0x48')](handleError(_0x528bd3));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 4bf9d06..b6bd768 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 _0xb48d=['uniqueid','transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings'];(function(_0xcd5a2a,_0x42325f){var _0x27b3c0=function(_0x16bc9e){while(--_0x16bc9e){_0xcd5a2a['push'](_0xcd5a2a['shift']());}};_0x27b3c0(++_0x42325f);}(_0xb48d,0x194));var _0xdb48=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb48d[_0x173441];return _0x2423a8;};'use strict';var attributes=require(_0xdb48('0x0'));module['exports']=function(_0x267789,_0x568541){return _0x267789[_0xdb48('0x1')](_0xdb48('0x2'),attributes,{'tableName':_0xdb48('0x3'),'paranoid':![],'indexes':[{'name':_0xdb48('0x4'),'fields':['uniqueid']},{'name':_0xdb48('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x94dc=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','define','VoiceRecording'];(function(_0x313fef,_0x437660){var _0x423b79=function(_0x188374){while(--_0x188374){_0x313fef['push'](_0x313fef['shift']());}};_0x423b79(++_0x437660);}(_0x94dc,0xb1));var _0xc94d=function(_0x4eb23b,_0x37ffae){_0x4eb23b=_0x4eb23b-0x0;var _0x359979=_0x94dc[_0x4eb23b];return _0x359979;};'use strict';var attributes=require(_0xc94d('0x0'));module['exports']=function(_0x2d9149,_0x53939f){return _0x2d9149[_0xc94d('0x1')](_0xc94d('0x2'),attributes,{'tableName':_0xc94d('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc94d('0x4')]},{'name':_0xc94d('0x5'),'fields':[_0xc94d('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e66f658..2f9bf6a 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 _0x93e9=['http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','debug','stringify','../../components/encryptor','Setting','findOne','existsSync','value','format','%s.cypher','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x191bb6,_0x1d71c4){var _0x4a6f30=function(_0x3255c6){while(--_0x3255c6){_0x191bb6['push'](_0x191bb6['shift']());}};_0x4a6f30(++_0x1d71c4);}(_0x93e9,0xcc));var _0x993e=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x93e9[_0x54b062];return _0x255e41;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2366d9,_0x12ac94,_0x1aef74){return new BPromise(function(_0x53d0ce,_0x4701d3){return client[_0x993e('0xc')](_0x2366d9,_0x1aef74)[_0x993e('0xd')](function(_0x280291){logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));logger['debug'](_0x993e('0x11'),_0x12ac94,_0x993e('0x10'),JSON['stringify'](_0x280291));if(_0x280291['error']){if(_0x280291[_0x993e('0x12')]['code']===0x1f4){logger[_0x993e('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x12ac94,_0x280291['error'][_0x993e('0x13')]);return _0x4701d3(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}logger[_0x993e('0x12')](_0x993e('0xf'),_0x12ac94,_0x280291[_0x993e('0x12')][_0x993e('0x13')]);return _0x53d0ce(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}else{logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));_0x53d0ce(_0x280291[_0x993e('0x14')][_0x993e('0x13')]);}})[_0x993e('0x15')](function(_0x454475){logger[_0x993e('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x12ac94,_0x454475);_0x4701d3(_0x454475);});});}exports[_0x993e('0x16')]=function(_0x1acd21){var _0x3cc2b9=this;return new Promise(function(_0x3d6109,_0xfc2cbb){return db[_0x993e('0x17')]['update'](_0x1acd21[_0x993e('0x18')],{'raw':_0x1acd21[_0x993e('0x19')]?_0x1acd21[_0x993e('0x19')][_0x993e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1acd21[_0x993e('0x19')]?_0x1acd21[_0x993e('0x19')][_0x993e('0x1b')]||null:null,'attributes':_0x1acd21[_0x993e('0x19')]?_0x1acd21['options'][_0x993e('0x1c')]||null:null,'limit':_0x1acd21['options']?_0x1acd21[_0x993e('0x19')][_0x993e('0x1d')]||null:null})[_0x993e('0xd')](function(_0x5ba2a1){logger[_0x993e('0xe')](_0x993e('0x16'),_0x1acd21);logger[_0x993e('0x1e')](_0x993e('0x16'),_0x1acd21,JSON[_0x993e('0x1f')](_0x5ba2a1));_0x3d6109(_0x5ba2a1);})[_0x993e('0x15')](function(_0xa1c83e){logger[_0x993e('0x12')](_0x993e('0x16'),_0xa1c83e[_0x993e('0x13')],_0x1acd21);_0xfc2cbb(_0x3cc2b9[_0x993e('0x12')](0x1f4,_0xa1c83e[_0x993e('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x2756a7){var _0x279bb8=this;return new Promise(function(_0x52b727,_0x27bbf7){var _0x4f5cc1=require(_0x993e('0x20'));var _0xa03fbd;return db[_0x993e('0x21')][_0x993e('0x22')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x32e332){_0xa03fbd=_0x32e332;return db[_0x993e('0x17')]['create'](_0x2756a7[_0x993e('0x18')]);})[_0x993e('0xd')](function(_0x248354){if(_0xa03fbd['callRecordingEncryption']&&fs[_0x993e('0x23')](_0x248354[_0x993e('0x24')])){var _0x1f5d51=util[_0x993e('0x25')](_0x993e('0x26'),_0x248354['value']);return _0x4f5cc1[_0x993e('0x27')](_0x248354['value'],_0x1f5d51,config[_0x993e('0x28')]['recording'])[_0x993e('0xd')](function(){fs['unlink'](_0x248354[_0x993e('0x24')]);logger[_0x993e('0xe')](_0x993e('0x29'));return _0x248354;});}return _0x248354;})[_0x993e('0xd')](function(_0xbadd6e){logger[_0x993e('0xe')]('CreateVoiceRecording',_0x2756a7);logger[_0x993e('0x1e')]('CreateVoiceRecording',_0x2756a7,JSON['stringify'](_0xbadd6e));_0x52b727(_0xbadd6e);})[_0x993e('0x15')](function(_0x497d29){logger[_0x993e('0x12')](_0x993e('0x2a'),_0x497d29[_0x993e('0x13')],_0x2756a7);_0x27bbf7(_0x279bb8[_0x993e('0x12')](0x1f4,_0x497d29[_0x993e('0x13')]));});});}; \ No newline at end of file +var _0x9536=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','callRecordingEncryption','create','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0xe9078d,_0x47a2df){var _0x4250e9=function(_0x46174d){while(--_0x46174d){_0xe9078d['push'](_0xe9078d['shift']());}};_0x4250e9(++_0x47a2df);}(_0x9536,0x179));var _0x6953=function(_0x49a1a0,_0x48f776){_0x49a1a0=_0x49a1a0-0x0;var _0x518a4f=_0x9536[_0x49a1a0];return _0x518a4f;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')](_0x2da771[_0x6953('0x1a')],{'raw':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da771[_0x6953('0x1b')]?_0x2da771[_0x6953('0x1b')][_0x6953('0x1d')]||null:null,'attributes':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1e')]||null:null,'limit':_0x2da771['options']?_0x2da771[_0x6953('0x1b')][_0x6953('0x1f')]||null:null})[_0x6953('0xc')](function(_0x171dd8){logger['info'](_0x6953('0x17'),_0x2da771);logger[_0x6953('0xf')](_0x6953('0x17'),_0x2da771,JSON['stringify'](_0x171dd8));_0x10858a(_0x171dd8);})['catch'](function(_0x5a4cd7){logger[_0x6953('0x12')](_0x6953('0x17'),_0x5a4cd7['message'],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x5a4cd7['message']));});});};exports[_0x6953('0x20')]=function(_0x2bf39b){var _0xcdbce8=this;return new Promise(function(_0x2cc01e,_0x191d80){var _0x1497e3=require('../../components/encryptor');var _0x3dd890;return db[_0x6953('0x21')]['findOne']({'attributes':['id',_0x6953('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x173b3c){_0x3dd890=_0x173b3c;return db[_0x6953('0x18')][_0x6953('0x23')](_0x2bf39b['body']);})[_0x6953('0xc')](function(_0x3d7b04){if(_0x3dd890[_0x6953('0x22')]&&fs['existsSync'](_0x3d7b04[_0x6953('0x24')])){var _0x132a71=util['format']('%s.cypher',_0x3d7b04[_0x6953('0x24')]);return _0x1497e3[_0x6953('0x25')](_0x3d7b04[_0x6953('0x24')],_0x132a71,config[_0x6953('0x26')][_0x6953('0x27')])['then'](function(){fs[_0x6953('0x28')](_0x3d7b04['value']);logger[_0x6953('0x15')](_0x6953('0x29'));return _0x3d7b04;});}return _0x3d7b04;})['then'](function(_0x4a4d41){logger[_0x6953('0x15')](_0x6953('0x20'),_0x2bf39b);logger[_0x6953('0xf')]('CreateVoiceRecording',_0x2bf39b,JSON[_0x6953('0x11')](_0x4a4d41));_0x2cc01e(_0x4a4d41);})['catch'](function(_0x4e95f1){logger['error']('CreateVoiceRecording',_0x4e95f1[_0x6953('0x14')],_0x2bf39b);_0x191d80(_0xcdbce8[_0x6953('0x12')](0x1f4,_0x4e95f1[_0x6953('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 6601391..ce35516 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 _0xe321=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','/:id','destroy','exports','multer','path'];(function(_0x2ce0a0,_0xdfbc3e){var _0x38de1a=function(_0x5bee8d){while(--_0x5bee8d){_0x2ce0a0['push'](_0x2ce0a0['shift']());}};_0x38de1a(++_0xdfbc3e);}(_0xe321,0x1ca));var _0x1e32=function(_0x2a4285,_0x559749){_0x2a4285=_0x2a4285-0x0;var _0x48481b=_0xe321[_0x2a4285];return _0x48481b;};'use strict';var multer=require(_0x1e32('0x0'));var util=require('util');var path=require(_0x1e32('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e32('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1e32('0x3'));var interaction=require(_0x1e32('0x4'));var config=require(_0x1e32('0x5'));var controller=require(_0x1e32('0x6'));router[_0x1e32('0x7')]('/',auth[_0x1e32('0x8')](),controller[_0x1e32('0x9')]);router[_0x1e32('0x7')](_0x1e32('0xa'),auth['isAuthenticated'](),controller[_0x1e32('0xb')]);router['get']('/:id',auth[_0x1e32('0x8')](),controller[_0x1e32('0xc')]);router[_0x1e32('0xd')]('/',auth[_0x1e32('0x8')](),controller[_0x1e32('0xe')]);router[_0x1e32('0xf')]('/:id',auth[_0x1e32('0x8')](),controller[_0x1e32('0x10')]);router['delete'](_0x1e32('0x11'),auth['isAuthenticated'](),controller[_0x1e32('0x12')]);module[_0x1e32('0x13')]=router; \ No newline at end of file +var _0x3c7d=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','/describe','isAuthenticated','show','post','put','/:id'];(function(_0x328b40,_0x370642){var _0x556a56=function(_0x467553){while(--_0x467553){_0x328b40['push'](_0x328b40['shift']());}};_0x556a56(++_0x370642);}(_0x3c7d,0x9a));var _0xd3c7=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x3c7d[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require(_0xd3c7('0x0'));var util=require(_0xd3c7('0x1'));var path=require(_0xd3c7('0x2'));var timeout=require(_0xd3c7('0x3'));var express=require(_0xd3c7('0x4'));var router=express[_0xd3c7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd3c7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd3c7('0x7'));var controller=require(_0xd3c7('0x8'));router[_0xd3c7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd3c7('0xa'),auth[_0xd3c7('0xb')](),controller['describe']);router[_0xd3c7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd3c7('0xc')]);router[_0xd3c7('0xd')]('/',auth[_0xd3c7('0xb')](),controller['create']);router[_0xd3c7('0xe')](_0xd3c7('0xf'),auth[_0xd3c7('0xb')](),controller['update']);router['delete'](_0xd3c7('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xd3c7('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index ab22fdb..1aedd06 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 _0x166b=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x9b6426,_0x1f7d13){var _0xacf68e=function(_0x25b61c){while(--_0x25b61c){_0x9b6426['push'](_0x9b6426['shift']());}};_0xacf68e(++_0x1f7d13);}(_0x166b,0x1db));var _0xb166=function(_0x16b62f,_0x530b6f){_0x16b62f=_0x16b62f-0x0;var _0x536a34=_0x166b[_0x16b62f];return _0x536a34;};'use strict';var Sequelize=require(_0xb166('0x0'));var moment=require(_0xb166('0x1'));module[_0xb166('0x2')]={'type':{'type':Sequelize[_0xb166('0x3')](_0xb166('0x4'),_0xb166('0x5'))},'result':{'type':Sequelize[_0xb166('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xb166('0x6')]},'transferercalleridname':{'type':Sequelize[_0xb166('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb166('0x6')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xb166('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb166('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xb166('0x6')]},'transfereechannel':{'type':Sequelize[_0xb166('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xb166('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xb166('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb166('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb166('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xb166('0x6')]},'transfereecontext':{'type':Sequelize[_0xb166('0x6')]},'transfereeexten':{'type':Sequelize[_0xb166('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xb166('0x6')]},'isexternal':{'type':Sequelize[_0xb166('0x3')](_0xb166('0x7'),'No')},'context':{'type':Sequelize[_0xb166('0x6')]},'extension':{'type':Sequelize[_0xb166('0x6')]}}; \ No newline at end of file +var _0x5a93=['STRING','sequelize','exports','ENUM','blind'];(function(_0x3e7804,_0x121853){var _0x56efda=function(_0x1996f3){while(--_0x1996f3){_0x3e7804['push'](_0x3e7804['shift']());}};_0x56efda(++_0x121853);}(_0x5a93,0xa1));var _0x35a9=function(_0x13fa17,_0x74412d){_0x13fa17=_0x13fa17-0x0;var _0xc001b2=_0x5a93[_0x13fa17];return _0xc001b2;};'use strict';var Sequelize=require(_0x35a9('0x0'));var moment=require('moment');module[_0x35a9('0x1')]={'type':{'type':Sequelize[_0x35a9('0x2')](_0x35a9('0x3'),'attended')},'result':{'type':Sequelize[_0x35a9('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x35a9('0x4')]},'transferercalleridname':{'type':Sequelize[_0x35a9('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x35a9('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x35a9('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x35a9('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x35a9('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x35a9('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x35a9('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x35a9('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x35a9('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x35a9('0x4')]},'transfereeexten':{'type':Sequelize[_0x35a9('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x35a9('0x4')]},'isexternal':{'type':Sequelize[_0x35a9('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x35a9('0x4')]},'extension':{'type':Sequelize[_0x35a9('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e3454f4..05467fc 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 _0xad17=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceTransferReport','include','rows','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x1e0d88,_0x1d1585){var _0x332653=function(_0x4814fa){while(--_0x4814fa){_0x1e0d88['push'](_0x1e0d88['shift']());}};_0x332653(++_0x1d1585);}(_0xad17,0x1e4));var _0x7ad1=function(_0x2d93d4,_0x149172){_0x2d93d4=_0x2d93d4-0x0;var _0x44df30=_0xad17[_0x2d93d4];return _0x44df30;};'use strict';var emlformat=require(_0x7ad1('0x0'));var rimraf=require(_0x7ad1('0x1'));var zipdir=require(_0x7ad1('0x2'));var jsonpatch=require(_0x7ad1('0x3'));var rp=require('request-promise');var moment=require(_0x7ad1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7ad1('0x5'));var util=require(_0x7ad1('0x6'));var path=require(_0x7ad1('0x7'));var sox=require(_0x7ad1('0x8'));var csv=require(_0x7ad1('0x9'));var ejs=require(_0x7ad1('0xa'));var fs=require('fs');var fs_extra=require(_0x7ad1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ad1('0xc'));var deskjs=require(_0x7ad1('0xd'));var toCsv=require(_0x7ad1('0x9'));var querystring=require(_0x7ad1('0xe'));var Papa=require(_0x7ad1('0xf'));var Redis=require('ioredis');var authService=require(_0x7ad1('0x10'));var qs=require(_0x7ad1('0x11'));var as=require(_0x7ad1('0x12'));var hardwareService=require(_0x7ad1('0x13'));var logger=require(_0x7ad1('0x14'))(_0x7ad1('0x15'));var utils=require(_0x7ad1('0x16'));var config=require(_0x7ad1('0x17'));var licenseUtil=require(_0x7ad1('0x18'));var db=require(_0x7ad1('0x19'))['db'];function respondWithStatusCode(_0x559a43,_0x3a9e5b){_0x3a9e5b=_0x3a9e5b||0xcc;return function(_0x318a22){if(_0x318a22){return _0x559a43[_0x7ad1('0x1a')](_0x3a9e5b);}return _0x559a43[_0x7ad1('0x1b')](_0x3a9e5b)['end']();};}function respondWithResult(_0x177a89,_0x188766){_0x188766=_0x188766||0xc8;return function(_0x25e640){if(_0x25e640){return _0x177a89[_0x7ad1('0x1b')](_0x188766)[_0x7ad1('0x1c')](_0x25e640);}};}function respondWithFilteredResult(_0x4535cd,_0x5f099d){return function(_0x4cec8b){if(_0x4cec8b){var _0x4ca95f=typeof _0x5f099d['offset']===_0x7ad1('0x1d')&&typeof _0x5f099d['limit']===_0x7ad1('0x1d');var _0x26a786=_0x4cec8b[_0x7ad1('0x1e')];var _0x2967a2=_0x4ca95f?0x0:_0x5f099d[_0x7ad1('0x1f')];var _0x5d8842=_0x4ca95f?_0x4cec8b[_0x7ad1('0x1e')]:_0x5f099d[_0x7ad1('0x1f')]+_0x5f099d[_0x7ad1('0x20')];var _0x23b772;if(_0x5d8842>=_0x26a786){_0x5d8842=_0x26a786;_0x23b772=0xc8;}else{_0x23b772=0xce;}_0x4535cd['status'](_0x23b772);return _0x4535cd['set'](_0x7ad1('0x21'),_0x2967a2+'-'+_0x5d8842+'/'+_0x26a786)[_0x7ad1('0x1c')](_0x4cec8b);}return null;};}function patchUpdates(_0x477b01){return function(_0x1a9305){try{jsonpatch['apply'](_0x1a9305,_0x477b01,!![]);}catch(_0x2bbe0e){return BPromise[_0x7ad1('0x22')](_0x2bbe0e);}return _0x1a9305[_0x7ad1('0x23')]();};}function saveUpdates(_0x5cda97,_0x23a7ca){return function(_0x2ebc2e){if(_0x2ebc2e){return _0x2ebc2e[_0x7ad1('0x24')](_0x5cda97)['then'](function(_0x318d39){return _0x318d39;});}return null;};}function removeEntity(_0x5a3ba1,_0x30596a){return function(_0x35e38d){if(_0x35e38d){return _0x35e38d[_0x7ad1('0x25')]()[_0x7ad1('0x26')](function(){_0x5a3ba1[_0x7ad1('0x1b')](0xcc)[_0x7ad1('0x27')]();});}};}function handleEntityNotFound(_0x46c0f4,_0x1c815c){return function(_0x338ebd){if(!_0x338ebd){_0x46c0f4[_0x7ad1('0x1a')](0x194);}return _0x338ebd;};}function handleError(_0x51a4a4,_0x566d25){_0x566d25=_0x566d25||0x1f4;return function(_0xbb1869){logger[_0x7ad1('0x28')](_0xbb1869[_0x7ad1('0x29')]);if(_0xbb1869[_0x7ad1('0x2a')]){delete _0xbb1869[_0x7ad1('0x2a')];}_0x51a4a4[_0x7ad1('0x1b')](_0x566d25)[_0x7ad1('0x2b')](_0xbb1869);};}exports[_0x7ad1('0x2c')]=function(_0xcf7914,_0x29c8cf){var _0x11c54b={},_0x5f0a39={},_0x1b5a40={'count':0x0,'rows':[]};var _0x2c2174=_[_0x7ad1('0x2d')](db['VoiceTransferReport'][_0x7ad1('0x2e')],function(_0x5aaf){return{'name':_0x5aaf['fieldName'],'type':_0x5aaf[_0x7ad1('0x2f')][_0x7ad1('0x30')]};});_0x5f0a39[_0x7ad1('0x31')]=_['map'](_0x2c2174,_0x7ad1('0x2a'));_0x5f0a39[_0x7ad1('0x32')]=_[_0x7ad1('0x33')](_0xcf7914['query']);_0x5f0a39[_0x7ad1('0x34')]=_['intersection'](_0x5f0a39['model'],_0x5f0a39['query']);_0x11c54b[_0x7ad1('0x35')]=_[_0x7ad1('0x36')](_0x5f0a39[_0x7ad1('0x31')],qs[_0x7ad1('0x37')](_0xcf7914[_0x7ad1('0x32')][_0x7ad1('0x37')]));_0x11c54b[_0x7ad1('0x35')]=_0x11c54b[_0x7ad1('0x35')][_0x7ad1('0x38')]?_0x11c54b[_0x7ad1('0x35')]:_0x5f0a39[_0x7ad1('0x31')];if(!_0xcf7914['query'][_0x7ad1('0x39')](_0x7ad1('0x3a'))){_0x11c54b['limit']=qs[_0x7ad1('0x20')](_0xcf7914[_0x7ad1('0x32')][_0x7ad1('0x20')]);_0x11c54b['offset']=qs[_0x7ad1('0x1f')](_0xcf7914['query']['offset']);}_0x11c54b[_0x7ad1('0x3b')]=qs[_0x7ad1('0x3c')](_0xcf7914['query'][_0x7ad1('0x3c')]);_0x11c54b[_0x7ad1('0x3d')]=qs[_0x7ad1('0x34')](_[_0x7ad1('0x3e')](_0xcf7914[_0x7ad1('0x32')],_0x5f0a39[_0x7ad1('0x34')]),_0x2c2174);if(_0xcf7914[_0x7ad1('0x32')][_0x7ad1('0x3f')]){_0x11c54b[_0x7ad1('0x3d')]=_['merge'](_0x11c54b['where'],{'$or':_[_0x7ad1('0x2d')](_0x2c2174,function(_0x39639e){if(_0x39639e[_0x7ad1('0x2f')]!=='VIRTUAL'){var _0x28268f={};_0x28268f[_0x39639e[_0x7ad1('0x2a')]]={'$like':'%'+_0xcf7914[_0x7ad1('0x32')][_0x7ad1('0x3f')]+'%'};return _0x28268f;}})});}_0x11c54b=_[_0x7ad1('0x40')]({},_0x11c54b,_0xcf7914[_0x7ad1('0x41')]);var _0x1b08ef={'where':_0x11c54b[_0x7ad1('0x3d')]};return db[_0x7ad1('0x42')][_0x7ad1('0x1e')](_0x1b08ef)[_0x7ad1('0x26')](function(_0x5ba29c){_0x1b5a40[_0x7ad1('0x1e')]=_0x5ba29c;if(_0xcf7914[_0x7ad1('0x32')]['includeAll']){_0x11c54b[_0x7ad1('0x43')]=[{'all':!![]}];}return db[_0x7ad1('0x42')]['findAll'](_0x11c54b);})['then'](function(_0x440be5){_0x1b5a40[_0x7ad1('0x44')]=_0x440be5;return _0x1b5a40;})[_0x7ad1('0x26')](respondWithFilteredResult(_0x29c8cf,_0x11c54b))[_0x7ad1('0x45')](handleError(_0x29c8cf,null));};exports[_0x7ad1('0x46')]=function(_0x3dd90a,_0x10caaf){var _0x292906={'raw':!![],'where':{'id':_0x3dd90a[_0x7ad1('0x47')]['id']}},_0x2c3edd={};_0x2c3edd[_0x7ad1('0x31')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x2c3edd[_0x7ad1('0x32')]=_['keys'](_0x3dd90a[_0x7ad1('0x32')]);_0x2c3edd[_0x7ad1('0x34')]=_['intersection'](_0x2c3edd[_0x7ad1('0x31')],_0x2c3edd[_0x7ad1('0x32')]);_0x292906['attributes']=_[_0x7ad1('0x36')](_0x2c3edd[_0x7ad1('0x31')],qs[_0x7ad1('0x37')](_0x3dd90a['query'][_0x7ad1('0x37')]));_0x292906[_0x7ad1('0x35')]=_0x292906[_0x7ad1('0x35')][_0x7ad1('0x38')]?_0x292906['attributes']:_0x2c3edd[_0x7ad1('0x31')];if(_0x3dd90a[_0x7ad1('0x32')][_0x7ad1('0x48')]){_0x292906[_0x7ad1('0x43')]=[{'all':!![]}];}_0x292906=_[_0x7ad1('0x40')]({},_0x292906,_0x3dd90a['options']);return db['VoiceTransferReport']['find'](_0x292906)[_0x7ad1('0x26')](handleEntityNotFound(_0x10caaf,null))['then'](respondWithResult(_0x10caaf,null))[_0x7ad1('0x45')](handleError(_0x10caaf,null));};exports[_0x7ad1('0x49')]=function(_0x8322f5,_0x4bcf7d){return db['VoiceTransferReport'][_0x7ad1('0x49')](_0x8322f5['body'],{})[_0x7ad1('0x26')](respondWithResult(_0x4bcf7d,0xc9))[_0x7ad1('0x45')](handleError(_0x4bcf7d,null));};exports[_0x7ad1('0x24')]=function(_0x26bf5c,_0x47c6ee){if(_0x26bf5c[_0x7ad1('0x4a')]['id']){delete _0x26bf5c[_0x7ad1('0x4a')]['id'];}return db[_0x7ad1('0x42')][_0x7ad1('0x4b')]({'where':{'id':_0x26bf5c[_0x7ad1('0x47')]['id']}})[_0x7ad1('0x26')](handleEntityNotFound(_0x47c6ee,null))['then'](saveUpdates(_0x26bf5c['body'],null))[_0x7ad1('0x26')](respondWithResult(_0x47c6ee,null))[_0x7ad1('0x45')](handleError(_0x47c6ee,null));};exports[_0x7ad1('0x25')]=function(_0x377541,_0x293bfc){return db[_0x7ad1('0x42')]['find']({'where':{'id':_0x377541['params']['id']}})[_0x7ad1('0x26')](handleEntityNotFound(_0x293bfc,null))[_0x7ad1('0x26')](removeEntity(_0x293bfc,null))['catch'](handleError(_0x293bfc,null));};exports['describe']=function(_0x22d6b5,_0x1ea936){return db[_0x7ad1('0x42')][_0x7ad1('0x4c')]()[_0x7ad1('0x26')](respondWithResult(_0x1ea936,null))[_0x7ad1('0x45')](handleError(_0x1ea936,null));}; \ No newline at end of file +var _0x8e17=['intersection','attributes','fields','length','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','include','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0x8e17,0xa7));var _0x78e1=function(_0xaed4c,_0x1ad05f){_0xaed4c=_0xaed4c-0x0;var _0x1fa5a1=_0x8e17[_0xaed4c];return _0x1fa5a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x78e1('0x0'));var jsonpatch=require(_0x78e1('0x1'));var rp=require(_0x78e1('0x2'));var moment=require(_0x78e1('0x3'));var BPromise=require(_0x78e1('0x4'));var Mustache=require(_0x78e1('0x5'));var util=require('util');var path=require(_0x78e1('0x6'));var sox=require('sox');var csv=require(_0x78e1('0x7'));var ejs=require(_0x78e1('0x8'));var fs=require('fs');var fs_extra=require(_0x78e1('0x9'));var _=require(_0x78e1('0xa'));var squel=require(_0x78e1('0xb'));var crypto=require(_0x78e1('0xc'));var jsforce=require(_0x78e1('0xd'));var deskjs=require(_0x78e1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78e1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x78e1('0x10'));var hardwareService=require(_0x78e1('0x11'));var logger=require('../../config/logger')(_0x78e1('0x12'));var utils=require(_0x78e1('0x13'));var config=require(_0x78e1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x78e1('0x15'))['db'];function respondWithStatusCode(_0x4ac20f,_0x277ad6){_0x277ad6=_0x277ad6||0xcc;return function(_0x179168){if(_0x179168){return _0x4ac20f[_0x78e1('0x16')](_0x277ad6);}return _0x4ac20f[_0x78e1('0x17')](_0x277ad6)[_0x78e1('0x18')]();};}function respondWithResult(_0x5843d5,_0x5a9e56){_0x5a9e56=_0x5a9e56||0xc8;return function(_0x5a2622){if(_0x5a2622){return _0x5843d5[_0x78e1('0x17')](_0x5a9e56)[_0x78e1('0x19')](_0x5a2622);}};}function respondWithFilteredResult(_0x101fc2,_0x30dcec){return function(_0x5be5ed){if(_0x5be5ed){var _0x4ca20e=typeof _0x30dcec['offset']===_0x78e1('0x1a')&&typeof _0x30dcec[_0x78e1('0x1b')]===_0x78e1('0x1a');var _0xe3c79f=_0x5be5ed[_0x78e1('0x1c')];var _0x46ea1e=_0x4ca20e?0x0:_0x30dcec['offset'];var _0x284253=_0x4ca20e?_0x5be5ed[_0x78e1('0x1c')]:_0x30dcec[_0x78e1('0x1d')]+_0x30dcec[_0x78e1('0x1b')];var _0x3adcbf;if(_0x284253>=_0xe3c79f){_0x284253=_0xe3c79f;_0x3adcbf=0xc8;}else{_0x3adcbf=0xce;}_0x101fc2[_0x78e1('0x17')](_0x3adcbf);return _0x101fc2[_0x78e1('0x1e')](_0x78e1('0x1f'),_0x46ea1e+'-'+_0x284253+'/'+_0xe3c79f)[_0x78e1('0x19')](_0x5be5ed);}return null;};}function patchUpdates(_0x3f7378){return function(_0x450646){try{jsonpatch[_0x78e1('0x20')](_0x450646,_0x3f7378,!![]);}catch(_0x447538){return BPromise['reject'](_0x447538);}return _0x450646['save']();};}function saveUpdates(_0x500c29,_0x2a12b6){return function(_0x4859b3){if(_0x4859b3){return _0x4859b3[_0x78e1('0x21')](_0x500c29)[_0x78e1('0x22')](function(_0x312ced){return _0x312ced;});}return null;};}function removeEntity(_0x36748c,_0x3141ed){return function(_0x118f57){if(_0x118f57){return _0x118f57[_0x78e1('0x23')]()['then'](function(){_0x36748c['status'](0xcc)[_0x78e1('0x18')]();});}};}function handleEntityNotFound(_0x2787c7,_0x190851){return function(_0x15c71b){if(!_0x15c71b){_0x2787c7[_0x78e1('0x16')](0x194);}return _0x15c71b;};}function handleError(_0x343401,_0x511e96){_0x511e96=_0x511e96||0x1f4;return function(_0x26b1a0){logger['error'](_0x26b1a0[_0x78e1('0x24')]);if(_0x26b1a0[_0x78e1('0x25')]){delete _0x26b1a0[_0x78e1('0x25')];}_0x343401[_0x78e1('0x17')](_0x511e96)[_0x78e1('0x26')](_0x26b1a0);};}exports[_0x78e1('0x27')]=function(_0x18f2d4,_0x535fb8){var _0x564972={},_0x591d9c={},_0x2fcb16={'count':0x0,'rows':[]};var _0x5b672f=_[_0x78e1('0x28')](db[_0x78e1('0x29')][_0x78e1('0x2a')],function(_0x3d3556){return{'name':_0x3d3556[_0x78e1('0x2b')],'type':_0x3d3556[_0x78e1('0x2c')][_0x78e1('0x2d')]};});_0x591d9c[_0x78e1('0x2e')]=_[_0x78e1('0x28')](_0x5b672f,_0x78e1('0x25'));_0x591d9c['query']=_[_0x78e1('0x2f')](_0x18f2d4[_0x78e1('0x30')]);_0x591d9c['filters']=_[_0x78e1('0x31')](_0x591d9c[_0x78e1('0x2e')],_0x591d9c['query']);_0x564972[_0x78e1('0x32')]=_[_0x78e1('0x31')](_0x591d9c[_0x78e1('0x2e')],qs[_0x78e1('0x33')](_0x18f2d4[_0x78e1('0x30')][_0x78e1('0x33')]));_0x564972[_0x78e1('0x32')]=_0x564972[_0x78e1('0x32')][_0x78e1('0x34')]?_0x564972['attributes']:_0x591d9c[_0x78e1('0x2e')];if(!_0x18f2d4[_0x78e1('0x30')]['hasOwnProperty'](_0x78e1('0x35'))){_0x564972[_0x78e1('0x1b')]=qs[_0x78e1('0x1b')](_0x18f2d4[_0x78e1('0x30')]['limit']);_0x564972[_0x78e1('0x1d')]=qs[_0x78e1('0x1d')](_0x18f2d4['query'][_0x78e1('0x1d')]);}_0x564972[_0x78e1('0x36')]=qs[_0x78e1('0x37')](_0x18f2d4['query']['sort']);_0x564972['where']=qs['filters'](_[_0x78e1('0x38')](_0x18f2d4[_0x78e1('0x30')],_0x591d9c[_0x78e1('0x39')]),_0x5b672f);if(_0x18f2d4[_0x78e1('0x30')]['filter']){_0x564972[_0x78e1('0x3a')]=_[_0x78e1('0x3b')](_0x564972[_0x78e1('0x3a')],{'$or':_[_0x78e1('0x28')](_0x5b672f,function(_0x27fe77){if(_0x27fe77[_0x78e1('0x2c')]!==_0x78e1('0x3c')){var _0x4d7ddf={};_0x4d7ddf[_0x27fe77[_0x78e1('0x25')]]={'$like':'%'+_0x18f2d4[_0x78e1('0x30')][_0x78e1('0x3d')]+'%'};return _0x4d7ddf;}})});}_0x564972=_[_0x78e1('0x3b')]({},_0x564972,_0x18f2d4[_0x78e1('0x3e')]);var _0x53d917={'where':_0x564972[_0x78e1('0x3a')]};return db[_0x78e1('0x29')][_0x78e1('0x1c')](_0x53d917)['then'](function(_0x2ba9f2){_0x2fcb16['count']=_0x2ba9f2;if(_0x18f2d4[_0x78e1('0x30')][_0x78e1('0x3f')]){_0x564972['include']=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x564972);})[_0x78e1('0x22')](function(_0x47fe61){_0x2fcb16[_0x78e1('0x40')]=_0x47fe61;return _0x2fcb16;})[_0x78e1('0x22')](respondWithFilteredResult(_0x535fb8,_0x564972))[_0x78e1('0x41')](handleError(_0x535fb8,null));};exports['show']=function(_0x239c66,_0x2109d7){var _0x5be642={'raw':!![],'where':{'id':_0x239c66['params']['id']}},_0x3700c0={};_0x3700c0[_0x78e1('0x2e')]=_[_0x78e1('0x2f')](db[_0x78e1('0x29')][_0x78e1('0x2a')]);_0x3700c0[_0x78e1('0x30')]=_[_0x78e1('0x2f')](_0x239c66['query']);_0x3700c0[_0x78e1('0x39')]=_['intersection'](_0x3700c0[_0x78e1('0x2e')],_0x3700c0[_0x78e1('0x30')]);_0x5be642[_0x78e1('0x32')]=_[_0x78e1('0x31')](_0x3700c0[_0x78e1('0x2e')],qs[_0x78e1('0x33')](_0x239c66[_0x78e1('0x30')]['fields']));_0x5be642[_0x78e1('0x32')]=_0x5be642['attributes'][_0x78e1('0x34')]?_0x5be642[_0x78e1('0x32')]:_0x3700c0[_0x78e1('0x2e')];if(_0x239c66['query'][_0x78e1('0x3f')]){_0x5be642[_0x78e1('0x42')]=[{'all':!![]}];}_0x5be642=_[_0x78e1('0x3b')]({},_0x5be642,_0x239c66['options']);return db['VoiceTransferReport'][_0x78e1('0x43')](_0x5be642)[_0x78e1('0x22')](handleEntityNotFound(_0x2109d7,null))[_0x78e1('0x22')](respondWithResult(_0x2109d7,null))[_0x78e1('0x41')](handleError(_0x2109d7,null));};exports[_0x78e1('0x44')]=function(_0xbf60c7,_0x56cfa7){return db['VoiceTransferReport'][_0x78e1('0x44')](_0xbf60c7[_0x78e1('0x45')],{})['then'](respondWithResult(_0x56cfa7,0xc9))[_0x78e1('0x41')](handleError(_0x56cfa7,null));};exports[_0x78e1('0x21')]=function(_0x346b0e,_0x1ff4bd){if(_0x346b0e['body']['id']){delete _0x346b0e[_0x78e1('0x45')]['id'];}return db[_0x78e1('0x29')]['find']({'where':{'id':_0x346b0e[_0x78e1('0x46')]['id']}})[_0x78e1('0x22')](handleEntityNotFound(_0x1ff4bd,null))[_0x78e1('0x22')](saveUpdates(_0x346b0e[_0x78e1('0x45')],null))[_0x78e1('0x22')](respondWithResult(_0x1ff4bd,null))[_0x78e1('0x41')](handleError(_0x1ff4bd,null));};exports[_0x78e1('0x23')]=function(_0x204b25,_0x57846f){return db['VoiceTransferReport'][_0x78e1('0x43')]({'where':{'id':_0x204b25['params']['id']}})[_0x78e1('0x22')](handleEntityNotFound(_0x57846f,null))['then'](removeEntity(_0x57846f,null))[_0x78e1('0x41')](handleError(_0x57846f,null));};exports[_0x78e1('0x47')]=function(_0xd03aa7,_0x564e0a){return db[_0x78e1('0x29')]['describe']()[_0x78e1('0x22')](respondWithResult(_0x564e0a,null))['catch'](handleError(_0x564e0a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a8bbd44..b790404 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 _0x5849=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x354172,_0x113589){var _0x5bffed=function(_0x55209b){while(--_0x55209b){_0x354172['push'](_0x354172['shift']());}};_0x5bffed(++_0x113589);}(_0x5849,0x120));var _0x9584=function(_0x1d7386,_0x3efb7c){_0x1d7386=_0x1d7386-0x0;var _0x168f96=_0x5849[_0x1d7386];return _0x168f96;};'use strict';var _=require(_0x9584('0x0'));var util=require(_0x9584('0x1'));var logger=require(_0x9584('0x2'))(_0x9584('0x3'));var moment=require(_0x9584('0x4'));var BPromise=require(_0x9584('0x5'));var rp=require(_0x9584('0x6'));var fs=require('fs');var path=require(_0x9584('0x7'));var rimraf=require('rimraf');var config=require(_0x9584('0x8'));var attributes=require(_0x9584('0x9'));module[_0x9584('0xa')]=function(_0x3ca85f,_0x37056e){return _0x3ca85f['define'](_0x9584('0xb'),attributes,{'tableName':_0x9584('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5cd=['request-promise','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1303f5,_0x50dce4){var _0x177454=function(_0x4d847){while(--_0x4d847){_0x1303f5['push'](_0x1303f5['shift']());}};_0x177454(++_0x50dce4);}(_0xd5cd,0x1ef));var _0xdd5c=function(_0x56e8dc,_0x234316){_0x56e8dc=_0x56e8dc-0x0;var _0x1abbc7=_0xd5cd[_0x56e8dc];return _0x1abbc7;};'use strict';var _=require(_0xdd5c('0x0'));var util=require('util');var logger=require(_0xdd5c('0x1'))(_0xdd5c('0x2'));var moment=require(_0xdd5c('0x3'));var BPromise=require(_0xdd5c('0x4'));var rp=require(_0xdd5c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdd5c('0x6'));module[_0xdd5c('0x7')]=function(_0x290c3b,_0x1c0d31){return _0x290c3b['define'](_0xdd5c('0x8'),attributes,{'tableName':_0xdd5c('0x9'),'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 d2092d1..601263c 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 _0xa8c2=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1a6517,_0x8f842a){var _0x2881db=function(_0x202b9a){while(--_0x202b9a){_0x1a6517['push'](_0x1a6517['shift']());}};_0x2881db(++_0x8f842a);}(_0xa8c2,0x104));var _0x2a8c=function(_0x476068,_0x6f216e){_0x476068=_0x476068-0x0;var _0x4887b7=_0xa8c2[_0x476068];return _0x4887b7;};'use strict';var _=require(_0x2a8c('0x0'));var util=require(_0x2a8c('0x1'));var moment=require('moment');var BPromise=require(_0x2a8c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a8c('0x3'));var db=require(_0x2a8c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a8c('0x5'))(_0x2a8c('0x6'));var config=require(_0x2a8c('0x7'));var jayson=require(_0x2a8c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3a8b,_0x98eb1c,_0x541749){return new BPromise(function(_0x16acd4,_0x26f3ee){return client[_0x2a8c('0x9')](_0x3c3a8b,_0x541749)[_0x2a8c('0xa')](function(_0x5d4820){logger[_0x2a8c('0xb')](_0x2a8c('0xc'),_0x98eb1c,'request\x20sent');logger[_0x2a8c('0xd')](_0x2a8c('0xe'),_0x98eb1c,_0x2a8c('0xf'),JSON[_0x2a8c('0x10')](_0x5d4820));if(_0x5d4820[_0x2a8c('0x11')]){if(_0x5d4820[_0x2a8c('0x11')][_0x2a8c('0x12')]===0x1f4){logger[_0x2a8c('0x11')](_0x2a8c('0xc'),_0x98eb1c,_0x5d4820[_0x2a8c('0x11')][_0x2a8c('0x13')]);return _0x26f3ee(_0x5d4820[_0x2a8c('0x11')][_0x2a8c('0x13')]);}logger[_0x2a8c('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x98eb1c,_0x5d4820[_0x2a8c('0x11')]['message']);return _0x16acd4(_0x5d4820['error'][_0x2a8c('0x13')]);}else{logger[_0x2a8c('0xb')](_0x2a8c('0xc'),_0x98eb1c,_0x2a8c('0xf'));_0x16acd4(_0x5d4820[_0x2a8c('0x14')][_0x2a8c('0x13')]);}})[_0x2a8c('0x15')](function(_0x378183){logger['error'](_0x2a8c('0xc'),_0x98eb1c,_0x378183);_0x26f3ee(_0x378183);});});}exports[_0x2a8c('0x16')]=function(_0x169f08){var _0xedc5eb=this;return new Promise(function(_0x1c4197,_0x34bec7){return db[_0x2a8c('0x17')][_0x2a8c('0x18')](_0x169f08[_0x2a8c('0x19')],{'raw':_0x169f08[_0x2a8c('0x1a')]?_0x169f08[_0x2a8c('0x1a')][_0x2a8c('0x1b')]===undefined?!![]:![]:!![]})[_0x2a8c('0xa')](function(_0x56576a){logger[_0x2a8c('0xb')](_0x2a8c('0x16'),_0x169f08);logger[_0x2a8c('0xd')](_0x2a8c('0x16'),_0x169f08,JSON['stringify'](_0x56576a));_0x1c4197(_0x56576a);})[_0x2a8c('0x15')](function(_0x21c856){logger['error'](_0x2a8c('0x16'),_0x21c856['message'],_0x169f08);_0x34bec7(_0xedc5eb['error'](0x1f4,_0x21c856[_0x2a8c('0x13')]));});});}; \ No newline at end of file +var _0xbec9=['../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x25b51d,_0x4a6600){var _0x3eeb68=function(_0x5d3ba2){while(--_0x5d3ba2){_0x25b51d['push'](_0x25b51d['shift']());}};_0x3eeb68(++_0x4a6600);}(_0xbec9,0x14b));var _0x9bec=function(_0x54db47,_0x273320){_0x54db47=_0x54db47-0x0;var _0x14a86d=_0xbec9[_0x54db47];return _0x14a86d;};'use strict';var _=require(_0x9bec('0x0'));var util=require(_0x9bec('0x1'));var moment=require(_0x9bec('0x2'));var BPromise=require(_0x9bec('0x3'));var rs=require(_0x9bec('0x4'));var fs=require('fs');var Redis=require(_0x9bec('0x5'));var db=require(_0x9bec('0x6'))['db'];var utils=require(_0x9bec('0x7'));var logger=require(_0x9bec('0x8'))(_0x9bec('0x9'));var config=require(_0x9bec('0xa'));var jayson=require(_0x9bec('0xb'));var client=jayson[_0x9bec('0xc')][_0x9bec('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x177f2a,_0x307570,_0x2df14e){return new BPromise(function(_0x57f759,_0x41d538){return client['request'](_0x177f2a,_0x2df14e)['then'](function(_0x506c87){logger[_0x9bec('0xe')](_0x9bec('0xf'),_0x307570,'request\x20sent');logger[_0x9bec('0x10')](_0x9bec('0x11'),_0x307570,'request\x20sent',JSON['stringify'](_0x506c87));if(_0x506c87[_0x9bec('0x12')]){if(_0x506c87[_0x9bec('0x12')][_0x9bec('0x13')]===0x1f4){logger[_0x9bec('0x12')](_0x9bec('0xf'),_0x307570,_0x506c87[_0x9bec('0x12')][_0x9bec('0x14')]);return _0x41d538(_0x506c87[_0x9bec('0x12')][_0x9bec('0x14')]);}logger[_0x9bec('0x12')](_0x9bec('0xf'),_0x307570,_0x506c87[_0x9bec('0x12')][_0x9bec('0x14')]);return _0x57f759(_0x506c87[_0x9bec('0x12')][_0x9bec('0x14')]);}else{logger[_0x9bec('0xe')](_0x9bec('0xf'),_0x307570,_0x9bec('0x15'));_0x57f759(_0x506c87[_0x9bec('0x16')][_0x9bec('0x14')]);}})[_0x9bec('0x17')](function(_0x4ee30f){logger[_0x9bec('0x12')](_0x9bec('0xf'),_0x307570,_0x4ee30f);_0x41d538(_0x4ee30f);});});}exports[_0x9bec('0x18')]=function(_0x325bf2){var _0x12d22d=this;return new Promise(function(_0x353f0f,_0x21f4ec){return db[_0x9bec('0x19')][_0x9bec('0x1a')](_0x325bf2['body'],{'raw':_0x325bf2[_0x9bec('0x1b')]?_0x325bf2[_0x9bec('0x1b')][_0x9bec('0x1c')]===undefined?!![]:![]:!![]})[_0x9bec('0x1d')](function(_0x37f03b){logger[_0x9bec('0xe')](_0x9bec('0x18'),_0x325bf2);logger[_0x9bec('0x10')](_0x9bec('0x18'),_0x325bf2,JSON[_0x9bec('0x1e')](_0x37f03b));_0x353f0f(_0x37f03b);})[_0x9bec('0x17')](function(_0x5b82c8){logger[_0x9bec('0x12')](_0x9bec('0x18'),_0x5b82c8[_0x9bec('0x14')],_0x325bf2);_0x21f4ec(_0x12d22d[_0x9bec('0x12')](0x1f4,_0x5b82c8[_0x9bec('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 6b9d241..0cca35d 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 _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x1295e2,_0x3429e2){var _0x41cb6a=function(_0x5c8213){while(--_0x5c8213){_0x1295e2['push'](_0x1295e2['shift']());}};_0x41cb6a(++_0x3429e2);}(_0xf109,0xce));var _0x9f10=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xf109[_0x20ef64];return _0x3707d8;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x3e4cf4,_0xb2eb34){var _0x251276=function(_0xbde91f){while(--_0xbde91f){_0x3e4cf4['push'](_0x3e4cf4['shift']());}};_0x251276(++_0xb2eb34);}(_0xdace,0xc5));var _0xedac=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xdace[_0x51ac09];return _0x3f827d;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 217a5b1..341ca0d 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 _0x34e8=['path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','localhost','socket.io-emitter','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','request','then','message','result','catch','User','agent','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','format','hangup','hangup\x20fired:','user:%s','hangup\x20executed!','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!'];(function(_0x386c94,_0x430936){var _0x4220a7=function(_0xd86dcf){while(--_0xd86dcf){_0x386c94['push'](_0x386c94['shift']());}};_0x4220a7(++_0x430936);}(_0x34e8,0x12c));var _0x834e=function(_0x283a67,_0x183f51){_0x283a67=_0x283a67-0x0;var _0x3d3d21=_0x34e8[_0x283a67];return _0x3d3d21;};'use strict';var path=require(_0x834e('0x0'));var fs=require('fs');var _=require(_0x834e('0x1'));var db=require(_0x834e('0x2'))['db'];var config=require(_0x834e('0x3'));var util=require('util');var BPromise=require(_0x834e('0x4'));var jayson=require(_0x834e('0x5'));var amiClient=jayson[_0x834e('0x6')][_0x834e('0x7')]({'port':0x232a});var logger=require(_0x834e('0x8'))(_0x834e('0x9'));var Redis=require(_0x834e('0xa'));config['redis']=_[_0x834e('0xb')](config['redis'],{'host':_0x834e('0xc'),'port':0x18eb});var io=require(_0x834e('0xd'))(new Redis(config[_0x834e('0xe')]));var Schema=require(_0x834e('0xf'));var originateValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],_0x834e('0x11')]},'callNumber':{'type':_0x834e('0x12'),'required':[!![],_0x834e('0x13')]},'callerId':{'type':_0x834e('0x12')},'callbackUrl':{'type':_0x834e('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],_0x834e('0x11')]},'sessionId':{'type':_0x834e('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],_0x834e('0x11')]},'sessionId':{'type':_0x834e('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x834e('0x12'),'required':[!![],_0x834e('0x14')]},'transferNumber':{'type':'string','required':[!![],_0x834e('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0x834e('0x10'),'required':[!![],_0x834e('0x11')]},'sessionId':{'type':_0x834e('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x834e('0x11')]},'sessionId':{'type':_0x834e('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x834e('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x834e('0x11')]}});function emit(_0x36d443,_0x478afe,_0x43ac41){logger[_0x834e('0x16')](_0x36d443,_0x478afe,JSON[_0x834e('0x17')](_0x43ac41));io['to'](_0x36d443)['emit'](_0x478afe,_0x43ac41);}function handleError(_0x283e56){return function(_0x211e9a){console[_0x834e('0x18')](_0x834e('0x19'),_0x211e9a,_0x211e9a instanceof RangeError);logger[_0x834e('0x1a')](_0x211e9a[_0x834e('0x1b')]);if(_0x211e9a instanceof RangeError){if(_0x211e9a[_0x834e('0x1c')]){delete _0x211e9a['name'];}_0x283e56[_0x834e('0x1d')](0x194)[_0x834e('0x1e')](_0x211e9a);}else{if(_0x211e9a[_0x834e('0x1c')]){delete _0x211e9a[_0x834e('0x1c')];}_0x283e56['status'](0x1f4)[_0x834e('0x1e')](_0x211e9a);}};}function checkError(){return function(_0x62f8f1){if(!_0x62f8f1){throw new RangeError('NotFound');}return _0x62f8f1;};}function respondWithRpcPromise(_0x1b4bdf,_0x28d687){return new BPromise(function(_0x8d406e,_0x5c55ca){var _0x4e3f48=amiClient;return _0x4e3f48[_0x834e('0x1f')](_0x1b4bdf,_0x28d687)[_0x834e('0x20')](function(_0x589dde){if(_0x589dde[_0x834e('0x1a')]){if(_0x589dde[_0x834e('0x1a')]['code']===0x1f4){return _0x5c55ca(_0x589dde[_0x834e('0x1a')][_0x834e('0x21')]);}return _0x8d406e(_0x589dde[_0x834e('0x1a')]['message']);}else{_0x8d406e(_0x589dde[_0x834e('0x22')]);}})[_0x834e('0x23')](function(_0x5e1cc5){_0x5c55ca(_0x5e1cc5);});});}function getAgent(_0x5bef62){return db[_0x834e('0x24')]['findOne']({'where':{'id':_0x5bef62,'role':_0x834e('0x25')}})[_0x834e('0x20')](checkError());}function getAgentCheckSession(_0x3db026,_0x2cc2eb){return new BPromise(function(_0x3cd928,_0x130cc5){var _0x491919=respondWithRpcPromise('VoiceChannels');var _0x4dc64a=getAgent(_0x3db026);Promise['all']([_0x491919,_0x4dc64a])[_0x834e('0x20')](function(_0x567cea){var _0x106d6a=_0x567cea[0x0];var _0x5dacc1=_0x567cea[0x1];var _0xb5bc06=_[_0x834e('0x26')](_0x106d6a[_0x834e('0x27')],function(_0x1e026a){return _0x1e026a[_0x834e('0x28')]==_0x5dacc1['id']&&_0x1e026a[_0x834e('0x29')]==_0x2cc2eb;});if(_0xb5bc06[_0x834e('0x2a')]==0x1){_0x3cd928(_0x5dacc1);}else{_0x130cc5(new RangeError(_0x834e('0x2b')+_0x2cc2eb+_0x834e('0x2c')));}});});}exports['originate']=function(_0xef9ec2,_0x5cad11){logger[_0x834e('0x16')](_0x834e('0x2d'),_0xef9ec2[_0x834e('0x2e')]);var _0x2b3418=originateValidation[_0x834e('0xf')](_0xef9ec2[_0x834e('0x2e')]);if(_0x2b3418[_0x834e('0x2a')]>0x0){return _0x5cad11[_0x834e('0x1d')](0x190)[_0x834e('0x2f')](_0x2b3418);}var _0x12b2bc=_0xef9ec2['body'][_0x834e('0x30')];var _0x2f408a=_0xef9ec2[_0x834e('0x2e')][_0x834e('0x31')];var _0x595cc0=_0xef9ec2[_0x834e('0x2e')][_0x834e('0x32')];var _0x4b12f5=_0xef9ec2['body']['callbackUrl'];return getAgent(_0x12b2bc)[_0x834e('0x20')](function(_0x41bf4d){logger[_0x834e('0x16')](_0x834e('0x33'),_0x41bf4d[_0x834e('0x1c')]);emit(util[_0x834e('0x34')]('user:%s',_0x41bf4d[_0x834e('0x1c')]),'webbar:originate',{'callNumber':_0x2f408a,'callerId':_0x595cc0,'callbackUrl':_0x4b12f5});return _0x5cad11[_0x834e('0x1d')](0xc8)[_0x834e('0x2f')]({'error':![],'message':'originate\x20executed!'});})[_0x834e('0x23')](handleError(_0x5cad11));};exports[_0x834e('0x35')]=function(_0x491c28,_0x481f70){logger[_0x834e('0x16')](_0x834e('0x36'),_0x491c28[_0x834e('0x2e')]);var _0x130c23=hangupValidation[_0x834e('0xf')](_0x491c28['body']);if(_0x130c23[_0x834e('0x2a')]>0x0){return _0x481f70['status'](0x190)['json'](_0x130c23);}var _0x1b2edf=_0x491c28['body'][_0x834e('0x30')];var _0x1ba66d=_0x491c28[_0x834e('0x2e')][_0x834e('0x29')];return getAgent(_0x1b2edf)[_0x834e('0x20')](function(_0x574ea8){logger[_0x834e('0x16')](_0x834e('0x33'),_0x574ea8[_0x834e('0x1c')]);emit(util['format'](_0x834e('0x37'),_0x574ea8[_0x834e('0x1c')]),'webbar:hangup',{'sessionId':_0x1ba66d});return _0x481f70[_0x834e('0x1d')](0xc8)['json']({'error':![],'message':_0x834e('0x38')});})[_0x834e('0x23')](handleError(_0x481f70));};exports['answer']=function(_0x4a6942,_0x22ea21){logger[_0x834e('0x16')](_0x834e('0x39'),_0x4a6942[_0x834e('0x2e')]);var _0x8ad264=answerValidation[_0x834e('0xf')](_0x4a6942[_0x834e('0x2e')]);if(_0x8ad264['length']>0x0){return _0x22ea21[_0x834e('0x1d')](0x190)['json'](_0x8ad264);}var _0x321efa=_0x4a6942['body'][_0x834e('0x30')];var _0x5a5807=_0x4a6942[_0x834e('0x2e')][_0x834e('0x29')];return getAgent(_0x321efa)['then'](function(_0x39e7b9){logger[_0x834e('0x16')](_0x834e('0x33'),_0x39e7b9[_0x834e('0x1c')]);emit(util[_0x834e('0x34')](_0x834e('0x37'),_0x39e7b9[_0x834e('0x1c')]),_0x834e('0x3a'),{'sessionId':_0x5a5807});return _0x22ea21[_0x834e('0x1d')](0xc8)[_0x834e('0x2f')]({'error':![],'message':'answer\x20executed!'});})[_0x834e('0x23')](handleError(_0x22ea21));};exports[_0x834e('0x3b')]=function(_0x47a8a9,_0x112306){logger[_0x834e('0x16')](_0x834e('0x3c'),_0x47a8a9[_0x834e('0x2e')]);var _0x19b5ef=holdValidation[_0x834e('0xf')](_0x47a8a9['body']);if(_0x19b5ef['length']>0x0){return _0x112306[_0x834e('0x1d')](0x190)[_0x834e('0x2f')](_0x19b5ef);}var _0x30568e=_0x47a8a9[_0x834e('0x2e')][_0x834e('0x30')];var _0xd1d83b=_0x47a8a9[_0x834e('0x2e')][_0x834e('0x29')];return getAgent(_0x30568e)[_0x834e('0x20')](function(_0x390c45){logger[_0x834e('0x16')](_0x834e('0x33'),_0x390c45[_0x834e('0x1c')]);emit(util[_0x834e('0x34')](_0x834e('0x37'),_0x390c45[_0x834e('0x1c')]),_0x834e('0x3d'),{'sessionId':_0xd1d83b});return _0x112306[_0x834e('0x1d')](0xc8)[_0x834e('0x2f')]({'error':![],'message':_0x834e('0x3e')});})['catch'](handleError(_0x112306));};exports[_0x834e('0x3f')]=function(_0x1f08b9,_0x4e73e0){logger[_0x834e('0x16')](_0x834e('0x40'),_0x1f08b9['body']);var _0x3dcca3=unholdValidation[_0x834e('0xf')](_0x1f08b9[_0x834e('0x2e')]);if(_0x3dcca3[_0x834e('0x2a')]>0x0){return _0x4e73e0[_0x834e('0x1d')](0x190)[_0x834e('0x2f')](_0x3dcca3);}var _0x4549ba=_0x1f08b9['body'][_0x834e('0x30')];var _0x8bc6c6=_0x1f08b9[_0x834e('0x2e')][_0x834e('0x29')];return getAgent(_0x4549ba)[_0x834e('0x20')](function(_0x396bbe){logger[_0x834e('0x16')](_0x834e('0x33'),_0x396bbe['name']);emit(util[_0x834e('0x34')]('user:%s',_0x396bbe[_0x834e('0x1c')]),'webbar:unhold',{'sessionId':_0x8bc6c6});return _0x4e73e0[_0x834e('0x1d')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x834e('0x23')](handleError(_0x4e73e0));};exports[_0x834e('0x41')]=function(_0x5291ae,_0x5be43d){logger[_0x834e('0x16')](_0x834e('0x42'),_0x5be43d[_0x834e('0x2e')]);var _0x387365=callsValidation[_0x834e('0xf')](_0x5291ae[_0x834e('0x2e')]);if(_0x387365[_0x834e('0x2a')]>0x0){return _0x5be43d[_0x834e('0x1d')](0x190)['json'](_0x387365);}var _0x142334=_0x5291ae[_0x834e('0x2e')]['userId'];var _0x281342=respondWithRpcPromise('VoiceChannels');var _0x3e58ef=getAgent(_0x142334);return Promise[_0x834e('0x43')]([_0x281342,_0x3e58ef])['then'](function(_0x41ef86){var _0x37ee0e=_0x41ef86[0x0];var _0x2de29a=_0x41ef86[0x1];var _0x25f720=_['filter'](_0x37ee0e[_0x834e('0x27')],function(_0x438f75){return _0x438f75[_0x834e('0x28')]==_0x2de29a['id'];});return _0x5be43d['status'](0xc8)[_0x834e('0x2f')]({'count':_0x25f720[_0x834e('0x2a')],'rows':_0x25f720});})[_0x834e('0x23')](handleError(_0x5be43d));};exports[_0x834e('0x44')]=function(_0x3183c5,_0x125f37){logger[_0x834e('0x16')](_0x834e('0x45'),_0x3183c5[_0x834e('0x2e')]);var _0xfcccd8=conferenceValidation[_0x834e('0xf')](_0x3183c5[_0x834e('0x2e')]);if(_0xfcccd8[_0x834e('0x2a')]>0x0){return _0x125f37[_0x834e('0x1d')](0x190)[_0x834e('0x2f')](_0xfcccd8);}var _0x17b8e3=_0x3183c5[_0x834e('0x2e')][_0x834e('0x30')];return getAgent(_0x17b8e3)[_0x834e('0x20')](function(_0x3e3467){logger[_0x834e('0x16')](_0x834e('0x33'),_0x3e3467['name']);emit(util[_0x834e('0x34')](_0x834e('0x37'),_0x3e3467[_0x834e('0x1c')]),_0x834e('0x46'));return _0x125f37['status'](0xc8)[_0x834e('0x2f')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x125f37));};exports[_0x834e('0x47')]=function(_0x2b1ec7,_0x1644dd){logger[_0x834e('0x16')](_0x834e('0x48'),_0x2b1ec7[_0x834e('0x2e')]);var _0xbb926d=transferValidation[_0x834e('0xf')](_0x2b1ec7['body']);if(_0xbb926d[_0x834e('0x2a')]>0x0){return _0x1644dd['status'](0x190)[_0x834e('0x2f')](_0xbb926d);}var _0xd35dda=_0x2b1ec7['body']['userId'];var _0x4a4def=_0x2b1ec7[_0x834e('0x2e')][_0x834e('0x29')];var _0x2cca07=_0x2b1ec7[_0x834e('0x2e')]['transferNumber'];return getAgent(_0xd35dda)[_0x834e('0x20')](function(_0x15018f){logger[_0x834e('0x16')](_0x834e('0x33'),_0x15018f[_0x834e('0x1c')]);emit(util[_0x834e('0x34')](_0x834e('0x37'),_0x15018f[_0x834e('0x1c')]),_0x834e('0x49'),{'sessionId':_0x4a4def,'transferNumber':_0x2cca07});return _0x1644dd[_0x834e('0x1d')](0xc8)['json']({'error':![],'message':_0x834e('0x4a')});})[_0x834e('0x23')](handleError(_0x1644dd));}; \ No newline at end of file +var _0x1b32=['emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','length','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20fired:','hangup\x20executed!','catch','answer','answer\x20fired:','webbar:answer','hold','sessionId','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x22d8a6,_0x4383d6){var _0x1364e0=function(_0x8deee2){while(--_0x8deee2){_0x22d8a6['push'](_0x22d8a6['shift']());}};_0x1364e0(++_0x4383d6);}(_0x1b32,0x85));var _0x21b3=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x1b32[_0x25e7cb];return _0x375d92;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x21b3('0x0'));var db=require(_0x21b3('0x1'))['db'];var config=require(_0x21b3('0x2'));var util=require(_0x21b3('0x3'));var BPromise=require(_0x21b3('0x4'));var jayson=require(_0x21b3('0x5'));var amiClient=jayson[_0x21b3('0x6')][_0x21b3('0x7')]({'port':0x232a});var logger=require(_0x21b3('0x8'))(_0x21b3('0x9'));var Redis=require(_0x21b3('0xa'));config[_0x21b3('0xb')]=_[_0x21b3('0xc')](config[_0x21b3('0xb')],{'host':_0x21b3('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x21b3('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x12')]},'transferNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x15662a,_0xe6b2b7,_0x29f286){logger[_0x21b3('0x14')](_0x15662a,_0xe6b2b7,JSON['stringify'](_0x29f286));io['to'](_0x15662a)[_0x21b3('0x15')](_0xe6b2b7,_0x29f286);}function handleError(_0x47ae6c){return function(_0x408c17){console[_0x21b3('0x16')](_0x21b3('0x17'),_0x408c17,_0x408c17 instanceof RangeError);logger[_0x21b3('0x18')](_0x408c17['stack']);if(_0x408c17 instanceof RangeError){if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x194)['send'](_0x408c17);}else{if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x1f4)[_0x21b3('0x1b')](_0x408c17);}};}function checkError(){return function(_0x360e57){if(!_0x360e57){throw new RangeError(_0x21b3('0x1c'));}return _0x360e57;};}function respondWithRpcPromise(_0x1e5181,_0x4cc8e0){return new BPromise(function(_0xbb78f3,_0x54695b){var _0x139672=amiClient;return _0x139672[_0x21b3('0x1d')](_0x1e5181,_0x4cc8e0)[_0x21b3('0x1e')](function(_0x4fcb87){if(_0x4fcb87[_0x21b3('0x18')]){if(_0x4fcb87['error'][_0x21b3('0x1f')]===0x1f4){return _0x54695b(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}return _0xbb78f3(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}else{_0xbb78f3(_0x4fcb87[_0x21b3('0x21')]);}})['catch'](function(_0x5b752c){_0x54695b(_0x5b752c);});});}function getAgent(_0x49aab8){return db[_0x21b3('0x22')][_0x21b3('0x23')]({'where':{'id':_0x49aab8,'role':_0x21b3('0x24')}})[_0x21b3('0x1e')](checkError());}function getAgentCheckSession(_0x18eba4,_0x58a356){return new BPromise(function(_0x170e78,_0x564313){var _0x16d012=respondWithRpcPromise('VoiceChannels');var _0x469e42=getAgent(_0x18eba4);Promise[_0x21b3('0x25')]([_0x16d012,_0x469e42])[_0x21b3('0x1e')](function(_0x4f6432){var _0x291e52=_0x4f6432[0x0];var _0x300977=_0x4f6432[0x1];var _0x336b1e=_[_0x21b3('0x26')](_0x291e52[_0x21b3('0x27')],function(_0x210c49){return _0x210c49[_0x21b3('0x28')]==_0x300977['id']&&_0x210c49['sessionId']==_0x58a356;});if(_0x336b1e['length']==0x1){_0x170e78(_0x300977);}else{_0x564313(new RangeError(_0x21b3('0x29')+_0x58a356+_0x21b3('0x2a')));}});});}exports['originate']=function(_0x45c753,_0xa04ac7){logger[_0x21b3('0x14')](_0x21b3('0x2b'),_0x45c753[_0x21b3('0x2c')]);var _0x6c56f5=originateValidation[_0x21b3('0x2d')](_0x45c753[_0x21b3('0x2c')]);if(_0x6c56f5[_0x21b3('0x2e')]>0x0){return _0xa04ac7['status'](0x190)['json'](_0x6c56f5);}var _0x18946f=_0x45c753['body'][_0x21b3('0x2f')];var _0x2d8c12=_0x45c753['body'][_0x21b3('0x30')];var _0x403cec=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x31')];var _0x4c4239=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x32')];return getAgent(_0x18946f)[_0x21b3('0x1e')](function(_0x118b9b){logger['info'](_0x21b3('0x33'),_0x118b9b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x118b9b[_0x21b3('0x19')]),_0x21b3('0x36'),{'callNumber':_0x2d8c12,'callerId':_0x403cec,'callbackUrl':_0x4c4239});return _0xa04ac7[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x38')});})['catch'](handleError(_0xa04ac7));};exports['hangup']=function(_0x28641f,_0x86027e){logger[_0x21b3('0x14')](_0x21b3('0x39'),_0x28641f['body']);var _0x1c190e=hangupValidation[_0x21b3('0x2d')](_0x28641f[_0x21b3('0x2c')]);if(_0x1c190e[_0x21b3('0x2e')]>0x0){return _0x86027e[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x1c190e);}var _0xbb93cd=_0x28641f[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x3145b2=_0x28641f[_0x21b3('0x2c')]['sessionId'];return getAgent(_0xbb93cd)[_0x21b3('0x1e')](function(_0x321050){logger['info'](_0x21b3('0x33'),_0x321050['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x321050['name']),'webbar:hangup',{'sessionId':_0x3145b2});return _0x86027e['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x3a')});})[_0x21b3('0x3b')](handleError(_0x86027e));};exports[_0x21b3('0x3c')]=function(_0x548652,_0x5d310c){logger[_0x21b3('0x14')](_0x21b3('0x3d'),_0x548652[_0x21b3('0x2c')]);var _0x28adbc=answerValidation[_0x21b3('0x2d')](_0x548652[_0x21b3('0x2c')]);if(_0x28adbc[_0x21b3('0x2e')]>0x0){return _0x5d310c['status'](0x190)[_0x21b3('0x37')](_0x28adbc);}var _0x44cf7d=_0x548652[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x119b43=_0x548652[_0x21b3('0x2c')]['sessionId'];return getAgent(_0x44cf7d)['then'](function(_0x1e7e1b){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x1e7e1b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x1e7e1b[_0x21b3('0x19')]),_0x21b3('0x3e'),{'sessionId':_0x119b43});return _0x5d310c[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'answer\x20executed!'});})[_0x21b3('0x3b')](handleError(_0x5d310c));};exports[_0x21b3('0x3f')]=function(_0x3bc4ef,_0x4e3d2b){logger['info']('hold\x20fired:',_0x3bc4ef[_0x21b3('0x2c')]);var _0x17b878=holdValidation[_0x21b3('0x2d')](_0x3bc4ef[_0x21b3('0x2c')]);if(_0x17b878[_0x21b3('0x2e')]>0x0){return _0x4e3d2b[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x17b878);}var _0x30d48b=_0x3bc4ef[_0x21b3('0x2c')]['userId'];var _0x542ef4=_0x3bc4ef['body'][_0x21b3('0x40')];return getAgent(_0x30d48b)[_0x21b3('0x1e')](function(_0x4046cd){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x4046cd[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x4046cd[_0x21b3('0x19')]),_0x21b3('0x41'),{'sessionId':_0x542ef4});return _0x4e3d2b['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x42')});})[_0x21b3('0x3b')](handleError(_0x4e3d2b));};exports[_0x21b3('0x43')]=function(_0x34509e,_0x2c7019){logger[_0x21b3('0x14')](_0x21b3('0x44'),_0x34509e[_0x21b3('0x2c')]);var _0x58c568=unholdValidation[_0x21b3('0x2d')](_0x34509e[_0x21b3('0x2c')]);if(_0x58c568[_0x21b3('0x2e')]>0x0){return _0x2c7019[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x58c568);}var _0x5d7ee7=_0x34509e['body'][_0x21b3('0x2f')];var _0x4bd19f=_0x34509e[_0x21b3('0x2c')][_0x21b3('0x40')];return getAgent(_0x5d7ee7)[_0x21b3('0x1e')](function(_0x412536){logger['info']('entityFound:',_0x412536[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x412536[_0x21b3('0x19')]),'webbar:unhold',{'sessionId':_0x4bd19f});return _0x2c7019[_0x21b3('0x1a')](0xc8)['json']({'error':![],'message':_0x21b3('0x45')});})[_0x21b3('0x3b')](handleError(_0x2c7019));};exports['calls']=function(_0x5f55ff,_0x3fd841){logger[_0x21b3('0x14')](_0x21b3('0x46'),_0x3fd841[_0x21b3('0x2c')]);var _0xc612b5=callsValidation[_0x21b3('0x2d')](_0x5f55ff[_0x21b3('0x2c')]);if(_0xc612b5['length']>0x0){return _0x3fd841[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0xc612b5);}var _0x166a31=_0x5f55ff[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x49a40e=respondWithRpcPromise('VoiceChannels');var _0x31c8f8=getAgent(_0x166a31);return Promise[_0x21b3('0x25')]([_0x49a40e,_0x31c8f8])[_0x21b3('0x1e')](function(_0x279b7d){var _0x18582e=_0x279b7d[0x0];var _0x4f728=_0x279b7d[0x1];var _0x5b1611=_[_0x21b3('0x26')](_0x18582e[_0x21b3('0x27')],function(_0x552141){return _0x552141[_0x21b3('0x28')]==_0x4f728['id'];});return _0x3fd841['status'](0xc8)[_0x21b3('0x37')]({'count':_0x5b1611[_0x21b3('0x2e')],'rows':_0x5b1611});})[_0x21b3('0x3b')](handleError(_0x3fd841));};exports[_0x21b3('0x47')]=function(_0x542c4e,_0x193317){logger['info'](_0x21b3('0x48'),_0x542c4e[_0x21b3('0x2c')]);var _0x3d285f=conferenceValidation[_0x21b3('0x2d')](_0x542c4e[_0x21b3('0x2c')]);if(_0x3d285f['length']>0x0){return _0x193317[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3d285f);}var _0x1821bf=_0x542c4e[_0x21b3('0x2c')][_0x21b3('0x2f')];return getAgent(_0x1821bf)[_0x21b3('0x1e')](function(_0xf6eb3){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0xf6eb3[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0xf6eb3[_0x21b3('0x19')]),_0x21b3('0x49'));return _0x193317[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x4a')});})[_0x21b3('0x3b')](handleError(_0x193317));};exports['transfer']=function(_0x412e3b,_0xc0c8f){logger[_0x21b3('0x14')]('transfer\x20fired:',_0x412e3b[_0x21b3('0x2c')]);var _0x3572e1=transferValidation[_0x21b3('0x2d')](_0x412e3b['body']);if(_0x3572e1[_0x21b3('0x2e')]>0x0){return _0xc0c8f[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3572e1);}var _0x1655e4=_0x412e3b[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x2d33a7=_0x412e3b['body']['sessionId'];var _0x31c511=_0x412e3b['body'][_0x21b3('0x4b')];return getAgent(_0x1655e4)[_0x21b3('0x1e')](function(_0x164d9f){logger['info'](_0x21b3('0x33'),_0x164d9f[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x164d9f[_0x21b3('0x19')]),_0x21b3('0x4c'),{'sessionId':_0x2d33a7,'transferNumber':_0x31c511});return _0xc0c8f[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc0c8f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3bfd5d5..e745eb1 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 _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x7014dc,_0x53d244){var _0x42d253=function(_0x2cecd9){while(--_0x2cecd9){_0x7014dc['push'](_0x7014dc['shift']());}};_0x42d253(++_0x53d244);}(_0x5c3c,0x132));var _0xc5c3=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x5c3c[_0x50007c];return _0x5c1ec7;};'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']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file +var _0xef0f=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeAnswers','exports'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xef0f,0x168));var _0xfef0=function(_0x56e5dd,_0x59862b){_0x56e5dd=_0x56e5dd-0x0;var _0xebba1e=_0xef0f[_0x56e5dd];return _0xebba1e;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0x8')](_0xfef0('0xf'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x8')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x8')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller['getAgents']);router[_0xfef0('0x8')](_0xfef0('0x14'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x15')]);router[_0xfef0('0x16')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x17')]);router['post'](_0xfef0('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x18')]);router[_0xfef0('0x16')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x19')]);router[_0xfef0('0x16')]('/:id/applications',auth[_0xfef0('0x9')](),controller[_0xfef0('0x1a')]);router[_0xfef0('0x16')](_0xfef0('0x1b'),controller[_0xfef0('0x1c')]);router['post'](_0xfef0('0x1d'),auth['isAuthenticated'](),controller[_0xfef0('0x1e')]);router[_0xfef0('0x1f')](_0xfef0('0xd'),auth['isAuthenticated'](),controller[_0xfef0('0x20')]);router['delete'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xfef0('0x9')](),controller['removeDispositions']);router[_0xfef0('0x21')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x22')]);router[_0xfef0('0x21')](_0xfef0('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfef0('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 4e03235..a5a71da 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 _0xa6a3=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x3ca1f8,_0x4afa33){var _0x94fb6b=function(_0x10c639){while(--_0x10c639){_0x3ca1f8['push'](_0x3ca1f8['shift']());}};_0x94fb6b(++_0x4afa33);}(_0xa6a3,0x91));var _0x3a6a=function(_0x4dd71c,_0x23a24e){_0x4dd71c=_0x4dd71c-0x0;var _0x8e4e36=_0xa6a3[_0x4dd71c];return _0x8e4e36;};'use strict';var Sequelize=require(_0x3a6a('0x0'));var rs=require(_0x3a6a('0x1'));module[_0x3a6a('0x2')]={'name':{'type':Sequelize[_0x3a6a('0x3')],'unique':_0x3a6a('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3a6a('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3a6a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3a6a('0x3')],'defaultValue':function(){return rs[_0x3a6a('0x5')]();}},'phone':{'type':Sequelize[_0x3a6a('0x3')]},'type':{'type':Sequelize[_0x3a6a('0x6')](_0x3a6a('0x7'),_0x3a6a('0x8'))},'accountSid':{'type':Sequelize[_0x3a6a('0x3')]},'baseUrl':{'type':Sequelize[_0x3a6a('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3a6a('0x9')],'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['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3a6a('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3a6a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3a6a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3a6a('0xb')],'comment':_0x3a6a('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3a6a('0xd'),'set':function(_0x45ca2c){if(!_0x45ca2c){this['setDataValue'](_0x3a6a('0xe'),null);}this['setDataValue'](_0x3a6a('0xf'),_0x45ca2c);}},'description':{'type':Sequelize[_0x3a6a('0x3')]}}; \ No newline at end of file +var _0x0a52=['randomstring','exports','STRING','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x2bdca0,_0x157cab){var _0x56bce9=function(_0x57de61){while(--_0x57de61){_0x2bdca0['push'](_0x2bdca0['shift']());}};_0x56bce9(++_0x157cab);}(_0x0a52,0x19f));var _0x20a5=function(_0x1fe9d7,_0x174d5c){_0x1fe9d7=_0x1fe9d7-0x0;var _0x39442f=_0x0a52[_0x1fe9d7];return _0x39442f;};'use strict';var Sequelize=require(_0x20a5('0x0'));var rs=require(_0x20a5('0x1'));module[_0x20a5('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x20a5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x20a5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x20a5('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x20a5('0x4')]('twilio','sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x20a5('0x3')]},'authToken':{'type':Sequelize[_0x20a5('0x3')]},'notificationTemplate':{'type':Sequelize[_0x20a5('0x5')],'defaultValue':function(){return _0x20a5('0x6');}},'notificationSound':{'type':Sequelize[_0x20a5('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x20a5('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x20a5('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x20a5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x20a5('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20a5('0x8')],'comment':_0x20a5('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x20a5('0x7')],'defaultValue':![],'comment':_0x20a5('0xa'),'set':function(_0x12b8fe){if(!_0x12b8fe){this[_0x20a5('0xb')]('mandatoryDispositionPauseId',null);}this[_0x20a5('0xb')](_0x20a5('0xc'),_0x12b8fe);}},'description':{'type':Sequelize[_0x20a5('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 1f6309b..7077b70 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 _0xa428=['mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','unshift','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','get','WhatsappAccounts','destroy','stack','name','send','index','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','Disposition','getDispositions','removeDispositions','ids','addAnswer','WhatsappAccountId','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','User','sequelize','Transaction','READ_COMMITTED','findOne','bulkCreate','WhatsappApplication','priority','getApplications','notify','whatsapp','Applications','account','statuses','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','sinch','notifications','isNil','from\x20is\x20mandatory'];(function(_0x20352e,_0x1ee2ac){var _0x5a9319=function(_0x168ac4){while(--_0x168ac4){_0x20352e['push'](_0x20352e['shift']());}};_0x5a9319(++_0x1ee2ac);}(_0xa428,0x19e));var _0x8a42=function(_0x4854ff,_0x50dc49){_0x4854ff=_0x4854ff-0x0;var _0x1fc145=_0xa428[_0x4854ff];return _0x1fc145;};'use strict';var emlformat=require(_0x8a42('0x0'));var rimraf=require(_0x8a42('0x1'));var zipdir=require(_0x8a42('0x2'));var jsonpatch=require(_0x8a42('0x3'));var rp=require('request-promise');var moment=require(_0x8a42('0x4'));var BPromise=require(_0x8a42('0x5'));var Mustache=require(_0x8a42('0x6'));var util=require('util');var path=require(_0x8a42('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a42('0x8'));var _=require(_0x8a42('0x9'));var squel=require(_0x8a42('0xa'));var crypto=require(_0x8a42('0xb'));var jsforce=require(_0x8a42('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8a42('0xd'));var Redis=require(_0x8a42('0xe'));var authService=require(_0x8a42('0xf'));var qs=require(_0x8a42('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a42('0x11'));var logger=require(_0x8a42('0x12'))(_0x8a42('0x13'));var utils=require(_0x8a42('0x14'));var config=require(_0x8a42('0x15'));var licenseUtil=require(_0x8a42('0x16'));var db=require('../../mysqldb')['db'];config[_0x8a42('0x17')]=_['defaults'](config['redis'],{'host':_0x8a42('0x18'),'port':0x18eb});var socket=require(_0x8a42('0x19'))(new Redis(config[_0x8a42('0x17')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x8a42('0x1a'));var client=jayson[_0x8a42('0x1b')][_0x8a42('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5127e6,_0x595fc4,_0x3c8a7f,_0x26b97b){return new BPromise(function(_0x461d91,_0x385bd7){var _0x1c340e=_0x26b97b||client;return _0x1c340e['request'](_0x5127e6,_0x3c8a7f)[_0x8a42('0x1d')](function(_0x4a21d4){logger['info'](_0x8a42('0x1e'),_0x595fc4,_0x8a42('0x1f'));logger['debug'](_0x8a42('0x20'),_0x595fc4,_0x8a42('0x1f'),JSON[_0x8a42('0x21')](_0x4a21d4));if(_0x4a21d4[_0x8a42('0x22')]){if(_0x4a21d4[_0x8a42('0x22')][_0x8a42('0x23')]===0x1f4){logger[_0x8a42('0x22')](_0x8a42('0x1e'),_0x595fc4,_0x4a21d4[_0x8a42('0x22')][_0x8a42('0x24')]);return _0x385bd7(_0x4a21d4[_0x8a42('0x22')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x595fc4,_0x4a21d4[_0x8a42('0x22')]['message']);return _0x461d91(_0x4a21d4[_0x8a42('0x22')]['message']);}else{logger[_0x8a42('0x25')](_0x8a42('0x1e'),_0x595fc4,_0x8a42('0x1f'));_0x461d91(_0x4a21d4['result'][_0x8a42('0x24')]);}})[_0x8a42('0x26')](function(_0x42f969){logger[_0x8a42('0x22')](_0x8a42('0x1e'),_0x595fc4,_0x42f969);_0x385bd7(_0x42f969);});});}function respondWithStatusCode(_0x105ef3,_0xd855fa){_0xd855fa=_0xd855fa||0xcc;return function(_0x2cb9f5){if(_0x2cb9f5){return _0x105ef3[_0x8a42('0x27')](_0xd855fa);}return _0x105ef3[_0x8a42('0x28')](_0xd855fa)['end']();};}function respondWithResult(_0x38c8c4,_0x476cfc){_0x476cfc=_0x476cfc||0xc8;return function(_0x42f310){if(_0x42f310){return _0x38c8c4[_0x8a42('0x28')](_0x476cfc)[_0x8a42('0x29')](_0x42f310);}};}function respondWithFilteredResult(_0xf249eb,_0x40f510){return function(_0x4e08d5){if(_0x4e08d5){var _0x4db757=typeof _0x40f510['offset']===_0x8a42('0x2a')&&typeof _0x40f510[_0x8a42('0x2b')]==='undefined';var _0x21dfa6=_0x4e08d5[_0x8a42('0x2c')];var _0x3d9a77=_0x4db757?0x0:_0x40f510[_0x8a42('0x2d')];var _0xd438d7=_0x4db757?_0x4e08d5[_0x8a42('0x2c')]:_0x40f510[_0x8a42('0x2d')]+_0x40f510[_0x8a42('0x2b')];var _0x3f16c7;if(_0xd438d7>=_0x21dfa6){_0xd438d7=_0x21dfa6;_0x3f16c7=0xc8;}else{_0x3f16c7=0xce;}_0xf249eb[_0x8a42('0x28')](_0x3f16c7);return _0xf249eb[_0x8a42('0x2e')](_0x8a42('0x2f'),_0x3d9a77+'-'+_0xd438d7+'/'+_0x21dfa6)['json'](_0x4e08d5);}return null;};}function patchUpdates(_0x1753fb){return function(_0x1de740){try{jsonpatch['apply'](_0x1de740,_0x1753fb,!![]);}catch(_0x54082b){return BPromise[_0x8a42('0x30')](_0x54082b);}return _0x1de740[_0x8a42('0x31')]();};}function saveUpdates(_0x36867f,_0x31734b){return function(_0x28a041){if(_0x28a041){return _0x28a041[_0x8a42('0x32')](_0x36867f)[_0x8a42('0x1d')](function(_0x31d1a2){return _0x31d1a2;});}return null;};}function removeEntity(_0x4019b7,_0x991c44){return function(_0x3a9af7){if(_0x3a9af7){return _0x3a9af7['destroy']()[_0x8a42('0x1d')](function(){var _0x5de567=_0x3a9af7[_0x8a42('0x33')]({'plain':!![]});var _0x399830=_0x8a42('0x34');return db['UserProfileResource'][_0x8a42('0x35')]({'where':{'type':_0x399830,'resourceId':_0x5de567['id']}})[_0x8a42('0x1d')](function(){return _0x3a9af7;});})[_0x8a42('0x1d')](function(){_0x4019b7[_0x8a42('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24bbba,_0x24b790){return function(_0x8d344e){if(!_0x8d344e){_0x24bbba[_0x8a42('0x27')](0x194);}return _0x8d344e;};}function handleError(_0x3c2cb3,_0x3cd911){_0x3cd911=_0x3cd911||0x1f4;return function(_0x55c393){logger[_0x8a42('0x22')](_0x55c393[_0x8a42('0x36')]);if(_0x55c393[_0x8a42('0x37')]){delete _0x55c393[_0x8a42('0x37')];}_0x3c2cb3['status'](_0x3cd911)[_0x8a42('0x38')](_0x55c393);};}exports[_0x8a42('0x39')]=function(_0x5cfe99,_0x450c34){var _0x573695={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x57a1fd={},_0x9a34e4={'count':0x0,'rows':[]};var _0x23488e=_[_0x8a42('0x3a')](db[_0x8a42('0x3b')][_0x8a42('0x3c')],function(_0x4347a4){return{'name':_0x4347a4[_0x8a42('0x3d')],'type':_0x4347a4[_0x8a42('0x3e')][_0x8a42('0x3f')]};});_0x57a1fd[_0x8a42('0x40')]=_['map'](_0x23488e,_0x8a42('0x37'));_0x57a1fd[_0x8a42('0x41')]=_[_0x8a42('0x42')](_0x5cfe99['query']);_0x57a1fd['filters']=_[_0x8a42('0x43')](_0x57a1fd[_0x8a42('0x40')],_0x57a1fd[_0x8a42('0x41')]);_0x573695[_0x8a42('0x44')]=_[_0x8a42('0x43')](_0x57a1fd[_0x8a42('0x40')],qs[_0x8a42('0x45')](_0x5cfe99[_0x8a42('0x41')][_0x8a42('0x45')]));_0x573695[_0x8a42('0x44')]=_0x573695[_0x8a42('0x44')][_0x8a42('0x46')]?_0x573695[_0x8a42('0x44')]:_0x57a1fd[_0x8a42('0x40')];if(!_0x5cfe99['query'][_0x8a42('0x47')](_0x8a42('0x48'))){_0x573695['limit']=qs[_0x8a42('0x2b')](_0x5cfe99[_0x8a42('0x41')]['limit']);_0x573695['offset']=qs[_0x8a42('0x2d')](_0x5cfe99[_0x8a42('0x41')][_0x8a42('0x2d')]);}_0x573695[_0x8a42('0x49')]=qs[_0x8a42('0x4a')](_0x5cfe99[_0x8a42('0x41')][_0x8a42('0x4a')]);_0x573695[_0x8a42('0x4b')]=qs[_0x8a42('0x4c')](_[_0x8a42('0x4d')](_0x5cfe99[_0x8a42('0x41')],_0x57a1fd[_0x8a42('0x4c')]),_0x23488e);if(_0x5cfe99[_0x8a42('0x41')][_0x8a42('0x4e')]){_0x573695['where']=_['merge'](_0x573695[_0x8a42('0x4b')],{'$or':_[_0x8a42('0x3a')](_0x23488e,function(_0x42a753){if(_0x42a753['type']!==_0x8a42('0x4f')){var _0x3755c2={};_0x3755c2[_0x42a753[_0x8a42('0x37')]]={'$like':'%'+_0x5cfe99[_0x8a42('0x41')][_0x8a42('0x4e')]+'%'};return _0x3755c2;}})});}_0x573695=_[_0x8a42('0x50')]({},_0x573695,_0x5cfe99[_0x8a42('0x51')]);var _0x3ecf85={'where':_0x573695[_0x8a42('0x4b')]};return db['WhatsappAccount'][_0x8a42('0x2c')](_0x3ecf85)[_0x8a42('0x1d')](function(_0x2597ed){_0x9a34e4['count']=_0x2597ed;if(_0x5cfe99[_0x8a42('0x41')][_0x8a42('0x52')]){_0x573695[_0x8a42('0x53')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x8a42('0x54')](_0x573695);})[_0x8a42('0x1d')](function(_0x535743){_0x9a34e4[_0x8a42('0x55')]=_0x535743;return _0x9a34e4;})[_0x8a42('0x1d')](respondWithFilteredResult(_0x450c34,_0x573695))['catch'](handleError(_0x450c34,null));};exports[_0x8a42('0x56')]=function(_0x5adeb9,_0x13dd97){var _0xed4934={'raw':![],'where':{'id':_0x5adeb9[_0x8a42('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x15f6c9={};_0x15f6c9[_0x8a42('0x40')]=_[_0x8a42('0x42')](db['WhatsappAccount']['rawAttributes']);_0x15f6c9[_0x8a42('0x41')]=_['keys'](_0x5adeb9[_0x8a42('0x41')]);_0x15f6c9['filters']=_[_0x8a42('0x43')](_0x15f6c9['model'],_0x15f6c9[_0x8a42('0x41')]);_0xed4934['attributes']=_[_0x8a42('0x43')](_0x15f6c9['model'],qs[_0x8a42('0x45')](_0x5adeb9['query']['fields']));_0xed4934[_0x8a42('0x44')]=_0xed4934['attributes']['length']?_0xed4934['attributes']:_0x15f6c9[_0x8a42('0x40')];if(_0x5adeb9[_0x8a42('0x41')][_0x8a42('0x52')]){_0xed4934[_0x8a42('0x53')]=[{'all':!![]}];}_0xed4934=_[_0x8a42('0x50')]({},_0xed4934,_0x5adeb9[_0x8a42('0x51')]);return db[_0x8a42('0x3b')][_0x8a42('0x58')](_0xed4934)[_0x8a42('0x1d')](handleEntityNotFound(_0x13dd97,null))['then'](respondWithResult(_0x13dd97,null))['catch'](handleError(_0x13dd97,null));};exports[_0x8a42('0x59')]=function(_0x24b23c,_0x97455f){return db[_0x8a42('0x3b')][_0x8a42('0x59')](_0x24b23c[_0x8a42('0x5a')],{})[_0x8a42('0x1d')](function(_0xf8d099){var _0x5db239=_0x24b23c[_0x8a42('0x5b')][_0x8a42('0x33')]({'plain':!![]});if(!_0x5db239)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5db239[_0x8a42('0x5c')]===_0x8a42('0x5b')){var _0x25e093=_0xf8d099['get']({'plain':!![]});var _0x233dc9='WhatsappAccounts';return db[_0x8a42('0x5d')][_0x8a42('0x58')]({'where':{'name':_0x233dc9,'userProfileId':_0x5db239[_0x8a42('0x5e')]},'raw':!![]})[_0x8a42('0x1d')](function(_0x2903ed){if(_0x2903ed&&_0x2903ed['autoAssociation']===0x0){return db[_0x8a42('0x5f')][_0x8a42('0x59')]({'name':_0x25e093[_0x8a42('0x37')],'resourceId':_0x25e093['id'],'type':_0x2903ed[_0x8a42('0x37')],'sectionId':_0x2903ed['id']},{})[_0x8a42('0x1d')](function(){return _0xf8d099;});}else{return _0xf8d099;}})['catch'](function(_0x4bbdb2){logger[_0x8a42('0x22')](_0x8a42('0x60'),_0x4bbdb2);throw _0x4bbdb2;});}return _0xf8d099;})[_0x8a42('0x1d')](respondWithResult(_0x97455f,0xc9))[_0x8a42('0x26')](handleError(_0x97455f,null));};exports[_0x8a42('0x32')]=function(_0x40133b,_0xa40c92){if(_0x40133b[_0x8a42('0x5a')]['id']){delete _0x40133b[_0x8a42('0x5a')]['id'];}return db[_0x8a42('0x3b')][_0x8a42('0x58')]({'where':{'id':_0x40133b['params']['id']},'include':[{'model':db[_0x8a42('0x61')],'as':'mandatoryDispositionPause'}]})[_0x8a42('0x1d')](handleEntityNotFound(_0xa40c92,null))[_0x8a42('0x1d')](saveUpdates(_0x40133b[_0x8a42('0x5a')],null))['then'](respondWithResult(_0xa40c92,null))[_0x8a42('0x26')](handleError(_0xa40c92,null));};exports[_0x8a42('0x35')]=function(_0x260d4e,_0x471ba3){return db[_0x8a42('0x3b')][_0x8a42('0x58')]({'where':{'id':_0x260d4e[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x471ba3,null))[_0x8a42('0x1d')](removeEntity(_0x471ba3,null))[_0x8a42('0x26')](handleError(_0x471ba3,null));};exports[_0x8a42('0x62')]=function(_0x42fb3f,_0x58ae6f){return db[_0x8a42('0x3b')][_0x8a42('0x62')]()[_0x8a42('0x1d')](respondWithResult(_0x58ae6f,null))['catch'](handleError(_0x58ae6f,null));};exports[_0x8a42('0x63')]=function(_0x96eefc,_0x13f602,_0xd3edf5){if(_0x96eefc[_0x8a42('0x5a')]['id']){delete _0x96eefc[_0x8a42('0x5a')]['id'];}return db[_0x8a42('0x3b')]['find']({'where':{'id':_0x96eefc[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x13f602,null))[_0x8a42('0x1d')](function(_0x310894){if(_0x310894){_0x96eefc[_0x8a42('0x5a')]['WhatsappAccountId']=_0x310894['id'];return db[_0x8a42('0x64')][_0x8a42('0x59')](_0x96eefc[_0x8a42('0x5a')]);}})[_0x8a42('0x1d')](respondWithResult(_0x13f602,null))[_0x8a42('0x26')](handleError(_0x13f602,null));};exports[_0x8a42('0x65')]=function(_0xf44464,_0x5a9a84,_0x3bf75e){var _0x189767={'raw':![],'where':{}};var _0x54e199={};var _0x5a6c55={'count':0x0,'rows':[]};return db[_0x8a42('0x3b')]['findOne']({'where':{'id':_0xf44464[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x5a9a84,null))[_0x8a42('0x1d')](function(_0xe2bfc6){if(_0xe2bfc6){_0x54e199[_0x8a42('0x40')]=_[_0x8a42('0x42')](db[_0x8a42('0x64')][_0x8a42('0x3c')]);_0x54e199['query']=_['keys'](_0xf44464[_0x8a42('0x41')]);_0x54e199[_0x8a42('0x4c')]=_[_0x8a42('0x43')](_0x54e199['model'],_0x54e199[_0x8a42('0x41')]);_0x189767[_0x8a42('0x44')]=_[_0x8a42('0x43')](_0x54e199[_0x8a42('0x40')],qs[_0x8a42('0x45')](_0xf44464[_0x8a42('0x41')]['fields']));_0x189767['attributes']=_0x189767[_0x8a42('0x44')][_0x8a42('0x46')]?_0x189767[_0x8a42('0x44')]:_0x54e199[_0x8a42('0x40')];if(!_0xf44464[_0x8a42('0x41')][_0x8a42('0x47')](_0x8a42('0x48'))){_0x189767[_0x8a42('0x2b')]=qs[_0x8a42('0x2b')](_0xf44464[_0x8a42('0x41')][_0x8a42('0x2b')]);_0x189767[_0x8a42('0x2d')]=qs[_0x8a42('0x2d')](_0xf44464[_0x8a42('0x41')][_0x8a42('0x2d')]);}_0x189767[_0x8a42('0x49')]=qs[_0x8a42('0x4a')](_0xf44464[_0x8a42('0x41')]['sort']);_0x189767['where']=qs[_0x8a42('0x4c')](_[_0x8a42('0x4d')](_0xf44464['query'],_0x54e199['filters']));_0x189767[_0x8a42('0x4b')]['WhatsappAccountId']=_0xe2bfc6['id'];if(_0xf44464[_0x8a42('0x41')][_0x8a42('0x4e')]){_0x189767[_0x8a42('0x4b')]=_[_0x8a42('0x50')](_0x189767[_0x8a42('0x4b')],{'$or':_['map'](_0x189767[_0x8a42('0x44')],function(_0x4defba){var _0x159a60={};_0x159a60[_0x4defba]={'$like':'%'+_0xf44464['query'][_0x8a42('0x4e')]+'%'};return _0x159a60;})});}_0x189767=_['merge']({},_0x189767,_0xf44464['options']);return db[_0x8a42('0x64')][_0x8a42('0x2c')]({'where':_0x189767[_0x8a42('0x4b')]})['then'](function(_0x342b32){_0x5a6c55[_0x8a42('0x2c')]=_0x342b32;if(_0xf44464[_0x8a42('0x41')]['includeAll']){_0x189767[_0x8a42('0x53')]=[{'all':!![]}];}return db[_0x8a42('0x64')][_0x8a42('0x54')](_0x189767);})[_0x8a42('0x1d')](function(_0x5a1f02){_0x5a6c55[_0x8a42('0x55')]=_0x5a1f02;return _0x5a6c55;});}})[_0x8a42('0x1d')](respondWithFilteredResult(_0x5a9a84,_0x189767))[_0x8a42('0x26')](handleError(_0x5a9a84,null));};exports[_0x8a42('0x66')]=function(_0x34eda0,_0x4d11bc,_0x5bcf3){return db[_0x8a42('0x3b')][_0x8a42('0x58')]({'where':{'id':_0x34eda0[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x4d11bc,null))[_0x8a42('0x1d')](function(_0x42c8f5){if(_0x42c8f5){return _0x42c8f5[_0x8a42('0x66')](_0x34eda0[_0x8a42('0x41')][_0x8a42('0x67')]);}})[_0x8a42('0x1d')](respondWithStatusCode(_0x4d11bc,null))[_0x8a42('0x26')](handleError(_0x4d11bc,null));};exports[_0x8a42('0x68')]=function(_0x5b9fae,_0x4a9b97,_0x11cba4){if(_0x5b9fae['body']['id']){delete _0x5b9fae[_0x8a42('0x5a')]['id'];}return db['WhatsappAccount'][_0x8a42('0x58')]({'where':{'id':_0x5b9fae[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x4a9b97,null))[_0x8a42('0x1d')](function(_0x333ad8){if(_0x333ad8){_0x5b9fae[_0x8a42('0x5a')][_0x8a42('0x69')]=_0x333ad8['id'];return db[_0x8a42('0x6a')]['create'](_0x5b9fae[_0x8a42('0x5a')]);}})[_0x8a42('0x1d')](respondWithResult(_0x4a9b97,null))[_0x8a42('0x26')](handleError(_0x4a9b97,null));};exports[_0x8a42('0x6b')]=function(_0x5452ce,_0x765dcb,_0x4a59e0){var _0x2cc31a={'raw':![],'where':{}};var _0x33e2a5={};var _0x5babf6={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5452ce[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x765dcb,null))['then'](function(_0x27b787){if(_0x27b787){_0x33e2a5[_0x8a42('0x40')]=_['keys'](db['CannedAnswer'][_0x8a42('0x3c')]);_0x33e2a5['query']=_[_0x8a42('0x42')](_0x5452ce['query']);_0x33e2a5['filters']=_['intersection'](_0x33e2a5[_0x8a42('0x40')],_0x33e2a5[_0x8a42('0x41')]);_0x2cc31a[_0x8a42('0x44')]=_[_0x8a42('0x43')](_0x33e2a5[_0x8a42('0x40')],qs['fields'](_0x5452ce['query'][_0x8a42('0x45')]));_0x2cc31a[_0x8a42('0x44')]=_0x2cc31a[_0x8a42('0x44')]['length']?_0x2cc31a['attributes']:_0x33e2a5[_0x8a42('0x40')];if(!_0x5452ce[_0x8a42('0x41')][_0x8a42('0x47')](_0x8a42('0x48'))){_0x2cc31a[_0x8a42('0x2b')]=qs[_0x8a42('0x2b')](_0x5452ce[_0x8a42('0x41')][_0x8a42('0x2b')]);_0x2cc31a[_0x8a42('0x2d')]=qs[_0x8a42('0x2d')](_0x5452ce[_0x8a42('0x41')][_0x8a42('0x2d')]);}_0x2cc31a[_0x8a42('0x49')]=qs[_0x8a42('0x4a')](_0x5452ce[_0x8a42('0x41')][_0x8a42('0x4a')]);_0x2cc31a[_0x8a42('0x4b')]=qs[_0x8a42('0x4c')](_[_0x8a42('0x4d')](_0x5452ce['query'],_0x33e2a5['filters']));_0x2cc31a[_0x8a42('0x4b')][_0x8a42('0x69')]=_0x27b787['id'];if(_0x5452ce[_0x8a42('0x41')][_0x8a42('0x4e')]){_0x2cc31a[_0x8a42('0x4b')]=_['merge'](_0x2cc31a[_0x8a42('0x4b')],{'$or':_[_0x8a42('0x3a')](_0x2cc31a['attributes'],function(_0x51f4c2){var _0x1fc50c={};_0x1fc50c[_0x51f4c2]={'$like':'%'+_0x5452ce[_0x8a42('0x41')][_0x8a42('0x4e')]+'%'};return _0x1fc50c;})});}_0x2cc31a=_[_0x8a42('0x50')]({},_0x2cc31a,_0x5452ce['options']);return db['CannedAnswer']['count']({'where':_0x2cc31a[_0x8a42('0x4b')]})['then'](function(_0x20b797){_0x5babf6['count']=_0x20b797;if(_0x5452ce['query']['includeAll']){_0x2cc31a[_0x8a42('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8a42('0x54')](_0x2cc31a);})[_0x8a42('0x1d')](function(_0x238003){_0x5babf6[_0x8a42('0x55')]=_0x238003;return _0x5babf6;});}})[_0x8a42('0x1d')](respondWithFilteredResult(_0x765dcb,_0x2cc31a))[_0x8a42('0x26')](handleError(_0x765dcb,null));};exports['removeAnswers']=function(_0x37988e,_0x1ba2ed,_0x46c283){return db[_0x8a42('0x3b')][_0x8a42('0x58')]({'where':{'id':_0x37988e['params']['id']}})['then'](handleEntityNotFound(_0x1ba2ed,null))['then'](function(_0x21a8b1){if(_0x21a8b1){return _0x21a8b1[_0x8a42('0x6c')](_0x37988e['query'][_0x8a42('0x67')]);}})[_0x8a42('0x1d')](respondWithStatusCode(_0x1ba2ed,null))[_0x8a42('0x26')](handleError(_0x1ba2ed,null));};exports[_0x8a42('0x6d')]=function(_0x3d8125,_0x373faf,_0xe24313){return db[_0x8a42('0x3b')][_0x8a42('0x58')]({'where':{'id':_0x3d8125[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x373faf,null))[_0x8a42('0x1d')](function(_0x587ee7){if(_0x587ee7){return _0x587ee7['addAgents'](_0x3d8125[_0x8a42('0x5a')][_0x8a42('0x67')],_[_0x8a42('0x6e')](_0x3d8125[_0x8a42('0x5a')],[_0x8a42('0x67'),'id'])||{})['spread'](function(_0x2b7f07){for(var _0x5bd059=0x0;_0x5bd059<_0x3d8125[_0x8a42('0x5a')][_0x8a42('0x67')][_0x8a42('0x46')];_0x5bd059+=0x1){socket['emit'](_0x8a42('0x6f'),{'UserId':Number(_0x3d8125[_0x8a42('0x5a')]['ids'][_0x5bd059]),'WhatsappAccountId':Number(_0x3d8125['params']['id'])});}return _0x2b7f07;});}})[_0x8a42('0x1d')](respondWithResult(_0x373faf,null))[_0x8a42('0x26')](handleError(_0x373faf,null));};exports['removeAgents']=function(_0x32a832,_0x48fd9a,_0x97ca77){return db[_0x8a42('0x3b')][_0x8a42('0x58')]({'where':{'id':_0x32a832[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x48fd9a,null))['then'](function(_0x5a59f9){if(_0x5a59f9){return _0x5a59f9[_0x8a42('0x70')](_0x32a832['query'][_0x8a42('0x67')])[_0x8a42('0x1d')](function(){if(_['isArray'](_0x32a832['query'][_0x8a42('0x67')])){for(var _0xd1a637=0x0;_0xd1a637<_0x32a832[_0x8a42('0x41')][_0x8a42('0x67')][_0x8a42('0x46')];_0xd1a637+=0x1){socket[_0x8a42('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x32a832[_0x8a42('0x41')][_0x8a42('0x67')][_0xd1a637]),'WhatsappAccountId':Number(_0x32a832[_0x8a42('0x57')]['id'])});}}else{socket['emit'](_0x8a42('0x72'),{'UserId':Number(_0x32a832[_0x8a42('0x41')][_0x8a42('0x67')]),'WhatsappAccountId':Number(_0x32a832[_0x8a42('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x48fd9a,null))[_0x8a42('0x26')](handleError(_0x48fd9a,null));};exports[_0x8a42('0x73')]=function(_0x5c6140,_0x452c67,_0x3e9bd2){var _0x226fb0={};var _0x425c43={};var _0x55b43a;var _0x202d41;return db[_0x8a42('0x3b')]['findOne']({'where':{'id':_0x5c6140[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x452c67,null))[_0x8a42('0x1d')](function(_0x12f700){if(_0x12f700){_0x55b43a=_0x12f700;_0x425c43[_0x8a42('0x40')]=_[_0x8a42('0x42')](db[_0x8a42('0x74')][_0x8a42('0x3c')]);_0x425c43[_0x8a42('0x41')]=_[_0x8a42('0x42')](_0x5c6140['query']);_0x425c43[_0x8a42('0x4c')]=_['intersection'](_0x425c43[_0x8a42('0x40')],_0x425c43[_0x8a42('0x41')]);_0x226fb0[_0x8a42('0x44')]=_[_0x8a42('0x43')](_0x425c43[_0x8a42('0x40')],qs[_0x8a42('0x45')](_0x5c6140[_0x8a42('0x41')][_0x8a42('0x45')]));_0x226fb0[_0x8a42('0x44')]=_0x226fb0[_0x8a42('0x44')][_0x8a42('0x46')]?_0x226fb0[_0x8a42('0x44')]:_0x425c43[_0x8a42('0x40')];_0x226fb0[_0x8a42('0x49')]=qs[_0x8a42('0x4a')](_0x5c6140[_0x8a42('0x41')]['sort']);_0x226fb0[_0x8a42('0x4b')]=qs['filters'](_[_0x8a42('0x4d')](_0x5c6140[_0x8a42('0x41')],_0x425c43[_0x8a42('0x4c')]));if(_0x5c6140['query'][_0x8a42('0x4e')]){_0x226fb0[_0x8a42('0x4b')]=_[_0x8a42('0x50')](_0x226fb0[_0x8a42('0x4b')],{'$or':_[_0x8a42('0x3a')](_0x226fb0[_0x8a42('0x44')],function(_0xe3a0c2){var _0x52ce52={};_0x52ce52[_0xe3a0c2]={'$like':'%'+_0x5c6140['query'][_0x8a42('0x4e')]+'%'};return _0x52ce52;})});}_0x226fb0=_[_0x8a42('0x50')]({},_0x226fb0,_0x5c6140['options']);return _0x55b43a[_0x8a42('0x73')](_0x226fb0);}})[_0x8a42('0x1d')](function(_0x336b5e){if(_0x336b5e){_0x202d41=_0x336b5e['length'];if(!_0x5c6140[_0x8a42('0x41')][_0x8a42('0x47')](_0x8a42('0x48'))){_0x226fb0[_0x8a42('0x2b')]=qs[_0x8a42('0x2b')](_0x5c6140['query'][_0x8a42('0x2b')]);_0x226fb0[_0x8a42('0x2d')]=qs[_0x8a42('0x2d')](_0x5c6140[_0x8a42('0x41')]['offset']);}return _0x55b43a[_0x8a42('0x73')](_0x226fb0);}})[_0x8a42('0x1d')](function(_0x343b67){if(_0x343b67){return _0x343b67?{'count':_0x202d41,'rows':_0x343b67}:null;}})[_0x8a42('0x1d')](respondWithResult(_0x452c67,null))[_0x8a42('0x26')](handleError(_0x452c67,null));};exports['addApplications']=function(_0x12cc91,_0xe3cbf5){var _0x2773e6=_0x12cc91[_0x8a42('0x57')]['id'];var _0x40cbab=_0x12cc91[_0x8a42('0x5a')];var _0x1886a0=0xc8;var _0x3fccc2=null;return db[_0x8a42('0x75')]['transaction']({'isolationLevel':db[_0x8a42('0x75')][_0x8a42('0x76')]['ISOLATION_LEVELS'][_0x8a42('0x77')]},function(_0x5c4bbd){return db[_0x8a42('0x3b')][_0x8a42('0x78')]({'where':{'id':_0x2773e6},'transaction':_0x5c4bbd})[_0x8a42('0x1d')](function(_0x16c896){if(_0x16c896){return db['WhatsappApplication'][_0x8a42('0x35')]({'where':{'WhatsappAccountId':_0x2773e6},'transaction':_0x5c4bbd})[_0x8a42('0x1d')](function(){var _0x2989bd=_[_0x8a42('0x3a')](_0x40cbab,function(_0x422ef9){_0x422ef9[_0x8a42('0x69')]=_0x2773e6;return _0x422ef9;});return db['WhatsappApplication'][_0x8a42('0x79')](_0x2989bd,{'transaction':_0x5c4bbd});});}else{_0x1886a0=0x194;_0x3fccc2=[];}});})[_0x8a42('0x1d')](function(){if(_0x1886a0!==0x194){return db[_0x8a42('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2773e6},'order':_0x8a42('0x7b')})[_0x8a42('0x1d')](function(_0x244cd0){_0x3fccc2=_0x244cd0;});}})[_0x8a42('0x26')](function(_0x3a673f){_0x1886a0=0x1f4;logger[_0x8a42('0x22')](_0x3a673f[_0x8a42('0x36')]);if(_0x3a673f[_0x8a42('0x37')]){delete _0x3a673f[_0x8a42('0x37')];}_0x3fccc2=_0x3a673f;})['finally'](function(){if(_0x3fccc2===null){_0xe3cbf5[_0x8a42('0x27')](_0x1886a0);}else{if(_0x1886a0===0x1f4){_0xe3cbf5[_0x8a42('0x28')](_0x1886a0)[_0x8a42('0x38')](_0x3fccc2);}else{_0xe3cbf5[_0x8a42('0x28')](_0x1886a0)[_0x8a42('0x29')](_0x3fccc2);}}});};exports['getApplications']=function(_0x40d180,_0x59e846,_0x2c4cbe){var _0x38c0c4={};var _0x40e3e0={};var _0x484c6c;var _0x3a8d71;return db[_0x8a42('0x3b')][_0x8a42('0x78')]({'where':{'id':_0x40d180[_0x8a42('0x57')]['id']}})[_0x8a42('0x1d')](handleEntityNotFound(_0x59e846,null))[_0x8a42('0x1d')](function(_0xb823e2){if(_0xb823e2){_0x484c6c=_0xb823e2;_0x40e3e0['model']=_['keys'](db[_0x8a42('0x7a')][_0x8a42('0x3c')]);_0x40e3e0['query']=_[_0x8a42('0x42')](_0x40d180[_0x8a42('0x41')]);_0x40e3e0[_0x8a42('0x4c')]=_[_0x8a42('0x43')](_0x40e3e0[_0x8a42('0x40')],_0x40e3e0['query']);_0x38c0c4['attributes']=_['intersection'](_0x40e3e0[_0x8a42('0x40')],qs[_0x8a42('0x45')](_0x40d180[_0x8a42('0x41')]['fields']));_0x38c0c4[_0x8a42('0x44')]=_0x38c0c4[_0x8a42('0x44')][_0x8a42('0x46')]?_0x38c0c4[_0x8a42('0x44')]:_0x40e3e0[_0x8a42('0x40')];_0x38c0c4['order']=qs['sort'](_0x40d180['query'][_0x8a42('0x4a')]);_0x38c0c4['where']=qs[_0x8a42('0x4c')](_[_0x8a42('0x4d')](_0x40d180[_0x8a42('0x41')],_0x40e3e0[_0x8a42('0x4c')]));if(_0x40d180['query'][_0x8a42('0x4e')]){_0x38c0c4['where']=_[_0x8a42('0x50')](_0x38c0c4[_0x8a42('0x4b')],{'$or':_[_0x8a42('0x3a')](_0x38c0c4[_0x8a42('0x44')],function(_0x265843){var _0x3d790f={};_0x3d790f[_0x265843]={'$like':'%'+_0x40d180[_0x8a42('0x41')][_0x8a42('0x4e')]+'%'};return _0x3d790f;})});}_0x38c0c4=_['merge']({},_0x38c0c4,_0x40d180[_0x8a42('0x51')]);return _0x484c6c['getApplications'](_0x38c0c4);}})[_0x8a42('0x1d')](function(_0x23cbcf){if(_0x23cbcf){_0x3a8d71=_0x23cbcf[_0x8a42('0x46')];if(!_0x40d180['query'][_0x8a42('0x47')](_0x8a42('0x48'))){_0x38c0c4['limit']=qs[_0x8a42('0x2b')](_0x40d180['query'][_0x8a42('0x2b')]);_0x38c0c4[_0x8a42('0x2d')]=qs[_0x8a42('0x2d')](_0x40d180[_0x8a42('0x41')][_0x8a42('0x2d')]);}return _0x484c6c[_0x8a42('0x7c')](_0x38c0c4);}})['then'](function(_0x1c4ada){if(_0x1c4ada){return _0x1c4ada?{'count':_0x3a8d71,'rows':_0x1c4ada}:null;}})[_0x8a42('0x1d')](respondWithResult(_0x59e846,null))[_0x8a42('0x26')](handleError(_0x59e846,null));};exports[_0x8a42('0x7d')]=function(_0x54c79c,_0x56aebb,_0x10c95e){var _0x42d074={'channel':_0x8a42('0x7e')};var _0x41a5d0=[];var _0x5d419b=[];var _0x112ffb={};return db[_0x8a42('0x3b')][_0x8a42('0x58')]({'where':{'id':_0x54c79c[_0x8a42('0x57')]['id']},'include':[{'model':db[_0x8a42('0x7a')],'as':_0x8a42('0x7f')}]})[_0x8a42('0x1d')](handleEntityNotFound(_0x56aebb,null))['then'](function(_0x2540fd){_0x42d074['account']=_0x2540fd;if(_0x42d074['account']&&_0x42d074[_0x8a42('0x80')]['type']==='sinch'&&_0x54c79c[_0x8a42('0x5a')][_0x8a42('0x81')]){if(_0x54c79c[_0x8a42('0x5a')]['statuses']['length']===0x0)return;if(_0x54c79c[_0x8a42('0x5a')][_0x8a42('0x81')][0x0]['state']!==_0x8a42('0x82'))return;return db[_0x8a42('0x83')][_0x8a42('0x32')]({'read':!![],'readAt':_0x54c79c['body'][_0x8a42('0x81')][0x0][_0x8a42('0x84')]},{'where':{'messageId':_0x54c79c[_0x8a42('0x5a')][_0x8a42('0x81')][0x0][_0x8a42('0x85')]},'individualHooks':!![]})[_0x8a42('0x1d')](function(_0x2f0f08){return _0x56aebb[_0x8a42('0x28')](0xc8)[_0x8a42('0x29')](_0x2f0f08);});}_0x42d074[_0x8a42('0x86')]=_['orderBy'](_0x2540fd[_0x8a42('0x7f')],['priority'],[_0x8a42('0x87')]);if(_0x42d074[_0x8a42('0x80')][_0x8a42('0x7f')]){delete _0x42d074[_0x8a42('0x80')][_0x8a42('0x7f')];}return db[_0x8a42('0x88')]['describe']()[_0x8a42('0x1d')](function(_0x496073){if(!_0x496073){throw new db[(_0x8a42('0x89'))][(_0x8a42('0x8a'))]('no\x20available\x20attributes');}_0x41a5d0=_['difference'](_['keys'](_0x496073),[_0x8a42('0x8b'),_0x8a42('0x8c')]);_0x5d419b=_[_0x8a42('0x8d')](_[_0x8a42('0x42')](_0x496073),[_0x8a42('0x8b'),_0x8a42('0x8c'),_0x8a42('0x8e'),'ListId']);_0x42d074[_0x8a42('0x5a')]={'mapKey':_0x8a42('0x8f')};if(_0x42d074['account']&&_0x42d074[_0x8a42('0x80')][_0x8a42('0x3e')]===_0x8a42('0x90')){_0x42d074['body'][_0x8a42('0x91')]=_0x54c79c['body'][_0x8a42('0x92')][_0x8a42('0x93')](_0x8a42('0x94'),'');_0x42d074[_0x8a42('0x5a')]['body']=_0x54c79c['body'][_0x8a42('0x95')];_0x42d074[_0x8a42('0x5a')][_0x8a42('0x96')]=_0x54c79c['body'][_0x8a42('0x97')];}if(_0x42d074[_0x8a42('0x80')]&&_0x42d074[_0x8a42('0x80')]['type']===_0x8a42('0x98')){_0x42d074[_0x8a42('0x5a')]['from']=_0x54c79c[_0x8a42('0x5a')][_0x8a42('0x99')][0x0][_0x8a42('0x91')];_0x42d074['body'][_0x8a42('0x5a')]=_0x54c79c[_0x8a42('0x5a')][_0x8a42('0x99')][0x0][_0x8a42('0x24')][_0x8a42('0x5a')];_0x42d074[_0x8a42('0x5a')]['messageId']=_0x54c79c[_0x8a42('0x5a')]['notifications'][0x0][_0x8a42('0x85')];}if(_0x42d074['body']['id']){delete _0x42d074[_0x8a42('0x5a')]['id'];}if(_[_0x8a42('0x9a')](_0x42d074[_0x8a42('0x5a')]['from'])){throw new db[(_0x8a42('0x89'))][(_0x8a42('0x8a'))](_0x8a42('0x9b'));}if(_[_0x8a42('0x9a')](_0x42d074[_0x8a42('0x5a')][_0x8a42('0x5a')])||_0x42d074[_0x8a42('0x5a')][_0x8a42('0x5a')]===''){throw new db[(_0x8a42('0x89'))][(_0x8a42('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8a42('0x9a')](_0x42d074[_0x8a42('0x5a')][_0x8a42('0x9c')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d419b);}if(!_[_0x8a42('0x9d')](_0x5d419b,_0x42d074[_0x8a42('0x5a')][_0x8a42('0x9c')])){throw new db[(_0x8a42('0x89'))][(_0x8a42('0x8a'))](_0x8a42('0x9e')+_0x5d419b);}_0x112ffb[_0x42d074[_0x8a42('0x5a')][_0x8a42('0x9c')]]=_0x42d074[_0x8a42('0x5a')][_0x8a42('0x91')];return db[_0x8a42('0x9f')]['find']({'where':{'id':_0x42d074[_0x8a42('0x80')]['ListId']},'include':[{'model':db[_0x8a42('0x88')],'as':_0x8a42('0xa0'),'where':_0x112ffb,'limit':0x1,'order':[[_0x8a42('0x8c'),_0x8a42('0xa1')]]}]});})['then'](handleEntityNotFound(_0x56aebb,null))[_0x8a42('0x1d')](function(_0x51e759){if(_0x51e759){_0x42d074[_0x8a42('0xa2')]=_[_0x8a42('0x6e')](_0x51e759,[_0x8a42('0xa0')]);if(_0x51e759['Contacts'][_0x8a42('0x46')]){return _0x51e759[_0x8a42('0xa0')][0x0];}var _0x294697=_['defaults'](_0x42d074[_0x8a42('0x5a')],{'firstName':_0x42d074[_0x8a42('0x5a')]['from'],'ListId':_0x51e759['id']});_0x294697[_0x42d074[_0x8a42('0x5a')][_0x8a42('0x9c')]]=_0x42d074['body'][_0x8a42('0x91')];return db[_0x8a42('0x88')]['create'](_0x294697,{'fields':_0x41a5d0,'raw':!![]});}})['then'](handleEntityNotFound(_0x56aebb,null))['then'](function(_0x2748b5){if(_0x2748b5){_0x42d074[_0x8a42('0xa3')]=_0x2748b5;var _0x4b2fe9={'ContactId':_0x2748b5['id'],'phone':_0x42d074[_0x8a42('0x5a')][_0x8a42('0x91')],'WhatsappAccountId':_0x54c79c[_0x8a42('0x57')]['id']};var _0x4ba83f={'ContactId':_0x2748b5['id'],'WhatsappAccountId':_0x54c79c[_0x8a42('0x57')]['id'],'closed':![]};return db[_0x8a42('0xa4')][_0x8a42('0x58')]({'where':_0x4ba83f})[_0x8a42('0x1d')](function(_0x43ef0f){if(_0x43ef0f){return[_0x43ef0f,![]];}return db[_0x8a42('0xa4')][_0x8a42('0x59')](_0x4b2fe9)[_0x8a42('0x1d')](function(_0x1c293a){return[_0x1c293a,!![]];});});}})[_0x8a42('0xa5')](function(_0x496852,_0x205a6d){_0x42d074[_0x8a42('0xa6')]=_0x496852[_0x8a42('0x33')]({'plain':!![]});_0x42d074[_0x8a42('0xa6')]['created']=![];if(_0x205a6d){if(_0x42d074[_0x8a42('0x80')]['autoclose']){_0x42d074[_0x8a42('0x86')][_0x8a42('0xa7')]({'id':0x0,'priority':_0x42d074['applications'][_0x8a42('0x46')]+0x1,'app':_0x8a42('0xa8'),'appdata':_0x8a42('0xa9'),'interval':_0x8a42('0xaa')});}_0x42d074[_0x8a42('0xa6')][_0x8a42('0xab')]=!![];}return db['WhatsappMessage'][_0x8a42('0x59')]({'phone':_0x42d074[_0x8a42('0x5a')]['from'],'messageId':_0x42d074[_0x8a42('0x5a')][_0x8a42('0x96')],'body':_0x42d074[_0x8a42('0x5a')]['body'],'WhatsappAccountId':_0x54c79c[_0x8a42('0x57')]['id'],'WhatsappInteractionId':_0x496852['id'],'direction':'in','ContactId':_0x496852[_0x8a42('0xac')],'AttachmentId':_0x42d074[_0x8a42('0x5a')][_0x8a42('0xad')]});})[_0x8a42('0x1d')](function(_0x2bad2f){_0x42d074[_0x8a42('0x24')]=_0x2bad2f;if(_0x42d074[_0x8a42('0xa6')]['UserId']){return db['User'][_0x8a42('0x58')]({'attributes':['id',_0x8a42('0x37')],'where':{'id':_0x42d074[_0x8a42('0xa6')]['UserId']}})[_0x8a42('0x1d')](function(_0x56dc7e){if(_0x56dc7e){_0x42d074['applications'][_0x8a42('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x56dc7e[_0x8a42('0x37')]+','+(_0x42d074[_0x8a42('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0x8a42('0xaa')});}return respondWithRpcPromise('Start','startRouting',_0x42d074);});}return respondWithRpcPromise(_0x8a42('0xaf'),_0x8a42('0xb0'),_0x42d074);})[_0x8a42('0x1d')](function(_0x29e6fa){if(_0x29e6fa){var _0x2821f4=0xc8;var _0x324d37=_0x8a42('0xb1');logger[_0x8a42('0x25')](_0x8a42('0x20'),_0x324d37,_0x2821f4,_0x8a42('0xb2'));logger[_0x8a42('0xb3')](_0x8a42('0xb4'),_0x324d37,_0x2821f4,'entity\x20found',JSON['stringify'](_0x29e6fa));if(_0x42d074[_0x8a42('0x80')]['type']===_0x8a42('0x90')){return _0x56aebb[_0x8a42('0x28')](_0x2821f4)[_0x8a42('0x2e')]('Content-Type',_0x8a42('0xb5'))[_0x8a42('0x38')](_0x8a42('0xb6'));}else{return _0x56aebb[_0x8a42('0x28')](_0x2821f4)[_0x8a42('0x29')](_0x29e6fa);}}});})[_0x8a42('0x26')](handleError(_0x56aebb,null));};exports['send']=function(_0xd20a46,_0x2532f4,_0x47fedc){var _0x5c613b,_0x20b71c,_0x2c56b0;if(_[_0x8a42('0x9a')](_0xd20a46['body'][_0x8a42('0x5a')])||_0xd20a46['body']['body']===''){throw new db[(_0x8a42('0x89'))]['ValidationError'](_0x8a42('0xb7'));}if(_[_0x8a42('0x9a')](_0xd20a46[_0x8a42('0x5a')]['to'])){throw new db['Sequelize'][(_0x8a42('0x8a'))](_0x8a42('0xb8'));}_0x5c613b=_0xd20a46[_0x8a42('0x5a')]['to'];return db[_0x8a42('0x3b')][_0x8a42('0x58')]({'where':{'id':_0xd20a46['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8a42('0x88')],'as':'Contacts','where':{'mobile':_0x5c613b},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x8a42('0x1d')](handleEntityNotFound(_0x2532f4,null))[_0x8a42('0x1d')](function(_0x29f3b0){if(_0x29f3b0&&_0x29f3b0['List']){_0x20b71c=_0x29f3b0[_0x8a42('0x33')]({'plain':!![]});if(_0x20b71c[_0x8a42('0xb9')]&&_0x20b71c[_0x8a42('0xb9')][_0x8a42('0xa0')]['length']){return _0x20b71c[_0x8a42('0xb9')][_0x8a42('0xa0')][0x0];}return db['CmContact'][_0x8a42('0x59')](_[_0x8a42('0xba')](_0xd20a46[_0x8a42('0x5a')],{'firstName':_0x5c613b,'mobile':_0x5c613b,'phone':_0x5c613b,'ListId':_0x20b71c['ListId']}));}})['then'](handleEntityNotFound(_0x2532f4,null))[_0x8a42('0x1d')](function(_0x437da9){if(_0x437da9){_0x2c56b0=_0x437da9;return db[_0x8a42('0xa4')][_0x8a42('0x58')]({'where':{'ContactId':_0x2c56b0['id'],'closed':![],'WhatsappAccountId':_0x20b71c['id']}})[_0x8a42('0x1d')](function(_0x1e0a5e){if(_0x1e0a5e){return[_0x1e0a5e,![]];}return db['WhatsappInteraction'][_0x8a42('0x59')]({'UserId':_0xd20a46['user']['id'],'ContactId':_0x2c56b0['id'],'WhatsappAccountId':_0x20b71c['id'],'phone':_0x5c613b,'firstMsgDirection':_0x8a42('0xbb'),'Messages':[_['merge'](_0xd20a46[_0x8a42('0x5a')],{'read':![],'body':_0xd20a46[_0x8a42('0x5a')][_0x8a42('0x5a')],'phone':_0x5c613b,'WhatsappAccountId':_0x20b71c['id'],'UserId':_0xd20a46[_0x8a42('0x5b')]['id'],'ContactId':_0x2c56b0['id']})]},{'include':[{'model':db[_0x8a42('0x83')],'as':_0x8a42('0xbc')}]})[_0x8a42('0x1d')](function(_0x513506){return[_0x513506,!![]];});});}})[_0x8a42('0xa5')](function(_0x4d02a8,_0x2609e1){if(_0x2609e1){return _0x4d02a8;}return db['WhatsappMessage'][_0x8a42('0x59')](_['merge'](_0xd20a46[_0x8a42('0x5a')],{'read':![],'body':_0xd20a46['body'][_0x8a42('0x5a')],'phone':_0x5c613b,'WhatsappAccountId':_0x20b71c['id'],'WhatsappInteractionId':_0x4d02a8['id'],'UserId':_0xd20a46[_0x8a42('0x5b')]['id'],'ContactId':_0x2c56b0['id']}))[_0x8a42('0x1d')](function(_0x43f07f){_0x4d02a8[_0x8a42('0xbd')][_0x8a42('0xbc')]=[];_0x4d02a8['dataValues']['Messages'][_0x8a42('0xa7')](_0x43f07f[_0x8a42('0xbd')]);return _0x4d02a8;});})[_0x8a42('0x1d')](respondWithResult(_0x2532f4,null))[_0x8a42('0x26')](handleError(_0x2532f4,null));}; \ No newline at end of file +var _0x997f=['./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','mandatoryDispositionPause','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','replace','whatsapp:','Body','MessageSid','notifications','messageId','message_id','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','CmList','CmContact','Contacts','DESC','list','contact','interaction','created','applications','close','unmanaged','ContactId','UserId','unshift','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','stringify','text/xml','\x0a','to\x20is\x20mandatory','List','ListId','WhatsappInteraction','out','user','Messages','spread','push','dataValues','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter'];(function(_0x5b0175,_0x28ed9a){var _0x276cbb=function(_0x40b7c5){while(--_0x40b7c5){_0x5b0175['push'](_0x5b0175['shift']());}};_0x276cbb(++_0x28ed9a);}(_0x997f,0x171));var _0xf997=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x997f[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf997('0x0'));var jsonpatch=require(_0xf997('0x1'));var rp=require('request-promise');var moment=require(_0xf997('0x2'));var BPromise=require(_0xf997('0x3'));var Mustache=require(_0xf997('0x4'));var util=require('util');var path=require(_0xf997('0x5'));var sox=require(_0xf997('0x6'));var csv=require(_0xf997('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf997('0x8'));var _=require(_0xf997('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf997('0xa'));var deskjs=require(_0xf997('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf997('0xc'));var Papa=require(_0xf997('0xd'));var Redis=require(_0xf997('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf997('0xf'));var as=require(_0xf997('0x10'));var hardwareService=require(_0xf997('0x11'));var logger=require(_0xf997('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf997('0x13'));var licenseUtil=require(_0xf997('0x14'));var db=require('../../mysqldb')['db'];config[_0xf997('0x15')]=_[_0xf997('0x16')](config[_0xf997('0x15')],{'host':_0xf997('0x17'),'port':0x18eb});var socket=require(_0xf997('0x18'))(new Redis(config[_0xf997('0x15')]));require(_0xf997('0x19'))[_0xf997('0x1a')](socket);var jayson=require(_0xf997('0x1b'));var client=jayson['client'][_0xf997('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x55d769,_0x281893,_0x1eeff4,_0x30f762){return new BPromise(function(_0x40e6c1,_0x251855){var _0x3ca290=_0x30f762||client;return _0x3ca290[_0xf997('0x1d')](_0x55d769,_0x1eeff4)[_0xf997('0x1e')](function(_0x5d674d){logger[_0xf997('0x1f')](_0xf997('0x20'),_0x281893,_0xf997('0x21'));logger[_0xf997('0x22')](_0xf997('0x23'),_0x281893,'request\x20sent',JSON['stringify'](_0x5d674d));if(_0x5d674d[_0xf997('0x24')]){if(_0x5d674d[_0xf997('0x24')][_0xf997('0x25')]===0x1f4){logger[_0xf997('0x24')](_0xf997('0x20'),_0x281893,_0x5d674d[_0xf997('0x24')][_0xf997('0x26')]);return _0x251855(_0x5d674d['error'][_0xf997('0x26')]);}logger[_0xf997('0x24')](_0xf997('0x20'),_0x281893,_0x5d674d[_0xf997('0x24')]['message']);return _0x40e6c1(_0x5d674d['error'][_0xf997('0x26')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x281893,'request\x20sent');_0x40e6c1(_0x5d674d[_0xf997('0x27')][_0xf997('0x26')]);}})[_0xf997('0x28')](function(_0x523fc1){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x281893,_0x523fc1);_0x251855(_0x523fc1);});});}function respondWithStatusCode(_0x4781a0,_0x540a88){_0x540a88=_0x540a88||0xcc;return function(_0x509295){if(_0x509295){return _0x4781a0['sendStatus'](_0x540a88);}return _0x4781a0[_0xf997('0x29')](_0x540a88)[_0xf997('0x2a')]();};}function respondWithResult(_0x176999,_0x547a6b){_0x547a6b=_0x547a6b||0xc8;return function(_0x2cff46){if(_0x2cff46){return _0x176999[_0xf997('0x29')](_0x547a6b)[_0xf997('0x2b')](_0x2cff46);}};}function respondWithFilteredResult(_0x1c3c14,_0x36683a){return function(_0x332e70){if(_0x332e70){var _0xc46fcc=typeof _0x36683a[_0xf997('0x2c')]===_0xf997('0x2d')&&typeof _0x36683a[_0xf997('0x2e')]==='undefined';var _0x43bb7c=_0x332e70[_0xf997('0x2f')];var _0x5d526d=_0xc46fcc?0x0:_0x36683a['offset'];var _0x13925d=_0xc46fcc?_0x332e70[_0xf997('0x2f')]:_0x36683a[_0xf997('0x2c')]+_0x36683a[_0xf997('0x2e')];var _0x33f5cf;if(_0x13925d>=_0x43bb7c){_0x13925d=_0x43bb7c;_0x33f5cf=0xc8;}else{_0x33f5cf=0xce;}_0x1c3c14['status'](_0x33f5cf);return _0x1c3c14[_0xf997('0x30')]('Content-Range',_0x5d526d+'-'+_0x13925d+'/'+_0x43bb7c)[_0xf997('0x2b')](_0x332e70);}return null;};}function patchUpdates(_0x2eaf63){return function(_0xbd16fc){try{jsonpatch[_0xf997('0x31')](_0xbd16fc,_0x2eaf63,!![]);}catch(_0x300876){return BPromise[_0xf997('0x32')](_0x300876);}return _0xbd16fc[_0xf997('0x33')]();};}function saveUpdates(_0x4e9067,_0x50fc80){return function(_0x1b87a3){if(_0x1b87a3){return _0x1b87a3[_0xf997('0x34')](_0x4e9067)[_0xf997('0x1e')](function(_0x3802b7){return _0x3802b7;});}return null;};}function removeEntity(_0x45a1cf,_0xa6aed){return function(_0x3b125c){if(_0x3b125c){return _0x3b125c[_0xf997('0x35')]()[_0xf997('0x1e')](function(){var _0x4042f1=_0x3b125c['get']({'plain':!![]});var _0x493301=_0xf997('0x36');return db[_0xf997('0x37')]['destroy']({'where':{'type':_0x493301,'resourceId':_0x4042f1['id']}})[_0xf997('0x1e')](function(){return _0x3b125c;});})[_0xf997('0x1e')](function(){_0x45a1cf[_0xf997('0x29')](0xcc)[_0xf997('0x2a')]();});}};}function handleEntityNotFound(_0x4daa2b,_0x3b78e3){return function(_0x1ef582){if(!_0x1ef582){_0x4daa2b[_0xf997('0x38')](0x194);}return _0x1ef582;};}function handleError(_0x50375c,_0x57e6d3){_0x57e6d3=_0x57e6d3||0x1f4;return function(_0x36e4fe){logger['error'](_0x36e4fe[_0xf997('0x39')]);if(_0x36e4fe[_0xf997('0x3a')]){delete _0x36e4fe[_0xf997('0x3a')];}_0x50375c[_0xf997('0x29')](_0x57e6d3)['send'](_0x36e4fe);};}exports[_0xf997('0x3b')]=function(_0x4f77f8,_0x38d3e6){var _0x4e2b26={'include':[{'model':db[_0xf997('0x3c')],'as':'mandatoryDispositionPause'}]},_0x22f8c3={},_0x530a05={'count':0x0,'rows':[]};var _0x1d5887=_[_0xf997('0x3d')](db[_0xf997('0x3e')][_0xf997('0x3f')],function(_0x1d6bee){return{'name':_0x1d6bee[_0xf997('0x40')],'type':_0x1d6bee['type'][_0xf997('0x41')]};});_0x22f8c3[_0xf997('0x42')]=_[_0xf997('0x3d')](_0x1d5887,_0xf997('0x3a'));_0x22f8c3[_0xf997('0x43')]=_[_0xf997('0x44')](_0x4f77f8[_0xf997('0x43')]);_0x22f8c3[_0xf997('0x45')]=_[_0xf997('0x46')](_0x22f8c3['model'],_0x22f8c3[_0xf997('0x43')]);_0x4e2b26['attributes']=_[_0xf997('0x46')](_0x22f8c3[_0xf997('0x42')],qs[_0xf997('0x47')](_0x4f77f8[_0xf997('0x43')]['fields']));_0x4e2b26[_0xf997('0x48')]=_0x4e2b26['attributes'][_0xf997('0x49')]?_0x4e2b26['attributes']:_0x22f8c3['model'];if(!_0x4f77f8['query'][_0xf997('0x4a')](_0xf997('0x4b'))){_0x4e2b26[_0xf997('0x2e')]=qs[_0xf997('0x2e')](_0x4f77f8[_0xf997('0x43')]['limit']);_0x4e2b26[_0xf997('0x2c')]=qs[_0xf997('0x2c')](_0x4f77f8[_0xf997('0x43')][_0xf997('0x2c')]);}_0x4e2b26[_0xf997('0x4c')]=qs[_0xf997('0x4d')](_0x4f77f8[_0xf997('0x43')][_0xf997('0x4d')]);_0x4e2b26[_0xf997('0x4e')]=qs[_0xf997('0x45')](_[_0xf997('0x4f')](_0x4f77f8[_0xf997('0x43')],_0x22f8c3['filters']),_0x1d5887);if(_0x4f77f8['query'][_0xf997('0x50')]){_0x4e2b26[_0xf997('0x4e')]=_[_0xf997('0x51')](_0x4e2b26[_0xf997('0x4e')],{'$or':_[_0xf997('0x3d')](_0x1d5887,function(_0x19f9a5){if(_0x19f9a5[_0xf997('0x52')]!==_0xf997('0x53')){var _0x26af64={};_0x26af64[_0x19f9a5[_0xf997('0x3a')]]={'$like':'%'+_0x4f77f8['query']['filter']+'%'};return _0x26af64;}})});}_0x4e2b26=_[_0xf997('0x51')]({},_0x4e2b26,_0x4f77f8[_0xf997('0x54')]);var _0x53fe29={'where':_0x4e2b26[_0xf997('0x4e')]};return db[_0xf997('0x3e')]['count'](_0x53fe29)[_0xf997('0x1e')](function(_0x1a5162){_0x530a05[_0xf997('0x2f')]=_0x1a5162;if(_0x4f77f8[_0xf997('0x43')][_0xf997('0x55')]){_0x4e2b26[_0xf997('0x56')]=[{'all':!![]}];}return db[_0xf997('0x3e')][_0xf997('0x57')](_0x4e2b26);})[_0xf997('0x1e')](function(_0x264ae4){_0x530a05[_0xf997('0x58')]=_0x264ae4;return _0x530a05;})['then'](respondWithFilteredResult(_0x38d3e6,_0x4e2b26))['catch'](handleError(_0x38d3e6,null));};exports['show']=function(_0x40c76c,_0x5e95b0){var _0x150759={'raw':![],'where':{'id':_0x40c76c['params']['id']},'include':[{'model':db[_0xf997('0x3c')],'as':_0xf997('0x59')}]},_0x2e84c8={};_0x2e84c8[_0xf997('0x42')]=_[_0xf997('0x44')](db[_0xf997('0x3e')]['rawAttributes']);_0x2e84c8[_0xf997('0x43')]=_[_0xf997('0x44')](_0x40c76c['query']);_0x2e84c8['filters']=_[_0xf997('0x46')](_0x2e84c8[_0xf997('0x42')],_0x2e84c8[_0xf997('0x43')]);_0x150759[_0xf997('0x48')]=_['intersection'](_0x2e84c8[_0xf997('0x42')],qs['fields'](_0x40c76c[_0xf997('0x43')][_0xf997('0x47')]));_0x150759[_0xf997('0x48')]=_0x150759[_0xf997('0x48')]['length']?_0x150759[_0xf997('0x48')]:_0x2e84c8['model'];if(_0x40c76c[_0xf997('0x43')][_0xf997('0x55')]){_0x150759[_0xf997('0x56')]=[{'all':!![]}];}_0x150759=_['merge']({},_0x150759,_0x40c76c[_0xf997('0x54')]);return db[_0xf997('0x3e')][_0xf997('0x5a')](_0x150759)['then'](handleEntityNotFound(_0x5e95b0,null))[_0xf997('0x1e')](respondWithResult(_0x5e95b0,null))['catch'](handleError(_0x5e95b0,null));};exports[_0xf997('0x5b')]=function(_0x41e25d,_0xa4db17){return db[_0xf997('0x3e')][_0xf997('0x5b')](_0x41e25d['body'],{})[_0xf997('0x1e')](function(_0x304c62){var _0x5e2769=_0x41e25d['user'][_0xf997('0x5c')]({'plain':!![]});if(!_0x5e2769)throw new Error(_0xf997('0x5d'));if(_0x5e2769[_0xf997('0x5e')]==='user'){var _0x24025c=_0x304c62[_0xf997('0x5c')]({'plain':!![]});var _0x35c25c=_0xf997('0x36');return db['UserProfileSection'][_0xf997('0x5a')]({'where':{'name':_0x35c25c,'userProfileId':_0x5e2769[_0xf997('0x5f')]},'raw':!![]})[_0xf997('0x1e')](function(_0x6f0028){if(_0x6f0028&&_0x6f0028['autoAssociation']===0x0){return db[_0xf997('0x37')][_0xf997('0x5b')]({'name':_0x24025c[_0xf997('0x3a')],'resourceId':_0x24025c['id'],'type':_0x6f0028['name'],'sectionId':_0x6f0028['id']},{})[_0xf997('0x1e')](function(){return _0x304c62;});}else{return _0x304c62;}})[_0xf997('0x28')](function(_0x2d304c){logger[_0xf997('0x24')](_0xf997('0x60'),_0x2d304c);throw _0x2d304c;});}return _0x304c62;})[_0xf997('0x1e')](respondWithResult(_0xa4db17,0xc9))[_0xf997('0x28')](handleError(_0xa4db17,null));};exports[_0xf997('0x34')]=function(_0x15fd06,_0x12ed81){if(_0x15fd06[_0xf997('0x61')]['id']){delete _0x15fd06[_0xf997('0x61')]['id'];}return db[_0xf997('0x3e')][_0xf997('0x5a')]({'where':{'id':_0x15fd06['params']['id']},'include':[{'model':db[_0xf997('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xf997('0x1e')](handleEntityNotFound(_0x12ed81,null))['then'](saveUpdates(_0x15fd06['body'],null))[_0xf997('0x1e')](respondWithResult(_0x12ed81,null))[_0xf997('0x28')](handleError(_0x12ed81,null));};exports[_0xf997('0x35')]=function(_0x2b3037,_0x17b5f3){return db[_0xf997('0x3e')][_0xf997('0x5a')]({'where':{'id':_0x2b3037[_0xf997('0x62')]['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0x17b5f3,null))['then'](removeEntity(_0x17b5f3,null))['catch'](handleError(_0x17b5f3,null));};exports[_0xf997('0x63')]=function(_0x144bac,_0x1bdf32){return db[_0xf997('0x3e')][_0xf997('0x63')]()[_0xf997('0x1e')](respondWithResult(_0x1bdf32,null))[_0xf997('0x28')](handleError(_0x1bdf32,null));};exports[_0xf997('0x64')]=function(_0x5d64f4,_0x52b1ea,_0x110ba7){if(_0x5d64f4[_0xf997('0x61')]['id']){delete _0x5d64f4[_0xf997('0x61')]['id'];}return db[_0xf997('0x3e')][_0xf997('0x5a')]({'where':{'id':_0x5d64f4[_0xf997('0x62')]['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0x52b1ea,null))['then'](function(_0x58c609){if(_0x58c609){_0x5d64f4['body'][_0xf997('0x65')]=_0x58c609['id'];return db[_0xf997('0x66')][_0xf997('0x5b')](_0x5d64f4[_0xf997('0x61')]);}})[_0xf997('0x1e')](respondWithResult(_0x52b1ea,null))[_0xf997('0x28')](handleError(_0x52b1ea,null));};exports[_0xf997('0x67')]=function(_0x183095,_0xf68e41,_0x3864d1){var _0x4cdcdc={'raw':![],'where':{}};var _0x4e0be4={};var _0x52d712={'count':0x0,'rows':[]};return db[_0xf997('0x3e')][_0xf997('0x68')]({'where':{'id':_0x183095['params']['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0xf68e41,null))[_0xf997('0x1e')](function(_0x5b9f04){if(_0x5b9f04){_0x4e0be4[_0xf997('0x42')]=_[_0xf997('0x44')](db[_0xf997('0x66')][_0xf997('0x3f')]);_0x4e0be4[_0xf997('0x43')]=_[_0xf997('0x44')](_0x183095[_0xf997('0x43')]);_0x4e0be4[_0xf997('0x45')]=_[_0xf997('0x46')](_0x4e0be4[_0xf997('0x42')],_0x4e0be4[_0xf997('0x43')]);_0x4cdcdc[_0xf997('0x48')]=_['intersection'](_0x4e0be4[_0xf997('0x42')],qs['fields'](_0x183095[_0xf997('0x43')]['fields']));_0x4cdcdc[_0xf997('0x48')]=_0x4cdcdc[_0xf997('0x48')][_0xf997('0x49')]?_0x4cdcdc[_0xf997('0x48')]:_0x4e0be4[_0xf997('0x42')];if(!_0x183095[_0xf997('0x43')][_0xf997('0x4a')]('nolimit')){_0x4cdcdc[_0xf997('0x2e')]=qs[_0xf997('0x2e')](_0x183095[_0xf997('0x43')][_0xf997('0x2e')]);_0x4cdcdc[_0xf997('0x2c')]=qs[_0xf997('0x2c')](_0x183095[_0xf997('0x43')][_0xf997('0x2c')]);}_0x4cdcdc[_0xf997('0x4c')]=qs['sort'](_0x183095[_0xf997('0x43')]['sort']);_0x4cdcdc['where']=qs[_0xf997('0x45')](_[_0xf997('0x4f')](_0x183095[_0xf997('0x43')],_0x4e0be4[_0xf997('0x45')]));_0x4cdcdc[_0xf997('0x4e')][_0xf997('0x65')]=_0x5b9f04['id'];if(_0x183095['query'][_0xf997('0x50')]){_0x4cdcdc[_0xf997('0x4e')]=_[_0xf997('0x51')](_0x4cdcdc['where'],{'$or':_[_0xf997('0x3d')](_0x4cdcdc[_0xf997('0x48')],function(_0x47944b){var _0x1e9626={};_0x1e9626[_0x47944b]={'$like':'%'+_0x183095['query'][_0xf997('0x50')]+'%'};return _0x1e9626;})});}_0x4cdcdc=_[_0xf997('0x51')]({},_0x4cdcdc,_0x183095[_0xf997('0x54')]);return db['Disposition'][_0xf997('0x2f')]({'where':_0x4cdcdc['where']})[_0xf997('0x1e')](function(_0x4e5948){_0x52d712[_0xf997('0x2f')]=_0x4e5948;if(_0x183095[_0xf997('0x43')][_0xf997('0x55')]){_0x4cdcdc[_0xf997('0x56')]=[{'all':!![]}];}return db[_0xf997('0x66')][_0xf997('0x57')](_0x4cdcdc);})[_0xf997('0x1e')](function(_0x2928d6){_0x52d712[_0xf997('0x58')]=_0x2928d6;return _0x52d712;});}})[_0xf997('0x1e')](respondWithFilteredResult(_0xf68e41,_0x4cdcdc))['catch'](handleError(_0xf68e41,null));};exports[_0xf997('0x69')]=function(_0x50f399,_0x59d0c2,_0x18a249){return db[_0xf997('0x3e')][_0xf997('0x5a')]({'where':{'id':_0x50f399['params']['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0x59d0c2,null))[_0xf997('0x1e')](function(_0x238da2){if(_0x238da2){return _0x238da2['removeDispositions'](_0x50f399[_0xf997('0x43')][_0xf997('0x6a')]);}})[_0xf997('0x1e')](respondWithStatusCode(_0x59d0c2,null))['catch'](handleError(_0x59d0c2,null));};exports[_0xf997('0x6b')]=function(_0x53353b,_0x12e1cd,_0x5bf648){if(_0x53353b[_0xf997('0x61')]['id']){delete _0x53353b['body']['id'];}return db[_0xf997('0x3e')]['find']({'where':{'id':_0x53353b['params']['id']}})['then'](handleEntityNotFound(_0x12e1cd,null))[_0xf997('0x1e')](function(_0x3301a0){if(_0x3301a0){_0x53353b[_0xf997('0x61')][_0xf997('0x65')]=_0x3301a0['id'];return db[_0xf997('0x6c')][_0xf997('0x5b')](_0x53353b[_0xf997('0x61')]);}})[_0xf997('0x1e')](respondWithResult(_0x12e1cd,null))['catch'](handleError(_0x12e1cd,null));};exports[_0xf997('0x6d')]=function(_0x56f031,_0x1a01b4,_0x44b0a6){var _0x599131={'raw':![],'where':{}};var _0x43f850={};var _0x539e90={'count':0x0,'rows':[]};return db[_0xf997('0x3e')][_0xf997('0x68')]({'where':{'id':_0x56f031['params']['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0x1a01b4,null))[_0xf997('0x1e')](function(_0x487166){if(_0x487166){_0x43f850[_0xf997('0x42')]=_[_0xf997('0x44')](db['CannedAnswer'][_0xf997('0x3f')]);_0x43f850[_0xf997('0x43')]=_['keys'](_0x56f031[_0xf997('0x43')]);_0x43f850[_0xf997('0x45')]=_[_0xf997('0x46')](_0x43f850[_0xf997('0x42')],_0x43f850[_0xf997('0x43')]);_0x599131[_0xf997('0x48')]=_[_0xf997('0x46')](_0x43f850['model'],qs[_0xf997('0x47')](_0x56f031[_0xf997('0x43')][_0xf997('0x47')]));_0x599131[_0xf997('0x48')]=_0x599131[_0xf997('0x48')][_0xf997('0x49')]?_0x599131[_0xf997('0x48')]:_0x43f850[_0xf997('0x42')];if(!_0x56f031[_0xf997('0x43')][_0xf997('0x4a')]('nolimit')){_0x599131['limit']=qs['limit'](_0x56f031[_0xf997('0x43')][_0xf997('0x2e')]);_0x599131[_0xf997('0x2c')]=qs['offset'](_0x56f031['query']['offset']);}_0x599131['order']=qs[_0xf997('0x4d')](_0x56f031[_0xf997('0x43')][_0xf997('0x4d')]);_0x599131[_0xf997('0x4e')]=qs[_0xf997('0x45')](_[_0xf997('0x4f')](_0x56f031['query'],_0x43f850['filters']));_0x599131[_0xf997('0x4e')]['WhatsappAccountId']=_0x487166['id'];if(_0x56f031[_0xf997('0x43')]['filter']){_0x599131['where']=_[_0xf997('0x51')](_0x599131[_0xf997('0x4e')],{'$or':_['map'](_0x599131[_0xf997('0x48')],function(_0xdf9261){var _0xdb49e0={};_0xdb49e0[_0xdf9261]={'$like':'%'+_0x56f031[_0xf997('0x43')]['filter']+'%'};return _0xdb49e0;})});}_0x599131=_[_0xf997('0x51')]({},_0x599131,_0x56f031[_0xf997('0x54')]);return db[_0xf997('0x6c')][_0xf997('0x2f')]({'where':_0x599131['where']})[_0xf997('0x1e')](function(_0x1cedce){_0x539e90['count']=_0x1cedce;if(_0x56f031[_0xf997('0x43')][_0xf997('0x55')]){_0x599131['include']=[{'all':!![]}];}return db[_0xf997('0x6c')][_0xf997('0x57')](_0x599131);})[_0xf997('0x1e')](function(_0x147705){_0x539e90[_0xf997('0x58')]=_0x147705;return _0x539e90;});}})[_0xf997('0x1e')](respondWithFilteredResult(_0x1a01b4,_0x599131))['catch'](handleError(_0x1a01b4,null));};exports[_0xf997('0x6e')]=function(_0x3d19d1,_0x3149fa,_0x46212d){return db[_0xf997('0x3e')][_0xf997('0x5a')]({'where':{'id':_0x3d19d1[_0xf997('0x62')]['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0x3149fa,null))[_0xf997('0x1e')](function(_0x1e23ab){if(_0x1e23ab){return _0x1e23ab[_0xf997('0x6e')](_0x3d19d1[_0xf997('0x43')][_0xf997('0x6a')]);}})[_0xf997('0x1e')](respondWithStatusCode(_0x3149fa,null))[_0xf997('0x28')](handleError(_0x3149fa,null));};exports[_0xf997('0x6f')]=function(_0x164ffa,_0x2057af,_0x116054){return db[_0xf997('0x3e')][_0xf997('0x5a')]({'where':{'id':_0x164ffa[_0xf997('0x62')]['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0x2057af,null))[_0xf997('0x1e')](function(_0x582c0d){if(_0x582c0d){return _0x582c0d['addAgents'](_0x164ffa[_0xf997('0x61')][_0xf997('0x6a')],_[_0xf997('0x70')](_0x164ffa[_0xf997('0x61')],[_0xf997('0x6a'),'id'])||{})['spread'](function(_0x43a6a5){for(var _0xb0af96=0x0;_0xb0af96<_0x164ffa['body'][_0xf997('0x6a')][_0xf997('0x49')];_0xb0af96+=0x1){socket[_0xf997('0x71')](_0xf997('0x72'),{'UserId':Number(_0x164ffa[_0xf997('0x61')]['ids'][_0xb0af96]),'WhatsappAccountId':Number(_0x164ffa[_0xf997('0x62')]['id'])});}return _0x43a6a5;});}})[_0xf997('0x1e')](respondWithResult(_0x2057af,null))[_0xf997('0x28')](handleError(_0x2057af,null));};exports['removeAgents']=function(_0x411e63,_0x32b063,_0x3c3ab8){return db[_0xf997('0x3e')]['find']({'where':{'id':_0x411e63[_0xf997('0x62')]['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0x32b063,null))[_0xf997('0x1e')](function(_0x480f9b){if(_0x480f9b){return _0x480f9b[_0xf997('0x73')](_0x411e63[_0xf997('0x43')][_0xf997('0x6a')])[_0xf997('0x1e')](function(){if(_[_0xf997('0x74')](_0x411e63[_0xf997('0x43')][_0xf997('0x6a')])){for(var _0x426ba0=0x0;_0x426ba0<_0x411e63[_0xf997('0x43')][_0xf997('0x6a')][_0xf997('0x49')];_0x426ba0+=0x1){socket[_0xf997('0x71')](_0xf997('0x75'),{'UserId':Number(_0x411e63[_0xf997('0x43')][_0xf997('0x6a')][_0x426ba0]),'WhatsappAccountId':Number(_0x411e63['params']['id'])});}}else{socket['emit'](_0xf997('0x75'),{'UserId':Number(_0x411e63[_0xf997('0x43')][_0xf997('0x6a')]),'WhatsappAccountId':Number(_0x411e63[_0xf997('0x62')]['id'])});}});}})[_0xf997('0x1e')](respondWithStatusCode(_0x32b063,null))[_0xf997('0x28')](handleError(_0x32b063,null));};exports[_0xf997('0x76')]=function(_0x30dc50,_0x1333ad,_0xd665e4){var _0x5f1020={};var _0xb58b12={};var _0x5821ea;var _0x1b0f5a;return db['WhatsappAccount'][_0xf997('0x68')]({'where':{'id':_0x30dc50['params']['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0x1333ad,null))['then'](function(_0x552319){if(_0x552319){_0x5821ea=_0x552319;_0xb58b12[_0xf997('0x42')]=_[_0xf997('0x44')](db[_0xf997('0x77')][_0xf997('0x3f')]);_0xb58b12[_0xf997('0x43')]=_[_0xf997('0x44')](_0x30dc50['query']);_0xb58b12[_0xf997('0x45')]=_[_0xf997('0x46')](_0xb58b12[_0xf997('0x42')],_0xb58b12[_0xf997('0x43')]);_0x5f1020[_0xf997('0x48')]=_[_0xf997('0x46')](_0xb58b12[_0xf997('0x42')],qs['fields'](_0x30dc50[_0xf997('0x43')][_0xf997('0x47')]));_0x5f1020[_0xf997('0x48')]=_0x5f1020[_0xf997('0x48')][_0xf997('0x49')]?_0x5f1020['attributes']:_0xb58b12[_0xf997('0x42')];_0x5f1020['order']=qs[_0xf997('0x4d')](_0x30dc50[_0xf997('0x43')][_0xf997('0x4d')]);_0x5f1020[_0xf997('0x4e')]=qs[_0xf997('0x45')](_['pick'](_0x30dc50['query'],_0xb58b12['filters']));if(_0x30dc50[_0xf997('0x43')][_0xf997('0x50')]){_0x5f1020[_0xf997('0x4e')]=_[_0xf997('0x51')](_0x5f1020[_0xf997('0x4e')],{'$or':_[_0xf997('0x3d')](_0x5f1020['attributes'],function(_0x226592){var _0x5980f8={};_0x5980f8[_0x226592]={'$like':'%'+_0x30dc50[_0xf997('0x43')][_0xf997('0x50')]+'%'};return _0x5980f8;})});}_0x5f1020=_[_0xf997('0x51')]({},_0x5f1020,_0x30dc50[_0xf997('0x54')]);return _0x5821ea[_0xf997('0x76')](_0x5f1020);}})[_0xf997('0x1e')](function(_0x1ef0a3){if(_0x1ef0a3){_0x1b0f5a=_0x1ef0a3[_0xf997('0x49')];if(!_0x30dc50[_0xf997('0x43')]['hasOwnProperty']('nolimit')){_0x5f1020[_0xf997('0x2e')]=qs[_0xf997('0x2e')](_0x30dc50['query'][_0xf997('0x2e')]);_0x5f1020['offset']=qs['offset'](_0x30dc50['query'][_0xf997('0x2c')]);}return _0x5821ea[_0xf997('0x76')](_0x5f1020);}})['then'](function(_0x4881ee){if(_0x4881ee){return _0x4881ee?{'count':_0x1b0f5a,'rows':_0x4881ee}:null;}})[_0xf997('0x1e')](respondWithResult(_0x1333ad,null))[_0xf997('0x28')](handleError(_0x1333ad,null));};exports[_0xf997('0x78')]=function(_0x32e908,_0x6521b2){var _0x23dd08=_0x32e908[_0xf997('0x62')]['id'];var _0x1a6c6b=_0x32e908[_0xf997('0x61')];var _0x48034b=0xc8;var _0x4ee8ee=null;return db[_0xf997('0x79')]['transaction']({'isolationLevel':db[_0xf997('0x79')][_0xf997('0x7a')][_0xf997('0x7b')][_0xf997('0x7c')]},function(_0x38bb6f){return db[_0xf997('0x3e')][_0xf997('0x68')]({'where':{'id':_0x23dd08},'transaction':_0x38bb6f})['then'](function(_0x305c90){if(_0x305c90){return db[_0xf997('0x7d')][_0xf997('0x35')]({'where':{'WhatsappAccountId':_0x23dd08},'transaction':_0x38bb6f})[_0xf997('0x1e')](function(){var _0x47ad12=_[_0xf997('0x3d')](_0x1a6c6b,function(_0x5ec53b){_0x5ec53b[_0xf997('0x65')]=_0x23dd08;return _0x5ec53b;});return db[_0xf997('0x7d')][_0xf997('0x7e')](_0x47ad12,{'transaction':_0x38bb6f});});}else{_0x48034b=0x194;_0x4ee8ee=[];}});})[_0xf997('0x1e')](function(){if(_0x48034b!==0x194){return db[_0xf997('0x7d')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x23dd08},'order':_0xf997('0x7f')})[_0xf997('0x1e')](function(_0x2733f3){_0x4ee8ee=_0x2733f3;});}})[_0xf997('0x28')](function(_0x146cd3){_0x48034b=0x1f4;logger[_0xf997('0x24')](_0x146cd3[_0xf997('0x39')]);if(_0x146cd3[_0xf997('0x3a')]){delete _0x146cd3[_0xf997('0x3a')];}_0x4ee8ee=_0x146cd3;})['finally'](function(){if(_0x4ee8ee===null){_0x6521b2[_0xf997('0x38')](_0x48034b);}else{if(_0x48034b===0x1f4){_0x6521b2[_0xf997('0x29')](_0x48034b)[_0xf997('0x80')](_0x4ee8ee);}else{_0x6521b2[_0xf997('0x29')](_0x48034b)[_0xf997('0x2b')](_0x4ee8ee);}}});};exports[_0xf997('0x81')]=function(_0x81b447,_0x50afb5,_0x53c298){var _0x151ea7={};var _0x5c8eff={};var _0x304595;var _0x5a4d4e;return db[_0xf997('0x3e')][_0xf997('0x68')]({'where':{'id':_0x81b447[_0xf997('0x62')]['id']}})[_0xf997('0x1e')](handleEntityNotFound(_0x50afb5,null))['then'](function(_0x5180d9){if(_0x5180d9){_0x304595=_0x5180d9;_0x5c8eff[_0xf997('0x42')]=_[_0xf997('0x44')](db['WhatsappApplication']['rawAttributes']);_0x5c8eff['query']=_[_0xf997('0x44')](_0x81b447[_0xf997('0x43')]);_0x5c8eff[_0xf997('0x45')]=_[_0xf997('0x46')](_0x5c8eff[_0xf997('0x42')],_0x5c8eff['query']);_0x151ea7[_0xf997('0x48')]=_[_0xf997('0x46')](_0x5c8eff['model'],qs[_0xf997('0x47')](_0x81b447[_0xf997('0x43')]['fields']));_0x151ea7[_0xf997('0x48')]=_0x151ea7[_0xf997('0x48')][_0xf997('0x49')]?_0x151ea7[_0xf997('0x48')]:_0x5c8eff[_0xf997('0x42')];_0x151ea7[_0xf997('0x4c')]=qs[_0xf997('0x4d')](_0x81b447[_0xf997('0x43')][_0xf997('0x4d')]);_0x151ea7[_0xf997('0x4e')]=qs[_0xf997('0x45')](_[_0xf997('0x4f')](_0x81b447['query'],_0x5c8eff['filters']));if(_0x81b447[_0xf997('0x43')][_0xf997('0x50')]){_0x151ea7['where']=_['merge'](_0x151ea7['where'],{'$or':_[_0xf997('0x3d')](_0x151ea7[_0xf997('0x48')],function(_0x5354c3){var _0x53cb16={};_0x53cb16[_0x5354c3]={'$like':'%'+_0x81b447['query'][_0xf997('0x50')]+'%'};return _0x53cb16;})});}_0x151ea7=_[_0xf997('0x51')]({},_0x151ea7,_0x81b447[_0xf997('0x54')]);return _0x304595['getApplications'](_0x151ea7);}})[_0xf997('0x1e')](function(_0x25bb04){if(_0x25bb04){_0x5a4d4e=_0x25bb04[_0xf997('0x49')];if(!_0x81b447[_0xf997('0x43')][_0xf997('0x4a')](_0xf997('0x4b'))){_0x151ea7[_0xf997('0x2e')]=qs[_0xf997('0x2e')](_0x81b447[_0xf997('0x43')]['limit']);_0x151ea7[_0xf997('0x2c')]=qs['offset'](_0x81b447[_0xf997('0x43')][_0xf997('0x2c')]);}return _0x304595[_0xf997('0x81')](_0x151ea7);}})['then'](function(_0x2322a4){if(_0x2322a4){return _0x2322a4?{'count':_0x5a4d4e,'rows':_0x2322a4}:null;}})[_0xf997('0x1e')](respondWithResult(_0x50afb5,null))[_0xf997('0x28')](handleError(_0x50afb5,null));};exports[_0xf997('0x82')]=function(_0x330d80,_0x5f0d20,_0xb6b365){var _0x2fd6f4={'channel':_0xf997('0x83')};var _0x2113b5=[];var _0x4ebad4=[];var _0x4fa2e6={};return db[_0xf997('0x3e')][_0xf997('0x5a')]({'where':{'id':_0x330d80[_0xf997('0x62')]['id']},'include':[{'model':db[_0xf997('0x7d')],'as':_0xf997('0x84')}]})[_0xf997('0x1e')](handleEntityNotFound(_0x5f0d20,null))['then'](function(_0xd75dbb){_0x2fd6f4[_0xf997('0x85')]=_0xd75dbb;if(_0x2fd6f4[_0xf997('0x85')]&&_0x2fd6f4[_0xf997('0x85')][_0xf997('0x52')]===_0xf997('0x86')&&_0x330d80[_0xf997('0x61')][_0xf997('0x87')]){if(_0x330d80['body'][_0xf997('0x87')][_0xf997('0x49')]===0x0)return;if(_0x330d80[_0xf997('0x61')]['statuses'][0x0][_0xf997('0x88')]!==_0xf997('0x89'))return;return db[_0xf997('0x8a')]['update']({'read':!![],'readAt':_0x330d80[_0xf997('0x61')][_0xf997('0x87')][0x0][_0xf997('0x8b')]},{'where':{'messageId':_0x330d80[_0xf997('0x61')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xf997('0x1e')](function(_0x231b44){return _0x5f0d20[_0xf997('0x29')](0xc8)[_0xf997('0x2b')](_0x231b44);});}_0x2fd6f4['applications']=_[_0xf997('0x8c')](_0xd75dbb[_0xf997('0x84')],[_0xf997('0x7f')],['asc']);if(_0x2fd6f4[_0xf997('0x85')][_0xf997('0x84')]){delete _0x2fd6f4[_0xf997('0x85')][_0xf997('0x84')];}return db['CmContact'][_0xf997('0x63')]()[_0xf997('0x1e')](function(_0x3c3c7f){if(!_0x3c3c7f){throw new db[(_0xf997('0x8d'))][(_0xf997('0x8e'))](_0xf997('0x8f'));}_0x2113b5=_[_0xf997('0x90')](_[_0xf997('0x44')](_0x3c3c7f),[_0xf997('0x91'),_0xf997('0x92')]);_0x4ebad4=_[_0xf997('0x90')](_[_0xf997('0x44')](_0x3c3c7f),[_0xf997('0x91'),_0xf997('0x92'),_0xf997('0x93'),'ListId']);_0x2fd6f4[_0xf997('0x61')]={'mapKey':_0xf997('0x94')};if(_0x2fd6f4[_0xf997('0x85')]&&_0x2fd6f4[_0xf997('0x85')]['type']===_0xf997('0x95')){_0x2fd6f4['body'][_0xf997('0x96')]=_0x330d80[_0xf997('0x61')]['From'][_0xf997('0x97')](_0xf997('0x98'),'');_0x2fd6f4[_0xf997('0x61')]['body']=_0x330d80['body'][_0xf997('0x99')];_0x2fd6f4[_0xf997('0x61')]['messageId']=_0x330d80[_0xf997('0x61')][_0xf997('0x9a')];}if(_0x2fd6f4[_0xf997('0x85')]&&_0x2fd6f4['account']['type']===_0xf997('0x86')){_0x2fd6f4[_0xf997('0x61')]['from']=_0x330d80['body']['notifications'][0x0][_0xf997('0x96')];_0x2fd6f4[_0xf997('0x61')][_0xf997('0x61')]=_0x330d80[_0xf997('0x61')][_0xf997('0x9b')][0x0][_0xf997('0x26')][_0xf997('0x61')];_0x2fd6f4[_0xf997('0x61')][_0xf997('0x9c')]=_0x330d80[_0xf997('0x61')][_0xf997('0x9b')][0x0][_0xf997('0x9d')];}if(_0x2fd6f4[_0xf997('0x61')]['id']){delete _0x2fd6f4[_0xf997('0x61')]['id'];}if(_['isNil'](_0x2fd6f4[_0xf997('0x61')][_0xf997('0x96')])){throw new db[(_0xf997('0x8d'))][(_0xf997('0x8e'))](_0xf997('0x9e'));}if(_[_0xf997('0x9f')](_0x2fd6f4[_0xf997('0x61')][_0xf997('0x61')])||_0x2fd6f4['body']['body']===''){throw new db['Sequelize'][(_0xf997('0x8e'))](_0xf997('0xa0'));}if(_[_0xf997('0x9f')](_0x2fd6f4[_0xf997('0x61')][_0xf997('0xa1')])){throw new db[(_0xf997('0x8d'))][(_0xf997('0x8e'))](_0xf997('0xa2')+_0x4ebad4);}if(!_[_0xf997('0xa3')](_0x4ebad4,_0x2fd6f4[_0xf997('0x61')]['mapKey'])){throw new db[(_0xf997('0x8d'))][(_0xf997('0x8e'))](_0xf997('0xa4')+_0x4ebad4);}_0x4fa2e6[_0x2fd6f4[_0xf997('0x61')][_0xf997('0xa1')]]=_0x2fd6f4['body'][_0xf997('0x96')];return db[_0xf997('0xa5')]['find']({'where':{'id':_0x2fd6f4[_0xf997('0x85')]['ListId']},'include':[{'model':db[_0xf997('0xa6')],'as':_0xf997('0xa7'),'where':_0x4fa2e6,'limit':0x1,'order':[[_0xf997('0x92'),_0xf997('0xa8')]]}]});})[_0xf997('0x1e')](handleEntityNotFound(_0x5f0d20,null))[_0xf997('0x1e')](function(_0x142272){if(_0x142272){_0x2fd6f4[_0xf997('0xa9')]=_[_0xf997('0x70')](_0x142272,[_0xf997('0xa7')]);if(_0x142272[_0xf997('0xa7')]['length']){return _0x142272[_0xf997('0xa7')][0x0];}var _0x14a2d5=_[_0xf997('0x16')](_0x2fd6f4[_0xf997('0x61')],{'firstName':_0x2fd6f4[_0xf997('0x61')][_0xf997('0x96')],'ListId':_0x142272['id']});_0x14a2d5[_0x2fd6f4[_0xf997('0x61')][_0xf997('0xa1')]]=_0x2fd6f4[_0xf997('0x61')]['from'];return db[_0xf997('0xa6')][_0xf997('0x5b')](_0x14a2d5,{'fields':_0x2113b5,'raw':!![]});}})[_0xf997('0x1e')](handleEntityNotFound(_0x5f0d20,null))[_0xf997('0x1e')](function(_0x3e8978){if(_0x3e8978){_0x2fd6f4[_0xf997('0xaa')]=_0x3e8978;var _0x268511={'ContactId':_0x3e8978['id'],'phone':_0x2fd6f4[_0xf997('0x61')][_0xf997('0x96')],'WhatsappAccountId':_0x330d80[_0xf997('0x62')]['id']};var _0x3038e2={'ContactId':_0x3e8978['id'],'WhatsappAccountId':_0x330d80[_0xf997('0x62')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xf997('0x5a')]({'where':_0x3038e2})[_0xf997('0x1e')](function(_0x3e8dc3){if(_0x3e8dc3){return[_0x3e8dc3,![]];}return db['WhatsappInteraction'][_0xf997('0x5b')](_0x268511)[_0xf997('0x1e')](function(_0x5bd300){return[_0x5bd300,!![]];});});}})['spread'](function(_0x47c7ec,_0x38fa67){_0x2fd6f4[_0xf997('0xab')]=_0x47c7ec[_0xf997('0x5c')]({'plain':!![]});_0x2fd6f4[_0xf997('0xab')][_0xf997('0xac')]=![];if(_0x38fa67){if(_0x2fd6f4[_0xf997('0x85')]['autoclose']){_0x2fd6f4[_0xf997('0xad')]['push']({'id':0x0,'priority':_0x2fd6f4[_0xf997('0xad')][_0xf997('0x49')]+0x1,'app':_0xf997('0xae'),'appdata':_0xf997('0xaf'),'interval':'*,*,*,*'});}_0x2fd6f4[_0xf997('0xab')][_0xf997('0xac')]=!![];}return db[_0xf997('0x8a')][_0xf997('0x5b')]({'phone':_0x2fd6f4[_0xf997('0x61')]['from'],'messageId':_0x2fd6f4[_0xf997('0x61')][_0xf997('0x9c')],'body':_0x2fd6f4[_0xf997('0x61')]['body'],'WhatsappAccountId':_0x330d80[_0xf997('0x62')]['id'],'WhatsappInteractionId':_0x47c7ec['id'],'direction':'in','ContactId':_0x47c7ec[_0xf997('0xb0')],'AttachmentId':_0x2fd6f4[_0xf997('0x61')]['AttachmentId']});})['then'](function(_0x1e314c){_0x2fd6f4[_0xf997('0x26')]=_0x1e314c;if(_0x2fd6f4[_0xf997('0xab')][_0xf997('0xb1')]){return db[_0xf997('0x77')][_0xf997('0x5a')]({'attributes':['id','name'],'where':{'id':_0x2fd6f4[_0xf997('0xab')]['UserId']}})[_0xf997('0x1e')](function(_0x1185cd){if(_0x1185cd){_0x2fd6f4['applications'][_0xf997('0xb2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1185cd[_0xf997('0x3a')]+','+(_0x2fd6f4[_0xf997('0x85')][_0xf997('0xb3')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xf997('0xb4'),_0x2fd6f4);});}return respondWithRpcPromise(_0xf997('0xb5'),_0xf997('0xb4'),_0x2fd6f4);})[_0xf997('0x1e')](function(_0x5b8a2b){if(_0x5b8a2b){var _0x1c94a8=0xc8;var _0x2187cf=_0xf997('0xb6');logger[_0xf997('0x1f')](_0xf997('0x23'),_0x2187cf,_0x1c94a8,_0xf997('0xb7'));logger[_0xf997('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2187cf,_0x1c94a8,_0xf997('0xb7'),JSON[_0xf997('0xb8')](_0x5b8a2b));if(_0x2fd6f4[_0xf997('0x85')][_0xf997('0x52')]===_0xf997('0x95')){return _0x5f0d20['status'](_0x1c94a8)[_0xf997('0x30')]('Content-Type',_0xf997('0xb9'))[_0xf997('0x80')](_0xf997('0xba'));}else{return _0x5f0d20[_0xf997('0x29')](_0x1c94a8)['json'](_0x5b8a2b);}}});})[_0xf997('0x28')](handleError(_0x5f0d20,null));};exports[_0xf997('0x80')]=function(_0x577a98,_0x4c36c8,_0x40a6ac){var _0xf32467,_0x53489e,_0x29006d;if(_['isNil'](_0x577a98[_0xf997('0x61')][_0xf997('0x61')])||_0x577a98[_0xf997('0x61')][_0xf997('0x61')]===''){throw new db[(_0xf997('0x8d'))][(_0xf997('0x8e'))](_0xf997('0xa0'));}if(_[_0xf997('0x9f')](_0x577a98[_0xf997('0x61')]['to'])){throw new db[(_0xf997('0x8d'))][(_0xf997('0x8e'))](_0xf997('0xbb'));}_0xf32467=_0x577a98[_0xf997('0x61')]['to'];return db[_0xf997('0x3e')][_0xf997('0x5a')]({'where':{'id':_0x577a98[_0xf997('0x62')]['id']},'include':[{'model':db[_0xf997('0xa5')],'as':_0xf997('0xbc'),'include':[{'model':db[_0xf997('0xa6')],'as':_0xf997('0xa7'),'where':{'mobile':_0xf32467},'limit':0x1,'order':[[_0xf997('0x92'),_0xf997('0xa8')]]}]}]})[_0xf997('0x1e')](handleEntityNotFound(_0x4c36c8,null))[_0xf997('0x1e')](function(_0x3d2a37){if(_0x3d2a37&&_0x3d2a37[_0xf997('0xbc')]){_0x53489e=_0x3d2a37[_0xf997('0x5c')]({'plain':!![]});if(_0x53489e[_0xf997('0xbc')]&&_0x53489e['List'][_0xf997('0xa7')][_0xf997('0x49')]){return _0x53489e[_0xf997('0xbc')][_0xf997('0xa7')][0x0];}return db[_0xf997('0xa6')][_0xf997('0x5b')](_[_0xf997('0x16')](_0x577a98[_0xf997('0x61')],{'firstName':_0xf32467,'mobile':_0xf32467,'phone':_0xf32467,'ListId':_0x53489e[_0xf997('0xbd')]}));}})['then'](handleEntityNotFound(_0x4c36c8,null))[_0xf997('0x1e')](function(_0x5b9203){if(_0x5b9203){_0x29006d=_0x5b9203;return db[_0xf997('0xbe')]['find']({'where':{'ContactId':_0x29006d['id'],'closed':![],'WhatsappAccountId':_0x53489e['id']}})[_0xf997('0x1e')](function(_0x313d8b){if(_0x313d8b){return[_0x313d8b,![]];}return db[_0xf997('0xbe')][_0xf997('0x5b')]({'UserId':_0x577a98['user']['id'],'ContactId':_0x29006d['id'],'WhatsappAccountId':_0x53489e['id'],'phone':_0xf32467,'firstMsgDirection':_0xf997('0xbf'),'Messages':[_[_0xf997('0x51')](_0x577a98[_0xf997('0x61')],{'read':![],'body':_0x577a98[_0xf997('0x61')][_0xf997('0x61')],'phone':_0xf32467,'WhatsappAccountId':_0x53489e['id'],'UserId':_0x577a98[_0xf997('0xc0')]['id'],'ContactId':_0x29006d['id']})]},{'include':[{'model':db[_0xf997('0x8a')],'as':_0xf997('0xc1')}]})[_0xf997('0x1e')](function(_0x316e7d){return[_0x316e7d,!![]];});});}})[_0xf997('0xc2')](function(_0x2fdce1,_0x159aa7){if(_0x159aa7){return _0x2fdce1;}return db['WhatsappMessage']['create'](_['merge'](_0x577a98[_0xf997('0x61')],{'read':![],'body':_0x577a98[_0xf997('0x61')][_0xf997('0x61')],'phone':_0xf32467,'WhatsappAccountId':_0x53489e['id'],'WhatsappInteractionId':_0x2fdce1['id'],'UserId':_0x577a98[_0xf997('0xc0')]['id'],'ContactId':_0x29006d['id']}))[_0xf997('0x1e')](function(_0x27199b){_0x2fdce1['dataValues'][_0xf997('0xc1')]=[];_0x2fdce1['dataValues'][_0xf997('0xc1')][_0xf997('0xc3')](_0x27199b[_0xf997('0xc4')]);return _0x2fdce1;});})['then'](respondWithResult(_0x4c36c8,null))[_0xf997('0x28')](handleError(_0x4c36c8,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 00f0ca7..7a249c4 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 _0x049f=['emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0xf2d528,_0x343634){var _0x50d825=function(_0x4558cf){while(--_0x4558cf){_0xf2d528['push'](_0xf2d528['shift']());}};_0x50d825(++_0x343634);}(_0x049f,0x19d));var _0xf049=function(_0x2ad1b8,_0x1ea09b){_0x2ad1b8=_0x2ad1b8-0x0;var _0x52547d=_0x049f[_0x2ad1b8];return _0x52547d;};'use strict';var EventEmitter=require(_0xf049('0x0'));var WhatsappAccount=require(_0xf049('0x1'))['db'][_0xf049('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf049('0x3')](0x0);var events={'afterCreate':_0xf049('0x4'),'afterUpdate':_0xf049('0x5'),'afterDestroy':_0xf049('0x6')};function emitEvent(_0xf23ecb){return function(_0xe52806,_0x42e4de,_0x3423f7){WhatsappAccountEvents[_0xf049('0x7')](_0xf23ecb+':'+_0xe52806['id'],_0xe52806);WhatsappAccountEvents[_0xf049('0x7')](_0xf23ecb,_0xe52806);_0x3423f7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xf049('0x8')](e,emitEvent(event));}}module[_0xf049('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x4ff7=['update','emit','hasOwnProperty','hook','exports','WhatsappAccount'];(function(_0x36e1f1,_0x22226c){var _0xec8678=function(_0x33606f){while(--_0x33606f){_0x36e1f1['push'](_0x36e1f1['shift']());}};_0xec8678(++_0x22226c);}(_0x4ff7,0x89));var _0x74ff=function(_0x48e86c,_0x9f034d){_0x48e86c=_0x48e86c-0x0;var _0x54fa11=_0x4ff7[_0x48e86c];return _0x54fa11;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x74ff('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x74ff('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4f7aa0){return function(_0x48f638,_0x2af8e5,_0x26f30d){WhatsappAccountEvents[_0x74ff('0x2')](_0x4f7aa0+':'+_0x48f638['id'],_0x48f638);WhatsappAccountEvents[_0x74ff('0x2')](_0x4f7aa0,_0x48f638);_0x26f30d(null);};}for(var e in events){if(events[_0x74ff('0x3')](e)){var event=events[e];WhatsappAccount[_0x74ff('0x4')](e,emitEvent(event));}}module[_0x74ff('0x5')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 23218cb..4de71e7 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 _0x4969=['define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x4508f4,_0x256f39){var _0x510b2d=function(_0x4a3fc6){while(--_0x4a3fc6){_0x4508f4['push'](_0x4508f4['shift']());}};_0x510b2d(++_0x256f39);}(_0x4969,0xc2));var _0x9496=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0x4969[_0x3b1e3f];return _0x3b1cd3;};'use strict';var _=require(_0x9496('0x0'));var util=require(_0x9496('0x1'));var logger=require(_0x9496('0x2'))(_0x9496('0x3'));var moment=require(_0x9496('0x4'));var BPromise=require('bluebird');var rp=require(_0x9496('0x5'));var fs=require('fs');var path=require(_0x9496('0x6'));var rimraf=require('rimraf');var config=require(_0x9496('0x7'));var attributes=require(_0x9496('0x8'));module[_0x9496('0x9')]=function(_0x4af4ff,_0x25eadb){return _0x4af4ff[_0x9496('0xa')]('WhatsappAccount',attributes,{'tableName':_0x9496('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3bd=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xf5140e,_0x29d181){var _0xd98a9f=function(_0x40e74b){while(--_0x40e74b){_0xf5140e['push'](_0xf5140e['shift']());}};_0xd98a9f(++_0x29d181);}(_0xa3bd,0x147));var _0xda3b=function(_0x3d3171,_0x94e926){_0x3d3171=_0x3d3171-0x0;var _0x2247b4=_0xa3bd[_0x3d3171];return _0x2247b4;};'use strict';var _=require(_0xda3b('0x0'));var util=require(_0xda3b('0x1'));var logger=require(_0xda3b('0x2'))(_0xda3b('0x3'));var moment=require(_0xda3b('0x4'));var BPromise=require(_0xda3b('0x5'));var rp=require(_0xda3b('0x6'));var fs=require('fs');var path=require(_0xda3b('0x7'));var rimraf=require('rimraf');var config=require(_0xda3b('0x8'));var attributes=require(_0xda3b('0x9'));module[_0xda3b('0xa')]=function(_0x57e449,_0xab751c){return _0x57e449[_0xda3b('0xb')](_0xda3b('0xc'),attributes,{'tableName':_0xda3b('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 68d3fb8..249e668 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 _0x9766=['attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','include','map','model'];(function(_0x4ff541,_0x2ec4d7){var _0xab813a=function(_0x34a5f3){while(--_0x34a5f3){_0x4ff541['push'](_0x4ff541['shift']());}};_0xab813a(++_0x2ec4d7);}(_0x9766,0x1ef));var _0x6976=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x9766[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0x6976('0x0'));var util=require(_0x6976('0x1'));var moment=require('moment');var BPromise=require(_0x6976('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6976('0x3'));var db=require(_0x6976('0x4'))['db'];var utils=require(_0x6976('0x5'));var logger=require(_0x6976('0x6'))(_0x6976('0x7'));var config=require(_0x6976('0x8'));var jayson=require(_0x6976('0x9'));var client=jayson[_0x6976('0xa')][_0x6976('0xb')]({'port':0x232a});config[_0x6976('0xc')]=_['defaults'](config[_0x6976('0xc')],{'host':_0x6976('0xd'),'port':0x18eb});var socket=require(_0x6976('0xe'))(new Redis(config[_0x6976('0xc')]));require(_0x6976('0xf'))[_0x6976('0x10')](socket);function respondWithRpcPromise(_0xc3c952,_0x48618e,_0x1e84d9){return new BPromise(function(_0x2ffc49,_0x253f78){return client['request'](_0xc3c952,_0x1e84d9)[_0x6976('0x11')](function(_0x5b2c30){logger[_0x6976('0x12')](_0x6976('0x13'),_0x48618e,'request\x20sent');logger[_0x6976('0x14')](_0x6976('0x15'),_0x48618e,_0x6976('0x16'),JSON[_0x6976('0x17')](_0x5b2c30));if(_0x5b2c30['error']){if(_0x5b2c30[_0x6976('0x18')][_0x6976('0x19')]===0x1f4){logger[_0x6976('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x48618e,_0x5b2c30[_0x6976('0x18')][_0x6976('0x1a')]);return _0x253f78(_0x5b2c30[_0x6976('0x18')][_0x6976('0x1a')]);}logger[_0x6976('0x18')](_0x6976('0x13'),_0x48618e,_0x5b2c30[_0x6976('0x18')]['message']);return _0x2ffc49(_0x5b2c30[_0x6976('0x18')][_0x6976('0x1a')]);}else{logger[_0x6976('0x12')](_0x6976('0x13'),_0x48618e,_0x6976('0x16'));_0x2ffc49(_0x5b2c30[_0x6976('0x1b')][_0x6976('0x1a')]);}})[_0x6976('0x1c')](function(_0x4ee094){logger[_0x6976('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x48618e,_0x4ee094);_0x253f78(_0x4ee094);});});}exports[_0x6976('0x1d')]=function(_0x411c58){var _0x113f30=this;return new Promise(function(_0x160d5e,_0x10b76a){return db[_0x6976('0x1e')]['find']({'raw':_0x411c58[_0x6976('0x1f')]?_0x411c58[_0x6976('0x1f')][_0x6976('0x20')]===undefined?!![]:![]:!![],'where':_0x411c58[_0x6976('0x1f')]?_0x411c58['options'][_0x6976('0x21')]||null:null,'attributes':_0x411c58[_0x6976('0x1f')]?_0x411c58[_0x6976('0x1f')]['attributes']||null:null,'include':_0x411c58[_0x6976('0x1f')]?_0x411c58[_0x6976('0x1f')][_0x6976('0x22')]?_[_0x6976('0x23')](_0x411c58['options'][_0x6976('0x22')],function(_0x31e583){return{'model':db[_0x31e583[_0x6976('0x24')]],'as':_0x31e583['as'],'attributes':_0x31e583[_0x6976('0x25')],'include':_0x31e583['include']?_[_0x6976('0x23')](_0x31e583['include'],function(_0x5ae014){return{'model':db[_0x5ae014['model']],'as':_0x5ae014['as'],'attributes':_0x5ae014[_0x6976('0x25')],'include':_0x5ae014[_0x6976('0x22')]?_[_0x6976('0x23')](_0x5ae014[_0x6976('0x22')],function(_0x4ac332){return{'model':db[_0x4ac332[_0x6976('0x24')]],'as':_0x4ac332['as'],'attributes':_0x4ac332['attributes']};}):[]};}):[]};}):[]:[]})[_0x6976('0x11')](function(_0x129064){logger[_0x6976('0x12')](_0x6976('0x1d'),_0x411c58);logger[_0x6976('0x14')]('ShowWhatsappAccount',_0x411c58,JSON['stringify'](_0x129064));_0x160d5e(_0x129064);})['catch'](function(_0x280502){logger[_0x6976('0x18')](_0x6976('0x1d'),_0x280502[_0x6976('0x1a')],_0x411c58);_0x10b76a(_0x113f30[_0x6976('0x18')](0x1f4,_0x280502[_0x6976('0x1a')]));});});}; \ No newline at end of file +var _0xa73a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','register','request','info','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','WhatsappAccount','find','options','raw','where','attributes','include','model','map','then','ShowWhatsappAccount','debug','util','bluebird'];(function(_0x5ba913,_0x107ddf){var _0x255f3c=function(_0x3fd31f){while(--_0x3fd31f){_0x5ba913['push'](_0x5ba913['shift']());}};_0x255f3c(++_0x107ddf);}(_0xa73a,0xe5));var _0xaa73=function(_0x14e1cb,_0xd3465e){_0x14e1cb=_0x14e1cb-0x0;var _0x18a337=_0xa73a[_0x14e1cb];return _0x18a337;};'use strict';var _=require('lodash');var util=require(_0xaa73('0x0'));var moment=require('moment');var BPromise=require(_0xaa73('0x1'));var rs=require(_0xaa73('0x2'));var fs=require('fs');var Redis=require(_0xaa73('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa73('0x4'));var logger=require(_0xaa73('0x5'))(_0xaa73('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaa73('0x7')][_0xaa73('0x8')]({'port':0x232a});config[_0xaa73('0x9')]=_[_0xaa73('0xa')](config[_0xaa73('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa73('0xb'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xaa73('0xc')](socket);function respondWithRpcPromise(_0x964748,_0x20bc2a,_0x4fca16){return new BPromise(function(_0x20c963,_0x40bd52){return client[_0xaa73('0xd')](_0x964748,_0x4fca16)['then'](function(_0x5d5d02){logger[_0xaa73('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x20bc2a,_0xaa73('0xf'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x20bc2a,'request\x20sent',JSON[_0xaa73('0x10')](_0x5d5d02));if(_0x5d5d02[_0xaa73('0x11')]){if(_0x5d5d02[_0xaa73('0x11')]['code']===0x1f4){logger[_0xaa73('0x11')](_0xaa73('0x12'),_0x20bc2a,_0x5d5d02[_0xaa73('0x11')]['message']);return _0x40bd52(_0x5d5d02[_0xaa73('0x11')]['message']);}logger['error'](_0xaa73('0x12'),_0x20bc2a,_0x5d5d02['error'][_0xaa73('0x13')]);return _0x20c963(_0x5d5d02[_0xaa73('0x11')][_0xaa73('0x13')]);}else{logger['info'](_0xaa73('0x12'),_0x20bc2a,_0xaa73('0xf'));_0x20c963(_0x5d5d02['result'][_0xaa73('0x13')]);}})[_0xaa73('0x14')](function(_0x3025fe){logger[_0xaa73('0x11')](_0xaa73('0x12'),_0x20bc2a,_0x3025fe);_0x40bd52(_0x3025fe);});});}exports['ShowWhatsappAccount']=function(_0x4787d2){var _0xaebd8e=this;return new Promise(function(_0x47c7cf,_0x1ada06){return db[_0xaa73('0x15')][_0xaa73('0x16')]({'raw':_0x4787d2[_0xaa73('0x17')]?_0x4787d2[_0xaa73('0x17')][_0xaa73('0x18')]===undefined?!![]:![]:!![],'where':_0x4787d2[_0xaa73('0x17')]?_0x4787d2[_0xaa73('0x17')][_0xaa73('0x19')]||null:null,'attributes':_0x4787d2['options']?_0x4787d2[_0xaa73('0x17')][_0xaa73('0x1a')]||null:null,'include':_0x4787d2[_0xaa73('0x17')]?_0x4787d2[_0xaa73('0x17')][_0xaa73('0x1b')]?_['map'](_0x4787d2[_0xaa73('0x17')][_0xaa73('0x1b')],function(_0x554b6f){return{'model':db[_0x554b6f[_0xaa73('0x1c')]],'as':_0x554b6f['as'],'attributes':_0x554b6f[_0xaa73('0x1a')],'include':_0x554b6f['include']?_['map'](_0x554b6f['include'],function(_0x263d43){return{'model':db[_0x263d43['model']],'as':_0x263d43['as'],'attributes':_0x263d43[_0xaa73('0x1a')],'include':_0x263d43[_0xaa73('0x1b')]?_[_0xaa73('0x1d')](_0x263d43['include'],function(_0x3f808a){return{'model':db[_0x3f808a[_0xaa73('0x1c')]],'as':_0x3f808a['as'],'attributes':_0x3f808a[_0xaa73('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xaa73('0x1e')](function(_0x24b65c){logger[_0xaa73('0xe')](_0xaa73('0x1f'),_0x4787d2);logger[_0xaa73('0x20')](_0xaa73('0x1f'),_0x4787d2,JSON[_0xaa73('0x10')](_0x24b65c));_0x47c7cf(_0x24b65c);})[_0xaa73('0x14')](function(_0x40c64f){logger[_0xaa73('0x11')]('ShowWhatsappAccount',_0x40c64f['message'],_0x4787d2);_0x1ada06(_0xaebd8e['error'](0x1f4,_0x40c64f[_0xaa73('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 51acdbe..02a697c 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 _0x0dcb=['update','emit','removeListener','save','remove'];(function(_0x51f2c3,_0x3d4501){var _0x4a3cee=function(_0x2547f5){while(--_0x2547f5){_0x51f2c3['push'](_0x51f2c3['shift']());}};_0x4a3cee(++_0x3d4501);}(_0x0dcb,0xe9));var _0xb0dc=function(_0x1da08f,_0x4c155d){_0x1da08f=_0x1da08f-0x0;var _0x35856b=_0x0dcb[_0x1da08f];return _0x35856b;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xb0dc('0x0'),_0xb0dc('0x1'),_0xb0dc('0x2')];function createListener(_0x2ef796,_0x16542c){return function(_0x193b44){_0x16542c[_0xb0dc('0x3')](_0x2ef796,_0x193b44);};}function removeListener(_0xfd3935,_0x123dbc){return function(){WhatsappAccountEvents[_0xb0dc('0x4')](_0xfd3935,_0x123dbc);};}exports['register']=function(_0x4346dc){for(var _0x56a1a3=0x0,_0x36c6bc=events['length'];_0x56a1a3<_0x36c6bc;_0x56a1a3++){var _0x2733cf=events[_0x56a1a3];var _0xbfe5ca=createListener('whatsappAccount:'+_0x2733cf,_0x4346dc);WhatsappAccountEvents['on'](_0x2733cf,_0xbfe5ca);}}; \ No newline at end of file +var _0x6f7f=['remove','update','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x30aae7,_0x44d802){var _0x4a66f1=function(_0x55dd54){while(--_0x55dd54){_0x30aae7['push'](_0x30aae7['shift']());}};_0x4a66f1(++_0x44d802);}(_0x6f7f,0xfb));var _0xf6f7=function(_0x15d427,_0x13092e){_0x15d427=_0x15d427-0x0;var _0x38db75=_0x6f7f[_0x15d427];return _0x38db75;};'use strict';var WhatsappAccountEvents=require(_0xf6f7('0x0'));var events=['save',_0xf6f7('0x1'),_0xf6f7('0x2')];function createListener(_0x341e68,_0x4963e3){return function(_0x3021d4){_0x4963e3[_0xf6f7('0x3')](_0x341e68,_0x3021d4);};}function removeListener(_0x46cd95,_0x50f299){return function(){WhatsappAccountEvents[_0xf6f7('0x4')](_0x46cd95,_0x50f299);};}exports['register']=function(_0x15a2c2){for(var _0x3b66c9=0x0,_0x60a90b=events[_0xf6f7('0x5')];_0x3b66c9<_0x60a90b;_0x3b66c9++){var _0x1cb57f=events[_0x3b66c9];var _0x47b413=createListener(_0xf6f7('0x6')+_0x1cb57f,_0x15a2c2);WhatsappAccountEvents['on'](_0x1cb57f,_0x47b413);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c3f2c18..b02a8b7 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 _0xeba5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express','fs-extra'];(function(_0x50ca2e,_0x3294ee){var _0x8a58c5=function(_0x6f29aa){while(--_0x6f29aa){_0x50ca2e['push'](_0x50ca2e['shift']());}};_0x8a58c5(++_0x3294ee);}(_0xeba5,0x119));var _0x5eba=function(_0x1a4fca,_0x17330b){_0x1a4fca=_0x1a4fca-0x0;var _0x2905aa=_0xeba5[_0x1a4fca];return _0x2905aa;};'use strict';var multer=require('multer');var util=require(_0x5eba('0x0'));var path=require('path');var timeout=require(_0x5eba('0x1'));var express=require(_0x5eba('0x2'));var router=express['Router']();var fs_extra=require(_0x5eba('0x3'));var auth=require(_0x5eba('0x4'));var interaction=require(_0x5eba('0x5'));var config=require(_0x5eba('0x6'));var controller=require(_0x5eba('0x7'));router[_0x5eba('0x8')]('/',auth[_0x5eba('0x9')](),controller[_0x5eba('0xa')]);router['get'](_0x5eba('0xb'),auth[_0x5eba('0x9')](),controller[_0x5eba('0xc')]);router[_0x5eba('0xd')]('/',auth['isAuthenticated'](),controller[_0x5eba('0xe')]);router[_0x5eba('0xf')](_0x5eba('0xb'),auth[_0x5eba('0x9')](),controller[_0x5eba('0x10')]);router[_0x5eba('0x11')](_0x5eba('0xb'),auth[_0x5eba('0x9')](),controller['destroy']);module[_0x5eba('0x12')]=router; \ No newline at end of file +var _0xc23a=['../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4b0342,_0x5b071c){var _0xc62aa3=function(_0x501b2e){while(--_0x501b2e){_0x4b0342['push'](_0x4b0342['shift']());}};_0xc62aa3(++_0x5b071c);}(_0xc23a,0xa3));var _0xac23=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0xc23a[_0xea35d1];return _0x1d7a7c;};'use strict';var multer=require(_0xac23('0x0'));var util=require(_0xac23('0x1'));var path=require(_0xac23('0x2'));var timeout=require(_0xac23('0x3'));var express=require(_0xac23('0x4'));var router=express[_0xac23('0x5')]();var fs_extra=require(_0xac23('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xac23('0x7'));var config=require(_0xac23('0x8'));var controller=require(_0xac23('0x9'));router[_0xac23('0xa')]('/',auth[_0xac23('0xb')](),controller[_0xac23('0xc')]);router[_0xac23('0xa')]('/:id',auth[_0xac23('0xb')](),controller[_0xac23('0xd')]);router[_0xac23('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xac23('0xf')](_0xac23('0x10'),auth[_0xac23('0xb')](),controller['update']);router[_0xac23('0x11')](_0xac23('0x10'),auth[_0xac23('0xb')](),controller['destroy']);module[_0xac23('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 06f1257..d5b2fd7 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 _0xe4a7=['TEXT','*,*,*,*','INTEGER','STRING','noop'];(function(_0x116ac9,_0x57a46b){var _0x2ca152=function(_0x46ed51){while(--_0x46ed51){_0x116ac9['push'](_0x116ac9['shift']());}};_0x2ca152(++_0x57a46b);}(_0xe4a7,0x19c));var _0x7e4a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe4a7[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7e4a('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7e4a('0x1')],'allowNull':![],'defaultValue':_0x7e4a('0x2')},'appdata':{'type':Sequelize[_0x7e4a('0x3')]()},'description':{'type':Sequelize[_0x7e4a('0x1')]},'interval':{'type':Sequelize[_0x7e4a('0x1')],'defaultValue':_0x7e4a('0x4')}}; \ No newline at end of file +var _0xf917=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x19c647,_0x4b3c6e){var _0x464cbf=function(_0x1ddca5){while(--_0x1ddca5){_0x19c647['push'](_0x19c647['shift']());}};_0x464cbf(++_0x4b3c6e);}(_0xf917,0x176));var _0x7f91=function(_0xdbff26,_0xfc8995){_0xdbff26=_0xdbff26-0x0;var _0x4adb23=_0xf917[_0xdbff26];return _0x4adb23;};'use strict';var Sequelize=require('sequelize');module[_0x7f91('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7f91('0x1')],'allowNull':![],'defaultValue':_0x7f91('0x2')},'appdata':{'type':Sequelize[_0x7f91('0x3')]()},'description':{'type':Sequelize[_0x7f91('0x1')]},'interval':{'type':Sequelize[_0x7f91('0x1')],'defaultValue':_0x7f91('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4449b72..0becf78 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 _0x1fa9=['includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fa9,0x136));var _0x91fa=function(_0x467776,_0x47045d){_0x467776=_0x467776-0x0;var _0x455ddb=_0x1fa9[_0x467776];return _0x455ddb;};'use strict';var emlformat=require(_0x91fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91fa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91fa('0x2'));var moment=require(_0x91fa('0x3'));var BPromise=require(_0x91fa('0x4'));var Mustache=require('mustache');var util=require(_0x91fa('0x5'));var path=require(_0x91fa('0x6'));var sox=require(_0x91fa('0x7'));var csv=require(_0x91fa('0x8'));var ejs=require(_0x91fa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91fa('0xa'));var squel=require(_0x91fa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x91fa('0xc'));var toCsv=require(_0x91fa('0x8'));var querystring=require(_0x91fa('0xd'));var Papa=require(_0x91fa('0xe'));var Redis=require(_0x91fa('0xf'));var authService=require(_0x91fa('0x10'));var qs=require(_0x91fa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x91fa('0x12'))(_0x91fa('0x13'));var utils=require(_0x91fa('0x14'));var config=require(_0x91fa('0x15'));var licenseUtil=require(_0x91fa('0x16'));var db=require(_0x91fa('0x17'))['db'];function respondWithStatusCode(_0x1bdb51,_0x578035){_0x578035=_0x578035||0xcc;return function(_0x5a904d){if(_0x5a904d){return _0x1bdb51['sendStatus'](_0x578035);}return _0x1bdb51[_0x91fa('0x18')](_0x578035)['end']();};}function respondWithResult(_0x5f215d,_0x4d95f5){_0x4d95f5=_0x4d95f5||0xc8;return function(_0x4650bf){if(_0x4650bf){return _0x5f215d[_0x91fa('0x18')](_0x4d95f5)['json'](_0x4650bf);}};}function respondWithFilteredResult(_0x308812,_0x252ec7){return function(_0x74c75d){if(_0x74c75d){var _0x2667da=typeof _0x252ec7[_0x91fa('0x19')]===_0x91fa('0x1a')&&typeof _0x252ec7['limit']===_0x91fa('0x1a');var _0x17c4d4=_0x74c75d[_0x91fa('0x1b')];var _0x3916cc=_0x2667da?0x0:_0x252ec7[_0x91fa('0x19')];var _0x4dcbcf=_0x2667da?_0x74c75d[_0x91fa('0x1b')]:_0x252ec7[_0x91fa('0x19')]+_0x252ec7[_0x91fa('0x1c')];var _0x1e3d6f;if(_0x4dcbcf>=_0x17c4d4){_0x4dcbcf=_0x17c4d4;_0x1e3d6f=0xc8;}else{_0x1e3d6f=0xce;}_0x308812[_0x91fa('0x18')](_0x1e3d6f);return _0x308812[_0x91fa('0x1d')](_0x91fa('0x1e'),_0x3916cc+'-'+_0x4dcbcf+'/'+_0x17c4d4)[_0x91fa('0x1f')](_0x74c75d);}return null;};}function patchUpdates(_0xba1e97){return function(_0x274d6f){try{jsonpatch[_0x91fa('0x20')](_0x274d6f,_0xba1e97,!![]);}catch(_0x4a8f08){return BPromise[_0x91fa('0x21')](_0x4a8f08);}return _0x274d6f[_0x91fa('0x22')]();};}function saveUpdates(_0x4ac68d,_0x1a6480){return function(_0x50596c){if(_0x50596c){return _0x50596c[_0x91fa('0x23')](_0x4ac68d)['then'](function(_0x4e619c){return _0x4e619c;});}return null;};}function removeEntity(_0x5d89f9,_0x2ed86d){return function(_0x6d4e53){if(_0x6d4e53){return _0x6d4e53[_0x91fa('0x24')]()[_0x91fa('0x25')](function(){_0x5d89f9[_0x91fa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3048c4,_0xb7a98){return function(_0x252c71){if(!_0x252c71){_0x3048c4[_0x91fa('0x26')](0x194);}return _0x252c71;};}function handleError(_0x4b0090,_0x5a9554){_0x5a9554=_0x5a9554||0x1f4;return function(_0x2aa3d7){logger[_0x91fa('0x27')](_0x2aa3d7[_0x91fa('0x28')]);if(_0x2aa3d7[_0x91fa('0x29')]){delete _0x2aa3d7[_0x91fa('0x29')];}_0x4b0090['status'](_0x5a9554)[_0x91fa('0x2a')](_0x2aa3d7);};}exports[_0x91fa('0x2b')]=function(_0x402884,_0x5601c4){var _0x518cae={},_0x342670={},_0x45a0e8={'count':0x0,'rows':[]};var _0x3ec667=_[_0x91fa('0x2c')](db[_0x91fa('0x2d')][_0x91fa('0x2e')],function(_0x27ed0e){return{'name':_0x27ed0e[_0x91fa('0x2f')],'type':_0x27ed0e[_0x91fa('0x30')][_0x91fa('0x31')]};});_0x342670[_0x91fa('0x32')]=_['map'](_0x3ec667,'name');_0x342670[_0x91fa('0x33')]=_[_0x91fa('0x34')](_0x402884[_0x91fa('0x33')]);_0x342670[_0x91fa('0x35')]=_[_0x91fa('0x36')](_0x342670[_0x91fa('0x32')],_0x342670['query']);_0x518cae[_0x91fa('0x37')]=_[_0x91fa('0x36')](_0x342670[_0x91fa('0x32')],qs[_0x91fa('0x38')](_0x402884[_0x91fa('0x33')][_0x91fa('0x38')]));_0x518cae[_0x91fa('0x37')]=_0x518cae[_0x91fa('0x37')]['length']?_0x518cae['attributes']:_0x342670[_0x91fa('0x32')];if(!_0x402884[_0x91fa('0x33')]['hasOwnProperty'](_0x91fa('0x39'))){_0x518cae['limit']=qs['limit'](_0x402884[_0x91fa('0x33')][_0x91fa('0x1c')]);_0x518cae[_0x91fa('0x19')]=qs['offset'](_0x402884[_0x91fa('0x33')][_0x91fa('0x19')]);}_0x518cae[_0x91fa('0x3a')]=qs[_0x91fa('0x3b')](_0x402884[_0x91fa('0x33')][_0x91fa('0x3b')]);_0x518cae[_0x91fa('0x3c')]=qs['filters'](_[_0x91fa('0x3d')](_0x402884[_0x91fa('0x33')],_0x342670['filters']),_0x3ec667);if(_0x402884['query'][_0x91fa('0x3e')]){_0x518cae[_0x91fa('0x3c')]=_['merge'](_0x518cae[_0x91fa('0x3c')],{'$or':_[_0x91fa('0x2c')](_0x3ec667,function(_0x4baaf3){if(_0x4baaf3[_0x91fa('0x30')]!=='VIRTUAL'){var _0x5846ee={};_0x5846ee[_0x4baaf3[_0x91fa('0x29')]]={'$like':'%'+_0x402884[_0x91fa('0x33')]['filter']+'%'};return _0x5846ee;}})});}_0x518cae=_[_0x91fa('0x3f')]({},_0x518cae,_0x402884[_0x91fa('0x40')]);var _0x5e4495={'where':_0x518cae[_0x91fa('0x3c')]};return db['WhatsappApplication'][_0x91fa('0x1b')](_0x5e4495)['then'](function(_0x396a91){_0x45a0e8['count']=_0x396a91;if(_0x402884[_0x91fa('0x33')][_0x91fa('0x41')]){_0x518cae[_0x91fa('0x42')]=[{'all':!![]}];}return db[_0x91fa('0x2d')]['findAll'](_0x518cae);})[_0x91fa('0x25')](function(_0x337c8b){_0x45a0e8[_0x91fa('0x43')]=_0x337c8b;return _0x45a0e8;})[_0x91fa('0x25')](respondWithFilteredResult(_0x5601c4,_0x518cae))[_0x91fa('0x44')](handleError(_0x5601c4,null));};exports[_0x91fa('0x45')]=function(_0x5dad2e,_0x382fb5){var _0x47bd8a={'raw':!![],'where':{'id':_0x5dad2e[_0x91fa('0x46')]['id']}},_0x4cdd67={};_0x4cdd67[_0x91fa('0x32')]=_[_0x91fa('0x34')](db[_0x91fa('0x2d')][_0x91fa('0x2e')]);_0x4cdd67[_0x91fa('0x33')]=_[_0x91fa('0x34')](_0x5dad2e['query']);_0x4cdd67[_0x91fa('0x35')]=_['intersection'](_0x4cdd67[_0x91fa('0x32')],_0x4cdd67[_0x91fa('0x33')]);_0x47bd8a[_0x91fa('0x37')]=_[_0x91fa('0x36')](_0x4cdd67[_0x91fa('0x32')],qs[_0x91fa('0x38')](_0x5dad2e[_0x91fa('0x33')][_0x91fa('0x38')]));_0x47bd8a[_0x91fa('0x37')]=_0x47bd8a[_0x91fa('0x37')][_0x91fa('0x47')]?_0x47bd8a[_0x91fa('0x37')]:_0x4cdd67[_0x91fa('0x32')];if(_0x5dad2e[_0x91fa('0x33')][_0x91fa('0x41')]){_0x47bd8a['include']=[{'all':!![]}];}_0x47bd8a=_[_0x91fa('0x3f')]({},_0x47bd8a,_0x5dad2e[_0x91fa('0x40')]);return db[_0x91fa('0x2d')][_0x91fa('0x48')](_0x47bd8a)[_0x91fa('0x25')](handleEntityNotFound(_0x382fb5,null))[_0x91fa('0x25')](respondWithResult(_0x382fb5,null))[_0x91fa('0x44')](handleError(_0x382fb5,null));};exports[_0x91fa('0x49')]=function(_0x50aa1b,_0x3c554c){return db[_0x91fa('0x2d')][_0x91fa('0x49')](_0x50aa1b[_0x91fa('0x4a')],{})['then'](respondWithResult(_0x3c554c,0xc9))[_0x91fa('0x44')](handleError(_0x3c554c,null));};exports[_0x91fa('0x23')]=function(_0x27645d,_0x3f8ad7){if(_0x27645d[_0x91fa('0x4a')]['id']){delete _0x27645d['body']['id'];}return db[_0x91fa('0x2d')]['find']({'where':{'id':_0x27645d[_0x91fa('0x46')]['id']}})[_0x91fa('0x25')](handleEntityNotFound(_0x3f8ad7,null))[_0x91fa('0x25')](saveUpdates(_0x27645d[_0x91fa('0x4a')],null))[_0x91fa('0x25')](respondWithResult(_0x3f8ad7,null))[_0x91fa('0x44')](handleError(_0x3f8ad7,null));};exports[_0x91fa('0x24')]=function(_0x6c02b9,_0x36f280){return db[_0x91fa('0x2d')][_0x91fa('0x48')]({'where':{'id':_0x6c02b9['params']['id']}})[_0x91fa('0x25')](handleEntityNotFound(_0x36f280,null))['then'](removeEntity(_0x36f280,null))['catch'](handleError(_0x36f280,null));}; \ No newline at end of file +var _0x9b09=['create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','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','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','catch','include','find'];(function(_0x3d737,_0x4d5ad3){var _0x1f4162=function(_0x595916){while(--_0x595916){_0x3d737['push'](_0x3d737['shift']());}};_0x1f4162(++_0x4d5ad3);}(_0x9b09,0x1ad));var _0x99b0=function(_0x155bbf,_0x1bca34){_0x155bbf=_0x155bbf-0x0;var _0x1cb0ac=_0x9b09[_0x155bbf];return _0x1cb0ac;};'use strict';var emlformat=require(_0x99b0('0x0'));var rimraf=require(_0x99b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99b0('0x2'));var rp=require(_0x99b0('0x3'));var moment=require('moment');var BPromise=require(_0x99b0('0x4'));var Mustache=require('mustache');var util=require(_0x99b0('0x5'));var path=require('path');var sox=require(_0x99b0('0x6'));var csv=require(_0x99b0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99b0('0x8'));var _=require(_0x99b0('0x9'));var squel=require('squel');var crypto=require(_0x99b0('0xa'));var jsforce=require(_0x99b0('0xb'));var deskjs=require(_0x99b0('0xc'));var toCsv=require(_0x99b0('0x7'));var querystring=require(_0x99b0('0xd'));var Papa=require('papaparse');var Redis=require(_0x99b0('0xe'));var authService=require(_0x99b0('0xf'));var qs=require(_0x99b0('0x10'));var as=require(_0x99b0('0x11'));var hardwareService=require(_0x99b0('0x12'));var logger=require('../../config/logger')(_0x99b0('0x13'));var utils=require(_0x99b0('0x14'));var config=require(_0x99b0('0x15'));var licenseUtil=require(_0x99b0('0x16'));var db=require(_0x99b0('0x17'))['db'];function respondWithStatusCode(_0x42be76,_0x57d64d){_0x57d64d=_0x57d64d||0xcc;return function(_0x256c0b){if(_0x256c0b){return _0x42be76['sendStatus'](_0x57d64d);}return _0x42be76[_0x99b0('0x18')](_0x57d64d)[_0x99b0('0x19')]();};}function respondWithResult(_0x5baf0c,_0x5bba73){_0x5bba73=_0x5bba73||0xc8;return function(_0x27142a){if(_0x27142a){return _0x5baf0c[_0x99b0('0x18')](_0x5bba73)[_0x99b0('0x1a')](_0x27142a);}};}function respondWithFilteredResult(_0x590aa4,_0x4cfd10){return function(_0x4a6b01){if(_0x4a6b01){var _0x2e176f=typeof _0x4cfd10[_0x99b0('0x1b')]==='undefined'&&typeof _0x4cfd10[_0x99b0('0x1c')]===_0x99b0('0x1d');var _0xaa1009=_0x4a6b01[_0x99b0('0x1e')];var _0x1cb302=_0x2e176f?0x0:_0x4cfd10[_0x99b0('0x1b')];var _0x193512=_0x2e176f?_0x4a6b01['count']:_0x4cfd10[_0x99b0('0x1b')]+_0x4cfd10[_0x99b0('0x1c')];var _0x1fb89b;if(_0x193512>=_0xaa1009){_0x193512=_0xaa1009;_0x1fb89b=0xc8;}else{_0x1fb89b=0xce;}_0x590aa4[_0x99b0('0x18')](_0x1fb89b);return _0x590aa4[_0x99b0('0x1f')](_0x99b0('0x20'),_0x1cb302+'-'+_0x193512+'/'+_0xaa1009)[_0x99b0('0x1a')](_0x4a6b01);}return null;};}function patchUpdates(_0x1783ca){return function(_0x310894){try{jsonpatch[_0x99b0('0x21')](_0x310894,_0x1783ca,!![]);}catch(_0x3988c4){return BPromise[_0x99b0('0x22')](_0x3988c4);}return _0x310894[_0x99b0('0x23')]();};}function saveUpdates(_0x1d5f41,_0x462af1){return function(_0x93dcb1){if(_0x93dcb1){return _0x93dcb1[_0x99b0('0x24')](_0x1d5f41)[_0x99b0('0x25')](function(_0x1d7022){return _0x1d7022;});}return null;};}function removeEntity(_0x27b238,_0x35bae9){return function(_0x28f11d){if(_0x28f11d){return _0x28f11d[_0x99b0('0x26')]()[_0x99b0('0x25')](function(){_0x27b238['status'](0xcc)[_0x99b0('0x19')]();});}};}function handleEntityNotFound(_0x4a6c0f,_0x55f4f1){return function(_0x34075a){if(!_0x34075a){_0x4a6c0f[_0x99b0('0x27')](0x194);}return _0x34075a;};}function handleError(_0x123f1b,_0x8df666){_0x8df666=_0x8df666||0x1f4;return function(_0x3ba9c1){logger['error'](_0x3ba9c1[_0x99b0('0x28')]);if(_0x3ba9c1[_0x99b0('0x29')]){delete _0x3ba9c1[_0x99b0('0x29')];}_0x123f1b[_0x99b0('0x18')](_0x8df666)['send'](_0x3ba9c1);};}exports[_0x99b0('0x2a')]=function(_0x2e0850,_0x5429cd){var _0x3421e3={},_0x35ecdb={},_0x27ced8={'count':0x0,'rows':[]};var _0x22a098=_[_0x99b0('0x2b')](db[_0x99b0('0x2c')][_0x99b0('0x2d')],function(_0x398885){return{'name':_0x398885[_0x99b0('0x2e')],'type':_0x398885['type'][_0x99b0('0x2f')]};});_0x35ecdb[_0x99b0('0x30')]=_[_0x99b0('0x2b')](_0x22a098,_0x99b0('0x29'));_0x35ecdb[_0x99b0('0x31')]=_[_0x99b0('0x32')](_0x2e0850['query']);_0x35ecdb[_0x99b0('0x33')]=_[_0x99b0('0x34')](_0x35ecdb[_0x99b0('0x30')],_0x35ecdb[_0x99b0('0x31')]);_0x3421e3[_0x99b0('0x35')]=_[_0x99b0('0x34')](_0x35ecdb[_0x99b0('0x30')],qs[_0x99b0('0x36')](_0x2e0850['query'][_0x99b0('0x36')]));_0x3421e3['attributes']=_0x3421e3[_0x99b0('0x35')][_0x99b0('0x37')]?_0x3421e3['attributes']:_0x35ecdb[_0x99b0('0x30')];if(!_0x2e0850['query']['hasOwnProperty'](_0x99b0('0x38'))){_0x3421e3[_0x99b0('0x1c')]=qs['limit'](_0x2e0850['query'][_0x99b0('0x1c')]);_0x3421e3[_0x99b0('0x1b')]=qs['offset'](_0x2e0850[_0x99b0('0x31')]['offset']);}_0x3421e3[_0x99b0('0x39')]=qs['sort'](_0x2e0850[_0x99b0('0x31')][_0x99b0('0x3a')]);_0x3421e3[_0x99b0('0x3b')]=qs['filters'](_[_0x99b0('0x3c')](_0x2e0850['query'],_0x35ecdb[_0x99b0('0x33')]),_0x22a098);if(_0x2e0850['query'][_0x99b0('0x3d')]){_0x3421e3[_0x99b0('0x3b')]=_[_0x99b0('0x3e')](_0x3421e3[_0x99b0('0x3b')],{'$or':_[_0x99b0('0x2b')](_0x22a098,function(_0x38af80){if(_0x38af80['type']!=='VIRTUAL'){var _0xb9e8a9={};_0xb9e8a9[_0x38af80[_0x99b0('0x29')]]={'$like':'%'+_0x2e0850[_0x99b0('0x31')][_0x99b0('0x3d')]+'%'};return _0xb9e8a9;}})});}_0x3421e3=_[_0x99b0('0x3e')]({},_0x3421e3,_0x2e0850['options']);var _0xace47b={'where':_0x3421e3['where']};return db['WhatsappApplication'][_0x99b0('0x1e')](_0xace47b)[_0x99b0('0x25')](function(_0x42b7b4){_0x27ced8['count']=_0x42b7b4;if(_0x2e0850['query'][_0x99b0('0x3f')]){_0x3421e3['include']=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x3421e3);})['then'](function(_0x1469eb){_0x27ced8[_0x99b0('0x40')]=_0x1469eb;return _0x27ced8;})['then'](respondWithFilteredResult(_0x5429cd,_0x3421e3))[_0x99b0('0x41')](handleError(_0x5429cd,null));};exports['show']=function(_0x68e138,_0x46ae3c){var _0x2911dd={'raw':!![],'where':{'id':_0x68e138['params']['id']}},_0x1ad5be={};_0x1ad5be['model']=_['keys'](db[_0x99b0('0x2c')][_0x99b0('0x2d')]);_0x1ad5be[_0x99b0('0x31')]=_[_0x99b0('0x32')](_0x68e138['query']);_0x1ad5be['filters']=_[_0x99b0('0x34')](_0x1ad5be[_0x99b0('0x30')],_0x1ad5be[_0x99b0('0x31')]);_0x2911dd[_0x99b0('0x35')]=_['intersection'](_0x1ad5be[_0x99b0('0x30')],qs[_0x99b0('0x36')](_0x68e138[_0x99b0('0x31')]['fields']));_0x2911dd[_0x99b0('0x35')]=_0x2911dd[_0x99b0('0x35')]['length']?_0x2911dd['attributes']:_0x1ad5be[_0x99b0('0x30')];if(_0x68e138['query'][_0x99b0('0x3f')]){_0x2911dd[_0x99b0('0x42')]=[{'all':!![]}];}_0x2911dd=_[_0x99b0('0x3e')]({},_0x2911dd,_0x68e138['options']);return db[_0x99b0('0x2c')][_0x99b0('0x43')](_0x2911dd)[_0x99b0('0x25')](handleEntityNotFound(_0x46ae3c,null))[_0x99b0('0x25')](respondWithResult(_0x46ae3c,null))['catch'](handleError(_0x46ae3c,null));};exports['create']=function(_0x57cea0,_0x663789){return db['WhatsappApplication'][_0x99b0('0x44')](_0x57cea0[_0x99b0('0x45')],{})[_0x99b0('0x25')](respondWithResult(_0x663789,0xc9))[_0x99b0('0x41')](handleError(_0x663789,null));};exports[_0x99b0('0x24')]=function(_0x1ddf18,_0x4bcb1d){if(_0x1ddf18['body']['id']){delete _0x1ddf18[_0x99b0('0x45')]['id'];}return db['WhatsappApplication'][_0x99b0('0x43')]({'where':{'id':_0x1ddf18[_0x99b0('0x46')]['id']}})[_0x99b0('0x25')](handleEntityNotFound(_0x4bcb1d,null))[_0x99b0('0x25')](saveUpdates(_0x1ddf18[_0x99b0('0x45')],null))[_0x99b0('0x25')](respondWithResult(_0x4bcb1d,null))[_0x99b0('0x41')](handleError(_0x4bcb1d,null));};exports[_0x99b0('0x26')]=function(_0x2a15dc,_0x5ca074){return db[_0x99b0('0x2c')][_0x99b0('0x43')]({'where':{'id':_0x2a15dc[_0x99b0('0x46')]['id']}})[_0x99b0('0x25')](handleEntityNotFound(_0x5ca074,null))[_0x99b0('0x25')](removeEntity(_0x5ca074,null))[_0x99b0('0x41')](handleError(_0x5ca074,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 0f1cfbd..7d844bc 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 _0x12c9=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0xe62388,_0x20a8dc){var _0x364a83=function(_0x3c3718){while(--_0x3c3718){_0xe62388['push'](_0xe62388['shift']());}};_0x364a83(++_0x20a8dc);}(_0x12c9,0x1c9));var _0x912c=function(_0xb1e7b,_0x598475){_0xb1e7b=_0xb1e7b-0x0;var _0x2cd33e=_0x12c9[_0xb1e7b];return _0x2cd33e;};'use strict';var _=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var logger=require(_0x912c('0x2'))(_0x912c('0x3'));var moment=require(_0x912c('0x4'));var BPromise=require('bluebird');var rp=require(_0x912c('0x5'));var fs=require('fs');var path=require(_0x912c('0x6'));var rimraf=require(_0x912c('0x7'));var config=require(_0x912c('0x8'));var attributes=require(_0x912c('0x9'));module['exports']=function(_0x584a27,_0xe29019){return _0x584a27[_0x912c('0xa')](_0x912c('0xb'),attributes,{'tableName':_0x912c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x912c('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9335=['WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x9335,0xab));var _0x5933=function(_0x4fd39b,_0x4c4eca){_0x4fd39b=_0x4fd39b-0x0;var _0x322b44=_0x9335[_0x4fd39b];return _0x322b44;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var logger=require('../../config/logger')(_0x5933('0x2'));var moment=require(_0x5933('0x3'));var BPromise=require(_0x5933('0x4'));var rp=require(_0x5933('0x5'));var fs=require('fs');var path=require(_0x5933('0x6'));var rimraf=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0x5933('0x9')]=function(_0x4de024,_0x553710){return _0x4de024[_0x5933('0xa')](_0x5933('0xb'),attributes,{'tableName':_0x5933('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5933('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 084e0ef..81b9ff9 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 _0xe5b3=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xe5b3,0x133));var _0x3e5b=function(_0x9c623b,_0x3008cb){_0x9c623b=_0x9c623b-0x0;var _0x176a42=_0xe5b3[_0x9c623b];return _0x176a42;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file +var _0xbec5=['info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0xbec5,0xe5));var _0x5bec=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xbec5[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 8c36ba4..1765a56 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 _0xcde7=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','exports','path','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/:id','show'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xcde7,0x65));var _0x7cde=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcde7[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7cde('0x0'));var timeout=require(_0x7cde('0x1'));var express=require(_0x7cde('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7cde('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7cde('0x4'));var controller=require(_0x7cde('0x5'));router[_0x7cde('0x6')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0x8')]);router[_0x7cde('0x6')]('/describe',auth[_0x7cde('0x7')](),controller['describe']);router[_0x7cde('0x6')](_0x7cde('0x9'),auth[_0x7cde('0x7')](),controller[_0x7cde('0xa')]);router['get'](_0x7cde('0xb'),auth[_0x7cde('0x7')](),controller[_0x7cde('0xc')]);router[_0x7cde('0x6')](_0x7cde('0xd'),auth[_0x7cde('0x7')](),controller[_0x7cde('0xe')]);router[_0x7cde('0xf')]('/',auth[_0x7cde('0x7')](),controller[_0x7cde('0x10')]);router['post'](_0x7cde('0xb'),auth[_0x7cde('0x7')](),controller[_0x7cde('0x11')]);router[_0x7cde('0xf')](_0x7cde('0x12'),auth[_0x7cde('0x7')](),interaction[_0x7cde('0x13')](_0x7cde('0x14'),_0x7cde('0x15')),controller['addTags']);router[_0x7cde('0x16')](_0x7cde('0x9'),auth[_0x7cde('0x7')](),interaction[_0x7cde('0x13')](_0x7cde('0x14'),_0x7cde('0x17')),controller[_0x7cde('0x18')]);router[_0x7cde('0x19')](_0x7cde('0x9'),auth[_0x7cde('0x7')](),interaction[_0x7cde('0x13')](_0x7cde('0x14'),_0x7cde('0x1a')),controller['destroy']);router[_0x7cde('0x19')](_0x7cde('0x12'),auth[_0x7cde('0x7')](),controller['removeTags']);module[_0x7cde('0x1b')]=router; \ No newline at end of file +var _0x5d17=['whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','getMessages','download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked'];(function(_0x22b099,_0x2f69ba){var _0x5652c7=function(_0xb0b3b5){while(--_0xb0b3b5){_0x22b099['push'](_0x22b099['shift']());}};_0x5652c7(++_0x2f69ba);}(_0x5d17,0x114));var _0x75d1=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x5d17[_0x30faee];return _0x3a90ab;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x75d1('0xe')]);router[_0x75d1('0x8')]('/:id/download',auth[_0x75d1('0xb')](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')]('/',auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);router[_0x75d1('0x10')]('/:id/messages',auth[_0x75d1('0xb')](),controller[_0x75d1('0x12')]);router[_0x75d1('0x10')](_0x75d1('0x13'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x75d1('0x14')),controller[_0x75d1('0x15')]);router[_0x75d1('0x16')]('/:id',auth[_0x75d1('0xb')](),interaction[_0x75d1('0x17')](_0x75d1('0x18'),_0x75d1('0x19')),controller[_0x75d1('0x1a')]);router[_0x75d1('0x1b')](_0x75d1('0xd'),auth[_0x75d1('0xb')](),interaction[_0x75d1('0x17')](_0x75d1('0x18'),_0x75d1('0x1c')),controller['destroy']);router['delete'](_0x75d1('0x13'),auth[_0x75d1('0xb')](),controller['removeTags']);module[_0x75d1('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c347a1e..37d73a1 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 _0x10af=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x45655c,_0x407b81){var _0x24a8d9=function(_0x1624c7){while(--_0x1624c7){_0x45655c['push'](_0x45655c['shift']());}};_0x24a8d9(++_0x407b81);}(_0x10af,0xfc));var _0xf10a=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x10af[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0xf10a('0x0'));var moment=require('moment');module[_0xf10a('0x1')]={'closed':{'type':Sequelize[_0xf10a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf10a('0x3')]},'disposition':{'type':Sequelize[_0xf10a('0x4')]},'secondDisposition':{'type':Sequelize[_0xf10a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf10a('0x4')]},'note':{'type':Sequelize[_0xf10a('0x4')]},'phone':{'type':Sequelize[_0xf10a('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf10a('0x5')]('in',_0xf10a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf10a('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf10a('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7118=['DATE','ENUM','out','exports','BOOLEAN','STRING'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7118,0x159));var _0x8711=function(_0x288dfe,_0x360772){_0x288dfe=_0x288dfe-0x0;var _0x929a2d=_0x7118[_0x288dfe];return _0x929a2d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x8711('0x0')]={'closed':{'type':Sequelize[_0x8711('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8711('0x2')]},'secondDisposition':{'type':Sequelize[_0x8711('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8711('0x2')]},'note':{'type':Sequelize[_0x8711('0x2')]},'phone':{'type':Sequelize[_0x8711('0x2')]},'read1stAt':{'type':Sequelize[_0x8711('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8711('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8711('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8711('0x4')]('in',_0x8711('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8711('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c090ac6..7b327af 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 _0x2922=['System','out','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','moment','bluebird','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','destroy','then','error','stack','name','send','map','type','key','getOptions','findAll','whatsapp','user','catch','params','model','WhatsappInteraction','keys','filters','query','fields','attributes','length','includeAll','include','options','find','create','body','describe','addMessage','WhatsappMessage','getMessages','findOne','rawAttributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','ids','omit','Tag','color','emit','removeTags','download','unix','toString','tmp','join','root','server','files','attachments','format','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','secret','read','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','pipe','createWriteStream','direction'];(function(_0x302408,_0x30de19){var _0x1679e0=function(_0x420796){while(--_0x420796){_0x302408['push'](_0x302408['shift']());}};_0x1679e0(++_0x30de19);}(_0x2922,0x107));var _0x2292=function(_0x5e7d16,_0x5d233c){_0x5e7d16=_0x5e7d16-0x0;var _0x1d364a=_0x2922[_0x5e7d16];return _0x1d364a;};'use strict';var rimraf=require(_0x2292('0x0'));var zipdir=require('zip-dir');var moment=require(_0x2292('0x1'));var BPromise=require(_0x2292('0x2'));var util=require(_0x2292('0x3'));var path=require('path');var ejs=require(_0x2292('0x4'));var fs=require('fs');var _=require(_0x2292('0x5'));var Redis=require('ioredis');var interaction=require(_0x2292('0x6'));var qs=require(_0x2292('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x2292('0x8'))(_0x2292('0x9'));var config=require(_0x2292('0xa'));var db=require(_0x2292('0xb'))['db'];config[_0x2292('0xc')]=_[_0x2292('0xd')](config['redis'],{'host':_0x2292('0xe'),'port':0x18eb});var socket=require(_0x2292('0xf'))(new Redis(config[_0x2292('0xc')]));require('./whatsappInteraction.socket')[_0x2292('0x10')](socket);function respondWithStatusCode(_0x5dbd1a,_0x275e14){_0x275e14=_0x275e14||0xcc;return function(_0x49f576){if(_0x49f576){return _0x5dbd1a[_0x2292('0x11')](_0x275e14);}return _0x5dbd1a[_0x2292('0x12')](_0x275e14)[_0x2292('0x13')]();};}function respondWithResult(_0x46fd04,_0x133b62){_0x133b62=_0x133b62||0xc8;return function(_0xc3f8a7){if(_0xc3f8a7){return _0x46fd04[_0x2292('0x12')](_0x133b62)['json'](_0xc3f8a7);}};}function respondWithFilteredResult(_0x387e04,_0x5a5804){return function(_0xb5b6){if(_0xb5b6){var _0x396a9e=typeof _0x5a5804[_0x2292('0x14')]===_0x2292('0x15')&&typeof _0x5a5804[_0x2292('0x16')]===_0x2292('0x15');var _0xcbc01a=_0xb5b6[_0x2292('0x17')];var _0x5dc6fc=_0x396a9e?0x0:_0x5a5804['offset'];var _0xcaa9a5=_0x396a9e?_0xb5b6[_0x2292('0x17')]:_0x5a5804[_0x2292('0x14')]+_0x5a5804['limit'];var _0x34a5ce;if(_0xcaa9a5>=_0xcbc01a){_0xcaa9a5=_0xcbc01a;_0x34a5ce=0xc8;}else{_0x34a5ce=0xce;}_0x387e04[_0x2292('0x12')](_0x34a5ce);return _0x387e04[_0x2292('0x18')]('Content-Range',_0x5dc6fc+'-'+_0xcaa9a5+'/'+_0xcbc01a)[_0x2292('0x19')](_0xb5b6);}return null;};}function saveUpdates(_0x6d46b1){return function(_0x2b9b82){if(_0x2b9b82){return _0x2b9b82[_0x2292('0x1a')](_0x6d46b1)['then'](function(_0x216781){return _0x216781;});}return null;};}function removeEntity(_0x192647){return function(_0x14ee7d){if(_0x14ee7d){return _0x14ee7d[_0x2292('0x1b')]()[_0x2292('0x1c')](function(){_0x192647[_0x2292('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4769bd){return function(_0x1eb376){if(!_0x1eb376){_0x4769bd['sendStatus'](0x194);}return _0x1eb376;};}function handleError(_0x1228cc,_0x5becdc){_0x5becdc=_0x5becdc||0x1f4;return function(_0x36cd0c){logger[_0x2292('0x1d')](_0x36cd0c[_0x2292('0x1e')]);if(_0x36cd0c[_0x2292('0x1f')]){delete _0x36cd0c['name'];}_0x1228cc[_0x2292('0x12')](_0x5becdc)[_0x2292('0x20')](_0x36cd0c);};}exports['index']=function(_0x53fd96,_0x1c31f3){var _0x35dfaf={};var _0x1f3573=_[_0x2292('0x21')](db['WhatsappInteraction']['rawAttributes'],function(_0xed5993){return{'name':_0xed5993['fieldName'],'type':_0xed5993[_0x2292('0x22')][_0x2292('0x23')]};});_0x35dfaf=qs[_0x2292('0x24')](_0x1f3573,_0x53fd96);return interaction[_0x2292('0x25')](_0x2292('0x26'),_0x53fd96['query'],_0x53fd96[_0x2292('0x27')],_0x35dfaf,_0x1f3573)[_0x2292('0x1c')](respondWithFilteredResult(_0x1c31f3,_0x35dfaf))[_0x2292('0x28')](handleError(_0x1c31f3,null));};exports['show']=function(_0x1e9cfd,_0x1683e7){var _0x3fcee5={'raw':![],'where':{'id':_0x1e9cfd[_0x2292('0x29')]['id']}},_0x4654c8={};_0x4654c8[_0x2292('0x2a')]=_['keys'](db[_0x2292('0x2b')]['rawAttributes']);_0x4654c8['query']=_[_0x2292('0x2c')](_0x1e9cfd['query']);_0x4654c8[_0x2292('0x2d')]=_['intersection'](_0x4654c8[_0x2292('0x2a')],_0x4654c8[_0x2292('0x2e')]);_0x3fcee5['attributes']=_['intersection'](_0x4654c8[_0x2292('0x2a')],qs[_0x2292('0x2f')](_0x1e9cfd[_0x2292('0x2e')][_0x2292('0x2f')]));_0x3fcee5[_0x2292('0x30')]=_0x3fcee5[_0x2292('0x30')][_0x2292('0x31')]?_0x3fcee5[_0x2292('0x30')]:_0x4654c8[_0x2292('0x2a')];if(_0x1e9cfd['query'][_0x2292('0x32')]){_0x3fcee5[_0x2292('0x33')]=[{'all':!![]}];}_0x3fcee5=_['merge']({},_0x3fcee5,_0x1e9cfd[_0x2292('0x34')]);return db[_0x2292('0x2b')][_0x2292('0x35')](_0x3fcee5)[_0x2292('0x1c')](handleEntityNotFound(_0x1683e7,null))[_0x2292('0x1c')](respondWithResult(_0x1683e7,null))[_0x2292('0x28')](handleError(_0x1683e7,null));};exports[_0x2292('0x36')]=function(_0x325840,_0x36eb5a){return db[_0x2292('0x2b')][_0x2292('0x36')](_0x325840[_0x2292('0x37')],{})['then'](respondWithResult(_0x36eb5a,0xc9))[_0x2292('0x28')](handleError(_0x36eb5a,null));};exports[_0x2292('0x1a')]=function(_0x1337fe,_0x2cc564){if(_0x1337fe[_0x2292('0x37')]['id']){delete _0x1337fe[_0x2292('0x37')]['id'];}return db[_0x2292('0x2b')][_0x2292('0x35')]({'where':{'id':_0x1337fe[_0x2292('0x29')]['id']}})[_0x2292('0x1c')](handleEntityNotFound(_0x2cc564,null))[_0x2292('0x1c')](saveUpdates(_0x1337fe[_0x2292('0x37')],null))['then'](respondWithResult(_0x2cc564,null))['catch'](handleError(_0x2cc564,null));};exports[_0x2292('0x1b')]=function(_0x3e8c7c,_0x4405e0){return db[_0x2292('0x2b')][_0x2292('0x35')]({'where':{'id':_0x3e8c7c[_0x2292('0x29')]['id']}})[_0x2292('0x1c')](handleEntityNotFound(_0x4405e0,null))['then'](removeEntity(_0x4405e0,null))[_0x2292('0x28')](handleError(_0x4405e0,null));};exports['describe']=function(_0x9bf3dd,_0x4c73f9){return db['WhatsappInteraction'][_0x2292('0x38')]()['then'](respondWithResult(_0x4c73f9,null))[_0x2292('0x28')](handleError(_0x4c73f9,null));};exports[_0x2292('0x39')]=function(_0xe7dde4,_0x27ce84){return db[_0x2292('0x3a')][_0x2292('0x35')]({'where':{'id':_0xe7dde4['params']['id']}})[_0x2292('0x1c')](handleEntityNotFound(_0x27ce84,null))[_0x2292('0x1c')](function(_0x3b2035){if(_0x3b2035){return _0x3b2035['addMessage'](_0xe7dde4['body']['ids'],_['omit'](_0xe7dde4[_0x2292('0x37')],['ids','id'])||{});}})[_0x2292('0x1c')](respondWithResult(_0x27ce84,null))[_0x2292('0x28')](handleError(_0x27ce84,null));};exports[_0x2292('0x3b')]=function(_0x44addb,_0x3515af){var _0x584b9e={'raw':![],'where':{}};var _0x56e1d6={};var _0x48832f={'count':0x0,'rows':[]};return db[_0x2292('0x2b')][_0x2292('0x3c')]({'where':{'id':_0x44addb[_0x2292('0x29')]['id']}})['then'](handleEntityNotFound(_0x3515af,null))[_0x2292('0x1c')](function(_0x2a7d79){if(_0x2a7d79){_0x56e1d6['model']=_[_0x2292('0x2c')](db['WhatsappMessage'][_0x2292('0x3d')]);_0x56e1d6[_0x2292('0x2e')]=_[_0x2292('0x2c')](_0x44addb['query']);_0x56e1d6[_0x2292('0x2d')]=_[_0x2292('0x3e')](_0x56e1d6['model'],_0x56e1d6[_0x2292('0x2e')]);_0x584b9e[_0x2292('0x30')]=_[_0x2292('0x3e')](_0x56e1d6[_0x2292('0x2a')],qs[_0x2292('0x2f')](_0x44addb[_0x2292('0x2e')]['fields']));_0x584b9e[_0x2292('0x30')]=_0x584b9e[_0x2292('0x30')]['length']?_0x584b9e[_0x2292('0x30')]:_0x56e1d6['model'];if(!_0x44addb[_0x2292('0x2e')][_0x2292('0x3f')](_0x2292('0x40'))){_0x584b9e[_0x2292('0x16')]=qs[_0x2292('0x16')](_0x44addb[_0x2292('0x2e')][_0x2292('0x16')]);_0x584b9e[_0x2292('0x14')]=qs[_0x2292('0x14')](_0x44addb['query'][_0x2292('0x14')]);}_0x584b9e[_0x2292('0x41')]=qs[_0x2292('0x42')](_0x44addb['query'][_0x2292('0x42')]);_0x584b9e[_0x2292('0x43')]=qs['filters'](_[_0x2292('0x44')](_0x44addb[_0x2292('0x2e')],_0x56e1d6[_0x2292('0x2d')]));_0x584b9e[_0x2292('0x43')][_0x2292('0x45')]=_0x2a7d79['id'];if(_0x44addb['query'][_0x2292('0x46')]){_0x584b9e[_0x2292('0x43')]=_[_0x2292('0x47')](_0x584b9e[_0x2292('0x43')],{'$or':_[_0x2292('0x21')](_0x584b9e[_0x2292('0x30')],function(_0x34b33d){var _0x48e6fb={};_0x48e6fb[_0x34b33d]={'$like':'%'+_0x44addb[_0x2292('0x2e')]['filter']+'%'};return _0x48e6fb;})});}if(_0x44addb['query'][_0x2292('0x48')]){var _0x41d370=_0x44addb[_0x2292('0x2e')]['$gte'][_0x2292('0x49')](',');var _0x38d162={};_0x38d162[_0x41d370[0x0]]={'$gte':moment(_0x41d370[0x1])['format'](_0x2292('0x4a'))};_0x584b9e[_0x2292('0x43')]=_[_0x2292('0x47')](_0x584b9e['where'],_0x38d162);}_0x584b9e=_[_0x2292('0x47')]({},_0x584b9e,_0x44addb[_0x2292('0x34')]);return db[_0x2292('0x3a')][_0x2292('0x17')]({'where':_0x584b9e[_0x2292('0x43')]})[_0x2292('0x1c')](function(_0x3e0cc7){_0x48832f[_0x2292('0x17')]=_0x3e0cc7;if(_0x44addb[_0x2292('0x2e')][_0x2292('0x32')]){_0x584b9e[_0x2292('0x33')]=[{'all':!![]}];}return db[_0x2292('0x3a')][_0x2292('0x25')](_0x584b9e);})[_0x2292('0x1c')](function(_0x25bfb7){_0x48832f[_0x2292('0x4b')]=_0x25bfb7;return _0x48832f;});}})['then'](respondWithFilteredResult(_0x3515af,_0x584b9e))['catch'](handleError(_0x3515af,null));};exports[_0x2292('0x4c')]=function(_0xc9c32c,_0x4eb15a){return db[_0x2292('0x2b')]['find']({'where':{'id':_0xc9c32c[_0x2292('0x29')]['id']}})['then'](handleEntityNotFound(_0x4eb15a,null))[_0x2292('0x1c')](function(_0x5b2115){if(_0x5b2115){return _0x5b2115[_0x2292('0x4d')](_0xc9c32c[_0x2292('0x37')][_0x2292('0x4e')],_[_0x2292('0x4f')](_0xc9c32c[_0x2292('0x37')],['ids','id'])||{})['spread'](function(){return db[_0x2292('0x50')]['findAll']({'attributes':['id',_0x2292('0x1f'),_0x2292('0x51')],'where':{'id':_0xc9c32c['body'][_0x2292('0x4e')]}});})['then'](function(_0x3a3e70){socket[_0x2292('0x52')]('whatsappInteractionTags:save',{'id':Number(_0xc9c32c[_0x2292('0x29')]['id']),'tags':_0x3a3e70||[]});return{'id':Number(_0xc9c32c[_0x2292('0x29')]['id']),'tags':_0x3a3e70||[]};});}})[_0x2292('0x1c')](respondWithResult(_0x4eb15a,null))[_0x2292('0x28')](handleError(_0x4eb15a,null));};exports[_0x2292('0x53')]=function(_0x59721b,_0x42aa5a){return db[_0x2292('0x2b')][_0x2292('0x35')]({'where':{'id':_0x59721b[_0x2292('0x29')]['id']}})['then'](handleEntityNotFound(_0x42aa5a,null))['then'](function(_0x23ec33){if(_0x23ec33){return _0x23ec33['removeTags'](_0x59721b[_0x2292('0x2e')][_0x2292('0x4e')]);}})[_0x2292('0x1c')](respondWithStatusCode(_0x42aa5a,null))[_0x2292('0x28')](handleError(_0x42aa5a,null));};exports[_0x2292('0x54')]=function(_0xd90968,_0x597a7b){var _0x48ea0e=moment()[_0x2292('0x55')]()[_0x2292('0x56')]();var _0x18281e=path['join'](config['root'],'server','files',_0x2292('0x57'));var _0x322f93=path[_0x2292('0x58')](config[_0x2292('0x59')],_0x2292('0x5a'),_0x2292('0x5b'),_0x2292('0x5c'));var _0x29b712=path[_0x2292('0x58')](_0x18281e,_0x48ea0e);var _0x22a41d=util[_0x2292('0x5d')]('transcript-%d-%s.zip',_0xd90968[_0x2292('0x29')]['id'],_0x48ea0e);var _0x260970=path[_0x2292('0x58')](_0x18281e,_0x22a41d);var _0x46d65c=[];_0x46d65c[_0x2292('0x5e')]({'model':db['User'],'as':_0x2292('0x5f'),'attributes':['id',_0x2292('0x60')],'raw':!![]});_0x46d65c[_0x2292('0x5e')]({'model':db[_0x2292('0x61')],'as':_0x2292('0x62'),'attributes':['id',_0x2292('0x63'),_0x2292('0x64')],'raw':!![]});if(_0xd90968[_0x2292('0x2e')]['attachments']){_0x46d65c['push']({'model':db[_0x2292('0x65')],'as':_0x2292('0x65'),'raw':!![]});}var _0x498946=[{'model':db[_0x2292('0x3a')],'as':'Messages','attributes':['id',_0x2292('0x37'),_0x2292('0x66'),'direction',_0x2292('0x67'),_0x2292('0x68')],'include':_0x46d65c}];_0x498946[_0x2292('0x5e')]({'model':db[_0x2292('0x69')],'as':_0x2292('0x6a'),'attributes':['id',_0x2292('0x1f')]});_0x498946[_0x2292('0x5e')]({'model':db['User'],'as':_0x2292('0x6b'),'attributes':['id',_0x2292('0x60')]});return db[_0x2292('0x2b')][_0x2292('0x35')]({'where':{'id':_0xd90968['params']['id']},'include':_0x498946})[_0x2292('0x1c')](handleEntityNotFound(_0x597a7b,null))[_0x2292('0x1c')](function(_0x202b61){if(_0x202b61){var _0x374878=_0x202b61[_0x2292('0x6c')]({'plain':!![]});fs['mkdirSync'](_0x29b712);var _0x584daa={'channel':_0x2292('0x6d'),'account':_0x374878[_0x2292('0x6a')][_0x2292('0x1f')],'agent':_0x374878[_0x2292('0x6b')]?_0x374878['Owner'][_0x2292('0x60')]:_0x2292('0x6e'),'createdAt':moment(_0x374878['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x2292('0x56')](),'closedAt':_0x374878['closed']?moment(_0x374878[_0x2292('0x6f')])[_0x2292('0x5d')](_0x2292('0x4a'))[_0x2292('0x56')]():'','disposition':_0x374878[_0x2292('0x70')],'messages':_(_0x374878['Messages'])[_0x2292('0x46')]({'secret':![]})[_0x2292('0x21')](function(_0x405c05){if(_0x405c05[_0x2292('0x65')]){var _0x396171=path[_0x2292('0x58')](_0x322f93,_0x405c05[_0x2292('0x65')][_0x2292('0x71')]);if(fs[_0x2292('0x72')](_0x396171)){fs['createReadStream'](_0x396171)[_0x2292('0x73')](fs[_0x2292('0x74')](path[_0x2292('0x58')](_0x29b712,_0x405c05[_0x2292('0x65')][_0x2292('0x71')])));}}return{'date':moment(_0x405c05['createdAt'])[_0x2292('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x405c05[_0x2292('0x75')]==='out'?_0x405c05[_0x2292('0x5f')]?_0x405c05[_0x2292('0x5f')][_0x2292('0x60')]:_0x2292('0x76'):_0x405c05[_0x2292('0x62')][_0x2292('0x63')]+(_0x405c05[_0x2292('0x62')][_0x2292('0x64')]?'\x20'+_0x405c05[_0x2292('0x62')][_0x2292('0x64')]:''),'body':_0x405c05['Attachment']?_0x405c05['Attachment'][_0x2292('0x71')]:_0x405c05[_0x2292('0x37')],'direction':_0x405c05[_0x2292('0x75')]===_0x2292('0x77')?'A':'C','secret':_0x405c05['secret'],'read':_0x405c05['read'],'attachment':_0x405c05[_0x2292('0x65')]};})[_0x2292('0x78')]()};return ejs[_0x2292('0x79')](path['join'](config[_0x2292('0x59')],_0x2292('0x5a'),'views',_0x2292('0x7a')),{'interaction':_0x584daa})['then'](function(_0x5542f5){var _0x3aaecc=path[_0x2292('0x58')](_0x29b712,_0x2292('0x7b')+_0x374878['id']+'-'+_0x48ea0e+_0x2292('0x7c'));var _0x511885={'path':_0x3aaecc,'channel':_0x2292('0x6d'),'interactionId':_0x374878['id']};return pdf['createPdfFromHTML'](_0x5542f5,_0x511885);})[_0x2292('0x1c')](function(){return new BPromise(function(_0x1c6ef2,_0x2f833d){zipdir(_0x29b712,{'saveTo':_0x260970},function(_0x100652,_0xd093b){if(_0x100652)return _0x2f833d(_0x100652);return _0x1c6ef2(_0xd093b);});})[_0x2292('0x1c')](function(){return new BPromise(function(_0x15fedd,_0x521c42){rimraf(_0x29b712,function(_0xe566a5){if(_0xe566a5)_0x521c42(_0xe566a5);return _0x15fedd();});});})[_0x2292('0x1c')](function(){return _0x597a7b[_0x2292('0x54')](_0x260970,_0x22a41d,function(_0x48c7d8){if(_0x48c7d8){console['log'](_0x2292('0x7d'),_0x48c7d8);}else{fs[_0x2292('0x7e')](_0x260970);}});});});}else{return _0x597a7b[_0x2292('0x11')](0xc8);}})[_0x2292('0x28')](handleError(_0x597a7b,null));}; \ No newline at end of file +var _0x08e6=['../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','user','catch','show','params','model','keys','intersection','fields','attributes','includeAll','include','options','create','body','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','filters','length','hasOwnProperty','sort','where','pick','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','push','User','fullname','Contact','firstName','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','closedAt','disposition','existsSync','createWriteStream','basename','System','lastName','value','renderFile','downloadInteraction.ejs','createPdfFromHTML','log','unlinkSync','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service'];(function(_0x5ed68d,_0x5cc21a){var _0x28723f=function(_0x58d146){while(--_0x58d146){_0x5ed68d['push'](_0x5ed68d['shift']());}};_0x28723f(++_0x5cc21a);}(_0x08e6,0x75));var _0x608e=function(_0x5b82a0,_0x37ef3b){_0x5b82a0=_0x5b82a0-0x0;var _0x1f6886=_0x08e6[_0x5b82a0];return _0x1f6886;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x608e('0x0'));var moment=require(_0x608e('0x1'));var BPromise=require('bluebird');var util=require(_0x608e('0x2'));var path=require(_0x608e('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x608e('0x4'));var Redis=require(_0x608e('0x5'));var interaction=require(_0x608e('0x6'));var qs=require(_0x608e('0x7'));var pdf=require(_0x608e('0x8'));var logger=require(_0x608e('0x9'))(_0x608e('0xa'));var config=require(_0x608e('0xb'));var db=require(_0x608e('0xc'))['db'];config[_0x608e('0xd')]=_[_0x608e('0xe')](config[_0x608e('0xd')],{'host':_0x608e('0xf'),'port':0x18eb});var socket=require(_0x608e('0x10'))(new Redis(config[_0x608e('0xd')]));require(_0x608e('0x11'))[_0x608e('0x12')](socket);function respondWithStatusCode(_0x3ab535,_0x343d4a){_0x343d4a=_0x343d4a||0xcc;return function(_0x172ed1){if(_0x172ed1){return _0x3ab535[_0x608e('0x13')](_0x343d4a);}return _0x3ab535[_0x608e('0x14')](_0x343d4a)[_0x608e('0x15')]();};}function respondWithResult(_0x18f91f,_0x2ece71){_0x2ece71=_0x2ece71||0xc8;return function(_0x32a734){if(_0x32a734){return _0x18f91f[_0x608e('0x14')](_0x2ece71)[_0x608e('0x16')](_0x32a734);}};}function respondWithFilteredResult(_0x19eb9c,_0xf600f8){return function(_0x441914){if(_0x441914){var _0x577fa4=typeof _0xf600f8[_0x608e('0x17')]===_0x608e('0x18')&&typeof _0xf600f8['limit']==='undefined';var _0x19a8e6=_0x441914['count'];var _0x4a8693=_0x577fa4?0x0:_0xf600f8[_0x608e('0x17')];var _0x3a2f42=_0x577fa4?_0x441914[_0x608e('0x19')]:_0xf600f8[_0x608e('0x17')]+_0xf600f8[_0x608e('0x1a')];var _0x6880d4;if(_0x3a2f42>=_0x19a8e6){_0x3a2f42=_0x19a8e6;_0x6880d4=0xc8;}else{_0x6880d4=0xce;}_0x19eb9c[_0x608e('0x14')](_0x6880d4);return _0x19eb9c[_0x608e('0x1b')](_0x608e('0x1c'),_0x4a8693+'-'+_0x3a2f42+'/'+_0x19a8e6)[_0x608e('0x16')](_0x441914);}return null;};}function saveUpdates(_0x1bdb4b){return function(_0x545c43){if(_0x545c43){return _0x545c43[_0x608e('0x1d')](_0x1bdb4b)[_0x608e('0x1e')](function(_0x11360d){return _0x11360d;});}return null;};}function removeEntity(_0x48e79b){return function(_0x522ba7){if(_0x522ba7){return _0x522ba7[_0x608e('0x1f')]()['then'](function(){_0x48e79b[_0x608e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35025e){return function(_0x5fb9b0){if(!_0x5fb9b0){_0x35025e['sendStatus'](0x194);}return _0x5fb9b0;};}function handleError(_0x21cf09,_0x23f6b7){_0x23f6b7=_0x23f6b7||0x1f4;return function(_0x11c78e){logger[_0x608e('0x20')](_0x11c78e[_0x608e('0x21')]);if(_0x11c78e[_0x608e('0x22')]){delete _0x11c78e[_0x608e('0x22')];}_0x21cf09[_0x608e('0x14')](_0x23f6b7)[_0x608e('0x23')](_0x11c78e);};}exports[_0x608e('0x24')]=function(_0x452e64,_0x2035be){var _0x65e42b={};var _0x22c545=_[_0x608e('0x25')](db[_0x608e('0x26')][_0x608e('0x27')],function(_0x44b9a7){return{'name':_0x44b9a7[_0x608e('0x28')],'type':_0x44b9a7['type'][_0x608e('0x29')]};});_0x65e42b=qs[_0x608e('0x2a')](_0x22c545,_0x452e64);return interaction[_0x608e('0x2b')]('whatsapp',_0x452e64[_0x608e('0x2c')],_0x452e64[_0x608e('0x2d')],_0x65e42b,_0x22c545)['then'](respondWithFilteredResult(_0x2035be,_0x65e42b))[_0x608e('0x2e')](handleError(_0x2035be,null));};exports[_0x608e('0x2f')]=function(_0x5ba54f,_0x53b080){var _0x3a3783={'raw':![],'where':{'id':_0x5ba54f[_0x608e('0x30')]['id']}},_0x53bb6c={};_0x53bb6c[_0x608e('0x31')]=_[_0x608e('0x32')](db[_0x608e('0x26')][_0x608e('0x27')]);_0x53bb6c['query']=_[_0x608e('0x32')](_0x5ba54f[_0x608e('0x2c')]);_0x53bb6c['filters']=_[_0x608e('0x33')](_0x53bb6c['model'],_0x53bb6c[_0x608e('0x2c')]);_0x3a3783['attributes']=_[_0x608e('0x33')](_0x53bb6c['model'],qs['fields'](_0x5ba54f[_0x608e('0x2c')][_0x608e('0x34')]));_0x3a3783[_0x608e('0x35')]=_0x3a3783[_0x608e('0x35')]['length']?_0x3a3783[_0x608e('0x35')]:_0x53bb6c['model'];if(_0x5ba54f[_0x608e('0x2c')][_0x608e('0x36')]){_0x3a3783[_0x608e('0x37')]=[{'all':!![]}];}_0x3a3783=_['merge']({},_0x3a3783,_0x5ba54f[_0x608e('0x38')]);return db['WhatsappInteraction']['find'](_0x3a3783)[_0x608e('0x1e')](handleEntityNotFound(_0x53b080,null))[_0x608e('0x1e')](respondWithResult(_0x53b080,null))[_0x608e('0x2e')](handleError(_0x53b080,null));};exports[_0x608e('0x39')]=function(_0x2bcc8f,_0xfd32a5){return db[_0x608e('0x26')][_0x608e('0x39')](_0x2bcc8f[_0x608e('0x3a')],{})[_0x608e('0x1e')](respondWithResult(_0xfd32a5,0xc9))['catch'](handleError(_0xfd32a5,null));};exports[_0x608e('0x1d')]=function(_0x374484,_0x574e10){if(_0x374484['body']['id']){delete _0x374484[_0x608e('0x3a')]['id'];}return db[_0x608e('0x26')][_0x608e('0x3b')]({'where':{'id':_0x374484[_0x608e('0x30')]['id']}})[_0x608e('0x1e')](handleEntityNotFound(_0x574e10,null))[_0x608e('0x1e')](saveUpdates(_0x374484[_0x608e('0x3a')],null))['then'](respondWithResult(_0x574e10,null))['catch'](handleError(_0x574e10,null));};exports[_0x608e('0x1f')]=function(_0x2ca7b2,_0x112882){return db[_0x608e('0x26')]['find']({'where':{'id':_0x2ca7b2[_0x608e('0x30')]['id']}})['then'](handleEntityNotFound(_0x112882,null))[_0x608e('0x1e')](removeEntity(_0x112882,null))[_0x608e('0x2e')](handleError(_0x112882,null));};exports['describe']=function(_0x2d7267,_0x3d3bd6){return db[_0x608e('0x26')][_0x608e('0x3c')]()[_0x608e('0x1e')](respondWithResult(_0x3d3bd6,null))[_0x608e('0x2e')](handleError(_0x3d3bd6,null));};exports[_0x608e('0x3d')]=function(_0x4062b3,_0x50113b){return db[_0x608e('0x3e')][_0x608e('0x3b')]({'where':{'id':_0x4062b3['params']['id']}})['then'](handleEntityNotFound(_0x50113b,null))['then'](function(_0x1b8871){if(_0x1b8871){return _0x1b8871[_0x608e('0x3d')](_0x4062b3[_0x608e('0x3a')][_0x608e('0x3f')],_[_0x608e('0x40')](_0x4062b3[_0x608e('0x3a')],[_0x608e('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x50113b,null))[_0x608e('0x2e')](handleError(_0x50113b,null));};exports[_0x608e('0x41')]=function(_0x1dd6c9,_0x2c52b7){var _0x5a0f64={'raw':![],'where':{}};var _0x45b20e={};var _0x436fc3={'count':0x0,'rows':[]};return db[_0x608e('0x26')][_0x608e('0x42')]({'where':{'id':_0x1dd6c9[_0x608e('0x30')]['id']}})[_0x608e('0x1e')](handleEntityNotFound(_0x2c52b7,null))[_0x608e('0x1e')](function(_0x4b0efe){if(_0x4b0efe){_0x45b20e[_0x608e('0x31')]=_[_0x608e('0x32')](db['WhatsappMessage'][_0x608e('0x27')]);_0x45b20e[_0x608e('0x2c')]=_['keys'](_0x1dd6c9[_0x608e('0x2c')]);_0x45b20e[_0x608e('0x43')]=_[_0x608e('0x33')](_0x45b20e[_0x608e('0x31')],_0x45b20e[_0x608e('0x2c')]);_0x5a0f64[_0x608e('0x35')]=_[_0x608e('0x33')](_0x45b20e['model'],qs[_0x608e('0x34')](_0x1dd6c9[_0x608e('0x2c')][_0x608e('0x34')]));_0x5a0f64[_0x608e('0x35')]=_0x5a0f64[_0x608e('0x35')][_0x608e('0x44')]?_0x5a0f64[_0x608e('0x35')]:_0x45b20e[_0x608e('0x31')];if(!_0x1dd6c9[_0x608e('0x2c')][_0x608e('0x45')]('nolimit')){_0x5a0f64[_0x608e('0x1a')]=qs['limit'](_0x1dd6c9[_0x608e('0x2c')]['limit']);_0x5a0f64[_0x608e('0x17')]=qs[_0x608e('0x17')](_0x1dd6c9['query'][_0x608e('0x17')]);}_0x5a0f64['order']=qs['sort'](_0x1dd6c9[_0x608e('0x2c')][_0x608e('0x46')]);_0x5a0f64[_0x608e('0x47')]=qs[_0x608e('0x43')](_[_0x608e('0x48')](_0x1dd6c9[_0x608e('0x2c')],_0x45b20e['filters']));_0x5a0f64[_0x608e('0x47')]['WhatsappInteractionId']=_0x4b0efe['id'];if(_0x1dd6c9[_0x608e('0x2c')][_0x608e('0x49')]){_0x5a0f64[_0x608e('0x47')]=_[_0x608e('0x4a')](_0x5a0f64['where'],{'$or':_['map'](_0x5a0f64[_0x608e('0x35')],function(_0x563954){var _0x30f4f8={};_0x30f4f8[_0x563954]={'$like':'%'+_0x1dd6c9['query']['filter']+'%'};return _0x30f4f8;})});}if(_0x1dd6c9[_0x608e('0x2c')][_0x608e('0x4b')]){var _0x3e995f=_0x1dd6c9[_0x608e('0x2c')][_0x608e('0x4b')]['split'](',');var _0x512e99={};_0x512e99[_0x3e995f[0x0]]={'$gte':moment(_0x3e995f[0x1])[_0x608e('0x4c')](_0x608e('0x4d'))};_0x5a0f64[_0x608e('0x47')]=_[_0x608e('0x4a')](_0x5a0f64[_0x608e('0x47')],_0x512e99);}_0x5a0f64=_['merge']({},_0x5a0f64,_0x1dd6c9[_0x608e('0x38')]);return db[_0x608e('0x3e')][_0x608e('0x19')]({'where':_0x5a0f64[_0x608e('0x47')]})[_0x608e('0x1e')](function(_0x18c612){_0x436fc3['count']=_0x18c612;if(_0x1dd6c9[_0x608e('0x2c')][_0x608e('0x36')]){_0x5a0f64['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x608e('0x2b')](_0x5a0f64);})[_0x608e('0x1e')](function(_0x5f3ae3){_0x436fc3[_0x608e('0x4e')]=_0x5f3ae3;return _0x436fc3;});}})[_0x608e('0x1e')](respondWithFilteredResult(_0x2c52b7,_0x5a0f64))['catch'](handleError(_0x2c52b7,null));};exports[_0x608e('0x4f')]=function(_0x289758,_0xdf37fd){return db[_0x608e('0x26')]['find']({'where':{'id':_0x289758['params']['id']}})[_0x608e('0x1e')](handleEntityNotFound(_0xdf37fd,null))[_0x608e('0x1e')](function(_0x55457f){if(_0x55457f){return _0x55457f[_0x608e('0x50')](_0x289758[_0x608e('0x3a')][_0x608e('0x3f')],_[_0x608e('0x40')](_0x289758[_0x608e('0x3a')],[_0x608e('0x3f'),'id'])||{})['spread'](function(){return db[_0x608e('0x51')][_0x608e('0x2b')]({'attributes':['id',_0x608e('0x22'),_0x608e('0x52')],'where':{'id':_0x289758[_0x608e('0x3a')][_0x608e('0x3f')]}});})[_0x608e('0x1e')](function(_0x332675){socket[_0x608e('0x53')](_0x608e('0x54'),{'id':Number(_0x289758[_0x608e('0x30')]['id']),'tags':_0x332675||[]});return{'id':Number(_0x289758[_0x608e('0x30')]['id']),'tags':_0x332675||[]};});}})['then'](respondWithResult(_0xdf37fd,null))[_0x608e('0x2e')](handleError(_0xdf37fd,null));};exports[_0x608e('0x55')]=function(_0x25bad5,_0x448e72){return db[_0x608e('0x26')]['find']({'where':{'id':_0x25bad5[_0x608e('0x30')]['id']}})[_0x608e('0x1e')](handleEntityNotFound(_0x448e72,null))[_0x608e('0x1e')](function(_0x331809){if(_0x331809){return _0x331809[_0x608e('0x55')](_0x25bad5['query']['ids']);}})[_0x608e('0x1e')](respondWithStatusCode(_0x448e72,null))[_0x608e('0x2e')](handleError(_0x448e72,null));};exports[_0x608e('0x56')]=function(_0x3b5c45,_0x5be72e){var _0x1c970c=moment()['unix']()[_0x608e('0x57')]();var _0x1ecee9=path[_0x608e('0x58')](config[_0x608e('0x59')],_0x608e('0x5a'),_0x608e('0x5b'),_0x608e('0x5c'));var _0x5df56c=path[_0x608e('0x58')](config['root'],'server',_0x608e('0x5b'),'attachments');var _0x512c38=path[_0x608e('0x58')](_0x1ecee9,_0x1c970c);var _0x1b72dc=util['format']('transcript-%d-%s.zip',_0x3b5c45[_0x608e('0x30')]['id'],_0x1c970c);var _0x1b0b70=path['join'](_0x1ecee9,_0x1b72dc);var _0xa46ebb=[];_0xa46ebb[_0x608e('0x5d')]({'model':db[_0x608e('0x5e')],'as':_0x608e('0x5e'),'attributes':['id',_0x608e('0x5f')],'raw':!![]});_0xa46ebb[_0x608e('0x5d')]({'model':db['CmContact'],'as':_0x608e('0x60'),'attributes':['id',_0x608e('0x61'),'lastName'],'raw':!![]});if(_0x3b5c45[_0x608e('0x2c')][_0x608e('0x62')]){_0xa46ebb['push']({'model':db[_0x608e('0x63')],'as':_0x608e('0x63'),'raw':!![]});}var _0x8c063e=[{'model':db[_0x608e('0x3e')],'as':_0x608e('0x64'),'attributes':['id','body',_0x608e('0x65'),_0x608e('0x66'),_0x608e('0x67'),_0x608e('0x68')],'include':_0xa46ebb}];_0x8c063e[_0x608e('0x5d')]({'model':db[_0x608e('0x69')],'as':_0x608e('0x6a'),'attributes':['id',_0x608e('0x22')]});_0x8c063e[_0x608e('0x5d')]({'model':db[_0x608e('0x5e')],'as':'Owner','attributes':['id',_0x608e('0x5f')]});return db[_0x608e('0x26')][_0x608e('0x3b')]({'where':{'id':_0x3b5c45[_0x608e('0x30')]['id']},'include':_0x8c063e})['then'](handleEntityNotFound(_0x5be72e,null))['then'](function(_0xa9e7a2){if(_0xa9e7a2){var _0x5ab8de=_0xa9e7a2[_0x608e('0x6b')]({'plain':!![]});fs[_0x608e('0x6c')](_0x512c38);var _0x1157a4={'channel':_0x608e('0x6d'),'account':_0x5ab8de[_0x608e('0x6a')][_0x608e('0x22')],'agent':_0x5ab8de['Owner']?_0x5ab8de[_0x608e('0x6e')][_0x608e('0x5f')]:'N.A.','createdAt':moment(_0x5ab8de[_0x608e('0x65')])[_0x608e('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x608e('0x57')](),'closedAt':_0x5ab8de['closed']?moment(_0x5ab8de[_0x608e('0x6f')])[_0x608e('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x5ab8de[_0x608e('0x70')],'messages':_(_0x5ab8de[_0x608e('0x64')])['filter']({'secret':![]})[_0x608e('0x25')](function(_0xd403dc){if(_0xd403dc[_0x608e('0x63')]){var _0x594efd=path[_0x608e('0x58')](_0x5df56c,_0xd403dc[_0x608e('0x63')]['basename']);if(fs[_0x608e('0x71')](_0x594efd)){fs['createReadStream'](_0x594efd)['pipe'](fs[_0x608e('0x72')](path[_0x608e('0x58')](_0x512c38,_0xd403dc[_0x608e('0x63')][_0x608e('0x73')])));}}return{'date':moment(_0xd403dc[_0x608e('0x65')])[_0x608e('0x4c')](_0x608e('0x4d'))['toString'](),'sender':_0xd403dc[_0x608e('0x66')]==='out'?_0xd403dc[_0x608e('0x5e')]?_0xd403dc[_0x608e('0x5e')][_0x608e('0x5f')]:_0x608e('0x74'):_0xd403dc['Contact'][_0x608e('0x61')]+(_0xd403dc[_0x608e('0x60')][_0x608e('0x75')]?'\x20'+_0xd403dc['Contact'][_0x608e('0x75')]:''),'body':_0xd403dc[_0x608e('0x63')]?_0xd403dc['Attachment']['basename']:_0xd403dc[_0x608e('0x3a')],'direction':_0xd403dc['direction']==='out'?'A':'C','secret':_0xd403dc[_0x608e('0x67')],'read':_0xd403dc[_0x608e('0x68')],'attachment':_0xd403dc[_0x608e('0x63')]};})[_0x608e('0x76')]()};return ejs[_0x608e('0x77')](path[_0x608e('0x58')](config[_0x608e('0x59')],_0x608e('0x5a'),'views',_0x608e('0x78')),{'interaction':_0x1157a4})[_0x608e('0x1e')](function(_0xf7734f){var _0x9ee00a=path[_0x608e('0x58')](_0x512c38,'transcript-'+_0x5ab8de['id']+'-'+_0x1c970c+'.pdf');var _0x5d79d3={'path':_0x9ee00a,'channel':'Whatsapp','interactionId':_0x5ab8de['id']};return pdf[_0x608e('0x79')](_0xf7734f,_0x5d79d3);})['then'](function(){return new BPromise(function(_0x5da566,_0x1dfc72){zipdir(_0x512c38,{'saveTo':_0x1b0b70},function(_0x5b0425,_0xf5bceb){if(_0x5b0425)return _0x1dfc72(_0x5b0425);return _0x5da566(_0xf5bceb);});})[_0x608e('0x1e')](function(){return new BPromise(function(_0x43f478,_0x3fe09f){rimraf(_0x512c38,function(_0x1c1c37){if(_0x1c1c37)_0x3fe09f(_0x1c1c37);return _0x43f478();});});})[_0x608e('0x1e')](function(){return _0x5be72e['download'](_0x1b0b70,_0x1b72dc,function(_0x373291){if(_0x373291){console[_0x608e('0x7a')]('err',_0x373291);}else{fs[_0x608e('0x7b')](_0x1b0b70);}});});});}else{return _0x5be72e[_0x608e('0x13')](0xc8);}})[_0x608e('0x2e')](handleError(_0x5be72e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d8dc361..578d67f 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 _0x1ca7=['setDataValue','map','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','getUsers','then'];(function(_0x376baa,_0x14960a){var _0x4bc22d=function(_0xad0e83){while(--_0xad0e83){_0x376baa['push'](_0x376baa['shift']());}};_0x4bc22d(++_0x14960a);}(_0x1ca7,0x157));var _0x71ca=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x1ca7[_0xa1e3e3];return _0xc980e9;};'use strict';var EventEmitter=require(_0x71ca('0x0'));var WhatsappInteraction=require(_0x71ca('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x71ca('0x2')](0x0);var events={'afterCreate':_0x71ca('0x3'),'afterUpdate':_0x71ca('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2501cd){return function(_0x3b6cbf,_0x58f288,_0x58c4a5){_0x3b6cbf[_0x71ca('0x5')]({'attributes':['id'],'raw':!![]})[_0x71ca('0x6')](function(_0x31444d){_0x3b6cbf[_0x71ca('0x7')]('Users',_0x31444d[_0x71ca('0x8')](function(_0x41ca0a){return{'id':_0x41ca0a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x3b6cbf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x71ca('0x6')](function(_0x2aff62){_0x3b6cbf[_0x71ca('0x7')]('unreadMessages',_0x2aff62[_0x71ca('0x9')]);WhatsappInteractionEvents[_0x71ca('0xa')](_0x2501cd+':'+_0x3b6cbf['id'],_0x3b6cbf);WhatsappInteractionEvents[_0x71ca('0xa')](_0x2501cd,_0x3b6cbf);_0x58c4a5(null);})[_0x71ca('0xb')](_0x58c4a5(null));};}for(var e in events){if(events[_0x71ca('0xc')](e)){var event=events[e];WhatsappInteraction[_0x71ca('0xd')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x777d=['map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','../../mysqldb','WhatsappInteraction','setMaxListeners','save','then'];(function(_0x234084,_0x362cde){var _0xd4ab3a=function(_0x259094){while(--_0x259094){_0x234084['push'](_0x234084['shift']());}};_0xd4ab3a(++_0x362cde);}(_0x777d,0xe9));var _0xd777=function(_0x90e3d5,_0x3eea2b){_0x90e3d5=_0x90e3d5-0x0;var _0x5c2252=_0x777d[_0x90e3d5];return _0x5c2252;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xd777('0x0'))['db'][_0xd777('0x1')];var WhatsappMessage=require(_0xd777('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd777('0x2')](0x0);var events={'afterCreate':_0xd777('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x514817){return function(_0x40b685,_0x590b33,_0x253dc1){_0x40b685['getUsers']({'attributes':['id'],'raw':!![]})[_0xd777('0x4')](function(_0x5d1a5f){_0x40b685['setDataValue']('Users',_0x5d1a5f[_0xd777('0x5')](function(_0x109514){return{'id':_0x109514['id']};}));return WhatsappMessage[_0xd777('0x6')]({'where':{'WhatsappInteractionId':_0x40b685['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd777('0x4')](function(_0x15b49e){_0x40b685[_0xd777('0x7')](_0xd777('0x8'),_0x15b49e[_0xd777('0x9')]);WhatsappInteractionEvents[_0xd777('0xa')](_0x514817+':'+_0x40b685['id'],_0x40b685);WhatsappInteractionEvents[_0xd777('0xa')](_0x514817,_0x40b685);_0x253dc1(null);})[_0xd777('0xb')](_0x253dc1(null));};}for(var e in events){if(events[_0xd777('0xc')](e)){var event=events[e];WhatsappInteraction[_0xd777('0xd')](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 e46859d..9e85fc1 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 _0xd16c=['exports','WhatsappInteraction','closed','format','lodash','../../config/logger','api','bluebird','request-promise','./whatsappInteraction.attributes'];(function(_0x4c6b65,_0xb9e04b){var _0x4eb7ba=function(_0x1b219d){while(--_0x1b219d){_0x4c6b65['push'](_0x4c6b65['shift']());}};_0x4eb7ba(++_0xb9e04b);}(_0xd16c,0xd6));var _0xcd16=function(_0xebc474,_0x59af0d){_0xebc474=_0xebc474-0x0;var _0x1bd3b4=_0xd16c[_0xebc474];return _0x1bd3b4;};'use strict';var _=require(_0xcd16('0x0'));var util=require('util');var logger=require(_0xcd16('0x1'))(_0xcd16('0x2'));var moment=require('moment');var BPromise=require(_0xcd16('0x3'));var rp=require(_0xcd16('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcd16('0x5'));module[_0xcd16('0x6')]=function(_0x5eb2ae,_0x5cd58a){return _0x5eb2ae['define'](_0xcd16('0x7'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b3134,_0x44c415,_0x5f0751){if(_0x4b3134['changed'](_0xcd16('0x8'))){_0x4b3134['closedAt']=moment()[_0xcd16('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5f0751(null,_0x4b3134);}}});}; \ No newline at end of file +var _0xc438=['exports','WhatsappInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc438,0xa7));var _0x8c43=function(_0x4b1720,_0x52bbd4){_0x4b1720=_0x4b1720-0x0;var _0x4609b6=_0xc438[_0x4b1720];return _0x4609b6;};'use strict';var _=require(_0x8c43('0x0'));var util=require('util');var logger=require(_0x8c43('0x1'))(_0x8c43('0x2'));var moment=require(_0x8c43('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c43('0x4'));var fs=require('fs');var path=require(_0x8c43('0x5'));var rimraf=require(_0x8c43('0x6'));var config=require(_0x8c43('0x7'));var attributes=require(_0x8c43('0x8'));module[_0x8c43('0x9')]=function(_0x1b62f,_0x13999f){return _0x1b62f['define'](_0x8c43('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x464a84,_0x28c8de,_0x13aae5){if(_0x464a84[_0x8c43('0xb')](_0x8c43('0xc'))){_0x464a84[_0x8c43('0xd')]=moment()[_0x8c43('0xe')](_0x8c43('0xf'));}_0x13aae5(null,_0x464a84);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 6109d9a..341b526 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 _0x0a6d=['find','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','stringify','catch','AddTagsToWhatsappInteraction'];(function(_0x34479b,_0x53b1d1){var _0x23e1b8=function(_0x22d0e6){while(--_0x22d0e6){_0x34479b['push'](_0x34479b['shift']());}};_0x23e1b8(++_0x53b1d1);}(_0x0a6d,0x1f1));var _0xd0a6=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x0a6d[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xd0a6('0x0'));var util=require(_0xd0a6('0x1'));var moment=require('moment');var BPromise=require(_0xd0a6('0x2'));var rs=require(_0xd0a6('0x3'));var fs=require('fs');var Redis=require(_0xd0a6('0x4'));var db=require(_0xd0a6('0x5'))['db'];var utils=require(_0xd0a6('0x6'));var logger=require(_0xd0a6('0x7'))(_0xd0a6('0x8'));var config=require(_0xd0a6('0x9'));var jayson=require(_0xd0a6('0xa'));var client=jayson[_0xd0a6('0xb')][_0xd0a6('0xc')]({'port':0x232a});config[_0xd0a6('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd0a6('0xd')]));require(_0xd0a6('0xe'))[_0xd0a6('0xf')](socket);function respondWithRpcPromise(_0x285e16,_0x17d359,_0x19ded6){return new BPromise(function(_0x3e5cc4,_0x1da506){return client['request'](_0x285e16,_0x19ded6)[_0xd0a6('0x10')](function(_0x1963fd){logger[_0xd0a6('0x11')](_0xd0a6('0x12'),_0x17d359,_0xd0a6('0x13'));logger[_0xd0a6('0x14')](_0xd0a6('0x15'),_0x17d359,_0xd0a6('0x13'),JSON['stringify'](_0x1963fd));if(_0x1963fd['error']){if(_0x1963fd[_0xd0a6('0x16')][_0xd0a6('0x17')]===0x1f4){logger[_0xd0a6('0x16')](_0xd0a6('0x12'),_0x17d359,_0x1963fd[_0xd0a6('0x16')][_0xd0a6('0x18')]);return _0x1da506(_0x1963fd[_0xd0a6('0x16')][_0xd0a6('0x18')]);}logger['error'](_0xd0a6('0x12'),_0x17d359,_0x1963fd[_0xd0a6('0x16')][_0xd0a6('0x18')]);return _0x3e5cc4(_0x1963fd[_0xd0a6('0x16')][_0xd0a6('0x18')]);}else{logger[_0xd0a6('0x11')](_0xd0a6('0x12'),_0x17d359,_0xd0a6('0x13'));_0x3e5cc4(_0x1963fd['result'][_0xd0a6('0x18')]);}})['catch'](function(_0x503506){logger[_0xd0a6('0x16')](_0xd0a6('0x12'),_0x17d359,_0x503506);_0x1da506(_0x503506);});});}exports[_0xd0a6('0x19')]=function(_0x138421){var _0x45941a=this;return new Promise(function(_0x1daf78,_0x683de){return db[_0xd0a6('0x1a')][_0xd0a6('0x1b')](_0x138421[_0xd0a6('0x1c')],{'raw':_0x138421[_0xd0a6('0x1d')]?_0x138421[_0xd0a6('0x1d')][_0xd0a6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x138421[_0xd0a6('0x1d')]?_0x138421['options']['where']||null:null,'attributes':_0x138421[_0xd0a6('0x1d')]?_0x138421[_0xd0a6('0x1d')][_0xd0a6('0x1f')]||null:null,'limit':_0x138421[_0xd0a6('0x1d')]?_0x138421[_0xd0a6('0x1d')][_0xd0a6('0x20')]||null:null})[_0xd0a6('0x10')](function(_0x14870f){logger['info'](_0xd0a6('0x19'),_0x138421);logger[_0xd0a6('0x14')](_0xd0a6('0x19'),_0x138421,JSON[_0xd0a6('0x21')](_0x14870f));_0x1daf78(_0x14870f);})[_0xd0a6('0x22')](function(_0x5c58d5){logger[_0xd0a6('0x16')](_0xd0a6('0x19'),_0x5c58d5[_0xd0a6('0x18')],_0x138421);_0x683de(_0x45941a['error'](0x1f4,_0x5c58d5[_0xd0a6('0x18')]));});});};exports[_0xd0a6('0x23')]=function(_0x2aa56b){return new Promise(function(_0x2fb064,_0x4fbd1c){return db['WhatsappInteraction'][_0xd0a6('0x24')]({'where':_0x2aa56b[_0xd0a6('0x1d')]?_0x2aa56b[_0xd0a6('0x1d')]['where']||null:null})[_0xd0a6('0x10')](function(_0x23500d){if(_0x23500d){return _0x23500d['addTags'](_0x2aa56b['body'][_0xd0a6('0x25')],_[_0xd0a6('0x26')](_0x2aa56b[_0xd0a6('0x1c')],[_0xd0a6('0x25'),'id'])||{});}})[_0xd0a6('0x27')](function(_0xbf91ce){logger['info'](_0xd0a6('0x28'),_0x2aa56b);logger[_0xd0a6('0x14')](_0xd0a6('0x28'),_0x2aa56b,JSON['stringify'](_0xbf91ce));_0x2fb064(_0xbf91ce);})['catch'](function(_0x130541){logger[_0xd0a6('0x16')](_0xd0a6('0x28'),_0x130541['message'],_0x2aa56b);_0x4fbd1c(_this[_0xd0a6('0x16')](0x1f4,_0x130541['message']));});});}; \ No newline at end of file +var _0xfe7f=['attributes','limit','then','AddTagsToWhatsappInteraction','find','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xfe7f,0x10b));var _0xffe7=function(_0x1e3660,_0x2f6219){_0x1e3660=_0x1e3660-0x0;var _0x55d588=_0xfe7f[_0x1e3660];return _0x55d588;};'use strict';var _=require('lodash');var util=require(_0xffe7('0x0'));var moment=require(_0xffe7('0x1'));var BPromise=require(_0xffe7('0x2'));var rs=require(_0xffe7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffe7('0x4'))['db'];var utils=require(_0xffe7('0x5'));var logger=require(_0xffe7('0x6'))(_0xffe7('0x7'));var config=require(_0xffe7('0x8'));var jayson=require(_0xffe7('0x9'));var client=jayson['client'][_0xffe7('0xa')]({'port':0x232a});config['redis']=_[_0xffe7('0xb')](config[_0xffe7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xffe7('0xd'))(new Redis(config['redis']));require(_0xffe7('0xe'))[_0xffe7('0xf')](socket);function respondWithRpcPromise(_0x51a08b,_0x140d02,_0x44b089){return new BPromise(function(_0x4228bc,_0x551beb){return client[_0xffe7('0x10')](_0x51a08b,_0x44b089)['then'](function(_0x38f4c4){logger[_0xffe7('0x11')](_0xffe7('0x12'),_0x140d02,'request\x20sent');logger[_0xffe7('0x13')](_0xffe7('0x14'),_0x140d02,_0xffe7('0x15'),JSON[_0xffe7('0x16')](_0x38f4c4));if(_0x38f4c4[_0xffe7('0x17')]){if(_0x38f4c4[_0xffe7('0x17')]['code']===0x1f4){logger[_0xffe7('0x17')](_0xffe7('0x12'),_0x140d02,_0x38f4c4[_0xffe7('0x17')][_0xffe7('0x18')]);return _0x551beb(_0x38f4c4[_0xffe7('0x17')]['message']);}logger[_0xffe7('0x17')](_0xffe7('0x12'),_0x140d02,_0x38f4c4[_0xffe7('0x17')]['message']);return _0x4228bc(_0x38f4c4['error']['message']);}else{logger['info'](_0xffe7('0x12'),_0x140d02,_0xffe7('0x15'));_0x4228bc(_0x38f4c4[_0xffe7('0x19')][_0xffe7('0x18')]);}})[_0xffe7('0x1a')](function(_0xdbf22b){logger[_0xffe7('0x17')](_0xffe7('0x12'),_0x140d02,_0xdbf22b);_0x551beb(_0xdbf22b);});});}exports[_0xffe7('0x1b')]=function(_0x1501f8){var _0x22aa79=this;return new Promise(function(_0xee8cfc,_0x2aa926){return db[_0xffe7('0x1c')][_0xffe7('0x1d')](_0x1501f8[_0xffe7('0x1e')],{'raw':_0x1501f8[_0xffe7('0x1f')]?_0x1501f8[_0xffe7('0x1f')][_0xffe7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1501f8[_0xffe7('0x1f')]?_0x1501f8[_0xffe7('0x1f')][_0xffe7('0x21')]||null:null,'attributes':_0x1501f8['options']?_0x1501f8[_0xffe7('0x1f')][_0xffe7('0x22')]||null:null,'limit':_0x1501f8[_0xffe7('0x1f')]?_0x1501f8[_0xffe7('0x1f')][_0xffe7('0x23')]||null:null})[_0xffe7('0x24')](function(_0x55dfc9){logger['info']('UpdateWhatsappInteraction',_0x1501f8);logger[_0xffe7('0x13')](_0xffe7('0x1b'),_0x1501f8,JSON[_0xffe7('0x16')](_0x55dfc9));_0xee8cfc(_0x55dfc9);})['catch'](function(_0xac998d){logger[_0xffe7('0x17')](_0xffe7('0x1b'),_0xac998d['message'],_0x1501f8);_0x2aa926(_0x22aa79[_0xffe7('0x17')](0x1f4,_0xac998d['message']));});});};exports[_0xffe7('0x25')]=function(_0x3dc6e1){return new Promise(function(_0x54f7a3,_0x5e52ab){return db['WhatsappInteraction'][_0xffe7('0x26')]({'where':_0x3dc6e1[_0xffe7('0x1f')]?_0x3dc6e1[_0xffe7('0x1f')]['where']||null:null})['then'](function(_0xd782d){if(_0xd782d){return _0xd782d['addTags'](_0x3dc6e1[_0xffe7('0x1e')]['ids'],_[_0xffe7('0x27')](_0x3dc6e1[_0xffe7('0x1e')],[_0xffe7('0x28'),'id'])||{});}})[_0xffe7('0x29')](function(_0x166e6c){logger[_0xffe7('0x11')](_0xffe7('0x2a'),_0x3dc6e1);logger['debug'](_0xffe7('0x2a'),_0x3dc6e1,JSON[_0xffe7('0x16')](_0x166e6c));_0x54f7a3(_0x166e6c);})[_0xffe7('0x1a')](function(_0x2bfe63){logger['error']('AddTags',_0x2bfe63[_0xffe7('0x18')],_0x3dc6e1);_0x5e52ab(_this['error'](0x1f4,_0x2bfe63[_0xffe7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index f79b303..2e57de7 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 _0xc2be=['emit','removeListener','register','length','save','remove'];(function(_0x2e8f04,_0x1a873d){var _0x383747=function(_0x39a24a){while(--_0x39a24a){_0x2e8f04['push'](_0x2e8f04['shift']());}};_0x383747(++_0x1a873d);}(_0xc2be,0xf4));var _0xec2b=function(_0x10eb38,_0x2086bd){_0x10eb38=_0x10eb38-0x0;var _0x5af9b5=_0xc2be[_0x10eb38];return _0x5af9b5;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xec2b('0x0'),_0xec2b('0x1'),'update'];function createListener(_0x5d92cb,_0x36561e){return function(_0xd71ae2){_0x36561e[_0xec2b('0x2')](_0x5d92cb,_0xd71ae2);};}function removeListener(_0x5081e2,_0x5382f3){return function(){WhatsappInteractionEvents[_0xec2b('0x3')](_0x5081e2,_0x5382f3);};}exports[_0xec2b('0x4')]=function(_0x475ef3){for(var _0x3f8944=0x0,_0x8d7afe=events[_0xec2b('0x5')];_0x3f8944<_0x8d7afe;_0x3f8944++){var _0x1cd222=events[_0x3f8944];var _0x8b4d1d=createListener('whatsappInteraction:'+_0x1cd222,_0x475ef3);WhatsappInteractionEvents['on'](_0x1cd222,_0x8b4d1d);}}; \ No newline at end of file +var _0xd6d9=['removeListener','length','whatsappInteraction:','./whatsappInteraction.events','update'];(function(_0x1b655f,_0x5e3422){var _0x5330f5=function(_0x3784a8){while(--_0x3784a8){_0x1b655f['push'](_0x1b655f['shift']());}};_0x5330f5(++_0x5e3422);}(_0xd6d9,0x99));var _0x9d6d=function(_0x200fc2,_0x415f7c){_0x200fc2=_0x200fc2-0x0;var _0x49ff6e=_0xd6d9[_0x200fc2];return _0x49ff6e;};'use strict';var WhatsappInteractionEvents=require(_0x9d6d('0x0'));var events=['save','remove',_0x9d6d('0x1')];function createListener(_0x2099b5,_0x371e6a){return function(_0xcc02fc){_0x371e6a['emit'](_0x2099b5,_0xcc02fc);};}function removeListener(_0x391b2e,_0x326bd6){return function(){WhatsappInteractionEvents[_0x9d6d('0x2')](_0x391b2e,_0x326bd6);};}exports['register']=function(_0x41fa73){for(var _0x1118cf=0x0,_0x4495c3=events[_0x9d6d('0x3')];_0x1118cf<_0x4495c3;_0x1118cf++){var _0x28d5ea=events[_0x1118cf];var _0x1d175b=createListener(_0x9d6d('0x4')+_0x28d5ea,_0x41fa73);WhatsappInteractionEvents['on'](_0x28d5ea,_0x1d175b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index e56aac7..e634819 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 _0xebcd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','whatsapp','whatsappmessage:create','/:id/status','status','put','accept','reject','delete','destroy','exports','multer','connect-timeout'];(function(_0x3aef67,_0x28e543){var _0x54b5b6=function(_0x1e7298){while(--_0x1e7298){_0x3aef67['push'](_0x3aef67['shift']());}};_0x54b5b6(++_0x28e543);}(_0xebcd,0xd6));var _0xdebc=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0xebcd[_0x1ac6ec];return _0x48a489;};'use strict';var multer=require(_0xdebc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdebc('0x1'));var express=require(_0xdebc('0x2'));var router=express[_0xdebc('0x3')]();var fs_extra=require(_0xdebc('0x4'));var auth=require(_0xdebc('0x5'));var interaction=require(_0xdebc('0x6'));var config=require(_0xdebc('0x7'));var controller=require(_0xdebc('0x8'));router[_0xdebc('0x9')]('/',auth[_0xdebc('0xa')](),controller[_0xdebc('0xb')]);router[_0xdebc('0x9')](_0xdebc('0xc'),auth[_0xdebc('0xa')](),controller[_0xdebc('0xd')]);router[_0xdebc('0x9')](_0xdebc('0xe'),auth[_0xdebc('0xa')](),controller[_0xdebc('0xf')]);router[_0xdebc('0x10')]('/',auth[_0xdebc('0xa')](),interaction['tracked'](_0xdebc('0x11'),_0xdebc('0x12')),controller['create']);router[_0xdebc('0x10')](_0xdebc('0x13'),controller[_0xdebc('0x14')]);router[_0xdebc('0x15')](_0xdebc('0xe'),auth[_0xdebc('0xa')](),controller['update']);router[_0xdebc('0x15')]('/:id/accept',auth[_0xdebc('0xa')](),controller[_0xdebc('0x16')]);router[_0xdebc('0x15')]('/:id/reject',auth[_0xdebc('0xa')](),controller[_0xdebc('0x17')]);router[_0xdebc('0x18')](_0xdebc('0xe'),auth[_0xdebc('0xa')](),controller[_0xdebc('0x19')]);module[_0xdebc('0x1a')]=router; \ No newline at end of file +var _0xe817=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer'];(function(_0x557431,_0x2b9634){var _0x4f4948=function(_0x84b0b7){while(--_0x84b0b7){_0x557431['push'](_0x557431['shift']());}};_0x4f4948(++_0x2b9634);}(_0xe817,0x1d0));var _0x7e81=function(_0x3b5574,_0x2df38c){_0x3b5574=_0x3b5574-0x0;var _0x50b02a=_0xe817[_0x3b5574];return _0x50b02a;};'use strict';var multer=require(_0x7e81('0x0'));var util=require(_0x7e81('0x1'));var path=require(_0x7e81('0x2'));var timeout=require(_0x7e81('0x3'));var express=require(_0x7e81('0x4'));var router=express[_0x7e81('0x5')]();var fs_extra=require(_0x7e81('0x6'));var auth=require(_0x7e81('0x7'));var interaction=require(_0x7e81('0x8'));var config=require(_0x7e81('0x9'));var controller=require(_0x7e81('0xa'));router[_0x7e81('0xb')]('/',auth[_0x7e81('0xc')](),controller[_0x7e81('0xd')]);router[_0x7e81('0xb')](_0x7e81('0xe'),auth[_0x7e81('0xc')](),controller['describe']);router[_0x7e81('0xb')](_0x7e81('0xf'),auth[_0x7e81('0xc')](),controller[_0x7e81('0x10')]);router[_0x7e81('0x11')]('/',auth[_0x7e81('0xc')](),interaction[_0x7e81('0x12')](_0x7e81('0x13'),_0x7e81('0x14')),controller[_0x7e81('0x15')]);router[_0x7e81('0x11')](_0x7e81('0x16'),controller[_0x7e81('0x17')]);router[_0x7e81('0x18')]('/:id',auth[_0x7e81('0xc')](),controller[_0x7e81('0x19')]);router[_0x7e81('0x18')](_0x7e81('0x1a'),auth['isAuthenticated'](),controller[_0x7e81('0x1b')]);router[_0x7e81('0x18')](_0x7e81('0x1c'),auth[_0x7e81('0xc')](),controller[_0x7e81('0x1d')]);router['delete'](_0x7e81('0xf'),auth[_0x7e81('0xc')](),controller[_0x7e81('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 1f275eb..e657a96 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 _0xc16b=['TEXT','sequelize','exports','medium','STRING','DATE'];(function(_0x1f615b,_0x2ffbee){var _0xe1830b=function(_0xc0972){while(--_0xc0972){_0x1f615b['push'](_0x1f615b['shift']());}};_0xe1830b(++_0x2ffbee);}(_0xc16b,0x109));var _0xbc16=function(_0x5c5227,_0x1b7b53){_0x5c5227=_0x5c5227-0x0;var _0x39b7ca=_0xc16b[_0x5c5227];return _0x39b7ca;};'use strict';var Sequelize=require(_0xbc16('0x0'));module[_0xbc16('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbc16('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbc16('0x3')]},'readAt':{'type':Sequelize[_0xbc16('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbc16('0x3')]},'providerResponse':{'type':Sequelize[_0xbc16('0x5')]}}; \ No newline at end of file +var _0xcde0=['STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0xcde0,0x14a));var _0x0cde=function(_0x3905f6,_0x25f751){_0x3905f6=_0x3905f6-0x0;var _0x26d195=_0xcde0[_0x3905f6];return _0x26d195;};'use strict';var Sequelize=require(_0x0cde('0x0'));module[_0x0cde('0x1')]={'body':{'type':Sequelize[_0x0cde('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0cde('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0cde('0x4')]('in',_0x0cde('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x0cde('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0cde('0x6')]},'readAt':{'type':Sequelize[_0x0cde('0x7')]},'secret':{'type':Sequelize[_0x0cde('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0cde('0x6')]},'providerResponse':{'type':Sequelize[_0x0cde('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b144b67..afa3967 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 _0x5535=['count','Content-Range','reject','update','destroy','name','send','index','WhatsappMessage','rawAttributes','key','model','map','query','intersection','attributes','fields','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','length','create','body','find','describe','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[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','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit'];(function(_0x1d75dc,_0x333bdd){var _0x8375ad=function(_0x571550){while(--_0x571550){_0x1d75dc['push'](_0x1d75dc['shift']());}};_0x8375ad(++_0x333bdd);}(_0x5535,0x175));var _0x5553=function(_0x4db27e,_0x1e95f6){_0x4db27e=_0x4db27e-0x0;var _0x522ece=_0x5535[_0x4db27e];return _0x522ece;};'use strict';var emlformat=require(_0x5553('0x0'));var rimraf=require(_0x5553('0x1'));var zipdir=require(_0x5553('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5553('0x3'));var moment=require('moment');var BPromise=require(_0x5553('0x4'));var Mustache=require(_0x5553('0x5'));var util=require(_0x5553('0x6'));var path=require(_0x5553('0x7'));var sox=require(_0x5553('0x8'));var csv=require(_0x5553('0x9'));var ejs=require(_0x5553('0xa'));var fs=require('fs');var fs_extra=require(_0x5553('0xb'));var _=require(_0x5553('0xc'));var squel=require(_0x5553('0xd'));var crypto=require('crypto');var jsforce=require(_0x5553('0xe'));var deskjs=require(_0x5553('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5553('0x10'));var Papa=require(_0x5553('0x11'));var Redis=require(_0x5553('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5553('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5553('0x14'));var logger=require(_0x5553('0x15'))(_0x5553('0x16'));var utils=require('../../config/utils');var config=require(_0x5553('0x17'));var licenseUtil=require(_0x5553('0x18'));var db=require(_0x5553('0x19'))['db'];config[_0x5553('0x1a')]=_[_0x5553('0x1b')](config['redis'],{'host':_0x5553('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5553('0x1a')]));require(_0x5553('0x1d'))['register'](socket);var jayson=require(_0x5553('0x1e'));var client=jayson[_0x5553('0x1f')][_0x5553('0x20')]({'port':0x232c});var client9002=jayson[_0x5553('0x1f')][_0x5553('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x30758f,_0x5996da,_0x10bdb2,_0x16909a){return new BPromise(function(_0x5b8dde,_0x23745f){var _0x7206e6=_0x16909a||client;return _0x7206e6['request'](_0x30758f,_0x10bdb2)[_0x5553('0x21')](function(_0x1a513c){logger[_0x5553('0x22')](_0x5553('0x23'),_0x5996da,_0x5553('0x24'));logger[_0x5553('0x25')](_0x5553('0x26'),_0x5996da,_0x5553('0x24'),JSON['stringify'](_0x1a513c));if(_0x1a513c['error']){if(_0x1a513c[_0x5553('0x27')][_0x5553('0x28')]===0x1f4){logger['error'](_0x5553('0x23'),_0x5996da,_0x1a513c['error'][_0x5553('0x29')]);return _0x23745f(_0x1a513c[_0x5553('0x27')][_0x5553('0x29')]);}logger[_0x5553('0x27')](_0x5553('0x23'),_0x5996da,_0x1a513c['error'][_0x5553('0x29')]);return _0x5b8dde(_0x1a513c['error'][_0x5553('0x29')]);}else{logger[_0x5553('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x5996da,_0x5553('0x24'));_0x5b8dde(_0x1a513c[_0x5553('0x2a')][_0x5553('0x29')]);}})[_0x5553('0x2b')](function(_0x321066){logger[_0x5553('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x5996da,_0x321066);_0x23745f(_0x321066);});});}function respondWithStatusCode(_0x36639e,_0x1eb215){_0x1eb215=_0x1eb215||0xcc;return function(_0x1ada5a){if(_0x1ada5a){return _0x36639e[_0x5553('0x2c')](_0x1eb215);}return _0x36639e['status'](_0x1eb215)['end']();};}function respondWithResult(_0x7e5333,_0x50d5d1){_0x50d5d1=_0x50d5d1||0xc8;return function(_0x366c37){if(_0x366c37){return _0x7e5333[_0x5553('0x2d')](_0x50d5d1)[_0x5553('0x2e')](_0x366c37);}};}function respondWithFilteredResult(_0x53f20b,_0x11b9ff){return function(_0x5eb76e){if(_0x5eb76e){var _0x30f4b9=typeof _0x11b9ff[_0x5553('0x2f')]===_0x5553('0x30')&&typeof _0x11b9ff[_0x5553('0x31')]==='undefined';var _0x59b5ea=_0x5eb76e[_0x5553('0x32')];var _0x4e04a3=_0x30f4b9?0x0:_0x11b9ff['offset'];var _0x5844f3=_0x30f4b9?_0x5eb76e[_0x5553('0x32')]:_0x11b9ff[_0x5553('0x2f')]+_0x11b9ff[_0x5553('0x31')];var _0xb97f4b;if(_0x5844f3>=_0x59b5ea){_0x5844f3=_0x59b5ea;_0xb97f4b=0xc8;}else{_0xb97f4b=0xce;}_0x53f20b[_0x5553('0x2d')](_0xb97f4b);return _0x53f20b['set'](_0x5553('0x33'),_0x4e04a3+'-'+_0x5844f3+'/'+_0x59b5ea)[_0x5553('0x2e')](_0x5eb76e);}return null;};}function patchUpdates(_0x3e6e58){return function(_0x29b00b){try{jsonpatch['apply'](_0x29b00b,_0x3e6e58,!![]);}catch(_0xcac29d){return BPromise[_0x5553('0x34')](_0xcac29d);}return _0x29b00b['save']();};}function saveUpdates(_0x1a1dc1,_0x4f3bea){return function(_0x39d85a){if(_0x39d85a){return _0x39d85a[_0x5553('0x35')](_0x1a1dc1)[_0x5553('0x21')](function(_0x1c0539){return _0x1c0539;});}return null;};}function removeEntity(_0x3e1f1c,_0x346c67){return function(_0x5c33d2){if(_0x5c33d2){return _0x5c33d2[_0x5553('0x36')]()[_0x5553('0x21')](function(){_0x3e1f1c[_0x5553('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22cb5b,_0x2be7c0){return function(_0x235a4c){if(!_0x235a4c){_0x22cb5b[_0x5553('0x2c')](0x194);}return _0x235a4c;};}function handleError(_0x1c2a05,_0x4fbce4){_0x4fbce4=_0x4fbce4||0x1f4;return function(_0x2b61dc){logger[_0x5553('0x27')](_0x2b61dc['stack']);if(_0x2b61dc[_0x5553('0x37')]){delete _0x2b61dc['name'];}_0x1c2a05[_0x5553('0x2d')](_0x4fbce4)[_0x5553('0x38')](_0x2b61dc);};}exports[_0x5553('0x39')]=function(_0x58960d,_0x31abb9){var _0x174d68={},_0x52e1cb={},_0x313a1f={'count':0x0,'rows':[]};var _0x4426d3=_['map'](db[_0x5553('0x3a')][_0x5553('0x3b')],function(_0x3d7a5c){return{'name':_0x3d7a5c['fieldName'],'type':_0x3d7a5c['type'][_0x5553('0x3c')]};});_0x52e1cb[_0x5553('0x3d')]=_[_0x5553('0x3e')](_0x4426d3,_0x5553('0x37'));_0x52e1cb[_0x5553('0x3f')]=_['keys'](_0x58960d[_0x5553('0x3f')]);_0x52e1cb['filters']=_[_0x5553('0x40')](_0x52e1cb['model'],_0x52e1cb['query']);_0x174d68[_0x5553('0x41')]=_[_0x5553('0x40')](_0x52e1cb[_0x5553('0x3d')],qs[_0x5553('0x42')](_0x58960d[_0x5553('0x3f')][_0x5553('0x42')]));_0x174d68['attributes']=_0x174d68[_0x5553('0x41')]['length']?_0x174d68[_0x5553('0x41')]:_0x52e1cb[_0x5553('0x3d')];if(!_0x58960d[_0x5553('0x3f')]['hasOwnProperty']('nolimit')){_0x174d68[_0x5553('0x31')]=qs['limit'](_0x58960d[_0x5553('0x3f')]['limit']);_0x174d68[_0x5553('0x2f')]=qs[_0x5553('0x2f')](_0x58960d[_0x5553('0x3f')]['offset']);}_0x174d68[_0x5553('0x43')]=qs[_0x5553('0x44')](_0x58960d[_0x5553('0x3f')]['sort']);_0x174d68[_0x5553('0x45')]=qs[_0x5553('0x46')](_[_0x5553('0x47')](_0x58960d[_0x5553('0x3f')],_0x52e1cb[_0x5553('0x46')]),_0x4426d3);if(_0x58960d[_0x5553('0x3f')]['filter']){_0x174d68[_0x5553('0x45')]=_[_0x5553('0x48')](_0x174d68[_0x5553('0x45')],{'$or':_[_0x5553('0x3e')](_0x4426d3,function(_0x2c86a2){if(_0x2c86a2[_0x5553('0x49')]!==_0x5553('0x4a')){var _0x5b8355={};_0x5b8355[_0x2c86a2['name']]={'$like':'%'+_0x58960d[_0x5553('0x3f')][_0x5553('0x4b')]+'%'};return _0x5b8355;}})});}_0x174d68=_[_0x5553('0x48')]({},_0x174d68,_0x58960d[_0x5553('0x4c')]);var _0x5547f6={'where':_0x174d68[_0x5553('0x45')]};return db[_0x5553('0x3a')][_0x5553('0x32')](_0x5547f6)['then'](function(_0x20ed8b){_0x313a1f[_0x5553('0x32')]=_0x20ed8b;if(_0x58960d[_0x5553('0x3f')][_0x5553('0x4d')]){_0x174d68[_0x5553('0x4e')]=[{'all':!![]}];}return db[_0x5553('0x3a')][_0x5553('0x4f')](_0x174d68);})[_0x5553('0x21')](function(_0x27b8f1){_0x313a1f['rows']=_0x27b8f1;return _0x313a1f;})[_0x5553('0x21')](respondWithFilteredResult(_0x31abb9,_0x174d68))[_0x5553('0x2b')](handleError(_0x31abb9,null));};exports[_0x5553('0x50')]=function(_0x5ac119,_0x2584fe){var _0x56b18f={'raw':!![],'where':{'id':_0x5ac119[_0x5553('0x51')]['id']}},_0x2728e0={};_0x2728e0[_0x5553('0x3d')]=_[_0x5553('0x52')](db[_0x5553('0x3a')][_0x5553('0x3b')]);_0x2728e0[_0x5553('0x3f')]=_[_0x5553('0x52')](_0x5ac119['query']);_0x2728e0[_0x5553('0x46')]=_[_0x5553('0x40')](_0x2728e0[_0x5553('0x3d')],_0x2728e0[_0x5553('0x3f')]);_0x56b18f[_0x5553('0x41')]=_[_0x5553('0x40')](_0x2728e0[_0x5553('0x3d')],qs[_0x5553('0x42')](_0x5ac119[_0x5553('0x3f')][_0x5553('0x42')]));_0x56b18f['attributes']=_0x56b18f['attributes'][_0x5553('0x53')]?_0x56b18f[_0x5553('0x41')]:_0x2728e0[_0x5553('0x3d')];if(_0x5ac119[_0x5553('0x3f')][_0x5553('0x4d')]){_0x56b18f[_0x5553('0x4e')]=[{'all':!![]}];}_0x56b18f=_[_0x5553('0x48')]({},_0x56b18f,_0x5ac119[_0x5553('0x4c')]);return db[_0x5553('0x3a')]['find'](_0x56b18f)[_0x5553('0x21')](handleEntityNotFound(_0x2584fe,null))[_0x5553('0x21')](respondWithResult(_0x2584fe,null))[_0x5553('0x2b')](handleError(_0x2584fe,null));};exports[_0x5553('0x54')]=function(_0x5bf6b1,_0x389fe9){return db[_0x5553('0x3a')]['create'](_0x5bf6b1['body'],{})[_0x5553('0x21')](respondWithResult(_0x389fe9,0xc9))[_0x5553('0x2b')](handleError(_0x389fe9,null));};exports['update']=function(_0x4bfbd4,_0x5dc800){if(_0x4bfbd4['body']['id']){delete _0x4bfbd4[_0x5553('0x55')]['id'];}return db[_0x5553('0x3a')][_0x5553('0x56')]({'where':{'id':_0x4bfbd4[_0x5553('0x51')]['id']}})[_0x5553('0x21')](handleEntityNotFound(_0x5dc800,null))[_0x5553('0x21')](saveUpdates(_0x4bfbd4[_0x5553('0x55')],null))[_0x5553('0x21')](respondWithResult(_0x5dc800,null))[_0x5553('0x2b')](handleError(_0x5dc800,null));};exports['destroy']=function(_0x39a670,_0x4aec5b){return db[_0x5553('0x3a')]['find']({'where':{'id':_0x39a670[_0x5553('0x51')]['id']}})[_0x5553('0x21')](handleEntityNotFound(_0x4aec5b,null))[_0x5553('0x21')](removeEntity(_0x4aec5b,null))[_0x5553('0x2b')](handleError(_0x4aec5b,null));};exports[_0x5553('0x57')]=function(_0x15e7ed,_0x337fcc){return db[_0x5553('0x3a')]['describe']()[_0x5553('0x21')](respondWithResult(_0x337fcc,null))[_0x5553('0x2b')](handleError(_0x337fcc,null));};var interaction_log=require(_0x5553('0x15'))('whatsapp-interactions');exports[_0x5553('0x58')]=function(_0x51d3ad,_0x34cb39,_0x5a95ea){var _0x2eb118={'agent':{},'channel':_0x5553('0x59')};if(_0x51d3ad[_0x5553('0x55')]['id']){delete _0x51d3ad['body']['id'];}_0x51d3ad[_0x5553('0x55')][_0x5553('0x5a')]=!![];_0x51d3ad[_0x5553('0x55')][_0x5553('0x5b')]=moment()[_0x5553('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x51d3ad[_0x5553('0x55')]['UserId']=_0x51d3ad[_0x5553('0x55')][_0x5553('0x5d')]||_0x51d3ad[_0x5553('0x5e')]['id'];_0x2eb118[_0x5553('0x5f')]['id']=_0x51d3ad['body'][_0x5553('0x5d')];return db[_0x5553('0x3a')][_0x5553('0x56')]({'where':{'id':_0x51d3ad[_0x5553('0x51')]['id'],'UserId':null}})[_0x5553('0x21')](handleEntityNotFound(_0x34cb39,null))[_0x5553('0x21')](saveUpdates(_0x51d3ad[_0x5553('0x55')],null))[_0x5553('0x21')](function(_0x54df60){if(_0x54df60){_0x2eb118[_0x5553('0x29')]=_0x54df60[_0x5553('0x60')]({'plain':!![]});return db[_0x5553('0x61')][_0x5553('0x56')]({'where':{'id':_0x54df60[_0x5553('0x62')]}});}return null;})[_0x5553('0x21')](handleEntityNotFound(_0x34cb39,null))[_0x5553('0x21')](function(_0x73c099){if(_0x73c099){return _0x73c099['update']({'UserId':_0x51d3ad[_0x5553('0x55')][_0x5553('0x5d')],'read1stAt':_[_0x5553('0x63')](_0x73c099[_0x5553('0x64')])?moment()[_0x5553('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5553('0x21')](function(_0x5a8573){if(_0x5a8573){_0x2eb118['interaction']=_0x5a8573[_0x5553('0x60')]({'plain':!![]});interaction_log[_0x5553('0x22')](_0x5553('0x65'),_0x51d3ad[_0x5553('0x5e')]['id'],_0x51d3ad[_0x5553('0x5e')][_0x5553('0x37')],_0x51d3ad[_0x5553('0x5e')][_0x5553('0x66')],_0x2eb118[_0x5553('0x67')]['id'],_0x51d3ad[_0x5553('0x55')]?JSON['stringify'](_0x51d3ad[_0x5553('0x55')]):_0x5553('0x68'));return respondWithRpcPromise('AcceptMessage',_0x5553('0x69'),_0x2eb118);}return null;})[_0x5553('0x21')](function(_0x345d14){var _0x2b07de=_0x5553('0x6a')+_0x345d14[_0x5553('0x29')][_0x5553('0x6b')];return db[_0x5553('0x6c')][_0x5553('0x3f')](_0x2b07de,{'type':db[_0x5553('0x6d')][_0x5553('0x6e')][_0x5553('0x6f')],'raw':!![]})[_0x5553('0x21')](function(_0x53ebd5){return _0x53ebd5;});})['then'](function(_0x29465d){if(_0x29465d){_0x2eb118[_0x5553('0x29')]['contact']=_0x29465d[0x0];if(!_0x51d3ad[_0x5553('0x55')]['UserId'])return;return db[_0x5553('0x70')]['find']({'where':{'id':_0x51d3ad['body'][_0x5553('0x5d')],'role':_0x5553('0x5f')},'attributes':['id',_0x5553('0x37'),_0x5553('0x71'),_0x5553('0x72'),_0x5553('0x73')],'raw':!![]});}return null;})[_0x5553('0x21')](function(_0x175d02){if(!_0x175d02)return null;_0x2eb118['message'][_0x5553('0x5f')]=_0x175d02;return _0x2eb118;})[_0x5553('0x21')](function(_0x126d54){if(_0x126d54){if(_0x51d3ad['body'][_0x5553('0x74')]){_0x2eb118[_0x5553('0x29')][_0x5553('0x75')]=util[_0x5553('0x5c')](_0x5553('0x76'),_0x51d3ad['user'][_0x5553('0x37')]);_0x2eb118[_0x5553('0x29')][_0x5553('0x77')]=_0x2eb118[_0x5553('0x77')];_0x2eb118[_0x5553('0x29')][_0x5553('0x78')]=_0x2eb118[_0x5553('0x77')];_0x2eb118[_0x5553('0x29')][_0x5553('0x79')]=_0x5553('0x58');return respondWithRpcPromise(_0x5553('0x7a'),_0x5553('0x7a'),{'event':_0x5553('0x7b'),'message':_0x2eb118[_0x5553('0x29')]},client9002)[_0x5553('0x21')](function(){return _0x2eb118;});}return _0x2eb118;}return null;})['then'](respondWithResult(_0x34cb39,null))['catch'](handleError(_0x34cb39,null));};var interaction_log=require('../../config/logger')(_0x5553('0x7c'));exports['reject']=function(_0x4d91a1,_0x76fb57,_0x17e10c){var _0x42ead8={'agent':{},'channel':_0x5553('0x59')};if(_0x4d91a1[_0x5553('0x55')]['id']){delete _0x4d91a1['body']['id'];}_0x4d91a1[_0x5553('0x55')][_0x5553('0x5d')]=_0x4d91a1[_0x5553('0x55')][_0x5553('0x5d')]||_0x4d91a1[_0x5553('0x5e')]['id'];_0x42ead8[_0x5553('0x5f')]['id']=_0x4d91a1[_0x5553('0x55')][_0x5553('0x5d')];return db[_0x5553('0x3a')]['find']({'where':{'id':_0x4d91a1[_0x5553('0x51')]['id'],'UserId':null}})[_0x5553('0x21')](handleEntityNotFound(_0x76fb57,null))['then'](function(_0x35786d){if(_0x35786d){_0x42ead8[_0x5553('0x29')]=_0x35786d['get']({'plain':!![]});return db['WhatsappInteraction'][_0x5553('0x56')]({'where':{'id':_0x35786d[_0x5553('0x62')]}});}return null;})[_0x5553('0x21')](handleEntityNotFound(_0x76fb57,null))['then'](function(_0x445230){if(_0x445230){_0x42ead8['interaction']=_0x445230[_0x5553('0x60')]({'plain':!![]});interaction_log[_0x5553('0x22')](_0x5553('0x7d'),_0x4d91a1[_0x5553('0x5e')]['id'],_0x4d91a1[_0x5553('0x5e')][_0x5553('0x37')],_0x4d91a1['user']['role'],_0x42ead8[_0x5553('0x67')]['id'],_0x4d91a1[_0x5553('0x55')]?JSON[_0x5553('0x7e')](_0x4d91a1[_0x5553('0x55')]):_0x5553('0x68'));return respondWithRpcPromise(_0x5553('0x7f'),_0x5553('0x80'),_0x42ead8);}return null;})['then'](function(_0x3299d4){var _0x4063db=_0x5553('0x6a')+_0x3299d4[_0x5553('0x29')]['ContactId'];return db[_0x5553('0x6c')][_0x5553('0x3f')](_0x4063db,{'type':db[_0x5553('0x6d')][_0x5553('0x6e')][_0x5553('0x6f')],'raw':!![]})[_0x5553('0x21')](function(_0x1664c3){return _0x1664c3;});})[_0x5553('0x21')](function(_0x4443c7){if(_0x4443c7){_0x42ead8[_0x5553('0x29')][_0x5553('0x81')]=_0x4443c7[0x0];if(!_0x4d91a1[_0x5553('0x55')]['UserId'])return;return db[_0x5553('0x70')]['find']({'where':{'id':_0x4d91a1[_0x5553('0x55')][_0x5553('0x5d')],'role':_0x5553('0x5f')},'attributes':['id','name',_0x5553('0x71'),_0x5553('0x72'),_0x5553('0x73')],'raw':!![]});}return null;})[_0x5553('0x21')](function(_0x3527dc){if(!_0x3527dc)return null;_0x42ead8[_0x5553('0x29')][_0x5553('0x5f')]=_0x3527dc;return _0x42ead8;})['then'](function(_0x5037c4){if(_0x5037c4){_0x5037c4['message'][_0x5553('0x75')]=util['format'](_0x5553('0x76'),_0x4d91a1[_0x5553('0x5e')][_0x5553('0x37')]);_0x5037c4[_0x5553('0x29')][_0x5553('0x77')]=_0x42ead8['channel'];_0x5037c4[_0x5553('0x29')][_0x5553('0x78')]=_0x42ead8[_0x5553('0x77')];_0x5037c4[_0x5553('0x29')][_0x5553('0x79')]=_0x5553('0x34');respondWithRpcPromise(_0x5553('0x7a'),_0x5553('0x7a'),{'event':_0x5553('0x82'),'message':_0x5037c4['message']},client9002);return _0x42ead8;}return null;})[_0x5553('0x21')](respondWithResult(_0x76fb57,null))[_0x5553('0x2b')](handleError(_0x76fb57,null));};exports[_0x5553('0x2d')]=function(_0x19d988,_0x1cb5df,_0x381ad5){if(_0x19d988[_0x5553('0x55')]['id']){delete _0x19d988[_0x5553('0x55')]['id'];}var _0x5639b3;return db[_0x5553('0x3a')][_0x5553('0x56')]({'where':{'id':_0x19d988[_0x5553('0x51')]['id']}})[_0x5553('0x21')](handleEntityNotFound(_0x1cb5df,null))[_0x5553('0x21')](function(_0xb8370e){if(_0xb8370e){_0x5639b3=_0xb8370e;return db[_0x5553('0x83')][_0x5553('0x56')]({'where':{'id':_0xb8370e[_0x5553('0x84')]}});}})['then'](handleEntityNotFound(_0x1cb5df,null))['then'](function(_0xab4f26){if(_0xab4f26){logger[_0x5553('0x25')](_0x5553('0x85'),_0x5553('0x2d'),_0x5553('0x86'),_0xab4f26['type'],util['inspect'](_0x19d988[_0x5553('0x55')],{'showHidden':![],'depth':null}));switch(_0xab4f26[_0x5553('0x49')]){case'twilio':if(_0x19d988[_0x5553('0x55')][_0x5553('0x87')]&&_0x19d988[_0x5553('0x55')][_0x5553('0x87')]===_0x5639b3[_0x5553('0x88')]&&_0x19d988[_0x5553('0x55')]['MessageStatus']&&_0x19d988['body'][_0x5553('0x89')]===_0x5553('0x5a')){return _0x5639b3[_0x5553('0x35')]({'read':!![]});}else{logger[_0x5553('0x27')](_0x5553('0x8a'),_0x5553('0x2d'),_0x5553('0x8b'),util[_0x5553('0x8c')](_0x19d988['body'],{'showHidden':![],'depth':null}));}break;}return _0x5639b3;}})[_0x5553('0x21')](respondWithResult(_0x1cb5df,null))[_0x5553('0x2b')](handleError(_0x1cb5df,null));}; \ No newline at end of file +var _0x768a=['eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','include','WhatsappMessage','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','whatsapp-interactions','whatsapp','read','readAt','format','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','SELECT','interface','reject','rejectmessage','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','update','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x22eb23,_0x4505c1){var _0x352f32=function(_0x4222d2){while(--_0x4222d2){_0x22eb23['push'](_0x22eb23['shift']());}};_0x352f32(++_0x4505c1);}(_0x768a,0x8a));var _0xa768=function(_0x32c875,_0x3e6ba7){_0x32c875=_0x32c875-0x0;var _0x10d9cd=_0x768a[_0x32c875];return _0x10d9cd;};'use strict';var emlformat=require(_0xa768('0x0'));var rimraf=require(_0xa768('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa768('0x2'));var rp=require(_0xa768('0x3'));var moment=require('moment');var BPromise=require(_0xa768('0x4'));var Mustache=require('mustache');var util=require(_0xa768('0x5'));var path=require(_0xa768('0x6'));var sox=require(_0xa768('0x7'));var csv=require(_0xa768('0x8'));var ejs=require(_0xa768('0x9'));var fs=require('fs');var fs_extra=require(_0xa768('0xa'));var _=require(_0xa768('0xb'));var squel=require('squel');var crypto=require(_0xa768('0xc'));var jsforce=require(_0xa768('0xd'));var deskjs=require(_0xa768('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa768('0xf'));var authService=require(_0xa768('0x10'));var qs=require(_0xa768('0x11'));var as=require(_0xa768('0x12'));var hardwareService=require(_0xa768('0x13'));var logger=require(_0xa768('0x14'))(_0xa768('0x15'));var utils=require(_0xa768('0x16'));var config=require(_0xa768('0x17'));var licenseUtil=require(_0xa768('0x18'));var db=require(_0xa768('0x19'))['db'];config[_0xa768('0x1a')]=_['defaults'](config[_0xa768('0x1a')],{'host':_0xa768('0x1b'),'port':0x18eb});var socket=require(_0xa768('0x1c'))(new Redis(config[_0xa768('0x1a')]));require(_0xa768('0x1d'))[_0xa768('0x1e')](socket);var jayson=require(_0xa768('0x1f'));var client=jayson[_0xa768('0x20')][_0xa768('0x21')]({'port':0x232c});var client9002=jayson[_0xa768('0x20')][_0xa768('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x369d0b,_0x225e85,_0x30ec9c,_0x57f722){return new BPromise(function(_0x4984fe,_0x289205){var _0x485f1c=_0x57f722||client;return _0x485f1c['request'](_0x369d0b,_0x30ec9c)[_0xa768('0x22')](function(_0x36fa0a){logger[_0xa768('0x23')](_0xa768('0x24'),_0x225e85,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x225e85,_0xa768('0x25'),JSON['stringify'](_0x36fa0a));if(_0x36fa0a[_0xa768('0x26')]){if(_0x36fa0a[_0xa768('0x26')][_0xa768('0x27')]===0x1f4){logger[_0xa768('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x225e85,_0x36fa0a[_0xa768('0x26')][_0xa768('0x28')]);return _0x289205(_0x36fa0a['error'][_0xa768('0x28')]);}logger['error'](_0xa768('0x24'),_0x225e85,_0x36fa0a[_0xa768('0x26')][_0xa768('0x28')]);return _0x4984fe(_0x36fa0a[_0xa768('0x26')][_0xa768('0x28')]);}else{logger[_0xa768('0x23')](_0xa768('0x24'),_0x225e85,'request\x20sent');_0x4984fe(_0x36fa0a[_0xa768('0x29')]['message']);}})['catch'](function(_0x3b678c){logger[_0xa768('0x26')](_0xa768('0x24'),_0x225e85,_0x3b678c);_0x289205(_0x3b678c);});});}function respondWithStatusCode(_0x10473f,_0x2387fa){_0x2387fa=_0x2387fa||0xcc;return function(_0x1c3580){if(_0x1c3580){return _0x10473f[_0xa768('0x2a')](_0x2387fa);}return _0x10473f['status'](_0x2387fa)[_0xa768('0x2b')]();};}function respondWithResult(_0x365a30,_0x1acb64){_0x1acb64=_0x1acb64||0xc8;return function(_0x4d057f){if(_0x4d057f){return _0x365a30[_0xa768('0x2c')](_0x1acb64)[_0xa768('0x2d')](_0x4d057f);}};}function respondWithFilteredResult(_0x32f76c,_0x2cea63){return function(_0x4dc4d8){if(_0x4dc4d8){var _0x5b2423=typeof _0x2cea63[_0xa768('0x2e')]===_0xa768('0x2f')&&typeof _0x2cea63['limit']==='undefined';var _0x5d13d1=_0x4dc4d8[_0xa768('0x30')];var _0x16952e=_0x5b2423?0x0:_0x2cea63[_0xa768('0x2e')];var _0x158f1c=_0x5b2423?_0x4dc4d8[_0xa768('0x30')]:_0x2cea63[_0xa768('0x2e')]+_0x2cea63[_0xa768('0x31')];var _0x1385d1;if(_0x158f1c>=_0x5d13d1){_0x158f1c=_0x5d13d1;_0x1385d1=0xc8;}else{_0x1385d1=0xce;}_0x32f76c[_0xa768('0x2c')](_0x1385d1);return _0x32f76c['set'](_0xa768('0x32'),_0x16952e+'-'+_0x158f1c+'/'+_0x5d13d1)['json'](_0x4dc4d8);}return null;};}function patchUpdates(_0xf66e5a){return function(_0x2c23da){try{jsonpatch[_0xa768('0x33')](_0x2c23da,_0xf66e5a,!![]);}catch(_0x173795){return BPromise['reject'](_0x173795);}return _0x2c23da[_0xa768('0x34')]();};}function saveUpdates(_0x556bb8,_0x577380){return function(_0x21a3e2){if(_0x21a3e2){return _0x21a3e2['update'](_0x556bb8)[_0xa768('0x22')](function(_0x220622){return _0x220622;});}return null;};}function removeEntity(_0x204a13,_0x153d45){return function(_0x110f13){if(_0x110f13){return _0x110f13['destroy']()['then'](function(){_0x204a13[_0xa768('0x2c')](0xcc)[_0xa768('0x2b')]();});}};}function handleEntityNotFound(_0x5aa945,_0x2b1a5b){return function(_0x957218){if(!_0x957218){_0x5aa945[_0xa768('0x2a')](0x194);}return _0x957218;};}function handleError(_0x17e550,_0x3a7b9e){_0x3a7b9e=_0x3a7b9e||0x1f4;return function(_0x3d3dda){logger[_0xa768('0x26')](_0x3d3dda[_0xa768('0x35')]);if(_0x3d3dda[_0xa768('0x36')]){delete _0x3d3dda[_0xa768('0x36')];}_0x17e550[_0xa768('0x2c')](_0x3a7b9e)['send'](_0x3d3dda);};}exports[_0xa768('0x37')]=function(_0x4e0064,_0x125385){var _0x547a6a={},_0xc64e86={},_0x37858d={'count':0x0,'rows':[]};var _0x1132b1=_[_0xa768('0x38')](db['WhatsappMessage'][_0xa768('0x39')],function(_0x57fdcf){return{'name':_0x57fdcf[_0xa768('0x3a')],'type':_0x57fdcf[_0xa768('0x3b')]['key']};});_0xc64e86[_0xa768('0x3c')]=_[_0xa768('0x38')](_0x1132b1,_0xa768('0x36'));_0xc64e86['query']=_[_0xa768('0x3d')](_0x4e0064[_0xa768('0x3e')]);_0xc64e86['filters']=_[_0xa768('0x3f')](_0xc64e86[_0xa768('0x3c')],_0xc64e86[_0xa768('0x3e')]);_0x547a6a[_0xa768('0x40')]=_[_0xa768('0x3f')](_0xc64e86[_0xa768('0x3c')],qs[_0xa768('0x41')](_0x4e0064[_0xa768('0x3e')]['fields']));_0x547a6a['attributes']=_0x547a6a[_0xa768('0x40')][_0xa768('0x42')]?_0x547a6a[_0xa768('0x40')]:_0xc64e86[_0xa768('0x3c')];if(!_0x4e0064['query'][_0xa768('0x43')]('nolimit')){_0x547a6a['limit']=qs[_0xa768('0x31')](_0x4e0064[_0xa768('0x3e')][_0xa768('0x31')]);_0x547a6a[_0xa768('0x2e')]=qs[_0xa768('0x2e')](_0x4e0064[_0xa768('0x3e')][_0xa768('0x2e')]);}_0x547a6a[_0xa768('0x44')]=qs[_0xa768('0x45')](_0x4e0064[_0xa768('0x3e')][_0xa768('0x45')]);_0x547a6a['where']=qs[_0xa768('0x46')](_['pick'](_0x4e0064[_0xa768('0x3e')],_0xc64e86[_0xa768('0x46')]),_0x1132b1);if(_0x4e0064[_0xa768('0x3e')][_0xa768('0x47')]){_0x547a6a[_0xa768('0x48')]=_[_0xa768('0x49')](_0x547a6a[_0xa768('0x48')],{'$or':_['map'](_0x1132b1,function(_0x1f8260){if(_0x1f8260[_0xa768('0x3b')]!==_0xa768('0x4a')){var _0x5f401c={};_0x5f401c[_0x1f8260[_0xa768('0x36')]]={'$like':'%'+_0x4e0064['query'][_0xa768('0x47')]+'%'};return _0x5f401c;}})});}_0x547a6a=_[_0xa768('0x49')]({},_0x547a6a,_0x4e0064[_0xa768('0x4b')]);var _0x5571b7={'where':_0x547a6a[_0xa768('0x48')]};return db['WhatsappMessage'][_0xa768('0x30')](_0x5571b7)[_0xa768('0x22')](function(_0x3b8cbf){_0x37858d[_0xa768('0x30')]=_0x3b8cbf;if(_0x4e0064['query']['includeAll']){_0x547a6a[_0xa768('0x4c')]=[{'all':!![]}];}return db[_0xa768('0x4d')][_0xa768('0x4e')](_0x547a6a);})[_0xa768('0x22')](function(_0xbd3e1e){_0x37858d[_0xa768('0x4f')]=_0xbd3e1e;return _0x37858d;})[_0xa768('0x22')](respondWithFilteredResult(_0x125385,_0x547a6a))[_0xa768('0x50')](handleError(_0x125385,null));};exports[_0xa768('0x51')]=function(_0x67ef34,_0x2298be){var _0x1c44d2={'raw':!![],'where':{'id':_0x67ef34[_0xa768('0x52')]['id']}},_0x2c1a61={};_0x2c1a61[_0xa768('0x3c')]=_[_0xa768('0x3d')](db[_0xa768('0x4d')][_0xa768('0x39')]);_0x2c1a61['query']=_[_0xa768('0x3d')](_0x67ef34[_0xa768('0x3e')]);_0x2c1a61[_0xa768('0x46')]=_[_0xa768('0x3f')](_0x2c1a61[_0xa768('0x3c')],_0x2c1a61[_0xa768('0x3e')]);_0x1c44d2[_0xa768('0x40')]=_[_0xa768('0x3f')](_0x2c1a61[_0xa768('0x3c')],qs['fields'](_0x67ef34[_0xa768('0x3e')][_0xa768('0x41')]));_0x1c44d2[_0xa768('0x40')]=_0x1c44d2[_0xa768('0x40')][_0xa768('0x42')]?_0x1c44d2[_0xa768('0x40')]:_0x2c1a61[_0xa768('0x3c')];if(_0x67ef34[_0xa768('0x3e')][_0xa768('0x53')]){_0x1c44d2[_0xa768('0x4c')]=[{'all':!![]}];}_0x1c44d2=_[_0xa768('0x49')]({},_0x1c44d2,_0x67ef34['options']);return db[_0xa768('0x4d')][_0xa768('0x54')](_0x1c44d2)[_0xa768('0x22')](handleEntityNotFound(_0x2298be,null))[_0xa768('0x22')](respondWithResult(_0x2298be,null))['catch'](handleError(_0x2298be,null));};exports[_0xa768('0x55')]=function(_0x17a3b0,_0xbe23e7){return db['WhatsappMessage']['create'](_0x17a3b0['body'],{})[_0xa768('0x22')](respondWithResult(_0xbe23e7,0xc9))[_0xa768('0x50')](handleError(_0xbe23e7,null));};exports['update']=function(_0x11278b,_0x16ffd7){if(_0x11278b[_0xa768('0x56')]['id']){delete _0x11278b[_0xa768('0x56')]['id'];}return db[_0xa768('0x4d')]['find']({'where':{'id':_0x11278b['params']['id']}})[_0xa768('0x22')](handleEntityNotFound(_0x16ffd7,null))[_0xa768('0x22')](saveUpdates(_0x11278b[_0xa768('0x56')],null))['then'](respondWithResult(_0x16ffd7,null))[_0xa768('0x50')](handleError(_0x16ffd7,null));};exports[_0xa768('0x57')]=function(_0x55b692,_0x5b6220){return db['WhatsappMessage'][_0xa768('0x54')]({'where':{'id':_0x55b692['params']['id']}})[_0xa768('0x22')](handleEntityNotFound(_0x5b6220,null))[_0xa768('0x22')](removeEntity(_0x5b6220,null))['catch'](handleError(_0x5b6220,null));};exports['describe']=function(_0x18717a,_0x21503d){return db[_0xa768('0x4d')][_0xa768('0x58')]()[_0xa768('0x22')](respondWithResult(_0x21503d,null))[_0xa768('0x50')](handleError(_0x21503d,null));};var interaction_log=require(_0xa768('0x14'))(_0xa768('0x59'));exports['accept']=function(_0x587465,_0xb06399,_0x6c7bd3){var _0x315cd8={'agent':{},'channel':_0xa768('0x5a')};if(_0x587465[_0xa768('0x56')]['id']){delete _0x587465[_0xa768('0x56')]['id'];}_0x587465[_0xa768('0x56')][_0xa768('0x5b')]=!![];_0x587465['body'][_0xa768('0x5c')]=moment()[_0xa768('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x587465['body'][_0xa768('0x5e')]=_0x587465['body'][_0xa768('0x5e')]||_0x587465['user']['id'];_0x315cd8[_0xa768('0x5f')]['id']=_0x587465['body'][_0xa768('0x5e')];return db[_0xa768('0x4d')][_0xa768('0x54')]({'where':{'id':_0x587465['params']['id'],'UserId':null}})[_0xa768('0x22')](handleEntityNotFound(_0xb06399,null))[_0xa768('0x22')](saveUpdates(_0x587465[_0xa768('0x56')],null))[_0xa768('0x22')](function(_0x20bf5a){if(_0x20bf5a){_0x315cd8[_0xa768('0x28')]=_0x20bf5a[_0xa768('0x60')]({'plain':!![]});return db[_0xa768('0x61')][_0xa768('0x54')]({'where':{'id':_0x20bf5a[_0xa768('0x62')]}});}return null;})[_0xa768('0x22')](handleEntityNotFound(_0xb06399,null))[_0xa768('0x22')](function(_0x1aedbb){if(_0x1aedbb){return _0x1aedbb['update']({'UserId':_0x587465[_0xa768('0x56')][_0xa768('0x5e')],'read1stAt':_[_0xa768('0x63')](_0x1aedbb['read1stAt'])?moment()[_0xa768('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa768('0x22')](function(_0x26a5a4){if(_0x26a5a4){_0x315cd8['interaction']=_0x26a5a4[_0xa768('0x60')]({'plain':!![]});interaction_log[_0xa768('0x23')](_0xa768('0x64'),_0x587465[_0xa768('0x65')]['id'],_0x587465[_0xa768('0x65')][_0xa768('0x36')],_0x587465[_0xa768('0x65')][_0xa768('0x66')],_0x315cd8[_0xa768('0x67')]['id'],_0x587465[_0xa768('0x56')]?JSON[_0xa768('0x68')](_0x587465['body']):_0xa768('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x315cd8);}return null;})[_0xa768('0x22')](function(_0x157c16){var _0x1f0b02=_0xa768('0x6a')+_0x157c16[_0xa768('0x28')][_0xa768('0x6b')];return db[_0xa768('0x6c')][_0xa768('0x3e')](_0x1f0b02,{'type':db[_0xa768('0x6d')][_0xa768('0x6e')]['SELECT'],'raw':!![]})[_0xa768('0x22')](function(_0x454ab3){return _0x454ab3;});})[_0xa768('0x22')](function(_0x17fe49){if(_0x17fe49){_0x315cd8[_0xa768('0x28')][_0xa768('0x6f')]=_0x17fe49[0x0];if(!_0x587465[_0xa768('0x56')][_0xa768('0x5e')])return;return db[_0xa768('0x70')][_0xa768('0x54')]({'where':{'id':_0x587465[_0xa768('0x56')]['UserId'],'role':_0xa768('0x5f')},'attributes':['id',_0xa768('0x36'),_0xa768('0x71'),_0xa768('0x72'),_0xa768('0x73')],'raw':!![]});}return null;})[_0xa768('0x22')](function(_0x3c6125){if(!_0x3c6125)return null;_0x315cd8[_0xa768('0x28')][_0xa768('0x5f')]=_0x3c6125;return _0x315cd8;})['then'](function(_0x30c92a){if(_0x30c92a){if(_0x587465[_0xa768('0x56')][_0xa768('0x74')]){_0x315cd8[_0xa768('0x28')]['interface']=util[_0xa768('0x5d')](_0xa768('0x75'),_0x587465[_0xa768('0x65')][_0xa768('0x36')]);_0x315cd8['message'][_0xa768('0x76')]=_0x315cd8['channel'];_0x315cd8[_0xa768('0x28')][_0xa768('0x77')]=_0x315cd8[_0xa768('0x76')];_0x315cd8[_0xa768('0x28')][_0xa768('0x78')]='accept';return respondWithRpcPromise('EventManager',_0xa768('0x79'),{'event':_0xa768('0x7a'),'message':_0x315cd8[_0xa768('0x28')]},client9002)[_0xa768('0x22')](function(){return _0x315cd8;});}return _0x315cd8;}return null;})[_0xa768('0x22')](respondWithResult(_0xb06399,null))[_0xa768('0x50')](handleError(_0xb06399,null));};var interaction_log=require(_0xa768('0x14'))('whatsapp-interactions');exports['reject']=function(_0x495d4d,_0xc7b18a,_0xc989bb){var _0x147162={'agent':{},'channel':_0xa768('0x5a')};if(_0x495d4d[_0xa768('0x56')]['id']){delete _0x495d4d['body']['id'];}_0x495d4d[_0xa768('0x56')][_0xa768('0x5e')]=_0x495d4d['body']['UserId']||_0x495d4d[_0xa768('0x65')]['id'];_0x147162[_0xa768('0x5f')]['id']=_0x495d4d['body'][_0xa768('0x5e')];return db['WhatsappMessage'][_0xa768('0x54')]({'where':{'id':_0x495d4d[_0xa768('0x52')]['id'],'UserId':null}})[_0xa768('0x22')](handleEntityNotFound(_0xc7b18a,null))['then'](function(_0x52efcf){if(_0x52efcf){_0x147162[_0xa768('0x28')]=_0x52efcf['get']({'plain':!![]});return db['WhatsappInteraction'][_0xa768('0x54')]({'where':{'id':_0x52efcf['WhatsappInteractionId']}});}return null;})[_0xa768('0x22')](handleEntityNotFound(_0xc7b18a,null))[_0xa768('0x22')](function(_0x84a018){if(_0x84a018){_0x147162[_0xa768('0x67')]=_0x84a018[_0xa768('0x60')]({'plain':!![]});interaction_log[_0xa768('0x23')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x495d4d['user']['id'],_0x495d4d[_0xa768('0x65')][_0xa768('0x36')],_0x495d4d['user'][_0xa768('0x66')],_0x147162[_0xa768('0x67')]['id'],_0x495d4d[_0xa768('0x56')]?JSON[_0xa768('0x68')](_0x495d4d[_0xa768('0x56')]):_0xa768('0x69'));return respondWithRpcPromise(_0xa768('0x7b'),'rejectMessage',_0x147162);}return null;})[_0xa768('0x22')](function(_0x21a15a){var _0x3a9cae=_0xa768('0x6a')+_0x21a15a[_0xa768('0x28')][_0xa768('0x6b')];return db[_0xa768('0x6c')][_0xa768('0x3e')](_0x3a9cae,{'type':db[_0xa768('0x6d')][_0xa768('0x6e')][_0xa768('0x7c')],'raw':!![]})[_0xa768('0x22')](function(_0x19f009){return _0x19f009;});})[_0xa768('0x22')](function(_0xe1d6c0){if(_0xe1d6c0){_0x147162[_0xa768('0x28')][_0xa768('0x6f')]=_0xe1d6c0[0x0];if(!_0x495d4d['body'][_0xa768('0x5e')])return;return db[_0xa768('0x70')][_0xa768('0x54')]({'where':{'id':_0x495d4d[_0xa768('0x56')][_0xa768('0x5e')],'role':_0xa768('0x5f')},'attributes':['id',_0xa768('0x36'),'fullname','email',_0xa768('0x73')],'raw':!![]});}return null;})[_0xa768('0x22')](function(_0x7edd27){if(!_0x7edd27)return null;_0x147162[_0xa768('0x28')]['agent']=_0x7edd27;return _0x147162;})['then'](function(_0x426f2d){if(_0x426f2d){_0x426f2d['message'][_0xa768('0x7d')]=util[_0xa768('0x5d')]('SIP/%s',_0x495d4d[_0xa768('0x65')]['name']);_0x426f2d[_0xa768('0x28')][_0xa768('0x76')]=_0x147162[_0xa768('0x76')];_0x426f2d[_0xa768('0x28')][_0xa768('0x77')]=_0x147162[_0xa768('0x76')];_0x426f2d[_0xa768('0x28')][_0xa768('0x78')]=_0xa768('0x7e');respondWithRpcPromise(_0xa768('0x79'),_0xa768('0x79'),{'event':_0xa768('0x7f'),'message':_0x426f2d[_0xa768('0x28')]},client9002);return _0x147162;}return null;})[_0xa768('0x22')](respondWithResult(_0xc7b18a,null))['catch'](handleError(_0xc7b18a,null));};exports[_0xa768('0x2c')]=function(_0x3fcec7,_0x3f58ff,_0x113024){if(_0x3fcec7[_0xa768('0x56')]['id']){delete _0x3fcec7[_0xa768('0x56')]['id'];}var _0x2c36f3;return db[_0xa768('0x4d')][_0xa768('0x54')]({'where':{'id':_0x3fcec7['params']['id']}})[_0xa768('0x22')](handleEntityNotFound(_0x3f58ff,null))['then'](function(_0x30b742){if(_0x30b742){_0x2c36f3=_0x30b742;return db['WhatsappAccount']['find']({'where':{'id':_0x30b742[_0xa768('0x80')]}});}})[_0xa768('0x22')](handleEntityNotFound(_0x3f58ff,null))[_0xa768('0x22')](function(_0x2ac9be){if(_0x2ac9be){logger[_0xa768('0x81')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xa768('0x2c'),_0xa768('0x82'),_0x2ac9be[_0xa768('0x3b')],util[_0xa768('0x83')](_0x3fcec7['body'],{'showHidden':![],'depth':null}));switch(_0x2ac9be[_0xa768('0x3b')]){case _0xa768('0x84'):if(_0x3fcec7['body'][_0xa768('0x85')]&&_0x3fcec7['body'][_0xa768('0x85')]===_0x2c36f3[_0xa768('0x86')]&&_0x3fcec7['body'][_0xa768('0x87')]&&_0x3fcec7[_0xa768('0x56')]['MessageStatus']===_0xa768('0x5b')){return _0x2c36f3[_0xa768('0x88')]({'read':!![]});}else{logger[_0xa768('0x26')](_0xa768('0x89'),_0xa768('0x2c'),_0xa768('0x84'),util[_0xa768('0x83')](_0x3fcec7[_0xa768('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x2c36f3;}})['then'](respondWithResult(_0x3f58ff,null))['catch'](handleError(_0x3f58ff,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2d85a85..6e4f5b9 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 _0x0fd9=['exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','emit'];(function(_0x384c8f,_0x4e6b44){var _0x9fb794=function(_0x27e24c){while(--_0x27e24c){_0x384c8f['push'](_0x384c8f['shift']());}};_0x9fb794(++_0x4e6b44);}(_0x0fd9,0xa3));var _0x90fd=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x0fd9[_0x1bf809];return _0x1caa4e;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x90fd('0x0'))['db'][_0x90fd('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x90fd('0x2')](0x0);var events={'afterCreate':_0x90fd('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x20b525){return function(_0x2a5f76,_0xb7cf6,_0x37a8be){WhatsappMessageEvents[_0x90fd('0x4')](_0x20b525+':'+_0x2a5f76['id'],_0x2a5f76);WhatsappMessageEvents[_0x90fd('0x4')](_0x20b525,_0x2a5f76);_0x37a8be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x90fd('0x5')]=WhatsappMessageEvents; \ No newline at end of file +var _0xc29b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','save','update'];(function(_0x275472,_0x2c9de8){var _0x1490b8=function(_0x16a9a7){while(--_0x16a9a7){_0x275472['push'](_0x275472['shift']());}};_0x1490b8(++_0x2c9de8);}(_0xc29b,0x12d));var _0xbc29=function(_0x312805,_0x3f3590){_0x312805=_0x312805-0x0;var _0x17d57f=_0xc29b[_0x312805];return _0x17d57f;};'use strict';var EventEmitter=require(_0xbc29('0x0'));var WhatsappMessage=require(_0xbc29('0x1'))['db'][_0xbc29('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbc29('0x3'),'afterUpdate':_0xbc29('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3032cb){return function(_0x294a45,_0x217922,_0xa365e8){WhatsappMessageEvents[_0xbc29('0x5')](_0x3032cb+':'+_0x294a45['id'],_0x294a45);WhatsappMessageEvents[_0xbc29('0x5')](_0x3032cb,_0x294a45);_0xa365e8(null);};}for(var e in events){if(events[_0xbc29('0x6')](e)){var event=events[e];WhatsappMessage[_0xbc29('0x7')](e,emitEvent(event));}}module[_0xbc29('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 1c84259..58dfded 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 _0xa7dc=['exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','direction','toLowerCase','out','secret','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','accountSid','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','body','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes'];(function(_0x38136b,_0x35c34e){var _0x3b10b9=function(_0x27fdfe){while(--_0x27fdfe){_0x38136b['push'](_0x38136b['shift']());}};_0x3b10b9(++_0x35c34e);}(_0xa7dc,0x11d));var _0xca7d=function(_0x58e1a8,_0x233279){_0x58e1a8=_0x58e1a8-0x0;var _0x47f323=_0xa7dc[_0x58e1a8];return _0x47f323;};'use strict';var _=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var logger=require(_0xca7d('0x2'))('api');var moment=require(_0xca7d('0x3'));var BPromise=require('bluebird');var rp=require(_0xca7d('0x4'));var fetch=require(_0xca7d('0x5'));var fs=require('fs');var path=require(_0xca7d('0x6'));var rimraf=require(_0xca7d('0x7'));var config=require(_0xca7d('0x8'));var attributes=require(_0xca7d('0x9'));module[_0xca7d('0xa')]=function(_0x47e415,_0x5073dd){return _0x47e415[_0xca7d('0xb')](_0xca7d('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xca7d('0xd'),'fields':[_0xca7d('0xd')]},{'name':_0xca7d('0xe'),'fields':['body'],'type':_0xca7d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x256e06,_0x2de747,_0x40077e){var _0x38ce56=_0x47e415['models'];var _0x609fc8=_0x256e06['get']({'plain':!![]});if(_0x609fc8[_0xca7d('0x10')]['toLowerCase']()==='in'||_0x609fc8[_0xca7d('0x10')][_0xca7d('0x11')]()===_0xca7d('0x12')&&!_0x609fc8[_0xca7d('0x13')]&&!_['isNil'](_0x609fc8['UserId'])){_0x38ce56['WhatsappInteraction'][_0xca7d('0x14')]({'where':{'id':_0x609fc8[_0xca7d('0x15')]}})[_0xca7d('0x16')](function(_0x39caec){if(_0x39caec){_0x39caec[_0xca7d('0x17')]({'lastMsgAt':_0x609fc8[_0xca7d('0x18')],'lastMsgDirection':_0x609fc8[_0xca7d('0x10')][_0xca7d('0x11')]()});}})[_0xca7d('0x19')](function(_0x1a6cb7){console[_0xca7d('0x1a')](_0x1a6cb7);});}if(_0x609fc8[_0xca7d('0x10')]==='out'&&!_0x609fc8['secret']){var _0x26e7f6;_0x38ce56[_0xca7d('0x1b')][_0xca7d('0x1c')]({'where':{'id':_0x609fc8[_0xca7d('0x1d')]},'raw':!![]})[_0xca7d('0x16')](function(_0x4d6f22){_0x26e7f6=_0x4d6f22;if(_0x26e7f6&&_0x26e7f6['type']){switch(_0x26e7f6[_0xca7d('0x1e')]){case'twilio':var _0x3f616e=require(_0xca7d('0x1f'));if(_0x26e7f6['accountSid']&&_0x26e7f6[_0xca7d('0x20')]&&_0x26e7f6['phone']){var _0x583a24=new _0x3f616e(_0x26e7f6[_0xca7d('0x21')],_0x26e7f6[_0xca7d('0x20')]);_0x583a24[_0xca7d('0x22')][_0xca7d('0x23')]({'body':_0x609fc8['body'],'to':_0xca7d('0x24')+_0x609fc8[_0xca7d('0x25')],'from':_0xca7d('0x24')+_0x26e7f6[_0xca7d('0x25')],'statusCallback':_0x26e7f6[_0xca7d('0x26')]+_0xca7d('0x27')+_0x609fc8['id']+_0xca7d('0x28')+_0x26e7f6[_0xca7d('0x29')]})[_0xca7d('0x16')](function(_0x1c9a38){if(_0x1c9a38['sid']){return _0x256e06[_0xca7d('0x17')]({'messageId':_0x1c9a38[_0xca7d('0x2a')]});}})[_0xca7d('0x19')](function(_0x59449f){logger[_0xca7d('0x1a')](_0xca7d('0x2b'),_0xca7d('0x2c'),_0xca7d('0x1f'),util[_0xca7d('0x2d')](_0x59449f,{'showHidden':![],'depth':null}));});}else{logger[_0xca7d('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xca7d('0x2c'),_0xca7d('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xca7d('0x2e'):var _0x5df354=_0x26e7f6['accountSid'];var _0x13c1df=_0x26e7f6['authToken'];var _0x37c8a6=_0x26e7f6[_0xca7d('0x2f')]+_0xca7d('0x30')+_0x5df354+_0xca7d('0x31');var _0x337f3f={'to':[_0x609fc8[_0xca7d('0x25')]],'message':{'type':'text','text':_0x609fc8[_0xca7d('0x32')]}};var _0x2a3b98={'method':_0xca7d('0x33'),'uri':_0x37c8a6,'headers':{'Authorization':'Bearer\x20'+_0x13c1df,'Content-Type':_0xca7d('0x34')},'body':_0x337f3f,'json':!![]};rp(_0x2a3b98)[_0xca7d('0x16')](function(_0x4487bd){if(_0x4487bd[_0xca7d('0x35')][0x0][_0xca7d('0x36')]){return _0x256e06[_0xca7d('0x17')]({'messageId':_0x4487bd[_0xca7d('0x35')][0x0][_0xca7d('0x36')]});}})['catch'](function(_0x508f4b){logger[_0xca7d('0x37')](_0xca7d('0x38'),_0x508f4b);});break;}}})[_0xca7d('0x39')](function(){_0x40077e();});}else{_0x40077e();}}},'charset':_0xca7d('0x3a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcf66=['messages','create','body','whatsapp:','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone'];(function(_0x5b51e8,_0x5dce4a){var _0x234a6c=function(_0x52a7a3){while(--_0x52a7a3){_0x5b51e8['push'](_0x5b51e8['shift']());}};_0x234a6c(++_0x5dce4a);}(_0xcf66,0x185));var _0x6cf6=function(_0x317919,_0xd4923){_0x317919=_0x317919-0x0;var _0x5f6482=_0xcf66[_0x317919];return _0x5f6482;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))(_0x6cf6('0x3'));var moment=require(_0x6cf6('0x4'));var BPromise=require(_0x6cf6('0x5'));var rp=require(_0x6cf6('0x6'));var fetch=require(_0x6cf6('0x7'));var fs=require('fs');var path=require(_0x6cf6('0x8'));var rimraf=require('rimraf');var config=require(_0x6cf6('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0x6cf6('0xa')]=function(_0x19bef6,_0x444f65){return _0x19bef6[_0x6cf6('0xb')](_0x6cf6('0xc'),attributes,{'tableName':_0x6cf6('0xd'),'paranoid':![],'indexes':[{'name':_0x6cf6('0xe'),'fields':[_0x6cf6('0xe')]},{'name':_0x6cf6('0xf'),'fields':['body'],'type':_0x6cf6('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dded1,_0x276837,_0x192952){var _0x3bcf39=_0x19bef6[_0x6cf6('0x11')];var _0x21083a=_0x3dded1[_0x6cf6('0x12')]({'plain':!![]});if(_0x21083a[_0x6cf6('0x13')][_0x6cf6('0x14')]()==='in'||_0x21083a[_0x6cf6('0x13')][_0x6cf6('0x14')]()===_0x6cf6('0x15')&&!_0x21083a['secret']&&!_['isNil'](_0x21083a[_0x6cf6('0x16')])){_0x3bcf39[_0x6cf6('0x17')]['findOne']({'where':{'id':_0x21083a[_0x6cf6('0x18')]}})[_0x6cf6('0x19')](function(_0x47abc0){if(_0x47abc0){_0x47abc0[_0x6cf6('0x1a')]({'lastMsgAt':_0x21083a[_0x6cf6('0x1b')],'lastMsgDirection':_0x21083a[_0x6cf6('0x13')][_0x6cf6('0x14')]()});}})['catch'](function(_0x4c9aca){console[_0x6cf6('0x1c')](_0x4c9aca);});}if(_0x21083a['direction']===_0x6cf6('0x15')&&!_0x21083a[_0x6cf6('0x1d')]){var _0x3fc931;_0x3bcf39[_0x6cf6('0x1e')][_0x6cf6('0x1f')]({'where':{'id':_0x21083a[_0x6cf6('0x20')]},'raw':!![]})['then'](function(_0x1edb2d){_0x3fc931=_0x1edb2d;if(_0x3fc931&&_0x3fc931[_0x6cf6('0x21')]){switch(_0x3fc931['type']){case _0x6cf6('0x22'):var _0x11115b=require(_0x6cf6('0x22'));if(_0x3fc931[_0x6cf6('0x23')]&&_0x3fc931[_0x6cf6('0x24')]&&_0x3fc931[_0x6cf6('0x25')]){var _0x15d2fd=new _0x11115b(_0x3fc931['accountSid'],_0x3fc931[_0x6cf6('0x24')]);_0x15d2fd[_0x6cf6('0x26')][_0x6cf6('0x27')]({'body':_0x21083a[_0x6cf6('0x28')],'to':'whatsapp:'+_0x21083a[_0x6cf6('0x25')],'from':_0x6cf6('0x29')+_0x3fc931[_0x6cf6('0x25')],'statusCallback':_0x3fc931['remote']+'/api/whatsapp/messages/'+_0x21083a['id']+'/status?token='+_0x3fc931['token']})['then'](function(_0x267e88){if(_0x267e88[_0x6cf6('0x2a')]){return _0x3dded1[_0x6cf6('0x1a')]({'messageId':_0x267e88[_0x6cf6('0x2a')]});}})[_0x6cf6('0x2b')](function(_0x3ed4bf){logger[_0x6cf6('0x1c')](_0x6cf6('0x2c'),'afterCreate','twilio',util[_0x6cf6('0x2d')](_0x3ed4bf,{'showHidden':![],'depth':null}));});}else{logger[_0x6cf6('0x1c')](_0x6cf6('0x2c'),_0x6cf6('0x2e'),_0x6cf6('0x22'),_0x6cf6('0x2f'));}break;case _0x6cf6('0x30'):var _0x2fa7ae=_0x3fc931[_0x6cf6('0x23')];var _0x435150=_0x3fc931[_0x6cf6('0x24')];var _0x1b3ad9=_0x3fc931[_0x6cf6('0x31')]+_0x6cf6('0x32')+_0x2fa7ae+_0x6cf6('0x33');var _0x118ae3={'to':[_0x21083a['phone']],'message':{'type':'text','text':_0x21083a[_0x6cf6('0x28')]}};var _0x3b2302={'method':'POST','uri':_0x1b3ad9,'headers':{'Authorization':_0x6cf6('0x34')+_0x435150,'Content-Type':_0x6cf6('0x35')},'body':_0x118ae3,'json':!![]};rp(_0x3b2302)['then'](function(_0x40b601){if(_0x40b601[_0x6cf6('0x36')][0x0][_0x6cf6('0x37')]){return _0x3dded1['update']({'messageId':_0x40b601[_0x6cf6('0x36')][0x0][_0x6cf6('0x37')]});}})[_0x6cf6('0x2b')](function(_0x229b77){logger[_0x6cf6('0x38')](_0x6cf6('0x39'),_0x229b77);});break;}}})[_0x6cf6('0x3a')](function(){_0x192952();});}else{_0x192952();}}},'charset':_0x6cf6('0x3b'),'collate':_0x6cf6('0x3c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f35c3c9..5443ac9 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 _0xe677=['rpc','http','redis','socket.io-emitter','./whatsappMessage.socket','register','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','then','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x53f1e2,_0x273a81){var _0x5e715f=function(_0x447240){while(--_0x447240){_0x53f1e2['push'](_0x53f1e2['shift']());}};_0x5e715f(++_0x273a81);}(_0xe677,0xd0));var _0x7e67=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xe677[_0x934425];return _0x31d596;};'use strict';var _=require(_0x7e67('0x0'));var util=require(_0x7e67('0x1'));var moment=require(_0x7e67('0x2'));var BPromise=require(_0x7e67('0x3'));var rs=require(_0x7e67('0x4'));var fs=require('fs');var Redis=require(_0x7e67('0x5'));var db=require(_0x7e67('0x6'))['db'];var utils=require(_0x7e67('0x7'));var logger=require(_0x7e67('0x8'))(_0x7e67('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7e67('0xa')]({'port':0x232a});config[_0x7e67('0xb')]=_['defaults'](config[_0x7e67('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e67('0xc'))(new Redis(config[_0x7e67('0xb')]));require(_0x7e67('0xd'))[_0x7e67('0xe')](socket);function respondWithRpcPromise(_0x126c75,_0x2a975a,_0x54a7d5){return new BPromise(function(_0x2c8828,_0x36d836){return client[_0x7e67('0xf')](_0x126c75,_0x54a7d5)['then'](function(_0xef449b){logger['info'](_0x7e67('0x10'),_0x2a975a,_0x7e67('0x11'));logger[_0x7e67('0x12')](_0x7e67('0x13'),_0x2a975a,_0x7e67('0x11'),JSON[_0x7e67('0x14')](_0xef449b));if(_0xef449b['error']){if(_0xef449b[_0x7e67('0x15')][_0x7e67('0x16')]===0x1f4){logger[_0x7e67('0x15')](_0x7e67('0x10'),_0x2a975a,_0xef449b[_0x7e67('0x15')][_0x7e67('0x17')]);return _0x36d836(_0xef449b[_0x7e67('0x15')][_0x7e67('0x17')]);}logger[_0x7e67('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x2a975a,_0xef449b[_0x7e67('0x15')]['message']);return _0x2c8828(_0xef449b['error'][_0x7e67('0x17')]);}else{logger['info'](_0x7e67('0x10'),_0x2a975a,_0x7e67('0x11'));_0x2c8828(_0xef449b[_0x7e67('0x18')][_0x7e67('0x17')]);}})[_0x7e67('0x19')](function(_0x59fbde){logger[_0x7e67('0x15')](_0x7e67('0x10'),_0x2a975a,_0x59fbde);_0x36d836(_0x59fbde);});});}exports[_0x7e67('0x1a')]=function(_0x1a3158){var _0x5779a0=this;return new Promise(function(_0x42ac95,_0x158b49){return db[_0x7e67('0x1b')]['create'](_0x1a3158[_0x7e67('0x1c')],{'raw':_0x1a3158['options']?_0x1a3158['options']['raw']===undefined?!![]:![]:!![]})[_0x7e67('0x1d')](function(_0x2b9877){logger[_0x7e67('0x1e')](_0x7e67('0x1a'),_0x1a3158);logger[_0x7e67('0x12')](_0x7e67('0x1a'),_0x1a3158,JSON[_0x7e67('0x14')](_0x2b9877));_0x42ac95(_0x2b9877);})[_0x7e67('0x19')](function(_0x286fde){logger[_0x7e67('0x15')]('CreateWhatsappMessage',_0x286fde[_0x7e67('0x17')],_0x1a3158);_0x158b49(_0x5779a0[_0x7e67('0x15')](0x1f4,_0x286fde[_0x7e67('0x17')]));});});}; \ No newline at end of file +var _0xb45f=['catch','WhatsappMessage,\x20%s,\x20%s','CreateWhatsappMessage','create','body','options','raw','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x37594c,_0x250938){var _0xc6c829=function(_0x130bba){while(--_0x130bba){_0x37594c['push'](_0x37594c['shift']());}};_0xc6c829(++_0x250938);}(_0xb45f,0x115));var _0xfb45=function(_0x377bf3,_0x1be188){_0x377bf3=_0x377bf3-0x0;var _0xde660c=_0xb45f[_0x377bf3];return _0xde660c;};'use strict';var _=require(_0xfb45('0x0'));var util=require(_0xfb45('0x1'));var moment=require('moment');var BPromise=require(_0xfb45('0x2'));var rs=require(_0xfb45('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb45('0x4'));var logger=require(_0xfb45('0x5'))(_0xfb45('0x6'));var config=require(_0xfb45('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfb45('0x8')][_0xfb45('0x9')]({'port':0x232a});config[_0xfb45('0xa')]=_[_0xfb45('0xb')](config[_0xfb45('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb45('0xa')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1061c3,_0x31faf0,_0x53552f){return new BPromise(function(_0xe43c20,_0x2c0a69){return client['request'](_0x1061c3,_0x53552f)[_0xfb45('0xc')](function(_0x5af77c){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x31faf0,_0xfb45('0xd'));logger[_0xfb45('0xe')](_0xfb45('0xf'),_0x31faf0,_0xfb45('0xd'),JSON[_0xfb45('0x10')](_0x5af77c));if(_0x5af77c[_0xfb45('0x11')]){if(_0x5af77c['error']['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x31faf0,_0x5af77c[_0xfb45('0x11')][_0xfb45('0x12')]);return _0x2c0a69(_0x5af77c[_0xfb45('0x11')][_0xfb45('0x12')]);}logger[_0xfb45('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x31faf0,_0x5af77c['error']['message']);return _0xe43c20(_0x5af77c['error'][_0xfb45('0x12')]);}else{logger[_0xfb45('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x31faf0,_0xfb45('0xd'));_0xe43c20(_0x5af77c['result']['message']);}})[_0xfb45('0x14')](function(_0x2ef26d){logger[_0xfb45('0x11')](_0xfb45('0x15'),_0x31faf0,_0x2ef26d);_0x2c0a69(_0x2ef26d);});});}exports[_0xfb45('0x16')]=function(_0x47f10c){var _0x25f59=this;return new Promise(function(_0x435b39,_0x35c150){return db['WhatsappMessage'][_0xfb45('0x17')](_0x47f10c[_0xfb45('0x18')],{'raw':_0x47f10c[_0xfb45('0x19')]?_0x47f10c[_0xfb45('0x19')][_0xfb45('0x1a')]===undefined?!![]:![]:!![]})[_0xfb45('0xc')](function(_0x54c0e6){logger['info'](_0xfb45('0x16'),_0x47f10c);logger[_0xfb45('0xe')]('CreateWhatsappMessage',_0x47f10c,JSON[_0xfb45('0x10')](_0x54c0e6));_0x435b39(_0x54c0e6);})[_0xfb45('0x14')](function(_0x2a69c8){logger[_0xfb45('0x11')]('CreateWhatsappMessage',_0x2a69c8['message'],_0x47f10c);_0x35c150(_0x25f59[_0xfb45('0x11')](0x1f4,_0x2a69c8['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b1a64fa..d2172c8 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 _0xeee0=['length','./whatsappMessage.events','save','remove','emit','removeListener','register'];(function(_0x56528b,_0x52db26){var _0x4ac32a=function(_0x35cc2b){while(--_0x35cc2b){_0x56528b['push'](_0x56528b['shift']());}};_0x4ac32a(++_0x52db26);}(_0xeee0,0x112));var _0x0eee=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0xeee0[_0x4bb145];return _0x4db596;};'use strict';var WhatsappMessageEvents=require(_0x0eee('0x0'));var events=[_0x0eee('0x1'),_0x0eee('0x2'),'update'];function createListener(_0x388eb5,_0x5b7ee8){return function(_0x36ac38){_0x5b7ee8[_0x0eee('0x3')](_0x388eb5,_0x36ac38);};}function removeListener(_0x1a0031,_0x4bd5d4){return function(){WhatsappMessageEvents[_0x0eee('0x4')](_0x1a0031,_0x4bd5d4);};}exports[_0x0eee('0x5')]=function(_0x234889){for(var _0x514174=0x0,_0x28c097=events[_0x0eee('0x6')];_0x514174<_0x28c097;_0x514174++){var _0x5309d6=events[_0x514174];var _0x3fd975=createListener('whatsappMessage:'+_0x5309d6,_0x234889);WhatsappMessageEvents['on'](_0x5309d6,_0x3fd975);}}; \ No newline at end of file +var _0x14fe=['./whatsappMessage.events','save','update','emit','removeListener','register','whatsappMessage:'];(function(_0x4009c2,_0x3e5e09){var _0x3afe99=function(_0xfd80ab){while(--_0xfd80ab){_0x4009c2['push'](_0x4009c2['shift']());}};_0x3afe99(++_0x3e5e09);}(_0x14fe,0x150));var _0xe14f=function(_0x393439,_0x52582f){_0x393439=_0x393439-0x0;var _0x510bfe=_0x14fe[_0x393439];return _0x510bfe;};'use strict';var WhatsappMessageEvents=require(_0xe14f('0x0'));var events=[_0xe14f('0x1'),'remove',_0xe14f('0x2')];function createListener(_0x6052ef,_0x22527a){return function(_0x5892ad){_0x22527a[_0xe14f('0x3')](_0x6052ef,_0x5892ad);};}function removeListener(_0x2e864a,_0x1e7bc9){return function(){WhatsappMessageEvents[_0xe14f('0x4')](_0x2e864a,_0x1e7bc9);};}exports[_0xe14f('0x5')]=function(_0x5232d4){for(var _0x2cc42e=0x0,_0x230d29=events['length'];_0x2cc42e<_0x230d29;_0x2cc42e++){var _0x11c280=events[_0x2cc42e];var _0xce8217=createListener(_0xe14f('0x6')+_0x11c280,_0x5232d4);WhatsappMessageEvents['on'](_0x11c280,_0xce8217);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index b1fee22..b59d5c0 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 _0x382a=['Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','describe','/:id','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','destroy','delete','removeTeams','multer','util','path','connect-timeout'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x382a,0x19a));var _0xa382=function(_0x381dbb,_0x4a1419){_0x381dbb=_0x381dbb-0x0;var _0x301378=_0x382a[_0x381dbb];return _0x301378;};'use strict';var multer=require(_0xa382('0x0'));var util=require(_0xa382('0x1'));var path=require(_0xa382('0x2'));var timeout=require(_0xa382('0x3'));var express=require('express');var router=express[_0xa382('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa382('0x5'));var config=require(_0xa382('0x6'));var controller=require(_0xa382('0x7'));router['get']('/',auth[_0xa382('0x8')](),controller[_0xa382('0x9')]);router[_0xa382('0xa')]('/describe',auth[_0xa382('0x8')](),controller[_0xa382('0xb')]);router[_0xa382('0xa')](_0xa382('0xc'),auth[_0xa382('0x8')](),controller['show']);router[_0xa382('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xa382('0xa')](_0xa382('0xd'),auth['isAuthenticated'](),controller[_0xa382('0xe')]);router[_0xa382('0xa')](_0xa382('0xf'),auth[_0xa382('0x8')](),controller[_0xa382('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa382('0x11')](_0xa382('0xd'),auth[_0xa382('0x8')](),controller['addTeams']);router[_0xa382('0x11')](_0xa382('0xf'),auth['isAuthenticated'](),controller[_0xa382('0x12')]);router[_0xa382('0x13')]('/:id',auth[_0xa382('0x8')](),controller['update']);router['delete']('/:id',auth[_0xa382('0x8')](),controller[_0xa382('0x14')]);router[_0xa382('0x15')](_0xa382('0xd'),auth[_0xa382('0x8')](),controller[_0xa382('0x16')]);router['delete']('/:id/users',auth[_0xa382('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4a5a=['put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents'];(function(_0x1f9b53,_0x5ccd61){var _0x3c747e=function(_0x31ce47){while(--_0x31ce47){_0x1f9b53['push'](_0x1f9b53['shift']());}};_0x3c747e(++_0x5ccd61);}(_0x4a5a,0xe0));var _0xa4a5=function(_0x4a9d47,_0x511ae8){_0x4a9d47=_0x4a9d47-0x0;var _0x148ff3=_0x4a5a[_0x4a9d47];return _0x148ff3;};'use strict';var multer=require('multer');var util=require(_0xa4a5('0x0'));var path=require(_0xa4a5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa4a5('0x2')]();var fs_extra=require(_0xa4a5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa4a5('0x4'));var config=require(_0xa4a5('0x5'));var controller=require(_0xa4a5('0x6'));router[_0xa4a5('0x7')]('/',auth[_0xa4a5('0x8')](),controller[_0xa4a5('0x9')]);router['get']('/describe',auth[_0xa4a5('0x8')](),controller[_0xa4a5('0xa')]);router[_0xa4a5('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa4a5('0x7')](_0xa4a5('0xb'),auth[_0xa4a5('0x8')](),controller[_0xa4a5('0xc')]);router['get'](_0xa4a5('0xd'),auth[_0xa4a5('0x8')](),controller[_0xa4a5('0xe')]);router[_0xa4a5('0x7')](_0xa4a5('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa4a5('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xa4a5('0x11')]);router[_0xa4a5('0x10')]('/:id/users',auth[_0xa4a5('0x8')](),controller[_0xa4a5('0x12')]);router[_0xa4a5('0x13')]('/:id',auth[_0xa4a5('0x8')](),controller[_0xa4a5('0x14')]);router[_0xa4a5('0x15')](_0xa4a5('0x16'),auth[_0xa4a5('0x8')](),controller[_0xa4a5('0x17')]);router[_0xa4a5('0x15')](_0xa4a5('0xd'),auth[_0xa4a5('0x8')](),controller[_0xa4a5('0x18')]);router[_0xa4a5('0x15')](_0xa4a5('0xf'),auth[_0xa4a5('0x8')](),controller[_0xa4a5('0x19')]);module[_0xa4a5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index ab51a64..ec40f83 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 _0x5ff3=['rrmemory','beepall','roundrobin','exports','name','ENUM'];(function(_0x47a021,_0x4f4c4c){var _0x52e76e=function(_0xdcebe6){while(--_0xdcebe6){_0x47a021['push'](_0x47a021['shift']());}};_0x52e76e(++_0x4f4c4c);}(_0x5ff3,0x17d));var _0x35ff=function(_0x5f0415,_0xdb2366){_0x5f0415=_0x5f0415-0x0;var _0x3015fa=_0x5ff3[_0x5f0415];return _0x3015fa;};'use strict';var Sequelize=require('sequelize');module[_0x35ff('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x35ff('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x35ff('0x2')](_0x35ff('0x3'),_0x35ff('0x4'),_0x35ff('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb28a=['INTEGER','roundrobin','exports','STRING'];(function(_0x4c1487,_0x1ce5a2){var _0x51cac8=function(_0x1a9d63){while(--_0x1a9d63){_0x4c1487['push'](_0x4c1487['shift']());}};_0x51cac8(++_0x1ce5a2);}(_0xb28a,0x166));var _0xab28=function(_0x3000c6,_0x2de1fd){_0x3000c6=_0x3000c6-0x0;var _0x2635a5=_0xb28a[_0x3000c6];return _0x2635a5;};'use strict';var Sequelize=require('sequelize');module[_0xab28('0x0')]={'name':{'type':Sequelize[_0xab28('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xab28('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xab28('0x3'))},'description':{'type':Sequelize[_0xab28('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c8f400b..67d9636 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 _0x43ef=['every','TeamId','includes','union','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappQueue','rows','catch','show','params','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','describe','getMembers','findOne','nolimit','order','findAll','User','agent','whatsappPause','updatedAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','UserWhatsappQueue','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','SELECT'];(function(_0x2a5a4a,_0x4bec25){var _0x4796a8=function(_0x211183){while(--_0x211183){_0x2a5a4a['push'](_0x2a5a4a['shift']());}};_0x4796a8(++_0x4bec25);}(_0x43ef,0x99));var _0xf43e=function(_0x414402,_0x23f64a){_0x414402=_0x414402-0x0;var _0x7fef84=_0x43ef[_0x414402];return _0x7fef84;};'use strict';var emlformat=require(_0xf43e('0x0'));var rimraf=require(_0xf43e('0x1'));var zipdir=require(_0xf43e('0x2'));var jsonpatch=require(_0xf43e('0x3'));var rp=require(_0xf43e('0x4'));var moment=require(_0xf43e('0x5'));var BPromise=require(_0xf43e('0x6'));var Mustache=require(_0xf43e('0x7'));var util=require(_0xf43e('0x8'));var path=require(_0xf43e('0x9'));var sox=require(_0xf43e('0xa'));var csv=require(_0xf43e('0xb'));var ejs=require(_0xf43e('0xc'));var fs=require('fs');var fs_extra=require(_0xf43e('0xd'));var _=require('lodash');var squel=require(_0xf43e('0xe'));var crypto=require('crypto');var jsforce=require(_0xf43e('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf43e('0x10'));var Papa=require(_0xf43e('0x11'));var Redis=require(_0xf43e('0x12'));var authService=require(_0xf43e('0x13'));var qs=require(_0xf43e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf43e('0x15'));var logger=require(_0xf43e('0x16'))(_0xf43e('0x17'));var utils=require(_0xf43e('0x18'));var config=require(_0xf43e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf43e('0x1a'))['db'];config[_0xf43e('0x1b')]=_[_0xf43e('0x1c')](config[_0xf43e('0x1b')],{'host':_0xf43e('0x1d'),'port':0x18eb});var socket=require(_0xf43e('0x1e'))(new Redis(config['redis']));require(_0xf43e('0x1f'))['register'](socket);function respondWithStatusCode(_0x6004ee,_0x758ae8){_0x758ae8=_0x758ae8||0xcc;return function(_0x1e556){if(_0x1e556){return _0x6004ee[_0xf43e('0x20')](_0x758ae8);}return _0x6004ee['status'](_0x758ae8)[_0xf43e('0x21')]();};}function respondWithResult(_0xb49fcc,_0x5bb5d0){_0x5bb5d0=_0x5bb5d0||0xc8;return function(_0x35c613){if(_0x35c613){return _0xb49fcc[_0xf43e('0x22')](_0x5bb5d0)[_0xf43e('0x23')](_0x35c613);}};}function respondWithFilteredResult(_0xd401b0,_0x47e83f){return function(_0x1788a3){if(_0x1788a3){var _0xaea67e=typeof _0x47e83f[_0xf43e('0x24')]==='undefined'&&typeof _0x47e83f['limit']===_0xf43e('0x25');var _0x1e7f4d=_0x1788a3['count'];var _0x53c4b0=_0xaea67e?0x0:_0x47e83f['offset'];var _0x1f77c6=_0xaea67e?_0x1788a3[_0xf43e('0x26')]:_0x47e83f[_0xf43e('0x24')]+_0x47e83f[_0xf43e('0x27')];var _0x5991fe;if(_0x1f77c6>=_0x1e7f4d){_0x1f77c6=_0x1e7f4d;_0x5991fe=0xc8;}else{_0x5991fe=0xce;}_0xd401b0[_0xf43e('0x22')](_0x5991fe);return _0xd401b0[_0xf43e('0x28')]('Content-Range',_0x53c4b0+'-'+_0x1f77c6+'/'+_0x1e7f4d)[_0xf43e('0x23')](_0x1788a3);}return null;};}function patchUpdates(_0x45712a){return function(_0x549e11){try{jsonpatch['apply'](_0x549e11,_0x45712a,!![]);}catch(_0x18da20){return BPromise[_0xf43e('0x29')](_0x18da20);}return _0x549e11['save']();};}function saveUpdates(_0xfe0d49,_0x4737b5){return function(_0x381e5){if(_0x381e5){return _0x381e5[_0xf43e('0x2a')](_0xfe0d49)[_0xf43e('0x2b')](function(_0x406f20){return _0x406f20;});}return null;};}function removeEntity(_0x26efb6,_0x50ccf7){return function(_0x547a50){if(_0x547a50){return _0x547a50[_0xf43e('0x2c')]()[_0xf43e('0x2b')](function(){var _0x379f5f=_0x547a50[_0xf43e('0x2d')]({'plain':!![]});var _0x475675=_0xf43e('0x2e');return db[_0xf43e('0x2f')]['destroy']({'where':{'type':_0x475675,'resourceId':_0x379f5f['id']}})[_0xf43e('0x2b')](function(){return _0x547a50;});})[_0xf43e('0x2b')](function(){_0x26efb6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7be5,_0x25a4ab){return function(_0x5d6bcf){if(!_0x5d6bcf){_0x3a7be5[_0xf43e('0x20')](0x194);}return _0x5d6bcf;};}function handleError(_0x344c71,_0x579656){_0x579656=_0x579656||0x1f4;return function(_0x55b1b2){logger[_0xf43e('0x30')](_0x55b1b2['stack']);if(_0x55b1b2[_0xf43e('0x31')]){delete _0x55b1b2['name'];}_0x344c71[_0xf43e('0x22')](_0x579656)[_0xf43e('0x32')](_0x55b1b2);};}exports['index']=function(_0x5bb9d2,_0x559bed){var _0x4f43aa={},_0xf33b60={},_0x3342d2={'count':0x0,'rows':[]};var _0x828d31=_[_0xf43e('0x33')](db['WhatsappQueue'][_0xf43e('0x34')],function(_0x4d2c9e){return{'name':_0x4d2c9e[_0xf43e('0x35')],'type':_0x4d2c9e[_0xf43e('0x36')][_0xf43e('0x37')]};});_0xf33b60[_0xf43e('0x38')]=_[_0xf43e('0x33')](_0x828d31,_0xf43e('0x31'));_0xf33b60[_0xf43e('0x39')]=_[_0xf43e('0x3a')](_0x5bb9d2[_0xf43e('0x39')]);_0xf33b60[_0xf43e('0x3b')]=_[_0xf43e('0x3c')](_0xf33b60[_0xf43e('0x38')],_0xf33b60[_0xf43e('0x39')]);_0x4f43aa['attributes']=_[_0xf43e('0x3c')](_0xf33b60[_0xf43e('0x38')],qs[_0xf43e('0x3d')](_0x5bb9d2[_0xf43e('0x39')]['fields']));_0x4f43aa[_0xf43e('0x3e')]=_0x4f43aa[_0xf43e('0x3e')][_0xf43e('0x3f')]?_0x4f43aa[_0xf43e('0x3e')]:_0xf33b60[_0xf43e('0x38')];if(!_0x5bb9d2[_0xf43e('0x39')]['hasOwnProperty']('nolimit')){_0x4f43aa[_0xf43e('0x27')]=qs['limit'](_0x5bb9d2[_0xf43e('0x39')][_0xf43e('0x27')]);_0x4f43aa[_0xf43e('0x24')]=qs[_0xf43e('0x24')](_0x5bb9d2[_0xf43e('0x39')]['offset']);}_0x4f43aa['order']=qs[_0xf43e('0x40')](_0x5bb9d2[_0xf43e('0x39')]['sort']);_0x4f43aa[_0xf43e('0x41')]=qs[_0xf43e('0x3b')](_[_0xf43e('0x42')](_0x5bb9d2[_0xf43e('0x39')],_0xf33b60[_0xf43e('0x3b')]),_0x828d31);if(_0x5bb9d2['query'][_0xf43e('0x43')]){_0x4f43aa[_0xf43e('0x41')]=_[_0xf43e('0x44')](_0x4f43aa[_0xf43e('0x41')],{'$or':_[_0xf43e('0x33')](_0x828d31,function(_0xdb1af6){if(_0xdb1af6[_0xf43e('0x36')]!==_0xf43e('0x45')){var _0x261a13={};_0x261a13[_0xdb1af6[_0xf43e('0x31')]]={'$like':'%'+_0x5bb9d2[_0xf43e('0x39')][_0xf43e('0x43')]+'%'};return _0x261a13;}})});}_0x4f43aa=_['merge']({},_0x4f43aa,_0x5bb9d2[_0xf43e('0x46')]);var _0x48ee00={'where':_0x4f43aa['where']};return db['WhatsappQueue'][_0xf43e('0x26')](_0x48ee00)[_0xf43e('0x2b')](function(_0x5062fe){_0x3342d2[_0xf43e('0x26')]=_0x5062fe;if(_0x5bb9d2[_0xf43e('0x39')][_0xf43e('0x47')]){_0x4f43aa[_0xf43e('0x48')]=[{'all':!![]}];}return db[_0xf43e('0x49')]['findAll'](_0x4f43aa);})[_0xf43e('0x2b')](function(_0x4181e2){_0x3342d2[_0xf43e('0x4a')]=_0x4181e2;return _0x3342d2;})[_0xf43e('0x2b')](respondWithFilteredResult(_0x559bed,_0x4f43aa))[_0xf43e('0x4b')](handleError(_0x559bed,null));};exports[_0xf43e('0x4c')]=function(_0xc6e9b0,_0x1a1935){var _0x3090a9={'raw':!![],'where':{'id':_0xc6e9b0[_0xf43e('0x4d')]['id']}},_0x4a5cee={};_0x4a5cee['model']=_[_0xf43e('0x3a')](db[_0xf43e('0x49')][_0xf43e('0x34')]);_0x4a5cee[_0xf43e('0x39')]=_[_0xf43e('0x3a')](_0xc6e9b0[_0xf43e('0x39')]);_0x4a5cee['filters']=_[_0xf43e('0x3c')](_0x4a5cee[_0xf43e('0x38')],_0x4a5cee[_0xf43e('0x39')]);_0x3090a9['attributes']=_[_0xf43e('0x3c')](_0x4a5cee[_0xf43e('0x38')],qs['fields'](_0xc6e9b0['query'][_0xf43e('0x3d')]));_0x3090a9[_0xf43e('0x3e')]=_0x3090a9[_0xf43e('0x3e')][_0xf43e('0x3f')]?_0x3090a9[_0xf43e('0x3e')]:_0x4a5cee['model'];if(_0xc6e9b0[_0xf43e('0x39')][_0xf43e('0x47')]){_0x3090a9['include']=[{'all':!![]}];}_0x3090a9=_[_0xf43e('0x44')]({},_0x3090a9,_0xc6e9b0['options']);return db[_0xf43e('0x49')][_0xf43e('0x4e')](_0x3090a9)['then'](handleEntityNotFound(_0x1a1935,null))['then'](respondWithResult(_0x1a1935,null))[_0xf43e('0x4b')](handleError(_0x1a1935,null));};exports[_0xf43e('0x4f')]=function(_0x363ed1,_0x45d929){return db[_0xf43e('0x49')][_0xf43e('0x4f')](_0x363ed1[_0xf43e('0x50')],{})[_0xf43e('0x2b')](function(_0x5868ee){var _0x3575aa=_0x363ed1[_0xf43e('0x51')][_0xf43e('0x2d')]({'plain':!![]});if(!_0x3575aa)throw new Error(_0xf43e('0x52'));if(_0x3575aa[_0xf43e('0x53')]===_0xf43e('0x51')){var _0x11811c=_0x5868ee[_0xf43e('0x2d')]({'plain':!![]});var _0x2551ff=_0xf43e('0x2e');return db[_0xf43e('0x54')][_0xf43e('0x4e')]({'where':{'name':_0x2551ff,'userProfileId':_0x3575aa[_0xf43e('0x55')]},'raw':!![]})[_0xf43e('0x2b')](function(_0x5f0de9){if(_0x5f0de9&&_0x5f0de9[_0xf43e('0x56')]===0x0){return db[_0xf43e('0x2f')][_0xf43e('0x4f')]({'name':_0x11811c[_0xf43e('0x31')],'resourceId':_0x11811c['id'],'type':_0x5f0de9[_0xf43e('0x31')],'sectionId':_0x5f0de9['id']},{})[_0xf43e('0x2b')](function(){return _0x5868ee;});}else{return _0x5868ee;}})[_0xf43e('0x4b')](function(_0x1528b0){logger[_0xf43e('0x30')](_0xf43e('0x57'),_0x1528b0);throw _0x1528b0;});}return _0x5868ee;})['then'](respondWithResult(_0x45d929,0xc9))[_0xf43e('0x4b')](handleError(_0x45d929,null));};exports[_0xf43e('0x2a')]=function(_0x530fea,_0x42be1a){if(_0x530fea[_0xf43e('0x50')]['id']){delete _0x530fea[_0xf43e('0x50')]['id'];}return db[_0xf43e('0x49')][_0xf43e('0x4e')]({'where':{'id':_0x530fea['params']['id']}})[_0xf43e('0x2b')](handleEntityNotFound(_0x42be1a,null))[_0xf43e('0x2b')](saveUpdates(_0x530fea['body'],null))[_0xf43e('0x2b')](respondWithResult(_0x42be1a,null))[_0xf43e('0x4b')](handleError(_0x42be1a,null));};exports[_0xf43e('0x2c')]=function(_0x4a7795,_0x36d26d){return db[_0xf43e('0x49')][_0xf43e('0x4e')]({'where':{'id':_0x4a7795[_0xf43e('0x4d')]['id']}})[_0xf43e('0x2b')](handleEntityNotFound(_0x36d26d,null))[_0xf43e('0x2b')](removeEntity(_0x36d26d,null))[_0xf43e('0x4b')](handleError(_0x36d26d,null));};exports[_0xf43e('0x58')]=function(_0x20c9e7,_0x58752b){return db['WhatsappQueue'][_0xf43e('0x58')]()['then'](respondWithResult(_0x58752b,null))[_0xf43e('0x4b')](handleError(_0x58752b,null));};exports[_0xf43e('0x59')]=function(_0x4cc92e,_0x4e5423,_0x34bab3){var _0x2fee45={'raw':!![],'where':{}},_0x4e3fbf={},_0x1327d6;return db[_0xf43e('0x49')][_0xf43e('0x5a')]({'where':{'id':_0x4cc92e[_0xf43e('0x4d')]['id']}})[_0xf43e('0x2b')](handleEntityNotFound(_0x4e5423,null))['then'](function(_0x131f8f){if(_0x131f8f){_0x1327d6=_0x131f8f['get']({'plain':!![]});_0x4e3fbf[_0xf43e('0x38')]=_['keys'](db['UserWhatsappQueue'][_0xf43e('0x34')]);_0x4e3fbf[_0xf43e('0x39')]=_[_0xf43e('0x3a')](_0x4cc92e['query']);_0x4e3fbf[_0xf43e('0x3b')]=_[_0xf43e('0x3c')](_0x4e3fbf['model'],_0x4e3fbf[_0xf43e('0x39')]);_0x2fee45['attributes']=_[_0xf43e('0x3c')](_0x4e3fbf[_0xf43e('0x38')],qs[_0xf43e('0x3d')](_0x4cc92e[_0xf43e('0x39')]['fields']));_0x2fee45[_0xf43e('0x3e')]=_0x2fee45[_0xf43e('0x3e')][_0xf43e('0x3f')]?_0x2fee45['attributes']:_0x4e3fbf[_0xf43e('0x38')];if(!_0x4cc92e[_0xf43e('0x39')]['hasOwnProperty'](_0xf43e('0x5b'))){_0x2fee45['limit']=qs[_0xf43e('0x27')](_0x4cc92e['query'][_0xf43e('0x27')]);_0x2fee45['offset']=qs[_0xf43e('0x24')](_0x4cc92e[_0xf43e('0x39')][_0xf43e('0x24')]);}_0x2fee45[_0xf43e('0x5c')]=qs[_0xf43e('0x40')](_0x4cc92e[_0xf43e('0x39')]['sort']);_0x2fee45[_0xf43e('0x41')]=qs['filters'](_[_0xf43e('0x42')](_0x4cc92e[_0xf43e('0x39')],_0x4e3fbf['filters']));_0x2fee45[_0xf43e('0x41')]['WhatsappQueueId']=_0x131f8f['id'];if(_0x4cc92e[_0xf43e('0x39')][_0xf43e('0x43')]){_0x2fee45[_0xf43e('0x41')]=_['merge'](_0x2fee45[_0xf43e('0x41')],{'$or':_[_0xf43e('0x33')](_0x2fee45['attributes'],function(_0x52b052){var _0x4a6e8c={};_0x4a6e8c[_0x52b052]={'$like':'%'+_0x4cc92e[_0xf43e('0x39')]['filter']+'%'};return _0x4a6e8c;})});}_0x2fee45=_[_0xf43e('0x44')]({},_0x2fee45,_0x4cc92e['options']);return db['UserWhatsappQueue'][_0xf43e('0x5d')](_0x2fee45);}})['then'](function(_0x5696d0){if(_0x5696d0){return db[_0xf43e('0x5e')]['findAndCountAll']({'where':{'id':_[_0xf43e('0x33')](_0x5696d0,'UserId'),'role':_0xf43e('0x5f')},'attributes':['id',_0xf43e('0x31'),_0xf43e('0x60'),_0xf43e('0x61'),'createdAt']});}})['then'](function(_0x419b2b){if(_0x419b2b){return{'count':_0x419b2b[_0xf43e('0x26')],'rows':_[_0xf43e('0x33')](_0x419b2b[_0xf43e('0x4a')],function(_0x48bbe6){return{'membername':_0x48bbe6[_0xf43e('0x31')],'UserId':_0x48bbe6['id'],'queue_name':_0x1327d6[_0xf43e('0x31')],'WhatsappQueueId':_0x1327d6['id'],'interface':util[_0xf43e('0x62')](_0xf43e('0x63'),_0xf43e('0x64'),_0x48bbe6[_0xf43e('0x31')]),'penalty':0x0,'paused':_0x48bbe6[_0xf43e('0x60')],'createdAt':_0x48bbe6['createdAt'],'updatedAt':_0x48bbe6[_0xf43e('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf43e('0x2b')](respondWithFilteredResult(_0x4e5423,_0x2fee45))['catch'](handleError(_0x4e5423,null));};exports[_0xf43e('0x65')]=function(_0x21bea3,_0x321c44,_0x14931b){var _0x1f76a8={};var _0x47f8={};var _0x73066b;var _0x35a92f;return db[_0xf43e('0x49')][_0xf43e('0x5a')]({'where':{'id':_0x21bea3[_0xf43e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x321c44,null))[_0xf43e('0x2b')](function(_0x3857f8){if(_0x3857f8){_0x73066b=_0x3857f8;_0x47f8[_0xf43e('0x38')]=_[_0xf43e('0x3a')](db[_0xf43e('0x66')]['rawAttributes']);_0x47f8[_0xf43e('0x39')]=_[_0xf43e('0x3a')](_0x21bea3[_0xf43e('0x39')]);_0x47f8[_0xf43e('0x3b')]=_['intersection'](_0x47f8[_0xf43e('0x38')],_0x47f8[_0xf43e('0x39')]);_0x1f76a8[_0xf43e('0x3e')]=_[_0xf43e('0x3c')](_0x47f8[_0xf43e('0x38')],qs['fields'](_0x21bea3['query'][_0xf43e('0x3d')]));_0x1f76a8[_0xf43e('0x3e')]=_0x1f76a8[_0xf43e('0x3e')][_0xf43e('0x3f')]?_0x1f76a8[_0xf43e('0x3e')]:_0x47f8['model'];_0x1f76a8[_0xf43e('0x5c')]=qs['sort'](_0x21bea3[_0xf43e('0x39')][_0xf43e('0x40')]);_0x1f76a8['where']=qs[_0xf43e('0x3b')](_[_0xf43e('0x42')](_0x21bea3[_0xf43e('0x39')],_0x47f8[_0xf43e('0x3b')]));if(_0x21bea3['query'][_0xf43e('0x43')]){_0x1f76a8[_0xf43e('0x41')]=_[_0xf43e('0x44')](_0x1f76a8[_0xf43e('0x41')],{'$or':_[_0xf43e('0x33')](_0x1f76a8[_0xf43e('0x3e')],function(_0x3bdb38){var _0x47aab9={};_0x47aab9[_0x3bdb38]={'$like':'%'+_0x21bea3['query'][_0xf43e('0x43')]+'%'};return _0x47aab9;})});}_0x1f76a8=_[_0xf43e('0x44')]({},_0x1f76a8,_0x21bea3[_0xf43e('0x46')]);return _0x73066b[_0xf43e('0x65')](_0x1f76a8);}})['then'](function(_0x11342e){if(_0x11342e){_0x35a92f=_0x11342e['length'];if(!_0x21bea3[_0xf43e('0x39')][_0xf43e('0x67')](_0xf43e('0x5b'))){_0x1f76a8[_0xf43e('0x27')]=qs['limit'](_0x21bea3['query']['limit']);_0x1f76a8[_0xf43e('0x24')]=qs[_0xf43e('0x24')](_0x21bea3[_0xf43e('0x39')]['offset']);}return _0x73066b[_0xf43e('0x65')](_0x1f76a8);}})[_0xf43e('0x2b')](function(_0x250134){if(_0x250134){return _0x250134?{'count':_0x35a92f,'rows':_0x250134}:null;}})[_0xf43e('0x2b')](respondWithResult(_0x321c44,null))['catch'](handleError(_0x321c44,null));};exports['addTeams']=function(_0x28521d,_0x2eacf9,_0x5808f1){var _0x3825c1=_0x28521d[_0xf43e('0x50')][_0xf43e('0x68')];return db[_0xf43e('0x66')][_0xf43e('0x5d')]({'where':{'id':_0x3825c1},'attributes':['id'],'include':[{'model':db[_0xf43e('0x5e')],'as':_0xf43e('0x69'),'attributes':['id',_0xf43e('0x31'),_0xf43e('0x6a'),_0xf43e('0x6b'),_0xf43e('0x6c')],'raw':!![]}]})[_0xf43e('0x2b')](function(_0x33124f){if(_0x33124f){var _0x5beb4b=_[_0xf43e('0x6d')](_0x33124f,function(_0x2a6289){var _0x1914bd=_0x2a6289[_0xf43e('0x2d')]({'plain':!![]});return _0x1914bd[_0xf43e('0x69')];});return db[_0xf43e('0x49')][_0xf43e('0x4e')]({'where':{'id':_0x28521d[_0xf43e('0x4d')]['id']}})[_0xf43e('0x2b')](function(_0x3a1c2d){return db[_0xf43e('0x6e')][_0xf43e('0x6f')](function(_0x39b1d9){return _0x3a1c2d[_0xf43e('0x70')](_0x3825c1,{'transaction':_0x39b1d9})['then'](function(){return BPromise[_0xf43e('0x71')](_0x5beb4b,function(_0x56c768){return db[_0xf43e('0x72')][_0xf43e('0x73')]({'where':{'UserId':_0x56c768['id'],'WhatsappQueueId':_0x28521d[_0xf43e('0x4d')]['id']},'transaction':_0x39b1d9});});})[_0xf43e('0x2b')](function(){_0x5beb4b[_0xf43e('0x74')](function(_0x57ea0f){socket['emit'](_0xf43e('0x75'),{'UserId':_0x57ea0f['id'],'WhatsappQueueId':_0x3a1c2d['id']});});});});});}})['then'](respondWithStatusCode(_0x2eacf9,null))[_0xf43e('0x4b')](handleError(_0x2eacf9,null));};exports[_0xf43e('0x76')]=function(_0x1fe4e6,_0x2b5e2c,_0x4873b8){return db[_0xf43e('0x66')][_0xf43e('0x5d')]({'where':{'id':_0x1fe4e6[_0xf43e('0x39')][_0xf43e('0x68')]},'attributes':['id'],'include':[{'model':db[_0xf43e('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf43e('0x2b')](handleEntityNotFound(_0x2b5e2c,null))[_0xf43e('0x2b')](function(_0x143cdd){var _0x4e3586=_[_0xf43e('0x33')](_0x143cdd,'id');var _0x16877a=[];var _0x14665e=[];var _0x51c2c9=squel[_0xf43e('0x77')]();_0x51c2c9[_0xf43e('0x78')]('tq.TeamId')[_0xf43e('0x79')](_0xf43e('0x7a'),'tq')['join'](_0xf43e('0x7b'),'ut',_0xf43e('0x7c'))[_0xf43e('0x41')]('WhatsappQueueId\x20=\x20?',_0x1fe4e6[_0xf43e('0x4d')]['id']);for(var _0x4d3662=0x0;_0x4d3662<_0x143cdd[_0xf43e('0x3f')];_0x4d3662+=0x1){let _0x62c49=_0x143cdd[_0x4d3662];for(var _0x302523=0x0;_0x302523<_0x62c49[_0xf43e('0x69')]['length'];_0x302523+=0x1){let _0x4cce8c=_0x62c49[_0xf43e('0x69')][_0x302523];var _0x52a920=_0x51c2c9[_0xf43e('0x7d')]();_0x52a920['where']('ut.UserId\x20=\x20?',_0x4cce8c['id']);_0x14665e[_0xf43e('0x7e')](db['sequelize'][_0xf43e('0x39')](_0x52a920[_0xf43e('0x7f')](),{'type':db[_0xf43e('0x6e')]['QueryTypes'][_0xf43e('0x80')]})['then'](function(_0x3b6daa){if(_0x3b6daa[_0xf43e('0x3f')]===0x1){return _0x4cce8c['id'];}else{var _0x57d3e4=_[_0xf43e('0x81')](_[_0xf43e('0x33')](_0x3b6daa,_0xf43e('0x82')),function(_0x527dd5){return _[_0xf43e('0x83')](_0x4e3586,_0x527dd5);});if(_0x57d3e4){return _0x4cce8c['id'];}}}));}}return BPromise['all'](_0x14665e)[_0xf43e('0x2b')](function(_0x2f2565){_0x16877a=_(_0x16877a)[_0xf43e('0x84')](_0x2f2565)['compact']()[_0xf43e('0x85')]();return db[_0xf43e('0x49')][_0xf43e('0x4e')]({'where':{'id':_0x1fe4e6['params']['id']}})[_0xf43e('0x2b')](function(_0x4a7f8d){return db[_0xf43e('0x6e')][_0xf43e('0x6f')](function(_0x37345f){return _0x4a7f8d[_0xf43e('0x76')](_0x1fe4e6['query'][_0xf43e('0x68')],{'transaction':_0x37345f})[_0xf43e('0x2b')](function(){if(!_[_0xf43e('0x86')](_0x16877a)){return _0x4a7f8d[_0xf43e('0x87')](_0x16877a,{'transaction':_0x37345f});}})[_0xf43e('0x2b')](function(){_0x16877a[_0xf43e('0x74')](function(_0x54a8c6){socket[_0xf43e('0x88')](_0xf43e('0x89'),{'UserId':_0x54a8c6,'WhatsappQueueId':_0x4a7f8d['id']});});});});});});})['then'](respondWithStatusCode(_0x2b5e2c,null))[_0xf43e('0x4b')](handleError(_0x2b5e2c,null));};exports['addAgents']=function(_0x510bc1,_0x225178,_0x45a394){return db[_0xf43e('0x49')][_0xf43e('0x4e')]({'where':{'id':_0x510bc1[_0xf43e('0x4d')]['id']}})[_0xf43e('0x2b')](handleEntityNotFound(_0x225178,null))[_0xf43e('0x2b')](function(_0x4f8871){if(_0x4f8871){return _0x4f8871[_0xf43e('0x8a')](_0x510bc1['body'][_0xf43e('0x68')],_[_0xf43e('0x8b')](_0x510bc1[_0xf43e('0x50')],['ids','id'])||{})['spread'](function(_0x3fec3b){for(var _0x2107c6=0x0;_0x2107c6<_0x510bc1[_0xf43e('0x50')][_0xf43e('0x68')]['length'];_0x2107c6+=0x1){socket[_0xf43e('0x88')](_0xf43e('0x75'),{'UserId':Number(_0x510bc1[_0xf43e('0x50')]['ids'][_0x2107c6]),'WhatsappQueueId':Number(_0x510bc1[_0xf43e('0x4d')]['id'])});}return _0x3fec3b;});}})[_0xf43e('0x2b')](respondWithResult(_0x225178,null))[_0xf43e('0x4b')](handleError(_0x225178,null));};exports[_0xf43e('0x87')]=function(_0x5535a5,_0x581f0a,_0x5bbea9){return db[_0xf43e('0x49')][_0xf43e('0x4e')]({'where':{'id':_0x5535a5[_0xf43e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x581f0a,null))['then'](function(_0xf2cadd){if(_0xf2cadd){return _0xf2cadd[_0xf43e('0x87')](_0x5535a5['query'][_0xf43e('0x68')])[_0xf43e('0x2b')](function(){if(_['isArray'](_0x5535a5[_0xf43e('0x39')][_0xf43e('0x68')])){for(var _0x36c92f=0x0;_0x36c92f<_0x5535a5[_0xf43e('0x39')][_0xf43e('0x68')][_0xf43e('0x3f')];_0x36c92f+=0x1){socket[_0xf43e('0x88')](_0xf43e('0x89'),{'UserId':Number(_0x5535a5['query'][_0xf43e('0x68')][_0x36c92f]),'WhatsappQueueId':Number(_0x5535a5[_0xf43e('0x4d')]['id'])});}}else{socket[_0xf43e('0x88')](_0xf43e('0x89'),{'UserId':Number(_0x5535a5[_0xf43e('0x39')]['ids']),'WhatsappQueueId':Number(_0x5535a5[_0xf43e('0x4d')]['id'])});}});}})[_0xf43e('0x2b')](respondWithStatusCode(_0x581f0a,null))[_0xf43e('0x4b')](handleError(_0x581f0a,null));};exports[_0xf43e('0x8c')]=function(_0x38aca6,_0x445ecd,_0x348994){var _0x2248d8={};var _0x14474a={};var _0x47476b;var _0x25cff1;return db[_0xf43e('0x49')][_0xf43e('0x5a')]({'where':{'id':_0x38aca6[_0xf43e('0x4d')]['id']}})[_0xf43e('0x2b')](handleEntityNotFound(_0x445ecd,null))[_0xf43e('0x2b')](function(_0x1b0a2c){if(_0x1b0a2c){_0x47476b=_0x1b0a2c;_0x14474a[_0xf43e('0x38')]=_[_0xf43e('0x3a')](db[_0xf43e('0x5e')][_0xf43e('0x34')]);_0x14474a['query']=_[_0xf43e('0x3a')](_0x38aca6[_0xf43e('0x39')]);_0x14474a[_0xf43e('0x3b')]=_[_0xf43e('0x3c')](_0x14474a[_0xf43e('0x38')],_0x14474a[_0xf43e('0x39')]);_0x2248d8['attributes']=_[_0xf43e('0x3c')](_0x14474a['model'],qs[_0xf43e('0x3d')](_0x38aca6[_0xf43e('0x39')][_0xf43e('0x3d')]));_0x2248d8[_0xf43e('0x3e')]=_0x2248d8[_0xf43e('0x3e')][_0xf43e('0x3f')]?_0x2248d8[_0xf43e('0x3e')]:_0x14474a[_0xf43e('0x38')];_0x2248d8[_0xf43e('0x5c')]=qs[_0xf43e('0x40')](_0x38aca6[_0xf43e('0x39')][_0xf43e('0x40')]);_0x2248d8[_0xf43e('0x41')]=qs[_0xf43e('0x3b')](_[_0xf43e('0x42')](_0x38aca6[_0xf43e('0x39')],_0x14474a[_0xf43e('0x3b')]));if(_0x38aca6[_0xf43e('0x39')]['filter']){_0x2248d8['where']=_[_0xf43e('0x44')](_0x2248d8['where'],{'$or':_['map'](_0x2248d8[_0xf43e('0x3e')],function(_0x1f993f){var _0x2c7b00={};_0x2c7b00[_0x1f993f]={'$like':'%'+_0x38aca6['query']['filter']+'%'};return _0x2c7b00;})});}_0x2248d8=_[_0xf43e('0x44')]({},_0x2248d8,_0x38aca6['options']);return _0x47476b[_0xf43e('0x8c')](_0x2248d8);}})[_0xf43e('0x2b')](function(_0x337b5b){if(_0x337b5b){_0x25cff1=_0x337b5b[_0xf43e('0x3f')];if(!_0x38aca6[_0xf43e('0x39')][_0xf43e('0x67')](_0xf43e('0x5b'))){_0x2248d8['limit']=qs[_0xf43e('0x27')](_0x38aca6[_0xf43e('0x39')][_0xf43e('0x27')]);_0x2248d8[_0xf43e('0x24')]=qs[_0xf43e('0x24')](_0x38aca6['query'][_0xf43e('0x24')]);}return _0x47476b[_0xf43e('0x8c')](_0x2248d8);}})[_0xf43e('0x2b')](function(_0x21dfae){if(_0x21dfae){return _0x21dfae?{'count':_0x25cff1,'rows':_0x21dfae}:null;}})[_0xf43e('0x2b')](respondWithResult(_0x445ecd,null))[_0xf43e('0x4b')](handleError(_0x445ecd,null));}; \ No newline at end of file +var _0xc2fb=['includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','merge','findAll','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','Team','getTeams','addTeams','ids','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','User','Agents','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','QueryTypes','SELECT','includes','all','union','compact','value','removeAgents','emit','addAgents','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','end','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc2fb,0x16c));var _0xbc2f=function(_0x1a557f,_0x18cf8d){_0x1a557f=_0x1a557f-0x0;var _0x765e0d=_0xc2fb[_0x1a557f];return _0x765e0d;};'use strict';var emlformat=require(_0xbc2f('0x0'));var rimraf=require(_0xbc2f('0x1'));var zipdir=require(_0xbc2f('0x2'));var jsonpatch=require(_0xbc2f('0x3'));var rp=require(_0xbc2f('0x4'));var moment=require(_0xbc2f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbc2f('0x6'));var util=require(_0xbc2f('0x7'));var path=require(_0xbc2f('0x8'));var sox=require(_0xbc2f('0x9'));var csv=require(_0xbc2f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc2f('0xb'));var _=require(_0xbc2f('0xc'));var squel=require(_0xbc2f('0xd'));var crypto=require(_0xbc2f('0xe'));var jsforce=require(_0xbc2f('0xf'));var deskjs=require(_0xbc2f('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbc2f('0x11'));var Redis=require(_0xbc2f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbc2f('0x13'));var as=require(_0xbc2f('0x14'));var hardwareService=require(_0xbc2f('0x15'));var logger=require(_0xbc2f('0x16'))(_0xbc2f('0x17'));var utils=require(_0xbc2f('0x18'));var config=require(_0xbc2f('0x19'));var licenseUtil=require(_0xbc2f('0x1a'));var db=require(_0xbc2f('0x1b'))['db'];config[_0xbc2f('0x1c')]=_[_0xbc2f('0x1d')](config[_0xbc2f('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xbc2f('0x1e'))(new Redis(config['redis']));require(_0xbc2f('0x1f'))[_0xbc2f('0x20')](socket);function respondWithStatusCode(_0x1c761d,_0x381c9c){_0x381c9c=_0x381c9c||0xcc;return function(_0x433a72){if(_0x433a72){return _0x1c761d['sendStatus'](_0x381c9c);}return _0x1c761d['status'](_0x381c9c)['end']();};}function respondWithResult(_0x380a7a,_0x2d6de4){_0x2d6de4=_0x2d6de4||0xc8;return function(_0xb6e1e6){if(_0xb6e1e6){return _0x380a7a[_0xbc2f('0x21')](_0x2d6de4)[_0xbc2f('0x22')](_0xb6e1e6);}};}function respondWithFilteredResult(_0x427b63,_0x3f34d2){return function(_0x2162d5){if(_0x2162d5){var _0x54db49=typeof _0x3f34d2[_0xbc2f('0x23')]===_0xbc2f('0x24')&&typeof _0x3f34d2[_0xbc2f('0x25')]===_0xbc2f('0x24');var _0xa60805=_0x2162d5['count'];var _0x5b5a16=_0x54db49?0x0:_0x3f34d2[_0xbc2f('0x23')];var _0x39ecc1=_0x54db49?_0x2162d5[_0xbc2f('0x26')]:_0x3f34d2[_0xbc2f('0x23')]+_0x3f34d2['limit'];var _0x5047bf;if(_0x39ecc1>=_0xa60805){_0x39ecc1=_0xa60805;_0x5047bf=0xc8;}else{_0x5047bf=0xce;}_0x427b63[_0xbc2f('0x21')](_0x5047bf);return _0x427b63[_0xbc2f('0x27')](_0xbc2f('0x28'),_0x5b5a16+'-'+_0x39ecc1+'/'+_0xa60805)['json'](_0x2162d5);}return null;};}function patchUpdates(_0x492d51){return function(_0x30bbd0){try{jsonpatch[_0xbc2f('0x29')](_0x30bbd0,_0x492d51,!![]);}catch(_0xe52d7c){return BPromise[_0xbc2f('0x2a')](_0xe52d7c);}return _0x30bbd0[_0xbc2f('0x2b')]();};}function saveUpdates(_0x2744c4,_0x54d0c1){return function(_0x4c9f94){if(_0x4c9f94){return _0x4c9f94[_0xbc2f('0x2c')](_0x2744c4)[_0xbc2f('0x2d')](function(_0x29b4e2){return _0x29b4e2;});}return null;};}function removeEntity(_0x397189,_0x430d99){return function(_0x59c7a3){if(_0x59c7a3){return _0x59c7a3[_0xbc2f('0x2e')]()[_0xbc2f('0x2d')](function(){var _0x3b7e68=_0x59c7a3[_0xbc2f('0x2f')]({'plain':!![]});var _0x429b7f=_0xbc2f('0x30');return db['UserProfileResource'][_0xbc2f('0x2e')]({'where':{'type':_0x429b7f,'resourceId':_0x3b7e68['id']}})[_0xbc2f('0x2d')](function(){return _0x59c7a3;});})['then'](function(){_0x397189[_0xbc2f('0x21')](0xcc)[_0xbc2f('0x31')]();});}};}function handleEntityNotFound(_0x3c1b8d,_0x1ab8a0){return function(_0x54d718){if(!_0x54d718){_0x3c1b8d['sendStatus'](0x194);}return _0x54d718;};}function handleError(_0x48b85e,_0x299ab5){_0x299ab5=_0x299ab5||0x1f4;return function(_0x5645c0){logger['error'](_0x5645c0[_0xbc2f('0x32')]);if(_0x5645c0[_0xbc2f('0x33')]){delete _0x5645c0['name'];}_0x48b85e[_0xbc2f('0x21')](_0x299ab5)[_0xbc2f('0x34')](_0x5645c0);};}exports[_0xbc2f('0x35')]=function(_0x37e226,_0x386143){var _0x10383a={},_0xdf7e33={},_0x2c4f19={'count':0x0,'rows':[]};var _0x2351c2=_[_0xbc2f('0x36')](db[_0xbc2f('0x37')][_0xbc2f('0x38')],function(_0x5e8f42){return{'name':_0x5e8f42[_0xbc2f('0x39')],'type':_0x5e8f42[_0xbc2f('0x3a')][_0xbc2f('0x3b')]};});_0xdf7e33[_0xbc2f('0x3c')]=_['map'](_0x2351c2,_0xbc2f('0x33'));_0xdf7e33[_0xbc2f('0x3d')]=_[_0xbc2f('0x3e')](_0x37e226['query']);_0xdf7e33[_0xbc2f('0x3f')]=_[_0xbc2f('0x40')](_0xdf7e33['model'],_0xdf7e33[_0xbc2f('0x3d')]);_0x10383a[_0xbc2f('0x41')]=_[_0xbc2f('0x40')](_0xdf7e33[_0xbc2f('0x3c')],qs['fields'](_0x37e226[_0xbc2f('0x3d')][_0xbc2f('0x42')]));_0x10383a[_0xbc2f('0x41')]=_0x10383a['attributes'][_0xbc2f('0x43')]?_0x10383a['attributes']:_0xdf7e33['model'];if(!_0x37e226[_0xbc2f('0x3d')][_0xbc2f('0x44')](_0xbc2f('0x45'))){_0x10383a[_0xbc2f('0x25')]=qs[_0xbc2f('0x25')](_0x37e226[_0xbc2f('0x3d')][_0xbc2f('0x25')]);_0x10383a[_0xbc2f('0x23')]=qs['offset'](_0x37e226[_0xbc2f('0x3d')][_0xbc2f('0x23')]);}_0x10383a[_0xbc2f('0x46')]=qs['sort'](_0x37e226['query'][_0xbc2f('0x47')]);_0x10383a['where']=qs[_0xbc2f('0x3f')](_[_0xbc2f('0x48')](_0x37e226[_0xbc2f('0x3d')],_0xdf7e33['filters']),_0x2351c2);if(_0x37e226[_0xbc2f('0x3d')][_0xbc2f('0x49')]){_0x10383a[_0xbc2f('0x4a')]=_['merge'](_0x10383a['where'],{'$or':_[_0xbc2f('0x36')](_0x2351c2,function(_0x53cdfd){if(_0x53cdfd['type']!==_0xbc2f('0x4b')){var _0x197be3={};_0x197be3[_0x53cdfd['name']]={'$like':'%'+_0x37e226[_0xbc2f('0x3d')][_0xbc2f('0x49')]+'%'};return _0x197be3;}})});}_0x10383a=_['merge']({},_0x10383a,_0x37e226[_0xbc2f('0x4c')]);var _0x191518={'where':_0x10383a[_0xbc2f('0x4a')]};return db['WhatsappQueue'][_0xbc2f('0x26')](_0x191518)[_0xbc2f('0x2d')](function(_0x22f04a){_0x2c4f19[_0xbc2f('0x26')]=_0x22f04a;if(_0x37e226[_0xbc2f('0x3d')][_0xbc2f('0x4d')]){_0x10383a[_0xbc2f('0x4e')]=[{'all':!![]}];}return db[_0xbc2f('0x37')]['findAll'](_0x10383a);})[_0xbc2f('0x2d')](function(_0x1231ae){_0x2c4f19[_0xbc2f('0x4f')]=_0x1231ae;return _0x2c4f19;})[_0xbc2f('0x2d')](respondWithFilteredResult(_0x386143,_0x10383a))[_0xbc2f('0x50')](handleError(_0x386143,null));};exports[_0xbc2f('0x51')]=function(_0x4cc17a,_0xed01ca){var _0x314685={'raw':!![],'where':{'id':_0x4cc17a[_0xbc2f('0x52')]['id']}},_0x5765b7={};_0x5765b7[_0xbc2f('0x3c')]=_[_0xbc2f('0x3e')](db[_0xbc2f('0x37')]['rawAttributes']);_0x5765b7[_0xbc2f('0x3d')]=_['keys'](_0x4cc17a[_0xbc2f('0x3d')]);_0x5765b7[_0xbc2f('0x3f')]=_[_0xbc2f('0x40')](_0x5765b7[_0xbc2f('0x3c')],_0x5765b7[_0xbc2f('0x3d')]);_0x314685['attributes']=_['intersection'](_0x5765b7[_0xbc2f('0x3c')],qs[_0xbc2f('0x42')](_0x4cc17a[_0xbc2f('0x3d')][_0xbc2f('0x42')]));_0x314685[_0xbc2f('0x41')]=_0x314685[_0xbc2f('0x41')]['length']?_0x314685[_0xbc2f('0x41')]:_0x5765b7[_0xbc2f('0x3c')];if(_0x4cc17a[_0xbc2f('0x3d')][_0xbc2f('0x4d')]){_0x314685[_0xbc2f('0x4e')]=[{'all':!![]}];}_0x314685=_['merge']({},_0x314685,_0x4cc17a[_0xbc2f('0x4c')]);return db[_0xbc2f('0x37')][_0xbc2f('0x53')](_0x314685)['then'](handleEntityNotFound(_0xed01ca,null))['then'](respondWithResult(_0xed01ca,null))[_0xbc2f('0x50')](handleError(_0xed01ca,null));};exports[_0xbc2f('0x54')]=function(_0x2f75cb,_0x2deacd){return db[_0xbc2f('0x37')][_0xbc2f('0x54')](_0x2f75cb[_0xbc2f('0x55')],{})[_0xbc2f('0x2d')](function(_0x3ec5cc){var _0x1e5c3a=_0x2f75cb['user']['get']({'plain':!![]});if(!_0x1e5c3a)throw new Error(_0xbc2f('0x56'));if(_0x1e5c3a[_0xbc2f('0x57')]==='user'){var _0x306954=_0x3ec5cc['get']({'plain':!![]});var _0x143346='WhatsappQueues';return db[_0xbc2f('0x58')][_0xbc2f('0x53')]({'where':{'name':_0x143346,'userProfileId':_0x1e5c3a['userProfileId']},'raw':!![]})[_0xbc2f('0x2d')](function(_0x3af0c1){if(_0x3af0c1&&_0x3af0c1[_0xbc2f('0x59')]===0x0){return db[_0xbc2f('0x5a')][_0xbc2f('0x54')]({'name':_0x306954[_0xbc2f('0x33')],'resourceId':_0x306954['id'],'type':_0x3af0c1[_0xbc2f('0x33')],'sectionId':_0x3af0c1['id']},{})[_0xbc2f('0x2d')](function(){return _0x3ec5cc;});}else{return _0x3ec5cc;}})['catch'](function(_0x36e65c){logger[_0xbc2f('0x5b')](_0xbc2f('0x5c'),_0x36e65c);throw _0x36e65c;});}return _0x3ec5cc;})[_0xbc2f('0x2d')](respondWithResult(_0x2deacd,0xc9))[_0xbc2f('0x50')](handleError(_0x2deacd,null));};exports['update']=function(_0x59fca1,_0x2f77c4){if(_0x59fca1['body']['id']){delete _0x59fca1[_0xbc2f('0x55')]['id'];}return db[_0xbc2f('0x37')][_0xbc2f('0x53')]({'where':{'id':_0x59fca1[_0xbc2f('0x52')]['id']}})[_0xbc2f('0x2d')](handleEntityNotFound(_0x2f77c4,null))[_0xbc2f('0x2d')](saveUpdates(_0x59fca1[_0xbc2f('0x55')],null))[_0xbc2f('0x2d')](respondWithResult(_0x2f77c4,null))[_0xbc2f('0x50')](handleError(_0x2f77c4,null));};exports[_0xbc2f('0x2e')]=function(_0x141c0c,_0x23bae0){return db[_0xbc2f('0x37')][_0xbc2f('0x53')]({'where':{'id':_0x141c0c[_0xbc2f('0x52')]['id']}})[_0xbc2f('0x2d')](handleEntityNotFound(_0x23bae0,null))[_0xbc2f('0x2d')](removeEntity(_0x23bae0,null))[_0xbc2f('0x50')](handleError(_0x23bae0,null));};exports[_0xbc2f('0x5d')]=function(_0x433b6b,_0x107155){return db[_0xbc2f('0x37')]['describe']()[_0xbc2f('0x2d')](respondWithResult(_0x107155,null))[_0xbc2f('0x50')](handleError(_0x107155,null));};exports[_0xbc2f('0x5e')]=function(_0x451005,_0x17a044,_0x3c0f11){var _0x25a975={'raw':!![],'where':{}},_0x50e83a={},_0x55d156;return db[_0xbc2f('0x37')][_0xbc2f('0x5f')]({'where':{'id':_0x451005[_0xbc2f('0x52')]['id']}})[_0xbc2f('0x2d')](handleEntityNotFound(_0x17a044,null))[_0xbc2f('0x2d')](function(_0x526b3c){if(_0x526b3c){_0x55d156=_0x526b3c[_0xbc2f('0x2f')]({'plain':!![]});_0x50e83a[_0xbc2f('0x3c')]=_['keys'](db[_0xbc2f('0x60')][_0xbc2f('0x38')]);_0x50e83a['query']=_[_0xbc2f('0x3e')](_0x451005[_0xbc2f('0x3d')]);_0x50e83a[_0xbc2f('0x3f')]=_[_0xbc2f('0x40')](_0x50e83a[_0xbc2f('0x3c')],_0x50e83a[_0xbc2f('0x3d')]);_0x25a975[_0xbc2f('0x41')]=_['intersection'](_0x50e83a[_0xbc2f('0x3c')],qs[_0xbc2f('0x42')](_0x451005[_0xbc2f('0x3d')][_0xbc2f('0x42')]));_0x25a975['attributes']=_0x25a975[_0xbc2f('0x41')]['length']?_0x25a975[_0xbc2f('0x41')]:_0x50e83a[_0xbc2f('0x3c')];if(!_0x451005[_0xbc2f('0x3d')][_0xbc2f('0x44')](_0xbc2f('0x45'))){_0x25a975['limit']=qs[_0xbc2f('0x25')](_0x451005[_0xbc2f('0x3d')][_0xbc2f('0x25')]);_0x25a975['offset']=qs[_0xbc2f('0x23')](_0x451005[_0xbc2f('0x3d')][_0xbc2f('0x23')]);}_0x25a975[_0xbc2f('0x46')]=qs[_0xbc2f('0x47')](_0x451005[_0xbc2f('0x3d')][_0xbc2f('0x47')]);_0x25a975[_0xbc2f('0x4a')]=qs[_0xbc2f('0x3f')](_['pick'](_0x451005[_0xbc2f('0x3d')],_0x50e83a[_0xbc2f('0x3f')]));_0x25a975[_0xbc2f('0x4a')][_0xbc2f('0x61')]=_0x526b3c['id'];if(_0x451005['query'][_0xbc2f('0x49')]){_0x25a975[_0xbc2f('0x4a')]=_[_0xbc2f('0x62')](_0x25a975['where'],{'$or':_[_0xbc2f('0x36')](_0x25a975[_0xbc2f('0x41')],function(_0x192d51){var _0x4368d4={};_0x4368d4[_0x192d51]={'$like':'%'+_0x451005[_0xbc2f('0x3d')][_0xbc2f('0x49')]+'%'};return _0x4368d4;})});}_0x25a975=_[_0xbc2f('0x62')]({},_0x25a975,_0x451005[_0xbc2f('0x4c')]);return db[_0xbc2f('0x60')][_0xbc2f('0x63')](_0x25a975);}})[_0xbc2f('0x2d')](function(_0x2eec73){if(_0x2eec73){return db['User'][_0xbc2f('0x64')]({'where':{'id':_[_0xbc2f('0x36')](_0x2eec73,_0xbc2f('0x65')),'role':'agent'},'attributes':['id',_0xbc2f('0x33'),'whatsappPause',_0xbc2f('0x66'),_0xbc2f('0x67')]});}})[_0xbc2f('0x2d')](function(_0x5cf244){if(_0x5cf244){return{'count':_0x5cf244['count'],'rows':_[_0xbc2f('0x36')](_0x5cf244[_0xbc2f('0x4f')],function(_0x465f5f){return{'membername':_0x465f5f[_0xbc2f('0x33')],'UserId':_0x465f5f['id'],'queue_name':_0x55d156[_0xbc2f('0x33')],'WhatsappQueueId':_0x55d156['id'],'interface':util[_0xbc2f('0x68')](_0xbc2f('0x69'),_0xbc2f('0x6a'),_0x465f5f['name']),'penalty':0x0,'paused':_0x465f5f[_0xbc2f('0x6b')],'createdAt':_0x465f5f['createdAt'],'updatedAt':_0x465f5f[_0xbc2f('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbc2f('0x2d')](respondWithFilteredResult(_0x17a044,_0x25a975))['catch'](handleError(_0x17a044,null));};exports['getTeams']=function(_0x3e6a42,_0x5e3b89,_0x31d475){var _0x4a7410={};var _0x1db397={};var _0x3d3d29;var _0x438ab2;return db[_0xbc2f('0x37')][_0xbc2f('0x5f')]({'where':{'id':_0x3e6a42[_0xbc2f('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e3b89,null))[_0xbc2f('0x2d')](function(_0x5e48b3){if(_0x5e48b3){_0x3d3d29=_0x5e48b3;_0x1db397[_0xbc2f('0x3c')]=_[_0xbc2f('0x3e')](db[_0xbc2f('0x6c')][_0xbc2f('0x38')]);_0x1db397[_0xbc2f('0x3d')]=_[_0xbc2f('0x3e')](_0x3e6a42[_0xbc2f('0x3d')]);_0x1db397['filters']=_['intersection'](_0x1db397['model'],_0x1db397['query']);_0x4a7410[_0xbc2f('0x41')]=_['intersection'](_0x1db397[_0xbc2f('0x3c')],qs['fields'](_0x3e6a42['query'][_0xbc2f('0x42')]));_0x4a7410[_0xbc2f('0x41')]=_0x4a7410[_0xbc2f('0x41')][_0xbc2f('0x43')]?_0x4a7410[_0xbc2f('0x41')]:_0x1db397[_0xbc2f('0x3c')];_0x4a7410[_0xbc2f('0x46')]=qs[_0xbc2f('0x47')](_0x3e6a42[_0xbc2f('0x3d')][_0xbc2f('0x47')]);_0x4a7410[_0xbc2f('0x4a')]=qs[_0xbc2f('0x3f')](_[_0xbc2f('0x48')](_0x3e6a42['query'],_0x1db397[_0xbc2f('0x3f')]));if(_0x3e6a42[_0xbc2f('0x3d')][_0xbc2f('0x49')]){_0x4a7410[_0xbc2f('0x4a')]=_[_0xbc2f('0x62')](_0x4a7410[_0xbc2f('0x4a')],{'$or':_[_0xbc2f('0x36')](_0x4a7410[_0xbc2f('0x41')],function(_0xa3c01d){var _0x563d0d={};_0x563d0d[_0xa3c01d]={'$like':'%'+_0x3e6a42['query'][_0xbc2f('0x49')]+'%'};return _0x563d0d;})});}_0x4a7410=_[_0xbc2f('0x62')]({},_0x4a7410,_0x3e6a42[_0xbc2f('0x4c')]);return _0x3d3d29[_0xbc2f('0x6d')](_0x4a7410);}})['then'](function(_0x5cbbc0){if(_0x5cbbc0){_0x438ab2=_0x5cbbc0['length'];if(!_0x3e6a42[_0xbc2f('0x3d')][_0xbc2f('0x44')](_0xbc2f('0x45'))){_0x4a7410[_0xbc2f('0x25')]=qs[_0xbc2f('0x25')](_0x3e6a42[_0xbc2f('0x3d')][_0xbc2f('0x25')]);_0x4a7410[_0xbc2f('0x23')]=qs['offset'](_0x3e6a42[_0xbc2f('0x3d')][_0xbc2f('0x23')]);}return _0x3d3d29[_0xbc2f('0x6d')](_0x4a7410);}})[_0xbc2f('0x2d')](function(_0x99e544){if(_0x99e544){return _0x99e544?{'count':_0x438ab2,'rows':_0x99e544}:null;}})[_0xbc2f('0x2d')](respondWithResult(_0x5e3b89,null))['catch'](handleError(_0x5e3b89,null));};exports[_0xbc2f('0x6e')]=function(_0x41c136,_0x2aab91,_0x58e782){var _0x1294b5=_0x41c136[_0xbc2f('0x55')][_0xbc2f('0x6f')];return db['Team'][_0xbc2f('0x63')]({'where':{'id':_0x1294b5},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0xbc2f('0x70'),_0xbc2f('0x71')],'raw':!![]}]})['then'](function(_0x20f317){if(_0x20f317){var _0x2e9070=_[_0xbc2f('0x72')](_0x20f317,function(_0x34af65){var _0x9743f1=_0x34af65['get']({'plain':!![]});return _0x9743f1['Agents'];});return db['WhatsappQueue'][_0xbc2f('0x53')]({'where':{'id':_0x41c136[_0xbc2f('0x52')]['id']}})['then'](function(_0x45c535){return db[_0xbc2f('0x73')][_0xbc2f('0x74')](function(_0x5ca0f3){return _0x45c535[_0xbc2f('0x6e')](_0x1294b5,{'transaction':_0x5ca0f3})['then'](function(){return BPromise[_0xbc2f('0x75')](_0x2e9070,function(_0x100669){return db[_0xbc2f('0x60')][_0xbc2f('0x76')]({'where':{'UserId':_0x100669['id'],'WhatsappQueueId':_0x41c136['params']['id']},'transaction':_0x5ca0f3});});})[_0xbc2f('0x2d')](function(){_0x2e9070[_0xbc2f('0x77')](function(_0x43c582){socket['emit'](_0xbc2f('0x78'),{'UserId':_0x43c582['id'],'WhatsappQueueId':_0x45c535['id']});});});});});}})['then'](respondWithStatusCode(_0x2aab91,null))[_0xbc2f('0x50')](handleError(_0x2aab91,null));};exports[_0xbc2f('0x79')]=function(_0x89fdd3,_0x3f09a5,_0x3b474f){return db[_0xbc2f('0x6c')][_0xbc2f('0x63')]({'where':{'id':_0x89fdd3[_0xbc2f('0x3d')][_0xbc2f('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xbc2f('0x7a')],'as':_0xbc2f('0x7b'),'attributes':['id'],'raw':!![]}]})[_0xbc2f('0x2d')](handleEntityNotFound(_0x3f09a5,null))['then'](function(_0x2b0449){var _0x1353c5=_['map'](_0x2b0449,'id');var _0x1ed00b=[];var _0xc1d2c2=[];var _0x13945e=squel[_0xbc2f('0x7c')]();_0x13945e[_0xbc2f('0x7d')](_0xbc2f('0x7e'))['from'](_0xbc2f('0x7f'),'tq')[_0xbc2f('0x80')](_0xbc2f('0x81'),'ut',_0xbc2f('0x82'))[_0xbc2f('0x4a')](_0xbc2f('0x83'),_0x89fdd3['params']['id']);for(var _0x5066b3=0x0;_0x5066b3<_0x2b0449[_0xbc2f('0x43')];_0x5066b3+=0x1){let _0x319e46=_0x2b0449[_0x5066b3];for(var _0x2e7be7=0x0;_0x2e7be7<_0x319e46['Agents'][_0xbc2f('0x43')];_0x2e7be7+=0x1){let _0x298bf5=_0x319e46[_0xbc2f('0x7b')][_0x2e7be7];var _0x5165b9=_0x13945e[_0xbc2f('0x84')]();_0x5165b9['where']('ut.UserId\x20=\x20?',_0x298bf5['id']);_0xc1d2c2['push'](db[_0xbc2f('0x73')]['query'](_0x5165b9['toString'](),{'type':db[_0xbc2f('0x73')][_0xbc2f('0x85')][_0xbc2f('0x86')]})[_0xbc2f('0x2d')](function(_0x91eb18){if(_0x91eb18[_0xbc2f('0x43')]===0x1){return _0x298bf5['id'];}else{var _0x50bd27=_['every'](_[_0xbc2f('0x36')](_0x91eb18,'TeamId'),function(_0x5d7971){return _[_0xbc2f('0x87')](_0x1353c5,_0x5d7971);});if(_0x50bd27){return _0x298bf5['id'];}}}));}}return BPromise[_0xbc2f('0x88')](_0xc1d2c2)[_0xbc2f('0x2d')](function(_0x1d5a1f){_0x1ed00b=_(_0x1ed00b)[_0xbc2f('0x89')](_0x1d5a1f)[_0xbc2f('0x8a')]()[_0xbc2f('0x8b')]();return db[_0xbc2f('0x37')][_0xbc2f('0x53')]({'where':{'id':_0x89fdd3[_0xbc2f('0x52')]['id']}})[_0xbc2f('0x2d')](function(_0x35b50a){return db[_0xbc2f('0x73')][_0xbc2f('0x74')](function(_0x1fbe4c){return _0x35b50a[_0xbc2f('0x79')](_0x89fdd3[_0xbc2f('0x3d')][_0xbc2f('0x6f')],{'transaction':_0x1fbe4c})['then'](function(){if(!_['isEmpty'](_0x1ed00b)){return _0x35b50a[_0xbc2f('0x8c')](_0x1ed00b,{'transaction':_0x1fbe4c});}})['then'](function(){_0x1ed00b['forEach'](function(_0x3faa8d){socket[_0xbc2f('0x8d')]('userWhatsappQueue:remove',{'UserId':_0x3faa8d,'WhatsappQueueId':_0x35b50a['id']});});});});});});})['then'](respondWithStatusCode(_0x3f09a5,null))['catch'](handleError(_0x3f09a5,null));};exports[_0xbc2f('0x8e')]=function(_0x50c0b0,_0x5a8faf,_0x5b78e8){return db[_0xbc2f('0x37')][_0xbc2f('0x53')]({'where':{'id':_0x50c0b0['params']['id']}})[_0xbc2f('0x2d')](handleEntityNotFound(_0x5a8faf,null))[_0xbc2f('0x2d')](function(_0x315bff){if(_0x315bff){return _0x315bff['addAgents'](_0x50c0b0['body'][_0xbc2f('0x6f')],_['omit'](_0x50c0b0['body'],['ids','id'])||{})[_0xbc2f('0x8f')](function(_0x3bfa39){for(var _0x362ae6=0x0;_0x362ae6<_0x50c0b0['body']['ids'][_0xbc2f('0x43')];_0x362ae6+=0x1){socket[_0xbc2f('0x8d')](_0xbc2f('0x78'),{'UserId':Number(_0x50c0b0[_0xbc2f('0x55')][_0xbc2f('0x6f')][_0x362ae6]),'WhatsappQueueId':Number(_0x50c0b0[_0xbc2f('0x52')]['id'])});}return _0x3bfa39;});}})[_0xbc2f('0x2d')](respondWithResult(_0x5a8faf,null))[_0xbc2f('0x50')](handleError(_0x5a8faf,null));};exports['removeAgents']=function(_0x709048,_0x3eb711,_0x2363c8){return db[_0xbc2f('0x37')][_0xbc2f('0x53')]({'where':{'id':_0x709048[_0xbc2f('0x52')]['id']}})['then'](handleEntityNotFound(_0x3eb711,null))['then'](function(_0x16a823){if(_0x16a823){return _0x16a823[_0xbc2f('0x8c')](_0x709048[_0xbc2f('0x3d')][_0xbc2f('0x6f')])[_0xbc2f('0x2d')](function(){if(_[_0xbc2f('0x90')](_0x709048[_0xbc2f('0x3d')][_0xbc2f('0x6f')])){for(var _0x2a2c76=0x0;_0x2a2c76<_0x709048[_0xbc2f('0x3d')]['ids'][_0xbc2f('0x43')];_0x2a2c76+=0x1){socket[_0xbc2f('0x8d')](_0xbc2f('0x91'),{'UserId':Number(_0x709048[_0xbc2f('0x3d')]['ids'][_0x2a2c76]),'WhatsappQueueId':Number(_0x709048[_0xbc2f('0x52')]['id'])});}}else{socket[_0xbc2f('0x8d')](_0xbc2f('0x91'),{'UserId':Number(_0x709048[_0xbc2f('0x3d')][_0xbc2f('0x6f')]),'WhatsappQueueId':Number(_0x709048['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3eb711,null))['catch'](handleError(_0x3eb711,null));};exports[_0xbc2f('0x92')]=function(_0x329a6a,_0x22256b,_0x434794){var _0x3ccb6b={};var _0x4371b4={};var _0x2bbd92;var _0x57383d;return db['WhatsappQueue'][_0xbc2f('0x5f')]({'where':{'id':_0x329a6a[_0xbc2f('0x52')]['id']}})[_0xbc2f('0x2d')](handleEntityNotFound(_0x22256b,null))[_0xbc2f('0x2d')](function(_0x31356c){if(_0x31356c){_0x2bbd92=_0x31356c;_0x4371b4[_0xbc2f('0x3c')]=_['keys'](db[_0xbc2f('0x7a')][_0xbc2f('0x38')]);_0x4371b4[_0xbc2f('0x3d')]=_[_0xbc2f('0x3e')](_0x329a6a[_0xbc2f('0x3d')]);_0x4371b4[_0xbc2f('0x3f')]=_[_0xbc2f('0x40')](_0x4371b4[_0xbc2f('0x3c')],_0x4371b4[_0xbc2f('0x3d')]);_0x3ccb6b[_0xbc2f('0x41')]=_[_0xbc2f('0x40')](_0x4371b4[_0xbc2f('0x3c')],qs[_0xbc2f('0x42')](_0x329a6a[_0xbc2f('0x3d')][_0xbc2f('0x42')]));_0x3ccb6b[_0xbc2f('0x41')]=_0x3ccb6b[_0xbc2f('0x41')][_0xbc2f('0x43')]?_0x3ccb6b['attributes']:_0x4371b4[_0xbc2f('0x3c')];_0x3ccb6b[_0xbc2f('0x46')]=qs[_0xbc2f('0x47')](_0x329a6a['query'][_0xbc2f('0x47')]);_0x3ccb6b[_0xbc2f('0x4a')]=qs[_0xbc2f('0x3f')](_['pick'](_0x329a6a[_0xbc2f('0x3d')],_0x4371b4[_0xbc2f('0x3f')]));if(_0x329a6a[_0xbc2f('0x3d')][_0xbc2f('0x49')]){_0x3ccb6b[_0xbc2f('0x4a')]=_[_0xbc2f('0x62')](_0x3ccb6b[_0xbc2f('0x4a')],{'$or':_[_0xbc2f('0x36')](_0x3ccb6b[_0xbc2f('0x41')],function(_0x1195d0){var _0x19a90d={};_0x19a90d[_0x1195d0]={'$like':'%'+_0x329a6a[_0xbc2f('0x3d')][_0xbc2f('0x49')]+'%'};return _0x19a90d;})});}_0x3ccb6b=_['merge']({},_0x3ccb6b,_0x329a6a['options']);return _0x2bbd92[_0xbc2f('0x92')](_0x3ccb6b);}})[_0xbc2f('0x2d')](function(_0x26632f){if(_0x26632f){_0x57383d=_0x26632f[_0xbc2f('0x43')];if(!_0x329a6a[_0xbc2f('0x3d')][_0xbc2f('0x44')](_0xbc2f('0x45'))){_0x3ccb6b['limit']=qs[_0xbc2f('0x25')](_0x329a6a[_0xbc2f('0x3d')][_0xbc2f('0x25')]);_0x3ccb6b[_0xbc2f('0x23')]=qs[_0xbc2f('0x23')](_0x329a6a[_0xbc2f('0x3d')][_0xbc2f('0x23')]);}return _0x2bbd92['getAgents'](_0x3ccb6b);}})['then'](function(_0x1ea0e9){if(_0x1ea0e9){return _0x1ea0e9?{'count':_0x57383d,'rows':_0x1ea0e9}:null;}})['then'](respondWithResult(_0x22256b,null))['catch'](handleError(_0x22256b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 7437492..aad4bdb 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 _0x7eb2=['exports','../../mysqldb','WhatsappQueue','update','remove','emit','hook'];(function(_0x152ad2,_0x133e46){var _0x2aa4e5=function(_0x21018c){while(--_0x21018c){_0x152ad2['push'](_0x152ad2['shift']());}};_0x2aa4e5(++_0x133e46);}(_0x7eb2,0xe1));var _0x27eb=function(_0x2d5728,_0x22afc5){_0x2d5728=_0x2d5728-0x0;var _0x1ed907=_0x7eb2[_0x2d5728];return _0x1ed907;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x27eb('0x0'))['db'][_0x27eb('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x27eb('0x2'),'afterDestroy':_0x27eb('0x3')};function emitEvent(_0x593ac9){return function(_0x414be8,_0x35caa7,_0x44efc2){WhatsappQueueEvents[_0x27eb('0x4')](_0x593ac9+':'+_0x414be8['id'],_0x414be8);WhatsappQueueEvents[_0x27eb('0x4')](_0x593ac9,_0x414be8);_0x44efc2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x27eb('0x5')](e,emitEvent(event));}}module[_0x27eb('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x3685=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3685,0x125));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x5368('0x0'));var WhatsappQueue=require(_0x5368('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5368('0x2')](0x0);var events={'afterCreate':_0x5368('0x3'),'afterUpdate':_0x5368('0x4'),'afterDestroy':_0x5368('0x5')};function emitEvent(_0x4fb198){return function(_0x20d978,_0x3b0e76,_0x50b498){WhatsappQueueEvents['emit'](_0x4fb198+':'+_0x20d978['id'],_0x20d978);WhatsappQueueEvents[_0x5368('0x6')](_0x4fb198,_0x20d978);_0x50b498(null);};}for(var e in events){if(events[_0x5368('0x7')](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 ddcaf92..a97f9c2 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 _0x8c9c=['moment','bluebird','request-promise','path','../../config/environment','define','WhatsappQueue','lodash','util','../../config/logger','api'];(function(_0x245978,_0x27232c){var _0x23eeae=function(_0xcbc655){while(--_0xcbc655){_0x245978['push'](_0x245978['shift']());}};_0x23eeae(++_0x27232c);}(_0x8c9c,0x1b4));var _0xc8c9=function(_0x393c55,_0x43b06c){_0x393c55=_0x393c55-0x0;var _0x4085fc=_0x8c9c[_0x393c55];return _0x4085fc;};'use strict';var _=require(_0xc8c9('0x0'));var util=require(_0xc8c9('0x1'));var logger=require(_0xc8c9('0x2'))(_0xc8c9('0x3'));var moment=require(_0xc8c9('0x4'));var BPromise=require(_0xc8c9('0x5'));var rp=require(_0xc8c9('0x6'));var fs=require('fs');var path=require(_0xc8c9('0x7'));var rimraf=require('rimraf');var config=require(_0xc8c9('0x8'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x436a79,_0x35b1b6){return _0x436a79[_0xc8c9('0x9')](_0xc8c9('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x174b=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x174b,0x1d1));var _0xb174=function(_0x14e43b,_0x4e69ed){_0x14e43b=_0x14e43b-0x0;var _0x45c5ef=_0x174b[_0x14e43b];return _0x45c5ef;};'use strict';var _=require(_0xb174('0x0'));var util=require(_0xb174('0x1'));var logger=require(_0xb174('0x2'))(_0xb174('0x3'));var moment=require(_0xb174('0x4'));var BPromise=require('bluebird');var rp=require(_0xb174('0x5'));var fs=require('fs');var path=require(_0xb174('0x6'));var rimraf=require(_0xb174('0x7'));var config=require(_0xb174('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xb174('0x9')]=function(_0x4311b5,_0x472955){return _0x4311b5[_0xb174('0xa')](_0xb174('0xb'),attributes,{'tableName':_0xb174('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 3e5e132..9f870ff 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 _0x3e12=['find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappQueue,\x20%s,\x20%s','result','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','include','map','model','catch','ShowWhatsappQueue'];(function(_0xbdd476,_0x16f8ad){var _0x5d82e2=function(_0x5a68c7){while(--_0x5a68c7){_0xbdd476['push'](_0xbdd476['shift']());}};_0x5d82e2(++_0x16f8ad);}(_0x3e12,0x160));var _0x23e1=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x3e12[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x23e1('0x0'));var util=require('util');var moment=require(_0x23e1('0x1'));var BPromise=require(_0x23e1('0x2'));var rs=require(_0x23e1('0x3'));var fs=require('fs');var Redis=require(_0x23e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x23e1('0x5'));var logger=require('../../config/logger')(_0x23e1('0x6'));var config=require(_0x23e1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x23e1('0x8')][_0x23e1('0x9')]({'port':0x232a});config[_0x23e1('0xa')]=_[_0x23e1('0xb')](config[_0x23e1('0xa')],{'host':_0x23e1('0xc'),'port':0x18eb});var socket=require(_0x23e1('0xd'))(new Redis(config['redis']));require(_0x23e1('0xe'))[_0x23e1('0xf')](socket);function respondWithRpcPromise(_0x70cf79,_0x2f8333,_0x1cd34e){return new BPromise(function(_0x635917,_0x219f25){return client[_0x23e1('0x10')](_0x70cf79,_0x1cd34e)[_0x23e1('0x11')](function(_0x4f2293){logger[_0x23e1('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x2f8333,'request\x20sent');logger[_0x23e1('0x13')](_0x23e1('0x14'),_0x2f8333,_0x23e1('0x15'),JSON[_0x23e1('0x16')](_0x4f2293));if(_0x4f2293[_0x23e1('0x17')]){if(_0x4f2293[_0x23e1('0x17')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2f8333,_0x4f2293['error'][_0x23e1('0x18')]);return _0x219f25(_0x4f2293[_0x23e1('0x17')]['message']);}logger[_0x23e1('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x2f8333,_0x4f2293[_0x23e1('0x17')][_0x23e1('0x18')]);return _0x635917(_0x4f2293[_0x23e1('0x17')][_0x23e1('0x18')]);}else{logger['info'](_0x23e1('0x19'),_0x2f8333,_0x23e1('0x15'));_0x635917(_0x4f2293[_0x23e1('0x1a')][_0x23e1('0x18')]);}})['catch'](function(_0x58b5db){logger[_0x23e1('0x17')](_0x23e1('0x19'),_0x2f8333,_0x58b5db);_0x219f25(_0x58b5db);});});}exports[_0x23e1('0x1b')]=function(_0x22c491){var _0x5b328f=this;return new Promise(function(_0x485360,_0x5272fd){return db[_0x23e1('0x1c')]['findAll']({'raw':_0x22c491[_0x23e1('0x1d')]?_0x22c491[_0x23e1('0x1d')][_0x23e1('0x1e')]===undefined?!![]:![]:!![],'where':_0x22c491[_0x23e1('0x1d')]?_0x22c491['options'][_0x23e1('0x1f')]||null:null,'attributes':_0x22c491[_0x23e1('0x1d')]?_0x22c491[_0x23e1('0x1d')][_0x23e1('0x20')]||null:null,'limit':_0x22c491[_0x23e1('0x1d')]?_0x22c491['options']['limit']||null:null,'include':_0x22c491[_0x23e1('0x1d')]?_0x22c491[_0x23e1('0x1d')][_0x23e1('0x21')]?_[_0x23e1('0x22')](_0x22c491[_0x23e1('0x1d')][_0x23e1('0x21')],function(_0x6e50ae){return{'model':db[_0x6e50ae[_0x23e1('0x23')]],'as':_0x6e50ae['as'],'attributes':_0x6e50ae[_0x23e1('0x20')],'include':_0x6e50ae[_0x23e1('0x21')]?_['map'](_0x6e50ae[_0x23e1('0x21')],function(_0x103c34){return{'model':db[_0x103c34[_0x23e1('0x23')]],'as':_0x103c34['as'],'attributes':_0x103c34[_0x23e1('0x20')],'include':_0x103c34[_0x23e1('0x21')]?_[_0x23e1('0x22')](_0x103c34['include'],function(_0x18229e){return{'model':db[_0x18229e[_0x23e1('0x23')]],'as':_0x18229e['as'],'attributes':_0x18229e[_0x23e1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x23e1('0x11')](function(_0x780f54){logger[_0x23e1('0x12')](_0x23e1('0x1b'),_0x22c491);logger[_0x23e1('0x13')](_0x23e1('0x1b'),_0x22c491,JSON[_0x23e1('0x16')](_0x780f54));_0x485360(_0x780f54);})[_0x23e1('0x24')](function(_0xdcf556){logger['error']('GetWhatsappQueue',_0xdcf556[_0x23e1('0x18')],_0x22c491);_0x5272fd(_0x5b328f[_0x23e1('0x17')](0x1f4,_0xdcf556[_0x23e1('0x18')]));});});};exports[_0x23e1('0x25')]=function(_0x4d1633){var _0x497503=this;return new Promise(function(_0x3e3999,_0x217c8e){return db[_0x23e1('0x1c')][_0x23e1('0x26')]({'raw':_0x4d1633['options']?_0x4d1633[_0x23e1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4d1633[_0x23e1('0x1d')]?_0x4d1633['options'][_0x23e1('0x1f')]||null:null,'attributes':_0x4d1633[_0x23e1('0x1d')]?_0x4d1633[_0x23e1('0x1d')][_0x23e1('0x20')]||null:null,'include':_0x4d1633['options']?_0x4d1633['options']['include']?_[_0x23e1('0x22')](_0x4d1633[_0x23e1('0x1d')][_0x23e1('0x21')],function(_0x32356a){return{'model':db[_0x32356a['model']],'as':_0x32356a['as'],'attributes':_0x32356a['attributes'],'include':_0x32356a[_0x23e1('0x21')]?_['map'](_0x32356a[_0x23e1('0x21')],function(_0x1f637f){return{'model':db[_0x1f637f['model']],'as':_0x1f637f['as'],'attributes':_0x1f637f[_0x23e1('0x20')],'include':_0x1f637f[_0x23e1('0x21')]?_[_0x23e1('0x22')](_0x1f637f[_0x23e1('0x21')],function(_0x3bca94){return{'model':db[_0x3bca94[_0x23e1('0x23')]],'as':_0x3bca94['as'],'attributes':_0x3bca94['attributes']};}):[]};}):[]};}):[]:[]})[_0x23e1('0x11')](function(_0x1b80af){logger[_0x23e1('0x12')]('ShowWhatsappQueue',_0x4d1633);logger[_0x23e1('0x13')](_0x23e1('0x25'),_0x4d1633,JSON[_0x23e1('0x16')](_0x1b80af));_0x3e3999(_0x1b80af);})[_0x23e1('0x24')](function(_0x3fd45e){logger[_0x23e1('0x17')](_0x23e1('0x25'),_0x3fd45e['message'],_0x4d1633);_0x217c8e(_0x497503[_0x23e1('0x17')](0x1f4,_0x3fd45e[_0x23e1('0x18')]));});});}; \ No newline at end of file +var _0x770a=['info','request\x20sent','debug','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','include','map','model','then','stringify','ShowWhatsappQueue','find','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x2ac992,_0x37c877){var _0x223c9d=function(_0x2d4865){while(--_0x2d4865){_0x2ac992['push'](_0x2ac992['shift']());}};_0x223c9d(++_0x37c877);}(_0x770a,0x13e));var _0xa770=function(_0x2dca22,_0x31877a){_0x2dca22=_0x2dca22-0x0;var _0x5b8659=_0x770a[_0x2dca22];return _0x5b8659;};'use strict';var _=require(_0xa770('0x0'));var util=require(_0xa770('0x1'));var moment=require('moment');var BPromise=require(_0xa770('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa770('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa770('0x4'));var logger=require(_0xa770('0x5'))(_0xa770('0x6'));var config=require(_0xa770('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa770('0x8')]['http']({'port':0x232a});config[_0xa770('0x9')]=_[_0xa770('0xa')](config[_0xa770('0x9')],{'host':_0xa770('0xb'),'port':0x18eb});var socket=require(_0xa770('0xc'))(new Redis(config[_0xa770('0x9')]));require('./whatsappQueue.socket')[_0xa770('0xd')](socket);function respondWithRpcPromise(_0x137efa,_0x5b8ca7,_0x4f1902){return new BPromise(function(_0x58a53b,_0x180986){return client[_0xa770('0xe')](_0x137efa,_0x4f1902)['then'](function(_0x2e447d){logger[_0xa770('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x5b8ca7,_0xa770('0x10'));logger[_0xa770('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5b8ca7,_0xa770('0x10'),JSON['stringify'](_0x2e447d));if(_0x2e447d[_0xa770('0x12')]){if(_0x2e447d['error'][_0xa770('0x13')]===0x1f4){logger[_0xa770('0x12')](_0xa770('0x14'),_0x5b8ca7,_0x2e447d[_0xa770('0x12')]['message']);return _0x180986(_0x2e447d[_0xa770('0x12')][_0xa770('0x15')]);}logger[_0xa770('0x12')](_0xa770('0x14'),_0x5b8ca7,_0x2e447d[_0xa770('0x12')][_0xa770('0x15')]);return _0x58a53b(_0x2e447d[_0xa770('0x12')][_0xa770('0x15')]);}else{logger[_0xa770('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x5b8ca7,_0xa770('0x10'));_0x58a53b(_0x2e447d[_0xa770('0x16')][_0xa770('0x15')]);}})[_0xa770('0x17')](function(_0x559ec1){logger[_0xa770('0x12')](_0xa770('0x14'),_0x5b8ca7,_0x559ec1);_0x180986(_0x559ec1);});});}exports[_0xa770('0x18')]=function(_0x1eca78){var _0x430aa0=this;return new Promise(function(_0x543a75,_0x3f4ead){return db['WhatsappQueue'][_0xa770('0x19')]({'raw':_0x1eca78[_0xa770('0x1a')]?_0x1eca78[_0xa770('0x1a')][_0xa770('0x1b')]===undefined?!![]:![]:!![],'where':_0x1eca78['options']?_0x1eca78[_0xa770('0x1a')][_0xa770('0x1c')]||null:null,'attributes':_0x1eca78['options']?_0x1eca78['options'][_0xa770('0x1d')]||null:null,'limit':_0x1eca78[_0xa770('0x1a')]?_0x1eca78['options']['limit']||null:null,'include':_0x1eca78[_0xa770('0x1a')]?_0x1eca78['options'][_0xa770('0x1e')]?_[_0xa770('0x1f')](_0x1eca78[_0xa770('0x1a')][_0xa770('0x1e')],function(_0x39215a){return{'model':db[_0x39215a[_0xa770('0x20')]],'as':_0x39215a['as'],'attributes':_0x39215a[_0xa770('0x1d')],'include':_0x39215a[_0xa770('0x1e')]?_[_0xa770('0x1f')](_0x39215a[_0xa770('0x1e')],function(_0x370822){return{'model':db[_0x370822[_0xa770('0x20')]],'as':_0x370822['as'],'attributes':_0x370822[_0xa770('0x1d')],'include':_0x370822['include']?_[_0xa770('0x1f')](_0x370822[_0xa770('0x1e')],function(_0x2131f8){return{'model':db[_0x2131f8[_0xa770('0x20')]],'as':_0x2131f8['as'],'attributes':_0x2131f8[_0xa770('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa770('0x21')](function(_0x9454a1){logger[_0xa770('0xf')](_0xa770('0x18'),_0x1eca78);logger[_0xa770('0x11')]('GetWhatsappQueue',_0x1eca78,JSON[_0xa770('0x22')](_0x9454a1));_0x543a75(_0x9454a1);})[_0xa770('0x17')](function(_0x25ac60){logger[_0xa770('0x12')]('GetWhatsappQueue',_0x25ac60[_0xa770('0x15')],_0x1eca78);_0x3f4ead(_0x430aa0[_0xa770('0x12')](0x1f4,_0x25ac60['message']));});});};exports[_0xa770('0x23')]=function(_0x3cd3b3){var _0x47bb5d=this;return new Promise(function(_0x18cf0d,_0x19e8bc){return db['WhatsappQueue'][_0xa770('0x24')]({'raw':_0x3cd3b3[_0xa770('0x1a')]?_0x3cd3b3[_0xa770('0x1a')][_0xa770('0x1b')]===undefined?!![]:![]:!![],'where':_0x3cd3b3[_0xa770('0x1a')]?_0x3cd3b3['options'][_0xa770('0x1c')]||null:null,'attributes':_0x3cd3b3['options']?_0x3cd3b3['options']['attributes']||null:null,'include':_0x3cd3b3['options']?_0x3cd3b3[_0xa770('0x1a')]['include']?_['map'](_0x3cd3b3['options'][_0xa770('0x1e')],function(_0x2e7bb7){return{'model':db[_0x2e7bb7[_0xa770('0x20')]],'as':_0x2e7bb7['as'],'attributes':_0x2e7bb7[_0xa770('0x1d')],'include':_0x2e7bb7[_0xa770('0x1e')]?_[_0xa770('0x1f')](_0x2e7bb7[_0xa770('0x1e')],function(_0x520224){return{'model':db[_0x520224[_0xa770('0x20')]],'as':_0x520224['as'],'attributes':_0x520224[_0xa770('0x1d')],'include':_0x520224[_0xa770('0x1e')]?_['map'](_0x520224[_0xa770('0x1e')],function(_0x516496){return{'model':db[_0x516496[_0xa770('0x20')]],'as':_0x516496['as'],'attributes':_0x516496[_0xa770('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12fd21){logger['info'](_0xa770('0x23'),_0x3cd3b3);logger[_0xa770('0x11')](_0xa770('0x23'),_0x3cd3b3,JSON[_0xa770('0x22')](_0x12fd21));_0x18cf0d(_0x12fd21);})[_0xa770('0x17')](function(_0x3a3d9c){logger[_0xa770('0x12')]('ShowWhatsappQueue',_0x3a3d9c[_0xa770('0x15')],_0x3cd3b3);_0x19e8bc(_0x47bb5d[_0xa770('0x12')](0x1f4,_0x3a3d9c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index accdfb9..dac0d55 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 _0x0d2f=['save','update','emit','removeListener','register','whatsappQueue:','./whatsappQueue.events'];(function(_0x540457,_0x5079f4){var _0x14ebef=function(_0x4893ca){while(--_0x4893ca){_0x540457['push'](_0x540457['shift']());}};_0x14ebef(++_0x5079f4);}(_0x0d2f,0x68));var _0xf0d2=function(_0x11e888,_0x494bd9){_0x11e888=_0x11e888-0x0;var _0x2fe4dd=_0x0d2f[_0x11e888];return _0x2fe4dd;};'use strict';var WhatsappQueueEvents=require(_0xf0d2('0x0'));var events=[_0xf0d2('0x1'),'remove',_0xf0d2('0x2')];function createListener(_0x5439d6,_0x1725d3){return function(_0x254eaa){_0x1725d3[_0xf0d2('0x3')](_0x5439d6,_0x254eaa);};}function removeListener(_0x2a616a,_0x276dd9){return function(){WhatsappQueueEvents[_0xf0d2('0x4')](_0x2a616a,_0x276dd9);};}exports[_0xf0d2('0x5')]=function(_0x5b2d40){for(var _0x7b6470=0x0,_0x55ca13=events['length'];_0x7b6470<_0x55ca13;_0x7b6470++){var _0x4ade0c=events[_0x7b6470];var _0x2080f3=createListener(_0xf0d2('0x6')+_0x4ade0c,_0x5b2d40);WhatsappQueueEvents['on'](_0x4ade0c,_0x2080f3);}}; \ No newline at end of file +var _0x2796=['removeListener','save','update','emit'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0x2796,0xa1));var _0x6279=function(_0x637f82,_0x1e0360){_0x637f82=_0x637f82-0x0;var _0x5afa62=_0x2796[_0x637f82];return _0x5afa62;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6279('0x0'),'remove',_0x6279('0x1')];function createListener(_0x10c592,_0x249e72){return function(_0x23acc8){_0x249e72[_0x6279('0x2')](_0x10c592,_0x23acc8);};}function removeListener(_0x1faefe,_0x5d1358){return function(){WhatsappQueueEvents[_0x6279('0x3')](_0x1faefe,_0x5d1358);};}exports['register']=function(_0x42ed44){for(var _0x58b102=0x0,_0x5bf202=events['length'];_0x58b102<_0x5bf202;_0x58b102++){var _0x4d519f=events[_0x58b102];var _0x930861=createListener('whatsappQueue:'+_0x4d519f,_0x42ed44);WhatsappQueueEvents['on'](_0x4d519f,_0x930861);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 6ee510d..44ee249 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 _0x49d8=['../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4803ed,_0x26840d){var _0x1de89a=function(_0x113bed){while(--_0x113bed){_0x4803ed['push'](_0x4803ed['shift']());}};_0x1de89a(++_0x26840d);}(_0x49d8,0x115));var _0x849d=function(_0x445c6d,_0x894b1e){_0x445c6d=_0x445c6d-0x0;var _0x442ef2=_0x49d8[_0x445c6d];return _0x442ef2;};'use strict';var multer=require(_0x849d('0x0'));var util=require(_0x849d('0x1'));var path=require('path');var timeout=require(_0x849d('0x2'));var express=require(_0x849d('0x3'));var router=express[_0x849d('0x4')]();var fs_extra=require(_0x849d('0x5'));var auth=require(_0x849d('0x6'));var interaction=require(_0x849d('0x7'));var config=require(_0x849d('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x849d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x849d('0x9')]('/describe',auth[_0x849d('0xa')](),controller[_0x849d('0xb')]);router[_0x849d('0x9')](_0x849d('0xc'),auth[_0x849d('0xa')](),controller[_0x849d('0xd')]);router[_0x849d('0xe')]('/',auth['isAuthenticated'](),controller[_0x849d('0xf')]);router[_0x849d('0x10')]('/:id',auth[_0x849d('0xa')](),controller['update']);router['delete']('/:id',auth[_0x849d('0xa')](),controller[_0x849d('0x11')]);module[_0x849d('0x12')]=router; \ No newline at end of file +var _0x9cc1=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','post','create','put','delete','destroy'];(function(_0x3b53d3,_0x2b744d){var _0x5cc755=function(_0xb37174){while(--_0xb37174){_0x3b53d3['push'](_0x3b53d3['shift']());}};_0x5cc755(++_0x2b744d);}(_0x9cc1,0xf1));var _0x19cc=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x9cc1[_0x1ae4a9];return _0x54d0b0;};'use strict';var multer=require(_0x19cc('0x0'));var util=require('util');var path=require(_0x19cc('0x1'));var timeout=require('connect-timeout');var express=require(_0x19cc('0x2'));var router=express[_0x19cc('0x3')]();var fs_extra=require(_0x19cc('0x4'));var auth=require(_0x19cc('0x5'));var interaction=require(_0x19cc('0x6'));var config=require(_0x19cc('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x19cc('0x8')]('/',auth['isAuthenticated'](),controller[_0x19cc('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x19cc('0xa')]);router[_0x19cc('0x8')](_0x19cc('0xb'),auth[_0x19cc('0xc')](),controller[_0x19cc('0xd')]);router[_0x19cc('0xe')]('/',auth[_0x19cc('0xc')](),controller[_0x19cc('0xf')]);router[_0x19cc('0x10')]('/:id',auth[_0x19cc('0xc')](),controller['update']);router[_0x19cc('0x11')]('/:id',auth[_0x19cc('0xc')](),controller[_0x19cc('0x12')]);module[_0x19cc('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 6e81117..3ce8f6e 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(_0x5f2ee0,_0x5dadb5){var _0x23bab8=function(_0x37515e){while(--_0x37515e){_0x5f2ee0['push'](_0x5f2ee0['shift']());}};_0x23bab8(++_0x5dadb5);}(_0x7a54,0x106));var _0x47a5=function(_0x214903,_0x222a23){_0x214903=_0x214903-0x0;var _0x55f518=_0x7a54[_0x214903];return _0x55f518;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x45b706,_0x488cee){var _0x31d799=function(_0x1f2d7d){while(--_0x1f2d7d){_0x45b706['push'](_0x45b706['shift']());}};_0x31d799(++_0x488cee);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index e394b59..cf19f5c 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 _0x236c=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','WhatsappQueueReport','fieldName','key','query','filters','intersection'];(function(_0x4b48fe,_0x516251){var _0x1eee2d=function(_0x205530){while(--_0x205530){_0x4b48fe['push'](_0x4b48fe['shift']());}};_0x1eee2d(++_0x516251);}(_0x236c,0x155));var _0xc236=function(_0x1e26ab,_0x4386e0){_0x1e26ab=_0x1e26ab-0x0;var _0x5b3ebc=_0x236c[_0x1e26ab];return _0x5b3ebc;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];function respondWithStatusCode(_0x5ee3a5,_0x5b9638){_0x5b9638=_0x5b9638||0xcc;return function(_0x5bce83){if(_0x5bce83){return _0x5ee3a5['sendStatus'](_0x5b9638);}return _0x5ee3a5[_0xc236('0x18')](_0x5b9638)[_0xc236('0x19')]();};}function respondWithResult(_0x2184c9,_0x71bce2){_0x71bce2=_0x71bce2||0xc8;return function(_0x5052db){if(_0x5052db){return _0x2184c9[_0xc236('0x18')](_0x71bce2)['json'](_0x5052db);}};}function respondWithFilteredResult(_0x5221bf,_0x9a65e8){return function(_0x32f2fd){if(_0x32f2fd){var _0x443a46=typeof _0x9a65e8[_0xc236('0x1a')]===_0xc236('0x1b')&&typeof _0x9a65e8['limit']==='undefined';var _0x57355b=_0x32f2fd[_0xc236('0x1c')];var _0x76f45=_0x443a46?0x0:_0x9a65e8[_0xc236('0x1a')];var _0x541a20=_0x443a46?_0x32f2fd[_0xc236('0x1c')]:_0x9a65e8['offset']+_0x9a65e8['limit'];var _0x1eafba;if(_0x541a20>=_0x57355b){_0x541a20=_0x57355b;_0x1eafba=0xc8;}else{_0x1eafba=0xce;}_0x5221bf[_0xc236('0x18')](_0x1eafba);return _0x5221bf[_0xc236('0x1d')](_0xc236('0x1e'),_0x76f45+'-'+_0x541a20+'/'+_0x57355b)[_0xc236('0x1f')](_0x32f2fd);}return null;};}function patchUpdates(_0x27c6ab){return function(_0x3f0e2f){try{jsonpatch[_0xc236('0x20')](_0x3f0e2f,_0x27c6ab,!![]);}catch(_0x54ffac){return BPromise[_0xc236('0x21')](_0x54ffac);}return _0x3f0e2f[_0xc236('0x22')]();};}function saveUpdates(_0x4a9006,_0x208c3f){return function(_0x34d73a){if(_0x34d73a){return _0x34d73a[_0xc236('0x23')](_0x4a9006)[_0xc236('0x24')](function(_0x27afba){return _0x27afba;});}return null;};}function removeEntity(_0x21fab8,_0x3a315b){return function(_0xf921e6){if(_0xf921e6){return _0xf921e6[_0xc236('0x25')]()[_0xc236('0x24')](function(){_0x21fab8[_0xc236('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308cd6,_0x21d78f){return function(_0x356042){if(!_0x356042){_0x308cd6[_0xc236('0x26')](0x194);}return _0x356042;};}function handleError(_0x561da1,_0x42f248){_0x42f248=_0x42f248||0x1f4;return function(_0x5da4b2){logger['error'](_0x5da4b2[_0xc236('0x27')]);if(_0x5da4b2['name']){delete _0x5da4b2[_0xc236('0x28')];}_0x561da1['status'](_0x42f248)[_0xc236('0x29')](_0x5da4b2);};}exports['index']=function(_0x423842,_0x1d144b){var _0x4f5175={},_0x5a61b5={},_0x265c8d={'count':0x0,'rows':[]};var _0x1fd31d=_[_0xc236('0x2a')](db[_0xc236('0x2b')]['rawAttributes'],function(_0x4e3262){return{'name':_0x4e3262[_0xc236('0x2c')],'type':_0x4e3262['type'][_0xc236('0x2d')]};});_0x5a61b5['model']=_[_0xc236('0x2a')](_0x1fd31d,_0xc236('0x28'));_0x5a61b5['query']=_['keys'](_0x423842[_0xc236('0x2e')]);_0x5a61b5[_0xc236('0x2f')]=_[_0xc236('0x30')](_0x5a61b5[_0xc236('0x31')],_0x5a61b5[_0xc236('0x2e')]);_0x4f5175[_0xc236('0x32')]=_[_0xc236('0x30')](_0x5a61b5[_0xc236('0x31')],qs[_0xc236('0x33')](_0x423842['query']['fields']));_0x4f5175['attributes']=_0x4f5175[_0xc236('0x32')][_0xc236('0x34')]?_0x4f5175[_0xc236('0x32')]:_0x5a61b5[_0xc236('0x31')];if(!_0x423842[_0xc236('0x2e')][_0xc236('0x35')](_0xc236('0x36'))){_0x4f5175['limit']=qs[_0xc236('0x37')](_0x423842[_0xc236('0x2e')][_0xc236('0x37')]);_0x4f5175['offset']=qs[_0xc236('0x1a')](_0x423842[_0xc236('0x2e')][_0xc236('0x1a')]);}_0x4f5175[_0xc236('0x38')]=qs['sort'](_0x423842[_0xc236('0x2e')][_0xc236('0x39')]);_0x4f5175[_0xc236('0x3a')]=qs[_0xc236('0x2f')](_[_0xc236('0x3b')](_0x423842[_0xc236('0x2e')],_0x5a61b5[_0xc236('0x2f')]),_0x1fd31d);if(_0x423842[_0xc236('0x2e')][_0xc236('0x3c')]){_0x4f5175[_0xc236('0x3a')]=_[_0xc236('0x3d')](_0x4f5175[_0xc236('0x3a')],{'$or':_[_0xc236('0x2a')](_0x1fd31d,function(_0x237193){if(_0x237193[_0xc236('0x3e')]!==_0xc236('0x3f')){var _0x46db5a={};_0x46db5a[_0x237193['name']]={'$like':'%'+_0x423842['query']['filter']+'%'};return _0x46db5a;}})});}_0x4f5175=_['merge']({},_0x4f5175,_0x423842[_0xc236('0x40')]);var _0x5c4739={'where':_0x4f5175[_0xc236('0x3a')]};return db[_0xc236('0x2b')][_0xc236('0x1c')](_0x5c4739)[_0xc236('0x24')](function(_0xdf7897){_0x265c8d[_0xc236('0x1c')]=_0xdf7897;if(_0x423842[_0xc236('0x2e')][_0xc236('0x41')]){_0x4f5175[_0xc236('0x42')]=[{'all':!![]}];}return db[_0xc236('0x2b')][_0xc236('0x43')](_0x4f5175);})[_0xc236('0x24')](function(_0x3b2f2f){_0x265c8d[_0xc236('0x44')]=_0x3b2f2f;return _0x265c8d;})[_0xc236('0x24')](respondWithFilteredResult(_0x1d144b,_0x4f5175))['catch'](handleError(_0x1d144b,null));};exports[_0xc236('0x45')]=function(_0x24b851,_0x506ba0){var _0xb90a83={'raw':!![],'where':{'id':_0x24b851[_0xc236('0x46')]['id']}},_0x5b0bc5={};_0x5b0bc5['model']=_[_0xc236('0x47')](db[_0xc236('0x2b')][_0xc236('0x48')]);_0x5b0bc5['query']=_[_0xc236('0x47')](_0x24b851[_0xc236('0x2e')]);_0x5b0bc5[_0xc236('0x2f')]=_['intersection'](_0x5b0bc5[_0xc236('0x31')],_0x5b0bc5[_0xc236('0x2e')]);_0xb90a83[_0xc236('0x32')]=_[_0xc236('0x30')](_0x5b0bc5[_0xc236('0x31')],qs[_0xc236('0x33')](_0x24b851['query'][_0xc236('0x33')]));_0xb90a83['attributes']=_0xb90a83[_0xc236('0x32')][_0xc236('0x34')]?_0xb90a83[_0xc236('0x32')]:_0x5b0bc5[_0xc236('0x31')];if(_0x24b851[_0xc236('0x2e')][_0xc236('0x41')]){_0xb90a83[_0xc236('0x42')]=[{'all':!![]}];}_0xb90a83=_['merge']({},_0xb90a83,_0x24b851[_0xc236('0x40')]);return db['WhatsappQueueReport'][_0xc236('0x49')](_0xb90a83)[_0xc236('0x24')](handleEntityNotFound(_0x506ba0,null))['then'](respondWithResult(_0x506ba0,null))[_0xc236('0x4a')](handleError(_0x506ba0,null));};exports[_0xc236('0x4b')]=function(_0x3c1c5c,_0x161890){return db[_0xc236('0x2b')][_0xc236('0x4b')](_0x3c1c5c[_0xc236('0x4c')],{})['then'](respondWithResult(_0x161890,0xc9))['catch'](handleError(_0x161890,null));};exports[_0xc236('0x23')]=function(_0x2afed2,_0x510f7f){if(_0x2afed2[_0xc236('0x4c')]['id']){delete _0x2afed2[_0xc236('0x4c')]['id'];}return db[_0xc236('0x2b')][_0xc236('0x49')]({'where':{'id':_0x2afed2[_0xc236('0x46')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x510f7f,null))[_0xc236('0x24')](saveUpdates(_0x2afed2[_0xc236('0x4c')],null))[_0xc236('0x24')](respondWithResult(_0x510f7f,null))['catch'](handleError(_0x510f7f,null));};exports[_0xc236('0x25')]=function(_0x307663,_0x41b7d5){return db[_0xc236('0x2b')][_0xc236('0x49')]({'where':{'id':_0x307663[_0xc236('0x46')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x41b7d5,null))['then'](removeEntity(_0x41b7d5,null))[_0xc236('0x4a')](handleError(_0x41b7d5,null));};exports[_0xc236('0x4d')]=function(_0x17c86b,_0x16ff63){return db['WhatsappQueueReport'][_0xc236('0x4d')]()[_0xc236('0x24')](respondWithResult(_0x16ff63,null))[_0xc236('0x4a')](handleError(_0x16ff63,null));}; \ No newline at end of file +var _0xb7e7=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','name','map','WhatsappQueueReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','destroy','describe','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce'];(function(_0x2eef22,_0x16e251){var _0x435cc0=function(_0x2f4bc3){while(--_0x2f4bc3){_0x2eef22['push'](_0x2eef22['shift']());}};_0x435cc0(++_0x16e251);}(_0xb7e7,0x121));var _0x7b7e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xb7e7[_0x424a9a];return _0xa7831c;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=typeof _0x3d2fb2[_0x7b7e('0x1d')]===_0x7b7e('0x1e')&&typeof _0x3d2fb2[_0x7b7e('0x1f')]===_0x7b7e('0x1e');var _0x2cc400=_0x5703fd[_0x7b7e('0x20')];var _0x242368=_0x51baf6?0x0:_0x3d2fb2[_0x7b7e('0x1d')];var _0x2acb8c=_0x51baf6?_0x5703fd[_0x7b7e('0x20')]:_0x3d2fb2[_0x7b7e('0x1d')]+_0x3d2fb2[_0x7b7e('0x1f')];var _0x448980;if(_0x2acb8c>=_0x2cc400){_0x2acb8c=_0x2cc400;_0x448980=0xc8;}else{_0x448980=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x448980);return _0x457ec5[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x242368+'-'+_0x2acb8c+'/'+_0x2cc400)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x49eddb){return function(_0x69262b){try{jsonpatch[_0x7b7e('0x23')](_0x69262b,_0x49eddb,!![]);}catch(_0x24718c){return BPromise['reject'](_0x24718c);}return _0x69262b[_0x7b7e('0x24')]();};}function saveUpdates(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x25')](_0xbf0cb3)[_0x7b7e('0x26')](function(_0x28bf43){return _0x28bf43;});}return null;};}function removeEntity(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(_0x5d6215){return _0x5d6215['destroy']()[_0x7b7e('0x26')](function(){_0x10a66a[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x483c6f,_0x51d3b1){return function(_0x5dadbb){if(!_0x5dadbb){_0x483c6f[_0x7b7e('0x19')](0x194);}return _0x5dadbb;};}function handleError(_0x3c8192,_0x16a3c7){_0x16a3c7=_0x16a3c7||0x1f4;return function(_0x7aa71){logger[_0x7b7e('0x27')](_0x7aa71['stack']);if(_0x7aa71[_0x7b7e('0x28')]){delete _0x7aa71[_0x7b7e('0x28')];}_0x3c8192['status'](_0x16a3c7)['send'](_0x7aa71);};}exports['index']=function(_0x12ef0b,_0x423832){var _0x503625={},_0x3db8c4={},_0x51d4b5={'count':0x0,'rows':[]};var _0x1b4341=_[_0x7b7e('0x29')](db[_0x7b7e('0x2a')]['rawAttributes'],function(_0x3960b8){return{'name':_0x3960b8[_0x7b7e('0x2b')],'type':_0x3960b8[_0x7b7e('0x2c')][_0x7b7e('0x2d')]};});_0x3db8c4[_0x7b7e('0x2e')]=_['map'](_0x1b4341,_0x7b7e('0x28'));_0x3db8c4['query']=_[_0x7b7e('0x2f')](_0x12ef0b[_0x7b7e('0x30')]);_0x3db8c4[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x3db8c4[_0x7b7e('0x2e')],_0x3db8c4[_0x7b7e('0x30')]);_0x503625[_0x7b7e('0x33')]=_['intersection'](_0x3db8c4['model'],qs[_0x7b7e('0x34')](_0x12ef0b[_0x7b7e('0x30')]['fields']));_0x503625[_0x7b7e('0x33')]=_0x503625[_0x7b7e('0x33')][_0x7b7e('0x35')]?_0x503625['attributes']:_0x3db8c4[_0x7b7e('0x2e')];if(!_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x36')](_0x7b7e('0x37'))){_0x503625[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x1f')]);_0x503625[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x1d')]);}_0x503625[_0x7b7e('0x38')]=qs[_0x7b7e('0x39')](_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x39')]);_0x503625['where']=qs[_0x7b7e('0x31')](_[_0x7b7e('0x3a')](_0x12ef0b[_0x7b7e('0x30')],_0x3db8c4[_0x7b7e('0x31')]),_0x1b4341);if(_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x503625[_0x7b7e('0x3c')]=_[_0x7b7e('0x3d')](_0x503625[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x29')](_0x1b4341,function(_0x5f3de5){if(_0x5f3de5[_0x7b7e('0x2c')]!==_0x7b7e('0x3e')){var _0x213a8c={};_0x213a8c[_0x5f3de5[_0x7b7e('0x28')]]={'$like':'%'+_0x12ef0b['query'][_0x7b7e('0x3b')]+'%'};return _0x213a8c;}})});}_0x503625=_[_0x7b7e('0x3d')]({},_0x503625,_0x12ef0b[_0x7b7e('0x3f')]);var _0x5c58c0={'where':_0x503625['where']};return db[_0x7b7e('0x2a')]['count'](_0x5c58c0)[_0x7b7e('0x26')](function(_0x3b16d7){_0x51d4b5['count']=_0x3b16d7;if(_0x12ef0b[_0x7b7e('0x30')][_0x7b7e('0x40')]){_0x503625[_0x7b7e('0x41')]=[{'all':!![]}];}return db[_0x7b7e('0x2a')][_0x7b7e('0x42')](_0x503625);})[_0x7b7e('0x26')](function(_0xc888e4){_0x51d4b5[_0x7b7e('0x43')]=_0xc888e4;return _0x51d4b5;})[_0x7b7e('0x26')](respondWithFilteredResult(_0x423832,_0x503625))['catch'](handleError(_0x423832,null));};exports['show']=function(_0x25b41e,_0x550ea6){var _0x41c8a6={'raw':!![],'where':{'id':_0x25b41e['params']['id']}},_0x5e8b5d={};_0x5e8b5d[_0x7b7e('0x2e')]=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x5e8b5d[_0x7b7e('0x30')]=_[_0x7b7e('0x2f')](_0x25b41e[_0x7b7e('0x30')]);_0x5e8b5d[_0x7b7e('0x31')]=_['intersection'](_0x5e8b5d[_0x7b7e('0x2e')],_0x5e8b5d[_0x7b7e('0x30')]);_0x41c8a6[_0x7b7e('0x33')]=_[_0x7b7e('0x32')](_0x5e8b5d[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x25b41e['query']['fields']));_0x41c8a6['attributes']=_0x41c8a6[_0x7b7e('0x33')][_0x7b7e('0x35')]?_0x41c8a6[_0x7b7e('0x33')]:_0x5e8b5d[_0x7b7e('0x2e')];if(_0x25b41e[_0x7b7e('0x30')][_0x7b7e('0x40')]){_0x41c8a6['include']=[{'all':!![]}];}_0x41c8a6=_[_0x7b7e('0x3d')]({},_0x41c8a6,_0x25b41e[_0x7b7e('0x3f')]);return db['WhatsappQueueReport']['find'](_0x41c8a6)[_0x7b7e('0x26')](handleEntityNotFound(_0x550ea6,null))[_0x7b7e('0x26')](respondWithResult(_0x550ea6,null))[_0x7b7e('0x44')](handleError(_0x550ea6,null));};exports[_0x7b7e('0x45')]=function(_0x38b4d0,_0xb46776){return db['WhatsappQueueReport'][_0x7b7e('0x45')](_0x38b4d0['body'],{})[_0x7b7e('0x26')](respondWithResult(_0xb46776,0xc9))[_0x7b7e('0x44')](handleError(_0xb46776,null));};exports[_0x7b7e('0x25')]=function(_0x5874e2,_0x58e4e6){if(_0x5874e2[_0x7b7e('0x46')]['id']){delete _0x5874e2[_0x7b7e('0x46')]['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x5874e2[_0x7b7e('0x48')]['id']}})['then'](handleEntityNotFound(_0x58e4e6,null))[_0x7b7e('0x26')](saveUpdates(_0x5874e2[_0x7b7e('0x46')],null))[_0x7b7e('0x26')](respondWithResult(_0x58e4e6,null))[_0x7b7e('0x44')](handleError(_0x58e4e6,null));};exports[_0x7b7e('0x49')]=function(_0x5a9697,_0x1d6d18){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x5a9697[_0x7b7e('0x48')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x1d6d18,null))[_0x7b7e('0x26')](removeEntity(_0x1d6d18,null))[_0x7b7e('0x44')](handleError(_0x1d6d18,null));};exports['describe']=function(_0x433ec7,_0x5d7c89){return db[_0x7b7e('0x2a')][_0x7b7e('0x4a')]()['then'](respondWithResult(_0x5d7c89,null))[_0x7b7e('0x44')](handleError(_0x5d7c89,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index f574f44..5ce1a73 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 _0x78df=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','lodash','util'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x78df,0x152));var _0xf78d=function(_0x57014e,_0x196d39){_0x57014e=_0x57014e-0x0;var _0x2e61c4=_0x78df[_0x57014e];return _0x2e61c4;};'use strict';var _=require(_0xf78d('0x0'));var util=require(_0xf78d('0x1'));var logger=require(_0xf78d('0x2'))('api');var moment=require(_0xf78d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf78d('0x4'));var fs=require('fs');var path=require(_0xf78d('0x5'));var rimraf=require(_0xf78d('0x6'));var config=require(_0xf78d('0x7'));var attributes=require(_0xf78d('0x8'));module['exports']=function(_0x21fdd6,_0x53e1a7){return _0x21fdd6[_0xf78d('0x9')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd2fa=['api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xd2fa,0x1b0));var _0xad2f=function(_0x1856e6,_0x375577){_0x1856e6=_0x1856e6-0x0;var _0x3ae487=_0xd2fa[_0x1856e6];return _0x3ae487;};'use strict';var _=require('lodash');var util=require(_0xad2f('0x0'));var logger=require(_0xad2f('0x1'))(_0xad2f('0x2'));var moment=require(_0xad2f('0x3'));var BPromise=require(_0xad2f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad2f('0x5'));var rimraf=require(_0xad2f('0x6'));var config=require(_0xad2f('0x7'));var attributes=require(_0xad2f('0x8'));module[_0xad2f('0x9')]=function(_0x9be35e,_0x3744bb){return _0x9be35e[_0xad2f('0xa')](_0xad2f('0xb'),attributes,{'tableName':_0xad2f('0xc'),'paranoid':![],'indexes':[{'name':_0xad2f('0xd'),'fields':[_0xad2f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 919b805..80c4bbe 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 _0xd770=['http','request','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','WhatsappQueueReport','create','body','options','raw','catch','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','attributes','limit','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0xd770,0x1e5));var _0x0d77=function(_0xbf19f2,_0x2cbf70){_0xbf19f2=_0xbf19f2-0x0;var _0x121989=_0xd770[_0xbf19f2];return _0x121989;};'use strict';var _=require('lodash');var util=require(_0x0d77('0x0'));var moment=require(_0x0d77('0x1'));var BPromise=require(_0x0d77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d77('0x3'));var db=require(_0x0d77('0x4'))['db'];var utils=require(_0x0d77('0x5'));var logger=require(_0x0d77('0x6'))(_0x0d77('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d77('0x8'));var client=jayson[_0x0d77('0x9')][_0x0d77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x556b15,_0x4ad970,_0x18bb0d){return new BPromise(function(_0x3cede5,_0x60076b){return client[_0x0d77('0xb')](_0x556b15,_0x18bb0d)[_0x0d77('0xc')](function(_0x26668d){logger[_0x0d77('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4ad970,_0x0d77('0xe'));logger['debug'](_0x0d77('0xf'),_0x4ad970,'request\x20sent',JSON[_0x0d77('0x10')](_0x26668d));if(_0x26668d['error']){if(_0x26668d[_0x0d77('0x11')]['code']===0x1f4){logger[_0x0d77('0x11')](_0x0d77('0x12'),_0x4ad970,_0x26668d[_0x0d77('0x11')][_0x0d77('0x13')]);return _0x60076b(_0x26668d[_0x0d77('0x11')][_0x0d77('0x13')]);}logger[_0x0d77('0x11')](_0x0d77('0x12'),_0x4ad970,_0x26668d[_0x0d77('0x11')][_0x0d77('0x13')]);return _0x3cede5(_0x26668d['error']['message']);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4ad970,_0x0d77('0xe'));_0x3cede5(_0x26668d[_0x0d77('0x14')][_0x0d77('0x13')]);}})['catch'](function(_0x1daff4){logger[_0x0d77('0x11')](_0x0d77('0x12'),_0x4ad970,_0x1daff4);_0x60076b(_0x1daff4);});});}exports['CreateWhatsappQueueReport']=function(_0x380282){var _0x12d0f9=this;return new Promise(function(_0x3f12ab,_0x2e0290){return db[_0x0d77('0x15')][_0x0d77('0x16')](_0x380282[_0x0d77('0x17')],{'raw':_0x380282['options']?_0x380282[_0x0d77('0x18')][_0x0d77('0x19')]===undefined?!![]:![]:!![]})[_0x0d77('0xc')](function(_0x52c0c5){logger[_0x0d77('0xd')]('CreateWhatsappQueueReport',_0x380282);logger['debug']('CreateWhatsappQueueReport',_0x380282,JSON['stringify'](_0x52c0c5));_0x3f12ab(_0x52c0c5);})[_0x0d77('0x1a')](function(_0x49c627){logger[_0x0d77('0x11')](_0x0d77('0x1b'),_0x49c627[_0x0d77('0x13')],_0x380282);_0x2e0290(_0x12d0f9['error'](0x1f4,_0x49c627[_0x0d77('0x13')]));});});};exports[_0x0d77('0x1c')]=function(_0x4fe766){var _0x2c8b85=this;return new Promise(function(_0x54f274,_0x47e25a){return db[_0x0d77('0x15')][_0x0d77('0x1d')](_0x4fe766[_0x0d77('0x17')],{'raw':_0x4fe766[_0x0d77('0x18')]?_0x4fe766['options'][_0x0d77('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe766['options']?_0x4fe766['options']['where']||null:null,'attributes':_0x4fe766[_0x0d77('0x18')]?_0x4fe766['options'][_0x0d77('0x1e')]||null:null,'limit':_0x4fe766[_0x0d77('0x18')]?_0x4fe766[_0x0d77('0x18')][_0x0d77('0x1f')]||null:null})[_0x0d77('0xc')](function(_0x3e66fc){logger[_0x0d77('0xd')](_0x0d77('0x1c'),_0x4fe766);logger[_0x0d77('0x20')](_0x0d77('0x1c'),_0x4fe766,JSON[_0x0d77('0x10')](_0x3e66fc));_0x54f274(_0x3e66fc);})[_0x0d77('0x1a')](function(_0x43f446){logger['error'](_0x0d77('0x1c'),_0x43f446[_0x0d77('0x13')],_0x4fe766);_0x47e25a(_0x2c8b85['error'](0x1f4,_0x43f446[_0x0d77('0x13')]));});});}; \ No newline at end of file +var _0xa1a7=['WhatsappQueueReport','create','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','body','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','error','code','message','result','catch','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa1a7,0xa3));var _0x7a1a=function(_0x15624a,_0x62a80b){_0x15624a=_0x15624a-0x0;var _0x42b811=_0xa1a7[_0x15624a];return _0x42b811;};'use strict';var _=require(_0x7a1a('0x0'));var util=require(_0x7a1a('0x1'));var moment=require(_0x7a1a('0x2'));var BPromise=require(_0x7a1a('0x3'));var rs=require(_0x7a1a('0x4'));var fs=require('fs');var Redis=require(_0x7a1a('0x5'));var db=require(_0x7a1a('0x6'))['db'];var utils=require(_0x7a1a('0x7'));var logger=require(_0x7a1a('0x8'))(_0x7a1a('0x9'));var config=require(_0x7a1a('0xa'));var jayson=require(_0x7a1a('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f5d88,_0xd33514,_0x27dad4){return new BPromise(function(_0x21e847,_0x57ab92){return client[_0x7a1a('0xc')](_0x3f5d88,_0x27dad4)[_0x7a1a('0xd')](function(_0x4b5856){logger[_0x7a1a('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd33514,_0x7a1a('0xf'));logger[_0x7a1a('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xd33514,_0x7a1a('0xf'),JSON['stringify'](_0x4b5856));if(_0x4b5856[_0x7a1a('0x11')]){if(_0x4b5856[_0x7a1a('0x11')][_0x7a1a('0x12')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0xd33514,_0x4b5856['error'][_0x7a1a('0x13')]);return _0x57ab92(_0x4b5856['error'][_0x7a1a('0x13')]);}logger[_0x7a1a('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd33514,_0x4b5856[_0x7a1a('0x11')][_0x7a1a('0x13')]);return _0x21e847(_0x4b5856['error'][_0x7a1a('0x13')]);}else{logger[_0x7a1a('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd33514,'request\x20sent');_0x21e847(_0x4b5856[_0x7a1a('0x14')]['message']);}})[_0x7a1a('0x15')](function(_0x3e4a1f){logger[_0x7a1a('0x11')](_0x7a1a('0x16'),_0xd33514,_0x3e4a1f);_0x57ab92(_0x3e4a1f);});});}exports['CreateWhatsappQueueReport']=function(_0x26be60){var _0x28a7fe=this;return new Promise(function(_0x1e48ee,_0xe8c88){return db[_0x7a1a('0x17')][_0x7a1a('0x18')](_0x26be60['body'],{'raw':_0x26be60[_0x7a1a('0x19')]?_0x26be60[_0x7a1a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x7a1a('0xd')](function(_0x3c4a97){logger[_0x7a1a('0xe')](_0x7a1a('0x1a'),_0x26be60);logger[_0x7a1a('0x10')]('CreateWhatsappQueueReport',_0x26be60,JSON['stringify'](_0x3c4a97));_0x1e48ee(_0x3c4a97);})[_0x7a1a('0x15')](function(_0x4fec20){logger[_0x7a1a('0x11')](_0x7a1a('0x1a'),_0x4fec20[_0x7a1a('0x13')],_0x26be60);_0xe8c88(_0x28a7fe['error'](0x1f4,_0x4fec20[_0x7a1a('0x13')]));});});};exports[_0x7a1a('0x1b')]=function(_0x8e2656){var _0xb23eb5=this;return new Promise(function(_0x2a1e4d,_0x4437f2){return db[_0x7a1a('0x17')][_0x7a1a('0x1c')](_0x8e2656[_0x7a1a('0x1d')],{'raw':_0x8e2656[_0x7a1a('0x19')]?_0x8e2656['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8e2656['options']?_0x8e2656[_0x7a1a('0x19')]['where']||null:null,'attributes':_0x8e2656[_0x7a1a('0x19')]?_0x8e2656['options']['attributes']||null:null,'limit':_0x8e2656[_0x7a1a('0x19')]?_0x8e2656['options']['limit']||null:null})[_0x7a1a('0xd')](function(_0x52207c){logger[_0x7a1a('0xe')](_0x7a1a('0x1b'),_0x8e2656);logger[_0x7a1a('0x10')](_0x7a1a('0x1b'),_0x8e2656,JSON[_0x7a1a('0x1e')](_0x52207c));_0x2a1e4d(_0x52207c);})[_0x7a1a('0x15')](function(_0x3deaac){logger[_0x7a1a('0x11')](_0x7a1a('0x1b'),_0x3deaac['message'],_0x8e2656);_0x4437f2(_0xb23eb5[_0x7a1a('0x11')](0x1f4,_0x3deaac[_0x7a1a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 19bd617..c65ef94 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 _0xe33c=['index','/describe','show','post','/:id','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xe33c,0x147));var _0xce33=function(_0x552a49,_0x245deb){_0x552a49=_0x552a49-0x0;var _0xfc9726=_0xe33c[_0x552a49];return _0xfc9726;};'use strict';var multer=require('multer');var util=require(_0xce33('0x0'));var path=require(_0xce33('0x1'));var timeout=require('connect-timeout');var express=require(_0xce33('0x2'));var router=express[_0xce33('0x3')]();var fs_extra=require(_0xce33('0x4'));var auth=require(_0xce33('0x5'));var interaction=require(_0xce33('0x6'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0xce33('0x7')]('/',auth[_0xce33('0x8')](),controller[_0xce33('0x9')]);router[_0xce33('0x7')](_0xce33('0xa'),auth[_0xce33('0x8')](),controller['describe']);router[_0xce33('0x7')]('/:id',auth[_0xce33('0x8')](),controller[_0xce33('0xb')]);router[_0xce33('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xce33('0xd'),auth[_0xce33('0x8')](),controller['update']);router[_0xce33('0xe')]('/:id',auth[_0xce33('0x8')](),controller['destroy']);module[_0xce33('0xf')]=router; \ No newline at end of file +var _0xd84b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','multer','util','path'];(function(_0x260f05,_0x577a8a){var _0x2e90e3=function(_0x363d99){while(--_0x363d99){_0x260f05['push'](_0x260f05['shift']());}};_0x2e90e3(++_0x577a8a);}(_0xd84b,0xd9));var _0xbd84=function(_0x91f745,_0x12e303){_0x91f745=_0x91f745-0x0;var _0x1632b1=_0xd84b[_0x91f745];return _0x1632b1;};'use strict';var multer=require(_0xbd84('0x0'));var util=require(_0xbd84('0x1'));var path=require(_0xbd84('0x2'));var timeout=require(_0xbd84('0x3'));var express=require(_0xbd84('0x4'));var router=express[_0xbd84('0x5')]();var fs_extra=require(_0xbd84('0x6'));var auth=require(_0xbd84('0x7'));var interaction=require(_0xbd84('0x8'));var config=require(_0xbd84('0x9'));var controller=require('./whatsappTransferReport.controller');router[_0xbd84('0xa')]('/',auth[_0xbd84('0xb')](),controller[_0xbd84('0xc')]);router[_0xbd84('0xa')](_0xbd84('0xd'),auth['isAuthenticated'](),controller[_0xbd84('0xe')]);router[_0xbd84('0xa')](_0xbd84('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xbd84('0x10')]('/',auth[_0xbd84('0xb')](),controller[_0xbd84('0x11')]);router[_0xbd84('0x12')](_0xbd84('0xf'),auth[_0xbd84('0xb')](),controller[_0xbd84('0x13')]);router['delete'](_0xbd84('0xf'),auth[_0xbd84('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 3b6b94f..9e049b4 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 _0x02ce=['queue','DATE','sequelize','exports','STRING','account'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x02ce,0x1ac));var _0xe02c=function(_0xdfd518,_0x172f5a){_0xdfd518=_0xdfd518-0x0;var _0x9a00a9=_0x02ce[_0xdfd518];return _0x9a00a9;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'uniqueid':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe02c('0x3'),'agent',_0xe02c('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe02c('0x5')]}}; \ No newline at end of file +var _0xc2a2=['exports','STRING','ENUM','agent','queue','DATE','sequelize'];(function(_0x58658d,_0x3c1169){var _0x273592=function(_0x52c0ba){while(--_0x52c0ba){_0x58658d['push'](_0x58658d['shift']());}};_0x273592(++_0x3c1169);}(_0xc2a2,0x84));var _0x2c2a=function(_0x595faf,_0x573564){_0x595faf=_0x595faf-0x0;var _0x27ff68=_0xc2a2[_0x595faf];return _0x27ff68;};'use strict';var Sequelize=require(_0x2c2a('0x0'));module[_0x2c2a('0x1')]={'uniqueid':{'type':Sequelize[_0x2c2a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2c2a('0x3')]('account',_0x2c2a('0x4'),_0x2c2a('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2c2a('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 4614d8b..e384d50 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 _0xaa5e=['WhatsappTransferReport','fieldName','key','keys','filters','model','query','attributes','intersection','fields','hasOwnProperty','sort','where','type','VIRTUAL','merge','include','catch','show','params','rawAttributes','length','includeAll','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../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','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map'];(function(_0x42fe22,_0x34a965){var _0x48de26=function(_0x10c442){while(--_0x10c442){_0x42fe22['push'](_0x42fe22['shift']());}};_0x48de26(++_0x34a965);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x52a3a8,_0x2b7103){_0x52a3a8=_0x52a3a8-0x0;var _0x2d3474=_0xaa5e[_0x52a3a8];return _0x2d3474;};'use strict';var emlformat=require(_0xeaa5('0x0'));var rimraf=require(_0xeaa5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeaa5('0x2'));var rp=require(_0xeaa5('0x3'));var moment=require(_0xeaa5('0x4'));var BPromise=require(_0xeaa5('0x5'));var Mustache=require(_0xeaa5('0x6'));var util=require('util');var path=require(_0xeaa5('0x7'));var sox=require(_0xeaa5('0x8'));var csv=require(_0xeaa5('0x9'));var ejs=require(_0xeaa5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeaa5('0xb'));var crypto=require(_0xeaa5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeaa5('0xd'));var toCsv=require(_0xeaa5('0x9'));var querystring=require('querystring');var Papa=require(_0xeaa5('0xe'));var Redis=require('ioredis');var authService=require(_0xeaa5('0xf'));var qs=require(_0xeaa5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeaa5('0x11'));var logger=require(_0xeaa5('0x12'))(_0xeaa5('0x13'));var utils=require(_0xeaa5('0x14'));var config=require(_0xeaa5('0x15'));var licenseUtil=require(_0xeaa5('0x16'));var db=require(_0xeaa5('0x17'))['db'];function respondWithStatusCode(_0x2c3561,_0x123d6e){_0x123d6e=_0x123d6e||0xcc;return function(_0x47a779){if(_0x47a779){return _0x2c3561[_0xeaa5('0x18')](_0x123d6e);}return _0x2c3561[_0xeaa5('0x19')](_0x123d6e)[_0xeaa5('0x1a')]();};}function respondWithResult(_0x21acf9,_0x18ca75){_0x18ca75=_0x18ca75||0xc8;return function(_0x4f3710){if(_0x4f3710){return _0x21acf9[_0xeaa5('0x19')](_0x18ca75)['json'](_0x4f3710);}};}function respondWithFilteredResult(_0x5d5884,_0x1f904a){return function(_0x1a1abc){if(_0x1a1abc){var _0x507fb4=typeof _0x1f904a[_0xeaa5('0x1b')]==='undefined'&&typeof _0x1f904a[_0xeaa5('0x1c')]===_0xeaa5('0x1d');var _0x36786a=_0x1a1abc['count'];var _0x1877a6=_0x507fb4?0x0:_0x1f904a['offset'];var _0x222da7=_0x507fb4?_0x1a1abc[_0xeaa5('0x1e')]:_0x1f904a[_0xeaa5('0x1b')]+_0x1f904a[_0xeaa5('0x1c')];var _0x541af6;if(_0x222da7>=_0x36786a){_0x222da7=_0x36786a;_0x541af6=0xc8;}else{_0x541af6=0xce;}_0x5d5884[_0xeaa5('0x19')](_0x541af6);return _0x5d5884[_0xeaa5('0x1f')](_0xeaa5('0x20'),_0x1877a6+'-'+_0x222da7+'/'+_0x36786a)['json'](_0x1a1abc);}return null;};}function patchUpdates(_0x11ace2){return function(_0xa097a5){try{jsonpatch[_0xeaa5('0x21')](_0xa097a5,_0x11ace2,!![]);}catch(_0x152e56){return BPromise[_0xeaa5('0x22')](_0x152e56);}return _0xa097a5['save']();};}function saveUpdates(_0x3f081e,_0x5f2d83){return function(_0x4212f5){if(_0x4212f5){return _0x4212f5[_0xeaa5('0x23')](_0x3f081e)[_0xeaa5('0x24')](function(_0x1a7ab5){return _0x1a7ab5;});}return null;};}function removeEntity(_0x3a98b4,_0x233a5b){return function(_0x355dbd){if(_0x355dbd){return _0x355dbd[_0xeaa5('0x25')]()[_0xeaa5('0x24')](function(){_0x3a98b4[_0xeaa5('0x19')](0xcc)[_0xeaa5('0x1a')]();});}};}function handleEntityNotFound(_0x43530e,_0x8d01cb){return function(_0x3f6612){if(!_0x3f6612){_0x43530e[_0xeaa5('0x18')](0x194);}return _0x3f6612;};}function handleError(_0x4dde20,_0x32a99a){_0x32a99a=_0x32a99a||0x1f4;return function(_0x2b43e4){logger['error'](_0x2b43e4[_0xeaa5('0x26')]);if(_0x2b43e4[_0xeaa5('0x27')]){delete _0x2b43e4[_0xeaa5('0x27')];}_0x4dde20[_0xeaa5('0x19')](_0x32a99a)[_0xeaa5('0x28')](_0x2b43e4);};}exports['index']=function(_0x26a426,_0x592fe1){var _0x42e55e={},_0x1b2533={},_0x57cd47={'count':0x0,'rows':[]};var _0x24d90d=_[_0xeaa5('0x29')](db[_0xeaa5('0x2a')]['rawAttributes'],function(_0x2bdc1d){return{'name':_0x2bdc1d[_0xeaa5('0x2b')],'type':_0x2bdc1d['type'][_0xeaa5('0x2c')]};});_0x1b2533['model']=_[_0xeaa5('0x29')](_0x24d90d,'name');_0x1b2533['query']=_[_0xeaa5('0x2d')](_0x26a426['query']);_0x1b2533[_0xeaa5('0x2e')]=_['intersection'](_0x1b2533[_0xeaa5('0x2f')],_0x1b2533[_0xeaa5('0x30')]);_0x42e55e[_0xeaa5('0x31')]=_[_0xeaa5('0x32')](_0x1b2533['model'],qs[_0xeaa5('0x33')](_0x26a426['query']['fields']));_0x42e55e[_0xeaa5('0x31')]=_0x42e55e[_0xeaa5('0x31')]['length']?_0x42e55e[_0xeaa5('0x31')]:_0x1b2533[_0xeaa5('0x2f')];if(!_0x26a426[_0xeaa5('0x30')][_0xeaa5('0x34')]('nolimit')){_0x42e55e['limit']=qs[_0xeaa5('0x1c')](_0x26a426[_0xeaa5('0x30')][_0xeaa5('0x1c')]);_0x42e55e[_0xeaa5('0x1b')]=qs[_0xeaa5('0x1b')](_0x26a426[_0xeaa5('0x30')][_0xeaa5('0x1b')]);}_0x42e55e['order']=qs[_0xeaa5('0x35')](_0x26a426[_0xeaa5('0x30')]['sort']);_0x42e55e[_0xeaa5('0x36')]=qs[_0xeaa5('0x2e')](_['pick'](_0x26a426['query'],_0x1b2533['filters']),_0x24d90d);if(_0x26a426[_0xeaa5('0x30')]['filter']){_0x42e55e[_0xeaa5('0x36')]=_['merge'](_0x42e55e['where'],{'$or':_[_0xeaa5('0x29')](_0x24d90d,function(_0xf3b6b){if(_0xf3b6b[_0xeaa5('0x37')]!==_0xeaa5('0x38')){var _0x20341c={};_0x20341c[_0xf3b6b[_0xeaa5('0x27')]]={'$like':'%'+_0x26a426['query']['filter']+'%'};return _0x20341c;}})});}_0x42e55e=_[_0xeaa5('0x39')]({},_0x42e55e,_0x26a426['options']);var _0x377b28={'where':_0x42e55e[_0xeaa5('0x36')]};return db['WhatsappTransferReport'][_0xeaa5('0x1e')](_0x377b28)[_0xeaa5('0x24')](function(_0x3ccc41){_0x57cd47['count']=_0x3ccc41;if(_0x26a426[_0xeaa5('0x30')]['includeAll']){_0x42e55e[_0xeaa5('0x3a')]=[{'all':!![]}];}return db[_0xeaa5('0x2a')]['findAll'](_0x42e55e);})[_0xeaa5('0x24')](function(_0x43d5a0){_0x57cd47['rows']=_0x43d5a0;return _0x57cd47;})[_0xeaa5('0x24')](respondWithFilteredResult(_0x592fe1,_0x42e55e))[_0xeaa5('0x3b')](handleError(_0x592fe1,null));};exports[_0xeaa5('0x3c')]=function(_0x2b22ed,_0x3ccdb3){var _0x417af0={'raw':!![],'where':{'id':_0x2b22ed[_0xeaa5('0x3d')]['id']}},_0x45a0d2={};_0x45a0d2[_0xeaa5('0x2f')]=_['keys'](db[_0xeaa5('0x2a')][_0xeaa5('0x3e')]);_0x45a0d2[_0xeaa5('0x30')]=_[_0xeaa5('0x2d')](_0x2b22ed[_0xeaa5('0x30')]);_0x45a0d2[_0xeaa5('0x2e')]=_['intersection'](_0x45a0d2['model'],_0x45a0d2[_0xeaa5('0x30')]);_0x417af0[_0xeaa5('0x31')]=_[_0xeaa5('0x32')](_0x45a0d2['model'],qs[_0xeaa5('0x33')](_0x2b22ed[_0xeaa5('0x30')][_0xeaa5('0x33')]));_0x417af0['attributes']=_0x417af0[_0xeaa5('0x31')][_0xeaa5('0x3f')]?_0x417af0[_0xeaa5('0x31')]:_0x45a0d2['model'];if(_0x2b22ed[_0xeaa5('0x30')][_0xeaa5('0x40')]){_0x417af0[_0xeaa5('0x3a')]=[{'all':!![]}];}_0x417af0=_[_0xeaa5('0x39')]({},_0x417af0,_0x2b22ed[_0xeaa5('0x41')]);return db[_0xeaa5('0x2a')][_0xeaa5('0x42')](_0x417af0)[_0xeaa5('0x24')](handleEntityNotFound(_0x3ccdb3,null))[_0xeaa5('0x24')](respondWithResult(_0x3ccdb3,null))['catch'](handleError(_0x3ccdb3,null));};exports[_0xeaa5('0x43')]=function(_0x3360fb,_0x147d2f){return db[_0xeaa5('0x2a')][_0xeaa5('0x43')](_0x3360fb[_0xeaa5('0x44')],{})[_0xeaa5('0x24')](respondWithResult(_0x147d2f,0xc9))[_0xeaa5('0x3b')](handleError(_0x147d2f,null));};exports[_0xeaa5('0x23')]=function(_0x516368,_0xaab776){if(_0x516368[_0xeaa5('0x44')]['id']){delete _0x516368[_0xeaa5('0x44')]['id'];}return db[_0xeaa5('0x2a')]['find']({'where':{'id':_0x516368[_0xeaa5('0x3d')]['id']}})[_0xeaa5('0x24')](handleEntityNotFound(_0xaab776,null))[_0xeaa5('0x24')](saveUpdates(_0x516368[_0xeaa5('0x44')],null))['then'](respondWithResult(_0xaab776,null))[_0xeaa5('0x3b')](handleError(_0xaab776,null));};exports[_0xeaa5('0x25')]=function(_0x3cb257,_0x2a8127){return db['WhatsappTransferReport'][_0xeaa5('0x42')]({'where':{'id':_0x3cb257['params']['id']}})['then'](handleEntityNotFound(_0x2a8127,null))[_0xeaa5('0x24')](removeEntity(_0x2a8127,null))['catch'](handleError(_0x2a8127,null));};exports['describe']=function(_0x40d0dd,_0x4916f0){return db[_0xeaa5('0x2a')]['describe']()['then'](respondWithResult(_0x4916f0,null))['catch'](handleError(_0x4916f0,null));}; \ No newline at end of file +var _0x4797=['stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then','error'];(function(_0x5743b4,_0x579826){var _0x4ae2c8=function(_0x217e03){while(--_0x217e03){_0x5743b4['push'](_0x5743b4['shift']());}};_0x4ae2c8(++_0x579826);}(_0x4797,0x143));var _0x7479=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4797[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7479('0x0'));var rimraf=require(_0x7479('0x1'));var zipdir=require(_0x7479('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7479('0x3'));var BPromise=require(_0x7479('0x4'));var Mustache=require(_0x7479('0x5'));var util=require('util');var path=require(_0x7479('0x6'));var sox=require(_0x7479('0x7'));var csv=require(_0x7479('0x8'));var ejs=require(_0x7479('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7479('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7479('0xb'));var deskjs=require(_0x7479('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7479('0xd'));var Redis=require(_0x7479('0xe'));var authService=require(_0x7479('0xf'));var qs=require(_0x7479('0x10'));var as=require(_0x7479('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7479('0x12'))(_0x7479('0x13'));var utils=require('../../config/utils');var config=require(_0x7479('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7479('0x15'))['db'];function respondWithStatusCode(_0x25496d,_0x44783e){_0x44783e=_0x44783e||0xcc;return function(_0x503f5b){if(_0x503f5b){return _0x25496d[_0x7479('0x16')](_0x44783e);}return _0x25496d[_0x7479('0x17')](_0x44783e)[_0x7479('0x18')]();};}function respondWithResult(_0x17d85e,_0x4a1b44){_0x4a1b44=_0x4a1b44||0xc8;return function(_0x29b5f6){if(_0x29b5f6){return _0x17d85e['status'](_0x4a1b44)['json'](_0x29b5f6);}};}function respondWithFilteredResult(_0x46d50c,_0x118a32){return function(_0x5cf666){if(_0x5cf666){var _0x2edef4=typeof _0x118a32[_0x7479('0x19')]===_0x7479('0x1a')&&typeof _0x118a32[_0x7479('0x1b')]===_0x7479('0x1a');var _0x13af73=_0x5cf666['count'];var _0x4b7199=_0x2edef4?0x0:_0x118a32[_0x7479('0x19')];var _0x3d1f83=_0x2edef4?_0x5cf666[_0x7479('0x1c')]:_0x118a32[_0x7479('0x19')]+_0x118a32[_0x7479('0x1b')];var _0x4fce73;if(_0x3d1f83>=_0x13af73){_0x3d1f83=_0x13af73;_0x4fce73=0xc8;}else{_0x4fce73=0xce;}_0x46d50c[_0x7479('0x17')](_0x4fce73);return _0x46d50c['set'](_0x7479('0x1d'),_0x4b7199+'-'+_0x3d1f83+'/'+_0x13af73)[_0x7479('0x1e')](_0x5cf666);}return null;};}function patchUpdates(_0x3a544d){return function(_0x4d706e){try{jsonpatch['apply'](_0x4d706e,_0x3a544d,!![]);}catch(_0x185fae){return BPromise[_0x7479('0x1f')](_0x185fae);}return _0x4d706e[_0x7479('0x20')]();};}function saveUpdates(_0x5e1bb5,_0x33e5b7){return function(_0x346992){if(_0x346992){return _0x346992[_0x7479('0x21')](_0x5e1bb5)['then'](function(_0x4952e1){return _0x4952e1;});}return null;};}function removeEntity(_0x2d0466,_0x48108d){return function(_0x499701){if(_0x499701){return _0x499701[_0x7479('0x22')]()[_0x7479('0x23')](function(){_0x2d0466[_0x7479('0x17')](0xcc)[_0x7479('0x18')]();});}};}function handleEntityNotFound(_0x5ee81f,_0xfa9c5b){return function(_0x3a6cc9){if(!_0x3a6cc9){_0x5ee81f[_0x7479('0x16')](0x194);}return _0x3a6cc9;};}function handleError(_0x42725d,_0x15cf25){_0x15cf25=_0x15cf25||0x1f4;return function(_0x2eec15){logger[_0x7479('0x24')](_0x2eec15[_0x7479('0x25')]);if(_0x2eec15[_0x7479('0x26')]){delete _0x2eec15[_0x7479('0x26')];}_0x42725d['status'](_0x15cf25)[_0x7479('0x27')](_0x2eec15);};}exports[_0x7479('0x28')]=function(_0x5b073c,_0x1fae91){var _0x54964a={},_0x27fa10={},_0x4db967={'count':0x0,'rows':[]};var _0x227844=_['map'](db[_0x7479('0x29')][_0x7479('0x2a')],function(_0x4338ed){return{'name':_0x4338ed[_0x7479('0x2b')],'type':_0x4338ed[_0x7479('0x2c')][_0x7479('0x2d')]};});_0x27fa10[_0x7479('0x2e')]=_[_0x7479('0x2f')](_0x227844,_0x7479('0x26'));_0x27fa10[_0x7479('0x30')]=_[_0x7479('0x31')](_0x5b073c[_0x7479('0x30')]);_0x27fa10[_0x7479('0x32')]=_['intersection'](_0x27fa10[_0x7479('0x2e')],_0x27fa10[_0x7479('0x30')]);_0x54964a[_0x7479('0x33')]=_[_0x7479('0x34')](_0x27fa10[_0x7479('0x2e')],qs[_0x7479('0x35')](_0x5b073c[_0x7479('0x30')][_0x7479('0x35')]));_0x54964a[_0x7479('0x33')]=_0x54964a['attributes'][_0x7479('0x36')]?_0x54964a[_0x7479('0x33')]:_0x27fa10[_0x7479('0x2e')];if(!_0x5b073c[_0x7479('0x30')]['hasOwnProperty'](_0x7479('0x37'))){_0x54964a[_0x7479('0x1b')]=qs['limit'](_0x5b073c[_0x7479('0x30')][_0x7479('0x1b')]);_0x54964a[_0x7479('0x19')]=qs[_0x7479('0x19')](_0x5b073c[_0x7479('0x30')][_0x7479('0x19')]);}_0x54964a[_0x7479('0x38')]=qs[_0x7479('0x39')](_0x5b073c[_0x7479('0x30')]['sort']);_0x54964a['where']=qs['filters'](_[_0x7479('0x3a')](_0x5b073c[_0x7479('0x30')],_0x27fa10[_0x7479('0x32')]),_0x227844);if(_0x5b073c[_0x7479('0x30')][_0x7479('0x3b')]){_0x54964a[_0x7479('0x3c')]=_[_0x7479('0x3d')](_0x54964a[_0x7479('0x3c')],{'$or':_[_0x7479('0x2f')](_0x227844,function(_0x197ed7){if(_0x197ed7[_0x7479('0x2c')]!==_0x7479('0x3e')){var _0x3afe97={};_0x3afe97[_0x197ed7[_0x7479('0x26')]]={'$like':'%'+_0x5b073c['query'][_0x7479('0x3b')]+'%'};return _0x3afe97;}})});}_0x54964a=_['merge']({},_0x54964a,_0x5b073c['options']);var _0x43a6e6={'where':_0x54964a[_0x7479('0x3c')]};return db[_0x7479('0x29')][_0x7479('0x1c')](_0x43a6e6)[_0x7479('0x23')](function(_0x265b1a){_0x4db967['count']=_0x265b1a;if(_0x5b073c[_0x7479('0x30')][_0x7479('0x3f')]){_0x54964a[_0x7479('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x7479('0x41')](_0x54964a);})[_0x7479('0x23')](function(_0x5744a8){_0x4db967[_0x7479('0x42')]=_0x5744a8;return _0x4db967;})[_0x7479('0x23')](respondWithFilteredResult(_0x1fae91,_0x54964a))[_0x7479('0x43')](handleError(_0x1fae91,null));};exports['show']=function(_0xb1ce98,_0x1d14fd){var _0x1d839d={'raw':!![],'where':{'id':_0xb1ce98['params']['id']}},_0x1804fd={};_0x1804fd['model']=_[_0x7479('0x31')](db[_0x7479('0x29')][_0x7479('0x2a')]);_0x1804fd[_0x7479('0x30')]=_[_0x7479('0x31')](_0xb1ce98[_0x7479('0x30')]);_0x1804fd[_0x7479('0x32')]=_[_0x7479('0x34')](_0x1804fd[_0x7479('0x2e')],_0x1804fd['query']);_0x1d839d[_0x7479('0x33')]=_[_0x7479('0x34')](_0x1804fd['model'],qs['fields'](_0xb1ce98['query'][_0x7479('0x35')]));_0x1d839d[_0x7479('0x33')]=_0x1d839d[_0x7479('0x33')][_0x7479('0x36')]?_0x1d839d[_0x7479('0x33')]:_0x1804fd[_0x7479('0x2e')];if(_0xb1ce98[_0x7479('0x30')][_0x7479('0x3f')]){_0x1d839d[_0x7479('0x40')]=[{'all':!![]}];}_0x1d839d=_[_0x7479('0x3d')]({},_0x1d839d,_0xb1ce98['options']);return db[_0x7479('0x29')][_0x7479('0x44')](_0x1d839d)[_0x7479('0x23')](handleEntityNotFound(_0x1d14fd,null))[_0x7479('0x23')](respondWithResult(_0x1d14fd,null))[_0x7479('0x43')](handleError(_0x1d14fd,null));};exports[_0x7479('0x45')]=function(_0x4fd272,_0x36abdb){return db['WhatsappTransferReport'][_0x7479('0x45')](_0x4fd272[_0x7479('0x46')],{})[_0x7479('0x23')](respondWithResult(_0x36abdb,0xc9))['catch'](handleError(_0x36abdb,null));};exports[_0x7479('0x21')]=function(_0x29ae5e,_0x19178e){if(_0x29ae5e[_0x7479('0x46')]['id']){delete _0x29ae5e[_0x7479('0x46')]['id'];}return db[_0x7479('0x29')][_0x7479('0x44')]({'where':{'id':_0x29ae5e['params']['id']}})['then'](handleEntityNotFound(_0x19178e,null))[_0x7479('0x23')](saveUpdates(_0x29ae5e[_0x7479('0x46')],null))[_0x7479('0x23')](respondWithResult(_0x19178e,null))[_0x7479('0x43')](handleError(_0x19178e,null));};exports[_0x7479('0x22')]=function(_0x108052,_0x5800f2){return db[_0x7479('0x29')][_0x7479('0x44')]({'where':{'id':_0x108052['params']['id']}})[_0x7479('0x23')](handleEntityNotFound(_0x5800f2,null))[_0x7479('0x23')](removeEntity(_0x5800f2,null))[_0x7479('0x43')](handleError(_0x5800f2,null));};exports[_0x7479('0x47')]=function(_0x456bb1,_0xc3d6e3){return db['WhatsappTransferReport'][_0x7479('0x47')]()[_0x7479('0x23')](respondWithResult(_0xc3d6e3,null))[_0x7479('0x43')](handleError(_0xc3d6e3,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a890ca7..1444232 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 _0x0e7d=['WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x25cca5,_0x796dc8){var _0x164d42=function(_0x648cd1){while(--_0x648cd1){_0x25cca5['push'](_0x25cca5['shift']());}};_0x164d42(++_0x796dc8);}(_0x0e7d,0x91));var _0xd0e7=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x0e7d[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0xd0e7('0x0'));var util=require(_0xd0e7('0x1'));var logger=require(_0xd0e7('0x2'))(_0xd0e7('0x3'));var moment=require(_0xd0e7('0x4'));var BPromise=require(_0xd0e7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0e7('0x6'));var rimraf=require(_0xd0e7('0x7'));var config=require(_0xd0e7('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0xd0e7('0x9')]=function(_0x2f10ab,_0x119a77){return _0x2f10ab[_0xd0e7('0xa')](_0xd0e7('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd0e7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcaa9=['../../config/logger','api','bluebird','request-promise','path','rimraf','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x55af91,_0x43a6d9){var _0x296828=function(_0x305c29){while(--_0x305c29){_0x55af91['push'](_0x55af91['shift']());}};_0x296828(++_0x43a6d9);}(_0xcaa9,0xe2));var _0x9caa=function(_0x3e5d5b,_0x552159){_0x3e5d5b=_0x3e5d5b-0x0;var _0xb66dba=_0xcaa9[_0x3e5d5b];return _0xb66dba;};'use strict';var _=require(_0x9caa('0x0'));var util=require(_0x9caa('0x1'));var logger=require(_0x9caa('0x2'))(_0x9caa('0x3'));var moment=require('moment');var BPromise=require(_0x9caa('0x4'));var rp=require(_0x9caa('0x5'));var fs=require('fs');var path=require(_0x9caa('0x6'));var rimraf=require(_0x9caa('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x239e28,_0x531d12){return _0x239e28[_0x9caa('0x8')](_0x9caa('0x9'),attributes,{'tableName':_0x9caa('0xa'),'paranoid':![],'indexes':[{'name':_0x9caa('0xb'),'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 f54bc7d..65f9c25 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 _0x8836=['rpc','../../config/environment','jayson/promise','client','http','request','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x30dfa4,_0x1a6275){var _0x185b37=function(_0x1a8025){while(--_0x1a8025){_0x30dfa4['push'](_0x30dfa4['shift']());}};_0x185b37(++_0x1a6275);}(_0x8836,0xc8));var _0x6883=function(_0x137e13,_0x2935d5){_0x137e13=_0x137e13-0x0;var _0x35bb84=_0x8836[_0x137e13];return _0x35bb84;};'use strict';var _=require(_0x6883('0x0'));var util=require(_0x6883('0x1'));var moment=require('moment');var BPromise=require(_0x6883('0x2'));var rs=require(_0x6883('0x3'));var fs=require('fs');var Redis=require(_0x6883('0x4'));var db=require(_0x6883('0x5'))['db'];var utils=require(_0x6883('0x6'));var logger=require('../../config/logger')(_0x6883('0x7'));var config=require(_0x6883('0x8'));var jayson=require(_0x6883('0x9'));var client=jayson[_0x6883('0xa')][_0x6883('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f349a,_0xfa6b1f,_0x3553f5){return new BPromise(function(_0x23341c,_0x2391af){return client[_0x6883('0xc')](_0x3f349a,_0x3553f5)['then'](function(_0x3d1dae){logger['info'](_0x6883('0xd'),_0xfa6b1f,_0x6883('0xe'));logger[_0x6883('0xf')](_0x6883('0x10'),_0xfa6b1f,_0x6883('0xe'),JSON[_0x6883('0x11')](_0x3d1dae));if(_0x3d1dae['error']){if(_0x3d1dae[_0x6883('0x12')][_0x6883('0x13')]===0x1f4){logger[_0x6883('0x12')](_0x6883('0xd'),_0xfa6b1f,_0x3d1dae[_0x6883('0x12')][_0x6883('0x14')]);return _0x2391af(_0x3d1dae[_0x6883('0x12')][_0x6883('0x14')]);}logger['error'](_0x6883('0xd'),_0xfa6b1f,_0x3d1dae['error'][_0x6883('0x14')]);return _0x23341c(_0x3d1dae[_0x6883('0x12')][_0x6883('0x14')]);}else{logger['info'](_0x6883('0xd'),_0xfa6b1f,_0x6883('0xe'));_0x23341c(_0x3d1dae[_0x6883('0x15')]['message']);}})[_0x6883('0x16')](function(_0x3df698){logger['error'](_0x6883('0xd'),_0xfa6b1f,_0x3df698);_0x2391af(_0x3df698);});});} \ No newline at end of file +var _0x86da=['jayson/promise','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0xf87e77,_0xc9d074){var _0x1765dd=function(_0x3ea7c7){while(--_0x3ea7c7){_0xf87e77['push'](_0xf87e77['shift']());}};_0x1765dd(++_0xc9d074);}(_0x86da,0x175));var _0xa86d=function(_0x45725b,_0x6f132e){_0x45725b=_0x45725b-0x0;var _0x2f65a0=_0x86da[_0x45725b];return _0x2f65a0;};'use strict';var _=require(_0xa86d('0x0'));var util=require(_0xa86d('0x1'));var moment=require('moment');var BPromise=require(_0xa86d('0x2'));var rs=require(_0xa86d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa86d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa86d('0x5'))(_0xa86d('0x6'));var config=require('../../config/environment');var jayson=require(_0xa86d('0x7'));var client=jayson['client'][_0xa86d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f34e5,_0x3910b2,_0x5704a6){return new BPromise(function(_0x8a92be,_0xf74216){return client[_0xa86d('0x9')](_0x4f34e5,_0x5704a6)['then'](function(_0x281677){logger[_0xa86d('0xa')](_0xa86d('0xb'),_0x3910b2,_0xa86d('0xc'));logger[_0xa86d('0xd')](_0xa86d('0xe'),_0x3910b2,_0xa86d('0xc'),JSON['stringify'](_0x281677));if(_0x281677['error']){if(_0x281677[_0xa86d('0xf')][_0xa86d('0x10')]===0x1f4){logger['error'](_0xa86d('0xb'),_0x3910b2,_0x281677[_0xa86d('0xf')]['message']);return _0xf74216(_0x281677['error'][_0xa86d('0x11')]);}logger[_0xa86d('0xf')](_0xa86d('0xb'),_0x3910b2,_0x281677[_0xa86d('0xf')][_0xa86d('0x11')]);return _0x8a92be(_0x281677['error']['message']);}else{logger[_0xa86d('0xa')](_0xa86d('0xb'),_0x3910b2,_0xa86d('0xc'));_0x8a92be(_0x281677['result'][_0xa86d('0x11')]);}})[_0xa86d('0x12')](function(_0x4b31c1){logger[_0xa86d('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3910b2,_0x4b31c1);_0xf74216(_0x4b31c1);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 6dc558b..1a90fa7 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ec6=['number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','status','join','None','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','seedDB','default','then','listen','info','start','filter','exitCode'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x464575,_0x330661){_0x464575=_0x464575-0x0;var _0x3dc6a4=_0x0ec6[_0x464575];return _0x3dc6a4;};'use strict';var _=require(_0x60ec('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x60ec('0x1'));var rpc=require(_0x60ec('0x2'));var config=require(_0x60ec('0x3'));var logger=require(_0x60ec('0x4'))(_0x60ec('0x5'));var pm2=require(_0x60ec('0x6'));var pm2Config=require(_0x60ec('0x7'));var schedule=require('./config/schedule');var chat=require(_0x60ec('0x8'));var whatsapp=require(_0x60ec('0x9'));var transcribe=require(_0x60ec('0xa'));var provider=require(_0x60ec('0xb'));function main(){return db['sequelize'][_0x60ec('0xc')]()['then'](function(){if(config[_0x60ec('0xd')]){return seedDb[_0x60ec('0xe')]();}})[_0x60ec('0xf')](function(){return checkLicense[_0x60ec('0xe')]();})[_0x60ec('0xf')](function(){return rpc[_0x60ec('0x10')]();})['then'](function(_0x49fe3b){logger[_0x60ec('0x11')](_0x49fe3b);return chat[_0x60ec('0x12')]();})[_0x60ec('0xf')](function(){return whatsapp[_0x60ec('0x12')]();})[_0x60ec('0xf')](function(){return schedule['start']();})['then'](function(){return transcribe[_0x60ec('0x12')]();})[_0x60ec('0xf')](function(){return provider[_0x60ec('0x12')]();})[_0x60ec('0xf')](function(_0x34c615){logger['info'](_0x34c615);return pm2[_0x60ec('0x12')](pm2Config);})[_0x60ec('0xf')](function(_0x22fdb1){var _0x15045c=_0x22fdb1[_0x60ec('0x13')](function(_0x23298f){return typeof _0x23298f[_0x60ec('0x14')]===_0x60ec('0x15')&&_0x23298f[_0x60ec('0x14')]>=0x0;});if(_0x15045c['length']>0x0){throw new Error(_0x15045c[_0x60ec('0x16')]+_0x60ec('0x17')+_[_0x60ec('0x18')](_0x15045c,function(_0x155bdc){return'\x22'+_0x155bdc[_0x60ec('0x19')][_0x60ec('0x1a')]+'\x22';}));}logger[_0x60ec('0x11')](_0x60ec('0x1b'),_[_0x60ec('0x18')](_[_0x60ec('0x13')](_0x22fdb1,{'status':_0x60ec('0x1c')}),_0x60ec('0x1a'))['join']());logger[_0x60ec('0x11')](_0x60ec('0x1d'),_[_0x60ec('0x18')](_[_0x60ec('0x13')](_0x22fdb1,function(_0x5cace8){return _0x5cace8[_0x60ec('0x1e')]!==_0x60ec('0x1c');}),_0x60ec('0x1a'))[_0x60ec('0x1f')]()||_0x60ec('0x20'));console[_0x60ec('0x21')]('App\x20Ready!');})['catch'](function(_0x588b66){console[_0x60ec('0x21')](_0x60ec('0x22'),_0x588b66);logger[_0x60ec('0x23')](_0x60ec('0x24'),_0x588b66);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x44e8=['./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','name','Online\x20apps:','online','join','Offline\x20apps:','map','status','None','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config'];(function(_0x459790,_0x4f2297){var _0x57e601=function(_0x1ba213){while(--_0x1ba213){_0x459790['push'](_0x459790['shift']());}};_0x57e601(++_0x4f2297);}(_0x44e8,0xd7));var _0x844e=function(_0x342b9a,_0x440bd5){_0x342b9a=_0x342b9a-0x0;var _0x31cbd6=_0x44e8[_0x342b9a];return _0x31cbd6;};'use strict';var _=require(_0x844e('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x844e('0x1'));var rpc=require(_0x844e('0x2'));var config=require(_0x844e('0x3'));var logger=require(_0x844e('0x4'))('app');var pm2=require(_0x844e('0x5'));var pm2Config=require(_0x844e('0x6'));var schedule=require(_0x844e('0x7'));var chat=require(_0x844e('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x844e('0x9'));var provider=require(_0x844e('0xa'));function main(){return db[_0x844e('0xb')][_0x844e('0xc')]()['then'](function(){if(config[_0x844e('0xd')]){return seedDb[_0x844e('0xe')]();}})[_0x844e('0xf')](function(){return checkLicense[_0x844e('0xe')]();})[_0x844e('0xf')](function(){return rpc[_0x844e('0x10')]();})['then'](function(_0x39ef28){logger[_0x844e('0x11')](_0x39ef28);return chat[_0x844e('0x12')]();})[_0x844e('0xf')](function(){return whatsapp[_0x844e('0x12')]();})[_0x844e('0xf')](function(){return schedule[_0x844e('0x12')]();})['then'](function(){return transcribe[_0x844e('0x12')]();})[_0x844e('0xf')](function(){return provider['start']();})[_0x844e('0xf')](function(_0x1cd556){logger['info'](_0x1cd556);return pm2[_0x844e('0x12')](pm2Config);})[_0x844e('0xf')](function(_0x1c1689){var _0x4ed3a4=_0x1c1689[_0x844e('0x13')](function(_0x465e49){return typeof _0x465e49[_0x844e('0x14')]===_0x844e('0x15')&&_0x465e49[_0x844e('0x14')]>=0x0;});if(_0x4ed3a4[_0x844e('0x16')]>0x0){throw new Error(_0x4ed3a4[_0x844e('0x16')]+_0x844e('0x17')+_['map'](_0x4ed3a4,function(_0x36286c){return'\x22'+_0x36286c['pm2_env'][_0x844e('0x18')]+'\x22';}));}logger['info'](_0x844e('0x19'),_['map'](_[_0x844e('0x13')](_0x1c1689,{'status':_0x844e('0x1a')}),_0x844e('0x18'))[_0x844e('0x1b')]());logger[_0x844e('0x11')](_0x844e('0x1c'),_[_0x844e('0x1d')](_[_0x844e('0x13')](_0x1c1689,function(_0x4ffb86){return _0x4ffb86[_0x844e('0x1e')]!=='online';}),'name')[_0x844e('0x1b')]()||_0x844e('0x1f'));console[_0x844e('0x20')](_0x844e('0x21'));})['catch'](function(_0x1202dc){console[_0x844e('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x1202dc);logger[_0x844e('0x22')](_0x844e('0x23'),_0x1202dc);process[_0x844e('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 3122b27..8e9c056 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 _0xa9e0=['role','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','decryptString','length','unshift','encryptString','promisify','payload','options','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','authenticate','pass','status','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'];(function(_0x16ed0b,_0x4ad5a0){var _0x279735=function(_0x218779){while(--_0x218779){_0x16ed0b['push'](_0x16ed0b['shift']());}};_0x279735(++_0x4ad5a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var db=require(_0x0a9e('0x0'))['db'];var config=require(_0x0a9e('0x1'));var hardwareConf=require(_0x0a9e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x0a9e('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x0a9e('0x4'));var compose=require(_0x0a9e('0x5'));var basicAuth=require(_0x0a9e('0x6'));var crypto=require(_0x0a9e('0x7'));var BPromise=require(_0x0a9e('0x8'));var util=require('util');var moment=require(_0x0a9e('0x9'));var validateJwt=expressJwt({'secret':config[_0x0a9e('0xa')][_0x0a9e('0xb')]});var userAttributes=['id','role','fullname',_0x0a9e('0xc'),'internal','email',_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),_0x0a9e('0x11'),_0x0a9e('0x12'),'faxPause','smsPause','openchannelPause','pauseType',_0x0a9e('0x13'),_0x0a9e('0x14'),_0x0a9e('0x15'),_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),'alias',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'phoneBarExpires',_0x0a9e('0x1f'),'phoneBarRemoteControl',_0x0a9e('0x20'),'hotdesk',_0x0a9e('0x21'),_0x0a9e('0x22'),'privacyEnabled',_0x0a9e('0x23'),'wssPort',_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28'),_0x0a9e('0x29'),_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x0a9e('0x2c'),_0x0a9e('0x2d'),_0x0a9e('0x2e'),_0x0a9e('0x2f'),'openchannelAutoanswerDelay',_0x0a9e('0x30'),_0x0a9e('0x31'),'whatsappAutoanswer',_0x0a9e('0x32')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x0a9e('0x33')](function(_0x432e56,_0x38e7c4,_0x30bae6){if(_0x432e56['user']){_0x30bae6();}else{return db[_0x0a9e('0x34')][_0x0a9e('0x35')]({'where':{'id':_0x432e56[_0x0a9e('0x36')]['id']},'attributes':['id',_0x0a9e('0x37'),_0x0a9e('0x38')],'raw':!![]})[_0x0a9e('0x39')](function(_0x16b1ca){if(_0x16b1ca&&_0x16b1ca['closed']){return _0x38e7c4['status'](_0x16b1ca[_0x0a9e('0x38')]===_0x0a9e('0x3a')?0x195:0x193)[_0x0a9e('0x3b')]({'message':_0x16b1ca[_0x0a9e('0x38')]==='unmanaged'?_0x0a9e('0x3c'):'Forbidden.'});}else{_0x30bae6();}})[_0x0a9e('0x3d')](function(_0x5bfb33){_0x30bae6(_0x5bfb33);});}});};exports[_0x0a9e('0x3e')]=function isAuthenticated(_0x34dc65){return compose()[_0x0a9e('0x33')](function(_0x14433c,_0x140511,_0x1538a4){var _0x11c3b6;if(_0x14433c[_0x0a9e('0x3f')]['authorization']){if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x42'))){var _0x5c877d=basicAuth(_0x14433c);db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'name':_0x5c877d[_0x0a9e('0xc')]}})[_0x0a9e('0x39')](function(_0x58b06f){if(!_0x58b06f||!_0x58b06f[_0x0a9e('0x45')](_0x5c877d[_0x0a9e('0x46')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Wrong\x20credentials.'});}_0x14433c[_0x0a9e('0x48')]={'id':_0x58b06f['id']};_0x1538a4();})['catch'](function(_0x2407f9){_0x1538a4(_0x2407f9);});}else if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x49'))){validateJwt(_0x14433c,_0x140511,_0x1538a4);}else{if(_0x34dc65){_0x1538a4();}else{return _0x140511['status'](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}}}else if(_0x14433c[_0x0a9e('0x4b')][_0x0a9e('0x4c')]){try{var _0x2b45ea={'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf[_0x0a9e('0x4d')]()};verifyJwt(_0x14433c[_0x0a9e('0x4b')]['apikey'],_0x2b45ea)[_0x0a9e('0x39')](function(_0x5e7238){return db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x5e7238[_0x0a9e('0x4e')]}})[_0x0a9e('0x39')](function(_0x567193){_0x11c3b6=_0x567193;return db[_0x0a9e('0x4f')][_0x0a9e('0x35')]({'where':{'id':0x1},'attributes':[_0x0a9e('0x50'),_0x0a9e('0x51')],'raw':!![]});})['then'](function(_0x54135e){if(!_0x11c3b6||!_[_0x0a9e('0x52')](_0x11c3b6['apiKeyNonce'],_0x5e7238[_0x0a9e('0x53')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x54')});}if(_0x11c3b6['disabled']){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}if(_0x11c3b6['blocked']){if(_0x54135e[_0x0a9e('0x51')]>0x0){if(moment(_0x11c3b6[_0x0a9e('0x56')])[_0x0a9e('0x57')](_0x54135e['blockDuration'],'minutes')>moment()){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}}_0x14433c[_0x0a9e('0x48')]={'id':_0x11c3b6['id']};_0x1538a4();});})['catch'](function(){return _0x140511['status'](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});});}catch(_0x53f3ee){_0x1538a4(_0x53f3ee);}}else if(_0x34dc65){_0x1538a4();}else{return _0x140511[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}})['use'](function(_0x316c8f,_0x2cfea9,_0x274e8e){if(_0x316c8f[_0x0a9e('0x48')]){db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x316c8f[_0x0a9e('0x48')]['id']},'attributes':userAttributes})[_0x0a9e('0x39')](function(_0x23b089){if(!_0x23b089){return _0x2cfea9[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x58')});}_0x316c8f[_0x0a9e('0x48')]=_0x23b089;_0x274e8e();})[_0x0a9e('0x3d')](function(_0x37f6cc){_0x274e8e(_0x37f6cc);});}else if(_0x34dc65){_0x274e8e();}else{return _0x2cfea9['status'](0x194)['json']({'message':_0x0a9e('0x59')});}});};exports[_0x0a9e('0x5a')]=function canUpdate(){return compose()[_0x0a9e('0x33')](function(_0x315881,_0x1a69dd,_0xc9a702){return licenseUtil[_0x0a9e('0x5b')]()[_0x0a9e('0x39')](function(_0x432fcc){if(_0x432fcc[_0x0a9e('0x5c')]){_0xc9a702();}else{return _0x1a69dd[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':'Forbidden'});}})[_0x0a9e('0x3d')](function(_0x138b8b){_0xc9a702(_0x138b8b);});});};exports[_0x0a9e('0x5d')]=function isWebrtcLicence(){return compose()[_0x0a9e('0x33')](function(_0x2e8caf,_0xbe9d19,_0x21eb86){return licenseUtil[_0x0a9e('0x5b')]()['then'](function(_0x2e9d90){if(_0x2e9d90['webrtc']){_0x21eb86();}else{return _0xbe9d19[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x5e')});}})['catch'](function(_0x14bec2){_0x21eb86(_0x14bec2);});});};exports[_0x0a9e('0x5f')]=function(_0x4774f4,_0x34aa5a,_0x45c845){_0x4774f4[_0x0a9e('0x5f')]=!![];return _0x45c845();};exports[_0x0a9e('0x60')]=function signToken(_0x5bbcde){return signJwt(_0x5bbcde);};exports[_0x0a9e('0x61')]=function(_0x1bde3c,_0x1b5e80){if(!_0x1bde3c[_0x0a9e('0x48')]){return _0x1b5e80[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x62')});}var _0x19383e={'payload':{'id':_0x1bde3c[_0x0a9e('0x48')]['id'],'role':_0x1bde3c['user'][_0x0a9e('0x63')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19383e)[_0x0a9e('0x39')](function(_0x4f7240){_0x1b5e80['cookie']('motion.token',_0x4f7240);_0x1b5e80[_0x0a9e('0x64')](_0x0a9e('0x65'));})[_0x0a9e('0x3d')](function(_0x11545a){return _0x1b5e80[_0x0a9e('0x47')](0x1f4)[_0x0a9e('0x66')](_0x11545a);});};exports[_0x0a9e('0x67')]=function(_0x375c18){if(_['isNil'](_0x375c18['apiKeyNonce'])||_['isNil'](_0x375c18[_0x0a9e('0x68')])){return null;}else{return createJwt(_0x375c18);}};exports[_0x0a9e('0x69')]=function(_0x14d602){_0x14d602['apiKeyNonce']=generateNonce();_0x14d602[_0x0a9e('0x68')]=generateIssuedAt();return createJwt(_0x14d602);};exports[_0x0a9e('0x6a')]=function(_0x53d113,_0x5a88da){var _0x2ef381=_0x53d113['query'][_0x0a9e('0x4c')];if(_0x2ef381){var _0x4c3845={'nonce':_0x5a88da[_0x0a9e('0x6b')],'iat':_0x5a88da[_0x0a9e('0x68')],'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2ef381,_0x4c3845)[_0x0a9e('0x39')](function(){return generateApiKey(_0x5a88da);});}else{throw{'message':_0x0a9e('0x6c')};}};exports['validatePasswordPattern']=function(_0x50f687){var _0x128aa6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x128aa6[_0x0a9e('0x6d')](_0x50f687))throw new db['Sequelize'][(_0x0a9e('0x6e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x0a9e('0x6f')]=function(_0x523cd2,_0xe22ccc,_0x4a6deb){var _0x5da27d=encryptor['decryptString'](_0xe22ccc)[_0x0a9e('0x70')](',');for(var _0x47de4c=0x0;_0x47de4c<_0x4a6deb;_0x47de4c++){if(!_0x5da27d[_0x47de4c])break;if(_0x523cd2[_0x0a9e('0x71')]()===_0x5da27d[_0x47de4c][_0x0a9e('0x71')]()){var _0x3cfd00=util[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x4a6deb);if(_0x4a6deb===0x1){_0x3cfd00=_0x0a9e('0x74');}throw new db[(_0x0a9e('0x75'))][(_0x0a9e('0x6e'))](_0x3cfd00);}}return;};exports['updatePasswordsHistory']=function(_0x1c693e,_0x121cef){var _0x2642bb=_0x121cef?encryptor[_0x0a9e('0x76')](_0x121cef)[_0x0a9e('0x70')](','):[];if(_0x2642bb[_0x0a9e('0x77')]===0x5){_0x2642bb['splice'](-0x1,0x1);}_0x2642bb[_0x0a9e('0x78')](_0x1c693e);return encryptor[_0x0a9e('0x79')](_0x2642bb['join'](','));};function signJwt(_0x3649cc){var _0x5cc8fb=BPromise[_0x0a9e('0x7a')](jwt['sign'],{'context':jwt});var _0x4b3c1a=_0x3649cc['secret']||config[_0x0a9e('0xa')]['session'];return new BPromise(function(_0x2244d6,_0x1fc70e){_0x5cc8fb(_0x3649cc[_0x0a9e('0x7b')],_0x4b3c1a,_0x3649cc[_0x0a9e('0x7c')])[_0x0a9e('0x39')](function(_0x26d7db){_0x2244d6(_0x26d7db);})['catch'](function(_0x1627a7){_0x1fc70e(_0x1627a7);});});}function verifyJwt(_0x5854cc,_0xca4ade,_0x1f07cb){var _0x51aaf7=BPromise['promisify'](jwt[_0x0a9e('0x7d')],{'context':jwt});var _0x156f1c=_0x1f07cb||config[_0x0a9e('0xa')][_0x0a9e('0xb')];return new BPromise(function(_0x497d91,_0x1d0dc8){_0x51aaf7(_0x5854cc,_0x156f1c,_0xca4ade)[_0x0a9e('0x39')](function(_0x54327c){_0x497d91(_0x54327c);})[_0x0a9e('0x3d')](function(_0x17e88c){_0x1d0dc8(_0x17e88c);});});}function generateNonce(){return crypto[_0x0a9e('0x7e')](0x10)[_0x0a9e('0x7f')](_0x0a9e('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0x0a9e('0x81')]()/0x3e8)[_0x0a9e('0x7f')]();}function createJwt(_0x281c7d){var _0x47bb43={'payload':{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x281c7d['id'][_0x0a9e('0x7f')](),'issuer':hardwareConf[_0x0a9e('0x4d')](),'audience':hardwareConf[_0x0a9e('0x4d')]()}};return signJwt(_0x47bb43)[_0x0a9e('0x39')](function(_0x186f39){return{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d[_0x0a9e('0x6b')],'token':_0x186f39};});} \ No newline at end of file +var _0x9bde=['whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','User','find','authenticate','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x291e68,_0x1968a2){_0x291e68=_0x291e68-0x0;var _0x1ca1fd=_0x9bde[_0x291e68];return _0x1ca1fd;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xe9bd('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xe9bd('0x1'));var encryptor=require('../encryptor');var _=require(_0xe9bd('0x2'));var jwt=require(_0xe9bd('0x3'));var expressJwt=require(_0xe9bd('0x4'));var compose=require(_0xe9bd('0x5'));var basicAuth=require(_0xe9bd('0x6'));var crypto=require(_0xe9bd('0x7'));var BPromise=require(_0xe9bd('0x8'));var util=require('util');var moment=require(_0xe9bd('0x9'));var validateJwt=expressJwt({'secret':config[_0xe9bd('0xa')][_0xe9bd('0xb')]});var userAttributes=['id',_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf'),_0xe9bd('0x10'),_0xe9bd('0x11'),_0xe9bd('0x12'),'md5secret','voicePause',_0xe9bd('0x13'),_0xe9bd('0x14'),_0xe9bd('0x15'),'smsPause',_0xe9bd('0x16'),_0xe9bd('0x17'),_0xe9bd('0x18'),_0xe9bd('0x19'),'lastPauseAt',_0xe9bd('0x1a'),'allowmessenger',_0xe9bd('0x1b'),_0xe9bd('0x1c'),_0xe9bd('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xe9bd('0x1e'),_0xe9bd('0x1f'),_0xe9bd('0x20'),_0xe9bd('0x21'),_0xe9bd('0x22'),_0xe9bd('0x23'),_0xe9bd('0x24'),'hotdesk',_0xe9bd('0x25'),_0xe9bd('0x26'),_0xe9bd('0x27'),'settingsEnabled',_0xe9bd('0x28'),_0xe9bd('0x29'),_0xe9bd('0x2a'),_0xe9bd('0x2b'),'ignorePauseForPreviewCalls',_0xe9bd('0x2c'),'chatAutoanswer',_0xe9bd('0x2d'),'emailAutoanswer',_0xe9bd('0x2e'),_0xe9bd('0x2f'),_0xe9bd('0x30'),_0xe9bd('0x31'),_0xe9bd('0x32'),_0xe9bd('0x33'),_0xe9bd('0x34'),'whatsappAutoanswer',_0xe9bd('0x35')];exports[_0xe9bd('0x36')]=function(){return this['isAuthenticated'](!![])[_0xe9bd('0x37')](function(_0x505c23,_0x238ab1,_0x1b9cc9){if(_0x505c23[_0xe9bd('0x38')]){_0x1b9cc9();}else{return db[_0xe9bd('0x39')]['findOne']({'where':{'id':_0x505c23[_0xe9bd('0x3a')]['id']},'attributes':['id',_0xe9bd('0x3b'),_0xe9bd('0x3c')],'raw':!![]})[_0xe9bd('0x3d')](function(_0x2641be){if(_0x2641be&&_0x2641be[_0xe9bd('0x3b')]){return _0x238ab1[_0xe9bd('0x3e')](_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?0x195:0x193)['json']({'message':_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?'Unmanaged.':_0xe9bd('0x40')});}else{_0x1b9cc9();}})[_0xe9bd('0x41')](function(_0x119672){_0x1b9cc9(_0x119672);});}});};exports[_0xe9bd('0x42')]=function isAuthenticated(_0x141b95){return compose()[_0xe9bd('0x37')](function(_0x519f48,_0x5b7f1d,_0x1de54c){var _0x56e409;if(_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')]){if(_[_0xe9bd('0x45')](_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')],'Basic')){var _0x4b7bc2=basicAuth(_0x519f48);db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'name':_0x4b7bc2[_0xe9bd('0xe')]}})[_0xe9bd('0x3d')](function(_0xe2436){if(!_0xe2436||!_0xe2436[_0xe9bd('0x48')](_0x4b7bc2[_0xe9bd('0x49')])){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':'Wrong\x20credentials.'});}_0x519f48[_0xe9bd('0x38')]={'id':_0xe2436['id']};_0x1de54c();})[_0xe9bd('0x41')](function(_0x390a43){_0x1de54c(_0x390a43);});}else if(_['startsWith'](_0x519f48['headers'][_0xe9bd('0x44')],_0xe9bd('0x4b'))){validateJwt(_0x519f48,_0x5b7f1d,_0x1de54c);}else{if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}}}else if(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')]){try{var _0x1c6173={'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};verifyJwt(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')],_0x1c6173)[_0xe9bd('0x3d')](function(_0x199477){return db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'id':_0x199477[_0xe9bd('0x50')]}})[_0xe9bd('0x3d')](function(_0x4c689d){_0x56e409=_0x4c689d;return db[_0xe9bd('0x51')][_0xe9bd('0x52')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe9bd('0x53')],'raw':!![]});})[_0xe9bd('0x3d')](function(_0x4c7d47){if(!_0x56e409||!_['isEqual'](_0x56e409[_0xe9bd('0x54')],_0x199477[_0xe9bd('0x55')])){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x56')});}if(_0x56e409[_0xe9bd('0x57')]){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56e409[_0xe9bd('0x58')]){if(_0x4c7d47[_0xe9bd('0x53')]>0x0){if(moment(_0x56e409[_0xe9bd('0x59')])[_0xe9bd('0x5a')](_0x4c7d47['blockDuration'],_0xe9bd('0x5b'))>moment()){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}_0x519f48[_0xe9bd('0x38')]={'id':_0x56e409['id']};_0x1de54c();});})[_0xe9bd('0x41')](function(){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xcf9a0c){_0x1de54c(_0xcf9a0c);}}else if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d['status'](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}})[_0xe9bd('0x37')](function(_0x480797,_0x1ba613,_0x2923cf){if(_0x480797[_0xe9bd('0x38')]){db['User'][_0xe9bd('0x47')]({'where':{'id':_0x480797[_0xe9bd('0x38')]['id']},'attributes':userAttributes})[_0xe9bd('0x3d')](function(_0x388132){if(!_0x388132){return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5d')});}_0x480797[_0xe9bd('0x38')]=_0x388132;_0x2923cf();})[_0xe9bd('0x41')](function(_0x300e07){_0x2923cf(_0x300e07);});}else if(_0x141b95){_0x2923cf();}else{return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5e')});}});};exports[_0xe9bd('0x5f')]=function canUpdate(){return compose()[_0xe9bd('0x37')](function(_0x5b70d3,_0x5a86fd,_0x283e67){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x58828b){if(_0x58828b['update']){_0x283e67();}else{return _0x5a86fd[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0x39fb61){_0x283e67(_0x39fb61);});});};exports[_0xe9bd('0x62')]=function isWebrtcLicence(){return compose()[_0xe9bd('0x37')](function(_0x512899,_0x1e45fc,_0x4cc146){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x33ba69){if(_0x33ba69[_0xe9bd('0x63')]){_0x4cc146();}else{return _0x1e45fc[_0xe9bd('0x3e')](0x193)['json']({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0xe14fa4){_0x4cc146(_0xe14fa4);});});};exports['isMiddleware']=function(_0xff4e14,_0x476f23,_0x34f787){_0xff4e14['isMiddleware']=!![];return _0x34f787();};exports[_0xe9bd('0x64')]=function signToken(_0x27e7b0){return signJwt(_0x27e7b0);};exports[_0xe9bd('0x65')]=function(_0x10ec29,_0x1ee09c){if(!_0x10ec29['user']){return _0x1ee09c[_0xe9bd('0x3e')](0x194)['json']({'message':_0xe9bd('0x66')});}var _0x239be9={'payload':{'id':_0x10ec29[_0xe9bd('0x38')]['id'],'role':_0x10ec29[_0xe9bd('0x38')][_0xe9bd('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x239be9)['then'](function(_0x15d1d0){_0x1ee09c['cookie'](_0xe9bd('0x67'),_0x15d1d0);_0x1ee09c[_0xe9bd('0x68')]('/dashboards/general');})['catch'](function(_0x1ce539){return _0x1ee09c['status'](0x1f4)[_0xe9bd('0x69')](_0x1ce539);});};exports['retrieveApiKey']=function(_0x26b25a){if(_[_0xe9bd('0x6a')](_0x26b25a['apiKeyNonce'])||_[_0xe9bd('0x6a')](_0x26b25a['apiKeyIat'])){return null;}else{return createJwt(_0x26b25a);}};exports[_0xe9bd('0x6b')]=function(_0x2d9a94){_0x2d9a94[_0xe9bd('0x54')]=generateNonce();_0x2d9a94['apiKeyIat']=generateIssuedAt();return createJwt(_0x2d9a94);};exports[_0xe9bd('0x6c')]=function(_0x1d703f,_0x45b69e){var _0x232a36=_0x1d703f['query']['apikey'];if(_0x232a36){var _0x441f89={'nonce':_0x45b69e['apiKeyNonce'],'iat':_0x45b69e[_0xe9bd('0x6d')],'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};return verifyJwt(_0x232a36,_0x441f89)[_0xe9bd('0x3d')](function(){return generateApiKey(_0x45b69e);});}else{throw{'message':_0xe9bd('0x6e')};}};exports[_0xe9bd('0x6f')]=function(_0x373057){var _0x3381ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3381ee[_0xe9bd('0x70')](_0x373057))throw new db[(_0xe9bd('0x71'))][(_0xe9bd('0x72'))](_0xe9bd('0x73'));return;};exports['validatePasswordHistory']=function(_0x596a7d,_0x566dd8,_0x10e685){var _0x5a516e=encryptor[_0xe9bd('0x74')](_0x566dd8)[_0xe9bd('0x75')](',');for(var _0x90db01=0x0;_0x90db01<_0x10e685;_0x90db01++){if(!_0x5a516e[_0x90db01])break;if(_0x596a7d[_0xe9bd('0x76')]()===_0x5a516e[_0x90db01][_0xe9bd('0x76')]()){var _0xaf6ffd=util[_0xe9bd('0x77')](_0xe9bd('0x78'),_0x10e685);if(_0x10e685===0x1){_0xaf6ffd=_0xe9bd('0x79');}throw new db['Sequelize'][(_0xe9bd('0x72'))](_0xaf6ffd);}}return;};exports[_0xe9bd('0x7a')]=function(_0x3d3e74,_0x3f848d){var _0x4d58c1=_0x3f848d?encryptor[_0xe9bd('0x74')](_0x3f848d)[_0xe9bd('0x75')](','):[];if(_0x4d58c1[_0xe9bd('0x7b')]===0x5){_0x4d58c1['splice'](-0x1,0x1);}_0x4d58c1[_0xe9bd('0x7c')](_0x3d3e74);return encryptor[_0xe9bd('0x7d')](_0x4d58c1[_0xe9bd('0x7e')](','));};function signJwt(_0xfe82f7){var _0x4ee26a=BPromise['promisify'](jwt[_0xe9bd('0x7f')],{'context':jwt});var _0x188891=_0xfe82f7[_0xe9bd('0x80')]||config[_0xe9bd('0xa')]['session'];return new BPromise(function(_0x49add9,_0x305efa){_0x4ee26a(_0xfe82f7[_0xe9bd('0x81')],_0x188891,_0xfe82f7[_0xe9bd('0x82')])[_0xe9bd('0x3d')](function(_0x1fd2b5){_0x49add9(_0x1fd2b5);})[_0xe9bd('0x41')](function(_0x4870f8){_0x305efa(_0x4870f8);});});}function verifyJwt(_0x179c8d,_0x5681ab,_0x27e07c){var _0x28dd03=BPromise[_0xe9bd('0x83')](jwt[_0xe9bd('0x84')],{'context':jwt});var _0x5bc1f8=_0x27e07c||config[_0xe9bd('0xa')][_0xe9bd('0xb')];return new BPromise(function(_0x3b0190,_0x4f35c4){_0x28dd03(_0x179c8d,_0x5bc1f8,_0x5681ab)[_0xe9bd('0x3d')](function(_0x1a9d0c){_0x3b0190(_0x1a9d0c);})[_0xe9bd('0x41')](function(_0x3e3e05){_0x4f35c4(_0x3e3e05);});});}function generateNonce(){return crypto[_0xe9bd('0x85')](0x10)[_0xe9bd('0x86')](_0xe9bd('0x87'));}function generateIssuedAt(){return Math[_0xe9bd('0x88')](Date[_0xe9bd('0x89')]()/0x3e8)[_0xe9bd('0x86')]();}function createJwt(_0x14c599){var _0x37d07a={'payload':{'iat':_0x14c599['apiKeyIat'],'nonce':_0x14c599[_0xe9bd('0x54')]},'options':{'algorithm':_0xe9bd('0x8a'),'subject':_0x14c599['id']['toString'](),'issuer':hardwareConf[_0xe9bd('0x4f')](),'audience':hardwareConf[_0xe9bd('0x4f')]()}};return signJwt(_0x37d07a)['then'](function(_0x561165){return{'iat':_0x14c599[_0xe9bd('0x6d')],'nonce':_0x14c599[_0xe9bd('0x54')],'token':_0x561165};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 0ded1c8..977beda 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 _0x0306=['count','buildContactsQuery','getFilteredContacts','rows','describe','CmContact','keys','cf_','CmCustomField','slice','all','type','map','catch','./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','where','fields','filter','user','clause','skip','tag','countFilteredContacts'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0306,0x11c));var _0x6030=function(_0x14c6a4,_0x130c44){_0x14c6a4=_0x14c6a4-0x0;var _0x45747b=_0x0306[_0x14c6a4];return _0x45747b;};'use strict';var _=require('lodash');var sqlUtils=require(_0x6030('0x0'));var db=require('../../mysqldb')['db'];exports[_0x6030('0x1')]=function(_0x4ba78e,_0x526501,_0x36da58,_0xf3ddac){var _0x32fa34={'count':0x0,'rows':[]};var _0x5b96dd=sqlUtils[_0x6030('0x2')](_0x526501,_0x4ba78e);if(_0x5b96dd){return Promise[_0x6030('0x3')](_0x32fa34);}var _0x3f2dff=sqlUtils[_0x6030('0x4')]();var _0x2a14d6={};var _0x56f177=![];var _0x13c446=![];return Promise[_0x6030('0x3')]()[_0x6030('0x5')](function(){if(_0x4ba78e['search']){return sqlUtils[_0x6030('0x6')](_0x4ba78e[_0x6030('0x7')],_0xf3ddac);}else{return sqlUtils['parseQueryParameters'](_0x4ba78e,_0xf3ddac);}})[_0x6030('0x5')](function(_0x7b0eba){_0x3f2dff['where'](_0x7b0eba['default']);_0x3f2dff[_0x6030('0x8')](_0x7b0eba[_0x6030('0x9')]);_0x3f2dff[_0x6030('0x8')](_0x7b0eba[_0x6030('0xa')]);_0x3f2dff[_0x6030('0x8')](_0x7b0eba[_0x6030('0xb')][_0x6030('0xc')]);_0x2a14d6=_0x7b0eba['tags'];_0x13c446=_0x7b0eba[_0x6030('0xb')][_0x6030('0xd')];return sqlUtils['checkListsRestrictions'](_0x526501,_0x4ba78e,_0x13c446);})[_0x6030('0x5')](function(_0x4e2379){_0x3f2dff[_0x6030('0x8')](_0x4e2379);var _0x5c474f=_0x4ba78e[_0x6030('0x7')]?_0x2a14d6['ids']:_0x4ba78e[_0x6030('0xe')];_0x56f177=_0x5c474f?!![]:![];return sqlUtils[_0x6030('0xf')](_0x3f2dff,_0x5c474f);})[_0x6030('0x5')](function(_0x54fbe6){_0x32fa34['count']=_0x54fbe6;if(_0x32fa34[_0x6030('0x10')]===0x0){return;}if(_0x4ba78e['User']){_0x13c446=!![];}return sqlUtils[_0x6030('0x11')](_0x3f2dff,_0x4ba78e[_0x6030('0x9')],_0x36da58,_0x56f177,_0x2a14d6[_0x6030('0xc')],_0x13c446);})[_0x6030('0x5')](function(_0x3b658e){if(!_0x3b658e){return[];}return sqlUtils[_0x6030('0x12')](_0x3b658e,_0x4ba78e,_0x36da58);})['then'](function(_0x5247a0){_0x32fa34[_0x6030('0x13')]=_0x5247a0;return _0x32fa34;})['catch'](function(_0x553553){throw _0x553553;});};exports[_0x6030('0x14')]=function(){var _0x5706e2={};var _0x57ee5f=[];return db[_0x6030('0x15')][_0x6030('0x14')]()[_0x6030('0x5')](function(_0xa30465){_0x5706e2=_0xa30465;var _0x437071=Object[_0x6030('0x16')](_0x5706e2)[_0x6030('0xa')](function(_0x4ed8f4){return _['startsWith'](_0x4ed8f4,_0x6030('0x17'))?_0x4ed8f4:undefined;});var _0x25f235=_0x437071['map'](function(_0x439a65){return db[_0x6030('0x18')]['findOne']({'where':{'id':_0x439a65[_0x6030('0x19')](0x3)},'raw':!![]});});return Promise[_0x6030('0x1a')](_0x25f235);})[_0x6030('0x5')](function(_0x549209){for(var _0x52c8fb=0x0;_0x52c8fb<_0x549209['length'];_0x52c8fb++){if(_0x549209[_0x52c8fb]){var _0x55b78a=_0x6030('0x17')+_0x549209[_0x52c8fb]['id'];_0x5706e2[_0x55b78a]['fieldType']=_0x549209[_0x52c8fb][_0x6030('0x1b')];}}_0x57ee5f=_[_0x6030('0x1c')](Object['keys'](_0x5706e2),function(_0x4491d5){return{'name':_0x4491d5,'type':_0x5706e2[_0x4491d5]['type']};});return _0x57ee5f;})[_0x6030('0x1d')](function(_0xb3ed3f){throw _0xb3ed3f;});}; \ No newline at end of file +var _0x0e74=['length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','startsWith','cf_','map','CmCustomField','findOne'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0e74,0x1d7));var _0x40e7=function(_0x5a75e4,_0x36857f){_0x5a75e4=_0x5a75e4-0x0;var _0x527926=_0x0e74[_0x5a75e4];return _0x527926;};'use strict';var _=require('lodash');var sqlUtils=require(_0x40e7('0x0'));var db=require(_0x40e7('0x1'))['db'];exports[_0x40e7('0x2')]=function(_0x4dbfb9,_0x42f23a,_0x55dae4,_0x4eed6f){var _0xbd4b66={'count':0x0,'rows':[]};var _0x59a1ee=sqlUtils[_0x40e7('0x3')](_0x42f23a,_0x4dbfb9);if(_0x59a1ee){return Promise[_0x40e7('0x4')](_0xbd4b66);}var _0x430907=sqlUtils['getContactsSubquery']();var _0x867685={};var _0x53688c=![];var _0x48212=![];return Promise[_0x40e7('0x4')]()[_0x40e7('0x5')](function(){if(_0x4dbfb9['search']){return sqlUtils[_0x40e7('0x6')](_0x4dbfb9[_0x40e7('0x7')],_0x4eed6f);}else{return sqlUtils[_0x40e7('0x8')](_0x4dbfb9,_0x4eed6f);}})[_0x40e7('0x5')](function(_0x44a5b3){_0x430907[_0x40e7('0x9')](_0x44a5b3[_0x40e7('0xa')]);_0x430907[_0x40e7('0x9')](_0x44a5b3[_0x40e7('0xb')]);_0x430907[_0x40e7('0x9')](_0x44a5b3[_0x40e7('0xc')]);_0x430907['where'](_0x44a5b3[_0x40e7('0xd')][_0x40e7('0xe')]);_0x867685=_0x44a5b3[_0x40e7('0xf')];_0x48212=_0x44a5b3[_0x40e7('0xd')][_0x40e7('0x10')];return sqlUtils[_0x40e7('0x11')](_0x42f23a,_0x4dbfb9,_0x48212);})['then'](function(_0x4148af){_0x430907['where'](_0x4148af);var _0x44f136=_0x4dbfb9[_0x40e7('0x7')]?_0x867685['ids']:_0x4dbfb9[_0x40e7('0x12')];_0x53688c=_0x44f136?!![]:![];return sqlUtils[_0x40e7('0x13')](_0x430907,_0x44f136);})['then'](function(_0x2d20c9){_0xbd4b66[_0x40e7('0x14')]=_0x2d20c9;if(_0xbd4b66[_0x40e7('0x14')]===0x0){return;}if(_0x4dbfb9[_0x40e7('0x15')]){_0x48212=!![];}return sqlUtils[_0x40e7('0x16')](_0x430907,_0x4dbfb9['fields'],_0x55dae4,_0x53688c,_0x867685[_0x40e7('0xe')],_0x48212);})[_0x40e7('0x5')](function(_0xebb596){if(!_0xebb596){return[];}return sqlUtils[_0x40e7('0x17')](_0xebb596,_0x4dbfb9,_0x55dae4);})[_0x40e7('0x5')](function(_0x586120){_0xbd4b66[_0x40e7('0x18')]=_0x586120;return _0xbd4b66;})[_0x40e7('0x19')](function(_0xeb641f){throw _0xeb641f;});};exports[_0x40e7('0x1a')]=function(){var _0x31c193={};var _0x597d4d=[];return db['CmContact'][_0x40e7('0x1a')]()['then'](function(_0x47fae7){_0x31c193=_0x47fae7;var _0x4a2cc1=Object[_0x40e7('0x1b')](_0x31c193)[_0x40e7('0xc')](function(_0x487104){return _[_0x40e7('0x1c')](_0x487104,_0x40e7('0x1d'))?_0x487104:undefined;});var _0x4a0924=_0x4a2cc1[_0x40e7('0x1e')](function(_0x5c1a8b){return db[_0x40e7('0x1f')][_0x40e7('0x20')]({'where':{'id':_0x5c1a8b['slice'](0x3)},'raw':!![]});});return Promise['all'](_0x4a0924);})[_0x40e7('0x5')](function(_0x15fa95){for(var _0x2987fe=0x0;_0x2987fe<_0x15fa95[_0x40e7('0x21')];_0x2987fe++){if(_0x15fa95[_0x2987fe]){var _0x417180=_0x40e7('0x1d')+_0x15fa95[_0x2987fe]['id'];_0x31c193[_0x417180][_0x40e7('0x22')]=_0x15fa95[_0x2987fe]['type'];}}_0x597d4d=_['map'](Object[_0x40e7('0x1b')](_0x31c193),function(_0x85cc3f){return{'name':_0x85cc3f,'type':_0x31c193[_0x85cc3f][_0x40e7('0x23')]};});return _0x597d4d;})[_0x40e7('0x19')](function(_0x14e236){throw _0x14e236;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 54d3c4f..2d000a7 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 _0x2659=['../../mysqldb','role','agent','search','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','mobile','ListId','createdAt','deletedAt','TagIds','includes','push','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','length','find','dateOfBirth','datetime','DATE','type','text','end','Tag','value','split','map','tags','clause','ids','User','and','uc.UserId\x20=\x20?','user','skip','some','name','compact','Contact','forEach','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','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','Sequelize','QueryTypes','SELECT','CmContact','sequelize','Tags','clone','COUNT(*)','c.id','getSelectedTags','isEmpty','query','toString','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils'];(function(_0x31eb3b,_0x8c4a6e){var _0x38b978=function(_0x3644d7){while(--_0x3644d7){_0x31eb3b['push'](_0x31eb3b['shift']());}};_0x38b978(++_0x8c4a6e);}(_0x2659,0x64));var _0x9265=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x2659[_0x3c51d4];return _0x53c45f;};'use strict';var _=require(_0x9265('0x0'));var squel=require('squel');var as=require(_0x9265('0x1'));var qs=require(_0x9265('0x2'));var utils=require(_0x9265('0x3'));var db=require(_0x9265('0x4'))['db'];function skipContactsQuery(_0x39969c,_0x2d2fd5){var _0x647eee=![];if(_0x39969c[_0x9265('0x5')]===_0x9265('0x6')&&!_0x2d2fd5[_0x9265('0x7')]&&!_0x2d2fd5['ListId']&&_0x2d2fd5[_0x9265('0x8')]!==_0x9265('0x9')){_0x647eee=!![];}return _0x647eee;}function getContactsSubquery(){return squel[_0x9265('0xa')]()[_0x9265('0xb')](_0x9265('0xc'),'c')[_0x9265('0xd')](_0x9265('0xe'));}function applyJoinClauses(_0x3bfdf3,_0x67a53e){var _0x4196a5=_0x67a53e?'c':_0x9265('0xf');_0x3bfdf3[_0x9265('0x10')]('cm_user_has_contacts','uc',_0x9265('0x11')+_0x4196a5+_0x9265('0x12'))[_0x9265('0x10')](_0x9265('0x13'),'ct',_0x9265('0x14')+_0x4196a5+_0x9265('0x12'))[_0x9265('0x10')](_0x9265('0x15'),'t',_0x9265('0x16'));return _0x3bfdf3;}function addFieldsToQuery(_0x2fa879,_0x594f3,_0xf2f5dc,_0x15100f,_0x100e0d){var _0x42eb9f=_0x100e0d?'c':_0x9265('0xf');if(!_0x594f3){_0x594f3=['id',_0x9265('0x17'),'lastName','phone',_0x9265('0x18'),'fax','email',_0x9265('0x19'),'CompanyId',_0x9265('0x1a'),'updatedAt',_0x9265('0x1b'),_0x9265('0x1c')];}else if(!_0x594f3[_0x9265('0x1d')]('id')){_0x594f3[_0x9265('0x1e')]('id');}var _0x546777=_0xf2f5dc&&_0x100e0d||!_0xf2f5dc&&!_0x100e0d;if(_0x15100f){_0x546777=_0x15100f&&_0x100e0d||!_0x15100f&&!_0x100e0d;}_0x594f3['forEach'](function(_0x5cc415){if(_0x5cc415===_0x9265('0x1c')){if(_0x546777){_0x2fa879['field'](_0x9265('0x1f'),_0x5cc415);}else if(_0xf2f5dc||_0x15100f){_0x2fa879[_0x9265('0x20')](_0x42eb9f+'.'+_0x5cc415);}}else{_0x2fa879[_0x9265('0x20')](_0x42eb9f+'.'+_0x5cc415);}});return _0x2fa879;}function getSqlClauses(){var _0x228c3d={'default':squel[_0x9265('0x21')](),'fields':squel[_0x9265('0x21')](),'filter':squel[_0x9265('0x21')](),'tags':{'clause':squel[_0x9265('0x21')](),'ids':null},'user':{'clause':squel[_0x9265('0x21')](),'skip':![]}};return _0x228c3d;}function parseTagParameter(_0x21d408){var _0x745de0=squel[_0x9265('0x21')]();if(_0x21d408){var _0x163136=utils['getSelectedTags'](_0x21d408);_0x163136['forEach'](function(_0x15793b){_0x745de0['or'](_0x9265('0x22'),'%,'+_0x15793b+',%');});}return _0x745de0;}function parseSearchFilter(_0x2e3c64){var _0x2f5a9b=squel[_0x9265('0x21')]();if(_0x2e3c64){var _0x21925e=_0x2e3c64['replace']('\x5c','\x5c\x5c')[_0x9265('0x23')](/'/g,'\x27\x27');if(_0x21925e['split']('\x20')['length']>0x1){_0x2f5a9b['or'](_0x9265('0x24'),qs[_0x9265('0x25')](_0x21925e,!![]),null);}else{if(qs['isNumeric'](_0x21925e)){_0x2f5a9b['or']('c.id\x20LIKE\x20?',_0x21925e+'%');_0x2f5a9b['or'](_0x9265('0x26'),_0x21925e+'%');_0x2f5a9b['or']('c.mobile\x20LIKE\x20?',_0x21925e+'%');_0x2f5a9b['or']('c.fax\x20LIKE\x20?',_0x21925e+'%');}else if(qs['isEmail'](_0x21925e)){_0x2f5a9b['or'](_0x9265('0x27'),_0x21925e+'%');}else{_0x2f5a9b['or'](_0x9265('0x28'),'%'+_0x21925e+'%');_0x2f5a9b['or']('c.lastName\x20LIKE\x20?','%'+_0x21925e+'%');_0x2f5a9b['or'](_0x9265('0x27'),'%'+_0x21925e+'%');}}}return _0x2f5a9b;}function parseAdvancedSearchFilter(_0x4ec5c3,_0x4fd7b5){var _0x275ce8=getSqlClauses();var _0x50d1a6=as[_0x9265('0x29')](_0x4ec5c3);var _0x370cdc=_0x50d1a6[_0x9265('0x2a')];for(var _0x400078=0x0;_0x400078<_0x50d1a6['conditions'][_0x9265('0x2b')];_0x400078++){var _0x2ecd04=_0x50d1a6['conditions'][_0x400078];var _0x5ef417='c';var _0x4125d5=_[_0x9265('0x2c')](_0x4fd7b5,['name',_0x2ecd04['field']]);if(_0x4125d5){if(_0x2ecd04[_0x9265('0x20')]===_0x9265('0x2d')||_0x4125d5['fieldType']===_0x9265('0x2e')){_0x2ecd04['castTo']=_0x9265('0x2f');}var _0x3c77d7=as['buildExpression'](_0x5ef417,_0x4125d5[_0x9265('0x30')],_0x2ecd04);_0x275ce8['default'][_0x370cdc](_0x3c77d7[_0x9265('0x31')],_0x3c77d7['value']['start'],_0x3c77d7['value'][_0x9265('0x32')]);}else{if(_0x2ecd04['field']===_0x9265('0x33')){var _0x64e05c=_0x2ecd04[_0x9265('0x34')][_0x9265('0x35')](',')[_0x9265('0x36')](function(_0xc6ec23){return Number(_0xc6ec23);});var _0x23506b=parseTagParameter(_0x64e05c);_0x275ce8[_0x9265('0x37')][_0x9265('0x38')]['and'](_0x23506b);_0x275ce8[_0x9265('0x37')][_0x9265('0x39')]=_0x64e05c;}else if(_0x2ecd04[_0x9265('0x20')]===_0x9265('0x3a')){_0x275ce8['user']['clause'][_0x9265('0x3b')](_0x9265('0x3c'),_0x2ecd04[_0x9265('0x34')]);_0x275ce8[_0x9265('0x3d')][_0x9265('0x3e')]=!![];}}}return _0x275ce8;}function parseModelFields(_0x39d2e9,_0x2dc59c){var _0x4a3c57=squel[_0x9265('0x21')]();var _0x7e5e40=_(_0x39d2e9)['keys']()['map'](function(_0x2d3121){return _[_0x9265('0x3f')](_0x2dc59c,[_0x9265('0x40'),_0x2d3121])?_0x2d3121:undefined;})[_0x9265('0x41')]()['value']();if(_0x39d2e9[_0x9265('0x42')]){_0x7e5e40[_0x9265('0x1e')](_0x9265('0x42'));}if(_0x39d2e9['User']){_0x7e5e40[_0x9265('0x1e')]('User');}if(_0x7e5e40[_0x9265('0x2b')]>0x0){_0x7e5e40[_0x9265('0x43')](function(_0x278716){if(_0x278716==='ListId'){_0x4a3c57[_0x9265('0x3b')](_0x9265('0x44'),[][_0x9265('0x45')](_0x39d2e9[_0x278716]));}else if(_0x278716==='Contact'){var _0x198d69='%'+_0x39d2e9[_0x278716]+'%';_0x4a3c57[_0x9265('0x3b')](_0x9265('0x46'),_0x198d69);}else if(_0x278716===_0x9265('0x3a')){_0x4a3c57[_0x9265('0x3b')](_0x9265('0x3c'),_0x39d2e9[_0x278716]);}else{_0x4a3c57[_0x9265('0x3b')]('c.'+_0x278716+_0x9265('0x47'),_0x39d2e9[_0x278716]);}});}return _0x4a3c57;}function parseQueryParameters(_0x2cecb6,_0x48a25f){var _0x2e293e=getSqlClauses();return Promise[_0x9265('0x48')]()[_0x9265('0x49')](function(){return parseModelFields(_0x2cecb6,_0x48a25f);})[_0x9265('0x49')](function(_0x39d0f0){_0x2e293e[_0x9265('0x4a')]['and'](_0x39d0f0);return parseTagParameter(_0x2cecb6[_0x9265('0x4b')]);})[_0x9265('0x49')](function(_0x38b1a3){_0x2e293e[_0x9265('0x37')][_0x9265('0x38')][_0x9265('0x3b')](_0x38b1a3);return parseSearchFilter(_0x2cecb6[_0x9265('0x4c')]);})[_0x9265('0x49')](function(_0x29b585){_0x2e293e['filter']=_0x29b585;return _0x2e293e;});}function checkListsRestrictions(_0x1237f5,_0x11a777,_0x3d366a){var _0xd7d58c=squel[_0x9265('0x21')]();return Promise[_0x9265('0x48')]()[_0x9265('0x49')](function(){if(_0x11a777[_0x9265('0x7')]&&_0x1237f5[_0x9265('0x5')]===_0x9265('0x6')&&!_0x3d366a){return _0x1237f5[_0x9265('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0x9265('0x49')](function(_0xcd5824){if(_0xcd5824){if(_0xcd5824[_0x9265('0x2b')]===0x0){_0xd7d58c[_0x9265('0x3b')](_0x9265('0x4e'));}else{_0xd7d58c[_0x9265('0x3b')](_0x9265('0x44'),_[_0x9265('0x36')](_0xcd5824,'id'));}}})['then'](function(){return _0xd7d58c;});}function buildContactsQuery(_0x20381f,_0x2d7e3a,_0x507f19,_0x19d0fc,_0x21b014,_0x186a55){if(_0x2d7e3a){_0x2d7e3a=_0x507f19[_0x9265('0x4f')];}_0x20381f=addFieldsToQuery(_0x20381f,_0x2d7e3a,_0x19d0fc,_0x186a55,!![]);var _0x2326e2=squel[_0x9265('0xa')]();_0x2326e2=addFieldsToQuery(_0x2326e2,_0x2d7e3a,_0x19d0fc,_0x186a55,![]);if(_0x19d0fc||_0x186a55){_0x20381f=applyJoinClauses(_0x20381f,!![]);_0x20381f[_0x9265('0x50')]('c.id');if(_0x507f19[_0x9265('0x51')]){_0x2326e2[_0x9265('0x51')](_0x507f19[_0x9265('0x51')]);}if(_0x507f19[_0x9265('0x52')]){_0x2326e2[_0x9265('0x52')](_0x507f19[_0x9265('0x52')]);}}else{_0x2326e2=applyJoinClauses(_0x2326e2,![]);_0x2326e2[_0x9265('0x50')](_0x9265('0x53'));if(_0x507f19[_0x9265('0x51')]){_0x20381f[_0x9265('0x51')](_0x507f19[_0x9265('0x51')]);}if(_0x507f19['offset']){_0x20381f[_0x9265('0x52')](_0x507f19[_0x9265('0x52')]);}}_0x2326e2[_0x9265('0x54')](_0x21b014);if(_0x507f19[_0x9265('0x55')]){_0x507f19['order']['forEach'](function(_0x44bbcd){_0x20381f['order']('c.'+_0x44bbcd[0x0],_0x44bbcd[0x1]===_0x9265('0x56')?![]:!![]);_0x2326e2[_0x9265('0x55')](_0x9265('0x57')+_0x44bbcd[0x0],_0x44bbcd[0x1]==='DESC'?![]:!![]);});}_0x2326e2['from'](_0x20381f,_0x9265('0xf'));return _0x2326e2;}function getFilteredContacts(_0x397903){var _0x3a3f8c=[];return db[_0x9265('0x33')][_0x9265('0x58')]({'attributes':['id',_0x9265('0x40'),_0x9265('0x59')],'raw':!![]})[_0x9265('0x49')](function(_0x3c5fb9){_0x3a3f8c=_['keyBy'](_0x3c5fb9,'id');var _0x338f9e={'type':db[_0x9265('0x5a')][_0x9265('0x5b')][_0x9265('0x5c')],'model':db[_0x9265('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9265('0x5e')]['query'](_0x397903['toString'](),_0x338f9e);})['then'](function(_0x35a727){_0x35a727[_0x9265('0x43')](function(_0x5cee84){if(_0x5cee84[_0x9265('0x1c')]){_0x5cee84[_0x9265('0x5f')]=[];_0x5cee84[_0x9265('0x1c')][_0x9265('0x35')](',')['forEach'](function(_0x246456){_0x5cee84[_0x9265('0x5f')]['push'](_0x3a3f8c[_0x246456]);});}delete _0x5cee84[_0x9265('0x1c')];});return _0x35a727;});}function countFilteredContacts(_0x3d8085,_0x2e522c){var _0x35f71a=_0x3d8085[_0x9265('0x60')]();_0x35f71a['field'](_0x9265('0x61'));_0x35f71a=applyJoinClauses(_0x35f71a,!![]);_0x3d8085[_0x9265('0x50')](_0x9265('0x62'));var _0x2fbeed=utils[_0x9265('0x63')](_0x2e522c);if(!_[_0x9265('0x64')](_0x2fbeed)){_0x35f71a[_0x9265('0xd')]('t.id\x20IN\x20?',_0x2fbeed);}var _0x28853f={'type':db[_0x9265('0x5a')][_0x9265('0x5b')][_0x9265('0x5c')],'raw':!![]};return db['sequelize'][_0x9265('0x65')](_0x35f71a[_0x9265('0x66')](),_0x28853f)[_0x9265('0x49')](function(_0x2d7a75){return _0x2d7a75[0x0][_0x9265('0x61')];});}module[_0x9265('0x67')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x9f98=['COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','exports','squel','../parsers/qs','role','agent','search','ListId','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','lastName','phone','fax','email','updatedAt','deletedAt','TagIds','includes','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','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.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','sqlOperator','conditions','find','name','datetime','castTo','buildExpression','type','text','value','start','end','Tag','map','tags','clause','and','ids','User','skip','keys','some','compact','Contact','push','forEach','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','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','order','DESC','findAll','color','keyBy','SELECT','CmContact','sequelize','query','toString','Tags','clone'];(function(_0xf2a7a5,_0x322667){var _0x5c494b=function(_0x15aa32){while(--_0x15aa32){_0xf2a7a5['push'](_0xf2a7a5['shift']());}};_0x5c494b(++_0x322667);}(_0x9f98,0x19a));var _0x89f9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9f98[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var squel=require(_0x89f9('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x89f9('0x1'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x3c3a25,_0x11419c){var _0x13f6d3=![];if(_0x3c3a25[_0x89f9('0x2')]===_0x89f9('0x3')&&!_0x11419c[_0x89f9('0x4')]&&!_0x11419c[_0x89f9('0x5')]&&_0x11419c[_0x89f9('0x6')]!==_0x89f9('0x7')){_0x13f6d3=!![];}return _0x13f6d3;}function getContactsSubquery(){return squel['select']()[_0x89f9('0x8')](_0x89f9('0x9'),'c')[_0x89f9('0xa')](_0x89f9('0xb'));}function applyJoinClauses(_0x2e23d5,_0x168a14){var _0x49de13=_0x168a14?'c':_0x89f9('0xc');_0x2e23d5[_0x89f9('0xd')](_0x89f9('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x49de13+_0x89f9('0xf'))[_0x89f9('0xd')](_0x89f9('0x10'),'ct',_0x89f9('0x11')+_0x49de13+'.id')[_0x89f9('0xd')]('tools_tags','t',_0x89f9('0x12'));return _0x2e23d5;}function addFieldsToQuery(_0x7b6e7b,_0x3ed7e1,_0xf987c,_0x1d068e,_0x4bccbe){var _0x7a473b=_0x4bccbe?'c':_0x89f9('0xc');if(!_0x3ed7e1){_0x3ed7e1=['id','firstName',_0x89f9('0x13'),_0x89f9('0x14'),'mobile',_0x89f9('0x15'),_0x89f9('0x16'),_0x89f9('0x5'),'CompanyId','createdAt',_0x89f9('0x17'),_0x89f9('0x18'),_0x89f9('0x19')];}else if(!_0x3ed7e1[_0x89f9('0x1a')]('id')){_0x3ed7e1['push']('id');}var _0x2912e0=_0xf987c&&_0x4bccbe||!_0xf987c&&!_0x4bccbe;if(_0x1d068e){_0x2912e0=_0x1d068e&&_0x4bccbe||!_0x1d068e&&!_0x4bccbe;}_0x3ed7e1['forEach'](function(_0x20389a){if(_0x20389a===_0x89f9('0x19')){if(_0x2912e0){_0x7b6e7b[_0x89f9('0x1b')](_0x89f9('0x1c'),_0x20389a);}else if(_0xf987c||_0x1d068e){_0x7b6e7b[_0x89f9('0x1b')](_0x7a473b+'.'+_0x20389a);}}else{_0x7b6e7b[_0x89f9('0x1b')](_0x7a473b+'.'+_0x20389a);}});return _0x7b6e7b;}function getSqlClauses(){var _0x3c6af9={'default':squel[_0x89f9('0x1d')](),'fields':squel['expr'](),'filter':squel[_0x89f9('0x1d')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x3c6af9;}function parseTagParameter(_0x500bb8){var _0x4b4ecd=squel[_0x89f9('0x1d')]();if(_0x500bb8){var _0x3d8c63=utils['getSelectedTags'](_0x500bb8);_0x3d8c63['forEach'](function(_0x142b95){_0x4b4ecd['or'](_0x89f9('0x1e'),'%,'+_0x142b95+',%');});}return _0x4b4ecd;}function parseSearchFilter(_0x1c1c0b){var _0x1540df=squel['expr']();if(_0x1c1c0b){var _0x420224=_0x1c1c0b[_0x89f9('0x1f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x420224[_0x89f9('0x20')]('\x20')[_0x89f9('0x21')]>0x1){_0x1540df['or'](_0x89f9('0x22'),qs[_0x89f9('0x23')](_0x420224,!![]),null);}else{if(qs[_0x89f9('0x24')](_0x420224)){_0x1540df['or'](_0x89f9('0x25'),_0x420224+'%');_0x1540df['or'](_0x89f9('0x26'),_0x420224+'%');_0x1540df['or']('c.mobile\x20LIKE\x20?',_0x420224+'%');_0x1540df['or']('c.fax\x20LIKE\x20?',_0x420224+'%');}else if(qs['isEmail'](_0x420224)){_0x1540df['or']('c.email\x20LIKE\x20?',_0x420224+'%');}else{_0x1540df['or'](_0x89f9('0x27'),'%'+_0x420224+'%');_0x1540df['or']('c.lastName\x20LIKE\x20?','%'+_0x420224+'%');_0x1540df['or'](_0x89f9('0x28'),'%'+_0x420224+'%');}}}return _0x1540df;}function parseAdvancedSearchFilter(_0xb082f6,_0x255284){var _0x36004d=getSqlClauses();var _0xcbd91e=as['parseSearch'](_0xb082f6);var _0x182658=_0xcbd91e[_0x89f9('0x29')];for(var _0x1865e2=0x0;_0x1865e2<_0xcbd91e[_0x89f9('0x2a')][_0x89f9('0x21')];_0x1865e2++){var _0x391dfe=_0xcbd91e[_0x89f9('0x2a')][_0x1865e2];var _0x480874='c';var _0x6d9adb=_[_0x89f9('0x2b')](_0x255284,[_0x89f9('0x2c'),_0x391dfe['field']]);if(_0x6d9adb){if(_0x391dfe[_0x89f9('0x1b')]==='dateOfBirth'||_0x6d9adb['fieldType']===_0x89f9('0x2d')){_0x391dfe[_0x89f9('0x2e')]='DATE';}var _0x38e627=as[_0x89f9('0x2f')](_0x480874,_0x6d9adb[_0x89f9('0x30')],_0x391dfe);_0x36004d['default'][_0x182658](_0x38e627[_0x89f9('0x31')],_0x38e627[_0x89f9('0x32')][_0x89f9('0x33')],_0x38e627[_0x89f9('0x32')][_0x89f9('0x34')]);}else{if(_0x391dfe[_0x89f9('0x1b')]===_0x89f9('0x35')){var _0x215801=_0x391dfe[_0x89f9('0x32')]['split'](',')[_0x89f9('0x36')](function(_0x31b12a){return Number(_0x31b12a);});var _0x51627d=parseTagParameter(_0x215801);_0x36004d[_0x89f9('0x37')][_0x89f9('0x38')][_0x89f9('0x39')](_0x51627d);_0x36004d['tags'][_0x89f9('0x3a')]=_0x215801;}else if(_0x391dfe[_0x89f9('0x1b')]===_0x89f9('0x3b')){_0x36004d['user']['clause'][_0x89f9('0x39')]('uc.UserId\x20=\x20?',_0x391dfe['value']);_0x36004d['user'][_0x89f9('0x3c')]=!![];}}}return _0x36004d;}function parseModelFields(_0x3b0703,_0x23a6ef){var _0xbcecba=squel[_0x89f9('0x1d')]();var _0x2f4d20=_(_0x3b0703)[_0x89f9('0x3d')]()[_0x89f9('0x36')](function(_0x235015){return _[_0x89f9('0x3e')](_0x23a6ef,[_0x89f9('0x2c'),_0x235015])?_0x235015:undefined;})[_0x89f9('0x3f')]()[_0x89f9('0x32')]();if(_0x3b0703[_0x89f9('0x40')]){_0x2f4d20[_0x89f9('0x41')](_0x89f9('0x40'));}if(_0x3b0703[_0x89f9('0x3b')]){_0x2f4d20['push'](_0x89f9('0x3b'));}if(_0x2f4d20[_0x89f9('0x21')]>0x0){_0x2f4d20[_0x89f9('0x42')](function(_0x5505fb){if(_0x5505fb===_0x89f9('0x5')){_0xbcecba['and'](_0x89f9('0x43'),[][_0x89f9('0x44')](_0x3b0703[_0x5505fb]));}else if(_0x5505fb===_0x89f9('0x40')){var _0x4e2cfd='%'+_0x3b0703[_0x5505fb]+'%';_0xbcecba['and'](_0x89f9('0x45'),_0x4e2cfd);}else if(_0x5505fb===_0x89f9('0x3b')){_0xbcecba[_0x89f9('0x39')]('uc.UserId\x20=\x20?',_0x3b0703[_0x5505fb]);}else{_0xbcecba['and']('c.'+_0x5505fb+_0x89f9('0x46'),_0x3b0703[_0x5505fb]);}});}return _0xbcecba;}function parseQueryParameters(_0x36d329,_0x5bfcf3){var _0x266016=getSqlClauses();return Promise[_0x89f9('0x47')]()[_0x89f9('0x48')](function(){return parseModelFields(_0x36d329,_0x5bfcf3);})[_0x89f9('0x48')](function(_0x5c3121){_0x266016[_0x89f9('0x49')][_0x89f9('0x39')](_0x5c3121);return parseTagParameter(_0x36d329[_0x89f9('0x4a')]);})[_0x89f9('0x48')](function(_0x30de7f){_0x266016[_0x89f9('0x37')][_0x89f9('0x38')][_0x89f9('0x39')](_0x30de7f);return parseSearchFilter(_0x36d329[_0x89f9('0x4b')]);})[_0x89f9('0x48')](function(_0x35a973){_0x266016[_0x89f9('0x4b')]=_0x35a973;return _0x266016;});}function checkListsRestrictions(_0x23d553,_0x27dc95,_0x27ef54){var _0x545697=squel['expr']();return Promise[_0x89f9('0x47')]()[_0x89f9('0x48')](function(){if(_0x27dc95[_0x89f9('0x4')]&&_0x23d553[_0x89f9('0x2')]==='agent'&&!_0x27ef54){return _0x23d553['getLists']({'attributes':['id'],'raw':!![]});}})[_0x89f9('0x48')](function(_0x404ddd){if(_0x404ddd){if(_0x404ddd[_0x89f9('0x21')]===0x0){_0x545697[_0x89f9('0x39')](_0x89f9('0x4c'));}else{_0x545697[_0x89f9('0x39')](_0x89f9('0x43'),_['map'](_0x404ddd,'id'));}}})[_0x89f9('0x48')](function(){return _0x545697;});}function buildContactsQuery(_0x3cac34,_0x264ea8,_0x341730,_0x759728,_0x354bdf,_0x9647c2){if(_0x264ea8){_0x264ea8=_0x341730[_0x89f9('0x4d')];}_0x3cac34=addFieldsToQuery(_0x3cac34,_0x264ea8,_0x759728,_0x9647c2,!![]);var _0xab09c0=squel[_0x89f9('0x4e')]();_0xab09c0=addFieldsToQuery(_0xab09c0,_0x264ea8,_0x759728,_0x9647c2,![]);if(_0x759728||_0x9647c2){_0x3cac34=applyJoinClauses(_0x3cac34,!![]);_0x3cac34[_0x89f9('0x4f')](_0x89f9('0x50'));if(_0x341730[_0x89f9('0x51')]){_0xab09c0[_0x89f9('0x51')](_0x341730[_0x89f9('0x51')]);}if(_0x341730[_0x89f9('0x52')]){_0xab09c0[_0x89f9('0x52')](_0x341730[_0x89f9('0x52')]);}}else{_0xab09c0=applyJoinClauses(_0xab09c0,![]);_0xab09c0[_0x89f9('0x4f')]('subqry.id');if(_0x341730[_0x89f9('0x51')]){_0x3cac34['limit'](_0x341730['limit']);}if(_0x341730[_0x89f9('0x52')]){_0x3cac34[_0x89f9('0x52')](_0x341730[_0x89f9('0x52')]);}}_0xab09c0['having'](_0x354bdf);if(_0x341730[_0x89f9('0x53')]){_0x341730['order'][_0x89f9('0x42')](function(_0x4aab17){_0x3cac34[_0x89f9('0x53')]('c.'+_0x4aab17[0x0],_0x4aab17[0x1]===_0x89f9('0x54')?![]:!![]);_0xab09c0[_0x89f9('0x53')]('subqry.'+_0x4aab17[0x0],_0x4aab17[0x1]===_0x89f9('0x54')?![]:!![]);});}_0xab09c0[_0x89f9('0x8')](_0x3cac34,_0x89f9('0xc'));return _0xab09c0;}function getFilteredContacts(_0x33db00){var _0x4994da=[];return db[_0x89f9('0x35')][_0x89f9('0x55')]({'attributes':['id','name',_0x89f9('0x56')],'raw':!![]})[_0x89f9('0x48')](function(_0xda3543){_0x4994da=_[_0x89f9('0x57')](_0xda3543,'id');var _0xa9fc6={'type':db['Sequelize']['QueryTypes'][_0x89f9('0x58')],'model':db[_0x89f9('0x59')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x89f9('0x5a')][_0x89f9('0x5b')](_0x33db00[_0x89f9('0x5c')](),_0xa9fc6);})[_0x89f9('0x48')](function(_0x4e9ad4){_0x4e9ad4[_0x89f9('0x42')](function(_0x380072){if(_0x380072[_0x89f9('0x19')]){_0x380072[_0x89f9('0x5d')]=[];_0x380072[_0x89f9('0x19')][_0x89f9('0x20')](',')[_0x89f9('0x42')](function(_0x422f4b){_0x380072['Tags'][_0x89f9('0x41')](_0x4994da[_0x422f4b]);});}delete _0x380072[_0x89f9('0x19')];});return _0x4e9ad4;});}function countFilteredContacts(_0xeae34a,_0x271a77){var _0x1c5542=_0xeae34a[_0x89f9('0x5e')]();_0x1c5542[_0x89f9('0x1b')](_0x89f9('0x5f'));_0x1c5542=applyJoinClauses(_0x1c5542,!![]);_0xeae34a[_0x89f9('0x4f')]('c.id');var _0x5ecf57=utils[_0x89f9('0x60')](_0x271a77);if(!_[_0x89f9('0x61')](_0x5ecf57)){_0x1c5542[_0x89f9('0xa')](_0x89f9('0x62'),_0x5ecf57);}var _0x317d8c={'type':db[_0x89f9('0x63')]['QueryTypes'][_0x89f9('0x58')],'raw':!![]};return db[_0x89f9('0x5a')][_0x89f9('0x5b')](_0x1c5542[_0x89f9('0x5c')](),_0x317d8c)['then'](function(_0x17af70){return _0x17af70[0x0][_0x89f9('0x5f')];});}module[_0x89f9('0x64')]={'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 b5e00a7..edc096c 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 _0xe913=['crypto','lodash','../../config/environment','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','update','write','end','final','binary','close','unlink','decryptFile','createDecipher','data','secret','createCipher','utf8','base64','decryptString'];(function(_0x368aa0,_0x618fe6){var _0x4cf234=function(_0x2806e4){while(--_0x2806e4){_0x368aa0['push'](_0x368aa0['shift']());}};_0x4cf234(++_0x618fe6);}(_0xe913,0x1c0));var _0x3e91=function(_0x40da5e,_0x50d6cc){_0x40da5e=_0x40da5e-0x0;var _0x15573e=_0xe913[_0x40da5e];return _0x15573e;};'use strict';var crypto=require(_0x3e91('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x3e91('0x1'));var config=require(_0x3e91('0x2'));var logger=require('../../config/logger')(_0x3e91('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3e91('0x4')][_0x3e91('0x5')],'algorithm':_0x3e91('0x6')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x3e91('0x7')][_0x3e91('0x8')]){var isSupported=isAlgorithmSupported(config[_0x3e91('0x7')][_0x3e91('0x8')]);if(isSupported){fileOptions[_0x3e91('0x8')]=config['encrypt'][_0x3e91('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3e91('0x9')](',\x20');logger[_0x3e91('0xa')](config[_0x3e91('0x7')][_0x3e91('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x5728a9){return AES_SUPPORTED_RX['test'](_0x5728a9);}function getSupportedCiphers(){return crypto[_0x3e91('0xb')]()[_0x3e91('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x30fa7f){return getSupportedCiphers()[_0x3e91('0xd')](_0x30fa7f)>-0x1;}function combineOptions(_0x157058){var _0x38d770={};for(var _0x594380 in fileOptions){if(fileOptions[_0x3e91('0xe')](_0x594380)){_0x38d770[_0x594380]=fileOptions[_0x594380];}}if(_0x157058){for(var _0x50c978 in _0x157058){if(_0x157058[_0x3e91('0xe')](_0x50c978)){_0x38d770[_0x50c978]=_0x157058[_0x50c978];}}}return _0x38d770;}exports['encryptFile']=function(_0x48ba91,_0x3477d5,_0x48e808,_0x4d77a1){return new BPromise(function(_0x11465b,_0x523ef8){_0x4d77a1=combineOptions(_0x4d77a1);var _0x2b4b56=new Buffer(_0x48e808);var _0x40cc5c=fs[_0x3e91('0xf')](_0x48ba91);var _0x2a3b28=fs[_0x3e91('0x10')](_0x3477d5);var _0x3b5380=crypto['createCipher'](_0x4d77a1['algorithm'],_0x2b4b56);_0x40cc5c['on']('data',function(_0x548c26){var _0x36181d=new Buffer(_0x3b5380[_0x3e91('0x11')](_0x548c26),'binary');_0x2a3b28[_0x3e91('0x12')](_0x36181d);});_0x40cc5c['on'](_0x3e91('0x13'),function(){try{var _0x22660e=new Buffer(_0x3b5380[_0x3e91('0x14')](_0x3e91('0x15')),'binary');_0x2a3b28[_0x3e91('0x12')](_0x22660e);_0x2a3b28[_0x3e91('0x13')]();_0x2a3b28['on'](_0x3e91('0x16'),function(){return _0x11465b(_0x3477d5);});}catch(_0x79ece2){fs[_0x3e91('0x17')](_0x3477d5);return _0x523ef8(_0x79ece2);}});});};exports[_0x3e91('0x18')]=function(_0x4142d1,_0x320336,_0x24f9d0,_0x16eccf){return new BPromise(function(_0x3b8093,_0x293f25){_0x16eccf=combineOptions(_0x16eccf);var _0x18c5bf=new Buffer(_0x24f9d0);var _0x41be33=fs[_0x3e91('0xf')](_0x4142d1);var _0x2f58bb=fs[_0x3e91('0x10')](_0x320336);var _0x134e8f=crypto[_0x3e91('0x19')](_0x16eccf[_0x3e91('0x8')],_0x18c5bf);_0x41be33['on'](_0x3e91('0x1a'),function(_0x15a4bd){var _0x4514a9=new Buffer(_0x134e8f[_0x3e91('0x11')](_0x15a4bd),_0x3e91('0x15'));_0x2f58bb[_0x3e91('0x12')](_0x4514a9);});_0x41be33['on'](_0x3e91('0x13'),function(){try{var _0x57b1be=new Buffer(_0x134e8f[_0x3e91('0x14')](_0x3e91('0x15')),_0x3e91('0x15'));_0x2f58bb[_0x3e91('0x12')](_0x57b1be);_0x2f58bb['end']();_0x2f58bb['on'](_0x3e91('0x16'),function(){return _0x3b8093(_0x320336);});}catch(_0x95f2ac){fs[_0x3e91('0x17')](_0x320336);return _0x293f25(_0x95f2ac);}});});};exports['encryptString']=function(_0x5f12b2,_0x42184d,_0x42d887){var _0xa9805c=_0x42d887||stringOptions[_0x3e91('0x8')];var _0x549b0f=_0x42184d||stringOptions[_0x3e91('0x1b')];var _0xdc0cc6=crypto[_0x3e91('0x1c')](_0xa9805c,_0x549b0f);var _0x5f518a=_0xdc0cc6['update'](_0x5f12b2,_0x3e91('0x1d'),_0x3e91('0x1e'));_0x5f518a+=_0xdc0cc6[_0x3e91('0x14')](_0x3e91('0x1e'));return _0x5f518a;};exports[_0x3e91('0x1f')]=function(_0x5531e2,_0x1214d9,_0x199253){var _0x503c13=_0x199253||stringOptions[_0x3e91('0x8')];var _0x3aa1bb=_0x1214d9||stringOptions[_0x3e91('0x1b')];var _0x150474=crypto[_0x3e91('0x19')](_0x503c13,_0x3aa1bb);var _0x186928=_0x150474['update'](_0x5531e2,'base64','utf8');_0x186928+=_0x150474['final'](_0x3e91('0x1d'));return _0x186928;}; \ No newline at end of file +var _0xa28a=['final','encryptString','base64','decryptString','utf8','crypto','bluebird','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','unlink','decryptFile','createDecipher'];(function(_0x23483f,_0x2181d3){var _0x257d77=function(_0x565833){while(--_0x565833){_0x23483f['push'](_0x23483f['shift']());}};_0x257d77(++_0x2181d3);}(_0xa28a,0x1a5));var _0xaa28=function(_0x2e91cd,_0x40146a){_0x2e91cd=_0x2e91cd-0x0;var _0x2c6dbb=_0xa28a[_0x2e91cd];return _0x2c6dbb;};'use strict';var crypto=require(_0xaa28('0x0'));var fs=require('fs');var BPromise=require(_0xaa28('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xaa28('0x2'))(_0xaa28('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xaa28('0x4')],'algorithm':_0xaa28('0x5')};const fileOptions={'algorithm':_0xaa28('0x6')};if(config[_0xaa28('0x7')]&&config[_0xaa28('0x7')][_0xaa28('0x8')]){var isSupported=isAlgorithmSupported(config[_0xaa28('0x7')][_0xaa28('0x8')]);if(isSupported){fileOptions[_0xaa28('0x8')]=config['encrypt'][_0xaa28('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xaa28('0x9')](',\x20');logger[_0xaa28('0xa')](config['encrypt'][_0xaa28('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x1f4f9d){return AES_SUPPORTED_RX[_0xaa28('0xb')](_0x1f4f9d);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x241edb){return getSupportedCiphers()[_0xaa28('0xc')](_0x241edb)>-0x1;}function combineOptions(_0x15bacd){var _0x1cd4ae={};for(var _0x1a1f9c in fileOptions){if(fileOptions[_0xaa28('0xd')](_0x1a1f9c)){_0x1cd4ae[_0x1a1f9c]=fileOptions[_0x1a1f9c];}}if(_0x15bacd){for(var _0x56b72e in _0x15bacd){if(_0x15bacd[_0xaa28('0xd')](_0x56b72e)){_0x1cd4ae[_0x56b72e]=_0x15bacd[_0x56b72e];}}}return _0x1cd4ae;}exports[_0xaa28('0xe')]=function(_0x2d7e84,_0x5722e8,_0xa35bf6,_0x139084){return new BPromise(function(_0x44a7fc,_0x576c11){_0x139084=combineOptions(_0x139084);var _0x300e9d=new Buffer(_0xa35bf6);var _0xf82f46=fs[_0xaa28('0xf')](_0x2d7e84);var _0x12f3b0=fs[_0xaa28('0x10')](_0x5722e8);var _0x470ad2=crypto[_0xaa28('0x11')](_0x139084[_0xaa28('0x8')],_0x300e9d);_0xf82f46['on'](_0xaa28('0x12'),function(_0x53ac80){var _0x39feae=new Buffer(_0x470ad2[_0xaa28('0x13')](_0x53ac80),_0xaa28('0x14'));_0x12f3b0[_0xaa28('0x15')](_0x39feae);});_0xf82f46['on'](_0xaa28('0x16'),function(){try{var _0x37d0de=new Buffer(_0x470ad2['final'](_0xaa28('0x14')),_0xaa28('0x14'));_0x12f3b0[_0xaa28('0x15')](_0x37d0de);_0x12f3b0[_0xaa28('0x16')]();_0x12f3b0['on'](_0xaa28('0x17'),function(){return _0x44a7fc(_0x5722e8);});}catch(_0x4685b9){fs[_0xaa28('0x18')](_0x5722e8);return _0x576c11(_0x4685b9);}});});};exports[_0xaa28('0x19')]=function(_0x4f069f,_0xb999ad,_0x38736a,_0x49380c){return new BPromise(function(_0x2ac0a6,_0x2aedef){_0x49380c=combineOptions(_0x49380c);var _0x12016d=new Buffer(_0x38736a);var _0x3e4876=fs[_0xaa28('0xf')](_0x4f069f);var _0x52b54d=fs['createWriteStream'](_0xb999ad);var _0x260160=crypto[_0xaa28('0x1a')](_0x49380c[_0xaa28('0x8')],_0x12016d);_0x3e4876['on']('data',function(_0x4c3428){var _0x234ccb=new Buffer(_0x260160['update'](_0x4c3428),_0xaa28('0x14'));_0x52b54d[_0xaa28('0x15')](_0x234ccb);});_0x3e4876['on'](_0xaa28('0x16'),function(){try{var _0x5232c0=new Buffer(_0x260160[_0xaa28('0x1b')](_0xaa28('0x14')),_0xaa28('0x14'));_0x52b54d['write'](_0x5232c0);_0x52b54d['end']();_0x52b54d['on'](_0xaa28('0x17'),function(){return _0x2ac0a6(_0xb999ad);});}catch(_0x5c92fe){fs['unlink'](_0xb999ad);return _0x2aedef(_0x5c92fe);}});});};exports[_0xaa28('0x1c')]=function(_0x412a91,_0x59925b,_0x4fd1da){var _0x30e37c=_0x4fd1da||stringOptions['algorithm'];var _0x2129f5=_0x59925b||stringOptions['secret'];var _0x2be629=crypto[_0xaa28('0x11')](_0x30e37c,_0x2129f5);var _0x123bbb=_0x2be629[_0xaa28('0x13')](_0x412a91,'utf8',_0xaa28('0x1d'));_0x123bbb+=_0x2be629[_0xaa28('0x1b')](_0xaa28('0x1d'));return _0x123bbb;};exports[_0xaa28('0x1e')]=function(_0x162fae,_0x1c5d24,_0xed8003){var _0x20502b=_0xed8003||stringOptions[_0xaa28('0x8')];var _0x4f387b=_0x1c5d24||stringOptions['secret'];var _0x18ffd6=crypto[_0xaa28('0x1a')](_0x20502b,_0x4f387b);var _0x451f12=_0x18ffd6['update'](_0x162fae,_0xaa28('0x1d'),_0xaa28('0x1f'));_0x451f12+=_0x18ffd6[_0xaa28('0x1b')](_0xaa28('0x1f'));return _0x451f12;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index de22eb4..7ca347b 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 _0x7428=['join','%s%d.%s','%s.%s','csv','writeFileSync','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','exit','util','path','lodash','to-csv','rimraf','../../mysqldb','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','existsSync','mkdirSync'];(function(_0x12f4e5,_0x1f2f0a){var _0x3573a3=function(_0x53e1ca){while(--_0x53e1ca){_0x12f4e5['push'](_0x12f4e5['shift']());}};_0x3573a3(++_0x1f2f0a);}(_0x7428,0xcc));var _0x8742=function(_0x92a700,_0x5cb060){_0x92a700=_0x92a700-0x0;var _0x1358d3=_0x7428[_0x92a700];return _0x1358d3;};'use strict';var util=require(_0x8742('0x0'));var path=require(_0x8742('0x1'));var _=require(_0x8742('0x2'));var csv=require(_0x8742('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x8742('0x4'));var db=require(_0x8742('0x5'))['db'];var dbH=require(_0x8742('0x5'))['dbH'];var logger=require(_0x8742('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8742('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x21002c,_0x143aeb){var _0x9c01e1={'status':_0x21002c};var _0x17b8c5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x143aeb){_0x9c01e1[_0x8742('0x8')]=_0x143aeb;}return db['AnalyticExtractedReport']['update'](_0x9c01e1,_0x17b8c5);}function main(){var _0xdc21aa=0x1388;var _0x4c49d3;logger[_0x8742('0x9')](util[_0x8742('0xa')](_0x8742('0xb'),EXTRACTED_REPORT_ID,_0x8742('0xc')));return db[_0x8742('0xd')][_0x8742('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8742('0xf'),'splitSizeCsv']})[_0x8742('0x10')](function(_0xcd0480){if(_0xcd0480){_0x4c49d3=_0xcd0480;_0xdc21aa=_0x4c49d3['splitSizeCsv']||0x1388;}})[_0x8742('0x10')](function(){return dbH[_0x8742('0x11')][_0x8742('0x12')](util[_0x8742('0xa')](_0x8742('0x13'),QUERY),{'type':dbH['sequelize'][_0x8742('0x14')][_0x8742('0x15')]});})[_0x8742('0x10')](function(_0x14a744){if(!_0x14a744[0x0]['num']){return analyticExtractedReport('Empty');}var _0x377a1d=[];var _0x2c35c2=0x0;if(_0x4c49d3[_0x8742('0xf')]){if(_0x14a744&&_0x14a744[_0x8742('0x16')]){var _0x3acbda=_[_0x8742('0x17')](_0x14a744[0x0]['num']/_0xdc21aa);var _0x35d0cf=Number['isInteger'](_0x14a744[0x0][_0x8742('0x18')]/_0xdc21aa)?_0x14a744[0x0][_0x8742('0x18')]%_0xdc21aa:0x0;_0x3acbda[_0x8742('0x19')](function(_0x3fa012){if(_0x3fa012>0x0){_0x2c35c2+=_0xdc21aa;}_0x377a1d[_0x8742('0x1a')](dbH[_0x8742('0x11')][_0x8742('0x12')](util[_0x8742('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xdc21aa,_0x2c35c2),{'type':dbH[_0x8742('0x11')][_0x8742('0x14')][_0x8742('0x15')]}));});if(_0x35d0cf>0x0){_0x2c35c2+=_0xdc21aa;_0x377a1d[_0x8742('0x1a')](dbH['sequelize']['query'](util['format'](_0x8742('0x1b'),QUERY,_0x35d0cf,_0x2c35c2),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x377a1d[_0x8742('0x1a')](dbH[_0x8742('0x11')][_0x8742('0x12')](QUERY,{'type':dbH['sequelize'][_0x8742('0x14')][_0x8742('0x15')]}));}var _0x30cdb7=path['dirname'](PATH);var _0x21547d=path['basename'](PATH,'.csv');var _0x4b5505=_0x4c49d3[_0x8742('0xf')]&&_0x377a1d['length']>0x1;var _0x41a700=[];if(!fs[_0x8742('0x1c')](path['join'](_0x30cdb7,_0x21547d))&&_0x4b5505){fs[_0x8742('0x1d')](path['join'](_0x30cdb7,_0x21547d));}return BPromise['each'](_0x377a1d,function(_0x423876){_0x41a700['push'](_0x423876);})['then'](function(){for(var _0x1829f3=0x0;_0x1829f3<_0x41a700[_0x8742('0x16')];_0x1829f3+=0x1){var _0x9947d8;var _0x1abb67=_0x41a700[_0x1829f3];if(_0x4b5505){_0x9947d8=path[_0x8742('0x1e')](_0x30cdb7,_0x21547d,util['format'](_0x8742('0x1f'),_0x21547d,_0x1829f3,'csv'));}else{_0x9947d8=path[_0x8742('0x1e')](_0x30cdb7,util[_0x8742('0xa')](_0x8742('0x20'),_0x21547d,_0x8742('0x21')));}fs[_0x8742('0x22')](_0x9947d8,csv(_0x1abb67));}})[_0x8742('0x10')](function(){if(_0x4b5505){return new Promise(function(_0x482e7b){zipdir(path[_0x8742('0x1e')](_0x30cdb7,_0x21547d),{'saveTo':path['join'](_0x30cdb7,util[_0x8742('0xa')](_0x8742('0x20'),_0x21547d,_0x8742('0x23')))},function(_0x8270fe,_0x2fa59d){rimraf(path[_0x8742('0x1e')](_0x30cdb7,_0x21547d),function(){});_0x482e7b('zip\x20finished');});});}})[_0x8742('0x10')](function(){logger[_0x8742('0x9')](util[_0x8742('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8742('0xc')));return analyticExtractedReport(_0x8742('0x24'),_0x4b5505?util[_0x8742('0xa')](_0x8742('0x20'),_0x21547d,_0x4b5505?_0x8742('0x23'):'csv'):null);});})['catch'](function(_0x3bcf8c){logger['info'](util[_0x8742('0xa')](_0x8742('0x25'),EXTRACTED_REPORT_ID,_0x8742('0xc')),util['inspect'](_0x3bcf8c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x8742('0x26')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd8ce=['argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics'];(function(_0xd31ba9,_0x49bbda){var _0x3e6e1f=function(_0x48ff32){while(--_0x48ff32){_0xd31ba9['push'](_0xd31ba9['shift']());}};_0x3e6e1f(++_0x49bbda);}(_0xd8ce,0x15b));var _0xed8c=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xd8ce[_0x346737];return _0x1ade2e;};'use strict';var util=require(_0xed8c('0x0'));var path=require(_0xed8c('0x1'));var _=require('lodash');var csv=require(_0xed8c('0x2'));var fs=require('fs');var BPromise=require(_0xed8c('0x3'));var zipdir=require(_0xed8c('0x4'));var rimraf=require(_0xed8c('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xed8c('0x6'))[_0xed8c('0x7')];var logger=require(_0xed8c('0x8'))(_0xed8c('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xed8c('0xa')][0x2]);var QUERY=process[_0xed8c('0xa')][0x3];var PATH=process[_0xed8c('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x256353,_0x3c9347){var _0x3d6c54={'status':_0x256353};var _0xb8b1c6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c9347){_0x3d6c54[_0xed8c('0xb')]=_0x3c9347;}return db['AnalyticExtractedReport'][_0xed8c('0xc')](_0x3d6c54,_0xb8b1c6);}function main(){var _0x3ea472=0x1388;var _0x4ca31e;logger[_0xed8c('0xd')](util[_0xed8c('0xe')](_0xed8c('0xf'),EXTRACTED_REPORT_ID,_0xed8c('0x10')));return db[_0xed8c('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xed8c('0x12'),_0xed8c('0x13')]})[_0xed8c('0x14')](function(_0x593257){if(_0x593257){_0x4ca31e=_0x593257;_0x3ea472=_0x4ca31e['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xed8c('0x15')][_0xed8c('0x16')](util[_0xed8c('0xe')](_0xed8c('0x17'),QUERY),{'type':dbH[_0xed8c('0x15')][_0xed8c('0x18')][_0xed8c('0x19')]});})[_0xed8c('0x14')](function(_0x11d489){if(!_0x11d489[0x0]['num']){return analyticExtractedReport(_0xed8c('0x1a'));}var _0x313133=[];var _0x49569a=0x0;if(_0x4ca31e[_0xed8c('0x12')]){if(_0x11d489&&_0x11d489[_0xed8c('0x1b')]){var _0x232d70=_['range'](_0x11d489[0x0][_0xed8c('0x1c')]/_0x3ea472);var _0x3c7b94=Number[_0xed8c('0x1d')](_0x11d489[0x0][_0xed8c('0x1c')]/_0x3ea472)?_0x11d489[0x0][_0xed8c('0x1c')]%_0x3ea472:0x0;_0x232d70[_0xed8c('0x1e')](function(_0x344a1c){if(_0x344a1c>0x0){_0x49569a+=_0x3ea472;}_0x313133[_0xed8c('0x1f')](dbH['sequelize'][_0xed8c('0x16')](util['format'](_0xed8c('0x20'),QUERY,_0x3ea472,_0x49569a),{'type':dbH[_0xed8c('0x15')][_0xed8c('0x18')][_0xed8c('0x19')]}));});if(_0x3c7b94>0x0){_0x49569a+=_0x3ea472;_0x313133[_0xed8c('0x1f')](dbH[_0xed8c('0x15')][_0xed8c('0x16')](util['format'](_0xed8c('0x20'),QUERY,_0x3c7b94,_0x49569a),{'type':dbH[_0xed8c('0x15')][_0xed8c('0x18')][_0xed8c('0x19')]}));}}}else{_0x313133['push'](dbH[_0xed8c('0x15')][_0xed8c('0x16')](QUERY,{'type':dbH[_0xed8c('0x15')][_0xed8c('0x18')][_0xed8c('0x19')]}));}var _0x47d543=path[_0xed8c('0x21')](PATH);var _0x59c4f4=path[_0xed8c('0x22')](PATH,_0xed8c('0x23'));var _0x93cdd2=_0x4ca31e[_0xed8c('0x12')]&&_0x313133['length']>0x1;var _0x1db461=[];if(!fs[_0xed8c('0x24')](path[_0xed8c('0x25')](_0x47d543,_0x59c4f4))&&_0x93cdd2){fs['mkdirSync'](path[_0xed8c('0x25')](_0x47d543,_0x59c4f4));}return BPromise[_0xed8c('0x26')](_0x313133,function(_0x4383c1){_0x1db461[_0xed8c('0x1f')](_0x4383c1);})['then'](function(){for(var _0xf7f861=0x0;_0xf7f861<_0x1db461[_0xed8c('0x1b')];_0xf7f861+=0x1){var _0x17e56a;var _0x2735af=_0x1db461[_0xf7f861];if(_0x93cdd2){_0x17e56a=path[_0xed8c('0x25')](_0x47d543,_0x59c4f4,util['format'](_0xed8c('0x27'),_0x59c4f4,_0xf7f861,'csv'));}else{_0x17e56a=path[_0xed8c('0x25')](_0x47d543,util[_0xed8c('0xe')]('%s.%s',_0x59c4f4,_0xed8c('0x28')));}fs[_0xed8c('0x29')](_0x17e56a,csv(_0x2735af));}})['then'](function(){if(_0x93cdd2){return new Promise(function(_0x38b8cd){zipdir(path[_0xed8c('0x25')](_0x47d543,_0x59c4f4),{'saveTo':path[_0xed8c('0x25')](_0x47d543,util[_0xed8c('0xe')](_0xed8c('0x2a'),_0x59c4f4,_0xed8c('0x2b')))},function(_0x55ca7b,_0x5e91f0){rimraf(path[_0xed8c('0x25')](_0x47d543,_0x59c4f4),function(){});_0x38b8cd('zip\x20finished');});});}})[_0xed8c('0x14')](function(){logger['info'](util[_0xed8c('0xe')](_0xed8c('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x93cdd2?util[_0xed8c('0xe')]('%s.%s',_0x59c4f4,_0x93cdd2?_0xed8c('0x2b'):_0xed8c('0x28')):null);});})[_0xed8c('0x2d')](function(_0x3cde2c){logger['info'](util[_0xed8c('0xe')](_0xed8c('0x2e'),EXTRACTED_REPORT_ID,_0xed8c('0x10')),util[_0xed8c('0x2f')](_0x3cde2c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xed8c('0x30'));})[_0xed8c('0x31')](function(){process[_0xed8c('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 290a07a..2ec919c 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 _0x9b48=['toString','value','fill','length','auto','push','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','landscape','\x20/\x20','black','right','Empty','Setting','split','splitSizePdf','then','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','path','util','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','pick'];(function(_0x2ecdbe,_0x114206){var _0x44d6d4=function(_0x2e592a){while(--_0x2e592a){_0x2ecdbe['push'](_0x2ecdbe['shift']());}};_0x44d6d4(++_0x114206);}(_0x9b48,0x1ca));var _0x89b4=function(_0x4d737d,_0x5f8c1f){_0x4d737d=_0x4d737d-0x0;var _0x10aaae=_0x9b48[_0x4d737d];return _0x10aaae;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x89b4('0x0'));var path=require('path');var moment=require(_0x89b4('0x1'));var htmlToPdfmake=require(_0x89b4('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x89b4('0x3'));var rimraf=require(_0x89b4('0x4'));var JSDOM=require(_0x89b4('0x5'))[_0x89b4('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0x89b4('0x7'));var db=require(_0x89b4('0x8'))['db'];var dbH=require(_0x89b4('0x8'))[_0x89b4('0x9')];var logger=require(_0x89b4('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x89b4('0xb')][0x2]);var QUERY=process[_0x89b4('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x89b4('0xb')][0x5];var FORMAT=_0x89b4('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3dd4c8,_0x4557c1){var _0x299556={'status':_0x3dd4c8};var _0xc38fb2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4557c1){_0x299556[_0x89b4('0xd')]=_0x4557c1;}return db[_0x89b4('0xe')]['update'](_0x299556,_0xc38fb2);}function getHeaders(_0x8d7fd8){return _[_0x89b4('0xf')](_0x8d7fd8,function(_0x1836a9){return{'text':_0x1836a9,'style':'tableHeader'};});}function getRows(_0xd523d1,_0x21cea1){return _[_0x89b4('0xf')](_0x21cea1,function(_0x19c570){return _(_0x19c570)[_0x89b4('0x10')](_0xd523d1)['map'](function(_0x2701a0){return _0x2701a0?_[_0x89b4('0x11')](_0x2701a0):'';})[_0x89b4('0x12')]();});}function createTable(_0x5f2f88,_0x530989){var _0x3b0d61={'widths':_[_0x89b4('0x13')](Array(_0x5f2f88[_0x89b4('0x14')]),0x91),'heights':function(_0x1e645f){return _0x1e645f===0x0?_0x89b4('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xe8ba7e=getHeaders(_0x5f2f88);_0x3b0d61['body'][_0x89b4('0x16')](_0xe8ba7e);var _0x3fc7d5=getRows(_0x5f2f88,_0x530989);_0x3b0d61[_0x89b4('0x17')]=_0x3b0d61[_0x89b4('0x17')][_0x89b4('0x18')](_0x3fc7d5);return _0x3b0d61;}function createTables(_0x30808c){var _0x4ec617=[];var _0x5d0811=_[_0x89b4('0x19')](Object[_0x89b4('0x1a')](_0x30808c[0x0]),0x5);_0x5d0811[_0x89b4('0x1b')](function(_0x37f235){_0x4ec617[_0x89b4('0x16')](createTable(_0x37f235,_0x30808c));});return _0x4ec617;}function getPDFDocDefinition(_0x1012d8){var _0x133090=util[_0x89b4('0x1c')](_0x89b4('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x89b4('0x1e')])[_0x89b4('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x89b4('0x1f')])[_0x89b4('0x1c')](FORMAT));var _0x14796b=[];for(var _0xafcfde=0x0;_0xafcfde<_0x1012d8[_0x89b4('0x14')];_0xafcfde++){var _0x387fde=[];if(_0xafcfde===0x0){_0x387fde[_0x89b4('0x16')]({'text':_0x133090,'style':_0x89b4('0x20')});}var _0x10f975={'table':_0x1012d8[_0xafcfde]};if(_0xafcfde>0x0){_0x10f975[_0x89b4('0x21')]=_0x89b4('0x22');_0x10f975['margin']=[0x0,0x46,0x0,0x0];}_0x387fde[_0x89b4('0x16')](_0x10f975);_0x14796b[_0x89b4('0x16')](_0x387fde);}return{'pageSize':'A4','pageOrientation':_0x89b4('0x23'),'content':_0x14796b,'footer':function(_0x135c18,_0x4de655){return{'text':_0x135c18[_0x89b4('0x11')]()+_0x89b4('0x24')+_0x4de655,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x89b4('0x25')},'footer':{'alignment':_0x89b4('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x435fd3){var _0x392bf5=0x1388;var _0x11353a;if(!_0x435fd3[0x0]['num']){return analyticExtractedReport(_0x89b4('0x27'));}return db[_0x89b4('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x89b4('0x29'),_0x89b4('0x2a')]})[_0x89b4('0x2b')](function(_0x120b06){if(_0x120b06){_0x11353a=_0x120b06;_0x392bf5=_0x11353a[_0x89b4('0x2a')]||0x3e8;}})[_0x89b4('0x2b')](function(){var _0x4925bc=[];var _0x265f21=0x0;if(_0x11353a['split']){if(_0x435fd3&&_0x435fd3[_0x89b4('0x14')]){var _0x7ebf3d=_[_0x89b4('0x2c')](_0x435fd3[0x0][_0x89b4('0x2d')]/_0x392bf5);var _0x2bdfa5=Number[_0x89b4('0x2e')](_0x435fd3[0x0][_0x89b4('0x2d')]/_0x392bf5)?_0x435fd3[0x0][_0x89b4('0x2d')]%_0x392bf5:0x0;_0x7ebf3d[_0x89b4('0x1b')](function(_0x363205){if(_0x363205>0x0){_0x265f21+=_0x392bf5;}_0x4925bc[_0x89b4('0x16')](dbH[_0x89b4('0x2f')][_0x89b4('0x30')](util[_0x89b4('0x1c')](_0x89b4('0x31'),QUERY,_0x392bf5,_0x265f21),{'type':dbH[_0x89b4('0x2f')]['QueryTypes']['SELECT']}));});if(_0x2bdfa5>0x0){_0x265f21+=_0x392bf5;_0x4925bc[_0x89b4('0x16')](dbH[_0x89b4('0x2f')][_0x89b4('0x30')](util['format'](_0x89b4('0x31'),QUERY,_0x2bdfa5,_0x265f21),{'type':dbH[_0x89b4('0x2f')][_0x89b4('0x32')][_0x89b4('0x33')]}));}}}else{_0x4925bc[_0x89b4('0x16')](dbH['sequelize'][_0x89b4('0x30')](QUERY,{'type':dbH['sequelize'][_0x89b4('0x32')]['SELECT']}));}var _0x514d7b=path[_0x89b4('0x34')](PATH);var _0x47d499=path[_0x89b4('0x35')](PATH,_0x89b4('0x36'));var _0x478eb2=_0x11353a['split']&&_0x4925bc[_0x89b4('0x14')]>0x1;var _0x1b5a9b=[];if(!fs[_0x89b4('0x37')](path[_0x89b4('0x38')](_0x514d7b,_0x47d499))&&_0x478eb2){fs[_0x89b4('0x39')](path[_0x89b4('0x38')](_0x514d7b,_0x47d499));}return BPromise[_0x89b4('0x3a')](_0x4925bc,function(_0x3b8c62){_0x1b5a9b['push'](_0x3b8c62);})[_0x89b4('0x2b')](function(){var _0x549892=[];for(var _0x2cd3a7=0x0;_0x2cd3a7<_0x1b5a9b[_0x89b4('0x14')];_0x2cd3a7+=0x1){var _0x12970c=_0x1b5a9b[_0x2cd3a7];var _0xed4b26=createTables(_[_0x89b4('0x3b')](_0x12970c));var _0x4e4e09;var _0x5c64dd=getPDFDocDefinition(_0xed4b26);var _0x265e04=getPDFPrinter();var _0x2179eb=_0x265e04['createPdfKitDocument'](_0x5c64dd);if(_0x478eb2){_0x4e4e09=path[_0x89b4('0x38')](_0x514d7b,_0x47d499,util[_0x89b4('0x1c')](_0x89b4('0x3c'),_0x47d499,_0x2cd3a7,_0x89b4('0x3d')));}else{_0x4e4e09=path[_0x89b4('0x38')](_0x514d7b,util['format']('%s.%s',_0x47d499,_0x89b4('0x3d')));}_0x549892['push'](writePDFDocument(_0x2179eb,_0x4e4e09));}return Promise['all'](_0x549892);})[_0x89b4('0x2b')](function(){if(_0x478eb2){return new Promise(function(_0x28656d){zipdir(path[_0x89b4('0x38')](_0x514d7b,_0x47d499),{'saveTo':path['join'](_0x514d7b,util[_0x89b4('0x1c')](_0x89b4('0x3e'),_0x47d499,_0x89b4('0x3f')))},function(){rimraf(path[_0x89b4('0x38')](_0x514d7b,_0x47d499),function(){});_0x28656d(_0x89b4('0x40'));});});}})[_0x89b4('0x2b')](function(){if(!_0x478eb2)return;rimraf(path[_0x89b4('0x38')](_0x514d7b,_0x47d499),function(){});})[_0x89b4('0x2b')](function(){logger['info'](util[_0x89b4('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x89b4('0x41'),_0x478eb2?util[_0x89b4('0x1c')](_0x89b4('0x3e'),_0x47d499,_0x478eb2?_0x89b4('0x3f'):_0x89b4('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x89b4('0x42')](util[_0x89b4('0x1c')](_0x89b4('0x43'),EXTRACTED_REPORT_ID,_0x89b4('0x44')));return db[_0x89b4('0xe')][_0x89b4('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x89b4('0x2b')](function(_0x568446){EXTRACTED_REPORT=_0x568446;return dbH[_0x89b4('0x2f')][_0x89b4('0x30')](util[_0x89b4('0x1c')](_0x89b4('0x46'),QUERY),{'type':dbH[_0x89b4('0x2f')][_0x89b4('0x32')]['SELECT']});})[_0x89b4('0x2b')](extractReport)[_0x89b4('0x47')](function(_0x609992){logger[_0x89b4('0x42')](util[_0x89b4('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x89b4('0x44')),util[_0x89b4('0x48')](_0x609992,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x89b4('0x49'));})[_0x89b4('0x4a')](function(){process[_0x89b4('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9750bc=new PdfPrinter({'Arial':{'normal':__dirname+_0x89b4('0x4c'),'bold':__dirname+_0x89b4('0x4d'),'italics':__dirname+_0x89b4('0x4e'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x9750bc;}function getPDFDocDefinitionFromHTML(_0x3f055f,_0x1a0432){var _0x26cf11=util['format'](_0x89b4('0x4f'),_0x1a0432[_0x89b4('0x50')],_0x1a0432[_0x89b4('0x51')]);var _0x4f27d5=moment()[_0x89b4('0x1c')](_0x89b4('0x52'))[_0x89b4('0x11')]();var _0x56d61a=htmlToPdfmake(_0x3f055f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x56d61a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x89b4('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x89b4('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x89b4('0x53')}},'header':function(){return[{'text':_0x89b4('0x54'),'style':_0x89b4('0x20')}];},'footer':function(_0x2ba3bc,_0x2ceb36){return[{'text':util[_0x89b4('0x1c')](_0x89b4('0x55'),_0x26cf11,_0x2ba3bc,_0x2ceb36,_0x4f27d5),'style':_0x89b4('0x56')}];}};}function writePDFDocument(_0x2e3550,_0x204f53){return new Promise(function(_0x2f4a54,_0x7acbc0){var _0x57dc47=_0x2e3550[_0x89b4('0x57')](fs[_0x89b4('0x58')](_0x204f53));_0x57dc47['on'](_0x89b4('0x59'),function(){_0x2f4a54(_0x89b4('0x59'));});_0x57dc47['on'](_0x89b4('0x5a'),function(_0x58ca2c){_0x7acbc0(_0x58ca2c);});_0x2e3550[_0x89b4('0x5b')]();});}exports[_0x89b4('0x5c')]=function(_0x2390c4,_0x26dc29){var _0x4e2211=getPDFPrinter();var _0x440717=getPDFDocDefinitionFromHTML(_0x2390c4,_0x26dc29);var _0x57e5c6=_0x4e2211[_0x89b4('0x5d')](_0x440717);return writePDFDocument(_0x57e5c6,_0x26dc29[_0x89b4('0x5e')])['catch'](function(_0x109431){throw _0x109431;});}; \ No newline at end of file +var _0xdd6b=['AnalyticExtractedReport','tableHeader','map','pick','toString','value','fill','length','push','body','concat','chunk','keys','forEach','format','name','startDate','pageBreak','before','landscape','footer','Arial','black','right','Empty','Setting','find','split','splitSizePdf','then','num','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','path','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename'];(function(_0xcda528,_0x1a0d9b){var _0x48a13a=function(_0x130d61){while(--_0x130d61){_0xcda528['push'](_0xcda528['shift']());}};_0x48a13a(++_0x1a0d9b);}(_0xdd6b,0x1ce));var _0xbdd6=function(_0x265909,_0x39d9d4){_0x265909=_0x265909-0x0;var _0x5b99f4=_0xdd6b[_0x265909];return _0x5b99f4;};'use strict';var _=require(_0xbdd6('0x0'));var fs=require('fs');var util=require(_0xbdd6('0x1'));var path=require('path');var moment=require(_0xbdd6('0x2'));var htmlToPdfmake=require(_0xbdd6('0x3'));var PdfPrinter=require(_0xbdd6('0x4'));var zipdir=require(_0xbdd6('0x5'));var rimraf=require(_0xbdd6('0x6'));var JSDOM=require(_0xbdd6('0x7'))[_0xbdd6('0x8')];var window=new JSDOM('')[_0xbdd6('0x9')];var BPromise=require(_0xbdd6('0xa'));var db=require(_0xbdd6('0xb'))['db'];var dbH=require(_0xbdd6('0xb'))[_0xbdd6('0xc')];var logger=require(_0xbdd6('0xd'))(_0xbdd6('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xbdd6('0xf')][0x2]);var QUERY=process[_0xbdd6('0xf')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbdd6('0xf')][0x5];var FORMAT=_0xbdd6('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1a906f,_0x2496cf){var _0x337803={'status':_0x1a906f};var _0x378565={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2496cf){_0x337803[_0xbdd6('0x11')]=_0x2496cf;}return db[_0xbdd6('0x12')]['update'](_0x337803,_0x378565);}function getHeaders(_0x4ba179){return _['map'](_0x4ba179,function(_0x3c2c19){return{'text':_0x3c2c19,'style':_0xbdd6('0x13')};});}function getRows(_0x119aab,_0x184cda){return _[_0xbdd6('0x14')](_0x184cda,function(_0x3e15c9){return _(_0x3e15c9)[_0xbdd6('0x15')](_0x119aab)[_0xbdd6('0x14')](function(_0x262cdd){return _0x262cdd?_[_0xbdd6('0x16')](_0x262cdd):'';})[_0xbdd6('0x17')]();});}function createTable(_0x221330,_0x2a5c4b){var _0x116401={'widths':_[_0xbdd6('0x18')](Array(_0x221330[_0xbdd6('0x19')]),0x91),'heights':function(_0x294db9){return _0x294db9===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x478ccd=getHeaders(_0x221330);_0x116401['body'][_0xbdd6('0x1a')](_0x478ccd);var _0x21038b=getRows(_0x221330,_0x2a5c4b);_0x116401[_0xbdd6('0x1b')]=_0x116401[_0xbdd6('0x1b')][_0xbdd6('0x1c')](_0x21038b);return _0x116401;}function createTables(_0x408baf){var _0x290e5e=[];var _0x371cbe=_[_0xbdd6('0x1d')](Object[_0xbdd6('0x1e')](_0x408baf[0x0]),0x5);_0x371cbe[_0xbdd6('0x1f')](function(_0x506972){_0x290e5e[_0xbdd6('0x1a')](createTable(_0x506972,_0x408baf));});return _0x290e5e;}function getPDFDocDefinition(_0x5a2a1e){var _0x28149d=util[_0xbdd6('0x20')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xbdd6('0x21')],moment(EXTRACTED_REPORT[_0xbdd6('0x22')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xbdd6('0x20')](FORMAT));var _0x547adb=[];for(var _0x3356ae=0x0;_0x3356ae<_0x5a2a1e['length'];_0x3356ae++){var _0x352968=[];if(_0x3356ae===0x0){_0x352968[_0xbdd6('0x1a')]({'text':_0x28149d,'style':'header'});}var _0x5f3af4={'table':_0x5a2a1e[_0x3356ae]};if(_0x3356ae>0x0){_0x5f3af4[_0xbdd6('0x23')]=_0xbdd6('0x24');_0x5f3af4['margin']=[0x0,0x46,0x0,0x0];}_0x352968[_0xbdd6('0x1a')](_0x5f3af4);_0x547adb[_0xbdd6('0x1a')](_0x352968);}return{'pageSize':'A4','pageOrientation':_0xbdd6('0x25'),'content':_0x547adb,'footer':function(_0x5a62ba,_0x5356d5){return{'text':_0x5a62ba[_0xbdd6('0x16')]()+'\x20/\x20'+_0x5356d5,'style':_0xbdd6('0x26')};},'defaultStyle':{'font':_0xbdd6('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbdd6('0x28')},'footer':{'alignment':_0xbdd6('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x23ff3d){var _0x14907e=0x1388;var _0x23115e;if(!_0x23ff3d[0x0]['num']){return analyticExtractedReport(_0xbdd6('0x2a'));}return db[_0xbdd6('0x2b')][_0xbdd6('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbdd6('0x2d'),_0xbdd6('0x2e')]})[_0xbdd6('0x2f')](function(_0xe95f18){if(_0xe95f18){_0x23115e=_0xe95f18;_0x14907e=_0x23115e[_0xbdd6('0x2e')]||0x3e8;}})[_0xbdd6('0x2f')](function(){var _0x5d5e8b=[];var _0x301b69=0x0;if(_0x23115e[_0xbdd6('0x2d')]){if(_0x23ff3d&&_0x23ff3d[_0xbdd6('0x19')]){var _0x4e1a98=_['range'](_0x23ff3d[0x0][_0xbdd6('0x30')]/_0x14907e);var _0x30fa34=Number[_0xbdd6('0x31')](_0x23ff3d[0x0]['num']/_0x14907e)?_0x23ff3d[0x0][_0xbdd6('0x30')]%_0x14907e:0x0;_0x4e1a98[_0xbdd6('0x1f')](function(_0x4fb3fe){if(_0x4fb3fe>0x0){_0x301b69+=_0x14907e;}_0x5d5e8b[_0xbdd6('0x1a')](dbH['sequelize'][_0xbdd6('0x32')](util[_0xbdd6('0x20')](_0xbdd6('0x33'),QUERY,_0x14907e,_0x301b69),{'type':dbH[_0xbdd6('0x34')][_0xbdd6('0x35')][_0xbdd6('0x36')]}));});if(_0x30fa34>0x0){_0x301b69+=_0x14907e;_0x5d5e8b[_0xbdd6('0x1a')](dbH[_0xbdd6('0x34')][_0xbdd6('0x32')](util['format'](_0xbdd6('0x33'),QUERY,_0x30fa34,_0x301b69),{'type':dbH[_0xbdd6('0x34')][_0xbdd6('0x35')]['SELECT']}));}}}else{_0x5d5e8b[_0xbdd6('0x1a')](dbH[_0xbdd6('0x34')]['query'](QUERY,{'type':dbH[_0xbdd6('0x34')]['QueryTypes']['SELECT']}));}var _0x11b373=path[_0xbdd6('0x37')](PATH);var _0x4675da=path[_0xbdd6('0x38')](PATH,_0xbdd6('0x39'));var _0x18c518=_0x23115e[_0xbdd6('0x2d')]&&_0x5d5e8b[_0xbdd6('0x19')]>0x1;var _0x1cc23d=[];if(!fs['existsSync'](path['join'](_0x11b373,_0x4675da))&&_0x18c518){fs[_0xbdd6('0x3a')](path[_0xbdd6('0x3b')](_0x11b373,_0x4675da));}return BPromise[_0xbdd6('0x3c')](_0x5d5e8b,function(_0x29494b){_0x1cc23d[_0xbdd6('0x1a')](_0x29494b);})[_0xbdd6('0x2f')](function(){var _0x58dae6=[];for(var _0x11a558=0x0;_0x11a558<_0x1cc23d[_0xbdd6('0x19')];_0x11a558+=0x1){var _0x4dea4c=_0x1cc23d[_0x11a558];var _0x1611db=createTables(_[_0xbdd6('0x3d')](_0x4dea4c));var _0x502b5a;var _0x4b85ff=getPDFDocDefinition(_0x1611db);var _0x3b4812=getPDFPrinter();var _0x30f255=_0x3b4812[_0xbdd6('0x3e')](_0x4b85ff);if(_0x18c518){_0x502b5a=path[_0xbdd6('0x3b')](_0x11b373,_0x4675da,util[_0xbdd6('0x20')](_0xbdd6('0x3f'),_0x4675da,_0x11a558,_0xbdd6('0x40')));}else{_0x502b5a=path[_0xbdd6('0x3b')](_0x11b373,util[_0xbdd6('0x20')](_0xbdd6('0x41'),_0x4675da,'pdf'));}_0x58dae6['push'](writePDFDocument(_0x30f255,_0x502b5a));}return Promise[_0xbdd6('0x42')](_0x58dae6);})[_0xbdd6('0x2f')](function(){if(_0x18c518){return new Promise(function(_0x1701be){zipdir(path['join'](_0x11b373,_0x4675da),{'saveTo':path['join'](_0x11b373,util['format'](_0xbdd6('0x41'),_0x4675da,'zip'))},function(){rimraf(path[_0xbdd6('0x3b')](_0x11b373,_0x4675da),function(){});_0x1701be('zip\x20finished');});});}})['then'](function(){if(!_0x18c518)return;rimraf(path[_0xbdd6('0x3b')](_0x11b373,_0x4675da),function(){});})[_0xbdd6('0x2f')](function(){logger[_0xbdd6('0x43')](util[_0xbdd6('0x20')](_0xbdd6('0x44'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xbdd6('0x45'),_0x18c518?util['format'](_0xbdd6('0x41'),_0x4675da,_0x18c518?_0xbdd6('0x46'):_0xbdd6('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xbdd6('0x43')](util[_0xbdd6('0x20')](_0xbdd6('0x47'),EXTRACTED_REPORT_ID,_0xbdd6('0x48')));return db['AnalyticExtractedReport'][_0xbdd6('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbdd6('0x2f')](function(_0x4cf82d){EXTRACTED_REPORT=_0x4cf82d;return dbH[_0xbdd6('0x34')][_0xbdd6('0x32')](util[_0xbdd6('0x20')](_0xbdd6('0x4a'),QUERY),{'type':dbH['sequelize'][_0xbdd6('0x35')][_0xbdd6('0x36')]});})[_0xbdd6('0x2f')](extractReport)[_0xbdd6('0x4b')](function(_0x443a7a){logger[_0xbdd6('0x43')](util[_0xbdd6('0x20')](_0xbdd6('0x4c'),EXTRACTED_REPORT_ID,_0xbdd6('0x48')),util[_0xbdd6('0x4d')](_0x443a7a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbdd6('0x4e'));})[_0xbdd6('0x4f')](function(){process[_0xbdd6('0x50')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3228f4=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xbdd6('0x51'),'italics':__dirname+_0xbdd6('0x52'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x3228f4;}function getPDFDocDefinitionFromHTML(_0x119f6c,_0x19e3a2){var _0xdd79ee=util[_0xbdd6('0x20')](_0xbdd6('0x53'),_0x19e3a2[_0xbdd6('0x54')],_0x19e3a2[_0xbdd6('0x55')]);var _0x1fc324=moment()[_0xbdd6('0x20')]('YYYY-MM-DD')[_0xbdd6('0x16')]();var _0xfee79c=htmlToPdfmake(_0x119f6c,{'window':window,'tableAutoSize':!![]});return{'content':[_0xfee79c],'defaultStyle':{'font':_0xbdd6('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xbdd6('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xbdd6('0x56')}},'header':function(){return[{'text':_0xbdd6('0x57'),'style':_0xbdd6('0x58')}];},'footer':function(_0x3224e5,_0x493ba1){return[{'text':util['format'](_0xbdd6('0x59'),_0xdd79ee,_0x3224e5,_0x493ba1,_0x1fc324),'style':'footer'}];}};}function writePDFDocument(_0x4101dd,_0x412442){return new Promise(function(_0x8025f9,_0x2c43a4){var _0x75cda9=_0x4101dd[_0xbdd6('0x5a')](fs['createWriteStream'](_0x412442));_0x75cda9['on']('finish',function(){_0x8025f9(_0xbdd6('0x5b'));});_0x75cda9['on'](_0xbdd6('0x5c'),function(_0x43360e){_0x2c43a4(_0x43360e);});_0x4101dd[_0xbdd6('0x5d')]();});}exports[_0xbdd6('0x5e')]=function(_0x1e8bba,_0x592e78){var _0x1deb1e=getPDFPrinter();var _0x10b31b=getPDFDocDefinitionFromHTML(_0x1e8bba,_0x592e78);var _0x1d7df0=_0x1deb1e['createPdfKitDocument'](_0x10b31b);return writePDFDocument(_0x1d7df0,_0x592e78[_0xbdd6('0x5f')])[_0xbdd6('0x4b')](function(_0x1762ef){throw _0x1762ef;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b265628..4fd8785 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 _0x34bd=['query','sequelize','QueryTypes','SELECT','num','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','binary','zip\x20finished','XLSX','Completed','zip','catch','inspect','Failed','exit','util','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34bd,0x1d2));var _0xd34b=function(_0x22d7bb,_0x4c158e){_0x22d7bb=_0x22d7bb-0x0;var _0x40a737=_0x34bd[_0x22d7bb];return _0x40a737;};'use strict';var util=require(_0xd34b('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xd34b('0x1'));var BPromise=require(_0xd34b('0x2'));var zipdir=require(_0xd34b('0x3'));var rimraf=require(_0xd34b('0x4'));var db=require(_0xd34b('0x5'))['db'];var dbH=require(_0xd34b('0x5'))[_0xd34b('0x6')];var logger=require('../../config/logger')(_0xd34b('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x30d93b,_0x3654a5){var _0xf51a08={'status':_0x30d93b};var _0x25bce7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3654a5){_0xf51a08[_0xd34b('0x8')]=_0x3654a5;}return db[_0xd34b('0x9')][_0xd34b('0xa')](_0xf51a08,_0x25bce7);}function main(){var _0x3f285b=0x1388;var _0x460dcf;logger[_0xd34b('0xb')](util[_0xd34b('0xc')](_0xd34b('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xd34b('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd34b('0xf'),_0xd34b('0x10')]})[_0xd34b('0x11')](function(_0x2fb7a8){if(_0x2fb7a8){_0x460dcf=_0x2fb7a8;_0x3f285b=_0x460dcf[_0xd34b('0x10')]||0x1388;}})[_0xd34b('0x11')](function(){return dbH['sequelize'][_0xd34b('0x12')](util[_0xd34b('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd34b('0x13')][_0xd34b('0x14')][_0xd34b('0x15')]});})['then'](function(_0x326f00){if(!_0x326f00[0x0][_0xd34b('0x16')]){return analyticExtractedReport('Empty');}var _0x3c74e2=[];var _0x4ce87b=0x0;if(_0x460dcf[_0xd34b('0xf')]){if(_0x326f00&&_0x326f00[_0xd34b('0x17')]){var _0x2ace5a=_['range'](_0x326f00[0x0][_0xd34b('0x16')]/_0x3f285b);var _0x193965=Number[_0xd34b('0x18')](_0x326f00[0x0][_0xd34b('0x16')]/_0x3f285b)?_0x326f00[0x0][_0xd34b('0x16')]%_0x3f285b:0x0;_0x2ace5a['forEach'](function(_0x4c8c37){if(_0x4c8c37>0x0){_0x4ce87b+=_0x3f285b;}_0x3c74e2[_0xd34b('0x19')](dbH[_0xd34b('0x13')][_0xd34b('0x12')](util[_0xd34b('0xc')](_0xd34b('0x1a'),QUERY,_0x3f285b,_0x4ce87b),{'type':dbH[_0xd34b('0x13')]['QueryTypes'][_0xd34b('0x15')]}));});if(_0x193965>0x0){_0x4ce87b+=_0x3f285b;_0x3c74e2[_0xd34b('0x19')](dbH[_0xd34b('0x13')][_0xd34b('0x12')](util['format'](_0xd34b('0x1a'),QUERY,_0x193965,_0x4ce87b),{'type':dbH[_0xd34b('0x13')][_0xd34b('0x14')][_0xd34b('0x15')]}));}}}else{_0x3c74e2[_0xd34b('0x19')](dbH[_0xd34b('0x13')]['query'](QUERY,{'type':dbH[_0xd34b('0x13')]['QueryTypes'][_0xd34b('0x15')]}));}var _0x2ae0e1=path['dirname'](PATH);var _0x5f3325=path['basename'](PATH,_0xd34b('0x1b'));var _0x187b33=_0x460dcf[_0xd34b('0xf')]&&_0x3c74e2['length']>0x1;var _0x34b192=[];if(!fs[_0xd34b('0x1c')](path['join'](_0x2ae0e1,_0x5f3325))&&_0x187b33){fs[_0xd34b('0x1d')](path[_0xd34b('0x1e')](_0x2ae0e1,_0x5f3325));}return BPromise[_0xd34b('0x1f')](_0x3c74e2,function(_0x5a121a){_0x34b192[_0xd34b('0x19')](_0x5a121a);})['then'](function(){for(var _0x182266=0x0;_0x182266<_0x34b192[_0xd34b('0x17')];_0x182266+=0x1){var _0x28e20c;var _0x554e44=_0x34b192[_0x182266];if(_0x187b33){_0x28e20c=path[_0xd34b('0x1e')](_0x2ae0e1,_0x5f3325,util['format'](_0xd34b('0x20'),_0x5f3325,_0x182266,'xlsx'));}else{_0x28e20c=path[_0xd34b('0x1e')](_0x2ae0e1,util['format'](_0xd34b('0x21'),_0x5f3325,_0xd34b('0x22')));}fs['writeFileSync'](_0x28e20c,json2xls(_0x554e44),_0xd34b('0x23'));}})[_0xd34b('0x11')](function(){if(_0x187b33){return new Promise(function(_0xc3beb1){zipdir(path['join'](_0x2ae0e1,_0x5f3325),{'saveTo':path[_0xd34b('0x1e')](_0x2ae0e1,util[_0xd34b('0xc')](_0xd34b('0x21'),_0x5f3325,'zip'))},function(_0x39f442,_0x465f07){rimraf(path[_0xd34b('0x1e')](_0x2ae0e1,_0x5f3325),function(){});_0xc3beb1(_0xd34b('0x24'));});});}})[_0xd34b('0x11')](function(){logger[_0xd34b('0xb')](util[_0xd34b('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd34b('0x25')));return analyticExtractedReport(_0xd34b('0x26'),_0x187b33?util[_0xd34b('0xc')](_0xd34b('0x21'),_0x5f3325,_0x187b33?_0xd34b('0x27'):'xlsx'):null);});})[_0xd34b('0x28')](function(_0x41ff08){logger[_0xd34b('0xb')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd34b('0x25')),util[_0xd34b('0x29')](_0x41ff08,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd34b('0x2a'));})['finally'](function(){process[_0xd34b('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xaf69=['analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','split','mkdirSync','join','each','xlsx','%s.%s','zip\x20finished','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','json2xls','bluebird','rimraf','../../mysqldb','dbH'];(function(_0x38aa92,_0x117e66){var _0x4837f2=function(_0x2aa7a3){while(--_0x2aa7a3){_0x38aa92['push'](_0x38aa92['shift']());}};_0x4837f2(++_0x117e66);}(_0xaf69,0x13c));var _0x9af6=function(_0x12c96c,_0x3b84b8){_0x12c96c=_0x12c96c-0x0;var _0x4090ca=_0xaf69[_0x12c96c];return _0x4090ca;};'use strict';var util=require('util');var path=require(_0x9af6('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x9af6('0x1'));var BPromise=require(_0x9af6('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x9af6('0x3'));var db=require(_0x9af6('0x4'))['db'];var dbH=require(_0x9af6('0x4'))[_0x9af6('0x5')];var logger=require('../../config/logger')(_0x9af6('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9af6('0x7')][0x3];var PATH=process[_0x9af6('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x428cc5,_0xa28f94){var _0x5c44f4={'status':_0x428cc5};var _0x29fad8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa28f94){_0x5c44f4[_0x9af6('0x8')]=_0xa28f94;}return db[_0x9af6('0x9')][_0x9af6('0xa')](_0x5c44f4,_0x29fad8);}function main(){var _0x13c4f5=0x1388;var _0x215a87;logger[_0x9af6('0xb')](util['format'](_0x9af6('0xc'),EXTRACTED_REPORT_ID,_0x9af6('0xd')));return db[_0x9af6('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})['then'](function(_0x57a0c4){if(_0x57a0c4){_0x215a87=_0x57a0c4;_0x13c4f5=_0x215a87['splitSizeXlsx']||0x1388;}})[_0x9af6('0xf')](function(){return dbH[_0x9af6('0x10')]['query'](util[_0x9af6('0x11')](_0x9af6('0x12'),QUERY),{'type':dbH[_0x9af6('0x10')][_0x9af6('0x13')][_0x9af6('0x14')]});})[_0x9af6('0xf')](function(_0x479d84){if(!_0x479d84[0x0]['num']){return analyticExtractedReport(_0x9af6('0x15'));}var _0x3fd1ed=[];var _0x17d7e1=0x0;if(_0x215a87['split']){if(_0x479d84&&_0x479d84[_0x9af6('0x16')]){var _0x21782f=_[_0x9af6('0x17')](_0x479d84[0x0][_0x9af6('0x18')]/_0x13c4f5);var _0x280e21=Number[_0x9af6('0x19')](_0x479d84[0x0][_0x9af6('0x18')]/_0x13c4f5)?_0x479d84[0x0][_0x9af6('0x18')]%_0x13c4f5:0x0;_0x21782f['forEach'](function(_0x46d5c0){if(_0x46d5c0>0x0){_0x17d7e1+=_0x13c4f5;}_0x3fd1ed[_0x9af6('0x1a')](dbH[_0x9af6('0x10')][_0x9af6('0x1b')](util[_0x9af6('0x11')](_0x9af6('0x1c'),QUERY,_0x13c4f5,_0x17d7e1),{'type':dbH[_0x9af6('0x10')][_0x9af6('0x13')][_0x9af6('0x14')]}));});if(_0x280e21>0x0){_0x17d7e1+=_0x13c4f5;_0x3fd1ed[_0x9af6('0x1a')](dbH[_0x9af6('0x10')][_0x9af6('0x1b')](util['format'](_0x9af6('0x1c'),QUERY,_0x280e21,_0x17d7e1),{'type':dbH[_0x9af6('0x10')][_0x9af6('0x13')][_0x9af6('0x14')]}));}}}else{_0x3fd1ed[_0x9af6('0x1a')](dbH[_0x9af6('0x10')][_0x9af6('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x9af6('0x14')]}));}var _0x37a551=path[_0x9af6('0x1d')](PATH);var _0x38ba12=path[_0x9af6('0x1e')](PATH,_0x9af6('0x1f'));var _0x5fa270=_0x215a87[_0x9af6('0x20')]&&_0x3fd1ed[_0x9af6('0x16')]>0x1;var _0x3b441a=[];if(!fs['existsSync'](path['join'](_0x37a551,_0x38ba12))&&_0x5fa270){fs[_0x9af6('0x21')](path[_0x9af6('0x22')](_0x37a551,_0x38ba12));}return BPromise[_0x9af6('0x23')](_0x3fd1ed,function(_0x33445c){_0x3b441a[_0x9af6('0x1a')](_0x33445c);})[_0x9af6('0xf')](function(){for(var _0x3313b7=0x0;_0x3313b7<_0x3b441a[_0x9af6('0x16')];_0x3313b7+=0x1){var _0x119eb6;var _0xe0452f=_0x3b441a[_0x3313b7];if(_0x5fa270){_0x119eb6=path[_0x9af6('0x22')](_0x37a551,_0x38ba12,util[_0x9af6('0x11')]('%s%d.%s',_0x38ba12,_0x3313b7,_0x9af6('0x24')));}else{_0x119eb6=path[_0x9af6('0x22')](_0x37a551,util[_0x9af6('0x11')]('%s.%s',_0x38ba12,_0x9af6('0x24')));}fs['writeFileSync'](_0x119eb6,json2xls(_0xe0452f),'binary');}})[_0x9af6('0xf')](function(){if(_0x5fa270){return new Promise(function(_0x104b45){zipdir(path[_0x9af6('0x22')](_0x37a551,_0x38ba12),{'saveTo':path[_0x9af6('0x22')](_0x37a551,util['format'](_0x9af6('0x25'),_0x38ba12,'zip'))},function(_0x2b3cde,_0x207a9a){rimraf(path[_0x9af6('0x22')](_0x37a551,_0x38ba12),function(){});_0x104b45(_0x9af6('0x26'));});});}})['then'](function(){logger[_0x9af6('0xb')](util[_0x9af6('0x11')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9af6('0xd')));return analyticExtractedReport(_0x9af6('0x27'),_0x5fa270?util[_0x9af6('0x11')](_0x9af6('0x25'),_0x38ba12,_0x5fa270?_0x9af6('0x28'):'xlsx'):null);});})[_0x9af6('0x29')](function(_0x18ee0f){logger[_0x9af6('0xb')](util[_0x9af6('0x11')](_0x9af6('0x2a'),EXTRACTED_REPORT_ID,_0x9af6('0xd')),util[_0x9af6('0x2b')](_0x18ee0f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9af6('0x2c')](function(){process[_0x9af6('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 d77293f..29d17ed 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 _0x391c=['inbound','push','Set','CDR(routeid)=','outbound','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','hasOwnProperty','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','ExecIf','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','Interval','findAll','then','IntervalId','models','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','type','format','context','VoiceExtensionId'];(function(_0x26755a,_0xa823e3){var _0x536401=function(_0x54166f){while(--_0x54166f){_0x26755a['push'](_0x26755a['shift']());}};_0x536401(++_0xa823e3);}(_0x391c,0x104));var _0xc391=function(_0x42d9db,_0x48a1ed){_0x42d9db=_0x42d9db-0x0;var _0x556ba5=_0x391c[_0x42d9db];return _0x556ba5;};'use strict';var _=require(_0xc391('0x0'));var util=require(_0xc391('0x1'));function rewrite(_0xd99b39,_0x23c56e){var _0x403d49=this;return _0xd99b39['models'][_0xc391('0x2')][_0xc391('0x3')]({'raw':!![]})[_0xc391('0x4')](function(_0x5f19dc){_0x403d49['intervals']=_0x5f19dc;return _0xd99b39['models']['VoiceExtension']['findAll']({'where':{'IntervalId':_0x23c56e[_0xc391('0x5')]},'raw':!![]});})[_0xc391('0x4')](function(_0x2bcc13){return _0xd99b39[_0xc391('0x6')][_0xc391('0x7')][_0xc391('0x3')]({'where':{'exten':{'$in':_[_0xc391('0x8')](_[_0xc391('0x9')](_0x2bcc13,_0xc391('0xa')))}},'order':[{'raw':_0xc391('0xb')}],'raw':!![]});})[_0xc391('0x4')](function(_0x1b6e28){var _0x41eb90=_[_0xc391('0xc')](_0x1b6e28,{'priority':'1'});var _0x2e6bc6=_[_0xc391('0xc')](_0x1b6e28,{'isApp':0x1});var _0x5d00b4=_[_0xc391('0xd')](_0x2e6bc6,_0xc391('0xa'));var _0x2b085c=[_0xc391('0xe'),_0xc391('0xf')];var _0x479b77=[];var _0x3970c9=[];for(var _0x4b6856 in _0x5d00b4){if(_0x5d00b4['hasOwnProperty'](_0x4b6856)){_0x403d49[_0xc391('0x10')]=0x2;_0x403d49[_0xc391('0x11')]=[];_0x403d49[_0xc391('0x12')]=_[_0xc391('0x13')](_0x41eb90,{'exten':_0x5d00b4[_0x4b6856][0x0]['exten']});_0x403d49[_0xc391('0x11')]['push']({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':'Set','appdata':util[_0xc391('0x15')]('CDR(type)=%s',_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')]),'context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'priority':_0x403d49[_0xc391('0x10')]++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')]});if(_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')]===_0xc391('0x18')){_0x403d49['extensions'][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':_0xc391('0x1a'),'appdata':_0xc391('0x1b')+_0x5d00b4[_0x4b6856][0x0]['VoiceExtensionId'],'context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'priority':_0x403d49[_0xc391('0x10')]++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')]});}else if(_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')]===_0xc391('0x1c')){if(_0x403d49[_0xc391('0x12')]){_0x403d49[_0xc391('0x11')]['push']({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':_0xc391('0x1a'),'appdata':'CDR(destination)='+(_0x403d49[_0xc391('0x12')][_0xc391('0x1d')]?_0xc391('0x1e')+_0x403d49[_0xc391('0x12')][_0xc391('0x1d')]+'}':_0xc391('0x1f')),'context':_0x5d00b4[_0x4b6856][0x0]['context'],'exten':_0x5d00b4[_0x4b6856][0x0]['exten'],'priority':_0x403d49['priority']++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')]});}_0x403d49[_0xc391('0x11')][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':'Set','appdata':'CDR(routeid)='+_0x5d00b4[_0x4b6856][0x0]['VoiceExtensionId'],'context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'priority':_0x403d49[_0xc391('0x10')]++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0]['VoiceExtensionId']});var _0x43b92a=_0x403d49[_0xc391('0x10')]++;_0x403d49[_0xc391('0x11')][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':'ExecIf','appdata':_0xc391('0x20')+(_0x43b92a+0x2)+_0xc391('0x21')+(_0x43b92a+0x1)+')','context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0]['exten'],'priority':_0x43b92a,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')]});if(_0x403d49[_0xc391('0x12')]){_0x403d49[_0xc391('0x11')][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0]['type'],'app':_0xc391('0x1a'),'appdata':_0x403d49['extension'][_0xc391('0x1d')]?_0xc391('0x22')+_0x403d49[_0xc391('0x12')][_0xc391('0x1d')]+'}':_0xc391('0x23'),'context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'priority':_0x403d49[_0xc391('0x10')]++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')]});}_0x403d49[_0xc391('0x11')]['push']({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':_0xc391('0x1a'),'appdata':_0xc391('0x24')+_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')],'context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0]['exten'],'priority':_0x403d49[_0xc391('0x10')]++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')]});if(_0x403d49['extension']&&_0x403d49[_0xc391('0x12')]['hasOwnProperty'](_0xc391('0x25'))&&_0x403d49[_0xc391('0x12')][_0xc391('0x25')]!=='none'){_0x403d49[_0xc391('0x11')][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':_0xc391('0x1a'),'appdata':_0xc391('0x26'),'context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'priority':_0x403d49['priority']++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')]});_0x403d49[_0xc391('0x11')][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':_0xc391('0x1a'),'appdata':_0xc391('0x27')+_0x403d49[_0xc391('0x12')][_0xc391('0x25')]||'wav','context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'priority':_0x403d49[_0xc391('0x10')]++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0]['VoiceExtensionId']});}}_0x403d49[_0xc391('0x11')][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':_0xc391('0x1a'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'priority':_0x403d49['priority']++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')]});_0x403d49['extensions'][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0]['type'],'app':_0xc391('0x1a'),'appdata':_0xc391('0x28'),'context':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x16')],'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'priority':_0x403d49[_0xc391('0x10')]++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0]['VoiceExtensionId']});_0x403d49[_0xc391('0x11')][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':_0xc391('0x1a'),'appdata':_0xc391('0x29'),'context':_0x5d00b4[_0x4b6856][0x0]['context'],'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'priority':_0x403d49['priority']++,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0]['VoiceExtensionId']});for(var _0x5b7321=0x0,_0xba192d=0x0;_0x5b7321<_0x5d00b4[_0x4b6856][_0xc391('0x2a')];_0x5b7321+=0x1,_0xba192d=0x0){var _0x4f8ff5=_0x5d00b4[_0x4b6856][_0x5b7321];if(_0x4f8ff5[_0xc391('0x14')]){_0x4f8ff5[_0xc391('0x14')]=_0x4f8ff5['type'][_0xc391('0x2b')]();}var _0x3c162e=[];var _0x4a9b42=[];delete _0x4f8ff5['id'];delete _0x4f8ff5[_0xc391('0x2c')];delete _0x4f8ff5[_0xc391('0x2d')];var _0x180050=_0x4f8ff5[_0xc391('0x2e')]!==_0xc391('0x2f')?[_0x4f8ff5['interval']]:_0x4f8ff5[_0xc391('0x5')]?_['map'](_[_0xc391('0xc')](_0x403d49['intervals'],{'IntervalId':_0x4f8ff5[_0xc391('0x5')]}),_0xc391('0x2e')):[];if(_0x4f8ff5[_0xc391('0x30')]('tag')){if(_0x4f8ff5['tag']&&_0x4f8ff5[_0xc391('0x31')]!=='--'){_0x3c162e[_0xc391('0x19')]({'type':_0x4f8ff5[_0xc391('0x14')],'app':_0xc391('0x1a'),'appdata':_0xc391('0x32')+_0x4f8ff5[_0xc391('0x31')],'context':_0x4f8ff5[_0xc391('0x16')],'exten':_0x4f8ff5[_0xc391('0xa')],'priority':_0x180050[_0xc391('0x2a')]+_0x403d49[_0xc391('0x10')]+_0xba192d++,'VoiceExtensionId':_0x4f8ff5[_0xc391('0x17')]});}}if(_0x4f8ff5['type']===_0xc391('0x1c')&&_0x4f8ff5[_0xc391('0x30')](_0xc391('0x33'))){if(_0x4f8ff5[_0xc391('0x33')]){_0x3c162e[_0xc391('0x19')]({'type':_0x4f8ff5['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4f8ff5[_0xc391('0x33')]+')','context':_0x4f8ff5['context'],'exten':_0x4f8ff5[_0xc391('0xa')],'priority':_0x180050['length']+_0x403d49['priority']+_0xba192d++,'VoiceExtensionId':_0x4f8ff5[_0xc391('0x17')]});}else{_0x3c162e['push']({'type':_0x4f8ff5[_0xc391('0x14')],'app':'ExecIf','appdata':_0xc391('0x34'),'context':_0x4f8ff5[_0xc391('0x16')],'exten':_0x4f8ff5[_0xc391('0xa')],'priority':_0x180050[_0xc391('0x2a')]+_0x403d49[_0xc391('0x10')]+_0xba192d++,'VoiceExtensionId':_0x4f8ff5['VoiceExtensionId']});}}if(_0x4f8ff5[_0xc391('0x30')](_0xc391('0x35'))){if(_0x2b085c[_0xc391('0x36')](_0x4f8ff5[_0xc391('0x37')][_0xc391('0x2b')]())>=0x0&&_0x4f8ff5['appType']!==_0xc391('0x38')){if(_0x4f8ff5[_0xc391('0x35')]){_0x3c162e[_0xc391('0x19')]({'type':_0x4f8ff5[_0xc391('0x14')],'app':_0xc391('0x39'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4f8ff5['context'],'exten':_0x4f8ff5[_0xc391('0xa')],'priority':_0x180050['length']+_0x403d49['priority']+_0xba192d++,'VoiceExtensionId':_0x4f8ff5[_0xc391('0x17')]});_0x3c162e[_0xc391('0x19')]({'type':_0x4f8ff5[_0xc391('0x14')],'app':_0xc391('0x1a'),'appdata':_0xc391('0x3a'),'context':_0x4f8ff5[_0xc391('0x16')],'exten':_0x4f8ff5[_0xc391('0xa')],'priority':_0x180050[_0xc391('0x2a')]+_0x403d49['priority']+_0xba192d++,'VoiceExtensionId':_0x4f8ff5['VoiceExtensionId']});}else{_0x3c162e[_0xc391('0x19')]({'type':_0x4f8ff5[_0xc391('0x14')],'app':_0xc391('0x39'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4f8ff5['context'],'exten':_0x4f8ff5[_0xc391('0xa')],'priority':_0x180050['length']+_0x403d49[_0xc391('0x10')]+_0xba192d++,'VoiceExtensionId':_0x4f8ff5['VoiceExtensionId']});_0x3c162e[_0xc391('0x19')]({'type':_0x4f8ff5['type'],'app':'Set','appdata':_0xc391('0x3b'),'context':_0x4f8ff5['context'],'exten':_0x4f8ff5['exten'],'priority':_0x180050['length']+_0x403d49[_0xc391('0x10')]+_0xba192d++,'VoiceExtensionId':_0x4f8ff5[_0xc391('0x17')]});}}}for(var _0x2956c7=0x0;_0x2956c7<_0x180050['length'];_0x2956c7+=0x1){var _0x414f8c=_0x403d49[_0xc391('0x10')]+_0x180050[_0xc391('0x2a')];var _0x4d320a=_0x2956c7===_0x180050[_0xc391('0x2a')]-0x1?_0x403d49[_0xc391('0x10')]+_0x3c162e[_0xc391('0x2a')]+_0x4a9b42['length']+0x2:_0x403d49['priority']+_0x2956c7+0x1;_0x3c162e[_0xc391('0x3c')](_0x2956c7,0x0,{'type':_0x4f8ff5[_0xc391('0x14')],'app':_0xc391('0x3d'),'appdata':_0x180050[_0x2956c7]+'?'+_0x4f8ff5[_0xc391('0x16')]+',${EXTEN},'+_0x414f8c+':'+_0x4f8ff5[_0xc391('0x16')]+_0xc391('0x3e')+_0x4d320a,'exten':_0x4f8ff5[_0xc391('0xa')],'context':_0x4f8ff5[_0xc391('0x16')],'priority':_0x403d49[_0xc391('0x10')]+_0x2956c7,'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0]['VoiceExtensionId']});}_0x4f8ff5[_0xc391('0x10')]=_0x3c162e['length']?_[_0xc391('0x3f')](_0x3c162e)[_0xc391('0x10')]+0x1:_0x403d49[_0xc391('0x10')];_0x403d49[_0xc391('0x10')]=(_0x4a9b42['length']?_[_0xc391('0x3f')](_0x4a9b42)[_0xc391('0x10')]:_0x4f8ff5['priority'])+0x1;_0x403d49[_0xc391('0x11')]=_[_0xc391('0x40')](_0x403d49[_0xc391('0x11')],_0x3c162e,[_0x4f8ff5],_0x4a9b42);}_0x403d49[_0xc391('0x11')][_0xc391('0x19')]({'type':_0x5d00b4[_0x4b6856][0x0][_0xc391('0x14')],'app':_0xc391('0x41'),'exten':_0x5d00b4[_0x4b6856][0x0][_0xc391('0xa')],'context':_0x5d00b4[_0x4b6856][0x0]['context'],'priority':_0x403d49[_0xc391('0x10')],'VoiceExtensionId':_0x5d00b4[_0x4b6856][0x0]['VoiceExtensionId']});_0x479b77[_0xc391('0x19')](_0x5d00b4[_0x4b6856][0x0][_0xc391('0x17')]);_0x3970c9=_[_0xc391('0x40')](_0x3970c9,_0x403d49[_0xc391('0x11')]);}}return _0xd99b39[_0xc391('0x42')](function(_0x5572cf){return _0xd99b39[_0xc391('0x6')][_0xc391('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x479b77}},'transaction':_0x5572cf})['then'](function(_0x1134fa){return _0xd99b39['models'][_0xc391('0x7')][_0xc391('0x43')](_[_0xc391('0x44')](_0x3970c9,_0xc391('0x10')),{'transaction':_0x5572cf});});});})[_0xc391('0x45')](function(_0x2f2442){console['error'](_0x2f2442);});}exports[_0xc391('0x46')]=rewrite; \ No newline at end of file +var _0x2953=['updatedAt','interval','*,*,*,*','IntervalId','filter','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','then','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','hasOwnProperty','priority','extension','find','extensions','push','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt'];(function(_0x341eca,_0x3b58aa){var _0x18c18a=function(_0x148874){while(--_0x148874){_0x341eca['push'](_0x341eca['shift']());}};_0x18c18a(++_0x3b58aa);}(_0x2953,0x1b9));var _0x3295=function(_0x5e1597,_0x4e4630){_0x5e1597=_0x5e1597-0x0;var _0x20acfc=_0x2953[_0x5e1597];return _0x20acfc;};'use strict';var _=require(_0x3295('0x0'));var util=require(_0x3295('0x1'));function rewrite(_0x5abff7,_0x94be65){var _0x5cb7d3=this;return _0x5abff7[_0x3295('0x2')]['Interval'][_0x3295('0x3')]({'raw':!![]})[_0x3295('0x4')](function(_0xb18b07){_0x5cb7d3['intervals']=_0xb18b07;return _0x5abff7[_0x3295('0x2')]['VoiceExtension'][_0x3295('0x3')]({'where':{'IntervalId':_0x94be65['IntervalId']},'raw':!![]});})[_0x3295('0x4')](function(_0x4332be){return _0x5abff7[_0x3295('0x2')][_0x3295('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x3295('0x6')](_['map'](_0x4332be,_0x3295('0x7')))}},'order':[{'raw':_0x3295('0x8')}],'raw':!![]});})[_0x3295('0x4')](function(_0x14bd1f){var _0x195981=_['filter'](_0x14bd1f,{'priority':'1'});var _0x8f46a2=_['filter'](_0x14bd1f,{'isApp':0x1});var _0x3cb307=_[_0x3295('0x9')](_0x8f46a2,_0x3295('0x7'));var _0x489ea3=[_0x3295('0xa'),'playback'];var _0x4b9c95=[];var _0xa8aea0=[];for(var _0x2ffb39 in _0x3cb307){if(_0x3cb307[_0x3295('0xb')](_0x2ffb39)){_0x5cb7d3[_0x3295('0xc')]=0x2;_0x5cb7d3['extensions']=[];_0x5cb7d3[_0x3295('0xd')]=_[_0x3295('0xe')](_0x195981,{'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')]});_0x5cb7d3[_0x3295('0xf')][_0x3295('0x10')]({'type':_0x3cb307[_0x2ffb39][0x0]['type'],'app':'Set','appdata':util[_0x3295('0x11')](_0x3295('0x12'),_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')]),'context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3['priority']++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});if(_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')]===_0x3295('0x16')){_0x5cb7d3[_0x3295('0xf')][_0x3295('0x10')]({'type':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')],'app':_0x3295('0x17'),'appdata':_0x3295('0x18')+_0x3cb307[_0x2ffb39][0x0]['VoiceExtensionId'],'context':_0x3cb307[_0x2ffb39][0x0]['context'],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3[_0x3295('0xc')]++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});}else if(_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')]===_0x3295('0x19')){if(_0x5cb7d3[_0x3295('0xd')]){_0x5cb7d3[_0x3295('0xf')][_0x3295('0x10')]({'type':_0x3cb307[_0x2ffb39][0x0]['type'],'app':_0x3295('0x17'),'appdata':_0x3295('0x1a')+(_0x5cb7d3[_0x3295('0xd')][_0x3295('0x1b')]?_0x3295('0x1c')+_0x5cb7d3[_0x3295('0xd')][_0x3295('0x1b')]+'}':'${EXTEN}'),'context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3[_0x3295('0xc')]++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});}_0x5cb7d3[_0x3295('0xf')]['push']({'type':_0x3cb307[_0x2ffb39][0x0]['type'],'app':_0x3295('0x17'),'appdata':'CDR(routeid)='+_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')],'context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3[_0x3295('0xc')]++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0]['VoiceExtensionId']});var _0x2a7af8=_0x5cb7d3[_0x3295('0xc')]++;_0x5cb7d3[_0x3295('0xf')][_0x3295('0x10')]({'type':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')],'app':'ExecIf','appdata':_0x3295('0x1d')+(_0x2a7af8+0x2)+_0x3295('0x1e')+(_0x2a7af8+0x1)+')','context':_0x3cb307[_0x2ffb39][0x0]['context'],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x2a7af8,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});if(_0x5cb7d3[_0x3295('0xd')]){_0x5cb7d3[_0x3295('0xf')]['push']({'type':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')],'app':_0x3295('0x17'),'appdata':_0x5cb7d3['extension'][_0x3295('0x1b')]?_0x3295('0x1f')+_0x5cb7d3[_0x3295('0xd')][_0x3295('0x1b')]+'}':_0x3295('0x20'),'context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3[_0x3295('0xc')]++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0]['VoiceExtensionId']});}_0x5cb7d3['extensions']['push']({'type':_0x3cb307[_0x2ffb39][0x0]['type'],'app':_0x3295('0x17'),'appdata':'outboundrouteid='+_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')],'context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3[_0x3295('0xc')]++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});if(_0x5cb7d3[_0x3295('0xd')]&&_0x5cb7d3[_0x3295('0xd')][_0x3295('0xb')]('recordingFormat')&&_0x5cb7d3[_0x3295('0xd')]['recordingFormat']!==_0x3295('0x21')){_0x5cb7d3[_0x3295('0xf')][_0x3295('0x10')]({'type':_0x3cb307[_0x2ffb39][0x0]['type'],'app':_0x3295('0x17'),'appdata':_0x3295('0x22'),'context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3[_0x3295('0xc')]++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});_0x5cb7d3['extensions'][_0x3295('0x10')]({'type':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')],'app':'Set','appdata':_0x3295('0x23')+_0x5cb7d3[_0x3295('0xd')][_0x3295('0x24')]||_0x3295('0x25'),'context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3['priority']++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});}}_0x5cb7d3[_0x3295('0xf')][_0x3295('0x10')]({'type':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')],'app':_0x3295('0x17'),'appdata':_0x3295('0x26'),'context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3[_0x3295('0xc')]++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});_0x5cb7d3[_0x3295('0xf')]['push']({'type':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')],'app':_0x3295('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'exten':_0x3cb307[_0x2ffb39][0x0]['exten'],'priority':_0x5cb7d3[_0x3295('0xc')]++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});_0x5cb7d3['extensions'][_0x3295('0x10')]({'type':_0x3cb307[_0x2ffb39][0x0]['type'],'app':_0x3295('0x17'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3cb307[_0x2ffb39][0x0]['context'],'exten':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x7')],'priority':_0x5cb7d3[_0x3295('0xc')]++,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});for(var _0x2dcf07=0x0,_0xc3d0d3=0x0;_0x2dcf07<_0x3cb307[_0x2ffb39][_0x3295('0x27')];_0x2dcf07+=0x1,_0xc3d0d3=0x0){var _0x3b2e02=_0x3cb307[_0x2ffb39][_0x2dcf07];if(_0x3b2e02[_0x3295('0x13')]){_0x3b2e02[_0x3295('0x13')]=_0x3b2e02[_0x3295('0x13')][_0x3295('0x28')]();}var _0x537766=[];var _0x2b5a30=[];delete _0x3b2e02['id'];delete _0x3b2e02[_0x3295('0x29')];delete _0x3b2e02[_0x3295('0x2a')];var _0x4e2745=_0x3b2e02[_0x3295('0x2b')]!==_0x3295('0x2c')?[_0x3b2e02[_0x3295('0x2b')]]:_0x3b2e02[_0x3295('0x2d')]?_['map'](_[_0x3295('0x2e')](_0x5cb7d3['intervals'],{'IntervalId':_0x3b2e02[_0x3295('0x2d')]}),_0x3295('0x2b')):[];if(_0x3b2e02[_0x3295('0xb')](_0x3295('0x2f'))){if(_0x3b2e02[_0x3295('0x2f')]&&_0x3b2e02[_0x3295('0x2f')]!=='--'){_0x537766['push']({'type':_0x3b2e02[_0x3295('0x13')],'app':_0x3295('0x17'),'appdata':_0x3295('0x30')+_0x3b2e02[_0x3295('0x2f')],'context':_0x3b2e02[_0x3295('0x14')],'exten':_0x3b2e02[_0x3295('0x7')],'priority':_0x4e2745[_0x3295('0x27')]+_0x5cb7d3[_0x3295('0xc')]+_0xc3d0d3++,'VoiceExtensionId':_0x3b2e02[_0x3295('0x15')]});}}if(_0x3b2e02[_0x3295('0x13')]===_0x3295('0x19')&&_0x3b2e02[_0x3295('0xb')](_0x3295('0x31'))){if(_0x3b2e02[_0x3295('0x31')]){_0x537766[_0x3295('0x10')]({'type':_0x3b2e02[_0x3295('0x13')],'app':_0x3295('0x32'),'appdata':_0x3295('0x33')+_0x3b2e02['callerID']+')','context':_0x3b2e02[_0x3295('0x14')],'exten':_0x3b2e02[_0x3295('0x7')],'priority':_0x4e2745[_0x3295('0x27')]+_0x5cb7d3['priority']+_0xc3d0d3++,'VoiceExtensionId':_0x3b2e02[_0x3295('0x15')]});}else{_0x537766['push']({'type':_0x3b2e02[_0x3295('0x13')],'app':_0x3295('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3b2e02[_0x3295('0x14')],'exten':_0x3b2e02[_0x3295('0x7')],'priority':_0x4e2745[_0x3295('0x27')]+_0x5cb7d3['priority']+_0xc3d0d3++,'VoiceExtensionId':_0x3b2e02[_0x3295('0x15')]});}}if(_0x3b2e02[_0x3295('0xb')](_0x3295('0x34'))){if(_0x489ea3[_0x3295('0x35')](_0x3b2e02[_0x3295('0x36')][_0x3295('0x28')]())>=0x0&&_0x3b2e02[_0x3295('0x37')]!==_0x3295('0x38')){if(_0x3b2e02[_0x3295('0x34')]){_0x537766[_0x3295('0x10')]({'type':_0x3b2e02['type'],'app':_0x3295('0x32'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3b2e02[_0x3295('0x14')],'exten':_0x3b2e02['exten'],'priority':_0x4e2745['length']+_0x5cb7d3[_0x3295('0xc')]+_0xc3d0d3++,'VoiceExtensionId':_0x3b2e02[_0x3295('0x15')]});_0x537766[_0x3295('0x10')]({'type':_0x3b2e02[_0x3295('0x13')],'app':_0x3295('0x17'),'appdata':_0x3295('0x39'),'context':_0x3b2e02[_0x3295('0x14')],'exten':_0x3b2e02[_0x3295('0x7')],'priority':_0x4e2745[_0x3295('0x27')]+_0x5cb7d3['priority']+_0xc3d0d3++,'VoiceExtensionId':_0x3b2e02[_0x3295('0x15')]});}else{_0x537766[_0x3295('0x10')]({'type':_0x3b2e02[_0x3295('0x13')],'app':_0x3295('0x32'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3b2e02['context'],'exten':_0x3b2e02['exten'],'priority':_0x4e2745['length']+_0x5cb7d3[_0x3295('0xc')]+_0xc3d0d3++,'VoiceExtensionId':_0x3b2e02[_0x3295('0x15')]});_0x537766['push']({'type':_0x3b2e02[_0x3295('0x13')],'app':_0x3295('0x17'),'appdata':_0x3295('0x3a'),'context':_0x3b2e02[_0x3295('0x14')],'exten':_0x3b2e02['exten'],'priority':_0x4e2745[_0x3295('0x27')]+_0x5cb7d3[_0x3295('0xc')]+_0xc3d0d3++,'VoiceExtensionId':_0x3b2e02[_0x3295('0x15')]});}}}for(var _0x488d45=0x0;_0x488d45<_0x4e2745[_0x3295('0x27')];_0x488d45+=0x1){var _0x588e0d=_0x5cb7d3[_0x3295('0xc')]+_0x4e2745[_0x3295('0x27')];var _0x5396ea=_0x488d45===_0x4e2745[_0x3295('0x27')]-0x1?_0x5cb7d3[_0x3295('0xc')]+_0x537766['length']+_0x2b5a30[_0x3295('0x27')]+0x2:_0x5cb7d3[_0x3295('0xc')]+_0x488d45+0x1;_0x537766['splice'](_0x488d45,0x0,{'type':_0x3b2e02[_0x3295('0x13')],'app':'GotoIfTime','appdata':_0x4e2745[_0x488d45]+'?'+_0x3b2e02[_0x3295('0x14')]+',${EXTEN},'+_0x588e0d+':'+_0x3b2e02[_0x3295('0x14')]+_0x3295('0x3b')+_0x5396ea,'exten':_0x3b2e02[_0x3295('0x7')],'context':_0x3b2e02['context'],'priority':_0x5cb7d3[_0x3295('0xc')]+_0x488d45,'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]});}_0x3b2e02[_0x3295('0xc')]=_0x537766[_0x3295('0x27')]?_[_0x3295('0x3c')](_0x537766)[_0x3295('0xc')]+0x1:_0x5cb7d3['priority'];_0x5cb7d3[_0x3295('0xc')]=(_0x2b5a30[_0x3295('0x27')]?_[_0x3295('0x3c')](_0x2b5a30)[_0x3295('0xc')]:_0x3b2e02[_0x3295('0xc')])+0x1;_0x5cb7d3[_0x3295('0xf')]=_[_0x3295('0x3d')](_0x5cb7d3['extensions'],_0x537766,[_0x3b2e02],_0x2b5a30);}_0x5cb7d3['extensions']['push']({'type':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x13')],'app':_0x3295('0x3e'),'exten':_0x3cb307[_0x2ffb39][0x0]['exten'],'context':_0x3cb307[_0x2ffb39][0x0][_0x3295('0x14')],'priority':_0x5cb7d3[_0x3295('0xc')],'VoiceExtensionId':_0x3cb307[_0x2ffb39][0x0]['VoiceExtensionId']});_0x4b9c95['push'](_0x3cb307[_0x2ffb39][0x0][_0x3295('0x15')]);_0xa8aea0=_[_0x3295('0x3d')](_0xa8aea0,_0x5cb7d3[_0x3295('0xf')]);}}return _0x5abff7['transaction'](function(_0x488508){return _0x5abff7[_0x3295('0x2')]['VoiceExtension'][_0x3295('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x4b9c95}},'transaction':_0x488508})[_0x3295('0x4')](function(_0x23de0d){return _0x5abff7['models'][_0x3295('0x5')][_0x3295('0x40')](_[_0x3295('0x41')](_0xa8aea0,'priority'),{'transaction':_0x488508});});});})[_0x3295('0x42')](function(_0x3b4318){console[_0x3295('0x43')](_0x3b4318);});}exports[_0x3295('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 4179517..bafe5fa 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 _0x5617=['dialCheckDuplicateType','CmList','Lists','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','get','cmContact,\x20%s,\x20%s','finally','emit','contact:csv_','resolve','unlinkSync','exit','info','CSV\x20import\x20process\x20stopped!','CmContact','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','test','errors','length','map','join','data','firstName','error','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','field','toString','NOW()','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','fromQuery','select','cm_contacts','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound'];(function(_0x5e7dd6,_0x18040a){var _0x16b9ba=function(_0xdce3f){while(--_0xdce3f){_0x5e7dd6['push'](_0x5e7dd6['shift']());}};_0x16b9ba(++_0x18040a);}(_0x5617,0x87));var _0x7561=function(_0x5293a1,_0x351c64){_0x5293a1=_0x5293a1-0x0;var _0x5085aa=_0x5617[_0x5293a1];return _0x5085aa;};'use strict';var BPromise=require(_0x7561('0x0'));var util=require(_0x7561('0x1'));var _=require(_0x7561('0x2'));var fs=require('fs');var squel=require(_0x7561('0x3'));var Papa=require('papaparse');var Redis=require(_0x7561('0x4'));var db=require(_0x7561('0x5'))['db'];var config=require(_0x7561('0x6'));var logger=require(_0x7561('0x7'))(_0x7561('0x8'));config[_0x7561('0x9')]=_['defaults'](config[_0x7561('0x9')],{'host':_0x7561('0xa'),'port':0x18eb});var socket=require(_0x7561('0xb'))(new Redis(config[_0x7561('0x9')]));require(_0x7561('0xc'))[_0x7561('0xd')](socket);try{if(!process[_0x7561('0xe')][0x2]||process[_0x7561('0xe')][0x2]==='undefined'||process[_0x7561('0xe')][0x2]==='null'){throw new Error(_0x7561('0xf'));}var FILEPATH=process[_0x7561('0xe')][0x2];if(!process[_0x7561('0xe')][0x3]||process['argv'][0x3]===_0x7561('0x10')||process[_0x7561('0xe')][0x3]==='null'||!process[_0x7561('0xe')][0x4]||process[_0x7561('0xe')][0x4]==='undefined'||process[_0x7561('0xe')][0x4]===_0x7561('0x11')){throw new Error(_0x7561('0x12'));}var FIELDS=_[_0x7561('0x13')](process[_0x7561('0xe')][0x3][_0x7561('0x14')](','),process[_0x7561('0xe')][0x4][_0x7561('0x14')](','));if(!process[_0x7561('0xe')][0x5]||process[_0x7561('0xe')][0x5]===_0x7561('0x10')||process['argv'][0x5]==='null'){throw new Error(_0x7561('0x15'));}var LISTID=process[_0x7561('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x7561('0xe')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x7561('0x11')?process[_0x7561('0xe')][0x6]:null;var DUPLICATES=process[_0x7561('0xe')][0x7]&&process['argv'][0x7]!==_0x7561('0x10')&&process[_0x7561('0xe')][0x7]!==_0x7561('0x11')?process[_0x7561('0xe')][0x7]:null;if(!process[_0x7561('0xe')][0x8]||process['argv'][0x8]===_0x7561('0x10')||process[_0x7561('0xe')][0x8]==='null'){throw new Error(_0x7561('0x16'));}var SOCKET_TIMESTAMP=process[_0x7561('0xe')][0x8];}catch(_0x113001){logger['error'](_0x113001);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(_0x3c357b,_0x21561d,_0x3e6881,_0x31b3b4){var _0x48639f={'message':_0x21561d};_0x48639f[_0x3c357b]=!![];if(_0x3e6881){_0x48639f[_0x7561('0x17')]=_0x3e6881;}if(_0x31b3b4){_0x48639f['index']=_0x31b3b4;}return _0x48639f;}function isEmail(_0x3d7b5e){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))*$/[_0x7561('0x18')](_0x3d7b5e);}function checkRow(_0x3c7895,_0x306140,_0x3e3271){return new BPromise(function(_0x43c4fe,_0x3617cf){if(_['isNil'](_0x3c7895)){return _0x3617cf(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3e3271));}if(_0x3c7895[_0x7561('0x19')]&&_0x3c7895[_0x7561('0x19')][_0x7561('0x1a')]){var _0x252e18=_[_0x7561('0x1b')](_0x3c7895['errors'],'message')[_0x7561('0x1c')](';');return _0x3617cf(handleCheckRowError('error',_0x252e18,null,_0x3e3271));}var _0x2fdc6b={};for(var _0x4acf29 in FIELDS){if(FIELDS['hasOwnProperty'](_0x4acf29)&&FIELDS[_0x4acf29]){_0x2fdc6b[_0x4acf29]=_0x3c7895[_0x7561('0x1d')][0x0][FIELDS[_0x4acf29]]||_0x3c7895['data'][0x0]['\ufeff'+FIELDS[_0x4acf29]];}}if(!_0x2fdc6b[_0x7561('0x1e')]){return _0x3617cf(handleCheckRowError(_0x7561('0x1f'),_0x7561('0x20'),null,_0x3e3271));}if(!_0x2fdc6b[_0x7561('0x21')]){return _0x3617cf(handleCheckRowError(_0x7561('0x1f'),_0x7561('0x22'),null,_0x3e3271));}if(_0x2fdc6b[_0x7561('0x23')]){var _0x5392c5=moment(_0x2fdc6b['birthDate'],'YYYY-MM-DD');if(!_0x5392c5[_0x7561('0x24')]()){return _0x3617cf(handleCheckRowError(_0x7561('0x1f'),_0x7561('0x25'),null,_0x3e3271));}}if(_0x2fdc6b[_0x7561('0x26')]){if(!isEmail(_0x2fdc6b[_0x7561('0x26')])){return _0x3617cf(handleCheckRowError(_0x7561('0x1f'),_0x7561('0x27'),null,_0x3e3271));}}_0x2fdc6b[_0x7561('0x28')]=LISTID;_0x2fdc6b[_0x7561('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7561('0x1a')]&&_0x306140){var _0x20af51={};for(var _0x51650c=0x0,_0x301e1f=DUPLICATES['length'];_0x51650c<_0x301e1f;_0x51650c+=0x1){_0x20af51[DUPLICATES[_0x51650c]]=_0x2fdc6b[DUPLICATES[_0x51650c]];}var _0x34daef=_[_0x7561('0x2a')](_0x306140,_0x20af51);if(_0x34daef){return _0x3617cf(handleCheckRowError(_0x7561('0x2b'),_0x7561('0x2c'),_0x34daef,_0x3e3271));}}return db['CmContact'][_0x7561('0x2d')](_0x2fdc6b,{'raw':!![],'hooks':![],'fields':_[_0x7561('0x2e')](_0x2fdc6b)})[_0x7561('0x2f')](function(_0x23173f){if(DUPLICATES&&DUPLICATES[_0x7561('0x1a')]&&_0x306140){_0x306140[_0x7561('0x30')](_[_0x7561('0x31')](_0x2fdc6b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x23173f['id'];return _0x43c4fe();})[_0x7561('0x32')](function(_0x1faaaa){return _0x3617cf(handleCheckRowError('error',_0x7561('0x33')+(_0x1faaaa[_0x7561('0x34')]||JSON[_0x7561('0x35')](_0x1faaaa)),null,_0x3e3271));});});}function checkHopper(){function _0x5419b7(){return function(_0x584e3f){logger['error'](_0x7561('0x36'),_0x7561('0x37'),util[_0x7561('0x38')](_0x584e3f,{'showHidden':![],'depth':null}));};}var _0x3050d6=function(_0x5c0170,_0x3db1be){var _0x3a7485=squel['insert']()[_0x7561('0x39')](_0x7561('0x3a'))['fromQuery']([_0x7561('0x21'),_0x7561('0x3b'),_0x7561('0x3c'),_0x7561('0x28'),_0x3db1be,_0x7561('0x3d'),_0x7561('0x3e')],squel['select']()[_0x7561('0x3f')](_0x7561('0x21'),_0x7561('0x21'))[_0x7561('0x3f')]('NOW()',_0x7561('0x3b'))['field']('id','ContactId')['field'](LISTID[_0x7561('0x40')](),_0x7561('0x28'))[_0x7561('0x3f')](_0x5c0170['id'][_0x7561('0x40')](),_0x3db1be)[_0x7561('0x3f')](_0x7561('0x41'),_0x7561('0x3d'))['field'](_0x7561('0x41'),_0x7561('0x3e'))[_0x7561('0x42')]('cm_contacts')[_0x7561('0x43')](_0x7561('0x44'))['where'](_0x7561('0x45'),LISTID[_0x7561('0x40')]())[_0x7561('0x43')](_0x7561('0x46'))[_0x7561('0x43')](_0x7561('0x47'),squel['select']()[_0x7561('0x3f')](_0x7561('0x21'))[_0x7561('0x42')](_0x7561('0x3a'))[_0x7561('0x43')](_0x3db1be+_0x7561('0x48'),_0x5c0170['id']['toString']())))[_0x7561('0x40')]();return _0x3a7485;};var _0x30d8ca=function(_0x2cc3da,_0x5275dd){var _0x3a5a15=squel[_0x7561('0x49')]()[_0x7561('0x39')]('cm_hopper')[_0x7561('0x4a')](['phone',_0x7561('0x3b'),_0x7561('0x3c'),_0x7561('0x28'),_0x5275dd,'createdAt',_0x7561('0x3e')],squel[_0x7561('0x4b')]()[_0x7561('0x3f')](_0x7561('0x21'),_0x7561('0x21'))['field'](_0x7561('0x41'),_0x7561('0x3b'))[_0x7561('0x3f')]('id',_0x7561('0x3c'))['field'](LISTID[_0x7561('0x40')](),_0x7561('0x28'))[_0x7561('0x3f')](_0x2cc3da['id'][_0x7561('0x40')](),_0x5275dd)[_0x7561('0x3f')](_0x7561('0x41'),_0x7561('0x3d'))[_0x7561('0x3f')](_0x7561('0x41'),_0x7561('0x3e'))[_0x7561('0x42')](_0x7561('0x4c'))[_0x7561('0x43')]('deletedAt\x20IS\x20NULL')[_0x7561('0x43')]('ListId\x20=\x20?',LISTID[_0x7561('0x40')]())[_0x7561('0x43')](_0x7561('0x4d'),squel[_0x7561('0x4e')](hopperContacts))[_0x7561('0x43')](_0x7561('0x46'))[_0x7561('0x43')](_0x7561('0x47'),squel['select']()[_0x7561('0x3f')](_0x7561('0x4f'))['from'](_0x7561('0x50'))[_0x7561('0x43')](_0x5275dd+_0x7561('0x48'),_0x2cc3da['id'][_0x7561('0x40')]()))[_0x7561('0x43')](_0x7561('0x47'),squel['select']()[_0x7561('0x3f')](_0x7561('0x21'))['from'](_0x7561('0x3a'))[_0x7561('0x43')](_0x5275dd+_0x7561('0x48'),_0x2cc3da['id'][_0x7561('0x40')]())))[_0x7561('0x40')]();return _0x3a5a15;};function _0xfe5fdc(_0x48d6fe,_0x456aca){var _0x2436ae=squel[_0x7561('0x49')]()[_0x7561('0x39')]('cm_hopper')[_0x7561('0x4a')]([_0x7561('0x21'),_0x7561('0x3b'),_0x7561('0x3c'),_0x7561('0x28'),_0x456aca,'createdAt',_0x7561('0x3e')],squel[_0x7561('0x4b')]()[_0x7561('0x3f')](_0x7561('0x21'),_0x7561('0x21'))[_0x7561('0x3f')]('NOW()',_0x7561('0x3b'))[_0x7561('0x3f')]('id',_0x7561('0x3c'))[_0x7561('0x3f')](LISTID[_0x7561('0x40')](),_0x7561('0x28'))['field'](_0x48d6fe['id']['toString'](),_0x456aca)[_0x7561('0x3f')]('NOW()',_0x7561('0x3d'))[_0x7561('0x3f')](_0x7561('0x41'),'updatedAt')[_0x7561('0x42')](_0x7561('0x4c'))[_0x7561('0x43')](_0x7561('0x44'))[_0x7561('0x43')](_0x7561('0x45'),LISTID['toString']())[_0x7561('0x43')](_0x7561('0x4d'),squel[_0x7561('0x4e')](hopperContacts))[_0x7561('0x43')](_0x7561('0x46')))[_0x7561('0x40')]();return _0x2436ae;}function _0x1ff288(_0x38ebde,_0x2c43c2){var _0x61949b=squel[_0x7561('0x49')]()['into'](_0x7561('0x51'))[_0x7561('0x4a')]([_0x7561('0x21'),_0x7561('0x3c'),'ListId',_0x2c43c2,_0x7561('0x3d'),_0x7561('0x3e')],squel['select']()[_0x7561('0x3f')]('phone',_0x7561('0x21'))[_0x7561('0x3f')]('id',_0x7561('0x3c'))[_0x7561('0x3f')](LISTID[_0x7561('0x40')](),_0x7561('0x28'))[_0x7561('0x3f')](_0x38ebde['id'][_0x7561('0x40')](),_0x2c43c2)[_0x7561('0x3f')](_0x7561('0x41'),_0x7561('0x3d'))[_0x7561('0x3f')](_0x7561('0x41'),_0x7561('0x3e'))[_0x7561('0x42')](_0x7561('0x4c'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x7561('0x45'),LISTID[_0x7561('0x40')]())[_0x7561('0x43')](_0x7561('0x4d'),squel[_0x7561('0x4e')](hopperContacts))[_0x7561('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x7561('0x40')]();return _0x61949b;}return db[_0x7561('0x52')][_0x7561('0x53')]({'where':{'type':_0x7561('0x54')},'attributes':['id',_0x7561('0x55')],'include':[{'model':db[_0x7561('0x56')],'as':_0x7561('0x57'),'where':{'id':LISTID}}]})[_0x7561('0x2f')](function(_0x256122){var _0x159c91=[];if(_0x256122){var _0x2999c6;for(var _0x493efd=0x0,_0x13b86e;_0x493efd<_0x256122['length'];_0x493efd+=0x1){_0x13b86e=_0x256122[_0x493efd]['get']({'plain':!![]});switch(_0x13b86e['dialCheckDuplicateType']){case _0x7561('0x58'):_0x159c91[_0x7561('0x30')](db['sequelize'][_0x7561('0x59')](_0x30d8ca(_0x13b86e,_0x7561('0x5a')))[_0x7561('0x2f')](function(){})[_0x7561('0x32')](_0x5419b7()));break;case _0x7561('0x5b'):_0x159c91[_0x7561('0x30')](db[_0x7561('0x5c')][_0x7561('0x59')](_0x3050d6(_0x13b86e,'VoiceQueueId'))[_0x7561('0x2f')](function(){})[_0x7561('0x32')](_0x5419b7()));break;default:_0x159c91[_0x7561('0x30')](db['sequelize'][_0x7561('0x59')](_0xfe5fdc(_0x13b86e,_0x7561('0x5a')))['then'](function(){})['catch'](_0x5419b7()));}}}return _0x159c91;})[_0x7561('0x5d')]()[_0x7561('0x2f')](function(){return db['VoiceQueue'][_0x7561('0x53')]({'where':{'type':_0x7561('0x54')},'attributes':['id'],'include':[{'model':db[_0x7561('0x56')],'as':_0x7561('0x5e'),'where':{'id':LISTID}}]})[_0x7561('0x2f')](function(_0x5c9222){var _0x26e23d=[];if(_0x5c9222){var _0x34412c;for(var _0x42c9ee=0x0,_0x3b234d;_0x42c9ee<_0x5c9222[_0x7561('0x1a')];_0x42c9ee+=0x1){_0x3b234d=_0x5c9222[_0x42c9ee]['get']({'plain':!![]});_0x26e23d['push'](db['sequelize'][_0x7561('0x59')](_0x1ff288(_0x3b234d,_0x7561('0x5a')))['then'](function(){})[_0x7561('0x32')](_0x5419b7()));}}return _0x26e23d;})[_0x7561('0x5d')]();})[_0x7561('0x2f')](function(){return db[_0x7561('0x5f')]['findAll']({'attributes':['id',_0x7561('0x55')],'include':[{'model':db[_0x7561('0x56')],'as':'Lists','where':{'id':LISTID}}]})[_0x7561('0x2f')](function(_0x1c5df8){var _0x423445=[];if(_0x1c5df8){for(var _0x30048b=0x0,_0x155d3c;_0x30048b<_0x1c5df8[_0x7561('0x1a')];_0x30048b+=0x1){_0x155d3c=_0x1c5df8[_0x30048b]['get']({'plain':!![]});switch(_0x155d3c['dialCheckDuplicateType']){case _0x7561('0x58'):_0x423445[_0x7561('0x30')](db[_0x7561('0x5c')][_0x7561('0x59')](_0x30d8ca(_0x155d3c,_0x7561('0x60')))['then'](function(){})['catch'](_0x5419b7()));break;case'onlyIfOpen':_0x423445['push'](db['sequelize'][_0x7561('0x59')](_0x3050d6(_0x155d3c,_0x7561('0x60')))[_0x7561('0x2f')](function(){})[_0x7561('0x32')](_0x5419b7()));break;default:_0x423445[_0x7561('0x30')](db[_0x7561('0x5c')][_0x7561('0x59')](_0xfe5fdc(_0x155d3c,_0x7561('0x60')))[_0x7561('0x2f')](function(){})['catch'](_0x5419b7()));}}}return _0x423445;})[_0x7561('0x5d')]();})['then'](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0x7561('0x56')],'as':_0x7561('0x5e'),'where':{'id':LISTID}}]})[_0x7561('0x2f')](function(_0x213a05){var _0x42fc05=[];if(_0x213a05){for(var _0x2b6e04=0x0,_0x538504;_0x2b6e04<_0x213a05[_0x7561('0x1a')];_0x2b6e04+=0x1){_0x538504=_0x213a05[_0x2b6e04][_0x7561('0x61')]({'plain':!![]});_0x42fc05[_0x7561('0x30')](db['sequelize']['query'](_0x1ff288(_0x538504,_0x7561('0x60')))['then'](function(){})['catch'](_0x5419b7()));}}return _0x42fc05;})[_0x7561('0x5d')]();})[_0x7561('0x32')](function(_0x4ab38a){logger['error'](_0x7561('0x62'),'generalCheckHopper',_0x4ab38a['message']);});}var processPromises=function(_0x29a23f){return BPromise['all'](promises)[_0x7561('0x2f')](function(_0x2c3e65){})[_0x7561('0x32')](function(_0x177045){logger[_0x7561('0x1f')]('Error\x20processing\x20rows\x20block:',JSON[_0x7561('0x35')](_0x177045));})[_0x7561('0x63')](function(){socket[_0x7561('0x64')](_0x7561('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x29a23f){return _0x29a23f['resume']();}});};var endCsv=function(){return BPromise[_0x7561('0x66')]()[_0x7561('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0x7561('0x2f')](function(){socket[_0x7561('0x64')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7561('0x67')](FILEPATH);}catch(_0x16cf26){logger[_0x7561('0x1f')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x16cf26));}finally{process[_0x7561('0x68')](0x0);}});};process['on']('SIGINT',function(){logger[_0x7561('0x69')](_0x7561('0x6a'));endCsv();});function main(){return BPromise[_0x7561('0x66')]()[_0x7561('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7561('0x14')](',');return db[_0x7561('0x6b')][_0x7561('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xe33a16){var _0x1c953b=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x1c953b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4782c5,_0x1aa382){total+=0x1;var _0x58975b=total;promises[_0x7561('0x30')](checkRow(_0x4782c5,_0xe33a16,_0x58975b)[_0x7561('0x2f')](function(){success+=0x1;})[_0x7561('0x32')](function(_0x111036){if(_0x111036['error']){errors+=0x1;delete _0x111036[_0x7561('0x1f')];}else if(_0x111036['duplicate']){duplicates+=0x1;delete _0x111036[_0x7561('0x2b')];}rows[_0x7561('0x30')](_0x111036);}));if(total%0xc8===0x0){_0x1aa382['pause']();return processPromises(_0x1aa382);}},'complete':function(){return processPromises()[_0x7561('0x2f')](function(){logger[_0x7561('0x69')](_0x7561('0x6c'));endCsv();});},'error':function(_0x2c52ca,_0x18d230){logger['info'](_0x7561('0x6d'),JSON['stringify'](_0x2c52ca));endCsv();}});})['catch'](function(_0x3126d2){logger[_0x7561('0x1f')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x7561('0x35')](_0x3126d2));});}main(); \ No newline at end of file +var _0xa105=['ListId','createdAt','field','ContactId','toString','NOW()','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','into','select','id\x20IN\x20?','str','cm_hopper_final','\x20=\x20?','VoiceQueue','outbound','dialCheckDuplicateType','CmList','then','get','always','sequelize','query','VoiceQueueId','all','findAll','BlackLists','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/logger','redis','localhost','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','duplicate','create','keys','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0xa105,0x9d));var _0x5a10=function(_0x6e9200,_0x55132e){_0x6e9200=_0x6e9200-0x0;var _0x3386c7=_0xa105[_0x6e9200];return _0x3386c7;};'use strict';var BPromise=require(_0x5a10('0x0'));var util=require(_0x5a10('0x1'));var _=require(_0x5a10('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x5a10('0x3'));var db=require(_0x5a10('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x5a10('0x5'))('api');config[_0x5a10('0x6')]=_['defaults'](config['redis'],{'host':_0x5a10('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a10('0x6')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x5a10('0x8')][0x2]||process[_0x5a10('0x8')][0x2]===_0x5a10('0x9')||process['argv'][0x2]===_0x5a10('0xa')){throw new Error(_0x5a10('0xb'));}var FILEPATH=process[_0x5a10('0x8')][0x2];if(!process[_0x5a10('0x8')][0x3]||process[_0x5a10('0x8')][0x3]===_0x5a10('0x9')||process[_0x5a10('0x8')][0x3]===_0x5a10('0xa')||!process[_0x5a10('0x8')][0x4]||process['argv'][0x4]==='undefined'||process[_0x5a10('0x8')][0x4]===_0x5a10('0xa')){throw new Error(_0x5a10('0xc'));}var FIELDS=_[_0x5a10('0xd')](process[_0x5a10('0x8')][0x3][_0x5a10('0xe')](','),process[_0x5a10('0x8')][0x4][_0x5a10('0xe')](','));if(!process[_0x5a10('0x8')][0x5]||process[_0x5a10('0x8')][0x5]==='undefined'||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x5a10('0x8')][0x5];var COMPANYID=process[_0x5a10('0x8')][0x6]&&process[_0x5a10('0x8')][0x6]!=='undefined'&&process[_0x5a10('0x8')][0x6]!==_0x5a10('0xa')?process[_0x5a10('0x8')][0x6]:null;var DUPLICATES=process[_0x5a10('0x8')][0x7]&&process[_0x5a10('0x8')][0x7]!==_0x5a10('0x9')&&process[_0x5a10('0x8')][0x7]!==_0x5a10('0xa')?process[_0x5a10('0x8')][0x7]:null;if(!process[_0x5a10('0x8')][0x8]||process[_0x5a10('0x8')][0x8]===_0x5a10('0x9')||process[_0x5a10('0x8')][0x8]===_0x5a10('0xa')){throw new Error(_0x5a10('0xf'));}var SOCKET_TIMESTAMP=process[_0x5a10('0x8')][0x8];}catch(_0x300b5d){logger[_0x5a10('0x10')](_0x300b5d);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(_0x29745f,_0x5b0204,_0x50674c,_0x2223be){var _0x25b2de={'message':_0x5b0204};_0x25b2de[_0x29745f]=!![];if(_0x50674c){_0x25b2de[_0x5a10('0x11')]=_0x50674c;}if(_0x2223be){_0x25b2de[_0x5a10('0x12')]=_0x2223be;}return _0x25b2de;}function isEmail(_0x34cb01){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))*$/[_0x5a10('0x13')](_0x34cb01);}function checkRow(_0x486ca9,_0x1012cb,_0x14110a){return new BPromise(function(_0x9558,_0x483a7d){if(_[_0x5a10('0x14')](_0x486ca9)){return _0x483a7d(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x14110a));}if(_0x486ca9['errors']&&_0x486ca9['errors']['length']){var _0x489b51=_['map'](_0x486ca9[_0x5a10('0x15')],_0x5a10('0x16'))[_0x5a10('0x17')](';');return _0x483a7d(handleCheckRowError(_0x5a10('0x10'),_0x489b51,null,_0x14110a));}var _0x10815e={};for(var _0x3390be in FIELDS){if(FIELDS[_0x5a10('0x18')](_0x3390be)&&FIELDS[_0x3390be]){_0x10815e[_0x3390be]=_0x486ca9[_0x5a10('0x19')][0x0][FIELDS[_0x3390be]]||_0x486ca9[_0x5a10('0x19')][0x0]['\ufeff'+FIELDS[_0x3390be]];}}if(!_0x10815e[_0x5a10('0x1a')]){return _0x483a7d(handleCheckRowError(_0x5a10('0x10'),_0x5a10('0x1b'),null,_0x14110a));}if(!_0x10815e[_0x5a10('0x1c')]){return _0x483a7d(handleCheckRowError(_0x5a10('0x10'),'phone\x20not\x20specified!',null,_0x14110a));}if(_0x10815e[_0x5a10('0x1d')]){var _0x5cd465=moment(_0x10815e[_0x5a10('0x1d')],_0x5a10('0x1e'));if(!_0x5cd465[_0x5a10('0x1f')]()){return _0x483a7d(handleCheckRowError(_0x5a10('0x10'),_0x5a10('0x20'),null,_0x14110a));}}if(_0x10815e[_0x5a10('0x21')]){if(!isEmail(_0x10815e[_0x5a10('0x21')])){return _0x483a7d(handleCheckRowError(_0x5a10('0x10'),_0x5a10('0x22'),null,_0x14110a));}}_0x10815e['ListId']=LISTID;_0x10815e[_0x5a10('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5a10('0x24')]&&_0x1012cb){var _0x4472b3={};for(var _0xe7098a=0x0,_0x326caf=DUPLICATES[_0x5a10('0x24')];_0xe7098a<_0x326caf;_0xe7098a+=0x1){_0x4472b3[DUPLICATES[_0xe7098a]]=_0x10815e[DUPLICATES[_0xe7098a]];}var _0x334232=_['find'](_0x1012cb,_0x4472b3);if(_0x334232){return _0x483a7d(handleCheckRowError(_0x5a10('0x25'),'Duplicate\x20Contact',_0x334232,_0x14110a));}}return db['CmContact'][_0x5a10('0x26')](_0x10815e,{'raw':!![],'hooks':![],'fields':_[_0x5a10('0x27')](_0x10815e)})['then'](function(_0x262d12){if(DUPLICATES&&DUPLICATES['length']&&_0x1012cb){_0x1012cb[_0x5a10('0x28')](_['pick'](_0x10815e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x262d12['id'];return _0x9558();})[_0x5a10('0x29')](function(_0x2bd59a){return _0x483a7d(handleCheckRowError(_0x5a10('0x10'),_0x5a10('0x2a')+(_0x2bd59a[_0x5a10('0x16')]||JSON[_0x5a10('0x2b')](_0x2bd59a)),null,_0x14110a));});});}function checkHopper(){function _0x224218(){return function(_0x4a4b15){logger[_0x5a10('0x10')](_0x5a10('0x2c'),_0x5a10('0x2d'),util[_0x5a10('0x2e')](_0x4a4b15,{'showHidden':![],'depth':null}));};}var _0x2a7360=function(_0x51e68e,_0x42638c){var _0x5ea677=squel[_0x5a10('0x2f')]()['into'](_0x5a10('0x30'))[_0x5a10('0x31')]([_0x5a10('0x1c'),_0x5a10('0x32'),'ContactId',_0x5a10('0x33'),_0x42638c,_0x5a10('0x34'),'updatedAt'],squel['select']()['field']('phone',_0x5a10('0x1c'))[_0x5a10('0x35')]('NOW()',_0x5a10('0x32'))[_0x5a10('0x35')]('id',_0x5a10('0x36'))[_0x5a10('0x35')](LISTID[_0x5a10('0x37')](),'ListId')[_0x5a10('0x35')](_0x51e68e['id'][_0x5a10('0x37')](),_0x42638c)[_0x5a10('0x35')](_0x5a10('0x38'),_0x5a10('0x34'))[_0x5a10('0x35')](_0x5a10('0x38'),_0x5a10('0x39'))['from'](_0x5a10('0x3a'))[_0x5a10('0x3b')](_0x5a10('0x3c'))[_0x5a10('0x3b')](_0x5a10('0x3d'),LISTID[_0x5a10('0x37')]())['where'](_0x5a10('0x3e'))[_0x5a10('0x3b')](_0x5a10('0x3f'),squel['select']()[_0x5a10('0x35')]('phone')[_0x5a10('0x40')](_0x5a10('0x30'))[_0x5a10('0x3b')](_0x42638c+'\x20=\x20?',_0x51e68e['id'][_0x5a10('0x37')]())))['toString']();return _0x5ea677;};var _0x35feec=function(_0x25f7c1,_0x40b126){var _0x25a0f4=squel[_0x5a10('0x2f')]()[_0x5a10('0x41')](_0x5a10('0x30'))['fromQuery']([_0x5a10('0x1c'),'scheduledAt','ContactId','ListId',_0x40b126,'createdAt',_0x5a10('0x39')],squel[_0x5a10('0x42')]()[_0x5a10('0x35')](_0x5a10('0x1c'),_0x5a10('0x1c'))[_0x5a10('0x35')](_0x5a10('0x38'),_0x5a10('0x32'))['field']('id','ContactId')[_0x5a10('0x35')](LISTID['toString'](),_0x5a10('0x33'))[_0x5a10('0x35')](_0x25f7c1['id'][_0x5a10('0x37')](),_0x40b126)[_0x5a10('0x35')](_0x5a10('0x38'),_0x5a10('0x34'))['field'](_0x5a10('0x38'),'updatedAt')[_0x5a10('0x40')](_0x5a10('0x3a'))[_0x5a10('0x3b')](_0x5a10('0x3c'))[_0x5a10('0x3b')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x5a10('0x43'),squel[_0x5a10('0x44')](hopperContacts))[_0x5a10('0x3b')](_0x5a10('0x3e'))[_0x5a10('0x3b')](_0x5a10('0x3f'),squel['select']()[_0x5a10('0x35')]('calleridnum')[_0x5a10('0x40')](_0x5a10('0x45'))['where'](_0x40b126+_0x5a10('0x46'),_0x25f7c1['id'][_0x5a10('0x37')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x5a10('0x35')](_0x5a10('0x1c'))[_0x5a10('0x40')](_0x5a10('0x30'))[_0x5a10('0x3b')](_0x40b126+_0x5a10('0x46'),_0x25f7c1['id'][_0x5a10('0x37')]())))[_0x5a10('0x37')]();return _0x25a0f4;};function _0x9d1fdb(_0x566de7,_0x1c741d){var _0x4172cc=squel[_0x5a10('0x2f')]()[_0x5a10('0x41')](_0x5a10('0x30'))[_0x5a10('0x31')]([_0x5a10('0x1c'),_0x5a10('0x32'),_0x5a10('0x36'),_0x5a10('0x33'),_0x1c741d,'createdAt',_0x5a10('0x39')],squel[_0x5a10('0x42')]()[_0x5a10('0x35')](_0x5a10('0x1c'),_0x5a10('0x1c'))[_0x5a10('0x35')](_0x5a10('0x38'),'scheduledAt')['field']('id',_0x5a10('0x36'))['field'](LISTID[_0x5a10('0x37')](),_0x5a10('0x33'))['field'](_0x566de7['id']['toString'](),_0x1c741d)[_0x5a10('0x35')](_0x5a10('0x38'),_0x5a10('0x34'))['field'](_0x5a10('0x38'),_0x5a10('0x39'))['from'](_0x5a10('0x3a'))[_0x5a10('0x3b')](_0x5a10('0x3c'))['where'](_0x5a10('0x3d'),LISTID[_0x5a10('0x37')]())[_0x5a10('0x3b')]('id\x20IN\x20?',squel[_0x5a10('0x44')](hopperContacts))[_0x5a10('0x3b')](_0x5a10('0x3e')))[_0x5a10('0x37')]();return _0x4172cc;}function _0x38cc27(_0x3c70b5,_0x5ded58){var _0x4e2e81=squel[_0x5a10('0x2f')]()[_0x5a10('0x41')]('cm_hopper_black')[_0x5a10('0x31')]([_0x5a10('0x1c'),_0x5a10('0x36'),_0x5a10('0x33'),_0x5ded58,'createdAt',_0x5a10('0x39')],squel['select']()[_0x5a10('0x35')](_0x5a10('0x1c'),_0x5a10('0x1c'))[_0x5a10('0x35')]('id','ContactId')['field'](LISTID['toString'](),'ListId')['field'](_0x3c70b5['id']['toString'](),_0x5ded58)[_0x5a10('0x35')](_0x5a10('0x38'),'createdAt')[_0x5a10('0x35')](_0x5a10('0x38'),'updatedAt')['from']('cm_contacts')[_0x5a10('0x3b')](_0x5a10('0x3c'))[_0x5a10('0x3b')](_0x5a10('0x3d'),LISTID[_0x5a10('0x37')]())[_0x5a10('0x3b')](_0x5a10('0x43'),squel[_0x5a10('0x44')](hopperContacts))[_0x5a10('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x5a10('0x37')]();return _0x4e2e81;}return db[_0x5a10('0x47')]['findAll']({'where':{'type':_0x5a10('0x48')},'attributes':['id',_0x5a10('0x49')],'include':[{'model':db[_0x5a10('0x4a')],'as':'Lists','where':{'id':LISTID}}]})[_0x5a10('0x4b')](function(_0x21c14b){var _0x127a7c=[];if(_0x21c14b){var _0x3762c7;for(var _0xcbbc9f=0x0,_0x39af68;_0xcbbc9f<_0x21c14b[_0x5a10('0x24')];_0xcbbc9f+=0x1){_0x39af68=_0x21c14b[_0xcbbc9f][_0x5a10('0x4c')]({'plain':!![]});switch(_0x39af68[_0x5a10('0x49')]){case _0x5a10('0x4d'):_0x127a7c[_0x5a10('0x28')](db[_0x5a10('0x4e')]['query'](_0x35feec(_0x39af68,'VoiceQueueId'))[_0x5a10('0x4b')](function(){})[_0x5a10('0x29')](_0x224218()));break;case'onlyIfOpen':_0x127a7c['push'](db[_0x5a10('0x4e')][_0x5a10('0x4f')](_0x2a7360(_0x39af68,_0x5a10('0x50')))[_0x5a10('0x4b')](function(){})[_0x5a10('0x29')](_0x224218()));break;default:_0x127a7c[_0x5a10('0x28')](db[_0x5a10('0x4e')][_0x5a10('0x4f')](_0x9d1fdb(_0x39af68,_0x5a10('0x50')))['then'](function(){})[_0x5a10('0x29')](_0x224218()));}}}return _0x127a7c;})[_0x5a10('0x51')]()[_0x5a10('0x4b')](function(){return db['VoiceQueue'][_0x5a10('0x52')]({'where':{'type':_0x5a10('0x48')},'attributes':['id'],'include':[{'model':db[_0x5a10('0x4a')],'as':_0x5a10('0x53'),'where':{'id':LISTID}}]})[_0x5a10('0x4b')](function(_0x2936e6){var _0x2c3ca8=[];if(_0x2936e6){var _0x1daaec;for(var _0x20b3e1=0x0,_0x47cb1c;_0x20b3e1<_0x2936e6[_0x5a10('0x24')];_0x20b3e1+=0x1){_0x47cb1c=_0x2936e6[_0x20b3e1][_0x5a10('0x4c')]({'plain':!![]});_0x2c3ca8['push'](db[_0x5a10('0x4e')][_0x5a10('0x4f')](_0x38cc27(_0x47cb1c,_0x5a10('0x50')))[_0x5a10('0x4b')](function(){})['catch'](_0x224218()));}}return _0x2c3ca8;})[_0x5a10('0x51')]();})[_0x5a10('0x4b')](function(){return db[_0x5a10('0x54')][_0x5a10('0x52')]({'attributes':['id',_0x5a10('0x49')],'include':[{'model':db['CmList'],'as':_0x5a10('0x55'),'where':{'id':LISTID}}]})[_0x5a10('0x4b')](function(_0x87c1c0){var _0x5260b5=[];if(_0x87c1c0){for(var _0x59e5c4=0x0,_0x518f43;_0x59e5c4<_0x87c1c0[_0x5a10('0x24')];_0x59e5c4+=0x1){_0x518f43=_0x87c1c0[_0x59e5c4][_0x5a10('0x4c')]({'plain':!![]});switch(_0x518f43[_0x5a10('0x49')]){case _0x5a10('0x4d'):_0x5260b5[_0x5a10('0x28')](db[_0x5a10('0x4e')][_0x5a10('0x4f')](_0x35feec(_0x518f43,_0x5a10('0x56')))[_0x5a10('0x4b')](function(){})[_0x5a10('0x29')](_0x224218()));break;case _0x5a10('0x57'):_0x5260b5['push'](db['sequelize'][_0x5a10('0x4f')](_0x2a7360(_0x518f43,'CampaignId'))['then'](function(){})[_0x5a10('0x29')](_0x224218()));break;default:_0x5260b5['push'](db[_0x5a10('0x4e')][_0x5a10('0x4f')](_0x9d1fdb(_0x518f43,_0x5a10('0x56')))[_0x5a10('0x4b')](function(){})[_0x5a10('0x29')](_0x224218()));}}}return _0x5260b5;})[_0x5a10('0x51')]();})[_0x5a10('0x4b')](function(){return db['Campaign'][_0x5a10('0x52')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x5a10('0x53'),'where':{'id':LISTID}}]})[_0x5a10('0x4b')](function(_0x10fc75){var _0x1dfc62=[];if(_0x10fc75){for(var _0x5d3e38=0x0,_0xfdcc4f;_0x5d3e38<_0x10fc75[_0x5a10('0x24')];_0x5d3e38+=0x1){_0xfdcc4f=_0x10fc75[_0x5d3e38][_0x5a10('0x4c')]({'plain':!![]});_0x1dfc62[_0x5a10('0x28')](db[_0x5a10('0x4e')][_0x5a10('0x4f')](_0x38cc27(_0xfdcc4f,_0x5a10('0x56')))['then'](function(){})['catch'](_0x224218()));}}return _0x1dfc62;})[_0x5a10('0x51')]();})['catch'](function(_0x108edf){logger[_0x5a10('0x10')](_0x5a10('0x58'),'generalCheckHopper',_0x108edf[_0x5a10('0x16')]);});}var processPromises=function(_0x647b83){return BPromise[_0x5a10('0x51')](promises)[_0x5a10('0x4b')](function(_0x5d77a0){})[_0x5a10('0x29')](function(_0x91efe){logger[_0x5a10('0x10')](_0x5a10('0x59'),JSON[_0x5a10('0x2b')](_0x91efe));})['finally'](function(){socket[_0x5a10('0x5a')](_0x5a10('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x647b83){return _0x647b83['resume']();}});};var endCsv=function(){return BPromise[_0x5a10('0x5c')]()[_0x5a10('0x4b')](function(){if(hopperContacts){return checkHopper();}})[_0x5a10('0x4b')](function(){socket[_0x5a10('0x5a')](_0x5a10('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2705e0){logger['error'](_0x5a10('0x5d'),JSON[_0x5a10('0x2b')](_0x2705e0));}finally{process[_0x5a10('0x5e')](0x0);}});};process['on']('SIGINT',function(){logger[_0x5a10('0x5f')](_0x5a10('0x60'));endCsv();});function main(){return BPromise[_0x5a10('0x5c')]()[_0x5a10('0x4b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x5a10('0xe')](',');return db[_0x5a10('0x61')][_0x5a10('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x5a10('0x4b')](function(_0x35028c){var _0x790142=fs[_0x5a10('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5a10('0x63')](_0x790142,{'header':!![],'skipEmptyLines':!![],'step':function(_0x54ba4c,_0x260295){total+=0x1;var _0x1412fe=total;promises['push'](checkRow(_0x54ba4c,_0x35028c,_0x1412fe)[_0x5a10('0x4b')](function(){success+=0x1;})[_0x5a10('0x29')](function(_0x39246f){if(_0x39246f['error']){errors+=0x1;delete _0x39246f[_0x5a10('0x10')];}else if(_0x39246f[_0x5a10('0x25')]){duplicates+=0x1;delete _0x39246f['duplicate'];}rows['push'](_0x39246f);}));if(total%0xc8===0x0){_0x260295[_0x5a10('0x64')]();return processPromises(_0x260295);}},'complete':function(){return processPromises()[_0x5a10('0x4b')](function(){logger[_0x5a10('0x5f')](_0x5a10('0x65'));endCsv();});},'error':function(_0x5d7285,_0x267b7e){logger[_0x5a10('0x5f')](_0x5a10('0x66'),JSON[_0x5a10('0x2b')](_0x5d7285));endCsv();}});})[_0x5a10('0x29')](function(_0x2381ef){logger[_0x5a10('0x10')](_0x5a10('0x67'),JSON[_0x5a10('0x2b')](_0x2381ef));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 01a2a72..917c68a 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 _0xad6a=['recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','all','dialTimezone','set','offset','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','ContactItemType','findAll','name','header','writeFileSync','parse','createReadStream','data','rows','find','_description','isNil','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','utcOffset','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','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()','DROP\x20TABLE\x20','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','length','push','split','CmContactHasItem','findOne','update','updated','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','phone','ContactId','createdAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','join','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','ListId','cm_contacts','.CmListId','cm_hopper_black','ListId\x20=\x20?','\x20=\x20','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','scheduledat','updatedAt'];(function(_0x235922,_0x521641){var _0x3a5180=function(_0x8806f6){while(--_0x8806f6){_0x235922['push'](_0x235922['shift']());}};_0x3a5180(++_0x521641);}(_0xad6a,0x136));var _0xaad6=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xad6a[_0x172747];return _0x509692;};'use strict';var fs=require('fs');var path=require(_0xaad6('0x0'));var _=require(_0xaad6('0x1'));var Papa=require(_0xaad6('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xaad6('0x3'));var squel=require(_0xaad6('0x4'));var Redis=require(_0xaad6('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xaad6('0x6'));var shared=require(_0xaad6('0x7'));var logger=require(_0xaad6('0x8'))('import');config[_0xaad6('0x9')]=_['defaults'](config[_0xaad6('0x9')],{'host':_0xaad6('0xa'),'port':0x18eb});var socket=require(_0xaad6('0xb'))(new Redis(config[_0xaad6('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xaad6('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xaad6('0xc')](_0xaad6('0xd'));function isEmail(_0x525be9){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))*$/[_0xaad6('0xe')](_0x525be9);}function selectNotIn(_0x3147de,_0x4a390b,_0x4e6417,_0x12af94,_0x58e7e1){return squel[_0xaad6('0xf')]()[_0xaad6('0x10')]('phone')[_0xaad6('0x11')](_0x12af94)['join'](_0x4a390b,null,_0x4a390b+'.id\x20=\x20'+_0x12af94+'.'+_0x4e6417)[_0xaad6('0x12')](_0x12af94+'.'+_0x4e6417+'\x20=\x20'+_0x3147de+'.'+_0x4e6417)[_0xaad6('0x12')](_0x4a390b+_0xaad6('0x13')+_0x58e7e1['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2839fd,_0x4d4b87){promisesAdditionalPhones=[];return db[_0xaad6('0x14')]['findAll']({'raw':!![],'attributes':['id',_0xaad6('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xaad6('0x16')](function(_0x1b785b){if(_0x1b785b!==null){var _0x31c4cb=[];for(var _0x4fdbf6=0x0;_0x4fdbf6<_0x1b785b[_0xaad6('0x17')];_0x4fdbf6++){var _0x1cb08e=_0x1b785b[_0x4fdbf6];_0x31c4cb[_0xaad6('0x18')](insertAdditionalPhones(_0x1cb08e));}}Promise['all'](_0x31c4cb)['then'](function(){_0x2839fd({'val':0x1});});});});}function insertAdditionalPhones(_0x55d440){return new Promise(function(_0x3bf84b,_0x1ce465){var _0x1923a6=_0x55d440[_0xaad6('0x15')];var _0x27d7f7=_0x1923a6[_0xaad6('0x19')](';');var _0x35a358=[];orderBy=0x0;for(var _0x442f88=0x0;_0x442f88<_0x27d7f7[_0xaad6('0x17')];_0x442f88++){_0x35a358[_0xaad6('0x18')](splitAdditionalPhone(_0x55d440['id'],_0x27d7f7[_0x442f88]));}Promise['all'](_0x35a358)['then'](function(){_0x3bf84b({'val':_0x27d7f7[_0xaad6('0x17')]});});});}function splitAdditionalPhone(_0x2e4183,_0x5b857a){return new Promise(function(_0x558364,_0x9e1d0e){var _0x3cfcf1=_0x5b857a[_0xaad6('0x19')](':');var _0x284ef5=_0x3cfcf1[0x0];var _0x4794f0=_0x3cfcf1[0x1];if(!_['isNil'](_0x4794f0)){var _0x3dfd8c=_0x4794f0[_0xaad6('0x19')]('|');var _0x367832=[];for(var _0x315118=0x0;_0x315118<_0x3dfd8c['length'];_0x315118++){if(_0x3dfd8c[_0x315118]!==''){var _0x95dc85=_['filter'](promisesAdditionalPhones,{'contactId':_0x2e4183,'phone':_0x3dfd8c[_0x315118]});if(_0x95dc85['length']==0x0){orderBy++;promisesAdditionalPhones[_0xaad6('0x18')]({'contactId':_0x2e4183,'contactTypeId':_0x284ef5,'phone':_0x3dfd8c[_0x315118],'orderBy':orderBy});}}}_0x558364({'ok':0x1});}else _0x558364({'res':0x0});});}function createAdditionalPhone(_0x50699e,_0x3e2956,_0x364193,_0xb47fe6){var _0x102455='';var _0x70500e='';var _0x341930=_0x364193['split']('§');_0x102455=_0x341930[0x0];if(_0x341930[_0xaad6('0x17')]==0x2)_0x70500e=_0x341930[0x1];return new Promise(function(_0x5e84d6,_0x33fe3e){return db[_0xaad6('0x1a')][_0xaad6('0x1b')]({'where':{'CmContactId':_0x50699e,'item':_0x102455}})[_0xaad6('0x16')](function(_0x141cbf){if(_0x141cbf){return db[_0xaad6('0x1a')][_0xaad6('0x1c')]({'ItemTypeId':_0x3e2956,'description':_0x70500e,'OrderBy':_0xb47fe6},{'where':{'CmContactId':_0x50699e,'item':_0x102455}})[_0xaad6('0x16')](function(_0x350992){_0x5e84d6({'res':_0xaad6('0x1d')});});}else{return db[_0xaad6('0x1a')]['create']({'CmContactId':_0x50699e,'item':_0x102455,'description':_0x70500e,'ItemTypeId':_0x3e2956,'OrderBy':_0xb47fe6,'ItemClass':_0xaad6('0x1e')})['then'](function(_0x5cc2d7){_0x5e84d6({'res':'inserted'});});}});});}function insertCmHopper(_0x4738d2,_0x1c3b5c,_0x1a3015,_0x134ec8,_0x3fe467){var _0x5592dc=[_0xaad6('0x1f'),_0xaad6('0x20'),'cm_contacts.id',_0xaad6('0x21'),_0x1c3b5c+'.'+_0x134ec8,_0xaad6('0x22'),_0xaad6('0x23'),_0xaad6('0x24'),_0xaad6('0x25'),'\x22'+_0x3fe467+'\x22'];return squel[_0xaad6('0x26')]()[_0xaad6('0x27')]('cm_hopper')[_0xaad6('0x28')]([_0xaad6('0x29'),'scheduledat',_0xaad6('0x2a'),'ListId',_0x134ec8,_0xaad6('0x2b'),'updatedAt',_0xaad6('0x2c'),_0xaad6('0x2d'),'recallme'],squel[_0xaad6('0xf')]()[_0xaad6('0x2e')](_0x5592dc)[_0xaad6('0x11')](_0x1c3b5c)['join']('cm_contacts',null,_0xaad6('0x2f')+_0x1c3b5c+'.CmListId')[_0xaad6('0x30')](_0x1a3015,null,_0x1a3015+_0xaad6('0x31')+_0x1c3b5c+'.'+_0x134ec8)[_0xaad6('0x12')](_0x1c3b5c+_0xaad6('0x32'),_0x4738d2)[_0xaad6('0x12')](_0xaad6('0x33'),NOW)['where'](_0xaad6('0x34'),selectNotIn(_0x1c3b5c,_0x1a3015,_0x134ec8,_0xaad6('0x35'),[_0xaad6('0x36'),_0xaad6('0x37')]))['where'](_0xaad6('0x34'),selectNotIn(_0x1c3b5c,_0x1a3015,_0x134ec8,_0xaad6('0x35'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x10e7ca,_0x1e4d46,_0x18b207,_0x3af0b3){var _0x3d307d=[_0xaad6('0x1f'),'cm_contacts.id',_0xaad6('0x21'),_0x1e4d46+'.'+_0x3af0b3,_0xaad6('0x22'),_0xaad6('0x23')];return squel[_0xaad6('0x26')]()[_0xaad6('0x27')]('cm_hopper_black')['fromQuery']([_0xaad6('0x29'),_0xaad6('0x2a'),_0xaad6('0x38'),_0x3af0b3,_0xaad6('0x2b'),'updatedAt'],squel[_0xaad6('0xf')]()[_0xaad6('0x2e')](_0x3d307d)[_0xaad6('0x11')](_0x1e4d46)[_0xaad6('0x30')](_0xaad6('0x39'),null,_0xaad6('0x2f')+_0x1e4d46+_0xaad6('0x3a'))['join'](_0x18b207,null,_0x18b207+'.id\x20=\x20'+_0x1e4d46+'.'+_0x3af0b3)[_0xaad6('0x12')](_0x1e4d46+_0xaad6('0x32'),_0x10e7ca)[_0xaad6('0x12')](_0xaad6('0x33'),NOW)[_0xaad6('0x12')](_0xaad6('0x34'),squel['select']()[_0xaad6('0x10')](_0xaad6('0x29'))[_0xaad6('0x11')](_0xaad6('0x3b'))[_0xaad6('0x12')](_0xaad6('0x3c'),_0x10e7ca)[_0xaad6('0x12')](_0x3af0b3+_0xaad6('0x3d')+_0x1e4d46+'.'+_0x3af0b3)))[_0xaad6('0x3e')]();}function insertTzCmHopper(_0x50d96b,_0x2be2cf,_0x53a4c8,_0x3add16,_0x58af99,_0x2e46c9){var _0x43877d=[_0xaad6('0x1f'),_0xaad6('0x3f')+_0x2e46c9+_0xaad6('0x40'),_0xaad6('0x41'),'cm_contacts.ListId',_0x2be2cf+'.'+_0x3add16,_0xaad6('0x22'),_0xaad6('0x23'),_0xaad6('0x24'),_0xaad6('0x25'),'\x22'+_0x58af99+'\x22'];var _0x2ef696=squel[_0xaad6('0x26')]()[_0xaad6('0x27')](_0xaad6('0x35'))[_0xaad6('0x28')]([_0xaad6('0x29'),_0xaad6('0x42'),_0xaad6('0x2a'),'ListId',_0x3add16,_0xaad6('0x2b'),_0xaad6('0x43'),_0xaad6('0x2c'),_0xaad6('0x2d'),_0xaad6('0x44')],squel[_0xaad6('0xf')]()['fields'](_0x43877d)['from'](_0x2be2cf)['join'](_0xaad6('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x2be2cf+_0xaad6('0x3a'))[_0xaad6('0x30')](_0x53a4c8,null,_0x53a4c8+'.id\x20=\x20'+_0x2be2cf+'.'+_0x3add16)[_0xaad6('0x30')](_0x2e46c9,null,_0x2e46c9+_0xaad6('0x31')+_0x2be2cf+'.'+_0x3add16)[_0xaad6('0x12')](_0x2be2cf+'.CmListId\x20=\x20?',_0x50d96b)[_0xaad6('0x12')](_0xaad6('0x33'),NOW)[_0xaad6('0x12')](_0xaad6('0x34'),selectNotIn(_0x2be2cf,_0x53a4c8,_0x3add16,_0xaad6('0x35'),['\x22always\x22',_0xaad6('0x37')]))[_0xaad6('0x12')](_0xaad6('0x34'),selectNotIn(_0x2be2cf,_0x53a4c8,_0x3add16,'cm_hopper',[_0xaad6('0x36')])))[_0xaad6('0x3e')]();return _0x2ef696;}function insertTzCmHopperBlack(_0x45bd22,_0x71158b,_0x3046c3,_0x4db966){var _0x45d014=['cm_contacts.phone',_0xaad6('0x41'),_0xaad6('0x21'),_0x71158b+'.'+_0x4db966,_0xaad6('0x22'),_0xaad6('0x23')];return squel[_0xaad6('0x26')]()['into'](_0xaad6('0x3b'))[_0xaad6('0x28')]([_0xaad6('0x29'),'ContactId',_0xaad6('0x38'),_0x4db966,_0xaad6('0x2b'),_0xaad6('0x43')],squel['select']()[_0xaad6('0x2e')](_0x45d014)[_0xaad6('0x11')](_0x71158b)[_0xaad6('0x30')](_0xaad6('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x71158b+_0xaad6('0x3a'))[_0xaad6('0x30')](_0x3046c3,null,_0x3046c3+_0xaad6('0x31')+_0x71158b+'.'+_0x4db966)[_0xaad6('0x12')](_0x71158b+_0xaad6('0x32'),_0x45bd22)['where'](_0xaad6('0x33'),NOW)[_0xaad6('0x12')](_0xaad6('0x34'),squel['select']()[_0xaad6('0x10')](_0xaad6('0x29'))[_0xaad6('0x11')](_0xaad6('0x3b'))[_0xaad6('0x12')](_0xaad6('0x3c'),_0x45bd22)[_0xaad6('0x12')](_0x4db966+_0xaad6('0x3d')+_0x71158b+'.'+_0x4db966)))[_0xaad6('0x3e')]();}function insertCmHopperAdditionalPhones(_0x4ea500){var _0x39c84f=[_0xaad6('0x45'),_0xaad6('0x46'),_0xaad6('0x47'),_0xaad6('0x48'),_0xaad6('0x49')];return squel['insert']()[_0xaad6('0x27')](_0xaad6('0x4a'))['fromQuery']([_0xaad6('0x4b'),'phone',_0xaad6('0x4c'),'createdAt','updatedAt'],squel['select']()[_0xaad6('0x2e')](_0x39c84f)[_0xaad6('0x11')](_0xaad6('0x35'))[_0xaad6('0x30')](_0xaad6('0x39'),null,_0xaad6('0x4d'))['join'](_0xaad6('0x4e'),null,_0xaad6('0x4f'))['where'](_0xaad6('0x50'),_0x4ea500)[_0xaad6('0x12')](_0xaad6('0x33'),NOW))[_0xaad6('0x3e')]();}function insertCmContact(_0x24e5ce,_0x4293c7,_0xbd5f65,_0x50842d){var _0x440102=_[_0xaad6('0x51')](_[_0xaad6('0x52')](_0x50842d),[_0xaad6('0x38'),'CompanyId','createdAt',_0xaad6('0x43'),'scheduledAt']);return squel[_0xaad6('0x26')]()[_0xaad6('0x27')]('cm_contacts')['fromQuery'](_0x440102,squel[_0xaad6('0xf')]()[_0xaad6('0x2e')](_0x440102)[_0xaad6('0x11')](_0x4293c7)[_0xaad6('0x12')]('('+_0xbd5f65[_0xaad6('0x30')](',')+_0xaad6('0x53'),squel[_0xaad6('0xf')]()[_0xaad6('0x2e')](_0xbd5f65)[_0xaad6('0x11')](_0xaad6('0x39'))[_0xaad6('0x12')]('ListId\x20=\x20?',_0x24e5ce)['where']('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0xaad6('0xf')]()[_0xaad6('0x10')](_0xaad6('0x54'),'min_id')[_0xaad6('0x11')](_0x4293c7)[_0xaad6('0x55')](_0xbd5f65['join'](','))))[_0xaad6('0x3e')]();}function handleStop(){logger[_0xaad6('0x56')](_0xaad6('0x57'));stopped=!![];}function handleUncaughtException(_0x199f91){logger[_0xaad6('0x58')](_0x199f91['message']);process[_0xaad6('0x59')](0x1);}function handleError(_0x4b3151,_0x58ef50){stats[_0xaad6('0x5a')][_0xaad6('0x18')]({'name':_0x58ef50[_0xaad6('0x5b')],'message':_0x58ef50[_0xaad6('0x5c')],'row':_0x4b3151});}function handleQuery(_0x5a7c0a){logger[_0xaad6('0x56')](_0x5a7c0a);return db[_0xaad6('0x5d')][_0xaad6('0x5e')](_0x5a7c0a)['spread'](function(_0x3942eb){results['push'](_0x3942eb);})[_0xaad6('0x5f')](function(_0x3ec8a0){logger[_0xaad6('0x58')](_0x3ec8a0[_0xaad6('0x5c')]);});}function updateTzCampaigns(_0x5c4a5a){return new Promise(function(_0x3d69c0,_0x5df312){var _0x55564d=squel[_0xaad6('0xf')]()[_0xaad6('0x2e')]([_0xaad6('0x60'),_0xaad6('0x61')])[_0xaad6('0x11')]('campaigns')[_0xaad6('0x30')](_0xaad6('0x62'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xaad6('0x12')](_0xaad6('0x63')+_0x5c4a5a);db[_0xaad6('0x5d')][_0xaad6('0x5e')](_0x55564d['toString']())[_0xaad6('0x64')](function(_0x30882e){var _0x3e6329=[];for(var _0x419319=0x0;_0x419319<_0x30882e['length'];_0x419319++){_0x3e6329[_0xaad6('0x18')](getTimezoneData(_0x30882e[_0x419319],tmp_campaigns));}BPromise['all'](_0x3e6329)[_0xaad6('0x16')](function(){_0x3d69c0({'val':0x1});});})['catch'](function(_0x513aba){logger['error'](_0x513aba[_0xaad6('0x5c')]);_0x3d69c0({'val':0x0});});});}function updateTzVoiceQueues(_0x58ccb6){return new Promise(function(_0xc8c4,_0x1d01a0){var _0x53a432=squel[_0xaad6('0xf')]()[_0xaad6('0x2e')]([_0xaad6('0x65'),'voice_queues.dialTimezone'])[_0xaad6('0x11')](_0xaad6('0x66'))[_0xaad6('0x30')](_0xaad6('0x67'),null,_0xaad6('0x68'))['where'](_0xaad6('0x69')+_0x58ccb6);db['sequelize']['query'](_0x53a432[_0xaad6('0x3e')]())['spread'](function(_0xe93348){var _0x50673b=[];for(var _0x1843cf=0x0;_0x1843cf<_0xe93348[_0xaad6('0x17')];_0x1843cf++){_0x50673b[_0xaad6('0x18')](getTimezoneData(_0xe93348[_0x1843cf],tmp_voice_queues));}BPromise[_0xaad6('0x6a')](_0x50673b)[_0xaad6('0x16')](function(){_0xc8c4({'val':0x1});});})[_0xaad6('0x5f')](function(_0x271b8f){logger[_0xaad6('0x58')](_0x271b8f[_0xaad6('0x5c')]);_0xc8c4({'val':0x0});});});}function getTimezoneData(_0x54e6cc,_0x5d811a){return new Promise(function(_0x58ca31,_0x4d8a75){var _0x10830e=shared['timezones'];var _0x1b4276=_0x10830e[_0x54e6cc[_0xaad6('0x6b')]];if(_['isNil'](_0x1b4276)){_0x58ca31({'ret':0x1});}else{var _0x6cc9c0=_0x1b4276['utcOffset'];var _0x4d5356=squel[_0xaad6('0x26')]()['into'](_0x5d811a)[_0xaad6('0x6c')]('id',_0x54e6cc['id'])['set'](_0xaad6('0x6d'),_0x6cc9c0)[_0xaad6('0x6c')](_0xaad6('0x6b'),_0x54e6cc[_0xaad6('0x6b')])[_0xaad6('0x3e')]();return db[_0xaad6('0x5d')][_0xaad6('0x5e')](_0x4d5356)[_0xaad6('0x64')](function(_0x55a8d0){_0x58ca31({'ret':0x1});})[_0xaad6('0x5f')](function(_0x263c65){logger[_0xaad6('0x58')](_0x263c65[_0xaad6('0x5c')]);_0x4d8a75({'ret':0x1});});}});}function handleTZQuery(_0x4c8906){logger[_0xaad6('0x56')](_0x4c8906);return db[_0xaad6('0x5d')][_0xaad6('0x5e')](_0x4c8906)['spread'](function(_0x47ecd7){})[_0xaad6('0x5f')](function(_0x38f2a5){logger[_0xaad6('0x58')](_0x38f2a5[_0xaad6('0x5c')]);});}function main(_0x332b40,_0x1ba9a0,_0x16caac,_0x3b9e4f){logger[_0xaad6('0x56')](_0xaad6('0x6e'),_0x332b40,JSON[_0xaad6('0x6f')](_0x1ba9a0));process[_0xaad6('0x70')](_0xaad6('0x71'));var _0x1c02eb=_0x1ba9a0[_0xaad6('0x72')];var _0x444f31=_[_0xaad6('0x73')](_0x1c02eb);var _0x40ef53=_0x1ba9a0[_0xaad6('0x74')];var _0x1bf9cd=path['join'](config['root'],_0xaad6('0x75'),_0x40ef53+_0xaad6('0x76'));hasTZ=_[_0xaad6('0x52')](_0x1c02eb)[_0xaad6('0x77')](_0xaad6('0x6b'));var _0x51f45c=_[_0xaad6('0x52')](_0x1c02eb)[_0xaad6('0x30')]();logger['info']('header',_0x51f45c);db[_0xaad6('0x78')][_0xaad6('0x79')]({'raw':!![],'attributes':['id',_0xaad6('0x7a')]})[_0xaad6('0x16')](function(_0x1be2a7){for(var _0x4026f8=0x0;_0x4026f8<_0x1be2a7['length'];_0x4026f8++){if(_0x1be2a7[_0x4026f8][_0xaad6('0x7a')]in _0x1c02eb){contactItemTypes[_0xaad6('0x18')](_0x1be2a7[_0x4026f8]);delete _0x444f31[_0x1be2a7[_0x4026f8][_0xaad6('0x7a')]];hasAdditionalPhones=!![];}for(var _0x165735 in _0x1c02eb){if(_0x1be2a7[_0x4026f8][_0xaad6('0x7a')]+'_description'===_0x165735){phoneDescriptions[_0xaad6('0x18')]({'itemTypeId':_0x1be2a7[_0x4026f8]['id'],'description':_0x165735});delete _0x444f31[_0x165735];}}}if(hasAdditionalPhones)_0x444f31[_0xaad6('0x15')]='';var _0x2fe0ee=_['keys'](_0x444f31)[_0xaad6('0x30')]();logger[_0xaad6('0x56')](_0xaad6('0x7b'),_0x2fe0ee);fs[_0xaad6('0x7c')](_0x1bf9cd,_0x2fe0ee+'\x0a');Papa[_0xaad6('0x7d')](fs[_0xaad6('0x7e')](_0x332b40),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2b1262,_0x902db5){try{for(var _0x372fc7=0x0,_0x5c5279=[];_0x372fc7<_0x2b1262[_0xaad6('0x7f')][_0xaad6('0x17')];_0x372fc7++){stats[_0xaad6('0x80')]+=0x1;if(_0x2b1262[_0xaad6('0x5a')][_0x372fc7]){handleError(_0x2b1262[_0xaad6('0x7f')][_0x372fc7],_0x2b1262['errors'][_0x372fc7]);}else{var _0x45c3fd=[];var _0x2751ac=[];var _0x36b800={};for(var _0x2b89b7 in _0x1c02eb){let _0x253d1f=contactItemTypes[_0xaad6('0x81')](_0x5df555=>_0x5df555[_0xaad6('0x7a')]===_0x2b89b7);let _0x2f20ce=contactItemTypes['find'](_0x57c84a=>_0x57c84a['name']+_0xaad6('0x82')===_0x2b89b7);if(_[_0xaad6('0x83')](_0x253d1f)&&_[_0xaad6('0x83')](_0x2f20ce)){if(_0x1c02eb[_0xaad6('0x84')](_0x2b89b7)){if(_0x2b1262['data'][_0x372fc7][_0x1c02eb[_0x2b89b7]]){var _0xeee895=_[_0xaad6('0x85')](_0x2b1262[_0xaad6('0x7f')][_0x372fc7][_0x1c02eb[_0x2b89b7]][_0xaad6('0x86')](/"/g,'\x27'));switch(_0x2b89b7){case _0xaad6('0x42'):var _0xc62fe4=moment(_0xeee895,_0xaad6('0xd'),!![]);if(_0xc62fe4['isValid']()){_0x5c5279['push']('\x22'+_0xeee895+'\x22');}else{_0x45c3fd[_0xaad6('0x18')](_0xaad6('0x87'));}break;case _0xaad6('0x2c'):var _0x1a61f2=parseInt(_0xeee895);_0xeee895=_['isNaN'](_0x1a61f2)||_0x1a61f2<0x0||_0x1a61f2>0x4?_0x3b9e4f?0x3:0x2:_0x1a61f2;_0x5c5279[_0xaad6('0x18')]('\x22'+_0xeee895+'\x22');break;case _0xaad6('0x2d'):var _0xcf057c=parseInt(_0xeee895);if(_[_0xaad6('0x88')](_0xcf057c)&&_[_0xaad6('0x77')](_0x16caac,_0xcf057c)){_0x5c5279['push']('\x22'+_0xcf057c+'\x22');}else{_0x45c3fd['push']('agent\x20not\x20exists');}break;case _0xaad6('0x89'):if(isEmail(_0xeee895)){_0x5c5279[_0xaad6('0x18')]('\x22'+_0xeee895+'\x22');}else{_0x45c3fd[_0xaad6('0x18')](_0xaad6('0x8a'));}break;case _0xaad6('0x8b'):var _0x1e994e=moment(_0xeee895,_0xaad6('0x8c'),!![]);if(_0x1e994e[_0xaad6('0x8d')]()){_0x5c5279[_0xaad6('0x18')]('\x22'+_0xeee895+'\x22');}else{_0x45c3fd[_0xaad6('0x18')](_0xaad6('0x8e'));}break;case _0xaad6('0x6b'):var _0x599be3=shared[_0xaad6('0x8f')];var _0x50f646=_0x599be3[_0xeee895];if(!_[_0xaad6('0x83')](_0x50f646)){var _0xe5c4f3=_0x50f646[_0xaad6('0x90')];_0x5c5279['push']('\x22'+_0xeee895+'\x22');_0x5c5279[_0xaad6('0x18')]('\x22'+_0xe5c4f3+'\x22');}break;default:_0x5c5279['push']('\x22'+_0xeee895+'\x22');}}else{switch(_0x2b89b7){case _0xaad6('0x91'):case'phone':_0x45c3fd[_0xaad6('0x18')](_0x2b89b7+_0xaad6('0x92'));break;default:_0x5c5279[_0xaad6('0x18')]('\x22\x22');}}}}else{var _0x1fa242='';if(!_[_0xaad6('0x83')](_0x253d1f)){if(!_0x36b800['hasOwnProperty'](_0x253d1f['id'])){if(!_['isNil'](_0x2b1262[_0xaad6('0x7f')][_0x372fc7][_0x1c02eb[_0x2b89b7]])){var _0xeee895=_['trim'](_0x2b1262[_0xaad6('0x7f')][_0x372fc7][_0x1c02eb[_0x2b89b7]][_0xaad6('0x86')](/"/g,'\x27'));var _0x1d8541=phoneDescriptions[_0xaad6('0x81')](_0x195642=>_0x195642['itemTypeId']===_0x253d1f['id']);if(!_[_0xaad6('0x83')](_0x1d8541)){var _0x561d5b=_[_0xaad6('0x85')](_0x2b1262[_0xaad6('0x7f')][_0x372fc7][_0x1c02eb[_0x1d8541['description']]]['replace'](/"/g,'\x27'));if(!_[_0xaad6('0x83')](_0x561d5b))_0xeee895=_0xeee895+'§'+_0x561d5b;}if(_0x1fa242=='')_0x1fa242=_0xeee895;else _0x1fa242+='|'+_0xeee895;}_0x2751ac[_0xaad6('0x18')](_0x253d1f['id']+':'+_0x1fa242);_0x36b800[_0x253d1f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5c5279[_0xaad6('0x18')]('\x22'+_0x2751ac[_0xaad6('0x30')](';')+'\x22');}if(_0x45c3fd[_0xaad6('0x17')]){handleError(_0x2b1262[_0xaad6('0x7f')][_0x372fc7],{'code':_0xaad6('0x93'),'message':_0x45c3fd[_0xaad6('0x30')]()});}else{fs[_0xaad6('0x94')](_0x1bf9cd,_0x5c5279[_0xaad6('0x30')]()+'\x0a');}_0x5c5279=[];}if(!(stats[_0xaad6('0x80')]%0xc8)){socket['emit'](_0xaad6('0x95')+_0x40ef53,stats);stats['errors']=[];}}if(stopped){logger[_0xaad6('0x56')](_0xaad6('0x96'));_0x902db5[_0xaad6('0x97')]();}}catch(_0x65e17e){handleError(_0x2b1262[_0xaad6('0x7f')][_0x372fc7],{'code':_0xaad6('0x98'),'message':_0x65e17e[_0xaad6('0x5c')]});logger[_0xaad6('0x58')]('step',_0x65e17e[_0xaad6('0x5c')]);}},'complete':function(){try{var _0x509b70=[];var _0x997f6a=[];var _0x45ef3f=_0xaad6('0x39');if(_0x1ba9a0[_0xaad6('0x99')]&&_0x1ba9a0['duplicates'][_0xaad6('0x17')]){_0x45ef3f=_0xaad6('0x9a')+_0x40ef53;_0x509b70[_0xaad6('0x18')](_0xaad6('0x9b')+_0x45ef3f+_0xaad6('0x9c'));}tmp_campaigns=_0xaad6('0x9d')+_0x40ef53;tmp_voice_queues=_0xaad6('0x9e')+_0x40ef53;_0x997f6a[_0xaad6('0x18')](_0xaad6('0x9b')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x997f6a[_0xaad6('0x18')](_0xaad6('0x9b')+tmp_voice_queues+_0xaad6('0x9f'));BPromise[_0xaad6('0xa0')](_0x997f6a,handleTZQuery)[_0xaad6('0x16')](function(_0x514f87){updateTzCampaigns(_0x1ba9a0['ListId'])[_0xaad6('0x16')](function(_0xad3564){updateTzVoiceQueues(_0x1ba9a0['ListId'])['then'](function(_0x2ec6ba){if(hasTZ)_0x2fe0ee=_0x2fe0ee[_0xaad6('0x86')](_0xaad6('0x6b'),_0xaad6('0xa1'));var _0x421cea=util['format'](_0xaad6('0xa2'),_0x1bf9cd,_0x45ef3f,_0x2fe0ee,_0x1ba9a0[_0xaad6('0x38')],_0x1ba9a0['CompanyId']||null,NOW,NOW);if(_[_0xaad6('0x83')](_0x1c02eb[_0xaad6('0x42')])){_0x421cea+=_0xaad6('0xa3');}_0x509b70[_0xaad6('0x18')](_0x421cea);if(_0x1ba9a0[_0xaad6('0x99')]&&_0x1ba9a0[_0xaad6('0x99')][_0xaad6('0x17')]){_0x509b70['push'](insertCmContact(_0x1ba9a0[_0xaad6('0x38')],_0x45ef3f,_0x1ba9a0[_0xaad6('0x99')],_0x1c02eb));_0x509b70['push'](_0xaad6('0xa4')+_0x45ef3f+';');}BPromise[_0xaad6('0xa0')](_0x509b70,handleQuery)[_0xaad6('0x16')](function(_0x3f74be){BPromise[_0xaad6('0x6a')]([handleAdditionalPhones()])[_0xaad6('0x16')](function(){_0x509b70=[];for(var _0xf46a84=0x0;_0xf46a84\x20\x20');}var _0x540d13=path[_0xaad6('0x30')](config[_0xaad6('0xb2')],_0xaad6('0x75'),process[_0xaad6('0xb1')][0x2]);if(!fs[_0xaad6('0xb3')](_0x540d13)){throw new Error(_0xaad6('0xb4'));}var _0x319194={};try{_0x319194=JSON['parse'](process['argv'][0x3]);if(!_0x319194[_0xaad6('0x72')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x319194[_0xaad6('0x72')][_0xaad6('0x29')]){throw new Error(_0xaad6('0xb5'));}if(!_0x319194[_0xaad6('0x72')]['firstName']){throw new Error(_0xaad6('0xb6'));}var _0xbb34da=0x0;if(_0x319194[_0xaad6('0x72')][_0xaad6('0x2d')]){_0xbb34da=0x1;}if(!_0x319194['ListId']){throw new Error(_0xaad6('0xb7'));}}catch(_0x35be8a){throw new Error(_0xaad6('0xb8'));}var _0x37f019=[];try{_0x37f019=_[_0xaad6('0xb9')](JSON[_0xaad6('0x7d')](process[_0xaad6('0xb1')][0x4]),'id');}catch(_0x1415cd){logger[_0xaad6('0x56')](_0xaad6('0xba'));}main(_0x540d13,_0x319194,_0x37f019,_0xbb34da);}validate();process['on'](_0xaad6('0xbb'),handleStop);process['on'](_0xaad6('0xbc'),handleUncaughtException); \ No newline at end of file +var _0xc456=['MIN(id)','group','error','message','exit','errors','info','sequelize','query','spread','catch','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','all','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','binding','clone','socket_timestamp','root','includes','header','ContactItemType','findAll','name','_description','writeFileSync','parse','data','rows','find','hasOwnProperty','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','trim','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','format','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','server/files/tmp','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','socket.io-emitter','redis','YYYY-MM-DD\x20HH:mm:ss','select','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','then','length','push','AdditionalPhones','split','isNil','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','fromQuery','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.updatedAt','insert','cm_hopper_black','phone','ContactId','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','cm_contacts','into','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?'];(function(_0x38b621,_0x263776){var _0x4652d9=function(_0x2af544){while(--_0x2af544){_0x38b621['push'](_0x38b621['shift']());}};_0x4652d9(++_0x263776);}(_0xc456,0x1d2));var _0x6c45=function(_0x13d7c2,_0x59ed0b){_0x13d7c2=_0x13d7c2-0x0;var _0x1c583e=_0xc456[_0x13d7c2];return _0x1c583e;};'use strict';var fs=require('fs');var path=require(_0x6c45('0x0'));var _=require(_0x6c45('0x1'));var Papa=require(_0x6c45('0x2'));var util=require('util');var BPromise=require(_0x6c45('0x3'));var moment=require(_0x6c45('0x4'));var squel=require(_0x6c45('0x5'));var Redis=require(_0x6c45('0x6'));var db=require(_0x6c45('0x7'))['db'];var config=require(_0x6c45('0x8'));var shared=require(_0x6c45('0x9'));var logger=require(_0x6c45('0xa'))(_0x6c45('0xb'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6c45('0xc'))(new Redis(config[_0x6c45('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x6c45('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x6c45('0xe'));function isEmail(_0xcd3de5){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'](_0xcd3de5);}function selectNotIn(_0x3aeefc,_0x83f67,_0x3b95e6,_0x5767c3,_0x13b970){return squel[_0x6c45('0xf')]()[_0x6c45('0x10')]('phone')[_0x6c45('0x11')](_0x5767c3)[_0x6c45('0x12')](_0x83f67,null,_0x83f67+_0x6c45('0x13')+_0x5767c3+'.'+_0x3b95e6)[_0x6c45('0x14')](_0x5767c3+'.'+_0x3b95e6+'\x20=\x20'+_0x3aeefc+'.'+_0x3b95e6)[_0x6c45('0x14')](_0x83f67+_0x6c45('0x15')+_0x13b970[_0x6c45('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4fcb46,_0x7ced2e){promisesAdditionalPhones=[];return db[_0x6c45('0x16')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6c45('0x17')](function(_0x15cfa1){if(_0x15cfa1!==null){var _0x3a74a2=[];for(var _0x6b3324=0x0;_0x6b3324<_0x15cfa1[_0x6c45('0x18')];_0x6b3324++){var _0x569284=_0x15cfa1[_0x6b3324];_0x3a74a2[_0x6c45('0x19')](insertAdditionalPhones(_0x569284));}}Promise['all'](_0x3a74a2)['then'](function(){_0x4fcb46({'val':0x1});});});});}function insertAdditionalPhones(_0x114336){return new Promise(function(_0x554783,_0x4d0660){var _0x5bde81=_0x114336[_0x6c45('0x1a')];var _0x820581=_0x5bde81[_0x6c45('0x1b')](';');var _0x688677=[];orderBy=0x0;for(var _0x431860=0x0;_0x431860<_0x820581[_0x6c45('0x18')];_0x431860++){_0x688677[_0x6c45('0x19')](splitAdditionalPhone(_0x114336['id'],_0x820581[_0x431860]));}Promise['all'](_0x688677)['then'](function(){_0x554783({'val':_0x820581[_0x6c45('0x18')]});});});}function splitAdditionalPhone(_0x17621f,_0x45b3a0){return new Promise(function(_0x295915,_0x523833){var _0x2f2b9d=_0x45b3a0[_0x6c45('0x1b')](':');var _0xd70be1=_0x2f2b9d[0x0];var _0xaa80eb=_0x2f2b9d[0x1];if(!_[_0x6c45('0x1c')](_0xaa80eb)){var _0x19a715=_0xaa80eb[_0x6c45('0x1b')]('|');var _0x461bd9=[];for(var _0x434a14=0x0;_0x434a14<_0x19a715['length'];_0x434a14++){if(_0x19a715[_0x434a14]!==''){var _0x596109=_['filter'](promisesAdditionalPhones,{'contactId':_0x17621f,'phone':_0x19a715[_0x434a14]});if(_0x596109['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x17621f,'contactTypeId':_0xd70be1,'phone':_0x19a715[_0x434a14],'orderBy':orderBy});}}}_0x295915({'ok':0x1});}else _0x295915({'res':0x0});});}function createAdditionalPhone(_0x253f7f,_0x33bf66,_0x4b1aaf,_0x491a3c){var _0x2edd85='';var _0x3dba15='';var _0x49ca8d=_0x4b1aaf[_0x6c45('0x1b')]('§');_0x2edd85=_0x49ca8d[0x0];if(_0x49ca8d[_0x6c45('0x18')]==0x2)_0x3dba15=_0x49ca8d[0x1];return new Promise(function(_0x53f0b2,_0x4063ad){return db[_0x6c45('0x1d')][_0x6c45('0x1e')]({'where':{'CmContactId':_0x253f7f,'item':_0x2edd85}})[_0x6c45('0x17')](function(_0x4a14f5){if(_0x4a14f5){return db[_0x6c45('0x1d')][_0x6c45('0x1f')]({'ItemTypeId':_0x33bf66,'description':_0x3dba15,'OrderBy':_0x491a3c},{'where':{'CmContactId':_0x253f7f,'item':_0x2edd85}})[_0x6c45('0x17')](function(_0x464000){_0x53f0b2({'res':_0x6c45('0x20')});});}else{return db['CmContactHasItem'][_0x6c45('0x21')]({'CmContactId':_0x253f7f,'item':_0x2edd85,'description':_0x3dba15,'ItemTypeId':_0x33bf66,'OrderBy':_0x491a3c,'ItemClass':'PHONE'})[_0x6c45('0x17')](function(_0x163335){_0x53f0b2({'res':_0x6c45('0x22')});});}});});}function insertCmHopper(_0x3ede73,_0x2e086d,_0x54a2dc,_0x4c9625,_0x4a5c30){var _0x432d8a=['cm_contacts.phone',_0x6c45('0x23'),_0x6c45('0x24'),_0x6c45('0x25'),_0x2e086d+'.'+_0x4c9625,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x6c45('0x26'),_0x6c45('0x27'),'\x22'+_0x4a5c30+'\x22'];return squel['insert']()['into']('cm_hopper')[_0x6c45('0x28')](['phone','scheduledat','ContactId',_0x6c45('0x29'),_0x4c9625,_0x6c45('0x2a'),_0x6c45('0x2b'),_0x6c45('0x2c'),'UserId',_0x6c45('0x2d')],squel[_0x6c45('0xf')]()[_0x6c45('0x2e')](_0x432d8a)[_0x6c45('0x11')](_0x2e086d)['join']('cm_contacts',null,_0x6c45('0x2f')+_0x2e086d+_0x6c45('0x30'))[_0x6c45('0x12')](_0x54a2dc,null,_0x54a2dc+_0x6c45('0x13')+_0x2e086d+'.'+_0x4c9625)[_0x6c45('0x14')](_0x2e086d+_0x6c45('0x31'),_0x3ede73)[_0x6c45('0x14')](_0x6c45('0x32'),NOW)[_0x6c45('0x14')](_0x6c45('0x33'),selectNotIn(_0x2e086d,_0x54a2dc,_0x4c9625,_0x6c45('0x34'),[_0x6c45('0x35'),_0x6c45('0x36')]))[_0x6c45('0x14')](_0x6c45('0x33'),selectNotIn(_0x2e086d,_0x54a2dc,_0x4c9625,_0x6c45('0x34'),[_0x6c45('0x35')])))[_0x6c45('0x37')]();}function insertCmHopperBlack(_0x1e0392,_0x24359f,_0x25a82b,_0x56d524){var _0x154f00=[_0x6c45('0x38'),_0x6c45('0x24'),_0x6c45('0x25'),_0x24359f+'.'+_0x56d524,_0x6c45('0x39'),_0x6c45('0x3a')];return squel[_0x6c45('0x3b')]()['into'](_0x6c45('0x3c'))[_0x6c45('0x28')]([_0x6c45('0x3d'),_0x6c45('0x3e'),_0x6c45('0x29'),_0x56d524,_0x6c45('0x2a'),_0x6c45('0x2b')],squel[_0x6c45('0xf')]()[_0x6c45('0x2e')](_0x154f00)[_0x6c45('0x11')](_0x24359f)[_0x6c45('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x24359f+_0x6c45('0x30'))['join'](_0x25a82b,null,_0x25a82b+_0x6c45('0x13')+_0x24359f+'.'+_0x56d524)['where'](_0x24359f+_0x6c45('0x31'),_0x1e0392)[_0x6c45('0x14')](_0x6c45('0x32'),NOW)[_0x6c45('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6c45('0xf')]()['field'](_0x6c45('0x3d'))['from'](_0x6c45('0x3c'))['where'](_0x6c45('0x3f'),_0x1e0392)[_0x6c45('0x14')](_0x56d524+_0x6c45('0x40')+_0x24359f+'.'+_0x56d524)))[_0x6c45('0x37')]();}function insertTzCmHopper(_0x5e5637,_0xb3932e,_0x734885,_0x31a333,_0x555f99,_0x5e3d96){var _0x3a1b09=[_0x6c45('0x38'),_0x6c45('0x41')+_0x5e3d96+_0x6c45('0x42'),_0x6c45('0x24'),_0x6c45('0x25'),_0xb3932e+'.'+_0x31a333,'cm_contacts.createdAt',_0x6c45('0x3a'),_0x6c45('0x26'),'cm_contacts.UserId','\x22'+_0x555f99+'\x22'];var _0x638f0=squel[_0x6c45('0x3b')]()['into'](_0x6c45('0x34'))[_0x6c45('0x28')](['phone',_0x6c45('0x43'),'ContactId','ListId',_0x31a333,_0x6c45('0x2a'),_0x6c45('0x2b'),_0x6c45('0x2c'),'UserId',_0x6c45('0x2d')],squel[_0x6c45('0xf')]()[_0x6c45('0x2e')](_0x3a1b09)[_0x6c45('0x11')](_0xb3932e)[_0x6c45('0x12')](_0x6c45('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0xb3932e+_0x6c45('0x30'))['join'](_0x734885,null,_0x734885+_0x6c45('0x13')+_0xb3932e+'.'+_0x31a333)[_0x6c45('0x12')](_0x5e3d96,null,_0x5e3d96+_0x6c45('0x13')+_0xb3932e+'.'+_0x31a333)[_0x6c45('0x14')](_0xb3932e+'.CmListId\x20=\x20?',_0x5e5637)['where'](_0x6c45('0x32'),NOW)[_0x6c45('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xb3932e,_0x734885,_0x31a333,_0x6c45('0x34'),[_0x6c45('0x35'),_0x6c45('0x36')]))[_0x6c45('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xb3932e,_0x734885,_0x31a333,_0x6c45('0x34'),[_0x6c45('0x35')])))[_0x6c45('0x37')]();return _0x638f0;}function insertTzCmHopperBlack(_0x573b93,_0x4da951,_0x440de3,_0x4eb07c){var _0x4bce1e=[_0x6c45('0x38'),'cm_contacts.id',_0x6c45('0x25'),_0x4da951+'.'+_0x4eb07c,_0x6c45('0x39'),_0x6c45('0x3a')];return squel[_0x6c45('0x3b')]()[_0x6c45('0x45')](_0x6c45('0x3c'))[_0x6c45('0x28')](['phone',_0x6c45('0x3e'),'ListId',_0x4eb07c,_0x6c45('0x2a'),'updatedAt'],squel['select']()[_0x6c45('0x2e')](_0x4bce1e)[_0x6c45('0x11')](_0x4da951)[_0x6c45('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4da951+'.CmListId')[_0x6c45('0x12')](_0x440de3,null,_0x440de3+'.id\x20=\x20'+_0x4da951+'.'+_0x4eb07c)['where'](_0x4da951+_0x6c45('0x31'),_0x573b93)['where'](_0x6c45('0x32'),NOW)[_0x6c45('0x14')](_0x6c45('0x33'),squel['select']()[_0x6c45('0x10')](_0x6c45('0x3d'))['from'](_0x6c45('0x3c'))[_0x6c45('0x14')](_0x6c45('0x3f'),_0x573b93)[_0x6c45('0x14')](_0x4eb07c+_0x6c45('0x40')+_0x4da951+'.'+_0x4eb07c)))['toString']();}function insertCmHopperAdditionalPhones(_0x593031){var _0x3c7616=['cm_hopper.id','cm_contact_has_items.item',_0x6c45('0x46'),'cm_contact_has_items.createdAt',_0x6c45('0x47')];return squel['insert']()[_0x6c45('0x45')](_0x6c45('0x48'))[_0x6c45('0x28')]([_0x6c45('0x49'),_0x6c45('0x3d'),_0x6c45('0x4a'),_0x6c45('0x2a'),_0x6c45('0x2b')],squel['select']()[_0x6c45('0x2e')](_0x3c7616)[_0x6c45('0x11')](_0x6c45('0x34'))['join'](_0x6c45('0x44'),null,_0x6c45('0x4b'))[_0x6c45('0x12')](_0x6c45('0x4c'),null,_0x6c45('0x4d'))[_0x6c45('0x14')](_0x6c45('0x4e'),_0x593031)['where'](_0x6c45('0x32'),NOW))[_0x6c45('0x37')]();}function insertCmContact(_0x2cfc9d,_0x2634ba,_0xed8330,_0x4c643c){var _0x1a9495=_['concat'](_[_0x6c45('0x4f')](_0x4c643c),['ListId','CompanyId',_0x6c45('0x2a'),_0x6c45('0x2b'),'scheduledAt']);return squel[_0x6c45('0x3b')]()[_0x6c45('0x45')](_0x6c45('0x44'))[_0x6c45('0x28')](_0x1a9495,squel['select']()[_0x6c45('0x2e')](_0x1a9495)['from'](_0x2634ba)[_0x6c45('0x14')]('('+_0xed8330[_0x6c45('0x12')](',')+_0x6c45('0x50'),squel['select']()['fields'](_0xed8330)[_0x6c45('0x11')](_0x6c45('0x44'))['where']('ListId\x20=\x20?',_0x2cfc9d)['where'](_0x6c45('0x51')))[_0x6c45('0x14')](_0x6c45('0x52'),squel[_0x6c45('0xf')]()[_0x6c45('0x10')](_0x6c45('0x53'),'min_id')['from'](_0x2634ba)[_0x6c45('0x54')](_0xed8330[_0x6c45('0x12')](','))))[_0x6c45('0x37')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2faa0c){logger[_0x6c45('0x55')](_0x2faa0c[_0x6c45('0x56')]);process[_0x6c45('0x57')](0x1);}function handleError(_0x9017ed,_0x1369b9){stats[_0x6c45('0x58')][_0x6c45('0x19')]({'name':_0x1369b9['code'],'message':_0x1369b9[_0x6c45('0x56')],'row':_0x9017ed});}function handleQuery(_0x514862){logger[_0x6c45('0x59')](_0x514862);return db[_0x6c45('0x5a')][_0x6c45('0x5b')](_0x514862)[_0x6c45('0x5c')](function(_0x3fbccd){results[_0x6c45('0x19')](_0x3fbccd);})[_0x6c45('0x5d')](function(_0x5aa5b5){logger[_0x6c45('0x55')](_0x5aa5b5[_0x6c45('0x56')]);});}function updateTzCampaigns(_0xf4a8a5){return new Promise(function(_0x4686d2,_0x2b3c40){var _0xae19c7=squel[_0x6c45('0xf')]()[_0x6c45('0x2e')]([_0x6c45('0x5e'),'campaigns.dialTimezone'])['from'](_0x6c45('0x5f'))[_0x6c45('0x12')]('campaigns_has_cm_lists',null,_0x6c45('0x60'))[_0x6c45('0x14')](_0x6c45('0x61')+_0xf4a8a5);db['sequelize'][_0x6c45('0x5b')](_0xae19c7[_0x6c45('0x37')]())[_0x6c45('0x5c')](function(_0x457aff){var _0xb9f68f=[];for(var _0x34a1ff=0x0;_0x34a1ff<_0x457aff['length'];_0x34a1ff++){_0xb9f68f[_0x6c45('0x19')](getTimezoneData(_0x457aff[_0x34a1ff],tmp_campaigns));}BPromise[_0x6c45('0x62')](_0xb9f68f)['then'](function(){_0x4686d2({'val':0x1});});})[_0x6c45('0x5d')](function(_0x318896){logger[_0x6c45('0x55')](_0x318896[_0x6c45('0x56')]);_0x4686d2({'val':0x0});});});}function updateTzVoiceQueues(_0x172746){return new Promise(function(_0x7b44d,_0x5a0519){var _0x95e8e4=squel[_0x6c45('0xf')]()['fields']([_0x6c45('0x63'),_0x6c45('0x64')])[_0x6c45('0x11')](_0x6c45('0x65'))[_0x6c45('0x12')](_0x6c45('0x66'),null,_0x6c45('0x67'))[_0x6c45('0x14')](_0x6c45('0x68')+_0x172746);db[_0x6c45('0x5a')][_0x6c45('0x5b')](_0x95e8e4['toString']())[_0x6c45('0x5c')](function(_0xb496b0){var _0x2178cf=[];for(var _0x467a74=0x0;_0x467a74<_0xb496b0[_0x6c45('0x18')];_0x467a74++){_0x2178cf[_0x6c45('0x19')](getTimezoneData(_0xb496b0[_0x467a74],tmp_voice_queues));}BPromise[_0x6c45('0x62')](_0x2178cf)['then'](function(){_0x7b44d({'val':0x1});});})[_0x6c45('0x5d')](function(_0x145aec){logger[_0x6c45('0x55')](_0x145aec['message']);_0x7b44d({'val':0x0});});});}function getTimezoneData(_0x1b0b8c,_0x55bb13){return new Promise(function(_0x590655,_0x475c34){var _0x50d0bb=shared[_0x6c45('0x69')];var _0x5f14f7=_0x50d0bb[_0x1b0b8c[_0x6c45('0x6a')]];if(_[_0x6c45('0x1c')](_0x5f14f7)){_0x590655({'ret':0x1});}else{var _0x50f6e5=_0x5f14f7[_0x6c45('0x6b')];var _0xba3c9d=squel[_0x6c45('0x3b')]()[_0x6c45('0x45')](_0x55bb13)[_0x6c45('0x6c')]('id',_0x1b0b8c['id'])['set'](_0x6c45('0x6d'),_0x50f6e5)[_0x6c45('0x6c')](_0x6c45('0x6a'),_0x1b0b8c[_0x6c45('0x6a')])[_0x6c45('0x37')]();return db[_0x6c45('0x5a')][_0x6c45('0x5b')](_0xba3c9d)['spread'](function(_0x229467){_0x590655({'ret':0x1});})['catch'](function(_0x3de7c1){logger[_0x6c45('0x55')](_0x3de7c1[_0x6c45('0x56')]);_0x475c34({'ret':0x1});});}});}function handleTZQuery(_0x1d3b19){logger[_0x6c45('0x59')](_0x1d3b19);return db['sequelize'][_0x6c45('0x5b')](_0x1d3b19)[_0x6c45('0x5c')](function(_0x451045){})[_0x6c45('0x5d')](function(_0x56ee0b){logger[_0x6c45('0x55')](_0x56ee0b[_0x6c45('0x56')]);});}function main(_0x53f735,_0x4fb6a7,_0x459d2c,_0x3a4173){logger[_0x6c45('0x59')](_0x6c45('0x6e'),_0x53f735,JSON[_0x6c45('0x6f')](_0x4fb6a7));process[_0x6c45('0x70')]('start');var _0x37f2a9=_0x4fb6a7[_0x6c45('0x71')];var _0x595420=_[_0x6c45('0x72')](_0x37f2a9);var _0x219af2=_0x4fb6a7[_0x6c45('0x73')];var _0x524058=path[_0x6c45('0x12')](config[_0x6c45('0x74')],'server/files/tmp',_0x219af2+'.csv');hasTZ=_[_0x6c45('0x4f')](_0x37f2a9)[_0x6c45('0x75')](_0x6c45('0x6a'));var _0x4340e5=_[_0x6c45('0x4f')](_0x37f2a9)['join']();logger[_0x6c45('0x59')](_0x6c45('0x76'),_0x4340e5);db[_0x6c45('0x77')][_0x6c45('0x78')]({'raw':!![],'attributes':['id','name']})['then'](function(_0xffe3da){for(var _0x3d72a1=0x0;_0x3d72a1<_0xffe3da[_0x6c45('0x18')];_0x3d72a1++){if(_0xffe3da[_0x3d72a1][_0x6c45('0x79')]in _0x37f2a9){contactItemTypes['push'](_0xffe3da[_0x3d72a1]);delete _0x595420[_0xffe3da[_0x3d72a1][_0x6c45('0x79')]];hasAdditionalPhones=!![];}for(var _0x1d9a45 in _0x37f2a9){if(_0xffe3da[_0x3d72a1]['name']+_0x6c45('0x7a')===_0x1d9a45){phoneDescriptions['push']({'itemTypeId':_0xffe3da[_0x3d72a1]['id'],'description':_0x1d9a45});delete _0x595420[_0x1d9a45];}}}if(hasAdditionalPhones)_0x595420[_0x6c45('0x1a')]='';var _0x2fdbc1=_[_0x6c45('0x4f')](_0x595420)[_0x6c45('0x12')]();logger[_0x6c45('0x59')](_0x6c45('0x76'),_0x2fdbc1);fs[_0x6c45('0x7b')](_0x524058,_0x2fdbc1+'\x0a');Papa[_0x6c45('0x7c')](fs['createReadStream'](_0x53f735),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2c468f,_0x29231b){try{for(var _0x4a18f4=0x0,_0x262c6c=[];_0x4a18f4<_0x2c468f[_0x6c45('0x7d')][_0x6c45('0x18')];_0x4a18f4++){stats[_0x6c45('0x7e')]+=0x1;if(_0x2c468f['errors'][_0x4a18f4]){handleError(_0x2c468f[_0x6c45('0x7d')][_0x4a18f4],_0x2c468f[_0x6c45('0x58')][_0x4a18f4]);}else{var _0x11b74b=[];var _0x46eeae=[];var _0x3ac3db={};for(var _0x503996 in _0x37f2a9){let _0x38be7f=contactItemTypes['find'](_0x536d53=>_0x536d53[_0x6c45('0x79')]===_0x503996);let _0x85e09=contactItemTypes[_0x6c45('0x7f')](_0x815896=>_0x815896['name']+_0x6c45('0x7a')===_0x503996);if(_[_0x6c45('0x1c')](_0x38be7f)&&_[_0x6c45('0x1c')](_0x85e09)){if(_0x37f2a9[_0x6c45('0x80')](_0x503996)){if(_0x2c468f[_0x6c45('0x7d')][_0x4a18f4][_0x37f2a9[_0x503996]]){var _0x366f80=_['trim'](_0x2c468f[_0x6c45('0x7d')][_0x4a18f4][_0x37f2a9[_0x503996]][_0x6c45('0x81')](/"/g,'\x27'));switch(_0x503996){case _0x6c45('0x43'):var _0x46ca86=moment(_0x366f80,_0x6c45('0xe'),!![]);if(_0x46ca86['isValid']()){_0x262c6c[_0x6c45('0x19')]('\x22'+_0x366f80+'\x22');}else{_0x11b74b['push'](_0x6c45('0x82'));}break;case'priority':var _0x3d1ac0=parseInt(_0x366f80);_0x366f80=_[_0x6c45('0x83')](_0x3d1ac0)||_0x3d1ac0<0x0||_0x3d1ac0>0x4?_0x3a4173?0x3:0x2:_0x3d1ac0;_0x262c6c[_0x6c45('0x19')]('\x22'+_0x366f80+'\x22');break;case'UserId':var _0x2bb4c1=parseInt(_0x366f80);if(_[_0x6c45('0x84')](_0x2bb4c1)&&_[_0x6c45('0x75')](_0x459d2c,_0x2bb4c1)){_0x262c6c[_0x6c45('0x19')]('\x22'+_0x2bb4c1+'\x22');}else{_0x11b74b[_0x6c45('0x19')](_0x6c45('0x85'));}break;case _0x6c45('0x86'):if(isEmail(_0x366f80)){_0x262c6c[_0x6c45('0x19')]('\x22'+_0x366f80+'\x22');}else{_0x11b74b['push'](_0x6c45('0x87'));}break;case _0x6c45('0x88'):var _0x1ec4c3=moment(_0x366f80,'YYYY-MM-DD',!![]);if(_0x1ec4c3['isValid']()){_0x262c6c[_0x6c45('0x19')]('\x22'+_0x366f80+'\x22');}else{_0x11b74b[_0x6c45('0x19')](_0x6c45('0x89'));}break;case _0x6c45('0x6a'):var _0xf2eab6=shared[_0x6c45('0x69')];var _0x341c90=_0xf2eab6[_0x366f80];if(!_['isNil'](_0x341c90)){var _0x4c8a50=_0x341c90[_0x6c45('0x6b')];_0x262c6c['push']('\x22'+_0x366f80+'\x22');_0x262c6c[_0x6c45('0x19')]('\x22'+_0x4c8a50+'\x22');}break;default:_0x262c6c[_0x6c45('0x19')]('\x22'+_0x366f80+'\x22');}}else{switch(_0x503996){case _0x6c45('0x8a'):case'phone':_0x11b74b[_0x6c45('0x19')](_0x503996+'\x20not\x20specified');break;default:_0x262c6c[_0x6c45('0x19')]('\x22\x22');}}}}else{var _0xa57b29='';if(!_[_0x6c45('0x1c')](_0x38be7f)){if(!_0x3ac3db[_0x6c45('0x80')](_0x38be7f['id'])){if(!_[_0x6c45('0x1c')](_0x2c468f[_0x6c45('0x7d')][_0x4a18f4][_0x37f2a9[_0x503996]])){var _0x366f80=_[_0x6c45('0x8b')](_0x2c468f[_0x6c45('0x7d')][_0x4a18f4][_0x37f2a9[_0x503996]][_0x6c45('0x81')](/"/g,'\x27'));var _0x52f21f=phoneDescriptions[_0x6c45('0x7f')](_0x1c80e2=>_0x1c80e2['itemTypeId']===_0x38be7f['id']);if(!_[_0x6c45('0x1c')](_0x52f21f)){var _0x30bf30=_[_0x6c45('0x8b')](_0x2c468f[_0x6c45('0x7d')][_0x4a18f4][_0x37f2a9[_0x52f21f[_0x6c45('0x8c')]]]['replace'](/"/g,'\x27'));if(!_[_0x6c45('0x1c')](_0x30bf30))_0x366f80=_0x366f80+'§'+_0x30bf30;}if(_0xa57b29=='')_0xa57b29=_0x366f80;else _0xa57b29+='|'+_0x366f80;}_0x46eeae[_0x6c45('0x19')](_0x38be7f['id']+':'+_0xa57b29);_0x3ac3db[_0x38be7f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x262c6c['push']('\x22'+_0x46eeae[_0x6c45('0x12')](';')+'\x22');}if(_0x11b74b[_0x6c45('0x18')]){handleError(_0x2c468f[_0x6c45('0x7d')][_0x4a18f4],{'code':_0x6c45('0x8d'),'message':_0x11b74b[_0x6c45('0x12')]()});}else{fs['appendFileSync'](_0x524058,_0x262c6c['join']()+'\x0a');}_0x262c6c=[];}if(!(stats[_0x6c45('0x7e')]%0xc8)){socket[_0x6c45('0x8e')](_0x6c45('0x8f')+_0x219af2,stats);stats[_0x6c45('0x58')]=[];}}if(stopped){logger['info'](_0x6c45('0x90'));_0x29231b[_0x6c45('0x91')]();}}catch(_0x1c4a97){handleError(_0x2c468f[_0x6c45('0x7d')][_0x4a18f4],{'code':_0x6c45('0x92'),'message':_0x1c4a97[_0x6c45('0x56')]});logger[_0x6c45('0x55')](_0x6c45('0x93'),_0x1c4a97[_0x6c45('0x56')]);}},'complete':function(){try{var _0x430518=[];var _0x469b0c=[];var _0x4279a7=_0x6c45('0x44');if(_0x4fb6a7['duplicates']&&_0x4fb6a7[_0x6c45('0x94')][_0x6c45('0x18')]){_0x4279a7=_0x6c45('0x95')+_0x219af2;_0x430518[_0x6c45('0x19')](_0x6c45('0x96')+_0x4279a7+_0x6c45('0x97'));}tmp_campaigns='campaigns_'+_0x219af2;tmp_voice_queues=_0x6c45('0x98')+_0x219af2;_0x469b0c[_0x6c45('0x19')](_0x6c45('0x96')+tmp_campaigns+_0x6c45('0x99'));_0x469b0c[_0x6c45('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x6c45('0x99'));BPromise[_0x6c45('0x9a')](_0x469b0c,handleTZQuery)[_0x6c45('0x17')](function(_0x209b5d){updateTzCampaigns(_0x4fb6a7[_0x6c45('0x29')])[_0x6c45('0x17')](function(_0x3f3f76){updateTzVoiceQueues(_0x4fb6a7['ListId'])[_0x6c45('0x17')](function(_0x56ccb){if(hasTZ)_0x2fdbc1=_0x2fdbc1[_0x6c45('0x81')](_0x6c45('0x6a'),'dialTimezone,utcOffset');var _0x330eb5=util[_0x6c45('0x9b')]('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',_0x524058,_0x4279a7,_0x2fdbc1,_0x4fb6a7[_0x6c45('0x29')],_0x4fb6a7[_0x6c45('0x9c')]||null,NOW,NOW);if(_[_0x6c45('0x1c')](_0x37f2a9[_0x6c45('0x43')])){_0x330eb5+=_0x6c45('0x9d');}_0x430518[_0x6c45('0x19')](_0x330eb5);if(_0x4fb6a7[_0x6c45('0x94')]&&_0x4fb6a7['duplicates'][_0x6c45('0x18')]){_0x430518[_0x6c45('0x19')](insertCmContact(_0x4fb6a7[_0x6c45('0x29')],_0x4279a7,_0x4fb6a7[_0x6c45('0x94')],_0x37f2a9));_0x430518[_0x6c45('0x19')](_0x6c45('0x9e')+_0x4279a7+';');}BPromise['each'](_0x430518,handleQuery)['then'](function(_0x198eef){BPromise[_0x6c45('0x62')]([handleAdditionalPhones()])[_0x6c45('0x17')](function(){_0x430518=[];for(var _0x1e23c9=0x0;_0x1e23c9\x20\x20');}var _0x230dae=path['join'](config[_0x6c45('0x74')],_0x6c45('0xab'),process[_0x6c45('0xac')][0x2]);if(!fs[_0x6c45('0xad')](_0x230dae)){throw new Error(_0x6c45('0xae'));}var _0x579da0={};try{_0x579da0=JSON[_0x6c45('0x7c')](process['argv'][0x3]);if(!_0x579da0[_0x6c45('0x71')]){throw new Error(_0x6c45('0xaf'));}if(!_0x579da0[_0x6c45('0x71')][_0x6c45('0x3d')]){throw new Error(_0x6c45('0xb0'));}if(!_0x579da0[_0x6c45('0x71')][_0x6c45('0x8a')]){throw new Error(_0x6c45('0xb1'));}var _0x4abd90=0x0;if(_0x579da0[_0x6c45('0x71')][_0x6c45('0xb2')]){_0x4abd90=0x1;}if(!_0x579da0[_0x6c45('0x29')]){throw new Error(_0x6c45('0xb3'));}}catch(_0xcf9efd){throw new Error(_0x6c45('0xb4'));}var _0x25e15e=[];try{_0x25e15e=_[_0x6c45('0xb5')](JSON[_0x6c45('0x7c')](process[_0x6c45('0xac')][0x4]),'id');}catch(_0xfa7731){logger['info'](_0x6c45('0xb6'));}main(_0x230dae,_0x579da0,_0x25e15e,_0x4abd90);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index f4534a5..4bed922 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4123=['length','isNil','push','all','then','catch','error','AdditionalPhones','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','recallme','select','fields','cm_contacts','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','into','cm_hopper_black','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','ListId\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','cm_hopper_additional_phones','OrderBy','cm_hopper.ListId\x20=\x20?','concat','CompanyId','createdAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','code','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','ContactItemType','findAll','name','_description','keys','header','parse','createReadStream','data','find','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','replace','itemTypeId','description','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','unlink','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','phone','from','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x4123,0x87));var _0x3412=function(_0x360076,_0x481a6f){_0x360076=_0x360076-0x0;var _0x1d593d=_0x4123[_0x360076];return _0x1d593d;};'use strict';var fs=require('fs');var path=require(_0x3412('0x0'));var _=require(_0x3412('0x1'));var Papa=require(_0x3412('0x2'));var util=require(_0x3412('0x3'));var BPromise=require(_0x3412('0x4'));var moment=require(_0x3412('0x5'));var squel=require(_0x3412('0x6'));var Redis=require(_0x3412('0x7'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x3412('0x8'))(_0x3412('0x9'));config['redis']=_[_0x3412('0xa')](config[_0x3412('0xb')],{'host':_0x3412('0xc'),'port':0x18eb});var socket=require(_0x3412('0xd'))(new Redis(config[_0x3412('0xb')]));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()[_0x3412('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x3412('0xf')+moment()[_0x3412('0xe')](_0x3412('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x266e22){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))*$/[_0x3412('0x11')](_0x266e22);}function selectNotIn(_0x2afc08,_0x27a434,_0x40698b,_0x3be34c,_0x4b70e4){return squel['select']()[_0x3412('0x12')](_0x3412('0x13'))[_0x3412('0x14')](_0x3be34c)['join'](_0x27a434,null,_0x27a434+'.id\x20=\x20'+_0x3be34c+'.'+_0x40698b)['where'](_0x3be34c+'.'+_0x40698b+_0x3412('0x15')+_0x2afc08+'.'+_0x40698b)[_0x3412('0x16')](_0x27a434+_0x3412('0x17')+_0x4b70e4[_0x3412('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3f31b7,_0x226006){promisesAdditionalPhones=[];promisesContact=[];return db[_0x3412('0x19')][_0x3412('0x1a')](_0x3412('0x1b')+tempTableName)[_0x3412('0x1c')](function(_0x37c3a4){if(_0x37c3a4!==null){var _0x382f11=[];for(var _0x454cd0=0x0;_0x454cd0<_0x37c3a4[_0x3412('0x1d')];_0x454cd0++){var _0x543a80=_0x37c3a4[_0x454cd0];if(!_[_0x3412('0x1e')](_0x543a80[_0x3412('0x13')])){if(!_['isNil'](_0x543a80['AdditionalPhones']))_0x382f11['push'](insertAdditionalPhones(_0x543a80));promisesContact[_0x3412('0x1f')]({'contact':_0x543a80});}}}Promise[_0x3412('0x20')](_0x382f11)[_0x3412('0x21')](function(){_0x3f31b7({'val':0x1});});})[_0x3412('0x22')](function(_0x2748f4){logger[_0x3412('0x23')](_0x2748f4['message']);});});}function insertAdditionalPhones(_0x48845a){return new Promise(function(_0x2e1e53,_0x328083){var _0x118248=_0x48845a[_0x3412('0x24')];if(_['isNil'](_0x118248))_0x328083({'val':0x0});else{var _0x231f00=_0x118248[_0x3412('0x25')](';');var _0x18b0be=[];orderBy=0x0;for(var _0x2bcf3c=0x0;_0x2bcf3c<_0x231f00[_0x3412('0x1d')];_0x2bcf3c++){_0x18b0be[_0x3412('0x1f')](splitAdditionalPhone(_0x48845a['id'],_0x231f00[_0x2bcf3c]));}Promise[_0x3412('0x20')](_0x18b0be)[_0x3412('0x21')](function(){_0x2e1e53({'val':_0x231f00['length']});});}});}function splitAdditionalPhone(_0x8d721d,_0x3fae63){return new Promise(function(_0x27654a,_0x23db59){var _0x1291cc=_0x3fae63[_0x3412('0x25')](':');var _0x342136=_0x1291cc[0x0];var _0x228bed=_0x1291cc[0x1];if(_0x228bed!==''){var _0x4c3d50=_0x228bed[_0x3412('0x25')]('|');var _0x1baa0b=[];for(var _0x318586=0x0;_0x318586<_0x4c3d50['length'];_0x318586++){if(_0x4c3d50[_0x318586]!==''){var _0x253e50=_[_0x3412('0x26')](promisesAdditionalPhones,{'contactId':_0x8d721d,'phone':_0x4c3d50[_0x318586]});if(_0x253e50[_0x3412('0x1d')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x8d721d,'contactTypeId':_0x342136,'phone':_0x4c3d50[_0x318586],'orderBy':orderBy});}}}_0x27654a({'ok':0x1});}else _0x27654a({'res':0x0});});}function createAdditionalPhone(_0x4220c6,_0x18bead,_0x3d70f9,_0x42c910){var _0x106c21='';var _0x45c155='';var _0x17f52f=_0x3d70f9['split']('§');_0x106c21=_0x17f52f[0x0];if(_0x17f52f[_0x3412('0x1d')]==0x2)_0x45c155=_0x17f52f[0x1];return new Promise(function(_0x14b35d,_0x2cad8){return db[_0x3412('0x27')][_0x3412('0x28')]({'where':{'CmContactId':_0x4220c6,'item':_0x106c21}})[_0x3412('0x21')](function(_0x2c7226){if(_0x2c7226){return db['CmContactHasItem'][_0x3412('0x29')]({'ItemTypeId':_0x18bead,'description':_0x45c155,'OrderBy':_0x42c910},{'where':{'CmContactId':_0x4220c6,'item':_0x106c21}})['then'](function(_0x5aab37){_0x14b35d({'res':_0x3412('0x2a')});});}else{return db[_0x3412('0x27')][_0x3412('0x2b')]({'CmContactId':_0x4220c6,'item':_0x106c21,'ItemTypeId':_0x18bead,'description':_0x45c155,'OrderBy':_0x42c910,'ItemClass':_0x3412('0x2c')})['then'](function(_0x1f0a6b){_0x14b35d({'res':_0x3412('0x2d')});});}});});}function updateContact(_0x2038f3){return new Promise(function(_0x5998ad,_0x5c586e){var _0x7a15b2=_0x2038f3['id'];delete _0x2038f3['id'];return db[_0x3412('0x2e')]['update'](_0x2038f3,{'where':{'id':_0x7a15b2}})[_0x3412('0x21')](function(_0x4668af){updatedRows+=0x1;return db[_0x3412('0x2f')][_0x3412('0x29')]({'phone':_0x2038f3['phone']},{'where':{'ContactId':_0x7a15b2}})[_0x3412('0x21')](function(_0x3ff74e){_0x5998ad({'ret':'OK'});});});});}function insertCmHopper(_0xa246ba,_0x15c4af,_0x577e12,_0x2b996e,_0xa13abb){var _0x5d7dcb=[_0x3412('0x30'),_0x3412('0x31'),_0x3412('0x32'),'cm_contacts.ListId',_0x15c4af+'.'+_0x2b996e,_0x3412('0x33'),'cm_contacts.updatedAt','cm_contacts.priority',_0x3412('0x34'),'\x22'+_0xa13abb+'\x22'];return squel[_0x3412('0x35')]()['into']('cm_hopper')[_0x3412('0x36')](['phone',_0x3412('0x37'),_0x3412('0x38'),_0x3412('0x39'),_0x2b996e,'createdAt',_0x3412('0x3a'),_0x3412('0x3b'),'UserId',_0x3412('0x3c')],squel[_0x3412('0x3d')]()[_0x3412('0x3e')](_0x5d7dcb)[_0x3412('0x14')](_0x15c4af)['join'](_0x3412('0x3f'),null,'cm_contacts.ListId\x20=\x20'+_0x15c4af+'.CmListId')[_0x3412('0x18')](_0x577e12,null,_0x577e12+'.id\x20=\x20'+_0x15c4af+'.'+_0x2b996e)[_0x3412('0x16')](_0x15c4af+'.CmListId\x20=\x20?',_0xa246ba)[_0x3412('0x16')](_0x3412('0x40'),NOW)[_0x3412('0x16')](_0x3412('0x41'),selectNotIn(_0x15c4af,_0x577e12,_0x2b996e,_0x3412('0x42'),[_0x3412('0x43'),_0x3412('0x44')]))[_0x3412('0x16')](_0x3412('0x41'),selectNotIn(_0x15c4af,_0x577e12,_0x2b996e,_0x3412('0x42'),[_0x3412('0x43')])))[_0x3412('0x45')]();}function insertCmHopperBlack(_0x4fbabf,_0x1c01f7,_0x32add3,_0x49bcd6){var _0x26e474=[_0x3412('0x30'),_0x3412('0x32'),_0x3412('0x46'),_0x1c01f7+'.'+_0x49bcd6,'cm_contacts.createdAt',_0x3412('0x47')];return squel['insert']()[_0x3412('0x48')](_0x3412('0x49'))[_0x3412('0x36')]([_0x3412('0x13'),_0x3412('0x38'),'ListId',_0x49bcd6,'createdAt',_0x3412('0x3a')],squel['select']()['fields'](_0x26e474)[_0x3412('0x14')](_0x1c01f7)[_0x3412('0x18')](_0x3412('0x3f'),null,_0x3412('0x4a')+_0x1c01f7+'.CmListId')['join'](_0x32add3,null,_0x32add3+'.id\x20=\x20'+_0x1c01f7+'.'+_0x49bcd6)[_0x3412('0x16')](_0x1c01f7+_0x3412('0x4b'),_0x4fbabf)[_0x3412('0x16')](_0x3412('0x40'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x3412('0x3d')]()[_0x3412('0x12')](_0x3412('0x13'))[_0x3412('0x14')](_0x3412('0x49'))['where'](_0x3412('0x4c'),_0x4fbabf)[_0x3412('0x16')](_0x49bcd6+'\x20=\x20?',_0x1c01f7+'.'+_0x49bcd6)))[_0x3412('0x45')]();}function insertCmHopperAdditionalPhones(_0x3b8acd){var _0x430505=[_0x3412('0x4d'),_0x3412('0x4e'),_0x3412('0x4f'),_0x3412('0x50'),_0x3412('0x51')];return squel[_0x3412('0x35')]()[_0x3412('0x48')](_0x3412('0x52'))[_0x3412('0x36')](['CmHopperId','phone',_0x3412('0x53'),'createdAt',_0x3412('0x3a')],squel[_0x3412('0x3d')]()[_0x3412('0x3e')](_0x430505)[_0x3412('0x14')](_0x3412('0x42'))[_0x3412('0x18')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x3412('0x18')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x3412('0x54'),_0x3b8acd)['where'](_0x3412('0x40'),NOW))['toString']();}function insertCmContact(_0x49cde9,_0x404078,_0x20c454,_0x420782){var _0x5a9228=_[_0x3412('0x55')](_['keys'](_0x420782),['ListId',_0x3412('0x56'),_0x3412('0x57'),_0x3412('0x3a')]);return squel['insert']()[_0x3412('0x48')](_0x3412('0x3f'))[_0x3412('0x36')](_0x5a9228,squel[_0x3412('0x3d')]()[_0x3412('0x3e')](_0x5a9228)[_0x3412('0x14')](_0x404078)['where']('('+_0x20c454[_0x3412('0x18')](',')+_0x3412('0x58'),squel['select']()[_0x3412('0x3e')](_0x20c454)[_0x3412('0x14')](_0x3412('0x3f'))[_0x3412('0x16')]('ListId\x20=\x20?',_0x49cde9))[_0x3412('0x16')](_0x3412('0x59'),squel[_0x3412('0x3d')]()[_0x3412('0x12')](_0x3412('0x5a'),_0x3412('0x5b'))[_0x3412('0x14')](_0x404078)[_0x3412('0x5c')](_0x20c454[_0x3412('0x18')](','))))['toString']();}function handleStop(){logger[_0x3412('0x5d')](_0x3412('0x5e'));stopped=!![];}function handleUncaughtException(_0x4dc931){logger[_0x3412('0x23')](_0x4dc931[_0x3412('0x5f')]);process[_0x3412('0x60')](0x1);}function handleError(_0x3ebf05,_0x35c69f){stats[_0x3412('0x61')][_0x3412('0x1f')]({'name':_0x35c69f[_0x3412('0x62')],'message':_0x35c69f[_0x3412('0x5f')],'row':_0x3ebf05});}function handleQuery(_0x3511e7){logger[_0x3412('0x5d')](_0x3511e7);return db[_0x3412('0x19')][_0x3412('0x1a')](_0x3511e7)[_0x3412('0x1c')](function(_0x42020d){results[_0x3412('0x1f')](_0x42020d);})[_0x3412('0x22')](function(_0x47e520){logger[_0x3412('0x23')](_0x47e520[_0x3412('0x5f')]);});}function main(_0x363415,_0x3bc5eb,_0x5c5400,_0x43b97a){logger['info'](_0x3412('0x63'),_0x363415,JSON[_0x3412('0x64')](_0x3bc5eb));process[_0x3412('0x65')](_0x3412('0x66'));var _0x2c2992=_0x3bc5eb[_0x3412('0x67')];var _0x45e051=_[_0x3412('0x68')](_0x2c2992);var _0x4d369c=_0x3bc5eb[_0x3412('0x69')];var _0x18dbf8=path['join'](config[_0x3412('0x6a')],_0x3412('0x6b'),_0x4d369c+_0x3412('0x6c'));logger[_0x3412('0x5d')]('body',_0x3bc5eb);db[_0x3412('0x6d')][_0x3412('0x6e')]({'raw':!![],'attributes':['id','name']})[_0x3412('0x21')](function(_0x6426cf){for(var _0x3f3e6a=0x0;_0x3f3e6a<_0x6426cf['length'];_0x3f3e6a++){if(_0x6426cf[_0x3f3e6a][_0x3412('0x6f')]in _0x2c2992){contactItemTypes['push'](_0x6426cf[_0x3f3e6a]);delete _0x45e051[_0x6426cf[_0x3f3e6a][_0x3412('0x6f')]];hasAdditionalPhones=!![];}for(var _0x4be565 in _0x2c2992){if(_0x6426cf[_0x3f3e6a][_0x3412('0x6f')]+_0x3412('0x70')===_0x4be565){phoneDescriptions[_0x3412('0x1f')]({'itemTypeId':_0x6426cf[_0x3f3e6a]['id'],'description':_0x4be565});delete _0x45e051[_0x4be565];}}}if(hasAdditionalPhones)_0x45e051[_0x3412('0x24')]='';var _0x34671e=_[_0x3412('0x71')](_0x45e051)[_0x3412('0x18')]();logger[_0x3412('0x5d')](_0x3412('0x72'),_0x34671e);fs['writeFileSync'](_0x18dbf8,_0x34671e+'\x0a');Papa[_0x3412('0x73')](fs[_0x3412('0x74')](_0x363415),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5e54ed,_0x52a196){try{for(var _0x2e227a=0x0,_0x4362c6=[];_0x2e227a<_0x5e54ed[_0x3412('0x75')][_0x3412('0x1d')];_0x2e227a++){stats['rows']+=0x1;if(_0x5e54ed[_0x3412('0x61')][_0x2e227a]){handleError(_0x5e54ed[_0x3412('0x75')][_0x2e227a],_0x5e54ed['errors'][_0x2e227a]);}else{var _0x51df94=[];var _0x4bff65=[];var _0x46c71d={};for(var _0x4a487f in _0x2c2992){let _0x47f59f=contactItemTypes[_0x3412('0x76')](_0x2c1ce9=>_0x2c1ce9[_0x3412('0x6f')]===_0x4a487f);let _0x650054=contactItemTypes[_0x3412('0x76')](_0x11a458=>_0x11a458[_0x3412('0x6f')]+'_description'===_0x4a487f);if(_[_0x3412('0x1e')](_0x47f59f)&&_[_0x3412('0x1e')](_0x650054)){if(_0x2c2992[_0x3412('0x77')](_0x4a487f)){if(_0x5e54ed[_0x3412('0x75')][_0x2e227a][_0x2c2992[_0x4a487f]]){var _0x234667=_['trim'](_0x5e54ed[_0x3412('0x75')][_0x2e227a][_0x2c2992[_0x4a487f]]['replace'](/"/g,'\x27'));switch(_0x4a487f){case _0x3412('0x37'):var _0x477ac8=moment(_0x234667,_0x3412('0x78'),!![]);if(_0x477ac8['isValid']()){_0x4362c6['push']('\x22'+_0x234667+'\x22');}else{_0x51df94['push'](_0x3412('0x79'));}break;case'priority':var _0x4c5521=parseInt(_0x234667);_0x234667=_['isNaN'](_0x4c5521)||_0x4c5521<0x0||_0x4c5521>0x4?_0x43b97a?0x3:0x2:_0x4c5521;_0x4362c6['push']('\x22'+_0x234667+'\x22');break;case _0x3412('0x7a'):var _0x5790c5=parseInt(_0x234667);if(_[_0x3412('0x7b')](_0x5790c5)&&_[_0x3412('0x7c')](_0x5c5400,_0x5790c5)){_0x4362c6['push']('\x22'+_0x5790c5+'\x22');}else{_0x51df94['push'](_0x3412('0x7d'));}break;case'email':if(isEmail(_0x234667)){_0x4362c6[_0x3412('0x1f')]('\x22'+_0x234667+'\x22');}else{_0x51df94[_0x3412('0x1f')](_0x3412('0x7e'));}break;case _0x3412('0x7f'):var _0x37f9f4=moment(_0x234667,_0x3412('0x80'),!![]);if(_0x37f9f4[_0x3412('0x81')]()){_0x4362c6[_0x3412('0x1f')]('\x22'+_0x234667+'\x22');}else{_0x51df94['push'](_0x3412('0x82'));}break;default:_0x4362c6[_0x3412('0x1f')]('\x22'+_0x234667+'\x22');}}else{switch(_0x4a487f){case _0x3412('0x83'):case _0x3412('0x13'):_0x51df94[_0x3412('0x1f')](_0x4a487f+_0x3412('0x84'));break;default:_0x4362c6[_0x3412('0x1f')]('\x22\x22');}}}}else{var _0x2d1889='';if(!_['isNil'](_0x47f59f)){if(!_0x46c71d[_0x3412('0x77')](_0x47f59f['id'])){for(var _0x129e2c=0x0;_0x129e2c<_0x2c2992[_0x4a487f][_0x3412('0x1d')];_0x129e2c++){var _0x234667=_[_0x3412('0x85')](_0x5e54ed[_0x3412('0x75')][_0x2e227a][_0x2c2992[_0x4a487f][_0x129e2c]][_0x3412('0x86')](/"/g,'\x27'));var _0x219216=phoneDescriptions[_0x3412('0x76')](_0x21e01b=>_0x21e01b[_0x3412('0x87')]===_0x47f59f['id']);if(!_[_0x3412('0x1e')](_0x219216)){var _0x4f89c2=_[_0x3412('0x85')](_0x5e54ed[_0x3412('0x75')][_0x2e227a][_0x2c2992[_0x219216[_0x3412('0x88')]][0x0]][_0x3412('0x86')](/"/g,'\x27'));if(!_[_0x3412('0x1e')](_0x4f89c2))_0x234667=_0x234667+'§'+_0x4f89c2;}if(_0x2d1889=='')_0x2d1889=_0x234667;else _0x2d1889+='|'+_0x234667;}_0x4bff65[_0x3412('0x1f')](_0x47f59f['id']+':'+_0x2d1889);_0x46c71d[_0x47f59f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4362c6[_0x3412('0x1f')]('\x22'+_0x4bff65['join'](';')+'\x22');}if(_0x51df94[_0x3412('0x1d')]){handleError(_0x5e54ed[_0x3412('0x75')][_0x2e227a],{'code':'SystemRow','message':_0x51df94[_0x3412('0x18')]()});}else{fs[_0x3412('0x89')](_0x18dbf8,_0x4362c6['join']()+'\x0a');}_0x4362c6=[];}if(!(stats[_0x3412('0x8a')]%0xc8)){socket[_0x3412('0x8b')](_0x3412('0x8c')+_0x4d369c,stats);stats[_0x3412('0x61')]=[];}}if(stopped){logger[_0x3412('0x5d')](_0x3412('0x8d'));_0x52a196[_0x3412('0x8e')]();}}catch(_0x103fd5){handleError(_0x5e54ed[_0x3412('0x75')][_0x2e227a],{'code':'SystemError','message':_0x103fd5[_0x3412('0x5f')]});logger['error']('step',_0x103fd5['message']);}},'complete':function(){try{var _0x3db981=[];var _0x295d17=tempTableName;_0x3db981[_0x3412('0x1f')](_0x3412('0x8f')+_0x295d17+_0x3412('0x90'));logger[_0x3412('0x5d')](_0x3412('0x91'),contactItemTypes['length']);var _0x484cad=util[_0x3412('0xe')]('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',_0x18dbf8,_0x295d17,_0x34671e,_0x3bc5eb[_0x3412('0x39')],_0x3bc5eb[_0x3412('0x56')]||null,NOW,NOW);if(_[_0x3412('0x1e')](_0x2c2992[_0x3412('0x37')])){_0x484cad+=_0x3412('0x92');}_0x3db981[_0x3412('0x1f')](_0x484cad);BPromise[_0x3412('0x93')](_0x3db981,handleQuery)[_0x3412('0x21')](function(_0x38e1cc){BPromise[_0x3412('0x20')]([handleAdditionalPhones()])[_0x3412('0x21')](function(){_0x3db981=[];for(var _0x2ec431=0x0;_0x2ec431\x20\x20');}var _0x1130c0=path[_0x3412('0x18')](config[_0x3412('0x6a')],_0x3412('0x6b'),process['argv'][0x2]);if(!fs[_0x3412('0x9b')](_0x1130c0)){throw new Error(_0x3412('0x9c'));}var _0x253617={};try{_0x253617=JSON[_0x3412('0x73')](process[_0x3412('0x9a')][0x3]);if(!_0x253617[_0x3412('0x67')]){throw new Error(_0x3412('0x9d'));}var _0x37b0e4=0x0;if(_0x253617['binding'][_0x3412('0x7a')]){_0x37b0e4=0x1;}if(!_0x253617[_0x3412('0x39')]){throw new Error(_0x3412('0x9e'));}}catch(_0x3f288a){throw new Error(_0x3412('0x9f'));}var _0x25bbcb=[];try{_0x25bbcb=_[_0x3412('0xa0')](JSON[_0x3412('0x73')](process['argv'][0x4]),'id');}catch(_0x562e70){logger[_0x3412('0x5d')](_0x3412('0xa1'));}main(_0x1130c0,_0x253617,_0x25bbcb,_0x37b0e4);}validate();process['on'](_0x3412('0xa2'),handleStop);process['on'](_0x3412('0xa3'),handleUncaughtException); \ No newline at end of file +var _0x5795=['.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','data','rows','find','hasOwnProperty','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','trim','description','SystemRow','appendFileSync','contact:import:','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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',',\x20scheduledAt\x20=\x20NOW()','each','all','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','select','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','then','catch','error','split','filter','CmContactHasItem','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','fromQuery','fields','from','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','concat','keys','CompanyId','min_id','group','Received\x20SIGINT','message','exit','errors','code','info','stringify','binding','clone','socket_timestamp','root'];(function(_0x5195eb,_0x547b6){var _0x4a8bca=function(_0xda39){while(--_0xda39){_0x5195eb['push'](_0x5195eb['shift']());}};_0x4a8bca(++_0x547b6);}(_0x5795,0xd1));var _0x5579=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x5795[_0x273c39];return _0x46d6b5;};'use strict';var fs=require('fs');var path=require(_0x5579('0x0'));var _=require(_0x5579('0x1'));var Papa=require(_0x5579('0x2'));var util=require(_0x5579('0x3'));var BPromise=require(_0x5579('0x4'));var moment=require(_0x5579('0x5'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x5579('0x6'));var logger=require(_0x5579('0x7'))('import');config[_0x5579('0x8')]=_[_0x5579('0x9')](config[_0x5579('0x8')],{'host':_0x5579('0xa'),'port':0x18eb});var socket=require(_0x5579('0xb'))(new Redis(config[_0x5579('0x8')]));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'](_0x5579('0xc'));var tempTableName=_0x5579('0xd')+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x36110e){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))*$/[_0x5579('0xe')](_0x36110e);}function selectNotIn(_0x2a38e7,_0xd6bdc0,_0x5ee51c,_0x317906,_0x4dc7b4){return squel[_0x5579('0xf')]()[_0x5579('0x10')](_0x5579('0x11'))['from'](_0x317906)[_0x5579('0x12')](_0xd6bdc0,null,_0xd6bdc0+_0x5579('0x13')+_0x317906+'.'+_0x5ee51c)['where'](_0x317906+'.'+_0x5ee51c+'\x20=\x20'+_0x2a38e7+'.'+_0x5ee51c)[_0x5579('0x14')](_0xd6bdc0+_0x5579('0x15')+_0x4dc7b4[_0x5579('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3fe5e3,_0x316d4f){promisesAdditionalPhones=[];promisesContact=[];return db[_0x5579('0x16')][_0x5579('0x17')](_0x5579('0x18')+tempTableName)[_0x5579('0x19')](function(_0x202344){if(_0x202344!==null){var _0x39bf6e=[];for(var _0xc0ccbb=0x0;_0xc0ccbb<_0x202344[_0x5579('0x1a')];_0xc0ccbb++){var _0x5597ad=_0x202344[_0xc0ccbb];if(!_['isNil'](_0x5597ad[_0x5579('0x11')])){if(!_[_0x5579('0x1b')](_0x5597ad[_0x5579('0x1c')]))_0x39bf6e[_0x5579('0x1d')](insertAdditionalPhones(_0x5597ad));promisesContact[_0x5579('0x1d')]({'contact':_0x5597ad});}}}Promise['all'](_0x39bf6e)[_0x5579('0x1e')](function(){_0x3fe5e3({'val':0x1});});})[_0x5579('0x1f')](function(_0x732dd3){logger[_0x5579('0x20')](_0x732dd3['message']);});});}function insertAdditionalPhones(_0x10741f){return new Promise(function(_0x4151d7,_0x5124a7){var _0x10f693=_0x10741f['AdditionalPhones'];if(_[_0x5579('0x1b')](_0x10f693))_0x5124a7({'val':0x0});else{var _0x17ae02=_0x10f693[_0x5579('0x21')](';');var _0x31578e=[];orderBy=0x0;for(var _0x3a3f50=0x0;_0x3a3f50<_0x17ae02[_0x5579('0x1a')];_0x3a3f50++){_0x31578e[_0x5579('0x1d')](splitAdditionalPhone(_0x10741f['id'],_0x17ae02[_0x3a3f50]));}Promise['all'](_0x31578e)[_0x5579('0x1e')](function(){_0x4151d7({'val':_0x17ae02['length']});});}});}function splitAdditionalPhone(_0x304c50,_0xeb6ee){return new Promise(function(_0x5d90ce,_0x4dab56){var _0x5754c6=_0xeb6ee['split'](':');var _0x5167a6=_0x5754c6[0x0];var _0x335839=_0x5754c6[0x1];if(_0x335839!==''){var _0x4cb334=_0x335839['split']('|');var _0x3e1044=[];for(var _0x557525=0x0;_0x557525<_0x4cb334[_0x5579('0x1a')];_0x557525++){if(_0x4cb334[_0x557525]!==''){var _0x11f8bc=_[_0x5579('0x22')](promisesAdditionalPhones,{'contactId':_0x304c50,'phone':_0x4cb334[_0x557525]});if(_0x11f8bc[_0x5579('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x304c50,'contactTypeId':_0x5167a6,'phone':_0x4cb334[_0x557525],'orderBy':orderBy});}}}_0x5d90ce({'ok':0x1});}else _0x5d90ce({'res':0x0});});}function createAdditionalPhone(_0x3701a6,_0x25465b,_0x4377f7,_0x1f726b){var _0x4ac34b='';var _0xac765e='';var _0x432929=_0x4377f7[_0x5579('0x21')]('§');_0x4ac34b=_0x432929[0x0];if(_0x432929['length']==0x2)_0xac765e=_0x432929[0x1];return new Promise(function(_0x1a1d02,_0x3c4bb5){return db[_0x5579('0x23')]['findOne']({'where':{'CmContactId':_0x3701a6,'item':_0x4ac34b}})[_0x5579('0x1e')](function(_0x4ffea6){if(_0x4ffea6){return db[_0x5579('0x23')]['update']({'ItemTypeId':_0x25465b,'description':_0xac765e,'OrderBy':_0x1f726b},{'where':{'CmContactId':_0x3701a6,'item':_0x4ac34b}})[_0x5579('0x1e')](function(_0x454d9b){_0x1a1d02({'res':'updated'});});}else{return db[_0x5579('0x23')][_0x5579('0x24')]({'CmContactId':_0x3701a6,'item':_0x4ac34b,'ItemTypeId':_0x25465b,'description':_0xac765e,'OrderBy':_0x1f726b,'ItemClass':_0x5579('0x25')})['then'](function(_0x956ed){_0x1a1d02({'res':_0x5579('0x26')});});}});});}function updateContact(_0x4d1f09){return new Promise(function(_0x3c1f93,_0x56d0bd){var _0x4a5b09=_0x4d1f09['id'];delete _0x4d1f09['id'];return db[_0x5579('0x27')]['update'](_0x4d1f09,{'where':{'id':_0x4a5b09}})[_0x5579('0x1e')](function(_0x1051a){updatedRows+=0x1;return db[_0x5579('0x28')]['update']({'phone':_0x4d1f09[_0x5579('0x11')]},{'where':{'ContactId':_0x4a5b09}})[_0x5579('0x1e')](function(_0x5ca5e4){_0x3c1f93({'ret':'OK'});});});});}function insertCmHopper(_0x2901a5,_0x1c034b,_0x390722,_0x5f07dc,_0x1c34cf){var _0x5ee640=['cm_contacts.phone',_0x5579('0x29'),_0x5579('0x2a'),_0x5579('0x2b'),_0x1c034b+'.'+_0x5f07dc,_0x5579('0x2c'),_0x5579('0x2d'),_0x5579('0x2e'),'cm_contacts.UserId','\x22'+_0x1c34cf+'\x22'];return squel[_0x5579('0x2f')]()[_0x5579('0x30')](_0x5579('0x31'))['fromQuery']([_0x5579('0x11'),_0x5579('0x32'),_0x5579('0x33'),_0x5579('0x34'),_0x5f07dc,_0x5579('0x35'),_0x5579('0x36'),_0x5579('0x37'),_0x5579('0x38'),_0x5579('0x39')],squel[_0x5579('0xf')]()['fields'](_0x5ee640)['from'](_0x1c034b)[_0x5579('0x12')](_0x5579('0x3a'),null,_0x5579('0x3b')+_0x1c034b+_0x5579('0x3c'))['join'](_0x390722,null,_0x390722+_0x5579('0x13')+_0x1c034b+'.'+_0x5f07dc)[_0x5579('0x14')](_0x1c034b+_0x5579('0x3d'),_0x2901a5)['where'](_0x5579('0x3e'),NOW)[_0x5579('0x14')](_0x5579('0x3f'),selectNotIn(_0x1c034b,_0x390722,_0x5f07dc,_0x5579('0x31'),[_0x5579('0x40'),'\x22onlyIfOpen\x22']))[_0x5579('0x14')](_0x5579('0x3f'),selectNotIn(_0x1c034b,_0x390722,_0x5f07dc,_0x5579('0x31'),['\x22always\x22'])))[_0x5579('0x41')]();}function insertCmHopperBlack(_0x4359fc,_0x32d950,_0x46b3fe,_0x203008){var _0x786336=['cm_contacts.phone',_0x5579('0x2a'),_0x5579('0x2b'),_0x32d950+'.'+_0x203008,'cm_contacts.createdAt',_0x5579('0x2d')];return squel[_0x5579('0x2f')]()[_0x5579('0x30')](_0x5579('0x42'))[_0x5579('0x43')]([_0x5579('0x11'),'ContactId',_0x5579('0x34'),_0x203008,'createdAt','updatedAt'],squel[_0x5579('0xf')]()[_0x5579('0x44')](_0x786336)[_0x5579('0x45')](_0x32d950)[_0x5579('0x12')](_0x5579('0x3a'),null,_0x5579('0x3b')+_0x32d950+_0x5579('0x3c'))[_0x5579('0x12')](_0x46b3fe,null,_0x46b3fe+'.id\x20=\x20'+_0x32d950+'.'+_0x203008)['where'](_0x32d950+_0x5579('0x3d'),_0x4359fc)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5579('0x14')](_0x5579('0x3f'),squel[_0x5579('0xf')]()['field'](_0x5579('0x11'))['from'](_0x5579('0x42'))[_0x5579('0x14')](_0x5579('0x46'),_0x4359fc)[_0x5579('0x14')](_0x203008+_0x5579('0x47'),_0x32d950+'.'+_0x203008)))[_0x5579('0x41')]();}function insertCmHopperAdditionalPhones(_0x4c4c33){var _0x31974c=[_0x5579('0x48'),_0x5579('0x49'),'cm_contact_has_items.OrderBy',_0x5579('0x4a'),_0x5579('0x4b')];return squel[_0x5579('0x2f')]()['into'](_0x5579('0x4c'))[_0x5579('0x43')](['CmHopperId',_0x5579('0x11'),_0x5579('0x4d'),_0x5579('0x35'),'updatedAt'],squel['select']()[_0x5579('0x44')](_0x31974c)[_0x5579('0x45')](_0x5579('0x31'))[_0x5579('0x12')](_0x5579('0x3a'),null,_0x5579('0x4e'))[_0x5579('0x12')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x5579('0x14')]('cm_hopper.ListId\x20=\x20?',_0x4c4c33)[_0x5579('0x14')](_0x5579('0x3e'),NOW))[_0x5579('0x41')]();}function insertCmContact(_0x9f7b4f,_0x436950,_0x5dfcc9,_0x45f902){var _0x2dfbf5=_[_0x5579('0x4f')](_[_0x5579('0x50')](_0x45f902),['ListId',_0x5579('0x51'),_0x5579('0x35'),_0x5579('0x36')]);return squel[_0x5579('0x2f')]()[_0x5579('0x30')]('cm_contacts')['fromQuery'](_0x2dfbf5,squel['select']()[_0x5579('0x44')](_0x2dfbf5)[_0x5579('0x45')](_0x436950)[_0x5579('0x14')]('('+_0x5dfcc9[_0x5579('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0x5579('0xf')]()['fields'](_0x5dfcc9)[_0x5579('0x45')](_0x5579('0x3a'))[_0x5579('0x14')](_0x5579('0x46'),_0x9f7b4f))['where']('id\x20IN\x20?',squel['select']()['field']('MIN(id)',_0x5579('0x52'))['from'](_0x436950)[_0x5579('0x53')](_0x5dfcc9[_0x5579('0x12')](','))))[_0x5579('0x41')]();}function handleStop(){logger['info'](_0x5579('0x54'));stopped=!![];}function handleUncaughtException(_0x1f6e6b){logger[_0x5579('0x20')](_0x1f6e6b[_0x5579('0x55')]);process[_0x5579('0x56')](0x1);}function handleError(_0x4fe289,_0x364557){stats[_0x5579('0x57')][_0x5579('0x1d')]({'name':_0x364557[_0x5579('0x58')],'message':_0x364557[_0x5579('0x55')],'row':_0x4fe289});}function handleQuery(_0xffda9e){logger[_0x5579('0x59')](_0xffda9e);return db[_0x5579('0x16')][_0x5579('0x17')](_0xffda9e)[_0x5579('0x19')](function(_0x2a90f4){results[_0x5579('0x1d')](_0x2a90f4);})[_0x5579('0x1f')](function(_0x4b7ee0){logger[_0x5579('0x20')](_0x4b7ee0[_0x5579('0x55')]);});}function main(_0x4a0af7,_0x4ca010,_0x58a265,_0x302733){logger['info']('main',_0x4a0af7,JSON[_0x5579('0x5a')](_0x4ca010));process['send']('start');var _0x3b312a=_0x4ca010[_0x5579('0x5b')];var _0x1c5684=_[_0x5579('0x5c')](_0x3b312a);var _0x12b7c4=_0x4ca010[_0x5579('0x5d')];var _0x4842b0=path[_0x5579('0x12')](config[_0x5579('0x5e')],'server/files/tmp',_0x12b7c4+_0x5579('0x5f'));logger[_0x5579('0x59')](_0x5579('0x60'),_0x4ca010);db[_0x5579('0x61')][_0x5579('0x62')]({'raw':!![],'attributes':['id','name']})[_0x5579('0x1e')](function(_0x4a1950){for(var _0x3e00ee=0x0;_0x3e00ee<_0x4a1950[_0x5579('0x1a')];_0x3e00ee++){if(_0x4a1950[_0x3e00ee]['name']in _0x3b312a){contactItemTypes['push'](_0x4a1950[_0x3e00ee]);delete _0x1c5684[_0x4a1950[_0x3e00ee][_0x5579('0x63')]];hasAdditionalPhones=!![];}for(var _0x303a87 in _0x3b312a){if(_0x4a1950[_0x3e00ee][_0x5579('0x63')]+_0x5579('0x64')===_0x303a87){phoneDescriptions[_0x5579('0x1d')]({'itemTypeId':_0x4a1950[_0x3e00ee]['id'],'description':_0x303a87});delete _0x1c5684[_0x303a87];}}}if(hasAdditionalPhones)_0x1c5684[_0x5579('0x1c')]='';var _0x13eaee=_['keys'](_0x1c5684)[_0x5579('0x12')]();logger[_0x5579('0x59')](_0x5579('0x65'),_0x13eaee);fs[_0x5579('0x66')](_0x4842b0,_0x13eaee+'\x0a');Papa[_0x5579('0x67')](fs['createReadStream'](_0x4a0af7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x22abf9,_0x20ddea){try{for(var _0x1e01b9=0x0,_0x4a3f36=[];_0x1e01b9<_0x22abf9[_0x5579('0x68')][_0x5579('0x1a')];_0x1e01b9++){stats[_0x5579('0x69')]+=0x1;if(_0x22abf9[_0x5579('0x57')][_0x1e01b9]){handleError(_0x22abf9[_0x5579('0x68')][_0x1e01b9],_0x22abf9[_0x5579('0x57')][_0x1e01b9]);}else{var _0x222d5c=[];var _0xb8f0c5=[];var _0x3b83ac={};for(var _0x485693 in _0x3b312a){let _0x186552=contactItemTypes[_0x5579('0x6a')](_0x4f935a=>_0x4f935a[_0x5579('0x63')]===_0x485693);let _0x8bde13=contactItemTypes[_0x5579('0x6a')](_0xfb866f=>_0xfb866f[_0x5579('0x63')]+'_description'===_0x485693);if(_[_0x5579('0x1b')](_0x186552)&&_[_0x5579('0x1b')](_0x8bde13)){if(_0x3b312a[_0x5579('0x6b')](_0x485693)){if(_0x22abf9[_0x5579('0x68')][_0x1e01b9][_0x3b312a[_0x485693]]){var _0xf9ad48=_['trim'](_0x22abf9[_0x5579('0x68')][_0x1e01b9][_0x3b312a[_0x485693]][_0x5579('0x6c')](/"/g,'\x27'));switch(_0x485693){case _0x5579('0x32'):var _0x5dfd44=moment(_0xf9ad48,_0x5579('0xc'),!![]);if(_0x5dfd44[_0x5579('0x6d')]()){_0x4a3f36['push']('\x22'+_0xf9ad48+'\x22');}else{_0x222d5c[_0x5579('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x5579('0x37'):var _0x2b8e3a=parseInt(_0xf9ad48);_0xf9ad48=_[_0x5579('0x6e')](_0x2b8e3a)||_0x2b8e3a<0x0||_0x2b8e3a>0x4?_0x302733?0x3:0x2:_0x2b8e3a;_0x4a3f36['push']('\x22'+_0xf9ad48+'\x22');break;case _0x5579('0x38'):var _0x4c4aa8=parseInt(_0xf9ad48);if(_[_0x5579('0x6f')](_0x4c4aa8)&&_['includes'](_0x58a265,_0x4c4aa8)){_0x4a3f36[_0x5579('0x1d')]('\x22'+_0x4c4aa8+'\x22');}else{_0x222d5c['push'](_0x5579('0x70'));}break;case _0x5579('0x71'):if(isEmail(_0xf9ad48)){_0x4a3f36[_0x5579('0x1d')]('\x22'+_0xf9ad48+'\x22');}else{_0x222d5c['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x53f63d=moment(_0xf9ad48,_0x5579('0x72'),!![]);if(_0x53f63d[_0x5579('0x6d')]()){_0x4a3f36[_0x5579('0x1d')]('\x22'+_0xf9ad48+'\x22');}else{_0x222d5c[_0x5579('0x1d')](_0x5579('0x73'));}break;default:_0x4a3f36[_0x5579('0x1d')]('\x22'+_0xf9ad48+'\x22');}}else{switch(_0x485693){case _0x5579('0x74'):case _0x5579('0x11'):_0x222d5c[_0x5579('0x1d')](_0x485693+_0x5579('0x75'));break;default:_0x4a3f36['push']('\x22\x22');}}}}else{var _0x56ef8b='';if(!_[_0x5579('0x1b')](_0x186552)){if(!_0x3b83ac[_0x5579('0x6b')](_0x186552['id'])){for(var _0x583043=0x0;_0x583043<_0x3b312a[_0x485693]['length'];_0x583043++){var _0xf9ad48=_['trim'](_0x22abf9['data'][_0x1e01b9][_0x3b312a[_0x485693][_0x583043]][_0x5579('0x6c')](/"/g,'\x27'));var _0x59e068=phoneDescriptions[_0x5579('0x6a')](_0x19e679=>_0x19e679[_0x5579('0x76')]===_0x186552['id']);if(!_['isNil'](_0x59e068)){var _0x5ee210=_[_0x5579('0x77')](_0x22abf9[_0x5579('0x68')][_0x1e01b9][_0x3b312a[_0x59e068[_0x5579('0x78')]][0x0]][_0x5579('0x6c')](/"/g,'\x27'));if(!_[_0x5579('0x1b')](_0x5ee210))_0xf9ad48=_0xf9ad48+'§'+_0x5ee210;}if(_0x56ef8b=='')_0x56ef8b=_0xf9ad48;else _0x56ef8b+='|'+_0xf9ad48;}_0xb8f0c5[_0x5579('0x1d')](_0x186552['id']+':'+_0x56ef8b);_0x3b83ac[_0x186552['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4a3f36['push']('\x22'+_0xb8f0c5[_0x5579('0x12')](';')+'\x22');}if(_0x222d5c[_0x5579('0x1a')]){handleError(_0x22abf9[_0x5579('0x68')][_0x1e01b9],{'code':_0x5579('0x79'),'message':_0x222d5c['join']()});}else{fs[_0x5579('0x7a')](_0x4842b0,_0x4a3f36[_0x5579('0x12')]()+'\x0a');}_0x4a3f36=[];}if(!(stats[_0x5579('0x69')]%0xc8)){socket['emit'](_0x5579('0x7b')+_0x12b7c4,stats);stats[_0x5579('0x57')]=[];}}if(stopped){logger[_0x5579('0x59')]('Abort\x20parser');_0x20ddea[_0x5579('0x7c')]();}}catch(_0x215697){handleError(_0x22abf9[_0x5579('0x68')][_0x1e01b9],{'code':'SystemError','message':_0x215697['message']});logger[_0x5579('0x20')](_0x5579('0x7d'),_0x215697[_0x5579('0x55')]);}},'complete':function(){try{var _0x9fbf02=[];var _0x313744=tempTableName;_0x9fbf02[_0x5579('0x1d')](_0x5579('0x7e')+_0x313744+_0x5579('0x7f'));logger['info']('CIS\x20len',contactItemTypes[_0x5579('0x1a')]);var _0x374c3f=util[_0x5579('0x80')](_0x5579('0x81'),_0x4842b0,_0x313744,_0x13eaee,_0x4ca010[_0x5579('0x34')],_0x4ca010[_0x5579('0x51')]||null,NOW,NOW);if(_[_0x5579('0x1b')](_0x3b312a[_0x5579('0x32')])){_0x374c3f+=_0x5579('0x82');}_0x9fbf02[_0x5579('0x1d')](_0x374c3f);BPromise[_0x5579('0x83')](_0x9fbf02,handleQuery)['then'](function(_0x1bdaf6){BPromise[_0x5579('0x84')]([handleAdditionalPhones()])['then'](function(){_0x9fbf02=[];for(var _0x42a0ea=0x0;_0x42a0ea\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.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.MailAccountId','openchannel','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','../parsers/advancedSearch','./update-interaction','./utils','../../mysqldb','getAccountFK','role','agent','search','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','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','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(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','name','buildExpression','type','default','text','value','start','end','and','Contact','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','tags','clause','ids','operator','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','body','some','compact','forEach','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','then','fields','read','filter','get','Websites','Accounts','resolve'];(function(_0x46f54e,_0x25a758){var _0x47dca1=function(_0x522799){while(--_0x522799){_0x46f54e['push'](_0x46f54e['shift']());}};_0x47dca1(++_0x25a758);}(_0x0d9e,0x18d));var _0xe0d9=function(_0x4c9fd5,_0x4a5369){_0x4c9fd5=_0x4c9fd5-0x0;var _0x3223de=_0x0d9e[_0x4c9fd5];return _0x3223de;};'use strict';var _=require(_0xe0d9('0x0'));var squel=require('squel');var as=require(_0xe0d9('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0xe0d9('0x2'))['updateInteraction'];var utils=require(_0xe0d9('0x3'));var db=require(_0xe0d9('0x4'))['db'];function skipInteractionsQuery(_0x5b7aee,_0x9908f4,_0x19b5d1){var _0x9239c2=![];var _0x5edd39=utils[_0xe0d9('0x5')](_0x5b7aee);if(_0x9908f4[_0xe0d9('0x6')]===_0xe0d9('0x7')&&!_0x19b5d1[_0xe0d9('0x8')]&&!_0x19b5d1[_0x5edd39]){_0x9239c2=!![];}return _0x9239c2;}function getTagsQuery(){return squel[_0xe0d9('0x9')]()[_0xe0d9('0xa')]('id')['field']('name')[_0xe0d9('0xa')]('color')[_0xe0d9('0xb')](_0xe0d9('0xc'));}function getUsersQuery(_0x585e0,_0x25f8a0){var _0xd29b83=utils[_0xe0d9('0xd')](_0x585e0);var _0x1637e1=_0xe0d9('0xe')+_0x585e0+_0xe0d9('0xf');var _0x57b56b=squel[_0xe0d9('0x9')]()[_0xe0d9('0xa')](_0xe0d9('0x10'))[_0xe0d9('0xa')](_0xe0d9('0x11'))['field'](_0xe0d9('0x12')+_0xd29b83)[_0xe0d9('0xb')](_0x1637e1,'ui')['left_join'](_0xe0d9('0x13'),'u',_0xe0d9('0x14'));if(_0x25f8a0[_0xe0d9('0x15')]>0x0){_0x57b56b[_0xe0d9('0x16')]('ui.'+_0xd29b83+_0xe0d9('0x17'),_[_0xe0d9('0x18')](_0x25f8a0,'id'));}return _0x57b56b;}function getInteractionsQuery(_0x4bb275){var _0x499bc1=utils[_0xe0d9('0x19')](_0x4bb275);var _0x3ad013=utils[_0xe0d9('0x5')](_0x4bb275);var _0x2592b2=utils['getInteractionFK'](_0x4bb275);return squel[_0xe0d9('0x9')]()[_0xe0d9('0xb')](_0x499bc1[_0xe0d9('0x1a')],'i')[_0xe0d9('0x1b')]('cm_contacts','c',_0xe0d9('0x1c'))[_0xe0d9('0x1b')](_0xe0d9('0x13'),'o',_0xe0d9('0x1d'))[_0xe0d9('0x1b')](_0x499bc1[_0xe0d9('0x1e')],'a',_0xe0d9('0x1f')+_0x3ad013)[_0xe0d9('0x1b')](_0x499bc1[_0xe0d9('0x20')],'me',_0xe0d9('0x21')+_0x2592b2+_0xe0d9('0x22'))[_0xe0d9('0x1b')](_0x499bc1['interactionsTags'],'it','it.'+_0x2592b2+_0xe0d9('0x22'))[_0xe0d9('0x1b')]('tools_tags','t',_0xe0d9('0x23'));}function getSqlClauses(){var _0x2eebc3={'body':squel[_0xe0d9('0x24')](),'contact':squel[_0xe0d9('0x24')](),'default':squel[_0xe0d9('0x24')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0xe0d9('0x24')](),'tags':{'clause':squel[_0xe0d9('0x24')](),'ids':null},'user':squel[_0xe0d9('0x24')]()};return _0x2eebc3;}function parseTagParameter(_0x6feaba){var _0x275ca1=squel[_0xe0d9('0x24')]();if(_0x6feaba){var _0xff6091=utils[_0xe0d9('0x25')](_0x6feaba);_0xff6091['forEach'](function(_0x3f71a6){_0x275ca1['or'](_0xe0d9('0x26'),'%,'+_0x3f71a6+',%');});}return _0x275ca1;}function parseReadParameter(_0x3a8ca6){var _0x2db497='';if(_0x3a8ca6){_0x2db497=_0xe0d9('0x27');if(_0x3a8ca6==='1'){_0x2db497=_0x2db497[_0xe0d9('0x28')]('{OPERATOR}','=');}else{_0x2db497=_0x2db497[_0xe0d9('0x28')](_0xe0d9('0x29'),'>');}}return _0x2db497;}function parseSearchFilter(_0x3d908d,_0x4d3b57){var _0x4b9880=squel[_0xe0d9('0x24')]();if(_0x4d3b57){var _0x539ec6=_0x4d3b57['replace']('\x5c','\x5c\x5c')[_0xe0d9('0x28')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x539ec6)){_0x4b9880['or'](_0xe0d9('0x2a'),_0x539ec6+'%');if([_0xe0d9('0x2b'),_0xe0d9('0x2c')][_0xe0d9('0x2d')](_0x3d908d)){_0x4b9880['or'](_0xe0d9('0x2e'),_0x539ec6+'%');}else if(_0x3d908d===_0xe0d9('0x2f')){_0x4b9880['or'](_0xe0d9('0x30'),_0x539ec6+'%');}else if(_0x3d908d==='openchannel'){_0x4b9880['or'](_0xe0d9('0x31'),_0x539ec6+'%');}}else if(_0x3d908d==='mail'&&qs[_0xe0d9('0x32')](_0x539ec6)){_0x4b9880['or'](_0xe0d9('0x33'),_0x539ec6+'%');}else{if(_0x3d908d===_0xe0d9('0x34')){_0x4b9880['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x539ec6,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe0d9('0x35')](_0x539ec6));}else if(_0x3d908d!=='fax'){_0x4b9880['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x539ec6));}_0x4b9880['or'](_0xe0d9('0x36'),qs['getFullTextValue'](_0x539ec6,!![]),null);}}return _0x4b9880;}function parseAdvancedSearchFilter(_0x345102,_0x5aaec9){var _0x1df4e3=getSqlClauses();var _0x2c4b32=as[_0xe0d9('0x37')](_0x345102);var _0x101e6b=_0x2c4b32[_0xe0d9('0x38')];for(var _0x24af52=0x0;_0x24af52<_0x2c4b32['conditions'][_0xe0d9('0x15')];_0x24af52++){var _0x282f90=_0x2c4b32[_0xe0d9('0x39')][_0x24af52];var _0x59d923='i';var _0x192cd4=_[_0xe0d9('0x3a')](_0x5aaec9,[_0xe0d9('0x3b'),_0x282f90[_0xe0d9('0xa')]]);if(_0x192cd4){var _0x2ef3f8=as[_0xe0d9('0x3c')](_0x59d923,_0x192cd4[_0xe0d9('0x3d')],_0x282f90);_0x1df4e3[_0xe0d9('0x3e')][_0x101e6b](_0x2ef3f8[_0xe0d9('0x3f')],_0x2ef3f8[_0xe0d9('0x40')][_0xe0d9('0x41')],_0x2ef3f8[_0xe0d9('0x40')][_0xe0d9('0x42')]);}else{switch(_0x282f90[_0xe0d9('0xa')]){case'unreadMessages':var _0x268588=parseReadParameter(_0x282f90[_0xe0d9('0x40')]);_0x1df4e3['read'][_0xe0d9('0x43')](_0x268588);break;case _0xe0d9('0x44'):if(_0x282f90['operator']==='$substring'){if(_0x282f90[_0xe0d9('0x40')][_0xe0d9('0x45')]('\x20')[_0xe0d9('0x15')]>0x1){_0x1df4e3[_0xe0d9('0x46')][_0x101e6b](_0xe0d9('0x36'),qs[_0xe0d9('0x35')](_0x282f90[_0xe0d9('0x40')],!![]),null);}else{var _0x201868='%'+_0x282f90['value']+'%';_0x1df4e3[_0xe0d9('0x46')][_0x101e6b](_0xe0d9('0x47'),_0x201868,_0x201868,_0x201868);}}else{_0x192cd4=_[_0xe0d9('0x3a')](_0x5aaec9,[_0xe0d9('0x3b'),_0xe0d9('0x48')]);_0x282f90['field']='ContactId';_0x2ef3f8=as[_0xe0d9('0x3c')](_0x59d923,_0x192cd4[_0xe0d9('0x3d')],_0x282f90);_0x1df4e3[_0xe0d9('0x46')][_0x101e6b](_0x2ef3f8['text'],_0x2ef3f8[_0xe0d9('0x40')][_0xe0d9('0x41')],_0x2ef3f8[_0xe0d9('0x40')][_0xe0d9('0x42')]);}break;case'Tag':var _0x55c47f=_0x282f90[_0xe0d9('0x40')][_0xe0d9('0x45')](',')[_0xe0d9('0x18')](function(_0x5cce9b){return Number(_0x5cce9b);});var _0xca669f=parseTagParameter(_0x55c47f);_0x1df4e3[_0xe0d9('0x49')][_0xe0d9('0x4a')][_0xe0d9('0x43')](_0xca669f);_0x1df4e3[_0xe0d9('0x49')][_0xe0d9('0x4b')]=_0x55c47f;break;case'User':if(_0x282f90[_0xe0d9('0x4c')]===_0xe0d9('0x4d')){_0x1df4e3[_0xe0d9('0x4e')][_0x101e6b](_0xe0d9('0x4f'),'%'+_0x282f90[_0xe0d9('0x40')]+'%',null);}else{_0x192cd4=_[_0xe0d9('0x3a')](_0x5aaec9,[_0xe0d9('0x3b'),_0xe0d9('0x50')]);_0x282f90[_0xe0d9('0xa')]=_0xe0d9('0x50');_0x2ef3f8=as[_0xe0d9('0x3c')](_0x59d923,_0x192cd4['type'],_0x282f90);_0x1df4e3['user'][_0x101e6b](_0x2ef3f8['text'],_0x2ef3f8[_0xe0d9('0x40')][_0xe0d9('0x41')],_0x2ef3f8['value']['end']);}break;case'body':case _0xe0d9('0x51'):_0x2ef3f8=as['buildExpression']('me',null,_0x282f90);_0x1df4e3[_0xe0d9('0x52')][_0x101e6b](_0x2ef3f8[_0xe0d9('0x3f')],_0x2ef3f8[_0xe0d9('0x40')][_0xe0d9('0x41')],_0x2ef3f8[_0xe0d9('0x40')]['end']);break;}}}return _0x1df4e3;}function parseModelFields(_0x2314dc,_0x36d514,_0x50870c){var _0x56ad92=utils[_0xe0d9('0x5')](_0x2314dc);var _0x413964=squel['expr']();var _0x23213e=_(_0x36d514)['keys']()['map'](function(_0x195547){return _[_0xe0d9('0x53')](_0x50870c,['name',_0x195547])?_0x195547:undefined;})[_0xe0d9('0x54')]()['value']();if(_0x23213e[_0xe0d9('0x15')]>0x0){_0x23213e[_0xe0d9('0x55')](function(_0x14549c){if(_0x14549c===_0x56ad92){_0x413964['and']('i.'+_0x56ad92+_0xe0d9('0x17'),[][_0xe0d9('0x56')](_0x36d514[_0x14549c]));}else if(_0x14549c===_0xe0d9('0x57')){var _0x1d0006=JSON[_0xe0d9('0x58')](_0x36d514[_0x14549c])['$gte'];var _0x368c96=JSON[_0xe0d9('0x58')](_0x36d514[_0x14549c])[_0xe0d9('0x59')];_0x413964[_0xe0d9('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1d0006,_0x368c96);}else{if(_0x36d514[_0x14549c]===_0xe0d9('0x5a')){_0x413964[_0xe0d9('0x43')]('i.'+_0x14549c+_0xe0d9('0x5b'));}else{_0x413964[_0xe0d9('0x43')]('i.'+_0x14549c+_0xe0d9('0x5c'),_0x36d514[_0x14549c]);}}});}return _0x413964;}function parseQueryParameters(_0x30da6f,_0x3a6953,_0x4d8795){var _0x13ff8a=getSqlClauses();return Promise['resolve']()[_0xe0d9('0x5d')](function(){return parseModelFields(_0x30da6f,_0x3a6953,_0x4d8795);})[_0xe0d9('0x5d')](function(_0x2d2583){_0x13ff8a[_0xe0d9('0x5e')]['and'](_0x2d2583);return parseReadParameter(_0x3a6953[_0xe0d9('0x5f')]);})[_0xe0d9('0x5d')](function(_0x25889b){_0x13ff8a[_0xe0d9('0x5f')][_0xe0d9('0x43')](_0x25889b);return parseTagParameter(_0x3a6953['tag']);})[_0xe0d9('0x5d')](function(_0x3192c5){_0x13ff8a['tags'][_0xe0d9('0x4a')][_0xe0d9('0x43')](_0x3192c5);return parseSearchFilter(_0x30da6f,_0x3a6953[_0xe0d9('0x60')]);})[_0xe0d9('0x5d')](function(_0x5a5bfd){_0x13ff8a[_0xe0d9('0x60')]=_0x5a5bfd;return _0x13ff8a;});}function checkAccountsRestrictions(_0x205383,_0x3fd392,_0x1c37a1){var _0x17b5a5=utils['getAccountFK'](_0x205383);var _0x193a7f=_0xe0d9('0x61')+_['capitalize'](_0x205383)+(_0x205383==='chat'?_0xe0d9('0x62'):_0xe0d9('0x63'));var _0x1e908f=squel[_0xe0d9('0x24')]();return Promise[_0xe0d9('0x64')]()[_0xe0d9('0x5d')](function(){if(_0x1c37a1[_0xe0d9('0x8')]&&_0x3fd392[_0xe0d9('0x6')]===_0xe0d9('0x7')){return _0x3fd392[_0x193a7f]({'attributes':['id'],'raw':!![]});}})[_0xe0d9('0x5d')](function(_0x5e58cc){if(_0x5e58cc){if(_0x5e58cc[_0xe0d9('0x15')]===0x0){_0x1e908f[_0xe0d9('0x43')]('i.'+_0x17b5a5+_0xe0d9('0x5b'));}else{_0x1e908f[_0xe0d9('0x43')]('i.'+_0x17b5a5+_0xe0d9('0x17'),_[_0xe0d9('0x18')](_0x5e58cc,'id'));}}else if(!_0x1c37a1[_0x17b5a5]){_0x1e908f['and']('i.'+_0x17b5a5+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x1e908f;});}function getClosedOrderClause(_0x1e1440,_0x499a8b){var _0xbc0da6='';var _0x5133ab=[_0xe0d9('0x65'),_0xe0d9('0x66'),_0xe0d9('0x67')];if(_0x1e1440==='mail'){_0x5133ab['unshift']('i.substatus');}if(_0x499a8b[_0xe0d9('0x68')]==='0'&&_0x1e1440===_0xe0d9('0x34')){_0xbc0da6=_0xe0d9('0x69');}else{if(_0x499a8b['closed']==='1'){_0x5133ab[_0xe0d9('0x6a')]();}_0xbc0da6=_0xe0d9('0x6b')+_0x5133ab['join'](',\x20')+')';}return _0xbc0da6;}function getFilteredInteractions(_0x375669,_0x3202fd,_0x4907a8,_0x4a6c33){var _0x45dd44=utils[_0xe0d9('0xd')](_0x375669);var _0x16f96a=_[_0xe0d9('0x6c')](_0x375669)+_0xe0d9('0x6d');var _0x3f2689=[];var _0x3dfed7=getTagsQuery();var _0x307a1d={'type':db[_0xe0d9('0x6e')][_0xe0d9('0x6f')]['SELECT'],'raw':!![]};var _0xffbdaa=[];var _0x43ab09=[];return db['sequelize'][_0xe0d9('0x70')](_0x3dfed7[_0xe0d9('0x71')](),_0x307a1d)['then'](function(_0x4d0339){_0x3f2689=_[_0xe0d9('0x72')](_0x4d0339,'id');_0x307a1d=_[_0xe0d9('0x73')](_0x307a1d,{'model':db[_0x16f96a],'mapToModel':!![],'nest':!![]});if(_0x4907a8['fields']){_0x4a6c33[_0xe0d9('0x74')][_0xe0d9('0x55')](function(_0x4c74ec){_0x3202fd['field']('i.'+_0x4c74ec);});}else{_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x75'),_0xe0d9('0x76'));_0x3202fd[_0xe0d9('0xa')]('a.key',_0xe0d9('0x77'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x78'),'Account.mandatoryDisposition');if(_0x375669==='mail'){_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x79'),_0xe0d9('0x7a'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x7b'),_0xe0d9('0x7c'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x7d'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x7e'));_0x3202fd['field'](_0xe0d9('0x7f'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x80'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x81'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x82'));_0x3202fd['field'](_0xe0d9('0x83'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x84'));_0x3202fd['field']('i.subject');_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x67'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x66'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x65'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x69'));_0x3202fd['field']('i.to');_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x85'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x86'));_0x3202fd['field']('i.UserId');}else if(_0x375669===_0xe0d9('0x87')){_0x3202fd['field']('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',_0xe0d9('0x7c'));}else{_0x3202fd['field'](_0xe0d9('0x88'),_0xe0d9('0x7c'));}if(_0x375669!==_0xe0d9('0x34')){_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x89'));}_0x3202fd['field']('c.firstName',_0xe0d9('0x8a'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x8b'),_0xe0d9('0x8c'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x8d'),_0xe0d9('0x8e'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x8f'),_0xe0d9('0x90'));_0x3202fd[_0xe0d9('0xa')]('c.mobile',_0xe0d9('0x91'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x92'),_0xe0d9('0x93'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x94'),_0xe0d9('0x95'));_0x3202fd['field'](_0xe0d9('0x96'),_0xe0d9('0x97'));_0x3202fd[_0xe0d9('0xa')](_0xe0d9('0x98'),_0xe0d9('0x99'));}if(_0x4a6c33['limit']){_0x3202fd[_0xe0d9('0x9a')](_0x4a6c33['limit']);}if(_0x4a6c33['offset']){_0x3202fd[_0xe0d9('0x9b')](_0x4a6c33[_0xe0d9('0x9b')]);}return db['sequelize']['query'](_0x3202fd['toString'](),_0x307a1d);})[_0xe0d9('0x5d')](function(_0x10d291){_0xffbdaa=_0x10d291;var _0x3b4893=getUsersQuery(_0x375669,_0xffbdaa);return db[_0xe0d9('0x9c')][_0xe0d9('0x70')](_0x3b4893[_0xe0d9('0x71')](),_0x307a1d);})[_0xe0d9('0x5d')](function(_0x1dc25c){_0x43ab09=_[_0xe0d9('0x9d')](_0x1dc25c,_0x45dd44);if(_0x375669===_0xe0d9('0x34')){return db[_0xe0d9('0x9e')][_0xe0d9('0x9f')]({'attributes':[_0xe0d9('0xa0')],'raw':!![]});}})[_0xe0d9('0x5d')](function(_0x8f3b9d){var _0x4e8fd2=_0x8f3b9d?_0x8f3b9d[_0xe0d9('0xa0')]:undefined;var _0x4627df=_0xffbdaa[_0xe0d9('0x18')](function(_0xba7810){return updateInteraction(_0xba7810,_0x3f2689,_0x43ab09,_0x4e8fd2);});return Promise[_0xe0d9('0xa1')](_0x4627df);});}function countFilteredInteractions(_0x1bbd81,_0x5ad35d){var _0x31f13a=_0x1bbd81['clone']();_0x31f13a[_0xe0d9('0xa')]('COUNT(*)');_0x31f13a[_0xe0d9('0xa')](_0xe0d9('0x75'),_0xe0d9('0x76'));var _0xc0ed2f=utils[_0xe0d9('0x25')](_0x5ad35d);if(!_[_0xe0d9('0xa2')](_0xc0ed2f)){_0x31f13a[_0xe0d9('0x16')](_0xe0d9('0xa3'),_0xc0ed2f);}var _0x52b075={'type':db[_0xe0d9('0x6e')][_0xe0d9('0x6f')][_0xe0d9('0xa4')],'raw':!![]};return db[_0xe0d9('0x9c')][_0xe0d9('0x70')](_0x31f13a[_0xe0d9('0x71')](),_0x52b075);}module[_0xe0d9('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xfccc=['squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','color','from','getInteractionFK','u.id','u.fullname','ui.','left_join','length','where','\x20IN\x20?','map','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','buildExpression','default','text','value','start','end','read','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','clause','and','ids','User','user','name','UserId','type','body','plainBody','keys','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','filter','chat','Websites','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','i.id','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','Setting','findOne','enableEmailPreview','all','clone','t.id\x20IN\x20?','lodash'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xfccc,0x147));var _0xcfcc=function(_0x3b195d,_0xdda83){_0x3b195d=_0x3b195d-0x0;var _0xe46db=_0xfccc[_0x3b195d];return _0xe46db;};'use strict';var _=require(_0xcfcc('0x0'));var squel=require(_0xcfcc('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xcfcc('0x2'));var updateInteraction=require(_0xcfcc('0x3'))[_0xcfcc('0x4')];var utils=require(_0xcfcc('0x5'));var db=require(_0xcfcc('0x6'))['db'];function skipInteractionsQuery(_0x25ab89,_0x496211,_0x1e710f){var _0x32c927=![];var _0x2f858f=utils[_0xcfcc('0x7')](_0x25ab89);if(_0x496211[_0xcfcc('0x8')]===_0xcfcc('0x9')&&!_0x1e710f[_0xcfcc('0xa')]&&!_0x1e710f[_0x2f858f]){_0x32c927=!![];}return _0x32c927;}function getTagsQuery(){return squel[_0xcfcc('0xb')]()[_0xcfcc('0xc')]('id')['field']('name')['field'](_0xcfcc('0xd'))[_0xcfcc('0xe')]('tools_tags');}function getUsersQuery(_0x5ac595,_0x4281f6){var _0x2b2ccb=utils[_0xcfcc('0xf')](_0x5ac595);var _0x26ad49='user_has_'+_0x5ac595+'_interactions';var _0x4e4eb8=squel[_0xcfcc('0xb')]()['field'](_0xcfcc('0x10'))[_0xcfcc('0xc')](_0xcfcc('0x11'))[_0xcfcc('0xc')](_0xcfcc('0x12')+_0x2b2ccb)[_0xcfcc('0xe')](_0x26ad49,'ui')[_0xcfcc('0x13')]('users','u','u.id\x20=\x20ui.UserId');if(_0x4281f6[_0xcfcc('0x14')]>0x0){_0x4e4eb8[_0xcfcc('0x15')](_0xcfcc('0x12')+_0x2b2ccb+_0xcfcc('0x16'),_[_0xcfcc('0x17')](_0x4281f6,'id'));}return _0x4e4eb8;}function getInteractionsQuery(_0x1a3719){var _0x4917c9=utils[_0xcfcc('0x18')](_0x1a3719);var _0x2806e1=utils[_0xcfcc('0x7')](_0x1a3719);var _0x18df75=utils[_0xcfcc('0xf')](_0x1a3719);return squel[_0xcfcc('0xb')]()[_0xcfcc('0xe')](_0x4917c9['interactions'],'i')[_0xcfcc('0x13')](_0xcfcc('0x19'),'c',_0xcfcc('0x1a'))[_0xcfcc('0x13')](_0xcfcc('0x1b'),'o',_0xcfcc('0x1c'))['left_join'](_0x4917c9[_0xcfcc('0x1d')],'a',_0xcfcc('0x1e')+_0x2806e1)[_0xcfcc('0x13')](_0x4917c9[_0xcfcc('0x1f')],'me',_0xcfcc('0x20')+_0x18df75+_0xcfcc('0x21'))[_0xcfcc('0x13')](_0x4917c9[_0xcfcc('0x22')],'it',_0xcfcc('0x23')+_0x18df75+_0xcfcc('0x21'))[_0xcfcc('0x13')](_0xcfcc('0x24'),'t',_0xcfcc('0x25'));}function getSqlClauses(){var _0x3b4093={'body':squel[_0xcfcc('0x26')](),'contact':squel[_0xcfcc('0x26')](),'default':squel[_0xcfcc('0x26')](),'fields':squel[_0xcfcc('0x26')](),'filter':squel[_0xcfcc('0x26')](),'read':squel[_0xcfcc('0x26')](),'tags':{'clause':squel[_0xcfcc('0x26')](),'ids':null},'user':squel[_0xcfcc('0x26')]()};return _0x3b4093;}function parseTagParameter(_0x407a85){var _0x2bbc94=squel['expr']();if(_0x407a85){var _0x546838=utils[_0xcfcc('0x27')](_0x407a85);_0x546838[_0xcfcc('0x28')](function(_0xb5f1cc){_0x2bbc94['or'](_0xcfcc('0x29'),'%,'+_0xb5f1cc+',%');});}return _0x2bbc94;}function parseReadParameter(_0x373fe0){var _0x294706='';if(_0x373fe0){_0x294706=_0xcfcc('0x2a');if(_0x373fe0==='1'){_0x294706=_0x294706[_0xcfcc('0x2b')](_0xcfcc('0x2c'),'=');}else{_0x294706=_0x294706['replace'](_0xcfcc('0x2c'),'>');}}return _0x294706;}function parseSearchFilter(_0x5d4054,_0x243f05){var _0x17e3b4=squel[_0xcfcc('0x26')]();if(_0x243f05){var _0x506d50=_0x243f05[_0xcfcc('0x2b')]('\x5c','\x5c\x5c')[_0xcfcc('0x2b')](/'/g,'\x27\x27');if(qs[_0xcfcc('0x2d')](_0x506d50)){_0x17e3b4['or'](_0xcfcc('0x2e'),_0x506d50+'%');if([_0xcfcc('0x2f'),_0xcfcc('0x30')]['includes'](_0x5d4054)){_0x17e3b4['or'](_0xcfcc('0x31'),_0x506d50+'%');}else if(_0x5d4054===_0xcfcc('0x32')){_0x17e3b4['or'](_0xcfcc('0x33'),_0x506d50+'%');}else if(_0x5d4054==='openchannel'){_0x17e3b4['or']('i.from\x20LIKE\x20?',_0x506d50+'%');}}else if(_0x5d4054===_0xcfcc('0x34')&&qs[_0xcfcc('0x35')](_0x506d50)){_0x17e3b4['or'](_0xcfcc('0x36'),_0x506d50+'%');}else{if(_0x5d4054==='mail'){_0x17e3b4['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcfcc('0x37')](_0x506d50,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcfcc('0x37')](_0x506d50));}else if(_0x5d4054!=='fax'){_0x17e3b4['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcfcc('0x37')](_0x506d50));}_0x17e3b4['or'](_0xcfcc('0x38'),qs['getFullTextValue'](_0x506d50,!![]),null);}}return _0x17e3b4;}function parseAdvancedSearchFilter(_0x43568d,_0x4d4e49){var _0x47967e=getSqlClauses();var _0x40c2ff=as['parseSearch'](_0x43568d);var _0x6eb481=_0x40c2ff[_0xcfcc('0x39')];for(var _0x10ead6=0x0;_0x10ead6<_0x40c2ff[_0xcfcc('0x3a')][_0xcfcc('0x14')];_0x10ead6++){var _0xb8698e=_0x40c2ff[_0xcfcc('0x3a')][_0x10ead6];var _0x6ac756='i';var _0xcba1cc=_[_0xcfcc('0x3b')](_0x4d4e49,['name',_0xb8698e['field']]);if(_0xcba1cc){var _0x203c6c=as[_0xcfcc('0x3c')](_0x6ac756,_0xcba1cc['type'],_0xb8698e);_0x47967e[_0xcfcc('0x3d')][_0x6eb481](_0x203c6c[_0xcfcc('0x3e')],_0x203c6c[_0xcfcc('0x3f')][_0xcfcc('0x40')],_0x203c6c[_0xcfcc('0x3f')][_0xcfcc('0x41')]);}else{switch(_0xb8698e[_0xcfcc('0xc')]){case'unreadMessages':var _0x10d7c8=parseReadParameter(_0xb8698e['value']);_0x47967e[_0xcfcc('0x42')]['and'](_0x10d7c8);break;case _0xcfcc('0x43'):if(_0xb8698e[_0xcfcc('0x44')]===_0xcfcc('0x45')){if(_0xb8698e[_0xcfcc('0x3f')][_0xcfcc('0x46')]('\x20')[_0xcfcc('0x14')]>0x1){_0x47967e['contact'][_0x6eb481](_0xcfcc('0x38'),qs[_0xcfcc('0x37')](_0xb8698e['value'],!![]),null);}else{var _0x4bed04='%'+_0xb8698e['value']+'%';_0x47967e[_0xcfcc('0x47')][_0x6eb481](_0xcfcc('0x48'),_0x4bed04,_0x4bed04,_0x4bed04);}}else{_0xcba1cc=_[_0xcfcc('0x3b')](_0x4d4e49,['name',_0xcfcc('0x49')]);_0xb8698e[_0xcfcc('0xc')]=_0xcfcc('0x49');_0x203c6c=as['buildExpression'](_0x6ac756,_0xcba1cc['type'],_0xb8698e);_0x47967e[_0xcfcc('0x47')][_0x6eb481](_0x203c6c['text'],_0x203c6c[_0xcfcc('0x3f')][_0xcfcc('0x40')],_0x203c6c[_0xcfcc('0x3f')][_0xcfcc('0x41')]);}break;case _0xcfcc('0x4a'):var _0x1ea7d5=_0xb8698e[_0xcfcc('0x3f')][_0xcfcc('0x46')](',')[_0xcfcc('0x17')](function(_0x99a878){return Number(_0x99a878);});var _0x54be86=parseTagParameter(_0x1ea7d5);_0x47967e[_0xcfcc('0x4b')][_0xcfcc('0x4c')][_0xcfcc('0x4d')](_0x54be86);_0x47967e['tags'][_0xcfcc('0x4e')]=_0x1ea7d5;break;case _0xcfcc('0x4f'):if(_0xb8698e[_0xcfcc('0x44')]==='$substring'){_0x47967e[_0xcfcc('0x50')][_0x6eb481]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xb8698e['value']+'%',null);}else{_0xcba1cc=_['find'](_0x4d4e49,[_0xcfcc('0x51'),_0xcfcc('0x52')]);_0xb8698e[_0xcfcc('0xc')]='UserId';_0x203c6c=as[_0xcfcc('0x3c')](_0x6ac756,_0xcba1cc[_0xcfcc('0x53')],_0xb8698e);_0x47967e[_0xcfcc('0x50')][_0x6eb481](_0x203c6c[_0xcfcc('0x3e')],_0x203c6c[_0xcfcc('0x3f')][_0xcfcc('0x40')],_0x203c6c['value'][_0xcfcc('0x41')]);}break;case _0xcfcc('0x54'):case _0xcfcc('0x55'):_0x203c6c=as[_0xcfcc('0x3c')]('me',null,_0xb8698e);_0x47967e[_0xcfcc('0x54')][_0x6eb481](_0x203c6c[_0xcfcc('0x3e')],_0x203c6c[_0xcfcc('0x3f')][_0xcfcc('0x40')],_0x203c6c['value'][_0xcfcc('0x41')]);break;}}}return _0x47967e;}function parseModelFields(_0x2c7b7a,_0x36575c,_0x1834e2){var _0x693b3b=utils[_0xcfcc('0x7')](_0x2c7b7a);var _0x2a354d=squel[_0xcfcc('0x26')]();var _0x3ea735=_(_0x36575c)[_0xcfcc('0x56')]()['map'](function(_0x4bcd42){return _['some'](_0x1834e2,[_0xcfcc('0x51'),_0x4bcd42])?_0x4bcd42:undefined;})['compact']()[_0xcfcc('0x3f')]();if(_0x3ea735[_0xcfcc('0x14')]>0x0){_0x3ea735[_0xcfcc('0x28')](function(_0x2618da){if(_0x2618da===_0x693b3b){_0x2a354d[_0xcfcc('0x4d')]('i.'+_0x693b3b+_0xcfcc('0x16'),[][_0xcfcc('0x57')](_0x36575c[_0x2618da]));}else if(_0x2618da===_0xcfcc('0x58')){var _0x5b6dd1=JSON[_0xcfcc('0x59')](_0x36575c[_0x2618da])[_0xcfcc('0x5a')];var _0x527789=JSON[_0xcfcc('0x59')](_0x36575c[_0x2618da])[_0xcfcc('0x5b')];_0x2a354d[_0xcfcc('0x4d')](_0xcfcc('0x5c'),_0x5b6dd1,_0x527789);}else{if(_0x36575c[_0x2618da]===_0xcfcc('0x5d')){_0x2a354d[_0xcfcc('0x4d')]('i.'+_0x2618da+'\x20IS\x20NULL');}else{_0x2a354d[_0xcfcc('0x4d')]('i.'+_0x2618da+_0xcfcc('0x5e'),_0x36575c[_0x2618da]);}}});}return _0x2a354d;}function parseQueryParameters(_0x51d556,_0x1be297,_0x97d4f3){var _0x2ad9de=getSqlClauses();return Promise[_0xcfcc('0x5f')]()[_0xcfcc('0x60')](function(){return parseModelFields(_0x51d556,_0x1be297,_0x97d4f3);})[_0xcfcc('0x60')](function(_0x7bd922){_0x2ad9de[_0xcfcc('0x61')][_0xcfcc('0x4d')](_0x7bd922);return parseReadParameter(_0x1be297[_0xcfcc('0x42')]);})['then'](function(_0x2d5b5a){_0x2ad9de['read']['and'](_0x2d5b5a);return parseTagParameter(_0x1be297['tag']);})['then'](function(_0x473f0f){_0x2ad9de[_0xcfcc('0x4b')][_0xcfcc('0x4c')][_0xcfcc('0x4d')](_0x473f0f);return parseSearchFilter(_0x51d556,_0x1be297[_0xcfcc('0x62')]);})[_0xcfcc('0x60')](function(_0x310862){_0x2ad9de['filter']=_0x310862;return _0x2ad9de;});}function checkAccountsRestrictions(_0x509ca6,_0x204568,_0x2114e9){var _0x114d3c=utils['getAccountFK'](_0x509ca6);var _0x2457f2='get'+_['capitalize'](_0x509ca6)+(_0x509ca6===_0xcfcc('0x63')?_0xcfcc('0x64'):'Accounts');var _0x5f30d3=squel[_0xcfcc('0x26')]();return Promise[_0xcfcc('0x5f')]()[_0xcfcc('0x60')](function(){if(_0x2114e9[_0xcfcc('0xa')]&&_0x204568[_0xcfcc('0x8')]==='agent'){return _0x204568[_0x2457f2]({'attributes':['id'],'raw':!![]});}})[_0xcfcc('0x60')](function(_0x5bc12b){if(_0x5bc12b){if(_0x5bc12b[_0xcfcc('0x14')]===0x0){_0x5f30d3['and']('i.'+_0x114d3c+_0xcfcc('0x65'));}else{_0x5f30d3[_0xcfcc('0x4d')]('i.'+_0x114d3c+_0xcfcc('0x16'),_[_0xcfcc('0x17')](_0x5bc12b,'id'));}}else if(!_0x2114e9[_0x114d3c]){_0x5f30d3[_0xcfcc('0x4d')]('i.'+_0x114d3c+_0xcfcc('0x66'));}})['then'](function(){return _0x5f30d3;});}function getClosedOrderClause(_0x49b6ad,_0x53d0f5){var _0x57c7ee='';var _0x39dc8f=['i.thirdDisposition',_0xcfcc('0x67'),_0xcfcc('0x68')];if(_0x49b6ad===_0xcfcc('0x34')){_0x39dc8f[_0xcfcc('0x69')](_0xcfcc('0x6a'));}if(_0x53d0f5['closed']==='0'&&_0x49b6ad===_0xcfcc('0x34')){_0x57c7ee=_0xcfcc('0x6a');}else{if(_0x53d0f5['closed']==='1'){_0x39dc8f[_0xcfcc('0x6b')]();}_0x57c7ee=_0xcfcc('0x6c')+_0x39dc8f['join'](',\x20')+')';}return _0x57c7ee;}function getFilteredInteractions(_0x1f26c6,_0x1fed96,_0x5b7edd,_0x4b6b2f){var _0x163948=utils[_0xcfcc('0xf')](_0x1f26c6);var _0x32f656=_['capitalize'](_0x1f26c6)+_0xcfcc('0x6d');var _0x44228d=[];var _0x3e2178=getTagsQuery();var _0x400807={'type':db[_0xcfcc('0x6e')][_0xcfcc('0x6f')][_0xcfcc('0x70')],'raw':!![]};var _0x2887db=[];var _0x3b98cd=[];return db['sequelize'][_0xcfcc('0x71')](_0x3e2178[_0xcfcc('0x72')](),_0x400807)[_0xcfcc('0x60')](function(_0xc4a724){_0x44228d=_[_0xcfcc('0x73')](_0xc4a724,'id');_0x400807=_[_0xcfcc('0x74')](_0x400807,{'model':db[_0x32f656],'mapToModel':!![],'nest':!![]});if(_0x5b7edd['fields']){_0x4b6b2f[_0xcfcc('0x75')][_0xcfcc('0x28')](function(_0x2df082){_0x1fed96['field']('i.'+_0x2df082);});}else{_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x76'),_0xcfcc('0x77'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x78'),_0xcfcc('0x79'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x7a'),_0xcfcc('0x7b'));if(_0x1f26c6===_0xcfcc('0x34')){_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x7c'),'Account.email');_0x1fed96['field']('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');_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x7d'));_0x1fed96['field']('i.createdAt');_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x7e'));_0x1fed96['field'](_0xcfcc('0x7f'));_0x1fed96['field']('i.closedAt');_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x80'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x81'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x82'));_0x1fed96[_0xcfcc('0xc')]('i.subject');_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x68'));_0x1fed96['field'](_0xcfcc('0x67'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x83'));_0x1fed96[_0xcfcc('0xc')]('i.substatus');_0x1fed96['field'](_0xcfcc('0x84'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x85'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x86'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x87'));}else if(_0x1f26c6==='openchannel'){_0x1fed96[_0xcfcc('0xc')]('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',_0xcfcc('0x88'));}else{_0x1fed96['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xcfcc('0x88'));}if(_0x1f26c6!==_0xcfcc('0x34')){_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x89'));}_0x1fed96['field'](_0xcfcc('0x8a'),_0xcfcc('0x8b'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x8c'),_0xcfcc('0x8d'));_0x1fed96[_0xcfcc('0xc')]('c.email',_0xcfcc('0x8e'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x8f'),_0xcfcc('0x90'));_0x1fed96['field'](_0xcfcc('0x91'),_0xcfcc('0x92'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x93'),_0xcfcc('0x94'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x95'),_0xcfcc('0x96'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x97'),_0xcfcc('0x98'));_0x1fed96[_0xcfcc('0xc')](_0xcfcc('0x99'),_0xcfcc('0x9a'));}if(_0x4b6b2f['limit']){_0x1fed96[_0xcfcc('0x9b')](_0x4b6b2f[_0xcfcc('0x9b')]);}if(_0x4b6b2f[_0xcfcc('0x9c')]){_0x1fed96[_0xcfcc('0x9c')](_0x4b6b2f[_0xcfcc('0x9c')]);}return db[_0xcfcc('0x9d')][_0xcfcc('0x71')](_0x1fed96[_0xcfcc('0x72')](),_0x400807);})[_0xcfcc('0x60')](function(_0x16effa){_0x2887db=_0x16effa;var _0x159507=getUsersQuery(_0x1f26c6,_0x2887db);return db['sequelize']['query'](_0x159507[_0xcfcc('0x72')](),_0x400807);})['then'](function(_0x597833){_0x3b98cd=_['groupBy'](_0x597833,_0x163948);if(_0x1f26c6===_0xcfcc('0x34')){return db[_0xcfcc('0x9e')][_0xcfcc('0x9f')]({'attributes':[_0xcfcc('0xa0')],'raw':!![]});}})[_0xcfcc('0x60')](function(_0x53e6b3){var _0x18457b=_0x53e6b3?_0x53e6b3[_0xcfcc('0xa0')]:undefined;var _0xd8ef84=_0x2887db[_0xcfcc('0x17')](function(_0x450e9b){return updateInteraction(_0x450e9b,_0x44228d,_0x3b98cd,_0x18457b);});return Promise[_0xcfcc('0xa1')](_0xd8ef84);});}function countFilteredInteractions(_0x391c13,_0x41c518){var _0x21c62a=_0x391c13[_0xcfcc('0xa2')]();_0x21c62a[_0xcfcc('0xc')]('COUNT(*)');_0x21c62a[_0xcfcc('0xc')](_0xcfcc('0x76'),_0xcfcc('0x77'));var _0xb30246=utils[_0xcfcc('0x27')](_0x41c518);if(!_['isEmpty'](_0xb30246)){_0x21c62a[_0xcfcc('0x15')](_0xcfcc('0xa3'),_0xb30246);}var _0x478e4c={'type':db[_0xcfcc('0x6e')][_0xcfcc('0x6f')]['SELECT'],'raw':!![]};return db[_0xcfcc('0x9d')][_0xcfcc('0x71')](_0x21c62a['toString'](),_0x478e4c);}module['exports']={'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 4b55f38..ffaed91 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 _0xa93d=['catch','updateInteraction','Users','Tags','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','answered','unmanaged','abandoned','total','disposition','UserId','talking','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart'];(function(_0x2a87ed,_0x748986){var _0xc951c2=function(_0x238a31){while(--_0x238a31){_0x2a87ed['push'](_0x2a87ed['shift']());}};_0xc951c2(++_0x748986);}(_0xa93d,0x108));var _0xda93=function(_0x46b829,_0x2acbc8){_0x46b829=_0x46b829-0x0;var _0x480809=_0xa93d[_0x46b829];return _0x480809;};'use strict';var _=require(_0xda93('0x0'));var db=require(_0xda93('0x1'))['db'];function getInteractionUsers(_0x32372e,_0x43ad6d){return new Promise(function(_0x30faee,_0x5a6df3){try{var _0x5ca9ed=[];if(_0x43ad6d[_0x32372e]){_0x5ca9ed=_0x43ad6d[_0x32372e][_0xda93('0x2')](function(_0x4b2b0c){return{'id':_0x4b2b0c['id'],'fullname':_0x4b2b0c[_0xda93('0x3')]};});}return _0x30faee(_0x5ca9ed);}catch(_0x5775df){_0x5a6df3(_0x5775df);}});}function getInteractionTags(_0x1929a2,_0x9f2a95){var _0x551bd6=[];if(_0x1929a2){_0x1929a2[_0xda93('0x4')](',')[_0xda93('0x5')](function(_0x2108de){_0x551bd6[_0xda93('0x6')](_0x9f2a95[_0x2108de]);});}return _0x551bd6;}function updateWaitingCounter(_0x3ab8ab){if(_0x3ab8ab[_0xda93('0x7')]){_0x3ab8ab[_0xda93('0x7')]-=0x1;}}function updateInteractionCounters(_0x337873){_0x337873['waiting']=0x0;_0x337873['talking']=0x0;_0x337873[_0xda93('0x8')]=0x0;_0x337873[_0xda93('0x9')]=0x0;_0x337873[_0xda93('0xa')]=0x0;_0x337873[_0xda93('0xb')]=0x0;if(_0x337873['closed']){if(_0x337873[_0xda93('0xc')]==='abandoned'){_0x337873[_0xda93('0xa')]+=0x1;updateWaitingCounter(_0x337873);}if(_0x337873[_0xda93('0xd')]){_0x337873['answered']+=0x1;if(_0x337873[_0xda93('0xe')]){_0x337873[_0xda93('0xe')]-=0x1;}}else{if(_0x337873['disposition']){_0x337873['unmanaged']+=0x1;updateWaitingCounter(_0x337873);}}}else{if(!_0x337873[_0xda93('0xd')]){_0x337873['waiting']+=0x1;}if(_0x337873[_0xda93('0xd')]){_0x337873['talking']+=0x1;updateWaitingCounter(_0x337873);}}_0x337873[_0xda93('0xb')]+=0x1;return _0x337873;}function getLastMessageText(_0x1fac7e){return db[_0xda93('0xf')][_0xda93('0x10')]({'where':{'$and':[{'MailInteractionId':_0x1fac7e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xda93('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xda93('0x12')],'order':'-id','raw':!![]})[_0xda93('0x13')](function(_0x4976d6){if(_0x4976d6&&_0x4976d6[_0xda93('0x12')]){_0x1fac7e[_0xda93('0x14')]=_[_0xda93('0x15')](_0x4976d6[_0xda93('0x12')]);}return _0x1fac7e;})[_0xda93('0x16')](function(_0x3b990a){throw _0x3b990a;});}exports[_0xda93('0x17')]=function(_0x1f4b38,_0x490b9b,_0x1b0a47,_0x814324){return new Promise(function(_0xd8da68,_0x5168b8){return getInteractionUsers(_0x1f4b38['id'],_0x1b0a47)[_0xda93('0x13')](function(_0x57ffbb){_0x1f4b38[_0xda93('0x18')]=_0x57ffbb;return getInteractionTags(_0x1f4b38['TagIds'],_0x490b9b);})[_0xda93('0x13')](function(_0x5d6a3e){_0x1f4b38[_0xda93('0x19')]=_0x5d6a3e;delete _0x1f4b38['TagIds'];return updateInteractionCounters(_0x1f4b38);})[_0xda93('0x13')](function(_0x57bd5e){if(_0x814324){return getLastMessageText(_0x57bd5e);}else{return _0x57bd5e;}})[_0xda93('0x13')](function(_0x40f029){_0xd8da68(_0x40f029);})[_0xda93('0x16')](function(_0x54da59){_0x5168b8(_0x54da59);});});}; \ No newline at end of file +var _0x74d9=['findOne','out','plainBody','-id','lastMsgText','trimStart','then','Users','TagIds','Tags','catch','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','talking'];(function(_0x23c052,_0x529c10){var _0x4f9d57=function(_0x2dac0d){while(--_0x2dac0d){_0x23c052['push'](_0x23c052['shift']());}};_0x4f9d57(++_0x529c10);}(_0x74d9,0x1a0));var _0x974d=function(_0x16e3f1,_0x3ae219){_0x16e3f1=_0x16e3f1-0x0;var _0x53a7dc=_0x74d9[_0x16e3f1];return _0x53a7dc;};'use strict';var _=require(_0x974d('0x0'));var db=require(_0x974d('0x1'))['db'];function getInteractionUsers(_0x9f0759,_0x11fce3){return new Promise(function(_0x5491a5,_0xdb0972){try{var _0xdcf096=[];if(_0x11fce3[_0x9f0759]){_0xdcf096=_0x11fce3[_0x9f0759][_0x974d('0x2')](function(_0x3125b1){return{'id':_0x3125b1['id'],'fullname':_0x3125b1[_0x974d('0x3')]};});}return _0x5491a5(_0xdcf096);}catch(_0x112f29){_0xdb0972(_0x112f29);}});}function getInteractionTags(_0x42b3a5,_0x156018){var _0x4208da=[];if(_0x42b3a5){_0x42b3a5[_0x974d('0x4')](',')[_0x974d('0x5')](function(_0x3a3e03){_0x4208da[_0x974d('0x6')](_0x156018[_0x3a3e03]);});}return _0x4208da;}function updateWaitingCounter(_0x268920){if(_0x268920[_0x974d('0x7')]){_0x268920['waiting']-=0x1;}}function updateInteractionCounters(_0x464feb){_0x464feb[_0x974d('0x7')]=0x0;_0x464feb['talking']=0x0;_0x464feb[_0x974d('0x8')]=0x0;_0x464feb[_0x974d('0x9')]=0x0;_0x464feb[_0x974d('0xa')]=0x0;_0x464feb[_0x974d('0xb')]=0x0;if(_0x464feb[_0x974d('0xc')]){if(_0x464feb[_0x974d('0xd')]===_0x974d('0xa')){_0x464feb['abandoned']+=0x1;updateWaitingCounter(_0x464feb);}if(_0x464feb[_0x974d('0xe')]){_0x464feb[_0x974d('0x8')]+=0x1;if(_0x464feb[_0x974d('0xf')]){_0x464feb[_0x974d('0xf')]-=0x1;}}else{if(_0x464feb[_0x974d('0xd')]){_0x464feb[_0x974d('0x9')]+=0x1;updateWaitingCounter(_0x464feb);}}}else{if(!_0x464feb['UserId']){_0x464feb['waiting']+=0x1;}if(_0x464feb['UserId']){_0x464feb[_0x974d('0xf')]+=0x1;updateWaitingCounter(_0x464feb);}}_0x464feb[_0x974d('0xb')]+=0x1;return _0x464feb;}function getLastMessageText(_0x5590d0){return db['MailMessage'][_0x974d('0x10')]({'where':{'$and':[{'MailInteractionId':_0x5590d0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x974d('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x974d('0x12')],'order':_0x974d('0x13'),'raw':!![]})['then'](function(_0x602574){if(_0x602574&&_0x602574['plainBody']){_0x5590d0[_0x974d('0x14')]=_[_0x974d('0x15')](_0x602574[_0x974d('0x12')]);}return _0x5590d0;})['catch'](function(_0x23e46a){throw _0x23e46a;});}exports['updateInteraction']=function(_0x5cf2d5,_0x450b31,_0x1aa2ac,_0x563682){return new Promise(function(_0x4fe0fb,_0x1d756b){return getInteractionUsers(_0x5cf2d5['id'],_0x1aa2ac)[_0x974d('0x16')](function(_0x52bf23){_0x5cf2d5[_0x974d('0x17')]=_0x52bf23;return getInteractionTags(_0x5cf2d5[_0x974d('0x18')],_0x450b31);})['then'](function(_0x489385){_0x5cf2d5[_0x974d('0x19')]=_0x489385;delete _0x5cf2d5[_0x974d('0x18')];return updateInteractionCounters(_0x5cf2d5);})[_0x974d('0x16')](function(_0x35f036){if(_0x563682){return getLastMessageText(_0x35f036);}else{return _0x35f036;}})[_0x974d('0x16')](function(_0x4034fd){_0x4fe0fb(_0x4034fd);})[_0x974d('0x1a')](function(_0x20f7a0){_0x1d756b(_0x20f7a0);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 757946d..44052cf 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 _0x6464=['name','role','stringify','null','Interaction','update','then','catch','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase'];(function(_0x1c4409,_0x3b2e8f){var _0x356d8f=function(_0xae43bf){while(--_0xae43bf){_0x1c4409['push'](_0x1c4409['shift']());}};_0x356d8f(++_0x3b2e8f);}(_0x6464,0x12a));var _0x4646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6464[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require(_0x4646('0x0'))['db'];var loggers={'openchannel':require(_0x4646('0x1'))(_0x4646('0x2')),'mail':require(_0x4646('0x1'))(_0x4646('0x3')),'fax':require(_0x4646('0x1'))(_0x4646('0x4')),'sms':require(_0x4646('0x1'))(_0x4646('0x5')),'chat':require(_0x4646('0x1'))('chat-interactions'),'whatsapp':require(_0x4646('0x1'))(_0x4646('0x6'))};function getAccountFK(_0x5e56c2){return _[_0x4646('0x7')](_0x5e56c2)+(_0x5e56c2===_0x4646('0x8')?_0x4646('0x9'):_0x4646('0xa'))+'Id';}function getInteractionFK(_0x53a1bb){return _['capitalize'](_0x53a1bb)+_0x4646('0xb');}function getInteractionId(_0x12e34e,_0x52538a,_0x54dad7){if(_0x12e34e&&_0x12e34e[_[_0x4646('0xc')](_0x54dad7)+_0x4646('0xb')]){return _0x12e34e[_[_0x4646('0xc')](_0x54dad7)+_0x4646('0xb')];}else if(_0x12e34e&&_0x12e34e['id']){return _0x12e34e['id'];}else if(_0x52538a&&_0x52538a['id']){return _0x52538a['id'];}else{return _0x4646('0xd');}}function getInteractionsTables(_0x106bfe){return{'accounts':_0x106bfe+'_'+(_0x106bfe===_0x4646('0x8')?_0x4646('0xe'):'accounts'),'interactions':_0x106bfe+_0x4646('0xf'),'interactionsTags':_0x106bfe+_0x4646('0x10'),'messages':_0x106bfe+_0x4646('0x11'),'userInteractions':_0x4646('0x12')+_0x106bfe+_0x4646('0xf')};}function getSelectedTags(_0x541ce7){var _0xa4094d=[];if(_0x541ce7){_0xa4094d=Array[_0x4646('0x13')](_0x541ce7)?_0x541ce7:[_0x541ce7];}return _0xa4094d;}function log(_0x60de5,_0x168878,_0xba0af0,_0x2f2360,_0x1303c7,_0x209543){loggers[_0x1303c7['toLowerCase']()][_0x60de5](_0x4646('0x14'),_0x209543[_0x4646('0x15')](),_0x168878?_0x168878['id']:null,_0x168878?_0x168878[_0x4646('0x16')]:null,_0x168878?_0x168878[_0x4646('0x17')]:null,getInteractionId(_0xba0af0,_0x2f2360,_0x1303c7),_0xba0af0?JSON[_0x4646('0x18')](_0xba0af0):_0x4646('0x19'));}function updateUser(_0x45889d,_0x4faf27,_0x5a27a5,_0x1acd9a,_0x3bff53){db[_['upperFirst'](_0x1acd9a)+_0x4646('0x1a')]['findOne']({'where':{'id':getInteractionId(_0x4faf27,_0x5a27a5,_0x1acd9a)}})['then'](function(_0x25f2cb){if(_0x25f2cb){return _0x25f2cb[_0x4646('0x1b')]({'UserId':_0x45889d?_0x45889d['id']:null});}})[_0x4646('0x1c')](function(_0xdf799e){if(_0xdf799e){log('info',_0x45889d,_0x4faf27,_0x5a27a5,_0x1acd9a,_0x3bff53);}})[_0x4646('0x1d')](function(){log(_0x4646('0x1e'),_0x45889d,_0x4faf27,_0x5a27a5,_0x1acd9a,_0x3bff53);});}module[_0x4646('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xd8f0=['../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','findOne','then','info','catch','error','exports','lodash','../../mysqldb','openchannel-interactions'];(function(_0x4090cd,_0x55a2f0){var _0x522fbe=function(_0x2e1c6c){while(--_0x2e1c6c){_0x4090cd['push'](_0x4090cd['shift']());}};_0x522fbe(++_0x55a2f0);}(_0xd8f0,0x13d));var _0x0d8f=function(_0x425b19,_0x2dcf14){_0x425b19=_0x425b19-0x0;var _0x15ecab=_0xd8f0[_0x425b19];return _0x15ecab;};'use strict';var _=require(_0x0d8f('0x0'));var db=require(_0x0d8f('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x0d8f('0x2')),'mail':require(_0x0d8f('0x3'))(_0x0d8f('0x4')),'fax':require(_0x0d8f('0x3'))(_0x0d8f('0x5')),'sms':require(_0x0d8f('0x3'))(_0x0d8f('0x6')),'chat':require(_0x0d8f('0x3'))(_0x0d8f('0x7')),'whatsapp':require(_0x0d8f('0x3'))(_0x0d8f('0x8'))};function getAccountFK(_0x22b97d){return _[_0x0d8f('0x9')](_0x22b97d)+(_0x22b97d===_0x0d8f('0xa')?_0x0d8f('0xb'):_0x0d8f('0xc'))+'Id';}function getInteractionFK(_0x3ef212){return _[_0x0d8f('0x9')](_0x3ef212)+_0x0d8f('0xd');}function getInteractionId(_0x4b9a7e,_0x54e81d,_0x532aa9){if(_0x4b9a7e&&_0x4b9a7e[_[_0x0d8f('0xe')](_0x532aa9)+'InteractionId']){return _0x4b9a7e[_[_0x0d8f('0xe')](_0x532aa9)+_0x0d8f('0xd')];}else if(_0x4b9a7e&&_0x4b9a7e['id']){return _0x4b9a7e['id'];}else if(_0x54e81d&&_0x54e81d['id']){return _0x54e81d['id'];}else{return _0x0d8f('0xf');}}function getInteractionsTables(_0x8e0c6){return{'accounts':_0x8e0c6+'_'+(_0x8e0c6===_0x0d8f('0xa')?_0x0d8f('0x10'):_0x0d8f('0x11')),'interactions':_0x8e0c6+_0x0d8f('0x12'),'interactionsTags':_0x8e0c6+'_interaction_has_tags','messages':_0x8e0c6+_0x0d8f('0x13'),'userInteractions':'user_has_'+_0x8e0c6+'_interactions'};}function getSelectedTags(_0x39d33b){var _0x26659e=[];if(_0x39d33b){_0x26659e=Array['isArray'](_0x39d33b)?_0x39d33b:[_0x39d33b];}return _0x26659e;}function log(_0x356c9a,_0x22c417,_0x1b51e6,_0x40aab9,_0x5aff43,_0xc1efcc){loggers[_0x5aff43[_0x0d8f('0x14')]()][_0x356c9a](_0x0d8f('0x15'),_0xc1efcc[_0x0d8f('0x16')](),_0x22c417?_0x22c417['id']:null,_0x22c417?_0x22c417['name']:null,_0x22c417?_0x22c417['role']:null,getInteractionId(_0x1b51e6,_0x40aab9,_0x5aff43),_0x1b51e6?JSON[_0x0d8f('0x17')](_0x1b51e6):_0x0d8f('0x18'));}function updateUser(_0x2c6b65,_0x29aba8,_0xd62f37,_0xb0699c,_0x32bd84){db[_[_0x0d8f('0xe')](_0xb0699c)+_0x0d8f('0x19')][_0x0d8f('0x1a')]({'where':{'id':getInteractionId(_0x29aba8,_0xd62f37,_0xb0699c)}})[_0x0d8f('0x1b')](function(_0x1e7036){if(_0x1e7036){return _0x1e7036['update']({'UserId':_0x2c6b65?_0x2c6b65['id']:null});}})[_0x0d8f('0x1b')](function(_0x26e5c7){if(_0x26e5c7){log(_0x0d8f('0x1c'),_0x2c6b65,_0x29aba8,_0xd62f37,_0xb0699c,_0x32bd84);}})[_0x0d8f('0x1d')](function(){log(_0x0d8f('0x1e'),_0x2c6b65,_0x29aba8,_0xd62f37,_0xb0699c,_0x32bd84);});}module[_0x0d8f('0x1f')]={'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 dfd36c0..c5aa946 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 _0x7a9d=['composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','findOne','then','count','status','json','users','User','admin','user','isUserLimit','crypto'];(function(_0x1d1c7a,_0x2bd1e0){var _0x7bfb9=function(_0xa0c993){while(--_0xa0c993){_0x1d1c7a['push'](_0x1d1c7a['shift']());}};_0x7bfb9(++_0x2bd1e0);}(_0x7a9d,0xf9));var _0xd7a9=function(_0x544af6,_0x429d27){_0x544af6=_0x544af6-0x0;var _0x1e63a5=_0x7a9d[_0x544af6];return _0x1e63a5;};'use strict';var crypto=require(_0xd7a9('0x0'));var util=require('util');var compose=require(_0xd7a9('0x1'));var db=require(_0xd7a9('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4492ce,_0x4e1d5d){if(_0x4492ce&&_0x4e1d5d){if(_0x4e1d5d[_0xd7a9('0x3')]&&_0x4e1d5d['license']){var _0x3d0177=_0x4e1d5d[_0xd7a9('0x3')];var _0x2a9a7a=_0x4e1d5d[_0xd7a9('0x4')];var _0x403f7d=_0x3d0177[_0xd7a9('0x5')]('-')[0x4];var _0x2a5ebd=_0x3d0177[_0xd7a9('0x5')]('-')[0x0];var _0x1cd0c4=crypto[_0xd7a9('0x6')](_0xd7a9('0x7'),util[_0xd7a9('0x8')](_0xd7a9('0x9'),_0x403f7d,_0x3d0177,_0x2a5ebd));var _0x36816a=_0x1cd0c4[_0xd7a9('0xa')](_0x2a9a7a,'base64',_0xd7a9('0xb'));_0x36816a+=_0x1cd0c4[_0xd7a9('0xc')](_0xd7a9('0xb'));var _0x432c7b=JSON[_0xd7a9('0xd')](_0x36816a);return _0x432c7b[_0xd7a9('0xe')](_0x4492ce)?_0x432c7b[_0x4492ce]:null;}}return null;}function isLimit(_0x17e1a2,_0x197e67,_0x456979,_0x3f5de8){var _0x3ef915=_0x197e67;return compose()['use'](function(_0x48f3a8,_0xcf0ead,_0xdce765){return db['License'][_0xd7a9('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xd7a9('0x10')](function(_0xc85122){var _0x17b8bf=getValueFromLicense(_0x17e1a2,_0xc85122);return _0x17b8bf?_0x17b8bf:_0x3ef915;})['then'](function(_0x583735){_0x3ef915=_0x583735;return _0x456979[_0xd7a9('0x11')](_0x3f5de8);})[_0xd7a9('0x10')](function(_0x6041a6){if(_0x6041a6>=_0x3ef915){return _0xcf0ead[_0xd7a9('0x12')](0x193)[_0xd7a9('0x13')]({'message':util[_0xd7a9('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x17e1a2)});}_0xdce765();})['catch'](function(_0x457c44){_0xdce765(_0x457c44);});});}function isUserLimit(){return isLimit(_0xd7a9('0x14'),0x1,db[_0xd7a9('0x15')],{'where':{'$or':[{'role':_0xd7a9('0x16')},{'role':_0xd7a9('0x17')}]}});}exports[_0xd7a9('0x18')]=isUserLimit; \ No newline at end of file +var _0xd9ad=['composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util'];(function(_0x1d17ff,_0x1feae4){var _0x1fc85c=function(_0x90bab0){while(--_0x90bab0){_0x1d17ff['push'](_0x1d17ff['shift']());}};_0x1fc85c(++_0x1feae4);}(_0xd9ad,0x132));var _0xdd9a=function(_0x248f6b,_0x401324){_0x248f6b=_0x248f6b-0x0;var _0x54b829=_0xd9ad[_0x248f6b];return _0x54b829;};'use strict';var crypto=require(_0xdd9a('0x0'));var util=require(_0xdd9a('0x1'));var compose=require(_0xdd9a('0x2'));var db=require(_0xdd9a('0x3'))['db'];var config=require(_0xdd9a('0x4'));function getValueFromLicense(_0x5e3bf3,_0x37770c){if(_0x5e3bf3&&_0x37770c){if(_0x37770c[_0xdd9a('0x5')]&&_0x37770c[_0xdd9a('0x6')]){var _0x1929bb=_0x37770c[_0xdd9a('0x5')];var _0x49aef9=_0x37770c[_0xdd9a('0x6')];var _0x5c2a57=_0x1929bb[_0xdd9a('0x7')]('-')[0x4];var _0x176008=_0x1929bb[_0xdd9a('0x7')]('-')[0x0];var _0x5e4a20=crypto[_0xdd9a('0x8')](_0xdd9a('0x9'),util[_0xdd9a('0xa')](_0xdd9a('0xb'),_0x5c2a57,_0x1929bb,_0x176008));var _0x4e2e62=_0x5e4a20[_0xdd9a('0xc')](_0x49aef9,_0xdd9a('0xd'),_0xdd9a('0xe'));_0x4e2e62+=_0x5e4a20[_0xdd9a('0xf')](_0xdd9a('0xe'));var _0x34cfe3=JSON['parse'](_0x4e2e62);return _0x34cfe3[_0xdd9a('0x10')](_0x5e3bf3)?_0x34cfe3[_0x5e3bf3]:null;}}return null;}function isLimit(_0x46d90d,_0x122fca,_0x456ad1,_0x11261e){var _0x4edc07=_0x122fca;return compose()[_0xdd9a('0x11')](function(_0x16b48b,_0x3e0952,_0x2fdcc9){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xdd9a('0x12')](function(_0x3447f8){var _0x2d3544=getValueFromLicense(_0x46d90d,_0x3447f8);return _0x2d3544?_0x2d3544:_0x4edc07;})[_0xdd9a('0x12')](function(_0x58219e){_0x4edc07=_0x58219e;return _0x456ad1[_0xdd9a('0x13')](_0x11261e);})[_0xdd9a('0x12')](function(_0x41fc68){if(_0x41fc68>=_0x4edc07){return _0x3e0952[_0xdd9a('0x14')](0x193)[_0xdd9a('0x15')]({'message':util[_0xdd9a('0xa')](_0xdd9a('0x16'),_0x46d90d)});}_0x2fdcc9();})['catch'](function(_0x3ec42d){_0x2fdcc9(_0x3ec42d);});});}function isUserLimit(){return isLimit(_0xdd9a('0x17'),0x1,db[_0xdd9a('0x18')],{'where':{'$or':[{'role':_0xdd9a('0x19')},{'role':_0xdd9a('0x1a')}]}});}exports[_0xdd9a('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index daa893e..895e8ce 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 _0xc373=['includes','$lte','add','days','castTo','text','CAST(','field','\x20AS\x20','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','$in','start','$startsWith','pop','DATE','utcOffset','format','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','length','slice','forEach','split','shift','match','filter','indexOf','map','conditions','buildExpression','operator','$eq','$between','value'];(function(_0x3c1277,_0x65e543){var _0x46f7f5=function(_0x14b4b4){while(--_0x14b4b4){_0x3c1277['push'](_0x3c1277['shift']());}};_0x46f7f5(++_0x65e543);}(_0xc373,0xd5));var _0x3c37=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0xc373[_0x209ec9];return _0x129b1b;};'use strict';var _=require(_0x3c37('0x0'));var moment=require(_0x3c37('0x1'));exports[_0x3c37('0x2')]=function(_0x237daa){var _0x45790c={'conditions':[]};_0x45790c[_0x3c37('0x3')]=_[_0x3c37('0x4')](_0x237daa,_0x3c37('0x5'))?'or':_0x3c37('0x6');var _0x8c6dbf=_0x237daa[_0x3c37('0x7')]('[$and]','')[_0x3c37('0x7')](_0x3c37('0x5'),'')['split']('||');for(var _0x1018ae=0x0;_0x1018ae<_0x8c6dbf[_0x3c37('0x8')];_0x1018ae++){var _0x5dca8b=_0x8c6dbf[_0x1018ae]['split'](':=');var _0x477637=_0x5dca8b[0x0];var _0x3a5765=_0x5dca8b[_0x3c37('0x9')](0x1);_0x3a5765[_0x3c37('0xa')](function(_0x547025){var _0x8248ed=_0x547025[_0x3c37('0xb')]('[')[_0x3c37('0xc')]();var _0x55c649=_0x547025[_0x3c37('0xd')](/\[(.*?)\]/g);_0x55c649[_0x3c37('0xa')](function(_0x1a2cd1){var _0x23329e=_0x1a2cd1[_0x3c37('0xb')]('[')[_0x3c37('0xe')](function(_0x241866){return _0x241866[_0x3c37('0xf')](']')>-0x1;})[_0x3c37('0x10')](function(_0x1696d7){return _0x1696d7[_0x3c37('0xb')](']')[0x0];})[0x0];_0x45790c[_0x3c37('0x11')]['push']({'field':_0x477637,'operator':_0x8248ed,'value':_0x23329e});});});}return _0x45790c;};exports[_0x3c37('0x12')]=function(_0x50f643,_0x27e0a4,_0xdc671c){var _0x99a8df={};if(_0x27e0a4==='DATE'){if(_0xdc671c[_0x3c37('0x13')]===_0x3c37('0x14')){_0xdc671c[_0x3c37('0x13')]=_0x3c37('0x15');_0xdc671c[_0x3c37('0x16')]+=','+_0xdc671c[_0x3c37('0x16')];}else if(_[_0x3c37('0x17')](['$gt',_0x3c37('0x18')],_0xdc671c['operator'])){_0xdc671c[_0x3c37('0x16')]=moment(_0xdc671c['value'])[_0x3c37('0x19')](0x1,_0x3c37('0x1a'))['format']('YYYY-MM-DD');}}if(_0xdc671c[_0x3c37('0x1b')]){_0x27e0a4=_0xdc671c[_0x3c37('0x1b')];_0x99a8df[_0x3c37('0x1c')]=_0x3c37('0x1d')+_0x50f643+'.'+_0xdc671c[_0x3c37('0x1e')]+_0x3c37('0x1f')+_0xdc671c['castTo']+')\x20'+parseOperator(_0xdc671c['operator']);}else{_0x99a8df[_0x3c37('0x1c')]=_0x50f643+'.'+_0xdc671c[_0x3c37('0x1e')]+'\x20'+parseOperator(_0xdc671c[_0x3c37('0x13')]);}if(_['includes'](['$ne','$notIn'],_0xdc671c['operator']))_0x99a8df[_0x3c37('0x1c')]='('+_0x99a8df[_0x3c37('0x1c')]+'\x20OR\x20'+_0x50f643+'.'+_0xdc671c[_0x3c37('0x1e')]+_0x3c37('0x20');_0x99a8df[_0x3c37('0x16')]=parseValue(_0x27e0a4,_0xdc671c['operator'],_0xdc671c[_0x3c37('0x16')]);return _0x99a8df;};function parseOperator(_0x405537){var _0x547d94;switch(_0x405537){case'$in':_0x547d94=_0x3c37('0x21');break;case _0x3c37('0x22'):_0x547d94=_0x3c37('0x23');break;case'$eq':_0x547d94=_0x3c37('0x24');break;case _0x3c37('0x25'):_0x547d94=_0x3c37('0x26');break;case _0x3c37('0x27'):case'$startsWith':case _0x3c37('0x28'):_0x547d94=_0x3c37('0x29');break;case _0x3c37('0x2a'):_0x547d94=_0x3c37('0x2b');break;case _0x3c37('0x2c'):_0x547d94=_0x3c37('0x2d');break;case _0x3c37('0x18'):_0x547d94=_0x3c37('0x2e');break;case _0x3c37('0x2f'):_0x547d94=_0x3c37('0x30');break;case'$between':_0x547d94='BETWEEN\x20?\x20AND\x20?';break;}return _0x547d94;}function parseValue(_0x40d8b3,_0x47f3b9,_0x3d7786){var _0x5be8d4={'start':undefined,'end':undefined};switch(_0x47f3b9){case _0x3c37('0x31'):case'$notIn':_0x5be8d4[_0x3c37('0x32')]=_0x3d7786[_0x3c37('0xb')](',');break;case _0x3c37('0x27'):_0x5be8d4[_0x3c37('0x32')]='%'+_0x3d7786+'%';break;case _0x3c37('0x33'):_0x5be8d4[_0x3c37('0x32')]=_0x3d7786+'%';break;case'$endsWith':_0x5be8d4[_0x3c37('0x32')]='%'+_0x3d7786;break;case _0x3c37('0x15'):var _0x4f3abb=_0x3d7786['split'](',');var _0x3d7786=_0x4f3abb[_0x3c37('0xc')]();var _0x30b226=_0x4f3abb[_0x3c37('0x34')]();if(_0x40d8b3===_0x3c37('0x35')){_0x3d7786=moment(_0x3d7786)[_0x3c37('0x36')](0x0,!![])[_0x3c37('0x37')]();_0x30b226=moment(_0x30b226)['utcOffset'](0x0,!![])[_0x3c37('0x19')](0x17,_0x3c37('0x38'))[_0x3c37('0x19')](0x3b,_0x3c37('0x39'))[_0x3c37('0x19')](0x3b,_0x3c37('0x3a'))[_0x3c37('0x37')]();}_0x5be8d4={'start':_0x3d7786,'end':_0x30b226};break;default:_0x5be8d4[_0x3c37('0x32')]=_0x3d7786;break;}return _0x5be8d4;} \ No newline at end of file +var _0x7f81=['<\x20?','>\x20?','$lte','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','minutes','seconds','lodash','parseSearch','startsWith','[$or]','and','[$and]','replace','split','length','forEach','shift','match','filter','indexOf','map','push','buildExpression','DATE','operator','$between','value','includes','$gt','add','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$notIn','\x20OR\x20','$in','IN\x20?','$eq','$ne','<>\x20?','$substring','$endsWith','LIKE\x20?'];(function(_0x1ed40a,_0x374aab){var _0x4f67bb=function(_0x2c1f12){while(--_0x2c1f12){_0x1ed40a['push'](_0x1ed40a['shift']());}};_0x4f67bb(++_0x374aab);}(_0x7f81,0x6d));var _0x17f8=function(_0xc11762,_0x4559e1){_0xc11762=_0xc11762-0x0;var _0x3d837a=_0x7f81[_0xc11762];return _0x3d837a;};'use strict';var _=require(_0x17f8('0x0'));var moment=require('moment');exports[_0x17f8('0x1')]=function(_0x25dbcb){var _0x17a8ed={'conditions':[]};_0x17a8ed['sqlOperator']=_[_0x17f8('0x2')](_0x25dbcb,_0x17f8('0x3'))?'or':_0x17f8('0x4');var _0x5c1c50=_0x25dbcb['replace'](_0x17f8('0x5'),'')[_0x17f8('0x6')](_0x17f8('0x3'),'')[_0x17f8('0x7')]('||');for(var _0x3c4e45=0x0;_0x3c4e45<_0x5c1c50[_0x17f8('0x8')];_0x3c4e45++){var _0x2e1794=_0x5c1c50[_0x3c4e45][_0x17f8('0x7')](':=');var _0x5131a0=_0x2e1794[0x0];var _0x3156a3=_0x2e1794['slice'](0x1);_0x3156a3[_0x17f8('0x9')](function(_0x26fd70){var _0xbf7860=_0x26fd70[_0x17f8('0x7')]('[')[_0x17f8('0xa')]();var _0x276c16=_0x26fd70[_0x17f8('0xb')](/\[(.*?)\]/g);_0x276c16[_0x17f8('0x9')](function(_0x29d1cc){var _0x28c4b2=_0x29d1cc[_0x17f8('0x7')]('[')[_0x17f8('0xc')](function(_0x3349ea){return _0x3349ea[_0x17f8('0xd')](']')>-0x1;})[_0x17f8('0xe')](function(_0x20c1fa){return _0x20c1fa[_0x17f8('0x7')](']')[0x0];})[0x0];_0x17a8ed['conditions'][_0x17f8('0xf')]({'field':_0x5131a0,'operator':_0xbf7860,'value':_0x28c4b2});});});}return _0x17a8ed;};exports[_0x17f8('0x10')]=function(_0xdc6c97,_0x4f0424,_0xa3b8cc){var _0x144dd5={};if(_0x4f0424===_0x17f8('0x11')){if(_0xa3b8cc['operator']==='$eq'){_0xa3b8cc[_0x17f8('0x12')]=_0x17f8('0x13');_0xa3b8cc[_0x17f8('0x14')]+=','+_0xa3b8cc[_0x17f8('0x14')];}else if(_[_0x17f8('0x15')]([_0x17f8('0x16'),'$lte'],_0xa3b8cc['operator'])){_0xa3b8cc['value']=moment(_0xa3b8cc['value'])[_0x17f8('0x17')](0x1,'days')[_0x17f8('0x18')](_0x17f8('0x19'));}}if(_0xa3b8cc[_0x17f8('0x1a')]){_0x4f0424=_0xa3b8cc[_0x17f8('0x1a')];_0x144dd5[_0x17f8('0x1b')]=_0x17f8('0x1c')+_0xdc6c97+'.'+_0xa3b8cc['field']+_0x17f8('0x1d')+_0xa3b8cc[_0x17f8('0x1a')]+')\x20'+parseOperator(_0xa3b8cc[_0x17f8('0x12')]);}else{_0x144dd5['text']=_0xdc6c97+'.'+_0xa3b8cc[_0x17f8('0x1e')]+'\x20'+parseOperator(_0xa3b8cc[_0x17f8('0x12')]);}if(_[_0x17f8('0x15')](['$ne',_0x17f8('0x1f')],_0xa3b8cc[_0x17f8('0x12')]))_0x144dd5[_0x17f8('0x1b')]='('+_0x144dd5['text']+_0x17f8('0x20')+_0xdc6c97+'.'+_0xa3b8cc[_0x17f8('0x1e')]+'\x20IS\x20NULL)';_0x144dd5[_0x17f8('0x14')]=parseValue(_0x4f0424,_0xa3b8cc[_0x17f8('0x12')],_0xa3b8cc[_0x17f8('0x14')]);return _0x144dd5;};function parseOperator(_0x436544){var _0x2ad655;switch(_0x436544){case _0x17f8('0x21'):_0x2ad655=_0x17f8('0x22');break;case'$notIn':_0x2ad655='NOT\x20IN\x20?';break;case _0x17f8('0x23'):_0x2ad655='=\x20?';break;case _0x17f8('0x24'):_0x2ad655=_0x17f8('0x25');break;case _0x17f8('0x26'):case'$startsWith':case _0x17f8('0x27'):_0x2ad655=_0x17f8('0x28');break;case'$lt':_0x2ad655=_0x17f8('0x29');break;case _0x17f8('0x16'):_0x2ad655=_0x17f8('0x2a');break;case _0x17f8('0x2b'):_0x2ad655='<=\x20?';break;case'$gte':_0x2ad655='>=\x20?';break;case _0x17f8('0x13'):_0x2ad655=_0x17f8('0x2c');break;}return _0x2ad655;}function parseValue(_0x5a3cf5,_0x1dfcf1,_0x26c207){var _0x2c4503={'start':undefined,'end':undefined};switch(_0x1dfcf1){case _0x17f8('0x21'):case _0x17f8('0x1f'):_0x2c4503[_0x17f8('0x2d')]=_0x26c207[_0x17f8('0x7')](',');break;case'$substring':_0x2c4503['start']='%'+_0x26c207+'%';break;case'$startsWith':_0x2c4503[_0x17f8('0x2d')]=_0x26c207+'%';break;case'$endsWith':_0x2c4503['start']='%'+_0x26c207;break;case _0x17f8('0x13'):var _0x3c1e79=_0x26c207['split'](',');var _0x26c207=_0x3c1e79['shift']();var _0x4347e3=_0x3c1e79['pop']();if(_0x5a3cf5==='DATE'){_0x26c207=moment(_0x26c207)[_0x17f8('0x2e')](0x0,!![])[_0x17f8('0x18')]();_0x4347e3=moment(_0x4347e3)[_0x17f8('0x2e')](0x0,!![])[_0x17f8('0x17')](0x17,_0x17f8('0x2f'))[_0x17f8('0x17')](0x3b,_0x17f8('0x30'))[_0x17f8('0x17')](0x3b,_0x17f8('0x31'))[_0x17f8('0x18')]();}_0x2c4503={'start':_0x26c207,'end':_0x4347e3};break;default:_0x2c4503[_0x17f8('0x2d')]=_0x26c207;break;}return _0x2c4503;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 64fe938..83da23b 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 _0x06f2=['where','filter','columns','value','merge','VIRTUAL','lower','options','parse','keys','includes','fields','split','filters','isEmpty','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','uniqueid','isArray','limit','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','\x22{EXPR}\x22','{EXPR}','replace','push','join','getOptions','query','$id','model','attributes','intersection','nolimit','offset','order'];(function(_0x332842,_0x318975){var _0x2f6cac=function(_0xa49d56){while(--_0xa49d56){_0x332842['push'](_0x332842['shift']());}};_0x2f6cac(++_0x318975);}(_0x06f2,0x190));var _0x206f=function(_0x3d1156,_0x163846){_0x3d1156=_0x3d1156-0x0;var _0x2116f8=_0x06f2[_0x3d1156];return _0x2116f8;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x25e30b){var _0x3d5fe7=['ne'];try{var _0x5a16c2=JSON[_0x206f('0x0')](_0x25e30b);var _0x54521a=Object[_0x206f('0x1')](_0x5a16c2)[0x0];return _0x3d5fe7[_0x206f('0x2')](_0x54521a);}catch(_0x9d9300){return![];}}function getOperatorValue(_0x411db5){var _0x7e98e1=JSON[_0x206f('0x0')](_0x411db5);var _0x20f9e9=Object[_0x206f('0x1')](_0x7e98e1)[0x0];var _0x3fa703=_0x7e98e1[_0x20f9e9];return{['$'+_0x20f9e9]:_0x3fa703};}exports[_0x206f('0x3')]=function(_0x2dce7a){var _0x194766=null;if(_0x2dce7a){_0x194766=_0x2dce7a[_0x206f('0x4')](',');}return _0x194766;};exports[_0x206f('0x5')]=function(_0x4d0c60,_0x41c3b6){var _0x100f97={};if(!_[_0x206f('0x6')](_0x4d0c60)){_['forOwn'](_0x4d0c60,function(_0x5b709c,_0x13a01e){try{if(_0x41c3b6){var _0x5dc37c=_['find'](_0x41c3b6,{'name':_0x13a01e})||{};if(hasSequelizeOperator(_0x5b709c)){_0x100f97[_0x13a01e]=getOperatorValue(_0x5b709c);}else if(_0x5dc37c[_0x206f('0x7')]==='DATE'&&_[_0x206f('0x8')](_0x5b709c)){var _0x3d1056=JSON[_0x206f('0x0')](_0x5b709c);var _0x3d95f8={'$gte':moment(moment(_0x3d1056[_0x206f('0x9')])[_0x206f('0xa')](_0x206f('0xb')))[_0x206f('0xc')]()[_0x206f('0xa')](),'$lte':moment(moment(_0x3d1056['$lte'])[_0x206f('0xa')](_0x206f('0xb')))[_0x206f('0xc')]()[_0x206f('0xd')](0x1,'s')[_0x206f('0xa')]()};_0x100f97[_0x13a01e]=_0x3d95f8;}else if(_0x5dc37c['name']===_0x206f('0xe')){_0x100f97[_0x13a01e]=_0x5b709c;}else{_0x100f97[_0x13a01e]=_[_0x206f('0xf')](_0x5b709c)?_0x5b709c:JSON[_0x206f('0x0')](_0x5b709c);}}else{_0x100f97[_0x13a01e]=_[_0x206f('0xf')](_0x5b709c)?_0x5b709c:JSON[_0x206f('0x0')](_0x5b709c);}}catch(_0x54372a){_0x100f97[_0x13a01e]=_0x5b709c[_0x206f('0x4')](',');}});}return _0x100f97;};exports[_0x206f('0x10')]=function(_0x172a7c){_0x172a7c=parseInt(_0x172a7c,0xa);if(!_0x172a7c||_0x172a7c<0x0){_0x172a7c=LIMIT_VALUE;}return _0x172a7c;};exports['offset']=function(_0x285b54){_0x285b54=parseInt(_0x285b54,0xa);if(!_0x285b54||_0x285b54<0x0){_0x285b54=0x0;}return _0x285b54;};exports['sort']=function(_0x845502){var _0x3a14ed,_0x15bc55=null;if(_0x845502){_0x3a14ed=_0x845502[_0x206f('0x4')](',');_0x15bc55=_[_0x206f('0x11')](_0x3a14ed,function(_0x1b363e){if(_0x1b363e[_0x206f('0x12')]('-')===0x0){return[_0x1b363e===_0x206f('0x13')?sequelize[_0x206f('0x14')](sequelize[_0x206f('0x15')](_0x206f('0x13')),_0x206f('0x16')):_0x1b363e[_0x206f('0x17')](0x1),_0x206f('0x18')];}else{return[_0x1b363e==='priority'?sequelize['cast'](sequelize[_0x206f('0x15')](_0x206f('0x13')),_0x206f('0x16')):_0x1b363e,_0x206f('0x19')];}});}return _0x15bc55;};exports['omit']=function(_0x1b9c3d,_0x115c9f){if(_['isEmpty'](_0x1b9c3d)){return _0x1b9c3d;}if(_[_0x206f('0xf')](_0x1b9c3d)){for(var _0x1d83d5=0x0;_0x1d83d5<_0x1b9c3d[_0x206f('0x1a')];_0x1d83d5+=0x1){_0x1b9c3d[_0x1d83d5]=this[_0x206f('0x1b')](_0x1b9c3d[_0x1d83d5],_0x115c9f);}return _0x1b9c3d;}if(!_[_0x206f('0x1c')](_0x1b9c3d)){return _0x1b9c3d;}if(_[_0x206f('0x1d')](_0x115c9f)){_0x115c9f=[_0x115c9f];}if(!_[_0x206f('0xf')](_0x115c9f)){return _0x1b9c3d;}for(var _0x1b9bf8=0x0;_0x1b9bf8<_0x115c9f[_0x206f('0x1a')];_0x1b9bf8+=0x1){_[_0x206f('0x1e')](_0x1b9c3d,_0x115c9f[_0x1b9bf8]);}for(var _0x133d16 in _0x1b9c3d){if(_0x1b9c3d[_0x206f('0x1f')](_0x133d16)){_0x1b9c3d[_0x133d16]=this[_0x206f('0x1b')](_0x1b9c3d[_0x133d16],_0x115c9f);}}return _0x1b9c3d;};exports[_0x206f('0x20')]=function(_0x24954c){return _0x24954c['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x349f29){return _0x349f29[_0x206f('0x21')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1004f1,_0x15b3f5){var _0x4a26c8=[];var _0x5a119d=/[ `!@#$%^&*()_\-?~]/;var _0x30ce5c=_0x15b3f5?_0x206f('0x22'):_0x206f('0x23');_0x1004f1[_0x206f('0x4')](/[ ,]+/)['forEach'](function(_0x151787){_0x151787=_0x151787[_0x206f('0x24')](/([^:]")"+/g,'$1');_0x151787='+'+_0x151787+'*';var _0x526965=_0x151787[_0x206f('0x21')](_0x5a119d);if(_0x526965){_0x151787='\x22'+_0x151787+'\x22';}_0x4a26c8[_0x206f('0x25')](_0x151787);});_0x30ce5c=_0x30ce5c[_0x206f('0x24')](_0x206f('0x23'),_0x4a26c8[_0x206f('0x26')]('\x20'));return _0x30ce5c;};exports[_0x206f('0x27')]=function(_0x30c160,_0x317d4b,_0xfa13be){var _0x573269={},_0x33ab58={};if(_0x317d4b[_0x206f('0x28')][_0x206f('0x29')]){_0x317d4b['query']['id']=_0x317d4b[_0x206f('0x28')][_0x206f('0x29')];delete _0x317d4b[_0x206f('0x28')][_0x206f('0x29')];}_0x573269[_0x206f('0x2a')]=_[_0x206f('0x11')](_0x30c160,'name');_0x573269[_0x206f('0x28')]=_[_0x206f('0x1')](_0x317d4b[_0x206f('0x28')]);_0x573269['filters']=_['intersection'](_0x573269[_0x206f('0x2a')],_0x573269['query']);_0x33ab58[_0x206f('0x2b')]=_[_0x206f('0x2c')](_0x573269['model'],this[_0x206f('0x3')](_0x317d4b[_0x206f('0x28')]['fields']));_0x33ab58['attributes']=_0x33ab58[_0x206f('0x2b')][_0x206f('0x1a')]?_0x33ab58['attributes']:_0x573269[_0x206f('0x2a')];if(!_0x317d4b[_0x206f('0x28')][_0x206f('0x1f')](_0x206f('0x2d'))){_0x33ab58[_0x206f('0x10')]=this[_0x206f('0x10')](_0x317d4b[_0x206f('0x28')]['limit']);_0x33ab58[_0x206f('0x2e')]=this[_0x206f('0x2e')](_0x317d4b['query'][_0x206f('0x2e')]);}_0x33ab58[_0x206f('0x2f')]=this['sort'](_0x317d4b[_0x206f('0x28')]['sort']);_0x33ab58[_0x206f('0x30')]=this[_0x206f('0x5')](_['pick'](_0x317d4b['query'],_0x573269[_0x206f('0x5')]),_0x30c160);if(_0x317d4b[_0x206f('0x28')][_0x206f('0x31')]){var _0x2d9664=_0x30c160;var _0x264be1=_0x317d4b[_0x206f('0x28')]['filter'];if(typeof _0x264be1==='object'){_0x2d9664=_[_0x206f('0x31')](_0x30c160,function(_0x4e9c3b){return _[_0x206f('0x2')](_0x264be1[_0x206f('0x32')],_0x4e9c3b['name']);});_0x264be1=_0x264be1[_0x206f('0x33')];}_0x33ab58[_0x206f('0x30')]=_[_0x206f('0x34')](_0x33ab58[_0x206f('0x30')],{'$or':_['map'](_0x2d9664,function(_0x3a94c7){if(_0x3a94c7[_0x206f('0x7')]!==_0x206f('0x35')){if(_0xfa13be){return sequelize[_0x206f('0x30')](sequelize['fn'](_0x206f('0x36'),sequelize[_0x206f('0x15')](_0x3a94c7['name'])),{'$like':sequelize['fn'](_0x206f('0x36'),'%'+_0x317d4b['query'][_0x206f('0x31')]+'%')});}else{var _0x3b71bf={};_0x3b71bf[_0x3a94c7['name']]={'$like':'%'+_0x317d4b[_0x206f('0x28')][_0x206f('0x31')]+'%'};return _0x3b71bf;}}})});}_0x33ab58=_[_0x206f('0x34')]({},_0x33ab58,_0x317d4b[_0x206f('0x37')]);return _0x33ab58;}; \ No newline at end of file +var _0xd9e6=['order','pick','filter','object','columns','value','merge','where','VIRTUAL','lower','sequelize','moment','parse','includes','keys','split','filters','isEmpty','find','isPlainObject','$gte','format','$lte','YYYY-MM-DD','utc','subtract','isArray','offset','sort','map','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','length','omit','isObject','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','name','attributes','intersection','fields','nolimit','limit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd9e6,0x13b));var _0x6d9e=function(_0x3feaa2,_0x35b419){_0x3feaa2=_0x3feaa2-0x0;var _0x1a10ae=_0xd9e6[_0x3feaa2];return _0x1a10ae;};'use strict';var _=require('lodash');var sequelize=require(_0x6d9e('0x0'));var moment=require(_0x6d9e('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x43e45e){var _0x538474=['ne'];try{var _0x4591f3=JSON[_0x6d9e('0x2')](_0x43e45e);var _0x1a9bd8=Object['keys'](_0x4591f3)[0x0];return _0x538474[_0x6d9e('0x3')](_0x1a9bd8);}catch(_0xf13494){return![];}}function getOperatorValue(_0x437a57){var _0x108da3=JSON[_0x6d9e('0x2')](_0x437a57);var _0x1a82d1=Object[_0x6d9e('0x4')](_0x108da3)[0x0];var _0x2135a7=_0x108da3[_0x1a82d1];return{['$'+_0x1a82d1]:_0x2135a7};}exports['fields']=function(_0x594621){var _0xce98f9=null;if(_0x594621){_0xce98f9=_0x594621[_0x6d9e('0x5')](',');}return _0xce98f9;};exports[_0x6d9e('0x6')]=function(_0x305ff9,_0x1929fd){var _0x226716={};if(!_[_0x6d9e('0x7')](_0x305ff9)){_['forOwn'](_0x305ff9,function(_0x44535e,_0x390eca){try{if(_0x1929fd){var _0x8819ab=_[_0x6d9e('0x8')](_0x1929fd,{'name':_0x390eca})||{};if(hasSequelizeOperator(_0x44535e)){_0x226716[_0x390eca]=getOperatorValue(_0x44535e);}else if(_0x8819ab['type']==='DATE'&&_[_0x6d9e('0x9')](_0x44535e)){var _0x2b2a35=JSON['parse'](_0x44535e);var _0x4b9f60={'$gte':moment(moment(_0x2b2a35[_0x6d9e('0xa')])[_0x6d9e('0xb')]('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0x2b2a35[_0x6d9e('0xc')])[_0x6d9e('0xb')](_0x6d9e('0xd')))[_0x6d9e('0xe')]()[_0x6d9e('0xf')](0x1,'s')[_0x6d9e('0xb')]()};_0x226716[_0x390eca]=_0x4b9f60;}else if(_0x8819ab['name']==='uniqueid'){_0x226716[_0x390eca]=_0x44535e;}else{_0x226716[_0x390eca]=_[_0x6d9e('0x10')](_0x44535e)?_0x44535e:JSON['parse'](_0x44535e);}}else{_0x226716[_0x390eca]=_[_0x6d9e('0x10')](_0x44535e)?_0x44535e:JSON[_0x6d9e('0x2')](_0x44535e);}}catch(_0x517c63){_0x226716[_0x390eca]=_0x44535e[_0x6d9e('0x5')](',');}});}return _0x226716;};exports['limit']=function(_0x252b3a){_0x252b3a=parseInt(_0x252b3a,0xa);if(!_0x252b3a||_0x252b3a<0x0){_0x252b3a=LIMIT_VALUE;}return _0x252b3a;};exports[_0x6d9e('0x11')]=function(_0x4c3ef2){_0x4c3ef2=parseInt(_0x4c3ef2,0xa);if(!_0x4c3ef2||_0x4c3ef2<0x0){_0x4c3ef2=0x0;}return _0x4c3ef2;};exports[_0x6d9e('0x12')]=function(_0x5e44c9){var _0xc11430,_0x5657d8=null;if(_0x5e44c9){_0xc11430=_0x5e44c9['split'](',');_0x5657d8=_[_0x6d9e('0x13')](_0xc11430,function(_0x595654){if(_0x595654[_0x6d9e('0x14')]('-')===0x0){return[_0x595654===_0x6d9e('0x15')?sequelize[_0x6d9e('0x16')](sequelize[_0x6d9e('0x17')]('priority'),'unsigned'):_0x595654[_0x6d9e('0x18')](0x1),_0x6d9e('0x19')];}else{return[_0x595654==='priority'?sequelize[_0x6d9e('0x16')](sequelize['col']('priority'),_0x6d9e('0x1a')):_0x595654,_0x6d9e('0x1b')];}});}return _0x5657d8;};exports['omit']=function(_0x460506,_0x4dffec){if(_['isEmpty'](_0x460506)){return _0x460506;}if(_[_0x6d9e('0x10')](_0x460506)){for(var _0x4fe0a7=0x0;_0x4fe0a7<_0x460506[_0x6d9e('0x1c')];_0x4fe0a7+=0x1){_0x460506[_0x4fe0a7]=this[_0x6d9e('0x1d')](_0x460506[_0x4fe0a7],_0x4dffec);}return _0x460506;}if(!_[_0x6d9e('0x1e')](_0x460506)){return _0x460506;}if(_['isString'](_0x4dffec)){_0x4dffec=[_0x4dffec];}if(!_[_0x6d9e('0x10')](_0x4dffec)){return _0x460506;}for(var _0x23bb3a=0x0;_0x23bb3a<_0x4dffec['length'];_0x23bb3a+=0x1){_['unset'](_0x460506,_0x4dffec[_0x23bb3a]);}for(var _0x2232d8 in _0x460506){if(_0x460506[_0x6d9e('0x1f')](_0x2232d8)){_0x460506[_0x2232d8]=this['omit'](_0x460506[_0x2232d8],_0x4dffec);}}return _0x460506;};exports['isNumeric']=function(_0x95045b){return _0x95045b[_0x6d9e('0x20')](RegExp(_0x6d9e('0x21')))?!![]:![];};exports[_0x6d9e('0x22')]=function(_0x29d3ff){return _0x29d3ff[_0x6d9e('0x20')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x38ff37,_0x5b089c){var _0x56e06d=[];var _0x2e06e0=/[ `!@#$%^&*()_\-?~]/;var _0x3852ea=_0x5b089c?_0x6d9e('0x23'):_0x6d9e('0x24');_0x38ff37[_0x6d9e('0x5')](/[ ,]+/)[_0x6d9e('0x25')](function(_0x352764){_0x352764=_0x352764[_0x6d9e('0x26')](/([^:]")"+/g,'$1');_0x352764='+'+_0x352764+'*';var _0x2ec9cd=_0x352764[_0x6d9e('0x20')](_0x2e06e0);if(_0x2ec9cd){_0x352764='\x22'+_0x352764+'\x22';}_0x56e06d[_0x6d9e('0x27')](_0x352764);});_0x3852ea=_0x3852ea[_0x6d9e('0x26')](_0x6d9e('0x24'),_0x56e06d[_0x6d9e('0x28')]('\x20'));return _0x3852ea;};exports[_0x6d9e('0x29')]=function(_0x36bd27,_0xe4c8b4,_0x20fd31){var _0x3777a8={},_0x1220c6={};if(_0xe4c8b4['query']['$id']){_0xe4c8b4[_0x6d9e('0x2a')]['id']=_0xe4c8b4[_0x6d9e('0x2a')]['$id'];delete _0xe4c8b4[_0x6d9e('0x2a')][_0x6d9e('0x2b')];}_0x3777a8[_0x6d9e('0x2c')]=_[_0x6d9e('0x13')](_0x36bd27,_0x6d9e('0x2d'));_0x3777a8[_0x6d9e('0x2a')]=_['keys'](_0xe4c8b4[_0x6d9e('0x2a')]);_0x3777a8[_0x6d9e('0x6')]=_['intersection'](_0x3777a8['model'],_0x3777a8[_0x6d9e('0x2a')]);_0x1220c6[_0x6d9e('0x2e')]=_[_0x6d9e('0x2f')](_0x3777a8[_0x6d9e('0x2c')],this[_0x6d9e('0x30')](_0xe4c8b4['query'][_0x6d9e('0x30')]));_0x1220c6['attributes']=_0x1220c6[_0x6d9e('0x2e')][_0x6d9e('0x1c')]?_0x1220c6[_0x6d9e('0x2e')]:_0x3777a8[_0x6d9e('0x2c')];if(!_0xe4c8b4['query'][_0x6d9e('0x1f')](_0x6d9e('0x31'))){_0x1220c6[_0x6d9e('0x32')]=this[_0x6d9e('0x32')](_0xe4c8b4[_0x6d9e('0x2a')]['limit']);_0x1220c6[_0x6d9e('0x11')]=this[_0x6d9e('0x11')](_0xe4c8b4[_0x6d9e('0x2a')][_0x6d9e('0x11')]);}_0x1220c6[_0x6d9e('0x33')]=this['sort'](_0xe4c8b4[_0x6d9e('0x2a')][_0x6d9e('0x12')]);_0x1220c6['where']=this[_0x6d9e('0x6')](_[_0x6d9e('0x34')](_0xe4c8b4[_0x6d9e('0x2a')],_0x3777a8['filters']),_0x36bd27);if(_0xe4c8b4[_0x6d9e('0x2a')]['filter']){var _0x142e0e=_0x36bd27;var _0x4f4bbb=_0xe4c8b4[_0x6d9e('0x2a')][_0x6d9e('0x35')];if(typeof _0x4f4bbb===_0x6d9e('0x36')){_0x142e0e=_[_0x6d9e('0x35')](_0x36bd27,function(_0x3a4aac){return _['includes'](_0x4f4bbb[_0x6d9e('0x37')],_0x3a4aac[_0x6d9e('0x2d')]);});_0x4f4bbb=_0x4f4bbb[_0x6d9e('0x38')];}_0x1220c6['where']=_[_0x6d9e('0x39')](_0x1220c6[_0x6d9e('0x3a')],{'$or':_[_0x6d9e('0x13')](_0x142e0e,function(_0xbc33dd){if(_0xbc33dd['type']!==_0x6d9e('0x3b')){if(_0x20fd31){return sequelize[_0x6d9e('0x3a')](sequelize['fn'](_0x6d9e('0x3c'),sequelize[_0x6d9e('0x17')](_0xbc33dd[_0x6d9e('0x2d')])),{'$like':sequelize['fn'](_0x6d9e('0x3c'),'%'+_0xe4c8b4[_0x6d9e('0x2a')][_0x6d9e('0x35')]+'%')});}else{var _0x384b12={};_0x384b12[_0xbc33dd[_0x6d9e('0x2d')]]={'$like':'%'+_0xe4c8b4['query'][_0x6d9e('0x35')]+'%'};return _0x384b12;}}})});}_0x1220c6=_[_0x6d9e('0x39')]({},_0x1220c6,_0xe4c8b4['options']);return _0x1220c6;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 12de429..cbeaf38 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 _0x996f=['faxCurrentCapacity','smsStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','filterAgentAttributes','lodash','client','http','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unavailable','isNil','voiceStatus','pause','every','chatStatus','mailStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','unknown','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','value','includes','getAgentIdsByStatus','findAll','name','fullname','faxPause','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','substring','indexOf','internal','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0x996f,0x1ec));var _0xf996=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x996f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf996('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xf996('0x1')]['http']({'port':0x232a});var routingClient=jayson[_0xf996('0x1')][_0xf996('0x2')]({'port':0x232c});function isAgentPaused(_0x58e08b,_0x5df9af){var _0x1b5ea8=[_0x58e08b[_0xf996('0x3')],_0x58e08b['faxPause'],_0x58e08b[_0xf996('0x4')],_0x58e08b[_0xf996('0x5')],_0x58e08b[_0xf996('0x6')],_0x58e08b[_0xf996('0x7')],_0x58e08b[_0xf996('0x8')]];if(!_0x5df9af)return _['every'](_0x1b5ea8);var _0x33c100=_[_0xf996('0x9')](_0x1b5ea8);return _0x33c100[_0xf996('0xa')]>0x0&&_0x33c100['length']<_0x1b5ea8['length']?!![]:![];}function isIdle(_0x1a7d85){return _0x1a7d85===_0xf996('0xb')||_0x1a7d85==='unknown'||_0x1a7d85===_0xf996('0xc')||_0x1a7d85==='ringing'||_[_0xf996('0xd')](_0x1a7d85);}function isAgentIdle(_0x48563a){if(_0x48563a[_0xf996('0xe')]!==_0xf996('0xb')&&_0x48563a['voicePause']){_0x48563a['voiceStatus']=_0xf996('0xf');return![];}return _[_0xf996('0x10')]([_0x48563a[_0xf996('0x11')],_0x48563a['faxStatus'],_0x48563a[_0xf996('0x12')],_0x48563a['openchannelStatus'],_0x48563a['smsStatus'],_0x48563a[_0xf996('0xe')],_0x48563a[_0xf996('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xf996('0x14')](_0xf996('0x15'),{})[_0xf996('0x16')](function(_0x537d1f){if(_0x537d1f[_0xf996('0x17')]){throw new Error(_0xf996('0x18'));}var _0x9c7c18=_0x537d1f[_0xf996('0x19')];return routingClient[_0xf996('0x14')](_0xf996('0x15'),{})[_0xf996('0x16')](function(_0x1f6022){if(_0x1f6022['error']){throw new Error(_0xf996('0x1a'));}var _0x2bc29c=_0x1f6022[_0xf996('0x19')];return _['merge']({},_0x9c7c18,_0x2bc29c);});})[_0xf996('0x1b')](function(_0x4fd088){throw _0x4fd088;});}exports[_0xf996('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x442b30){var _0x348e75=_0xf996('0x1d');if(isAgentPaused(_0x442b30))_0x348e75=_0xf996('0xf');else if(isAgentPaused(_0x442b30,!![]))_0x348e75=_0xf996('0x1e');else if(isAgentIdle(_0x442b30))_0x348e75='idle';else _0x348e75=_0xf996('0x1f');return _0x348e75;}exports[_0xf996('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x45b18f,_0x4485fb){var _0x2abb9b=_[_0xf996('0x21')](_0x45b18f)?_0x45b18f:[_0x45b18f];var _0x3b7413=_[_0xf996('0x22')](_0x4485fb)+_0xf996('0x23');var _0xaef4d2=_[_0xf996('0x24')](_0x2abb9b,function(_0x3819f6){return db[_0x3b7413][_0xf996('0x25')]({'where':{'id':_0x3819f6}})[_0xf996('0x16')](function(_0x2a2c72){if(!_0x2a2c72)return[];return _0x2a2c72['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xf996('0x26')](_0xaef4d2)[_0xf996('0x16')](function(_0x166457){var _0x203f75=_(_0x166457)[_0xf996('0x27')]()[_0xf996('0x24')]('id')['uniq']()[_0xf996('0x28')]();return _0x203f75;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x58387a,_0x5d0afc,_0x4b7d3f){try{if(_0x5d0afc[_0xf996('0xa')]>0x0){_0x58387a=_0x58387a[_0xf996('0x9')](function(_0x1f6206){return _0x5d0afc[_0xf996('0x29')](_0x1f6206['id']);});}var _0x4984a5=_0x58387a[_0xf996('0x9')](function(_0x377e10){var _0x1281f9=_0xf996('0x1f');if(isAgentIdle(_0x377e10)){_0x1281f9=_0xf996('0xb');}return _0x1281f9===_0x4b7d3f;});return _[_0xf996('0x24')](_0x4984a5,'id');}catch(_0x2f2521){throw _0x2f2521;}}exports[_0xf996('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x23b2c7,_0x28cf2b,_0x1d68c4){return Promise['resolve']()[_0xf996('0x16')](function(){if(_0x28cf2b[_0xf996('0xa')]>0x0){_0x23b2c7=_0x23b2c7[_0xf996('0x9')](function(_0x4a9082){return _0x28cf2b[_0xf996('0x29')](_0x4a9082['id']);});}return _0x23b2c7;})['then'](function(){return db['User'][_0xf996('0x2b')]({'attributes':['id',_0xf996('0x2c'),_0xf996('0x2d'),_0xf996('0x3'),_0xf996('0x2e'),_0xf996('0x4'),_0xf996('0x5'),_0xf996('0x6'),_0xf996('0x7'),_0xf996('0x8'),'pauseType'],'where':{'id':{'$in':_[_0xf996('0x24')](_0x23b2c7,'id')}},'raw':!![]});})[_0xf996('0x16')](function(_0x54f117){return _0x54f117[_0xf996('0x24')](function(_0x2bbcdb){var _0x3acfdd=_['find'](_0x23b2c7,['id',_0x2bbcdb['id']]);var _0x2fc966=filterAgentAttributes(_0x3acfdd);_['merge'](_0x2bbcdb,_0x2fc966);_0x2bbcdb[_0xf996('0x2f')]=getAgentStatus(_0x2bbcdb);return _0x2bbcdb;});})['then'](function(_0x495690){var _0x2db7d6=sortAgentsByStatus(_0x495690,_0x1d68c4);return _['map'](_0x2db7d6,'id');})['catch'](function(_0x4a6dc6){throw _0x4a6dc6;});}exports[_0xf996('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x59b618){var _0x17246d={'fields':[],'order':null};var _0x14c683=_0x59b618[_0xf996('0x31')](',');_0x17246d[_0xf996('0x32')]=_[_0xf996('0x9')](_0x14c683,function(_0x6aba9f){if(!_0x6aba9f[_0xf996('0x29')](_0xf996('0x2f'))){return!![];}_0x17246d[_0xf996('0x33')]=_[_0xf996('0x34')](_0x6aba9f,'-')?_0xf996('0x35'):_0xf996('0x36');return![];});return _0x17246d;}exports[_0xf996('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x5a56a9){if(_0x5a56a9[_0xf996('0x29')](_0xf996('0x2d'))&&!_0x5a56a9[_0xf996('0x29')]('internal')){var _0x468cb0=_0x5a56a9[_0xf996('0x38')](0x0,_0x5a56a9[_0xf996('0x39')](_0xf996('0x2d')));_0x5a56a9+=','+_0x468cb0+_0xf996('0x3a');}return _0x5a56a9;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0xf70db3,_0x46e568){var _0x5dee0d=_0xf70db3['sort'](function(_0xd41bf3,_0x140c70){if(_0xd41bf3[_0xf996('0x2f')]===_0x140c70[_0xf996('0x2f')]){if(_0xd41bf3['globalStatus']===_0xf996('0xf')){if(_0x46e568===_0xf996('0x35')){return(_0xd41bf3[_0xf996('0x3b')]||'')<(_0x140c70[_0xf996('0x3b')]||'')||_0xd41bf3[_0xf996('0x2d')][_0xf996('0x3c')]()>_0x140c70[_0xf996('0x2d')][_0xf996('0x3c')]()?0x1:-0x1;}else{return(_0xd41bf3[_0xf996('0x3b')]||'')<(_0x140c70['pauseType']||'')||_0xd41bf3[_0xf996('0x2d')][_0xf996('0x3c')]()>_0x140c70['fullname'][_0xf996('0x3c')]()?-0x1:0x1;}}else{if(_0x46e568===_0xf996('0x35')){return _0xd41bf3[_0xf996('0x2d')]['toLowerCase']()<_0x140c70[_0xf996('0x2d')][_0xf996('0x3c')]()?0x1:-0x1;}else{return _0xd41bf3[_0xf996('0x2d')]['toLowerCase']()<_0x140c70['fullname'][_0xf996('0x3c')]()?-0x1:0x1;}}}else{if(_0x46e568===_0xf996('0x35')){return _0xd41bf3[_0xf996('0x2f')]<_0x140c70['globalStatus']?0x1:-0x1;}else{return _0xd41bf3[_0xf996('0x2f')]<_0x140c70['globalStatus']?-0x1:0x1;}}});return _0x5dee0d;}exports[_0xf996('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x109da9){var _0x321b44=[_0xf996('0x3e'),_0xf996('0x3f'),_0xf996('0x40'),_0xf996('0x41'),_0xf996('0x3b'),_0xf996('0x41'),'internal',_0xf996('0x42'),_0xf996('0x3'),'openchannelPause',_0xf996('0x4'),_0xf996('0x6'),'whatsappPause','faxPause',_0xf996('0x7'),_0xf996('0x43'),_0xf996('0x44'),_0xf996('0x45'),_0xf996('0x46'),_0xf996('0x47'),_0xf996('0x48'),_0xf996('0x49'),_0xf996('0x4a'),_0xf996('0x4b'),_0xf996('0x4c'),_0xf996('0x4d'),_0xf996('0x4e'),_0xf996('0x11'),'openchannelStatus','mailStatus',_0xf996('0x4f'),_0xf996('0x13'),_0xf996('0x50'),'voiceStatus',_0xf996('0x51'),_0xf996('0x52'),_0xf996('0x53'),_0xf996('0x54'),_0xf996('0x55'),_0xf996('0x56'),_0xf996('0x57'),_0xf996('0x58'),'destconnectedlinenum',_0xf996('0x59'),_0xf996('0x5a'),_0xf996('0x5b'),_0xf996('0x5c')];var _0x299910=['chatPause',_0xf996('0x5'),'mailPause',_0xf996('0x6'),_0xf996('0x8'),_0xf996('0x2e'),_0xf996('0x7'),'online'];var _0x5cb260=_(_0x109da9)[_0xf996('0x5d')](_0x299910)['pick'](_0x321b44)[_0xf996('0x28')]();return _0x5cb260;}exports[_0xf996('0x5e')]=filterAgentAttributes; \ No newline at end of file +var _0xfed1=['http','chatPause','faxPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','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)','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','Queue','map','all','flatten','value','includes','resolve','fullname','mailPause','smsPause','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client'];(function(_0x4f6faf,_0x148286){var _0xb9736b=function(_0x3b09d8){while(--_0x3b09d8){_0x4f6faf['push'](_0x4f6faf['shift']());}};_0xb9736b(++_0x148286);}(_0xfed1,0x1dc));var _0x1fed=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xfed1[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x1fed('0x0'));var jayson=require(_0x1fed('0x1'));var db=require(_0x1fed('0x2'))['db'];var amiClient=jayson[_0x1fed('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x1fed('0x3')][_0x1fed('0x4')]({'port':0x232c});function isAgentPaused(_0x5f32b4,_0x297f3c){var _0x46cd0f=[_0x5f32b4[_0x1fed('0x5')],_0x5f32b4[_0x1fed('0x6')],_0x5f32b4['mailPause'],_0x5f32b4[_0x1fed('0x7')],_0x5f32b4['smsPause'],_0x5f32b4[_0x1fed('0x8')],_0x5f32b4[_0x1fed('0x9')]];if(!_0x297f3c)return _[_0x1fed('0xa')](_0x46cd0f);var _0x392690=_[_0x1fed('0xb')](_0x46cd0f);return _0x392690['length']>0x0&&_0x392690[_0x1fed('0xc')]<_0x46cd0f[_0x1fed('0xc')]?!![]:![];}function isIdle(_0xc31ca1){return _0xc31ca1===_0x1fed('0xd')||_0xc31ca1===_0x1fed('0xe')||_0xc31ca1===_0x1fed('0xf')||_0xc31ca1===_0x1fed('0x10')||_[_0x1fed('0x11')](_0xc31ca1);}function isAgentIdle(_0x58ed94){if(_0x58ed94[_0x1fed('0x12')]!=='idle'&&_0x58ed94[_0x1fed('0x8')]){_0x58ed94[_0x1fed('0x12')]='pause';return![];}return _[_0x1fed('0xa')]([_0x58ed94[_0x1fed('0x13')],_0x58ed94[_0x1fed('0x14')],_0x58ed94[_0x1fed('0x15')],_0x58ed94[_0x1fed('0x16')],_0x58ed94[_0x1fed('0x17')],_0x58ed94[_0x1fed('0x12')],_0x58ed94[_0x1fed('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x1fed('0x19')](_0x1fed('0x1a'),{})[_0x1fed('0x1b')](function(_0xa86375){if(_0xa86375[_0x1fed('0x1c')]){throw new Error(_0x1fed('0x1d'));}var _0x17439b=_0xa86375[_0x1fed('0x1e')];return routingClient[_0x1fed('0x19')](_0x1fed('0x1a'),{})[_0x1fed('0x1b')](function(_0x1a2e8e){if(_0x1a2e8e['error']){throw new Error(_0x1fed('0x1f'));}var _0x35d1f5=_0x1a2e8e[_0x1fed('0x1e')];return _['merge']({},_0x17439b,_0x35d1f5);});})[_0x1fed('0x20')](function(_0x1db06f){throw _0x1db06f;});}exports[_0x1fed('0x21')]=getRealtimeAgents;function getAgentStatus(_0x178df3){var _0x550d11=_0x1fed('0xe');if(isAgentPaused(_0x178df3))_0x550d11=_0x1fed('0x22');else if(isAgentPaused(_0x178df3,!![]))_0x550d11=_0x1fed('0x23');else if(isAgentIdle(_0x178df3))_0x550d11=_0x1fed('0xd');else _0x550d11=_0x1fed('0x24');return _0x550d11;}exports[_0x1fed('0x25')]=getAgentStatus;function getAgentIdsByQueues(_0x515e61,_0x4b245a){var _0x15483b=_[_0x1fed('0x26')](_0x515e61)?_0x515e61:[_0x515e61];var _0x277014=_['startCase'](_0x4b245a)+_0x1fed('0x27');var _0x4518fe=_[_0x1fed('0x28')](_0x15483b,function(_0x59dcde){return db[_0x277014]['findOne']({'where':{'id':_0x59dcde}})['then'](function(_0x3486e6){if(!_0x3486e6)return[];return _0x3486e6['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x1fed('0x29')](_0x4518fe)['then'](function(_0x419546){var _0x56ff65=_(_0x419546)[_0x1fed('0x2a')]()[_0x1fed('0x28')]('id')['uniq']()[_0x1fed('0x2b')]();return _0x56ff65;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4494ca,_0x32d60c,_0x4a0887){try{if(_0x32d60c[_0x1fed('0xc')]>0x0){_0x4494ca=_0x4494ca['filter'](function(_0x17bda1){return _0x32d60c[_0x1fed('0x2c')](_0x17bda1['id']);});}var _0x2d5492=_0x4494ca[_0x1fed('0xb')](function(_0x4650ef){var _0x59ccc9='busy';if(isAgentIdle(_0x4650ef)){_0x59ccc9=_0x1fed('0xd');}return _0x59ccc9===_0x4a0887;});return _[_0x1fed('0x28')](_0x2d5492,'id');}catch(_0x18b810){throw _0x18b810;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x362b13,_0x23dcbd,_0x1cc720){return Promise[_0x1fed('0x2d')]()['then'](function(){if(_0x23dcbd[_0x1fed('0xc')]>0x0){_0x362b13=_0x362b13['filter'](function(_0x44b048){return _0x23dcbd['includes'](_0x44b048['id']);});}return _0x362b13;})['then'](function(){return db['User']['findAll']({'attributes':['id','name',_0x1fed('0x2e'),'chatPause','faxPause',_0x1fed('0x2f'),_0x1fed('0x7'),_0x1fed('0x30'),_0x1fed('0x8'),_0x1fed('0x9'),'pauseType'],'where':{'id':{'$in':_['map'](_0x362b13,'id')}},'raw':!![]});})[_0x1fed('0x1b')](function(_0x254138){return _0x254138[_0x1fed('0x28')](function(_0x255891){var _0x3b9944=_[_0x1fed('0x31')](_0x362b13,['id',_0x255891['id']]);var _0x33802e=filterAgentAttributes(_0x3b9944);_[_0x1fed('0x32')](_0x255891,_0x33802e);_0x255891[_0x1fed('0x33')]=getAgentStatus(_0x255891);return _0x255891;});})['then'](function(_0x27f967){var _0x4e4bb8=sortAgentsByStatus(_0x27f967,_0x1cc720);return _['map'](_0x4e4bb8,'id');})['catch'](function(_0x406741){throw _0x406741;});}exports[_0x1fed('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x51e0dd){var _0x8fe7b9={'fields':[],'order':null};var _0x2ae057=_0x51e0dd[_0x1fed('0x35')](',');_0x8fe7b9[_0x1fed('0x36')]=_[_0x1fed('0xb')](_0x2ae057,function(_0x31dfa9){if(!_0x31dfa9[_0x1fed('0x2c')](_0x1fed('0x33'))){return!![];}_0x8fe7b9[_0x1fed('0x37')]=_[_0x1fed('0x38')](_0x31dfa9,'-')?'DESC':_0x1fed('0x39');return![];});return _0x8fe7b9;}exports[_0x1fed('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x191184){if(_0x191184[_0x1fed('0x2c')](_0x1fed('0x2e'))&&!_0x191184[_0x1fed('0x2c')](_0x1fed('0x3b'))){var _0x24ad61=_0x191184[_0x1fed('0x3c')](0x0,_0x191184[_0x1fed('0x3d')]('fullname'));_0x191184+=','+_0x24ad61+'internal';}return _0x191184;}exports[_0x1fed('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x1d78fd,_0x7e8826){var _0x4caca4=_0x1d78fd['sort'](function(_0x5cb0de,_0x43ed8d){if(_0x5cb0de[_0x1fed('0x33')]===_0x43ed8d[_0x1fed('0x33')]){if(_0x5cb0de[_0x1fed('0x33')]===_0x1fed('0x22')){if(_0x7e8826===_0x1fed('0x3f')){return(_0x5cb0de[_0x1fed('0x40')]||'')<(_0x43ed8d[_0x1fed('0x40')]||'')||_0x5cb0de[_0x1fed('0x2e')][_0x1fed('0x41')]()>_0x43ed8d[_0x1fed('0x2e')][_0x1fed('0x41')]()?0x1:-0x1;}else{return(_0x5cb0de[_0x1fed('0x40')]||'')<(_0x43ed8d[_0x1fed('0x40')]||'')||_0x5cb0de['fullname']['toLowerCase']()>_0x43ed8d['fullname'][_0x1fed('0x41')]()?-0x1:0x1;}}else{if(_0x7e8826===_0x1fed('0x3f')){return _0x5cb0de[_0x1fed('0x2e')]['toLowerCase']()<_0x43ed8d[_0x1fed('0x2e')][_0x1fed('0x41')]()?0x1:-0x1;}else{return _0x5cb0de['fullname']['toLowerCase']()<_0x43ed8d['fullname'][_0x1fed('0x41')]()?-0x1:0x1;}}}else{if(_0x7e8826===_0x1fed('0x3f')){return _0x5cb0de['globalStatus']<_0x43ed8d[_0x1fed('0x33')]?0x1:-0x1;}else{return _0x5cb0de[_0x1fed('0x33')]<_0x43ed8d[_0x1fed('0x33')]?-0x1:0x1;}}});return _0x4caca4;}exports[_0x1fed('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x5eea95){var _0x5f0770=[_0x1fed('0x43'),'online',_0x1fed('0x44'),_0x1fed('0x45'),_0x1fed('0x40'),_0x1fed('0x45'),'internal',_0x1fed('0x46'),_0x1fed('0x5'),_0x1fed('0x7'),_0x1fed('0x2f'),_0x1fed('0x30'),'whatsappPause',_0x1fed('0x6'),'voicePause',_0x1fed('0x47'),_0x1fed('0x48'),_0x1fed('0x49'),_0x1fed('0x4a'),_0x1fed('0x4b'),_0x1fed('0x4c'),_0x1fed('0x4d'),_0x1fed('0x4e'),_0x1fed('0x4f'),_0x1fed('0x50'),_0x1fed('0x51'),_0x1fed('0x52'),_0x1fed('0x13'),_0x1fed('0x16'),'mailStatus',_0x1fed('0x17'),'whatsappStatus','faxStatus',_0x1fed('0x12'),_0x1fed('0x53'),_0x1fed('0x54'),_0x1fed('0x55'),_0x1fed('0x56'),_0x1fed('0x57'),'faxStatusTime',_0x1fed('0x58'),_0x1fed('0x59'),_0x1fed('0x5a'),_0x1fed('0x5b'),_0x1fed('0x5c'),'phoneBarEnableAutomaticScreenRecording','routealias'];var _0x1184c1=[_0x1fed('0x5'),'openchannelPause',_0x1fed('0x2f'),_0x1fed('0x30'),_0x1fed('0x9'),'faxPause',_0x1fed('0x8'),'online'];var _0x294e7c=_(_0x5eea95)[_0x1fed('0x5d')](_0x1184c1)[_0x1fed('0x5e')](_0x5f0770)[_0x1fed('0x2b')]();return _0x294e7c;}exports[_0x1fed('0x5f')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 275e401..51f7432 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 _0x7e97=['find','merge','pick','initializeQueues','lodash','client','http','loggedIn','waiting','inUse','loggedInDb','notInUse','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','voice','startCase','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','concat','outbound','map','get','paused','available'];(function(_0x48a17b,_0x15fe4b){var _0x3170db=function(_0x46bee6){while(--_0x46bee6){_0x48a17b['push'](_0x48a17b['shift']());}};_0x3170db(++_0x15fe4b);}(_0x7e97,0x1da));var _0x77e9=function(_0x25e4a1,_0x8b6b53){_0x25e4a1=_0x25e4a1-0x0;var _0xaa02e=_0x7e97[_0x25e4a1];return _0xaa02e;};'use strict';var _=require(_0x77e9('0x0'));var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson[_0x77e9('0x1')][_0x77e9('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x77e9('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x77e9('0x3'),'paused',_0x77e9('0x4')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x77e9('0x5'),'invalid',_0x77e9('0x6'),_0x77e9('0x7'),'onHold',_0x77e9('0x8'),_0x77e9('0x9'),_0x77e9('0xa'),_0x77e9('0xb'),_0x77e9('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x77e9('0xd'),_0x77e9('0xe'),_0x77e9('0xf'),_0x77e9('0x10'),'dialActive',_0x77e9('0x11'),_0x77e9('0x12'),_0x77e9('0x13'),_0x77e9('0x14'),_0x77e9('0x15'),_0x77e9('0x16'),_0x77e9('0x17'),_0x77e9('0x18'),_0x77e9('0x19'),_0x77e9('0x1a'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x77e9('0x1b'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x77e9('0x1c'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x2eca62,_0x4e97df){var _0x4fe38a=_0x4e97df===_0x77e9('0x1d')?amiClient:routingClient;return _0x4fe38a['request'](_[_0x77e9('0x1e')](_0x4e97df)+'Queues',_0x2eca62)[_0x77e9('0x1f')](function(_0x2b553c){if(_0x2b553c['error'])throw new Error(util[_0x77e9('0x20')](_0x77e9('0x21'),_0x4e97df));return _0x2b553c['result'];})[_0x77e9('0x22')](function(_0x163680){throw _0x163680;});}exports[_0x77e9('0x23')]=getRealtimeQueues;function initializeQueues(_0x58312c,_0x13bdb2,_0x26dbe1,_0xbca22b){var _0x65b7f1=DEFAULT_QUEUE_ATTRIBUTES;if(_0x26dbe1===_0x77e9('0x1d')){if(_0xbca22b===_0x77e9('0x24')){_0x65b7f1=_0x65b7f1[_0x77e9('0x25')](VOICE_QUEUE_ATTRIBUTES);}else if(_0xbca22b===_0x77e9('0x26')){_0x65b7f1=_0x65b7f1['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x58312c[_0x77e9('0x27')](function(_0x4833c9){var _0xeba371=_0x4833c9[_0x77e9('0x28')]({'plain':!![]});_0xeba371[_0x77e9('0x29')]=0x0;_0xeba371[_0x77e9('0x6')]=0x0;_0xeba371[_0x77e9('0x3')]=0x0;_0xeba371[_0x77e9('0x2a')]=0x0;_0xeba371[_0x77e9('0x4')]=0x0;if(_0x26dbe1===_0x77e9('0x1d')){_0xeba371['talking']=0x0;_0xeba371['busy']=0x0;if(_0xbca22b===_0x77e9('0x26')){_0xeba371['pTalking']=0x0;_0xeba371[_0x77e9('0xe')]=0x0;}}var _0x4239aa=_[_0x77e9('0x2b')](_0x13bdb2,['id',_0xeba371['id']]);if(_0x4239aa){_[_0x77e9('0x2c')](_0xeba371,_[_0x77e9('0x2d')](_0x4239aa,_0x65b7f1));}return _0xeba371;});}exports[_0x77e9('0x2e')]=initializeQueues; \ No newline at end of file +var _0xa427=['erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','voice','request','startCase','Queues','then','error','getRealtimeQueues','concat','outbound','map','loggedIn','find','merge','pick','initializeQueues','lodash','jayson/promise','http','available','paused','waiting','busy','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive'];(function(_0x35f4a1,_0x4160bf){var _0x3b2175=function(_0x5d7718){while(--_0x5d7718){_0x35f4a1['push'](_0x35f4a1['shift']());}};_0x3b2175(++_0x4160bf);}(_0xa427,0xa8));var _0x7a42=function(_0x1392e0,_0x27b711){_0x1392e0=_0x1392e0-0x0;var _0x175280=_0xa427[_0x1392e0];return _0x175280;};'use strict';var _=require(_0x7a42('0x0'));var jayson=require(_0x7a42('0x1'));var util=require('util');var amiClient=jayson['client'][_0x7a42('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x7a42('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7a42('0x3'),'loggedIn',_0x7a42('0x4'),_0x7a42('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x7a42('0x6'),'inUse',_0x7a42('0x7'),_0x7a42('0x8'),_0x7a42('0x9'),_0x7a42('0xa'),_0x7a42('0xb'),_0x7a42('0xc'),_0x7a42('0xd'),'unavailable',_0x7a42('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x7a42('0xf'),_0x7a42('0x10'),_0x7a42('0x11'),_0x7a42('0x12'),_0x7a42('0x13'),_0x7a42('0x14'),_0x7a42('0x15'),_0x7a42('0x16'),_0x7a42('0x17'),_0x7a42('0x18'),_0x7a42('0x19'),'erlangAbandonmentRate',_0x7a42('0x1a'),_0x7a42('0x1b'),_0x7a42('0x1c'),'dialPredictiveIntervalMinThreshold',_0x7a42('0x1d'),_0x7a42('0x1e'),'predictiveIntervalAnsweredCalls',_0x7a42('0x1f'),'predictiveIntervalDroppedCallsCallersExit',_0x7a42('0x20'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x15386b,_0x4e4de7){var _0x3bb841=_0x4e4de7===_0x7a42('0x21')?amiClient:routingClient;return _0x3bb841[_0x7a42('0x22')](_[_0x7a42('0x23')](_0x4e4de7)+_0x7a42('0x24'),_0x15386b)[_0x7a42('0x25')](function(_0x256361){if(_0x256361[_0x7a42('0x26')])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x4e4de7));return _0x256361['result'];})['catch'](function(_0x4781d9){throw _0x4781d9;});}exports[_0x7a42('0x27')]=getRealtimeQueues;function initializeQueues(_0x1826a8,_0x573e79,_0x4a6fd8,_0x1ee530){var _0x593447=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4a6fd8===_0x7a42('0x21')){if(_0x1ee530==='inbound'){_0x593447=_0x593447[_0x7a42('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1ee530===_0x7a42('0x29')){_0x593447=_0x593447[_0x7a42('0x28')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1826a8[_0x7a42('0x2a')](function(_0x2cfb44){var _0x197af2=_0x2cfb44['get']({'plain':!![]});_0x197af2[_0x7a42('0x4')]=0x0;_0x197af2[_0x7a42('0x8')]=0x0;_0x197af2[_0x7a42('0x2b')]=0x0;_0x197af2[_0x7a42('0x3')]=0x0;_0x197af2[_0x7a42('0x5')]=0x0;if(_0x4a6fd8===_0x7a42('0x21')){_0x197af2[_0x7a42('0xd')]=0x0;_0x197af2[_0x7a42('0x6')]=0x0;if(_0x1ee530===_0x7a42('0x29')){_0x197af2[_0x7a42('0xf')]=0x0;_0x197af2[_0x7a42('0x10')]=0x0;}}var _0x139e8c=_[_0x7a42('0x2c')](_0x573e79,['id',_0x197af2['id']]);if(_0x139e8c){_[_0x7a42('0x2d')](_0x197af2,_[_0x7a42('0x2e')](_0x139e8c,_0x593447));}return _0x197af2;});}exports[_0x7a42('0x2f')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index c5fbe10..a703e47 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(_0x57db3a,_0x32dc3f){var _0x18dc71=function(_0x426649){while(--_0x426649){_0x57db3a['push'](_0x57db3a['shift']());}};_0x18dc71(++_0x32dc3f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +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(_0x55b087,_0x2e94fa){var _0x583d66=function(_0x1fde73){while(--_0x1fde73){_0x55b087['push'](_0x55b087['shift']());}};_0x583d66(++_0x2e94fa);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 53c69bb..9ee3420 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 _0x400e=['../environment','networkInterfaces','orderBy','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','execSync'];(function(_0x10ab81,_0x2586c5){var _0x19a896=function(_0xf97ea8){while(--_0xf97ea8){_0x10ab81['push'](_0x10ab81['shift']());}};_0x19a896(++_0x2586c5);}(_0x400e,0x85));var _0xe400=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x400e[_0x2a5099];return _0x2802f1;};'use strict';var _=require(_0xe400('0x0'));var os=require('os');var crypto=require(_0xe400('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xe400('0x2')];var config=require(_0xe400('0x3'));function getInterfaces(){var _0x125a0f=[];var _0x2f21f7=os[_0xe400('0x4')]();var _0x11526b=_[_0xe400('0x5')](_['keys'](_0x2f21f7));for(var _0x4f673b=0x0;_0x4f673b<_0x11526b['length'];_0x4f673b++){var _0x177144=_0x2f21f7[_0x11526b[_0x4f673b]]['filter'](function(_0x3156ff){return _0x3156ff[_0xe400('0x6')]===_0xe400('0x7')&&_0x3156ff[_0xe400('0x8')]===![];});_0x125a0f=_0x125a0f['concat'](_0x177144);}return _0x125a0f;}function getFirstInterface(){var _0x185691=_[_0xe400('0x9')](getInterfaces());return{'macAddress':_0x185691&&_0x185691['mac']?_0x185691[_0xe400('0xa')]:_0xe400('0xb'),'ipAddress':_0x185691&&_0x185691[_0xe400('0xc')]?_0x185691[_0xe400('0xc')]:_0xe400('0xd')};}exports[_0xe400('0xe')]=getFirstInterface;function getCPUhash(){var _0x47d298=_[_0xe400('0x5')](os[_0xe400('0xf')]()[_0xe400('0x10')](function(_0x844271){return _0x844271['model'];}))[_0xe400('0x11')](':');return crypto[_0xe400('0x12')](_0xe400('0x13'))[_0xe400('0x14')](_0x47d298)[_0xe400('0x15')]('hex');}exports[_0xe400('0x16')]=function(){var _0x28600a=os[_0xe400('0x17')]();var _0x195cf1=/[0-9a-f-]{36}/;if(config[_0xe400('0x18')]&&_0x195cf1[_0xe400('0x19')](config[_0xe400('0x18')])){return config['licenseToken'];}else if(_0x28600a===_0xe400('0x1a')){return exec(_0xe400('0x1b'),{'encoding':_0xe400('0x1c')})[_0xe400('0x1d')]('\x0d\x0a','');}else{var _0x3e664a=getFirstInterface();var _0x2f3b3e=getCPUhash();var _0x2f53ac=_0x2f3b3e+'|'+os[_0xe400('0x1e')]()+'|'+_0x3e664a[_0xe400('0x1f')]+'|'+_0x3e664a[_0xe400('0x20')];var _0x583400=crypto['createHash'](_0xe400('0x13'))['update'](_0x2f53ac)[_0xe400('0x15')]('hex');return _0x583400[_0xe400('0x21')](0x0,0x8)+'-'+_0x583400[_0xe400('0x21')](0x8,0xc)+'-'+_0x583400[_0xe400('0x21')](0xc,0x10)+'-'+_0x583400[_0xe400('0x21')](0x10,0x14)+'-'+_0x583400[_0xe400('0x21')](0x14);}}; \ No newline at end of file +var _0xa1b1=['getFirstInterface','map','model','join','createHash','digest','getUuid','licenseToken','utf8','replace','hostname','ipAddress','update','hex','substring','lodash','crypto','execSync','../environment','networkInterfaces','orderBy','keys','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x410344,_0x11c039){var _0x210ff4=function(_0x24501a){while(--_0x24501a){_0x410344['push'](_0x410344['shift']());}};_0x210ff4(++_0x11c039);}(_0xa1b1,0x15f));var _0x1a1b=function(_0x4f526c,_0x6c4dbe){_0x4f526c=_0x4f526c-0x0;var _0x38a51e=_0xa1b1[_0x4f526c];return _0x38a51e;};'use strict';var _=require(_0x1a1b('0x0'));var os=require('os');var crypto=require(_0x1a1b('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x1a1b('0x2')];var config=require(_0x1a1b('0x3'));function getInterfaces(){var _0x1df566=[];var _0x138040=os[_0x1a1b('0x4')]();var _0x212bfe=_[_0x1a1b('0x5')](_[_0x1a1b('0x6')](_0x138040));for(var _0x3edb16=0x0;_0x3edb16<_0x212bfe['length'];_0x3edb16++){var _0x140977=_0x138040[_0x212bfe[_0x3edb16]]['filter'](function(_0x45f193){return _0x45f193['family']==='IPv4'&&_0x45f193[_0x1a1b('0x7')]===![];});_0x1df566=_0x1df566[_0x1a1b('0x8')](_0x140977);}return _0x1df566;}function getFirstInterface(){var _0x24774c=_['head'](getInterfaces());return{'macAddress':_0x24774c&&_0x24774c[_0x1a1b('0x9')]?_0x24774c[_0x1a1b('0x9')]:_0x1a1b('0xa'),'ipAddress':_0x24774c&&_0x24774c[_0x1a1b('0xb')]?_0x24774c[_0x1a1b('0xb')]:_0x1a1b('0xc')};}exports[_0x1a1b('0xd')]=getFirstInterface;function getCPUhash(){var _0x268b2a=_[_0x1a1b('0x5')](os['cpus']()[_0x1a1b('0xe')](function(_0x1fbce4){return _0x1fbce4[_0x1a1b('0xf')];}))[_0x1a1b('0x10')](':');return crypto[_0x1a1b('0x11')]('md5')['update'](_0x268b2a)[_0x1a1b('0x12')]('hex');}exports[_0x1a1b('0x13')]=function(){var _0x4466a3=os['platform']();var _0x2daca8=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x2daca8['test'](config[_0x1a1b('0x14')])){return config[_0x1a1b('0x14')];}else if(_0x4466a3==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x1a1b('0x15')})[_0x1a1b('0x16')]('\x0d\x0a','');}else{var _0x2251a7=getFirstInterface();var _0x4eb179=getCPUhash();var _0x530ceb=_0x4eb179+'|'+os[_0x1a1b('0x17')]()+'|'+_0x2251a7['macAddress']+'|'+_0x2251a7[_0x1a1b('0x18')];var _0x6a7859=crypto[_0x1a1b('0x11')]('md5')[_0x1a1b('0x19')](_0x530ceb)[_0x1a1b('0x12')](_0x1a1b('0x1a'));return _0x6a7859[_0x1a1b('0x1b')](0x0,0x8)+'-'+_0x6a7859[_0x1a1b('0x1b')](0x8,0xc)+'-'+_0x6a7859[_0x1a1b('0x1b')](0xc,0x10)+'-'+_0x6a7859['substring'](0x10,0x14)+'-'+_0x6a7859['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 88df488..182c852 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 _0x43ee=['spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','../../mysqldb','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate'];(function(_0x5f4501,_0x418f04){var _0x16f4e9=function(_0x2a6f00){while(--_0x2a6f00){_0x5f4501['push'](_0x5f4501['shift']());}};_0x16f4e9(++_0x418f04);}(_0x43ee,0xa6));var _0xe43e=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0x43ee[_0x31a37b];return _0x49ae16;};'use strict';var util=require(_0xe43e('0x0'));var moment=require(_0xe43e('0x1'));var rp=require(_0xe43e('0x2'));var BPromise=require(_0xe43e('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xe43e('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xe43e('0x5'))(_0xe43e('0x6'));var HOST=_0xe43e('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x21fe38){return new BPromise(function(_0x3c3bfc,_0x302ff9){var _0x377af7=util[_0xe43e('0x8')](_0xe43e('0x9'),HOST,_0x21fe38,module['exports']['version']);if(oldToken){_0x377af7=util[_0xe43e('0x8')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x21fe38,module[_0xe43e('0xa')][_0xe43e('0xb')],oldToken);}var _0x33991d={'uri':_0x377af7,'method':_0xe43e('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x33991d)[_0xe43e('0xd')](function(_0x444f08){_0x3c3bfc(_0x444f08);})['catch'](function(_0x3ca079){_0x302ff9(_0x3ca079);});});}function manageLicense(_0x234533,_0x2b1829){var _0x26e7d0=_0x2b1829[_0xe43e('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x26e7d0[_0xe43e('0xf')]!==_0x234533&&!_0x26e7d0[_0xe43e('0x10')]){oldToken=_0x26e7d0[_0xe43e('0xf')];}httpRequest(_0x234533)['then'](function(_0x29b542){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x29b542[_0xe43e('0x11')]){isOldTokenSent=![];if(!_0x26e7d0[_0xe43e('0x6')]&&_0x26e7d0[_0xe43e('0x6')]!=_0x29b542[_0xe43e('0x6')]||_0x26e7d0['license']&&_0x26e7d0[_0xe43e('0x10')]){logger['info'](_0xe43e('0x12'));}if(_0x26e7d0[_0xe43e('0x6')]&&!_0x26e7d0[_0xe43e('0x10')]&&_0x26e7d0[_0xe43e('0x6')]!=_0x29b542['license']){logger[_0xe43e('0x13')](_0xe43e('0x14'));}if(_0x26e7d0[_0xe43e('0x6')]&&!_0x26e7d0[_0xe43e('0x10')]&&_0x26e7d0[_0xe43e('0x6')]==_0x29b542['license']){return _0x2b1829;}return _0x2b1829[_0xe43e('0x15')]({'data1':_0x234533,'data2':null,'license':_0x29b542[_0xe43e('0x6')]});}else{if(_0x29b542[_0xe43e('0x6')]||_0x26e7d0[_0xe43e('0x6')]){if(!_0x26e7d0['data2']){if(_0x26e7d0[_0xe43e('0xf')]==_0x234533){GRAY_PERIOD_REASON=_0xe43e('0x16');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xe43e('0x17');logger[_0xe43e('0x13')](_0xe43e('0x18'),_0x26e7d0[_0xe43e('0xf')],_0x234533);}logger[_0xe43e('0x13')](_0xe43e('0x19'),GRAY_PERIOD_REASON[_0xe43e('0x1a')](),moment()[_0xe43e('0x8')](_0xe43e('0x1b')));return _0x2b1829[_0xe43e('0x15')]({'data2':encryptor[_0xe43e('0x1c')](moment()[_0xe43e('0x8')](_0xe43e('0x1b')))});}else{if(moment()['diff'](encryptor[_0xe43e('0x1d')](_0x26e7d0[_0xe43e('0x10')]),_0xe43e('0x1e'))>DAYS){logger[_0xe43e('0x13')](_0xe43e('0x1f'),moment()[_0xe43e('0x8')](_0xe43e('0x1b')));isOldTokenSent=![];return _0x2b1829['update']({'data1':_0x234533,'data2':null,'license':null});}}}else{if(_0x26e7d0[_0xe43e('0xf')]!=_0x234533){logger[_0xe43e('0x13')](_0xe43e('0x18'),_0x26e7d0['data1'],_0x234533);return _0x2b1829[_0xe43e('0x15')]({'data1':_0x234533,'data2':null,'license':null});}}}return _0x2b1829;})[_0xe43e('0xd')](function(_0x1e6ff8){_0x2b1829=_0x1e6ff8;})[_0xe43e('0x20')](function(_0xadb47d){logger[_0xe43e('0x21')](_0xadb47d[_0xe43e('0x22')]);})[_0xe43e('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xe43e('0x24')](),_0x2b1829);},TIME);});}function defaultLicense(){var _0x181571=hardware['getUuid']();if(_0x181571){return db[_0xe43e('0x25')][_0xe43e('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x181571}})[_0xe43e('0x27')](function(_0x5a5ace,_0x194d9c){logger[_0xe43e('0x13')](_0xe43e('0x28'),_0x181571);manageLicense(_0x181571,_0x5a5ace);})[_0xe43e('0x20')](function(_0x46d1a4){logger[_0xe43e('0x21')](_0x46d1a4['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xb654=['exports','GET','then','catch','get','data1','data2','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s'];(function(_0x114416,_0x18623e){var _0x524545=function(_0x40630e){while(--_0x40630e){_0x114416['push'](_0x114416['shift']());}};_0x524545(++_0x18623e);}(_0xb654,0x1b9));var _0x4b65=function(_0x389ba2,_0x4a817b){_0x389ba2=_0x389ba2-0x0;var _0x38bcca=_0xb654[_0x389ba2];return _0x38bcca;};'use strict';var util=require(_0x4b65('0x0'));var moment=require(_0x4b65('0x1'));var rp=require(_0x4b65('0x2'));var BPromise=require(_0x4b65('0x3'));var pkginfo=require(_0x4b65('0x4'))(module,_0x4b65('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x4b65('0x6'));var hardware=require('./hardware');var logger=require('../logger')('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3dc90c){return new BPromise(function(_0x20f792,_0x20dfbf){var _0x215f71=util[_0x4b65('0x7')](_0x4b65('0x8'),HOST,_0x3dc90c,module['exports'][_0x4b65('0x5')]);if(oldToken){_0x215f71=util[_0x4b65('0x7')](_0x4b65('0x9'),HOST,_0x3dc90c,module[_0x4b65('0xa')]['version'],oldToken);}var _0x4d9fa5={'uri':_0x215f71,'method':_0x4b65('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x4d9fa5)[_0x4b65('0xc')](function(_0x1918b3){_0x20f792(_0x1918b3);})[_0x4b65('0xd')](function(_0x58acce){_0x20dfbf(_0x58acce);});});}function manageLicense(_0x4e5837,_0x4f7d00){var _0x51d4bd=_0x4f7d00[_0x4b65('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x51d4bd[_0x4b65('0xf')]!==_0x4e5837&&!_0x51d4bd[_0x4b65('0x10')]){oldToken=_0x51d4bd['data1'];}httpRequest(_0x4e5837)[_0x4b65('0xc')](function(_0x36db81){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x36db81['active']){isOldTokenSent=![];if(!_0x51d4bd[_0x4b65('0x11')]&&_0x51d4bd[_0x4b65('0x11')]!=_0x36db81[_0x4b65('0x11')]||_0x51d4bd[_0x4b65('0x11')]&&_0x51d4bd[_0x4b65('0x10')]){logger[_0x4b65('0x12')](_0x4b65('0x13'));}if(_0x51d4bd[_0x4b65('0x11')]&&!_0x51d4bd[_0x4b65('0x10')]&&_0x51d4bd[_0x4b65('0x11')]!=_0x36db81[_0x4b65('0x11')]){logger[_0x4b65('0x12')](_0x4b65('0x14'));}if(_0x51d4bd[_0x4b65('0x11')]&&!_0x51d4bd[_0x4b65('0x10')]&&_0x51d4bd[_0x4b65('0x11')]==_0x36db81['license']){return _0x4f7d00;}return _0x4f7d00[_0x4b65('0x15')]({'data1':_0x4e5837,'data2':null,'license':_0x36db81[_0x4b65('0x11')]});}else{if(_0x36db81[_0x4b65('0x11')]||_0x51d4bd[_0x4b65('0x11')]){if(!_0x51d4bd[_0x4b65('0x10')]){if(_0x51d4bd[_0x4b65('0xf')]==_0x4e5837){GRAY_PERIOD_REASON=_0x4b65('0x16');logger[_0x4b65('0x12')](_0x4b65('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x4b65('0x12')](_0x4b65('0x18'),_0x51d4bd[_0x4b65('0xf')],_0x4e5837);}logger['info'](_0x4b65('0x19'),GRAY_PERIOD_REASON[_0x4b65('0x1a')](),moment()[_0x4b65('0x7')](_0x4b65('0x1b')));return _0x4f7d00[_0x4b65('0x15')]({'data2':encryptor[_0x4b65('0x1c')](moment()[_0x4b65('0x7')](_0x4b65('0x1b')))});}else{if(moment()[_0x4b65('0x1d')](encryptor[_0x4b65('0x1e')](_0x51d4bd['data2']),_0x4b65('0x1f'))>DAYS){logger[_0x4b65('0x12')](_0x4b65('0x20'),moment()[_0x4b65('0x7')](_0x4b65('0x1b')));isOldTokenSent=![];return _0x4f7d00[_0x4b65('0x15')]({'data1':_0x4e5837,'data2':null,'license':null});}}}else{if(_0x51d4bd[_0x4b65('0xf')]!=_0x4e5837){logger[_0x4b65('0x12')](_0x4b65('0x18'),_0x51d4bd[_0x4b65('0xf')],_0x4e5837);return _0x4f7d00['update']({'data1':_0x4e5837,'data2':null,'license':null});}}}return _0x4f7d00;})['then'](function(_0x4a2e81){_0x4f7d00=_0x4a2e81;})[_0x4b65('0xd')](function(_0x1246f6){logger['error'](_0x1246f6[_0x4b65('0x21')]);})[_0x4b65('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x4b65('0x23')](),_0x4f7d00);},TIME);});}function defaultLicense(){var _0x25cd3b=hardware[_0x4b65('0x23')]();if(_0x25cd3b){return db['License'][_0x4b65('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x25cd3b}})[_0x4b65('0x25')](function(_0x7d7060,_0x41723e){logger['info'](_0x4b65('0x26'),_0x25cd3b);manageLicense(_0x25cd3b,_0x7d7060);})[_0x4b65('0xd')](function(_0x491b2c){logger[_0x4b65('0x27')](_0x491b2c[_0x4b65('0x21')]);});}}exports[_0x4b65('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7514ecf..4283a5d 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 _0x38cc=['findAll','role','sequelize','col','count','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','add','days','grayReason','disabled','message'];(function(_0x2d1325,_0x1b8734){var _0x2cae1e=function(_0x123d8c){while(--_0x123d8c){_0x2d1325['push'](_0x2d1325['shift']());}};_0x2cae1e(++_0x1b8734);}(_0x38cc,0x1db));var _0xc38c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38cc[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xc38c('0x0'));var _=require(_0xc38c('0x1'));var moment=require(_0xc38c('0x2'));var BPromise=require(_0xc38c('0x3'));var hardware=require('./hardware');var encryptor=require(_0xc38c('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc38c('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xc38c('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc38c('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x38d0d2){return new BPromise(function(_0x48f3c2,_0x2e2498){return db[_0xc38c('0x8')][_0xc38c('0x9')](_['defaults'](_0x38d0d2,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3ec306){return checkLicense(_0x3ec306,null);})[_0xc38c('0xa')](function(_0x141110){_0x48f3c2(_0x141110);return;})[_0xc38c('0xb')](function(_0x385afb){_0x2e2498(_0x385afb);});});}function checkLicense(_0x14404a,_0x2120b5){if(!_0x14404a){demoLicense[_0xc38c('0xc')]=_0x14404a[_0xc38c('0xd')];return demoLicense;}try{var _0x1eda5a=_0x2120b5||_0x14404a[_0xc38c('0xe')];if(_[_0xc38c('0xf')](_0x1eda5a)){throw new Error(_0xc38c('0x10'));}var _0x1b54ae=_0x14404a[_0xc38c('0xd')];var _0x5c7773=_0x14404a['data2'];var _0x3e170d=_0x1b54ae[_0xc38c('0x11')]('-')[0x4];var _0x226256=_0x1b54ae[_0xc38c('0x11')]('-')[0x0];var _0x2f8481=encryptor[_0xc38c('0x12')](_0x1eda5a,util['format'](_0xc38c('0x13'),_0x3e170d,_0x1b54ae,_0x226256));var _0x2c2f81=JSON[_0xc38c('0x14')](_0x2f8481);_0x2c2f81[_0xc38c('0x15')]=![];_0x2c2f81['uuid']=_0x1b54ae;_0x2c2f81[_0xc38c('0x16')]=hardware[_0xc38c('0x6')]();if(_0x5c7773){var _0x64f1dd=encryptor['decryptString'](_0x5c7773);_0x2c2f81[_0xc38c('0x17')]=_0x64f1dd;_0x2c2f81['deadline']=moment(_0x64f1dd)[_0xc38c('0x18')](0x7,_0xc38c('0x19'))['format']();_0x2c2f81[_0xc38c('0x1a')]=_0x2c2f81[_0xc38c('0xc')]!=_0x2c2f81[_0xc38c('0x16')]?'changed':_0xc38c('0x1b');}return _0x2c2f81;}catch(_0x46a51f){breakingLicense[_0xc38c('0xc')]=_0x14404a['data1'];breakingLicense[_0xc38c('0x1c')]=_0x46a51f[_0xc38c('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3d4938,_0x5172e4){getLicense()[_0xc38c('0xa')](function(_0x58596f){return db['User'][_0xc38c('0x1d')]({'attributes':[_0xc38c('0x1e'),[db['sequelize']['fn']('COUNT',db[_0xc38c('0x1f')][_0xc38c('0x20')]('role')),_0xc38c('0x21')]],'group':_0xc38c('0x1e'),'where':{'role':{'$or':[_0xc38c('0x22'),_0xc38c('0x23'),_0xc38c('0x24')]}},'raw':!![]})[_0xc38c('0xa')](function(_0x239ef4){var _0x2251e0={'user':_0x58596f['users']||0x0,'telephone':_0x58596f[_0xc38c('0x25')]||0x0};_0x239ef4[_0xc38c('0x26')](function(_0x4f0bc9){var _0x297072=_0x4f0bc9[_0xc38c('0x1e')]==='admin'?_0xc38c('0x23'):_0x4f0bc9[_0xc38c('0x1e')];_0x2251e0[_0x297072]-=_0x4f0bc9[_0xc38c('0x21')];if(_0x2251e0[_0x297072]<0x0)_0x2251e0[_0x297072]=0x0;});_0x3d4938(_0x2251e0);return;});})['catch'](function(_0x2bccdd){_0x5172e4(_0x2bccdd);});});}function checkUserLimits(_0x3b2ed2){return new BPromise(function(_0x5cf68c,_0xf7d5ce){getLimits()[_0xc38c('0xa')](function(_0x3e5ca0){var _0x194d3d=_[_0xc38c('0x27')](_[_0xc38c('0x28')](_0x3b2ed2,_0xc38c('0x1e')),[_0xc38c('0x22'),_0xc38c('0x23'),'telephone']);var _0x447be6=(_0x194d3d[_0xc38c('0x22')]||0x0)+(_0x194d3d[_0xc38c('0x23')]||0x0);var _0x1b413d=_0x194d3d['telephone']||0x0;if(_0x447be6>_0x3e5ca0[_0xc38c('0x23')])return _0xf7d5ce('License\x20limit\x20reached\x20for\x20users');if(_0x1b413d>_0x3e5ca0[_0xc38c('0x24')])return _0xf7d5ce(_0xc38c('0x29'));return _0x5cf68c();})['catch'](function(_0x427d49){_0xf7d5ce(_0x427d49);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe7b0=['gray','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','telephone','telephones','forEach','admin','user','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse','machineUuid'];(function(_0x5ca6a3,_0x48837d){var _0x31884a=function(_0x46478f){while(--_0x46478f){_0x5ca6a3['push'](_0x5ca6a3['shift']());}};_0x31884a(++_0x48837d);}(_0xe7b0,0x6c));var _0x0e7b=function(_0x2d9e90,_0x5dcc72){_0x2d9e90=_0x2d9e90-0x0;var _0x54695f=_0xe7b0[_0x2d9e90];return _0x54695f;};'use strict';var util=require(_0x0e7b('0x0'));var _=require(_0x0e7b('0x1'));var moment=require(_0x0e7b('0x2'));var BPromise=require(_0x0e7b('0x3'));var hardware=require(_0x0e7b('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x0e7b('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e7b('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x0e7b('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e7b('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0e7b('0x8'),'machineUuid':hardware[_0x0e7b('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x8c7218){return new BPromise(function(_0xa81100,_0x2114cd){return db['License'][_0x0e7b('0x9')](_['defaults'](_0x8c7218,{'raw':!![],'where':{'id':0x1}}))[_0x0e7b('0xa')](function(_0x312d97){return checkLicense(_0x312d97,null);})[_0x0e7b('0xa')](function(_0x101ee4){_0xa81100(_0x101ee4);return;})[_0x0e7b('0xb')](function(_0x2be4fb){_0x2114cd(_0x2be4fb);});});}function checkLicense(_0x23960b,_0x96a97e){if(!_0x23960b){demoLicense[_0x0e7b('0xc')]=_0x23960b[_0x0e7b('0xd')];return demoLicense;}try{var _0x391398=_0x96a97e||_0x23960b[_0x0e7b('0xe')];if(_['isEmpty'](_0x391398)){throw new Error(_0x0e7b('0xf'));}var _0x35dc7b=_0x23960b[_0x0e7b('0xd')];var _0x18fdfd=_0x23960b['data2'];var _0x2d7b8b=_0x35dc7b['split']('-')[0x4];var _0x44e199=_0x35dc7b[_0x0e7b('0x10')]('-')[0x0];var _0x508aa9=encryptor[_0x0e7b('0x11')](_0x391398,util[_0x0e7b('0x12')]('%s:%s:%s',_0x2d7b8b,_0x35dc7b,_0x44e199));var _0x332d65=JSON[_0x0e7b('0x13')](_0x508aa9);_0x332d65['demo']=![];_0x332d65[_0x0e7b('0xc')]=_0x35dc7b;_0x332d65[_0x0e7b('0x14')]=hardware['getUuid']();if(_0x18fdfd){var _0x25d38d=encryptor[_0x0e7b('0x11')](_0x18fdfd);_0x332d65[_0x0e7b('0x15')]=_0x25d38d;_0x332d65['deadline']=moment(_0x25d38d)[_0x0e7b('0x16')](0x7,_0x0e7b('0x17'))['format']();_0x332d65[_0x0e7b('0x18')]=_0x332d65[_0x0e7b('0xc')]!=_0x332d65[_0x0e7b('0x14')]?_0x0e7b('0x19'):_0x0e7b('0x1a');}return _0x332d65;}catch(_0x5c61d2){breakingLicense[_0x0e7b('0xc')]=_0x23960b[_0x0e7b('0xd')];breakingLicense[_0x0e7b('0x1b')]=_0x5c61d2['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x358339,_0x29c36b){getLicense()[_0x0e7b('0xa')](function(_0x3f6ebd){return db[_0x0e7b('0x1c')][_0x0e7b('0x1d')]({'attributes':[_0x0e7b('0x1e'),[db[_0x0e7b('0x1f')]['fn'](_0x0e7b('0x20'),db[_0x0e7b('0x1f')]['col'](_0x0e7b('0x1e'))),_0x0e7b('0x21')]],'group':_0x0e7b('0x1e'),'where':{'role':{'$or':['admin','user',_0x0e7b('0x22')]}},'raw':!![]})[_0x0e7b('0xa')](function(_0x4571f3){var _0x286303={'user':_0x3f6ebd['users']||0x0,'telephone':_0x3f6ebd[_0x0e7b('0x23')]||0x0};_0x4571f3[_0x0e7b('0x24')](function(_0x57d9c8){var _0x2dbb24=_0x57d9c8[_0x0e7b('0x1e')]===_0x0e7b('0x25')?_0x0e7b('0x26'):_0x57d9c8[_0x0e7b('0x1e')];_0x286303[_0x2dbb24]-=_0x57d9c8[_0x0e7b('0x21')];if(_0x286303[_0x2dbb24]<0x0)_0x286303[_0x2dbb24]=0x0;});_0x358339(_0x286303);return;});})[_0x0e7b('0xb')](function(_0x5091f8){_0x29c36b(_0x5091f8);});});}function checkUserLimits(_0x539594){return new BPromise(function(_0x235a04,_0x537c49){getLimits()[_0x0e7b('0xa')](function(_0x580018){var _0x2c96bd=_[_0x0e7b('0x27')](_[_0x0e7b('0x28')](_0x539594,_0x0e7b('0x1e')),['admin',_0x0e7b('0x26'),_0x0e7b('0x22')]);var _0x509f64=(_0x2c96bd['admin']||0x0)+(_0x2c96bd[_0x0e7b('0x26')]||0x0);var _0x5eaea7=_0x2c96bd[_0x0e7b('0x22')]||0x0;if(_0x509f64>_0x580018['user'])return _0x537c49('License\x20limit\x20reached\x20for\x20users');if(_0x5eaea7>_0x580018[_0x0e7b('0x22')])return _0x537c49(_0x0e7b('0x29'));return _0x235a04();})[_0x0e7b('0xb')](function(_0xd84f57){_0x537c49(_0xd84f57);});});}module[_0x0e7b('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 7191673..3e082b1 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 _0xd4a2=['app-id','exports'];(function(_0x50095a,_0x345cdd){var _0xb9c806=function(_0x187a2d){while(--_0x187a2d){_0x50095a['push'](_0x50095a['shift']());}};_0xb9c806(++_0x345cdd);}(_0xd4a2,0x173));var _0x2d4a=function(_0x5eccb3,_0x13c1f3){_0x5eccb3=_0x5eccb3-0x0;var _0x499837=_0xd4a2[_0x5eccb3];return _0x499837;};'use strict';module[_0x2d4a('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x2d4a('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x0598=['http://localhost:9000','app-id','exports'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x0598,0x92));var _0x8059=function(_0x5c9c5f,_0x43bdaf){_0x5c9c5f=_0x5c9c5f-0x0;var _0x19e06b=_0x0598[_0x5c9c5f];return _0x19e06b;};'use strict';module[_0x8059('0x0')]={'DOMAIN':_0x8059('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x8059('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1e97968..bac42ae 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3199=['fileLogger','exports'];(function(_0x503f16,_0x222aaf){var _0x9e99bb=function(_0x109239){while(--_0x109239){_0x503f16['push'](_0x503f16['shift']());}};_0x9e99bb(++_0x222aaf);}(_0x3199,0xe8));var _0x9319=function(_0x57dc07,_0x2c9639){_0x57dc07=_0x57dc07-0x0;var _0xbad6a=_0x3199[_0x57dc07];return _0xbad6a;};'use strict';var fileLogger=require('../utils/loggers')[_0x9319('0x0')];module[_0x9319('0x1')]=fileLogger; \ No newline at end of file +var _0x8490=['exports','../utils/loggers','fileLogger'];(function(_0x3dcd6b,_0x9c4516){var _0x3ccf30=function(_0x20060b){while(--_0x20060b){_0x3dcd6b['push'](_0x3dcd6b['shift']());}};_0x3ccf30(++_0x9c4516);}(_0x8490,0x1bd));var _0x0849=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x8490[_0x46e363];return _0x3fb059;};'use strict';var fileLogger=require(_0x0849('0x0'))[_0x0849('0x1')];module[_0x0849('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f1fbc03..273b72b 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 _0x5eb0=['exports','path','../../config/environment','resolve','join','root','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','xdr','../../services/xdr/index.js'];(function(_0x152dd8,_0x44984a){var _0x54cb78=function(_0x6874db){while(--_0x6874db){_0x152dd8['push'](_0x152dd8['shift']());}};_0x54cb78(++_0x44984a);}(_0x5eb0,0x145));var _0x05eb=function(_0x40c3c0,_0x1494db){_0x40c3c0=_0x40c3c0-0x0;var _0x333733=_0x5eb0[_0x40c3c0];return _0x333733;};'use strict';var path=require(_0x05eb('0x0'));var cfg=require(_0x05eb('0x1'));var env={'NODE_PATH':path[_0x05eb('0x2')](path[_0x05eb('0x3')](cfg[_0x05eb('0x4')],_0x05eb('0x5')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0x05eb('0x6')),'env':env},{'name':_0x05eb('0x7'),'script':path[_0x05eb('0x3')](__dirname,_0x05eb('0x8')),'env':env},{'name':'agi','script':path[_0x05eb('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0x05eb('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0x05eb('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x05eb('0x9'),'script':path[_0x05eb('0x3')](__dirname,_0x05eb('0xa')),'env':env}]};module[_0x05eb('0xb')]=pm2config; \ No newline at end of file +var _0x0773=['../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../config/environment','join','root','legacy-libs','express','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','routing'];(function(_0x15542f,_0x3d79d6){var _0x3f2d03=function(_0x314be6){while(--_0x314be6){_0x15542f['push'](_0x15542f['shift']());}};_0x3f2d03(++_0x3d79d6);}(_0x0773,0xc6));var _0x3077=function(_0x1c2534,_0x5e911e){_0x1c2534=_0x1c2534-0x0;var _0xe2c63b=_0x0773[_0x1c2534];return _0xe2c63b;};'use strict';var path=require(_0x3077('0x0'));var cfg=require(_0x3077('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x3077('0x2')](cfg[_0x3077('0x3')],_0x3077('0x4')))};var pm2config={'apps':[{'name':_0x3077('0x5'),'script':path[_0x3077('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path['join'](__dirname,_0x3077('0x6')),'env':env},{'name':'agi','script':path[_0x3077('0x2')](__dirname,_0x3077('0x7')),'env':env},{'name':'email','script':path[_0x3077('0x2')](__dirname,_0x3077('0x8')),'env':env},{'name':_0x3077('0x9'),'script':path[_0x3077('0x2')](__dirname,_0x3077('0xa')),'env':env},{'name':_0x3077('0xb'),'script':path[_0x3077('0x2')](__dirname,_0x3077('0xc')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e3d0eef..e4ba451 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 _0x79b8=['dump','saved','bluebird','./config','connected','start','then','disconnect','stop','describe','delete'];(function(_0x42d5f0,_0x151b49){var _0x5d008f=function(_0x1a17ca){while(--_0x1a17ca){_0x42d5f0['push'](_0x42d5f0['shift']());}};_0x5d008f(++_0x151b49);}(_0x79b8,0x136));var _0x879b=function(_0x19a82a,_0x3ce198){_0x19a82a=_0x19a82a-0x0;var _0x1d4395=_0x79b8[_0x19a82a];return _0x1d4395;};'use strict';var pm2=require('pm2');var BPromise=require(_0x879b('0x0'));var config=require(_0x879b('0x1'));function connect(){return new BPromise(function(_0x364653,_0x38be41){return pm2['connect'](function(_0x3cf5bc){if(_0x3cf5bc){return _0x38be41(_0x3cf5bc);}return _0x364653(_0x879b('0x2'));});});};exports[_0x879b('0x3')]=function(_0x336bfe){return connect()[_0x879b('0x4')](function(){return new BPromise(function(_0x594f74,_0x223d40){return pm2['start'](_0x336bfe,function(_0x74290b,_0x17b8a8){if(_0x74290b){return _0x223d40(_0x74290b);}pm2[_0x879b('0x5')]();return _0x594f74(_0x17b8a8);});});});};exports['stop']=function(_0x12e588){return connect()[_0x879b('0x4')](function(){return new BPromise(function(_0x5a9d98,_0x97c544){return pm2[_0x879b('0x6')](_0x12e588,function(_0x1d2244,_0x58d4e3){if(_0x1d2244){return _0x97c544(_0x1d2244);}pm2[_0x879b('0x5')]();return _0x5a9d98(_0x58d4e3);});});});};exports['restart']=function(_0x4ad997){return connect()['then'](function(){return new BPromise(function(_0x3872f3,_0x265dc9){return pm2['restart'](_0x4ad997,function(_0x597e99,_0x20951e){if(_0x597e99){return _0x265dc9(_0x597e99);}pm2[_0x879b('0x5')]();return _0x3872f3(_0x20951e);});});});};exports['list']=function(){return connect()[_0x879b('0x4')](function(){return new BPromise(function(_0xbc7170,_0x20c6a2){return pm2['list'](function(_0x5a6470,_0x276b19){if(_0x5a6470){return _0x20c6a2(_0x5a6470);}pm2[_0x879b('0x5')]();return _0xbc7170(_0x276b19);});});});};exports[_0x879b('0x7')]=function(_0x3b35ba){return connect()['then'](function(){return new BPromise(function(_0x166c16,_0x1877de){return pm2[_0x879b('0x7')](_0x3b35ba,function(_0x4aae64,_0x242b05){if(_0x4aae64){return _0x1877de(_0x4aae64);}pm2[_0x879b('0x5')]();return _0x166c16(_0x242b05);});});});};exports[_0x879b('0x8')]=function(_0xdac71f){return connect()['then'](function(){return new BPromise(function(_0x225e1e,_0x4fe8b8){return pm2[_0x879b('0x8')](_0xdac71f,function(_0xe06f06,_0x286d05){if(_0xe06f06){return _0x4fe8b8(_0xe06f06);}pm2[_0x879b('0x5')]();return _0x225e1e(_0x286d05);});});});};exports['dump']=function(){return connect()[_0x879b('0x4')](function(){return new BPromise(function(_0x375150,_0x58bd20){return pm2[_0x879b('0x9')](function(_0x1c670d){if(_0x1c670d){return _0x58bd20(_0x1c670d);}return _0x375150(_0x879b('0xa'));});});});}; \ No newline at end of file +var _0x9628=['connect','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x219e91,_0x4db361){var _0x56151e=function(_0xf0180c){while(--_0xf0180c){_0x219e91['push'](_0x219e91['shift']());}};_0x56151e(++_0x4db361);}(_0x9628,0x193));var _0x8962=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x9628[_0x491a7f];return _0x3d8f44;};'use strict';var pm2=require(_0x8962('0x0'));var BPromise=require(_0x8962('0x1'));var config=require(_0x8962('0x2'));function connect(){return new BPromise(function(_0x20d29c,_0x30e5e0){return pm2[_0x8962('0x3')](function(_0x3a828c){if(_0x3a828c){return _0x30e5e0(_0x3a828c);}return _0x20d29c('connected');});});};exports[_0x8962('0x4')]=function(_0x22a6b8){return connect()[_0x8962('0x5')](function(){return new BPromise(function(_0x7d9da9,_0x4498f4){return pm2['start'](_0x22a6b8,function(_0x123002,_0x227f54){if(_0x123002){return _0x4498f4(_0x123002);}pm2[_0x8962('0x6')]();return _0x7d9da9(_0x227f54);});});});};exports[_0x8962('0x7')]=function(_0x4aabf7){return connect()[_0x8962('0x5')](function(){return new BPromise(function(_0x4fc3c8,_0x471260){return pm2[_0x8962('0x7')](_0x4aabf7,function(_0x20a882,_0x4c6859){if(_0x20a882){return _0x471260(_0x20a882);}pm2[_0x8962('0x6')]();return _0x4fc3c8(_0x4c6859);});});});};exports[_0x8962('0x8')]=function(_0x50c4d3){return connect()[_0x8962('0x5')](function(){return new BPromise(function(_0x3fe1d1,_0x4617b7){return pm2[_0x8962('0x8')](_0x50c4d3,function(_0x49da8c,_0x1822cb){if(_0x49da8c){return _0x4617b7(_0x49da8c);}pm2[_0x8962('0x6')]();return _0x3fe1d1(_0x1822cb);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0xa0aa7b,_0x44f0ae){return pm2[_0x8962('0x9')](function(_0x4ab11a,_0x4a7f9c){if(_0x4ab11a){return _0x44f0ae(_0x4ab11a);}pm2[_0x8962('0x6')]();return _0xa0aa7b(_0x4a7f9c);});});});};exports[_0x8962('0xa')]=function(_0x44f3af){return connect()[_0x8962('0x5')](function(){return new BPromise(function(_0x5ca64f,_0x3afa24){return pm2[_0x8962('0xa')](_0x44f3af,function(_0x4ebe87,_0x3d55d5){if(_0x4ebe87){return _0x3afa24(_0x4ebe87);}pm2[_0x8962('0x6')]();return _0x5ca64f(_0x3d55d5);});});});};exports[_0x8962('0xb')]=function(_0x44cd8d){return connect()[_0x8962('0x5')](function(){return new BPromise(function(_0x39c1bf,_0x5d9d59){return pm2[_0x8962('0xb')](_0x44cd8d,function(_0x27d547,_0x40c666){if(_0x27d547){return _0x5d9d59(_0x27d547);}pm2[_0x8962('0x6')]();return _0x39c1bf(_0x40c666);});});});};exports[_0x8962('0xc')]=function(){return connect()[_0x8962('0x5')](function(){return new BPromise(function(_0x265542,_0x2927f3){return pm2[_0x8962('0xc')](function(_0x5c97b7){if(_0x5c97b7){return _0x2927f3(_0x5c97b7);}return _0x265542(_0x8962('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 86c9dfc..9df15b2 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 _0x077e=['redis','defaults','localhost','socket.io-emitter','find','then','chatTimeout','ChatInteraction','length','info','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x4c0956,_0x5e0ea5){var _0x3bd256=function(_0x228668){while(--_0x228668){_0x4c0956['push'](_0x4c0956['shift']());}};_0x3bd256(++_0x5e0ea5);}(_0x077e,0x13c));var _0xe077=function(_0x1013ff,_0x5218ad){_0x1013ff=_0x1013ff-0x0;var _0xc00260=_0x077e[_0x1013ff];return _0xc00260;};'use strict';var _=require(_0xe077('0x0'));var moment=require(_0xe077('0x1'));var Redis=require(_0xe077('0x2'));var util=require(_0xe077('0x3'));var config=require(_0xe077('0x4'));var db=require(_0xe077('0x5'))['db'];var logger=require(_0xe077('0x6'))(_0xe077('0x7'));config[_0xe077('0x8')]=_[_0xe077('0x9')](config[_0xe077('0x8')],{'host':_0xe077('0xa'),'port':0x18eb});var io=require(_0xe077('0xb'))(new Redis(config['redis']));function closeInteractions(){var _0x5c33e9=0x0;var _0x54c941=[];return db['Setting'][_0xe077('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xe077('0xd')](function(_0xaed98f){_0x5c33e9=_0xaed98f[_0xe077('0xe')];if(_0x5c33e9){return db[_0xe077('0xf')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xaed98f['chatTimeout'],'minutes')}}});}else{return[];}})[_0xe077('0xd')](function(_0x3b08a4){if(_0x3b08a4&&_0x3b08a4[_0xe077('0x10')]){_0x54c941=_['map'](_0x3b08a4||[],'id');logger[_0xe077('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x54c941['join']());return db[_0xe077('0xf')]['update']({'closeReason':_0xe077('0x12'),'disposition':_0xe077('0x13'),'closed':!![],'closedAt':moment()[_0xe077('0x14')](_0xe077('0x15'))},{'where':{'id':_0x54c941}});}})['then'](function(){if(_0x54c941&&_0x54c941[_0xe077('0x10')]){logger[_0xe077('0x11')](_0xe077('0x16'),_0x54c941['join']());for(var _0x5d2580=0x0;_0x5d2580<_0x54c941[_0xe077('0x10')];_0x5d2580++){io[_0xe077('0x17')](_0xe077('0x18'),{'id':_0x54c941[_0x5d2580],'closed':!![]});}}})['catch'](function(_0x2846aa){logger['error'](_0xe077('0x19'),_0x2846aa?util['inspect'](_0x2846aa,{'showHidden':![],'depth':null}):'');});}exports[_0xe077('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3c33=['info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','map'];(function(_0x168b65,_0x25ed90){var _0x6e3ccb=function(_0x52a01b){while(--_0x52a01b){_0x168b65['push'](_0x168b65['shift']());}};_0x6e3ccb(++_0x25ed90);}(_0x3c33,0x9b));var _0x33c3=function(_0x557741,_0x43d009){_0x557741=_0x557741-0x0;var _0x4cd544=_0x3c33[_0x557741];return _0x4cd544;};'use strict';var _=require(_0x33c3('0x0'));var moment=require(_0x33c3('0x1'));var Redis=require(_0x33c3('0x2'));var util=require(_0x33c3('0x3'));var config=require(_0x33c3('0x4'));var db=require(_0x33c3('0x5'))['db'];var logger=require(_0x33c3('0x6'))(_0x33c3('0x7'));config['redis']=_['defaults'](config[_0x33c3('0x8')],{'host':_0x33c3('0x9'),'port':0x18eb});var io=require(_0x33c3('0xa'))(new Redis(config[_0x33c3('0x8')]));function closeInteractions(){var _0x412aac=0x0;var _0x393b71=[];return db['Setting'][_0x33c3('0xb')]({'raw':!![],'attributes':['id',_0x33c3('0xc')],'where':{'id':0x1}})[_0x33c3('0xd')](function(_0xbe178a){_0x412aac=_0xbe178a['chatTimeout'];if(_0x412aac){return db[_0x33c3('0xe')][_0x33c3('0xf')]({'raw':!![],'attributes':['id',_0x33c3('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x33c3('0x11')](_0xbe178a[_0x33c3('0xc')],'minutes')}}});}else{return[];}})[_0x33c3('0xd')](function(_0x58afe8){if(_0x58afe8&&_0x58afe8[_0x33c3('0x12')]){_0x393b71=_[_0x33c3('0x13')](_0x58afe8||[],'id');logger[_0x33c3('0x14')](_0x33c3('0x15'),_0x393b71[_0x33c3('0x16')]());return db[_0x33c3('0xe')][_0x33c3('0x17')]({'closeReason':_0x33c3('0x18'),'disposition':_0x33c3('0x19'),'closed':!![],'closedAt':moment()[_0x33c3('0x1a')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x393b71}});}})[_0x33c3('0xd')](function(){if(_0x393b71&&_0x393b71[_0x33c3('0x12')]){logger['info'](_0x33c3('0x1b'),_0x393b71[_0x33c3('0x16')]());for(var _0x1fcca5=0x0;_0x1fcca5<_0x393b71[_0x33c3('0x12')];_0x1fcca5++){io[_0x33c3('0x1c')](_0x33c3('0x1d'),{'id':_0x393b71[_0x1fcca5],'closed':!![]});}}})[_0x33c3('0x1e')](function(_0x520ef7){logger[_0x33c3('0x1f')](_0x33c3('0x20'),_0x520ef7?util[_0x33c3('0x21')](_0x520ef7,{'showHidden':![],'depth':null}):'');});}exports[_0x33c3('0x22')]=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 a7598b2..2c7b78a 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 _0x136d=['exports','startAllRefreshIntervals'];(function(_0x445943,_0x3048ad){var _0x1b7059=function(_0x517c65){while(--_0x517c65){_0x445943['push'](_0x445943['shift']());}};_0x1b7059(++_0x3048ad);}(_0x136d,0x1a1));var _0xd136=function(_0x552352,_0x51e3b0){_0x552352=_0x552352-0x0;var _0x1e0d71=_0x136d[_0x552352];return _0x1e0d71;};'use strict';function start(){var _0x28d263=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x28d263[_0xd136('0x0')]();}module[_0xd136('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x0e54=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x72a3e5,_0xd9cbf9){var _0x5b6601=function(_0x5e0521){while(--_0x5e0521){_0x72a3e5['push'](_0x72a3e5['shift']());}};_0x5b6601(++_0xd9cbf9);}(_0x0e54,0xbf));var _0x40e5=function(_0x4d7fc7,_0x56c12b){_0x4d7fc7=_0x4d7fc7-0x0;var _0x2eacb1=_0x0e54[_0x4d7fc7];return _0x2eacb1;};'use strict';function start(){var _0x4f6018=require(_0x40e5('0x0'));return _0x4f6018[_0x40e5('0x1')]();}module[_0x40e5('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 d7b0b5c..083db3b 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 _0xad86=['stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','user','email','subtractNumber','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','then','error','error\x20mail','stringify','email\x20sent','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','findAll','MailServerOut','jobs','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','cron','active','isBetween','startAt','endAt','start'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xad86,0x194));var _0x6ad8=function(_0x110566,_0x2cc50c){_0x110566=_0x110566-0x0;var _0x17da85=_0xad86[_0x110566];return _0x17da85;};'use strict';var fs=require('fs');var util=require(_0x6ad8('0x0'));var path=require(_0x6ad8('0x1'));var _=require(_0x6ad8('0x2'));var moment=require(_0x6ad8('0x3'));var CronJobManager=require(_0x6ad8('0x4'));var jayson=require(_0x6ad8('0x5'));var BPromise=require('bluebird');var logger=require('../logger')(_0x6ad8('0x6'));var db=require(_0x6ad8('0x7'))['db'];var analyticCustomReportController=require(_0x6ad8('0x8'));var analyticDefaultReportController=require(_0x6ad8('0x9'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1ecf3f,_0x44b48e){return function(){logger[_0x6ad8('0xa')](_0x6ad8('0xb'),_0x1ecf3f['email']);var _0x535cce=!![];var _0x10dff0=_0x1ecf3f[_0x6ad8('0xc')][_0x6ad8('0xd')]();var _0x1c04bc={'account':_0x10dff0,'message':{'from':util[_0x6ad8('0xe')](_0x6ad8('0xf'),_0x1ecf3f[_0x6ad8('0xc')][_0x6ad8('0x10')],_0x1ecf3f[_0x6ad8('0xc')]['email']||_0x1ecf3f['MailAccount']['Smtp'][_0x6ad8('0x11')]),'to':_0x1ecf3f[_0x6ad8('0x12')],'cc':_0x1ecf3f['cc'],'bcc':_0x1ecf3f['bcc'],'subject':util[_0x6ad8('0xe')]('Report\x20%s\x20last\x20%s\x20%s',_0x44b48e[_0x6ad8('0x10')],_0x1ecf3f[_0x6ad8('0x13')],_0x1ecf3f['subtractUnit'])}};var _0xf272ea=path['join'](__dirname,_0x6ad8('0x14'));var _0x15a557=_0x44b48e[_0x6ad8('0x15')];var _0x19a29e=util['format'](_0x6ad8('0x16'),path[_0x6ad8('0x17')](_0x44b48e[_0x6ad8('0x15')],path[_0x6ad8('0x18')](_0x44b48e['savename'])),_0x6ad8('0x19'));var _0x42eb24=path['join'](_0xf272ea,_0x15a557);var _0x4404da=path['join'](_0xf272ea,_0x19a29e);if(fs[_0x6ad8('0x1a')](_0x42eb24)){_0x44b48e[_0x6ad8('0x1b')]=_0x6ad8('0x1c');_0x1c04bc[_0x6ad8('0x1d')]['attachments']=[{'filename':_0x15a557,'path':_0x42eb24}];_0x1c04bc[_0x6ad8('0x1d')][_0x6ad8('0x1e')]=util[_0x6ad8('0xe')](_0x6ad8('0x1f'),JSON['stringify'](_0x44b48e,null,0x2));}else if(fs[_0x6ad8('0x1a')](_0x4404da)){_0x44b48e[_0x6ad8('0x1b')]=_0x6ad8('0x1c');_0x1c04bc[_0x6ad8('0x1d')][_0x6ad8('0x20')]=[{'filename':_0x19a29e,'path':_0x4404da}];}else{_0x1c04bc[_0x6ad8('0x1d')][_0x6ad8('0x1e')]=_0x6ad8('0x21');if(!_0x1ecf3f['sendIfEmpty']){_0x535cce=![];logger[_0x6ad8('0xa')](_0x6ad8('0x22'));}}if(_0x535cce){return client['request']('SendMail',_0x1c04bc)[_0x6ad8('0x23')](function(_0x2afdb2){if(_0x2afdb2[_0x6ad8('0x24')]){return logger[_0x6ad8('0x24')](_0x6ad8('0x25'),JSON[_0x6ad8('0x26')](_0x2afdb2));}return logger[_0x6ad8('0xa')](_0x6ad8('0x27'));})['catch'](function(_0x493de5){return logger[_0x6ad8('0x24')](_0x6ad8('0x25'),JSON[_0x6ad8('0x26')](_0x493de5));});}};}function handleError(){return function(_0x39aa51){return logger['error'](JSON[_0x6ad8('0x26')](_0x39aa51));};}function handleResult(_0x5219a1){return function(_0x206eaa){logger[_0x6ad8('0xa')](_0x6ad8('0x28'),JSON[_0x6ad8('0x26')](_0x206eaa));if(_0x5219a1[_0x6ad8('0xc')]&&_0x5219a1[_0x6ad8('0xc')][_0x6ad8('0x29')]&&!_['isNil'](_0x5219a1['email'])){setTimeout(handleSendEmail(_0x5219a1,_0x206eaa),0x3c*0x3e8);}};}function handleJob(_0x706377){return function(){try{if(_[_0x6ad8('0x2a')](_0x706377['subtractNumber'])){return logger['info'](_0x6ad8('0x2b'));}if(_[_0x6ad8('0x2a')](_0x706377[_0x6ad8('0x2c')])){return logger[_0x6ad8('0xa')](_0x6ad8('0x2d'));}var _0x533597={'startDate':moment()[_0x6ad8('0x2e')](_0x706377['subtractNumber'],_0x706377[_0x6ad8('0x2c')])[_0x6ad8('0xe')](_0x6ad8('0x2f')),'endDate':moment()[_0x6ad8('0xe')](_0x6ad8('0x2f')),'type':_0x6ad8('0x30'),'output':_0x706377[_0x6ad8('0x31')],'name':_0x706377[_0x6ad8('0x10')]};if(!_[_0x6ad8('0x2a')](_0x706377[_0x6ad8('0x32')])){logger[_0x6ad8('0xa')](_0x6ad8('0x33'),_0x706377['DefaultReportId']);return analyticDefaultReportController[_0x6ad8('0x34')]({'id':_0x706377[_0x6ad8('0x32')]},_0x533597)[_0x6ad8('0x23')](handleResult(_0x706377))[_0x6ad8('0x35')](handleError());}if(!_['isNil'](_0x706377[_0x6ad8('0x36')])){logger[_0x6ad8('0xa')]('exec\x20custom\x20report\x20id:%s',_0x706377['CustomReportId']);return analyticCustomReportController[_0x6ad8('0x34')]({'id':_0x706377[_0x6ad8('0x36')]},_0x533597)[_0x6ad8('0x23')](handleResult(_0x706377))[_0x6ad8('0x35')](handleError());}}catch(_0x42f109){logger[_0x6ad8('0x24')](JSON[_0x6ad8('0x26')](_0x42f109));}return logger[_0x6ad8('0xa')](_0x6ad8('0x37'));};}function getJobs(_0x10ff6f){var _0x215807={};if(_0x10ff6f){_0x215807['id']=_0x10ff6f;}return db['Schedule'][_0x6ad8('0x38')]({'where':_0x215807,'include':[{'model':db['MailAccount'],'attributes':['id',_0x6ad8('0x10'),_0x6ad8('0x12')],'include':[{'model':db[_0x6ad8('0x39')],'as':_0x6ad8('0x29'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})[_0x6ad8('0x23')](function(_0x7e8acd){var _0x4034ab=_['keys'](manager[_0x6ad8('0x3a')]);var _0x16f041=_[_0x6ad8('0x3b')](_0x7e8acd,function(_0x5d85c3){return _0x5d85c3['id'][_0x6ad8('0x3c')]();});var _0x49049c=_[_0x6ad8('0x3d')](_0x7e8acd,function(_0x3c4ee8){return _0x3c4ee8['id'][_0x6ad8('0x3c')]();});var _0x17075c=_0x10ff6f?_0x16f041:_['difference'](_0x16f041,_0x4034ab);var _0x23b4ca=_['intersection'](_0x16f041,_0x4034ab);var _0x3239d7=_[_0x6ad8('0x3e')](_0x4034ab,_0x16f041);var _0xa442fb;var _0x4452b6;for(_0xa442fb=0x0;_0xa442fb<_0x3239d7[_0x6ad8('0x3f')]&&!_0x10ff6f;_0xa442fb+=0x1){_0x4452b6=_0x3239d7[_0xa442fb][_0x6ad8('0x3c')]();if(manager[_0x6ad8('0x40')](_0x4452b6)){manager[_0x6ad8('0x41')](_0x4452b6);manager[_0x6ad8('0x42')](_0x4452b6);logger['info'](_0x6ad8('0x43'),_0x4452b6);}}logger[_0x6ad8('0xa')](_0x6ad8('0x44'),JSON['stringify'](_0x17075c));for(_0xa442fb=0x0;_0xa442fb<_0x17075c[_0x6ad8('0x3f')];_0xa442fb+=0x1){_0x4452b6=_0x17075c[_0xa442fb][_0x6ad8('0x3c')]();logger['info'](_0x6ad8('0x45'),_0x4452b6);if(_0x10ff6f){logger[_0x6ad8('0xa')]('my\x20id',_0x10ff6f);logger[_0x6ad8('0xa')](JSON[_0x6ad8('0x26')](_0x49049c[_0x4452b6]));BPromise['resolve']()[_0x6ad8('0x23')](handleJob(_0x49049c[_0x4452b6]));logger[_0x6ad8('0xa')]('run\x20job',_0x49049c[_0x4452b6]['name'],_0x49049c[_0x4452b6][_0x6ad8('0x46')]);}else if(_0x49049c[_0x4452b6][_0x6ad8('0x46')]&&_0x49049c[_0x4452b6][_0x6ad8('0x47')]&&moment()[_0x6ad8('0x48')](_0x49049c[_0x4452b6][_0x6ad8('0x49')],_0x49049c[_0x4452b6][_0x6ad8('0x4a')])){manager['add'](_0x4452b6,_0x49049c[_0x4452b6][_0x6ad8('0x46')],handleJob(_0x49049c[_0x4452b6]));manager[_0x6ad8('0x4b')](_0x4452b6);logger[_0x6ad8('0xa')]('add\x20cron',_0x49049c[_0x4452b6][_0x6ad8('0x10')],_0x49049c[_0x4452b6][_0x6ad8('0x46')]);}else if(manager['exists'](_0x4452b6)){manager[_0x6ad8('0x41')](_0x4452b6);manager['deleteJob'](_0x4452b6);logger[_0x6ad8('0xa')](_0x6ad8('0x4c'),_0x49049c[_0x4452b6][_0x6ad8('0x10')],_0x49049c[_0x4452b6]['cron']);}}for(_0xa442fb=0x0,_0x4452b6;_0xa442fb<_0x23b4ca[_0x6ad8('0x3f')]&&!_0x10ff6f;_0xa442fb+=0x1){_0x4452b6=_0x23b4ca[_0xa442fb]['toString']();if(manager[_0x6ad8('0x40')](_0x4452b6)){if(_0x49049c[_0x4452b6][_0x6ad8('0x46')]&&_0x49049c[_0x4452b6][_0x6ad8('0x47')]&&moment()[_0x6ad8('0x48')](_0x49049c[_0x4452b6]['startAt'],_0x49049c[_0x4452b6]['endAt'])){manager[_0x6ad8('0x4d')](_0x4452b6,_0x49049c[_0x4452b6][_0x6ad8('0x46')],handleJob(_0x49049c[_0x4452b6]));logger[_0x6ad8('0xa')](_0x6ad8('0x4e'),_0x49049c[_0x4452b6][_0x6ad8('0x10')],_0x49049c[_0x4452b6][_0x6ad8('0x46')]);}else{manager[_0x6ad8('0x41')](_0x4452b6);manager[_0x6ad8('0x42')](_0x4452b6);logger[_0x6ad8('0xa')](_0x6ad8('0x4c'),_0x49049c[_0x4452b6][_0x6ad8('0x10')],_0x49049c[_0x4452b6][_0x6ad8('0x46')]);}}}})[_0x6ad8('0x35')](function(_0x825a5a){logger[_0x6ad8('0x24')](JSON[_0x6ad8('0x26')](_0x825a5a));});}exports[_0x6ad8('0x4f')]=function(_0x51ebce){return getJobs(_0x51ebce);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd2dc=['http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','Smtp','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','map','keyBy','toString','difference','length','exists','index','my\x20id','resolve','cron','active','startAt','add','start','add\x20cron','stop','deleteJob','stop\x20cron','isBetween','endAt','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client'];(function(_0x4835d9,_0x32a402){var _0x265884=function(_0x367504){while(--_0x367504){_0x4835d9['push'](_0x4835d9['shift']());}};_0x265884(++_0x32a402);}(_0xd2dc,0xee));var _0xcd2d=function(_0x4ca394,_0x50fc17){_0x4ca394=_0x4ca394-0x0;var _0x5ea852=_0xd2dc[_0x4ca394];return _0x5ea852;};'use strict';var fs=require('fs');var util=require(_0xcd2d('0x0'));var path=require(_0xcd2d('0x1'));var _=require(_0xcd2d('0x2'));var moment=require(_0xcd2d('0x3'));var CronJobManager=require(_0xcd2d('0x4'));var jayson=require(_0xcd2d('0x5'));var BPromise=require(_0xcd2d('0x6'));var logger=require(_0xcd2d('0x7'))(_0xcd2d('0x8'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xcd2d('0x9'));var client=jayson[_0xcd2d('0xa')][_0xcd2d('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4ae4fa,_0x11c208){return function(){logger[_0xcd2d('0xc')](_0xcd2d('0xd'),_0x4ae4fa[_0xcd2d('0xe')]);var _0x5401f3=!![];var _0x3cbcd6=_0x4ae4fa[_0xcd2d('0xf')][_0xcd2d('0x10')]();var _0x53eb36={'account':_0x3cbcd6,'message':{'from':util[_0xcd2d('0x11')]('\x22%s\x22\x20<%s>',_0x4ae4fa[_0xcd2d('0xf')][_0xcd2d('0x12')],_0x4ae4fa[_0xcd2d('0xf')][_0xcd2d('0xe')]||_0x4ae4fa['MailAccount'][_0xcd2d('0x13')][_0xcd2d('0x14')]),'to':_0x4ae4fa[_0xcd2d('0xe')],'cc':_0x4ae4fa['cc'],'bcc':_0x4ae4fa[_0xcd2d('0x15')],'subject':util[_0xcd2d('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0x11c208[_0xcd2d('0x12')],_0x4ae4fa[_0xcd2d('0x16')],_0x4ae4fa[_0xcd2d('0x17')])}};var _0x22a598=path[_0xcd2d('0x18')](__dirname,_0xcd2d('0x19'));var _0x14e932=_0x11c208[_0xcd2d('0x1a')];var _0x110427=util[_0xcd2d('0x11')](_0xcd2d('0x1b'),path[_0xcd2d('0x1c')](_0x11c208[_0xcd2d('0x1a')],path['extname'](_0x11c208['savename'])),'zip');var _0x4df2cd=path[_0xcd2d('0x18')](_0x22a598,_0x14e932);var _0x1754c9=path[_0xcd2d('0x18')](_0x22a598,_0x110427);if(fs[_0xcd2d('0x1d')](_0x4df2cd)){_0x11c208[_0xcd2d('0x1e')]=_0xcd2d('0x1f');_0x53eb36[_0xcd2d('0x20')]['attachments']=[{'filename':_0x14e932,'path':_0x4df2cd}];_0x53eb36[_0xcd2d('0x20')][_0xcd2d('0x21')]=util[_0xcd2d('0x11')](_0xcd2d('0x22'),JSON[_0xcd2d('0x23')](_0x11c208,null,0x2));}else if(fs[_0xcd2d('0x1d')](_0x1754c9)){_0x11c208[_0xcd2d('0x1e')]=_0xcd2d('0x1f');_0x53eb36[_0xcd2d('0x20')]['attachments']=[{'filename':_0x110427,'path':_0x1754c9}];}else{_0x53eb36['message'][_0xcd2d('0x21')]=_0xcd2d('0x24');if(!_0x4ae4fa[_0xcd2d('0x25')]){_0x5401f3=![];logger[_0xcd2d('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5401f3){return client[_0xcd2d('0x26')](_0xcd2d('0x27'),_0x53eb36)['then'](function(_0x1d16df){if(_0x1d16df[_0xcd2d('0x28')]){return logger[_0xcd2d('0x28')](_0xcd2d('0x29'),JSON[_0xcd2d('0x23')](_0x1d16df));}return logger[_0xcd2d('0xc')](_0xcd2d('0x2a'));})[_0xcd2d('0x2b')](function(_0x2fe04f){return logger[_0xcd2d('0x28')](_0xcd2d('0x29'),JSON[_0xcd2d('0x23')](_0x2fe04f));});}};}function handleError(){return function(_0x36e59b){return logger[_0xcd2d('0x28')](JSON['stringify'](_0x36e59b));};}function handleResult(_0x53cd8a){return function(_0x52b7f2){logger[_0xcd2d('0xc')](_0xcd2d('0x2c'),JSON[_0xcd2d('0x23')](_0x52b7f2));if(_0x53cd8a[_0xcd2d('0xf')]&&_0x53cd8a[_0xcd2d('0xf')][_0xcd2d('0x13')]&&!_[_0xcd2d('0x2d')](_0x53cd8a[_0xcd2d('0xe')])){setTimeout(handleSendEmail(_0x53cd8a,_0x52b7f2),0x3c*0x3e8);}};}function handleJob(_0x21585d){return function(){try{if(_['isNil'](_0x21585d[_0xcd2d('0x16')])){return logger[_0xcd2d('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xcd2d('0x2d')](_0x21585d[_0xcd2d('0x17')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x3ae721={'startDate':moment()[_0xcd2d('0x2e')](_0x21585d[_0xcd2d('0x16')],_0x21585d['subtractUnit'])['format'](_0xcd2d('0x2f')),'endDate':moment()[_0xcd2d('0x11')](_0xcd2d('0x2f')),'type':_0xcd2d('0x30'),'output':_0x21585d['output'],'name':_0x21585d['name']};if(!_['isNil'](_0x21585d[_0xcd2d('0x31')])){logger['info'](_0xcd2d('0x32'),_0x21585d[_0xcd2d('0x31')]);return analyticDefaultReportController[_0xcd2d('0x33')]({'id':_0x21585d[_0xcd2d('0x31')]},_0x3ae721)[_0xcd2d('0x34')](handleResult(_0x21585d))[_0xcd2d('0x2b')](handleError());}if(!_[_0xcd2d('0x2d')](_0x21585d['CustomReportId'])){logger[_0xcd2d('0xc')](_0xcd2d('0x35'),_0x21585d[_0xcd2d('0x36')]);return analyticCustomReportController[_0xcd2d('0x33')]({'id':_0x21585d[_0xcd2d('0x36')]},_0x3ae721)[_0xcd2d('0x34')](handleResult(_0x21585d))['catch'](handleError());}}catch(_0x421c85){logger[_0xcd2d('0x28')](JSON[_0xcd2d('0x23')](_0x421c85));}return logger[_0xcd2d('0xc')](_0xcd2d('0x37'));};}function getJobs(_0x3d6f28){var _0x37ed21={};if(_0x3d6f28){_0x37ed21['id']=_0x3d6f28;}return db[_0xcd2d('0x38')][_0xcd2d('0x39')]({'where':_0x37ed21,'include':[{'model':db[_0xcd2d('0xf')],'attributes':['id',_0xcd2d('0x12'),_0xcd2d('0xe')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xcd2d('0x3a')],'as':_0xcd2d('0x3a')}]}]}]})['then'](function(_0x39dd17){var _0x33ed98=_[_0xcd2d('0x3b')](manager['jobs']);var _0x493321=_[_0xcd2d('0x3c')](_0x39dd17,function(_0x3c736f){return _0x3c736f['id']['toString']();});var _0x20f851=_[_0xcd2d('0x3d')](_0x39dd17,function(_0x3ed65c){return _0x3ed65c['id'][_0xcd2d('0x3e')]();});var _0x13f84e=_0x3d6f28?_0x493321:_[_0xcd2d('0x3f')](_0x493321,_0x33ed98);var _0x2e6aa5=_['intersection'](_0x493321,_0x33ed98);var _0x27ef7a=_[_0xcd2d('0x3f')](_0x33ed98,_0x493321);var _0x5f34c8;var _0x27c77f;for(_0x5f34c8=0x0;_0x5f34c8<_0x27ef7a[_0xcd2d('0x40')]&&!_0x3d6f28;_0x5f34c8+=0x1){_0x27c77f=_0x27ef7a[_0x5f34c8][_0xcd2d('0x3e')]();if(manager[_0xcd2d('0x41')](_0x27c77f)){manager['stop'](_0x27c77f);manager['deleteJob'](_0x27c77f);logger[_0xcd2d('0xc')]('delete\x20cron',_0x27c77f);}}logger[_0xcd2d('0xc')]('toRun',JSON['stringify'](_0x13f84e));for(_0x5f34c8=0x0;_0x5f34c8<_0x13f84e[_0xcd2d('0x40')];_0x5f34c8+=0x1){_0x27c77f=_0x13f84e[_0x5f34c8][_0xcd2d('0x3e')]();logger[_0xcd2d('0xc')](_0xcd2d('0x42'),_0x27c77f);if(_0x3d6f28){logger[_0xcd2d('0xc')](_0xcd2d('0x43'),_0x3d6f28);logger[_0xcd2d('0xc')](JSON[_0xcd2d('0x23')](_0x20f851[_0x27c77f]));BPromise[_0xcd2d('0x44')]()[_0xcd2d('0x34')](handleJob(_0x20f851[_0x27c77f]));logger['info']('run\x20job',_0x20f851[_0x27c77f][_0xcd2d('0x12')],_0x20f851[_0x27c77f][_0xcd2d('0x45')]);}else if(_0x20f851[_0x27c77f][_0xcd2d('0x45')]&&_0x20f851[_0x27c77f][_0xcd2d('0x46')]&&moment()['isBetween'](_0x20f851[_0x27c77f][_0xcd2d('0x47')],_0x20f851[_0x27c77f]['endAt'])){manager[_0xcd2d('0x48')](_0x27c77f,_0x20f851[_0x27c77f][_0xcd2d('0x45')],handleJob(_0x20f851[_0x27c77f]));manager[_0xcd2d('0x49')](_0x27c77f);logger['info'](_0xcd2d('0x4a'),_0x20f851[_0x27c77f][_0xcd2d('0x12')],_0x20f851[_0x27c77f][_0xcd2d('0x45')]);}else if(manager['exists'](_0x27c77f)){manager[_0xcd2d('0x4b')](_0x27c77f);manager[_0xcd2d('0x4c')](_0x27c77f);logger['info'](_0xcd2d('0x4d'),_0x20f851[_0x27c77f][_0xcd2d('0x12')],_0x20f851[_0x27c77f][_0xcd2d('0x45')]);}}for(_0x5f34c8=0x0,_0x27c77f;_0x5f34c8<_0x2e6aa5['length']&&!_0x3d6f28;_0x5f34c8+=0x1){_0x27c77f=_0x2e6aa5[_0x5f34c8][_0xcd2d('0x3e')]();if(manager['exists'](_0x27c77f)){if(_0x20f851[_0x27c77f]['cron']&&_0x20f851[_0x27c77f][_0xcd2d('0x46')]&&moment()[_0xcd2d('0x4e')](_0x20f851[_0x27c77f][_0xcd2d('0x47')],_0x20f851[_0x27c77f][_0xcd2d('0x4f')])){manager[_0xcd2d('0x50')](_0x27c77f,_0x20f851[_0x27c77f]['cron'],handleJob(_0x20f851[_0x27c77f]));logger['info'](_0xcd2d('0x51'),_0x20f851[_0x27c77f][_0xcd2d('0x12')],_0x20f851[_0x27c77f]['cron']);}else{manager[_0xcd2d('0x4b')](_0x27c77f);manager[_0xcd2d('0x4c')](_0x27c77f);logger[_0xcd2d('0xc')](_0xcd2d('0x4d'),_0x20f851[_0x27c77f][_0xcd2d('0x12')],_0x20f851[_0x27c77f][_0xcd2d('0x45')]);}}}})['catch'](function(_0x234d34){logger[_0xcd2d('0x28')](JSON['stringify'](_0x234d34));});}exports[_0xcd2d('0x52')]=function(_0x1be885){return getJobs(_0x1be885);};exports[_0xcd2d('0x49')]=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 71b427e..7d312d9 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 _0xbe9d=['start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript','info','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbe9d,0x99));var _0xdbe9=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xbe9d[_0x484e36];return _0xafc85d;};var _=require(_0xdbe9('0x0'));var AWS=require(_0xdbe9('0x1'));var rp=require(_0xdbe9('0x2'));var util=require(_0xdbe9('0x3'));var BPromise=require(_0xdbe9('0x4'));var db=require(_0xdbe9('0x5'))['db'];var logger=require(_0xdbe9('0x6'))(_0xdbe9('0x7'));function getTranscriptionJob(_0x42db10,_0x341470,_0x448325,_0x2602b1){return new Promise(function(_0x163517,_0x52405e){var _0x56e9be=new AWS[(_0xdbe9('0x8'))]({'accessKeyId':_0x341470,'secretAccessKey':_0x42db10,'region':_0x448325});_0x56e9be[_0xdbe9('0x9')]({'TranscriptionJobName':_0x2602b1},function(_0x5a9989,_0x58093b){if(_0x5a9989){return _0x52405e(_0x5a9989);}else{return _0x163517(_0x58093b);}});});}function sentiment(_0x24c217,_0x10c57e,_0x56470c,_0x4f8005,_0x14dc74){return new Promise(function(_0x4500cb,_0x42ba09){var _0x4070f9=new AWS['Comprehend']({'accessKeyId':_0x10c57e,'secretAccessKey':_0x24c217,'region':_0x56470c});_0x4070f9[_0xdbe9('0xa')]({'Text':_0x4f8005,'LanguageCode':_0x14dc74[_0xdbe9('0xb')](0x0,0x2)},function(_0x41d8f0,_0x8bb043){if(_0x41d8f0){return _0x42ba09(_0x41d8f0);}else{return _0x4500cb(_0x8bb043);}});});}function checkTranscribeJob(_0x500f8f,_0x463efa,_0x53b083){var _0x31233b;return new BPromise(function(_0x9e78f4,_0x2cfeb0){logger['info'](util[_0xdbe9('0xc')](_0xdbe9('0xd'),_0x500f8f['id'],_0x500f8f[_0xdbe9('0xe')]));return getTranscriptionJob(_0x53b083['data1'],_0x53b083[_0xdbe9('0xf')],_0x463efa['transcribeRegion'],_0x500f8f[_0xdbe9('0xe')])[_0xdbe9('0x10')](function(_0x11260a){logger['info'](util[_0xdbe9('0xc')](_0xdbe9('0x11'),_0x500f8f['id'],_0x500f8f[_0xdbe9('0xe')],_0x11260a['TranscriptionJob'][_0xdbe9('0x12')]));if(!_0x500f8f[_0xdbe9('0x13')]){switch(_0x11260a['TranscriptionJob'][_0xdbe9('0x12')]){case _0xdbe9('0x14'):var _0x21a2d5={'transcribeStatus':_0x11260a[_0xdbe9('0x15')][_0xdbe9('0x12')],'fileUri':_0x11260a[_0xdbe9('0x15')][_0xdbe9('0x16')]['TranscriptFileUri']};logger[_0xdbe9('0x17')](util[_0xdbe9('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x500f8f['id']));return rp({'uri':_0x11260a[_0xdbe9('0x15')][_0xdbe9('0x16')][_0xdbe9('0x18')],'json':!![]})[_0xdbe9('0x10')](function(_0x2fe158){logger['info'](util[_0xdbe9('0xc')](_0xdbe9('0x19'),_0x500f8f['id']));if(_0x2fe158&&_0x2fe158[_0xdbe9('0x1a')]&&_0x2fe158[_0xdbe9('0x1a')][_0xdbe9('0x1b')]&&_0x2fe158[_0xdbe9('0x1a')][_0xdbe9('0x1b')][_0xdbe9('0x1c')]){_0x21a2d5[_0xdbe9('0x13')]='';for(var _0x5cc1ab=0x0;_0x5cc1ab<_0x2fe158[_0xdbe9('0x1a')][_0xdbe9('0x1b')][_0xdbe9('0x1c')];_0x5cc1ab++){_0x21a2d5[_0xdbe9('0x13')]+=_0x2fe158[_0xdbe9('0x1a')][_0xdbe9('0x1b')][_0x5cc1ab][_0xdbe9('0x1d')]+'';}}return _0x500f8f[_0xdbe9('0x1e')](_0x21a2d5);})['then'](function(){logger[_0xdbe9('0x17')](util[_0xdbe9('0xc')](_0xdbe9('0x1f'),_0x500f8f['id']));if(!_0x500f8f[_0xdbe9('0x20')]){throw new db[(_0xdbe9('0x21'))][(_0xdbe9('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x463efa['sentiment']||!_0x463efa[_0xdbe9('0x23')]||!_0x463efa[_0xdbe9('0x24')]||!_0x463efa[_0xdbe9('0x25')]||!_0x463efa[_0xdbe9('0x26')]){throw new db[(_0xdbe9('0x21'))]['ValidationError'](_0xdbe9('0x27'));}if(!_0x21a2d5[_0xdbe9('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x463efa[_0xdbe9('0x23')]===_0x53b083['id']){return _0x53b083;}else{return db[_0xdbe9('0x28')][_0xdbe9('0x29')]({'where':{'id':_settings[_0xdbe9('0x23')]}});}})[_0xdbe9('0x10')](function(_0x243414){if(!_0x243414){throw new db[(_0xdbe9('0x21'))][(_0xdbe9('0x22'))](_0xdbe9('0x2a'));}if(!_0x243414[_0xdbe9('0x2b')]||!_0x243414[_0xdbe9('0xf')]){throw new db[(_0xdbe9('0x21'))]['ValidationError'](_0xdbe9('0x2c'));}_0x31233b=_0x243414;logger[_0xdbe9('0x17')](util['format'](_0xdbe9('0x2d'),_0x500f8f['id']));return sentiment(_0x31233b[_0xdbe9('0x2b')],_0x31233b['data2'],_0x463efa[_0xdbe9('0x24')],_0x21a2d5[_0xdbe9('0x13')],_0x463efa[_0xdbe9('0x25')]);})['then'](function(_0x19026b){logger[_0xdbe9('0x17')](util[_0xdbe9('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x500f8f['id']));return _0x500f8f[_0xdbe9('0x1e')]({'sentiment':_0x19026b[_0xdbe9('0x2e')],'sPositive':_0x19026b[_0xdbe9('0x2f')][_0xdbe9('0x30')],'sNegative':_0x19026b[_0xdbe9('0x2f')][_0xdbe9('0x31')],'sMixed':_0x19026b[_0xdbe9('0x2f')]['Mixed'],'sNeutral':_0x19026b[_0xdbe9('0x2f')][_0xdbe9('0x32')]});})['then'](function(){logger[_0xdbe9('0x17')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x500f8f['id']));_0x9e78f4();});case _0xdbe9('0x33'):return _0x500f8f[_0xdbe9('0x1e')]({'transcribeStatus':_0xdbe9('0x33'),'failureReason':_0x11260a[_0xdbe9('0x15')][_0xdbe9('0x34')]})[_0xdbe9('0x10')](function(){logger[_0xdbe9('0x17')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x500f8f['id']));_0x9e78f4();});default:logger[_0xdbe9('0x17')](util[_0xdbe9('0xc')](_0xdbe9('0x35'),_0x500f8f['id']));break;}}else{return BPromise[_0xdbe9('0x36')]()[_0xdbe9('0x10')](function(){if(!_0x500f8f['tempSentiment']){throw new db[(_0xdbe9('0x21'))][(_0xdbe9('0x22'))](_0xdbe9('0x37'));}if(!_0x463efa['sentiment']||!_0x463efa[_0xdbe9('0x23')]||!_0x463efa[_0xdbe9('0x24')]||!_0x463efa[_0xdbe9('0x25')]||!_0x463efa[_0xdbe9('0x26')]){throw new db[(_0xdbe9('0x21'))]['ValidationError'](_0xdbe9('0x27'));}if(!_0x500f8f[_0xdbe9('0x13')]){throw new Error(_0xdbe9('0x38'));}if(_0x463efa['sentimentAccountId']===_0x53b083['id']){return _0x53b083;}else{return db[_0xdbe9('0x28')][_0xdbe9('0x29')]({'where':{'id':_settings[_0xdbe9('0x23')]}});}})[_0xdbe9('0x10')](function(_0x251d6e){if(!_0x251d6e){throw new db[(_0xdbe9('0x21'))]['ValidationError'](_0xdbe9('0x2a'));}if(!_0x251d6e['data1']||!_0x251d6e[_0xdbe9('0xf')]){throw new db[(_0xdbe9('0x21'))][(_0xdbe9('0x22'))](_0xdbe9('0x2c'));}_0x31233b=_0x251d6e;logger[_0xdbe9('0x17')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x500f8f['id']));return sentiment(_0x31233b['data1'],_0x31233b[_0xdbe9('0xf')],_0x463efa[_0xdbe9('0x24')],_0x500f8f[_0xdbe9('0x13')],_0x463efa[_0xdbe9('0x25')]);})[_0xdbe9('0x10')](function(_0x519284){logger['info'](util[_0xdbe9('0xc')](_0xdbe9('0x39'),_0x500f8f['id']));return _0x500f8f[_0xdbe9('0x1e')]({'sentiment':_0x519284[_0xdbe9('0x2e')],'sPositive':_0x519284[_0xdbe9('0x2f')][_0xdbe9('0x30')],'sNegative':_0x519284[_0xdbe9('0x2f')][_0xdbe9('0x31')],'sMixed':_0x519284[_0xdbe9('0x2f')][_0xdbe9('0x3a')],'sNeutral':_0x519284[_0xdbe9('0x2f')][_0xdbe9('0x32')],'transcribeStatus':_0xdbe9('0x14')});})['then'](function(){logger[_0xdbe9('0x17')](util[_0xdbe9('0xc')](_0xdbe9('0x1f'),_0x500f8f['id']));_0x9e78f4();});}})[_0xdbe9('0x3b')](function(_0x3eef25){if(_0x3eef25){if(!_0x3eef25[_0xdbe9('0x3c')]||_0x3eef25[_0xdbe9('0x3c')]!==_0xdbe9('0x3d')){logger[_0xdbe9('0x3e')](util[_0xdbe9('0xc')](_0xdbe9('0x3f'),_0x500f8f['id']),util[_0xdbe9('0x40')](_0x3eef25,{'showHidden':![],'depth':null}));}}_0x9e78f4();});});}function checkTranscribe(){var _0x514fe2;var _0x522467;var _0x299d16;return db[_0xdbe9('0x41')][_0xdbe9('0x42')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xdbe9('0x10')](function(_0x439b1c){if(!_0x439b1c||!_0x439b1c[_0xdbe9('0x1c')]){throw new db['Sequelize']['ValidationError'](_0xdbe9('0x43'));}_0x514fe2=_0x439b1c;return db[_0xdbe9('0x44')]['findOne']({'where':{'id':0x1}});})[_0xdbe9('0x10')](function(_0x14d0bc){if(!_0x14d0bc){throw new db[(_0xdbe9('0x21'))]['ValidationError'](_0xdbe9('0x45'));}_0x522467=_0x14d0bc;if(!_0x522467[_0xdbe9('0x7')]||!_0x522467['transcribeAccountId']||!_0x522467[_0xdbe9('0x46')]||!_0x522467[_0xdbe9('0x25')]||!_0x522467[_0xdbe9('0x26')]){throw new db[(_0xdbe9('0x21'))][(_0xdbe9('0x22'))](_0xdbe9('0x47'));}return db[_0xdbe9('0x28')][_0xdbe9('0x29')]({'where':{'id':_0x522467['transcribeAccountId']}});})['then'](function(_0x44939){if(!_0x44939){throw new db[(_0xdbe9('0x21'))][(_0xdbe9('0x22'))](_0xdbe9('0x2a'));}if(!_0x44939[_0xdbe9('0x2b')]||!_0x44939['data2']){throw new db[(_0xdbe9('0x21'))]['ValidationError'](_0xdbe9('0x2c'));}_0x299d16=_0x44939;var _0x2df39a=[];_0x514fe2[_0xdbe9('0x48')](function(_0x1ee483){_0x2df39a[_0xdbe9('0x49')](checkTranscribeJob(_0x1ee483,_0x522467,_0x299d16));});return BPromise[_0xdbe9('0x4a')](_0x2df39a);})[_0xdbe9('0x3b')](function(_0x44553d){if(_0x44553d){if(!_0x44553d['name']||_0x44553d['name']!==_0xdbe9('0x3d')){logger[_0xdbe9('0x3e')](util[_0xdbe9('0x40')](_0x44553d,{'showHidden':![],'depth':null}));}}});}exports[_0xdbe9('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd23d=['[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','forEach','push','all','inspect','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','SentimentScore','Positive','Negative','Neutral','FAILED','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','catch','name','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd23d,0xa0));var _0xdd23=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xd23d[_0x13b02f];return _0x12e9a6;};var _=require(_0xdd23('0x0'));var AWS=require(_0xdd23('0x1'));var rp=require(_0xdd23('0x2'));var util=require(_0xdd23('0x3'));var BPromise=require(_0xdd23('0x4'));var db=require(_0xdd23('0x5'))['db'];var logger=require(_0xdd23('0x6'))('transcribe');function getTranscriptionJob(_0x5c938b,_0x5c0eed,_0x166454,_0x23d246){return new Promise(function(_0x7232e8,_0xa5bdac){var _0x5933e2=new AWS[(_0xdd23('0x7'))]({'accessKeyId':_0x5c0eed,'secretAccessKey':_0x5c938b,'region':_0x166454});_0x5933e2['getTranscriptionJob']({'TranscriptionJobName':_0x23d246},function(_0x51db09,_0x7d8547){if(_0x51db09){return _0xa5bdac(_0x51db09);}else{return _0x7232e8(_0x7d8547);}});});}function sentiment(_0x3aca99,_0x39a5c0,_0x963479,_0x1e28dd,_0x50d62b){return new Promise(function(_0x3a0324,_0x153bbc){var _0x2a3d8f=new AWS['Comprehend']({'accessKeyId':_0x39a5c0,'secretAccessKey':_0x3aca99,'region':_0x963479});_0x2a3d8f[_0xdd23('0x8')]({'Text':_0x1e28dd,'LanguageCode':_0x50d62b[_0xdd23('0x9')](0x0,0x2)},function(_0x3ab457,_0x4c87e6){if(_0x3ab457){return _0x153bbc(_0x3ab457);}else{return _0x3a0324(_0x4c87e6);}});});}function checkTranscribeJob(_0x3216ed,_0x103a43,_0x1484d7){var _0x1e4739;return new BPromise(function(_0x450d35,_0x5aeddf){logger['info'](util[_0xdd23('0xa')](_0xdd23('0xb'),_0x3216ed['id'],_0x3216ed[_0xdd23('0xc')]));return getTranscriptionJob(_0x1484d7['data1'],_0x1484d7[_0xdd23('0xd')],_0x103a43[_0xdd23('0xe')],_0x3216ed[_0xdd23('0xc')])[_0xdd23('0xf')](function(_0x5d0087){logger[_0xdd23('0x10')](util[_0xdd23('0xa')](_0xdd23('0x11'),_0x3216ed['id'],_0x3216ed[_0xdd23('0xc')],_0x5d0087[_0xdd23('0x12')][_0xdd23('0x13')]));if(!_0x3216ed['fileText']){switch(_0x5d0087['TranscriptionJob'][_0xdd23('0x13')]){case _0xdd23('0x14'):var _0x3f9507={'transcribeStatus':_0x5d0087[_0xdd23('0x12')][_0xdd23('0x13')],'fileUri':_0x5d0087[_0xdd23('0x12')][_0xdd23('0x15')][_0xdd23('0x16')]};logger[_0xdd23('0x10')](util[_0xdd23('0xa')](_0xdd23('0x17'),_0x3216ed['id']));return rp({'uri':_0x5d0087[_0xdd23('0x12')][_0xdd23('0x15')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x4f53fa){logger['info'](util[_0xdd23('0xa')](_0xdd23('0x18'),_0x3216ed['id']));if(_0x4f53fa&&_0x4f53fa[_0xdd23('0x19')]&&_0x4f53fa[_0xdd23('0x19')][_0xdd23('0x1a')]&&_0x4f53fa[_0xdd23('0x19')][_0xdd23('0x1a')][_0xdd23('0x1b')]){_0x3f9507[_0xdd23('0x1c')]='';for(var _0x395b2e=0x0;_0x395b2e<_0x4f53fa[_0xdd23('0x19')][_0xdd23('0x1a')][_0xdd23('0x1b')];_0x395b2e++){_0x3f9507[_0xdd23('0x1c')]+=_0x4f53fa[_0xdd23('0x19')]['transcripts'][_0x395b2e]['transcript']+'';}}return _0x3216ed[_0xdd23('0x1d')](_0x3f9507);})['then'](function(){logger[_0xdd23('0x10')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3216ed['id']));if(!_0x3216ed[_0xdd23('0x1e')]){throw new db[(_0xdd23('0x1f'))]['ValidationError'](_0xdd23('0x20'));}if(!_0x103a43[_0xdd23('0x21')]||!_0x103a43[_0xdd23('0x22')]||!_0x103a43['sentimentRegion']||!_0x103a43[_0xdd23('0x23')]||!_0x103a43[_0xdd23('0x24')]){throw new db[(_0xdd23('0x1f'))][(_0xdd23('0x25'))](_0xdd23('0x26'));}if(!_0x3f9507[_0xdd23('0x1c')]){throw new Error(_0xdd23('0x27'));}if(_0x103a43[_0xdd23('0x22')]===_0x1484d7['id']){return _0x1484d7;}else{return db['CloudProvider'][_0xdd23('0x28')]({'where':{'id':_settings[_0xdd23('0x22')]}});}})['then'](function(_0x4d2a44){if(!_0x4d2a44){throw new db[(_0xdd23('0x1f'))]['ValidationError'](_0xdd23('0x29'));}if(!_0x4d2a44[_0xdd23('0x2a')]||!_0x4d2a44[_0xdd23('0xd')]){throw new db[(_0xdd23('0x1f'))][(_0xdd23('0x25'))](_0xdd23('0x2b'));}_0x1e4739=_0x4d2a44;logger[_0xdd23('0x10')](util['format'](_0xdd23('0x2c'),_0x3216ed['id']));return sentiment(_0x1e4739[_0xdd23('0x2a')],_0x1e4739[_0xdd23('0xd')],_0x103a43[_0xdd23('0x2d')],_0x3f9507['fileText'],_0x103a43[_0xdd23('0x23')]);})[_0xdd23('0xf')](function(_0x5ce6ad){logger[_0xdd23('0x10')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3216ed['id']));return _0x3216ed[_0xdd23('0x1d')]({'sentiment':_0x5ce6ad['Sentiment'],'sPositive':_0x5ce6ad[_0xdd23('0x2e')][_0xdd23('0x2f')],'sNegative':_0x5ce6ad[_0xdd23('0x2e')][_0xdd23('0x30')],'sMixed':_0x5ce6ad[_0xdd23('0x2e')]['Mixed'],'sNeutral':_0x5ce6ad['SentimentScore'][_0xdd23('0x31')]});})[_0xdd23('0xf')](function(){logger[_0xdd23('0x10')](util[_0xdd23('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3216ed['id']));_0x450d35();});case _0xdd23('0x32'):return _0x3216ed[_0xdd23('0x1d')]({'transcribeStatus':_0xdd23('0x32'),'failureReason':_0x5d0087[_0xdd23('0x12')]['FailureReason']})[_0xdd23('0xf')](function(){logger[_0xdd23('0x10')](util[_0xdd23('0xa')](_0xdd23('0x33'),_0x3216ed['id']));_0x450d35();});default:logger[_0xdd23('0x10')](util[_0xdd23('0xa')](_0xdd23('0x34'),_0x3216ed['id']));break;}}else{return BPromise[_0xdd23('0x35')]()[_0xdd23('0xf')](function(){if(!_0x3216ed[_0xdd23('0x1e')]){throw new db['Sequelize'][(_0xdd23('0x25'))](_0xdd23('0x20'));}if(!_0x103a43['sentiment']||!_0x103a43[_0xdd23('0x22')]||!_0x103a43[_0xdd23('0x2d')]||!_0x103a43[_0xdd23('0x23')]||!_0x103a43[_0xdd23('0x24')]){throw new db['Sequelize'][(_0xdd23('0x25'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3216ed[_0xdd23('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x103a43['sentimentAccountId']===_0x1484d7['id']){return _0x1484d7;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xdd23('0x22')]}});}})[_0xdd23('0xf')](function(_0x228bcd){if(!_0x228bcd){throw new db['Sequelize'][(_0xdd23('0x25'))](_0xdd23('0x29'));}if(!_0x228bcd[_0xdd23('0x2a')]||!_0x228bcd[_0xdd23('0xd')]){throw new db[(_0xdd23('0x1f'))][(_0xdd23('0x25'))](_0xdd23('0x2b'));}_0x1e4739=_0x228bcd;logger[_0xdd23('0x10')](util[_0xdd23('0xa')](_0xdd23('0x2c'),_0x3216ed['id']));return sentiment(_0x1e4739[_0xdd23('0x2a')],_0x1e4739['data2'],_0x103a43[_0xdd23('0x2d')],_0x3216ed[_0xdd23('0x1c')],_0x103a43[_0xdd23('0x23')]);})[_0xdd23('0xf')](function(_0x1cfd2c){logger[_0xdd23('0x10')](util[_0xdd23('0xa')](_0xdd23('0x36'),_0x3216ed['id']));return _0x3216ed[_0xdd23('0x1d')]({'sentiment':_0x1cfd2c['Sentiment'],'sPositive':_0x1cfd2c['SentimentScore']['Positive'],'sNegative':_0x1cfd2c[_0xdd23('0x2e')][_0xdd23('0x30')],'sMixed':_0x1cfd2c[_0xdd23('0x2e')][_0xdd23('0x37')],'sNeutral':_0x1cfd2c['SentimentScore'][_0xdd23('0x31')],'transcribeStatus':_0xdd23('0x14')});})[_0xdd23('0xf')](function(){logger[_0xdd23('0x10')](util[_0xdd23('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3216ed['id']));_0x450d35();});}})[_0xdd23('0x38')](function(_0x75f082){if(_0x75f082){if(!_0x75f082['name']||_0x75f082[_0xdd23('0x39')]!=='SequelizeValidationError'){logger[_0xdd23('0x3a')](util[_0xdd23('0xa')](_0xdd23('0x3b'),_0x3216ed['id']),util['inspect'](_0x75f082,{'showHidden':![],'depth':null}));}}_0x450d35();});});}function checkTranscribe(){var _0x51dbcf;var _0x428d9f;var _0x411e2f;return db[_0xdd23('0x3c')][_0xdd23('0x3d')]({'where':{'transcribeStatus':_0xdd23('0x3e')}})[_0xdd23('0xf')](function(_0x28ce32){if(!_0x28ce32||!_0x28ce32[_0xdd23('0x1b')]){throw new db[(_0xdd23('0x1f'))]['ValidationError'](_0xdd23('0x3f'));}_0x51dbcf=_0x28ce32;return db[_0xdd23('0x40')][_0xdd23('0x28')]({'where':{'id':0x1}});})[_0xdd23('0xf')](function(_0x51aaee){if(!_0x51aaee){throw new db[(_0xdd23('0x1f'))][(_0xdd23('0x25'))](_0xdd23('0x41'));}_0x428d9f=_0x51aaee;if(!_0x428d9f[_0xdd23('0x42')]||!_0x428d9f[_0xdd23('0x43')]||!_0x428d9f[_0xdd23('0xe')]||!_0x428d9f['language']||!_0x428d9f['bucket']){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xdd23('0x28')]({'where':{'id':_0x428d9f[_0xdd23('0x43')]}});})['then'](function(_0x4b3020){if(!_0x4b3020){throw new db[(_0xdd23('0x1f'))][(_0xdd23('0x25'))](_0xdd23('0x29'));}if(!_0x4b3020[_0xdd23('0x2a')]||!_0x4b3020[_0xdd23('0xd')]){throw new db[(_0xdd23('0x1f'))][(_0xdd23('0x25'))](_0xdd23('0x2b'));}_0x411e2f=_0x4b3020;var _0x153111=[];_0x51dbcf[_0xdd23('0x44')](function(_0x1263cd){_0x153111[_0xdd23('0x45')](checkTranscribeJob(_0x1263cd,_0x428d9f,_0x411e2f));});return BPromise[_0xdd23('0x46')](_0x153111);})['catch'](function(_0x19ebfc){if(_0x19ebfc){if(!_0x19ebfc['name']||_0x19ebfc[_0xdd23('0x39')]!=='SequelizeValidationError'){logger[_0xdd23('0x3a')](util[_0xdd23('0x47')](_0x19ebfc,{'showHidden':![],'depth':null}));}}});}exports[_0xdd23('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index af1d451..1e95e6f 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 _0x4cd3=['format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../logger','schedule','localhost','WhatsappInteraction','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout'];(function(_0x41ade1,_0x34af04){var _0x465d5f=function(_0x22a1af){while(--_0x22a1af){_0x41ade1['push'](_0x41ade1['shift']());}};_0x465d5f(++_0x34af04);}(_0x4cd3,0x1ca));var _0x34cd=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x4cd3[_0x2c96f6];return _0x6d4808;};'use strict';var _=require(_0x34cd('0x0'));var moment=require(_0x34cd('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x34cd('0x2'))(_0x34cd('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x34cd('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x4cd732=[];return db[_0x34cd('0x5')]['findAll']({'raw':!![],'attributes':['id',_0x34cd('0x6')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x34cd('0x7')](0x18,_0x34cd('0x8'))}}})['then'](function(_0x2aab91){if(_0x2aab91&&_0x2aab91[_0x34cd('0x9')]){_0x4cd732=_[_0x34cd('0xa')](_0x2aab91||[],'id');logger[_0x34cd('0xb')](_0x34cd('0xc'),_0x4cd732[_0x34cd('0xd')]());return db[_0x34cd('0x5')][_0x34cd('0xe')]({'closeReason':_0x34cd('0xf'),'disposition':_0x34cd('0x10'),'closed':!![],'closedAt':moment()[_0x34cd('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4cd732}});}})[_0x34cd('0x12')](function(){if(_0x4cd732&&_0x4cd732[_0x34cd('0x9')]){logger[_0x34cd('0xb')](_0x34cd('0x13'),_0x4cd732[_0x34cd('0xd')]());for(var _0x654655=0x0;_0x654655<_0x4cd732[_0x34cd('0x9')];_0x654655++){io['emit'](_0x34cd('0x14'),{'id':_0x4cd732[_0x654655],'closed':!![]});}}})[_0x34cd('0x15')](function(_0x5e1728){logger['error'](_0x34cd('0x16'),_0x5e1728?util[_0x34cd('0x17')](_0x5e1728,{'showHidden':![],'depth':null}):'');});}exports[_0x34cd('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x544d=['WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x544d,0x16a));var _0xd544=function(_0x40f2d4,_0x3a56db){_0x40f2d4=_0x40f2d4-0x0;var _0x208e9b=_0x544d[_0x40f2d4];return _0x208e9b;};'use strict';var _=require('lodash');var moment=require(_0xd544('0x0'));var Redis=require('ioredis');var util=require(_0xd544('0x1'));var config=require(_0xd544('0x2'));var db=require(_0xd544('0x3'))['db'];var logger=require(_0xd544('0x4'))(_0xd544('0x5'));config[_0xd544('0x6')]=_[_0xd544('0x7')](config['redis'],{'host':_0xd544('0x8'),'port':0x18eb});var io=require(_0xd544('0x9'))(new Redis(config[_0xd544('0x6')]));function closeInteractions(){var _0x2303a3=[];return db[_0xd544('0xa')][_0xd544('0xb')]({'raw':!![],'attributes':['id',_0xd544('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xd544('0xd'))}}})[_0xd544('0xe')](function(_0x5b11cf){if(_0x5b11cf&&_0x5b11cf[_0xd544('0xf')]){_0x2303a3=_[_0xd544('0x10')](_0x5b11cf||[],'id');logger[_0xd544('0x11')](_0xd544('0x12'),_0x2303a3[_0xd544('0x13')]());return db[_0xd544('0xa')]['update']({'closeReason':_0xd544('0x14'),'disposition':_0xd544('0x15'),'closed':!![],'closedAt':moment()[_0xd544('0x16')](_0xd544('0x17'))},{'where':{'id':_0x2303a3}});}})[_0xd544('0xe')](function(){if(_0x2303a3&&_0x2303a3[_0xd544('0xf')]){logger[_0xd544('0x11')](_0xd544('0x18'),_0x2303a3[_0xd544('0x13')]());for(var _0x9fbec3=0x0;_0x9fbec3<_0x2303a3[_0xd544('0xf')];_0x9fbec3++){io[_0xd544('0x19')](_0xd544('0x1a'),{'id':_0x2303a3[_0x9fbec3],'closed':!![]});}}})[_0xd544('0x1b')](function(_0x187cb1){logger['error'](_0xd544('0x1c'),_0x187cb1?util[_0xd544('0x1d')](_0x187cb1,{'showHidden':![],'depth':null}):'');});}exports[_0xd544('0x1e')]=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 bfa1a94..8cb7ec7 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4807=['now','innocenzo.biondo','CmContact','then','contacts1','destroy','CmHopper','log','finished\x20populating','hopper1','contacts2','bulkCreate','catch','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x4807,0x1af));var _0x7480=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4807[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x7480('0x0'));var db=require(_0x7480('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7480('0x2')]({'id':i,'firstName':_0x7480('0x3')+i,'lastName':_0x7480('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x7480('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7480('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7480('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7480('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7480('0x2')]({'id':i,'firstName':_0x7480('0x3')+i,'lastName':_0x7480('0x4')+i,'phone':0xf879fb460+i,'email':_0x7480('0x7')+i+_0x7480('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7480('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7480('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7480('0x6')](),'updatedAt':Date[_0x7480('0x6')]()});}db[_0x7480('0x8')]['destroy']({'where':{}})[_0x7480('0x9')](function(){return db[_0x7480('0x8')]['bulkCreate'](contacts);})[_0x7480('0x9')](function(){console['log']('finished\x20populating',_0x7480('0xa'));return db['CmHopper'][_0x7480('0xb')]({'where':{}});})[_0x7480('0x9')](function(){return db[_0x7480('0xc')]['bulkCreate'](hopper);})['then'](function(){console[_0x7480('0xd')](_0x7480('0xe'),_0x7480('0xf'));return db[_0x7480('0x8')]['bulkCreate'](contacts2);})['then'](function(){console['log']('finished\x20populating',_0x7480('0x10'));return db['CmHopper'][_0x7480('0x11')](hopper2);})[_0x7480('0x9')](function(){console['log'](_0x7480('0xe'),'hopper2');})[_0x7480('0x12')](function(_0x3b7af2){console[_0x7480('0xd')](_0x3b7af2);}); \ No newline at end of file +var _0xea99=['bulkCreate','contacts2','hopper2','catch','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','log','finished\x20populating','CmHopper'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xea99,0x8c));var _0x9ea9=function(_0x392a88,_0x478705){_0x392a88=_0x392a88-0x0;var _0x31cb1a=_0xea99[_0x392a88];return _0x31cb1a;};'use strict';var util=require('util');var db=require(_0x9ea9('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9ea9('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9ea9('0x2')+i,'phone':0xf879fb460+i,'email':_0x9ea9('0x3')+i+_0x9ea9('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9ea9('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9ea9('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9ea9('0x5')](),'updatedAt':Date[_0x9ea9('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9ea9('0x1')]({'id':i,'firstName':_0x9ea9('0x6')+i,'lastName':_0x9ea9('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}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[_0x9ea9('0x5')](),'updatedAt':Date['now']()});}db[_0x9ea9('0x7')][_0x9ea9('0x8')]({'where':{}})[_0x9ea9('0x9')](function(){return db[_0x9ea9('0x7')]['bulkCreate'](contacts);})['then'](function(){console[_0x9ea9('0xa')](_0x9ea9('0xb'),'contacts1');return db[_0x9ea9('0xc')][_0x9ea9('0x8')]({'where':{}});})[_0x9ea9('0x9')](function(){return db[_0x9ea9('0xc')][_0x9ea9('0xd')](hopper);})[_0x9ea9('0x9')](function(){console[_0x9ea9('0xa')](_0x9ea9('0xb'),'hopper1');return db['CmContact'][_0x9ea9('0xd')](contacts2);})[_0x9ea9('0x9')](function(){console[_0x9ea9('0xa')]('finished\x20populating',_0x9ea9('0xe'));return db[_0x9ea9('0xc')][_0x9ea9('0xd')](hopper2);})[_0x9ea9('0x9')](function(){console['log'](_0x9ea9('0xb'),_0x9ea9('0xf'));})[_0x9ea9('0x10')](function(_0x542045){console[_0x9ea9('0xa')](_0x542045);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 4ae2657..de01dfa 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf61c=['then','log','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','User','bulkCreate'];(function(_0x56f935,_0xbb3e13){var _0x25ff2f=function(_0x3d0fad){while(--_0x3d0fad){_0x56f935['push'](_0x56f935['shift']());}};_0x25ff2f(++_0xbb3e13);}(_0xf61c,0x1de));var _0xcf61=function(_0xe5d75f,_0x5d3776){_0xe5d75f=_0xe5d75f-0x0;var _0x3e5108=_0xf61c[_0xe5d75f];return _0x3e5108;};'use strict';var util=require(_0xcf61('0x0'));var db=require(_0xcf61('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xcf61('0x2')](_0xcf61('0x3'),'agent',i),'fullname':util[_0xcf61('0x2')]('%s%s',_0xcf61('0x4'),i),'email':util[_0xcf61('0x2')](_0xcf61('0x5'),'agent',i),'role':'agent','password':_0xcf61('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xcf61('0x7'),'ws',_0xcf61('0x8')],'disallow':[_0xcf61('0x9')],'allow':[_0xcf61('0xa')],'defaultuser':util[_0xcf61('0x2')](_0xcf61('0x3'),_0xcf61('0x4'),i),'encryption':_0xcf61('0xb'),'avpf':_0xcf61('0xb'),'force_avp':'yes','icesupport':_0xcf61('0xb'),'dtlsenable':_0xcf61('0xb'),'dtlsverify':'no','dtlscertfile':_0xcf61('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xcf61('0xd'),'callerid':util[_0xcf61('0x2')]('\x22%s\x22\x20<%s>',util[_0xcf61('0x2')]('%s%s',_0xcf61('0x4'),i),0xfa0+i)});}db[_0xcf61('0xe')][_0xcf61('0xf')](users)[_0xcf61('0x10')](function(){console[_0xcf61('0x11')]('add\x20user');})[_0xcf61('0x12')](function(_0x5c2100){console[_0xcf61('0x11')](_0x5c2100);}); \ No newline at end of file +var _0x7782=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','log','add\x20user','catch','push','format','agent','%s%s','%s%s@xcally.com','password','friend','wss','all','ulaw'];(function(_0x480a07,_0x2147f2){var _0xed5d11=function(_0x76863e){while(--_0x76863e){_0x480a07['push'](_0x480a07['shift']());}};_0xed5d11(++_0x2147f2);}(_0x7782,0xe4));var _0x2778=function(_0x28aee5,_0x5e1007){_0x28aee5=_0x28aee5-0x0;var _0x5caa21=_0x7782[_0x28aee5];return _0x5caa21;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2778('0x0')]({'name':util[_0x2778('0x1')]('%s%s',_0x2778('0x2'),i),'fullname':util[_0x2778('0x1')](_0x2778('0x3'),_0x2778('0x2'),i),'email':util[_0x2778('0x1')](_0x2778('0x4'),_0x2778('0x2'),i),'role':_0x2778('0x2'),'password':_0x2778('0x5'),'internal':0xfa0+i,'type':_0x2778('0x6'),'transport':['udp','ws',_0x2778('0x7')],'disallow':[_0x2778('0x8')],'allow':[_0x2778('0x9')],'defaultuser':util['format'](_0x2778('0x3'),'agent',i),'encryption':_0x2778('0xa'),'avpf':'yes','force_avp':_0x2778('0xa'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x2778('0xb'),'dtlsprivatekey':_0x2778('0xc'),'dtlssetup':'actpass','callerid':util[_0x2778('0x1')]('\x22%s\x22\x20<%s>',util['format'](_0x2778('0x3'),'agent',i),0xfa0+i)});}db[_0x2778('0xd')]['bulkCreate'](users)['then'](function(){console[_0x2778('0xe')](_0x2778('0xf'));})[_0x2778('0x10')](function(_0x4dbeef){console['log'](_0x4dbeef);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 1d22077..82fd329 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3974=['MailQueues','OpenchannelQueues','findAll','Telephones','resourceId','then','map','where','Campaign','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','FaxQueues','SmsQueue','MailQueue','WhatsappQueues','IvrCampaigns','agent','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','disconnect','DISCONNECTED','lodash','util','bluebird','name','Agents','User','role','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues'];(function(_0x4f8080,_0x3e5414){var _0x870d7c=function(_0x135437){while(--_0x135437){_0x4f8080['push'](_0x4f8080['shift']());}};_0x870d7c(++_0x3e5414);}(_0x3974,0xbc));var _0x4397=function(_0x107e45,_0x4e7991){_0x107e45=_0x107e45-0x0;var _0x4655ee=_0x3974[_0x107e45];return _0x4655ee;};'use strict';var _=require(_0x4397('0x0'));var util=require(_0x4397('0x1'));var BPromise=require(_0x4397('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x4397('0x3')],'include':[{'as':_0x4397('0x4'),'model':db[_0x4397('0x5')],'attributes':['id',_0x4397('0x3'),_0x4397('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4397('0x3')],'where':{'role':_0x4397('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4397('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x4397('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4397('0x3'),_0x4397('0x8')],'where':{'type':_0x4397('0x9')}};function getAssociatedResources(_0xc78051,_0x4c7790,_0x31c4b3){return db[_0x4397('0xa')][_0x4397('0xb')]({'where':{'name':_0xc78051,'userProfileId':_0x4c7790},'raw':!![]})['then'](function(_0x47e207){if(_0x47e207){if(_0x47e207[_0x4397('0xc')]){switch(_0xc78051){case _0x4397('0xd'):case _0x4397('0xe'):case'FaxQueues':case _0x4397('0xf'):case _0x4397('0x10'):case _0x4397('0x11'):case'WhatsappQueues':return db[_0x31c4b3][_0x4397('0x12')](queryQueues);case _0x4397('0x13'):return db[_0x31c4b3][_0x4397('0x12')](queryTelephones);case'Trunks':return db[_0x31c4b3][_0x4397('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x31c4b3][_0x4397('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0x4397('0x12')]({'attributes':[_0x4397('0x14')],'where':{'sectionId':_0x47e207['id']},'raw':!![]})[_0x4397('0x15')](function(_0x1aa61f){if(_0x1aa61f){var _0x172ce2={'where':{'id':_[_0x4397('0x16')](_0x1aa61f,'resourceId')},'raw':!![]};switch(_0x31c4b3){case _0x4397('0x5'):_0x172ce2[_0x4397('0x17')][_0x4397('0x6')]=_0x4397('0x7');break;case _0x4397('0x18'):_0x172ce2[_0x4397('0x17')][_0x4397('0x8')]=_0x4397('0x9');break;}return db[_0x31c4b3][_0x4397('0x12')](_0x172ce2);}else{return[];}});}}else{return[];}})['then'](function(_0x4d3284){return _0x4d3284;});}function joinOrLeaveQueues(_0xff27cd,_0x3a2810,_0x6ebced,_0xaf9b09){_0xff27cd[_0x3a2810](util['format']('%s:queue:%s',_0x6ebced,_0xaf9b09[_0x4397('0x3')]));if(_0xaf9b09[_0x4397('0x4')]){for(var _0x52bf64=0x0;_0x52bf64<_0xaf9b09['Agents']['length'];_0x52bf64+=0x1){_0xff27cd[_0x3a2810](util[_0x4397('0x19')](_0x4397('0x1a'),_0xaf9b09['Agents'][_0x52bf64][_0x4397('0x3')]));}}}function joinOrLeave(_0x3fef2b,_0x53d6d3,_0x2797d2){var _0x4d6de6;if(_0x3fef2b[_0x4397('0x1b')][_0x4397('0x1c')]['id']){db['User']['find']({'attributes':['id','name',_0x4397('0x6'),_0x4397('0x1d')],'where':{'id':_0x3fef2b[_0x4397('0x1b')][_0x4397('0x1c')]['id']},'include':[{'model':db[_0x4397('0x1e')],'as':_0x4397('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x4397('0x20')],'as':_0x4397('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x4397('0x22')],'as':_0x4397('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x4397('0x24')],'as':_0x4397('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x4397('0x26')],'as':_0x4397('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x4397('0x15')](function(_0x575536){if(_0x575536){_0x4d6de6=_0x575536;_0x3fef2b[_0x53d6d3](util[_0x4397('0x19')](_0x4397('0x1a'),_0x575536['name']));var _0x1e7d56=[];switch(_0x575536[_0x4397('0x6')]){case _0x4397('0x28'):_0x3fef2b[_0x53d6d3]('voice:inbound');_0x3fef2b[_0x53d6d3](_0x4397('0x29'));if(queryQueues[_0x4397('0x2a')](_0x4397('0x2b'))){delete queryQueues['include'];}_0x1e7d56[_0x4397('0x2c')](db['VoiceQueue'][_0x4397('0x12')](queryQueues));_0x1e7d56['push'](db[_0x4397('0x2d')][_0x4397('0x12')](queryQueues));_0x1e7d56[_0x4397('0x2c')](db[_0x4397('0x2e')][_0x4397('0x12')](queryQueues));_0x1e7d56[_0x4397('0x2c')](db['SmsQueue'][_0x4397('0x12')](queryQueues));_0x1e7d56[_0x4397('0x2c')](db['MailQueue']['findAll'](queryQueues));_0x1e7d56['push'](db[_0x4397('0x2f')][_0x4397('0x12')](queryQueues));_0x1e7d56[_0x4397('0x2c')](db[_0x4397('0x30')][_0x4397('0x12')](queryQueues));_0x1e7d56[_0x4397('0x2c')](db[_0x4397('0x5')]['findAll'](queryTelephones));_0x1e7d56['push'](db[_0x4397('0x31')][_0x4397('0x12')](queryTrunks));_0x1e7d56[_0x4397('0x2c')](db[_0x4397('0x18')]['findAll'](queryCampaigns));_0x1e7d56[_0x4397('0x2c')](db[_0x4397('0x5')][_0x4397('0x12')](queryAgents));break;case _0x4397('0x32'):_0x3fef2b[_0x53d6d3]('voice:inbound');_0x3fef2b[_0x53d6d3](_0x4397('0x29'));_0x1e7d56[_0x4397('0x2c')](getAssociatedResources('VoiceQueues',_0x575536[_0x4397('0x1d')],_0x4397('0x33')));_0x1e7d56[_0x4397('0x2c')](getAssociatedResources('ChatQueues',_0x575536['userProfileId'],_0x4397('0x2d')));_0x1e7d56[_0x4397('0x2c')](getAssociatedResources(_0x4397('0x34'),_0x575536[_0x4397('0x1d')],_0x4397('0x2e')));_0x1e7d56[_0x4397('0x2c')](getAssociatedResources('SmsQueues',_0x575536['userProfileId'],_0x4397('0x35')));_0x1e7d56['push'](getAssociatedResources(_0x4397('0x10'),_0x575536[_0x4397('0x1d')],_0x4397('0x36')));_0x1e7d56[_0x4397('0x2c')](getAssociatedResources(_0x4397('0x11'),_0x575536[_0x4397('0x1d')],'OpenchannelQueue'));_0x1e7d56[_0x4397('0x2c')](getAssociatedResources(_0x4397('0x37'),_0x575536['userProfileId'],_0x4397('0x30')));_0x1e7d56[_0x4397('0x2c')](getAssociatedResources(_0x4397('0x13'),_0x575536['userProfileId'],'User'));_0x1e7d56[_0x4397('0x2c')](getAssociatedResources('Trunks',_0x575536[_0x4397('0x1d')],_0x4397('0x31')));_0x1e7d56[_0x4397('0x2c')](getAssociatedResources(_0x4397('0x38'),_0x575536['userProfileId'],_0x4397('0x18')));_0x1e7d56[_0x4397('0x2c')](db[_0x4397('0x5')][_0x4397('0x12')](queryAgents));break;case _0x4397('0x39'):_0x3fef2b[_0x53d6d3](_0x4397('0x3a'));_0x3fef2b[_0x53d6d3]('voice:outbound');_0x1e7d56[_0x4397('0x2c')](_0x575536[_0x4397('0x3b')]({'attributes':['id',_0x4397('0x3')]}));_0x1e7d56['push'](_0x575536[_0x4397('0x3c')]({'attributes':['id',_0x4397('0x3')]}));_0x1e7d56[_0x4397('0x2c')](_0x575536[_0x4397('0x3d')]({'attributes':['id',_0x4397('0x3')]}));_0x1e7d56[_0x4397('0x2c')](_0x575536[_0x4397('0x3e')]({'attributes':['id','name']}));_0x1e7d56[_0x4397('0x2c')](_0x575536[_0x4397('0x3f')]({'attributes':['id',_0x4397('0x3')]}));_0x1e7d56['push'](_0x575536[_0x4397('0x40')]({'attributes':['id',_0x4397('0x3')]}));_0x1e7d56[_0x4397('0x2c')](_0x575536[_0x4397('0x41')]({'attributes':['id',_0x4397('0x3')]}));break;}return BPromise[_0x4397('0x42')](_0x1e7d56);}})[_0x4397('0x15')](function(_0x60bc33){if(_0x60bc33&&_0x60bc33[_0x4397('0x43')]){for(var _0x195d63=0x0;_0x195d63<_0x60bc33['length'];_0x195d63+=0x1){for(var _0x47a3fc=0x0;_0x47a3fc<_0x60bc33[_0x195d63][_0x4397('0x43')];_0x47a3fc+=0x1){switch(_0x195d63){case 0x0:joinOrLeaveQueues(_0x3fef2b,_0x53d6d3,_0x4397('0x44'),_0x60bc33[_0x195d63][_0x47a3fc]);break;case 0x1:joinOrLeaveQueues(_0x3fef2b,_0x53d6d3,_0x4397('0x45'),_0x60bc33[_0x195d63][_0x47a3fc]);break;case 0x2:joinOrLeaveQueues(_0x3fef2b,_0x53d6d3,_0x4397('0x46'),_0x60bc33[_0x195d63][_0x47a3fc]);break;case 0x3:joinOrLeaveQueues(_0x3fef2b,_0x53d6d3,_0x4397('0x47'),_0x60bc33[_0x195d63][_0x47a3fc]);break;case 0x4:joinOrLeaveQueues(_0x3fef2b,_0x53d6d3,_0x4397('0x48'),_0x60bc33[_0x195d63][_0x47a3fc]);break;case 0x5:joinOrLeaveQueues(_0x3fef2b,_0x53d6d3,'openchannel',_0x60bc33[_0x195d63][_0x47a3fc]);break;case 0x6:joinOrLeaveQueues(_0x3fef2b,_0x53d6d3,_0x4397('0x49'),_0x60bc33[_0x195d63][_0x47a3fc]);break;case 0x7:if(_0x4d6de6[_0x4397('0x6')]!=='agent')_0x3fef2b[_0x53d6d3](util['format'](_0x4397('0x4a'),_0x60bc33[_0x195d63][_0x47a3fc][_0x4397('0x3')]));break;case 0x8:if(_0x4d6de6[_0x4397('0x6')]!=='agent')_0x3fef2b[_0x53d6d3](util[_0x4397('0x19')](_0x4397('0x4b'),_0x60bc33[_0x195d63][_0x47a3fc]['name']));break;case 0x9:if(_0x4d6de6[_0x4397('0x6')]!=='agent')_0x3fef2b[_0x53d6d3](util[_0x4397('0x19')]('campaign:%s:%s',_0x60bc33[_0x195d63][_0x47a3fc][_0x4397('0x8')],_0x60bc33[_0x195d63][_0x47a3fc][_0x4397('0x3')]));break;case 0xa:_0x3fef2b[_0x53d6d3](util[_0x4397('0x19')](_0x4397('0x1a'),_0x60bc33[_0x195d63][_0x47a3fc][_0x4397('0x3')]));break;}}}}})[_0x4397('0x15')](function(){if(_0x53d6d3==='leave'){var _0x40e6e9=_[_0x4397('0x16')](_0x4d6de6[_0x4397('0x1f')],'id');return _0x4d6de6[_0x4397('0x4c')](_0x40e6e9)[_0x4397('0x15')](function(){for(var _0x4f6784=0x0;_0x4f6784<_0x40e6e9[_0x4397('0x43')];_0x4f6784+=0x1){_0x2797d2[_0x4397('0x4d')](_0x4397('0x4e'),{'ChatInteractionId':Number(_0x40e6e9[_0x4f6784]),'UserId':Number(_0x4d6de6['id'])});}});}})[_0x4397('0x15')](function(){if(_0x53d6d3===_0x4397('0x4f')){var _0x279304=_[_0x4397('0x16')](_0x4d6de6['MailInteractions'],'id');return _0x4d6de6['removeMailInteractions'](_0x279304)[_0x4397('0x15')](function(){for(var _0x190376=0x0;_0x190376<_0x279304[_0x4397('0x43')];_0x190376+=0x1){_0x2797d2[_0x4397('0x4d')](_0x4397('0x50'),{'MailInteractionId':Number(_0x279304[_0x190376]),'UserId':Number(_0x4d6de6['id'])});}});}})[_0x4397('0x15')](function(){if(_0x53d6d3===_0x4397('0x4f')){var _0x3dbf92=_[_0x4397('0x16')](_0x4d6de6['FaxInteractions'],'id');return _0x4d6de6['removeFaxInteractions'](_0x3dbf92)['then'](function(){for(var _0xa391b4=0x0;_0xa391b4<_0x3dbf92[_0x4397('0x43')];_0xa391b4+=0x1){_0x2797d2[_0x4397('0x4d')](_0x4397('0x51'),{'FaxInteractionId':Number(_0x3dbf92[_0xa391b4]),'UserId':Number(_0x4d6de6['id'])});}});}})[_0x4397('0x15')](function(){if(_0x53d6d3===_0x4397('0x4f')){var _0x493138=_[_0x4397('0x16')](_0x4d6de6['SmsInteractions'],'id');return _0x4d6de6[_0x4397('0x52')](_0x493138)[_0x4397('0x15')](function(){for(var _0x310c2a=0x0;_0x310c2a<_0x493138[_0x4397('0x43')];_0x310c2a+=0x1){_0x2797d2['emit'](_0x4397('0x53'),{'SmsInteractionId':Number(_0x493138[_0x310c2a]),'UserId':Number(_0x4d6de6['id'])});}});}})[_0x4397('0x15')](function(){if(_0x53d6d3===_0x4397('0x4f')){var _0x5ddf8c=_['map'](_0x4d6de6[_0x4397('0x27')],'id');return _0x4d6de6[_0x4397('0x54')](_0x5ddf8c)[_0x4397('0x15')](function(){for(var _0x5e527a=0x0;_0x5e527a<_0x5ddf8c[_0x4397('0x43')];_0x5e527a+=0x1){_0x2797d2[_0x4397('0x4d')](_0x4397('0x55'),{'OpenchannelInteractionId':Number(_0x5ddf8c[_0x5e527a]),'UserId':Number(_0x4d6de6['id'])});}});}})[_0x4397('0x15')](function(){if(_0x53d6d3==='leave'){var _0x553e8a=_[_0x4397('0x16')](_0x4d6de6[_0x4397('0x56')],'id');return _0x4d6de6[_0x4397('0x57')](_0x553e8a)[_0x4397('0x15')](function(){for(var _0x49ee88=0x0;_0x49ee88<_0x553e8a[_0x4397('0x43')];_0x49ee88+=0x1){_0x2797d2['emit'](_0x4397('0x58'),{'WhatsappInteractionId':Number(_0x553e8a[_0x49ee88]),'UserId':Number(_0x4d6de6['id'])});}});}})[_0x4397('0x59')](function(_0x294385){_0x3fef2b[_0x4397('0x5a')](_0x294385);});}}function onDisconnect(_0x292756,_0x2474ca){joinOrLeave(_0x292756,_0x4397('0x4f'),_0x2474ca);}function onConnect(_0x34a1de){joinOrLeave(_0x34a1de,_0x4397('0x5b'));}exports[_0x4397('0x5c')]=function(_0x5496b0){_0x5496b0['on'](_0x4397('0x5d'),function(_0x429c33){_0x429c33[_0x4397('0x5e')](0x0);_0x429c33[_0x4397('0x5f')]=_0x429c33[_0x4397('0x60')]['connection'][_0x4397('0x61')]+':'+_0x429c33[_0x4397('0x60')]['connection'][_0x4397('0x62')];_0x429c33['connectedAt']=new Date();_0x429c33['log']=function(_0x410f26){console[_0x4397('0x5a')](_0x4397('0x63')+_0x429c33['nsp'][_0x4397('0x3')]+'['+_0x429c33[_0x4397('0x5f')]+']',_0x410f26);};_0x429c33['on'](_0x4397('0x64'),function(){onDisconnect(_0x429c33,_0x5496b0);_0x429c33[_0x4397('0x5a')](_0x4397('0x65'));});onConnect(_0x429c33);_0x429c33[_0x4397('0x5a')]('CONNECTED');});}; \ No newline at end of file +var _0x292c=['SocketIO\x20','nsp','disconnect','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','where','role','%s:queue:%s','length','format','user:%s','handshake','query','User','ChatInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','Campaign','VoiceQueues','userProfileId','OpenchannelQueue','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','map','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','connection','setMaxListeners','address','request','remoteAddress','remotePort'];(function(_0x206711,_0x4125b4){var _0x4fe02b=function(_0x27dc45){while(--_0x27dc45){_0x206711['push'](_0x206711['shift']());}};_0x4fe02b(++_0x4125b4);}(_0x292c,0x66));var _0xc292=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x292c[_0x1030ce];return _0x3367fd;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var BPromise=require(_0xc292('0x1'));var db=require(_0xc292('0x2'))['db'];var config=require(_0xc292('0x3'));var queryQueues={'attributes':['id',_0xc292('0x4')],'include':[{'as':_0xc292('0x5'),'model':db['User'],'attributes':['id',_0xc292('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc292('0x4')],'where':{'role':_0xc292('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc292('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc292('0x4')],'where':{'role':_0xc292('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc292('0x4'),_0xc292('0x8')],'where':{'type':_0xc292('0x9')}};function getAssociatedResources(_0x162e17,_0x43fd69,_0x5a548a){return db[_0xc292('0xa')][_0xc292('0xb')]({'where':{'name':_0x162e17,'userProfileId':_0x43fd69},'raw':!![]})[_0xc292('0xc')](function(_0x25d1f0){if(_0x25d1f0){if(_0x25d1f0[_0xc292('0xd')]){switch(_0x162e17){case'VoiceQueues':case _0xc292('0xe'):case _0xc292('0xf'):case _0xc292('0x10'):case _0xc292('0x11'):case _0xc292('0x12'):case _0xc292('0x13'):return db[_0x5a548a]['findAll'](queryQueues);case _0xc292('0x14'):return db[_0x5a548a][_0xc292('0x15')](queryTelephones);case _0xc292('0x16'):return db[_0x5a548a][_0xc292('0x15')](queryTrunks);case _0xc292('0x17'):return db[_0x5a548a]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0xc292('0x15')]({'attributes':[_0xc292('0x18')],'where':{'sectionId':_0x25d1f0['id']},'raw':!![]})['then'](function(_0x290138){if(_0x290138){var _0x53a23e={'where':{'id':_['map'](_0x290138,_0xc292('0x18'))},'raw':!![]};switch(_0x5a548a){case'User':_0x53a23e[_0xc292('0x19')][_0xc292('0x1a')]=_0xc292('0x6');break;case'Campaign':_0x53a23e[_0xc292('0x19')]['type']='ivr';break;}return db[_0x5a548a][_0xc292('0x15')](_0x53a23e);}else{return[];}});}}else{return[];}})[_0xc292('0xc')](function(_0x5808f1){return _0x5808f1;});}function joinOrLeaveQueues(_0x2a74af,_0xaee8d7,_0x314f3b,_0x5a9873){_0x2a74af[_0xaee8d7](util['format'](_0xc292('0x1b'),_0x314f3b,_0x5a9873[_0xc292('0x4')]));if(_0x5a9873[_0xc292('0x5')]){for(var _0x2493ac=0x0;_0x2493ac<_0x5a9873[_0xc292('0x5')][_0xc292('0x1c')];_0x2493ac+=0x1){_0x2a74af[_0xaee8d7](util[_0xc292('0x1d')](_0xc292('0x1e'),_0x5a9873[_0xc292('0x5')][_0x2493ac]['name']));}}}function joinOrLeave(_0x5b3562,_0x2a1750,_0x3aa05b){var _0x4ba9e3;if(_0x5b3562[_0xc292('0x1f')][_0xc292('0x20')]['id']){db[_0xc292('0x21')]['find']({'attributes':['id',_0xc292('0x4'),_0xc292('0x1a'),'userProfileId'],'where':{'id':_0x5b3562['handshake'][_0xc292('0x20')]['id']},'include':[{'model':db[_0xc292('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc292('0x23')],'as':_0xc292('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xc292('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xc292('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xc292('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x23cb2c){if(_0x23cb2c){_0x4ba9e3=_0x23cb2c;_0x5b3562[_0x2a1750](util[_0xc292('0x1d')]('user:%s',_0x23cb2c['name']));var _0x939e19=[];switch(_0x23cb2c['role']){case _0xc292('0x28'):_0x5b3562[_0x2a1750](_0xc292('0x29'));_0x5b3562[_0x2a1750](_0xc292('0x2a'));if(queryQueues['hasOwnProperty'](_0xc292('0x2b'))){delete queryQueues[_0xc292('0x2b')];}_0x939e19[_0xc292('0x2c')](db[_0xc292('0x2d')][_0xc292('0x15')](queryQueues));_0x939e19['push'](db[_0xc292('0x2e')][_0xc292('0x15')](queryQueues));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x2f')]['findAll'](queryQueues));_0x939e19['push'](db[_0xc292('0x30')][_0xc292('0x15')](queryQueues));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x31')][_0xc292('0x15')](queryQueues));_0x939e19[_0xc292('0x2c')](db['OpenchannelQueue']['findAll'](queryQueues));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x32')]['findAll'](queryQueues));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x21')][_0xc292('0x15')](queryTelephones));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x33')]['findAll'](queryTrunks));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x34')][_0xc292('0x15')](queryCampaigns));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x21')][_0xc292('0x15')](queryAgents));break;case'user':_0x5b3562[_0x2a1750](_0xc292('0x29'));_0x5b3562[_0x2a1750](_0xc292('0x2a'));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0x35'),_0x23cb2c[_0xc292('0x36')],'VoiceQueue'));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0xe'),_0x23cb2c[_0xc292('0x36')],_0xc292('0x2e')));_0x939e19[_0xc292('0x2c')](getAssociatedResources('FaxQueues',_0x23cb2c['userProfileId'],_0xc292('0x2f')));_0x939e19[_0xc292('0x2c')](getAssociatedResources('SmsQueues',_0x23cb2c[_0xc292('0x36')],_0xc292('0x30')));_0x939e19['push'](getAssociatedResources(_0xc292('0x11'),_0x23cb2c[_0xc292('0x36')],'MailQueue'));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0x12'),_0x23cb2c[_0xc292('0x36')],_0xc292('0x37')));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0x13'),_0x23cb2c['userProfileId'],_0xc292('0x32')));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0x14'),_0x23cb2c['userProfileId'],_0xc292('0x21')));_0x939e19['push'](getAssociatedResources('Trunks',_0x23cb2c[_0xc292('0x36')],_0xc292('0x33')));_0x939e19[_0xc292('0x2c')](getAssociatedResources('IvrCampaigns',_0x23cb2c[_0xc292('0x36')],'Campaign'));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x21')][_0xc292('0x15')](queryAgents));break;case'agent':_0x5b3562[_0x2a1750]('voice:inbound');_0x5b3562[_0x2a1750](_0xc292('0x2a'));_0x939e19[_0xc292('0x2c')](_0x23cb2c['getVoiceQueues']({'attributes':['id','name']}));_0x939e19[_0xc292('0x2c')](_0x23cb2c[_0xc292('0x38')]({'attributes':['id',_0xc292('0x4')]}));_0x939e19['push'](_0x23cb2c[_0xc292('0x39')]({'attributes':['id','name']}));_0x939e19['push'](_0x23cb2c[_0xc292('0x3a')]({'attributes':['id','name']}));_0x939e19[_0xc292('0x2c')](_0x23cb2c['getMailQueues']({'attributes':['id',_0xc292('0x4')]}));_0x939e19[_0xc292('0x2c')](_0x23cb2c[_0xc292('0x3b')]({'attributes':['id',_0xc292('0x4')]}));_0x939e19[_0xc292('0x2c')](_0x23cb2c[_0xc292('0x3c')]({'attributes':['id','name']}));break;}return BPromise[_0xc292('0x3d')](_0x939e19);}})[_0xc292('0xc')](function(_0x48ab49){if(_0x48ab49&&_0x48ab49[_0xc292('0x1c')]){for(var _0x25711e=0x0;_0x25711e<_0x48ab49[_0xc292('0x1c')];_0x25711e+=0x1){for(var _0x721f32=0x0;_0x721f32<_0x48ab49[_0x25711e][_0xc292('0x1c')];_0x721f32+=0x1){switch(_0x25711e){case 0x0:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x3e'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x1:joinOrLeaveQueues(_0x5b3562,_0x2a1750,'chat',_0x48ab49[_0x25711e][_0x721f32]);break;case 0x2:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x3f'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x3:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x40'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x4:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x41'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x5:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x42'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x6:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x43'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x7:if(_0x4ba9e3[_0xc292('0x1a')]!==_0xc292('0x7'))_0x5b3562[_0x2a1750](util[_0xc292('0x1d')](_0xc292('0x44'),_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x4')]));break;case 0x8:if(_0x4ba9e3[_0xc292('0x1a')]!==_0xc292('0x7'))_0x5b3562[_0x2a1750](util[_0xc292('0x1d')](_0xc292('0x45'),_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x4')]));break;case 0x9:if(_0x4ba9e3[_0xc292('0x1a')]!=='agent')_0x5b3562[_0x2a1750](util[_0xc292('0x1d')](_0xc292('0x46'),_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x8')],_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x4')]));break;case 0xa:_0x5b3562[_0x2a1750](util['format'](_0xc292('0x1e'),_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x4')]));break;}}}}})[_0xc292('0xc')](function(){if(_0x2a1750===_0xc292('0x47')){var _0x16e531=_['map'](_0x4ba9e3[_0xc292('0x48')],'id');return _0x4ba9e3['removeChatInteractions'](_0x16e531)[_0xc292('0xc')](function(){for(var _0x299546=0x0;_0x299546<_0x16e531[_0xc292('0x1c')];_0x299546+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x4a'),{'ChatInteractionId':Number(_0x16e531[_0x299546]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0xc')](function(){if(_0x2a1750==='leave'){var _0x71b80d=_['map'](_0x4ba9e3[_0xc292('0x4b')],'id');return _0x4ba9e3[_0xc292('0x4c')](_0x71b80d)[_0xc292('0xc')](function(){for(var _0x49ceaa=0x0;_0x49ceaa<_0x71b80d['length'];_0x49ceaa+=0x1){_0x3aa05b['emit'](_0xc292('0x4d'),{'MailInteractionId':Number(_0x71b80d[_0x49ceaa]),'UserId':Number(_0x4ba9e3['id'])});}});}})['then'](function(){if(_0x2a1750==='leave'){var _0x3e72dc=_[_0xc292('0x4e')](_0x4ba9e3['FaxInteractions'],'id');return _0x4ba9e3[_0xc292('0x4f')](_0x3e72dc)['then'](function(){for(var _0x9b4bff=0x0;_0x9b4bff<_0x3e72dc[_0xc292('0x1c')];_0x9b4bff+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x50'),{'FaxInteractionId':Number(_0x3e72dc[_0x9b4bff]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0xc')](function(){if(_0x2a1750==='leave'){var _0x550332=_['map'](_0x4ba9e3['SmsInteractions'],'id');return _0x4ba9e3['removeSmsInteractions'](_0x550332)[_0xc292('0xc')](function(){for(var _0x447360=0x0;_0x447360<_0x550332['length'];_0x447360+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x51'),{'SmsInteractionId':Number(_0x550332[_0x447360]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0xc')](function(){if(_0x2a1750===_0xc292('0x47')){var _0x11636f=_[_0xc292('0x4e')](_0x4ba9e3['OpenchannelInteractions'],'id');return _0x4ba9e3['removeOpenchannelInteractions'](_0x11636f)[_0xc292('0xc')](function(){for(var _0x28a798=0x0;_0x28a798<_0x11636f['length'];_0x28a798+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x52'),{'OpenchannelInteractionId':Number(_0x11636f[_0x28a798]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0xc')](function(){if(_0x2a1750===_0xc292('0x47')){var _0x1e73e5=_[_0xc292('0x4e')](_0x4ba9e3[_0xc292('0x53')],'id');return _0x4ba9e3[_0xc292('0x54')](_0x1e73e5)[_0xc292('0xc')](function(){for(var _0x58b87a=0x0;_0x58b87a<_0x1e73e5[_0xc292('0x1c')];_0x58b87a+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x55'),{'WhatsappInteractionId':Number(_0x1e73e5[_0x58b87a]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0x56')](function(_0xf39dad){_0x5b3562[_0xc292('0x57')](_0xf39dad);});}}function onDisconnect(_0x4a7d4e,_0x598929){joinOrLeave(_0x4a7d4e,_0xc292('0x47'),_0x598929);}function onConnect(_0x10dcfb){joinOrLeave(_0x10dcfb,'join');}exports['default']=function(_0x14b813){_0x14b813['on'](_0xc292('0x58'),function(_0x581a97){_0x581a97[_0xc292('0x59')](0x0);_0x581a97[_0xc292('0x5a')]=_0x581a97[_0xc292('0x5b')][_0xc292('0x58')][_0xc292('0x5c')]+':'+_0x581a97[_0xc292('0x5b')][_0xc292('0x58')][_0xc292('0x5d')];_0x581a97['connectedAt']=new Date();_0x581a97[_0xc292('0x57')]=function(_0x406851){console[_0xc292('0x57')](_0xc292('0x5e')+_0x581a97[_0xc292('0x5f')][_0xc292('0x4')]+'['+_0x581a97[_0xc292('0x5a')]+']',_0x406851);};_0x581a97['on'](_0xc292('0x60'),function(){onDisconnect(_0x581a97,_0x14b813);_0x581a97['log']('DISCONNECTED');});onConnect(_0x581a97);_0x581a97[_0xc292('0x57')](_0xc292('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7e09e92..f666e7b 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 _0xbce1=['ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','closedinteraction','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','info','error','code','channel','direction','then','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','UserId','undefined','SIP/%s','agent','incomingmessage','outgoingmessage','catch','Trigger,\x20%s','motionChannel','event','offlineMessage','get','opened','resolve','sequelize','format','AfterCreate','changed','closed','substatus','QueryTypes','SELECT','AfterUpdate','User','name','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','triggers','client','http','Chat'];(function(_0x4aca94,_0x2a4e56){var _0x4f3800=function(_0x8410f1){while(--_0x8410f1){_0x4aca94['push'](_0x4aca94['shift']());}};_0x4f3800(++_0x2a4e56);}(_0xbce1,0x1bc));var _0x1bce=function(_0x5ae2ff,_0x11a534){_0x5ae2ff=_0x5ae2ff-0x0;var _0x341ec9=_0xbce1[_0x5ae2ff];return _0x341ec9;};'use strict';var util=require(_0x1bce('0x0'));var db=require(_0x1bce('0x1'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0x1bce('0x2'));var client=jayson[_0x1bce('0x3')][_0x1bce('0x4')]({'port':0x232a});var triggers=[{'channel':_0x1bce('0x5'),'model':_0x1bce('0x6'),'event':_0x1bce('0x7'),'condition':_0x1bce('0x8'),'callback':afterCreate},{'channel':_0x1bce('0x5'),'model':_0x1bce('0x6'),'event':_0x1bce('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1bce('0x5'),'model':_0x1bce('0xa'),'event':_0x1bce('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0x1bce('0xb'),'event':_0x1bce('0x7'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':'SmsInteraction','event':'afterCreate','condition':_0x1bce('0x8'),'callback':afterCreate},{'channel':_0x1bce('0xc'),'model':_0x1bce('0xd'),'event':_0x1bce('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1bce('0xc'),'model':_0x1bce('0xe'),'event':_0x1bce('0x7'),'condition':_0x1bce('0xf'),'callback':afterCreateMessage},{'channel':_0x1bce('0x10'),'model':_0x1bce('0x11'),'event':_0x1bce('0x7'),'condition':_0x1bce('0x8'),'callback':afterCreate},{'channel':_0x1bce('0x10'),'model':_0x1bce('0x11'),'event':'afterUpdate','condition':_0x1bce('0x12'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1bce('0x13'),'model':_0x1bce('0x14'),'event':_0x1bce('0x7'),'condition':_0x1bce('0x8'),'callback':afterCreate},{'channel':_0x1bce('0x13'),'model':_0x1bce('0x14'),'event':'afterUpdate','condition':_0x1bce('0x12'),'callback':afterUpdate},{'channel':_0x1bce('0x13'),'model':_0x1bce('0x15'),'event':_0x1bce('0x7'),'condition':_0x1bce('0xf'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x1bce('0x16'),'event':_0x1bce('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1bce('0x17'),'model':_0x1bce('0x16'),'event':_0x1bce('0x9'),'condition':_0x1bce('0x12'),'callback':afterUpdate},{'channel':'Mail','model':_0x1bce('0x18'),'event':_0x1bce('0x7'),'condition':_0x1bce('0xf'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x1bce('0x19'),'event':_0x1bce('0x7'),'condition':_0x1bce('0x8'),'callback':afterCreate},{'channel':_0x1bce('0x1a'),'model':'OpenchannelInteraction','event':_0x1bce('0x9'),'condition':_0x1bce('0x12'),'callback':afterUpdate},{'channel':_0x1bce('0x1a'),'model':_0x1bce('0x1b'),'event':_0x1bce('0x7'),'condition':_0x1bce('0xf'),'callback':afterCreateMessage}];function request(_0xb637fb){return client[_0x1bce('0x1c')](_0x1bce('0x1d'),_0xb637fb)['then'](function(_0x2c2d85){logger[_0x1bce('0x1e')]('Trigger,\x20%s',_0x1bce('0x1d'),_0x2c2d85);if(_0x2c2d85[_0x1bce('0x1f')]){if(_0x2c2d85[_0x1bce('0x1f')][_0x1bce('0x20')]===0x1f4){logger[_0x1bce('0x1f')]('Trigger,\x20%s',_0x1bce('0x1d'),_0x2c2d85['error']);}}})['catch'](function(_0x498d8b){logger[_0x1bce('0x1f')]('Trigger,\x20%s','EventManager',_0x498d8b);});}function afterCreateMessage(_0xbd8715){return function(_0x515860){_0x515860=_0x515860['get']({'plain':!![]});_0x515860[_0x1bce('0x21')]=_0xbd8715;_0x515860['motionChannel']=_0xbd8715;_0x515860['event']=_0x515860[_0x1bce('0x22')];Promise['resolve']()[_0x1bce('0x23')](function(){if(typeof _0x515860[_0x1bce('0x24')]==='undefined')return null;var _0x531e4f=_0x1bce('0x25')+_0x515860['ContactId'];return db['sequelize'][_0x1bce('0x26')](_0x531e4f,{'type':db[_0x1bce('0x27')]['QueryTypes']['SELECT'],'raw':!![]});})['then'](function(_0x403af4){if(_0x403af4){_0x515860['contact']=_0x403af4[0x0];}if(typeof _0x515860[_0x1bce('0x28')]===_0x1bce('0x29'))return;return getAgent(_0x515860[_0x1bce('0x28')]);})[_0x1bce('0x23')](function(_0x184a66){if(_0x184a66){_0x515860['interface']=util['format'](_0x1bce('0x2a'),_0x184a66['name']);_0x515860[_0x1bce('0x2b')]=_0x184a66;_0x515860[_0x1bce('0x21')]=_0xbd8715;return request({'event':_0x1bce('0x2c'),'message':_0x515860});}else{return request({'event':_0x1bce('0x2d'),'message':_0x515860});}})[_0x1bce('0x2e')](function(_0xe8ca68){logger[_0x1bce('0x1f')](_0x1bce('0x2f'),'AfterCreateMessage',_0xe8ca68);});};}function afterCreateOfflineMessage(_0x22643e){return function(_0x303b5d){_0x303b5d=_0x303b5d['get']({'plain':!![]});_0x303b5d['channel']=_0x22643e;_0x303b5d[_0x1bce('0x30')]=_0x22643e;_0x303b5d[_0x1bce('0x31')]=_0x1bce('0x32');return request({'event':_0x303b5d[_0x1bce('0x31')],'message':_0x303b5d});};}function afterCreate(_0x441c44,_0x2600f3){return function(_0x25a8af){_0x25a8af=_0x25a8af[_0x1bce('0x33')]({'plain':!![]});_0x25a8af['channel']=_0x441c44;_0x25a8af['motionChannel']=_0x441c44;_0x25a8af[_0x1bce('0x31')]=_0x1bce('0x34');Promise[_0x1bce('0x35')]()[_0x1bce('0x23')](function(){var _0x4b6791=_0x1bce('0x25')+_0x25a8af[_0x1bce('0x24')];return db[_0x1bce('0x36')][_0x1bce('0x26')](_0x4b6791,{'type':db[_0x1bce('0x27')]['QueryTypes']['SELECT'],'raw':!![]});})['then'](function(_0x2f9e68){if(_0x2f9e68){_0x25a8af['contact']=_0x2f9e68[0x0];}if(typeof _0x25a8af[_0x1bce('0x28')]===_0x1bce('0x29'))return;return getAgent(_0x25a8af[_0x1bce('0x28')]);})[_0x1bce('0x23')](function(_0x29a295){if(_0x29a295){_0x25a8af['interface']=util[_0x1bce('0x37')](_0x1bce('0x2a'),_0x29a295['name']);_0x25a8af[_0x1bce('0x2b')]=_0x29a295;}return request({'event':_0x2600f3,'message':_0x25a8af});})['catch'](function(_0x5cb72d){logger[_0x1bce('0x1f')](_0x1bce('0x2f'),_0x1bce('0x38'),_0x5cb72d);});};}function afterUpdate(_0x256d8b){return function(_0xf0d90){var _0x518290=_0xf0d90[_0x1bce('0x39')](_0x1bce('0x3a'))&&_0xf0d90[_0x1bce('0x3a')];var _0x12675a=_0xf0d90['changed']('substatus');if(_0x518290||_0x12675a){var _0x5506f2=_0x518290?_0x1bce('0x12'):_0x1bce('0x3b');var _0x429d3d=_0xf0d90['get']({'plain':!![]});_0x429d3d[_0x1bce('0x21')]=_0x256d8b;_0x429d3d[_0x1bce('0x30')]=_0x256d8b;_0x429d3d[_0x1bce('0x31')]=_0x518290?_0x1bce('0x3a'):'substatus';var _0x342073=_0x1bce('0x25')+_0x429d3d[_0x1bce('0x24')];return db['sequelize']['query'](_0x342073,{'type':db[_0x1bce('0x27')][_0x1bce('0x3c')][_0x1bce('0x3d')],'raw':!![]})[_0x1bce('0x23')](function(_0x15f91f){if(_0x15f91f){_0x429d3d['contact']=_0x15f91f[0x0];}if(typeof _0x429d3d[_0x1bce('0x28')]===_0x1bce('0x29'))return;return getAgent(_0x429d3d[_0x1bce('0x28')]);})[_0x1bce('0x23')](function(_0x18af62){if(_0x18af62){_0x429d3d['interface']=util[_0x1bce('0x37')](_0x1bce('0x2a'),_0x18af62['name']);_0x429d3d[_0x1bce('0x2b')]=_0x18af62;}return request({'event':_0x5506f2,'message':_0x429d3d});})['catch'](function(_0x1d4f7f){logger[_0x1bce('0x1f')]('Trigger,\x20%s',_0x1bce('0x3e'),_0x1d4f7f);});}};}function getAgent(_0x5eef0d){return db[_0x1bce('0x3f')]['find']({'where':{'id':_0x5eef0d},'attributes':['id',_0x1bce('0x40'),'fullname',_0x1bce('0x41'),_0x1bce('0x42')],'raw':!![]})[_0x1bce('0x23')](function(_0x5d1f07){return _0x5d1f07;});}exports[_0x1bce('0x43')]=function(){for(var _0x55e8ce=0x0;_0x55e8ce=_0x545228['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x567663(_0xb8a38e);})['catch'](function(_0x4cb6ca){_0x46401b(_0x4cb6ca);});});}; \ No newline at end of file +var _0xf5ec=['../mysqldb','./license/util','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird'];(function(_0xcec82,_0x283411){var _0x330d83=function(_0x104fc4){while(--_0x104fc4){_0xcec82['push'](_0xcec82['shift']());}};_0x330d83(++_0x283411);}(_0xf5ec,0x16e));var _0xcf5e=function(_0x1b07b0,_0x2f42ca){_0x1b07b0=_0x1b07b0-0x0;var _0x3a5552=_0xf5ec[_0x1b07b0];return _0x3a5552;};'use strict';var _=require(_0xcf5e('0x0'));var BPromise=require(_0xcf5e('0x1'));var db=require(_0xcf5e('0x2'))['db'];var util=require(_0xcf5e('0x3'));var channels=['voice',_0xcf5e('0x4'),'chat',_0xcf5e('0x5'),_0xcf5e('0x6'),_0xcf5e('0x7'),_0xcf5e('0x8')];exports[_0xcf5e('0x9')]=function(){return channels;};exports[_0xcf5e('0xa')]=function(_0x339605){_0x339605=_0x339605['toLowerCase']();return _['includes'](channels,_0x339605);};exports[_0xcf5e('0xb')]=function(_0xacb3ab,_0x3ef654,_0x53275e,_0x63d8f8){var _0x108dc2={'loginAttempts':_0x3ef654,'blocked':_0x53275e};if(!_[_0xcf5e('0xc')](_0x63d8f8)){_0x108dc2[_0xcf5e('0xd')]=_0x63d8f8;}return _0xacb3ab[_0xcf5e('0xe')](_0x108dc2);};exports[_0xcf5e('0xf')]=function(_0x4d77d8){return new BPromise(function(_0x2181c7,_0x3f626f){var _0x15e8d9=0x0;if(_0x4d77d8[_0xcf5e('0x10')]!==_0xcf5e('0x11')){_0x2181c7(_0x4d77d8);}db['User'][_0xcf5e('0x12')]({'where':{'role':_0xcf5e('0x11'),'online':!![],'id':{'$ne':_0x4d77d8['id']}}})[_0xcf5e('0x13')](function(_0x35fcc4){_0x15e8d9=_0x35fcc4;return util['getLicense']();})['then'](function(_0x186291){if(_0x186291&&_0x186291['agents']&&_0x15e8d9>=_0x186291[_0xcf5e('0x14')]){throw Error(_0xcf5e('0x15'));}_0x2181c7(_0x4d77d8);})[_0xcf5e('0x16')](function(_0x5582e6){_0x3f626f(_0x5582e6);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 3600ebc..b0c5e55 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x32fa1f,_0x3735be){var _0x51a8ca=function(_0x354849){while(--_0x354849){_0x32fa1f['push'](_0x32fa1f['shift']());}};_0x51a8ca(++_0x3735be);}(_0x814b,0x1a2));var _0xb814=function(_0x1f5873,_0x1497be){_0x1f5873=_0x1f5873-0x0;var _0x2a75d9=_0x814b[_0x1f5873];return _0x2a75d9;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x54ef=['send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Not\x20Found','Forbidden','OutOfInterval','error','stack','status'];(function(_0x2cdedd,_0x4b8889){var _0x55eb50=function(_0x429ffd){while(--_0x429ffd){_0x2cdedd['push'](_0x2cdedd['shift']());}};_0x55eb50(++_0x4b8889);}(_0x54ef,0x112));var _0xf54e=function(_0x15061a,_0x5eb67f){_0x15061a=_0x15061a-0x0;var _0x401650=_0x54ef[_0x15061a];return _0x401650;};'use strict';var util=require(_0xf54e('0x0'));var logger=require(_0xf54e('0x1'))(_0xf54e('0x2'));var APIError=function(_0x5d180f,_0xd936f7){this[_0xf54e('0x3')]=_0x5d180f||_0xf54e('0x4');this[_0xf54e('0x5')]=_0xd936f7||_0xf54e('0x6');util[_0xf54e('0x7')](APIError,Error);};var APIBadRequestError=function(_0x12d43f){this['message']=_0x12d43f||'Bad\x20Request';this[_0xf54e('0x5')]=_0xf54e('0x8');util[_0xf54e('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x561870){this[_0xf54e('0x3')]=_0x561870||'Entity\x20not\x20found';this[_0xf54e('0x5')]=_0xf54e('0x9');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x26fc3e){switch(_0x26fc3e){case _0xf54e('0x8'):return 0x190;case _0xf54e('0xa'),_0xf54e('0xb'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x558502){return function(_0xc939ab){logger[_0xf54e('0xc')](_0xc939ab[_0xf54e('0xd')]);var _0x553759=getStatusCode(_0xc939ab[_0xf54e('0x5')]);if(_0xc939ab['name'])delete _0xc939ab['name'];return _0x558502[_0xf54e('0xe')](_0x553759)[_0xf54e('0xf')](_0xc939ab);};}module[_0xf54e('0x10')]={'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 c2b7f9b..17b5ae4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1ef=['status','render','404'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb1ef,0x107));var _0xfb1e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb1ef[_0x321bb2];return _0x9c12ed;};'use strict';module['exports'][0x194]=function pageNotFound(_0xf6e548,_0x51156d){var _0x475a6=_0xfb1e('0x0');var _0x4a6177=0x194;var _0x5cd507={'status':_0x4a6177};_0x51156d[_0xfb1e('0x1')](_0x5cd507[_0xfb1e('0x1')]);_0x51156d[_0xfb1e('0x2')](_0x475a6,{},function(_0x16f791,_0x2bd96d){if(_0x16f791){return _0x51156d[_0xfb1e('0x1')](_0x5cd507[_0xfb1e('0x1')])['json'](_0x5cd507);}_0x51156d['send'](_0x2bd96d);});}; \ No newline at end of file +var _0xe299=['status','render','send','exports','404'];(function(_0x3fd894,_0xf24fbe){var _0x3670e7=function(_0x2fb300){while(--_0x2fb300){_0x3fd894['push'](_0x3fd894['shift']());}};_0x3670e7(++_0xf24fbe);}(_0xe299,0x1c5));var _0x9e29=function(_0x1d2dea,_0x267515){_0x1d2dea=_0x1d2dea-0x0;var _0x2281d6=_0xe299[_0x1d2dea];return _0x2281d6;};'use strict';module[_0x9e29('0x0')][0x194]=function pageNotFound(_0x3686d8,_0x4f9768){var _0x3da65e=_0x9e29('0x1');var _0x10cdba=0x194;var _0x154a2c={'status':_0x10cdba};_0x4f9768['status'](_0x154a2c[_0x9e29('0x2')]);_0x4f9768[_0x9e29('0x3')](_0x3da65e,{},function(_0x1e29e6,_0x1d736f){if(_0x1e29e6){return _0x4f9768[_0x9e29('0x2')](_0x154a2c[_0x9e29('0x2')])['json'](_0x154a2c);}_0x4f9768[_0x9e29('0x4')](_0x1d736f);});}; \ No newline at end of file diff --git a/server/migrations/2.6.19.js b/server/migrations/2.6.19.js index cc7819a..df9d107 100644 --- a/server/migrations/2.6.19.js +++ b/server/migrations/2.6.19.js @@ -267,6 +267,11 @@ module.exports = { }); // END whatsapp_interactions + //START cm_hopper + migration.query('ALTER TABLE `cm_hopper` DROP FOREIGN KEY `cm_hopper_ibfk_3`;'); + migration.query('ALTER TABLE `cm_hopper` ADD CONSTRAINT `cm_hopper_ibfk_3` FOREIGN KEY (`UserId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;'); + //END cm_hopper + // START FINAL migration.final(resolve); // END FINAL diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 9ea4f80..5764aee 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(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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=['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','SET\x20NULL','Campaign','CampaignId','All','Any','AutomationAnyId','Intervals','MailApplications','FaxApplications','AnalyticCustomReport','CustomReportId','Mohs','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactHasItem','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','DefaultReportId','MetricId','Configurations','SubjectId','Descriptions','DescriptionId','AccountId','Subject','Description','Field','FieldId','VariableId','SugarcrmField','Subjects','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','SessionId','JscriptyProject','ProjectId','JscriptyQuestionReport','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','UserSetting','user','exports','../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','SquareRecording','../api/squareRecording/squareRecording.model'];(function(_0x30d7bc,_0x2417b8){var _0x140e3f=function(_0x535d4d){while(--_0x535d4d){_0x30d7bc['push'](_0x30d7bc['shift']());}};_0x140e3f(++_0x2417b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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','onDelete':_0x0a9e('0x1a5')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a6')],{'as':'Campaign','foreignKey':_0x0a9e('0x1a7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':'OwnerId'});db[_0x0a9e('0x6f')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db['VoiceQueue'],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x14b'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a6')],{'as':_0x0a9e('0x1a6'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1a9'),'singular':'OneAny'},'foreignKey':_0x0a9e('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Disposition'][_0x0a9e('0x110')](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':'ParentId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x1ab'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':'restrict'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ac'),'foreignKey':_0x0a9e('0x153')});db['Interval']['hasMany'](db[_0x0a9e('0x63')],{'as':'ChatApplications','foreignKey':_0x0a9e('0x153')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x0a9e('0x82')][_0x0a9e('0x150')](db['MailAccount'],{});db[_0x0a9e('0x82')][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0x0a9e('0x1ae')],{'foreignKey':_0x0a9e('0x1af')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db['VoiceMusicOnHold'],{'as':_0x0a9e('0x1b0'),'through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db['Tag'][_0x0a9e('0x121')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x11c')],{'through':'mail_interaction_has_tags'});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x5d')],{'through':_0x0a9e('0x1b1')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b2')});db['CmContactHasItem'][_0x0a9e('0x150')](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b3'),'foreignKey':_0x0a9e('0x1b4')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b5'),'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('0x1b7'),'singular':_0x0a9e('0x1b8')},'foreignKey':_0x0a9e('0x1b9'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':'TriggerAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':'Actions','foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['AnalyticCustomReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1bd'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x0a9e('0x94')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x0a9e('0x1be')});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x0a9e('0x150')](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1bf')});db['SalesforceAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x0a9e('0x9e')][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x0a9e('0x1c1')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x0a9e('0x1c2'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c3')});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0x9e')][_0x0a9e('0x150')](db['SalesforceAccount'],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c4')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c5'),'foreignKey':_0x0a9e('0x1c1')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c6'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c7'),'foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':'Variable','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c4')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1ca')],{'as':_0x0a9e('0x1cb'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1ca')],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db['SugarcrmField'],{'as':_0x0a9e('0x1bd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa2')][_0x0a9e('0x150')](db['SugarcrmAccount'],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db['SugarcrmField']['hasMany'](db[_0x0a9e('0x1ca')],{'as':_0x0a9e('0x1c5'),'foreignKey':'SubjectId'});db[_0x0a9e('0x1ca')][_0x0a9e('0x110')](db['SugarcrmField'],{'as':_0x0a9e('0x1c6'),'foreignKey':_0x0a9e('0x1c3')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1ca')],{'as':_0x0a9e('0x1c7'),'foreignKey':'FieldId'});db[_0x0a9e('0x1ca')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1c9')});db['DeskAccount'][_0x0a9e('0x110')](db['DeskConfiguration'],{'as':_0x0a9e('0x1c0'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c4')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cb'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c1')});db['DeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c2'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':_0x0a9e('0x1bd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c4')});db['DeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x0a9e('0xa8')]['hasMany'](db[_0x0a9e('0xa8')],{'as':'Subject','foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c6'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c7'),'foreignKey':_0x0a9e('0x1c8')});db['DeskField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c4')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db['ZohoField'],{'as':_0x0a9e('0x1cb'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c2'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c4')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subject','foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db['ZohoField'],{'as':'Description','foreignKey':_0x0a9e('0x1c3')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c7'),'foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':'Variable','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xaf')]['hasMany'](db[_0x0a9e('0x1cd')],{'as':_0x0a9e('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x0a9e('0x1cd')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c1')});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x0a9e('0x1cd')]['hasMany'](db['ZendeskField'],{'as':'Fields','foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0x1cd')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':'Account','foreignKey':_0x0a9e('0x1c4')});db['ZendeskConfiguration']['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1ce')});db[_0x0a9e('0xb2')]['hasMany'](db['ZendeskField'],{'as':'Subject','foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c6'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c7'),'foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xb2')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1cf')][_0x0a9e('0x110')](db[_0x0a9e('0x1d0')],{'as':_0x0a9e('0x1c0'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c4')});db[_0x0a9e('0x1d0')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0x1d0')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c3')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x0a9e('0x1bd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db['FreshdeskAccount'],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':_0x0a9e('0x1c5'),'foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xb5')]['hasMany'](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c7'),'foreignKey':_0x0a9e('0x1c8')});db['FreshdeskField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c0'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c4')});db['VtigerConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1cb'),'foreignKey':'SubjectId'});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c2'),'foreignKey':_0x0a9e('0x1c3')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1bd'),'foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c4')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1c5'),'foreignKey':'SubjectId'});db['VtigerField'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1c6'),'foreignKey':_0x0a9e('0x1c3')});db[_0x0a9e('0xb9')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c7'),'foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1c9')});db['ServicenowAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c0'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c4')});db['ServicenowConfiguration']['hasMany'](db[_0x0a9e('0x1d3')],{'as':'Subjects','foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c2'),'foreignKey':_0x0a9e('0x1c3')});db['ServicenowConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1bd'),'foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c5'),'foreignKey':_0x0a9e('0x1c1')});db['ServicenowField'][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1c6'),'foreignKey':_0x0a9e('0x1c3')});db[_0x0a9e('0x1d3')]['hasMany'](db[_0x0a9e('0x1d3')],{'as':'Field','foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0x1d3')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':'Variable','foreignKey':_0x0a9e('0x1c9')});db['Dynamics365Account'][_0x0a9e('0x110')](db[_0x0a9e('0xbf')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c4')});db[_0x0a9e('0xbe')]['belongsTo'](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162')});db[_0x0a9e('0xbf')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1bd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c5'),'foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c6'),'foreignKey':_0x0a9e('0x1c3')});db[_0x0a9e('0xc1')]['hasMany'](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c7'),'foreignKey':_0x0a9e('0x1c8')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xc3')][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c4')});db[_0x0a9e('0xc5')]['hasMany'](db['FreshsalesField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Descriptions','foreignKey':_0x0a9e('0x1c3')});db['FreshsalesConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Fields','foreignKey':_0x0a9e('0x1c8')});db['FreshsalesConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xc3')],{'as':'Account','foreignKey':_0x0a9e('0x1c4')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':_0x0a9e('0x1c5'),'foreignKey':_0x0a9e('0x1c1')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c6'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c7'),'foreignKey':'FieldId'});db['FreshsalesField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x0a9e('0x150')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db['User'],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x0a9e('0xcc')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d4')});db['JscriptySessionReport'][_0x0a9e('0x110')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['JscriptySessionReport'][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':_0x0a9e('0x1d5'),'onDelete':'cascade'});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x124')],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db['SmsQueueReport']['belongsTo'](db['SmsMessage'],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0x1d6')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x12a')});db['Team'][_0x0a9e('0x121')](db['VoiceQueue'],{'through':_0x0a9e('0x105'),'as':'VoiceQueues'});db['Team'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1d9')});db['Team']['belongsToMany'](db[_0x0a9e('0x67')],{'through':'team_has_chat_queues','as':_0x0a9e('0x133')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x4c')],{'through':'team_has_fax_queues','as':_0x0a9e('0x135')});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('0x1da')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1db'),'as':_0x0a9e('0x138')});db['Team'][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':'VoicePrefixes'});db[_0x0a9e('0x1a6')][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a6')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a6')]['hasMany'](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db['Campaign'][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x0a9e('0x1a7')});db['Campaign'][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x28'),'foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a6')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x0a9e('0x1a6')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a6')]['belongsTo'](db[_0x0a9e('0xdc')],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1dc')});db[_0x0a9e('0x1a6')][_0x0a9e('0x121')](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x1dd')});db[_0x0a9e('0x1a6')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1de')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1df')]['belongsTo'](db['MailMessage'],{});db[_0x0a9e('0x1df')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x1df')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e0'),'as':_0x0a9e('0x1e1')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1df')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e4'),'as':_0x0a9e('0x1e5')});db[_0x0a9e('0x1df')][_0x0a9e('0x150')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1df')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x64')],{});db['ChatTransferReport']['belongsTo'](db[_0x0a9e('0x60')],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e1')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e4'),'as':_0x0a9e('0x1e5')});db['ChatTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db[_0x0a9e('0x60')],{'foreignKey':_0x0a9e('0x1ea'),'as':'ToAccount'});db[_0x0a9e('0xea')]['belongsTo'](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db['FaxInteraction'],{});db['FaxTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1eb'),'as':_0x0a9e('0x1e1')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e4'),'as':_0x0a9e('0x1e5')});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x4c')],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db['FaxAccount'],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e8')});db['OpenchannelTransferReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x0a9e('0x5d')],{});db[_0x0a9e('0xec')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1e1')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e4'),'as':_0x0a9e('0x1e5')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db['SmsTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1ef'),'as':_0x0a9e('0x1e1')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e4'),'as':_0x0a9e('0x1e5')});db['SmsTransferReport']['belongsTo'](db['SmsQueue'],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e6')});db['SmsTransferReport'][_0x0a9e('0x150')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList'][_0x0a9e('0x110')](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')]['hasMany'](db[_0x0a9e('0x124')],{'as':'Contacts','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':'ReportAgentPreview','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x1f3'),'through':_0x0a9e('0x1f4')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'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':'Agents','through':_0x0a9e('0x109')});db['VoicePrefix'][_0x0a9e('0x121')](db['Team'],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':'userProfileId'});db[_0x0a9e('0xf2')]['hasMany'](db[_0x0a9e('0xf3')],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f6'),'onDelete':'cascade'});db['UserProfileSection']['hasMany'](db[_0x0a9e('0xf4')],{'as':_0x0a9e('0x1f7'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x1f9'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':'Messages','foreignKey':_0x0a9e('0x1f9')});db['WhatsappAccount'][_0x0a9e('0x110')](db['WhatsappInteraction'],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xf9')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f9'),'onDelete':'cascade'});db[_0x0a9e('0xf7')]['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db['Pause'],{'as':_0x0a9e('0x16f'),'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')]['belongsTo'](db[_0x0a9e('0xf7')],{'onDelete':'restrict'});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':'TagId'});db[_0x0a9e('0xfb')]['hasMany'](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1fa')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f9')});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('0x1b2'),'as':'Tags'});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b2'),'as':_0x0a9e('0x175')});db['WhatsappInteraction'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_whatsapp_interactions','foreignKey':_0x0a9e('0x1fa')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1fa')});db['WhatsappMessage'][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappAccount'],{});db[_0x0a9e('0xfe')][_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')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0xfd')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['User'],{});db[_0x0a9e('0x1fb')][_0x0a9e('0x150')](db['WhatsappMessage'],{});db[_0x0a9e('0x1fb')][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'foreignKey':'ToWhatsappAccountId','as':_0x0a9e('0x1e8')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0x101')],{'foreignKey':_0x0a9e('0x1fd'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1fb')]['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1e4'),'as':_0x0a9e('0x1e5')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserWhatsappQueue','foreignKey':_0x0a9e('0x1fe')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':'team_has_whatsapp_queues','as':_0x0a9e('0x155')});db[_0x0a9e('0x1ff')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x200'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')]['hasOne'](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0xbe'),'onDelete':'restrict'});db[_0x0a9e('0x103')]['hasOne'](db['MailServerIn'],{'as':_0x0a9e('0x165'),'onDelete':'restrict'});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':_0x0a9e('0x166'),'onDelete':'restrict'});module[_0x0a9e('0x201')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 0265af6..72529c3 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70ba=['/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./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/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','./api/squareReportDetail','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.2.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express','./config/environment','setupLoggers','./api/client-side-logs','then','use','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./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/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','/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/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x70ba,0x192));var _0xa70b=function(_0x30d751,_0x2b4db5){_0x30d751=_0x30d751-0x0;var _0x2127d7=_0x70ba[_0x30d751];return _0x2127d7;};'use strict';var path=require(_0xa70b('0x0'));var express=require(_0xa70b('0x1'));var errors=require('./errors');var config=require(_0xa70b('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0xa70b('0x3')];var clientSideLogs=require(_0xa70b('0x4'));exports['default']=function(_0x3f8181){return setupLoggers(_0x3f8181)[_0xa70b('0x5')](function(){_0x3f8181[_0xa70b('0x6')](_0xa70b('0x7'),require('./api/user'));_0x3f8181['use'](_0xa70b('0x8'),require('./api/voiceChanSpy'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x9'),require('./api/voiceContext'));_0x3f8181[_0xa70b('0x6')]('/api/voice/extensions',require(_0xa70b('0xa')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xb'),require(_0xa70b('0xc')));_0x3f8181[_0xa70b('0x6')]('/api/voice/queues',require(_0xa70b('0xd')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xe'),require('./api/voiceRecording'));_0x3f8181['use'](_0xa70b('0xf'),require('./api/screenRecording'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x10'),require(_0xa70b('0x11')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x12'),require(_0xa70b('0x13')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x14'),require(_0xa70b('0x15')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x16'),require(_0xa70b('0x17')));_0x3f8181[_0xa70b('0x6')]('/api/voice/agents/reports',require(_0xa70b('0x18')));_0x3f8181[_0xa70b('0x6')]('/api/voice/queues/reports',require(_0xa70b('0x19')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x1a'),require(_0xa70b('0x1b')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x1c'),require(_0xa70b('0x1d')));_0x3f8181[_0xa70b('0x6')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x3f8181['use'](_0xa70b('0x1e'),require(_0xa70b('0x1f')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x20'),require('./api/mailAccount'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x21'),require('./api/mailQueue'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x22'),require(_0xa70b('0x23')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x24'),require(_0xa70b('0x25')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x26'),require(_0xa70b('0x27')));_0x3f8181['use'](_0xa70b('0x28'),require(_0xa70b('0x29')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x2a'),require(_0xa70b('0x2b')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x2c'),require(_0xa70b('0x2d')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x2e'),require(_0xa70b('0x2f')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x30'),require(_0xa70b('0x31')));_0x3f8181['use'](_0xa70b('0x32'),require(_0xa70b('0x33')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x34'),require('./api/faxInteraction'));_0x3f8181['use'](_0xa70b('0x35'),require('./api/faxMessage'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x36'),require(_0xa70b('0x37')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x38'),require('./api/faxQueueReport'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x39'),require(_0xa70b('0x3a')));_0x3f8181['use'](_0xa70b('0x3b'),require('./api/smsApplication'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x3c'),require(_0xa70b('0x3d')));_0x3f8181['use'](_0xa70b('0x3e'),require(_0xa70b('0x3f')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x40'),require('./api/smsQueue'));_0x3f8181[_0xa70b('0x6')]('/api/openchannel/accounts',require(_0xa70b('0x41')));_0x3f8181['use'](_0xa70b('0x42'),require('./api/openchannelApplication'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x43'),require('./api/openchannelInteraction'));_0x3f8181[_0xa70b('0x6')]('/api/openchannel/messages',require(_0xa70b('0x44')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x45'),require(_0xa70b('0x46')));_0x3f8181['use'](_0xa70b('0x47'),require(_0xa70b('0x48')));_0x3f8181['use'](_0xa70b('0x49'),require(_0xa70b('0x4a')));_0x3f8181[_0xa70b('0x6')]('/api/chat/applications',require(_0xa70b('0x4b')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x4c'),require(_0xa70b('0x4d')));_0x3f8181['use'](_0xa70b('0x4e'),require(_0xa70b('0x4f')));_0x3f8181['use'](_0xa70b('0x50'),require(_0xa70b('0x51')));_0x3f8181['use'](_0xa70b('0x52'),require('./api/chatQueue'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x53'),require('./api/chatGroup'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x54'),require(_0xa70b('0x55')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x56'),require(_0xa70b('0x57')));_0x3f8181['use'](_0xa70b('0x58'),require(_0xa70b('0x59')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x5a'),require('./api/cmHopper'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x5b'),require(_0xa70b('0x5c')));_0x3f8181[_0xa70b('0x6')]('/api/cm/hopper_final',require(_0xa70b('0x5d')));_0x3f8181['use'](_0xa70b('0x5e'),require(_0xa70b('0x5f')));_0x3f8181['use'](_0xa70b('0x60'),require(_0xa70b('0x61')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x62'),require(_0xa70b('0x63')));_0x3f8181['use'](_0xa70b('0x64'),require('./api/automation'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x65'),require('./api/cannedAnswer'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x66'),require('./api/disposition'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x67'),require(_0xa70b('0x68')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x69'),require(_0xa70b('0x6a')));_0x3f8181[_0xa70b('0x6')]('/api/pauses',require(_0xa70b('0x6b')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x6c'),require(_0xa70b('0x6d')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x6e'),require(_0xa70b('0x6f')));_0x3f8181[_0xa70b('0x6')]('/api/schedules',require(_0xa70b('0x70')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x71'),require(_0xa70b('0x72')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x73'),require(_0xa70b('0x74')));_0x3f8181[_0xa70b('0x6')]('/api/contact_item_types',require('./api/contactItemType'));_0x3f8181['use'](_0xa70b('0x75'),require('./api/cmContactHasItem'));_0x3f8181[_0xa70b('0x6')]('/api/cm_hopper_additional_phones',require(_0xa70b('0x76')));_0x3f8181[_0xa70b('0x6')]('/api/templates',require(_0xa70b('0x77')));_0x3f8181['use'](_0xa70b('0x78'),require(_0xa70b('0x79')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x7a'),require(_0xa70b('0x7b')));_0x3f8181[_0xa70b('0x6')]('/api/integrations',require(_0xa70b('0x7c')));_0x3f8181['use'](_0xa70b('0x7d'),require(_0xa70b('0x7e')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x7f'),require(_0xa70b('0x80')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x81'),require(_0xa70b('0x82')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x83'),require(_0xa70b('0x84')));_0x3f8181['use']('/api/analytics/metrics',require('./api/analyticMetric'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x85'),require(_0xa70b('0x86')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x87'),require(_0xa70b('0x88')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x89'),require(_0xa70b('0x8a')));_0x3f8181[_0xa70b('0x6')]('/api/integrations/salesforce/configurations',require(_0xa70b('0x8b')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x8c'),require(_0xa70b('0x8d')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x8e'),require('./api/intSugarcrmAccount'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x8f'),require(_0xa70b('0x90')));_0x3f8181[_0xa70b('0x6')]('/api/integrations/sugarcrm/fields',require(_0xa70b('0x91')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x92'),require(_0xa70b('0x93')));_0x3f8181[_0xa70b('0x6')]('/api/integrations/desk/configurations',require(_0xa70b('0x94')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x95'),require('./api/intDeskField'));_0x3f8181['use'](_0xa70b('0x96'),require(_0xa70b('0x97')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x98'),require(_0xa70b('0x99')));_0x3f8181[_0xa70b('0x6')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x3f8181[_0xa70b('0x6')]('/api/integrations/zendesk/accounts',require(_0xa70b('0x9a')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x9b'),require('./api/intZendeskConfiguration'));_0x3f8181['use']('/api/integrations/zendesk/fields',require(_0xa70b('0x9c')));_0x3f8181[_0xa70b('0x6')]('/api/integrations/freshdesk/accounts',require(_0xa70b('0x9d')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x9e'),require(_0xa70b('0x9f')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xa0'),require(_0xa70b('0xa1')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xa2'),require(_0xa70b('0xa3')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xa4'),require(_0xa70b('0xa5')));_0x3f8181['use'](_0xa70b('0xa6'),require(_0xa70b('0xa7')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xa8'),require('./api/intServicenowAccount'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xa9'),require('./api/intServicenowConfiguration'));_0x3f8181[_0xa70b('0x6')]('/api/integrations/servicenow/fields',require(_0xa70b('0xaa')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xab'),require(_0xa70b('0xac')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xad'),require(_0xa70b('0xae')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xaf'),require('./api/intDynamics365Field'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xb0'),require(_0xa70b('0xb1')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xb2'),require(_0xa70b('0xb3')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xb4'),require(_0xa70b('0xb5')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xb6'),require(_0xa70b('0xb7')));_0x3f8181[_0xa70b('0x6')]('/api/chat/reports/queue',require(_0xa70b('0xb8')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xb9'),require(_0xa70b('0xba')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xbb'),require(_0xa70b('0xbc')));_0x3f8181['use'](_0xa70b('0xbd'),require(_0xa70b('0xbe')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xbf'),require(_0xa70b('0xc0')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xc1'),require('./api/smsQueueReport'));_0x3f8181['use'](_0xa70b('0xc2'),require(_0xa70b('0xc3')));_0x3f8181[_0xa70b('0x6')]('/api/square/details/reports',require(_0xa70b('0xc4')));_0x3f8181[_0xa70b('0x6')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x3f8181[_0xa70b('0x6')]('/api/settings',require(_0xa70b('0xc5')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xc6'),require(_0xa70b('0xc7')));_0x3f8181[_0xa70b('0x6')]('/api/square/projects',require(_0xa70b('0xc8')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xc9'),require(_0xa70b('0xca')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xcb'),require(_0xa70b('0xcc')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xcd'),require('./api/team'));_0x3f8181['use'](_0xa70b('0xce'),require(_0xa70b('0xcf')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xd0'),require(_0xa70b('0xd1')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xd2'),require('./api/migration'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xd3'),require(_0xa70b('0xd4')));_0x3f8181[_0xa70b('0x6')]('/api/plugins',require(_0xa70b('0xd5')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xd6'),require(_0xa70b('0xd7')));_0x3f8181['use'](_0xa70b('0xd8'),require(_0xa70b('0xd9')));_0x3f8181[_0xa70b('0x6')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x3f8181[_0xa70b('0x6')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xda'),require(_0xa70b('0xdb')));_0x3f8181[_0xa70b('0x6')]('/api/cm/lists',require(_0xa70b('0xdc')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xdd'),require(_0xa70b('0xde')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xdf'),require(_0xa70b('0xe0')));_0x3f8181['use']('/api/userProfile/sections',require(_0xa70b('0xe1')));_0x3f8181['use'](_0xa70b('0xe2'),require(_0xa70b('0xe3')));_0x3f8181['use'](_0xa70b('0xe4'),require(_0xa70b('0xe5')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xe6'),require(_0xa70b('0xe7')));_0x3f8181[_0xa70b('0x6')]('/api/whatsapp/applications',require(_0xa70b('0xe8')));_0x3f8181['use'](_0xa70b('0xe9'),require(_0xa70b('0xea')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xeb'),require(_0xa70b('0xec')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xed'),require('./api/whatsappQueueReport'));_0x3f8181['use'](_0xa70b('0xee'),require('./api/whatsappTransferReport'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xef'),require(_0xa70b('0xf0')));_0x3f8181[_0xa70b('0x6')]('/api/cloudProviders',require(_0xa70b('0xf1')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xf2'),require(_0xa70b('0xf3')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xf4'),require(_0xa70b('0xf5')));_0x3f8181[_0xa70b('0x6')]('/api/auth/local',require(_0xa70b('0xf6')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xf7'),require(_0xa70b('0xf8')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xf9'),require('./api/authActiveDirectory'));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xfa'),require(_0xa70b('0xfb')));_0x3f8181[_0xa70b('0x6')]('/api/rpc',require(_0xa70b('0xfc')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xfd'),require(_0xa70b('0xfe')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0xff'),require(_0xa70b('0x100')));_0x3f8181[_0xa70b('0x6')]('/api/pm2',require(_0xa70b('0x101')));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x102'),require(_0xa70b('0x103')));_0x3f8181['use']('/api/logs',clientSideLogs);_0x3f8181[_0xa70b('0x6')](_0xa70b('0x104'),express[_0xa70b('0x105')](path[_0xa70b('0x106')](config[_0xa70b('0x107')],_0xa70b('0x104'))));_0x3f8181[_0xa70b('0x6')]('/www',express[_0xa70b('0x105')](path['join'](config[_0xa70b('0x107')],_0xa70b('0x108'))));_0x3f8181['use'](_0xa70b('0x109'),express[_0xa70b('0x105')](path[_0xa70b('0x106')](config[_0xa70b('0x107')],_0xa70b('0x109'))));_0x3f8181[_0xa70b('0x6')](_0xa70b('0x10a'),express['static'](path[_0xa70b('0x106')](config[_0xa70b('0x107')],_0xa70b('0x10b'),_0xa70b('0x10c'))));_0x3f8181['use'](_0xa70b('0x10d'),express['static'](path[_0xa70b('0x106')](config['root'],'/server/files/plugins')));_0x3f8181[_0xa70b('0x10e')](_0xa70b('0x10f'))[_0xa70b('0x110')](errors[0x194]);_0x3f8181[_0xa70b('0x10e')]('/*')[_0xa70b('0x110')](function(_0x14700c,_0x556960){_0x556960[_0xa70b('0x111')](path['resolve'](_0x3f8181[_0xa70b('0x110')](_0xa70b('0x112'))+_0xa70b('0x113')));});return _0x3f8181;});}; \ No newline at end of file +var _0x9a3d=['/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/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/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','root','static','join','/www','/demo','snippet','3.2.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField'];(function(_0x3a6922,_0xc728be){var _0x9c1b44=function(_0x4ffb5e){while(--_0x4ffb5e){_0x3a6922['push'](_0x3a6922['shift']());}};_0x9c1b44(++_0xc728be);}(_0x9a3d,0x198));var _0xd9a3=function(_0x44182f,_0x192c1c){_0x44182f=_0x44182f-0x0;var _0x4194ec=_0x9a3d[_0x44182f];return _0x4194ec;};'use strict';var path=require(_0xd9a3('0x0'));var express=require('express');var errors=require(_0xd9a3('0x1'));var config=require(_0xd9a3('0x2'));var setupLoggers=require(_0xd9a3('0x3'))[_0xd9a3('0x4')];var clientSideLogs=require(_0xd9a3('0x5'));exports[_0xd9a3('0x6')]=function(_0x282b62){return setupLoggers(_0x282b62)['then'](function(){_0x282b62[_0xd9a3('0x7')]('/api/users',require('./api/user'));_0x282b62['use'](_0xd9a3('0x8'),require(_0xd9a3('0x9')));_0x282b62['use'](_0xd9a3('0xa'),require(_0xd9a3('0xb')));_0x282b62['use'](_0xd9a3('0xc'),require(_0xd9a3('0xd')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xe'),require('./api/voiceMusicOnHold'));_0x282b62['use']('/api/voice/queues',require(_0xd9a3('0xf')));_0x282b62[_0xd9a3('0x7')]('/api/voice/recordings',require(_0xd9a3('0x10')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x11'),require(_0xd9a3('0x12')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x13'),require(_0xd9a3('0x14')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x15'),require(_0xd9a3('0x16')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x17'),require(_0xd9a3('0x18')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x19'),require(_0xd9a3('0x1a')));_0x282b62[_0xd9a3('0x7')]('/api/voice/agents/reports',require(_0xd9a3('0x1b')));_0x282b62['use'](_0xd9a3('0x1c'),require('./api/voiceQueueReport'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x1d'),require('./api/memberReport'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x1e'),require('./api/trunk'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x1f'),require(_0xd9a3('0x20')));_0x282b62[_0xd9a3('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x282b62['use'](_0xd9a3('0x21'),require(_0xd9a3('0x22')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x23'),require(_0xd9a3('0x24')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x25'),require(_0xd9a3('0x26')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x27'),require(_0xd9a3('0x28')));_0x282b62['use'](_0xd9a3('0x29'),require('./api/mailMessage'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x2a'),require(_0xd9a3('0x2b')));_0x282b62[_0xd9a3('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x2c'),require(_0xd9a3('0x2d')));_0x282b62['use'](_0xd9a3('0x2e'),require(_0xd9a3('0x2f')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x30'),require(_0xd9a3('0x31')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x32'),require(_0xd9a3('0x33')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x34'),require(_0xd9a3('0x35')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x36'),require('./api/faxMessage'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x37'),require('./api/faxQueue'));_0x282b62['use'](_0xd9a3('0x38'),require(_0xd9a3('0x39')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x3a'),require(_0xd9a3('0x3b')));_0x282b62['use'](_0xd9a3('0x3c'),require('./api/smsApplication'));_0x282b62['use'](_0xd9a3('0x3d'),require(_0xd9a3('0x3e')));_0x282b62['use'](_0xd9a3('0x3f'),require('./api/smsMessage'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x40'),require(_0xd9a3('0x41')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x42'),require(_0xd9a3('0x43')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x44'),require('./api/openchannelApplication'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x45'),require(_0xd9a3('0x46')));_0x282b62['use'](_0xd9a3('0x47'),require(_0xd9a3('0x48')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x49'),require(_0xd9a3('0x4a')));_0x282b62['use'](_0xd9a3('0x4b'),require(_0xd9a3('0x4c')));_0x282b62['use']('/api/openchannel/reports/queue',require(_0xd9a3('0x4d')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x4e'),require(_0xd9a3('0x4f')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x50'),require(_0xd9a3('0x51')));_0x282b62['use'](_0xd9a3('0x52'),require(_0xd9a3('0x53')));_0x282b62[_0xd9a3('0x7')]('/api/chat/offline_messages',require(_0xd9a3('0x54')));_0x282b62[_0xd9a3('0x7')]('/api/chat/queues',require(_0xd9a3('0x55')));_0x282b62[_0xd9a3('0x7')]('/api/chat/groups',require(_0xd9a3('0x56')));_0x282b62[_0xd9a3('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x57'),require(_0xd9a3('0x58')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x59'),require(_0xd9a3('0x5a')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x5b'),require(_0xd9a3('0x5c')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x5d'),require(_0xd9a3('0x5e')));_0x282b62['use'](_0xd9a3('0x5f'),require('./api/cmHopperFinal'));_0x282b62[_0xd9a3('0x7')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x282b62['use'](_0xd9a3('0x60'),require(_0xd9a3('0x61')));_0x282b62['use'](_0xd9a3('0x62'),require('./api/action'));_0x282b62[_0xd9a3('0x7')]('/api/automations',require(_0xd9a3('0x63')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x64'),require(_0xd9a3('0x65')));_0x282b62[_0xd9a3('0x7')]('/api/dispositions',require('./api/disposition'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x66'),require(_0xd9a3('0x67')));_0x282b62['use'](_0xd9a3('0x68'),require(_0xd9a3('0x69')));_0x282b62[_0xd9a3('0x7')]('/api/pauses',require(_0xd9a3('0x6a')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x6b'),require('./api/cdr'));_0x282b62['use'](_0xd9a3('0x6c'),require('./api/voiceQueuesLog'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x6d'),require(_0xd9a3('0x6e')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x6f'),require(_0xd9a3('0x70')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x71'),require(_0xd9a3('0x72')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x73'),require(_0xd9a3('0x74')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x75'),require('./api/cmContactHasItem'));_0x282b62['use']('/api/cm_hopper_additional_phones',require(_0xd9a3('0x76')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x77'),require(_0xd9a3('0x78')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x79'),require(_0xd9a3('0x7a')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x7b'),require(_0xd9a3('0x7c')));_0x282b62[_0xd9a3('0x7')]('/api/integrations',require(_0xd9a3('0x7d')));_0x282b62['use'](_0xd9a3('0x7e'),require('./api/integrationReport'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x7f'),require('./api/analyticCustomReport'));_0x282b62['use'](_0xd9a3('0x80'),require(_0xd9a3('0x81')));_0x282b62['use'](_0xd9a3('0x82'),require(_0xd9a3('0x83')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x84'),require('./api/analyticMetric'));_0x282b62[_0xd9a3('0x7')]('/api/analytics/field_reports',require(_0xd9a3('0x85')));_0x282b62[_0xd9a3('0x7')]('/api/analytics/tree_reports',require(_0xd9a3('0x86')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x87'),require(_0xd9a3('0x88')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x89'),require(_0xd9a3('0x8a')));_0x282b62['use']('/api/integrations/salesforce/fields',require(_0xd9a3('0x8b')));_0x282b62[_0xd9a3('0x7')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x8c'),require(_0xd9a3('0x8d')));_0x282b62['use']('/api/integrations/sugarcrm/fields',require(_0xd9a3('0x8e')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x8f'),require('./api/intDeskAccount'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x90'),require(_0xd9a3('0x91')));_0x282b62['use'](_0xd9a3('0x92'),require(_0xd9a3('0x93')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x94'),require(_0xd9a3('0x95')));_0x282b62[_0xd9a3('0x7')]('/api/integrations/zoho/configurations',require(_0xd9a3('0x96')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x97'),require(_0xd9a3('0x98')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x99'),require(_0xd9a3('0x9a')));_0x282b62['use'](_0xd9a3('0x9b'),require(_0xd9a3('0x9c')));_0x282b62['use'](_0xd9a3('0x9d'),require(_0xd9a3('0x9e')));_0x282b62[_0xd9a3('0x7')]('/api/integrations/freshdesk/accounts',require(_0xd9a3('0x9f')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xa0'),require(_0xd9a3('0xa1')));_0x282b62['use']('/api/integrations/freshdesk/fields',require(_0xd9a3('0xa2')));_0x282b62['use'](_0xd9a3('0xa3'),require(_0xd9a3('0xa4')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xa5'),require(_0xd9a3('0xa6')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xa7'),require(_0xd9a3('0xa8')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xa9'),require(_0xd9a3('0xaa')));_0x282b62[_0xd9a3('0x7')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xab'),require('./api/intServicenowField'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xac'),require('./api/intDynamics365Account'));_0x282b62['use'](_0xd9a3('0xad'),require(_0xd9a3('0xae')));_0x282b62['use']('/api/integrations/dynamics365/fields',require(_0xd9a3('0xaf')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xb0'),require(_0xd9a3('0xb1')));_0x282b62[_0xd9a3('0x7')]('/api/integrations/freshsales/configurations',require(_0xd9a3('0xb2')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xb3'),require(_0xd9a3('0xb4')));_0x282b62[_0xd9a3('0x7')]('/api/networks',require(_0xd9a3('0xb5')));_0x282b62['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xb6'),require(_0xd9a3('0xb7')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xb8'),require(_0xd9a3('0xb9')));_0x282b62['use'](_0xd9a3('0xba'),require(_0xd9a3('0xbb')));_0x282b62['use'](_0xd9a3('0xbc'),require(_0xd9a3('0xbd')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xbe'),require('./api/smsQueueReport'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xbf'),require(_0xd9a3('0xc0')));_0x282b62['use'](_0xd9a3('0xc1'),require(_0xd9a3('0xc2')));_0x282b62['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xc3'),require(_0xd9a3('0xc4')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xc5'),require(_0xd9a3('0xc6')));_0x282b62[_0xd9a3('0x7')]('/api/square/projects',require(_0xd9a3('0xc7')));_0x282b62['use'](_0xd9a3('0xc8'),require(_0xd9a3('0xc9')));_0x282b62['use'](_0xd9a3('0xca'),require(_0xd9a3('0xcb')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xcc'),require(_0xd9a3('0xcd')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xce'),require('./api/license'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xcf'),require(_0xd9a3('0xd0')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xd1'),require(_0xd9a3('0xd2')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xd3'),require('./api/attachment'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xd4'),require(_0xd9a3('0xd5')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xd6'),require(_0xd9a3('0xd7')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xd8'),require(_0xd9a3('0xd9')));_0x282b62['use'](_0xd9a3('0xda'),require(_0xd9a3('0xdb')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xdc'),require(_0xd9a3('0xdd')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xde'),require('./api/smsTransferReport'));_0x282b62['use']('/api/cm/lists',require('./api/cmList'));_0x282b62[_0xd9a3('0x7')]('/api/voice/prefixes',require(_0xd9a3('0xdf')));_0x282b62[_0xd9a3('0x7')]('/api/userProfiles',require('./api/userProfile'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xe0'),require(_0xd9a3('0xe1')));_0x282b62['use'](_0xd9a3('0xe2'),require(_0xd9a3('0xe3')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xe4'),require('./api/userNotification'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xe5'),require(_0xd9a3('0xe6')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xe7'),require('./api/whatsappApplication'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xe8'),require(_0xd9a3('0xe9')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xea'),require(_0xd9a3('0xeb')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xec'),require('./api/whatsappQueueReport'));_0x282b62['use'](_0xd9a3('0xed'),require('./api/whatsappTransferReport'));_0x282b62[_0xd9a3('0x7')]('/api/whatsapp/queues',require(_0xd9a3('0xee')));_0x282b62[_0xd9a3('0x7')]('/api/cloudProviders',require(_0xd9a3('0xef')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xf0'),require(_0xd9a3('0xf1')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xf2'),require(_0xd9a3('0xf3')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xf4'),require('./api/authLocal'));_0x282b62['use'](_0xd9a3('0xf5'),require(_0xd9a3('0xf6')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xf7'),require(_0xd9a3('0xf8')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xf9'),require(_0xd9a3('0xfa')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xfb'),require('./api/rpc'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xfc'),require('./api/version'));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0xfd'),require(_0xd9a3('0xfe')));_0x282b62[_0xd9a3('0x7')]('/api/pm2',require(_0xd9a3('0xff')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x100'),require(_0xd9a3('0x101')));_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x102'),clientSideLogs);_0x282b62[_0xd9a3('0x7')](_0xd9a3('0x103'),express['static'](path['join'](config[_0xd9a3('0x104')],_0xd9a3('0x103'))));_0x282b62[_0xd9a3('0x7')]('/www',express[_0xd9a3('0x105')](path[_0xd9a3('0x106')](config[_0xd9a3('0x104')],_0xd9a3('0x107'))));_0x282b62[_0xd9a3('0x7')]('/demo',express[_0xd9a3('0x105')](path[_0xd9a3('0x106')](config['root'],_0xd9a3('0x108'))));_0x282b62[_0xd9a3('0x7')]('/snippet',express[_0xd9a3('0x105')](path[_0xd9a3('0x106')](config[_0xd9a3('0x104')],_0xd9a3('0x109'),_0xd9a3('0x10a'))));_0x282b62['use']('/plugins',express[_0xd9a3('0x105')](path['join'](config[_0xd9a3('0x104')],_0xd9a3('0x10b'))));_0x282b62[_0xd9a3('0x10c')](_0xd9a3('0x10d'))['get'](errors[0x194]);_0x282b62[_0xd9a3('0x10c')]('/*')[_0xd9a3('0x10e')](function(_0x18e769,_0x40e57e){_0x40e57e[_0xd9a3('0x10f')](path[_0xd9a3('0x110')](_0x282b62[_0xd9a3('0x10e')](_0xd9a3('0x111'))+'/index.html'));});return _0x282b62;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 1b430aa..83b7a34 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3551=['http','rpc','port','error','default','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intVtigerAccount/intVtigerAccount.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/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3551,0x1b7));var _0x1355=function(_0x52a167,_0xd2e437){_0x52a167=_0x52a167-0x0;var _0x2ab33a=_0x3551[_0x52a167];return _0x2ab33a;};'use strict';var jayson=require('jayson/promise');var _=require(_0x1355('0x0'));var config=require(_0x1355('0x1'));exports['listen']=function(){return new Promise(function(_0xe8baf2,_0x34e45e){var _0x5222f8={};_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/user/user.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x3')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/voiceQueue/voiceQueue.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x4')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x5')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x6')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x7')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x8')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/memberReport/memberReport.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x9')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0xa')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0xb')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0xc')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0xd')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0xe')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0xf')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x10')));_0x5222f8=_['merge'](_0x5222f8,require('../api/mailApplication/mailApplication.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x11')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x12')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/faxApplication/faxApplication.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x13')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/faxMessage/faxMessage.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x14')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x15')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x16')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x17')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x18')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/smsQueue/smsQueue.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x19')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x1a')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x1b')));_0x5222f8=_['merge'](_0x5222f8,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x1c')));_0x5222f8=_['merge'](_0x5222f8,require('../api/chatInteraction/chatInteraction.rpc'));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x1d')));_0x5222f8=_['merge'](_0x5222f8,require('../api/chatQueue/chatQueue.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/cmContact/cmContact.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/cmHopper/cmHopper.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x1e')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x1f')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x20')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x21')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x22')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x23')));_0x5222f8=_['merge'](_0x5222f8,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x24')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x25')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x26')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x27')));_0x5222f8=_['merge'](_0x5222f8,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x28')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x29')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5222f8=_['merge'](_0x5222f8,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x2a')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x2b')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x2c')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/setting/setting.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x2d')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x2e')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x2f')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require('../api/squareMessage/squareMessage.rpc'));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x30')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x31')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x32')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x33')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x34')));_0x5222f8=_[_0x1355('0x2')](_0x5222f8,require(_0x1355('0x35')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x36')));_0x5222f8=_['merge'](_0x5222f8,require(_0x1355('0x37')));var _0x293ca5=jayson[_0x1355('0x38')](_0x5222f8)[_0x1355('0x39')]();var _0x5df976=config[_0x1355('0x3a')][_0x1355('0x3b')]||config[_0x1355('0x3b')]+0x1;var _0x599798=config[_0x1355('0x3a')]['ip']||'localhost';_0x293ca5['on'](_0x1355('0x3c'),function(_0x34f887){return _0x34e45e(_0x34f887);});_0x293ca5['listen'](_0x5df976,_0x599798,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x599798,_0x5df976);require('../config/triggers')[_0x1355('0x3d')]();return _0xe8baf2('RPC\x20listening\x20on\x20'+_0x599798+':'+_0x5df976);});});}; \ No newline at end of file +var _0xbe0b=['../config/environment','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/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/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','listen','log','../config/triggers','default','jayson/promise','lodash'];(function(_0x5ad751,_0x3f0662){var _0x101017=function(_0x43c528){while(--_0x43c528){_0x5ad751['push'](_0x5ad751['shift']());}};_0x101017(++_0x3f0662);}(_0xbe0b,0x11e));var _0xbbe0=function(_0x25aac6,_0x5eeeaa){_0x25aac6=_0x25aac6-0x0;var _0x1d033f=_0xbe0b[_0x25aac6];return _0x1d033f;};'use strict';var jayson=require(_0xbbe0('0x0'));var _=require(_0xbbe0('0x1'));var config=require(_0xbbe0('0x2'));exports['listen']=function(){return new Promise(function(_0x1d5c9b,_0x4c6f92){var _0x39360c={};_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x3')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/voiceExtension/voiceExtension.rpc'));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x5')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/voiceRecording/voiceRecording.rpc'));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x6')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x7')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x8')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x9')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0xa')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0xb')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0xc')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0xd')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0xe')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/mailQueue/mailQueue.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0xf')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x10')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x11')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x12')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x13')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/faxApplication/faxApplication.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x14')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x15')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x16')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x17')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x18')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x19')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/smsMessage/smsMessage.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x1a')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x1b')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x1c')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x1d')));_0x39360c=_['merge'](_0x39360c,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x1e')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x1f')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x20')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/chatQueue/chatQueue.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/cmContact/cmContact.rpc'));_0x39360c=_['merge'](_0x39360c,require('../api/cmHopper/cmHopper.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x21')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x22')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x23')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x24')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x25')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x26')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x27')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x39360c=_['merge'](_0x39360c,require('../api/template/template.rpc'));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x28')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x29')));_0x39360c=_['merge'](_0x39360c,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x2a')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x2b')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x2c')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x2d')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x2e')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x2f')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x30')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x31')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x32')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x33')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x34')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x35')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x36')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x37')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x38')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x39')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x3a')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/attachment/attachment.rpc'));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x3b')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x3c')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x3d')));_0x39360c=_[_0xbbe0('0x4')](_0x39360c,require(_0xbbe0('0x3e')));_0x39360c=_['merge'](_0x39360c,require(_0xbbe0('0x3f')));var _0xc7a3a1=jayson['server'](_0x39360c)[_0xbbe0('0x40')]();var _0x2c00b0=config[_0xbbe0('0x41')][_0xbbe0('0x42')]||config[_0xbbe0('0x42')]+0x1;var _0x342bce=config[_0xbbe0('0x41')]['ip']||_0xbbe0('0x43');_0xc7a3a1['on']('error',function(_0x2a3b13){return _0x4c6f92(_0x2a3b13);});_0xc7a3a1[_0xbbe0('0x44')](_0x2c00b0,_0x342bce,function(){console[_0xbbe0('0x45')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x342bce,_0x2c00b0);require(_0xbbe0('0x46'))[_0xbbe0('0x47')]();return _0x1d5c9b('RPC\x20listening\x20on\x20'+_0x342bce+':'+_0x2c00b0);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index bb17550..64a849f 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 _0xdf89=['answer','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','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','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','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','substring','search','function','no\x20code','result=','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','sendRequest','sync','prototype'];(function(_0xcb5fe7,_0x512cd5){var _0x51ae15=function(_0x33e246){while(--_0x33e246){_0xcb5fe7['push'](_0xcb5fe7['shift']());}};_0x51ae15(++_0x512cd5);}(_0xdf89,0x16f));var _0x9df8=function(_0x2001de,_0x5bd376){_0x2001de=_0x2001de-0x0;var _0x10a84b=_0xdf89[_0x2001de];return _0x10a84b;};'use strict';var util=require(_0x9df8('0x0'));var _=require(_0x9df8('0x1'));var EventEmitter=require(_0x9df8('0x2'))[_0x9df8('0x3')];var AGIReply=require(_0x9df8('0x4'));var AGIError=require(_0x9df8('0x5'));function AGIChannel(_0x18463a){var _0x416467=this,_0x31b021=new AGIReply(),_0x57a211=![],_0x414df0={};EventEmitter[_0x9df8('0x6')](_0x416467);_0x18463a[_0x9df8('0x7')](_0x9df8('0x8'));_0x18463a[_0x9df8('0x9')](0x8*0x3c*0x3c*0x3e8);_0x31b021['setEncoding'](_0x9df8('0x8'));_0x31b021['on'](_0x9df8('0xa'),function(_0x5a53f9){for(var _0x2c98b3 in _0x5a53f9){_0x416467[_0x2c98b3]=_0x5a53f9[_0x2c98b3];}_0x416467[_0x9df8('0xb')](_0x9df8('0xc'));});_0x31b021['on'](_0x9df8('0xd'),function(_0x5dc398){if(_0x5dc398['toLowerCase']()==_0x9df8('0xe')){_0x416467[_0x9df8('0xb')](_0x9df8('0xe'));return;}if(_0x5dc398[_0x9df8('0xf')](0x0,0xb)=='520-Invalid'){_0x57a211=!![];}if(_0x57a211){_0x414df0['rx']+=_0x5dc398+'\x0a';if(_0x5dc398[_0x9df8('0x10')]('520\x20End\x20of\x20proper')!=-0x1){_0x57a211=![];}}else{_0x414df0['rx']=_0x5dc398;}if(_0x57a211){return;}if(typeof _0x414df0['cb']==_0x9df8('0x11')){var _0x2ec049=_0x414df0['rx']['substring'](0x0,0x3),_0x3220f2=null,_0x3f0b59=null;_0x2ec049=parseInt(_0x2ec049);if(isNaN(_0x2ec049)){_0x414df0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9df8('0x12')});return;}if(_0x2ec049!=0xc8){_0x414df0['cb'](null,{'code':_0x2ec049,'result':-0x1,'extra':'KO'});return;}_0x3220f2=_0x414df0['rx']['substring'](0x4)['replace'](_0x9df8('0x13'),'');if(_0x3220f2[_0x9df8('0x14')]('\x20')!=-0x1){_0x3220f2=_0x3220f2['substr'](0x0,_0x3220f2['indexOf']('\x20'));}if(_[_0x9df8('0x15')](_0x3220f2,'-1')){_0x3220f2=parseInt(_0x3220f2);}_0x3f0b59=_0x414df0['rx']['split']('\x20');if(_0x3f0b59[_0x9df8('0x16')]==0x3){_0x3f0b59=_0x3f0b59[0x2]['substring'](0x1,_0x3f0b59[0x2][_0x9df8('0x16')]-0x1);}else if(_0x3f0b59[_0x9df8('0x16')]>0x3){var _0x3586e2=/\((.+)\)/;var _0x372ffa=_0x414df0['rx'][_0x9df8('0x17')](_0x3586e2);if(_0x372ffa){_0x3f0b59=_0x372ffa[0x1];}else{_0x3f0b59=null;}}else{_0x3f0b59=null;}_0x414df0['cb'](null,{'code':_0x2ec049,'result':_0x3220f2,'extra':_0x3f0b59});}});_0x18463a['on'](_0x9df8('0x18'),function(_0x200a6d){_0x416467['emit'](_0x9df8('0x18'),new AGIError(_0x9df8('0x19'),_0x200a6d[_0x9df8('0x1a')]));});_0x18463a['on'](_0x9df8('0x1b'),function(){_0x416467['emit'](_0x9df8('0x1b'),new AGIError(_0x9df8('0x1c')));});_0x18463a['on']('timeout',function(){_0x416467[_0x9df8('0xb')](_0x9df8('0x1d'),new AGIError(_0x9df8('0x1e')));_0x18463a[_0x9df8('0x1f')]();});_0x18463a[_0x9df8('0x20')](_0x31b021);this[_0x9df8('0x21')]=function(_0x225ee3,_0x41051d){var _0x225ee3=_0x225ee3||'',_0x41051d=typeof _0x41051d==_0x9df8('0x11')?_0x41051d:new Function();_0x414df0={'tx':_0x225ee3,'rx':'','cb':_0x41051d};_0x18463a['write'](_0x225ee3+'\x0a');},this[_0x9df8('0x1b')]=function(){_0x18463a['destroy']();};}util[_0x9df8('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x9df8('0x23')]=function(_0x1e6304){return this['command'][_0x9df8('0x24')](this,_0x1e6304);};AGIChannel[_0x9df8('0x25')][_0x9df8('0x26')]=function(){return this[_0x9df8('0x23')](_0x9df8('0x27'));};AGIChannel['prototype'][_0x9df8('0x28')]=function(_0x31ef45,_0x59c863,_0x89c200){_0x31ef45=_0x31ef45===undefined?_0x9df8('0x29'):_0x31ef45;_0x59c863=_0x59c863===undefined?'5':_0x59c863;_0x89c200=_0x89c200===undefined?'1':_0x89c200;return this[_0x9df8('0x23')](util[_0x9df8('0x2a')](_0x9df8('0x2b'),_0x31ef45,_0x59c863*0x3e8,_0x89c200));};AGIChannel[_0x9df8('0x25')][_0x9df8('0x2c')]=function(_0x29cca6){_0x29cca6=_0x29cca6||_0x9df8('0x2d');return this['sendRequest'](util['format']('VERBOSE\x20\x22%s\x22',_0x29cca6));};AGIChannel[_0x9df8('0x25')][_0x9df8('0x2e')]=function(_0x30794a,_0x1f51be){if(_[_0x9df8('0x2f')](_0x1f51be)){return this['sendRequest'](util[_0x9df8('0x2a')](_0x9df8('0x30'),_0x30794a,_0x1f51be[_0x9df8('0x31')](',')));}return this[_0x9df8('0x23')](util['format'](_0x9df8('0x30'),_0x30794a,_0x1f51be));};AGIChannel['prototype']['setContext']=function(_0x1351e9){return this[_0x9df8('0x23')](util[_0x9df8('0x2a')](_0x9df8('0x32'),_0x1351e9));};AGIChannel['prototype'][_0x9df8('0x33')]=function(_0x444255){return this['sendRequest'](util['format']('SET\x20EXTENSION\x20%s',_0x444255));};AGIChannel['prototype'][_0x9df8('0x34')]=function(_0xf855f2){return this['sendRequest'](util[_0x9df8('0x2a')](_0x9df8('0x35'),_0xf855f2));};AGIChannel['prototype'][_0x9df8('0xe')]=function(){return this[_0x9df8('0x23')]('HANGUP');};AGIChannel[_0x9df8('0x25')][_0x9df8('0x36')]=function(_0x47b774,_0x4cb328){var _0x1720ef=_[_0x9df8('0x37')](_0x4cb328)||_[_0x9df8('0x38')](_0x4cb328)?_0x4cb328['toString']():_0x4cb328;return this[_0x9df8('0x23')](util[_0x9df8('0x2a')](_0x9df8('0x39'),_0x47b774,_0x1720ef?_0x1720ef[_0x9df8('0x3a')]()[_0x9df8('0x3b')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9df8('0x25')][_0x9df8('0x3c')]=function(_0x25a870,_0x197cf2){return this[_0x9df8('0x23')](util[_0x9df8('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x25a870,_0x197cf2));};AGIChannel[_0x9df8('0x25')]['sayDigits']=function(_0x2afd72,_0x3181da){return this[_0x9df8('0x23')](util[_0x9df8('0x2a')](_0x9df8('0x3d'),_0x2afd72,_0x3181da));};AGIChannel['prototype'][_0x9df8('0x3e')]=function(_0x41e70b,_0x646d6){return this['sendRequest'](util[_0x9df8('0x2a')](_0x9df8('0x3f'),_0x41e70b,_0x646d6));};AGIChannel['prototype'][_0x9df8('0x40')]=function(_0x22b4b8,_0xda88ef,_0x308e7f){_0xda88ef=_0xda88ef||this[_0x9df8('0x41')];_0x308e7f=_0x308e7f||0x1;this[_0x9df8('0x42')](_0x22b4b8);this[_0x9df8('0x33')](_0xda88ef);this[_0x9df8('0x34')](_0x308e7f);return this['noop'](util[_0x9df8('0x2a')](_0x9df8('0x43'),_0x22b4b8,_0xda88ef,_0x308e7f));};AGIChannel[_0x9df8('0x25')][_0x9df8('0x44')]=function(_0x131fad){return this[_0x9df8('0x23')](util[_0x9df8('0x2a')](_0x9df8('0x45'),_0x131fad));};AGIChannel['prototype']['recordFile']=function(_0x1253dd,_0x2d9bf6,_0x29f233,_0x59ead3,_0x53c7f0,_0x2e0501){_0x2d9bf6=_0x2d9bf6||_0x9df8('0x46');_0x29f233=_0x29f233||'';_0x59ead3=_0x59ead3===undefined?-0x1:_0x59ead3==='-1'?-0x1:_0x59ead3*0x3e8;_0x53c7f0=_0x53c7f0===undefined?'':'s='+_0x53c7f0;_0x2e0501=_0x2e0501?_0x9df8('0x47'):'';return this[_0x9df8('0x23')](util[_0x9df8('0x2a')](_0x9df8('0x48'),_0x1253dd,_0x2d9bf6,_0x29f233,_0x59ead3,_0x2e0501,_0x53c7f0));};AGIChannel[_0x9df8('0x25')][_0x9df8('0x49')]=function(_0x46bb2b,_0x18e01c){_0x18e01c=_0x18e01c||'';return this[_0x9df8('0x23')](util[_0x9df8('0x2a')](_0x9df8('0x4a'),_0x46bb2b,_0x18e01c));};AGIChannel[_0x9df8('0x25')][_0x9df8('0x4b')]=function(_0x4624b9){return this[_0x9df8('0x2e')](_0x9df8('0x4c'),_0x4624b9);};AGIChannel[_0x9df8('0x25')][_0x9df8('0x4d')]=function(_0x344884){return this[_0x9df8('0x2e')](_0x9df8('0x4e'),_0x344884);};AGIChannel[_0x9df8('0x25')][_0x9df8('0x18')]=function(_0x3e21a4,_0xfa1d2){this[_0x9df8('0x2c')](util[_0x9df8('0x2a')](_0x9df8('0x4f'),_0x3e21a4['id'],_0x3e21a4[_0x9df8('0x50')],_0xfa1d2));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xf445=['wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','ready','hangup','emit','520-Invalid','function','substring','no\x20code','result=','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','prototype','sendRequest','sync','answer','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi'];(function(_0x11b945,_0x3cbfaa){var _0x53f454=function(_0x3dc41e){while(--_0x3dc41e){_0x11b945['push'](_0x11b945['shift']());}};_0x53f454(++_0x3cbfaa);}(_0xf445,0xe8));var _0x5f44=function(_0x534fb9,_0x466466){_0x534fb9=_0x534fb9-0x0;var _0x57d679=_0xf445[_0x534fb9];return _0x57d679;};'use strict';var util=require(_0x5f44('0x0'));var _=require(_0x5f44('0x1'));var EventEmitter=require(_0x5f44('0x2'))[_0x5f44('0x3')];var AGIReply=require(_0x5f44('0x4'));var AGIError=require(_0x5f44('0x5'));function AGIChannel(_0x567ac2){var _0x5f0297=this,_0x53599a=new AGIReply(),_0x506fb1=![],_0x3f3155={};EventEmitter[_0x5f44('0x6')](_0x5f0297);_0x567ac2[_0x5f44('0x7')](_0x5f44('0x8'));_0x567ac2['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x53599a[_0x5f44('0x7')](_0x5f44('0x8'));_0x53599a['on'](_0x5f44('0x9'),function(_0x4a2fd9){for(var _0x7f7fb0 in _0x4a2fd9){_0x5f0297[_0x7f7fb0]=_0x4a2fd9[_0x7f7fb0];}_0x5f0297['emit'](_0x5f44('0xa'));});_0x53599a['on']('line',function(_0x2a3cdd){if(_0x2a3cdd['toLowerCase']()==_0x5f44('0xb')){_0x5f0297[_0x5f44('0xc')]('hangup');return;}if(_0x2a3cdd['substring'](0x0,0xb)==_0x5f44('0xd')){_0x506fb1=!![];}if(_0x506fb1){_0x3f3155['rx']+=_0x2a3cdd+'\x0a';if(_0x2a3cdd['search']('520\x20End\x20of\x20proper')!=-0x1){_0x506fb1=![];}}else{_0x3f3155['rx']=_0x2a3cdd;}if(_0x506fb1){return;}if(typeof _0x3f3155['cb']==_0x5f44('0xe')){var _0x1b85fa=_0x3f3155['rx'][_0x5f44('0xf')](0x0,0x3),_0x455a1d=null,_0xe9b33b=null;_0x1b85fa=parseInt(_0x1b85fa);if(isNaN(_0x1b85fa)){_0x3f3155['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x5f44('0x10')});return;}if(_0x1b85fa!=0xc8){_0x3f3155['cb'](null,{'code':_0x1b85fa,'result':-0x1,'extra':'KO'});return;}_0x455a1d=_0x3f3155['rx']['substring'](0x4)['replace'](_0x5f44('0x11'),'');if(_0x455a1d['indexOf']('\x20')!=-0x1){_0x455a1d=_0x455a1d[_0x5f44('0x12')](0x0,_0x455a1d['indexOf']('\x20'));}if(_[_0x5f44('0x13')](_0x455a1d,'-1')){_0x455a1d=parseInt(_0x455a1d);}_0xe9b33b=_0x3f3155['rx'][_0x5f44('0x14')]('\x20');if(_0xe9b33b['length']==0x3){_0xe9b33b=_0xe9b33b[0x2][_0x5f44('0xf')](0x1,_0xe9b33b[0x2][_0x5f44('0x15')]-0x1);}else if(_0xe9b33b[_0x5f44('0x15')]>0x3){var _0xa2f508=/\((.+)\)/;var _0x3bf388=_0x3f3155['rx'][_0x5f44('0x16')](_0xa2f508);if(_0x3bf388){_0xe9b33b=_0x3bf388[0x1];}else{_0xe9b33b=null;}}else{_0xe9b33b=null;}_0x3f3155['cb'](null,{'code':_0x1b85fa,'result':_0x455a1d,'extra':_0xe9b33b});}});_0x567ac2['on']('error',function(_0x1fb50f){_0x5f0297[_0x5f44('0xc')](_0x5f44('0x17'),new AGIError(_0x5f44('0x18'),_0x1fb50f[_0x5f44('0x19')]));});_0x567ac2['on'](_0x5f44('0x1a'),function(){_0x5f0297[_0x5f44('0xc')]('close',new AGIError(_0x5f44('0x1b')));});_0x567ac2['on'](_0x5f44('0x1c'),function(){_0x5f0297[_0x5f44('0xc')](_0x5f44('0x1c'),new AGIError(_0x5f44('0x1d')));_0x567ac2[_0x5f44('0x1e')]();});_0x567ac2['pipe'](_0x53599a);this[_0x5f44('0x1f')]=function(_0x1d1cf1,_0x32475f){var _0x1d1cf1=_0x1d1cf1||'',_0x32475f=typeof _0x32475f==_0x5f44('0xe')?_0x32475f:new Function();_0x3f3155={'tx':_0x1d1cf1,'rx':'','cb':_0x32475f};_0x567ac2[_0x5f44('0x20')](_0x1d1cf1+'\x0a');},this[_0x5f44('0x1a')]=function(){_0x567ac2['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x5f44('0x21')][_0x5f44('0x22')]=function(_0x21e4f8){return this['command'][_0x5f44('0x23')](this,_0x21e4f8);};AGIChannel[_0x5f44('0x21')][_0x5f44('0x24')]=function(){return this[_0x5f44('0x22')]('ANSWER');};AGIChannel[_0x5f44('0x21')][_0x5f44('0x25')]=function(_0x3325ee,_0x3548ab,_0x4bc3b4){_0x3325ee=_0x3325ee===undefined?_0x5f44('0x26'):_0x3325ee;_0x3548ab=_0x3548ab===undefined?'5':_0x3548ab;_0x4bc3b4=_0x4bc3b4===undefined?'1':_0x4bc3b4;return this['sendRequest'](util[_0x5f44('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3325ee,_0x3548ab*0x3e8,_0x4bc3b4));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x28')]=function(_0x501c9c){_0x501c9c=_0x501c9c||'NO\x20MESSAGE';return this['sendRequest'](util[_0x5f44('0x27')](_0x5f44('0x29'),_0x501c9c));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x2a')]=function(_0x300676,_0x4eed7c){if(_[_0x5f44('0x2b')](_0x4eed7c)){return this[_0x5f44('0x22')](util[_0x5f44('0x27')](_0x5f44('0x2c'),_0x300676,_0x4eed7c[_0x5f44('0x2d')](',')));}return this[_0x5f44('0x22')](util[_0x5f44('0x27')](_0x5f44('0x2c'),_0x300676,_0x4eed7c));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x2e')]=function(_0x1aba47){return this[_0x5f44('0x22')](util['format'](_0x5f44('0x2f'),_0x1aba47));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x30')]=function(_0x320e38){return this[_0x5f44('0x22')](util[_0x5f44('0x27')]('SET\x20EXTENSION\x20%s',_0x320e38));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x31')]=function(_0xc0594f){return this[_0x5f44('0x22')](util[_0x5f44('0x27')](_0x5f44('0x32'),_0xc0594f));};AGIChannel[_0x5f44('0x21')]['hangup']=function(){return this[_0x5f44('0x22')](_0x5f44('0x33'));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x34')]=function(_0x165a10,_0x3f156a){var _0xf9c5d6=_[_0x5f44('0x35')](_0x3f156a)||_[_0x5f44('0x36')](_0x3f156a)?_0x3f156a[_0x5f44('0x37')]():_0x3f156a;return this[_0x5f44('0x22')](util[_0x5f44('0x27')](_0x5f44('0x38'),_0x165a10,_0xf9c5d6?_0xf9c5d6[_0x5f44('0x37')]()[_0x5f44('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x3a')]=function(_0x2384d4,_0x569107){return this[_0x5f44('0x22')](util[_0x5f44('0x27')](_0x5f44('0x3b'),_0x2384d4,_0x569107));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x3c')]=function(_0x1621c4,_0x48df39){return this[_0x5f44('0x22')](util[_0x5f44('0x27')]('SAY\x20DIGITS\x20%s\x20%s',_0x1621c4,_0x48df39));};AGIChannel['prototype'][_0x5f44('0x3d')]=function(_0x15dc23,_0x48fc31){return this['sendRequest'](util[_0x5f44('0x27')](_0x5f44('0x3e'),_0x15dc23,_0x48fc31));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x3f')]=function(_0x419da5,_0x30c237,_0x3016a6){_0x30c237=_0x30c237||this[_0x5f44('0x40')];_0x3016a6=_0x3016a6||0x1;this[_0x5f44('0x2e')](_0x419da5);this[_0x5f44('0x30')](_0x30c237);this[_0x5f44('0x31')](_0x3016a6);return this[_0x5f44('0x28')](util[_0x5f44('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x419da5,_0x30c237,_0x3016a6));};AGIChannel['prototype'][_0x5f44('0x41')]=function(_0x427bc9){return this[_0x5f44('0x22')](util['format'](_0x5f44('0x42'),_0x427bc9));};AGIChannel['prototype']['recordFile']=function(_0x4b04a0,_0x3c718f,_0x1c70f4,_0x1d1292,_0x1ec130,_0x285213){_0x3c718f=_0x3c718f||_0x5f44('0x43');_0x1c70f4=_0x1c70f4||'';_0x1d1292=_0x1d1292===undefined?-0x1:_0x1d1292==='-1'?-0x1:_0x1d1292*0x3e8;_0x1ec130=_0x1ec130===undefined?'':'s='+_0x1ec130;_0x285213=_0x285213?_0x5f44('0x44'):'';return this[_0x5f44('0x22')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x4b04a0,_0x3c718f,_0x1c70f4,_0x1d1292,_0x285213,_0x1ec130));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x45')]=function(_0x3911ea,_0x4101a4){_0x4101a4=_0x4101a4||'';return this['sendRequest'](util[_0x5f44('0x27')](_0x5f44('0x46'),_0x3911ea,_0x4101a4));};AGIChannel[_0x5f44('0x21')][_0x5f44('0x47')]=function(_0x2f0a6f){return this[_0x5f44('0x2a')]('AGI',_0x2f0a6f);};AGIChannel[_0x5f44('0x21')][_0x5f44('0x48')]=function(_0x51d653){return this[_0x5f44('0x2a')]('WAIT',_0x51d653);};AGIChannel[_0x5f44('0x21')][_0x5f44('0x17')]=function(_0x59d79a,_0xe552ae){this['noop'](util['format'](_0x5f44('0x49'),_0x59d79a['id'],_0x59d79a[_0x5f44('0x4a')],_0xe552ae));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5f44('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ec1ab60..6dbbdf3 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 _0x1556=['message','name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply'];(function(_0x5a91d9,_0x47cedb){var _0x5275e2=function(_0x15de79){while(--_0x15de79){_0x5a91d9['push'](_0x5a91d9['shift']());}};_0x5275e2(++_0x47cedb);}(_0x1556,0x128));var _0x6155=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1556[_0x413feb];return _0x40ee88;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x6155('0x0'),'E_AGI_ARGUMENT_PORT':_0x6155('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x6155('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x6155('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x6155('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x6155('0x5'),'E_AGI_COMMAND_EMPTY':_0x6155('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6155('0x7'),'E_AGI_IVR_ENTRY':_0x6155('0x8')};function AGIError(_0x2b8105){var _0x2b8105=_0x2b8105||null,_0x48bc38=_0x48bc38||[],_0x5c1ab0=0x1,_0x781d2b='';if(!error[_0x2b8105]){_0x2b8105='E_AGI_UNDEFINED';}_0x48bc38['push'](error[_0x2b8105]);while(arguments[_0x5c1ab0]){_0x48bc38[_0x6155('0x9')](arguments[_0x5c1ab0]);_0x5c1ab0++;}_0x781d2b=util[_0x6155('0xa')][_0x6155('0xb')](util,_0x48bc38);this[_0x6155('0xc')]=_0x781d2b;this[_0x6155('0xd')]=_0x2b8105;}module['exports']=AGIError; \ No newline at end of file +var _0x99bc=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','name','util','Undefined\x20error.'];(function(_0x516ecb,_0x5e75f8){var _0x57fbd2=function(_0x5b381d){while(--_0x5b381d){_0x516ecb['push'](_0x516ecb['shift']());}};_0x57fbd2(++_0x5e75f8);}(_0x99bc,0xf5));var _0xc99b=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x99bc[_0x51020b];return _0x371e47;};'use strict';var util=require(_0xc99b('0x0'));var error={'E_AGI_UNDEFINED':_0xc99b('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc99b('0x2'),'E_AGI_SERVER_CLOSE':_0xc99b('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xc99b('0x4'),'E_AGI_SOCKET_ERROR':_0xc99b('0x5'),'E_AGI_SOCKET_CLOSE':_0xc99b('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xc99b('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xc99b('0x8')};function AGIError(_0x348363){var _0x348363=_0x348363||null,_0x2eeef5=_0x2eeef5||[],_0x506e5f=0x1,_0x67ed73='';if(!error[_0x348363]){_0x348363='E_AGI_UNDEFINED';}_0x2eeef5[_0xc99b('0x9')](error[_0x348363]);while(arguments[_0x506e5f]){_0x2eeef5['push'](arguments[_0x506e5f]);_0x506e5f++;}_0x67ed73=util[_0xc99b('0xa')]['apply'](util,_0x2eeef5);this[_0xc99b('0xb')]=_0x67ed73;this[_0xc99b('0xc')]=_0x348363;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 72cb045..dda3713 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 _0x07a3=['emit','projectUpdate','E_AGI_SERVER_ERROR','ioredis','./error','../../config/environment','redis','agi','error','message','parse'];(function(_0x4c258c,_0x4d88e9){var _0x564473=function(_0x4ec157){while(--_0x4ec157){_0x4c258c['push'](_0x4c258c['shift']());}};_0x564473(++_0x4d88e9);}(_0x07a3,0xa8));var _0x307a=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x07a3[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x307a('0x0'));var AGIError=require(_0x307a('0x1'));var config=require(_0x307a('0x2'));config[_0x307a('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe'](_0x307a('0x4'),function(_0xd0465){if(_0xd0465)return eventEmitter['emit'](_0x307a('0x5'),new AGIError('E_AGI_SERVER_ERROR',_0xd0465));});sub['on'](_0x307a('0x6'),function(_0x32dffc,_0x2b36dc){if(_0x32dffc!==_0x307a('0x4'))return;try{var _0x487b8c=JSON[_0x307a('0x7')](_0x2b36dc);eventEmitter[_0x307a('0x8')](_0x307a('0x9'),_0x487b8c);}catch(_0xe81a00){eventEmitter[_0x307a('0x8')]('error',new AGIError(_0x307a('0xa'),_0xe81a00));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x1300=['parse','emit','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe','agi'];(function(_0x9510f5,_0x3a0263){var _0x24b8d9=function(_0x33366b){while(--_0x33366b){_0x9510f5['push'](_0x9510f5['shift']());}};_0x24b8d9(++_0x3a0263);}(_0x1300,0x1b8));var _0x0130=function(_0x211f5f,_0xc6daac){_0x211f5f=_0x211f5f-0x0;var _0x4feb86=_0x1300[_0x211f5f];return _0x4feb86;};'use strict';var _=require(_0x0130('0x0'));var EventEmitter=require(_0x0130('0x1'))[_0x0130('0x2')];var Redis=require(_0x0130('0x3'));var AGIError=require(_0x0130('0x4'));var config=require(_0x0130('0x5'));config[_0x0130('0x6')]=_['defaults'](config[_0x0130('0x6')],{'host':_0x0130('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x0130('0x6')]);sub[_0x0130('0x8')](_0x0130('0x9'),function(_0x4362f5){if(_0x4362f5)return eventEmitter['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x4362f5));});sub['on']('message',function(_0x14d3b5,_0x301b7c){if(_0x14d3b5!=='agi')return;try{var _0x405dad=JSON[_0x0130('0xa')](_0x301b7c);eventEmitter[_0x0130('0xb')](_0x0130('0xc'),_0x405dad);}catch(_0x4bb95d){eventEmitter[_0x0130('0xb')]('error',new AGIError(_0x0130('0xd'),_0x4bb95d));}});module[_0x0130('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 de78e9b..f82e050 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 _0xc620=['default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','relations','getVertex','info','length','condition','split','agicommand','default','invalid','traverseBFS','target','vswitch'];(function(_0x22f842,_0x4e43bb){var _0x14f83f=function(_0x2b681e){while(--_0x2b681e){_0x22f842['push'](_0x22f842['shift']());}};_0x14f83f(++_0x4e43bb);}(_0xc620,0x138));var _0x0c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc620[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c62('0x0'));var logger=require(_0x0c62('0x1'))(_0x0c62('0x2'));var verticesWithRetry=[_0x0c62('0x3'),_0x0c62('0x4'),_0x0c62('0x5')];var Graph=function(){this[_0x0c62('0x6')]={};this[_0x0c62('0x7')]={};this[_0x0c62('0x8')]=0x0;};Graph[_0x0c62('0x9')][_0x0c62('0xa')]=function(_0xf7dfc3){this[_0x0c62('0x6')][_0xf7dfc3['id']]=_0xf7dfc3;this[_0x0c62('0x7')][_0xf7dfc3['id']]=[];};Graph['prototype'][_0x0c62('0xb')]=function(_0x2d8ac3,_0x1df7e2,_0x33abaa){this['edges'][_0x2d8ac3]['push']({'target':_0x1df7e2,'condition':_0x33abaa});this[_0x0c62('0x8')]+=0x1;};Graph[_0x0c62('0x9')]['size']=function(){return _['size'](this[_0x0c62('0x6')]);};Graph[_0x0c62('0x9')][_0x0c62('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x0c62('0x9')][_0x0c62('0xd')]=function(_0x5b1f07){return this['vertices'][_0x5b1f07];};Graph[_0x0c62('0x9')]['traverseBFS']=function(_0x39a1a8,_0x58321c){if(!this[_0x0c62('0x6')][_0x39a1a8]){return logger[_0x0c62('0xe')]('no\x20vertex\x20found');}var _0xa8dd5d=_0x58321c(this[_0x0c62('0x6')][_0x39a1a8]);if(!_0xa8dd5d){return logger[_0x0c62('0xe')]('stop\x20traverse');}if(this[_0x0c62('0x7')][_0x39a1a8][_0x0c62('0xf')]===0x0){return logger[_0x0c62('0xe')]('no\x20edge/s\x20available');}for(var _0x517c06=0x0,_0x456b6f=[],_0xa775fb=![];_0x517c06\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','hasOwnProperty','indexOf','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','find','handleNotFound','handleUnpublished','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','then','catch','[LICENSE]','finally','./server','listening','close','syncho','util','../../config/logger','../../config/license/util','./rpc','./project','./events','agi','defaults','projectUpdate','stack','findIndex','deleted','push','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x28c8,0xf9));var _0x828c=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x28c8[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require('lodash');var syncho=require(_0x828c('0x0'));var util=require(_0x828c('0x1'));var config=require('../../config/environment');var logger=require(_0x828c('0x2'))('agi');var utilLicense=require(_0x828c('0x3'));var rpc=require(_0x828c('0x4'));var Project=require(_0x828c('0x5'));var AGIEmitter=require(_0x828c('0x6'))['EventEmitter'];var projects=[];config[_0x828c('0x7')]=_[_0x828c('0x8')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x828c('0x9'),projectUpdateHandler);function connectionHandler(_0x4d7421){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4d7421);agiHandler(_0x4d7421);}catch(_0x56e2f5){logger['error'](_0x56e2f5[_0x828c('0xa')]);}});});}function projectUpdateHandler(_0x81e8f9){try{var _0x217c68=_[_0x828c('0xb')](projects,['id',_0x81e8f9['id']]);if(_0x217c68>-0x1){if(_0x81e8f9[_0x828c('0xc')]===!![]){projects['splice'](_0x217c68,0x1);}else{projects[_0x217c68]=_0x81e8f9;}}else{projects[_0x828c('0xd')](_0x81e8f9);}}catch(_0x259fd1){logger['error'](_0x259fd1[_0x828c('0xa')]);}}function listeningHandler(){console[_0x828c('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x828c('0x7')][_0x828c('0xf')]);logger[_0x828c('0x10')](util[_0x828c('0x11')](_0x828c('0x12'),config[_0x828c('0x7')]['ip'],config[_0x828c('0x7')][_0x828c('0xf')]));}function errorHandler(_0x5492c5){if(_0x5492c5&&_0x5492c5[_0x828c('0x13')]&&_0x5492c5[_0x828c('0x14')]){logger[_0x828c('0x15')](util['format'](_0x828c('0x16'),_0x5492c5['name'],_0x5492c5[_0x828c('0x14')]));}else{logger[_0x828c('0x15')](util[_0x828c('0x11')]('[ERROR]\x20%s',_0x5492c5[_0x828c('0xa')]));}}function closeHandler(){logger['info'](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x828c('0x17')],this[_0x828c('0x18')],this[_0x828c('0x19')],this[_0x828c('0x1a')],this[_0x828c('0x1b')]));try{createSquareReport(this);}catch(_0x21b2ea){logger[_0x828c('0x15')](_0x21b2ea[_0x828c('0xa')]);}}function timeoutHandler(){logger[_0x828c('0x10')](util[_0x828c('0x11')](_0x828c('0x1c'),this['arg_1'],this[_0x828c('0x18')],this[_0x828c('0x19')],this[_0x828c('0x1a')],this[_0x828c('0x1b')]));}function hangupHandler(){logger[_0x828c('0x10')](util[_0x828c('0x11')](_0x828c('0x1d'),this[_0x828c('0x17')],this['calleridname'],this[_0x828c('0x19')],this[_0x828c('0x1a')],this[_0x828c('0x1b')]));this['evtHangup']=!![];}function createSquareReport(_0x23a1ab,_0xcacee7){rpc[_0x828c('0x1e')](_0x23a1ab)['then'](function(_0xdf5cb8){if(_0xcacee7){_0xcacee7(null,_0xdf5cb8);}})['catch'](function(_0x5f2fa5){if(_0xcacee7){_0xcacee7(null,_0x5f2fa5);}});}function setChannelVariables(_0x22f560){for(var _0x3639e9 in _0x22f560){if(_0x22f560[_0x828c('0x1f')](_0x3639e9)){if(_0x3639e9[_0x828c('0x20')]('agi_')===0x0){_0x22f560[_0x3639e9[_0x828c('0x21')](0x4)]=_0x22f560[_0x3639e9];delete _0x22f560[_0x3639e9];}}}}function agiHandler(_0x15e715){logger[_0x828c('0x22')](_0x828c('0x23'),JSON['stringify'](_0x15e715,null,0x2));logger[_0x828c('0x10')](util[_0x828c('0x11')](_0x828c('0x24'),_0x15e715['arg_1'],_0x15e715[_0x828c('0x18')],_0x15e715['callerid'],_0x15e715[_0x828c('0x1a')],_0x15e715['uniqueid']));_0x15e715['on'](_0x828c('0x15'),errorHandler);_0x15e715['on']('close',closeHandler);_0x15e715['on'](_0x828c('0x25'),timeoutHandler);_0x15e715[_0x828c('0x26')]=![];_0x15e715['on'](_0x828c('0x27'),hangupHandler);var _0x5d724b=_[_0x828c('0x28')](projects,[_0x828c('0x13'),_0x15e715[_0x828c('0x17')]]);if(!_0x5d724b)return Project[_0x828c('0x29')](_0x15e715);if(!_0x5d724b['production'])return Project[_0x828c('0x2a')](_0x15e715);return Project['initialize'](_0x5d724b,_0x15e715);}function main(){var _0x1c4637;return utilLicense[_0x828c('0x2b')]()['then'](function(_0x23deec){if(!_0x23deec)return;if(_0x23deec['voice']){if(_0x23deec[_0x828c('0x2c')]&&_0x23deec[_0x828c('0x2c')]>0x0){logger[_0x828c('0x10')](util[_0x828c('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x23deec[_0x828c('0x2c')]));_0x1c4637=_0x23deec['callysquare'];}else{logger[_0x828c('0x10')](_0x828c('0x2d'));}}else{logger[_0x828c('0x10')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1c4637=-0x1;}})['then'](function(){return Project[_0x828c('0x2e')]();})[_0x828c('0x2f')](function(_0x48337b){projects=_0x48337b;return;})[_0x828c('0x30')](function(_0x1c7aa8){logger['error'](_0x828c('0x31'),_0x1c7aa8[_0x828c('0xa')]);})[_0x828c('0x32')](function(){var _0xeeb2fd=require(_0x828c('0x33'))(config[_0x828c('0x7')][_0x828c('0xf')],config['agi']['ip'],_0x1c4637);_0xeeb2fd['on']('error',errorHandler);_0xeeb2fd['on'](_0x828c('0x34'),listeningHandler);_0xeeb2fd['on']('connection',connectionHandler);_0xeeb2fd['on'](_0x828c('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0xa82c=['stack','findIndex','deleted','push','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','indexOf','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','then','[LICENSE]','finally','listening','connection','util','../../config/environment','../../config/logger','agi','EventEmitter','defaults','127.0.0.1','projectUpdate','error'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xa82c,0x129));var _0xca82=function(_0x1650af,_0x11e5f3){_0x1650af=_0x1650af-0x0;var _0x245ffe=_0xa82c[_0x1650af];return _0x245ffe;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0xca82('0x0'));var config=require(_0xca82('0x1'));var logger=require(_0xca82('0x2'))(_0xca82('0x3'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require('./events')[_0xca82('0x4')];var projects=[];config[_0xca82('0x3')]=_[_0xca82('0x5')](config['agi'],{'ip':_0xca82('0x6'),'port':0x11dd});AGIEmitter['on'](_0xca82('0x7'),projectUpdateHandler);function connectionHandler(_0xfc6a0){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xfc6a0);agiHandler(_0xfc6a0);}catch(_0x28ee3b){logger[_0xca82('0x8')](_0x28ee3b[_0xca82('0x9')]);}});});}function projectUpdateHandler(_0x3f69c7){try{var _0x2eee61=_[_0xca82('0xa')](projects,['id',_0x3f69c7['id']]);if(_0x2eee61>-0x1){if(_0x3f69c7[_0xca82('0xb')]===!![]){projects['splice'](_0x2eee61,0x1);}else{projects[_0x2eee61]=_0x3f69c7;}}else{projects[_0xca82('0xc')](_0x3f69c7);}}catch(_0x25bbc3){logger[_0xca82('0x8')](_0x25bbc3[_0xca82('0x9')]);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xca82('0x3')][_0xca82('0xd')]);logger[_0xca82('0xe')](util[_0xca82('0xf')](_0xca82('0x10'),config['agi']['ip'],config[_0xca82('0x3')]['port']));}function errorHandler(_0x966cd4){if(_0x966cd4&&_0x966cd4['name']&&_0x966cd4[_0xca82('0x11')]){logger[_0xca82('0x8')](util['format'](_0xca82('0x12'),_0x966cd4[_0xca82('0x13')],_0x966cd4[_0xca82('0x11')]));}else{logger[_0xca82('0x8')](util[_0xca82('0xf')](_0xca82('0x14'),_0x966cd4[_0xca82('0x9')]));}}function closeHandler(){logger[_0xca82('0xe')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xca82('0x15')],this['calleridname'],this[_0xca82('0x16')],this[_0xca82('0x17')],this[_0xca82('0x18')]));try{createSquareReport(this);}catch(_0x40f5ec){logger[_0xca82('0x8')](_0x40f5ec['stack']);}}function timeoutHandler(){logger[_0xca82('0xe')](util[_0xca82('0xf')](_0xca82('0x19'),this['arg_1'],this[_0xca82('0x1a')],this[_0xca82('0x16')],this[_0xca82('0x17')],this['uniqueid']));}function hangupHandler(){logger['info'](util['format'](_0xca82('0x1b'),this[_0xca82('0x15')],this['calleridname'],this['callerid'],this[_0xca82('0x17')],this['uniqueid']));this[_0xca82('0x1c')]=!![];}function createSquareReport(_0x3252fe,_0x388492){rpc[_0xca82('0x1d')](_0x3252fe)['then'](function(_0x49d7ef){if(_0x388492){_0x388492(null,_0x49d7ef);}})[_0xca82('0x1e')](function(_0x3891fe){if(_0x388492){_0x388492(null,_0x3891fe);}});}function setChannelVariables(_0x3468ba){for(var _0x32b1bc in _0x3468ba){if(_0x3468ba['hasOwnProperty'](_0x32b1bc)){if(_0x32b1bc[_0xca82('0x1f')](_0xca82('0x20'))===0x0){_0x3468ba[_0x32b1bc[_0xca82('0x21')](0x4)]=_0x3468ba[_0x32b1bc];delete _0x3468ba[_0x32b1bc];}}}}function agiHandler(_0x433b09){logger[_0xca82('0x22')]('variables',JSON[_0xca82('0x23')](_0x433b09,null,0x2));logger[_0xca82('0xe')](util['format'](_0xca82('0x24'),_0x433b09[_0xca82('0x15')],_0x433b09[_0xca82('0x1a')],_0x433b09[_0xca82('0x16')],_0x433b09[_0xca82('0x17')],_0x433b09['uniqueid']));_0x433b09['on'](_0xca82('0x8'),errorHandler);_0x433b09['on'](_0xca82('0x25'),closeHandler);_0x433b09['on'](_0xca82('0x26'),timeoutHandler);_0x433b09[_0xca82('0x1c')]=![];_0x433b09['on'](_0xca82('0x27'),hangupHandler);var _0x52ea77=_[_0xca82('0x28')](projects,[_0xca82('0x13'),_0x433b09[_0xca82('0x15')]]);if(!_0x52ea77)return Project['handleNotFound'](_0x433b09);if(!_0x52ea77['production'])return Project[_0xca82('0x29')](_0x433b09);return Project[_0xca82('0x2a')](_0x52ea77,_0x433b09);}function main(){var _0x554dae;return utilLicense[_0xca82('0x2b')]()['then'](function(_0x4edf37){if(!_0x4edf37)return;if(_0x4edf37['voice']){if(_0x4edf37[_0xca82('0x2c')]&&_0x4edf37[_0xca82('0x2c')]>0x0){logger['info'](util[_0xca82('0xf')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4edf37[_0xca82('0x2c')]));_0x554dae=_0x4edf37[_0xca82('0x2c')];}else{logger[_0xca82('0xe')](_0xca82('0x2d'));}}else{logger[_0xca82('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x554dae=-0x1;}})[_0xca82('0x2e')](function(){return Project['getAll']();})[_0xca82('0x2e')](function(_0x53e58b){projects=_0x53e58b;return;})[_0xca82('0x1e')](function(_0x1917c4){logger[_0xca82('0x8')](_0xca82('0x2f'),_0x1917c4[_0xca82('0x9')]);})[_0xca82('0x30')](function(){var _0x38eeee=require('./server')(config[_0xca82('0x3')]['port'],config[_0xca82('0x3')]['ip'],_0x554dae);_0x38eeee['on']('error',errorHandler);_0x38eeee['on'](_0xca82('0x31'),listeningHandler);_0x38eeee['on'](_0xca82('0x32'),connectionHandler);_0x38eeee['on'](_0xca82('0x25'),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 4fc9913..ce2760e 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 _0x3cca=['request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x12f9a1,_0x1d1eff){var _0xb80c0f=function(_0x1d339a){while(--_0x1d339a){_0x12f9a1['push'](_0x12f9a1['shift']());}};_0xb80c0f(++_0x1d1eff);}(_0x3cca,0x194));var _0xa3cc=function(_0x390606,_0x59b269){_0x390606=_0x390606-0x0;var _0x2b51f1=_0x3cca[_0x390606];return _0x2b51f1;};'use strict';var BPromise=require(_0xa3cc('0x0'));var jayson=require(_0xa3cc('0x1'));var client=jayson['client'][_0xa3cc('0x2')]({'port':0x232b});function request(_0x5db75a,_0x445bea){return new BPromise(function(_0x12bf9e,_0x5e9e38){return client[_0xa3cc('0x3')](_0x5db75a,_0x445bea)[_0xa3cc('0x4')](function(_0x3cc155){if(_0x3cc155[_0xa3cc('0x5')]){return _0x5e9e38(_0x3cc155[_0xa3cc('0x5')][_0xa3cc('0x6')]);}else{return _0x12bf9e(_0x3cc155[_0xa3cc('0x7')]);}})[_0xa3cc('0x8')](function(_0x5baef8){return _0x5e9e38(_0x5baef8);});});}exports[_0xa3cc('0x9')]=function(_0x2762c5,_0x381a68){return request(_0xa3cc('0xa'),{'account':_0x2762c5,'message':_0x381a68});}; \ No newline at end of file +var _0x0e6f=['bluebird','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x6425df,_0x35cb17){var _0x2c8ab4=function(_0x3fef16){while(--_0x3fef16){_0x6425df['push'](_0x6425df['shift']());}};_0x2c8ab4(++_0x35cb17);}(_0x0e6f,0x14a));var _0xf0e6=function(_0xc8966a,_0x19753d){_0xc8966a=_0xc8966a-0x0;var _0x2a3be4=_0x0e6f[_0xc8966a];return _0x2a3be4;};'use strict';var BPromise=require(_0xf0e6('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xf0e6('0x1')][_0xf0e6('0x2')]({'port':0x232b});function request(_0x2c4892,_0x565ae4){return new BPromise(function(_0x3f763d,_0x5667eb){return client[_0xf0e6('0x3')](_0x2c4892,_0x565ae4)[_0xf0e6('0x4')](function(_0x349507){if(_0x349507['error']){return _0x5667eb(_0x349507[_0xf0e6('0x5')]['message']);}else{return _0x3f763d(_0x349507[_0xf0e6('0x6')]);}})[_0xf0e6('0x7')](function(_0x478dd3){return _0x5667eb(_0x478dd3);});});}exports[_0xf0e6('0x8')]=function(_0x34a44d,_0x559563){return request(_0xf0e6('0x9'),{'account':_0x34a44d,'message':_0x559563});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index d00953c..bbc1103 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 _0x3380=['target','addEdge','source','mxGraphModel','root','inspect','production','debug','stringify','joinAt','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','start','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','isUndefined','arg_1','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','close','exports','lodash','xml2json','./mailRpc','getSquareProjects','error','stack','hasOwnProperty','retry','omit','mxCell','length'];(function(_0x3e86ea,_0x44db83){var _0x359b69=function(_0x405f6e){while(--_0x405f6e){_0x3e86ea['push'](_0x3e86ea['shift']());}};_0x359b69(++_0x44db83);}(_0x3380,0x1a5));var _0x0338=function(_0x37ef04,_0x49f673){_0x37ef04=_0x37ef04-0x0;var _0x388b25=_0x3380[_0x37ef04];return _0x388b25;};'use strict';var _=require(_0x0338('0x0'));var moment=require('moment');var parser=require(_0x0338('0x1'));var util=require('util');var logger=require('../../config/logger')('agi');var rpc=require('./rpc');var mailRpc=require(_0x0338('0x2'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x0338('0x3')]()['catch'](function(_0x26e24e){logger[_0x0338('0x4')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x26e24e[_0x0338('0x5')]);return[];});}function addVertex(_0x5ca774,_0x2cf506,_0x4ef01a){_0x2cf506['agicommand']=_0x4ef01a;if(_0x2cf506[_0x0338('0x6')](_0x0338('0x7'))){_0x2cf506['maxRetry']=parseInt(_0x2cf506['retry'],0xa);}_0x5ca774['addVertex'](_[_0x0338('0x8')](_0x2cf506,_0x0338('0x9')));}function initGraph(_0x4e02d5,_0x293361){var _0x37122d=new Graph();for(var _0x95488f in _0x4e02d5){if(_0x4e02d5['hasOwnProperty'](_0x95488f)){if(_['isArray'](_0x4e02d5[_0x95488f])){for(var _0x5d3290=0x0;_0x5d3290<_0x4e02d5[_0x95488f]['length'];_0x5d3290+=0x1){addVertex(_0x37122d,_0x4e02d5[_0x95488f][_0x5d3290],_0x95488f);}}else{addVertex(_0x37122d,_0x4e02d5[_0x95488f],_0x95488f);}}}for(var _0x5559b2=0x0;_0x5559b2<_0x293361[_0x0338('0xa')];_0x5559b2+=0x1){if(_0x293361[_0x5559b2]['source']&&_0x293361[_0x5559b2][_0x0338('0xb')]){_0x37122d[_0x0338('0xc')](_0x293361[_0x5559b2][_0x0338('0xd')],_0x293361[_0x5559b2]['target'],_0x293361[_0x5559b2]['value']);}}return _0x37122d;}function getRoot(_0x236e89){return parser['toJson'](_0x236e89,{'object':!![]})[_0x0338('0xe')][_0x0338('0xf')];}function inspect(_0x42feb5){return util[_0x0338('0x10')](_0x42feb5,{'showHidden':![],'depth':null});}function initialize(_0x547f0a,_0x528e28){var _0x3b92ea=getRoot(_0x547f0a[_0x0338('0x11')]);if(!_0x3b92ea||!_0x3b92ea['start'])return;var _0x437166,_0x367987,_0x3420a9;logger[_0x0338('0x12')](_0x0338('0xf'),JSON[_0x0338('0x13')](_0x3b92ea,null,0x2));_0x528e28[_0x0338('0x14')]=moment()[_0x0338('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x437166=initGraph(_[_0x0338('0x8')](_0x3b92ea,_0x0338('0x9')),_0x3b92ea[_0x0338('0x9')]);_0x367987=new Vertices(_0x528e28,rpc,mailRpc);logger[_0x0338('0x16')](util[_0x0338('0x15')](_0x0338('0x17'),_0x528e28['arg_1'],_0x528e28[_0x0338('0x18')],_0x528e28[_0x0338('0x19')],_0x528e28[_0x0338('0x1a')],_0x528e28[_0x0338('0x1b')]));_0x437166['traverseBFS'](_0x3b92ea[_0x0338('0x1c')]['id'],function(_0x184ccd){try{_0x184ccd=_0x367987['clear'](_0x184ccd);logger['debug']('vertex',JSON[_0x0338('0x13')](_0x184ccd,null,0x2));if(_0x184ccd[_0x0338('0x1d')]===_0x0338('0x1e')){logger[_0x0338('0x16')](_0x0338('0x1f'));_0x528e28[_0x0338('0x20')]=_0x184ccd[_0x0338('0x20')]||_0x528e28['context'];_0x528e28[_0x0338('0x21')]=_0x184ccd[_0x0338('0x21')];_0x528e28[_0x0338('0x22')]=_0x184ccd[_0x0338('0x22')]?_0x184ccd[_0x0338('0x22')]-0x1:0x1;return null;}else if(_0x184ccd&&_0x367987[_0x184ccd[_0x0338('0x1d')]]){_0x3420a9=_0x367987[_0x184ccd['agicommand']](_0x184ccd);logger[_0x0338('0x16')](_0x0338('0x23'),JSON[_0x0338('0x13')](_0x3420a9,null,0x2));if(_0x3420a9&&_0x3420a9[_0x0338('0x24')]===AGI_CODE_SUCCESS&&_0x3420a9[_0x0338('0x25')]!==AGI_RESULT_ERROR&&!_0x528e28[_0x0338('0x26')]){logger[_0x0338('0x12')](_0x0338('0x23'),inspect(_0x3420a9));return _['isUndefined'](_0x3420a9[_0x0338('0x25')])?null:_0x3420a9[_0x0338('0x25')][_0x0338('0x27')]();}else{logger[_0x0338('0x4')](_0x0338('0x23'),inspect(_0x3420a9));return null;}}else{logger['error'](_0x0338('0x28'));return null;}}catch(_0x3d7d3c){logger[_0x0338('0x4')](_0x3d7d3c[_0x0338('0x5')]);return null;}});if(_0x3b92ea[_0x0338('0x29')]){logger[_0x0338('0x16')](util[_0x0338('0x15')](_0x0338('0x2a'),_0x528e28['arg_1'],_0x528e28[_0x0338('0x18')],_0x528e28[_0x0338('0x19')],_0x528e28[_0x0338('0x1a')],_0x528e28[_0x0338('0x1b')]));_0x437166[_0x0338('0x2b')](_0x3b92ea[_0x0338('0x29')]['id'],function(_0x267f19){try{_0x267f19=_0x367987[_0x0338('0x2c')](_0x267f19);logger[_0x0338('0x12')](_0x0338('0x2d'),JSON[_0x0338('0x13')](_0x267f19,null,0x2));if(_0x267f19&&_0x367987[_0x267f19['agicommand']]){_0x3420a9=_0x367987[_0x267f19[_0x0338('0x1d')]](_0x267f19);if(_0x3420a9){logger['debug'](_0x0338('0x23'),inspect(_0x3420a9));return _[_0x0338('0x2e')](_0x3420a9[_0x0338('0x25')])?null:_0x3420a9['result'][_0x0338('0x27')]();}else{logger[_0x0338('0x4')](_0x0338('0x23'),inspect(_0x3420a9));return null;}}else{logger[_0x0338('0x4')](_0x0338('0x28'));return null;}}catch(_0x56b473){logger[_0x0338('0x4')](_0x56b473['stack']);return null;}});}logger[_0x0338('0x16')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x528e28[_0x0338('0x2f')],_0x528e28[_0x0338('0x18')],_0x528e28[_0x0338('0x19')],_0x528e28['dnid'],_0x528e28['uniqueid']));logger[_0x0338('0x16')](util['format'](_0x0338('0x30'),_0x528e28['context'],_0x528e28[_0x0338('0x21')],parseInt(_0x528e28[_0x0338('0x22')],0xa)+0x1));_0x528e28['continueAt'](_0x528e28[_0x0338('0x20')],_0x528e28[_0x0338('0x21')],parseInt(_0x528e28[_0x0338('0x22')],0xa)+0x1);_0x528e28['close']();}function handleNotFound(_0x164449){logger[_0x0338('0x4')](util[_0x0338('0x15')](_0x0338('0x31'),_0x164449[_0x0338('0x2f')]));_0x164449[_0x0338('0x32')](_0x164449[_0x0338('0x20')],_0x164449[_0x0338('0x21')],parseInt(_0x164449[_0x0338('0x22')],0xa)+0x1);_0x164449['close']();}function handleUnpublished(_0xcedb8d){logger[_0x0338('0x4')](util[_0x0338('0x15')](_0x0338('0x33'),_0xcedb8d[_0x0338('0x2f')]));_0xcedb8d[_0x0338('0x32')](_0xcedb8d[_0x0338('0x20')],_0xcedb8d[_0x0338('0x21')],parseInt(_0xcedb8d[_0x0338('0x22')],0xa)+0x1);_0xcedb8d[_0x0338('0x34')]();}module[_0x0338('0x35')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x1521=['vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','info','response','stringify','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','format','calleridname','callerid','clear','result','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','addVertex','length','source','target','addEdge','value','toJson','root','inspect','start','debug','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','traverseBFS'];(function(_0x14ba0b,_0x1acb47){var _0x28d780=function(_0x1953c3){while(--_0x1953c3){_0x14ba0b['push'](_0x14ba0b['shift']());}};_0x28d780(++_0x1acb47);}(_0x1521,0x167));var _0x1152=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x1521[_0x2bd1ec];return _0x2f7577;};'use strict';var _=require('lodash');var moment=require(_0x1152('0x0'));var parser=require(_0x1152('0x1'));var util=require(_0x1152('0x2'));var logger=require(_0x1152('0x3'))(_0x1152('0x4'));var rpc=require(_0x1152('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x1152('0x6'));var Vertices=require(_0x1152('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1152('0x8')]()['catch'](function(_0x201248){logger[_0x1152('0x9')](_0x1152('0xa'),_0x201248['stack']);return[];});}function addVertex(_0x5c5895,_0x420ce9,_0xed0d07){_0x420ce9[_0x1152('0xb')]=_0xed0d07;if(_0x420ce9[_0x1152('0xc')](_0x1152('0xd'))){_0x420ce9['maxRetry']=parseInt(_0x420ce9['retry'],0xa);}_0x5c5895[_0x1152('0xe')](_['omit'](_0x420ce9,'mxCell'));}function initGraph(_0x43129c,_0x414024){var _0x326b38=new Graph();for(var _0x40d57d in _0x43129c){if(_0x43129c[_0x1152('0xc')](_0x40d57d)){if(_['isArray'](_0x43129c[_0x40d57d])){for(var _0xed30b=0x0;_0xed30b<_0x43129c[_0x40d57d][_0x1152('0xf')];_0xed30b+=0x1){addVertex(_0x326b38,_0x43129c[_0x40d57d][_0xed30b],_0x40d57d);}}else{addVertex(_0x326b38,_0x43129c[_0x40d57d],_0x40d57d);}}}for(var _0x4487f4=0x0;_0x4487f4<_0x414024[_0x1152('0xf')];_0x4487f4+=0x1){if(_0x414024[_0x4487f4][_0x1152('0x10')]&&_0x414024[_0x4487f4][_0x1152('0x11')]){_0x326b38[_0x1152('0x12')](_0x414024[_0x4487f4][_0x1152('0x10')],_0x414024[_0x4487f4][_0x1152('0x11')],_0x414024[_0x4487f4][_0x1152('0x13')]);}}return _0x326b38;}function getRoot(_0x3db4c3){return parser[_0x1152('0x14')](_0x3db4c3,{'object':!![]})['mxGraphModel'][_0x1152('0x15')];}function inspect(_0x297f13){return util[_0x1152('0x16')](_0x297f13,{'showHidden':![],'depth':null});}function initialize(_0x4ef38a,_0x27d085){var _0xcf7cb7=getRoot(_0x4ef38a['production']);if(!_0xcf7cb7||!_0xcf7cb7[_0x1152('0x17')])return;var _0x209899,_0x4584cd,_0x9e3bf7;logger[_0x1152('0x18')](_0x1152('0x15'),JSON['stringify'](_0xcf7cb7,null,0x2));_0x27d085['joinAt']=moment()['format'](_0x1152('0x19'));_0x209899=initGraph(_[_0x1152('0x1a')](_0xcf7cb7,_0x1152('0x1b')),_0xcf7cb7[_0x1152('0x1b')]);_0x4584cd=new Vertices(_0x27d085,rpc,mailRpc);logger['info'](util['format'](_0x1152('0x1c'),_0x27d085[_0x1152('0x1d')],_0x27d085['calleridname'],_0x27d085['callerid'],_0x27d085[_0x1152('0x1e')],_0x27d085[_0x1152('0x1f')]));_0x209899[_0x1152('0x20')](_0xcf7cb7['start']['id'],function(_0x456905){try{_0x456905=_0x4584cd['clear'](_0x456905);logger[_0x1152('0x18')](_0x1152('0x21'),JSON['stringify'](_0x456905,null,0x2));if(_0x456905[_0x1152('0xb')]==='gotoc'){logger['info'](_0x1152('0x22'));_0x27d085['context']=_0x456905[_0x1152('0x23')]||_0x27d085['context'];_0x27d085['extension']=_0x456905[_0x1152('0x24')];_0x27d085['priority']=_0x456905['priority']?_0x456905[_0x1152('0x25')]-0x1:0x1;return null;}else if(_0x456905&&_0x4584cd[_0x456905[_0x1152('0xb')]]){_0x9e3bf7=_0x4584cd[_0x456905[_0x1152('0xb')]](_0x456905);logger[_0x1152('0x26')](_0x1152('0x27'),JSON[_0x1152('0x28')](_0x9e3bf7,null,0x2));if(_0x9e3bf7&&_0x9e3bf7['code']===AGI_CODE_SUCCESS&&_0x9e3bf7['result']!==AGI_RESULT_ERROR&&!_0x27d085[_0x1152('0x29')]){logger[_0x1152('0x18')]('response',inspect(_0x9e3bf7));return _[_0x1152('0x2a')](_0x9e3bf7['result'])?null:_0x9e3bf7['result'][_0x1152('0x2b')]();}else{logger[_0x1152('0x9')](_0x1152('0x27'),inspect(_0x9e3bf7));return null;}}else{logger[_0x1152('0x9')](_0x1152('0x2c'));return null;}}catch(_0x2efd5a){logger[_0x1152('0x9')](_0x2efd5a['stack']);return null;}});if(_0xcf7cb7[_0x1152('0x2d')]){logger['info'](util[_0x1152('0x2e')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x27d085[_0x1152('0x1d')],_0x27d085[_0x1152('0x2f')],_0x27d085[_0x1152('0x30')],_0x27d085['dnid'],_0x27d085[_0x1152('0x1f')]));_0x209899['traverseBFS'](_0xcf7cb7[_0x1152('0x2d')]['id'],function(_0x41fa9b){try{_0x41fa9b=_0x4584cd[_0x1152('0x31')](_0x41fa9b);logger[_0x1152('0x18')](_0x1152('0x21'),JSON[_0x1152('0x28')](_0x41fa9b,null,0x2));if(_0x41fa9b&&_0x4584cd[_0x41fa9b[_0x1152('0xb')]]){_0x9e3bf7=_0x4584cd[_0x41fa9b[_0x1152('0xb')]](_0x41fa9b);if(_0x9e3bf7){logger[_0x1152('0x18')]('response',inspect(_0x9e3bf7));return _[_0x1152('0x2a')](_0x9e3bf7[_0x1152('0x32')])?null:_0x9e3bf7['result'][_0x1152('0x2b')]();}else{logger[_0x1152('0x9')](_0x1152('0x27'),inspect(_0x9e3bf7));return null;}}else{logger[_0x1152('0x9')](_0x1152('0x2c'));return null;}}catch(_0x334b82){logger[_0x1152('0x9')](_0x334b82['stack']);return null;}});}logger[_0x1152('0x26')](util[_0x1152('0x2e')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x27d085[_0x1152('0x1d')],_0x27d085['calleridname'],_0x27d085[_0x1152('0x30')],_0x27d085[_0x1152('0x1e')],_0x27d085[_0x1152('0x1f')]));logger['info'](util['format'](_0x1152('0x33'),_0x27d085[_0x1152('0x23')],_0x27d085[_0x1152('0x24')],parseInt(_0x27d085[_0x1152('0x25')],0xa)+0x1));_0x27d085[_0x1152('0x34')](_0x27d085[_0x1152('0x23')],_0x27d085[_0x1152('0x24')],parseInt(_0x27d085[_0x1152('0x25')],0xa)+0x1);_0x27d085[_0x1152('0x35')]();}function handleNotFound(_0x1e5b92){logger['error'](util[_0x1152('0x2e')]('Project\x20%s\x20not\x20found',_0x1e5b92['arg_1']));_0x1e5b92[_0x1152('0x34')](_0x1e5b92['context'],_0x1e5b92[_0x1152('0x24')],parseInt(_0x1e5b92[_0x1152('0x25')],0xa)+0x1);_0x1e5b92[_0x1152('0x35')]();}function handleUnpublished(_0x8b2a4f){logger['error'](util['format'](_0x1152('0x36'),_0x8b2a4f['arg_1']));_0x8b2a4f[_0x1152('0x34')](_0x8b2a4f['context'],_0x8b2a4f[_0x1152('0x24')],parseInt(_0x8b2a4f[_0x1152('0x25')],0xa)+0x1);_0x8b2a4f[_0x1152('0x35')]();}module[_0x1152('0x37')]={'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 ca43737..e660c45 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 _0xa8a1=['length','split','slice','trim','emit','line','exports','stream','Transform','call','_localBuffer','inherits','prototype','_transform','_inBody','indexOf','substring'];(function(_0x1a88e7,_0x51d5ce){var _0x1fd3c6=function(_0x174754){while(--_0x174754){_0x1a88e7['push'](_0x1a88e7['shift']());}};_0x1fd3c6(++_0x51d5ce);}(_0xa8a1,0x6d));var _0x1a8a=function(_0x3db27d,_0x395887){_0x3db27d=_0x3db27d-0x0;var _0x5101df=_0xa8a1[_0x3db27d];return _0x5101df;};'use strict';var util=require('util');var Transform=require(_0x1a8a('0x0'))[_0x1a8a('0x1')];function AGIReply(_0x2309ff){Transform[_0x1a8a('0x2')](this,_0x2309ff);this[_0x1a8a('0x3')]='';this['_inBody']=![];}util[_0x1a8a('0x4')](AGIReply,Transform);AGIReply[_0x1a8a('0x5')][_0x1a8a('0x6')]=function(_0x5abff1,_0x1a088a,_0x49bd28){var _0x6c4f69='\x0a',_0x329e72=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x21892f=-0x1,_0x1506f2=-0x1,_0x5a8a29='',_0xa05174=0x0,_0x370c91='',_0x319803='';this[_0x1a8a('0x3')]+=_0x5abff1['toString']();_0x370c91=this['_localBuffer'];if(!this[_0x1a8a('0x7')]){_0xa05174=0x0;while(_0x329e72[_0xa05174]){while((_0x1506f2=_0x370c91[_0x1a8a('0x8')](_0x329e72[_0xa05174]))!=-0x1){_0x5a8a29=_0x329e72[_0xa05174];_0x319803=_0x370c91[_0x1a8a('0x9')](0x0,_0x1506f2);_0x370c91=_0x370c91['substring'](_0x1506f2+_0x5a8a29[_0x1a8a('0xa')]);var _0x373811=_0x319803[_0x1a8a('0xb')](_0x6c4f69),_0x48f704=0x0,_0x2b8e15={},_0x7b9d9b='',_0x23db09='',_0x345317=-0x1;while(_0x373811[_0x48f704]){_0x345317=_0x373811[_0x48f704][_0x1a8a('0x8')](':');if(_0x345317!=-0x1){_0x7b9d9b=_0x373811[_0x48f704][_0x1a8a('0xc')](0x0,_0x345317)[_0x1a8a('0xd')]();_0x23db09=_0x373811[_0x48f704][_0x1a8a('0xc')](_0x345317+0x1)['trim']();if(_0x7b9d9b[_0x1a8a('0xa')]>0x0){_0x2b8e15[_0x7b9d9b]=_0x23db09;}}else{}_0x48f704++;}this[_0x1a8a('0xe')]('headers',_0x2b8e15);this[_0x1a8a('0x7')]=!![];}_0xa05174++;}this['_localBuffer']=_0x370c91;}else{while((_0x21892f=_0x370c91[_0x1a8a('0x8')](_0x6c4f69))!=-0x1){_0x319803=_0x370c91['substring'](0x0,_0x21892f);this[_0x1a8a('0xe')](_0x1a8a('0xf'),_0x319803);_0x370c91=_0x370c91[_0x1a8a('0x9')](_0x21892f+_0x6c4f69['length']);}this[_0x1a8a('0x3')]=_0x370c91;}_0x49bd28();};module[_0x1a8a('0x10')]=AGIReply; \ No newline at end of file +var _0xfbe6=['headers','emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','slice','trim','length'];(function(_0x406427,_0x413a81){var _0x5244f0=function(_0x2b000f){while(--_0x2b000f){_0x406427['push'](_0x406427['shift']());}};_0x5244f0(++_0x413a81);}(_0xfbe6,0x6d));var _0x6fbe=function(_0xe92f6b,_0x3e2fe8){_0xe92f6b=_0xe92f6b-0x0;var _0x3c1f06=_0xfbe6[_0xe92f6b];return _0x3c1f06;};'use strict';var util=require(_0x6fbe('0x0'));var Transform=require(_0x6fbe('0x1'))[_0x6fbe('0x2')];function AGIReply(_0x50c7b9){Transform[_0x6fbe('0x3')](this,_0x50c7b9);this[_0x6fbe('0x4')]='';this[_0x6fbe('0x5')]=![];}util[_0x6fbe('0x6')](AGIReply,Transform);AGIReply[_0x6fbe('0x7')][_0x6fbe('0x8')]=function(_0x1911bf,_0x1b4d67,_0x46b337){var _0x120352='\x0a',_0x533992=['\x0a\x0a',_0x6fbe('0x9')],_0x1b4712=-0x1,_0x1be794=-0x1,_0x439feb='',_0x5532b3=0x0,_0x2ab238='',_0x2b4489='';this[_0x6fbe('0x4')]+=_0x1911bf[_0x6fbe('0xa')]();_0x2ab238=this[_0x6fbe('0x4')];if(!this[_0x6fbe('0x5')]){_0x5532b3=0x0;while(_0x533992[_0x5532b3]){while((_0x1be794=_0x2ab238[_0x6fbe('0xb')](_0x533992[_0x5532b3]))!=-0x1){_0x439feb=_0x533992[_0x5532b3];_0x2b4489=_0x2ab238[_0x6fbe('0xc')](0x0,_0x1be794);_0x2ab238=_0x2ab238[_0x6fbe('0xc')](_0x1be794+_0x439feb['length']);var _0x42a736=_0x2b4489[_0x6fbe('0xd')](_0x120352),_0x3b5763=0x0,_0x419c77={},_0x39f554='',_0x35bf5a='',_0xf5fb06=-0x1;while(_0x42a736[_0x3b5763]){_0xf5fb06=_0x42a736[_0x3b5763][_0x6fbe('0xb')](':');if(_0xf5fb06!=-0x1){_0x39f554=_0x42a736[_0x3b5763]['slice'](0x0,_0xf5fb06)['trim']();_0x35bf5a=_0x42a736[_0x3b5763][_0x6fbe('0xe')](_0xf5fb06+0x1)[_0x6fbe('0xf')]();if(_0x39f554[_0x6fbe('0x10')]>0x0){_0x419c77[_0x39f554]=_0x35bf5a;}}else{}_0x3b5763++;}this['emit'](_0x6fbe('0x11'),_0x419c77);this[_0x6fbe('0x5')]=!![];}_0x5532b3++;}this[_0x6fbe('0x4')]=_0x2ab238;}else{while((_0x1b4712=_0x2ab238[_0x6fbe('0xb')](_0x120352))!=-0x1){_0x2b4489=_0x2ab238[_0x6fbe('0xc')](0x0,_0x1b4712);this[_0x6fbe('0x12')](_0x6fbe('0x13'),_0x2b4489);_0x2ab238=_0x2ab238[_0x6fbe('0xc')](_0x1b4712+_0x120352['length']);}this[_0x6fbe('0x4')]=_0x2ab238;}_0x46b337();};module[_0x6fbe('0x14')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7ace282..688ed2d 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 _0xf6fb=['CreateCmContact','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','jayson/promise','client','then','error','message','result','catch','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','ShowUser','GetContactByPhone','phone','getTrunkById','ShowTrunk','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0xf6fb,0x111));var _0xbf6f=function(_0x2b42dc,_0x37fba8){_0x2b42dc=_0x2b42dc-0x0;var _0x403ace=_0xf6fb[_0x2b42dc];return _0x403ace;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0xbf6f('0x0'));var client=jayson[_0xbf6f('0x1')]['http']({'port':0x2329});function request(_0x270dda,_0x7191f2){return new Promise(function(_0x5709b7,_0xa3eb6){return client['request'](_0x270dda,_0x7191f2)[_0xbf6f('0x2')](function(_0x41f22f){if(_0x41f22f[_0xbf6f('0x3')]){return _0xa3eb6(_0x41f22f[_0xbf6f('0x3')][_0xbf6f('0x4')]);}else{return _0x5709b7(_0x41f22f[_0xbf6f('0x5')]);}})[_0xbf6f('0x6')](function(_0x43d56b){return _0xa3eb6(_0x43d56b);});});}exports['getSquareProjects']=function(){return request(_0xbf6f('0x7'),{'options':{'raw':![],'attributes':['id',_0xbf6f('0x8'),_0xbf6f('0x9')]}});};exports[_0xbf6f('0xa')]=function(_0x283d7e){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x283d7e},'attributes':['production']}});};exports[_0xbf6f('0xb')]=function(_0x42dc5b){return request(_0xbf6f('0xc'),{'options':{'raw':![],'where':{'id':_0x42dc5b},'include':[{'model':'MailServerOut','as':_0xbf6f('0xd'),'include':[{'model':'CloudProvider','as':_0xbf6f('0xe')}]}],'attributes':['id',_0xbf6f('0x8'),_0xbf6f('0xf')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x36133e){return request(_0xbf6f('0x10'),{'options':{'where':{'id':_0x36133e},'attributes':[_0xbf6f('0x8')]}});};exports[_0xbf6f('0x11')]=function(_0xce557a){return request(_0xbf6f('0x12'),{'options':{'where':{'id':_0xce557a},'attributes':['name']}});};exports[_0xbf6f('0x13')]=function(_0x3f1c33){return request(_0xbf6f('0x14'),{'options':{'where':{'id':_0x3f1c33},'attributes':[_0xbf6f('0x8')]}});};exports[_0xbf6f('0x15')]=function(_0x2abe87){return request(_0xbf6f('0x16'),{'options':{'where':{'id':_0x2abe87},'attributes':['dsn']}});};exports['getUserById']=function(_0x734fe8){return request(_0xbf6f('0x17'),{'options':{'where':{'id':_0x734fe8},'attributes':[_0xbf6f('0x8')]}});};exports['getContactByPhone']=function(_0x56b4da){return request(_0xbf6f('0x18'),{'options':{'where':{'phone':_0x56b4da[_0xbf6f('0x19')]},'attributes':['id']}});};exports[_0xbf6f('0x1a')]=function(_0x22e1e9){return request(_0xbf6f('0x1b'),{'options':{'where':{'id':_0x22e1e9},'attributes':['name']}});};exports['getSoundById']=function(_0x23cc46){return request('ShowSound',{'options':{'where':{'id':_0x23cc46},'attributes':[_0xbf6f('0x1c')]}});};exports[_0xbf6f('0x1d')]=function(_0x3cc13c){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3cc13c},'include':[{'model':_0xbf6f('0x1e'),'as':_0xbf6f('0x1f')}]}});};exports[_0xbf6f('0x20')]=function(_0x528bf0){return request(_0xbf6f('0x21'),{'options':{'where':{'id':_0x528bf0},'attributes':['id','name']}});};exports[_0xbf6f('0x22')]=function(_0xb9e8bc){return request(_0xbf6f('0x23'),{'body':_0xb9e8bc});};exports['createSquareDetailsReport']=function(_0x28d8f6){return request(_0xbf6f('0x24'),{'body':_0x28d8f6});};exports[_0xbf6f('0x25')]=function(_0x17fe26){return request(_0xbf6f('0x26'),{'body':_[_0xbf6f('0x27')](_0x17fe26,{'project_name':_0x17fe26['arg_1'],'prev_project_name':_0x17fe26[_0xbf6f('0x28')]||'','is_subproject':_0x17fe26[_0xbf6f('0x28')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x246473){return request('CreateSquareRecording',{'body':_0x246473});};exports[_0xbf6f('0x29')]=function(_0x153304){return request(_0xbf6f('0x2a'),{'body':_0x153304});};exports[_0xbf6f('0x2b')]=function(_0xb440e8){return request(_0xbf6f('0x2c'),{'options':{'raw':![],'where':{'phone':_0xb440e8[_0xbf6f('0x19')],'ListId':_0xb440e8['ListId']}}})['then'](function(_0x1b675a){if(_0x1b675a){return _0x1b675a;}return request(_0xbf6f('0x2d'),{'body':_0xb440e8});});};exports['getPauseById']=function(_0x1fa67c){return request('ShowPause',{'options':{'where':{'id':_0x1fa67c},'attributes':[_0xbf6f('0x8')]}});};exports[_0xbf6f('0x2e')]=function(_0x7f92e9,_0x44f7fe){return request(_0xbf6f('0x2f'),{'body':{'interface':_0x44f7fe},'options':{'where':_0x7f92e9}});};exports[_0xbf6f('0x30')]=function(_0x3200a4,_0x6e3471,_0xed5db){return request(_0xbf6f('0x31'),{'body':{'type':_0x6e3471,'uniqueid':_0xed5db},'options':{'where':_0x3200a4}});};exports['agentUnpause']=function(_0x5c994f){return request(_0xbf6f('0x32'),{'body':{},'options':{'where':_0x5c994f}});};exports[_0xbf6f('0x33')]=function(_0x257d36){return request(_0xbf6f('0x34'),{'body':{},'options':{'where':_0x257d36}});}; \ No newline at end of file +var _0xdbd0=['getSmsAccountById','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','then','error','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','getUserById','getContactByPhone','GetContactByPhone','getTrunkById','getSoundById','ShowSound','ShowInterval'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xdbd0,0x88));var _0x0dbd=function(_0x315e0b,_0x2f1f84){_0x315e0b=_0x315e0b-0x0;var _0x3e6173=_0xdbd0[_0x315e0b];return _0x3e6173;};'use strict';var _=require(_0x0dbd('0x0'));var moment=require(_0x0dbd('0x1'));var jayson=require(_0x0dbd('0x2'));var client=jayson[_0x0dbd('0x3')][_0x0dbd('0x4')]({'port':0x2329});function request(_0x58ef9e,_0x3ac5c2){return new Promise(function(_0x190897,_0x1aeffb){return client['request'](_0x58ef9e,_0x3ac5c2)[_0x0dbd('0x5')](function(_0x153856){if(_0x153856[_0x0dbd('0x6')]){return _0x1aeffb(_0x153856[_0x0dbd('0x6')]['message']);}else{return _0x190897(_0x153856['result']);}})[_0x0dbd('0x7')](function(_0x3b3f21){return _0x1aeffb(_0x3b3f21);});});}exports[_0x0dbd('0x8')]=function(){return request(_0x0dbd('0x9'),{'options':{'raw':![],'attributes':['id',_0x0dbd('0xa'),_0x0dbd('0xb')]}});};exports['getSquareProject']=function(_0x55f318){return request(_0x0dbd('0xc'),{'options':{'raw':![],'where':{'name':_0x55f318},'attributes':[_0x0dbd('0xb')]}});};exports[_0x0dbd('0xd')]=function(_0x38d767){return request(_0x0dbd('0xe'),{'options':{'raw':![],'where':{'id':_0x38d767},'include':[{'model':_0x0dbd('0xf'),'as':_0x0dbd('0x10'),'include':[{'model':_0x0dbd('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0x0dbd('0xa'),_0x0dbd('0x12')],'smtp':!![]}});};exports[_0x0dbd('0x13')]=function(_0x59f880){return request(_0x0dbd('0xc'),{'options':{'where':{'id':_0x59f880},'attributes':[_0x0dbd('0xa')]}});};exports[_0x0dbd('0x14')]=function(_0x903a5){return request(_0x0dbd('0x15'),{'options':{'where':{'id':_0x903a5},'attributes':[_0x0dbd('0xa')]}});};exports[_0x0dbd('0x16')]=function(_0xce4a93){return request(_0x0dbd('0x17'),{'options':{'where':{'id':_0xce4a93},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x844503){return request(_0x0dbd('0x18'),{'options':{'where':{'id':_0x844503},'attributes':['dsn']}});};exports[_0x0dbd('0x19')]=function(_0x16ae44){return request('ShowUser',{'options':{'where':{'id':_0x16ae44},'attributes':['name']}});};exports[_0x0dbd('0x1a')]=function(_0x23db13){return request(_0x0dbd('0x1b'),{'options':{'where':{'phone':_0x23db13['phone']},'attributes':['id']}});};exports[_0x0dbd('0x1c')]=function(_0x2a26dd){return request('ShowTrunk',{'options':{'where':{'id':_0x2a26dd},'attributes':['name']}});};exports[_0x0dbd('0x1d')]=function(_0x6c7d3){return request(_0x0dbd('0x1e'),{'options':{'where':{'id':_0x6c7d3},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x1f31a8){return request(_0x0dbd('0x1f'),{'options':{'raw':![],'where':{'id':_0x1f31a8},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x0dbd('0x20')]=function(_0x425ceb){return request('ShowSmsAccount',{'options':{'where':{'id':_0x425ceb},'attributes':['id',_0x0dbd('0xa')]}});};exports[_0x0dbd('0x21')]=function(_0x18edd1){return request('CreateSmsMessage',{'body':_0x18edd1});};exports[_0x0dbd('0x22')]=function(_0x1bbefb){return request('CreateSquareDetailsReport',{'body':_0x1bbefb});};exports[_0x0dbd('0x23')]=function(_0x380ff0){return request(_0x0dbd('0x24'),{'body':_[_0x0dbd('0x25')](_0x380ff0,{'project_name':_0x380ff0[_0x0dbd('0x26')],'prev_project_name':_0x380ff0['arg_2']||'','is_subproject':_0x380ff0[_0x0dbd('0x27')]?!![]:![],'leaveAt':moment()[_0x0dbd('0x28')](_0x0dbd('0x29'))})});};exports[_0x0dbd('0x2a')]=function(_0x445601){return request(_0x0dbd('0x2b'),{'body':_0x445601});};exports['createSquareMessage']=function(_0x5dd8cd){return request('CreateSquareMessage',{'body':_0x5dd8cd});};exports[_0x0dbd('0x2c')]=function(_0x5c6d5e){return request(_0x0dbd('0x2d'),{'options':{'raw':![],'where':{'phone':_0x5c6d5e['phone'],'ListId':_0x5c6d5e['ListId']}}})[_0x0dbd('0x5')](function(_0x193f03){if(_0x193f03){return _0x193f03;}return request(_0x0dbd('0x2e'),{'body':_0x5c6d5e});});};exports[_0x0dbd('0x2f')]=function(_0x50993f){return request(_0x0dbd('0x30'),{'options':{'where':{'id':_0x50993f},'attributes':[_0x0dbd('0xa')]}});};exports[_0x0dbd('0x31')]=function(_0x52b8ee,_0x467d49){return request(_0x0dbd('0x32'),{'body':{'interface':_0x467d49},'options':{'where':_0x52b8ee}});};exports[_0x0dbd('0x33')]=function(_0x3688c6,_0x4e34fa,_0x2d9109){return request(_0x0dbd('0x34'),{'body':{'type':_0x4e34fa,'uniqueid':_0x2d9109},'options':{'where':_0x3688c6}});};exports[_0x0dbd('0x35')]=function(_0x324af5){return request('UnpauseUser',{'body':{},'options':{'where':_0x324af5}});};exports[_0x0dbd('0x36')]=function(_0x20d062){return request(_0x0dbd('0x37'),{'body':{},'options':{'where':_0x20d062}});}; \ 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 9fbe678..eb77ae4 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 _0x1261=['./lex','exports'];(function(_0x28a12c,_0x1a842a){var _0xdd3065=function(_0x5a84af){while(--_0x5a84af){_0x28a12c['push'](_0x28a12c['shift']());}};_0xdd3065(++_0x1a842a);}(_0x1261,0x144));var _0x1126=function(_0x253bd2,_0x4e88ff){_0x253bd2=_0x253bd2-0x0;var _0x457ff9=_0x1261[_0x253bd2];return _0x457ff9;};var polly=require('./polly');var lex=require(_0x1126('0x0'));module[_0x1126('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7ad3=['./polly','./lex','exports'];(function(_0x42b921,_0x41b95e){var _0x5ba089=function(_0xd293e7){while(--_0xd293e7){_0x42b921['push'](_0x42b921['shift']());}};_0x5ba089(++_0x41b95e);}(_0x7ad3,0x108));var _0x37ad=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x7ad3[_0x4ded65];return _0x5864fb;};var polly=require(_0x37ad('0x0'));var lex=require(_0x37ad('0x1'));module[_0x37ad('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 0e2f118..0a55ecc 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 _0xb4e6=['./lib/api'];(function(_0x268ad0,_0x50c35b){var _0x4619ea=function(_0x51b35f){while(--_0x51b35f){_0x268ad0['push'](_0x268ad0['shift']());}};_0x4619ea(++_0x50c35b);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0xb4e6[_0x4d6ac0];return _0x5296c4;};'use strict';var lex=require(_0x6b4e('0x0'));module['exports']=function(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad){return lex(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad);}; \ No newline at end of file +var _0x2dae=['./lib/api'];(function(_0x31cdf3,_0x4f2183){var _0x5623f8=function(_0x4377bc){while(--_0x4377bc){_0x31cdf3['push'](_0x31cdf3['shift']());}};_0x5623f8(++_0x4f2183);}(_0x2dae,0xc3));var _0xe2da=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2dae[_0x5bd426];return _0x23a7eb;};'use strict';var lex=require(_0xe2da('0x0'));module['exports']=function(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97){return lex(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97);}; \ 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 ab97eda..02b70c8 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(_0x1500c1,_0x9c60f8){var _0x2d589d=function(_0x4990f0){while(--_0x4990f0){_0x1500c1['push'](_0x1500c1['shift']());}};_0x2d589d(++_0x9c60f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x1e2048,_0x417fc4){var _0x4da807=function(_0x5dbebf){while(--_0x5dbebf){_0x1e2048['push'](_0x1e2048['shift']());}};_0x4da807(++_0x417fc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 185fc82..0de930d 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 _0x3e29=['exports','./lib/api'];(function(_0x480b65,_0x46f86c){var _0x28b0a9=function(_0x4f69d3){while(--_0x4f69d3){_0x480b65['push'](_0x480b65['shift']());}};_0x28b0a9(++_0x46f86c);}(_0x3e29,0x93));var _0x93e2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3e29[_0xa464c9];return _0x3d73c4;};'use strict';var polly=require(_0x93e2('0x0'));module[_0x93e2('0x1')]=function(_0x182d4b,_0x54535b,_0x4e9be3,_0x447d44,_0x15f96b,_0x5de495,_0x458047){return polly(_0x182d4b,_0x54535b,_0x4e9be3,_0x447d44,_0x15f96b,_0x5de495,_0x458047);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x1f8c1c,_0x2a1cf7,_0x3228be,_0x135c37,_0x477a26,_0x3d52a3,_0x4e37f2){return polly(_0x1f8c1c,_0x2a1cf7,_0x3228be,_0x135c37,_0x477a26,_0x3d52a3,_0x4e37f2);}; \ 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 6293857..eed3684 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 _0x5fa4=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3'];(function(_0x1f7731,_0x3cecb3){var _0x3c8494=function(_0x447143){while(--_0x447143){_0x1f7731['push'](_0x1f7731['shift']());}};_0x3c8494(++_0x3cecb3);}(_0x5fa4,0x78));var _0x45fa=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5fa4[_0x1facfa];return _0x9ec701;};'use strict';var fs=require('fs');var path=require(_0x45fa('0x0'));var BPromise=require(_0x45fa('0x1'));var rs=require(_0x45fa('0x2'));var AWS=require(_0x45fa('0x3'));function pollyResult(_0x3e1579,_0x3ab464,_0x24eee1){return new BPromise(function(_0x1bf27f,_0x14ee9d){_0x3e1579[_0x45fa('0x4')](_0x3ab464,function(_0x545273,_0x1ee4a9){if(_0x545273){_0x14ee9d(_0x545273);}else if(_0x1ee4a9){if(_0x1ee4a9[_0x45fa('0x5')]instanceof Buffer){fs['writeFile'](_0x24eee1,_0x1ee4a9[_0x45fa('0x5')],function(_0x3abc13){if(_0x3abc13){_0x14ee9d(_0x3abc13);}else{_0x1bf27f();}});}else{_0x14ee9d(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x14ee9d(new Error(_0x45fa('0x6')));}});});}module[_0x45fa('0x7')]=function(_0x55d1e0,_0x5afa8e,_0xd50fe8,_0x172918,_0x47fdb0,_0x277fcb,_0x3dd781){var _0xeb8789=new AWS[(_0x45fa('0x8'))]({'accessKeyId':_0x55d1e0,'secretAccessKey':_0x5afa8e,'region':_0xd50fe8});var _0x4c58b3={'Text':_0x47fdb0,'TextType':_0x277fcb||'text','OutputFormat':_0x45fa('0x9'),'VoiceId':_0x172918};return pollyResult(_0xeb8789,_0x4c58b3,_0x3dd781);}; \ No newline at end of file +var _0x9931=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','randomstring','aws-sdk','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3e4847,_0x46b8cb){var _0x431bf3=function(_0x159197){while(--_0x159197){_0x3e4847['push'](_0x3e4847['shift']());}};_0x431bf3(++_0x46b8cb);}(_0x9931,0x176));var _0x1993=function(_0x51ae9e,_0x104e3a){_0x51ae9e=_0x51ae9e-0x0;var _0x4ed907=_0x9931[_0x51ae9e];return _0x4ed907;};'use strict';var fs=require('fs');var path=require(_0x1993('0x0'));var BPromise=require(_0x1993('0x1'));var rs=require(_0x1993('0x2'));var AWS=require(_0x1993('0x3'));function pollyResult(_0x43a7c6,_0x5ed84e,_0x1e5212){return new BPromise(function(_0x2b62d3,_0x46b938){_0x43a7c6['synthesizeSpeech'](_0x5ed84e,function(_0xe2642f,_0x6ad7c8){if(_0xe2642f){_0x46b938(_0xe2642f);}else if(_0x6ad7c8){if(_0x6ad7c8['AudioStream']instanceof Buffer){fs[_0x1993('0x4')](_0x1e5212,_0x6ad7c8['AudioStream'],function(_0x450263){if(_0x450263){_0x46b938(_0x450263);}else{_0x2b62d3();}});}else{_0x46b938(new Error(_0x1993('0x5')));}}else{_0x46b938(new Error(_0x1993('0x6')));}});});}module[_0x1993('0x7')]=function(_0x5d8d90,_0x523a43,_0x49f543,_0x523e32,_0x270e74,_0xe65407,_0x4b96c1){var _0x21bfde=new AWS[(_0x1993('0x8'))]({'accessKeyId':_0x5d8d90,'secretAccessKey':_0x523a43,'region':_0x49f543});var _0x4d049a={'Text':_0x270e74,'TextType':_0xe65407||'text','OutputFormat':_0x1993('0x9'),'VoiceId':_0x523e32};return pollyResult(_0x21bfde,_0x4d049a,_0x4b96c1);}; \ 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 ee83409..2561513 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 _0x8d9a=['./lib/api'];(function(_0x5c5a56,_0x53005b){var _0x52e32a=function(_0x3964a5){while(--_0x3964a5){_0x5c5a56['push'](_0x5c5a56['shift']());}};_0x52e32a(++_0x53005b);}(_0x8d9a,0xa3));var _0xa8d9=function(_0x1ef7ae,_0x30ad20){_0x1ef7ae=_0x1ef7ae-0x0;var _0x5b0fa9=_0x8d9a[_0x1ef7ae];return _0x5b0fa9;};'use strict';var asr=require(_0xa8d9('0x0'));module['exports']=function(_0x161df6,_0x404548,_0x5004b7,_0x1238a5){return asr(_0x161df6,_0x404548,_0x5004b7);}; \ No newline at end of file +var _0x3986=['exports'];(function(_0x4b87bf,_0x546379){var _0x1b17e7=function(_0x4d07b1){while(--_0x4d07b1){_0x4b87bf['push'](_0x4b87bf['shift']());}};_0x1b17e7(++_0x546379);}(_0x3986,0x1cb));var _0x6398=function(_0x186869,_0x3a3074){_0x186869=_0x186869-0x0;var _0x1bddbb=_0x3986[_0x186869];return _0x1bddbb;};'use strict';var asr=require('./lib/api');module[_0x6398('0x0')]=function(_0x172fa3,_0x5b0e86,_0x42cd00,_0x194151){return asr(_0x172fa3,_0x5b0e86,_0x42cd00);}; \ 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 8d083dc..8c949bc 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 _0xa75b=['toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0x16c1d9,_0x2a1270){var _0x85293b=function(_0x2c3479){while(--_0x2c3479){_0x16c1d9['push'](_0x16c1d9['shift']());}};_0x85293b(++_0x2a1270);}(_0xa75b,0x170));var _0xba75=function(_0x113778,_0x190651){_0x113778=_0x113778-0x0;var _0x3501be=_0xa75b[_0x113778];return _0x3501be;};'use strict';var url=require(_0xba75('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xba75('0x1')]=function(_0x39dc19,_0x17b666,_0x3cde96){return new BPromise(function(_0x1760c0,_0x336606){var _0x152269;if(typeof _0x39dc19!==_0xba75('0x2')||_0x39dc19[_0xba75('0x3')]===0x0){return _0x336606(_0xba75('0x4'));}if(typeof _0x17b666!==_0xba75('0x2')||_0x17b666[_0xba75('0x3')]===0x0){return _0x336606(_0xba75('0x5'));}if(typeof _0x3cde96!=='undefined'&&(typeof _0x3cde96!=='string'||_0x3cde96[_0xba75('0x3')]===0x0)){return _0x336606('lang\x20should\x20be\x20a\x20string');}try{_0x152269=fs['readFileSync'](_0x39dc19)[_0xba75('0x6')]('base64');}catch(_0x2e8905){return _0x336606(_0x2e8905);}return _0x1760c0({'method':_0xba75('0x7'),'uri':host+_0xba75('0x8')+_0x17b666,'body':{'config':{'encoding':_0xba75('0x9'),'sampleRateHertz':_0xba75('0xa'),'languageCode':_0x3cde96},'audio':{'content':_0x152269}},'json':!![]});});}; \ No newline at end of file +var _0xf2cb=['string','undefined','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x148fc9,_0x235cbf){var _0x539562=function(_0x3ed1a7){while(--_0x3ed1a7){_0x148fc9['push'](_0x148fc9['shift']());}};_0x539562(++_0x235cbf);}(_0xf2cb,0x130));var _0xbf2c=function(_0x95cfc,_0x3a2760){_0x95cfc=_0x95cfc-0x0;var _0x31dbfc=_0xf2cb[_0x95cfc];return _0x31dbfc;};'use strict';var url=require('url');var BPromise=require(_0xbf2c('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xbf2c('0x1')]=function(_0x4cc874,_0x424f04,_0x5a97a1){return new BPromise(function(_0x1ecb79,_0x41c649){var _0x5abeb3;if(typeof _0x4cc874!=='string'||_0x4cc874[_0xbf2c('0x2')]===0x0){return _0x41c649(_0xbf2c('0x3'));}if(typeof _0x424f04!==_0xbf2c('0x4')||_0x424f04[_0xbf2c('0x2')]===0x0){return _0x41c649('key\x20should\x20be\x20a\x20string');}if(typeof _0x5a97a1!==_0xbf2c('0x5')&&(typeof _0x5a97a1!=='string'||_0x5a97a1[_0xbf2c('0x2')]===0x0)){return _0x41c649('lang\x20should\x20be\x20a\x20string');}try{_0x5abeb3=fs['readFileSync'](_0x4cc874)[_0xbf2c('0x6')](_0xbf2c('0x7'));}catch(_0xeb0e9d){return _0x41c649(_0xeb0e9d);}return _0x1ecb79({'method':'POST','uri':host+_0xbf2c('0x8')+_0x424f04,'body':{'config':{'encoding':_0xbf2c('0x9'),'sampleRateHertz':_0xbf2c('0xa'),'languageCode':_0x5a97a1},'audio':{'content':_0x5abeb3}},'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 01e30ed..cb05ade 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 _0xfd46=['exports'];(function(_0x20839f,_0x18e424){var _0xfd5ccc=function(_0x3e14d3){while(--_0x3e14d3){_0x20839f['push'](_0x20839f['shift']());}};_0xfd5ccc(++_0x18e424);}(_0xfd46,0x91));var _0x6fd4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xfd46[_0x53ccf2];return _0x5a2964;};var asr=require('./asr');module[_0x6fd4('0x0')]={'asr':asr}; \ No newline at end of file +var _0xee3c=['exports','./asr'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xee3c,0x69));var _0xcee3=function(_0x191157,_0x2ba8a0){_0x191157=_0x191157-0x0;var _0x2b9cbe=_0xee3c[_0x191157];return _0x2b9cbe;};var asr=require(_0xcee3('0x0'));module[_0xcee3('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 4ebebf7..525d62a 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 _0xdeb5=['f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','name','isFallback','languageCode','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','Data','audiofile','dirName','apiai-promise','bluebird','http','md5','path','querystring','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','generate','.wav','writeFileSync','base64','unlink','chmodSync','777','split','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','POST','then','resolve','tmp','from','audioContent','writeFile','info','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded'];(function(_0x290cd8,_0x465308){var _0x4c78cf=function(_0x5a4d3d){while(--_0x5a4d3d){_0x290cd8['push'](_0x290cd8['shift']());}};_0x4c78cf(++_0x465308);}(_0xdeb5,0x14f));var _0x5deb=function(_0x2135a9,_0x54418e){_0x2135a9=_0x2135a9-0x0;var _0x360f6a=_0xdeb5[_0x2135a9];return _0x360f6a;};'use strict';var apiai=require(_0x5deb('0x0'));var BPromise=require(_0x5deb('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x5deb('0x2'));var https=require('https');var md5=require(_0x5deb('0x3'));var path=require(_0x5deb('0x4'));var querystring=require(_0x5deb('0x5'));var rp=require('request-promise');var rs=require('randomstring');var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x5deb('0x6'))[_0x5deb('0x7')];var util=require(_0x5deb('0x8'));var aws=require(_0x5deb('0x9'));var google=require(_0x5deb('0xa'));var sestek=require(_0x5deb('0xb'));var tilde=require(_0x5deb('0xc'));var logger=require(_0x5deb('0xd'))(_0x5deb('0xe'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x25fa5d,_0x2f7893){return new BPromise(function(_0xedf6cd,_0x5e69e2){var _0x517288=urlParse(_0x25fa5d);var _0x3c920e=_0x517288[_0x5deb('0xf')]===_0x5deb('0x10')?https:http;var _0x325111={'host':_0x517288[_0x5deb('0x11')],'path':_0x517288[_0x5deb('0x4')],'headers':{'user-agent':_0x5deb('0x12')}};_0x3c920e[_0x5deb('0x13')](_0x325111,function(_0x12145a){if(_0x12145a[_0x5deb('0x14')]!==0xc8){logger[_0x5deb('0x15')](_0x5deb('0x16')+_0x25fa5d+_0x5deb('0x17')+_0x12145a[_0x5deb('0x14')]+'\x20('+_0x12145a['statusMessage']+')');_0x5e69e2(new Error(_0x5deb('0x16')+_0x25fa5d+_0x5deb('0x17')+_0x12145a[_0x5deb('0x14')]+'\x20('+_0x12145a[_0x5deb('0x18')]+')'));return;}var _0x2d2344=fs['createWriteStream'](_0x2f7893);_0x2d2344['on'](_0x5deb('0x19'),function(){logger['info'](_0x5deb('0x1a'));_0x2d2344[_0x5deb('0x1b')](_0xedf6cd);});_0x2d2344['on'](_0x5deb('0x15'),function(_0x410afc){fs['unlink'](_0x2f7893);logger[_0x5deb('0x15')](_0x5deb('0x1c'),_0x410afc);_0x5e69e2(_0x410afc);});_0x12145a[_0x5deb('0x1d')](_0x2d2344);})['on'](_0x5deb('0x15'),function(_0x2c0b37){logger['error'](_0x2c0b37);_0x5e69e2(_0x2c0b37);})[_0x5deb('0x1e')]();});}function uploadFile(_0x5f33f2){return new BPromise(function(_0x47ba54,_0x2b1991){var _0x295a15=urlParse(_0x5f33f2);var _0x2a3643=_0x295a15['protocol']===_0x5deb('0x10')?https:http;var _0x557c82={'host':_0x295a15[_0x5deb('0x11')],'path':_0x295a15[_0x5deb('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x2a3643['get'](_0x557c82,function(_0x52b45f){if(_0x52b45f[_0x5deb('0x14')]!==0xc8){_0x2b1991(new Error(_0x5deb('0x16')+_0x5f33f2+_0x5deb('0x17')+_0x52b45f[_0x5deb('0x14')]+'\x20('+_0x52b45f['statusMessage']+')'));return;}var _0x1f26c6='';_0x52b45f['on'](_0x5deb('0x1f'),function(_0x1c86f5){_0x1f26c6+=_0x1c86f5;});_0x52b45f['on'](_0x5deb('0x1e'),function(){_0x47ba54(_0x1f26c6);});})['on'](_0x5deb('0x15'),function(_0x3f3227){_0x2b1991(_0x3f3227);})['end']();});}function convertFile(_0x5e43cf,_0x15742f){return new BPromise(function(_0x55584f,_0x49f429){var _0x20232a=sox[_0x5deb('0x20')](_0x5e43cf,_0x15742f,{'sampleRate':0x1f40,'format':_0x5deb('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x20232a['on'](_0x5deb('0x15'),function(_0xefeb16){logger[_0x5deb('0x15')](_0x5deb('0x22'),_0xefeb16);_0x49f429(_0xefeb16);});_0x20232a['on'](_0x5deb('0x1e'),function(){logger['info'](_0x5deb('0x23'));_0x55584f();});_0x20232a[_0x5deb('0x24')]();});}function base64Decode(_0x2d491c,_0xdac44e){var _0x55e743=path['resolve'](__dirname,'tmp',rs[_0x5deb('0x25')](0x4)+_0x5deb('0x26'));fs[_0x5deb('0x27')](_0x55e743,_0x2d491c,_0x5deb('0x28'));return convertFile(_0x55e743,_0xdac44e)['then'](function(){try{fs[_0x5deb('0x29')](_0x55e743);fs[_0x5deb('0x2a')](_0xdac44e,_0x5deb('0x2b'));}catch(_0x1185a5){logger[_0x5deb('0x15')](_0x1185a5);}return _0xdac44e[_0x5deb('0x2c')]('.')[0x0];});}function base64Encode(_0x45ada3){var _0xff7565=fs['readFileSync'](_0x45ada3);return new Buffer(_0xff7565)[_0x5deb('0x2d')](_0x5deb('0x28'));}exports[_0x5deb('0x2e')]=function(_0x27074f,_0x446f43,_0x34dc3e,_0x19d31b,_0x66050d,_0x42b0e7){var _0x1408c2,_0x29bc72;var _0x23296c='https://texttospeech.googleapis.com/v1/';var _0x28e6cd=_0x5deb('0x2f')+_0x27074f;var _0x16771c={};if(_0x446f43===_0x5deb('0x30')){_0x16771c[_0x5deb('0x31')]={'ssml':_0x34dc3e};}else{_0x16771c[_0x5deb('0x31')]={'text':_0x34dc3e};};_0x16771c[_0x5deb('0x32')]={'languageCode':_0x19d31b,'ssmlGender':_0x66050d};_0x16771c[_0x5deb('0x33')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x31f341={'url':_0x23296c+'text:synthesize'+_0x28e6cd,'method':_0x5deb('0x34'),'json':!![],'body':_0x16771c};return rp(_0x31f341)[_0x5deb('0x35')](function(_0x51523f){return new BPromise(function(_0xcb6ee2,_0x32b9f0){_0x1408c2=path[_0x5deb('0x36')](__dirname,_0x5deb('0x37'),rs[_0x5deb('0x25')](0x4)+'.mp3');var _0x4be634=Buffer[_0x5deb('0x38')](_0x51523f[_0x5deb('0x39')],_0x5deb('0x28'));return fs[_0x5deb('0x3a')](_0x1408c2,_0x4be634,function(_0x4900f7){_0x32b9f0(_0x4900f7);},function(_0x25c533){fs['chmodSync'](_0x1408c2,_0x5deb('0x2b'));_0xcb6ee2(_0x25c533);});});})['then'](function(_0x516475){_0x29bc72=path['resolve'](__dirname,'tmp',rs[_0x5deb('0x25')](0x4)+'.wav');return convertFile(_0x1408c2,_0x29bc72);})[_0x5deb('0x35')](function(){try{fs[_0x5deb('0x29')](_0x1408c2);fs[_0x5deb('0x2a')](_0x29bc72,_0x5deb('0x2b'));}catch(_0x139e27){logger[_0x5deb('0x15')](_0x139e27);}logger[_0x5deb('0x3b')](_0x5deb('0x3c'),_0x29bc72[_0x5deb('0x2c')]('.')[0x0]);return _0x29bc72[_0x5deb('0x2c')]('.')[0x0];});};exports[_0x5deb('0x3d')]=function(_0x5c9fc5,_0x50b2a7){var _0x2d46a2=_0x5deb('0x3e');var _0xa2003d,_0x1a0d6c;var _0x4182c3;var _0x15c07f={'encoding':'utf8','method':_0x5deb('0x34'),'timeout':0x2710,'url':_0x2d46a2,'headers':{'Content-Type':_0x5deb('0x3f')},'body':_0x5deb('0x40')+encodeURIComponent(JSON[_0x5deb('0x41')]([[[_0x5deb('0x42'),JSON[_0x5deb('0x41')]([_0x5c9fc5,_0x50b2a7||'en',![],'null']),null,_0x5deb('0x43')]]]))};return rp(_0x15c07f)[_0x5deb('0x35')](function(_0x3cc175){try{_0x4182c3=eval(_0x3cc175[_0x5deb('0x44')](0x5))[0x0][0x2];}catch(_0x221430){throw new Error(_0x5deb('0x45')+_0x3cc175[_0x5deb('0x1f')]);}if(!_0x4182c3){if(_0x5c9fc5[_0x5deb('0x46')]>0xc8){throw new Error(_0x5deb('0x47'));}else{throw new Error('lang\x20\x22'+_0x50b2a7+_0x5deb('0x48'));}}try{_0x4182c3=eval(_0x4182c3)[0x0];}catch(_0x4a651b){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x5deb('0x1f')]);}const _0xf362b=_0x4182c3;_0xa2003d=path[_0x5deb('0x36')](__dirname,_0x5deb('0x37'),rs[_0x5deb('0x25')](0x4)+_0x5deb('0x49'));fs[_0x5deb('0x27')](_0xa2003d,_0x4182c3,{'encoding':_0x5deb('0x28')});_0x1a0d6c=path[_0x5deb('0x36')](__dirname,_0x5deb('0x37'),rs['generate'](0x4)+_0x5deb('0x26'));return convertFile(_0xa2003d,_0x1a0d6c);})['then'](function(){try{fs[_0x5deb('0x29')](_0xa2003d);fs[_0x5deb('0x2a')](_0x1a0d6c,_0x5deb('0x2b'));}catch(_0x6effc0){logger[_0x5deb('0x15')](_0x6effc0);}logger['info'](_0x5deb('0x4a'),_0x1a0d6c[_0x5deb('0x2c')]('.')[0x0]);return _0x1a0d6c[_0x5deb('0x2c')]('.')[0x0];});};exports[_0x5deb('0x4b')]=function(_0x5417ac,_0x1b36c6,_0x55c4da){return google[_0x5deb('0x4c')](_0x5417ac,_0x1b36c6,_0x55c4da)['then'](function(_0x1888bf){logger[_0x5deb('0x3b')](_0x1888bf[_0x5deb('0x4d')]);return rp(_0x1888bf);})['then'](function(_0x5bd12a){var _0x257076='';var _0x215dc6=0x0;try{fs[_0x5deb('0x29')](_0x5417ac);}catch(_0x385c8d){logger[_0x5deb('0x15')](_0x385c8d);}if(_0x5bd12a&&_0x5bd12a[_0x5deb('0x4e')]){_0x257076=_0x5bd12a[_0x5deb('0x4e')]['map'](function(_0x55623f){return _0x55623f&&_0x55623f[_0x5deb('0x4f')][0x0]&&_0x55623f[_0x5deb('0x4f')][0x0][_0x5deb('0x50')]?_0x55623f[_0x5deb('0x4f')][0x0][_0x5deb('0x50')]:'';})[_0x5deb('0x51')]('\x0a');_0x215dc6=_0x5bd12a[_0x5deb('0x4e')]['map'](function(_0x14a237){return _0x14a237&&_0x14a237[_0x5deb('0x4f')][0x0]&&_0x14a237[_0x5deb('0x4f')][0x0][_0x5deb('0x52')]?_0x14a237[_0x5deb('0x4f')][0x0][_0x5deb('0x52')]:0x0;})[_0x5deb('0x51')]('\x0a');}logger[_0x5deb('0x3b')]('googleASR\x20transcription',_0x257076);logger[_0x5deb('0x3b')](_0x5deb('0x53'),_0x215dc6);return{'transcript':_0x257076,'confidence':_0x215dc6};})[_0x5deb('0x54')](function(_0x7728f6){logger[_0x5deb('0x15')](_0x5deb('0x55'),_0x7728f6[_0x5deb('0x14')],_0x7728f6['name'],_0x7728f6['message']);});};exports[_0x5deb('0x56')]=function(_0x58456b,_0x4d9af1,_0x315e5c,_0x5aa571){var _0x5192c2=apiai(_0x4d9af1,{'language':_0x5aa571||'en'});return _0x5192c2[_0x5deb('0x57')](_0x315e5c,{'sessionId':md5(_0x58456b)})[_0x5deb('0x35')](function(_0x48d0cd){logger[_0x5deb('0x3b')](JSON[_0x5deb('0x41')](_0x48d0cd));return{'source':_0x48d0cd[_0x5deb('0x58')][_0x5deb('0x59')],'resolvedQuery':_0x48d0cd[_0x5deb('0x58')][_0x5deb('0x5a')],'action':_0x48d0cd[_0x5deb('0x58')][_0x5deb('0x5b')],'actionIncomplete':_0x48d0cd['result'][_0x5deb('0x5c')],'speech':_0x48d0cd[_0x5deb('0x58')][_0x5deb('0x5d')][_0x5deb('0x5e')],'score':_0x48d0cd[_0x5deb('0x58')]['score'],'statusCode':_0x48d0cd['status'][_0x5deb('0x5f')],'endConversation':_0x48d0cd[_0x5deb('0x58')][_0x5deb('0x60')][_0x5deb('0x61')]||![],'isFallbackIntent':_0x48d0cd[_0x5deb('0x58')][_0x5deb('0x60')][_0x5deb('0x62')]};});};exports[_0x5deb('0x63')]=function(_0x20817c,_0x2ea112,_0x5c010a,_0x14bc38,_0x56a97f,_0x2c8e66){var _0x39e533=_0x14bc38['replace'](/\\n/g,'\x0a');var _0x520a99={'credentials':{'private_key':_0x39e533,'client_email':_0x5c010a}};var _0x11179f=new dialogflow[(_0x5deb('0x64'))](_0x520a99);var _0x58e02e=_0x11179f[_0x5deb('0x65')](_0x2ea112,md5(_0x20817c));var _0x57e36b={'session':_0x58e02e,'queryInput':{'text':{'text':_0x56a97f,'languageCode':_0x2c8e66}}};return _0x11179f[_0x5deb('0x66')](_0x57e36b)[_0x5deb('0x35')](function(_0x13578f){if(_0x13578f&&_0x13578f[_0x5deb('0x46')]){logger[_0x5deb('0x3b')](_0x5deb('0x67'),JSON['stringify'](_0x13578f));var _0x475ef9=_0x13578f[0x0];if(_0x475ef9){var _0x20708d={'action':_0x475ef9['queryResult'][_0x5deb('0x5b')],'allRequiredParamsPresent':_0x475ef9[_0x5deb('0x68')]['allRequiredParamsPresent'],'endConversation':_0x475ef9[_0x5deb('0x68')]['diagnosticInfo']&&_0x475ef9['queryResult'][_0x5deb('0x69')]['fields']?_0x475ef9[_0x5deb('0x68')][_0x5deb('0x69')][_0x5deb('0x6a')][_0x5deb('0x6b')][_0x5deb('0x6c')]:![],'fulfillmentText':_0x475ef9[_0x5deb('0x68')]['fulfillmentText'],'intentName':_0x475ef9[_0x5deb('0x68')][_0x5deb('0x6d')][_0x5deb('0x6e')],'intentDisplayName':_0x475ef9[_0x5deb('0x68')][_0x5deb('0x6d')]['displayName'],'isFallbackIntent':_0x475ef9['queryResult'][_0x5deb('0x6d')][_0x5deb('0x6f')],'languageCode':_0x475ef9[_0x5deb('0x68')][_0x5deb('0x70')],'queryText':_0x475ef9['queryResult']['queryText'],'responseId':_0x475ef9['responseId'],'score':_0x475ef9['queryResult']['intentDetectionConfidence'],'speech':_0x475ef9[_0x5deb('0x68')][_0x5deb('0x71')],'providerResponse':JSON[_0x5deb('0x41')](_0x13578f)};return _0x20708d;}}});};exports[_0x5deb('0x72')]=function(_0x2cfd01,_0x54b40b,_0x29c816,_0x2c5e6e){return tilde[_0x5deb('0x4c')](_0x2cfd01,_0x54b40b,_0x29c816,_0x2c5e6e)[_0x5deb('0x35')](function(_0x2cfda0){try{fs[_0x5deb('0x29')](_0x2cfd01);}catch(_0xd2bbb7){logger[_0x5deb('0x15')](_0xd2bbb7);}logger[_0x5deb('0x3b')](_0x5deb('0x73'),_0x2cfda0[_0x5deb('0x50')]);logger[_0x5deb('0x3b')]('Tilde\x20ASR\x20confidence',_0x2cfda0[_0x5deb('0x52')]);return _0x2cfda0;});};exports[_0x5deb('0x74')]=function(_0x1f96cd,_0x671b57,_0x396aca,_0x50dfb6,_0x47fe01,_0x529caa){var _0x559386=path[_0x5deb('0x36')](__dirname,_0x5deb('0x37'),rs[_0x5deb('0x25')](0x4)+_0x5deb('0x49'));var _0x1278cc;return aws[_0x5deb('0x75')](_0x1f96cd,_0x671b57,_0x396aca,_0x50dfb6,_0x47fe01,_0x529caa,_0x559386)[_0x5deb('0x35')](function(){_0x1278cc=path['resolve'](__dirname,_0x5deb('0x37'),rs[_0x5deb('0x25')](0x4)+_0x5deb('0x26'));return convertFile(_0x559386,_0x1278cc);})[_0x5deb('0x35')](function(){try{fs[_0x5deb('0x29')](_0x559386);fs[_0x5deb('0x2a')](_0x1278cc,_0x5deb('0x2b'));}catch(_0xf1dff8){logger['error'](_0xf1dff8);}return _0x1278cc['split']('.')[0x0];});};exports['awsLex']=function(_0x174636,_0x1b301e,_0x3f33ad,_0x3e89dc,_0x208771,_0x4f66d0){return aws[_0x5deb('0x76')](_0x174636,_0x1b301e,_0x3f33ad,_0x3e89dc,_0x208771,_0x4f66d0)[_0x5deb('0x35')](function(_0x31a2f0){logger['info'](JSON[_0x5deb('0x41')](_0x31a2f0));return _0x31a2f0;});};exports[_0x5deb('0x77')]=function(_0x1250e8,_0xa5139,_0x2338b7,_0x1e23c8){var _0x3de044=util['format'](_0x5deb('0x78'),ISPEECH_API,_0x1250e8,encodeURIComponent(_0xa5139),_0x2338b7,_0x1e23c8);var _0x477bb9=path[_0x5deb('0x36')](__dirname,'tmp',rs[_0x5deb('0x25')](0x4)+_0x5deb('0x49'));var _0x3282f1;return downloadFile(_0x3de044,_0x477bb9)[_0x5deb('0x35')](function(){_0x3282f1=path[_0x5deb('0x36')](__dirname,'tmp',rs['generate'](0x4)+_0x5deb('0x26'));return convertFile(_0x477bb9,_0x3282f1);})[_0x5deb('0x35')](function(){try{fs[_0x5deb('0x29')](_0x477bb9);fs[_0x5deb('0x2a')](_0x3282f1,'777');}catch(_0x53558a){logger[_0x5deb('0x15')](_0x53558a);}return _0x3282f1['split']('.')[0x0];});};exports['ispeechASR']=function(_0x744075,_0x3507fe,_0x5149c6,_0x49814d){var _0x4a0165=util[_0x5deb('0x79')](_0x5deb('0x7a'),ISPEECH_API,_0x3507fe,_0x5149c6,base64Encode(_0x744075),_0x49814d?util[_0x5deb('0x79')](_0x5deb('0x7b'),encodeURIComponent(_0x49814d)):_0x5deb('0x7c'));return uploadFile(_0x4a0165)[_0x5deb('0x35')](function(_0x2712a8){return querystring['parse'](_0x2712a8);});};exports[_0x5deb('0x7d')]=function(_0x1134a8,_0x58f6fd){return sestek[_0x5deb('0x7e')](_0x1134a8,_0x58f6fd)[_0x5deb('0x35')](function(_0x5067a3){logger[_0x5deb('0x3b')](JSON[_0x5deb('0x41')](_0x5067a3));var _0x4f71b9={'speech':_0x5067a3[_0x5deb('0x7f')],'action':_0x5067a3['channelData']?_0x5067a3[_0x5deb('0x80')][_0x5deb('0x81')]:undefined,'actiondata':_0x5067a3[_0x5deb('0x80')]?_0x5067a3[_0x5deb('0x80')]['CustomActionData']:undefined};if(_0x5067a3[_0x5deb('0x80')]&&_0x5067a3[_0x5deb('0x80')]['AudioFromTts']){return base64Decode(_0x5067a3[_0x5deb('0x80')]['AudioFromTts'][_0x5deb('0x82')],path[_0x5deb('0x36')](__dirname,_0x5deb('0x37'),rs[_0x5deb('0x25')](0x4)+'.wav'))['then'](function(_0x3cd370){_0x4f71b9[_0x5deb('0x83')]=_0x3cd370;return _0x4f71b9;});}return _0x4f71b9;});};exports[_0x5deb('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0x6b99=['\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','pipe','end','host','WHAT_EVER','transcode','wav','error\x20convert','start','resolve','base64','then','chmodSync','777','readFileSync','googleCloudTTS','?key=','input','voice','audioConfig','MP3','tmp','generate','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','writeFileSync','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','score','code','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','apiai-promise','dialogflow','http','https','path','querystring','request-promise','randomstring','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','get','statusCode','error'];(function(_0x42e92e,_0x1330f1){var _0x5c5456=function(_0x279322){while(--_0x279322){_0x42e92e['push'](_0x42e92e['shift']());}};_0x5c5456(++_0x1330f1);}(_0x6b99,0x70));var _0x96b9=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x6b99[_0x1da527];return _0x40fc7c;};'use strict';var apiai=require(_0x96b9('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x96b9('0x1'));var fs=require('fs');var http=require(_0x96b9('0x2'));var https=require(_0x96b9('0x3'));var md5=require('md5');var path=require(_0x96b9('0x4'));var querystring=require(_0x96b9('0x5'));var rp=require(_0x96b9('0x6'));var rs=require(_0x96b9('0x7'));var sox=require('sox');var tts=require(_0x96b9('0x8'));var urlParse=require(_0x96b9('0x9'))[_0x96b9('0xa')];var util=require('util');var aws=require(_0x96b9('0xb'));var google=require(_0x96b9('0xc'));var sestek=require(_0x96b9('0xd'));var tilde=require(_0x96b9('0xe'));var logger=require(_0x96b9('0xf'))(_0x96b9('0x10'));var ISPEECH_API=_0x96b9('0x11');function downloadFile(_0x1af1b1,_0x13b30f){return new BPromise(function(_0x31e70e,_0x182a71){var _0x4efe00=urlParse(_0x1af1b1);var _0x135355=_0x4efe00['protocol']===_0x96b9('0x12')?https:http;var _0x37e8fc={'host':_0x4efe00['host'],'path':_0x4efe00[_0x96b9('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x135355[_0x96b9('0x13')](_0x37e8fc,function(_0x5bceeb){if(_0x5bceeb[_0x96b9('0x14')]!==0xc8){logger[_0x96b9('0x15')]('request\x20to\x20'+_0x1af1b1+_0x96b9('0x16')+_0x5bceeb[_0x96b9('0x14')]+'\x20('+_0x5bceeb[_0x96b9('0x17')]+')');_0x182a71(new Error('request\x20to\x20'+_0x1af1b1+'\x20failed,\x20status\x20code\x20=\x20'+_0x5bceeb['statusCode']+'\x20('+_0x5bceeb[_0x96b9('0x17')]+')'));return;}var _0x4882b1=fs[_0x96b9('0x18')](_0x13b30f);_0x4882b1['on'](_0x96b9('0x19'),function(){logger[_0x96b9('0x1a')]('finish\x20download\x20file');_0x4882b1[_0x96b9('0x1b')](_0x31e70e);});_0x4882b1['on'](_0x96b9('0x15'),function(_0x1e3aec){fs[_0x96b9('0x1c')](_0x13b30f);logger[_0x96b9('0x15')]('download\x20error',_0x1e3aec);_0x182a71(_0x1e3aec);});_0x5bceeb[_0x96b9('0x1d')](_0x4882b1);})['on'](_0x96b9('0x15'),function(_0x1f267c){logger[_0x96b9('0x15')](_0x1f267c);_0x182a71(_0x1f267c);})[_0x96b9('0x1e')]();});}function uploadFile(_0x448a7c){return new BPromise(function(_0xd12864,_0x145524){var _0x1563dc=urlParse(_0x448a7c);var _0x35f154=_0x1563dc['protocol']==='https:'?https:http;var _0x245f32={'host':_0x1563dc[_0x96b9('0x1f')],'path':_0x1563dc[_0x96b9('0x4')],'headers':{'user-agent':_0x96b9('0x20')}};_0x35f154[_0x96b9('0x13')](_0x245f32,function(_0x245d66){if(_0x245d66['statusCode']!==0xc8){_0x145524(new Error('request\x20to\x20'+_0x448a7c+_0x96b9('0x16')+_0x245d66['statusCode']+'\x20('+_0x245d66[_0x96b9('0x17')]+')'));return;}var _0x1f7fbf='';_0x245d66['on']('data',function(_0x292f42){_0x1f7fbf+=_0x292f42;});_0x245d66['on'](_0x96b9('0x1e'),function(){_0xd12864(_0x1f7fbf);});})['on'](_0x96b9('0x15'),function(_0x4c2323){_0x145524(_0x4c2323);})[_0x96b9('0x1e')]();});}function convertFile(_0x27fdf7,_0x8adfd4){return new BPromise(function(_0x2fa943,_0x16fa51){var _0xf61459=sox[_0x96b9('0x21')](_0x27fdf7,_0x8adfd4,{'sampleRate':0x1f40,'format':_0x96b9('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf61459['on']('error',function(_0x283f54){logger[_0x96b9('0x15')](_0x96b9('0x23'),_0x283f54);_0x16fa51(_0x283f54);});_0xf61459['on']('end',function(){logger[_0x96b9('0x1a')]('finish\x20to\x20convert');_0x2fa943();});_0xf61459[_0x96b9('0x24')]();});}function base64Decode(_0xd2383a,_0x220488){var _0x5e1332=path[_0x96b9('0x25')](__dirname,'tmp',rs['generate'](0x4)+'.wav');fs['writeFileSync'](_0x5e1332,_0xd2383a,_0x96b9('0x26'));return convertFile(_0x5e1332,_0x220488)[_0x96b9('0x27')](function(){try{fs[_0x96b9('0x1c')](_0x5e1332);fs[_0x96b9('0x28')](_0x220488,_0x96b9('0x29'));}catch(_0x23eb8f){logger[_0x96b9('0x15')](_0x23eb8f);}return _0x220488['split']('.')[0x0];});}function base64Encode(_0x62bcce){var _0x20454b=fs[_0x96b9('0x2a')](_0x62bcce);return new Buffer(_0x20454b)['toString'](_0x96b9('0x26'));}exports[_0x96b9('0x2b')]=function(_0x565de9,_0x52433a,_0x222be9,_0x31f306,_0x40ce57,_0x160dd3){var _0x234d27,_0x378b1d;var _0x272891='https://texttospeech.googleapis.com/v1/';var _0x25110c=_0x96b9('0x2c')+_0x565de9;var _0x102792={};if(_0x52433a==='ssml'){_0x102792[_0x96b9('0x2d')]={'ssml':_0x222be9};}else{_0x102792[_0x96b9('0x2d')]={'text':_0x222be9};};_0x102792[_0x96b9('0x2e')]={'languageCode':_0x31f306,'ssmlGender':_0x40ce57};_0x102792[_0x96b9('0x2f')]={'audioEncoding':_0x96b9('0x30'),'sampleRateHertz':0x1f40};var _0x403231={'url':_0x272891+'text:synthesize'+_0x25110c,'method':'POST','json':!![],'body':_0x102792};return rp(_0x403231)[_0x96b9('0x27')](function(_0x23eb22){return new BPromise(function(_0x1710de,_0x233a04){_0x234d27=path[_0x96b9('0x25')](__dirname,_0x96b9('0x31'),rs[_0x96b9('0x32')](0x4)+_0x96b9('0x33'));var _0x140fe1=Buffer[_0x96b9('0x34')](_0x23eb22[_0x96b9('0x35')],_0x96b9('0x26'));return fs[_0x96b9('0x36')](_0x234d27,_0x140fe1,function(_0x4951e5){_0x233a04(_0x4951e5);},function(_0x184d68){fs[_0x96b9('0x28')](_0x234d27,_0x96b9('0x29'));_0x1710de(_0x184d68);});});})[_0x96b9('0x27')](function(_0x480b44){_0x378b1d=path['resolve'](__dirname,_0x96b9('0x31'),rs['generate'](0x4)+_0x96b9('0x37'));return convertFile(_0x234d27,_0x378b1d);})[_0x96b9('0x27')](function(){try{fs[_0x96b9('0x1c')](_0x234d27);fs['chmodSync'](_0x378b1d,_0x96b9('0x29'));}catch(_0x3d276c){logger[_0x96b9('0x15')](_0x3d276c);}logger['info'](_0x96b9('0x38'),_0x378b1d[_0x96b9('0x39')]('.')[0x0]);return _0x378b1d[_0x96b9('0x39')]('.')[0x0];});};exports[_0x96b9('0x3a')]=function(_0x5dd6be,_0x866007){var _0x585542=_0x96b9('0x3b');var _0xe4e08b,_0x76916a;var _0x402894;var _0x2799e6={'encoding':_0x96b9('0x3c'),'method':_0x96b9('0x3d'),'timeout':0x2710,'url':_0x585542,'headers':{'Content-Type':_0x96b9('0x3e')},'body':_0x96b9('0x3f')+encodeURIComponent(JSON['stringify']([[[_0x96b9('0x40'),JSON[_0x96b9('0x41')]([_0x5dd6be,_0x866007||'en',![],_0x96b9('0x42')]),null,_0x96b9('0x43')]]]))};return rp(_0x2799e6)[_0x96b9('0x27')](function(_0x27e4bd){try{_0x402894=eval(_0x27e4bd['slice'](0x5))[0x0][0x2];}catch(_0x34b1d4){throw new Error(_0x96b9('0x44')+_0x27e4bd[_0x96b9('0x45')]);}if(!_0x402894){if(_0x5dd6be[_0x96b9('0x46')]>0xc8){throw new Error(_0x96b9('0x47'));}else{throw new Error('lang\x20\x22'+_0x866007+_0x96b9('0x48'));}}try{_0x402894=eval(_0x402894)[0x0];}catch(_0x53da43){throw new Error(_0x96b9('0x44')+res[_0x96b9('0x45')]);}const _0x1c1ba3=_0x402894;_0xe4e08b=path[_0x96b9('0x25')](__dirname,_0x96b9('0x31'),rs[_0x96b9('0x32')](0x4)+_0x96b9('0x33'));fs[_0x96b9('0x49')](_0xe4e08b,_0x402894,{'encoding':'base64'});_0x76916a=path[_0x96b9('0x25')](__dirname,'tmp',rs[_0x96b9('0x32')](0x4)+_0x96b9('0x37'));return convertFile(_0xe4e08b,_0x76916a);})['then'](function(){try{fs['unlink'](_0xe4e08b);fs['chmodSync'](_0x76916a,_0x96b9('0x29'));}catch(_0x311485){logger[_0x96b9('0x15')](_0x311485);}logger[_0x96b9('0x1a')]('goggleTTS\x20path',_0x76916a[_0x96b9('0x39')]('.')[0x0]);return _0x76916a[_0x96b9('0x39')]('.')[0x0];});};exports[_0x96b9('0x4a')]=function(_0x21a3c5,_0x15253d,_0x2e1ec7){return google[_0x96b9('0x4b')](_0x21a3c5,_0x15253d,_0x2e1ec7)[_0x96b9('0x27')](function(_0x5ea19d){logger[_0x96b9('0x1a')](_0x5ea19d[_0x96b9('0x4c')]);return rp(_0x5ea19d);})[_0x96b9('0x27')](function(_0x293cfb){var _0x501a5f='';var _0x3f673a=0x0;try{fs['unlink'](_0x21a3c5);}catch(_0x1aab3b){logger[_0x96b9('0x15')](_0x1aab3b);}if(_0x293cfb&&_0x293cfb[_0x96b9('0x4d')]){_0x501a5f=_0x293cfb[_0x96b9('0x4d')][_0x96b9('0x4e')](function(_0x153019){return _0x153019&&_0x153019['alternatives'][0x0]&&_0x153019[_0x96b9('0x4f')][0x0]['transcript']?_0x153019['alternatives'][0x0][_0x96b9('0x50')]:'';})[_0x96b9('0x51')]('\x0a');_0x3f673a=_0x293cfb['results'][_0x96b9('0x4e')](function(_0x351b8e){return _0x351b8e&&_0x351b8e[_0x96b9('0x4f')][0x0]&&_0x351b8e[_0x96b9('0x4f')][0x0][_0x96b9('0x52')]?_0x351b8e[_0x96b9('0x4f')][0x0]['confidence']:0x0;})[_0x96b9('0x51')]('\x0a');}logger[_0x96b9('0x1a')](_0x96b9('0x53'),_0x501a5f);logger[_0x96b9('0x1a')](_0x96b9('0x54'),_0x3f673a);return{'transcript':_0x501a5f,'confidence':_0x3f673a};})['catch'](function(_0x37f6fa){logger[_0x96b9('0x15')]('[%s]\x20%s:%s',_0x37f6fa[_0x96b9('0x14')],_0x37f6fa['name'],_0x37f6fa['message']);});};exports[_0x96b9('0x55')]=function(_0x3aadf7,_0x21b8e2,_0x5e8840,_0x2fe57c){var _0x25a019=apiai(_0x21b8e2,{'language':_0x2fe57c||'en'});return _0x25a019[_0x96b9('0x56')](_0x5e8840,{'sessionId':md5(_0x3aadf7)})[_0x96b9('0x27')](function(_0x8cde61){logger[_0x96b9('0x1a')](JSON[_0x96b9('0x41')](_0x8cde61));return{'source':_0x8cde61[_0x96b9('0x57')][_0x96b9('0x58')],'resolvedQuery':_0x8cde61[_0x96b9('0x57')]['resolvedQuery'],'action':_0x8cde61['result'][_0x96b9('0x59')],'actionIncomplete':_0x8cde61['result'][_0x96b9('0x5a')],'speech':_0x8cde61[_0x96b9('0x57')][_0x96b9('0x5b')]['speech'],'score':_0x8cde61[_0x96b9('0x57')][_0x96b9('0x5c')],'statusCode':_0x8cde61['status'][_0x96b9('0x5d')],'endConversation':_0x8cde61[_0x96b9('0x57')]['metadata'][_0x96b9('0x5e')]||![],'isFallbackIntent':_0x8cde61[_0x96b9('0x57')]['metadata']['isFallbackIntent']};});};exports[_0x96b9('0x5f')]=function(_0xb8020b,_0xd4b1b8,_0x40087b,_0x2341db,_0x324af5,_0x17ff07){var _0xf26048=_0x2341db[_0x96b9('0x60')](/\\n/g,'\x0a');var _0x28fc3c={'credentials':{'private_key':_0xf26048,'client_email':_0x40087b}};var _0x4c90d2=new dialogflow[(_0x96b9('0x61'))](_0x28fc3c);var _0x12af86=_0x4c90d2[_0x96b9('0x62')](_0xd4b1b8,md5(_0xb8020b));var _0x4129f2={'session':_0x12af86,'queryInput':{'text':{'text':_0x324af5,'languageCode':_0x17ff07}}};return _0x4c90d2[_0x96b9('0x63')](_0x4129f2)['then'](function(_0x51f4a6){if(_0x51f4a6&&_0x51f4a6['length']){logger[_0x96b9('0x1a')](_0x96b9('0x64'),JSON['stringify'](_0x51f4a6));var _0xc5613a=_0x51f4a6[0x0];if(_0xc5613a){var _0x3e9d14={'action':_0xc5613a[_0x96b9('0x65')][_0x96b9('0x59')],'allRequiredParamsPresent':_0xc5613a[_0x96b9('0x65')][_0x96b9('0x66')],'endConversation':_0xc5613a['queryResult'][_0x96b9('0x67')]&&_0xc5613a[_0x96b9('0x65')]['diagnosticInfo'][_0x96b9('0x68')]?_0xc5613a[_0x96b9('0x65')]['diagnosticInfo'][_0x96b9('0x68')]['end_conversation'][_0x96b9('0x69')]:![],'fulfillmentText':_0xc5613a[_0x96b9('0x65')][_0x96b9('0x6a')],'intentName':_0xc5613a['queryResult'][_0x96b9('0x6b')][_0x96b9('0x6c')],'intentDisplayName':_0xc5613a[_0x96b9('0x65')][_0x96b9('0x6b')]['displayName'],'isFallbackIntent':_0xc5613a[_0x96b9('0x65')]['intent'][_0x96b9('0x6d')],'languageCode':_0xc5613a[_0x96b9('0x65')][_0x96b9('0x6e')],'queryText':_0xc5613a[_0x96b9('0x65')][_0x96b9('0x6f')],'responseId':_0xc5613a[_0x96b9('0x70')],'score':_0xc5613a[_0x96b9('0x65')][_0x96b9('0x71')],'speech':_0xc5613a[_0x96b9('0x65')]['fulfillmentText'],'providerResponse':JSON[_0x96b9('0x41')](_0x51f4a6)};return _0x3e9d14;}}});};exports[_0x96b9('0x72')]=function(_0x8c44b,_0x4bcc50,_0x358d2a,_0x4a7b9d){return tilde['asr'](_0x8c44b,_0x4bcc50,_0x358d2a,_0x4a7b9d)[_0x96b9('0x27')](function(_0x22f021){try{fs[_0x96b9('0x1c')](_0x8c44b);}catch(_0x50aa1f){logger[_0x96b9('0x15')](_0x50aa1f);}logger[_0x96b9('0x1a')](_0x96b9('0x73'),_0x22f021[_0x96b9('0x50')]);logger[_0x96b9('0x1a')](_0x96b9('0x74'),_0x22f021[_0x96b9('0x52')]);return _0x22f021;});};exports['awsPolly']=function(_0x45624d,_0x16e4c7,_0x5e0daf,_0x4525bc,_0x1efd13,_0x368c14){var _0x13a793=path[_0x96b9('0x25')](__dirname,_0x96b9('0x31'),rs[_0x96b9('0x32')](0x4)+'.mp3');var _0x15842e;return aws[_0x96b9('0x75')](_0x45624d,_0x16e4c7,_0x5e0daf,_0x4525bc,_0x1efd13,_0x368c14,_0x13a793)[_0x96b9('0x27')](function(){_0x15842e=path[_0x96b9('0x25')](__dirname,_0x96b9('0x31'),rs[_0x96b9('0x32')](0x4)+_0x96b9('0x37'));return convertFile(_0x13a793,_0x15842e);})['then'](function(){try{fs[_0x96b9('0x1c')](_0x13a793);fs[_0x96b9('0x28')](_0x15842e,_0x96b9('0x29'));}catch(_0x239831){logger[_0x96b9('0x15')](_0x239831);}return _0x15842e['split']('.')[0x0];});};exports[_0x96b9('0x76')]=function(_0x1c18b8,_0x3da0f5,_0x28ab28,_0x1029df,_0x36411e,_0x5bffd5){return aws[_0x96b9('0x77')](_0x1c18b8,_0x3da0f5,_0x28ab28,_0x1029df,_0x36411e,_0x5bffd5)[_0x96b9('0x27')](function(_0x1234d0){logger[_0x96b9('0x1a')](JSON[_0x96b9('0x41')](_0x1234d0));return _0x1234d0;});};exports[_0x96b9('0x78')]=function(_0xebed94,_0x1c96a6,_0x57291f,_0x30880b){var _0x308eee=util[_0x96b9('0x79')](_0x96b9('0x7a'),ISPEECH_API,_0xebed94,encodeURIComponent(_0x1c96a6),_0x57291f,_0x30880b);var _0x5647be=path[_0x96b9('0x25')](__dirname,_0x96b9('0x31'),rs['generate'](0x4)+'.mp3');var _0x591927;return downloadFile(_0x308eee,_0x5647be)[_0x96b9('0x27')](function(){_0x591927=path[_0x96b9('0x25')](__dirname,_0x96b9('0x31'),rs[_0x96b9('0x32')](0x4)+'.wav');return convertFile(_0x5647be,_0x591927);})[_0x96b9('0x27')](function(){try{fs[_0x96b9('0x1c')](_0x5647be);fs[_0x96b9('0x28')](_0x591927,_0x96b9('0x29'));}catch(_0x5362d2){logger['error'](_0x5362d2);}return _0x591927[_0x96b9('0x39')]('.')[0x0];});};exports[_0x96b9('0x7b')]=function(_0x3878bb,_0x10b7af,_0x20dac0,_0x2bec0d){var _0x356522=util['format'](_0x96b9('0x7c'),ISPEECH_API,_0x10b7af,_0x20dac0,base64Encode(_0x3878bb),_0x2bec0d?util[_0x96b9('0x79')](_0x96b9('0x7d'),encodeURIComponent(_0x2bec0d)):_0x96b9('0x7e'));return uploadFile(_0x356522)['then'](function(_0x53c81c){return querystring[_0x96b9('0xa')](_0x53c81c);});};exports['sestekNDA']=function(_0x568429,_0x4b8fb2){return sestek[_0x96b9('0x7f')](_0x568429,_0x4b8fb2)['then'](function(_0x300c55){logger[_0x96b9('0x1a')](JSON[_0x96b9('0x41')](_0x300c55));var _0x3159f5={'speech':_0x300c55[_0x96b9('0x80')],'action':_0x300c55[_0x96b9('0x81')]?_0x300c55[_0x96b9('0x81')][_0x96b9('0x82')]:undefined,'actiondata':_0x300c55[_0x96b9('0x81')]?_0x300c55[_0x96b9('0x81')][_0x96b9('0x83')]:undefined};if(_0x300c55[_0x96b9('0x81')]&&_0x300c55[_0x96b9('0x81')][_0x96b9('0x84')]){return base64Decode(_0x300c55['channelData']['AudioFromTts']['Data'],path[_0x96b9('0x25')](__dirname,_0x96b9('0x31'),rs[_0x96b9('0x32')](0x4)+_0x96b9('0x37')))[_0x96b9('0x27')](function(_0x2228cd){_0x3159f5['audiofile']=_0x2228cd;return _0x3159f5;});}return _0x3159f5;});};exports[_0x96b9('0x85')]=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 781261f..66ca8b4 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 _0x6e9c=['exports'];(function(_0x373ee2,_0x4c6d3a){var _0x425ff7=function(_0x19f1ff){while(--_0x19f1ff){_0x373ee2['push'](_0x373ee2['shift']());}};_0x425ff7(++_0x4c6d3a);}(_0x6e9c,0x10f));var _0xc6e9=function(_0x518084,_0x292262){_0x518084=_0x518084-0x0;var _0x135926=_0x6e9c[_0x518084];return _0x135926;};var nda=require('./nda');module[_0xc6e9('0x0')]={'nda':nda}; \ No newline at end of file +var _0x8aaf=['exports','./nda'];(function(_0x2942af,_0x260548){var _0x38f87f=function(_0x7dd5bf){while(--_0x7dd5bf){_0x2942af['push'](_0x2942af['shift']());}};_0x38f87f(++_0x260548);}(_0x8aaf,0xc5));var _0xf8aa=function(_0x59b6f8,_0x5802ce){_0x59b6f8=_0x59b6f8-0x0;var _0x2c2057=_0x8aaf[_0x59b6f8];return _0x2c2057;};var nda=require(_0xf8aa('0x0'));module[_0xf8aa('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 12f940e..9b0fb3b 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 _0xb077=['custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','agi','POST','resolve','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x3541b1,_0x3058e0){var _0x176967=function(_0x436423){while(--_0x436423){_0x3541b1['push'](_0x3541b1['shift']());}};_0x176967(++_0x3058e0);}(_0xb077,0x7a));var _0x7b07=function(_0x2373c5,_0x27574d){_0x2373c5=_0x2373c5-0x0;var _0x11a68a=_0xb077[_0x2373c5];return _0x11a68a;};'use strict';var rp=require(_0x7b07('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x7b07('0x1'));module['exports']=function(_0x3b4ddb,_0xb5fbb2){var _0x1fe3c4={'method':_0x7b07('0x2'),'uri':url[_0x7b07('0x3')](_0xb5fbb2['ndauth_url'],'/token'),'form':{'grant_type':_0x7b07('0x4'),'username':_0xb5fbb2[_0x7b07('0x5')],'password':_0xb5fbb2[_0x7b07('0x4')]},'json':!![]};return rp(_0x1fe3c4)['then'](function(_0x561c99){var _0x3a82e8={'method':'POST','uri':url[_0x7b07('0x3')](_0xb5fbb2[_0x7b07('0x6')],_0x7b07('0x7')),'body':{'type':_0xb5fbb2[_0x7b07('0x8')]||_0x7b07('0x9'),'channelId':_0x7b07('0xa'),'conversation':{'id':_0x3b4ddb[_0x7b07('0xb')]},'from':{'id':_0x3b4ddb[_0x7b07('0xc')],'name':_0x3b4ddb[_0x7b07('0xd')]},'recipient':{'id':_0x3b4ddb['dnid'],'name':_0x3b4ddb[_0x7b07('0xe')]},'text':_0xb5fbb2[_0x7b07('0xf')],'channelData':{}},'headers':{'Authorization':_0x7b07('0x10')+_0x561c99['access_token']},'json':!![]};if(_0xb5fbb2[_0x7b07('0x11')]){_0x3a82e8[_0x7b07('0x12')][_0x7b07('0x13')][_0x7b07('0x14')]=_0xb5fbb2['project'];}if(_0xb5fbb2[_0x7b07('0x15')]=='1'){_0x3a82e8[_0x7b07('0x12')][_0x7b07('0x13')][_0x7b07('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0xb5fbb2[_0x7b07('0x17')]){_0x3a82e8[_0x7b07('0x12')][_0x7b07('0x13')][_0x7b07('0x18')]=_0xb5fbb2['custom_action'];if(_0xb5fbb2['custom_action_data']){_0x3a82e8['body']['channelData'][_0x7b07('0x19')]=_0xb5fbb2[_0x7b07('0x1a')];}}logger[_0x7b07('0x1b')](JSON[_0x7b07('0x1c')](_0x3a82e8));return rp(_0x3a82e8);});}; \ No newline at end of file +var _0x0647=['CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','username','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio'];(function(_0x522da1,_0x1d138e){var _0x57da0d=function(_0x4c3884){while(--_0x4c3884){_0x522da1['push'](_0x522da1['shift']());}};_0x57da0d(++_0x1d138e);}(_0x0647,0xd0));var _0x7064=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x0647[_0x24259d];return _0x5a701;};'use strict';var rp=require(_0x7064('0x0'));var url=require('url');var logger=require(_0x7064('0x1'))(_0x7064('0x2'));module[_0x7064('0x3')]=function(_0x11f1b5,_0x38dadf){var _0x5e8659={'method':'POST','uri':url[_0x7064('0x4')](_0x38dadf[_0x7064('0x5')],_0x7064('0x6')),'form':{'grant_type':_0x7064('0x7'),'username':_0x38dadf[_0x7064('0x8')],'password':_0x38dadf[_0x7064('0x7')]},'json':!![]};return rp(_0x5e8659)['then'](function(_0x536336){var _0x1c85b1={'method':_0x7064('0x9'),'uri':url[_0x7064('0x4')](_0x38dadf['ndassistant_url'],_0x7064('0xa')),'body':{'type':_0x38dadf[_0x7064('0xb')]||'message','channelId':_0x7064('0xc'),'conversation':{'id':_0x11f1b5[_0x7064('0xd')]},'from':{'id':_0x11f1b5[_0x7064('0xe')],'name':_0x11f1b5['calleridname']},'recipient':{'id':_0x11f1b5[_0x7064('0xf')],'name':_0x11f1b5[_0x7064('0x10')]},'text':_0x38dadf[_0x7064('0x11')],'channelData':{}},'headers':{'Authorization':_0x7064('0x12')+_0x536336['access_token']},'json':!![]};if(_0x38dadf[_0x7064('0x13')]){_0x1c85b1[_0x7064('0x14')][_0x7064('0x15')][_0x7064('0x16')]=_0x38dadf[_0x7064('0x13')];}if(_0x38dadf[_0x7064('0x17')]=='1'){_0x1c85b1[_0x7064('0x14')][_0x7064('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x38dadf['custom_action']){_0x1c85b1[_0x7064('0x14')][_0x7064('0x15')][_0x7064('0x18')]=_0x38dadf['custom_action'];if(_0x38dadf[_0x7064('0x19')]){_0x1c85b1[_0x7064('0x14')]['channelData'][_0x7064('0x1a')]=_0x38dadf[_0x7064('0x19')];}}logger[_0x7064('0x1b')](JSON[_0x7064('0x1c')](_0x1c85b1));return rp(_0x1c85b1);});}; \ 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 21e42d3..7a88b81 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 _0x0e03=['./lib/api','exports'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0x0e03,0x78));var _0x30e0=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x0e03[_0x44afa4];return _0xcad289;};'use strict';var asr=require(_0x30e0('0x0'));module[_0x30e0('0x1')]=function(_0x2b2afc,_0xf16a0b,_0x5b6f7f,_0x59faad){return asr(_0x2b2afc,_0xf16a0b,_0x5b6f7f,_0x59faad);}; \ No newline at end of file +var _0x1c20=['./lib/api'];(function(_0x401d92,_0x5bf37f){var _0x358a14=function(_0x210448){while(--_0x210448){_0x401d92['push'](_0x401d92['shift']());}};_0x358a14(++_0x5bf37f);}(_0x1c20,0x171));var _0x01c2=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x1c20[_0x220dbb];return _0x2b77de;};'use strict';var asr=require(_0x01c2('0x0'));module['exports']=function(_0x136250,_0x1acad6,_0x1b3c89,_0x16d01d){return asr(_0x136250,_0x1acad6,_0x1b3c89,_0x16d01d);}; \ 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 254155b..1670781 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 _0x7fa3=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','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','isNil','isObject','open','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info'];(function(_0x585199,_0x10d223){var _0x4f5eaf=function(_0x19f4cf){while(--_0x19f4cf){_0x585199['push'](_0x585199['shift']());}};_0x4f5eaf(++_0x10d223);}(_0x7fa3,0x192));var _0x37fa=function(_0x5742c4,_0x5d94fc){_0x5742c4=_0x5742c4-0x0;var _0x3eecc9=_0x7fa3[_0x5742c4];return _0x3eecc9;};'use strict';var BPromise=require(_0x37fa('0x0'));var _=require(_0x37fa('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x37fa('0x2'));var crypto=require(_0x37fa('0x3'));var logger=require(_0x37fa('0x4'))(_0x37fa('0x5'));module[_0x37fa('0x6')]=function(_0x3e2e24,_0x1a9309,_0x3c63ec,_0x1e1120){return new BPromise(function(_0x253e91,_0x1d5173){logger[_0x37fa('0x7')]('Tilde\x20URI',_0x1e1120||_0x37fa('0x8'));var _0x1e73bd=new WebSocket(_0x1e1120||_0x37fa('0x8'),{'perMessageDeflate':![]});var _0x18c773='';var _0x172d73='0';var _0x445fc7='1';var _0x119970='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x246d7a(_0x4cc1fc){var _0x3d064e=crypto[_0x37fa('0x9')]('sha1');_0x3d064e[_0x37fa('0xa')](_0x4cc1fc);return _0x3d064e['digest'](_0x37fa('0xb'));}function _0x19bc72(){try{logger[_0x37fa('0x7')](_0x37fa('0xc'));var _0xe1d7e0=moment()[_0x37fa('0xd')]();var _0x4c5210=_0x246d7a(_0xe1d7e0+_0x1a9309+_0x3c63ec);_0x1e73bd[_0x37fa('0xe')](JSON['stringify']({'appID':_0x1a9309,'timestamp':_0xe1d7e0,'appKey':_0x4c5210}));var _0x3cdb4b=fs[_0x37fa('0xf')](_0x3e2e24);_0x3cdb4b['on'](_0x37fa('0x10'),function(_0x4abf7e){_0x1e73bd[_0x37fa('0xe')](_0x4abf7e);});_0x3cdb4b['on'](_0x37fa('0x11'),function(){_0x1e73bd[_0x37fa('0xe')](_0x37fa('0x12'));});}catch(_0x39b817){logger[_0x37fa('0x13')](_0x37fa('0x14'),JSON[_0x37fa('0x15')](_0x39b817));_0x1e73bd[_0x37fa('0x16')]();}}function _0x49736f(_0x26f13e){try{if(_0x26f13e){var _0x246db6=JSON[_0x37fa('0x17')](_0x26f13e);switch(_0x246db6['status']){case 0x0:if(_0x246db6[_0x37fa('0x18')]){if(_0x246db6[_0x37fa('0x18')][_0x37fa('0x19')]){logger[_0x37fa('0x7')](_0x37fa('0x1a'),JSON[_0x37fa('0x15')](_0x246db6[_0x37fa('0x18')][_0x37fa('0x1b')]));_0x18c773=_0x246db6[_0x37fa('0x18')][_0x37fa('0x1b')][0x0][_0x37fa('0x1c')];_0x172d73=_0x246db6['result'][_0x37fa('0x1b')][0x0][_0x37fa('0x1d')];_0x445fc7='0';_0x119970=_0x37fa('0x1e');_0x1e73bd[_0x37fa('0x16')]();}}break;case 0x1:logger[_0x37fa('0x7')](_0x37fa('0x1f'));_0x445fc7='1';_0x119970='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x37fa('0x7')](_0x37fa('0x20'));_0x445fc7='2';_0x119970='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x37fa('0x21'));_0x445fc7='9';_0x119970=_0x37fa('0x21');break;case 0xa:logger[_0x37fa('0x7')]('Authentication\x20failed.');_0x445fc7='10';_0x119970=_0x37fa('0x22');break;case 0xb:logger[_0x37fa('0x7')](_0x37fa('0x23'));_0x445fc7='11';_0x119970=_0x37fa('0x23');}}}catch(_0x494225){logger[_0x37fa('0x13')](_0x37fa('0x24'),JSON['stringify'](_0x494225));_0x1e73bd[_0x37fa('0x16')]();}}function _0x4b1a7b(){logger[_0x37fa('0x7')](_0x37fa('0x25'));_0x253e91({'transcript':_0x18c773,'confidence':_0x172d73,'status':_0x445fc7,'status_message':_0x119970});}function _0x26f8dd(_0xdcc490){logger[_0x37fa('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x37fa('0x26')](_0xdcc490)){logger[_0x37fa('0x13')](_[_0x37fa('0x27')](_0xdcc490)?JSON['stringify'](_0xdcc490):_0xdcc490);}}_0x1e73bd['on'](_0x37fa('0x28'),_0x19bc72);_0x1e73bd['on']('message',_0x49736f);_0x1e73bd['on'](_0x37fa('0x11'),_0x4b1a7b);_0x1e73bd['on'](_0x37fa('0x13'),_0x26f8dd);});}; \ No newline at end of file +var _0xe4a7=['send','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','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','isNil','isObject','stringify','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','createReadStream','data'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0xe4a7,0x146));var _0x7e4a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe4a7[_0x40a045];return _0x1a687c;};'use strict';var BPromise=require(_0x7e4a('0x0'));var _=require(_0x7e4a('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7e4a('0x2'));var crypto=require(_0x7e4a('0x3'));var logger=require(_0x7e4a('0x4'))(_0x7e4a('0x5'));module[_0x7e4a('0x6')]=function(_0xcb33a5,_0x5b4e11,_0x577a2a,_0x51fb47){return new BPromise(function(_0x8ab314,_0x508bf9){logger[_0x7e4a('0x7')]('Tilde\x20URI',_0x51fb47||_0x7e4a('0x8'));var _0x4db6bb=new WebSocket(_0x51fb47||_0x7e4a('0x8'),{'perMessageDeflate':![]});var _0x209f44='';var _0x3b3ef0='0';var _0x56a5ba='1';var _0x4b46c5=_0x7e4a('0x9');function _0x307b5f(_0x6a7b90){var _0x5e3793=crypto['createHash']('sha1');_0x5e3793[_0x7e4a('0xa')](_0x6a7b90);return _0x5e3793[_0x7e4a('0xb')](_0x7e4a('0xc'));}function _0x4f5d86(){try{logger['info'](_0x7e4a('0xd'));var _0x3c88a1=moment()['unix']();var _0x38021e=_0x307b5f(_0x3c88a1+_0x5b4e11+_0x577a2a);_0x4db6bb['send'](JSON['stringify']({'appID':_0x5b4e11,'timestamp':_0x3c88a1,'appKey':_0x38021e}));var _0x424172=fs[_0x7e4a('0xe')](_0xcb33a5);_0x424172['on'](_0x7e4a('0xf'),function(_0x48ce68){_0x4db6bb[_0x7e4a('0x10')](_0x48ce68);});_0x424172['on'](_0x7e4a('0x11'),function(){_0x4db6bb[_0x7e4a('0x10')]('EOS');});}catch(_0x247af2){logger[_0x7e4a('0x12')](_0x7e4a('0x13'),JSON['stringify'](_0x247af2));_0x4db6bb['terminate']();}}function _0x3eb74b(_0x635435){try{if(_0x635435){var _0x1c9597=JSON[_0x7e4a('0x14')](_0x635435);switch(_0x1c9597[_0x7e4a('0x15')]){case 0x0:if(_0x1c9597['result']){if(_0x1c9597[_0x7e4a('0x16')][_0x7e4a('0x17')]){logger[_0x7e4a('0x7')](_0x7e4a('0x18'),JSON['stringify'](_0x1c9597['result'][_0x7e4a('0x19')]));_0x209f44=_0x1c9597[_0x7e4a('0x16')]['hypotheses'][0x0]['transcript'];_0x3b3ef0=_0x1c9597[_0x7e4a('0x16')][_0x7e4a('0x19')][0x0]['likelihood'];_0x56a5ba='0';_0x4b46c5=_0x7e4a('0x1a');_0x4db6bb['terminate']();}}break;case 0x1:logger['info'](_0x7e4a('0x9'));_0x56a5ba='1';_0x4b46c5='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0x7e4a('0x1b'));_0x56a5ba='2';_0x4b46c5='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x7e4a('0x7')](_0x7e4a('0x1c'));_0x56a5ba='9';_0x4b46c5=_0x7e4a('0x1c');break;case 0xa:logger['info']('Authentication\x20failed.');_0x56a5ba='10';_0x4b46c5=_0x7e4a('0x1d');break;case 0xb:logger['info'](_0x7e4a('0x1e'));_0x56a5ba='11';_0x4b46c5='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x157b4f){logger[_0x7e4a('0x12')](_0x7e4a('0x1f'),JSON['stringify'](_0x157b4f));_0x4db6bb['terminate']();}}function _0x3aef18(){logger['info'](_0x7e4a('0x20'));_0x8ab314({'transcript':_0x209f44,'confidence':_0x3b3ef0,'status':_0x56a5ba,'status_message':_0x4b46c5});}function _0x383dde(_0x876b72){logger[_0x7e4a('0x12')](_0x7e4a('0x21'));if(!_[_0x7e4a('0x22')](_0x876b72)){logger[_0x7e4a('0x12')](_[_0x7e4a('0x23')](_0x876b72)?JSON[_0x7e4a('0x24')](_0x876b72):_0x876b72);}}_0x4db6bb['on']('open',_0x4f5d86);_0x4db6bb['on'](_0x7e4a('0x25'),_0x3eb74b);_0x4db6bb['on'](_0x7e4a('0x11'),_0x3aef18);_0x4db6bb['on']('error',_0x383dde);});}; \ 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 d1eb775..cf63965 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 _0x5755=['./asr'];(function(_0x3ad737,_0x300131){var _0x16c1e2=function(_0x4c64fe){while(--_0x4c64fe){_0x3ad737['push'](_0x3ad737['shift']());}};_0x16c1e2(++_0x300131);}(_0x5755,0x16f));var _0x5575=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x5755[_0x1dac7a];return _0x4cb363;};var asr=require(_0x5575('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x8012=['exports','./asr'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x8012,0x1d1));var _0x2801=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8012[_0xefd519];return _0x4bb882;};var asr=require(_0x2801('0x0'));module[_0x2801('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c047a12..5e6988d 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +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(_0x571c00,_0x3ae028){var _0x2887df=function(_0x5ebe70){while(--_0x5ebe70){_0x571c00['push'](_0x571c00['shift']());}};_0x2887df(++_0x3ae028);}(_0xe706,0xa3));var _0x6e70=function(_0x5e8b4d,_0x4e5ba1){_0x5e8b4d=_0x5e8b4d-0x0;var _0x5d0091=_0xe706[_0x5e8b4d];return _0x5d0091;};'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 diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index bbbcc61..7f59c1d 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 _0x6aa7=['agent','agentPause','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','number','timeout','POST','PUT','method','parse','headers','rawHeaders','computedVariables','uri','render','body','stringify','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','key','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','split','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','createSquareDetailsReport','maxRetry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','delay','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','debug','no\x20user\x20selected','sip_id','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','pause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','project_id','arg_1','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\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','join','util','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','/var/opt/motion2/server/files','rawBody','menu','getdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getSquareProject','getSquareProjectById','name','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','getSoundPath','format','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','channel','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x6aa7,0x178));var _0x76aa=function(_0x303321,_0x3cde68){_0x303321=_0x303321-0x0;var _0x3904db=_0x6aa7[_0x303321];return _0x3904db;};'use strict';var fs=require('fs');var util=require(_0x76aa('0x0'));var _=require('lodash');var sh=require(_0x76aa('0x1'));var odbc=require(_0x76aa('0x2'))();var rs=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var Mustache=require('mustache');var rp=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x76aa('0x8');var recursiveMapAttributes=['rawHeaders',_0x76aa('0x9')];var verticesWithRetry=[_0x76aa('0xa'),_0x76aa('0xb'),'getsecretdigits'];var AGIVertices=function(_0x3dae33,_0x266bd5,_0x3a3f36){this['channel']=_0x3dae33;this[_0x76aa('0xc')]=_0x266bd5;this[_0x76aa('0xd')]=_0x3a3f36;};AGIVertices[_0x76aa('0xe')][_0x76aa('0xf')]=function(_0x37f1ab,_0x128435){this[_0x76aa('0xc')][_0x76aa('0x10')](_0x37f1ab)[_0x76aa('0x11')](function(_0x17a417){_0x128435(null,_0x17a417?_0x17a417['name']:![]);})[_0x76aa('0x12')](function(_0x5df49c){_0x128435(_0x5df49c);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x13')]=function(_0x3f8f6b,_0x8e44ed){this[_0x76aa('0xc')]['getVoiceQueueById'](_0x3f8f6b)['then'](function(_0x2b3b4f){_0x8e44ed(null,_0x2b3b4f?_0x2b3b4f['name']:![]);})[_0x76aa('0x12')](function(_0x319bf1){_0x8e44ed(_0x319bf1);});};AGIVertices['prototype'][_0x76aa('0x14')]=function(_0x550d9a,_0x328381){this['rpc'][_0x76aa('0x15')](_0x550d9a)[_0x76aa('0x11')](function(_0x2ab30b){_0x328381(null,_0x2ab30b?_0x2ab30b[_0x76aa('0x16')]:![]);})[_0x76aa('0x12')](function(_0x3ead3f){_0x328381(_0x3ead3f);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x256636,_0x454dd3){this[_0x76aa('0xc')][_0x76aa('0x17')](_0x256636)[_0x76aa('0x11')](function(_0x191560){_0x454dd3(null,_0x191560?_0x191560[_0x76aa('0x18')]:![]);})[_0x76aa('0x12')](function(_0x385157){_0x454dd3(_0x385157);});};AGIVertices['prototype'][_0x76aa('0x19')]=function(_0x21064c,_0x338a6b){this['rpc'][_0x76aa('0x1a')](_0x21064c)[_0x76aa('0x11')](function(_0x31252f){_0x338a6b(null,_0x31252f?_0x31252f[_0x76aa('0x16')]:![]);})[_0x76aa('0x12')](function(_0xc1044c){_0x338a6b(_0xc1044c);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x1b')]=function(_0x32bf9f,_0x2cba6d){this[_0x76aa('0xc')][_0x76aa('0x1c')](_0x32bf9f)[_0x76aa('0x11')](function(_0x4ef9b0){_0x2cba6d(null,_0x4ef9b0?_0x4ef9b0[_0x76aa('0x16')]:![]);})[_0x76aa('0x12')](function(_0x25c614){_0x2cba6d(_0x25c614);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x1d')]=function(_0x2f9316,_0x25a803){var _0x282d0a=this;this[_0x76aa('0xc')][_0x76aa('0x1e')](_0x2f9316)['then'](function(_0x3fcb7f){_0x25a803(null,_0x3fcb7f?_0x282d0a['getSoundPath'](_0x3fcb7f[_0x76aa('0x1f')]):![]);})[_0x76aa('0x12')](function(_0x2dec94){_0x25a803(_0x2dec94);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x20')]=function(_0x2d6213,_0x2ee0f9){this[_0x76aa('0xc')][_0x76aa('0x21')](_0x2d6213)[_0x76aa('0x11')](function(_0x5edcd8){_0x2ee0f9(null,_0x5edcd8?_0x5edcd8:![]);})[_0x76aa('0x12')](function(_0x5532c7){_0x2ee0f9(_0x5532c7);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x22')]=function(_0x458ac3,_0x38ecd1,_0x35a705){this['mailRpc'][_0x76aa('0x22')](_0x458ac3,_0x38ecd1)[_0x76aa('0x11')](function(){_0x35a705(null);})['catch'](function(_0x2ee338){_0x35a705(_0x2ee338);});};AGIVertices['prototype'][_0x76aa('0x23')]=function(_0x4c90b6,_0x8479a3){this['rpc']['getIntervalById'](_0x4c90b6)[_0x76aa('0x11')](function(_0x282c56){if(_0x282c56){if(_0x282c56[_0x76aa('0x24')]){_0x8479a3(null,[_0x282c56[_0x76aa('0x25')]]);}else{_0x8479a3(null,_['map'](_0x282c56['Intervals'],_0x76aa('0x25')));}}else{_0x8479a3(null,![]);}})[_0x76aa('0x12')](function(_0x58127c){_0x8479a3(_0x58127c);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x26')]=function(_0x5b57d8){return util[_0x76aa('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x5b57d8);};AGIVertices['prototype'][_0x76aa('0x28')]=function(_0x36d64e,_0x181216,_0x127bc4){odbc['open'](_0x36d64e,function(_0x401c07){if(_0x401c07){logger[_0x76aa('0x29')](_0x76aa('0x2a'),_0x401c07);_0x127bc4(_0x401c07);}else{logger['info'](_0x76aa('0x2b'));odbc[_0x76aa('0x2c')](_0x181216,function(_0x2f7726,_0x147c03){if(_0x2f7726){logger[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x181216);_0x127bc4(_0x2f7726);}else{logger[_0x76aa('0x2d')](_0x76aa('0x2f'),_0x181216);odbc[_0x76aa('0x30')](function(_0x5f022a){if(_0x5f022a){logger[_0x76aa('0x29')](_0x76aa('0x31'),_0x5f022a);}_0x127bc4(null,_0x147c03);});}});}});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x32')]=function(_0x64612e,_0x2957aa){this['rpc']['getSmsAccountById'](_0x64612e)[_0x76aa('0x11')](function(_0x262906){_0x2957aa(null,_0x262906?_0x262906:![]);})[_0x76aa('0x12')](function(_0x365612){_0x2957aa(_0x365612);});};AGIVertices['prototype'][_0x76aa('0x33')]=function(_0x403084,_0x154567){this[_0x76aa('0xc')][_0x76aa('0x33')](_0x403084)['then'](function(_0x13dafe){_0x154567(null,_0x13dafe);})['catch'](function(_0xbb3136){_0x154567(_0xbb3136);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x4f7f3a,_0x144f0a,_0x541594){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x76aa('0x34')][_0x76aa('0x35')],'node':_0x4f7f3a[_0x76aa('0x36')],'application':_0x4f7f3a[_0x76aa('0x37')],'data':_0x144f0a||null,'project_name':this[_0x76aa('0x34')]['arg_1'],'callerid':this[_0x76aa('0x34')][_0x76aa('0x38')]})[_0x76aa('0x11')](function(_0x2d6b7f){if(_0x541594){_0x541594(null,_0x2d6b7f);}})[_0x76aa('0x12')](function(_0x47a308){if(_0x541594){_0x541594(_0x47a308);}});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x39')]=function(_0x5dc67e,_0x2d3441,_0x5a984e,_0x3aa858){this[_0x76aa('0xc')][_0x76aa('0x39')]({'uniqueid':this[_0x76aa('0x34')][_0x76aa('0x35')],'callerid':this[_0x76aa('0x34')][_0x76aa('0x38')],'calleridname':this[_0x76aa('0x34')][_0x76aa('0x3a')],'context':this[_0x76aa('0x34')]['context'],'extension':this[_0x76aa('0x34')]['extension'],'priority':this[_0x76aa('0x34')][_0x76aa('0x3b')],'accountcode':this[_0x76aa('0x34')][_0x76aa('0x3c')],'dnid':this['channel']['dnid'],'projectName':this[_0x76aa('0x34')]['arg_1'],'saveName':_0x2d3441,'filename':_0x5dc67e[_0x76aa('0x3d')]||_0x2d3441,'savePath':_0x5a984e})[_0x76aa('0x11')](function(_0x4315b3){_0x3aa858(null,_0x4315b3);})[_0x76aa('0x12')](function(_0x30c577){_0x3aa858(_0x30c577);});};AGIVertices[_0x76aa('0xe')]['createSquareMessage']=function(_0x564546,_0x2fcf8f,_0x1eafb2,_0x1708d4,_0x40e8ff){this[_0x76aa('0xc')][_0x76aa('0x3e')]({'uniqueid':this['channel'][_0x76aa('0x35')],'body':_0x564546,'direction':_0x2fcf8f,'providerName':_0x1eafb2,'providerResponse':_0x1708d4})[_0x76aa('0x11')](function(_0x26db69){if(_0x40e8ff){_0x40e8ff(null,_0x26db69);}})['catch'](function(_0x30d930){if(_0x40e8ff){_0x40e8ff(_0x30d930);}});};AGIVertices['prototype'][_0x76aa('0x3f')]=function(_0x5e1d84,_0x339b0d){this[_0x76aa('0xc')][_0x76aa('0x3f')]({'firstName':_[_0x76aa('0x40')](_0x5e1d84[_0x76aa('0x16')])||_[_0x76aa('0x41')](_0x5e1d84[_0x76aa('0x16')])?'callback_'+Math[_0x76aa('0x42')]():_0x5e1d84['name'],'lastName':_[_0x76aa('0x40')](_0x5e1d84[_0x76aa('0x43')])||_[_0x76aa('0x41')](_0x5e1d84[_0x76aa('0x43')])?null:_0x5e1d84[_0x76aa('0x43')],'phone':_0x5e1d84[_0x76aa('0x44')],'ListId':_0x5e1d84[_0x76aa('0x45')],'scheduledat':_0x5e1d84['scheduledAt'],'callbackUniqueid':this[_0x76aa('0x34')][_0x76aa('0x35')],'tags':_0x76aa('0x46'),'description':_0x76aa('0x47')+_0x5e1d84['scheduledAt'][_0x76aa('0x48')](),'priority':_0x5e1d84[_0x76aa('0x49')]})[_0x76aa('0x11')](function(_0x410933){_0x339b0d(null,_0x410933);})[_0x76aa('0x12')](function(_0xf7732){_0x339b0d(_0xf7732);});};AGIVertices['prototype'][_0x76aa('0x4a')]=function(_0xbf78c7,_0x2886eb){this[_0x76aa('0xc')][_0x76aa('0x4b')](_0xbf78c7)[_0x76aa('0x11')](function(_0x37babe){_0x2886eb(null,_0x37babe?_0x37babe['name']:![]);})['catch'](function(_0x2c59a6){_0x2886eb(_0x2c59a6);});};AGIVertices[_0x76aa('0xe')]['agentPause']=function(_0x3d7802,_0x1e6f3c,_0x4f832d){var _0x3354b6={'role':_0x76aa('0x4c')};_0x3354b6[_0x3d7802]=this[_0x76aa('0x34')][_0x76aa('0x38')];this[_0x76aa('0xc')][_0x76aa('0x4d')](_0x3354b6,_0x1e6f3c,this[_0x76aa('0x34')][_0x76aa('0x35')])[_0x76aa('0x11')](function(_0x57d778){_0x4f832d(null,_[_0x76aa('0x41')](_0x57d778)?![]:!![]);})['catch'](function(_0x40e746){logger[_0x76aa('0x29')](_0x40e746);_0x4f832d(null,![]);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x4e')]=function(_0x343cf1,_0x260ad2){var _0x18c4b8={'role':_0x76aa('0x4c')};_0x18c4b8[_0x343cf1]=this[_0x76aa('0x34')]['callerid'];this[_0x76aa('0xc')][_0x76aa('0x4e')](_0x18c4b8)[_0x76aa('0x11')](function(_0xe5957d){_0x260ad2(null,_[_0x76aa('0x41')](_0xe5957d)?![]:!![]);})[_0x76aa('0x12')](function(_0x3d6d10){logger[_0x76aa('0x29')](_0x3d6d10);_0x260ad2(null,![]);});};AGIVertices['prototype'][_0x76aa('0x4f')]=function(_0x4d3ad0,_0x35bd2b){var _0x35881c={'role':_0x76aa('0x4c')};_0x35881c[_0x4d3ad0]=this[_0x76aa('0x34')][_0x76aa('0x38')];this[_0x76aa('0xc')][_0x76aa('0x4f')](_0x35881c)['then'](function(_0x9ea0af){_0x35bd2b(null,_[_0x76aa('0x41')](_0x9ea0af)?![]:!![]);})['catch'](function(_0x54334b){logger[_0x76aa('0x29')](_0x54334b);_0x35bd2b(null,![]);});};AGIVertices[_0x76aa('0xe')]['agentLogin']=function(_0x21b99c,_0x35a21f){var _0x12aeee={'role':'agent'};_0x12aeee[_0x21b99c]=this[_0x76aa('0x34')]['callerid'];var _0xf31e1f=_0x21b99c!=_0x76aa('0x50')?util[_0x76aa('0x27')](_0x76aa('0x51'),'LOCAL',this['channel'][_0x76aa('0x38')]):undefined;this['rpc'][_0x76aa('0x52')](_0x12aeee,_0xf31e1f)[_0x76aa('0x11')](function(_0x368a95){_0x35a21f(null,_[_0x76aa('0x41')](_0x368a95)?![]:!![]);})[_0x76aa('0x12')](function(_0x30837c){logger[_0x76aa('0x29')](_0x30837c);_0x35a21f(null,![]);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x53')]=function(_0x54390f,_0x7d02e7){sh[_0x76aa('0x54')](_[_0x76aa('0x55')](_0x54390f),function(_0x45ae9f,_0x4eb2e7){var _0x4c0af4=_0x4eb2e7['replace'](/(\r\n|\n|\r)/gm,'');_0x7d02e7(null,_0x4c0af4);});};AGIVertices[_0x76aa('0xe')]['googleCloudTTS']=function(_0xb61e5,_0x256195){scripts[_0x76aa('0x56')](_0xb61e5[_0x76aa('0x57')],_0xb61e5['google_cloud_tts_text_type']||_0x76aa('0x58'),_0xb61e5['text'],_0xb61e5[_0x76aa('0x59')]||_0x76aa('0x5a'),_0xb61e5[_0x76aa('0x5b')]||_0x76aa('0x5c'),_0xb61e5[_0x76aa('0x5d')]||'MP3')[_0x76aa('0x11')](function(_0x13ae5d){_0x256195(null,_0x13ae5d);})[_0x76aa('0x12')](function(_0x3601d6){_0x256195(_0x3601d6);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x5e')]=function(_0x1d9c6e,_0x18c88a){scripts['googleTTS'](_0x1d9c6e[_0x76aa('0x58')],_0x1d9c6e[_0x76aa('0x5f')]||'en',0x1)['then'](function(_0x3c1b98){_0x18c88a(null,_0x3c1b98);})[_0x76aa('0x12')](function(_0x325487){_0x18c88a(_0x325487);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x60')]=function(_0x51b101,_0x2eaeb5){var _0x5dc923={'uri':_0x51b101[_0x76aa('0x61')],'method':_0x51b101['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x51b101['timeout'])===_0x76aa('0x62')&&parseInt(_0x51b101[_0x76aa('0x63')])>=0x1?parseInt(_0x51b101['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x76aa('0x64'),_0x76aa('0x65')],_0x5dc923[_0x76aa('0x66')]['toUpperCase']())){try{_0x5dc923['body']=_0x51b101[_0x76aa('0x9')]?JSON[_0x76aa('0x67')](_0x51b101[_0x76aa('0x9')]):{};}catch(_0x5d65ec){logger[_0x76aa('0x29')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5d65ec);}}try{_0x5dc923[_0x76aa('0x68')]=_0x51b101[_0x76aa('0x69')]?JSON[_0x76aa('0x67')](_0x51b101[_0x76aa('0x69')]):{};}catch(_0x1e539f){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1e539f);}if(_0x51b101[_0x76aa('0x6a')]){try{var _0x272a28=require(_0x51b101[_0x76aa('0x6a')])['sync'](this,_0x5dc923);_0x5dc923[_0x76aa('0x6b')]=Mustache[_0x76aa('0x6c')](_0x51b101[_0x76aa('0x61')],_0x272a28,{},['$$','$$']);if(_0x5dc923[_0x76aa('0x68')]){_0x5dc923[_0x76aa('0x68')]=JSON['parse'](Mustache[_0x76aa('0x6c')](JSON['stringify'](_0x5dc923[_0x76aa('0x68')]),_0x272a28,{},['$$','$$']));}if(_0x5dc923[_0x76aa('0x6d')]){_0x5dc923[_0x76aa('0x6d')]=JSON[_0x76aa('0x67')](Mustache[_0x76aa('0x6c')](JSON[_0x76aa('0x6e')](_0x5dc923['body']),_0x272a28,{},['$$','$$']));}}catch(_0x555682){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x555682);}}rp(_0x5dc923)['then'](function(_0x2203c3){var _0x22f44f={'statusCode':_0x2203c3['statusCode']||0xc8,'statusMessage':_0x2203c3['statusMessage']||'OK','headers':_0x2203c3['headers']||{},'body':_0x2203c3[_0x76aa('0x6d')]||{}};_0x2eaeb5(null,_0x22f44f);})[_0x76aa('0x12')](function(_0x161593){var _0x506a41={'statusCode':_0x161593['statusCode']||0x1f4,'statusMessage':_0x161593[_0x76aa('0x6f')]||_0x76aa('0x70'),'headers':_0x161593[_0x76aa('0x71')][_0x76aa('0x68')]||{},'body':_0x161593[_0x76aa('0x71')]['body']||{}};_0x2eaeb5(null,_0x506a41);});};AGIVertices['prototype'][_0x76aa('0x72')]=function(_0x5c18b4,_0x5d9381){scripts['googleDialogflow'](this[_0x76aa('0x34')][_0x76aa('0x35')],_0x5c18b4['key'],_0x5c18b4[_0x76aa('0x58')],_0x5c18b4[_0x76aa('0x73')]||'en')['then'](function(_0x22063f){_0x5d9381(null,_0x22063f);})[_0x76aa('0x12')](function(_0x11d91f){_0x5d9381(_0x11d91f);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x74')]=function(_0x458ab9,_0x1a8b6b){scripts[_0x76aa('0x74')](this[_0x76aa('0x34')]['uniqueid'],_0x458ab9[_0x76aa('0x75')],_0x458ab9[_0x76aa('0x76')],_0x458ab9['private_key'],_0x458ab9[_0x76aa('0x58')],_0x458ab9[_0x76aa('0x77')]||'en')[_0x76aa('0x11')](function(_0x5653b3){_0x1a8b6b(null,_0x5653b3);})[_0x76aa('0x12')](function(_0x1ae1ab){_0x1a8b6b(_0x1ae1ab);});};AGIVertices['prototype'][_0x76aa('0x78')]=function(_0x3320a2,_0x203b1f){scripts['sestekNDA'](this[_0x76aa('0x34')],_0x3320a2)[_0x76aa('0x11')](function(_0x50a51f){_0x203b1f(null,_0x50a51f);})['catch'](function(_0x5941a5){_0x203b1f(_0x5941a5);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x79')]=function(_0x10acb2,_0x16643e){scripts['ispeechTTS'](_0x10acb2['key'],_0x10acb2['text'],_0x10acb2[_0x76aa('0x7a')]||'en-US',_0x10acb2[_0x76aa('0x7b')])[_0x76aa('0x11')](function(_0x5f3c24){_0x16643e(null,_0x5f3c24);})[_0x76aa('0x12')](function(_0x33781c){_0x16643e(_0x33781c);});};AGIVertices['prototype'][_0x76aa('0x7c')]=function(_0x238832,_0x41200c,_0xb766ec){scripts[_0x76aa('0x7c')](_0x41200c,_0x238832[_0x76aa('0x7d')],_0x238832['ispeech_asr_language']||_0x76aa('0x5a'),this['isConfigured'](_0x238832['model'])?_0x238832['model']:undefined)['then'](function(_0x519359){_0xb766ec(null,_0x519359);})[_0x76aa('0x12')](function(_0x11f59f){_0xb766ec(_0x11f59f);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x7e')]=function(_0x47c0de,_0x447103){scripts[_0x76aa('0x7e')](_0x47c0de[_0x76aa('0x7f')],_0x47c0de[_0x76aa('0x80')],_0x47c0de[_0x76aa('0x81')],_0x47c0de['aws_polly_voice']||_0x76aa('0x82'),_0x47c0de[_0x76aa('0x58')],_0x47c0de[_0x76aa('0x83')]||_0x76aa('0x58'))[_0x76aa('0x11')](function(_0x40f4a3){_0x447103(null,_0x40f4a3);})[_0x76aa('0x12')](function(_0x5aef82){_0x447103(_0x5aef82);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x84')]=function(_0x537917,_0x5c523b){scripts[_0x76aa('0x84')](this[_0x76aa('0x34')]['uniqueid'],_0x537917[_0x76aa('0x7f')],_0x537917['aws_secret_access_key'],_0x537917[_0x76aa('0x85')],_0x537917['text'],_0x537917[_0x76aa('0x86')])[_0x76aa('0x11')](function(_0x45227e){_0x5c523b(null,_0x45227e);})[_0x76aa('0x12')](function(_0x3d392d){_0x5c523b(_0x3d392d);});};AGIVertices['prototype'][_0x76aa('0x87')]=function(_0x54bfd7,_0x1af32e,_0x9b5fbb){scripts['googleASR'](_0x1af32e,_0x54bfd7['key'],_0x54bfd7[_0x76aa('0x88')]||_0x76aa('0x5a'))[_0x76aa('0x11')](function(_0x238818){_0x9b5fbb(null,_0x238818);})['catch'](function(_0x5a1577){_0x9b5fbb(_0x5a1577);});};AGIVertices[_0x76aa('0xe')]['tildeASR']=function(_0x3c928d,_0x5d18f8,_0x45b761){scripts[_0x76aa('0x89')](_0x5d18f8,_0x3c928d['appid'],_0x3c928d[_0x76aa('0x8a')],_0x3c928d['uri'])['then'](function(_0x32fe97){_0x45b761(null,_0x32fe97);})[_0x76aa('0x12')](function(_0x517096){_0x45b761(_0x517096);});};AGIVertices[_0x76aa('0xe')][_0x76aa('0x8b')]=function(_0x12cd19){var _0x52762c=_[_0x76aa('0x8c')](verticesWithRetry,_0x12cd19[_0x76aa('0x37')])?_0x12cd19:_[_0x76aa('0x8d')](_0x12cd19);for(var _0x1fc2f2 in _0x52762c){if(_0x52762c[_0x76aa('0x8e')](_0x1fc2f2)){if(_0x52762c[_0x1fc2f2]&&_[_0x76aa('0x8f')](_0x52762c[_0x1fc2f2])){if(_[_0x76aa('0x8c')](recursiveMapAttributes,_0x1fc2f2)){_0x52762c[_0x1fc2f2]=this[_0x76aa('0x90')](_0x52762c[_0x1fc2f2]);}else{_0x52762c[_0x1fc2f2]=this[_0x76aa('0x91')](_0x52762c[_0x1fc2f2]);}}}}return _0x52762c;};AGIVertices[_0x76aa('0xe')][_0x76aa('0x92')]=function(_0x3d21e4){for(var _0x488150 in _0x3d21e4){if(_0x3d21e4[_0x76aa('0x8e')](_0x488150)){if(_[_0x76aa('0x93')](_0x3d21e4[_0x488150])){this['recursiveNodeIndex'](_0x3d21e4[_0x488150]);}else if(_[_0x76aa('0x94')](_0x3d21e4[_0x488150])){for(var _0x1d165c=0x0;_0x1d165c<_0x3d21e4[_0x488150]['length'];_0x1d165c++){this['recursiveNodeIndex'](_0x3d21e4[_0x488150][_0x1d165c]);}}else if(_[_0x76aa('0x8f')](_0x3d21e4[_0x488150])){_0x3d21e4[_0x488150]=this[_0x76aa('0x91')](_0x3d21e4[_0x488150]);}}}};AGIVertices['prototype'][_0x76aa('0x95')]=function(_0x429500,_0x24af48){for(var _0x5010c8 in _0x429500){if(_0x429500[_0x76aa('0x8e')](_0x5010c8)){if(_[_0x76aa('0x93')](_0x429500[_0x5010c8])){if(!_['isEmpty'](_0x429500[_0x5010c8])){this[_0x76aa('0x95')](_0x429500[_0x5010c8],util[_0x76aa('0x27')](_0x76aa('0x96'),_0x24af48,_0x5010c8));}}else if(_[_0x76aa('0x94')](_0x429500[_0x5010c8])){for(var _0x2f7f2a=0x0;_0x2f7f2a<_0x429500[_0x5010c8][_0x76aa('0x97')];_0x2f7f2a++){this['saveRestApiResult'](_0x429500[_0x5010c8][_0x2f7f2a],util[_0x76aa('0x27')]('%s.%s',_0x24af48,_0x5010c8+'['+_0x2f7f2a+']'));}}else{if(!_[_0x76aa('0x41')](_0x429500[_0x5010c8])){this[_0x76aa('0x34')][_0x76aa('0x98')](util['format']('%s.%s',_0x24af48,_0x5010c8),_0x429500[_0x5010c8]);}}}}};AGIVertices[_0x76aa('0xe')][_0x76aa('0x90')]=function(_0x19982e){try{var _0xa6fd62=JSON[_0x76aa('0x67')](_0x19982e);this[_0x76aa('0x92')](_0xa6fd62);return JSON['stringify'](_0xa6fd62);}catch(_0x5a4c03){return this[_0x76aa('0x91')](_0x19982e);}};AGIVertices[_0x76aa('0xe')][_0x76aa('0x91')]=function(_0x46614f){var _0x507d7f=_0x46614f[_0x76aa('0x99')]('{');for(var _0x5a6d82=0x1;_0x5a6d82<_0x507d7f['length'];_0x5a6d82+=0x1){var _0x4bc8e3=_0x507d7f[_0x5a6d82][_0x76aa('0x99')]('}');if(_0x4bc8e3[_0x76aa('0x97')]>0x1){_0x46614f=_0x46614f['replaceAll']('{'+_0x4bc8e3[0x0]+'}',this[_0x76aa('0x34')][_0x76aa('0xf')](_0x4bc8e3[0x0])[_0x76aa('0x9a')]||_0x4bc8e3[0x0]);}}if(_0x507d7f[_0x76aa('0x97')]===0x1){return _0x46614f[_0x76aa('0x48')]();}return this[_0x76aa('0x91')](_0x46614f);};AGIVertices[_0x76aa('0xe')]['getAndSetVariable']=function(_0x344ea4,_0x2a3bbf){var _0x212adb=this[_0x76aa('0x34')][_0x76aa('0xf')](_0x344ea4);if(_0x212adb[_0x76aa('0x9b')]===-0x1){return _0x212adb;}logger['info'](util[_0x76aa('0x27')](_0x76aa('0x9c'),_0x2a3bbf,_0x212adb[_0x76aa('0x9a')]));return this[_0x76aa('0x34')]['setVariable'](_0x2a3bbf,_0x212adb[_0x76aa('0x9a')]);};AGIVertices[_0x76aa('0xe')][_0x76aa('0x9d')]=function(_0x3e837d){return _0x3e837d&&_0x3e837d!=='0'&&_0x3e837d!=='-1'&&_0x3e837d!=='';};AGIVertices[_0x76aa('0xe')]['maxRetry']=function(_0x203bc2){this[_0x76aa('0x9e')]['sync'](this,_0x203bc2,'-');_0x203bc2['retry']=_0x203bc2[_0x76aa('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x76aa('0xe')][_0x76aa('0xa0')]=function(_0x461075){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x461075[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x461075[_0x76aa('0x58')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xa2'));}var _0x59c946='\x22'+_0x461075[_0x76aa('0x58')]+'\x22';if(this[_0x76aa('0x9d')](_0x461075[_0x76aa('0x71')])){_0x59c946+=','+_0x461075[_0x76aa('0x71')];}var _0x42d71d=this[_0x76aa('0x34')]['exec'](_0x76aa('0xa3'),_0x59c946);if(_0x42d71d['result']===-0x1){return _0x42d71d;}return this[_0x76aa('0x34')]['noop'](util[_0x76aa('0x27')](_0x76aa('0xa4'),_0x59c946));};AGIVertices['prototype'][_0x76aa('0xa5')]=function(_0x85a254){logger[_0x76aa('0x2d')](util['format'](_0x76aa('0xa6'),_0x85a254[_0x76aa('0x36')]));if(!this['isConfigured'](_0x85a254[_0x76aa('0xa7')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xa8'));}var _0x3b9ed5=_0x85a254[_0x76aa('0xa7')];if(this['isConfigured'](_0x85a254[_0x76aa('0x71')])){_0x3b9ed5+=','+_0x85a254[_0x76aa('0x71')];}var _0x3de02b=this[_0x76aa('0x34')][_0x76aa('0x54')](_0x76aa('0xa9'),_0x3b9ed5);if(_0x3de02b[_0x76aa('0x9b')]===-0x1){return _0x3de02b;}var _0x6962da=this[_0x76aa('0xaa')](_0x76aa('0xab'),_0x76aa('0xac'));if(_0x6962da['result']===-0x1){return _0x6962da;}var _0x219e47=this[_0x76aa('0xaa')](_0x76aa('0xad'),_0x76aa('0xae'));if(_0x219e47[_0x76aa('0x9b')]===-0x1){return _0x219e47;}var _0x81b7ea=this[_0x76aa('0xaa')](_0x76aa('0xaf'),'MRCP_RECOG_INSTANCE');if(_0x81b7ea[_0x76aa('0x9b')]===-0x1){return _0x81b7ea;}return this['channel'][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xb0'),_0x3b9ed5));};AGIVertices['prototype'][_0x76aa('0x7')]=function(_0x41316b){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0xb1'),_0x41316b['label']));return this[_0x76aa('0x34')]['agi']([_0x41316b[_0x76aa('0xb2')],_0x41316b[_0x76aa('0xb3')]]);};AGIVertices['prototype'][_0x76aa('0xb4')]=function(_0x20fb0a){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0xb5'),_0x20fb0a[_0x76aa('0x36')]));if(this[_0x76aa('0x9d')](_0x20fb0a[_0x76aa('0x63')])){logger['info'](util[_0x76aa('0x27')](_0x76aa('0xb6'),_0x20fb0a[_0x76aa('0x63')]));var _0x2be7da=this[_0x76aa('0x34')][_0x76aa('0xb7')](_0x20fb0a[_0x76aa('0x63')]);if(_0x2be7da[_0x76aa('0x9b')]===-0x1){return _0x2be7da;}}return this['channel'][_0x76aa('0xb4')]();};AGIVertices[_0x76aa('0xe')][_0x76aa('0x46')]=function(_0x54e450){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0xb8'),_0x54e450[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x54e450['list_id'])){return this[_0x76aa('0x34')]['error'](_0x54e450,_0x76aa('0xb9'));}_0x54e450[_0x76aa('0xba')]=moment();if(this[_0x76aa('0x9d')](_0x54e450[_0x76aa('0xbb')])){_0x54e450[_0x76aa('0xba')]=moment()['add'](_0x54e450[_0x76aa('0xbb')],'minutes');}if(!this[_0x76aa('0x9d')](_0x54e450[_0x76aa('0x49')])){_0x54e450[_0x76aa('0x49')]=0x2;}this['createCmContact'][_0x76aa('0xbc')](this,_0x54e450);return this['channel'][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xbd'),_0x54e450[_0x76aa('0x44')],_0x54e450[_0x76aa('0x45')],_0x54e450[_0x76aa('0xba')]));};AGIVertices['prototype'][_0x76aa('0xbe')]=function(_0x195e95){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0xbf'),_0x195e95[_0x76aa('0x36')]));var _0xbfa5f8=this[_0x76aa('0x34')][_0x76aa('0x54')](_0x195e95[_0x76aa('0xc0')],_0x195e95[_0x76aa('0x71')]);if(_0xbfa5f8[_0x76aa('0x9b')]===-0x1){return _0xbfa5f8;}return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xc1'),_0x195e95[_0x76aa('0xc0')],_0x195e95[_0x76aa('0x71')]));};AGIVertices['prototype'][_0x76aa('0xc2')]=function(_0x4a9fd7){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4a9fd7[_0x76aa('0x36')]));if(!this['isConfigured'](_0x4a9fd7[_0x76aa('0x58')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')]('no\x20text\x20configured');}var _0x2e6093='\x22'+_0x4a9fd7['text']+'\x22';if(this['isConfigured'](_0x4a9fd7[_0x76aa('0x71')])){_0x2e6093+=','+_0x4a9fd7['options'];}var _0x85012d=this['channel']['exec'](_0x76aa('0xa3'),_0x2e6093);if(_0x85012d[_0x76aa('0x9b')]===-0x1){return _0x85012d;}return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xa4'),_0x2e6093));};AGIVertices[_0x76aa('0xe')][_0x76aa('0xc3')]=function(_0x334615){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0xc4'),_0x334615[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x334615['text'])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xa2'));}var _0x1fe2c7='\x22'+_0x334615['text']+'\x22';if(this[_0x76aa('0x9d')](_0x334615['options'])){_0x1fe2c7+=','+_0x334615[_0x76aa('0x71')];}var _0x4dc018=this[_0x76aa('0x34')]['exec'](_0x76aa('0xa3'),_0x1fe2c7);if(_0x4dc018['result']===-0x1){return _0x4dc018;}return this[_0x76aa('0x34')]['noop'](util[_0x76aa('0x27')](_0x76aa('0xa4'),_0x1fe2c7));};AGIVertices['prototype'][_0x76aa('0xc5')]=function(_0x51feca){logger[_0x76aa('0x2d')](util['format'](_0x76aa('0xc6'),_0x51feca['label']));if(!this['isConfigured'](_0x51feca[_0x76aa('0xa7')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xa8'));}var _0x1f56f6=_0x51feca[_0x76aa('0xa7')];if(this[_0x76aa('0x9d')](_0x51feca[_0x76aa('0x71')])){_0x1f56f6+=','+_0x51feca[_0x76aa('0x71')];}var _0xca1831=this['channel'][_0x76aa('0x54')](_0x76aa('0xa9'),_0x1f56f6);if(_0xca1831[_0x76aa('0x9b')]===-0x1){return _0xca1831;}var _0x7121d6=this[_0x76aa('0xaa')](_0x76aa('0xab'),_0x76aa('0xc7'));if(_0x7121d6[_0x76aa('0x9b')]===-0x1){return _0x7121d6;}var _0x1cb8ad=this[_0x76aa('0xaa')](_0x76aa('0xad'),_0x76aa('0xc8'));if(_0x1cb8ad[_0x76aa('0x9b')]===-0x1){return _0x1cb8ad;}var _0x1d4f1c=this['getAndSetVariable']('RECOG_INSTANCE()',_0x76aa('0xc9'));if(_0x1d4f1c[_0x76aa('0x9b')]===-0x1){return _0x1d4f1c;}return this[_0x76aa('0x34')]['noop'](util['format'](_0x76aa('0xb0'),_0x1f56f6));};AGIVertices[_0x76aa('0xe')][_0x76aa('0xca')]=function(_0x580390){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x580390['label']));if(!this['isConfigured'](_0x580390[_0x76aa('0xa7')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')]('no\x20grammar\x20configured');}var _0x21ec5a=_0x580390[_0x76aa('0xa7')];if(this['isConfigured'](_0x580390['options'])){_0x21ec5a+=','+_0x580390[_0x76aa('0x71')];}var _0x31d0a4=this[_0x76aa('0x34')]['exec'](_0x76aa('0xa9'),_0x21ec5a);if(_0x31d0a4[_0x76aa('0x9b')]===-0x1){return _0x31d0a4;}var _0x546770=this[_0x76aa('0xaa')](_0x76aa('0xab'),'SESTEK_ASR_CONFIDENCE');if(_0x546770[_0x76aa('0x9b')]===-0x1){return _0x546770;}var _0x347211=this['getAndSetVariable'](_0x76aa('0xad'),'SESTEK_ASR_TRANSCRIPT');if(_0x347211['result']===-0x1){return _0x347211;}var _0x159215=this[_0x76aa('0xaa')](_0x76aa('0xaf'),_0x76aa('0xcb'));if(_0x159215[_0x76aa('0x9b')]===-0x1){return _0x159215;}return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xb0'),_0x21ec5a));};AGIVertices[_0x76aa('0xe')]['database']=function(_0x539e4d){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0xcc'),_0x539e4d[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x539e4d[_0x76aa('0xcd')])){return this['channel'][_0x76aa('0x29')](_0x539e4d,_0x76aa('0xce'));}var _0x17f15e=this[_0x76aa('0xcf')][_0x76aa('0xbc')](this,_0x539e4d[_0x76aa('0xcd')]);if(!_0x17f15e){return this[_0x76aa('0x34')]['error'](_0x539e4d,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x539e4d[_0x76aa('0x2c')])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x539e4d,_0x76aa('0xd0'));}var _0x25188a=_0x539e4d['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xd1'),_0x25188a));var _0xe6e51a=this['getQueryOdbc'][_0x76aa('0xbc')](this,_0x17f15e,_0x25188a);this['createSquareDetailsReport'][_0x76aa('0xbc')](this,_0x539e4d,_0x25188a);if(!this['isConfigured'](_0x539e4d['variable_id'])){return this[_0x76aa('0x34')]['noop'](_0x76aa('0xd2'));}var _0x419c5c=this[_0x76aa('0xf')][_0x76aa('0xbc')](this,_0x539e4d[_0x76aa('0xd3')]);if(!_0x419c5c){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x539e4d,_0x76aa('0xd4'));}var _0x5db468=this;_0xe6e51a[_0x76aa('0xd5')](function(_0x37fba1,_0x3ab5c6){Object[_0x76aa('0xd6')](_0x37fba1)[_0x76aa('0xd5')](function(_0x4e9063){_0x5db468[_0x76aa('0x34')]['setVariable'](util[_0x76aa('0x27')]('%s[%s][%s]',_0x419c5c,_0x3ab5c6,_0x4e9063),_0x37fba1[_0x4e9063]);});});this[_0x76aa('0x34')]['setVariable'](util[_0x76aa('0x27')]('%s_ROWS_COUNT',_0x419c5c),_0xe6e51a[_0x76aa('0x97')]);return this[_0x76aa('0x34')][_0x76aa('0xa1')](util['format']('variable\x20%s\x20set',_0x419c5c));};AGIVertices[_0x76aa('0xe')]['dial']=function(_0x36c7ff){logger[_0x76aa('0xd7')](util[_0x76aa('0x27')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x36c7ff['label']));if(!this['isConfigured'](_0x36c7ff['sip_id'])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x36c7ff,_0x76aa('0xd8'));}var _0x1ef07e=this[_0x76aa('0x19')][_0x76aa('0xbc')](this,_0x36c7ff[_0x76aa('0xd9')]);if(!_0x1ef07e){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x36c7ff,_0x76aa('0xda'));}var _0x2484fd=this[_0x76aa('0x34')][_0x76aa('0x54')]('DIAL',[util[_0x76aa('0x27')]('SIP/%s',_0x1ef07e),_0x36c7ff[_0x76aa('0x63')],_0x36c7ff[_0x76aa('0xdb')],_0x36c7ff[_0x76aa('0x61')]]);if(_0x2484fd[_0x76aa('0x9b')]===-0x1){return _0x2484fd;}return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xdc'),_0x76aa('0xdd')));};AGIVertices[_0x76aa('0xe')][_0x76aa('0xde')]=function(_0x50f9a4){logger['info'](util[_0x76aa('0x27')](_0x76aa('0xdf'),_0x50f9a4['label']));if(!this[_0x76aa('0x9d')](_0x50f9a4[_0x76aa('0x7d')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xe0'));}if(!this[_0x76aa('0x9d')](_0x50f9a4[_0x76aa('0x58')])){return this['channel'][_0x76aa('0xa1')](_0x76aa('0xa2'));}this['channel']['bot']=!![];this[_0x76aa('0x9e')](_0x50f9a4);this[_0x76aa('0x3e')](_0x50f9a4[_0x76aa('0x58')],'in','','');this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xe1'),_0x50f9a4[_0x76aa('0x58')]));var _0x3b6241=this[_0x76aa('0x72')][_0x76aa('0xbc')](this,_0x50f9a4);if(_0x3b6241){for(var _0x1cf023 in _0x3b6241){if(_0x3b6241[_0x76aa('0x8e')](_0x1cf023)){this['channel']['setVariable'](util[_0x76aa('0x27')](_0x76aa('0xe2'),_0x1cf023[_0x76aa('0xe3')]()),_0x3b6241[_0x1cf023]);}}this[_0x76aa('0x3e')](_0x3b6241['speech'],'out',_0x76aa('0xde'),'');return this[_0x76aa('0x34')][_0x76aa('0xa1')](util['format']('Dialogflow\x20Result\x20%s',_0x3b6241['speech']));}return this[_0x76aa('0x34')]['error'](_0x50f9a4,_0x76aa('0xe4'));};AGIVertices[_0x76aa('0xe')][_0x76aa('0xe5')]=function(_0x22f2cd){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0xe6'),_0x22f2cd[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x22f2cd[_0x76aa('0x75')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xe7'));}if(!this[_0x76aa('0x9d')](_0x22f2cd[_0x76aa('0x76')])){return this[_0x76aa('0x34')]['noop'](_0x76aa('0xe8'));}if(!this['isConfigured'](_0x22f2cd[_0x76aa('0xe9')])){return this['channel'][_0x76aa('0xa1')]('no\x20private_key\x20configured');}if(!this[_0x76aa('0x9d')](_0x22f2cd['dialogflowV2_language'])){return this['channel'][_0x76aa('0xa1')](_0x76aa('0xea'));}if(!this[_0x76aa('0x9d')](_0x22f2cd[_0x76aa('0x58')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')]('no\x20text\x20configured');}this[_0x76aa('0x34')][_0x76aa('0xeb')]=!![];this[_0x76aa('0x9e')](_0x22f2cd);this[_0x76aa('0x3e')](_0x22f2cd['text'],'in','','');this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xec'),_0x22f2cd[_0x76aa('0x58')]));var _0x106e9a=this[_0x76aa('0x74')][_0x76aa('0xbc')](this,_0x22f2cd);if(_0x106e9a){for(var _0x364dcf in _0x106e9a){if(_0x106e9a[_0x76aa('0x8e')](_0x364dcf)){if(_0x364dcf!==_0x76aa('0xed')){this[_0x76aa('0x34')]['setVariable'](util['format'](_0x76aa('0xe2'),_0x364dcf[_0x76aa('0xe3')]()),_0x106e9a[_0x364dcf]);}}}this[_0x76aa('0x3e')](_0x106e9a[_0x76aa('0xee')],_0x76aa('0xef'),_0x76aa('0xe5'),_0x106e9a[_0x76aa('0xed')]);return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xf0'),_0x106e9a['speech']));}return this[_0x76aa('0x34')]['error'](_0x22f2cd,_0x76aa('0xf1'));};AGIVertices[_0x76aa('0xe')][_0x76aa('0xf2')]=function(_0x14256c){logger[_0x76aa('0x2d')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x14256c[_0x76aa('0x36')]));if(!this['isConfigured'](_0x14256c[_0x76aa('0xf3')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xf4'));}if(!this[_0x76aa('0x9d')](_0x14256c['username'])){return this['channel'][_0x76aa('0xa1')](_0x76aa('0xf5'));}if(!this[_0x76aa('0x9d')](_0x14256c[_0x76aa('0xf6')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xf7'));}if(!this[_0x76aa('0x9d')](_0x14256c[_0x76aa('0xf8')])){return this[_0x76aa('0x34')]['noop'](_0x76aa('0xa2'));}this[_0x76aa('0x34')]['bot']=!![];this[_0x76aa('0x9e')](_0x14256c);this[_0x76aa('0x3e')](_0x14256c[_0x76aa('0x58')],'in','','');this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xf9'),_0x14256c['text']));var _0x3c2089=this[_0x76aa('0x78')][_0x76aa('0xbc')](this,_0x14256c);if(_0x3c2089){for(var _0x2f2a27 in _0x3c2089){if(_0x3c2089['hasOwnProperty'](_0x2f2a27)){this[_0x76aa('0x34')][_0x76aa('0x98')](util[_0x76aa('0x27')](_0x76aa('0xfa'),_0x2f2a27[_0x76aa('0xe3')]()),_0x3c2089[_0x2f2a27]);}}this[_0x76aa('0x3e')](_0x3c2089[_0x76aa('0xee')],_0x76aa('0xef'),_0x76aa('0xf2'),'');if(_0x3c2089[_0x76aa('0xfb')]){this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xfc'),_0x3c2089['audiofile']));var _0x52bea1=this[_0x76aa('0x34')][_0x76aa('0xfd')](_0x3c2089['audiofile']);try{fs[_0x76aa('0xfe')](_0x3c2089['audiofile']+_0x76aa('0xff'));}catch(_0x2e9c1a){logger[_0x76aa('0x29')](_0x2e9c1a);}return _0x52bea1;}else{return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x100'),_0x3c2089[_0x76aa('0xee')]));}}return this['channel'][_0x76aa('0x29')](_0x14256c,_0x76aa('0x101'));};AGIVertices['prototype']['end']=function(_0x19cf37){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x102'),_0x19cf37[_0x76aa('0x36')]));return this['channel'][_0x76aa('0xa1')]('end');};AGIVertices[_0x76aa('0xe')][_0x76aa('0x103')]=function(_0x33e5f0){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x104'),_0x33e5f0[_0x76aa('0x36')]));var _0x3ce540='';if(_0x33e5f0[_0x76aa('0x105')]){if(!this[_0x76aa('0x9d')](_0x33e5f0[_0x76aa('0x105')])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x33e5f0,'no\x20trunk\x20selected');}else{var _0x4236bb=parseInt(_0x33e5f0['trunk_id'],0xa);if(isNaN(_0x4236bb)){_0x3ce540=_0x33e5f0['trunk_id'];}else{_0x3ce540=this['getTrunk'][_0x76aa('0xbc')](this,_0x33e5f0['trunk_id']);if(!_0x3ce540){return this['channel']['error'](_0x33e5f0,'no\x20trunk\x20found');}}}}else if(_0x33e5f0[_0x76aa('0x106')]){_0x3ce540=_0x33e5f0[_0x76aa('0x106')];}else{return this['channel'][_0x76aa('0x29')](_0x33e5f0,_0x76aa('0x107'));}var _0x70ce1=this['channel']['exec']('DIAL',[util[_0x76aa('0x27')]('SIP/%s/%s',_0x3ce540,_0x33e5f0[_0x76aa('0x44')]),_0x33e5f0[_0x76aa('0x63')],_0x33e5f0['opts'],_0x33e5f0[_0x76aa('0x61')]]);if(_0x70ce1[_0x76aa('0x9b')]===-0x1){return _0x70ce1;}return this['channel'][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0xdc'),_0x76aa('0xdd')));};AGIVertices[_0x76aa('0xe')][_0x76aa('0x108')]=function(_0x26c6c8){logger[_0x76aa('0x2d')](util['format'](_0x76aa('0x109'),_0x26c6c8[_0x76aa('0x36')]));return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x108'));};AGIVertices[_0x76aa('0xe')][_0x76aa('0xb')]=function(_0x3271a5){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3271a5[_0x76aa('0x36')]));if(_0x3271a5[_0x76aa('0x10a')]===0x0){return this[_0x76aa('0x9f')](_0x3271a5);}_0x3271a5['retry']-=0x1;if(!this['isConfigured'](_0x3271a5['file_id'])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x3271a5,'no\x20file\x20audio\x20selected');}var _0x1fb2ad=this['getSound']['sync'](this,_0x3271a5[_0x76aa('0x10b')]);if(!_0x1fb2ad){return this[_0x76aa('0x34')]['error'](_0x3271a5,_0x76aa('0x10c'));}if(!this[_0x76aa('0x9d')](_0x3271a5[_0x76aa('0xd3')])){return this['channel'][_0x76aa('0x29')](_0x76aa('0xd2'));}var _0x44ed9a=this[_0x76aa('0x34')][_0x76aa('0x10d')](_0x1fb2ad,_0x3271a5[_0x76aa('0x10e')],_0x3271a5[_0x76aa('0x10f')]);var _0x29edc7=_0x44ed9a[_0x76aa('0x9b')]?_0x44ed9a[_0x76aa('0x9b')][_0x76aa('0x48')]():'';logger['info'](_0x76aa('0x110'),JSON[_0x76aa('0x6e')](_0x44ed9a));if(_0x44ed9a[_0x76aa('0x9b')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x3271a5,_0x29edc7);return _0x44ed9a;}else if(_0x44ed9a[_0x76aa('0x9a')]===_0x76aa('0x63')){_0x44ed9a[_0x76aa('0x9b')]=_0x29edc7['length']>=parseInt(_0x3271a5[_0x76aa('0x111')])?'x':'i';}else{_0x44ed9a[_0x76aa('0x9b')]=_0x29edc7[_0x76aa('0x97')]>=parseInt(_0x3271a5[_0x76aa('0x111')])&&_0x29edc7[_0x76aa('0x97')]<=parseInt(_0x3271a5[_0x76aa('0x10f')])?'x':'i';}var _0x353fef=this[_0x76aa('0xf')][_0x76aa('0xbc')](this,_0x3271a5[_0x76aa('0xd3')]);if(!_0x353fef){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x3271a5,_0x76aa('0xd4'));}this[_0x76aa('0x34')]['setVariable'](_0x353fef,_0x29edc7);if(this[_0x76aa('0x9d')](_0x3271a5['hiddendigitsnum'])){var _0xe9987d=parseInt(_0x3271a5['hiddendigitsnum'],0xa);var _0x452a57=rs[_0x76aa('0x112')]({'charset':'*','length':_0xe9987d});var _0x1420c4=_0x29edc7['length'];if(_0x1420c4>0x0){if(_0x1420c4>_0xe9987d){this[_0x76aa('0x9e')][_0x76aa('0xbc')](this,_0x3271a5,_0x3271a5[_0x76aa('0x113')]===_0x76aa('0x114')?_0x452a57+_0x29edc7[_0x76aa('0x115')](_0xe9987d):_0x29edc7[_0x76aa('0x115')](0x0,_0x1420c4-_0xe9987d)+_0x452a57);}else{this['createSquareDetailsReport']['sync'](this,_0x3271a5,rs[_0x76aa('0x112')]({'charset':'*','length':_0x1420c4}));}}else{this[_0x76aa('0x9e')][_0x76aa('0xbc')](this,_0x3271a5,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x3271a5,_0x29edc7);}return _0x44ed9a;};AGIVertices[_0x76aa('0xe')][_0x76aa('0x116')]=function(_0x1fdbca){logger['info'](util['format'](_0x76aa('0x117'),_0x1fdbca[_0x76aa('0x36')]));return this[_0x76aa('0xb')](_0x1fdbca);};AGIVertices[_0x76aa('0xe')][_0x76aa('0x118')]=function(_0x2ebf47){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x2ebf47[_0x76aa('0x36')]));this[_0x76aa('0x9e')][_0x76aa('0xbc')](this,_0x2ebf47,_0x2ebf47['goalname']);return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')]('GOAL\x20%s',_0x2ebf47['goalname']));};AGIVertices[_0x76aa('0xe')]['awspolly']=function(_0x405c3a){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x119'),_0x405c3a['label']));if(!this['isConfigured'](_0x405c3a[_0x76aa('0x7f')])||!this[_0x76aa('0x9d')](_0x405c3a[_0x76aa('0x80')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x11a'));}if(!this['isConfigured'](_0x405c3a[_0x76aa('0x58')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')]('no\x20text\x20configured');}this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')]('Trying\x20aws\x20Polly\x20%s',_0x405c3a[_0x76aa('0x58')]));var _0x547766=this['awsPolly'][_0x76aa('0xbc')](this,_0x405c3a);if(_0x547766){this[_0x76aa('0x34')][_0x76aa('0xa1')](util['format'](_0x76aa('0x11b'),_0x547766));var _0x4b198e=this[_0x76aa('0x34')][_0x76aa('0xfd')](_0x547766);try{fs['unlink'](_0x547766+_0x76aa('0xff'));}catch(_0x4806d5){logger['error'](_0x4806d5);}return _0x4b198e;}return this['channel'][_0x76aa('0x29')](_0x405c3a,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x76aa('0xe')]['awslex']=function(_0x51d54c){logger[_0x76aa('0x2d')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x51d54c[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x51d54c[_0x76aa('0x7f')])||!this[_0x76aa('0x9d')](_0x51d54c[_0x76aa('0x80')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x51d54c[_0x76aa('0x86')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x11c'));}if(!this[_0x76aa('0x9d')](_0x51d54c[_0x76aa('0x58')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xa2'));}this['channel']['bot']=!![];this[_0x76aa('0x9e')](_0x51d54c);this[_0x76aa('0x3e')](_0x51d54c[_0x76aa('0x58')],'in','','');this[_0x76aa('0x34')]['noop'](util['format'](_0x76aa('0x11d'),_0x51d54c['text']));var _0x28c627=this[_0x76aa('0x84')]['sync'](this,_0x51d54c);if(_0x28c627){for(var _0x71483 in _0x28c627){if(_0x28c627[_0x76aa('0x8e')](_0x71483)&&_[_0x76aa('0x8f')](_0x28c627[_0x71483])){this[_0x76aa('0x34')][_0x76aa('0x98')](util['format'](_0x76aa('0x11e'),_0x71483[_0x76aa('0xe3')]()),_0x28c627[_0x71483]);}}if(_['isNil'](_0x28c627['message'])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x11f'));}else{this[_0x76aa('0x3e')](_0x28c627[_0x76aa('0x6f')],_0x76aa('0xef'),_0x76aa('0x120'),'');return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x121'),_0x28c627['message']));}}return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x51d54c,_0x76aa('0x122'));};AGIVertices[_0x76aa('0xe')]['googleasr']=function(_0x5392a3){logger['info'](util['format'](_0x76aa('0x123'),_0x5392a3[_0x76aa('0x36')],_0x5392a3[_0x76aa('0x63')]));if(!this[_0x76aa('0x9d')](_0x5392a3[_0x76aa('0x7d')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')]('no\x20key\x20configured');}var _0x4ab296=_0x76aa('0x124');var _0x499a12=util[_0x76aa('0x27')](_0x76aa('0x125'),FILES_PATH,rs[_0x76aa('0x112')](0x4));var _0x5e3622=util[_0x76aa('0x27')](_0x76aa('0x96'),_0x499a12,_0x4ab296);var _0x29e112=!![];if(_0x5392a3[_0x76aa('0x126')]==='NOBEEP'){_0x29e112=![];}var _0x220744=this[_0x76aa('0x34')][_0x76aa('0x127')](_0x499a12,_0x4ab296,_0x5392a3['intKey'],_0x5392a3[_0x76aa('0x63')],undefined,_0x29e112);if(_0x220744[_0x76aa('0x9b')]!==-0x1){this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x128'),_0x5e3622));var _0x158b65=this['googleASR']['sync'](this,_0x5392a3,_0x5e3622);if(_0x158b65){for(var _0x72b9a in _0x158b65){if(_0x158b65[_0x76aa('0x8e')](_0x72b9a)){this[_0x76aa('0x34')][_0x76aa('0x98')](util[_0x76aa('0x27')](_0x76aa('0x129'),_0x72b9a[_0x76aa('0xe3')]()),_0x158b65[_0x72b9a]);}}return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x12a'),JSON[_0x76aa('0x6e')](_0x158b65)));}}return _0x220744;};AGIVertices[_0x76aa('0xe')][_0x76aa('0x12b')]=function(_0x1d5b00){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x12c'),_0x1d5b00[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x1d5b00[_0x76aa('0x12d')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x12e'));}if(!this[_0x76aa('0x9d')](_0x1d5b00[_0x76aa('0x8a')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')]('no\x20appsecret\x20configured');}var _0x4588c5=_0x76aa('0x124');var _0xd6cdd3=util[_0x76aa('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x76aa('0x112')](0x4));var _0x30dab8=util[_0x76aa('0x27')]('%s.%s',_0xd6cdd3,_0x4588c5);var _0x252d37=!![];if(_0x1d5b00[_0x76aa('0x126')]==='NOBEEP'){_0x252d37=![];}var _0x3a86cd=this['channel'][_0x76aa('0x127')](_0xd6cdd3,_0x4588c5,_0x1d5b00[_0x76aa('0x12f')],_0x1d5b00[_0x76aa('0x63')],undefined,_0x252d37);if(_0x3a86cd[_0x76aa('0x9b')]!==-0x1){this['channel'][_0x76aa('0xa1')](util['format'](_0x76aa('0x130'),_0x30dab8));var _0x5eb2b9=this[_0x76aa('0x89')]['sync'](this,_0x1d5b00,_0x30dab8);if(_0x5eb2b9){for(var _0x41df74 in _0x5eb2b9){if(_0x5eb2b9[_0x76aa('0x8e')](_0x41df74)){this[_0x76aa('0x34')][_0x76aa('0x98')](util[_0x76aa('0x27')](_0x76aa('0x131'),_0x41df74['toUpperCase']()),_0x5eb2b9[_0x41df74]);}}return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x132'),JSON['stringify'](_0x5eb2b9)));}}return _0x3a86cd;};AGIVertices[_0x76aa('0xe')][_0x76aa('0x133')]=function(_0x506cad){logger['info'](util[_0x76aa('0x27')](_0x76aa('0x134'),_0x506cad[_0x76aa('0x36')]));return this[_0x76aa('0x34')]['continueAt'](_0x506cad['context'],_0x506cad[_0x76aa('0x135')],_0x506cad[_0x76aa('0x3b')]);};AGIVertices[_0x76aa('0xe')][_0x76aa('0x136')]=function(_0x4b05fa){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x137'),_0x4b05fa[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x4b05fa['condition'])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x4b05fa,_0x76aa('0x138'));}try{var _0x35a411=eval(_0x4b05fa[_0x76aa('0x139')])?_0x76aa('0x13a'):_0x76aa('0x13b');this[_0x76aa('0x34')]['noop'](util[_0x76aa('0x27')](_0x76aa('0x13c'),_0x4b05fa[_0x76aa('0x139')],_0x35a411));return{'code':0xc8,'result':_0x35a411};}catch(_0x1cd01e){return{'code':0xc8,'result':_0x76aa('0x13b')};}};AGIVertices['prototype'][_0x76aa('0x13d')]=function(_0x29f36c){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x13e'),_0x29f36c[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x29f36c[_0x76aa('0x13f')])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x29f36c,'no\x20interval\x20configured');}var _0x4d2c63=this['getIntervals'][_0x76aa('0xbc')](this,_0x29f36c[_0x76aa('0x13f')]);if(!_0x4d2c63){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x29f36c,_0x76aa('0x140'));}for(var _0x174700=0x0;_0x174700<_0x4d2c63['length'];_0x174700+=0x1){var _0x2feda=this[_0x76aa('0x34')]['getVariable'](util[_0x76aa('0x27')](_0x76aa('0x141'),_0x4d2c63[_0x174700]));if(_0x2feda['result']===-0x1){return _0x2feda;}logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x142'),_0x4d2c63[_0x174700],_0x2feda[_0x76aa('0x9a')]));if(_0x2feda[_0x76aa('0x9a')]==='true'){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x142'),_0x4d2c63[_0x174700],_0x76aa('0x13a')));this[_0x76aa('0x34')]['noop'](util[_0x76aa('0x27')](_0x76aa('0x142'),_0x4d2c63[_0x174700],_0x76aa('0x13a')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x76aa('0x27')](_0x76aa('0x142'),_0x4d2c63[_0x174700],_0x76aa('0x13b')));this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')]('IFTIME\x20%s\x20%s',_0x4d2c63[_0x174700],_0x76aa('0x13b')));}}return{'code':0xc8,'result':_0x76aa('0x13b')};};AGIVertices[_0x76aa('0xe')][_0x76aa('0x143')]=function(_0x4dff0f){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x4dff0f[_0x76aa('0x36')]));return this[_0x76aa('0x34')][_0x76aa('0x143')]();};AGIVertices[_0x76aa('0xe')]['ispeechasr']=function(_0x4d8b5e){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x144'),_0x4d8b5e[_0x76aa('0x36')]));if(!this['isConfigured'](_0x4d8b5e['key'])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xe0'));}var _0x102d0b=_0x76aa('0x124');var _0xe0216f=util[_0x76aa('0x27')](_0x76aa('0x125'),FILES_PATH,rs[_0x76aa('0x112')](0x4));var _0x15ec84=util[_0x76aa('0x27')](_0x76aa('0x96'),_0xe0216f,_0x102d0b);var _0x348b30=!![];if(_0x4d8b5e[_0x76aa('0x126')]===_0x76aa('0x145')){_0x348b30=![];}var _0x3e66b5=this['channel'][_0x76aa('0x127')](_0xe0216f,_0x102d0b,_0x4d8b5e[_0x76aa('0x12f')],_0x4d8b5e[_0x76aa('0x63')],undefined,_0x348b30);if(_0x3e66b5[_0x76aa('0x9b')]!==-0x1){this[_0x76aa('0x34')][_0x76aa('0xa1')](util['format'](_0x76aa('0x146'),_0x15ec84));var _0x585dc6=this['ispeechASR'][_0x76aa('0xbc')](this,_0x4d8b5e,_0x15ec84);if(_0x585dc6){for(var _0x5ee91d in _0x585dc6){if(_0x585dc6['hasOwnProperty'](_0x5ee91d)){this[_0x76aa('0x34')]['setVariable'](util[_0x76aa('0x27')]('ISPEECH_ASR_%s',_0x5ee91d[_0x76aa('0xe3')]()),_0x585dc6[_0x5ee91d]);}}return this[_0x76aa('0x34')]['noop'](util[_0x76aa('0x27')](_0x76aa('0x147'),JSON[_0x76aa('0x6e')](_0x585dc6)));}}return _0x3e66b5;};AGIVertices[_0x76aa('0xe')][_0x76aa('0x148')]=function(_0x15fbbe){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x149'),_0x15fbbe[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x15fbbe['key'])){return this[_0x76aa('0x34')]['noop'](_0x76aa('0xe0'));}if(!this['isConfigured'](_0x15fbbe[_0x76aa('0x58')])){return this['channel'][_0x76aa('0xa1')](_0x76aa('0xa2'));}this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x15fbbe[_0x76aa('0x58')]));var _0x5262f0=this[_0x76aa('0x79')][_0x76aa('0xbc')](this,_0x15fbbe);if(_0x5262f0){this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x146'),_0x5262f0));var _0x2925bd=this['channel']['streamFile'](_0x5262f0,_0x15fbbe['intKey']);try{fs['unlink'](_0x5262f0+_0x76aa('0xff'));}catch(_0x3693ab){logger[_0x76aa('0x29')](_0x3693ab);}return _0x2925bd;}return this['channel'][_0x76aa('0x29')](_0x15fbbe,_0x76aa('0x14a'));};AGIVertices[_0x76aa('0xe')][_0x76aa('0x14b')]=function(_0xa55da2){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xa55da2[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0xa55da2['findBy'])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0xa55da2,_0x76aa('0x14c'));}logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x14d'),this[_0x76aa('0x34')]['callerid'],_0xa55da2[_0x76aa('0x14e')]));var _0x69ad17=this[_0x76aa('0x52')][_0x76aa('0xbc')](this,_0xa55da2[_0x76aa('0x14e')]);if(_0x69ad17){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x76aa('0x34')][_0x76aa('0x38')],_0xa55da2[_0x76aa('0x14e')]));this[_0x76aa('0x34')]['noop'](util[_0x76aa('0x27')](_0x76aa('0x14f'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0xa55da2[_0x76aa('0x14e')]));return{'code':0xc8,'result':_0x76aa('0x150')};}else{logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x76aa('0x34')][_0x76aa('0x38')],_0xa55da2[_0x76aa('0x14e')]));this['channel'][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x151'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0xa55da2[_0x76aa('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x76aa('0x152')]=function(_0x8490f9){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x8490f9['label']));if(!this[_0x76aa('0x9d')](_0x8490f9[_0x76aa('0x14e')])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x8490f9,_0x76aa('0x14c'));}logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x14d'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0x8490f9[_0x76aa('0x14e')]));var _0x1ff5bd=this[_0x76aa('0x4f')][_0x76aa('0xbc')](this,_0x8490f9['findBy']);if(_0x1ff5bd){logger['info'](util[_0x76aa('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x76aa('0x34')]['callerid'],_0x8490f9[_0x76aa('0x14e')]));this['channel'][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x14f'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0x8490f9['findBy']));return{'code':0xc8,'result':_0x76aa('0x150')};}else{logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x76aa('0x34')][_0x76aa('0x38')],_0x8490f9[_0x76aa('0x14e')]));this['channel'][_0x76aa('0xa1')](util['format'](_0x76aa('0x151'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0x8490f9[_0x76aa('0x14e')]));return{'code':0xc8,'result':_0x76aa('0x153')};}};AGIVertices[_0x76aa('0xe')][_0x76aa('0x154')]=function(_0x6003d4){logger['info'](util[_0x76aa('0x27')](_0x76aa('0x155'),_0x6003d4['label']));if(!this['isConfigured'](_0x6003d4[_0x76aa('0x156')])){return this['channel'][_0x76aa('0x29')](_0x6003d4,_0x76aa('0x157'));}this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x158'),_0x6003d4[_0x76aa('0x156')]));var _0xa5c1c3=eval(_0x6003d4['operation']);if(!this[_0x76aa('0x9d')](_0x6003d4['variable_id'])){return this['channel'][_0x76aa('0xa1')](_0x76aa('0xd2'));}var _0x10f1ac=this['getVariable'][_0x76aa('0xbc')](this,_0x6003d4[_0x76aa('0xd3')]);if(!_0x10f1ac){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x6003d4,_0x76aa('0xd4'));}if(_[_0x76aa('0x94')](_0xa5c1c3)){var _0x4f36f6=this;_0xa5c1c3['forEach'](function(_0x5d61b0,_0x48fdfb){_0x4f36f6[_0x76aa('0x34')]['setVariable'](util[_0x76aa('0x27')]('%s[%s]',_0x10f1ac,_0x48fdfb),_0x5d61b0);});return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x159'),_0x10f1ac));}else{return this[_0x76aa('0x34')][_0x76aa('0x98')](_0x10f1ac,_0xa5c1c3);}};AGIVertices[_0x76aa('0xe')][_0x76aa('0xa')]=function(_0x513ec5){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x15a'),_0x513ec5[_0x76aa('0x36')]));if(_0x513ec5['retry']===0x0){return this[_0x76aa('0x9f')](_0x513ec5);}_0x513ec5[_0x76aa('0x10a')]-=0x1;if(!this[_0x76aa('0x9d')](_0x513ec5[_0x76aa('0x10b')])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x513ec5,_0x76aa('0x15b'));}var _0x18aaf1=this[_0x76aa('0x1d')][_0x76aa('0xbc')](this,_0x513ec5['file_id']);if(!_0x18aaf1){return this['channel'][_0x76aa('0x29')](_0x513ec5,_0x76aa('0x10c'));}var _0x15b286=this['channel'][_0x76aa('0x10d')](_0x18aaf1,_0x513ec5[_0x76aa('0x10e')],_0x513ec5['digit']);var _0x40b440=_0x15b286[_0x76aa('0x9b')];if(_0x15b286[_0x76aa('0x9b')]===-0x1){this[_0x76aa('0x9e')]['sync'](this,_0x513ec5,'-1');return _0x15b286;}else if(_0x15b286['extra']===_0x76aa('0x63')){_0x15b286[_0x76aa('0x9b')]=_0x15b286['result'][_0x76aa('0x97')]>0x0?_0x15b286[_0x76aa('0x9b')]:'t';}else if(_[_0x76aa('0x40')](_0x15b286[_0x76aa('0x9b')])){_0x15b286['result']='#';_0x40b440='#';}if(!this['isConfigured'](_0x513ec5[_0x76aa('0xd3')])){this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0xd2'));}else{var _0x83ccb3=this[_0x76aa('0xf')][_0x76aa('0xbc')](this,_0x513ec5['variable_id']);if(!_0x83ccb3){return this[_0x76aa('0x34')]['error'](_0x513ec5,_0x76aa('0xd4'));}this[_0x76aa('0x34')][_0x76aa('0x98')](_0x83ccb3,_0x40b440);}this[_0x76aa('0x9e')]['sync'](this,_0x513ec5,_0x40b440);return _0x15b286;};AGIVertices[_0x76aa('0xe')]['noop']=function(_0x590373){logger['info'](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x590373['label']));return this[_0x76aa('0x34')]['noop'](_0x590373['output']||_0x590373[_0x76aa('0x36')]);};AGIVertices[_0x76aa('0xe')][_0x76aa('0x15c')]=function(_0x72c15a){logger['info'](util[_0x76aa('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x72c15a['label']));if(!this[_0x76aa('0x9d')](_0x72c15a['findBy'])){return this[_0x76aa('0x34')]['error'](_0x72c15a,'no\x20find\x20by\x20configured');}logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x14d'),this[_0x76aa('0x34')]['callerid'],_0x72c15a[_0x76aa('0x14e')]));var _0x53f673=this[_0x76aa('0x4a')]['sync'](this,_0x72c15a[_0x76aa('0x15d')]);var _0x3e353d=this[_0x76aa('0x4d')][_0x76aa('0xbc')](this,_0x72c15a[_0x76aa('0x14e')],_0x53f673);if(_0x3e353d){logger[_0x76aa('0x2d')](util['format'](_0x76aa('0x14f'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0x72c15a['findBy']));this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x14f'),this[_0x76aa('0x34')]['callerid'],_0x72c15a[_0x76aa('0x14e')]));return{'code':0xc8,'result':_0x76aa('0x150')};}else{logger['info'](util[_0x76aa('0x27')](_0x76aa('0x151'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0x72c15a['findBy']));this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x14f'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0x72c15a['findBy']));return{'code':0xc8,'result':_0x76aa('0x153')};}};AGIVertices[_0x76aa('0xe')]['playback']=function(_0x1bebab){logger[_0x76aa('0x2d')](util['format'](_0x76aa('0x15e'),_0x1bebab['label']));if(!this[_0x76aa('0x9d')](_0x1bebab[_0x76aa('0x10b')])){return this['channel'][_0x76aa('0x29')](_0x1bebab,_0x76aa('0x15b'));}var _0x5c11db=this[_0x76aa('0x1d')][_0x76aa('0xbc')](this,_0x1bebab[_0x76aa('0x10b')]);if(!_0x5c11db){return this['channel']['error'](_0x1bebab,_0x76aa('0x10c'));}var _0x4f2f37=this[_0x76aa('0x34')]['exec']('PLAYBACK',[_0x5c11db,_0x1bebab['opts']]);if(_0x4f2f37[_0x76aa('0x9b')]===-0x1){return _0x4f2f37;}return this['channel'][_0x76aa('0xa1')](util['format'](_0x76aa('0xc1'),'PLAYBACK',_0x5c11db));};AGIVertices['prototype'][_0x76aa('0x15f')]=function(_0x544cc2){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x160'),_0x544cc2['label']));if(!this['isConfigured'](_0x544cc2[_0x76aa('0x161')])){return this[_0x76aa('0x34')]['error'](_0x544cc2,_0x76aa('0x162'));}var _0x55c9c2='';var _0x4857fb=parseInt(_0x544cc2[_0x76aa('0x161')],0xa);if(isNaN(_0x4857fb)){_0x55c9c2=_0x544cc2[_0x76aa('0x161')];}else{_0x55c9c2=this[_0x76aa('0x13')][_0x76aa('0xbc')](this,_0x544cc2[_0x76aa('0x161')]);if(!_0x55c9c2){return this['channel'][_0x76aa('0x29')](_0x544cc2,_0x76aa('0x163'));}}var _0x4a00fc='';if(this[_0x76aa('0x9d')](_0x544cc2[_0x76aa('0x10b')])){var _0x26fe2e=this[_0x76aa('0x1d')][_0x76aa('0xbc')](this,_0x544cc2[_0x76aa('0x10b')]);if(_0x26fe2e){_0x4a00fc=_0x26fe2e;}}this[_0x76aa('0x9e')][_0x76aa('0xbc')](this,_0x544cc2,_0x55c9c2);if(_0x544cc2['opts'][_0x76aa('0x164')]('x')<0x0){_0x544cc2[_0x76aa('0xdb')]+='x';}if(_0x544cc2[_0x76aa('0xdb')]['indexOf']('X')<0x0){_0x544cc2[_0x76aa('0xdb')]+='X';}this['channel']['setVariable'](_0x76aa('0x165'),_0x55c9c2?_0x55c9c2[_0x76aa('0x166')]():'');var _0x5c8984=this[_0x76aa('0x34')][_0x76aa('0x54')](_0x76aa('0x167'),[_0x55c9c2,_0x544cc2[_0x76aa('0xdb')],_0x544cc2[_0x76aa('0x61')],_0x4a00fc,_0x544cc2[_0x76aa('0x63')],_0x544cc2[_0x76aa('0x7')],_0x544cc2[_0x76aa('0x168')],_0x544cc2[_0x76aa('0x169')],'',_0x544cc2[_0x76aa('0x16a')]]);if(_0x5c8984[_0x76aa('0x9b')]===-0x1){return _0x5c8984;}return this[_0x76aa('0x34')]['noop'](util[_0x76aa('0x27')](_0x76aa('0xc1'),_0x76aa('0x167'),_0x55c9c2));};AGIVertices[_0x76aa('0xe')]['record']=function(_0x35d0af){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x16b'),_0x35d0af[_0x76aa('0x36')]));var _0x8f330=_0x35d0af[_0x76aa('0x16c')]||'wav';var _0x2a8966=util[_0x76aa('0x27')]('%s_%s',this['channel'][_0x76aa('0x35')],rs[_0x76aa('0x112')](0x5));var _0x1d823e=util[_0x76aa('0x27')](_0x76aa('0x16d'),FILES_PATH,_0x2a8966,_0x8f330);var _0x468264=util[_0x76aa('0x27')](_0x76aa('0x125'),FILES_PATH,_0x2a8966);this['createSquareRecording']['sync'](this,_0x35d0af,_0x2a8966,_0x1d823e);this[_0x76aa('0x34')][_0x76aa('0x98')]('RECORDING_SAVENAME',_0x2a8966);logger[_0x76aa('0x2d')](_0x76aa('0x16e'),_0x468264,_0x8f330,_0x35d0af[_0x76aa('0x16f')],_0x35d0af['timeout']);return this['channel'][_0x76aa('0x127')](_0x468264,_0x8f330,_0x35d0af[_0x76aa('0x16f')],_0x35d0af[_0x76aa('0x63')],undefined,!![]);};AGIVertices[_0x76aa('0xe')]['restapi']=function(_0x55baaa){logger['info'](util[_0x76aa('0x27')](_0x76aa('0x170'),_0x55baaa[_0x76aa('0x36')]));if(!this['isConfigured'](_0x55baaa['url'])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x171'));}var _0x415b6f=this['restAPI'][_0x76aa('0xbc')](this,_0x55baaa);logger[_0x76aa('0x2d')](util['format'](_0x76aa('0x172'),util[_0x76aa('0x173')](_0x415b6f,{'showHidden':![],'depth':null})));if(!this[_0x76aa('0x9d')](_0x55baaa[_0x76aa('0xd3')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x4d8ec6=this[_0x76aa('0xf')][_0x76aa('0xbc')](this,_0x55baaa[_0x76aa('0xd3')]);if(!_0x4d8ec6){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x55baaa,_0x76aa('0xd4'));}this[_0x76aa('0x34')][_0x76aa('0x98')](util[_0x76aa('0x27')](_0x76aa('0x174'),_0x4d8ec6),_0x415b6f[_0x76aa('0x175')]?_0x415b6f[_0x76aa('0x175')]:_0x76aa('0x176'));this['channel'][_0x76aa('0x98')](util[_0x76aa('0x27')](_0x76aa('0x177'),_0x4d8ec6),_0x415b6f[_0x76aa('0x178')]?_0x415b6f['statusMessage']:'OK');if(_0x415b6f[_0x76aa('0x6d')]){try{this[_0x76aa('0x95')](_0x415b6f['body'],_0x4d8ec6);}catch(_0x39393d){logger['error'](util['format'](_0x76aa('0x179'),_0x4d8ec6));}}return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x17a'),_0x4d8ec6));};AGIVertices[_0x76aa('0xe')][_0x76aa('0x17b')]=function(_0xb34891){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xb34891[_0x76aa('0x36')]));return this[_0x76aa('0x34')][_0x76aa('0x17c')](_0xb34891[_0x76aa('0x17d')][_0x76aa('0x17e')](/\s+/g,''),_0xb34891[_0x76aa('0x16f')]);};AGIVertices[_0x76aa('0xe')][_0x76aa('0x17f')]=function(_0x503562){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x180'),_0x503562['label']));return this[_0x76aa('0x34')]['sayNumber'](_0x503562[_0x76aa('0x62')][_0x76aa('0x17e')](/\s+/g,''),_0x503562[_0x76aa('0x16f')]);};AGIVertices['prototype'][_0x76aa('0x181')]=function(_0x28a4c2){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x182'),_0x28a4c2['label']));return this[_0x76aa('0x34')][_0x76aa('0x183')](_0x28a4c2['text'],_0x28a4c2['escape_digits']);};AGIVertices[_0x76aa('0xe')][_0x76aa('0x184')]=function(_0x41e6e1){logger['info'](util[_0x76aa('0x27')](_0x76aa('0x185'),_0x41e6e1[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x41e6e1['account_id'])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x186'));}var _0x4b702b=this['getMailAccount'][_0x76aa('0xbc')](this,_0x41e6e1[_0x76aa('0x187')]);if(!_0x4b702b||!_0x4b702b[_0x76aa('0x188')]){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x41e6e1,_0x76aa('0x189'));}var _0x2684ce={'from':util['format'](_0x76aa('0x18a'),_0x4b702b[_0x76aa('0x16')],_0x4b702b[_0x76aa('0x18b')]||_0x4b702b[_0x76aa('0x188')][_0x76aa('0x18c')]),'to':_0x41e6e1['to']||'','cc':_0x41e6e1['cc']||'','bcc':_0x41e6e1[_0x76aa('0x18d')]||'','subject':_0x41e6e1[_0x76aa('0x18e')],'html':_0x41e6e1['text'],'text':_0x41e6e1['text']};if(this[_0x76aa('0x9d')](_0x41e6e1[_0x76aa('0x18f')])){}logger[_0x76aa('0xd7')](_0x76aa('0x190'),JSON[_0x76aa('0x6e')](_0x2684ce));this['createSquareDetailsReport'][_0x76aa('0xbc')](this,_0x41e6e1,_0x41e6e1[_0x76aa('0x187')]);this[_0x76aa('0x34')][_0x76aa('0xa1')](util['format'](_0x76aa('0x191'),_0x4b702b[_0x76aa('0x16')]));this['sendMailMessage']['sync'](this,_0x4b702b[_0x76aa('0x192')],_0x2684ce);return this[_0x76aa('0x34')]['noop'](_0x76aa('0x193'));};AGIVertices[_0x76aa('0xe')][_0x76aa('0x194')]=function(_0x4e7643){logger['info'](util[_0x76aa('0x27')](_0x76aa('0x195'),_0x4e7643[_0x76aa('0x36')]));return this['channel'][_0x76aa('0xa1')](_0x76aa('0x196'));};AGIVertices[_0x76aa('0xe')][_0x76aa('0x197')]=function(_0x143a95){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x198'),_0x143a95['label']));if(!this['isConfigured'](_0x143a95[_0x76aa('0x199')])){return this[_0x76aa('0x34')]['noop'](_0x76aa('0x19a'));}var _0x4bb772=this[_0x76aa('0x32')][_0x76aa('0xbc')](this,_0x143a95[_0x76aa('0x199')]);if(!_0x4bb772){return this[_0x76aa('0x34')]['error'](_0x143a95,_0x76aa('0x19b'));}var _0x626db5={'body':_0x143a95[_0x76aa('0x19c')],'phone':_0x143a95['to']||'','SmsAccountId':_0x4bb772['id']};logger[_0x76aa('0xd7')](_0x76aa('0x19d'),JSON[_0x76aa('0x6e')](_0x626db5));this[_0x76aa('0x9e')]['sync'](this,_0x143a95,_0x143a95[_0x76aa('0x199')]);this[_0x76aa('0x34')]['noop'](util[_0x76aa('0x27')](_0x76aa('0x19e'),_0x4bb772[_0x76aa('0x16')]));this[_0x76aa('0x33')][_0x76aa('0xbc')](this,_0x626db5);return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x19f'));};AGIVertices['prototype'][_0x76aa('0x1a0')]=function(_0x3d2607){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x1a1'),_0x3d2607[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x3d2607[_0x76aa('0xd3')])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x3d2607,'no\x20variable\x20selected');}var _0x573787=this[_0x76aa('0xf')][_0x76aa('0xbc')](this,_0x3d2607['variable_id']);if(!_0x573787){return this[_0x76aa('0x34')]['error'](_0x3d2607,'no\x20variable\x20found');}return this[_0x76aa('0x34')][_0x76aa('0x98')](_0x573787,_0x3d2607[_0x76aa('0x1a2')]);};AGIVertices[_0x76aa('0xe')][_0x76aa('0x1a3')]=function(_0x3a1c1c){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x1a4'),_0x3a1c1c[_0x76aa('0x36')]));this[_0x76aa('0x34')]['noop']('START\x20CALLY\x20SQUARE');var _0x44242d=this['channel'][_0x76aa('0xf')](_0x76aa('0x1a5'));if(!_[_0x76aa('0x40')](_0x44242d[_0x76aa('0x9a')])){this[_0x76aa('0x34')][_0x76aa('0x35')]=_0x44242d[_0x76aa('0x9a')];}if(_0x3a1c1c['answer']===_0x76aa('0x1a6')){this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x1a7'));return this[_0x76aa('0x34')][_0x76aa('0xb4')]();}return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x1a8'));};AGIVertices[_0x76aa('0xe')]['subproject']=function(_0x225cdb){logger[_0x76aa('0x2d')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x225cdb[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x225cdb[_0x76aa('0x1a9')])){return this[_0x76aa('0x34')]['error'](_0x225cdb,'no\x20subproject\x20selected');}var _0x2b434f=this[_0x76aa('0x14')][_0x76aa('0xbc')](this,_0x225cdb[_0x76aa('0x1a9')]);if(!this[_0x76aa('0x9d')](_0x2b434f)){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x225cdb,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x225cdb[_0x76aa('0x1a9')]));}if(_0x2b434f===this[_0x76aa('0x34')][_0x76aa('0x1aa')]){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x225cdb,_0x76aa('0x1ab'));}this[_0x76aa('0x9e')][_0x76aa('0xbc')](this,_0x225cdb,_0x2b434f);var _0x383c26=this[_0x76aa('0x34')][_0x76aa('0x54')](_0x76aa('0x1ac'),util['format'](_0x76aa('0x1ad'),config[_0x76aa('0x7')][_0x76aa('0x1ae')]||_0x76aa('0x1af'),_0x2b434f,this['channel']['arg_1']));if(_0x383c26[_0x76aa('0x9b')]===-0x1){return _0x383c26;}return this[_0x76aa('0x34')][_0x76aa('0xa1')](util['format']('Executed\x20command\x20%s\x20%s',_0x76aa('0x1ac'),_0x2b434f));};AGIVertices[_0x76aa('0xe')][_0x76aa('0x1b0')]=function(_0x1e2c28){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1e2c28['label']));var _0x1ca1b0=this[_0x76aa('0x53')][_0x76aa('0xbc')](this,_0x1e2c28[_0x76aa('0xb2')]);this[_0x76aa('0x9e')][_0x76aa('0xbc')](this,_0x1e2c28,_0x1e2c28['command']);if(this[_0x76aa('0x9d')](_0x1e2c28['variable_id'])){var _0x3c4e7e=this['getVariable']['sync'](this,_0x1e2c28[_0x76aa('0xd3')]);if(_0x3c4e7e){this['channel'][_0x76aa('0x98')](_0x3c4e7e,_0x1ca1b0);return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x1e2c28[_0x76aa('0xb2')],_0x3c4e7e));}}return this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x1b1'),_0x1e2c28[_0x76aa('0xb2')]));};AGIVertices[_0x76aa('0xe')][_0x76aa('0x1b2')]=function(_0x3cc82a){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x1b3'),_0x3cc82a['label']));_0x3cc82a[_0x76aa('0x58')]=_0x3cc82a['text'][_0x76aa('0x17e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x76aa('0x9d')](_0x3cc82a[_0x76aa('0x57')])){return this[_0x76aa('0x34')][_0x76aa('0xa1')](_0x76aa('0x1b4'));}if(!this[_0x76aa('0x9d')](_0x3cc82a[_0x76aa('0x58')])){return this['channel'][_0x76aa('0xa1')](_0x76aa('0xa2'));}this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x1b5'),_0x3cc82a['text']));var _0x95270d=this[_0x76aa('0x56')]['sync'](this,_0x3cc82a);if(_0x95270d){this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x95270d));var _0xb4d1bb=this['channel']['streamFile'](_0x95270d);try{fs[_0x76aa('0xfe')](_0x95270d+_0x76aa('0xff'));}catch(_0x4950f3){logger[_0x76aa('0x29')](_0x4950f3);}return _0xb4d1bb;}return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x3cc82a,_0x76aa('0x1b6'));};AGIVertices[_0x76aa('0xe')][_0x76aa('0x1b7')]=function(_0x38d9d8){logger[_0x76aa('0x2d')](util['format'](_0x76aa('0x1b8'),_0x38d9d8[_0x76aa('0x36')]));_0x38d9d8[_0x76aa('0x58')]=_0x38d9d8[_0x76aa('0x58')][_0x76aa('0x17e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x76aa('0x9d')](_0x38d9d8['text'])){return this['channel'][_0x76aa('0xa1')](_0x76aa('0xa2'));}this['channel'][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x1b9'),_0x38d9d8[_0x76aa('0x58')]));var _0x32c93a=this[_0x76aa('0x5e')][_0x76aa('0xbc')](this,_0x38d9d8);if(_0x32c93a){this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')]('Google\x20TTS\x20%s\x20file\x20created',_0x32c93a));var _0x3225bc=this[_0x76aa('0x34')][_0x76aa('0xfd')](_0x32c93a);try{fs['unlink'](_0x32c93a+_0x76aa('0xff'));}catch(_0x4a7914){logger[_0x76aa('0x29')](_0x4a7914);}return _0x3225bc;}return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x38d9d8,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x76aa('0xe')]['unpause']=function(_0x5dbe55){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x1ba'),_0x5dbe55[_0x76aa('0x36')]));if(!this[_0x76aa('0x9d')](_0x5dbe55['findBy'])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x5dbe55,'no\x20find\x20by\x20configured');}logger[_0x76aa('0x2d')](util['format'](_0x76aa('0x14d'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0x5dbe55[_0x76aa('0x14e')]));var _0x3c4df7=this[_0x76aa('0x4e')][_0x76aa('0xbc')](this,_0x5dbe55[_0x76aa('0x14e')]);if(_0x3c4df7){logger['info'](util[_0x76aa('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x76aa('0x34')]['callerid'],_0x5dbe55['findBy']));this['channel']['noop'](util[_0x76aa('0x27')](_0x76aa('0x14f'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0x5dbe55[_0x76aa('0x14e')]));return{'code':0xc8,'result':_0x76aa('0x150')};}else{logger['info'](util['format'](_0x76aa('0x151'),this[_0x76aa('0x34')]['callerid'],_0x5dbe55[_0x76aa('0x14e')]));this[_0x76aa('0x34')][_0x76aa('0xa1')](util[_0x76aa('0x27')](_0x76aa('0x151'),this[_0x76aa('0x34')][_0x76aa('0x38')],_0x5dbe55[_0x76aa('0x14e')]));return{'code':0xc8,'result':_0x76aa('0x153')};}};AGIVertices[_0x76aa('0xe')][_0x76aa('0x1bb')]=function(_0x383bb3){logger['info'](util[_0x76aa('0x27')](_0x76aa('0x1bc'),_0x383bb3[_0x76aa('0x36')]));var _0x436e5b=this['channel'][_0x76aa('0x54')](_0x76aa('0x1bd'),[_0x383bb3[_0x76aa('0x1be')],_0x383bb3[_0x76aa('0x71')]]);if(_0x436e5b[_0x76aa('0x9b')]===-0x1){return _0x436e5b;}return this['channel'][_0x76aa('0xa1')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x383bb3[_0x76aa('0x1be')]));};AGIVertices[_0x76aa('0xe')][_0x76aa('0x1bf')]=function(_0x3266cf){logger[_0x76aa('0x2d')](util[_0x76aa('0x27')](_0x76aa('0x1c0'),_0x3266cf[_0x76aa('0x36')]));if(!this['isConfigured'](_0x3266cf[_0x76aa('0xd3')])){return this[_0x76aa('0x34')][_0x76aa('0x29')](_0x3266cf,_0x76aa('0x1c1'));}var _0x55510f=this['getVariable']['sync'](this,_0x3266cf[_0x76aa('0xd3')]);if(!_0x55510f){return this[_0x76aa('0x34')]['error'](_0x3266cf,_0x76aa('0xd4'));}var _0x749cba=this[_0x76aa('0x34')][_0x76aa('0xf')](_0x55510f);return{'code':0xc8,'result':_0x749cba[_0x76aa('0x9a')]?_0x749cba['extra']:'-'};};String['prototype'][_0x76aa('0x1c2')]=function(_0x42dba3,_0x40bc23){return this[_0x76aa('0x99')](_0x42dba3)[_0x76aa('0x1c3')](_0x40bc23);};module['exports']=AGIVertices; \ No newline at end of file +var _0xadb8=['Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','getVariableById','then','name','catch','prototype','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','channel','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentLogout','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','body','parse','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','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','isPlainObject','isArray','length','recursiveNodeIndex','replaceAllVariables','saveRestApiResult','format','%s.%s','setVariable','split','replaceAll','getVariable','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','createSquareDetailsReport','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','keys','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','username','ndassistant_url','SESTEK_NDA_%s','out','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','macro','position','Executed\x20command\x20%s\x20%s','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','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','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host'];(function(_0x342b32,_0x1c26a3){var _0x86bf50=function(_0xf14b38){while(--_0xf14b38){_0x342b32['push'](_0x342b32['shift']());}};_0x86bf50(++_0x1c26a3);}(_0xadb8,0x1d0));var _0x8adb=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xadb8[_0x48d6a3];return _0x38bfa0;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0x8adb('0x0'));var odbc=require('odbc')();var rs=require(_0x8adb('0x1'));var moment=require(_0x8adb('0x2'));var Mustache=require(_0x8adb('0x3'));var rp=require(_0x8adb('0x4'));var logger=require(_0x8adb('0x5'))(_0x8adb('0x6'));var config=require(_0x8adb('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x8adb('0x8');var recursiveMapAttributes=[_0x8adb('0x9'),_0x8adb('0xa')];var verticesWithRetry=[_0x8adb('0xb'),_0x8adb('0xc'),_0x8adb('0xd')];var AGIVertices=function(_0x27d994,_0x5138b9,_0x500e09){this['channel']=_0x27d994;this[_0x8adb('0xe')]=_0x5138b9;this['mailRpc']=_0x500e09;};AGIVertices['prototype']['getVariable']=function(_0xa095e1,_0x628c45){this[_0x8adb('0xe')][_0x8adb('0xf')](_0xa095e1)[_0x8adb('0x10')](function(_0x2d79b5){_0x628c45(null,_0x2d79b5?_0x2d79b5[_0x8adb('0x11')]:![]);})[_0x8adb('0x12')](function(_0x2d6b55){_0x628c45(_0x2d6b55);});};AGIVertices[_0x8adb('0x13')]['getVoiceQueue']=function(_0x5f0de6,_0x5db6c1){this[_0x8adb('0xe')]['getVoiceQueueById'](_0x5f0de6)[_0x8adb('0x10')](function(_0x43579e){_0x5db6c1(null,_0x43579e?_0x43579e[_0x8adb('0x11')]:![]);})['catch'](function(_0x20add0){_0x5db6c1(_0x20add0);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x14')]=function(_0x3f1ca7,_0x224e6c){this[_0x8adb('0xe')]['getSquareProjectById'](_0x3f1ca7)[_0x8adb('0x10')](function(_0xe8cfa5){_0x224e6c(null,_0xe8cfa5?_0xe8cfa5['name']:![]);})['catch'](function(_0x18897e){_0x224e6c(_0x18897e);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x15')]=function(_0x430c89,_0x46bce0){this[_0x8adb('0xe')][_0x8adb('0x16')](_0x430c89)[_0x8adb('0x10')](function(_0x156ebf){_0x46bce0(null,_0x156ebf?_0x156ebf[_0x8adb('0x17')]:![]);})[_0x8adb('0x12')](function(_0x190171){_0x46bce0(_0x190171);});};AGIVertices['prototype']['getUser']=function(_0x24b31d,_0x3d37db){this['rpc'][_0x8adb('0x18')](_0x24b31d)[_0x8adb('0x10')](function(_0x468dd6){_0x3d37db(null,_0x468dd6?_0x468dd6[_0x8adb('0x11')]:![]);})[_0x8adb('0x12')](function(_0x28d5cd){_0x3d37db(_0x28d5cd);});};AGIVertices['prototype'][_0x8adb('0x19')]=function(_0x16f305,_0x234ef2){this['rpc'][_0x8adb('0x1a')](_0x16f305)[_0x8adb('0x10')](function(_0x2892bb){_0x234ef2(null,_0x2892bb?_0x2892bb[_0x8adb('0x11')]:![]);})[_0x8adb('0x12')](function(_0x15ee75){_0x234ef2(_0x15ee75);});};AGIVertices['prototype'][_0x8adb('0x1b')]=function(_0x16f724,_0x18f94e){var _0x44f242=this;this[_0x8adb('0xe')][_0x8adb('0x1c')](_0x16f724)[_0x8adb('0x10')](function(_0x5c5a7b){_0x18f94e(null,_0x5c5a7b?_0x44f242[_0x8adb('0x1d')](_0x5c5a7b[_0x8adb('0x1e')]):![]);})[_0x8adb('0x12')](function(_0x824eda){_0x18f94e(_0x824eda);});};AGIVertices['prototype'][_0x8adb('0x1f')]=function(_0x47abd7,_0x2c582b){this[_0x8adb('0xe')][_0x8adb('0x20')](_0x47abd7)[_0x8adb('0x10')](function(_0x56f8a4){_0x2c582b(null,_0x56f8a4?_0x56f8a4:![]);})[_0x8adb('0x12')](function(_0x57a12c){_0x2c582b(_0x57a12c);});};AGIVertices[_0x8adb('0x13')]['sendMailMessage']=function(_0x1d4962,_0x1661a3,_0x41e2ce){this[_0x8adb('0x21')][_0x8adb('0x22')](_0x1d4962,_0x1661a3)[_0x8adb('0x10')](function(){_0x41e2ce(null);})['catch'](function(_0x59ab91){_0x41e2ce(_0x59ab91);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x23')]=function(_0x429d5a,_0x77e99f){this[_0x8adb('0xe')][_0x8adb('0x24')](_0x429d5a)[_0x8adb('0x10')](function(_0xdabe8e){if(_0xdabe8e){if(_0xdabe8e[_0x8adb('0x25')]){_0x77e99f(null,[_0xdabe8e[_0x8adb('0x26')]]);}else{_0x77e99f(null,_[_0x8adb('0x27')](_0xdabe8e[_0x8adb('0x28')],_0x8adb('0x26')));}}else{_0x77e99f(null,![]);}})['catch'](function(_0x220eb3){_0x77e99f(_0x220eb3);});};AGIVertices[_0x8adb('0x13')]['getSoundPath']=function(_0x47783d){return util['format'](_0x8adb('0x29'),FILES_PATH,_0x47783d);};AGIVertices[_0x8adb('0x13')][_0x8adb('0x2a')]=function(_0x108a80,_0x365290,_0x480897){odbc[_0x8adb('0x2b')](_0x108a80,function(_0x5e34aa){if(_0x5e34aa){logger[_0x8adb('0x2c')](_0x8adb('0x2d'),_0x5e34aa);_0x480897(_0x5e34aa);}else{logger['info'](_0x8adb('0x2e'));odbc['query'](_0x365290,function(_0x233256,_0x494afd){if(_0x233256){logger[_0x8adb('0x2f')](_0x8adb('0x30'),_0x365290);_0x480897(_0x233256);}else{logger[_0x8adb('0x2f')]('Query\x20executed\x20correctly\x20%s',_0x365290);odbc['close'](function(_0x182c4b){if(_0x182c4b){logger[_0x8adb('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x182c4b);}_0x480897(null,_0x494afd);});}});}});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x31')]=function(_0x2da037,_0x3872c9){this[_0x8adb('0xe')][_0x8adb('0x32')](_0x2da037)[_0x8adb('0x10')](function(_0x264d53){_0x3872c9(null,_0x264d53?_0x264d53:![]);})['catch'](function(_0x5b175f){_0x3872c9(_0x5b175f);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x33')]=function(_0x4717fa,_0x2f9228){this['rpc'][_0x8adb('0x33')](_0x4717fa)['then'](function(_0x26abec){_0x2f9228(null,_0x26abec);})[_0x8adb('0x12')](function(_0x3ee3a0){_0x2f9228(_0x3ee3a0);});};AGIVertices[_0x8adb('0x13')]['createSquareDetailsReport']=function(_0x4ef5a3,_0x213c23,_0x520370){this[_0x8adb('0xe')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x8adb('0x34')],'node':_0x4ef5a3[_0x8adb('0x35')],'application':_0x4ef5a3['agicommand'],'data':_0x213c23||null,'project_name':this[_0x8adb('0x36')][_0x8adb('0x37')],'callerid':this[_0x8adb('0x36')][_0x8adb('0x38')]})[_0x8adb('0x10')](function(_0x54f741){if(_0x520370){_0x520370(null,_0x54f741);}})[_0x8adb('0x12')](function(_0x49b9a3){if(_0x520370){_0x520370(_0x49b9a3);}});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x39')]=function(_0x56a717,_0x53953e,_0x46d175,_0x5354af){this[_0x8adb('0xe')][_0x8adb('0x39')]({'uniqueid':this[_0x8adb('0x36')][_0x8adb('0x34')],'callerid':this['channel'][_0x8adb('0x38')],'calleridname':this[_0x8adb('0x36')]['calleridname'],'context':this['channel'][_0x8adb('0x3a')],'extension':this[_0x8adb('0x36')][_0x8adb('0x3b')],'priority':this['channel'][_0x8adb('0x3c')],'accountcode':this[_0x8adb('0x36')][_0x8adb('0x3d')],'dnid':this[_0x8adb('0x36')][_0x8adb('0x3e')],'projectName':this[_0x8adb('0x36')][_0x8adb('0x37')],'saveName':_0x53953e,'filename':_0x56a717[_0x8adb('0x3f')]||_0x53953e,'savePath':_0x46d175})[_0x8adb('0x10')](function(_0xe725e9){_0x5354af(null,_0xe725e9);})[_0x8adb('0x12')](function(_0x4187de){_0x5354af(_0x4187de);});};AGIVertices['prototype'][_0x8adb('0x40')]=function(_0x33c28c,_0x35ef9d,_0x32fc34,_0x1a2e3f,_0x1fcbd4){this[_0x8adb('0xe')][_0x8adb('0x40')]({'uniqueid':this[_0x8adb('0x36')][_0x8adb('0x34')],'body':_0x33c28c,'direction':_0x35ef9d,'providerName':_0x32fc34,'providerResponse':_0x1a2e3f})['then'](function(_0x46eb69){if(_0x1fcbd4){_0x1fcbd4(null,_0x46eb69);}})[_0x8adb('0x12')](function(_0x42d299){if(_0x1fcbd4){_0x1fcbd4(_0x42d299);}});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x41')]=function(_0x12b242,_0x355fbd){this[_0x8adb('0xe')]['createCmContact']({'firstName':_[_0x8adb('0x42')](_0x12b242[_0x8adb('0x11')])||_[_0x8adb('0x43')](_0x12b242[_0x8adb('0x11')])?'callback_'+Math[_0x8adb('0x44')]():_0x12b242[_0x8adb('0x11')],'lastName':_[_0x8adb('0x42')](_0x12b242[_0x8adb('0x45')])||_['isNil'](_0x12b242[_0x8adb('0x45')])?null:_0x12b242[_0x8adb('0x45')],'phone':_0x12b242[_0x8adb('0x46')],'ListId':_0x12b242[_0x8adb('0x47')],'scheduledat':_0x12b242[_0x8adb('0x48')],'callbackUniqueid':this[_0x8adb('0x36')][_0x8adb('0x34')],'tags':_0x8adb('0x49'),'description':_0x8adb('0x4a')+_0x12b242[_0x8adb('0x48')][_0x8adb('0x4b')](),'priority':_0x12b242[_0x8adb('0x4c')]})['then'](function(_0x4329b0){_0x355fbd(null,_0x4329b0);})['catch'](function(_0x5def35){_0x355fbd(_0x5def35);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x4d')]=function(_0x58473b,_0x272899){this[_0x8adb('0xe')][_0x8adb('0x4e')](_0x58473b)[_0x8adb('0x10')](function(_0x545a47){_0x272899(null,_0x545a47?_0x545a47[_0x8adb('0x11')]:![]);})['catch'](function(_0x26d693){_0x272899(_0x26d693);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x4f')]=function(_0x47a2a4,_0x3142c3,_0x50dc53){var _0xb73009={'role':_0x8adb('0x50')};_0xb73009[_0x47a2a4]=this[_0x8adb('0x36')]['callerid'];this[_0x8adb('0xe')][_0x8adb('0x4f')](_0xb73009,_0x3142c3,this[_0x8adb('0x36')][_0x8adb('0x34')])['then'](function(_0x1a001e){_0x50dc53(null,_[_0x8adb('0x43')](_0x1a001e)?![]:!![]);})['catch'](function(_0x1f1961){logger[_0x8adb('0x2c')](_0x1f1961);_0x50dc53(null,![]);});};AGIVertices[_0x8adb('0x13')]['agentUnpause']=function(_0x21f8ae,_0xbc1014){var _0x2efe02={'role':_0x8adb('0x50')};_0x2efe02[_0x21f8ae]=this['channel'][_0x8adb('0x38')];this['rpc']['agentUnpause'](_0x2efe02)['then'](function(_0x4148f3){_0xbc1014(null,_[_0x8adb('0x43')](_0x4148f3)?![]:!![]);})[_0x8adb('0x12')](function(_0x4c9a27){logger[_0x8adb('0x2c')](_0x4c9a27);_0xbc1014(null,![]);});};AGIVertices['prototype'][_0x8adb('0x51')]=function(_0x16b8a0,_0x36a9ff){var _0x7def34={'role':_0x8adb('0x50')};_0x7def34[_0x16b8a0]=this[_0x8adb('0x36')][_0x8adb('0x38')];this[_0x8adb('0xe')][_0x8adb('0x51')](_0x7def34)['then'](function(_0x19bf11){_0x36a9ff(null,_[_0x8adb('0x43')](_0x19bf11)?![]:!![]);})[_0x8adb('0x12')](function(_0x3e3634){logger['error'](_0x3e3634);_0x36a9ff(null,![]);});};AGIVertices[_0x8adb('0x13')]['agentLogin']=function(_0x247d1e,_0x18b0b5){var _0x367787={'role':_0x8adb('0x50')};_0x367787[_0x247d1e]=this['channel'][_0x8adb('0x38')];var _0x14c13b=_0x247d1e!='internal'?util['format']('%s/%s@from-sip/n',_0x8adb('0x52'),this[_0x8adb('0x36')][_0x8adb('0x38')]):undefined;this['rpc']['agentLogin'](_0x367787,_0x14c13b)[_0x8adb('0x10')](function(_0x2db881){_0x18b0b5(null,_[_0x8adb('0x43')](_0x2db881)?![]:!![]);})['catch'](function(_0x180976){logger[_0x8adb('0x2c')](_0x180976);_0x18b0b5(null,![]);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x53')]=function(_0x1476a6,_0x29b5d7){sh['exec'](_[_0x8adb('0x54')](_0x1476a6),function(_0x53078f,_0x5d17d4){var _0x187613=_0x5d17d4[_0x8adb('0x55')](/(\r\n|\n|\r)/gm,'');_0x29b5d7(null,_0x187613);});};AGIVertices[_0x8adb('0x13')]['googleCloudTTS']=function(_0x4f9b71,_0x244d1d){scripts[_0x8adb('0x56')](_0x4f9b71[_0x8adb('0x57')],_0x4f9b71[_0x8adb('0x58')]||_0x8adb('0x59'),_0x4f9b71['text'],_0x4f9b71[_0x8adb('0x5a')]||'en-US',_0x4f9b71['ssmlGender']||'MALE',_0x4f9b71[_0x8adb('0x5b')]||'MP3')[_0x8adb('0x10')](function(_0xce4380){_0x244d1d(null,_0xce4380);})[_0x8adb('0x12')](function(_0x4ade9a){_0x244d1d(_0x4ade9a);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x5c')]=function(_0x1be3dc,_0x525f00){scripts['googleTTS'](_0x1be3dc[_0x8adb('0x59')],_0x1be3dc[_0x8adb('0x5d')]||'en',0x1)[_0x8adb('0x10')](function(_0x15889a){_0x525f00(null,_0x15889a);})[_0x8adb('0x12')](function(_0x50ecd5){_0x525f00(_0x50ecd5);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x5e')]=function(_0x22295d,_0x80ecc1){var _0x581835={'uri':_0x22295d[_0x8adb('0x5f')],'method':_0x22295d[_0x8adb('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x22295d[_0x8adb('0x61')])===_0x8adb('0x62')&&parseInt(_0x22295d[_0x8adb('0x61')])>=0x1?parseInt(_0x22295d[_0x8adb('0x61')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x8adb('0x63'),_0x8adb('0x64')],_0x581835['method'][_0x8adb('0x65')]())){try{_0x581835[_0x8adb('0x66')]=_0x22295d[_0x8adb('0xa')]?JSON[_0x8adb('0x67')](_0x22295d[_0x8adb('0xa')]):{};}catch(_0x4c9b6d){logger[_0x8adb('0x2c')](_0x8adb('0x68'),_0x4c9b6d);}}try{_0x581835[_0x8adb('0x69')]=_0x22295d[_0x8adb('0x9')]?JSON[_0x8adb('0x67')](_0x22295d['rawHeaders']):{};}catch(_0x267b53){logger[_0x8adb('0x2c')](_0x8adb('0x6a'),_0x267b53);}if(_0x22295d['computedVariables']){try{var _0x3dd537=require(_0x22295d[_0x8adb('0x6b')])[_0x8adb('0x6c')](this,_0x581835);_0x581835['uri']=Mustache[_0x8adb('0x6d')](_0x22295d[_0x8adb('0x5f')],_0x3dd537,{},['$$','$$']);if(_0x581835[_0x8adb('0x69')]){_0x581835[_0x8adb('0x69')]=JSON[_0x8adb('0x67')](Mustache[_0x8adb('0x6d')](JSON[_0x8adb('0x6e')](_0x581835['headers']),_0x3dd537,{},['$$','$$']));}if(_0x581835['body']){_0x581835[_0x8adb('0x66')]=JSON[_0x8adb('0x67')](Mustache[_0x8adb('0x6d')](JSON[_0x8adb('0x6e')](_0x581835['body']),_0x3dd537,{},['$$','$$']));}}catch(_0x18311e){logger[_0x8adb('0x2c')](_0x8adb('0x6f'),_0x18311e);}}rp(_0x581835)[_0x8adb('0x10')](function(_0x2403f8){var _0x37bd3c={'statusCode':_0x2403f8[_0x8adb('0x70')]||0xc8,'statusMessage':_0x2403f8[_0x8adb('0x71')]||'OK','headers':_0x2403f8[_0x8adb('0x69')]||{},'body':_0x2403f8[_0x8adb('0x66')]||{}};_0x80ecc1(null,_0x37bd3c);})[_0x8adb('0x12')](function(_0x4daba0){var _0x2b2777={'statusCode':_0x4daba0[_0x8adb('0x70')]||0x1f4,'statusMessage':_0x4daba0[_0x8adb('0x72')]||_0x8adb('0x73'),'headers':_0x4daba0[_0x8adb('0x74')][_0x8adb('0x69')]||{},'body':_0x4daba0['options']['body']||{}};_0x80ecc1(null,_0x2b2777);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x75')]=function(_0x8af633,_0x428052){scripts[_0x8adb('0x75')](this[_0x8adb('0x36')][_0x8adb('0x34')],_0x8af633[_0x8adb('0x76')],_0x8af633['text'],_0x8af633['dialogflow_language']||'en')[_0x8adb('0x10')](function(_0x58ecc2){_0x428052(null,_0x58ecc2);})['catch'](function(_0x4afa20){_0x428052(_0x4afa20);});};AGIVertices[_0x8adb('0x13')]['googleDialogflowV2']=function(_0x37ade9,_0x34d34c){scripts['googleDialogflowV2'](this['channel']['uniqueid'],_0x37ade9['dialogflowV2_project_id'],_0x37ade9[_0x8adb('0x77')],_0x37ade9[_0x8adb('0x78')],_0x37ade9[_0x8adb('0x59')],_0x37ade9[_0x8adb('0x79')]||'en')[_0x8adb('0x10')](function(_0x1ad978){_0x34d34c(null,_0x1ad978);})['catch'](function(_0x403421){_0x34d34c(_0x403421);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x7a')]=function(_0x176cef,_0xc51567){scripts['sestekNDA'](this['channel'],_0x176cef)[_0x8adb('0x10')](function(_0x2aa0c3){_0xc51567(null,_0x2aa0c3);})['catch'](function(_0x4b0a6a){_0xc51567(_0x4b0a6a);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x7b')]=function(_0x3413d7,_0x41bc16){scripts[_0x8adb('0x7b')](_0x3413d7[_0x8adb('0x76')],_0x3413d7['text'],_0x3413d7[_0x8adb('0x7c')]||_0x8adb('0x7d'),_0x3413d7['speed'])[_0x8adb('0x10')](function(_0x1b2162){_0x41bc16(null,_0x1b2162);})['catch'](function(_0x10721d){_0x41bc16(_0x10721d);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x7e')]=function(_0xaeff7,_0x27812f,_0x4e9c49){scripts[_0x8adb('0x7e')](_0x27812f,_0xaeff7[_0x8adb('0x76')],_0xaeff7['ispeech_asr_language']||'en-US',this[_0x8adb('0x7f')](_0xaeff7['model'])?_0xaeff7[_0x8adb('0x80')]:undefined)[_0x8adb('0x10')](function(_0x1b7293){_0x4e9c49(null,_0x1b7293);})[_0x8adb('0x12')](function(_0x536888){_0x4e9c49(_0x536888);});};AGIVertices['prototype']['awsPolly']=function(_0x195b62,_0x395fd9){scripts['awsPolly'](_0x195b62[_0x8adb('0x81')],_0x195b62[_0x8adb('0x82')],_0x195b62[_0x8adb('0x83')],_0x195b62[_0x8adb('0x84')]||'Amy',_0x195b62['text'],_0x195b62[_0x8adb('0x85')]||_0x8adb('0x59'))[_0x8adb('0x10')](function(_0x12d5a8){_0x395fd9(null,_0x12d5a8);})[_0x8adb('0x12')](function(_0x31cd3a){_0x395fd9(_0x31cd3a);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x86')]=function(_0x18aba6,_0x34605d){scripts[_0x8adb('0x86')](this[_0x8adb('0x36')]['uniqueid'],_0x18aba6['aws_access_key_id'],_0x18aba6[_0x8adb('0x82')],_0x18aba6[_0x8adb('0x87')],_0x18aba6[_0x8adb('0x59')],_0x18aba6[_0x8adb('0x88')])['then'](function(_0x4fd475){_0x34605d(null,_0x4fd475);})[_0x8adb('0x12')](function(_0x595d0a){_0x34605d(_0x595d0a);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x89')]=function(_0x2c5d87,_0x588937,_0x13c9cc){scripts[_0x8adb('0x89')](_0x588937,_0x2c5d87[_0x8adb('0x76')],_0x2c5d87[_0x8adb('0x8a')]||_0x8adb('0x7d'))[_0x8adb('0x10')](function(_0xcaaed5){_0x13c9cc(null,_0xcaaed5);})[_0x8adb('0x12')](function(_0x1bb4f1){_0x13c9cc(_0x1bb4f1);});};AGIVertices[_0x8adb('0x13')]['tildeASR']=function(_0x368645,_0x189704,_0x4905e2){scripts[_0x8adb('0x8b')](_0x189704,_0x368645[_0x8adb('0x8c')],_0x368645[_0x8adb('0x8d')],_0x368645['uri'])[_0x8adb('0x10')](function(_0x3852c4){_0x4905e2(null,_0x3852c4);})['catch'](function(_0x410b17){_0x4905e2(_0x410b17);});};AGIVertices[_0x8adb('0x13')][_0x8adb('0x8e')]=function(_0xcc94a8){var _0x2fab14=_[_0x8adb('0x8f')](verticesWithRetry,_0xcc94a8[_0x8adb('0x90')])?_0xcc94a8:_[_0x8adb('0x91')](_0xcc94a8);for(var _0x5243cf in _0x2fab14){if(_0x2fab14[_0x8adb('0x92')](_0x5243cf)){if(_0x2fab14[_0x5243cf]&&_[_0x8adb('0x93')](_0x2fab14[_0x5243cf])){if(_[_0x8adb('0x8f')](recursiveMapAttributes,_0x5243cf)){_0x2fab14[_0x5243cf]=this[_0x8adb('0x94')](_0x2fab14[_0x5243cf]);}else{_0x2fab14[_0x5243cf]=this['replaceAllVariables'](_0x2fab14[_0x5243cf]);}}}}return _0x2fab14;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x1b073c){for(var _0x3c59e0 in _0x1b073c){if(_0x1b073c['hasOwnProperty'](_0x3c59e0)){if(_[_0x8adb('0x95')](_0x1b073c[_0x3c59e0])){this['recursiveNodeIndex'](_0x1b073c[_0x3c59e0]);}else if(_[_0x8adb('0x96')](_0x1b073c[_0x3c59e0])){for(var _0x3e961c=0x0;_0x3e961c<_0x1b073c[_0x3c59e0][_0x8adb('0x97')];_0x3e961c++){this[_0x8adb('0x98')](_0x1b073c[_0x3c59e0][_0x3e961c]);}}else if(_[_0x8adb('0x93')](_0x1b073c[_0x3c59e0])){_0x1b073c[_0x3c59e0]=this[_0x8adb('0x99')](_0x1b073c[_0x3c59e0]);}}}};AGIVertices[_0x8adb('0x13')][_0x8adb('0x9a')]=function(_0x4a347b,_0x2afad3){for(var _0x59ba72 in _0x4a347b){if(_0x4a347b['hasOwnProperty'](_0x59ba72)){if(_[_0x8adb('0x95')](_0x4a347b[_0x59ba72])){if(!_[_0x8adb('0x42')](_0x4a347b[_0x59ba72])){this['saveRestApiResult'](_0x4a347b[_0x59ba72],util[_0x8adb('0x9b')](_0x8adb('0x9c'),_0x2afad3,_0x59ba72));}}else if(_[_0x8adb('0x96')](_0x4a347b[_0x59ba72])){for(var _0x25f9f3=0x0;_0x25f9f3<_0x4a347b[_0x59ba72]['length'];_0x25f9f3++){this[_0x8adb('0x9a')](_0x4a347b[_0x59ba72][_0x25f9f3],util[_0x8adb('0x9b')]('%s.%s',_0x2afad3,_0x59ba72+'['+_0x25f9f3+']'));}}else{if(!_[_0x8adb('0x43')](_0x4a347b[_0x59ba72])){this[_0x8adb('0x36')][_0x8adb('0x9d')](util[_0x8adb('0x9b')](_0x8adb('0x9c'),_0x2afad3,_0x59ba72),_0x4a347b[_0x59ba72]);}}}}};AGIVertices['prototype'][_0x8adb('0x94')]=function(_0x2ebb9d){try{var _0x472b65=JSON[_0x8adb('0x67')](_0x2ebb9d);this[_0x8adb('0x98')](_0x472b65);return JSON['stringify'](_0x472b65);}catch(_0x43ef6d){return this[_0x8adb('0x99')](_0x2ebb9d);}};AGIVertices[_0x8adb('0x13')][_0x8adb('0x99')]=function(_0x2aa23e){var _0x4e9c15=_0x2aa23e['split']('{');for(var _0x1ff262=0x1;_0x1ff262<_0x4e9c15[_0x8adb('0x97')];_0x1ff262+=0x1){var _0x38d50a=_0x4e9c15[_0x1ff262][_0x8adb('0x9e')]('}');if(_0x38d50a[_0x8adb('0x97')]>0x1){_0x2aa23e=_0x2aa23e[_0x8adb('0x9f')]('{'+_0x38d50a[0x0]+'}',this[_0x8adb('0x36')][_0x8adb('0xa0')](_0x38d50a[0x0])[_0x8adb('0xa1')]||_0x38d50a[0x0]);}}if(_0x4e9c15['length']===0x1){return _0x2aa23e[_0x8adb('0x4b')]();}return this[_0x8adb('0x99')](_0x2aa23e);};AGIVertices[_0x8adb('0x13')]['getAndSetVariable']=function(_0x20aed5,_0x2d2423){var _0x1df385=this[_0x8adb('0x36')][_0x8adb('0xa0')](_0x20aed5);if(_0x1df385[_0x8adb('0xa2')]===-0x1){return _0x1df385;}logger['info'](util['format'](_0x8adb('0xa3'),_0x2d2423,_0x1df385['extra']));return this[_0x8adb('0x36')][_0x8adb('0x9d')](_0x2d2423,_0x1df385[_0x8adb('0xa1')]);};AGIVertices[_0x8adb('0x13')]['isConfigured']=function(_0x4e864b){return _0x4e864b&&_0x4e864b!=='0'&&_0x4e864b!=='-1'&&_0x4e864b!=='';};AGIVertices[_0x8adb('0x13')]['maxRetry']=function(_0x5e6baa){this[_0x8adb('0xa4')][_0x8adb('0x6c')](this,_0x5e6baa,'-');_0x5e6baa[_0x8adb('0xa5')]=_0x5e6baa['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8adb('0x13')][_0x8adb('0xa6')]=function(_0x3c301f){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0xa7'),_0x3c301f[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x3c301f['text'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xa9'));}var _0x2d551e='\x22'+_0x3c301f['text']+'\x22';if(this[_0x8adb('0x7f')](_0x3c301f[_0x8adb('0x74')])){_0x2d551e+=','+_0x3c301f['options'];}var _0xf72f72=this[_0x8adb('0x36')]['exec'](_0x8adb('0xaa'),_0x2d551e);if(_0xf72f72[_0x8adb('0xa2')]===-0x1){return _0xf72f72;}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xab'),_0x2d551e));};AGIVertices[_0x8adb('0x13')][_0x8adb('0xac')]=function(_0x1e5252){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0xad'),_0x1e5252[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x1e5252[_0x8adb('0xae')])){return this['channel'][_0x8adb('0xa8')]('no\x20grammar\x20configured');}var _0x2d6c4b=_0x1e5252[_0x8adb('0xae')];if(this[_0x8adb('0x7f')](_0x1e5252['options'])){_0x2d6c4b+=','+_0x1e5252[_0x8adb('0x74')];}var _0x2c3493=this[_0x8adb('0x36')]['exec'](_0x8adb('0xaf'),_0x2d6c4b);if(_0x2c3493[_0x8adb('0xa2')]===-0x1){return _0x2c3493;}var _0x4fd466=this[_0x8adb('0xb0')](_0x8adb('0xb1'),_0x8adb('0xb2'));if(_0x4fd466[_0x8adb('0xa2')]===-0x1){return _0x4fd466;}var _0x260190=this[_0x8adb('0xb0')](_0x8adb('0xb3'),_0x8adb('0xb4'));if(_0x260190[_0x8adb('0xa2')]===-0x1){return _0x260190;}var _0x53df92=this[_0x8adb('0xb0')](_0x8adb('0xb5'),'MRCP_RECOG_INSTANCE');if(_0x53df92[_0x8adb('0xa2')]===-0x1){return _0x53df92;}return this['channel'][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xb6'),_0x2d6c4b));};AGIVertices['prototype'][_0x8adb('0x6')]=function(_0x148c60){logger['info'](util['format'](_0x8adb('0xb7'),_0x148c60[_0x8adb('0x35')]));return this[_0x8adb('0x36')]['agi']([_0x148c60[_0x8adb('0xb8')],_0x148c60['args']]);};AGIVertices[_0x8adb('0x13')][_0x8adb('0xb9')]=function(_0x159718){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0xba'),_0x159718[_0x8adb('0x35')]));if(this['isConfigured'](_0x159718[_0x8adb('0x61')])){logger[_0x8adb('0x2f')](util['format'](_0x8adb('0xbb'),_0x159718[_0x8adb('0x61')]));var _0x363b77=this['channel'][_0x8adb('0xbc')](_0x159718[_0x8adb('0x61')]);if(_0x363b77['result']===-0x1){return _0x363b77;}}return this[_0x8adb('0x36')][_0x8adb('0xb9')]();};AGIVertices[_0x8adb('0x13')][_0x8adb('0x49')]=function(_0x56ed25){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x56ed25[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x56ed25[_0x8adb('0x47')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x56ed25,_0x8adb('0xbd'));}_0x56ed25[_0x8adb('0x48')]=moment();if(this[_0x8adb('0x7f')](_0x56ed25[_0x8adb('0xbe')])){_0x56ed25['scheduledAt']=moment()['add'](_0x56ed25['delay'],_0x8adb('0xbf'));}if(!this[_0x8adb('0x7f')](_0x56ed25[_0x8adb('0x4c')])){_0x56ed25[_0x8adb('0x4c')]=0x2;}this[_0x8adb('0x41')]['sync'](this,_0x56ed25);return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xc0'),_0x56ed25[_0x8adb('0x46')],_0x56ed25['list_id'],_0x56ed25[_0x8adb('0x48')]));};AGIVertices['prototype'][_0x8adb('0xc1')]=function(_0x286cc9){logger['info'](util['format'](_0x8adb('0xc2'),_0x286cc9[_0x8adb('0x35')]));var _0xf3129a=this[_0x8adb('0x36')][_0x8adb('0xc3')](_0x286cc9['application'],_0x286cc9[_0x8adb('0x74')]);if(_0xf3129a['result']===-0x1){return _0xf3129a;}return this[_0x8adb('0x36')]['noop'](util[_0x8adb('0x9b')]('Executed\x20command\x20%s\x20%s',_0x286cc9[_0x8adb('0xc4')],_0x286cc9[_0x8adb('0x74')]));};AGIVertices[_0x8adb('0x13')][_0x8adb('0xc5')]=function(_0x1e9e2f){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0xc6'),_0x1e9e2f[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x1e9e2f[_0x8adb('0x59')])){return this[_0x8adb('0x36')]['noop']('no\x20text\x20configured');}var _0x554626='\x22'+_0x1e9e2f[_0x8adb('0x59')]+'\x22';if(this[_0x8adb('0x7f')](_0x1e9e2f['options'])){_0x554626+=','+_0x1e9e2f[_0x8adb('0x74')];}var _0x1f2683=this[_0x8adb('0x36')][_0x8adb('0xc3')]('MRCPSynth',_0x554626);if(_0x1f2683[_0x8adb('0xa2')]===-0x1){return _0x1f2683;}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x554626));};AGIVertices[_0x8adb('0x13')][_0x8adb('0xc7')]=function(_0x557ae2){logger[_0x8adb('0x2f')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x557ae2[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x557ae2[_0x8adb('0x59')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xa9'));}var _0x3c92f0='\x22'+_0x557ae2[_0x8adb('0x59')]+'\x22';if(this['isConfigured'](_0x557ae2[_0x8adb('0x74')])){_0x3c92f0+=','+_0x557ae2[_0x8adb('0x74')];}var _0x56c235=this[_0x8adb('0x36')][_0x8adb('0xc3')](_0x8adb('0xaa'),_0x3c92f0);if(_0x56c235['result']===-0x1){return _0x56c235;}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xab'),_0x3c92f0));};AGIVertices[_0x8adb('0x13')]['lumenvoxasr']=function(_0x58ef4a){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0xc8'),_0x58ef4a['label']));if(!this[_0x8adb('0x7f')](_0x58ef4a[_0x8adb('0xae')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xc9'));}var _0x36d572=_0x58ef4a[_0x8adb('0xae')];if(this[_0x8adb('0x7f')](_0x58ef4a[_0x8adb('0x74')])){_0x36d572+=','+_0x58ef4a[_0x8adb('0x74')];}var _0x119eb9=this[_0x8adb('0x36')][_0x8adb('0xc3')](_0x8adb('0xaf'),_0x36d572);if(_0x119eb9[_0x8adb('0xa2')]===-0x1){return _0x119eb9;}var _0x49d649=this[_0x8adb('0xb0')](_0x8adb('0xb1'),'LUMENVOX_ASR_CONFIDENCE');if(_0x49d649[_0x8adb('0xa2')]===-0x1){return _0x49d649;}var _0x58f082=this[_0x8adb('0xb0')]('RECOG_INPUT()',_0x8adb('0xca'));if(_0x58f082[_0x8adb('0xa2')]===-0x1){return _0x58f082;}var _0x15b743=this[_0x8adb('0xb0')](_0x8adb('0xb5'),_0x8adb('0xcb'));if(_0x15b743[_0x8adb('0xa2')]===-0x1){return _0x15b743;}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format'](_0x8adb('0xb6'),_0x36d572));};AGIVertices[_0x8adb('0x13')][_0x8adb('0xcc')]=function(_0x23ce71){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0xcd'),_0x23ce71[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x23ce71[_0x8adb('0xae')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xc9'));}var _0x8ffbe0=_0x23ce71[_0x8adb('0xae')];if(this[_0x8adb('0x7f')](_0x23ce71[_0x8adb('0x74')])){_0x8ffbe0+=','+_0x23ce71[_0x8adb('0x74')];}var _0x3f07b1=this[_0x8adb('0x36')]['exec'](_0x8adb('0xaf'),_0x8ffbe0);if(_0x3f07b1[_0x8adb('0xa2')]===-0x1){return _0x3f07b1;}var _0x5e68ba=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x8adb('0xce'));if(_0x5e68ba['result']===-0x1){return _0x5e68ba;}var _0x58a5ae=this[_0x8adb('0xb0')]('RECOG_INPUT()',_0x8adb('0xcf'));if(_0x58a5ae[_0x8adb('0xa2')]===-0x1){return _0x58a5ae;}var _0x33bab6=this[_0x8adb('0xb0')](_0x8adb('0xb5'),_0x8adb('0xd0'));if(_0x33bab6[_0x8adb('0xa2')]===-0x1){return _0x33bab6;}return this[_0x8adb('0x36')]['noop'](util['format'](_0x8adb('0xb6'),_0x8ffbe0));};AGIVertices[_0x8adb('0x13')][_0x8adb('0xd1')]=function(_0x5bc902){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0xd2'),_0x5bc902[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x5bc902[_0x8adb('0xd3')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x5bc902,_0x8adb('0xd4'));}var _0x3f77e2=this[_0x8adb('0x15')][_0x8adb('0x6c')](this,_0x5bc902['odbc_id']);if(!_0x3f77e2){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x5bc902,_0x8adb('0xd5'));}if(!this[_0x8adb('0x7f')](_0x5bc902[_0x8adb('0xd6')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x5bc902,_0x8adb('0xd7'));}var _0x365845=_0x5bc902[_0x8adb('0xd6')][_0x8adb('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xd8'),_0x365845));var _0x4d63e0=this['getQueryOdbc']['sync'](this,_0x3f77e2,_0x365845);this[_0x8adb('0xa4')][_0x8adb('0x6c')](this,_0x5bc902,_0x365845);if(!this['isConfigured'](_0x5bc902['variable_id'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x38ea54=this[_0x8adb('0xa0')][_0x8adb('0x6c')](this,_0x5bc902[_0x8adb('0xd9')]);if(!_0x38ea54){return this['channel'][_0x8adb('0x2c')](_0x5bc902,_0x8adb('0xda'));}var _0x4fdb02=this;_0x4d63e0['forEach'](function(_0x228f8e,_0x5b399c){Object[_0x8adb('0xdb')](_0x228f8e)[_0x8adb('0xdc')](function(_0x1ca1d3){_0x4fdb02['channel'][_0x8adb('0x9d')](util['format'](_0x8adb('0xdd'),_0x38ea54,_0x5b399c,_0x1ca1d3),_0x228f8e[_0x1ca1d3]);});});this[_0x8adb('0x36')]['setVariable'](util[_0x8adb('0x9b')]('%s_ROWS_COUNT',_0x38ea54),_0x4d63e0[_0x8adb('0x97')]);return this['channel'][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xde'),_0x38ea54));};AGIVertices['prototype'][_0x8adb('0xdf')]=function(_0x5b6cdd){logger[_0x8adb('0xe0')](util[_0x8adb('0x9b')](_0x8adb('0xe1'),_0x5b6cdd[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x5b6cdd[_0x8adb('0xe2')])){return this['channel'][_0x8adb('0x2c')](_0x5b6cdd,_0x8adb('0xe3'));}var _0x2ca4b1=this[_0x8adb('0xe4')][_0x8adb('0x6c')](this,_0x5b6cdd['sip_id']);if(!_0x2ca4b1){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x5b6cdd,'no\x20user\x20found');}var _0x2afe09=this['channel'][_0x8adb('0xc3')](_0x8adb('0xe5'),[util['format'](_0x8adb('0xe6'),_0x2ca4b1),_0x5b6cdd[_0x8adb('0x61')],_0x5b6cdd[_0x8adb('0xe7')],_0x5b6cdd[_0x8adb('0x5f')]]);if(_0x2afe09['result']===-0x1){return _0x2afe09;}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xe8'),'DIAL'));};AGIVertices[_0x8adb('0x13')]['dialogflow']=function(_0x5bf172){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0xe9'),_0x5bf172[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x5bf172[_0x8adb('0x76')])){return this['channel'][_0x8adb('0xa8')](_0x8adb('0xea'));}if(!this[_0x8adb('0x7f')](_0x5bf172['text'])){return this['channel'][_0x8adb('0xa8')](_0x8adb('0xa9'));}this[_0x8adb('0x36')]['bot']=!![];this[_0x8adb('0xa4')](_0x5bf172);this[_0x8adb('0x40')](_0x5bf172[_0x8adb('0x59')],'in','','');this[_0x8adb('0x36')]['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0x5bf172[_0x8adb('0x59')]));var _0x2b635c=this[_0x8adb('0x75')]['sync'](this,_0x5bf172);if(_0x2b635c){for(var _0x410fe3 in _0x2b635c){if(_0x2b635c[_0x8adb('0x92')](_0x410fe3)){this[_0x8adb('0x36')][_0x8adb('0x9d')](util[_0x8adb('0x9b')]('DIALOGFLOW_%s',_0x410fe3['toUpperCase']()),_0x2b635c[_0x410fe3]);}}this[_0x8adb('0x40')](_0x2b635c['speech'],'out','dialogflow','');return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xeb'),_0x2b635c[_0x8adb('0xec')]));}return this[_0x8adb('0x36')]['error'](_0x5bf172,_0x8adb('0xed'));};AGIVertices[_0x8adb('0x13')][_0x8adb('0xee')]=function(_0x488957){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0xef'),_0x488957[_0x8adb('0x35')]));if(!this['isConfigured'](_0x488957[_0x8adb('0xf0')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xf1'));}if(!this[_0x8adb('0x7f')](_0x488957[_0x8adb('0x77')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xf2'));}if(!this[_0x8adb('0x7f')](_0x488957['private_key'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xf3'));}if(!this[_0x8adb('0x7f')](_0x488957[_0x8adb('0x79')])){return this['channel'][_0x8adb('0xa8')](_0x8adb('0xf4'));}if(!this[_0x8adb('0x7f')](_0x488957[_0x8adb('0x59')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')]('no\x20text\x20configured');}this['channel'][_0x8adb('0xf5')]=!![];this[_0x8adb('0xa4')](_0x488957);this[_0x8adb('0x40')](_0x488957[_0x8adb('0x59')],'in','','');this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format'](_0x8adb('0xf6'),_0x488957[_0x8adb('0x59')]));var _0xef712c=this['googleDialogflowV2']['sync'](this,_0x488957);if(_0xef712c){for(var _0x16beeb in _0xef712c){if(_0xef712c[_0x8adb('0x92')](_0x16beeb)){if(_0x16beeb!==_0x8adb('0xf7')){this[_0x8adb('0x36')][_0x8adb('0x9d')](util['format']('DIALOGFLOW_%s',_0x16beeb[_0x8adb('0x65')]()),_0xef712c[_0x16beeb]);}}}this['createSquareMessage'](_0xef712c[_0x8adb('0xec')],'out',_0x8adb('0xee'),_0xef712c[_0x8adb('0xf7')]);return this[_0x8adb('0x36')]['noop'](util[_0x8adb('0x9b')](_0x8adb('0xf8'),_0xef712c[_0x8adb('0xec')]));}return this['channel'][_0x8adb('0x2c')](_0x488957,_0x8adb('0xf9'));};AGIVertices[_0x8adb('0x13')][_0x8adb('0xfa')]=function(_0x4133a8){logger[_0x8adb('0x2f')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4133a8[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x4133a8[_0x8adb('0xfb')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x8adb('0x7f')](_0x4133a8[_0x8adb('0xfc')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x4133a8['password'])){return this['channel']['noop']('no\x20password\x20configured');}if(!this[_0x8adb('0x7f')](_0x4133a8[_0x8adb('0xfd')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xa9'));}this[_0x8adb('0x36')]['bot']=!![];this[_0x8adb('0xa4')](_0x4133a8);this['createSquareMessage'](_0x4133a8[_0x8adb('0x59')],'in','','');this['channel'][_0x8adb('0xa8')](util[_0x8adb('0x9b')]('Trying\x20SestekNDA:\x20%s',_0x4133a8['text']));var _0x406d6a=this[_0x8adb('0x7a')][_0x8adb('0x6c')](this,_0x4133a8);if(_0x406d6a){for(var _0xd1ea93 in _0x406d6a){if(_0x406d6a[_0x8adb('0x92')](_0xd1ea93)){this[_0x8adb('0x36')]['setVariable'](util[_0x8adb('0x9b')](_0x8adb('0xfe'),_0xd1ea93[_0x8adb('0x65')]()),_0x406d6a[_0xd1ea93]);}}this[_0x8adb('0x40')](_0x406d6a[_0x8adb('0xec')],_0x8adb('0xff'),_0x8adb('0xfa'),'');if(_0x406d6a[_0x8adb('0x100')]){this[_0x8adb('0x36')]['noop'](util[_0x8adb('0x9b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x406d6a[_0x8adb('0x100')]));var _0x54d20f=this['channel'][_0x8adb('0x101')](_0x406d6a[_0x8adb('0x100')]);try{fs[_0x8adb('0x102')](_0x406d6a[_0x8adb('0x100')]+_0x8adb('0x103'));}catch(_0xf33c87){logger[_0x8adb('0x2c')](_0xf33c87);}return _0x54d20f;}else{return this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format']('SestekNDA\x20Result\x20%s',_0x406d6a[_0x8adb('0xec')]));}}return this['channel'][_0x8adb('0x2c')](_0x4133a8,_0x8adb('0x104'));};AGIVertices['prototype'][_0x8adb('0x105')]=function(_0x2422ff){logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x106'),_0x2422ff[_0x8adb('0x35')]));return this[_0x8adb('0x36')]['noop'](_0x8adb('0x105'));};AGIVertices[_0x8adb('0x13')][_0x8adb('0x107')]=function(_0x46fdea){logger['info'](util[_0x8adb('0x9b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x46fdea[_0x8adb('0x35')]));var _0x3e799c='';if(_0x46fdea['trunk_id']){if(!this[_0x8adb('0x7f')](_0x46fdea['trunk_id'])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x46fdea,'no\x20trunk\x20selected');}else{var _0x3e6845=parseInt(_0x46fdea['trunk_id'],0xa);if(isNaN(_0x3e6845)){_0x3e799c=_0x46fdea[_0x8adb('0x108')];}else{_0x3e799c=this[_0x8adb('0x19')][_0x8adb('0x6c')](this,_0x46fdea[_0x8adb('0x108')]);if(!_0x3e799c){return this['channel'][_0x8adb('0x2c')](_0x46fdea,_0x8adb('0x109'));}}}}else if(_0x46fdea[_0x8adb('0x10a')]){_0x3e799c=_0x46fdea[_0x8adb('0x10a')];}else{return this[_0x8adb('0x36')]['error'](_0x46fdea,_0x8adb('0x10b'));}var _0x174df9=this[_0x8adb('0x36')][_0x8adb('0xc3')](_0x8adb('0xe5'),[util[_0x8adb('0x9b')]('SIP/%s/%s',_0x3e799c,_0x46fdea[_0x8adb('0x46')]),_0x46fdea[_0x8adb('0x61')],_0x46fdea[_0x8adb('0xe7')],_0x46fdea[_0x8adb('0x5f')]]);if(_0x174df9[_0x8adb('0xa2')]===-0x1){return _0x174df9;}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xe8'),_0x8adb('0xe5')));};AGIVertices[_0x8adb('0x13')]['finally']=function(_0x5b339a){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x10c'),_0x5b339a[_0x8adb('0x35')]));return this['channel'][_0x8adb('0xa8')](_0x8adb('0x10d'));};AGIVertices['prototype'][_0x8adb('0xc')]=function(_0x1e664f){logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x10e'),_0x1e664f['label']));if(_0x1e664f[_0x8adb('0xa5')]===0x0){return this[_0x8adb('0x10f')](_0x1e664f);}_0x1e664f[_0x8adb('0xa5')]-=0x1;if(!this[_0x8adb('0x7f')](_0x1e664f['file_id'])){return this['channel'][_0x8adb('0x2c')](_0x1e664f,'no\x20file\x20audio\x20selected');}var _0x1cc069=this['getSound']['sync'](this,_0x1e664f[_0x8adb('0x110')]);if(!_0x1cc069){return this[_0x8adb('0x36')]['error'](_0x1e664f,_0x8adb('0x111'));}if(!this[_0x8adb('0x7f')](_0x1e664f[_0x8adb('0xd9')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2bfcc0=this[_0x8adb('0x36')][_0x8adb('0x112')](_0x1cc069,_0x1e664f[_0x8adb('0x113')],_0x1e664f['maxdigit']);var _0x5b1870=_0x2bfcc0['result']?_0x2bfcc0[_0x8adb('0xa2')][_0x8adb('0x4b')]():'';logger[_0x8adb('0x2f')](_0x8adb('0x114'),JSON[_0x8adb('0x6e')](_0x2bfcc0));if(_0x2bfcc0['result']===-0x1){this[_0x8adb('0xa4')][_0x8adb('0x6c')](this,_0x1e664f,_0x5b1870);return _0x2bfcc0;}else if(_0x2bfcc0[_0x8adb('0xa1')]===_0x8adb('0x61')){_0x2bfcc0[_0x8adb('0xa2')]=_0x5b1870[_0x8adb('0x97')]>=parseInt(_0x1e664f['mindigit'])?'x':'i';}else{_0x2bfcc0[_0x8adb('0xa2')]=_0x5b1870['length']>=parseInt(_0x1e664f[_0x8adb('0x115')])&&_0x5b1870[_0x8adb('0x97')]<=parseInt(_0x1e664f['maxdigit'])?'x':'i';}var _0x2f7506=this['getVariable'][_0x8adb('0x6c')](this,_0x1e664f['variable_id']);if(!_0x2f7506){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x1e664f,_0x8adb('0xda'));}this['channel'][_0x8adb('0x9d')](_0x2f7506,_0x5b1870);if(this[_0x8adb('0x7f')](_0x1e664f['hiddendigitsnum'])){var _0x3d3421=parseInt(_0x1e664f['hiddendigitsnum'],0xa);var _0x447d8=rs[_0x8adb('0x116')]({'charset':'*','length':_0x3d3421});var _0x56acd1=_0x5b1870[_0x8adb('0x97')];if(_0x56acd1>0x0){if(_0x56acd1>_0x3d3421){this[_0x8adb('0xa4')]['sync'](this,_0x1e664f,_0x1e664f[_0x8adb('0x117')]===_0x8adb('0x118')?_0x447d8+_0x5b1870[_0x8adb('0x119')](_0x3d3421):_0x5b1870[_0x8adb('0x119')](0x0,_0x56acd1-_0x3d3421)+_0x447d8);}else{this['createSquareDetailsReport'][_0x8adb('0x6c')](this,_0x1e664f,rs['generate']({'charset':'*','length':_0x56acd1}));}}else{this[_0x8adb('0xa4')]['sync'](this,_0x1e664f,'');}}else{this[_0x8adb('0xa4')][_0x8adb('0x6c')](this,_0x1e664f,_0x5b1870);}return _0x2bfcc0;};AGIVertices[_0x8adb('0x13')][_0x8adb('0xd')]=function(_0x4197a6){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x11a'),_0x4197a6[_0x8adb('0x35')]));return this[_0x8adb('0xc')](_0x4197a6);};AGIVertices[_0x8adb('0x13')][_0x8adb('0x11b')]=function(_0x56b700){logger[_0x8adb('0x2f')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x56b700[_0x8adb('0x35')]));this[_0x8adb('0xa4')][_0x8adb('0x6c')](this,_0x56b700,_0x56b700[_0x8adb('0x11c')]);return this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format']('GOAL\x20%s',_0x56b700['goalname']));};AGIVertices['prototype'][_0x8adb('0x11d')]=function(_0x120531){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x11e'),_0x120531['label']));if(!this[_0x8adb('0x7f')](_0x120531[_0x8adb('0x81')])||!this[_0x8adb('0x7f')](_0x120531['aws_secret_access_key'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0x11f'));}if(!this['isConfigured'](_0x120531[_0x8adb('0x59')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xa9'));}this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x120'),_0x120531[_0x8adb('0x59')]));var _0x2ecfc0=this[_0x8adb('0x121')][_0x8adb('0x6c')](this,_0x120531);if(_0x2ecfc0){this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x2ecfc0));var _0xfac0c8=this[_0x8adb('0x36')][_0x8adb('0x101')](_0x2ecfc0);try{fs[_0x8adb('0x102')](_0x2ecfc0+_0x8adb('0x103'));}catch(_0x494bd7){logger[_0x8adb('0x2c')](_0x494bd7);}return _0xfac0c8;}return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x120531,_0x8adb('0x122'));};AGIVertices[_0x8adb('0x13')]['awslex']=function(_0x35fa5a){logger[_0x8adb('0x2f')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x35fa5a[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x35fa5a[_0x8adb('0x81')])||!this[_0x8adb('0x7f')](_0x35fa5a[_0x8adb('0x82')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0x11f'));}if(!this[_0x8adb('0x7f')](_0x35fa5a[_0x8adb('0x88')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0x123'));}if(!this['isConfigured'](_0x35fa5a['text'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xa9'));}this[_0x8adb('0x36')][_0x8adb('0xf5')]=!![];this['createSquareDetailsReport'](_0x35fa5a);this['createSquareMessage'](_0x35fa5a['text'],'in','','');this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x35fa5a[_0x8adb('0x59')]));var _0x5ab1a7=this[_0x8adb('0x86')]['sync'](this,_0x35fa5a);if(_0x5ab1a7){for(var _0x3cf2b3 in _0x5ab1a7){if(_0x5ab1a7[_0x8adb('0x92')](_0x3cf2b3)&&_[_0x8adb('0x93')](_0x5ab1a7[_0x3cf2b3])){this['channel'][_0x8adb('0x9d')](util[_0x8adb('0x9b')](_0x8adb('0x124'),_0x3cf2b3[_0x8adb('0x65')]()),_0x5ab1a7[_0x3cf2b3]);}}if(_[_0x8adb('0x43')](_0x5ab1a7['message'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0x125'));}else{this[_0x8adb('0x40')](_0x5ab1a7[_0x8adb('0x72')],_0x8adb('0xff'),_0x8adb('0x126'),'');return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')]('Amazon\x20Lex\x20Result\x20%s',_0x5ab1a7['message']));}}return this['channel'][_0x8adb('0x2c')](_0x35fa5a,_0x8adb('0x127'));};AGIVertices[_0x8adb('0x13')][_0x8adb('0x128')]=function(_0x42a2d5){logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x129'),_0x42a2d5[_0x8adb('0x35')],_0x42a2d5[_0x8adb('0x61')]));if(!this[_0x8adb('0x7f')](_0x42a2d5[_0x8adb('0x76')])){return this[_0x8adb('0x36')]['noop'](_0x8adb('0xea'));}var _0x5350cf=_0x8adb('0x12a');var _0x37fe2a=util['format'](_0x8adb('0x12b'),FILES_PATH,rs[_0x8adb('0x116')](0x4));var _0x328bc6=util[_0x8adb('0x9b')](_0x8adb('0x9c'),_0x37fe2a,_0x5350cf);var _0x29570c=!![];if(_0x42a2d5[_0x8adb('0x12c')]===_0x8adb('0x12d')){_0x29570c=![];}var _0x1bfaa3=this[_0x8adb('0x36')][_0x8adb('0x12e')](_0x37fe2a,_0x5350cf,_0x42a2d5[_0x8adb('0x12f')],_0x42a2d5[_0x8adb('0x61')],undefined,_0x29570c);if(_0x1bfaa3[_0x8adb('0xa2')]!==-0x1){this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format']('google\x20%s\x20file\x20created',_0x328bc6));var _0x24a40e=this[_0x8adb('0x89')]['sync'](this,_0x42a2d5,_0x328bc6);if(_0x24a40e){for(var _0xedda40 in _0x24a40e){if(_0x24a40e[_0x8adb('0x92')](_0xedda40)){this['channel']['setVariable'](util[_0x8adb('0x9b')](_0x8adb('0x130'),_0xedda40['toUpperCase']()),_0x24a40e[_0xedda40]);}}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format'](_0x8adb('0x131'),JSON[_0x8adb('0x6e')](_0x24a40e)));}}return _0x1bfaa3;};AGIVertices['prototype']['tildeasr']=function(_0x38ab0e){logger[_0x8adb('0x2f')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x38ab0e[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x38ab0e[_0x8adb('0x8c')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')]('no\x20appid\x20configured');}if(!this[_0x8adb('0x7f')](_0x38ab0e[_0x8adb('0x8d')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')]('no\x20appsecret\x20configured');}var _0x51a1f9=_0x8adb('0x12a');var _0x549016=util[_0x8adb('0x9b')]('%s/recordings/%s',FILES_PATH,rs[_0x8adb('0x116')](0x4));var _0x2301c8=util[_0x8adb('0x9b')](_0x8adb('0x9c'),_0x549016,_0x51a1f9);var _0x34a86b=!![];if(_0x38ab0e['beep']===_0x8adb('0x12d')){_0x34a86b=![];}var _0x13c642=this['channel'][_0x8adb('0x12e')](_0x549016,_0x51a1f9,_0x38ab0e[_0x8adb('0x12f')],_0x38ab0e[_0x8adb('0x61')],undefined,_0x34a86b);if(_0x13c642[_0x8adb('0xa2')]!==-0x1){this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x132'),_0x2301c8));var _0x131389=this[_0x8adb('0x8b')][_0x8adb('0x6c')](this,_0x38ab0e,_0x2301c8);if(_0x131389){for(var _0x159db2 in _0x131389){if(_0x131389['hasOwnProperty'](_0x159db2)){this[_0x8adb('0x36')][_0x8adb('0x9d')](util[_0x8adb('0x9b')](_0x8adb('0x133'),_0x159db2[_0x8adb('0x65')]()),_0x131389[_0x159db2]);}}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')]('TildeASR\x20Result\x20%s',JSON[_0x8adb('0x6e')](_0x131389)));}}return _0x13c642;};AGIVertices[_0x8adb('0x13')][_0x8adb('0x134')]=function(_0x3afc9a){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x135'),_0x3afc9a[_0x8adb('0x35')]));return this['channel'][_0x8adb('0x136')](_0x3afc9a[_0x8adb('0x3a')],_0x3afc9a[_0x8adb('0x3b')],_0x3afc9a['priority']);};AGIVertices[_0x8adb('0x13')][_0x8adb('0x137')]=function(_0x3b7317){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x138'),_0x3b7317['label']));if(!this['isConfigured'](_0x3b7317[_0x8adb('0x139')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x3b7317,'no\x20condition\x20configured');}try{var _0x4e2f51=eval(_0x3b7317[_0x8adb('0x139')])?_0x8adb('0x13a'):'false';this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format'](_0x8adb('0x13b'),_0x3b7317[_0x8adb('0x139')],_0x4e2f51));return{'code':0xc8,'result':_0x4e2f51};}catch(_0x353e28){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x8adb('0x13')][_0x8adb('0x13c')]=function(_0x10e1d0){logger[_0x8adb('0x2f')](util['format'](_0x8adb('0x13d'),_0x10e1d0[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x10e1d0[_0x8adb('0x13e')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x10e1d0,_0x8adb('0x13f'));}var _0x42ff19=this[_0x8adb('0x23')][_0x8adb('0x6c')](this,_0x10e1d0[_0x8adb('0x13e')]);if(!_0x42ff19){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x10e1d0,_0x8adb('0x140'));}for(var _0x59d382=0x0;_0x59d382<_0x42ff19['length'];_0x59d382+=0x1){var _0x5c7aea=this[_0x8adb('0x36')][_0x8adb('0xa0')](util[_0x8adb('0x9b')](_0x8adb('0x141'),_0x42ff19[_0x59d382]));if(_0x5c7aea['result']===-0x1){return _0x5c7aea;}logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')]('IFTIME\x20%s\x20%s',_0x42ff19[_0x59d382],_0x5c7aea[_0x8adb('0xa1')]));if(_0x5c7aea['extra']===_0x8adb('0x13a')){logger[_0x8adb('0x2f')](util['format'](_0x8adb('0x142'),_0x42ff19[_0x59d382],'true'));this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x142'),_0x42ff19[_0x59d382],_0x8adb('0x13a')));return{'code':0xc8,'result':_0x8adb('0x13a')};}else{logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x142'),_0x42ff19[_0x59d382],'false'));this['channel'][_0x8adb('0xa8')](util['format']('IFTIME\x20%s\x20%s',_0x42ff19[_0x59d382],'false'));}}return{'code':0xc8,'result':_0x8adb('0x143')};};AGIVertices[_0x8adb('0x13')][_0x8adb('0x144')]=function(_0xa55a58){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xa55a58[_0x8adb('0x35')]));return this[_0x8adb('0x36')][_0x8adb('0x144')]();};AGIVertices[_0x8adb('0x13')][_0x8adb('0x145')]=function(_0x3ec166){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x146'),_0x3ec166['label']));if(!this['isConfigured'](_0x3ec166['key'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xea'));}var _0x57e6ca=_0x8adb('0x12a');var _0x3548ae=util[_0x8adb('0x9b')](_0x8adb('0x12b'),FILES_PATH,rs[_0x8adb('0x116')](0x4));var _0x3e9e9b=util[_0x8adb('0x9b')](_0x8adb('0x9c'),_0x3548ae,_0x57e6ca);var _0x12a976=!![];if(_0x3ec166['beep']==='NOBEEP'){_0x12a976=![];}var _0x2a9df9=this[_0x8adb('0x36')][_0x8adb('0x12e')](_0x3548ae,_0x57e6ca,_0x3ec166[_0x8adb('0x12f')],_0x3ec166[_0x8adb('0x61')],undefined,_0x12a976);if(_0x2a9df9['result']!==-0x1){this[_0x8adb('0x36')]['noop'](util[_0x8adb('0x9b')](_0x8adb('0x147'),_0x3e9e9b));var _0x5f33e0=this[_0x8adb('0x7e')][_0x8adb('0x6c')](this,_0x3ec166,_0x3e9e9b);if(_0x5f33e0){for(var _0x53341c in _0x5f33e0){if(_0x5f33e0[_0x8adb('0x92')](_0x53341c)){this[_0x8adb('0x36')][_0x8adb('0x9d')](util['format'](_0x8adb('0x148'),_0x53341c[_0x8adb('0x65')]()),_0x5f33e0[_0x53341c]);}}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x149'),JSON[_0x8adb('0x6e')](_0x5f33e0)));}}return _0x2a9df9;};AGIVertices[_0x8adb('0x13')][_0x8adb('0x14a')]=function(_0x37037a){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x37037a['label']));if(!this['isConfigured'](_0x37037a[_0x8adb('0x76')])){return this['channel'][_0x8adb('0xa8')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x37037a['text'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xa9'));}this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x14b'),_0x37037a[_0x8adb('0x59')]));var _0x501e78=this[_0x8adb('0x7b')]['sync'](this,_0x37037a);if(_0x501e78){this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x147'),_0x501e78));var _0x3197cb=this['channel']['streamFile'](_0x501e78,_0x37037a[_0x8adb('0x12f')]);try{fs[_0x8adb('0x102')](_0x501e78+_0x8adb('0x103'));}catch(_0x15896f){logger['error'](_0x15896f);}return _0x3197cb;}return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x37037a,_0x8adb('0x14c'));};AGIVertices[_0x8adb('0x13')]['login']=function(_0x3b7ccb){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x3b7ccb['label']));if(!this[_0x8adb('0x7f')](_0x3b7ccb['findBy'])){return this['channel'][_0x8adb('0x2c')](_0x3b7ccb,_0x8adb('0x14d'));}logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x14e'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0x3b7ccb['findBy']));var _0x505c23=this[_0x8adb('0x14f')]['sync'](this,_0x3b7ccb[_0x8adb('0x150')]);if(_0x505c23){logger['info'](util['format'](_0x8adb('0x151'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0x3b7ccb['findBy']));this['channel'][_0x8adb('0xa8')](util[_0x8adb('0x9b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8adb('0x36')][_0x8adb('0x38')],_0x3b7ccb[_0x8adb('0x150')]));return{'code':0xc8,'result':_0x8adb('0x152')};}else{logger[_0x8adb('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8adb('0x36')][_0x8adb('0x38')],_0x3b7ccb['findBy']));this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format'](_0x8adb('0x153'),this[_0x8adb('0x36')]['callerid'],_0x3b7ccb[_0x8adb('0x150')]));return{'code':0xc8,'result':_0x8adb('0x154')};}};AGIVertices[_0x8adb('0x13')]['logout']=function(_0xbe3c5c){logger[_0x8adb('0x2f')](util['format'](_0x8adb('0x155'),_0xbe3c5c[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0xbe3c5c['findBy'])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0xbe3c5c,'no\x20find\x20by\x20configured');}logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x14e'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0xbe3c5c[_0x8adb('0x150')]));var _0x589f6f=this['agentLogout'][_0x8adb('0x6c')](this,_0xbe3c5c[_0x8adb('0x150')]);if(_0x589f6f){logger[_0x8adb('0x2f')](util['format'](_0x8adb('0x151'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0xbe3c5c['findBy']));this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x151'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0xbe3c5c[_0x8adb('0x150')]));return{'code':0xc8,'result':_0x8adb('0x152')};}else{logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x153'),this[_0x8adb('0x36')]['callerid'],_0xbe3c5c[_0x8adb('0x150')]));this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x153'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0xbe3c5c[_0x8adb('0x150')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x8adb('0x156')]=function(_0x5896c1){logger[_0x8adb('0x2f')](util['format'](_0x8adb('0x157'),_0x5896c1[_0x8adb('0x35')]));if(!this['isConfigured'](_0x5896c1[_0x8adb('0x158')])){return this['channel'][_0x8adb('0x2c')](_0x5896c1,'no\x20operation\x20configured');}this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x159'),_0x5896c1[_0x8adb('0x158')]));var _0x20deb6=eval(_0x5896c1[_0x8adb('0x158')]);if(!this[_0x8adb('0x7f')](_0x5896c1[_0x8adb('0xd9')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0x15a'));}var _0x2de358=this[_0x8adb('0xa0')][_0x8adb('0x6c')](this,_0x5896c1[_0x8adb('0xd9')]);if(!_0x2de358){return this[_0x8adb('0x36')]['error'](_0x5896c1,'no\x20variable\x20found');}if(_[_0x8adb('0x96')](_0x20deb6)){var _0xe45076=this;_0x20deb6['forEach'](function(_0xd49865,_0x1ea1e1){_0xe45076[_0x8adb('0x36')][_0x8adb('0x9d')](util[_0x8adb('0x9b')](_0x8adb('0x15b'),_0x2de358,_0x1ea1e1),_0xd49865);});return this['channel'][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x15c'),_0x2de358));}else{return this[_0x8adb('0x36')][_0x8adb('0x9d')](_0x2de358,_0x20deb6);}};AGIVertices[_0x8adb('0x13')]['menu']=function(_0x44783e){logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x15d'),_0x44783e[_0x8adb('0x35')]));if(_0x44783e[_0x8adb('0xa5')]===0x0){return this[_0x8adb('0x10f')](_0x44783e);}_0x44783e[_0x8adb('0xa5')]-=0x1;if(!this[_0x8adb('0x7f')](_0x44783e[_0x8adb('0x110')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x44783e,_0x8adb('0x15e'));}var _0x46a7e8=this[_0x8adb('0x1b')][_0x8adb('0x6c')](this,_0x44783e[_0x8adb('0x110')]);if(!_0x46a7e8){return this['channel'][_0x8adb('0x2c')](_0x44783e,_0x8adb('0x111'));}var _0x3f6e0b=this[_0x8adb('0x36')][_0x8adb('0x112')](_0x46a7e8,_0x44783e[_0x8adb('0x113')],_0x44783e[_0x8adb('0x15f')]);var _0x209cf1=_0x3f6e0b[_0x8adb('0xa2')];if(_0x3f6e0b[_0x8adb('0xa2')]===-0x1){this[_0x8adb('0xa4')]['sync'](this,_0x44783e,'-1');return _0x3f6e0b;}else if(_0x3f6e0b[_0x8adb('0xa1')]===_0x8adb('0x61')){_0x3f6e0b['result']=_0x3f6e0b['result'][_0x8adb('0x97')]>0x0?_0x3f6e0b[_0x8adb('0xa2')]:'t';}else if(_[_0x8adb('0x42')](_0x3f6e0b[_0x8adb('0xa2')])){_0x3f6e0b['result']='#';_0x209cf1='#';}if(!this['isConfigured'](_0x44783e[_0x8adb('0xd9')])){this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2cac74=this[_0x8adb('0xa0')][_0x8adb('0x6c')](this,_0x44783e[_0x8adb('0xd9')]);if(!_0x2cac74){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x44783e,_0x8adb('0xda'));}this[_0x8adb('0x36')][_0x8adb('0x9d')](_0x2cac74,_0x209cf1);}this[_0x8adb('0xa4')][_0x8adb('0x6c')](this,_0x44783e,_0x209cf1);return _0x3f6e0b;};AGIVertices[_0x8adb('0x13')][_0x8adb('0xa8')]=function(_0x3b16d2){logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x160'),_0x3b16d2['label']));return this[_0x8adb('0x36')]['noop'](_0x3b16d2[_0x8adb('0x161')]||_0x3b16d2['label']);};AGIVertices[_0x8adb('0x13')]['pause']=function(_0x564846){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x162'),_0x564846[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x564846[_0x8adb('0x150')])){return this[_0x8adb('0x36')]['error'](_0x564846,_0x8adb('0x14d'));}logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x14e'),this['channel'][_0x8adb('0x38')],_0x564846[_0x8adb('0x150')]));var _0x125a92=this[_0x8adb('0x4d')][_0x8adb('0x6c')](this,_0x564846[_0x8adb('0x163')]);var _0x534c29=this[_0x8adb('0x4f')][_0x8adb('0x6c')](this,_0x564846[_0x8adb('0x150')],_0x125a92);if(_0x534c29){logger[_0x8adb('0x2f')](util['format'](_0x8adb('0x151'),this['channel'][_0x8adb('0x38')],_0x564846[_0x8adb('0x150')]));this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x151'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0x564846['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8adb('0x38')],_0x564846[_0x8adb('0x150')]));this[_0x8adb('0x36')]['noop'](util[_0x8adb('0x9b')](_0x8adb('0x151'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0x564846[_0x8adb('0x150')]));return{'code':0xc8,'result':_0x8adb('0x154')};}};AGIVertices[_0x8adb('0x13')][_0x8adb('0x164')]=function(_0x2ddeed){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x2ddeed[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x2ddeed[_0x8adb('0x110')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x2ddeed,_0x8adb('0x15e'));}var _0x28e91e=this[_0x8adb('0x1b')][_0x8adb('0x6c')](this,_0x2ddeed[_0x8adb('0x110')]);if(!_0x28e91e){return this[_0x8adb('0x36')]['error'](_0x2ddeed,_0x8adb('0x111'));}var _0x1c3a1f=this[_0x8adb('0x36')][_0x8adb('0xc3')](_0x8adb('0x165'),[_0x28e91e,_0x2ddeed['opts']]);if(_0x1c3a1f['result']===-0x1){return _0x1c3a1f;}return this['channel'][_0x8adb('0xa8')](util['format']('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x28e91e));};AGIVertices[_0x8adb('0x13')][_0x8adb('0x166')]=function(_0x3e6c67){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x167'),_0x3e6c67['label']));if(!this['isConfigured'](_0x3e6c67[_0x8adb('0x168')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x3e6c67,_0x8adb('0x169'));}var _0x5a61f2='';var _0x3795cb=parseInt(_0x3e6c67[_0x8adb('0x168')],0xa);if(isNaN(_0x3795cb)){_0x5a61f2=_0x3e6c67['queue_id'];}else{_0x5a61f2=this[_0x8adb('0x16a')]['sync'](this,_0x3e6c67[_0x8adb('0x168')]);if(!_0x5a61f2){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x3e6c67,_0x8adb('0x16b'));}}var _0x2a4daf='';if(this[_0x8adb('0x7f')](_0x3e6c67[_0x8adb('0x110')])){var _0x1512aa=this[_0x8adb('0x1b')]['sync'](this,_0x3e6c67[_0x8adb('0x110')]);if(_0x1512aa){_0x2a4daf=_0x1512aa;}}this['createSquareDetailsReport'][_0x8adb('0x6c')](this,_0x3e6c67,_0x5a61f2);if(_0x3e6c67['opts'][_0x8adb('0x16c')]('x')<0x0){_0x3e6c67[_0x8adb('0xe7')]+='x';}if(_0x3e6c67[_0x8adb('0xe7')]['indexOf']('X')<0x0){_0x3e6c67[_0x8adb('0xe7')]+='X';}this[_0x8adb('0x36')][_0x8adb('0x9d')]('XMCS-QUEUE',_0x5a61f2?_0x5a61f2[_0x8adb('0x16d')]():'');var _0x43fa4d=this['channel'][_0x8adb('0xc3')]('QUEUE',[_0x5a61f2,_0x3e6c67['opts'],_0x3e6c67[_0x8adb('0x5f')],_0x2a4daf,_0x3e6c67[_0x8adb('0x61')],_0x3e6c67[_0x8adb('0x6')],_0x3e6c67[_0x8adb('0x16e')],_0x3e6c67['gosub'],'',_0x3e6c67[_0x8adb('0x16f')]]);if(_0x43fa4d[_0x8adb('0xa2')]===-0x1){return _0x43fa4d;}return this['channel']['noop'](util[_0x8adb('0x9b')](_0x8adb('0x170'),_0x8adb('0x171'),_0x5a61f2));};AGIVertices[_0x8adb('0x13')][_0x8adb('0x172')]=function(_0xaa38eb){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x173'),_0xaa38eb[_0x8adb('0x35')]));var _0x4850e9=_0xaa38eb[_0x8adb('0x174')]||_0x8adb('0x12a');var _0x32f1e9=util[_0x8adb('0x9b')](_0x8adb('0x175'),this['channel'][_0x8adb('0x34')],rs[_0x8adb('0x116')](0x5));var _0x2be516=util[_0x8adb('0x9b')](_0x8adb('0x176'),FILES_PATH,_0x32f1e9,_0x4850e9);var _0x16f3e4=util[_0x8adb('0x9b')](_0x8adb('0x12b'),FILES_PATH,_0x32f1e9);this[_0x8adb('0x39')][_0x8adb('0x6c')](this,_0xaa38eb,_0x32f1e9,_0x2be516);this[_0x8adb('0x36')]['setVariable']('RECORDING_SAVENAME',_0x32f1e9);logger['info'](_0x8adb('0x177'),_0x16f3e4,_0x4850e9,_0xaa38eb['escape_digits'],_0xaa38eb['timeout']);return this[_0x8adb('0x36')][_0x8adb('0x12e')](_0x16f3e4,_0x4850e9,_0xaa38eb[_0x8adb('0x178')],_0xaa38eb[_0x8adb('0x61')],undefined,!![]);};AGIVertices[_0x8adb('0x13')][_0x8adb('0x179')]=function(_0x4df263){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x17a'),_0x4df263[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x4df263['url'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0x17b'));}var _0x7e6f7e=this[_0x8adb('0x5e')][_0x8adb('0x6c')](this,_0x4df263);logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x17c'),util[_0x8adb('0x17d')](_0x7e6f7e,{'showHidden':![],'depth':null})));if(!this[_0x8adb('0x7f')](_0x4df263[_0x8adb('0xd9')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0x17e'));}var _0x3dc1ff=this[_0x8adb('0xa0')][_0x8adb('0x6c')](this,_0x4df263[_0x8adb('0xd9')]);if(!_0x3dc1ff){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x4df263,_0x8adb('0xda'));}this[_0x8adb('0x36')][_0x8adb('0x9d')](util[_0x8adb('0x9b')](_0x8adb('0x17f'),_0x3dc1ff),_0x7e6f7e['statusCode']?_0x7e6f7e[_0x8adb('0x70')]:'200');this[_0x8adb('0x36')][_0x8adb('0x9d')](util[_0x8adb('0x9b')](_0x8adb('0x180'),_0x3dc1ff),_0x7e6f7e[_0x8adb('0x71')]?_0x7e6f7e['statusMessage']:'OK');if(_0x7e6f7e[_0x8adb('0x66')]){try{this[_0x8adb('0x9a')](_0x7e6f7e['body'],_0x3dc1ff);}catch(_0x1ce93f){logger[_0x8adb('0x2c')](util['format'](_0x8adb('0x181'),_0x3dc1ff));}}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0xde'),_0x3dc1ff));};AGIVertices[_0x8adb('0x13')]['saydigits']=function(_0x25e565){logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x182'),_0x25e565[_0x8adb('0x35')]));return this[_0x8adb('0x36')][_0x8adb('0x183')](_0x25e565[_0x8adb('0x184')][_0x8adb('0x55')](/\s+/g,''),_0x25e565[_0x8adb('0x178')]);};AGIVertices[_0x8adb('0x13')]['saynumber']=function(_0x28dcf9){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x185'),_0x28dcf9[_0x8adb('0x35')]));return this['channel'][_0x8adb('0x186')](_0x28dcf9['number'][_0x8adb('0x55')](/\s+/g,''),_0x28dcf9[_0x8adb('0x178')]);};AGIVertices[_0x8adb('0x13')]['sayphonetic']=function(_0x514432){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x187'),_0x514432[_0x8adb('0x35')]));return this[_0x8adb('0x36')][_0x8adb('0x188')](_0x514432[_0x8adb('0x59')],_0x514432['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x50e89e){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x189'),_0x50e89e[_0x8adb('0x35')]));if(!this['isConfigured'](_0x50e89e[_0x8adb('0x18a')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')]('no\x20mail\x20account\x20configured');}var _0xdae010=this[_0x8adb('0x1f')][_0x8adb('0x6c')](this,_0x50e89e['account_id']);if(!_0xdae010||!_0xdae010[_0x8adb('0x18b')]){return this['channel'][_0x8adb('0x2c')](_0x50e89e,_0x8adb('0x18c'));}var _0x476561={'from':util[_0x8adb('0x9b')]('\x22%s\x22\x20<%s>',_0xdae010[_0x8adb('0x11')],_0xdae010[_0x8adb('0x18d')]||_0xdae010[_0x8adb('0x18b')][_0x8adb('0x18e')]),'to':_0x50e89e['to']||'','cc':_0x50e89e['cc']||'','bcc':_0x50e89e[_0x8adb('0x18f')]||'','subject':_0x50e89e[_0x8adb('0x190')],'html':_0x50e89e[_0x8adb('0x59')],'text':_0x50e89e[_0x8adb('0x59')]};if(this[_0x8adb('0x7f')](_0x50e89e['template_id'])){}logger['debug'](_0x8adb('0x191'),JSON['stringify'](_0x476561));this[_0x8adb('0xa4')]['sync'](this,_0x50e89e,_0x50e89e[_0x8adb('0x18a')]);this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format'](_0x8adb('0x192'),_0xdae010[_0x8adb('0x11')]));this[_0x8adb('0x22')][_0x8adb('0x6c')](this,_0xdae010[_0x8adb('0x193')],_0x476561);return this['channel']['noop'](_0x8adb('0x194'));};AGIVertices[_0x8adb('0x13')]['sendFax']=function(_0x59cc9f){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x195'),_0x59cc9f['label']));return this['channel'][_0x8adb('0xa8')](_0x8adb('0x196'));};AGIVertices[_0x8adb('0x13')][_0x8adb('0x197')]=function(_0x18864c){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x198'),_0x18864c['label']));if(!this[_0x8adb('0x7f')](_0x18864c[_0x8adb('0x199')])){return this['channel'][_0x8adb('0xa8')](_0x8adb('0x19a'));}var _0x4f2485=this[_0x8adb('0x31')][_0x8adb('0x6c')](this,_0x18864c[_0x8adb('0x199')]);if(!_0x4f2485){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x18864c,'no\x20sms\x20account\x20found');}var _0xf24921={'body':_0x18864c[_0x8adb('0x19b')],'phone':_0x18864c['to']||'','SmsAccountId':_0x4f2485['id']};logger[_0x8adb('0xe0')]('sendSMS\x20message',JSON[_0x8adb('0x6e')](_0xf24921));this['createSquareDetailsReport'][_0x8adb('0x6c')](this,_0x18864c,_0x18864c['sms_account_id']);this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x19c'),_0x4f2485[_0x8adb('0x11')]));this[_0x8adb('0x33')][_0x8adb('0x6c')](this,_0xf24921);return this['channel'][_0x8adb('0xa8')](_0x8adb('0x19d'));};AGIVertices[_0x8adb('0x13')]['set']=function(_0x52c588){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x52c588[_0x8adb('0x35')]));if(!this[_0x8adb('0x7f')](_0x52c588[_0x8adb('0xd9')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x52c588,_0x8adb('0x19e'));}var _0x5cdd27=this[_0x8adb('0xa0')]['sync'](this,_0x52c588[_0x8adb('0xd9')]);if(!_0x5cdd27){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x52c588,_0x8adb('0xda'));}return this[_0x8adb('0x36')][_0x8adb('0x9d')](_0x5cdd27,_0x52c588['variable_value']);};AGIVertices[_0x8adb('0x13')][_0x8adb('0x19f')]=function(_0x2ffde6){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x1a0'),_0x2ffde6[_0x8adb('0x35')]));this[_0x8adb('0x36')]['noop'](_0x8adb('0x1a1'));var _0x2097d7=this['channel'][_0x8adb('0xa0')](_0x8adb('0x1a2'));if(!_['isEmpty'](_0x2097d7[_0x8adb('0xa1')])){this[_0x8adb('0x36')][_0x8adb('0x34')]=_0x2097d7[_0x8adb('0xa1')];}if(_0x2ffde6[_0x8adb('0xb9')]===_0x8adb('0x1a3')){this[_0x8adb('0x36')]['noop']('Answer');return this[_0x8adb('0x36')]['answer']();}return this[_0x8adb('0x36')]['noop'](_0x8adb('0x1a4'));};AGIVertices['prototype']['subproject']=function(_0x2ec882){logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x1a5'),_0x2ec882['label']));if(!this[_0x8adb('0x7f')](_0x2ec882[_0x8adb('0x1a6')])){return this[_0x8adb('0x36')]['error'](_0x2ec882,_0x8adb('0x1a7'));}var _0x488654=this[_0x8adb('0x14')]['sync'](this,_0x2ec882['project_id']);if(!this[_0x8adb('0x7f')](_0x488654)){return this['channel'][_0x8adb('0x2c')](_0x2ec882,util[_0x8adb('0x9b')](_0x8adb('0x1a8'),_0x2ec882[_0x8adb('0x1a6')]));}if(_0x488654===this[_0x8adb('0x36')]['arg_1']){return this['channel']['error'](_0x2ec882,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x8adb('0xa4')][_0x8adb('0x6c')](this,_0x2ec882,_0x488654);var _0x5af9de=this[_0x8adb('0x36')]['exec'](_0x8adb('0x1a9'),util[_0x8adb('0x9b')](_0x8adb('0x1aa'),config['agi'][_0x8adb('0x1ab')]||'127.0.0.1',_0x488654,this[_0x8adb('0x36')][_0x8adb('0x37')]));if(_0x5af9de['result']===-0x1){return _0x5af9de;}return this[_0x8adb('0x36')]['noop'](util[_0x8adb('0x9b')](_0x8adb('0x170'),'AGI',_0x488654));};AGIVertices['prototype']['system']=function(_0x222250){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x1ac'),_0x222250['label']));var _0x3a5b82=this[_0x8adb('0x53')]['sync'](this,_0x222250[_0x8adb('0xb8')]);this[_0x8adb('0xa4')]['sync'](this,_0x222250,_0x222250[_0x8adb('0xb8')]);if(this['isConfigured'](_0x222250[_0x8adb('0xd9')])){var _0x126b52=this[_0x8adb('0xa0')]['sync'](this,_0x222250[_0x8adb('0xd9')]);if(_0x126b52){this[_0x8adb('0x36')][_0x8adb('0x9d')](_0x126b52,_0x3a5b82);return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x222250['command'],_0x126b52));}}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x1ad'),_0x222250[_0x8adb('0xb8')]));};AGIVertices[_0x8adb('0x13')]['google_cloud_tts']=function(_0x29759e){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x29759e[_0x8adb('0x35')]));_0x29759e['text']=_0x29759e[_0x8adb('0x59')][_0x8adb('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x29759e[_0x8adb('0x57')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0x1ae'));}if(!this['isConfigured'](_0x29759e[_0x8adb('0x59')])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xa9'));}this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x29759e['text']));var _0x1d3495=this[_0x8adb('0x56')][_0x8adb('0x6c')](this,_0x29759e);if(_0x1d3495){this[_0x8adb('0x36')]['noop'](util[_0x8adb('0x9b')](_0x8adb('0x1af'),_0x1d3495));var _0x372b46=this['channel'][_0x8adb('0x101')](_0x1d3495);try{fs[_0x8adb('0x102')](_0x1d3495+_0x8adb('0x103'));}catch(_0x3a8515){logger[_0x8adb('0x2c')](_0x3a8515);}return _0x372b46;}return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x29759e,_0x8adb('0x1b0'));};AGIVertices[_0x8adb('0x13')][_0x8adb('0x1b1')]=function(_0x32650b){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x1b2'),_0x32650b[_0x8adb('0x35')]));_0x32650b[_0x8adb('0x59')]=_0x32650b['text'][_0x8adb('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8adb('0x7f')](_0x32650b['text'])){return this[_0x8adb('0x36')][_0x8adb('0xa8')](_0x8adb('0xa9'));}this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format'](_0x8adb('0x1b3'),_0x32650b[_0x8adb('0x59')]));var _0x2884ef=this[_0x8adb('0x5c')]['sync'](this,_0x32650b);if(_0x2884ef){this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x2884ef));var _0x19a27a=this['channel'][_0x8adb('0x101')](_0x2884ef);try{fs[_0x8adb('0x102')](_0x2884ef+_0x8adb('0x103'));}catch(_0x33bd45){logger[_0x8adb('0x2c')](_0x33bd45);}return _0x19a27a;}return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x32650b,_0x8adb('0x1b4'));};AGIVertices['prototype'][_0x8adb('0x1b5')]=function(_0x3c1578){logger['info'](util[_0x8adb('0x9b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3c1578[_0x8adb('0x35')]));if(!this['isConfigured'](_0x3c1578[_0x8adb('0x150')])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x3c1578,_0x8adb('0x14d'));}logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8adb('0x36')][_0x8adb('0x38')],_0x3c1578[_0x8adb('0x150')]));var _0x225387=this[_0x8adb('0x1b6')]['sync'](this,_0x3c1578[_0x8adb('0x150')]);if(_0x225387){logger[_0x8adb('0x2f')](util[_0x8adb('0x9b')](_0x8adb('0x151'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0x3c1578[_0x8adb('0x150')]));this[_0x8adb('0x36')][_0x8adb('0xa8')](util['format'](_0x8adb('0x151'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0x3c1578[_0x8adb('0x150')]));return{'code':0xc8,'result':_0x8adb('0x152')};}else{logger['info'](util['format'](_0x8adb('0x153'),this['channel'][_0x8adb('0x38')],_0x3c1578[_0x8adb('0x150')]));this['channel'][_0x8adb('0xa8')](util[_0x8adb('0x9b')](_0x8adb('0x153'),this[_0x8adb('0x36')][_0x8adb('0x38')],_0x3c1578[_0x8adb('0x150')]));return{'code':0xc8,'result':_0x8adb('0x154')};}};AGIVertices['prototype'][_0x8adb('0x1b7')]=function(_0x4ac931){logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x1b8'),_0x4ac931[_0x8adb('0x35')]));var _0x9cf401=this['channel']['exec'](_0x8adb('0x1b9'),[_0x4ac931[_0x8adb('0x1ba')],_0x4ac931[_0x8adb('0x74')]]);if(_0x9cf401['result']===-0x1){return _0x9cf401;}return this[_0x8adb('0x36')][_0x8adb('0xa8')](util[_0x8adb('0x9b')]('Executed\x20command\x20%s\x20%s',_0x8adb('0x1b9'),_0x4ac931['mailbox']));};AGIVertices[_0x8adb('0x13')][_0x8adb('0x1bb')]=function(_0x17a727){logger['info'](util[_0x8adb('0x9b')](_0x8adb('0x1bc'),_0x17a727['label']));if(!this[_0x8adb('0x7f')](_0x17a727['variable_id'])){return this[_0x8adb('0x36')][_0x8adb('0x2c')](_0x17a727,'no\x20variable\x20selected');}var _0xb477eb=this[_0x8adb('0xa0')]['sync'](this,_0x17a727['variable_id']);if(!_0xb477eb){return this['channel'][_0x8adb('0x2c')](_0x17a727,_0x8adb('0xda'));}var _0x36322d=this['channel'][_0x8adb('0xa0')](_0xb477eb);return{'code':0xc8,'result':_0x36322d[_0x8adb('0xa1')]?_0x36322d[_0x8adb('0xa1')]:'-'};};String[_0x8adb('0x13')][_0x8adb('0x9f')]=function(_0x3d0530,_0x5a9f38){return this[_0x8adb('0x9e')](_0x3d0530)['join'](_0x5a9f38);};module[_0x8adb('0x1bd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index b58275e..0a4a564 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 _0x13f5=['update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','Auto-Pause','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','then','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','getAgent','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','message','stopAcw','uniqueid','[%s][TIMER][STOP][AGENT:%s]','saveUnpause'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x13f5,0xc3));var _0x513f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x13f5[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x513f('0x0'));var moment=require(_0x513f('0x1'));var ami=require(_0x513f('0x2'));var logger=require(_0x513f('0x3'))('acw');var RpcUser=require(_0x513f('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5c30ef){this[_0x513f('0x5')]=_0x5c30ef[_0x513f('0x5')];this[_0x513f('0x6')]=_0x5c30ef[_0x513f('0x6')];this[_0x513f('0x7')]=_0x5c30ef[_0x513f('0x7')];this[_0x513f('0x8')]={};ami['on'](_0x513f('0x9'),this[_0x513f('0xa')][_0x513f('0xb')](this));ami['on'](_0x513f('0xc'),this[_0x513f('0xd')]['bind'](this));ami['on'](_0x513f('0xe'),this[_0x513f('0xf')][_0x513f('0xb')](this));ami['on'](_0x513f('0x10'),this[_0x513f('0x11')]['bind'](this));ami['on'](_0x513f('0x12'),this[_0x513f('0x13')]['bind'](this));ami['on'](_0x513f('0x14'),this[_0x513f('0x15')][_0x513f('0xb')](this));ami['on'](_0x513f('0x16'),this[_0x513f('0x17')][_0x513f('0xb')](this));}function getDiff(_0x2a0e99){var _0x265cd7=moment()[_0x513f('0x18')](0x0);var _0x2356ab=moment(_0x2a0e99)[_0x513f('0x18')](0x0);return _0x265cd7[_0x513f('0x19')](_0x2356ab,_0x513f('0x1a'));}Acw[_0x513f('0x1b')]['updateAcw']=function(_0x369b25,_0x4d1001){var _0x13f919=this;var _0x3c4c63=getDiff(_0x13f919[_0x513f('0x7')][_0x369b25][_0x513f('0x1c')]);clearTimeout(_0x13f919[_0x513f('0x7')][_0x369b25]['timer']);_0x13f919[_0x513f('0x7')][_0x369b25][_0x513f('0x1d')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x3c4c63},_0x13f919[_0x513f('0x7')][_0x369b25]['uniqueid'],_0x369b25)[_0x513f('0x1e')](function(_0x1d4462){logger['info'](_0x513f('0x1f'),_0x4d1001,_0x3c4c63,_0x1d4462);})[_0x513f('0x20')](function(_0x3b5de3){logger[_0x513f('0x21')](_0x513f('0x22'),_0x4d1001,_0x3b5de3);})[_0x513f('0x23')](function(){delete _0x13f919['timers'][_0x369b25];});};Acw[_0x513f('0x1b')][_0x513f('0x24')]=function(_0x5a9e7c){try{var _0x1af0d6=this;var _0x3314cf=this[_0x513f('0x8')][_0x5a9e7c][_0x513f('0x25')];var _0x3d85f7=this[_0x513f('0x8')][_0x5a9e7c]['queue'];var _0x560835=this['voiceQueues'][_0x3d85f7];var _0x3d7f4d=![];var _0x4309cb=_0x513f('0x26');if(_0x560835[_0x513f('0x27')]&&_0x560835[_0x513f('0x28')][_0x513f('0x29')]){_0x3d7f4d=!![];_0x4309cb=_0x560835[_0x513f('0x28')][_0x513f('0x29')];}if(!_0x1af0d6[_0x513f('0x6')][_0x3314cf]){return Promise['resolve']();}return RpcUser[_0x513f('0x2a')](_0x1af0d6[_0x513f('0x6')][_0x3314cf]['id'])[_0x513f('0x1e')](function(_0x359d5c){if(!_0x359d5c||_0x359d5c['voicePause']){logger[_0x513f('0x2b')](_0x513f('0x2c'),_0x5a9e7c,_0x3314cf,_0x3d85f7);return;}logger['info'](_0x513f('0x2d'),_0x5a9e7c,_0x3314cf,_0x3d85f7);var _0x54c9aa=_0x1af0d6['channels'][_0x5a9e7c][_0x513f('0x2e')]&&_0x1af0d6[_0x513f('0x8')][_0x5a9e7c][_0x513f('0x2f')]?_0x1af0d6[_0x513f('0x8')][_0x5a9e7c]['destlinkedid']:_0x5a9e7c;return RpcUser[_0x513f('0x30')](_0x1af0d6[_0x513f('0x6')][_0x3314cf],_0x4309cb,_0x54c9aa);})[_0x513f('0x1e')](function(_0x201cee){if(_0x3d7f4d||!_0x201cee){return;}_0x1af0d6['timers'][_0x3314cf]={};logger[_0x513f('0x2b')](_0x513f('0x31'),_0x5a9e7c,_0x1af0d6[_0x513f('0x5')][_0x3d85f7][_0x513f('0x32')],_0x3314cf,_0x3d85f7);_0x1af0d6[_0x513f('0x7')][_0x3314cf][_0x513f('0x1d')]=setTimeout(_0x1af0d6['stopAcw']['bind'](_0x1af0d6,_0x3314cf),_0x1af0d6[_0x513f('0x5')][_0x3d85f7][_0x513f('0x32')]*0x3e8);_0x1af0d6['timers'][_0x3314cf]['lastPauseAt']=moment()[_0x513f('0x33')](_0x513f('0x34'));_0x1af0d6[_0x513f('0x7')][_0x3314cf]['uniqueid']=_0x5a9e7c;_0x1af0d6[_0x513f('0x7')][_0x3314cf][_0x513f('0x35')]=_0x3d85f7;_0x1af0d6['timers'][_0x3314cf][_0x513f('0x36')]=_0x1af0d6[_0x513f('0x36')][_0x513f('0xb')](_0x1af0d6,_0x3314cf,_0x5a9e7c);})[_0x513f('0x20')](function(){logger[_0x513f('0x21')](_0x513f('0x31'),_0x5a9e7c,_0x1af0d6[_0x513f('0x5')][_0x3d85f7][_0x513f('0x32')],_0x3314cf,_0x3d85f7);})[_0x513f('0x23')](function(){delete _0x1af0d6['channels'][_0x5a9e7c];});}catch(_0x13afe9){logger['error']('[ACW][START]\x20%s',_0x13afe9[_0x513f('0x37')]);}};Acw['prototype'][_0x513f('0x38')]=function(_0xf12bd7){try{var _0x4cef61=this;if(_0x4cef61[_0x513f('0x7')][_0xf12bd7]){_0x4cef61['timers'][_0xf12bd7]['timer']=![];var _0x3ee273=_0x4cef61[_0x513f('0x7')][_0xf12bd7][_0x513f('0x39')];var _0x3a8928=_0x4cef61[_0x513f('0x7')][_0xf12bd7]['queue'];var _0x116835=_0x4cef61[_0x513f('0x5')][_0x3a8928]['acwTimeout'];logger[_0x513f('0x2b')](_0x513f('0x3a'),_0x3ee273,_0xf12bd7);RpcUser[_0x513f('0x3b')](this[_0x513f('0x6')][_0xf12bd7]);RpcVoiceAgentReport[_0x513f('0x3c')]({'acwtime':_0x116835,'agentacw':!![]},_0x3ee273,_0xf12bd7)['then'](function(_0x7d3ffa){logger[_0x513f('0x2b')](_0x513f('0x1f'),_0x3ee273,_0x116835,_0x7d3ffa);})[_0x513f('0x20')](function(_0x51bf13){logger['error'](_0x513f('0x22'),_0x3ee273,_0x51bf13);});}else{logger[_0x513f('0x21')](_0x513f('0x3d'),_0xf12bd7);if(_0x4cef61[_0x513f('0x7')]){logger['info']('[ACW][TIMERS]',JSON[_0x513f('0x3e')](_0x4cef61[_0x513f('0x7')]));}}}catch(_0x4265da){logger[_0x513f('0x21')](_0x513f('0x3f'),_0x4265da['message']);}};Acw[_0x513f('0x1b')][_0x513f('0xa')]=function(_0x1ff5ce){try{if(this['voiceQueues'][_0x1ff5ce[_0x513f('0x35')]]&&(this[_0x513f('0x5')][_0x1ff5ce['queue']][_0x513f('0x40')]||this[_0x513f('0x5')][_0x1ff5ce[_0x513f('0x35')]][_0x513f('0x27')])){if(this[_0x513f('0x6')][_0x1ff5ce['interface']]){this[_0x513f('0x8')][_0x1ff5ce[_0x513f('0x39')]]={'queue':_0x1ff5ce[_0x513f('0x35')],'interface':_0x1ff5ce[_0x513f('0x25')],'destlinkedid':_0x1ff5ce['destlinkedid']};}}}catch(_0x5af5cf){logger[_0x513f('0x21')](_0x513f('0x41'),_0x5af5cf[_0x513f('0x37')]);}};Acw[_0x513f('0x1b')][_0x513f('0x17')]=function(_0x3b9ec0){try{if(this[_0x513f('0x5')][_0x3b9ec0['queue']]&&(this[_0x513f('0x5')][_0x3b9ec0[_0x513f('0x35')]][_0x513f('0x40')]||this['voiceQueues'][_0x3b9ec0[_0x513f('0x35')]]['mandatoryDisposition'])){if(this[_0x513f('0x6')][_0x3b9ec0['interface']]){this[_0x513f('0x8')][_0x3b9ec0['uniqueid']]={'queue':_0x3b9ec0[_0x513f('0x35')],'interface':_0x3b9ec0[_0x513f('0x25')]};}}}catch(_0x5e1076){logger['error'](_0x513f('0x42'),_0x5e1076['message']);}};Acw[_0x513f('0x1b')][_0x513f('0xd')]=function(_0x52af64){try{if(this[_0x513f('0x8')][_0x52af64[_0x513f('0x39')]]&&_['isUndefined'](this[_0x513f('0x8')][_0x52af64[_0x513f('0x39')]]['attended'])){logger[_0x513f('0x2b')]('[%s][HANGUP:UNIQUEID]',_0x52af64[_0x513f('0x39')]);this['startAcw'](_0x52af64[_0x513f('0x39')]);}else if(this['channels'][_0x52af64[_0x513f('0x43')]]&&_['isUndefined'](this[_0x513f('0x8')][_0x52af64['linkedid']][_0x513f('0x2e')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x52af64[_0x513f('0x43')]);this[_0x513f('0x24')](_0x52af64['linkedid']);}}catch(_0x25f7c5){logger[_0x513f('0x21')](_0x513f('0x44'),_0x25f7c5['message']);}};Acw[_0x513f('0x1b')][_0x513f('0xf')]=function(_0x135cb2){try{if(this[_0x513f('0x8')][_0x135cb2['uniqueid']]&&this[_0x513f('0x8')][_0x135cb2[_0x513f('0x39')]]['attended']){logger[_0x513f('0x2b')](_0x513f('0x45'),_0x135cb2['uniqueid']);this[_0x513f('0x24')](_0x135cb2[_0x513f('0x39')]);}else if(this['channels'][_0x135cb2['linkedid']]&&this['channels'][_0x135cb2[_0x513f('0x43')]]['attended']){logger['info'](_0x513f('0x46'),_0x135cb2[_0x513f('0x43')]);this[_0x513f('0x24')](_0x135cb2[_0x513f('0x43')]);}}catch(_0xb0c1fa){logger[_0x513f('0x21')](_0x513f('0x47'),_0xb0c1fa['message']);}};Acw[_0x513f('0x1b')][_0x513f('0x13')]=function(_0x23f836){try{if(!_['isNil'](this['channels'][_0x23f836[_0x513f('0x48')]])){this[_0x513f('0x24')](_0x23f836[_0x513f('0x48')]);if(this[_0x513f('0x8')][_0x23f836[_0x513f('0x49')]]){this['channels'][_0x23f836[_0x513f('0x49')]][_0x513f('0x2e')]=!![];this[_0x513f('0x8')][_0x23f836[_0x513f('0x4a')]]=this[_0x513f('0x8')][_0x23f836['secondtransfereruniqueid']];delete this['channels'][_0x23f836[_0x513f('0x49')]];}}else if(!_[_0x513f('0x4b')](this[_0x513f('0x8')][_0x23f836[_0x513f('0x4a')]])){this[_0x513f('0x24')](_0x23f836['transfertargetuniqueid']);if(this[_0x513f('0x8')][_0x23f836[_0x513f('0x4c')]]){this['channels'][_0x23f836[_0x513f('0x4c')]][_0x513f('0x2e')]=!![];this[_0x513f('0x8')][_0x23f836[_0x513f('0x48')]]=this[_0x513f('0x8')][_0x23f836['origtransfereruniqueid']];delete this['channels'][_0x23f836[_0x513f('0x4c')]];}}}catch(_0x38882a){logger[_0x513f('0x21')](_0x513f('0x4d'),_0x38882a[_0x513f('0x37')]);}};Acw[_0x513f('0x1b')][_0x513f('0x15')]=function(_0x3fbe2a){try{if(this[_0x513f('0x8')][_0x3fbe2a[_0x513f('0x4e')]]){logger[_0x513f('0x2b')](_0x513f('0x4f'),JSON[_0x513f('0x3e')](_0x3fbe2a[_0x513f('0x4e')]));this[_0x513f('0x24')](_0x3fbe2a[_0x513f('0x4e')]);}else if(this[_0x513f('0x8')][_0x3fbe2a[_0x513f('0x50')]]){logger['info'](_0x513f('0x51'),JSON[_0x513f('0x3e')](_0x3fbe2a[_0x513f('0x50')]));this[_0x513f('0x24')](_0x3fbe2a['transfererlinkedid']);}}catch(_0x452bc3){logger[_0x513f('0x21')]('[ACW][syncBlindTransfer]\x20%s',_0x452bc3[_0x513f('0x37')]);}};Acw[_0x513f('0x1b')]['syncAgentRingNoAnswer']=function(_0x562c9e){try{if(this[_0x513f('0x5')][_0x562c9e['queue']]&&this[_0x513f('0x5')][_0x562c9e['queue']][_0x513f('0x52')]===_0x513f('0x53')){if(this[_0x513f('0x6')][_0x562c9e[_0x513f('0x25')]]){logger[_0x513f('0x2b')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x562c9e[_0x513f('0x39')],_0x562c9e['interface'],_0x562c9e[_0x513f('0x35')]);return RpcUser[_0x513f('0x30')](this['agents'][_0x562c9e[_0x513f('0x25')]],_0x513f('0x54'),_0x562c9e[_0x513f('0x39')]);}}}catch(_0xed34e8){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0xed34e8[_0x513f('0x37')]);}};module['exports']=Acw; \ No newline at end of file +var _0x68b3=['[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[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','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','attended','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','timer','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause'];(function(_0x43f2ed,_0x18ef91){var _0x5f452f=function(_0x4616df){while(--_0x4616df){_0x43f2ed['push'](_0x43f2ed['shift']());}};_0x5f452f(++_0x18ef91);}(_0x68b3,0x1d8));var _0x368b=function(_0x52a010,_0xa10fd4){_0x52a010=_0x52a010-0x0;var _0x1373da=_0x68b3[_0x52a010];return _0x1373da;};'use strict';var _=require(_0x368b('0x0'));var moment=require(_0x368b('0x1'));var ami=require(_0x368b('0x2'));var logger=require(_0x368b('0x3'))(_0x368b('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x368b('0x5'));function Acw(_0x3325ac){this[_0x368b('0x6')]=_0x3325ac[_0x368b('0x6')];this['agents']=_0x3325ac[_0x368b('0x7')];this[_0x368b('0x8')]=_0x3325ac[_0x368b('0x8')];this[_0x368b('0x9')]={};ami['on'](_0x368b('0xa'),this[_0x368b('0xb')][_0x368b('0xc')](this));ami['on'](_0x368b('0xd'),this[_0x368b('0xe')][_0x368b('0xc')](this));ami['on'](_0x368b('0xf'),this['syncHangup'][_0x368b('0xc')](this));ami['on'](_0x368b('0x10'),this[_0x368b('0x11')]['bind'](this));ami['on'](_0x368b('0x12'),this[_0x368b('0x13')][_0x368b('0xc')](this));ami['on']('blindtransfer',this[_0x368b('0x14')][_0x368b('0xc')](this));ami['on']('custom:agentConnectPreview',this[_0x368b('0x15')][_0x368b('0xc')](this));}function getDiff(_0x44e376){var _0x4015fe=moment()[_0x368b('0x16')](0x0);var _0x4fffe5=moment(_0x44e376)[_0x368b('0x16')](0x0);return _0x4015fe[_0x368b('0x17')](_0x4fffe5,'seconds');}Acw[_0x368b('0x18')][_0x368b('0x19')]=function(_0x30c245,_0x515350){var _0x220cd5=this;var _0x392376=getDiff(_0x220cd5[_0x368b('0x8')][_0x30c245]['lastPauseAt']);clearTimeout(_0x220cd5[_0x368b('0x8')][_0x30c245][_0x368b('0x1a')]);_0x220cd5[_0x368b('0x8')][_0x30c245]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x392376},_0x220cd5[_0x368b('0x8')][_0x30c245][_0x368b('0x1b')],_0x30c245)[_0x368b('0x1c')](function(_0x1e632a){logger[_0x368b('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x515350,_0x392376,_0x1e632a);})[_0x368b('0x1e')](function(_0x44cfe6){logger[_0x368b('0x1f')](_0x368b('0x20'),_0x515350,_0x44cfe6);})[_0x368b('0x21')](function(){delete _0x220cd5[_0x368b('0x8')][_0x30c245];});};Acw[_0x368b('0x18')][_0x368b('0x22')]=function(_0x508e48){try{var _0x13e750=this;var _0x2f08d9=this[_0x368b('0x9')][_0x508e48][_0x368b('0x23')];var _0x286853=this['channels'][_0x508e48][_0x368b('0x24')];var _0x1ca429=this[_0x368b('0x6')][_0x286853];var _0xafa856=![];var _0x77a269=_0x368b('0x25');if(_0x1ca429[_0x368b('0x26')]&&_0x1ca429[_0x368b('0x27')][_0x368b('0x28')]){_0xafa856=!![];_0x77a269=_0x1ca429[_0x368b('0x27')][_0x368b('0x28')];}if(!_0x13e750[_0x368b('0x7')][_0x2f08d9]){return Promise[_0x368b('0x29')]();}return RpcUser[_0x368b('0x2a')](_0x13e750[_0x368b('0x7')][_0x2f08d9]['id'])[_0x368b('0x1c')](function(_0x5dc5fa){if(!_0x5dc5fa||_0x5dc5fa[_0x368b('0x2b')]){logger[_0x368b('0x1d')](_0x368b('0x2c'),_0x508e48,_0x2f08d9,_0x286853);return;}logger[_0x368b('0x1d')](_0x368b('0x2d'),_0x508e48,_0x2f08d9,_0x286853);var _0x107d2f=_0x13e750[_0x368b('0x9')][_0x508e48]['attended']&&_0x13e750['channels'][_0x508e48][_0x368b('0x2e')]?_0x13e750[_0x368b('0x9')][_0x508e48][_0x368b('0x2e')]:_0x508e48;return RpcUser[_0x368b('0x2f')](_0x13e750['agents'][_0x2f08d9],_0x77a269,_0x107d2f);})[_0x368b('0x1c')](function(_0x1f3ed3){if(_0xafa856||!_0x1f3ed3){return;}_0x13e750[_0x368b('0x8')][_0x2f08d9]={};logger[_0x368b('0x1d')](_0x368b('0x30'),_0x508e48,_0x13e750['voiceQueues'][_0x286853][_0x368b('0x31')],_0x2f08d9,_0x286853);_0x13e750[_0x368b('0x8')][_0x2f08d9][_0x368b('0x1a')]=setTimeout(_0x13e750[_0x368b('0x32')]['bind'](_0x13e750,_0x2f08d9),_0x13e750['voiceQueues'][_0x286853]['acwTimeout']*0x3e8);_0x13e750[_0x368b('0x8')][_0x2f08d9][_0x368b('0x33')]=moment()[_0x368b('0x34')](_0x368b('0x35'));_0x13e750[_0x368b('0x8')][_0x2f08d9]['uniqueid']=_0x508e48;_0x13e750[_0x368b('0x8')][_0x2f08d9][_0x368b('0x24')]=_0x286853;_0x13e750['timers'][_0x2f08d9][_0x368b('0x19')]=_0x13e750[_0x368b('0x19')]['bind'](_0x13e750,_0x2f08d9,_0x508e48);})[_0x368b('0x1e')](function(){logger[_0x368b('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x508e48,_0x13e750[_0x368b('0x6')][_0x286853]['acwTimeout'],_0x2f08d9,_0x286853);})['finally'](function(){delete _0x13e750['channels'][_0x508e48];});}catch(_0xe4994d){logger[_0x368b('0x1f')](_0x368b('0x36'),_0xe4994d[_0x368b('0x37')]);}};Acw[_0x368b('0x18')][_0x368b('0x32')]=function(_0x10c5d5){try{var _0x2035d5=this;if(_0x2035d5[_0x368b('0x8')][_0x10c5d5]){_0x2035d5[_0x368b('0x8')][_0x10c5d5]['timer']=![];var _0x204c52=_0x2035d5[_0x368b('0x8')][_0x10c5d5]['uniqueid'];var _0x221210=_0x2035d5[_0x368b('0x8')][_0x10c5d5][_0x368b('0x24')];var _0x231d84=_0x2035d5[_0x368b('0x6')][_0x221210]['acwTimeout'];logger[_0x368b('0x1d')](_0x368b('0x38'),_0x204c52,_0x10c5d5);RpcUser[_0x368b('0x39')](this[_0x368b('0x7')][_0x10c5d5]);RpcVoiceAgentReport['update']({'acwtime':_0x231d84,'agentacw':!![]},_0x204c52,_0x10c5d5)['then'](function(_0x7ba60d){logger[_0x368b('0x1d')](_0x368b('0x3a'),_0x204c52,_0x231d84,_0x7ba60d);})[_0x368b('0x1e')](function(_0x248487){logger[_0x368b('0x1f')](_0x368b('0x20'),_0x204c52,_0x248487);});}else{logger[_0x368b('0x1f')](_0x368b('0x3b'),_0x10c5d5);if(_0x2035d5[_0x368b('0x8')]){logger['info'](_0x368b('0x3c'),JSON[_0x368b('0x3d')](_0x2035d5['timers']));}}}catch(_0x25e713){logger[_0x368b('0x1f')](_0x368b('0x3e'),_0x25e713[_0x368b('0x37')]);}};Acw['prototype'][_0x368b('0xb')]=function(_0x151711){try{if(this['voiceQueues'][_0x151711[_0x368b('0x24')]]&&(this[_0x368b('0x6')][_0x151711[_0x368b('0x24')]]['acw']||this[_0x368b('0x6')][_0x151711[_0x368b('0x24')]][_0x368b('0x26')])){if(this['agents'][_0x151711['interface']]){this[_0x368b('0x9')][_0x151711[_0x368b('0x1b')]]={'queue':_0x151711['queue'],'interface':_0x151711[_0x368b('0x23')],'destlinkedid':_0x151711[_0x368b('0x2e')]};}}}catch(_0x392f26){logger[_0x368b('0x1f')](_0x368b('0x3f'),_0x392f26[_0x368b('0x37')]);}};Acw[_0x368b('0x18')][_0x368b('0x15')]=function(_0x5db559){try{if(this[_0x368b('0x6')][_0x5db559[_0x368b('0x24')]]&&(this[_0x368b('0x6')][_0x5db559[_0x368b('0x24')]]['acw']||this[_0x368b('0x6')][_0x5db559[_0x368b('0x24')]][_0x368b('0x26')])){if(this[_0x368b('0x7')][_0x5db559[_0x368b('0x23')]]){this['channels'][_0x5db559['uniqueid']]={'queue':_0x5db559[_0x368b('0x24')],'interface':_0x5db559[_0x368b('0x23')]};}}}catch(_0x1c8755){logger['error'](_0x368b('0x40'),_0x1c8755[_0x368b('0x37')]);}};Acw[_0x368b('0x18')][_0x368b('0xe')]=function(_0x3cae32){try{if(this[_0x368b('0x9')][_0x3cae32[_0x368b('0x1b')]]&&_[_0x368b('0x41')](this[_0x368b('0x9')][_0x3cae32[_0x368b('0x1b')]]['attended'])){logger[_0x368b('0x1d')]('[%s][HANGUP:UNIQUEID]',_0x3cae32[_0x368b('0x1b')]);this['startAcw'](_0x3cae32[_0x368b('0x1b')]);}else if(this['channels'][_0x3cae32[_0x368b('0x42')]]&&_[_0x368b('0x41')](this[_0x368b('0x9')][_0x3cae32[_0x368b('0x42')]]['attended'])){logger[_0x368b('0x1d')](_0x368b('0x43'),_0x3cae32[_0x368b('0x42')]);this[_0x368b('0x22')](_0x3cae32[_0x368b('0x42')]);}}catch(_0x31c673){logger[_0x368b('0x1f')](_0x368b('0x44'),_0x31c673[_0x368b('0x37')]);}};Acw['prototype'][_0x368b('0x45')]=function(_0x1044b3){try{if(this[_0x368b('0x9')][_0x1044b3[_0x368b('0x1b')]]&&this[_0x368b('0x9')][_0x1044b3['uniqueid']][_0x368b('0x46')]){logger[_0x368b('0x1d')](_0x368b('0x47'),_0x1044b3[_0x368b('0x1b')]);this[_0x368b('0x22')](_0x1044b3[_0x368b('0x1b')]);}else if(this[_0x368b('0x9')][_0x1044b3['linkedid']]&&this['channels'][_0x1044b3['linkedid']]['attended']){logger[_0x368b('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1044b3[_0x368b('0x42')]);this[_0x368b('0x22')](_0x1044b3['linkedid']);}}catch(_0x5711ee){logger[_0x368b('0x1f')]('[ACW][syncHangup]\x20%s',_0x5711ee[_0x368b('0x37')]);}};Acw[_0x368b('0x18')]['syncAttendedTransfer']=function(_0x2a0bf0){try{if(!_[_0x368b('0x48')](this['channels'][_0x2a0bf0[_0x368b('0x49')]])){this['startAcw'](_0x2a0bf0[_0x368b('0x49')]);if(this[_0x368b('0x9')][_0x2a0bf0[_0x368b('0x4a')]]){this[_0x368b('0x9')][_0x2a0bf0['secondtransfereruniqueid']][_0x368b('0x46')]=!![];this[_0x368b('0x9')][_0x2a0bf0[_0x368b('0x4b')]]=this[_0x368b('0x9')][_0x2a0bf0['secondtransfereruniqueid']];delete this[_0x368b('0x9')][_0x2a0bf0['secondtransfereruniqueid']];}}else if(!_[_0x368b('0x48')](this[_0x368b('0x9')][_0x2a0bf0['transfertargetuniqueid']])){this['startAcw'](_0x2a0bf0[_0x368b('0x4b')]);if(this[_0x368b('0x9')][_0x2a0bf0[_0x368b('0x4c')]]){this[_0x368b('0x9')][_0x2a0bf0[_0x368b('0x4c')]]['attended']=!![];this[_0x368b('0x9')][_0x2a0bf0[_0x368b('0x49')]]=this['channels'][_0x2a0bf0[_0x368b('0x4c')]];delete this[_0x368b('0x9')][_0x2a0bf0[_0x368b('0x4c')]];}}}catch(_0x302b06){logger['error'](_0x368b('0x4d'),_0x302b06[_0x368b('0x37')]);}};Acw[_0x368b('0x18')][_0x368b('0x14')]=function(_0x530b80){try{if(this['channels'][_0x530b80['transfereruniqueid']]){logger['info'](_0x368b('0x4e'),JSON[_0x368b('0x3d')](_0x530b80['transfereruniqueid']));this['startAcw'](_0x530b80['transfereruniqueid']);}else if(this['channels'][_0x530b80['transfererlinkedid']]){logger[_0x368b('0x1d')](_0x368b('0x4f'),JSON[_0x368b('0x3d')](_0x530b80['transfererlinkedid']));this[_0x368b('0x22')](_0x530b80['transfererlinkedid']);}}catch(_0x50296f){logger[_0x368b('0x1f')](_0x368b('0x50'),_0x50296f[_0x368b('0x37')]);}};Acw[_0x368b('0x18')]['syncAgentRingNoAnswer']=function(_0x2c4488){try{if(this[_0x368b('0x6')][_0x2c4488[_0x368b('0x24')]]&&this['voiceQueues'][_0x2c4488[_0x368b('0x24')]][_0x368b('0x51')]==='all'){if(this[_0x368b('0x7')][_0x2c4488[_0x368b('0x23')]]){logger['info'](_0x368b('0x52'),_0x2c4488['uniqueid'],_0x2c4488[_0x368b('0x23')],_0x2c4488[_0x368b('0x24')]);return RpcUser['savePause'](this[_0x368b('0x7')][_0x2c4488[_0x368b('0x23')]],_0x368b('0x53'),_0x2c4488[_0x368b('0x1b')]);}}}catch(_0x281023){logger['error'](_0x368b('0x54'),_0x281023[_0x368b('0x37')]);}};module[_0x368b('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cd0063d..d5240b2 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 _0x461b=['actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','info','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','[ami.js][fullybooted]','exports','bluebird','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary'];(function(_0x371d26,_0x161e1b){var _0x22af13=function(_0x2fe036){while(--_0x2fe036){_0x371d26['push'](_0x371d26['shift']());}};_0x22af13(++_0x161e1b);}(_0x461b,0x1cb));var _0xb461=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x461b[_0x2641f9];return _0x585741;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xb461('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb461('0x1'));var config=require(_0xb461('0x2'));var ami=new Manager(config[_0xb461('0x3')][_0xb461('0x4')],config[_0xb461('0x3')]['ip'],config[_0xb461('0x3')][_0xb461('0x5')],config[_0xb461('0x3')][_0xb461('0x6')],!![]);ami[_0xb461('0x7')]();ami[_0xb461('0x8')]=BPromise['promisify'](ami[_0xb461('0x9')]);function error(_0xa8bba0){logger[_0xb461('0xa')](util[_0xb461('0xb')](_0xb461('0xc'),config[_0xb461('0x3')][_0xb461('0x5')],config[_0xb461('0x3')]['ip'],config[_0xb461('0x3')][_0xb461('0x4')],util[_0xb461('0xd')](_0xa8bba0,![],null)));}function close(){logger[_0xb461('0xa')](util[_0xb461('0xb')](_0xb461('0xe'),config[_0xb461('0x3')]['username'],config[_0xb461('0x3')]['ip'],config[_0xb461('0x3')]['port']));}ami[_0xb461('0xf')]=function(){return function(){return ami[_0xb461('0x8')]({'action':_0xb461('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0xb461('0x11')});};};ami[_0xb461('0x12')]=function(){return function(){return ami[_0xb461('0x8')]({'action':_0xb461('0x13')});};};ami[_0xb461('0x14')]=function(){return function(){return ami[_0xb461('0x8')]({'action':_0xb461('0x15')});};};ami[_0xb461('0x16')]=function(){return function(){return ami[_0xb461('0x8')]({'action':_0xb461('0x17')});};};function connect(){logger['info'](util[_0xb461('0xb')](_0xb461('0x18'),config['asterisk'][_0xb461('0x5')],config[_0xb461('0x3')]['ip'],config[_0xb461('0x3')][_0xb461('0x4')]));ami[_0xb461('0x19')](_0xb461('0xa'),error);ami['once'](_0xb461('0x1a'),close);}ami['on'](_0xb461('0x1b'),connect);ami['on'](_0xb461('0x1c'),function(_0x5bd7eb){logger[_0xb461('0x1d')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0xb461('0x3')]['ip'],config[_0xb461('0x3')]['port'],util['inspect'](_0x5bd7eb,![],null)));});ami['on'](_0xb461('0x1e'),function(){logger[_0xb461('0x1d')](util[_0xb461('0xb')](_0xb461('0x1f'),config[_0xb461('0x3')][_0xb461('0x5')],config[_0xb461('0x3')]['ip'],config[_0xb461('0x3')][_0xb461('0x4')]));return Promise[_0xb461('0x20')]()['then'](ami[_0xb461('0xf')]())[_0xb461('0x21')](ami[_0xb461('0x22')]())['then'](ami[_0xb461('0x12')]())[_0xb461('0x21')](ami[_0xb461('0x14')]())[_0xb461('0x21')](ami[_0xb461('0x16')]())['catch'](function(_0x1c583e){logger[_0xb461('0xa')](_0xb461('0x23'),util[_0xb461('0xd')](_0x1c583e,{'showHidden':![],'depth':null}));});});ami[_0xb461('0x19')](_0xb461('0xa'),error);ami[_0xb461('0x19')](_0xb461('0x1a'),close);module[_0xb461('0x24')]=ami; \ No newline at end of file +var _0x270d=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','actionQueueSummary','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','username','keepConnected','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','actionDeviceStateList','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect'];(function(_0x446f0a,_0x49fc1e){var _0x100514=function(_0x1c1253){while(--_0x1c1253){_0x446f0a['push'](_0x446f0a['shift']());}};_0x100514(++_0x49fc1e);}(_0x270d,0x14e));var _0xd270=function(_0x4b332b,_0x3eddbd){_0x4b332b=_0x4b332b-0x0;var _0x4602df=_0x270d[_0x4b332b];return _0x4602df;};'use strict';var Manager=require(_0xd270('0x0'));var BPromise=require(_0xd270('0x1'));var util=require(_0xd270('0x2'));var logger=require(_0xd270('0x3'))('ami');var config=require(_0xd270('0x4'));var ami=new Manager(config[_0xd270('0x5')][_0xd270('0x6')],config['asterisk']['ip'],config[_0xd270('0x5')][_0xd270('0x7')],config['asterisk']['password'],!![]);ami[_0xd270('0x8')]();ami['Action']=BPromise['promisify'](ami['action']);function error(_0x47c271){logger['error'](util[_0xd270('0x9')](_0xd270('0xa'),config[_0xd270('0x5')][_0xd270('0x7')],config[_0xd270('0x5')]['ip'],config['asterisk'][_0xd270('0x6')],util[_0xd270('0xb')](_0x47c271,![],null)));}function close(){logger[_0xd270('0xc')](util[_0xd270('0x9')](_0xd270('0xd'),config[_0xd270('0x5')][_0xd270('0x7')],config[_0xd270('0x5')]['ip'],config['asterisk'][_0xd270('0x6')]));}ami[_0xd270('0xe')]=function(){return function(){return ami[_0xd270('0xf')]({'action':'sipshowregistry'});};};ami[_0xd270('0x10')]=function(){return function(){return ami[_0xd270('0xf')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xd270('0x11')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xd270('0xf')]({'action':_0xd270('0x12')});};};ami[_0xd270('0x13')]=function(){return function(){return ami[_0xd270('0xf')]({'action':_0xd270('0x14')});};};function connect(){logger[_0xd270('0x15')](util[_0xd270('0x9')](_0xd270('0x16'),config[_0xd270('0x5')][_0xd270('0x7')],config[_0xd270('0x5')]['ip'],config[_0xd270('0x5')][_0xd270('0x6')]));ami['once'](_0xd270('0xc'),error);ami[_0xd270('0x17')](_0xd270('0x18'),close);}ami['on'](_0xd270('0x19'),connect);ami['on']('shutdown',function(_0x3cdf79){logger[_0xd270('0x15')](util[_0xd270('0x9')](_0xd270('0x1a'),config[_0xd270('0x5')][_0xd270('0x7')],config[_0xd270('0x5')]['ip'],config[_0xd270('0x5')][_0xd270('0x6')],util[_0xd270('0xb')](_0x3cdf79,![],null)));});ami['on'](_0xd270('0x1b'),function(){logger[_0xd270('0x15')](util['format'](_0xd270('0x1c'),config['asterisk'][_0xd270('0x7')],config[_0xd270('0x5')]['ip'],config[_0xd270('0x5')][_0xd270('0x6')]));return Promise[_0xd270('0x1d')]()[_0xd270('0x1e')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0xd270('0x1e')](ami[_0xd270('0x1f')]())[_0xd270('0x1e')](ami[_0xd270('0x20')]())[_0xd270('0x1e')](ami[_0xd270('0x13')]())[_0xd270('0x21')](function(_0x429f41){logger['error'](_0xd270('0x22'),util['inspect'](_0x429f41,{'showHidden':![],'depth':null}));});});ami[_0xd270('0x17')](_0xd270('0xc'),error);ami['once'](_0xd270('0x18'),close);module[_0xd270('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 289e719..dc7bb11 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb7e7[_0x34bc30];return _0x5706de;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xda3f,0xec));var _0xfda3=function(_0x35b359,_0x5a1494){_0x35b359=_0x35b359-0x0;var _0xdc37d9=_0xda3f[_0x35b359];return _0xdc37d9;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('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 c24fae8..6dc71b1 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 _0x5fdb=['[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','finally','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','dialAMDActive','value','MACHINE','outboundAnswerAgiCallsDay','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','stateGlobal','reason19\x20machine....','countmachineretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','HANGUP','saveInDb','[syncHangupInAMDIvr][createHistory]','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','sequence','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','UserId','[emptyContact]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','checkRetriveMax','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','countnosuchnumberretry','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','swapAdditionalPhones','Global','[callProgressDetecting]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','startMethodPredictive','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[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','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','[abandonmentRate]','m\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','lodash','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','queueBooked','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','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','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Interval','Intervals','NULL_INTERVAL','isEmpty','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','Error','prototype','isTrunkReachable','active','status','reachable','format','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','Action','iftime\x20%s,%s','interval','indexOf','true','catch','command','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialTimezone','checkIfTimeIntervals','launchHandleIvr','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','predictive','booked','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','intervalIftime','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','[ifTime][Action]','queue','uniqueid','ivr','updateOriginated','answertime','syncAgentComplete','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','additional','rescheduleContact','add','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','statedesc','calleridname','calleridnum','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','queueCallerAbandonCreateState','ContactId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','push','idHopper','syncQueueStatusComplete','roundrobin','run'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x5fdb,0x11e));var _0xb5fd=function(_0x2755ba,_0x5e0e39){_0x2755ba=_0x2755ba-0x0;var _0x2c3a3d=_0x5fdb[_0x2755ba];return _0x2c3a3d;};'use strict';var util=require('util');var _=require(_0xb5fd('0x0'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0xb5fd('0x1'));var utils=require(_0xb5fd('0x2'));var hopperUtils=require(_0xb5fd('0x3'));var ut=require('../preview/util/util');var config=require(_0xb5fd('0x4'));var logger=require(_0xb5fd('0x5'))(_0xb5fd('0x6'));var loggerBooked=require(_0xb5fd('0x5'))('booked');var loggerPredictive=require(_0xb5fd('0x5'))('predictive');var loggerPredictiveCalls=require(_0xb5fd('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xb5fd('0x5'))(_0xb5fd('0x7'));var ami=require(_0xb5fd('0x8'));config[_0xb5fd('0x9')]=_[_0xb5fd('0xa')](config['redis'],{'host':_0xb5fd('0xb'),'port':0x18eb});var io=require(_0xb5fd('0xc'))(new Redis(config[_0xb5fd('0x9')]));var cmHopper=require(_0xb5fd('0xd'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xb5fd('0xe'));var Interval=require(_0xb5fd('0xf'));var Action=require(_0xb5fd('0x10'));var History=require(_0xb5fd('0x11'));var Final=require(_0xb5fd('0x12'));var AgentComplete=require(_0xb5fd('0x13'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process['env'][_0xb5fd('0x14')]||_0xb5fd('0x15');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xb5fd('0x16')]=function(_0x51cf3e){this[_0xb5fd('0x17')]=this[_0xb5fd('0x17')]?this[_0xb5fd('0x17')]['finally'](_0x51cf3e):_0x51cf3e();};function Dialer(_0x963b58,_0x870c73){this['sequence']=new Sequence();this[_0xb5fd('0x18')]=_0x870c73;this[_0xb5fd('0x19')]=_0x963b58[_0xb5fd('0x19')];this['campaigns']=_0x963b58[_0xb5fd('0x1a')];this[_0xb5fd('0x1b')]=_0x963b58[_0xb5fd('0x1b')];this[_0xb5fd('0x1c')]=_0x963b58[_0xb5fd('0x1c')];this['maxNumberOriginate']=config[_0xb5fd('0x1d')]||0x2;this[_0xb5fd('0x1e')]={};this[_0xb5fd('0x1f')]={};this['contactsId']={};this[_0xb5fd('0x20')]={};this[_0xb5fd('0x21')]={};this[_0xb5fd('0x22')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xb5fd('0x23')]={};this['queueBookedRR']={};this[_0xb5fd('0x24')]={};ami['on'](_0xb5fd('0x25'),this[_0xb5fd('0x26')]['bind'](this));ami['on'](_0xb5fd('0x27'),this[_0xb5fd('0x28')][_0xb5fd('0x29')](this));ami['on']('originateresponse',this[_0xb5fd('0x2a')][_0xb5fd('0x29')](this));ami['on'](_0xb5fd('0x2b'),this['syncAgentComplete'][_0xb5fd('0x29')](this));ami['on'](_0xb5fd('0x2c'),this[_0xb5fd('0x7')]['bind'](this));ami['on'](_0xb5fd('0x2d'),this[_0xb5fd('0x2e')][_0xb5fd('0x29')](this));ami['on'](_0xb5fd('0x2f'),this[_0xb5fd('0x30')]['bind'](this));ami['on']('newexten',this[_0xb5fd('0x31')][_0xb5fd('0x29')](this));ami['on'](_0xb5fd('0x32'),this['syncVarSet'][_0xb5fd('0x29')](this));ami['on'](_0xb5fd('0x33'),this[_0xb5fd('0x34')][_0xb5fd('0x29')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xb5fd('0x29')](this));this[_0xb5fd('0x35')]();this[_0xb5fd('0x36')]();RpcSetting[_0xb5fd('0x37')]()[_0xb5fd('0x38')](function(_0x328b2e){previewRecallmeReminderInterval=_0x328b2e['previewRecallmeReminderInterval'];});}function isNotNull(_0x53a4fd){return _0x53a4fd!==null&&!_[_0xb5fd('0x39')](_0x53a4fd);}function msgResponse(_0x53d6db,_0x48b50a,_0x2cfd14){return{'action':_0x53d6db,'response':_0x48b50a,'message':_0x2cfd14,'stack':_0x2cfd14};}function emit(_0x57650f,_0x3a3f5c,_0x2591e0){io['to'](_0x57650f)[_0xb5fd('0x3a')](_0x3a3f5c,_0x2591e0);}function emitOutboundVoiceQueueSummary(_0x5c8463){if(_0x5c8463[_0xb5fd('0x3b')]===_0xb5fd('0x3c')){logger[_0xb5fd('0x3d')](_0xb5fd('0x3e'),util['inspect'](_0x5c8463,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0x5c8463[_0xb5fd('0x3f')]),_0xb5fd('0x40'),_0x5c8463);}}function checkGetDataPredictive(_0x2788bb){if(isNotNull(_0x2788bb)&&!_['isEmpty'](_0x2788bb)){loggerPredictive[_0xb5fd('0x41')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x42'),_0x2788bb[_0xb5fd('0x43')]);loggerPredictive['info'](_0xb5fd('0x44'),_0x2788bb[_0xb5fd('0x45')]);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x46'),_0x2788bb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x47'),_0x2788bb['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x48'),_0x2788bb[_0xb5fd('0x49')]);loggerPredictive[_0xb5fd('0x41')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2788bb[_0xb5fd('0x4a')]);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x4b'));if(_0x2788bb['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x2788bb['predictiveIntervalAvgTalktime'])&&_0x2788bb[_0xb5fd('0x4a')]>0x0){return!![];}loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x4c'));if(!_[_0xb5fd('0x39')](_0x2788bb[_0xb5fd('0x49')])&&_0x2788bb[_0xb5fd('0x49')]>0x0){return!![];}loggerPredictive['info'](_0xb5fd('0x4d'));}else{loggerPredictive['info'](_0xb5fd('0x4e'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x29ffe2){return function(_0x54343e){loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x4f'));loggerPredictive['info'](_0xb5fd('0x50'),_0x54343e[_0xb5fd('0x51')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54343e[_0xb5fd('0x52')]);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x53'),_0x54343e[_0xb5fd('0x54')]);loggerPredictive[_0xb5fd('0x41')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54343e['erlangBusyFactor']);loggerPredictive['info'](_0xb5fd('0x53'),_0x54343e[_0xb5fd('0x54')]);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x4b'));_[_0xb5fd('0x55')](_0x29ffe2,_0x54343e);};}function ifInterval(_0x590f2c,_0x2ecfcf){if(_[_0xb5fd('0x39')](_0x2ecfcf)){return![];}return utils[_0xb5fd('0x56')](undefined,_0x2ecfcf)<_0x590f2c*0x3c;}function clearPredictiveAttributes(_0xe73cf1){if(_0xe73cf1[_0xb5fd('0x57')]){_0xe73cf1[_0xb5fd('0x57')]=undefined;loggerPredictive[_0xb5fd('0x3d')](_0xe73cf1[_0xb5fd('0x3f')],_0xb5fd('0x58'));}if(_0xe73cf1[_0xb5fd('0x22')]){_0xe73cf1['startPredictive']=undefined;loggerPredictive[_0xb5fd('0x3d')](_0xe73cf1[_0xb5fd('0x3f')],_0xb5fd('0x59'));}if(_0xe73cf1[_0xb5fd('0x5a')]){clearInterval(_0xe73cf1['handlePredictive']);_0xe73cf1['handlePredictive']=undefined;loggerPredictive[_0xb5fd('0x3d')](_0xe73cf1[_0xb5fd('0x3f')],_0xb5fd('0x5b'));}}function loggerCatchPredictive(_0x533e19,_0x2a5a2){return function(_0x537c72){loggerPredictive['error'](_0x2a5a2[_0xb5fd('0x3f')],_0x533e19);loggerPredictive[_0xb5fd('0x5c')](_0x537c72[_0xb5fd('0x5d')]);clearPredictiveAttributes(_0x2a5a2);};}function loggerCatch(_0x14fd0a){return function(_0x53f097){logger[_0xb5fd('0x5c')](_0x14fd0a,util[_0xb5fd('0x5e')](_0x53f097,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4ca306,_0xa5ffac,_0x15d261){return function(_0x37d40d){utils['checkContactLowerLimitOriginate'](_0xa5ffac,_0x15d261,0x0);logger[_0xb5fd('0x5c')](_0x4ca306,util[_0xb5fd('0x5e')](_0x37d40d,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x565554){return function(_0x1dc427){if(isNotNull(_0x1dc427)&&isNotNull(_0x1dc427[0x0])){if(_0x1dc427[0x0][_0xb5fd('0x5f')]>0x0){_0x565554[_0xb5fd('0x60')]=utils[_0xb5fd('0x61')][_0xb5fd('0x62')];logger['info']('[getContactDialer2][ReScheduled]'+_0x565554[_0xb5fd('0x3f')],_0x1dc427[0x0]['contactsRescheduled'],_0xb5fd('0x63'));}else{_0x565554['message']=utils[_0xb5fd('0x61')][_0xb5fd('0x64')];logger['info'](_0xb5fd('0x65')+_0x565554[_0xb5fd('0x3f')]);}}};}function createObjHistory(_0x3753e4,_0x39f606,_0x55c2f1,_0x4f8e52,_0x566b91){_0x3753e4[_0xb5fd('0x60')]=_0x55c2f1;var _0x244f49=new Action(_0x3753e4,_0x39f606);var _0x416eca=new History(_0x244f49);_0x416eca[_0xb5fd('0x66')]=_0x4f8e52;_0x416eca['statedesc']=_0x566b91;_0x416eca[_0xb5fd('0x67')]=_0x244f49[_0xb5fd('0x68')];return _0x416eca;}function unlockQueueStatus(_0x5d2a05,_0x3ef5da){setTimeout(function(){if(_[_0xb5fd('0x39')](_0x5d2a05[_0xb5fd('0x69')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x3ef5da);}_0x5d2a05[_0xb5fd('0x69')]=!![];loggerBooked[_0xb5fd('0x41')](_0xb5fd('0x6a'),_0x3ef5da,JSON[_0xb5fd('0x6b')](_[_0xb5fd('0x6c')](_0x5d2a05,[_0xb5fd('0x3f'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x246bbd){return function(){if(!isNotNull(_0x246bbd['Interval'])){_0x246bbd[_0xb5fd('0x60')]=utils[_0xb5fd('0x61')]['NULL_INTERVAL'];throw _0x246bbd['name']+_0xb5fd('0x6d');}if(!isNotNull(_0x246bbd[_0xb5fd('0x6e')][_0xb5fd('0x6f')])){_0x246bbd[_0xb5fd('0x60')]=utils[_0xb5fd('0x61')][_0xb5fd('0x70')];throw _0x246bbd['name']+_0xb5fd('0x6d');}if(!isNotNull(_[_0xb5fd('0x71')](_0x246bbd[_0xb5fd('0x6e')][_0xb5fd('0x6f')]))){_0x246bbd[_0xb5fd('0x60')]=utils['CAMPAIGN_STATUS'][_0xb5fd('0x70')];throw _0x246bbd['name']+_0xb5fd('0x6d');}};}function checkIsIVRCampaignActive(_0x383ec3){return function(){if(!utils[_0xb5fd('0x72')](_0x383ec3)){_0x383ec3[_0xb5fd('0x60')]=utils[_0xb5fd('0x61')][_0xb5fd('0x73')];throw _0x383ec3[_0xb5fd('0x3f')]+_0xb5fd('0x74');}};}function emitCampaignSummary(_0x6ef50a){if(utils[_0xb5fd('0x75')](_0x6ef50a)){emit(util['format'](_0xb5fd('0x76'),_0x6ef50a['name']),_0xb5fd('0x77'),_0x6ef50a);}}function loggerCatchQueueSummary(_0x5068f5,_0x1f2b06){return function(_0x2c82ab){clearPredictiveAttributes(_0x1f2b06);emitCampaignSummary(_0x1f2b06);loggerSyncQueueSummary[_0xb5fd('0x3d')](_0x5068f5,util[_0xb5fd('0x5e')](_0x2c82ab,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x39bb36){if(_0x39bb36['sendMessageOneNotActive']){if(_0x39bb36[_0xb5fd('0x78')]===0x0){_0x39bb36['sendMessageOneNotActive']=![];_0x39bb36['message']=utils['CAMPAIGN_STATUS'][_0xb5fd('0x73')];loggerSyncQueueSummary[_0xb5fd('0x3d')](_0xb5fd('0x79'),_0x39bb36[_0xb5fd('0x3f')],_0xb5fd('0x7a'));}else{_0x39bb36[_0xb5fd('0x60')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0xb5fd('0x3d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x39bb36[_0xb5fd('0x3f')],_0xb5fd('0x7b'));}emitCampaignSummary(_0x39bb36);}}function myreject(_0x5ceb9c){return function(_0xd34773){return _0x5ceb9c(msgResponse('[ifTime][Action]',_0xb5fd('0x7c'),JSON[_0xb5fd('0x6b')](_0xd34773)));};}Dialer[_0xb5fd('0x7d')][_0xb5fd('0x7e')]=function(_0x921468){return!_[_0xb5fd('0x39')](_0x921468)&&_0x921468&&!_['isUndefined'](_0x921468['name'])&&!_[_0xb5fd('0x39')](_0x921468[_0xb5fd('0x7f')])&&_0x921468[_0xb5fd('0x7f')]&&(this[_0xb5fd('0x1c')][util['format']('SIP/%s',_0x921468[_0xb5fd('0x3f')])][_0xb5fd('0x80')]===_0xb5fd('0x81')||this[_0xb5fd('0x1c')][util[_0xb5fd('0x82')]('SIP/%s',_0x921468['name'])]['status']===_0xb5fd('0x83'));};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x84')]=function(_0x54ce8f){var _0x4f2f0a=this;return function(){if(!_0x4f2f0a[_0xb5fd('0x7e')](_0x54ce8f['Trunk'])){if(!_0x4f2f0a[_0xb5fd('0x7e')](_0x54ce8f[_0xb5fd('0x85')])){_0x54ce8f[_0xb5fd('0x60')]=utils['CAMPAIGN_STATUS'][_0xb5fd('0x86')];throw _0x54ce8f['name']+_0xb5fd('0x87');}}};};Dialer['prototype'][_0xb5fd('0x88')]=function(_0xbbb369,_0x213579,_0x1d140a,_0x3323c0){var _0x212bf8=this;return function(){var _0x206ead=!![];return _0x212bf8[_0xb5fd('0x89')](_0xbbb369,_0x213579,_0x1d140a,_0x3323c0,_0x206ead);};};Dialer[_0xb5fd('0x7d')]['checkIfTimeIntervals']=function(_0x2572e1,_0x4f2b3b,_0x5ab7a8,_0x3be00e){var _0x2b56a1=this;return function(){var _0x48c313=![];return _0x2b56a1[_0xb5fd('0x89')](_0x2572e1[_0xb5fd('0x6f')],_0x4f2b3b,_0x5ab7a8,_0x3be00e,_0x48c313);};};Dialer['prototype'][_0xb5fd('0x89')]=function(_0x9c4170,_0x11dadf,_0x5f3403,_0x48122f,_0xd7da4c){var _0x2b46e3=[];return new Promise(function(_0x168719,_0x3457c1){if(!isNotNull(_0x9c4170)){_0x48122f['message']=utils[_0xb5fd('0x61')][_0xb5fd('0x70')];return _0x3457c1(msgResponse(_0xb5fd('0x8a'),'Failure',_0x5f3403+_0xb5fd('0x8b')));}if(_[_0xb5fd('0x71')](_0x9c4170)){_0x48122f[_0xb5fd('0x60')]=utils[_0xb5fd('0x61')][_0xb5fd('0x8c')];return _0x3457c1(msgResponse(_0xb5fd('0x8a'),_0xb5fd('0x8d'),_0x5f3403+_0xb5fd('0x8e')));}if(_0x11dadf&&_[_0xb5fd('0x39')](config[_0xb5fd('0x8f')][_0x11dadf])){_0x48122f[_0xb5fd('0x60')]=utils[_0xb5fd('0x61')][_0xb5fd('0x90')];return _0x3457c1(msgResponse(_0xb5fd('0x8a'),_0xb5fd('0x8d'),_0x5f3403+'\x20Timezone\x20unknow\x20'+_0x11dadf));}if(_[_0xb5fd('0x91')](_0x9c4170)){for(var _0x490095=0x0;_0x490095<_0x9c4170['length'];_0x490095+=0x1){_0x2b46e3['push'](ami[_0xb5fd('0x92')]({'action':'command','command':util[_0xb5fd('0x82')](_0xb5fd('0x93'),_0x9c4170[_0x490095][_0xb5fd('0x94')],!_[_0xb5fd('0x39')](config[_0xb5fd('0x8f')][_0x11dadf])?_0x11dadf:'')})[_0xb5fd('0x38')](function(_0x5b9afe){return _0x5b9afe['content'][_0xb5fd('0x95')](_0xb5fd('0x96'))>=0x0;})[_0xb5fd('0x97')](myreject(_0x3457c1)));}}else{_0x2b46e3['push'](ami[_0xb5fd('0x92')]({'action':_0xb5fd('0x98'),'command':util['format'](_0xb5fd('0x93'),_0x9c4170,!_['isUndefined'](config[_0xb5fd('0x8f')][_0x11dadf])?_0x11dadf:'')})[_0xb5fd('0x38')](function(_0x3052c0){return _0x3052c0['content'][_0xb5fd('0x95')](_0xb5fd('0x96'))>=0x0;})[_0xb5fd('0x97')](myreject(_0x3457c1)));}Promise[_0xb5fd('0x99')](_0x2b46e3)[_0xb5fd('0x38')](function(_0x33c0f1){var _0x13d548=_[_0xb5fd('0x9a')](_0x33c0f1);if(_0x13d548){return _0x168719(_0x13d548);}else{_0x48122f[_0xb5fd('0x60')]=_0xd7da4c?utils['CAMPAIGN_STATUS'][_0xb5fd('0x9b')]:utils['CAMPAIGN_STATUS'][_0xb5fd('0x9c')];return _0x3457c1(msgResponse(_0xb5fd('0x9d'),_0xb5fd('0x8d'),'Global:\x20'+_0xd7da4c+'\x20'+_0x5f3403+'\x20Interval\x20is\x20overtime:\x20'+util[_0xb5fd('0x5e')](_0x9c4170,{'showHidden':![],'depth':null})+_0xb5fd('0x9e')+_0x11dadf));}})['catch'](function(_0x37facb){return _0x3457c1(msgResponse(_0xb5fd('0x8a'),_0xb5fd('0x8d'),JSON['stringify'](_0x37facb)));});});};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x35')]=function(){var _0x5158d4=this;return cmHopper[_0xb5fd('0x9f')]({'active':![]},{'where':{'active':!![]}})[_0xb5fd('0x38')](function(){setInterval(function(){_0x5158d4[_0xb5fd('0xa0')]();},0x3e8);});};Dialer[_0xb5fd('0x7d')]['syncCampaigns']=function(){var _0x6e5c3d=this;var _0xafe46b;for(var _0x5a667d in this[_0xb5fd('0x1a')]){if(typeof this[_0xb5fd('0x1a')][_0x5a667d]!==_0xb5fd('0xa1')){_0xafe46b=this[_0xb5fd('0x1a')][_0x5a667d];if(utils[_0xb5fd('0x75')](_0xafe46b)&&utils[_0xb5fd('0x72')](_0xafe46b)){_0xafe46b['sendMessageOneNotActive']=!![];Promise[_0xb5fd('0xa2')]()[_0xb5fd('0x38')](checkIsIVRCampaignActive(_0xafe46b))[_0xb5fd('0x38')](checkInterval(_0xafe46b))[_0xb5fd('0x38')](_0x6e5c3d[_0xb5fd('0x84')](_0xafe46b))[_0xb5fd('0x38')](_0x6e5c3d['checkIfTime'](_0xafe46b['dialGlobalInterval'],_0xafe46b[_0xb5fd('0xa3')],_0xafe46b['name'],_0xafe46b))[_0xb5fd('0x38')](_0x6e5c3d[_0xb5fd('0xa4')](_0xafe46b[_0xb5fd('0x6e')],_0xafe46b['dialTimezone'],_0xafe46b[_0xb5fd('0x3f')],_0xafe46b))[_0xb5fd('0x38')](_0x6e5c3d[_0xb5fd('0xa5')](_0xafe46b))[_0xb5fd('0x97')](loggerCatchQueueSummary('[syncCampaigns]',_0xafe46b));}else{notSendMessagesCampaign(_0xafe46b);}}}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0xa6')]=function(_0x3273ab){if(_0x3273ab[_0xb5fd('0xa7')]!=='predictive'){clearPredictiveAttributes(_0x3273ab);}switch(_0x3273ab['dialMethod']){case'progressive':this[_0xb5fd('0xa8')](_0x3273ab,0x1);break;case _0xb5fd('0xa9'):this[_0xb5fd('0xa8')](_0x3273ab,_0x3273ab[_0xb5fd('0xaa')]);break;case _0xb5fd('0xab'):this[_0xb5fd('0xab')](_0x3273ab);break;case _0xb5fd('0xac'):this[_0xb5fd('0xa8')](_0x3273ab,0x1);break;default:logger[_0xb5fd('0x5c')](_0xb5fd('0xad'),_0x3273ab[_0xb5fd('0x3f')],_0xb5fd('0xae'));}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x8a')]=function(_0x35f4b9,_0x17f1eb){var _0x3c4204=_0x35f4b9[_0xb5fd('0xa3')];var _0x2f7973=_0x17f1eb?_0x35f4b9[_0xb5fd('0xaf')]:_0x35f4b9[_0xb5fd('0x6e')][_0xb5fd('0x6f')];logger[_0xb5fd('0xb0')](_0xb5fd('0xb1'),_0x2f7973,_0x3c4204,_0x35f4b9[_0xb5fd('0x3f')],util[_0xb5fd('0x82')]('Voice\x20Queue\x20%s\x20$s',_0x35f4b9[_0xb5fd('0x3f')],_0x35f4b9['id']));var _0x500b05=null;return Interval[_0xb5fd('0xb2')](_0x2f7973,_0x3c4204)['then'](function(_0x2070e2){if(_0x2070e2===!![]){return _0x2070e2;}else{_0x35f4b9[_0xb5fd('0x60')]=_0x17f1eb?utils[_0xb5fd('0x61')][_0xb5fd('0x9b')]:utils['CAMPAIGN_STATUS'][_0xb5fd('0x9c')];_0x500b05=msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0x17f1eb+'\x20'+_0x35f4b9[_0xb5fd('0x3f')]+_0xb5fd('0xb3')+util[_0xb5fd('0x5e')](_0x2f7973,{'showHidden':![],'depth':null})+_0xb5fd('0x9e')+_0x3c4204);}if(_0x500b05!==null){logger[_0xb5fd('0xb0')](_0xb5fd('0xb4'),_0x500b05);_0x500b05[_0xb5fd('0xb5')]=_0x17f1eb;throw _0x500b05;}})[_0xb5fd('0x97')](function(_0x35c2ee){logger[_0xb5fd('0x5c')]('AMI\x20IfTime',_0x35c2ee);throw msgResponse(_0xb5fd('0xb6'),_0xb5fd('0x7c'),util['inspect'](_0x35c2ee,{'showHidden':![],'depth':null}));});};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x26')]=function(_0x585d19){if(this[_0xb5fd('0x19')][_0x585d19[_0xb5fd('0xb7')]]){if(this[_0xb5fd('0x20')][_0x585d19[_0xb5fd('0xb8')]]&&this['uniqueId'][_0x585d19[_0xb5fd('0xb8')]][_0xb5fd('0x3b')]!==_0xb5fd('0xb9')){this[_0xb5fd('0xba')](this['voiceQueues'][_0x585d19[_0xb5fd('0xb7')]]);this[_0xb5fd('0x20')][_0x585d19[_0xb5fd('0xb8')]][_0xb5fd('0xbb')]=moment()[_0xb5fd('0x82')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0xbc')]=function(_0x247c84){var _0x2dfe37=this[_0xb5fd('0x20')][_0x247c84[_0xb5fd('0xb8')]];if(this['voiceQueues'][_0x247c84[_0xb5fd('0xb7')]]){if(_0x2dfe37&&_0x2dfe37[_0xb5fd('0x3b')]!==_0xb5fd('0xb9')){delete this[_0xb5fd('0x20')][_0x247c84['uniqueid']];this['voiceQueues'][_0x247c84[_0xb5fd('0xb7')]][_0xb5fd('0xbd')]+=0x1;var _0x55354d=new AgentComplete(_0x2dfe37,_0x247c84);if(_0x247c84[_0xb5fd('0xbe')]===_0xb5fd('0xbf')){_0x55354d[_0xb5fd('0xc0')]=this[_0xb5fd('0x19')][_0x247c84[_0xb5fd('0xb7')]][_0xb5fd('0xc1')]&&this[_0xb5fd('0x19')][_0x247c84[_0xb5fd('0xb7')]][_0xb5fd('0xc2')]?moment()[_0xb5fd('0x82')](_0xb5fd('0xc3')):undefined;}hopperUtils[_0xb5fd('0xc4')](_0x55354d)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0xc5')));hopperUtils[_0xb5fd('0xc6')](_0x55354d)['catch'](loggerCatch(_0xb5fd('0xc7')));}}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x28')]=function(_0x59aa53){var _0x5dfba0=this['uniqueId'][_0x59aa53[_0xb5fd('0xb8')]];var _0x2dbeb3=this;var _0xc26f69=![];var _0x548fdb;var _0x5aaa1;if(this[_0xb5fd('0x19')][_0x59aa53['queue']]){if(_0x5dfba0&&_0x5dfba0[_0xb5fd('0x3b')]!=='ivr'){delete this[_0xb5fd('0x20')][_0x59aa53[_0xb5fd('0xb8')]];this[_0xb5fd('0xba')](this[_0xb5fd('0x19')][_0x59aa53[_0xb5fd('0xb7')]]);_0x5dfba0[_0xb5fd('0xc8')]=moment()[_0xb5fd('0x82')](_0xb5fd('0xc3'));var _0x5a2aed=new QueueCallerAbandon(_0x5dfba0,_0x59aa53);if(utils[_0xb5fd('0x56')](_0x5dfba0[_0xb5fd('0xc8')],_0x5dfba0[_0xb5fd('0xc9')])>=_0x5dfba0[_0xb5fd('0xca')]){this[_0xb5fd('0x19')][_0x59aa53['queue']][_0xb5fd('0xcb')]+=0x1;this[_0xb5fd('0x19')][_0x59aa53['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xb5fd('0x19')][_0x59aa53[_0xb5fd('0xb7')]][_0xb5fd('0xcc')]+=0x1;_0x5a2aed[_0xb5fd('0x66')]=0xa;_0x5a2aed['statedesc']=_0xb5fd('0xcd');_0x5a2aed[_0xb5fd('0xce')]='TIMEOUT';_0x5a2aed[_0xb5fd('0xc0')]=this[_0xb5fd('0x19')][_0x59aa53['queue']][_0xb5fd('0xc1')]?moment()[_0xb5fd('0x82')](_0xb5fd('0xc3')):undefined;_0x5a2aed[_0xb5fd('0xcf')]+=0x1;_0x5a2aed[_0xb5fd('0xd0')]+=0x1;_0x548fdb=this['voiceQueues'][_0x59aa53[_0xb5fd('0xb7')]][_0xb5fd('0xd1')];_0x5aaa1=this[_0xb5fd('0x19')][_0x59aa53[_0xb5fd('0xb7')]][_0xb5fd('0xd2')];hopperUtils[_0xb5fd('0xd3')](_0x5a2aed,_0x5a2aed['state'],_0x5dfba0[_0xb5fd('0xd4')])[_0xb5fd('0x38')](function(_0x540128){_0xc26f69=_0x540128['additional']==0x1;if(_0x5a2aed[_0xb5fd('0xcf')]>=_0x2dbeb3[_0xb5fd('0x19')][_0x59aa53[_0xb5fd('0xb7')]][_0xb5fd('0xd5')]){_0x2dbeb3['queueCallerAbandonCreateState'](_0x5a2aed,_0x540128[_0xb5fd('0xd6')]);}else{hopperUtils[_0xb5fd('0xd7')]({'active':![],'countdropretry':_0x5a2aed[_0xb5fd('0xcf')],'scheduledat':moment()[_0xb5fd('0xd8')](_0x2dbeb3[_0xb5fd('0x19')][_0x59aa53['queue']][_0xb5fd('0xd1')],_0xb5fd('0xd9'))[_0xb5fd('0x82')](_0xb5fd('0xc3')),'ContactId':_0x5dfba0['ContactId'],'ListId':_0x5dfba0[_0xb5fd('0xda')],'VoiceQueueId':_0x5dfba0[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x5dfba0[_0xb5fd('0xdc')]||undefined})[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0xdd')));var _0x226fd6=new History(_0x5a2aed);_0x226fd6[_0xb5fd('0x66')]=0xa;_0x226fd6[_0xb5fd('0xde')]='Drop';_0x226fd6[_0xb5fd('0x68')]=moment()[_0xb5fd('0x82')](_0xb5fd('0xc3'));_0x226fd6[_0xb5fd('0x67')]=_0x226fd6[_0xb5fd('0x68')];_0x226fd6[_0xb5fd('0xdf')]=_0x5a2aed[_0xb5fd('0xdf')];_0x226fd6['calleridnum']=_0x5a2aed[_0xb5fd('0xe0')];hopperUtils[_0xb5fd('0xc4')](_0x226fd6)[_0xb5fd('0x97')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xb5fd('0x38')](function(){if(_0xc26f69)hopperUtils['swapAdditionalPhones'](_0x5a2aed,_0x548fdb,_0x5aaa1)[_0xb5fd('0x38')](function(){return 0x1;});});}else{this[_0xb5fd('0x19')][_0x59aa53['queue']][_0xb5fd('0xe1')]+=0x1;this[_0xb5fd('0x19')][_0x59aa53[_0xb5fd('0xb7')]][_0xb5fd('0xe2')]+=0x1;_0x5a2aed[_0xb5fd('0x66')]=0xb;_0x5a2aed[_0xb5fd('0xde')]=_0xb5fd('0xe3');_0x5a2aed[_0xb5fd('0xce')]='CALLEREXIT';_0x5a2aed[_0xb5fd('0xe4')]+=0x1;_0x5a2aed[_0xb5fd('0xd0')]+=0x1;_0x548fdb=this[_0xb5fd('0x19')][_0x59aa53[_0xb5fd('0xb7')]][_0xb5fd('0xe5')];_0x5aaa1=this[_0xb5fd('0x19')][_0x59aa53[_0xb5fd('0xb7')]][_0xb5fd('0xd2')];hopperUtils[_0xb5fd('0xd3')](_0x5a2aed,_0x5a2aed[_0xb5fd('0x66')],_0x5dfba0[_0xb5fd('0xd4')])[_0xb5fd('0x38')](function(_0x37353b){if(_0x5a2aed[_0xb5fd('0xe4')]>=_0x2dbeb3[_0xb5fd('0x19')][_0x59aa53[_0xb5fd('0xb7')]]['dialAbandonedMaxRetry']){_0x2dbeb3[_0xb5fd('0xe6')](_0x5a2aed,_0x37353b[_0xb5fd('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5a2aed[_0xb5fd('0xe4')],'scheduledat':moment()[_0xb5fd('0xd8')](_0x2dbeb3[_0xb5fd('0x19')][_0x59aa53[_0xb5fd('0xb7')]][_0xb5fd('0xe5')],'minutes')[_0xb5fd('0x82')](_0xb5fd('0xc3')),'ContactId':_0x5dfba0[_0xb5fd('0xe7')],'ListId':_0x5dfba0[_0xb5fd('0xda')],'VoiceQueueId':_0x5dfba0[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x5dfba0['CampaignId']||undefined})[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0xe8')));var _0x3ca3bf=new History(_0x5a2aed);_0x3ca3bf[_0xb5fd('0x66')]=0xb;_0x3ca3bf[_0xb5fd('0xde')]='Abandoned';_0x3ca3bf[_0xb5fd('0x68')]=moment()[_0xb5fd('0x82')](_0xb5fd('0xc3'));_0x3ca3bf[_0xb5fd('0x67')]=_0x3ca3bf[_0xb5fd('0x68')];_0x3ca3bf['calleridname']=_0x5a2aed[_0xb5fd('0xdf')];_0x3ca3bf[_0xb5fd('0xe0')]=_0x5a2aed[_0xb5fd('0xe0')];hopperUtils[_0xb5fd('0xc4')](_0x3ca3bf)['catch'](loggerCatch(_0xb5fd('0xe9')));}})[_0xb5fd('0x38')](function(){if(_0xc26f69)hopperUtils['swapAdditionalPhones'](_0x5a2aed,_0x548fdb,_0x5aaa1)[_0xb5fd('0x38')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xb5fd('0x31')]=function(_0x5cb930){if(this['actions'][_0x5cb930[_0xb5fd('0xb8')]]){this[_0xb5fd('0x1f')][_0x5cb930[_0xb5fd('0xb8')]][_0xb5fd('0xea')]=_0x5cb930[_0xb5fd('0xea')];}if(this[_0xb5fd('0x20')][_0x5cb930[_0xb5fd('0xb8')]]){this[_0xb5fd('0x20')][_0x5cb930[_0xb5fd('0xb8')]]['channel']=_0x5cb930['channel'];}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x34')]=function(_0x5b4dd5){if(!this['actions'][_0x5b4dd5['actionid']]){return;}var _0x2b9ca2=this[_0xb5fd('0x19')][this[_0xb5fd('0x1f')][_0x5b4dd5[_0xb5fd('0xeb')]][_0xb5fd('0xb7')]][_0xb5fd('0xec')]||_0xb5fd('0xed');if(_0x2b9ca2==='roundrobin'){if(this[_0xb5fd('0x1f')][_0x5b4dd5[_0xb5fd('0xeb')]]&&_[_0xb5fd('0xee')](this[_0xb5fd('0x1f')][_0x5b4dd5[_0xb5fd('0xeb')]][_0xb5fd('0xef')])&&_0x5b4dd5[_0xb5fd('0x80')]==='1'&&_0x5b4dd5[_0xb5fd('0xf0')]==='0'){if(this[_0xb5fd('0x1b')][_0x5b4dd5[_0xb5fd('0xf1')]]){if(!this['agents'][_0x5b4dd5[_0xb5fd('0xf1')]]['locked']){this[_0xb5fd('0x1b')][_0x5b4dd5[_0xb5fd('0xf1')]][_0xb5fd('0xef')]=!![];this[_0xb5fd('0x1f')][_0x5b4dd5[_0xb5fd('0xeb')]][_0xb5fd('0xef')]=!![];this[_0xb5fd('0x1f')][_0x5b4dd5['actionid']][_0xb5fd('0xf1')]=_0x5b4dd5[_0xb5fd('0xf1')];}}}}else if(_0x2b9ca2==='rrmemory'){if(this['actions'][_0x5b4dd5['actionid']]){if(this['agents'][_0x5b4dd5[_0xb5fd('0xf1')]]){this[_0xb5fd('0x1f')][_0x5b4dd5[_0xb5fd('0xeb')]][_0xb5fd('0xf1')]=_0x5b4dd5[_0xb5fd('0xf1')];if(_[_0xb5fd('0xee')](this['queueBooked'][this[_0xb5fd('0x1f')][_0x5b4dd5[_0xb5fd('0xeb')]]['queue']])){this[_0xb5fd('0x23')][this[_0xb5fd('0x1f')][_0x5b4dd5[_0xb5fd('0xeb')]][_0xb5fd('0xb7')]]=[];}this['queueBooked'][this[_0xb5fd('0x1f')][_0x5b4dd5[_0xb5fd('0xeb')]]['queue']][_0xb5fd('0xf2')](_[_0xb5fd('0x55')](_[_0xb5fd('0x6c')](this[_0xb5fd('0x1f')][_0x5b4dd5[_0xb5fd('0xeb')]],[_0xb5fd('0xf3'),_0xb5fd('0xf1')]),{'status':_0x5b4dd5[_0xb5fd('0x80')],'paused':_0x5b4dd5['paused']}));}}}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0xf4')]=function(_0x26b737){if(!this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]]){return;}var _0x2d0ea9=this;var _0x50e5b8=this['voiceQueues'][this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]]['queue']];var _0x36b259=_0x50e5b8[_0xb5fd('0xec')]||_0xb5fd('0xed');if(_0x36b259===_0xb5fd('0xf5')){if(this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]]&&this[_0xb5fd('0x1f')][_0x26b737['actionid']][_0xb5fd('0xf1')]){this[_0xb5fd('0x18')][_0xb5fd('0xf6')](this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xf3')],this[_0xb5fd('0x1f')][_0x26b737['actionid']][_0xb5fd('0xf1')])['catch'](function(_0x503461){logger[_0xb5fd('0x5c')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xb5fd('0x5e')](_0x503461,{'showHidden':![],'depth':null}));})['finally'](function(){_0x2d0ea9['updateOriginated'](_0x2d0ea9['voiceQueues'][_0x2d0ea9[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xb7')]]);_0x2d0ea9['agents'][_0x2d0ea9[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]]['stateinterface']]['locked']=![];delete _0x2d0ea9['actions'][_0x26b737[_0xb5fd('0xeb')]];unlockQueueStatus(_0x50e5b8);});}else{this[_0xb5fd('0xba')](this['voiceQueues'][this[_0xb5fd('0x1f')][_0x26b737['actionid']][_0xb5fd('0xb7')]]);hopperUtils[_0xb5fd('0xd7')]({'active':![],'ContactId':this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xe7')],'ListId':this[_0xb5fd('0x1f')][_0x26b737['actionid']][_0xb5fd('0xda')],'VoiceQueueId':this[_0xb5fd('0x1f')][_0x26b737['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xdc')]||undefined})[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0xf7')));delete this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]];unlockQueueStatus(_0x50e5b8);}}else if(_0x36b259===_0xb5fd('0xed')){var _0x3643a1;if(this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]]&&!_['isEmpty'](this[_0xb5fd('0x23')][this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xb7')]])){if(this[_0xb5fd('0xf8')][_0x2d0ea9[_0xb5fd('0x1f')][_0x26b737['actionid']]['queue']]){this['queueBookedRR'][_0x2d0ea9[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xb7')]]=this[_0xb5fd('0xf8')][this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xb7')]]?this['queueBookedRR'][this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xb7')]]:this[_0xb5fd('0x23')][this['actions'][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xb7')]]?this[_0xb5fd('0x23')][this[_0xb5fd('0x1f')][_0x26b737['actionid']]['queue']][_0xb5fd('0xf9')]||0x0:0x0;}this['queueBooked'][this[_0xb5fd('0x1f')][_0x26b737['actionid']]['queue']][_0xb5fd('0xf9')]=this[_0xb5fd('0xf8')][this[_0xb5fd('0x1f')][_0x26b737[_0xb5fd('0xeb')]][_0xb5fd('0xb7')]];for(var _0x33283b=0x0;_0x33283b=_0x128928['dialGlobalMaxRetry']){_0x3588ba[_0xb5fd('0x11b')](_0x56a0d6,_0xf2d1fa,_0x3e440b,_0xb5fd('0x11c'));}else{if(_0x56a0d6[_0xb5fd('0x11d')]>=_0x128928[_0xb5fd('0x11e')]){_0x3588ba[_0xb5fd('0x11f')](_0x56a0d6,_0xf2d1fa,_0x3e440b,_0xb5fd('0x120'));}else{hopperUtils[_0xb5fd('0xd7')]({'active':![],'countmachineretry':_0x56a0d6[_0xb5fd('0x11d')],'scheduledat':moment()[_0xb5fd('0xd8')](_0x128928[_0xb5fd('0x121')],'minutes')[_0xb5fd('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x56a0d6[_0xb5fd('0xe7')],'ListId':_0x56a0d6[_0xb5fd('0xda')],'VoiceQueueId':_0x56a0d6[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x56a0d6[_0xb5fd('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0xf2d1fa({'reschedule':0x1});}}});}if(_0x5dc197['type']===_0xb5fd('0xb9')&&this[_0xb5fd('0x1a')][_0x5dc197[_0xb5fd('0xb7')]][_0xb5fd('0x112')]&&_0x5d846a[_0xb5fd('0x113')]===_0xb5fd('0x122')){delete this[_0xb5fd('0x20')][_0x5d846a[_0xb5fd('0xb8')]];this[_0xb5fd('0xba')](this[_0xb5fd('0x1a')][_0x5dc197[_0xb5fd('0xb7')]]);_0x3aabfb=new Hangup(_0x5dc197,_0x5d846a);_0x3aabfb[_0xb5fd('0x66')]=0x12;_0x3aabfb[_0xb5fd('0xde')]=_0xb5fd('0x10b');_0x3aabfb['membername']=_0xb5fd('0x10d');ami[_0xb5fd('0x3a')]('custom:amd',ut[_0xb5fd('0x10f')](_0x3aabfb,_0xb5fd('0x110')));this[_0xb5fd('0x123')](_0x3aabfb,_0xb5fd('0x124'),'[syncHangupInAMDIvr]');}if(_0x5dc197[_0xb5fd('0x3b')]===_0xb5fd('0xb9')&&this[_0xb5fd('0x1a')][_0x5dc197[_0xb5fd('0xb7')]][_0xb5fd('0x112')]&&_0x5d846a[_0xb5fd('0x113')]===_0xb5fd('0x114')){return new Promise(function(_0x141a0f,_0x10a823){delete _0x3588ba[_0xb5fd('0x20')][_0x5d846a['uniqueid']];_0x3588ba['updateOriginated'](_0x3588ba[_0xb5fd('0x1a')][_0x5dc197[_0xb5fd('0xb7')]]);_0x3588ba['campaigns'][_0x5dc197['queue']]['outboundAnswerCallsDay']+=0x1;_0x3588ba['campaigns'][_0x5dc197[_0xb5fd('0xb7')]][_0xb5fd('0x115')]+=0x1;var _0x492b93=_0x3588ba[_0xb5fd('0x1a')][_0x5dc197[_0xb5fd('0xb7')]];var _0x4169a7=new Hangup(_0x5dc197,_0x5d846a);_0x4169a7[_0xb5fd('0x66')]=0x13;_0x4169a7[_0xb5fd('0xde')]='Machine';_0x4169a7[_0xb5fd('0x10c')]=_0xb5fd('0x10d');_0x4169a7[_0xb5fd('0x11d')]+=0x1;_0x4169a7[_0xb5fd('0xd0')]+=0x1;_0x4169a7[_0xb5fd('0x110')]=!![];ami[_0xb5fd('0x3a')](_0xb5fd('0x10e'),ut[_0xb5fd('0x10f')](_0x4169a7,_0xb5fd('0x110')));hopperUtils[_0xb5fd('0xc4')](_0x4169a7)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x117')));if(_0x4169a7[_0xb5fd('0x118')]+_0x4169a7['countcongestionretry']+_0x4169a7[_0xb5fd('0x11a')]+_0x4169a7['countnosuchnumberretry']+_0x4169a7[_0xb5fd('0xcf')]+_0x4169a7['countabandonedretry']+_0x4169a7[_0xb5fd('0x11d')]+_0x4169a7['countagentrejectretry']>=_0x492b93['dialGlobalMaxRetry']){_0x3588ba['stateGlobal'](_0x4169a7,_0x141a0f,_0x10a823,_0xb5fd('0x11c'));}else{if(_0x4169a7[_0xb5fd('0x11d')]>=_0x492b93['dialMachineMaxRetry']){_0x3588ba['createStateFinal'](_0x4169a7,_0x141a0f,_0x10a823,_0xb5fd('0x120'));}else{hopperUtils[_0xb5fd('0xd7')]({'active':![],'countmachineretry':_0x4169a7['countmachineretry'],'scheduledat':moment()[_0xb5fd('0xd8')](_0x492b93[_0xb5fd('0x121')],_0xb5fd('0xd9'))[_0xb5fd('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4169a7['ContactId'],'ListId':_0x4169a7[_0xb5fd('0xda')],'VoiceQueueId':_0x4169a7['VoiceQueueId']||undefined,'CampaignId':_0x4169a7['CampaignId']||undefined})[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x125')));_0x141a0f({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xb5fd('0x30')]=function(_0x4ac640){var _0x2e250e=this['uniqueId'][_0x4ac640[_0xb5fd('0xb8')]];var _0x3d8625;if(_0x2e250e&&_0x2e250e[_0xb5fd('0x3b')]==='ivr'){delete this['uniqueId'][_0x4ac640[_0xb5fd('0xb8')]];this['updateOriginated'](this['campaigns'][_0x2e250e[_0xb5fd('0xb7')]]);this[_0xb5fd('0x1a')][_0x2e250e[_0xb5fd('0xb7')]]['ivrAnswerCallsDay']+=0x1;_0x3d8625=new Hangup(_0x2e250e,_0x4ac640);hopperUtils[_0xb5fd('0xc4')](_0x3d8625)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x126')));hopperUtils[_0xb5fd('0xc6')](_0x3d8625)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x127')));}if(_0x2e250e&&_0x2e250e[_0xb5fd('0x3b')]!==_0xb5fd('0xb9')&&isNotNull(this[_0xb5fd('0x19')][_0x2e250e[_0xb5fd('0xb7')]][_0xb5fd('0x128')])){delete this[_0xb5fd('0x20')][_0x4ac640[_0xb5fd('0xb8')]];this[_0xb5fd('0xba')](this[_0xb5fd('0x19')][_0x2e250e[_0xb5fd('0xb7')]]);this['voiceQueues'][_0x2e250e['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xb5fd('0x19')][_0x2e250e[_0xb5fd('0xb7')]][_0xb5fd('0x115')]+=0x1;_0x3d8625=new Hangup(_0x2e250e,_0x4ac640);_0x3d8625[_0xb5fd('0x66')]=0x10;_0x3d8625[_0xb5fd('0xde')]=_0xb5fd('0x129');_0x3d8625['membername']='AGI';hopperUtils[_0xb5fd('0xc4')](_0x3d8625)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x126')));hopperUtils['moveContactManagedDialer'](_0x3d8625)[_0xb5fd('0x97')](loggerCatch('[syncHangupIvr]'));}if(_0x2e250e&&_0x2e250e[_0xb5fd('0x3b')]!=='ivr'&&!isNotNull(this[_0xb5fd('0x19')][_0x2e250e[_0xb5fd('0xb7')]]['dialQueueProject'])){delete this[_0xb5fd('0x20')][_0x4ac640[_0xb5fd('0xb8')]];this[_0xb5fd('0xba')](this[_0xb5fd('0x19')][_0x2e250e[_0xb5fd('0xb7')]]);this[_0xb5fd('0x19')][_0x2e250e[_0xb5fd('0xb7')]][_0xb5fd('0x12a')]+=0x1;_0x3d8625=new Hangup(_0x2e250e,_0x4ac640);_0x3d8625[_0xb5fd('0x66')]=0xc;_0x3d8625['statedesc']=_0x4ac640[_0xb5fd('0x12b')];_0x3d8625[_0xb5fd('0x10c')]=_0xb5fd('0x12c');hopperUtils[_0xb5fd('0xc4')](_0x3d8625)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x126')));hopperUtils[_0xb5fd('0xc6')](_0x3d8625)[_0xb5fd('0x97')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xb5fd('0x7d')]['syncQueueSummary']=function(_0x59632f){var _0x6b9c0f=this;if(!_0x6b9c0f[_0xb5fd('0x24')][_0x59632f['name']]){_0x6b9c0f[_0xb5fd('0x24')][_0x59632f['name']]={'running':![]};}else if(_0x6b9c0f[_0xb5fd('0x24')][_0x59632f[_0xb5fd('0x3f')]][_0xb5fd('0x12d')]===!![]){return;}else if(_0x6b9c0f['queuesSummary'][_0x59632f[_0xb5fd('0x3f')]][_0xb5fd('0x12d')]===![]){_0x6b9c0f['queuesSummary'][_0x59632f[_0xb5fd('0x3f')]][_0xb5fd('0x12d')]=!![];}var _0x948c8c=_0x6b9c0f[_0xb5fd('0x19')][_0x59632f['name']];var _0xd0f558=_0x948c8c[_0xb5fd('0x60')]!==utils[_0xb5fd('0x61')][_0xb5fd('0x73')];var _0x3cff3b=utils[_0xb5fd('0x12e')](_0x948c8c);_0x948c8c['statusMessage']=utils[_0xb5fd('0x12f')](_0x948c8c,_0x6b9c0f[_0xb5fd('0x1c')]);Promise[_0xb5fd('0xa2')]()[_0xb5fd('0x38')](function(){if(_0x948c8c[_0xb5fd('0x130')]===utils[_0xb5fd('0x61')][_0xb5fd('0x73')]){if(_0xd0f558){clearPredictiveAttributes(_0x948c8c);_0x59632f[_0xb5fd('0x22')]=undefined;_0x59632f[_0xb5fd('0x57')]=undefined;}if(_0x948c8c['statusMessage']===utils[_0xb5fd('0x61')][_0xb5fd('0x73')]){_0x59632f[_0xb5fd('0x131')]=0x0;_0x59632f['paused']=0x0;_0x59632f['inUse']=0x0;_0x59632f[_0xb5fd('0x132')]=0x0;_0x59632f[_0xb5fd('0x133')]=0x0;}}else if(_0x948c8c[_0xb5fd('0x130')]===utils['CAMPAIGN_STATUS'][_0xb5fd('0x134')]&&!_0x3cff3b){return _0x6b9c0f['ifTime'](_0x948c8c,!![])[_0xb5fd('0x38')](function(){return _0x6b9c0f['ifTime'](_0x948c8c,![]);})[_0xb5fd('0x38')](function(){return _0x6b9c0f[_0xb5fd('0xa6')](_0x948c8c);})[_0xb5fd('0x97')](function(_0x442274){loggerSyncQueueSummary[_0xb5fd('0x3d')]('[syncQueueSummary]',util[_0xb5fd('0x5e')](_0x442274,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x948c8c);});}else{clearPredictiveAttributes(_0x948c8c);}})[_0xb5fd('0x38')](function(){var _0x1c8f9b=_0x59632f[_0xb5fd('0x135')](_0x948c8c);if(_0x1c8f9b||_0x948c8c[_0xb5fd('0x136')]){_0x948c8c['queueSummaryCountersUpdated']=![];_0x59632f[_0xb5fd('0x137')](_0x948c8c);Object['assign'](_0x948c8c,_0x59632f);emitOutboundVoiceQueueSummary(_0x59632f);}_0x6b9c0f[_0xb5fd('0x24')][_0x948c8c[_0xb5fd('0x3f')]][_0xb5fd('0x12d')]=![];})[_0xb5fd('0x97')](function(_0x5d85f1){logger[_0xb5fd('0x5c')]('[syncQueueSummary]',util[_0xb5fd('0x5e')](_0x5d85f1,{'showHidden':![],'depth':null}));_0x6b9c0f[_0xb5fd('0x24')][_0x948c8c['name']][_0xb5fd('0x12d')]=![];});};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x2e')]=_[_0xb5fd('0x138')](function(){var _0x54372a=_[_0xb5fd('0x139')](this[_0xb5fd('0x19')],function(_0x2b6fa5){return _0x2b6fa5[_0xb5fd('0x13a')];});var _0x2c191d=_[_0xb5fd('0x139')](this[_0xb5fd('0x1b')],function(_0x221af1){return _0x221af1[_0xb5fd('0x13b')]&&_0x221af1['status']===_0xb5fd('0x81');});if(_0x54372a[_0xb5fd('0xfa')]>0x0&&_0x2c191d[_0xb5fd('0xfa')]>0x0){return Promise[_0xb5fd('0xa2')]()[_0xb5fd('0x38')](cmHopper[_0xb5fd('0x13c')](_[_0xb5fd('0x13d')](_0x54372a,'id'),previewRecallmeReminderInterval,_[_0xb5fd('0x13d')](_0x2c191d,'id')))[_0xb5fd('0x38')](function(_0x5d8480){for(var _0x18f521=0x0;_0x18f521<_0x5d8480[_0xb5fd('0xfa')];_0x18f521++){var _0x533253=_0x5d8480[_0x18f521][_0xb5fd('0x13e')]['name'];if(_0x533253)io['to'](util[_0xb5fd('0x82')](_0xb5fd('0x13f'),_0x533253))[_0xb5fd('0x3a')](_0xb5fd('0x140'),{'hopper':_0x5d8480[_0x18f521]});}})[_0xb5fd('0x97')](function(_0x11e598){logger['error'](_0xb5fd('0x141'),_0x11e598);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xb5fd('0x7d')][_0xb5fd('0x36')]=function(){var _0x4f1318=this;setInterval(function(){_0x4f1318[_0xb5fd('0x142')](_0x4f1318[_0xb5fd('0x20')],'[uniqueid]');_0x4f1318[_0xb5fd('0x142')](_0x4f1318[_0xb5fd('0x1f')],_0xb5fd('0x143'));},0x32c8);};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x142')]=function(_0x208583,_0x2dc09c){var _0x1126ce=this;for(var _0x356900 in _0x208583){if(typeof _0x208583[_0x356900]!=='undefined'){this[_0xb5fd('0x144')][_0xb5fd('0x16')](function(){if(!_[_0xb5fd('0xee')](_0x208583[_0x356900])){return ami[_0xb5fd('0x92')]({'action':_0xb5fd('0x80'),'channel':_0x208583[_0x356900][_0xb5fd('0xea')]})[_0xb5fd('0x97')](function(_0x14b9a4){if(_0x14b9a4['message']===_0xb5fd('0x145')){setTimeout(function(){if(_0x208583[_0x356900]&&_0x208583[_0x356900]['type']!==_0xb5fd('0xb9')){_0x1126ce['updateOriginated'](_0x1126ce[_0xb5fd('0x19')][_0x208583[_0x356900][_0xb5fd('0xb7')]]);logger[_0xb5fd('0x5c')](_0xb5fd('0x146'),_0x2dc09c,_0x356900,_0x208583[_0x356900]['queue']);delete _0x208583[_0x356900];}if(_0x208583[_0x356900]&&_0x208583[_0x356900][_0xb5fd('0x3b')]===_0xb5fd('0xb9')){_0x1126ce[_0xb5fd('0xba')](_0x1126ce[_0xb5fd('0x1a')][_0x208583[_0x356900]['queue']]);logger[_0xb5fd('0x5c')](_0xb5fd('0x147'),_0x2dc09c,_0x356900,_0x208583[_0x356900]['queue']);delete _0x208583[_0x356900];}},0x2328);}});}});}}};Dialer['prototype'][_0xb5fd('0x148')]=function(_0x3ee546){return Promise[_0xb5fd('0xa2')]()['then'](voiceQueueRt[_0xb5fd('0x148')](_0x3ee546))[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x149')));};Dialer['prototype'][_0xb5fd('0xba')]=function(_0x38e9f){if(!_[_0xb5fd('0x39')](_0x38e9f)&&_0x38e9f!==null){if(typeof _0x38e9f[_0xb5fd('0x78')]!==_0xb5fd('0xa1')){if(_0x38e9f['originated']>0x0){_0x38e9f['originated']-=0x1;}else{logger[_0xb5fd('0x5c')](_0xb5fd('0x14a'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x14b')]=function(_0xa50d5b,_0x3ce426){var _0x220bec=this;return function(_0x1de852){_0x220bec[_0xb5fd('0xba')](_0x3ce426);logger['error'](_0xa50d5b,util[_0xb5fd('0x5e')](_0x1de852,{'showHidden':![],'depth':null}));};};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x14c')]=function(_0x2d3810,_0x48f59f,_0x31feeb){var _0x28ba9c={'state':0x19,'statedesc':'notFound'};this[_0xb5fd('0xba')](_0x48f59f);this[_0xb5fd('0x123')](_['merge'](_0x28ba9c,_['pick'](_0x31feeb,['ContactId',_0xb5fd('0xda'),_0xb5fd('0x14d'),_0xb5fd('0xdb'),'CampaignId'])),'[emptyContact][createHistory]',_0xb5fd('0x14e'));logger[_0xb5fd('0x5c')](_0x2d3810);};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x123')]=function(_0x3aab63,_0x840f53,_0x2fbd7a){hopperUtils[_0xb5fd('0xc4')](_0x3aab63)[_0xb5fd('0x97')](loggerCatch(_0x840f53));hopperUtils['moveContactManagedDialer'](_0x3aab63)[_0xb5fd('0x97')](loggerCatch(_0x2fbd7a));};Dialer[_0xb5fd('0x7d')]['queueCallerAbandonCreateState']=function(_0x32d0de,_0x5aff79){hopperUtils['createHistory'](_0x32d0de)[_0xb5fd('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x5aff79==0x0){hopperUtils[_0xb5fd('0xc6')](_0x32d0de)[_0xb5fd('0x97')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x141')]=function(_0x2c8932){return Promise[_0xb5fd('0xa2')]()[_0xb5fd('0x38')](cmHopper[_0xb5fd('0x13c')](_0x2c8932['id'],previewRecallmeReminderInterval))[_0xb5fd('0x38')](function(_0x56f976){for(var _0x963c16=0x0;_0x963c16<_0x56f976[_0xb5fd('0xfa')];_0x963c16++){var _0x3e713d=_0x56f976[_0x963c16][_0xb5fd('0x13e')][_0xb5fd('0x3f')];if(_0x3e713d)io['to'](util['format'](_0xb5fd('0x13f'),_0x3e713d))[_0xb5fd('0x3a')](_0xb5fd('0x140'),{'hopper':_0x56f976[_0x963c16]});}})[_0xb5fd('0x97')](function(){});};Dialer[_0xb5fd('0x7d')][_0xb5fd('0xa5')]=function(_0x1c4361){var _0x2d6181=this;return function(){_0x2d6181[_0xb5fd('0x14f')](_0x1c4361);};};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x150')]=function(_0x2cfeb7,_0x597123){var _0x2a2c48=this;var _0x5a6288=uuid['v4']();this[_0xb5fd('0x1f')][_0x5a6288]=new Action(_0x2cfeb7,_0x597123,_0x5a6288);return new Promise(function(_0x2140ed,_0x52d71f){if(_['isUndefined'](_0x2cfeb7)&&typeof _0x2cfeb7!==_0xb5fd('0x151')){return _0x52d71f(msgResponse(_0xb5fd('0x152'),_0xb5fd('0x8d'),_0xb5fd('0x153')));}if(_[_0xb5fd('0x39')](_0x597123[_0xb5fd('0x154')])||_0x597123['phone']===null){return _0x52d71f(msgResponse(_0xb5fd('0x152'),_0xb5fd('0x8d'),_0xb5fd('0x155')));}var _0x3705f7={'XMD-CALLERID':_0x2a2c48['actions'][_0x5a6288][_0xb5fd('0x156')](),'XMD-AGI':_0x2cfeb7[_0xb5fd('0x128')]?util[_0xb5fd('0x82')](_0xb5fd('0x157'),ipAgi,_0x2cfeb7[_0xb5fd('0x128')]):_0xb5fd('0x158'),'XMD-AGIAFTER':_0x2cfeb7[_0xb5fd('0xc1')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2cfeb7[_0xb5fd('0xc1')]):_0xb5fd('0x158'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2cfeb7)?util[_0xb5fd('0x82')](_0xb5fd('0x159'),_0x2cfeb7[_0xb5fd('0x3f')],_0x2cfeb7[_0xb5fd('0x15a')]||'',_0x2cfeb7[_0xb5fd('0xc2')]?'c':'',_0x2cfeb7['dialQueueTimeout']||0x3):_0xb5fd('0x158'),'XMD-CONTACTID':_0x597123[_0xb5fd('0xe7')],'XMD-CDRTYPE':_0xb5fd('0x6'),'CALLERID(all)':_0x2a2c48[_0xb5fd('0x1f')][_0x5a6288]['getCaller'](),'XMD-AMD':_0x2cfeb7['dialAMDActive']?_0xb5fd('0x134'):_0xb5fd('0x158'),'XMD-DESTINATION':_0xb5fd('0x10a')};if(_0x2cfeb7[_0xb5fd('0x112')]){_0x3705f7['XMD-AMDINITIALSILENCE']=_0x2cfeb7[_0xb5fd('0x15b')]||0x9c4;_0x3705f7[_0xb5fd('0x15c')]=_0x2cfeb7[_0xb5fd('0x15d')]||0x5dc;_0x3705f7['XMD-AMDAFTERGREETINGSILENCE']=_0x2cfeb7[_0xb5fd('0x15e')]||0x320;_0x3705f7['XMD-AMDTOTALANALYSISTIME']=_0x2cfeb7[_0xb5fd('0x15f')]||0x1388;_0x3705f7[_0xb5fd('0x160')]=_0x2cfeb7['dialAMDMinWordLength']||0x64;_0x3705f7[_0xb5fd('0x161')]=_0x2cfeb7[_0xb5fd('0x162')]||0x32;_0x3705f7['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2cfeb7[_0xb5fd('0x163')]||0x3;_0x3705f7[_0xb5fd('0x164')]=_0x2cfeb7[_0xb5fd('0x165')]||0x100;_0x3705f7['XMD-AMDMAXIMUMWORDLENGTH']=_0x2cfeb7[_0xb5fd('0x166')]||0x1388;}if(utils[_0xb5fd('0x167')](_0x2cfeb7)){_0x3705f7[_0xb5fd('0x168')]=_0x597123[_0xb5fd('0xdb')];}else{_0x3705f7[_0xb5fd('0x169')]=_0x597123[_0xb5fd('0xdc')];}var _0x1f4c42=utils[_0xb5fd('0x16a')](_0x597123[_0xb5fd('0x16b')]);Object[_0xb5fd('0x16c')](_0x3705f7,_0x1f4c42);var _0x53393e=_0x2a2c48[_0xb5fd('0x7e')](_0x2cfeb7[_0xb5fd('0x16d')])?utils[_0xb5fd('0x16e')](_0x2cfeb7[_0xb5fd('0x16d')][_0xb5fd('0x16f')],_0x2cfeb7[_0xb5fd('0x170')],_0x2cfeb7['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x2cfeb7['dialOriginateCallerIdNumber'],_0x2cfeb7[_0xb5fd('0x171')]):_0x2cfeb7['dialOriginateCallerIdNumber']):utils[_0xb5fd('0x16e')](_[_0xb5fd('0xee')](_0x2cfeb7['TrunkBackup'])?_0x2cfeb7['Trunk'][_0xb5fd('0x16f')]:_0x2cfeb7['TrunkBackup'][_0xb5fd('0x16f')],_0x2cfeb7[_0xb5fd('0x170')],_0x2cfeb7[_0xb5fd('0x171')]>0x0?utils['getCallerIdRandom'](_0x2cfeb7[_0xb5fd('0x172')],_0x2cfeb7[_0xb5fd('0x171')]):_0x2cfeb7[_0xb5fd('0x172')]);if(_0x53393e){_0x3705f7[_0xb5fd('0x173')]=_0x2a2c48['actions'][_0x5a6288][_0xb5fd('0x174')]=utils[_0xb5fd('0x175')](_0x53393e);_0x3705f7[_0xb5fd('0x176')]=_0x597123['phone'];}_0x2cfeb7['variables']=_0x3705f7;return ami[_0xb5fd('0x92')]({'actionid':_0x5a6288,'action':'originate','channel':_0x2a2c48[_0xb5fd('0x7e')](_0x2cfeb7['Trunk'])?util[_0xb5fd('0x82')](_0xb5fd('0x177'),_0x2cfeb7[_0xb5fd('0x16d')][_0xb5fd('0x3f')],isNotNull(_0x2cfeb7[_0xb5fd('0x178')])?_0x2cfeb7[_0xb5fd('0x178')][_0xb5fd('0x179')]()||'':'',_0x2cfeb7[_0xb5fd('0x17a')]>0x0?_0x597123[_0xb5fd('0x154')]['substring'](_0x2cfeb7[_0xb5fd('0x17a')]):_0x597123[_0xb5fd('0x154')]):util[_0xb5fd('0x82')](_0xb5fd('0x177'),_[_0xb5fd('0xee')](_0x2cfeb7['TrunkBackup'])?_0x2cfeb7['Trunk'][_0xb5fd('0x3f')]:_0x2cfeb7[_0xb5fd('0x85')][_0xb5fd('0x3f')],isNotNull(_0x2cfeb7['dialPrefix'])?_0x2cfeb7[_0xb5fd('0x178')][_0xb5fd('0x179')]()||'':'',_0x2cfeb7[_0xb5fd('0x17a')]>0x0?_0x597123[_0xb5fd('0x154')]['substring'](_0x2cfeb7[_0xb5fd('0x17a')]):_0x597123['phone']),'callerid':_0x53393e,'Exten':_0xb5fd('0x10a'),'Context':_0xb5fd('0x17b'),'Priority':'1','variable':_0x3705f7,'timeout':(_0x2cfeb7[_0xb5fd('0x17c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5a6288})['then'](function(_0x5afb9f){return _0x2140ed(_0x5afb9f);})[_0xb5fd('0x97')](function(_0x54fc59){_0x2cfeb7[_0xb5fd('0x17d')]+=0x1;var _0x42ead6=new History(_0x2a2c48['actions'][_0x5a6288]);logger['error'](util[_0xb5fd('0x82')](_0xb5fd('0x17e'),JSON['stringify'](_0x54fc59)));_0x42ead6[_0xb5fd('0x66')]=0xe;_0x42ead6['statedesc']='OriginateError';_0x42ead6['starttime']=moment()[_0xb5fd('0x82')](_0xb5fd('0xc3'));_0x42ead6[_0xb5fd('0x67')]=_0x42ead6['starttime'];hopperUtils[_0xb5fd('0xc4')](_0x42ead6)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x17f')));_0x2a2c48['moveContactManagedDialer'](_0x42ead6)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x17f')))[_0xb5fd('0xfe')](function(){delete _0x2a2c48[_0xb5fd('0x1f')][_0x5a6288];return _0x52d71f(msgResponse(_0xb5fd('0x152'),_0xb5fd('0x7c'),'originate\x20action\x20Error'));});});});};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x180')]=function(_0xdecfb0,_0x258bef,_0x25f770){var _0x2f6041=new History(_0x258bef);if(_0x2f6041['countbusyretry']+_0x2f6041[_0xb5fd('0x119')]+_0x2f6041[_0xb5fd('0x11a')]+_0x2f6041['countnosuchnumberretry']+_0x2f6041[_0xb5fd('0xcf')]+_0x2f6041[_0xb5fd('0xe4')]+_0x2f6041[_0xb5fd('0x11d')]+_0x2f6041[_0xb5fd('0x181')]>=_0x25f770[_0xb5fd('0x182')]-0x1){return!![];}switch(_0xdecfb0){case 0x3:if(_0x2f6041['countnoanswerretry']>=_0x25f770[_0xb5fd('0x183')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2f6041[_0xb5fd('0x11a')]+=0x1,'scheduledat':moment()[_0xb5fd('0xd8')](_0x25f770['dialNoAnswerRetryFrequency'],_0xb5fd('0xd9'))['format'](_0xb5fd('0xc3')),'ContactId':_0x2f6041[_0xb5fd('0xe7')],'ListId':_0x2f6041[_0xb5fd('0xda')],'VoiceQueueId':_0x2f6041['VoiceQueueId']||undefined,'CampaignId':_0x2f6041['CampaignId']||undefined})['catch'](loggerCatch(_0xb5fd('0x184')));break;case 0x5:if(_0x2f6041[_0xb5fd('0x118')]>=_0x25f770[_0xb5fd('0x185')]-0x1){return!![];}hopperUtils[_0xb5fd('0xd7')]({'active':![],'countbusyretry':_0x2f6041['countbusyretry']+=0x1,'scheduledat':moment()[_0xb5fd('0xd8')](_0x25f770[_0xb5fd('0x186')],_0xb5fd('0xd9'))[_0xb5fd('0x82')](_0xb5fd('0xc3')),'ContactId':_0x2f6041[_0xb5fd('0xe7')],'ListId':_0x2f6041['ListId'],'VoiceQueueId':_0x2f6041[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x2f6041['CampaignId']||undefined})[_0xb5fd('0x97')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2f6041[_0xb5fd('0x119')]>=_0x25f770['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xb5fd('0xd7')]({'active':![],'countcongestionretry':_0x2f6041[_0xb5fd('0x119')]+=0x1,'scheduledat':moment()[_0xb5fd('0xd8')](_0x25f770[_0xb5fd('0x187')],_0xb5fd('0xd9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f6041[_0xb5fd('0xe7')],'ListId':_0x2f6041[_0xb5fd('0xda')],'VoiceQueueId':_0x2f6041[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x2f6041['CampaignId']||undefined})[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x188')));break;case 0x0:if(_0x2f6041['countnosuchnumberretry']>=_0x25f770['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0xb5fd('0xd7')]({'active':![],'countnosuchnumberretry':_0x2f6041[_0xb5fd('0x189')]+=0x1,'scheduledat':moment()['add'](_0x25f770['dialNoSuchNumberRetryFrequency'],_0xb5fd('0xd9'))[_0xb5fd('0x82')](_0xb5fd('0xc3')),'ContactId':_0x2f6041[_0xb5fd('0xe7')],'ListId':_0x2f6041[_0xb5fd('0xda')],'VoiceQueueId':_0x2f6041[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x2f6041['CampaignId']||undefined})[_0xb5fd('0x97')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2f6041[_0xb5fd('0xcf')]>=_0x25f770[_0xb5fd('0xd5')]-0x1){return!![];}hopperUtils[_0xb5fd('0xd7')]({'active':![],'countdropretry':_0x2f6041['countdropretry']+=0x1,'scheduledat':moment()[_0xb5fd('0xd8')](_0x25f770[_0xb5fd('0xd1')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f6041[_0xb5fd('0xe7')],'ListId':_0x2f6041[_0xb5fd('0xda')],'VoiceQueueId':_0x2f6041[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x2f6041[_0xb5fd('0xdc')]||undefined})[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0xdd')));break;case 0xb:if(_0x2f6041[_0xb5fd('0xe4')]>=_0x25f770[_0xb5fd('0x18a')]-0x1){return!![];}hopperUtils[_0xb5fd('0xd7')]({'active':![],'countabandonedretry':_0x2f6041['countabandonedretry']+=0x1,'scheduledat':moment()[_0xb5fd('0xd8')](_0x25f770[_0xb5fd('0xe5')],'minutes')[_0xb5fd('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f6041[_0xb5fd('0xe7')],'ListId':_0x2f6041[_0xb5fd('0xda')],'VoiceQueueId':_0x2f6041[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x2f6041['CampaignId']||undefined})['catch'](loggerCatch(_0xb5fd('0xe8')));break;case 0x13:if(_0x2f6041[_0xb5fd('0x11d')]>=_0x25f770['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xb5fd('0xd7')]({'active':![],'countmachineretry':_0x2f6041['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x25f770['dialMachineRetryFrequency'],_0xb5fd('0xd9'))[_0xb5fd('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f6041['ContactId'],'ListId':_0x2f6041[_0xb5fd('0xda')],'VoiceQueueId':_0x2f6041['VoiceQueueId']||undefined,'CampaignId':_0x2f6041[_0xb5fd('0xdc')]||undefined})[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x125')));break;case 0x14:if(_0x2f6041[_0xb5fd('0x181')]>=_0x25f770['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xb5fd('0xd7')]({'active':![],'countagentrejectretry':_0x2f6041[_0xb5fd('0x181')]+=0x1,'scheduledat':moment()[_0xb5fd('0xd8')](_0x25f770[_0xb5fd('0x18b')],_0xb5fd('0xd9'))[_0xb5fd('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f6041['ContactId'],'ListId':_0x2f6041[_0xb5fd('0xda')],'VoiceQueueId':_0x2f6041[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x2f6041[_0xb5fd('0xdc')]||undefined})[_0xb5fd('0x97')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x18c')]=function(_0x3a7f7d,_0xabcc94,_0x1e0a30){var _0x3b16f1=this;var _0x389d64=new History(_0x3a7f7d);var _0x5265e0=![];var _0x30de8e;var _0x406066;return new Promise(function(_0x2fbc1d,_0x15f14c){if(_[_0xb5fd('0x39')](_0xabcc94)&&typeof _0xabcc94!=='object'){return _0x15f14c(msgResponse('[callProgressDetecting]',_0xb5fd('0x8d'),_0xb5fd('0x18d')));}if(_['isUndefined'](_0x1e0a30)&&typeof _0x1e0a30!==_0xb5fd('0x151')){return _0x15f14c(msgResponse('[callProgressDetecting]','Failure',_0xb5fd('0x18e')));}hopperUtils[_0xb5fd('0xd3')](_0x389d64,_0x1e0a30[_0xb5fd('0xbe')],_0xabcc94)[_0xb5fd('0x38')](function(_0x2e82df){if(_0x2e82df[_0xb5fd('0xd6')]==0x1)_0x5265e0=!![];switch(_0x1e0a30[_0xb5fd('0xbe')]){case'0':_0xabcc94[_0xb5fd('0x18f')]+=0x1;_0x389d64[_0xb5fd('0x66')]=0x0;_0x389d64[_0xb5fd('0xde')]=_0xb5fd('0x190');_0x389d64[_0xb5fd('0x189')]+=0x1;_0x389d64[_0xb5fd('0xd0')]+=0x1;ami[_0xb5fd('0x3a')]('custom:agentnosuchnumber',ut[_0xb5fd('0x10f')](_0x3a7f7d,'nosuchnumber'));_0x30de8e=_0xabcc94['dialNoSuchNumberRetryFrequency'];_0x406066=_0xabcc94['callAdditionalPhoneAfterMin'];hopperUtils[_0xb5fd('0xc4')](_0x389d64)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x117')));if(_0x3b16f1[_0xb5fd('0x180')](0x0,_0x3a7f7d,_0xabcc94)&&!_0x5265e0){if(_0x389d64[_0xb5fd('0x189')]>=_0xabcc94[_0xb5fd('0x191')]){_0x3b16f1[_0xb5fd('0x11f')](_0x389d64,_0x2fbc1d,_0x15f14c,_0xb5fd('0x192'));}else{_0x3b16f1[_0xb5fd('0x11b')](_0x389d64,_0x2fbc1d,_0x15f14c,_0xb5fd('0x192'));}}break;case'3':_0xabcc94[_0xb5fd('0x193')]+=0x1;_0x389d64['state']=0x3;_0x389d64[_0xb5fd('0xde')]=_0xb5fd('0x194');_0x389d64[_0xb5fd('0x11a')]+=0x1;_0x389d64['countglobal']+=0x1;var _0x4b7f0f=ut[_0xb5fd('0x195')](_0x3a7f7d,_0xabcc94);ami['emit'](_0xb5fd('0x196'),_0x4b7f0f);_0x30de8e=_0xabcc94[_0xb5fd('0x197')];_0x406066=_0xabcc94[_0xb5fd('0xd2')];hopperUtils[_0xb5fd('0xc4')](_0x389d64)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x198')));if(_0x3b16f1[_0xb5fd('0x180')](0x3,_0x3a7f7d,_0xabcc94)&&!_0x5265e0){if(_0x389d64[_0xb5fd('0x11a')]>=_0xabcc94[_0xb5fd('0x183')]){_0x3b16f1['createStateFinal'](_0x389d64,_0x2fbc1d,_0x15f14c,'reason\x203\x20ringing\x20no\x20answer');}else{_0x3b16f1[_0xb5fd('0x11b')](_0x389d64,_0x2fbc1d,_0x15f14c,_0xb5fd('0x199'));}}break;case'5':_0xabcc94['outboundBusyCallsDay']+=0x1;_0x389d64[_0xb5fd('0x66')]=0x5;_0x389d64[_0xb5fd('0xde')]=_0xb5fd('0x19a');_0x389d64['countbusyretry']+=0x1;_0x389d64[_0xb5fd('0xd0')]+=0x1;ami[_0xb5fd('0x3a')](_0xb5fd('0x19b'),ut['buildObj'](_0x3a7f7d,_0xb5fd('0x19c')));_0x30de8e=_0xabcc94[_0xb5fd('0x186')];_0x406066=_0xabcc94[_0xb5fd('0xd2')];hopperUtils['createHistory'](_0x389d64)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x19d')));if(_0x3b16f1[_0xb5fd('0x180')](0x5,_0x3a7f7d,_0xabcc94)&&!_0x5265e0){if(_0x389d64[_0xb5fd('0x118')]>=_0xabcc94['dialBusyMaxRetry']){_0x3b16f1[_0xb5fd('0x11f')](_0x389d64,_0x2fbc1d,_0x15f14c,'reason\x205\x20busy');}else{_0x3b16f1[_0xb5fd('0x11b')](_0x389d64,_0x2fbc1d,_0x15f14c,_0xb5fd('0x19e'));}}break;case'8':_0xabcc94[_0xb5fd('0x19f')]+=0x1;_0x389d64['state']=0x8;_0x389d64[_0xb5fd('0xde')]=_0xb5fd('0x1a0');_0x389d64['countcongestionretry']+=0x1;_0x389d64[_0xb5fd('0xd0')]+=0x1;_0x30de8e=_0xabcc94[_0xb5fd('0x187')];_0x406066=_0xabcc94[_0xb5fd('0xd2')];ami[_0xb5fd('0x3a')](_0xb5fd('0x1a1'),ut[_0xb5fd('0x10f')](_0x3a7f7d,'congestion'));hopperUtils[_0xb5fd('0xc4')](_0x389d64)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x1a2')));if(_0x3b16f1[_0xb5fd('0x180')](0x8,_0x3a7f7d,_0xabcc94)&&!_0x5265e0){if(_0x389d64[_0xb5fd('0x119')]>=_0xabcc94['dialCongestionMaxRetry']){_0x3b16f1['createStateFinal'](_0x389d64,_0x2fbc1d,_0x15f14c,_0xb5fd('0x1a3'));}else{_0x3b16f1[_0xb5fd('0x11b')](_0x389d64,_0x2fbc1d,_0x15f14c,'reason\x208\x20congestion');}}break;case'11':_0xabcc94[_0xb5fd('0x1a4')]+=0x1;_0x389d64[_0xb5fd('0x66')]=0xb;_0x389d64['statedesc']=_0xb5fd('0xe3');_0x389d64['countabandonedretry']+=0x1;_0x389d64[_0xb5fd('0xd0')]+=0x1;_0x30de8e=_0xabcc94[_0xb5fd('0xe5')];_0x406066=_0xabcc94[_0xb5fd('0xd2')];hopperUtils[_0xb5fd('0xc4')](_0x389d64)['catch'](loggerCatch(_0xb5fd('0xe9')));if(_0x3b16f1[_0xb5fd('0x180')](0xb,_0x3a7f7d,_0xabcc94)&&!_0x5265e0){if(_0x389d64['countabandonedretry']>=_0xabcc94[_0xb5fd('0x18a')]){_0x3b16f1[_0xb5fd('0x11f')](_0x389d64,_0x2fbc1d,_0x15f14c,'reason\x2011\x20abandoned');}else{_0x3b16f1[_0xb5fd('0x11b')](_0x389d64,_0x2fbc1d,_0x15f14c,_0xb5fd('0x1a5'));}}break;case'20':_0xabcc94[_0xb5fd('0x1a6')]+=0x1;_0x389d64[_0xb5fd('0x66')]=0x14;_0x389d64[_0xb5fd('0xde')]=_0xb5fd('0x1a7');_0x389d64['countagentrejectretry']+=0x1;_0x389d64['countglobal']+=0x1;_0x30de8e=_0xabcc94[_0xb5fd('0x18b')];_0x406066=_0xabcc94[_0xb5fd('0xd2')];ami['emit'](_0xb5fd('0x1a8'),ut['buildObj'](_0x3a7f7d,_0xb5fd('0x1a9')));hopperUtils[_0xb5fd('0xc4')](_0x389d64)[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x1aa')));if(_0x3b16f1[_0xb5fd('0x180')](0x14,_0x3a7f7d,_0xabcc94)&&!_0x5265e0){if(_0x389d64[_0xb5fd('0x181')]>=_0xabcc94[_0xb5fd('0x1ab')]){_0x3b16f1['createStateFinal'](_0x389d64,_0x2fbc1d,_0x15f14c,'reason\x2020\x20agentreject');}else{_0x3b16f1[_0xb5fd('0x11b')](_0x389d64,_0x2fbc1d,_0x15f14c,_0xb5fd('0x1ac'));}}break;default:_0xabcc94[_0xb5fd('0x12a')]+=0x1;_0x389d64[_0xb5fd('0x66')]=0xc;_0x389d64['statedesc']=_0x1e0a30[_0xb5fd('0xbe')];_0x30de8e=_0xabcc94[_0xb5fd('0x18b')];_0x406066=_0xabcc94['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x389d64)['catch'](loggerCatch(_0xb5fd('0x1ad')));if(_0x3b16f1['checkRetriveMax'](_0x1e0a30[_0xb5fd('0xbe')],_0x3a7f7d,_0xabcc94)&&!_0x5265e0){if(_0x389d64[_0xb5fd('0x118')]+_0x389d64[_0xb5fd('0x119')]+_0x389d64[_0xb5fd('0x11a')]+_0x389d64[_0xb5fd('0x189')]+_0x389d64['countdropretry']+_0x389d64[_0xb5fd('0xe4')]+_0x389d64[_0xb5fd('0x11d')]+_0x389d64['countagentrejectretry']>=_0xabcc94[_0xb5fd('0x182')]){_0x3b16f1[_0xb5fd('0x11b')](_0x389d64,_0x2fbc1d,_0x15f14c,_0x1e0a30['reason']);}else{_0x3b16f1[_0xb5fd('0x11f')](_0x389d64,_0x2fbc1d,_0x15f14c,_0x1e0a30[_0xb5fd('0xbe')]);}}}})[_0xb5fd('0x38')](function(){if(_0x5265e0){hopperUtils[_0xb5fd('0x1ae')](_0x389d64,_0x30de8e,_0x406066)['then'](function(){return _0x2fbc1d(0x1);});}});});};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x11b')]=function(_0x49e0d0,_0x1b6ed8,_0x2d3ebc,_0x1f8541){var _0x488893=new Final(_0x49e0d0);_0x488893[_0xb5fd('0x66')]=0xf;_0x488893[_0xb5fd('0xde')]=_0xb5fd('0x1af');this['createStateFinal'](_0x488893,_0x1b6ed8,_0x2d3ebc,_0x1f8541);};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x11f')]=function(_0x139ed6,_0x378dee,_0x1be25f,_0x39ca9b){hopperUtils[_0xb5fd('0xc6')](_0x139ed6)[_0xb5fd('0x38')](function(){return _0x378dee(msgResponse(_0xb5fd('0x1b0'),'Success',_0x39ca9b));})[_0xb5fd('0x97')](function(){return _0x1be25f(msgResponse('[moveContactManagedDialer][0]',_0xb5fd('0x8d'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xb5fd('0xab')]=function(_0x49af45){var _0x373dac=_0x49af45[_0xb5fd('0x1b1')]/0x64;var _0x97165f=_0x49af45[_0xb5fd('0x1b2')]/(_0x49af45[_0xb5fd('0x1b2')]+_0x49af45[_0xb5fd('0xbd')]);var _0x1731b5=Math[_0xb5fd('0x1b3')](_0x49af45['predictiveIntervalAvailable']*(_0x49af45['predictiveIntervalMaxThreshold']/0x64));var _0x473697=Math[_0xb5fd('0x1b3')](_0x49af45[_0xb5fd('0x1b4')]*(_0x49af45[_0xb5fd('0x1b5')]/0x64));var _0x4a0461=_0x49af45[_0xb5fd('0x131')]+_0x49af45[_0xb5fd('0x132')];var _0x46b3f4=Math[_0xb5fd('0x1b6')](_0x49af45[_0xb5fd('0x51')]*_0x49af45[_0xb5fd('0x54')]*_0x49af45[_0xb5fd('0x1b7')]*_0x49af45[_0xb5fd('0x1b8')]);if(_[_0xb5fd('0x39')](_0x49af45[_0xb5fd('0x57')])){if(!_['isUndefined'](_0x49af45[_0xb5fd('0x22')])){_0x49af45['startPredictive']=undefined;loggerPredictive[_0xb5fd('0x5c')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xb5fd('0x39')](_0x49af45[_0xb5fd('0x5a')])){loggerPredictive[_0xb5fd('0x5c')](_0xb5fd('0x1b9'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x49af45[_0xb5fd('0x5a')]);_0x49af45[_0xb5fd('0x5a')]=undefined;}_0x49af45['startProgressive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xb5fd('0x41')](_0x49af45['name'],_0xb5fd('0x1ba'),_0x49af45[_0xb5fd('0x57')]);this['handlePower'](_0x49af45,0x1);}else if(ifInterval(_0x49af45['dialPredictiveInterval'],_0x49af45[_0xb5fd('0x57')])){this['handlePower'](_0x49af45,0x1);loggerPredictiveCalls[_0xb5fd('0x41')]('[startMethodPredictive][StartProgressive][Loop]',_0x49af45[_0xb5fd('0x57')],_0x49af45[_0xb5fd('0x3f')]);_0x49af45[_0xb5fd('0x51')]=0x0;_0x49af45[_0xb5fd('0xcc')]=0x0;}else if(_0x373dac<_0x97165f&&_0x49af45[_0xb5fd('0x1bb')]===_0xb5fd('0x1bc')){clearPredictiveAttributes(_0x49af45);loggerPredictive[_0xb5fd('0x41')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x97165f,_0xb5fd('0x57'),_0x49af45['name']);}else if(_0x46b3f4<_0x49af45[_0xb5fd('0xcc')]&&_0x49af45[_0xb5fd('0x1bb')]===_0xb5fd('0x1bc')){clearPredictiveAttributes(_0x49af45);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x1bd'),_0xb5fd('0x1be'),_0x46b3f4,_0xb5fd('0x1bf'),_0x49af45[_0xb5fd('0xcc')],_0xb5fd('0x57'),_0x49af45[_0xb5fd('0x3f')]);}else if(!ifInterval(_0x49af45[_0xb5fd('0x1c0')],_0x49af45['startProgressive'])&&_[_0xb5fd('0x39')](_0x49af45[_0xb5fd('0x22')])&&!_[_0xb5fd('0x39')](_0x49af45[_0xb5fd('0x57')])){_0x49af45[_0xb5fd('0x22')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x49af45['name'],_0xb5fd('0x1c1'),_0x49af45[_0xb5fd('0x22')]);hopperUtils[_0xb5fd('0x1c2')](_0x49af45[_0xb5fd('0x1c0')])[_0xb5fd('0x38')](this[_0xb5fd('0x1c3')](_0x49af45))[_0xb5fd('0x38')](mergeDataErlangB(_0x49af45))['then'](this['startMethodPredictive'](_0x49af45))[_0xb5fd('0x97')](loggerCatchPredictive(_0xb5fd('0x1c4'),_0x49af45));}else if(!ifInterval(_0x49af45[_0xb5fd('0x1c0')],_0x49af45[_0xb5fd('0x22')])){_0x49af45['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x49af45['startPredictive']=moment()[_0xb5fd('0x82')](_0xb5fd('0xc3'));loggerPredictive[_0xb5fd('0x41')](_0x49af45[_0xb5fd('0x3f')],_0xb5fd('0x1c5'),_0x49af45[_0xb5fd('0x22')]);clearInterval(_0x49af45['handlePredictive']);_0x49af45[_0xb5fd('0x5a')]=undefined;hopperUtils[_0xb5fd('0x1c2')](_0x49af45[_0xb5fd('0x1c0')])[_0xb5fd('0x38')](this['getDataPredictive'](_0x49af45))[_0xb5fd('0x38')](mergeDataErlangB(_0x49af45))[_0xb5fd('0x38')](this['startMethodPredictive'](_0x49af45))[_0xb5fd('0x97')](loggerCatchPredictive(_0xb5fd('0x1c6'),_0x49af45));}else if(_0x49af45[_0xb5fd('0x1b4')]&&_0x4a0461<_0x49af45[_0xb5fd('0x1b4')]-_0x473697){clearPredictiveAttributes(_0x49af45);loggerPredictive['info'](_0x49af45['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4a0461,')\x20are\x20less\x20than\x20threshold\x20(',_0x49af45[_0xb5fd('0x1b4')],'-',_0x473697,'=',_0x49af45[_0xb5fd('0x1b4')]-_0x473697,')');}else if(_0x49af45[_0xb5fd('0x1b4')]&&_0x4a0461>_0x49af45[_0xb5fd('0x1b4')]+_0x1731b5){clearPredictiveAttributes(_0x49af45);loggerPredictive[_0xb5fd('0x41')](_0x49af45['name'],_0xb5fd('0x1c7'),_0x4a0461,_0xb5fd('0x1c8'),_0x49af45[_0xb5fd('0x1b4')],'+',_0x1731b5,'=',_0x49af45[_0xb5fd('0x1b4')]+_0x1731b5,')');}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x1c3')]=function(_0x1dbad4){var _0x57a8c3=this;return function(_0x44af9f){return new Promise(function(_0x57f034,_0x1fb0f9){_['merge'](_0x1dbad4,_0x44af9f[0x0]);if(checkGetDataPredictive(_0x44af9f[0x0])){var _0x5c7eee=_0x1dbad4['predictiveIntervalAvailable']=_0x1dbad4[_0xb5fd('0x132')]+_0x1dbad4[_0xb5fd('0x131')];var _0x267204=_0x1dbad4[_0xb5fd('0x1c0')]*0x3c;var _0x422646=_0x44af9f[0x0][_0xb5fd('0x4a')]+_0x44af9f[0x0][_0xb5fd('0x49')];var _0x2656fb=(_0x44af9f[0x0][_0xb5fd('0x45')]+_0x44af9f[0x0][_0xb5fd('0xcb')]+_0x44af9f[0x0][_0xb5fd('0xe1')])/_0x44af9f[0x0][_0xb5fd('0x43')];_0x1dbad4[_0xb5fd('0x1b7')]=_0x2656fb>0x0?_0x2656fb:0x1;switch(_0x1dbad4[_0xb5fd('0x1bb')]){case _0xb5fd('0x1bc'):var _0x3f06e6=_0x1dbad4[_0xb5fd('0x1b1')]/0x64;return _0x57a8c3[_0xb5fd('0x1c9')](_0x5c7eee,_0x267204,_0x422646,_0x2656fb,_0x3f06e6)[_0xb5fd('0x38')](function(_0x5d4ce3){return _0x57f034(_0x5d4ce3);});case _0xb5fd('0x1ca'):var _0x553c37=_0x1dbad4['dialPredictiveOptimizationPercentage']/0x64;return _0x57a8c3['busyFactor'](_0x5c7eee,_0x267204,_0x422646,_0x2656fb,_0x553c37)[_0xb5fd('0x38')](function(_0x24c42f){return _0x57f034(_0x24c42f);});default:return _0x1fb0f9(msgResponse(_0xb5fd('0x1cb'),_0xb5fd('0x8d'),_0xb5fd('0x1cc')));}}else{return _0x1fb0f9(msgResponse(_0xb5fd('0x1cb'),_0xb5fd('0x8d'),_0xb5fd('0x1cd')));}});};};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x1ce')]=function(_0x41b071){var _0x22c68c=this;return function(_0x206613){return new Promise(function(_0x5d4430,_0x679acb){_[_0xb5fd('0x55')](_0x41b071,_0x206613[0x0]);if(checkGetDataPredictive(_0x206613[0x0])){loggerPredictive['info'](JSON[_0xb5fd('0x6b')](_0x206613[0x0]));if(_0x41b071[_0xb5fd('0x1bb')]===_0xb5fd('0x1bc')){return _0x22c68c['getVoiceQueueRtPauses'](_0x41b071['id'])[_0xb5fd('0x38')](function(_0x4e4246){var _0x440a72=_0x41b071[_0xb5fd('0x1cf')]-_0x4e4246[0x0][_0xb5fd('0x1d0')];var _0x509ece=_0x41b071[_0xb5fd('0x1c0')]*0x3c;var _0x21e183=_0x206613[0x0][_0xb5fd('0x4a')]+_0x206613[0x0][_0xb5fd('0x49')];var _0x4a711e=(_0x206613[0x0][_0xb5fd('0x45')]+_0x206613[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x206613[0x0][_0xb5fd('0xe1')])/_0x206613[0x0][_0xb5fd('0x43')];var _0x4c4f5f=_0x41b071[_0xb5fd('0x1b1')]/0x64;_0x41b071[_0xb5fd('0x1d1')]=_0x4e4246[0x0][_0xb5fd('0x1d0')]||0x0;_0x41b071[_0xb5fd('0x1b7')]=_0x4a711e>0x0?_0x4a711e:0x1;return _0x22c68c[_0xb5fd('0x1c9')](_0x440a72,_0x509ece,_0x21e183,_0x4a711e,_0x4c4f5f);})[_0xb5fd('0x38')](function(_0x8fdf63){return _0x5d4430(_0x8fdf63);})['catch'](function(_0x22805a){return _0x679acb(msgResponse('[CatchErlangB]',_0xb5fd('0x8d'),JSON[_0xb5fd('0x6b')](_0x22805a)));});}if(_0x41b071[_0xb5fd('0x1bb')]===_0xb5fd('0x1ca')){return _0x22c68c['getVoiceQueueRtPauses'](_0x41b071['id'])[_0xb5fd('0x38')](function(_0x2533c6){var _0x2ef16a=_0x41b071['loggedIn']-_0x2533c6[0x0]['outboundQueuePauses'];var _0x37dacc=_0x41b071['dialPredictiveInterval']*0x3c;var _0x4d5c8c=_0x206613[0x0][_0xb5fd('0x4a')]+_0x206613[0x0][_0xb5fd('0x49')];var _0x3fbfa7=(_0x206613[0x0]['predictiveIntervalAnsweredCalls']+_0x206613[0x0][_0xb5fd('0xcb')]+_0x206613[0x0][_0xb5fd('0xe1')])/_0x206613[0x0][_0xb5fd('0x43')];var _0x2ef893=_0x41b071['dialPredictiveOptimizationPercentage']/0x64;_0x41b071[_0xb5fd('0x1d1')]=_0x2533c6[0x0][_0xb5fd('0x1d0')]||0x0;_0x41b071['predictiveIntervalHitRate']=_0x3fbfa7>0x0?_0x3fbfa7:0x1;return _0x22c68c['busyFactor'](_0x2ef16a,_0x37dacc,_0x4d5c8c,_0x3fbfa7,_0x2ef893);})[_0xb5fd('0x38')](function(_0x5d0182){return _0x5d4430(_0x5d0182);})[_0xb5fd('0x97')](function(_0x1b957e){return _0x679acb(msgResponse(_0xb5fd('0x1d2'),_0xb5fd('0x8d'),JSON[_0xb5fd('0x6b')](_0x1b957e)));});}}else{return _0x679acb(msgResponse(_0xb5fd('0x1cb'),_0xb5fd('0x8d'),_0xb5fd('0x1cd')));}});};};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x1d3')]=function(_0x484a46){var _0x63c223=this;return function(){var _0x58ea12=0x0;var _0x4d526f=Math[_0xb5fd('0x1b6')](_0x484a46[_0xb5fd('0x52')]*0x3e8);if(_0x4d526f>0x0){_0x4d526f=_0x4d526f<0x64?0x64:_0x4d526f;loggerPredictive[_0xb5fd('0x41')](_0x484a46[_0xb5fd('0x3f')],_0xb5fd('0x1d4'),_0x4d526f,_0xb5fd('0x1d5'));_0x484a46[_0xb5fd('0x5a')]=setInterval(function(){_0x63c223[_0xb5fd('0x5a')](_0x484a46);loggerPredictiveCalls[_0xb5fd('0x41')](_0xb5fd('0x1d6'),_0x58ea12+=0x1);},_0x4d526f);}else{loggerPredictive[_0xb5fd('0x41')](_0x484a46[_0xb5fd('0x3f')],_0xb5fd('0x1d7'));}};};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x1d8')]=function(_0x3e2d3f,_0x272969){var _0x3fabca=this;return function(_0x181ff4){if(_[_0xb5fd('0x71')](_0x181ff4)){if(_['isNil'](_0x272969[_0xb5fd('0x14d')])||!_0x272969[_0xb5fd('0x1d9')]){if(_0x3e2d3f['dialMethod']===_0xb5fd('0xac')){_0x3e2d3f['queueStatusComplete']=_[_0xb5fd('0x39')](_0x3e2d3f[_0xb5fd('0x69')])?!![]:_0x3e2d3f['queueStatusComplete'];var _0x393fec=uuid['v4']();_0x3fabca[_0xb5fd('0x1f')][_0x393fec]=new Action(_0x3e2d3f,_0x272969,_0x393fec);loggerBooked[_0xb5fd('0x41')](_0xb5fd('0x1da'),_0x393fec,_0xb5fd('0x1db'),JSON[_0xb5fd('0x6b')](_0x3e2d3f['queueStatusComplete']),'Queue:\x20',_0x3e2d3f[_0xb5fd('0x3f')]);if(_0x3e2d3f[_0xb5fd('0x69')]){_0x3e2d3f[_0xb5fd('0x69')]=![];_0x3fabca['queueBooked'][_0x3fabca['actions'][_0x393fec][_0xb5fd('0xb7')]]=[];ami[_0xb5fd('0x92')]({'actionid':_0x393fec,'action':'queuestatus','queue':_0x3e2d3f['name']})[_0xb5fd('0x97')](function(){_0x3fabca[_0xb5fd('0xba')](_0x3e2d3f);hopperUtils[_0xb5fd('0xd7')]({'active':![],'ContactId':_0x3fabca['actions'][_0x393fec][_0xb5fd('0xe7')],'ListId':_0x3fabca[_0xb5fd('0x1f')][_0x393fec][_0xb5fd('0xda')],'VoiceQueueId':_0x3fabca['actions'][_0x393fec]['VoiceQueueId']||undefined,'CampaignId':_0x3fabca[_0xb5fd('0x1f')][_0x393fec]['CampaignId']||undefined})['catch'](loggerCatch(_0xb5fd('0x1dc')));delete _0x3fabca[_0xb5fd('0x1f')][_0x393fec];});}else{loggerBooked[_0xb5fd('0x41')](_0xb5fd('0x1dd'),JSON['stringify'](_0x3e2d3f[_0xb5fd('0x69')]),_0xb5fd('0x1de'),_0x3e2d3f[_0xb5fd('0x3f')]);_0x3fabca[_0xb5fd('0xba')](_0x3e2d3f);hopperUtils[_0xb5fd('0xd7')]({'active':![],'ContactId':_0x3fabca[_0xb5fd('0x1f')][_0x393fec][_0xb5fd('0xe7')],'ListId':_0x3fabca[_0xb5fd('0x1f')][_0x393fec][_0xb5fd('0xda')],'VoiceQueueId':_0x3fabca[_0xb5fd('0x1f')][_0x393fec]['VoiceQueueId']||undefined,'CampaignId':_0x3fabca[_0xb5fd('0x1f')][_0x393fec][_0xb5fd('0xdc')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3fabca['actions'][_0x393fec];}}else{return _0x3fabca[_0xb5fd('0x150')](_0x3e2d3f,_0x272969);}}else{if(utils['getSeconds'](undefined,_0x272969[_0xb5fd('0x1df')])<_0x3e2d3f[_0xb5fd('0x1e0')]*0x3c){if(_0x272969[_0xb5fd('0x13e')]&&!_0x272969[_0xb5fd('0x13e')][_0xb5fd('0x1e1')]){_0x3fabca[_0xb5fd('0x18')][_0xb5fd('0xf6')](_0x272969['id'])[_0xb5fd('0xfe')](function(){_0x3fabca[_0xb5fd('0xba')](_0x3e2d3f);});}else{hopperUtils[_0xb5fd('0x1e2')]({'active':![]},_0x272969['id'],0x1)['finally'](function(){_0x3fabca[_0xb5fd('0xba')](_0x3e2d3f);});}}else{_0x3e2d3f['outboundReCallsDay']+=0x1;_0x3fabca['updateOriginated'](_0x3e2d3f);if(_0x3e2d3f[_0xb5fd('0x1e3')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x272969[_0xb5fd('0xe7')],'ListId':_0x272969[_0xb5fd('0xda')],'VoiceQueueId':_0x272969[_0xb5fd('0xdb')]||undefined,'CampaignId':_0x272969[_0xb5fd('0xdc')]||undefined})['catch'](loggerCatch(_0xb5fd('0x1e4')));hopperUtils[_0xb5fd('0xc4')](createObjHistory(_0x3e2d3f,_0x272969,utils[_0xb5fd('0x61')][_0xb5fd('0x1e5')],0x17,_0xb5fd('0x1e6')))[_0xb5fd('0x97')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3fabca[_0xb5fd('0x123')](createObjHistory(_0x3e2d3f,_0x272969,utils['CAMPAIGN_STATUS'][_0xb5fd('0x1e7')],0x16,_0xb5fd('0x1e8')),_0xb5fd('0x1e9'),'[Originate][HistoryRecallClose]');}}}}else{_0x3e2d3f[_0xb5fd('0x1ea')]+=0x1;_0x3fabca[_0xb5fd('0x123')](createObjHistory(_0x3e2d3f,_0x272969,utils['CAMPAIGN_STATUS'][_0xb5fd('0x1eb')],0xd,_0xb5fd('0x1ec')),_0xb5fd('0x1ed'),_0xb5fd('0x1ee'));throw _0xb5fd('0x1ef');}};};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x14f')]=function(_0x1155bb){var _0x30777a=this;var _0xb509bd=_0x1155bb[_0xb5fd('0x1f0')]-_0x1155bb[_0xb5fd('0x78')];emitCampaignSummary(_0x1155bb);if(_0xb509bd>0x0&&_0x1155bb['temp']==0x0){if(_0xb509bd>this[_0xb5fd('0x1d')]){_0xb509bd=this['maxNumberOriginate'];}_0x1155bb[_0xb5fd('0x1f1')]=0x1;hopperUtils[_0xb5fd('0x1f2')](_0x1155bb,_0xb509bd)[_0xb5fd('0x38')](function(_0x296375){_0x1155bb[_0xb5fd('0x1f1')]=0x0;if(_0x296375){if(!utils[_0xb5fd('0x1f3')](_0x296375)){_0x1155bb[_0xb5fd('0x60')]=utils['CAMPAIGN_STATUS'][_0xb5fd('0x64')];logger[_0xb5fd('0x41')](_0xb5fd('0x1f4')+_0x1155bb['name']);}else{_0x1155bb[_0xb5fd('0x78')]+=_0x296375[_0xb5fd('0xfa')];_0x1155bb[_0xb5fd('0x60')]=utils[_0xb5fd('0x61')][_0xb5fd('0x1f5')];for(var _0x238650=0x0;_0x238650<_0x296375[_0xb5fd('0xfa')];_0x238650+=0x1){_0x1155bb['ivrTotalCallsDays']+=0x1;if(_[_0xb5fd('0xee')](_0x296375[_0x238650])||_[_0xb5fd('0xee')](_0x296375[_0x238650][_0xb5fd('0x16b')])||_['isNil'](_0x296375[_0x238650]['phone'])){_0x30777a[_0xb5fd('0x14c')](_0xb5fd('0x1f6'),_0x1155bb,_0x296375[_0x238650]);}else{hopperUtils[_0xb5fd('0x1f7')](_[_0xb5fd('0x6c')](_0x296375[_0x238650],['CampaignId',_0xb5fd('0x154')]))[_0xb5fd('0x38')](_0x30777a[_0xb5fd('0x1d8')](_0x1155bb,_0x296375[_0x238650]))[_0xb5fd('0x97')](_0x30777a[_0xb5fd('0x14b')](_0xb5fd('0x1f8'),_0x1155bb));}}}}})[_0xb5fd('0x97')](loggerGetContactDialer('[getContactCampaign2]',_0x1155bb,_0xb509bd));}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0xa8')]=function(_0x5b6b01,_0x3dc130){var _0x3ab9f5=this;var _0x2490bc=[];if(_0x3dc130<0x1||_0x5b6b01[_0xb5fd('0xa7')]===_0xb5fd('0xac')){_0x3dc130=0x1;}var _0x1faa5d=Math[_0xb5fd('0x1b6')](_0x5b6b01[_0xb5fd('0x131')]*_0x3dc130)-_0x5b6b01['originated'];if(_0x5b6b01[_0xb5fd('0x1f9')]>0x0){var _0x2c53aa=_0x5b6b01['dialLimitQueue']-_0x5b6b01[_0xb5fd('0x78')]-_0x5b6b01[_0xb5fd('0x132')]-_0x5b6b01[_0xb5fd('0x133')];if(_0x1faa5d>_0x2c53aa){_0x1faa5d=_0x2c53aa;}}if(_0x1faa5d>0x0&&_0x5b6b01[_0xb5fd('0x1f1')]==0x0){if(_0x5b6b01[_0xb5fd('0xa7')]===_0xb5fd('0xac')){_0x1faa5d=0x1;}if(_0x1faa5d>this['maxNumberOriginate']){_0x1faa5d=this[_0xb5fd('0x1d')];}for(var _0x3c50e7 in this[_0xb5fd('0x1b')]){if(typeof this[_0xb5fd('0x1b')][_0x3c50e7]!=='undefined'){if(this['agents'][_0x3c50e7][_0xb5fd('0x66')]===_0xb5fd('0x1fa')&&this[_0xb5fd('0x1b')][_0x3c50e7][_0xb5fd('0x80')]===_0xb5fd('0x81')){_0x2490bc['push'](this[_0xb5fd('0x1b')][_0x3c50e7]['id']);}}}_0x5b6b01[_0xb5fd('0x1f1')]=0x1;hopperUtils[_0xb5fd('0x1fb')](_0x5b6b01,_0x2490bc,_0x1faa5d)[_0xb5fd('0x38')](function(_0xc22bfa){_0x5b6b01['temp']=0x0;if(_0xc22bfa){if(!utils[_0xb5fd('0x1f3')](_0xc22bfa)){hopperUtils[_0xb5fd('0x1fc')](_0x5b6b01)[_0xb5fd('0x38')](sendMessageReschedule(_0x5b6b01))[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x1fd')));}else{_0x5b6b01['originated']+=_0xc22bfa[_0xb5fd('0xfa')];_0x5b6b01[_0xb5fd('0x60')]=_0x5b6b01['dialMethod']===_0xb5fd('0xac')?utils['CAMPAIGN_STATUS'][_0xb5fd('0x134')]:utils[_0xb5fd('0x61')][_0xb5fd('0x1f5')];for(var _0x3af757=0x0;_0x3af757<_0xc22bfa[_0xb5fd('0xfa')];_0x3af757+=0x1){if(_['isNil'](_0xc22bfa[_0x3af757])||_['isNil'](_0xc22bfa[_0x3af757][_0xb5fd('0x16b')])||_[_0xb5fd('0xee')](_0xc22bfa[_0x3af757][_0xb5fd('0x154')])){_0x3ab9f5[_0xb5fd('0x14c')]('[actionOriginate]\x20',_0x5b6b01,_0xc22bfa[_0x3af757]);}else{hopperUtils[_0xb5fd('0x1fe')](_[_0xb5fd('0x6c')](_0xc22bfa[_0x3af757],['VoiceQueueId','phone']))[_0xb5fd('0x38')](_0x3ab9f5['checkContactBlack'](_0x5b6b01,_0xc22bfa[_0x3af757]))[_0xb5fd('0x97')](_0x3ab9f5['loggerHandler']('[actionOriginate]\x20',_0x5b6b01));}}}}})[_0xb5fd('0x97')](loggerGetContactDialer(_0xb5fd('0x1ff'),_0x5b6b01,_0x1faa5d));}};Dialer[_0xb5fd('0x7d')]['handlePredictive']=function(_0x392e99){if(_0x392e99[_0xb5fd('0x1f9')]>0x0){var _0x534302=_0x392e99['dialLimitQueue']-_0x392e99[_0xb5fd('0x78')]-_0x392e99[_0xb5fd('0x132')];if(_0x534302>0x0&&_0x392e99['temp']==0x0){this[_0xb5fd('0x200')](_0x392e99);}else{loggerPredictiveCalls[_0xb5fd('0x41')](_0xb5fd('0x201'));}}else{this[_0xb5fd('0x200')](_0x392e99);}};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x200')]=function(_0x2ae3bc){var _0x1c9287=this;var _0x1ab782=[];_0x2ae3bc[_0xb5fd('0x78')]+=0x1;for(var _0x29ef31 in this[_0xb5fd('0x1b')]){if(typeof this[_0xb5fd('0x1b')][_0x29ef31]!==_0xb5fd('0xa1')){if(this[_0xb5fd('0x1b')][_0x29ef31][_0xb5fd('0x66')]===_0xb5fd('0x1fa')&&this[_0xb5fd('0x1b')][_0x29ef31]['status']===_0xb5fd('0x81')){_0x1ab782[_0xb5fd('0xf2')](this[_0xb5fd('0x1b')][_0x29ef31]['id']);}}}_0x2ae3bc[_0xb5fd('0x1f1')]=0x1;return this[_0xb5fd('0x1fb')](_0x2ae3bc['id'],_0x1ab782,0x1,_0x2ae3bc[_0xb5fd('0x202')],_0x2ae3bc)[_0xb5fd('0x38')](function(_0x96e88b){_0x2ae3bc['temp']=0x1;if(_0x96e88b){if(!utils['checkContactEmpty'](_0x96e88b)){utils[_0xb5fd('0x203')](_0x2ae3bc,0x1,0x0);return hopperUtils[_0xb5fd('0x1fc')](_0x2ae3bc)[_0xb5fd('0x38')](sendMessageReschedule(_0x2ae3bc))[_0xb5fd('0x97')](loggerCatch(_0xb5fd('0x1fd')));}else{_0x2ae3bc[_0xb5fd('0x60')]=utils[_0xb5fd('0x61')]['RUNNING'];if(_[_0xb5fd('0xee')](_0x96e88b[0x0])||_[_0xb5fd('0xee')](_0x96e88b[0x0][_0xb5fd('0x16b')])||_['isNil'](_0x96e88b[0x0][_0xb5fd('0x154')])){_0x1c9287[_0xb5fd('0x14c')](_0xb5fd('0x1f6'),_0x2ae3bc,_0x96e88b[0x0]);}else{return hopperUtils[_0xb5fd('0x1fe')](_[_0xb5fd('0x6c')](_0x96e88b[0x0],[_0xb5fd('0xdb'),_0xb5fd('0x154')]))[_0xb5fd('0x38')](_0x1c9287[_0xb5fd('0x1d8')](_0x2ae3bc,_0x96e88b[0x0]))['catch'](_0x1c9287['loggerHandler'](_0xb5fd('0x204'),_0x2ae3bc));}}}})[_0xb5fd('0x97')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2ae3bc,0x1));};Dialer['prototype'][_0xb5fd('0x1c9')]=function(_0x13c6ca,_0x5da140,_0x4e2784,_0x39801b,_0x1cb737,_0x5eafb0){loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x205'));loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x206'),_0x13c6ca);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x207'),_0x5da140);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x208'),_0x4e2784);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',_0x39801b);loggerPredictive[_0xb5fd('0x41')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cb737);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x4b'));return new Promise(function(_0x298a91,_0x2ed146){if(_0x13c6ca<=0x0||isNaN(_0x13c6ca)){return _0x2ed146(msgResponse(_0xb5fd('0x209'),_0xb5fd('0x7c'),_0xb5fd('0x20a')+_0x13c6ca));}if(_0x4e2784<=0x0||isNaN(_0x4e2784)){return _0x2ed146(msgResponse(_0xb5fd('0x209'),_0xb5fd('0x7c'),'Ts\x20=\x20'+_0x4e2784));}if(_0x39801b<=0x0||isNaN(_0x39801b)){return _0x2ed146(msgResponse(_0xb5fd('0x209'),_0xb5fd('0x7c'),'p\x20=\x20'+_0x39801b));}if(_0x5da140<=0x0||isNaN(_0x5da140)){return _0x2ed146(msgResponse(_0xb5fd('0x209'),_0xb5fd('0x7c'),_0xb5fd('0x20b')+_0x5da140));}if(_0x1cb737<=0x0||isNaN(_0x1cb737)){return _0x2ed146(msgResponse(_0xb5fd('0x209'),_0xb5fd('0x7c'),_0xb5fd('0x20c')+_0x1cb737));}_0x5eafb0=_0x5eafb0||0x0;var _0x1b4902=0x1/_0x4e2784;var _0x4e24f3=0x0;var _0x316d01=0x0;var _0x39a7ce=0x0;var _0x3358dc=0x0;for(var _0x5b85ec=0x0;_0x39a7ce<_0x1cb737;_0x5b85ec+=0x1){_0x316d01=_0x5b85ec/_0x5da140;_0x4e24f3=(_0x39801b*_0x316d01+_0x5eafb0)/_0x1b4902;_0x39a7ce=utils[_0xb5fd('0x20d')](_0x4e24f3,_0x13c6ca);_0x3358dc=_0x4e24f3/_0x13c6ca*(0x1-utils[_0xb5fd('0x20d')](_0x4e24f3,_0x13c6ca));}return _0x298a91({'erlangCalls':_0x5b85ec,'erlangCallToSecond':_0x5da140/_0x5b85ec,'erlangAbandonmentRate':_0x39a7ce,'erlangBusyFactor':_0x3358dc});});};Dialer[_0xb5fd('0x7d')][_0xb5fd('0x20e')]=function(_0x2d11e2,_0xbd5630,_0x5f53a4,_0x15fad8,_0x476374,_0x44d048){loggerPredictive[_0xb5fd('0x41')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x206'),_0x2d11e2);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x207'),_0xbd5630);loggerPredictive[_0xb5fd('0x41')]('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',_0x5f53a4);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x20f'),_0x15fad8);loggerPredictive[_0xb5fd('0x41')](_0xb5fd('0x210'),_0x476374);loggerPredictive['info'](_0xb5fd('0x4b'));return new Promise(function(_0x4171ca,_0x59ac36){if(_0x2d11e2<=0x0||isNaN(_0x2d11e2)){return _0x59ac36(msgResponse(_0xb5fd('0x211'),'Error',_0xb5fd('0x20a')+_0x2d11e2));}if(_0x5f53a4<=0x0||isNaN(_0x5f53a4)){return _0x59ac36(msgResponse(_0xb5fd('0x211'),_0xb5fd('0x7c'),_0xb5fd('0x212')+_0x5f53a4));}if(_0x15fad8<=0x0||isNaN(_0x15fad8)){return _0x59ac36(msgResponse('[busyFactor]',_0xb5fd('0x7c'),'p\x20=\x20'+_0x15fad8));}if(_0xbd5630<=0x0||isNaN(_0xbd5630)){return _0x59ac36(msgResponse(_0xb5fd('0x211'),_0xb5fd('0x7c'),_0xb5fd('0x20b')+_0xbd5630));}if(_0x476374<=0x0||isNaN(_0x476374)){return _0x59ac36(msgResponse(_0xb5fd('0x211'),'Error',_0xb5fd('0x213')+_0x476374));}_0x44d048=_0x44d048||0x0;var _0x3ce6ef=0x1/_0x5f53a4;var _0x1c9394=0x0;var _0xe1444e=0x0;var _0x239aeb=0x0;var _0x57718c=0x0;for(var _0x46f445=0x0;_0x57718c<_0x476374;_0x46f445+=0x1){_0xe1444e=_0x46f445/_0xbd5630;_0x1c9394=(_0x15fad8*_0xe1444e+_0x44d048)/_0x3ce6ef;_0x239aeb=utils[_0xb5fd('0x20d')](_0x1c9394,_0x2d11e2);_0x57718c=_0x1c9394/_0x2d11e2*(0x1-utils[_0xb5fd('0x20d')](_0x1c9394,_0x2d11e2));}return _0x4171ca({'erlangCalls':_0x46f445,'erlangCallToSecond':_0xbd5630/_0x46f445,'erlangAbandonmentRate':_0x239aeb,'erlangBusyFactor':_0x57718c});});};module[_0xb5fd('0x214')]=Dialer; \ No newline at end of file +var _0x2857=['Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','available','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','loggedIn','predictiveIntervalAnsweredCalls','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','isEmpty','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','dialRecallMeTimeout','voicePause','preview','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','limitCalls','temp','getContactDialerIvr','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','getContactDialer','checkContactEmpty','countReScheduled','RUNNING','checkIsBlackList','talking','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','[getContactDialerPredictive]','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','exports','util','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_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','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','prototype','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','Action','interval','true','catch','iftime\x20%s,%s','content','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','predictive','method\x20not\x20recognized','silly','Dialer::ifTime()','intervalIftime','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','type','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','createHistory','[syncAgentComplete][createHistory]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','dropreason','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','add','minutes','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','push','idHopper','[Catch][Preview][syncQueueStatusComplete]','rescheduleContact','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','run','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','responsetime','response','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','MACHINE','countnoanswerretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','moveContactManagedDialer','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','queueCallerAbandonCreateState','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','callProgressDetecting','entity\x20is\x20undefine','object','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global'];(function(_0x177173,_0x5f5858){var _0x50f4cf=function(_0x1e754a){while(--_0x1e754a){_0x177173['push'](_0x177173['shift']());}};_0x50f4cf(++_0x5f5858);}(_0x2857,0x66));var _0x7285=function(_0x2b9ac8,_0xf820cb){_0x2b9ac8=_0x2b9ac8-0x0;var _0x3ceea9=_0x2857[_0x2b9ac8];return _0x3ceea9;};'use strict';var util=require(_0x7285('0x0'));var _=require(_0x7285('0x1'));var uuid=require(_0x7285('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x7285('0x3'));var utils=require(_0x7285('0x4'));var hopperUtils=require(_0x7285('0x5'));var ut=require(_0x7285('0x6'));var config=require(_0x7285('0x7'));var logger=require(_0x7285('0x8'))(_0x7285('0x9'));var loggerBooked=require(_0x7285('0x8'))(_0x7285('0xa'));var loggerPredictive=require(_0x7285('0x8'))('predictive');var loggerPredictiveCalls=require(_0x7285('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x7285('0xb'));var ami=require('../ami');config[_0x7285('0xc')]=_[_0x7285('0xd')](config[_0x7285('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x7285('0xe'))(new Redis(config['redis']));var cmHopper=require(_0x7285('0xf'));var voiceQueueRt=require(_0x7285('0x10'));var RpcSetting=require(_0x7285('0x11'));var Interval=require(_0x7285('0x12'));var Action=require(_0x7285('0x13'));var History=require('./models/history');var Final=require(_0x7285('0x14'));var AgentComplete=require(_0x7285('0x15'));var QueueCallerAbandon=require(_0x7285('0x16'));var Hangup=require(_0x7285('0x17'));var ipAgi=process[_0x7285('0x18')][_0x7285('0x19')]||_0x7285('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x7285('0x1b')]=function(_0x5a3614){this[_0x7285('0x1c')]=this[_0x7285('0x1c')]?this[_0x7285('0x1c')][_0x7285('0x1d')](_0x5a3614):_0x5a3614();};function Dialer(_0x1d44be,_0x3337b5){this['sequence']=new Sequence();this['preview']=_0x3337b5;this[_0x7285('0x1e')]=_0x1d44be[_0x7285('0x1e')];this[_0x7285('0x1f')]=_0x1d44be[_0x7285('0x1f')];this[_0x7285('0x20')]=_0x1d44be[_0x7285('0x20')];this['trunks']=_0x1d44be[_0x7285('0x21')];this[_0x7285('0x22')]=config[_0x7285('0x22')]||0x2;this[_0x7285('0x23')]={};this[_0x7285('0x24')]={};this[_0x7285('0x25')]={};this[_0x7285('0x26')]={};this[_0x7285('0x27')]={};this[_0x7285('0x28')]={};this[_0x7285('0x29')]={};this['ivrOriginated']={};this[_0x7285('0x2a')]={};this[_0x7285('0x2b')]={};this[_0x7285('0x2c')]={};ami['on'](_0x7285('0x2d'),this[_0x7285('0x2e')][_0x7285('0x2f')](this));ami['on'](_0x7285('0x30'),this[_0x7285('0x31')][_0x7285('0x2f')](this));ami['on'](_0x7285('0x32'),this['syncOriginateResponse'][_0x7285('0x2f')](this));ami['on']('agentcomplete',this[_0x7285('0x33')][_0x7285('0x2f')](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0x7285('0x34'),this[_0x7285('0x35')][_0x7285('0x2f')](this));ami['on']('hangup',this[_0x7285('0x36')][_0x7285('0x2f')](this));ami['on'](_0x7285('0x37'),this[_0x7285('0x38')]['bind'](this));ami['on'](_0x7285('0x39'),this[_0x7285('0x3a')]['bind'](this));ami['on'](_0x7285('0x3b'),this['syncQueueMember'][_0x7285('0x2f')](this));ami['on'](_0x7285('0x3c'),this[_0x7285('0x3d')][_0x7285('0x2f')](this));this[_0x7285('0x3e')]();this[_0x7285('0x3f')]();RpcSetting[_0x7285('0x40')]()[_0x7285('0x41')](function(_0x10ad68){previewRecallmeReminderInterval=_0x10ad68[_0x7285('0x42')];});}function isNotNull(_0x72f548){return _0x72f548!==null&&!_[_0x7285('0x43')](_0x72f548);}function msgResponse(_0x5b812d,_0x44e2a0,_0x862b40){return{'action':_0x5b812d,'response':_0x44e2a0,'message':_0x862b40,'stack':_0x862b40};}function emit(_0x7ccc5a,_0x7591a1,_0x221bf0){io['to'](_0x7ccc5a)[_0x7285('0x44')](_0x7591a1,_0x221bf0);}function emitOutboundVoiceQueueSummary(_0x40446c){if(_0x40446c['type']===_0x7285('0x45')){logger[_0x7285('0x46')](_0x7285('0x47'),util['inspect'](_0x40446c,{'showHidden':![],'depth':null}));emit(util[_0x7285('0x48')](_0x7285('0x49'),_0x40446c[_0x7285('0x4a')]),_0x7285('0x4b'),_0x40446c);}}function checkGetDataPredictive(_0x31dd3f){if(isNotNull(_0x31dd3f)&&!_['isEmpty'](_0x31dd3f)){loggerPredictive[_0x7285('0x4c')](_0x7285('0x4d'));loggerPredictive[_0x7285('0x4c')](_0x7285('0x4e'),_0x31dd3f[_0x7285('0x4f')]);loggerPredictive[_0x7285('0x4c')](_0x7285('0x50'),_0x31dd3f['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x7285('0x51'),_0x31dd3f[_0x7285('0x52')]);loggerPredictive[_0x7285('0x4c')](_0x7285('0x53'),_0x31dd3f[_0x7285('0x54')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31dd3f[_0x7285('0x55')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31dd3f[_0x7285('0x56')]);loggerPredictive['info'](_0x7285('0x57'));if(_0x31dd3f[_0x7285('0x4f')]>0x0){if(!_[_0x7285('0x43')](_0x31dd3f['predictiveIntervalAvgTalktime'])&&_0x31dd3f[_0x7285('0x56')]>0x0){return!![];}loggerPredictive['info'](_0x7285('0x58'));if(!_[_0x7285('0x43')](_0x31dd3f[_0x7285('0x55')])&&_0x31dd3f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x7285('0x4c')](_0x7285('0x59'));}else{loggerPredictive[_0x7285('0x4c')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x7285('0x5a'));}return![];}function mergeDataErlangB(_0x50fa03){return function(_0x389601){loggerPredictive[_0x7285('0x4c')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x7285('0x5b'),_0x389601[_0x7285('0x5c')]);loggerPredictive[_0x7285('0x4c')](_0x7285('0x5d'),_0x389601[_0x7285('0x5e')]);loggerPredictive['info'](_0x7285('0x5f'),_0x389601[_0x7285('0x60')]);loggerPredictive[_0x7285('0x4c')](_0x7285('0x61'),_0x389601['erlangBusyFactor']);loggerPredictive['info'](_0x7285('0x5f'),_0x389601[_0x7285('0x60')]);loggerPredictive[_0x7285('0x4c')]('---------------------------');_[_0x7285('0x62')](_0x50fa03,_0x389601);};}function ifInterval(_0x1263dd,_0x11c58d){if(_['isUndefined'](_0x11c58d)){return![];}return utils[_0x7285('0x63')](undefined,_0x11c58d)<_0x1263dd*0x3c;}function clearPredictiveAttributes(_0x1c3cd8){if(_0x1c3cd8['startProgressive']){_0x1c3cd8['startProgressive']=undefined;loggerPredictive['debug'](_0x1c3cd8[_0x7285('0x4a')],_0x7285('0x64'));}if(_0x1c3cd8[_0x7285('0x28')]){_0x1c3cd8[_0x7285('0x28')]=undefined;loggerPredictive[_0x7285('0x46')](_0x1c3cd8[_0x7285('0x4a')],_0x7285('0x65'));}if(_0x1c3cd8['handlePredictive']){clearInterval(_0x1c3cd8[_0x7285('0x66')]);_0x1c3cd8['handlePredictive']=undefined;loggerPredictive['debug'](_0x1c3cd8['name'],_0x7285('0x67'));}}function loggerCatchPredictive(_0x130e6d,_0xd5b5b4){return function(_0xb483c9){loggerPredictive[_0x7285('0x68')](_0xd5b5b4[_0x7285('0x4a')],_0x130e6d);loggerPredictive[_0x7285('0x68')](_0xb483c9[_0x7285('0x69')]);clearPredictiveAttributes(_0xd5b5b4);};}function loggerCatch(_0x309513){return function(_0xeb7f1c){logger[_0x7285('0x68')](_0x309513,util[_0x7285('0x6a')](_0xeb7f1c,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x35607e,_0x4aecda,_0x32deac){return function(_0x4dd50f){utils[_0x7285('0x6b')](_0x4aecda,_0x32deac,0x0);logger['error'](_0x35607e,util[_0x7285('0x6a')](_0x4dd50f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x21ff4a){return function(_0x52daf3){if(isNotNull(_0x52daf3)&&isNotNull(_0x52daf3[0x0])){if(_0x52daf3[0x0][_0x7285('0x6c')]>0x0){_0x21ff4a[_0x7285('0x6d')]=utils[_0x7285('0x6e')][_0x7285('0x6f')];logger['info']('[getContactDialer2][ReScheduled]'+_0x21ff4a[_0x7285('0x4a')],_0x52daf3[0x0][_0x7285('0x6c')],_0x7285('0x70'));}else{_0x21ff4a['message']=utils[_0x7285('0x6e')][_0x7285('0x71')];logger[_0x7285('0x4c')](_0x7285('0x72')+_0x21ff4a[_0x7285('0x4a')]);}}};}function createObjHistory(_0x3aaf15,_0x205f16,_0x254a70,_0x5d400b,_0x14f686){_0x3aaf15[_0x7285('0x6d')]=_0x254a70;var _0x17324c=new Action(_0x3aaf15,_0x205f16);var _0x54378d=new History(_0x17324c);_0x54378d[_0x7285('0x73')]=_0x5d400b;_0x54378d[_0x7285('0x74')]=_0x14f686;_0x54378d['endtime']=_0x17324c[_0x7285('0x75')];return _0x54378d;}function unlockQueueStatus(_0x30ae30,_0x1cb154){setTimeout(function(){if(_[_0x7285('0x43')](_0x30ae30[_0x7285('0x76')])){loggerBooked[_0x7285('0x68')](_0x7285('0x77'),_0x1cb154);}_0x30ae30[_0x7285('0x76')]=!![];loggerBooked['info'](_0x7285('0x78'),_0x1cb154,JSON[_0x7285('0x79')](_[_0x7285('0x7a')](_0x30ae30,[_0x7285('0x4a'),_0x7285('0x76')])));},0x1f3);}function checkInterval(_0x3cf528){return function(){if(!isNotNull(_0x3cf528[_0x7285('0x7b')])){_0x3cf528[_0x7285('0x6d')]=utils[_0x7285('0x6e')][_0x7285('0x7c')];throw _0x3cf528[_0x7285('0x4a')]+_0x7285('0x7d');}if(!isNotNull(_0x3cf528[_0x7285('0x7b')][_0x7285('0x7e')])){_0x3cf528['message']=utils[_0x7285('0x6e')]['NULL_INTERVAL'];throw _0x3cf528['name']+_0x7285('0x7d');}if(!isNotNull(_['isEmpty'](_0x3cf528[_0x7285('0x7b')][_0x7285('0x7e')]))){_0x3cf528[_0x7285('0x6d')]=utils[_0x7285('0x6e')][_0x7285('0x7c')];throw _0x3cf528['name']+_0x7285('0x7d');}};}function checkIsIVRCampaignActive(_0x410421){return function(){if(!utils['isIVRCampaignActive'](_0x410421)){_0x410421[_0x7285('0x6d')]=utils[_0x7285('0x6e')][_0x7285('0x7f')];throw _0x410421[_0x7285('0x4a')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x49e274){if(utils[_0x7285('0x80')](_0x49e274)){emit(util[_0x7285('0x48')]('campaign:ivr:%s',_0x49e274[_0x7285('0x4a')]),_0x7285('0x81'),_0x49e274);}}function loggerCatchQueueSummary(_0x427774,_0xa18ca9){return function(_0x3b057d){clearPredictiveAttributes(_0xa18ca9);emitCampaignSummary(_0xa18ca9);loggerSyncQueueSummary[_0x7285('0x46')](_0x427774,util[_0x7285('0x6a')](_0x3b057d,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x257d52){if(_0x257d52[_0x7285('0x82')]){if(_0x257d52[_0x7285('0x83')]===0x0){_0x257d52[_0x7285('0x82')]=![];_0x257d52[_0x7285('0x6d')]=utils[_0x7285('0x6e')][_0x7285('0x7f')];loggerSyncQueueSummary[_0x7285('0x46')](_0x7285('0x84'),_0x257d52['name'],_0x7285('0x85'));}else{_0x257d52['message']=utils[_0x7285('0x6e')]['DISACTIVED'];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x257d52[_0x7285('0x4a')],_0x7285('0x86'));}emitCampaignSummary(_0x257d52);}}function myreject(_0x270c7d){return function(_0x17f29f){return _0x270c7d(msgResponse(_0x7285('0x87'),'Error',JSON[_0x7285('0x79')](_0x17f29f)));};}Dialer[_0x7285('0x88')][_0x7285('0x89')]=function(_0x2786f2){return!_['isUndefined'](_0x2786f2)&&_0x2786f2&&!_['isUndefined'](_0x2786f2[_0x7285('0x4a')])&&!_[_0x7285('0x43')](_0x2786f2[_0x7285('0x8a')])&&_0x2786f2['active']&&(this[_0x7285('0x21')][util[_0x7285('0x48')](_0x7285('0x8b'),_0x2786f2[_0x7285('0x4a')])]['status']===_0x7285('0x8c')||this[_0x7285('0x21')][util[_0x7285('0x48')]('SIP/%s',_0x2786f2['name'])][_0x7285('0x8d')]===_0x7285('0x8e'));};Dialer['prototype'][_0x7285('0x8f')]=function(_0x66fb1e){var _0x193a48=this;return function(){if(!_0x193a48['isTrunkReachable'](_0x66fb1e[_0x7285('0x90')])){if(!_0x193a48[_0x7285('0x89')](_0x66fb1e[_0x7285('0x91')])){_0x66fb1e[_0x7285('0x6d')]=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x66fb1e['name']+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x7285('0x92')]=function(_0x8fc292,_0x358bdd,_0x32efd,_0x57aa5e){var _0x1ce3e5=this;return function(){var _0x54d0bf=!![];return _0x1ce3e5[_0x7285('0x93')](_0x8fc292,_0x358bdd,_0x32efd,_0x57aa5e,_0x54d0bf);};};Dialer[_0x7285('0x88')][_0x7285('0x94')]=function(_0x63fb5d,_0x38cde5,_0x3f3fda,_0x29cf20){var _0x4ec573=this;return function(){var _0x1055a4=![];return _0x4ec573[_0x7285('0x93')](_0x63fb5d['Intervals'],_0x38cde5,_0x3f3fda,_0x29cf20,_0x1055a4);};};Dialer['prototype']['ifTimeIvr']=function(_0x12dc86,_0x237e18,_0x58cd1f,_0x3ed9ce,_0x1aff1f){var _0x2a18de=[];return new Promise(function(_0x40114c,_0x7f1309){if(!isNotNull(_0x12dc86)){_0x3ed9ce[_0x7285('0x6d')]=utils['CAMPAIGN_STATUS'][_0x7285('0x7c')];return _0x7f1309(msgResponse(_0x7285('0x95'),_0x7285('0x96'),_0x58cd1f+_0x7285('0x97')));}if(_['isEmpty'](_0x12dc86)){_0x3ed9ce[_0x7285('0x6d')]=utils[_0x7285('0x6e')]['EMPTY_INTERVAL'];return _0x7f1309(msgResponse(_0x7285('0x95'),_0x7285('0x96'),_0x58cd1f+'\x20Intervals\x20is\x20empty\x20'));}if(_0x237e18&&_[_0x7285('0x43')](config[_0x7285('0x98')][_0x237e18])){_0x3ed9ce[_0x7285('0x6d')]=utils[_0x7285('0x6e')]['UNKNOWN_TIMEZONE'];return _0x7f1309(msgResponse(_0x7285('0x95'),_0x7285('0x96'),_0x58cd1f+_0x7285('0x99')+_0x237e18));}if(_[_0x7285('0x9a')](_0x12dc86)){for(var _0x1e46ab=0x0;_0x1e46ab<_0x12dc86[_0x7285('0x9b')];_0x1e46ab+=0x1){_0x2a18de['push'](ami[_0x7285('0x9c')]({'action':'command','command':util[_0x7285('0x48')]('iftime\x20%s,%s',_0x12dc86[_0x1e46ab][_0x7285('0x9d')],!_[_0x7285('0x43')](config['timezones'][_0x237e18])?_0x237e18:'')})[_0x7285('0x41')](function(_0x28e0f6){return _0x28e0f6['content']['indexOf'](_0x7285('0x9e'))>=0x0;})[_0x7285('0x9f')](myreject(_0x7f1309)));}}else{_0x2a18de['push'](ami[_0x7285('0x9c')]({'action':'command','command':util[_0x7285('0x48')](_0x7285('0xa0'),_0x12dc86,!_[_0x7285('0x43')](config[_0x7285('0x98')][_0x237e18])?_0x237e18:'')})['then'](function(_0x216d7e){return _0x216d7e[_0x7285('0xa1')][_0x7285('0xa2')]('true')>=0x0;})[_0x7285('0x9f')](myreject(_0x7f1309)));}Promise[_0x7285('0xa3')](_0x2a18de)[_0x7285('0x41')](function(_0x1ffe66){var _0x1bedc0=_[_0x7285('0xa4')](_0x1ffe66);if(_0x1bedc0){return _0x40114c(_0x1bedc0);}else{_0x3ed9ce['message']=_0x1aff1f?utils['CAMPAIGN_STATUS'][_0x7285('0xa5')]:utils[_0x7285('0x6e')][_0x7285('0xa6')];return _0x7f1309(msgResponse(_0x7285('0xa7'),'Failure',_0x7285('0xa8')+_0x1aff1f+'\x20'+_0x58cd1f+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x12dc86,{'showHidden':![],'depth':null})+_0x7285('0xa9')+_0x237e18));}})[_0x7285('0x9f')](function(_0x56913d){return _0x7f1309(msgResponse(_0x7285('0x95'),_0x7285('0x96'),JSON[_0x7285('0x79')](_0x56913d)));});});};Dialer[_0x7285('0x88')][_0x7285('0x3e')]=function(){var _0x1c26e1=this;return cmHopper[_0x7285('0xaa')]({'active':![]},{'where':{'active':!![]}})[_0x7285('0x41')](function(){setInterval(function(){_0x1c26e1['syncCampaigns']();},0x3e8);});};Dialer[_0x7285('0x88')][_0x7285('0xab')]=function(){var _0x3ab9d9=this;var _0x4e1900;for(var _0x3947b9 in this[_0x7285('0x1f')]){if(typeof this[_0x7285('0x1f')][_0x3947b9]!==_0x7285('0xac')){_0x4e1900=this[_0x7285('0x1f')][_0x3947b9];if(utils['isIVRCampaign'](_0x4e1900)&&utils[_0x7285('0xad')](_0x4e1900)){_0x4e1900[_0x7285('0x82')]=!![];Promise[_0x7285('0xae')]()[_0x7285('0x41')](checkIsIVRCampaignActive(_0x4e1900))[_0x7285('0x41')](checkInterval(_0x4e1900))[_0x7285('0x41')](_0x3ab9d9['checkIsTrunkReachable'](_0x4e1900))['then'](_0x3ab9d9[_0x7285('0x92')](_0x4e1900[_0x7285('0xaf')],_0x4e1900[_0x7285('0xb0')],_0x4e1900[_0x7285('0x4a')],_0x4e1900))[_0x7285('0x41')](_0x3ab9d9[_0x7285('0x94')](_0x4e1900[_0x7285('0x7b')],_0x4e1900[_0x7285('0xb0')],_0x4e1900[_0x7285('0x4a')],_0x4e1900))['then'](_0x3ab9d9[_0x7285('0xb1')](_0x4e1900))[_0x7285('0x9f')](loggerCatchQueueSummary('[syncCampaigns]',_0x4e1900));}else{notSendMessagesCampaign(_0x4e1900);}}}};Dialer[_0x7285('0x88')][_0x7285('0xb2')]=function(_0x48beb8){if(_0x48beb8[_0x7285('0xb3')]!=='predictive'){clearPredictiveAttributes(_0x48beb8);}switch(_0x48beb8[_0x7285('0xb3')]){case _0x7285('0xb4'):this['handlePower'](_0x48beb8,0x1);break;case _0x7285('0xb5'):this[_0x7285('0xb6')](_0x48beb8,_0x48beb8[_0x7285('0xb7')]);break;case _0x7285('0xb8'):this[_0x7285('0xb8')](_0x48beb8);break;case'booked':this[_0x7285('0xb6')](_0x48beb8,0x1);break;default:logger[_0x7285('0x68')]('Queue',_0x48beb8['name'],_0x7285('0xb9'));}};Dialer[_0x7285('0x88')]['ifTime']=function(_0x289e45,_0x1a0e9c){var _0x1e3070=_0x289e45[_0x7285('0xb0')];var _0x5bed27=_0x1a0e9c?_0x289e45['dialGlobalInterval']:_0x289e45[_0x7285('0x7b')][_0x7285('0x7e')];logger[_0x7285('0xba')](_0x7285('0xbb'),_0x5bed27,_0x1e3070,_0x289e45[_0x7285('0x4a')],util[_0x7285('0x48')]('Voice\x20Queue\x20%s\x20$s',_0x289e45['name'],_0x289e45['id']));var _0x5d18ac=null;return Interval[_0x7285('0xbc')](_0x5bed27,_0x1e3070)[_0x7285('0x41')](function(_0x2a1bb0){if(_0x2a1bb0===!![]){return _0x2a1bb0;}else{_0x289e45['message']=_0x1a0e9c?utils[_0x7285('0x6e')][_0x7285('0xa5')]:utils[_0x7285('0x6e')]['OVERTIME_INTERVAL'];_0x5d18ac=msgResponse(_0x7285('0xa7'),'Failure','Global:\x20'+_0x1a0e9c+'\x20'+_0x289e45[_0x7285('0x4a')]+_0x7285('0xbd')+util[_0x7285('0x6a')](_0x5bed27,{'showHidden':![],'depth':null})+_0x7285('0xa9')+_0x1e3070);}if(_0x5d18ac!==null){logger[_0x7285('0xba')](_0x7285('0xbe'),_0x5d18ac);_0x5d18ac[_0x7285('0xbf')]=_0x1a0e9c;throw _0x5d18ac;}})[_0x7285('0x9f')](function(_0x3f3824){logger[_0x7285('0x68')](_0x7285('0xc0'),_0x3f3824);throw msgResponse(_0x7285('0x87'),'Error',util['inspect'](_0x3f3824,{'showHidden':![],'depth':null}));});};Dialer[_0x7285('0x88')][_0x7285('0x2e')]=function(_0x395e96){if(this[_0x7285('0x1e')][_0x395e96[_0x7285('0xc1')]]){if(this[_0x7285('0x26')][_0x395e96[_0x7285('0xc2')]]&&this[_0x7285('0x26')][_0x395e96[_0x7285('0xc2')]][_0x7285('0xc3')]!==_0x7285('0xc4')){this[_0x7285('0xc5')](this[_0x7285('0x1e')][_0x395e96['queue']]);this['uniqueId'][_0x395e96['uniqueid']][_0x7285('0xc6')]=moment()[_0x7285('0x48')](_0x7285('0xc7'));}}};Dialer[_0x7285('0x88')]['syncAgentComplete']=function(_0x2bd778){var _0x413285=this[_0x7285('0x26')][_0x2bd778[_0x7285('0xc2')]];if(this[_0x7285('0x1e')][_0x2bd778[_0x7285('0xc1')]]){if(_0x413285&&_0x413285['type']!==_0x7285('0xc4')){delete this['uniqueId'][_0x2bd778[_0x7285('0xc2')]];this[_0x7285('0x1e')][_0x2bd778[_0x7285('0xc1')]]['outboundAnswerCallsDay']+=0x1;var _0xde1e4=new AgentComplete(_0x413285,_0x2bd778);if(_0x2bd778[_0x7285('0xc8')]===_0x7285('0xc9')){_0xde1e4[_0x7285('0xca')]=this[_0x7285('0x1e')][_0x2bd778['queue']]['dialQueueProject2']&&this[_0x7285('0x1e')][_0x2bd778[_0x7285('0xc1')]]['dialAgiAfterHangupAgent']?moment()[_0x7285('0x48')](_0x7285('0xc7')):undefined;}hopperUtils[_0x7285('0xcb')](_0xde1e4)[_0x7285('0x9f')](loggerCatch(_0x7285('0xcc')));hopperUtils['moveContactManagedDialer'](_0xde1e4)[_0x7285('0x9f')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x7285('0x88')]['syncQueueCallerAbandon']=function(_0x4220ad){var _0x3bcf74=this[_0x7285('0x26')][_0x4220ad['uniqueid']];var _0x1ad551=this;var _0xe3e415=![];var _0x278a54;var _0x6f0a2c;if(this['voiceQueues'][_0x4220ad[_0x7285('0xc1')]]){if(_0x3bcf74&&_0x3bcf74[_0x7285('0xc3')]!==_0x7285('0xc4')){delete this[_0x7285('0x26')][_0x4220ad[_0x7285('0xc2')]];this['updateOriginated'](this[_0x7285('0x1e')][_0x4220ad[_0x7285('0xc1')]]);_0x3bcf74[_0x7285('0xcd')]=moment()[_0x7285('0x48')](_0x7285('0xc7'));var _0x1eba9d=new QueueCallerAbandon(_0x3bcf74,_0x4220ad);if(utils[_0x7285('0x63')](_0x3bcf74['droptime'],_0x3bcf74['responsetime'])>=_0x3bcf74[_0x7285('0xce')]){this[_0x7285('0x1e')][_0x4220ad[_0x7285('0xc1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x7285('0x1e')][_0x4220ad[_0x7285('0xc1')]][_0x7285('0xcf')]+=0x1;this[_0x7285('0x1e')][_0x4220ad[_0x7285('0xc1')]][_0x7285('0xd0')]+=0x1;_0x1eba9d[_0x7285('0x73')]=0xa;_0x1eba9d['statedesc']=_0x7285('0xd1');_0x1eba9d['dropreason']=_0x7285('0xd2');_0x1eba9d[_0x7285('0xca')]=this['voiceQueues'][_0x4220ad[_0x7285('0xc1')]][_0x7285('0xd3')]?moment()['format'](_0x7285('0xc7')):undefined;_0x1eba9d[_0x7285('0xd4')]+=0x1;_0x1eba9d[_0x7285('0xd5')]+=0x1;_0x278a54=this['voiceQueues'][_0x4220ad[_0x7285('0xc1')]][_0x7285('0xd6')];_0x6f0a2c=this[_0x7285('0x1e')][_0x4220ad[_0x7285('0xc1')]][_0x7285('0xd7')];hopperUtils[_0x7285('0xd8')](_0x1eba9d,_0x1eba9d['state'],_0x3bcf74[_0x7285('0xd9')])[_0x7285('0x41')](function(_0x46c86f){_0xe3e415=_0x46c86f[_0x7285('0xda')]==0x1;if(_0x1eba9d[_0x7285('0xd4')]>=_0x1ad551[_0x7285('0x1e')][_0x4220ad[_0x7285('0xc1')]]['dialDropMaxRetry']){_0x1ad551['queueCallerAbandonCreateState'](_0x1eba9d,_0x46c86f['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1eba9d['countdropretry'],'scheduledat':moment()['add'](_0x1ad551[_0x7285('0x1e')][_0x4220ad['queue']]['dialDropRetryFrequency'],'minutes')[_0x7285('0x48')](_0x7285('0xc7')),'ContactId':_0x3bcf74[_0x7285('0xdb')],'ListId':_0x3bcf74[_0x7285('0xdc')],'VoiceQueueId':_0x3bcf74[_0x7285('0xdd')]||undefined,'CampaignId':_0x3bcf74[_0x7285('0xde')]||undefined})[_0x7285('0x9f')](loggerCatch(_0x7285('0xdf')));var _0x1aeb32=new History(_0x1eba9d);_0x1aeb32[_0x7285('0x73')]=0xa;_0x1aeb32[_0x7285('0x74')]=_0x7285('0xd1');_0x1aeb32[_0x7285('0x75')]=moment()[_0x7285('0x48')](_0x7285('0xc7'));_0x1aeb32[_0x7285('0xe0')]=_0x1aeb32[_0x7285('0x75')];_0x1aeb32['calleridname']=_0x1eba9d[_0x7285('0xe1')];_0x1aeb32[_0x7285('0xe2')]=_0x1eba9d[_0x7285('0xe2')];hopperUtils[_0x7285('0xcb')](_0x1aeb32)[_0x7285('0x9f')](loggerCatch(_0x7285('0xe3')));}})[_0x7285('0x41')](function(){if(_0xe3e415)hopperUtils[_0x7285('0xe4')](_0x1eba9d,_0x278a54,_0x6f0a2c)[_0x7285('0x41')](function(){return 0x1;});});}else{this[_0x7285('0x1e')][_0x4220ad['queue']][_0x7285('0x54')]+=0x1;this[_0x7285('0x1e')][_0x4220ad[_0x7285('0xc1')]]['outboundDropCallsDayCallersExit']+=0x1;_0x1eba9d[_0x7285('0x73')]=0xb;_0x1eba9d['statedesc']=_0x7285('0xe5');_0x1eba9d[_0x7285('0xe6')]='CALLEREXIT';_0x1eba9d[_0x7285('0xe7')]+=0x1;_0x1eba9d[_0x7285('0xd5')]+=0x1;_0x278a54=this['voiceQueues'][_0x4220ad['queue']][_0x7285('0xe8')];_0x6f0a2c=this['voiceQueues'][_0x4220ad[_0x7285('0xc1')]][_0x7285('0xd7')];hopperUtils[_0x7285('0xd8')](_0x1eba9d,_0x1eba9d[_0x7285('0x73')],_0x3bcf74[_0x7285('0xd9')])[_0x7285('0x41')](function(_0x6488e8){if(_0x1eba9d[_0x7285('0xe7')]>=_0x1ad551['voiceQueues'][_0x4220ad[_0x7285('0xc1')]][_0x7285('0xe9')]){_0x1ad551['queueCallerAbandonCreateState'](_0x1eba9d,_0x6488e8[_0x7285('0xda')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1eba9d['countabandonedretry'],'scheduledat':moment()[_0x7285('0xea')](_0x1ad551[_0x7285('0x1e')][_0x4220ad[_0x7285('0xc1')]][_0x7285('0xe8')],_0x7285('0xeb'))['format'](_0x7285('0xc7')),'ContactId':_0x3bcf74[_0x7285('0xdb')],'ListId':_0x3bcf74[_0x7285('0xdc')],'VoiceQueueId':_0x3bcf74['VoiceQueueId']||undefined,'CampaignId':_0x3bcf74[_0x7285('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0xd96e12=new History(_0x1eba9d);_0xd96e12[_0x7285('0x73')]=0xb;_0xd96e12[_0x7285('0x74')]='Abandoned';_0xd96e12['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd96e12[_0x7285('0xe0')]=_0xd96e12[_0x7285('0x75')];_0xd96e12[_0x7285('0xe1')]=_0x1eba9d[_0x7285('0xe1')];_0xd96e12[_0x7285('0xe2')]=_0x1eba9d[_0x7285('0xe2')];hopperUtils[_0x7285('0xcb')](_0xd96e12)[_0x7285('0x9f')](loggerCatch(_0x7285('0xec')));}})['then'](function(){if(_0xe3e415)hopperUtils['swapAdditionalPhones'](_0x1eba9d,_0x278a54,_0x6f0a2c)[_0x7285('0x41')](function(){return 0x1;});});}}}};Dialer[_0x7285('0x88')][_0x7285('0x38')]=function(_0x312485){if(this[_0x7285('0x24')][_0x312485[_0x7285('0xc2')]]){this[_0x7285('0x24')][_0x312485['uniqueid']][_0x7285('0xed')]=_0x312485[_0x7285('0xed')];}if(this[_0x7285('0x26')][_0x312485[_0x7285('0xc2')]]){this[_0x7285('0x26')][_0x312485[_0x7285('0xc2')]]['channel']=_0x312485[_0x7285('0xed')];}};Dialer[_0x7285('0x88')][_0x7285('0xee')]=function(_0x470895){if(!this[_0x7285('0x24')][_0x470895[_0x7285('0xef')]]){return;}var _0x3bb1ae=this[_0x7285('0x1e')][this['actions'][_0x470895[_0x7285('0xef')]][_0x7285('0xc1')]][_0x7285('0xf0')]||_0x7285('0xf1');if(_0x3bb1ae===_0x7285('0xf2')){if(this[_0x7285('0x24')][_0x470895[_0x7285('0xef')]]&&_['isNil'](this[_0x7285('0x24')][_0x470895[_0x7285('0xef')]][_0x7285('0xf3')])&&_0x470895[_0x7285('0x8d')]==='1'&&_0x470895[_0x7285('0xf4')]==='0'){if(this[_0x7285('0x20')][_0x470895[_0x7285('0xf5')]]){if(!this['agents'][_0x470895[_0x7285('0xf5')]][_0x7285('0xf3')]){this[_0x7285('0x20')][_0x470895[_0x7285('0xf5')]][_0x7285('0xf3')]=!![];this[_0x7285('0x24')][_0x470895[_0x7285('0xef')]][_0x7285('0xf3')]=!![];this[_0x7285('0x24')][_0x470895['actionid']]['stateinterface']=_0x470895[_0x7285('0xf5')];}}}}else if(_0x3bb1ae===_0x7285('0xf1')){if(this['actions'][_0x470895[_0x7285('0xef')]]){if(this['agents'][_0x470895[_0x7285('0xf5')]]){this['actions'][_0x470895[_0x7285('0xef')]]['stateinterface']=_0x470895[_0x7285('0xf5')];if(_[_0x7285('0xf6')](this[_0x7285('0x2a')][this[_0x7285('0x24')][_0x470895[_0x7285('0xef')]][_0x7285('0xc1')]])){this[_0x7285('0x2a')][this[_0x7285('0x24')][_0x470895[_0x7285('0xef')]][_0x7285('0xc1')]]=[];}this[_0x7285('0x2a')][this['actions'][_0x470895['actionid']]['queue']][_0x7285('0xf7')](_[_0x7285('0x62')](_[_0x7285('0x7a')](this[_0x7285('0x24')][_0x470895[_0x7285('0xef')]],['idHopper',_0x7285('0xf5')]),{'status':_0x470895[_0x7285('0x8d')],'paused':_0x470895[_0x7285('0xf4')]}));}}}};Dialer[_0x7285('0x88')][_0x7285('0x3d')]=function(_0x25bb1a){if(!this['actions'][_0x25bb1a[_0x7285('0xef')]]){return;}var _0x33d338=this;var _0x4f1fad=this[_0x7285('0x1e')][this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xc1')]];var _0x34b3c4=_0x4f1fad[_0x7285('0xf0')]||'rrmemory';if(_0x34b3c4===_0x7285('0xf2')){if(this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]]&&this[_0x7285('0x24')][_0x25bb1a['actionid']][_0x7285('0xf5')]){this['preview']['run'](this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xf8')],this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xf5')])[_0x7285('0x9f')](function(_0x30d28f){logger['error'](_0x7285('0xf9'),util[_0x7285('0x6a')](_0x30d28f,{'showHidden':![],'depth':null}));})[_0x7285('0x1d')](function(){_0x33d338[_0x7285('0xc5')](_0x33d338[_0x7285('0x1e')][_0x33d338['actions'][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xc1')]]);_0x33d338[_0x7285('0x20')][_0x33d338['actions'][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xf5')]]['locked']=![];delete _0x33d338[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]];unlockQueueStatus(_0x4f1fad);});}else{this[_0x7285('0xc5')](this[_0x7285('0x1e')][this['actions'][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xc1')]]);hopperUtils[_0x7285('0xfa')]({'active':![],'ContactId':this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xdb')],'ListId':this['actions'][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xdc')],'VoiceQueueId':this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xdd')]||undefined,'CampaignId':this['actions'][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xde')]||undefined})['catch'](loggerCatch(_0x7285('0xfb')));delete this['actions'][_0x25bb1a[_0x7285('0xef')]];unlockQueueStatus(_0x4f1fad);}}else if(_0x34b3c4==='rrmemory'){var _0x17a8e8;if(this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xc1')]])){if(this[_0x7285('0x2b')][_0x33d338[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xc1')]]){this[_0x7285('0x2b')][_0x33d338[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]]['queue']]=this[_0x7285('0x2b')][this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]]['queue']]?this['queueBookedRR'][this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xc1')]]:this[_0x7285('0x2a')][this[_0x7285('0x24')][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xc1')]]?this[_0x7285('0x2a')][this[_0x7285('0x24')][_0x25bb1a['actionid']][_0x7285('0xc1')]][_0x7285('0xfc')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xc1')]]['_rr']=this[_0x7285('0x2b')][this['actions'][_0x25bb1a[_0x7285('0xef')]][_0x7285('0xc1')]];for(var _0x188c08=0x0;_0x188c08=_0x1edba1[_0x7285('0x11e')]){_0x282d7d[_0x7285('0x11f')](_0x25008c,_0x3f0c5e,_0x2ef89a,_0x7285('0x120'));}else{if(_0x25008c['countmachineretry']>=_0x1edba1[_0x7285('0x121')]){_0x282d7d[_0x7285('0x122')](_0x25008c,_0x3f0c5e,_0x2ef89a,_0x7285('0x123'));}else{hopperUtils[_0x7285('0xfa')]({'active':![],'countmachineretry':_0x25008c['countmachineretry'],'scheduledat':moment()[_0x7285('0xea')](_0x1edba1[_0x7285('0x124')],_0x7285('0xeb'))['format'](_0x7285('0xc7')),'ContactId':_0x25008c['ContactId'],'ListId':_0x25008c[_0x7285('0xdc')],'VoiceQueueId':_0x25008c['VoiceQueueId']||undefined,'CampaignId':_0x25008c[_0x7285('0xde')]||undefined})[_0x7285('0x9f')](loggerCatch(_0x7285('0x125')));_0x3f0c5e({'reschedule':0x1});}}});}if(_0x4a6a96[_0x7285('0xc3')]===_0x7285('0xc4')&&this[_0x7285('0x1f')][_0x4a6a96[_0x7285('0xc1')]][_0x7285('0x10d')]&&_0x45a6bf[_0x7285('0x10e')]===_0x7285('0x126')){delete this['uniqueId'][_0x45a6bf['uniqueid']];this[_0x7285('0xc5')](this[_0x7285('0x1f')][_0x4a6a96[_0x7285('0xc1')]]);_0x2cdc18=new Hangup(_0x4a6a96,_0x45a6bf);_0x2cdc18['state']=0x12;_0x2cdc18[_0x7285('0x74')]=_0x7285('0x111');_0x2cdc18[_0x7285('0x112')]=_0x7285('0x113');ami[_0x7285('0x44')]('custom:amd',ut[_0x7285('0x115')](_0x2cdc18,_0x7285('0x118')));this[_0x7285('0x116')](_0x2cdc18,'[syncHangupInAMDIvr][createHistory]',_0x7285('0x127'));}if(_0x4a6a96[_0x7285('0xc3')]==='ivr'&&this[_0x7285('0x1f')][_0x4a6a96[_0x7285('0xc1')]][_0x7285('0x10d')]&&_0x45a6bf[_0x7285('0x10e')]===_0x7285('0x128')){return new Promise(function(_0x3cb9bc,_0x1bc1a2){delete _0x282d7d[_0x7285('0x26')][_0x45a6bf[_0x7285('0xc2')]];_0x282d7d[_0x7285('0xc5')](_0x282d7d[_0x7285('0x1f')][_0x4a6a96[_0x7285('0xc1')]]);_0x282d7d[_0x7285('0x1f')][_0x4a6a96[_0x7285('0xc1')]][_0x7285('0x10f')]+=0x1;_0x282d7d[_0x7285('0x1f')][_0x4a6a96[_0x7285('0xc1')]][_0x7285('0x110')]+=0x1;var _0x11a2f8=_0x282d7d[_0x7285('0x1f')][_0x4a6a96[_0x7285('0xc1')]];var _0x458fce=new Hangup(_0x4a6a96,_0x45a6bf);_0x458fce[_0x7285('0x73')]=0x13;_0x458fce[_0x7285('0x74')]='Machine';_0x458fce[_0x7285('0x112')]=_0x7285('0x113');_0x458fce['countmachineretry']+=0x1;_0x458fce[_0x7285('0xd5')]+=0x1;_0x458fce[_0x7285('0x118')]=!![];ami['emit'](_0x7285('0x114'),ut[_0x7285('0x115')](_0x458fce,_0x7285('0x118')));hopperUtils[_0x7285('0xcb')](_0x458fce)[_0x7285('0x9f')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x458fce[_0x7285('0x11a')]+_0x458fce[_0x7285('0x11b')]+_0x458fce[_0x7285('0x129')]+_0x458fce[_0x7285('0x11c')]+_0x458fce['countdropretry']+_0x458fce[_0x7285('0xe7')]+_0x458fce[_0x7285('0x117')]+_0x458fce['countagentrejectretry']>=_0x11a2f8[_0x7285('0x11e')]){_0x282d7d[_0x7285('0x11f')](_0x458fce,_0x3cb9bc,_0x1bc1a2,_0x7285('0x120'));}else{if(_0x458fce['countmachineretry']>=_0x11a2f8[_0x7285('0x121')]){_0x282d7d[_0x7285('0x122')](_0x458fce,_0x3cb9bc,_0x1bc1a2,_0x7285('0x123'));}else{hopperUtils[_0x7285('0xfa')]({'active':![],'countmachineretry':_0x458fce[_0x7285('0x117')],'scheduledat':moment()[_0x7285('0xea')](_0x11a2f8['dialMachineRetryFrequency'],_0x7285('0xeb'))[_0x7285('0x48')](_0x7285('0xc7')),'ContactId':_0x458fce[_0x7285('0xdb')],'ListId':_0x458fce[_0x7285('0xdc')],'VoiceQueueId':_0x458fce[_0x7285('0xdd')]||undefined,'CampaignId':_0x458fce[_0x7285('0xde')]||undefined})[_0x7285('0x9f')](loggerCatch(_0x7285('0x125')));_0x3cb9bc({'reschedule':0x1});}}});}}};Dialer[_0x7285('0x88')][_0x7285('0x36')]=function(_0x4a457a){var _0x247270=this[_0x7285('0x26')][_0x4a457a['uniqueid']];var _0x3d242b;if(_0x247270&&_0x247270['type']==='ivr'){delete this['uniqueId'][_0x4a457a['uniqueid']];this['updateOriginated'](this[_0x7285('0x1f')][_0x247270[_0x7285('0xc1')]]);this[_0x7285('0x1f')][_0x247270[_0x7285('0xc1')]][_0x7285('0x12a')]+=0x1;_0x3d242b=new Hangup(_0x247270,_0x4a457a);hopperUtils['createHistory'](_0x3d242b)[_0x7285('0x9f')](loggerCatch(_0x7285('0x12b')));hopperUtils['moveContactManagedDialer'](_0x3d242b)[_0x7285('0x9f')](loggerCatch(_0x7285('0x12c')));}if(_0x247270&&_0x247270[_0x7285('0xc3')]!==_0x7285('0xc4')&&isNotNull(this[_0x7285('0x1e')][_0x247270[_0x7285('0xc1')]][_0x7285('0x12d')])){delete this[_0x7285('0x26')][_0x4a457a['uniqueid']];this[_0x7285('0xc5')](this[_0x7285('0x1e')][_0x247270[_0x7285('0xc1')]]);this[_0x7285('0x1e')][_0x247270['queue']][_0x7285('0x10f')]+=0x1;this[_0x7285('0x1e')][_0x247270['queue']][_0x7285('0x110')]+=0x1;_0x3d242b=new Hangup(_0x247270,_0x4a457a);_0x3d242b['state']=0x10;_0x3d242b[_0x7285('0x74')]=_0x7285('0x12e');_0x3d242b[_0x7285('0x112')]=_0x7285('0x12f');hopperUtils[_0x7285('0xcb')](_0x3d242b)[_0x7285('0x9f')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7285('0x130')](_0x3d242b)[_0x7285('0x9f')](loggerCatch(_0x7285('0x12c')));}if(_0x247270&&_0x247270[_0x7285('0xc3')]!==_0x7285('0xc4')&&!isNotNull(this[_0x7285('0x1e')][_0x247270[_0x7285('0xc1')]][_0x7285('0x12d')])){delete this[_0x7285('0x26')][_0x4a457a[_0x7285('0xc2')]];this[_0x7285('0xc5')](this[_0x7285('0x1e')][_0x247270[_0x7285('0xc1')]]);this[_0x7285('0x1e')][_0x247270[_0x7285('0xc1')]]['outboundUnknownCallsDay']+=0x1;_0x3d242b=new Hangup(_0x247270,_0x4a457a);_0x3d242b[_0x7285('0x73')]=0xc;_0x3d242b['statedesc']=_0x4a457a[_0x7285('0x131')];_0x3d242b[_0x7285('0x112')]=_0x7285('0x132');hopperUtils[_0x7285('0xcb')](_0x3d242b)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7285('0x130')](_0x3d242b)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x7285('0x88')][_0x7285('0xb')]=function(_0x46de03){var _0x3147f7=this;if(!_0x3147f7[_0x7285('0x2c')][_0x46de03[_0x7285('0x4a')]]){_0x3147f7[_0x7285('0x2c')][_0x46de03['name']]={'running':![]};}else if(_0x3147f7['queuesSummary'][_0x46de03['name']][_0x7285('0x133')]===!![]){return;}else if(_0x3147f7[_0x7285('0x2c')][_0x46de03[_0x7285('0x4a')]][_0x7285('0x133')]===![]){_0x3147f7[_0x7285('0x2c')][_0x46de03[_0x7285('0x4a')]][_0x7285('0x133')]=!![];}var _0x52b026=_0x3147f7[_0x7285('0x1e')][_0x46de03['name']];var _0x24cd1c=_0x52b026[_0x7285('0x6d')]!==utils[_0x7285('0x6e')][_0x7285('0x7f')];var _0x2ee612=utils[_0x7285('0x134')](_0x52b026);_0x52b026[_0x7285('0x135')]=utils[_0x7285('0x136')](_0x52b026,_0x3147f7['trunks']);Promise['resolve']()[_0x7285('0x41')](function(){if(_0x52b026[_0x7285('0x135')]===utils[_0x7285('0x6e')][_0x7285('0x7f')]){if(_0x24cd1c){clearPredictiveAttributes(_0x52b026);_0x46de03['startPredictive']=undefined;_0x46de03[_0x7285('0x29')]=undefined;}if(_0x52b026[_0x7285('0x135')]===utils[_0x7285('0x6e')][_0x7285('0x7f')]){_0x46de03['available']=0x0;_0x46de03['paused']=0x0;_0x46de03[_0x7285('0x137')]=0x0;_0x46de03['talking']=0x0;_0x46de03[_0x7285('0x138')]=0x0;}}else if(_0x52b026[_0x7285('0x135')]===utils[_0x7285('0x6e')][_0x7285('0x139')]&&!_0x2ee612){return _0x3147f7['ifTime'](_0x52b026,!![])[_0x7285('0x41')](function(){return _0x3147f7[_0x7285('0x95')](_0x52b026,![]);})[_0x7285('0x41')](function(){return _0x3147f7['checkDialMethod'](_0x52b026);})[_0x7285('0x9f')](function(_0x15a7ac){loggerSyncQueueSummary[_0x7285('0x46')](_0x7285('0x13a'),util[_0x7285('0x6a')](_0x15a7ac,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x52b026);});}else{clearPredictiveAttributes(_0x52b026);}})['then'](function(){var _0x5692a7=_0x46de03[_0x7285('0x13b')](_0x52b026);if(_0x5692a7||_0x52b026[_0x7285('0x13c')]){_0x52b026[_0x7285('0x13c')]=![];_0x46de03[_0x7285('0x13d')](_0x52b026);Object[_0x7285('0x13e')](_0x52b026,_0x46de03);emitOutboundVoiceQueueSummary(_0x46de03);}_0x3147f7[_0x7285('0x2c')][_0x52b026[_0x7285('0x4a')]][_0x7285('0x133')]=![];})[_0x7285('0x9f')](function(_0x5431fd){logger[_0x7285('0x68')](_0x7285('0x13a'),util[_0x7285('0x6a')](_0x5431fd,{'showHidden':![],'depth':null}));_0x3147f7[_0x7285('0x2c')][_0x52b026[_0x7285('0x4a')]][_0x7285('0x133')]=![];});};Dialer[_0x7285('0x88')][_0x7285('0x35')]=_['throttle'](function(){var _0x20c82e=_[_0x7285('0x13f')](this['voiceQueues'],function(_0x1a2cf5){return _0x1a2cf5[_0x7285('0x140')];});var _0x13f4cb=_[_0x7285('0x13f')](this[_0x7285('0x20')],function(_0x34ada1){return _0x34ada1[_0x7285('0x141')]&&_0x34ada1[_0x7285('0x8d')]===_0x7285('0x8c');});if(_0x20c82e[_0x7285('0x9b')]>0x0&&_0x13f4cb[_0x7285('0x9b')]>0x0){return Promise['resolve']()[_0x7285('0x41')](cmHopper['handlePreviewRecallNotifications'](_[_0x7285('0x142')](_0x20c82e,'id'),previewRecallmeReminderInterval,_['map'](_0x13f4cb,'id')))[_0x7285('0x41')](function(_0x3630ff){for(var _0x197d85=0x0;_0x197d85<_0x3630ff[_0x7285('0x9b')];_0x197d85++){var _0x5674dc=_0x3630ff[_0x197d85][_0x7285('0x143')][_0x7285('0x4a')];if(_0x5674dc)io['to'](util['format'](_0x7285('0x144'),_0x5674dc))[_0x7285('0x44')](_0x7285('0x145'),{'hopper':_0x3630ff[_0x197d85]});}})[_0x7285('0x9f')](function(_0x4990d3){logger[_0x7285('0x68')](_0x7285('0x146'),_0x4990d3);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7285('0x88')][_0x7285('0x3f')]=function(){var _0x1d0bb8=this;setInterval(function(){_0x1d0bb8[_0x7285('0x147')](_0x1d0bb8['uniqueId'],'[uniqueid]');_0x1d0bb8[_0x7285('0x147')](_0x1d0bb8[_0x7285('0x24')],'[actions]');},0x32c8);};Dialer['prototype'][_0x7285('0x147')]=function(_0x4c8e94,_0x1c2151){var _0xff4c08=this;for(var _0x1e8e49 in _0x4c8e94){if(typeof _0x4c8e94[_0x1e8e49]!==_0x7285('0xac')){this['sequence'][_0x7285('0x1b')](function(){if(!_['isNil'](_0x4c8e94[_0x1e8e49])){return ami[_0x7285('0x9c')]({'action':'status','channel':_0x4c8e94[_0x1e8e49][_0x7285('0xed')]})[_0x7285('0x9f')](function(_0x4be600){if(_0x4be600[_0x7285('0x6d')]===_0x7285('0x148')){setTimeout(function(){if(_0x4c8e94[_0x1e8e49]&&_0x4c8e94[_0x1e8e49][_0x7285('0xc3')]!=='ivr'){_0xff4c08['updateOriginated'](_0xff4c08[_0x7285('0x1e')][_0x4c8e94[_0x1e8e49][_0x7285('0xc1')]]);logger[_0x7285('0x68')](_0x7285('0x149'),_0x1c2151,_0x1e8e49,_0x4c8e94[_0x1e8e49][_0x7285('0xc1')]);delete _0x4c8e94[_0x1e8e49];}if(_0x4c8e94[_0x1e8e49]&&_0x4c8e94[_0x1e8e49]['type']===_0x7285('0xc4')){_0xff4c08[_0x7285('0xc5')](_0xff4c08[_0x7285('0x1f')][_0x4c8e94[_0x1e8e49][_0x7285('0xc1')]]);logger[_0x7285('0x68')](_0x7285('0x14a'),_0x1c2151,_0x1e8e49,_0x4c8e94[_0x1e8e49]['queue']);delete _0x4c8e94[_0x1e8e49];}},0x2328);}});}});}}};Dialer[_0x7285('0x88')][_0x7285('0x14b')]=function(_0x209d10){return Promise[_0x7285('0xae')]()[_0x7285('0x41')](voiceQueueRt[_0x7285('0x14b')](_0x209d10))['catch'](loggerCatch(_0x7285('0x14c')));};Dialer[_0x7285('0x88')][_0x7285('0xc5')]=function(_0x1ed1e3){if(!_[_0x7285('0x43')](_0x1ed1e3)&&_0x1ed1e3!==null){if(typeof _0x1ed1e3[_0x7285('0x83')]!==_0x7285('0xac')){if(_0x1ed1e3[_0x7285('0x83')]>0x0){_0x1ed1e3[_0x7285('0x83')]-=0x1;}else{logger[_0x7285('0x68')](_0x7285('0x14d'));}}}else{logger[_0x7285('0x68')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x7285('0x88')][_0x7285('0x14e')]=function(_0x489233,_0x9439e8){var _0x3243ea=this;return function(_0x3f60d5){_0x3243ea[_0x7285('0xc5')](_0x9439e8);logger[_0x7285('0x68')](_0x489233,util['inspect'](_0x3f60d5,{'showHidden':![],'depth':null}));};};Dialer[_0x7285('0x88')][_0x7285('0x14f')]=function(_0xdfe34,_0xbdfd46,_0x6665af){var _0x282c82={'state':0x19,'statedesc':_0x7285('0x150')};this[_0x7285('0xc5')](_0xbdfd46);this['saveInDb'](_[_0x7285('0x62')](_0x282c82,_[_0x7285('0x7a')](_0x6665af,[_0x7285('0xdb'),_0x7285('0xdc'),_0x7285('0x151'),_0x7285('0xdd'),_0x7285('0xde')])),_0x7285('0x152'),_0x7285('0x153'));logger[_0x7285('0x68')](_0xdfe34);};Dialer[_0x7285('0x88')]['saveInDb']=function(_0x1fb3e1,_0x249230,_0x5aa7bd){hopperUtils[_0x7285('0xcb')](_0x1fb3e1)[_0x7285('0x9f')](loggerCatch(_0x249230));hopperUtils[_0x7285('0x130')](_0x1fb3e1)[_0x7285('0x9f')](loggerCatch(_0x5aa7bd));};Dialer[_0x7285('0x88')][_0x7285('0x154')]=function(_0x1b3d23,_0x4db7e3){hopperUtils[_0x7285('0xcb')](_0x1b3d23)[_0x7285('0x9f')](loggerCatch(_0x7285('0xcc')));if(_0x4db7e3==0x0){hopperUtils['moveContactManagedDialer'](_0x1b3d23)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x7285('0x88')][_0x7285('0x146')]=function(_0x1d4810){return Promise[_0x7285('0xae')]()[_0x7285('0x41')](cmHopper['handlePreviewRecallNotifications'](_0x1d4810['id'],previewRecallmeReminderInterval))['then'](function(_0x335469){for(var _0x2902c7=0x0;_0x2902c7<_0x335469[_0x7285('0x9b')];_0x2902c7++){var _0xd33d83=_0x335469[_0x2902c7][_0x7285('0x143')][_0x7285('0x4a')];if(_0xd33d83)io['to'](util[_0x7285('0x48')](_0x7285('0x144'),_0xd33d83))['emit'](_0x7285('0x145'),{'hopper':_0x335469[_0x2902c7]});}})[_0x7285('0x9f')](function(){});};Dialer['prototype'][_0x7285('0xb1')]=function(_0x2f37c6){var _0x443bad=this;return function(){_0x443bad['handleIvr'](_0x2f37c6);};};Dialer[_0x7285('0x88')]['actionOriginate']=function(_0x30c54d,_0xd66062){var _0x1b4cb0=this;var _0x199a42=uuid['v4']();this[_0x7285('0x24')][_0x199a42]=new Action(_0x30c54d,_0xd66062,_0x199a42);return new Promise(function(_0x1e20cd,_0x3a1c64){if(_[_0x7285('0x43')](_0x30c54d)&&typeof _0x30c54d!=='object'){return _0x3a1c64(msgResponse(_0x7285('0x155'),_0x7285('0x96'),'voiceQueue\x20is\x20undefine'));}if(_[_0x7285('0x43')](_0xd66062[_0x7285('0x156')])||_0xd66062[_0x7285('0x156')]===null){return _0x3a1c64(msgResponse(_0x7285('0x155'),'Failure',_0x7285('0x157')));}var _0x712754={'XMD-CALLERID':_0x1b4cb0['actions'][_0x199a42][_0x7285('0x158')](),'XMD-AGI':_0x30c54d[_0x7285('0x12d')]?util['format'](_0x7285('0x159'),ipAgi,_0x30c54d[_0x7285('0x12d')]):'NONE','XMD-AGIAFTER':_0x30c54d[_0x7285('0xd3')]?util[_0x7285('0x48')](_0x7285('0x159'),ipAgi,_0x30c54d[_0x7285('0xd3')]):_0x7285('0x15a'),'XMD-QUEUE':utils['isOutboundQueue'](_0x30c54d)?util[_0x7285('0x48')](_0x7285('0x15b'),_0x30c54d[_0x7285('0x4a')],_0x30c54d[_0x7285('0x15c')]||'',_0x30c54d[_0x7285('0x15d')]?'c':'',_0x30c54d['dialQueueTimeout']||0x3):_0x7285('0x15a'),'XMD-CONTACTID':_0xd66062[_0x7285('0xdb')],'XMD-CDRTYPE':_0x7285('0x9'),'CALLERID(all)':_0x1b4cb0[_0x7285('0x24')][_0x199a42][_0x7285('0x158')](),'XMD-AMD':_0x30c54d['dialAMDActive']?_0x7285('0x139'):_0x7285('0x15a'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x30c54d[_0x7285('0x10d')]){_0x712754['XMD-AMDINITIALSILENCE']=_0x30c54d['dialAMDInitialSilence']||0x9c4;_0x712754['XMD-AMDGREETING']=_0x30c54d[_0x7285('0x15e')]||0x5dc;_0x712754[_0x7285('0x15f')]=_0x30c54d[_0x7285('0x160')]||0x320;_0x712754[_0x7285('0x161')]=_0x30c54d[_0x7285('0x162')]||0x1388;_0x712754[_0x7285('0x163')]=_0x30c54d['dialAMDMinWordLength']||0x64;_0x712754[_0x7285('0x164')]=_0x30c54d[_0x7285('0x165')]||0x32;_0x712754[_0x7285('0x166')]=_0x30c54d[_0x7285('0x167')]||0x3;_0x712754[_0x7285('0x168')]=_0x30c54d[_0x7285('0x169')]||0x100;_0x712754[_0x7285('0x16a')]=_0x30c54d['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x7285('0x16b')](_0x30c54d)){_0x712754[_0x7285('0x16c')]=_0xd66062[_0x7285('0xdd')];}else{_0x712754[_0x7285('0x16d')]=_0xd66062[_0x7285('0xde')];}var _0x307eb2=utils[_0x7285('0x16e')](_0xd66062[_0x7285('0x16f')]);Object[_0x7285('0x13e')](_0x712754,_0x307eb2);var _0x2a7b7f=_0x1b4cb0['isTrunkReachable'](_0x30c54d['Trunk'])?utils[_0x7285('0x170')](_0x30c54d[_0x7285('0x90')]['callerid'],_0x30c54d[_0x7285('0x171')],_0x30c54d[_0x7285('0x172')]>0x0?utils['getCallerIdRandom'](_0x30c54d['dialOriginateCallerIdNumber'],_0x30c54d[_0x7285('0x172')]):_0x30c54d[_0x7285('0x173')]):utils[_0x7285('0x170')](_[_0x7285('0xf6')](_0x30c54d[_0x7285('0x91')])?_0x30c54d[_0x7285('0x90')][_0x7285('0x174')]:_0x30c54d[_0x7285('0x91')][_0x7285('0x174')],_0x30c54d[_0x7285('0x171')],_0x30c54d[_0x7285('0x172')]>0x0?utils['getCallerIdRandom'](_0x30c54d['dialOriginateCallerIdNumber'],_0x30c54d[_0x7285('0x172')]):_0x30c54d['dialOriginateCallerIdNumber']);if(_0x2a7b7f){_0x712754[_0x7285('0x175')]=_0x1b4cb0[_0x7285('0x24')][_0x199a42][_0x7285('0x176')]=utils[_0x7285('0x177')](_0x2a7b7f);_0x712754['XMD-ORIGINATECALLERIDNUM']=_0xd66062[_0x7285('0x156')];}_0x30c54d[_0x7285('0x178')]=_0x712754;return ami[_0x7285('0x9c')]({'actionid':_0x199a42,'action':_0x7285('0x155'),'channel':_0x1b4cb0[_0x7285('0x89')](_0x30c54d['Trunk'])?util['format']('SIP/%s/%s%s',_0x30c54d[_0x7285('0x90')][_0x7285('0x4a')],isNotNull(_0x30c54d['dialPrefix'])?_0x30c54d[_0x7285('0x179')][_0x7285('0x17a')]()||'':'',_0x30c54d[_0x7285('0x17b')]>0x0?_0xd66062['phone'][_0x7285('0x17c')](_0x30c54d[_0x7285('0x17b')]):_0xd66062['phone']):util[_0x7285('0x48')](_0x7285('0x17d'),_[_0x7285('0xf6')](_0x30c54d[_0x7285('0x91')])?_0x30c54d[_0x7285('0x90')][_0x7285('0x4a')]:_0x30c54d[_0x7285('0x91')][_0x7285('0x4a')],isNotNull(_0x30c54d[_0x7285('0x179')])?_0x30c54d[_0x7285('0x179')][_0x7285('0x17a')]()||'':'',_0x30c54d[_0x7285('0x17b')]>0x0?_0xd66062[_0x7285('0x156')][_0x7285('0x17c')](_0x30c54d['dialCutDigit']):_0xd66062[_0x7285('0x156')]),'callerid':_0x2a7b7f,'Exten':'xcally-motion-dialer','Context':_0x7285('0x17e'),'Priority':'1','variable':_0x712754,'timeout':(_0x30c54d[_0x7285('0x17f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x199a42})[_0x7285('0x41')](function(_0x53ac14){return _0x1e20cd(_0x53ac14);})['catch'](function(_0x4bc873){_0x30c54d['outboundOriginateFailureCallsDay']+=0x1;var _0x185637=new History(_0x1b4cb0[_0x7285('0x24')][_0x199a42]);logger[_0x7285('0x68')](util[_0x7285('0x48')](_0x7285('0x180'),JSON[_0x7285('0x79')](_0x4bc873)));_0x185637[_0x7285('0x73')]=0xe;_0x185637[_0x7285('0x74')]=_0x7285('0x181');_0x185637[_0x7285('0x75')]=moment()['format'](_0x7285('0xc7'));_0x185637[_0x7285('0xe0')]=_0x185637[_0x7285('0x75')];hopperUtils[_0x7285('0xcb')](_0x185637)[_0x7285('0x9f')](loggerCatch(_0x7285('0x182')));_0x1b4cb0[_0x7285('0x130')](_0x185637)[_0x7285('0x9f')](loggerCatch(_0x7285('0x182')))[_0x7285('0x1d')](function(){delete _0x1b4cb0[_0x7285('0x24')][_0x199a42];return _0x3a1c64(msgResponse(_0x7285('0x155'),'Error',_0x7285('0x183')));});});});};Dialer[_0x7285('0x88')][_0x7285('0x184')]=function(_0x471c64,_0x593b7b,_0x5eb9bb){var _0xbcd7c7=new History(_0x593b7b);if(_0xbcd7c7[_0x7285('0x11a')]+_0xbcd7c7[_0x7285('0x11b')]+_0xbcd7c7[_0x7285('0x129')]+_0xbcd7c7[_0x7285('0x11c')]+_0xbcd7c7['countdropretry']+_0xbcd7c7[_0x7285('0xe7')]+_0xbcd7c7[_0x7285('0x117')]+_0xbcd7c7[_0x7285('0x11d')]>=_0x5eb9bb[_0x7285('0x11e')]-0x1){return!![];}switch(_0x471c64){case 0x3:if(_0xbcd7c7[_0x7285('0x129')]>=_0x5eb9bb[_0x7285('0x185')]-0x1){return!![];}hopperUtils[_0x7285('0xfa')]({'active':![],'countnoanswerretry':_0xbcd7c7[_0x7285('0x129')]+=0x1,'scheduledat':moment()[_0x7285('0xea')](_0x5eb9bb[_0x7285('0x186')],_0x7285('0xeb'))[_0x7285('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbcd7c7[_0x7285('0xdb')],'ListId':_0xbcd7c7[_0x7285('0xdc')],'VoiceQueueId':_0xbcd7c7[_0x7285('0xdd')]||undefined,'CampaignId':_0xbcd7c7[_0x7285('0xde')]||undefined})[_0x7285('0x9f')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xbcd7c7[_0x7285('0x11a')]>=_0x5eb9bb[_0x7285('0x187')]-0x1){return!![];}hopperUtils[_0x7285('0xfa')]({'active':![],'countbusyretry':_0xbcd7c7[_0x7285('0x11a')]+=0x1,'scheduledat':moment()[_0x7285('0xea')](_0x5eb9bb[_0x7285('0x188')],_0x7285('0xeb'))['format'](_0x7285('0xc7')),'ContactId':_0xbcd7c7[_0x7285('0xdb')],'ListId':_0xbcd7c7['ListId'],'VoiceQueueId':_0xbcd7c7[_0x7285('0xdd')]||undefined,'CampaignId':_0xbcd7c7['CampaignId']||undefined})[_0x7285('0x9f')](loggerCatch(_0x7285('0x189')));break;case 0x8:if(_0xbcd7c7[_0x7285('0x11b')]>=_0x5eb9bb[_0x7285('0x18a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0xbcd7c7[_0x7285('0x11b')]+=0x1,'scheduledat':moment()[_0x7285('0xea')](_0x5eb9bb[_0x7285('0x18b')],_0x7285('0xeb'))[_0x7285('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbcd7c7[_0x7285('0xdb')],'ListId':_0xbcd7c7['ListId'],'VoiceQueueId':_0xbcd7c7['VoiceQueueId']||undefined,'CampaignId':_0xbcd7c7[_0x7285('0xde')]||undefined})['catch'](loggerCatch(_0x7285('0x18c')));break;case 0x0:if(_0xbcd7c7[_0x7285('0x11c')]>=_0x5eb9bb[_0x7285('0x18d')]-0x1){return!![];}else{hopperUtils[_0x7285('0xfa')]({'active':![],'countnosuchnumberretry':_0xbcd7c7[_0x7285('0x11c')]+=0x1,'scheduledat':moment()[_0x7285('0xea')](_0x5eb9bb[_0x7285('0x18e')],_0x7285('0xeb'))[_0x7285('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbcd7c7[_0x7285('0xdb')],'ListId':_0xbcd7c7[_0x7285('0xdc')],'VoiceQueueId':_0xbcd7c7[_0x7285('0xdd')]||undefined,'CampaignId':_0xbcd7c7[_0x7285('0xde')]||undefined})[_0x7285('0x9f')](loggerCatch(_0x7285('0x18f')));}break;case 0xa:if(_0xbcd7c7['countdropretry']>=_0x5eb9bb[_0x7285('0x190')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xbcd7c7['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x5eb9bb[_0x7285('0xd6')],_0x7285('0xeb'))[_0x7285('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbcd7c7[_0x7285('0xdb')],'ListId':_0xbcd7c7[_0x7285('0xdc')],'VoiceQueueId':_0xbcd7c7[_0x7285('0xdd')]||undefined,'CampaignId':_0xbcd7c7[_0x7285('0xde')]||undefined})[_0x7285('0x9f')](loggerCatch(_0x7285('0xdf')));break;case 0xb:if(_0xbcd7c7[_0x7285('0xe7')]>=_0x5eb9bb['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xbcd7c7[_0x7285('0xe7')]+=0x1,'scheduledat':moment()[_0x7285('0xea')](_0x5eb9bb[_0x7285('0xe8')],'minutes')[_0x7285('0x48')](_0x7285('0xc7')),'ContactId':_0xbcd7c7[_0x7285('0xdb')],'ListId':_0xbcd7c7[_0x7285('0xdc')],'VoiceQueueId':_0xbcd7c7[_0x7285('0xdd')]||undefined,'CampaignId':_0xbcd7c7['CampaignId']||undefined})[_0x7285('0x9f')](loggerCatch(_0x7285('0x191')));break;case 0x13:if(_0xbcd7c7['countmachineretry']>=_0x5eb9bb['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x7285('0xfa')]({'active':![],'countmachineretry':_0xbcd7c7['countmachineretry']+=0x1,'scheduledat':moment()[_0x7285('0xea')](_0x5eb9bb['dialMachineRetryFrequency'],_0x7285('0xeb'))[_0x7285('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbcd7c7['ContactId'],'ListId':_0xbcd7c7[_0x7285('0xdc')],'VoiceQueueId':_0xbcd7c7['VoiceQueueId']||undefined,'CampaignId':_0xbcd7c7[_0x7285('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xbcd7c7[_0x7285('0x11d')]>=_0x5eb9bb[_0x7285('0x192')]-0x1){return!![];}hopperUtils[_0x7285('0xfa')]({'active':![],'countagentrejectretry':_0xbcd7c7['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x5eb9bb['dialAgentRejectRetryFrequency'],_0x7285('0xeb'))[_0x7285('0x48')](_0x7285('0xc7')),'ContactId':_0xbcd7c7[_0x7285('0xdb')],'ListId':_0xbcd7c7['ListId'],'VoiceQueueId':_0xbcd7c7[_0x7285('0xdd')]||undefined,'CampaignId':_0xbcd7c7['CampaignId']||undefined})[_0x7285('0x9f')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x7285('0x88')][_0x7285('0x193')]=function(_0x5a09c5,_0x3009bb,_0x518329){var _0xa0587=this;var _0x33b15a=new History(_0x5a09c5);var _0x560494=![];var _0xba9982;var _0x49a28a;return new Promise(function(_0x5ace04,_0x541289){if(_['isUndefined'](_0x3009bb)&&typeof _0x3009bb!=='object'){return _0x541289(msgResponse('[callProgressDetecting]',_0x7285('0x96'),_0x7285('0x194')));}if(_['isUndefined'](_0x518329)&&typeof _0x518329!==_0x7285('0x195')){return _0x541289(msgResponse(_0x7285('0x196'),_0x7285('0x96'),'evt\x20is\x20undefine'));}hopperUtils[_0x7285('0xd8')](_0x33b15a,_0x518329[_0x7285('0xc8')],_0x3009bb)[_0x7285('0x41')](function(_0x19d326){if(_0x19d326[_0x7285('0xda')]==0x1)_0x560494=!![];switch(_0x518329[_0x7285('0xc8')]){case'0':_0x3009bb[_0x7285('0x197')]+=0x1;_0x33b15a[_0x7285('0x73')]=0x0;_0x33b15a['statedesc']=_0x7285('0x198');_0x33b15a[_0x7285('0x11c')]+=0x1;_0x33b15a[_0x7285('0xd5')]+=0x1;ami[_0x7285('0x44')](_0x7285('0x199'),ut[_0x7285('0x115')](_0x5a09c5,_0x7285('0x19a')));_0xba9982=_0x3009bb['dialNoSuchNumberRetryFrequency'];_0x49a28a=_0x3009bb[_0x7285('0xd7')];hopperUtils[_0x7285('0xcb')](_0x33b15a)[_0x7285('0x9f')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xa0587[_0x7285('0x184')](0x0,_0x5a09c5,_0x3009bb)&&!_0x560494){if(_0x33b15a[_0x7285('0x11c')]>=_0x3009bb[_0x7285('0x18d')]){_0xa0587[_0x7285('0x122')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x19b'));}else{_0xa0587[_0x7285('0x11f')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x19b'));}}break;case'3':_0x3009bb['outboundNoAnswerCallsDay']+=0x1;_0x33b15a[_0x7285('0x73')]=0x3;_0x33b15a[_0x7285('0x74')]='NoAnswer';_0x33b15a[_0x7285('0x129')]+=0x1;_0x33b15a['countglobal']+=0x1;var _0x26b4fc=ut['buildNoAnswerEventPayload'](_0x5a09c5,_0x3009bb);ami[_0x7285('0x44')](_0x7285('0x19c'),_0x26b4fc);_0xba9982=_0x3009bb[_0x7285('0x186')];_0x49a28a=_0x3009bb[_0x7285('0xd7')];hopperUtils[_0x7285('0xcb')](_0x33b15a)[_0x7285('0x9f')](loggerCatch(_0x7285('0x19d')));if(_0xa0587[_0x7285('0x184')](0x3,_0x5a09c5,_0x3009bb)&&!_0x560494){if(_0x33b15a[_0x7285('0x129')]>=_0x3009bb[_0x7285('0x185')]){_0xa0587[_0x7285('0x122')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x19e'));}else{_0xa0587[_0x7285('0x11f')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x19e'));}}break;case'5':_0x3009bb[_0x7285('0x19f')]+=0x1;_0x33b15a[_0x7285('0x73')]=0x5;_0x33b15a[_0x7285('0x74')]=_0x7285('0x1a0');_0x33b15a[_0x7285('0x11a')]+=0x1;_0x33b15a[_0x7285('0xd5')]+=0x1;ami[_0x7285('0x44')](_0x7285('0x1a1'),ut[_0x7285('0x115')](_0x5a09c5,_0x7285('0x1a2')));_0xba9982=_0x3009bb['dialBusyRetryFrequency'];_0x49a28a=_0x3009bb['callAdditionalPhoneAfterMin'];hopperUtils[_0x7285('0xcb')](_0x33b15a)[_0x7285('0x9f')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0xa0587[_0x7285('0x184')](0x5,_0x5a09c5,_0x3009bb)&&!_0x560494){if(_0x33b15a[_0x7285('0x11a')]>=_0x3009bb[_0x7285('0x187')]){_0xa0587[_0x7285('0x122')](_0x33b15a,_0x5ace04,_0x541289,'reason\x205\x20busy');}else{_0xa0587[_0x7285('0x11f')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x1a3'));}}break;case'8':_0x3009bb[_0x7285('0x1a4')]+=0x1;_0x33b15a[_0x7285('0x73')]=0x8;_0x33b15a[_0x7285('0x74')]=_0x7285('0x1a5');_0x33b15a[_0x7285('0x11b')]+=0x1;_0x33b15a[_0x7285('0xd5')]+=0x1;_0xba9982=_0x3009bb[_0x7285('0x18b')];_0x49a28a=_0x3009bb[_0x7285('0xd7')];ami[_0x7285('0x44')]('custom:agentcongestion',ut[_0x7285('0x115')](_0x5a09c5,_0x7285('0x1a6')));hopperUtils['createHistory'](_0x33b15a)[_0x7285('0x9f')](loggerCatch(_0x7285('0x1a7')));if(_0xa0587[_0x7285('0x184')](0x8,_0x5a09c5,_0x3009bb)&&!_0x560494){if(_0x33b15a[_0x7285('0x11b')]>=_0x3009bb[_0x7285('0x18a')]){_0xa0587[_0x7285('0x122')](_0x33b15a,_0x5ace04,_0x541289,'reason\x208\x20congestion');}else{_0xa0587[_0x7285('0x11f')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x1a8'));}}break;case'11':_0x3009bb[_0x7285('0x1a9')]+=0x1;_0x33b15a[_0x7285('0x73')]=0xb;_0x33b15a[_0x7285('0x74')]=_0x7285('0xe5');_0x33b15a[_0x7285('0xe7')]+=0x1;_0x33b15a[_0x7285('0xd5')]+=0x1;_0xba9982=_0x3009bb[_0x7285('0xe8')];_0x49a28a=_0x3009bb[_0x7285('0xd7')];hopperUtils[_0x7285('0xcb')](_0x33b15a)[_0x7285('0x9f')](loggerCatch(_0x7285('0xec')));if(_0xa0587['checkRetriveMax'](0xb,_0x5a09c5,_0x3009bb)&&!_0x560494){if(_0x33b15a[_0x7285('0xe7')]>=_0x3009bb[_0x7285('0xe9')]){_0xa0587[_0x7285('0x122')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x1aa'));}else{_0xa0587[_0x7285('0x11f')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x1aa'));}}break;case'20':_0x3009bb[_0x7285('0x1ab')]+=0x1;_0x33b15a[_0x7285('0x73')]=0x14;_0x33b15a[_0x7285('0x74')]='AgentReject';_0x33b15a[_0x7285('0x11d')]+=0x1;_0x33b15a[_0x7285('0xd5')]+=0x1;_0xba9982=_0x3009bb[_0x7285('0x1ac')];_0x49a28a=_0x3009bb[_0x7285('0xd7')];ami[_0x7285('0x44')](_0x7285('0x1ad'),ut[_0x7285('0x115')](_0x5a09c5,'agentreject'));hopperUtils[_0x7285('0xcb')](_0x33b15a)[_0x7285('0x9f')](loggerCatch(_0x7285('0x1ae')));if(_0xa0587[_0x7285('0x184')](0x14,_0x5a09c5,_0x3009bb)&&!_0x560494){if(_0x33b15a[_0x7285('0x11d')]>=_0x3009bb[_0x7285('0x192')]){_0xa0587[_0x7285('0x122')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x1af'));}else{_0xa0587[_0x7285('0x11f')](_0x33b15a,_0x5ace04,_0x541289,_0x7285('0x1af'));}}break;default:_0x3009bb['outboundUnknownCallsDay']+=0x1;_0x33b15a[_0x7285('0x73')]=0xc;_0x33b15a[_0x7285('0x74')]=_0x518329[_0x7285('0xc8')];_0xba9982=_0x3009bb['dialAgentRejectRetryFrequency'];_0x49a28a=_0x3009bb[_0x7285('0xd7')];hopperUtils[_0x7285('0xcb')](_0x33b15a)[_0x7285('0x9f')](loggerCatch(_0x7285('0x1b0')));if(_0xa0587['checkRetriveMax'](_0x518329[_0x7285('0xc8')],_0x5a09c5,_0x3009bb)&&!_0x560494){if(_0x33b15a[_0x7285('0x11a')]+_0x33b15a['countcongestionretry']+_0x33b15a[_0x7285('0x129')]+_0x33b15a['countnosuchnumberretry']+_0x33b15a[_0x7285('0xd4')]+_0x33b15a[_0x7285('0xe7')]+_0x33b15a[_0x7285('0x117')]+_0x33b15a[_0x7285('0x11d')]>=_0x3009bb['dialGlobalMaxRetry']){_0xa0587['stateGlobal'](_0x33b15a,_0x5ace04,_0x541289,_0x518329[_0x7285('0xc8')]);}else{_0xa0587[_0x7285('0x122')](_0x33b15a,_0x5ace04,_0x541289,_0x518329['reason']);}}}})['then'](function(){if(_0x560494){hopperUtils['swapAdditionalPhones'](_0x33b15a,_0xba9982,_0x49a28a)[_0x7285('0x41')](function(){return _0x5ace04(0x1);});}});});};Dialer[_0x7285('0x88')]['stateGlobal']=function(_0x29baed,_0x461eeb,_0x4885ca,_0x55679e){var _0x5ea649=new Final(_0x29baed);_0x5ea649[_0x7285('0x73')]=0xf;_0x5ea649[_0x7285('0x74')]=_0x7285('0x1b1');this['createStateFinal'](_0x5ea649,_0x461eeb,_0x4885ca,_0x55679e);};Dialer[_0x7285('0x88')][_0x7285('0x122')]=function(_0x37df9d,_0x410167,_0x2a9a0f,_0x13726c){hopperUtils[_0x7285('0x130')](_0x37df9d)[_0x7285('0x41')](function(){return _0x410167(msgResponse(_0x7285('0x196'),_0x7285('0x1b2'),_0x13726c));})['catch'](function(){return _0x2a9a0f(msgResponse(_0x7285('0x1b3'),'Failure',_0x7285('0x1b4')));});};Dialer[_0x7285('0x88')][_0x7285('0xb8')]=function(_0x53156c){var _0x13f345=_0x53156c['dialPredictiveOptimizationPercentage']/0x64;var _0x36f7a3=_0x53156c[_0x7285('0xcf')]/(_0x53156c[_0x7285('0xcf')]+_0x53156c[_0x7285('0x10f')]);var _0x4bb809=Math[_0x7285('0x1b5')](_0x53156c['predictiveIntervalAvailable']*(_0x53156c['predictiveIntervalMaxThreshold']/0x64));var _0xf962cf=Math[_0x7285('0x1b5')](_0x53156c[_0x7285('0x1b6')]*(_0x53156c['predictiveIntervalMinThreshold']/0x64));var _0x291f01=_0x53156c[_0x7285('0x1b7')]+_0x53156c['talking'];var _0x43bc87=Math[_0x7285('0x1b8')](_0x53156c[_0x7285('0x5c')]*_0x53156c['erlangAbandonmentRate']*_0x53156c[_0x7285('0x1b9')]*_0x53156c['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x53156c[_0x7285('0x29')])){if(!_['isUndefined'](_0x53156c[_0x7285('0x28')])){_0x53156c['startPredictive']=undefined;loggerPredictive[_0x7285('0x68')]('[startMethodPredictive][StartProgressive]',_0x7285('0x1ba'));}if(!_['isUndefined'](_0x53156c[_0x7285('0x66')])){loggerPredictive[_0x7285('0x68')](_0x7285('0x1bb'),_0x7285('0x1bc'));clearInterval(_0x53156c[_0x7285('0x66')]);_0x53156c['handlePredictive']=undefined;}_0x53156c[_0x7285('0x29')]=moment()[_0x7285('0x48')](_0x7285('0xc7'));loggerPredictive[_0x7285('0x4c')](_0x53156c['name'],_0x7285('0x1bd'),_0x53156c[_0x7285('0x29')]);this[_0x7285('0xb6')](_0x53156c,0x1);}else if(ifInterval(_0x53156c[_0x7285('0x1be')],_0x53156c[_0x7285('0x29')])){this[_0x7285('0xb6')](_0x53156c,0x1);loggerPredictiveCalls[_0x7285('0x4c')](_0x7285('0x1bf'),_0x53156c[_0x7285('0x29')],_0x53156c['name']);_0x53156c[_0x7285('0x5c')]=0x0;_0x53156c[_0x7285('0xd0')]=0x0;}else if(_0x13f345<_0x36f7a3&&_0x53156c['dialPredictiveOptimization']===_0x7285('0x1c0')){clearPredictiveAttributes(_0x53156c);loggerPredictive[_0x7285('0x4c')](_0x7285('0x1c1'),_0x7285('0x1c2'),_0x36f7a3,_0x7285('0x29'),_0x53156c['name']);}else if(_0x43bc87<_0x53156c[_0x7285('0xd0')]&&_0x53156c[_0x7285('0x1c3')]===_0x7285('0x1c0')){clearPredictiveAttributes(_0x53156c);loggerPredictive[_0x7285('0x4c')](_0x7285('0x1c4'),_0x7285('0x1c5'),_0x43bc87,_0x7285('0x1c6'),_0x53156c[_0x7285('0xd0')],_0x7285('0x29'),_0x53156c[_0x7285('0x4a')]);}else if(!ifInterval(_0x53156c[_0x7285('0x1be')],_0x53156c[_0x7285('0x29')])&&_[_0x7285('0x43')](_0x53156c[_0x7285('0x28')])&&!_['isUndefined'](_0x53156c['startProgressive'])){_0x53156c[_0x7285('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x53156c['name'],'started\x20in\x20predictive\x20at',_0x53156c[_0x7285('0x28')]);hopperUtils[_0x7285('0x1c7')](_0x53156c[_0x7285('0x1be')])[_0x7285('0x41')](this[_0x7285('0x1c8')](_0x53156c))['then'](mergeDataErlangB(_0x53156c))['then'](this[_0x7285('0x1c9')](_0x53156c))[_0x7285('0x9f')](loggerCatchPredictive(_0x7285('0x1ca'),_0x53156c));}else if(!ifInterval(_0x53156c[_0x7285('0x1be')],_0x53156c[_0x7285('0x28')])){_0x53156c[_0x7285('0xd0')]=0x0;_0x53156c['startPredictive']=moment()[_0x7285('0x48')](_0x7285('0xc7'));loggerPredictive['info'](_0x53156c['name'],_0x7285('0x1cb'),_0x53156c[_0x7285('0x28')]);clearInterval(_0x53156c[_0x7285('0x66')]);_0x53156c[_0x7285('0x66')]=undefined;hopperUtils[_0x7285('0x1c7')](_0x53156c[_0x7285('0x1be')])[_0x7285('0x41')](this[_0x7285('0x1c8')](_0x53156c))[_0x7285('0x41')](mergeDataErlangB(_0x53156c))[_0x7285('0x41')](this[_0x7285('0x1c9')](_0x53156c))[_0x7285('0x9f')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x53156c));}else if(_0x53156c[_0x7285('0x1b6')]&&_0x291f01<_0x53156c[_0x7285('0x1b6')]-_0xf962cf){clearPredictiveAttributes(_0x53156c);loggerPredictive[_0x7285('0x4c')](_0x53156c[_0x7285('0x4a')],_0x7285('0x1cc'),_0x291f01,')\x20are\x20less\x20than\x20threshold\x20(',_0x53156c['predictiveIntervalAvailable'],'-',_0xf962cf,'=',_0x53156c['predictiveIntervalAvailable']-_0xf962cf,')');}else if(_0x53156c[_0x7285('0x1b6')]&&_0x291f01>_0x53156c[_0x7285('0x1b6')]+_0x4bb809){clearPredictiveAttributes(_0x53156c);loggerPredictive[_0x7285('0x4c')](_0x53156c['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x291f01,_0x7285('0x1cd'),_0x53156c[_0x7285('0x1b6')],'+',_0x4bb809,'=',_0x53156c[_0x7285('0x1b6')]+_0x4bb809,')');}};Dialer[_0x7285('0x88')]['getDataPredictive']=function(_0x20010a){var _0x1a1770=this;return function(_0x25b4c8){return new Promise(function(_0x1d63aa,_0x1e28b8){_[_0x7285('0x62')](_0x20010a,_0x25b4c8[0x0]);if(checkGetDataPredictive(_0x25b4c8[0x0])){var _0x7ce5f6=_0x20010a[_0x7285('0x1b6')]=_0x20010a['talking']+_0x20010a[_0x7285('0x1b7')];var _0x135052=_0x20010a[_0x7285('0x1be')]*0x3c;var _0x7208b7=_0x25b4c8[0x0][_0x7285('0x56')]+_0x25b4c8[0x0][_0x7285('0x55')];var _0x247416=(_0x25b4c8[0x0]['predictiveIntervalAnsweredCalls']+_0x25b4c8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x25b4c8[0x0][_0x7285('0x54')])/_0x25b4c8[0x0][_0x7285('0x4f')];_0x20010a[_0x7285('0x1b9')]=_0x247416>0x0?_0x247416:0x1;switch(_0x20010a[_0x7285('0x1c3')]){case _0x7285('0x1c0'):var _0x3c4c81=_0x20010a[_0x7285('0x1ce')]/0x64;return _0x1a1770['abandonmentRate'](_0x7ce5f6,_0x135052,_0x7208b7,_0x247416,_0x3c4c81)['then'](function(_0x405832){return _0x1d63aa(_0x405832);});case _0x7285('0x1cf'):var _0x4499ed=_0x20010a[_0x7285('0x1ce')]/0x64;return _0x1a1770[_0x7285('0x1d0')](_0x7ce5f6,_0x135052,_0x7208b7,_0x247416,_0x4499ed)['then'](function(_0x12bdd6){return _0x1d63aa(_0x12bdd6);});default:return _0x1e28b8(msgResponse(_0x7285('0x1d1'),_0x7285('0x96'),'Unknown\x20Predictive'));}}else{return _0x1e28b8(msgResponse('[getDataPredictive]',_0x7285('0x96'),'check\x20failure'));}});};};Dialer[_0x7285('0x88')][_0x7285('0x1d2')]=function(_0x4c530f){var _0x44445c=this;return function(_0x2faebc){return new Promise(function(_0x1f331e,_0x173487){_[_0x7285('0x62')](_0x4c530f,_0x2faebc[0x0]);if(checkGetDataPredictive(_0x2faebc[0x0])){loggerPredictive[_0x7285('0x4c')](JSON[_0x7285('0x79')](_0x2faebc[0x0]));if(_0x4c530f[_0x7285('0x1c3')]==='dropRate'){return _0x44445c[_0x7285('0x14b')](_0x4c530f['id'])[_0x7285('0x41')](function(_0xccaa75){var _0xdfde13=_0x4c530f['loggedIn']-_0xccaa75[0x0][_0x7285('0x1d3')];var _0x12eaac=_0x4c530f[_0x7285('0x1be')]*0x3c;var _0x413119=_0x2faebc[0x0][_0x7285('0x56')]+_0x2faebc[0x0]['predictiveIntervalAvgHoldtime'];var _0x23a5ee=(_0x2faebc[0x0]['predictiveIntervalAnsweredCalls']+_0x2faebc[0x0][_0x7285('0x52')]+_0x2faebc[0x0][_0x7285('0x54')])/_0x2faebc[0x0][_0x7285('0x4f')];var _0x28e03f=_0x4c530f['dialPredictiveOptimizationPercentage']/0x64;_0x4c530f[_0x7285('0x1d4')]=_0xccaa75[0x0][_0x7285('0x1d3')]||0x0;_0x4c530f[_0x7285('0x1b9')]=_0x23a5ee>0x0?_0x23a5ee:0x1;return _0x44445c[_0x7285('0x1d5')](_0xdfde13,_0x12eaac,_0x413119,_0x23a5ee,_0x28e03f);})['then'](function(_0x55ab46){return _0x1f331e(_0x55ab46);})['catch'](function(_0x38fa88){return _0x173487(msgResponse(_0x7285('0x1d6'),_0x7285('0x96'),JSON[_0x7285('0x79')](_0x38fa88)));});}if(_0x4c530f[_0x7285('0x1c3')]===_0x7285('0x1cf')){return _0x44445c['getVoiceQueueRtPauses'](_0x4c530f['id'])[_0x7285('0x41')](function(_0x58322b){var _0xeada3c=_0x4c530f[_0x7285('0x1d7')]-_0x58322b[0x0][_0x7285('0x1d3')];var _0x4bfa3b=_0x4c530f[_0x7285('0x1be')]*0x3c;var _0x13daab=_0x2faebc[0x0][_0x7285('0x56')]+_0x2faebc[0x0][_0x7285('0x55')];var _0x588f99=(_0x2faebc[0x0][_0x7285('0x1d8')]+_0x2faebc[0x0][_0x7285('0x52')]+_0x2faebc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2faebc[0x0]['predictiveIntervalTotalCalls'];var _0x1670a7=_0x4c530f[_0x7285('0x1ce')]/0x64;_0x4c530f[_0x7285('0x1d4')]=_0x58322b[0x0][_0x7285('0x1d3')]||0x0;_0x4c530f[_0x7285('0x1b9')]=_0x588f99>0x0?_0x588f99:0x1;return _0x44445c[_0x7285('0x1d0')](_0xeada3c,_0x4bfa3b,_0x13daab,_0x588f99,_0x1670a7);})[_0x7285('0x41')](function(_0x29b4e4){return _0x1f331e(_0x29b4e4);})[_0x7285('0x9f')](function(_0x2a8cf4){return _0x173487(msgResponse(_0x7285('0x1d6'),'Failure',JSON[_0x7285('0x79')](_0x2a8cf4)));});}}else{return _0x173487(msgResponse(_0x7285('0x1d1'),_0x7285('0x96'),_0x7285('0x1d9')));}});};};Dialer[_0x7285('0x88')][_0x7285('0x1c9')]=function(_0x103f26){var _0x555431=this;return function(){var _0x10e050=0x0;var _0x4017c3=Math[_0x7285('0x1b8')](_0x103f26[_0x7285('0x5e')]*0x3e8);if(_0x4017c3>0x0){_0x4017c3=_0x4017c3<0x64?0x64:_0x4017c3;loggerPredictive[_0x7285('0x4c')](_0x103f26['name'],_0x7285('0x1da'),_0x4017c3,_0x7285('0x1db'));_0x103f26[_0x7285('0x66')]=setInterval(function(){_0x555431[_0x7285('0x66')](_0x103f26);loggerPredictiveCalls['info'](_0x7285('0x1dc'),_0x10e050+=0x1);},_0x4017c3);}else{loggerPredictive[_0x7285('0x4c')](_0x103f26[_0x7285('0x4a')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x7285('0x88')][_0x7285('0x1dd')]=function(_0x27cc75,_0x31ce7b){var _0x4a2ac4=this;return function(_0x428a6b){if(_[_0x7285('0x1de')](_0x428a6b)){if(_[_0x7285('0xf6')](_0x31ce7b['UserId'])||!_0x31ce7b[_0x7285('0x1df')]){if(_0x27cc75[_0x7285('0xb3')]===_0x7285('0xa')){_0x27cc75[_0x7285('0x76')]=_[_0x7285('0x43')](_0x27cc75['queueStatusComplete'])?!![]:_0x27cc75[_0x7285('0x76')];var _0x38583a=uuid['v4']();_0x4a2ac4[_0x7285('0x24')][_0x38583a]=new Action(_0x27cc75,_0x31ce7b,_0x38583a);loggerBooked[_0x7285('0x4c')](_0x7285('0x1e0'),_0x38583a,_0x7285('0x1e1'),JSON['stringify'](_0x27cc75[_0x7285('0x76')]),'Queue:\x20',_0x27cc75['name']);if(_0x27cc75['queueStatusComplete']){_0x27cc75[_0x7285('0x76')]=![];_0x4a2ac4[_0x7285('0x2a')][_0x4a2ac4[_0x7285('0x24')][_0x38583a][_0x7285('0xc1')]]=[];ami[_0x7285('0x9c')]({'actionid':_0x38583a,'action':'queuestatus','queue':_0x27cc75['name']})[_0x7285('0x9f')](function(){_0x4a2ac4[_0x7285('0xc5')](_0x27cc75);hopperUtils[_0x7285('0xfa')]({'active':![],'ContactId':_0x4a2ac4[_0x7285('0x24')][_0x38583a][_0x7285('0xdb')],'ListId':_0x4a2ac4[_0x7285('0x24')][_0x38583a][_0x7285('0xdc')],'VoiceQueueId':_0x4a2ac4[_0x7285('0x24')][_0x38583a][_0x7285('0xdd')]||undefined,'CampaignId':_0x4a2ac4[_0x7285('0x24')][_0x38583a][_0x7285('0xde')]||undefined})[_0x7285('0x9f')](loggerCatch(_0x7285('0x1e2')));delete _0x4a2ac4[_0x7285('0x24')][_0x38583a];});}else{loggerBooked['info'](_0x7285('0x1e3'),JSON[_0x7285('0x79')](_0x27cc75[_0x7285('0x76')]),_0x7285('0x1e4'),_0x27cc75[_0x7285('0x4a')]);_0x4a2ac4['updateOriginated'](_0x27cc75);hopperUtils[_0x7285('0xfa')]({'active':![],'ContactId':_0x4a2ac4['actions'][_0x38583a][_0x7285('0xdb')],'ListId':_0x4a2ac4[_0x7285('0x24')][_0x38583a][_0x7285('0xdc')],'VoiceQueueId':_0x4a2ac4['actions'][_0x38583a]['VoiceQueueId']||undefined,'CampaignId':_0x4a2ac4[_0x7285('0x24')][_0x38583a][_0x7285('0xde')]||undefined})[_0x7285('0x9f')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4a2ac4[_0x7285('0x24')][_0x38583a];}}else{return _0x4a2ac4[_0x7285('0x1e5')](_0x27cc75,_0x31ce7b);}}else{if(utils[_0x7285('0x63')](undefined,_0x31ce7b['scheduledat'])<_0x27cc75[_0x7285('0x1e6')]*0x3c){if(_0x31ce7b['Agent']&&!_0x31ce7b['Agent'][_0x7285('0x1e7')]){_0x4a2ac4[_0x7285('0x1e8')][_0x7285('0x100')](_0x31ce7b['id'])['finally'](function(){_0x4a2ac4[_0x7285('0xc5')](_0x27cc75);});}else{hopperUtils[_0x7285('0x1e9')]({'active':![]},_0x31ce7b['id'],0x1)[_0x7285('0x1d')](function(){_0x4a2ac4['updateOriginated'](_0x27cc75);});}}else{_0x27cc75[_0x7285('0x1ea')]+=0x1;_0x4a2ac4['updateOriginated'](_0x27cc75);if(_0x27cc75[_0x7285('0x1eb')]){hopperUtils[_0x7285('0xfa')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x31ce7b[_0x7285('0xdb')],'ListId':_0x31ce7b['ListId'],'VoiceQueueId':_0x31ce7b[_0x7285('0xdd')]||undefined,'CampaignId':_0x31ce7b[_0x7285('0xde')]||undefined})[_0x7285('0x9f')](loggerCatch(_0x7285('0x1ec')));hopperUtils[_0x7285('0xcb')](createObjHistory(_0x27cc75,_0x31ce7b,utils[_0x7285('0x6e')]['QUEUE_RECALL'],0x17,_0x7285('0x1ed')))[_0x7285('0x9f')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4a2ac4['saveInDb'](createObjHistory(_0x27cc75,_0x31ce7b,utils[_0x7285('0x6e')][_0x7285('0x1ee')],0x16,_0x7285('0x1ef')),'[Originate][HistoryRecallClose][historyCatch]',_0x7285('0x1f0'));}}}}else{_0x27cc75[_0x7285('0x1f1')]+=0x1;_0x4a2ac4['saveInDb'](createObjHistory(_0x27cc75,_0x31ce7b,utils[_0x7285('0x6e')][_0x7285('0x1f2')],0xd,_0x7285('0x1f3')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x435507){var _0x250f34=this;var _0x4781ae=_0x435507[_0x7285('0x1f4')]-_0x435507[_0x7285('0x83')];emitCampaignSummary(_0x435507);if(_0x4781ae>0x0&&_0x435507[_0x7285('0x1f5')]==0x0){if(_0x4781ae>this[_0x7285('0x22')]){_0x4781ae=this[_0x7285('0x22')];}_0x435507[_0x7285('0x1f5')]=0x1;hopperUtils[_0x7285('0x1f6')](_0x435507,_0x4781ae)[_0x7285('0x41')](function(_0x142f83){_0x435507['temp']=0x0;if(_0x142f83){if(!utils['checkContactEmpty'](_0x142f83)){_0x435507[_0x7285('0x6d')]=utils[_0x7285('0x6e')][_0x7285('0x71')];logger['info']('[getContactCampaign2][Empty]'+_0x435507[_0x7285('0x4a')]);}else{_0x435507['originated']+=_0x142f83[_0x7285('0x9b')];_0x435507[_0x7285('0x6d')]=utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0xc5fe7d=0x0;_0xc5fe7d<_0x142f83[_0x7285('0x9b')];_0xc5fe7d+=0x1){_0x435507['ivrTotalCallsDays']+=0x1;if(_[_0x7285('0xf6')](_0x142f83[_0xc5fe7d])||_[_0x7285('0xf6')](_0x142f83[_0xc5fe7d]['Contact'])||_[_0x7285('0xf6')](_0x142f83[_0xc5fe7d][_0x7285('0x156')])){_0x250f34['emptyContact'](_0x7285('0x1f7'),_0x435507,_0x142f83[_0xc5fe7d]);}else{hopperUtils[_0x7285('0x1f8')](_[_0x7285('0x7a')](_0x142f83[_0xc5fe7d],[_0x7285('0xde'),_0x7285('0x156')]))[_0x7285('0x41')](_0x250f34[_0x7285('0x1dd')](_0x435507,_0x142f83[_0xc5fe7d]))[_0x7285('0x9f')](_0x250f34[_0x7285('0x14e')](_0x7285('0x1f9'),_0x435507));}}}}})[_0x7285('0x9f')](loggerGetContactDialer(_0x7285('0x1fa'),_0x435507,_0x4781ae));}};Dialer[_0x7285('0x88')]['handlePower']=function(_0x442816,_0x23a604){var _0x5a3315=this;var _0x21b5d6=[];if(_0x23a604<0x1||_0x442816[_0x7285('0xb3')]===_0x7285('0xa')){_0x23a604=0x1;}var _0x251288=Math[_0x7285('0x1b8')](_0x442816['available']*_0x23a604)-_0x442816[_0x7285('0x83')];if(_0x442816['dialLimitQueue']>0x0){var _0x512c4e=_0x442816[_0x7285('0x1fb')]-_0x442816[_0x7285('0x83')]-_0x442816['talking']-_0x442816[_0x7285('0x138')];if(_0x251288>_0x512c4e){_0x251288=_0x512c4e;}}if(_0x251288>0x0&&_0x442816[_0x7285('0x1f5')]==0x0){if(_0x442816[_0x7285('0xb3')]===_0x7285('0xa')){_0x251288=0x1;}if(_0x251288>this['maxNumberOriginate']){_0x251288=this[_0x7285('0x22')];}for(var _0x3f5849 in this['agents']){if(typeof this[_0x7285('0x20')][_0x3f5849]!=='undefined'){if(this['agents'][_0x3f5849][_0x7285('0x73')]==='not_inuse'&&this['agents'][_0x3f5849][_0x7285('0x8d')]===_0x7285('0x8c')){_0x21b5d6[_0x7285('0xf7')](this[_0x7285('0x20')][_0x3f5849]['id']);}}}_0x442816[_0x7285('0x1f5')]=0x1;hopperUtils[_0x7285('0x1fc')](_0x442816,_0x21b5d6,_0x251288)[_0x7285('0x41')](function(_0x1218a6){_0x442816['temp']=0x0;if(_0x1218a6){if(!utils[_0x7285('0x1fd')](_0x1218a6)){hopperUtils[_0x7285('0x1fe')](_0x442816)['then'](sendMessageReschedule(_0x442816))[_0x7285('0x9f')](loggerCatch('[countReScheduled]\x20'));}else{_0x442816[_0x7285('0x83')]+=_0x1218a6[_0x7285('0x9b')];_0x442816[_0x7285('0x6d')]=_0x442816[_0x7285('0xb3')]==='booked'?utils[_0x7285('0x6e')][_0x7285('0x139')]:utils[_0x7285('0x6e')][_0x7285('0x1ff')];for(var _0x584b8a=0x0;_0x584b8a<_0x1218a6[_0x7285('0x9b')];_0x584b8a+=0x1){if(_['isNil'](_0x1218a6[_0x584b8a])||_['isNil'](_0x1218a6[_0x584b8a][_0x7285('0x16f')])||_[_0x7285('0xf6')](_0x1218a6[_0x584b8a][_0x7285('0x156')])){_0x5a3315[_0x7285('0x14f')]('[actionOriginate]\x20',_0x442816,_0x1218a6[_0x584b8a]);}else{hopperUtils[_0x7285('0x200')](_[_0x7285('0x7a')](_0x1218a6[_0x584b8a],['VoiceQueueId',_0x7285('0x156')]))[_0x7285('0x41')](_0x5a3315[_0x7285('0x1dd')](_0x442816,_0x1218a6[_0x584b8a]))['catch'](_0x5a3315['loggerHandler'](_0x7285('0x1f7'),_0x442816));}}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x442816,_0x251288));}};Dialer['prototype'][_0x7285('0x66')]=function(_0x21d653){if(_0x21d653[_0x7285('0x1fb')]>0x0){var _0x5a3df4=_0x21d653[_0x7285('0x1fb')]-_0x21d653[_0x7285('0x83')]-_0x21d653[_0x7285('0x201')];if(_0x5a3df4>0x0&&_0x21d653[_0x7285('0x1f5')]==0x0){this[_0x7285('0x202')](_0x21d653);}else{loggerPredictiveCalls[_0x7285('0x4c')](_0x7285('0x203'));}}else{this[_0x7285('0x202')](_0x21d653);}};Dialer[_0x7285('0x88')][_0x7285('0x202')]=function(_0xb1782a){var _0x4f5da1=this;var _0x97face=[];_0xb1782a[_0x7285('0x83')]+=0x1;for(var _0x3ac5c8 in this[_0x7285('0x20')]){if(typeof this['agents'][_0x3ac5c8]!==_0x7285('0xac')){if(this[_0x7285('0x20')][_0x3ac5c8][_0x7285('0x73')]===_0x7285('0x204')&&this[_0x7285('0x20')][_0x3ac5c8]['status']==='reachable'){_0x97face[_0x7285('0xf7')](this['agents'][_0x3ac5c8]['id']);}}}_0xb1782a[_0x7285('0x1f5')]=0x1;return this[_0x7285('0x1fc')](_0xb1782a['id'],_0x97face,0x1,_0xb1782a[_0x7285('0x205')],_0xb1782a)[_0x7285('0x41')](function(_0x4d3ef9){_0xb1782a[_0x7285('0x1f5')]=0x1;if(_0x4d3ef9){if(!utils[_0x7285('0x1fd')](_0x4d3ef9)){utils[_0x7285('0x6b')](_0xb1782a,0x1,0x0);return hopperUtils['countReScheduled'](_0xb1782a)[_0x7285('0x41')](sendMessageReschedule(_0xb1782a))[_0x7285('0x9f')](loggerCatch(_0x7285('0x206')));}else{_0xb1782a['message']=utils['CAMPAIGN_STATUS']['RUNNING'];if(_['isNil'](_0x4d3ef9[0x0])||_['isNil'](_0x4d3ef9[0x0]['Contact'])||_[_0x7285('0xf6')](_0x4d3ef9[0x0][_0x7285('0x156')])){_0x4f5da1[_0x7285('0x14f')]('[actionOriginate]\x20',_0xb1782a,_0x4d3ef9[0x0]);}else{return hopperUtils[_0x7285('0x200')](_[_0x7285('0x7a')](_0x4d3ef9[0x0],['VoiceQueueId',_0x7285('0x156')]))['then'](_0x4f5da1[_0x7285('0x1dd')](_0xb1782a,_0x4d3ef9[0x0]))[_0x7285('0x9f')](_0x4f5da1[_0x7285('0x14e')]('[actionOriginatePredictive]\x20',_0xb1782a));}}}})[_0x7285('0x9f')](loggerGetContactDialer(_0x7285('0x207'),_0xb1782a,0x1));};Dialer[_0x7285('0x88')][_0x7285('0x1d5')]=function(_0x107a47,_0x51293a,_0x31a1a7,_0x1a07cf,_0x1fee49,_0x170d22){loggerPredictive[_0x7285('0x4c')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x7285('0x4c')]('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',_0x107a47);loggerPredictive[_0x7285('0x4c')](_0x7285('0x208'),_0x51293a);loggerPredictive[_0x7285('0x4c')](_0x7285('0x209'),_0x31a1a7);loggerPredictive[_0x7285('0x4c')]('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',_0x1a07cf);loggerPredictive[_0x7285('0x4c')](_0x7285('0x20a'),_0x1fee49);loggerPredictive['info'](_0x7285('0x57'));return new Promise(function(_0x2dc0f4,_0x470e75){if(_0x107a47<=0x0||isNaN(_0x107a47)){return _0x470e75(msgResponse(_0x7285('0x20b'),_0x7285('0x20c'),_0x7285('0x20d')+_0x107a47));}if(_0x31a1a7<=0x0||isNaN(_0x31a1a7)){return _0x470e75(msgResponse(_0x7285('0x20b'),_0x7285('0x20c'),_0x7285('0x20e')+_0x31a1a7));}if(_0x1a07cf<=0x0||isNaN(_0x1a07cf)){return _0x470e75(msgResponse(_0x7285('0x20b'),_0x7285('0x20c'),_0x7285('0x20f')+_0x1a07cf));}if(_0x51293a<=0x0||isNaN(_0x51293a)){return _0x470e75(msgResponse(_0x7285('0x20b'),_0x7285('0x20c'),_0x7285('0x210')+_0x51293a));}if(_0x1fee49<=0x0||isNaN(_0x1fee49)){return _0x470e75(msgResponse('[abandonmentRate]',_0x7285('0x20c'),_0x7285('0x211')+_0x1fee49));}_0x170d22=_0x170d22||0x0;var _0xc099b=0x1/_0x31a1a7;var _0x413e59=0x0;var _0x1e18bd=0x0;var _0x613c28=0x0;var _0x296cf0=0x0;for(var _0x15ecc7=0x0;_0x613c28<_0x1fee49;_0x15ecc7+=0x1){_0x1e18bd=_0x15ecc7/_0x51293a;_0x413e59=(_0x1a07cf*_0x1e18bd+_0x170d22)/_0xc099b;_0x613c28=utils[_0x7285('0x212')](_0x413e59,_0x107a47);_0x296cf0=_0x413e59/_0x107a47*(0x1-utils[_0x7285('0x212')](_0x413e59,_0x107a47));}return _0x2dc0f4({'erlangCalls':_0x15ecc7,'erlangCallToSecond':_0x51293a/_0x15ecc7,'erlangAbandonmentRate':_0x613c28,'erlangBusyFactor':_0x296cf0});});};Dialer[_0x7285('0x88')][_0x7285('0x1d0')]=function(_0xe0c842,_0x2fd1f1,_0x1152a5,_0x12415f,_0x3fb368,_0x17cd3a){loggerPredictive[_0x7285('0x4c')](_0x7285('0x213'));loggerPredictive[_0x7285('0x4c')](_0x7285('0x214'),_0xe0c842);loggerPredictive[_0x7285('0x4c')](_0x7285('0x208'),_0x2fd1f1);loggerPredictive[_0x7285('0x4c')](_0x7285('0x209'),_0x1152a5);loggerPredictive['info'](_0x7285('0x215'),_0x12415f);loggerPredictive[_0x7285('0x4c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3fb368);loggerPredictive[_0x7285('0x4c')](_0x7285('0x57'));return new Promise(function(_0x490a75,_0xd99240){if(_0xe0c842<=0x0||isNaN(_0xe0c842)){return _0xd99240(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0xe0c842));}if(_0x1152a5<=0x0||isNaN(_0x1152a5)){return _0xd99240(msgResponse(_0x7285('0x216'),_0x7285('0x20c'),'Ts\x20=\x20'+_0x1152a5));}if(_0x12415f<=0x0||isNaN(_0x12415f)){return _0xd99240(msgResponse('[busyFactor]',_0x7285('0x20c'),_0x7285('0x20f')+_0x12415f));}if(_0x2fd1f1<=0x0||isNaN(_0x2fd1f1)){return _0xd99240(msgResponse('[busyFactor]',_0x7285('0x20c'),_0x7285('0x210')+_0x2fd1f1));}if(_0x3fb368<=0x0||isNaN(_0x3fb368)){return _0xd99240(msgResponse('[busyFactor]','Error','Umin\x20=\x20'+_0x3fb368));}_0x17cd3a=_0x17cd3a||0x0;var _0x508bcd=0x1/_0x1152a5;var _0x52d170=0x0;var _0x445cc4=0x0;var _0xa385a7=0x0;var _0x11eaeb=0x0;for(var _0x564abd=0x0;_0x11eaeb<_0x3fb368;_0x564abd+=0x1){_0x445cc4=_0x564abd/_0x2fd1f1;_0x52d170=(_0x12415f*_0x445cc4+_0x17cd3a)/_0x508bcd;_0xa385a7=utils[_0x7285('0x212')](_0x52d170,_0xe0c842);_0x11eaeb=_0x52d170/_0xe0c842*(0x1-utils['erlangb'](_0x52d170,_0xe0c842));}return _0x490a75({'erlangCalls':_0x564abd,'erlangCallToSecond':_0x2fd1f1/_0x564abd,'erlangAbandonmentRate':_0xa385a7,'erlangBusyFactor':_0x11eaeb});});};module[_0x7285('0x217')]=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 211f7b4..7502204 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 _0xac54=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x1aad86,_0x5219f4){var _0x20df38=function(_0xda620c){while(--_0xda620c){_0x1aad86['push'](_0x1aad86['shift']());}};_0x20df38(++_0x5219f4);}(_0xac54,0xfd));var _0x4ac5=function(_0x84122c,_0x306ef4){_0x84122c=_0x84122c-0x0;var _0xef2b81=_0xac54[_0x84122c];return _0xef2b81;};'use strict';var util=require(_0x4ac5('0x0'));var _=require(_0x4ac5('0x1'));var moment=require(_0x4ac5('0x2'));function checkNameSurname(_0x373de,_0x4a88f4,_0x4c3ca6){var _0x74f5cf='';if(!_[_0x4ac5('0x3')](_0x4a88f4)&&'string'===typeof _0x4a88f4){_0x74f5cf+=_0x4a88f4;}if(!_[_0x4ac5('0x3')](_0x4c3ca6)&&_0x4ac5('0x4')===typeof _0x4c3ca6){_0x74f5cf+='\x20'+_0x4c3ca6;}if(_0x74f5cf!==''){return _0x74f5cf;}return _0x373de;}function Action(_0x4e884a,_0x45f610,_0x57e1e3){this[_0x4ac5('0x5')]=_0x4e884a;this[_0x4ac5('0x6')]=_0x57e1e3||undefined;this[_0x4ac5('0x7')]=checkNameSurname(_0x45f610['Contact']['phone'],_0x45f610[_0x4ac5('0x8')][_0x4ac5('0x9')],_0x45f610['Contact']['lastName']);this[_0x4ac5('0xa')]=_0x45f610[_0x4ac5('0xb')];this['queue']=_0x4e884a['name'];this[_0x4ac5('0xc')]=_0x45f610['active']||![];this[_0x4ac5('0xd')]=_0x4e884a[_0x4ac5('0xd')];this[_0x4ac5('0xe')]=_0x4e884a[_0x4ac5('0xe')]||0x3;this['scheduledat']=_0x45f610[_0x4ac5('0xf')];this[_0x4ac5('0x10')]=_0x45f610[_0x4ac5('0x10')];this[_0x4ac5('0x11')]=_0x45f610[_0x4ac5('0x11')];this[_0x4ac5('0x12')]=_0x45f610[_0x4ac5('0x12')];this[_0x4ac5('0x13')]=_0x45f610[_0x4ac5('0x13')];this[_0x4ac5('0x14')]=_0x45f610[_0x4ac5('0x14')];this[_0x4ac5('0x15')]=_0x45f610[_0x4ac5('0x15')];this[_0x4ac5('0x16')]=_0x45f610[_0x4ac5('0x16')];this['countagentrejectretry']=_0x45f610[_0x4ac5('0x17')];this[_0x4ac5('0x18')]=_0x45f610['ContactId'];this[_0x4ac5('0x19')]=_0x45f610[_0x4ac5('0x19')];this['UserId']=_0x45f610[_0x4ac5('0x1a')];this[_0x4ac5('0x1b')]=_0x45f610['VoiceQueueId'];this[_0x4ac5('0x1c')]=_0x45f610[_0x4ac5('0x1c')];this[_0x4ac5('0x1d')]=_0x45f610['id'];this[_0x4ac5('0x1e')]=_0x45f610[_0x4ac5('0x8')]['firstName']||'';this[_0x4ac5('0x1f')]=moment()[_0x4ac5('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4ac5('0x21')]=_0x45f610[_0x4ac5('0x21')];this[_0x4ac5('0x22')]=_0x45f610[_0x4ac5('0x22')];this[_0x4ac5('0x23')]=_0x45f610[_0x4ac5('0x23')];this[_0x4ac5('0x24')]=_0x45f610[_0x4ac5('0x24')];this[_0x4ac5('0x25')]='';this['originatecalleridname']='';}Action[_0x4ac5('0x26')][_0x4ac5('0x27')]=function(){return util[_0x4ac5('0x20')](_0x4ac5('0x28'),this[_0x4ac5('0x7')],this['voiceQueue'][_0x4ac5('0x29')]>0x0?this[_0x4ac5('0xa')][_0x4ac5('0x2a')](this['voiceQueue'][_0x4ac5('0x29')]):this[_0x4ac5('0xa')]);};Action[_0x4ac5('0x26')][_0x4ac5('0x2b')]=function(){return this[_0x4ac5('0x2c')];};module[_0x4ac5('0x2d')]=Action; \ No newline at end of file +var _0x0fe8=['Contact','phone','number','queue','name','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','format','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','string','isNil','voiceQueue'];(function(_0x525370,_0x5abe18){var _0x4a1ae9=function(_0x257f97){while(--_0x257f97){_0x525370['push'](_0x525370['shift']());}};_0x4a1ae9(++_0x5abe18);}(_0x0fe8,0x76));var _0x80fe=function(_0x52c1f6,_0x4f13a1){_0x52c1f6=_0x52c1f6-0x0;var _0x218cf6=_0x0fe8[_0x52c1f6];return _0x218cf6;};'use strict';var util=require(_0x80fe('0x0'));var _=require(_0x80fe('0x1'));var moment=require('moment');function checkNameSurname(_0x21f0ad,_0x4f1ce3,_0x524f4e){var _0x3602a0='';if(!_['isNil'](_0x4f1ce3)&&_0x80fe('0x2')===typeof _0x4f1ce3){_0x3602a0+=_0x4f1ce3;}if(!_[_0x80fe('0x3')](_0x524f4e)&&_0x80fe('0x2')===typeof _0x524f4e){_0x3602a0+='\x20'+_0x524f4e;}if(_0x3602a0!==''){return _0x3602a0;}return _0x21f0ad;}function Action(_0x357b6f,_0x89435e,_0x1ba10a){this[_0x80fe('0x4')]=_0x357b6f;this['uniqueid']=_0x1ba10a||undefined;this['name']=checkNameSurname(_0x89435e[_0x80fe('0x5')][_0x80fe('0x6')],_0x89435e[_0x80fe('0x5')]['firstName'],_0x89435e[_0x80fe('0x5')]['lastName']);this[_0x80fe('0x7')]=_0x89435e['phone'];this[_0x80fe('0x8')]=_0x357b6f[_0x80fe('0x9')];this['active']=_0x89435e['active']||![];this[_0x80fe('0xa')]=_0x357b6f[_0x80fe('0xa')];this[_0x80fe('0xb')]=_0x357b6f[_0x80fe('0xb')]||0x3;this[_0x80fe('0xc')]=_0x89435e[_0x80fe('0xc')];this[_0x80fe('0xd')]=_0x89435e[_0x80fe('0xd')];this[_0x80fe('0xe')]=_0x89435e[_0x80fe('0xe')];this[_0x80fe('0xf')]=_0x89435e['countnoanswerretry'];this[_0x80fe('0x10')]=_0x89435e[_0x80fe('0x10')];this[_0x80fe('0x11')]=_0x89435e[_0x80fe('0x11')];this[_0x80fe('0x12')]=_0x89435e['countabandonedretry'];this[_0x80fe('0x13')]=_0x89435e[_0x80fe('0x13')];this[_0x80fe('0x14')]=_0x89435e[_0x80fe('0x14')];this[_0x80fe('0x15')]=_0x89435e[_0x80fe('0x15')];this[_0x80fe('0x16')]=_0x89435e['ListId'];this[_0x80fe('0x17')]=_0x89435e['UserId'];this[_0x80fe('0x18')]=_0x89435e[_0x80fe('0x18')];this['CampaignId']=_0x89435e[_0x80fe('0x19')];this[_0x80fe('0x1a')]=_0x89435e['id'];this[_0x80fe('0x1b')]=_0x89435e['Contact'][_0x80fe('0x1c')]||'';this['starttime']=moment()[_0x80fe('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x89435e['callback'];this[_0x80fe('0x1e')]=_0x89435e[_0x80fe('0x1e')];this['callbackat']=_0x89435e[_0x80fe('0x1f')];this['recallme']=_0x89435e[_0x80fe('0x20')];this[_0x80fe('0x21')]='';this[_0x80fe('0x22')]='';}Action[_0x80fe('0x23')]['getCaller']=function(){return util[_0x80fe('0x1d')](_0x80fe('0x24'),this[_0x80fe('0x9')],this[_0x80fe('0x4')][_0x80fe('0x25')]>0x0?this['number'][_0x80fe('0x26')](this[_0x80fe('0x4')][_0x80fe('0x25')]):this['number']);};Action['prototype'][_0x80fe('0x27')]=function(){return this[_0x80fe('0x8')];};module[_0x80fe('0x28')]=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 22b8663..7d8b460 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 _0xcdee=['originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x2ca4a3,_0x3e8080){var _0x303b7f=function(_0x16d45b){while(--_0x16d45b){_0x2ca4a3['push'](_0x2ca4a3['shift']());}};_0x303b7f(++_0x3e8080);}(_0xcdee,0xea));var _0xecde=function(_0x2a86fa,_0x32da60){_0x2a86fa=_0x2a86fa-0x0;var _0xee86c=_0xcdee[_0x2a86fa];return _0xee86c;};'use strict';var moment=require(_0xecde('0x0'));var utils=require(_0xecde('0x1'));function AgentComplete(_0x59e7fa,_0x2534ef){this[_0xecde('0x2')]=0x4;this[_0xecde('0x3')]=_0xecde('0x4');this['scheduledat']=_0x59e7fa['scheduledat'];this[_0xecde('0x5')]=_0x59e7fa[_0xecde('0x5')];this[_0xecde('0x6')]=_0x59e7fa[_0xecde('0x5')]===_0xecde('0x7')?_0xecde('0x8'):_0x59e7fa[_0xecde('0x5')];this[_0xecde('0x9')]=_0x59e7fa[_0xecde('0x9')];this[_0xecde('0xa')]=_0x59e7fa['countcongestionretry'];this[_0xecde('0xb')]=_0x59e7fa[_0xecde('0xb')];this[_0xecde('0xc')]=_0x59e7fa[_0xecde('0x9')]+_0x59e7fa[_0xecde('0xa')]+_0x59e7fa[_0xecde('0xb')]+_0x59e7fa[_0xecde('0xd')]+_0x59e7fa[_0xecde('0xe')]+_0x59e7fa[_0xecde('0xf')]+_0x59e7fa[_0xecde('0x10')]+_0x59e7fa[_0xecde('0x11')];this[_0xecde('0xd')]=_0x59e7fa[_0xecde('0xd')];this['countdropretry']=_0x59e7fa[_0xecde('0xe')];this[_0xecde('0xf')]=_0x59e7fa[_0xecde('0xf')];this[_0xecde('0x10')]=_0x59e7fa[_0xecde('0x10')];this[_0xecde('0x11')]=_0x59e7fa[_0xecde('0x11')];this[_0xecde('0x12')]=_0x2534ef[_0xecde('0x12')];this[_0xecde('0x13')]=_0x59e7fa[_0xecde('0x14')];this[_0xecde('0x15')]=_0x59e7fa[_0xecde('0x16')];this[_0xecde('0x17')]=_0x59e7fa['starttime'];this[_0xecde('0x18')]=_0x59e7fa['responsetime'];this[_0xecde('0x19')]=_0x59e7fa[_0xecde('0x19')];this[_0xecde('0x1a')]=moment()[_0xecde('0x1b')](_0xecde('0x1c'));this['ringtime']=utils[_0xecde('0x1d')](_0x59e7fa[_0xecde('0x18')],_0x59e7fa['starttime']);this[_0xecde('0x1e')]=utils[_0xecde('0x1d')](_0x59e7fa[_0xecde('0x19')],_0x59e7fa[_0xecde('0x18')]);this[_0xecde('0x1f')]=utils[_0xecde('0x1d')](this[_0xecde('0x1a')],_0x59e7fa[_0xecde('0x19')]);this['queue']=_0x2534ef[_0xecde('0x8')];this[_0xecde('0x20')]=_0x2534ef[_0xecde('0x20')];this[_0xecde('0x21')]=_0x2534ef[_0xecde('0x21')];this[_0xecde('0x22')]=_0x59e7fa[_0xecde('0x22')];this[_0xecde('0x23')]=_0x59e7fa[_0xecde('0x23')];this['callbackat']=_0x59e7fa['callbackat'];this[_0xecde('0x24')]=_0x59e7fa['recallme'];this[_0xecde('0x25')]=_0x59e7fa[_0xecde('0x25')];this[_0xecde('0x26')]=_0x59e7fa[_0xecde('0x26')];this[_0xecde('0x27')]=_0x59e7fa[_0xecde('0x27')];this[_0xecde('0x28')]=_0x59e7fa[_0xecde('0x28')];this['CampaignId']=_0x59e7fa[_0xecde('0x29')];this[_0xecde('0x2a')]=_0x59e7fa[_0xecde('0x2a')]||'';this['originatecalleridname']=_0x59e7fa[_0xecde('0x2b')]||'';this['agiafterat']=_0x59e7fa[_0xecde('0x2c')];}module[_0xecde('0x2d')]=AgentComplete; \ No newline at end of file +var _0x4927=['countnosuchnumberretry','countmachineretry','uniqueid','name','number','starttime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x55bb33,_0x1a69be){var _0x43f075=function(_0x29036b){while(--_0x29036b){_0x55bb33['push'](_0x55bb33['shift']());}};_0x43f075(++_0x1a69be);}(_0x4927,0xa8));var _0x7492=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4927[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require(_0x7492('0x0'));var utils=require(_0x7492('0x1'));function AgentComplete(_0x4eb982,_0xc2b644){this[_0x7492('0x2')]=0x4;this[_0x7492('0x3')]=_0x7492('0x4');this[_0x7492('0x5')]=_0x4eb982['scheduledat'];this[_0x7492('0x6')]=_0x4eb982[_0x7492('0x6')];this['campaigntype']=_0x4eb982[_0x7492('0x6')]===_0x7492('0x7')?_0x7492('0x8'):_0x4eb982[_0x7492('0x6')];this[_0x7492('0x9')]=_0x4eb982['countbusyretry'];this[_0x7492('0xa')]=_0x4eb982[_0x7492('0xa')];this[_0x7492('0xb')]=_0x4eb982[_0x7492('0xb')];this[_0x7492('0xc')]=_0x4eb982['countbusyretry']+_0x4eb982[_0x7492('0xa')]+_0x4eb982[_0x7492('0xb')]+_0x4eb982['countnosuchnumberretry']+_0x4eb982[_0x7492('0xd')]+_0x4eb982[_0x7492('0xe')]+_0x4eb982['countmachineretry']+_0x4eb982[_0x7492('0xf')];this['countnosuchnumberretry']=_0x4eb982[_0x7492('0x10')];this[_0x7492('0xd')]=_0x4eb982[_0x7492('0xd')];this[_0x7492('0xe')]=_0x4eb982[_0x7492('0xe')];this['countmachineretry']=_0x4eb982[_0x7492('0x11')];this['countagentrejectretry']=_0x4eb982[_0x7492('0xf')];this[_0x7492('0x12')]=_0xc2b644[_0x7492('0x12')];this['calleridname']=_0x4eb982[_0x7492('0x13')];this['calleridnum']=_0x4eb982[_0x7492('0x14')];this['starttime']=_0x4eb982[_0x7492('0x15')];this['responsetime']=_0x4eb982['responsetime'];this[_0x7492('0x16')]=_0x4eb982[_0x7492('0x16')];this[_0x7492('0x17')]=moment()[_0x7492('0x18')](_0x7492('0x19'));this[_0x7492('0x1a')]=utils[_0x7492('0x1b')](_0x4eb982[_0x7492('0x1c')],_0x4eb982['starttime']);this[_0x7492('0x1d')]=utils[_0x7492('0x1b')](_0x4eb982['answertime'],_0x4eb982['responsetime']);this[_0x7492('0x1e')]=utils['getSeconds'](this[_0x7492('0x17')],_0x4eb982[_0x7492('0x16')]);this[_0x7492('0x8')]=_0xc2b644['queue'];this[_0x7492('0x1f')]=_0xc2b644[_0x7492('0x1f')];this[_0x7492('0x20')]=_0xc2b644[_0x7492('0x20')];this[_0x7492('0x21')]=_0x4eb982[_0x7492('0x21')];this[_0x7492('0x22')]=_0x4eb982[_0x7492('0x22')];this[_0x7492('0x23')]=_0x4eb982[_0x7492('0x23')];this['recallme']=_0x4eb982[_0x7492('0x24')];this[_0x7492('0x25')]=_0x4eb982[_0x7492('0x25')];this[_0x7492('0x26')]=_0x4eb982[_0x7492('0x26')];this[_0x7492('0x27')]=_0x4eb982['UserId'];this[_0x7492('0x28')]=_0x4eb982[_0x7492('0x28')];this[_0x7492('0x29')]=_0x4eb982['CampaignId'];this[_0x7492('0x2a')]=_0x4eb982[_0x7492('0x2a')]||'';this[_0x7492('0x2b')]=_0x4eb982[_0x7492('0x2b')]||'';this[_0x7492('0x2c')]=_0x4eb982[_0x7492('0x2c')];}module[_0x7492('0x2d')]=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 520744e..a5ecf14 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 _0x0ced=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','campaigntype','type','outbound'];(function(_0x5308ff,_0x593ed4){var _0x38e643=function(_0x248dc5){while(--_0x248dc5){_0x5308ff['push'](_0x5308ff['shift']());}};_0x38e643(++_0x593ed4);}(_0x0ced,0xe9));var _0xd0ce=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x0ced[_0x1deb03];return _0x189fe7;};'use strict';function Final(_0x54bc47){this[_0xd0ce('0x0')]=_0x54bc47[_0xd0ce('0x0')];this['scheduledat']=_0x54bc47[_0xd0ce('0x1')];this['type']=_0x54bc47['type'];this[_0xd0ce('0x2')]=_0x54bc47[_0xd0ce('0x3')]===_0xd0ce('0x4')?'queue':_0x54bc47[_0xd0ce('0x3')];this[_0xd0ce('0x5')]=_0x54bc47[_0xd0ce('0x5')];this[_0xd0ce('0x6')]=_0x54bc47[_0xd0ce('0x6')];this[_0xd0ce('0x7')]=_0x54bc47[_0xd0ce('0x7')];this[_0xd0ce('0x8')]=_0x54bc47[_0xd0ce('0x5')]+_0x54bc47['countcongestionretry']+_0x54bc47[_0xd0ce('0x7')]+_0x54bc47['countnosuchnumberretry']+_0x54bc47[_0xd0ce('0x9')]+_0x54bc47[_0xd0ce('0xa')]+_0x54bc47[_0xd0ce('0xb')]+_0x54bc47['countagentrejectretry'];this[_0xd0ce('0xc')]=_0x54bc47['countnosuchnumberretry'];this['countdropretry']=_0x54bc47[_0xd0ce('0x9')];this[_0xd0ce('0xa')]=_0x54bc47['countabandonedretry'];this[_0xd0ce('0xb')]=_0x54bc47[_0xd0ce('0xb')];this['countagentrejectretry']=_0x54bc47[_0xd0ce('0xd')];this[_0xd0ce('0xe')]=_0x54bc47[_0xd0ce('0xe')];this[_0xd0ce('0xf')]=_0x54bc47['calleridname'];this[_0xd0ce('0x10')]=_0x54bc47[_0xd0ce('0x10')];this[_0xd0ce('0x11')]=_0x54bc47[_0xd0ce('0x11')];this['responsetime']=_0x54bc47[_0xd0ce('0x12')];this[_0xd0ce('0x13')]=_0x54bc47['responsetime'];this['ringtime']=_0x54bc47['ringtime']||0x0;this[_0xd0ce('0x14')]=_0x54bc47[_0xd0ce('0x14')]||0x0;this[_0xd0ce('0x15')]=_0x54bc47[_0xd0ce('0x15')]||0x0;this[_0xd0ce('0x16')]=_0x54bc47['callback'];this['callbackuniqueid']=_0x54bc47[_0xd0ce('0x17')];this['callbackat']=_0x54bc47[_0xd0ce('0x18')];this[_0xd0ce('0x19')]=_0x54bc47[_0xd0ce('0x19')];this[_0xd0ce('0x1a')]=_0x54bc47[_0xd0ce('0x1a')];this[_0xd0ce('0x1b')]=_0x54bc47[_0xd0ce('0x1b')];this['UserId']=_0x54bc47['UserId'];this['VoiceQueueId']=_0x54bc47[_0xd0ce('0x1c')];this[_0xd0ce('0x1d')]=_0x54bc47[_0xd0ce('0x1d')];this[_0xd0ce('0x1e')]=_0x54bc47[_0xd0ce('0x1e')]||'';this[_0xd0ce('0x1f')]=_0x54bc47[_0xd0ce('0x1f')]||'';this['state']=_0x54bc47[_0xd0ce('0x20')];this[_0xd0ce('0x21')]=_0x54bc47['statedesc'];}module['exports']=Final; \ No newline at end of file +var _0x2707=['countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry'];(function(_0x567bcb,_0x4978c1){var _0x4eebc2=function(_0x42a456){while(--_0x42a456){_0x567bcb['push'](_0x567bcb['shift']());}};_0x4eebc2(++_0x4978c1);}(_0x2707,0x1f1));var _0x7270=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x2707[_0x172747];return _0x509692;};'use strict';function Final(_0x4ce573){this[_0x7270('0x0')]=_0x4ce573[_0x7270('0x0')];this[_0x7270('0x1')]=_0x4ce573[_0x7270('0x1')];this['type']=_0x4ce573[_0x7270('0x2')];this['campaigntype']=_0x4ce573[_0x7270('0x2')]===_0x7270('0x3')?_0x7270('0x4'):_0x4ce573['type'];this[_0x7270('0x5')]=_0x4ce573['countbusyretry'];this[_0x7270('0x6')]=_0x4ce573[_0x7270('0x6')];this['countnoanswerretry']=_0x4ce573[_0x7270('0x7')];this[_0x7270('0x8')]=_0x4ce573[_0x7270('0x5')]+_0x4ce573['countcongestionretry']+_0x4ce573[_0x7270('0x7')]+_0x4ce573[_0x7270('0x9')]+_0x4ce573['countdropretry']+_0x4ce573[_0x7270('0xa')]+_0x4ce573['countmachineretry']+_0x4ce573[_0x7270('0xb')];this[_0x7270('0x9')]=_0x4ce573[_0x7270('0x9')];this[_0x7270('0xc')]=_0x4ce573[_0x7270('0xc')];this[_0x7270('0xa')]=_0x4ce573[_0x7270('0xa')];this['countmachineretry']=_0x4ce573[_0x7270('0xd')];this[_0x7270('0xb')]=_0x4ce573[_0x7270('0xb')];this['queue']=_0x4ce573[_0x7270('0x4')];this[_0x7270('0xe')]=_0x4ce573[_0x7270('0xe')];this[_0x7270('0xf')]=_0x4ce573[_0x7270('0xf')];this[_0x7270('0x10')]=_0x4ce573[_0x7270('0x10')];this[_0x7270('0x11')]=_0x4ce573[_0x7270('0x11')];this[_0x7270('0x12')]=_0x4ce573[_0x7270('0x11')];this[_0x7270('0x13')]=_0x4ce573[_0x7270('0x13')]||0x0;this[_0x7270('0x14')]=_0x4ce573[_0x7270('0x14')]||0x0;this['talktime']=_0x4ce573[_0x7270('0x15')]||0x0;this[_0x7270('0x16')]=_0x4ce573['callback'];this[_0x7270('0x17')]=_0x4ce573['callbackuniqueid'];this[_0x7270('0x18')]=_0x4ce573[_0x7270('0x18')];this[_0x7270('0x19')]=_0x4ce573[_0x7270('0x19')];this[_0x7270('0x1a')]=_0x4ce573[_0x7270('0x1a')];this[_0x7270('0x1b')]=_0x4ce573[_0x7270('0x1b')];this[_0x7270('0x1c')]=_0x4ce573[_0x7270('0x1c')];this[_0x7270('0x1d')]=_0x4ce573[_0x7270('0x1d')];this['CampaignId']=_0x4ce573['CampaignId'];this['originatecalleridnum']=_0x4ce573[_0x7270('0x1e')]||'';this[_0x7270('0x1f')]=_0x4ce573['originatecalleridname']||'';this[_0x7270('0x20')]=_0x4ce573[_0x7270('0x20')];this[_0x7270('0x21')]=_0x4ce573[_0x7270('0x21')];}module['exports']=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 98416c5..d449d3c 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 _0x7a43=['Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state'];(function(_0xa09242,_0x13dfdc){var _0x411cd0=function(_0x88dbe4){while(--_0x88dbe4){_0xa09242['push'](_0xa09242['shift']());}};_0x411cd0(++_0x13dfdc);}(_0x7a43,0x1c0));var _0x37a4=function(_0x29841e,_0x1f195e){_0x29841e=_0x29841e-0x0;var _0x405b8d=_0x7a43[_0x29841e];return _0x405b8d;};'use strict';var moment=require(_0x37a4('0x0'));var utils=require(_0x37a4('0x1'));function Hangup(_0x5cbe8e,_0x3851e1){this[_0x37a4('0x2')]=0x4;this['statedesc']=_0x37a4('0x3');this[_0x37a4('0x4')]=_0x5cbe8e[_0x37a4('0x4')];this['type']=_0x5cbe8e[_0x37a4('0x5')];this[_0x37a4('0x6')]=_0x5cbe8e[_0x37a4('0x5')]===_0x37a4('0x7')?_0x37a4('0x8'):_0x5cbe8e[_0x37a4('0x5')];this[_0x37a4('0x9')]=_0x5cbe8e['amd']||![];this[_0x37a4('0xa')]=_0x5cbe8e[_0x37a4('0xa')];this['countcongestionretry']=_0x5cbe8e['countcongestionretry'];this[_0x37a4('0xb')]=_0x5cbe8e['countnoanswerretry'];this[_0x37a4('0xc')]=_0x5cbe8e['countbusyretry']+_0x5cbe8e['countcongestionretry']+_0x5cbe8e[_0x37a4('0xb')]+_0x5cbe8e[_0x37a4('0xd')]+_0x5cbe8e[_0x37a4('0xe')]+_0x5cbe8e['countabandonedretry']+_0x5cbe8e[_0x37a4('0xf')]+_0x5cbe8e[_0x37a4('0x10')];this[_0x37a4('0xd')]=_0x5cbe8e[_0x37a4('0xd')];this[_0x37a4('0xe')]=_0x5cbe8e[_0x37a4('0xe')];this[_0x37a4('0x11')]=_0x5cbe8e[_0x37a4('0x11')];this[_0x37a4('0xf')]=_0x5cbe8e[_0x37a4('0xf')];this[_0x37a4('0x10')]=_0x5cbe8e['countagentrejectretry'];this[_0x37a4('0x12')]=_0x3851e1[_0x37a4('0x12')];this[_0x37a4('0x13')]=_0x5cbe8e[_0x37a4('0x14')];this[_0x37a4('0x15')]=_0x5cbe8e['number'];this[_0x37a4('0x16')]=_0x5cbe8e[_0x37a4('0x16')];this[_0x37a4('0x17')]=_0x5cbe8e[_0x37a4('0x17')];this[_0x37a4('0x18')]=moment()[_0x37a4('0x19')](_0x37a4('0x1a'));this[_0x37a4('0x1b')]=utils[_0x37a4('0x1c')](_0x5cbe8e[_0x37a4('0x17')],_0x5cbe8e['starttime']);this['holdtime']=0x0;this[_0x37a4('0x1d')]=utils['getSeconds'](this['endtime'],_0x5cbe8e[_0x37a4('0x17')]);this[_0x37a4('0x8')]=_0x5cbe8e['queue'];this['membername']=_0x37a4('0x1e');this[_0x37a4('0x1f')]=_0x3851e1['cause-txt'];this[_0x37a4('0x20')]=_0x5cbe8e['callback'];this[_0x37a4('0x21')]=_0x5cbe8e[_0x37a4('0x21')];this[_0x37a4('0x22')]=_0x5cbe8e[_0x37a4('0x22')];this[_0x37a4('0x23')]=_0x5cbe8e[_0x37a4('0x23')];this[_0x37a4('0x24')]=_0x5cbe8e[_0x37a4('0x24')];this[_0x37a4('0x25')]=_0x5cbe8e[_0x37a4('0x25')];this['UserId']=_0x5cbe8e[_0x37a4('0x26')];this[_0x37a4('0x27')]=_0x5cbe8e[_0x37a4('0x27')];this['CampaignId']=_0x5cbe8e[_0x37a4('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0x4c98=['calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','Answer','scheduledat','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name'];(function(_0x13896c,_0x419715){var _0x5e5ef8=function(_0x4c977d){while(--_0x4c977d){_0x13896c['push'](_0x13896c['shift']());}};_0x5e5ef8(++_0x419715);}(_0x4c98,0x144));var _0x84c9=function(_0x3e1388,_0x17faa2){_0x3e1388=_0x3e1388-0x0;var _0xb0adab=_0x4c98[_0x3e1388];return _0xb0adab;};'use strict';var moment=require(_0x84c9('0x0'));var utils=require(_0x84c9('0x1'));function Hangup(_0x889a8c,_0x3875e2){this['state']=0x4;this['statedesc']=_0x84c9('0x2');this['scheduledat']=_0x889a8c[_0x84c9('0x3')];this['type']=_0x889a8c[_0x84c9('0x4')];this['campaigntype']=_0x889a8c[_0x84c9('0x4')]==='outbound'?_0x84c9('0x5'):_0x889a8c[_0x84c9('0x4')];this[_0x84c9('0x6')]=_0x889a8c[_0x84c9('0x6')]||![];this[_0x84c9('0x7')]=_0x889a8c[_0x84c9('0x7')];this['countcongestionretry']=_0x889a8c[_0x84c9('0x8')];this[_0x84c9('0x9')]=_0x889a8c['countnoanswerretry'];this['countglobal']=_0x889a8c['countbusyretry']+_0x889a8c[_0x84c9('0x8')]+_0x889a8c[_0x84c9('0x9')]+_0x889a8c['countnosuchnumberretry']+_0x889a8c[_0x84c9('0xa')]+_0x889a8c[_0x84c9('0xb')]+_0x889a8c[_0x84c9('0xc')]+_0x889a8c[_0x84c9('0xd')];this[_0x84c9('0xe')]=_0x889a8c[_0x84c9('0xe')];this[_0x84c9('0xa')]=_0x889a8c[_0x84c9('0xa')];this[_0x84c9('0xb')]=_0x889a8c[_0x84c9('0xb')];this[_0x84c9('0xc')]=_0x889a8c[_0x84c9('0xc')];this[_0x84c9('0xd')]=_0x889a8c['countagentrejectretry'];this[_0x84c9('0xf')]=_0x3875e2['uniqueid'];this[_0x84c9('0x10')]=_0x889a8c[_0x84c9('0x11')];this[_0x84c9('0x12')]=_0x889a8c[_0x84c9('0x13')];this[_0x84c9('0x14')]=_0x889a8c[_0x84c9('0x14')];this['responsetime']=_0x889a8c[_0x84c9('0x15')];this[_0x84c9('0x16')]=moment()[_0x84c9('0x17')](_0x84c9('0x18'));this[_0x84c9('0x19')]=utils[_0x84c9('0x1a')](_0x889a8c['responsetime'],_0x889a8c[_0x84c9('0x14')]);this['holdtime']=0x0;this[_0x84c9('0x1b')]=utils[_0x84c9('0x1a')](this[_0x84c9('0x16')],_0x889a8c[_0x84c9('0x15')]);this[_0x84c9('0x5')]=_0x889a8c[_0x84c9('0x5')];this[_0x84c9('0x1c')]='IVR';this['reason']=_0x3875e2['cause-txt'];this[_0x84c9('0x1d')]=_0x889a8c['callback'];this['callbackuniqueid']=_0x889a8c['callbackuniqueid'];this[_0x84c9('0x1e')]=_0x889a8c['callbackat'];this[_0x84c9('0x1f')]=_0x889a8c[_0x84c9('0x1f')];this[_0x84c9('0x20')]=_0x889a8c[_0x84c9('0x20')];this[_0x84c9('0x21')]=_0x889a8c[_0x84c9('0x21')];this['UserId']=_0x889a8c[_0x84c9('0x22')];this['VoiceQueueId']=_0x889a8c[_0x84c9('0x23')];this[_0x84c9('0x24')]=_0x889a8c[_0x84c9('0x24')];}module[_0x84c9('0x25')]=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 e4ee953..db43c1a 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 _0xdca0=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','responsetime','endtime','ringtime','getSeconds','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','outbound','queue','countbusyretry'];(function(_0x596791,_0x4526b6){var _0x201ff1=function(_0x34f2fe){while(--_0x34f2fe){_0x596791['push'](_0x596791['shift']());}};_0x201ff1(++_0x4526b6);}(_0xdca0,0x6e));var _0x0dca=function(_0xb4bed2,_0x1ba3db){_0xb4bed2=_0xb4bed2-0x0;var _0x17a2a5=_0xdca0[_0xb4bed2];return _0x17a2a5;};'use strict';var utils=require(_0x0dca('0x0'));function History(_0x1d19ae){this[_0x0dca('0x1')]=_0x1d19ae[_0x0dca('0x1')];this[_0x0dca('0x2')]=_0x1d19ae[_0x0dca('0x2')]||undefined;this[_0x0dca('0x3')]=_0x1d19ae[_0x0dca('0x3')];this['campaigntype']=_0x1d19ae['type']===_0x0dca('0x4')?_0x0dca('0x5'):_0x1d19ae[_0x0dca('0x3')];this['countbusyretry']=_0x1d19ae[_0x0dca('0x6')];this[_0x0dca('0x7')]=_0x1d19ae['countcongestionretry'];this[_0x0dca('0x8')]=_0x1d19ae[_0x0dca('0x8')];this[_0x0dca('0x9')]=_0x1d19ae['countbusyretry']+_0x1d19ae[_0x0dca('0x7')]+_0x1d19ae[_0x0dca('0x8')]+_0x1d19ae['countnosuchnumberretry']+_0x1d19ae[_0x0dca('0xa')]+_0x1d19ae[_0x0dca('0xb')]+_0x1d19ae[_0x0dca('0xc')]+_0x1d19ae[_0x0dca('0xd')];this['countnosuchnumberretry']=_0x1d19ae[_0x0dca('0xe')];this[_0x0dca('0xa')]=_0x1d19ae['countdropretry'];this['countabandonedretry']=_0x1d19ae[_0x0dca('0xb')];this['countmachineretry']=_0x1d19ae['countmachineretry'];this[_0x0dca('0xd')]=_0x1d19ae[_0x0dca('0xd')];this['queue']=_0x1d19ae[_0x0dca('0x5')];this[_0x0dca('0xf')]=_0x1d19ae[_0x0dca('0x10')];this[_0x0dca('0x11')]=_0x1d19ae[_0x0dca('0x12')];this['starttime']=_0x1d19ae['starttime'];this['responsetime']=_0x1d19ae[_0x0dca('0x13')];this[_0x0dca('0x14')]=_0x1d19ae[_0x0dca('0x13')];this[_0x0dca('0x15')]=utils[_0x0dca('0x16')](_0x1d19ae[_0x0dca('0x13')],_0x1d19ae[_0x0dca('0x17')]);this[_0x0dca('0x18')]=0x0;this[_0x0dca('0x19')]=0x0;this[_0x0dca('0x1a')]=_0x1d19ae[_0x0dca('0x1a')];this[_0x0dca('0x1b')]=_0x1d19ae[_0x0dca('0x1b')];this[_0x0dca('0x1c')]=_0x1d19ae[_0x0dca('0x1c')];this['recallme']=_0x1d19ae[_0x0dca('0x1d')];this[_0x0dca('0x1e')]=_0x1d19ae['ContactId'];this['ListId']=_0x1d19ae[_0x0dca('0x1f')];this[_0x0dca('0x20')]=_0x1d19ae['UserId'];this['VoiceQueueId']=_0x1d19ae[_0x0dca('0x21')];this[_0x0dca('0x22')]=_0x1d19ae[_0x0dca('0x22')];this[_0x0dca('0x23')]=_0x1d19ae[_0x0dca('0x23')]||'';this['originatecalleridname']=_0x1d19ae[_0x0dca('0x24')]||'';this['state']=_0x1d19ae[_0x0dca('0x25')];this[_0x0dca('0x26')]=_0x1d19ae[_0x0dca('0x26')];}module['exports']=History; \ No newline at end of file +var _0x79dd=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callbackat','recallme'];(function(_0x204e14,_0x430bda){var _0x218450=function(_0x489589){while(--_0x489589){_0x204e14['push'](_0x204e14['shift']());}};_0x218450(++_0x430bda);}(_0x79dd,0xb3));var _0xd79d=function(_0x4a8812,_0x430080){_0x4a8812=_0x4a8812-0x0;var _0x55a784=_0x79dd[_0x4a8812];return _0x55a784;};'use strict';var utils=require('../utils');function History(_0x1ff63b){this[_0xd79d('0x0')]=_0x1ff63b[_0xd79d('0x0')];this[_0xd79d('0x1')]=_0x1ff63b['scheduledat']||undefined;this[_0xd79d('0x2')]=_0x1ff63b[_0xd79d('0x2')];this['campaigntype']=_0x1ff63b[_0xd79d('0x2')]===_0xd79d('0x3')?_0xd79d('0x4'):_0x1ff63b[_0xd79d('0x2')];this[_0xd79d('0x5')]=_0x1ff63b[_0xd79d('0x5')];this[_0xd79d('0x6')]=_0x1ff63b[_0xd79d('0x6')];this[_0xd79d('0x7')]=_0x1ff63b[_0xd79d('0x7')];this[_0xd79d('0x8')]=_0x1ff63b['countbusyretry']+_0x1ff63b[_0xd79d('0x6')]+_0x1ff63b['countnoanswerretry']+_0x1ff63b[_0xd79d('0x9')]+_0x1ff63b[_0xd79d('0xa')]+_0x1ff63b[_0xd79d('0xb')]+_0x1ff63b[_0xd79d('0xc')]+_0x1ff63b[_0xd79d('0xd')];this[_0xd79d('0x9')]=_0x1ff63b[_0xd79d('0x9')];this[_0xd79d('0xa')]=_0x1ff63b[_0xd79d('0xa')];this[_0xd79d('0xb')]=_0x1ff63b[_0xd79d('0xb')];this[_0xd79d('0xc')]=_0x1ff63b['countmachineretry'];this[_0xd79d('0xd')]=_0x1ff63b[_0xd79d('0xd')];this[_0xd79d('0x4')]=_0x1ff63b['queue'];this['calleridname']=_0x1ff63b[_0xd79d('0xe')];this[_0xd79d('0xf')]=_0x1ff63b[_0xd79d('0x10')];this[_0xd79d('0x11')]=_0x1ff63b[_0xd79d('0x11')];this[_0xd79d('0x12')]=_0x1ff63b[_0xd79d('0x12')];this[_0xd79d('0x13')]=_0x1ff63b[_0xd79d('0x12')];this[_0xd79d('0x14')]=utils[_0xd79d('0x15')](_0x1ff63b[_0xd79d('0x12')],_0x1ff63b[_0xd79d('0x11')]);this[_0xd79d('0x16')]=0x0;this['talktime']=0x0;this['callback']=_0x1ff63b['callback'];this['callbackuniqueid']=_0x1ff63b['callbackuniqueid'];this[_0xd79d('0x17')]=_0x1ff63b['callbackat'];this[_0xd79d('0x18')]=_0x1ff63b[_0xd79d('0x18')];this['ContactId']=_0x1ff63b[_0xd79d('0x19')];this[_0xd79d('0x1a')]=_0x1ff63b[_0xd79d('0x1a')];this[_0xd79d('0x1b')]=_0x1ff63b[_0xd79d('0x1b')];this['VoiceQueueId']=_0x1ff63b[_0xd79d('0x1c')];this['CampaignId']=_0x1ff63b[_0xd79d('0x1d')];this[_0xd79d('0x1e')]=_0x1ff63b[_0xd79d('0x1e')]||'';this['originatecalleridname']=_0x1ff63b[_0xd79d('0x1f')]||'';this[_0xd79d('0x20')]=_0x1ff63b['state'];this[_0xd79d('0x21')]=_0x1ff63b[_0xd79d('0x21')];}module['exports']=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 7bd5106..b7ad31a 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 _0x812a=['dropreason','endtime','ringtime','getSeconds','starttime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridnum','number','responsetime','droptime'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x812a,0xe3));var _0xa812=function(_0x184181,_0x20eb5b){_0x184181=_0x184181-0x0;var _0x329022=_0x812a[_0x184181];return _0x329022;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x5f5328,_0x46443b){this[_0xa812('0x0')]=_0x5f5328[_0xa812('0x0')];this[_0xa812('0x1')]=_0x5f5328[_0xa812('0x1')];this[_0xa812('0x2')]=_0x5f5328[_0xa812('0x1')]===_0xa812('0x3')?_0xa812('0x4'):_0x5f5328[_0xa812('0x1')];this['countbusyretry']=_0x5f5328[_0xa812('0x5')];this[_0xa812('0x6')]=_0x5f5328['countcongestionretry'];this[_0xa812('0x7')]=_0x5f5328[_0xa812('0x7')];this[_0xa812('0x8')]=_0x5f5328[_0xa812('0x5')]+_0x5f5328[_0xa812('0x6')]+_0x5f5328[_0xa812('0x7')]+_0x5f5328['countnosuchnumberretry']+_0x5f5328[_0xa812('0x9')]+_0x5f5328['countabandonedretry']+_0x5f5328[_0xa812('0xa')]+_0x5f5328[_0xa812('0xb')];this[_0xa812('0xc')]=_0x5f5328[_0xa812('0xc')];this[_0xa812('0x9')]=_0x5f5328[_0xa812('0x9')];this['countabandonedretry']=_0x5f5328[_0xa812('0xd')];this[_0xa812('0xa')]=_0x5f5328[_0xa812('0xa')];this[_0xa812('0xb')]=_0x5f5328[_0xa812('0xb')];this['uniqueid']=_0x46443b[_0xa812('0xe')];this['calleridname']=_0x5f5328['name'];this[_0xa812('0xf')]=_0x5f5328[_0xa812('0x10')];this['starttime']=_0x5f5328['starttime'];this[_0xa812('0x11')]=_0x5f5328[_0xa812('0x11')];this[_0xa812('0x12')]=_0x5f5328[_0xa812('0x12')];this['dropreason']=_0x5f5328[_0xa812('0x13')];this[_0xa812('0x14')]=this[_0xa812('0x12')];this[_0xa812('0x15')]=utils[_0xa812('0x16')](_0x5f5328['responsetime'],_0x5f5328[_0xa812('0x17')]);this[_0xa812('0x18')]=utils[_0xa812('0x16')](this[_0xa812('0x12')],_0x5f5328['responsetime']);this[_0xa812('0x19')]=0x0;this[_0xa812('0x4')]=_0x46443b[_0xa812('0x4')];this['membername']=_0x46443b[_0xa812('0x1a')];this[_0xa812('0x1b')]=_0x46443b[_0xa812('0x1b')];this[_0xa812('0x1c')]=_0x5f5328[_0xa812('0x1c')];this[_0xa812('0x1d')]=_0x5f5328['callbackuniqueid'];this['callbackat']=_0x5f5328['callbackat'];this[_0xa812('0x1e')]=_0x5f5328[_0xa812('0x1e')];this['ContactId']=_0x5f5328[_0xa812('0x1f')];this[_0xa812('0x20')]=_0x5f5328[_0xa812('0x20')];this[_0xa812('0x21')]=_0x5f5328[_0xa812('0x21')];this[_0xa812('0x22')]=_0x5f5328[_0xa812('0x22')];this[_0xa812('0x23')]=_0x5f5328[_0xa812('0x23')];this['originatecalleridnum']=_0x5f5328['originatecalleridnum']||'';this[_0xa812('0x24')]=_0x5f5328[_0xa812('0x24')]||'';this[_0xa812('0x25')]=_0x5f5328[_0xa812('0x25')];this[_0xa812('0x26')]=_0x5f5328[_0xa812('0x26')];this[_0xa812('0x27')]=_0x5f5328[_0xa812('0x27')];}module[_0xa812('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xa457=['callbackat','recallme','ContactId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid'];(function(_0x3efe6d,_0x193c41){var _0x53c4a7=function(_0x57326){while(--_0x57326){_0x3efe6d['push'](_0x3efe6d['shift']());}};_0x53c4a7(++_0x193c41);}(_0xa457,0x1eb));var _0x7a45=function(_0x568fbe,_0x3311c4){_0x568fbe=_0x568fbe-0x0;var _0x136168=_0xa457[_0x568fbe];return _0x136168;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x963e14,_0xe17fa3){this[_0x7a45('0x0')]=_0x963e14[_0x7a45('0x0')];this[_0x7a45('0x1')]=_0x963e14['type'];this[_0x7a45('0x2')]=_0x963e14['type']===_0x7a45('0x3')?_0x7a45('0x4'):_0x963e14[_0x7a45('0x1')];this[_0x7a45('0x5')]=_0x963e14[_0x7a45('0x5')];this[_0x7a45('0x6')]=_0x963e14[_0x7a45('0x6')];this['countnoanswerretry']=_0x963e14['countnoanswerretry'];this[_0x7a45('0x7')]=_0x963e14[_0x7a45('0x5')]+_0x963e14[_0x7a45('0x6')]+_0x963e14['countnoanswerretry']+_0x963e14[_0x7a45('0x8')]+_0x963e14['countdropretry']+_0x963e14[_0x7a45('0x9')]+_0x963e14[_0x7a45('0xa')]+_0x963e14[_0x7a45('0xb')];this['countnosuchnumberretry']=_0x963e14[_0x7a45('0x8')];this[_0x7a45('0xc')]=_0x963e14[_0x7a45('0xc')];this[_0x7a45('0x9')]=_0x963e14[_0x7a45('0x9')];this[_0x7a45('0xa')]=_0x963e14[_0x7a45('0xa')];this[_0x7a45('0xb')]=_0x963e14['countagentrejectretry'];this['uniqueid']=_0xe17fa3['uniqueid'];this['calleridname']=_0x963e14[_0x7a45('0xd')];this[_0x7a45('0xe')]=_0x963e14[_0x7a45('0xf')];this[_0x7a45('0x10')]=_0x963e14[_0x7a45('0x10')];this['responsetime']=_0x963e14[_0x7a45('0x11')];this[_0x7a45('0x12')]=_0x963e14['droptime'];this[_0x7a45('0x13')]=_0x963e14[_0x7a45('0x13')];this[_0x7a45('0x14')]=this[_0x7a45('0x12')];this[_0x7a45('0x15')]=utils[_0x7a45('0x16')](_0x963e14[_0x7a45('0x11')],_0x963e14['starttime']);this[_0x7a45('0x17')]=utils[_0x7a45('0x16')](this[_0x7a45('0x12')],_0x963e14['responsetime']);this[_0x7a45('0x18')]=0x0;this[_0x7a45('0x4')]=_0xe17fa3[_0x7a45('0x4')];this['membername']=_0xe17fa3[_0x7a45('0x19')];this[_0x7a45('0x1a')]=_0xe17fa3[_0x7a45('0x1a')];this[_0x7a45('0x1b')]=_0x963e14[_0x7a45('0x1b')];this[_0x7a45('0x1c')]=_0x963e14[_0x7a45('0x1c')];this[_0x7a45('0x1d')]=_0x963e14[_0x7a45('0x1d')];this['recallme']=_0x963e14[_0x7a45('0x1e')];this[_0x7a45('0x1f')]=_0x963e14['ContactId'];this['ListId']=_0x963e14['ListId'];this['UserId']=_0x963e14['UserId'];this[_0x7a45('0x20')]=_0x963e14[_0x7a45('0x20')];this[_0x7a45('0x21')]=_0x963e14[_0x7a45('0x21')];this['originatecalleridnum']=_0x963e14[_0x7a45('0x22')]||'';this[_0x7a45('0x23')]=_0x963e14[_0x7a45('0x23')]||'';this[_0x7a45('0x24')]=_0x963e14[_0x7a45('0x24')];this[_0x7a45('0x25')]=_0x963e14[_0x7a45('0x25')];this[_0x7a45('0x26')]=_0x963e14[_0x7a45('0x26')];}module[_0x7a45('0x27')]=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 b4c0ed0..0cd7403 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 _0xa46e=['getContactDialerIvr','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]'];(function(_0x26fbfd,_0x47f2c1){var _0x508968=function(_0x44f9dd){while(--_0x44f9dd){_0x26fbfd['push'](_0x26fbfd['shift']());}};_0x508968(++_0x47f2c1);}(_0xa46e,0x8a));var _0xea46=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xa46e[_0xd050c6];return _0x7278a;};'use strict';var util=require(_0xea46('0x0'));var logger=require(_0xea46('0x1'))('dialer');var cmHopper=require(_0xea46('0x2'));var cmHopperAdditionalPhone=require(_0xea46('0x3'));var cmHopperBlack=require(_0xea46('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x19f135){return util['inspect'](_0x19f135,{'showHidden':![],'depth':null});}function getContactDialer(_0x3a2209,_0x47d633,_0x3599fc){return cmHopper['getContactDialer'](_0x3a2209['id'],_0x47d633,_0x3599fc,_0x3a2209[_0xea46('0x5')])[_0xea46('0x6')](function(_0x5f1cd1){_0x3a2209[_0xea46('0x7')]=0x0;logger[_0xea46('0x8')](_0xea46('0x9'),inspectError(_0x5f1cd1));});}exports[_0xea46('0xa')]=getContactDialer;function getContactDialerIvr(_0x468322,_0x4cf206){return cmHopper['getContactDialerIvr'](_0x468322['id'],_0x4cf206,_0x468322['dialOrderByScheduledAt'])[_0xea46('0x6')](function(_0x45550a){_0x468322['temp']=0x0;logger[_0xea46('0x8')](_0xea46('0xb'),inspectError(_0x45550a));});}exports[_0xea46('0xc')]=getContactDialerIvr;function countReScheduled(_0x594694){return cmHopper[_0xea46('0xd')](_0x594694)[_0xea46('0x6')](function(_0x4e10f3){logger[_0xea46('0x8')](_0xea46('0xe'),inspectError(_0x4e10f3));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x20955e){return cmHopper['rescheduleContact'](_0x20955e)[_0xea46('0x6')](function(_0x42c328){logger[_0xea46('0x8')](_0xea46('0xf'),inspectError(_0x42c328));});}exports[_0xea46('0x10')]=rescheduleContact;function unlockContact(_0x2ef436,_0x81ee45,_0x20a79c){return cmHopper[_0xea46('0x11')](_0x2ef436,_0x81ee45,_0x20a79c)['catch'](function(_0x2fa2f9){logger[_0xea46('0x8')](_0xea46('0x12'),inspectError(_0x2fa2f9));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x58b4da){return cmHopper[_0xea46('0x13')](_0x58b4da)[_0xea46('0x6')](function(_0x5cf5dd){logger['error'](_0xea46('0x14'),inspectError(_0x5cf5dd));});}exports[_0xea46('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x4ff93d){return cmHopperBlack[_0xea46('0x15')](_0x4ff93d)[_0xea46('0x6')](function(_0x1adba1){logger[_0xea46('0x8')]('[checkIsBlackList]',inspectError(_0x1adba1));});}exports[_0xea46('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x4e220f){return cmHopperBlack['checkIsBlackListIvr'](_0x4e220f)[_0xea46('0x6')](function(_0x59e431){logger['error']('[checkIsBlackListIvr]',inspectError(_0x59e431));});}exports[_0xea46('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x36f982,_0x3d1850,_0x5beb44){return cmHopperAdditionalPhone[_0xea46('0x17')](_0x36f982,_0x3d1850,_0x5beb44)['catch'](function(_0x12e688){logger[_0xea46('0x8')]('[verifyAdditionalPhone]',inspectError(_0x12e688));});}exports[_0xea46('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5480eb,_0x2b3a8f,_0x114bf9){return cmHopperAdditionalPhone[_0xea46('0x18')](_0x5480eb,_0x2b3a8f,_0x114bf9)['catch'](function(_0x5d2de1){logger[_0xea46('0x8')](_0xea46('0x19'),inspectError(_0x5d2de1));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x3b3928){return cmHopperHistory['avgHandleTime'](_0x3b3928)[_0xea46('0x6')](function(_0x51ca27){logger[_0xea46('0x8')](_0xea46('0x1a'),inspectError(_0x51ca27));});}exports[_0xea46('0x1b')]=avgHandleTime;function createHistory(_0x44517d){return cmHopperHistory[_0xea46('0x1c')](_0x44517d)[_0xea46('0x6')](function(_0x4a5149){logger[_0xea46('0x8')](_0xea46('0x1d'),inspectError(_0x4a5149));});}exports[_0xea46('0x1c')]=createHistory; \ No newline at end of file +var _0x814b=['rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','catch','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','temp','countReScheduled','[countReScheduled]'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x814b,0x1a2));var _0xb814=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x814b[_0x3ea913];return _0x2b4f28;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var cmHopper=require(_0xb814('0x3'));var cmHopperAdditionalPhone=require(_0xb814('0x4'));var cmHopperBlack=require(_0xb814('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x38c21a){return util[_0xb814('0x6')](_0x38c21a,{'showHidden':![],'depth':null});}function getContactDialer(_0x258866,_0x4237bc,_0x44931c){return cmHopper[_0xb814('0x7')](_0x258866['id'],_0x4237bc,_0x44931c,_0x258866['dialOrderByScheduledAt'])[_0xb814('0x8')](function(_0x2e6272){_0x258866['temp']=0x0;logger[_0xb814('0x9')](_0xb814('0xa'),inspectError(_0x2e6272));});}exports[_0xb814('0x7')]=getContactDialer;function getContactDialerIvr(_0x41166c,_0x1fea33){return cmHopper[_0xb814('0xb')](_0x41166c['id'],_0x1fea33,_0x41166c[_0xb814('0xc')])[_0xb814('0x8')](function(_0x207dbc){_0x41166c[_0xb814('0xd')]=0x0;logger[_0xb814('0x9')]('[getContactDialerIvr]',inspectError(_0x207dbc));});}exports[_0xb814('0xb')]=getContactDialerIvr;function countReScheduled(_0x56278f){return cmHopper[_0xb814('0xe')](_0x56278f)[_0xb814('0x8')](function(_0x35b10d){logger[_0xb814('0x9')](_0xb814('0xf'),inspectError(_0x35b10d));});}exports[_0xb814('0xe')]=countReScheduled;function rescheduleContact(_0x1438e7){return cmHopper[_0xb814('0x10')](_0x1438e7)[_0xb814('0x8')](function(_0x2ab627){logger[_0xb814('0x9')](_0xb814('0x11'),inspectError(_0x2ab627));});}exports[_0xb814('0x10')]=rescheduleContact;function unlockContact(_0x39bfcf,_0x303aca,_0x3a71d6){return cmHopper[_0xb814('0x12')](_0x39bfcf,_0x303aca,_0x3a71d6)[_0xb814('0x8')](function(_0x125ce2){logger[_0xb814('0x9')](_0xb814('0x13'),inspectError(_0x125ce2));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x168a48){return cmHopper['moveContactManagedDialer'](_0x168a48)[_0xb814('0x8')](function(_0xfac75b){logger['error']('[moveContactManagedDialer]',inspectError(_0xfac75b));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x399b43){return cmHopperBlack['checkIsBlackList'](_0x399b43)['catch'](function(_0xb684ea){logger[_0xb814('0x9')](_0xb814('0x14'),inspectError(_0xb684ea));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0xf5b8aa){return cmHopperBlack['checkIsBlackListIvr'](_0xf5b8aa)[_0xb814('0x8')](function(_0x1808a3){logger[_0xb814('0x9')](_0xb814('0x15'),inspectError(_0x1808a3));});}exports[_0xb814('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bd039,_0x1f5d40,_0x594470){return cmHopperAdditionalPhone[_0xb814('0x17')](_0x2bd039,_0x1f5d40,_0x594470)['catch'](function(_0x3f81d0){logger[_0xb814('0x9')](_0xb814('0x18'),inspectError(_0x3f81d0));});}exports[_0xb814('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1c8a2e,_0xb9e57d,_0x3d836c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1c8a2e,_0xb9e57d,_0x3d836c)[_0xb814('0x8')](function(_0xc0ef66){logger[_0xb814('0x9')](_0xb814('0x19'),inspectError(_0xc0ef66));});}exports[_0xb814('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x1d5965){return cmHopperHistory[_0xb814('0x1b')](_0x1d5965)[_0xb814('0x8')](function(_0x5a6291){logger[_0xb814('0x9')](_0xb814('0x1c'),inspectError(_0x5a6291));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x9008b2){return cmHopperHistory[_0xb814('0x1d')](_0x9008b2)[_0xb814('0x8')](function(_0x499f22){logger[_0xb814('0x9')](_0xb814('0x1e'),inspectError(_0x499f22));});}exports['createHistory']=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 345ce9e..0eb1ea7 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 _0x2520=['../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','diff','seconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','replace','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','undefined','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer'];(function(_0x3e18f9,_0x348e8f){var _0x523f60=function(_0x419fbe){while(--_0x419fbe){_0x3e18f9['push'](_0x3e18f9['shift']());}};_0x523f60(++_0x348e8f);}(_0x2520,0x109));var _0x0252=function(_0x164196,_0x5b0008){_0x164196=_0x164196-0x0;var _0x3e54da=_0x2520[_0x164196];return _0x3e54da;};'use strict';var _=require(_0x0252('0x0'));var moment=require(_0x0252('0x1'));var util=require(_0x0252('0x2'));var logger=require(_0x0252('0x3'))(_0x0252('0x4'));var timezones=require(_0x0252('0x5'))[_0x0252('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x0252('0x7'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x0252('0x8'),'DEACTIVATED':_0x0252('0x9'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x0252('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x0252('0xb'),'NO_AVAILABLE_CONTACTS':_0x0252('0xc'),'NULL_INTERVAL':_0x0252('0xd'),'OVERTIME_INTERVAL':_0x0252('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0x0252('0xf'),'QUEUE_RECALL':_0x0252('0x10'),'RECALL_TIMEOUT':_0x0252('0x11'),'RUNNING':_0x0252('0x12'),'UNKNOWN_TIMEZONE':_0x0252('0x13'),'UNREACHABLE_TRUNK':_0x0252('0x14')};exports[_0x0252('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x59cdfb){return _0x59cdfb['dialMethod']===_0x0252('0x16');}exports[_0x0252('0x17')]=isPreviewCampaign;function isIVRCampaign(_0x48e573){return _0x48e573[_0x0252('0x18')]===_0x0252('0x19');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x34c50d){return _0x34c50d[_0x0252('0x18')]==='outbound';}exports[_0x0252('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x5a573b){return _0x5a573b[_0x0252('0x1b')];}exports[_0x0252('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1e4f36){return _0x1e4f36[_0x0252('0x1d')];}exports[_0x0252('0x1e')]=isIVRCampaignActive;function getSeconds(_0x563b17,_0x3e05e6){var _0x4dcfeb=moment(_0x563b17)['milliseconds'](0x0);var _0x4e5514=moment(_0x3e05e6)['milliseconds'](0x0);return _0x4dcfeb[_0x0252('0x1f')](_0x4e5514,_0x0252('0x20'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0xc04907,_0x1e9916){var _0x4d7e4c=![];var _0x4337dc=_0xc04907['dialMethod']!==_0x1e9916[_0x0252('0x21')]||_0xc04907[_0x0252('0x1b')]!==_0x1e9916[_0x0252('0x1b')]||_0xc04907[_0x0252('0x22')]!==_0x1e9916[_0x0252('0x22')];var _0x59742e=_0xc04907[_0x0252('0x23')]!==_0x1e9916['available']||_0xc04907[_0x0252('0x24')]!==_0x1e9916[_0x0252('0x24')]||_0xc04907[_0x0252('0x25')]!==_0x1e9916['loggedInDb']||_0xc04907[_0x0252('0x26')]!==_0x1e9916[_0x0252('0x26')]||_0xc04907[_0x0252('0x27')]!==_0x1e9916[_0x0252('0x27')]||_0xc04907[_0x0252('0x28')]!==_0x1e9916[_0x0252('0x28')]||_0xc04907[_0x0252('0x29')]!==_0x1e9916[_0x0252('0x29')]||_0xc04907[_0x0252('0x2a')]!==_0x1e9916['inUse']||_0xc04907[_0x0252('0x2b')]!==_0x1e9916[_0x0252('0x2b')];if(_0xc04907[_0x0252('0x2c')]&&_0x1e9916[_0x0252('0x2c')]){_0x4d7e4c=_0xc04907['Trunk'][_0x0252('0x2d')]!==_0x1e9916[_0x0252('0x2c')]['name']||_0xc04907[_0x0252('0x2c')][_0x0252('0x1d')]!==_0x1e9916[_0x0252('0x2c')][_0x0252('0x1d')];}return _0x4337dc||_0x59742e||_0x4d7e4c;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x59274e){var _0xa85709=null;var _0x41a40d=_0x59274e['dialTimezone'];if(_[_0x0252('0x2e')](_0x59274e[_0x0252('0x2f')])||_[_0x0252('0x2e')](_0x59274e[_0x0252('0x30')])||_[_0x0252('0x2e')](_0x59274e[_0x0252('0x30')]['Intervals'])){_0xa85709=CAMPAIGN_STATUS[_0x0252('0x31')];}else if(_[_0x0252('0x32')](_0x59274e[_0x0252('0x2f')])||_[_0x0252('0x32')](_0x59274e[_0x0252('0x30')][_0x0252('0x33')])){_0xa85709=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x41a40d&&!timezones[_0x41a40d]){_0xa85709=CAMPAIGN_STATUS[_0x0252('0x34')];}return _0xa85709;}function checkAnyValidTrunk(_0x50f2bd,_0x441c06){var _0x8ee6be=null;var _0x5bbe7a=_0x0252('0x35');var _0x1c3fff=[_0x0252('0x36'),_0x0252('0x37')];var _0x3e5b4b=!![];if(_0x50f2bd[_0x0252('0x2c')]&&_0x50f2bd[_0x0252('0x2c')][_0x0252('0x1d')]){_0x5bbe7a+=_0x50f2bd[_0x0252('0x2c')]['name'];_0x8ee6be=_0x441c06[_0x5bbe7a];_0x3e5b4b=_0x1c3fff[_0x0252('0x38')](_0x8ee6be[_0x0252('0x39')]);}else if(_0x50f2bd[_0x0252('0x3a')]&&_0x50f2bd['TrunkBackup'][_0x0252('0x1d')]){_0x5bbe7a+=_0x50f2bd[_0x0252('0x3a')][_0x0252('0x2d')];_0x8ee6be=_0x441c06[_0x5bbe7a];_0x3e5b4b=_0x1c3fff['includes'](_0x8ee6be[_0x0252('0x39')]);}return _0x3e5b4b;}function getQueueCampaignStatusMessage(_0x3ba211,_0x458298){var _0x536eda=CAMPAIGN_STATUS[_0x0252('0x7')];var _0x32553b=isPreviewCampaign(_0x3ba211);if(!isQueueCampaignActive(_0x3ba211)){if(_0x32553b){_0x536eda=CAMPAIGN_STATUS[_0x0252('0x3b')];}else{if(_0x3ba211[_0x0252('0x2b')]===0x0&&_0x3ba211['talking']===0x0&&_0x3ba211[_0x0252('0x29')]===0x0&&(_0x3ba211[_0x0252('0x28')]||0x0)===0x0){_0x536eda=CAMPAIGN_STATUS[_0x0252('0x3b')];}else{_0x536eda=CAMPAIGN_STATUS[_0x0252('0x3c')];}}}else if(_0x3ba211[_0x0252('0x24')]===0x0){_0x536eda=CAMPAIGN_STATUS[_0x0252('0x3d')];}else if(!checkAnyValidTrunk(_0x3ba211,_0x458298)){_0x536eda=CAMPAIGN_STATUS[_0x0252('0x3e')];}else if(!isPreviewCampaign(_0x3ba211)){var _0x216c2b=checkAnyValidQueueCampaignInterval(_0x3ba211);if(_0x216c2b){_0x536eda=_0x216c2b;}}return _0x536eda;}exports[_0x0252('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4f2ca8){var _0xad6c43=CAMPAIGN_STATUS[_0x0252('0x3c')];if(_0x4f2ca8[_0x0252('0x2b')]===0x0&&_0x4f2ca8[_0x0252('0x27')]===0x0&&_0x4f2ca8[_0x0252('0x29')]===0x0&&(_0x4f2ca8['pTalking']||0x0)===0x0){_0xad6c43=CAMPAIGN_STATUS[_0x0252('0x3b')];}return _0xad6c43;}exports[_0x0252('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xb8015d){var _0x31be2a=_0xb8015d[_0x0252('0x41')](/"(.*?)"/);return _0x31be2a?_0x31be2a[0x1]:_0xb8015d;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0xcb8909,_0x4bae86,_0x2b6f9d){if(!_[_0x0252('0x42')](_0x2b6f9d)&&typeof _0x2b6f9d===_0x0252('0x43')&&!_['isEmpty'](_0x2b6f9d)){if(!_[_0x0252('0x42')](_0x4bae86)&&typeof _0x4bae86===_0x0252('0x43')&&!_['isEmpty'](_0x4bae86)){return util[_0x0252('0x44')](_0x0252('0x45'),_0x4bae86,_0x2b6f9d);}return util[_0x0252('0x44')](_0x0252('0x45'),_0x2b6f9d,_0x2b6f9d);}if(!_[_0x0252('0x42')](_0xcb8909)&&typeof _0xcb8909===_0x0252('0x43')&&!_[_0x0252('0x32')](_0xcb8909)){return _0xcb8909;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x521d39,_0x1140a8){var _0x3f0bb1;var _0x274f0d;var _0x15b3bf;if(_0x1140a8<=0x0){_0x1140a8=0x1;}_0x3f0bb1=new RegExp(_0x0252('0x46')+_0x1140a8+'}$');_0x274f0d=Math[_0x0252('0x47')](0xa,_0x1140a8-0x1);_0x15b3bf=Math[_0x0252('0x47')](0xa,_0x1140a8)-0x1;return util[_0x0252('0x44')]('%s',_[_0x0252('0x48')](_0x521d39,_0x3f0bb1,_['random'](_0x274f0d,_0x15b3bf)[_0x0252('0x49')]()));}exports[_0x0252('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x33d8bd){if(_0x33d8bd['originated']&&_0x33d8bd[_0x0252('0x2b')]>0x0){_0x33d8bd['originated']-=0x1;}else{logger[_0x0252('0x4b')](_0x0252('0x4c'));}}exports[_0x0252('0x4d')]=decrementOriginate;function checkContactEmpty(_0x4d285d){return _0x4d285d&&_0x4d285d[_0x0252('0x4e')]>0x0;}exports[_0x0252('0x4f')]=checkContactEmpty;function erlangb(_0x47b809,_0x3928b4){if(_0x3928b4===0x0){return 0x0;}var _0x508ceb=0x1;for(var _0x4a562f=0x1;_0x4a562f<=_0x3928b4;_0x4a562f+=0x1){_0x508ceb=0x1+_0x508ceb*_0x4a562f/_0x47b809;}return 0x1/_0x508ceb;}exports[_0x0252('0x50')]=erlangb;function checkContactLowerLimitOriginate(_0x884efc,_0x244664,_0x10e04a){if(_0x244664>_0x10e04a){for(var _0x3b729c=0x0;_0x3b729c<_0x244664-_0x10e04a;_0x3b729c+=0x1){decrementOriginate(_0x884efc);}}}exports[_0x0252('0x51')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x928b0e){var _0xbbf233={};var _0x395700=['id',_0x0252('0x52'),_0x0252('0x53'),_0x0252('0x54'),_0x0252('0x55')];if(_0x928b0e){for(var _0x3d8281 in _0x928b0e){if(typeof _0x928b0e[_0x3d8281]!==_0x0252('0x56')){if(!_[_0x0252('0x2e')](_0x928b0e[_0x3d8281])&&!_0x395700[_0x0252('0x38')](_0x3d8281)){_0xbbf233[util[_0x0252('0x44')]('%s%s',_0x0252('0x57'),_0x3d8281[_0x0252('0x58')]())]=_0x928b0e[_0x3d8281];}}}}return _0xbbf233;}exports[_0x0252('0x59')]=setXMDContactVariables; \ No newline at end of file +var _0x064f=['available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','active','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','unmonitored','name','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message'];(function(_0x5bc6bb,_0x3f20f3){var _0x3cb46d=function(_0x1188ba){while(--_0x1188ba){_0x5bc6bb['push'](_0x5bc6bb['shift']());}};_0x3cb46d(++_0x3f20f3);}(_0x064f,0xe1));var _0xf064=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x064f[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xf064('0x0'));var moment=require('moment');var util=require(_0xf064('0x1'));var logger=require(_0xf064('0x2'))(_0xf064('0x3'));var timezones=require(_0xf064('0x4'))[_0xf064('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xf064('0x6'),'DISACTIVED':_0xf064('0x7'),'EMPTY_INTERVAL':_0xf064('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xf064('0x9'),'NO_AVAILABLE_CONTACTS':_0xf064('0xa'),'NULL_INTERVAL':_0xf064('0xb'),'OVERTIME_INTERVAL':_0xf064('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xf064('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xf064('0xe'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xf064('0xf')};exports[_0xf064('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x204002){return _0x204002[_0xf064('0x11')]===_0xf064('0x12');}exports[_0xf064('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x56cc79){return _0x56cc79[_0xf064('0x14')]===_0xf064('0x15');}exports[_0xf064('0x16')]=isIVRCampaign;function isOutboundQueue(_0x58fe6a){return _0x58fe6a[_0xf064('0x14')]===_0xf064('0x17');}exports[_0xf064('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x12f524){return _0x12f524[_0xf064('0x19')];}exports[_0xf064('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x129a77){return _0x129a77['active'];}exports[_0xf064('0x1b')]=isIVRCampaignActive;function getSeconds(_0x37f0a0,_0x4f7f9d){var _0xe2c6f5=moment(_0x37f0a0)[_0xf064('0x1c')](0x0);var _0xa95912=moment(_0x4f7f9d)[_0xf064('0x1c')](0x0);return _0xe2c6f5[_0xf064('0x1d')](_0xa95912,_0xf064('0x1e'));}exports[_0xf064('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x388fa7,_0x55bfa1){var _0x48a25d=![];var _0x2a7d7a=_0x388fa7[_0xf064('0x11')]!==_0x55bfa1[_0xf064('0x11')]||_0x388fa7[_0xf064('0x19')]!==_0x55bfa1[_0xf064('0x19')]||_0x388fa7[_0xf064('0x20')]!==_0x55bfa1[_0xf064('0x20')];var _0x3489b5=_0x388fa7[_0xf064('0x21')]!==_0x55bfa1[_0xf064('0x21')]||_0x388fa7[_0xf064('0x22')]!==_0x55bfa1[_0xf064('0x22')]||_0x388fa7[_0xf064('0x23')]!==_0x55bfa1[_0xf064('0x23')]||_0x388fa7['paused']!==_0x55bfa1['paused']||_0x388fa7[_0xf064('0x24')]!==_0x55bfa1['talking']||_0x388fa7['pTalking']!==_0x55bfa1[_0xf064('0x25')]||_0x388fa7['waiting']!==_0x55bfa1[_0xf064('0x26')]||_0x388fa7[_0xf064('0x27')]!==_0x55bfa1[_0xf064('0x27')]||_0x388fa7[_0xf064('0x28')]!==_0x55bfa1[_0xf064('0x28')];if(_0x388fa7[_0xf064('0x29')]&&_0x55bfa1[_0xf064('0x29')]){_0x48a25d=_0x388fa7['Trunk']['name']!==_0x55bfa1['Trunk']['name']||_0x388fa7['Trunk'][_0xf064('0x2a')]!==_0x55bfa1[_0xf064('0x29')][_0xf064('0x2a')];}return _0x2a7d7a||_0x3489b5||_0x48a25d;}exports[_0xf064('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xb6d356){var _0xa1122b=null;var _0x3c3464=_0xb6d356[_0xf064('0x2c')];if(_['isNil'](_0xb6d356[_0xf064('0x2d')])||_[_0xf064('0x2e')](_0xb6d356['Interval'])||_['isNil'](_0xb6d356[_0xf064('0x2f')][_0xf064('0x30')])){_0xa1122b=CAMPAIGN_STATUS[_0xf064('0x31')];}else if(_[_0xf064('0x32')](_0xb6d356[_0xf064('0x2d')])||_['isEmpty'](_0xb6d356[_0xf064('0x2f')][_0xf064('0x30')])){_0xa1122b=CAMPAIGN_STATUS[_0xf064('0x33')];}else if(_0x3c3464&&!timezones[_0x3c3464]){_0xa1122b=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0xa1122b;}function checkAnyValidTrunk(_0x44a4f0,_0x2efe84){var _0x434b90=null;var _0x32a43f=_0xf064('0x34');var _0x4dfa15=['reachable',_0xf064('0x35')];var _0x1d446d=!![];if(_0x44a4f0['Trunk']&&_0x44a4f0['Trunk'][_0xf064('0x2a')]){_0x32a43f+=_0x44a4f0[_0xf064('0x29')][_0xf064('0x36')];_0x434b90=_0x2efe84[_0x32a43f];_0x1d446d=_0x4dfa15[_0xf064('0x37')](_0x434b90[_0xf064('0x38')]);}else if(_0x44a4f0[_0xf064('0x39')]&&_0x44a4f0[_0xf064('0x39')][_0xf064('0x2a')]){_0x32a43f+=_0x44a4f0['TrunkBackup'][_0xf064('0x36')];_0x434b90=_0x2efe84[_0x32a43f];_0x1d446d=_0x4dfa15[_0xf064('0x37')](_0x434b90['status']);}return _0x1d446d;}function getQueueCampaignStatusMessage(_0x4a904d,_0xa4e33e){var _0x151caf=CAMPAIGN_STATUS['ACTIVE'];var _0x4942cb=isPreviewCampaign(_0x4a904d);if(!isQueueCampaignActive(_0x4a904d)){if(_0x4942cb){_0x151caf=CAMPAIGN_STATUS[_0xf064('0x3a')];}else{if(_0x4a904d[_0xf064('0x28')]===0x0&&_0x4a904d[_0xf064('0x24')]===0x0&&_0x4a904d['waiting']===0x0&&(_0x4a904d['pTalking']||0x0)===0x0){_0x151caf=CAMPAIGN_STATUS['INACTIVE'];}else{_0x151caf=CAMPAIGN_STATUS[_0xf064('0x3b')];}}}else if(_0x4a904d[_0xf064('0x22')]===0x0){_0x151caf=CAMPAIGN_STATUS[_0xf064('0x3c')];}else if(!checkAnyValidTrunk(_0x4a904d,_0xa4e33e)){_0x151caf=CAMPAIGN_STATUS[_0xf064('0x3d')];}else if(!isPreviewCampaign(_0x4a904d)){var _0x474d32=checkAnyValidQueueCampaignInterval(_0x4a904d);if(_0x474d32){_0x151caf=_0x474d32;}}return _0x151caf;}exports[_0xf064('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x515df7){var _0x5deb11=CAMPAIGN_STATUS[_0xf064('0x3b')];if(_0x515df7['originated']===0x0&&_0x515df7[_0xf064('0x24')]===0x0&&_0x515df7[_0xf064('0x26')]===0x0&&(_0x515df7['pTalking']||0x0)===0x0){_0x5deb11=CAMPAIGN_STATUS['INACTIVE'];}return _0x5deb11;}exports[_0xf064('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x89254f){var _0x36195b=_0x89254f['match'](/"(.*?)"/);return _0x36195b?_0x36195b[0x1]:_0x89254f;}exports[_0xf064('0x40')]=extractCalleridName;function getCallerId(_0xeaa824,_0x5c8fb2,_0x7e2865){if(!_['isUndefined'](_0x7e2865)&&typeof _0x7e2865===_0xf064('0x41')&&!_[_0xf064('0x32')](_0x7e2865)){if(!_[_0xf064('0x42')](_0x5c8fb2)&&typeof _0x5c8fb2==='string'&&!_[_0xf064('0x32')](_0x5c8fb2)){return util[_0xf064('0x43')](_0xf064('0x44'),_0x5c8fb2,_0x7e2865);}return util[_0xf064('0x43')](_0xf064('0x44'),_0x7e2865,_0x7e2865);}if(!_[_0xf064('0x42')](_0xeaa824)&&typeof _0xeaa824===_0xf064('0x41')&&!_[_0xf064('0x32')](_0xeaa824)){return _0xeaa824;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0xa48943,_0x9df578){var _0x2b3610;var _0x23f1e5;var _0x320be0;if(_0x9df578<=0x0){_0x9df578=0x1;}_0x2b3610=new RegExp(_0xf064('0x45')+_0x9df578+'}$');_0x23f1e5=Math[_0xf064('0x46')](0xa,_0x9df578-0x1);_0x320be0=Math[_0xf064('0x46')](0xa,_0x9df578)-0x1;return util[_0xf064('0x43')]('%s',_['replace'](_0xa48943,_0x2b3610,_['random'](_0x23f1e5,_0x320be0)[_0xf064('0x47')]()));}exports[_0xf064('0x48')]=getCallerIdRandom;function decrementOriginate(_0x3e0d00){if(_0x3e0d00[_0xf064('0x28')]&&_0x3e0d00[_0xf064('0x28')]>0x0){_0x3e0d00['originated']-=0x1;}else{logger[_0xf064('0x49')](_0xf064('0x4a'));}}exports[_0xf064('0x4b')]=decrementOriginate;function checkContactEmpty(_0x277c1e){return _0x277c1e&&_0x277c1e[_0xf064('0x4c')]>0x0;}exports[_0xf064('0x4d')]=checkContactEmpty;function erlangb(_0x72f78,_0x4250d1){if(_0x4250d1===0x0){return 0x0;}var _0x11b588=0x1;for(var _0x3e1d1d=0x1;_0x3e1d1d<=_0x4250d1;_0x3e1d1d+=0x1){_0x11b588=0x1+_0x11b588*_0x3e1d1d/_0x72f78;}return 0x1/_0x11b588;}exports[_0xf064('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x3b92b9,_0x1b6095,_0x387a66){if(_0x1b6095>_0x387a66){for(var _0x185416=0x0;_0x185416<_0x1b6095-_0x387a66;_0x185416+=0x1){decrementOriginate(_0x3b92b9);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x409a0a){var _0x31057c={};var _0x29af25=['id','createdAt','description',_0xf064('0x4f'),_0xf064('0x50')];if(_0x409a0a){for(var _0x53db22 in _0x409a0a){if(typeof _0x409a0a[_0x53db22]!==_0xf064('0x51')){if(!_[_0xf064('0x2e')](_0x409a0a[_0x53db22])&&!_0x29af25[_0xf064('0x37')](_0x53db22)){_0x31057c[util[_0xf064('0x43')](_0xf064('0x52'),_0xf064('0x53'),_0x53db22[_0xf064('0x54')]())]=_0x409a0a[_0x53db22];}}}}return _0x31057c;}exports[_0xf064('0x55')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 13748fa..230adfa 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(_0xabdbe0,_0x96a3d){var _0x5ab376=function(_0x16576c){while(--_0x16576c){_0xabdbe0['push'](_0xabdbe0['shift']());}};_0x5ab376(++_0x96a3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x315bb9,_0x50c719){var _0x13b67d=function(_0x292bcf){while(--_0x292bcf){_0x315bb9['push'](_0x315bb9['shift']());}};_0x13b67d(++_0x50c719);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 c695e3d..d7c2031 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 _0x939c=['[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','message','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewExten','faxstatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','name','info','actions','channel','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','application/pdf','then','notify','parse','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x939c,0x97));var _0xc939=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0x939c[_0x2179f1];return _0x176ec9;};'use strict';var util=require(_0xc939('0x0'));var _=require('lodash');var BPromise=require(_0xc939('0x1'));var uuid=require(_0xc939('0x2'));var moment=require(_0xc939('0x3'));var path=require('path');var tiff2pdf=require(_0xc939('0x4'));var gs=require('./util/gs');var logger=require(_0xc939('0x5'))(_0xc939('0x6'));var ami=require(_0xc939('0x7'));var rpcDb=require(_0xc939('0x8'));var Channel=require(_0xc939('0x9'));var ut=require(_0xc939('0xa'));var Action=require(_0xc939('0xb'));var faxAccount=require(_0xc939('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xc939('0xd'));function Fax(_0xaea450){this[_0xc939('0xe')]={};this['faxAccounts']=_0xaea450[_0xc939('0xf')];this['trunks']=_0xaea450[_0xc939('0x10')];this['actions']={};ami['on'](_0xc939('0x11'),this[_0xc939('0x12')][_0xc939('0x13')](this));ami['on'](_0xc939('0x14'),this[_0xc939('0x15')]['bind'](this));ami['on'](_0xc939('0x16'),this['syncNewState'][_0xc939('0x13')](this));ami['on']('newexten',this[_0xc939('0x17')]['bind'](this));ami['on'](_0xc939('0x18'),this['syncFaxStatus'][_0xc939('0x13')](this));ami['on'](_0xc939('0x19'),this[_0xc939('0x1a')][_0xc939('0x13')](this));ami['on']('hangup',this[_0xc939('0x1b')][_0xc939('0x13')](this));ami['on']('originateresponse',this[_0xc939('0x1c')][_0xc939('0x13')](this));}Fax[_0xc939('0x1d')][_0xc939('0x12')]=function(_0x5b76b){if(_0x5b76b[_0xc939('0x1e')]===_0xc939('0x1f')){for(var _0x592de5 in this[_0xc939('0xf')]){if(this[_0xc939('0xf')][_0xc939('0x20')](_0x592de5)){if(_0x5b76b[_0xc939('0x21')]===this[_0xc939('0xf')][_0x592de5][_0xc939('0x22')]){this['channels'][_0x5b76b['uniqueid']]={};this[_0xc939('0xe')][_0x5b76b[_0xc939('0x23')]]['channel']=_0x5b76b['channel'];this[_0xc939('0xe')][_0x5b76b[_0xc939('0x23')]]['id']=this['faxAccounts'][_0x592de5]['id'];this[_0xc939('0xe')][_0x5b76b[_0xc939('0x23')]][_0xc939('0x24')]=this[_0xc939('0xf')][_0x592de5]['name'];logger[_0xc939('0x25')](_0x5b76b[_0xc939('0x23')],'\x20syncNewchannel\x20');}}}}if(this[_0xc939('0x26')][_0x5b76b[_0xc939('0x23')]]){this[_0xc939('0xe')][_0x5b76b[_0xc939('0x23')]]={};this['channels'][_0x5b76b['uniqueid']][_0xc939('0x27')]=_0x5b76b[_0xc939('0x27')];logger[_0xc939('0x25')](_0x5b76b[_0xc939('0x23')],_0xc939('0x28'));}};Fax['prototype']['syncVarSet']=function(_0x329194){if(this[_0xc939('0xe')][_0x329194[_0xc939('0x23')]]){for(var _0x22c32b in _0x329194[_0xc939('0x29')]){if(_0x329194[_0xc939('0x29')][_0xc939('0x20')](_0x22c32b)){this[_0xc939('0xe')][_0x329194[_0xc939('0x23')]][_0x22c32b]=_0x329194[_0xc939('0x2a')];}}}};Fax['prototype']['syncNewState']=function(_0x4a1972){if(this[_0xc939('0xe')][_0x4a1972['uniqueid']]){this[_0xc939('0xe')][_0x4a1972['uniqueid']][_0xc939('0x2b')]=_0x4a1972['channelstate'];this[_0xc939('0xe')][_0x4a1972[_0xc939('0x23')]][_0xc939('0x2c')]=_0x4a1972[_0xc939('0x2c')];}};Fax[_0xc939('0x1d')]['syncNewExten']=function(_0x5db3cc){if(this[_0xc939('0xe')][_0x5db3cc[_0xc939('0x23')]]){for(var _0x434cd3 in _0x5db3cc[_0xc939('0x29')]){if(_0x5db3cc[_0xc939('0x29')][_0xc939('0x20')](_0x434cd3)){this['channels'][_0x5db3cc[_0xc939('0x23')]][_0x434cd3]=_0x5db3cc[_0xc939('0x2a')];}}}};Fax['prototype'][_0xc939('0x2d')]=function(_0xdc616f){if(this[_0xc939('0xe')][_0xdc616f[_0xc939('0x23')]]){this[_0xc939('0xe')][_0xdc616f['uniqueid']]['operation']=_0xdc616f[_0xc939('0x2e')];this[_0xc939('0xe')][_0xdc616f[_0xc939('0x23')]]['status']=_0xdc616f[_0xc939('0x2f')];this['channels'][_0xdc616f['uniqueid']][_0xc939('0x22')]=_0xdc616f['localstationid'];this[_0xc939('0xe')][_0xdc616f[_0xc939('0x23')]][_0xc939('0x30')]=_0xdc616f[_0xc939('0x30')];logger[_0xc939('0x25')](_0xdc616f[_0xc939('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0xc939('0x1d')][_0xc939('0x1a')]=function(_0x2308ec){var _0x3e08dd=this;if(this[_0xc939('0xe')][_0x2308ec[_0xc939('0x23')]]){var _0x11bfb2=this[_0xc939('0xe')][_0x2308ec[_0xc939('0x23')]]['id'];this[_0xc939('0xe')][_0x2308ec['uniqueid']][_0xc939('0x31')]=_0x2308ec[_0xc939('0x31')];this[_0xc939('0xe')][_0x2308ec[_0xc939('0x23')]]['pagestransferred']=_0x2308ec[_0xc939('0x32')];this['channels'][_0x2308ec[_0xc939('0x23')]][_0xc939('0x22')]=_0x2308ec[_0xc939('0x22')];this[_0xc939('0xe')][_0x2308ec[_0xc939('0x23')]][_0xc939('0x33')]=_0x2308ec[_0xc939('0x33')];this[_0xc939('0xe')][_0x2308ec[_0xc939('0x23')]]['transferrate']=_0x2308ec[_0xc939('0x34')];this[_0xc939('0xe')][_0x2308ec[_0xc939('0x23')]]['filename']=_0x2308ec[_0xc939('0x30')];this[_0xc939('0xe')][_0x2308ec[_0xc939('0x23')]][_0xc939('0x35')]=_0x2308ec['calleridnum'];if(this['channels'][_0x2308ec[_0xc939('0x23')]][_0xc939('0x32')]>0x0){tiff2pdf(_0x2308ec[_0xc939('0x30')],_0xc939('0x36'),function(_0xdd6e46){logger['info'](_0x2308ec[_0xc939('0x23')],_0xc939('0x37'),_0xdd6e46['message']);attachment['create']({'name':path['parse'](_0x2308ec['filename'])['name'],'basename':path['parse'](_0x2308ec[_0xc939('0x30')])[_0xc939('0x24')]+'.pdf','type':_0xc939('0x38')})[_0xc939('0x39')](function(_0x38a2b3){faxAccount[_0xc939('0x3a')](_0x11bfb2,{'from':_0x2308ec[_0xc939('0x35')],'mapKey':_0xc939('0x6'),'body':path[_0xc939('0x3b')](_0x2308ec[_0xc939('0x30')])[_0xc939('0x24')]+'.pdf','AttachmentId':_0x38a2b3['id']})['catch'](function(_0x564766){logger[_0xc939('0x3c')](_0x2308ec[_0xc939('0x23')],_0xc939('0x3d'),JSON[_0xc939('0x3e')](_0x564766));});})[_0xc939('0x3f')](function(_0x24994f){logger[_0xc939('0x3c')](_0x2308ec[_0xc939('0x23')],_0xc939('0x40'),JSON['stringify'](_0x24994f));});});}logger[_0xc939('0x25')](_0x2308ec[_0xc939('0x23')],'\x20receiveFax\x20');}};Fax[_0xc939('0x1d')][_0xc939('0x1c')]=function(_0x513ce9){if(this[_0xc939('0x26')][_0x513ce9[_0xc939('0x23')]]){_[_0xc939('0x41')](this['channels'][_0x513ce9[_0xc939('0x23')]],_[_0xc939('0x42')](_0x513ce9,[_0xc939('0x43'),_0xc939('0x44')]));}};function updateStatus(_0x47e071){if(_0x47e071[_0xc939('0x45')]){faxMessage['update'](_0x47e071[_0xc939('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xc939('0x39')](function(_0xa97681){ut['logger'](_0xc939('0x46'),_0xa97681);})[_0xc939('0x3f')](function(_0x128ed0){ut['logger'](_0xc939('0x47'),_0x128ed0);});}else{ut[_0xc939('0x48')](_0xc939('0x49'));}}Fax[_0xc939('0x1d')]['updateStatus']=function(_0x46c2a5,_0x52fa43,_0x311f6d){var _0xe41537=this;var _0x2b24d8={};if(_0x52fa43){_0x2b24d8={'read':_0x52fa43};}else{_0x2b24d8={'failMessage':_0x311f6d};}if(this[_0xc939('0x26')][_0x46c2a5][_0xc939('0x45')]){faxMessage[_0xc939('0x4a')](this[_0xc939('0x26')][_0x46c2a5][_0xc939('0x45')],_0x2b24d8)[_0xc939('0x39')](function(_0x1350a0){ut['logger'](_0xc939('0x4b'),_0x1350a0);})['catch'](function(_0x4c1f46){ut[_0xc939('0x48')]('[Fax][Message][NoUpdate1]',_0x4c1f46);})['finally'](function(){delete _0xe41537[_0xc939('0xe')][_0x46c2a5];delete _0xe41537[_0xc939('0x26')][_0x46c2a5];});}else{ut[_0xc939('0x48')](_0xc939('0x4c'));delete this[_0xc939('0xe')][_0x46c2a5];delete this['actions'][_0x46c2a5];}};Fax['prototype']['syncHangup']=function(_0x13fd86){var _0xdd92ae=this;if(this['channels'][_0x13fd86['uniqueid']]){if(this[_0xc939('0x26')][_0x13fd86[_0xc939('0x23')]]){this[_0xc939('0xe')][_0x13fd86[_0xc939('0x23')]]['id']=this[_0xc939('0x26')][_0x13fd86[_0xc939('0x23')]]['id'];this['channels'][_0x13fd86[_0xc939('0x23')]][_0xc939('0x24')]=this[_0xc939('0x26')][_0x13fd86[_0xc939('0x23')]][_0xc939('0x24')];}logger['info'](_0x13fd86[_0xc939('0x23')],this[_0xc939('0x26')][_0x13fd86['uniqueid']]?_0xc939('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON[_0xc939('0x3e')](this[_0xc939('0xe')][_0x13fd86[_0xc939('0x23')]]));if(this[_0xc939('0x26')][_0x13fd86[_0xc939('0x23')]]){if(this[_0xc939('0xe')][_0x13fd86['uniqueid']][_0xc939('0x4e')]>0x0&&this[_0xc939('0xe')][_0x13fd86[_0xc939('0x23')]][_0xc939('0x18')]==='SUCCESS'){this['updateStatus'](_0x13fd86[_0xc939('0x23')],!![]);}else{this['updateStatus'](_0x13fd86['uniqueid'],![],this[_0xc939('0xe')][_0x13fd86[_0xc939('0x23')]][_0xc939('0x4f')]?_0xc939('0x50')+this[_0xc939('0xe')][_0x13fd86['uniqueid']]['faxstatusstring']:_0xc939('0x51'));}}}};Fax[_0xc939('0x1d')]['send']=function(_0x105785){var _0x485494=this;return new BPromise(function(_0x2fb536,_0x15a4f7){_0x485494[_0xc939('0x52')](_0x105785,_0x485494[_0xc939('0xf')][_0x105785['FaxAccountId']])[_0xc939('0x39')](function(_0x1608ab){ut[_0xc939('0x48')]('[Fax][execOriginate][success]',_0x1608ab);_0x2fb536(ut[_0xc939('0x53')]('Fax\x20received'));})[_0xc939('0x3f')](function(_0x38d892){ut[_0xc939('0x48')](_0xc939('0x54'),_0x38d892);updateStatus(_0x105785);_0x15a4f7(ut['message'](_0xc939('0x55')));});});};Fax['prototype']['checkAfterSend']=function(_0x4a6561){var _0x5af4d1=this;return new BPromise(function(_0x250097,_0x5ccfe2){var _0x30c503=_0x5af4d1[_0xc939('0x56')](_0x5af4d1[_0xc939('0xf')][_0x4a6561[_0xc939('0x57')]][_0xc939('0x58')],_0x4a6561);if(_0x30c503[_0xc939('0x59')]){_0x250097(ut[_0xc939('0x53')](_0xc939('0x5a')));}else{_0x5ccfe2(ut[_0xc939('0x53')](_0x30c503[_0xc939('0x53')]));}});};function originate(_0x203241,_0x1e8dbc,_0x2c2401){return new BPromise(function(_0x3a2bf0,_0x1da35c){if(_0x2c2401){var _0x1d77b4=util['format'](_0xc939('0x5b'),path[_0xc939('0x3b')](_0x203241['path'])[_0xc939('0x24')],_0x203241[_0xc939('0x5c')]);gs[_0xc939('0x5d')](_0x1d77b4)[_0xc939('0x39')](function(){_0x203241[_0xc939('0x5c')]=util[_0xc939('0x5e')](_0xc939('0x5f'),path[_0xc939('0x3b')](_0x203241[_0xc939('0x5c')])[_0xc939('0x60')],path[_0xc939('0x3b')](_0x203241[_0xc939('0x5c')])[_0xc939('0x24')]);_0x1e8dbc[_0xc939('0x61')]=_0x203241[_0xc939('0x5c')];ut[_0xc939('0x48')]('Convert\x20pdf\x20to\x20tif','');ami[_0xc939('0x62')](ut[_0xc939('0x63')](_0x203241,_0x1e8dbc))[_0xc939('0x39')](function(_0x477204){_0x3a2bf0(_0x477204);})['catch'](function(_0x514055){_0x1da35c(_0x514055);});})[_0xc939('0x3f')](function(_0x29a73b){_0x1da35c(_0x29a73b);});}else{ami[_0xc939('0x62')](ut[_0xc939('0x63')](_0x203241,_0x1e8dbc))[_0xc939('0x39')](function(_0x3dab8e){_0x3a2bf0(_0x3dab8e);})[_0xc939('0x3f')](function(_0x368c0e){_0x1da35c(_0x368c0e);});}});}Fax['prototype'][_0xc939('0x52')]=function(_0x19bac8,_0x30ad14){var _0x2ea126=this;return new BPromise(function(_0x14da15,_0x18e24a){var _0x27638c=uuid['v4']();var _0x3e496a=ut[_0xc939('0x64')](_0x19bac8,_0x30ad14);_0x2ea126[_0xc939('0x26')][_0x27638c]=new Action(_0x27638c,_0x30ad14,_0x19bac8);var _0x30a809=_0x2ea126[_0xc939('0x26')][_0x27638c];if(path[_0xc939('0x3b')](_0x19bac8[_0xc939('0x5c')])['ext']==='.pdf'){originate(_0x30a809,_0x3e496a,!![])['then'](function(_0x2fa9b4){_0x14da15(_0x2fa9b4);})[_0xc939('0x3f')](function(_0x562014){_0x18e24a(_0x562014);});}else{originate(_0x30a809,_0x3e496a,![])[_0xc939('0x39')](function(_0x2b29bd){_0x14da15(_0x2b29bd);})['catch'](function(_0x133dbe){_0x18e24a(_0x133dbe);});}});};Fax[_0xc939('0x1d')][_0xc939('0x65')]=function(_0x21900a){return!_[_0xc939('0x66')](_0x21900a)&&!_['isNil'](_0x21900a[_0xc939('0x24')])&&!_[_0xc939('0x66')](_0x21900a[_0xc939('0x67')])&&_0x21900a[_0xc939('0x67')]&&!_['isNil'](this[_0xc939('0x10')][util[_0xc939('0x5e')]('SIP/%s',_0x21900a[_0xc939('0x24')])])&&!_[_0xc939('0x66')](this[_0xc939('0x10')][util['format'](_0xc939('0x68'),_0x21900a[_0xc939('0x24')])][_0xc939('0x2f')])&&(this[_0xc939('0x10')][util[_0xc939('0x5e')](_0xc939('0x68'),_0x21900a['name'])][_0xc939('0x2f')]===_0xc939('0x69')||this[_0xc939('0x10')][util['format']('SIP/%s',_0x21900a['name'])]['status']===_0xc939('0x6a'));};Fax['prototype']['checkTrunk']=function(_0x458b5f,_0x28fb98){if(!this[_0xc939('0x65')](_0x458b5f)){ut[_0xc939('0x48')](_0xc939('0x6b'),_[_0xc939('0x66')](_0x458b5f)?'':_0x458b5f[_0xc939('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xc939('0x6c')};}if(_[_0xc939('0x66')](_0x28fb98['fax'])){ut[_0xc939('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xc939('0x3e')](_0x28fb98));return{'isValid':![],'message':_0xc939('0x6d')};}if(_[_0xc939('0x66')](_0x28fb98['path'])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x28fb98));return{'isValid':![],'message':_0xc939('0x6e')};}return{'isValid':!![],'message':_0xc939('0x6f')};};module[_0xc939('0x70')]=Fax; \ No newline at end of file +var _0x3722=['variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','tiff2pdf','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','bind','faxstatus','syncFaxStatus','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','.pdf','stringify','catch','error','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','XMF-PATH','Action'];(function(_0x2c902f,_0x3f39ec){var _0x1ad7ae=function(_0x35358a){while(--_0x35358a){_0x2c902f['push'](_0x2c902f['shift']());}};_0x1ad7ae(++_0x3f39ec);}(_0x3722,0xfa));var _0x2372=function(_0x5cd3c1,_0x1b629a){_0x5cd3c1=_0x5cd3c1-0x0;var _0x53874d=_0x3722[_0x5cd3c1];return _0x53874d;};'use strict';var util=require('util');var _=require(_0x2372('0x0'));var BPromise=require(_0x2372('0x1'));var uuid=require(_0x2372('0x2'));var moment=require(_0x2372('0x3'));var path=require('path');var tiff2pdf=require(_0x2372('0x4'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x2372('0x5'));var ami=require('../ami');var rpcDb=require(_0x2372('0x6'));var Channel=require(_0x2372('0x7'));var ut=require(_0x2372('0x8'));var Action=require(_0x2372('0x9'));var faxAccount=require(_0x2372('0xa'));var attachment=require(_0x2372('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x244f5e){this[_0x2372('0xc')]={};this[_0x2372('0xd')]=_0x244f5e[_0x2372('0xd')];this[_0x2372('0xe')]=_0x244f5e[_0x2372('0xe')];this['actions']={};ami['on'](_0x2372('0xf'),this[_0x2372('0x10')]['bind'](this));ami['on'](_0x2372('0x11'),this[_0x2372('0x12')]['bind'](this));ami['on'](_0x2372('0x13'),this[_0x2372('0x14')]['bind'](this));ami['on'](_0x2372('0x15'),this[_0x2372('0x16')][_0x2372('0x17')](this));ami['on'](_0x2372('0x18'),this[_0x2372('0x19')][_0x2372('0x17')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0x2372('0x1a'),this[_0x2372('0x1b')][_0x2372('0x17')](this));ami['on'](_0x2372('0x1c'),this[_0x2372('0x1d')]['bind'](this));}Fax[_0x2372('0x1e')]['syncNewchannel']=function(_0x281d9f){if(_0x281d9f[_0x2372('0x1f')]===_0x2372('0x20')){for(var _0x3f3c7f in this[_0x2372('0xd')]){if(this[_0x2372('0xd')][_0x2372('0x21')](_0x3f3c7f)){if(_0x281d9f[_0x2372('0x22')]===this[_0x2372('0xd')][_0x3f3c7f][_0x2372('0x23')]){this[_0x2372('0xc')][_0x281d9f[_0x2372('0x24')]]={};this[_0x2372('0xc')][_0x281d9f[_0x2372('0x24')]][_0x2372('0x25')]=_0x281d9f[_0x2372('0x25')];this[_0x2372('0xc')][_0x281d9f[_0x2372('0x24')]]['id']=this[_0x2372('0xd')][_0x3f3c7f]['id'];this[_0x2372('0xc')][_0x281d9f[_0x2372('0x24')]][_0x2372('0x26')]=this[_0x2372('0xd')][_0x3f3c7f][_0x2372('0x26')];logger[_0x2372('0x27')](_0x281d9f['uniqueid'],_0x2372('0x28'));}}}}if(this[_0x2372('0x29')][_0x281d9f['uniqueid']]){this[_0x2372('0xc')][_0x281d9f[_0x2372('0x24')]]={};this[_0x2372('0xc')][_0x281d9f[_0x2372('0x24')]][_0x2372('0x25')]=_0x281d9f[_0x2372('0x25')];logger['info'](_0x281d9f[_0x2372('0x24')],_0x2372('0x28'));}};Fax[_0x2372('0x1e')][_0x2372('0x12')]=function(_0x5c5844){if(this[_0x2372('0xc')][_0x5c5844[_0x2372('0x24')]]){for(var _0x2f5531 in _0x5c5844[_0x2372('0x2a')]){if(_0x5c5844[_0x2372('0x2a')][_0x2372('0x21')](_0x2f5531)){this[_0x2372('0xc')][_0x5c5844[_0x2372('0x24')]][_0x2f5531]=_0x5c5844[_0x2372('0x2b')];}}}};Fax[_0x2372('0x1e')]['syncNewState']=function(_0x3954f2){if(this[_0x2372('0xc')][_0x3954f2[_0x2372('0x24')]]){this[_0x2372('0xc')][_0x3954f2[_0x2372('0x24')]][_0x2372('0x2c')]=_0x3954f2[_0x2372('0x2c')];this[_0x2372('0xc')][_0x3954f2[_0x2372('0x24')]][_0x2372('0x2d')]=_0x3954f2[_0x2372('0x2d')];}};Fax['prototype'][_0x2372('0x16')]=function(_0x27d92b){if(this[_0x2372('0xc')][_0x27d92b[_0x2372('0x24')]]){for(var _0x432fb0 in _0x27d92b[_0x2372('0x2a')]){if(_0x27d92b['variable']['hasOwnProperty'](_0x432fb0)){this[_0x2372('0xc')][_0x27d92b[_0x2372('0x24')]][_0x432fb0]=_0x27d92b[_0x2372('0x2b')];}}}};Fax['prototype'][_0x2372('0x19')]=function(_0x566304){if(this[_0x2372('0xc')][_0x566304[_0x2372('0x24')]]){this[_0x2372('0xc')][_0x566304[_0x2372('0x24')]][_0x2372('0x2e')]=_0x566304[_0x2372('0x2e')];this[_0x2372('0xc')][_0x566304[_0x2372('0x24')]]['status']=_0x566304[_0x2372('0x2f')];this[_0x2372('0xc')][_0x566304[_0x2372('0x24')]][_0x2372('0x23')]=_0x566304[_0x2372('0x23')];this[_0x2372('0xc')][_0x566304['uniqueid']]['filename']=_0x566304[_0x2372('0x30')];logger[_0x2372('0x27')](_0x566304[_0x2372('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0x2372('0x1e')][_0x2372('0x31')]=function(_0x2f090b){var _0x1b05c0=this;if(this['channels'][_0x2f090b['uniqueid']]){var _0x530868=this[_0x2372('0xc')][_0x2f090b[_0x2372('0x24')]]['id'];this['channels'][_0x2f090b['uniqueid']][_0x2372('0x32')]=_0x2f090b[_0x2372('0x32')];this[_0x2372('0xc')][_0x2f090b[_0x2372('0x24')]]['pagestransferred']=_0x2f090b[_0x2372('0x33')];this[_0x2372('0xc')][_0x2f090b['uniqueid']][_0x2372('0x23')]=_0x2f090b[_0x2372('0x23')];this['channels'][_0x2f090b['uniqueid']][_0x2372('0x34')]=_0x2f090b[_0x2372('0x34')];this['channels'][_0x2f090b[_0x2372('0x24')]][_0x2372('0x35')]=_0x2f090b[_0x2372('0x35')];this['channels'][_0x2f090b[_0x2372('0x24')]][_0x2372('0x30')]=_0x2f090b[_0x2372('0x30')];this['channels'][_0x2f090b[_0x2372('0x24')]][_0x2372('0x36')]=_0x2f090b['calleridnum'];if(this[_0x2372('0xc')][_0x2f090b['uniqueid']][_0x2372('0x33')]>0x0){tiff2pdf(_0x2f090b[_0x2372('0x30')],_0x2372('0x37'),function(_0x5d84f0){logger['info'](_0x2f090b[_0x2372('0x24')],_0x2372('0x38'),_0x5d84f0[_0x2372('0x39')]);attachment[_0x2372('0x3a')]({'name':path[_0x2372('0x3b')](_0x2f090b[_0x2372('0x30')])['name'],'basename':path[_0x2372('0x3b')](_0x2f090b[_0x2372('0x30')])['name']+'.pdf','type':_0x2372('0x3c')})[_0x2372('0x3d')](function(_0x5a6f8c){faxAccount['notify'](_0x530868,{'from':_0x2f090b[_0x2372('0x36')],'mapKey':_0x2372('0x5'),'body':path[_0x2372('0x3b')](_0x2f090b[_0x2372('0x30')])['name']+_0x2372('0x3e'),'AttachmentId':_0x5a6f8c['id']})['catch'](function(_0x47341d){logger['error'](_0x2f090b[_0x2372('0x24')],'\x20notify\x20',JSON[_0x2372('0x3f')](_0x47341d));});})[_0x2372('0x40')](function(_0x225946){logger[_0x2372('0x41')](_0x2f090b[_0x2372('0x24')],_0x2372('0x42'),JSON[_0x2372('0x3f')](_0x225946));});});}logger[_0x2372('0x27')](_0x2f090b[_0x2372('0x24')],_0x2372('0x42'));}};Fax[_0x2372('0x1e')][_0x2372('0x1d')]=function(_0x4f12e3){if(this['actions'][_0x4f12e3[_0x2372('0x24')]]){_[_0x2372('0x43')](this['channels'][_0x4f12e3[_0x2372('0x24')]],_[_0x2372('0x44')](_0x4f12e3,[_0x2372('0x45'),_0x2372('0x46')]));}};function updateStatus(_0x26b7dd){if(_0x26b7dd[_0x2372('0x47')]){faxMessage[_0x2372('0x48')](_0x26b7dd[_0x2372('0x47')],{'failMessage':_0x2372('0x49')})[_0x2372('0x3d')](function(_0x2bd81f){ut[_0x2372('0x4a')]('[Fax][Message][Error][Updated]',_0x2bd81f);})[_0x2372('0x40')](function(_0x1100c5){ut['logger'](_0x2372('0x4b'),_0x1100c5);});}else{ut[_0x2372('0x4a')](_0x2372('0x4c'));}}Fax[_0x2372('0x1e')]['updateStatus']=function(_0x3c2a42,_0x1aed79,_0x44e593){var _0x233bd1=this;var _0x5da5d2={};if(_0x1aed79){_0x5da5d2={'read':_0x1aed79};}else{_0x5da5d2={'failMessage':_0x44e593};}if(this['actions'][_0x3c2a42][_0x2372('0x47')]){faxMessage['update'](this['actions'][_0x3c2a42][_0x2372('0x47')],_0x5da5d2)[_0x2372('0x3d')](function(_0x44c8c0){ut[_0x2372('0x4a')](_0x2372('0x4d'),_0x44c8c0);})['catch'](function(_0x1c2b27){ut[_0x2372('0x4a')]('[Fax][Message][NoUpdate1]',_0x1c2b27);})['finally'](function(){delete _0x233bd1[_0x2372('0xc')][_0x3c2a42];delete _0x233bd1[_0x2372('0x29')][_0x3c2a42];});}else{ut[_0x2372('0x4a')](_0x2372('0x4e'));delete this['channels'][_0x3c2a42];delete this[_0x2372('0x29')][_0x3c2a42];}};Fax['prototype']['syncHangup']=function(_0x11f72f){var _0x193571=this;if(this[_0x2372('0xc')][_0x11f72f[_0x2372('0x24')]]){if(this['actions'][_0x11f72f[_0x2372('0x24')]]){this[_0x2372('0xc')][_0x11f72f[_0x2372('0x24')]]['id']=this[_0x2372('0x29')][_0x11f72f[_0x2372('0x24')]]['id'];this['channels'][_0x11f72f['uniqueid']][_0x2372('0x26')]=this[_0x2372('0x29')][_0x11f72f[_0x2372('0x24')]]['name'];}logger['info'](_0x11f72f['uniqueid'],this[_0x2372('0x29')][_0x11f72f[_0x2372('0x24')]]?_0x2372('0x4f'):_0x2372('0x50'),JSON[_0x2372('0x3f')](this['channels'][_0x11f72f[_0x2372('0x24')]]));if(this[_0x2372('0x29')][_0x11f72f[_0x2372('0x24')]]){if(this[_0x2372('0xc')][_0x11f72f[_0x2372('0x24')]][_0x2372('0x51')]>0x0&&this[_0x2372('0xc')][_0x11f72f['uniqueid']][_0x2372('0x18')]===_0x2372('0x52')){this[_0x2372('0x53')](_0x11f72f[_0x2372('0x24')],!![]);}else{this[_0x2372('0x53')](_0x11f72f[_0x2372('0x24')],![],this['channels'][_0x11f72f['uniqueid']][_0x2372('0x54')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x11f72f[_0x2372('0x24')]][_0x2372('0x54')]:_0x2372('0x55'));}}}};Fax[_0x2372('0x1e')][_0x2372('0x56')]=function(_0x22bb6a){var _0x8f3473=this;return new BPromise(function(_0xcd6357,_0x2235d4){_0x8f3473[_0x2372('0x57')](_0x22bb6a,_0x8f3473[_0x2372('0xd')][_0x22bb6a['FaxAccountId']])[_0x2372('0x3d')](function(_0x2b1d0b){ut[_0x2372('0x4a')]('[Fax][execOriginate][success]',_0x2b1d0b);_0xcd6357(ut[_0x2372('0x39')](_0x2372('0x58')));})[_0x2372('0x40')](function(_0x387315){ut['logger'](_0x2372('0x59'),_0x387315);updateStatus(_0x22bb6a);_0x2235d4(ut[_0x2372('0x39')]('Fax\x20failed'));});});};Fax[_0x2372('0x1e')]['checkAfterSend']=function(_0x110255){var _0x4c4b06=this;return new BPromise(function(_0x1efa67,_0x46b09a){var _0x1949d4=_0x4c4b06['checkTrunk'](_0x4c4b06['faxAccounts'][_0x110255[_0x2372('0x5a')]][_0x2372('0x5b')],_0x110255);if(_0x1949d4[_0x2372('0x5c')]){_0x1efa67(ut[_0x2372('0x39')](_0x2372('0x5d')));}else{_0x46b09a(ut[_0x2372('0x39')](_0x1949d4[_0x2372('0x39')]));}});};function originate(_0x3056d0,_0x5a8012,_0xbdc1b7){return new BPromise(function(_0x114771,_0x33629a){if(_0xbdc1b7){var _0x23963d=util[_0x2372('0x5e')](_0x2372('0x5f'),path[_0x2372('0x3b')](_0x3056d0[_0x2372('0x60')])[_0x2372('0x26')],_0x3056d0[_0x2372('0x60')]);gs[_0x2372('0x61')](_0x23963d)[_0x2372('0x3d')](function(){_0x3056d0['path']=util[_0x2372('0x5e')](_0x2372('0x62'),path[_0x2372('0x3b')](_0x3056d0['path'])['dir'],path[_0x2372('0x3b')](_0x3056d0[_0x2372('0x60')])['name']);_0x5a8012[_0x2372('0x63')]=_0x3056d0['path'];ut[_0x2372('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami[_0x2372('0x64')](ut[_0x2372('0x65')](_0x3056d0,_0x5a8012))[_0x2372('0x3d')](function(_0x263d71){_0x114771(_0x263d71);})['catch'](function(_0x395609){_0x33629a(_0x395609);});})[_0x2372('0x40')](function(_0x21578f){_0x33629a(_0x21578f);});}else{ami[_0x2372('0x64')](ut[_0x2372('0x65')](_0x3056d0,_0x5a8012))[_0x2372('0x3d')](function(_0x5ee7f6){_0x114771(_0x5ee7f6);})['catch'](function(_0x3285fe){_0x33629a(_0x3285fe);});}});}Fax[_0x2372('0x1e')][_0x2372('0x57')]=function(_0x1750f7,_0x3480fe){var _0x547c5a=this;return new BPromise(function(_0x16373e,_0x1ffe97){var _0x54f7b8=uuid['v4']();var _0x5cff12=ut['addVariables'](_0x1750f7,_0x3480fe);_0x547c5a[_0x2372('0x29')][_0x54f7b8]=new Action(_0x54f7b8,_0x3480fe,_0x1750f7);var _0x2f10ad=_0x547c5a['actions'][_0x54f7b8];if(path[_0x2372('0x3b')](_0x1750f7[_0x2372('0x60')])[_0x2372('0x66')]===_0x2372('0x3e')){originate(_0x2f10ad,_0x5cff12,!![])[_0x2372('0x3d')](function(_0xd6b2de){_0x16373e(_0xd6b2de);})[_0x2372('0x40')](function(_0x568c86){_0x1ffe97(_0x568c86);});}else{originate(_0x2f10ad,_0x5cff12,![])[_0x2372('0x3d')](function(_0xa87547){_0x16373e(_0xa87547);})[_0x2372('0x40')](function(_0x32d77b){_0x1ffe97(_0x32d77b);});}});};Fax[_0x2372('0x1e')][_0x2372('0x67')]=function(_0x28a0a4){return!_['isNil'](_0x28a0a4)&&!_['isNil'](_0x28a0a4[_0x2372('0x26')])&&!_[_0x2372('0x68')](_0x28a0a4[_0x2372('0x69')])&&_0x28a0a4[_0x2372('0x69')]&&!_[_0x2372('0x68')](this['trunks'][util[_0x2372('0x5e')](_0x2372('0x6a'),_0x28a0a4['name'])])&&!_[_0x2372('0x68')](this[_0x2372('0xe')][util['format'](_0x2372('0x6a'),_0x28a0a4['name'])][_0x2372('0x2f')])&&(this[_0x2372('0xe')][util[_0x2372('0x5e')](_0x2372('0x6a'),_0x28a0a4['name'])][_0x2372('0x2f')]==='reachable'||this[_0x2372('0xe')][util[_0x2372('0x5e')](_0x2372('0x6a'),_0x28a0a4['name'])][_0x2372('0x2f')]===_0x2372('0x6b'));};Fax[_0x2372('0x1e')][_0x2372('0x6c')]=function(_0x5c8215,_0x3864c0){if(!this[_0x2372('0x67')](_0x5c8215)){ut[_0x2372('0x4a')](_0x2372('0x6d'),_[_0x2372('0x68')](_0x5c8215)?'':_0x5c8215['name']+_0x2372('0x6e'));return{'isValid':![],'message':_0x2372('0x6f')};}if(_['isNil'](_0x3864c0[_0x2372('0x5')])){ut[_0x2372('0x4a')](_0x2372('0x70'),JSON[_0x2372('0x3f')](_0x3864c0));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x3864c0[_0x2372('0x60')])){ut[_0x2372('0x4a')](_0x2372('0x71'),JSON[_0x2372('0x3f')](_0x3864c0));return{'isValid':![],'message':_0x2372('0x72')};}return{'isValid':!![],'message':_0x2372('0x73')};};module[_0x2372('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0cd6974..72b07e5 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 _0x5c27=['../rpc/faxAccount','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x5135c0,_0x47ba49){var _0x1d735a=function(_0x6774ff){while(--_0x6774ff){_0x5135c0['push'](_0x5135c0['shift']());}};_0x1d735a(++_0x47ba49);}(_0x5c27,0x127));var _0x75c2=function(_0x2ef1a5,_0x316aac){_0x2ef1a5=_0x2ef1a5-0x0;var _0x268769=_0x5c27[_0x2ef1a5];return _0x268769;};'use strict';var util=require(_0x75c2('0x0'));var BPromise=require(_0x75c2('0x1'));var logger=require(_0x75c2('0x2'))(_0x75c2('0x3'));var _=require(_0x75c2('0x4'));var faxAccount=require(_0x75c2('0x5'));function loggerCatch(_0x3e3747){return function(_0x58562c){logger['error'](_0x3e3747,util[_0x75c2('0x6')](_0x58562c,{'showHidden':![],'depth':null}));};}exports[_0x75c2('0x7')]=function(_0x88d152,_0x444471){return BPromise[_0x75c2('0x8')]()[_0x75c2('0x9')](faxAccount[_0x75c2('0x7')](_0x88d152,_0x444471))[_0x75c2('0xa')](loggerCatch(_0x75c2('0xb')));}; \ No newline at end of file +var _0x0a7a=['notify','resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','inspect'];(function(_0x180dda,_0x577ad9){var _0x5d003c=function(_0x2cdfd6){while(--_0x2cdfd6){_0x180dda['push'](_0x180dda['shift']());}};_0x5d003c(++_0x577ad9);}(_0x0a7a,0xae));var _0xa0a7=function(_0x19e88e,_0x23fcc9){_0x19e88e=_0x19e88e-0x0;var _0x1b6458=_0x0a7a[_0x19e88e];return _0x1b6458;};'use strict';var util=require(_0xa0a7('0x0'));var BPromise=require(_0xa0a7('0x1'));var logger=require(_0xa0a7('0x2'))(_0xa0a7('0x3'));var _=require('lodash');var faxAccount=require(_0xa0a7('0x4'));function loggerCatch(_0x22873b){return function(_0x185872){logger['error'](_0x22873b,util[_0xa0a7('0x5')](_0x185872,{'showHidden':![],'depth':null}));};}exports[_0xa0a7('0x6')]=function(_0x176d50,_0x2be17e){return BPromise[_0xa0a7('0x7')]()[_0xa0a7('0x8')](faxAccount[_0xa0a7('0x6')](_0x176d50,_0x2be17e))['catch'](loggerCatch(_0xa0a7('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index bcb8c1e..dae1103 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 _0x458c=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info'];(function(_0xa1a044,_0x30be35){var _0x2b88d9=function(_0x1689c4){while(--_0x1689c4){_0xa1a044['push'](_0xa1a044['shift']());}};_0x2b88d9(++_0x30be35);}(_0x458c,0x92));var _0xc458=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0x458c[_0x4a93bb];return _0x208468;};'use strict';var util=require(_0xc458('0x0'));var logger=require(_0xc458('0x1'))(_0xc458('0x2'));var BPromise=require(_0xc458('0x3'));var exec=require(_0xc458('0x4'))[_0xc458('0x5')];exports[_0xc458('0x6')]=function(_0x23e8ec){return new BPromise(function(_0x507038,_0x210bb4){exec(_0x23e8ec,function(_0x234785,_0x4f986b,_0x3e5f8b){logger[_0xc458('0x7')](_0xc458('0x8'),_0x4f986b);if(_0x234785){logger[_0xc458('0x7')](_0xc458('0x8'),_0xc458('0x9'),util[_0xc458('0xa')](_0x234785,{'showHidden':![],'depth':null}),_0x4f986b,_0x3e5f8b);_0x210bb4(_0x234785);}_0x507038(_0x4f986b);});});}; \ No newline at end of file +var _0xeb0c=['util','bluebird','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xeb0c,0x1b0));var _0xceb0=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xeb0c[_0x3712e2];return _0x1faff4;};'use strict';var util=require(_0xceb0('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xceb0('0x1'));var exec=require(_0xceb0('0x2'))[_0xceb0('0x3')];exports[_0xceb0('0x4')]=function(_0x48ac49){return new BPromise(function(_0x3d9107,_0x1e23a1){exec(_0x48ac49,function(_0x2e0605,_0x4e1c8b,_0x20a25f){logger['info'](_0xceb0('0x5'),_0x4e1c8b);if(_0x2e0605){logger[_0xceb0('0x6')](_0xceb0('0x5'),_0xceb0('0x7'),util[_0xceb0('0x8')](_0x2e0605,{'showHidden':![],'depth':null}),_0x4e1c8b,_0x20a25f);_0x1e23a1(_0x2e0605);}_0x3d9107(_0x4e1c8b);});});}; \ 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 5bf4544..a8102f1 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 _0x9297=['info','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger'];(function(_0xa86d7f,_0x37c258){var _0x42b4ed=function(_0x23fb10){while(--_0x23fb10){_0xa86d7f['push'](_0xa86d7f['shift']());}};_0x42b4ed(++_0x37c258);}(_0x9297,0x9b));var _0x7929=function(_0x5072f2,_0x125bca){_0x5072f2=_0x5072f2-0x0;var _0xc0e70d=_0x9297[_0x5072f2];return _0xc0e70d;};'use strict';var util=require(_0x7929('0x0'));var _=require(_0x7929('0x1'));var moment=require(_0x7929('0x2'));var logger=require(_0x7929('0x3'))(_0x7929('0x4'));exports[_0x7929('0x5')]=function(_0x3b991c){return{'message':_0x3b991c};};exports[_0x7929('0x6')]=function(_0x1732b6,_0x256aa9){logger[_0x7929('0x7')](_0x1732b6,util['inspect'](_0x256aa9,{'showHidden':![],'depth':null}));};exports[_0x7929('0x8')]=function(_0x9ebf9c,_0xac663a){var _0x403728={'XMF-ECM':_0xac663a[_0x7929('0x9')],'XMF-HEADERINFO':_0xac663a[_0x7929('0xa')],'XMF-MINRATE':_0xac663a[_0x7929('0xb')],'XMF-MAXRATE':_0xac663a[_0x7929('0xc')],'XMF-MODEM':util[_0x7929('0xd')](_0x7929('0xe'),_0xac663a[_0x7929('0xf')]),'XMF-GATEWAY':_0xac663a[_0x7929('0x10')],'XMF-FAXDETECT':_0xac663a[_0x7929('0x11')],'XMF-T38TIMEOUT':_0xac663a[_0x7929('0x12')],'XMF-LOCALSTATIONID':_0xac663a[_0x7929('0x13')],'XMF-PATH':_0x9ebf9c['path']};return _0x403728;};exports[_0x7929('0x14')]=function(_0x45e4e2,_0xbd450){return{'actionid':_0x45e4e2[_0x7929('0x15')],'action':_0x7929('0x16'),'channel':_0x45e4e2[_0x7929('0x17')],'Exten':_0x7929('0x18'),'Context':_0x7929('0x19'),'Priority':'1','callerid':util[_0x7929('0xd')](_0x7929('0x1a'),_0x45e4e2[_0x7929('0xa')]?_0x45e4e2[_0x7929('0xa')]:'',_0x45e4e2[_0x7929('0x13')]),'variable':_0xbd450,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x45e4e2[_0x7929('0x15')]};}; \ No newline at end of file +var _0xbacc=['\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','addVariables','minrate','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','uniqueid','channel','xcally-motion-fax','from-sip'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xbacc,0x122));var _0xcbac=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xbacc[_0x38a7ac];return _0x53061a;};'use strict';var util=require(_0xcbac('0x0'));var _=require(_0xcbac('0x1'));var moment=require(_0xcbac('0x2'));var logger=require(_0xcbac('0x3'))('fax');exports[_0xcbac('0x4')]=function(_0x25d85f){return{'message':_0x25d85f};};exports[_0xcbac('0x5')]=function(_0x55cb39,_0x5de880){logger[_0xcbac('0x6')](_0x55cb39,util[_0xcbac('0x7')](_0x5de880,{'showHidden':![],'depth':null}));};exports[_0xcbac('0x8')]=function(_0x4e3bba,_0x267644){var _0x4653a1={'XMF-ECM':_0x267644['ecm'],'XMF-HEADERINFO':_0x267644['headerinfo'],'XMF-MINRATE':_0x267644[_0xcbac('0x9')],'XMF-MAXRATE':_0x267644[_0xcbac('0xa')],'XMF-MODEM':util[_0xcbac('0xb')](_0xcbac('0xc'),_0x267644[_0xcbac('0xd')]),'XMF-GATEWAY':_0x267644['gateway'],'XMF-FAXDETECT':_0x267644[_0xcbac('0xe')],'XMF-T38TIMEOUT':_0x267644[_0xcbac('0xf')],'XMF-LOCALSTATIONID':_0x267644[_0xcbac('0x10')],'XMF-PATH':_0x4e3bba[_0xcbac('0x11')]};return _0x4653a1;};exports['variablesAction']=function(_0x45eb71,_0x51c29e){return{'actionid':_0x45eb71[_0xcbac('0x12')],'action':'originate','channel':_0x45eb71[_0xcbac('0x13')],'Exten':_0xcbac('0x14'),'Context':_0xcbac('0x15'),'Priority':'1','callerid':util['format'](_0xcbac('0x16'),_0x45eb71[_0xcbac('0x17')]?_0x45eb71['headerinfo']:'',_0x45eb71[_0xcbac('0x10')]),'variable':_0x51c29e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x45eb71[_0xcbac('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b2dff72..719edbd 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 _0x3806=['initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','moment','./realtime','./report','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','../../config/logger','ami','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x3806,0x1eb));var _0x6380=function(_0x59997b,_0x29c5bc){_0x59997b=_0x59997b-0x0;var _0x201225=_0x3806[_0x59997b];return _0x201225;};'use strict';var util=require('util');var moment=require(_0x6380('0x0'));var server=require('./server');var Realtime=require(_0x6380('0x1'));var Report=require(_0x6380('0x2'));var Acw=require('./acw');var Trigger=require(_0x6380('0x3'));var Dialer=require(_0x6380('0x4'));var Preview=require('./preview');var Fax=require(_0x6380('0x5'));var user=require(_0x6380('0x6'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x6380('0x7'));var voiceCallReport=require(_0x6380('0x8'));var trunk=require(_0x6380('0x9'));var trigger=require(_0x6380('0xa'));var template=require(_0x6380('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x6380('0xc'));var voiceExtension=require(_0x6380('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x6380('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x6380('0xf'));var freshdesk=require(_0x6380('0x10'));var desk=require(_0x6380('0x11'));var zoho=require(_0x6380('0x12'));var vtiger=require(_0x6380('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x6380('0x14'))(_0x6380('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x6380('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x6380('0x17')]()[_0x6380('0x18')](user[_0x6380('0x19')]())[_0x6380('0x18')](realtime[_0x6380('0x1a')]())[_0x6380('0x18')](user[_0x6380('0x1b')]())[_0x6380('0x18')](realtime[_0x6380('0x1c')]())[_0x6380('0x18')](trunk['getTrunks']())[_0x6380('0x18')](realtime[_0x6380('0x1d')]())['then'](voiceQueue[_0x6380('0x1e')]())[_0x6380('0x18')](realtime[_0x6380('0x1f')]())[_0x6380('0x18')](trigger[_0x6380('0x20')]())[_0x6380('0x18')](realtime[_0x6380('0x21')]())[_0x6380('0x18')](template[_0x6380('0x22')]())[_0x6380('0x18')](realtime[_0x6380('0x23')]())['then'](zendesk['getZendeskAccounts']())['then'](realtime['initZendeskAccounts']())[_0x6380('0x18')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x6380('0x24')]())[_0x6380('0x18')](sugarcrm[_0x6380('0x25')]())[_0x6380('0x18')](realtime[_0x6380('0x26')]())[_0x6380('0x18')](freshdesk[_0x6380('0x27')]())['then'](realtime[_0x6380('0x28')]())[_0x6380('0x18')](desk[_0x6380('0x29')]())['then'](realtime['initDeskAccounts']())[_0x6380('0x18')](zoho[_0x6380('0x2a')]())['then'](realtime[_0x6380('0x2b')]())[_0x6380('0x18')](vtiger[_0x6380('0x2c')]())[_0x6380('0x18')](realtime['initVtigerAccounts']())[_0x6380('0x18')](freshsales[_0x6380('0x2d')]())[_0x6380('0x18')](realtime[_0x6380('0x2e')]())[_0x6380('0x18')](servicenow[_0x6380('0x2f')]())['then'](realtime['initServicenowAccounts']())[_0x6380('0x18')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x6380('0x30')]())[_0x6380('0x18')](campaign[_0x6380('0x31')]())[_0x6380('0x18')](realtime['initCampaigns']())[_0x6380('0x18')](voiceExtension[_0x6380('0x32')]())[_0x6380('0x18')](realtime[_0x6380('0x33')]())[_0x6380('0x18')](faxAccount[_0x6380('0x34')]())['then'](realtime['initFaxAccounts']())[_0x6380('0x18')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x6380('0x18')](voiceQueueReport[_0x6380('0x35')]())[_0x6380('0x18')](realtime[_0x6380('0x36')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x6380('0x18')](realtime[_0x6380('0x37')]())[_0x6380('0x18')](cmHopperHistory[_0x6380('0x38')]())[_0x6380('0x18')](realtime[_0x6380('0x39')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x6380('0x18')](realtime[_0x6380('0x3a')]())[_0x6380('0x3b')](function(_0x25e86f){logger['error'](_0x6380('0x3c'),util[_0x6380('0x3d')](_0x25e86f,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6380('0x3e')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x6380('0x18')](function(){return initParams();})['then'](function(){report[_0x6380('0x3f')]();setInterval(initRealtime,0x1388);})[_0x6380('0x3b')](function(_0x489e71){logger[_0x6380('0x40')]('[index.js][main]',util[_0x6380('0x3d')](_0x489e71,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x408d=['hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','inspect','listen','sync','catch','util','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','ami','get'];(function(_0x366c1b,_0x2503d1){var _0x21d27e=function(_0x355d03){while(--_0x355d03){_0x366c1b['push'](_0x366c1b['shift']());}};_0x21d27e(++_0x2503d1);}(_0x408d,0xb3));var _0xd408=function(_0x233966,_0x5b6367){_0x233966=_0x233966-0x0;var _0x4489eb=_0x408d[_0x233966];return _0x4489eb;};'use strict';var util=require(_0xd408('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require(_0xd408('0x1'));var Report=require('./report');var Acw=require(_0xd408('0x2'));var Trigger=require(_0xd408('0x3'));var Dialer=require(_0xd408('0x4'));var Preview=require(_0xd408('0x5'));var Fax=require(_0xd408('0x6'));var user=require(_0xd408('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xd408('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xd408('0x9'));var template=require(_0xd408('0xa'));var cmHopperHistory=require(_0xd408('0xb'));var campaign=require(_0xd408('0xc'));var voiceExtension=require(_0xd408('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xd408('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xd408('0xf'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xd408('0x10'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xd408('0x11'));var freshsales=require(_0xd408('0x12'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xd408('0x13'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xd408('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd408('0x15')](_0xd408('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd408('0x15')](_0xd408('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xd408('0x17')]()[_0xd408('0x18')](user[_0xd408('0x19')]())[_0xd408('0x18')](realtime[_0xd408('0x1a')]())[_0xd408('0x18')](user[_0xd408('0x1b')]())[_0xd408('0x18')](realtime[_0xd408('0x1c')]())[_0xd408('0x18')](trunk[_0xd408('0x1d')]())['then'](realtime[_0xd408('0x1e')]())[_0xd408('0x18')](voiceQueue[_0xd408('0x1f')]())[_0xd408('0x18')](realtime['initVoiceQueues']())[_0xd408('0x18')](trigger[_0xd408('0x20')]())['then'](realtime[_0xd408('0x21')]())[_0xd408('0x18')](template['getTemplates']())[_0xd408('0x18')](realtime[_0xd408('0x22')]())[_0xd408('0x18')](zendesk[_0xd408('0x23')]())['then'](realtime['initZendeskAccounts']())[_0xd408('0x18')](salesforce[_0xd408('0x24')]())[_0xd408('0x18')](realtime[_0xd408('0x25')]())['then'](sugarcrm[_0xd408('0x26')]())[_0xd408('0x18')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xd408('0x27')]())[_0xd408('0x18')](realtime[_0xd408('0x28')]())[_0xd408('0x18')](desk[_0xd408('0x29')]())[_0xd408('0x18')](realtime['initDeskAccounts']())[_0xd408('0x18')](zoho[_0xd408('0x2a')]())[_0xd408('0x18')](realtime['initZohoAccounts']())[_0xd408('0x18')](vtiger['getVtigerAccounts']())[_0xd408('0x18')](realtime[_0xd408('0x2b')]())[_0xd408('0x18')](freshsales[_0xd408('0x2c')]())[_0xd408('0x18')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0xd408('0x2d')]())[_0xd408('0x18')](realtime[_0xd408('0x2e')]())['then'](dynamics365[_0xd408('0x2f')]())[_0xd408('0x18')](realtime[_0xd408('0x30')]())[_0xd408('0x18')](campaign[_0xd408('0x31')]())[_0xd408('0x18')](realtime[_0xd408('0x32')]())[_0xd408('0x18')](voiceExtension[_0xd408('0x33')]())[_0xd408('0x18')](realtime[_0xd408('0x34')]())[_0xd408('0x18')](faxAccount[_0xd408('0x35')]())[_0xd408('0x18')](realtime[_0xd408('0x36')]())[_0xd408('0x18')](function(){return realtime;});}function initParams(){return Promise[_0xd408('0x17')]()[_0xd408('0x18')](voiceQueueReport[_0xd408('0x37')]())[_0xd408('0x18')](realtime[_0xd408('0x38')]())[_0xd408('0x18')](cmHopperHistory[_0xd408('0x39')]())[_0xd408('0x18')](realtime[_0xd408('0x3a')]())['then'](cmHopperHistory[_0xd408('0x3b')]())[_0xd408('0x18')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xd408('0x3c')]())['then'](realtime[_0xd408('0x3d')]())['catch'](function(_0x1d93ba){logger['error'](_0xd408('0x3e'),util[_0xd408('0x3f')](_0x1d93ba,{'showHidden':![],'depth':null}));});}function main(){return server[_0xd408('0x40')](realtime,preview,fax)[_0xd408('0x18')](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xd408('0x41')]();setInterval(initRealtime,0x1388);})[_0xd408('0x42')](function(_0x593169){logger['error']('[index.js][main]',util[_0xd408('0x3f')](_0x593169,{'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 e7e9662..a35049c 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 _0xf908=['localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','onhold','local','prototype','toLowerCase','idle','inuse','talking','statePause','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf908,0x128));var _0x8f90=function(_0x23693c,_0xfffbf3){_0x23693c=_0x23693c-0x0;var _0x5d4377=_0xf908[_0x23693c];return _0x5d4377;};'use strict';var _=require(_0x8f90('0x0'));var util=require(_0x8f90('0x1'));var moment=require(_0x8f90('0x2'));var md5=require(_0x8f90('0x3'));var Redis=require(_0x8f90('0x4'));var config=require(_0x8f90('0x5'));config[_0x8f90('0x6')]=_[_0x8f90('0x7')](config[_0x8f90('0x6')],{'host':_0x8f90('0x8'),'port':0x18eb});var io=require(_0x8f90('0x9'))(new Redis(config[_0x8f90('0x6')]));function Agent(_0x1baeb6){this['id']=_0x1baeb6['id']||0x0;this[_0x8f90('0xa')]=_0x1baeb6['name']||'';this[_0x8f90('0xb')]=_0x1baeb6[_0x8f90('0xb')]||'';this[_0x8f90('0xc')]=_0x1baeb6[_0x8f90('0xc')]||'';this[_0x8f90('0xd')]=_0x1baeb6['fullname']||'';this[_0x8f90('0xe')]='unknown';this[_0x8f90('0xf')]=0x0;this[_0x8f90('0x10')]='unknown';this[_0x8f90('0x11')]='';this[_0x8f90('0x12')]='';this[_0x8f90('0x13')]='';this[_0x8f90('0x14')]='';this[_0x8f90('0x15')]=_0x1baeb6[_0x8f90('0x15')]||![];this[_0x8f90('0x16')]='unknown';this[_0x8f90('0x17')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x8f90('0x18')]=![];this[_0x8f90('0x19')]=![];this[_0x8f90('0x3')]='';}Agent[_0x8f90('0x1a')]['updateStatusRealtime']=function(_0x261cee){var _0x1fbd4a;if(_0x261cee&&_0x261cee['state']){_0x1fbd4a=_0x261cee['state'][_0x8f90('0x1b')]();switch(_0x1fbd4a){case'not_inuse':_0x1fbd4a=_0x8f90('0x1c');break;case _0x8f90('0x1d'):_0x1fbd4a=_0x8f90('0x1e');break;}}if(_0x1fbd4a&&this['voiceStatus']!==_0x1fbd4a||_0x261cee[_0x8f90('0x1f')]){this[_0x8f90('0x17')]=_['toNumber'](moment()[_0x8f90('0x20')]('x'));}if(_0x1fbd4a){this['voiceStatus']=_0x1fbd4a;}var _0x4dffbe={'id':this['id'],'name':this['name'],'email':this[_0x8f90('0xb')],'accountcode':this[_0x8f90('0xc')],'fullname':this[_0x8f90('0xd')],'state':this[_0x8f90('0xe')],'stateTime':this[_0x8f90('0xf')],'status':this[_0x8f90('0x10')],'address':this[_0x8f90('0x11')],'online':this[_0x8f90('0x15')],'voiceStatus':this[_0x8f90('0x16')],'voiceStatusTime':this[_0x8f90('0x17')],'voiceStatusCallerIdNumber':this[_0x8f90('0x21')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x8f90('0x14')],'onhold':this[_0x8f90('0x18')]};var _0x131726=md5(JSON[_0x8f90('0x22')](_0x4dffbe));if(this[_0x8f90('0x3')]!==_0x131726){this[_0x8f90('0x3')]=_0x131726;io['to'](util[_0x8f90('0x20')](_0x8f90('0x23'),_0x4dffbe['name']))[_0x8f90('0x24')]('user:save',_0x4dffbe);io[_0x8f90('0x24')]('user:presence',_0x4dffbe);}};module[_0x8f90('0x25')]=Agent; \ No newline at end of file +var _0x6e78=['format','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','state','toLowerCase','not_inuse','talking','voiceStatusTime'];(function(_0x37d719,_0x36a50e){var _0x487d52=function(_0x26587d){while(--_0x26587d){_0x37d719['push'](_0x37d719['shift']());}};_0x487d52(++_0x36a50e);}(_0x6e78,0x16f));var _0x86e7=function(_0x19921b,_0x5c0c2d){_0x19921b=_0x19921b-0x0;var _0x273545=_0x6e78[_0x19921b];return _0x273545;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x86e7('0x0'));var md5=require(_0x86e7('0x1'));var Redis=require(_0x86e7('0x2'));var config=require(_0x86e7('0x3'));config[_0x86e7('0x4')]=_[_0x86e7('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x86e7('0x6'))(new Redis(config['redis']));function Agent(_0x23fe44){this['id']=_0x23fe44['id']||0x0;this[_0x86e7('0x7')]=_0x23fe44[_0x86e7('0x7')]||'';this[_0x86e7('0x8')]=_0x23fe44['email']||'';this[_0x86e7('0x9')]=_0x23fe44[_0x86e7('0x9')]||'';this['fullname']=_0x23fe44[_0x86e7('0xa')]||'';this['state']=_0x86e7('0xb');this[_0x86e7('0xc')]=0x0;this[_0x86e7('0xd')]=_0x86e7('0xb');this['address']='';this[_0x86e7('0xe')]='';this[_0x86e7('0xf')]='';this[_0x86e7('0x10')]='';this[_0x86e7('0x11')]=_0x23fe44['online']||![];this[_0x86e7('0x12')]=_0x86e7('0xb');this['voiceStatusTime']=0x0;this[_0x86e7('0x13')]='';this[_0x86e7('0x14')]='';this[_0x86e7('0x15')]=![];this[_0x86e7('0x16')]=![];this['md5']='';}Agent[_0x86e7('0x17')]['updateStatusRealtime']=function(_0x5a8444){var _0x3a9930;if(_0x5a8444&&_0x5a8444[_0x86e7('0x18')]){_0x3a9930=_0x5a8444[_0x86e7('0x18')][_0x86e7('0x19')]();switch(_0x3a9930){case _0x86e7('0x1a'):_0x3a9930='idle';break;case'inuse':_0x3a9930=_0x86e7('0x1b');break;}}if(_0x3a9930&&this[_0x86e7('0x12')]!==_0x3a9930||_0x5a8444['statePause']){this[_0x86e7('0x1c')]=_['toNumber'](moment()[_0x86e7('0x1d')]('x'));}if(_0x3a9930){this['voiceStatus']=_0x3a9930;}var _0x369d9f={'id':this['id'],'name':this[_0x86e7('0x7')],'email':this[_0x86e7('0x8')],'accountcode':this[_0x86e7('0x9')],'fullname':this[_0x86e7('0xa')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x86e7('0xd')],'address':this['address'],'online':this[_0x86e7('0x11')],'voiceStatus':this[_0x86e7('0x12')],'voiceStatusTime':this[_0x86e7('0x1c')],'voiceStatusCallerIdNumber':this[_0x86e7('0x13')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x86e7('0x10')],'onhold':this[_0x86e7('0x15')]};var _0x39c660=md5(JSON[_0x86e7('0x1e')](_0x369d9f));if(this[_0x86e7('0x1')]!==_0x39c660){this[_0x86e7('0x1')]=_0x39c660;io['to'](util['format'](_0x86e7('0x1f'),_0x369d9f[_0x86e7('0x7')]))[_0x86e7('0x20')](_0x86e7('0x21'),_0x369d9f);io[_0x86e7('0x20')](_0x86e7('0x22'),_0x369d9f);}};module[_0x86e7('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5d746d4..0115007 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 _0x5d06=['ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay'];(function(_0x34d0e2,_0x47901b){var _0x45a9ba=function(_0x327b2c){while(--_0x327b2c){_0x34d0e2['push'](_0x34d0e2['shift']());}};_0x45a9ba(++_0x47901b);}(_0x5d06,0x8d));var _0x65d0=function(_0x2d63aa,_0x35a260){_0x2d63aa=_0x2d63aa-0x0;var _0x659809=_0x5d06[_0x2d63aa];return _0x659809;};'use strict';function Campaign(_0x142d3c){this['id']=_0x142d3c['id']||0x0;this[_0x65d0('0x0')]=_0x142d3c['name']||'';this[_0x65d0('0x1')]=_0x142d3c[_0x65d0('0x1')]||_0x65d0('0x2');this[_0x65d0('0x3')]=0x0;this[_0x65d0('0x4')]=0x0;this[_0x65d0('0x5')]=0x0;this[_0x65d0('0x6')]=0x0;this['message']='';this[_0x65d0('0x7')]=!![];this[_0x65d0('0x8')]=_0x142d3c['active'];this[_0x65d0('0x9')]=_0x142d3c['limitCalls'];this['dialTimezone']=_0x142d3c['dialTimezone']||null;this[_0x65d0('0xa')]=_0x142d3c[_0x65d0('0xa')]?_0x142d3c['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x142d3c[_0x65d0('0xb')];this[_0x65d0('0xc')]=_0x142d3c[_0x65d0('0xc')];this['dialOriginateTimeout']=_0x142d3c['dialOriginateTimeout']||0x1e;this[_0x65d0('0xd')]=_0x142d3c[_0x65d0('0xd')];this[_0x65d0('0xe')]=_0x142d3c[_0x65d0('0xe')];this[_0x65d0('0xf')]=_0x142d3c[_0x65d0('0xf')];this[_0x65d0('0x10')]=_0x142d3c[_0x65d0('0x10')];this[_0x65d0('0x11')]=_0x142d3c['dialNoAnswerMaxRetry'];this[_0x65d0('0x12')]=_0x142d3c['dialNoAnswerRetryFrequency'];this[_0x65d0('0x13')]=_0x142d3c[_0x65d0('0x13')];this[_0x65d0('0x14')]=_0x142d3c[_0x65d0('0x14')]||0x3;this[_0x65d0('0x15')]=_0x142d3c['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x142d3c['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x142d3c[_0x65d0('0x16')]||0x96;this[_0x65d0('0x17')]=_0x142d3c[_0x65d0('0x17')]||0x3;this[_0x65d0('0x18')]=_0x142d3c[_0x65d0('0x18')]||0x96;this[_0x65d0('0x19')]=_0x142d3c[_0x65d0('0x19')]||0x3;this[_0x65d0('0x1a')]=_0x142d3c[_0x65d0('0x1a')]||0x96;this[_0x65d0('0x1b')]=_0x142d3c['dialAgentRejectMaxRetry']||0x3;this[_0x65d0('0x1c')]=_0x142d3c[_0x65d0('0x1c')]||0x96;this[_0x65d0('0x1d')]=_0x142d3c[_0x65d0('0x1d')]||_0x65d0('0x1e');this[_0x65d0('0x1f')]=_0x142d3c[_0x65d0('0x1f')]||undefined;this[_0x65d0('0x20')]=_0x142d3c[_0x65d0('0x20')]||undefined;this[_0x65d0('0x21')]=_0x142d3c[_0x65d0('0x21')]||undefined;this[_0x65d0('0x22')]=_0x142d3c['TrunkBackup']?_0x142d3c['TrunkBackup']:undefined;this['Trunk']=_0x142d3c[_0x65d0('0x23')]?_0x142d3c['Trunk']:undefined;this[_0x65d0('0x24')]=_0x142d3c[_0x65d0('0x24')]?_0x142d3c[_0x65d0('0x24')]:undefined;this[_0x65d0('0x25')]=_0x142d3c[_0x65d0('0x25')]?_0x142d3c[_0x65d0('0x25')]:undefined;this['dialQueueProject']=_0x142d3c['SquareProject']?_0x142d3c[_0x65d0('0x25')][_0x65d0('0x0')]:undefined;this[_0x65d0('0x26')]=_0x142d3c['dialAMDActive']||![];this[_0x65d0('0x27')]=_0x142d3c[_0x65d0('0x27')];this[_0x65d0('0x28')]=_0x142d3c[_0x65d0('0x28')];this['dialAMDAfterGreetingSilence']=_0x142d3c[_0x65d0('0x29')];this['dialAMDTotalAnalysisTime']=_0x142d3c[_0x65d0('0x2a')];this[_0x65d0('0x2b')]=_0x142d3c[_0x65d0('0x2b')];this['dialAMDBetweenWordsSilence']=_0x142d3c[_0x65d0('0x2c')];this[_0x65d0('0x2d')]=_0x142d3c[_0x65d0('0x2d')];this[_0x65d0('0x2e')]=_0x142d3c[_0x65d0('0x2e')];this[_0x65d0('0x2f')]=_0x142d3c['dialAMDMaximumWordLength'];}module[_0x65d0('0x30')]=Campaign; \ No newline at end of file +var _0x1399=['dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x1399,0x1d7));var _0x9139=function(_0x3cc7db,_0x36b9a5){_0x3cc7db=_0x3cc7db-0x0;var _0x3a9d0d=_0x1399[_0x3cc7db];return _0x3a9d0d;};'use strict';function Campaign(_0x26a572){this['id']=_0x26a572['id']||0x0;this['name']=_0x26a572[_0x9139('0x0')]||'';this[_0x9139('0x1')]=_0x26a572[_0x9139('0x1')]||'campaign';this[_0x9139('0x2')]=0x0;this['temp']=0x0;this[_0x9139('0x3')]=0x0;this[_0x9139('0x4')]=0x0;this[_0x9139('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x9139('0x6')]=_0x26a572[_0x9139('0x6')];this[_0x9139('0x7')]=_0x26a572[_0x9139('0x7')];this[_0x9139('0x8')]=_0x26a572[_0x9139('0x8')]||null;this[_0x9139('0x9')]=_0x26a572['dialGlobalInterval']?_0x26a572[_0x9139('0x9')]:null;this['dialOriginateCallerIdName']=_0x26a572['dialOriginateCallerIdName'];this[_0x9139('0xa')]=_0x26a572['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x26a572[_0x9139('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x26a572[_0x9139('0xc')];this['dialCongestionRetryFrequency']=_0x26a572['dialCongestionRetryFrequency'];this[_0x9139('0xd')]=_0x26a572['dialBusyMaxRetry'];this[_0x9139('0xe')]=_0x26a572[_0x9139('0xe')];this[_0x9139('0xf')]=_0x26a572[_0x9139('0xf')];this[_0x9139('0x10')]=_0x26a572[_0x9139('0x10')];this[_0x9139('0x11')]=_0x26a572[_0x9139('0x11')];this[_0x9139('0x12')]=_0x26a572[_0x9139('0x12')]||0x3;this[_0x9139('0x13')]=_0x26a572['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9139('0x14')]=_0x26a572[_0x9139('0x14')]||0x3;this[_0x9139('0x15')]=_0x26a572['dialDropRetryFrequency']||0x96;this[_0x9139('0x16')]=_0x26a572['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x26a572[_0x9139('0x17')]||0x96;this['dialMachineMaxRetry']=_0x26a572[_0x9139('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x26a572[_0x9139('0x19')]||0x96;this[_0x9139('0x1a')]=_0x26a572[_0x9139('0x1a')]||0x3;this[_0x9139('0x1b')]=_0x26a572['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x26a572[_0x9139('0x1c')]||_0x9139('0x1d');this[_0x9139('0x1e')]=_0x26a572[_0x9139('0x1e')]||undefined;this[_0x9139('0x1f')]=_0x26a572[_0x9139('0x1f')]||undefined;this[_0x9139('0x20')]=_0x26a572[_0x9139('0x20')]||undefined;this[_0x9139('0x21')]=_0x26a572['TrunkBackup']?_0x26a572[_0x9139('0x21')]:undefined;this[_0x9139('0x22')]=_0x26a572[_0x9139('0x22')]?_0x26a572[_0x9139('0x22')]:undefined;this[_0x9139('0x23')]=_0x26a572['Interval']?_0x26a572[_0x9139('0x23')]:undefined;this[_0x9139('0x24')]=_0x26a572[_0x9139('0x24')]?_0x26a572[_0x9139('0x24')]:undefined;this[_0x9139('0x25')]=_0x26a572[_0x9139('0x24')]?_0x26a572['SquareProject']['name']:undefined;this[_0x9139('0x26')]=_0x26a572['dialAMDActive']||![];this[_0x9139('0x27')]=_0x26a572[_0x9139('0x27')];this[_0x9139('0x28')]=_0x26a572[_0x9139('0x28')];this['dialAMDAfterGreetingSilence']=_0x26a572[_0x9139('0x29')];this[_0x9139('0x2a')]=_0x26a572[_0x9139('0x2a')];this['dialAMDMinWordLength']=_0x26a572['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x26a572[_0x9139('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x26a572[_0x9139('0x2c')];this[_0x9139('0x2d')]=_0x26a572['dialAMDSilenceThreshold'];this[_0x9139('0x2e')]=_0x26a572[_0x9139('0x2e')];}module[_0x9139('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 5c868da..d548c7c 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 _0xb0ca=['lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','transferType','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb0ca,0x1b2));var _0xab0c=function(_0x3bbf08,_0x484ae7){_0x3bbf08=_0x3bbf08-0x0;var _0x1f308d=_0xb0ca[_0x3bbf08];return _0x1f308d;};'use strict';function Channel(){this['starttime']=null;this[_0xab0c('0x0')]='';this['destinationchannel']='';this[_0xab0c('0x1')]=0x0;this[_0xab0c('0x2')]='';this[_0xab0c('0x3')]=undefined;this[_0xab0c('0x4')]=undefined;this[_0xab0c('0x5')]=0x0;this[_0xab0c('0x6')]='';this[_0xab0c('0x7')]=0x0;this['linkedid']=0x0;this[_0xab0c('0x8')]=0x0;this[_0xab0c('0x9')]=![];this[_0xab0c('0xa')]=null;this[_0xab0c('0xb')]=null;this[_0xab0c('0xc')]=![];this[_0xab0c('0xd')]=![];this[_0xab0c('0xe')]='';this[_0xab0c('0xf')]='';this[_0xab0c('0x10')]=0x0;this['billableseconds']=0x0;this[_0xab0c('0x11')]=0x0;this[_0xab0c('0x12')]=null;this[_0xab0c('0x13')]=null;this[_0xab0c('0x14')]=null;this[_0xab0c('0x15')]=![];this[_0xab0c('0x16')]=null;this['queue']=null;this[_0xab0c('0x17')]=[];this['transfercalleridnum']=undefined;this[_0xab0c('0x18')]=undefined;this[_0xab0c('0x19')]=undefined;this[_0xab0c('0x1a')]=0x0;}module[_0xab0c('0x1b')]=Channel; \ No newline at end of file +var _0xc210=['answered','answertime','endtime','unmanaged','lastapplication','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten'];(function(_0x3d8163,_0x5470c4){var _0x49db86=function(_0x2542cb){while(--_0x2542cb){_0x3d8163['push'](_0x3d8163['shift']());}};_0x49db86(++_0x5470c4);}(_0xc210,0x7c));var _0x0c21=function(_0x23ed26,_0x1d2ff4){_0x23ed26=_0x23ed26-0x0;var _0x545502=_0xc210[_0x23ed26];return _0x545502;};'use strict';function Channel(){this[_0x0c21('0x0')]=null;this[_0x0c21('0x1')]='';this['destinationchannel']='';this[_0x0c21('0x2')]=0x0;this[_0x0c21('0x3')]='';this[_0x0c21('0x4')]=undefined;this[_0x0c21('0x5')]=undefined;this[_0x0c21('0x6')]=0x0;this[_0x0c21('0x7')]='';this[_0x0c21('0x8')]=0x0;this[_0x0c21('0x9')]=0x0;this[_0x0c21('0xa')]=0x0;this[_0x0c21('0xb')]=![];this[_0x0c21('0xc')]=null;this[_0x0c21('0xd')]=null;this[_0x0c21('0xe')]=![];this['abandoned']=![];this[_0x0c21('0xf')]='';this['lastdata']='';this['duration']=0x0;this[_0x0c21('0x10')]=0x0;this[_0x0c21('0x11')]=0x0;this[_0x0c21('0x12')]=null;this[_0x0c21('0x13')]=null;this[_0x0c21('0x14')]=null;this[_0x0c21('0x15')]=![];this[_0x0c21('0x16')]=null;this['queue']=null;this[_0x0c21('0x17')]=[];this[_0x0c21('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x0c21('0x19')]=0x0;}module[_0x0c21('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d8f9657..2e0baeb 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 _0x7ce7=['token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x142db6,_0x5a1395){var _0x256363=function(_0x530ac4){while(--_0x530ac4){_0x142db6['push'](_0x142db6['shift']());}};_0x256363(++_0x5a1395);}(_0x7ce7,0x125));var _0x77ce=function(_0x228d51,_0x5ec2ec){_0x228d51=_0x228d51-0x0;var _0x4c6d36=_0x7ce7[_0x228d51];return _0x4c6d36;};'use strict';function DeskAccount(_0xefbde8){this['id']=_0xefbde8['id']||0x0;this[_0x77ce('0x0')]=_0xefbde8[_0x77ce('0x0')]||'';this[_0x77ce('0x1')]=_0xefbde8[_0x77ce('0x1')]||'';this[_0x77ce('0x2')]=_0xefbde8['remoteUri']||'';this[_0x77ce('0x3')]=_0xefbde8['authType']||'';this[_0x77ce('0x4')]=_0xefbde8['password']||'';this[_0x77ce('0x5')]=_0xefbde8[_0x77ce('0x5')]||'';this[_0x77ce('0x6')]=_0xefbde8[_0x77ce('0x6')]||'';this[_0x77ce('0x7')]=_0xefbde8['token']||'';this[_0x77ce('0x8')]=_0xefbde8[_0x77ce('0x8')]||'';this['type']=_0xefbde8[_0x77ce('0x9')]||'';this[_0x77ce('0xa')]=_0xefbde8['serverUrl']||'';this[_0x77ce('0xb')]=_0xefbde8[_0x77ce('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xf6d3=['serverUrl','Configurations','exports','name','username','remoteUri','password','consumerSecret','token','tokenSecret','type'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xf6d3,0xbe));var _0x3f6d=function(_0x500980,_0x1487d9){_0x500980=_0x500980-0x0;var _0x589d80=_0xf6d3[_0x500980];return _0x589d80;};'use strict';function DeskAccount(_0x3e4f07){this['id']=_0x3e4f07['id']||0x0;this['name']=_0x3e4f07[_0x3f6d('0x0')]||'';this[_0x3f6d('0x1')]=_0x3e4f07['username']||'';this['remoteUri']=_0x3e4f07[_0x3f6d('0x2')]||'';this['authType']=_0x3e4f07['authType']||'';this['password']=_0x3e4f07[_0x3f6d('0x3')]||'';this['consumerKey']=_0x3e4f07['consumerKey']||'';this['consumerSecret']=_0x3e4f07[_0x3f6d('0x4')]||'';this['token']=_0x3e4f07[_0x3f6d('0x5')]||'';this[_0x3f6d('0x6')]=_0x3e4f07['tokenSecret']||'';this['type']=_0x3e4f07[_0x3f6d('0x7')]||'';this[_0x3f6d('0x8')]=_0x3e4f07[_0x3f6d('0x8')]||'';this[_0x3f6d('0x9')]=_0x3e4f07['Configurations']||{};}module[_0x3f6d('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 5fb010a..de33c11 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 _0x7cc6=['CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x25ec91,_0x339dc7){var _0x4bd780=function(_0x90eb09){while(--_0x90eb09){_0x25ec91['push'](_0x25ec91['shift']());}};_0x4bd780(++_0x339dc7);}(_0x7cc6,0x198));var _0x67cc=function(_0x4b9674,_0x499b26){_0x4b9674=_0x4b9674-0x0;var _0x1125cc=_0x7cc6[_0x4b9674];return _0x1125cc;};'use strict';function Dynamics365Account(_0x34d3f9){this['id']=_0x34d3f9['id']||0x0;this[_0x67cc('0x0')]=_0x34d3f9[_0x67cc('0x0')]||'';this[_0x67cc('0x1')]=_0x34d3f9[_0x67cc('0x1')]||'';this[_0x67cc('0x2')]=_0x34d3f9['password']||'';this[_0x67cc('0x3')]=_0x34d3f9[_0x67cc('0x3')]||'';this[_0x67cc('0x4')]=_0x34d3f9['tenantId']||'';this[_0x67cc('0x5')]=_0x34d3f9['clientId']||'';this[_0x67cc('0x6')]=_0x34d3f9[_0x67cc('0x6')]||{};this[_0x67cc('0x7')]=_0x34d3f9['serverUrl']||'';this['modernAuthentication']=_0x34d3f9[_0x67cc('0x8')]||![];this[_0x67cc('0x9')]=_0x34d3f9[_0x67cc('0x9')]||{};this['CloudProvider']=_0x34d3f9[_0x67cc('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x9c86=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x5169ca,_0x2356e5){var _0x13f00d=function(_0xd31006){while(--_0xd31006){_0x5169ca['push'](_0x5169ca['shift']());}};_0x13f00d(++_0x2356e5);}(_0x9c86,0x156));var _0x69c8=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c86[_0x334841];return _0x5beb4b;};'use strict';function Dynamics365Account(_0x5bf2b3){this['id']=_0x5bf2b3['id']||0x0;this[_0x69c8('0x0')]=_0x5bf2b3[_0x69c8('0x0')]||'';this[_0x69c8('0x1')]=_0x5bf2b3[_0x69c8('0x1')]||'';this[_0x69c8('0x2')]=_0x5bf2b3[_0x69c8('0x2')]||'';this[_0x69c8('0x3')]=_0x5bf2b3[_0x69c8('0x3')]||'';this[_0x69c8('0x4')]=_0x5bf2b3[_0x69c8('0x4')]||'';this[_0x69c8('0x5')]=_0x5bf2b3[_0x69c8('0x5')]||'';this[_0x69c8('0x6')]=_0x5bf2b3['clientSecret']||{};this['serverUrl']=_0x5bf2b3[_0x69c8('0x7')]||'';this[_0x69c8('0x8')]=_0x5bf2b3[_0x69c8('0x8')]||![];this[_0x69c8('0x9')]=_0x5bf2b3['Configurations']||{};this['CloudProvider']=_0x5bf2b3['CloudProvider']||{};}module[_0x69c8('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 057d8b2..c78feb3 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 _0x89a3=['SIP','Trunk','ListId','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x89a3,0x125));var _0x389a=function(_0xd85d9e,_0x22bef1){_0xd85d9e=_0xd85d9e-0x0;var _0x3f1e51=_0x89a3[_0xd85d9e];return _0x3f1e51;};'use strict';function FaxAccount(_0x4195f3){this['id']=_0x4195f3['id']||0x0;this[_0x389a('0x0')]=_0x4195f3[_0x389a('0x0')]||'';this['description']=_0x4195f3['description'];this[_0x389a('0x1')]=_0x4195f3['ecm'];this['headerinfo']=_0x4195f3[_0x389a('0x2')];this[_0x389a('0x3')]=_0x4195f3[_0x389a('0x3')];this[_0x389a('0x4')]=_0x4195f3['minrate']||0x960;this[_0x389a('0x5')]=_0x4195f3['maxrate']||0x3840;this[_0x389a('0x6')]=_0x4195f3[_0x389a('0x6')]||'v17,v27,v29';this[_0x389a('0x7')]=_0x4195f3[_0x389a('0x7')]||'no';this['faxdetect']=_0x4195f3[_0x389a('0x8')]||'no';this[_0x389a('0x9')]=_0x4195f3[_0x389a('0x9')]||0x1388;this[_0x389a('0xa')]=_0x4195f3['tech']||_0x389a('0xb');this[_0x389a('0xc')]=_0x4195f3['Trunk']?_0x4195f3[_0x389a('0xc')]:undefined;this['ListId']=_0x4195f3[_0x389a('0xd')];this[_0x389a('0xe')]=_0x4195f3[_0x389a('0xe')];}module[_0x389a('0xf')]=FaxAccount; \ No newline at end of file +var _0xf2cf=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x43c62a,_0x125d82){var _0x367fb8=function(_0x163f52){while(--_0x163f52){_0x43c62a['push'](_0x43c62a['shift']());}};_0x367fb8(++_0x125d82);}(_0xf2cf,0x91));var _0xff2c=function(_0x2b2c04,_0x5c1f4e){_0x2b2c04=_0x2b2c04-0x0;var _0xb397a7=_0xf2cf[_0x2b2c04];return _0xb397a7;};'use strict';function FaxAccount(_0x225431){this['id']=_0x225431['id']||0x0;this[_0xff2c('0x0')]=_0x225431[_0xff2c('0x0')]||'';this['description']=_0x225431['description'];this['ecm']=_0x225431[_0xff2c('0x1')];this[_0xff2c('0x2')]=_0x225431[_0xff2c('0x2')];this[_0xff2c('0x3')]=_0x225431[_0xff2c('0x3')];this[_0xff2c('0x4')]=_0x225431[_0xff2c('0x4')]||0x960;this[_0xff2c('0x5')]=_0x225431[_0xff2c('0x5')]||0x3840;this[_0xff2c('0x6')]=_0x225431[_0xff2c('0x6')]||_0xff2c('0x7');this[_0xff2c('0x8')]=_0x225431[_0xff2c('0x8')]||'no';this[_0xff2c('0x9')]=_0x225431['faxdetect']||'no';this[_0xff2c('0xa')]=_0x225431['t38timeout']||0x1388;this[_0xff2c('0xb')]=_0x225431[_0xff2c('0xb')]||_0xff2c('0xc');this[_0xff2c('0xd')]=_0x225431['Trunk']?_0x225431[_0xff2c('0xd')]:undefined;this['ListId']=_0x225431[_0xff2c('0xe')];this['key']=_0x225431[_0xff2c('0xf')];}module[_0xff2c('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 edcfeaf..12c6cf7 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 _0xcca9=['token','remoteUri','serverUrl','Configurations','name'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xcca9,0xbd));var _0x9cca=function(_0x51b42e,_0x8dea09){_0x51b42e=_0x51b42e-0x0;var _0x43ed23=_0xcca9[_0x51b42e];return _0x43ed23;};'use strict';function FreshdeskAccount(_0x6263b2){this['id']=_0x6263b2['id']||0x0;this[_0x9cca('0x0')]=_0x6263b2[_0x9cca('0x0')]||'';this['username']=_0x6263b2['username']||'';this['apiKey']=_0x6263b2[_0x9cca('0x1')]||'';this[_0x9cca('0x2')]=_0x6263b2[_0x9cca('0x2')]||'';this[_0x9cca('0x3')]=_0x6263b2[_0x9cca('0x3')]||'';this['Configurations']=_0x6263b2[_0x9cca('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x4616=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1abc4c,_0x32f192){var _0x2cac08=function(_0x4b4425){while(--_0x4b4425){_0x1abc4c['push'](_0x1abc4c['shift']());}};_0x2cac08(++_0x32f192);}(_0x4616,0x19c));var _0x6461=function(_0x48b027,_0x5f08b3){_0x48b027=_0x48b027-0x0;var _0x28e87b=_0x4616[_0x48b027];return _0x28e87b;};'use strict';function FreshdeskAccount(_0x23faa3){this['id']=_0x23faa3['id']||0x0;this[_0x6461('0x0')]=_0x23faa3[_0x6461('0x0')]||'';this[_0x6461('0x1')]=_0x23faa3[_0x6461('0x1')]||'';this[_0x6461('0x2')]=_0x23faa3['token']||'';this[_0x6461('0x3')]=_0x23faa3[_0x6461('0x3')]||'';this[_0x6461('0x4')]=_0x23faa3[_0x6461('0x4')]||'';this[_0x6461('0x5')]=_0x23faa3['Configurations']||{};}module[_0x6461('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index a01ef49..432f0f2 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 _0x0309=['name','username','apiKey','token','remoteUri','serverUrl','exports'];(function(_0x362aa6,_0x29e0af){var _0x1d5616=function(_0x51f99e){while(--_0x51f99e){_0x362aa6['push'](_0x362aa6['shift']());}};_0x1d5616(++_0x29e0af);}(_0x0309,0x165));var _0x9030=function(_0x593cf3,_0x2365f0){_0x593cf3=_0x593cf3-0x0;var _0x17bd64=_0x0309[_0x593cf3];return _0x17bd64;};'use strict';function FreshsalesAccount(_0x15c656){this['id']=_0x15c656['id']||0x0;this['name']=_0x15c656[_0x9030('0x0')]||'';this['username']=_0x15c656[_0x9030('0x1')]||'';this[_0x9030('0x2')]=_0x15c656[_0x9030('0x3')]||'';this[_0x9030('0x4')]=_0x15c656[_0x9030('0x4')]||'';this[_0x9030('0x5')]=_0x15c656[_0x9030('0x5')]||'';this['Configurations']=_0x15c656['Configurations']||{};}module[_0x9030('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xdedd=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x1add2d,_0x4a46d2){var _0x5c66a8=function(_0xc652c6){while(--_0xc652c6){_0x1add2d['push'](_0x1add2d['shift']());}};_0x5c66a8(++_0x4a46d2);}(_0xdedd,0x197));var _0xdded=function(_0x2a999c,_0x3f158f){_0x2a999c=_0x2a999c-0x0;var _0x27c6ec=_0xdedd[_0x2a999c];return _0x27c6ec;};'use strict';function FreshsalesAccount(_0x4c658a){this['id']=_0x4c658a['id']||0x0;this[_0xdded('0x0')]=_0x4c658a[_0xdded('0x0')]||'';this[_0xdded('0x1')]=_0x4c658a[_0xdded('0x1')]||'';this['apiKey']=_0x4c658a[_0xdded('0x2')]||'';this[_0xdded('0x3')]=_0x4c658a[_0xdded('0x3')]||'';this[_0xdded('0x4')]=_0x4c658a[_0xdded('0x4')]||'';this[_0xdded('0x5')]=_0x4c658a[_0xdded('0x5')]||{};}module[_0xdded('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 7423a73..39576a3 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 _0x01d5=['calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','routealias','variables','type','inbound'];(function(_0x22c597,_0x1b85f5){var _0x42ded4=function(_0x31cecc){while(--_0x31cecc){_0x22c597['push'](_0x22c597['shift']());}};_0x42ded4(++_0x1b85f5);}(_0x01d5,0x106));var _0x501d=function(_0x404793,_0x2c99fa){_0x404793=_0x404793-0x0;var _0x66f7ce=_0x01d5[_0x404793];return _0x66f7ce;};'use strict';function QueueReport(){this[_0x501d('0x0')]=_0x501d('0x1');this['uniqueid']='';this[_0x501d('0x2')]='';this[_0x501d('0x3')]='';this[_0x501d('0x4')]='';this[_0x501d('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x501d('0x6')]=0x1;this[_0x501d('0x7')]=0x1;this[_0x501d('0x8')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x501d('0x9')]=null;this[_0x501d('0xa')]=![];this[_0x501d('0xb')]=null;this['originalposition']=0x1;this[_0x501d('0xc')]='';this[_0x501d('0xd')]='';this[_0x501d('0xe')]='';this[_0x501d('0xf')]='';this[_0x501d('0x10')]='';this[_0x501d('0x11')]='';this['priority']='';this[_0x501d('0x12')]=0x0;this[_0x501d('0x13')]=![];this[_0x501d('0x14')]='';this[_0x501d('0x15')]='voice';this[_0x501d('0x16')]=null;this['mohtime']=0x0;this[_0x501d('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xafd4=['queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','accountcode','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables','exports','calleridname','queuecallerjoinAt'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xafd4,0x1b6));var _0x4afd=function(_0x281097,_0x109dac){_0x281097=_0x281097-0x0;var _0x4d212f=_0xafd4[_0x281097];return _0x4d212f;};'use strict';function QueueReport(){this['type']='inbound';this['uniqueid']='';this['calleridnum']='';this[_0x4afd('0x0')]='';this['queue']='';this[_0x4afd('0x1')]=null;this[_0x4afd('0x2')]=null;this['position']=0x1;this[_0x4afd('0x3')]=0x1;this[_0x4afd('0x4')]=![];this[_0x4afd('0x5')]=null;this[_0x4afd('0x6')]=![];this[_0x4afd('0x7')]=null;this[_0x4afd('0x8')]=![];this[_0x4afd('0x9')]=null;this['originalposition']=0x1;this['channel']='';this[_0x4afd('0xa')]='';this['connectedlinename']='';this[_0x4afd('0xb')]='';this['context']='';this['exten']='';this[_0x4afd('0xc')]='';this[_0x4afd('0xd')]=0x0;this[_0x4afd('0xe')]=![];this[_0x4afd('0xf')]='';this[_0x4afd('0x10')]='voice';this['routealias']=null;this[_0x4afd('0x11')]=0x0;this[_0x4afd('0x12')]={};}module[_0x4afd('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 0c26be3..788d8a3 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 _0xe255=['password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x39e4fa,_0x1ee2ba){var _0x62fd21=function(_0x1ea1ec){while(--_0x1ea1ec){_0x39e4fa['push'](_0x39e4fa['shift']());}};_0x62fd21(++_0x1ee2ba);}(_0xe255,0xcf));var _0x5e25=function(_0x44d782,_0x581b64){_0x44d782=_0x44d782-0x0;var _0x54ef48=_0xe255[_0x44d782];return _0x54ef48;};'use strict';function SalesforceAccount(_0x31f01c){this['id']=_0x31f01c['id']||0x0;this[_0x5e25('0x0')]=_0x31f01c['name']||'';this[_0x5e25('0x1')]=_0x31f01c[_0x5e25('0x1')]||'';this[_0x5e25('0x2')]=_0x31f01c['remoteUri']||'';this['password']=_0x31f01c[_0x5e25('0x3')]||'';this[_0x5e25('0x4')]=_0x31f01c[_0x5e25('0x4')]||'';this[_0x5e25('0x5')]=_0x31f01c[_0x5e25('0x5')]||'';this[_0x5e25('0x6')]=_0x31f01c[_0x5e25('0x6')]||'';this['type']=_0x31f01c[_0x5e25('0x7')]||'integrationTab';this[_0x5e25('0x8')]=_0x31f01c[_0x5e25('0x8')]||'';this[_0x5e25('0x9')]=_0x31f01c['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x7d9b=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x598f2d,_0x1210ca){var _0x750a29=function(_0x474369){while(--_0x474369){_0x598f2d['push'](_0x598f2d['shift']());}};_0x750a29(++_0x1210ca);}(_0x7d9b,0x126));var _0xb7d9=function(_0x3d91fd,_0x3a768b){_0x3d91fd=_0x3d91fd-0x0;var _0x137a3a=_0x7d9b[_0x3d91fd];return _0x137a3a;};'use strict';function SalesforceAccount(_0x3e6e7c){this['id']=_0x3e6e7c['id']||0x0;this['name']=_0x3e6e7c[_0xb7d9('0x0')]||'';this[_0xb7d9('0x1')]=_0x3e6e7c[_0xb7d9('0x1')]||'';this[_0xb7d9('0x2')]=_0x3e6e7c[_0xb7d9('0x2')]||'';this[_0xb7d9('0x3')]=_0x3e6e7c[_0xb7d9('0x3')]||'';this['clientId']=_0x3e6e7c[_0xb7d9('0x4')]||'';this[_0xb7d9('0x5')]=_0x3e6e7c[_0xb7d9('0x5')]||'';this['securityToken']=_0x3e6e7c[_0xb7d9('0x6')]||'';this['type']=_0x3e6e7c[_0xb7d9('0x7')]||_0xb7d9('0x8');this[_0xb7d9('0x9')]=_0x3e6e7c[_0xb7d9('0x9')]||'';this[_0xb7d9('0xa')]=_0x3e6e7c[_0xb7d9('0xa')]||{};}module[_0xb7d9('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 9eb2dcb..5988351 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 _0x665e=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x47b84b,_0x338a33){var _0x5a90b2=function(_0x6af709){while(--_0x6af709){_0x47b84b['push'](_0x47b84b['shift']());}};_0x5a90b2(++_0x338a33);}(_0x665e,0x18b));var _0xe665=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x665e[_0x31295c];return _0x2c150e;};'use strict';function ServicenowAccount(_0x90b705){this['id']=_0x90b705['id']||0x0;this[_0xe665('0x0')]=_0x90b705[_0xe665('0x0')]||'';this['username']=_0x90b705[_0xe665('0x1')]||'';this[_0xe665('0x2')]=_0x90b705['password']||'';this[_0xe665('0x3')]=_0x90b705['remoteUri']||'';this[_0xe665('0x4')]=_0x90b705[_0xe665('0x4')]||'';this[_0xe665('0x5')]=_0x90b705[_0xe665('0x5')]||{};}module[_0xe665('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xfd1f=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5d0430,_0x15cc32){var _0x4d964c=function(_0x392cbf){while(--_0x392cbf){_0x5d0430['push'](_0x5d0430['shift']());}};_0x4d964c(++_0x15cc32);}(_0xfd1f,0x105));var _0xffd1=function(_0x187ed6,_0x172ba2){_0x187ed6=_0x187ed6-0x0;var _0xdd5a1b=_0xfd1f[_0x187ed6];return _0xdd5a1b;};'use strict';function ServicenowAccount(_0xd2ee20){this['id']=_0xd2ee20['id']||0x0;this[_0xffd1('0x0')]=_0xd2ee20[_0xffd1('0x0')]||'';this[_0xffd1('0x1')]=_0xd2ee20['username']||'';this[_0xffd1('0x2')]=_0xd2ee20[_0xffd1('0x2')]||'';this[_0xffd1('0x3')]=_0xd2ee20[_0xffd1('0x3')]||'';this[_0xffd1('0x4')]=_0xd2ee20['serverUrl']||'';this[_0xffd1('0x5')]=_0xd2ee20[_0xffd1('0x5')]||{};}module[_0xffd1('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 3dd1b00..37dcb0b 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 _0x7fa6=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x2f615f,_0x1d7383){var _0x3fd443=function(_0x4e45ef){while(--_0x4e45ef){_0x2f615f['push'](_0x2f615f['shift']());}};_0x3fd443(++_0x1d7383);}(_0x7fa6,0x10c));var _0x67fa=function(_0x2fcb60,_0x51be6f){_0x2fcb60=_0x2fcb60-0x0;var _0x25bfd1=_0x7fa6[_0x2fcb60];return _0x25bfd1;};'use strict';function SugarcrmAccount(_0x477adc){this['id']=_0x477adc['id']||0x0;this[_0x67fa('0x0')]=_0x477adc[_0x67fa('0x0')]||'';this[_0x67fa('0x1')]=_0x477adc['username']||'';this['password']=_0x477adc[_0x67fa('0x2')]||'';this[_0x67fa('0x3')]=_0x477adc['remoteUri']||'';this[_0x67fa('0x4')]=_0x477adc['serverUrl']||'';this[_0x67fa('0x5')]=_0x477adc['Configurations']||{};}module[_0x67fa('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xc966=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x41eed6,_0x5cdfff){var _0x212d98=function(_0xd4100f){while(--_0xd4100f){_0x41eed6['push'](_0x41eed6['shift']());}};_0x212d98(++_0x5cdfff);}(_0xc966,0x187));var _0x6c96=function(_0x5767cb,_0x2ba0a3){_0x5767cb=_0x5767cb-0x0;var _0x2d5bd9=_0xc966[_0x5767cb];return _0x2d5bd9;};'use strict';function SugarcrmAccount(_0x199d0a){this['id']=_0x199d0a['id']||0x0;this[_0x6c96('0x0')]=_0x199d0a['name']||'';this['username']=_0x199d0a[_0x6c96('0x1')]||'';this['password']=_0x199d0a[_0x6c96('0x2')]||'';this[_0x6c96('0x3')]=_0x199d0a[_0x6c96('0x3')]||'';this[_0x6c96('0x4')]=_0x199d0a['serverUrl']||'';this[_0x6c96('0x5')]=_0x199d0a[_0x6c96('0x5')]||{};}module[_0x6c96('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 c84eba0..f866bd7 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 _0x2edc=['exports','name','accountcode','unknown','status','address'];(function(_0xee194a,_0x3b365e){var _0x7f15c4=function(_0x320410){while(--_0x320410){_0xee194a['push'](_0xee194a['shift']());}};_0x7f15c4(++_0x3b365e);}(_0x2edc,0x1d5));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x4d9549){this['id']=_0x4d9549['id']||0x0;this['name']=_0x4d9549[_0xc2ed('0x0')]||'';this[_0xc2ed('0x1')]=_0x4d9549[_0xc2ed('0x1')]||'';this['state']=_0xc2ed('0x2');this['stateTime']=0x0;this[_0xc2ed('0x3')]=_0xc2ed('0x2');this[_0xc2ed('0x4')]='';}module[_0xc2ed('0x5')]=Telephone; \ No newline at end of file +var _0x32f4=['name','accountcode','state','unknown','status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x32f4,0x168));var _0x432f=function(_0x24b685,_0x30a1bf){_0x24b685=_0x24b685-0x0;var _0x327576=_0x32f4[_0x24b685];return _0x327576;};'use strict';function Telephone(_0xdd3206){this['id']=_0xdd3206['id']||0x0;this[_0x432f('0x0')]=_0xdd3206[_0x432f('0x0')]||'';this[_0x432f('0x1')]=_0xdd3206['accountcode']||'';this[_0x432f('0x2')]=_0x432f('0x3');this['stateTime']=0x0;this[_0x432f('0x4')]=_0x432f('0x3');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 646aeb9..11ee2d0 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x5ccef4,_0x500a1b){var _0x463f80=function(_0x2d6524){while(--_0x2d6524){_0x5ccef4['push'](_0x5ccef4['shift']());}};_0x463f80(++_0x500a1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x295291,_0x336c3e){var _0x3b3b01=function(_0x35276a){while(--_0x35276a){_0x295291['push'](_0x295291['shift']());}};_0x3b3b01(++_0x336c3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 bf75232..4dc29c6 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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x2a84d2,_0x431bdd){var _0x4ecdc9=function(_0x52458c){while(--_0x52458c){_0x2a84d2['push'](_0x2a84d2['shift']());}};_0x4ecdc9(++_0x431bdd);}(_0xb10b,0x12a));var _0xbb10=function(_0x54613d,_0x4b8872){_0x54613d=_0x54613d-0x0;var _0x11c35b=_0xb10b[_0x54613d];return _0x11c35b;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x135e98,_0x1443e6){var _0x5aa14b=function(_0x2404ee){while(--_0x2404ee){_0x135e98['push'](_0x135e98['shift']());}};_0x5aa14b(++_0x1443e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a94d0,_0x374e5d){_0x4a94d0=_0x4a94d0-0x0;var _0x50128a=_0xb10b[_0x4a94d0];return _0x50128a;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('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 6d1f7fb..e1bc15b 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 _0xa373=['split','host','port','domain','domainport','registrationtime','address','defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xa373,0x109));var _0x3a37=function(_0x421c02,_0x5bf4ff){_0x421c02=_0x421c02-0x0;var _0x51b568=_0xa373[_0x421c02];return _0x51b568;};'use strict';function Trunk(_0x4c6630){this['id']=_0x4c6630['id']||0x0;this[_0x3a37('0x0')]=_0x4c6630['active']||![];this['name']=_0x4c6630[_0x3a37('0x1')]||'';this['state']=_0x3a37('0x2');this[_0x3a37('0x3')]=0x0;this[_0x3a37('0x4')]='unknown';this['registry']=_0x4c6630[_0x3a37('0x5')]&&_0x4c6630[_0x3a37('0x5')][_0x3a37('0x6')](':')?_0x4c6630[_0x3a37('0x5')][_0x3a37('0x7')](':')[0x0]:'';this[_0x3a37('0x8')]='';this[_0x3a37('0x9')]='';this[_0x3a37('0xa')]='';this[_0x3a37('0xb')]='';this['refresh']='';this['stateRegistry']=_0x3a37('0x2');this[_0x3a37('0xc')]='';this[_0x3a37('0xd')]='';this[_0x3a37('0xe')]=_0x4c6630[_0x3a37('0xe')]||'';}module[_0x3a37('0xf')]=Trunk; \ No newline at end of file +var _0x9422=['registry','host','port','domainport','stateRegistry','registrationtime','address','defaultuser','active','name','state','stateTime','unknown'];(function(_0xef6e15,_0x3e5d6a){var _0x5e6fe4=function(_0xa6c5e2){while(--_0xa6c5e2){_0xef6e15['push'](_0xef6e15['shift']());}};_0x5e6fe4(++_0x3e5d6a);}(_0x9422,0xb1));var _0x2942=function(_0x10d299,_0x201838){_0x10d299=_0x10d299-0x0;var _0x86919e=_0x9422[_0x10d299];return _0x86919e;};'use strict';function Trunk(_0x5bfa60){this['id']=_0x5bfa60['id']||0x0;this[_0x2942('0x0')]=_0x5bfa60[_0x2942('0x0')]||![];this[_0x2942('0x1')]=_0x5bfa60[_0x2942('0x1')]||'';this[_0x2942('0x2')]='unknown';this[_0x2942('0x3')]=0x0;this['status']=_0x2942('0x4');this[_0x2942('0x5')]=_0x5bfa60['registry']&&_0x5bfa60[_0x2942('0x5')]['indexOf'](':')?_0x5bfa60[_0x2942('0x5')]['split'](':')[0x0]:'';this[_0x2942('0x6')]='';this[_0x2942('0x7')]='';this['domain']='';this[_0x2942('0x8')]='';this['refresh']='';this[_0x2942('0x9')]=_0x2942('0x4');this[_0x2942('0xa')]='';this[_0x2942('0xb')]='';this[_0x2942('0xc')]=_0x5bfa60[_0x2942('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ca78a00..e1b6fab 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 _0xc5b3=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x53857e,_0x2778a1){var _0x4c6140=function(_0x341a62){while(--_0x341a62){_0x53857e['push'](_0x53857e['shift']());}};_0x4c6140(++_0x2778a1);}(_0xc5b3,0x1b6));var _0x3c5b=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0xc5b3[_0x3b8f2e];return _0x1433d5;};'use strict';function voiceExtension(_0x4a0dba){this['id']=_0x4a0dba['id']||0x0;this[_0x3c5b('0x0')]=_0x4a0dba['exten']||'';this['recordingFormat']=_0x4a0dba[_0x3c5b('0x1')]||'none';this[_0x3c5b('0x2')]=_0x4a0dba[_0x3c5b('0x2')]||![];}module[_0x3c5b('0x3')]=voiceExtension; \ No newline at end of file +var _0x7174=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x20de0f,_0x400f8d){var _0x521dcb=function(_0x5e6c16){while(--_0x5e6c16){_0x20de0f['push'](_0x20de0f['shift']());}};_0x521dcb(++_0x400f8d);}(_0x7174,0x127));var _0x4717=function(_0x59ddbc,_0xf8b1dc){_0x59ddbc=_0x59ddbc-0x0;var _0x46b03a=_0x7174[_0x59ddbc];return _0x46b03a;};'use strict';function voiceExtension(_0x20d6f3){this['id']=_0x20d6f3['id']||0x0;this[_0x4717('0x0')]=_0x20d6f3[_0x4717('0x0')]||'';this['recordingFormat']=_0x20d6f3[_0x4717('0x1')]||_0x4717('0x2');this[_0x4717('0x3')]=_0x20d6f3[_0x4717('0x3')]||![];}module[_0x4717('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 2de884d..08771ad 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 _0x31c2=['dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','busy','inUse','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry'];(function(_0x368fac,_0x2cc5ec){var _0x443c56=function(_0x28543b){while(--_0x28543b){_0x368fac['push'](_0x368fac['shift']());}};_0x443c56(++_0x2cc5ec);}(_0x31c2,0x1e1));var _0x231c=function(_0x9cabd9,_0x3be643){_0x9cabd9=_0x9cabd9-0x0;var _0x3233ed=_0x31c2[_0x9cabd9];return _0x3233ed;};'use strict';var monitorFormat={'wav':_0x231c('0x0'),'wav49':_0x231c('0x1'),'gsm':_0x231c('0x2')};var strategy={'fewestcalls':_0x231c('0x3'),'leastrecent':_0x231c('0x4'),'linear':_0x231c('0x5'),'random':_0x231c('0x6'),'ringall':_0x231c('0x7'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x231c('0x8'),'wrandom':_0x231c('0x9')};function VoiceQueue(_0x1f3f7d){this['id']=_0x1f3f7d['id']||0x0;this[_0x231c('0xa')]=_0x1f3f7d['name']||'';this[_0x231c('0xb')]=_0x1f3f7d['monitor_format']||'';this[_0x231c('0xc')]=_0x1f3f7d[_0x231c('0xc')]||_0x231c('0xd');this['waiting']=0x0;this[_0x231c('0xe')]=0x0;this[_0x231c('0xf')]=0x0;this[_0x231c('0x10')]=0x0;this[_0x231c('0x11')]=0x0;this[_0x231c('0x12')]=0x0;this[_0x231c('0x13')]=0x0;this[_0x231c('0x14')]=0x0;this['available']=0x0;this[_0x231c('0x15')]=0x0;this[_0x231c('0x16')]=0x0;this['invalid']=0x0;this[_0x231c('0x17')]=0x0;this[_0x231c('0x18')]=0x0;this[_0x231c('0x19')]=0x0;this[_0x231c('0x1a')]=0x0;this[_0x231c('0x1b')]=0x0;this[_0x231c('0x1c')]=0x0;this[_0x231c('0x1d')]=0x0;this[_0x231c('0x1e')]=0x0;this[_0x231c('0x1f')]=0x0;this[_0x231c('0x20')]=_0x1f3f7d[_0x231c('0x20')]||![];this[_0x231c('0x21')]=_0x1f3f7d[_0x231c('0x21')]||0xa;this[_0x231c('0x22')]=_0x1f3f7d[_0x231c('0x22')]||'no';this[_0x231c('0x23')]=!![];this[_0x231c('0x24')]='';this[_0x231c('0x25')]='';this[_0x231c('0x26')]=0x0;this[_0x231c('0x27')]=0x0;this['dialTimezone']=_0x1f3f7d[_0x231c('0x28')]||null;this[_0x231c('0x29')]=_0x1f3f7d[_0x231c('0x29')]?_0x1f3f7d[_0x231c('0x29')]:null;this[_0x231c('0x2a')]=_0x1f3f7d[_0x231c('0x2a')];this[_0x231c('0x2b')]=_0x1f3f7d[_0x231c('0x2b')]||_0x231c('0x2c');this[_0x231c('0x2d')]=_0x1f3f7d['dialLimitChannel']||0x0;this[_0x231c('0x2e')]=_0x1f3f7d['dialLimitQueue']||0x0;this[_0x231c('0x2f')]=_0x1f3f7d['dialPowerLevel']||0x1;this[_0x231c('0x30')]=_0x1f3f7d[_0x231c('0x30')]||_0x231c('0x31');this[_0x231c('0x32')]=_0x1f3f7d[_0x231c('0x32')]||0.03;this[_0x231c('0x33')]=_0x1f3f7d[_0x231c('0x33')]||0x258;this[_0x231c('0x34')]=_0x1f3f7d['dialOriginateCallerIdName']||_0x231c('0x35');this[_0x231c('0x36')]=_0x1f3f7d['dialOriginateCallerIdNumber']||_0x231c('0x35');this[_0x231c('0x37')]=_0x1f3f7d['dialOriginateTimeout']||0x1e;this[_0x231c('0x38')]=_0x1f3f7d['dialQueueOptions']||_0x231c('0x39');this[_0x231c('0x3a')]=_0x1f3f7d[_0x231c('0x3a')]||0x3;this[_0x231c('0x3b')]=_0x1f3f7d[_0x231c('0x3b')]||undefined;this[_0x231c('0x3c')]=_0x1f3f7d[_0x231c('0x3c')]||0x3;this['dialCongestionRetryFrequency']=_0x1f3f7d[_0x231c('0x3d')]||0x96;this[_0x231c('0x3e')]=_0x1f3f7d['dialBusyMaxRetry']||0x3;this[_0x231c('0x3f')]=_0x1f3f7d[_0x231c('0x3f')]||0x96;this[_0x231c('0x40')]=_0x1f3f7d[_0x231c('0x40')]||0x3;this[_0x231c('0x41')]=_0x1f3f7d[_0x231c('0x41')]||0x96;this[_0x231c('0x42')]=_0x1f3f7d['dialNoSuchNumberMaxRetry']||0x3;this[_0x231c('0x43')]=_0x1f3f7d[_0x231c('0x43')]||0x96;this['dialDropMaxRetry']=_0x1f3f7d['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x1f3f7d[_0x231c('0x44')]||0x96;this['dialAbandonedMaxRetry']=_0x1f3f7d[_0x231c('0x45')]||0x3;this['dialAbandonedRetryFrequency']=_0x1f3f7d[_0x231c('0x46')]||0x96;this[_0x231c('0x47')]=_0x1f3f7d[_0x231c('0x47')]||0x3;this[_0x231c('0x48')]=_0x1f3f7d['dialMachineRetryFrequency']||0x96;this[_0x231c('0x49')]=_0x1f3f7d[_0x231c('0x49')]||0x3;this[_0x231c('0x4a')]=_0x1f3f7d[_0x231c('0x4a')]||0x96;this[_0x231c('0x4b')]=_0x1f3f7d[_0x231c('0x4b')]||0x3;this[_0x231c('0x4c')]=_0x1f3f7d[_0x231c('0x4c')]||0x4;this['Trunk']=_0x1f3f7d['Trunk']?_0x1f3f7d[_0x231c('0x4d')]:undefined;this[_0x231c('0x4e')]=_0x1f3f7d[_0x231c('0x4e')]?_0x1f3f7d[_0x231c('0x4e')]:undefined;this[_0x231c('0x4f')]=_0x1f3f7d[_0x231c('0x4f')]||undefined;this['Interval']=_0x1f3f7d[_0x231c('0x50')]?_0x1f3f7d[_0x231c('0x50')]:undefined;this['dialOrderByScheduledAt']=_0x1f3f7d['dialOrderByScheduledAt']||_0x231c('0x51');this['dialRandomLastDigitCallerIdNumber']=_0x1f3f7d[_0x231c('0x52')]||undefined;this['dialCutDigit']=_0x1f3f7d[_0x231c('0x53')]||undefined;this[_0x231c('0x54')]=strategy[_0x1f3f7d['strategy']];this[_0x231c('0x55')]=!![];this[_0x231c('0x56')]=_0x1f3f7d[_0x231c('0x56')]||![];this['dialAMDInitialSilence']=_0x1f3f7d[_0x231c('0x57')];this[_0x231c('0x58')]=_0x1f3f7d[_0x231c('0x58')];this[_0x231c('0x59')]=_0x1f3f7d[_0x231c('0x59')];this[_0x231c('0x5a')]=_0x1f3f7d[_0x231c('0x5a')];this[_0x231c('0x5b')]=_0x1f3f7d[_0x231c('0x5b')];this[_0x231c('0x5c')]=_0x1f3f7d[_0x231c('0x5c')];this[_0x231c('0x5d')]=_0x1f3f7d[_0x231c('0x5d')];this['dialAMDSilenceThreshold']=_0x1f3f7d[_0x231c('0x5e')];this[_0x231c('0x5f')]=_0x1f3f7d[_0x231c('0x5f')];this[_0x231c('0x60')]=0x0;this[_0x231c('0x61')]=0x0;this['timeout']=_0x1f3f7d[_0x231c('0x62')];this[_0x231c('0x63')]=0x0;this[_0x231c('0x64')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x231c('0x65')]=0x0;this[_0x231c('0x66')]=0x0;this[_0x231c('0x67')]=0x0;this[_0x231c('0x68')]=0x0;this[_0x231c('0x69')]=0x0;this[_0x231c('0x6a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x231c('0x6b')]=0x0;this[_0x231c('0x6c')]=0x0;this[_0x231c('0x6d')]=0x0;this[_0x231c('0x6e')]=0x0;this['startProgressive']=undefined;this[_0x231c('0x6f')]=undefined;this['handlePredictive']=undefined;this[_0x231c('0x70')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x231c('0x71')]=0x0;this[_0x231c('0x72')]=0x0;this[_0x231c('0x73')]=0x0;this[_0x231c('0x74')]=0x0;this[_0x231c('0x75')]=0x0;this[_0x231c('0x76')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x231c('0x77')]=_0x1f3f7d[_0x231c('0x78')]||0x14;this[_0x231c('0x79')]=_0x1f3f7d['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x231c('0x7a')]=0x0;this[_0x231c('0x7b')]=0x0;this[_0x231c('0x7c')]=0x1;this[_0x231c('0x7d')]=0x0;this['erlangCallToSecond']=0x0;this[_0x231c('0x7e')]=0x0;this['erlangBusyFactor']=0x0;this[_0x231c('0x7f')]=_0x1f3f7d[_0x231c('0x7f')]||0x1e;this[_0x231c('0x80')]=_0x1f3f7d[_0x231c('0x80')]||![];this[_0x231c('0x81')]=!!_0x1f3f7d[_0x231c('0x81')]||![];this[_0x231c('0x82')]=!!_0x1f3f7d[_0x231c('0x82')]||![];this[_0x231c('0x83')]=_0x1f3f7d[_0x231c('0x83')]||undefined;this[_0x231c('0x84')]=_0x1f3f7d[_0x231c('0x84')]||![];this[_0x231c('0x85')]=_0x1f3f7d[_0x231c('0x85')]||![];this['monitor_format']=monitorFormat[_0x1f3f7d[_0x231c('0xb')]]?monitorFormat[_0x1f3f7d[_0x231c('0xb')]]:undefined;this[_0x231c('0x86')]=_0x1f3f7d[_0x231c('0x86')]||![];this[_0x231c('0x87')]=_0x1f3f7d['mandatoryDispositionPause']?_0x1f3f7d['mandatoryDispositionPause']:undefined;this[_0x231c('0x88')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0xb194=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','wrandom','name','monitor_format','type','waiting','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','invalid','notInUse','onHold','ringing','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','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','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x4ade60,_0x1c6ff7){var _0xefb8e5=function(_0x11aaa9){while(--_0x11aaa9){_0x4ade60['push'](_0x4ade60['shift']());}};_0xefb8e5(++_0x1c6ff7);}(_0xb194,0x1b2));var _0x4b19=function(_0x36afd7,_0x1181dc){_0x36afd7=_0x36afd7-0x0;var _0x2e0da0=_0xb194[_0x36afd7];return _0x2e0da0;};'use strict';var monitorFormat={'wav':_0x4b19('0x0'),'wav49':'wav49','gsm':_0x4b19('0x1')};var strategy={'fewestcalls':_0x4b19('0x2'),'leastrecent':_0x4b19('0x3'),'linear':_0x4b19('0x4'),'random':_0x4b19('0x5'),'ringall':'ringall','rr':_0x4b19('0x6'),'rrmemory':_0x4b19('0x7'),'rrordered':'rrordered','wrandom':_0x4b19('0x8')};function VoiceQueue(_0x570374){this['id']=_0x570374['id']||0x0;this[_0x4b19('0x9')]=_0x570374['name']||'';this[_0x4b19('0xa')]=_0x570374[_0x4b19('0xa')]||'';this[_0x4b19('0xb')]=_0x570374['type']||'inbound';this[_0x4b19('0xc')]=0x0;this['total']=0x0;this[_0x4b19('0xd')]=0x0;this[_0x4b19('0xe')]=0x0;this[_0x4b19('0xf')]=0x0;this[_0x4b19('0x10')]=0x0;this[_0x4b19('0x11')]=0x0;this[_0x4b19('0x12')]=0x0;this[_0x4b19('0x13')]=0x0;this[_0x4b19('0x14')]=0x0;this['inUse']=0x0;this[_0x4b19('0x15')]=0x0;this['loggedIn']=0x0;this[_0x4b19('0x16')]=0x0;this[_0x4b19('0x17')]=0x0;this['paused']=0x0;this[_0x4b19('0x18')]=0x0;this['ringInUse']=0x0;this[_0x4b19('0x19')]=0x0;this[_0x4b19('0x1a')]=0x0;this[_0x4b19('0x1b')]=0x0;this[_0x4b19('0x1c')]=_0x570374[_0x4b19('0x1c')]||![];this['acwTimeout']=_0x570374[_0x4b19('0x1d')]||0xa;this[_0x4b19('0x1e')]=_0x570374[_0x4b19('0x1e')]||'no';this[_0x4b19('0x1f')]=!![];this[_0x4b19('0x20')]='';this[_0x4b19('0x21')]='';this['originated']=0x0;this[_0x4b19('0x22')]=0x0;this[_0x4b19('0x23')]=_0x570374[_0x4b19('0x23')]||null;this[_0x4b19('0x24')]=_0x570374[_0x4b19('0x24')]?_0x570374[_0x4b19('0x24')]:null;this[_0x4b19('0x25')]=_0x570374[_0x4b19('0x25')];this['dialMethod']=_0x570374[_0x4b19('0x26')]||'progressive';this[_0x4b19('0x27')]=_0x570374[_0x4b19('0x27')]||0x0;this[_0x4b19('0x28')]=_0x570374[_0x4b19('0x28')]||0x0;this[_0x4b19('0x29')]=_0x570374[_0x4b19('0x29')]||0x1;this['dialPredictiveOptimization']=_0x570374[_0x4b19('0x2a')]||'dropRate';this[_0x4b19('0x2b')]=_0x570374[_0x4b19('0x2b')]||0.03;this[_0x4b19('0x2c')]=_0x570374['dialPredictiveInterval']||0x258;this[_0x4b19('0x2d')]=_0x570374['dialOriginateCallerIdName']||_0x4b19('0x2e');this[_0x4b19('0x2f')]=_0x570374['dialOriginateCallerIdNumber']||_0x4b19('0x2e');this[_0x4b19('0x30')]=_0x570374[_0x4b19('0x30')]||0x1e;this[_0x4b19('0x31')]=_0x570374['dialQueueOptions']||_0x4b19('0x32');this['dialQueueTimeout']=_0x570374['dialQueueTimeout']||0x3;this[_0x4b19('0x33')]=_0x570374['dialQueueProject']||undefined;this[_0x4b19('0x34')]=_0x570374[_0x4b19('0x34')]||0x3;this[_0x4b19('0x35')]=_0x570374[_0x4b19('0x35')]||0x96;this['dialBusyMaxRetry']=_0x570374[_0x4b19('0x36')]||0x3;this[_0x4b19('0x37')]=_0x570374['dialBusyRetryFrequency']||0x96;this[_0x4b19('0x38')]=_0x570374[_0x4b19('0x38')]||0x3;this[_0x4b19('0x39')]=_0x570374['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x570374[_0x4b19('0x3a')]||0x3;this[_0x4b19('0x3b')]=_0x570374[_0x4b19('0x3b')]||0x96;this[_0x4b19('0x3c')]=_0x570374[_0x4b19('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x570374[_0x4b19('0x3d')]||0x96;this[_0x4b19('0x3e')]=_0x570374[_0x4b19('0x3e')]||0x3;this[_0x4b19('0x3f')]=_0x570374[_0x4b19('0x3f')]||0x96;this[_0x4b19('0x40')]=_0x570374[_0x4b19('0x40')]||0x3;this[_0x4b19('0x41')]=_0x570374[_0x4b19('0x41')]||0x96;this[_0x4b19('0x42')]=_0x570374[_0x4b19('0x42')]||0x3;this[_0x4b19('0x43')]=_0x570374['dialAgentRejectRetryFrequency']||0x96;this[_0x4b19('0x44')]=_0x570374['callAdditionalPhoneAfterMin']||0x3;this[_0x4b19('0x45')]=_0x570374[_0x4b19('0x45')]||0x4;this['Trunk']=_0x570374[_0x4b19('0x46')]?_0x570374[_0x4b19('0x46')]:undefined;this[_0x4b19('0x47')]=_0x570374[_0x4b19('0x47')]?_0x570374[_0x4b19('0x47')]:undefined;this[_0x4b19('0x48')]=_0x570374[_0x4b19('0x48')]||undefined;this[_0x4b19('0x49')]=_0x570374[_0x4b19('0x49')]?_0x570374[_0x4b19('0x49')]:undefined;this[_0x4b19('0x4a')]=_0x570374[_0x4b19('0x4a')]||_0x4b19('0x4b');this['dialRandomLastDigitCallerIdNumber']=_0x570374[_0x4b19('0x4c')]||undefined;this['dialCutDigit']=_0x570374['dialCutDigit']||undefined;this[_0x4b19('0x4d')]=strategy[_0x570374[_0x4b19('0x4d')]];this[_0x4b19('0x4e')]=!![];this[_0x4b19('0x4f')]=_0x570374[_0x4b19('0x4f')]||![];this[_0x4b19('0x50')]=_0x570374[_0x4b19('0x50')];this[_0x4b19('0x51')]=_0x570374[_0x4b19('0x51')];this[_0x4b19('0x52')]=_0x570374[_0x4b19('0x52')];this['dialAMDTotalAnalysisTime']=_0x570374[_0x4b19('0x53')];this[_0x4b19('0x54')]=_0x570374['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x570374[_0x4b19('0x55')];this[_0x4b19('0x56')]=_0x570374[_0x4b19('0x56')];this[_0x4b19('0x57')]=_0x570374[_0x4b19('0x57')];this['dialAMDMaximumWordLength']=_0x570374['dialAMDMaximumWordLength'];this[_0x4b19('0x58')]=0x0;this[_0x4b19('0x59')]=0x0;this[_0x4b19('0x5a')]=_0x570374[_0x4b19('0x5a')];this[_0x4b19('0x5b')]=0x0;this[_0x4b19('0x5c')]=0x0;this[_0x4b19('0x5d')]=0x0;this[_0x4b19('0x5e')]=0x0;this[_0x4b19('0x5f')]=0x0;this[_0x4b19('0x60')]=0x0;this[_0x4b19('0x61')]=0x0;this[_0x4b19('0x62')]=0x0;this[_0x4b19('0x63')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x4b19('0x64')]=0x0;this[_0x4b19('0x65')]=0x0;this[_0x4b19('0x66')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x4b19('0x67')]=undefined;this[_0x4b19('0x68')]=undefined;this[_0x4b19('0x69')]=undefined;this[_0x4b19('0x6a')]=1.05;this[_0x4b19('0x6b')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x4b19('0x6c')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x4b19('0x6d')]=0x0;this[_0x4b19('0x6e')]=0x0;this[_0x4b19('0x6f')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x4b19('0x70')]=_0x570374[_0x4b19('0x71')]||0x14;this[_0x4b19('0x72')]=_0x570374[_0x4b19('0x71')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x4b19('0x73')]=0x0;this[_0x4b19('0x74')]=0x0;this[_0x4b19('0x75')]=0x0;this['erlangBusyFactor']=0x0;this[_0x4b19('0x76')]=_0x570374['dialRecallMeTimeout']||0x1e;this[_0x4b19('0x77')]=_0x570374[_0x4b19('0x77')]||![];this[_0x4b19('0x78')]=!!_0x570374[_0x4b19('0x78')]||![];this[_0x4b19('0x79')]=!!_0x570374[_0x4b19('0x79')]||![];this['dialQueueProject2']=_0x570374[_0x4b19('0x7a')]||undefined;this[_0x4b19('0x7b')]=_0x570374[_0x4b19('0x7b')]||![];this[_0x4b19('0x7c')]=_0x570374[_0x4b19('0x7c')]||![];this['monitor_format']=monitorFormat[_0x570374['monitor_format']]?monitorFormat[_0x570374[_0x4b19('0xa')]]:undefined;this[_0x4b19('0x7d')]=_0x570374[_0x4b19('0x7d')]||![];this[_0x4b19('0x7e')]=_0x570374['mandatoryDispositionPause']?_0x570374['mandatoryDispositionPause']:undefined;this[_0x4b19('0x7f')]=![];}module[_0x4b19('0x80')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index be78910..6a7813c 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 _0xad78=['ringInUse','talking','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','loggedin','callers','length','SIP/','online','incall','includes','status','busy','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','available','paused','ringing','waiting','answered','inUse','loggedIn','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','invalid','onHold','notInUse'];(function(_0x2d90e5,_0x80f30){var _0x230565=function(_0x2dcb22){while(--_0x2dcb22){_0x2d90e5['push'](_0x2d90e5['shift']());}};_0x230565(++_0x80f30);}(_0xad78,0x149));var _0x8ad7=function(_0x15046a,_0x3a3f57){_0x15046a=_0x15046a-0x0;var _0x5d2799=_0xad78[_0x15046a];return _0x5d2799;};'use strict';var INBOUND_COUNTERS=[_0x8ad7('0x0'),'loggedIn','loggedInDb',_0x8ad7('0x1'),_0x8ad7('0x2'),'talking',_0x8ad7('0x3')];var OUTBOUND_COUNTERS=[_0x8ad7('0x0'),_0x8ad7('0x4'),_0x8ad7('0x5'),_0x8ad7('0x6'),_0x8ad7('0x7'),_0x8ad7('0x8'),_0x8ad7('0x9'),_0x8ad7('0xa'),_0x8ad7('0xb'),'outboundBusyCallsDay','outboundCongestionCallsDay',_0x8ad7('0xc'),_0x8ad7('0xd'),_0x8ad7('0xe'),_0x8ad7('0xf'),_0x8ad7('0x10'),_0x8ad7('0x1'),_0x8ad7('0x11'),'talking',_0x8ad7('0x12'),_0x8ad7('0x13'),_0x8ad7('0x14'),'waiting'];function VoiceQueueSummary(_0x44fad6){this['id']=_0x44fad6['id'];this[_0x8ad7('0x15')]=_0x44fad6[_0x8ad7('0x15')];this[_0x8ad7('0x16')]=_0x44fad6[_0x8ad7('0x16')];this[_0x8ad7('0x17')]=_0x44fad6[_0x8ad7('0x17')]||0x0;this[_0x8ad7('0x4')]=_0x44fad6[_0x8ad7('0x4')]||0x0;this[_0x8ad7('0x0')]=_0x44fad6[_0x8ad7('0x0')]||0x0;this['busy']=_0x44fad6['busy']||0x0;this[_0x8ad7('0x5')]=_0x44fad6['inUse']||0x0;this[_0x8ad7('0x18')]=_0x44fad6[_0x8ad7('0x18')]||0x0;this['loggedIn']=_0x44fad6['loggedIn']||0x0;this[_0x8ad7('0x7')]=_0x44fad6[_0x8ad7('0x7')]||0x0;this[_0x8ad7('0x19')]=_0x44fad6[_0x8ad7('0x19')]||0x0;this[_0x8ad7('0x1a')]=_0x44fad6[_0x8ad7('0x1a')]||0x0;this[_0x8ad7('0x1')]=_0x44fad6['paused']||0x0;this['ringing']=_0x44fad6['ringing']||0x0;this[_0x8ad7('0x1b')]=_0x44fad6['ringInUse'];this[_0x8ad7('0x12')]=_0x44fad6[_0x8ad7('0x12')];this[_0x8ad7('0x13')]=_0x44fad6['sumDuration'];this['sumHoldTime']=_0x44fad6['sumHoldTime']||0x0;this[_0x8ad7('0x1c')]=_0x44fad6['talking']||0x0;this['total']=_0x44fad6[_0x8ad7('0x14')]||0x0;this[_0x8ad7('0x1d')]=_0x44fad6[_0x8ad7('0x1d')];this['unavailable']=_0x44fad6[_0x8ad7('0x1e')]||0x0;this[_0x8ad7('0x1f')]=_0x44fad6[_0x8ad7('0x1f')]||0x0;this[_0x8ad7('0x20')]=_0x44fad6[_0x8ad7('0x20')]||0x0;this[_0x8ad7('0x3')]=_0x44fad6['waiting']||0x0;if(_0x44fad6[_0x8ad7('0x1d')]===_0x8ad7('0x21')){this['pTalking']=_0x44fad6[_0x8ad7('0x11')]||0x0;this[_0x8ad7('0x22')]=_0x44fad6[_0x8ad7('0x22')];this[_0x8ad7('0x23')]=_0x44fad6[_0x8ad7('0x23')];this[_0x8ad7('0x24')]=_0x44fad6[_0x8ad7('0x24')];this['dialOriginateCallerIdNumber']=_0x44fad6['dialOriginateCallerIdNumber'];this[_0x8ad7('0x25')]=_0x44fad6['dialOriginateTimeout'];this[_0x8ad7('0x26')]=_0x44fad6[_0x8ad7('0x26')];this['temp']=_0x44fad6[_0x8ad7('0x27')];this[_0x8ad7('0x28')]=_0x44fad6[_0x8ad7('0x28')];this['outboundAnswerCallsDay']=_0x44fad6[_0x8ad7('0xa')];this['outboundBlacklistCallsDay']=_0x44fad6['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x44fad6[_0x8ad7('0x29')];this[_0x8ad7('0x2a')]=_0x44fad6[_0x8ad7('0x2a')];this[_0x8ad7('0x2b')]=_0x44fad6[_0x8ad7('0x2b')];this[_0x8ad7('0x2c')]=_0x44fad6[_0x8ad7('0x2c')];this[_0x8ad7('0x2d')]=_0x44fad6[_0x8ad7('0x2d')];this[_0x8ad7('0xc')]=_0x44fad6['outboundNoAnswerCallsDay'];this[_0x8ad7('0xd')]=_0x44fad6[_0x8ad7('0xd')];this[_0x8ad7('0x2e')]=_0x44fad6['outboundOriginateFailureCallsDay'];this[_0x8ad7('0xe')]=_0x44fad6[_0x8ad7('0xe')];this[_0x8ad7('0xf')]=_0x44fad6[_0x8ad7('0xf')];this[_0x8ad7('0x10')]=_0x44fad6[_0x8ad7('0x10')];this['predictiveIntervalAnsweredCalls']=_0x44fad6[_0x8ad7('0x2f')];this['predictiveIntervalAvgHoldtime']=_0x44fad6[_0x8ad7('0x30')];this[_0x8ad7('0x31')]=_0x44fad6[_0x8ad7('0x31')];this[_0x8ad7('0x32')]=_0x44fad6['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x44fad6[_0x8ad7('0x33')];this[_0x8ad7('0x34')]=_0x44fad6[_0x8ad7('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x44fad6[_0x8ad7('0x35')];this[_0x8ad7('0x36')]=_0x44fad6[_0x8ad7('0x36')];this[_0x8ad7('0x37')]=_0x44fad6[_0x8ad7('0x37')];this[_0x8ad7('0x38')]=_0x44fad6['predictiveIntervalPauses'];this[_0x8ad7('0x39')]=_0x44fad6['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x44fad6[_0x8ad7('0x3a')];this['originated']=_0x44fad6[_0x8ad7('0x8')];this[_0x8ad7('0x3b')]=_0x44fad6[_0x8ad7('0x3b')];this['erlangCallToSecond']=_0x44fad6[_0x8ad7('0x3c')];this[_0x8ad7('0x3d')]=_0x44fad6[_0x8ad7('0x3d')];this[_0x8ad7('0x3e')]=_0x44fad6[_0x8ad7('0x3e')];this[_0x8ad7('0x3f')]=_0x44fad6[_0x8ad7('0x3f')];this['startProgressive']=_0x44fad6[_0x8ad7('0x40')];this[_0x8ad7('0x41')]=_0x44fad6[_0x8ad7('0x41')];this[_0x8ad7('0x42')]=_0x44fad6[_0x8ad7('0x42')];}if(_0x44fad6[_0x8ad7('0x43')]){this[_0x8ad7('0x43')]={'id':_0x44fad6[_0x8ad7('0x43')]['id'],'name':_0x44fad6[_0x8ad7('0x43')]['name'],'active':_0x44fad6[_0x8ad7('0x43')]['active'],'callerid':_0x44fad6[_0x8ad7('0x43')][_0x8ad7('0x44')]};}}VoiceQueueSummary['prototype']['createReport']=function(_0xf39b0c,_0x360be7,_0x258cae,_0xb6b403){this[_0x8ad7('0x7')]=0x0;this[_0x8ad7('0x1c')]=0x0;this[_0x8ad7('0x1')]=0x0;this[_0x8ad7('0x1f')]=0x0;this['notInUse']=0x0;this[_0x8ad7('0x5')]=0x0;this['busy']=0x0;this[_0x8ad7('0x18')]=0x0;this['unavailable']=0x0;this[_0x8ad7('0x2')]=0x0;this[_0x8ad7('0x1b')]=0x0;this[_0x8ad7('0x19')]=0x0;if(_0x258cae){if(_0x258cae[_0x8ad7('0x0')]){this['available']=Number(_0x258cae[_0x8ad7('0x0')]);}if(_0x258cae[_0x8ad7('0x45')]){this[_0x8ad7('0x6')]=Number(_0x258cae[_0x8ad7('0x45')]);}if(_0x258cae[_0x8ad7('0x46')]){this[_0x8ad7('0x3')]=Number(_0x258cae['callers']);}}for(var _0x59a9fb=0x0;_0x59a9fb<_0xf39b0c[_0x8ad7('0x47')];_0x59a9fb++){var _0x308523=_0x360be7[_0x8ad7('0x48')+_0xf39b0c[_0x59a9fb]['name']];if(_0x308523&&_0x308523[_0x8ad7('0x49')]){this[_0x8ad7('0x7')]+=0x1;}if(_0xf39b0c[_0x59a9fb][_0x8ad7('0x4a')]==='1'){this[_0x8ad7('0x1c')]+=0x1;}if(_0xf39b0c[_0x59a9fb][_0x8ad7('0x1')]==='1'&&!['2','7','8'][_0x8ad7('0x4b')](_0xf39b0c[_0x59a9fb][_0x8ad7('0x4c')])){this[_0x8ad7('0x1')]+=0x1;}switch(_0xf39b0c[_0x59a9fb][_0x8ad7('0x4c')]){case'0':this[_0x8ad7('0x1f')]+=0x1;break;case'1':this[_0x8ad7('0x1a')]+=0x1;break;case'2':this[_0x8ad7('0x5')]+=0x1;break;case'3':this[_0x8ad7('0x4d')]+=0x1;break;case'4':this[_0x8ad7('0x18')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x8ad7('0x1b')]+=0x1;break;case'8':this[_0x8ad7('0x19')]+=0x1;break;}}if(this[_0x8ad7('0x23')]==='booked'){var _0x2c2abb=Object['keys'](_0xb6b403);for(var _0x9b3e5c=0x0;_0x9b3e5c<_0x2c2abb[_0x8ad7('0x47')];_0x9b3e5c++){var _0x20bb38=_0x2c2abb[_0x9b3e5c];var _0x26e398=_0xb6b403[_0x20bb38];if(_0x26e398[_0x8ad7('0x4e')]===this['name']&&_0x26e398['type']===_0x8ad7('0x4f')&&_0x26e398[_0x8ad7('0x50')]===_0x8ad7('0x51')){this[_0x8ad7('0x1c')]+=0x1;}}if(this['talking']>this[_0x8ad7('0x5')]){this[_0x8ad7('0x1c')]=this[_0x8ad7('0x5')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x8ad7('0x52')][_0x8ad7('0x53')]=function(_0x3aa0da){var _0xc7d194=![];if(_0x3aa0da){_0xc7d194=INBOUND_COUNTERS[_0x8ad7('0x54')](function(_0x4454d0){return this[_0x4454d0]!==_0x3aa0da[_0x4454d0];},this);}return _0xc7d194;};VoiceQueueSummary[_0x8ad7('0x52')][_0x8ad7('0x55')]=function(_0x103e3a){var _0x1d8604=![];var _0x1c980a=![];var _0x121f3b=![];if(_0x103e3a){_0x1d8604=this[_0x8ad7('0x23')]!==_0x103e3a['dialMethod']||this[_0x8ad7('0x22')]!==_0x103e3a[_0x8ad7('0x22')]||this['message']!==_0x103e3a[_0x8ad7('0x41')]||this[_0x8ad7('0x42')]!==_0x103e3a[_0x8ad7('0x42')];_0x1c980a=OUTBOUND_COUNTERS['some'](function(_0x1e42d0){return this[_0x1e42d0]!==_0x103e3a[_0x1e42d0];},this);if(this[_0x8ad7('0x43')]&&_0x103e3a[_0x8ad7('0x43')]){_0x121f3b=this[_0x8ad7('0x43')][_0x8ad7('0x15')]!==_0x103e3a['Trunk'][_0x8ad7('0x15')]||this[_0x8ad7('0x43')][_0x8ad7('0x56')]!==_0x103e3a[_0x8ad7('0x43')][_0x8ad7('0x56')];}}return _0x1d8604||_0x1c980a||_0x121f3b;};VoiceQueueSummary['prototype'][_0x8ad7('0x57')]=function(_0x505b0c){this[_0x8ad7('0x4')]=_0x505b0c[_0x8ad7('0x4')];this['message']=_0x505b0c[_0x8ad7('0x41')];this[_0x8ad7('0x42')]=_0x505b0c[_0x8ad7('0x42')];this['originated']=_0x505b0c[_0x8ad7('0x8')];this['outboundAbandonedCallsDay']=_0x505b0c['outboundAbandonedCallsDay'];this[_0x8ad7('0xa')]=_0x505b0c[_0x8ad7('0xa')];this[_0x8ad7('0xb')]=_0x505b0c['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x505b0c['outboundBusyCallsDay'];this[_0x8ad7('0x2a')]=_0x505b0c['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x505b0c[_0x8ad7('0xc')];this[_0x8ad7('0xd')]=_0x505b0c[_0x8ad7('0xd')];this[_0x8ad7('0xe')]=_0x505b0c[_0x8ad7('0xe')];this[_0x8ad7('0xf')]=_0x505b0c['outboundRejectCallsDay'];this[_0x8ad7('0x10')]=_0x505b0c[_0x8ad7('0x10')];this[_0x8ad7('0x12')]=_0x505b0c['sumBillable'];this[_0x8ad7('0x13')]=_0x505b0c[_0x8ad7('0x13')];this['total']=_0x505b0c[_0x8ad7('0x14')];if(this[_0x8ad7('0x23')]===_0x8ad7('0x58')){this[_0x8ad7('0x11')]=_0x505b0c['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xa23f=['predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','notInUse','booked','queue','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','available','loggedIn','ringing','talking','waiting','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumDuration','name','strategy','abandoned','answered','busy','invalid','onHold','paused','ringInUse','sumBillable','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0xa23f,0x7c));var _0xfa23=function(_0x3dc2fc,_0x20511e){_0x3dc2fc=_0x3dc2fc-0x0;var _0x37a276=_0xa23f[_0x3dc2fc];return _0x37a276;};'use strict';var INBOUND_COUNTERS=[_0xfa23('0x0'),_0xfa23('0x1'),'loggedInDb','paused',_0xfa23('0x2'),_0xfa23('0x3'),_0xfa23('0x4')];var OUTBOUND_COUNTERS=[_0xfa23('0x0'),'answered',_0xfa23('0x5'),'loggedIn',_0xfa23('0x6'),_0xfa23('0x7'),_0xfa23('0x8'),_0xfa23('0x9'),'outboundBlacklistCallsDay',_0xfa23('0xa'),'outboundCongestionCallsDay',_0xfa23('0xb'),_0xfa23('0xc'),_0xfa23('0xd'),_0xfa23('0xe'),_0xfa23('0xf'),'paused','pTalking',_0xfa23('0x3'),'sumBillable',_0xfa23('0x10'),'total',_0xfa23('0x4')];function VoiceQueueSummary(_0x2853da){this['id']=_0x2853da['id'];this[_0xfa23('0x11')]=_0x2853da['name'];this[_0xfa23('0x12')]=_0x2853da[_0xfa23('0x12')];this[_0xfa23('0x13')]=_0x2853da['abandoned']||0x0;this['answered']=_0x2853da[_0xfa23('0x14')]||0x0;this[_0xfa23('0x0')]=_0x2853da[_0xfa23('0x0')]||0x0;this[_0xfa23('0x15')]=_0x2853da['busy']||0x0;this[_0xfa23('0x5')]=_0x2853da[_0xfa23('0x5')]||0x0;this[_0xfa23('0x16')]=_0x2853da[_0xfa23('0x16')]||0x0;this['loggedIn']=_0x2853da[_0xfa23('0x1')]||0x0;this[_0xfa23('0x6')]=_0x2853da[_0xfa23('0x6')]||0x0;this[_0xfa23('0x17')]=_0x2853da[_0xfa23('0x17')]||0x0;this['notInUse']=_0x2853da['notInUse']||0x0;this['paused']=_0x2853da[_0xfa23('0x18')]||0x0;this[_0xfa23('0x2')]=_0x2853da['ringing']||0x0;this[_0xfa23('0x19')]=_0x2853da[_0xfa23('0x19')];this[_0xfa23('0x1a')]=_0x2853da['sumBillable'];this[_0xfa23('0x10')]=_0x2853da[_0xfa23('0x10')];this['sumHoldTime']=_0x2853da[_0xfa23('0x1b')]||0x0;this[_0xfa23('0x3')]=_0x2853da[_0xfa23('0x3')]||0x0;this[_0xfa23('0x1c')]=_0x2853da[_0xfa23('0x1c')]||0x0;this[_0xfa23('0x1d')]=_0x2853da[_0xfa23('0x1d')];this['unavailable']=_0x2853da[_0xfa23('0x1e')]||0x0;this[_0xfa23('0x1f')]=_0x2853da[_0xfa23('0x1f')]||0x0;this[_0xfa23('0x20')]=_0x2853da['unmanaged']||0x0;this[_0xfa23('0x4')]=_0x2853da['waiting']||0x0;if(_0x2853da[_0xfa23('0x1d')]===_0xfa23('0x21')){this[_0xfa23('0x22')]=_0x2853da[_0xfa23('0x22')]||0x0;this[_0xfa23('0x23')]=_0x2853da[_0xfa23('0x23')];this[_0xfa23('0x24')]=_0x2853da[_0xfa23('0x24')];this['dialOriginateCallerIdName']=_0x2853da[_0xfa23('0x25')];this['dialOriginateCallerIdNumber']=_0x2853da[_0xfa23('0x26')];this['dialOriginateTimeout']=_0x2853da['dialOriginateTimeout'];this[_0xfa23('0x27')]=_0x2853da[_0xfa23('0x27')];this[_0xfa23('0x28')]=_0x2853da[_0xfa23('0x28')];this[_0xfa23('0x29')]=_0x2853da[_0xfa23('0x29')];this[_0xfa23('0x9')]=_0x2853da['outboundAnswerCallsDay'];this[_0xfa23('0x2a')]=_0x2853da['outboundBlacklistCallsDay'];this[_0xfa23('0xa')]=_0x2853da[_0xfa23('0xa')];this['outboundCongestionCallsDay']=_0x2853da[_0xfa23('0x2b')];this[_0xfa23('0x2c')]=_0x2853da[_0xfa23('0x2c')];this[_0xfa23('0x2d')]=_0x2853da[_0xfa23('0x2d')];this[_0xfa23('0x2e')]=_0x2853da[_0xfa23('0x2e')];this[_0xfa23('0xb')]=_0x2853da[_0xfa23('0xb')];this['outboundNoSuchCallsDay']=_0x2853da[_0xfa23('0xc')];this['outboundOriginateFailureCallsDay']=_0x2853da[_0xfa23('0x2f')];this[_0xfa23('0xd')]=_0x2853da[_0xfa23('0xd')];this[_0xfa23('0xe')]=_0x2853da[_0xfa23('0xe')];this[_0xfa23('0xf')]=_0x2853da[_0xfa23('0xf')];this[_0xfa23('0x30')]=_0x2853da[_0xfa23('0x30')];this['predictiveIntervalAvgHoldtime']=_0x2853da[_0xfa23('0x31')];this['predictiveIntervalAvgTalktime']=_0x2853da[_0xfa23('0x32')];this[_0xfa23('0x33')]=_0x2853da[_0xfa23('0x33')];this[_0xfa23('0x34')]=_0x2853da[_0xfa23('0x34')];this[_0xfa23('0x35')]=_0x2853da[_0xfa23('0x35')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x2853da[_0xfa23('0x36')];this[_0xfa23('0x37')]=_0x2853da[_0xfa23('0x37')];this[_0xfa23('0x38')]=_0x2853da['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x2853da['predictiveIntervalPauses'];this[_0xfa23('0x39')]=_0x2853da[_0xfa23('0x39')];this['predictiveIntervalTotalCalls']=_0x2853da[_0xfa23('0x3a')];this[_0xfa23('0x7')]=_0x2853da[_0xfa23('0x7')];this['erlangCalls']=_0x2853da[_0xfa23('0x3b')];this['erlangCallToSecond']=_0x2853da[_0xfa23('0x3c')];this[_0xfa23('0x3d')]=_0x2853da[_0xfa23('0x3d')];this[_0xfa23('0x3e')]=_0x2853da[_0xfa23('0x3e')];this[_0xfa23('0x3f')]=_0x2853da['startPredictive'];this[_0xfa23('0x40')]=_0x2853da[_0xfa23('0x40')];this[_0xfa23('0x41')]=_0x2853da[_0xfa23('0x41')];this['statusMessage']=_0x2853da[_0xfa23('0x42')];}if(_0x2853da[_0xfa23('0x43')]){this[_0xfa23('0x43')]={'id':_0x2853da[_0xfa23('0x43')]['id'],'name':_0x2853da[_0xfa23('0x43')][_0xfa23('0x11')],'active':_0x2853da['Trunk'][_0xfa23('0x44')],'callerid':_0x2853da['Trunk']['callerid']};}}VoiceQueueSummary[_0xfa23('0x45')][_0xfa23('0x46')]=function(_0x5937e0,_0x603fd9,_0x20c88c,_0x71abcc){this['loggedInDb']=0x0;this[_0xfa23('0x3')]=0x0;this[_0xfa23('0x18')]=0x0;this[_0xfa23('0x1f')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0xfa23('0x15')]=0x0;this['invalid']=0x0;this[_0xfa23('0x1e')]=0x0;this[_0xfa23('0x2')]=0x0;this[_0xfa23('0x19')]=0x0;this['onHold']=0x0;if(_0x20c88c){if(_0x20c88c[_0xfa23('0x0')]){this[_0xfa23('0x0')]=Number(_0x20c88c[_0xfa23('0x0')]);}if(_0x20c88c[_0xfa23('0x47')]){this['loggedIn']=Number(_0x20c88c[_0xfa23('0x47')]);}if(_0x20c88c[_0xfa23('0x48')]){this[_0xfa23('0x4')]=Number(_0x20c88c['callers']);}}for(var _0x5c9a98=0x0;_0x5c9a98<_0x5937e0[_0xfa23('0x49')];_0x5c9a98++){var _0x49e186=_0x603fd9[_0xfa23('0x4a')+_0x5937e0[_0x5c9a98][_0xfa23('0x11')]];if(_0x49e186&&_0x49e186[_0xfa23('0x4b')]){this[_0xfa23('0x6')]+=0x1;}if(_0x5937e0[_0x5c9a98][_0xfa23('0x4c')]==='1'){this[_0xfa23('0x3')]+=0x1;}if(_0x5937e0[_0x5c9a98]['paused']==='1'&&!['2','7','8'][_0xfa23('0x4d')](_0x5937e0[_0x5c9a98][_0xfa23('0x4e')])){this[_0xfa23('0x18')]+=0x1;}switch(_0x5937e0[_0x5c9a98][_0xfa23('0x4e')]){case'0':this[_0xfa23('0x1f')]+=0x1;break;case'1':this[_0xfa23('0x4f')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xfa23('0x15')]+=0x1;break;case'4':this[_0xfa23('0x16')]+=0x1;break;case'5':this[_0xfa23('0x1e')]+=0x1;break;case'6':this[_0xfa23('0x2')]+=0x1;break;case'7':this[_0xfa23('0x19')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xfa23('0x24')]===_0xfa23('0x50')){var _0x18afb9=Object['keys'](_0x71abcc);for(var _0x253faf=0x0;_0x253faf<_0x18afb9[_0xfa23('0x49')];_0x253faf++){var _0xf87b08=_0x18afb9[_0x253faf];var _0x4490ad=_0x71abcc[_0xf87b08];if(_0x4490ad[_0xfa23('0x51')]===this[_0xfa23('0x11')]&&_0x4490ad[_0xfa23('0x1d')]==='dialer'&&_0x4490ad[_0xfa23('0x52')]==='xcally-motion-preview'){this[_0xfa23('0x3')]+=0x1;}}if(this[_0xfa23('0x3')]>this[_0xfa23('0x5')]){this[_0xfa23('0x3')]=this[_0xfa23('0x5')];}this[_0xfa23('0x22')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xfa23('0x53')]=function(_0x2b7628){var _0x2ec20b=![];if(_0x2b7628){_0x2ec20b=INBOUND_COUNTERS[_0xfa23('0x54')](function(_0x13c37d){return this[_0x13c37d]!==_0x2b7628[_0x13c37d];},this);}return _0x2ec20b;};VoiceQueueSummary[_0xfa23('0x45')][_0xfa23('0x55')]=function(_0x531c02){var _0x3e1d1a=![];var _0x18280a=![];var _0x35baca=![];if(_0x531c02){_0x3e1d1a=this[_0xfa23('0x24')]!==_0x531c02['dialMethod']||this[_0xfa23('0x23')]!==_0x531c02[_0xfa23('0x23')]||this[_0xfa23('0x41')]!==_0x531c02[_0xfa23('0x41')]||this[_0xfa23('0x42')]!==_0x531c02[_0xfa23('0x42')];_0x18280a=OUTBOUND_COUNTERS['some'](function(_0x29ca4b){return this[_0x29ca4b]!==_0x531c02[_0x29ca4b];},this);if(this['Trunk']&&_0x531c02[_0xfa23('0x43')]){_0x35baca=this[_0xfa23('0x43')]['name']!==_0x531c02[_0xfa23('0x43')][_0xfa23('0x11')]||this['Trunk'][_0xfa23('0x44')]!==_0x531c02[_0xfa23('0x43')]['active'];}}return _0x3e1d1a||_0x18280a||_0x35baca;};VoiceQueueSummary[_0xfa23('0x45')][_0xfa23('0x56')]=function(_0x1325c9){this[_0xfa23('0x14')]=_0x1325c9['answered'];this[_0xfa23('0x41')]=_0x1325c9[_0xfa23('0x41')];this['statusMessage']=_0x1325c9[_0xfa23('0x42')];this[_0xfa23('0x7')]=_0x1325c9[_0xfa23('0x7')];this[_0xfa23('0x8')]=_0x1325c9[_0xfa23('0x8')];this[_0xfa23('0x9')]=_0x1325c9['outboundAnswerCallsDay'];this[_0xfa23('0x2a')]=_0x1325c9[_0xfa23('0x2a')];this[_0xfa23('0xa')]=_0x1325c9['outboundBusyCallsDay'];this[_0xfa23('0x2b')]=_0x1325c9[_0xfa23('0x2b')];this[_0xfa23('0xb')]=_0x1325c9['outboundNoAnswerCallsDay'];this[_0xfa23('0xc')]=_0x1325c9[_0xfa23('0xc')];this[_0xfa23('0xd')]=_0x1325c9[_0xfa23('0xd')];this[_0xfa23('0xe')]=_0x1325c9['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x1325c9[_0xfa23('0xf')];this[_0xfa23('0x1a')]=_0x1325c9[_0xfa23('0x1a')];this[_0xfa23('0x10')]=_0x1325c9['sumDuration'];this['total']=_0x1325c9[_0xfa23('0x1c')];if(this[_0xfa23('0x24')]===_0xfa23('0x57')){this[_0xfa23('0x22')]=_0x1325c9['pTalking'];}};module[_0xfa23('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5b71ee4..f5aee23 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 _0xa974=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2c5755,_0xd30855){var _0x561ea1=function(_0xff516e){while(--_0xff516e){_0x2c5755['push'](_0x2c5755['shift']());}};_0x561ea1(++_0xd30855);}(_0xa974,0x195));var _0x4a97=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0xa974[_0x39cf70];return _0x580424;};'use strict';function VtigerAccount(_0x4e92d4){this['id']=_0x4e92d4['id']||0x0;this['name']=_0x4e92d4[_0x4a97('0x0')]||'';this[_0x4a97('0x1')]=_0x4e92d4[_0x4a97('0x1')]||'';this[_0x4a97('0x2')]=_0x4e92d4[_0x4a97('0x2')]||'';this['remoteUri']=_0x4e92d4[_0x4a97('0x3')]||'';this[_0x4a97('0x4')]=_0x4e92d4[_0x4a97('0x4')]||'';this[_0x4a97('0x5')]=_0x4e92d4[_0x4a97('0x5')]||{};}module[_0x4a97('0x6')]=VtigerAccount; \ No newline at end of file +var _0x98df=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x35dceb,_0x3ff81e){var _0x257bb5=function(_0xbbdde7){while(--_0xbbdde7){_0x35dceb['push'](_0x35dceb['shift']());}};_0x257bb5(++_0x3ff81e);}(_0x98df,0xc8));var _0xf98d=function(_0x32f24a,_0x4fbe6a){_0x32f24a=_0x32f24a-0x0;var _0x1f3e8f=_0x98df[_0x32f24a];return _0x1f3e8f;};'use strict';function VtigerAccount(_0x1ce11d){this['id']=_0x1ce11d['id']||0x0;this[_0xf98d('0x0')]=_0x1ce11d[_0xf98d('0x0')]||'';this['username']=_0x1ce11d[_0xf98d('0x1')]||'';this[_0xf98d('0x2')]=_0x1ce11d[_0xf98d('0x2')]||'';this[_0xf98d('0x3')]=_0x1ce11d['remoteUri']||'';this[_0xf98d('0x4')]=_0x1ce11d['serverUrl']||'';this[_0xf98d('0x5')]=_0x1ce11d['Configurations']||{};}module[_0xf98d('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 19afdbd..1aafb9c 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 _0x1d1b=['integrationTab','serverUrl','Configurations','exports','name','username','password','remoteUri','authType','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d1b,0xa4));var _0xb1d1=function(_0x189b2d,_0x2f8a9c){_0x189b2d=_0x189b2d-0x0;var _0x478dba=_0x1d1b[_0x189b2d];return _0x478dba;};'use strict';function ZendeskAccount(_0xfc8880){this['id']=_0xfc8880['id']||0x0;this['name']=_0xfc8880[_0xb1d1('0x0')]||'';this['username']=_0xfc8880[_0xb1d1('0x1')]||'';this[_0xb1d1('0x2')]=_0xfc8880[_0xb1d1('0x2')]||'';this['token']=_0xfc8880['token']||'';this[_0xb1d1('0x3')]=_0xfc8880[_0xb1d1('0x3')]||'';this[_0xb1d1('0x4')]=_0xfc8880[_0xb1d1('0x4')]||'';this['type']=_0xfc8880[_0xb1d1('0x5')]||_0xb1d1('0x6');this['serverUrl']=_0xfc8880[_0xb1d1('0x7')]||'';this[_0xb1d1('0x8')]=_0xfc8880['Configurations']||{};}module[_0xb1d1('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x3fd7=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','username','password'];(function(_0x42184c,_0x59dac7){var _0x34a800=function(_0x1b2f10){while(--_0x1b2f10){_0x42184c['push'](_0x42184c['shift']());}};_0x34a800(++_0x59dac7);}(_0x3fd7,0x1b6));var _0x73fd=function(_0x40ffc2,_0x2f770f){_0x40ffc2=_0x40ffc2-0x0;var _0x1fde65=_0x3fd7[_0x40ffc2];return _0x1fde65;};'use strict';function ZendeskAccount(_0x4ee18e){this['id']=_0x4ee18e['id']||0x0;this['name']=_0x4ee18e['name']||'';this[_0x73fd('0x0')]=_0x4ee18e[_0x73fd('0x0')]||'';this[_0x73fd('0x1')]=_0x4ee18e['password']||'';this[_0x73fd('0x2')]=_0x4ee18e['token']||'';this[_0x73fd('0x3')]=_0x4ee18e[_0x73fd('0x3')]||'';this[_0x73fd('0x4')]=_0x4ee18e[_0x73fd('0x4')]||'';this[_0x73fd('0x5')]=_0x4ee18e[_0x73fd('0x5')]||_0x73fd('0x6');this[_0x73fd('0x7')]=_0x4ee18e[_0x73fd('0x7')]||'';this[_0x73fd('0x8')]=_0x4ee18e[_0x73fd('0x8')]||{};}module[_0x73fd('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 4f8c64b..5df84bd 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 _0xbf42=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x1c3b6f,_0x5138a3){var _0x5a15ab=function(_0x2c8a5b){while(--_0x2c8a5b){_0x1c3b6f['push'](_0x1c3b6f['shift']());}};_0x5a15ab(++_0x5138a3);}(_0xbf42,0x166));var _0x2bf4=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xbf42[_0x34bc30];return _0x5706de;};'use strict';function ZohoAccount(_0xca1716){this['id']=_0xca1716['id']||0x0;this[_0x2bf4('0x0')]=_0xca1716[_0x2bf4('0x0')]||'';this[_0x2bf4('0x1')]=_0xca1716[_0x2bf4('0x1')]||'';this[_0x2bf4('0x2')]=_0xca1716[_0x2bf4('0x2')]||'';this[_0x2bf4('0x3')]=_0xca1716[_0x2bf4('0x3')]||'';this[_0x2bf4('0x4')]=_0xca1716[_0x2bf4('0x4')]||'';this[_0x2bf4('0x5')]=_0xca1716[_0x2bf4('0x5')]||'';this[_0x2bf4('0x6')]=_0xca1716[_0x2bf4('0x6')]||'';this[_0x2bf4('0x7')]=_0xca1716[_0x2bf4('0x7')]||'';this[_0x2bf4('0x8')]=_0xca1716['refreshToken']||'';this[_0x2bf4('0x9')]=_0xca1716[_0x2bf4('0x9')]||{};}module[_0x2bf4('0xa')]=ZohoAccount; \ No newline at end of file +var _0x61d6=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x58061d,_0x59e441){var _0x24afc8=function(_0x53a517){while(--_0x53a517){_0x58061d['push'](_0x58061d['shift']());}};_0x24afc8(++_0x59e441);}(_0x61d6,0xec));var _0x661d=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x61d6[_0x220f3f];return _0x1f170e;};'use strict';function ZohoAccount(_0x44876f){this['id']=_0x44876f['id']||0x0;this[_0x661d('0x0')]=_0x44876f['name']||'';this['description']=_0x44876f[_0x661d('0x1')]||'';this[_0x661d('0x2')]=_0x44876f['host']||'';this[_0x661d('0x3')]=_0x44876f['zone']||'';this[_0x661d('0x4')]=_0x44876f[_0x661d('0x4')]||'';this[_0x661d('0x5')]=_0x44876f['clientSecret']||'';this[_0x661d('0x6')]=_0x44876f[_0x661d('0x6')]||'';this[_0x661d('0x7')]=_0x44876f[_0x661d('0x7')]||'';this[_0x661d('0x8')]=_0x44876f[_0x661d('0x8')]||'';this[_0x661d('0x9')]=_0x44876f[_0x661d('0x9')]||{};}module[_0x661d('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 66cfba9..8139c0a 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 _0x896e=['Contact','phone','firstName','lastName','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','queue','membername','Agent','format','SIP/%s','calleridname'];(function(_0x9a3bdf,_0x155a5f){var _0x34bbda=function(_0xc5b451){while(--_0xc5b451){_0x9a3bdf['push'](_0x9a3bdf['shift']());}};_0x34bbda(++_0x155a5f);}(_0x896e,0x1e9));var _0xe896=function(_0x1575cc,_0x56f2f3){_0x1575cc=_0x1575cc-0x0;var _0x43689a=_0x896e[_0x1575cc];return _0x43689a;};'use strict';var util=require(_0xe896('0x0'));var _=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));function checkNameSurname(_0x229b59,_0x36085e,_0x26d296){var _0x2af995='';if(!_[_0xe896('0x3')](_0x36085e)&&_0xe896('0x4')===typeof _0x36085e){_0x2af995+=_0x36085e;}if(!_[_0xe896('0x3')](_0x26d296)&&_0xe896('0x4')===typeof _0x26d296){_0x2af995+='\x20'+_0x26d296;}if(_0x2af995!==''){return _0x2af995;}return _0x229b59;}function Action(_0x318a7b,_0x52ac80,_0x24c430,_0x7a0721,_0x3b902c){this[_0xe896('0x5')]=_0x24c430||undefined;this[_0xe896('0x6')]=_0x318a7b['id'];this['queue']=_0x52ac80[_0xe896('0x7')];this[_0xe896('0x8')]=_0x52ac80[_0xe896('0x8')];this['campaigntype']=_0xe896('0x9');this['dialAnswer']=![];this[_0xe896('0xa')]=_['isNil'](_0x318a7b[_0xe896('0xb')])?undefined:_0x318a7b[_0xe896('0xb')][_0xe896('0x7')];this['channelAgent']=this[_0xe896('0xa')]?util[_0xe896('0xc')](_0xe896('0xd'),this['membername']):_0x7a0721||undefined;this[_0xe896('0xe')]=checkNameSurname(_0x318a7b[_0xe896('0xf')][_0xe896('0x10')],_0x318a7b['Contact'][_0xe896('0x11')],_0x318a7b[_0xe896('0xf')][_0xe896('0x12')]);this['active']=_0x318a7b['active']||![];this[_0xe896('0x13')]=_0x318a7b[_0xe896('0x10')];this['scheduledat']=_0x318a7b['scheduledat'];this[_0xe896('0x14')]=_0x318a7b[_0xe896('0x14')]||0x0;this['countcongestionretry']=_0x318a7b[_0xe896('0x15')]||0x0;this['countnoanswerretry']=_0x318a7b[_0xe896('0x16')]||0x0;this[_0xe896('0x17')]=(_0x318a7b[_0xe896('0x14')]||0x0)+(_0x318a7b['countcongestionretry']||0x0)+(_0x318a7b[_0xe896('0x16')]||0x0)+(_0x318a7b[_0xe896('0x18')]||0x0)+(_0x318a7b[_0xe896('0x19')]||0x0)+(_0x318a7b[_0xe896('0x1a')]||0x0)+(_0x318a7b[_0xe896('0x1b')]||0x0)+(_0x318a7b[_0xe896('0x1c')]||0x0);this[_0xe896('0x18')]=_0x318a7b[_0xe896('0x18')]||0x0;this['countdropretry']=_0x318a7b[_0xe896('0x19')]||0x0;this['countabandonedretry']=_0x318a7b['countabandonedretry']||0x0;this[_0xe896('0x1b')]=_0x318a7b[_0xe896('0x1b')]||0x0;this[_0xe896('0x1c')]=_0x318a7b[_0xe896('0x1c')]||0x0;this['callback']=_0x318a7b[_0xe896('0x1d')];this['callbackuniqueid']=_0x318a7b['callbackuniqueid'];this[_0xe896('0x1e')]=_0x318a7b[_0xe896('0x1e')];this[_0xe896('0x1f')]=_0x318a7b[_0xe896('0x1f')];this[_0xe896('0x20')]=_0x318a7b[_0xe896('0x20')];this[_0xe896('0x21')]=_0x318a7b['ListId'];this[_0xe896('0x22')]=_[_0xe896('0x3')](_0x318a7b[_0xe896('0xb')])?_0x318a7b['UserId']:_0x318a7b[_0xe896('0xb')]['id'];this[_0xe896('0x23')]=_0x318a7b[_0xe896('0x23')];this[_0xe896('0x24')]='';this[_0xe896('0x25')]='';}Action[_0xe896('0x26')]['getCaller']=function(){return util[_0xe896('0xc')](_0xe896('0x27'),this[_0xe896('0xe')],this[_0xe896('0x28')]);};module[_0xe896('0x29')]=Action; \ No newline at end of file +var _0xfff0=['recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','uniqueid','queue','type','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','phone','Contact','firstName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0xfff0,0x139));var _0x0fff=function(_0x58785f,_0x1baaf0){_0x58785f=_0x58785f-0x0;var _0x48c14e=_0xfff0[_0x58785f];return _0x48c14e;};'use strict';var util=require('util');var _=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));function checkNameSurname(_0x148db8,_0x527213,_0x37165b){var _0x1f4065='';if(!_[_0x0fff('0x2')](_0x527213)&&'string'===typeof _0x527213){_0x1f4065+=_0x527213;}if(!_[_0x0fff('0x2')](_0x37165b)&&_0x0fff('0x3')===typeof _0x37165b){_0x1f4065+='\x20'+_0x37165b;}if(_0x1f4065!==''){return _0x1f4065;}return _0x148db8;}function Action(_0x53c517,_0x33c813,_0x4c2221,_0x2f1d2b,_0x586dc5){this[_0x0fff('0x4')]=_0x4c2221||undefined;this['idContact']=_0x53c517['id'];this[_0x0fff('0x5')]=_0x33c813['name'];this[_0x0fff('0x6')]=_0x33c813[_0x0fff('0x6')];this['campaigntype']=_0x0fff('0x5');this[_0x0fff('0x7')]=![];this[_0x0fff('0x8')]=_[_0x0fff('0x2')](_0x53c517[_0x0fff('0x9')])?undefined:_0x53c517[_0x0fff('0x9')][_0x0fff('0xa')];this[_0x0fff('0xb')]=this[_0x0fff('0x8')]?util[_0x0fff('0xc')](_0x0fff('0xd'),this['membername']):_0x2f1d2b||undefined;this[_0x0fff('0xe')]=checkNameSurname(_0x53c517['Contact'][_0x0fff('0xf')],_0x53c517[_0x0fff('0x10')][_0x0fff('0x11')],_0x53c517[_0x0fff('0x10')]['lastName']);this['active']=_0x53c517[_0x0fff('0x12')]||![];this['calleridnum']=_0x53c517['phone'];this['scheduledat']=_0x53c517[_0x0fff('0x13')];this[_0x0fff('0x14')]=_0x53c517['countbusyretry']||0x0;this[_0x0fff('0x15')]=_0x53c517[_0x0fff('0x15')]||0x0;this['countnoanswerretry']=_0x53c517['countnoanswerretry']||0x0;this['countglobal']=(_0x53c517[_0x0fff('0x14')]||0x0)+(_0x53c517[_0x0fff('0x15')]||0x0)+(_0x53c517[_0x0fff('0x16')]||0x0)+(_0x53c517[_0x0fff('0x17')]||0x0)+(_0x53c517[_0x0fff('0x18')]||0x0)+(_0x53c517[_0x0fff('0x19')]||0x0)+(_0x53c517['countmachineretry']||0x0)+(_0x53c517[_0x0fff('0x1a')]||0x0);this[_0x0fff('0x17')]=_0x53c517[_0x0fff('0x17')]||0x0;this['countdropretry']=_0x53c517['countdropretry']||0x0;this[_0x0fff('0x19')]=_0x53c517[_0x0fff('0x19')]||0x0;this[_0x0fff('0x1b')]=_0x53c517[_0x0fff('0x1b')]||0x0;this['countagentrejectretry']=_0x53c517[_0x0fff('0x1a')]||0x0;this[_0x0fff('0x1c')]=_0x53c517[_0x0fff('0x1c')];this[_0x0fff('0x1d')]=_0x53c517[_0x0fff('0x1d')];this[_0x0fff('0x1e')]=_0x53c517['callbackat'];this[_0x0fff('0x1f')]=_0x53c517[_0x0fff('0x1f')];this[_0x0fff('0x20')]=_0x53c517[_0x0fff('0x20')];this[_0x0fff('0x21')]=_0x53c517[_0x0fff('0x21')];this['UserId']=_[_0x0fff('0x2')](_0x53c517[_0x0fff('0x9')])?_0x53c517[_0x0fff('0x22')]:_0x53c517[_0x0fff('0x9')]['id'];this[_0x0fff('0x23')]=_0x53c517[_0x0fff('0x23')];this[_0x0fff('0x24')]='';this[_0x0fff('0x25')]='';}Action[_0x0fff('0x26')][_0x0fff('0x27')]=function(){return util[_0x0fff('0xc')](_0x0fff('0x28'),this['calleridname'],this[_0x0fff('0x29')]);};module[_0x0fff('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f763de9..fd26d9b 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 _0x2bd2=['VoiceQueueId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','getContactRecallMe','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','then','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','lookAgent','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','isActive','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','pTalking:\x20','[syncHangup][talking][cause]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/logger','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','voiceQueues','trunks','actions','agents','clockClearZombieChannels','hangup','syncHangup','bind','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','logger','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','outbound','clearZombieChannels','type','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','campaignsPreview','dialAnswer','pick','contactId','UserId'];(function(_0x6620b8,_0x8b3d5e){var _0x33de50=function(_0x2f1f07){while(--_0x2f1f07){_0x6620b8['push'](_0x6620b8['shift']());}};_0x33de50(++_0x8b3d5e);}(_0x2bd2,0xfa));var _0x22bd=function(_0x3ef489,_0x575485){_0x3ef489=_0x3ef489-0x0;var _0x40d3ad=_0x2bd2[_0x3ef489];return _0x40d3ad;};'use strict';var util=require(_0x22bd('0x0'));var _=require(_0x22bd('0x1'));var uuid=require('uuid');var moment=require(_0x22bd('0x2'));var Redis=require(_0x22bd('0x3'));var config=require('../../../config/environment');var logger=require(_0x22bd('0x4'))('preview');var loggerAction=require(_0x22bd('0x4'))('actionPreview');var ami=require(_0x22bd('0x5'));var rpcDb=require(_0x22bd('0x6'));var cmHopperAdditionalPhone=require(_0x22bd('0x7'));var Action=require(_0x22bd('0x8'));var ut=require(_0x22bd('0x9'));var utils=require(_0x22bd('0xa'));config[_0x22bd('0xb')]=_[_0x22bd('0xc')](config[_0x22bd('0xb')],{'host':_0x22bd('0xd'),'port':0x18eb});var io=require(_0x22bd('0xe'))(new Redis(config[_0x22bd('0xb')]));var Sequence=function(){};Sequence[_0x22bd('0xf')][_0x22bd('0x10')]=function(_0x566203){this[_0x22bd('0x11')]=this[_0x22bd('0x11')]?this[_0x22bd('0x11')]['finally'](_0x566203):_0x566203();};function Preview(_0x221335){this['sequence']=new Sequence();this['campaignsPreview']=_0x221335[_0x22bd('0x12')];this['trunks']=_0x221335[_0x22bd('0x13')];this[_0x22bd('0x14')]={};this[_0x22bd('0x15')]=_0x221335[_0x22bd('0x15')];this[_0x22bd('0x16')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x22bd('0x17'),this[_0x22bd('0x18')][_0x22bd('0x19')](this));ami['on'](_0x22bd('0x1a'),this['syncHangupRequest']['bind'](this));ami['on'](_0x22bd('0x1b'),this[_0x22bd('0x1c')][_0x22bd('0x19')](this));ami['on'](_0x22bd('0x1d'),this[_0x22bd('0x1e')][_0x22bd('0x19')](this));ami['on'](_0x22bd('0x1f'),this[_0x22bd('0x20')][_0x22bd('0x19')](this));ami['on'](_0x22bd('0x21'),this[_0x22bd('0x22')][_0x22bd('0x19')](this));ami['on']('blindtransfer',this[_0x22bd('0x23')][_0x22bd('0x19')](this));this[_0x22bd('0x24')](this['campaignsPreview']);}function emit(_0x2cbadb,_0x2d79b7,_0x41164f){io['to'](_0x2cbadb)[_0x22bd('0x25')](_0x2d79b7,_0x41164f);}function emitVoiceQueueChannelRemove(_0x1be5f6){logger[_0x22bd('0x26')](_0x22bd('0x27'),JSON[_0x22bd('0x28')](_0x1be5f6));emit(util[_0x22bd('0x29')](_0x22bd('0x2a'),_0x1be5f6[_0x22bd('0x2b')]),'voice_queue_channel:remove',_0x1be5f6);io[_0x22bd('0x25')](_0x22bd('0x2c'),_0x1be5f6);}function notSendMessagesQueue(_0x23bdb9){if(_0x23bdb9[_0x22bd('0x2d')]){if(_0x23bdb9[_0x22bd('0x2e')]===0x0&&_0x23bdb9[_0x22bd('0x2f')]===0x0){_0x23bdb9['sendMessageOneNotActive']=![];_0x23bdb9[_0x22bd('0x30')]=0x0;_0x23bdb9['paused']=0x0;_0x23bdb9[_0x22bd('0x31')]=utils[_0x22bd('0x32')][_0x22bd('0x33')];ut['logger'](_0x22bd('0x34'),_0x23bdb9[_0x22bd('0x2b')]+'\x20is\x20not\x20active');}else{_0x23bdb9[_0x22bd('0x31')]=utils[_0x22bd('0x32')][_0x22bd('0x35')];ut[_0x22bd('0x36')](_0x22bd('0x34'),_0x23bdb9[_0x22bd('0x2b')]+_0x22bd('0x37'));}}}Preview[_0x22bd('0xf')]['loopCampaigns']=function(){var _0x56df82=this;setInterval(function(){_0x56df82[_0x22bd('0x38')]();},0x7cf);};Preview[_0x22bd('0xf')][_0x22bd('0x38')]=function(){var _0x4545cb=this['campaignsPreview'];this[_0x22bd('0x16')]+=0x1;for(var _0x4907e2 in _0x4545cb){if(_0x4545cb[_0x22bd('0x39')](_0x4907e2)&&(_0x4545cb[_0x4907e2][_0x22bd('0x3a')]===_0x22bd('0x3b')||_0x4545cb[_0x4907e2][_0x22bd('0x3a')]===_0x22bd('0x3c'))&&_0x4545cb[_0x4907e2]['type']===_0x22bd('0x3d')){if(this['clockClearZombieChannels']>0x7){this[_0x22bd('0x16')]=0x0;this[_0x22bd('0x3e')]();}}if(_0x4545cb[_0x22bd('0x39')](_0x4907e2)&&_0x4545cb[_0x4907e2]['dialMethod']===_0x22bd('0x3b')&&_0x4545cb[_0x4907e2][_0x22bd('0x3f')]===_0x22bd('0x3d')){if(_0x4545cb[_0x4907e2]['dialActive']){this['setMessage'](_0x4545cb[_0x4907e2]);if(_0x4545cb[_0x4907e2][_0x22bd('0x40')])this[_0x22bd('0x41')](_0x4545cb[_0x4907e2]);}else{notSendMessagesQueue(_0x4545cb[_0x4907e2]);}}}};Preview[_0x22bd('0xf')][_0x22bd('0x42')]=function(_0x3cc60b){var _0x31bd58=this;this['sequence'][_0x22bd('0x10')](function(){if(!_[_0x22bd('0x43')](_0x31bd58['actions'][_0x3cc60b])){loggerAction[_0x22bd('0x26')](_0x22bd('0x44'),_0x3cc60b,_0x22bd('0x45'),_0x31bd58[_0x22bd('0x14')][_0x3cc60b][_0x22bd('0x46')],'originated:\x20',JSON[_0x22bd('0x28')](_0x31bd58['campaignsPreview'][_0x31bd58[_0x22bd('0x14')][_0x3cc60b]['queue']][_0x22bd('0x2e')]),'pTalking:\x20',JSON['stringify'](_0x31bd58[_0x22bd('0x47')][_0x31bd58['actions'][_0x3cc60b][_0x22bd('0x46')]][_0x22bd('0x2f')]),JSON[_0x22bd('0x28')](_0x31bd58[_0x22bd('0x14')][_0x3cc60b][_0x22bd('0x48')]),JSON['stringify'](_[_0x22bd('0x49')](_0x31bd58[_0x22bd('0x14')][_0x3cc60b],[_0x22bd('0x4a'),_0x22bd('0x4b'),_0x22bd('0x4c'),'ListId'])));return ami[_0x22bd('0x4d')]({'action':'status','channel':_0x31bd58[_0x22bd('0x14')][_0x3cc60b][_0x22bd('0x4e')]})[_0x22bd('0x4f')](function(_0xd878ac){if(_0xd878ac[_0x22bd('0x31')]===_0x22bd('0x50')){setTimeout(function(){if(_0x31bd58['actions'][_0x3cc60b]){ut[_0x22bd('0x51')](_0x31bd58[_0x22bd('0x47')][_0x31bd58[_0x22bd('0x14')][_0x3cc60b][_0x22bd('0x46')]],_0x22bd('0x52'));if(_0x31bd58[_0x22bd('0x14')][_0x3cc60b][_0x22bd('0x48')]===!![]){ut[_0x22bd('0x53')](_0x31bd58[_0x22bd('0x47')][_0x31bd58[_0x22bd('0x14')][_0x3cc60b]['queue']],_0x22bd('0x52'));ut[_0x22bd('0x54')](_0x22bd('0x55')+_0x3cc60b,_0x31bd58[_0x22bd('0x14')][_0x3cc60b][_0x22bd('0x46')]);}ut[_0x22bd('0x54')]('[Dialer][checkChannel][Preview]'+_0x3cc60b,_0x31bd58['actions'][_0x3cc60b][_0x22bd('0x46')]);delete _0x31bd58[_0x22bd('0x14')][_0x3cc60b];}},0x2328);}});}});};Preview[_0x22bd('0xf')][_0x22bd('0x3e')]=function(){var _0x1ac957=this;loggerAction[_0x22bd('0x26')]('[action]',_[_0x22bd('0x56')](this[_0x22bd('0x14')]));for(var _0x1e7056 in this[_0x22bd('0x14')]){if(_0x1ac957[_0x22bd('0x14')][_0x22bd('0x39')](_0x1e7056)){_0x1ac957['clearZombieChannel'](_0x1e7056);}}};Preview[_0x22bd('0xf')][_0x22bd('0x41')]=function(_0x232e2b){var _0x792232=this;rpcDb[_0x22bd('0x57')](_0x232e2b['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x31ca5a){if(!_[_0x22bd('0x43')](_0x31ca5a)){for(var _0x12d3cf=0x0;_0x12d3cf<_0x31ca5a[_0x22bd('0x58')];_0x12d3cf+=0x1){if(ut['getDiff'](_0x31ca5a[_0x12d3cf][_0x22bd('0x59')])<_0x232e2b[_0x22bd('0x5a')]*0x3c){if(_0x31ca5a[_0x12d3cf][_0x22bd('0x5b')]&&!_0x31ca5a[_0x12d3cf][_0x22bd('0x5b')][_0x22bd('0x5c')]){_0x792232[_0x22bd('0x5d')](_0x31ca5a[_0x12d3cf]['id'])['then'](ut[_0x22bd('0x5e')]('[RecallMe]'))[_0x22bd('0x4f')](ut[_0x22bd('0x5e')](_0x22bd('0x5f')));}else{rpcDb[_0x22bd('0x60')](_0x31ca5a[_0x12d3cf]['id']);}}else{var _0x572c3f=new Action(_0x31ca5a[_0x12d3cf],_0x232e2b);_0x572c3f[_0x22bd('0x61')]=moment()[_0x22bd('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x232e2b[_0x22bd('0x62')]+=0x1;ut['logCustomer'](_0x572c3f,0x17,_0x22bd('0x63'));if(_0x232e2b[_0x22bd('0x64')]){rpcDb[_0x22bd('0x65')](ut['createBody'](_0x31ca5a[_0x12d3cf]));rpcDb['createCustomerHistory'](_0x572c3f,_0x22bd('0x66'));}else{ut[_0x22bd('0x67')](_0x572c3f,0x16,_0x22bd('0x68'));rpcDb[_0x22bd('0x69')](_0x572c3f,_0x22bd('0x6a'));rpcDb[_0x22bd('0x6b')](_0x572c3f,_0x22bd('0x6a'));}}}}})['catch'](ut['logger2'](_0x22bd('0x6c')));};Preview[_0x22bd('0xf')][_0x22bd('0x6d')]=function(_0x4a273d){_0x4a273d[_0x22bd('0x2d')]=!![];if(ut[_0x22bd('0x6e')](_0x4a273d['loggedIn'])){_0x4a273d[_0x22bd('0x31')]=utils[_0x22bd('0x32')][_0x22bd('0x6f')];}else if(!ut['isActive'](_0x4a273d['dialActive'])){_0x4a273d[_0x22bd('0x31')]=utils[_0x22bd('0x32')][_0x22bd('0x33')];}else if(!this[_0x22bd('0x70')](_0x4a273d['Trunk'])){if(!this['isTrunkReachable'](_0x4a273d[_0x22bd('0x71')])){_0x4a273d[_0x22bd('0x31')]=utils[_0x22bd('0x32')][_0x22bd('0x72')];}else{_0x4a273d[_0x22bd('0x31')]=utils['CAMPAIGN_STATUS'][_0x22bd('0x73')];}}else{_0x4a273d[_0x22bd('0x31')]=utils['CAMPAIGN_STATUS'][_0x22bd('0x73')];}};Preview[_0x22bd('0xf')][_0x22bd('0x74')]=function(_0x539906,_0x1c6932,_0x367009){var _0x6d4cec=this;var _0x187113=this[_0x22bd('0x14')][_0x1c6932];var _0x386217=this[_0x22bd('0x47')][_0x187113[_0x22bd('0x46')]];var _0x290966;var _0x5bca3a=![];var _0x1d6861=0x2;var _0x1e3237=0x3;if(_0x386217){switch(_0x367009){case'1':_0x386217[_0x22bd('0x75')]+=0x1;_0x187113[_0x22bd('0x76')]+=0x1;_0x187113[_0x22bd('0x77')]=ut[_0x22bd('0x78')](_0x187113);ut[_0x22bd('0x67')](_0x187113,0x0,_0x22bd('0x79'));ami[_0x22bd('0x25')](_0x22bd('0x7a'),ut[_0x22bd('0x7b')](_0x187113,_0x22bd('0x7c')));rpcDb[_0x22bd('0x69')](_0x187113,_0x22bd('0x7d'));_0x6d4cec[_0x22bd('0x7e')](_0x187113,'0',_0x386217)[_0x22bd('0x7f')](function(_0x5cbdf5){_0x5bca3a=_0x5cbdf5[_0x22bd('0x80')]==0x1;_0x1d6861=_0x386217[_0x22bd('0x81')];_0x1e3237=_0x386217[_0x22bd('0x82')];if(!_0x5bca3a){if(ut[_0x22bd('0x78')](_0x187113)>=_0x386217[_0x22bd('0x83')]){_0x290966=ut[_0x22bd('0x84')](_0x187113,0xf,'Global');rpcDb[_0x22bd('0x6b')](_0x290966,_0x22bd('0x85'));}else{if(_0x187113[_0x22bd('0x76')]>=_0x386217[_0x22bd('0x86')]){rpcDb[_0x22bd('0x6b')](_0x187113,_0x22bd('0x85'));}else{rpcDb['rescheduleContact'](ut[_0x22bd('0x87')](_0x187113,_0x22bd('0x76'),_0x386217['dialNoSuchNumberRetryFrequency']),_0x187113[_0x22bd('0x88')],_0x187113['activeContact']);}}delete this[_0x22bd('0x14')][_0x539906[_0x22bd('0x89')]];}else{_0x187113[_0x22bd('0x76')]++;logger['info'](_0x22bd('0x8a'),_0x187113[_0x22bd('0x76')]);logger[_0x22bd('0x26')]('id',_0x187113[_0x22bd('0x8b')]);_0x6d4cec[_0x22bd('0x8c')]({'id':_0x187113[_0x22bd('0x8b')],'field':{'countnosuchnumberretry':_0x187113[_0x22bd('0x76')]}})[_0x22bd('0x7f')](function(){_0x6d4cec[_0x22bd('0x8d')](_0x187113,_0x1d6861,_0x1e3237)['then'](function(){});});}});break;case'ANSWER':var _0x1e0932=moment()['format'](_0x22bd('0x8e'));_0x187113[_0x22bd('0x8f')]=_0x1e0932;_0x187113['answertime']=_0x1e0932;_0x187113['dialAnswer']=!![];_0x386217[_0x22bd('0x2f')]+=0x1;logger['info'](_0x22bd('0x90'),_0x187113[_0x22bd('0x91')],_0x22bd('0x92'),_0x386217[_0x22bd('0x2b')],'pTalking:\x20',_0x386217[_0x22bd('0x2f')]);ami[_0x22bd('0x25')](_0x22bd('0x93'),ut['buildObj'](_0x187113,_0x22bd('0x94'),this[_0x22bd('0x47')][_0x187113[_0x22bd('0x46')]]));if(_0x386217[_0x22bd('0x95')]){ami[_0x22bd('0x25')](_0x22bd('0x96'),ut[_0x22bd('0x97')](_0x187113));}break;case'16':ami[_0x22bd('0x25')](_0x22bd('0x98'),ut['buildObj'](_0x187113,_0x22bd('0x99'),this[_0x22bd('0x47')][_0x187113[_0x22bd('0x46')]]));emitVoiceQueueChannelRemove(ut[_0x22bd('0x7b')](_0x187113,_0x22bd('0x99')));_0x386217[_0x22bd('0x9a')]+=0x1;_0x386217[_0x22bd('0x9b')]+=0x1;_0x386217[_0x22bd('0x9c')]+=0x1;ut[_0x22bd('0x53')](_0x386217,_0x22bd('0x9d'));_0x187113[_0x22bd('0x77')]=ut[_0x22bd('0x78')](_0x187113);ut[_0x22bd('0x67')](_0x187113,0x4,'Answer');rpcDb[_0x22bd('0x69')](_0x187113,_0x22bd('0x9e'));rpcDb['createCustomerFinal'](_0x187113,_0x22bd('0x9f'));rpcDb['crateCustomerReportQueue'](_0x187113);_0x386217[_0x22bd('0xa0')]+=_0x187113['talktime'];_0x386217['sumBillable']+=_0x187113[_0x22bd('0xa1')];logger[_0x22bd('0x26')](_0x22bd('0xa2'),_0x187113[_0x22bd('0x91')],'\x20Queue',_0x386217[_0x22bd('0x2b')],'pTalking:\x20',_0x386217['pTalking']);delete this['actions'][_0x539906[_0x22bd('0x89')]];break;case _0x22bd('0xa3'):_0x386217['outboundBusyCallsDay']+=0x1;_0x187113[_0x22bd('0xa4')]+=0x1;_0x187113[_0x22bd('0x77')]=ut[_0x22bd('0x78')](_0x187113);ut[_0x22bd('0x67')](_0x187113,0x5,_0x22bd('0xa5'));_0x1d6861=_0x386217[_0x22bd('0xa6')];_0x1e3237=_0x386217[_0x22bd('0x82')];ami[_0x22bd('0x25')]('custom:agentbusy',ut['buildObj'](_0x187113,_0x22bd('0xa7')));rpcDb[_0x22bd('0x69')](_0x187113,_0x22bd('0xa8'));_0x6d4cec[_0x22bd('0x7e')](_0x187113,'5',_0x386217)[_0x22bd('0x7f')](function(_0xb90b8e){_0x5bca3a=_0xb90b8e[_0x22bd('0x80')]==0x1;if(!_0x5bca3a){if(ut['totalGlobal'](_0x187113)>=_0x386217[_0x22bd('0x83')]){_0x290966=ut[_0x22bd('0x84')](_0x187113,0xf,'Global');rpcDb[_0x22bd('0x6b')](_0x290966,_0x22bd('0xa9'));}else{if(_0x187113['countbusyretry']>=_0x386217[_0x22bd('0xaa')]){rpcDb[_0x22bd('0x6b')](_0x187113,_0x22bd('0xa8'));}else{rpcDb[_0x22bd('0xab')](ut[_0x22bd('0x87')](_0x187113,'countbusyretry',_0x386217[_0x22bd('0xa6')]),_0x187113[_0x22bd('0x88')],_0x187113[_0x22bd('0xac')]);}}}else{_0x187113[_0x22bd('0xa4')]++;_0x6d4cec[_0x22bd('0x8c')]({'id':_0x187113[_0x22bd('0x8b')],'field':{'countbusyretry':_0x187113[_0x22bd('0xa4')]}})[_0x22bd('0x7f')](function(){_0x6d4cec[_0x22bd('0x8d')](_0x187113,_0x1d6861,_0x1e3237)[_0x22bd('0x7f')](function(){});});}});break;case _0x22bd('0xad'):_0x386217[_0x22bd('0xae')]+=0x1;_0x187113[_0x22bd('0xaf')]+=0x1;_0x187113[_0x22bd('0x77')]=ut[_0x22bd('0x78')](_0x187113);ut['logCustomer'](_0x187113,0x3,_0x22bd('0xb0'));_0x1d6861=_0x386217[_0x22bd('0xb1')];_0x1e3237=_0x386217[_0x22bd('0x82')];var _0x4aedac=ut[_0x22bd('0xb2')](_0x187113,_0x386217);ami[_0x22bd('0x25')]('custom:agentnoanswer',_0x4aedac);rpcDb[_0x22bd('0x69')](_0x187113,_0x22bd('0xb3'));_0x6d4cec[_0x22bd('0x7e')](_0x187113,'3',_0x386217)[_0x22bd('0x7f')](function(_0x14f18f){_0x5bca3a=_0x14f18f[_0x22bd('0x80')]==0x1;if(!_0x5bca3a){if(ut['totalGlobal'](_0x187113)>=_0x386217['dialGlobalMaxRetry']){_0x290966=ut[_0x22bd('0x84')](_0x187113,0xf,_0x22bd('0xb4'));rpcDb[_0x22bd('0x6b')](_0x290966,_0x22bd('0xb5'));}else{if(_0x187113['countnoanswerretry']>=_0x386217['dialNoAnswerMaxRetry']){rpcDb[_0x22bd('0x6b')](_0x187113,_0x22bd('0xb3'));}else{rpcDb['rescheduleContact'](ut[_0x22bd('0x87')](_0x187113,_0x22bd('0xaf'),_0x386217[_0x22bd('0xb1')]),_0x187113[_0x22bd('0x88')],_0x187113[_0x22bd('0xac')]);}}}else{_0x187113[_0x22bd('0xaf')]++;_0x6d4cec[_0x22bd('0x8c')]({'id':_0x187113[_0x22bd('0x8b')],'field':{'countnoanswerretry':_0x187113[_0x22bd('0xaf')]}})[_0x22bd('0x7f')](function(){_0x6d4cec['swapAdditionalPhones'](_0x187113,_0x1d6861,_0x1e3237)['then'](function(){});});}});break;case _0x22bd('0xb6'):_0x386217[_0x22bd('0xb7')]+=0x1;_0x187113[_0x22bd('0xb8')]+=0x1;_0x187113[_0x22bd('0x77')]=ut[_0x22bd('0x78')](_0x187113);ut['logCustomer'](_0x187113,0x8,_0x22bd('0xb9'));_0x1d6861=_0x386217[_0x22bd('0xba')];_0x1e3237=_0x386217[_0x22bd('0x82')];ami[_0x22bd('0x25')]('custom:agentcongestion',ut[_0x22bd('0x7b')](_0x187113,_0x22bd('0xbb')));rpcDb[_0x22bd('0x69')](_0x187113,_0x22bd('0xbc'));_0x6d4cec['verifyAdditionalPhones'](_0x187113,'8',_0x386217)[_0x22bd('0x7f')](function(_0x1a562c){_0x5bca3a=_0x1a562c[_0x22bd('0x80')]==0x1;if(!_0x5bca3a){if(ut[_0x22bd('0x78')](_0x187113)>=_0x386217['dialGlobalMaxRetry']){_0x290966=ut[_0x22bd('0x84')](_0x187113,0xf,_0x22bd('0xb4'));rpcDb[_0x22bd('0x6b')](_0x290966,_0x22bd('0xbd'));}else{if(_0x187113['countcongestionretry']>=_0x386217[_0x22bd('0xbe')]){rpcDb[_0x22bd('0x6b')](_0x187113,_0x22bd('0xbc'));}else{rpcDb[_0x22bd('0xab')](ut[_0x22bd('0x87')](_0x187113,_0x22bd('0xb8'),_0x386217[_0x22bd('0xa6')]),_0x187113[_0x22bd('0x88')],_0x187113[_0x22bd('0xac')]);}}}else{_0x187113[_0x22bd('0xb8')]++;_0x6d4cec[_0x22bd('0x8c')]({'id':_0x187113[_0x22bd('0x8b')],'field':{'countcongestionretry':_0x187113[_0x22bd('0xb8')]}})[_0x22bd('0x7f')](function(){_0x6d4cec[_0x22bd('0x8d')](_0x187113,_0x1d6861,_0x1e3237)[_0x22bd('0x7f')](function(){});});}});break;case'CANCEL':_0x386217[_0x22bd('0xbf')]+=0x1;_0x187113[_0x22bd('0xc0')]+=0x1;_0x187113[_0x22bd('0x77')]=ut['totalGlobal'](_0x187113);ut['logCustomer'](_0x187113,0x14,_0x22bd('0xc1'));_0x1d6861=_0x386217[_0x22bd('0xc2')];_0x1e3237=_0x386217[_0x22bd('0x82')];ami['emit']('custom:agentreject',ut[_0x22bd('0x7b')](_0x187113,_0x22bd('0xc3')));rpcDb[_0x22bd('0x69')](_0x187113,'[syncHangupRequest][logAgentReject]');_0x6d4cec[_0x22bd('0x7e')](_0x187113,'20',_0x386217)[_0x22bd('0x7f')](function(_0x28c710){_0x5bca3a=_0x28c710[_0x22bd('0x80')]==0x1;if(!_0x5bca3a){if(ut[_0x22bd('0x78')](_0x187113)>=_0x386217[_0x22bd('0x83')]){_0x290966=ut[_0x22bd('0x84')](_0x187113,0x14,_0x22bd('0xc1'));rpcDb[_0x22bd('0x6b')](_0x290966,_0x22bd('0xc4'));}else{if(_0x187113[_0x22bd('0xc0')]>=_0x386217[_0x22bd('0xc5')]){rpcDb['createCustomerFinal'](_0x187113,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x22bd('0xab')](ut[_0x22bd('0x87')](_0x187113,'countagentrejectretry',_0x386217['dialAgentRejectRetryFrequency']),_0x187113[_0x22bd('0x88')],_0x187113[_0x22bd('0xac')]);}}}else{_0x187113['countnoanswerretry']++;_0x6d4cec[_0x22bd('0x8c')]({'id':_0x187113[_0x22bd('0x8b')],'field':{'countnoanswerretry':_0x187113[_0x22bd('0xaf')]}})[_0x22bd('0x7f')](function(){_0x6d4cec[_0x22bd('0x8d')](_0x187113,_0x1d6861,_0x1e3237)[_0x22bd('0x7f')](function(){});});}});break;case _0x22bd('0xc6'):_0x386217[_0x22bd('0xc7')]+=0x1;_0x187113['countabandonedretry']+=0x1;_0x187113[_0x22bd('0x77')]=ut['totalGlobal'](_0x187113);ut[_0x22bd('0x67')](_0x187113,0xb,_0x22bd('0xc8'));rpcDb[_0x22bd('0x69')](_0x187113,_0x22bd('0xc9'));_0x6d4cec[_0x22bd('0x7e')](_0x187113,'11',_0x386217)[_0x22bd('0x7f')](function(_0x4a4bb5){_0x5bca3a=_0x4a4bb5[_0x22bd('0x80')]==0x1;if(!_0x5bca3a){if(ut['totalGlobal'](_0x187113)>=_0x386217['dialGlobalMaxRetry']){_0x290966=ut[_0x22bd('0x84')](_0x187113,0xf,'Global');rpcDb[_0x22bd('0x6b')](_0x290966,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x187113['countabandonedetry']>=_0x386217[_0x22bd('0xca')]){rpcDb['createCustomerFinal'](_0x187113,_0x22bd('0xc9'));}else{rpcDb[_0x22bd('0xab')](ut[_0x22bd('0x87')](_0x187113,_0x22bd('0xcb'),_0x386217[_0x22bd('0xcc')]),_0x187113['unlockAgent'],_0x187113['activeContact']);}}}else{_0x187113[_0x22bd('0xaf')]++;_0x6d4cec[_0x22bd('0x8c')]({'id':_0x187113[_0x22bd('0x8b')],'field':{'countnoanswerretry':_0x187113[_0x22bd('0xaf')]}})[_0x22bd('0x7f')](function(){_0x6d4cec[_0x22bd('0x8d')](_0x187113,_0x1d6861,_0x1e3237)['then'](function(){});});}});break;case'18':_0x386217[_0x22bd('0xcd')]+=0x1;_0x187113[_0x22bd('0xce')]+=0x1;_0x187113[_0x22bd('0x77')]=ut[_0x22bd('0x78')](_0x187113);ut['logCustomer'](_0x187113,0x12,_0x539906[_0x22bd('0xcf')]||_0x539906['dialstatus']);ami['emit'](_0x22bd('0xd0'),ut[_0x22bd('0x7b')](_0x187113,_0x22bd('0xd1')));rpcDb[_0x22bd('0x69')](_0x187113,_0x22bd('0xd2'));_0x6d4cec[_0x22bd('0x7e')](_0x187113,'18',_0x386217)['then'](function(_0x32297e){_0x5bca3a=_0x32297e[_0x22bd('0x80')]==0x1;if(!_0x5bca3a){if(ut[_0x22bd('0x78')](_0x187113)>=_0x386217['dialGlobalMaxRetry']){_0x290966=ut[_0x22bd('0x84')](_0x187113,0x12,'Global');rpcDb[_0x22bd('0x6b')](_0x290966,_0x22bd('0xd2'));}else{rpcDb[_0x22bd('0x6b')](_0x187113,_0x22bd('0xd2'));}}else{_0x187113[_0x22bd('0xaf')]++;_0x6d4cec[_0x22bd('0x8c')]({'id':_0x187113[_0x22bd('0x8b')],'field':{'countnoanswerretry':_0x187113[_0x22bd('0xaf')]}})['then'](function(){_0x6d4cec['swapAdditionalPhones'](_0x187113,_0x1d6861,_0x1e3237)[_0x22bd('0x7f')](function(){});});}});delete this[_0x22bd('0x14')][_0x539906[_0x22bd('0x89')]];break;case'19':_0x386217[_0x22bd('0xcd')]+=0x1;_0x187113[_0x22bd('0x77')]=ut[_0x22bd('0x78')](_0x187113);ut[_0x22bd('0x67')](_0x187113,0x13,_0x539906[_0x22bd('0xcf')]||_0x539906[_0x22bd('0xd3')]);ami['emit']('custom:amd',ut['buildObj'](_0x187113,'amd'));rpcDb[_0x22bd('0x69')](_0x187113,_0x22bd('0xd4'));_0x6d4cec[_0x22bd('0x7e')](_0x187113,'18',_0x386217)[_0x22bd('0x7f')](function(_0x1d40fd){_0x5bca3a=_0x1d40fd[_0x22bd('0x80')]==0x1;if(!_0x5bca3a){if(ut['totalGlobal'](_0x187113)>=_0x386217[_0x22bd('0x83')]){_0x290966=ut[_0x22bd('0x84')](_0x187113,0xf,'Global');rpcDb[_0x22bd('0x6b')](_0x290966,_0x22bd('0xd4'));}else{rpcDb['createCustomerFinal'](_0x187113,_0x22bd('0xd4'));}}else{_0x187113['countnoanswerretry']++;_0x6d4cec[_0x22bd('0x8c')]({'id':_0x187113['idContact'],'field':{'countnoanswerretry':_0x187113[_0x22bd('0xaf')]}})[_0x22bd('0x7f')](function(){_0x6d4cec[_0x22bd('0x8d')](_0x187113,_0x1d6861,_0x1e3237)[_0x22bd('0x7f')](function(){});});}});delete this[_0x22bd('0x14')][_0x539906['linkedid']];break;default:if(_0x187113[_0x22bd('0x48')]){ut[_0x22bd('0x53')](_0x386217,_0x22bd('0xd5'));ut['loggerError'](_0x22bd('0xd6')+_0x386217[_0x22bd('0x2b')],_0x539906);}_0x386217[_0x22bd('0xcd')]+=0x1;_0x187113[_0x22bd('0x77')]=ut['totalGlobal'](_0x187113);ut[_0x22bd('0x67')](_0x187113,0xc,_0x539906[_0x22bd('0xcf')]||_0x539906[_0x22bd('0xd3')]);_0x1d6861=_0x386217[_0x22bd('0xc2')];_0x1e3237=_0x386217[_0x22bd('0x82')];rpcDb[_0x22bd('0x69')](_0x187113,_0x22bd('0xd7'));_0x6d4cec['verifyAdditionalPhones'](_0x187113,'20',_0x386217)[_0x22bd('0x7f')](function(_0x468459){_0x5bca3a=_0x468459['additional']==0x1;if(!_0x5bca3a){if(ut[_0x22bd('0x78')](_0x187113)>=_0x386217[_0x22bd('0x83')]){_0x290966=ut[_0x22bd('0x84')](_0x187113,0xf,_0x22bd('0xb4'));rpcDb['createCustomerFinal'](_0x290966,_0x22bd('0xd8'));}else{rpcDb['createCustomerFinal'](_0x187113,_0x22bd('0xd8'));}delete this[_0x22bd('0x14')][_0x539906[_0x22bd('0x89')]];}else{_0x6d4cec[_0x22bd('0x8d')](_0x187113,_0x1d6861,_0x1e3237)[_0x22bd('0x7f')](function(){});}});}if(!(_0x187113[_0x22bd('0x48')]&&_0x367009==='16')){ut['updateOriginated'](_0x386217,_0x22bd('0xd9'));logger[_0x22bd('0x26')]('[originated][decrement][callProgressDetectingCustomer]',_0x187113[_0x22bd('0x91')],_0x22bd('0x92'),_0x386217[_0x22bd('0x2b')],_0x22bd('0xda'),_0x386217[_0x22bd('0x2e')]);}if(_0x367009!==_0x22bd('0xdb')){delete this['actions'][_0x539906[_0x22bd('0x89')]];delete this['actions'][_0x539906[_0x22bd('0xdc')]];}_0x386217[_0x22bd('0xdd')]=!![];}};Preview[_0x22bd('0xf')]['callProgressDetectingAgent']=function(_0xfe10c7,_0x55f553,_0x5ed636){if(_[_0x22bd('0xde')](_0x55f553)&&_0x22bd('0xdf')!==typeof _0x55f553){return;}if(_['isUndefined'](_0x5ed636)&&_0x22bd('0xdf')!==typeof _0x5ed636){return;}switch(_0x5ed636[_0x22bd('0xe0')]){case'0':ut[_0x22bd('0xe1')](_0xfe10c7,0x0,_0x22bd('0x79'));rpcDb['createAgentHistory'](_0xfe10c7,_0x22bd('0xe2'));break;case'3':ut[_0x22bd('0xe1')](_0xfe10c7,0x3,_0x22bd('0xb0'));rpcDb[_0x22bd('0xe3')](_0xfe10c7,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0xfe10c7,0x5,_0x22bd('0xa5'));rpcDb[_0x22bd('0xe3')](_0xfe10c7,_0x22bd('0xe4'));break;case'8':ut['logAgent'](_0xfe10c7,0x8,_0x22bd('0xb9'));rpcDb[_0x22bd('0xe3')](_0xfe10c7,_0x22bd('0xe5'));break;case'22':ut[_0x22bd('0xe1')](_0xfe10c7,0x16,'AnswerAGI');rpcDb[_0x22bd('0xe3')](_0xfe10c7,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x22bd('0xe1')](_0xfe10c7,0xc,_0x5ed636[_0x22bd('0xe0')]);rpcDb[_0x22bd('0xe3')](_0xfe10c7,_0x22bd('0xe5'));}ut[_0x22bd('0x51')](_0x55f553,_0x22bd('0xe6'));logger[_0x22bd('0x26')](_0x22bd('0xe7'),_0xfe10c7[_0x22bd('0x91')],_0x22bd('0x92'),_0x55f553[_0x22bd('0x2b')],_0x22bd('0xda'),_0x55f553['originated']);delete this[_0x22bd('0x14')][_0xfe10c7[_0x22bd('0x91')]];};Preview['prototype'][_0x22bd('0x7e')]=function(_0x5f1c83,_0x39bffe,_0x495d94){return cmHopperAdditionalPhone[_0x22bd('0x7e')](_0x5f1c83,_0x39bffe,_0x495d94)[_0x22bd('0x4f')](logger['info'](_0x22bd('0xe8')));};Preview[_0x22bd('0xf')][_0x22bd('0x8d')]=function(_0x49f055,_0x23df00,_0x50ad25){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x49f055,_0x23df00,_0x50ad25)['catch'](logger[_0x22bd('0x26')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0x22bd('0x8c')]=function(_0x4b7128){return Promise['resolve']()[_0x22bd('0x7f')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x4b7128))[_0x22bd('0x4f')](logger[_0x22bd('0x26')](_0x22bd('0xe9')));};Preview[_0x22bd('0xf')][_0x22bd('0xea')]=function(_0x5349e0,_0x5b23e8,_0x5b1689,_0x367b0c,_0x286e99){var _0x852564=this;return new Promise(function(_0x7e5aa9,_0x4b7b2d){if(_['isNil'](_0x5b23e8)||_[_0x22bd('0x43')](_0x5b23e8['Contact'])||_[_0x22bd('0x43')](_0x5b23e8['phone'])||_[_0x22bd('0x43')](_0x5b23e8['VoiceQueueId'])){_0x4b7b2d(ut[_0x22bd('0x31')]('Contact\x20is\x20undefined',_0x367b0c,_0x286e99));return;}var _0x366e3a=uuid['v4']();var _0x277ef0=_0x852564[_0x22bd('0x47')][_0x5b23e8[_0x22bd('0x45')]['name']];var _0xba0729=_0x5b1689?_0x852564[_0x22bd('0x15')][_0x5b1689]['id']:undefined;_0x852564[_0x22bd('0x14')][_0x366e3a]=new Action(_0x5b23e8,_0x277ef0,_0x366e3a,_0x5b1689,_0xba0729);var _0x1c6988=_0x852564['actions'][_0x366e3a];_0x1c6988[_0x22bd('0x88')]=_0x367b0c;_0x1c6988[_0x22bd('0xac')]=_0x286e99;_0x1c6988[_0x22bd('0xeb')]=_0x5b1689;if(_['isEmpty'](_0x5349e0)){_0x852564['execCall'](_0x1c6988,_0x277ef0,_0x5b23e8,_0x5b1689)['then'](function(_0x392f8e){logger['info'](_0x22bd('0xec'),_0x22bd('0xed')+_0x1c6988[_0x22bd('0x46')]+_0x22bd('0xee')+_0x1c6988[_0x22bd('0x8b')],JSON[_0x22bd('0x28')](_0x392f8e));ami['emit'](_0x22bd('0xef'),ut[_0x22bd('0x7b')](_0x1c6988,'called',_0x852564[_0x22bd('0x47')][_0x1c6988['queue']]));_0x7e5aa9(ut['message']('Calling'));})['catch'](function(_0x343636){ut[_0x22bd('0x36')](_0x22bd('0xf0'),_0x343636);_0x4b7b2d(ut[_0x22bd('0x31')](_0x22bd('0xf1'),_0x367b0c,_0x286e99));});}else{_0x277ef0[_0x22bd('0xf2')]+=0x1;ut[_0x22bd('0xf3')](_0x1c6988);rpcDb[_0x22bd('0xf4')](_0x1c6988,_0x22bd('0xf5'));delete _0x852564[_0x22bd('0x14')][_0x366e3a];_0x4b7b2d(ut[_0x22bd('0x31')](_0x22bd('0xf6'),_0x367b0c,_0x286e99));}});};Preview[_0x22bd('0xf')][_0x22bd('0x70')]=function(_0x4407f3){return!_[_0x22bd('0x43')](_0x4407f3)&&!_[_0x22bd('0x43')](_0x4407f3[_0x22bd('0x2b')])&&!_[_0x22bd('0x43')](_0x4407f3['active'])&&_0x4407f3[_0x22bd('0xf7')]&&!_[_0x22bd('0x43')](this[_0x22bd('0x13')][util[_0x22bd('0x29')](_0x22bd('0xf8'),_0x4407f3['name'])])&&!_[_0x22bd('0x43')](this['trunks'][util[_0x22bd('0x29')]('SIP/%s',_0x4407f3[_0x22bd('0x2b')])][_0x22bd('0xf9')])&&(this['trunks'][util[_0x22bd('0x29')](_0x22bd('0xf8'),_0x4407f3['name'])][_0x22bd('0xf9')]===_0x22bd('0xfa')||this[_0x22bd('0x13')][util[_0x22bd('0x29')](_0x22bd('0xf8'),_0x4407f3[_0x22bd('0x2b')])]['status']==='unmonitored');};Preview[_0x22bd('0xf')][_0x22bd('0x5d')]=function(_0x3c95c7,_0x325997){return this[_0x22bd('0xfb')](_0x3c95c7,_0x325997)[_0x22bd('0x7f')](function(_0x401765){return _['pick'](_0x401765,[_0x22bd('0x31')]);})[_0x22bd('0x4f')](function(_0x5028a6){if(_0x5028a6[_0x22bd('0xfc')]){rpcDb[_0x22bd('0xfd')](_0x3c95c7);}if(_0x5028a6[_0x22bd('0xf7')]){rpcDb[_0x22bd('0x60')](_0x3c95c7);}throw _[_0x22bd('0x49')](_0x5028a6,[_0x22bd('0x31')]);});};Preview[_0x22bd('0xf')]['execRun']=function(_0x1d0aa6,_0x307824){var _0x52f447=this;var _0x1aef6d,_0x2b889b;return rpcDb[_0x22bd('0xfe')](_0x1d0aa6)['then'](function(_0x5c44da){if(!_['isNil'](_0x5c44da[0x0])){_0x2b889b=_0x5c44da[0x0]['recallme']?![]:!![];_0x1aef6d=_0x5c44da[0x0][_0x22bd('0xff')]?!![]:![];_0x1aef6d=_0x307824?!![]:_0x1aef6d;}var _0x2e8188=_0x52f447[_0x22bd('0x100')](_0x5c44da);if(_0x2e8188[_0x22bd('0x101')]){rpcDb[_0x22bd('0x102')](_[_0x22bd('0x49')](_0x5c44da[0x0],[_0x22bd('0x4c'),'phone']))[_0x22bd('0x7f')](function(_0x37890b){_0x52f447[_0x22bd('0xea')](_0x37890b,_0x5c44da[0x0],_0x307824,_0x2b889b,_0x1aef6d)[_0x22bd('0x7f')](function(_0x98b919){return _0x98b919;})['catch'](function(_0x5c5c96){throw _0x5c5c96;});})[_0x22bd('0x4f')](function(_0x220c53){ut[_0x22bd('0x36')](_0x22bd('0x103'),_0x220c53);throw ut['message'](_0x22bd('0x104'),_0x2b889b,_0x1aef6d);});}else{throw ut[_0x22bd('0x31')](_0x2e8188['message'],_0x2b889b,_0x1aef6d);}})[_0x22bd('0x4f')](function(_0x2829e6){ut[_0x22bd('0x36')](_0x22bd('0x105'),_0x2829e6);throw ut[_0x22bd('0x31')](_0x22bd('0x104'),![],!![]);});};Preview[_0x22bd('0xf')][_0x22bd('0x100')]=function(_0x2e5f53){if(_[_0x22bd('0x43')](_0x2e5f53)||_[_0x22bd('0x106')](_0x2e5f53)||!_[_0x22bd('0x43')](_0x2e5f53[0x0][_0x22bd('0x5b')])&&_[_0x22bd('0x43')](_0x2e5f53[0x0][_0x22bd('0x5b')][_0x22bd('0x2b')])){ut[_0x22bd('0x36')]('[Preview][validateContact][Empty\x20Contact]',_0x2e5f53);return{'isValid':![],'message':_0x22bd('0x107')};}var _0x461977=this['campaignsPreview'][_0x2e5f53[0x0][_0x22bd('0x45')][_0x22bd('0x2b')]];_0x461977['message']=utils[_0x22bd('0x32')][_0x22bd('0x73')];if(_['isNil'](_0x461977)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x461977);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x22bd('0x70')](_0x461977[_0x22bd('0x108')])){ut[_0x22bd('0x36')](_0x22bd('0x109'),_0x22bd('0x10a')+_0x461977[_0x22bd('0x2b')]+_0x22bd('0x10b'));if(!this['isTrunkReachable'](_0x461977['TrunkBackup'])){ut[_0x22bd('0x36')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x461977[_0x22bd('0x2b')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x22bd('0x10c')](_0x461977[_0x22bd('0x10d')])){ut[_0x22bd('0x36')](_0x22bd('0x10e'),_0x461977[_0x22bd('0x2b')]+_0x22bd('0x10f'));return{'isValid':![],'message':_0x22bd('0x10a')+_0x461977['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x22bd('0xf')]['execCall']=function(_0x54a134,_0x3e4cea,_0x5c9898,_0x53abdc){var _0x22ef08=this;return new Promise(function(_0x323db9,_0xc19348){var _0x43a452=_0x54a134[_0x22bd('0x91')];var _0x5240fb=_0x22ef08[_0x22bd('0x70')](_0x3e4cea[_0x22bd('0x108')])?util[_0x22bd('0x29')](_0x22bd('0x110'),_0x3e4cea[_0x22bd('0x108')][_0x22bd('0x2b')],_[_0x22bd('0x43')](_0x3e4cea[_0x22bd('0x111')])?'':_0x3e4cea[_0x22bd('0x111')][_0x22bd('0x112')]()||'',_0x3e4cea[_0x22bd('0x113')]>0x0?_0x5c9898[_0x22bd('0x114')][_0x22bd('0x115')](_0x3e4cea[_0x22bd('0x113')]):_0x5c9898[_0x22bd('0x114')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x3e4cea[_0x22bd('0x71')])?_0x3e4cea[_0x22bd('0x108')]['name']:_0x3e4cea[_0x22bd('0x71')]['name'],_[_0x22bd('0x43')](_0x3e4cea[_0x22bd('0x111')])?'':_0x3e4cea[_0x22bd('0x111')]['trim']()||'',_0x3e4cea[_0x22bd('0x113')]>0x0?_0x5c9898[_0x22bd('0x114')]['substring'](_0x3e4cea['dialCutDigit']):_0x5c9898[_0x22bd('0x114')]);var _0x4328c1=_0x22ef08[_0x22bd('0x70')](_0x3e4cea[_0x22bd('0x108')])?ut['getCallerId'](_0x3e4cea['Trunk']['callerid'],_0x3e4cea[_0x22bd('0x116')],_0x3e4cea[_0x22bd('0x117')]>0x0?ut[_0x22bd('0x118')](_0x3e4cea[_0x22bd('0x119')],_0x3e4cea['dialRandomLastDigitCallerIdNumber']):_0x3e4cea[_0x22bd('0x119')]):ut[_0x22bd('0x11a')](_[_0x22bd('0x43')](_0x3e4cea[_0x22bd('0x71')])?_0x3e4cea[_0x22bd('0x108')][_0x22bd('0x11b')]:_0x3e4cea[_0x22bd('0x71')][_0x22bd('0x11b')],_0x3e4cea[_0x22bd('0x116')],_0x3e4cea[_0x22bd('0x117')]>0x0?ut[_0x22bd('0x118')](_0x3e4cea['dialOriginateCallerIdNumber'],_0x3e4cea[_0x22bd('0x117')]):_0x3e4cea[_0x22bd('0x119')]);if(_0x4328c1){_0x54a134[_0x22bd('0x11c')]=ut[_0x22bd('0x11d')](_0x4328c1);_0x54a134[_0x22bd('0x11e')]=ut[_0x22bd('0x11f')](_0x4328c1);}var _0x4fda3e=ut[_0x22bd('0x120')](_0x3e4cea,_0x5c9898,_0x5240fb,_0x4328c1,_0x43a452,_0x54a134);var _0x1ac459=utils[_0x22bd('0x121')](_0x5c9898['Contact']);Object[_0x22bd('0x122')](_0x4fda3e,_0x1ac459);_[_0x22bd('0x123')](_0x54a134,ut[_0x22bd('0x124')](_0x4fda3e));_0x54a134[_0x22bd('0x61')]=moment()[_0x22bd('0x29')](_0x22bd('0x8e'));_0x3e4cea['variables']=_0x4fda3e;var _0xdf3dec=ut[_0x22bd('0x125')](_0x54a134,_0x3e4cea,_0x4fda3e,_0x54a134[_0x22bd('0xac')],_0x53abdc);return ami[_0x22bd('0x4d')](_0xdf3dec)[_0x22bd('0x7f')](function(_0x36f4f9){_0x3e4cea[_0x22bd('0x2e')]+=0x1;logger['info']('[originated][increment]',_0x43a452,_0x22bd('0x92'),_0x3e4cea[_0x22bd('0x2b')],_0x22bd('0xda'),_0x3e4cea[_0x22bd('0x2e')]);_0x323db9(_0x36f4f9);})[_0x22bd('0x4f')](function(_0x57defa){ut[_0x22bd('0xe1')](_0x54a134,0xe,_0x22bd('0x126'));rpcDb[_0x22bd('0xe3')](_0x54a134,_0x22bd('0x127'));_0xc19348(_0x57defa);});});};Preview[_0x22bd('0xf')][_0x22bd('0x1e')]=function(_0x3edae4){if(this[_0x22bd('0x14')][_0x3edae4['linkedid']]){this[_0x22bd('0x14')][_0x3edae4[_0x22bd('0x89')]]['channel']=_0x3edae4['channel'];}};Preview[_0x22bd('0xf')]['syncOriginateResponse']=function(_0x32d25d){var _0x1232a8=this;var _0x30b050=this[_0x22bd('0x14')][_0x32d25d[_0x22bd('0x128')]];if(_0x30b050){if(_0x30b050[_0x22bd('0xeb')]&&this[_0x22bd('0x15')][_0x30b050[_0x22bd('0xeb')]]){ut[_0x22bd('0x129')](_0x30b050,this[_0x22bd('0x15')][_0x30b050[_0x22bd('0xeb')]][_0x22bd('0x2b')],this['agents'][_0x30b050[_0x22bd('0xeb')]]['id']);}var _0x38e8ae=_[_0x22bd('0x12a')](_0x30b050);_0x38e8ae[_0x22bd('0x8f')]=moment()['format'](_0x22bd('0x8e'));var _0x4d36f0=_0x1232a8['campaignsPreview'][_0x30b050[_0x22bd('0x46')]];if(ut[_0x22bd('0x12b')](_0x32d25d['response'])){if(_0x30b050[_0x22bd('0x88')]){rpcDb[_0x22bd('0xfd')](_0x30b050[_0x22bd('0x8b')]);}if(_0x30b050['activeContact']){rpcDb[_0x22bd('0x60')](_0x30b050['idContact']);}ami['emit'](_0x22bd('0x12c'),ut['buildObj'](_0x30b050,_0x22bd('0x12d'),this[_0x22bd('0x47')][_0x30b050[_0x22bd('0x46')]]));this[_0x22bd('0x12e')](_0x38e8ae,_0x4d36f0,_0x32d25d);}else{_0x30b050[_0x22bd('0x61')]=moment()[_0x22bd('0x29')](_0x22bd('0x8e'));ut['logAgent'](_0x38e8ae,0x4,_0x22bd('0x12f'));rpcDb[_0x22bd('0xe3')](_0x38e8ae,_0x22bd('0x130'));}}};Preview[_0x22bd('0xf')][_0x22bd('0x18')]=function(_0x5d5468){var _0x4f1d21=this[_0x22bd('0x14')][_0x5d5468[_0x22bd('0x89')]];var _0x4f9439;if(_0x4f1d21){_0x4f9439=this['campaignsPreview'][_0x4f1d21[_0x22bd('0x46')]];logger[_0x22bd('0x26')](_0x22bd('0x131'),_0x5d5468[_0x22bd('0x89')],_0x22bd('0x92'),_0x4f9439[_0x22bd('0x2b')],_0x22bd('0x132'),_0x4f9439[_0x22bd('0x2f')]);}if(this[_0x22bd('0x14')][_0x5d5468[_0x22bd('0x89')]]&&_0x5d5468['linkedid']!==_0x5d5468[_0x22bd('0x91')]){if(_0x5d5468['cause']==='16'&&this['actions'][_0x5d5468[_0x22bd('0x89')]][_0x22bd('0x48')]){this[_0x22bd('0x74')](_0x5d5468,_0x5d5468[_0x22bd('0x89')],_0x5d5468['cause']);}else if(this['actions'][_0x5d5468['linkedid']][_0x22bd('0x48')]){logger['info'](_0x22bd('0x133'),_0x5d5468['linkedid'],_0x5d5468['cause'],'\x20Queue',_0x4f9439[_0x22bd('0x2b')],_0x22bd('0x132'),_0x4f9439[_0x22bd('0x2f')]);this[_0x22bd('0x74')](_0x5d5468,_0x5d5468['linkedid'],_0x5d5468[_0x22bd('0x134')]);}}else if(_0x4f1d21&&_[_0x22bd('0x43')](_0x4f1d21['statedesc'])&&_0x4f9439[_0x22bd('0x135')]&&_0x5d5468[_0x22bd('0x89')]===_0x5d5468['uniqueid']&&_['isNil'](_0x5d5468['reason'])&&_0x5d5468[_0x22bd('0x134')]==='16'&&_0x5d5468[_0x22bd('0x136')]==='6'&&_[_0x22bd('0xde')](_0x4f1d21[_0x22bd('0x137')])){if(_0x4f1d21[_0x22bd('0x88')]){rpcDb[_0x22bd('0xfd')](_0x4f1d21[_0x22bd('0x8b')]);}if(_0x4f1d21[_0x22bd('0xac')]){rpcDb[_0x22bd('0x60')](_0x4f1d21[_0x22bd('0x8b')]);}_0x5d5468[_0x22bd('0xe0')]='22';this['callProgressDetectingAgent'](_0x4f1d21,_0x4f9439,_0x5d5468);}else if(_0x4f1d21&&_0x4f1d21[_0x22bd('0x137')]){if(_0x5d5468['cause']==='16'&&this[_0x22bd('0x14')][_0x5d5468[_0x22bd('0x89')]][_0x22bd('0x48')]){logger['info'](_0x22bd('0x138'),_0x5d5468[_0x22bd('0x89')],_0x5d5468[_0x22bd('0x134')],_0x22bd('0x92'),_0x4f9439[_0x22bd('0x2b')],_0x22bd('0x132'),_0x4f9439[_0x22bd('0x2f')]);this[_0x22bd('0x74')](_0x5d5468,_0x5d5468[_0x22bd('0x89')],_0x5d5468[_0x22bd('0x134')]);}else if(this['actions'][_0x5d5468[_0x22bd('0x89')]][_0x22bd('0x48')]){logger[_0x22bd('0x26')]('[syncHangup][talking][cause]',_0x5d5468[_0x22bd('0x89')],_0x5d5468[_0x22bd('0x134')],'\x20Queue',_0x4f9439[_0x22bd('0x2b')],_0x22bd('0x132'),_0x4f9439['pTalking']);this[_0x22bd('0x74')](_0x5d5468,_0x5d5468[_0x22bd('0x89')],_0x5d5468[_0x22bd('0x134')]);}}};Preview['prototype']['syncDialEnd']=function(_0x5cbebb){if(this[_0x22bd('0x14')][_0x5cbebb[_0x22bd('0xdc')]]&&_0x5cbebb[_0x22bd('0xdc')]!==_0x5cbebb[_0x22bd('0x139')]){this[_0x22bd('0x74')](_0x5cbebb,_0x5cbebb[_0x22bd('0xdc')],_0x5cbebb['dialstatus']);}};Preview[_0x22bd('0xf')][_0x22bd('0x13a')]=function(_0x176aa2){if(this[_0x22bd('0x14')][_0x176aa2[_0x22bd('0x89')]]&&_0x176aa2[_0x22bd('0x89')]!==_0x176aa2['uniqueid']&&!this[_0x22bd('0x14')][_0x176aa2['linkedid']][_0x22bd('0x48')]){if(_0x176aa2[_0x22bd('0x134')]==='1'){this[_0x22bd('0x74')](_0x176aa2,_0x176aa2[_0x22bd('0x89')],_0x176aa2[_0x22bd('0x134')]);}}};Preview[_0x22bd('0xf')][_0x22bd('0x13b')]=function(_0x21049b,_0x2701f5,_0x27947b){if(this[_0x22bd('0x14')][_0x21049b]){if(_[_0x22bd('0x43')](this['actions'][_0x21049b][_0x22bd('0x13c')])){this[_0x22bd('0x14')][_0x21049b]['variables']={};}this[_0x22bd('0x14')][_0x21049b][_0x22bd('0x13c')][_0x2701f5]=_0x27947b;}};Preview[_0x22bd('0xf')][_0x22bd('0x20')]=function(_0x8f1739){try{if(!_[_0x22bd('0x43')](_0x8f1739)){if(ut[_0x22bd('0x13d')](_[_0x22bd('0x13e')](_0x8f1739[_0x22bd('0x13f')])[0x0])){this[_0x22bd('0x13b')](_0x8f1739[_0x22bd('0x91')],_[_0x22bd('0x13e')](_0x8f1739['variable'])[0x0],_0x8f1739[_0x22bd('0x140')]);}}}catch(_0x27a9f6){logger[_0x22bd('0x141')](_0x22bd('0x142'),util['inspect'](_0x27a9f6,{'showHidden':![],'depth':null}));}};Preview[_0x22bd('0xf')][_0x22bd('0x22')]=function(_0x412090){if(_0x412090){if(this[_0x22bd('0x14')][_0x412090[_0x22bd('0x143')]]){this[_0x22bd('0x14')][_0x412090[_0x22bd('0x143')]][_0x22bd('0x137')]=!![];}}};Preview['prototype'][_0x22bd('0x23')]=function(_0x2a04aa){if(_0x2a04aa){if(this[_0x22bd('0x14')][_0x2a04aa[_0x22bd('0x144')]]){this[_0x22bd('0x14')][_0x2a04aa[_0x22bd('0x144')]][_0x22bd('0x137')]=!![];}}};module[_0x22bd('0x145')]=Preview; \ No newline at end of file +var _0x0599=['blindtransfer','syncBlindTransfer','campaignsPreview','info','stringify','format','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','message','INACTIVE','\x20is\x20not\x20active','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','clearZombieChannel','sequence','[clearZombieChannels][talking]','actions','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','isNil','getDiff','scheduledat','Agent','voicePause','[RecallMe]','logger2','starttime','outboundReCallsDay','logCustomer','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','unlockAgent','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','custom:agentconnect','buildObj','connect','buildAcw','custom:agentcomplete','complete','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','sumDuration','talktime','sumBillable','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','activeContact','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','scheduledAt','ABANDONED','outboundAbandonedCallsDay','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','uniqueid','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','unlock','unlockContact','pick','getContactPreview','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','setXMDContactVariables','Contact','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variablesAction','[originated][increment]','\x20Queue','OriginateError','channel','syncOriginateResponse','actionid','logLookAgent','clone','response','disableContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','callProgressDetectingAgent','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','syncVarSet','variable','keys','value','error','[syncVarSet][Preview]','transfererlinkedid','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','defaults','redis','localhost','enqueue','tail','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','dialend','syncDialEnd','newexten','syncNewExten','syncAttendedTransfer'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x0599,0x120));var _0x9059=function(_0x5d82f5,_0x1a3851){_0x5d82f5=_0x5d82f5-0x0;var _0x505e0a=_0x0599[_0x5d82f5];return _0x505e0a;};'use strict';var util=require('util');var _=require('lodash');var uuid=require('uuid');var moment=require(_0x9059('0x0'));var Redis=require(_0x9059('0x1'));var config=require(_0x9059('0x2'));var logger=require('../../../config/logger')(_0x9059('0x3'));var loggerAction=require(_0x9059('0x4'))(_0x9059('0x5'));var ami=require('../ami');var rpcDb=require(_0x9059('0x6'));var cmHopperAdditionalPhone=require(_0x9059('0x7'));var Action=require('./action');var ut=require(_0x9059('0x8'));var utils=require('../dialer/utils');config['redis']=_[_0x9059('0x9')](config[_0x9059('0xa')],{'host':_0x9059('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x9059('0xc')]=function(_0x34bab5){this[_0x9059('0xd')]=this[_0x9059('0xd')]?this[_0x9059('0xd')]['finally'](_0x34bab5):_0x34bab5();};function Preview(_0x4d0e58){this['sequence']=new Sequence();this['campaignsPreview']=_0x4d0e58[_0x9059('0xe')];this[_0x9059('0xf')]=_0x4d0e58[_0x9059('0xf')];this['actions']={};this[_0x9059('0x10')]=_0x4d0e58['agents'];this[_0x9059('0x11')]=0x0;ami['on'](_0x9059('0x12'),this['syncOriginateResponse'][_0x9059('0x13')](this));ami['on']('hangup',this[_0x9059('0x14')]['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x9059('0x13')](this));ami['on'](_0x9059('0x15'),this[_0x9059('0x16')][_0x9059('0x13')](this));ami['on'](_0x9059('0x17'),this[_0x9059('0x18')][_0x9059('0x13')](this));ami['on']('varset',this['syncVarSet'][_0x9059('0x13')](this));ami['on']('attendedtransfer',this[_0x9059('0x19')][_0x9059('0x13')](this));ami['on'](_0x9059('0x1a'),this[_0x9059('0x1b')][_0x9059('0x13')](this));this['loopCampaigns'](this[_0x9059('0x1c')]);}function emit(_0x365b76,_0x3df3cc,_0xa2f3af){io['to'](_0x365b76)['emit'](_0x3df3cc,_0xa2f3af);}function emitVoiceQueueChannelRemove(_0x58f729){logger[_0x9059('0x1d')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x9059('0x1e')](_0x58f729));emit(util[_0x9059('0x1f')]('voice:queue:%s',_0x58f729[_0x9059('0x20')]),_0x9059('0x21'),_0x58f729);io[_0x9059('0x22')](_0x9059('0x23'),_0x58f729);}function notSendMessagesQueue(_0xc24c13){if(_0xc24c13[_0x9059('0x24')]){if(_0xc24c13[_0x9059('0x25')]===0x0&&_0xc24c13[_0x9059('0x26')]===0x0){_0xc24c13['sendMessageOneNotActive']=![];_0xc24c13[_0x9059('0x27')]=0x0;_0xc24c13['paused']=0x0;_0xc24c13[_0x9059('0x28')]=utils['CAMPAIGN_STATUS'][_0x9059('0x29')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xc24c13[_0x9059('0x20')]+_0x9059('0x2a'));}else{_0xc24c13[_0x9059('0x28')]=utils[_0x9059('0x2b')]['DEACTIVATED'];ut[_0x9059('0x2c')](_0x9059('0x2d'),_0xc24c13[_0x9059('0x20')]+_0x9059('0x2e'));}}}Preview[_0x9059('0x2f')]['loopCampaigns']=function(){var _0x20dac2=this;setInterval(function(){_0x20dac2['syncCampaigns']();},0x7cf);};Preview[_0x9059('0x2f')][_0x9059('0x30')]=function(){var _0x298cd4=this[_0x9059('0x1c')];this[_0x9059('0x11')]+=0x1;for(var _0x24e8a0 in _0x298cd4){if(_0x298cd4[_0x9059('0x31')](_0x24e8a0)&&(_0x298cd4[_0x24e8a0][_0x9059('0x32')]===_0x9059('0x3')||_0x298cd4[_0x24e8a0][_0x9059('0x32')]===_0x9059('0x33'))&&_0x298cd4[_0x24e8a0][_0x9059('0x34')]===_0x9059('0x35')){if(this[_0x9059('0x11')]>0x7){this[_0x9059('0x11')]=0x0;this[_0x9059('0x36')]();}}if(_0x298cd4['hasOwnProperty'](_0x24e8a0)&&_0x298cd4[_0x24e8a0][_0x9059('0x32')]===_0x9059('0x3')&&_0x298cd4[_0x24e8a0][_0x9059('0x34')]===_0x9059('0x35')){if(_0x298cd4[_0x24e8a0][_0x9059('0x37')]){this['setMessage'](_0x298cd4[_0x24e8a0]);if(_0x298cd4[_0x24e8a0]['dialPreviewAutoRecallMe'])this['recallMe'](_0x298cd4[_0x24e8a0]);}else{notSendMessagesQueue(_0x298cd4[_0x24e8a0]);}}}};Preview[_0x9059('0x2f')][_0x9059('0x38')]=function(_0x519f7f){var _0x2d704e=this;this[_0x9059('0x39')][_0x9059('0xc')](function(){if(!_['isNil'](_0x2d704e['actions'][_0x519f7f])){loggerAction['info'](_0x9059('0x3a'),_0x519f7f,'Queue',_0x2d704e[_0x9059('0x3b')][_0x519f7f][_0x9059('0x3c')],_0x9059('0x3d'),JSON[_0x9059('0x1e')](_0x2d704e[_0x9059('0x1c')][_0x2d704e[_0x9059('0x3b')][_0x519f7f]['queue']]['originated']),_0x9059('0x3e'),JSON[_0x9059('0x1e')](_0x2d704e[_0x9059('0x1c')][_0x2d704e[_0x9059('0x3b')][_0x519f7f][_0x9059('0x3c')]][_0x9059('0x26')]),JSON['stringify'](_0x2d704e[_0x9059('0x3b')][_0x519f7f][_0x9059('0x3f')]),JSON[_0x9059('0x1e')](_['pick'](_0x2d704e['actions'][_0x519f7f],[_0x9059('0x40'),_0x9059('0x41'),'VoiceQueueId','ListId'])));return ami[_0x9059('0x42')]({'action':_0x9059('0x43'),'channel':_0x2d704e[_0x9059('0x3b')][_0x519f7f]['channel']})[_0x9059('0x44')](function(_0x46c14a){if(_0x46c14a['message']===_0x9059('0x45')){setTimeout(function(){if(_0x2d704e[_0x9059('0x3b')][_0x519f7f]){ut[_0x9059('0x46')](_0x2d704e[_0x9059('0x1c')][_0x2d704e[_0x9059('0x3b')][_0x519f7f][_0x9059('0x3c')]],_0x9059('0x47'));if(_0x2d704e['actions'][_0x519f7f][_0x9059('0x3f')]===!![]){ut['decrementTalkink'](_0x2d704e[_0x9059('0x1c')][_0x2d704e[_0x9059('0x3b')][_0x519f7f][_0x9059('0x3c')]],_0x9059('0x47'));ut['loggerError'](_0x9059('0x48')+_0x519f7f,_0x2d704e['actions'][_0x519f7f]['queue']);}ut[_0x9059('0x49')](_0x9059('0x4a')+_0x519f7f,_0x2d704e[_0x9059('0x3b')][_0x519f7f][_0x9059('0x3c')]);delete _0x2d704e[_0x9059('0x3b')][_0x519f7f];}},0x2328);}});}});};Preview[_0x9059('0x2f')][_0x9059('0x36')]=function(){var _0x269534=this;loggerAction[_0x9059('0x1d')](_0x9059('0x4b'),_[_0x9059('0x4c')](this[_0x9059('0x3b')]));for(var _0x1fe448 in this[_0x9059('0x3b')]){if(_0x269534[_0x9059('0x3b')][_0x9059('0x31')](_0x1fe448)){_0x269534[_0x9059('0x38')](_0x1fe448);}}};Preview[_0x9059('0x2f')][_0x9059('0x4d')]=function(_0x369bf0){var _0x565ccc=this;rpcDb[_0x9059('0x4e')](_0x369bf0['id'],ut[_0x9059('0x4f')](this[_0x9059('0x10')]))[_0x9059('0x50')](function(_0x139980){if(!_[_0x9059('0x51')](_0x139980)){for(var _0x3fdec6=0x0;_0x3fdec6<_0x139980['length'];_0x3fdec6+=0x1){if(ut[_0x9059('0x52')](_0x139980[_0x3fdec6][_0x9059('0x53')])<_0x369bf0['dialRecallMeTimeout']*0x3c){if(_0x139980[_0x3fdec6][_0x9059('0x54')]&&!_0x139980[_0x3fdec6]['Agent'][_0x9059('0x55')]){_0x565ccc['run'](_0x139980[_0x3fdec6]['id'])[_0x9059('0x50')](ut['logger2'](_0x9059('0x56')))['catch'](ut[_0x9059('0x57')](_0x9059('0x56')));}else{rpcDb['disableContact'](_0x139980[_0x3fdec6]['id']);}}else{var _0x224777=new Action(_0x139980[_0x3fdec6],_0x369bf0);_0x224777[_0x9059('0x58')]=moment()[_0x9059('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');_0x369bf0[_0x9059('0x59')]+=0x1;ut[_0x9059('0x5a')](_0x224777,0x17,'RecallInQueue');if(_0x369bf0['dialRecallInQueue']){rpcDb[_0x9059('0x5b')](ut[_0x9059('0x5c')](_0x139980[_0x3fdec6]));rpcDb[_0x9059('0x5d')](_0x224777,_0x9059('0x5e'));}else{ut[_0x9059('0x5a')](_0x224777,0x16,_0x9059('0x5f'));rpcDb['createCustomerHistory'](_0x224777,_0x9059('0x60'));rpcDb[_0x9059('0x61')](_0x224777,'[HistoryRecallClose]');}}}}})[_0x9059('0x44')](ut[_0x9059('0x57')]('[getContactRecallMe]'));};Preview[_0x9059('0x2f')][_0x9059('0x62')]=function(_0x3b62de){_0x3b62de[_0x9059('0x24')]=!![];if(ut[_0x9059('0x63')](_0x3b62de[_0x9059('0x64')])){_0x3b62de['message']=utils[_0x9059('0x2b')][_0x9059('0x65')];}else if(!ut[_0x9059('0x66')](_0x3b62de[_0x9059('0x37')])){_0x3b62de['message']=utils[_0x9059('0x2b')][_0x9059('0x29')];}else if(!this[_0x9059('0x67')](_0x3b62de[_0x9059('0x68')])){if(!this[_0x9059('0x67')](_0x3b62de[_0x9059('0x69')])){_0x3b62de[_0x9059('0x28')]=utils[_0x9059('0x2b')]['UNREACHABLE_TRUNK'];}else{_0x3b62de[_0x9059('0x28')]=utils[_0x9059('0x2b')]['ACTIVE'];}}else{_0x3b62de[_0x9059('0x28')]=utils[_0x9059('0x2b')][_0x9059('0x6a')];}};Preview[_0x9059('0x2f')][_0x9059('0x6b')]=function(_0x259068,_0x51e807,_0x554f93){var _0x6772d0=this;var _0x3c02d6=this[_0x9059('0x3b')][_0x51e807];var _0x2301a8=this['campaignsPreview'][_0x3c02d6[_0x9059('0x3c')]];var _0x54ff79;var _0x8eb8b7=![];var _0x1e2c60=0x2;var _0x5d97e6=0x3;if(_0x2301a8){switch(_0x554f93){case'1':_0x2301a8[_0x9059('0x6c')]+=0x1;_0x3c02d6[_0x9059('0x6d')]+=0x1;_0x3c02d6[_0x9059('0x6e')]=ut[_0x9059('0x6f')](_0x3c02d6);ut[_0x9059('0x5a')](_0x3c02d6,0x0,_0x9059('0x70'));ami[_0x9059('0x22')](_0x9059('0x71'),ut['buildObj'](_0x3c02d6,'nosuchnumber'));rpcDb[_0x9059('0x5d')](_0x3c02d6,_0x9059('0x72'));_0x6772d0[_0x9059('0x73')](_0x3c02d6,'0',_0x2301a8)[_0x9059('0x50')](function(_0x5cb521){_0x8eb8b7=_0x5cb521[_0x9059('0x74')]==0x1;_0x1e2c60=_0x2301a8[_0x9059('0x75')];_0x5d97e6=_0x2301a8[_0x9059('0x76')];if(!_0x8eb8b7){if(ut[_0x9059('0x6f')](_0x3c02d6)>=_0x2301a8[_0x9059('0x77')]){_0x54ff79=ut[_0x9059('0x78')](_0x3c02d6,0xf,_0x9059('0x79'));rpcDb['createCustomerFinal'](_0x54ff79,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3c02d6['countnosuchnumberretry']>=_0x2301a8[_0x9059('0x7a')]){rpcDb[_0x9059('0x61')](_0x3c02d6,_0x9059('0x7b'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3c02d6,_0x9059('0x6d'),_0x2301a8['dialNoSuchNumberRetryFrequency']),_0x3c02d6[_0x9059('0x7c')],_0x3c02d6['activeContact']);}}delete this[_0x9059('0x3b')][_0x259068[_0x9059('0x7d')]];}else{_0x3c02d6['countnosuchnumberretry']++;logger[_0x9059('0x1d')](_0x9059('0x7e'),_0x3c02d6[_0x9059('0x6d')]);logger[_0x9059('0x1d')]('id',_0x3c02d6[_0x9059('0x7f')]);_0x6772d0['incrementPreviewCounters']({'id':_0x3c02d6['idContact'],'field':{'countnosuchnumberretry':_0x3c02d6[_0x9059('0x6d')]}})[_0x9059('0x50')](function(){_0x6772d0[_0x9059('0x80')](_0x3c02d6,_0x1e2c60,_0x5d97e6)[_0x9059('0x50')](function(){});});}});break;case _0x9059('0x81'):var _0x230edd=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3c02d6[_0x9059('0x82')]=_0x230edd;_0x3c02d6[_0x9059('0x83')]=_0x230edd;_0x3c02d6[_0x9059('0x3f')]=!![];_0x2301a8['pTalking']+=0x1;logger['info'](_0x9059('0x84'),_0x3c02d6['uniqueid'],'\x20Queue',_0x2301a8['name'],_0x9059('0x3e'),_0x2301a8[_0x9059('0x26')]);ami['emit'](_0x9059('0x85'),ut[_0x9059('0x86')](_0x3c02d6,_0x9059('0x87'),this[_0x9059('0x1c')][_0x3c02d6['queue']]));if(_0x2301a8['acw']){ami['emit']('custom:agentConnectPreview',ut[_0x9059('0x88')](_0x3c02d6));}break;case'16':ami[_0x9059('0x22')](_0x9059('0x89'),ut[_0x9059('0x86')](_0x3c02d6,_0x9059('0x8a'),this[_0x9059('0x1c')][_0x3c02d6['queue']]));emitVoiceQueueChannelRemove(ut[_0x9059('0x86')](_0x3c02d6,_0x9059('0x8a')));_0x2301a8['outboundAnswerCallsDay']+=0x1;_0x2301a8['total']+=0x1;_0x2301a8[_0x9059('0x8b')]+=0x1;ut[_0x9059('0x8c')](_0x2301a8,_0x9059('0x8d'));_0x3c02d6[_0x9059('0x6e')]=ut[_0x9059('0x6f')](_0x3c02d6);ut['logCustomer'](_0x3c02d6,0x4,_0x9059('0x8e'));rpcDb[_0x9059('0x5d')](_0x3c02d6,_0x9059('0x8f'));rpcDb[_0x9059('0x61')](_0x3c02d6,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x3c02d6);_0x2301a8[_0x9059('0x90')]+=_0x3c02d6[_0x9059('0x91')];_0x2301a8[_0x9059('0x92')]+=_0x3c02d6[_0x9059('0x91')];logger['info']('[syncHangup][talking][decrement]',_0x3c02d6['uniqueid'],'\x20Queue',_0x2301a8[_0x9059('0x20')],_0x9059('0x3e'),_0x2301a8[_0x9059('0x26')]);delete this[_0x9059('0x3b')][_0x259068[_0x9059('0x7d')]];break;case _0x9059('0x93'):_0x2301a8[_0x9059('0x94')]+=0x1;_0x3c02d6[_0x9059('0x95')]+=0x1;_0x3c02d6[_0x9059('0x6e')]=ut[_0x9059('0x6f')](_0x3c02d6);ut['logCustomer'](_0x3c02d6,0x5,_0x9059('0x96'));_0x1e2c60=_0x2301a8['dialBusyRetryFrequency'];_0x5d97e6=_0x2301a8[_0x9059('0x76')];ami['emit'](_0x9059('0x97'),ut['buildObj'](_0x3c02d6,_0x9059('0x98')));rpcDb['createCustomerHistory'](_0x3c02d6,_0x9059('0x99'));_0x6772d0[_0x9059('0x73')](_0x3c02d6,'5',_0x2301a8)[_0x9059('0x50')](function(_0x4ab81d){_0x8eb8b7=_0x4ab81d[_0x9059('0x74')]==0x1;if(!_0x8eb8b7){if(ut[_0x9059('0x6f')](_0x3c02d6)>=_0x2301a8['dialGlobalMaxRetry']){_0x54ff79=ut[_0x9059('0x78')](_0x3c02d6,0xf,_0x9059('0x79'));rpcDb[_0x9059('0x61')](_0x54ff79,_0x9059('0x9a'));}else{if(_0x3c02d6['countbusyretry']>=_0x2301a8[_0x9059('0x9b')]){rpcDb[_0x9059('0x61')](_0x3c02d6,_0x9059('0x99'));}else{rpcDb[_0x9059('0x9c')](ut['scheduledAt'](_0x3c02d6,_0x9059('0x95'),_0x2301a8[_0x9059('0x9d')]),_0x3c02d6[_0x9059('0x7c')],_0x3c02d6[_0x9059('0x9e')]);}}}else{_0x3c02d6[_0x9059('0x95')]++;_0x6772d0[_0x9059('0x9f')]({'id':_0x3c02d6[_0x9059('0x7f')],'field':{'countbusyretry':_0x3c02d6[_0x9059('0x95')]}})[_0x9059('0x50')](function(){_0x6772d0[_0x9059('0x80')](_0x3c02d6,_0x1e2c60,_0x5d97e6)[_0x9059('0x50')](function(){});});}});break;case _0x9059('0xa0'):_0x2301a8[_0x9059('0xa1')]+=0x1;_0x3c02d6['countnoanswerretry']+=0x1;_0x3c02d6['countglobal']=ut[_0x9059('0x6f')](_0x3c02d6);ut[_0x9059('0x5a')](_0x3c02d6,0x3,_0x9059('0xa2'));_0x1e2c60=_0x2301a8[_0x9059('0xa3')];_0x5d97e6=_0x2301a8[_0x9059('0x76')];var _0x26a0b8=ut[_0x9059('0xa4')](_0x3c02d6,_0x2301a8);ami[_0x9059('0x22')](_0x9059('0xa5'),_0x26a0b8);rpcDb[_0x9059('0x5d')](_0x3c02d6,_0x9059('0xa6'));_0x6772d0[_0x9059('0x73')](_0x3c02d6,'3',_0x2301a8)[_0x9059('0x50')](function(_0x3a2326){_0x8eb8b7=_0x3a2326['additional']==0x1;if(!_0x8eb8b7){if(ut[_0x9059('0x6f')](_0x3c02d6)>=_0x2301a8['dialGlobalMaxRetry']){_0x54ff79=ut['cloneAction'](_0x3c02d6,0xf,'Global');rpcDb[_0x9059('0x61')](_0x54ff79,_0x9059('0xa7'));}else{if(_0x3c02d6[_0x9059('0xa8')]>=_0x2301a8[_0x9059('0xa9')]){rpcDb['createCustomerFinal'](_0x3c02d6,_0x9059('0xa6'));}else{rpcDb[_0x9059('0x9c')](ut['scheduledAt'](_0x3c02d6,_0x9059('0xa8'),_0x2301a8['dialNoAnswerRetryFrequency']),_0x3c02d6[_0x9059('0x7c')],_0x3c02d6['activeContact']);}}}else{_0x3c02d6['countnoanswerretry']++;_0x6772d0[_0x9059('0x9f')]({'id':_0x3c02d6[_0x9059('0x7f')],'field':{'countnoanswerretry':_0x3c02d6[_0x9059('0xa8')]}})[_0x9059('0x50')](function(){_0x6772d0[_0x9059('0x80')](_0x3c02d6,_0x1e2c60,_0x5d97e6)[_0x9059('0x50')](function(){});});}});break;case _0x9059('0xaa'):_0x2301a8[_0x9059('0xab')]+=0x1;_0x3c02d6['countcongestionretry']+=0x1;_0x3c02d6[_0x9059('0x6e')]=ut[_0x9059('0x6f')](_0x3c02d6);ut[_0x9059('0x5a')](_0x3c02d6,0x8,_0x9059('0xac'));_0x1e2c60=_0x2301a8[_0x9059('0xad')];_0x5d97e6=_0x2301a8['callAdditionalPhoneAfterMin'];ami['emit'](_0x9059('0xae'),ut[_0x9059('0x86')](_0x3c02d6,'congestion'));rpcDb[_0x9059('0x5d')](_0x3c02d6,_0x9059('0xaf'));_0x6772d0['verifyAdditionalPhones'](_0x3c02d6,'8',_0x2301a8)[_0x9059('0x50')](function(_0x135515){_0x8eb8b7=_0x135515[_0x9059('0x74')]==0x1;if(!_0x8eb8b7){if(ut[_0x9059('0x6f')](_0x3c02d6)>=_0x2301a8[_0x9059('0x77')]){_0x54ff79=ut[_0x9059('0x78')](_0x3c02d6,0xf,'Global');rpcDb[_0x9059('0x61')](_0x54ff79,_0x9059('0xb0'));}else{if(_0x3c02d6['countcongestionretry']>=_0x2301a8[_0x9059('0xb1')]){rpcDb['createCustomerFinal'](_0x3c02d6,_0x9059('0xaf'));}else{rpcDb[_0x9059('0x9c')](ut['scheduledAt'](_0x3c02d6,_0x9059('0xb2'),_0x2301a8[_0x9059('0x9d')]),_0x3c02d6[_0x9059('0x7c')],_0x3c02d6[_0x9059('0x9e')]);}}}else{_0x3c02d6[_0x9059('0xb2')]++;_0x6772d0[_0x9059('0x9f')]({'id':_0x3c02d6[_0x9059('0x7f')],'field':{'countcongestionretry':_0x3c02d6[_0x9059('0xb2')]}})[_0x9059('0x50')](function(){_0x6772d0['swapAdditionalPhones'](_0x3c02d6,_0x1e2c60,_0x5d97e6)[_0x9059('0x50')](function(){});});}});break;case _0x9059('0xb3'):_0x2301a8[_0x9059('0xb4')]+=0x1;_0x3c02d6[_0x9059('0xb5')]+=0x1;_0x3c02d6['countglobal']=ut[_0x9059('0x6f')](_0x3c02d6);ut[_0x9059('0x5a')](_0x3c02d6,0x14,'AgentReject');_0x1e2c60=_0x2301a8[_0x9059('0xb6')];_0x5d97e6=_0x2301a8[_0x9059('0x76')];ami[_0x9059('0x22')](_0x9059('0xb7'),ut[_0x9059('0x86')](_0x3c02d6,_0x9059('0xb8')));rpcDb[_0x9059('0x5d')](_0x3c02d6,_0x9059('0xb9'));_0x6772d0[_0x9059('0x73')](_0x3c02d6,'20',_0x2301a8)[_0x9059('0x50')](function(_0x35aa49){_0x8eb8b7=_0x35aa49['additional']==0x1;if(!_0x8eb8b7){if(ut['totalGlobal'](_0x3c02d6)>=_0x2301a8[_0x9059('0x77')]){_0x54ff79=ut['cloneAction'](_0x3c02d6,0x14,_0x9059('0xba'));rpcDb[_0x9059('0x61')](_0x54ff79,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3c02d6['countagentrejectretry']>=_0x2301a8[_0x9059('0xbb')]){rpcDb[_0x9059('0x61')](_0x3c02d6,_0x9059('0xbc'));}else{rpcDb['rescheduleContact'](ut[_0x9059('0xbd')](_0x3c02d6,'countagentrejectretry',_0x2301a8[_0x9059('0xb6')]),_0x3c02d6[_0x9059('0x7c')],_0x3c02d6[_0x9059('0x9e')]);}}}else{_0x3c02d6[_0x9059('0xa8')]++;_0x6772d0[_0x9059('0x9f')]({'id':_0x3c02d6[_0x9059('0x7f')],'field':{'countnoanswerretry':_0x3c02d6[_0x9059('0xa8')]}})['then'](function(){_0x6772d0[_0x9059('0x80')](_0x3c02d6,_0x1e2c60,_0x5d97e6)[_0x9059('0x50')](function(){});});}});break;case _0x9059('0xbe'):_0x2301a8[_0x9059('0xbf')]+=0x1;_0x3c02d6['countabandonedretry']+=0x1;_0x3c02d6[_0x9059('0x6e')]=ut[_0x9059('0x6f')](_0x3c02d6);ut[_0x9059('0x5a')](_0x3c02d6,0xb,'Abandoned');rpcDb[_0x9059('0x5d')](_0x3c02d6,_0x9059('0xc0'));_0x6772d0['verifyAdditionalPhones'](_0x3c02d6,'11',_0x2301a8)['then'](function(_0x8fffcd){_0x8eb8b7=_0x8fffcd['additional']==0x1;if(!_0x8eb8b7){if(ut[_0x9059('0x6f')](_0x3c02d6)>=_0x2301a8[_0x9059('0x77')]){_0x54ff79=ut[_0x9059('0x78')](_0x3c02d6,0xf,_0x9059('0x79'));rpcDb[_0x9059('0x61')](_0x54ff79,_0x9059('0xc0'));}else{if(_0x3c02d6['countabandonedetry']>=_0x2301a8[_0x9059('0xc1')]){rpcDb[_0x9059('0x61')](_0x3c02d6,_0x9059('0xc0'));}else{rpcDb[_0x9059('0x9c')](ut['scheduledAt'](_0x3c02d6,_0x9059('0xc2'),_0x2301a8[_0x9059('0xc3')]),_0x3c02d6[_0x9059('0x7c')],_0x3c02d6['activeContact']);}}}else{_0x3c02d6[_0x9059('0xa8')]++;_0x6772d0[_0x9059('0x9f')]({'id':_0x3c02d6[_0x9059('0x7f')],'field':{'countnoanswerretry':_0x3c02d6[_0x9059('0xa8')]}})['then'](function(){_0x6772d0[_0x9059('0x80')](_0x3c02d6,_0x1e2c60,_0x5d97e6)[_0x9059('0x50')](function(){});});}});break;case'18':_0x2301a8[_0x9059('0xc4')]+=0x1;_0x3c02d6[_0x9059('0xc5')]+=0x1;_0x3c02d6['countglobal']=ut[_0x9059('0x6f')](_0x3c02d6);ut[_0x9059('0x5a')](_0x3c02d6,0x12,_0x259068[_0x9059('0xc6')]||_0x259068['dialstatus']);ami['emit'](_0x9059('0xc7'),ut[_0x9059('0x86')](_0x3c02d6,_0x9059('0xc8')));rpcDb[_0x9059('0x5d')](_0x3c02d6,_0x9059('0xc9'));_0x6772d0[_0x9059('0x73')](_0x3c02d6,'18',_0x2301a8)[_0x9059('0x50')](function(_0x2f61c5){_0x8eb8b7=_0x2f61c5[_0x9059('0x74')]==0x1;if(!_0x8eb8b7){if(ut['totalGlobal'](_0x3c02d6)>=_0x2301a8[_0x9059('0x77')]){_0x54ff79=ut[_0x9059('0x78')](_0x3c02d6,0x12,_0x9059('0x79'));rpcDb[_0x9059('0x61')](_0x54ff79,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x9059('0x61')](_0x3c02d6,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x3c02d6['countnoanswerretry']++;_0x6772d0['incrementPreviewCounters']({'id':_0x3c02d6[_0x9059('0x7f')],'field':{'countnoanswerretry':_0x3c02d6[_0x9059('0xa8')]}})[_0x9059('0x50')](function(){_0x6772d0['swapAdditionalPhones'](_0x3c02d6,_0x1e2c60,_0x5d97e6)[_0x9059('0x50')](function(){});});}});delete this['actions'][_0x259068[_0x9059('0x7d')]];break;case'19':_0x2301a8[_0x9059('0xc4')]+=0x1;_0x3c02d6[_0x9059('0x6e')]=ut[_0x9059('0x6f')](_0x3c02d6);ut['logCustomer'](_0x3c02d6,0x13,_0x259068[_0x9059('0xc6')]||_0x259068[_0x9059('0xca')]);ami['emit']('custom:amd',ut[_0x9059('0x86')](_0x3c02d6,_0x9059('0xc8')));rpcDb[_0x9059('0x5d')](_0x3c02d6,_0x9059('0xcb'));_0x6772d0[_0x9059('0x73')](_0x3c02d6,'18',_0x2301a8)[_0x9059('0x50')](function(_0xea950f){_0x8eb8b7=_0xea950f[_0x9059('0x74')]==0x1;if(!_0x8eb8b7){if(ut[_0x9059('0x6f')](_0x3c02d6)>=_0x2301a8[_0x9059('0x77')]){_0x54ff79=ut[_0x9059('0x78')](_0x3c02d6,0xf,_0x9059('0x79'));rpcDb[_0x9059('0x61')](_0x54ff79,_0x9059('0xcb'));}else{rpcDb[_0x9059('0x61')](_0x3c02d6,_0x9059('0xcb'));}}else{_0x3c02d6[_0x9059('0xa8')]++;_0x6772d0[_0x9059('0x9f')]({'id':_0x3c02d6[_0x9059('0x7f')],'field':{'countnoanswerretry':_0x3c02d6[_0x9059('0xa8')]}})[_0x9059('0x50')](function(){_0x6772d0[_0x9059('0x80')](_0x3c02d6,_0x1e2c60,_0x5d97e6)[_0x9059('0x50')](function(){});});}});delete this[_0x9059('0x3b')][_0x259068[_0x9059('0x7d')]];break;default:if(_0x3c02d6[_0x9059('0x3f')]){ut[_0x9059('0x8c')](_0x2301a8,_0x9059('0xcc'));ut[_0x9059('0x49')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2301a8[_0x9059('0x20')],_0x259068);}_0x2301a8[_0x9059('0xc4')]+=0x1;_0x3c02d6[_0x9059('0x6e')]=ut['totalGlobal'](_0x3c02d6);ut['logCustomer'](_0x3c02d6,0xc,_0x259068[_0x9059('0xc6')]||_0x259068[_0x9059('0xca')]);_0x1e2c60=_0x2301a8[_0x9059('0xb6')];_0x5d97e6=_0x2301a8[_0x9059('0x76')];rpcDb['createCustomerHistory'](_0x3c02d6,_0x9059('0xcd'));_0x6772d0[_0x9059('0x73')](_0x3c02d6,'20',_0x2301a8)[_0x9059('0x50')](function(_0x362fe5){_0x8eb8b7=_0x362fe5[_0x9059('0x74')]==0x1;if(!_0x8eb8b7){if(ut[_0x9059('0x6f')](_0x3c02d6)>=_0x2301a8['dialGlobalMaxRetry']){_0x54ff79=ut[_0x9059('0x78')](_0x3c02d6,0xf,'Global');rpcDb[_0x9059('0x61')](_0x54ff79,_0x9059('0xce'));}else{rpcDb['createCustomerFinal'](_0x3c02d6,_0x9059('0xce'));}delete this[_0x9059('0x3b')][_0x259068[_0x9059('0x7d')]];}else{_0x6772d0[_0x9059('0x80')](_0x3c02d6,_0x1e2c60,_0x5d97e6)['then'](function(){});}});}if(!(_0x3c02d6[_0x9059('0x3f')]&&_0x554f93==='16')){ut['updateOriginated'](_0x2301a8,'[callProgressDetectingCustomer]');logger[_0x9059('0x1d')]('[originated][decrement][callProgressDetectingCustomer]',_0x3c02d6[_0x9059('0xcf')],'\x20Queue',_0x2301a8[_0x9059('0x20')],_0x9059('0x3d'),_0x2301a8[_0x9059('0x25')]);}if(_0x554f93!==_0x9059('0x81')){delete this[_0x9059('0x3b')][_0x259068[_0x9059('0x7d')]];delete this[_0x9059('0x3b')][_0x259068[_0x9059('0xd0')]];}_0x2301a8['queueSummaryCountersUpdated']=!![];}};Preview[_0x9059('0x2f')]['callProgressDetectingAgent']=function(_0x4f479a,_0x38a766,_0x39dd0b){if(_[_0x9059('0xd1')](_0x38a766)&&_0x9059('0xd2')!==typeof _0x38a766){return;}if(_['isUndefined'](_0x39dd0b)&&_0x9059('0xd2')!==typeof _0x39dd0b){return;}switch(_0x39dd0b[_0x9059('0xd3')]){case'0':ut[_0x9059('0xd4')](_0x4f479a,0x0,'NoSuchNumber');rpcDb[_0x9059('0xd5')](_0x4f479a,_0x9059('0xd6'));break;case'3':ut['logAgent'](_0x4f479a,0x3,_0x9059('0xa2'));rpcDb['createAgentHistory'](_0x4f479a,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x4f479a,0x5,'Busy');rpcDb[_0x9059('0xd5')](_0x4f479a,_0x9059('0xd7'));break;case'8':ut['logAgent'](_0x4f479a,0x8,_0x9059('0xac'));rpcDb[_0x9059('0xd5')](_0x4f479a,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x9059('0xd4')](_0x4f479a,0x16,_0x9059('0xd8'));rpcDb[_0x9059('0xd5')](_0x4f479a,_0x9059('0xd9'));break;default:ut[_0x9059('0xd4')](_0x4f479a,0xc,_0x39dd0b[_0x9059('0xd3')]);rpcDb['createAgentHistory'](_0x4f479a,_0x9059('0xda'));}ut[_0x9059('0x46')](_0x38a766,_0x9059('0xdb'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x4f479a[_0x9059('0xcf')],'\x20Queue',_0x38a766[_0x9059('0x20')],_0x9059('0x3d'),_0x38a766[_0x9059('0x25')]);delete this[_0x9059('0x3b')][_0x4f479a[_0x9059('0xcf')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0xa253b7,_0x487b60,_0x499493){return cmHopperAdditionalPhone[_0x9059('0x73')](_0xa253b7,_0x487b60,_0x499493)[_0x9059('0x44')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x9059('0x2f')]['swapAdditionalPhones']=function(_0x55f46e,_0x3c75a5,_0x4246a2){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x55f46e,_0x3c75a5,_0x4246a2)[_0x9059('0x44')](logger[_0x9059('0x1d')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0x9059('0x9f')]=function(_0xc06c89){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x9059('0x9f')](_0xc06c89))[_0x9059('0x44')](logger[_0x9059('0x1d')](_0x9059('0xdc')));};Preview[_0x9059('0x2f')][_0x9059('0xdd')]=function(_0x87a80e,_0x22db7a,_0x57df12,_0x1b2599,_0xf07dd2){var _0x2b2b7a=this;return new Promise(function(_0x6d3f5b,_0x19d3d8){if(_['isNil'](_0x22db7a)||_[_0x9059('0x51')](_0x22db7a['Contact'])||_[_0x9059('0x51')](_0x22db7a[_0x9059('0xde')])||_['isNil'](_0x22db7a['VoiceQueueId'])){_0x19d3d8(ut['message'](_0x9059('0xdf'),_0x1b2599,_0xf07dd2));return;}var _0x5d7248=uuid['v4']();var _0x3f72db=_0x2b2b7a['campaignsPreview'][_0x22db7a[_0x9059('0xe0')][_0x9059('0x20')]];var _0x4cb2c3=_0x57df12?_0x2b2b7a[_0x9059('0x10')][_0x57df12]['id']:undefined;_0x2b2b7a[_0x9059('0x3b')][_0x5d7248]=new Action(_0x22db7a,_0x3f72db,_0x5d7248,_0x57df12,_0x4cb2c3);var _0x2fef8a=_0x2b2b7a[_0x9059('0x3b')][_0x5d7248];_0x2fef8a[_0x9059('0x7c')]=_0x1b2599;_0x2fef8a[_0x9059('0x9e')]=_0xf07dd2;_0x2fef8a[_0x9059('0xe1')]=_0x57df12;if(_['isEmpty'](_0x87a80e)){_0x2b2b7a[_0x9059('0xe2')](_0x2fef8a,_0x3f72db,_0x22db7a,_0x57df12)[_0x9059('0x50')](function(_0x3a0a0d){logger[_0x9059('0x1d')](_0x9059('0xe3'),_0x9059('0xe4')+_0x2fef8a[_0x9059('0x3c')]+_0x9059('0xe5')+_0x2fef8a[_0x9059('0x7f')],JSON['stringify'](_0x3a0a0d));ami[_0x9059('0x22')]('custom:agentcalled',ut[_0x9059('0x86')](_0x2fef8a,_0x9059('0xe6'),_0x2b2b7a[_0x9059('0x1c')][_0x2fef8a[_0x9059('0x3c')]]));_0x6d3f5b(ut[_0x9059('0x28')](_0x9059('0xe7')));})[_0x9059('0x44')](function(_0x2d32b1){ut[_0x9059('0x2c')](_0x9059('0xe8'),_0x2d32b1);_0x19d3d8(ut[_0x9059('0x28')]('Call\x20failed',_0x1b2599,_0xf07dd2));});}else{_0x3f72db[_0x9059('0xe9')]+=0x1;ut[_0x9059('0xea')](_0x2fef8a);rpcDb[_0x9059('0xeb')](_0x2fef8a,_0x9059('0xec'));delete _0x2b2b7a['actions'][_0x5d7248];_0x19d3d8(ut[_0x9059('0x28')](_0x9059('0xed'),_0x1b2599,_0xf07dd2));}});};Preview[_0x9059('0x2f')][_0x9059('0x67')]=function(_0xcc7b93){return!_['isNil'](_0xcc7b93)&&!_[_0x9059('0x51')](_0xcc7b93['name'])&&!_[_0x9059('0x51')](_0xcc7b93[_0x9059('0xee')])&&_0xcc7b93[_0x9059('0xee')]&&!_[_0x9059('0x51')](this['trunks'][util[_0x9059('0x1f')](_0x9059('0xef'),_0xcc7b93['name'])])&&!_[_0x9059('0x51')](this['trunks'][util[_0x9059('0x1f')]('SIP/%s',_0xcc7b93['name'])][_0x9059('0x43')])&&(this['trunks'][util[_0x9059('0x1f')](_0x9059('0xef'),_0xcc7b93[_0x9059('0x20')])][_0x9059('0x43')]===_0x9059('0xf0')||this[_0x9059('0xf')][util[_0x9059('0x1f')](_0x9059('0xef'),_0xcc7b93[_0x9059('0x20')])][_0x9059('0x43')]==='unmonitored');};Preview['prototype']['run']=function(_0x33bc24,_0x3f977c){return this[_0x9059('0xf1')](_0x33bc24,_0x3f977c)[_0x9059('0x50')](function(_0x5445de){return _['pick'](_0x5445de,[_0x9059('0x28')]);})[_0x9059('0x44')](function(_0xb3e561){if(_0xb3e561[_0x9059('0xf2')]){rpcDb[_0x9059('0xf3')](_0x33bc24);}if(_0xb3e561[_0x9059('0xee')]){rpcDb['disableContact'](_0x33bc24);}throw _[_0x9059('0xf4')](_0xb3e561,[_0x9059('0x28')]);});};Preview[_0x9059('0x2f')][_0x9059('0xf1')]=function(_0x1b9030,_0x40ce23){var _0x15ba55=this;var _0x28c290,_0x240502;return rpcDb[_0x9059('0xf5')](_0x1b9030)['then'](function(_0xb32d13){if(!_['isNil'](_0xb32d13[0x0])){_0x240502=_0xb32d13[0x0][_0x9059('0xf6')]?![]:!![];_0x28c290=_0xb32d13[0x0][_0x9059('0xf6')]?!![]:![];_0x28c290=_0x40ce23?!![]:_0x28c290;}var _0x32c15c=_0x15ba55[_0x9059('0xf7')](_0xb32d13);if(_0x32c15c['isValid']){rpcDb[_0x9059('0xf8')](_[_0x9059('0xf4')](_0xb32d13[0x0],['VoiceQueueId',_0x9059('0xde')]))[_0x9059('0x50')](function(_0x26809b){_0x15ba55['checkInBlack'](_0x26809b,_0xb32d13[0x0],_0x40ce23,_0x240502,_0x28c290)[_0x9059('0x50')](function(_0x30794f){return _0x30794f;})[_0x9059('0x44')](function(_0x535a1a){throw _0x535a1a;});})[_0x9059('0x44')](function(_0x2703b){ut['logger'](_0x9059('0xf9'),_0x2703b);throw ut[_0x9059('0x28')](_0x9059('0xfa'),_0x240502,_0x28c290);});}else{throw ut[_0x9059('0x28')](_0x32c15c[_0x9059('0x28')],_0x240502,_0x28c290);}})[_0x9059('0x44')](function(_0x47dc75){ut['logger'](_0x9059('0xfb'),_0x47dc75);throw ut[_0x9059('0x28')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x9059('0x2f')][_0x9059('0xf7')]=function(_0x113bc7){if(_[_0x9059('0x51')](_0x113bc7)||_[_0x9059('0xfc')](_0x113bc7)||!_[_0x9059('0x51')](_0x113bc7[0x0][_0x9059('0x54')])&&_[_0x9059('0x51')](_0x113bc7[0x0][_0x9059('0x54')]['name'])){ut[_0x9059('0x2c')](_0x9059('0xfd'),_0x113bc7);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x406bbf=this[_0x9059('0x1c')][_0x113bc7[0x0][_0x9059('0xe0')]['name']];_0x406bbf['message']=utils[_0x9059('0x2b')][_0x9059('0x6a')];if(_[_0x9059('0x51')](_0x406bbf)){ut[_0x9059('0x2c')](_0x9059('0xfe'),_0x406bbf);return{'isValid':![],'message':_0x9059('0xff')};}if(!this[_0x9059('0x67')](_0x406bbf['Trunk'])){ut[_0x9059('0x2c')](_0x9059('0x100'),'campaign\x20Name:\x20'+_0x406bbf[_0x9059('0x20')]+_0x9059('0x101'));if(!this[_0x9059('0x67')](_0x406bbf['TrunkBackup'])){ut['logger'](_0x9059('0x100'),_0x406bbf[_0x9059('0x20')]+_0x9059('0x102'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x406bbf[_0x9059('0x37')])){ut[_0x9059('0x2c')](_0x9059('0x103'),_0x406bbf[_0x9059('0x20')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x406bbf[_0x9059('0x20')]+_0x9059('0x104')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x9059('0xe2')]=function(_0x4fd9d9,_0x170959,_0x5af1f1,_0x15d77d){var _0x202445=this;return new Promise(function(_0xa3d418,_0xf7f465){var _0x79086f=_0x4fd9d9[_0x9059('0xcf')];var _0x1176e2=_0x202445['isTrunkReachable'](_0x170959['Trunk'])?util['format']('SIP/%s/%s%s',_0x170959[_0x9059('0x68')][_0x9059('0x20')],_[_0x9059('0x51')](_0x170959[_0x9059('0x105')])?'':_0x170959[_0x9059('0x105')][_0x9059('0x106')]()||'',_0x170959[_0x9059('0x107')]>0x0?_0x5af1f1[_0x9059('0xde')]['substring'](_0x170959[_0x9059('0x107')]):_0x5af1f1[_0x9059('0xde')]):util[_0x9059('0x1f')](_0x9059('0x108'),_['isNil'](_0x170959['TrunkBackup'])?_0x170959[_0x9059('0x68')][_0x9059('0x20')]:_0x170959[_0x9059('0x69')]['name'],_['isNil'](_0x170959[_0x9059('0x105')])?'':_0x170959['dialPrefix'][_0x9059('0x106')]()||'',_0x170959[_0x9059('0x107')]>0x0?_0x5af1f1[_0x9059('0xde')][_0x9059('0x109')](_0x170959[_0x9059('0x107')]):_0x5af1f1[_0x9059('0xde')]);var _0x32feba=_0x202445[_0x9059('0x67')](_0x170959[_0x9059('0x68')])?ut['getCallerId'](_0x170959[_0x9059('0x68')][_0x9059('0x10a')],_0x170959[_0x9059('0x10b')],_0x170959[_0x9059('0x10c')]>0x0?ut['getCallerIdRandom'](_0x170959[_0x9059('0x10d')],_0x170959[_0x9059('0x10c')]):_0x170959[_0x9059('0x10d')]):ut[_0x9059('0x10e')](_[_0x9059('0x51')](_0x170959[_0x9059('0x69')])?_0x170959[_0x9059('0x68')][_0x9059('0x10a')]:_0x170959[_0x9059('0x69')]['callerid'],_0x170959[_0x9059('0x10b')],_0x170959[_0x9059('0x10c')]>0x0?ut[_0x9059('0x10f')](_0x170959['dialOriginateCallerIdNumber'],_0x170959['dialRandomLastDigitCallerIdNumber']):_0x170959[_0x9059('0x10d')]);if(_0x32feba){_0x4fd9d9[_0x9059('0x110')]=ut[_0x9059('0x111')](_0x32feba);_0x4fd9d9[_0x9059('0x112')]=ut['extractCalleridNumber'](_0x32feba);}var _0x38d876=ut[_0x9059('0x113')](_0x170959,_0x5af1f1,_0x1176e2,_0x32feba,_0x79086f,_0x4fd9d9);var _0xe5624f=utils[_0x9059('0x114')](_0x5af1f1[_0x9059('0x115')]);Object['assign'](_0x38d876,_0xe5624f);_[_0x9059('0x116')](_0x4fd9d9,ut[_0x9059('0x117')](_0x38d876));_0x4fd9d9[_0x9059('0x58')]=moment()[_0x9059('0x1f')](_0x9059('0x118'));_0x170959['variables']=_0x38d876;var _0x76f7d5=ut[_0x9059('0x119')](_0x4fd9d9,_0x170959,_0x38d876,_0x4fd9d9['activeContact'],_0x15d77d);return ami['Action'](_0x76f7d5)[_0x9059('0x50')](function(_0x50af28){_0x170959[_0x9059('0x25')]+=0x1;logger[_0x9059('0x1d')](_0x9059('0x11a'),_0x79086f,_0x9059('0x11b'),_0x170959[_0x9059('0x20')],_0x9059('0x3d'),_0x170959[_0x9059('0x25')]);_0xa3d418(_0x50af28);})['catch'](function(_0x292d59){ut[_0x9059('0xd4')](_0x4fd9d9,0xe,_0x9059('0x11c'));rpcDb['createAgentHistory'](_0x4fd9d9,'[originateFailure][logOriginateFailure]');_0xf7f465(_0x292d59);});});};Preview[_0x9059('0x2f')][_0x9059('0x18')]=function(_0x24d581){if(this[_0x9059('0x3b')][_0x24d581[_0x9059('0x7d')]]){this[_0x9059('0x3b')][_0x24d581[_0x9059('0x7d')]]['channel']=_0x24d581[_0x9059('0x11d')];}};Preview[_0x9059('0x2f')][_0x9059('0x11e')]=function(_0x18615){var _0x283a24=this;var _0x1dfcfd=this[_0x9059('0x3b')][_0x18615[_0x9059('0x11f')]];if(_0x1dfcfd){if(_0x1dfcfd[_0x9059('0xe1')]&&this['agents'][_0x1dfcfd['lookAgent']]){ut[_0x9059('0x120')](_0x1dfcfd,this[_0x9059('0x10')][_0x1dfcfd[_0x9059('0xe1')]][_0x9059('0x20')],this['agents'][_0x1dfcfd['lookAgent']]['id']);}var _0x192ade=_[_0x9059('0x121')](_0x1dfcfd);_0x192ade['responsetime']=moment()['format'](_0x9059('0x118'));var _0xa0548e=_0x283a24[_0x9059('0x1c')][_0x1dfcfd['queue']];if(ut['isFailure'](_0x18615[_0x9059('0x122')])){if(_0x1dfcfd[_0x9059('0x7c')]){rpcDb[_0x9059('0xf3')](_0x1dfcfd[_0x9059('0x7f')]);}if(_0x1dfcfd[_0x9059('0x9e')]){rpcDb[_0x9059('0x123')](_0x1dfcfd['idContact']);}ami[_0x9059('0x22')](_0x9059('0x124'),ut['buildObj'](_0x1dfcfd,_0x9059('0x125'),this[_0x9059('0x1c')][_0x1dfcfd['queue']]));this['callProgressDetectingAgent'](_0x192ade,_0xa0548e,_0x18615);}else{_0x1dfcfd['starttime']=moment()[_0x9059('0x1f')](_0x9059('0x118'));ut[_0x9059('0xd4')](_0x192ade,0x4,_0x9059('0x8e'));rpcDb['createAgentHistory'](_0x192ade,_0x9059('0x126'));}}};Preview[_0x9059('0x2f')][_0x9059('0x14')]=function(_0x79d90){var _0x13f022=this[_0x9059('0x3b')][_0x79d90[_0x9059('0x7d')]];var _0x4b1b4f;if(_0x13f022){_0x4b1b4f=this[_0x9059('0x1c')][_0x13f022['queue']];logger[_0x9059('0x1d')](_0x9059('0x127'),_0x79d90[_0x9059('0x7d')],_0x9059('0x11b'),_0x4b1b4f[_0x9059('0x20')],_0x9059('0x3e'),_0x4b1b4f[_0x9059('0x26')]);}if(this[_0x9059('0x3b')][_0x79d90[_0x9059('0x7d')]]&&_0x79d90[_0x9059('0x7d')]!==_0x79d90[_0x9059('0xcf')]){if(_0x79d90[_0x9059('0x128')]==='16'&&this[_0x9059('0x3b')][_0x79d90[_0x9059('0x7d')]][_0x9059('0x3f')]){this[_0x9059('0x6b')](_0x79d90,_0x79d90[_0x9059('0x7d')],_0x79d90[_0x9059('0x128')]);}else if(this[_0x9059('0x3b')][_0x79d90[_0x9059('0x7d')]][_0x9059('0x3f')]){logger['info'](_0x9059('0x129'),_0x79d90[_0x9059('0x7d')],_0x79d90[_0x9059('0x128')],'\x20Queue',_0x4b1b4f[_0x9059('0x20')],_0x9059('0x3e'),_0x4b1b4f[_0x9059('0x26')]);this['callProgressDetectingCustomer'](_0x79d90,_0x79d90[_0x9059('0x7d')],_0x79d90[_0x9059('0x128')]);}}else if(_0x13f022&&_[_0x9059('0x51')](_0x13f022[_0x9059('0x12a')])&&_0x4b1b4f['dialQueueProject']&&_0x79d90[_0x9059('0x7d')]===_0x79d90[_0x9059('0xcf')]&&_[_0x9059('0x51')](_0x79d90[_0x9059('0xd3')])&&_0x79d90[_0x9059('0x128')]==='16'&&_0x79d90[_0x9059('0x12b')]==='6'&&_['isUndefined'](_0x13f022['transfer'])){if(_0x13f022[_0x9059('0x7c')]){rpcDb[_0x9059('0xf3')](_0x13f022[_0x9059('0x7f')]);}if(_0x13f022[_0x9059('0x9e')]){rpcDb[_0x9059('0x123')](_0x13f022['idContact']);}_0x79d90[_0x9059('0xd3')]='22';this[_0x9059('0x12c')](_0x13f022,_0x4b1b4f,_0x79d90);}else if(_0x13f022&&_0x13f022[_0x9059('0x12d')]){if(_0x79d90[_0x9059('0x128')]==='16'&&this[_0x9059('0x3b')][_0x79d90['linkedid']][_0x9059('0x3f')]){logger[_0x9059('0x1d')](_0x9059('0x12e'),_0x79d90[_0x9059('0x7d')],_0x79d90[_0x9059('0x128')],_0x9059('0x11b'),_0x4b1b4f[_0x9059('0x20')],_0x9059('0x3e'),_0x4b1b4f[_0x9059('0x26')]);this[_0x9059('0x6b')](_0x79d90,_0x79d90[_0x9059('0x7d')],_0x79d90[_0x9059('0x128')]);}else if(this[_0x9059('0x3b')][_0x79d90[_0x9059('0x7d')]][_0x9059('0x3f')]){logger['info'](_0x9059('0x129'),_0x79d90['linkedid'],_0x79d90[_0x9059('0x128')],_0x9059('0x11b'),_0x4b1b4f['name'],_0x9059('0x3e'),_0x4b1b4f['pTalking']);this[_0x9059('0x6b')](_0x79d90,_0x79d90[_0x9059('0x7d')],_0x79d90[_0x9059('0x128')]);}}};Preview[_0x9059('0x2f')][_0x9059('0x16')]=function(_0xea8c0f){if(this['actions'][_0xea8c0f[_0x9059('0xd0')]]&&_0xea8c0f[_0x9059('0xd0')]!==_0xea8c0f[_0x9059('0x12f')]){this[_0x9059('0x6b')](_0xea8c0f,_0xea8c0f[_0x9059('0xd0')],_0xea8c0f['dialstatus']);}};Preview[_0x9059('0x2f')][_0x9059('0x130')]=function(_0x3930c4){if(this[_0x9059('0x3b')][_0x3930c4[_0x9059('0x7d')]]&&_0x3930c4['linkedid']!==_0x3930c4[_0x9059('0xcf')]&&!this[_0x9059('0x3b')][_0x3930c4[_0x9059('0x7d')]][_0x9059('0x3f')]){if(_0x3930c4[_0x9059('0x128')]==='1'){this[_0x9059('0x6b')](_0x3930c4,_0x3930c4[_0x9059('0x7d')],_0x3930c4['cause']);}}};Preview[_0x9059('0x2f')][_0x9059('0x131')]=function(_0x352578,_0x15db3c,_0x51226d){if(this[_0x9059('0x3b')][_0x352578]){if(_[_0x9059('0x51')](this[_0x9059('0x3b')][_0x352578][_0x9059('0x132')])){this[_0x9059('0x3b')][_0x352578][_0x9059('0x132')]={};}this['actions'][_0x352578][_0x9059('0x132')][_0x15db3c]=_0x51226d;}};Preview[_0x9059('0x2f')][_0x9059('0x133')]=function(_0x79e9e6){try{if(!_[_0x9059('0x51')](_0x79e9e6)){if(ut['filterKey'](_['keys'](_0x79e9e6[_0x9059('0x134')])[0x0])){this[_0x9059('0x131')](_0x79e9e6[_0x9059('0xcf')],_[_0x9059('0x135')](_0x79e9e6['variable'])[0x0],_0x79e9e6[_0x9059('0x136')]);}}}catch(_0x10c319){logger[_0x9059('0x137')](_0x9059('0x138'),util['inspect'](_0x10c319,{'showHidden':![],'depth':null}));}};Preview[_0x9059('0x2f')]['syncAttendedTransfer']=function(_0x1b501b){if(_0x1b501b){if(this[_0x9059('0x3b')][_0x1b501b['transfertargetlinkedid']]){this['actions'][_0x1b501b['transfertargetlinkedid']][_0x9059('0x12d')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x2cbbf5){if(_0x2cbbf5){if(this[_0x9059('0x3b')][_0x2cbbf5[_0x9059('0x139')]]){this[_0x9059('0x3b')][_0x2cbbf5[_0x9059('0x139')]][_0x9059('0x12d')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 5498d1c..271cef6 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 _0x396f=['catch','[createHistory]\x20','resolve','then','[moveContactManagedDialer]\x20','getContactPreview','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','createHistory'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x396f,0x184));var _0xf396=function(_0x2b574d,_0x423dd2){_0x2b574d=_0x2b574d-0x0;var _0x5f1526=_0x396f[_0x2b574d];return _0x5f1526;};'use strict';var util=require(_0xf396('0x0'));var BPromise=require(_0xf396('0x1'));var logger=require('../../../config/logger')(_0xf396('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xf396('0x3'));var cmHopperBlack=require(_0xf396('0x4'));var agentReportPreview=require(_0xf396('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x57cf5e){return function(_0x385caf){logger[_0xf396('0x6')](_0x57cf5e,util['inspect'](_0x385caf,{'showHidden':![],'depth':null}));};}function create(_0xfb7426){return cmHopperHistory[_0xf396('0x7')](_0xfb7426)[_0xf396('0x8')](loggerCatch(_0xf396('0x9')));}function createAgent(_0xe8bf2c){return BPromise[_0xf396('0xa')]()[_0xf396('0xb')](agentReportPreview[_0xf396('0x7')](_0xe8bf2c))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5de8cc){return cmHopper['moveContactManagedDialer'](_0x5de8cc,!![])[_0xf396('0x8')](loggerCatch(_0xf396('0xc')));}exports['checkIsBlackList']=function(_0x36d936){return cmHopperBlack['checkIsBlackList'](_0x36d936)[_0xf396('0x8')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xf396('0xd')]=function(_0x3c8e67){return BPromise[_0xf396('0xa')]()[_0xf396('0xb')](cmHopper[_0xf396('0xd')](_0x3c8e67))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xf396('0x7')]=function(_0x36c186,_0x9bd869){create(_0x36c186)[_0xf396('0x8')](loggerCatch(_0x9bd869));moveContact(_0x36c186)[_0xf396('0x8')](loggerCatch(_0x9bd869));};exports['createAgentHistory']=function(_0x30f48e,_0x2c33f4){createAgent(_0x30f48e)[_0xf396('0x8')](loggerCatch(_0x2c33f4));};exports['createCustomerHistory']=function(_0x4ffa8e,_0x77d51){create(_0x4ffa8e)[_0xf396('0x8')](loggerCatch(_0x77d51));};exports['createCustomerFinal']=function(_0x112c23,_0x4104fd){moveContact(_0x112c23)[_0xf396('0x8')](loggerCatch(_0x4104fd));};exports[_0xf396('0xe')]=function(_0x1a872a,_0xa1aba1,_0x4b8df2){if(_0xa1aba1){_0x1a872a[_0xf396('0xf')]=null;}if(_0x4b8df2){_0x1a872a[_0xf396('0x10')]=![];}return cmHopper[_0xf396('0xe')](_0x1a872a)[_0xf396('0x8')](loggerCatch(_0xf396('0x11')));};exports[_0xf396('0x12')]=function(_0xa41817){return cmHopper[_0xf396('0x12')](_0xa41817)[_0xf396('0x8')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x4da6e4){return cmHopper[_0xf396('0x13')]({'UserId':null},_0x4da6e4,0x1)['catch'](loggerCatch(_0xf396('0x14')));};exports['disableContact']=function(_0x287b5c){return cmHopper['unlockContact']({'active':![]},_0x287b5c,0x1)[_0xf396('0x8')](loggerCatch(_0xf396('0x15')));};exports['crateCustomerReportQueue']=function(_0x5a3fbc){var _0x39b36e={};_0x39b36e['type']=_0x5a3fbc[_0xf396('0x16')];_0x39b36e[_0xf396('0x17')]=_0x5a3fbc[_0xf396('0x17')];_0x39b36e[_0xf396('0x18')]=_0x5a3fbc[_0xf396('0x18')];_0x39b36e['calleridname']=_0x5a3fbc[_0xf396('0x19')];_0x39b36e['queue']=_0x5a3fbc[_0xf396('0x1a')];_0x39b36e[_0xf396('0x1b')]=_0x5a3fbc[_0xf396('0x1c')];_0x39b36e[_0xf396('0x1d')]=_0x5a3fbc[_0xf396('0x1c')];_0x39b36e[_0xf396('0x1e')]=0x1;_0x39b36e[_0xf396('0x1f')]=_0x5a3fbc[_0xf396('0x20')];_0x39b36e[_0xf396('0x21')]=_0x5a3fbc['membername'];_0x39b36e['context']=_0xf396('0x22');_0x39b36e['exten']=_0xf396('0x23');_0x39b36e[_0xf396('0x24')]=0x0;_0x39b36e[_0xf396('0x25')]=0x1;_0x39b36e[_0xf396('0x26')]=_0x5a3fbc[_0xf396('0x27')];_0x39b36e['queuecallerexitreason']='COMPLETED';return BPromise['resolve']()[_0xf396('0xb')](voiceQueueReport['create'](_0x39b36e))[_0xf396('0x8')](loggerCatch(_0xf396('0x28')));};exports[_0xf396('0x29')]=function(_0x3dccb7,_0x42e94e){return BPromise[_0xf396('0xa')]()['then'](cmHopper['getContactRecallMe'](_0x3dccb7,_0x42e94e))[_0xf396('0x8')](loggerCatch(_0xf396('0x2a')));};exports['rescheduleContactInQueue']=function(_0x5db681){return cmHopper[_0xf396('0xe')](_0x5db681,!![],!![])[_0xf396('0x8')](loggerCatch(_0xf396('0x2b')));}; \ No newline at end of file +var _0xf606=['../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','holdtime','assigned','lastAssignedTo','queuecallerexitreason','then','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird'];(function(_0x331446,_0xb02df5){var _0x2d17bd=function(_0x1eecd1){while(--_0x1eecd1){_0x331446['push'](_0x331446['shift']());}};_0x2d17bd(++_0xb02df5);}(_0xf606,0x142));var _0x6f60=function(_0x597070,_0x3f577b){_0x597070=_0x597070-0x0;var _0xea6b05=_0xf606[_0x597070];return _0xea6b05;};'use strict';var util=require(_0x6f60('0x0'));var BPromise=require(_0x6f60('0x1'));var logger=require(_0x6f60('0x2'))(_0x6f60('0x3'));var cmHopper=require(_0x6f60('0x4'));var cmHopperHistory=require(_0x6f60('0x5'));var cmHopperBlack=require(_0x6f60('0x6'));var agentReportPreview=require(_0x6f60('0x7'));var voiceQueueReport=require(_0x6f60('0x8'));function loggerCatch(_0x40bdab){return function(_0xf083c8){logger[_0x6f60('0x9')](_0x40bdab,util[_0x6f60('0xa')](_0xf083c8,{'showHidden':![],'depth':null}));};}function create(_0x20ad60){return cmHopperHistory[_0x6f60('0xb')](_0x20ad60)[_0x6f60('0xc')](loggerCatch(_0x6f60('0xd')));}function createAgent(_0x26e2e7){return BPromise[_0x6f60('0xe')]()['then'](agentReportPreview[_0x6f60('0xb')](_0x26e2e7))[_0x6f60('0xc')](loggerCatch(_0x6f60('0xd')));}function moveContact(_0x271be3){return cmHopper[_0x6f60('0xf')](_0x271be3,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x6f60('0x10')]=function(_0x2f9a5b){return cmHopperBlack[_0x6f60('0x10')](_0x2f9a5b)[_0x6f60('0xc')](loggerCatch(_0x6f60('0x11')));};exports[_0x6f60('0x12')]=function(_0x2e4736){return BPromise['resolve']()['then'](cmHopper[_0x6f60('0x12')](_0x2e4736))[_0x6f60('0xc')](loggerCatch(_0x6f60('0x13')));};exports[_0x6f60('0xb')]=function(_0x335561,_0x502fd7){create(_0x335561)[_0x6f60('0xc')](loggerCatch(_0x502fd7));moveContact(_0x335561)['catch'](loggerCatch(_0x502fd7));};exports[_0x6f60('0x14')]=function(_0x4a6ccd,_0x5166be){createAgent(_0x4a6ccd)[_0x6f60('0xc')](loggerCatch(_0x5166be));};exports['createCustomerHistory']=function(_0x580201,_0x1565e6){create(_0x580201)[_0x6f60('0xc')](loggerCatch(_0x1565e6));};exports[_0x6f60('0x15')]=function(_0x3ce20c,_0xe25460){moveContact(_0x3ce20c)[_0x6f60('0xc')](loggerCatch(_0xe25460));};exports['rescheduleContact']=function(_0x56e107,_0x4b6293,_0x358798){if(_0x4b6293){_0x56e107['UserId']=null;}if(_0x358798){_0x56e107['active']=![];}return cmHopper[_0x6f60('0x16')](_0x56e107)['catch'](loggerCatch(_0x6f60('0x17')));};exports[_0x6f60('0x18')]=function(_0x2c545c){return cmHopper[_0x6f60('0x18')](_0x2c545c)['catch'](loggerCatch(_0x6f60('0x19')));};exports[_0x6f60('0x1a')]=function(_0x3456ff){return cmHopper[_0x6f60('0x1a')]({'UserId':null},_0x3456ff,0x1)['catch'](loggerCatch(_0x6f60('0x1b')));};exports[_0x6f60('0x1c')]=function(_0x4c25ce){return cmHopper[_0x6f60('0x1a')]({'active':![]},_0x4c25ce,0x1)['catch'](loggerCatch(_0x6f60('0x1d')));};exports['crateCustomerReportQueue']=function(_0x4e74b7){var _0x2a06d9={};_0x2a06d9[_0x6f60('0x1e')]=_0x4e74b7[_0x6f60('0x1e')];_0x2a06d9[_0x6f60('0x1f')]=_0x4e74b7[_0x6f60('0x1f')];_0x2a06d9[_0x6f60('0x20')]=_0x4e74b7[_0x6f60('0x20')];_0x2a06d9[_0x6f60('0x21')]=_0x4e74b7[_0x6f60('0x21')];_0x2a06d9[_0x6f60('0x22')]=_0x4e74b7[_0x6f60('0x22')];_0x2a06d9['queuecallerjoinAt']=_0x4e74b7[_0x6f60('0x23')];_0x2a06d9[_0x6f60('0x24')]=_0x4e74b7[_0x6f60('0x23')];_0x2a06d9[_0x6f60('0x25')]=0x1;_0x2a06d9[_0x6f60('0x26')]=_0x4e74b7['endtime'];_0x2a06d9[_0x6f60('0x27')]=_0x4e74b7[_0x6f60('0x28')];_0x2a06d9[_0x6f60('0x29')]=_0x6f60('0x2a');_0x2a06d9['exten']='xcally-motion-preview';_0x2a06d9[_0x6f60('0x2b')]=0x0;_0x2a06d9[_0x6f60('0x2c')]=0x1;_0x2a06d9[_0x6f60('0x2d')]=_0x4e74b7[_0x6f60('0x28')];_0x2a06d9[_0x6f60('0x2e')]='COMPLETED';return BPromise[_0x6f60('0xe')]()[_0x6f60('0x2f')](voiceQueueReport[_0x6f60('0x30')](_0x2a06d9))[_0x6f60('0xc')](loggerCatch(_0x6f60('0x31')));};exports['getContactRecallMe']=function(_0x372691,_0x503f1f){return BPromise[_0x6f60('0xe')]()[_0x6f60('0x2f')](cmHopper[_0x6f60('0x32')](_0x372691,_0x503f1f))[_0x6f60('0xc')](loggerCatch(_0x6f60('0x33')));};exports[_0x6f60('0x34')]=function(_0x370eba){return cmHopper[_0x6f60('0x16')](_0x370eba,!![],!![])['catch'](loggerCatch(_0x6f60('0x35')));}; \ 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 23c99cd..78ba5db 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 _0xd470=['originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','ringtime','logLookAgent','membername','UserId','logCustomer','getSeconds','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','originate','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','channelAgent','uniqueid','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','pow','random','extractCalleridNumber','match','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','loggerCatch','logger','info','inspect','loggerError','error','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd470,0x65));var _0x0d47=function(_0x16772c,_0x28d700){_0x16772c=_0x16772c-0x0;var _0x5e019a=_0xd470[_0x16772c];return _0x5e019a;};'use strict';var util=require('util');var _=require(_0x0d47('0x0'));var moment=require(_0x0d47('0x1'));var logger=require(_0x0d47('0x2'))(_0x0d47('0x3'));var ipAgi=process[_0x0d47('0x4')]['XCALLY_IP_AGI']||_0x0d47('0x5');var utils=require(_0x0d47('0x6'));exports[_0x0d47('0x7')]=function(_0x1c4f0c){return function(_0xf7b3dc){logger['error'](_0x1c4f0c,util['inspect'](_0xf7b3dc,{'showHidden':![],'depth':null}));};};exports[_0x0d47('0x8')]=function(_0x5848b0,_0x201211){logger[_0x0d47('0x9')](_0x5848b0,util[_0x0d47('0xa')](_0x201211,{'showHidden':![],'depth':null}));};exports[_0x0d47('0xb')]=function(_0x30cd33,_0x4b347d){logger[_0x0d47('0xc')](_0x30cd33,util[_0x0d47('0xa')](_0x4b347d,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2929c4){return function(_0x321815){logger[_0x0d47('0x9')](_0x2929c4,util['inspect'](_0x321815,{'showHidden':![],'depth':null}));};};exports[_0x0d47('0xd')]=function(_0x2126cb,_0x3bc943,_0x1a7d36){return{'message':_0x2126cb,'unlock':_0x3bc943,'active':_0x1a7d36};};exports[_0x0d47('0xe')]=function(_0x3e31b6,_0x1558e0,_0x516c5f){if(!_[_0x0d47('0xf')](_0x516c5f)&&_0x0d47('0x10')===typeof _0x516c5f&&!_[_0x0d47('0x11')](_0x516c5f)){if(!_[_0x0d47('0xf')](_0x1558e0)&&'string'===typeof _0x1558e0&&!_[_0x0d47('0x11')](_0x1558e0)){return util[_0x0d47('0x12')]('\x22%s\x22\x20<%s>',_0x1558e0,_0x516c5f);}return util[_0x0d47('0x12')](_0x0d47('0x13'),_0x516c5f,_0x516c5f);}if(!_[_0x0d47('0xf')](_0x3e31b6)&&_0x0d47('0x10')===typeof _0x3e31b6&&!_[_0x0d47('0x11')](_0x3e31b6)){return _0x3e31b6;}return _0x0d47('0x14');};exports[_0x0d47('0x15')]=function(_0x19a8e3){if(_[_0x0d47('0x16')](_0x19a8e3)){return![];}return _0x19a8e3;};exports[_0x0d47('0x17')]=function(_0x20c124,_0x3d2252,_0x45264a,_0x18085e,_0x573708,_0x594d65){var _0x1c7413={'XMD-QUEUE':_0x3d2252[_0x0d47('0x18')]?_0x3d2252[_0x0d47('0x18')][_0x0d47('0x19')]:'','XMD-CALLERID':_0x18085e,'XMD-CALLERID-PREVIEW':_0x594d65?util['format'](_0x0d47('0x13'),_0x594d65[_0x0d47('0x1a')],_0x594d65[_0x0d47('0x1b')]):_0x18085e,'XMD-DIALID':_0x573708,'XMD-CONTACTID':_0x3d2252[_0x0d47('0x1c')],'XMD-CDRTYPE':_0x0d47('0x1d'),'CALLERID(all)':_0x18085e,'XMD-VOICEQUEUEID':_0x3d2252[_0x0d47('0x1e')],'XMD-DIALCHANNEL':_0x45264a,'XMD-DIALTIMEOUT':_0x20c124[_0x0d47('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x0d47('0x12')]('\x22rtTxX%s%s\x22',_0x20c124['dialQueueProject2']?'g':'',_[_0x0d47('0x11')](_0x20c124[_0x0d47('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x20c124[_0x0d47('0x21')]||'','XMD-AGI':_0x20c124['dialQueueProject']?util[_0x0d47('0x12')](_0x0d47('0x22'),ipAgi,_0x20c124[_0x0d47('0x23')]):_0x0d47('0x24'),'XMD-AGIAFTER':_0x20c124[_0x0d47('0x25')]?util['format'](_0x0d47('0x22'),ipAgi,_0x20c124[_0x0d47('0x25')]):_0x0d47('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x594d65?_0x594d65[_0x0d47('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x594d65?_0x594d65['originatecalleridname']:'','XMD-DESTINATION':_0x0d47('0x27'),'SIPADDHEADER':_0x0d47('0x28')};if(!_['isEmpty'](_0x20c124[_0x0d47('0x20')])){_0x1c7413[util[_0x0d47('0x12')]('%s',_0x0d47('0x29'))]=_0x20c124[_0x0d47('0x20')];_0x1c7413[util[_0x0d47('0x12')]('%s',_0x0d47('0x2a'))]=_0x573708;}return _0x1c7413;};exports[_0x0d47('0x2b')]=function(_0x57487c){var _0x38f5a5={};for(var _0x48e615 in _0x57487c){if(_0x57487c[_0x0d47('0x2c')](_0x48e615)){_0x38f5a5[util[_0x0d47('0x12')]('%s',_[_0x0d47('0x2d')](_0x48e615))]=_0x57487c[_0x48e615];}}return{'variables':_0x38f5a5};};exports[_0x0d47('0x2e')]=function(_0x3b6978,_0xbfc699){if(!_[_0x0d47('0x16')](_0x3b6978)){if(_0x3b6978['hasOwnProperty'](_0x0d47('0x2f'))){if(_0x3b6978[_0x0d47('0x2f')]>0x0){_0x3b6978['originated']-=0x1;}else{logger['error'](_0x0d47('0x30'),_0xbfc699);}}}else{logger[_0x0d47('0xc')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0xbfc699);}};exports[_0x0d47('0x31')]=function(_0x169cf4){var _0x4b68d0=moment()[_0x0d47('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x169cf4['state']=0xd;_0x169cf4[_0x0d47('0x32')]=_0x0d47('0x33');_0x169cf4[_0x0d47('0x34')]=_0x4b68d0;_0x169cf4[_0x0d47('0x35')]=_0x4b68d0;_0x169cf4[_0x0d47('0x36')]=_0x4b68d0;};exports[_0x0d47('0x37')]=function(_0xa1263,_0x1a377e,_0x47851e){var _0x4aa8fb=moment()[_0x0d47('0x12')](_0x0d47('0x38'));_0xa1263[_0x0d47('0x39')]=_0x1a377e;_0xa1263[_0x0d47('0x32')]=_0x47851e;_0xa1263['responsetime']=_0x4aa8fb;_0xa1263[_0x0d47('0x3a')]=utils['getSeconds'](_0xa1263[_0x0d47('0x35')],_0xa1263['starttime']);};exports[_0x0d47('0x3b')]=function(_0x32be01,_0x8d3c9d,_0x563dab){_0x32be01[_0x0d47('0x3c')]=_0x8d3c9d;_0x32be01[_0x0d47('0x3d')]=_0x563dab;};exports[_0x0d47('0x3e')]=function(_0x402b18,_0x125740,_0x1b3cda){var _0x3c6493=moment()[_0x0d47('0x12')](_0x0d47('0x38'));_0x402b18['state']=_0x125740;_0x402b18[_0x0d47('0x32')]=_0x1b3cda;_0x402b18['responsetime']=_0x402b18[_0x0d47('0x35')]?_0x402b18[_0x0d47('0x35')]:_0x3c6493;_0x402b18[_0x0d47('0x36')]=_0x402b18[_0x0d47('0x36')]?_0x402b18[_0x0d47('0x36')]:_0x3c6493;_0x402b18[_0x0d47('0x3a')]=utils[_0x0d47('0x3f')](_0x402b18[_0x0d47('0x35')]||0x0,_0x402b18[_0x0d47('0x34')]||0x0);_0x402b18[_0x0d47('0x40')]=_0x402b18[_0x0d47('0x41')]?utils[_0x0d47('0x3f')](_0x402b18['endtime'],_0x402b18['answertime']):0x0;};exports[_0x0d47('0x42')]=function(_0xc77e38){return _0xc77e38===_0x0d47('0x43');};exports[_0x0d47('0x44')]=function(_0x2cc671,_0x48f395,_0x599cbc,_0x353d4c,_0x357725){var _0x24c30b=_0x353d4c?_0x0d47('0x45'):_0x2cc671['calleridname'];_0x24c30b=_0x357725?_0x0d47('0x46'):_0x24c30b;return{'actionid':_0x2cc671['uniqueid'],'action':_0x0d47('0x47'),'channel':_0x2cc671['channelAgent'],'callerid':util[_0x0d47('0x12')](_0x0d47('0x13'),_0x24c30b,_0x2cc671[_0x0d47('0x1b')]),'Exten':_0x0d47('0x27'),'Context':'from-sip','Priority':'1','variable':_0x599cbc,'timeout':(_0x48f395[_0x0d47('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2cc671['uniqueid']};};exports[_0x0d47('0x49')]=function(_0x3449ac){return _0x3449ac['countbusyretry']+_0x3449ac[_0x0d47('0x4a')]+_0x3449ac[_0x0d47('0x4b')]+_0x3449ac[_0x0d47('0x4c')]+_0x3449ac[_0x0d47('0x4d')];};exports['cloneAction']=function(_0xb86d57){var _0x4d287a=_[_0x0d47('0x4e')](_0xb86d57);_0x4d287a[_0x0d47('0x39')]=0xf;_0x4d287a[_0x0d47('0x32')]=_0x0d47('0x4f');return _0x4d287a;};exports['scheduledAt']=function(_0xf4a000,_0x440757,_0x2fcf0c){var _0x4cc2f5={};_0x4cc2f5[_0x440757]=_0xf4a000[_0x440757];_0x4cc2f5[_0x0d47('0x50')]=![];_0x4cc2f5[_0x0d47('0x51')]=moment()[_0x0d47('0x52')](_0x2fcf0c,_0x0d47('0x53'))[_0x0d47('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x4cc2f5[_0x0d47('0x1c')]=_0xf4a000['ContactId'];_0x4cc2f5[_0x0d47('0x54')]=_0xf4a000[_0x0d47('0x54')];_0x4cc2f5[_0x0d47('0x1e')]=_0xf4a000[_0x0d47('0x1e')]||undefined;return _0x4cc2f5;};exports[_0x0d47('0x55')]=function(_0x2beb85,_0x10b0eb){if(!_['isNil'](_0x2beb85)){if(_0x2beb85[_0x0d47('0x56')]>0x0){_0x2beb85[_0x0d47('0x56')]-=0x1;}else{logger[_0x0d47('0xc')](_0x10b0eb,_0x0d47('0x57'));}}else{logger['error'](_0x10b0eb,_0x0d47('0x58'));}};exports['IsNotLoggedIn']=function(_0x4a72c0){if(_0x4a72c0<=0x0){return!![];}return![];};function buildObj(_0x3f24ce,_0x2d4edd,_0x18fb5c){_0x3f24ce['lastevent']=_0x2d4edd;_0x3f24ce['name']=_0x3f24ce[_0x0d47('0x59')];_0x3f24ce[_0x0d47('0x5a')]=_0x3f24ce['channelAgent'];_0x3f24ce[_0x0d47('0x5b')]=_0x0d47('0x5c');if(_0x18fb5c){_0x3f24ce['mandatoryDisposition']=_0x18fb5c[_0x0d47('0x5d')];}return _0x3f24ce;}exports[_0x0d47('0x5e')]=buildObj;exports[_0x0d47('0x5f')]=function(_0x59b7ef){var _0x1e028b={};_0x1e028b[_0x0d47('0x59')]=_0x59b7ef[_0x0d47('0x59')];_0x1e028b[_0x0d47('0x5a')]=_0x59b7ef[_0x0d47('0x60')];_0x1e028b[_0x0d47('0x61')]=_0x59b7ef['uniqueid'];return _0x1e028b;};exports[_0x0d47('0x62')]=function(_0x3f4062){var _0x34f997=[];for(var _0x2661e9 in _0x3f4062){if(_0x3f4062[_0x0d47('0x2c')](_0x2661e9)){if(!_[_0x0d47('0x16')](_0x3f4062[_0x2661e9])&&_0x3f4062[_0x2661e9]['state']===_0x0d47('0x63')&&_0x3f4062[_0x2661e9][_0x0d47('0x64')]===_0x0d47('0x65')){_0x34f997[_0x0d47('0x66')](_0x3f4062[_0x2661e9]['id']);}}}return _0x34f997;};exports[_0x0d47('0x67')]=function(_0x2668d8){var _0x3ba2b9=moment()[_0x0d47('0x68')](0x0);var _0x52e81d=moment(_0x2668d8)[_0x0d47('0x68')](0x0);return _0x3ba2b9[_0x0d47('0x69')](_0x52e81d,_0x0d47('0x6a'));};exports[_0x0d47('0x6b')]=function(_0x591a01){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x591a01[_0x0d47('0x1c')],'ListId':_0x591a01['ListId'],'VoiceQueueId':_0x591a01[_0x0d47('0x1e')]||undefined,'CampaignId':_0x591a01[_0x0d47('0x6c')]||undefined};};exports[_0x0d47('0x6d')]=function(_0x293836){if(_0x293836===_0x0d47('0x61')||_0x293836==='idContact'||_0x293836===_0x0d47('0x59')||_0x293836==='type'||_0x293836===_0x0d47('0x6e')||_0x293836===_0x0d47('0x6f')||_0x293836===_0x0d47('0x3c')||_0x293836===_0x0d47('0x60')||_0x293836===_0x0d47('0x1a')||_0x293836===_0x0d47('0x50')||_0x293836===_0x0d47('0x1b')||_0x293836===_0x0d47('0x51')||_0x293836==='countbusyretry'||_0x293836==='countcongestionretry'||_0x293836===_0x0d47('0x4b')||_0x293836===_0x0d47('0x70')||_0x293836===_0x0d47('0x71')||_0x293836===_0x0d47('0x72')||_0x293836==='callbackat'||_0x293836===_0x0d47('0x73')||_0x293836===_0x0d47('0x1c')||_0x293836===_0x0d47('0x54')||_0x293836===_0x0d47('0x3d')||_0x293836==='VoiceQueueId'||_0x293836==='sipcallid'||_0x293836===_0x0d47('0x74')||_0x293836===_0x0d47('0x75')||_0x293836===_0x0d47('0x76')||_0x293836===_0x0d47('0x77')||_0x293836===_0x0d47('0x78')||_0x293836===_0x0d47('0x79')||_0x293836===_0x0d47('0x7a')||_0x293836===_0x0d47('0x7b')||_0x293836===_0x0d47('0x7c')||_0x293836===_0x0d47('0x7d')||_0x293836===_0x0d47('0x7e')||_0x293836===_0x0d47('0x7f')||_0x293836==='xmd-agiafter'||_0x293836==='xmd-agi'||_0x293836==='rtpaudioqos'||_0x293836==='rtpaudioqosbridged'||_0x293836===_0x0d47('0x80')||_0x293836===_0x0d47('0x81')||_0x293836===_0x0d47('0x82')||_0x293836==='rtpaudioqoslossbridged'||_0x293836===_0x0d47('0x83')||_0x293836==='rtpaudioqosrttbridged'||_0x293836===_0x0d47('0x84')||_0x293836===_0x0d47('0x85')||_0x293836===_0x0d47('0x80')||_0x293836===_0x0d47('0x81')||_0x293836===_0x0d47('0x82')||_0x293836===_0x0d47('0x86')||_0x293836==='rtpaudioqosrtt'||_0x293836===_0x0d47('0x87')||_0x293836===_0x0d47('0x88')||_0x293836===_0x0d47('0x89')||_0x293836===_0x0d47('0x39')||_0x293836==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x523f6b,_0x330aff){var _0x2e8d17,_0x4c1a83,_0xc2201d;if(_0x330aff<=0x0){_0x330aff=0x1;}_0x2e8d17=new RegExp('\x5cw{0,'+_0x330aff+'}$');_0x4c1a83=Math[_0x0d47('0x8a')](0xa,_0x330aff-0x1);_0xc2201d=Math[_0x0d47('0x8a')](0xa,_0x330aff)-0x1;return util[_0x0d47('0x12')]('%s',_['replace'](_0x523f6b,_0x2e8d17,_[_0x0d47('0x8b')](_0x4c1a83,_0xc2201d)));};exports['extractCalleridName']=function(_0x3231e9){var _0x5241c3=_0x3231e9['match'](/"(.*?)"/);return _0x5241c3?_0x5241c3[0x1]:_0x3231e9;};exports[_0x0d47('0x8c')]=function(_0x534771){var _0x15d47b=_0x534771[_0x0d47('0x8d')](/<(.*?)>/);return _0x15d47b?_0x15d47b[0x1]:_0x534771;};function buildNoAnswerEventPayload(_0x58adfd,_0x4b184a){var _0x1cfd34=buildObj(_0x58adfd,_0x0d47('0x8e'));if(!_[_0x0d47('0x11')](_0x4b184a['variables'])){Object[_0x0d47('0x8f')](_0x4b184a[_0x0d47('0x90')])[_0x0d47('0x91')](function(_0x443d2a){_0x1cfd34[_0x443d2a[_0x0d47('0x92')]()]=_0x4b184a[_0x0d47('0x90')][_0x443d2a];});}return _0x1cfd34;}exports[_0x0d47('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x112b=['\x5cw{0,','pow','replace','random','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','error','inspect','logger','info','loggerError','logger2','string','isUndefined','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logCustomer','talktime','Failure','BOOKED','originate','channelAgent','xcally-motion-preview','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','interface','motionChannel','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','membername','scheduledat','countglobal','callback','callbackat','recallme','ListId','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x112b,0x95));var _0xb112=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x112b[_0x81dcac];return _0xc7803b;};'use strict';var util=require(_0xb112('0x0'));var _=require('lodash');var moment=require(_0xb112('0x1'));var logger=require(_0xb112('0x2'))(_0xb112('0x3'));var ipAgi=process[_0xb112('0x4')]['XCALLY_IP_AGI']||_0xb112('0x5');var utils=require(_0xb112('0x6'));exports['loggerCatch']=function(_0x546510){return function(_0x522caa){logger[_0xb112('0x7')](_0x546510,util[_0xb112('0x8')](_0x522caa,{'showHidden':![],'depth':null}));};};exports[_0xb112('0x9')]=function(_0x2a47e4,_0x4e472f){logger[_0xb112('0xa')](_0x2a47e4,util[_0xb112('0x8')](_0x4e472f,{'showHidden':![],'depth':null}));};exports[_0xb112('0xb')]=function(_0x513e39,_0x2212a8){logger[_0xb112('0x7')](_0x513e39,util[_0xb112('0x8')](_0x2212a8,{'showHidden':![],'depth':null}));};exports[_0xb112('0xc')]=function(_0x51b67d){return function(_0x17b737){logger['info'](_0x51b67d,util[_0xb112('0x8')](_0x17b737,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x25c0ff,_0x1a8a75,_0x1c81d4){return{'message':_0x25c0ff,'unlock':_0x1a8a75,'active':_0x1c81d4};};exports['getCallerId']=function(_0x2b6f2b,_0x139bd7,_0x280245){if(!_['isUndefined'](_0x280245)&&_0xb112('0xd')===typeof _0x280245&&!_['isEmpty'](_0x280245)){if(!_[_0xb112('0xe')](_0x139bd7)&&_0xb112('0xd')===typeof _0x139bd7&&!_[_0xb112('0xf')](_0x139bd7)){return util['format'](_0xb112('0x10'),_0x139bd7,_0x280245);}return util[_0xb112('0x11')](_0xb112('0x10'),_0x280245,_0x280245);}if(!_[_0xb112('0xe')](_0x2b6f2b)&&_0xb112('0xd')===typeof _0x2b6f2b&&!_[_0xb112('0xf')](_0x2b6f2b)){return _0x2b6f2b;}return _0xb112('0x12');};exports['isActive']=function(_0x4f9fac){if(_['isNil'](_0x4f9fac)){return![];}return _0x4f9fac;};exports['addVariables']=function(_0x479112,_0x301c57,_0x373718,_0x189d2a,_0x19a969,_0x2389e4){var _0x335e52={'XMD-QUEUE':_0x301c57[_0xb112('0x13')]?_0x301c57[_0xb112('0x13')][_0xb112('0x14')]:'','XMD-CALLERID':_0x189d2a,'XMD-CALLERID-PREVIEW':_0x2389e4?util[_0xb112('0x11')](_0xb112('0x10'),_0x2389e4['calleridname'],_0x2389e4[_0xb112('0x15')]):_0x189d2a,'XMD-DIALID':_0x19a969,'XMD-CONTACTID':_0x301c57[_0xb112('0x16')],'XMD-CDRTYPE':_0xb112('0x17'),'CALLERID(all)':_0x189d2a,'XMD-VOICEQUEUEID':_0x301c57[_0xb112('0x18')],'XMD-DIALCHANNEL':_0x373718,'XMD-DIALTIMEOUT':_0x479112[_0xb112('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0xb112('0x11')](_0xb112('0x1a'),_0x479112[_0xb112('0x1b')]?'g':'',_[_0xb112('0xf')](_0x479112[_0xb112('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x479112['dialPreviewUrl']||'','XMD-AGI':_0x479112[_0xb112('0x1d')]?util[_0xb112('0x11')](_0xb112('0x1e'),ipAgi,_0x479112[_0xb112('0x1d')]):_0xb112('0x1f'),'XMD-AGIAFTER':_0x479112['dialQueueProject2']?util[_0xb112('0x11')](_0xb112('0x1e'),ipAgi,_0x479112[_0xb112('0x1b')]):_0xb112('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x2389e4?_0x2389e4['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2389e4?_0x2389e4[_0xb112('0x20')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xb112('0x21')};if(!_[_0xb112('0xf')](_0x479112['monitor_format'])){_0x335e52[util[_0xb112('0x11')]('%s',_0xb112('0x22'))]=_0x479112[_0xb112('0x1c')];_0x335e52[util[_0xb112('0x11')]('%s',_0xb112('0x23'))]=_0x19a969;}return _0x335e52;};exports[_0xb112('0x24')]=function(_0x2fd13b){var _0x554060={};for(var _0x12bb3c in _0x2fd13b){if(_0x2fd13b[_0xb112('0x25')](_0x12bb3c)){_0x554060[util[_0xb112('0x11')]('%s',_[_0xb112('0x26')](_0x12bb3c))]=_0x2fd13b[_0x12bb3c];}}return{'variables':_0x554060};};exports[_0xb112('0x27')]=function(_0x49b94e,_0x1c6c6a){if(!_[_0xb112('0x28')](_0x49b94e)){if(_0x49b94e[_0xb112('0x25')](_0xb112('0x29'))){if(_0x49b94e[_0xb112('0x29')]>0x0){_0x49b94e['originated']-=0x1;}else{logger[_0xb112('0x7')](_0xb112('0x2a'),_0x1c6c6a);}}}else{logger[_0xb112('0x7')](_0xb112('0x2b'),_0x1c6c6a);}};exports[_0xb112('0x2c')]=function(_0x5925cb){var _0x1dd7e4=moment()['format'](_0xb112('0x2d'));_0x5925cb[_0xb112('0x2e')]=0xd;_0x5925cb[_0xb112('0x2f')]=_0xb112('0x30');_0x5925cb[_0xb112('0x31')]=_0x1dd7e4;_0x5925cb[_0xb112('0x32')]=_0x1dd7e4;_0x5925cb[_0xb112('0x33')]=_0x1dd7e4;};exports[_0xb112('0x34')]=function(_0x2f7eb8,_0x53ba04,_0x688cce){var _0x449602=moment()[_0xb112('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f7eb8[_0xb112('0x2e')]=_0x53ba04;_0x2f7eb8[_0xb112('0x2f')]=_0x688cce;_0x2f7eb8[_0xb112('0x32')]=_0x449602;_0x2f7eb8[_0xb112('0x35')]=utils[_0xb112('0x36')](_0x2f7eb8[_0xb112('0x32')],_0x2f7eb8['starttime']);};exports['logLookAgent']=function(_0x49df7e,_0x2d8789,_0x478a28){_0x49df7e['membername']=_0x2d8789;_0x49df7e['UserId']=_0x478a28;};exports[_0xb112('0x37')]=function(_0x45be1d,_0x16bb39,_0x53a3c0){var _0xd51018=moment()['format'](_0xb112('0x2d'));_0x45be1d[_0xb112('0x2e')]=_0x16bb39;_0x45be1d[_0xb112('0x2f')]=_0x53a3c0;_0x45be1d['responsetime']=_0x45be1d[_0xb112('0x32')]?_0x45be1d[_0xb112('0x32')]:_0xd51018;_0x45be1d['endtime']=_0x45be1d[_0xb112('0x33')]?_0x45be1d[_0xb112('0x33')]:_0xd51018;_0x45be1d['ringtime']=utils['getSeconds'](_0x45be1d[_0xb112('0x32')]||0x0,_0x45be1d[_0xb112('0x31')]||0x0);_0x45be1d[_0xb112('0x38')]=_0x45be1d['answertime']?utils[_0xb112('0x36')](_0x45be1d[_0xb112('0x33')],_0x45be1d['answertime']):0x0;};exports['isFailure']=function(_0x434bf8){return _0x434bf8===_0xb112('0x39');};exports['variablesAction']=function(_0xb5d540,_0x3acfbd,_0x51685b,_0x2c279f,_0x34f5d5){var _0x11044e=_0x2c279f?'RECALL':_0xb5d540['calleridname'];_0x11044e=_0x34f5d5?_0xb112('0x3a'):_0x11044e;return{'actionid':_0xb5d540['uniqueid'],'action':_0xb112('0x3b'),'channel':_0xb5d540[_0xb112('0x3c')],'callerid':util[_0xb112('0x11')](_0xb112('0x10'),_0x11044e,_0xb5d540['calleridnum']),'Exten':_0xb112('0x3d'),'Context':'from-sip','Priority':'1','variable':_0x51685b,'timeout':(_0x3acfbd[_0xb112('0x3e')]||0x1e)*0x3e8,'async':!![],'channelid':_0xb5d540[_0xb112('0x3f')]};};exports[_0xb112('0x40')]=function(_0x25b3c4){return _0x25b3c4[_0xb112('0x41')]+_0x25b3c4[_0xb112('0x42')]+_0x25b3c4[_0xb112('0x43')]+_0x25b3c4['countagentrejectretry']+_0x25b3c4[_0xb112('0x44')];};exports[_0xb112('0x45')]=function(_0x4bf5f7){var _0x20cd5a=_[_0xb112('0x46')](_0x4bf5f7);_0x20cd5a[_0xb112('0x2e')]=0xf;_0x20cd5a[_0xb112('0x2f')]=_0xb112('0x47');return _0x20cd5a;};exports[_0xb112('0x48')]=function(_0x32b7b5,_0x2b1f37,_0x1712ad){var _0x1c9b64={};_0x1c9b64[_0x2b1f37]=_0x32b7b5[_0x2b1f37];_0x1c9b64[_0xb112('0x49')]=![];_0x1c9b64['scheduledat']=moment()[_0xb112('0x4a')](_0x1712ad,_0xb112('0x4b'))['format'](_0xb112('0x2d'));_0x1c9b64['ContactId']=_0x32b7b5['ContactId'];_0x1c9b64['ListId']=_0x32b7b5['ListId'];_0x1c9b64['VoiceQueueId']=_0x32b7b5[_0xb112('0x18')]||undefined;return _0x1c9b64;};exports['decrementTalkink']=function(_0x4f7cf5,_0xda4f62){if(!_['isNil'](_0x4f7cf5)){if(_0x4f7cf5[_0xb112('0x4c')]>0x0){_0x4f7cf5[_0xb112('0x4c')]-=0x1;}else{logger[_0xb112('0x7')](_0xda4f62,_0xb112('0x4d'));}}else{logger[_0xb112('0x7')](_0xda4f62,_0xb112('0x4e'));}};exports['IsNotLoggedIn']=function(_0x4d1032){if(_0x4d1032<=0x0){return!![];}return![];};function buildObj(_0x2cee93,_0x126f92,_0x4bdbc2){_0x2cee93['lastevent']=_0x126f92;_0x2cee93[_0xb112('0x14')]=_0x2cee93[_0xb112('0x4f')];_0x2cee93[_0xb112('0x50')]=_0x2cee93[_0xb112('0x3c')];_0x2cee93[_0xb112('0x51')]='voice';if(_0x4bdbc2){_0x2cee93[_0xb112('0x52')]=_0x4bdbc2[_0xb112('0x52')];}return _0x2cee93;}exports['buildObj']=buildObj;exports[_0xb112('0x53')]=function(_0x32f56a){var _0x3259d6={};_0x3259d6[_0xb112('0x4f')]=_0x32f56a[_0xb112('0x4f')];_0x3259d6[_0xb112('0x50')]=_0x32f56a[_0xb112('0x3c')];_0x3259d6[_0xb112('0x3f')]=_0x32f56a[_0xb112('0x3f')];return _0x3259d6;};exports[_0xb112('0x54')]=function(_0x43fe03){var _0x5bdde3=[];for(var _0x57d6cd in _0x43fe03){if(_0x43fe03[_0xb112('0x25')](_0x57d6cd)){if(!_['isNil'](_0x43fe03[_0x57d6cd])&&_0x43fe03[_0x57d6cd]['state']===_0xb112('0x55')&&_0x43fe03[_0x57d6cd]['status']==='reachable'){_0x5bdde3[_0xb112('0x56')](_0x43fe03[_0x57d6cd]['id']);}}}return _0x5bdde3;};exports[_0xb112('0x57')]=function(_0x312ab2){var _0x1388e5=moment()[_0xb112('0x58')](0x0);var _0x32b494=moment(_0x312ab2)[_0xb112('0x58')](0x0);return _0x1388e5[_0xb112('0x59')](_0x32b494,_0xb112('0x5a'));};exports[_0xb112('0x5b')]=function(_0x526c58){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x526c58['ContactId'],'ListId':_0x526c58['ListId'],'VoiceQueueId':_0x526c58[_0xb112('0x18')]||undefined,'CampaignId':_0x526c58[_0xb112('0x5c')]||undefined};};exports['filterKey']=function(_0x238a55){if(_0x238a55===_0xb112('0x3f')||_0x238a55===_0xb112('0x5d')||_0x238a55===_0xb112('0x4f')||_0x238a55===_0xb112('0x5e')||_0x238a55===_0xb112('0x5f')||_0x238a55===_0xb112('0x60')||_0x238a55===_0xb112('0x61')||_0x238a55===_0xb112('0x3c')||_0x238a55==='calleridname'||_0x238a55==='active'||_0x238a55===_0xb112('0x15')||_0x238a55===_0xb112('0x62')||_0x238a55==='countbusyretry'||_0x238a55===_0xb112('0x42')||_0x238a55===_0xb112('0x43')||_0x238a55===_0xb112('0x63')||_0x238a55===_0xb112('0x64')||_0x238a55==='callbackuniqueid'||_0x238a55===_0xb112('0x65')||_0x238a55===_0xb112('0x66')||_0x238a55===_0xb112('0x16')||_0x238a55===_0xb112('0x67')||_0x238a55===_0xb112('0x68')||_0x238a55===_0xb112('0x18')||_0x238a55===_0xb112('0x69')||_0x238a55===_0xb112('0x6a')||_0x238a55===_0xb112('0x6b')||_0x238a55===_0xb112('0x6c')||_0x238a55===_0xb112('0x6d')||_0x238a55===_0xb112('0x6e')||_0x238a55===_0xb112('0x6f')||_0x238a55===_0xb112('0x70')||_0x238a55==='xmd-dialid'||_0x238a55===_0xb112('0x71')||_0x238a55===_0xb112('0x72')||_0x238a55==='xmd-cdrtype'||_0x238a55===_0xb112('0x73')||_0x238a55===_0xb112('0x74')||_0x238a55===_0xb112('0x75')||_0x238a55===_0xb112('0x76')||_0x238a55===_0xb112('0x77')||_0x238a55===_0xb112('0x78')||_0x238a55==='rtpaudioqosjitterbridged'||_0x238a55===_0xb112('0x79')||_0x238a55===_0xb112('0x7a')||_0x238a55===_0xb112('0x7b')||_0x238a55==='rtpaudioqosrttbridged'||_0x238a55===_0xb112('0x76')||_0x238a55===_0xb112('0x77')||_0x238a55===_0xb112('0x78')||_0x238a55==='rtpaudioqosjitterbridged'||_0x238a55===_0xb112('0x79')||_0x238a55===_0xb112('0x7a')||_0x238a55===_0xb112('0x7b')||_0x238a55===_0xb112('0x7c')||_0x238a55===_0xb112('0x7d')||_0x238a55==='bridgepvtcallid'||_0x238a55===_0xb112('0x2e')||_0x238a55==='statedesc'){return![];}return!![];};exports[_0xb112('0x7e')]=function(_0x38605c,_0x1b3b51){var _0x563e49,_0x36428e,_0x3c380f;if(_0x1b3b51<=0x0){_0x1b3b51=0x1;}_0x563e49=new RegExp(_0xb112('0x7f')+_0x1b3b51+'}$');_0x36428e=Math[_0xb112('0x80')](0xa,_0x1b3b51-0x1);_0x3c380f=Math[_0xb112('0x80')](0xa,_0x1b3b51)-0x1;return util[_0xb112('0x11')]('%s',_[_0xb112('0x81')](_0x38605c,_0x563e49,_[_0xb112('0x82')](_0x36428e,_0x3c380f)));};exports['extractCalleridName']=function(_0x3bb9b9){var _0x1de2e=_0x3bb9b9[_0xb112('0x83')](/"(.*?)"/);return _0x1de2e?_0x1de2e[0x1]:_0x3bb9b9;};exports['extractCalleridNumber']=function(_0x2a02b4){var _0x2b51d7=_0x2a02b4[_0xb112('0x83')](/<(.*?)>/);return _0x2b51d7?_0x2b51d7[0x1]:_0x2a02b4;};function buildNoAnswerEventPayload(_0x194f3f,_0x1761be){var _0x1e8d86=buildObj(_0x194f3f,_0xb112('0x84'));if(!_[_0xb112('0xf')](_0x1761be[_0xb112('0x85')])){Object[_0xb112('0x86')](_0x1761be[_0xb112('0x85')])[_0xb112('0x87')](function(_0x437f43){_0x1e8d86[_0x437f43[_0xb112('0x88')]()]=_0x1761be['variables'][_0x437f43];});}return _0x1e8d86;}exports[_0xb112('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index aa54888..8c1f9d7 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 _0xaf32=['number','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x4d092a,_0x2db5d6){var _0x44be44=function(_0x5adcd4){while(--_0x5adcd4){_0x4d092a['push'](_0x4d092a['shift']());}};_0x44be44(++_0x2db5d6);}(_0xaf32,0x170));var _0x2af3=function(_0xfd2dd2,_0x41e8d6){_0xfd2dd2=_0xfd2dd2-0x0;var _0x3f28f1=_0xaf32[_0xfd2dd2];return _0x3f28f1;};'use strict';exports[_0x2af3('0x0')]={'queue':{'type':_0x2af3('0x1'),'required':!![]},'interface':{'type':_0x2af3('0x1'),'required':!![]},'membername':{'type':_0x2af3('0x1'),'required':!![]},'penalty':{'type':_0x2af3('0x2'),'required':![]},'paused':{'type':_0x2af3('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x2af3('0x1'),'required':!![]}};exports[_0x2af3('0x4')]={'interface':{'type':_0x2af3('0x1'),'required':!![]},'paused':{'type':_0x2af3('0x3')},'reason':{'type':_0x2af3('0x1'),'required':![]}};exports[_0x2af3('0x5')]={'module':{'type':_0x2af3('0x1'),'required':![]}};exports[_0x2af3('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x2af3('0x7')]={'uniqueid':{'type':_0x2af3('0x1'),'required':!![]},'filename':{'type':_0x2af3('0x1')},'format':{'type':_0x2af3('0x1')},'mixmonitorid':{'type':_0x2af3('0x1')}};exports[_0x2af3('0x8')]={'uniqueid':{'type':_0x2af3('0x1'),'required':!![]}};exports[_0x2af3('0x9')]={'uniqueid':{'type':_0x2af3('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x2af3('0x1')}}; \ No newline at end of file +var _0x4d4b=['reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d4b,0x14e));var _0xb4d4=function(_0x5e9b3b,_0x2dd756){_0x5e9b3b=_0x5e9b3b-0x0;var _0x4803f8=_0x4d4b[_0x5e9b3b];return _0x4803f8;};'use strict';exports[_0xb4d4('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xb4d4('0x1'),'required':!![]},'membername':{'type':_0xb4d4('0x1'),'required':!![]},'penalty':{'type':_0xb4d4('0x2'),'required':![]},'paused':{'type':_0xb4d4('0x3'),'required':![]}};exports[_0xb4d4('0x4')]={'queue':{'type':_0xb4d4('0x1'),'required':!![]},'interface':{'type':_0xb4d4('0x1'),'required':!![]}};exports[_0xb4d4('0x5')]={'interface':{'type':_0xb4d4('0x1'),'required':!![]},'paused':{'type':_0xb4d4('0x3')},'reason':{'type':_0xb4d4('0x1'),'required':![]}};exports[_0xb4d4('0x6')]={'module':{'type':_0xb4d4('0x1'),'required':![]}};exports[_0xb4d4('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xb4d4('0x8')]={'uniqueid':{'type':_0xb4d4('0x1'),'required':!![]},'filename':{'type':_0xb4d4('0x1')},'format':{'type':_0xb4d4('0x1')},'mixmonitorid':{'type':_0xb4d4('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xb4d4('0x1'),'required':!![]}};exports[_0xb4d4('0x9')]={'uniqueid':{'type':_0xb4d4('0x1'),'required':!![]},'exten':{'type':_0xb4d4('0x1'),'required':!![]},'context':{'type':_0xb4d4('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d21e742..18fa3ee 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x4f12a0,_0x409520){var _0x16ed83=function(_0x5b6481){while(--_0x5b6481){_0x4f12a0['push'](_0x4f12a0['shift']());}};_0x16ed83(++_0x409520);}(_0xb10b,0x12a));var _0xbb10=function(_0x19a21c,_0x4e03f8){_0x19a21c=_0x19a21c-0x0;var _0x3e9b9f=_0xb10b[_0x19a21c];return _0x3e9b9f;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x50f2a1,_0x2b4dc0){var _0x539be6=function(_0x12daf3){while(--_0x12daf3){_0x50f2a1['push'](_0x50f2a1['shift']());}};_0x539be6(++_0x2b4dc0);}(_0xadb5,0xad));var _0x5adb=function(_0x376ba5,_0x320cd9){_0x376ba5=_0x376ba5-0x0;var _0x419697=_0xadb5[_0x376ba5];return _0x419697;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index a789a70..22f7046 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 _0x7392=['assign','mergeDBDataToRealtime'];(function(_0x65c604,_0x3f4867){var _0x231cb9=function(_0xde08c5){while(--_0xde08c5){_0x65c604['push'](_0x65c604['shift']());}};_0x231cb9(++_0x3f4867);}(_0x7392,0x198));var _0x2739=function(_0x178b4c,_0xbd1ed6){_0x178b4c=_0x178b4c-0x0;var _0x54b8b5=_0x7392[_0x178b4c];return _0x54b8b5;};'use strict';function mergeDBDataToRealtime(_0x2c333a,_0x17f12a){var _0x3513db=Object[_0x2739('0x0')]({},_0x2c333a);for(var _0x4a39f0 in _0x17f12a){if(_0x3513db['hasOwnProperty'](_0x4a39f0)){_0x3513db[_0x4a39f0]=_0x17f12a[_0x4a39f0];}}return _0x3513db;}exports[_0x2739('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x19d7=['assign','mergeDBDataToRealtime'];(function(_0x2da402,_0x14a691){var _0x31a57d=function(_0x3cfb60){while(--_0x3cfb60){_0x2da402['push'](_0x2da402['shift']());}};_0x31a57d(++_0x14a691);}(_0x19d7,0x7e));var _0x719d=function(_0x3e7352,_0x2b4289){_0x3e7352=_0x3e7352-0x0;var _0xdfd76a=_0x19d7[_0x3e7352];return _0xdfd76a;};'use strict';function mergeDBDataToRealtime(_0x335c82,_0x111bc2){var _0x46b0f8=Object[_0x719d('0x0')]({},_0x335c82);for(var _0x30009d in _0x111bc2){if(_0x46b0f8['hasOwnProperty'](_0x30009d)){_0x46b0f8[_0x30009d]=_0x111bc2[_0x30009d];}}return _0x46b0f8;}exports[_0x719d('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 20fd8eb..479ebbf 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 _0x0b0f=['../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','find','accountcode','name','isNil','interface','length','connectedlinenum','assigned','lastAssignedTo','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','keys','getCallType','channel','split','calleridnum','outbound','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getAgentByInternal','UserId','membername','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','findAgent','SIP/%s','attendedTransfer','exports','lodash','moment'];(function(_0x4717b8,_0x565c94){var _0x3daaa8=function(_0x1f5cf7){while(--_0x1f5cf7){_0x4717b8['push'](_0x4717b8['shift']());}};_0x3daaa8(++_0x565c94);}(_0x0b0f,0xb6));var _0xf0b0=function(_0x1506fe,_0xdee645){_0x1506fe=_0x1506fe-0x0;var _0x1a8689=_0x0b0f[_0x1506fe];return _0x1a8689;};'use strict';var _=require(_0xf0b0('0x0'));var moment=require(_0xf0b0('0x1'));var util=require('util');var config=require(_0xf0b0('0x2'));var ami=require(_0xf0b0('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xf0b0('0x4'));var RpcVoiceDialReport=require(_0xf0b0('0x5'));var RpcMemberReport=require(_0xf0b0('0x6'));var RpcVoiceQueueReport=require(_0xf0b0('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xf0b0('0x8'));var VoiceCallReport=require(_0xf0b0('0x9'));var VoiceAgentReport=require(_0xf0b0('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xf0b0('0xb'));function Report(_0x4b0ff2){this[_0xf0b0('0xc')]=_0x4b0ff2;this[_0xf0b0('0xd')]=_0x4b0ff2[_0xf0b0('0xd')];this[_0xf0b0('0xe')]=_0x4b0ff2[_0xf0b0('0xe')];}Report[_0xf0b0('0xf')][_0xf0b0('0x10')]=function(_0x43b13a){var _0x26c4f6=new VoiceQueueReport(this[_0xf0b0('0xc')]);var _0x40002f=new VoiceAgentReport(this[_0xf0b0('0xc')]);var _0x1c21a2=new VoiceDialReport(this[_0xf0b0('0xc')]);var _0x57e95f=new VoiceCallReport(this[_0xf0b0('0xc')]);var _0x118903=new UserReport(this[_0xf0b0('0xc')]);if(config[_0xf0b0('0x11')]&&config['xdr'][_0xf0b0('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xf0b0('0x13')][_0xf0b0('0x14')](this));ami['on'](_0xf0b0('0x15'),this[_0xf0b0('0x16')][_0xf0b0('0x14')](this));ami['on'](_0xf0b0('0x17'),this[_0xf0b0('0x18')][_0xf0b0('0x14')](this));ami['on']('custom:voiceDialReport',this[_0xf0b0('0x19')][_0xf0b0('0x14')](this));ami['on'](_0xf0b0('0x1a'),this[_0xf0b0('0x1b')][_0xf0b0('0x14')](this));ami['on'](_0xf0b0('0x1c'),this['attendedTransfer'][_0xf0b0('0x14')](this));}};Report['prototype']['findAgent']=function(_0x49bfdd){var _0x207059;_0x207059=_[_0xf0b0('0x1d')](this['agents'],function(_0x27e169){return _0x27e169[_0xf0b0('0x1e')]==_0x49bfdd||_0x27e169[_0xf0b0('0x1f')]==_0x49bfdd;});if(_[_0xf0b0('0x20')](_0x207059)){var _0x4417d8=_[_0xf0b0('0x1d')](this['telephones'],function(_0x251d07){return _0x251d07[_0xf0b0('0x1e')]==_0x49bfdd||_0x251d07['name']==_0x49bfdd;});if(_0x4417d8){_0x207059=_[_0xf0b0('0x1d')](this[_0xf0b0('0xd')],function(_0x43c74b){return _0x43c74b[_0xf0b0('0x21')]==util['format']('SIP/%s',_0x4417d8[_0xf0b0('0x1f')]);});}}return _0x207059;};Report[_0xf0b0('0xf')]['voiceQueueReport']=function(_0x2a3521){for(var _0x27a9b9=0x0;_0x27a9b9<_0x2a3521[_0xf0b0('0x22')];_0x27a9b9+=0x1){var _0xfb544c=this['findAgent'](_0x2a3521[_0x27a9b9][_0xf0b0('0x23')]);if(_0xfb544c){_0x2a3521[_0x27a9b9][_0xf0b0('0x1e')]=_0xfb544c[_0xf0b0('0x1e')];_0x2a3521[_0x27a9b9][_0xf0b0('0x24')]=!![];_0x2a3521[_0x27a9b9][_0xf0b0('0x25')]=_0xfb544c[_0xf0b0('0x1f')];_0x2a3521[_0x27a9b9][_0xf0b0('0x21')]=_[_0xf0b0('0x20')](_0xfb544c[_0xf0b0('0x21')])?util[_0xf0b0('0x26')]('SIP/%s',_0xfb544c[_0xf0b0('0x1f')]):_0xfb544c[_0xf0b0('0x21')];if(_0x2a3521[_0x27a9b9]['queuecallercomplete']){_0x2a3521[_0x27a9b9]['queuecallercompleteAt']=moment()[_0xf0b0('0x26')](_0xf0b0('0x27'));}if(_0x2a3521[_0x27a9b9][_0xf0b0('0x28')]){_0x2a3521[_0x27a9b9][_0xf0b0('0x29')]=moment()[_0xf0b0('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x2a3521[_0x27a9b9]);}RpcVoiceQueueReport['create'](_0x2a3521[_0x27a9b9]);}};function extractCalleridNumber(_0x5d0118){var _0x441c2f=_0x5d0118[_0xf0b0('0x2a')](/<(.*?)>/);return _0x441c2f?_0x441c2f[0x1]:_0x5d0118;}Report['prototype']['getAgentByInternal']=function(_0x59835){for(var _0x23d0b0=0x0;_0x23d0b0',_0x4f7d17[_0xf0b0('0x41')],_0x4f7d17[_0xf0b0('0x2f')]);}if(RpcVoiceTransferReport[_0xf0b0('0x42')][_0x4f7d17[_0xf0b0('0x43')]]){var _0x5b1174=RpcVoiceTransferReport[_0xf0b0('0x42')][_0x4f7d17['linkedid']];_0x5b1174[_0xf0b0('0x44')]=_0x4f7d17[_0xf0b0('0x45')];RpcVoiceTransferReport[_0xf0b0('0x1b')](_0x5b1174);delete RpcVoiceTransferReport[_0xf0b0('0x42')][_0x4f7d17[_0xf0b0('0x43')]];}if(_['isNil'](_0x4f7d17[_0xf0b0('0x33')])){_0x4f7d17['type']=this[_0xf0b0('0x2c')](_0x4f7d17);}if(_['isNil'](_0x4f7d17['UserId'])){var _0x33b8b8=_0x4f7d17[_0xf0b0('0x2d')][_0xf0b0('0x2e')]('-')[0x0];var _0x111e81=this[_0xf0b0('0xd')][_0x33b8b8];if(!_0x111e81)_0x111e81=this[_0xf0b0('0x46')](_0x4f7d17[_0xf0b0('0x1e')]);if(_0x111e81){_0x4f7d17[_0xf0b0('0x47')]=_0x111e81['id'];_0x4f7d17[_0xf0b0('0x48')]=_0x111e81['name'];}}RpcVoiceCallReport[_0xf0b0('0x49')](_0x4f7d17);if(_0x4f7d17[_0xf0b0('0x4a')]){for(var _0x7e9823=0x0;_0x7e9823<_0x4f7d17[_0xf0b0('0x4b')][_0xf0b0('0x22')];_0x7e9823+=0x1){_0x4f7d17[_0xf0b0('0x4c')]=_0x4f7d17[_0xf0b0('0x4b')][_0x7e9823][_0xf0b0('0x4d')];_0x4f7d17['createdAt']=_0x4f7d17[_0xf0b0('0x4b')][_0x7e9823][_0xf0b0('0x4e')];if(_0x4f7d17[_0xf0b0('0x32')]==_0xf0b0('0x3b')){_0x4f7d17[_0xf0b0('0x2f')]=_0x4f7d17[_0xf0b0('0x23')];_0x4f7d17['calleridname']=_0x4f7d17['connectedlinename'];_0x4f7d17[_0xf0b0('0x23')]=_0x4f7d17[_0xf0b0('0x1e')];_0x4f7d17[_0xf0b0('0x4f')]=_0x4f7d17['membername'];_0x4f7d17[_0xf0b0('0x32')]=_0x4f7d17[_0xf0b0('0x3d')];}else if(_0x4f7d17['exten']=='xcally-motion-dialer'){_0x4f7d17[_0xf0b0('0x2f')]=_0x4f7d17[_0xf0b0('0x31')];_0x4f7d17[_0xf0b0('0x32')]=_0x4f7d17[_0xf0b0('0x3d')];}RpcVoiceRecording['create'](_0x4f7d17);}}};Report[_0xf0b0('0xf')]['voiceAgentReport']=function(_0x4d026c){if(_[_0xf0b0('0x50')](_0x4d026c)){_0x4d026c[_0xf0b0('0x51')](function(_0x3984c8){RpcVoiceAgentReport[_0xf0b0('0x49')](_0x3984c8);});}else{RpcVoiceAgentReport[_0xf0b0('0x49')](_0x4d026c);}};Report[_0xf0b0('0xf')][_0xf0b0('0x19')]=function(_0x7188e4){RpcVoiceDialReport[_0xf0b0('0x49')](_0x7188e4);var _0x301d54;var _0x292633;var _0x38590a=_0x7188e4['channel'];if(_[_0xf0b0('0x52')](_0x38590a,_0xf0b0('0x53'))){_0x292633=_0x38590a[_0xf0b0('0x54')](_0x38590a['indexOf']('/')+0x1,_0x38590a[_0xf0b0('0x55')]('@'));_0x301d54=_['find'](this[_0xf0b0('0xd')],function(_0x262f54){return _0x262f54[_0xf0b0('0x56')]==_0x292633||_0x262f54['phone']==_0x292633||_0x262f54[_0xf0b0('0x1e')]==_0x292633;});}else{_0x292633=_0x38590a[_0xf0b0('0x54')](_0x38590a[_0xf0b0('0x55')]('/')+0x1,_0x38590a[_0xf0b0('0x57')]('-'));_0x301d54=this[_0xf0b0('0x58')](_0x292633);}if(_0x301d54){_0x7188e4[_0xf0b0('0x21')]=_[_0xf0b0('0x20')](_0x301d54[_0xf0b0('0x21')])?util[_0xf0b0('0x26')](_0xf0b0('0x59'),_0x301d54[_0xf0b0('0x1f')]):_0x301d54[_0xf0b0('0x21')];_0x7188e4[_0xf0b0('0x48')]=_0x301d54['name'];_0x7188e4['accountcode']=_0x301d54[_0xf0b0('0x1e')];RpcMemberReport[_0xf0b0('0x19')](_0x7188e4);}};Report['prototype']['blindTransfer']=function(_0x17974f){RpcVoiceTransferReport['transfers'][_0x17974f['transfererlinkedid']]=_0x17974f;};Report[_0xf0b0('0xf')][_0xf0b0('0x5a')]=function(_0x4b4e76){RpcVoiceTransferReport[_0xf0b0('0x5a')](_0x4b4e76);};module[_0xf0b0('0x5b')]=Report; \ No newline at end of file +var _0xd363=['destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','exten','isArray','forEach','voiceDialReport','startsWith','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','interface','format','SIP/%s','name','voiceQueueReport','length','connectedlinenum','accountcode','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','split','calleridnum','internal','type','lastapplication','queue','context','from-voip-provider','destination','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum'];(function(_0x5379c0,_0x303984){var _0x2f5b7e=function(_0x2d0ebb){while(--_0x2d0ebb){_0x5379c0['push'](_0x5379c0['shift']());}};_0x2f5b7e(++_0x303984);}(_0xd363,0x79));var _0x3d36=function(_0x6f041d,_0x4029b4){_0x6f041d=_0x6f041d-0x0;var _0x4609b8=_0xd363[_0x6f041d];return _0x4609b8;};'use strict';var _=require(_0x3d36('0x0'));var moment=require(_0x3d36('0x1'));var util=require(_0x3d36('0x2'));var config=require(_0x3d36('0x3'));var ami=require(_0x3d36('0x4'));var RpcVoiceAgentReport=require(_0x3d36('0x5'));var RpcVoiceCallReport=require(_0x3d36('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x3d36('0x7'));var RpcVoiceQueueReport=require(_0x3d36('0x8'));var RpcVoiceRecording=require(_0x3d36('0x9'));var RpcVoiceTransferReport=require(_0x3d36('0xa'));var VoiceQueueReport=require(_0x3d36('0xb'));var VoiceCallReport=require(_0x3d36('0xc'));var VoiceAgentReport=require(_0x3d36('0xd'));var VoiceDialReport=require(_0x3d36('0xe'));var UserReport=require(_0x3d36('0xf'));function Report(_0x43565c){this[_0x3d36('0x10')]=_0x43565c;this[_0x3d36('0x11')]=_0x43565c[_0x3d36('0x11')];this[_0x3d36('0x12')]=_0x43565c[_0x3d36('0x12')];}Report[_0x3d36('0x13')]['sync']=function(_0x5477a5){var _0x411673=new VoiceQueueReport(this[_0x3d36('0x10')]);var _0x3c6f48=new VoiceAgentReport(this[_0x3d36('0x10')]);var _0x5072a8=new VoiceDialReport(this[_0x3d36('0x10')]);var _0x1d8ba2=new VoiceCallReport(this['realtime']);var _0x1d583b=new UserReport(this[_0x3d36('0x10')]);if(config[_0x3d36('0x14')]&&config['xdr'][_0x3d36('0x15')]){ami['on'](_0x3d36('0x16'),this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this[_0x3d36('0x17')][_0x3d36('0x18')](this));ami['on']('custom:voiceAgentReport',this[_0x3d36('0x19')][_0x3d36('0x18')](this));ami['on'](_0x3d36('0x1a'),this['voiceDialReport'][_0x3d36('0x18')](this));ami['on'](_0x3d36('0x1b'),this[_0x3d36('0x1c')][_0x3d36('0x18')](this));ami['on']('attendedtransfer',this[_0x3d36('0x1d')]['bind'](this));}};Report[_0x3d36('0x13')][_0x3d36('0x1e')]=function(_0x54d915){var _0x33e6a6;_0x33e6a6=_['find'](this['agents'],function(_0x5fc56d){return _0x5fc56d['accountcode']==_0x54d915||_0x5fc56d['name']==_0x54d915;});if(_['isNil'](_0x33e6a6)){var _0x303711=_[_0x3d36('0x1f')](this['telephones'],function(_0x4dc011){return _0x4dc011['accountcode']==_0x54d915||_0x4dc011['name']==_0x54d915;});if(_0x303711){_0x33e6a6=_[_0x3d36('0x1f')](this[_0x3d36('0x11')],function(_0x2ae02d){return _0x2ae02d[_0x3d36('0x20')]==util[_0x3d36('0x21')](_0x3d36('0x22'),_0x303711[_0x3d36('0x23')]);});}}return _0x33e6a6;};Report[_0x3d36('0x13')][_0x3d36('0x24')]=function(_0x3f2fd9){for(var _0xb23b89=0x0;_0xb23b89<_0x3f2fd9[_0x3d36('0x25')];_0xb23b89+=0x1){var _0x1a9073=this['findAgent'](_0x3f2fd9[_0xb23b89][_0x3d36('0x26')]);if(_0x1a9073){_0x3f2fd9[_0xb23b89][_0x3d36('0x27')]=_0x1a9073[_0x3d36('0x27')];_0x3f2fd9[_0xb23b89][_0x3d36('0x28')]=!![];_0x3f2fd9[_0xb23b89][_0x3d36('0x29')]=_0x1a9073[_0x3d36('0x23')];_0x3f2fd9[_0xb23b89]['interface']=_[_0x3d36('0x2a')](_0x1a9073[_0x3d36('0x20')])?util[_0x3d36('0x21')]('SIP/%s',_0x1a9073[_0x3d36('0x23')]):_0x1a9073[_0x3d36('0x20')];if(_0x3f2fd9[_0xb23b89][_0x3d36('0x2b')]){_0x3f2fd9[_0xb23b89][_0x3d36('0x2c')]=moment()[_0x3d36('0x21')](_0x3d36('0x2d'));}if(_0x3f2fd9[_0xb23b89][_0x3d36('0x2e')]){_0x3f2fd9[_0xb23b89][_0x3d36('0x2f')]=moment()[_0x3d36('0x21')](_0x3d36('0x2d'));}RpcMemberReport[_0x3d36('0x24')](_0x3f2fd9[_0xb23b89]);}RpcVoiceQueueReport[_0x3d36('0x30')](_0x3f2fd9[_0xb23b89]);}};function extractCalleridNumber(_0x7e3c3e){var _0x10a2f4=_0x7e3c3e['match'](/<(.*?)>/);return _0x10a2f4?_0x10a2f4[0x1]:_0x7e3c3e;}Report[_0x3d36('0x13')][_0x3d36('0x31')]=function(_0xf3fbe8){for(var _0x3fde4e=0x0;_0x3fde4e0x0?!![]:![];if(!_0x3fc237){return this[_0x37c8('0x72')](this[_0x37c8('0x17')][_0x37c8('0x73')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x1780da){var _0x3d2922=this[_0x37c8('0x17')]['id'];if(this[_0x37c8('0x17')][_0x37c8('0x66')][_0x3d2922]&&this['summary'][_0x37c8('0x66')][_0x3d2922][_0x1780da[_0x37c8('0x65')]]){this[_0x37c8('0x17')]['queuestatus'][_0x3d2922][_0x1780da['actionid']][_0x37c8('0x14')]['push'](_0x1780da);}};VoiceQueueReport[_0x37c8('0xe')]['syncQueueSummary']=function(_0x599618){var _0x5eb2c3=this;try{if(this[_0x37c8('0x5e')](_0x599618)&&this[_0x37c8('0x5e')](_0x599618[_0x37c8('0x52')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x37c8('0x45')](_0x599618,{'showHidden':![],'depth':null}));var _0x2e3938=this[_0x37c8('0x15')][_0x599618[_0x37c8('0x52')]];if(_0x2e3938){logger['debug'](_0x37c8('0x74'),_0x2e3938[_0x37c8('0x69')]);this[_0x37c8('0x17')][_0x37c8('0x60')][_0x2e3938[_0x37c8('0x69')]]={'summaryEvent':_0x599618};this['summary'][_0x37c8('0x71')]+=0x1;return ami[_0x37c8('0x3d')]({'action':_0x37c8('0x66'),'queue':_0x2e3938[_0x37c8('0x69')]})['then'](function(_0x530844){if(!_0x5eb2c3[_0x37c8('0x17')]['queuestatus'][_0x599618['actionid']]){_0x5eb2c3['summary'][_0x37c8('0x66')][_0x599618[_0x37c8('0x65')]]={};}_0x5eb2c3[_0x37c8('0x17')][_0x37c8('0x66')][_0x599618[_0x37c8('0x65')]][_0x530844[_0x37c8('0x65')]]={'queue':_0x2e3938['name'],'agents':[]};})[_0x37c8('0x40')](function(_0x5a2849){throw _0x5a2849;});}}}catch(_0xdb9cff){logger['error'](_0x37c8('0x67'),util[_0x37c8('0x45')](_0xdb9cff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c8('0xe')][_0x37c8('0x72')]=function(_0x2b60d4){if(this[_0x37c8('0x17')]['statusRequests']>0x0){this[_0x37c8('0x17')][_0x37c8('0x73')]=_0x2b60d4;return;}logger[_0x37c8('0x4e')](_0x37c8('0x75'),util[_0x37c8('0x45')](_0x2b60d4,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x37c8('0x4c')](_0x37c8('0x76'),{});};VoiceQueueReport[_0x37c8('0xe')][_0x37c8('0x21')]=function(_0x4b192d){try{if(this[_0x37c8('0x5e')](_0x4b192d)){logger[_0x37c8('0x4e')](_0x37c8('0x77'),_0x4b192d[_0x37c8('0x50')],util[_0x37c8('0x45')](_0x4b192d,{'showHidden':![],'depth':null}));if(_[_0x37c8('0x5f')](this['queueReports'][_0x4b192d['uniqueid']])){this[_0x37c8('0x13')][_0x4b192d[_0x37c8('0x50')]]=[];}if(_['isUndefined'](this[_0x37c8('0x3a')][_0x4b192d[_0x37c8('0x50')]])){this[_0x37c8('0x3a')][_0x4b192d[_0x37c8('0x50')]]={};}var _0x209cbf=new QueueReport();_0x209cbf[_0x37c8('0x52')]=_0x4b192d['queue'];_0x209cbf[_0x37c8('0x6f')]=this[_0x37c8('0x15')][_0x209cbf[_0x37c8('0x52')]]&&this[_0x37c8('0x15')][_0x209cbf['queue']]['type']?this[_0x37c8('0x15')][_0x209cbf[_0x37c8('0x52')]][_0x37c8('0x6f')]||_0x37c8('0x5b'):_0x37c8('0x5b');_0x209cbf[_0x37c8('0x78')]=moment()[_0x37c8('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x209cbf[_0x37c8('0x79')]=_0x4b192d[_0x37c8('0x79')];_0x209cbf['count']=_0x4b192d[_0x37c8('0x7a')];_0x209cbf[_0x37c8('0x50')]=_0x4b192d[_0x37c8('0x50')];_0x209cbf[_0x37c8('0x7b')]=this[_0x37c8('0x3a')][_0x4b192d[_0x37c8('0x50')]][_0x37c8('0x7b')];logger[_0x37c8('0x7c')](_0x37c8('0x7d'),_0x209cbf['queue'],_0x209cbf[_0x37c8('0x6f')]);Object[_0x37c8('0x6e')](_0x209cbf,_[_0x37c8('0x7e')](_0x4b192d,_[_0x37c8('0x7f')](_0x209cbf)));this[_0x37c8('0x13')][_0x4b192d[_0x37c8('0x50')]][_0x37c8('0x80')](_0x209cbf);this['channels'][_0x4b192d[_0x37c8('0x50')]]=_0x209cbf;this['emitVoiceQueueChannelSave'](_0x209cbf,_0x37c8('0x20'));}}catch(_0x4cb80d){logger[_0x37c8('0x43')](_0x37c8('0x77'),_0x4b192d['uniqueid'],util[_0x37c8('0x45')](_0x4cb80d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c8('0xe')][_0x37c8('0x23')]=function(_0x4a4fa4){try{if(this[_0x37c8('0x5e')](_0x4a4fa4)){logger[_0x37c8('0x4e')](_0x37c8('0x81'),_0x4a4fa4['uniqueid'],util[_0x37c8('0x45')](_0x4a4fa4,{'showHidden':![],'depth':null}));if(this[_0x37c8('0x13')][_0x4a4fa4[_0x37c8('0x50')]]){var _0x2d3799=_[_0x37c8('0x82')](this[_0x37c8('0x13')][_0x4a4fa4[_0x37c8('0x50')]]);_0x2d3799['queuecallercomplete']=![];_0x2d3799[_0x37c8('0x83')]=null;_0x2d3799[_0x37c8('0x84')]=_0x4a4fa4[_0x37c8('0x84')];_0x2d3799[_0x37c8('0x85')]=_0x4a4fa4[_0x37c8('0x85')];_0x2d3799[_0x37c8('0x22')]=!![];_0x2d3799[_0x37c8('0x86')]=moment()[_0x37c8('0x51')](_0x37c8('0x87'));_0x2d3799[_0x37c8('0x55')]='ABANDONED';_0x2d3799[_0x37c8('0x88')]=null;logger[_0x37c8('0x7c')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2d3799[_0x37c8('0x52')],_0x2d3799[_0x37c8('0x6f')]);this['channels'][_0x4a4fa4[_0x37c8('0x50')]]=_0x2d3799;this[_0x37c8('0x4a')](_0x2d3799,_0x37c8('0x22'));}}}catch(_0x76b1e1){logger[_0x37c8('0x43')](_0x37c8('0x81'),_0x4a4fa4[_0x37c8('0x50')],util[_0x37c8('0x45')](_0x76b1e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x37c8('0x25')]=function(_0x3481cb){try{if(this[_0x37c8('0x5e')](_0x3481cb)){logger[_0x37c8('0x4e')](_0x37c8('0x89'),_0x3481cb[_0x37c8('0x50')],util[_0x37c8('0x45')](_0x3481cb,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3481cb[_0x37c8('0x50')]]){var _0x214964=_[_0x37c8('0x82')](this['queueReports'][_0x3481cb[_0x37c8('0x50')]]);_0x214964[_0x37c8('0x8a')]=moment()[_0x37c8('0x51')](_0x37c8('0x87'));_0x214964[_0x37c8('0x8b')]=_0x3481cb['connectedlinenum'];_0x214964[_0x37c8('0x8c')]=_0x3481cb[_0x37c8('0x8c')];logger[_0x37c8('0x7c')](_0x37c8('0x8d'),_0x214964[_0x37c8('0x52')],_0x214964['type'],_0x3481cb[_0x37c8('0x8b')],_0x3481cb[_0x37c8('0x8c')]);this[_0x37c8('0x3a')][_0x3481cb[_0x37c8('0x50')]]=_0x214964;this[_0x37c8('0x4d')](_0x214964,'queuecallerleave');}}}catch(_0xb1ca5d){logger['error'](_0x37c8('0x89'),_0x3481cb[_0x37c8('0x50')],util[_0x37c8('0x45')](_0xb1ca5d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c8('0xe')][_0x37c8('0x27')]=function(_0x391848){try{if(this[_0x37c8('0x5e')](_0x391848)){logger[_0x37c8('0x4e')]('[%s][voiceQueueReport][agentconnect]',_0x391848[_0x37c8('0x50')],util[_0x37c8('0x45')](_0x391848,{'showHidden':![],'depth':null}));if(this[_0x37c8('0x13')][_0x391848[_0x37c8('0x50')]]){var _0x1c27f1=_[_0x37c8('0x82')](this[_0x37c8('0x13')][_0x391848[_0x37c8('0x50')]]);_0x1c27f1[_0x37c8('0x38')]=!![];_0x1c27f1[_0x37c8('0x55')]=_0x37c8('0x8e');logger[_0x37c8('0x7c')](_0x37c8('0x8f'),_0x1c27f1[_0x37c8('0x52')],_0x1c27f1[_0x37c8('0x6f')]);}}}catch(_0x5d01e0){logger[_0x37c8('0x43')](_0x37c8('0x90'),_0x391848[_0x37c8('0x50')],util[_0x37c8('0x45')](_0x5d01e0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c8('0xe')]['syncAgentComplete']=function(_0x25b07a){try{if(this[_0x37c8('0x5e')](_0x25b07a)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x25b07a['uniqueid'],util['inspect'](_0x25b07a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x25b07a['uniqueid']]){var _0xdb571a=_[_0x37c8('0x82')](this[_0x37c8('0x13')][_0x25b07a[_0x37c8('0x50')]]);_0xdb571a[_0x37c8('0x22')]=![];_0xdb571a['queuecallerabandonAt']=null;_0xdb571a[_0x37c8('0x91')]=!![];_0xdb571a[_0x37c8('0x88')]=_0x25b07a[_0x37c8('0x92')];_0xdb571a[_0x37c8('0x84')]=_0x25b07a['holdtime'];_0xdb571a[_0x37c8('0x38')]=!![];_0xdb571a['queuecallerexit']=![];_0xdb571a[_0x37c8('0x93')]=null;if(!_0xdb571a[_0x37c8('0x94')]){if(_0x25b07a[_0x37c8('0x95')]==_0x37c8('0x94')){_0xdb571a[_0x37c8('0x55')]=_0x37c8('0x96');logger['info'](_0x37c8('0x97'),_0xdb571a[_0x37c8('0x52')],_0xdb571a[_0x37c8('0x6f')]);}else{if(_[_0x37c8('0x98')](_0x25b07a[_0x37c8('0x3f')][_0x37c8('0x99')](),_0x37c8('0x9a'))){if(this['queueReports'][_0x25b07a[_0x37c8('0x9b')]]){var _0x24450b=_[_0x37c8('0x82')](this[_0x37c8('0x13')][_0x25b07a[_0x37c8('0x9b')]]);_0x24450b[_0x37c8('0x38')]=![];_0x24450b[_0x37c8('0x9c')]=!![];_0x24450b[_0x37c8('0x93')]=moment(_0xdb571a[_0x37c8('0x78')])['add'](_0x25b07a['holdtime'],_0x37c8('0x9d'))['format'](_0x37c8('0x87'));_0x24450b[_0x37c8('0x55')]=_0x37c8('0x9e');_0x24450b['transfer']=!![];_0x24450b[_0x37c8('0x9f')]=_0x37c8('0xa0');_0x24450b['transferexten']=_0x25b07a[_0x37c8('0xa1')];_0x24450b[_0x37c8('0xa2')]=_0x25b07a[_0x37c8('0x50')];logger[_0x37c8('0x7c')](_0x37c8('0xa3'),_0x24450b[_0x37c8('0x52')],_0x24450b['type']);var _0x32e823=this[_0x37c8('0x13')][_0x25b07a['linkedid']];this[_0x37c8('0x13')][_0x25b07a[_0x37c8('0x9b')]]=this['queueReports'][_0x25b07a[_0x37c8('0x50')]];this['queueReports'][_0x25b07a[_0x37c8('0x50')]]=_0x32e823;}}else{_0xdb571a['queuecallerexitreason']=_0x37c8('0xa4')+_0x25b07a[_0x37c8('0x95')][_0x37c8('0xa5')]();logger[_0x37c8('0x7c')](_0x37c8('0xa6'),_0xdb571a['queue'],_0xdb571a['type'],_0xdb571a[_0x37c8('0x55')]);}}}this['channels'][_0x25b07a[_0x37c8('0x50')]]=_0xdb571a;}}}catch(_0x230927){logger[_0x37c8('0x43')](_0x37c8('0xa7'),_0x25b07a['uniqueid'],util[_0x37c8('0x45')](_0x230927,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c8('0xe')][_0x37c8('0x29')]=function(_0x19ad02){try{if(this[_0x37c8('0x5e')](_0x19ad02)){logger[_0x37c8('0x4e')]('[%s][voiceQueueReport][varset]',_0x19ad02['uniqueid'],util[_0x37c8('0x45')](_0x19ad02,{'showHidden':![],'depth':null}));this[_0x37c8('0xa8')](_0x19ad02['uniqueid'],_[_0x37c8('0x7f')](_0x19ad02['variable'])[0x0],_0x19ad02['value']);if(this[_0x37c8('0x13')][_0x19ad02[_0x37c8('0x50')]]){var _0x698b6f=_['last'](this[_0x37c8('0x13')][_0x19ad02[_0x37c8('0x50')]]);if(_0x698b6f){if(this[_0x37c8('0x5e')](_0x19ad02[_0x37c8('0xa9')])&&this['isNotNull'](_0x19ad02[_0x37c8('0xa9')][_0x37c8('0x66')])){switch(_0x19ad02[_0x37c8('0xaa')]){case _0x37c8('0xab'):_0x698b6f[_0x37c8('0x9c')]=![];_0x698b6f[_0x37c8('0x93')]=null;break;case _0x37c8('0xac'):_0x698b6f[_0x37c8('0xad')]='timeout';_0x698b6f[_0x37c8('0x9c')]=!![];_0x698b6f['queuecallerexitAt']=moment()[_0x37c8('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x698b6f[_0x37c8('0x8a')]=moment()['format'](_0x37c8('0x87'));logger['debug'](_0x37c8('0xae'),_0x19ad02[_0x37c8('0x50')],util['inspect'](_0x698b6f,{'showHidden':![],'depth':null}));ami['emit'](_0x37c8('0xaf'),_0x698b6f);break;default:_0x698b6f['queuecallerexit']=!![];_0x698b6f['queuecallerexitAt']=moment()[_0x37c8('0x51')](_0x37c8('0x87'));_0x698b6f['queuecallerleaveAt']=moment()['format'](_0x37c8('0x87'));}_0x698b6f[_0x37c8('0x22')]=![];_0x698b6f[_0x37c8('0x86')]=null;_0x698b6f[_0x37c8('0x55')]=_0x19ad02[_0x37c8('0xaa')];this[_0x37c8('0x3a')][_0x19ad02[_0x37c8('0x50')]]=_0x698b6f;this[_0x37c8('0x4a')](_0x698b6f,_0x37c8('0x28'));}else if(this[_0x37c8('0x5e')](_0x19ad02[_0x37c8('0xa9')])&&this[_0x37c8('0x5e')](_0x19ad02['variable'][_0x37c8('0xb0')])){if(!_0x698b6f['queuecallerabandon']){_0x698b6f['queuecallerexit']=!![];_0x698b6f['queuecallerexitAt']=moment()[_0x37c8('0x51')](_0x37c8('0x87'));_0x698b6f[_0x37c8('0x55')]=_0x37c8('0xb1');_0x698b6f[_0x37c8('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x19ad02[_0x37c8('0x50')]]=_0x698b6f;}}logger['info'](_0x37c8('0xb2'),_0x19ad02[_0x37c8('0x50')],_0x698b6f['queue'],_0x698b6f[_0x37c8('0x6f')],_[_0x37c8('0x7f')](_0x19ad02[_0x37c8('0xa9')])[0x0],_0x19ad02[_0x37c8('0xaa')]);_0x698b6f[_0x37c8('0x18')]=this[_0x37c8('0x18')][_0x19ad02[_0x37c8('0x50')]];}}}}catch(_0xdf7f52){logger[_0x37c8('0x43')](_0x37c8('0xb3'),_0x19ad02[_0x37c8('0x50')],util[_0x37c8('0x45')](_0xdf7f52,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37c8('0xe')]['addVariable']=function(_0x3c077f,_0x185eda,_0x1a9003){var _0x445f58=[_0x37c8('0xb4'),_0x37c8('0xb5'),_0x37c8('0xb6'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x37c8('0xb7'),_0x37c8('0xb8'),'rtpaudioqosrttbridged',_0x37c8('0xb9'),'sipuri',_0x37c8('0xba'),_0x37c8('0xbb'),_0x37c8('0xbc'),'memberdynamic',_0x37c8('0xbd'),_0x37c8('0xbe'),'membername',_0x37c8('0xbf'),_0x37c8('0xc0')];if(!_[_0x37c8('0x3c')](_0x185eda)&&!_[_0x37c8('0xc1')](_0x445f58,_0x185eda)){if(_['isUndefined'](this[_0x37c8('0x18')][_0x3c077f])){this[_0x37c8('0x18')][_0x3c077f]={};}this['variables'][_0x3c077f][_0x185eda]=_0x1a9003;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x56dd37,_0x4134d1,_0x11c6e7){try{var _0x3f9bd2={};if(this[_0x37c8('0x13')][_0x56dd37]){for(var _0x43356a=0x0;_0x43356a0x0?!![]:![];if(!_0x1a724f){return this[_0xe4b6('0x17')](this[_0xe4b6('0x48')][_0xe4b6('0x71')]);}};VoiceQueueReport[_0xe4b6('0x8')][_0xe4b6('0x18')]=function(_0x29a9c1){var _0xcb111f=this['summary']['id'];if(this[_0xe4b6('0x48')]['queuestatus'][_0xcb111f]&&this[_0xe4b6('0x48')][_0xe4b6('0x6d')][_0xcb111f][_0x29a9c1[_0xe4b6('0x64')]]){this['summary'][_0xe4b6('0x6d')][_0xcb111f][_0x29a9c1['actionid']][_0xe4b6('0xf')]['push'](_0x29a9c1);}};VoiceQueueReport[_0xe4b6('0x8')]['syncQueueSummary']=function(_0x4c0048){var _0x2721c8=this;try{if(this[_0xe4b6('0x5f')](_0x4c0048)&&this[_0xe4b6('0x5f')](_0x4c0048[_0xe4b6('0x57')])){logger[_0xe4b6('0x4c')]('[voiceQueueReport][queuesummary]\x20event:',util[_0xe4b6('0x44')](_0x4c0048,{'showHidden':![],'depth':null}));var _0x2608f5=this[_0xe4b6('0x10')][_0x4c0048['queue']];if(_0x2608f5){logger['debug'](_0xe4b6('0x72'),_0x2608f5[_0xe4b6('0x6c')]);this[_0xe4b6('0x48')][_0xe4b6('0x67')][_0x2608f5[_0xe4b6('0x6c')]]={'summaryEvent':_0x4c0048};this[_0xe4b6('0x48')][_0xe4b6('0x70')]+=0x1;return ami[_0xe4b6('0x3e')]({'action':_0xe4b6('0x6d'),'queue':_0x2608f5[_0xe4b6('0x6c')]})[_0xe4b6('0x63')](function(_0x49c28b){if(!_0x2721c8['summary'][_0xe4b6('0x6d')][_0x4c0048[_0xe4b6('0x64')]]){_0x2721c8[_0xe4b6('0x48')]['queuestatus'][_0x4c0048[_0xe4b6('0x64')]]={};}_0x2721c8[_0xe4b6('0x48')][_0xe4b6('0x6d')][_0x4c0048[_0xe4b6('0x64')]][_0x49c28b['actionid']]={'queue':_0x2608f5['name'],'agents':[]};})[_0xe4b6('0x65')](function(_0x20b9e3){throw _0x20b9e3;});}}}catch(_0x2f31b9){logger[_0xe4b6('0x42')](_0xe4b6('0x66'),util[_0xe4b6('0x44')](_0x2f31b9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x1eba64){if(this[_0xe4b6('0x48')][_0xe4b6('0x70')]>0x0){this[_0xe4b6('0x48')][_0xe4b6('0x71')]=_0x1eba64;return;}logger[_0xe4b6('0x4c')](_0xe4b6('0x73'),util[_0xe4b6('0x44')](_0x1eba64,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xe4b6('0x4a')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xe4b6('0x8')][_0xe4b6('0x1c')]=function(_0x2713fb){try{if(this['isNotNull'](_0x2713fb)){logger[_0xe4b6('0x4c')](_0xe4b6('0x74'),_0x2713fb['uniqueid'],util[_0xe4b6('0x44')](_0x2713fb,{'showHidden':![],'depth':null}));if(_[_0xe4b6('0x60')](this[_0xe4b6('0xd')][_0x2713fb['uniqueid']])){this['queueReports'][_0x2713fb['uniqueid']]=[];}if(_[_0xe4b6('0x60')](this[_0xe4b6('0x3b')][_0x2713fb[_0xe4b6('0x4f')]])){this[_0xe4b6('0x3b')][_0x2713fb[_0xe4b6('0x4f')]]={};}var _0x4c6153=new QueueReport();_0x4c6153[_0xe4b6('0x57')]=_0x2713fb['queue'];_0x4c6153[_0xe4b6('0x5b')]=this[_0xe4b6('0x10')][_0x4c6153['queue']]&&this[_0xe4b6('0x10')][_0x4c6153[_0xe4b6('0x57')]][_0xe4b6('0x5b')]?this[_0xe4b6('0x10')][_0x4c6153[_0xe4b6('0x57')]]['type']||_0xe4b6('0x5c'):_0xe4b6('0x5c');_0x4c6153[_0xe4b6('0x75')]=moment()[_0xe4b6('0x50')](_0xe4b6('0x76'));_0x4c6153[_0xe4b6('0x77')]=_0x2713fb[_0xe4b6('0x77')];_0x4c6153[_0xe4b6('0x78')]=_0x2713fb[_0xe4b6('0x78')];_0x4c6153[_0xe4b6('0x4f')]=_0x2713fb['uniqueid'];_0x4c6153[_0xe4b6('0x79')]=this[_0xe4b6('0x3b')][_0x2713fb[_0xe4b6('0x4f')]][_0xe4b6('0x79')];logger[_0xe4b6('0x7a')](_0xe4b6('0x7b'),_0x4c6153[_0xe4b6('0x57')],_0x4c6153[_0xe4b6('0x5b')]);Object[_0xe4b6('0x6b')](_0x4c6153,_['pick'](_0x2713fb,_[_0xe4b6('0x7c')](_0x4c6153)));this[_0xe4b6('0xd')][_0x2713fb[_0xe4b6('0x4f')]]['push'](_0x4c6153);this[_0xe4b6('0x3b')][_0x2713fb[_0xe4b6('0x4f')]]=_0x4c6153;this[_0xe4b6('0x4b')](_0x4c6153,_0xe4b6('0x1b'));}}catch(_0x1c6bf8){logger['error'](_0xe4b6('0x74'),_0x2713fb[_0xe4b6('0x4f')],util[_0xe4b6('0x44')](_0x1c6bf8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe4b6('0x8')][_0xe4b6('0x1e')]=function(_0x253c7e){try{if(this[_0xe4b6('0x5f')](_0x253c7e)){logger[_0xe4b6('0x4c')]('[%s][voiceQueueReport][queuecallerabandon]',_0x253c7e[_0xe4b6('0x4f')],util[_0xe4b6('0x44')](_0x253c7e,{'showHidden':![],'depth':null}));if(this[_0xe4b6('0xd')][_0x253c7e[_0xe4b6('0x4f')]]){var _0x2a6674=_[_0xe4b6('0x7d')](this[_0xe4b6('0xd')][_0x253c7e[_0xe4b6('0x4f')]]);_0x2a6674[_0xe4b6('0x39')]=![];_0x2a6674['queuecallercompleteAt']=null;_0x2a6674[_0xe4b6('0x7e')]=_0x253c7e[_0xe4b6('0x7e')];_0x2a6674['originalposition']=_0x253c7e[_0xe4b6('0x7f')];_0x2a6674[_0xe4b6('0x1d')]=!![];_0x2a6674['queuecallerabandonAt']=moment()[_0xe4b6('0x50')](_0xe4b6('0x76'));_0x2a6674['queuecallerexitreason']='ABANDONED';_0x2a6674[_0xe4b6('0x80')]=null;logger[_0xe4b6('0x7a')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2a6674[_0xe4b6('0x57')],_0x2a6674['type']);this[_0xe4b6('0x3b')][_0x253c7e[_0xe4b6('0x4f')]]=_0x2a6674;this['emitVoiceQueueChannelRemove'](_0x2a6674,_0xe4b6('0x1d'));}}}catch(_0xd6ff61){logger[_0xe4b6('0x42')](_0xe4b6('0x81'),_0x253c7e['uniqueid'],util[_0xe4b6('0x44')](_0xd6ff61,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe4b6('0x8')][_0xe4b6('0x1f')]=function(_0x1e2b74){try{if(this[_0xe4b6('0x5f')](_0x1e2b74)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x1e2b74['uniqueid'],util[_0xe4b6('0x44')](_0x1e2b74,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1e2b74[_0xe4b6('0x4f')]]){var _0xe75f56=_['last'](this['queueReports'][_0x1e2b74[_0xe4b6('0x4f')]]);_0xe75f56[_0xe4b6('0x82')]=moment()['format'](_0xe4b6('0x76'));_0xe75f56['connectedlinenum']=_0x1e2b74[_0xe4b6('0x83')];_0xe75f56[_0xe4b6('0x84')]=_0x1e2b74[_0xe4b6('0x84')];logger[_0xe4b6('0x7a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xe75f56[_0xe4b6('0x57')],_0xe75f56[_0xe4b6('0x5b')],_0x1e2b74[_0xe4b6('0x83')],_0x1e2b74[_0xe4b6('0x84')]);this[_0xe4b6('0x3b')][_0x1e2b74[_0xe4b6('0x4f')]]=_0xe75f56;this[_0xe4b6('0x4b')](_0xe75f56,_0xe4b6('0x85'));}}}catch(_0x2914f5){logger[_0xe4b6('0x42')](_0xe4b6('0x86'),_0x1e2b74[_0xe4b6('0x4f')],util[_0xe4b6('0x44')](_0x2914f5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe4b6('0x22')]=function(_0xe72a1f){try{if(this[_0xe4b6('0x5f')](_0xe72a1f)){logger['debug'](_0xe4b6('0x87'),_0xe72a1f[_0xe4b6('0x4f')],util[_0xe4b6('0x44')](_0xe72a1f,{'showHidden':![],'depth':null}));if(this[_0xe4b6('0xd')][_0xe72a1f[_0xe4b6('0x4f')]]){var _0x4c2012=_[_0xe4b6('0x7d')](this[_0xe4b6('0xd')][_0xe72a1f[_0xe4b6('0x4f')]]);_0x4c2012[_0xe4b6('0x39')]=!![];_0x4c2012[_0xe4b6('0x55')]=_0xe4b6('0x88');logger[_0xe4b6('0x7a')](_0xe4b6('0x89'),_0x4c2012[_0xe4b6('0x57')],_0x4c2012[_0xe4b6('0x5b')]);}}}catch(_0x3b69ba){logger[_0xe4b6('0x42')](_0xe4b6('0x87'),_0xe72a1f[_0xe4b6('0x4f')],util['inspect'](_0x3b69ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe4b6('0x8')][_0xe4b6('0x20')]=function(_0x20ad34){try{if(this[_0xe4b6('0x5f')](_0x20ad34)){logger[_0xe4b6('0x4c')]('[%s][voiceQueueReport][agentcomplete]',_0x20ad34[_0xe4b6('0x4f')],util[_0xe4b6('0x44')](_0x20ad34,{'showHidden':![],'depth':null}));if(this[_0xe4b6('0xd')][_0x20ad34[_0xe4b6('0x4f')]]){var _0x453a0f=_[_0xe4b6('0x7d')](this[_0xe4b6('0xd')][_0x20ad34['uniqueid']]);_0x453a0f[_0xe4b6('0x1d')]=![];_0x453a0f[_0xe4b6('0x8a')]=null;_0x453a0f['assigned']=!![];_0x453a0f[_0xe4b6('0x80')]=_0x20ad34['membername'];_0x453a0f['holdtime']=_0x20ad34[_0xe4b6('0x7e')];_0x453a0f[_0xe4b6('0x39')]=!![];_0x453a0f[_0xe4b6('0x8b')]=![];_0x453a0f[_0xe4b6('0x8c')]=null;if(!_0x453a0f[_0xe4b6('0x8d')]){if(_0x20ad34[_0xe4b6('0x8e')]==_0xe4b6('0x8d')){_0x453a0f[_0xe4b6('0x55')]=_0xe4b6('0x8f');logger['info'](_0xe4b6('0x90'),_0x453a0f[_0xe4b6('0x57')],_0x453a0f['type']);}else{if(_['startsWith'](_0x20ad34[_0xe4b6('0x3f')][_0xe4b6('0x91')](),_0xe4b6('0x92'))){if(this[_0xe4b6('0xd')][_0x20ad34['linkedid']]){var _0x450e8b=_[_0xe4b6('0x7d')](this['queueReports'][_0x20ad34[_0xe4b6('0x93')]]);_0x450e8b[_0xe4b6('0x39')]=![];_0x450e8b[_0xe4b6('0x8b')]=!![];_0x450e8b[_0xe4b6('0x8c')]=moment(_0x453a0f[_0xe4b6('0x75')])[_0xe4b6('0x94')](_0x20ad34['holdtime'],'seconds')[_0xe4b6('0x50')](_0xe4b6('0x76'));_0x450e8b[_0xe4b6('0x55')]=_0xe4b6('0x95');_0x450e8b['transfer']=!![];_0x450e8b[_0xe4b6('0x96')]='FORWARD';_0x450e8b[_0xe4b6('0x97')]=_0x20ad34['destexten'];_0x450e8b[_0xe4b6('0x98')]=_0x20ad34[_0xe4b6('0x4f')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x450e8b[_0xe4b6('0x57')],_0x450e8b[_0xe4b6('0x5b')]);var _0x1a4f15=this[_0xe4b6('0xd')][_0x20ad34[_0xe4b6('0x93')]];this['queueReports'][_0x20ad34['linkedid']]=this[_0xe4b6('0xd')][_0x20ad34['uniqueid']];this[_0xe4b6('0xd')][_0x20ad34[_0xe4b6('0x4f')]]=_0x1a4f15;}}else{_0x453a0f[_0xe4b6('0x55')]='COMPLETEDBY'+_0x20ad34[_0xe4b6('0x8e')][_0xe4b6('0x99')]();logger[_0xe4b6('0x7a')](_0xe4b6('0x9a'),_0x453a0f['queue'],_0x453a0f[_0xe4b6('0x5b')],_0x453a0f[_0xe4b6('0x55')]);}}}this[_0xe4b6('0x3b')][_0x20ad34[_0xe4b6('0x4f')]]=_0x453a0f;}}}catch(_0x5933e9){logger[_0xe4b6('0x42')](_0xe4b6('0x9b'),_0x20ad34['uniqueid'],util[_0xe4b6('0x44')](_0x5933e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe4b6('0x24')]=function(_0x459e49){try{if(this[_0xe4b6('0x5f')](_0x459e49)){logger[_0xe4b6('0x4c')]('[%s][voiceQueueReport][varset]',_0x459e49[_0xe4b6('0x4f')],util[_0xe4b6('0x44')](_0x459e49,{'showHidden':![],'depth':null}));this[_0xe4b6('0x9c')](_0x459e49[_0xe4b6('0x4f')],_[_0xe4b6('0x7c')](_0x459e49['variable'])[0x0],_0x459e49[_0xe4b6('0x9d')]);if(this[_0xe4b6('0xd')][_0x459e49[_0xe4b6('0x4f')]]){var _0x379515=_[_0xe4b6('0x7d')](this[_0xe4b6('0xd')][_0x459e49[_0xe4b6('0x4f')]]);if(_0x379515){if(this['isNotNull'](_0x459e49[_0xe4b6('0x9e')])&&this[_0xe4b6('0x5f')](_0x459e49[_0xe4b6('0x9e')]['queuestatus'])){switch(_0x459e49[_0xe4b6('0x9d')]){case'CONTINUE':_0x379515['queuecallerexit']=![];_0x379515[_0xe4b6('0x8c')]=null;break;case _0xe4b6('0x9f'):_0x379515[_0xe4b6('0xa0')]='timeout';_0x379515['queuecallerexit']=!![];_0x379515[_0xe4b6('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x379515[_0xe4b6('0x82')]=moment()[_0xe4b6('0x50')](_0xe4b6('0x76'));logger['debug'](_0xe4b6('0xa1'),_0x459e49['uniqueid'],util[_0xe4b6('0x44')](_0x379515,{'showHidden':![],'depth':null}));ami[_0xe4b6('0x4a')](_0xe4b6('0xa2'),_0x379515);break;default:_0x379515[_0xe4b6('0x8b')]=!![];_0x379515['queuecallerexitAt']=moment()[_0xe4b6('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x379515[_0xe4b6('0x82')]=moment()['format'](_0xe4b6('0x76'));}_0x379515['queuecallerabandon']=![];_0x379515['queuecallerabandonAt']=null;_0x379515['queuecallerexitreason']=_0x459e49[_0xe4b6('0x9d')];this['channels'][_0x459e49[_0xe4b6('0x4f')]]=_0x379515;this[_0xe4b6('0x54')](_0x379515,_0xe4b6('0x23'));}else if(this['isNotNull'](_0x459e49[_0xe4b6('0x9e')])&&this[_0xe4b6('0x5f')](_0x459e49[_0xe4b6('0x9e')]['queueposition'])){if(!_0x379515[_0xe4b6('0x1d')]){_0x379515['queuecallerexit']=!![];_0x379515[_0xe4b6('0x8c')]=moment()['format'](_0xe4b6('0x76'));_0x379515[_0xe4b6('0x55')]=_0xe4b6('0xa3');_0x379515['queuecallerleaveAt']=moment()[_0xe4b6('0x50')](_0xe4b6('0x76'));this['channels'][_0x459e49[_0xe4b6('0x4f')]]=_0x379515;}}logger[_0xe4b6('0x7a')](_0xe4b6('0xa4'),_0x459e49['uniqueid'],_0x379515[_0xe4b6('0x57')],_0x379515[_0xe4b6('0x5b')],_['keys'](_0x459e49[_0xe4b6('0x9e')])[0x0],_0x459e49[_0xe4b6('0x9d')]);_0x379515[_0xe4b6('0x12')]=this[_0xe4b6('0x12')][_0x459e49[_0xe4b6('0x4f')]];}}}}catch(_0x432ce9){logger[_0xe4b6('0x42')](_0xe4b6('0xa5'),_0x459e49[_0xe4b6('0x4f')],util[_0xe4b6('0x44')](_0x432ce9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe4b6('0x8')][_0xe4b6('0x9c')]=function(_0x2c185b,_0x45057d,_0x2e1cfa){var _0x404e59=[_0xe4b6('0xa6'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xe4b6('0xa7'),_0xe4b6('0xa8'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0xe4b6('0xa9'),_0xe4b6('0xaa'),_0xe4b6('0xab'),'bridgepvtcallid',_0xe4b6('0xac'),_0xe4b6('0xad'),_0xe4b6('0xae'),_0xe4b6('0xaf'),'membername','memberpenalty',_0xe4b6('0xb0')];if(!_[_0xe4b6('0x3d')](_0x45057d)&&!_[_0xe4b6('0xb1')](_0x404e59,_0x45057d)){if(_[_0xe4b6('0x60')](this[_0xe4b6('0x12')][_0x2c185b])){this['variables'][_0x2c185b]={};}this[_0xe4b6('0x12')][_0x2c185b][_0x45057d]=_0x2e1cfa;}};VoiceQueueReport[_0xe4b6('0x8')][_0xe4b6('0xb2')]=function(_0x82bb27,_0x17d2a5,_0x15b832){try{var _0x417719={};if(this[_0xe4b6('0xd')][_0x82bb27]){for(var _0x940a3e=0x0;_0x940a3e=0x0?moment(_0x13bb46['endtime'])[_0x69de('0x18')](_0x13bb46['starttime'],_0x69de('0xc')):null,'data1':_0x69de('0x1a'),'data2':_0x13bb46['accountcode'],'data3':_0x13bb46[_0x69de('0x1b')],'data4':_0x13bb46[_0x69de('0x1c')]||null,'role':_0x69de('0x1d'),'internal':_0x13bb46[_0x69de('0x10')]?_[_0x69de('0x11')](_0x13bb46['accountcode']):undefined,'uniqueid':_0x13bb46[_0x69de('0x12')]},'log':_0x69de('0x13')});}; \ No newline at end of file +var _0x5667=['voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','Request','membername','starttime','endtime','dialstring','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport'];(function(_0x1d1859,_0x255777){var _0x235226=function(_0x3067fb){while(--_0x3067fb){_0x1d1859['push'](_0x1d1859['shift']());}};_0x235226(++_0x255777);}(_0x5667,0xcc));var _0x7566=function(_0xa70aab,_0x2135d1){_0xa70aab=_0xa70aab-0x0;var _0x21275c=_0x5667[_0xa70aab];return _0x21275c;};'use strict';var moment=require('moment');var _=require(_0x7566('0x0'));var util=require(_0x7566('0x1'));var client=require('../client');exports[_0x7566('0x2')]=function(_0x9e5f35){var _0x227d57=_0x9e5f35[_0x7566('0x3')]||_0x9e5f35[_0x7566('0x4')];return client['Request'](_0x7566('0x5'),{'body':{'channel':_0x7566('0x6'),'membername':_0x9e5f35[_0x7566('0x7')],'interface':_[_0x7566('0x8')](_0x9e5f35[_0x7566('0x9')])?util[_0x7566('0xa')](_0x7566('0xb'),_0x9e5f35[_0x7566('0x7')]):_0x9e5f35[_0x7566('0x9')],'type':_0x7566('0xc'),'enterAt':_0x9e5f35[_0x7566('0xd')],'exitAt':_0x227d57,'duration':moment(_0x227d57)[_0x7566('0xe')](_0x9e5f35['queuecallerleaveAt'],_0x7566('0xf')),'data1':_0x7566('0x10'),'data2':_0x9e5f35[_0x7566('0x11')],'data3':_0x9e5f35[_0x7566('0x12')],'data4':null,'data5':_0x9e5f35[_0x7566('0x13')],'role':_0x7566('0x14'),'internal':_0x9e5f35[_0x7566('0x15')]?_[_0x7566('0x16')](_0x9e5f35[_0x7566('0x15')]):undefined,'uniqueid':_0x9e5f35[_0x7566('0x17')]},'log':_0x7566('0x5')});};exports[_0x7566('0x18')]=function(_0x28fb2c){return client[_0x7566('0x19')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x28fb2c[_0x7566('0x1a')],'interface':_0x28fb2c[_0x7566('0x9')],'type':_0x7566('0xc'),'enterAt':_0x28fb2c[_0x7566('0x1b')],'exitAt':_0x28fb2c[_0x7566('0x1c')],'duration':moment(_0x28fb2c[_0x7566('0x1c')])[_0x7566('0xe')](_0x28fb2c[_0x7566('0x1b')],'seconds')>=0x0?moment(_0x28fb2c[_0x7566('0x1c')])['diff'](_0x28fb2c[_0x7566('0x1b')],_0x7566('0xf')):null,'data1':'outbound','data2':_0x28fb2c['accountcode'],'data3':_0x28fb2c[_0x7566('0x12')],'data4':_0x28fb2c[_0x7566('0x1d')]||null,'role':'agent','internal':_0x28fb2c[_0x7566('0x15')]?_[_0x7566('0x16')](_0x28fb2c['accountcode']):undefined,'uniqueid':_0x28fb2c['uniqueid']},'log':_0x7566('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index d4dd22a..28fa1b2 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 _0xddd1=['Request','ShowSetting','stopRecordingOnTransfer','getSettings'];(function(_0x1b6f56,_0x4f44d2){var _0x2bbf0a=function(_0x30183d){while(--_0x30183d){_0x1b6f56['push'](_0x1b6f56['shift']());}};_0x2bbf0a(++_0x4f44d2);}(_0xddd1,0xab));var _0x1ddd=function(_0x55082b,_0x5b537f){_0x55082b=_0x55082b-0x0;var _0x117580=_0xddd1[_0x55082b];return _0x117580;};'use strict';var client=require('../client');exports[_0x1ddd('0x0')]=function(){return client[_0x1ddd('0x1')](_0x1ddd('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1ddd('0x3'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x3222=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x2b708f,_0xa24aa9){var _0x4207a6=function(_0x49e258){while(--_0x49e258){_0x2b708f['push'](_0x2b708f['shift']());}};_0x4207a6(++_0xa24aa9);}(_0x3222,0xe1));var _0x2322=function(_0x70e6b3,_0x3cf42b){_0x70e6b3=_0x70e6b3-0x0;var _0x115e60=_0x3222[_0x70e6b3];return _0x115e60;};'use strict';var client=require(_0x2322('0x0'));exports[_0x2322('0x1')]=function(){return client[_0x2322('0x2')](_0x2322('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2322('0x4'),_0x2322('0x5')]},'log':_0x2322('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 98d6ac8..2defa5b 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 _0xcc6a=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xcc6a,0x1cd));var _0xacc6=function(_0x4b2151,_0x202f79){_0x4b2151=_0x4b2151-0x0;var _0x37d0e9=_0xcc6a[_0x4b2151];return _0x37d0e9;};'use strict';var client=require(_0xacc6('0x0'));exports[_0xacc6('0x1')]=function(_0x36421a){return function(_0x4ac068){return client[_0xacc6('0x2')](_0xacc6('0x3'),{'options':{'raw':!![],'attributes':['id',_0xacc6('0x4'),_0xacc6('0x5')]},'log':_0xacc6('0x3')});};}; \ No newline at end of file +var _0x2343=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0x13c174,_0xda25fe){var _0x160654=function(_0x1b6ac2){while(--_0x1b6ac2){_0x13c174['push'](_0x13c174['shift']());}};_0x160654(++_0xda25fe);}(_0x2343,0xef));var _0x3234=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0x2343[_0x12d812];return _0x3711ab;};'use strict';var client=require(_0x3234('0x0'));exports[_0x3234('0x1')]=function(_0x10bb2b){return function(_0x4c5144){return client[_0x3234('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x3234('0x3'),_0x3234('0x4')]},'log':_0x3234('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 9e2ba1d..67a699f 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 _0x1c71=['data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','AnyConditions','operator','Action','Actions','data1','data3','data4'];(function(_0x5d735c,_0x34f771){var _0x104e60=function(_0x1d81aa){while(--_0x1d81aa){_0x5d735c['push'](_0x5d735c['shift']());}};_0x104e60(++_0x34f771);}(_0x1c71,0x1e8));var _0x11c7=function(_0x13661b,_0x5541d9){_0x13661b=_0x13661b-0x0;var _0x1ae1cd=_0x1c71[_0x13661b];return _0x1ae1cd;};'use strict';var client=require(_0x11c7('0x0'));exports[_0x11c7('0x1')]=function(_0x1b4b92){return function(_0x3d76a2){return client[_0x11c7('0x2')](_0x11c7('0x3'),{'options':{'raw':![],'attributes':['id',_0x11c7('0x4'),_0x11c7('0x5'),'status'],'include':[{'model':_0x11c7('0x6'),'as':_0x11c7('0x7'),'attributes':['id',_0x11c7('0x8'),'operator','value']},{'model':_0x11c7('0x6'),'as':_0x11c7('0x9'),'attributes':['id','field',_0x11c7('0xa'),'value']},{'model':_0x11c7('0xb'),'as':_0x11c7('0xc'),'attributes':['id','action',_0x11c7('0xd'),'data2',_0x11c7('0xe'),_0x11c7('0xf'),'data5',_0x11c7('0x10'),_0x11c7('0x11')]}]},'log':_0x11c7('0x3')});};}; \ No newline at end of file +var _0xb564=['operator','value','AnyConditions','Actions','data1','data2','data3','data4','data6','data7','../client','getTriggers','GetTrigger','name','channel','status','Condition','AllConditions','field'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xb564,0x1bf));var _0x4b56=function(_0x517de1,_0x14655a){_0x517de1=_0x517de1-0x0;var _0x4d1b3d=_0xb564[_0x517de1];return _0x4d1b3d;};'use strict';var client=require(_0x4b56('0x0'));exports[_0x4b56('0x1')]=function(_0x47b04d){return function(_0x5b62bc){return client['Request'](_0x4b56('0x2'),{'options':{'raw':![],'attributes':['id',_0x4b56('0x3'),_0x4b56('0x4'),_0x4b56('0x5')],'include':[{'model':_0x4b56('0x6'),'as':_0x4b56('0x7'),'attributes':['id',_0x4b56('0x8'),_0x4b56('0x9'),_0x4b56('0xa')]},{'model':_0x4b56('0x6'),'as':_0x4b56('0xb'),'attributes':['id',_0x4b56('0x8'),_0x4b56('0x9'),'value']},{'model':'Action','as':_0x4b56('0xc'),'attributes':['id','action',_0x4b56('0xd'),_0x4b56('0xe'),_0x4b56('0xf'),_0x4b56('0x10'),'data5',_0x4b56('0x11'),_0x4b56('0x12')]}]},'log':_0x4b56('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 8674384..a7c3c7a 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 _0x22cc=['defaultuser','getTrunks','Request','GetTrunk','name','registry'];(function(_0x123eac,_0x4f20b6){var _0x10b9ce=function(_0x3f0e7c){while(--_0x3f0e7c){_0x123eac['push'](_0x123eac['shift']());}};_0x10b9ce(++_0x4f20b6);}(_0x22cc,0x1e1));var _0xc22c=function(_0x584b9d,_0x1cb5c5){_0x584b9d=_0x584b9d-0x0;var _0x172053=_0x22cc[_0x584b9d];return _0x172053;};'use strict';var client=require('../client');exports[_0xc22c('0x0')]=function(_0x61f9f){return function(_0x1b7256){return client[_0xc22c('0x1')](_0xc22c('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc22c('0x3'),_0xc22c('0x4'),_0xc22c('0x5')]},'log':_0xc22c('0x2')});};}; \ No newline at end of file +var _0x5e8f=['GetTrunk','defaultuser','../client','getTrunks','Request'];(function(_0x51d41b,_0x2d1741){var _0x5a3f5f=function(_0xf98881){while(--_0xf98881){_0x51d41b['push'](_0x51d41b['shift']());}};_0x5a3f5f(++_0x2d1741);}(_0x5e8f,0x12e));var _0xf5e8=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x5e8f[_0x531d15];return _0x271a18;};'use strict';var client=require(_0xf5e8('0x0'));exports[_0xf5e8('0x1')]=function(_0xaaff05){return function(_0x5a048f){return client[_0xf5e8('0x2')](_0xf5e8('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xf5e8('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 0ec9e2b..66da6bd 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x42b245,_0x3fc317){var _0x4b6cc1=function(_0x1031c5){while(--_0x1031c5){_0x42b245['push'](_0x42b245['shift']());}};_0x4b6cc1(++_0x3fc317);}(_0xedd9,0xfc));var _0x9edd=function(_0x4313ff,_0x50242e){_0x4313ff=_0x4313ff-0x0;var _0x58fb8f=_0xedd9[_0x4313ff];return _0x58fb8f;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x17ac66,_0x5e1223){var _0x11384a=function(_0x2e981b){while(--_0x2e981b){_0x17ac66['push'](_0x17ac66['shift']());}};_0x11384a(++_0x5e1223);}(_0x70e0,0x17b));var _0x070e=function(_0x54717b,_0x21c231){_0x54717b=_0x54717b-0x0;var _0x5193cb=_0x70e0[_0x54717b];return _0x5193cb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 902727d..d00ce92 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 _0xcab2=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xcab2,0xa7));var _0x2cab=function(_0x42a6a9,_0xee10b9){_0x42a6a9=_0x42a6a9-0x0;var _0x4ab651=_0xcab2[_0x42a6a9];return _0x4ab651;};'use strict';var client=require(_0x2cab('0x0'));exports[_0x2cab('0x1')]=function(_0xe1c253){return client[_0x2cab('0x2')](_0x2cab('0x3'),{'body':_0xe1c253,'log':_0x2cab('0x3')});};exports[_0x2cab('0x4')]=function(_0x4f9901,_0x477a0c,_0x1cf7b1){return client['Request']('UpdateVoiceAgentReport',{'body':_0x4f9901,'options':{'where':{'uniqueid':_0x477a0c,'interface':_0x1cf7b1,'agentcomplete':!![]}},'log':_0x2cab('0x5')});}; \ No newline at end of file +var _0xddd3=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0xddd3,0x15e));var _0x3ddd=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xddd3[_0xea8947];return _0x2455e9;};'use strict';var client=require(_0x3ddd('0x0'));exports[_0x3ddd('0x1')]=function(_0x4dc34b){return client[_0x3ddd('0x2')](_0x3ddd('0x3'),{'body':_0x4dc34b,'log':_0x3ddd('0x3')});};exports[_0x3ddd('0x4')]=function(_0x1d09c9,_0x55bd30,_0x4ae45c){return client['Request'](_0x3ddd('0x5'),{'body':_0x1d09c9,'options':{'where':{'uniqueid':_0x55bd30,'interface':_0x4ae45c,'agentcomplete':!![]}},'log':_0x3ddd('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 822f918..7b6fc32 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 _0xb812=['endOf','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x58b0a7,_0x32f451){var _0x5aab22=function(_0x4d184e){while(--_0x4d184e){_0x58b0a7['push'](_0x58b0a7['shift']());}};_0x5aab22(++_0x32f451);}(_0xb812,0x7d));var _0x2b81=function(_0x40a2d0,_0x3dc831){_0x40a2d0=_0x40a2d0-0x0;var _0x27f444=_0xb812[_0x40a2d0];return _0x27f444;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x2b81('0x0'));var client=require(_0x2b81('0x1'));exports[_0x2b81('0x2')]=function(_0x30299c){return client[_0x2b81('0x3')](_0x2b81('0x4'),{'body':_[_0x2b81('0x5')](_0x30299c,{'source':_0x30299c['calleridnum'],'destinationcontext':_0x30299c[_0x2b81('0x6')],'callerid':_0x30299c[_0x2b81('0x7')],'amaflags':_0x2b81('0x8')}),'log':_0x2b81('0x4')});};exports[_0x2b81('0x9')]=function(){return function(){return client['Request'](_0x2b81('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x2b81('0xb')](_0x2b81('0xc'))[_0x2b81('0xd')](_0x2b81('0xe')),moment()[_0x2b81('0xf')](_0x2b81('0xc'))[_0x2b81('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x2b81('0x10'),_0x2b81('0x11'),_0x2b81('0x12')]},'log':_0x2b81('0x13')});};}; \ No newline at end of file +var _0x802a=['CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','merge','calleridnum','context','DOCUMENTATION'];(function(_0x156654,_0x3755b3){var _0x541b70=function(_0x535911){while(--_0x535911){_0x156654['push'](_0x156654['shift']());}};_0x541b70(++_0x3755b3);}(_0x802a,0x6f));var _0xa802=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x802a[_0x42bdad];return _0x122626;};'use strict';var moment=require(_0xa802('0x0'));var util=require(_0xa802('0x1'));var _=require(_0xa802('0x2'));var client=require(_0xa802('0x3'));exports[_0xa802('0x4')]=function(_0x3bb199){return client['Request']('CreateVoiceCallReport',{'body':_[_0xa802('0x5')](_0x3bb199,{'source':_0x3bb199[_0xa802('0x6')],'destinationcontext':_0x3bb199[_0xa802('0x7')],'callerid':_0x3bb199['callerid'],'amaflags':_0xa802('0x8')}),'log':_0xa802('0x9')});};exports[_0xa802('0xa')]=function(){return function(){return client[_0xa802('0xb')](_0xa802('0xc'),{'options':{'where':{'type':[_0xa802('0xd')],'createdAt':{'$between':[moment()[_0xa802('0xe')](_0xa802('0xf'))[_0xa802('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xa802('0x11')](_0xa802('0xf'))['format'](_0xa802('0x12'))]}},'attributes':[_0xa802('0x13'),_0xa802('0x14'),_0xa802('0x15'),_0xa802('0x16')]},'log':_0xa802('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f525a5e..2c34acf 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 _0xce50=['create','Request','CreateVoiceDialReport','../client'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xce50,0x1df));var _0x0ce5=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xce50[_0x4b7895];return _0x264180;};'use strict';var client=require(_0x0ce5('0x0'));exports[_0x0ce5('0x1')]=function(_0x84a1e7){return client[_0x0ce5('0x2')](_0x0ce5('0x3'),{'body':_0x84a1e7,'log':_0x0ce5('0x3')});}; \ No newline at end of file +var _0xa558=['CreateVoiceDialReport','../client','Request'];(function(_0x350d8d,_0xa5c21e){var _0x3cf7c9=function(_0x4870af){while(--_0x4870af){_0x350d8d['push'](_0x350d8d['shift']());}};_0x3cf7c9(++_0xa5c21e);}(_0xa558,0x13f));var _0x8a55=function(_0x2dd63d,_0x4fbefc){_0x2dd63d=_0x2dd63d-0x0;var _0x4ac04e=_0xa558[_0x2dd63d];return _0x4ac04e;};'use strict';var client=require(_0x8a55('0x0'));exports['create']=function(_0x177355){return client[_0x8a55('0x1')]('CreateVoiceDialReport',{'body':_0x177355,'log':_0x8a55('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 731c4dc..41c0bb2 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 _0x3c81=['GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x1b7c36,_0x2bef8b){var _0x36b7b1=function(_0x568d06){while(--_0x568d06){_0x1b7c36['push'](_0x1b7c36['shift']());}};_0x36b7b1(++_0x2bef8b);}(_0x3c81,0x102));var _0x13c8=function(_0x4d065c,_0x418c32){_0x4d065c=_0x4d065c-0x0;var _0x1fdeac=_0x3c81[_0x4d065c];return _0x1fdeac;};'use strict';var client=require(_0x13c8('0x0'));exports[_0x13c8('0x1')]=function(){return function(){return client['Request'](_0x13c8('0x2'),{'options':{'raw':!![],'attributes':['id',_0x13c8('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x58a7=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x58a7,0xf7));var _0x758a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x58a7[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x758a('0x0'));exports[_0x758a('0x1')]=function(){return function(){return client[_0x758a('0x2')](_0x758a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x758a('0x4'),_0x758a('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x758a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 4ecc367..2c18e79 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 _0xeed8=['Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup'];(function(_0x35c3c9,_0x195683){var _0x357152=function(_0x5cc18c){while(--_0x5cc18c){_0x35c3c9['push'](_0x35c3c9['shift']());}};_0x357152(++_0x195683);}(_0xeed8,0x1dc));var _0x8eed=function(_0x38f239,_0x4060e8){_0x38f239=_0x38f239-0x0;var _0x29924b=_0xeed8[_0x38f239];return _0x29924b;};'use strict';var client=require(_0x8eed('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x8eed('0x1')](_0x8eed('0x2'),{'options':{'raw':![],'attributes':['id',_0x8eed('0x3'),_0x8eed('0x4'),_0x8eed('0x5'),_0x8eed('0x6'),'monitor_format',_0x8eed('0x7'),_0x8eed('0x8'),_0x8eed('0x9'),_0x8eed('0xa'),_0x8eed('0xb'),'dialPowerLevel','dialPredictiveOptimization',_0x8eed('0xc'),'dialPredictiveInterval',_0x8eed('0xd'),'dialOriginateCallerIdNumber',_0x8eed('0xe'),'dialQueueOptions','dialQueueTimeout',_0x8eed('0xf'),_0x8eed('0x10'),_0x8eed('0x11'),_0x8eed('0x12'),_0x8eed('0x13'),'dialNoAnswerMaxRetry',_0x8eed('0x14'),_0x8eed('0x15'),_0x8eed('0x16'),_0x8eed('0x17'),_0x8eed('0x18'),_0x8eed('0x19'),'dialAMDActive','dialAMDInitialSilence',_0x8eed('0x1a'),_0x8eed('0x1b'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x8eed('0x1c'),_0x8eed('0x1d'),'dialAMDMaximumWordLength',_0x8eed('0x1e'),'dialRecallMeTimeout',_0x8eed('0x1f'),_0x8eed('0x20'),_0x8eed('0x21'),_0x8eed('0x22'),_0x8eed('0x23'),_0x8eed('0x24'),_0x8eed('0x25'),_0x8eed('0x26'),'dialCutDigit',_0x8eed('0x27'),_0x8eed('0x28'),_0x8eed('0x29'),_0x8eed('0x2a'),_0x8eed('0x2b'),_0x8eed('0x2c'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x8eed('0x2d'),_0x8eed('0x2e'),_0x8eed('0x2f'),_0x8eed('0x30'),_0x8eed('0x31'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x8eed('0x32'),'as':'Trunk','attributes':['id',_0x8eed('0x3'),_0x8eed('0x33'),_0x8eed('0x34')]},{'model':_0x8eed('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0x8eed('0x3')]},{'model':_0x8eed('0x32'),'as':_0x8eed('0x36'),'attributes':['id',_0x8eed('0x3'),_0x8eed('0x33'),'active']},{'model':_0x8eed('0x37'),'as':_0x8eed('0x37'),'attributes':['id',_0x8eed('0x3')],'include':[{'model':_0x8eed('0x37'),'as':_0x8eed('0x38'),'attributes':['id',_0x8eed('0x3'),_0x8eed('0x39')]}]}]},'log':_0x8eed('0x3a')});};}; \ No newline at end of file +var _0x6626=['dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','Interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialMethod','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x6626,0x183));var _0x6662=function(_0x527003,_0xccb1fa){_0x527003=_0x527003-0x0;var _0x43b3ca=_0x6626[_0x527003];return _0x43b3ca;};'use strict';var client=require(_0x6662('0x0'));exports[_0x6662('0x1')]=function(){return function(){return client[_0x6662('0x2')](_0x6662('0x3'),{'options':{'raw':![],'attributes':['id',_0x6662('0x4'),_0x6662('0x5'),_0x6662('0x6'),_0x6662('0x7'),'monitor_format',_0x6662('0x8'),'dialActive',_0x6662('0x9'),'dialLimitChannel','dialLimitQueue','dialPowerLevel',_0x6662('0xa'),_0x6662('0xb'),_0x6662('0xc'),_0x6662('0xd'),'dialOriginateCallerIdNumber',_0x6662('0xe'),_0x6662('0xf'),'dialQueueTimeout',_0x6662('0x10'),_0x6662('0x11'),_0x6662('0x12'),_0x6662('0x13'),_0x6662('0x14'),_0x6662('0x15'),_0x6662('0x16'),_0x6662('0x17'),'dialTimezone',_0x6662('0x18'),'dialPrefix',_0x6662('0x19'),'dialAMDActive',_0x6662('0x1a'),'dialAMDGreeting',_0x6662('0x1b'),_0x6662('0x1c'),_0x6662('0x1d'),_0x6662('0x1e'),_0x6662('0x1f'),_0x6662('0x20'),_0x6662('0x21'),_0x6662('0x22'),'dialRecallMeTimeout',_0x6662('0x23'),_0x6662('0x24'),_0x6662('0x25'),_0x6662('0x26'),_0x6662('0x27'),_0x6662('0x28'),_0x6662('0x29'),_0x6662('0x2a'),_0x6662('0x2b'),'dialNoSuchNumberMaxRetry',_0x6662('0x2c'),'dialDropMaxRetry',_0x6662('0x2d'),_0x6662('0x2e'),'dialAbandonedRetryFrequency',_0x6662('0x2f'),_0x6662('0x30'),_0x6662('0x31'),_0x6662('0x32'),_0x6662('0x33'),_0x6662('0x34'),'dialPredictiveIntervalMinThreshold',_0x6662('0x35'),_0x6662('0x36')],'include':[{'model':'Trunk','as':_0x6662('0x37'),'attributes':['id','name','callerid',_0x6662('0x38')]},{'model':_0x6662('0x39'),'as':_0x6662('0x3a'),'attributes':['id',_0x6662('0x4')]},{'model':_0x6662('0x37'),'as':'TrunkBackup','attributes':['id',_0x6662('0x4'),'callerid',_0x6662('0x38')]},{'model':_0x6662('0x3b'),'as':_0x6662('0x3b'),'attributes':['id',_0x6662('0x4')],'include':[{'model':_0x6662('0x3b'),'as':'Intervals','attributes':['id',_0x6662('0x4'),'interval']}]}]},'log':_0x6662('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index c714775..ca6e749 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(_0x266bb5,_0x4e4cda){var _0x25df28=function(_0x100374){while(--_0x100374){_0x266bb5['push'](_0x266bb5['shift']());}};_0x25df28(++_0x4e4cda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x2a2eb6,_0x3838d0){var _0x4fea98=function(_0x5ff767){while(--_0x5ff767){_0x2a2eb6['push'](_0x2a2eb6['shift']());}};_0x4fea98(++_0x3838d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 12cc4d8..e487591 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 _0xfdaf=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x3efcbe,_0xf0dfca){var _0x1209ae=function(_0x53d5c0){while(--_0x53d5c0){_0x3efcbe['push'](_0x3efcbe['shift']());}};_0x1209ae(++_0xf0dfca);}(_0xfdaf,0x119));var _0xffda=function(_0x4c0726,_0x3cbe8b){_0x4c0726=_0x4c0726-0x0;var _0x86ce9b=_0xfdaf[_0x4c0726];return _0x86ce9b;};'use strict';var client=require(_0xffda('0x0'));exports[_0xffda('0x1')]=function(_0x15abc8){return function(){return client[_0xffda('0x2')](_0xffda('0x3'),{'options':{'where':{'VoiceQueueId':_0x15abc8,'paused':!![]},'raw':!![]},'log':_0xffda('0x1')});};}; \ No newline at end of file +var _0x14f1=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x2ff07b,_0xf58a1c){var _0x49bd16=function(_0x54de3d){while(--_0x54de3d){_0x2ff07b['push'](_0x2ff07b['shift']());}};_0x49bd16(++_0xf58a1c);}(_0x14f1,0x187));var _0x114f=function(_0x4b5d31,_0x4499ab){_0x4b5d31=_0x4b5d31-0x0;var _0x1315a9=_0x14f1[_0x4b5d31];return _0x1315a9;};'use strict';var client=require(_0x114f('0x0'));exports[_0x114f('0x1')]=function(_0x4c4f41){return function(){return client[_0x114f('0x2')](_0x114f('0x3'),{'options':{'where':{'VoiceQueueId':_0x4c4f41,'paused':!![]},'raw':!![]},'log':_0x114f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 07de162..0e6f3e0 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x48577a,_0x5f3105){var _0x4b7284=function(_0x1774e5){while(--_0x1774e5){_0x48577a['push'](_0x48577a['shift']());}};_0x4b7284(++_0x5f3105);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2d2155,_0x3941df){var _0x5193bf=function(_0x10c2ea){while(--_0x10c2ea){_0x2d2155['push'](_0x2d2155['shift']());}};_0x5193bf(++_0x3941df);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index ab5ed30..ff730e2 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 _0x5876=['blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers'];(function(_0x4fb4f4,_0x3a32ea){var _0x2fde84=function(_0x3765b1){while(--_0x3765b1){_0x4fb4f4['push'](_0x4fb4f4['shift']());}};_0x2fde84(++_0x3a32ea);}(_0x5876,0x1d2));var _0x6587=function(_0x19d350,_0x3c843f){_0x19d350=_0x19d350-0x0;var _0x3bfc8d=_0x5876[_0x19d350];return _0x3bfc8d;};'use strict';var client=require(_0x6587('0x0'));exports[_0x6587('0x1')]={};exports[_0x6587('0x2')]=function(_0x3ae255){return client[_0x6587('0x3')](_0x6587('0x4'),{'body':{'result':_0x3ae255['result'],'transfererchannel':_0x3ae255[_0x6587('0x5')],'transferercalleridnum':_0x3ae255[_0x6587('0x6')],'transferercalleridname':_0x3ae255[_0x6587('0x7')],'transfererconnectedlinenum':_0x3ae255[_0x6587('0x8')],'transfererconnectedlinename':_0x3ae255[_0x6587('0x9')],'transfereraccountcode':_0x3ae255[_0x6587('0xa')],'transferercontext':_0x3ae255[_0x6587('0xb')],'transfererexten':_0x3ae255['transfererexten'],'transfererlinkedid':_0x3ae255[_0x6587('0xc')],'transfereechannel':_0x3ae255['transfereechannel'],'transfereecalleridnum':_0x3ae255[_0x6587('0xd')],'transfereecalleridname':_0x3ae255[_0x6587('0xe')],'transfereeconnectedlinenum':_0x3ae255['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3ae255['transfereeconnectedlinename'],'transfereeaccountcode':_0x3ae255[_0x6587('0xf')],'transfereecontext':_0x3ae255['transfereecontext'],'transfereeexten':_0x3ae255[_0x6587('0x10')],'transfereelinkedid':_0x3ae255[_0x6587('0x11')],'isexternal':_0x3ae255[_0x6587('0x12')],'context':_0x3ae255[_0x6587('0x13')],'extension':_0x3ae255[_0x6587('0x14')],'type':_0x6587('0x15')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x13abbc){return client[_0x6587('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x13abbc['result'],'transfererchannel':_0x13abbc[_0x6587('0x16')],'transferercalleridnum':_0x13abbc[_0x6587('0x17')],'transferercalleridname':_0x13abbc['origtransferercalleridname'],'transfererconnectedlinenum':_0x13abbc[_0x6587('0x18')],'transfererconnectedlinename':_0x13abbc[_0x6587('0x19')],'transfereraccountcode':_0x13abbc[_0x6587('0x1a')],'transferercontext':_0x13abbc['secondtransferercontext'],'transfererexten':_0x13abbc[_0x6587('0x1b')],'transfererlinkedid':_0x13abbc[_0x6587('0x1c')],'transfereechannel':_0x13abbc[_0x6587('0x1d')],'transfereecalleridnum':_0x13abbc[_0x6587('0x1e')],'transfereecalleridname':_0x13abbc['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x13abbc[_0x6587('0x1f')],'transfereeconnectedlinename':_0x13abbc[_0x6587('0x20')],'transfereeaccountcode':_0x13abbc[_0x6587('0x21')],'transfereecontext':_0x13abbc[_0x6587('0x22')],'transfereeexten':_0x13abbc[_0x6587('0x23')],'transfereelinkedid':_0x13abbc[_0x6587('0x24')],'isexternal':_0x13abbc[_0x6587('0x12')],'context':_0x13abbc['origtransferercontext'],'extension':_0x13abbc[_0x6587('0x25')],'type':_0x6587('0x26')},'log':_0x6587('0x4')});}; \ No newline at end of file +var _0x73f7=['origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeexten','isexternal','extension','blind','attendedTransfer','origtransfererchannel'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x73f7,0x74));var _0x773f=function(_0x3ff77f,_0x5c8f56){_0x3ff77f=_0x3ff77f-0x0;var _0x1b7359=_0x73f7[_0x3ff77f];return _0x1b7359;};'use strict';var client=require(_0x773f('0x0'));exports['transfers']={};exports[_0x773f('0x1')]=function(_0x38e8ae){return client[_0x773f('0x2')](_0x773f('0x3'),{'body':{'result':_0x38e8ae[_0x773f('0x4')],'transfererchannel':_0x38e8ae['transfererchannel'],'transferercalleridnum':_0x38e8ae[_0x773f('0x5')],'transferercalleridname':_0x38e8ae[_0x773f('0x6')],'transfererconnectedlinenum':_0x38e8ae[_0x773f('0x7')],'transfererconnectedlinename':_0x38e8ae[_0x773f('0x8')],'transfereraccountcode':_0x38e8ae[_0x773f('0x9')],'transferercontext':_0x38e8ae[_0x773f('0xa')],'transfererexten':_0x38e8ae['transfererexten'],'transfererlinkedid':_0x38e8ae['transfererlinkedid'],'transfereechannel':_0x38e8ae[_0x773f('0xb')],'transfereecalleridnum':_0x38e8ae['transfereecalleridnum'],'transfereecalleridname':_0x38e8ae[_0x773f('0xc')],'transfereeconnectedlinenum':_0x38e8ae[_0x773f('0xd')],'transfereeconnectedlinename':_0x38e8ae['transfereeconnectedlinename'],'transfereeaccountcode':_0x38e8ae['transfereeaccountcode'],'transfereecontext':_0x38e8ae['transfereecontext'],'transfereeexten':_0x38e8ae[_0x773f('0xe')],'transfereelinkedid':_0x38e8ae['transfereelinkedid'],'isexternal':_0x38e8ae[_0x773f('0xf')],'context':_0x38e8ae['context'],'extension':_0x38e8ae[_0x773f('0x10')],'type':_0x773f('0x11')},'log':_0x773f('0x3')});};exports[_0x773f('0x12')]=function(_0x1ae08c){return client['Request'](_0x773f('0x3'),{'body':{'result':_0x1ae08c['result'],'transfererchannel':_0x1ae08c[_0x773f('0x13')],'transferercalleridnum':_0x1ae08c[_0x773f('0x14')],'transferercalleridname':_0x1ae08c[_0x773f('0x15')],'transfererconnectedlinenum':_0x1ae08c[_0x773f('0x16')],'transfererconnectedlinename':_0x1ae08c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1ae08c[_0x773f('0x17')],'transferercontext':_0x1ae08c['secondtransferercontext'],'transfererexten':_0x1ae08c[_0x773f('0x18')],'transfererlinkedid':_0x1ae08c['origtransfererlinkedid'],'transfereechannel':_0x1ae08c[_0x773f('0x19')],'transfereecalleridnum':_0x1ae08c[_0x773f('0x1a')],'transfereecalleridname':_0x1ae08c[_0x773f('0x1b')],'transfereeconnectedlinenum':_0x1ae08c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1ae08c[_0x773f('0x1c')],'transfereeaccountcode':_0x1ae08c['transfertargetaccountcode'],'transfereecontext':_0x1ae08c[_0x773f('0x1d')],'transfereeexten':_0x1ae08c[_0x773f('0x1e')],'transfereelinkedid':_0x1ae08c['transfertargetlinkedid'],'isexternal':_0x1ae08c[_0x773f('0xf')],'context':_0x1ae08c[_0x773f('0x1f')],'extension':_0x1ae08c[_0x773f('0x20')],'type':_0x773f('0x21')},'log':_0x773f('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 9c9763d..a78c82b 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 _0x24ca=['QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','keys','reload','Reload','Action','catch','message','join','pick','action','then','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','isNil','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','voicechannel','map','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','type','inbound','filter','count','rows','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','emit','custom:','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','name','timers','timer','updateAcw','agents','pause'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x24ca[_0x4d82ea];return _0x257f4a;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var jayson=require(_0xa24c('0x1'));var schema=require(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var config=require('../../../config/environment');var properties=require(_0xa24c('0x4'));var ami=require(_0xa24c('0x5'));var VoiceQueueSummary=require(_0xa24c('0x6'));exports[_0xa24c('0x7')]=function(_0xe76a30,_0x15a5cd,_0xf0511){return new Promise(function(_0x3c0aaa,_0x2dd348){var _0x257264={'QueuePause':function(_0x9a5013){return new Promise(function(_0x481196){var _0x42d89c=util[_0xa24c('0x8')](_0xa24c('0x9'),'SIP',_0x9a5013[_0xa24c('0xa')]);if(_0xe76a30[_0xa24c('0xb')]&&_0xe76a30[_0xa24c('0xb')][_0x42d89c]&&_0xe76a30[_0xa24c('0xb')][_0x42d89c][_0xa24c('0xc')]){_0xe76a30[_0xa24c('0xb')][_0x42d89c][_0xa24c('0xd')]();}if(_0xe76a30[_0xa24c('0xe')][_0x42d89c]){_0xe76a30[_0xa24c('0xe')][_0x42d89c]['updateStatusRealtime']({'statePause':_0x9a5013[_0xa24c('0xf')]?!![]:![]});}_0x481196({'code':0xc8,'message':_0xa24c('0x10')});});},'Reload':function(_0xcee4fe){var _0x2c2af8=this;return new Promise(function(_0x5a9486,_0x3ad0bf){if(ami[_0xa24c('0x11')]()==![]){return _0x3ad0bf(_0x2c2af8[_0xa24c('0x12')](0x1f4,[config[_0xa24c('0x13')]['ip'],config[_0xa24c('0x13')][_0xa24c('0x14')],_0xa24c('0x15')]['join']('\x20')));}_0xcee4fe=_['pick'](_0xcee4fe,_[_0xa24c('0x16')](properties[_0xa24c('0x17')]['module']));_0xcee4fe['action']=_0xa24c('0x18');return ami[_0xa24c('0x19')](_0xcee4fe)['then'](function(_0x2a64ff){_0x5a9486({'code':0xc8,'message':_0x2a64ff['message']});})[_0xa24c('0x1a')](function(_0x2a610a){_0x3ad0bf(_0x2c2af8[_0xa24c('0x12')](0x1f5,_0x2a610a[_0xa24c('0x1b')]));});});},'Command':function(_0x4ff97c){var _0x16d363=this;return new Promise(function(_0x18b7e0,_0x773f70){if(ami['isConnected']()==![]){return _0x773f70(_0x16d363['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xa24c('0x14')],_0xa24c('0x15')][_0xa24c('0x1c')]('\x20')));}_0x4ff97c=_[_0xa24c('0x1d')](_0x4ff97c,'command');_0x4ff97c[_0xa24c('0x1e')]='Command';return ami[_0xa24c('0x19')](_0x4ff97c)[_0xa24c('0x1f')](function(_0x4a1cda){_0x18b7e0({'code':0xc8,'message':_0x4a1cda[_0xa24c('0x20')]});})[_0xa24c('0x1a')](function(_0x43a0c0){_0x773f70(_0x16d363[_0xa24c('0x12')](0x1f5,_0x43a0c0[_0xa24c('0x1b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x47e0eb){var _0xec9167=[];for(var _0x5cc9cb in _0xe76a30[_0xa24c('0x21')]){if(_0xe76a30[_0xa24c('0x21')][_0xa24c('0x22')](_0x5cc9cb)){var _0x51dc3f=_0xe76a30[_0xa24c('0x21')][_0x5cc9cb];var _0x31c4d9=new VoiceQueueSummary(_0x51dc3f);_0xec9167[_0xa24c('0x23')](_0x31c4d9);}}_0x47e0eb({'count':_0xec9167[_0xa24c('0x24')],'rows':_0xec9167});});},'UpdateVoiceQueue':function(_0x11e4e0){return new Promise(function(_0x3ad0e6,_0x39609a){var _0x5b23f4=_[_0xa24c('0x25')](_0xe76a30[_0xa24c('0x21')],{'id':parseInt(_0x11e4e0['id'])});var _0x152120=_[_0xa24c('0x26')](_0x11e4e0,['id']);if(_0x5b23f4){for(var _0x5e491e in _0x152120){if(typeof _0x152120[_0x5e491e]!==_0xa24c('0x27')&&typeof _0x5b23f4[_0x5e491e]!==_0xa24c('0x27')){_0x5b23f4[_0x5e491e]=_0x152120[_0x5e491e];}}_0x3ad0e6(_0x5b23f4);}else{_0x39609a();}});},'VoiceChannels':function(){return new Promise(function(_0x97c08){var _0x59dbeb=_[_0xa24c('0x28')](_0xe76a30[_0xa24c('0x29')]);_0x97c08({'count':_0x59dbeb[_0xa24c('0x24')],'rows':_0x59dbeb});});},'VoiceChannelMixMonitor':function(_0x4ae35c){var _0x245fb2=this;return new Promise(function(_0x5e0226,_0x1102ab){if(ami[_0xa24c('0x11')]()==![]){return _0x1102ab(_0x245fb2[_0xa24c('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xa24c('0x13')][_0xa24c('0x14')],_0xa24c('0x15')]['join']('\x20')));}var _0x1c1ed3=schema(properties['voicechannel'])[_0xa24c('0x2')](_0x4ae35c);if(_0x1c1ed3[_0xa24c('0x24')]>0x0){return _0x1102ab(_0x245fb2['error'](0x1f4,_['map'](_0x1c1ed3,_0xa24c('0x1b'))[_0xa24c('0x1c')](',\x20')));}var _0x182e86=_[_0xa24c('0x25')](_0xe76a30[_0xa24c('0x29')],{'uniqueid':_0x4ae35c[_0xa24c('0x2a')]});if(_0x182e86&&_0x182e86[_0xa24c('0x2b')]){var _0x4b4dc2=util[_0xa24c('0x8')](_0xa24c('0x2c'),_0x4ae35c[_0xa24c('0x2d')]||_0x4ae35c[_0xa24c('0x2a')],_0x4ae35c[_0xa24c('0x8')]||_0xa24c('0x2e'));return ami[_0xa24c('0x19')]({'action':_0xa24c('0x2f'),'channel':_0x182e86[_0xa24c('0x2b')],'file':_0x4b4dc2,'options':_0xa24c('0x30')})['then'](function(_0x70a957){var _0x66f5a6=_[_0xa24c('0x25')](_0x182e86[_0xa24c('0x31')],{'filename':'/var/spool/asterisk/monitor/'+_0x4b4dc2['toLowerCase']()});if(_[_0xa24c('0x32')](_0x66f5a6)){_0x182e86['monitors'][_0xa24c('0x23')]({'filename':_0xa24c('0x33')+_0x4b4dc2[_0xa24c('0x34')](),'createdAt':moment()[_0xa24c('0x8')](_0xa24c('0x35')),'mixmonitorid':_0x70a957['mixmonitorid'],'status':'rec'});}else{_0x66f5a6[_0xa24c('0x36')]=_0x70a957[_0xa24c('0x36')];_0x66f5a6[_0xa24c('0x37')]=_0xa24c('0x38');}_0x5e0226({'code':0xc8,'message':[_0x4ae35c[_0xa24c('0x2a')],_0xa24c('0x39'),_0x70a957['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x70a957[_0xa24c('0x36')]});})[_0xa24c('0x1a')](function(_0x4037d6){_0x1102ab(_0x245fb2[_0xa24c('0x12')](0x1f5,[_0x4ae35c[_0xa24c('0x2a')],_0x4037d6['message'][_0xa24c('0x34')]()][_0xa24c('0x1c')]('\x20')));});}else{return _0x1102ab(_0x245fb2['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0xba7407){var _0x44f6ae=this;return new Promise(function(_0x231eea,_0x537849){if(ami['isConnected']()==![]){return _0x537849(_0x44f6ae[_0xa24c('0x12')](0x1f4,[config[_0xa24c('0x13')]['ip'],config[_0xa24c('0x13')][_0xa24c('0x14')],_0xa24c('0x15')][_0xa24c('0x1c')]('\x20')));}var _0x23d1e0=schema(properties[_0xa24c('0x3a')])['validate'](_0xba7407);if(_0x23d1e0['length']>0x0){return _0x537849(_0x44f6ae[_0xa24c('0x12')](0x1f4,_[_0xa24c('0x3b')](_0x23d1e0,_0xa24c('0x1b'))['join'](',\x20')));}var _0x472c1e=_[_0xa24c('0x25')](_0xe76a30[_0xa24c('0x29')],{'uniqueid':_0xba7407[_0xa24c('0x2a')]});if(_0x472c1e){return Promise[_0xa24c('0x3c')]()[_0xa24c('0x1f')](function(){if(_0x472c1e[_0xa24c('0x2b')]){return ami[_0xa24c('0x19')]({'action':_0xa24c('0x3d'),'channel':_0x472c1e[_0xa24c('0x2b')],'mixmonitorid':_0xba7407['mixmonitorid']})[_0xa24c('0x1a')](function(){});}})[_0xa24c('0x1f')](function(){if(_0x472c1e[_0xa24c('0x3e')]){return ami['Action']({'action':_0xa24c('0x3d'),'channel':_0x472c1e[_0xa24c('0x3e')],'mixmonitorid':_0xba7407[_0xa24c('0x36')]})[_0xa24c('0x1a')](function(){});}})[_0xa24c('0x1f')](function(){var _0x16d340=_[_0xa24c('0x25')](_0x472c1e[_0xa24c('0x31')],{'mixmonitorid':_0xba7407[_0xa24c('0x36')]});if(_0x16d340){_0x16d340[_0xa24c('0x37')]=_0xa24c('0x3f');}})['then'](function(){var _0x29a84d=util[_0xa24c('0x8')](_0xa24c('0x2c'),_0xba7407[_0xa24c('0x2d')]||_0xba7407[_0xa24c('0x2a')],_0xba7407[_0xa24c('0x8')]||_0xa24c('0x2e'));var _0x2250b9=_[_0xa24c('0x25')](_0x472c1e['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x29a84d[_0xa24c('0x34')]()});if(_0x2250b9){_0x2250b9['status']=_0xa24c('0x3f');}})[_0xa24c('0x1f')](function(){_0x231eea({'code':0xc8,'message':[_0xba7407['uniqueid'],_0xa24c('0x40')][_0xa24c('0x1c')]('\x20')});})[_0xa24c('0x1a')](function(_0x568938){_0x537849(_0x44f6ae['error'](0x1f5,[_0xba7407[_0xa24c('0x2a')],_0x568938['message'][_0xa24c('0x34')]()][_0xa24c('0x1c')]('\x20')));});}else{return _0x537849(_0x44f6ae[_0xa24c('0x12')](0x1f5,_0xa24c('0x41')));}});},'VoiceQueuesChannels':function(_0x228401){var _0x1fa739=this;return new Promise(function(_0x3f3ce6){var _0x286d57=_[_0xa24c('0x28')](_0xe76a30[_0xa24c('0x42')]);var _0x4ea43d={'count':_0x286d57[_0xa24c('0x24')],'rows':_0x286d57};if(_0x228401&&_0x228401[_0xa24c('0x43')]){if(![_0xa24c('0x44'),'outbound']['includes'](_0x228401['type'])){return _0x2dd348(_0x1fa739[_0xa24c('0x12')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x4757ff=_[_0xa24c('0x45')](_0x286d57,function(_0x5a35e5){return _0x5a35e5[_0xa24c('0x43')]===_0x228401[_0xa24c('0x43')];});_0x4ea43d[_0xa24c('0x46')]=_0x4757ff[_0xa24c('0x24')];_0x4ea43d[_0xa24c('0x47')]=_0x4757ff;}_0x3f3ce6(_0x4ea43d);});},'VoiceQueuesChannel':function(_0x3a72e3){var _0x3816f7=this;return new Promise(function(_0xbeab78,_0x518c2a){var _0x172645=schema(properties['voicequeuechannel'])['validate'](_0x3a72e3);if(_0x172645['length']>0x0){return _0x518c2a(_0x3816f7['error'](0x1f4,_['map'](_0x172645,_0xa24c('0x1b'))['join'](',\x20')));}var _0x27c184=_[_0xa24c('0x25')](_0xe76a30[_0xa24c('0x42')],{'uniqueid':_0x3a72e3[_0xa24c('0x2a')]});if(_0x27c184){_0xbeab78(_0x27c184);}else{return _0x518c2a(_0x3816f7[_0xa24c('0x12')](0x1f5,_0xa24c('0x41')));}});},'VoiceQueuesChannelHangup':function(_0x6f5aad){var _0x2406d6=this;return new Promise(function(_0x45f971,_0x3de0e3){if(ami[_0xa24c('0x11')]()==![]){return _0x3de0e3(_0x2406d6[_0xa24c('0x12')](0x1f4,[config[_0xa24c('0x13')]['ip'],config[_0xa24c('0x13')][_0xa24c('0x14')],'ami\x20disconnected'][_0xa24c('0x1c')]('\x20')));}var _0x168601=schema(properties['voicequeuechannelhangup'])[_0xa24c('0x2')](_0x6f5aad);if(_0x168601[_0xa24c('0x24')]>0x0){return _0x3de0e3(_0x2406d6[_0xa24c('0x12')](0x1f4,_[_0xa24c('0x3b')](_0x168601,'message')['join'](',\x20')));}var _0x40119d=_['find'](_0xe76a30['queueChannels'],{'uniqueid':_0x6f5aad[_0xa24c('0x2a')]});if(_0x40119d&&_0x40119d[_0xa24c('0x2b')]){return ami[_0xa24c('0x19')]({'action':_0xa24c('0x48'),'channel':_0x40119d['channel']})['then'](function(_0x29b836){_0x45f971({'code':0xc8,'message':[_0x6f5aad['uniqueid'],_0x29b836['message'][_0xa24c('0x34')]()][_0xa24c('0x1c')]('\x20')});})[_0xa24c('0x1a')](function(_0x54528f){_0x3de0e3(_0x2406d6[_0xa24c('0x12')](0x1f5,[_0x6f5aad[_0xa24c('0x2a')],_0x54528f['message'][_0xa24c('0x34')]()][_0xa24c('0x1c')]('\x20')));});}else{return _0x3de0e3(_0x2406d6[_0xa24c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x1e6be9){var _0x34e261=this;return new Promise(function(_0x21439a,_0x7aab6e){if(ami[_0xa24c('0x11')]()==![]){return _0x7aab6e(_0x34e261['error'](0x1f4,[config[_0xa24c('0x13')]['ip'],config[_0xa24c('0x13')][_0xa24c('0x14')],_0xa24c('0x15')][_0xa24c('0x1c')]('\x20')));}var _0x2ca3fa=schema(properties[_0xa24c('0x49')])['validate'](_0x1e6be9);if(_0x2ca3fa[_0xa24c('0x24')]>0x0){return _0x7aab6e(_0x34e261[_0xa24c('0x12')](0x1f4,_['map'](_0x2ca3fa,_0xa24c('0x1b'))[_0xa24c('0x1c')](',\x20')));}var _0x14da5e=_[_0xa24c('0x25')](_0xe76a30[_0xa24c('0x42')],{'uniqueid':_0x1e6be9[_0xa24c('0x2a')]});if(_0x14da5e&&_0x14da5e[_0xa24c('0x2b')]){return ami[_0xa24c('0x19')]({'action':_0xa24c('0x4a'),'channel':_0x14da5e[_0xa24c('0x2b')],'exten':_0x1e6be9['exten'],'context':_0x1e6be9[_0xa24c('0x4b')]||_0x14da5e[_0xa24c('0x4b')],'priority':0x1})[_0xa24c('0x1f')](function(_0x5e52f4){_0x21439a({'code':0xc8,'message':[_0x1e6be9[_0xa24c('0x2a')],_0x5e52f4[_0xa24c('0x1b')][_0xa24c('0x34')]()]['join']('\x20')});})[_0xa24c('0x1a')](function(_0x6a4385){_0x7aab6e(_0x34e261[_0xa24c('0x12')](0x1f5,[_0x1e6be9[_0xa24c('0x2a')],_0x6a4385[_0xa24c('0x1b')][_0xa24c('0x34')]()]['join']('\x20')));});}else{return _0x7aab6e(_0x34e261['error'](0x1f5,_0xa24c('0x41')));}});},'Agents':function(_0x4b281b){return new Promise(function(_0x16678e){var _0x1879ae=_[_0xa24c('0x28')](_0xe76a30[_0xa24c('0xe')]);if(_0x4b281b&&_0x4b281b['id']){var _0x12d715=_['find'](_0x1879ae,function(_0x1f7b20){return _0x1f7b20['id']===_0x4b281b['id'];});_0x16678e(_0x12d715);}else{_0x16678e({'count':_0x1879ae[_0xa24c('0x24')],'rows':_0x1879ae});}});},'Telephones':function(){return new Promise(function(_0x467e60){var _0x38201d=_[_0xa24c('0x28')](_0xe76a30[_0xa24c('0x4c')]);_0x467e60({'count':_0x38201d['length'],'rows':_0x38201d});});},'Trunks':function(){return new Promise(function(_0x34d8c8){var _0x1285e9=_[_0xa24c('0x28')](_0xe76a30[_0xa24c('0x4d')]);_0x34d8c8({'count':_0x1285e9['length'],'rows':_0x1285e9});});},'OutboundChannels':function(){return new Promise(function(_0x403bf1){var _0x4d8e3a=_[_0xa24c('0x28')](_0xe76a30[_0xa24c('0x4e')]);_0x403bf1({'count':_0x4d8e3a[_0xa24c('0x24')],'rows':_0x4d8e3a});});},'Outbound':function(){return new Promise(function(_0x180da2){_0x180da2(_0xe76a30['outbound']);});},'Campaigns':function(){return new Promise(function(_0x2e612d){var _0x2f3afb=_['values'](_0xe76a30[_0xa24c('0x4f')]);_0x2e612d({'count':_0x2f3afb[_0xa24c('0x24')],'rows':_0x2f3afb});});},'VoiceQueuesPreview':function(_0x135cef){var _0x3e0c08=this;return new Promise(function(_0x8bd3fb,_0x288cb7){_0x15a5cd[_0xa24c('0x50')](_0x135cef['id'])[_0xa24c('0x1f')](function(_0x49c5bb){_0x8bd3fb({'code':0xc8,'message':_0x49c5bb[_0xa24c('0x1b')]});})[_0xa24c('0x1a')](function(_0x2cae90){_0x288cb7(_0x3e0c08[_0xa24c('0x12')](0x1f4,_0x2cae90[_0xa24c('0x1b')]));});});},'EventManager':function(_0x209b42){var _0x118ecf=this;return new Promise(function(_0x13dbef,_0x4562e1){if(!_0x209b42[_0xa24c('0x51')]){return _0x4562e1(_0x118ecf[_0xa24c('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xa24c('0x52')](_0xa24c('0x53')+_0x209b42['event'],_0x209b42[_0xa24c('0x1b')]);_0x13dbef({'code':0xc8,'message':_0x209b42});});},'FaxAccounts':function(){return new Promise(function(_0x3f212f){var _0x1f7c59=_['values'](_0xe76a30['faxAccounts']);_0x3f212f({'count':_0x1f7c59[_0xa24c('0x24')],'rows':_0x1f7c59});});},'SendFax':function(_0x4c9b19){var _0x53928f=this;return new Promise(function(_0x105ed5,_0x3101d5){_0xf0511[_0xa24c('0x54')](_0x4c9b19)[_0xa24c('0x1f')](function(_0x371c80){_0x105ed5({'code':0xc8,'message':_0x371c80[_0xa24c('0x1b')]});})['catch'](function(_0x47fc5f){_0x3101d5(_0x53928f['error'](0x1f4,_0x47fc5f[_0xa24c('0x1b')]));});});},'CheckAfterSend':function(_0x521894){var _0x53462e=this;return new Promise(function(_0xb3f567,_0x3eb97c){_0xf0511[_0xa24c('0x55')](_0x521894)[_0xa24c('0x1f')](function(_0x84ddcc){_0xb3f567({'code':0xc8,'message':_0x84ddcc[_0xa24c('0x1b')]});})[_0xa24c('0x1a')](function(_0x170b65){_0x3eb97c(_0x53462e[_0xa24c('0x12')](0x1f4,_0x170b65['message']));});});}};var _0x3897ca=jayson[_0xa24c('0x56')](_0x257264)[_0xa24c('0x57')]();_0x3897ca['on'](_0xa24c('0x12'),function(_0x314cd3){return _0x2dd348(_0x314cd3);});_0x3897ca[_0xa24c('0x7')](0x232a,_0xa24c('0x58'),function(){console[_0xa24c('0x59')](_0xa24c('0x5a'),0x232a);return _0x3c0aaa(_0xa24c('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x2eb2=['asterisk','ami\x20disconnected','join','module','Action','message','catch','isConnected','username','command','action','Command','then','content','voiceQueues','hasOwnProperty','length','omit','undefined','values','channels','voicechannel','find','uniqueid','channel','%s.%s','filename','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','type','outbound','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','Event\x20name\x20mandatory','emit','event','faxAccounts','send','checkAfterSend','server','http','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','moment','../../../config/environment','../properties','../model/voiceQueueSummary','format','%s/%s','SIP','name','timers','agents','QueuePause','error'];(function(_0x9828dd,_0x582d0e){var _0x506006=function(_0x60c052){while(--_0x60c052){_0x9828dd['push'](_0x9828dd['shift']());}};_0x506006(++_0x582d0e);}(_0x2eb2,0x19f));var _0x22eb=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x2eb2[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var jayson=require(_0x22eb('0x1'));var schema=require(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var config=require(_0x22eb('0x4'));var properties=require(_0x22eb('0x5'));var ami=require('../ami');var VoiceQueueSummary=require(_0x22eb('0x6'));exports['listen']=function(_0x591824,_0x1dfef7,_0x10e116){return new Promise(function(_0x35dd5b,_0x2a9850){var _0x4539d0={'QueuePause':function(_0x396806){return new Promise(function(_0x33ddef){var _0x3375d6=util[_0x22eb('0x7')](_0x22eb('0x8'),_0x22eb('0x9'),_0x396806[_0x22eb('0xa')]);if(_0x591824['timers']&&_0x591824[_0x22eb('0xb')][_0x3375d6]&&_0x591824['timers'][_0x3375d6]['timer']){_0x591824[_0x22eb('0xb')][_0x3375d6]['updateAcw']();}if(_0x591824[_0x22eb('0xc')][_0x3375d6]){_0x591824[_0x22eb('0xc')][_0x3375d6]['updateStatusRealtime']({'statePause':_0x396806['pause']?!![]:![]});}_0x33ddef({'code':0xc8,'message':_0x22eb('0xd')});});},'Reload':function(_0x189f05){var _0x128d43=this;return new Promise(function(_0x1e2a53,_0x427439){if(ami['isConnected']()==![]){return _0x427439(_0x128d43[_0x22eb('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x22eb('0xf')]['username'],_0x22eb('0x10')][_0x22eb('0x11')]('\x20')));}_0x189f05=_['pick'](_0x189f05,_['keys'](properties['reload'][_0x22eb('0x12')]));_0x189f05['action']='Reload';return ami[_0x22eb('0x13')](_0x189f05)['then'](function(_0x4d9b09){_0x1e2a53({'code':0xc8,'message':_0x4d9b09[_0x22eb('0x14')]});})[_0x22eb('0x15')](function(_0x385bcb){_0x427439(_0x128d43[_0x22eb('0xe')](0x1f5,_0x385bcb[_0x22eb('0x14')]));});});},'Command':function(_0x4bc0a2){var _0x4182a8=this;return new Promise(function(_0x12bbd1,_0x10d182){if(ami[_0x22eb('0x16')]()==![]){return _0x10d182(_0x4182a8[_0x22eb('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x22eb('0xf')][_0x22eb('0x17')],_0x22eb('0x10')]['join']('\x20')));}_0x4bc0a2=_['pick'](_0x4bc0a2,_0x22eb('0x18'));_0x4bc0a2[_0x22eb('0x19')]=_0x22eb('0x1a');return ami[_0x22eb('0x13')](_0x4bc0a2)[_0x22eb('0x1b')](function(_0x3e8c1c){_0x12bbd1({'code':0xc8,'message':_0x3e8c1c[_0x22eb('0x1c')]});})['catch'](function(_0x2e8f7c){_0x10d182(_0x4182a8[_0x22eb('0xe')](0x1f5,_0x2e8f7c[_0x22eb('0x14')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3031b3){var _0x420d4f=[];for(var _0x4da252 in _0x591824[_0x22eb('0x1d')]){if(_0x591824[_0x22eb('0x1d')][_0x22eb('0x1e')](_0x4da252)){var _0x5a001e=_0x591824[_0x22eb('0x1d')][_0x4da252];var _0x259847=new VoiceQueueSummary(_0x5a001e);_0x420d4f['push'](_0x259847);}}_0x3031b3({'count':_0x420d4f[_0x22eb('0x1f')],'rows':_0x420d4f});});},'UpdateVoiceQueue':function(_0x222ef3){return new Promise(function(_0x1e3015,_0x2924f6){var _0x2da5c6=_['find'](_0x591824['voiceQueues'],{'id':parseInt(_0x222ef3['id'])});var _0x2a950e=_[_0x22eb('0x20')](_0x222ef3,['id']);if(_0x2da5c6){for(var _0x44cf91 in _0x2a950e){if(typeof _0x2a950e[_0x44cf91]!==_0x22eb('0x21')&&typeof _0x2da5c6[_0x44cf91]!==_0x22eb('0x21')){_0x2da5c6[_0x44cf91]=_0x2a950e[_0x44cf91];}}_0x1e3015(_0x2da5c6);}else{_0x2924f6();}});},'VoiceChannels':function(){return new Promise(function(_0x14724e){var _0x2375e7=_[_0x22eb('0x22')](_0x591824[_0x22eb('0x23')]);_0x14724e({'count':_0x2375e7[_0x22eb('0x1f')],'rows':_0x2375e7});});},'VoiceChannelMixMonitor':function(_0x24e9dc){var _0x5a37f8=this;return new Promise(function(_0x54f401,_0x2f5a25){if(ami['isConnected']()==![]){return _0x2f5a25(_0x5a37f8[_0x22eb('0xe')](0x1f4,[config[_0x22eb('0xf')]['ip'],config[_0x22eb('0xf')][_0x22eb('0x17')],_0x22eb('0x10')][_0x22eb('0x11')]('\x20')));}var _0x35fb89=schema(properties[_0x22eb('0x24')])[_0x22eb('0x2')](_0x24e9dc);if(_0x35fb89[_0x22eb('0x1f')]>0x0){return _0x2f5a25(_0x5a37f8['error'](0x1f4,_['map'](_0x35fb89,_0x22eb('0x14'))['join'](',\x20')));}var _0x55ee20=_[_0x22eb('0x25')](_0x591824[_0x22eb('0x23')],{'uniqueid':_0x24e9dc[_0x22eb('0x26')]});if(_0x55ee20&&_0x55ee20[_0x22eb('0x27')]){var _0x45c53e=util[_0x22eb('0x7')](_0x22eb('0x28'),_0x24e9dc[_0x22eb('0x29')]||_0x24e9dc[_0x22eb('0x26')],_0x24e9dc[_0x22eb('0x7')]||'wav');return ami[_0x22eb('0x13')]({'action':'MixMonitor','channel':_0x55ee20['channel'],'file':_0x45c53e,'options':_0x22eb('0x2a')})[_0x22eb('0x1b')](function(_0x48e47e){var _0x42e9bd=_[_0x22eb('0x25')](_0x55ee20[_0x22eb('0x2b')],{'filename':_0x22eb('0x2c')+_0x45c53e[_0x22eb('0x2d')]()});if(_['isNil'](_0x42e9bd)){_0x55ee20[_0x22eb('0x2b')][_0x22eb('0x2e')]({'filename':'/var/spool/asterisk/monitor/'+_0x45c53e[_0x22eb('0x2d')](),'createdAt':moment()[_0x22eb('0x7')](_0x22eb('0x2f')),'mixmonitorid':_0x48e47e[_0x22eb('0x30')],'status':_0x22eb('0x31')});}else{_0x42e9bd['mixmonitorid']=_0x48e47e['mixmonitorid'];_0x42e9bd[_0x22eb('0x32')]=_0x22eb('0x31');}_0x54f401({'code':0xc8,'message':[_0x24e9dc['uniqueid'],_0x22eb('0x33'),_0x48e47e[_0x22eb('0x30')]][_0x22eb('0x11')]('\x20'),'mixmonitorid':_0x48e47e['mixmonitorid']});})[_0x22eb('0x15')](function(_0x3377eb){_0x2f5a25(_0x5a37f8[_0x22eb('0xe')](0x1f5,[_0x24e9dc[_0x22eb('0x26')],_0x3377eb[_0x22eb('0x14')][_0x22eb('0x2d')]()]['join']('\x20')));});}else{return _0x2f5a25(_0x5a37f8[_0x22eb('0xe')](0x1f5,_0x22eb('0x34')));}});},'VoiceChannelStopMixMonitor':function(_0x515b6d){var _0x24ad2a=this;return new Promise(function(_0x44d39f,_0x204092){if(ami[_0x22eb('0x16')]()==![]){return _0x204092(_0x24ad2a[_0x22eb('0xe')](0x1f4,[config[_0x22eb('0xf')]['ip'],config[_0x22eb('0xf')][_0x22eb('0x17')],_0x22eb('0x10')][_0x22eb('0x11')]('\x20')));}var _0x3e1826=schema(properties[_0x22eb('0x24')])[_0x22eb('0x2')](_0x515b6d);if(_0x3e1826[_0x22eb('0x1f')]>0x0){return _0x204092(_0x24ad2a[_0x22eb('0xe')](0x1f4,_[_0x22eb('0x35')](_0x3e1826,_0x22eb('0x14'))[_0x22eb('0x11')](',\x20')));}var _0x507f21=_[_0x22eb('0x25')](_0x591824[_0x22eb('0x23')],{'uniqueid':_0x515b6d['uniqueid']});if(_0x507f21){return Promise[_0x22eb('0x36')]()[_0x22eb('0x1b')](function(){if(_0x507f21['channel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x507f21[_0x22eb('0x27')],'mixmonitorid':_0x515b6d[_0x22eb('0x30')]})['catch'](function(){});}})['then'](function(){if(_0x507f21[_0x22eb('0x37')]){return ami[_0x22eb('0x13')]({'action':_0x22eb('0x38'),'channel':_0x507f21[_0x22eb('0x37')],'mixmonitorid':_0x515b6d[_0x22eb('0x30')]})[_0x22eb('0x15')](function(){});}})[_0x22eb('0x1b')](function(){var _0x147ca0=_['find'](_0x507f21['monitors'],{'mixmonitorid':_0x515b6d[_0x22eb('0x30')]});if(_0x147ca0){_0x147ca0['status']=_0x22eb('0x39');}})['then'](function(){var _0x8a2b2c=util['format']('%s.%s',_0x515b6d['filename']||_0x515b6d['uniqueid'],_0x515b6d[_0x22eb('0x7')]||'wav');var _0x320211=_[_0x22eb('0x25')](_0x507f21['monitors'],{'filename':_0x22eb('0x2c')+_0x8a2b2c['toLowerCase']()});if(_0x320211){_0x320211[_0x22eb('0x32')]=_0x22eb('0x39');}})[_0x22eb('0x1b')](function(){_0x44d39f({'code':0xc8,'message':[_0x515b6d[_0x22eb('0x26')],_0x22eb('0x3a')][_0x22eb('0x11')]('\x20')});})[_0x22eb('0x15')](function(_0x517858){_0x204092(_0x24ad2a[_0x22eb('0xe')](0x1f5,[_0x515b6d['uniqueid'],_0x517858[_0x22eb('0x14')][_0x22eb('0x2d')]()]['join']('\x20')));});}else{return _0x204092(_0x24ad2a[_0x22eb('0xe')](0x1f5,_0x22eb('0x34')));}});},'VoiceQueuesChannels':function(_0x4da671){var _0x31216f=this;return new Promise(function(_0x4fee5c){var _0x6c0600=_[_0x22eb('0x22')](_0x591824[_0x22eb('0x3b')]);var _0x3e3fae={'count':_0x6c0600[_0x22eb('0x1f')],'rows':_0x6c0600};if(_0x4da671&&_0x4da671[_0x22eb('0x3c')]){if(!['inbound',_0x22eb('0x3d')]['includes'](_0x4da671[_0x22eb('0x3c')])){return _0x2a9850(_0x31216f['error'](0x190,_0x22eb('0x3e')));}var _0x254b53=_[_0x22eb('0x3f')](_0x6c0600,function(_0x2c1b87){return _0x2c1b87[_0x22eb('0x3c')]===_0x4da671['type'];});_0x3e3fae['count']=_0x254b53[_0x22eb('0x1f')];_0x3e3fae[_0x22eb('0x40')]=_0x254b53;}_0x4fee5c(_0x3e3fae);});},'VoiceQueuesChannel':function(_0x490110){var _0x308ef6=this;return new Promise(function(_0xdf9531,_0x2c5165){var _0x27f8a2=schema(properties[_0x22eb('0x41')])[_0x22eb('0x2')](_0x490110);if(_0x27f8a2[_0x22eb('0x1f')]>0x0){return _0x2c5165(_0x308ef6[_0x22eb('0xe')](0x1f4,_[_0x22eb('0x35')](_0x27f8a2,_0x22eb('0x14'))[_0x22eb('0x11')](',\x20')));}var _0x5f30c9=_[_0x22eb('0x25')](_0x591824[_0x22eb('0x3b')],{'uniqueid':_0x490110[_0x22eb('0x26')]});if(_0x5f30c9){_0xdf9531(_0x5f30c9);}else{return _0x2c5165(_0x308ef6[_0x22eb('0xe')](0x1f5,_0x22eb('0x34')));}});},'VoiceQueuesChannelHangup':function(_0x24465a){var _0x15d191=this;return new Promise(function(_0x3871ef,_0x26fc89){if(ami[_0x22eb('0x16')]()==![]){return _0x26fc89(_0x15d191[_0x22eb('0xe')](0x1f4,[config[_0x22eb('0xf')]['ip'],config[_0x22eb('0xf')][_0x22eb('0x17')],'ami\x20disconnected']['join']('\x20')));}var _0x36ee0d=schema(properties[_0x22eb('0x42')])[_0x22eb('0x2')](_0x24465a);if(_0x36ee0d[_0x22eb('0x1f')]>0x0){return _0x26fc89(_0x15d191[_0x22eb('0xe')](0x1f4,_['map'](_0x36ee0d,_0x22eb('0x14'))[_0x22eb('0x11')](',\x20')));}var _0x590b10=_['find'](_0x591824[_0x22eb('0x3b')],{'uniqueid':_0x24465a[_0x22eb('0x26')]});if(_0x590b10&&_0x590b10[_0x22eb('0x27')]){return ami[_0x22eb('0x13')]({'action':_0x22eb('0x43'),'channel':_0x590b10[_0x22eb('0x27')]})[_0x22eb('0x1b')](function(_0x22104f){_0x3871ef({'code':0xc8,'message':[_0x24465a[_0x22eb('0x26')],_0x22104f[_0x22eb('0x14')][_0x22eb('0x2d')]()][_0x22eb('0x11')]('\x20')});})[_0x22eb('0x15')](function(_0x1d4aa1){_0x26fc89(_0x15d191['error'](0x1f5,[_0x24465a[_0x22eb('0x26')],_0x1d4aa1[_0x22eb('0x14')][_0x22eb('0x2d')]()]['join']('\x20')));});}else{return _0x26fc89(_0x15d191[_0x22eb('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x27b082){var _0x5347b4=this;return new Promise(function(_0x1919d0,_0x43f4a1){if(ami['isConnected']()==![]){return _0x43f4a1(_0x5347b4[_0x22eb('0xe')](0x1f4,[config[_0x22eb('0xf')]['ip'],config['asterisk']['username'],_0x22eb('0x10')][_0x22eb('0x11')]('\x20')));}var _0x1984f0=schema(properties[_0x22eb('0x44')])[_0x22eb('0x2')](_0x27b082);if(_0x1984f0[_0x22eb('0x1f')]>0x0){return _0x43f4a1(_0x5347b4['error'](0x1f4,_[_0x22eb('0x35')](_0x1984f0,'message')['join'](',\x20')));}var _0x30c3ae=_[_0x22eb('0x25')](_0x591824[_0x22eb('0x3b')],{'uniqueid':_0x27b082[_0x22eb('0x26')]});if(_0x30c3ae&&_0x30c3ae[_0x22eb('0x27')]){return ami[_0x22eb('0x13')]({'action':_0x22eb('0x45'),'channel':_0x30c3ae[_0x22eb('0x27')],'exten':_0x27b082['exten'],'context':_0x27b082['context']||_0x30c3ae[_0x22eb('0x46')],'priority':0x1})[_0x22eb('0x1b')](function(_0x49f182){_0x1919d0({'code':0xc8,'message':[_0x27b082[_0x22eb('0x26')],_0x49f182[_0x22eb('0x14')][_0x22eb('0x2d')]()][_0x22eb('0x11')]('\x20')});})[_0x22eb('0x15')](function(_0x3ff700){_0x43f4a1(_0x5347b4['error'](0x1f5,[_0x27b082[_0x22eb('0x26')],_0x3ff700[_0x22eb('0x14')][_0x22eb('0x2d')]()]['join']('\x20')));});}else{return _0x43f4a1(_0x5347b4['error'](0x1f5,_0x22eb('0x34')));}});},'Agents':function(_0x753980){return new Promise(function(_0xa4178f){var _0x5ebeb5=_[_0x22eb('0x22')](_0x591824['agents']);if(_0x753980&&_0x753980['id']){var _0x1a305d=_[_0x22eb('0x25')](_0x5ebeb5,function(_0x3d7636){return _0x3d7636['id']===_0x753980['id'];});_0xa4178f(_0x1a305d);}else{_0xa4178f({'count':_0x5ebeb5[_0x22eb('0x1f')],'rows':_0x5ebeb5});}});},'Telephones':function(){return new Promise(function(_0x5703ab){var _0x1c0cc0=_[_0x22eb('0x22')](_0x591824[_0x22eb('0x47')]);_0x5703ab({'count':_0x1c0cc0[_0x22eb('0x1f')],'rows':_0x1c0cc0});});},'Trunks':function(){return new Promise(function(_0x1aa062){var _0x1ad08d=_[_0x22eb('0x22')](_0x591824[_0x22eb('0x48')]);_0x1aa062({'count':_0x1ad08d[_0x22eb('0x1f')],'rows':_0x1ad08d});});},'OutboundChannels':function(){return new Promise(function(_0x1c5b0b){var _0x14006f=_['values'](_0x591824[_0x22eb('0x49')]);_0x1c5b0b({'count':_0x14006f[_0x22eb('0x1f')],'rows':_0x14006f});});},'Outbound':function(){return new Promise(function(_0x5e7d49){_0x5e7d49(_0x591824['outbound']);});},'Campaigns':function(){return new Promise(function(_0x51d9f4){var _0x257c48=_[_0x22eb('0x22')](_0x591824['campaigns']);_0x51d9f4({'count':_0x257c48[_0x22eb('0x1f')],'rows':_0x257c48});});},'VoiceQueuesPreview':function(_0x15e08a){var _0xe6e71d=this;return new Promise(function(_0x41c50e,_0x8cbc83){_0x1dfef7['run'](_0x15e08a['id'])['then'](function(_0x297554){_0x41c50e({'code':0xc8,'message':_0x297554[_0x22eb('0x14')]});})[_0x22eb('0x15')](function(_0x4fffb3){_0x8cbc83(_0xe6e71d['error'](0x1f4,_0x4fffb3[_0x22eb('0x14')]));});});},'EventManager':function(_0x4be2d4){var _0x4d893a=this;return new Promise(function(_0x3568bc,_0xe524a1){if(!_0x4be2d4['event']){return _0xe524a1(_0x4d893a['error'](0x1f4,_0x22eb('0x4a')));}ami[_0x22eb('0x4b')]('custom:'+_0x4be2d4[_0x22eb('0x4c')],_0x4be2d4[_0x22eb('0x14')]);_0x3568bc({'code':0xc8,'message':_0x4be2d4});});},'FaxAccounts':function(){return new Promise(function(_0x1224b5){var _0x5823d0=_[_0x22eb('0x22')](_0x591824[_0x22eb('0x4d')]);_0x1224b5({'count':_0x5823d0[_0x22eb('0x1f')],'rows':_0x5823d0});});},'SendFax':function(_0x2a0c73){var _0x3697ad=this;return new Promise(function(_0x49578c,_0x9147e2){_0x10e116[_0x22eb('0x4e')](_0x2a0c73)[_0x22eb('0x1b')](function(_0x4bc34a){_0x49578c({'code':0xc8,'message':_0x4bc34a['message']});})[_0x22eb('0x15')](function(_0xc44944){_0x9147e2(_0x3697ad[_0x22eb('0xe')](0x1f4,_0xc44944['message']));});});},'CheckAfterSend':function(_0x215472){var _0x33df26=this;return new Promise(function(_0x2a0062,_0x5b797e){_0x10e116[_0x22eb('0x4f')](_0x215472)['then'](function(_0x532a59){_0x2a0062({'code':0xc8,'message':_0x532a59[_0x22eb('0x14')]});})[_0x22eb('0x15')](function(_0x1057f2){_0x5b797e(_0x33df26['error'](0x1f4,_0x1057f2[_0x22eb('0x14')]));});});}};var _0x3cf81c=jayson[_0x22eb('0x50')](_0x4539d0)[_0x22eb('0x51')]();_0x3cf81c['on'](_0x22eb('0xe'),function(_0x545c0a){return _0x2a9850(_0x545c0a);});_0x3cf81c[_0x22eb('0x52')](0x232a,'127.0.0.1',function(){console[_0x22eb('0x53')](_0x22eb('0x54'),0x232a);return _0x35dd5b(_0x22eb('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 3e5300d..e1ddbc5 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 _0x8998=['data2','data5','xmd-contactid','data3','phone','routeId','destcalleridnum','firstName','lastName','mobile','fax','ListId','scheduledAt','updatedAt','union','resolve','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','calleridname','','Unknown','destcalleridname','then','createContact','push','isNil','format','name','action','toLowerCase','merge','bluebird','ioredis','util','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','stringify','emit','exec','data1'];(function(_0x40043d,_0x2fb109){var _0x47a176=function(_0x50adcd){while(--_0x50adcd){_0x40043d['push'](_0x40043d['shift']());}};_0x47a176(++_0x2fb109);}(_0x8998,0x152));var _0x8899=function(_0x582cde,_0x20f78d){_0x582cde=_0x582cde-0x0;var _0x2ee01a=_0x8998[_0x582cde];return _0x2ee01a;};'use strict';var _=require('lodash');var BPromise=require(_0x8899('0x0'));var Redis=require(_0x8899('0x1'));var util=require(_0x8899('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x8899('0x3'));var cmContactRpc=require(_0x8899('0x4'));config[_0x8899('0x5')]=_['defaults'](config[_0x8899('0x5')],{'host':_0x8899('0x6'),'port':0x18eb});var io=require(_0x8899('0x7'))(new Redis(config[_0x8899('0x5')]));function emit(_0x12ade4,_0x321334,_0x5e0d7b,_0x28d163,_0x3a6794){logger['info']('[CM][%s][%s]',_0x12ade4,_0x321334['id'],_0x5e0d7b,_0x28d163,JSON[_0x8899('0x8')](_0x3a6794));io['to'](_0x5e0d7b)[_0x8899('0x9')](_0x28d163,_0x3a6794);}exports[_0x8899('0xa')]=function(_0x1aa47c,_0x4a7b3e,_0x1df50e,_0x37270b){var _0xdb5f76,_0x2cd9d6;var _0xc9b01e={};var _0x9872ad;var _0x2bebd6=Number(_0x1df50e[_0x8899('0xb')]);var _0x1b558d=_0x1df50e['data2']?Boolean(Number(_0x1df50e[_0x8899('0xc')])):![];var _0x45ff4e;var _0x1d9aa7=![];if(!_['isNil'](_0x1df50e['data5'])){if(_0x1df50e[_0x8899('0xd')]=='1')_0x1d9aa7=!![];}if(!_0x1d9aa7){if(_0x37270b[_0x8899('0xe')]){_0xc9b01e['id']=_0x37270b[_0x8899('0xe')];}}if(!_0xc9b01e['id']){_0xc9b01e['ListId']=_0x2bebd6;_0x45ff4e=_0x1df50e[_0x8899('0xf')]&&_0x1df50e['data3']!=='0'?_0x1df50e[_0x8899('0xf')]['split'](','):[_0x8899('0x10')];_0xc9b01e['$or']=_['map'](_0x45ff4e,function(_0x15a2ab){var _0x1f5196={};_0x1f5196[_0x15a2ab]=_0x37270b[_0x8899('0x11')]?_0x37270b[_0x8899('0x12')]:_0x37270b['calleridnum'];return _0x1f5196;});_0x9872ad=_0x37270b[_0x8899('0x11')]?_0x37270b[_0x8899('0x12')]:_0x37270b['calleridnum'];}var _0x2f5cb3=['id',_0x8899('0x13'),_0x8899('0x14'),_0x8899('0x10'),_0x8899('0x15'),_0x8899('0x16'),_0x8899('0x17'),'createdAt',_0x8899('0x18'),_0x8899('0x19')];var _0x4ac790=_[_0x8899('0x1a')](_0x2f5cb3,_0x45ff4e);BPromise[_0x8899('0x1b')]()['then'](cmContactRpc['getContacts']({'attributes':_0x4ac790,'where':_0xc9b01e,'phone':_0x9872ad}))['then'](function(_0x3e38de){_0x2cd9d6=_0x3e38de;if(!_[_0x8899('0x1c')](_0x2cd9d6)){if(_0x2cd9d6[_0x8899('0x1d')]===0x1){_0xdb5f76=_0x2cd9d6[0x0];logger[_0x8899('0x1e')](_0x8899('0x1f'),_0x37270b[_0x8899('0x20')],_0x4a7b3e['id'],_0xdb5f76['id']);}else{logger[_0x8899('0x1e')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x37270b[_0x8899('0x20')],_0x4a7b3e['id'],_[_0x8899('0x21')](_0x2cd9d6,'id')['join'](','));}return;}else{logger[_0x8899('0x1e')](_0x8899('0x22'),_0x37270b[_0x8899('0x20')],_0x4a7b3e['id']);var _0x5545c7={'ListId':_0x2bebd6};var _0x27e256=_0x1df50e[_0x8899('0x23')]&&_0x1df50e[_0x8899('0x23')]!=='0'?_0x1df50e[_0x8899('0x23')]:_0x8899('0x10');if(_0x1b558d){logger[_0x8899('0x1e')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x37270b['uniqueid'],_0x4a7b3e['id']);_0x5545c7[_0x27e256]=_['isNil'](_0x37270b[_0x8899('0x11')])?_0x37270b[_0x8899('0x24')]:_0x37270b[_0x8899('0x12')];if(_['isNil'](_0x37270b[_0x8899('0x11')])){_0x5545c7[_0x8899('0x13')]=_0x37270b[_0x8899('0x25')]&&_0x37270b['calleridname']!==_0x8899('0x26')?_0x37270b[_0x8899('0x25')]:_0x8899('0x27');}else{_0x5545c7[_0x8899('0x13')]=_0x37270b['destcalleridname']&&_0x37270b[_0x8899('0x28')]!==_0x8899('0x26')?_0x37270b['destcalleridname']:'Unknown';}return BPromise[_0x8899('0x1b')]()[_0x8899('0x29')](cmContactRpc[_0x8899('0x2a')](_0x5545c7))[_0x8899('0x29')](function(_0xbfe437){_0xdb5f76=_0xbfe437;_0x2cd9d6[_0x8899('0x2b')](_0xbfe437);if(_0xdb5f76){logger[_0x8899('0x1e')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x37270b['uniqueid'],_0x4a7b3e['id'],_0xdb5f76['id']);}return;});}else{logger[_0x8899('0x1e')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x37270b[_0x8899('0x20')],_0x4a7b3e['id']);_0x5545c7[_0x27e256]=_[_0x8899('0x2c')](_0x37270b[_0x8899('0x11')])?_0x37270b[_0x8899('0x24')]:_0x37270b['destcalleridnum'];if(_['isNil'](_0x37270b['routeId'])){_0x5545c7['firstName']=_0x37270b[_0x8899('0x25')]&&_0x37270b[_0x8899('0x25')]!==''?_0x37270b[_0x8899('0x25')]:'Unknown';}else{_0x5545c7[_0x8899('0x13')]=_0x37270b[_0x8899('0x28')]&&_0x37270b['destcalleridname']!==''?_0x37270b[_0x8899('0x28')]:_0x8899('0x27');}_0xdb5f76=_0x5545c7;_0x2cd9d6[_0x8899('0x2b')](_0x5545c7);return;}}})['then'](function(){if(_0x1aa47c){emit(_0x37270b[_0x8899('0x20')],_0x4a7b3e,util[_0x8899('0x2d')]('user:%s',_0x1aa47c[_0x8899('0x2e')]),util[_0x8899('0x2d')]('trigger:%s',_0x1df50e[_0x8899('0x2f')][_0x8899('0x30')]()),{'evt':_[_0x8899('0x31')](_0x37270b,{'autoCreate':_0x1b558d}),'contact':_0xdb5f76===undefined?{}:_0xdb5f76,'contacts':_0x2cd9d6[_0x8899('0x1d')]===0x0?undefined:_0x2cd9d6});}});}; \ No newline at end of file +var _0x200b=['calleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','length','lodash','util','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','info','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x200b,0x7d));var _0xb200=function(_0x58331c,_0x151ee3){_0x58331c=_0x58331c-0x0;var _0x2ba2f3=_0x200b[_0x58331c];return _0x2ba2f3;};'use strict';var _=require(_0xb200('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0xb200('0x1'));var config=require('../../../../config/environment');var logger=require(_0xb200('0x2'))(_0xb200('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0xb200('0x4')]=_[_0xb200('0x5')](config[_0xb200('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xb200('0x6'))(new Redis(config[_0xb200('0x4')]));function emit(_0x5641b3,_0x4804d2,_0x28642c,_0x3ee390,_0x37ce74){logger[_0xb200('0x7')]('[CM][%s][%s]',_0x5641b3,_0x4804d2['id'],_0x28642c,_0x3ee390,JSON['stringify'](_0x37ce74));io['to'](_0x28642c)['emit'](_0x3ee390,_0x37ce74);}exports[_0xb200('0x8')]=function(_0x2435cf,_0x3c0925,_0x559170,_0x1ca5be){var _0x5f0951,_0x10fc93;var _0x79b033={};var _0x57c2b4;var _0x47f0c5=Number(_0x559170[_0xb200('0x9')]);var _0x4a9f2c=_0x559170[_0xb200('0xa')]?Boolean(Number(_0x559170[_0xb200('0xa')])):![];var _0x4eedee;var _0x5731f4=![];if(!_[_0xb200('0xb')](_0x559170[_0xb200('0xc')])){if(_0x559170[_0xb200('0xc')]=='1')_0x5731f4=!![];}if(!_0x5731f4){if(_0x1ca5be[_0xb200('0xd')]){_0x79b033['id']=_0x1ca5be['xmd-contactid'];}}if(!_0x79b033['id']){_0x79b033[_0xb200('0xe')]=_0x47f0c5;_0x4eedee=_0x559170[_0xb200('0xf')]&&_0x559170[_0xb200('0xf')]!=='0'?_0x559170[_0xb200('0xf')][_0xb200('0x10')](','):[_0xb200('0x11')];_0x79b033[_0xb200('0x12')]=_[_0xb200('0x13')](_0x4eedee,function(_0x2c6ddd){var _0x53607c={};_0x53607c[_0x2c6ddd]=_0x1ca5be[_0xb200('0x14')]?_0x1ca5be[_0xb200('0x15')]:_0x1ca5be[_0xb200('0x16')];return _0x53607c;});_0x57c2b4=_0x1ca5be['routeId']?_0x1ca5be[_0xb200('0x15')]:_0x1ca5be[_0xb200('0x16')];}var _0x3e68ed=['id',_0xb200('0x17'),'lastName',_0xb200('0x11'),_0xb200('0x18'),_0xb200('0x19'),'ListId',_0xb200('0x1a'),_0xb200('0x1b'),_0xb200('0x1c')];var _0x5014da=_['union'](_0x3e68ed,_0x4eedee);BPromise[_0xb200('0x1d')]()[_0xb200('0x1e')](cmContactRpc['getContacts']({'attributes':_0x5014da,'where':_0x79b033,'phone':_0x57c2b4}))[_0xb200('0x1e')](function(_0x2d70f3){_0x10fc93=_0x2d70f3;if(!_['isEmpty'](_0x10fc93)){if(_0x10fc93['length']===0x1){_0x5f0951=_0x10fc93[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x1ca5be['uniqueid'],_0x3c0925['id'],_0x5f0951['id']);}else{logger['info'](_0xb200('0x1f'),_0x1ca5be[_0xb200('0x20')],_0x3c0925['id'],_[_0xb200('0x13')](_0x10fc93,'id')[_0xb200('0x21')](','));}return;}else{logger[_0xb200('0x7')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1ca5be['uniqueid'],_0x3c0925['id']);var _0x33bf2e={'ListId':_0x47f0c5};var _0x4a8d3e=_0x559170[_0xb200('0x22')]&&_0x559170[_0xb200('0x22')]!=='0'?_0x559170['data4']:_0xb200('0x11');if(_0x4a9f2c){logger['info'](_0xb200('0x23'),_0x1ca5be[_0xb200('0x20')],_0x3c0925['id']);_0x33bf2e[_0x4a8d3e]=_[_0xb200('0xb')](_0x1ca5be['routeId'])?_0x1ca5be[_0xb200('0x16')]:_0x1ca5be[_0xb200('0x15')];if(_[_0xb200('0xb')](_0x1ca5be[_0xb200('0x14')])){_0x33bf2e[_0xb200('0x17')]=_0x1ca5be['calleridname']&&_0x1ca5be[_0xb200('0x24')]!==_0xb200('0x25')?_0x1ca5be[_0xb200('0x24')]:_0xb200('0x26');}else{_0x33bf2e[_0xb200('0x17')]=_0x1ca5be[_0xb200('0x27')]&&_0x1ca5be[_0xb200('0x27')]!==''?_0x1ca5be['destcalleridname']:_0xb200('0x26');}return BPromise[_0xb200('0x1d')]()['then'](cmContactRpc[_0xb200('0x28')](_0x33bf2e))[_0xb200('0x1e')](function(_0x423c43){_0x5f0951=_0x423c43;_0x10fc93[_0xb200('0x29')](_0x423c43);if(_0x5f0951){logger['info'](_0xb200('0x2a'),_0x1ca5be[_0xb200('0x20')],_0x3c0925['id'],_0x5f0951['id']);}return;});}else{logger[_0xb200('0x7')](_0xb200('0x2b'),_0x1ca5be[_0xb200('0x20')],_0x3c0925['id']);_0x33bf2e[_0x4a8d3e]=_[_0xb200('0xb')](_0x1ca5be[_0xb200('0x14')])?_0x1ca5be[_0xb200('0x16')]:_0x1ca5be[_0xb200('0x15')];if(_[_0xb200('0xb')](_0x1ca5be[_0xb200('0x14')])){_0x33bf2e[_0xb200('0x17')]=_0x1ca5be[_0xb200('0x24')]&&_0x1ca5be['calleridname']!==_0xb200('0x25')?_0x1ca5be[_0xb200('0x24')]:_0xb200('0x26');}else{_0x33bf2e[_0xb200('0x17')]=_0x1ca5be['destcalleridname']&&_0x1ca5be[_0xb200('0x27')]!==_0xb200('0x25')?_0x1ca5be[_0xb200('0x27')]:_0xb200('0x26');}_0x5f0951=_0x33bf2e;_0x10fc93[_0xb200('0x29')](_0x33bf2e);return;}}})[_0xb200('0x1e')](function(){if(_0x2435cf){emit(_0x1ca5be['uniqueid'],_0x3c0925,util[_0xb200('0x2c')](_0xb200('0x2d'),_0x2435cf['name']),util[_0xb200('0x2c')](_0xb200('0x2e'),_0x559170['action'][_0xb200('0x2f')]()),{'evt':_['merge'](_0x1ca5be,{'autoCreate':_0x4a9f2c}),'contact':_0x5f0951===undefined?{}:_0x5f0951,'contacts':_0x10fc93[_0xb200('0x30')]===0x0?undefined:_0x10fc93});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 5ec7fdc..29cc93b 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 _0x3dc9=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','motionChannel','undefined','debug','inspect','checkTriggers','interface','status','checkTrigger','merge','Actions','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','800','data6','winApplication','render','winArguments','user:%s','name','format','trigger:%s:%s','action','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','query','search','replace','channel','AllConditions','length','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','field','chat','ChatWebsiteId','operator','upperFirst','value','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x3dc9,0x164));var _0x93dc=function(_0x48bf40,_0x18fb21){_0x48bf40=_0x48bf40-0x0;var _0x3b8417=_0x3dc9[_0x48bf40];return _0x3b8417;};'use strict';var util=require('util');var _=require('lodash');var url=require(_0x93dc('0x0'));var Mustache=require(_0x93dc('0x1'));var Redis=require(_0x93dc('0x2'));var urlforward=require(_0x93dc('0x3'));var integration=require(_0x93dc('0x4'));var cmContact=require(_0x93dc('0x5'));var script=require(_0x93dc('0x6'));var config=require(_0x93dc('0x7'));var logger=require(_0x93dc('0x8'))('trigger');var ami=require('../ami');config[_0x93dc('0x9')]=_['defaults'](config['redis'],{'host':_0x93dc('0xa'),'port':0x18eb});var io=require(_0x93dc('0xb'))(new Redis(config[_0x93dc('0x9')]));var operators={'equals':function(_0x50228b,_0x51eda7){return _0x50228b==_0x51eda7;},'not_equals':function(_0x9d6c9c,_0x1484c8){return _0x9d6c9c!=_0x1484c8;}};var barAndWebActions=[_0x93dc('0xc'),'url',_0x93dc('0xd')];function Trigger(_0x5ccc4d){this[_0x93dc('0xe')]=_0x5ccc4d['triggers'];this[_0x93dc('0xf')]=_0x5ccc4d[_0x93dc('0xf')];this[_0x93dc('0x10')]=_0x5ccc4d[_0x93dc('0x10')];this['templates']=_0x5ccc4d[_0x93dc('0x11')];this[_0x93dc('0x12')]=_0x5ccc4d['voiceExtensions'];this[_0x93dc('0x13')]=_0x5ccc4d[_0x93dc('0x13')];this[_0x93dc('0x14')]=_0x5ccc4d[_0x93dc('0x14')];this['salesforceAccounts']=_0x5ccc4d['salesforceAccounts'];this[_0x93dc('0x15')]=_0x5ccc4d[_0x93dc('0x15')];this['zohoAccounts']=_0x5ccc4d[_0x93dc('0x16')];this[_0x93dc('0x17')]=_0x5ccc4d[_0x93dc('0x17')];this[_0x93dc('0x18')]=_0x5ccc4d[_0x93dc('0x18')];this[_0x93dc('0x19')]=_0x5ccc4d[_0x93dc('0x19')];this[_0x93dc('0x1a')]=_0x5ccc4d[_0x93dc('0x1a')];this['freshsalesAccounts']=_0x5ccc4d[_0x93dc('0x1b')];this[_0x93dc('0x1c')]={'zendesk':this[_0x93dc('0x13')],'salesforce':this[_0x93dc('0x1d')],'freshdesk':this[_0x93dc('0x14')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x93dc('0x16')],'desk':this[_0x93dc('0x17')],'vtiger':this[_0x93dc('0x18')],'dynamics365':this[_0x93dc('0x1a')],'freshsales':this[_0x93dc('0x1b')],'servicenow':this['servicenowAccounts']};ami['on'](_0x93dc('0x1e'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x21'),this['syncCustomEvent'][_0x93dc('0x20')](this));ami['on']('custom:agentringnoanswer',this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x22'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x23'),this[_0x93dc('0x1f')]['bind'](this));ami['on'](_0x93dc('0x24'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x25'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x26'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on']('custom:agentreject',this[_0x93dc('0x1f')]['bind'](this));ami['on']('custom:amd',this[_0x93dc('0x1f')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x27'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x28'),this[_0x93dc('0x29')]['bind'](this));ami['on']('custom:dialconnect',this[_0x93dc('0x29')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x2a'),this[_0x93dc('0x29')]['bind'](this));ami['on'](_0x93dc('0x2b'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x2c'),this['syncCustomEvent'][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x2d'),this['syncCustomEvent'][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x2e'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x2f'),this[_0x93dc('0x1f')]['bind'](this));ami['on'](_0x93dc('0x30'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x31'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));ami['on'](_0x93dc('0x32'),this[_0x93dc('0x1f')][_0x93dc('0x20')](this));}Trigger[_0x93dc('0x33')][_0x93dc('0x34')]=function(_0x18323b,_0x51c150,_0x390c9b){logger[_0x93dc('0x35')](_0x18323b,_0x51c150,JSON[_0x93dc('0x36')](_0x390c9b));io['to'](_0x18323b)[_0x93dc('0x34')](_0x51c150,_0x390c9b);};Trigger[_0x93dc('0x33')][_0x93dc('0x1f')]=function(_0x59c90e){var _0x411cef=_['clone'](_0x59c90e);if(typeof _0x411cef[_0x93dc('0x37')]===_0x93dc('0x38')){_0x411cef['motionChannel']='voice';}logger[_0x93dc('0x39')](_0x93dc('0x1f'),util[_0x93dc('0x3a')](_0x411cef,{'showHidden':!![],'depth':null}));this[_0x93dc('0x3b')](_0x411cef);};Trigger[_0x93dc('0x33')][_0x93dc('0x29')]=function(_0x33e6f7){if(this['agents'][_0x33e6f7[_0x93dc('0x3c')]]){this[_0x93dc('0x1f')](_0x33e6f7);}};Trigger[_0x93dc('0x33')][_0x93dc('0x3b')]=function(_0x17deca){var _0x43510c;for(var _0x224dec in this[_0x93dc('0xe')]){if(this[_0x93dc('0xe')]['hasOwnProperty'](_0x224dec)){if(this['triggers'][_0x224dec][_0x93dc('0x3d')]){_0x43510c=this[_0x93dc('0x3e')](this[_0x93dc('0xe')][_0x224dec],_0x17deca);if(_0x43510c){_[_0x93dc('0x3f')](_0x17deca,_0x17deca['variables']);for(var _0x391810=0x0,_0xa66198,_0x118707,_0x4f6a1e;_0x3918100x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x25f166,_0x3327de){_0x25f166=_0x25f166-0x0;var _0xa1eda4=_0xe14b[_0x25f166];return _0xa1eda4;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ 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 a3890b8..0d118bc 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 _0x59a4=[']\x20Enduser\x20created!','string','picklist','type','customField','idField','substring','indexOf','content','ticketType','incidents','assign','Subjects','getString','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','ioredis','dynamics365','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','email','userEmail','isdisabled','info','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','internalemailaddress','username','toLowerCase','outbound','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','lastIndexOf','enduserId','destcalleridnum','telephone1','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','value','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59a4,0x9c));var _0x459a=function(_0x1945a5,_0x50de54){_0x1945a5=_0x1945a5-0x0;var _0x5817a5=_0x59a4[_0x1945a5];return _0x5817a5;};'use strict';var _=require(_0x459a('0x0'));var rp=require('request-promise');var util=require(_0x459a('0x1'));var intUtil=require(_0x459a('0x2'));var md5=require('md5');var Redis=require(_0x459a('0x3'));var logger=require('../../../../config/logger')(_0x459a('0x4'));var config=require('../../../../config/environment');config[_0x459a('0x5')]=_['defaults'](config[_0x459a('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x459a('0x6'))(new Redis(config[_0x459a('0x5')]));function getAuthToken(_0x4b3e26,_0x3e272a,_0x5d2924){if(_0x4b3e26[_0x459a('0x7')]){_0x4b3e26[_0x459a('0x8')]=_0x4b3e26[_0x459a('0x9')][_0x459a('0xa')];_0x4b3e26[_0x459a('0xb')]=_0x4b3e26['CloudProvider'][_0x459a('0xc')];return Promise[_0x459a('0xd')](_0x4b3e26['CloudProvider'][_0x459a('0xe')]);}var _0x317278={'method':_0x459a('0xf'),'uri':_0x3e272a,'form':{'client_id':_0x4b3e26[_0x459a('0x10')],'resource':_0x4b3e26[_0x459a('0x8')],'username':_0x4b3e26['username'],'password':_0x4b3e26['password'],'grant_type':_0x459a('0x11'),'client_secret':_0x4b3e26[_0x459a('0x12')]},'json':!![]};return rp(_0x317278)['then'](function(_0x51eb5c){return _0x51eb5c['access_token'];})[_0x459a('0x13')](function(_0x18864b){logger[_0x459a('0x14')]('['+[_0x5d2924[_0x459a('0x15')]()]+_0x459a('0x16'));return _0x18864b[_0x459a('0x17')];});}function getUser(_0x32a57b,_0x3db47a,_0x189990,_0xea69c1,_0x40c430,_0x3965cd){return new Promise(function(_0x16cd18,_0x3f1e21){return getAuthToken(_0x3db47a,_0xea69c1,_0x3965cd)[_0x459a('0x18')](function(_0x42619a){var _0x2e0d79={'method':'GET','uri':_0x40c430+_0x459a('0x19'),'headers':{'Authorization':_0x459a('0x1a')+_0x42619a,'OData-Version':_0x459a('0x1b')},'json':!![]};return rp(_0x2e0d79);})['then'](function(_0x2e8b7a){var _0x3330c8=_0x2e8b7a['value'];var _0x369f39=![];var _0x239c36=null;if(!_[_0x459a('0x1c')](_0x189990)){if(intUtil['validateEmail'](_0x189990[_0x459a('0x1d')])){_0x32a57b[_0x459a('0x1e')]=_0x189990['email'];for(_0x239c36=0x0;_0x239c36<_0x3330c8['length'];_0x239c36++){if(_0x3330c8[_0x239c36]['internalemailaddress']===_0x189990[_0x459a('0x1d')]&&!_0x3330c8[_0x239c36][_0x459a('0x1f')]){_0x369f39=!![];logger[_0x459a('0x20')]('['+[_0x3965cd[_0x459a('0x15')]()]+']\x20Agent\x20found\x20'+_0x3330c8[_0x239c36]['systemuserid']+'!');_0x32a57b[_0x459a('0x21')]=_0x3330c8[_0x239c36][_0x459a('0x22')];}}}}if(!_0x369f39){logger[_0x459a('0x20')]('['+[_0x3965cd[_0x459a('0x15')]()]+_0x459a('0x23'));_0x32a57b[_0x459a('0x1e')]=_0x3db47a['username'];for(_0x239c36=0x0;_0x239c36<_0x3330c8[_0x459a('0x24')];_0x239c36++){if(_0x3330c8[_0x239c36][_0x459a('0x25')]===_0x3db47a[_0x459a('0x26')]){_0x32a57b['userId']=_0x3330c8[_0x239c36][_0x459a('0x22')];}}}_0x16cd18(_0x32a57b);})[_0x459a('0x13')](function(_0x34be7b){_0x3f1e21(_0x34be7b[_0x459a('0x17')]);});});}function createEndUser(_0x281d6c,_0x11ffbc,_0x51d330,_0x16dbae,_0xc0c262,_0x436152,_0x3bcc19){return new Promise(function(_0x118852,_0x4598e9){return getAuthToken(_0x11ffbc,_0x51d330,_0x436152)[_0x459a('0x18')](function(_0x4636e2){var _0x4e5e6d=_0x436152[_0x459a('0x27')]()===_0x459a('0x28')?_0xc0c262['destcalleridnum']:_0xc0c262[_0x459a('0x29')];var _0x155cce={'method':_0x459a('0xf'),'uri':_0x16dbae+_0x459a('0x2a'),'body':{'fullname':_0x4e5e6d,'firstname':_0x4e5e6d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x459a('0x2b')+_0x281d6c[_0x459a('0x21')]+')'},'headers':{'Authorization':_0x459a('0x1a')+_0x4636e2,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x155cce[_0x459a('0x2c')][_0x3bcc19]=_0x4e5e6d;return rp(_0x155cce);})[_0x459a('0x18')](function(_0x51a751){var _0x74d729=_0x51a751[_0x459a('0x2d')][_0x459a('0x2e')];var _0x295221=_0x74d729['substring'](_0x74d729[_0x459a('0x2f')]('(')+0x1,_0x74d729[_0x459a('0x2f')](')'));_0x281d6c[_0x459a('0x30')]=_0x295221;_0x118852(_0x281d6c);})['catch'](function(_0x1957d2){_0x4598e9(_0x1957d2[_0x459a('0x17')]);});});}function getEndUser(_0x2ff753,_0x55162e,_0x2f97a6,_0x182bc2,_0x141bb0,_0xaa21cb,_0x4a6c1f,_0x2ee276){var _0x1e9f29=_0xaa21cb[_0x459a('0x27')]()===_0x459a('0x28')?_0x141bb0[_0x459a('0x31')]:_0x141bb0[_0x459a('0x29')];return getAuthToken(_0x55162e,_0x2f97a6,_0xaa21cb)[_0x459a('0x18')](function(_0x24405d){_0x2ee276=_0x2ee276?_0x2ee276:_0x459a('0x32');var _0x93e4c3={'method':_0x459a('0x33'),'uri':_0x182bc2+_0x459a('0x34')+_0x2ee276+'&$filter='+_0x2ee276+_0x459a('0x35')+_0x1e9f29[_0x459a('0x36')]('+',_0x459a('0x37'))+'\x27','headers':{'Authorization':_0x459a('0x1a')+_0x24405d,'If-None-Match':null,'OData-Version':_0x459a('0x1b')},'json':!![]};return rp(_0x93e4c3);})['then'](function(_0x212fa9){var _0x26dae9=![];if(!_0x212fa9)return _0x26dae9;var _0x168de9=_0x212fa9[_0x459a('0x38')];for(var _0x244719=0x0;_0x244719<_0x168de9['length'];_0x244719++){if(_0x168de9[_0x244719][_0x2ee276]===_0x1e9f29){_0x26dae9=!![];_0x2ff753[_0x459a('0x30')]=_0x168de9[_0x244719][_0x459a('0x39')];}}return _0x26dae9;})[_0x459a('0x18')](function(_0x5c817a){if(_0x5c817a)return _0x2ff753;if(_0x4a6c1f===_0x459a('0x3a')){logger[_0x459a('0x20')]('['+[_0xaa21cb[_0x459a('0x15')]()]+_0x459a('0x3b'));return _0x2ff753;}return createEndUser(_0x2ff753,_0x55162e,_0x2f97a6,_0x182bc2,_0x141bb0,_0xaa21cb,_0x2ee276)[_0x459a('0x18')](function(_0x3b04cc){logger['info']('['+[_0xaa21cb['toUpperCase']()]+_0x459a('0x3c'),_0x3b04cc['enduserId']);return _0x3b04cc;});});}function getCustomFields(_0x1c4495,_0x171b3e,_0x2d9893){var _0x122be9={};if(_0x1c4495['length']>0x0){_['forEach'](_0x1c4495,function(_0x4aa286){if(_['includes']([_0x459a('0x3d'),_0x459a('0x3e')],_0x4aa286[_0x459a('0x3f')])&&_0x4aa286['nameField']&&!_0x4aa286[_0x459a('0x40')]){var _0x5e0427=_0x4aa286[_0x459a('0x41')][_0x459a('0x27')]();var _0x2993e5=_0x5e0427[_0x459a('0x42')](0x0,_0x5e0427[_0x459a('0x43')]('_'));var _0x581ba9=_0x5e0427[_0x459a('0x42')](_0x5e0427[_0x459a('0x43')]('_')+0x1);if(_0x2993e5===_0x2d9893){_0x122be9[_0x581ba9]=_0x4aa286[_0x459a('0x44')];}}});}return _0x122be9;}function getTicket(_0x5bafb9,_0x45babc,_0x30bcb9,_0xb4b381,_0x4e6643,_0x5091d2,_0xbf674a){return new Promise(function(_0xf28ce9,_0x3f681b){var _0x4fee58;return getAuthToken(_0x45babc,_0x30bcb9,_0xbf674a)[_0x459a('0x18')](function(_0x99f7e9){if(_0x5091d2[_0x459a('0x45')]==='incident'){_0x4fee58={'method':_0x459a('0xf'),'uri':_0xb4b381+_0x459a('0x46'),'body':Object[_0x459a('0x47')]({},{'title':intUtil['getString'](_0x5091d2[_0x459a('0x48')],_0x4e6643,'\x20'),'description':intUtil[_0x459a('0x49')](_0x5091d2[_0x459a('0x4a')],_0x4e6643,'\x0a'),'customerid_contact@odata.bind':_0x5bafb9[_0x459a('0x30')]?_0x459a('0x4b')+_0x5bafb9[_0x459a('0x30')]+')':undefined,'ownerid@odata.bind':_0x459a('0x2b')+_0x5bafb9[_0x459a('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x5091d2[_0x459a('0x4c')],_0x4e6643,_0x5091d2[_0x459a('0x45')])),'headers':{'Authorization':_0x459a('0x1a')+_0x99f7e9,'OData-Version':_0x459a('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5091d2[_0x459a('0x45')]===_0x459a('0x4d')){var _0x4b7b89=_0x5bafb9[_0x459a('0x30')]?[{'partyid_systemuser@odata.bind':_0x459a('0x2b')+_0x5bafb9[_0x459a('0x21')]+')','participationtypemask':_0x5bafb9['callDirection']===_0x459a('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5bafb9['enduserId']+')','participationtypemask':_0x5bafb9[_0x459a('0x4f')]===_0x459a('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x459a('0x2b')+_0x5bafb9[_0x459a('0x21')]+')','participationtypemask':_0x5bafb9['callDirection']===_0x459a('0x4e')?0x2:0x1}];_0x4fee58={'method':_0x459a('0xf'),'uri':_0xb4b381+'phonecalls','body':Object[_0x459a('0x47')]({},{'subject':intUtil['getString'](_0x5091d2['Subjects'],_0x4e6643,'\x20'),'phonenumber':String(_0x4e6643[_0x459a('0x29')]),'description':intUtil[_0x459a('0x49')](_0x5091d2[_0x459a('0x4a')],_0x4e6643,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5bafb9[_0x459a('0x30')]?'/contacts('+_0x5bafb9[_0x459a('0x30')]+')':undefined,'ownerid@odata.bind':_0x459a('0x2b')+_0x5bafb9[_0x459a('0x21')]+')','directioncode':_0x5bafb9['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x4b7b89},getCustomFields(_0x5091d2[_0x459a('0x4c')],_0x4e6643,_0x5091d2[_0x459a('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x99f7e9,'OData-Version':_0x459a('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4fee58);})[_0x459a('0x18')](function(_0x43fd87){var _0xa3e60d=_0x43fd87[_0x459a('0x2d')]['odata-entityid'];var _0x28e323=_0xa3e60d[_0x459a('0x42')](_0xa3e60d[_0x459a('0x2f')]('(')+0x1,_0xa3e60d['lastIndexOf'](')'));_0x5bafb9[_0x459a('0x50')]=_0x28e323;_0xf28ce9(_0x5bafb9);})[_0x459a('0x13')](function(_0x470a5d){_0x3f681b(_0x470a5d[_0x459a('0x17')]);});});}function emit(_0x469cd6,_0x2d9c69,_0x4b6c47,_0x3ecc97){var _0x14a7e8={'uri':util['format'](_0x459a('0x51'),_0x469cd6,_0x4b6c47,_0x3ecc97)};io['to'](util[_0x459a('0x52')]('user:%s',_0x2d9c69))[_0x459a('0x53')](_0x459a('0x54'),_0x14a7e8);}exports['cs']=function(_0x277040,_0x1bf74a,_0x266a57,_0x471148,_0x426956,_0x4e01aa,_0x40359e,_0x4c497d){var _0x34e850={};_0x4e01aa['remoteUri']=_0x4e01aa['modernAuthentication']?intUtil[_0x459a('0x55')](_0x4e01aa[_0x459a('0x9')]['data7']):intUtil['stripTrailingSlash'](_0x4e01aa[_0x459a('0x8')]);_0x4e01aa[_0x459a('0x56')]=intUtil[_0x459a('0x55')](_0x4e01aa['serverUrl']);_0x34e850[_0x459a('0x4f')]=_0x4c497d===_0x459a('0x4e')||_0x4c497d==='unmanaged'?'queue':_0x459a('0x28');var _0x14e34e=_0x4e01aa['modernAuthentication']?util[_0x459a('0x52')]('%s/api/data/v9.0/',_0x4e01aa[_0x459a('0x9')][_0x459a('0xa')]):util[_0x459a('0x52')](_0x459a('0x57'),_0x4e01aa[_0x459a('0x8')]);var _0xb885e8=util[_0x459a('0x52')](_0x459a('0x58'),_0x4e01aa[_0x459a('0xb')]);var _0x24d912=util[_0x459a('0x52')](_0x459a('0x59'),_0x4e01aa[_0x459a('0x56')],_0x1bf74a['uniqueid'],md5(_0x1bf74a[_0x459a('0x5a')]));if(_0x426956&&_0x426956[_0x459a('0x5b')]){logger[_0x459a('0x20')](_0x459a('0x5c'),_0x459a('0x5d'));_0x1bf74a[_0x459a('0x5e')]=_0x24d912;}else if(_0x40359e&&_0x40359e[_0x459a('0x5f')]&&_0x40359e[_0x459a('0x5f')]!=='none'){logger['info'](_0x459a('0x60'),'Recording\x20is\x20enabled!');_0x1bf74a['recordingURL']=_0x24d912;}else{_0x1bf74a[_0x459a('0x5e')]='';}return getUser(_0x34e850,_0x4e01aa,_0x471148,_0xb885e8,_0x14e34e,_0x4c497d)['then'](function(_0x47c1f2){logger[_0x459a('0x20')]('['+_0x4c497d[_0x459a('0x15')]()+_0x459a('0x61'),_0x47c1f2[_0x459a('0x21')]);logger[_0x459a('0x20')]('['+_0x4c497d[_0x459a('0x15')]()+_0x459a('0x62'),_0x47c1f2['userEmail']);return getEndUser(_0x47c1f2,_0x4e01aa,_0xb885e8,_0x14e34e,_0x1bf74a,_0x4c497d,_0x266a57[_0x459a('0x63')],_0x266a57[_0x459a('0x64')]);})['then'](function(_0x4bf980){logger['info']('['+_0x4c497d[_0x459a('0x15')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x4bf980[_0x459a('0x30')]);logger[_0x459a('0x20')]('['+_0x4c497d[_0x459a('0x15')]()+_0x459a('0x65'),_0x1bf74a[_0x459a('0x29')]);return getTicket(_0x4bf980,_0x4e01aa,_0xb885e8,_0x14e34e,_0x1bf74a,_0x266a57,_0x4c497d);})[_0x459a('0x18')](function(_0x5cf881){logger[_0x459a('0x20')](util['format']('['+_0x4c497d['toUpperCase']()+_0x459a('0x66'),_0x266a57[_0x459a('0x45')],_0x5cf881['ticketId']));logger[_0x459a('0x20')](util[_0x459a('0x52')]('['+_0x4c497d[_0x459a('0x15')]()+']\x20Call\x20direction:\x20%s',_0x4c497d));if(_0x4c497d!==_0x459a('0x67')&&_0x266a57[_0x459a('0x68')]){logger['info']('['+_0x4c497d[_0x459a('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4e01aa[_0x459a('0x8')],_0x471148[_0x459a('0x69')],_0x266a57[_0x459a('0x45')],_0x5cf881[_0x459a('0x50')]);}})['catch'](function(_0x592067){logger[_0x459a('0x14')]('['+_0x4c497d[_0x459a('0x15')]()+_0x459a('0x6a'),_0x592067[_0x459a('0x17')]);console[_0x459a('0x14')](_0x459a('0x6b'),_0x592067);});}; \ No newline at end of file +var _0x0f62=['unmanaged','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','ioredis','../../../../config/environment','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','resolve','data5','clientId','username','password','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','isNil','validateEmail','userEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','systemuserid','toLowerCase','destcalleridnum','calleridnum','POST','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid',']\x20Enduser\x20created!','includes','picklist','nameField','customField','idField','indexOf','content','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','Subjects','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl'];(function(_0x362c40,_0x264ee7){var _0x335ad4=function(_0x85f842){while(--_0x85f842){_0x362c40['push'](_0x362c40['shift']());}};_0x335ad4(++_0x264ee7);}(_0x0f62,0x7c));var _0x20f6=function(_0x3a84ce,_0x224b54){_0x3a84ce=_0x3a84ce-0x0;var _0x10d5a9=_0x0f62[_0x3a84ce];return _0x10d5a9;};'use strict';var _=require('lodash');var rp=require(_0x20f6('0x0'));var util=require(_0x20f6('0x1'));var intUtil=require(_0x20f6('0x2'));var md5=require('md5');var Redis=require(_0x20f6('0x3'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x20f6('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x20f6('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x4506ae,_0x499609,_0x34a6e7){if(_0x4506ae[_0x20f6('0x6')]){_0x4506ae[_0x20f6('0x7')]=_0x4506ae[_0x20f6('0x8')][_0x20f6('0x9')];_0x4506ae[_0x20f6('0xa')]=_0x4506ae['CloudProvider']['data2'];return Promise[_0x20f6('0xb')](_0x4506ae['CloudProvider'][_0x20f6('0xc')]);}var _0x476e05={'method':'POST','uri':_0x499609,'form':{'client_id':_0x4506ae[_0x20f6('0xd')],'resource':_0x4506ae[_0x20f6('0x7')],'username':_0x4506ae[_0x20f6('0xe')],'password':_0x4506ae[_0x20f6('0xf')],'grant_type':_0x20f6('0xf'),'client_secret':_0x4506ae['clientSecret']},'json':!![]};return rp(_0x476e05)[_0x20f6('0x10')](function(_0x430e4c){return _0x430e4c['access_token'];})[_0x20f6('0x11')](function(_0x22db80){logger[_0x20f6('0x12')]('['+[_0x34a6e7[_0x20f6('0x13')]()]+_0x20f6('0x14'));return _0x22db80[_0x20f6('0x15')];});}function getUser(_0x3f6074,_0x29dd65,_0x3bd302,_0x440314,_0xe250cd,_0x34b527){return new Promise(function(_0x121aa6,_0x49a8bb){return getAuthToken(_0x29dd65,_0x440314,_0x34b527)[_0x20f6('0x10')](function(_0x456efd){var _0x291ba1={'method':_0x20f6('0x16'),'uri':_0xe250cd+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x20f6('0x17')+_0x456efd,'OData-Version':_0x20f6('0x18')},'json':!![]};return rp(_0x291ba1);})[_0x20f6('0x10')](function(_0x45e7d3){var _0x36f3b2=_0x45e7d3['value'];var _0x4d08f0=![];var _0x483b03=null;if(!_[_0x20f6('0x19')](_0x3bd302)){if(intUtil[_0x20f6('0x1a')](_0x3bd302['email'])){_0x3f6074[_0x20f6('0x1b')]=_0x3bd302[_0x20f6('0x1c')];for(_0x483b03=0x0;_0x483b03<_0x36f3b2[_0x20f6('0x1d')];_0x483b03++){if(_0x36f3b2[_0x483b03]['internalemailaddress']===_0x3bd302[_0x20f6('0x1c')]&&!_0x36f3b2[_0x483b03][_0x20f6('0x1e')]){_0x4d08f0=!![];logger[_0x20f6('0x1f')]('['+[_0x34b527['toUpperCase']()]+_0x20f6('0x20')+_0x36f3b2[_0x483b03]['systemuserid']+'!');_0x3f6074[_0x20f6('0x21')]=_0x36f3b2[_0x483b03]['systemuserid'];}}}}if(!_0x4d08f0){logger[_0x20f6('0x1f')]('['+[_0x34b527['toUpperCase']()]+_0x20f6('0x22'));_0x3f6074[_0x20f6('0x1b')]=_0x29dd65[_0x20f6('0xe')];for(_0x483b03=0x0;_0x483b03<_0x36f3b2[_0x20f6('0x1d')];_0x483b03++){if(_0x36f3b2[_0x483b03][_0x20f6('0x23')]===_0x29dd65[_0x20f6('0xe')]){_0x3f6074[_0x20f6('0x21')]=_0x36f3b2[_0x483b03][_0x20f6('0x24')];}}}_0x121aa6(_0x3f6074);})[_0x20f6('0x11')](function(_0x3be6c6){_0x49a8bb(_0x3be6c6['message']);});});}function createEndUser(_0x2324c0,_0x3de161,_0x2b4823,_0x221778,_0xd120c5,_0x1a7dac,_0x5010ef){return new Promise(function(_0x59fa2d,_0x5c245a){return getAuthToken(_0x3de161,_0x2b4823,_0x1a7dac)[_0x20f6('0x10')](function(_0x36e826){var _0x3151e2=_0x1a7dac[_0x20f6('0x25')]()==='outbound'?_0xd120c5[_0x20f6('0x26')]:_0xd120c5[_0x20f6('0x27')];var _0x37cb05={'method':_0x20f6('0x28'),'uri':_0x221778+_0x20f6('0x29'),'body':{'fullname':_0x3151e2,'firstname':_0x3151e2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x20f6('0x2a')+_0x2324c0['userId']+')'},'headers':{'Authorization':_0x20f6('0x17')+_0x36e826,'OData-Version':_0x20f6('0x18')},'json':!![],'resolveWithFullResponse':!![]};_0x37cb05[_0x20f6('0x2b')][_0x5010ef]=_0x3151e2;return rp(_0x37cb05);})[_0x20f6('0x10')](function(_0x6a38a1){var _0x2bebb6=_0x6a38a1[_0x20f6('0x2c')][_0x20f6('0x2d')];var _0x192dd0=_0x2bebb6[_0x20f6('0x2e')](_0x2bebb6[_0x20f6('0x2f')]('(')+0x1,_0x2bebb6[_0x20f6('0x2f')](')'));_0x2324c0[_0x20f6('0x30')]=_0x192dd0;_0x59fa2d(_0x2324c0);})[_0x20f6('0x11')](function(_0x299a25){_0x5c245a(_0x299a25[_0x20f6('0x15')]);});});}function getEndUser(_0xfebd88,_0x1d2c65,_0x526ea5,_0x1057f1,_0x13a610,_0x487307,_0x194ec5,_0x3d4481){var _0x567361=_0x487307[_0x20f6('0x25')]()==='outbound'?_0x13a610[_0x20f6('0x26')]:_0x13a610['calleridnum'];return getAuthToken(_0x1d2c65,_0x526ea5,_0x487307)[_0x20f6('0x10')](function(_0xdf377){_0x3d4481=_0x3d4481?_0x3d4481:_0x20f6('0x31');var _0x415aaa={'method':_0x20f6('0x16'),'uri':_0x1057f1+_0x20f6('0x32')+_0x3d4481+_0x20f6('0x33')+_0x3d4481+_0x20f6('0x34')+_0x567361[_0x20f6('0x35')]('+',_0x20f6('0x36'))+'\x27','headers':{'Authorization':_0x20f6('0x17')+_0xdf377,'If-None-Match':null,'OData-Version':_0x20f6('0x18')},'json':!![]};return rp(_0x415aaa);})[_0x20f6('0x10')](function(_0x5c15ec){var _0x4b1013=![];if(!_0x5c15ec)return _0x4b1013;var _0x217191=_0x5c15ec[_0x20f6('0x37')];for(var _0x37ad3a=0x0;_0x37ad3a<_0x217191[_0x20f6('0x1d')];_0x37ad3a++){if(_0x217191[_0x37ad3a][_0x3d4481]===_0x567361){_0x4b1013=!![];_0xfebd88[_0x20f6('0x30')]=_0x217191[_0x37ad3a][_0x20f6('0x38')];}}return _0x4b1013;})['then'](function(_0x587983){if(_0x587983)return _0xfebd88;if(_0x194ec5==='nothing'){logger[_0x20f6('0x1f')]('['+[_0x487307[_0x20f6('0x13')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0xfebd88;}return createEndUser(_0xfebd88,_0x1d2c65,_0x526ea5,_0x1057f1,_0x13a610,_0x487307,_0x3d4481)['then'](function(_0x4abfa2){logger[_0x20f6('0x1f')]('['+[_0x487307[_0x20f6('0x13')]()]+_0x20f6('0x39'),_0x4abfa2['enduserId']);return _0x4abfa2;});});}function getCustomFields(_0xed7e54,_0x389cb4,_0x35a21c){var _0x854f36={};if(_0xed7e54['length']>0x0){_['forEach'](_0xed7e54,function(_0x55c7bb){if(_[_0x20f6('0x3a')](['string',_0x20f6('0x3b')],_0x55c7bb['type'])&&_0x55c7bb[_0x20f6('0x3c')]&&!_0x55c7bb[_0x20f6('0x3d')]){var _0x56d991=_0x55c7bb[_0x20f6('0x3e')][_0x20f6('0x25')]();var _0x3bab0b=_0x56d991[_0x20f6('0x2e')](0x0,_0x56d991[_0x20f6('0x3f')]('_'));var _0x1029e8=_0x56d991['substring'](_0x56d991[_0x20f6('0x3f')]('_')+0x1);if(_0x3bab0b===_0x35a21c){_0x854f36[_0x1029e8]=_0x55c7bb[_0x20f6('0x40')];}}});}return _0x854f36;}function getTicket(_0x37a6f3,_0x5a0d82,_0x51e82e,_0x6d874f,_0x586a21,_0x494507,_0x4373ea){return new Promise(function(_0x21c656,_0x1f47e6){var _0x1c2e66;return getAuthToken(_0x5a0d82,_0x51e82e,_0x4373ea)[_0x20f6('0x10')](function(_0x2eac2a){if(_0x494507['ticketType']==='incident'){_0x1c2e66={'method':_0x20f6('0x28'),'uri':_0x6d874f+'incidents','body':Object['assign']({},{'title':intUtil[_0x20f6('0x41')](_0x494507['Subjects'],_0x586a21,'\x20'),'description':intUtil[_0x20f6('0x41')](_0x494507[_0x20f6('0x42')],_0x586a21,'\x0a'),'customerid_contact@odata.bind':_0x37a6f3[_0x20f6('0x30')]?_0x20f6('0x43')+_0x37a6f3[_0x20f6('0x30')]+')':undefined,'ownerid@odata.bind':_0x20f6('0x2a')+_0x37a6f3[_0x20f6('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x494507[_0x20f6('0x44')],_0x586a21,_0x494507['ticketType'])),'headers':{'Authorization':_0x20f6('0x17')+_0x2eac2a,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x494507[_0x20f6('0x45')]===_0x20f6('0x46')){var _0x2a4b70=_0x37a6f3[_0x20f6('0x30')]?[{'partyid_systemuser@odata.bind':_0x20f6('0x2a')+_0x37a6f3[_0x20f6('0x21')]+')','participationtypemask':_0x37a6f3[_0x20f6('0x47')]===_0x20f6('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0x20f6('0x43')+_0x37a6f3[_0x20f6('0x30')]+')','participationtypemask':_0x37a6f3['callDirection']===_0x20f6('0x48')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x20f6('0x2a')+_0x37a6f3[_0x20f6('0x21')]+')','participationtypemask':_0x37a6f3[_0x20f6('0x47')]==='queue'?0x2:0x1}];_0x1c2e66={'method':_0x20f6('0x28'),'uri':_0x6d874f+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x20f6('0x41')](_0x494507[_0x20f6('0x49')],_0x586a21,'\x20'),'phonenumber':String(_0x586a21[_0x20f6('0x27')]),'description':intUtil[_0x20f6('0x41')](_0x494507[_0x20f6('0x42')],_0x586a21,'\x0a'),'regardingobjectid_contact@odata.bind':_0x37a6f3['enduserId']?_0x20f6('0x43')+_0x37a6f3[_0x20f6('0x30')]+')':undefined,'ownerid@odata.bind':_0x20f6('0x2a')+_0x37a6f3['userId']+')','directioncode':_0x37a6f3[_0x20f6('0x47')]==='queue'?![]:!![],'phonecall_activity_parties':_0x2a4b70},getCustomFields(_0x494507[_0x20f6('0x44')],_0x586a21,_0x494507[_0x20f6('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x2eac2a,'OData-Version':_0x20f6('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1c2e66);})[_0x20f6('0x10')](function(_0x10dcad){var _0xd6c06a=_0x10dcad[_0x20f6('0x2c')][_0x20f6('0x2d')];var _0x5836e2=_0xd6c06a[_0x20f6('0x2e')](_0xd6c06a[_0x20f6('0x2f')]('(')+0x1,_0xd6c06a[_0x20f6('0x2f')](')'));_0x37a6f3[_0x20f6('0x4a')]=_0x5836e2;_0x21c656(_0x37a6f3);})[_0x20f6('0x11')](function(_0x30bcd4){_0x1f47e6(_0x30bcd4[_0x20f6('0x15')]);});});}function emit(_0x4ac74c,_0x41bcc0,_0x209feb,_0x332409){var _0xcb195d={'uri':util[_0x20f6('0x4b')](_0x20f6('0x4c'),_0x4ac74c,_0x209feb,_0x332409)};io['to'](util['format'](_0x20f6('0x4d'),_0x41bcc0))[_0x20f6('0x4e')](_0x20f6('0x4f'),_0xcb195d);}exports['cs']=function(_0x9cea47,_0x2a1338,_0x2eff2f,_0x41cf88,_0x2e8c2e,_0x58b064,_0x2f182d,_0x3fd474){var _0x1b3a2={};_0x58b064[_0x20f6('0x7')]=_0x58b064[_0x20f6('0x6')]?intUtil['stripTrailingSlash'](_0x58b064[_0x20f6('0x8')]['data7']):intUtil[_0x20f6('0x50')](_0x58b064[_0x20f6('0x7')]);_0x58b064[_0x20f6('0x51')]=intUtil[_0x20f6('0x50')](_0x58b064[_0x20f6('0x51')]);_0x1b3a2['callDirection']=_0x3fd474==='queue'||_0x3fd474===_0x20f6('0x52')?_0x20f6('0x48'):_0x20f6('0x53');var _0x1531d7=_0x58b064[_0x20f6('0x6')]?util[_0x20f6('0x4b')](_0x20f6('0x54'),_0x58b064['CloudProvider'][_0x20f6('0x9')]):util['format'](_0x20f6('0x54'),_0x58b064['remoteUri']);var _0x3e36a8=util['format'](_0x20f6('0x55'),_0x58b064[_0x20f6('0xa')]);var _0x450f25=util[_0x20f6('0x4b')](_0x20f6('0x56'),_0x58b064['serverUrl'],_0x2a1338[_0x20f6('0x57')],md5(_0x2a1338[_0x20f6('0x57')]));if(_0x2e8c2e&&_0x2e8c2e[_0x20f6('0x58')]){logger[_0x20f6('0x1f')](_0x20f6('0x59'),_0x20f6('0x5a'));_0x2a1338['recordingURL']=_0x450f25;}else if(_0x2f182d&&_0x2f182d[_0x20f6('0x5b')]&&_0x2f182d[_0x20f6('0x5b')]!==_0x20f6('0x5c')){logger[_0x20f6('0x1f')]('[OUTBOUND]',_0x20f6('0x5a'));_0x2a1338[_0x20f6('0x5d')]=_0x450f25;}else{_0x2a1338[_0x20f6('0x5d')]='';}return getUser(_0x1b3a2,_0x58b064,_0x41cf88,_0x3e36a8,_0x1531d7,_0x3fd474)[_0x20f6('0x10')](function(_0x2b6244){logger[_0x20f6('0x1f')]('['+_0x3fd474[_0x20f6('0x13')]()+_0x20f6('0x5e'),_0x2b6244['userId']);logger[_0x20f6('0x1f')]('['+_0x3fd474['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x2b6244[_0x20f6('0x1b')]);return getEndUser(_0x2b6244,_0x58b064,_0x3e36a8,_0x1531d7,_0x2a1338,_0x3fd474,_0x2eff2f[_0x20f6('0x5f')],_0x2eff2f['additionalSearchContact']);})[_0x20f6('0x10')](function(_0xc735d7){logger[_0x20f6('0x1f')]('['+_0x3fd474['toUpperCase']()+_0x20f6('0x60'),_0xc735d7[_0x20f6('0x30')]);logger['info']('['+_0x3fd474[_0x20f6('0x13')]()+_0x20f6('0x61'),_0x2a1338[_0x20f6('0x27')]);return getTicket(_0xc735d7,_0x58b064,_0x3e36a8,_0x1531d7,_0x2a1338,_0x2eff2f,_0x3fd474);})['then'](function(_0x946254){logger[_0x20f6('0x1f')](util[_0x20f6('0x4b')]('['+_0x3fd474[_0x20f6('0x13')]()+_0x20f6('0x62'),_0x2eff2f['ticketType'],_0x946254['ticketId']));logger[_0x20f6('0x1f')](util['format']('['+_0x3fd474['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x3fd474));if(_0x3fd474!=='unmanaged'&&_0x2eff2f[_0x20f6('0x63')]){logger[_0x20f6('0x1f')]('['+_0x3fd474[_0x20f6('0x13')]()+']',_0x20f6('0x64'));emit(_0x58b064[_0x20f6('0x7')],_0x41cf88[_0x20f6('0x65')],_0x2eff2f[_0x20f6('0x45')],_0x946254[_0x20f6('0x4a')]);}})[_0x20f6('0x11')](function(_0x134f48){logger[_0x20f6('0x12')]('['+_0x3fd474['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x134f48[_0x20f6('0x15')]);console['error'](_0x20f6('0x66'),_0x134f48);});}; \ 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 07b753e..262410d 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 _0xcf97=['idField','customField','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','unmanaged','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','socket.io-emitter','application/json','emit','merge','format','Caller\x20-\x20%s','getString','Subjects','Descriptions','
','Tags','name','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','toString','[HTTP]','GET','includes','picklist','type','nameField','content'];(function(_0x51c494,_0x58af48){var _0x53f5e4=function(_0x5a548f){while(--_0x5a548f){_0x51c494['push'](_0x51c494['shift']());}};_0x53f5e4(++_0x58af48);}(_0xcf97,0x19b));var _0x7cf9=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0xcf97[_0x2cef86];return _0x46dfd6;};'use strict';var _=require(_0x7cf9('0x0'));var rp=require('request-promise');var md5=require(_0x7cf9('0x1'));var util=require(_0x7cf9('0x2'));var Redis=require(_0x7cf9('0x3'));var intUtil=require(_0x7cf9('0x4'));var config=require(_0x7cf9('0x5'));var logger=require(_0x7cf9('0x6'))(_0x7cf9('0x7'));config['redis']=_[_0x7cf9('0x8')](config[_0x7cf9('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x7cf9('0xa'))(new Redis(config[_0x7cf9('0x9')]));var headers={'Content-Type':_0x7cf9('0xb'),'Accept':'application/json'};function emit(_0x268bdb,_0x5b6790,_0x2aa421){io['to'](_0x268bdb)[_0x7cf9('0xc')](_0x5b6790,_0x2aa421);}function getTicket(_0x2e2feb,_0x2ba90a,_0x2ecb0b,_0x2659cb,_0x1f1ea0){logger['info']('Creating\x20new\x20ticket...');var _0x576eac=_[_0x7cf9('0xd')]({'responder_id':_0x2ba90a['id'],'requester_id':_0x2ecb0b['id'],'name':util[_0x7cf9('0xe')](_0x7cf9('0xf'),_0x1f1ea0['calleridname']),'phone':_0x1f1ea0['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7cf9('0x10')](_0x2659cb[_0x7cf9('0x11')],_0x1f1ea0,'\x20'),'description':intUtil['getString'](_0x2659cb[_0x7cf9('0x12')],_0x1f1ea0,_0x7cf9('0x13')),'tags':getTags(_0x2659cb[_0x7cf9('0x14')],_0x7cf9('0x15'))},getCustomFields(_0x2659cb['Fields'],_0x1f1ea0));_0x576eac[_0x7cf9('0x16')]=_['mapValues'](_[_0x7cf9('0x17')](_0x576eac['custom_fields'],'id'),_0x7cf9('0x18'));return request({'uri':util[_0x7cf9('0xe')](_0x7cf9('0x19'),_0x2e2feb[_0x7cf9('0x1a')]),'method':_0x7cf9('0x1b'),'body':_0x576eac})[_0x7cf9('0x1c')](function(_0x15c53a){logger[_0x7cf9('0x1d')](_0x7cf9('0x1e'));return _0x15c53a;});}function getUser(_0xfc2945,_0x2d4956){if(intUtil['validateEmail'](_0x2d4956)){return request({'uri':util[_0x7cf9('0xe')](_0x7cf9('0x1f'),_0xfc2945['remoteUri']),'qs':{'email':_0x2d4956}})[_0x7cf9('0x1c')](function(_0x1bb2b9){if(_0x1bb2b9[_0x7cf9('0x20')]){logger[_0x7cf9('0x1d')](_0x7cf9('0x21'));return _[_0x7cf9('0x22')](_0x1bb2b9,function(_0x93a87c){return _0x93a87c[_0x7cf9('0x23')][_0x7cf9('0x24')]===_0x2d4956;});}else{logger[_0x7cf9('0x1d')](_0x7cf9('0x25'));return request({'uri':util['format'](_0x7cf9('0x26'),_0xfc2945[_0x7cf9('0x1a')])})['then'](function(_0x579f20){logger[_0x7cf9('0x1d')](_0x7cf9('0x27'));return _0x579f20;});}});}else{logger['info'](_0x7cf9('0x28'));return request({'uri':util[_0x7cf9('0xe')]('%s/api/v2/agents/me',_0xfc2945['remoteUri'])})['then'](function(_0xfab40a){logger[_0x7cf9('0x1d')](_0x7cf9('0x27'));return _0xfab40a;});}}function getEndUser(_0x34795b,_0x1a4a7d,_0x51fdcb){logger[_0x7cf9('0x1d')](_0x7cf9('0x29'),_0x51fdcb);return request({'uri':util['format'](_0x7cf9('0x2a'),_0x34795b[_0x7cf9('0x1a')]),'qs':{'phone':_0x51fdcb}})[_0x7cf9('0x1c')](function(_0x316efa){if(_0x316efa[_0x7cf9('0x20')]){logger[_0x7cf9('0x1d')](_0x7cf9('0x2b'));return _[_0x7cf9('0x22')](_0x316efa,{'phone':_0x51fdcb});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7cf9('0xe')](_0x7cf9('0x2a'),_0x34795b[_0x7cf9('0x1a')]),'method':_0x7cf9('0x1b'),'body':{'name':_0x1a4a7d,'phone':_0x51fdcb}})[_0x7cf9('0x1c')](function(_0x3b2b34){logger[_0x7cf9('0x1d')](_0x7cf9('0x2c'));return _0x3b2b34;});}});}function getAuth(_0x4761d1){return util[_0x7cf9('0xe')](_0x7cf9('0x2d'),new Buffer(_0x4761d1['apiKey']+':X')[_0x7cf9('0x2e')]('base64'));}function request(_0x5c5a57){logger['debug'](_0x7cf9('0x2f'),JSON['stringify'](_0x5c5a57));return rp(_[_0x7cf9('0x8')](_0x5c5a57,{'method':_0x7cf9('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x477c4b,_0x4e0de0){var _0x1b2c5c=[];if(_0x477c4b&&_0x477c4b[_0x7cf9('0x20')]>0x0){_0x1b2c5c=_['map'](_0x477c4b,_0x4e0de0);}return _0x1b2c5c;}function getCustomFields(_0x265737,_0x2e1659){var _0x3a9ada=[];var _0x281d6c={'custom_fields':[]};if(_0x265737[_0x7cf9('0x20')]>0x0){_['forEach'](_0x265737,function(_0x130425){if(_[_0x7cf9('0x31')](['string',_0x7cf9('0x32')],_0x130425[_0x7cf9('0x33')])&&_0x130425[_0x7cf9('0x34')]&&!_0x130425['customField']){_0x281d6c[_0x130425[_0x7cf9('0x34')]['toLowerCase']()]=_0x130425[_0x7cf9('0x35')][_0x7cf9('0x2e')]();}else if(_[_0x7cf9('0x31')](['string',_0x7cf9('0x32')],_0x130425[_0x7cf9('0x33')])&&_0x130425[_0x7cf9('0x36')]&&_0x130425[_0x7cf9('0x37')]){_0x281d6c[_0x7cf9('0x16')][_0x7cf9('0x38')]({'id':_0x130425[_0x7cf9('0x36')],'value':_0x130425[_0x7cf9('0x35')][_0x7cf9('0x2e')]()});}else if(_0x130425[_0x7cf9('0x33')]===_0x7cf9('0x39')&&_0x130425[_0x7cf9('0x3a')]&&_0x130425[_0x7cf9('0x36')]&&_0x130425['customField']){_0x2e1659[_0x130425['variableName']]&&_0x281d6c[_0x7cf9('0x16')][_0x7cf9('0x38')]({'id':_0x130425[_0x7cf9('0x36')],'value':_0x2e1659[_0x130425[_0x7cf9('0x3a')]][_0x7cf9('0x2e')]()});}else if(_0x130425[_0x7cf9('0x33')]===_0x7cf9('0x3b')&&_0x130425[_0x7cf9('0x3c')]&&_0x130425[_0x7cf9('0x3c')][_0x7cf9('0x15')]&&_0x130425[_0x7cf9('0x36')]&&_0x130425['customField']){_0x2e1659[_0x130425[_0x7cf9('0x3c')][_0x7cf9('0x15')][_0x7cf9('0x3d')]()]&&_0x281d6c[_0x7cf9('0x16')]['push']({'id':_0x130425[_0x7cf9('0x36')],'value':_0x2e1659[_0x130425[_0x7cf9('0x3c')][_0x7cf9('0x15')][_0x7cf9('0x3d')]()][_0x7cf9('0x2e')]()});}});}return _0x281d6c;}exports[_0x7cf9('0x3e')]=function(_0x27d8cc,_0x43f983,_0x336341,_0x203140,_0x25f52b,_0x2b700e){var _0x2bb31a,_0x329043;_0x2b700e['remoteUri']=intUtil['stripTrailingSlash'](_0x2b700e[_0x7cf9('0x1a')]);_0x2b700e['serverUrl']=intUtil[_0x7cf9('0x3f')](_0x2b700e[_0x7cf9('0x40')]);if(_0x25f52b&&_0x25f52b[_0x7cf9('0x41')]){logger[_0x7cf9('0x1d')](_0x7cf9('0x42'),_0x7cf9('0x43'));_0x43f983[_0x7cf9('0x44')]=util[_0x7cf9('0xe')](_0x7cf9('0x45'),_0x2b700e['serverUrl'],_0x43f983[_0x7cf9('0x46')],md5(_0x43f983[_0x7cf9('0x46')]));}else{_0x43f983[_0x7cf9('0x44')]='';}headers[_0x7cf9('0x47')]=getAuth(_0x2b700e);return getUser(_0x2b700e,_0x203140[_0x7cf9('0x24')])[_0x7cf9('0x1c')](function(_0x220a9){_0x2bb31a=_0x220a9;logger[_0x7cf9('0x1d')](_0x7cf9('0x48'),_0x2bb31a['id']);return getEndUser(_0x2b700e,_0x43f983[_0x7cf9('0x49')],_0x43f983['calleridnum']);})[_0x7cf9('0x1c')](function(_0x1c0af2){_0x329043=_0x1c0af2;logger[_0x7cf9('0x1d')](_0x7cf9('0x4a'),_0x329043['id']);return getTicket(_0x2b700e,_0x2bb31a,_0x329043,_0x336341,_0x43f983);})[_0x7cf9('0x1c')](function(_0xb550d9){if(_0xb550d9&&_0xb550d9['id']){logger['info']('Ticket\x20created!');logger[_0x7cf9('0x1d')](_0x7cf9('0x4b'),_0xb550d9['id']);logger[_0x7cf9('0x1d')](_0x7cf9('0x42'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7cf9('0xe')](_0x7cf9('0x4c'),_0x203140[_0x7cf9('0x15')]),_0x7cf9('0x4d'),{'uri':util[_0x7cf9('0xe')]('%s/helpdesk/tickets/%d',_0x2b700e[_0x7cf9('0x1a')],_0xb550d9['id'])});}})[_0x7cf9('0x4e')](function(_0x50d4fa){logger['error'](_0x7cf9('0x42'),JSON[_0x7cf9('0x4f')](_0x50d4fa));});};exports[_0x7cf9('0x50')]=function(_0x15ce16,_0x2537e6,_0x556879,_0x11a334,_0x4d93f4,_0x1540d4,_0x49f74e){var _0xc01128,_0x1efc1a;_0x1540d4['remoteUri']=intUtil[_0x7cf9('0x3f')](_0x1540d4[_0x7cf9('0x1a')]);_0x1540d4['serverUrl']=intUtil[_0x7cf9('0x3f')](_0x1540d4[_0x7cf9('0x40')]);if(_0x49f74e&&_0x49f74e[_0x7cf9('0x51')]&&_0x49f74e[_0x7cf9('0x51')]!==_0x7cf9('0x52')){logger[_0x7cf9('0x1d')](_0x7cf9('0x53'),_0x7cf9('0x43'));_0x2537e6['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1540d4[_0x7cf9('0x40')],_0x2537e6['uniqueid'],md5(_0x2537e6[_0x7cf9('0x46')]));}headers[_0x7cf9('0x47')]=getAuth(_0x1540d4);return getUser(_0x1540d4,_0x11a334[_0x7cf9('0x24')])[_0x7cf9('0x1c')](function(_0xad1050){_0xc01128=_0xad1050;logger[_0x7cf9('0x1d')](_0x7cf9('0x48'),_0xc01128['id']);return getEndUser(_0x1540d4,_0x2537e6[_0x7cf9('0x54')],_0x2537e6[_0x7cf9('0x55')]);})[_0x7cf9('0x1c')](function(_0x160366){_0x1efc1a=_0x160366;logger[_0x7cf9('0x1d')](_0x7cf9('0x4a'),_0x1efc1a['id']);return getTicket(_0x1540d4,_0xc01128,_0x1efc1a,_0x556879,_0x2537e6);})['then'](function(_0x3dbdcc){if(_0x3dbdcc&&_0x3dbdcc['id']){logger['info'](_0x7cf9('0x1e'));logger['info'](_0x7cf9('0x4b'),_0x3dbdcc['id']);logger['info'](_0x7cf9('0x53'),_0x7cf9('0x56'));emit(util[_0x7cf9('0xe')](_0x7cf9('0x4c'),_0x11a334[_0x7cf9('0x15')]),'trigger:browser:url',{'uri':util[_0x7cf9('0xe')](_0x7cf9('0x57'),_0x1540d4['remoteUri'],_0x3dbdcc['id'])});}})['catch'](function(_0x19e8f7){logger[_0x7cf9('0x58')]('[OUTBOUND]',JSON[_0x7cf9('0x4f')](_0x19e8f7));});};exports[_0x7cf9('0x59')]=function(_0x5b7098,_0x35854f,_0x237270,_0x232d09,_0x5c231a,_0x299b16){var _0x37882c,_0x111ef5;_0x299b16[_0x7cf9('0x1a')]=intUtil[_0x7cf9('0x3f')](_0x299b16[_0x7cf9('0x1a')]);_0x299b16[_0x7cf9('0x40')]=intUtil[_0x7cf9('0x3f')](_0x299b16['serverUrl']);if(_0x5c231a&&_0x5c231a[_0x7cf9('0x41')]){logger['info']('['+_0x35854f[_0x7cf9('0x5a')][_0x7cf9('0x5b')]()+']',_0x7cf9('0x43'));_0x35854f[_0x7cf9('0x44')]=util[_0x7cf9('0xe')](_0x7cf9('0x45'),_0x299b16['serverUrl'],_0x35854f['uniqueid'],md5(_0x35854f['uniqueid']));}else{_0x35854f['recordingURL']='';}headers['Authorization']=getAuth(_0x299b16);return getUser(_0x299b16,'')[_0x7cf9('0x1c')](function(_0x2110f2){_0x37882c=_0x2110f2;logger['info'](_0x7cf9('0x48'),_0x37882c['id']);return getEndUser(_0x299b16,_0x35854f['calleridname'],_0x35854f[_0x7cf9('0x5c')]);})['then'](function(_0x2ffc64){_0x111ef5=_0x2ffc64;logger[_0x7cf9('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x111ef5['id']);return getTicket(_0x299b16,_0x37882c,_0x111ef5,_0x237270,_0x35854f);})[_0x7cf9('0x1c')](function(_0x24512){if(_0x24512){logger[_0x7cf9('0x1d')]('Ticket\x20created!');logger[_0x7cf9('0x1d')](_0x7cf9('0x4b'),_0x24512['id']);}})['catch'](function(_0x59c15c){logger[_0x7cf9('0x58')]('['+_0x35854f[_0x7cf9('0x5a')][_0x7cf9('0x5b')]()+']',JSON[_0x7cf9('0x4f')](_0x59c15c));});}; \ No newline at end of file +var _0x001e=['variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','unmanaged','lastevent','calleridnum','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','
','Tags','name','Fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','string','picklist','type','nameField','customField','toLowerCase','includes','idField','custom_fields','push','content','variable'];(function(_0xa95705,_0x2042d2){var _0x4ffcfc=function(_0x2cae05){while(--_0x2cae05){_0xa95705['push'](_0xa95705['shift']());}};_0x4ffcfc(++_0x2042d2);}(_0x001e,0x13b));var _0xe001=function(_0x545e1c,_0x3088d1){_0x545e1c=_0x545e1c-0x0;var _0x47abef=_0x001e[_0x545e1c];return _0x47abef;};'use strict';var _=require(_0xe001('0x0'));var rp=require(_0xe001('0x1'));var md5=require(_0xe001('0x2'));var util=require('util');var Redis=require(_0xe001('0x3'));var intUtil=require(_0xe001('0x4'));var config=require(_0xe001('0x5'));var logger=require('../../../../config/logger')(_0xe001('0x6'));config[_0xe001('0x7')]=_[_0xe001('0x8')](config[_0xe001('0x7')],{'host':_0xe001('0x9'),'port':0x18eb});var io=require(_0xe001('0xa'))(new Redis(config[_0xe001('0x7')]));var headers={'Content-Type':_0xe001('0xb'),'Accept':_0xe001('0xb')};function emit(_0x1bc54b,_0x2d027b,_0x6c9578){io['to'](_0x1bc54b)[_0xe001('0xc')](_0x2d027b,_0x6c9578);}function getTicket(_0x324552,_0x4f8c48,_0x2764ed,_0x2e42a7,_0x7e8119){logger[_0xe001('0xd')](_0xe001('0xe'));var _0x509ea9=_[_0xe001('0xf')]({'responder_id':_0x4f8c48['id'],'requester_id':_0x2764ed['id'],'name':util[_0xe001('0x10')](_0xe001('0x11'),_0x7e8119[_0xe001('0x12')]),'phone':_0x7e8119['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2e42a7['Subjects'],_0x7e8119,'\x20'),'description':intUtil['getString'](_0x2e42a7['Descriptions'],_0x7e8119,_0xe001('0x13')),'tags':getTags(_0x2e42a7[_0xe001('0x14')],_0xe001('0x15'))},getCustomFields(_0x2e42a7[_0xe001('0x16')],_0x7e8119));_0x509ea9['custom_fields']=_[_0xe001('0x17')](_[_0xe001('0x18')](_0x509ea9['custom_fields'],'id'),_0xe001('0x19'));return request({'uri':util[_0xe001('0x10')](_0xe001('0x1a'),_0x324552[_0xe001('0x1b')]),'method':'POST','body':_0x509ea9})[_0xe001('0x1c')](function(_0x299d94){logger[_0xe001('0xd')](_0xe001('0x1d'));return _0x299d94;});}function getUser(_0x3acb66,_0x559411){if(intUtil[_0xe001('0x1e')](_0x559411)){return request({'uri':util['format'](_0xe001('0x1f'),_0x3acb66['remoteUri']),'qs':{'email':_0x559411}})[_0xe001('0x1c')](function(_0x5c5431){if(_0x5c5431[_0xe001('0x20')]){logger[_0xe001('0xd')](_0xe001('0x21'));return _['find'](_0x5c5431,function(_0x504b51){return _0x504b51[_0xe001('0x22')][_0xe001('0x23')]===_0x559411;});}else{logger['info'](_0xe001('0x24'));return request({'uri':util[_0xe001('0x10')](_0xe001('0x25'),_0x3acb66[_0xe001('0x1b')])})[_0xe001('0x1c')](function(_0x1ea5b1){logger[_0xe001('0xd')](_0xe001('0x26'));return _0x1ea5b1;});}});}else{logger[_0xe001('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe001('0x10')](_0xe001('0x25'),_0x3acb66['remoteUri'])})[_0xe001('0x1c')](function(_0x17d0d4){logger[_0xe001('0xd')](_0xe001('0x26'));return _0x17d0d4;});}}function getEndUser(_0xc10ef8,_0x1bd51e,_0x4aeef6){logger[_0xe001('0xd')](_0xe001('0x27'),_0x4aeef6);return request({'uri':util[_0xe001('0x10')](_0xe001('0x28'),_0xc10ef8['remoteUri']),'qs':{'phone':_0x4aeef6}})[_0xe001('0x1c')](function(_0x2fb3c7){if(_0x2fb3c7[_0xe001('0x20')]){logger[_0xe001('0xd')](_0xe001('0x29'));return _[_0xe001('0x2a')](_0x2fb3c7,{'phone':_0x4aeef6});}else{logger[_0xe001('0xd')](_0xe001('0x2b'));return request({'uri':util[_0xe001('0x10')](_0xe001('0x28'),_0xc10ef8[_0xe001('0x1b')]),'method':_0xe001('0x2c'),'body':{'name':_0x1bd51e,'phone':_0x4aeef6}})[_0xe001('0x1c')](function(_0x2d74f3){logger[_0xe001('0xd')](_0xe001('0x2d'));return _0x2d74f3;});}});}function getAuth(_0x6d2911){return util[_0xe001('0x10')](_0xe001('0x2e'),new Buffer(_0x6d2911[_0xe001('0x2f')]+':X')[_0xe001('0x30')](_0xe001('0x31')));}function request(_0x407c37){logger[_0xe001('0x32')](_0xe001('0x33'),JSON['stringify'](_0x407c37));return rp(_[_0xe001('0x8')](_0x407c37,{'method':_0xe001('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x286fec,_0x51e43d){var _0x55b24c=[];if(_0x286fec&&_0x286fec[_0xe001('0x20')]>0x0){_0x55b24c=_['map'](_0x286fec,_0x51e43d);}return _0x55b24c;}function getCustomFields(_0x5210dc,_0x2ff316){var _0x150bdd=[];var _0x27ab3b={'custom_fields':[]};if(_0x5210dc[_0xe001('0x20')]>0x0){_['forEach'](_0x5210dc,function(_0x33b103){if(_['includes']([_0xe001('0x35'),_0xe001('0x36')],_0x33b103[_0xe001('0x37')])&&_0x33b103[_0xe001('0x38')]&&!_0x33b103[_0xe001('0x39')]){_0x27ab3b[_0x33b103[_0xe001('0x38')][_0xe001('0x3a')]()]=_0x33b103['content'][_0xe001('0x30')]();}else if(_[_0xe001('0x3b')]([_0xe001('0x35'),_0xe001('0x36')],_0x33b103[_0xe001('0x37')])&&_0x33b103[_0xe001('0x3c')]&&_0x33b103[_0xe001('0x39')]){_0x27ab3b[_0xe001('0x3d')][_0xe001('0x3e')]({'id':_0x33b103['idField'],'value':_0x33b103[_0xe001('0x3f')]['toString']()});}else if(_0x33b103[_0xe001('0x37')]===_0xe001('0x40')&&_0x33b103[_0xe001('0x41')]&&_0x33b103[_0xe001('0x3c')]&&_0x33b103[_0xe001('0x39')]){_0x2ff316[_0x33b103[_0xe001('0x41')]]&&_0x27ab3b[_0xe001('0x3d')]['push']({'id':_0x33b103[_0xe001('0x3c')],'value':_0x2ff316[_0x33b103[_0xe001('0x41')]][_0xe001('0x30')]()});}else if(_0x33b103[_0xe001('0x37')]==='customVariable'&&_0x33b103[_0xe001('0x42')]&&_0x33b103[_0xe001('0x42')][_0xe001('0x15')]&&_0x33b103[_0xe001('0x3c')]&&_0x33b103[_0xe001('0x39')]){_0x2ff316[_0x33b103['Variable']['name']['toLowerCase']()]&&_0x27ab3b[_0xe001('0x3d')][_0xe001('0x3e')]({'id':_0x33b103[_0xe001('0x3c')],'value':_0x2ff316[_0x33b103[_0xe001('0x42')][_0xe001('0x15')][_0xe001('0x3a')]()]['toString']()});}});}return _0x27ab3b;}exports[_0xe001('0x43')]=function(_0x168171,_0x4aafe3,_0x5a2add,_0x24bb4b,_0x111322,_0xc0384a){var _0x1c40d1,_0x1afde1;_0xc0384a['remoteUri']=intUtil[_0xe001('0x44')](_0xc0384a[_0xe001('0x1b')]);_0xc0384a[_0xe001('0x45')]=intUtil[_0xe001('0x44')](_0xc0384a[_0xe001('0x45')]);if(_0x111322&&_0x111322[_0xe001('0x46')]){logger[_0xe001('0xd')](_0xe001('0x47'),_0xe001('0x48'));_0x4aafe3[_0xe001('0x49')]=util[_0xe001('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc0384a['serverUrl'],_0x4aafe3[_0xe001('0x4a')],md5(_0x4aafe3['uniqueid']));}else{_0x4aafe3[_0xe001('0x49')]='';}headers[_0xe001('0x4b')]=getAuth(_0xc0384a);return getUser(_0xc0384a,_0x24bb4b[_0xe001('0x23')])[_0xe001('0x1c')](function(_0x8a2c78){_0x1c40d1=_0x8a2c78;logger['info'](_0xe001('0x4c'),_0x1c40d1['id']);return getEndUser(_0xc0384a,_0x4aafe3[_0xe001('0x12')],_0x4aafe3['calleridnum']);})['then'](function(_0x46d2ee){_0x1afde1=_0x46d2ee;logger[_0xe001('0xd')]('The\x20Enduser\x20ID\x20is:',_0x1afde1['id']);return getTicket(_0xc0384a,_0x1c40d1,_0x1afde1,_0x5a2add,_0x4aafe3);})[_0xe001('0x1c')](function(_0x9e9f43){if(_0x9e9f43&&_0x9e9f43['id']){logger[_0xe001('0xd')](_0xe001('0x1d'));logger[_0xe001('0xd')]('The\x20Ticket\x20ID\x20is:',_0x9e9f43['id']);logger[_0xe001('0xd')](_0xe001('0x47'),_0xe001('0x4d'));emit(util[_0xe001('0x10')]('user:%s',_0x24bb4b[_0xe001('0x15')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0xc0384a[_0xe001('0x1b')],_0x9e9f43['id'])});}})['catch'](function(_0xf7791a){logger[_0xe001('0x4e')](_0xe001('0x47'),JSON[_0xe001('0x4f')](_0xf7791a));});};exports[_0xe001('0x50')]=function(_0x2d5cad,_0x4e960d,_0x46dede,_0x53d3bc,_0x13baab,_0x1eae35,_0x1d60b6){var _0x293dd7,_0x565a9a;_0x1eae35[_0xe001('0x1b')]=intUtil[_0xe001('0x44')](_0x1eae35[_0xe001('0x1b')]);_0x1eae35[_0xe001('0x45')]=intUtil[_0xe001('0x44')](_0x1eae35[_0xe001('0x45')]);if(_0x1d60b6&&_0x1d60b6[_0xe001('0x51')]&&_0x1d60b6[_0xe001('0x51')]!==_0xe001('0x52')){logger['info'](_0xe001('0x53'),'Recording\x20is\x20enabled!');_0x4e960d[_0xe001('0x49')]=util[_0xe001('0x10')](_0xe001('0x54'),_0x1eae35['serverUrl'],_0x4e960d[_0xe001('0x4a')],md5(_0x4e960d[_0xe001('0x4a')]));}headers[_0xe001('0x4b')]=getAuth(_0x1eae35);return getUser(_0x1eae35,_0x53d3bc[_0xe001('0x23')])['then'](function(_0x43c4b4){_0x293dd7=_0x43c4b4;logger[_0xe001('0xd')](_0xe001('0x4c'),_0x293dd7['id']);return getEndUser(_0x1eae35,_0x4e960d['destcalleridname'],_0x4e960d[_0xe001('0x55')]);})[_0xe001('0x1c')](function(_0x4a6bb2){_0x565a9a=_0x4a6bb2;logger[_0xe001('0xd')](_0xe001('0x56'),_0x565a9a['id']);return getTicket(_0x1eae35,_0x293dd7,_0x565a9a,_0x46dede,_0x4e960d);})[_0xe001('0x1c')](function(_0x3e8467){if(_0x3e8467&&_0x3e8467['id']){logger[_0xe001('0xd')](_0xe001('0x1d'));logger[_0xe001('0xd')](_0xe001('0x57'),_0x3e8467['id']);logger[_0xe001('0xd')](_0xe001('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe001('0x10')](_0xe001('0x58'),_0x53d3bc['name']),'trigger:browser:url',{'uri':util[_0xe001('0x10')](_0xe001('0x59'),_0x1eae35[_0xe001('0x1b')],_0x3e8467['id'])});}})[_0xe001('0x5a')](function(_0x62c1a3){logger[_0xe001('0x4e')]('[OUTBOUND]',JSON[_0xe001('0x4f')](_0x62c1a3));});};exports[_0xe001('0x5b')]=function(_0x4faeeb,_0x44f938,_0x2fe272,_0x1903fb,_0x53cbf4,_0x1f10e1){var _0x44af44,_0x37a9f3;_0x1f10e1['remoteUri']=intUtil[_0xe001('0x44')](_0x1f10e1[_0xe001('0x1b')]);_0x1f10e1[_0xe001('0x45')]=intUtil[_0xe001('0x44')](_0x1f10e1['serverUrl']);if(_0x53cbf4&&_0x53cbf4[_0xe001('0x46')]){logger[_0xe001('0xd')]('['+_0x44f938[_0xe001('0x5c')]['toUpperCase']()+']',_0xe001('0x48'));_0x44f938[_0xe001('0x49')]=util[_0xe001('0x10')](_0xe001('0x54'),_0x1f10e1['serverUrl'],_0x44f938['uniqueid'],md5(_0x44f938[_0xe001('0x4a')]));}else{_0x44f938[_0xe001('0x49')]='';}headers[_0xe001('0x4b')]=getAuth(_0x1f10e1);return getUser(_0x1f10e1,'')[_0xe001('0x1c')](function(_0x1fd31b){_0x44af44=_0x1fd31b;logger['info'](_0xe001('0x4c'),_0x44af44['id']);return getEndUser(_0x1f10e1,_0x44f938['calleridname'],_0x44f938[_0xe001('0x5d')]);})[_0xe001('0x1c')](function(_0x118ca1){_0x37a9f3=_0x118ca1;logger[_0xe001('0xd')](_0xe001('0x56'),_0x37a9f3['id']);return getTicket(_0x1f10e1,_0x44af44,_0x37a9f3,_0x2fe272,_0x44f938);})[_0xe001('0x1c')](function(_0xf16966){if(_0xf16966){logger[_0xe001('0xd')](_0xe001('0x1d'));logger[_0xe001('0xd')](_0xe001('0x57'),_0xf16966['id']);}})[_0xe001('0x5a')](function(_0x27d34f){logger[_0xe001('0x4e')]('['+_0x44f938[_0xe001('0x5c')][_0xe001('0x5e')]()+']',JSON[_0xe001('0x4f')](_0x27d34f));});}; \ 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 0fec94b..f2fb378 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 _0xaeac=['apiKey','remoteUri','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','then','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','Admin\x20selected','userEmail','error','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','format','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token='];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaeac,0x115));var _0xcaea=function(_0x548f80,_0x1f7741){_0x548f80=_0x548f80-0x0;var _0x284e9d=_0xaeac[_0x548f80];return _0x284e9d;};'use strict';var _=require(_0xcaea('0x0'));var rp=require(_0xcaea('0x1'));var md5=require(_0xcaea('0x2'));var util=require(_0xcaea('0x3'));var moment=require(_0xcaea('0x4'));var Promise=require(_0xcaea('0x5'));var Redis=require(_0xcaea('0x6'));var intUtil=require(_0xcaea('0x7'));var config=require('../../../../config/environment');var logger=require(_0xcaea('0x8'))(_0xcaea('0x9'));config[_0xcaea('0xa')]=_[_0xcaea('0xb')](config[_0xcaea('0xa')],{'host':_0xcaea('0xc'),'port':0x18eb});var io=require(_0xcaea('0xd'))(new Redis(config[_0xcaea('0xa')]));function getAdminId(_0x5d691a,_0xeb42e1,_0x3a93bb,_0x4d0b3f){return new Promise(function(_0x13b1f6,_0x2c9ceb){var _0x857b55=![];var _0x2bc569={'method':_0xcaea('0xe'),'uri':_0x4d0b3f+_0xcaea('0xf'),'json':!![]};_0x2bc569[_0xcaea('0x10')]=_0x3a93bb;logger[_0xcaea('0x11')]('Getting\x20admin\x20information');return rp(_0x2bc569)['then'](function(_0x1bd8ef){if(_0x1bd8ef){var _0x43df21=_0x1bd8ef[_0xcaea('0x12')];var _0x36c0c2=null;for(_0x36c0c2=0x0;_0x36c0c2<_0x43df21[_0xcaea('0x13')];_0x36c0c2++){if(_0x43df21[_0x36c0c2][_0xcaea('0x14')]===_0x5d691a[_0xcaea('0x15')]){_0x5d691a[_0xcaea('0x16')]=_0x43df21[_0x36c0c2]['id'];_0x857b55=!![];}}if(_0x857b55){logger[_0xcaea('0x11')]('Admin\x20found:',_0x5d691a[_0xcaea('0x16')]);_0x13b1f6(_0x5d691a);}else{_0x2c9ceb({'statusCode':0x194,'message':_0xcaea('0x17')});}}else{_0x2c9ceb({'statusCode':0x194,'message':_0xcaea('0x17')});}})[_0xcaea('0x18')](function(_0x32385f){logger['error']('['+[_0xeb42e1[_0xcaea('0x19')]()]+']',_0x32385f[_0xcaea('0x1a')]);_0x2c9ceb(_0x32385f);});});}function getUser(_0x111554,_0x985573,_0x31327a){return function(_0xa73d54){return new Promise(function(_0x396a6d,_0xb6ad3d){var _0x2a3f51={'method':_0xcaea('0xe'),'uri':_0x31327a+_0xcaea('0xf'),'json':!![]};_0x2a3f51[_0xcaea('0x10')]=_0x985573;logger[_0xcaea('0x11')]('Getting\x20user\x20list');return rp(_0x2a3f51)[_0xcaea('0x1b')](function(_0x273969){if(_0x273969){var _0x23129d=_0x273969[_0xcaea('0x12')];var _0x4f3500=![];var _0x755bfb=null;if(_0xa73d54['agentEmail']!==null){logger[_0xcaea('0x11')](_0xcaea('0x1c'),_0xa73d54[_0xcaea('0x1d')]);_0xa73d54['userEmail']=_0xa73d54[_0xcaea('0x1d')];for(_0x755bfb=0x0;_0x755bfb<_0x23129d['length'];_0x755bfb++){if(_0x23129d[_0x755bfb][_0xcaea('0x14')]===_0xa73d54['agentEmail']){_0x4f3500=!![];_0xa73d54[_0xcaea('0x1e')]=_0x23129d[_0x755bfb]['id'];logger['info'](_0xcaea('0x1f'),_0xa73d54[_0xcaea('0x1e')]);}}}if(!_0x4f3500){logger[_0xcaea('0x11')](_0xcaea('0x20'));_0xa73d54[_0xcaea('0x21')]=_0xa73d54[_0xcaea('0x15')];_0xa73d54['userId']=_0xa73d54[_0xcaea('0x16')];_0x4f3500=!![];}if(_0x4f3500){_0x396a6d(_0xa73d54);}else{_0xb6ad3d({'statusCode':0x194,'message':_0xcaea('0x17')});}}else{_0xb6ad3d({'statusCode':0x194,'message':_0xcaea('0x17')});}})[_0xcaea('0x18')](function(_0x4f350a){logger[_0xcaea('0x22')]('['+[_0x111554[_0xcaea('0x19')]()]+']',_0x4f350a['message']);_0xb6ad3d(_0x4f350a);});});};}function searchContact(_0x317cdd,_0x1ab280,_0x14e0a8,_0x352904){return new Promise(function(_0x4ef1aa,_0x2f5bb2){var _0x53570d={'method':_0xcaea('0xe'),'headers':_0x1ab280,'uri':_0x317cdd+'/api/lookup?q='+_0x352904+_0xcaea('0x23')+_0x14e0a8+_0xcaea('0x24'),'json':!![]};rp(_0x53570d)[_0xcaea('0x1b')](function(_0x2d91e6){var _0x296ee1=_['find'](_0x2d91e6[_0xcaea('0x25')][_0xcaea('0x25')],[_0x14e0a8,_0x352904]);_0x4ef1aa(_0x296ee1);})[_0xcaea('0x18')](function(_0xf6466){_0x2f5bb2(_0xf6466);});});}function getEndUser(_0x20177b,_0x2db12c,_0x48c374){return function(_0x55ef7d){return new Promise(function(_0x469ea1,_0x34bb5b){logger[_0xcaea('0x11')](util['format'](_0xcaea('0x26'),_0x55ef7d[_0xcaea('0x27')]));searchContact(_0x48c374,_0x2db12c,'mobile_number',_0x55ef7d['contactNumber'])[_0xcaea('0x1b')](function(_0x24583e){if(_0x24583e){_0x55ef7d[_0xcaea('0x28')]=_0x24583e['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x55ef7d[_0xcaea('0x28')]);return _0x469ea1(_0x55ef7d);}searchContact(_0x48c374,_0x2db12c,_0xcaea('0x29'),_0x55ef7d[_0xcaea('0x27')])[_0xcaea('0x1b')](function(_0x576028){if(_0x576028){_0x55ef7d[_0xcaea('0x28')]=_0x576028['id'];logger[_0xcaea('0x11')](_0xcaea('0x2a'),_0x55ef7d[_0xcaea('0x28')]);return _0x469ea1(_0x55ef7d);}createEndUser(_0x55ef7d,_0x20177b,_0x2db12c,_0x48c374)[_0xcaea('0x1b')](function(_0x52be2){logger[_0xcaea('0x11')]('Contact\x20created:',_0x52be2[_0xcaea('0x28')]);return _0x469ea1(_0x52be2);});});})[_0xcaea('0x18')](function(_0x579431){_0x34bb5b(_0x579431);});});};}function createEndUser(_0x5431e5,_0x5dc2ce,_0x574418,_0xf3d1c8){return new Promise(function(_0x104f54,_0x252ef3){var _0x5b589f=moment();var _0x48f803={'method':_0xcaea('0x2b'),'uri':_0xf3d1c8+_0xcaea('0x2c'),'body':{'contact':{'last_name':_0x5431e5[_0xcaea('0x27')],'work_number':_0x5431e5[_0xcaea('0x27')],'mobile_number':_0x5431e5[_0xcaea('0x27')],'owner_id':_0x5431e5[_0xcaea('0x1e')],'created_at':_0x5b589f[_0xcaea('0x2d')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x48f803['headers']=_0x574418;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x48f803)[_0xcaea('0x1b')](function(_0x32935a){_0x5431e5[_0xcaea('0x28')]=_0x32935a[_0xcaea('0x2e')]['id'];_0x104f54(_0x5431e5);})['catch'](function(_0x456e76){logger['error']('['+[_0x5dc2ce[_0xcaea('0x19')]()]+']',_0x456e76[_0xcaea('0x1a')]);_0x252ef3(_0x456e76[_0xcaea('0x1a')]);});});}function getTicket(_0x28ebaa,_0x11b931,_0x433291,_0x1e64bb,_0x8b8560){return function(_0xe65a5d){logger['info'](_0xcaea('0x2f'));return new Promise(function(_0x959512,_0x225702){var _0x470fd7=moment();var _0x353539={'method':'POST','uri':_0x433291+_0xcaea('0x30'),'body':{'title':intUtil[_0xcaea('0x31')](_0x1e64bb[_0xcaea('0x32')],_0x8b8560,'\x20'),'description':intUtil['getString'](_0x1e64bb[_0xcaea('0x33')],_0x8b8560,'\x0a'),'owner_id':_0xe65a5d[_0xcaea('0x1e')],'creater_id':_0xe65a5d[_0xcaea('0x16')],'targetable_id':_0xe65a5d[_0xcaea('0x28')],'targetable_type':_0xcaea('0x34'),'created_at':_0x470fd7[_0xcaea('0x2d')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x470fd7[_0xcaea('0x35')](0x1e,'m')[_0xcaea('0x2d')](_0xcaea('0x36'))},'json':!![]};_0x353539[_0xcaea('0x10')]=_0x11b931;return rp(_0x353539)['then'](function(_0x4077e5){_0xe65a5d[_0xcaea('0x37')]=_0x4077e5[_0xcaea('0x38')]['id'];logger[_0xcaea('0x11')](_0xcaea('0x39'),_0xe65a5d[_0xcaea('0x37')]);_0x959512(_0xe65a5d);})[_0xcaea('0x18')](function(_0x38c24c){logger['error']('['+[_0x28ebaa['toUpperCase']()]+']',_0x38c24c[_0xcaea('0x1a')]);_0x225702(_0x38c24c['message']);});});};}function emit(_0x27461b,_0x265698,_0x2b3426){var _0x3d7f1d={'uri':_0x27461b+_0xcaea('0x3a')+_0x2b3426};io['to'](util[_0xcaea('0x2d')](_0xcaea('0x3b'),_0x265698))[_0xcaea('0x3c')](_0xcaea('0x3d'),_0x3d7f1d);}exports['cs']=function(_0x274f29,_0x250893,_0x5c790a,_0x574bfb,_0x17a462,_0xb38ad2,_0x15465b,_0x46a38d){var _0x496b9e={};var _0x296252={'Authorization':_0xcaea('0x3e')+_0xb38ad2[_0xcaea('0x3f')]};_0xb38ad2[_0xcaea('0x40')]=intUtil[_0xcaea('0x41')](_0xb38ad2['remoteUri']);_0xb38ad2['serverUrl']=intUtil[_0xcaea('0x41')](_0xb38ad2['serverUrl']);var _0xac8531=_0xb38ad2[_0xcaea('0x40')];_0x496b9e[_0xcaea('0x15')]=_0xb38ad2[_0xcaea('0x42')];_0x496b9e[_0xcaea('0x27')]=_0x46a38d[_0xcaea('0x43')]()===_0xcaea('0x44')?_0x250893[_0xcaea('0x45')]:_0x250893['calleridnum'];_0x496b9e['callDirection']=_0x46a38d===_0xcaea('0x46')||_0x46a38d==='unmanaged'?_0xcaea('0x46'):_0xcaea('0x44');if(_0x574bfb){_0x496b9e[_0xcaea('0x1d')]=_0x574bfb[_0xcaea('0x14')];}var _0x3c53fa=util[_0xcaea('0x2d')](_0xcaea('0x47'),_0xb38ad2[_0xcaea('0x48')],_0x250893[_0xcaea('0x49')],md5(_0x250893[_0xcaea('0x49')]));if(_0x17a462&&_0x17a462[_0xcaea('0x4a')]){logger[_0xcaea('0x11')](_0xcaea('0x4b'),'Recording\x20is\x20enabled!');_0x250893[_0xcaea('0x4c')]=_0x3c53fa;}else if(_0x15465b&&_0x15465b[_0xcaea('0x4d')]&&_0x15465b[_0xcaea('0x4d')]!=='none'){logger[_0xcaea('0x11')](_0xcaea('0x4e'),_0xcaea('0x4f'));_0x250893['recordingURL']=_0x3c53fa;}else{_0x250893[_0xcaea('0x4c')]='';}return getAdminId(_0x496b9e,_0x46a38d,_0x296252,_0xac8531)[_0xcaea('0x1b')](getUser(_0x46a38d,_0x296252,_0xac8531))[_0xcaea('0x1b')](getEndUser(_0x46a38d,_0x296252,_0xac8531))[_0xcaea('0x1b')](getTicket(_0x46a38d,_0x296252,_0xac8531,_0x5c790a,_0x250893))[_0xcaea('0x1b')](function(_0x2c3abb){logger['info'](util['format'](_0xcaea('0x50'),_0x2c3abb[_0xcaea('0x37')]));if(_0x46a38d!==_0xcaea('0x51')){logger[_0xcaea('0x11')]('['+[_0x46a38d['toUpperCase']()]+']',_0xcaea('0x52'));emit(_0xac8531,_0x574bfb[_0xcaea('0x53')],_0x2c3abb[_0xcaea('0x28')]);}})[_0xcaea('0x18')](function(_0x4623ec){logger[_0xcaea('0x22')]('['+[_0x46a38d[_0xcaea('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xcaea('0x54')](_0x4623ec,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x04e2=['socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','users','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','Admin\x20selected','message','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','remoteUri','stripTrailingSlash','serverUrl','outbound','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','ioredis','./util','../../../../config/environment','redis'];(function(_0x13e2ec,_0xb2c5e9){var _0x228246=function(_0x378759){while(--_0x378759){_0x13e2ec['push'](_0x13e2ec['shift']());}};_0x228246(++_0xb2c5e9);}(_0x04e2,0x90));var _0x204e=function(_0x49b0d2,_0xc9b86b){_0x49b0d2=_0x49b0d2-0x0;var _0x1caa07=_0x04e2[_0x49b0d2];return _0x1caa07;};'use strict';var _=require(_0x204e('0x0'));var rp=require(_0x204e('0x1'));var md5=require('md5');var util=require(_0x204e('0x2'));var moment=require(_0x204e('0x3'));var Promise=require('bluebird');var Redis=require(_0x204e('0x4'));var intUtil=require(_0x204e('0x5'));var config=require(_0x204e('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x204e('0x7')]=_['defaults'](config[_0x204e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x204e('0x8'))(new Redis(config[_0x204e('0x7')]));function getAdminId(_0x3e8c73,_0x2bcfd4,_0x5f1072,_0x173294){return new Promise(function(_0x490ecb,_0x22b7ff){var _0x1fa219=![];var _0x273e8c={'method':_0x204e('0x9'),'uri':_0x173294+_0x204e('0xa'),'json':!![]};_0x273e8c['headers']=_0x5f1072;logger[_0x204e('0xb')](_0x204e('0xc'));return rp(_0x273e8c)[_0x204e('0xd')](function(_0x1534f7){if(_0x1534f7){var _0x421f4c=_0x1534f7['users'];var _0x38fa7b=null;for(_0x38fa7b=0x0;_0x38fa7b<_0x421f4c[_0x204e('0xe')];_0x38fa7b++){if(_0x421f4c[_0x38fa7b][_0x204e('0xf')]===_0x3e8c73[_0x204e('0x10')]){_0x3e8c73[_0x204e('0x11')]=_0x421f4c[_0x38fa7b]['id'];_0x1fa219=!![];}}if(_0x1fa219){logger['info'](_0x204e('0x12'),_0x3e8c73['adminId']);_0x490ecb(_0x3e8c73);}else{_0x22b7ff({'statusCode':0x194,'message':_0x204e('0x13')});}}else{_0x22b7ff({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x204e('0x14')](function(_0x493a6){logger[_0x204e('0x15')]('['+[_0x2bcfd4[_0x204e('0x16')]()]+']',_0x493a6['message']);_0x22b7ff(_0x493a6);});});}function getUser(_0x1621d1,_0x3cdd27,_0x5af11e){return function(_0x120433){return new Promise(function(_0x1c4034,_0x362438){var _0x586373={'method':'GET','uri':_0x5af11e+_0x204e('0xa'),'json':!![]};_0x586373['headers']=_0x3cdd27;logger['info']('Getting\x20user\x20list');return rp(_0x586373)[_0x204e('0xd')](function(_0x1c84db){if(_0x1c84db){var _0x80ea9c=_0x1c84db[_0x204e('0x17')];var _0x257a1c=![];var _0x2fce82=null;if(_0x120433['agentEmail']!==null){logger['info'](_0x204e('0x18'),_0x120433[_0x204e('0x19')]);_0x120433['userEmail']=_0x120433[_0x204e('0x19')];for(_0x2fce82=0x0;_0x2fce82<_0x80ea9c[_0x204e('0xe')];_0x2fce82++){if(_0x80ea9c[_0x2fce82]['email']===_0x120433[_0x204e('0x19')]){_0x257a1c=!![];_0x120433[_0x204e('0x1a')]=_0x80ea9c[_0x2fce82]['id'];logger[_0x204e('0xb')](_0x204e('0x1b'),_0x120433['userId']);}}}if(!_0x257a1c){logger[_0x204e('0xb')](_0x204e('0x1c'));_0x120433['userEmail']=_0x120433['adminEmail'];_0x120433[_0x204e('0x1a')]=_0x120433[_0x204e('0x11')];_0x257a1c=!![];}if(_0x257a1c){_0x1c4034(_0x120433);}else{_0x362438({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x362438({'statusCode':0x194,'message':_0x204e('0x13')});}})[_0x204e('0x14')](function(_0x2abcdc){logger['error']('['+[_0x1621d1[_0x204e('0x16')]()]+']',_0x2abcdc[_0x204e('0x1d')]);_0x362438(_0x2abcdc);});});};}function searchContact(_0x52ecb6,_0x1eb86d,_0x2ebbf2,_0x1686af){return new Promise(function(_0x3e10c4,_0x4cef2c){var _0x4147bf={'method':_0x204e('0x9'),'headers':_0x1eb86d,'uri':_0x52ecb6+_0x204e('0x1e')+_0x1686af+'&f='+_0x2ebbf2+_0x204e('0x1f'),'json':!![]};rp(_0x4147bf)[_0x204e('0xd')](function(_0x569cd7){var _0x1a7a67=_[_0x204e('0x20')](_0x569cd7[_0x204e('0x21')][_0x204e('0x21')],[_0x2ebbf2,_0x1686af]);_0x3e10c4(_0x1a7a67);})[_0x204e('0x14')](function(_0xd2fe29){_0x4cef2c(_0xd2fe29);});});}function getEndUser(_0x52ea2b,_0x13a31c,_0x170e69){return function(_0x35820d){return new Promise(function(_0x58c34b,_0x5a6af6){logger[_0x204e('0xb')](util[_0x204e('0x22')](_0x204e('0x23'),_0x35820d[_0x204e('0x24')]));searchContact(_0x170e69,_0x13a31c,_0x204e('0x25'),_0x35820d[_0x204e('0x24')])[_0x204e('0xd')](function(_0x22e597){if(_0x22e597){_0x35820d['endUserId']=_0x22e597['id'];logger[_0x204e('0xb')](_0x204e('0x26'),_0x35820d['endUserId']);return _0x58c34b(_0x35820d);}searchContact(_0x170e69,_0x13a31c,'work_number',_0x35820d[_0x204e('0x24')])['then'](function(_0x461b95){if(_0x461b95){_0x35820d[_0x204e('0x27')]=_0x461b95['id'];logger[_0x204e('0xb')](_0x204e('0x28'),_0x35820d['endUserId']);return _0x58c34b(_0x35820d);}createEndUser(_0x35820d,_0x52ea2b,_0x13a31c,_0x170e69)[_0x204e('0xd')](function(_0x338448){logger[_0x204e('0xb')](_0x204e('0x29'),_0x338448[_0x204e('0x27')]);return _0x58c34b(_0x338448);});});})['catch'](function(_0x1b4ee9){_0x5a6af6(_0x1b4ee9);});});};}function createEndUser(_0x5c0ef3,_0x226c9b,_0x3b3d9c,_0x14312a){return new Promise(function(_0x158c5e,_0x340242){var _0xbc1c46=moment();var _0x558adc={'method':_0x204e('0x2a'),'uri':_0x14312a+_0x204e('0x2b'),'body':{'contact':{'last_name':_0x5c0ef3[_0x204e('0x24')],'work_number':_0x5c0ef3[_0x204e('0x24')],'mobile_number':_0x5c0ef3['contactNumber'],'owner_id':_0x5c0ef3[_0x204e('0x1a')],'created_at':_0xbc1c46['format'](_0x204e('0x2c'))}},'json':!![]};_0x558adc[_0x204e('0x2d')]=_0x3b3d9c;logger[_0x204e('0xb')](_0x204e('0x2e'));return rp(_0x558adc)[_0x204e('0xd')](function(_0x1e69a4){_0x5c0ef3[_0x204e('0x27')]=_0x1e69a4[_0x204e('0x2f')]['id'];_0x158c5e(_0x5c0ef3);})[_0x204e('0x14')](function(_0x1c0453){logger[_0x204e('0x15')]('['+[_0x226c9b[_0x204e('0x16')]()]+']',_0x1c0453[_0x204e('0x1d')]);_0x340242(_0x1c0453[_0x204e('0x1d')]);});});}function getTicket(_0x4c2f72,_0x4d95c2,_0x58d0be,_0x5c32cc,_0x47594c){return function(_0x5d2863){logger[_0x204e('0xb')](_0x204e('0x30'));return new Promise(function(_0x322560,_0x536c04){var _0x3992a2=moment();var _0x30817f={'method':_0x204e('0x2a'),'uri':_0x58d0be+'/api/tasks','body':{'title':intUtil[_0x204e('0x31')](_0x5c32cc[_0x204e('0x32')],_0x47594c,'\x20'),'description':intUtil['getString'](_0x5c32cc[_0x204e('0x33')],_0x47594c,'\x0a'),'owner_id':_0x5d2863[_0x204e('0x1a')],'creater_id':_0x5d2863[_0x204e('0x11')],'targetable_id':_0x5d2863['endUserId'],'targetable_type':'Contact','created_at':_0x3992a2[_0x204e('0x22')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x3992a2[_0x204e('0x34')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x30817f[_0x204e('0x2d')]=_0x4d95c2;return rp(_0x30817f)[_0x204e('0xd')](function(_0x2249ce){_0x5d2863[_0x204e('0x35')]=_0x2249ce[_0x204e('0x36')]['id'];logger[_0x204e('0xb')](_0x204e('0x37'),_0x5d2863['ticketId']);_0x322560(_0x5d2863);})[_0x204e('0x14')](function(_0x532f12){logger[_0x204e('0x15')]('['+[_0x4c2f72[_0x204e('0x16')]()]+']',_0x532f12[_0x204e('0x1d')]);_0x536c04(_0x532f12['message']);});});};}function emit(_0x5ab3a2,_0x415b13,_0x6c350e){var _0x37948c={'uri':_0x5ab3a2+_0x204e('0x38')+_0x6c350e};io['to'](util[_0x204e('0x22')](_0x204e('0x39'),_0x415b13))[_0x204e('0x3a')]('trigger:browser:url',_0x37948c);}exports['cs']=function(_0x4389aa,_0xb4a7ff,_0x215042,_0x38150a,_0x197546,_0x33517b,_0x336c90,_0x3c1785){var _0xbb53ec={};var _0x49820f={'Authorization':'Token\x20token='+_0x33517b['apiKey']};_0x33517b[_0x204e('0x3b')]=intUtil[_0x204e('0x3c')](_0x33517b[_0x204e('0x3b')]);_0x33517b[_0x204e('0x3d')]=intUtil['stripTrailingSlash'](_0x33517b[_0x204e('0x3d')]);var _0x3f623b=_0x33517b[_0x204e('0x3b')];_0xbb53ec[_0x204e('0x10')]=_0x33517b['username'];_0xbb53ec[_0x204e('0x24')]=_0x3c1785['toLowerCase']()===_0x204e('0x3e')?_0xb4a7ff['destcalleridnum']:_0xb4a7ff[_0x204e('0x3f')];_0xbb53ec['callDirection']=_0x3c1785==='queue'||_0x3c1785===_0x204e('0x40')?_0x204e('0x41'):_0x204e('0x3e');if(_0x38150a){_0xbb53ec[_0x204e('0x19')]=_0x38150a[_0x204e('0xf')];}var _0x5987aa=util['format'](_0x204e('0x42'),_0x33517b['serverUrl'],_0xb4a7ff[_0x204e('0x43')],md5(_0xb4a7ff['uniqueid']));if(_0x197546&&_0x197546['monitor_format']){logger[_0x204e('0xb')]('[QUEUE]',_0x204e('0x44'));_0xb4a7ff['recordingURL']=_0x5987aa;}else if(_0x336c90&&_0x336c90[_0x204e('0x45')]&&_0x336c90['recordingFormat']!==_0x204e('0x46')){logger['info'](_0x204e('0x47'),'Recording\x20is\x20enabled!');_0xb4a7ff[_0x204e('0x48')]=_0x5987aa;}else{_0xb4a7ff[_0x204e('0x48')]='';}return getAdminId(_0xbb53ec,_0x3c1785,_0x49820f,_0x3f623b)[_0x204e('0xd')](getUser(_0x3c1785,_0x49820f,_0x3f623b))[_0x204e('0xd')](getEndUser(_0x3c1785,_0x49820f,_0x3f623b))[_0x204e('0xd')](getTicket(_0x3c1785,_0x49820f,_0x3f623b,_0x215042,_0xb4a7ff))[_0x204e('0xd')](function(_0x3d63a5){logger[_0x204e('0xb')](util[_0x204e('0x22')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3d63a5[_0x204e('0x35')]));if(_0x3c1785!==_0x204e('0x40')){logger[_0x204e('0xb')]('['+[_0x3c1785[_0x204e('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3f623b,_0x38150a[_0x204e('0x49')],_0x3d63a5[_0x204e('0x27')]);}})[_0x204e('0x14')](function(_0x3c2b2e){logger[_0x204e('0x15')]('['+[_0x3c1785['toUpperCase']()]+_0x204e('0x4a'),util[_0x204e('0x4b')](_0x3c2b2e,{'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 0fc66b6..36f1cbf 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 _0xe059=['../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./servicenow','./dynamics365','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','unmanaged','zendesk','sugarcrm','desk'];(function(_0x59bed6,_0x231a63){var _0x440e11=function(_0x19d3ef){while(--_0x19d3ef){_0x59bed6['push'](_0x59bed6['shift']());}};_0x440e11(++_0x231a63);}(_0xe059,0x15a));var _0x9e05=function(_0x163628,_0x55a1f8){_0x163628=_0x163628-0x0;var _0xbfa4a1=_0xe059[_0x163628];return _0xbfa4a1;};'use strict';var _=require(_0x9e05('0x0'));var util=require(_0x9e05('0x1'));var zendesk=require(_0x9e05('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x9e05('0x3'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x9e05('0x4'));var dynamics365=require(_0x9e05('0x5'));var freshsales=require('./freshsales');var integrations=['zendesk','salesforce','sugarcrm',_0x9e05('0x6'),_0x9e05('0x7'),'desk',_0x9e05('0x8'),_0x9e05('0x9'),_0x9e05('0xa'),_0x9e05('0xb')];exports[_0x9e05('0xc')]=function(_0x256d72,_0x2b7c5b,_0x4e5530,_0x1aec09,_0x45bed5,_0x81edd5){if(_0x4e5530){if(_['includes'](integrations,_0x256d72[_0x9e05('0xd')][_0x9e05('0xe')]())){try{var _0x27dfdb=null;var _0x2f63c9='';var _0x176a78=_0x4e5530[_0x256d72[_0x9e05('0xd')][_0x9e05('0xe')]()];if(_0x176a78){var _0x2d1d36=_0x176a78[_0x256d72[_0x9e05('0xf')]];if(_0x2d1d36){var _0x345497=_[_0x9e05('0x10')](_0x2d1d36[_0x9e05('0x11')],{'id':parseInt(_0x256d72['data3'],0xa)});if(_0x345497){if(_0x1aec09){if(_0x45bed5&&_0x2b7c5b[_0x9e05('0x12')]){_0x2f63c9='queue';}else if(_0x2b7c5b[_0x9e05('0x13')]){_0x2f63c9=_0x9e05('0x14');}else{console[_0x9e05('0x15')]('EVENT\x20UNKNOWN',_0x2b7c5b);}}else{_0x2f63c9=_0x9e05('0x16');}switch(_0x256d72['data1'][_0x9e05('0xe')]()){case _0x9e05('0x17'):zendesk[_0x2f63c9](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5);break;case'salesforce':salesforce[_0x2f63c9](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5);break;case _0x9e05('0x18'):sugarcrm[_0x2f63c9](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5);break;case _0x9e05('0x6'):freshdesk[_0x2f63c9](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5);break;case _0x9e05('0x7'):zoho[_0x2f63c9](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5);break;case _0x9e05('0x19'):desk[_0x2f63c9](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5);break;case _0x9e05('0x8'):vtiger[_0x2f63c9](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5);break;case _0x9e05('0xa'):freshsales['cs'](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5,_0x2f63c9);break;case _0x9e05('0xb'):servicenow['cs'](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5,_0x2f63c9);break;case _0x9e05('0x9'):dynamics365['cs'](_0x256d72,_0x2b7c5b,_0x345497,_0x1aec09,_0x45bed5,_0x2d1d36,_0x81edd5,_0x2f63c9);break;default:console[_0x9e05('0x15')]('unknown\x20integration');}}else{_0x27dfdb=require(_0x9e05('0x1a'))(_0x256d72[_0x9e05('0xd')]['toLowerCase']());_0x27dfdb[_0x9e05('0x1b')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x256d72['data1'][_0x9e05('0xe')](),_0x256d72['data3']));}}else{_0x27dfdb=require('../../../../config/logger')(_0x256d72[_0x9e05('0xd')][_0x9e05('0xe')]());_0x27dfdb['error'](_0x9e05('0x1c'),util[_0x9e05('0x1d')](_0x9e05('0x1e'),_0x256d72[_0x9e05('0xd')][_0x9e05('0xe')](),_0x256d72[_0x9e05('0xf')]));}}else{}}catch(_0x3da11f){console['error'](_0x3da11f);}}}}; \ No newline at end of file +var _0xd8c6=['error','lodash','./sugarcrm','./freshdesk','./desk','./vtiger','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','data1','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found'];(function(_0x55902a,_0x46088c){var _0x58ca00=function(_0x140b00){while(--_0x140b00){_0x55902a['push'](_0x55902a['shift']());}};_0x58ca00(++_0x46088c);}(_0xd8c6,0xb0));var _0x6d8c=function(_0x4e0eb6,_0x240784){_0x4e0eb6=_0x4e0eb6-0x0;var _0x46e432=_0xd8c6[_0x4e0eb6];return _0x46e432;};'use strict';var _=require(_0x6d8c('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x6d8c('0x1'));var freshdesk=require(_0x6d8c('0x2'));var zoho=require('./zoho');var desk=require(_0x6d8c('0x3'));var vtiger=require(_0x6d8c('0x4'));var servicenow=require('./servicenow');var dynamics365=require(_0x6d8c('0x5'));var freshsales=require('./freshsales');var integrations=[_0x6d8c('0x6'),_0x6d8c('0x7'),_0x6d8c('0x8'),_0x6d8c('0x9'),_0x6d8c('0xa'),_0x6d8c('0xb'),_0x6d8c('0xc'),_0x6d8c('0xd'),_0x6d8c('0xe'),_0x6d8c('0xf')];exports[_0x6d8c('0x10')]=function(_0x24f800,_0x3c7251,_0x24c72f,_0x357eaa,_0x35e630,_0x171584){if(_0x24c72f){if(_[_0x6d8c('0x11')](integrations,_0x24f800['data1'][_0x6d8c('0x12')]())){try{var _0x3d6fb8=null;var _0x461093='';var _0x2a28e1=_0x24c72f[_0x24f800['data1'][_0x6d8c('0x12')]()];if(_0x2a28e1){var _0x430775=_0x2a28e1[_0x24f800[_0x6d8c('0x13')]];if(_0x430775){var _0x3c136b=_[_0x6d8c('0x14')](_0x430775[_0x6d8c('0x15')],{'id':parseInt(_0x24f800[_0x6d8c('0x16')],0xa)});if(_0x3c136b){if(_0x357eaa){if(_0x35e630&&_0x3c7251[_0x6d8c('0x17')]){_0x461093='queue';}else if(_0x3c7251[_0x6d8c('0x18')]){_0x461093=_0x6d8c('0x19');}else{console[_0x6d8c('0x1a')](_0x6d8c('0x1b'),_0x3c7251);}}else{_0x461093='unmanaged';}switch(_0x24f800[_0x6d8c('0x1c')][_0x6d8c('0x12')]()){case'zendesk':zendesk[_0x461093](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584);break;case _0x6d8c('0x7'):salesforce[_0x461093](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584);break;case _0x6d8c('0x8'):sugarcrm[_0x461093](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584);break;case _0x6d8c('0x9'):freshdesk[_0x461093](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584);break;case _0x6d8c('0xa'):zoho[_0x461093](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584);break;case _0x6d8c('0xb'):desk[_0x461093](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584);break;case _0x6d8c('0xc'):vtiger[_0x461093](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584);break;case _0x6d8c('0xe'):freshsales['cs'](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584,_0x461093);break;case _0x6d8c('0xf'):servicenow['cs'](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584,_0x461093);break;case _0x6d8c('0xd'):dynamics365['cs'](_0x24f800,_0x3c7251,_0x3c136b,_0x357eaa,_0x35e630,_0x430775,_0x171584,_0x461093);break;default:console[_0x6d8c('0x1a')](_0x6d8c('0x1d'));}}else{_0x3d6fb8=require(_0x6d8c('0x1e'))(_0x24f800[_0x6d8c('0x1c')]['toLowerCase']());_0x3d6fb8['error'](_0x6d8c('0x1f'),util[_0x6d8c('0x20')](_0x6d8c('0x21'),_0x24f800['data1'][_0x6d8c('0x12')](),_0x24f800[_0x6d8c('0x16')]));}}else{_0x3d6fb8=require(_0x6d8c('0x1e'))(_0x24f800['data1']['toLowerCase']());_0x3d6fb8[_0x6d8c('0x22')]('[EXEC]',util[_0x6d8c('0x20')]('%s\x20account\x20#%s\x20not\x20found',_0x24f800['data1'][_0x6d8c('0x12')](),_0x24f800[_0x6d8c('0x13')]));}}else{}}catch(_0xa7099b){console[_0x6d8c('0x22')](_0xa7099b);}}}}; \ 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 7d5c84d..3a977ff 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 _0xc161=['length','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','upperFirst','includes','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','assign','getString','Subjects','Task','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','ticketType','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xc161,0x14b));var _0x1c16=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0xc161[_0x5f382f];return _0x3bb11b;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x1c16('0x0'));var BPromise=require(_0x1c16('0x1'));var md5=require('md5');var jsforce=require(_0x1c16('0x2'));var util=require(_0x1c16('0x3'));var Redis=require('ioredis');var intUtil=require(_0x1c16('0x4'));var config=require(_0x1c16('0x5'));var logger=require(_0x1c16('0x6'))('salesforce');config[_0x1c16('0x7')]=_[_0x1c16('0x8')](config[_0x1c16('0x7')],{'host':_0x1c16('0x9'),'port':0x18eb});var io=require(_0x1c16('0xa'))(new Redis(config[_0x1c16('0x7')]));function emit(_0x9787cc,_0x4e4a60,_0xe48bca){io['to'](_0x9787cc)['emit'](_0x4e4a60,_0xe48bca);}function getTicket(_0x3f9d2b,_0x53c611,_0x355b2f,_0x4773b9,_0x5494d8,_0x57abc6,_0x377f62,_0x57c4ca){var _0x3898c9=Object[_0x1c16('0xb')]({},{'OwnerId':_0x53c611['id'],'Subject':intUtil[_0x1c16('0xc')](_0x4773b9[_0x1c16('0xd')],_0x5494d8,'\x20'),'Description':intUtil[_0x1c16('0xc')](_0x4773b9['Descriptions'],_0x5494d8,'\x0a')},getCustomFields(_0x57abc6,_0x5494d8));if(_0x355b2f){if(_0x4773b9['ticketType']===_0x1c16('0xe')){_0x3898c9['ActivityDate']=moment[_0x1c16('0xf')]();_0x3898c9['IsReminderSet']=![];_0x3898c9[_0x1c16('0x10')]=![];if(_0x355b2f[_0x1c16('0x11')]===_0x1c16('0x12')||_0x355b2f[_0x1c16('0x11')]===_0x1c16('0x13')){_0x3898c9[_0x1c16('0x14')]=_0x355b2f['id'];}else if(_0x355b2f[_0x1c16('0x11')]===_0x1c16('0x15')){_0x3898c9['WhatId']=_0x355b2f['id'];}}else if(_0x4773b9[_0x1c16('0x16')]===_0x1c16('0x17')){if(_0x355b2f[_0x1c16('0x11')]===_0x1c16('0x12')){_0x3898c9[_0x1c16('0x18')]=_0x355b2f['id'];}else if(_0x355b2f[_0x1c16('0x11')]===_0x1c16('0x15')){_0x3898c9[_0x1c16('0x19')]=_0x355b2f['id'];}else if(_0x355b2f[_0x1c16('0x11')]===_0x1c16('0x13')&&_0x4773b9['leadId']){_0x3898c9[_0x4773b9[_0x1c16('0x1a')]]=_0x355b2f['id'];}else{logger['info'](_0x1c16('0x1b'));}}}return _0x377f62[_0x1c16('0x1c')](_0x4773b9[_0x1c16('0x16')])[_0x1c16('0x1d')](_0x3898c9);}function getUser(_0x2df292,_0x107aad,_0x5c3e7e){if(!_[_0x1c16('0x1e')](_0x107aad)&&intUtil[_0x1c16('0x1f')](_0x107aad)){var _0x36401f={'Email':_0x107aad};var _0x18c9f5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5c3e7e[_0x1c16('0x1c')]('User')[_0x1c16('0x20')](_0x36401f,_0x18c9f5)[_0x1c16('0x21')]()[_0x1c16('0x22')](function(_0x222bfa){if(_0x222bfa[_0x1c16('0x23')]){var _0x256b43=_[_0x1c16('0x20')](_0x222bfa,function(_0x135585){return _0x135585['Email']===_0x107aad;});if(_0x256b43){logger[_0x1c16('0x24')]('Agent\x20%s\x20found.',_0x107aad);return BPromise[_0x1c16('0x25')]({'id':_0x256b43['Id'],'name':_0x256b43[_0x1c16('0x26')]});}}else{logger['info'](_0x1c16('0x27'),_0x107aad);return _0x5c3e7e[_0x1c16('0x28')]()[_0x1c16('0x22')](function(_0x2e1dc0){return BPromise['resolve']({'id':_0x2e1dc0[_0x1c16('0x29')],'name':_0x2e1dc0['display_name']});});}});}else{logger[_0x1c16('0x24')](_0x1c16('0x27'),_0x107aad);return _0x5c3e7e[_0x1c16('0x28')]()[_0x1c16('0x22')](function(_0x29698a){return BPromise['resolve']({'id':_0x29698a[_0x1c16('0x29')],'name':_0x29698a[_0x1c16('0x2a')]});});}}function getEndUser(_0x55eb13,_0x44df80,_0x251096,_0x29a890,_0x42412e){var _0x4d0c74={'$or':{'Phone':_0x29a890}};var _0x4f46b4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1c16('0x25')]()['then'](function(){logger['info'](_0x1c16('0x2b'),_0x29a890,_0x44df80['moduleSearch']);switch(_0x44df80[_0x1c16('0x2c')]){case _0x1c16('0x2d'):var _0x22303d=_[_0x1c16('0x2e')](_0x4d0c74);if(_0x44df80[_0x1c16('0x2f')]){var _0x5d5aa2={};_0x5d5aa2[_0x44df80[_0x1c16('0x2f')]]=_0x29a890;_[_0x1c16('0x30')](_0x22303d[_0x1c16('0x31')],_0x5d5aa2);}return _0x42412e[_0x1c16('0x1c')](_0x1c16('0x32'))[_0x1c16('0x20')](_0x22303d,_0x4f46b4)[_0x1c16('0x21')]()[_0x1c16('0x22')](function(_0x652db0){if(_0x652db0&&_0x652db0[_0x1c16('0x23')]){return _0x652db0;}else{var _0x460968=_['cloneDeep'](_0x4d0c74);if(_0x44df80[_0x1c16('0x33')]){var _0x36f052={};_0x36f052[_0x44df80['additionalSearchLead']]=_0x29a890;_['merge'](_0x460968[_0x1c16('0x31')],_0x36f052);}return _0x42412e[_0x1c16('0x1c')](_0x1c16('0x34'))[_0x1c16('0x20')](_0x460968,_0x4f46b4);}});case _0x1c16('0x35'):var _0x54ebf5=_[_0x1c16('0x2e')](_0x4d0c74);if(_0x44df80[_0x1c16('0x36')]){var _0x5d5aa2={};_0x5d5aa2[_0x44df80[_0x1c16('0x36')]]=_0x29a890;_[_0x1c16('0x30')](_0x54ebf5[_0x1c16('0x31')],_0x5d5aa2);}return _0x42412e[_0x1c16('0x1c')]('Account')['find'](_0x54ebf5,_0x4f46b4)['execute']()[_0x1c16('0x22')](function(_0x1ceed1){if(_0x1ceed1&&_0x1ceed1['length']){return _0x1ceed1;}else{var _0x272ab9=_[_0x1c16('0x2e')](_0x4d0c74);if(_0x44df80['additionalSearchContact']){var _0x145b3f={};_0x145b3f[_0x44df80[_0x1c16('0x2f')]]=_0x29a890;_['merge'](_0x272ab9[_0x1c16('0x31')],_0x145b3f);}return _0x42412e[_0x1c16('0x1c')](_0x1c16('0x32'))[_0x1c16('0x20')](_0x272ab9,_0x4f46b4)[_0x1c16('0x22')](function(_0x24831a){if(_0x24831a&&_0x24831a[_0x1c16('0x23')]){return _0x24831a;}else{var _0x5c18f3=_[_0x1c16('0x2e')](_0x4d0c74);if(_0x44df80[_0x1c16('0x33')]){var _0x3ea69b={};_0x3ea69b[_0x44df80[_0x1c16('0x33')]]=_0x29a890;_[_0x1c16('0x30')](_0x5c18f3[_0x1c16('0x31')],_0x3ea69b);}return _0x42412e[_0x1c16('0x1c')](_0x1c16('0x34'))[_0x1c16('0x20')](_0x5c18f3,_0x4f46b4);}});}});case _0x1c16('0x12'):var _0x22303d=_['cloneDeep'](_0x4d0c74);if(_0x44df80[_0x1c16('0x2f')]){var _0x5d5aa2={};_0x5d5aa2[_0x44df80['additionalSearchContact']]=_0x29a890;_['merge'](_0x22303d[_0x1c16('0x31')],_0x5d5aa2);}return _0x42412e['sobject'](_0x1c16('0x32'))[_0x1c16('0x20')](_0x22303d,_0x4f46b4)[_0x1c16('0x21')]();case _0x1c16('0x13'):var _0x393285=_[_0x1c16('0x2e')](_0x4d0c74);if(_0x44df80['additionalSearchLead']){var _0x5d5aa2={};_0x5d5aa2[_0x44df80['additionalSearchLead']]=_0x29a890;_[_0x1c16('0x30')](_0x393285[_0x1c16('0x31')],_0x5d5aa2);}return _0x42412e[_0x1c16('0x1c')]('Lead')[_0x1c16('0x20')](_0x393285,_0x4f46b4);case _0x1c16('0x15'):var _0x54ebf5=_['cloneDeep'](_0x4d0c74);if(_0x44df80['additionalSearchAccount']){var _0x5d5aa2={};_0x5d5aa2[_0x44df80[_0x1c16('0x36')]]=_0x29a890;_[_0x1c16('0x30')](_0x54ebf5[_0x1c16('0x31')],_0x5d5aa2);}return _0x42412e[_0x1c16('0x1c')](_0x1c16('0x37'))[_0x1c16('0x20')](_0x54ebf5,_0x4f46b4);default:return null;}})[_0x1c16('0x22')](function(_0x100efb){if(_0x100efb&&_0x100efb[_0x1c16('0x23')]){var _0x456799=_['first'](_0x100efb);if(_0x456799){return BPromise[_0x1c16('0x25')]({'id':_0x456799['Id'],'name':_0x456799['Name'],'phone':_0x456799[_0x1c16('0x38')],'endUserType':_0x456799[_0x1c16('0x39')][_0x1c16('0x3a')][_0x1c16('0x3b')]()});}}})[_0x1c16('0x22')](function(_0x449ab7){if(_0x449ab7){logger['info'](_0x1c16('0x3c'),_0x449ab7['endUserType'],_0x29a890);return BPromise[_0x1c16('0x25')](_0x449ab7);}else{logger[_0x1c16('0x24')](_0x1c16('0x3d'),_0x29a890);var _0x2f14b6={'Phone':_0x29a890};if(_0x44df80[_0x1c16('0x3e')]){if(_0x44df80[_0x1c16('0x3e')]===_0x1c16('0x12')){logger[_0x1c16('0x24')](_0x1c16('0x3f'),_0x29a890,_0x44df80[_0x1c16('0x3e')]);_0x2f14b6[_0x1c16('0x40')]=_0x251096!==_0x1c16('0x41')?_0x251096:util[_0x1c16('0x42')](_0x1c16('0x43'),_0x29a890);}else if(_0x44df80[_0x1c16('0x3e')]==='lead'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x29a890,_0x44df80['moduleCreate']);_0x2f14b6['LastName']=_0x251096!==_0x1c16('0x41')?_0x251096:util[_0x1c16('0x42')](_0x1c16('0x43'),_0x29a890);_0x2f14b6['Company']='No\x20Company';}else if(_0x44df80[_0x1c16('0x3e')]==='account'){logger['info'](_0x1c16('0x3f'),_0x29a890,_0x44df80[_0x1c16('0x3e')]);_0x2f14b6[_0x1c16('0x26')]=_0x251096!==_0x1c16('0x41')?_0x251096:util[_0x1c16('0x42')]('Caller\x20-\x20%s',_0x29a890);}else{return null;}}return _0x42412e[_0x1c16('0x1c')](_[_0x1c16('0x44')](_0x44df80[_0x1c16('0x3e')]))[_0x1c16('0x1d')](_0x2f14b6)['then'](function(_0x51dc1f){return BPromise[_0x1c16('0x25')]({'id':_0x51dc1f['id'],'endUserType':_0x44df80[_0x1c16('0x3e')]});});}});}function getCustomFields(_0x2bbd83,_0xa16d5a){var _0x45c8ed={};if(_0x2bbd83['length']>0x0){_['forEach'](_0x2bbd83,function(_0x47337c){if(_[_0x1c16('0x45')](['string',_0x1c16('0x46')],_0x47337c[_0x1c16('0x3a')])&&_0x47337c[_0x1c16('0x47')]){_0x45c8ed[_0x47337c[_0x1c16('0x47')]]=_0x47337c[_0x1c16('0x48')][_0x1c16('0x49')]();}else if(_0x47337c[_0x1c16('0x3a')]===_0x1c16('0x4a')&&_0x47337c[_0x1c16('0x4b')]&&_0x47337c[_0x1c16('0x47')]){_0xa16d5a[_0x47337c['variableName']]&&(_0x45c8ed[_0x47337c[_0x1c16('0x47')]]=_0xa16d5a[_0x47337c[_0x1c16('0x4b')]][_0x1c16('0x49')]());}else if(_0x47337c['type']===_0x1c16('0x4c')&&_0x47337c['Variable']&&_0x47337c[_0x1c16('0x4d')][_0x1c16('0x4e')]&&_0x47337c[_0x1c16('0x47')]){_0xa16d5a[_0x47337c[_0x1c16('0x4d')][_0x1c16('0x4e')][_0x1c16('0x3b')]()]&&(_0x45c8ed[_0x47337c['idField']]=_0xa16d5a[_0x47337c[_0x1c16('0x4d')][_0x1c16('0x4e')][_0x1c16('0x3b')]()][_0x1c16('0x49')]());}});}return _0x45c8ed;}function getConnection(_0x534445){var _0x1c2d47=_0x534445[_0x1c16('0x4f')]['concat'](_0x534445[_0x1c16('0x50')]);var _0x86bc9c=new jsforce[(_0x1c16('0x51'))]({'oauth2':{'loginUrl':_0x534445['remoteUri']||_0x1c16('0x52'),'clientId':_0x534445[_0x1c16('0x53')],'clientSecret':_0x534445[_0x1c16('0x54')]}});return _0x86bc9c['login'](_0x534445['username'],_0x1c2d47)['then'](function(){logger[_0x1c16('0x24')](_0x1c16('0x55'));return _0x86bc9c;});}exports[_0x1c16('0x56')]=function(_0x1e257c,_0x4d0a0b,_0x25bc47,_0x2c59b1,_0x5aed08,_0x446e5f){var _0x1e2d12,_0x49f517,_0x468931,_0x5c3916;_0x446e5f[_0x1c16('0x57')]=intUtil[_0x1c16('0x58')](_0x446e5f[_0x1c16('0x57')]);_0x446e5f['remoteUri']=intUtil['stripTrailingSlash'](_0x446e5f[_0x1c16('0x59')]);if(_0x5aed08&&_0x5aed08[_0x1c16('0x5a')]){logger['info'](_0x1c16('0x5b'),_0x1c16('0x5c'));_0x4d0a0b[_0x1c16('0x5d')]=util['format'](_0x1c16('0x5e'),_0x446e5f[_0x1c16('0x57')],_0x4d0a0b[_0x1c16('0x5f')],md5(_0x4d0a0b[_0x1c16('0x5f')]));}else{_0x4d0a0b[_0x1c16('0x5d')]='';}return getConnection(_0x446e5f)['then'](function(_0x31e76f){_0x5c3916=_0x31e76f;return getUser(_0x446e5f,_0x2c59b1[_0x1c16('0x60')],_0x5c3916);})['then'](function(_0x353481){_0x1e2d12=_0x353481;return getEndUser(_0x446e5f,_0x25bc47,_0x4d0a0b[_0x1c16('0x61')],_0x4d0a0b[_0x1c16('0x62')],_0x5c3916);})['then'](function(_0x13e87a){_0x49f517=_0x13e87a;return getTicket(_0x446e5f,_0x1e2d12,_0x49f517,_0x25bc47,_0x4d0a0b,_0x25bc47[_0x1c16('0x63')],_0x5c3916,_0x1c16('0x56'));})[_0x1c16('0x22')](function(_0x46f9c7){_0x468931=_0x46f9c7;logger[_0x1c16('0x24')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x468931['id']);logger[_0x1c16('0x24')](_0x1c16('0x64'),_0x468931['id'],_0x2c59b1[_0x1c16('0x4e')],_0x446e5f[_0x1c16('0x3a')]);switch(_0x446e5f[_0x1c16('0x3a')]){case _0x1c16('0x65'):emit(util['format'](_0x1c16('0x66'),_0x2c59b1[_0x1c16('0x4e')]),_0x1c16('0x67'),{'recordId':_0x468931['id']});break;case _0x1c16('0x68'):emit(util['format'](_0x1c16('0x66'),_0x2c59b1[_0x1c16('0x4e')]),_0x1c16('0x69'),{'uri':util['format'](_0x1c16('0x6a'),_0x5c3916['instanceUrl'],_0x468931['id'])});break;default:logger[_0x1c16('0x6b')](_0x1c16('0x6c'));}})[_0x1c16('0x6d')](function(_0x121846){logger[_0x1c16('0x6b')]('[QUEUE]',_0x121846);});};exports['outbound']=function(_0x3b368c,_0x30ce6d,_0x3ebb30,_0x250d45,_0x39a96a,_0x1bc8c7,_0x5bac6b){var _0x2e8ca9,_0x34bdfd,_0xe2fc5e,_0x10e8b2;_0x1bc8c7[_0x1c16('0x57')]=intUtil[_0x1c16('0x58')](_0x1bc8c7[_0x1c16('0x57')]);_0x1bc8c7['remoteUri']=intUtil[_0x1c16('0x58')](_0x1bc8c7[_0x1c16('0x59')]);if(_0x5bac6b&&_0x5bac6b[_0x1c16('0x6e')]&&_0x5bac6b['recordingFormat']!==_0x1c16('0x6f')){logger[_0x1c16('0x24')](_0x1c16('0x70'),'Recording\x20is\x20enabled!');_0x30ce6d['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1bc8c7[_0x1c16('0x57')],_0x30ce6d[_0x1c16('0x5f')],md5(_0x30ce6d['uniqueid']));}return getConnection(_0x1bc8c7)[_0x1c16('0x22')](function(_0x1be3c0){_0x10e8b2=_0x1be3c0;return getUser(_0x1bc8c7,_0x250d45[_0x1c16('0x60')],_0x10e8b2);})['then'](function(_0x5c2da5){_0x2e8ca9=_0x5c2da5;return getEndUser(_0x1bc8c7,_0x3ebb30,_0x30ce6d[_0x1c16('0x71')],_0x30ce6d[_0x1c16('0x72')],_0x10e8b2);})[_0x1c16('0x22')](function(_0x599a9d){_0x34bdfd=_0x599a9d;return getTicket(_0x1bc8c7,_0x2e8ca9,_0x34bdfd,_0x3ebb30,_0x30ce6d,_0x3ebb30['Fields'],_0x10e8b2,_0x1c16('0x73'));})[_0x1c16('0x22')](function(_0x25547e){_0xe2fc5e=_0x25547e;logger[_0x1c16('0x24')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xe2fc5e['id']);logger['info'](_0x1c16('0x74'),_0xe2fc5e['id'],_0x250d45[_0x1c16('0x4e')],_0x1bc8c7['type']);switch(_0x1bc8c7['type']){case'integrationTab':emit(util[_0x1c16('0x42')](_0x1c16('0x66'),_0x250d45['name']),_0x1c16('0x67'),{'recordId':_0xe2fc5e['id']});break;case _0x1c16('0x68'):emit(util[_0x1c16('0x42')]('user:%s',_0x250d45[_0x1c16('0x4e')]),_0x1c16('0x69'),{'uri':util['format'](_0x1c16('0x6a'),_0x10e8b2['instanceUrl'],_0xe2fc5e['id'])});break;default:logger[_0x1c16('0x6b')](_0x1c16('0x70'),_0x1c16('0x75'));}})[_0x1c16('0x6d')](function(_0x29da03){logger[_0x1c16('0x6b')](_0x1c16('0x70'),_0x29da03);});};exports[_0x1c16('0x76')]=function(_0x545413,_0x1a2800,_0x3c3d3d,_0x29dcce,_0x3ff0a4,_0x54ca84){var _0x65af5a,_0x51afc9,_0x5c1598,_0xcd5feb;_0x54ca84['serverUrl']=intUtil[_0x1c16('0x58')](_0x54ca84['serverUrl']);_0x54ca84['remoteUri']=intUtil[_0x1c16('0x58')](_0x54ca84[_0x1c16('0x59')]);if(_0x3ff0a4&&_0x3ff0a4[_0x1c16('0x5a')]){logger['info']('['+_0x1a2800[_0x1c16('0x77')][_0x1c16('0x78')]()+']','Recording\x20is\x20enabled!');_0x1a2800[_0x1c16('0x5d')]=util[_0x1c16('0x42')](_0x1c16('0x5e'),_0x54ca84[_0x1c16('0x57')],_0x1a2800[_0x1c16('0x5f')],md5(_0x1a2800[_0x1c16('0x5f')]));}else{_0x1a2800[_0x1c16('0x5d')]='';}return getConnection(_0x54ca84)[_0x1c16('0x22')](function(_0x5cbdc0){_0xcd5feb=_0x5cbdc0;if(!_[_0x1c16('0x1e')](_0x29dcce)){return getUser(_0x54ca84,_0x29dcce[_0x1c16('0x4e')],_0xcd5feb);}else{return getUser(_0x54ca84,null,_0xcd5feb);}})['then'](function(_0x29c7bd){_0x65af5a=_0x29c7bd;return getEndUser(_0x54ca84,_0x3c3d3d,_0x1a2800[_0x1c16('0x61')],_0x1a2800[_0x1c16('0x62')],_0xcd5feb);})[_0x1c16('0x22')](function(_0x3e301c){_0x51afc9=_0x3e301c;return getTicket(_0x54ca84,_0x65af5a,_0x51afc9,_0x3c3d3d,_0x1a2800,_0x3c3d3d[_0x1c16('0x63')],_0xcd5feb);})[_0x1c16('0x22')](function(_0x3eabc0){_0x5c1598=_0x3eabc0;logger[_0x1c16('0x24')]('['+_0x1a2800[_0x1c16('0x77')][_0x1c16('0x78')]()+']\x20Ticket\x20%s\x20created.',_0x5c1598['id']);logger[_0x1c16('0x24')]('['+_0x1a2800[_0x1c16('0x77')]['toUpperCase']()+_0x1c16('0x79'),_0x54ca84[_0x1c16('0x3a')]);})['catch'](function(_0x3096d7){logger[_0x1c16('0x6b')]('['+_0x1a2800['lastevent']['toUpperCase']()+']',_0x3096d7);});}; \ No newline at end of file +var _0xfef2=['contact','lead','WhoId','account','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','moduleSearch','contact_lead','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','includes','string','idField','toString','variable','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','redis','assign','getString','Descriptions','ticketType','ActivityDate','IsReminderSet','IsRecurrence','endUserType'];(function(_0x45f03b,_0x3448d2){var _0x511c08=function(_0x152a7d){while(--_0x152a7d){_0x45f03b['push'](_0x45f03b['shift']());}};_0x511c08(++_0x3448d2);}(_0xfef2,0x6c));var _0x2fef=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0xfef2[_0x5d2ed9];return _0x4262c5;};'use strict';var _=require(_0x2fef('0x0'));var rp=require(_0x2fef('0x1'));var moment=require(_0x2fef('0x2'));var BPromise=require('bluebird');var md5=require(_0x2fef('0x3'));var jsforce=require('jsforce');var util=require(_0x2fef('0x4'));var Redis=require(_0x2fef('0x5'));var intUtil=require(_0x2fef('0x6'));var config=require(_0x2fef('0x7'));var logger=require(_0x2fef('0x8'))('salesforce');config['redis']=_[_0x2fef('0x9')](config['redis'],{'host':_0x2fef('0xa'),'port':0x18eb});var io=require(_0x2fef('0xb'))(new Redis(config[_0x2fef('0xc')]));function emit(_0x25d6a0,_0x504073,_0x387c36){io['to'](_0x25d6a0)['emit'](_0x504073,_0x387c36);}function getTicket(_0x161d8d,_0xddfc7,_0x4ff165,_0x433be5,_0x182ca0,_0x5471a0,_0xc0dfe,_0x29a5ac){var _0x1d2967=Object[_0x2fef('0xd')]({},{'OwnerId':_0xddfc7['id'],'Subject':intUtil[_0x2fef('0xe')](_0x433be5['Subjects'],_0x182ca0,'\x20'),'Description':intUtil['getString'](_0x433be5[_0x2fef('0xf')],_0x182ca0,'\x0a')},getCustomFields(_0x5471a0,_0x182ca0));if(_0x4ff165){if(_0x433be5[_0x2fef('0x10')]==='Task'){_0x1d2967[_0x2fef('0x11')]=moment['utc']();_0x1d2967[_0x2fef('0x12')]=![];_0x1d2967[_0x2fef('0x13')]=![];if(_0x4ff165[_0x2fef('0x14')]===_0x2fef('0x15')||_0x4ff165[_0x2fef('0x14')]===_0x2fef('0x16')){_0x1d2967[_0x2fef('0x17')]=_0x4ff165['id'];}else if(_0x4ff165[_0x2fef('0x14')]===_0x2fef('0x18')){_0x1d2967['WhatId']=_0x4ff165['id'];}}else if(_0x433be5[_0x2fef('0x10')]===_0x2fef('0x19')){if(_0x4ff165[_0x2fef('0x14')]==='contact'){_0x1d2967[_0x2fef('0x1a')]=_0x4ff165['id'];}else if(_0x4ff165[_0x2fef('0x14')]==='account'){_0x1d2967[_0x2fef('0x1b')]=_0x4ff165['id'];}else if(_0x4ff165[_0x2fef('0x14')]===_0x2fef('0x16')&&_0x433be5[_0x2fef('0x1c')]){_0x1d2967[_0x433be5[_0x2fef('0x1c')]]=_0x4ff165['id'];}else{logger[_0x2fef('0x1d')](_0x2fef('0x1e'));}}}return _0xc0dfe[_0x2fef('0x1f')](_0x433be5[_0x2fef('0x10')])[_0x2fef('0x20')](_0x1d2967);}function getUser(_0x589759,_0xf09ecf,_0x4ed6c0){if(!_['isNil'](_0xf09ecf)&&intUtil[_0x2fef('0x21')](_0xf09ecf)){var _0x1a1d86={'Email':_0xf09ecf};var _0x4e047a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ed6c0[_0x2fef('0x1f')](_0x2fef('0x22'))[_0x2fef('0x23')](_0x1a1d86,_0x4e047a)[_0x2fef('0x24')]()[_0x2fef('0x25')](function(_0x4a8a44){if(_0x4a8a44[_0x2fef('0x26')]){var _0x51694b=_[_0x2fef('0x23')](_0x4a8a44,function(_0x272081){return _0x272081[_0x2fef('0x27')]===_0xf09ecf;});if(_0x51694b){logger[_0x2fef('0x1d')](_0x2fef('0x28'),_0xf09ecf);return BPromise[_0x2fef('0x29')]({'id':_0x51694b['Id'],'name':_0x51694b[_0x2fef('0x2a')]});}}else{logger[_0x2fef('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xf09ecf);return _0x4ed6c0['identity']()[_0x2fef('0x25')](function(_0x596b3c){return BPromise['resolve']({'id':_0x596b3c['user_id'],'name':_0x596b3c[_0x2fef('0x2b')]});});}});}else{logger[_0x2fef('0x1d')](_0x2fef('0x2c'),_0xf09ecf);return _0x4ed6c0[_0x2fef('0x2d')]()[_0x2fef('0x25')](function(_0x252b8d){return BPromise[_0x2fef('0x29')]({'id':_0x252b8d[_0x2fef('0x2e')],'name':_0x252b8d[_0x2fef('0x2b')]});});}}function getEndUser(_0x29aca1,_0x312f64,_0x62b7c,_0x4a478d,_0x4c5c1f){var _0x525d72={'$or':{'Phone':_0x4a478d}};var _0x50b08f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2fef('0x29')]()[_0x2fef('0x25')](function(){logger[_0x2fef('0x1d')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x4a478d,_0x312f64[_0x2fef('0x2f')]);switch(_0x312f64[_0x2fef('0x2f')]){case _0x2fef('0x30'):var _0x3dd354=_['cloneDeep'](_0x525d72);if(_0x312f64[_0x2fef('0x31')]){var _0x212df7={};_0x212df7[_0x312f64['additionalSearchContact']]=_0x4a478d;_['merge'](_0x3dd354[_0x2fef('0x32')],_0x212df7);}return _0x4c5c1f[_0x2fef('0x1f')](_0x2fef('0x33'))['find'](_0x3dd354,_0x50b08f)[_0x2fef('0x24')]()[_0x2fef('0x25')](function(_0xadd0b4){if(_0xadd0b4&&_0xadd0b4[_0x2fef('0x26')]){return _0xadd0b4;}else{var _0x3e9f9f=_[_0x2fef('0x34')](_0x525d72);if(_0x312f64[_0x2fef('0x35')]){var _0x825e53={};_0x825e53[_0x312f64[_0x2fef('0x35')]]=_0x4a478d;_[_0x2fef('0x36')](_0x3e9f9f[_0x2fef('0x32')],_0x825e53);}return _0x4c5c1f[_0x2fef('0x1f')](_0x2fef('0x37'))[_0x2fef('0x23')](_0x3e9f9f,_0x50b08f);}});case'account_contact_lead':var _0x3871a4=_[_0x2fef('0x34')](_0x525d72);if(_0x312f64['additionalSearchAccount']){var _0x212df7={};_0x212df7[_0x312f64[_0x2fef('0x38')]]=_0x4a478d;_[_0x2fef('0x36')](_0x3871a4[_0x2fef('0x32')],_0x212df7);}return _0x4c5c1f[_0x2fef('0x1f')](_0x2fef('0x39'))[_0x2fef('0x23')](_0x3871a4,_0x50b08f)[_0x2fef('0x24')]()[_0x2fef('0x25')](function(_0x30846f){if(_0x30846f&&_0x30846f[_0x2fef('0x26')]){return _0x30846f;}else{var _0x170207=_['cloneDeep'](_0x525d72);if(_0x312f64['additionalSearchContact']){var _0x3c3e1e={};_0x3c3e1e[_0x312f64[_0x2fef('0x31')]]=_0x4a478d;_[_0x2fef('0x36')](_0x170207[_0x2fef('0x32')],_0x3c3e1e);}return _0x4c5c1f[_0x2fef('0x1f')](_0x2fef('0x33'))['find'](_0x170207,_0x50b08f)[_0x2fef('0x25')](function(_0x3a5a3a){if(_0x3a5a3a&&_0x3a5a3a[_0x2fef('0x26')]){return _0x3a5a3a;}else{var _0x158755=_[_0x2fef('0x34')](_0x525d72);if(_0x312f64[_0x2fef('0x35')]){var _0xab25b6={};_0xab25b6[_0x312f64['additionalSearchLead']]=_0x4a478d;_[_0x2fef('0x36')](_0x158755[_0x2fef('0x32')],_0xab25b6);}return _0x4c5c1f[_0x2fef('0x1f')](_0x2fef('0x37'))[_0x2fef('0x23')](_0x158755,_0x50b08f);}});}});case _0x2fef('0x15'):var _0x3dd354=_['cloneDeep'](_0x525d72);if(_0x312f64['additionalSearchContact']){var _0x212df7={};_0x212df7[_0x312f64[_0x2fef('0x31')]]=_0x4a478d;_[_0x2fef('0x36')](_0x3dd354[_0x2fef('0x32')],_0x212df7);}return _0x4c5c1f['sobject'](_0x2fef('0x33'))[_0x2fef('0x23')](_0x3dd354,_0x50b08f)[_0x2fef('0x24')]();case _0x2fef('0x16'):var _0x2db37d=_[_0x2fef('0x34')](_0x525d72);if(_0x312f64[_0x2fef('0x35')]){var _0x212df7={};_0x212df7[_0x312f64[_0x2fef('0x35')]]=_0x4a478d;_['merge'](_0x2db37d[_0x2fef('0x32')],_0x212df7);}return _0x4c5c1f[_0x2fef('0x1f')](_0x2fef('0x37'))[_0x2fef('0x23')](_0x2db37d,_0x50b08f);case _0x2fef('0x18'):var _0x3871a4=_['cloneDeep'](_0x525d72);if(_0x312f64[_0x2fef('0x38')]){var _0x212df7={};_0x212df7[_0x312f64[_0x2fef('0x38')]]=_0x4a478d;_[_0x2fef('0x36')](_0x3871a4[_0x2fef('0x32')],_0x212df7);}return _0x4c5c1f[_0x2fef('0x1f')](_0x2fef('0x39'))['find'](_0x3871a4,_0x50b08f);default:return null;}})[_0x2fef('0x25')](function(_0x524e25){if(_0x524e25&&_0x524e25[_0x2fef('0x26')]){var _0x197132=_[_0x2fef('0x3a')](_0x524e25);if(_0x197132){return BPromise[_0x2fef('0x29')]({'id':_0x197132['Id'],'name':_0x197132[_0x2fef('0x2a')],'phone':_0x197132[_0x2fef('0x3b')],'endUserType':_0x197132[_0x2fef('0x3c')][_0x2fef('0x3d')][_0x2fef('0x3e')]()});}}})[_0x2fef('0x25')](function(_0x3bd00d){if(_0x3bd00d){logger[_0x2fef('0x1d')](_0x2fef('0x3f'),_0x3bd00d[_0x2fef('0x14')],_0x4a478d);return BPromise['resolve'](_0x3bd00d);}else{logger[_0x2fef('0x1d')](_0x2fef('0x40'),_0x4a478d);var _0x31cd86={'Phone':_0x4a478d};if(_0x312f64[_0x2fef('0x41')]){if(_0x312f64[_0x2fef('0x41')]===_0x2fef('0x15')){logger[_0x2fef('0x1d')](_0x2fef('0x42'),_0x4a478d,_0x312f64[_0x2fef('0x41')]);_0x31cd86[_0x2fef('0x43')]=_0x62b7c!==_0x2fef('0x44')?_0x62b7c:util[_0x2fef('0x45')]('Caller\x20-\x20%s',_0x4a478d);}else if(_0x312f64[_0x2fef('0x41')]===_0x2fef('0x16')){logger[_0x2fef('0x1d')](_0x2fef('0x42'),_0x4a478d,_0x312f64[_0x2fef('0x41')]);_0x31cd86[_0x2fef('0x43')]=_0x62b7c!==_0x2fef('0x44')?_0x62b7c:util[_0x2fef('0x45')](_0x2fef('0x46'),_0x4a478d);_0x31cd86['Company']=_0x2fef('0x47');}else if(_0x312f64[_0x2fef('0x41')]===_0x2fef('0x18')){logger[_0x2fef('0x1d')](_0x2fef('0x42'),_0x4a478d,_0x312f64['moduleCreate']);_0x31cd86[_0x2fef('0x2a')]=_0x62b7c!==_0x2fef('0x44')?_0x62b7c:util['format'](_0x2fef('0x46'),_0x4a478d);}else{return null;}}return _0x4c5c1f[_0x2fef('0x1f')](_[_0x2fef('0x48')](_0x312f64['moduleCreate']))['create'](_0x31cd86)[_0x2fef('0x25')](function(_0x23170b){return BPromise[_0x2fef('0x29')]({'id':_0x23170b['id'],'endUserType':_0x312f64[_0x2fef('0x41')]});});}});}function getCustomFields(_0x5806f2,_0xade34){var _0xc02f31={};if(_0x5806f2[_0x2fef('0x26')]>0x0){_[_0x2fef('0x49')](_0x5806f2,function(_0x298d3d){if(_[_0x2fef('0x4a')]([_0x2fef('0x4b'),'picklist'],_0x298d3d[_0x2fef('0x3d')])&&_0x298d3d[_0x2fef('0x4c')]){_0xc02f31[_0x298d3d[_0x2fef('0x4c')]]=_0x298d3d['content'][_0x2fef('0x4d')]();}else if(_0x298d3d[_0x2fef('0x3d')]===_0x2fef('0x4e')&&_0x298d3d[_0x2fef('0x4f')]&&_0x298d3d[_0x2fef('0x4c')]){_0xade34[_0x298d3d[_0x2fef('0x4f')]]&&(_0xc02f31[_0x298d3d[_0x2fef('0x4c')]]=_0xade34[_0x298d3d[_0x2fef('0x4f')]][_0x2fef('0x4d')]());}else if(_0x298d3d[_0x2fef('0x3d')]==='customVariable'&&_0x298d3d[_0x2fef('0x50')]&&_0x298d3d[_0x2fef('0x50')]['name']&&_0x298d3d[_0x2fef('0x4c')]){_0xade34[_0x298d3d['Variable'][_0x2fef('0x51')][_0x2fef('0x3e')]()]&&(_0xc02f31[_0x298d3d[_0x2fef('0x4c')]]=_0xade34[_0x298d3d[_0x2fef('0x50')]['name'][_0x2fef('0x3e')]()]['toString']());}});}return _0xc02f31;}function getConnection(_0x425b54){var _0x355253=_0x425b54[_0x2fef('0x52')][_0x2fef('0x53')](_0x425b54[_0x2fef('0x54')]);var _0x3fcd70=new jsforce[(_0x2fef('0x55'))]({'oauth2':{'loginUrl':_0x425b54[_0x2fef('0x56')]||_0x2fef('0x57'),'clientId':_0x425b54[_0x2fef('0x58')],'clientSecret':_0x425b54[_0x2fef('0x59')]}});return _0x3fcd70[_0x2fef('0x5a')](_0x425b54['username'],_0x355253)[_0x2fef('0x25')](function(){logger['info'](_0x2fef('0x5b'));return _0x3fcd70;});}exports[_0x2fef('0x5c')]=function(_0x1f4a55,_0x58a8c5,_0x2a1d7a,_0x490a66,_0x512e9c,_0x1d7531){var _0xf0b064,_0x2c32b0,_0x4e5153,_0x19823c;_0x1d7531[_0x2fef('0x5d')]=intUtil['stripTrailingSlash'](_0x1d7531['serverUrl']);_0x1d7531[_0x2fef('0x56')]=intUtil[_0x2fef('0x5e')](_0x1d7531['remoteUri']);if(_0x512e9c&&_0x512e9c[_0x2fef('0x5f')]){logger[_0x2fef('0x1d')](_0x2fef('0x60'),_0x2fef('0x61'));_0x58a8c5['recordingURL']=util['format'](_0x2fef('0x62'),_0x1d7531[_0x2fef('0x5d')],_0x58a8c5[_0x2fef('0x63')],md5(_0x58a8c5[_0x2fef('0x63')]));}else{_0x58a8c5[_0x2fef('0x64')]='';}return getConnection(_0x1d7531)[_0x2fef('0x25')](function(_0x901349){_0x19823c=_0x901349;return getUser(_0x1d7531,_0x490a66[_0x2fef('0x65')],_0x19823c);})['then'](function(_0x4a3a9f){_0xf0b064=_0x4a3a9f;return getEndUser(_0x1d7531,_0x2a1d7a,_0x58a8c5[_0x2fef('0x66')],_0x58a8c5[_0x2fef('0x67')],_0x19823c);})['then'](function(_0x5ed9a7){_0x2c32b0=_0x5ed9a7;return getTicket(_0x1d7531,_0xf0b064,_0x2c32b0,_0x2a1d7a,_0x58a8c5,_0x2a1d7a[_0x2fef('0x68')],_0x19823c,'queue');})[_0x2fef('0x25')](function(_0x1f006c){_0x4e5153=_0x1f006c;logger[_0x2fef('0x1d')](_0x2fef('0x69'),_0x4e5153['id']);logger[_0x2fef('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4e5153['id'],_0x490a66[_0x2fef('0x51')],_0x1d7531[_0x2fef('0x3d')]);switch(_0x1d7531[_0x2fef('0x3d')]){case _0x2fef('0x6a'):emit(util['format'](_0x2fef('0x6b'),_0x490a66[_0x2fef('0x51')]),_0x2fef('0x6c'),{'recordId':_0x4e5153['id']});break;case _0x2fef('0x6d'):emit(util[_0x2fef('0x45')](_0x2fef('0x6b'),_0x490a66[_0x2fef('0x51')]),_0x2fef('0x6e'),{'uri':util[_0x2fef('0x45')]('%s/%s/e',_0x19823c[_0x2fef('0x6f')],_0x4e5153['id'])});break;default:logger[_0x2fef('0x70')](_0x2fef('0x71'));}})[_0x2fef('0x72')](function(_0x2debaf){logger[_0x2fef('0x70')](_0x2fef('0x60'),_0x2debaf);});};exports[_0x2fef('0x73')]=function(_0x1cda08,_0x26dfd8,_0x3a4321,_0x40d6f4,_0x4f0bba,_0x4b1478,_0x32d280){var _0x24f0b2,_0x3547e6,_0x3d0bcd,_0x418061;_0x4b1478['serverUrl']=intUtil[_0x2fef('0x5e')](_0x4b1478[_0x2fef('0x5d')]);_0x4b1478[_0x2fef('0x56')]=intUtil['stripTrailingSlash'](_0x4b1478[_0x2fef('0x56')]);if(_0x32d280&&_0x32d280[_0x2fef('0x74')]&&_0x32d280[_0x2fef('0x74')]!==_0x2fef('0x75')){logger[_0x2fef('0x1d')]('[OUTBOUND]',_0x2fef('0x61'));_0x26dfd8[_0x2fef('0x64')]=util[_0x2fef('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b1478[_0x2fef('0x5d')],_0x26dfd8[_0x2fef('0x63')],md5(_0x26dfd8[_0x2fef('0x63')]));}return getConnection(_0x4b1478)['then'](function(_0x18e975){_0x418061=_0x18e975;return getUser(_0x4b1478,_0x40d6f4[_0x2fef('0x65')],_0x418061);})['then'](function(_0x16a4dd){_0x24f0b2=_0x16a4dd;return getEndUser(_0x4b1478,_0x3a4321,_0x26dfd8['destcalleridname'],_0x26dfd8[_0x2fef('0x76')],_0x418061);})[_0x2fef('0x25')](function(_0x462195){_0x3547e6=_0x462195;return getTicket(_0x4b1478,_0x24f0b2,_0x3547e6,_0x3a4321,_0x26dfd8,_0x3a4321[_0x2fef('0x68')],_0x418061,_0x2fef('0x73'));})['then'](function(_0x4c09b9){_0x3d0bcd=_0x4c09b9;logger[_0x2fef('0x1d')](_0x2fef('0x77'),_0x3d0bcd['id']);logger[_0x2fef('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3d0bcd['id'],_0x40d6f4['name'],_0x4b1478['type']);switch(_0x4b1478[_0x2fef('0x3d')]){case _0x2fef('0x6a'):emit(util[_0x2fef('0x45')](_0x2fef('0x6b'),_0x40d6f4[_0x2fef('0x51')]),_0x2fef('0x6c'),{'recordId':_0x3d0bcd['id']});break;case _0x2fef('0x6d'):emit(util[_0x2fef('0x45')](_0x2fef('0x6b'),_0x40d6f4[_0x2fef('0x51')]),_0x2fef('0x6e'),{'uri':util[_0x2fef('0x45')](_0x2fef('0x78'),_0x418061[_0x2fef('0x6f')],_0x3d0bcd['id'])});break;default:logger[_0x2fef('0x70')](_0x2fef('0x79'),_0x2fef('0x7a'));}})[_0x2fef('0x72')](function(_0x5a6cd1){logger[_0x2fef('0x70')](_0x2fef('0x79'),_0x5a6cd1);});};exports[_0x2fef('0x7b')]=function(_0x121cf6,_0x50602d,_0x27a5c2,_0x16914e,_0x40f2e4,_0x2ab362){var _0x3916f7,_0x1a65bd,_0xae01e0,_0xaf9986;_0x2ab362[_0x2fef('0x5d')]=intUtil[_0x2fef('0x5e')](_0x2ab362[_0x2fef('0x5d')]);_0x2ab362['remoteUri']=intUtil['stripTrailingSlash'](_0x2ab362[_0x2fef('0x56')]);if(_0x40f2e4&&_0x40f2e4['monitor_format']){logger[_0x2fef('0x1d')]('['+_0x50602d[_0x2fef('0x7c')][_0x2fef('0x7d')]()+']',_0x2fef('0x61'));_0x50602d[_0x2fef('0x64')]=util[_0x2fef('0x45')](_0x2fef('0x62'),_0x2ab362[_0x2fef('0x5d')],_0x50602d[_0x2fef('0x63')],md5(_0x50602d[_0x2fef('0x63')]));}else{_0x50602d[_0x2fef('0x64')]='';}return getConnection(_0x2ab362)['then'](function(_0xdc862d){_0xaf9986=_0xdc862d;if(!_[_0x2fef('0x7e')](_0x16914e)){return getUser(_0x2ab362,_0x16914e['name'],_0xaf9986);}else{return getUser(_0x2ab362,null,_0xaf9986);}})[_0x2fef('0x25')](function(_0x34aae3){_0x3916f7=_0x34aae3;return getEndUser(_0x2ab362,_0x27a5c2,_0x50602d[_0x2fef('0x66')],_0x50602d[_0x2fef('0x67')],_0xaf9986);})[_0x2fef('0x25')](function(_0x536fa8){_0x1a65bd=_0x536fa8;return getTicket(_0x2ab362,_0x3916f7,_0x1a65bd,_0x27a5c2,_0x50602d,_0x27a5c2[_0x2fef('0x68')],_0xaf9986);})[_0x2fef('0x25')](function(_0xbc058a){_0xae01e0=_0xbc058a;logger[_0x2fef('0x1d')]('['+_0x50602d[_0x2fef('0x7c')][_0x2fef('0x7d')]()+_0x2fef('0x7f'),_0xae01e0['id']);logger['info']('['+_0x50602d[_0x2fef('0x7c')][_0x2fef('0x7d')]()+_0x2fef('0x80'),_0x2ab362[_0x2fef('0x3d')]);})[_0x2fef('0x72')](function(_0x4b7357){logger[_0x2fef('0x70')]('['+_0x50602d[_0x2fef('0x7c')][_0x2fef('0x7d')]()+']',_0x4b7357);});}; \ 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 3338f76..b9d7cd4 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 _0x1506=['endUserId','],\x20getEndUser\x20crm','forEach','includes','picklist','customField','nameField','toLowerCase','content','toString','string','type','idField','variable','variableName','customVariable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','userId','sys_id','userEmail','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1506,0x18f));var _0x6150=function(_0x2cf34f,_0x113909){_0x2cf34f=_0x2cf34f-0x0;var _0xe590ce=_0x1506[_0x2cf34f];return _0xe590ce;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x6150('0x0'));var util=require(_0x6150('0x1'));var md5=require(_0x6150('0x2'));var Redis=require(_0x6150('0x3'));var intUtil=require(_0x6150('0x4'));var config=require(_0x6150('0x5'));var logger=require(_0x6150('0x6'))(_0x6150('0x7'));config[_0x6150('0x8')]=_[_0x6150('0x9')](config[_0x6150('0x8')],{'host':_0x6150('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6150('0x8')]));function getAdminUser(_0x3c08bc,_0x1f8bd6,_0x2c0b85,_0xbfff9a,_0x267555,_0x38c3d0){return new Promise(function(_0x4280cf,_0x370632){var _0x55face={'method':_0x6150('0xb'),'uri':_0xbfff9a+_0x6150('0xc')+'&'+_0x267555+'&'+_0x38c3d0,'auth':_0x1f8bd6,'json':!![]};return rp(_0x55face)[_0x6150('0xd')](function(_0x232d71){if(_0x232d71[_0x6150('0xe')][_0x6150('0xf')]>0x0){_0x2c0b85[_0x6150('0x10')]=_0x232d71[_0x6150('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x3c08bc['toUpperCase']()]+_0x6150('0x11'),_0x2c0b85);_0x4280cf(_0x2c0b85);})[_0x6150('0x12')](function(_0x34db70){logger[_0x6150('0x13')]('['+[_0x3c08bc[_0x6150('0x14')]()]+']',_0x34db70[_0x6150('0x15')]);_0x370632(_0x34db70[_0x6150('0x15')]);});});}function getUser(_0x21ccd7,_0x1e97cb,_0x22ad57,_0x1b4d66,_0x375e4d){return function(_0x1eb358){logger[_0x6150('0x16')]('['+[_0x21ccd7[_0x6150('0x14')]()]+_0x6150('0x17'),_0x1eb358);return new Promise(function(_0x3e3b62,_0x253c0b){if(intUtil[_0x6150('0x18')](_0x1eb358['userEmail'])){var _0x464f68={'method':_0x6150('0xb'),'uri':_0x22ad57+_0x6150('0x19')+_0x1eb358['userEmail']+'&'+_0x1b4d66+'&'+_0x375e4d,'auth':_0x1e97cb,'json':!![]};logger[_0x6150('0x16')]('['+[_0x21ccd7['toUpperCase']()]+_0x6150('0x1a'),_0x464f68);return rp(_0x464f68)[_0x6150('0xd')](function(_0x29c34c){logger[_0x6150('0x16')]('['+[_0x21ccd7[_0x6150('0x14')]()]+'],\x20getUser\x20entity',_0x29c34c);if(_0x29c34c['result'][_0x6150('0xf')]>0x0&&String(_0x29c34c[_0x6150('0xe')][0x0][_0x6150('0x1b')])==='true'){_0x1eb358[_0x6150('0x1c')]=_0x29c34c[_0x6150('0xe')][0x0][_0x6150('0x1d')];}else{_0x1eb358['userId']=_0x1eb358[_0x6150('0x10')];_0x1eb358[_0x6150('0x1e')]=_0x1eb358[_0x6150('0x1f')];}logger[_0x6150('0x16')]('['+[_0x21ccd7[_0x6150('0x14')]()]+'],\x20getUser\x20crm',_0x1eb358);_0x3e3b62(_0x1eb358);})[_0x6150('0x12')](function(_0x26d029){logger[_0x6150('0x13')]('['+[_0x21ccd7[_0x6150('0x14')]()]+']',_0x26d029['message']);_0x253c0b(_0x26d029[_0x6150('0x15')]);});}else{logger[_0x6150('0x16')]('['+[_0x21ccd7[_0x6150('0x14')]()]+']\x20using\x20admin\x20profile');_0x1eb358['userId']=_0x1eb358[_0x6150('0x10')];_0x1eb358[_0x6150('0x1e')]=_0x1eb358[_0x6150('0x1f')];_0x3e3b62(_0x1eb358);}});};}function createEndUser(_0x3e9dcc,_0x4a2502,_0x34f203,_0x2ee202,_0x255fed){logger[_0x6150('0x16')]('['+[_0x3e9dcc[_0x6150('0x14')]()]+_0x6150('0x20'),_0x34f203);return new Promise(function(_0x65da6,_0xd2a46e){var _0x38221f={'method':'POST','uri':_0x2ee202+_0x6150('0x21')+_0x255fed,'body':{'user_name':_0x34f203[_0x6150('0x22')],'roles':_0x6150('0x23'),'first_name':_0x34f203['endUserNumber'],'active':_0x6150('0x24'),'date_format':_0x6150('0x25'),'phone':_0x34f203[_0x6150('0x22')]},'auth':_0x4a2502,'json':!![]};return rp(_0x38221f)[_0x6150('0xd')](function(_0x45b2af){logger[_0x6150('0x16')]('['+[_0x3e9dcc[_0x6150('0x14')]()]+_0x6150('0x26'),_0x45b2af[_0x6150('0xe')]);_0x34f203['endUserId']=_0x45b2af[_0x6150('0xe')]['sys_id'];_0x65da6(_0x34f203);})[_0x6150('0x12')](function(_0x24f00b){logger[_0x6150('0x13')]('['+[_0x3e9dcc[_0x6150('0x14')]()]+']',_0x24f00b[_0x6150('0x15')]);_0xd2a46e(_0x24f00b['message']);});});}function getEndUser(_0x4ea37b,_0x1baec6,_0x50651,_0x3527cc,_0x1316dd){return function(_0x229f6e){logger[_0x6150('0x16')]('['+[_0x4ea37b['toUpperCase']()]+_0x6150('0x27'),_0x229f6e);return new Promise(function(_0x27dfaf,_0x28580f){var _0x560867={'method':_0x6150('0xb'),'uri':_0x50651+_0x6150('0x28')+_0x229f6e['endUserNumber']+'&'+_0x3527cc+'&'+_0x1316dd,'auth':_0x1baec6,'json':!![]};return rp(_0x560867)[_0x6150('0xd')](function(_0x400818){if(_0x400818[_0x6150('0xe')][_0x6150('0xf')]>0x0){_0x229f6e[_0x6150('0x29')]=_0x400818[_0x6150('0xe')][0x0][_0x6150('0x1d')];logger[_0x6150('0x16')]('['+[_0x4ea37b[_0x6150('0x14')]()]+_0x6150('0x2a'),_0x229f6e);_0x27dfaf(_0x229f6e);}else{return createEndUser(_0x4ea37b,_0x1baec6,_0x229f6e,_0x50651,_0x3527cc)[_0x6150('0xd')](function(_0x301998){logger[_0x6150('0x16')]('['+[_0x4ea37b[_0x6150('0x14')]()]+'],\x20createEndUser\x20crm',_0x301998);_0x27dfaf(_0x301998);});}})['catch'](function(_0x30bf06){logger[_0x6150('0x13')]('['+[_0x4ea37b[_0x6150('0x14')]()]+']',_0x30bf06[_0x6150('0x15')]);_0x28580f(_0x30bf06[_0x6150('0x15')]);});});};}function getCustomFields(_0x3d153c,_0x2003fe){var _0x2aae33={};if(_0x3d153c[_0x6150('0xf')]>0x0){_[_0x6150('0x2b')](_0x3d153c,function(_0x568317){if(_[_0x6150('0x2c')](['string',_0x6150('0x2d')],_0x568317['type'])&&_0x568317['nameField']&&!_0x568317[_0x6150('0x2e')]){_0x2aae33[_0x568317[_0x6150('0x2f')][_0x6150('0x30')]()]=_0x568317[_0x6150('0x31')][_0x6150('0x32')]();}else if(_['includes']([_0x6150('0x33'),'picklist'],_0x568317[_0x6150('0x34')])&&_0x568317[_0x6150('0x35')]&&_0x568317[_0x6150('0x2e')]){_0x2aae33[_0x568317[_0x6150('0x35')][_0x6150('0x30')]()]=_0x568317[_0x6150('0x31')][_0x6150('0x32')]();}else if(_0x568317['type']===_0x6150('0x36')&&_0x568317[_0x6150('0x37')]&&_0x568317[_0x6150('0x35')]&&_0x568317['customField']){_0x2aae33[_0x568317[_0x6150('0x35')][_0x6150('0x30')]()]=_0x2003fe[_0x568317[_0x6150('0x37')]][_0x6150('0x32')]();}else if(_0x568317[_0x6150('0x34')]===_0x6150('0x38')&&_0x568317['Variable']&&_0x568317['Variable'][_0x6150('0x39')]&&_0x568317[_0x6150('0x35')]&&_0x568317[_0x6150('0x2e')]){_0x2aae33[_0x568317['idField'][_0x6150('0x30')]()]=_0x2003fe[_0x568317['Variable'][_0x6150('0x39')][_0x6150('0x30')]()]['toString']();}});}return _0x2aae33;}function getTicket(_0x37e611,_0x24cfdf,_0xc866a8,_0x425fd6,_0x2cee92,_0x5d1d7d){return function(_0x2d88b1){logger['info']('['+[_0x37e611[_0x6150('0x14')]()]+_0x6150('0x3a'),_0x2d88b1);return new Promise(function(_0x96f9cc,_0x28be97){var _0x3e4988=_0x37e611[_0x6150('0x30')]()===_0x6150('0x3b')?_0x2d88b1[_0x6150('0x1c')]:_0x2d88b1[_0x6150('0x29')];var _0x1de1a2={'method':_0x6150('0x3c'),'uri':_0xc866a8+_0x6150('0x3d')+'?'+_0x5d1d7d,'body':Object['assign']({},{'active':'true','caller_id':_0x3e4988,'assigned_to':_0x2d88b1[_0x6150('0x1c')],'short_description':intUtil[_0x6150('0x3e')](_0x425fd6['Subjects'],_0x2cee92,'\x20'),'description':intUtil[_0x6150('0x3e')](_0x425fd6[_0x6150('0x3f')],_0x2cee92,'\x0a')},getCustomFields(_0x425fd6[_0x6150('0x40')],_0x2cee92)),'auth':_0x24cfdf,'json':!![]};return rp(_0x1de1a2)[_0x6150('0xd')](function(_0x43c09e){logger[_0x6150('0x16')]('['+[_0x37e611[_0x6150('0x14')]()]+_0x6150('0x41'),_0x43c09e[_0x6150('0xe')]);_0x2d88b1[_0x6150('0x42')]=_0x43c09e['result'][_0x6150('0x1d')];_0x2d88b1['ticketNumber']=_0x43c09e[_0x6150('0xe')]['number'];logger['info']('['+[_0x37e611[_0x6150('0x14')]()]+_0x6150('0x43'),_0x2d88b1);_0x96f9cc(_0x2d88b1);})['catch'](function(_0x342ffa){logger['error']('['+[_0x37e611[_0x6150('0x14')]()]+']',_0x342ffa['message']);_0x28be97(_0x342ffa[_0x6150('0x15')]);});});};}function createRemoteTag(_0x1d9ef3,_0x20c794,_0x459152,_0x578582){return new Promise(function(_0x224504,_0x9e300f){var _0x3cbdad={'method':'POST','uri':_0x459152+'label'+'?'+_0x578582,'body':{'short_description':_0x1d9ef3,'global':!![],'active':!![],'name':_0x1d9ef3},'auth':_0x20c794,'json':!![]};return rp(_0x3cbdad)[_0x6150('0xd')](function(_0x35497b){var _0x10734d=_0x35497b[_0x6150('0xe')][_0x6150('0x1d')];_0x224504(_0x10734d);});});}function getRemoteTag(_0x65a00e,_0x1b13bb,_0x5a5b97,_0x6effa0,_0x2e3591){return new Promise(function(_0x493b7d,_0x563b54){var _0x1b2179={'method':_0x6150('0xb'),'uri':_0x5a5b97+_0x6150('0x44')+_0x6150('0x45')+_0x65a00e+'&'+_0x6effa0,'auth':_0x1b13bb,'json':!![]};return rp(_0x1b2179)[_0x6150('0xd')](function(_0x218367){if(_0x218367[_0x6150('0xe')][_0x6150('0xf')]>0x0){var _0xf265b4=_0x218367[_0x6150('0xe')][0x0][_0x6150('0x1d')];_0x493b7d(_0xf265b4);}else{return createRemoteTag(_0x65a00e,_0x1b13bb,_0x5a5b97,_0x6effa0)['then'](function(_0x4b8be5){_0x493b7d(_0x4b8be5);});}});});}function assignTagToIncident(_0x4e0913,_0x521fae,_0x10e1ca,_0x412bf7,_0x42a97c){return new Promise(function(_0x4b9140,_0x2689ef){var _0x17b821={'method':_0x6150('0x3c'),'uri':_0x10e1ca+_0x6150('0x46')+'?'+_0x42a97c,'body':{'label':_0x4e0913,'table':_0x6150('0x3d'),'id_type':'Incident','table_key':_0x412bf7[_0x6150('0x42')],'title':_0x6150('0x47')+_0x412bf7['ticketNumber'],'id_display':_0x412bf7[_0x6150('0x48')]},'auth':_0x521fae,'json':!![]};return rp(_0x17b821)[_0x6150('0xd')](function(_0x562a71){_0x4b9140();})[_0x6150('0x12')](function(){_0x4b9140();});});}function manageTags(_0x1ab85f,_0x3e7425,_0x363865,_0x3a7c42,_0x3d72be,_0x1a61d6,_0x424c72){return new Promise(function(_0x1b55eb,_0x10eccb){var _0x49c669=[];_0x3e7425[_0x6150('0x2b')](function(_0x1f26ef){_0x49c669[_0x6150('0x49')](getRemoteTag(_0x1f26ef,_0x363865,_0x3a7c42,_0x1a61d6,_0x424c72));});return Promise[_0x6150('0x4a')](_0x49c669)[_0x6150('0xd')](function(_0x530350){if(_0x530350[_0x6150('0xf')]){logger['info']('['+[_0x1ab85f[_0x6150('0x14')]()]+_0x6150('0x4b'),_0x530350);var _0x119212=[];_0x530350['forEach'](function(_0x3d4d4a){_0x119212[_0x6150('0x49')](assignTagToIncident(_0x3d4d4a,_0x363865,_0x3a7c42,_0x3d72be,_0x1a61d6));});return Promise['all'](_0x119212)[_0x6150('0xd')](function(){_0x1b55eb();})['catch'](function(){_0x1b55eb();});}else{_0x1b55eb();}});});}function getTags(_0xa17fec,_0x3a183d,_0x1b7767,_0x5e58a8,_0x3e5903,_0x596d6f){return function(_0x1ee4fc){return new Promise(function(_0x5ee179,_0x5f01b8){var _0x7382a9=[];var _0x1ee441=_0x5e58a8[_0x6150('0x4c')];if(_0x1ee441&&_0x1ee441[_0x6150('0xf')]>0x0){_0x7382a9=_[_0x6150('0x4d')](_0x1ee441,'name');}if(_0x7382a9[_0x6150('0xf')]>0x0){return manageTags(_0xa17fec,_0x7382a9,_0x3a183d,_0x1b7767,_0x1ee4fc,_0x3e5903,_0x596d6f)[_0x6150('0xd')](function(){_0x5ee179(_0x1ee4fc);});}else{_0x5ee179(_0x1ee4fc);}});};}function emit(_0x2da190,_0x26853c,_0x17c998){var _0x303b6b='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x6150('0x4e')+_0x6150('0x4f');var _0x1a6904={'uri':_0x2da190+_0x6150('0x50')+_0x17c998+_0x303b6b};io['to'](util['format'](_0x6150('0x51'),_0x26853c))[_0x6150('0x52')](_0x6150('0x53'),_0x1a6904);}exports['cs']=function(_0x43460e,_0x4d93cf,_0x107303,_0x4c8fed,_0x21dda6,_0x35303d,_0x4ab7a6,_0x2ce990){var _0x19d1be={};var _0x3e6c15={'user':_0x35303d[_0x6150('0x54')],'pass':_0x35303d['password']};var _0x13d904='sysparm_limit=1';var _0x1c61ba=_0x6150('0x55');_0x35303d[_0x6150('0x56')]=intUtil[_0x6150('0x57')](_0x35303d[_0x6150('0x56')]);_0x35303d[_0x6150('0x58')]=intUtil[_0x6150('0x57')](_0x35303d['serverUrl']);var _0x4c9aac=util[_0x6150('0x59')](_0x6150('0x5a'),_0x35303d[_0x6150('0x56')]);_0x19d1be[_0x6150('0x1e')]=!_[_0x6150('0x5b')](_0x4c8fed)?_0x4c8fed['email']:null;_0x19d1be['adminEmail']=_0x35303d[_0x6150('0x5c')];_0x19d1be['endUserNumber']=_0x2ce990['toLowerCase']()===_0x6150('0x3b')?_0x4d93cf[_0x6150('0x5d')]:_0x4d93cf[_0x6150('0x5e')];_0x19d1be[_0x6150('0x5f')]=_0x2ce990===_0x6150('0x60')||_0x2ce990===_0x6150('0x61')?_0x6150('0x60'):'outbound';var _0x5e4fe3=util[_0x6150('0x59')](_0x6150('0x62'),_0x35303d[_0x6150('0x58')],_0x4d93cf[_0x6150('0x63')],md5(_0x4d93cf[_0x6150('0x63')]));if(_0x21dda6&&_0x21dda6[_0x6150('0x64')]){logger[_0x6150('0x16')](_0x6150('0x65'),'Recording\x20is\x20enabled!');_0x4d93cf[_0x6150('0x66')]=_0x5e4fe3;}else if(_0x4ab7a6&&_0x4ab7a6[_0x6150('0x67')]&&_0x4ab7a6[_0x6150('0x67')]!==_0x6150('0x68')){logger['info'](_0x6150('0x69'),'Recording\x20is\x20enabled!');_0x4d93cf['recordingURL']=_0x5e4fe3;}else{_0x4d93cf[_0x6150('0x66')]='';}return getAdminUser(_0x2ce990,_0x3e6c15,_0x19d1be,_0x4c9aac,_0x1c61ba,_0x13d904)[_0x6150('0xd')](getUser(_0x2ce990,_0x3e6c15,_0x4c9aac,_0x1c61ba,_0x13d904))[_0x6150('0xd')](getEndUser(_0x2ce990,_0x3e6c15,_0x4c9aac,_0x1c61ba,_0x13d904))[_0x6150('0xd')](getTicket(_0x2ce990,_0x3e6c15,_0x4c9aac,_0x107303,_0x4d93cf,_0x1c61ba))[_0x6150('0xd')](function(_0x16fe40){logger[_0x6150('0x16')](util[_0x6150('0x59')]('The\x20ticket\x20ID\x20is:\x20%s',_0x16fe40['ticketId']));logger[_0x6150('0x16')](util[_0x6150('0x59')](_0x6150('0x6a'),_0x2ce990));if(_0x2ce990!==_0x6150('0x61')){logger['info']('['+[_0x2ce990[_0x6150('0x14')]()]+']',_0x6150('0x6b'));emit(_0x35303d[_0x6150('0x56')],_0x4c8fed[_0x6150('0x39')],_0x16fe40['ticketId']);}})[_0x6150('0x12')](function(_0x3ea0fe){logger[_0x6150('0x13')]('['+[_0x2ce990[_0x6150('0x14')]()]+_0x6150('0x6c'),util[_0x6150('0x6d')](_0x3ea0fe,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x58ab=['ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s','bluebird','request-promise','util','md5','ioredis','./util','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','nameField','customField','content','toString','string','type','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x58ab,0x173));var _0xb58a=function(_0x51326e,_0x3d66d7){_0x51326e=_0x51326e-0x0;var _0x26f06b=_0x58ab[_0x51326e];return _0x26f06b;};'use strict';var _=require('lodash');var Promise=require(_0xb58a('0x0'));var rp=require(_0xb58a('0x1'));var util=require(_0xb58a('0x2'));var md5=require(_0xb58a('0x3'));var Redis=require(_0xb58a('0x4'));var intUtil=require(_0xb58a('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xb58a('0x6'));config[_0xb58a('0x7')]=_[_0xb58a('0x8')](config[_0xb58a('0x7')],{'host':_0xb58a('0x9'),'port':0x18eb});var io=require(_0xb58a('0xa'))(new Redis(config[_0xb58a('0x7')]));function getAdminUser(_0x2bd8fa,_0x305e9e,_0x5654cc,_0x23806d,_0x1a7b96,_0x21f8f2){return new Promise(function(_0x5222a6,_0x1e4903){var _0x5c3cb8={'method':_0xb58a('0xb'),'uri':_0x23806d+_0xb58a('0xc')+'&'+_0x1a7b96+'&'+_0x21f8f2,'auth':_0x305e9e,'json':!![]};return rp(_0x5c3cb8)[_0xb58a('0xd')](function(_0x189a69){if(_0x189a69[_0xb58a('0xe')]['length']>0x0){_0x5654cc[_0xb58a('0xf')]=_0x189a69[_0xb58a('0xe')][0x0][_0xb58a('0x10')];}logger[_0xb58a('0x11')]('['+[_0x2bd8fa[_0xb58a('0x12')]()]+'],\x20getAdminUser\x20crm',_0x5654cc);_0x5222a6(_0x5654cc);})[_0xb58a('0x13')](function(_0x3409e4){logger[_0xb58a('0x14')]('['+[_0x2bd8fa[_0xb58a('0x12')]()]+']',_0x3409e4[_0xb58a('0x15')]);_0x1e4903(_0x3409e4[_0xb58a('0x15')]);});});}function getUser(_0xf37a5a,_0x3339dc,_0x25a784,_0x1846b7,_0x2c117c){return function(_0x7d386c){logger[_0xb58a('0x11')]('['+[_0xf37a5a[_0xb58a('0x12')]()]+'],\x20getUser\x20input\x20crm',_0x7d386c);return new Promise(function(_0x4d38ba,_0x13cb56){if(intUtil[_0xb58a('0x16')](_0x7d386c[_0xb58a('0x17')])){var _0x108b23={'method':'GET','uri':_0x25a784+_0xb58a('0x18')+_0x7d386c[_0xb58a('0x17')]+'&'+_0x1846b7+'&'+_0x2c117c,'auth':_0x3339dc,'json':!![]};logger[_0xb58a('0x11')]('['+[_0xf37a5a[_0xb58a('0x12')]()]+_0xb58a('0x19'),_0x108b23);return rp(_0x108b23)[_0xb58a('0xd')](function(_0x20772a){logger[_0xb58a('0x11')]('['+[_0xf37a5a[_0xb58a('0x12')]()]+_0xb58a('0x1a'),_0x20772a);if(_0x20772a[_0xb58a('0xe')][_0xb58a('0x1b')]>0x0&&String(_0x20772a[_0xb58a('0xe')][0x0][_0xb58a('0x1c')])==='true'){_0x7d386c[_0xb58a('0x1d')]=_0x20772a[_0xb58a('0xe')][0x0][_0xb58a('0x10')];}else{_0x7d386c[_0xb58a('0x1d')]=_0x7d386c['adminId'];_0x7d386c['userEmail']=_0x7d386c[_0xb58a('0x1e')];}logger[_0xb58a('0x11')]('['+[_0xf37a5a['toUpperCase']()]+'],\x20getUser\x20crm',_0x7d386c);_0x4d38ba(_0x7d386c);})[_0xb58a('0x13')](function(_0x5869ba){logger[_0xb58a('0x14')]('['+[_0xf37a5a['toUpperCase']()]+']',_0x5869ba[_0xb58a('0x15')]);_0x13cb56(_0x5869ba[_0xb58a('0x15')]);});}else{logger['info']('['+[_0xf37a5a[_0xb58a('0x12')]()]+_0xb58a('0x1f'));_0x7d386c['userId']=_0x7d386c[_0xb58a('0xf')];_0x7d386c[_0xb58a('0x17')]=_0x7d386c[_0xb58a('0x1e')];_0x4d38ba(_0x7d386c);}});};}function createEndUser(_0x314649,_0x2a22e3,_0x3ce641,_0x11db74,_0x11de16){logger[_0xb58a('0x11')]('['+[_0x314649[_0xb58a('0x12')]()]+_0xb58a('0x20'),_0x3ce641);return new Promise(function(_0x409528,_0x31c57e){var _0x29635c={'method':_0xb58a('0x21'),'uri':_0x11db74+_0xb58a('0x22')+_0x11de16,'body':{'user_name':_0x3ce641[_0xb58a('0x23')],'roles':_0xb58a('0x24'),'first_name':_0x3ce641['endUserNumber'],'active':_0xb58a('0x25'),'date_format':_0xb58a('0x26'),'phone':_0x3ce641[_0xb58a('0x23')]},'auth':_0x2a22e3,'json':!![]};return rp(_0x29635c)[_0xb58a('0xd')](function(_0x266c74){logger[_0xb58a('0x11')]('['+[_0x314649[_0xb58a('0x12')]()]+_0xb58a('0x27'),_0x266c74[_0xb58a('0xe')]);_0x3ce641['endUserId']=_0x266c74['result'][_0xb58a('0x10')];_0x409528(_0x3ce641);})[_0xb58a('0x13')](function(_0x1ea42a){logger[_0xb58a('0x14')]('['+[_0x314649[_0xb58a('0x12')]()]+']',_0x1ea42a[_0xb58a('0x15')]);_0x31c57e(_0x1ea42a[_0xb58a('0x15')]);});});}function getEndUser(_0x2783b5,_0x3c6357,_0x5920b7,_0x31c653,_0x2e48de){return function(_0x4d0381){logger[_0xb58a('0x11')]('['+[_0x2783b5[_0xb58a('0x12')]()]+_0xb58a('0x28'),_0x4d0381);return new Promise(function(_0x84d01,_0x60ac8d){var _0x334c6b={'method':_0xb58a('0xb'),'uri':_0x5920b7+'sys_user?sysparm_query=phone%3D'+_0x4d0381['endUserNumber']+'&'+_0x31c653+'&'+_0x2e48de,'auth':_0x3c6357,'json':!![]};return rp(_0x334c6b)['then'](function(_0xb2954e){if(_0xb2954e['result'][_0xb58a('0x1b')]>0x0){_0x4d0381['endUserId']=_0xb2954e[_0xb58a('0xe')][0x0][_0xb58a('0x10')];logger[_0xb58a('0x11')]('['+[_0x2783b5[_0xb58a('0x12')]()]+_0xb58a('0x29'),_0x4d0381);_0x84d01(_0x4d0381);}else{return createEndUser(_0x2783b5,_0x3c6357,_0x4d0381,_0x5920b7,_0x31c653)[_0xb58a('0xd')](function(_0x34b529){logger[_0xb58a('0x11')]('['+[_0x2783b5['toUpperCase']()]+_0xb58a('0x2a'),_0x34b529);_0x84d01(_0x34b529);});}})['catch'](function(_0x36dfc8){logger['error']('['+[_0x2783b5['toUpperCase']()]+']',_0x36dfc8[_0xb58a('0x15')]);_0x60ac8d(_0x36dfc8[_0xb58a('0x15')]);});});};}function getCustomFields(_0x5f3783,_0x29512e){var _0x105723={};if(_0x5f3783[_0xb58a('0x1b')]>0x0){_[_0xb58a('0x2b')](_0x5f3783,function(_0x4dc765){if(_[_0xb58a('0x2c')](['string',_0xb58a('0x2d')],_0x4dc765['type'])&&_0x4dc765[_0xb58a('0x2e')]&&!_0x4dc765[_0xb58a('0x2f')]){_0x105723[_0x4dc765['nameField']['toLowerCase']()]=_0x4dc765[_0xb58a('0x30')][_0xb58a('0x31')]();}else if(_[_0xb58a('0x2c')]([_0xb58a('0x32'),_0xb58a('0x2d')],_0x4dc765[_0xb58a('0x33')])&&_0x4dc765[_0xb58a('0x34')]&&_0x4dc765[_0xb58a('0x2f')]){_0x105723[_0x4dc765['idField'][_0xb58a('0x35')]()]=_0x4dc765[_0xb58a('0x30')][_0xb58a('0x31')]();}else if(_0x4dc765[_0xb58a('0x33')]===_0xb58a('0x36')&&_0x4dc765['variableName']&&_0x4dc765[_0xb58a('0x34')]&&_0x4dc765['customField']){_0x105723[_0x4dc765[_0xb58a('0x34')][_0xb58a('0x35')]()]=_0x29512e[_0x4dc765[_0xb58a('0x37')]][_0xb58a('0x31')]();}else if(_0x4dc765[_0xb58a('0x33')]===_0xb58a('0x38')&&_0x4dc765[_0xb58a('0x39')]&&_0x4dc765[_0xb58a('0x39')][_0xb58a('0x3a')]&&_0x4dc765[_0xb58a('0x34')]&&_0x4dc765['customField']){_0x105723[_0x4dc765[_0xb58a('0x34')][_0xb58a('0x35')]()]=_0x29512e[_0x4dc765[_0xb58a('0x39')][_0xb58a('0x3a')][_0xb58a('0x35')]()][_0xb58a('0x31')]();}});}return _0x105723;}function getTicket(_0x3e19ea,_0x2003fa,_0x2c8100,_0x497e78,_0x13038b,_0xb9277c){return function(_0x3b4a47){logger[_0xb58a('0x11')]('['+[_0x3e19ea['toUpperCase']()]+_0xb58a('0x3b'),_0x3b4a47);return new Promise(function(_0x480df8,_0x24d13f){var _0xa5be44=_0x3e19ea[_0xb58a('0x35')]()===_0xb58a('0x3c')?_0x3b4a47[_0xb58a('0x1d')]:_0x3b4a47[_0xb58a('0x3d')];var _0x2ebee3={'method':_0xb58a('0x21'),'uri':_0x2c8100+_0xb58a('0x3e')+'?'+_0xb9277c,'body':Object[_0xb58a('0x3f')]({},{'active':_0xb58a('0x25'),'caller_id':_0xa5be44,'assigned_to':_0x3b4a47[_0xb58a('0x1d')],'short_description':intUtil[_0xb58a('0x40')](_0x497e78[_0xb58a('0x41')],_0x13038b,'\x20'),'description':intUtil[_0xb58a('0x40')](_0x497e78[_0xb58a('0x42')],_0x13038b,'\x0a')},getCustomFields(_0x497e78[_0xb58a('0x43')],_0x13038b)),'auth':_0x2003fa,'json':!![]};return rp(_0x2ebee3)[_0xb58a('0xd')](function(_0x177f44){logger[_0xb58a('0x11')]('['+[_0x3e19ea[_0xb58a('0x12')]()]+_0xb58a('0x44'),_0x177f44[_0xb58a('0xe')]);_0x3b4a47[_0xb58a('0x45')]=_0x177f44[_0xb58a('0xe')][_0xb58a('0x10')];_0x3b4a47['ticketNumber']=_0x177f44[_0xb58a('0xe')][_0xb58a('0x46')];logger[_0xb58a('0x11')]('['+[_0x3e19ea['toUpperCase']()]+_0xb58a('0x47'),_0x3b4a47);_0x480df8(_0x3b4a47);})[_0xb58a('0x13')](function(_0x4ebb0b){logger[_0xb58a('0x14')]('['+[_0x3e19ea[_0xb58a('0x12')]()]+']',_0x4ebb0b[_0xb58a('0x15')]);_0x24d13f(_0x4ebb0b['message']);});});};}function createRemoteTag(_0x1d93c2,_0x9c03c1,_0x2b148e,_0x43a858){return new Promise(function(_0x59001f,_0x325b15){var _0x17e61f={'method':_0xb58a('0x21'),'uri':_0x2b148e+_0xb58a('0x48')+'?'+_0x43a858,'body':{'short_description':_0x1d93c2,'global':!![],'active':!![],'name':_0x1d93c2},'auth':_0x9c03c1,'json':!![]};return rp(_0x17e61f)[_0xb58a('0xd')](function(_0xcd762b){var _0x26656b=_0xcd762b['result'][_0xb58a('0x10')];_0x59001f(_0x26656b);});});}function getRemoteTag(_0x5737cc,_0x4cce33,_0x10e690,_0x115a23,_0x27fe15){return new Promise(function(_0x2ac820,_0x555d32){var _0x11e189={'method':_0xb58a('0xb'),'uri':_0x10e690+'label'+_0xb58a('0x49')+_0x5737cc+'&'+_0x115a23,'auth':_0x4cce33,'json':!![]};return rp(_0x11e189)[_0xb58a('0xd')](function(_0x14deac){if(_0x14deac[_0xb58a('0xe')][_0xb58a('0x1b')]>0x0){var _0x1ddbc8=_0x14deac[_0xb58a('0xe')][0x0]['sys_id'];_0x2ac820(_0x1ddbc8);}else{return createRemoteTag(_0x5737cc,_0x4cce33,_0x10e690,_0x115a23)[_0xb58a('0xd')](function(_0x11a703){_0x2ac820(_0x11a703);});}});});}function assignTagToIncident(_0x4313c2,_0x5e85e1,_0x50cd94,_0x4ee2ef,_0x523b03){return new Promise(function(_0x40b61d,_0x3bc855){var _0x225454={'method':'POST','uri':_0x50cd94+_0xb58a('0x4a')+'?'+_0x523b03,'body':{'label':_0x4313c2,'table':_0xb58a('0x3e'),'id_type':_0xb58a('0x4b'),'table_key':_0x4ee2ef[_0xb58a('0x45')],'title':_0xb58a('0x4c')+_0x4ee2ef['ticketNumber'],'id_display':_0x4ee2ef[_0xb58a('0x4d')]},'auth':_0x5e85e1,'json':!![]};return rp(_0x225454)['then'](function(_0x20ed5a){_0x40b61d();})['catch'](function(){_0x40b61d();});});}function manageTags(_0x3497ee,_0x598620,_0x425caf,_0x4f277c,_0x9fa8d8,_0xcaafe1,_0x37d135){return new Promise(function(_0x5e6c23,_0x1ce503){var _0x3ba41f=[];_0x598620[_0xb58a('0x2b')](function(_0x56ff0a){_0x3ba41f[_0xb58a('0x4e')](getRemoteTag(_0x56ff0a,_0x425caf,_0x4f277c,_0xcaafe1,_0x37d135));});return Promise[_0xb58a('0x4f')](_0x3ba41f)[_0xb58a('0xd')](function(_0x10edaa){if(_0x10edaa['length']){logger[_0xb58a('0x11')]('['+[_0x3497ee[_0xb58a('0x12')]()]+_0xb58a('0x50'),_0x10edaa);var _0x3099cd=[];_0x10edaa[_0xb58a('0x2b')](function(_0x285e46){_0x3099cd['push'](assignTagToIncident(_0x285e46,_0x425caf,_0x4f277c,_0x9fa8d8,_0xcaafe1));});return Promise[_0xb58a('0x4f')](_0x3099cd)[_0xb58a('0xd')](function(){_0x5e6c23();})[_0xb58a('0x13')](function(){_0x5e6c23();});}else{_0x5e6c23();}});});}function getTags(_0x48e971,_0x2ac95c,_0x35afa0,_0x5173c5,_0x4e988d,_0x54f8a6){return function(_0x2d8619){return new Promise(function(_0xe4db89,_0x183416){var _0x3317c0=[];var _0x3e9c06=_0x5173c5[_0xb58a('0x51')];if(_0x3e9c06&&_0x3e9c06['length']>0x0){_0x3317c0=_[_0xb58a('0x52')](_0x3e9c06,_0xb58a('0x3a'));}if(_0x3317c0['length']>0x0){return manageTags(_0x48e971,_0x3317c0,_0x2ac95c,_0x35afa0,_0x2d8619,_0x4e988d,_0x54f8a6)['then'](function(){_0xe4db89(_0x2d8619);});}else{_0xe4db89(_0x2d8619);}});};}function emit(_0x25629e,_0x4ea658,_0xf4c84){var _0x281744=_0xb58a('0x53')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xb58a('0x54')+'%255EORDERBYDESCnumber';var _0x3be4b7={'uri':_0x25629e+_0xb58a('0x55')+_0xf4c84+_0x281744};io['to'](util[_0xb58a('0x56')](_0xb58a('0x57'),_0x4ea658))['emit'](_0xb58a('0x58'),_0x3be4b7);}exports['cs']=function(_0xcf27f0,_0x3617e1,_0x5073dd,_0x444773,_0x57b348,_0xc7e441,_0x4a004e,_0x5e1d45){var _0x38fbda={};var _0x59e479={'user':_0xc7e441[_0xb58a('0x59')],'pass':_0xc7e441[_0xb58a('0x5a')]};var _0x4f6125=_0xb58a('0x5b');var _0x47a4ae='sysparm_display_value=true';_0xc7e441[_0xb58a('0x5c')]=intUtil[_0xb58a('0x5d')](_0xc7e441[_0xb58a('0x5c')]);_0xc7e441[_0xb58a('0x5e')]=intUtil[_0xb58a('0x5d')](_0xc7e441[_0xb58a('0x5e')]);var _0x269790=util[_0xb58a('0x56')](_0xb58a('0x5f'),_0xc7e441[_0xb58a('0x5c')]);_0x38fbda[_0xb58a('0x17')]=!_[_0xb58a('0x60')](_0x444773)?_0x444773[_0xb58a('0x61')]:null;_0x38fbda[_0xb58a('0x1e')]=_0xc7e441[_0xb58a('0x61')];_0x38fbda[_0xb58a('0x23')]=_0x5e1d45[_0xb58a('0x35')]()===_0xb58a('0x3c')?_0x3617e1[_0xb58a('0x62')]:_0x3617e1[_0xb58a('0x63')];_0x38fbda[_0xb58a('0x64')]=_0x5e1d45===_0xb58a('0x65')||_0x5e1d45===_0xb58a('0x66')?'queue':_0xb58a('0x3c');var _0x1405ee=util[_0xb58a('0x56')](_0xb58a('0x67'),_0xc7e441[_0xb58a('0x5e')],_0x3617e1[_0xb58a('0x68')],md5(_0x3617e1[_0xb58a('0x68')]));if(_0x57b348&&_0x57b348[_0xb58a('0x69')]){logger[_0xb58a('0x11')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3617e1[_0xb58a('0x6a')]=_0x1405ee;}else if(_0x4a004e&&_0x4a004e[_0xb58a('0x6b')]&&_0x4a004e[_0xb58a('0x6b')]!==_0xb58a('0x6c')){logger[_0xb58a('0x11')](_0xb58a('0x6d'),_0xb58a('0x6e'));_0x3617e1[_0xb58a('0x6a')]=_0x1405ee;}else{_0x3617e1[_0xb58a('0x6a')]='';}return getAdminUser(_0x5e1d45,_0x59e479,_0x38fbda,_0x269790,_0x47a4ae,_0x4f6125)[_0xb58a('0xd')](getUser(_0x5e1d45,_0x59e479,_0x269790,_0x47a4ae,_0x4f6125))[_0xb58a('0xd')](getEndUser(_0x5e1d45,_0x59e479,_0x269790,_0x47a4ae,_0x4f6125))['then'](getTicket(_0x5e1d45,_0x59e479,_0x269790,_0x5073dd,_0x3617e1,_0x47a4ae))[_0xb58a('0xd')](function(_0x4e978f){logger[_0xb58a('0x11')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x4e978f['ticketId']));logger[_0xb58a('0x11')](util[_0xb58a('0x56')](_0xb58a('0x6f'),_0x5e1d45));if(_0x5e1d45!==_0xb58a('0x66')){logger[_0xb58a('0x11')]('['+[_0x5e1d45['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xc7e441[_0xb58a('0x5c')],_0x444773['name'],_0x4e978f['ticketId']);}})[_0xb58a('0x13')](function(_0x433c5b){logger[_0xb58a('0x14')]('['+[_0x5e1d45[_0xb58a('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x433c5b,{'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 cb4a49c..cf2c16c 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 _0x5a32=['getString','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','forEach','variableName','push','idField','JSON','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','length','find','name_value_list','Agent\x20found!','resolve','value','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','entry_list','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','nameField','customField','toLowerCase','type','string','custom_fields','content','Variable','POST','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridnum','trigger:browser:url','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','isNil','calleridnum','request-promise','md5','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name'];(function(_0x215df6,_0x287fb1){var _0x48db2f=function(_0x49f24c){while(--_0x49f24c){_0x215df6['push'](_0x215df6['shift']());}};_0x48db2f(++_0x287fb1);}(_0x5a32,0x1c5));var _0x25a3=function(_0x519011,_0xb09484){_0x519011=_0x519011-0x0;var _0x558a53=_0x5a32[_0x519011];return _0x558a53;};'use strict';var _=require('lodash');var rp=require(_0x25a3('0x0'));var BPromise=require('bluebird');var md5=require(_0x25a3('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x25a3('0x2'))(_0x25a3('0x3'));config[_0x25a3('0x4')]=_[_0x25a3('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x25a3('0x6'))(new Redis(config[_0x25a3('0x4')]));var def={'method':'POST','json':!![]};function emit(_0x2b5350,_0x3d732d,_0x11a28b){io['to'](_0x2b5350)[_0x25a3('0x7')](_0x3d732d,_0x11a28b);}function getTicket(_0x3892c8,_0x31179e,_0x495704,_0x53218e,_0x2f6b15,_0xb6a02c,_0xf48e82,_0x51135c){logger[_0x25a3('0x8')](_0x25a3('0x9'));var _0x3ac1e0=new Date();var _0x3fcb0c=[{'name':_0x25a3('0xa'),'value':intUtil[_0x25a3('0xb')](_0x53218e['Subjects'],_0x2f6b15,'\x20')},{'name':'assigned_user_id','value':_0x31179e['id']},{'name':'created_by','value':_0x31179e['id']},{'name':_0x25a3('0xc'),'value':intUtil[_0x25a3('0xb')](_0x53218e[_0x25a3('0xd')],_0x2f6b15,'\x0a')},{'name':'date_start','value':_0x3ac1e0[_0x25a3('0xe')]()[_0x25a3('0xf')](0x0,0x13)[_0x25a3('0x10')]('T','\x20')},{'name':_0x25a3('0x11'),'value':'0'},{'name':_0x25a3('0x12'),'value':'15'},{'name':_0x25a3('0x13'),'value':_0x495704['id']},{'name':_0x25a3('0x14'),'value':_0x25a3('0x15')},{'name':'parent_name','value':_0x495704[_0x25a3('0xa')]},{'name':_0x25a3('0x16'),'value':_0x51135c}];if(_0xb6a02c['length']){_[_0x25a3('0x17')](_0xb6a02c,function(_0x4fdb2a){if(_0x2f6b15[_0x4fdb2a[_0x25a3('0x18')]]){_0x3fcb0c[_0x25a3('0x19')]({'name':_0x4fdb2a[_0x25a3('0x1a')],'value':_0x2f6b15[_0x4fdb2a[_0x25a3('0x18')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x25a3('0x1b'),'response_type':_0x25a3('0x1b'),'rest_data':JSON['stringify']({'session':_0xf48e82['id'],'module_name':_0x25a3('0x1c'),'name_value_list':_0x3fcb0c})}});}function getAuth(_0x54b12f){return util[_0x25a3('0x1d')](_0x25a3('0x1e'),new Buffer(_0x54b12f[_0x25a3('0x1f')]+':X')[_0x25a3('0x20')]('base64'));}function getServerInfo(_0x33771c){return request({'form':{'method':_0x25a3('0x21'),'input_type':_0x25a3('0x1b'),'response_type':_0x25a3('0x1b'),'rest_data':JSON[_0x25a3('0x22')]({'session':_0x33771c['id']})}});}function getUser(_0x54c20e,_0x1cb12d,_0x506bda){if(!_['isNil'](_0x1cb12d)){logger[_0x25a3('0x8')](_0x25a3('0x23'),_0x1cb12d);return request({'form':{'method':_0x25a3('0x24'),'input_type':_0x25a3('0x1b'),'response_type':_0x25a3('0x1b'),'rest_data':JSON[_0x25a3('0x22')]({'session':_0x506bda['id'],'module_name':_0x25a3('0x25'),'query':util[_0x25a3('0x1d')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1cb12d),'order_by':'','offset':'0','select_fields':['id',_0x25a3('0xa'),_0x25a3('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x25a3('0x27')](function(_0x36cbdc){if(_0x36cbdc['entry_list'][_0x25a3('0x28')]){var _0x139367=_[_0x25a3('0x29')](_0x36cbdc['entry_list'],function(_0xb836ba){return _0xb836ba[_0x25a3('0x2a')]['user_name']['value']===_0x1cb12d;});if(_0x139367){logger[_0x25a3('0x8')](_0x25a3('0x2b'));return BPromise[_0x25a3('0x2c')]({'id':_0x139367['name_value_list']['id'][_0x25a3('0x2d')],'name':_0x139367['name_value_list'][_0x25a3('0xa')][_0x25a3('0x2d')]});}}logger[_0x25a3('0x8')](_0x25a3('0x2e'));return BPromise[_0x25a3('0x2c')]({'id':_0x506bda['name_value_list'][_0x25a3('0x2f')][_0x25a3('0x2d')],'name':_0x506bda[_0x25a3('0x2a')][_0x25a3('0x26')][_0x25a3('0x2d')]});});}else{logger[_0x25a3('0x8')](_0x25a3('0x30'));return BPromise[_0x25a3('0x2c')]({'id':_0x506bda[_0x25a3('0x2a')]['user_id']['value'],'name':_0x506bda['name_value_list']['user_name'][_0x25a3('0x2d')]});}}function getEndUser(_0x430483,_0x34dbd6,_0x246a02,_0x4953b6){logger[_0x25a3('0x8')](_0x25a3('0x31'),_0x246a02);return request({'form':{'method':_0x25a3('0x24'),'input_type':_0x25a3('0x1b'),'response_type':'JSON','rest_data':JSON[_0x25a3('0x22')]({'session':_0x4953b6['id'],'module_name':_0x25a3('0x15'),'query':util['format'](_0x25a3('0x32'),_0x246a02),'order_by':'','offset':'0','select_fields':['id',_0x25a3('0xa'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x25a3('0x27')](function(_0x38764b){if(_0x38764b[_0x25a3('0x33')][_0x25a3('0x28')]){var _0x23bfe5=_[_0x25a3('0x29')](_0x38764b[_0x25a3('0x33')],function(_0x4e9d2c){return _0x4e9d2c[_0x25a3('0x2a')][_0x25a3('0x34')]['value']===_0x246a02;});if(_0x23bfe5){logger['info'](_0x25a3('0x35'));return BPromise[_0x25a3('0x2c')]({'id':_0x23bfe5['name_value_list']['id'][_0x25a3('0x2d')],'name':_0x23bfe5[_0x25a3('0x2a')][_0x25a3('0xa')]['value'],'phone':_0x23bfe5[_0x25a3('0x2a')]['phone_home'][_0x25a3('0x2d')]});}}else{logger[_0x25a3('0x8')](_0x25a3('0x36'));return request({'form':{'method':_0x25a3('0x37'),'input_type':'JSON','response_type':_0x25a3('0x1b'),'rest_data':JSON[_0x25a3('0x22')]({'session':_0x4953b6['id'],'module_name':_0x25a3('0x15'),'name_value_list':[{'name':_0x25a3('0x38'),'value':_0x34dbd6!==_0x25a3('0x39')?_0x34dbd6:util[_0x25a3('0x1d')](_0x25a3('0x3a'),_0x246a02)},{'name':_0x25a3('0x34'),'value':_0x246a02}]})}})[_0x25a3('0x27')](function(_0x1e6b31){logger[_0x25a3('0x8')](_0x25a3('0x3b'));return BPromise[_0x25a3('0x2c')]({'id':_0x1e6b31['id'],'name':_0x1e6b31[_0x25a3('0x33')][_0x25a3('0x38')][_0x25a3('0x2d')],'phone':_0x1e6b31[_0x25a3('0x33')][_0x25a3('0x34')][_0x25a3('0x2d')]});});}});}function request(_0x491f2d){logger['debug'](_0x25a3('0x3c'),JSON[_0x25a3('0x22')](_0x491f2d));return rp(_[_0x25a3('0x3d')](def,_0x491f2d));}function getTags(_0x47f7ed,_0x5eac97){var _0x154af6=[];if(_0x47f7ed&&_0x47f7ed[_0x25a3('0x28')]>0x0){_0x154af6=_[_0x25a3('0x3e')](_0x47f7ed,_0x5eac97);}return _0x154af6;}function getCustomFields(_0x4fa0d6,_0x392cf0){var _0x36ebf9=[];var _0x4f7cbc={'custom_fields':[]};if(_0x4fa0d6[_0x25a3('0x28')]>0x0){_[_0x25a3('0x17')](_0x4fa0d6,function(_0x2c902f){if(_0x2c902f['type']==='string'&&_0x2c902f[_0x25a3('0x3f')]&&!_0x2c902f[_0x25a3('0x40')]){_0x4f7cbc[_0x2c902f['nameField'][_0x25a3('0x41')]()]=_0x2c902f['content'][_0x25a3('0x20')]();}else if(_0x2c902f[_0x25a3('0x42')]===_0x25a3('0x43')&&_0x2c902f[_0x25a3('0x1a')]&&_0x2c902f[_0x25a3('0x40')]){_0x4f7cbc[_0x25a3('0x44')]['push']({'id':_0x2c902f['idField'],'value':_0x2c902f[_0x25a3('0x45')][_0x25a3('0x20')]()});}else if(_0x2c902f['type']==='variable'&&_0x2c902f[_0x25a3('0x18')]&&_0x2c902f['idField']&&_0x2c902f[_0x25a3('0x40')]){_0x392cf0[_0x2c902f[_0x25a3('0x18')]]&&_0x4f7cbc[_0x25a3('0x44')][_0x25a3('0x19')]({'id':_0x2c902f[_0x25a3('0x1a')],'value':_0x392cf0[_0x2c902f['variableName']][_0x25a3('0x20')]()});}else if(_0x2c902f['type']==='customVariable'&&_0x2c902f[_0x25a3('0x46')]&&_0x2c902f[_0x25a3('0x46')]['name']&&_0x2c902f[_0x25a3('0x1a')]&&_0x2c902f[_0x25a3('0x40')]){_0x392cf0[_0x2c902f[_0x25a3('0x46')][_0x25a3('0xa')][_0x25a3('0x41')]()]&&_0x4f7cbc[_0x25a3('0x44')][_0x25a3('0x19')]({'id':_0x2c902f[_0x25a3('0x1a')],'value':_0x392cf0[_0x2c902f[_0x25a3('0x46')][_0x25a3('0xa')][_0x25a3('0x41')]()]['toString']()});}});}return _0x4f7cbc;}function getConnection(_0x40f78e){return request({'method':_0x25a3('0x47'),'form':{'method':_0x25a3('0x48'),'input_type':_0x25a3('0x1b'),'response_type':_0x25a3('0x1b'),'rest_data':JSON[_0x25a3('0x22')]({'user_auth':{'user_name':_0x40f78e[_0x25a3('0x49')],'password':_0x40f78e['password'],'encryption':_0x25a3('0x4a')},'application':_0x25a3('0x4b')})}})[_0x25a3('0x27')](function(_0x38a9a3){var _0x1f15ba=_0x38a9a3;if(_0x1f15ba['id']){def[_0x25a3('0x4c')]=_0x1f15ba['id'];return BPromise[_0x25a3('0x2c')](_0x1f15ba);}else{throw new Error(util[_0x25a3('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x40f78e['id']));}});}function setRelationship(_0x4b1e65,_0x5d5cff,_0x11cf60,_0x5ef2e7){return request({'form':{'method':_0x25a3('0x4d'),'input_type':_0x25a3('0x1b'),'response_type':_0x25a3('0x1b'),'rest_data':JSON[_0x25a3('0x22')]({'session':_0x4b1e65['id'],'module_name':'Calls','module_id':_0x11cf60['id'],'link_field_name':_0x5ef2e7,'related_ids':[_0x5d5cff['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x25a3('0x4e')]=function(_0x1d6c94,_0xf22e3e,_0x468a46,_0xcde6f1,_0x4712a2,_0x26d376){var _0x39f459,_0x5e8ece,_0x1609d6,_0x2acbcb;_0x26d376['remoteUri']=intUtil[_0x25a3('0x4f')](_0x26d376[_0x25a3('0x50')]);_0x26d376['serverUrl']=intUtil[_0x25a3('0x4f')](_0x26d376[_0x25a3('0x51')]);def[_0x25a3('0x52')]=util[_0x25a3('0x1d')]('%s/service/v4_1/rest.php',_0x26d376['remoteUri']);if(_0x4712a2&&_0x4712a2[_0x25a3('0x53')]){logger[_0x25a3('0x8')]('[QUEUE]',_0x25a3('0x54'));_0xf22e3e[_0x25a3('0x55')]=util['format'](_0x25a3('0x56'),_0x26d376[_0x25a3('0x51')],_0xf22e3e[_0x25a3('0x57')],md5(_0xf22e3e[_0x25a3('0x57')]));}else{_0xf22e3e[_0x25a3('0x55')]='';}return getConnection(_0x26d376)[_0x25a3('0x27')](function(_0x26dd59){_0x2acbcb=_0x26dd59;return getUser(_0x26d376,_0xcde6f1[_0x25a3('0xa')],_0x2acbcb);})[_0x25a3('0x27')](function(_0x5efd8b){_0x39f459=_0x5efd8b;logger[_0x25a3('0x8')](_0x25a3('0x58'),_0x39f459['id']);return getEndUser(_0x26d376,_0xf22e3e[_0x25a3('0x59')],_0xf22e3e['calleridnum'],_0x2acbcb);})[_0x25a3('0x27')](function(_0x4884df){_0x5e8ece=_0x4884df;logger[_0x25a3('0x8')](_0x25a3('0x5a'),_0x5e8ece['id']);return getTicket(_0x26d376,_0x39f459,_0x5e8ece,_0x468a46,_0xf22e3e,_0x468a46[_0x25a3('0x5b')],_0x2acbcb,_0x25a3('0x5c'));})[_0x25a3('0x27')](function(_0x2df56c){_0x1609d6=_0x2df56c;logger[_0x25a3('0x8')](_0x25a3('0x5d'));logger[_0x25a3('0x8')]('The\x20Ticket\x20ID\x20is:',_0x1609d6['id']);return setRelationship(_0x2acbcb,_0x39f459,_0x1609d6,_0x25a3('0x5e'));})['then'](function(){return setRelationship(_0x2acbcb,_0x5e8ece,_0x1609d6,_0x25a3('0x5f'));})[_0x25a3('0x27')](function(){return getServerInfo(_0x2acbcb);})[_0x25a3('0x27')](function(_0x4d1ce8){var _0x14d950=parseInt(_0x4d1ce8[_0x25a3('0x60')][_0x25a3('0x61')](0x0));var _0x15a3f9=util['format'](_0x25a3('0x62'),_0x26d376[_0x25a3('0x50')],_0x1609d6['id']);if(_0x14d950>0x6){_0x15a3f9=util['format'](_0x25a3('0x63'),_0x26d376[_0x25a3('0x50')],_0x1609d6['id']);}logger[_0x25a3('0x8')](_0x25a3('0x64'),_0x25a3('0x65'));emit(util[_0x25a3('0x1d')](_0x25a3('0x66'),_0xcde6f1[_0x25a3('0xa')]),'trigger:browser:url',{'uri':_0x15a3f9});})[_0x25a3('0x67')](function(_0x2ee3e0){logger[_0x25a3('0x68')](_0x25a3('0x64'),JSON[_0x25a3('0x22')](_0x2ee3e0));});};exports['outbound']=function(_0x179fe1,_0x178335,_0x530fbb,_0x37975b,_0x212948,_0x2220cb,_0x4b7abf){var _0x647133,_0x5d5548,_0x58529c,_0x193f3c;_0x2220cb[_0x25a3('0x50')]=intUtil['stripTrailingSlash'](_0x2220cb[_0x25a3('0x50')]);_0x2220cb[_0x25a3('0x51')]=intUtil[_0x25a3('0x4f')](_0x2220cb[_0x25a3('0x51')]);def[_0x25a3('0x52')]=util['format']('%s/service/v4_1/rest.php',_0x2220cb['remoteUri']);if(_0x4b7abf&&_0x4b7abf[_0x25a3('0x69')]&&_0x4b7abf[_0x25a3('0x69')]!==_0x25a3('0x6a')){logger['info'](_0x25a3('0x6b'),_0x25a3('0x54'));_0x178335[_0x25a3('0x55')]=util[_0x25a3('0x1d')](_0x25a3('0x56'),_0x2220cb[_0x25a3('0x51')],_0x178335[_0x25a3('0x57')],md5(_0x178335[_0x25a3('0x57')]));}return getConnection(_0x2220cb)[_0x25a3('0x27')](function(_0x49b655){_0x193f3c=_0x49b655;return getUser(_0x2220cb,_0x37975b[_0x25a3('0xa')],_0x193f3c);})[_0x25a3('0x27')](function(_0x4b03a2){_0x647133=_0x4b03a2;logger[_0x25a3('0x8')](_0x25a3('0x58'),_0x647133['id']);return getEndUser(_0x2220cb,_0x178335['destcalleridname'],_0x178335[_0x25a3('0x6c')],_0x193f3c);})[_0x25a3('0x27')](function(_0x4ea706){_0x5d5548=_0x4ea706;logger[_0x25a3('0x8')]('The\x20Enduser\x20ID\x20is:',_0x5d5548['id']);return getTicket(_0x2220cb,_0x647133,_0x5d5548,_0x530fbb,_0x178335,_0x530fbb[_0x25a3('0x5b')],_0x193f3c,'Outbound');})[_0x25a3('0x27')](function(_0x3a0b54){_0x58529c=_0x3a0b54;logger[_0x25a3('0x8')](_0x25a3('0x5d'));logger[_0x25a3('0x8')]('The\x20Ticket\x20ID\x20is:',_0x58529c['id']);return setRelationship(_0x193f3c,_0x647133,_0x58529c,_0x25a3('0x5e'));})[_0x25a3('0x27')](function(){return setRelationship(_0x193f3c,_0x5d5548,_0x58529c,_0x25a3('0x5f'));})[_0x25a3('0x27')](function(){return getServerInfo(_0x193f3c);})[_0x25a3('0x27')](function(_0x169097){var _0x44cb4b=parseInt(_0x169097[_0x25a3('0x60')]['charAt'](0x0));var _0x2e8e1c=util['format'](_0x25a3('0x62'),_0x2220cb[_0x25a3('0x50')],_0x58529c['id']);if(_0x44cb4b>0x6){_0x2e8e1c=util[_0x25a3('0x1d')](_0x25a3('0x63'),_0x2220cb['remoteUri'],_0x58529c['id']);}logger[_0x25a3('0x8')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x25a3('0x1d')](_0x25a3('0x66'),_0x37975b[_0x25a3('0xa')]),_0x25a3('0x6d'),{'uri':_0x2e8e1c});})['catch'](function(_0x41cbc2){logger[_0x25a3('0x68')](_0x25a3('0x6b'),JSON[_0x25a3('0x22')](_0x41cbc2));});};exports[_0x25a3('0x6e')]=function(_0x3acbfa,_0x1f363a,_0x2ab0c4,_0x4f65ee,_0x470faf,_0x463e70){var _0x2b4770,_0x367236,_0x416765,_0xc73ef0;_0x463e70[_0x25a3('0x50')]=intUtil['stripTrailingSlash'](_0x463e70[_0x25a3('0x50')]);_0x463e70[_0x25a3('0x51')]=intUtil['stripTrailingSlash'](_0x463e70[_0x25a3('0x51')]);def[_0x25a3('0x52')]=util['format'](_0x25a3('0x6f'),_0x463e70['remoteUri']);if(_0x470faf&&_0x470faf[_0x25a3('0x53')]){logger[_0x25a3('0x8')]('['+_0x1f363a[_0x25a3('0x70')][_0x25a3('0x71')]()+']',_0x25a3('0x54'));_0x1f363a['recordingURL']=util[_0x25a3('0x1d')](_0x25a3('0x56'),_0x463e70['serverUrl'],_0x1f363a['uniqueid'],md5(_0x1f363a[_0x25a3('0x57')]));}else{_0x1f363a['recordingURL']='';}return getConnection(_0x463e70)[_0x25a3('0x27')](function(_0x3b4ba2){_0xc73ef0=_0x3b4ba2;if(!_[_0x25a3('0x72')](_0x4f65ee)){return getUser(_0x463e70,_0x4f65ee[_0x25a3('0xa')],_0xc73ef0);}else{return getUser(_0x463e70,null,_0xc73ef0);}})[_0x25a3('0x27')](function(_0x3bb031){_0x2b4770=_0x3bb031;logger[_0x25a3('0x8')](_0x25a3('0x58'),_0x2b4770['id']);return getEndUser(_0x463e70,_0x1f363a[_0x25a3('0x59')],_0x1f363a[_0x25a3('0x73')],_0xc73ef0);})[_0x25a3('0x27')](function(_0x31013c){_0x367236=_0x31013c;logger[_0x25a3('0x8')](_0x25a3('0x5a'),_0x367236['id']);return getTicket(_0x463e70,_0x2b4770,_0x367236,_0x2ab0c4,_0x1f363a,_0x2ab0c4[_0x25a3('0x5b')],_0xc73ef0,_0x25a3('0x5c'));})['then'](function(_0x311a54){_0x416765=_0x311a54;logger[_0x25a3('0x8')](_0x25a3('0x5d'));logger[_0x25a3('0x8')]('The\x20Ticket\x20ID\x20is:',_0x416765['id']);return setRelationship(_0xc73ef0,_0x2b4770,_0x416765,'users');})[_0x25a3('0x27')](function(){return setRelationship(_0xc73ef0,_0x367236,_0x416765,'contacts');})[_0x25a3('0x27')](function(){return getServerInfo(_0xc73ef0);})[_0x25a3('0x67')](function(_0x294a5f){logger[_0x25a3('0x68')]('['+_0x1f363a[_0x25a3('0x70')][_0x25a3('0x71')]()+']',JSON['stringify'](_0x294a5f));});}; \ No newline at end of file +var _0xf120=['user:%s','trigger:browser:url','recordingFormat','none','Outbound','Ticket\x20created!','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','[OUTBOUND]','unmanaged','lastevent','toUpperCase','isNil','Inbound','error','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','defaults','redis','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','getString','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','merge','type','string','toLowerCase','content','customField','variable','custom_fields','customVariable','Variable','login','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x2f60f5,_0xcbf7cb){var _0x28ec03=function(_0x54928a){while(--_0x54928a){_0x2f60f5['push'](_0x2f60f5['shift']());}};_0x28ec03(++_0xcbf7cb);}(_0xf120,0x165));var _0x0f12=function(_0x1b39d3,_0x2c7131){_0x1b39d3=_0x1b39d3-0x0;var _0x4c20da=_0xf120[_0x1b39d3];return _0x4c20da;};'use strict';var _=require('lodash');var rp=require(_0x0f12('0x0'));var BPromise=require(_0x0f12('0x1'));var md5=require(_0x0f12('0x2'));var util=require(_0x0f12('0x3'));var Redis=require(_0x0f12('0x4'));var intUtil=require(_0x0f12('0x5'));var config=require('../../../../config/environment');var logger=require(_0x0f12('0x6'))('sugarcrm');config['redis']=_[_0x0f12('0x7')](config[_0x0f12('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x0f12('0x9'))(new Redis(config[_0x0f12('0x8')]));var def={'method':_0x0f12('0xa'),'json':!![]};function emit(_0x8aee72,_0x427644,_0x5c9099){io['to'](_0x8aee72)[_0x0f12('0xb')](_0x427644,_0x5c9099);}function getTicket(_0x54b138,_0x39bd27,_0x56a50d,_0xc38129,_0x13e663,_0x3adedd,_0x49680f,_0x5c42f6){logger['info'](_0x0f12('0xc'));var _0x49a52f=new Date();var _0x1e0e01=[{'name':'name','value':intUtil['getString'](_0xc38129[_0x0f12('0xd')],_0x13e663,'\x20')},{'name':_0x0f12('0xe'),'value':_0x39bd27['id']},{'name':_0x0f12('0xf'),'value':_0x39bd27['id']},{'name':'description','value':intUtil[_0x0f12('0x10')](_0xc38129['Descriptions'],_0x13e663,'\x0a')},{'name':_0x0f12('0x11'),'value':_0x49a52f[_0x0f12('0x12')]()[_0x0f12('0x13')](0x0,0x13)[_0x0f12('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x0f12('0x15'),'value':'15'},{'name':_0x0f12('0x16'),'value':_0x56a50d['id']},{'name':_0x0f12('0x17'),'value':_0x0f12('0x18')},{'name':_0x0f12('0x19'),'value':_0x56a50d[_0x0f12('0x1a')]},{'name':'direction','value':_0x5c42f6}];if(_0x3adedd[_0x0f12('0x1b')]){_[_0x0f12('0x1c')](_0x3adedd,function(_0x5d56d5){if(_0x13e663[_0x5d56d5[_0x0f12('0x1d')]]){_0x1e0e01[_0x0f12('0x1e')]({'name':_0x5d56d5[_0x0f12('0x1f')],'value':_0x13e663[_0x5d56d5['variableName']]});}});}return request({'form':{'method':_0x0f12('0x20'),'input_type':'JSON','response_type':_0x0f12('0x21'),'rest_data':JSON[_0x0f12('0x22')]({'session':_0x49680f['id'],'module_name':_0x0f12('0x23'),'name_value_list':_0x1e0e01})}});}function getAuth(_0x59cd25){return util[_0x0f12('0x24')](_0x0f12('0x25'),new Buffer(_0x59cd25['apiKey']+':X')[_0x0f12('0x26')](_0x0f12('0x27')));}function getServerInfo(_0x4e18fe){return request({'form':{'method':_0x0f12('0x28'),'input_type':_0x0f12('0x21'),'response_type':_0x0f12('0x21'),'rest_data':JSON[_0x0f12('0x22')]({'session':_0x4e18fe['id']})}});}function getUser(_0x5c1ad6,_0x303f19,_0x389023){if(!_['isNil'](_0x303f19)){logger[_0x0f12('0x29')](_0x0f12('0x2a'),_0x303f19);return request({'form':{'method':_0x0f12('0x2b'),'input_type':_0x0f12('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x389023['id'],'module_name':_0x0f12('0x2c'),'query':util[_0x0f12('0x24')](_0x0f12('0x2d'),_0x303f19),'order_by':'','offset':'0','select_fields':['id',_0x0f12('0x1a'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0f12('0x2e')](function(_0x3e5f1d){if(_0x3e5f1d[_0x0f12('0x2f')][_0x0f12('0x1b')]){var _0x3f070d=_['find'](_0x3e5f1d[_0x0f12('0x2f')],function(_0xb64a24){return _0xb64a24[_0x0f12('0x30')]['user_name'][_0x0f12('0x31')]===_0x303f19;});if(_0x3f070d){logger['info']('Agent\x20found!');return BPromise[_0x0f12('0x32')]({'id':_0x3f070d[_0x0f12('0x30')]['id']['value'],'name':_0x3f070d[_0x0f12('0x30')][_0x0f12('0x1a')][_0x0f12('0x31')]});}}logger[_0x0f12('0x29')](_0x0f12('0x33'));return BPromise[_0x0f12('0x32')]({'id':_0x389023[_0x0f12('0x30')][_0x0f12('0x34')]['value'],'name':_0x389023[_0x0f12('0x30')]['user_name'][_0x0f12('0x31')]});});}else{logger[_0x0f12('0x29')](_0x0f12('0x35'));return BPromise[_0x0f12('0x32')]({'id':_0x389023[_0x0f12('0x30')]['user_id'][_0x0f12('0x31')],'name':_0x389023[_0x0f12('0x30')]['user_name'][_0x0f12('0x31')]});}}function getEndUser(_0xb65b7c,_0x23a4d5,_0x1ecc6d,_0x331784){logger[_0x0f12('0x29')](_0x0f12('0x36'),_0x1ecc6d);return request({'form':{'method':_0x0f12('0x2b'),'input_type':_0x0f12('0x21'),'response_type':_0x0f12('0x21'),'rest_data':JSON['stringify']({'session':_0x331784['id'],'module_name':_0x0f12('0x18'),'query':util[_0x0f12('0x24')](_0x0f12('0x37'),_0x1ecc6d),'order_by':'','offset':'0','select_fields':['id','name',_0x0f12('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0f12('0x2e')](function(_0x5bb7e6){if(_0x5bb7e6[_0x0f12('0x2f')][_0x0f12('0x1b')]){var _0x570da8=_['find'](_0x5bb7e6[_0x0f12('0x2f')],function(_0x42b7d8){return _0x42b7d8[_0x0f12('0x30')][_0x0f12('0x38')][_0x0f12('0x31')]===_0x1ecc6d;});if(_0x570da8){logger[_0x0f12('0x29')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x570da8[_0x0f12('0x30')]['id'][_0x0f12('0x31')],'name':_0x570da8[_0x0f12('0x30')][_0x0f12('0x1a')]['value'],'phone':_0x570da8[_0x0f12('0x30')][_0x0f12('0x38')][_0x0f12('0x31')]});}}else{logger[_0x0f12('0x29')](_0x0f12('0x39'));return request({'form':{'method':_0x0f12('0x20'),'input_type':_0x0f12('0x21'),'response_type':_0x0f12('0x21'),'rest_data':JSON[_0x0f12('0x22')]({'session':_0x331784['id'],'module_name':'Contacts','name_value_list':[{'name':_0x0f12('0x3a'),'value':_0x23a4d5!==''?_0x23a4d5:util[_0x0f12('0x24')](_0x0f12('0x3b'),_0x1ecc6d)},{'name':_0x0f12('0x38'),'value':_0x1ecc6d}]})}})['then'](function(_0x475f05){logger[_0x0f12('0x29')](_0x0f12('0x3c'));return BPromise[_0x0f12('0x32')]({'id':_0x475f05['id'],'name':_0x475f05['entry_list'][_0x0f12('0x3a')][_0x0f12('0x31')],'phone':_0x475f05[_0x0f12('0x2f')]['phone_home'][_0x0f12('0x31')]});});}});}function request(_0x193c64){logger['debug']('[HTTP]',JSON['stringify'](_0x193c64));return rp(_[_0x0f12('0x3d')](def,_0x193c64));}function getTags(_0x1a0ff8,_0x304aae){var _0x18197f=[];if(_0x1a0ff8&&_0x1a0ff8[_0x0f12('0x1b')]>0x0){_0x18197f=_['map'](_0x1a0ff8,_0x304aae);}return _0x18197f;}function getCustomFields(_0x234924,_0x5603d7){var _0x137423=[];var _0x571d21={'custom_fields':[]};if(_0x234924[_0x0f12('0x1b')]>0x0){_[_0x0f12('0x1c')](_0x234924,function(_0x2f2ce4){if(_0x2f2ce4[_0x0f12('0x3e')]===_0x0f12('0x3f')&&_0x2f2ce4['nameField']&&!_0x2f2ce4['customField']){_0x571d21[_0x2f2ce4['nameField'][_0x0f12('0x40')]()]=_0x2f2ce4[_0x0f12('0x41')][_0x0f12('0x26')]();}else if(_0x2f2ce4[_0x0f12('0x3e')]==='string'&&_0x2f2ce4['idField']&&_0x2f2ce4[_0x0f12('0x42')]){_0x571d21['custom_fields']['push']({'id':_0x2f2ce4[_0x0f12('0x1f')],'value':_0x2f2ce4[_0x0f12('0x41')][_0x0f12('0x26')]()});}else if(_0x2f2ce4[_0x0f12('0x3e')]===_0x0f12('0x43')&&_0x2f2ce4[_0x0f12('0x1d')]&&_0x2f2ce4[_0x0f12('0x1f')]&&_0x2f2ce4['customField']){_0x5603d7[_0x2f2ce4[_0x0f12('0x1d')]]&&_0x571d21[_0x0f12('0x44')][_0x0f12('0x1e')]({'id':_0x2f2ce4[_0x0f12('0x1f')],'value':_0x5603d7[_0x2f2ce4[_0x0f12('0x1d')]][_0x0f12('0x26')]()});}else if(_0x2f2ce4[_0x0f12('0x3e')]===_0x0f12('0x45')&&_0x2f2ce4[_0x0f12('0x46')]&&_0x2f2ce4[_0x0f12('0x46')][_0x0f12('0x1a')]&&_0x2f2ce4[_0x0f12('0x1f')]&&_0x2f2ce4['customField']){_0x5603d7[_0x2f2ce4[_0x0f12('0x46')][_0x0f12('0x1a')][_0x0f12('0x40')]()]&&_0x571d21[_0x0f12('0x44')]['push']({'id':_0x2f2ce4[_0x0f12('0x1f')],'value':_0x5603d7[_0x2f2ce4[_0x0f12('0x46')][_0x0f12('0x1a')][_0x0f12('0x40')]()][_0x0f12('0x26')]()});}});}return _0x571d21;}function getConnection(_0x261704){return request({'method':_0x0f12('0xa'),'form':{'method':_0x0f12('0x47'),'input_type':_0x0f12('0x21'),'response_type':_0x0f12('0x21'),'rest_data':JSON[_0x0f12('0x22')]({'user_auth':{'user_name':_0x261704['username'],'password':_0x261704[_0x0f12('0x48')],'encryption':'PLAIN'},'application':_0x0f12('0x49')})}})[_0x0f12('0x2e')](function(_0x5ce0f1){var _0x2e5acc=_0x5ce0f1;if(_0x2e5acc['id']){def['sessionID']=_0x2e5acc['id'];return BPromise[_0x0f12('0x32')](_0x2e5acc);}else{throw new Error(util[_0x0f12('0x24')](_0x0f12('0x4a'),_0x261704['id']));}});}function setRelationship(_0x3769dd,_0x5a25f9,_0x51980a,_0xc356df){return request({'form':{'method':'set_relationship','input_type':_0x0f12('0x21'),'response_type':'JSON','rest_data':JSON[_0x0f12('0x22')]({'session':_0x3769dd['id'],'module_name':'Calls','module_id':_0x51980a['id'],'link_field_name':_0xc356df,'related_ids':[_0x5a25f9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0f12('0x4b')]=function(_0xea9360,_0x2a7d62,_0x403e1b,_0x3c9a7e,_0x3bc455,_0x1a55d5){var _0x30faf2,_0x3d18f3,_0x12fe2c,_0x16532c;_0x1a55d5[_0x0f12('0x4c')]=intUtil[_0x0f12('0x4d')](_0x1a55d5[_0x0f12('0x4c')]);_0x1a55d5[_0x0f12('0x4e')]=intUtil[_0x0f12('0x4d')](_0x1a55d5[_0x0f12('0x4e')]);def[_0x0f12('0x4f')]=util['format'](_0x0f12('0x50'),_0x1a55d5['remoteUri']);if(_0x3bc455&&_0x3bc455[_0x0f12('0x51')]){logger['info'](_0x0f12('0x52'),_0x0f12('0x53'));_0x2a7d62['recordingURL']=util[_0x0f12('0x24')](_0x0f12('0x54'),_0x1a55d5['serverUrl'],_0x2a7d62[_0x0f12('0x55')],md5(_0x2a7d62['uniqueid']));}else{_0x2a7d62[_0x0f12('0x56')]='';}return getConnection(_0x1a55d5)['then'](function(_0x5448aa){_0x16532c=_0x5448aa;return getUser(_0x1a55d5,_0x3c9a7e[_0x0f12('0x1a')],_0x16532c);})['then'](function(_0x249f80){_0x30faf2=_0x249f80;logger[_0x0f12('0x29')](_0x0f12('0x57'),_0x30faf2['id']);return getEndUser(_0x1a55d5,_0x2a7d62[_0x0f12('0x58')],_0x2a7d62[_0x0f12('0x59')],_0x16532c);})['then'](function(_0x51bda2){_0x3d18f3=_0x51bda2;logger['info'](_0x0f12('0x5a'),_0x3d18f3['id']);return getTicket(_0x1a55d5,_0x30faf2,_0x3d18f3,_0x403e1b,_0x2a7d62,_0x403e1b[_0x0f12('0x5b')],_0x16532c,'Inbound');})[_0x0f12('0x2e')](function(_0x401f22){_0x12fe2c=_0x401f22;logger[_0x0f12('0x29')]('Ticket\x20created!');logger[_0x0f12('0x29')](_0x0f12('0x5c'),_0x12fe2c['id']);return setRelationship(_0x16532c,_0x30faf2,_0x12fe2c,_0x0f12('0x5d'));})['then'](function(){return setRelationship(_0x16532c,_0x3d18f3,_0x12fe2c,_0x0f12('0x5e'));})[_0x0f12('0x2e')](function(){return getServerInfo(_0x16532c);})[_0x0f12('0x2e')](function(_0x149cd1){var _0x4def9b=parseInt(_0x149cd1[_0x0f12('0x5f')][_0x0f12('0x60')](0x0));var _0x43e7c9=util[_0x0f12('0x24')](_0x0f12('0x61'),_0x1a55d5[_0x0f12('0x4c')],_0x12fe2c['id']);if(_0x4def9b>0x6){_0x43e7c9=util[_0x0f12('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1a55d5[_0x0f12('0x4c')],_0x12fe2c['id']);}logger['info']('[QUEUE]',_0x0f12('0x62'));emit(util[_0x0f12('0x24')](_0x0f12('0x63'),_0x3c9a7e['name']),_0x0f12('0x64'),{'uri':_0x43e7c9});})['catch'](function(_0x3e94e8){logger['error'](_0x0f12('0x52'),JSON[_0x0f12('0x22')](_0x3e94e8));});};exports['outbound']=function(_0x438acd,_0x193f49,_0x32160f,_0x3af540,_0x2464fd,_0x6c042b,_0x37ed34){var _0xa55cfe,_0x50049a,_0x5bbaca,_0x2a1801;_0x6c042b[_0x0f12('0x4c')]=intUtil['stripTrailingSlash'](_0x6c042b[_0x0f12('0x4c')]);_0x6c042b['serverUrl']=intUtil['stripTrailingSlash'](_0x6c042b['serverUrl']);def[_0x0f12('0x4f')]=util[_0x0f12('0x24')]('%s/service/v4_1/rest.php',_0x6c042b[_0x0f12('0x4c')]);if(_0x37ed34&&_0x37ed34[_0x0f12('0x65')]&&_0x37ed34[_0x0f12('0x65')]!==_0x0f12('0x66')){logger[_0x0f12('0x29')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x193f49[_0x0f12('0x56')]=util[_0x0f12('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6c042b[_0x0f12('0x4e')],_0x193f49['uniqueid'],md5(_0x193f49[_0x0f12('0x55')]));}return getConnection(_0x6c042b)[_0x0f12('0x2e')](function(_0x3234b4){_0x2a1801=_0x3234b4;return getUser(_0x6c042b,_0x3af540[_0x0f12('0x1a')],_0x2a1801);})[_0x0f12('0x2e')](function(_0xf15079){_0xa55cfe=_0xf15079;logger[_0x0f12('0x29')](_0x0f12('0x57'),_0xa55cfe['id']);return getEndUser(_0x6c042b,_0x193f49['destcalleridname'],_0x193f49['destcalleridnum'],_0x2a1801);})[_0x0f12('0x2e')](function(_0x23ce54){_0x50049a=_0x23ce54;logger[_0x0f12('0x29')](_0x0f12('0x5a'),_0x50049a['id']);return getTicket(_0x6c042b,_0xa55cfe,_0x50049a,_0x32160f,_0x193f49,_0x32160f['Fields'],_0x2a1801,_0x0f12('0x67'));})[_0x0f12('0x2e')](function(_0x1e672c){_0x5bbaca=_0x1e672c;logger[_0x0f12('0x29')](_0x0f12('0x68'));logger['info'](_0x0f12('0x5c'),_0x5bbaca['id']);return setRelationship(_0x2a1801,_0xa55cfe,_0x5bbaca,_0x0f12('0x5d'));})[_0x0f12('0x2e')](function(){return setRelationship(_0x2a1801,_0x50049a,_0x5bbaca,_0x0f12('0x5e'));})[_0x0f12('0x2e')](function(){return getServerInfo(_0x2a1801);})[_0x0f12('0x2e')](function(_0x1039c1){var _0x55130a=parseInt(_0x1039c1['version'][_0x0f12('0x60')](0x0));var _0x2f11f2=util[_0x0f12('0x24')](_0x0f12('0x61'),_0x6c042b[_0x0f12('0x4c')],_0x5bbaca['id']);if(_0x55130a>0x6){_0x2f11f2=util['format'](_0x0f12('0x69'),_0x6c042b[_0x0f12('0x4c')],_0x5bbaca['id']);}logger[_0x0f12('0x29')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3af540[_0x0f12('0x1a')]),'trigger:browser:url',{'uri':_0x2f11f2});})[_0x0f12('0x6a')](function(_0x2d3de7){logger['error'](_0x0f12('0x6b'),JSON[_0x0f12('0x22')](_0x2d3de7));});};exports[_0x0f12('0x6c')]=function(_0x568d36,_0x4b1386,_0x20ef95,_0x3bd9f9,_0xc768fe,_0x3e5b9c){var _0x32250b,_0x20c420,_0x3c51ca,_0x512fef;_0x3e5b9c[_0x0f12('0x4c')]=intUtil[_0x0f12('0x4d')](_0x3e5b9c[_0x0f12('0x4c')]);_0x3e5b9c['serverUrl']=intUtil[_0x0f12('0x4d')](_0x3e5b9c['serverUrl']);def[_0x0f12('0x4f')]=util[_0x0f12('0x24')](_0x0f12('0x50'),_0x3e5b9c[_0x0f12('0x4c')]);if(_0xc768fe&&_0xc768fe[_0x0f12('0x51')]){logger[_0x0f12('0x29')]('['+_0x4b1386[_0x0f12('0x6d')][_0x0f12('0x6e')]()+']',_0x0f12('0x53'));_0x4b1386[_0x0f12('0x56')]=util['format'](_0x0f12('0x54'),_0x3e5b9c[_0x0f12('0x4e')],_0x4b1386[_0x0f12('0x55')],md5(_0x4b1386[_0x0f12('0x55')]));}else{_0x4b1386[_0x0f12('0x56')]='';}return getConnection(_0x3e5b9c)[_0x0f12('0x2e')](function(_0x3589a4){_0x512fef=_0x3589a4;if(!_[_0x0f12('0x6f')](_0x3bd9f9)){return getUser(_0x3e5b9c,_0x3bd9f9[_0x0f12('0x1a')],_0x512fef);}else{return getUser(_0x3e5b9c,null,_0x512fef);}})[_0x0f12('0x2e')](function(_0x5a4868){_0x32250b=_0x5a4868;logger[_0x0f12('0x29')]('The\x20User\x20ID\x20is:',_0x32250b['id']);return getEndUser(_0x3e5b9c,_0x4b1386[_0x0f12('0x58')],_0x4b1386[_0x0f12('0x59')],_0x512fef);})[_0x0f12('0x2e')](function(_0x2ed562){_0x20c420=_0x2ed562;logger[_0x0f12('0x29')]('The\x20Enduser\x20ID\x20is:',_0x20c420['id']);return getTicket(_0x3e5b9c,_0x32250b,_0x20c420,_0x20ef95,_0x4b1386,_0x20ef95['Fields'],_0x512fef,_0x0f12('0x70'));})[_0x0f12('0x2e')](function(_0x4d10df){_0x3c51ca=_0x4d10df;logger[_0x0f12('0x29')]('Ticket\x20created!');logger[_0x0f12('0x29')](_0x0f12('0x5c'),_0x3c51ca['id']);return setRelationship(_0x512fef,_0x32250b,_0x3c51ca,_0x0f12('0x5d'));})[_0x0f12('0x2e')](function(){return setRelationship(_0x512fef,_0x20c420,_0x3c51ca,'contacts');})['then'](function(){return getServerInfo(_0x512fef);})[_0x0f12('0x6a')](function(_0x5153d9){logger[_0x0f12('0x71')]('['+_0x4b1386[_0x0f12('0x6d')]['toUpperCase']()+']',JSON[_0x0f12('0x22')](_0x5153d9));});}; \ 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 021997d..0be27b2 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 _0x44e3=['type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','sortBy','string','push','content'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x44e3,0x108));var _0x344e=function(_0x462753,_0x4b26cd){_0x462753=_0x462753-0x0;var _0x322f0d=_0x44e3[_0x462753];return _0x322f0d;};'use strict';var _=require(_0x344e('0x0'));var util=require(_0x344e('0x1'));exports['getString']=function(_0xd6ad02,_0x2689fe,_0x5ea246){var _0x52653d=[];if(_0xd6ad02['length']>0x0){var _0x3fb8d3=_[_0x344e('0x2')](_0xd6ad02,['id']);for(var _0x43dfbe=0x0;_0x43dfbe<_0x3fb8d3['length'];_0x43dfbe++){var _0x42dc68=_0x3fb8d3[_0x43dfbe];if(_0x42dc68['type']===_0x344e('0x3')){_0x52653d[_0x344e('0x4')](_0x42dc68[_0x344e('0x5')]);}else if(_0x42dc68[_0x344e('0x6')]===_0x344e('0x7')&&_0x42dc68[_0x344e('0x8')]){_0x2689fe[_0x42dc68['variableName']]&&_0x52653d[_0x344e('0x4')](_0x2689fe[_0x42dc68[_0x344e('0x8')]][_0x344e('0x9')]());}else if(_0x42dc68['type']===_0x344e('0xa')&&_0x42dc68[_0x344e('0xb')]&&_0x42dc68['Variable'][_0x344e('0xc')]){_0x2689fe[_0x42dc68[_0x344e('0xb')][_0x344e('0xc')][_0x344e('0xd')]()]&&_0x52653d[_0x344e('0x4')](_0x2689fe[_0x42dc68[_0x344e('0xb')][_0x344e('0xc')]['toLowerCase']()][_0x344e('0x9')]());}else if(_0x42dc68['type']===_0x344e('0xe')){if(_0x42dc68[_0x344e('0xf')]===_0x344e('0x3')&&_0x42dc68[_0x344e('0x10')]){_0x52653d[_0x344e('0x4')](util[_0x344e('0x11')]('%s:\x20%s',_0x42dc68[_0x344e('0x10')],_0x42dc68[_0x344e('0x12')]));}else if(_0x42dc68[_0x344e('0xf')]===_0x344e('0x7')&&_0x42dc68[_0x344e('0x8')]&&_0x42dc68[_0x344e('0x10')]){_0x2689fe[_0x42dc68['variableName']]&&_0x52653d[_0x344e('0x4')](util[_0x344e('0x11')](_0x344e('0x13'),_0x42dc68[_0x344e('0x10')],_0x2689fe[_0x42dc68[_0x344e('0x8')]]));}else if(_0x42dc68[_0x344e('0xf')]==='customVariable'&&_0x42dc68['Variable']&&_0x42dc68['Variable'][_0x344e('0xc')]&&_0x42dc68[_0x344e('0x10')]){_0x2689fe[_0x42dc68[_0x344e('0xb')][_0x344e('0xc')][_0x344e('0xd')]()]&&_0x52653d['push'](util['format'](_0x344e('0x13'),_0x42dc68[_0x344e('0x10')],_0x2689fe[_0x42dc68[_0x344e('0xb')][_0x344e('0xc')][_0x344e('0xd')]()]));}}}}return _0x52653d[_0x344e('0x14')](_0x5ea246);};exports[_0x344e('0x15')]=function(_0x580548){var _0x4eaee5=_0x580548[_0x344e('0x16')](-0x1);if(_0x4eaee5==='/'){_0x580548=_0x580548[_0x344e('0x17')](0x0,_0x580548[_0x344e('0x18')](_0x4eaee5));}return _0x580548;};exports[_0x344e('0x19')]=function(_0x386e8a){if(!_[_0x344e('0x1a')](_0x386e8a)&&_0x386e8a!==''){var _0x1fdd43=/^(([^<>()\[\]\\.,;:\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 _0x1fdd43['test'](String(_0x386e8a)[_0x344e('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x8a3b=['util','getString','length','sortBy','type','content','variableName','push','toString','Variable','name','toLowerCase','keyValue','string','%s:\x20%s','key','keyContent','keyType','variable','format','customVariable','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','test','lodash'];(function(_0x3b90d8,_0x41eb92){var _0x5b9615=function(_0x5dd2fe){while(--_0x5dd2fe){_0x3b90d8['push'](_0x3b90d8['shift']());}};_0x5b9615(++_0x41eb92);}(_0x8a3b,0x8b));var _0xb8a3=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x8a3b[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0xb8a3('0x0'));var util=require(_0xb8a3('0x1'));exports[_0xb8a3('0x2')]=function(_0x55fe02,_0xde8a48,_0x32884e){var _0x4e3f8f=[];if(_0x55fe02[_0xb8a3('0x3')]>0x0){var _0x5b404c=_[_0xb8a3('0x4')](_0x55fe02,['id']);for(var _0x2a0fc2=0x0;_0x2a0fc2<_0x5b404c[_0xb8a3('0x3')];_0x2a0fc2++){var _0x44b8c1=_0x5b404c[_0x2a0fc2];if(_0x44b8c1[_0xb8a3('0x5')]==='string'){_0x4e3f8f['push'](_0x44b8c1[_0xb8a3('0x6')]);}else if(_0x44b8c1[_0xb8a3('0x5')]==='variable'&&_0x44b8c1[_0xb8a3('0x7')]){_0xde8a48[_0x44b8c1['variableName']]&&_0x4e3f8f[_0xb8a3('0x8')](_0xde8a48[_0x44b8c1[_0xb8a3('0x7')]][_0xb8a3('0x9')]());}else if(_0x44b8c1[_0xb8a3('0x5')]==='customVariable'&&_0x44b8c1[_0xb8a3('0xa')]&&_0x44b8c1['Variable'][_0xb8a3('0xb')]){_0xde8a48[_0x44b8c1[_0xb8a3('0xa')][_0xb8a3('0xb')][_0xb8a3('0xc')]()]&&_0x4e3f8f[_0xb8a3('0x8')](_0xde8a48[_0x44b8c1[_0xb8a3('0xa')][_0xb8a3('0xb')][_0xb8a3('0xc')]()][_0xb8a3('0x9')]());}else if(_0x44b8c1[_0xb8a3('0x5')]===_0xb8a3('0xd')){if(_0x44b8c1['keyType']===_0xb8a3('0xe')&&_0x44b8c1['key']){_0x4e3f8f[_0xb8a3('0x8')](util['format'](_0xb8a3('0xf'),_0x44b8c1[_0xb8a3('0x10')],_0x44b8c1[_0xb8a3('0x11')]));}else if(_0x44b8c1[_0xb8a3('0x12')]===_0xb8a3('0x13')&&_0x44b8c1[_0xb8a3('0x7')]&&_0x44b8c1[_0xb8a3('0x10')]){_0xde8a48[_0x44b8c1[_0xb8a3('0x7')]]&&_0x4e3f8f[_0xb8a3('0x8')](util[_0xb8a3('0x14')]('%s:\x20%s',_0x44b8c1[_0xb8a3('0x10')],_0xde8a48[_0x44b8c1[_0xb8a3('0x7')]]));}else if(_0x44b8c1['keyType']===_0xb8a3('0x15')&&_0x44b8c1['Variable']&&_0x44b8c1[_0xb8a3('0xa')][_0xb8a3('0xb')]&&_0x44b8c1['key']){_0xde8a48[_0x44b8c1['Variable'][_0xb8a3('0xb')][_0xb8a3('0xc')]()]&&_0x4e3f8f[_0xb8a3('0x8')](util[_0xb8a3('0x14')](_0xb8a3('0xf'),_0x44b8c1[_0xb8a3('0x10')],_0xde8a48[_0x44b8c1[_0xb8a3('0xa')][_0xb8a3('0xb')][_0xb8a3('0xc')]()]));}}}}return _0x4e3f8f[_0xb8a3('0x16')](_0x32884e);};exports[_0xb8a3('0x17')]=function(_0x410a74){var _0x477343=_0x410a74[_0xb8a3('0x18')](-0x1);if(_0x477343==='/'){_0x410a74=_0x410a74['substring'](0x0,_0x410a74[_0xb8a3('0x19')](_0x477343));}return _0x410a74;};exports[_0xb8a3('0x1a')]=function(_0x25aa63){if(!_['isNil'](_0x25aa63)&&_0x25aa63!==''){var _0x317235=/^(([^<>()\[\]\\.,;:\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 _0x317235[_0xb8a3('0x1b')](String(_0x25aa63)[_0xb8a3('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 7f8d2d5..17f81ac 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2ad46a,_0x12a1bf){var _0x5cb601=function(_0x13983f){while(--_0x13983f){_0x2ad46a['push'](_0x2ad46a['shift']());}};_0x5cb601(++_0x12a1bf);}(_0xe706,0xa3));var _0x6e70=function(_0x26425a,_0x1b4d6f){_0x26425a=_0x26425a-0x0;var _0x12802a=_0xe706[_0x26425a];return _0x12802a;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 69c37cd..5daf96c 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 _0x1401=['ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','authType','password','token','%s/token:%s','username','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','toLowerCase','content','idField','customField','custom_fields','push','type','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Ticket\x20created!'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0x1401,0xc4));var _0x1140=function(_0x457bf8,_0x209a0a){_0x457bf8=_0x457bf8-0x0;var _0x919f94=_0x1401[_0x457bf8];return _0x919f94;};'use strict';var _=require(_0x1140('0x0'));var rp=require(_0x1140('0x1'));var md5=require(_0x1140('0x2'));var util=require(_0x1140('0x3'));var Redis=require(_0x1140('0x4'));var intUtil=require(_0x1140('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x1140('0x6'));config[_0x1140('0x7')]=_[_0x1140('0x8')](config[_0x1140('0x7')],{'host':_0x1140('0x9'),'port':0x18eb});var io=require(_0x1140('0xa'))(new Redis(config[_0x1140('0x7')]));function emit(_0xbeb9d3,_0x325954,_0x3aff64){io['to'](_0xbeb9d3)['emit'](_0x325954,_0x3aff64);}var headers={'Content-Type':_0x1140('0xb'),'Accept':_0x1140('0xb')};function getTicket(_0x3d8170,_0x443857,_0x11fa96,_0x1ddda4,_0x3bddb3){logger[_0x1140('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util['format']('%s/tickets.json',_0x3d8170[_0x1140('0xd')]),'method':_0x1140('0xe'),'body':{'ticket':_[_0x1140('0xf')]({'requester_id':_0x11fa96['id'],'submitter_id':_0x443857?_0x443857['id']:undefined,'assignee_id':_0x443857?_0x443857['id']:undefined,'tags':getTags(_0x1ddda4[_0x1140('0x10')],_0x1140('0x11')),'subject':intUtil[_0x1140('0x12')](_0x1ddda4[_0x1140('0x13')],_0x3bddb3,'\x20'),'description':intUtil['getString'](_0x1ddda4[_0x1140('0x14')],_0x3bddb3,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1140('0x12')](_0x1ddda4[_0x1140('0x14')],_0x3bddb3,'\x0a')}},getCustomFields(_0x1ddda4['Fields'],_0x3bddb3))}})['then'](function(_0x1a9698){logger[_0x1140('0xc')](_0x1140('0x15'));return _0x1a9698[_0x1140('0x16')];});}function getUser(_0x2ddba8,_0x35949a){if(intUtil[_0x1140('0x17')](_0x35949a)){logger[_0x1140('0xc')](_0x1140('0x18'),_0x35949a);return request({'uri':util[_0x1140('0x19')](_0x1140('0x1a'),_0x2ddba8['remoteUri']),'qs':{'query':util[_0x1140('0x19')](_0x1140('0x1b'),_0x35949a)}})[_0x1140('0x1c')](function(_0x4dbe0f){if(_0x4dbe0f[_0x1140('0x1d')]){logger[_0x1140('0xc')](_0x1140('0x1e'));return _[_0x1140('0x1f')](_0x4dbe0f[_0x1140('0x20')],{'email':_0x35949a,'role':_0x1140('0x21')});}else{logger[_0x1140('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1140('0x19')](_0x1140('0x22'),_0x2ddba8[_0x1140('0xd')])})[_0x1140('0x1c')](function(_0x58cee9){logger[_0x1140('0xc')]('Admin\x20account\x20selected.');return _0x58cee9[_0x1140('0x23')];});}});}else{logger[_0x1140('0xc')](_0x1140('0x24'));return request({'uri':util[_0x1140('0x19')](_0x1140('0x22'),_0x2ddba8[_0x1140('0xd')])})[_0x1140('0x1c')](function(_0xeba0ab){logger[_0x1140('0xc')](_0x1140('0x25'));return _0xeba0ab['user'];});}}function getEndUser(_0xf74380,_0x2dd503,_0x10ac8c){logger[_0x1140('0xc')]('Searching\x20enduser\x20with\x20phone',_0x10ac8c);return request({'uri':util[_0x1140('0x19')](_0x1140('0x1a'),_0xf74380[_0x1140('0xd')]),'qs':{'query':util[_0x1140('0x19')](_0x1140('0x26'),_0x10ac8c)}})[_0x1140('0x1c')](function(_0x140fce){var _0x10c174;if(_0x140fce[_0x1140('0x20')][_0x1140('0x27')]){_0x140fce[_0x1140('0x20')]=_['filter'](_0x140fce[_0x1140('0x20')],{'suspended':![],'role':'end-user'});if(_0x140fce['results'][_0x1140('0x27')]){_0x10c174=_['first'](_0x140fce[_0x1140('0x20')]);}}if(_0x10c174){logger[_0x1140('0xc')](_0x1140('0x28'));return _0x10c174;}else{logger[_0x1140('0xc')](_0x1140('0x29'));return request({'uri':util['format'](_0x1140('0x2a'),_0xf74380[_0x1140('0xd')]),'method':_0x1140('0xe'),'body':{'user':{'role':_0x1140('0x2b'),'name':util[_0x1140('0x19')](_0x1140('0x2c'),_0x2dd503||_0x10ac8c),'phone':_0x10ac8c}}})[_0x1140('0x1c')](function(_0x2eaab9){logger[_0x1140('0xc')]('Enduser\x20created.');return _0x2eaab9[_0x1140('0x23')];});}});}function getAuth(_0x47d698){var _0x42bd1d;if(_0x47d698[_0x1140('0x2d')]==='password'){_0x42bd1d=util[_0x1140('0x19')]('%s:%s',_0x47d698['username'],_0x47d698[_0x1140('0x2e')]);}else if(_0x47d698[_0x1140('0x2d')]===_0x1140('0x2f')){_0x42bd1d=util[_0x1140('0x19')](_0x1140('0x30'),_0x47d698[_0x1140('0x31')],_0x47d698['token']);}return util[_0x1140('0x19')]('Basic\x20%s',new Buffer(_0x42bd1d)[_0x1140('0x32')]('base64'));}function request(_0xed5367){logger[_0x1140('0x33')](_0x1140('0x34'),JSON[_0x1140('0x35')](_0xed5367));return rp(_[_0x1140('0x8')](_0xed5367,{'method':_0x1140('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x578ce3,_0x251488){var _0x50a55a=[];if(_0x578ce3&&_0x578ce3[_0x1140('0x27')]>0x0){_0x50a55a=_[_0x1140('0x37')](_0x578ce3,_0x251488);}return _0x50a55a;}function getCustomFields(_0x401699,_0x475e32){var _0x21a951=[];var _0x3d32da={'custom_fields':[]};if(_0x401699[_0x1140('0x27')]>0x0){_[_0x1140('0x38')](_0x401699,function(_0x14a88a){if(_[_0x1140('0x39')]([_0x1140('0x3a'),_0x1140('0x3b')],_0x14a88a['type'])&&_0x14a88a[_0x1140('0x3c')]&&!_0x14a88a['customField']){_0x3d32da[_0x14a88a[_0x1140('0x3c')][_0x1140('0x3d')]()]=_0x14a88a[_0x1140('0x3e')][_0x1140('0x32')]();}else if(_['includes']([_0x1140('0x3a'),_0x1140('0x3b')],_0x14a88a['type'])&&_0x14a88a[_0x1140('0x3f')]&&_0x14a88a[_0x1140('0x40')]){_0x3d32da[_0x1140('0x41')][_0x1140('0x42')]({'id':_0x14a88a[_0x1140('0x3f')],'value':_0x14a88a[_0x1140('0x3e')][_0x1140('0x32')]()});}else if(_0x14a88a[_0x1140('0x43')]==='variable'&&_0x14a88a[_0x1140('0x44')]&&_0x14a88a[_0x1140('0x3f')]&&_0x14a88a[_0x1140('0x40')]){_0x475e32[_0x14a88a['variableName']]&&_0x3d32da[_0x1140('0x41')]['push']({'id':_0x14a88a[_0x1140('0x3f')],'value':_0x475e32[_0x14a88a[_0x1140('0x44')]]['toString']()});}else if(_0x14a88a['type']==='customVariable'&&_0x14a88a[_0x1140('0x45')]&&_0x14a88a['Variable'][_0x1140('0x11')]&&_0x14a88a[_0x1140('0x3f')]&&_0x14a88a[_0x1140('0x40')]){_0x475e32[_0x14a88a[_0x1140('0x45')]['name'][_0x1140('0x3d')]()]&&_0x3d32da[_0x1140('0x41')][_0x1140('0x42')]({'id':_0x14a88a[_0x1140('0x3f')],'value':_0x475e32[_0x14a88a[_0x1140('0x45')]['name'][_0x1140('0x3d')]()][_0x1140('0x32')]()});}});}return _0x3d32da;}exports[_0x1140('0x46')]=function(_0x36d71f,_0x10cb1e,_0x48f178,_0x10c0e9,_0xd49f13,_0x22bf0b){var _0x1e5a2b,_0x3a94cd;_0x22bf0b[_0x1140('0xd')]=intUtil[_0x1140('0x47')](_0x22bf0b[_0x1140('0xd')]);_0x22bf0b[_0x1140('0x48')]=intUtil['stripTrailingSlash'](_0x22bf0b[_0x1140('0x48')]);if(_0xd49f13&&_0xd49f13[_0x1140('0x49')]){logger[_0x1140('0xc')](_0x1140('0x4a'),_0x1140('0x4b'));_0x10cb1e[_0x1140('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22bf0b['serverUrl'],_0x10cb1e[_0x1140('0x4d')],md5(_0x10cb1e[_0x1140('0x4d')]));}else{_0x10cb1e[_0x1140('0x4c')]='';}headers['Authorization']=getAuth(_0x22bf0b);return getUser(_0x22bf0b,_0x10c0e9[_0x1140('0x4e')])['then'](function(_0x3ca8ce){_0x1e5a2b=_0x3ca8ce;logger[_0x1140('0xc')](_0x1140('0x4f'),_0x1e5a2b['id']);return getEndUser(_0x22bf0b,_0x10cb1e[_0x1140('0x50')],_0x10cb1e[_0x1140('0x51')]);})[_0x1140('0x1c')](function(_0x2fbd8a){_0x3a94cd=_0x2fbd8a;logger['info'](_0x1140('0x52'),_0x3a94cd['id']);return getTicket(_0x22bf0b,_0x1e5a2b,_0x3a94cd,_0x48f178,_0x10cb1e);})['then'](function(_0x54e82e){if(_0x54e82e){logger[_0x1140('0xc')]('The\x20Ticket\x20ID\x20is:',_0x54e82e['id']);switch(_0x22bf0b[_0x1140('0x43')]){case'integrationTab':logger['info'](_0x1140('0x4a'),_0x1140('0x53'));return request({'uri':util[_0x1140('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x22bf0b['remoteUri'],_0x1e5a2b['id'],_0x54e82e['id']),'method':_0x1140('0xe')});case _0x1140('0x54'):logger[_0x1140('0xc')]('[QUEUE]',_0x1140('0x55'));emit(util[_0x1140('0x19')](_0x1140('0x56'),_0x10c0e9[_0x1140('0x11')]),_0x1140('0x57'),{'uri':util[_0x1140('0x19')](_0x1140('0x58'),_0x22bf0b[_0x1140('0xd')][_0x1140('0x59')](_0x1140('0x5a'),''),_0x54e82e['id'])});break;default:logger[_0x1140('0x5b')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x1140('0x5c')](function(_0x46480e){logger[_0x1140('0x5b')](_0x1140('0x5d'),util['inspect'](_0x46480e,{'showHidden':!![],'depth':null}));});};exports[_0x1140('0x5e')]=function(_0x4e01e2,_0x52e922,_0x47b10c,_0x3cb95e,_0x1a8bc7,_0x2c2953,_0x2ee44d){var _0x1d01bd,_0x42e37f;_0x2c2953['remoteUri']=intUtil['stripTrailingSlash'](_0x2c2953[_0x1140('0xd')]);_0x2c2953[_0x1140('0x48')]=intUtil[_0x1140('0x47')](_0x2c2953[_0x1140('0x48')]);if(_0x2ee44d&&_0x2ee44d[_0x1140('0x5f')]&&_0x2ee44d[_0x1140('0x5f')]!==_0x1140('0x60')){logger[_0x1140('0xc')](_0x1140('0x61'),_0x1140('0x4b'));_0x52e922['recordingURL']=util[_0x1140('0x19')](_0x1140('0x62'),_0x2c2953[_0x1140('0x48')],_0x52e922[_0x1140('0x4d')],md5(_0x52e922[_0x1140('0x4d')]));}headers['Authorization']=getAuth(_0x2c2953);return getUser(_0x2c2953,_0x3cb95e[_0x1140('0x4e')])[_0x1140('0x1c')](function(_0x5e8c42){_0x1d01bd=_0x5e8c42;logger['info']('The\x20User\x20ID\x20is:',_0x1d01bd['id']);return getEndUser(_0x2c2953,_0x52e922['destcalleridname'],_0x52e922[_0x1140('0x63')]);})[_0x1140('0x1c')](function(_0x13668e){_0x42e37f=_0x13668e;logger['info'](_0x1140('0x52'),_0x42e37f['id']);return getTicket(_0x2c2953,_0x1d01bd,_0x42e37f,_0x47b10c,_0x52e922);})[_0x1140('0x1c')](function(_0x31f07f){if(_0x31f07f){logger[_0x1140('0xc')](_0x1140('0x64'),_0x31f07f['id']);switch(_0x2c2953[_0x1140('0x43')]){case'integrationTab':logger[_0x1140('0xc')](_0x1140('0x61'),_0x1140('0x53'));return request({'uri':util['format'](_0x1140('0x65'),_0x2c2953[_0x1140('0xd')],_0x1d01bd['id'],_0x31f07f['id']),'method':_0x1140('0xe')});case'newTab':logger[_0x1140('0xc')](_0x1140('0x61'),_0x1140('0x55'));emit(util[_0x1140('0x19')](_0x1140('0x56'),_0x3cb95e[_0x1140('0x11')]),'trigger:browser:url',{'uri':util[_0x1140('0x19')]('%s/agent/tickets/%s',_0x2c2953[_0x1140('0xd')]['replace']('/api/v2',''),_0x31f07f['id'])});break;default:logger['error'](_0x1140('0x61'),_0x1140('0x66'));}}})[_0x1140('0x5c')](function(_0x1d47e4){logger[_0x1140('0x5b')](_0x1140('0x67'),util[_0x1140('0x68')](_0x1d47e4,{'showHidden':!![],'depth':null}));});};exports[_0x1140('0x69')]=function(_0x36ce99,_0x2302d1,_0x25693f,_0x48af7b,_0x2128a2,_0x42da45){var _0x195c83,_0x297236;_0x42da45[_0x1140('0xd')]=intUtil[_0x1140('0x47')](_0x42da45[_0x1140('0xd')]);_0x42da45[_0x1140('0x48')]=intUtil[_0x1140('0x47')](_0x42da45[_0x1140('0x48')]);if(_0x2128a2&&_0x2128a2[_0x1140('0x49')]){logger[_0x1140('0xc')]('['+_0x2302d1[_0x1140('0x6a')][_0x1140('0x6b')]()+']',_0x1140('0x4b'));_0x2302d1[_0x1140('0x4c')]=util[_0x1140('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42da45[_0x1140('0x48')],_0x2302d1[_0x1140('0x4d')],md5(_0x2302d1[_0x1140('0x4d')]));}else{_0x2302d1[_0x1140('0x4c')]='';}headers['Authorization']=getAuth(_0x42da45);return getUser(_0x42da45)['then'](function(_0x489ac2){_0x195c83=_0x489ac2;logger[_0x1140('0xc')](_0x1140('0x4f'),_0x195c83['id']);return getEndUser(_0x42da45,_0x2302d1[_0x1140('0x50')],_0x2302d1[_0x1140('0x51')]);})[_0x1140('0x1c')](function(_0x1e3a04){_0x297236=_0x1e3a04;logger[_0x1140('0xc')](_0x1140('0x52'),_0x297236['id']);return getTicket(_0x42da45,_0x195c83,_0x297236,_0x25693f,_0x2302d1);})['then'](function(_0x384b46){if(_0x384b46){logger['info'](_0x1140('0x64'),_0x384b46['id']);}})[_0x1140('0x5c')](function(_0x38b668){logger[_0x1140('0x5b')]('['+_0x2302d1[_0x1140('0x6a')][_0x1140('0x6b')]()+']'+_0x1140('0x6c'),util[_0x1140('0x68')](_0x38b668,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa2b8=['defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','merge','Tags','getString','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','nameField','content','toString','custom_fields','push','idField','variable','variableName','customField','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','replace','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','./util','../../../../config/logger','redis'];(function(_0x13fe45,_0x343932){var _0x8db169=function(_0xe42651){while(--_0xe42651){_0x13fe45['push'](_0x13fe45['shift']());}};_0x8db169(++_0x343932);}(_0xa2b8,0x67));var _0x8a2b=function(_0x256511,_0x36d4d2){_0x256511=_0x256511-0x0;var _0x47a108=_0xa2b8[_0x256511];return _0x47a108;};'use strict';var _=require(_0x8a2b('0x0'));var rp=require('request-promise');var md5=require(_0x8a2b('0x1'));var util=require('util');var Redis=require(_0x8a2b('0x2'));var intUtil=require(_0x8a2b('0x3'));var config=require('../../../../config/environment');var logger=require(_0x8a2b('0x4'))('zendesk');config[_0x8a2b('0x5')]=_[_0x8a2b('0x6')](config[_0x8a2b('0x5')],{'host':_0x8a2b('0x7'),'port':0x18eb});var io=require(_0x8a2b('0x8'))(new Redis(config['redis']));function emit(_0x1f6600,_0x273901,_0x4e09fa){io['to'](_0x1f6600)[_0x8a2b('0x9')](_0x273901,_0x4e09fa);}var headers={'Content-Type':_0x8a2b('0xa'),'Accept':_0x8a2b('0xa')};function getTicket(_0x418b24,_0x5e0b5c,_0x3b65e8,_0x4aa6a4,_0xa03cd){logger[_0x8a2b('0xb')](_0x8a2b('0xc'));return request({'uri':util['format']('%s/tickets.json',_0x418b24[_0x8a2b('0xd')]),'method':'POST','body':{'ticket':_[_0x8a2b('0xe')]({'requester_id':_0x3b65e8['id'],'submitter_id':_0x5e0b5c?_0x5e0b5c['id']:undefined,'assignee_id':_0x5e0b5c?_0x5e0b5c['id']:undefined,'tags':getTags(_0x4aa6a4[_0x8a2b('0xf')],'name'),'subject':intUtil[_0x8a2b('0x10')](_0x4aa6a4['Subjects'],_0xa03cd,'\x20'),'description':intUtil['getString'](_0x4aa6a4['Descriptions'],_0xa03cd,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8a2b('0x10')](_0x4aa6a4[_0x8a2b('0x11')],_0xa03cd,'\x0a')}},getCustomFields(_0x4aa6a4[_0x8a2b('0x12')],_0xa03cd))}})[_0x8a2b('0x13')](function(_0x4db13c){logger[_0x8a2b('0xb')]('Ticket\x20created!');return _0x4db13c[_0x8a2b('0x14')];});}function getUser(_0x116204,_0x24c8ee){if(intUtil['validateEmail'](_0x24c8ee)){logger[_0x8a2b('0xb')](_0x8a2b('0x15'),_0x24c8ee);return request({'uri':util[_0x8a2b('0x16')](_0x8a2b('0x17'),_0x116204[_0x8a2b('0xd')]),'qs':{'query':util[_0x8a2b('0x16')](_0x8a2b('0x18'),_0x24c8ee)}})[_0x8a2b('0x13')](function(_0x91f146){if(_0x91f146['count']){logger[_0x8a2b('0xb')](_0x8a2b('0x19'));return _['find'](_0x91f146[_0x8a2b('0x1a')],{'email':_0x24c8ee,'role':_0x8a2b('0x1b')});}else{logger[_0x8a2b('0xb')](_0x8a2b('0x1c'));return request({'uri':util[_0x8a2b('0x16')](_0x8a2b('0x1d'),_0x116204[_0x8a2b('0xd')])})[_0x8a2b('0x13')](function(_0x150194){logger[_0x8a2b('0xb')](_0x8a2b('0x1e'));return _0x150194['user'];});}});}else{logger[_0x8a2b('0xb')](_0x8a2b('0x1c'));return request({'uri':util[_0x8a2b('0x16')](_0x8a2b('0x1d'),_0x116204[_0x8a2b('0xd')])})[_0x8a2b('0x13')](function(_0x388888){logger['info'](_0x8a2b('0x1e'));return _0x388888[_0x8a2b('0x1f')];});}}function getEndUser(_0x3c0288,_0x21b8b6,_0x2945f5){logger['info'](_0x8a2b('0x20'),_0x2945f5);return request({'uri':util['format'](_0x8a2b('0x17'),_0x3c0288['remoteUri']),'qs':{'query':util[_0x8a2b('0x16')](_0x8a2b('0x21'),_0x2945f5)}})[_0x8a2b('0x13')](function(_0x2cfb6e){var _0x48528a;if(_0x2cfb6e[_0x8a2b('0x1a')][_0x8a2b('0x22')]){_0x2cfb6e[_0x8a2b('0x1a')]=_['filter'](_0x2cfb6e[_0x8a2b('0x1a')],{'suspended':![],'role':_0x8a2b('0x23')});if(_0x2cfb6e['results']['length']){_0x48528a=_['first'](_0x2cfb6e[_0x8a2b('0x1a')]);}}if(_0x48528a){logger[_0x8a2b('0xb')](_0x8a2b('0x24'));return _0x48528a;}else{logger[_0x8a2b('0xb')](_0x8a2b('0x25'));return request({'uri':util['format']('%s/users.json',_0x3c0288[_0x8a2b('0xd')]),'method':'POST','body':{'user':{'role':_0x8a2b('0x23'),'name':util[_0x8a2b('0x16')](_0x8a2b('0x26'),_0x21b8b6||_0x2945f5),'phone':_0x2945f5}}})['then'](function(_0x4138c1){logger[_0x8a2b('0xb')](_0x8a2b('0x27'));return _0x4138c1[_0x8a2b('0x1f')];});}});}function getAuth(_0x327a91){var _0x1cd37b;if(_0x327a91[_0x8a2b('0x28')]===_0x8a2b('0x29')){_0x1cd37b=util['format'](_0x8a2b('0x2a'),_0x327a91[_0x8a2b('0x2b')],_0x327a91[_0x8a2b('0x29')]);}else if(_0x327a91[_0x8a2b('0x28')]===_0x8a2b('0x2c')){_0x1cd37b=util[_0x8a2b('0x16')](_0x8a2b('0x2d'),_0x327a91[_0x8a2b('0x2b')],_0x327a91[_0x8a2b('0x2c')]);}return util[_0x8a2b('0x16')]('Basic\x20%s',new Buffer(_0x1cd37b)['toString']('base64'));}function request(_0x1aee7d){logger[_0x8a2b('0x2e')](_0x8a2b('0x2f'),JSON[_0x8a2b('0x30')](_0x1aee7d));return rp(_[_0x8a2b('0x6')](_0x1aee7d,{'method':_0x8a2b('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x5da16e,_0x51fa9b){var _0x3eccb8=[];if(_0x5da16e&&_0x5da16e[_0x8a2b('0x22')]>0x0){_0x3eccb8=_[_0x8a2b('0x32')](_0x5da16e,_0x51fa9b);}return _0x3eccb8;}function getCustomFields(_0x3d79d5,_0x400a0e){var _0x30a1d9=[];var _0x2a06c3={'custom_fields':[]};if(_0x3d79d5[_0x8a2b('0x22')]>0x0){_[_0x8a2b('0x33')](_0x3d79d5,function(_0x531113){if(_['includes']([_0x8a2b('0x34'),_0x8a2b('0x35')],_0x531113[_0x8a2b('0x36')])&&_0x531113[_0x8a2b('0x37')]&&!_0x531113['customField']){_0x2a06c3[_0x531113[_0x8a2b('0x37')]['toLowerCase']()]=_0x531113[_0x8a2b('0x38')][_0x8a2b('0x39')]();}else if(_['includes']([_0x8a2b('0x34'),_0x8a2b('0x35')],_0x531113[_0x8a2b('0x36')])&&_0x531113['idField']&&_0x531113['customField']){_0x2a06c3[_0x8a2b('0x3a')][_0x8a2b('0x3b')]({'id':_0x531113[_0x8a2b('0x3c')],'value':_0x531113[_0x8a2b('0x38')]['toString']()});}else if(_0x531113[_0x8a2b('0x36')]===_0x8a2b('0x3d')&&_0x531113[_0x8a2b('0x3e')]&&_0x531113[_0x8a2b('0x3c')]&&_0x531113[_0x8a2b('0x3f')]){_0x400a0e[_0x531113['variableName']]&&_0x2a06c3['custom_fields']['push']({'id':_0x531113[_0x8a2b('0x3c')],'value':_0x400a0e[_0x531113[_0x8a2b('0x3e')]][_0x8a2b('0x39')]()});}else if(_0x531113['type']===_0x8a2b('0x40')&&_0x531113[_0x8a2b('0x41')]&&_0x531113['Variable'][_0x8a2b('0x42')]&&_0x531113[_0x8a2b('0x3c')]&&_0x531113[_0x8a2b('0x3f')]){_0x400a0e[_0x531113[_0x8a2b('0x41')][_0x8a2b('0x42')][_0x8a2b('0x43')]()]&&_0x2a06c3['custom_fields'][_0x8a2b('0x3b')]({'id':_0x531113[_0x8a2b('0x3c')],'value':_0x400a0e[_0x531113[_0x8a2b('0x41')][_0x8a2b('0x42')]['toLowerCase']()]['toString']()});}});}return _0x2a06c3;}exports[_0x8a2b('0x44')]=function(_0x3ad581,_0x57bc79,_0x117103,_0xd54939,_0x47a19d,_0x5c53a7){var _0x45bf00,_0x51e813;_0x5c53a7[_0x8a2b('0xd')]=intUtil[_0x8a2b('0x45')](_0x5c53a7[_0x8a2b('0xd')]);_0x5c53a7['serverUrl']=intUtil[_0x8a2b('0x45')](_0x5c53a7['serverUrl']);if(_0x47a19d&&_0x47a19d['monitor_format']){logger['info'](_0x8a2b('0x46'),_0x8a2b('0x47'));_0x57bc79[_0x8a2b('0x48')]=util[_0x8a2b('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c53a7[_0x8a2b('0x49')],_0x57bc79[_0x8a2b('0x4a')],md5(_0x57bc79[_0x8a2b('0x4a')]));}else{_0x57bc79[_0x8a2b('0x48')]='';}headers[_0x8a2b('0x4b')]=getAuth(_0x5c53a7);return getUser(_0x5c53a7,_0xd54939[_0x8a2b('0x4c')])[_0x8a2b('0x13')](function(_0x9feb90){_0x45bf00=_0x9feb90;logger['info'](_0x8a2b('0x4d'),_0x45bf00['id']);return getEndUser(_0x5c53a7,_0x57bc79[_0x8a2b('0x4e')],_0x57bc79[_0x8a2b('0x4f')]);})[_0x8a2b('0x13')](function(_0x189be9){_0x51e813=_0x189be9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x51e813['id']);return getTicket(_0x5c53a7,_0x45bf00,_0x51e813,_0x117103,_0x57bc79);})['then'](function(_0x947234){if(_0x947234){logger[_0x8a2b('0xb')](_0x8a2b('0x50'),_0x947234['id']);switch(_0x5c53a7[_0x8a2b('0x36')]){case _0x8a2b('0x51'):logger['info'](_0x8a2b('0x46'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8a2b('0x16')](_0x8a2b('0x52'),_0x5c53a7[_0x8a2b('0xd')],_0x45bf00['id'],_0x947234['id']),'method':_0x8a2b('0x53')});case'newTab':logger['info']('[QUEUE]',_0x8a2b('0x54'));emit(util[_0x8a2b('0x16')](_0x8a2b('0x55'),_0xd54939[_0x8a2b('0x42')]),_0x8a2b('0x56'),{'uri':util[_0x8a2b('0x16')](_0x8a2b('0x57'),_0x5c53a7['remoteUri']['replace']('/api/v2',''),_0x947234['id'])});break;default:logger['error'](_0x8a2b('0x46'),_0x8a2b('0x58'));}}})[_0x8a2b('0x59')](function(_0x17e497){logger[_0x8a2b('0x5a')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x8a2b('0x5b')](_0x17e497,{'showHidden':!![],'depth':null}));});};exports[_0x8a2b('0x5c')]=function(_0x1fd774,_0x20a312,_0x31d968,_0x39074f,_0x1ce8c4,_0x5937c7,_0x3eaa75){var _0x36ba72,_0x3478bf;_0x5937c7['remoteUri']=intUtil[_0x8a2b('0x45')](_0x5937c7[_0x8a2b('0xd')]);_0x5937c7[_0x8a2b('0x49')]=intUtil[_0x8a2b('0x45')](_0x5937c7[_0x8a2b('0x49')]);if(_0x3eaa75&&_0x3eaa75[_0x8a2b('0x5d')]&&_0x3eaa75['recordingFormat']!==_0x8a2b('0x5e')){logger[_0x8a2b('0xb')]('[OUTBOUND]',_0x8a2b('0x47'));_0x20a312['recordingURL']=util['format'](_0x8a2b('0x5f'),_0x5937c7[_0x8a2b('0x49')],_0x20a312[_0x8a2b('0x4a')],md5(_0x20a312['uniqueid']));}headers[_0x8a2b('0x4b')]=getAuth(_0x5937c7);return getUser(_0x5937c7,_0x39074f[_0x8a2b('0x4c')])[_0x8a2b('0x13')](function(_0x522892){_0x36ba72=_0x522892;logger['info'](_0x8a2b('0x4d'),_0x36ba72['id']);return getEndUser(_0x5937c7,_0x20a312[_0x8a2b('0x60')],_0x20a312[_0x8a2b('0x61')]);})[_0x8a2b('0x13')](function(_0x41b74a){_0x3478bf=_0x41b74a;logger['info'](_0x8a2b('0x62'),_0x3478bf['id']);return getTicket(_0x5937c7,_0x36ba72,_0x3478bf,_0x31d968,_0x20a312);})['then'](function(_0x2e9b9f){if(_0x2e9b9f){logger[_0x8a2b('0xb')](_0x8a2b('0x50'),_0x2e9b9f['id']);switch(_0x5937c7[_0x8a2b('0x36')]){case'integrationTab':logger[_0x8a2b('0xb')](_0x8a2b('0x63'),_0x8a2b('0x64'));return request({'uri':util[_0x8a2b('0x16')](_0x8a2b('0x52'),_0x5937c7[_0x8a2b('0xd')],_0x36ba72['id'],_0x2e9b9f['id']),'method':_0x8a2b('0x53')});case'newTab':logger[_0x8a2b('0xb')](_0x8a2b('0x63'),_0x8a2b('0x54'));emit(util['format'](_0x8a2b('0x55'),_0x39074f['name']),_0x8a2b('0x56'),{'uri':util[_0x8a2b('0x16')](_0x8a2b('0x57'),_0x5937c7[_0x8a2b('0xd')][_0x8a2b('0x65')](_0x8a2b('0x66'),''),_0x2e9b9f['id'])});break;default:logger['error']('[OUTBOUND]',_0x8a2b('0x58'));}}})['catch'](function(_0x22411e){logger['error'](_0x8a2b('0x67'),util[_0x8a2b('0x5b')](_0x22411e,{'showHidden':!![],'depth':null}));});};exports[_0x8a2b('0x68')]=function(_0x5d61ad,_0x35ee0e,_0x5cb6a9,_0x19dd6f,_0x1f1cbb,_0x27f1f5){var _0x11e375,_0x5e0646;_0x27f1f5[_0x8a2b('0xd')]=intUtil[_0x8a2b('0x45')](_0x27f1f5[_0x8a2b('0xd')]);_0x27f1f5[_0x8a2b('0x49')]=intUtil['stripTrailingSlash'](_0x27f1f5[_0x8a2b('0x49')]);if(_0x1f1cbb&&_0x1f1cbb[_0x8a2b('0x69')]){logger[_0x8a2b('0xb')]('['+_0x35ee0e[_0x8a2b('0x6a')]['toUpperCase']()+']',_0x8a2b('0x47'));_0x35ee0e['recordingURL']=util[_0x8a2b('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27f1f5['serverUrl'],_0x35ee0e[_0x8a2b('0x4a')],md5(_0x35ee0e['uniqueid']));}else{_0x35ee0e['recordingURL']='';}headers[_0x8a2b('0x4b')]=getAuth(_0x27f1f5);return getUser(_0x27f1f5)[_0x8a2b('0x13')](function(_0x55c331){_0x11e375=_0x55c331;logger[_0x8a2b('0xb')](_0x8a2b('0x4d'),_0x11e375['id']);return getEndUser(_0x27f1f5,_0x35ee0e['calleridname'],_0x35ee0e[_0x8a2b('0x4f')]);})[_0x8a2b('0x13')](function(_0x41be71){_0x5e0646=_0x41be71;logger[_0x8a2b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5e0646['id']);return getTicket(_0x27f1f5,_0x11e375,_0x5e0646,_0x5cb6a9,_0x35ee0e);})[_0x8a2b('0x13')](function(_0x4455cc){if(_0x4455cc){logger[_0x8a2b('0xb')](_0x8a2b('0x50'),_0x4455cc['id']);}})[_0x8a2b('0x59')](function(_0x15fea6){logger[_0x8a2b('0x5a')]('['+_0x35ee0e[_0x8a2b('0x6a')][_0x8a2b('0x6b')]()+']'+_0x8a2b('0x6c'),util[_0x8a2b('0x5b')](_0x15fea6,{'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 b41ffad..8ccf040 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 _0x44f3=['stack','Search\x20user','GET','format','ActiveUsers','isArrayLikeObject','findIndex','users','email','Agent\x20found!','info','Using\x20the\x20admin\x20account!','Administrator','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','enduserType','startCase','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','Contacts','Leads','nothing','uri','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','recordingURL','host','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','zoho.eu','com','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','calleridname','toUpperCase','request-promise','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0x44f3,0x192));var _0x344f=function(_0x367995,_0x129ae2){_0x367995=_0x367995-0x0;var _0x22daa8=_0x44f3[_0x367995];return _0x22daa8;};'use strict';var _=require('lodash');var rp=require(_0x344f('0x0'));var md5=require('md5');var util=require(_0x344f('0x1'));var intUtil=require(_0x344f('0x2'));var moment=require(_0x344f('0x3'));var Redis=require(_0x344f('0x4'));var BPromise=require('bluebird');var config=require(_0x344f('0x5'));var logger=require(_0x344f('0x6'))(_0x344f('0x7'));config[_0x344f('0x8')]=_[_0x344f('0x9')](config[_0x344f('0x8')],{'host':_0x344f('0xa'),'port':0x18eb});var io=require(_0x344f('0xb'))(new Redis(config[_0x344f('0x8')]));function emit(_0x2114e6,_0x178c83,_0x57d729){io['to'](_0x2114e6)[_0x344f('0xc')](_0x178c83,_0x57d729);}function request(_0x290f90){logger[_0x344f('0xd')]('[HTTP]',JSON[_0x344f('0xe')](_0x290f90));return rp(_0x290f90);}function getCustomFields(_0x473ef3,_0x440e58){var _0x4c794d={};if(_0x473ef3[_0x344f('0xf')]>0x0){_[_0x344f('0x10')](_0x473ef3,function(_0x52d153){if(_['includes'](['string','picklist'],_0x52d153[_0x344f('0x11')])&&_0x52d153[_0x344f('0x12')]){_0x4c794d[_0x52d153['idField']]=_0x52d153[_0x344f('0x13')]['toString']();}else if(_0x52d153[_0x344f('0x11')]===_0x344f('0x14')&&_0x52d153['variableName']&&_0x52d153[_0x344f('0x12')]&&_0x440e58[_0x52d153['variableName']]){_0x4c794d[_0x52d153[_0x344f('0x12')]]=_0x440e58[_0x52d153[_0x344f('0x15')]][_0x344f('0x16')]();}else if(_0x52d153[_0x344f('0x11')]==='customVariable'&&_0x52d153[_0x344f('0x17')]&&_0x52d153[_0x344f('0x17')][_0x344f('0x18')]&&_0x52d153[_0x344f('0x12')]&&_0x440e58[_0x52d153[_0x344f('0x17')][_0x344f('0x18')][_0x344f('0x19')]()]){_0x4c794d[_0x52d153[_0x344f('0x12')]]=_0x440e58[_0x52d153[_0x344f('0x17')][_0x344f('0x18')][_0x344f('0x19')]()][_0x344f('0x16')]();}});}return _0x4c794d;}function getName(_0x30f633){if(_0x30f633['indexOf']('\x20')>0x0){var _0x3e0c62=_0x30f633[_0x344f('0x1a')](/ (.+)/);if(_0x3e0c62[0x1]){return _0x3e0c62;}}return[_0x30f633,_0x30f633];}var accountsTokens={};function getAccessToken(_0x1da5b0){return new Promise(function(_0x379954,_0x5dd9ed){if(!_['isNil'](accountsTokens[_0x1da5b0['id']])&&!_[_0x344f('0x1b')](accountsTokens[_0x1da5b0['id']][_0x344f('0x1c')])){if(moment()[_0x344f('0x1d')](accountsTokens[_0x1da5b0['id']][_0x344f('0x1e')])){_0x379954(accountsTokens[_0x1da5b0['id']][_0x344f('0x1c')]);}}var _0x1a552e;switch(_0x1da5b0['zone']){case'US':_0x1a552e='https://accounts.zoho.com';break;case'AU':_0x1a552e='https://accounts.zoho.com.au';break;case'EU':_0x1a552e=_0x344f('0x1f');break;case'IN':_0x1a552e='https://accounts.zoho.in';break;case'CN':_0x1a552e=_0x344f('0x20');break;default:_0x1a552e=_0x344f('0x1f');break;}var _0x2e5496={'method':_0x344f('0x21'),'uri':_0x1a552e+'/oauth/v2/token','qs':{'refresh_token':_0x1da5b0['refreshToken'],'client_id':_0x1da5b0[_0x344f('0x22')],'client_secret':_0x1da5b0[_0x344f('0x23')],'grant_type':_0x344f('0x24')},'json':!![]};return rp(_0x2e5496)[_0x344f('0x25')](function(_0x56af63){accountsTokens[_0x1da5b0['id']]={'access_token':_0x56af63[_0x344f('0x1c')],'expires_in':moment()[_0x344f('0x26')](_0x56af63[_0x344f('0x1e')],'seconds')};_0x379954(_0x56af63[_0x344f('0x1c')]);})[_0x344f('0x27')](function(_0x394ad8){logger[_0x344f('0x28')](_0x344f('0x29'),_0x394ad8[_0x344f('0x2a')]);_0x5dd9ed(_0x394ad8);});});}function getUser(_0xdecb85,_0x29d954,_0x9226cf,_0x5490a1){logger['info'](_0x344f('0x2b'));return request({'method':_0x344f('0x2c'),'uri':util[_0x344f('0x2d')]('https://www.zohoapis.%s/crm/v2/users',_0x29d954),'qs':{'type':_0x344f('0x2e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xdecb85},'json':!![]})[_0x344f('0x25')](function(_0x42d539){if(_0x42d539['users']){var _0x152eef=-0x1;if(_[_0x344f('0x2f')](_0x42d539['users'])){if(!_[_0x344f('0x1b')](_0x5490a1)){_0x152eef=_[_0x344f('0x30')](_0x42d539[_0x344f('0x31')],function(_0x147578){return _0x147578[_0x344f('0x32')]===_0x5490a1;});}if(_0x152eef>=0x0){logger['info'](_0x344f('0x33'));}else{logger[_0x344f('0x34')](_0x344f('0x35'));_0x152eef=_[_0x344f('0x30')](_0x42d539['users'],function(_0x5394d2){return _0x5394d2['profile'][_0x344f('0x18')]===_0x344f('0x36');});}return _0x42d539[_0x344f('0x31')][_0x152eef];}else{if(_0x42d539['user'][_0x344f('0x37')]['name']===_0x344f('0x36')){logger[_0x344f('0x34')](_0x344f('0x35'));user=_0x42d539['user'];return user;}else{logger[_0x344f('0x28')](_0x344f('0x38'),JSON[_0x344f('0xe')](_0x42d539));throw new Error(_0x344f('0x39')+JSON[_0x344f('0xe')](_0x42d539));}}}else{logger[_0x344f('0x28')](_0x344f('0x38'),JSON[_0x344f('0xe')](_0x42d539));throw new Error(_0x344f('0x39')+JSON[_0x344f('0xe')](_0x42d539));}})['catch'](function(_0x5f494d){console['error'](_0x5f494d);});}function getZohoUser(_0xfa4a88,_0x32477e){return new BPromise(function(_0x484e66,_0x390018){request(_0xfa4a88)[_0x344f('0x25')](function(_0x55f736){var _0xb13d0f=null;if(_0x55f736){_0xb13d0f=_0x55f736[_0x344f('0x3a')][0x0];_0xb13d0f['enduserType']=_0x32477e;}_0x484e66(_0xb13d0f);})['catch'](function(_0x42327d){_0x390018(_0x42327d);});});}function createEndUser(_0x349282,_0x44f59f,_0xfa05b2,_0x4b7fda,_0x2814f0,_0x3ba0c7){var _0xfa05b2=getName(_0xfa05b2);return request({'method':_0x344f('0x21'),'uri':_0x344f('0x3b')+_0x44f59f+_0x344f('0x3c')+_['startCase'](_0x3ba0c7[_0x344f('0x3d')])+'s','body':{'data':[{'Last_Name':_0xfa05b2[0x1],'First_Name':_0xfa05b2[0x0],'Phone':_0x4b7fda,'Owner':{'name':!_[_0x344f('0x1b')](_0x2814f0[_0x344f('0x3e')][_0x344f('0x18')])?_0x2814f0['role'][_0x344f('0x18')]:!_[_0x344f('0x1b')](_0x2814f0[_0x344f('0x3f')])?_0x2814f0[_0x344f('0x3f')]+'\x20'+_0x2814f0[_0x344f('0x40')]:_0x2814f0['last_name'],'id':_0x2814f0['id']}}]},'headers':{'Authorization':_0x344f('0x41')+_0x349282},'json':!![]})[_0x344f('0x25')](function(_0x2cf7db){if(_0x2cf7db&&_0x2cf7db[_0x344f('0x3a')][0x0][_0x344f('0x42')]===_0x344f('0x43')){var _0xa39b2b=_0x2cf7db[_0x344f('0x3a')][0x0][_0x344f('0x44')];_0xa39b2b[_0x344f('0x45')]=_[_0x344f('0x46')](_0x3ba0c7[_0x344f('0x3d')])+'s';return _0xa39b2b;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x344f('0xe')](data));throw new Error(_0x344f('0x47')+JSON[_0x344f('0xe')](data));})[_0x344f('0x27')](function(_0x36c6a9){console['log'](_0x344f('0x48'),_0x36c6a9);});}function getEndUser(_0x44ad37,_0x2ca587,_0x5f58e3,_0x3ca026,_0x92d23c,_0x1a2132,_0x123e83){var _0x5d3c3f={'method':'GET','uri':'','headers':{'Authorization':_0x344f('0x41')+_0x44ad37},'json':!![]};switch(_0x123e83[_0x344f('0x49')]){case _0x344f('0x4a'):_0x5d3c3f['uri']=_0x344f('0x3b')+_0x2ca587+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x92d23c+'))';return getZohoUser(_0x5d3c3f,_0x344f('0x4b'))[_0x344f('0x25')](function(_0x2a7ffe){if(_0x2a7ffe)return _0x2a7ffe;_0x5d3c3f['uri']='https://www.zohoapis.'+_0x2ca587+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x92d23c+'))';return getZohoUser(_0x5d3c3f,_0x344f('0x4c'))['then'](function(_0x4aace5){if(_0x4aace5)return _0x4aace5;if(_0x123e83[_0x344f('0x3d')]!=_0x344f('0x4d')){return createEndUser(_0x44ad37,_0x2ca587,_0x3ca026,_0x92d23c,_0x1a2132,_0x123e83);}else{return{};}});});break;case'contact':_0x5d3c3f[_0x344f('0x4e')]='https://www.zohoapis.'+_0x2ca587+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x92d23c+'))';return getZohoUser(_0x5d3c3f,_0x344f('0x4b'))['then'](function(_0x487f67){if(_0x487f67)return _0x487f67;if(_0x123e83[_0x344f('0x3d')]!='nothing'){return createEndUser(_0x44ad37,_0x2ca587,_0x3ca026,_0x92d23c,_0x1a2132,_0x123e83);}else{return{};}});break;case'lead':_0x5d3c3f[_0x344f('0x4e')]='https://www.zohoapis.'+_0x2ca587+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x92d23c+'))';return getZohoUser(_0x5d3c3f,'Leads')[_0x344f('0x25')](function(_0xb63377){if(_0xb63377)return _0xb63377;if(_0x123e83[_0x344f('0x3d')]!='nothing'){return createEndUser(_0x44ad37,_0x2ca587,_0x3ca026,_0x92d23c,_0x1a2132,_0x123e83);}else{return{};}});break;}}function getCall(_0x76b123,_0x387c17,_0x5e20fa,_0x5c461,_0x36bd70,_0x4d069a,_0x2177fe,_0x31b86c){logger[_0x344f('0x34')]('Creating\x20new\x20call...');var _0x2a102f={};_0x2a102f[_0x344f('0x4f')]={'name':!_[_0x344f('0x1b')](_0x5c461[_0x344f('0x3e')][_0x344f('0x18')])&&!_[_0x344f('0x1b')](_0x5c461['profile'][_0x344f('0x18')])&&_0x5c461[_0x344f('0x37')][_0x344f('0x18')]===_0x344f('0x50')?_0x5c461[_0x344f('0x3e')][_0x344f('0x18')]:!_['isNil'](_0x5c461[_0x344f('0x3f')])?_0x5c461[_0x344f('0x3f')]+'\x20'+_0x5c461[_0x344f('0x40')]:_0x5c461['last_name'],'id':_0x5c461['id']};_0x2a102f['Subject']=intUtil[_0x344f('0x51')](_0x4d069a[_0x344f('0x52')],_0x2177fe,'\x20');_0x2a102f[_0x344f('0x53')]=intUtil[_0x344f('0x51')](_0x4d069a[_0x344f('0x54')],_0x2177fe,'\x0a');if(_0x36bd70[_0x344f('0x45')]===_0x344f('0x4b')){_0x2a102f[_0x344f('0x55')]={'name':!_[_0x344f('0x1b')](_0x36bd70[_0x344f('0x56')])?_0x36bd70['Full_Name']:!_[_0x344f('0x1b')](_0x36bd70[_0x344f('0x57')])?_0x36bd70['First_Name']+'\x20'+_0x36bd70['Last_Name']:_0x36bd70['Last_Name'],'id':_0x36bd70['id']};}if(_0x36bd70[_0x344f('0x45')]===_0x344f('0x4c')){_0x2a102f[_0x344f('0x58')]={'name':!_[_0x344f('0x1b')](_0x36bd70['Full_Name'])?_0x36bd70[_0x344f('0x56')]:!_[_0x344f('0x1b')](_0x36bd70[_0x344f('0x57')])?_0x36bd70[_0x344f('0x57')]+'\x20'+_0x36bd70['Last_Name']:_0x36bd70[_0x344f('0x59')],'id':_0x36bd70['id']};_0x2a102f[_0x344f('0x5a')]=_[_0x344f('0x46')](_0x36bd70[_0x344f('0x45')]);}if(_0x2177fe[_0x344f('0x5b')]){_0x2a102f[_0x344f('0x5c')]=moment[_0x344f('0x5d')](parseInt(_0x2177fe[_0x344f('0x5b')])*0x3e8)[_0x344f('0x2d')](_0x344f('0x5e'));}else if(_0x2177fe[_0x344f('0x5f')]&&_0x2177fe[_0x344f('0x60')]){_0x2a102f[_0x344f('0x5c')]=moment[_0x344f('0x5d')](moment(_0x2177fe['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0x344f('0x61')](moment(_0x2177fe['starttime'],_0x344f('0x62'))))[_0x344f('0x2d')](_0x344f('0x5e'));}switch(_0x2177fe[_0x344f('0x63')]){case _0x344f('0x64'):_0x2a102f[_0x344f('0x65')]=_0x344f('0x66');break;case _0x344f('0x67'):case _0x344f('0x68'):_0x2a102f['Call_Result']=_0x344f('0x69');break;case _0x344f('0x6a'):_0x2a102f['Call_Result']=_0x344f('0x6b');break;case _0x344f('0x6c'):_0x2a102f['Call_Result']='Abandoned';break;case _0x344f('0x6d'):_0x2a102f['Call_Result']=_0x344f('0x6e');default:}_0x2a102f['Call_Start_Time']=(_0x31b86c===_0x344f('0x6f')?moment(_0x2177fe[_0x344f('0x70')])[_0x344f('0x2d')](_0x344f('0x62')):moment(_0x2177fe[_0x344f('0x71')])[_0x344f('0x2d')](_0x344f('0x62')))||moment()[_0x344f('0x2d')]('YYYY-MM-DDTHH:mm:ss');_0x2a102f[_0x344f('0x72')]=_0x31b86c||_0x344f('0x73');_0x2a102f=_[_0x344f('0x74')](_0x2a102f,getCustomFields(_0x4d069a[_0x344f('0x75')],_0x2177fe));return request({'method':_0x344f('0x21'),'uri':'https://www.zohoapis.'+_0x387c17+_0x344f('0x76'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x76b123},'body':{'data':[_0x2a102f]},'json':!![]})['then'](function(_0x184a12){if(_0x184a12&&_0x184a12[_0x344f('0x3a')][0x0]['code']===_0x344f('0x43')){logger['info'](_0x344f('0x77'));return{'id':_0x184a12['data'][0x0][_0x344f('0x44')]['id']};}})[_0x344f('0x27')](function(_0x1308bf){logger[_0x344f('0x34')](_0x344f('0x78'),_0x1308bf[_0x344f('0x2a')]);console[_0x344f('0x79')]('err',_0x1308bf);});}exports[_0x344f('0x7a')]=function(_0x42e1ac,_0x14146c,_0x4f4e7f,_0x25a632,_0x4bcb59,_0x48d21c){var _0x1b737d,_0x24152c,_0x494cd4;_0x48d21c['host']=intUtil['stripTrailingSlash'](_0x48d21c['host']);_0x48d21c[_0x344f('0x7b')]=intUtil[_0x344f('0x7c')](_0x48d21c[_0x344f('0x7b')]);if(_0x4bcb59&&_0x4bcb59[_0x344f('0x7d')]){logger[_0x344f('0x34')](_0x344f('0x7e'),_0x344f('0x7f'));_0x14146c['recordingURL']=_0x48d21c[_0x344f('0x7b')]+_0x344f('0x80')+_0x14146c['uniqueid']+_0x344f('0x81')+md5(_0x14146c[_0x344f('0x82')]);}else{_0x14146c[_0x344f('0x83')]='';}var _0x4c4548=_0x48d21c[_0x344f('0x84')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x48d21c)[_0x344f('0x25')](function(_0x1b1d99){_0x494cd4=_0x1b1d99;return getUser(_0x494cd4,_0x4c4548,_0x48d21c,_0x25a632['email']);})[_0x344f('0x25')](function(_0x14582a){_0x1b737d=_0x14582a;logger[_0x344f('0x34')](_0x344f('0x85'),_0x1b737d['id']);return getEndUser(_0x494cd4,_0x4c4548,_0x48d21c,_0x14146c['calleridname'],_0x14146c['calleridnum'],_0x1b737d,_0x4f4e7f);})[_0x344f('0x25')](function(_0x5ecae6){_0x24152c=_0x5ecae6;return getCall(_0x494cd4,_0x4c4548,_0x48d21c,_0x1b737d,_0x24152c,_0x4f4e7f,_0x14146c,_0x344f('0x73'));})[_0x344f('0x25')](function(_0x505005){if(_0x505005){logger['info'](_0x344f('0x86'),_0x505005['id']);logger['info'](_0x344f('0x7e'),_0x344f('0x87'));emit(util[_0x344f('0x2d')](_0x344f('0x88'),_0x25a632[_0x344f('0x18')]),'trigger:browser:url',{'uri':'https://crm.'+_0x48d21c['host']+_0x344f('0x89')+_0x505005['id']});}})[_0x344f('0x27')](function(_0x2afe6e){logger[_0x344f('0x28')](_0x344f('0x7e'),JSON['stringify'](_0x2afe6e));});};exports['outbound']=function(_0x6b6f0b,_0x1d97f3,_0x59171c,_0x30553b,_0x41a60c,_0x573898,_0x3fdb13){var _0x48e0cb,_0x14cb4f,_0x47c61f;_0x573898[_0x344f('0x84')]=intUtil[_0x344f('0x7c')](_0x573898[_0x344f('0x84')]);_0x573898[_0x344f('0x7b')]=intUtil['stripTrailingSlash'](_0x573898['serverUrl']);if(_0x3fdb13&&_0x3fdb13[_0x344f('0x8a')]&&_0x3fdb13[_0x344f('0x8a')]!=='none'){logger[_0x344f('0x34')]('[OUTBOUND]',_0x344f('0x7f'));_0x1d97f3[_0x344f('0x83')]=_0x573898[_0x344f('0x7b')]+_0x344f('0x80')+_0x1d97f3[_0x344f('0x82')]+_0x344f('0x81')+md5(_0x1d97f3[_0x344f('0x82')]);}var _0x302ac3=_0x573898[_0x344f('0x84')]===_0x344f('0x8b')?'eu':_0x344f('0x8c');return getAccessToken(_0x573898)[_0x344f('0x25')](function(_0x2022aa){_0x47c61f=_0x2022aa;return getUser(_0x47c61f,_0x302ac3,_0x573898,_0x30553b[_0x344f('0x32')]);})[_0x344f('0x25')](function(_0x53fee7){_0x48e0cb=_0x53fee7;logger[_0x344f('0x34')](_0x344f('0x85'),_0x48e0cb['id']);return getEndUser(_0x47c61f,_0x302ac3,_0x573898,_0x1d97f3[_0x344f('0x8d')],_0x1d97f3[_0x344f('0x8e')],_0x48e0cb,_0x59171c);})[_0x344f('0x25')](function(_0x24d506){_0x14cb4f=_0x24d506;return getCall(_0x47c61f,_0x302ac3,_0x573898,_0x48e0cb,_0x14cb4f,_0x59171c,_0x1d97f3,_0x344f('0x8f'));})['then'](function(_0x403594){if(_0x403594){logger[_0x344f('0x34')](_0x344f('0x86'),_0x403594['id']);logger[_0x344f('0x34')](_0x344f('0x90'),_0x344f('0x87'));emit(util[_0x344f('0x2d')](_0x344f('0x88'),_0x30553b[_0x344f('0x18')]),'trigger:browser:url',{'uri':'https://crm.'+_0x573898[_0x344f('0x84')]+_0x344f('0x89')+_0x403594['id']});}})[_0x344f('0x27')](function(_0x4ae0d5){logger[_0x344f('0x28')]('[OUTBOUND]',JSON['stringify'](_0x4ae0d5));});};exports[_0x344f('0x91')]=function(_0x1b2488,_0x36ccb8,_0x2c1469,_0x3e19d5,_0x1a2883,_0x3b8868){var _0x2d687d,_0x389561,_0x45061f;_0x3b8868['host']=intUtil[_0x344f('0x7c')](_0x3b8868[_0x344f('0x84')]);_0x3b8868[_0x344f('0x7b')]=intUtil[_0x344f('0x7c')](_0x3b8868['serverUrl']);if(_0x1a2883&&_0x1a2883[_0x344f('0x7d')]){logger[_0x344f('0x34')]('['+_0x36ccb8['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x36ccb8[_0x344f('0x83')]=_0x3b8868[_0x344f('0x7b')]+_0x344f('0x80')+_0x36ccb8[_0x344f('0x82')]+_0x344f('0x81')+md5(_0x36ccb8['uniqueid']);}else{_0x36ccb8[_0x344f('0x83')]='';}var _0x9a6616=_0x3b8868['host']===_0x344f('0x8b')?'eu':_0x344f('0x8c');return getAccessToken(_0x3b8868)['then'](function(_0x581e4e){_0x45061f=_0x581e4e;return getUser(_0x45061f,_0x9a6616,_0x3b8868);})[_0x344f('0x25')](function(_0x46cb9f){_0x2d687d=_0x46cb9f;logger[_0x344f('0x34')](_0x344f('0x85'),_0x2d687d['id']);return getEndUser(_0x45061f,_0x9a6616,_0x3b8868,_0x36ccb8[_0x344f('0x92')],_0x36ccb8['calleridnum'],_0x2d687d,_0x2c1469);})[_0x344f('0x25')](function(_0x364fa5){_0x389561=_0x364fa5;return getCall(_0x45061f,_0x9a6616,_0x3b8868,_0x2d687d,_0x389561,_0x2c1469,_0x36ccb8,_0x344f('0x73'));})['then'](function(_0x2be945){if(_0x2be945){logger[_0x344f('0x34')](_0x344f('0x86'),_0x2be945['id']);}})['catch'](function(_0x452d03){logger[_0x344f('0x28')]('['+_0x36ccb8[_0x344f('0x63')][_0x344f('0x93')]()+']',JSON[_0x344f('0xe')](_0x452d03));});}; \ No newline at end of file +var _0x5293=['/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridnum','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','name','toLowerCase','Variable','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','utc','talktime','mm:ss','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Called','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields'];(function(_0xc6d9f2,_0x5e36f0){var _0x4c66f6=function(_0x5e39cc){while(--_0x5e39cc){_0xc6d9f2['push'](_0xc6d9f2['shift']());}};_0x4c66f6(++_0x5e36f0);}(_0x5293,0xb7));var _0x3529=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x5293[_0x3f00ee];return _0x18a07e;};'use strict';var _=require(_0x3529('0x0'));var rp=require('request-promise');var md5=require(_0x3529('0x1'));var util=require('util');var intUtil=require(_0x3529('0x2'));var moment=require(_0x3529('0x3'));var Redis=require(_0x3529('0x4'));var BPromise=require(_0x3529('0x5'));var config=require(_0x3529('0x6'));var logger=require(_0x3529('0x7'))('zoho');config[_0x3529('0x8')]=_[_0x3529('0x9')](config['redis'],{'host':_0x3529('0xa'),'port':0x18eb});var io=require(_0x3529('0xb'))(new Redis(config['redis']));function emit(_0x5a6dfa,_0x27fd87,_0x5c73c9){io['to'](_0x5a6dfa)[_0x3529('0xc')](_0x27fd87,_0x5c73c9);}function request(_0x4d4d71){logger[_0x3529('0xd')](_0x3529('0xe'),JSON['stringify'](_0x4d4d71));return rp(_0x4d4d71);}function getCustomFields(_0x161960,_0x1265ba){var _0x55c647={};if(_0x161960[_0x3529('0xf')]>0x0){_[_0x3529('0x10')](_0x161960,function(_0x62d496){if(_[_0x3529('0x11')]([_0x3529('0x12'),_0x3529('0x13')],_0x62d496[_0x3529('0x14')])&&_0x62d496[_0x3529('0x15')]){_0x55c647[_0x62d496[_0x3529('0x15')]]=_0x62d496[_0x3529('0x16')][_0x3529('0x17')]();}else if(_0x62d496['type']===_0x3529('0x18')&&_0x62d496[_0x3529('0x19')]&&_0x62d496[_0x3529('0x15')]&&_0x1265ba[_0x62d496[_0x3529('0x19')]]){_0x55c647[_0x62d496[_0x3529('0x15')]]=_0x1265ba[_0x62d496[_0x3529('0x19')]]['toString']();}else if(_0x62d496[_0x3529('0x14')]===_0x3529('0x1a')&&_0x62d496['Variable']&&_0x62d496['Variable']['name']&&_0x62d496[_0x3529('0x15')]&&_0x1265ba[_0x62d496['Variable'][_0x3529('0x1b')][_0x3529('0x1c')]()]){_0x55c647[_0x62d496[_0x3529('0x15')]]=_0x1265ba[_0x62d496[_0x3529('0x1d')][_0x3529('0x1b')][_0x3529('0x1c')]()][_0x3529('0x17')]();}});}return _0x55c647;}function getName(_0x26bec6){if(_0x26bec6['indexOf']('\x20')>0x0){var _0x527cf7=_0x26bec6['split'](/ (.+)/);if(_0x527cf7[0x1]){return _0x527cf7;}}return[_0x26bec6,_0x26bec6];}var accountsTokens={};function getAccessToken(_0x1c42d9){return new Promise(function(_0x3e1ecb,_0x8ba259){if(!_[_0x3529('0x1e')](accountsTokens[_0x1c42d9['id']])&&!_[_0x3529('0x1e')](accountsTokens[_0x1c42d9['id']][_0x3529('0x1f')])){if(moment()[_0x3529('0x20')](accountsTokens[_0x1c42d9['id']][_0x3529('0x21')])){_0x3e1ecb(accountsTokens[_0x1c42d9['id']][_0x3529('0x1f')]);}}var _0x558564;switch(_0x1c42d9[_0x3529('0x22')]){case'US':_0x558564=_0x3529('0x23');break;case'AU':_0x558564=_0x3529('0x24');break;case'EU':_0x558564=_0x3529('0x25');break;case'IN':_0x558564='https://accounts.zoho.in';break;case'CN':_0x558564=_0x3529('0x26');break;default:_0x558564='https://accounts.zoho.eu';break;}var _0x58062={'method':_0x3529('0x27'),'uri':_0x558564+'/oauth/v2/token','qs':{'refresh_token':_0x1c42d9[_0x3529('0x28')],'client_id':_0x1c42d9['clientId'],'client_secret':_0x1c42d9[_0x3529('0x29')],'grant_type':_0x3529('0x2a')},'json':!![]};return rp(_0x58062)[_0x3529('0x2b')](function(_0x3764c5){accountsTokens[_0x1c42d9['id']]={'access_token':_0x3764c5[_0x3529('0x1f')],'expires_in':moment()[_0x3529('0x2c')](_0x3764c5[_0x3529('0x21')],'seconds')};_0x3e1ecb(_0x3764c5[_0x3529('0x1f')]);})['catch'](function(_0x429075){logger[_0x3529('0x2d')](_0x3529('0x2e'),_0x429075[_0x3529('0x2f')]);_0x8ba259(_0x429075);});});}function getUser(_0x1d2422,_0x2ce13e,_0x2f972f,_0x1ebbd3){logger['info'](_0x3529('0x30'));return request({'method':_0x3529('0x31'),'uri':util[_0x3529('0x32')](_0x3529('0x33'),_0x2ce13e),'qs':{'type':_0x3529('0x34')},'headers':{'Authorization':_0x3529('0x35')+_0x1d2422},'json':!![]})[_0x3529('0x2b')](function(_0x11a9a5){if(_0x11a9a5['users']){var _0x463b62=-0x1;if(_[_0x3529('0x36')](_0x11a9a5[_0x3529('0x37')])){if(!_['isNil'](_0x1ebbd3)){_0x463b62=_[_0x3529('0x38')](_0x11a9a5[_0x3529('0x37')],function(_0x18f600){return _0x18f600[_0x3529('0x39')]===_0x1ebbd3;});}if(_0x463b62>=0x0){logger[_0x3529('0x3a')]('Agent\x20found!');}else{logger[_0x3529('0x3a')](_0x3529('0x3b'));_0x463b62=_['findIndex'](_0x11a9a5[_0x3529('0x37')],function(_0x569be1){return _0x569be1[_0x3529('0x3c')][_0x3529('0x1b')]===_0x3529('0x3d');});}return _0x11a9a5[_0x3529('0x37')][_0x463b62];}else{if(_0x11a9a5['user']['profile'][_0x3529('0x1b')]==='Administrator'){logger[_0x3529('0x3a')](_0x3529('0x3b'));user=_0x11a9a5['user'];return user;}else{logger[_0x3529('0x2d')](_0x3529('0x3e'),JSON[_0x3529('0x3f')](_0x11a9a5));throw new Error(_0x3529('0x40')+JSON[_0x3529('0x3f')](_0x11a9a5));}}}else{logger[_0x3529('0x2d')](_0x3529('0x3e'),JSON[_0x3529('0x3f')](_0x11a9a5));throw new Error(_0x3529('0x40')+JSON[_0x3529('0x3f')](_0x11a9a5));}})[_0x3529('0x41')](function(_0x210e37){console[_0x3529('0x2d')](_0x210e37);});}function getZohoUser(_0x3c0072,_0x1fb5ff){return new BPromise(function(_0x4b997a,_0x133076){request(_0x3c0072)[_0x3529('0x2b')](function(_0x23d25d){var _0x472e56=null;if(_0x23d25d){_0x472e56=_0x23d25d[_0x3529('0x42')][0x0];_0x472e56[_0x3529('0x43')]=_0x1fb5ff;}_0x4b997a(_0x472e56);})[_0x3529('0x41')](function(_0x3c2c3a){_0x133076(_0x3c2c3a);});});}function createEndUser(_0x5dca78,_0x11a68b,_0x116c1e,_0x3cfb5b,_0x5a222e,_0x1ecfdb){var _0x116c1e=getName(_0x116c1e);return request({'method':'POST','uri':_0x3529('0x44')+_0x11a68b+'/crm/v2/'+_[_0x3529('0x45')](_0x1ecfdb[_0x3529('0x46')])+'s','body':{'data':[{'Last_Name':_0x116c1e[0x1],'First_Name':_0x116c1e[0x0],'Phone':_0x3cfb5b,'Owner':{'name':!_[_0x3529('0x1e')](_0x5a222e['role']['name'])?_0x5a222e[_0x3529('0x47')][_0x3529('0x1b')]:!_[_0x3529('0x1e')](_0x5a222e[_0x3529('0x48')])?_0x5a222e[_0x3529('0x48')]+'\x20'+_0x5a222e[_0x3529('0x49')]:_0x5a222e['last_name'],'id':_0x5a222e['id']}}]},'headers':{'Authorization':_0x3529('0x35')+_0x5dca78},'json':!![]})['then'](function(_0x4760da){if(_0x4760da&&_0x4760da[_0x3529('0x42')][0x0][_0x3529('0x4a')]===_0x3529('0x4b')){var _0x1681dd=_0x4760da['data'][0x0]['details'];_0x1681dd[_0x3529('0x43')]=_[_0x3529('0x45')](_0x1ecfdb['moduleCreate'])+'s';return _0x1681dd;}logger[_0x3529('0x2d')](_0x3529('0x3e'),JSON[_0x3529('0x3f')](data));throw new Error(_0x3529('0x4c')+JSON[_0x3529('0x3f')](data));})['catch'](function(_0x45e7c7){console[_0x3529('0x4d')]('CREATE\x20ERROR',_0x45e7c7);});}function getEndUser(_0x433553,_0x8eb598,_0x5e4aaa,_0x126044,_0x551d76,_0xc33390,_0x182862){var _0x3842ec={'method':_0x3529('0x31'),'uri':'','headers':{'Authorization':_0x3529('0x35')+_0x433553},'json':!![]};switch(_0x182862[_0x3529('0x4e')]){case _0x3529('0x4f'):_0x3842ec[_0x3529('0x50')]='https://www.zohoapis.'+_0x8eb598+_0x3529('0x51')+_0x551d76+'))';return getZohoUser(_0x3842ec,'Contacts')[_0x3529('0x2b')](function(_0x5d812f){if(_0x5d812f)return _0x5d812f;_0x3842ec['uri']=_0x3529('0x44')+_0x8eb598+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x551d76+'))';return getZohoUser(_0x3842ec,_0x3529('0x52'))['then'](function(_0x2fe509){if(_0x2fe509)return _0x2fe509;if(_0x182862['moduleCreate']!=_0x3529('0x53')){return createEndUser(_0x433553,_0x8eb598,_0x126044,_0x551d76,_0xc33390,_0x182862);}else{return{};}});});break;case'contact':_0x3842ec['uri']=_0x3529('0x44')+_0x8eb598+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x551d76+'))';return getZohoUser(_0x3842ec,_0x3529('0x54'))['then'](function(_0x57d4c0){if(_0x57d4c0)return _0x57d4c0;if(_0x182862[_0x3529('0x46')]!=_0x3529('0x53')){return createEndUser(_0x433553,_0x8eb598,_0x126044,_0x551d76,_0xc33390,_0x182862);}else{return{};}});break;case _0x3529('0x55'):_0x3842ec['uri']=_0x3529('0x44')+_0x8eb598+_0x3529('0x56')+_0x551d76+'))';return getZohoUser(_0x3842ec,_0x3529('0x52'))[_0x3529('0x2b')](function(_0x21d9b8){if(_0x21d9b8)return _0x21d9b8;if(_0x182862[_0x3529('0x46')]!=_0x3529('0x53')){return createEndUser(_0x433553,_0x8eb598,_0x126044,_0x551d76,_0xc33390,_0x182862);}else{return{};}});break;}}function getCall(_0x10f26e,_0x471b37,_0xbdf4c8,_0xd71b17,_0x50e58e,_0x525848,_0x1c4f09,_0x1f37af){logger[_0x3529('0x3a')]('Creating\x20new\x20call...');var _0x2329f4={};_0x2329f4[_0x3529('0x57')]={'name':!_['isNil'](_0xd71b17['role'][_0x3529('0x1b')])&&!_[_0x3529('0x1e')](_0xd71b17[_0x3529('0x3c')][_0x3529('0x1b')])&&_0xd71b17[_0x3529('0x3c')][_0x3529('0x1b')]===_0x3529('0x58')?_0xd71b17[_0x3529('0x47')]['name']:!_[_0x3529('0x1e')](_0xd71b17[_0x3529('0x48')])?_0xd71b17[_0x3529('0x48')]+'\x20'+_0xd71b17[_0x3529('0x49')]:_0xd71b17[_0x3529('0x49')],'id':_0xd71b17['id']};_0x2329f4[_0x3529('0x59')]=intUtil[_0x3529('0x5a')](_0x525848['Subjects'],_0x1c4f09,'\x20');_0x2329f4[_0x3529('0x5b')]=intUtil[_0x3529('0x5a')](_0x525848[_0x3529('0x5c')],_0x1c4f09,'\x0a');if(_0x50e58e[_0x3529('0x43')]===_0x3529('0x54')){_0x2329f4[_0x3529('0x5d')]={'name':!_[_0x3529('0x1e')](_0x50e58e[_0x3529('0x5e')])?_0x50e58e[_0x3529('0x5e')]:!_[_0x3529('0x1e')](_0x50e58e[_0x3529('0x5f')])?_0x50e58e[_0x3529('0x5f')]+'\x20'+_0x50e58e[_0x3529('0x60')]:_0x50e58e['Last_Name'],'id':_0x50e58e['id']};}if(_0x50e58e[_0x3529('0x43')]===_0x3529('0x52')){_0x2329f4[_0x3529('0x61')]={'name':!_['isNil'](_0x50e58e[_0x3529('0x5e')])?_0x50e58e['Full_Name']:!_['isNil'](_0x50e58e[_0x3529('0x5f')])?_0x50e58e[_0x3529('0x5f')]+'\x20'+_0x50e58e[_0x3529('0x60')]:_0x50e58e[_0x3529('0x60')],'id':_0x50e58e['id']};_0x2329f4[_0x3529('0x62')]=_[_0x3529('0x45')](_0x50e58e['enduserType']);}if(_0x1c4f09['talktime']){_0x2329f4['Call_Duration']=moment[_0x3529('0x63')](parseInt(_0x1c4f09[_0x3529('0x64')])*0x3e8)[_0x3529('0x32')](_0x3529('0x65'));}else if(_0x1c4f09['answertime']&&_0x1c4f09[_0x3529('0x66')]){_0x2329f4[_0x3529('0x67')]=moment['utc'](moment(_0x1c4f09[_0x3529('0x66')],_0x3529('0x68'))[_0x3529('0x69')](moment(_0x1c4f09[_0x3529('0x6a')],_0x3529('0x68'))))[_0x3529('0x32')](_0x3529('0x65'));}switch(_0x1c4f09['lastevent']){case _0x3529('0x6b'):_0x2329f4['Call_Result']=_0x3529('0x6c');break;case'complete':case'connect':_0x2329f4[_0x3529('0x6d')]=_0x3529('0x6e');break;case _0x3529('0x6f'):_0x2329f4[_0x3529('0x6d')]=_0x3529('0x70');break;case _0x3529('0x71'):_0x2329f4[_0x3529('0x6d')]=_0x3529('0x72');break;case _0x3529('0x73'):_0x2329f4[_0x3529('0x6d')]=_0x3529('0x74');default:}_0x2329f4[_0x3529('0x75')]=(_0x1f37af===_0x3529('0x76')?moment(_0x1c4f09[_0x3529('0x6a')])[_0x3529('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1c4f09[_0x3529('0x77')])[_0x3529('0x32')](_0x3529('0x68')))||moment()[_0x3529('0x32')](_0x3529('0x68'));_0x2329f4['Call_Type']=_0x1f37af||_0x3529('0x78');_0x2329f4=_[_0x3529('0x79')](_0x2329f4,getCustomFields(_0x525848[_0x3529('0x7a')],_0x1c4f09));return request({'method':_0x3529('0x27'),'uri':_0x3529('0x44')+_0x471b37+_0x3529('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x10f26e},'body':{'data':[_0x2329f4]},'json':!![]})[_0x3529('0x2b')](function(_0x5ea090){if(_0x5ea090&&_0x5ea090['data'][0x0][_0x3529('0x4a')]==='SUCCESS'){logger[_0x3529('0x3a')]('Call\x20created!');return{'id':_0x5ea090['data'][0x0]['details']['id']};}})[_0x3529('0x41')](function(_0xa0c45){logger[_0x3529('0x3a')](_0x3529('0x7c'),_0xa0c45[_0x3529('0x2f')]);console[_0x3529('0x4d')]('err',_0xa0c45);});}exports[_0x3529('0x7d')]=function(_0x423924,_0x2acfe5,_0x5cca55,_0x153068,_0x14616d,_0x5d5a34){var _0x2dc62c,_0x56e6ac,_0x12f2ce;_0x5d5a34[_0x3529('0x7e')]=intUtil[_0x3529('0x7f')](_0x5d5a34[_0x3529('0x7e')]);_0x5d5a34[_0x3529('0x80')]=intUtil[_0x3529('0x7f')](_0x5d5a34[_0x3529('0x80')]);if(_0x14616d&&_0x14616d[_0x3529('0x81')]){logger[_0x3529('0x3a')](_0x3529('0x82'),_0x3529('0x83'));_0x2acfe5[_0x3529('0x84')]=_0x5d5a34['serverUrl']+_0x3529('0x85')+_0x2acfe5[_0x3529('0x86')]+_0x3529('0x87')+md5(_0x2acfe5[_0x3529('0x86')]);}else{_0x2acfe5[_0x3529('0x84')]='';}var _0x2d397b=_0x5d5a34[_0x3529('0x7e')]==='zoho.eu'?'eu':_0x3529('0x88');return getAccessToken(_0x5d5a34)[_0x3529('0x2b')](function(_0x364ae1){_0x12f2ce=_0x364ae1;return getUser(_0x12f2ce,_0x2d397b,_0x5d5a34,_0x153068[_0x3529('0x39')]);})['then'](function(_0x44beff){_0x2dc62c=_0x44beff;logger['info'](_0x3529('0x89'),_0x2dc62c['id']);return getEndUser(_0x12f2ce,_0x2d397b,_0x5d5a34,_0x2acfe5[_0x3529('0x8a')],_0x2acfe5['calleridnum'],_0x2dc62c,_0x5cca55);})[_0x3529('0x2b')](function(_0x4c72b8){_0x56e6ac=_0x4c72b8;return getCall(_0x12f2ce,_0x2d397b,_0x5d5a34,_0x2dc62c,_0x56e6ac,_0x5cca55,_0x2acfe5,_0x3529('0x78'));})['then'](function(_0x5e91b6){if(_0x5e91b6){logger[_0x3529('0x3a')](_0x3529('0x8b'),_0x5e91b6['id']);logger[_0x3529('0x3a')](_0x3529('0x82'),_0x3529('0x8c'));emit(util[_0x3529('0x32')](_0x3529('0x8d'),_0x153068[_0x3529('0x1b')]),'trigger:browser:url',{'uri':_0x3529('0x8e')+_0x5d5a34[_0x3529('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5e91b6['id']});}})[_0x3529('0x41')](function(_0x5d25a6){logger[_0x3529('0x2d')]('[QUEUE]',JSON[_0x3529('0x3f')](_0x5d25a6));});};exports[_0x3529('0x76')]=function(_0x940a84,_0x2dcec7,_0x390baa,_0x2d4655,_0x1e845d,_0x44599c,_0x33fc6b){var _0x1abbea,_0x565dd6,_0x1c26fc;_0x44599c['host']=intUtil[_0x3529('0x7f')](_0x44599c[_0x3529('0x7e')]);_0x44599c[_0x3529('0x80')]=intUtil[_0x3529('0x7f')](_0x44599c[_0x3529('0x80')]);if(_0x33fc6b&&_0x33fc6b[_0x3529('0x8f')]&&_0x33fc6b[_0x3529('0x8f')]!==_0x3529('0x90')){logger[_0x3529('0x3a')](_0x3529('0x91'),_0x3529('0x83'));_0x2dcec7[_0x3529('0x84')]=_0x44599c[_0x3529('0x80')]+_0x3529('0x85')+_0x2dcec7[_0x3529('0x86')]+_0x3529('0x87')+md5(_0x2dcec7[_0x3529('0x86')]);}var _0x1dc442=_0x44599c['host']===_0x3529('0x92')?'eu':_0x3529('0x88');return getAccessToken(_0x44599c)[_0x3529('0x2b')](function(_0x22663c){_0x1c26fc=_0x22663c;return getUser(_0x1c26fc,_0x1dc442,_0x44599c,_0x2d4655[_0x3529('0x39')]);})[_0x3529('0x2b')](function(_0x50e5dc){_0x1abbea=_0x50e5dc;logger['info']('The\x20User\x20ID\x20is:',_0x1abbea['id']);return getEndUser(_0x1c26fc,_0x1dc442,_0x44599c,_0x2dcec7['destcalleridname'],_0x2dcec7[_0x3529('0x93')],_0x1abbea,_0x390baa);})[_0x3529('0x2b')](function(_0x5b0ea5){_0x565dd6=_0x5b0ea5;return getCall(_0x1c26fc,_0x1dc442,_0x44599c,_0x1abbea,_0x565dd6,_0x390baa,_0x2dcec7,'Outbound');})[_0x3529('0x2b')](function(_0x4de3f4){if(_0x4de3f4){logger[_0x3529('0x3a')](_0x3529('0x8b'),_0x4de3f4['id']);logger[_0x3529('0x3a')](_0x3529('0x91'),_0x3529('0x8c'));emit(util[_0x3529('0x32')]('user:%s',_0x2d4655[_0x3529('0x1b')]),_0x3529('0x94'),{'uri':_0x3529('0x8e')+_0x44599c[_0x3529('0x7e')]+_0x3529('0x95')+_0x4de3f4['id']});}})[_0x3529('0x41')](function(_0x2b214d){logger['error'](_0x3529('0x91'),JSON['stringify'](_0x2b214d));});};exports[_0x3529('0x96')]=function(_0x5acfca,_0x311102,_0x4a7123,_0x28befa,_0x284c07,_0x3e051f){var _0xb753c3,_0x40e5b5,_0x1a007f;_0x3e051f[_0x3529('0x7e')]=intUtil['stripTrailingSlash'](_0x3e051f[_0x3529('0x7e')]);_0x3e051f[_0x3529('0x80')]=intUtil['stripTrailingSlash'](_0x3e051f[_0x3529('0x80')]);if(_0x284c07&&_0x284c07[_0x3529('0x81')]){logger[_0x3529('0x3a')]('['+_0x311102[_0x3529('0x97')][_0x3529('0x98')]()+']','Recording\x20is\x20enabled!');_0x311102[_0x3529('0x84')]=_0x3e051f[_0x3529('0x80')]+_0x3529('0x85')+_0x311102[_0x3529('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x311102['uniqueid']);}else{_0x311102[_0x3529('0x84')]='';}var _0x52f63a=_0x3e051f[_0x3529('0x7e')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x3e051f)[_0x3529('0x2b')](function(_0x596920){_0x1a007f=_0x596920;return getUser(_0x1a007f,_0x52f63a,_0x3e051f);})[_0x3529('0x2b')](function(_0x2d773a){_0xb753c3=_0x2d773a;logger[_0x3529('0x3a')]('The\x20User\x20ID\x20is:',_0xb753c3['id']);return getEndUser(_0x1a007f,_0x52f63a,_0x3e051f,_0x311102['calleridname'],_0x311102['calleridnum'],_0xb753c3,_0x4a7123);})['then'](function(_0x38d7a4){_0x40e5b5=_0x38d7a4;return getCall(_0x1a007f,_0x52f63a,_0x3e051f,_0xb753c3,_0x40e5b5,_0x4a7123,_0x311102,_0x3529('0x78'));})[_0x3529('0x2b')](function(_0x4df2cf){if(_0x4df2cf){logger[_0x3529('0x3a')](_0x3529('0x8b'),_0x4df2cf['id']);}})['catch'](function(_0x3dd8ac){logger['error']('['+_0x311102[_0x3529('0x97')]['toUpperCase']()+']',JSON['stringify'](_0x3dd8ac));});}; \ 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 a49dc44..d71467d 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 _0xbe3b=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','data2','Script','data3','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x4ebb44,_0x27c284){var _0x232db8=function(_0x2150ee){while(--_0x2150ee){_0x4ebb44['push'](_0x4ebb44['shift']());}};_0x232db8(++_0x27c284);}(_0xbe3b,0x13a));var _0xbbe3=function(_0x13f9c3,_0x2036c0){_0x13f9c3=_0x13f9c3-0x0;var _0x22185a=_0xbe3b[_0x13f9c3];return _0x22185a;};'use strict';var util=require(_0xbbe3('0x0'));var sh=require(_0xbbe3('0x1'));var Mustache=require('mustache');var logger=require(_0xbbe3('0x2'))('trigger');exports['exec']=function(_0xa70940,_0x479f41){var _0x5bb7af=_0xa70940['data2']?_0xa70940[_0xbbe3('0x3')]:_0xbbe3('0x4');var _0x29ea30=_0xa70940[_0xbbe3('0x5')]?Mustache['render'](_0xa70940[_0xbbe3('0x5')],_0x479f41):_0x479f41;sh[_0xbbe3('0x6')](_0x29ea30,function(_0x50b76e,_0x3ecc12,_0xc3a79){if(_0x50b76e!==0x0){logger[_0xbbe3('0x7')](util[_0xbbe3('0x8')](_0xbbe3('0x9'),_0x5bb7af,_0x29ea30,_0x50b76e,_0xc3a79));}else{logger[_0xbbe3('0xa')](util[_0xbbe3('0x8')](_0xbbe3('0xb'),_0x5bb7af,_0x29ea30,_0x3ecc12));}});}; \ No newline at end of file +var _0x9d80=['shelljs','mustache','../../../../config/logger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x58e989,_0x2b6e4a){var _0x2bf9bd=function(_0x583536){while(--_0x583536){_0x58e989['push'](_0x58e989['shift']());}};_0x2bf9bd(++_0x2b6e4a);}(_0x9d80,0xb5));var _0x09d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d80[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x09d8('0x0'));var sh=require(_0x09d8('0x1'));var Mustache=require(_0x09d8('0x2'));var logger=require(_0x09d8('0x3'))('trigger');exports[_0x09d8('0x4')]=function(_0x269967,_0x17a294){var _0x750629=_0x269967[_0x09d8('0x5')]?_0x269967[_0x09d8('0x5')]:_0x09d8('0x6');var _0x275530=_0x269967[_0x09d8('0x7')]?Mustache['render'](_0x269967[_0x09d8('0x7')],_0x17a294):_0x17a294;sh[_0x09d8('0x4')](_0x275530,function(_0x49a57e,_0x402eca,_0x194a26){if(_0x49a57e!==0x0){logger[_0x09d8('0x8')](util[_0x09d8('0x9')](_0x09d8('0xa'),_0x750629,_0x275530,_0x49a57e,_0x194a26));}else{logger[_0x09d8('0xb')](util[_0x09d8('0x9')](_0x09d8('0xc'),_0x750629,_0x275530,_0x402eca));}});}; \ 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 ce3efe1..55545a0 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 _0x2cbc=['POST','PUT','data7','parse','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','render','data2','number','data5','headers','data6','error','stack','data1','toUpperCase','DELETE'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x2cbc,0x1dd));var _0xc2cb=function(_0x49ab28,_0xae6e4){_0x49ab28=_0x49ab28-0x0;var _0x4ec00d=_0x2cbc[_0x49ab28];return _0x4ec00d;};'use strict';var rp=require(_0xc2cb('0x0'));var util=require(_0xc2cb('0x1'));var _=require(_0xc2cb('0x2'));var Mustache=require(_0xc2cb('0x3'));var logger=require(_0xc2cb('0x4'))(_0xc2cb('0x5'));exports[_0xc2cb('0x6')]=function(_0x1d90ed,_0x2608a0){var _0x24d4cb,_0x31b80e;var _0x29472c={'method':_0x1d90ed['data1']['toUpperCase'](),'uri':Mustache[_0xc2cb('0x7')](_0x1d90ed[_0xc2cb('0x8')],_0x2608a0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1d90ed['data5'])===_0xc2cb('0x9')&&parseInt(_0x1d90ed['data5'])>=0x1&&parseInt(_0x1d90ed['data5'])<=0xa?parseInt(_0x1d90ed[_0xc2cb('0xa')])*0x3e8:0x5*0x3e8};try{_0x29472c[_0xc2cb('0xb')]=_0x1d90ed[_0xc2cb('0xc')]?JSON['parse'](Mustache['render'](_0x1d90ed['data6'],_0x2608a0)):{};}catch(_0x2048c2){logger[_0xc2cb('0xd')](_0x2048c2[_0xc2cb('0xe')]);}switch(_0x1d90ed[_0xc2cb('0xf')][_0xc2cb('0x10')]()){case'GET':case _0xc2cb('0x11'):_0x24d4cb=null;_0x29472c['qs']=_0x2608a0;break;case _0xc2cb('0x12'):case _0xc2cb('0x13'):if(_0x1d90ed[_0xc2cb('0x14')]){try{_0x24d4cb=JSON[_0xc2cb('0x15')](Mustache[_0xc2cb('0x7')](_0x1d90ed['data7'],_0x2608a0));_0x29472c['body']=_0x24d4cb;}catch(_0x2867df){logger[_0xc2cb('0xd')](_0x2867df['stack']);logger[_0xc2cb('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x24d4cb=_0x2608a0;_0x29472c[_0xc2cb('0x16')]=_0x24d4cb;}break;}logger[_0xc2cb('0x17')](util[_0xc2cb('0x18')](_0xc2cb('0x19'),_0x1d90ed[_0xc2cb('0xf')],_0x1d90ed[_0xc2cb('0x8')],JSON[_0xc2cb('0x1a')](_0x29472c)));rp(_0x29472c)['then'](function(_0x34c181){_0x24d4cb=!_[_0xc2cb('0x1b')](_0x24d4cb)?_0xc2cb('0x1c')+_0x24d4cb:'';_0x31b80e=typeof _0x34c181[_0xc2cb('0x16')]==='object'?JSON[_0xc2cb('0x1a')](_0x34c181[_0xc2cb('0x16')]):_0x34c181['body'];logger[_0xc2cb('0x17')](util[_0xc2cb('0x18')](_0xc2cb('0x1d'),_0x1d90ed[_0xc2cb('0xf')],_0x1d90ed[_0xc2cb('0x8')],_0x34c181[_0xc2cb('0x1e')],_0x31b80e));})['catch'](function(_0x22caab){logger[_0xc2cb('0xd')](util[_0xc2cb('0x18')](_0xc2cb('0x1f'),_0x1d90ed[_0xc2cb('0xf')],_0x1d90ed[_0xc2cb('0x8')],_0x22caab[_0xc2cb('0x1e')],_0x22caab['name'],_0x22caab[_0xc2cb('0x20')]));});}; \ No newline at end of file +var _0x1827=['request-promise','util','lodash','trigger','exec','toUpperCase','render','data2','data5','headers','parse','data6','error','stack','data1','GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','info','%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'];(function(_0x1c2aa7,_0x1f7fb6){var _0x51594c=function(_0xf7869b){while(--_0xf7869b){_0x1c2aa7['push'](_0x1c2aa7['shift']());}};_0x51594c(++_0x1f7fb6);}(_0x1827,0xc6));var _0x7182=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x1827[_0x2b7764];return _0x848dcb;};'use strict';var rp=require(_0x7182('0x0'));var util=require(_0x7182('0x1'));var _=require(_0x7182('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x7182('0x3'));exports[_0x7182('0x4')]=function(_0x5c3437,_0x4e0107){var _0x37eb1e,_0x5c3b5c;var _0x4befcc={'method':_0x5c3437['data1'][_0x7182('0x5')](),'uri':Mustache[_0x7182('0x6')](_0x5c3437[_0x7182('0x7')],_0x4e0107),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5c3437[_0x7182('0x8')])==='number'&&parseInt(_0x5c3437[_0x7182('0x8')])>=0x1&&parseInt(_0x5c3437[_0x7182('0x8')])<=0xa?parseInt(_0x5c3437[_0x7182('0x8')])*0x3e8:0x5*0x3e8};try{_0x4befcc[_0x7182('0x9')]=_0x5c3437['data6']?JSON[_0x7182('0xa')](Mustache['render'](_0x5c3437[_0x7182('0xb')],_0x4e0107)):{};}catch(_0x203da0){logger[_0x7182('0xc')](_0x203da0[_0x7182('0xd')]);}switch(_0x5c3437[_0x7182('0xe')][_0x7182('0x5')]()){case _0x7182('0xf'):case'DELETE':_0x37eb1e=null;_0x4befcc['qs']=_0x4e0107;break;case _0x7182('0x10'):case _0x7182('0x11'):if(_0x5c3437[_0x7182('0x12')]){try{_0x37eb1e=JSON['parse'](Mustache['render'](_0x5c3437[_0x7182('0x12')],_0x4e0107));_0x4befcc[_0x7182('0x13')]=_0x37eb1e;}catch(_0x537530){logger['error'](_0x537530[_0x7182('0xd')]);logger[_0x7182('0xc')](_0x7182('0x14'));}}else{_0x37eb1e=_0x4e0107;_0x4befcc['body']=_0x37eb1e;}break;}logger['info'](util[_0x7182('0x15')](_0x7182('0x16'),_0x5c3437[_0x7182('0xe')],_0x5c3437['data2'],JSON[_0x7182('0x17')](_0x4befcc)));rp(_0x4befcc)[_0x7182('0x18')](function(_0xf6e56b){_0x37eb1e=!_[_0x7182('0x19')](_0x37eb1e)?_0x7182('0x1a')+_0x37eb1e:'';_0x5c3b5c=typeof _0xf6e56b['body']==='object'?JSON['stringify'](_0xf6e56b[_0x7182('0x13')]):_0xf6e56b[_0x7182('0x13')];logger[_0x7182('0x1b')](util[_0x7182('0x15')](_0x7182('0x1c'),_0x5c3437['data1'],_0x5c3437[_0x7182('0x7')],_0xf6e56b[_0x7182('0x1d')],_0x5c3b5c));})[_0x7182('0x1e')](function(_0x4455bb){logger[_0x7182('0xc')](util[_0x7182('0x15')](_0x7182('0x1f'),_0x5c3437[_0x7182('0xe')],_0x5c3437[_0x7182('0x7')],_0x4455bb[_0x7182('0x1d')],_0x4455bb['name'],_0x4455bb[_0x7182('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 64aaab4..528c571 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 _0x3b1e=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','request','rpc','routing','error'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x3b1e,0x197));var _0xe3b1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3b1e[_0x42cae2];return _0x5f256f;};'use strict';var jayson=require(_0xe3b1('0x0'));var BPromise=require(_0xe3b1('0x1'));var logger=require(_0xe3b1('0x2'))('routing');var client=jayson[_0xe3b1('0x3')][_0xe3b1('0x4')]({'port':0x2329});client['Request']=function(_0x548e9d,_0x3705af){return new BPromise(function(_0x3e63d0,_0x1ea597){return client[_0xe3b1('0x5')](_0x548e9d,_0x3705af)['then'](function(_0x1a055c){logger['debug'](_0xe3b1('0x6'),_0xe3b1('0x7'),_0x548e9d,_0x3705af,_0x1a055c);if(_0x1a055c[_0xe3b1('0x8')]){logger[_0xe3b1('0x8')]('rpc',_0xe3b1('0x7'),_0x548e9d,_0x1a055c[_0xe3b1('0x8')][_0xe3b1('0x9')],_0x3705af);return _0x1ea597(_0x1a055c[_0xe3b1('0x8')]['message']);}else{return _0x3e63d0(_0x1a055c[_0xe3b1('0xa')]);}})[_0xe3b1('0xb')](function(_0x384e27){logger[_0xe3b1('0x8')](_0xe3b1('0x6'),_0xe3b1('0x7'),_0x548e9d,_0x384e27,_0x3705af);return _0x1ea597(_0x384e27);});});};module[_0xe3b1('0xc')]=client; \ No newline at end of file +var _0xc160=['then','debug','routing','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','client','Request','request'];(function(_0x1f109c,_0xd9952e){var _0x3984e8=function(_0x40b60b){while(--_0x40b60b){_0x1f109c['push'](_0x1f109c['shift']());}};_0x3984e8(++_0xd9952e);}(_0xc160,0x1c1));var _0x0c16=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0xc160[_0x5c4f6b];return _0x104c4e;};'use strict';var jayson=require(_0x0c16('0x0'));var BPromise=require(_0x0c16('0x1'));var logger=require(_0x0c16('0x2'))('routing');var client=jayson[_0x0c16('0x3')]['http']({'port':0x2329});client[_0x0c16('0x4')]=function(_0x37146b,_0x2f03ae){return new BPromise(function(_0x5d04ce,_0x17c3f5){return client[_0x0c16('0x5')](_0x37146b,_0x2f03ae)[_0x0c16('0x6')](function(_0x11c3e9){logger[_0x0c16('0x7')]('rpc',_0x0c16('0x8'),_0x37146b,_0x2f03ae,_0x11c3e9);if(_0x11c3e9['error']){logger[_0x0c16('0x9')]('rpc','routing',_0x37146b,_0x11c3e9[_0x0c16('0x9')][_0x0c16('0xa')],_0x2f03ae);return _0x17c3f5(_0x11c3e9['error'][_0x0c16('0xa')]);}else{return _0x5d04ce(_0x11c3e9['result']);}})[_0x0c16('0xb')](function(_0x252bab){logger[_0x0c16('0x9')]('rpc',_0x0c16('0x8'),_0x37146b,_0x252bab,_0x2f03ae);return _0x17c3f5(_0x252bab);});});};module[_0x0c16('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 9bf048d..f11500e 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 _0xa283=['catch','./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xa283,0x135));var _0x3a28=function(_0x99a3ed,_0x4a7a1d){_0x99a3ed=_0x99a3ed-0x0;var _0x32cfb0=_0xa283[_0x99a3ed];return _0x32cfb0;};'use strict';var server=require(_0x3a28('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x3a28('0x1'));var mailAccount=require(_0x3a28('0x2'));var setting=require(_0x3a28('0x3'));var logger=require(_0x3a28('0x4'))(_0x3a28('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3a28('0x6')]()[_0x3a28('0x7')](mailAccount[_0x3a28('0x8')]())['then'](realtime[_0x3a28('0x9')]())['then'](function(){email[_0x3a28('0xa')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x3a28('0xb')](realtime,email)[_0x3a28('0x7')](function(){return initRealtime();})[_0x3a28('0x7')](function(){return setting[_0x3a28('0xc')]();})[_0x3a28('0x7')](function(_0x4543c5){return setInterval(initRealtime,_0x4543c5['loginMailFrequency']*0x3e8);})[_0x3a28('0xd')](function(_0x44d874){logger['error']('Email\x20service\x20initialization',_0x44d874);});}main(); \ No newline at end of file +var _0xbf14=['error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','catch'];(function(_0x331a72,_0xf026aa){var _0x213770=function(_0x7c8867){while(--_0x7c8867){_0x331a72['push'](_0x331a72['shift']());}};_0x213770(++_0xf026aa);}(_0xbf14,0x1cd));var _0x4bf1=function(_0x138ef,_0x4e973c){_0x138ef=_0x138ef-0x0;var _0x2bed43=_0xbf14[_0x138ef];return _0x2bed43;};'use strict';var server=require('./server');var Realtime=require(_0x4bf1('0x0'));var EmailChannel=require(_0x4bf1('0x1'));var mailAccount=require(_0x4bf1('0x2'));var setting=require(_0x4bf1('0x3'));var logger=require(_0x4bf1('0x4'))(_0x4bf1('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x4bf1('0x6')]()[_0x4bf1('0x7')](mailAccount[_0x4bf1('0x8')]())[_0x4bf1('0x7')](realtime[_0x4bf1('0x9')]())[_0x4bf1('0x7')](function(){email[_0x4bf1('0xa')](realtime[_0x4bf1('0xb')]);return realtime;});}function main(){return server[_0x4bf1('0xc')](realtime,email)[_0x4bf1('0x7')](function(){return initRealtime();})[_0x4bf1('0x7')](function(){return setting[_0x4bf1('0xd')]();})['then'](function(_0x397f84){return setInterval(initRealtime,_0x397f84['loginMailFrequency']*0x3e8);})[_0x4bf1('0xe')](function(_0x4d3c4b){logger[_0x4bf1('0xf')](_0x4bf1('0x10'),_0x4d3c4b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 00ebee8..96991ae 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 _0x3b62=['start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','hasOwnProperty','service','custom','provider','box','handleImapBox','handleImapEmail','bind','end','error','handleImapError','disabled','emit','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','catch','handleImapEnd','lastSync','send','Smtp','verify','verified','exports','lodash','moment','md5','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount'];(function(_0x3e0fab,_0x285e29){var _0x36cde8=function(_0x124a10){while(--_0x124a10){_0x3e0fab['push'](_0x3e0fab['shift']());}};_0x36cde8(++_0x285e29);}(_0x3b62,0x175));var _0x23b6=function(_0x10a77f,_0x8575b0){_0x10a77f=_0x10a77f-0x0;var _0x40e612=_0x3b62[_0x10a77f];return _0x40e612;};'use strict';var _=require(_0x23b6('0x0'));var moment=require(_0x23b6('0x1'));var BPromise=require('bluebird');var md5=require(_0x23b6('0x2'));var Redis=require('ioredis');var config=require(_0x23b6('0x3'));var logger=require(_0x23b6('0x4'))(_0x23b6('0x5'));config[_0x23b6('0x6')]=_[_0x23b6('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x23b6('0x8'))(new Redis(config[_0x23b6('0x6')]));var EmailImap=require(_0x23b6('0x9'));var EmailSmtp=require(_0x23b6('0xa'));var mailAccount=require(_0x23b6('0xb'));var md5Accounts={};function EmailChannel(_0x589546){logger['info'](_0x23b6('0xc'));this[_0x23b6('0xd')]=_0x589546[_0x23b6('0xd')];this[_0x23b6('0xe')]={};this[_0x23b6('0xf')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x1f6c18){var _0x5498d2=this['mailAccounts'][_0x1f6c18];var _0x56b8c5={'id':_0x5498d2['id'],'name':_0x5498d2[_0x23b6('0x10')],'key':_0x5498d2['key'],'active':_0x5498d2[_0x23b6('0x11')],'Imap':{'status':_0x5498d2[_0x23b6('0x12')][_0x23b6('0x13')],'messageStatus':_0x5498d2[_0x23b6('0x12')][_0x23b6('0x14')],'total':_0x5498d2['Imap'][_0x23b6('0x15')]}};if(_[_0x23b6('0x16')](md5Accounts[_0x1f6c18])){md5Accounts[_0x1f6c18]={};}var _0x48fec5=md5(JSON[_0x23b6('0x17')](_0x56b8c5));if(md5Accounts[_0x1f6c18][_0x23b6('0x2')]!==_0x48fec5){md5Accounts[_0x1f6c18][_0x23b6('0x2')]=_0x48fec5;io['emit'](_0x23b6('0x18'),_0x56b8c5);}};EmailChannel[_0x23b6('0x19')]['refresh']=function(_0x435c49){for(var _0x4d1c98 in _0x435c49){if(_0x435c49[_0x23b6('0x1a')](_0x4d1c98)){if(_0x435c49[_0x4d1c98][_0x23b6('0x12')]&&_0x435c49[_0x4d1c98][_0x23b6('0x11')]){var _0x46c512=_0x435c49[_0x4d1c98][_0x23b6('0x12')];if(!_0x46c512[_0x23b6('0x1b')]&&_0x435c49[_0x4d1c98]['provider']!==_0x23b6('0x1c'))_0x46c512[_0x23b6('0x1b')]=_0x435c49[_0x4d1c98][_0x23b6('0x1d')];if(!this[_0x23b6('0xe')][_0x23b6('0x1a')](_0x46c512['id'])){this[_0x23b6('0xe')][_0x46c512['id']]=new EmailImap(_0x46c512,_0x435c49[_0x4d1c98][_0x23b6('0x5')]);this[_0x23b6('0xe')][_0x46c512['id']]['on'](_0x23b6('0x1e'),this[_0x23b6('0x1f')]['bind'](this,_0x4d1c98));this[_0x23b6('0xe')][_0x46c512['id']]['on']('email',this[_0x23b6('0x20')][_0x23b6('0x21')](this,_0x4d1c98));this['imapAccounts'][_0x46c512['id']]['on'](_0x23b6('0x22'),this['handleImapEnd'][_0x23b6('0x21')](this,_0x4d1c98));this[_0x23b6('0xe')][_0x46c512['id']]['on'](_0x23b6('0x23'),this[_0x23b6('0x24')][_0x23b6('0x21')](this,_0x4d1c98));}}else{if(_[_0x23b6('0x16')](this['mailAccounts'][_0x4d1c98][_0x23b6('0x12')])){this[_0x23b6('0xd')][_0x4d1c98][_0x23b6('0x12')]={};}this[_0x23b6('0xd')][_0x4d1c98][_0x23b6('0x12')]['status']=_0x23b6('0x25');this[_0x23b6('0xd')][_0x4d1c98][_0x23b6('0x12')]['messageStatus']='';this[_0x23b6('0x26')](_0x4d1c98);}}}};EmailChannel[_0x23b6('0x19')][_0x23b6('0x1f')]=function(_0x120588,_0x207945){if(this['mailAccounts'][_0x120588]){this[_0x23b6('0xd')][_0x120588]['Imap'][_0x23b6('0x13')]=_0x23b6('0x27');this[_0x23b6('0xd')][_0x120588][_0x23b6('0x12')]['messageStatus']=_0x207945[_0x23b6('0x10')];if(_0x207945['messages']){this[_0x23b6('0xd')][_0x120588][_0x23b6('0x12')][_0x23b6('0x15')]=_0x207945[_0x23b6('0x28')][_0x23b6('0x15')];}return this[_0x23b6('0x26')](_0x120588);}};EmailChannel[_0x23b6('0x19')][_0x23b6('0x20')]=function(_0x3ed86a,_0x268f99){logger[_0x23b6('0x29')](_0x23b6('0x2a'),_0x268f99[_0x23b6('0x2b')],_0x268f99['lastName'],_0x268f99[_0x23b6('0x2c')],_0x3ed86a);if(this[_0x23b6('0xd')][_0x3ed86a]){return mailAccount[_0x23b6('0x2d')](_0x3ed86a,_0x268f99)[_0x23b6('0x2e')](function(_0x3395fd){if(_0x3395fd){logger[_0x23b6('0x29')]('Mail\x20accepted\x20from\x20routing');}})[_0x23b6('0x2f')](function(_0x5c5fba){logger[_0x23b6('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x5c5fba));});}};EmailChannel[_0x23b6('0x19')][_0x23b6('0x30')]=function(_0x5ead82){if(this[_0x23b6('0xd')][_0x5ead82]&&this[_0x23b6('0xd')][_0x5ead82][_0x23b6('0x12')]){if(this['imapAccounts'][this[_0x23b6('0xd')][_0x5ead82][_0x23b6('0x12')]['id']]){delete this['imapAccounts'][this[_0x23b6('0xd')][_0x5ead82][_0x23b6('0x12')]['id']];}this[_0x23b6('0xd')][_0x5ead82][_0x23b6('0x12')][_0x23b6('0x31')]=moment();this[_0x23b6('0x26')](_0x5ead82);}};EmailChannel[_0x23b6('0x19')]['handleImapError']=function(_0x15d09c,_0x352c9c){if(this[_0x23b6('0xd')][_0x15d09c]){this[_0x23b6('0xd')][_0x15d09c][_0x23b6('0x12')][_0x23b6('0x13')]=_0x23b6('0x23');this[_0x23b6('0xd')][_0x15d09c]['Imap'][_0x23b6('0x14')]=_0x352c9c;return this[_0x23b6('0x26')](_0x15d09c);}};EmailChannel[_0x23b6('0x19')]['sendMail']=function(_0x2b7fe8,_0x5a2273){return this[_0x23b6('0xf')][_0x23b6('0x32')](_0x2b7fe8,_0x5a2273);};EmailChannel[_0x23b6('0x19')]['verifySmtp']=function(_0x3711b3){var _0x13fec8=this;if(this['mailAccounts'][_0x3711b3['id']]){if(_['isNil'](this['mailAccounts'][_0x3711b3['id']][_0x23b6('0x33')])){this[_0x23b6('0xd')][_0x3711b3['id']]['Smtp']={};}this['mailAccounts'][_0x3711b3['id']][_0x23b6('0x33')][_0x23b6('0x31')]=moment();return new BPromise(function(_0x374799,_0x3d120d){return _0x13fec8[_0x23b6('0xf')][_0x23b6('0x34')](_0x3711b3)[_0x23b6('0x2e')](function(_0xd4aec2){_0x13fec8[_0x23b6('0xd')][_0x3711b3['id']][_0x23b6('0x33')][_0x23b6('0x13')]=_0x23b6('0x35');_0x13fec8[_0x23b6('0xd')][_0x3711b3['id']][_0x23b6('0x33')][_0x23b6('0x14')]='';_0x13fec8[_0x23b6('0x26')](_0x3711b3['id']);_0x374799(_0xd4aec2);})[_0x23b6('0x2f')](function(_0x3548d4){_0x13fec8[_0x23b6('0xd')][_0x3711b3['id']][_0x23b6('0x33')][_0x23b6('0x13')]=_0x23b6('0x23');_0x13fec8[_0x23b6('0xd')][_0x3711b3['id']]['Smtp'][_0x23b6('0x14')]=_0x3548d4;_0x13fec8[_0x23b6('0x26')](_0x3711b3['id']);_0x3d120d(_0x3548d4);});});}return this[_0x23b6('0xf')]['verify'](_0x3711b3);};module[_0x23b6('0x36')]=EmailChannel; \ No newline at end of file +var _0xdf19=['bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','active','Imap','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','status','disabled','messageStatus','connected','messages','total','firstName','lastName','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','send','verifySmtp','Smtp','verify','verified','exports','lodash'];(function(_0x103b91,_0x25f9da){var _0x281218=function(_0x51f68a){while(--_0x51f68a){_0x103b91['push'](_0x103b91['shift']());}};_0x281218(++_0x25f9da);}(_0xdf19,0x155));var _0x9df1=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0xdf19[_0x46f3f8];return _0xbc57cd;};'use strict';var _=require(_0x9df1('0x0'));var moment=require('moment');var BPromise=require(_0x9df1('0x1'));var md5=require(_0x9df1('0x2'));var Redis=require(_0x9df1('0x3'));var config=require(_0x9df1('0x4'));var logger=require('../../../config/logger')(_0x9df1('0x5'));config[_0x9df1('0x6')]=_[_0x9df1('0x7')](config['redis'],{'host':_0x9df1('0x8'),'port':0x18eb});var io=require(_0x9df1('0x9'))(new Redis(config[_0x9df1('0x6')]));var EmailImap=require(_0x9df1('0xa'));var EmailSmtp=require(_0x9df1('0xb'));var mailAccount=require(_0x9df1('0xc'));var md5Accounts={};function EmailChannel(_0x326ccf){logger[_0x9df1('0xd')]('start\x20email\x20channel');this['mailAccounts']=_0x326ccf[_0x9df1('0xe')];this['imapAccounts']={};this[_0x9df1('0xf')]=new EmailSmtp();}EmailChannel[_0x9df1('0x10')][_0x9df1('0x11')]=function(_0x22c902){var _0x6cf32=this[_0x9df1('0xe')][_0x22c902];var _0x42c3bc={'id':_0x6cf32['id'],'name':_0x6cf32[_0x9df1('0x12')],'key':_0x6cf32['key'],'active':_0x6cf32[_0x9df1('0x13')],'Imap':{'status':_0x6cf32[_0x9df1('0x14')]['status'],'messageStatus':_0x6cf32[_0x9df1('0x14')]['messageStatus'],'total':_0x6cf32[_0x9df1('0x14')]['total']}};if(_[_0x9df1('0x15')](md5Accounts[_0x22c902])){md5Accounts[_0x22c902]={};}var _0x2af74e=md5(JSON[_0x9df1('0x16')](_0x42c3bc));if(md5Accounts[_0x22c902][_0x9df1('0x2')]!==_0x2af74e){md5Accounts[_0x22c902][_0x9df1('0x2')]=_0x2af74e;io[_0x9df1('0x11')](_0x9df1('0x17'),_0x42c3bc);}};EmailChannel['prototype'][_0x9df1('0x18')]=function(_0x3ca631){for(var _0x163598 in _0x3ca631){if(_0x3ca631[_0x9df1('0x19')](_0x163598)){if(_0x3ca631[_0x163598][_0x9df1('0x14')]&&_0x3ca631[_0x163598]['active']){var _0x1551c7=_0x3ca631[_0x163598][_0x9df1('0x14')];if(!_0x1551c7[_0x9df1('0x1a')]&&_0x3ca631[_0x163598][_0x9df1('0x1b')]!==_0x9df1('0x1c'))_0x1551c7[_0x9df1('0x1a')]=_0x3ca631[_0x163598]['provider'];if(!this[_0x9df1('0x1d')][_0x9df1('0x19')](_0x1551c7['id'])){this['imapAccounts'][_0x1551c7['id']]=new EmailImap(_0x1551c7,_0x3ca631[_0x163598]['email']);this['imapAccounts'][_0x1551c7['id']]['on'](_0x9df1('0x1e'),this[_0x9df1('0x1f')][_0x9df1('0x20')](this,_0x163598));this[_0x9df1('0x1d')][_0x1551c7['id']]['on'](_0x9df1('0x5'),this[_0x9df1('0x21')][_0x9df1('0x20')](this,_0x163598));this['imapAccounts'][_0x1551c7['id']]['on'](_0x9df1('0x22'),this[_0x9df1('0x23')][_0x9df1('0x20')](this,_0x163598));this[_0x9df1('0x1d')][_0x1551c7['id']]['on'](_0x9df1('0x24'),this['handleImapError']['bind'](this,_0x163598));}}else{if(_[_0x9df1('0x15')](this[_0x9df1('0xe')][_0x163598]['Imap'])){this[_0x9df1('0xe')][_0x163598][_0x9df1('0x14')]={};}this[_0x9df1('0xe')][_0x163598][_0x9df1('0x14')][_0x9df1('0x25')]=_0x9df1('0x26');this[_0x9df1('0xe')][_0x163598][_0x9df1('0x14')][_0x9df1('0x27')]='';this[_0x9df1('0x11')](_0x163598);}}}};EmailChannel[_0x9df1('0x10')][_0x9df1('0x1f')]=function(_0x31e724,_0x184ff5){if(this[_0x9df1('0xe')][_0x31e724]){this[_0x9df1('0xe')][_0x31e724][_0x9df1('0x14')][_0x9df1('0x25')]=_0x9df1('0x28');this[_0x9df1('0xe')][_0x31e724][_0x9df1('0x14')][_0x9df1('0x27')]=_0x184ff5[_0x9df1('0x12')];if(_0x184ff5[_0x9df1('0x29')]){this[_0x9df1('0xe')][_0x31e724][_0x9df1('0x14')][_0x9df1('0x2a')]=_0x184ff5[_0x9df1('0x29')][_0x9df1('0x2a')];}return this[_0x9df1('0x11')](_0x31e724);}};EmailChannel['prototype'][_0x9df1('0x21')]=function(_0x49c7f7,_0x51e533){logger[_0x9df1('0xd')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x51e533[_0x9df1('0x2b')],_0x51e533[_0x9df1('0x2c')],_0x51e533['from'],_0x49c7f7);if(this['mailAccounts'][_0x49c7f7]){return mailAccount[_0x9df1('0x2d')](_0x49c7f7,_0x51e533)[_0x9df1('0x2e')](function(_0x39dae5){if(_0x39dae5){logger[_0x9df1('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0x9df1('0x2f')](function(_0x4d0340){logger['error'](_0x9df1('0x30'),JSON[_0x9df1('0x16')](_0x4d0340));});}};EmailChannel[_0x9df1('0x10')][_0x9df1('0x23')]=function(_0x3b585a){if(this[_0x9df1('0xe')][_0x3b585a]&&this['mailAccounts'][_0x3b585a][_0x9df1('0x14')]){if(this['imapAccounts'][this['mailAccounts'][_0x3b585a][_0x9df1('0x14')]['id']]){delete this[_0x9df1('0x1d')][this[_0x9df1('0xe')][_0x3b585a]['Imap']['id']];}this[_0x9df1('0xe')][_0x3b585a]['Imap'][_0x9df1('0x31')]=moment();this[_0x9df1('0x11')](_0x3b585a);}};EmailChannel[_0x9df1('0x10')][_0x9df1('0x32')]=function(_0x2e1a7b,_0x1177f9){if(this['mailAccounts'][_0x2e1a7b]){this[_0x9df1('0xe')][_0x2e1a7b][_0x9df1('0x14')][_0x9df1('0x25')]=_0x9df1('0x24');this[_0x9df1('0xe')][_0x2e1a7b][_0x9df1('0x14')][_0x9df1('0x27')]=_0x1177f9;return this[_0x9df1('0x11')](_0x2e1a7b);}};EmailChannel[_0x9df1('0x10')]['sendMail']=function(_0x5da91f,_0x413860){return this['smtp'][_0x9df1('0x33')](_0x5da91f,_0x413860);};EmailChannel[_0x9df1('0x10')][_0x9df1('0x34')]=function(_0x20aaae){var _0x2427e6=this;if(this['mailAccounts'][_0x20aaae['id']]){if(_[_0x9df1('0x15')](this['mailAccounts'][_0x20aaae['id']]['Smtp'])){this[_0x9df1('0xe')][_0x20aaae['id']]['Smtp']={};}this[_0x9df1('0xe')][_0x20aaae['id']][_0x9df1('0x35')][_0x9df1('0x31')]=moment();return new BPromise(function(_0x3166d2,_0x3c741b){return _0x2427e6['smtp'][_0x9df1('0x36')](_0x20aaae)['then'](function(_0x51a7ea){_0x2427e6[_0x9df1('0xe')][_0x20aaae['id']][_0x9df1('0x35')][_0x9df1('0x25')]=_0x9df1('0x37');_0x2427e6[_0x9df1('0xe')][_0x20aaae['id']][_0x9df1('0x35')][_0x9df1('0x27')]='';_0x2427e6[_0x9df1('0x11')](_0x20aaae['id']);_0x3166d2(_0x51a7ea);})[_0x9df1('0x2f')](function(_0x9fc7ec){_0x2427e6['mailAccounts'][_0x20aaae['id']][_0x9df1('0x35')][_0x9df1('0x25')]=_0x9df1('0x24');_0x2427e6[_0x9df1('0xe')][_0x20aaae['id']][_0x9df1('0x35')][_0x9df1('0x27')]=_0x9fc7ec;_0x2427e6[_0x9df1('0x11')](_0x20aaae['id']);_0x3c741b(_0x9fc7ec);});});}return this[_0x9df1('0xf')][_0x9df1('0x36')](_0x20aaae);};module[_0x9df1('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f573850..c1aaf81 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 _0x9713=['events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','service','user','xoauth2','CloudProvider','data5','authentication','password','anonymous@xcally.com','host','port','tls','autotls','required','handleOpenBox','box','readUnseen','end','search','handleReadUnseen','length','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','upperFirst','lodash','util','imap','simpleParser','iconv','Iconv'];(function(_0x23cead,_0x3b116d){var _0x1ada3e=function(_0x2a8f87){while(--_0x2a8f87){_0x23cead['push'](_0x23cead['shift']());}};_0x1ada3e(++_0x3b116d);}(_0x9713,0x72));var _0x3971=function(_0x57cb59,_0x2bcf6f){_0x57cb59=_0x57cb59-0x0;var _0x3319f6=_0x9713[_0x57cb59];return _0x3319f6;};'use strict';var _=require(_0x3971('0x0'));var util=require(_0x3971('0x1'));var Imap=require(_0x3971('0x2'));var simpleParser=require('mailparser')[_0x3971('0x3')];var Iconv=require(_0x3971('0x4'))[_0x3971('0x5')];var EventEmitter=require(_0x3971('0x6'))[_0x3971('0x7')];var utils=require(_0x3971('0x8'));var logger=require(_0x3971('0x9'))(_0x3971('0xa'));function EmailImap(_0x5388e5,_0x324613){this[_0x3971('0xb')]=_0x5388e5[_0x3971('0xb')];this[_0x3971('0xc')]=this[_0x3971('0xd')](_0x5388e5,_0x324613);this[_0x3971('0x2')]=new Imap(this[_0x3971('0xc')]);this[_0x3971('0x2')][_0x3971('0xe')](_0x3971('0xf'),this[_0x3971('0x10')][_0x3971('0x11')](this));this[_0x3971('0x2')][_0x3971('0xe')]('end',this[_0x3971('0x12')]['bind'](this));this[_0x3971('0x2')]['on'](_0x3971('0x13'),this[_0x3971('0x14')][_0x3971('0x11')](this));this[_0x3971('0x2')][_0x3971('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x3971('0x16')][_0x3971('0xd')]=function(_0x33519f,_0x2649a2){var _0x27dabc={'connTimeout':_0x33519f[_0x3971('0x17')]?_0x33519f[_0x3971('0x17')]*0x3e8:0x2710,'authTimeout':_0x33519f[_0x3971('0x18')]?_0x33519f[_0x3971('0x18')]*0x3e8:0x1388};if(_0x33519f[_0x3971('0x19')]){_0x27dabc[_0x3971('0x1a')]=_0x33519f['user'];if(_0x33519f['modernAuthentication']){_0x27dabc[_0x3971('0x1b')]=utils['generateXOAuth2Token'](_0x33519f[_0x3971('0x1c')][_0x3971('0x1d')],_0x33519f[_0x3971('0x1a')]);}else{_0x27dabc['password']=_0x33519f['password'];}}else{if(_0x33519f[_0x3971('0x1e')]){_0x27dabc['user']=_0x33519f[_0x3971('0x1a')];_0x27dabc[_0x3971('0x1f')]=_0x33519f[_0x3971('0x1f')];}}_0x27dabc[_0x3971('0xa')]=_0x2649a2||_0x33519f[_0x3971('0x1a')]||_0x3971('0x20');_0x27dabc[_0x3971('0x21')]=_0x33519f[_0x3971('0x21')];_0x27dabc[_0x3971('0x22')]=_0x33519f[_0x3971('0x22')]||0x3e1;if(_0x33519f['tls']){_0x27dabc[_0x3971('0x23')]=!![];}else{_0x27dabc['tls']=![];_0x27dabc[_0x3971('0x24')]=_0x3971('0x25');}return _0x27dabc;};EmailImap[_0x3971('0x16')]['handleReady']=function(){this['imap']['openBox'](this['mailbox'],![],this['handleOpenBox'][_0x3971('0x11')](this));};EmailImap['prototype'][_0x3971('0x26')]=function(_0x348ea1,_0x4d50e6){if(_0x348ea1){this[_0x3971('0x14')](_0x348ea1,!![]);}else{this['emit'](_0x3971('0x27'),_0x4d50e6);this[_0x3971('0x28')]();}};EmailImap[_0x3971('0x16')]['handleCloseBox']=function(_0x2b6050){if(_0x2b6050){this[_0x3971('0x14')](_0x2b6050,!![]);}else{this['imap'][_0x3971('0x29')]();}};EmailImap[_0x3971('0x16')][_0x3971('0x28')]=function(){this['imap'][_0x3971('0x2a')](['UNSEEN'],this[_0x3971('0x2b')]['bind'](this));};EmailImap[_0x3971('0x16')][_0x3971('0x2b')]=function(_0x3f7f2c,_0x507280){if(_0x3f7f2c){this[_0x3971('0x14')](_0x3f7f2c,!![]);}else{if(_0x507280[_0x3971('0x2c')]){try{var _0x10cce1=this[_0x3971('0x2')]['fetch'](_0x507280,{'bodies':'','markSeen':!![]});_0x10cce1['on']('message',this[_0x3971('0x2d')][_0x3971('0x11')](this));_0x10cce1[_0x3971('0xe')](_0x3971('0x13'),this[_0x3971('0x2e')]['bind'](this));_0x10cce1[_0x3971('0xe')]('end',this[_0x3971('0x2f')]['bind'](this));}catch(_0x37f4a2){logger[_0x3971('0x13')](_0x37f4a2);}}else{this[_0x3971('0x2')][_0x3971('0x30')](!![],this[_0x3971('0x31')][_0x3971('0x11')](this));}}};EmailImap[_0x3971('0x16')][_0x3971('0x2d')]=function(_0x300f4a){_0x300f4a['on']('body',this[_0x3971('0x32')][_0x3971('0x11')](this));_0x300f4a[_0x3971('0xe')](_0x3971('0x33'),this[_0x3971('0x34')][_0x3971('0x11')](this));_0x300f4a[_0x3971('0xe')](_0x3971('0x29'),this[_0x3971('0x35')]['bind'](this));};EmailImap[_0x3971('0x16')][_0x3971('0x32')]=function(_0x5410b4){simpleParser(_0x5410b4,{'Iconv':Iconv},this[_0x3971('0x36')][_0x3971('0x11')](this));};EmailImap[_0x3971('0x16')][_0x3971('0x34')]=function(){};EmailImap[_0x3971('0x16')][_0x3971('0x35')]=function(){};EmailImap[_0x3971('0x16')][_0x3971('0x36')]=function(_0x43a9f4,_0x533723){if(_0x43a9f4){logger[_0x3971('0x13')](_0x43a9f4);}else{var _0x58bd0f=this;utils[_0x3971('0x37')](this[_0x3971('0xc')],_0x533723,function(_0x5f5f90){_0x58bd0f[_0x3971('0x38')](_0x3971('0xa'),_0x5f5f90);});}};EmailImap[_0x3971('0x16')][_0x3971('0x2f')]=function(){this[_0x3971('0x2')][_0x3971('0x30')](!![],this[_0x3971('0x31')][_0x3971('0x11')](this));};EmailImap[_0x3971('0x16')][_0x3971('0x2e')]=function(_0x2907d7){this[_0x3971('0x14')](_0x2907d7);this['imap'][_0x3971('0x30')](!![],this[_0x3971('0x31')]['bind'](this));};EmailImap['prototype'][_0x3971('0x12')]=function(){this[_0x3971('0x38')]('end');};EmailImap[_0x3971('0x16')][_0x3971('0x14')]=function(_0x4415fe,_0x374a84){logger[_0x3971('0x13')](_0x3971('0x14'),this[_0x3971('0xc')][_0x3971('0xa')],JSON[_0x3971('0x39')](_0x4415fe));var _0x4797ad='';if(_0x4415fe){if(_0x4415fe[_0x3971('0x3a')]){_0x4797ad=_0x4415fe['textCode'];}else{for(var _0x4047f1 in _0x4415fe){if(_0x4415fe['hasOwnProperty'](_0x4047f1)){_0x4797ad+=_[_0x3971('0x3b')](_0x4047f1)+':\x20'+_0x4415fe[_0x4047f1]+'\x0a';}}}}if(_0x374a84){this[_0x3971('0x2')][_0x3971('0x29')]();}else{this['emit'](_0x3971('0x13'),_0x4797ad);this[_0x3971('0x38')](_0x3971('0x29'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x3438=['handleFetchError','handleFetchEnd','handleCloseBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','closeBox','error','stringify','textCode','hasOwnProperty','exports','lodash','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','end','handleEnd','handleError','connect','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','prototype','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage'];(function(_0x2af08c,_0x43e65e){var _0x35a354=function(_0xec8ca1){while(--_0xec8ca1){_0x2af08c['push'](_0x2af08c['shift']());}};_0x35a354(++_0x43e65e);}(_0x3438,0x141));var _0x8343=function(_0xd24b3a,_0x3b9f08){_0xd24b3a=_0xd24b3a-0x0;var _0xd48a43=_0x3438[_0xd24b3a];return _0xd48a43;};'use strict';var _=require(_0x8343('0x0'));var util=require('util');var Imap=require(_0x8343('0x1'));var simpleParser=require(_0x8343('0x2'))[_0x8343('0x3')];var Iconv=require('iconv')[_0x8343('0x4')];var EventEmitter=require(_0x8343('0x5'))[_0x8343('0x6')];var utils=require(_0x8343('0x7'));var logger=require(_0x8343('0x8'))(_0x8343('0x9'));function EmailImap(_0x44e01f,_0x1af3a9){this[_0x8343('0xa')]=_0x44e01f[_0x8343('0xa')];this[_0x8343('0xb')]=this['getAccount'](_0x44e01f,_0x1af3a9);this[_0x8343('0x1')]=new Imap(this[_0x8343('0xb')]);this['imap'][_0x8343('0xc')](_0x8343('0xd'),this[_0x8343('0xe')][_0x8343('0xf')](this));this[_0x8343('0x1')][_0x8343('0xc')](_0x8343('0x10'),this[_0x8343('0x11')][_0x8343('0xf')](this));this[_0x8343('0x1')]['on']('error',this[_0x8343('0x12')][_0x8343('0xf')](this));this[_0x8343('0x1')][_0x8343('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x9ddfd0,_0xc1b19c){var _0x1c10fe={'connTimeout':_0x9ddfd0[_0x8343('0x14')]?_0x9ddfd0[_0x8343('0x14')]*0x3e8:0x2710,'authTimeout':_0x9ddfd0[_0x8343('0x15')]?_0x9ddfd0['authTimeout']*0x3e8:0x1388};if(_0x9ddfd0[_0x8343('0x16')]){_0x1c10fe[_0x8343('0x17')]=_0x9ddfd0[_0x8343('0x17')];if(_0x9ddfd0[_0x8343('0x18')]){_0x1c10fe['xoauth2']=utils[_0x8343('0x19')](_0x9ddfd0[_0x8343('0x1a')][_0x8343('0x1b')],_0x9ddfd0['user']);}else{_0x1c10fe[_0x8343('0x1c')]=_0x9ddfd0['password'];}}else{if(_0x9ddfd0[_0x8343('0x1d')]){_0x1c10fe['user']=_0x9ddfd0[_0x8343('0x17')];_0x1c10fe['password']=_0x9ddfd0[_0x8343('0x1c')];}}_0x1c10fe[_0x8343('0x9')]=_0xc1b19c||_0x9ddfd0[_0x8343('0x17')]||'anonymous@xcally.com';_0x1c10fe['host']=_0x9ddfd0[_0x8343('0x1e')];_0x1c10fe[_0x8343('0x1f')]=_0x9ddfd0[_0x8343('0x1f')]||0x3e1;if(_0x9ddfd0['tls']){_0x1c10fe[_0x8343('0x20')]=!![];}else{_0x1c10fe[_0x8343('0x20')]=![];_0x1c10fe[_0x8343('0x21')]='required';}return _0x1c10fe;};EmailImap[_0x8343('0x22')][_0x8343('0xe')]=function(){this[_0x8343('0x1')][_0x8343('0x23')](this[_0x8343('0xa')],![],this[_0x8343('0x24')][_0x8343('0xf')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x52d880,_0x5a0bd7){if(_0x52d880){this[_0x8343('0x12')](_0x52d880,!![]);}else{this[_0x8343('0x25')](_0x8343('0x26'),_0x5a0bd7);this[_0x8343('0x27')]();}};EmailImap[_0x8343('0x22')]['handleCloseBox']=function(_0x1d63fc){if(_0x1d63fc){this[_0x8343('0x12')](_0x1d63fc,!![]);}else{this['imap'][_0x8343('0x10')]();}};EmailImap['prototype'][_0x8343('0x27')]=function(){this[_0x8343('0x1')][_0x8343('0x28')]([_0x8343('0x29')],this[_0x8343('0x2a')][_0x8343('0xf')](this));};EmailImap['prototype'][_0x8343('0x2a')]=function(_0x179bfa,_0x1a672b){if(_0x179bfa){this['handleError'](_0x179bfa,!![]);}else{if(_0x1a672b['length']){try{var _0x42f888=this[_0x8343('0x1')][_0x8343('0x2b')](_0x1a672b,{'bodies':'','markSeen':!![]});_0x42f888['on']('message',this[_0x8343('0x2c')][_0x8343('0xf')](this));_0x42f888[_0x8343('0xc')]('error',this[_0x8343('0x2d')][_0x8343('0xf')](this));_0x42f888['once'](_0x8343('0x10'),this[_0x8343('0x2e')][_0x8343('0xf')](this));}catch(_0x14c537){logger['error'](_0x14c537);}}else{this['imap']['closeBox'](!![],this[_0x8343('0x2f')][_0x8343('0xf')](this));}}};EmailImap['prototype'][_0x8343('0x2c')]=function(_0xc61ab7){_0xc61ab7['on'](_0x8343('0x30'),this[_0x8343('0x31')][_0x8343('0xf')](this));_0xc61ab7['once'](_0x8343('0x32'),this['handleMessageAttributes'][_0x8343('0xf')](this));_0xc61ab7[_0x8343('0xc')](_0x8343('0x10'),this[_0x8343('0x33')][_0x8343('0xf')](this));};EmailImap[_0x8343('0x22')][_0x8343('0x31')]=function(_0x37388){simpleParser(_0x37388,{'Iconv':Iconv},this[_0x8343('0x34')][_0x8343('0xf')](this));};EmailImap['prototype'][_0x8343('0x35')]=function(){};EmailImap['prototype'][_0x8343('0x33')]=function(){};EmailImap['prototype'][_0x8343('0x34')]=function(_0x6451c8,_0x16cdd7){if(_0x6451c8){logger['error'](_0x6451c8);}else{var _0x2648c6=this;utils[_0x8343('0x36')](this[_0x8343('0xb')],_0x16cdd7,function(_0x3d632a){_0x2648c6['emit'](_0x8343('0x9'),_0x3d632a);});}};EmailImap[_0x8343('0x22')][_0x8343('0x2e')]=function(){this[_0x8343('0x1')][_0x8343('0x37')](!![],this[_0x8343('0x2f')][_0x8343('0xf')](this));};EmailImap[_0x8343('0x22')][_0x8343('0x2d')]=function(_0x5bc784){this['handleError'](_0x5bc784);this[_0x8343('0x1')][_0x8343('0x37')](!![],this[_0x8343('0x2f')][_0x8343('0xf')](this));};EmailImap[_0x8343('0x22')][_0x8343('0x11')]=function(){this[_0x8343('0x25')](_0x8343('0x10'));};EmailImap[_0x8343('0x22')][_0x8343('0x12')]=function(_0x15b4e2,_0x4ea9a8){logger[_0x8343('0x38')](_0x8343('0x12'),this[_0x8343('0xb')][_0x8343('0x9')],JSON[_0x8343('0x39')](_0x15b4e2));var _0x2ff012='';if(_0x15b4e2){if(_0x15b4e2[_0x8343('0x3a')]){_0x2ff012=_0x15b4e2[_0x8343('0x3a')];}else{for(var _0x5e3177 in _0x15b4e2){if(_0x15b4e2[_0x8343('0x3b')](_0x5e3177)){_0x2ff012+=_['upperFirst'](_0x5e3177)+':\x20'+_0x15b4e2[_0x5e3177]+'\x0a';}}}}if(_0x4ea9a8){this[_0x8343('0x1')][_0x8343('0x10')]();}else{this['emit'](_0x8343('0x38'),_0x2ff012);this['emit'](_0x8343('0x10'));}};module[_0x8343('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 62fae40..a161e5f 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 _0xd25b=['prototype','send','createTransport','compile','toString','verify','Not\x20verifired','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd25b,0xe8));var _0xbd25=function(_0x3ca02b,_0x2d9a56){_0x3ca02b=_0x3ca02b-0x0;var _0x249935=_0xd25b[_0x3ca02b];return _0x249935;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xbd25('0x0')][_0xbd25('0x1')]=function(_0x59c66a,_0x27882f){return new Promise(function(_0x2b5a8d,_0x423df8){var _0x58e28e=nodemailer[_0xbd25('0x2')](_0x59c66a);_0x58e28e['use'](_0xbd25('0x3'),inlineBase64());_0x58e28e['sendMail'](_0x27882f,function(_0x1e5971,_0x5d237e){if(_0x1e5971){_0x423df8(_0x1e5971[_0xbd25('0x4')]());}else{_0x2b5a8d(_0x5d237e);}});});};EmailSmtp[_0xbd25('0x0')][_0xbd25('0x5')]=function(_0x5bbb7d){return new Promise(function(_0x5c3511,_0x43391e){var _0x1bcb7c=nodemailer[_0xbd25('0x2')](_0x5bbb7d);_0x1bcb7c[_0xbd25('0x5')](function(_0x545bb1,_0x190d01){if(_0x545bb1){_0x43391e(_0x545bb1[_0xbd25('0x4')]());}else{if(_0x190d01){_0x5c3511(_0x190d01);}else{_0x43391e(_0xbd25('0x6'));}}});});};module[_0xbd25('0x7')]=EmailSmtp; \ No newline at end of file +var _0xd099=['use','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','prototype','send','createTransport'];(function(_0x547f8b,_0x4660ff){var _0x2c7521=function(_0x219644){while(--_0x219644){_0x547f8b['push'](_0x547f8b['shift']());}};_0x2c7521(++_0x4660ff);}(_0xd099,0x11e));var _0x9d09=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0xd099[_0x1034bb];return _0x453fdb;};'use strict';var nodemailer=require(_0x9d09('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x9d09('0x1')][_0x9d09('0x2')]=function(_0xba9e2b,_0x5c891f){return new Promise(function(_0x6872b6,_0x4b6b6e){var _0x381932=nodemailer[_0x9d09('0x3')](_0xba9e2b);_0x381932[_0x9d09('0x4')]('compile',inlineBase64());_0x381932[_0x9d09('0x5')](_0x5c891f,function(_0x2829ac,_0x4f53a7){if(_0x2829ac){_0x4b6b6e(_0x2829ac[_0x9d09('0x6')]());}else{_0x6872b6(_0x4f53a7);}});});};EmailSmtp['prototype'][_0x9d09('0x7')]=function(_0x17dbbd){return new Promise(function(_0x2bc2bc,_0xb925c7){var _0x30a745=nodemailer['createTransport'](_0x17dbbd);_0x30a745['verify'](function(_0x30787a,_0x187517){if(_0x30787a){_0xb925c7(_0x30787a[_0x9d09('0x6')]());}else{if(_0x187517){_0x2bc2bc(_0x187517);}else{_0xb925c7(_0x9d09('0x8'));}}});});};module[_0x9d09('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 23f8c52..6c472ba 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 _0x3bfe=['body','textAsHtml','message','originTo','originCc','includes','bcc','attach','type','attachment','attachment-','format','%s-%s','now','join','root','server/files/attachments/','content','contentType','headerLines','Precedence:\x20auto_reply','line','parser','from','messageId','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','slice','pop','isEmpty','html','test','replace',''];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x3bfe,0x199));var _0xe3bf=function(_0x208c26,_0xd03b50){_0x208c26=_0x208c26-0x0;var _0x160b08=_0x3bfe[_0x208c26];return _0x160b08;};'use strict';var _=require(_0xe3bf('0x0'));var moment=require(_0xe3bf('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0xe3bf('0x2'));var logger=require(_0xe3bf('0x3'))(_0xe3bf('0x4'));var config=require(_0xe3bf('0x5'));function getAddress(_0x1f89bf){var _0x393a33=_[_0xe3bf('0x6')](_0x1f89bf[_0xe3bf('0x7')]);return _0x393a33&&_0x393a33[_0xe3bf('0x8')]?_0x393a33[_0xe3bf('0x8')]:_0xe3bf('0x9')+random[_0xe3bf('0xa')](0x6)+_0xe3bf('0xb');}function getFirstName(_0x58d246){var _0x364fa0=_['head'](_0x58d246[_0xe3bf('0x7')]);if(_0x364fa0&&_0x364fa0[_0xe3bf('0xc')]){if(_0x364fa0[_0xe3bf('0xc')]==_0x364fa0[_0xe3bf('0x8')]){return _0x364fa0[_0xe3bf('0xc')][_0xe3bf('0xd')](0x0,_0x364fa0[_0xe3bf('0xc')][_0xe3bf('0xe')]('@'));}var _0x17cbbc=_0x364fa0['name']['split'](/\s+/);return _0x17cbbc[_0xe3bf('0xf')]>0x1?_0x17cbbc[_0xe3bf('0x10')](0x0,-0x1)['join']('\x20'):_0x364fa0[_0xe3bf('0xc')];}return'Anonymous';}function getLastName(_0x3df4f2){var _0x4a5f23=_[_0xe3bf('0x6')](_0x3df4f2[_0xe3bf('0x7')]);if(_0x4a5f23&&_0x4a5f23[_0xe3bf('0xc')]){var _0x41ea03=_0x4a5f23[_0xe3bf('0xc')]['split'](/\s+/);return _0x41ea03[_0xe3bf('0xf')]>0x1?_0x41ea03[_0xe3bf('0x11')]():'';}return'';}function getMails(_0x53968b,_0x5e4dcb){var _0x2df7af='';for(var _0x13737e=0x0;_0x13737e<_0x5e4dcb[_0xe3bf('0x7')][_0xe3bf('0xf')];_0x13737e+=0x1){if(_0x5e4dcb[_0xe3bf('0x7')][_0x13737e][_0xe3bf('0x8')]!==_0x53968b){if(!_[_0xe3bf('0x12')](_0x2df7af)){_0x2df7af+=',';}_0x2df7af+=_0x5e4dcb['value'][_0x13737e]['name']||_0x5e4dcb[_0xe3bf('0x7')][_0x13737e]['address']||'';_0x2df7af+='\x20<';_0x2df7af+=_0x5e4dcb[_0xe3bf('0x7')][_0x13737e]['address']?_0x5e4dcb[_0xe3bf('0x7')][_0x13737e][_0xe3bf('0x8')]:_0xe3bf('0x9')+random[_0xe3bf('0xa')](0x6)+_0xe3bf('0xb');_0x2df7af+='>';}}return _0x2df7af;}function parseEmail(_0x2ec501,_0x129b24,_0x2afb65){if(_0x129b24[_0xe3bf('0x13')]){var _0x33673d=/)<[^<]*)*<\/script>/gi;while(_0x33673d[_0xe3bf('0x14')](_0x129b24[_0xe3bf('0x13')])){_0x129b24[_0xe3bf('0x13')]=_0x129b24[_0xe3bf('0x13')][_0xe3bf('0x15')](_0x33673d,'');}if(_0x129b24[_0xe3bf('0x13')]['includes'](_0xe3bf('0x16'))){var _0x541d67=[];_0x129b24[_0xe3bf('0x17')][_0xe3bf('0x18')](_0x47ae1b=>{_0x541d67[_0xe3bf('0x19')](_0x47ae1b[_0xe3bf('0x1a')]);});var _0x1dc34c=/]+>/g;var _0x4f40df=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x54ad31=_0x129b24[_0xe3bf('0x13')][_0xe3bf('0x15')](_0x4f40df,_0xe3bf('0x1b'));var _0x5a404e=_0x54ad31[_0xe3bf('0x15')](_0x1dc34c,'_IMG');for(let _0x38833b=0x0;_0x38833b<_0x541d67[_0xe3bf('0xf')];_0x38833b++){var _0x53923e=_0x5a404e[_0xe3bf('0x15')]('_IMG','\x20[Attachment:\x20'+_0x541d67[_0x38833b]+_0xe3bf('0x1c'));_0x5a404e=_0x53923e;}_0x129b24[_0xe3bf('0x13')]=_0x5a404e;}_0x2afb65[_0xe3bf('0x1d')]=_0x129b24[_0xe3bf('0x13')];}else{_0x2afb65[_0xe3bf('0x1d')]=_0x129b24[_0xe3bf('0x1e')];}if(_0x2afb65[_0xe3bf('0x1d')]){_0x2afb65[_0xe3bf('0x1d')]=_0x2afb65[_0xe3bf('0x1d')]['replace'](/0x0){var _0x3c001e=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0xe3bf('0x31')];for(var _0x5805f3=0x0;_0x5805f3<_0x129b24[_0xe3bf('0x30')][_0xe3bf('0xf')];_0x5805f3++){var _0x22e7df=_[_0xe3bf('0xe')](_0x3c001e,_0x129b24['headerLines'][_0x5805f3][_0xe3bf('0x32')]);if(_0x22e7df>=0x0){_0x2afb65['isAutoreply']=!![];}}}return _0x2afb65;}exports[_0xe3bf('0x33')]=function(_0x33a886,_0x518bcd,_0x28814d){var _0x19233f={'from':getAddress(_0x518bcd[_0xe3bf('0x34')]),'firstName':getFirstName(_0x518bcd[_0xe3bf('0x34')]),'lastName':getLastName(_0x518bcd['from']),'mapKey':_0xe3bf('0x4'),'message':{'from':getMails(_0x33a886['email'],_0x518bcd['from']),'to':_0x33a886['email'],'cc':'','subject':_0x518bcd['subject']||'','messageId':_0x518bcd[_0xe3bf('0x35')],'inReplyTo':_0x518bcd['inReplyTo'],'sentAt':moment(_0x518bcd[_0xe3bf('0x36')])[_0xe3bf('0x28')](_0xe3bf('0x37')),'attach':![],'attachments':[]}};if(!_0x518bcd[_0xe3bf('0x13')]&&!_0x518bcd['textAsHtml']){var _0x285eb1=_[_0xe3bf('0x38')](_0x518bcd[_0xe3bf('0x17')],{'contentType':_0xe3bf('0x39')});if(_0x285eb1['length']){logger[_0xe3bf('0x3a')](util[_0xe3bf('0x28')](_0xe3bf('0x3b'),_0x518bcd[_0xe3bf('0x35')]));tnef[_0xe3bf('0x3c')](_[_0xe3bf('0x3d')](_0x285eb1)[_0xe3bf('0x2e')],function(_0x9a1fb2,_0x4b6ac1){if(_0x4b6ac1){_0x518bcd[_0xe3bf('0x13')]=_0x4b6ac1[_0xe3bf('0x3e')]||'

Empty\x20message

';if(_0x4b6ac1[_0xe3bf('0x3f')]){for(var _0x12e5ab=0x0;_0x12e5ab<_0x4b6ac1[_0xe3bf('0x3f')][_0xe3bf('0xf')];_0x12e5ab++){var _0x1dce16=_0x4b6ac1[_0xe3bf('0x3f')][_0x12e5ab];_0x19233f[_0xe3bf('0x1f')][_0xe3bf('0x17')][_0xe3bf('0x19')]({'filename':_0x1dce16[_0xe3bf('0x40')],'content':Buffer[_0xe3bf('0x34')](_0x1dce16[_0xe3bf('0x41')])});}}}_0x28814d(parseEmail(_0x33a886,_0x518bcd,_0x19233f));});}else{_0x518bcd[_0xe3bf('0x13')]=_0xe3bf('0x42');_0x28814d(parseEmail(_0x33a886,_0x518bcd,_0x19233f));}}else{_0x28814d(parseEmail(_0x33a886,_0x518bcd,_0x19233f));}};exports[_0xe3bf('0x43')]=function(_0x1d87d6,_0x41fbf9){var _0xbcbf86=[_0xe3bf('0x44')+(_0x41fbf9||''),_0xe3bf('0x45')+_0x1d87d6,'',''];return Buffer[_0xe3bf('0x34')](_0xbcbf86[_0xe3bf('0x2b')](''),_0xe3bf('0x46'))[_0xe3bf('0x47')](_0xe3bf('0x48'));}; \ No newline at end of file +var _0x7f2c=['replace','includes','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','join','Anonymous','pop','isEmpty','html','test'];(function(_0x11c0ab,_0x513df6){var _0x40cdde=function(_0x574d59){while(--_0x574d59){_0x11c0ab['push'](_0x11c0ab['shift']());}};_0x40cdde(++_0x513df6);}(_0x7f2c,0x118));var _0xc7f2=function(_0x1b1aee,_0x57c8ed){_0x1b1aee=_0x1b1aee-0x0;var _0x276aa2=_0x7f2c[_0x1b1aee];return _0x276aa2;};'use strict';var _=require(_0xc7f2('0x0'));var moment=require(_0xc7f2('0x1'));var random=require(_0xc7f2('0x2'));var fs=require('fs');var path=require(_0xc7f2('0x3'));var util=require(_0xc7f2('0x4'));var tnef=require(_0xc7f2('0x5'));var logger=require('../../../config/logger')(_0xc7f2('0x6'));var config=require(_0xc7f2('0x7'));function getAddress(_0x373383){var _0x875e56=_[_0xc7f2('0x8')](_0x373383[_0xc7f2('0x9')]);return _0x875e56&&_0x875e56[_0xc7f2('0xa')]?_0x875e56[_0xc7f2('0xa')]:_0xc7f2('0xb')+random[_0xc7f2('0xc')](0x6)+_0xc7f2('0xd');}function getFirstName(_0x1818f2){var _0x53ea29=_[_0xc7f2('0x8')](_0x1818f2['value']);if(_0x53ea29&&_0x53ea29[_0xc7f2('0xe')]){if(_0x53ea29['name']==_0x53ea29['address']){return _0x53ea29['name'][_0xc7f2('0xf')](0x0,_0x53ea29[_0xc7f2('0xe')][_0xc7f2('0x10')]('@'));}var _0x307690=_0x53ea29[_0xc7f2('0xe')]['split'](/\s+/);return _0x307690[_0xc7f2('0x11')]>0x1?_0x307690['slice'](0x0,-0x1)[_0xc7f2('0x12')]('\x20'):_0x53ea29[_0xc7f2('0xe')];}return _0xc7f2('0x13');}function getLastName(_0x3a503b){var _0x303698=_[_0xc7f2('0x8')](_0x3a503b['value']);if(_0x303698&&_0x303698[_0xc7f2('0xe')]){var _0x38e550=_0x303698['name']['split'](/\s+/);return _0x38e550[_0xc7f2('0x11')]>0x1?_0x38e550[_0xc7f2('0x14')]():'';}return'';}function getMails(_0x463f0d,_0x2e4a82){var _0x54c100='';for(var _0x4f0b88=0x0;_0x4f0b88<_0x2e4a82[_0xc7f2('0x9')][_0xc7f2('0x11')];_0x4f0b88+=0x1){if(_0x2e4a82['value'][_0x4f0b88]['address']!==_0x463f0d){if(!_[_0xc7f2('0x15')](_0x54c100)){_0x54c100+=',';}_0x54c100+=_0x2e4a82[_0xc7f2('0x9')][_0x4f0b88][_0xc7f2('0xe')]||_0x2e4a82[_0xc7f2('0x9')][_0x4f0b88][_0xc7f2('0xa')]||'';_0x54c100+='\x20<';_0x54c100+=_0x2e4a82[_0xc7f2('0x9')][_0x4f0b88][_0xc7f2('0xa')]?_0x2e4a82['value'][_0x4f0b88][_0xc7f2('0xa')]:'anonymous'+random[_0xc7f2('0xc')](0x6)+_0xc7f2('0xd');_0x54c100+='>';}}return _0x54c100;}function parseEmail(_0x3a6a44,_0x5b2204,_0x341cdb){if(_0x5b2204[_0xc7f2('0x16')]){var _0x144e24=/)<[^<]*)*<\/script>/gi;while(_0x144e24[_0xc7f2('0x17')](_0x5b2204['html'])){_0x5b2204[_0xc7f2('0x16')]=_0x5b2204[_0xc7f2('0x16')][_0xc7f2('0x18')](_0x144e24,'');}if(_0x5b2204[_0xc7f2('0x16')][_0xc7f2('0x19')]('{_0x434e1b[_0xc7f2('0x1b')](_0x556e59[_0xc7f2('0x1c')]);});var _0x5d9839=/]+>/g;var _0x26c193=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3d1929=_0x5b2204[_0xc7f2('0x16')][_0xc7f2('0x18')](_0x26c193,_0xc7f2('0x1d'));var _0x2abfbd=_0x3d1929[_0xc7f2('0x18')](_0x5d9839,_0xc7f2('0x1e'));for(let _0xc71a5b=0x0;_0xc71a5b<_0x434e1b[_0xc7f2('0x11')];_0xc71a5b++){var _0x20bade=_0x2abfbd[_0xc7f2('0x18')](_0xc7f2('0x1e'),_0xc7f2('0x1f')+_0x434e1b[_0xc71a5b]+_0xc7f2('0x20'));_0x2abfbd=_0x20bade;}_0x5b2204[_0xc7f2('0x16')]=_0x2abfbd;}_0x341cdb[_0xc7f2('0x21')]=_0x5b2204[_0xc7f2('0x16')];}else{_0x341cdb[_0xc7f2('0x21')]=_0x5b2204[_0xc7f2('0x22')];}if(_0x341cdb[_0xc7f2('0x21')]){_0x341cdb[_0xc7f2('0x21')]=_0x341cdb[_0xc7f2('0x21')][_0xc7f2('0x18')](/0x0){var _0x3f24fa=[_0xc7f2('0x31'),'X-Auto-Response-Suppress:\x20All',_0xc7f2('0x32')];for(var _0x112338=0x0;_0x112338<_0x5b2204[_0xc7f2('0x33')][_0xc7f2('0x11')];_0x112338++){var _0x39d99a=_[_0xc7f2('0x10')](_0x3f24fa,_0x5b2204[_0xc7f2('0x33')][_0x112338]['line']);if(_0x39d99a>=0x0){_0x341cdb['isAutoreply']=!![];}}}return _0x341cdb;}exports[_0xc7f2('0x34')]=function(_0x103693,_0xebd8d,_0xfc508e){var _0x1bea2d={'from':getAddress(_0xebd8d['from']),'firstName':getFirstName(_0xebd8d['from']),'lastName':getLastName(_0xebd8d[_0xc7f2('0x35')]),'mapKey':_0xc7f2('0x6'),'message':{'from':getMails(_0x103693[_0xc7f2('0x6')],_0xebd8d[_0xc7f2('0x35')]),'to':_0x103693[_0xc7f2('0x6')],'cc':'','subject':_0xebd8d[_0xc7f2('0x36')]||'','messageId':_0xebd8d[_0xc7f2('0x37')],'inReplyTo':_0xebd8d[_0xc7f2('0x38')],'sentAt':moment(_0xebd8d[_0xc7f2('0x39')])[_0xc7f2('0x3a')](_0xc7f2('0x3b')),'attach':![],'attachments':[]}};if(!_0xebd8d[_0xc7f2('0x16')]&&!_0xebd8d[_0xc7f2('0x22')]){var _0x53781c=_[_0xc7f2('0x3c')](_0xebd8d[_0xc7f2('0x28')],{'contentType':_0xc7f2('0x3d')});if(_0x53781c[_0xc7f2('0x11')]){logger[_0xc7f2('0x3e')](util[_0xc7f2('0x3a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0xebd8d[_0xc7f2('0x37')]));tnef[_0xc7f2('0x3f')](_[_0xc7f2('0x40')](_0x53781c)[_0xc7f2('0x41')],function(_0x46a153,_0x8bb71c){if(_0x8bb71c){_0xebd8d[_0xc7f2('0x16')]=_0x8bb71c[_0xc7f2('0x42')]||'

Empty\x20message

';if(_0x8bb71c['Attachments']){for(var _0x376f00=0x0;_0x376f00<_0x8bb71c[_0xc7f2('0x43')][_0xc7f2('0x11')];_0x376f00++){var _0x3b801a=_0x8bb71c[_0xc7f2('0x43')][_0x376f00];_0x1bea2d['message']['attachments'][_0xc7f2('0x1b')]({'filename':_0x3b801a[_0xc7f2('0x44')],'content':Buffer[_0xc7f2('0x35')](_0x3b801a[_0xc7f2('0x45')])});}}}_0xfc508e(parseEmail(_0x103693,_0xebd8d,_0x1bea2d));});}else{_0xebd8d['html']=_0xc7f2('0x46');_0xfc508e(parseEmail(_0x103693,_0xebd8d,_0x1bea2d));}}else{_0xfc508e(parseEmail(_0x103693,_0xebd8d,_0x1bea2d));}};exports[_0xc7f2('0x47')]=function(_0x48c540,_0x5e391a){var _0x484129=['user='+(_0x5e391a||''),_0xc7f2('0x48')+_0x48c540,'',''];return Buffer[_0xc7f2('0x35')](_0x484129[_0xc7f2('0x12')](''),_0xc7f2('0x49'))[_0xc7f2('0x4a')](_0xc7f2('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index cdbfd0f..9fa875a 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 _0x1ab0=['SERV','Imap','Smtp','lodash','name','Service','key'];(function(_0x484bc0,_0x2dc089){var _0x293a5c=function(_0x3178f6){while(--_0x3178f6){_0x484bc0['push'](_0x484bc0['shift']());}};_0x293a5c(++_0x2dc089);}(_0x1ab0,0x65));var _0x01ab=function(_0x30ab7a,_0xb1340a){_0x30ab7a=_0x30ab7a-0x0;var _0x5ea4fc=_0x1ab0[_0x30ab7a];return _0x5ea4fc;};'use strict';var _=require(_0x01ab('0x0'));function MailAccount(_0x333229){this['id']=_0x333229['id']||0x0;this[_0x01ab('0x1')]=_0x333229['name']||_0x01ab('0x2');this[_0x01ab('0x3')]=_0x333229['key']||_0x01ab('0x4');this['active']=_0x333229['active']||![];this['Imap']=_0x333229[_0x01ab('0x5')]||[];this[_0x01ab('0x6')]=_0x333229[_0x01ab('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x78c5=['key','SERV','active','Imap','Smtp','name','Service'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x78c5,0x8a));var _0x578c=function(_0x1de841,_0x278c7c){_0x1de841=_0x1de841-0x0;var _0x19bce4=_0x78c5[_0x1de841];return _0x19bce4;};'use strict';var _=require('lodash');function MailAccount(_0xcbd6be){this['id']=_0xcbd6be['id']||0x0;this[_0x578c('0x0')]=_0xcbd6be[_0x578c('0x0')]||_0x578c('0x1');this[_0x578c('0x2')]=_0xcbd6be[_0x578c('0x2')]||_0x578c('0x3');this[_0x578c('0x4')]=_0xcbd6be[_0x578c('0x4')]||![];this['Imap']=_0xcbd6be[_0x578c('0x5')]||[];this[_0x578c('0x6')]=_0xcbd6be['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 7b0a284..ceb08ff 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 _0x724f=['length','isUndefined','../model/mailAccount','mapKeys','hasOwnProperty','prototype','initMailAccounts','mailAccounts'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0x724f,0xea));var _0xf724=function(_0x39a30a,_0x1bfbf5){_0x39a30a=_0x39a30a-0x0;var _0x1e0f54=_0x724f[_0x39a30a];return _0x1e0f54;};'use strict';var _=require('lodash');var MailAccount=require(_0xf724('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x39171d,_0x4e229f,_0x1803b6){var _0x57ee5f=_[_0xf724('0x1')](_0x39171d,function(_0x3efb1e,_0x1c9dc9){return _0x3efb1e[_0x1803b6];});for(var _0x5ae76e in _0x4e229f){if(_0x4e229f[_0xf724('0x2')](_0x5ae76e)){if(!_0x57ee5f[_0x5ae76e]){delete _0x4e229f[_0x5ae76e];}}}}Realtime[_0xf724('0x3')]['mergeFromDatabase']=function(_0x27e703,_0x3f02dc){for(var _0x15ece8 in _0x3f02dc){if(_0x27e703[_0xf724('0x2')](_0x15ece8)){_0x27e703[_0x15ece8]=_0x3f02dc[_0x15ece8];}}};Realtime[_0xf724('0x3')][_0xf724('0x4')]=function(){var _0x3275a8=this;return function(_0x450b6c){if(_0x450b6c){freeIsNotKey(_0x450b6c,_0x3275a8[_0xf724('0x5')],'id');for(var _0x400c65=0x0,_0x27e400={},_0x4bb86f={};_0x400c65<_0x450b6c[_0xf724('0x6')];_0x400c65+=0x1){_0x27e400=_0x450b6c[_0x400c65];if(_[_0xf724('0x7')](_0x3275a8[_0xf724('0x5')][_0x27e400['id']])){_0x3275a8[_0xf724('0x5')][_0x27e400['id']]=new MailAccount(_0x27e400);}else{_['merge'](_0x3275a8[_0xf724('0x5')][_0x27e400['id']],_0x27e400);}}}return _0x3275a8[_0xf724('0x5')];};};module['exports']=Realtime; \ No newline at end of file +var _0x9986=['mailAccounts','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9986,0x1d8));var _0x6998=function(_0x3c86dc,_0x5d22fc){_0x3c86dc=_0x3c86dc-0x0;var _0x4aeb79=_0x9986[_0x3c86dc];return _0x4aeb79;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x6998('0x0')]={};};function freeIsNotKey(_0x170c0d,_0x2e6afd,_0x5e2c27){var _0x5931ba=_['mapKeys'](_0x170c0d,function(_0x52d370,_0x28a5ff){return _0x52d370[_0x5e2c27];});for(var _0x37b489 in _0x2e6afd){if(_0x2e6afd[_0x6998('0x1')](_0x37b489)){if(!_0x5931ba[_0x37b489]){delete _0x2e6afd[_0x37b489];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0xad8d02,_0x4b76eb){for(var _0x493452 in _0x4b76eb){if(_0xad8d02[_0x6998('0x1')](_0x493452)){_0xad8d02[_0x493452]=_0x4b76eb[_0x493452];}}};Realtime[_0x6998('0x2')][_0x6998('0x3')]=function(){var _0x18878f=this;return function(_0x438ee0){if(_0x438ee0){freeIsNotKey(_0x438ee0,_0x18878f[_0x6998('0x0')],'id');for(var _0x597a50=0x0,_0x14a541={},_0x312ddd={};_0x597a50<_0x438ee0[_0x6998('0x4')];_0x597a50+=0x1){_0x14a541=_0x438ee0[_0x597a50];if(_[_0x6998('0x5')](_0x18878f[_0x6998('0x0')][_0x14a541['id']])){_0x18878f[_0x6998('0x0')][_0x14a541['id']]=new MailAccount(_0x14a541);}else{_[_0x6998('0x6')](_0x18878f[_0x6998('0x0')][_0x14a541['id']],_0x14a541);}}}return _0x18878f[_0x6998('0x0')];};};module[_0x6998('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 ce4d14c..7dc3f5f 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 _0x35a6=['service','email','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','Request','GetMailAccount','name','provider'];(function(_0x5267e1,_0x496cf0){var _0x816eae=function(_0x6b0729){while(--_0x6b0729){_0x5267e1['push'](_0x5267e1['shift']());}};_0x816eae(++_0x496cf0);}(_0x35a6,0x122));var _0x635a=function(_0x24cf99,_0x2e2189){_0x24cf99=_0x24cf99-0x0;var _0x210865=_0x35a6[_0x24cf99];return _0x210865;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x635a('0x0')](_0x635a('0x1'),{'options':{'attributes':['id',_0x635a('0x2'),_0x635a('0x3'),_0x635a('0x4'),_0x635a('0x5'),'active','key','ListId','TemplateId'],'raw':![],'include':[{'model':_0x635a('0x6'),'as':_0x635a('0x7'),'include':[{'model':_0x635a('0x8'),'attributes':['id',_0x635a('0x2'),_0x635a('0x4'),_0x635a('0x9'),_0x635a('0xa')],'as':_0x635a('0x8')}]},{'model':_0x635a('0xb'),'as':_0x635a('0xc'),'include':[{'model':_0x635a('0x8'),'attributes':['id',_0x635a('0x2'),'service','type',_0x635a('0xa')],'as':_0x635a('0x8')}]}]},'log':_0x635a('0xd')});};};exports['notify']=function(_0x179137,_0x187e3f){return client[_0x635a('0x0')]('NotifyMailAccount',{'account':{'id':_0x179137},'body':_0x187e3f,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x4279=['provider','service','email','key','TemplateId','MailServerIn','CloudProvider','data5','MailServerOut','type','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','name'];(function(_0x3de419,_0x16e055){var _0x55874b=function(_0x1c05b8){while(--_0x1c05b8){_0x3de419['push'](_0x3de419['shift']());}};_0x55874b(++_0x16e055);}(_0x4279,0x8d));var _0x9427=function(_0xe290a0,_0x53df14){_0xe290a0=_0xe290a0-0x0;var _0x54149e=_0x4279[_0xe290a0];return _0x54149e;};'use strict';var client=require('../client');exports[_0x9427('0x0')]=function(){return function(){return client[_0x9427('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x9427('0x2'),_0x9427('0x3'),_0x9427('0x4'),_0x9427('0x5'),'active',_0x9427('0x6'),'ListId',_0x9427('0x7')],'raw':![],'include':[{'model':_0x9427('0x8'),'as':'Imap','include':[{'model':_0x9427('0x9'),'attributes':['id',_0x9427('0x2'),_0x9427('0x4'),'type',_0x9427('0xa')],'as':'CloudProvider'}]},{'model':_0x9427('0xb'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x9427('0x2'),_0x9427('0x4'),_0x9427('0xc'),_0x9427('0xa')],'as':_0x9427('0x9')}]}]},'log':_0x9427('0xd')});};};exports[_0x9427('0xe')]=function(_0x1a7074,_0x5e003e){return client[_0x9427('0x1')](_0x9427('0xf'),{'account':{'id':_0x1a7074},'body':_0x5e003e,'log':_0x9427('0xf')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 338ce3c..0502437 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 _0xf81b=['GetSettings','../client','getSettings','ShowSetting','loginMailFrequency'];(function(_0x52f35a,_0x19f1e6){var _0x44d3b7=function(_0x1bfe87){while(--_0x1bfe87){_0x52f35a['push'](_0x52f35a['shift']());}};_0x44d3b7(++_0x19f1e6);}(_0xf81b,0x10f));var _0xbf81=function(_0x26b1d6,_0x21ee5e){_0x26b1d6=_0x26b1d6-0x0;var _0x4e307e=_0xf81b[_0x26b1d6];return _0x4e307e;};'use strict';var client=require(_0xbf81('0x0'));exports[_0xbf81('0x1')]=function(){return client['Request'](_0xbf81('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbf81('0x3')]},'log':_0xbf81('0x4')});}; \ No newline at end of file +var _0xfd20=['loginMailFrequency','GetSettings','../client','getSettings','ShowSetting'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xfd20,0x1e2));var _0x0fd2=function(_0x38ee8f,_0x23c2e6){_0x38ee8f=_0x38ee8f-0x0;var _0x379696=_0xfd20[_0x38ee8f];return _0x379696;};'use strict';var client=require(_0x0fd2('0x0'));exports[_0x0fd2('0x1')]=function(){return client['Request'](_0x0fd2('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0fd2('0x3')]},'log':_0x0fd2('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d85beb3..73e8ee1 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 63a3a04..f7c2bbd 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 _0xb844=['default','../../config/socketio','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session','timeout','listen','port','socket.io','websocket','polling','redis','defaults','socket.io-redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb844,0x1bf));var _0x4b84=function(_0x474096,_0xef26a8){_0x474096=_0x474096-0x0;var _0x43fd39=_0xb844[_0x474096];return _0x43fd39;};'use strict';var _=require(_0x4b84('0x0'));var http=require('http');var express=require(_0x4b84('0x1'));var sticky=require(_0x4b84('0x2'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server[_0x4b84('0x3')]=0xdbba0;if(sticky[_0x4b84('0x4')](server,config[_0x4b84('0x5')])){var socketio=require(_0x4b84('0x6'))(server,{'transports':[_0x4b84('0x7'),_0x4b84('0x8')]});config[_0x4b84('0x9')]=_[_0x4b84('0xa')](config[_0x4b84('0x9')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x4b84('0xb'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x4b84('0xc')]();require(_0x4b84('0xd'))[_0x4b84('0xc')](socketio);require('../../config/express')[_0x4b84('0xc')](app);require('../../routes')[_0x4b84('0xc')](app);}else{server[_0x4b84('0xe')](_0x4b84('0xf'),function(){console['log'](_0x4b84('0x10'),config[_0x4b84('0x5')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xaf6b=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','listen','socket.io','websocket','polling','redis','localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','once','listening'];(function(_0x511eaf,_0x5684df){var _0x39c52a=function(_0x4f1c46){while(--_0x4f1c46){_0x511eaf['push'](_0x511eaf['shift']());}};_0x39c52a(++_0x5684df);}(_0xaf6b,0xe9));var _0xbaf6=function(_0x4a6108,_0x35d316){_0x4a6108=_0x4a6108-0x0;var _0x2c0799=_0xaf6b[_0x4a6108];return _0x2c0799;};'use strict';var _=require(_0xbaf6('0x0'));var http=require(_0xbaf6('0x1'));var express=require(_0xbaf6('0x2'));var sticky=require(_0xbaf6('0x3'));var Redis=require(_0xbaf6('0x4'));var config=require(_0xbaf6('0x5'));var app=express();var server=http['createServer'](app);server[_0xbaf6('0x6')]=0xdbba0;if(sticky[_0xbaf6('0x7')](server,config['port'])){var socketio=require(_0xbaf6('0x8'))(server,{'transports':[_0xbaf6('0x9'),_0xbaf6('0xa')]});config[_0xbaf6('0xb')]=_['defaults'](config['redis'],{'host':_0xbaf6('0xc'),'port':0x18eb});socketio[_0xbaf6('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0xbaf6('0xb')]),'subClient':new Redis(config[_0xbaf6('0xb')])}));require(_0xbaf6('0xe'))[_0xbaf6('0xf')]();require(_0xbaf6('0x10'))[_0xbaf6('0xf')](socketio);require(_0xbaf6('0x11'))[_0xbaf6('0xf')](app);require('../../routes')['default'](app);}else{server[_0xbaf6('0x12')](_0xbaf6('0x13'),function(){console['log'](_0xbaf6('0x14'),config[_0xbaf6('0x15')]);});}exports=module[_0xbaf6('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e60a826..a5451a8 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 _0x2a70=['rpc','routing','error','message','result','catch','exports','jayson/promise','../../config/logger','client','http','Request','then','debug'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x2a70,0xe7));var _0x02a7=function(_0x3f0a7c,_0x16edda){_0x3f0a7c=_0x3f0a7c-0x0;var _0x2b3a28=_0x2a70[_0x3f0a7c];return _0x2b3a28;};'use strict';var jayson=require(_0x02a7('0x0'));var BPromise=require('bluebird');var logger=require(_0x02a7('0x1'))('routing');var client=jayson[_0x02a7('0x2')][_0x02a7('0x3')]({'port':0x2329});client[_0x02a7('0x4')]=function(_0x36a07b,_0x5cf677){return new BPromise(function(_0x8c6f51,_0x192ef8){return client['request'](_0x36a07b,_0x5cf677)[_0x02a7('0x5')](function(_0x13393a){logger[_0x02a7('0x6')](_0x02a7('0x7'),_0x02a7('0x8'),_0x36a07b,_0x5cf677,_0x13393a);if(_0x13393a[_0x02a7('0x9')]){logger['error'](_0x02a7('0x7'),_0x02a7('0x8'),_0x36a07b,_0x13393a[_0x02a7('0x9')][_0x02a7('0xa')],_0x5cf677);return _0x192ef8(_0x13393a[_0x02a7('0x9')][_0x02a7('0xa')]);}else{return _0x8c6f51(_0x13393a[_0x02a7('0xb')]);}})[_0x02a7('0xc')](function(_0x5ce86a){logger[_0x02a7('0x9')](_0x02a7('0x7'),_0x02a7('0x8'),_0x36a07b,_0x5ce86a,_0x5cf677);return _0x192ef8(_0x5ce86a);});});};module[_0x02a7('0xd')]=client; \ No newline at end of file +var _0x7348=['bluebird','http','Request','then','rpc','routing','error','message','result','exports'];(function(_0x1cf199,_0x2aeff6){var _0x2fdc24=function(_0x4df573){while(--_0x4df573){_0x1cf199['push'](_0x1cf199['shift']());}};_0x2fdc24(++_0x2aeff6);}(_0x7348,0x1b8));var _0x8734=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7348[_0x167cc1];return _0x10bc4b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8734('0x0'));var logger=require('../../config/logger')('routing');var client=jayson['client'][_0x8734('0x1')]({'port':0x2329});client[_0x8734('0x2')]=function(_0x590c91,_0x3df224){return new BPromise(function(_0x4f7e8e,_0x9cdca3){return client['request'](_0x590c91,_0x3df224)[_0x8734('0x3')](function(_0x99b6cf){logger['debug'](_0x8734('0x4'),_0x8734('0x5'),_0x590c91,_0x3df224,_0x99b6cf);if(_0x99b6cf['error']){logger[_0x8734('0x6')](_0x8734('0x4'),_0x8734('0x5'),_0x590c91,_0x99b6cf[_0x8734('0x6')][_0x8734('0x7')],_0x3df224);return _0x9cdca3(_0x99b6cf[_0x8734('0x6')]['message']);}else{return _0x4f7e8e(_0x99b6cf[_0x8734('0x8')]);}})['catch'](function(_0x213f9e){logger['error'](_0x8734('0x4'),_0x8734('0x5'),_0x590c91,_0x213f9e,_0x3df224);return _0x9cdca3(_0x213f9e);});});};module[_0x8734('0x9')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index b20d804..1424f0c 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 _0x8e74=['./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server'];(function(_0x521fb7,_0x1155cb){var _0x2ff4c5=function(_0x5152b9){while(--_0x5152b9){_0x521fb7['push'](_0x521fb7['shift']());}};_0x2ff4c5(++_0x1155cb);}(_0x8e74,0xee));var _0x48e7=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x8e74[_0x19b3f9];return _0x18c3f6;};'use strict';var BPromise=require(_0x48e7('0x0'));var server=require(_0x48e7('0x1'));var Realtime=require(_0x48e7('0x2'));var user=require(_0x48e7('0x3'));var interval=require(_0x48e7('0x4'));var openchannelQueue=require(_0x48e7('0x5'));var chatQueue=require(_0x48e7('0x6'));var smsQueue=require(_0x48e7('0x7'));var mailQueue=require(_0x48e7('0x8'));var faxQueue=require(_0x48e7('0x9'));var whatsappQueue=require(_0x48e7('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x48e7('0xb')]()[_0x48e7('0xc')](user[_0x48e7('0xd')]())[_0x48e7('0xc')](realtime[_0x48e7('0xe')]())[_0x48e7('0xc')](interval[_0x48e7('0xf')]())[_0x48e7('0xc')](realtime[_0x48e7('0x10')]())[_0x48e7('0xc')](openchannelQueue[_0x48e7('0x11')]())[_0x48e7('0xc')](realtime[_0x48e7('0x12')]())['then'](chatQueue[_0x48e7('0x13')]())[_0x48e7('0xc')](realtime['initChatQueues']())['then'](smsQueue[_0x48e7('0x14')]())[_0x48e7('0xc')](realtime[_0x48e7('0x15')]())[_0x48e7('0xc')](mailQueue[_0x48e7('0x16')]())[_0x48e7('0xc')](realtime['initMailQueues']())[_0x48e7('0xc')](faxQueue[_0x48e7('0x17')]())[_0x48e7('0xc')](realtime[_0x48e7('0x18')]())[_0x48e7('0xc')](whatsappQueue[_0x48e7('0x19')]())['then'](realtime[_0x48e7('0x1a')]())[_0x48e7('0xc')](function(){return realtime;});}function main(){return server[_0x48e7('0x1b')](realtime)[_0x48e7('0xc')](function(_0x4da4d3){return initRealtime();})['then'](function(_0x3eabca){return setInterval(initRealtime,0x1388);})[_0x48e7('0x1c')](function(_0x35b53c){console[_0x48e7('0x1d')](_0x35b53c);});}main(); \ No newline at end of file +var _0x203f=['./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','getAgents','then','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues','listen','catch','bluebird','./server'];(function(_0x89ac9,_0x48a36d){var _0xa1928a=function(_0x5ac0aa){while(--_0x5ac0aa){_0x89ac9['push'](_0x89ac9['shift']());}};_0xa1928a(++_0x48a36d);}(_0x203f,0x1a0));var _0xf203=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x203f[_0x16629d];return _0x56ccee;};'use strict';var BPromise=require(_0xf203('0x0'));var server=require(_0xf203('0x1'));var Realtime=require('./realtime');var user=require(_0xf203('0x2'));var interval=require(_0xf203('0x3'));var openchannelQueue=require(_0xf203('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xf203('0x5'));var mailQueue=require(_0xf203('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xf203('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0xf203('0x8')]())[_0xf203('0x9')](realtime[_0xf203('0xa')]())[_0xf203('0x9')](interval[_0xf203('0xb')]())[_0xf203('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0xf203('0xc')]())[_0xf203('0x9')](realtime[_0xf203('0xd')]())[_0xf203('0x9')](chatQueue[_0xf203('0xe')]())[_0xf203('0x9')](realtime[_0xf203('0xf')]())['then'](smsQueue['getSmsQueues']())[_0xf203('0x9')](realtime[_0xf203('0x10')]())[_0xf203('0x9')](mailQueue[_0xf203('0x11')]())[_0xf203('0x9')](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0xf203('0x9')](realtime[_0xf203('0x12')]())['then'](whatsappQueue[_0xf203('0x13')]())[_0xf203('0x9')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0xf203('0x14')](realtime)['then'](function(_0x3ca285){return initRealtime();})[_0xf203('0x9')](function(_0x283e1c){return setInterval(initRealtime,0x1388);})[_0xf203('0x15')](function(_0x3bb03f){console['log'](_0x3bb03f);});}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 00b25a5..79d90c6 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(_0x52a9ea,_0x182897){var _0x32df31=function(_0x3ffa0e){while(--_0x3ffa0e){_0x52a9ea['push'](_0x52a9ea['shift']());}};_0x32df31(++_0x182897);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x110e86,_0x2bff62){var _0x16d1a8=function(_0x1722a4){while(--_0x1722a4){_0x110e86['push'](_0x110e86['shift']());}};_0x16d1a8(++_0x2bff62);}(_0x7a54,0x106));var _0x47a5=function(_0x355ec0,_0x2d0630){_0x355ec0=_0x355ec0-0x0;var _0x30e919=_0x7a54[_0x355ec0];return _0x30e919;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index f674334..a2bbc86 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 _0xff3c=['sendMailMessage','SendMail','jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x4c8e29,_0x1fbc30){var _0x109e14=function(_0x49392a){while(--_0x49392a){_0x4c8e29['push'](_0x4c8e29['shift']());}};_0x109e14(++_0x1fbc30);}(_0xff3c,0xb2));var _0xcff3=function(_0x576710,_0x2766d0){_0x576710=_0x576710-0x0;var _0x792aaa=_0xff3c[_0x576710];return _0x792aaa;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xcff3('0x0'));var client=jayson[_0xcff3('0x1')][_0xcff3('0x2')]({'port':0x232b});function request(_0x3f2dd3,_0x5f00fb){return new BPromise(function(_0x5baf64,_0x37c33f){return client[_0xcff3('0x3')](_0x3f2dd3,_0x5f00fb)[_0xcff3('0x4')](function(_0x37d040){if(_0x37d040[_0xcff3('0x5')]){return _0x37c33f(_0x37d040['error'][_0xcff3('0x6')]);}else{return _0x5baf64(_0x37d040[_0xcff3('0x7')]);}})[_0xcff3('0x8')](function(_0x438e4e){return _0x37c33f(_0x438e4e);});});}exports[_0xcff3('0x9')]=function(_0x5ad722,_0x5b5515){return request(_0xcff3('0xa'),{'account':_0x5ad722,'message':_0x5b5515});}; \ No newline at end of file +var _0x8430=['http','request','catch','sendMailMessage','bluebird','client'];(function(_0x2ffbce,_0x3b242d){var _0xd8005b=function(_0x567e42){while(--_0x567e42){_0x2ffbce['push'](_0x2ffbce['shift']());}};_0xd8005b(++_0x3b242d);}(_0x8430,0x94));var _0x0843=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x8430[_0x33fcbb];return _0x2efe40;};'use strict';var BPromise=require(_0x0843('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x0843('0x1')][_0x0843('0x2')]({'port':0x232b});function request(_0x3d4d5b,_0x49db14){return new BPromise(function(_0x296dc2,_0xec37c3){return client[_0x0843('0x3')](_0x3d4d5b,_0x49db14)['then'](function(_0x51e0c5){if(_0x51e0c5['error']){return _0xec37c3(_0x51e0c5['error']['message']);}else{return _0x296dc2(_0x51e0c5['result']);}})[_0x0843('0x4')](function(_0x2410c4){return _0xec37c3(_0x2410c4);});});}exports[_0x0843('0x5')]=function(_0x140edf,_0x207479){return request('SendMail',{'account':_0x140edf,'message':_0x207479});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index f927806..d773311 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 _0x7c46=['mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','updateRealtime','chat','fax','sms','whatsapp','length','Status','StatusTime','smsPause','chatStatus','mailStatusTime','faxStatus','smsStatus','whatsappCurrentCapacity','openchannelCurrentCapacity','busy','openchannelWaitingInteractions','stringify','emit','user:save','exports','moment','md5','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus'];(function(_0x191a10,_0x1c06ab){var _0x2611b3=function(_0x17861f){while(--_0x17861f){_0x191a10['push'](_0x191a10['shift']());}};_0x2611b3(++_0x1c06ab);}(_0x7c46,0x1a1));var _0x67c4=function(_0x5a593e,_0x492b56){_0x5a593e=_0x5a593e-0x0;var _0x3349f0=_0x7c46[_0x5a593e];return _0x3349f0;};'use strict';var _=require('lodash');var moment=require(_0x67c4('0x0'));var md5=require(_0x67c4('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x67c4('0x2')]=_[_0x67c4('0x3')](config[_0x67c4('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x67c4('0x4'))(new Redis(config[_0x67c4('0x2')]));function Agent(_0x3762f0){this['id']=_0x3762f0['id']||0x0;this[_0x67c4('0x5')]=_0x3762f0['name']||'';this[_0x67c4('0x6')]=_0x3762f0[_0x67c4('0x6')]||!![];this[_0x67c4('0x7')]=_0x3762f0[_0x67c4('0x7')]||![];this[_0x67c4('0x8')]=_0x3762f0[_0x67c4('0x8')]||![];this[_0x67c4('0x9')]=_0x3762f0['mailPause']||![];this[_0x67c4('0xa')]=_0x3762f0['faxPause']||![];this['smsPause']=_0x3762f0['smsPause']||![];this[_0x67c4('0xb')]=_0x3762f0[_0x67c4('0xb')]||![];this['chatStatus']=_0x67c4('0xc');this[_0x67c4('0xd')]=0x0;this[_0x67c4('0xe')]=_0x3762f0[_0x67c4('0xe')]||0x0;this[_0x67c4('0xf')]=0x0;this[_0x67c4('0x10')]=_0x67c4('0xc');this['mailStatusTime']=0x0;this['mailCapacity']=_0x3762f0['mailCapacity']||0x0;this[_0x67c4('0x11')]=0x0;this['faxStatus']=_0x67c4('0xc');this[_0x67c4('0x12')]=0x0;this['faxCapacity']=_0x3762f0[_0x67c4('0x13')]||0x0;this[_0x67c4('0x14')]=0x0;this['smsStatus']=_0x67c4('0xc');this[_0x67c4('0x15')]=0x0;this[_0x67c4('0x16')]=_0x3762f0[_0x67c4('0x16')]||0x0;this[_0x67c4('0x17')]=0x0;this[_0x67c4('0x18')]=_0x67c4('0xc');this[_0x67c4('0x19')]=0x0;this[_0x67c4('0x1a')]=_0x3762f0[_0x67c4('0x1a')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x67c4('0x1b')]=_0x67c4('0xc');this[_0x67c4('0x1c')]=0x0;this[_0x67c4('0x1d')]=_0x3762f0[_0x67c4('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x67c4('0x1e')]=undefined;this['md5']='';this[_0x67c4('0x1f')]={};this[_0x67c4('0x20')]={};this[_0x67c4('0x21')]={};this['openchannelWaitingInteractions']={};this[_0x67c4('0x22')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x67c4('0x23')][_0x67c4('0x24')]=function(_0x56850e){if(this[_0x56850e+_0x67c4('0x25')]>0x0){if(this[_0x56850e+_0x67c4('0x26')]>0x0&&this[_0x56850e+_0x67c4('0x25')]>=this[_0x56850e+_0x67c4('0x26')]){return'maxcapacity';}else{return _0x67c4('0x27');}}else{return _0x67c4('0x28');}};Agent[_0x67c4('0x23')][_0x67c4('0x29')]=function(){var _0x386e82=['mail',_0x67c4('0x2a'),'openchannel',_0x67c4('0x2b'),_0x67c4('0x2c'),_0x67c4('0x2d')];for(var _0x1be8c5=0x0;_0x1be8c5<_0x386e82[_0x67c4('0x2e')];_0x1be8c5+=0x1){var _0x8e8c37=this[_0x67c4('0x24')](_0x386e82[_0x1be8c5]);if(this[_0x386e82[_0x1be8c5]+_0x67c4('0x2f')]!==_0x8e8c37){this[_0x386e82[_0x1be8c5]+_0x67c4('0x30')]=_['toNumber'](moment()['format']('x'));}this[_0x386e82[_0x1be8c5]+_0x67c4('0x2f')]=_0x8e8c37;}var _0x7ca406={'id':this['id'],'name':this[_0x67c4('0x5')],'online':this[_0x67c4('0x6')],'voicePause':this[_0x67c4('0x7')],'chatPause':this[_0x67c4('0x8')],'mailPause':this[_0x67c4('0x9')],'smsPause':this[_0x67c4('0x31')],'faxPause':this['faxPause'],'openchannelPause':this[_0x67c4('0xb')],'chatStatus':this[_0x67c4('0x32')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x67c4('0xe')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x67c4('0x10')],'mailStatusTime':this[_0x67c4('0x33')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x67c4('0x34')],'faxStatusTime':this[_0x67c4('0x12')],'faxCapacity':this[_0x67c4('0x13')],'faxCurrentCapacity':this[_0x67c4('0x14')],'smsStatus':this[_0x67c4('0x35')],'smsStatusTime':this[_0x67c4('0x15')],'smsCapacity':this[_0x67c4('0x16')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x67c4('0x18')],'whatsappStatusTime':this[_0x67c4('0x19')],'whatsappCapacity':this[_0x67c4('0x1a')],'whatsappCurrentCapacity':this[_0x67c4('0x36')],'openchannelStatus':this[_0x67c4('0x1b')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x67c4('0x1d')],'openchannelCurrentCapacity':this[_0x67c4('0x37')],'busy':this[_0x67c4('0x38')],'busyQueue':this[_0x67c4('0x1e')],'chatWaitingInteractions':this[_0x67c4('0x1f')],'faxWaitingInteractions':this[_0x67c4('0x20')],'mailWaitingInteractions':this[_0x67c4('0x21')],'openchannelWaitingInteractions':this[_0x67c4('0x39')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x1e0022=md5(JSON[_0x67c4('0x3a')](_0x7ca406));if(this[_0x67c4('0x1')]!==_0x1e0022){this['md5']=_0x1e0022;io[_0x67c4('0x3b')](_0x67c4('0x3c'),_0x7ca406);}};module[_0x67c4('0x3d')]=Agent; \ No newline at end of file +var _0x13ce=['faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','sms','whatsapp','Status','StatusTime','toNumber','format','name','mailPause','chatCurrentCapacity','mailCurrentCapacity','smsStatus','whatsappStatus','whatsappStatusTime','openchannelCurrentCapacity','mailWaitingInteractions','stringify','emit','user:save','exports','lodash','moment','ioredis','redis','defaults','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime'];(function(_0x5b0e77,_0x233e4a){var _0x4ab639=function(_0x2dd8e9){while(--_0x2dd8e9){_0x5b0e77['push'](_0x5b0e77['shift']());}};_0x4ab639(++_0x233e4a);}(_0x13ce,0xb5));var _0xe13c=function(_0xccc63f,_0x4db4fa){_0xccc63f=_0xccc63f-0x0;var _0x417074=_0x13ce[_0xccc63f];return _0x417074;};'use strict';var _=require(_0xe13c('0x0'));var moment=require(_0xe13c('0x1'));var md5=require('md5');var Redis=require(_0xe13c('0x2'));var config=require('../../../config/environment');config[_0xe13c('0x3')]=_[_0xe13c('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe13c('0x3')]));function Agent(_0x2d7097){this['id']=_0x2d7097['id']||0x0;this['name']=_0x2d7097['name']||'';this[_0xe13c('0x5')]=_0x2d7097[_0xe13c('0x5')]||!![];this[_0xe13c('0x6')]=_0x2d7097[_0xe13c('0x6')]||![];this[_0xe13c('0x7')]=_0x2d7097[_0xe13c('0x7')]||![];this['mailPause']=_0x2d7097['mailPause']||![];this[_0xe13c('0x8')]=_0x2d7097[_0xe13c('0x8')]||![];this[_0xe13c('0x9')]=_0x2d7097['smsPause']||![];this[_0xe13c('0xa')]=_0x2d7097[_0xe13c('0xa')]||![];this[_0xe13c('0xb')]=_0xe13c('0xc');this[_0xe13c('0xd')]=0x0;this[_0xe13c('0xe')]=_0x2d7097['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xe13c('0xf')]=_0xe13c('0xc');this[_0xe13c('0x10')]=0x0;this[_0xe13c('0x11')]=_0x2d7097[_0xe13c('0x11')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xe13c('0x12')]=_0xe13c('0xc');this[_0xe13c('0x13')]=0x0;this[_0xe13c('0x14')]=_0x2d7097['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0xe13c('0xc');this[_0xe13c('0x15')]=0x0;this[_0xe13c('0x16')]=_0x2d7097[_0xe13c('0x16')]||0x0;this[_0xe13c('0x17')]=0x0;this['whatsappStatus']=_0xe13c('0xc');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x2d7097[_0xe13c('0x18')]||0x0;this[_0xe13c('0x19')]=0x0;this[_0xe13c('0x1a')]=_0xe13c('0xc');this[_0xe13c('0x1b')]=0x0;this[_0xe13c('0x1c')]=_0x2d7097[_0xe13c('0x1c')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xe13c('0x1d')]=![];this[_0xe13c('0x1e')]=undefined;this[_0xe13c('0x1f')]='';this[_0xe13c('0x20')]={};this[_0xe13c('0x21')]={};this['mailWaitingInteractions']={};this[_0xe13c('0x22')]={};this[_0xe13c('0x23')]={};this[_0xe13c('0x24')]={};this[_0xe13c('0x25')]();}Agent[_0xe13c('0x26')][_0xe13c('0x27')]=function(_0x12fb65){if(this[_0x12fb65+_0xe13c('0x28')]>0x0){if(this[_0x12fb65+_0xe13c('0x29')]>0x0&&this[_0x12fb65+'CurrentCapacity']>=this[_0x12fb65+_0xe13c('0x29')]){return _0xe13c('0x2a');}else{return _0xe13c('0x2b');}}else{return _0xe13c('0x2c');}};Agent[_0xe13c('0x26')][_0xe13c('0x25')]=function(){var _0x1660ca=[_0xe13c('0x2d'),_0xe13c('0x2e'),_0xe13c('0x2f'),'fax',_0xe13c('0x30'),_0xe13c('0x31')];for(var _0x1bd718=0x0;_0x1bd718<_0x1660ca['length'];_0x1bd718+=0x1){var _0x3b62dd=this[_0xe13c('0x27')](_0x1660ca[_0x1bd718]);if(this[_0x1660ca[_0x1bd718]+_0xe13c('0x32')]!==_0x3b62dd){this[_0x1660ca[_0x1bd718]+_0xe13c('0x33')]=_[_0xe13c('0x34')](moment()[_0xe13c('0x35')]('x'));}this[_0x1660ca[_0x1bd718]+'Status']=_0x3b62dd;}var _0x179533={'id':this['id'],'name':this[_0xe13c('0x36')],'online':this[_0xe13c('0x5')],'voicePause':this[_0xe13c('0x6')],'chatPause':this[_0xe13c('0x7')],'mailPause':this[_0xe13c('0x37')],'smsPause':this[_0xe13c('0x9')],'faxPause':this['faxPause'],'openchannelPause':this[_0xe13c('0xa')],'chatStatus':this[_0xe13c('0xb')],'chatStatusTime':this[_0xe13c('0xd')],'chatCapacity':this[_0xe13c('0xe')],'chatCurrentCapacity':this[_0xe13c('0x38')],'mailStatus':this[_0xe13c('0xf')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xe13c('0x11')],'mailCurrentCapacity':this[_0xe13c('0x39')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xe13c('0x13')],'faxCapacity':this[_0xe13c('0x14')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xe13c('0x3a')],'smsStatusTime':this[_0xe13c('0x15')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xe13c('0x17')],'whatsappStatus':this[_0xe13c('0x3b')],'whatsappStatusTime':this[_0xe13c('0x3c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xe13c('0x19')],'openchannelStatus':this[_0xe13c('0x1a')],'openchannelStatusTime':this[_0xe13c('0x1b')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xe13c('0x3d')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xe13c('0x21')],'mailWaitingInteractions':this[_0xe13c('0x3e')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xe13c('0x24')]};var _0x1ffacb=md5(JSON[_0xe13c('0x3f')](_0x179533));if(this[_0xe13c('0x1f')]!==_0x1ffacb){this[_0xe13c('0x1f')]=_0x1ffacb;io[_0xe13c('0x40')](_0xe13c('0x41'),_0x179533);}};module[_0xe13c('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 36c33e5..43d1629 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 _0xabae=['format','chat:queue:%s','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','md5','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','length','online','chatPause','paused','available','waiting'];(function(_0x3f4576,_0x4522fc){var _0x12ee30=function(_0x5d7c80){while(--_0x5d7c80){_0x3f4576['push'](_0x3f4576['shift']());}};_0x12ee30(++_0x4522fc);}(_0xabae,0x126));var _0xeaba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xabae[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeaba('0x0'));var md5=require('md5');var util=require(_0xeaba('0x1'));var Redis=require(_0xeaba('0x2'));var config=require(_0xeaba('0x3'));config[_0xeaba('0x4')]=_[_0xeaba('0x5')](config[_0xeaba('0x4')],{'host':_0xeaba('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeaba('0x4')]));function ChatQueue(_0x442b21){this['id']=_0x442b21['id']||0x0;this[_0xeaba('0x7')]=_0x442b21[_0xeaba('0x7')]||'';this[_0xeaba('0x8')]=_0x442b21[_0xeaba('0x8')]||0xa;this[_0xeaba('0x9')]=_0x442b21['strategy']||'beepall';this[_0xeaba('0xa')]=_0x442b21['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xeaba('0xb')]='';this[_0xeaba('0xc')]();this[_0xeaba('0xd')]();}ChatQueue[_0xeaba('0xe')][_0xeaba('0xc')]=function(){var _0x1fa3db=this['mapAgentsId'][_0xeaba('0xf')];this[_0xeaba('0x10')]=_[_0xeaba('0x11')](this[_0xeaba('0xa')],'id');this[_0xeaba('0x10')][_0xeaba('0xf')]=_0x1fa3db;};ChatQueue['prototype'][_0xeaba('0xd')]=function(){this[_0xeaba('0x12')]=0x0;this['paused']=0x0;for(var _0x34a8e6=0x0;_0x34a8e6=0x0?this[_0xeaba('0x17')]:0x0;var _0x23418f={'id':this['id'],'available':this[_0xeaba('0x17')],'loggedIn':this[_0xeaba('0x12')],'name':this[_0xeaba('0x7')],'paused':this[_0xeaba('0x16')],'waiting':this[_0xeaba('0x18')]};var _0x41745c=md5(JSON['stringify'](_0x23418f));if(this[_0xeaba('0xb')]!==_0x41745c){this[_0xeaba('0xb')]=_0x41745c;io['to'](util[_0xeaba('0x19')](_0xeaba('0x1a'),_0x23418f[_0xeaba('0x7')]))['emit'](_0xeaba('0x1b'),_0x23418f);}};module[_0xeaba('0x1c')]=ChatQueue; \ No newline at end of file +var _0xe62b=['updateRealtime','length','online','loggedIn','chatPause','paused','available','chat_queue:save','md5','util','../../../config/environment','redis','localhost','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map'];(function(_0x95f1b7,_0x132a5b){var _0x476b9b=function(_0x239176){while(--_0x239176){_0x95f1b7['push'](_0x95f1b7['shift']());}};_0x476b9b(++_0x132a5b);}(_0xe62b,0x7b));var _0xbe62=function(_0x4578e7,_0x1c72a2){_0x4578e7=_0x4578e7-0x0;var _0x3db768=_0xe62b[_0x4578e7];return _0x3db768;};'use strict';var _=require('lodash');var md5=require(_0xbe62('0x0'));var util=require(_0xbe62('0x1'));var Redis=require('ioredis');var config=require(_0xbe62('0x2'));config['redis']=_['defaults'](config[_0xbe62('0x3')],{'host':_0xbe62('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbe62('0x3')]));function ChatQueue(_0x34d342){this['id']=_0x34d342['id']||0x0;this[_0xbe62('0x5')]=_0x34d342[_0xbe62('0x5')]||'';this['timeout']=_0x34d342['timeout']||0xa;this[_0xbe62('0x6')]=_0x34d342[_0xbe62('0x6')]||_0xbe62('0x7');this[_0xbe62('0x8')]=_0x34d342[_0xbe62('0x8')];this[_0xbe62('0x9')]={};this[_0xbe62('0xa')]=0x0;this[_0xbe62('0x0')]='';this[_0xbe62('0xb')]();this['updateRealtime']();}ChatQueue[_0xbe62('0xc')]['updateRouting']=function(){var _0x16b55e=this['mapAgentsId'][_0xbe62('0xd')];this[_0xbe62('0x9')]=_[_0xbe62('0xe')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x16b55e;};ChatQueue[_0xbe62('0xc')][_0xbe62('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x1fb8f1=0x0;_0x1fb8f1=0x0?this[_0xbe62('0x15')]:0x0;var _0x54a31f={'id':this['id'],'available':this[_0xbe62('0x15')],'loggedIn':this[_0xbe62('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xbe62('0xa')]};var _0xa48f83=md5(JSON['stringify'](_0x54a31f));if(this[_0xbe62('0x0')]!==_0xa48f83){this[_0xbe62('0x0')]=_0xa48f83;io['to'](util['format']('chat:queue:%s',_0x54a31f[_0xbe62('0x5')]))['emit'](_0xbe62('0x16'),_0x54a31f);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 237d5d1..0f5eccf 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 _0x5f5d=['updateRealtime','prototype','loggedIn','length','online','paused','available','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x23dce9,_0x3642ee){var _0x8ce8a0=function(_0x151a4a){while(--_0x151a4a){_0x23dce9['push'](_0x23dce9['shift']());}};_0x8ce8a0(++_0x3642ee);}(_0x5f5d,0x143));var _0xd5f5=function(_0x510db2,_0x127dee){_0x510db2=_0x510db2-0x0;var _0x3fc8d6=_0x5f5d[_0x510db2];return _0x3fc8d6;};'use strict';var _=require(_0xd5f5('0x0'));var md5=require(_0xd5f5('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xd5f5('0x2'));config[_0xd5f5('0x3')]=_[_0xd5f5('0x4')](config[_0xd5f5('0x3')],{'host':_0xd5f5('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd5f5('0x3')]));function FaxQueue(_0x5bf067){this['id']=_0x5bf067['id']||0x0;this['name']=_0x5bf067[_0xd5f5('0x6')]||'';this[_0xd5f5('0x7')]=_0x5bf067[_0xd5f5('0x7')]||0xa;this[_0xd5f5('0x8')]=_0x5bf067['strategy']||_0xd5f5('0x9');this[_0xd5f5('0xa')]=_0x5bf067[_0xd5f5('0xa')];this[_0xd5f5('0xb')]={};this['waiting']=0x0;this[_0xd5f5('0x1')]='';this[_0xd5f5('0xc')]();this[_0xd5f5('0xd')]();}FaxQueue[_0xd5f5('0xe')]['updateRouting']=function(){var _0x3a8f3c=this[_0xd5f5('0xb')]['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x3a8f3c;};FaxQueue[_0xd5f5('0xe')][_0xd5f5('0xd')]=function(){this[_0xd5f5('0xf')]=0x0;this['paused']=0x0;for(var _0x44bb31=0x0;_0x44bb31=0x0?this['available']:0x0;var _0x3e3b90={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd5f5('0xf')],'name':this[_0xd5f5('0x6')],'paused':this[_0xd5f5('0x12')],'waiting':this['waiting']};var _0xaad9f8=md5(JSON['stringify'](_0x3e3b90));if(this[_0xd5f5('0x1')]!==_0xaad9f8){this[_0xd5f5('0x1')]=_0xaad9f8;io['to'](util[_0xd5f5('0x14')](_0xd5f5('0x15'),_0x3e3b90[_0xd5f5('0x6')]))[_0xd5f5('0x16')](_0xd5f5('0x17'),_0x3e3b90);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xb60a=['util','../../../config/environment','redis','localhost','name','timeout','Agents','updateRouting','prototype','mapAgentsId','_rr','updateRealtime','loggedIn','length','online','faxPause','paused','available','format','emit','fax_queue:save','lodash','md5'];(function(_0x287a8c,_0x478da6){var _0x23bb6e=function(_0x481867){while(--_0x481867){_0x287a8c['push'](_0x287a8c['shift']());}};_0x23bb6e(++_0x478da6);}(_0xb60a,0x129));var _0xab60=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb60a[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xab60('0x0'));var md5=require(_0xab60('0x1'));var util=require(_0xab60('0x2'));var Redis=require('ioredis');var config=require(_0xab60('0x3'));config[_0xab60('0x4')]=_['defaults'](config[_0xab60('0x4')],{'host':_0xab60('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xab60('0x4')]));function FaxQueue(_0x551d0f){this['id']=_0x551d0f['id']||0x0;this[_0xab60('0x6')]=_0x551d0f[_0xab60('0x6')]||'';this[_0xab60('0x7')]=_0x551d0f[_0xab60('0x7')]||0xa;this['strategy']=_0x551d0f['strategy']||'beepall';this[_0xab60('0x8')]=_0x551d0f['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0xab60('0x9')]();this['updateRealtime']();}FaxQueue[_0xab60('0xa')][_0xab60('0x9')]=function(){var _0x350658=this[_0xab60('0xb')][_0xab60('0xc')];this[_0xab60('0xb')]=_['map'](this[_0xab60('0x8')],'id');this[_0xab60('0xb')][_0xab60('0xc')]=_0x350658;};FaxQueue[_0xab60('0xa')][_0xab60('0xd')]=function(){this[_0xab60('0xe')]=0x0;this['paused']=0x0;for(var _0x324b80=0x0;_0x324b80=0x0?this[_0xab60('0x13')]:0x0;var _0xc16807={'id':this['id'],'available':this[_0xab60('0x13')],'loggedIn':this[_0xab60('0xe')],'name':this[_0xab60('0x6')],'paused':this[_0xab60('0x12')],'waiting':this['waiting']};var _0xdd2b81=md5(JSON['stringify'](_0xc16807));if(this[_0xab60('0x1')]!==_0xdd2b81){this['md5']=_0xdd2b81;io['to'](util[_0xab60('0x14')]('fax:queue:%s',_0xc16807[_0xab60('0x6')]))[_0xab60('0x15')](_0xab60('0x16'),_0xc16807);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 655baff..bb6964d 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 _0xf360=['name','Intervals','exports'];(function(_0x4de22e,_0x14055f){var _0x5e6173=function(_0xeebd44){while(--_0xeebd44){_0x4de22e['push'](_0x4de22e['shift']());}};_0x5e6173(++_0x14055f);}(_0xf360,0xcc));var _0x0f36=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf360[_0x20a584];return _0x4b41a8;};'use strict';function Interval(_0x5335b8){this['id']=_0x5335b8['id']||0x0;this['name']=_0x5335b8[_0x0f36('0x0')]||'';this['Intervals']=_0x5335b8[_0x0f36('0x1')]||{};}module[_0x0f36('0x2')]=Interval; \ No newline at end of file +var _0x2769=['Intervals','exports','name'];(function(_0x56fec1,_0x41ba0a){var _0x5747c5=function(_0x5d3602){while(--_0x5d3602){_0x56fec1['push'](_0x56fec1['shift']());}};_0x5747c5(++_0x41ba0a);}(_0x2769,0x179));var _0x9276=function(_0x673604,_0x1ad10a){_0x673604=_0x673604-0x0;var _0x20d4bd=_0x2769[_0x673604];return _0x20d4bd;};'use strict';function Interval(_0x19640a){this['id']=_0x19640a['id']||0x0;this[_0x9276('0x0')]=_0x19640a[_0x9276('0x0')]||'';this[_0x9276('0x1')]=_0x19640a[_0x9276('0x1')]||{};}module[_0x9276('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 6528a96..27bc843 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 _0xb219=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','prototype','paused','length','available','loggedIn','stringify','format','mail:queue:%s','mail_queue:save','lodash','util'];(function(_0x3677d0,_0x2bb040){var _0x4f3d02=function(_0x3c0d16){while(--_0x3c0d16){_0x3677d0['push'](_0x3677d0['shift']());}};_0x4f3d02(++_0x2bb040);}(_0xb219,0x194));var _0x9b21=function(_0x11f6aa,_0x3747b5){_0x11f6aa=_0x11f6aa-0x0;var _0x941310=_0xb219[_0x11f6aa];return _0x941310;};'use strict';var _=require(_0x9b21('0x0'));var md5=require('md5');var util=require(_0x9b21('0x1'));var Redis=require(_0x9b21('0x2'));var config=require(_0x9b21('0x3'));config[_0x9b21('0x4')]=_[_0x9b21('0x5')](config[_0x9b21('0x4')],{'host':_0x9b21('0x6'),'port':0x18eb});var io=require(_0x9b21('0x7'))(new Redis(config['redis']));function MailQueue(_0x128f5b){this['id']=_0x128f5b['id']||0x0;this['name']=_0x128f5b[_0x9b21('0x8')]||'';this['timeout']=_0x128f5b[_0x9b21('0x9')]||0xa;this[_0x9b21('0xa')]=_0x128f5b[_0x9b21('0xa')]||_0x9b21('0xb');this[_0x9b21('0xc')]=_0x128f5b['Agents'];this[_0x9b21('0xd')]={};this[_0x9b21('0xe')]=0x0;this[_0x9b21('0xf')]='';this[_0x9b21('0x10')]();this[_0x9b21('0x11')]();}MailQueue['prototype'][_0x9b21('0x10')]=function(){var _0x42c0cf=this[_0x9b21('0xd')][_0x9b21('0x12')];this[_0x9b21('0xd')]=_[_0x9b21('0x13')](this[_0x9b21('0xc')],'id');this[_0x9b21('0xd')]['_rr']=_0x42c0cf;};MailQueue[_0x9b21('0x14')][_0x9b21('0x11')]=function(){this['loggedIn']=0x0;this[_0x9b21('0x15')]=0x0;for(var _0x1bf5d9=0x0;_0x1bf5d9=0x0?this[_0x9b21('0x17')]:0x0;var _0x5b61a6={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x9b21('0x8')],'paused':this['paused'],'waiting':this[_0x9b21('0xe')]};var _0x1580fa=md5(JSON[_0x9b21('0x19')](_0x5b61a6));if(this[_0x9b21('0xf')]!==_0x1580fa){this['md5']=_0x1580fa;io['to'](util[_0x9b21('0x1a')](_0x9b21('0x1b'),_0x5b61a6['name']))['emit'](_0x9b21('0x1c'),_0x5b61a6);}};module['exports']=MailQueue; \ No newline at end of file +var _0xb317=['online','available','stringify','format','mail:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','Agents','_rr','loggedIn','paused','length'];(function(_0x1a160e,_0x1bab3d){var _0xd5bde1=function(_0x3d15bc){while(--_0x3d15bc){_0x1a160e['push'](_0x1a160e['shift']());}};_0xd5bde1(++_0x1bab3d);}(_0xb317,0x181));var _0x7b31=function(_0x379249,_0x30751f){_0x379249=_0x379249-0x0;var _0x45e594=_0xb317[_0x379249];return _0x45e594;};'use strict';var _=require(_0x7b31('0x0'));var md5=require(_0x7b31('0x1'));var util=require('util');var Redis=require(_0x7b31('0x2'));var config=require(_0x7b31('0x3'));config[_0x7b31('0x4')]=_[_0x7b31('0x5')](config[_0x7b31('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x7b31('0x6'))(new Redis(config[_0x7b31('0x4')]));function MailQueue(_0x400f9a){this['id']=_0x400f9a['id']||0x0;this[_0x7b31('0x7')]=_0x400f9a[_0x7b31('0x7')]||'';this[_0x7b31('0x8')]=_0x400f9a['timeout']||0xa;this[_0x7b31('0x9')]=_0x400f9a[_0x7b31('0x9')]||'beepall';this['Agents']=_0x400f9a['Agents'];this[_0x7b31('0xa')]={};this[_0x7b31('0xb')]=0x0;this[_0x7b31('0x1')]='';this[_0x7b31('0xc')]();this[_0x7b31('0xd')]();}MailQueue[_0x7b31('0xe')][_0x7b31('0xc')]=function(){var _0x14a081=this[_0x7b31('0xa')]['_rr'];this[_0x7b31('0xa')]=_['map'](this[_0x7b31('0xf')],'id');this['mapAgentsId'][_0x7b31('0x10')]=_0x14a081;};MailQueue['prototype']['updateRealtime']=function(){this[_0x7b31('0x11')]=0x0;this[_0x7b31('0x12')]=0x0;for(var _0x57a986=0x0;_0x57a986=0x0?this['available']:0x0;var _0x11ad8a={'id':this['id'],'available':this[_0x7b31('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x7b31('0x7')],'paused':this[_0x7b31('0x12')],'waiting':this[_0x7b31('0xb')]};var _0x364d02=md5(JSON[_0x7b31('0x16')](_0x11ad8a));if(this[_0x7b31('0x1')]!==_0x364d02){this[_0x7b31('0x1')]=_0x364d02;io['to'](util[_0x7b31('0x17')](_0x7b31('0x18'),_0x11ad8a[_0x7b31('0x7')]))[_0x7b31('0x19')]('mail_queue:save',_0x11ad8a);}};module[_0x7b31('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index adc39d2..6253de4 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f0589fe..099b509 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 _0xc576=['ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','length','online','smsPause','paused','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0xc576,0x1ea));var _0x6c57=function(_0x4e7413,_0x5dffb1){_0x4e7413=_0x4e7413-0x0;var _0x11b6de=_0xc576[_0x4e7413];return _0x11b6de;};'use strict';var _=require(_0x6c57('0x0'));var md5=require(_0x6c57('0x1'));var util=require(_0x6c57('0x2'));var Redis=require(_0x6c57('0x3'));var config=require(_0x6c57('0x4'));config['redis']=_['defaults'](config[_0x6c57('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6c57('0x6'))(new Redis(config[_0x6c57('0x5')]));function SmsQueue(_0x5c1d2c){this['id']=_0x5c1d2c['id']||0x0;this[_0x6c57('0x7')]=_0x5c1d2c['name']||'';this[_0x6c57('0x8')]=_0x5c1d2c[_0x6c57('0x8')]||0xa;this['strategy']=_0x5c1d2c[_0x6c57('0x9')]||'beepall';this[_0x6c57('0xa')]=_0x5c1d2c[_0x6c57('0xa')];this['mapAgentsId']={};this[_0x6c57('0xb')]=0x0;this[_0x6c57('0x1')]='';this[_0x6c57('0xc')]();this[_0x6c57('0xd')]();}SmsQueue['prototype'][_0x6c57('0xc')]=function(){var _0x78dda8=this[_0x6c57('0xe')][_0x6c57('0xf')];this[_0x6c57('0xe')]=_[_0x6c57('0x10')](this['Agents'],'id');this[_0x6c57('0xe')][_0x6c57('0xf')]=_0x78dda8;};SmsQueue[_0x6c57('0x11')][_0x6c57('0xd')]=function(){this[_0x6c57('0x12')]=0x0;this['paused']=0x0;for(var _0x4b6b40=0x0;_0x4b6b40=0x0?this['available']:0x0;var _0x291acc={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6c57('0x12')],'name':this[_0x6c57('0x7')],'paused':this[_0x6c57('0x16')],'waiting':this['waiting']};var _0x52f01d=md5(JSON[_0x6c57('0x18')](_0x291acc));if(this['md5']!==_0x52f01d){this[_0x6c57('0x1')]=_0x52f01d;io['to'](util[_0x6c57('0x19')](_0x6c57('0x1a'),_0x291acc[_0x6c57('0x7')]))[_0x6c57('0x1b')]('sms_queue:save',_0x291acc);}};module[_0x6c57('0x1c')]=SmsQueue; \ No newline at end of file +var _0xd0bb=['available','stringify','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','smsPause'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3f23f8,_0x2aadcd){_0x3f23f8=_0x3f23f8-0x0;var _0x22edc3=_0xd0bb[_0x3f23f8];return _0x22edc3;};'use strict';var _=require(_0xbd0b('0x0'));var md5=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var Redis=require('ioredis');var config=require(_0xbd0b('0x3'));config['redis']=_[_0xbd0b('0x4')](config[_0xbd0b('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbd0b('0x6'))(new Redis(config['redis']));function SmsQueue(_0x2236ce){this['id']=_0x2236ce['id']||0x0;this[_0xbd0b('0x7')]=_0x2236ce[_0xbd0b('0x7')]||'';this[_0xbd0b('0x8')]=_0x2236ce[_0xbd0b('0x8')]||0xa;this['strategy']=_0x2236ce[_0xbd0b('0x9')]||_0xbd0b('0xa');this[_0xbd0b('0xb')]=_0x2236ce[_0xbd0b('0xb')];this[_0xbd0b('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xbd0b('0xd')]();this[_0xbd0b('0xe')]();}SmsQueue['prototype'][_0xbd0b('0xd')]=function(){var _0x196beb=this['mapAgentsId'][_0xbd0b('0xf')];this[_0xbd0b('0xc')]=_[_0xbd0b('0x10')](this[_0xbd0b('0xb')],'id');this[_0xbd0b('0xc')][_0xbd0b('0xf')]=_0x196beb;};SmsQueue[_0xbd0b('0x11')][_0xbd0b('0xe')]=function(){this[_0xbd0b('0x12')]=0x0;this[_0xbd0b('0x13')]=0x0;for(var _0x2d4664=0x0;_0x2d4664=0x0?this[_0xbd0b('0x16')]:0x0;var _0x2f58a3={'id':this['id'],'available':this[_0xbd0b('0x16')],'loggedIn':this[_0xbd0b('0x12')],'name':this['name'],'paused':this[_0xbd0b('0x13')],'waiting':this['waiting']};var _0x9c2404=md5(JSON[_0xbd0b('0x17')](_0x2f58a3));if(this[_0xbd0b('0x1')]!==_0x9c2404){this[_0xbd0b('0x1')]=_0x9c2404;io['to'](util['format'](_0xbd0b('0x18'),_0x2f58a3[_0xbd0b('0x7')]))[_0xbd0b('0x19')]('sms_queue:save',_0x2f58a3);}};module[_0xbd0b('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 312aa13..43be5cc 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 _0x8077=['paused','length','whatsappPause','available','format','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn'];(function(_0x4bdba4,_0x1a6bd4){var _0x5c4d18=function(_0x1512d0){while(--_0x1512d0){_0x4bdba4['push'](_0x4bdba4['shift']());}};_0x5c4d18(++_0x1a6bd4);}(_0x8077,0xd7));var _0x7807=function(_0x4e3438,_0x26c5f6){_0x4e3438=_0x4e3438-0x0;var _0xff9818=_0x8077[_0x4e3438];return _0xff9818;};'use strict';var _=require(_0x7807('0x0'));var md5=require(_0x7807('0x1'));var util=require(_0x7807('0x2'));var Redis=require('ioredis');var config=require(_0x7807('0x3'));config[_0x7807('0x4')]=_[_0x7807('0x5')](config[_0x7807('0x4')],{'host':_0x7807('0x6'),'port':0x18eb});var io=require(_0x7807('0x7'))(new Redis(config[_0x7807('0x4')]));function WhatsappQueue(_0x5475b7){this['id']=_0x5475b7['id']||0x0;this['name']=_0x5475b7[_0x7807('0x8')]||'';this[_0x7807('0x9')]=_0x5475b7[_0x7807('0x9')]||0xa;this[_0x7807('0xa')]=_0x5475b7[_0x7807('0xa')]||_0x7807('0xb');this[_0x7807('0xc')]=_0x5475b7[_0x7807('0xc')];this[_0x7807('0xd')]={};this[_0x7807('0xe')]=0x0;this[_0x7807('0x1')]='';this['updateRouting']();this[_0x7807('0xf')]();}WhatsappQueue[_0x7807('0x10')]['updateRouting']=function(){var _0x479340=this[_0x7807('0xd')][_0x7807('0x11')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x7807('0xd')][_0x7807('0x11')]=_0x479340;};WhatsappQueue[_0x7807('0x10')][_0x7807('0xf')]=function(){this[_0x7807('0x12')]=0x0;this[_0x7807('0x13')]=0x0;for(var _0x4a54ca=0x0;_0x4a54ca=0x0?this['available']:0x0;var _0x44bd80={'id':this['id'],'available':this[_0x7807('0x16')],'loggedIn':this[_0x7807('0x12')],'name':this[_0x7807('0x8')],'paused':this[_0x7807('0x13')],'waiting':this[_0x7807('0xe')]};var _0x49e0bf=md5(JSON['stringify'](_0x44bd80));if(this['md5']!==_0x49e0bf){this[_0x7807('0x1')]=_0x49e0bf;io['to'](util[_0x7807('0x17')]('whatsapp:queue:%s',_0x44bd80[_0x7807('0x8')]))['emit'](_0x7807('0x18'),_0x44bd80);}};module[_0x7807('0x19')]=WhatsappQueue; \ No newline at end of file +var _0xc455=['ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','paused','length','loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash'];(function(_0x2176e8,_0x1474b4){var _0x24872e=function(_0x4755af){while(--_0x4755af){_0x2176e8['push'](_0x2176e8['shift']());}};_0x24872e(++_0x1474b4);}(_0xc455,0x19f));var _0x5c45=function(_0x4dc0a8,_0x323da1){_0x4dc0a8=_0x4dc0a8-0x0;var _0x4bbf7a=_0xc455[_0x4dc0a8];return _0x4bbf7a;};'use strict';var _=require(_0x5c45('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x5c45('0x1'));var config=require('../../../config/environment');config[_0x5c45('0x2')]=_[_0x5c45('0x3')](config[_0x5c45('0x2')],{'host':_0x5c45('0x4'),'port':0x18eb});var io=require(_0x5c45('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x59033e){this['id']=_0x59033e['id']||0x0;this[_0x5c45('0x6')]=_0x59033e[_0x5c45('0x6')]||'';this['timeout']=_0x59033e['timeout']||0xa;this[_0x5c45('0x7')]=_0x59033e['strategy']||_0x5c45('0x8');this[_0x5c45('0x9')]=_0x59033e[_0x5c45('0x9')];this[_0x5c45('0xa')]={};this[_0x5c45('0xb')]=0x0;this[_0x5c45('0xc')]='';this[_0x5c45('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x5c45('0xe')][_0x5c45('0xd')]=function(){var _0x578db1=this[_0x5c45('0xa')][_0x5c45('0xf')];this[_0x5c45('0xa')]=_['map'](this[_0x5c45('0x9')],'id');this[_0x5c45('0xa')][_0x5c45('0xf')]=_0x578db1;};WhatsappQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x5c45('0x10')]=0x0;for(var _0x1e97fb=0x0;_0x1e97fb=0x0?this['available']:0x0;var _0x3fdbbe={'id':this['id'],'available':this[_0x5c45('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x5c45('0x6')],'paused':this[_0x5c45('0x10')],'waiting':this['waiting']};var _0x5411f3=md5(JSON[_0x5c45('0x15')](_0x3fdbbe));if(this[_0x5c45('0xc')]!==_0x5411f3){this[_0x5c45('0xc')]=_0x5411f3;io['to'](util[_0x5c45('0x16')](_0x5c45('0x17'),_0x3fdbbe['name']))['emit'](_0x5c45('0x18'),_0x3fdbbe);}};module[_0x5c45('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 3182ac1..6ab8163 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index d46d4bb..a8f9e91 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 _0x5708=['AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x1ddfab,_0x4fa495){var _0x515903=function(_0x2c2c88){while(--_0x2c2c88){_0x1ddfab['push'](_0x1ddfab['shift']());}};_0x515903(++_0x4fa495);}(_0x5708,0x14a));var _0x8570=function(_0x131868,_0x8e9a3c){_0x131868=_0x131868-0x0;var _0xdb3e92=_0x5708[_0x131868];return _0xdb3e92;};'use strict';var client=require(_0x8570('0x0'));exports[_0x8570('0x1')]=function(_0x3b6ee0,_0x5bb1cd){return client[_0x8570('0x2')](_0x8570('0x3'),{'body':_0x5bb1cd,'options':{'where':{'id':_0x3b6ee0}},'log':_0x8570('0x4')});};exports[_0x8570('0x5')]=function(_0x4859cf,_0xe765e6){return client[_0x8570('0x2')](_0x8570('0x6'),{'body':_0xe765e6,'options':{'where':{'id':_0x4859cf}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe14b=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x153fab,_0x3e1351){var _0x57252a=function(_0x32963a){while(--_0x32963a){_0x153fab['push'](_0x153fab['shift']());}};_0x57252a(++_0x3e1351);}(_0xe14b,0x1c6));var _0xbe14=function(_0x40d5d4,_0x52c169){_0x40d5d4=_0x40d5d4-0x0;var _0x35172c=_0xe14b[_0x40d5d4];return _0x35172c;};'use strict';var client=require(_0xbe14('0x0'));exports[_0xbe14('0x1')]=function(_0x2d9827,_0x5c6b7e){return client[_0xbe14('0x2')](_0xbe14('0x3'),{'body':_0x5c6b7e,'options':{'where':{'id':_0x2d9827}},'log':_0xbe14('0x4')});};exports[_0xbe14('0x5')]=function(_0xcd7766,_0x3c4eb4){return client[_0xbe14('0x2')](_0xbe14('0x6'),{'body':_0x3c4eb4,'options':{'where':{'id':_0xcd7766}},'log':_0xbe14('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7bcfd1f..01c4a7b 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 _0x6d3d=['create','Request','createChatMessage','../client'];(function(_0x58f802,_0x55f34b){var _0x4672b9=function(_0x280a32){while(--_0x280a32){_0x58f802['push'](_0x58f802['shift']());}};_0x4672b9(++_0x55f34b);}(_0x6d3d,0xf3));var _0xd6d3=function(_0x21c37a,_0xe3b007){_0x21c37a=_0x21c37a-0x0;var _0x550251=_0x6d3d[_0x21c37a];return _0x550251;};'use strict';var client=require(_0xd6d3('0x0'));exports[_0xd6d3('0x1')]=function(_0x24d7a3){return client[_0xd6d3('0x2')]('CreateChatMessage',{'body':_0x24d7a3,'log':_0xd6d3('0x3')});}; \ No newline at end of file +var _0x627d=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x16cb4b,_0x481b00){var _0x2e1bd8=function(_0x15287d){while(--_0x15287d){_0x16cb4b['push'](_0x16cb4b['shift']());}};_0x2e1bd8(++_0x481b00);}(_0x627d,0xba));var _0xd627=function(_0x545809,_0x1e9efc){_0x545809=_0x545809-0x0;var _0x363e7f=_0x627d[_0x545809];return _0x363e7f;};'use strict';var client=require(_0xd627('0x0'));exports['create']=function(_0x227faa){return client[_0xd627('0x1')](_0xd627('0x2'),{'body':_0x227faa,'log':_0xd627('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index f90c440..113c340 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 _0x7dee=['../client','Request','name','timeout','strategy','User','chatPause','getChatQueues'];(function(_0xadaf7b,_0x3db557){var _0x4e0855=function(_0x4f36cd){while(--_0x4f36cd){_0xadaf7b['push'](_0xadaf7b['shift']());}};_0x4e0855(++_0x3db557);}(_0x7dee,0xb0));var _0xe7de=function(_0x25c087,_0x434832){_0x25c087=_0x25c087-0x0;var _0x2ab656=_0x7dee[_0x25c087];return _0x2ab656;};'use strict';var client=require(_0xe7de('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xe7de('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xe7de('0x2'),_0xe7de('0x3'),_0xe7de('0x4')],'include':[{'model':_0xe7de('0x5'),'as':'Agents','attributes':['id',_0xe7de('0x2'),'online',_0xe7de('0x6')]}]},'log':_0xe7de('0x7')});};}; \ No newline at end of file +var _0x7118=['name','online','chatPause','Request','GetChatQueue','timeout','strategy','User','Agents'];(function(_0x377a73,_0x70ba24){var _0xe5bc75=function(_0x3dc027){while(--_0x3dc027){_0x377a73['push'](_0x377a73['shift']());}};_0xe5bc75(++_0x70ba24);}(_0x7118,0x159));var _0x8711=function(_0x4d0821,_0x2d41aa){_0x4d0821=_0x4d0821-0x0;var _0x443a8d=_0x7118[_0x4d0821];return _0x443a8d;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x8711('0x0')](_0x8711('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x8711('0x2'),_0x8711('0x3')],'include':[{'model':_0x8711('0x4'),'as':_0x8711('0x5'),'attributes':['id',_0x8711('0x6'),_0x8711('0x7'),_0x8711('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index cc3bf0c..e7182ec 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 _0x279d=['Request','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x279d,0x1d8));var _0xd279=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x279d[_0x87b0ff];return _0x3bc0b2;};'use strict';var client=require(_0xd279('0x0'));exports[_0xd279('0x1')]=function(_0x17cebd){return client[_0xd279('0x2')]('CreateChatQueueReport',{'body':_0x17cebd,'log':'CreateChatQueueReport'});};exports[_0xd279('0x3')]=function(_0x44441d,_0x47cfee){return client[_0xd279('0x2')](_0xd279('0x4'),{'body':_0x47cfee,'options':{'where':{'uniqueid':_0x44441d},'order':[['id',_0xd279('0x5')]],'limit':0x1},'log':_0xd279('0x4')});}; \ No newline at end of file +var _0x24cd=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','../client'];(function(_0x3c8832,_0x16e93e){var _0xacf303=function(_0x1c7f46){while(--_0x1c7f46){_0x3c8832['push'](_0x3c8832['shift']());}};_0xacf303(++_0x16e93e);}(_0x24cd,0x83));var _0xd24c=function(_0x2c4e1d,_0xa5adea){_0x2c4e1d=_0x2c4e1d-0x0;var _0x296b91=_0x24cd[_0x2c4e1d];return _0x296b91;};'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 diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 79ef32b..5389742 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(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x7a54,0x106));var _0x47a5=function(_0xab146d,_0x584140){_0xab146d=_0xab146d-0x0;var _0x4db544=_0x7a54[_0xab146d];return _0x4db544;};'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(_0x2bb6d3,_0x360333){var _0x284413=function(_0x5ab2da){while(--_0x5ab2da){_0x2bb6d3['push'](_0x2bb6d3['shift']());}};_0x284413(++_0x360333);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index aa31774..0cf82ad 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 _0x06ec=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x2d2904,_0x283066){var _0x16005a=function(_0x206527){while(--_0x206527){_0x2d2904['push'](_0x2d2904['shift']());}};_0x16005a(++_0x283066);}(_0x06ec,0xd9));var _0xc06e=function(_0x26d10c,_0x313c84){_0x26d10c=_0x26d10c-0x0;var _0x1508de=_0x06ec[_0x26d10c];return _0x1508de;};'use strict';var client=require(_0xc06e('0x0'));exports[_0xc06e('0x1')]=function(_0x53f10b){return client['Request'](_0xc06e('0x2'),{'body':_0x53f10b,'log':_0xc06e('0x3')});}; \ No newline at end of file +var _0xd13e=['create','Request','CreateFaxMessage','../client'];(function(_0x100499,_0x4911c7){var _0x34e0cb=function(_0x74f152){while(--_0x74f152){_0x100499['push'](_0x100499['shift']());}};_0x34e0cb(++_0x4911c7);}(_0xd13e,0x15f));var _0xed13=function(_0x18abb8,_0x203dad){_0x18abb8=_0x18abb8-0x0;var _0x5d812d=_0xd13e[_0x18abb8];return _0x5d812d;};'use strict';var client=require(_0xed13('0x0'));exports[_0xed13('0x1')]=function(_0x361dcf){return client[_0xed13('0x2')](_0xed13('0x3'),{'body':_0x361dcf,'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 b5a2a32..4dd3c4c 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 _0x884a=['online','faxPause','getFaxQueues','../client','Request','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x80544e,_0x37a3f3){var _0x4f9b90=function(_0x4f95d6){while(--_0x4f95d6){_0x80544e['push'](_0x80544e['shift']());}};_0x4f9b90(++_0x37a3f3);}(_0x884a,0x1f2));var _0xa884=function(_0x1721c8,_0x3a095a){_0x1721c8=_0x1721c8-0x0;var _0x126a04=_0x884a[_0x1721c8];return _0x126a04;};'use strict';var client=require(_0xa884('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xa884('0x1')](_0xa884('0x2'),{'options':{'raw':![],'attributes':['id',_0xa884('0x3'),_0xa884('0x4'),_0xa884('0x5')],'include':[{'model':_0xa884('0x6'),'as':_0xa884('0x7'),'attributes':['id','name',_0xa884('0x8'),_0xa884('0x9')]}]},'log':_0xa884('0xa')});};}; \ No newline at end of file +var _0x2437=['Agents','name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User'];(function(_0x223689,_0xccf31d){var _0x12b12b=function(_0x4936f1){while(--_0x4936f1){_0x223689['push'](_0x223689['shift']());}};_0x12b12b(++_0xccf31d);}(_0x2437,0x9e));var _0x7243=function(_0x1d2d64,_0x1eccf5){_0x1d2d64=_0x1d2d64-0x0;var _0x34ec1b=_0x2437[_0x1d2d64];return _0x34ec1b;};'use strict';var client=require(_0x7243('0x0'));exports[_0x7243('0x1')]=function(){return function(){return client[_0x7243('0x2')](_0x7243('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7243('0x4'),_0x7243('0x5')],'include':[{'model':_0x7243('0x6'),'as':_0x7243('0x7'),'attributes':['id',_0x7243('0x8'),_0x7243('0x9'),_0x7243('0xa')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index a47bf8c..d87a7ab 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 _0x285f=['UpdateFaxQueueReport','../client','create','CreateFaxQueueReport','update','Request'];(function(_0x4b2ba0,_0x58aa36){var _0x20b8b9=function(_0xaa83be){while(--_0xaa83be){_0x4b2ba0['push'](_0x4b2ba0['shift']());}};_0x20b8b9(++_0x58aa36);}(_0x285f,0x18d));var _0xf285=function(_0x49047d,_0x57f40){_0x49047d=_0x49047d-0x0;var _0x4d92b4=_0x285f[_0x49047d];return _0x4d92b4;};'use strict';var client=require(_0xf285('0x0'));exports[_0xf285('0x1')]=function(_0x16f155){return client['Request'](_0xf285('0x2'),{'body':_0x16f155,'log':_0xf285('0x2')});};exports[_0xf285('0x3')]=function(_0x378278,_0x449af9){return client[_0xf285('0x4')]('UpdateFaxQueueReport',{'body':_0x449af9,'options':{'where':{'uniqueid':_0x378278},'order':[['id','DESC']],'limit':0x1},'log':_0xf285('0x5')});}; \ No newline at end of file +var _0xbdf9=['update','Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0x38255a,_0x42990e){var _0x524d76=function(_0x249a38){while(--_0x249a38){_0x38255a['push'](_0x38255a['shift']());}};_0x524d76(++_0x42990e);}(_0xbdf9,0x1e0));var _0x9bdf=function(_0xa72cf,_0x24a05c){_0xa72cf=_0xa72cf-0x0;var _0x263735=_0xbdf9[_0xa72cf];return _0x263735;};'use strict';var client=require(_0x9bdf('0x0'));exports[_0x9bdf('0x1')]=function(_0x44fc41){return client['Request']('CreateFaxQueueReport',{'body':_0x44fc41,'log':_0x9bdf('0x2')});};exports[_0x9bdf('0x3')]=function(_0x357b86,_0x456fa6){return client[_0x9bdf('0x4')](_0x9bdf('0x5'),{'body':_0x456fa6,'options':{'where':{'uniqueid':_0x357b86},'order':[['id',_0x9bdf('0x6')]],'limit':0x1},'log':_0x9bdf('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 57197cc..89ca9c9 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 _0xe44e=['name','Interval','Intervals','getIntervals','../client','Request','GetInterval'];(function(_0x283574,_0x2b3c04){var _0xc7587c=function(_0x43239d){while(--_0x43239d){_0x283574['push'](_0x283574['shift']());}};_0xc7587c(++_0x2b3c04);}(_0xe44e,0x146));var _0xee44=function(_0x315b16,_0x4e5d8f){_0x315b16=_0x315b16-0x0;var _0x730958=_0xe44e[_0x315b16];return _0x730958;};'use strict';var client=require(_0xee44('0x0'));exports['getIntervals']=function(){return function(){return client[_0xee44('0x1')](_0xee44('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xee44('0x3')],'include':[{'model':_0xee44('0x4'),'as':_0xee44('0x5'),'attributes':['id',_0xee44('0x3'),'interval']}]},'log':_0xee44('0x6')});};}; \ No newline at end of file +var _0x9af9=['../client','getIntervals','GetInterval','name','Interval','Intervals','interval'];(function(_0xa575d7,_0x7193f9){var _0x183719=function(_0x4ff307){while(--_0x4ff307){_0xa575d7['push'](_0xa575d7['shift']());}};_0x183719(++_0x7193f9);}(_0x9af9,0x157));var _0x99af=function(_0x399b8b,_0x42325a){_0x399b8b=_0x399b8b-0x0;var _0x5cb4f9=_0x9af9[_0x399b8b];return _0x5cb4f9;};'use strict';var client=require(_0x99af('0x0'));exports[_0x99af('0x1')]=function(){return function(){return client['Request'](_0x99af('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x99af('0x3')],'include':[{'model':_0x99af('0x4'),'as':_0x99af('0x5'),'attributes':['id',_0x99af('0x3'),_0x99af('0x6')]}]},'log':_0x99af('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c9cf7b3..e4b98f8 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 _0x7880=['AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x7880,0x1f4));var _0x0788=function(_0x54b749,_0x45913f){_0x54b749=_0x54b749-0x0;var _0x5a1b77=_0x7880[_0x54b749];return _0x5a1b77;};'use strict';var client=require('../client');exports[_0x0788('0x0')]=function(_0x219c25,_0x841a33){return client[_0x0788('0x1')](_0x0788('0x2'),{'body':_0x841a33,'options':{'where':{'id':_0x219c25}},'log':_0x0788('0x3')});};exports['addTags']=function(_0x3925a6,_0x1e0814){return client[_0x0788('0x1')](_0x0788('0x4'),{'body':_0x1e0814,'options':{'where':{'id':_0x3925a6}},'log':_0x0788('0x5')});}; \ No newline at end of file +var _0x3a6d=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0xfdf7a4,_0x37da46){var _0x59ec89=function(_0x5a4094){while(--_0x5a4094){_0xfdf7a4['push'](_0xfdf7a4['shift']());}};_0x59ec89(++_0x37da46);}(_0x3a6d,0x143));var _0xd3a6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3a6d[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0xd3a6('0x0'));exports[_0xd3a6('0x1')]=function(_0x5cb93b,_0x389f73){return client[_0xd3a6('0x2')](_0xd3a6('0x3'),{'body':_0x389f73,'options':{'where':{'id':_0x5cb93b}},'log':_0xd3a6('0x4')});};exports[_0xd3a6('0x5')]=function(_0x585473,_0x1cb966){return client[_0xd3a6('0x2')](_0xd3a6('0x6'),{'body':_0x1cb966,'options':{'where':{'id':_0x585473}},'log':_0xd3a6('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b9d5a1c..a2315b2 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 _0x3ca7=['CreateMailMessage','createMailMessage','../client'];(function(_0x31f09e,_0x1b55e7){var _0x14e274=function(_0x594ed3){while(--_0x594ed3){_0x31f09e['push'](_0x31f09e['shift']());}};_0x14e274(++_0x1b55e7);}(_0x3ca7,0xe3));var _0x73ca=function(_0x1945a5,_0x50de54){_0x1945a5=_0x1945a5-0x0;var _0x5817a5=_0x3ca7[_0x1945a5];return _0x5817a5;};'use strict';var client=require(_0x73ca('0x0'));exports['create']=function(_0x53d92f){return client['Request'](_0x73ca('0x1'),{'body':_0x53d92f,'log':_0x73ca('0x2')});}; \ No newline at end of file +var _0x618e=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x350cf7,_0x531854){var _0x20e682=function(_0x24ac7c){while(--_0x24ac7c){_0x350cf7['push'](_0x350cf7['shift']());}};_0x20e682(++_0x531854);}(_0x618e,0x155));var _0xe618=function(_0x1dd907,_0x49e59f){_0x1dd907=_0x1dd907-0x0;var _0x33c1ef=_0x618e[_0x1dd907];return _0x33c1ef;};'use strict';var client=require(_0xe618('0x0'));exports['create']=function(_0x5a6394){return client[_0xe618('0x1')](_0xe618('0x2'),{'body':_0x5a6394,'log':_0xe618('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 26f1941..97dc203 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 _0x2f04=['strategy','Agents','name','online','../client','getMailQueues','Request','GetMailQueue'];(function(_0x44f378,_0x3d638e){var _0x54de47=function(_0x3b907b){while(--_0x3b907b){_0x44f378['push'](_0x44f378['shift']());}};_0x54de47(++_0x3d638e);}(_0x2f04,0x134));var _0x42f0=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x2f04[_0x36ed48];return _0x51c63a;};'use strict';var client=require(_0x42f0('0x0'));exports[_0x42f0('0x1')]=function(){return function(){return client[_0x42f0('0x2')](_0x42f0('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x42f0('0x4')],'include':[{'model':'User','as':_0x42f0('0x5'),'attributes':['id',_0x42f0('0x6'),_0x42f0('0x7'),'mailPause']}]},'log':_0x42f0('0x1')});};}; \ No newline at end of file +var _0x98f1=['strategy','User','Agents','online','mailPause','getMailQueues','Request','name'];(function(_0x4968c8,_0xe46a8a){var _0x15fe39=function(_0x5c7caf){while(--_0x5c7caf){_0x4968c8['push'](_0x4968c8['shift']());}};_0x15fe39(++_0xe46a8a);}(_0x98f1,0x1dd));var _0x198f=function(_0x501732,_0x53aaa0){_0x501732=_0x501732-0x0;var _0x588ae8=_0x98f1[_0x501732];return _0x588ae8;};'use strict';var client=require('../client');exports[_0x198f('0x0')]=function(){return function(){return client[_0x198f('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x198f('0x2'),'timeout',_0x198f('0x3')],'include':[{'model':_0x198f('0x4'),'as':_0x198f('0x5'),'attributes':['id',_0x198f('0x2'),_0x198f('0x6'),_0x198f('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index cb70681..01e087e 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 _0xad64=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xad64,0x69));var _0x4ad6=function(_0xa3d8fe,_0x3502bd){_0xa3d8fe=_0xa3d8fe-0x0;var _0x32a172=_0xad64[_0xa3d8fe];return _0x32a172;};'use strict';var client=require(_0x4ad6('0x0'));exports[_0x4ad6('0x1')]=function(_0x6274f7){return client[_0x4ad6('0x2')](_0x4ad6('0x3'),{'body':_0x6274f7,'log':_0x4ad6('0x3')});};exports[_0x4ad6('0x4')]=function(_0x25d154,_0x4cef57){return client[_0x4ad6('0x2')](_0x4ad6('0x5'),{'body':_0x4cef57,'options':{'where':{'uniqueid':_0x25d154},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x67ca=['create','CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','../client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x67ca,0x109));var _0xa67c=function(_0x2c77be,_0x55058a){_0x2c77be=_0x2c77be-0x0;var _0x506efc=_0x67ca[_0x2c77be];return _0x506efc;};'use strict';var client=require(_0xa67c('0x0'));exports[_0xa67c('0x1')]=function(_0x3f3010){return client['Request'](_0xa67c('0x2'),{'body':_0x3f3010,'log':_0xa67c('0x2')});};exports[_0xa67c('0x3')]=function(_0x174a05,_0x47fc8f){return client[_0xa67c('0x4')](_0xa67c('0x5'),{'body':_0x47fc8f,'options':{'where':{'uniqueid':_0x174a05},'order':[['id',_0xa67c('0x6')]],'limit':0x1},'log':_0xa67c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c878331..b218c19 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 _0x72b7=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x4124d2,_0x4bcf31){var _0x414b47=function(_0x44ec93){while(--_0x44ec93){_0x4124d2['push'](_0x4124d2['shift']());}};_0x414b47(++_0x4bcf31);}(_0x72b7,0x10b));var _0x772b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x72b7[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x772b('0x0'));exports[_0x772b('0x1')]=function(_0x598a1a,_0x102e90){return client[_0x772b('0x2')](_0x772b('0x3'),{'body':_0x102e90,'options':{'where':{'id':_0x598a1a}},'log':_0x772b('0x4')});};exports['addTags']=function(_0x5f3e36,_0x2f9c0d){return client[_0x772b('0x2')](_0x772b('0x5'),{'body':_0x2f9c0d,'options':{'where':{'id':_0x5f3e36}},'log':_0x772b('0x6')});}; \ No newline at end of file +var _0x9209=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update'];(function(_0x4abd4b,_0x49dd4e){var _0x15c374=function(_0x307a6b){while(--_0x307a6b){_0x4abd4b['push'](_0x4abd4b['shift']());}};_0x15c374(++_0x49dd4e);}(_0x9209,0xcb));var _0x9920=function(_0x2d8cf4,_0x58fe32){_0x2d8cf4=_0x2d8cf4-0x0;var _0x43f62a=_0x9209[_0x2d8cf4];return _0x43f62a;};'use strict';var client=require('../client');exports[_0x9920('0x0')]=function(_0x491965,_0x32b733){return client[_0x9920('0x1')](_0x9920('0x2'),{'body':_0x32b733,'options':{'where':{'id':_0x491965}},'log':_0x9920('0x3')});};exports[_0x9920('0x4')]=function(_0x235845,_0x52c0b1){return client['Request'](_0x9920('0x5'),{'body':_0x52c0b1,'options':{'where':{'id':_0x235845}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index c49b60b..a2b1f99 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 _0xb1b5=['../client','create','Request','CreateOpenchannelMessage'];(function(_0x25e362,_0x4a2bfb){var _0x2268bf=function(_0xc93d09){while(--_0xc93d09){_0x25e362['push'](_0x25e362['shift']());}};_0x2268bf(++_0x4a2bfb);}(_0xb1b5,0x1a8));var _0x5b1b=function(_0x5dc26a,_0x4e0a44){_0x5dc26a=_0x5dc26a-0x0;var _0xa7796b=_0xb1b5[_0x5dc26a];return _0xa7796b;};'use strict';var client=require(_0x5b1b('0x0'));exports[_0x5b1b('0x1')]=function(_0x1367bf){return client[_0x5b1b('0x2')](_0x5b1b('0x3'),{'body':_0x1367bf,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xe2af=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x2c1d89,_0xe1bf60){var _0x439602=function(_0x1ff413){while(--_0x1ff413){_0x2c1d89['push'](_0x2c1d89['shift']());}};_0x439602(++_0xe1bf60);}(_0xe2af,0xd4));var _0xfe2a=function(_0x1a9f59,_0x2dad22){_0x1a9f59=_0x1a9f59-0x0;var _0x4e02a6=_0xe2af[_0x1a9f59];return _0x4e02a6;};'use strict';var client=require(_0xfe2a('0x0'));exports[_0xfe2a('0x1')]=function(_0x5df5d7){return client[_0xfe2a('0x2')](_0xfe2a('0x3'),{'body':_0x5df5d7,'log':_0xfe2a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 3fe1a5a..42fcd67 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 _0xa235=['User','Agents','name','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','timeout','strategy'];(function(_0x2c9891,_0x16c9bf){var _0x1e51f1=function(_0x42743e){while(--_0x42743e){_0x2c9891['push'](_0x2c9891['shift']());}};_0x1e51f1(++_0x16c9bf);}(_0xa235,0xab));var _0x5a23=function(_0x9731fe,_0x3116cf){_0x9731fe=_0x9731fe-0x0;var _0x45adea=_0xa235[_0x9731fe];return _0x45adea;};'use strict';var client=require(_0x5a23('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x5a23('0x1')](_0x5a23('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x5a23('0x3'),_0x5a23('0x4')],'include':[{'model':_0x5a23('0x5'),'as':_0x5a23('0x6'),'attributes':['id',_0x5a23('0x7'),_0x5a23('0x8'),_0x5a23('0x9')]}]},'log':_0x5a23('0xa')});};}; \ No newline at end of file +var _0x4d50=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x27b480,_0x1e5107){var _0x536bab=function(_0x1926ef){while(--_0x1926ef){_0x27b480['push'](_0x27b480['shift']());}};_0x536bab(++_0x1e5107);}(_0x4d50,0x1b8));var _0x04d5=function(_0x39b373,_0x17eb35){_0x39b373=_0x39b373-0x0;var _0x4437e9=_0x4d50[_0x39b373];return _0x4437e9;};'use strict';var client=require(_0x04d5('0x0'));exports[_0x04d5('0x1')]=function(){return function(){return client[_0x04d5('0x2')](_0x04d5('0x3'),{'options':{'raw':![],'attributes':['id',_0x04d5('0x4'),_0x04d5('0x5'),_0x04d5('0x6')],'include':[{'model':_0x04d5('0x7'),'as':'Agents','attributes':['id',_0x04d5('0x4'),'online','openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 4027eb2..ed00191 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 _0xd315=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x323e7d,_0x5a3014){var _0x34a260=function(_0x33a13f){while(--_0x33a13f){_0x323e7d['push'](_0x323e7d['shift']());}};_0x34a260(++_0x5a3014);}(_0xd315,0x123));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5d31('0x0'));exports[_0x5d31('0x1')]=function(_0x2f2945){return client[_0x5d31('0x2')](_0x5d31('0x3'),{'body':_0x2f2945,'log':_0x5d31('0x3')});};exports[_0x5d31('0x4')]=function(_0x286fa9,_0x39b066){return client[_0x5d31('0x2')](_0x5d31('0x5'),{'body':_0x39b066,'options':{'where':{'uniqueid':_0x286fa9},'order':[['id',_0x5d31('0x6')]],'limit':0x1},'log':_0x5d31('0x5')});}; \ No newline at end of file +var _0xbfba=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','../client','create'];(function(_0x2c8de4,_0x48ecd7){var _0xa5f1d5=function(_0x521b2a){while(--_0x521b2a){_0x2c8de4['push'](_0x2c8de4['shift']());}};_0xa5f1d5(++_0x48ecd7);}(_0xbfba,0x1ac));var _0xabfb=function(_0x564591,_0x2f5b4c){_0x564591=_0x564591-0x0;var _0x46c713=_0xbfba[_0x564591];return _0x46c713;};'use strict';var client=require(_0xabfb('0x0'));exports[_0xabfb('0x1')]=function(_0x2fab6a){return client[_0xabfb('0x2')](_0xabfb('0x3'),{'body':_0x2fab6a,'log':_0xabfb('0x3')});};exports['update']=function(_0x2c2c49,_0x5340cc){return client[_0xabfb('0x2')](_0xabfb('0x4'),{'body':_0x5340cc,'options':{'where':{'uniqueid':_0x2c2c49},'order':[['id','DESC']],'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 ec82d9a..f01ab7d 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 _0x8135=['addTags','update','Request','updateSmsInteraction'];(function(_0x186a4f,_0x2138a1){var _0x57221f=function(_0x35c7e1){while(--_0x35c7e1){_0x186a4f['push'](_0x186a4f['shift']());}};_0x57221f(++_0x2138a1);}(_0x8135,0x99));var _0x5813=function(_0x4bea2c,_0x413367){_0x4bea2c=_0x4bea2c-0x0;var _0x499afc=_0x8135[_0x4bea2c];return _0x499afc;};'use strict';var client=require('../client');exports[_0x5813('0x0')]=function(_0x19e006,_0x301843){return client[_0x5813('0x1')]('UpdateSmsInteraction',{'body':_0x301843,'options':{'where':{'id':_0x19e006}},'log':_0x5813('0x2')});};exports[_0x5813('0x3')]=function(_0xf23c29,_0x701689){return client[_0x5813('0x1')]('AddTagsToSmsInteraction',{'body':_0x701689,'options':{'where':{'id':_0xf23c29}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x2a3a=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x402823,_0x3ac668){var _0x1e5274=function(_0x39048e){while(--_0x39048e){_0x402823['push'](_0x402823['shift']());}};_0x1e5274(++_0x3ac668);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x30cbc0,_0x4a9f74){_0x30cbc0=_0x30cbc0-0x0;var _0x2ecfb5=_0x2a3a[_0x30cbc0];return _0x2ecfb5;};'use strict';var client=require(_0xa2a3('0x0'));exports[_0xa2a3('0x1')]=function(_0x24c012,_0x1733b1){return client[_0xa2a3('0x2')]('UpdateSmsInteraction',{'body':_0x1733b1,'options':{'where':{'id':_0x24c012}},'log':'updateSmsInteraction'});};exports[_0xa2a3('0x3')]=function(_0x34d7f9,_0x1e61b2){return client[_0xa2a3('0x2')](_0xa2a3('0x4'),{'body':_0x1e61b2,'options':{'where':{'id':_0x34d7f9}},'log':_0xa2a3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8c75d52..d69a591 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 _0x106f=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x106f,0x15c));var _0xf106=function(_0x2ec3c3,_0x3f92cc){_0x2ec3c3=_0x2ec3c3-0x0;var _0x429894=_0x106f[_0x2ec3c3];return _0x429894;};'use strict';var client=require('../client');exports[_0xf106('0x0')]=function(_0x58f0a2){return client[_0xf106('0x1')](_0xf106('0x2'),{'body':_0x58f0a2,'log':_0xf106('0x3')});}; \ No newline at end of file +var _0x92e8=['../client','create'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0x92e8,0x142));var _0x892e=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x92e8[_0x508685];return _0x976a76;};'use strict';var client=require(_0x892e('0x0'));exports[_0x892e('0x1')]=function(_0x11f0c5){return client['Request']('CreateSmsMessage',{'body':_0x11f0c5,'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 fd68eb0..155dc6a 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x3380a2,_0x444dcd){var _0x222c22=function(_0x563456){while(--_0x563456){_0x3380a2['push'](_0x3380a2['shift']());}};_0x222c22(++_0x444dcd);}(_0x70e0,0x17b));var _0x070e=function(_0x3db037,_0x834580){_0x3db037=_0x3db037-0x0;var _0x599a54=_0x70e0[_0x3db037];return _0x599a54;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x33476d,_0x19053a){var _0x5ce733=function(_0x1eecb9){while(--_0x1eecb9){_0x33476d['push'](_0x33476d['shift']());}};_0x5ce733(++_0x19053a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index ffeb344..1d927ec 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x10d618,_0x1f1c82){var _0x57d044=function(_0x52c55b){while(--_0x52c55b){_0x10d618['push'](_0x10d618['shift']());}};_0x57d044(++_0x1f1c82);}(_0x008c,0x188));var _0xc008=function(_0x18cf74,_0x1b6eb6){_0x18cf74=_0x18cf74-0x0;var _0x2f6f1f=_0x008c[_0x18cf74];return _0x2f6f1f;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x3a2723,_0x4f7e0b){var _0xd4348f=function(_0xd10a7){while(--_0xd10a7){_0x3a2723['push'](_0x3a2723['shift']());}};_0xd4348f(++_0x4f7e0b);}(_0x3e74,0x175));var _0x43e7=function(_0x5a4e78,_0x6aba92){_0x5a4e78=_0x5a4e78-0x0;var _0x40d342=_0x3e74[_0x5a4e78];return _0x40d342;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 0ee4b8c..feeb69e 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(_0x34eefd,_0x2e9493){var _0x249020=function(_0x28d03b){while(--_0x28d03b){_0x34eefd['push'](_0x34eefd['shift']());}};_0x249020(++_0x2e9493);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x5f5350,_0x183f42){var _0x5f1ec6=function(_0x2662e6){while(--_0x2662e6){_0x5f5350['push'](_0x5f5350['shift']());}};_0x5f1ec6(++_0x183f42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 9904d1e..d17f7f2 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 _0xaf5a=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xaf5a,0x116));var _0xaaf5=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0xaf5a[_0x208d75];return _0x382d27;};'use strict';var client=require('../client');exports[_0xaaf5('0x0')]=function(_0x113a46,_0x26eb79){return client[_0xaaf5('0x1')](_0xaaf5('0x2'),{'body':_0x26eb79,'options':{'where':{'id':_0x113a46}},'log':_0xaaf5('0x3')});};exports[_0xaaf5('0x4')]=function(_0x1bdf16,_0x4ae9ed){return client[_0xaaf5('0x1')](_0xaaf5('0x5'),{'body':_0x4ae9ed,'options':{'where':{'id':_0x1bdf16}},'log':_0xaaf5('0x6')});}; \ No newline at end of file +var _0x1db9=['addTags','AddTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x87d80d,_0x1c2db7){var _0x39c929=function(_0x1f9301){while(--_0x1f9301){_0x87d80d['push'](_0x87d80d['shift']());}};_0x39c929(++_0x1c2db7);}(_0x1db9,0x176));var _0x91db=function(_0x43a046,_0x4e8870){_0x43a046=_0x43a046-0x0;var _0x1f8478=_0x1db9[_0x43a046];return _0x1f8478;};'use strict';var client=require(_0x91db('0x0'));exports[_0x91db('0x1')]=function(_0x8039b2,_0x340fb6){return client[_0x91db('0x2')](_0x91db('0x3'),{'body':_0x340fb6,'options':{'where':{'id':_0x8039b2}},'log':'updateWhatsappInteraction'});};exports[_0x91db('0x4')]=function(_0x42ae75,_0x59c944){return client['Request'](_0x91db('0x5'),{'body':_0x59c944,'options':{'where':{'id':_0x42ae75}},'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 67c4f6f..9b67bff 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 _0x0bc4=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x41914e,_0x57fd0c){var _0x598967=function(_0x2e2af2){while(--_0x2e2af2){_0x41914e['push'](_0x41914e['shift']());}};_0x598967(++_0x57fd0c);}(_0x0bc4,0x1a3));var _0x40bc=function(_0x1d0f99,_0x25bc9){_0x1d0f99=_0x1d0f99-0x0;var _0x4c8564=_0x0bc4[_0x1d0f99];return _0x4c8564;};'use strict';var client=require(_0x40bc('0x0'));exports[_0x40bc('0x1')]=function(_0x8fc6b3){return client[_0x40bc('0x2')](_0x40bc('0x3'),{'body':_0x8fc6b3,'log':_0x40bc('0x4')});}; \ No newline at end of file +var _0xbef8=['create','Request','CreateWhatsappMessage','../client'];(function(_0x2115e3,_0x460a65){var _0x234dd5=function(_0x32f144){while(--_0x32f144){_0x2115e3['push'](_0x2115e3['shift']());}};_0x234dd5(++_0x460a65);}(_0xbef8,0x1bb));var _0x8bef=function(_0x2c520,_0x1bad7e){_0x2c520=_0x2c520-0x0;var _0x1e0007=_0xbef8[_0x2c520];return _0x1e0007;};'use strict';var client=require(_0x8bef('0x0'));exports[_0x8bef('0x1')]=function(_0xa6f507){return client[_0x8bef('0x2')](_0x8bef('0x3'),{'body':_0xa6f507,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ddef281..eb4510c 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 _0xd3c4=['User','Agents','getWhatsappQueues','../client','GetWhatsappQueue','name','strategy'];(function(_0x4ab6ff,_0x5cc674){var _0x28c4cb=function(_0x3e89ca){while(--_0x3e89ca){_0x4ab6ff['push'](_0x4ab6ff['shift']());}};_0x28c4cb(++_0x5cc674);}(_0xd3c4,0xf1));var _0x4d3c=function(_0x133223,_0x169da8){_0x133223=_0x133223-0x0;var _0x496584=_0xd3c4[_0x133223];return _0x496584;};'use strict';var client=require(_0x4d3c('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x4d3c('0x1'),{'options':{'raw':![],'attributes':['id',_0x4d3c('0x2'),'timeout',_0x4d3c('0x3')],'include':[{'model':_0x4d3c('0x4'),'as':_0x4d3c('0x5'),'attributes':['id','name','online','whatsappPause']}]},'log':_0x4d3c('0x6')});};}; \ No newline at end of file +var _0xfcab=['online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','strategy','User','Agents'];(function(_0x30f664,_0x11dc7b){var _0x2d9337=function(_0x5695ef){while(--_0x5695ef){_0x30f664['push'](_0x30f664['shift']());}};_0x2d9337(++_0x11dc7b);}(_0xfcab,0x162));var _0xbfca=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0xfcab[_0x454e6d];return _0x4bc294;};'use strict';var client=require('../client');exports[_0xbfca('0x0')]=function(){return function(){return client['Request'](_0xbfca('0x1'),{'options':{'raw':![],'attributes':['id',_0xbfca('0x2'),'timeout',_0xbfca('0x3')],'include':[{'model':_0xbfca('0x4'),'as':_0xbfca('0x5'),'attributes':['id',_0xbfca('0x2'),_0xbfca('0x6'),_0xbfca('0x7')]}]},'log':_0xbfca('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index abcf2d5..9442712 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 _0x4029=['UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x25ebf0,_0x5a74ee){var _0x5c145=function(_0x5b0f9c){while(--_0x5b0f9c){_0x25ebf0['push'](_0x25ebf0['shift']());}};_0x5c145(++_0x5a74ee);}(_0x4029,0x17e));var _0x9402=function(_0x3412c2,_0x337d5e){_0x3412c2=_0x3412c2-0x0;var _0x492951=_0x4029[_0x3412c2];return _0x492951;};'use strict';var client=require(_0x9402('0x0'));exports['create']=function(_0x4a925f){return client[_0x9402('0x1')](_0x9402('0x2'),{'body':_0x4a925f,'log':_0x9402('0x2')});};exports['update']=function(_0x23a44a,_0x1f956f){return client[_0x9402('0x1')](_0x9402('0x3'),{'body':_0x1f956f,'options':{'where':{'uniqueid':_0x23a44a},'order':[['id',_0x9402('0x4')]],'limit':0x1},'log':_0x9402('0x3')});}; \ No newline at end of file +var _0xa51b=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x3eec42,_0x192ed2){var _0x110bf0=function(_0x4ef488){while(--_0x4ef488){_0x3eec42['push'](_0x3eec42['shift']());}};_0x110bf0(++_0x192ed2);}(_0xa51b,0x132));var _0xba51=function(_0x523172,_0xcbd638){_0x523172=_0x523172-0x0;var _0x2e0575=_0xa51b[_0x523172];return _0x2e0575;};'use strict';var client=require(_0xba51('0x0'));exports[_0xba51('0x1')]=function(_0x4fde9a){return client[_0xba51('0x2')](_0xba51('0x3'),{'body':_0x4fde9a,'log':_0xba51('0x3')});};exports['update']=function(_0x2e09c4,_0x5ed7e4){return client['Request'](_0xba51('0x4'),{'body':_0x5ed7e4,'options':{'where':{'uniqueid':_0x2e09c4},'order':[['id','DESC']],'limit':0x1},'log':_0xba51('0x4')});}; \ 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 6a7e8e7..99b5d7c 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 _0xb22f=['complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','stop','find','agents','timeout','createQueue','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x5739b3,_0x1c9157){var _0xc87127=function(_0x4c79d9){while(--_0x4c79d9){_0x5739b3['push'](_0x5739b3['shift']());}};_0xc87127(++_0x1c9157);}(_0xb22f,0x142));var _0xfb22=function(_0x2cf68e,_0x32ed11){_0x2cf68e=_0x2cf68e-0x0;var _0x27ae6a=_0xb22f[_0x2cf68e];return _0x27ae6a;};'use strict';var schema=require(_0xfb22('0x0'));var _=require('lodash');var util=require(_0xfb22('0x1'));var seqqueue=require(_0xfb22('0x2'));var logger=require(_0xfb22('0x3'))('routing');var strategy=require(_0xfb22('0x4'));var queue=schema({'name':{'type':_0xfb22('0x5'),'required':!![],'message':_0xfb22('0x6')},'timeout':{'type':'number','message':_0xfb22('0x7')}});function writeLog(_0x1f50d6,_0x186b8d,_0x26c119){return logger[_0xfb22('0x8')](util[_0xfb22('0x9')](_0xfb22('0xa'),_0x1f50d6,_0x186b8d[_0xfb22('0xb')],_0x26c119));}function handleFindAgent(_0x4206a5){return function(_0x42d13d){return _0x42d13d[_0xfb22('0xb')][_0xfb22('0xc')]()===_0x4206a5[_0xfb22('0xc')]();};}exports[_0xfb22('0xd')]=function(_0x1676f4,_0xbff5a1,_0x7aa8d1,_0x2056d7){return function(_0x186ad7){try{var _0x48ab1b={'name':_0xbff5a1[0x0],'timeout':_0xbff5a1[0x1]};var _0xf8a506=queue[_0xfb22('0x0')](_0x48ab1b,{'typecast':!![]});if(_0xf8a506[_0xfb22('0xe')]){logger[_0xfb22('0xf')](_0xfb22('0x10'),_0x1676f4,_['map'](_0xf8a506,_0xfb22('0x11'))['join'](',\x20'));_0x186ad7[_0xfb22('0x12')]();}else{var _0x242691=_[_0xfb22('0x13')](_0x7aa8d1[_0xfb22('0x14')],handleFindAgent(_0x48ab1b[_0xfb22('0xb')]));if(_0x242691){var _0x5cc481=(_0x48ab1b[_0xfb22('0x15')]||0xa)*0x3e8;var _0x4a875c,_0x5949e8;var _0x369ed9=seqqueue[_0xfb22('0x16')](_0x5cc481);_0x369ed9['id']=_0x1676f4;_0x369ed9['atimeout']=_0x5cc481;_0x369ed9[_0xfb22('0x17')]=_0x2056d7[_0xfb22('0x17')];writeLog(_0x1676f4,_0x242691,util[_0xfb22('0x9')](_0xfb22('0x18'),_0x5cc481));_0x7aa8d1[_0xfb22('0x19')][_0x1676f4]['on']('end',function(){logger[_0xfb22('0x8')](_0xfb22('0x1a'),_0x1676f4);clearTimeout(_0x5949e8);_0x5949e8=undefined;_0x369ed9[_0xfb22('0x1b')]();if(_0x7aa8d1[_0xfb22('0x19')][_0x1676f4]){delete _0x7aa8d1[_0xfb22('0x19')][_0x1676f4];}_0x186ad7['stop']();});_0x7aa8d1[_0xfb22('0x19')][_0x1676f4]['on'](_0xfb22('0x1c'),function(){if(_0x7aa8d1[_0xfb22('0x19')][_0x1676f4]){delete _0x7aa8d1[_0xfb22('0x19')][_0x1676f4];}});_0x5949e8=setTimeout(function(){logger[_0xfb22('0x8')](_0xfb22('0x1d'),_0x1676f4);clearTimeout(_0x5949e8);_0x369ed9[_0xfb22('0x1b')]();_0x186ad7[_0xfb22('0x1e')]();},_0x5cc481);strategy[_0xfb22('0x1f')](_0x369ed9,_0x242691,_0x7aa8d1,_0x2056d7);}else{logger[_0xfb22('0xf')](_0xfb22('0x20'),_0x1676f4,_0x48ab1b[_0xfb22('0xb')]);_0x186ad7[_0xfb22('0x12')]();}}}catch(_0x42c438){console['log'](_0x42c438);logger[_0xfb22('0xf')](_0xfb22('0x21'),_0x1676f4,_0x42c438[_0xfb22('0x22')]);_0x186ad7[_0xfb22('0x12')]();}};}; \ No newline at end of file +var _0xd619=['toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','./strategy','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x5787b4,_0x39c07c){var _0xb4388=function(_0x580119){while(--_0x580119){_0x5787b4['push'](_0x5787b4['shift']());}};_0xb4388(++_0x39c07c);}(_0xd619,0x115));var _0x9d61=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xd619[_0x1b2ff7];return _0x31656a;};'use strict';var schema=require(_0x9d61('0x0'));var _=require(_0x9d61('0x1'));var util=require(_0x9d61('0x2'));var seqqueue=require(_0x9d61('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x9d61('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9d61('0x5'),'message':_0x9d61('0x6')}});function writeLog(_0x1b6a04,_0x5bf60e,_0x1e5c21){return logger[_0x9d61('0x7')](util[_0x9d61('0x8')](_0x9d61('0x9'),_0x1b6a04,_0x5bf60e[_0x9d61('0xa')],_0x1e5c21));}function handleFindAgent(_0x321d69){return function(_0x2d2b7a){return _0x2d2b7a[_0x9d61('0xa')][_0x9d61('0xb')]()===_0x321d69[_0x9d61('0xb')]();};}exports[_0x9d61('0xc')]=function(_0x410a60,_0x450c21,_0x1e1c34,_0x2707d6){return function(_0x37700f){try{var _0x3fc547={'name':_0x450c21[0x0],'timeout':_0x450c21[0x1]};var _0x2be101=queue[_0x9d61('0x0')](_0x3fc547,{'typecast':!![]});if(_0x2be101[_0x9d61('0xd')]){logger['error'](_0x9d61('0xe'),_0x410a60,_[_0x9d61('0xf')](_0x2be101,_0x9d61('0x10'))[_0x9d61('0x11')](',\x20'));_0x37700f[_0x9d61('0x12')]();}else{var _0x495da3=_[_0x9d61('0x13')](_0x1e1c34[_0x9d61('0x14')],handleFindAgent(_0x3fc547[_0x9d61('0xa')]));if(_0x495da3){var _0x5a49c1=(_0x3fc547[_0x9d61('0x15')]||0xa)*0x3e8;var _0x303c4a,_0x1b3dbf;var _0x1af18d=seqqueue[_0x9d61('0x16')](_0x5a49c1);_0x1af18d['id']=_0x410a60;_0x1af18d['atimeout']=_0x5a49c1;_0x1af18d['channel']=_0x2707d6['channel'];writeLog(_0x410a60,_0x495da3,util[_0x9d61('0x8')](_0x9d61('0x17'),_0x5a49c1));_0x1e1c34[_0x9d61('0x18')][_0x410a60]['on'](_0x9d61('0x19'),function(){logger[_0x9d61('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x410a60);clearTimeout(_0x1b3dbf);_0x1b3dbf=undefined;_0x1af18d[_0x9d61('0x1a')]();if(_0x1e1c34[_0x9d61('0x18')][_0x410a60]){delete _0x1e1c34[_0x9d61('0x18')][_0x410a60];}_0x37700f[_0x9d61('0x12')]();});_0x1e1c34[_0x9d61('0x18')][_0x410a60]['on'](_0x9d61('0x1b'),function(){if(_0x1e1c34[_0x9d61('0x18')][_0x410a60]){delete _0x1e1c34['rules'][_0x410a60];}});_0x1b3dbf=setTimeout(function(){logger['info'](_0x9d61('0x1c'),_0x410a60);clearTimeout(_0x1b3dbf);_0x1af18d[_0x9d61('0x1a')]();_0x37700f[_0x9d61('0x1d')]();},_0x5a49c1);strategy[_0x9d61('0x1e')](_0x1af18d,_0x495da3,_0x1e1c34,_0x2707d6);}else{logger['error'](_0x9d61('0x1f'),_0x410a60,_0x3fc547[_0x9d61('0xa')]);_0x37700f['stop']();}}}catch(_0x52ff4b){console[_0x9d61('0x20')](_0x52ff4b);logger[_0x9d61('0x21')](_0x9d61('0x22'),_0x410a60,_0x52ff4b[_0x9d61('0x23')]);_0x37700f[_0x9d61('0x12')]();}};}; \ 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 9038028..fd3d9b6 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 _0x9c5c=['error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','toString','message','amazonlex','providerName','providerResponse','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','AccountId','account','upperFirst','created','isEmpty','body','Message','create','then','[%s][AMAZONLEX]\x20%s','catch'];(function(_0x502002,_0x5e439b){var _0x58e134=function(_0x2e2061){while(--_0x2e2061){_0x502002['push'](_0x502002['shift']());}};_0x58e134(++_0x5e439b);}(_0x9c5c,0x1e3));var _0xc9c5=function(_0x453ac9,_0x41b7d1){_0x453ac9=_0x453ac9-0x0;var _0x9aaabb=_0x9c5c[_0x453ac9];return _0x9aaabb;};'use strict';var _=require(_0xc9c5('0x0'));var moment=require(_0xc9c5('0x1'));var AWS=require(_0xc9c5('0x2'));var utils=require('./utils');var logger=require(_0xc9c5('0x3'))(_0xc9c5('0x4'));var rpc={'chatMessage':require(_0xc9c5('0x5')),'openchannelMessage':require(_0xc9c5('0x6')),'mailMessage':require(_0xc9c5('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc9c5('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc9c5('0x9')]=function(_0x4c0092,_0x33df6c){return function(_0x5e76c8){try{if(!_[_0xc9c5('0xa')](this[_0xc9c5('0xb')][_0xc9c5('0xc')])){logger[_0xc9c5('0xd')]('[%s][AMAZONLEX]\x20%s',_0x4c0092,_0xc9c5('0xe'));return _0x5e76c8[_0xc9c5('0xf')]();}var _0x1a342f={'ContactId':this[_0xc9c5('0x10')]['id'],'sentAt':moment()[_0xc9c5('0x11')](_0xc9c5('0x12')),'direction':_0xc9c5('0x13')};if(this[_0xc9c5('0x14')]==='sms'||this[_0xc9c5('0x14')]==='whatsapp'){_0x1a342f[_0xc9c5('0x15')]=this[_0xc9c5('0xb')]['phone'];}var _0x136939=this[_0xc9c5('0x14')];if(_0x136939===_0xc9c5('0x16')){_0x1a342f['ChatWebsiteId']=this['account']['id'];}else{_0x1a342f[_['upperFirst'](_0x136939)+_0xc9c5('0x17')]=this[_0xc9c5('0x18')]['id'];}_0x1a342f[_[_0xc9c5('0x19')](_0x136939)+'InteractionId']=this[_0xc9c5('0xb')]['id'];if(this[_0xc9c5('0xb')][_0xc9c5('0x1a')]){var _0x2c3c3e=_0x33df6c[0x4];if(!_[_0xc9c5('0x1b')](_0x2c3c3e)){_0x1a342f[_0xc9c5('0x1c')]=utils['getMustacheRender'](_0x2c3c3e,this);return rpc[_0x136939+_0xc9c5('0x1d')][_0xc9c5('0x1e')](_0x1a342f)[_0xc9c5('0x1f')](function(_0x39bd36){logger[_0xc9c5('0xd')](_0xc9c5('0x20'),_0x4c0092,_0x1a342f[_0xc9c5('0x1c')]);})[_0xc9c5('0x21')](function(_0x5bef0e){logger[_0xc9c5('0x22')](_0xc9c5('0x20'),_0x4c0092,JSON[_0xc9c5('0x23')](_0x5bef0e));})[_0xc9c5('0x24')](function(){logger[_0xc9c5('0xd')](_0xc9c5('0x25'),_0x4c0092);_0x5e76c8[_0xc9c5('0x26')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4c0092);_0x5e76c8[_0xc9c5('0x26')]();}}else{var _0x16ff71=this;var _0x5b7987=new AWS[(_0xc9c5('0x27'))]({'accessKeyId':_0x33df6c[0x0],'secretAccessKey':_0x33df6c[0x1],'region':_0x33df6c[0x2]});var _0x423311={'botAlias':_0xc9c5('0x28'),'botName':_0x33df6c[0x3],'inputText':this['message']['body'],'userId':this[_0xc9c5('0x14')]+':'+this[_0xc9c5('0xb')]['id'][_0xc9c5('0x29')]()};_0x5b7987['postText'](_0x423311,function(_0x2853bb,_0xd7164e){if(_0x2853bb){logger[_0xc9c5('0x22')](_0xc9c5('0x20'),_0x4c0092,_0x2853bb[_0xc9c5('0x2a')]);_0x5e76c8['next']();}else if(_0xd7164e&&_0xd7164e[_0xc9c5('0x2a')]){_0x16ff71[_0xc9c5('0x1c')][_0xc9c5('0x2b')]=_0xd7164e;_0x1a342f[_0xc9c5('0x1c')]=_0xd7164e[_0xc9c5('0x2a')];_0x1a342f[_0xc9c5('0x2c')]=_0xc9c5('0x2b');_0x1a342f[_0xc9c5('0x2d')]=JSON[_0xc9c5('0x23')](_0xd7164e);return rpc[_0x136939+_0xc9c5('0x1d')][_0xc9c5('0x1e')](_0x1a342f)[_0xc9c5('0x1f')](function(_0x21cdfb){logger[_0xc9c5('0xd')](_0xc9c5('0x20'),_0x4c0092,_0x1a342f[_0xc9c5('0x1c')]);if(_0xd7164e['dialogState']==_0xc9c5('0x2e')){_0x5e76c8[_0xc9c5('0xf')]();}else{_0x5e76c8[_0xc9c5('0x26')]();}})['catch'](function(_0x22dd42){logger[_0xc9c5('0x22')]('[%s][AMAZONLEX]\x20%s',_0x4c0092,JSON[_0xc9c5('0x23')](_0x22dd42));_0x5e76c8['next']();});}else{_0x5e76c8['next']();}});}}catch(_0x2075e8){logger['error'](_0xc9c5('0x20'),_0x4c0092,JSON[_0xc9c5('0x23')](_0x2075e8));_0x5e76c8['stop']();}};}; \ No newline at end of file +var _0x9779=['info','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','postText','message','amazonlex','providerName','create','dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','then','catch','error','stringify'];(function(_0x12c3aa,_0x9d52a7){var _0x178c7e=function(_0xc07041){while(--_0xc07041){_0x12c3aa['push'](_0x12c3aa['shift']());}};_0x178c7e(++_0x9d52a7);}(_0x9779,0x69));var _0x9977=function(_0x490475,_0x2454ee){_0x490475=_0x490475-0x0;var _0x3d1988=_0x9779[_0x490475];return _0x3d1988;};'use strict';var _=require(_0x9977('0x0'));var moment=require(_0x9977('0x1'));var AWS=require(_0x9977('0x2'));var utils=require(_0x9977('0x3'));var logger=require(_0x9977('0x4'))('routing');var rpc={'chatMessage':require(_0x9977('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9977('0x6')),'smsMessage':require(_0x9977('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9977('0x8')]=function(_0x5d11e8,_0x37793b){return function(_0xd4d287){try{if(!_[_0x9977('0x9')](this['interaction'][_0x9977('0xa')])){logger['info'](_0x9977('0xb'),_0x5d11e8,_0x9977('0xc'));return _0xd4d287[_0x9977('0xd')]();}var _0x37f4da={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9977('0xe')](_0x9977('0xf')),'direction':_0x9977('0x10')};if(this[_0x9977('0x11')]===_0x9977('0x12')||this[_0x9977('0x11')]===_0x9977('0x13')){_0x37f4da[_0x9977('0x14')]=this['interaction'][_0x9977('0x14')];}var _0x51798e=this[_0x9977('0x11')];if(_0x51798e===_0x9977('0x15')){_0x37f4da[_0x9977('0x16')]=this[_0x9977('0x17')]['id'];}else{_0x37f4da[_[_0x9977('0x18')](_0x51798e)+_0x9977('0x19')]=this['account']['id'];}_0x37f4da[_[_0x9977('0x18')](_0x51798e)+_0x9977('0x1a')]=this[_0x9977('0x1b')]['id'];if(this[_0x9977('0x1b')][_0x9977('0x1c')]){var _0x518ccc=_0x37793b[0x4];if(!_[_0x9977('0x1d')](_0x518ccc)){_0x37f4da[_0x9977('0x1e')]=utils[_0x9977('0x1f')](_0x518ccc,this);return rpc[_0x51798e+'Message']['create'](_0x37f4da)[_0x9977('0x20')](function(_0x36e33d){logger['info'](_0x9977('0xb'),_0x5d11e8,_0x37f4da[_0x9977('0x1e')]);})[_0x9977('0x21')](function(_0x4c49e0){logger[_0x9977('0x22')](_0x9977('0xb'),_0x5d11e8,JSON[_0x9977('0x23')](_0x4c49e0));})['finally'](function(){logger[_0x9977('0x24')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5d11e8);_0xd4d287[_0x9977('0x25')]();});}else{logger[_0x9977('0x24')](_0x9977('0x26'),_0x5d11e8);_0xd4d287[_0x9977('0x25')]();}}else{var _0x402346=this;var _0x5101ef=new AWS[(_0x9977('0x27'))]({'accessKeyId':_0x37793b[0x0],'secretAccessKey':_0x37793b[0x1],'region':_0x37793b[0x2]});var _0xd6fa91={'botAlias':_0x9977('0x28'),'botName':_0x37793b[0x3],'inputText':this['message'][_0x9977('0x1e')],'userId':this['channel']+':'+this[_0x9977('0x1b')]['id']['toString']()};_0x5101ef[_0x9977('0x29')](_0xd6fa91,function(_0x5a81a9,_0x50bd27){if(_0x5a81a9){logger['error'](_0x9977('0xb'),_0x5d11e8,_0x5a81a9[_0x9977('0x2a')]);_0xd4d287['next']();}else if(_0x50bd27&&_0x50bd27[_0x9977('0x2a')]){_0x402346['body'][_0x9977('0x2b')]=_0x50bd27;_0x37f4da['body']=_0x50bd27['message'];_0x37f4da[_0x9977('0x2c')]=_0x9977('0x2b');_0x37f4da['providerResponse']=JSON['stringify'](_0x50bd27);return rpc[_0x51798e+'Message'][_0x9977('0x2d')](_0x37f4da)[_0x9977('0x20')](function(_0x401e2b){logger[_0x9977('0x24')]('[%s][AMAZONLEX]\x20%s',_0x5d11e8,_0x37f4da['body']);if(_0x50bd27[_0x9977('0x2e')]=='Failed'){_0xd4d287[_0x9977('0xd')]();}else{_0xd4d287[_0x9977('0x25')]();}})[_0x9977('0x21')](function(_0x411afa){logger[_0x9977('0x22')](_0x9977('0xb'),_0x5d11e8,JSON[_0x9977('0x23')](_0x411afa));_0xd4d287['next']();});}else{_0xd4d287[_0x9977('0xd')]();}});}}catch(_0x356b52){logger[_0x9977('0x22')](_0x9977('0xb'),_0x5d11e8,JSON[_0x9977('0x23')](_0x356b52));_0xd4d287[_0x9977('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index a8466a4..0490947 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 _0x6825=['Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','inReplyTo','html','','replace','','headers','auto-replied','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6825,0x91));var _0x5682=function(_0x15c936,_0x522e26){_0x15c936=_0x15c936-0x0;var _0x53f91c=_0x6825[_0x15c936];return _0x53f91c;};'use strict';var _=require(_0x5682('0x0'));var moment=require('moment');var utils=require(_0x5682('0x1'));var logger=require(_0x5682('0x2'))(_0x5682('0x3'));var rpc={'chatMessage':require(_0x5682('0x4')),'openchannelMessage':require(_0x5682('0x5')),'mailMessage':require(_0x5682('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5682('0x7')),'whatsappMessage':require(_0x5682('0x8')),'chatInteraction':require(_0x5682('0x9')),'openchannelInteraction':require(_0x5682('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x5682('0xb')),'faxInteraction':require(_0x5682('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x5682('0xd'));exports['consequence']=function(_0x1f12ab,_0x2d048b,_0x298cbf,_0xaac17b){return function(_0x476891){try{var _0x4faff9=this[_0x5682('0xe')];if(_0x4faff9===_0x5682('0xf')&&_0xaac17b[_0x5682('0x10')][_0x5682('0x11')]){logger[_0x5682('0x12')](_0x5682('0x13'),_0x1f12ab,_0x5682('0x14'));return _0x476891[_0x5682('0x15')]();}if(_0x2d048b[0x0]==='1'&&(_['isNil'](this[_0x5682('0x16')]['created'])||!this[_0x5682('0x16')]['created'])){logger[_0x5682('0x12')](_0x5682('0x13'),_0x1f12ab,'Autoreply\x20already\x20sent');return _0x476891[_0x5682('0x15')]();}if(_0x2d048b[0x0]==='2'&&this[_0x5682('0x16')][_0x5682('0x17')]){logger['info'](_0x5682('0x18'),_0x1f12ab,_0x5682('0x19'));return _0x476891[_0x5682('0x15')]();}var _0x40c8ae={'ContactId':this[_0x5682('0x1a')]['id'],'sentAt':moment()[_0x5682('0x1b')](_0x5682('0x1c')),'direction':_0x5682('0x1d')};if(this[_0x5682('0xe')]===_0x5682('0xf')){_0x40c8ae[_0x5682('0x10')]=utils[_0x5682('0x1e')](_0x2d048b[0x2],this);}else{_0x40c8ae['body']=utils[_0x5682('0x1e')](_0x2d048b[0x1],this);}if(this[_0x5682('0x1f')]){_0x40c8ae['to']=this[_0x5682('0x1f')][_0x5682('0x20')]||'';if(this[_0x5682('0xe')]==='mail'&&_0x2d048b[0x1]==='1'){_0x40c8ae['cc']=this[_0x5682('0x1f')]['cc']||'';}_0x40c8ae[_0x5682('0x20')]=this[_0x5682('0x1f')]['to']||'';_0x40c8ae[_0x5682('0x21')]=this[_0x5682('0x1f')]['phone']||'';_0x40c8ae[_0x5682('0x22')]=!![];if(this[_0x5682('0x1f')][_0x5682('0x23')]){_0x40c8ae[_0x5682('0x23')]='';_0x40c8ae[_0x5682('0x23')]+=_[_0x5682('0x24')](this[_0x5682('0x1f')][_0x5682('0x23')],'Re:')?'':_0x5682('0x25');_0x40c8ae['subject']+=this[_0x5682('0x1f')][_0x5682('0x23')];}}if(this[_0x5682('0xe')]===_0x5682('0x26')){_0x40c8ae[_0x5682('0x27')]=this[_0x5682('0x28')]['id'];}else{_0x40c8ae[_['upperFirst'](this[_0x5682('0xe')])+_0x5682('0x29')]=this[_0x5682('0x28')]['id'];}_0x40c8ae[_[_0x5682('0x2a')](this[_0x5682('0xe')])+_0x5682('0x2b')]=this[_0x5682('0x16')]['id'];var _0x19a409=this['interaction'];if(rpc[this['channel']+_0x5682('0x2c')]){if(this[_0x5682('0xe')]===_0x5682('0xf')){_0x40c8ae[_0x5682('0x2d')]=this['message']['messageId'];_0x40c8ae[_0x5682('0x2e')]=_0x5682('0x2f')+_[_0x5682('0x30')](_0x40c8ae[_0x5682('0x10')],_0x5682('0x31'),_0x5682('0x32'))+_0x5682('0x33');_0x40c8ae[_0x5682('0x34')]={'Auto-Submitted':_0x5682('0x35'),'X-Auto-Response-Suppress':_0x5682('0x36'),'Precedence':_0x5682('0x37')};return mailRpc['sendMailMessage'](this['account'][_0x5682('0x38')],_0x40c8ae)[_0x5682('0x39')](function(_0x10115d){logger[_0x5682('0x12')](_0x5682('0x3a'),_0x1f12ab);_0x40c8ae['messageId']=_0x10115d[_0x5682('0x1f')]['messageId'];return rpc[_0x4faff9+_0x5682('0x2c')][_0x5682('0x3b')](_0x40c8ae);})[_0x5682('0x39')](function(_0x4ba28c){logger['info'](_0x5682('0x13'),_0x1f12ab,JSON['stringify'](_0x4ba28c));})[_0x5682('0x3c')](function(_0x1b1ee7){logger[_0x5682('0x3d')](_0x5682('0x3e'),_0x1f12ab,JSON[_0x5682('0x3f')](_0x1b1ee7));})[_0x5682('0x40')](function(){Promise['resolve']()[_0x5682('0x39')](function(){if(_0x2d048b[0x0]!=='2'||_0x19a409[_0x5682('0x17')])return;return rpc[_0x4faff9+_0x5682('0x41')][_0x5682('0x42')](_0x19a409['id'],{'autoreplyExecuted':!![]})['then'](function(_0x6b3744){logger[_0x5682('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1f12ab,JSON[_0x5682('0x3f')](_0x6b3744));})[_0x5682('0x3c')](function(_0x3bdfce){logger['error'](_0x5682('0x43'),_0x1f12ab,JSON[_0x5682('0x3f')](_0x3bdfce));});})[_0x5682('0x39')](function(){_0x476891['next']();});});}else{return rpc[this['channel']+'Message']['create'](_0x40c8ae)[_0x5682('0x39')](function(){logger['info'](_0x5682('0x13'),_0x1f12ab,_0x40c8ae[_0x5682('0x10')]);})['catch'](function(_0x198ba2){logger['error'](_0x5682('0x13'),_0x1f12ab,JSON[_0x5682('0x3f')](_0x198ba2));})[_0x5682('0x40')](function(){Promise[_0x5682('0x44')]()[_0x5682('0x39')](function(){if(_0x2d048b[0x0]!=='2'||_0x19a409[_0x5682('0x17')])return;return rpc[_0x4faff9+_0x5682('0x41')]['update'](_0x19a409['id'],{'autoreplyExecuted':!![]})[_0x5682('0x39')](function(_0x58d837){logger[_0x5682('0x12')](_0x5682('0x18'),_0x1f12ab,JSON[_0x5682('0x3f')](_0x58d837));})[_0x5682('0x3c')](function(_0x4b35ab){logger['error'](_0x5682('0x43'),_0x1f12ab,JSON[_0x5682('0x3f')](_0x4b35ab));});})['then'](function(){_0x476891[_0x5682('0x15')]();});});}}}catch(_0x2dff8b){logger[_0x5682('0x3d')](_0x5682('0x13'),_0x1f12ab,JSON['stringify'](_0x2dff8b));_0x476891[_0x5682('0x45')]();}};}; \ No newline at end of file +var _0x1ced=['AccountId','upperFirst','inReplyTo','messageId','html','','replace','','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','then','stringify','catch','error','resolve','Interaction','update','Message','create','finally','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','subject','startsWith','Re:','Re:\x20','account'];(function(_0x542c54,_0x2883eb){var _0x2f871b=function(_0x5dce84){while(--_0x5dce84){_0x542c54['push'](_0x542c54['shift']());}};_0x2f871b(++_0x2883eb);}(_0x1ced,0x12f));var _0xd1ce=function(_0x368467,_0x4f4c1e){_0x368467=_0x368467-0x0;var _0x1c8f4d=_0x1ced[_0x368467];return _0x1c8f4d;};'use strict';var _=require(_0xd1ce('0x0'));var moment=require(_0xd1ce('0x1'));var utils=require(_0xd1ce('0x2'));var logger=require(_0xd1ce('0x3'))(_0xd1ce('0x4'));var rpc={'chatMessage':require(_0xd1ce('0x5')),'openchannelMessage':require(_0xd1ce('0x6')),'mailMessage':require(_0xd1ce('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd1ce('0x8')),'whatsappMessage':require(_0xd1ce('0x9')),'chatInteraction':require(_0xd1ce('0xa')),'openchannelInteraction':require(_0xd1ce('0xb')),'mailInteraction':require(_0xd1ce('0xc')),'smsInteraction':require(_0xd1ce('0xd')),'faxInteraction':require(_0xd1ce('0xe')),'whatsappInteraction':require(_0xd1ce('0xf'))};var mailRpc=require('../../mailRpc');exports[_0xd1ce('0x10')]=function(_0x5d8347,_0x3d3de8,_0x1a8c25,_0x53544b){return function(_0xcefac3){try{var _0x3fe48f=this[_0xd1ce('0x11')];if(_0x3fe48f===_0xd1ce('0x12')&&_0x53544b[_0xd1ce('0x13')][_0xd1ce('0x14')]){logger[_0xd1ce('0x15')](_0xd1ce('0x16'),_0x5d8347,_0xd1ce('0x17'));return _0xcefac3[_0xd1ce('0x18')]();}if(_0x3d3de8[0x0]==='1'&&(_[_0xd1ce('0x19')](this[_0xd1ce('0x1a')][_0xd1ce('0x1b')])||!this['interaction'][_0xd1ce('0x1b')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x5d8347,_0xd1ce('0x1c'));return _0xcefac3[_0xd1ce('0x18')]();}if(_0x3d3de8[0x0]==='2'&&this[_0xd1ce('0x1a')][_0xd1ce('0x1d')]){logger[_0xd1ce('0x15')](_0xd1ce('0x1e'),_0x5d8347,'One\x20Time\x20already\x20sent');return _0xcefac3[_0xd1ce('0x18')]();}var _0x117947={'ContactId':this[_0xd1ce('0x1f')]['id'],'sentAt':moment()[_0xd1ce('0x20')](_0xd1ce('0x21')),'direction':_0xd1ce('0x22')};if(this[_0xd1ce('0x11')]==='mail'){_0x117947[_0xd1ce('0x13')]=utils[_0xd1ce('0x23')](_0x3d3de8[0x2],this);}else{_0x117947['body']=utils[_0xd1ce('0x23')](_0x3d3de8[0x1],this);}if(this[_0xd1ce('0x24')]){_0x117947['to']=this[_0xd1ce('0x24')]['from']||'';if(this[_0xd1ce('0x11')]==='mail'&&_0x3d3de8[0x1]==='1'){_0x117947['cc']=this[_0xd1ce('0x24')]['cc']||'';}_0x117947['from']=this[_0xd1ce('0x24')]['to']||'';_0x117947['phone']=this['message']['phone']||'';_0x117947['read']=!![];if(this[_0xd1ce('0x24')][_0xd1ce('0x25')]){_0x117947[_0xd1ce('0x25')]='';_0x117947[_0xd1ce('0x25')]+=_[_0xd1ce('0x26')](this['message']['subject'],_0xd1ce('0x27'))?'':_0xd1ce('0x28');_0x117947[_0xd1ce('0x25')]+=this[_0xd1ce('0x24')][_0xd1ce('0x25')];}}if(this[_0xd1ce('0x11')]==='chat'){_0x117947['ChatWebsiteId']=this[_0xd1ce('0x29')]['id'];}else{_0x117947[_['upperFirst'](this[_0xd1ce('0x11')])+_0xd1ce('0x2a')]=this['account']['id'];}_0x117947[_[_0xd1ce('0x2b')](this['channel'])+'InteractionId']=this[_0xd1ce('0x1a')]['id'];var _0x9a3dc=this[_0xd1ce('0x1a')];if(rpc[this[_0xd1ce('0x11')]+'Message']){if(this[_0xd1ce('0x11')]===_0xd1ce('0x12')){_0x117947[_0xd1ce('0x2c')]=this[_0xd1ce('0x24')][_0xd1ce('0x2d')];_0x117947[_0xd1ce('0x2e')]=_0xd1ce('0x2f')+_[_0xd1ce('0x30')](_0x117947['body'],']+(>|$)/g,''),'priorityTrue':_0x79e83[0x1],'priorityFalse':_0x79e83[0x2]};var _0x500e83=gotoif[_0x9f30('0x0')](_0x35ac60,{'typecast':!![]});if(_0x500e83[_0x9f30('0xd')]){logger[_0x9f30('0xe')](_0x9f30('0xf'),_0x404c84,_['map'](_0x500e83,'message')[_0x9f30('0x10')](',\x20'));_0x420bef[_0x9f30('0x11')]();}else{try{var _0x125728=eval('('+_0x35ac60[_0x9f30('0x12')]+')');var _0x2263f0=_0x125728?_0x35ac60[_0x9f30('0x13')]:_0x35ac60['priorityFalse'];logger[_0x9f30('0x14')](_0x9f30('0x15'),_0x404c84,_0x35ac60[_0x9f30('0x12')],_0x125728,_0x2263f0||_0x9f30('0x16'));if(_0x2263f0){var _0x450cda=_[_0x9f30('0x17')](_0x420bef[_0x9f30('0x18')](),{'p':_0x2263f0});if(_0x450cda>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x404c84,_0x2263f0||_0x9f30('0x16'),_0x450cda);_0x420bef['next'](_0x450cda);}else{logger[_0x9f30('0x14')](_0x9f30('0x19'),_0x404c84,_0x2263f0||_0x9f30('0x16'));_0x420bef[_0x9f30('0x11')]();}}else{_0x420bef[_0x9f30('0x16')]();}}catch(_0x5bd21c){logger[_0x9f30('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x404c84,_0x5bd21c[_0x9f30('0x1a')]);_0x420bef[_0x9f30('0x11')]();}}}catch(_0x5711f0){logger['error'](_0x9f30('0xf'),_0x404c84,JSON[_0x9f30('0x1b')](_0x5711f0));_0x420bef[_0x9f30('0x11')]();}};}; \ No newline at end of file +var _0xedd6=['findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0x42f4e0,_0x1a481f){var _0x5eb3e0=function(_0x4ba1fa){while(--_0x4ba1fa){_0x42f4e0['push'](_0x42f4e0['shift']());}};_0x5eb3e0(++_0x1a481f);}(_0xedd6,0x96));var _0x6edd=function(_0x5a0520,_0x1e0e28){_0x5a0520=_0x5a0520-0x0;var _0x23bf9f=_0xedd6[_0x5a0520];return _0x23bf9f;};'use strict';var schema=require(_0x6edd('0x0'));var _=require(_0x6edd('0x1'));var htmlToText=require(_0x6edd('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x6edd('0x3'));var gotoif=schema({'condition':{'type':_0x6edd('0x4'),'required':!![],'message':_0x6edd('0x5')},'priorityTrue':{'type':_0x6edd('0x6'),'message':_0x6edd('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x6edd('0x8')]=function(_0x516a10,_0x496a4b){return function(_0x38044f){try{var _0x335c33={'condition':htmlToText[_0x6edd('0x9')](utils['getMustacheRender'](_0x496a4b[0x0],this),{'wordwrap':![]})[_0x6edd('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x496a4b[0x1],'priorityFalse':_0x496a4b[0x2]};var _0x8cd32b=gotoif[_0x6edd('0x0')](_0x335c33,{'typecast':!![]});if(_0x8cd32b[_0x6edd('0xb')]){logger[_0x6edd('0xc')](_0x6edd('0xd'),_0x516a10,_[_0x6edd('0xe')](_0x8cd32b,_0x6edd('0xf'))[_0x6edd('0x10')](',\x20'));_0x38044f[_0x6edd('0x11')]();}else{try{var _0x5bc368=eval('('+_0x335c33[_0x6edd('0x12')]+')');var _0x538a30=_0x5bc368?_0x335c33[_0x6edd('0x13')]:_0x335c33[_0x6edd('0x14')];logger[_0x6edd('0x15')](_0x6edd('0x16'),_0x516a10,_0x335c33[_0x6edd('0x12')],_0x5bc368,_0x538a30||_0x6edd('0x17'));if(_0x538a30){var _0x35db26=_[_0x6edd('0x18')](_0x38044f[_0x6edd('0x19')](),{'p':_0x538a30});if(_0x35db26>=0x0){logger[_0x6edd('0x15')](_0x6edd('0x1a'),_0x516a10,_0x538a30||_0x6edd('0x17'),_0x35db26);_0x38044f[_0x6edd('0x17')](_0x35db26);}else{logger[_0x6edd('0x15')](_0x6edd('0x1b'),_0x516a10,_0x538a30||_0x6edd('0x17'));_0x38044f[_0x6edd('0x11')]();}}else{_0x38044f[_0x6edd('0x17')]();}}catch(_0x232825){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x516a10,_0x232825[_0x6edd('0xf')]);_0x38044f[_0x6edd('0x11')]();}}}catch(_0x4bdb74){logger[_0x6edd('0xc')]('[%s][GOTOIF]\x20%s',_0x516a10,JSON[_0x6edd('0x1c')](_0x4bdb74));_0x38044f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 9cc36d5..1a2c3a9 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 _0xbbe4=['lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate'];(function(_0x3a1e87,_0x5f84e5){var _0x1fd29b=function(_0x2fdd29){while(--_0x2fdd29){_0x3a1e87['push'](_0x3a1e87['shift']());}};_0x1fd29b(++_0x5f84e5);}(_0xbbe4,0x11f));var _0x4bbe=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0xbbe4[_0x74892f];return _0x10ee61;};'use strict';var schema=require(_0x4bbe('0x0'));var _=require(_0x4bbe('0x1'));var logger=require(_0x4bbe('0x2'))(_0x4bbe('0x3'));var gotop=schema({'priority':{'type':_0x4bbe('0x4'),'required':!![],'message':_0x4bbe('0x5')}});exports['consequence']=function(_0x7040f8,_0x59f82e){return function(_0x4d7387){try{var _0x41befe={'priority':_0x59f82e[0x0]};var _0x2fdc49=gotop['validate'](_0x41befe,{'typecast':!![]});if(_0x2fdc49['length']){logger[_0x4bbe('0x6')](_0x4bbe('0x7'),_0x7040f8,_['map'](_0x2fdc49,'message')[_0x4bbe('0x8')](',\x20'));_0x4d7387[_0x4bbe('0x9')]();}else{logger[_0x4bbe('0xa')](_0x4bbe('0xb'),_0x7040f8,_0x41befe[_0x4bbe('0xc')]);if(_0x41befe[_0x4bbe('0xc')]){var _0x3e7913=_[_0x4bbe('0xd')](_0x4d7387[_0x4bbe('0xe')](),{'p':_0x41befe[_0x4bbe('0xc')]});if(_0x3e7913>=0x0){logger[_0x4bbe('0xa')](_0x4bbe('0xf'),_0x7040f8,_0x41befe[_0x4bbe('0xc')]||_0x4bbe('0x10'),_0x3e7913);_0x4d7387[_0x4bbe('0x10')](_0x3e7913);}else{logger['info'](_0x4bbe('0x11'),_0x7040f8,_0x41befe['priority']||'next');_0x4d7387['stop']();}}else{_0x4d7387[_0x4bbe('0x10')]();}}}catch(_0x1f3634){logger[_0x4bbe('0x6')](_0x4bbe('0x7'),_0x7040f8,JSON['stringify'](_0x1f3634));_0x4d7387[_0x4bbe('0x9')]();}};}; \ No newline at end of file +var _0xfa06=['../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','validate','lodash'];(function(_0x137c5b,_0x365266){var _0x554dc6=function(_0x41c2b8){while(--_0x41c2b8){_0x137c5b['push'](_0x137c5b['shift']());}};_0x554dc6(++_0x365266);}(_0xfa06,0xc6));var _0x6fa0=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xfa06[_0x5b561d];return _0x431060;};'use strict';var schema=require(_0x6fa0('0x0'));var _=require(_0x6fa0('0x1'));var logger=require(_0x6fa0('0x2'))(_0x6fa0('0x3'));var gotop=schema({'priority':{'type':_0x6fa0('0x4'),'required':!![],'message':_0x6fa0('0x5')}});exports['consequence']=function(_0x1c3816,_0x557aa5){return function(_0x5d2d8f){try{var _0x2b42bf={'priority':_0x557aa5[0x0]};var _0xa62ed7=gotop[_0x6fa0('0x0')](_0x2b42bf,{'typecast':!![]});if(_0xa62ed7['length']){logger[_0x6fa0('0x6')](_0x6fa0('0x7'),_0x1c3816,_[_0x6fa0('0x8')](_0xa62ed7,_0x6fa0('0x9'))[_0x6fa0('0xa')](',\x20'));_0x5d2d8f['stop']();}else{logger[_0x6fa0('0xb')](_0x6fa0('0xc'),_0x1c3816,_0x2b42bf[_0x6fa0('0xd')]);if(_0x2b42bf[_0x6fa0('0xd')]){var _0x225b38=_[_0x6fa0('0xe')](_0x5d2d8f[_0x6fa0('0xf')](),{'p':_0x2b42bf['priority']});if(_0x225b38>=0x0){logger[_0x6fa0('0xb')](_0x6fa0('0x10'),_0x1c3816,_0x2b42bf['priority']||_0x6fa0('0x11'),_0x225b38);_0x5d2d8f[_0x6fa0('0x11')](_0x225b38);}else{logger[_0x6fa0('0xb')](_0x6fa0('0x12'),_0x1c3816,_0x2b42bf[_0x6fa0('0xd')]||'next');_0x5d2d8f[_0x6fa0('0x13')]();}}else{_0x5d2d8f['next']();}}}catch(_0x16f33f){logger[_0x6fa0('0x6')](_0x6fa0('0x7'),_0x1c3816,JSON['stringify'](_0x16f33f));_0x5d2d8f[_0x6fa0('0x13')]();}};}; \ 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 b10a9e5..67b1372 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 _0xab75=['[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','account','InteractionId','interaction','Message','create','then','info'];(function(_0x2c1540,_0x2ba8c3){var _0x3b9ca8=function(_0x267bc3){while(--_0x267bc3){_0x2c1540['push'](_0x2c1540['shift']());}};_0x3b9ca8(++_0x2ba8c3);}(_0xab75,0x11f));var _0x5ab7=function(_0x307af8,_0x6735ee){_0x307af8=_0x307af8-0x0;var _0x231c86=_0xab75[_0x307af8];return _0x231c86;};'use strict';var _=require(_0x5ab7('0x0'));var utils=require(_0x5ab7('0x1'));var logger=require(_0x5ab7('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5ab7('0x3')),'mailMessage':require(_0x5ab7('0x4')),'smsMessage':require(_0x5ab7('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5ab7('0x6'))};exports[_0x5ab7('0x7')]=function(_0x248e56,_0x3e1c7e){return function(_0x406ca2){try{var _0x32b338={'body':utils[_0x5ab7('0x8')](_0x3e1c7e[0x0],this),'ContactId':this[_0x5ab7('0x9')]['id']};if(this[_0x5ab7('0xa')]===_0x5ab7('0xb')){_0x32b338[_0x5ab7('0xc')]=this['account']['id'];}else{_0x32b338[_[_0x5ab7('0xd')](this[_0x5ab7('0xa')])+'AccountId']=this[_0x5ab7('0xe')]['id'];}_0x32b338[_[_0x5ab7('0xd')](this[_0x5ab7('0xa')])+_0x5ab7('0xf')]=this[_0x5ab7('0x10')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x5ab7('0xa')]+_0x5ab7('0x11')][_0x5ab7('0x12')](_0x32b338)[_0x5ab7('0x13')](function(_0x1d6ae0){logger[_0x5ab7('0x14')](_0x5ab7('0x15'),_0x248e56,_0x32b338[_0x5ab7('0x16')]);_0x406ca2[_0x5ab7('0x17')]();})[_0x5ab7('0x18')](function(_0xd3255d){logger['error'](_0x5ab7('0x15'),_0x248e56,JSON[_0x5ab7('0x19')](_0xd3255d));_0x406ca2[_0x5ab7('0x1a')]();});}}catch(_0x456a4b){logger[_0x5ab7('0x1b')](_0x5ab7('0x15'),_0x248e56,JSON[_0x5ab7('0x19')](_0x456a4b));_0x406ca2[_0x5ab7('0x1a')]();}};}; \ No newline at end of file +var _0xaf5c=['stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','upperFirst','channel','AccountId','InteractionId','Message','then','info','body','catch','error','[%s][MESSAGE]\x20%s','stringify'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xaf5c,0x161));var _0xcaf5=function(_0x127a8b,_0x245c3a){_0x127a8b=_0x127a8b-0x0;var _0x504574=_0xaf5c[_0x127a8b];return _0x504574;};'use strict';var _=require('lodash');var utils=require(_0xcaf5('0x0'));var logger=require(_0xcaf5('0x1'))(_0xcaf5('0x2'));var rpc={'chatMessage':require(_0xcaf5('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xcaf5('0x4')),'smsMessage':require(_0xcaf5('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xcaf5('0x6'))};exports['consequence']=function(_0x1fd2d7,_0x118558){return function(_0x3695d5){try{var _0x17c418={'body':utils[_0xcaf5('0x7')](_0x118558[0x0],this),'ContactId':this[_0xcaf5('0x8')]['id']};if(this['channel']==='chat'){_0x17c418['ChatWebsiteId']=this['account']['id'];}else{_0x17c418[_[_0xcaf5('0x9')](this[_0xcaf5('0xa')])+_0xcaf5('0xb')]=this['account']['id'];}_0x17c418[_[_0xcaf5('0x9')](this[_0xcaf5('0xa')])+_0xcaf5('0xc')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0xcaf5('0xa')]+_0xcaf5('0xd')]['create'](_0x17c418)[_0xcaf5('0xe')](function(_0x121296){logger[_0xcaf5('0xf')]('[%s][MESSAGE]\x20%s',_0x1fd2d7,_0x17c418[_0xcaf5('0x10')]);_0x3695d5['next']();})[_0xcaf5('0x11')](function(_0x44df7e){logger[_0xcaf5('0x12')](_0xcaf5('0x13'),_0x1fd2d7,JSON[_0xcaf5('0x14')](_0x44df7e));_0x3695d5[_0xcaf5('0x15')]();});}}catch(_0x124a58){logger[_0xcaf5('0x12')](_0xcaf5('0x13'),_0x1fd2d7,JSON[_0xcaf5('0x14')](_0x124a58));_0x3695d5[_0xcaf5('0x15')]();}};}; \ 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 4354d78..312a442 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 _0xfdf7=['[%s][NOOP]\x20%s','next','stringify','stop','../../../../config/logger','routing','consequence','info'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xfdf7,0x1bc));var _0x7fdf=function(_0x3b0285,_0x5be2af){_0x3b0285=_0x3b0285-0x0;var _0x41ca88=_0xfdf7[_0x3b0285];return _0x41ca88;};'use strict';var utils=require('./utils');var logger=require(_0x7fdf('0x0'))(_0x7fdf('0x1'));exports[_0x7fdf('0x2')]=function(_0xeec3b5,_0x478bfd){return function(_0x36139e){try{logger[_0x7fdf('0x3')](_0x7fdf('0x4'),_0xeec3b5,utils['getMustacheRender'](_0x478bfd[0x0],this));_0x36139e[_0x7fdf('0x5')]();}catch(_0x3ea784){logger['error']('[%s][NOOP]\x20%s',_0xeec3b5,JSON[_0x7fdf('0x6')](_0x3ea784));_0x36139e[_0x7fdf('0x7')]();}};}; \ No newline at end of file +var _0xd145=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','routing'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd145,0xa7));var _0x5d14=function(_0x22892f,_0x5338c1){_0x22892f=_0x22892f-0x0;var _0x262da1=_0xd145[_0x22892f];return _0x262da1;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5d14('0x0'));exports[_0x5d14('0x1')]=function(_0x222e43,_0x5d0a15){return function(_0xc2e7ea){try{logger[_0x5d14('0x2')](_0x5d14('0x3'),_0x222e43,utils[_0x5d14('0x4')](_0x5d0a15[0x0],this));_0xc2e7ea[_0x5d14('0x5')]();}catch(_0x268e4f){logger[_0x5d14('0x6')](_0x5d14('0x3'),_0x222e43,JSON['stringify'](_0x268e4f));_0xc2e7ea[_0x5d14('0x7')]();}};}; \ 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 f5fdcc4..cf000c0 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 _0xb12b=['next','rrmemory','beepall','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','emit','clone','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','log','LOG\x20~\x20endRouting\x20~\x20queue','update','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END'];(function(_0x37dfd7,_0x2190b9){var _0x558007=function(_0x1d0bbb){while(--_0x1d0bbb){_0x37dfd7['push'](_0x37dfd7['shift']());}};_0x558007(++_0x2190b9);}(_0xb12b,0x134));var _0xbb12=function(_0x405487,_0x8a3abc){_0x405487=_0x405487-0x0;var _0x3954a1=_0xb12b[_0x405487];return _0x3954a1;};'use strict';var schema=require(_0xbb12('0x0'));var _=require(_0xbb12('0x1'));var util=require(_0xbb12('0x2'));var seqqueue=require(_0xbb12('0x3'));var moment=require(_0xbb12('0x4'));var Redis=require('ioredis');var config=require(_0xbb12('0x5'));var logger=require('../../../../config/logger')(_0xbb12('0x6'));var strategy=require(_0xbb12('0x7'));config[_0xbb12('0x8')]=_[_0xbb12('0x9')](config[_0xbb12('0x8')],{'host':_0xbb12('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb12('0x8')]));var attributes=['id',_0xbb12('0xb'),_0xbb12('0xc'),_0xbb12('0xd'),'from','joinAt'];function emit(_0x5e500f,_0x2a1696,_0xe44ba4){io['to'](_0x5e500f)[_0xbb12('0xe')](_0x2a1696,_0xe44ba4);}function emitChannelQueueInteraction(_0x294400,_0x223c9d,_0x53a970,_0xf15a91,_0x73d31f,_0x41c4a4,_0x18ef33,_0x2ea5ac){var _0x1baf32=_[_0xbb12('0xf')](_0x53a970);_0x1baf32['queue_id']=_0x2ea5ac;_0x1baf32[_0xbb12('0xd')]=_0x223c9d;_0x1baf32[_0xbb12('0xc')]=_0xf15a91;_0x1baf32['id']=_0x73d31f;if(_0x41c4a4){attributes[_0xbb12('0x10')](_[_0xbb12('0x11')](_0x294400)+_0xbb12('0x12'));_0x18ef33[util[_0xbb12('0x13')]('%sQueuesWaitingInteractions',_0x294400)][_0x73d31f]=_[_0xbb12('0x14')](_0x1baf32,attributes);}else{delete _0x18ef33[util[_0xbb12('0x13')](_0xbb12('0x15'),_0x294400)][_0x73d31f];}emit(util['format'](_0xbb12('0x16'),_0x294400,_0x223c9d),util[_0xbb12('0x13')](_0xbb12('0x17'),_0x294400,_0x41c4a4?_0xbb12('0x18'):'remove'),_[_0xbb12('0x14')](_0x1baf32,attributes));}var rpc={'openchannelQueueReport':require(_0xbb12('0x19')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xbb12('0x1a')),'faxQueueReport':require(_0xbb12('0x1b')),'whatsappQueueReport':require(_0xbb12('0x1c'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xbb12('0x1d'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x1c1a3b,_0x22364f,_0x3275ea,_0x4ec86c){if(_0x1c1a3b&&_0x22364f&&_0x3275ea){_0x22364f[_0xbb12('0x1e')]+=0x1;var _0x40ed26={'uniqueid':_0x1c1a3b,'from':_0x3275ea[_0xbb12('0x1f')]?_0x3275ea[_0xbb12('0x1f')]['from']:'','joinAt':moment()[_0xbb12('0x13')](_0xbb12('0x20')),'ContactId':_0x3275ea[_0xbb12('0x21')]?_0x3275ea[_0xbb12('0x21')]['id']:null,'ListId':_0x3275ea[_0xbb12('0x22')]?_0x3275ea['list']['id']:null};_0x40ed26[_[_0xbb12('0x23')](_0x3275ea[_0xbb12('0x24')])+_0xbb12('0x25')]=_0x22364f['id']||null;_0x40ed26[_[_0xbb12('0x23')](_0x3275ea[_0xbb12('0x24')])+'InteractionId']=_0x3275ea[_0xbb12('0x26')]?_0x3275ea[_0xbb12('0x26')]['id']:null;_0x40ed26[_['upperFirst'](_0x3275ea[_0xbb12('0x24')])+'MessageId']=_0x3275ea[_0xbb12('0x27')]?_0x3275ea[_0xbb12('0x27')]['id']:null;_0x40ed26[_[_0xbb12('0x23')](_0x3275ea[_0xbb12('0x24')])+(_0x3275ea[_0xbb12('0x24')]!==_0xbb12('0x28')?_0xbb12('0x29'):'WebsiteId')]=_0x3275ea['account']?_0x3275ea['account']['id']:null;logger[_0xbb12('0x2a')](util[_0xbb12('0x13')](_0xbb12('0x2b'),_0x1c1a3b,_0x22364f[_0xbb12('0x2c')]));emitChannelQueueInteraction(_0x3275ea[_0xbb12('0x24')],_0x22364f[_0xbb12('0x2c')],_0x40ed26,_0x3275ea['account']['name'],_0x3275ea[_0xbb12('0x27')]['id'],!![],_0x4ec86c,_0x22364f['id']);if(rpc[_0x3275ea[_0xbb12('0x24')]+_0xbb12('0x2d')]){return rpc[_0x3275ea[_0xbb12('0x24')]+_0xbb12('0x2d')][_0xbb12('0x2e')](_0x40ed26)[_0xbb12('0x2f')](function(_0x388196){logger[_0xbb12('0x30')](_0xbb12('0x31'));});}}}function stopRouting(_0x42896c,_0x3a0703,_0x3640d4,_0x4db869){if(_0x42896c&&_0x3a0703){_0x3a0703[_0xbb12('0x1e')]-=0x1;var _0x53502f={'leaveAt':moment()['format'](_0xbb12('0x20')),'acceptAt':moment()[_0xbb12('0x13')](_0xbb12('0x20')),'reason':'accepted'};logger['info'](util[_0xbb12('0x13')](_0xbb12('0x32'),_0x42896c,_0x3a0703[_0xbb12('0x2c')]));emitChannelQueueInteraction(_0x3640d4[_0xbb12('0x24')],_0x3a0703['name'],_0x3640d4[_0xbb12('0x1f')],_0x3640d4['account']['name'],_0x3640d4[_0xbb12('0x27')]['id'],![],_0x4db869,_0x3a0703['id']);if(rpc[_0x3640d4['channel']+'QueueReport']){return rpc[_0x3640d4['channel']+_0xbb12('0x2d')]['update'](_0x42896c,_0x53502f)['catch'](function(_0x25d272){logger['error'](_0xbb12('0x33'));});}}}function endRouting(_0x3ca7b8,_0x8e2af6,_0x5cee75,_0x2addca){if(_0x3ca7b8&&_0x8e2af6){_0x8e2af6[_0xbb12('0x1e')]-=0x1;var _0x2c001d={'leaveAt':moment()[_0xbb12('0x13')](_0xbb12('0x20')),'exitAt':moment()[_0xbb12('0x13')](_0xbb12('0x20')),'reason':_0xbb12('0x34')};logger[_0xbb12('0x2a')](util['format'](_0xbb12('0x35'),_0x3ca7b8,_0x8e2af6['name']));emitChannelQueueInteraction(_0x5cee75['channel'],_0x8e2af6[_0xbb12('0x2c')],_0x5cee75[_0xbb12('0x1f')],_0x5cee75['account'][_0xbb12('0x2c')],_0x5cee75[_0xbb12('0x27')]['id'],![],_0x2addca);console[_0xbb12('0x36')](_0xbb12('0x37'),_0x8e2af6);if(rpc[_0x5cee75[_0xbb12('0x24')]+'QueueReport']){return rpc[_0x5cee75[_0xbb12('0x24')]+'QueueReport'][_0xbb12('0x38')](_0x3ca7b8,_0x2c001d)[_0xbb12('0x2f')](function(_0x342f62){logger[_0xbb12('0x30')]('update\x20queue\x20report');});}}}function handleFindQueue(_0xe67900){return function(_0x211729){return _0x211729[_0xbb12('0x2c')][_0xbb12('0x39')]()===_0xe67900[_0xbb12('0x39')]();};}exports['consequence']=function(_0x393743,_0x56067d,_0x27fc85,_0x2c2173){return function(_0x33be62){try{var _0x5e4851={'name':_0x56067d[0x0],'timeout':_0x56067d[0x1]};var _0x14741d=queue[_0xbb12('0x0')](_0x5e4851,{'typecast':!![]});if(_0x14741d[_0xbb12('0x3a')]){logger[_0xbb12('0x30')](_0xbb12('0x3b'),_0x393743,_[_0xbb12('0x3c')](_0x14741d,_0xbb12('0x27'))[_0xbb12('0x3d')](',\x20'));_0x33be62[_0xbb12('0x3e')]();}else{var _0x131a5a=_[_0xbb12('0x3f')](_0x27fc85[_0x2c2173['channel']+'Queues'],handleFindQueue(_0x5e4851[_0xbb12('0x2c')]));console[_0xbb12('0x36')]('LOG\x20~\x20returnfunction\x20~\x20q',_0x131a5a);if(_0x131a5a){startRouting(_0x393743,_0x131a5a,_0x2c2173,_0x27fc85);var _0x2766d9=(_0x131a5a[_0xbb12('0x34')]||0xa)*0x3e8;var _0x39e795=(_0x5e4851[_0xbb12('0x34')]||0x14)*0x3e8;var _0x5f3bfe;if(_0x2766d9>_0x39e795){_0x39e795=_0x2766d9;}var _0x224129=seqqueue[_0xbb12('0x40')](_0x2766d9);_0x224129['id']=_0x393743;_0x224129[_0xbb12('0x41')]=_0x2766d9;_0x224129[_0xbb12('0x42')]=_0x39e795;_0x224129['channel']=_0x2c2173[_0xbb12('0x24')];_0x27fc85['rules'][_0x393743]['on']('end',function(){logger[_0xbb12('0x2a')](_0xbb12('0x43'),_0x393743);stopRouting(_0x393743,_0x131a5a,_0x2c2173,_0x27fc85);clearTimeout(_0x5f3bfe);_0x5f3bfe=undefined;_0x224129[_0xbb12('0x44')](!![]);if(_0x27fc85[_0xbb12('0x45')][_0x393743]){delete _0x27fc85[_0xbb12('0x45')][_0x393743];}_0x33be62['stop']();});_0x27fc85[_0xbb12('0x45')][_0x393743]['on'](_0xbb12('0x46'),function(){if(_0x27fc85[_0xbb12('0x45')][_0x393743]){delete _0x27fc85[_0xbb12('0x45')][_0x393743];}});_0x5f3bfe=setTimeout(function(){logger[_0xbb12('0x2a')](_0xbb12('0x47'),_0x393743);endRouting(_0x393743,_0x131a5a,_0x2c2173,_0x27fc85);clearTimeout(_0x5f3bfe);_0x224129['close'](!![]);_0x33be62[_0xbb12('0x48')]();},_0x39e795);switch(_0x131a5a['strategy']){case _0xbb12('0x49'):strategy['rrmemory'](_0x224129,_0x131a5a,_0x27fc85,_0x2c2173);break;default:strategy[_0xbb12('0x4a')](_0x224129,_0x131a5a,_0x27fc85,_0x2c2173);}}else{logger[_0xbb12('0x30')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x393743,_0x5e4851[_0xbb12('0x2c')]);_0x33be62[_0xbb12('0x3e')]();}}}catch(_0x42c05a){console[_0xbb12('0x36')](_0x42c05a);logger[_0xbb12('0x30')](_0xbb12('0x3b'),_0x393743,_0x42c05a[_0xbb12('0x4b')]);_0x33be62[_0xbb12('0x3e')]();}};}; \ No newline at end of file +var _0x3f84=['[%s][STOP:QUEUE][NAME:%s]','update','error','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','stop','find','log','LOG\x20~\x20returnfunction\x20~\x20q','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','defaults','redis','localhost','from','joinAt','clone','queue_id','queue','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report'];(function(_0x4f32cb,_0x451735){var _0x28bbd9=function(_0x2d0161){while(--_0x2d0161){_0x4f32cb['push'](_0x4f32cb['shift']());}};_0x28bbd9(++_0x451735);}(_0x3f84,0x15a));var _0x43f8=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x3f84[_0x34c027];return _0x47bff0;};'use strict';var schema=require(_0x43f8('0x0'));var _=require(_0x43f8('0x1'));var util=require(_0x43f8('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x43f8('0x3'));var Redis=require(_0x43f8('0x4'));var config=require(_0x43f8('0x5'));var logger=require(_0x43f8('0x6'))(_0x43f8('0x7'));var strategy=require('./strategy');config['redis']=_[_0x43f8('0x8')](config[_0x43f8('0x9')],{'host':_0x43f8('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43f8('0x9')]));var attributes=['id','queue_id','account','queue',_0x43f8('0xb'),_0x43f8('0xc')];function emit(_0x2f8c3c,_0x2c382d,_0x270fa4){io['to'](_0x2f8c3c)['emit'](_0x2c382d,_0x270fa4);}function emitChannelQueueInteraction(_0x1f5e6d,_0x1fe8b9,_0x8edb2,_0x18b333,_0x26f970,_0x505326,_0x5de765,_0x430e3d){var _0x437ec3=_[_0x43f8('0xd')](_0x8edb2);_0x437ec3[_0x43f8('0xe')]=_0x430e3d;_0x437ec3[_0x43f8('0xf')]=_0x1fe8b9;_0x437ec3[_0x43f8('0x10')]=_0x18b333;_0x437ec3['id']=_0x26f970;if(_0x505326){attributes[_0x43f8('0x11')](_[_0x43f8('0x12')](_0x1f5e6d)+_0x43f8('0x13'));_0x5de765[util[_0x43f8('0x14')](_0x43f8('0x15'),_0x1f5e6d)][_0x26f970]=_[_0x43f8('0x16')](_0x437ec3,attributes);}else{delete _0x5de765[util['format']('%sQueuesWaitingInteractions',_0x1f5e6d)][_0x26f970];}emit(util[_0x43f8('0x14')](_0x43f8('0x17'),_0x1f5e6d,_0x1fe8b9),util[_0x43f8('0x14')]('%s_queue_waiting_interaction:%s',_0x1f5e6d,_0x505326?_0x43f8('0x18'):_0x43f8('0x19')),_['pick'](_0x437ec3,attributes));}var rpc={'openchannelQueueReport':require(_0x43f8('0x1a')),'mailQueueReport':require(_0x43f8('0x1b')),'chatQueueReport':require(_0x43f8('0x1c')),'smsQueueReport':require(_0x43f8('0x1d')),'faxQueueReport':require(_0x43f8('0x1e')),'whatsappQueueReport':require(_0x43f8('0x1f'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x43f8('0x20')},'timeout':{'type':_0x43f8('0x21'),'message':_0x43f8('0x22')}});function startRouting(_0xbf454a,_0x224194,_0x2d33f1,_0x30d686){if(_0xbf454a&&_0x224194&&_0x2d33f1){_0x224194[_0x43f8('0x23')]+=0x1;var _0x356462={'uniqueid':_0xbf454a,'from':_0x2d33f1[_0x43f8('0x24')]?_0x2d33f1[_0x43f8('0x24')]['from']:'','joinAt':moment()['format'](_0x43f8('0x25')),'ContactId':_0x2d33f1[_0x43f8('0x26')]?_0x2d33f1[_0x43f8('0x26')]['id']:null,'ListId':_0x2d33f1[_0x43f8('0x27')]?_0x2d33f1[_0x43f8('0x27')]['id']:null};_0x356462[_[_0x43f8('0x28')](_0x2d33f1[_0x43f8('0x29')])+_0x43f8('0x2a')]=_0x224194['id']||null;_0x356462[_[_0x43f8('0x28')](_0x2d33f1[_0x43f8('0x29')])+'InteractionId']=_0x2d33f1[_0x43f8('0x2b')]?_0x2d33f1[_0x43f8('0x2b')]['id']:null;_0x356462[_[_0x43f8('0x28')](_0x2d33f1[_0x43f8('0x29')])+_0x43f8('0x2c')]=_0x2d33f1[_0x43f8('0x2d')]?_0x2d33f1[_0x43f8('0x2d')]['id']:null;_0x356462[_[_0x43f8('0x28')](_0x2d33f1[_0x43f8('0x29')])+(_0x2d33f1[_0x43f8('0x29')]!=='chat'?_0x43f8('0x2e'):_0x43f8('0x2f'))]=_0x2d33f1['account']?_0x2d33f1[_0x43f8('0x10')]['id']:null;logger[_0x43f8('0x30')](util[_0x43f8('0x14')](_0x43f8('0x31'),_0xbf454a,_0x224194[_0x43f8('0x32')]));emitChannelQueueInteraction(_0x2d33f1[_0x43f8('0x29')],_0x224194['name'],_0x356462,_0x2d33f1[_0x43f8('0x10')][_0x43f8('0x32')],_0x2d33f1[_0x43f8('0x2d')]['id'],!![],_0x30d686,_0x224194['id']);if(rpc[_0x2d33f1[_0x43f8('0x29')]+_0x43f8('0x33')]){return rpc[_0x2d33f1[_0x43f8('0x29')]+_0x43f8('0x33')]['create'](_0x356462)[_0x43f8('0x34')](function(_0x173fd7){logger['error'](_0x43f8('0x35'));});}}}function stopRouting(_0x4c993d,_0x331801,_0x216037,_0xaa467d){if(_0x4c993d&&_0x331801){_0x331801[_0x43f8('0x23')]-=0x1;var _0x5df4fb={'leaveAt':moment()[_0x43f8('0x14')](_0x43f8('0x25')),'acceptAt':moment()[_0x43f8('0x14')](_0x43f8('0x25')),'reason':'accepted'};logger[_0x43f8('0x30')](util[_0x43f8('0x14')](_0x43f8('0x36'),_0x4c993d,_0x331801[_0x43f8('0x32')]));emitChannelQueueInteraction(_0x216037['channel'],_0x331801[_0x43f8('0x32')],_0x216037[_0x43f8('0x24')],_0x216037['account'][_0x43f8('0x32')],_0x216037[_0x43f8('0x2d')]['id'],![],_0xaa467d,_0x331801['id']);if(rpc[_0x216037[_0x43f8('0x29')]+_0x43f8('0x33')]){return rpc[_0x216037[_0x43f8('0x29')]+_0x43f8('0x33')][_0x43f8('0x37')](_0x4c993d,_0x5df4fb)[_0x43f8('0x34')](function(_0x4f856f){logger[_0x43f8('0x38')]('update\x20queue\x20report');});}}}function endRouting(_0x202fba,_0x517a43,_0x4bdb82,_0x3d0b22){if(_0x202fba&&_0x517a43){_0x517a43[_0x43f8('0x23')]-=0x1;var _0x159423={'leaveAt':moment()[_0x43f8('0x14')](_0x43f8('0x25')),'exitAt':moment()[_0x43f8('0x14')](_0x43f8('0x25')),'reason':_0x43f8('0x39')};logger['info'](util[_0x43f8('0x14')](_0x43f8('0x3a'),_0x202fba,_0x517a43[_0x43f8('0x32')]));emitChannelQueueInteraction(_0x4bdb82[_0x43f8('0x29')],_0x517a43[_0x43f8('0x32')],_0x4bdb82['body'],_0x4bdb82[_0x43f8('0x10')]['name'],_0x4bdb82['message']['id'],![],_0x3d0b22);console['log']('LOG\x20~\x20endRouting\x20~\x20queue',_0x517a43);if(rpc[_0x4bdb82[_0x43f8('0x29')]+'QueueReport']){return rpc[_0x4bdb82[_0x43f8('0x29')]+'QueueReport']['update'](_0x202fba,_0x159423)['catch'](function(_0x56e946){logger[_0x43f8('0x38')](_0x43f8('0x3b'));});}}}function handleFindQueue(_0x5909ad){return function(_0x280e0e){return _0x280e0e[_0x43f8('0x32')][_0x43f8('0x3c')]()===_0x5909ad[_0x43f8('0x3c')]();};}exports[_0x43f8('0x3d')]=function(_0x2c7106,_0x430353,_0x3dc8ed,_0xa724a5){return function(_0x2f354f){try{var _0x21f4dd={'name':_0x430353[0x0],'timeout':_0x430353[0x1]};var _0x1020fe=queue[_0x43f8('0x0')](_0x21f4dd,{'typecast':!![]});if(_0x1020fe[_0x43f8('0x3e')]){logger[_0x43f8('0x38')]('[%s][QUEUE]\x20%s',_0x2c7106,_[_0x43f8('0x3f')](_0x1020fe,_0x43f8('0x2d'))['join'](',\x20'));_0x2f354f[_0x43f8('0x40')]();}else{var _0x35739c=_[_0x43f8('0x41')](_0x3dc8ed[_0xa724a5[_0x43f8('0x29')]+'Queues'],handleFindQueue(_0x21f4dd[_0x43f8('0x32')]));console[_0x43f8('0x42')](_0x43f8('0x43'),_0x35739c);if(_0x35739c){startRouting(_0x2c7106,_0x35739c,_0xa724a5,_0x3dc8ed);var _0x7e9446=(_0x35739c['timeout']||0xa)*0x3e8;var _0xb39dd1=(_0x21f4dd[_0x43f8('0x39')]||0x14)*0x3e8;var _0xca2dfc;if(_0x7e9446>_0xb39dd1){_0xb39dd1=_0x7e9446;}var _0x44b528=seqqueue['createQueue'](_0x7e9446);_0x44b528['id']=_0x2c7106;_0x44b528[_0x43f8('0x44')]=_0x7e9446;_0x44b528[_0x43f8('0x45')]=_0xb39dd1;_0x44b528[_0x43f8('0x29')]=_0xa724a5[_0x43f8('0x29')];_0x3dc8ed[_0x43f8('0x46')][_0x2c7106]['on'](_0x43f8('0x47'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2c7106);stopRouting(_0x2c7106,_0x35739c,_0xa724a5,_0x3dc8ed);clearTimeout(_0xca2dfc);_0xca2dfc=undefined;_0x44b528[_0x43f8('0x48')](!![]);if(_0x3dc8ed['rules'][_0x2c7106]){delete _0x3dc8ed[_0x43f8('0x46')][_0x2c7106];}_0x2f354f[_0x43f8('0x40')]();});_0x3dc8ed[_0x43f8('0x46')][_0x2c7106]['on']('complete',function(){if(_0x3dc8ed[_0x43f8('0x46')][_0x2c7106]){delete _0x3dc8ed['rules'][_0x2c7106];}});_0xca2dfc=setTimeout(function(){logger[_0x43f8('0x30')](_0x43f8('0x49'),_0x2c7106);endRouting(_0x2c7106,_0x35739c,_0xa724a5,_0x3dc8ed);clearTimeout(_0xca2dfc);_0x44b528[_0x43f8('0x48')](!![]);_0x2f354f[_0x43f8('0x4a')]();},_0xb39dd1);switch(_0x35739c[_0x43f8('0x4b')]){case _0x43f8('0x4c'):strategy['rrmemory'](_0x44b528,_0x35739c,_0x3dc8ed,_0xa724a5);break;default:strategy['beepall'](_0x44b528,_0x35739c,_0x3dc8ed,_0xa724a5);}}else{logger[_0x43f8('0x38')](_0x43f8('0x4d'),_0x2c7106,_0x21f4dd[_0x43f8('0x32')]);_0x2f354f['stop']();}}}catch(_0x53c058){console[_0x43f8('0x42')](_0x53c058);logger['error'](_0x43f8('0x4e'),_0x2c7106,_0x53c058[_0x43f8('0x4f')]);_0x2f354f[_0x43f8('0x40')]();}};}; \ 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 21dbf4f..7535422 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 _0x2123=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','showNotification','writeLog','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','busyQueue','removeWaitingNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','bind','timeout','handleTimeout','drained','handleDrained','prototype','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime'];(function(_0x3ad8a1,_0x364e7e){var _0x537403=function(_0x3a7ec1){while(--_0x3a7ec1){_0x3ad8a1['push'](_0x3ad8a1['shift']());}};_0x537403(++_0x364e7e);}(_0x2123,0x190));var _0x3212=function(_0x45891c,_0x3b67d7){_0x45891c=_0x45891c-0x0;var _0x396fb2=_0x2123[_0x45891c];return _0x396fb2;};'use strict';var _=require(_0x3212('0x0'));var uuid=require(_0x3212('0x1'));var util=require(_0x3212('0x2'));var logger=require(_0x3212('0x3'))(_0x3212('0x4'));var Agent=function(_0x2ff863,_0x8c047,_0x2e951f,_0x304f80){this[_0x3212('0x5')]=uuid['v4']();this[_0x3212('0x6')]=_0x2ff863;this[_0x3212('0x7')]=_0x8c047;this['realtime']=_0x2e951f;this[_0x3212('0x4')]=_0x304f80;this[_0x3212('0x6')][_0x3212('0x8')](this['handleRun'][_0x3212('0x9')](this),this['handleTimeout'][_0x3212('0x9')](this));this[_0x3212('0x6')]['on'](_0x3212('0xa'),this[_0x3212('0xb')]['bind'](this));this['squeue']['on'](_0x3212('0xc'),this[_0x3212('0xd')][_0x3212('0x9')](this));};Agent[_0x3212('0xe')][_0x3212('0x8')]=function(){this[_0x3212('0x6')][_0x3212('0x8')](this[_0x3212('0xf')][_0x3212('0x9')](this),this[_0x3212('0xb')][_0x3212('0x9')](this));};Agent[_0x3212('0xe')][_0x3212('0xd')]=function(){this[_0x3212('0xb')](!![]);};Agent[_0x3212('0xe')][_0x3212('0xf')]=function(){logger[_0x3212('0x10')](_0x3212('0x11'),this[_0x3212('0x6')]['id'],this[_0x3212('0x7')]['id']);if(_[_0x3212('0x12')](this[_0x3212('0x13')]['agents'][this[_0x3212('0x7')]['id']])){logger[_0x3212('0x10')](_0x3212('0x14'),this[_0x3212('0x6')]['id'],this[_0x3212('0x7')]['id']);setTimeout(this[_0x3212('0x8')][_0x3212('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x3212('0x15')](this['squeue']['id'],this[_0x3212('0x13')][_0x3212('0x16')][this[_0x3212('0x7')]['id']],this[_0x3212('0x6')][_0x3212('0x17')],![])){this['realtime'][_0x3212('0x16')][this[_0x3212('0x7')]['id']]['busy']=!![];this[_0x3212('0x13')][_0x3212('0x16')][this[_0x3212('0x7')]['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this[_0x3212('0x13')],this[_0x3212('0x4')],this[_0x3212('0x7')],this[_0x3212('0x6')][_0x3212('0x17')]);util[_0x3212('0x18')](this['notificationId'],this['squeue']['id'],this[_0x3212('0x13')]['agents'][this[_0x3212('0x7')]['id']],null,this[_0x3212('0x4')]);util[_0x3212('0x19')](this['squeue']['id'],this[_0x3212('0x13')][_0x3212('0x16')][this[_0x3212('0x7')]['id']],'RINGING'+(this[_0x3212('0x4')][_0x3212('0x1a')]?_0x3212('0x1b'):''));}else{logger[_0x3212('0x10')](_0x3212('0x1c'),this[_0x3212('0x6')]['id'],this[_0x3212('0x7')]['id']);setTimeout(this[_0x3212('0x8')][_0x3212('0x9')](this),0x3e8);}}};Agent[_0x3212('0xe')][_0x3212('0xb')]=function(_0x3c0b9b){if(_['isNil'](this[_0x3212('0x13')][_0x3212('0x16')][this[_0x3212('0x7')]['id']])){return logger[_0x3212('0x10')](_0x3212('0x14'),this[_0x3212('0x6')]['id'],this[_0x3212('0x7')]['id']);}else{logger['debug'](_0x3212('0x1d'),this['squeue']['id'],this[_0x3212('0x7')]['id']);util['hideNotification'](this[_0x3212('0x5')],this['squeue']['id'],this['realtime'][_0x3212('0x16')][this['agent']['id']],null,this[_0x3212('0x4')]);this[_0x3212('0x13')][_0x3212('0x16')][this['agent']['id']][_0x3212('0x1e')]=![];this[_0x3212('0x13')][_0x3212('0x16')][this['agent']['id']][_0x3212('0x1f')]=undefined;util[_0x3212('0x20')](this[_0x3212('0x13')],this[_0x3212('0x4')],this[_0x3212('0x7')],this['squeue'][_0x3212('0x17')]);util[_0x3212('0x19')](this[_0x3212('0x6')]['id'],this['realtime'][_0x3212('0x16')][this[_0x3212('0x7')]['id']],_0x3c0b9b?_0x3212('0x21'):_0x3212('0x22'));}if(!_0x3c0b9b){setTimeout(this['push'][_0x3212('0x9')](this),0x3e8);}};function agent(_0x3f157c,_0xf5d848,_0x39ffd0,_0x5ae0cc){return new Agent(_0x3f157c,_0xf5d848,_0x39ffd0,_0x5ae0cc);}module['exports']=agent; \ No newline at end of file +var _0x5ad3=['TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','handleRun','bind','handleTimeout','handleDrained','push','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','forcedOwnership','channel','busyQueue','saveWaitingNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','removeWaitingNotification','STOP'];(function(_0x415583,_0x530e91){var _0x214b5d=function(_0xba23f2){while(--_0xba23f2){_0x415583['push'](_0x415583['shift']());}};_0x214b5d(++_0x530e91);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x20eacd,_0x2394e2){_0x20eacd=_0x20eacd-0x0;var _0x57942a=_0x5ad3[_0x20eacd];return _0x57942a;};'use strict';var _=require(_0x35ad('0x0'));var uuid=require(_0x35ad('0x1'));var util=require(_0x35ad('0x2'));var logger=require(_0x35ad('0x3'))('routing');var Agent=function(_0x468072,_0x373228,_0xc77352,_0x69a0b3){this[_0x35ad('0x4')]=uuid['v4']();this[_0x35ad('0x5')]=_0x468072;this[_0x35ad('0x6')]=_0x373228;this[_0x35ad('0x7')]=_0xc77352;this[_0x35ad('0x8')]=_0x69a0b3;this[_0x35ad('0x5')]['push'](this[_0x35ad('0x9')][_0x35ad('0xa')](this),this[_0x35ad('0xb')]['bind'](this));this[_0x35ad('0x5')]['on']('timeout',this['handleTimeout'][_0x35ad('0xa')](this));this[_0x35ad('0x5')]['on']('drained',this[_0x35ad('0xc')][_0x35ad('0xa')](this));};Agent['prototype']['push']=function(){this[_0x35ad('0x5')][_0x35ad('0xd')](this['handleRun'][_0x35ad('0xa')](this),this[_0x35ad('0xb')]['bind'](this));};Agent['prototype'][_0x35ad('0xc')]=function(){this[_0x35ad('0xb')](!![]);};Agent[_0x35ad('0xe')]['handleRun']=function(){logger[_0x35ad('0xf')](_0x35ad('0x10'),this['squeue']['id'],this[_0x35ad('0x6')]['id']);if(_['isNil'](this['realtime'][_0x35ad('0x11')][this[_0x35ad('0x6')]['id']])){logger[_0x35ad('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x35ad('0x5')]['id'],this[_0x35ad('0x6')]['id']);setTimeout(this[_0x35ad('0xd')][_0x35ad('0xa')](this),0x3e8);}else{if(this[_0x35ad('0x8')][_0x35ad('0x12')]||util['isAgentAvailable'](this[_0x35ad('0x5')]['id'],this[_0x35ad('0x7')]['agents'][this['agent']['id']],this[_0x35ad('0x5')][_0x35ad('0x13')],![])){this['realtime'][_0x35ad('0x11')][this[_0x35ad('0x6')]['id']]['busy']=!![];this[_0x35ad('0x7')][_0x35ad('0x11')][this[_0x35ad('0x6')]['id']][_0x35ad('0x14')]=undefined;util[_0x35ad('0x15')](this[_0x35ad('0x7')],this[_0x35ad('0x8')],this[_0x35ad('0x6')],this[_0x35ad('0x5')][_0x35ad('0x13')]);util['showNotification'](this[_0x35ad('0x4')],this[_0x35ad('0x5')]['id'],this['realtime'][_0x35ad('0x11')][this[_0x35ad('0x6')]['id']],null,this[_0x35ad('0x8')]);util[_0x35ad('0x16')](this[_0x35ad('0x5')]['id'],this['realtime'][_0x35ad('0x11')][this[_0x35ad('0x6')]['id']],_0x35ad('0x17')+(this[_0x35ad('0x8')][_0x35ad('0x12')]?_0x35ad('0x18'):''));}else{logger[_0x35ad('0xf')](_0x35ad('0x19'),this['squeue']['id'],this[_0x35ad('0x6')]['id']);setTimeout(this[_0x35ad('0xd')][_0x35ad('0xa')](this),0x3e8);}}};Agent[_0x35ad('0xe')][_0x35ad('0xb')]=function(_0x481803){if(_['isNil'](this[_0x35ad('0x7')]['agents'][this[_0x35ad('0x6')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);}else{logger[_0x35ad('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x35ad('0x6')]['id']);util['hideNotification'](this[_0x35ad('0x4')],this['squeue']['id'],this[_0x35ad('0x7')]['agents'][this[_0x35ad('0x6')]['id']],null,this['routing']);this[_0x35ad('0x7')][_0x35ad('0x11')][this[_0x35ad('0x6')]['id']]['busy']=![];this[_0x35ad('0x7')][_0x35ad('0x11')][this[_0x35ad('0x6')]['id']][_0x35ad('0x14')]=undefined;util[_0x35ad('0x1a')](this['realtime'],this['routing'],this[_0x35ad('0x6')],this[_0x35ad('0x5')][_0x35ad('0x13')]);util[_0x35ad('0x16')](this['squeue']['id'],this[_0x35ad('0x7')][_0x35ad('0x11')][this[_0x35ad('0x6')]['id']],_0x481803?_0x35ad('0x1b'):_0x35ad('0x1c'));}if(!_0x481803){setTimeout(this[_0x35ad('0xd')]['bind'](this),0x3e8);}};function agent(_0x58250d,_0x658444,_0x2800e7,_0x1d24bb){return new Agent(_0x58250d,_0x658444,_0x2800e7,_0x1d24bb);}module[_0x35ad('0x1d')]=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 2dfa583..d17b17e 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 _0x67e3=['drained','handleDrained','prototype','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','writeLog','RINGING','busyQueue','name','saveWaitingNotification','channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','busy','removeWaitingNotification','exports','lodash','uuid','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout'];(function(_0xce04e,_0xd73f6a){var _0x2fdbfa=function(_0x11daf7){while(--_0x11daf7){_0xce04e['push'](_0xce04e['shift']());}};_0x2fdbfa(++_0xd73f6a);}(_0x67e3,0x80));var _0x367e=function(_0x1d8795,_0x17d795){_0x1d8795=_0x1d8795-0x0;var _0x52c9bd=_0x67e3[_0x1d8795];return _0x52c9bd;};'use strict';var _=require(_0x367e('0x0'));var uuid=require(_0x367e('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x367e('0x2'));var Beepall=function(_0x25b460,_0x23dfe5,_0x29c073,_0x36ba18){this[_0x367e('0x3')]=uuid['v4']();this[_0x367e('0x4')]=_0x25b460;this[_0x367e('0x5')]=_0x23dfe5;this[_0x367e('0x6')]=_0x29c073;this[_0x367e('0x2')]=_0x36ba18;this[_0x367e('0x4')][_0x367e('0x7')](this[_0x367e('0x8')][_0x367e('0x9')](this),this[_0x367e('0xa')]['bind'](this));this[_0x367e('0x4')]['on'](_0x367e('0xb'),this['handleTimeout'][_0x367e('0x9')](this));this[_0x367e('0x4')]['on'](_0x367e('0xc'),this[_0x367e('0xd')]['bind'](this));};Beepall[_0x367e('0xe')][_0x367e('0x7')]=function(){this['squeue'][_0x367e('0x7')](this[_0x367e('0x8')][_0x367e('0x9')](this),this['handleTimeout']['bind'](this));};Beepall[_0x367e('0xe')][_0x367e('0xd')]=function(){this[_0x367e('0xa')](!![]);};Beepall[_0x367e('0xe')][_0x367e('0x8')]=function(){var _0x58e148=!![];if(!_[_0x367e('0xf')](this[_0x367e('0x5')])&&!_['isNil'](this[_0x367e('0x5')][_0x367e('0x10')])&&this[_0x367e('0x5')]['Agents'][_0x367e('0x11')]>0x0){for(var _0x1ad6ce=0x0,_0x29ba17;_0x1ad6ce0x0){for(var _0x40aac8=0x0,_0x4df1a4;_0x40aac80x0&&_0xa54199[_0x5f00cf+_0x1ef0('0x25')]>=_0xa54199[_0x5f00cf+_0x1ef0('0x24')]){writeLog(_0x446f22,_0xa54199,_0x5f00cf[_0x1ef0('0x26')]()+_0x1ef0('0x27'));return![];}}return!![];};exports[_0x1ef0('0x28')]=function(_0x55a102,_0x1a578c,_0x4ae4d2,_0x5acfa0,_0x36d37e){return sendNotification(!![],_0x55a102,_0x1a578c,_0x4ae4d2,_0x5acfa0,_0x36d37e);};exports[_0x1ef0('0x29')]=function(_0x811f02,_0x5ea89e,_0x263e7c,_0x4882fd,_0x5c4a3b){return sendNotification(![],_0x811f02,_0x5ea89e,_0x263e7c,_0x4882fd,_0x5c4a3b);};exports[_0x1ef0('0x2a')]=function(_0x38ae2b,_0x3e444e,_0xf7e065){var _0x236931=_0x3e444e['interaction'][_0x1ef0('0x2b')];if(!_0x236931&&_0xf7e065){_0x236931=_0xf7e065['id'];}var _0x440573=_[_0x1ef0('0x2c')](_0x38ae2b[_0x3e444e[_0x1ef0('0x2d')]+_0x1ef0('0x2e')],function(_0x5321b7){var _0x2d6981=_[_0x1ef0('0x2f')](_0x3e444e[_0x1ef0('0x2d')])+_0x1ef0('0x30');return _0x5321b7[_0x2d6981]===_0x3e444e[_0x1ef0('0x31')]['id'];});if(!_0x440573&&_0x236931){_0x440573=_['some'](_0x38ae2b[_0x1ef0('0x32')][_0x236931][_0x3e444e[_0x1ef0('0x2d')]+_0x1ef0('0x33')],function(_0x5b0e51){return _0x5b0e51['id']===_0x3e444e[_0x1ef0('0x31')]['id'];});}return _0x440573;};exports[_0x1ef0('0x34')]=function(_0x510798,_0x4e3078,_0x42e7ac,_0x143406){_0x510798[_0x1ef0('0x32')][_0x42e7ac['id']][_0x143406+'WaitingInteractions'][_0x4e3078[_0x1ef0('0x19')]['id']]={'id':_0x4e3078[_0x1ef0('0x31')]['id']};};exports['removeWaitingNotification']=function(_0x3e8465,_0x57f938,_0x4e087b,_0x3e954e){delete _0x3e8465[_0x1ef0('0x32')][_0x4e087b['id']][_0x3e954e+_0x1ef0('0x33')][_0x57f938['message']['id']];};exports[_0x1ef0('0x35')]=writeLog; \ No newline at end of file +var _0x613a=['remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','channel','QueuesWaitingInteractions','capitalize','InteractionId','some','agents','WaitingInteractions','saveWaitingNotification','message','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','emit','save'];(function(_0xf3a877,_0x410287){var _0x48b0a3=function(_0x9ae212){while(--_0x9ae212){_0xf3a877['push'](_0xf3a877['shift']());}};_0x48b0a3(++_0x410287);}(_0x613a,0x181));var _0xa613=function(_0x204d1f,_0x40ed37){_0x204d1f=_0x204d1f-0x0;var _0x4ab54e=_0x613a[_0x204d1f];return _0x4ab54e;};'use strict';var _=require(_0xa613('0x0'));var util=require(_0xa613('0x1'));var utils=require(_0xa613('0x2'));var Redis=require(_0xa613('0x3'));var config=require(_0xa613('0x4'));var logger=require(_0xa613('0x5'))(_0xa613('0x6'));config[_0xa613('0x7')]=_[_0xa613('0x8')](config[_0xa613('0x7')],{'host':_0xa613('0x9'),'port':0x18eb});var io=require(_0xa613('0xa'))(new Redis(config[_0xa613('0x7')]));function sendNotification(_0x300e5c,_0x346209,_0x5c281e,_0x21b5cd,_0x5c771e,_0x581425){io['to'](util[_0xa613('0xb')](_0xa613('0xc'),_0x21b5cd[_0xa613('0xd')]))['emit'](_0xa613('0xe'),_0x21b5cd);var _0x512032=_0x581425||{};var _0x2e9394=_0x5c281e[_0xa613('0xf')]('.');var _0x57069b={'uniqueid':_0x346209,'channel':_0x2e9394[0x0],'id':_0x2e9394[0x1],'title':_0x2e9394[0x0]+_0xa613('0x10'),'interactionId':_0x2e9394[0x2],'queue':_0x5c771e?_0x5c771e[_0xa613('0xd')]:null,'sound':_0x512032[_0xa613('0x11')][_0xa613('0x12')],'shake':_0x512032[_0xa613('0x11')][_0xa613('0x13')]};try{if(!_0x512032[_0xa613('0x14')]){_0x512032[_0xa613('0x14')]={};}if(_0x5c771e){_0x512032['body']['queue']=_0x5c771e;}else if(_0x512032[_0xa613('0x14')][_0xa613('0x15')]){delete _0x512032['body'][_0xa613('0x15')];}_0x57069b[_0xa613('0x16')]=utils[_0xa613('0x17')](_0x512032[_0xa613('0x11')]['notificationTemplate'],_0x512032);}catch(_0x1a2526){_0x57069b['msg']=_0xa613('0x18');logger[_0xa613('0x19')](util[_0xa613('0xb')]('[%s][QUEUE]\x20%s',_0x346209,_0x1a2526['message']));}io['to'](util['format'](_0xa613('0xc'),_0x21b5cd['name']))[_0xa613('0x1a')](util[_0xa613('0xb')]('notification:%s',_0x300e5c?_0xa613('0x1b'):_0xa613('0x1c')),_0x57069b);}function writeLog(_0x59b71a,_0x389039,_0x2ff04f){return logger[_0xa613('0x1d')](util[_0xa613('0xb')](_0xa613('0x1e'),_0x59b71a,_0x389039[_0xa613('0xd')],_0x2ff04f));}exports[_0xa613('0x1f')]=function(_0x2e4f26,_0x8b4f76,_0x438a75,_0x336da2){if(_0x8b4f76[_0xa613('0x20')]){writeLog(_0x2e4f26,_0x8b4f76,_0xa613('0x21'));return![];}if(!_0x8b4f76[_0xa613('0x22')]){writeLog(_0x2e4f26,_0x8b4f76,_0xa613('0x23'));return![];}if(_0x8b4f76[_0x438a75+_0xa613('0x24')]){writeLog(_0x2e4f26,_0x8b4f76,_0xa613('0x25'));return![];}if(_0x336da2&&_0x8b4f76[_0xa613('0x26')](_0x438a75+_0xa613('0x27'))&&_0x8b4f76['hasOwnProperty'](_0x438a75+_0xa613('0x28'))){if(_0x8b4f76[_0x438a75+_0xa613('0x27')]>0x0&&_0x8b4f76[_0x438a75+_0xa613('0x28')]>=_0x8b4f76[_0x438a75+_0xa613('0x27')]){writeLog(_0x2e4f26,_0x8b4f76,_0x438a75[_0xa613('0x29')]()+_0xa613('0x2a'));return![];}}return!![];};exports[_0xa613('0x2b')]=function(_0x4f22f7,_0x2e8879,_0x217fd3,_0xb26cc6,_0x17fbd7){return sendNotification(!![],_0x4f22f7,_0x2e8879,_0x217fd3,_0xb26cc6,_0x17fbd7);};exports[_0xa613('0x2c')]=function(_0xada7e8,_0x21b3da,_0x3ac3ec,_0x4c987e,_0x37552d){return sendNotification(![],_0xada7e8,_0x21b3da,_0x3ac3ec,_0x4c987e,_0x37552d);};exports[_0xa613('0x2d')]=function(_0x411a55,_0x492d31,_0x14ae3b){var _0x9bf38e=_0x492d31[_0xa613('0x2e')][_0xa613('0x2f')];if(!_0x9bf38e&&_0x14ae3b){_0x9bf38e=_0x14ae3b['id'];}var _0x567b4c=_['some'](_0x411a55[_0x492d31[_0xa613('0x30')]+_0xa613('0x31')],function(_0x5cbb00){var _0x1ee0da=_[_0xa613('0x32')](_0x492d31[_0xa613('0x30')])+_0xa613('0x33');return _0x5cbb00[_0x1ee0da]===_0x492d31[_0xa613('0x2e')]['id'];});if(!_0x567b4c&&_0x9bf38e){_0x567b4c=_[_0xa613('0x34')](_0x411a55[_0xa613('0x35')][_0x9bf38e][_0x492d31['channel']+_0xa613('0x36')],function(_0x4ac8b6){return _0x4ac8b6['id']===_0x492d31[_0xa613('0x2e')]['id'];});}return _0x567b4c;};exports[_0xa613('0x37')]=function(_0xf20540,_0x454be4,_0x2c0667,_0x3c533d){_0xf20540[_0xa613('0x35')][_0x2c0667['id']][_0x3c533d+_0xa613('0x36')][_0x454be4[_0xa613('0x38')]['id']]={'id':_0x454be4[_0xa613('0x2e')]['id']};};exports[_0xa613('0x39')]=function(_0x302f52,_0x5b46cf,_0x1b7e8b,_0x16ee54){delete _0x302f52['agents'][_0x1b7e8b['id']][_0x16ee54+'WaitingInteractions'][_0x5b46cf[_0xa613('0x38')]['id']];};exports[_0xa613('0x3a')]=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 192c979..c10422e 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 _0xcfe5=['stringify','validate','shelljs','string','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','isNil','[%s][SYSTEM]\x20no\x20variable','isObject'];(function(_0x2abc42,_0x199171){var _0x4c6d84=function(_0x3ea8f0){while(--_0x3ea8f0){_0x2abc42['push'](_0x2abc42['shift']());}};_0x4c6d84(++_0x199171);}(_0xcfe5,0x1c9));var _0x5cfe=function(_0x170a07,_0x4917dc){_0x170a07=_0x170a07-0x0;var _0x4525f7=_0xcfe5[_0x170a07];return _0x4525f7;};'use strict';var schema=require(_0x5cfe('0x0'));var sh=require(_0x5cfe('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x5cfe('0x2'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x5cfe('0x3')]=function(_0x78cec3,_0xd1f15e){return function(_0x585d10){try{var _0x26bdda={'command':_0xd1f15e[0x0]};var _0x4a33f0=system[_0x5cfe('0x0')](_0x26bdda,{'typecast':!![]});if(_0x4a33f0['length']){logger[_0x5cfe('0x4')](_0x5cfe('0x5'),_0x78cec3,_[_0x5cfe('0x6')](_0x4a33f0,_0x5cfe('0x7'))[_0x5cfe('0x8')](',\x20'));logger[_0x5cfe('0x9')](_0x5cfe('0xa'),_0x78cec3);_0x585d10[_0x5cfe('0xb')]();}else{var _0x2c0d78=this;var _0x4788da=utils[_0x5cfe('0xc')](_0xd1f15e[0x0],this);logger[_0x5cfe('0x9')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x78cec3,_0x4788da);sh[_0x5cfe('0xd')](_[_0x5cfe('0xe')](_0x4788da),function(_0x50b35c,_0x27c7df){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x78cec3,_0x50b35c);if(_0x50b35c==0x0){var _0x1d0912=_0x27c7df['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x5cfe('0xf')](_0xd1f15e[0x1])||_['isEmpty'](_0xd1f15e[0x1])){logger['info'](_0x5cfe('0x10'),_0x78cec3);_0x2c0d78['body'][_0xd1f15e[0x1]]=_0x1d0912;}else{logger[_0x5cfe('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x78cec3,_0xd1f15e[0x1],_0x1d0912);_0x2c0d78['body'][_0xd1f15e[0x1]]=_0x1d0912;}}_0x585d10[_0x5cfe('0xb')]();});}}catch(_0x5bab28){logger['error'](_0x5cfe('0x5'),_0x78cec3,_[_0x5cfe('0x11')](_0x5bab28)?JSON[_0x5cfe('0x12')](_0x5bab28):_0x5bab28);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x78cec3);_0x585d10[_0x5cfe('0xb')]();}};}; \ No newline at end of file +var _0x155e=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','stringify','validate','shelljs','lodash','../../../../config/logger','routing'];(function(_0x259ee8,_0x579dda){var _0x2c662d=function(_0x524f4d){while(--_0x524f4d){_0x259ee8['push'](_0x259ee8['shift']());}};_0x2c662d(++_0x579dda);}(_0x155e,0x9c));var _0xe155=function(_0x34f087,_0x2cf379){_0x34f087=_0x34f087-0x0;var _0x268ea9=_0x155e[_0x34f087];return _0x268ea9;};'use strict';var schema=require(_0xe155('0x0'));var sh=require(_0xe155('0x1'));var _=require(_0xe155('0x2'));var utils=require('./utils');var logger=require(_0xe155('0x3'))(_0xe155('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xe155('0x5')}});exports[_0xe155('0x6')]=function(_0x5ab64b,_0x9616ed){return function(_0x27c3b){try{var _0x4a34ea={'command':_0x9616ed[0x0]};var _0x1b3deb=system[_0xe155('0x0')](_0x4a34ea,{'typecast':!![]});if(_0x1b3deb[_0xe155('0x7')]){logger[_0xe155('0x8')]('[%s][SYSTEM]\x20%s',_0x5ab64b,_[_0xe155('0x9')](_0x1b3deb,'message')[_0xe155('0xa')](',\x20'));logger[_0xe155('0xb')](_0xe155('0xc'),_0x5ab64b);_0x27c3b[_0xe155('0xd')]();}else{var _0x5d7377=this;var _0x1e8e9e=utils['getMustacheRender'](_0x9616ed[0x0],this);logger['info'](_0xe155('0xe'),_0x5ab64b,_0x1e8e9e);sh[_0xe155('0xf')](_[_0xe155('0x10')](_0x1e8e9e),function(_0x232e9a,_0x2e7684){logger[_0xe155('0xb')](_0xe155('0x11'),_0x5ab64b,_0x232e9a);if(_0x232e9a==0x0){var _0x46bee8=_0x2e7684[_0xe155('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x9616ed[0x1])||_[_0xe155('0x13')](_0x9616ed[0x1])){logger[_0xe155('0xb')](_0xe155('0x14'),_0x5ab64b);_0x5d7377[_0xe155('0x15')][_0x9616ed[0x1]]=_0x46bee8;}else{logger[_0xe155('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5ab64b,_0x9616ed[0x1],_0x46bee8);_0x5d7377[_0xe155('0x15')][_0x9616ed[0x1]]=_0x46bee8;}}_0x27c3b[_0xe155('0xd')]();});}}catch(_0x3fb0fd){logger[_0xe155('0x8')]('[%s][SYSTEM]\x20%s',_0x5ab64b,_['isObject'](_0x3fb0fd)?JSON[_0xe155('0x16')](_0x3fb0fd):_0x3fb0fd);logger['info'](_0xe155('0xc'),_0x5ab64b);_0x27c3b['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 7ba1fca..164fac0 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 _0x526b=['isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','error','[%s][TAG]\x20%s'];(function(_0x38d74a,_0x50c071){var _0x2f7a94=function(_0x1925be){while(--_0x1925be){_0x38d74a['push'](_0x38d74a['shift']());}};_0x2f7a94(++_0x50c071);}(_0x526b,0xf4));var _0xb526=function(_0x59b50e,_0x39ca6e){_0x59b50e=_0x59b50e-0x0;var _0x5664fd=_0x526b[_0x59b50e];return _0x5664fd;};'use strict';var schema=require(_0xb526('0x0'));var _=require(_0xb526('0x1'));var rpc={'chatInteraction':require(_0xb526('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb526('0x3')),'mailInteraction':require(_0xb526('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xb526('0x5'))(_0xb526('0x6'));var tag=schema({'tag':{'type':_0xb526('0x7'),'required':!![],'message':_0xb526('0x8')}});exports[_0xb526('0x9')]=function(_0x4c6239,_0x27d71b,_0x5c5148,_0x1b0624){return function(_0x3a25ba){try{var _0x339cfb={'tag':_0x27d71b[0x0]};var _0x58681c=tag['validate'](_0x339cfb,{'typecast':!![]});if(_0x58681c[_0xb526('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x4c6239,_[_0xb526('0xb')](_0x58681c,_0xb526('0xc'))[_0xb526('0xd')](',\x20'));logger[_0xb526('0xe')](_0xb526('0xf'),_0x4c6239);_0x3a25ba[_0xb526('0x10')]();}else{var _0x2cd0b9={'ids':[_0x27d71b[0x0]]};if(rpc[_0x1b0624[_0xb526('0x11')]+'Interaction']){rpc[_0x1b0624['channel']+_0xb526('0x12')]['addTags'](_0x1b0624['interaction']['id'],_0x2cd0b9)['then'](function(_0x14091b){logger['info'](_0xb526('0x13'),_0x4c6239,_0x27d71b[0x1],_0x1b0624[_0xb526('0x11')],_0x1b0624[_0xb526('0x14')]['id']);})[_0xb526('0x15')](function(_0x46b249){logger['error']('[%s][TAG]\x20%s',_0x4c6239,JSON[_0xb526('0x16')](_0x46b249));logger['info'](_0xb526('0xf'),_0x4c6239);})[_0xb526('0x17')](function(){_0x3a25ba[_0xb526('0x10')]();});}}}catch(_0x2941cd){logger[_0xb526('0x18')](_0xb526('0x19'),_0x4c6239,_[_0xb526('0x1a')](_0x2941cd)?JSON[_0xb526('0x16')](_0x2941cd):_0x2941cd);logger[_0xb526('0xe')](_0xb526('0xf'),_0x4c6239);_0x3a25ba[_0xb526('0x10')]();}};}; \ No newline at end of file +var _0x9b0b=['Interaction','channel','addTags','interaction','error','stringify','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','number','consequence','[%s][TAG]\x20%s','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x18e0e7,_0xafa137){var _0x4c758d=function(_0x52252a){while(--_0x52252a){_0x18e0e7['push'](_0x18e0e7['shift']());}};_0x4c758d(++_0xafa137);}(_0x9b0b,0x10c));var _0xb9b0=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0x9b0b[_0x1aab74];return _0x396af2;};'use strict';var schema=require(_0xb9b0('0x0'));var _=require(_0xb9b0('0x1'));var rpc={'chatInteraction':require(_0xb9b0('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb9b0('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xb9b0('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xb9b0('0x5'))('routing');var tag=schema({'tag':{'type':_0xb9b0('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xb9b0('0x7')]=function(_0x393a14,_0x5356e9,_0x29696f,_0x4c9a2b){return function(_0x19ccd7){try{var _0x4925e2={'tag':_0x5356e9[0x0]};var _0xe4b3af=tag[_0xb9b0('0x0')](_0x4925e2,{'typecast':!![]});if(_0xe4b3af['length']){logger['error'](_0xb9b0('0x8'),_0x393a14,_['map'](_0xe4b3af,'message')[_0xb9b0('0x9')](',\x20'));logger[_0xb9b0('0xa')](_0xb9b0('0xb'),_0x393a14);_0x19ccd7['next']();}else{var _0x2b8371={'ids':[_0x5356e9[0x0]]};if(rpc[_0x4c9a2b['channel']+_0xb9b0('0xc')]){rpc[_0x4c9a2b[_0xb9b0('0xd')]+'Interaction'][_0xb9b0('0xe')](_0x4c9a2b[_0xb9b0('0xf')]['id'],_0x2b8371)['then'](function(_0x413a7d){logger[_0xb9b0('0xa')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x393a14,_0x5356e9[0x1],_0x4c9a2b[_0xb9b0('0xd')],_0x4c9a2b['interaction']['id']);})['catch'](function(_0x26fb23){logger[_0xb9b0('0x10')]('[%s][TAG]\x20%s',_0x393a14,JSON[_0xb9b0('0x11')](_0x26fb23));logger[_0xb9b0('0xa')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x393a14);})['finally'](function(){_0x19ccd7[_0xb9b0('0x12')]();});}}}catch(_0x16513f){logger[_0xb9b0('0x10')]('[%s][TAG]\x20%s',_0x393a14,_[_0xb9b0('0x13')](_0x16513f)?JSON[_0xb9b0('0x11')](_0x16513f):_0x16513f);logger[_0xb9b0('0xa')](_0xb9b0('0xb'),_0x393a14);_0x19ccd7['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 15a1bfc..46a54a4 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 _0x42dd=['push','params','stringify','utf8','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','stop','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','urlOnAnswer','?params=','jsonrpc','2.0','method'];(function(_0x4ac397,_0x1fc9ab){var _0x298df7=function(_0x3722fe){while(--_0x3722fe){_0x4ac397['push'](_0x4ac397['shift']());}};_0x298df7(++_0x1fc9ab);}(_0x42dd,0xe5));var _0xd42d=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x42dd[_0x5834bc];return _0x3e183a;};'use strict';var rp=require(_0xd42d('0x0'));var logger=require(_0xd42d('0x1'))(_0xd42d('0x2'));var _=require(_0xd42d('0x3'));var arr=[];exports[_0xd42d('0x4')]=function(_0x22aefc,_0x5178d2){return function(_0x5a1544){var _0x4f5da8=_0x5178d2[0xa];var _0x38c5b2=_0x5178d2[0xb];var _0x3a01b7=_0x5178d2[0xc];var _0x4a4a2d=_0x5178d2[0xd];var _0x5eb786=_0x5178d2[0xe];var _0x199349=_0x5178d2[0xf][_0xd42d('0x5')](/\n/g,'\x20-\x20');var _0x19bfc6=_0x5178d2[0x10][_0xd42d('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x38c5b2)){arr['push'](_0x38c5b2);var _0x55baaf=_0x5178d2[0x3];var _0x356a43=_0x5178d2[0x4];var _0x21c98a=_0x5178d2[0x1];var _0xd597c2=_0x5178d2[0x0];var _0x772e7a={};_0x772e7a[_0xd42d('0x6')]=_0x5178d2[0x8]+_0xd42d('0x7')+_0x3a01b7+'|'+_0x4f5da8+'|'+_0x4a4a2d+'|'+_0x38c5b2+'|'+_0x5eb786;_0x772e7a['urlOnRing']=_0x5178d2[0x7]+_0xd42d('0x7')+_0x3a01b7+'|'+_0x4f5da8+'|'+_0x4a4a2d+'|'+_0x38c5b2+'|'+_0x5eb786+'|'+_0x199349+'|'+_0x19bfc6;_0x772e7a['title']=_0x5178d2[0x9];var _0x4feddd={};_0x4feddd[_0xd42d('0x8')]=_0xd42d('0x9');_0x4feddd[_0xd42d('0xa')]='login';var _0xca7ae4=[];_0xca7ae4[_0xd42d('0xb')](_0x5178d2[0x2]);_0xca7ae4[_0xd42d('0xb')](_0x5178d2[0x5]);_0xca7ae4[_0xd42d('0xb')](_0x5178d2[0x6]);_0x4feddd[_0xd42d('0xc')]=_0xca7ae4;_0x4feddd['id']=0x1;var _0x2edd74=JSON[_0xd42d('0xd')](_0x4feddd);var _0x11bbba={'encoding':_0xd42d('0xe'),'method':_0xd42d('0xf'),'timeout':0x2710,'url':_0x55baaf,'headers':{'Content-Type':_0xd42d('0x10')},'body':_0x2edd74};return rp(_0x11bbba)[_0xd42d('0x11')](function(_0x4456ff){const _0x3a7995=JSON[_0xd42d('0x12')](_0x4456ff);if(!_0x3a7995['result'][_0xd42d('0x13')]){throw new Error(_0xd42d('0x14'));}var _0xf262fe=_0x38c5b2;var _0x3bbb1e=_0xd42d('0x15')+_0x21c98a+_0xd42d('0x16')+_0xd597c2+'&sessionId='+_0xf262fe+_0xd42d('0x17')+JSON[_0xd42d('0xd')](_0x772e7a);var _0x30bb34=_0x356a43+'?'+_0x3bbb1e;return rp(_0x30bb34);})[_0xd42d('0x11')](function(_0xe6ac2e){logger[_0xd42d('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x22aefc,_0xe6ac2e);_0x5a1544[_0xd42d('0x19')]();})['catch'](function(_0x3b8684){logger[_0xd42d('0x1a')](_0xd42d('0x1b'),_0x22aefc,_['isObject'](_0x3b8684)?JSON['stringify'](_0x3b8684):_0x3b8684);_0x5a1544[_0xd42d('0x19')]();});}else{logger[_0xd42d('0x18')](_0xd42d('0x1c'),_0x22aefc);_0x5a1544[_0xd42d('0x1d')]();}};}; \ No newline at end of file +var _0x8d38=['request-promise','../../../../config/logger','routing','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','title','2.0','login','stringify','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x8d38,0xf8));var _0x88d3=function(_0x324ce5,_0x127b9b){_0x324ce5=_0x324ce5-0x0;var _0x5758fa=_0x8d38[_0x324ce5];return _0x5758fa;};'use strict';var rp=require(_0x88d3('0x0'));var logger=require(_0x88d3('0x1'))(_0x88d3('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x435d59,_0x1acb2a){return function(_0x3f883f){var _0x4aa5e4=_0x1acb2a[0xa];var _0x5c0409=_0x1acb2a[0xb];var _0x46fd9e=_0x1acb2a[0xc];var _0x29bec1=_0x1acb2a[0xd];var _0x122ed4=_0x1acb2a[0xe];var _0x2a3c68=_0x1acb2a[0xf][_0x88d3('0x3')](/\n/g,_0x88d3('0x4'));var _0x54a59d=_0x1acb2a[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x88d3('0x5')](_0x5c0409)){arr[_0x88d3('0x6')](_0x5c0409);var _0x19b0e6=_0x1acb2a[0x3];var _0x20ed6a=_0x1acb2a[0x4];var _0x541efc=_0x1acb2a[0x1];var _0x224ff7=_0x1acb2a[0x0];var _0x5b1320={};_0x5b1320[_0x88d3('0x7')]=_0x1acb2a[0x8]+'?params='+_0x46fd9e+'|'+_0x4aa5e4+'|'+_0x29bec1+'|'+_0x5c0409+'|'+_0x122ed4;_0x5b1320[_0x88d3('0x8')]=_0x1acb2a[0x7]+_0x88d3('0x9')+_0x46fd9e+'|'+_0x4aa5e4+'|'+_0x29bec1+'|'+_0x5c0409+'|'+_0x122ed4+'|'+_0x2a3c68+'|'+_0x54a59d;_0x5b1320[_0x88d3('0xa')]=_0x1acb2a[0x9];var _0x476616={};_0x476616['jsonrpc']=_0x88d3('0xb');_0x476616['method']=_0x88d3('0xc');var _0x1b0c72=[];_0x1b0c72['push'](_0x1acb2a[0x2]);_0x1b0c72[_0x88d3('0x6')](_0x1acb2a[0x5]);_0x1b0c72['push'](_0x1acb2a[0x6]);_0x476616['params']=_0x1b0c72;_0x476616['id']=0x1;var _0x228939=JSON[_0x88d3('0xd')](_0x476616);var _0x2595cf={'encoding':'utf8','method':_0x88d3('0xe'),'timeout':0x2710,'url':_0x19b0e6,'headers':{'Content-Type':_0x88d3('0xf')},'body':_0x228939};return rp(_0x2595cf)[_0x88d3('0x10')](function(_0xb6f92f){const _0x199a34=JSON[_0x88d3('0x11')](_0xb6f92f);if(!_0x199a34['result'][_0x88d3('0x12')]){throw new Error(_0x88d3('0x13'));}var _0x37b75c=_0x5c0409;var _0x30b256=_0x88d3('0x14')+_0x541efc+_0x88d3('0x15')+_0x224ff7+_0x88d3('0x16')+_0x37b75c+'&data='+JSON[_0x88d3('0xd')](_0x5b1320);var _0x2e2cfc=_0x20ed6a+'?'+_0x30b256;return rp(_0x2e2cfc);})[_0x88d3('0x10')](function(_0x1244ac){logger[_0x88d3('0x17')](_0x88d3('0x18'),_0x435d59,_0x1244ac);_0x3f883f['stop']();})[_0x88d3('0x19')](function(_0x37e3ea){logger[_0x88d3('0x1a')]('[%s][TVOX]\x20%s',_0x435d59,_[_0x88d3('0x1b')](_0x37e3ea)?JSON[_0x88d3('0xd')](_0x37e3ea):_0x37e3ea);_0x3f883f[_0x88d3('0x1c')]();});}else{logger[_0x88d3('0x17')](_0x88d3('0x1d'),_0x435d59);_0x3f883f[_0x88d3('0x1e')]();}};}; \ 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 6cc561c..9c3b8dc 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x2ef733,_0x37bd51){var _0x4c75a5=function(_0x2079b3){while(--_0x2079b3){_0x2ef733['push'](_0x2ef733['shift']());}};_0x4c75a5(++_0x37bd51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x54bdd2,_0x44ccb3){var _0x3f5136=function(_0x37d762){while(--_0x37d762){_0x54bdd2['push'](_0x54bdd2['shift']());}};_0x3f5136(++_0x44ccb3);}(_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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 6e0254c..50b3844 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 _0xaceb=['./interval','condition','intervals','./applications/','consequence','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','bluebird','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','isArray','applications','length','existsSync','app','.js','autoreply','appdata','split','push','join','slice','dialogflow','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','body','format','%s:%s:%s'];(function(_0x13effd,_0x72361){var _0x2611df=function(_0x204e9b){while(--_0x204e9b){_0x13effd['push'](_0x13effd['shift']());}};_0x2611df(++_0x72361);}(_0xaceb,0x1d6));var _0xbace=function(_0x435191,_0x59048e){_0x435191=_0x435191-0x0;var _0x258b3d=_0xaceb[_0x435191];return _0x258b3d;};'use strict';var _=require(_0xbace('0x0'));var util=require('util');var path=require(_0xbace('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xbace('0x2'));var utils=require('./applications/utils');var sUtils=require(_0xbace('0x3'));var logger=require(_0xbace('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0xbace('0x5')),'mailQueueReport':require(_0xbace('0x6')),'chatQueueReport':require(_0xbace('0x7')),'smsQueueReport':require(_0xbace('0x8')),'faxQueueReport':require(_0xbace('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xbace('0xa'));function getId(_0x3f4ac3,_0x432ee9,_0x542567){return util['format'](_0xbace('0xb'),_0x3f4ac3,_0x432ee9||0x0,_0x542567||0x0);}function getIntervals(_0x3e8fd5,_0x3f6e06){var _0x4a5421=[];if(!_[_0xbace('0xc')](_0x3f6e06['IntervalId'])&&!_[_0xbace('0xc')](_0x3e8fd5[_0x3f6e06[_0xbace('0xd')]])&&!_['isNil'](_0x3e8fd5[_0x3f6e06[_0xbace('0xd')]][_0xbace('0xe')])){_0x4a5421=_[_0xbace('0xf')](_0x3e8fd5[_0x3f6e06['IntervalId']][_0xbace('0xe')],_0xbace('0x10'));}else if(!_[_0xbace('0xc')](_0x3f6e06['interval'])){_0x4a5421=[_0x3f6e06[_0xbace('0x10')]];}return _0x4a5421;}exports[_0xbace('0x11')]=function(_0x1f6b8d){_0x1f6b8d[_0xbace('0x12')]={};return new BPromise(function(_0x1ac2fe,_0x2a0ee5){var _0x2f28bb={'Start':function(_0x1e3061){var _0x152c36=this;return new Promise(function(_0x2220f0,_0x5abc68){if(_0x1e3061){try{var _0x41b513=[];var _0x5d3754=getId(_0x1e3061[_0xbace('0x13')],_0x1e3061[_0xbace('0x14')]?_0x1e3061[_0xbace('0x14')]['id']:0x0,_0x1e3061[_0xbace('0x15')]?_0x1e3061[_0xbace('0x15')]['id']:0x0);var _0x23577e=sUtils[_0xbace('0x16')](_0x1f6b8d,_0x1e3061);if(!_0x23577e&&_0x1e3061['applications']&&_[_0xbace('0x17')](_0x1e3061[_0xbace('0x18')])&&_0x1e3061['applications'][_0xbace('0x19')]){for(var _0xd90f7e=0x0;_0xd90f7e<_0x1e3061['applications'][_0xbace('0x19')];_0xd90f7e+=0x1){var _0x597567=_0x1e3061['applications'][_0xd90f7e];if(fs[_0xbace('0x1a')](path['join'](__dirname,_0xbace('0x18'),_0x597567[_0xbace('0x1b')]+_0xbace('0x1c')))){var _0x128b20=[];switch(_0x597567[_0xbace('0x1b')]['toLowerCase']()){case _0xbace('0x1d'):var _0x270b10=_0x597567[_0xbace('0x1e')][_0xbace('0x1f')](',');if(_0x1e3061[_0xbace('0x13')]==='mail'){_0x128b20[_0xbace('0x20')](_0x270b10[0x0]);_0x128b20['push'](_0x270b10[0x1]);_0x128b20[_0xbace('0x20')](_0x270b10['slice'](0x2,_0x270b10[_0xbace('0x19')])[_0xbace('0x21')](','));}else{_0x128b20[_0xbace('0x20')](_0x270b10[0x0]);_0x128b20[_0xbace('0x20')](_0x270b10[_0xbace('0x22')](0x1,_0x270b10[_0xbace('0x19')])[_0xbace('0x21')](','));}break;case _0xbace('0x23'):var _0x463d0c=_0x597567[_0xbace('0x1e')][_0xbace('0x1f')](',');_0x128b20[_0xbace('0x20')](_0x463d0c[0x0]);_0x128b20['push'](_0x463d0c[0x1]);_0x128b20[_0xbace('0x20')](_0x463d0c['slice'](0x2,_0x463d0c[_0xbace('0x19')])[_0xbace('0x21')](','));break;case'dialogflowv2':var _0x4a8fa9=_0x597567[_0xbace('0x1e')][_0xbace('0x1f')](',');_0x128b20['push'](_0x4a8fa9[0x0]);_0x128b20['push'](_0x4a8fa9[0x1]);_0x128b20[_0xbace('0x20')](_0x4a8fa9[0x2]);_0x128b20[_0xbace('0x20')](_0x4a8fa9[0x3]);_0x128b20[_0xbace('0x20')](_0x4a8fa9[_0xbace('0x22')](0x4,_0x4a8fa9['length'])[_0xbace('0x21')](','));break;case'amazonlex':var _0xacfd5c=_0x597567['appdata']['split'](',');_0x128b20[_0xbace('0x20')](_0xacfd5c[0x0]);_0x128b20[_0xbace('0x20')](_0xacfd5c[0x1]);_0x128b20[_0xbace('0x20')](_0xacfd5c[0x2]);_0x128b20[_0xbace('0x20')](_0xacfd5c[0x3]);_0x128b20[_0xbace('0x20')](_0xacfd5c[_0xbace('0x22')](0x4,_0xacfd5c[_0xbace('0x19')])['join'](','));break;case'message':_0x128b20[_0xbace('0x20')](_0x597567[_0xbace('0x1e')]);break;case _0xbace('0x24'):_0x128b20[_0xbace('0x20')](_0x597567[_0xbace('0x25')]);_0x128b20[_0xbace('0x20')](_0x597567['appdata']);break;case _0xbace('0x26'):var _0x755f23=utils[_0xbace('0x27')](_0x1e3061['account'][_0xbace('0x28')],_0x1e3061);var _0x73545d=_0x597567[_0xbace('0x1e')][_0xbace('0x1f')](',');_0x128b20[_0xbace('0x20')](_0x73545d[0x0]);_0x128b20[_0xbace('0x20')](_0x73545d[0x1]);_0x128b20[_0xbace('0x20')](_0x73545d[0x2]);_0x128b20['push'](_0x73545d[0x3]);_0x128b20[_0xbace('0x20')](_0x73545d[0x4]);_0x128b20['push'](_0x73545d[0x5]);_0x128b20[_0xbace('0x20')](_0x73545d[0x6]);_0x128b20['push'](_0x73545d[0x7]);_0x128b20['push'](_0x73545d[0x8]);_0x128b20['push'](_0x73545d[0x9]);_0x128b20[_0xbace('0x20')](_0x73545d[0xa]);_0x128b20[_0xbace('0x20')](_0x1e3061[_0xbace('0x15')]['id']);_0x128b20[_0xbace('0x20')](_0x1e3061['message']['id']);_0x128b20[_0xbace('0x20')](_0x597567[_0xbace('0x29')]);_0x128b20[_0xbace('0x20')](_0x1e3061[_0xbace('0x15')]['ContactId']);_0x128b20['push'](_0x1e3061['body'][_0xbace('0x2a')]);_0x128b20['push'](_0x755f23);break;default:_0x128b20=_[_0xbace('0xc')](_0x597567['appdata'])?[]:_0x597567[_0xbace('0x1e')][_0xbace('0x1f')](',');}var _0x341683={'id':util[_0xbace('0x2b')](_0xbace('0x2c'),_0x5d3754,_0x597567['id'],_0x597567[_0xbace('0x1b')]),'condition':require(_0xbace('0x2d'))[_0xbace('0x2e')](_0x5d3754,getIntervals(_0x1f6b8d[_0xbace('0x2f')],_0x597567),_0x1f6b8d),'consequence':require(_0xbace('0x30')+_0x597567[_0xbace('0x1b')])[_0xbace('0x31')](_0x5d3754,_0x128b20,_0x1f6b8d,_0x1e3061),'p':_0x597567['priority']||0x0};logger[_0xbace('0x32')]('Push\x20new\x20rule',_0x341683['id'],_0xbace('0x33'),getIntervals(_0x1f6b8d[_0xbace('0x2f')],_0x597567)['join'](_0xbace('0x34')));_0x41b513['push'](_0x341683);}else{logger[_0xbace('0x35')](_0xbace('0x36'),path[_0xbace('0x21')](__dirname,'applications',_0x597567[_0xbace('0x1b')]+'.js'));}}_0x1f6b8d[_0xbace('0x12')][_0x5d3754]=new RuleEngine(_0x41b513);_0x1f6b8d[_0xbace('0x12')][_0x5d3754][_0xbace('0x37')](_0x1e3061,function(_0x41a48d){logger[_0xbace('0x32')](_0xbace('0x38'),JSON[_0xbace('0x39')](_0x41a48d['matchPath']));if(_0x1f6b8d[_0xbace('0x12')][_0x5d3754]){_0x1f6b8d['rules'][_0x5d3754]['emit'](_0xbace('0x3a'));}});return _0x2220f0({'code':0xc8,'message':_0x1e3061});}else{if(_0x23577e){logger['info'](util[_0xbace('0x2b')](_0xbace('0x3b'),_0x5d3754));}else{logger[_0xbace('0x32')](_0xbace('0x3c'));}return _0x2220f0({'code':0xc8,'message':_0x1e3061});}}catch(_0x5565a5){logger['error'](_0x5565a5[_0xbace('0x3d')]);return _0x5abc68(_0x152c36[_0xbace('0x35')](0x1f4,_0x5565a5));}}return _0x5abc68(_0xbace('0x3e'));});},'AcceptMessage':function(_0x216c93){var _0x3abd1d=this;return new Promise(function(_0x2e6d79,_0x3de4d1){if(_0x216c93[_0xbace('0x3f')]&&_0x216c93[_0xbace('0x3f')]['id']){if(_0x1f6b8d[_0xbace('0x40')][_0x216c93[_0xbace('0x3f')]['id']]){_0x1f6b8d[_0xbace('0x40')][_0x216c93['agent']['id']][_0xbace('0x41')]=![];_0x1f6b8d[_0xbace('0x40')][_0x216c93[_0xbace('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x216c93[_0xbace('0x14')]&&_0x216c93[_0xbace('0x14')]['id']){try{var _0x5377ca=getId(_0x216c93['channel'],_0x216c93['message']?_0x216c93[_0xbace('0x14')]['id']:0x0,_0x216c93['interaction']?_0x216c93[_0xbace('0x15')]['id']:0x0);if(_0x1f6b8d['rules'][_0x5377ca]){_0x1f6b8d[_0xbace('0x12')][_0x5377ca]['emit'](_0xbace('0x42'));if(rpc[_0x216c93[_0xbace('0x13')]+_0xbace('0x43')]){rpc[_0x216c93[_0xbace('0x13')]+'QueueReport'][_0xbace('0x44')](_0x5377ca,{'UserId':_0x216c93[_0xbace('0x14')]['UserId']})[_0xbace('0x45')](function(){logger[_0xbace('0x35')](_0xbace('0x46'));});}}return _0x2e6d79({'code':0xc8,'message':_0x216c93});}catch(_0x855f9a){logger[_0xbace('0x35')](_0x855f9a['stack']);return _0x3de4d1(_0x3abd1d[_0xbace('0x35')](0x1f4,_0x855f9a));}}logger[_0xbace('0x35')](_0xbace('0x47'));return _0x3de4d1(_0x3abd1d[_0xbace('0x35')](0x1f4,_0xbace('0x47')));});},'RejectMessage':function(_0x1e3dcb){var _0x2bac7f=this;return new Promise(function(_0x587fc2,_0x4ab422){if(_0x1e3dcb['agent']&&_0x1e3dcb[_0xbace('0x3f')]['id']){try{if(_0x1f6b8d[_0xbace('0x40')][_0x1e3dcb[_0xbace('0x3f')]['id']]){_0x1f6b8d[_0xbace('0x40')][_0x1e3dcb['agent']['id']][_0xbace('0x41')]=![];_0x1f6b8d['agents'][_0x1e3dcb[_0xbace('0x3f')]['id']][_0xbace('0x48')]=undefined;}return _0x587fc2({'code':0xc8,'message':_0x1e3dcb});}catch(_0x2b3b93){logger['error'](_0x2b3b93[_0xbace('0x3d')]);return _0x4ab422(_0x2bac7f['error'](0x1f4,_0x2b3b93));}}logger[_0xbace('0x35')](_0xbace('0x47'));return _0x4ab422(_0x2bac7f['error'](0x1f4,_0xbace('0x47')));});},'AbandonInteraction':function(_0x49c61b){var _0xc1a594=this;return new Promise(function(_0x3254fe,_0x460885){if(_0x49c61b[_0xbace('0x13')]&&_0x49c61b[_0xbace('0x15')]&&_0x49c61b[_0xbace('0x15')]['id']){try{var _0x385db0=getId(_0x49c61b[_0xbace('0x13')],_0x49c61b[_0xbace('0x14')]?_0x49c61b[_0xbace('0x14')]['id']:0x0,_0x49c61b['interaction']?_0x49c61b[_0xbace('0x15')]['id']:0x0);if(_0x1f6b8d[_0xbace('0x12')][_0x385db0]){_0x1f6b8d[_0xbace('0x12')][_0x385db0][_0xbace('0x49')](_0xbace('0x42'));}return _0x3254fe({'code':0xc8,'message':_0x49c61b});}catch(_0x388c19){logger[_0xbace('0x35')](_0x388c19['stack']);return _0x460885(_0xc1a594[_0xbace('0x35')](0x1f4,_0x388c19));}}logger[_0xbace('0x35')](_0xbace('0x47'));return _0x460885(_0xc1a594[_0xbace('0x35')](0x1f4,_0xbace('0x47')));});},'AgentCapacity':function(_0x5bfda0){var _0x4e9fee=this;return new Promise(function(_0x1e794c,_0x440089){if(_0x1f6b8d[_0xbace('0x40')][_0xbace('0x4a')](_0x5bfda0['id'])){for(var _0x5baf03 in _0x5bfda0[_0xbace('0x4b')]){if(_0x5bfda0[_0xbace('0x4b')][_0xbace('0x4a')](_0x5baf03)){if(_0x1f6b8d[_0xbace('0x40')][_0x5bfda0['id']]['hasOwnProperty'](_0x5baf03+'CurrentCapacity')){_0x1f6b8d['agents'][_0x5bfda0['id']][_0x5baf03+_0xbace('0x4c')]=parseInt(_0x5bfda0['capacity'][_0x5baf03],0xa);}}}_0x1f6b8d[_0xbace('0x40')][_0x5bfda0['id']][_0xbace('0x4d')]();return _0x1e794c({'code':0xc8,'message':_0x1f6b8d[_0xbace('0x40')][_0x5bfda0['id']]});}else{return _0x440089(_0x4e9fee[_0xbace('0x35')](0x1f4,_0xbace('0x4e')));}});},'Agents':function(_0x102a12){return new Promise(function(_0x2a2cc3){var _0x23afc7=_['values'](_0x1f6b8d['agents']);if(_0x102a12&&_0x102a12['id']){var _0x1d81ac=_[_0xbace('0x4f')](_0x23afc7,function(_0x43fc7a){return _0x43fc7a['id']===_0x102a12['id'];});_0x2a2cc3(_0x1d81ac);}else{_0x2a2cc3({'count':_0x23afc7[_0xbace('0x19')],'rows':_0x23afc7});}});},'ChatQueues':function(){return new Promise(function(_0x3e8b77){var _0x1278c6=[];for(var _0x4a49fd in _0x1f6b8d['chatQueues']){if(_0x1f6b8d[_0xbace('0x50')][_0xbace('0x4a')](_0x4a49fd)){var _0x30d391=_0x1f6b8d['chatQueues'][_0x4a49fd];var _0x2a9d5a={'id':_0x30d391['id'],'available':_0x30d391[_0xbace('0x51')],'loggedIn':_0x30d391[_0xbace('0x52')],'name':_0x30d391[_0xbace('0x53')],'paused':_0x30d391[_0xbace('0x54')],'waiting':_0x30d391[_0xbace('0x55')]};_0x1278c6[_0xbace('0x20')](_0x2a9d5a);}}_0x3e8b77({'count':_0x1278c6['length'],'rows':_0x1278c6});});},'MailQueues':function(){return new Promise(function(_0x3b395f){var _0x5d5dbe=[];for(var _0x54eb2f in _0x1f6b8d[_0xbace('0x56')]){if(_0x1f6b8d['mailQueues'][_0xbace('0x4a')](_0x54eb2f)){var _0x43fd64=_0x1f6b8d['mailQueues'][_0x54eb2f];var _0x5be604={'id':_0x43fd64['id'],'available':_0x43fd64['available'],'loggedIn':_0x43fd64[_0xbace('0x52')],'name':_0x43fd64[_0xbace('0x53')],'paused':_0x43fd64[_0xbace('0x54')],'waiting':_0x43fd64[_0xbace('0x55')]};_0x5d5dbe[_0xbace('0x20')](_0x5be604);}}_0x3b395f({'count':_0x5d5dbe[_0xbace('0x19')],'rows':_0x5d5dbe});});},'OpenchannelQueues':function(){return new Promise(function(_0x3521d5){var _0x5f3fe0=[];for(var _0x16ddd0 in _0x1f6b8d[_0xbace('0x57')]){if(_0x1f6b8d[_0xbace('0x57')][_0xbace('0x4a')](_0x16ddd0)){var _0x5216d8=_0x1f6b8d[_0xbace('0x57')][_0x16ddd0];var _0x288b6f={'id':_0x5216d8['id'],'available':_0x5216d8[_0xbace('0x51')],'loggedIn':_0x5216d8[_0xbace('0x52')],'name':_0x5216d8[_0xbace('0x53')],'paused':_0x5216d8[_0xbace('0x54')],'waiting':_0x5216d8[_0xbace('0x55')]};_0x5f3fe0[_0xbace('0x20')](_0x288b6f);}}_0x3521d5({'count':_0x5f3fe0[_0xbace('0x19')],'rows':_0x5f3fe0});});},'SmsQueues':function(){return new Promise(function(_0x51de8a){var _0xfbc786=[];for(var _0xd0cb45 in _0x1f6b8d['smsQueues']){if(_0x1f6b8d[_0xbace('0x58')][_0xbace('0x4a')](_0xd0cb45)){var _0x4b5c68=_0x1f6b8d['smsQueues'][_0xd0cb45];var _0x2b4322={'id':_0x4b5c68['id'],'available':_0x4b5c68[_0xbace('0x51')],'loggedIn':_0x4b5c68['loggedIn'],'name':_0x4b5c68[_0xbace('0x53')],'paused':_0x4b5c68[_0xbace('0x54')],'waiting':_0x4b5c68['waiting']};_0xfbc786[_0xbace('0x20')](_0x2b4322);}}_0x51de8a({'count':_0xfbc786[_0xbace('0x19')],'rows':_0xfbc786});});},'FaxQueues':function(){return new Promise(function(_0x29add0){var _0x439124=[];for(var _0x55c93d in _0x1f6b8d['faxQueues']){if(_0x1f6b8d[_0xbace('0x59')][_0xbace('0x4a')](_0x55c93d)){var _0x3c2add=_0x1f6b8d['faxQueues'][_0x55c93d];var _0x1d3687={'id':_0x3c2add['id'],'available':_0x3c2add[_0xbace('0x51')],'loggedIn':_0x3c2add[_0xbace('0x52')],'name':_0x3c2add[_0xbace('0x53')],'paused':_0x3c2add[_0xbace('0x54')],'waiting':_0x3c2add[_0xbace('0x55')]};_0x439124[_0xbace('0x20')](_0x1d3687);}}_0x29add0({'count':_0x439124[_0xbace('0x19')],'rows':_0x439124});});},'WhatsappQueues':function(){return new Promise(function(_0x3be5c9){var _0x3be543=[];for(var _0x377453 in _0x1f6b8d['whatsappQueues']){if(_0x1f6b8d['whatsappQueues'][_0xbace('0x4a')](_0x377453)){var _0x411537=_0x1f6b8d[_0xbace('0x5a')][_0x377453];var _0x2e8048={'id':_0x411537['id'],'available':_0x411537['available'],'loggedIn':_0x411537[_0xbace('0x52')],'name':_0x411537['name'],'paused':_0x411537[_0xbace('0x54')],'waiting':_0x411537[_0xbace('0x55')]};_0x3be543[_0xbace('0x20')](_0x2e8048);}}_0x3be5c9({'count':_0x3be543[_0xbace('0x19')],'rows':_0x3be543});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x399ef6){var _0x540f9f=_['values'](_0x1f6b8d[_0xbace('0x5b')]);_0x399ef6({'count':_0x540f9f[_0xbace('0x19')],'rows':_0x540f9f});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3b64a5){var _0x2a55c2=_[_0xbace('0x5c')](_0x1f6b8d[_0xbace('0x5d')]);_0x3b64a5({'count':_0x2a55c2[_0xbace('0x19')],'rows':_0x2a55c2});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x18fdd7){var _0x22a380=_['values'](_0x1f6b8d[_0xbace('0x5e')]);_0x18fdd7({'count':_0x22a380[_0xbace('0x19')],'rows':_0x22a380});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x22c5ed){var _0x2efce6=_[_0xbace('0x5c')](_0x1f6b8d[_0xbace('0x5f')]);_0x22c5ed({'count':_0x2efce6[_0xbace('0x19')],'rows':_0x2efce6});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4973d7){var _0x1ea5f6=_[_0xbace('0x5c')](_0x1f6b8d['faxQueuesWaitingInteractions']);_0x4973d7({'count':_0x1ea5f6[_0xbace('0x19')],'rows':_0x1ea5f6});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x281e8a){var _0x24e3c7=_[_0xbace('0x5c')](_0x1f6b8d[_0xbace('0x60')]);_0x281e8a({'count':_0x24e3c7[_0xbace('0x19')],'rows':_0x24e3c7});});}};var _0x2d6a8d=jayson[_0xbace('0x61')](_0x2f28bb)[_0xbace('0x62')]();_0x2d6a8d['on']('error',function(_0x42ce35){logger[_0xbace('0x35')](JSON['stringify'](_0x42ce35));return _0x2a0ee5(_0x42ce35);});_0x2d6a8d[_0xbace('0x11')](0x232c,_0xbace('0x63'),function(){console[_0xbace('0x64')](_0xbace('0x65'),0x232c);return _0x1ac2fe(_0xbace('0x66')+0x232c);});});}; \ No newline at end of file +var _0x3b4e=['capacity','CurrentCapacity','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','IntervalId','isNil','Intervals','interval','rules','message','interaction','checkWaitingNotifications','applications','length','existsSync','app','.js','autoreply','appdata','channel','push','slice','join','split','dialogflowv2','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty'];(function(_0xb4ec76,_0x463b05){var _0x959e76=function(_0x2117d2){while(--_0x2117d2){_0xb4ec76['push'](_0xb4ec76['shift']());}};_0x959e76(++_0x463b05);}(_0x3b4e,0x142));var _0xe3b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b4e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe3b4('0x0'));var util=require(_0xe3b4('0x1'));var path=require(_0xe3b4('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0xe3b4('0x3'));var sUtils=require(_0xe3b4('0x4'));var logger=require(_0xe3b4('0x5'))(_0xe3b4('0x6'));var rpc={'openchannelQueueReport':require(_0xe3b4('0x7')),'mailQueueReport':require(_0xe3b4('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xe3b4('0x9')),'whatsappQueueReport':require(_0xe3b4('0xa'))};var RuleEngine=require(_0xe3b4('0xb'));function getId(_0xd9c16f,_0x5de9d8,_0x4cdc5d){return util[_0xe3b4('0xc')]('%s.%s.%s',_0xd9c16f,_0x5de9d8||0x0,_0x4cdc5d||0x0);}function getIntervals(_0x4ad29e,_0x132959){var _0x24d139=[];if(!_['isNil'](_0x132959[_0xe3b4('0xd')])&&!_[_0xe3b4('0xe')](_0x4ad29e[_0x132959[_0xe3b4('0xd')]])&&!_[_0xe3b4('0xe')](_0x4ad29e[_0x132959[_0xe3b4('0xd')]][_0xe3b4('0xf')])){_0x24d139=_['map'](_0x4ad29e[_0x132959[_0xe3b4('0xd')]][_0xe3b4('0xf')],_0xe3b4('0x10'));}else if(!_[_0xe3b4('0xe')](_0x132959[_0xe3b4('0x10')])){_0x24d139=[_0x132959[_0xe3b4('0x10')]];}return _0x24d139;}exports['listen']=function(_0x570a5a){_0x570a5a[_0xe3b4('0x11')]={};return new BPromise(function(_0xbfde36,_0x3e4397){var _0x33c1ca={'Start':function(_0x31df63){var _0x5e832d=this;return new Promise(function(_0x43fd53,_0x52dee7){if(_0x31df63){try{var _0x15dd25=[];var _0x1d096f=getId(_0x31df63['channel'],_0x31df63[_0xe3b4('0x12')]?_0x31df63['message']['id']:0x0,_0x31df63[_0xe3b4('0x13')]?_0x31df63[_0xe3b4('0x13')]['id']:0x0);var _0x5782c4=sUtils[_0xe3b4('0x14')](_0x570a5a,_0x31df63);if(!_0x5782c4&&_0x31df63['applications']&&_['isArray'](_0x31df63['applications'])&&_0x31df63['applications']['length']){for(var _0x323f3c=0x0;_0x323f3c<_0x31df63[_0xe3b4('0x15')][_0xe3b4('0x16')];_0x323f3c+=0x1){var _0x5f2278=_0x31df63[_0xe3b4('0x15')][_0x323f3c];if(fs[_0xe3b4('0x17')](path['join'](__dirname,_0xe3b4('0x15'),_0x5f2278[_0xe3b4('0x18')]+_0xe3b4('0x19')))){var _0x418202=[];switch(_0x5f2278[_0xe3b4('0x18')]['toLowerCase']()){case _0xe3b4('0x1a'):var _0xac537d=_0x5f2278[_0xe3b4('0x1b')]['split'](',');if(_0x31df63[_0xe3b4('0x1c')]==='mail'){_0x418202[_0xe3b4('0x1d')](_0xac537d[0x0]);_0x418202[_0xe3b4('0x1d')](_0xac537d[0x1]);_0x418202[_0xe3b4('0x1d')](_0xac537d[_0xe3b4('0x1e')](0x2,_0xac537d[_0xe3b4('0x16')])[_0xe3b4('0x1f')](','));}else{_0x418202[_0xe3b4('0x1d')](_0xac537d[0x0]);_0x418202[_0xe3b4('0x1d')](_0xac537d[_0xe3b4('0x1e')](0x1,_0xac537d[_0xe3b4('0x16')])[_0xe3b4('0x1f')](','));}break;case'dialogflow':var _0x3989ac=_0x5f2278['appdata'][_0xe3b4('0x20')](',');_0x418202[_0xe3b4('0x1d')](_0x3989ac[0x0]);_0x418202[_0xe3b4('0x1d')](_0x3989ac[0x1]);_0x418202[_0xe3b4('0x1d')](_0x3989ac[_0xe3b4('0x1e')](0x2,_0x3989ac[_0xe3b4('0x16')])[_0xe3b4('0x1f')](','));break;case _0xe3b4('0x21'):var _0x334370=_0x5f2278['appdata'][_0xe3b4('0x20')](',');_0x418202[_0xe3b4('0x1d')](_0x334370[0x0]);_0x418202['push'](_0x334370[0x1]);_0x418202[_0xe3b4('0x1d')](_0x334370[0x2]);_0x418202['push'](_0x334370[0x3]);_0x418202[_0xe3b4('0x1d')](_0x334370[_0xe3b4('0x1e')](0x4,_0x334370[_0xe3b4('0x16')])[_0xe3b4('0x1f')](','));break;case'amazonlex':var _0x4e875e=_0x5f2278[_0xe3b4('0x1b')][_0xe3b4('0x20')](',');_0x418202['push'](_0x4e875e[0x0]);_0x418202['push'](_0x4e875e[0x1]);_0x418202[_0xe3b4('0x1d')](_0x4e875e[0x2]);_0x418202[_0xe3b4('0x1d')](_0x4e875e[0x3]);_0x418202[_0xe3b4('0x1d')](_0x4e875e['slice'](0x4,_0x4e875e['length'])[_0xe3b4('0x1f')](','));break;case _0xe3b4('0x12'):_0x418202[_0xe3b4('0x1d')](_0x5f2278['appdata']);break;case _0xe3b4('0x22'):_0x418202['push'](_0x5f2278[_0xe3b4('0x23')]);_0x418202[_0xe3b4('0x1d')](_0x5f2278[_0xe3b4('0x1b')]);break;case _0xe3b4('0x24'):var _0x5a4547=utils['getMustacheRender'](_0x31df63[_0xe3b4('0x25')][_0xe3b4('0x26')],_0x31df63);var _0xb9bbe8=_0x5f2278[_0xe3b4('0x1b')][_0xe3b4('0x20')](',');_0x418202[_0xe3b4('0x1d')](_0xb9bbe8[0x0]);_0x418202[_0xe3b4('0x1d')](_0xb9bbe8[0x1]);_0x418202[_0xe3b4('0x1d')](_0xb9bbe8[0x2]);_0x418202[_0xe3b4('0x1d')](_0xb9bbe8[0x3]);_0x418202[_0xe3b4('0x1d')](_0xb9bbe8[0x4]);_0x418202['push'](_0xb9bbe8[0x5]);_0x418202['push'](_0xb9bbe8[0x6]);_0x418202['push'](_0xb9bbe8[0x7]);_0x418202['push'](_0xb9bbe8[0x8]);_0x418202[_0xe3b4('0x1d')](_0xb9bbe8[0x9]);_0x418202['push'](_0xb9bbe8[0xa]);_0x418202[_0xe3b4('0x1d')](_0x31df63['interaction']['id']);_0x418202[_0xe3b4('0x1d')](_0x31df63[_0xe3b4('0x12')]['id']);_0x418202[_0xe3b4('0x1d')](_0x5f2278[_0xe3b4('0x27')]);_0x418202[_0xe3b4('0x1d')](_0x31df63[_0xe3b4('0x13')][_0xe3b4('0x28')]);_0x418202[_0xe3b4('0x1d')](_0x31df63[_0xe3b4('0x29')][_0xe3b4('0x29')]);_0x418202[_0xe3b4('0x1d')](_0x5a4547);break;default:_0x418202=_[_0xe3b4('0xe')](_0x5f2278[_0xe3b4('0x1b')])?[]:_0x5f2278[_0xe3b4('0x1b')][_0xe3b4('0x20')](',');}var _0x383534={'id':util[_0xe3b4('0xc')](_0xe3b4('0x2a'),_0x1d096f,_0x5f2278['id'],_0x5f2278[_0xe3b4('0x18')]),'condition':require(_0xe3b4('0x2b'))[_0xe3b4('0x2c')](_0x1d096f,getIntervals(_0x570a5a[_0xe3b4('0x2d')],_0x5f2278),_0x570a5a),'consequence':require('./applications/'+_0x5f2278['app'])['consequence'](_0x1d096f,_0x418202,_0x570a5a,_0x31df63),'p':_0x5f2278['priority']||0x0};logger[_0xe3b4('0x2e')](_0xe3b4('0x2f'),_0x383534['id'],_0xe3b4('0x30'),getIntervals(_0x570a5a[_0xe3b4('0x2d')],_0x5f2278)[_0xe3b4('0x1f')](_0xe3b4('0x31')));_0x15dd25[_0xe3b4('0x1d')](_0x383534);}else{logger[_0xe3b4('0x32')](_0xe3b4('0x33'),path[_0xe3b4('0x1f')](__dirname,_0xe3b4('0x15'),_0x5f2278['app']+'.js'));}}_0x570a5a[_0xe3b4('0x11')][_0x1d096f]=new RuleEngine(_0x15dd25);_0x570a5a[_0xe3b4('0x11')][_0x1d096f][_0xe3b4('0x34')](_0x31df63,function(_0x33d85c){logger['info'](_0xe3b4('0x35'),JSON[_0xe3b4('0x36')](_0x33d85c[_0xe3b4('0x37')]));if(_0x570a5a[_0xe3b4('0x11')][_0x1d096f]){_0x570a5a['rules'][_0x1d096f][_0xe3b4('0x38')](_0xe3b4('0x39'));}});return _0x43fd53({'code':0xc8,'message':_0x31df63});}else{if(_0x5782c4){logger[_0xe3b4('0x2e')](util[_0xe3b4('0xc')](_0xe3b4('0x3a'),_0x1d096f));}else{logger[_0xe3b4('0x2e')](_0xe3b4('0x3b'));}return _0x43fd53({'code':0xc8,'message':_0x31df63});}}catch(_0x33c585){logger[_0xe3b4('0x32')](_0x33c585[_0xe3b4('0x3c')]);return _0x52dee7(_0x5e832d[_0xe3b4('0x32')](0x1f4,_0x33c585));}}return _0x52dee7(_0xe3b4('0x3d'));});},'AcceptMessage':function(_0x4b34ea){var _0x59cf34=this;return new Promise(function(_0x422c8b,_0x246780){if(_0x4b34ea['agent']&&_0x4b34ea[_0xe3b4('0x3e')]['id']){if(_0x570a5a[_0xe3b4('0x3f')][_0x4b34ea[_0xe3b4('0x3e')]['id']]){_0x570a5a['agents'][_0x4b34ea[_0xe3b4('0x3e')]['id']]['busy']=![];_0x570a5a['agents'][_0x4b34ea[_0xe3b4('0x3e')]['id']][_0xe3b4('0x40')]=undefined;}}if(_0x4b34ea[_0xe3b4('0x12')]&&_0x4b34ea['message']['id']){try{var _0x4eb4dd=getId(_0x4b34ea[_0xe3b4('0x1c')],_0x4b34ea[_0xe3b4('0x12')]?_0x4b34ea['message']['id']:0x0,_0x4b34ea[_0xe3b4('0x13')]?_0x4b34ea[_0xe3b4('0x13')]['id']:0x0);if(_0x570a5a[_0xe3b4('0x11')][_0x4eb4dd]){_0x570a5a[_0xe3b4('0x11')][_0x4eb4dd][_0xe3b4('0x38')](_0xe3b4('0x41'));if(rpc[_0x4b34ea[_0xe3b4('0x1c')]+_0xe3b4('0x42')]){rpc[_0x4b34ea[_0xe3b4('0x1c')]+_0xe3b4('0x42')][_0xe3b4('0x43')](_0x4eb4dd,{'UserId':_0x4b34ea[_0xe3b4('0x12')][_0xe3b4('0x44')]})[_0xe3b4('0x45')](function(){logger[_0xe3b4('0x32')](_0xe3b4('0x46'));});}}return _0x422c8b({'code':0xc8,'message':_0x4b34ea});}catch(_0x586399){logger[_0xe3b4('0x32')](_0x586399[_0xe3b4('0x3c')]);return _0x246780(_0x59cf34[_0xe3b4('0x32')](0x1f4,_0x586399));}}logger['error'](_0xe3b4('0x47'));return _0x246780(_0x59cf34['error'](0x1f4,_0xe3b4('0x47')));});},'RejectMessage':function(_0x314a8a){var _0xc53a2d=this;return new Promise(function(_0x995fd,_0x57db73){if(_0x314a8a['agent']&&_0x314a8a['agent']['id']){try{if(_0x570a5a[_0xe3b4('0x3f')][_0x314a8a[_0xe3b4('0x3e')]['id']]){_0x570a5a[_0xe3b4('0x3f')][_0x314a8a[_0xe3b4('0x3e')]['id']][_0xe3b4('0x48')]=![];_0x570a5a[_0xe3b4('0x3f')][_0x314a8a[_0xe3b4('0x3e')]['id']][_0xe3b4('0x40')]=undefined;}return _0x995fd({'code':0xc8,'message':_0x314a8a});}catch(_0x5cf169){logger[_0xe3b4('0x32')](_0x5cf169[_0xe3b4('0x3c')]);return _0x57db73(_0xc53a2d['error'](0x1f4,_0x5cf169));}}logger['error'](_0xe3b4('0x47'));return _0x57db73(_0xc53a2d[_0xe3b4('0x32')](0x1f4,_0xe3b4('0x47')));});},'AbandonInteraction':function(_0x310273){var _0x59167c=this;return new Promise(function(_0x4f45d4,_0x361c2d){if(_0x310273[_0xe3b4('0x1c')]&&_0x310273[_0xe3b4('0x13')]&&_0x310273[_0xe3b4('0x13')]['id']){try{var _0x8c6e9d=getId(_0x310273[_0xe3b4('0x1c')],_0x310273['message']?_0x310273[_0xe3b4('0x12')]['id']:0x0,_0x310273['interaction']?_0x310273['interaction']['id']:0x0);if(_0x570a5a[_0xe3b4('0x11')][_0x8c6e9d]){_0x570a5a[_0xe3b4('0x11')][_0x8c6e9d][_0xe3b4('0x38')](_0xe3b4('0x41'));}return _0x4f45d4({'code':0xc8,'message':_0x310273});}catch(_0x2f55c7){logger['error'](_0x2f55c7[_0xe3b4('0x3c')]);return _0x361c2d(_0x59167c[_0xe3b4('0x32')](0x1f4,_0x2f55c7));}}logger['error']('message\x20is\x20empty');return _0x361c2d(_0x59167c[_0xe3b4('0x32')](0x1f4,_0xe3b4('0x47')));});},'AgentCapacity':function(_0x51be2c){var _0xf15e44=this;return new Promise(function(_0x1a0204,_0x1dbeec){if(_0x570a5a[_0xe3b4('0x3f')][_0xe3b4('0x49')](_0x51be2c['id'])){for(var _0x4adb9f in _0x51be2c[_0xe3b4('0x4a')]){if(_0x51be2c['capacity']['hasOwnProperty'](_0x4adb9f)){if(_0x570a5a[_0xe3b4('0x3f')][_0x51be2c['id']][_0xe3b4('0x49')](_0x4adb9f+_0xe3b4('0x4b'))){_0x570a5a[_0xe3b4('0x3f')][_0x51be2c['id']][_0x4adb9f+_0xe3b4('0x4b')]=parseInt(_0x51be2c['capacity'][_0x4adb9f],0xa);}}}_0x570a5a[_0xe3b4('0x3f')][_0x51be2c['id']]['updateRealtime']();return _0x1a0204({'code':0xc8,'message':_0x570a5a[_0xe3b4('0x3f')][_0x51be2c['id']]});}else{return _0x1dbeec(_0xf15e44[_0xe3b4('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2cca6a){return new Promise(function(_0x53b2eb){var _0x41e92a=_[_0xe3b4('0x4c')](_0x570a5a['agents']);if(_0x2cca6a&&_0x2cca6a['id']){var _0x4af4bb=_[_0xe3b4('0x4d')](_0x41e92a,function(_0x4f4f83){return _0x4f4f83['id']===_0x2cca6a['id'];});_0x53b2eb(_0x4af4bb);}else{_0x53b2eb({'count':_0x41e92a[_0xe3b4('0x16')],'rows':_0x41e92a});}});},'ChatQueues':function(){return new Promise(function(_0x344f5d){var _0x3c4657=[];for(var _0x5d2951 in _0x570a5a[_0xe3b4('0x4e')]){if(_0x570a5a[_0xe3b4('0x4e')]['hasOwnProperty'](_0x5d2951)){var _0x27405c=_0x570a5a[_0xe3b4('0x4e')][_0x5d2951];var _0x24ad2e={'id':_0x27405c['id'],'available':_0x27405c[_0xe3b4('0x4f')],'loggedIn':_0x27405c[_0xe3b4('0x50')],'name':_0x27405c[_0xe3b4('0x51')],'paused':_0x27405c[_0xe3b4('0x52')],'waiting':_0x27405c[_0xe3b4('0x53')]};_0x3c4657[_0xe3b4('0x1d')](_0x24ad2e);}}_0x344f5d({'count':_0x3c4657['length'],'rows':_0x3c4657});});},'MailQueues':function(){return new Promise(function(_0x18f2d8){var _0x54004f=[];for(var _0x4bef25 in _0x570a5a['mailQueues']){if(_0x570a5a[_0xe3b4('0x54')][_0xe3b4('0x49')](_0x4bef25)){var _0x2addff=_0x570a5a[_0xe3b4('0x54')][_0x4bef25];var _0x5d8230={'id':_0x2addff['id'],'available':_0x2addff[_0xe3b4('0x4f')],'loggedIn':_0x2addff[_0xe3b4('0x50')],'name':_0x2addff[_0xe3b4('0x51')],'paused':_0x2addff[_0xe3b4('0x52')],'waiting':_0x2addff[_0xe3b4('0x53')]};_0x54004f['push'](_0x5d8230);}}_0x18f2d8({'count':_0x54004f['length'],'rows':_0x54004f});});},'OpenchannelQueues':function(){return new Promise(function(_0x1fe77c){var _0x46ac2c=[];for(var _0x56520a in _0x570a5a['openchannelQueues']){if(_0x570a5a[_0xe3b4('0x55')][_0xe3b4('0x49')](_0x56520a)){var _0x361d41=_0x570a5a[_0xe3b4('0x55')][_0x56520a];var _0x57a7d5={'id':_0x361d41['id'],'available':_0x361d41['available'],'loggedIn':_0x361d41[_0xe3b4('0x50')],'name':_0x361d41[_0xe3b4('0x51')],'paused':_0x361d41['paused'],'waiting':_0x361d41[_0xe3b4('0x53')]};_0x46ac2c[_0xe3b4('0x1d')](_0x57a7d5);}}_0x1fe77c({'count':_0x46ac2c[_0xe3b4('0x16')],'rows':_0x46ac2c});});},'SmsQueues':function(){return new Promise(function(_0xcf84d2){var _0x12fd50=[];for(var _0x48e88f in _0x570a5a['smsQueues']){if(_0x570a5a['smsQueues'][_0xe3b4('0x49')](_0x48e88f)){var _0x301359=_0x570a5a[_0xe3b4('0x56')][_0x48e88f];var _0x189f66={'id':_0x301359['id'],'available':_0x301359['available'],'loggedIn':_0x301359[_0xe3b4('0x50')],'name':_0x301359[_0xe3b4('0x51')],'paused':_0x301359[_0xe3b4('0x52')],'waiting':_0x301359['waiting']};_0x12fd50[_0xe3b4('0x1d')](_0x189f66);}}_0xcf84d2({'count':_0x12fd50['length'],'rows':_0x12fd50});});},'FaxQueues':function(){return new Promise(function(_0x1056b9){var _0x27e2ac=[];for(var _0x577e88 in _0x570a5a[_0xe3b4('0x57')]){if(_0x570a5a[_0xe3b4('0x57')][_0xe3b4('0x49')](_0x577e88)){var _0x4a9ee2=_0x570a5a['faxQueues'][_0x577e88];var _0x5afc18={'id':_0x4a9ee2['id'],'available':_0x4a9ee2[_0xe3b4('0x4f')],'loggedIn':_0x4a9ee2['loggedIn'],'name':_0x4a9ee2[_0xe3b4('0x51')],'paused':_0x4a9ee2['paused'],'waiting':_0x4a9ee2[_0xe3b4('0x53')]};_0x27e2ac['push'](_0x5afc18);}}_0x1056b9({'count':_0x27e2ac[_0xe3b4('0x16')],'rows':_0x27e2ac});});},'WhatsappQueues':function(){return new Promise(function(_0x4500b2){var _0x1f2e46=[];for(var _0x83b27a in _0x570a5a[_0xe3b4('0x58')]){if(_0x570a5a['whatsappQueues'][_0xe3b4('0x49')](_0x83b27a)){var _0x1436a8=_0x570a5a[_0xe3b4('0x58')][_0x83b27a];var _0x2e7e87={'id':_0x1436a8['id'],'available':_0x1436a8['available'],'loggedIn':_0x1436a8[_0xe3b4('0x50')],'name':_0x1436a8['name'],'paused':_0x1436a8[_0xe3b4('0x52')],'waiting':_0x1436a8[_0xe3b4('0x53')]};_0x1f2e46[_0xe3b4('0x1d')](_0x2e7e87);}}_0x4500b2({'count':_0x1f2e46['length'],'rows':_0x1f2e46});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5aebdc){var _0x47d842=_['values'](_0x570a5a[_0xe3b4('0x59')]);_0x5aebdc({'count':_0x47d842['length'],'rows':_0x47d842});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x32de77){var _0x22e759=_['values'](_0x570a5a[_0xe3b4('0x5a')]);_0x32de77({'count':_0x22e759['length'],'rows':_0x22e759});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x293bb7){var _0x282bcc=_[_0xe3b4('0x4c')](_0x570a5a['openchannelQueuesWaitingInteractions']);_0x293bb7({'count':_0x282bcc['length'],'rows':_0x282bcc});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x40ddcb){var _0x3d2f9b=_[_0xe3b4('0x4c')](_0x570a5a[_0xe3b4('0x5b')]);_0x40ddcb({'count':_0x3d2f9b[_0xe3b4('0x16')],'rows':_0x3d2f9b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x319c23){var _0x45c2b1=_[_0xe3b4('0x4c')](_0x570a5a['faxQueuesWaitingInteractions']);_0x319c23({'count':_0x45c2b1[_0xe3b4('0x16')],'rows':_0x45c2b1});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x46ad57){var _0x52dcbe=_['values'](_0x570a5a[_0xe3b4('0x5c')]);_0x46ad57({'count':_0x52dcbe[_0xe3b4('0x16')],'rows':_0x52dcbe});});}};var _0x13a5e6=jayson['server'](_0x33c1ca)[_0xe3b4('0x5d')]();_0x13a5e6['on'](_0xe3b4('0x32'),function(_0xdbb7c6){logger[_0xe3b4('0x32')](JSON[_0xe3b4('0x36')](_0xdbb7c6));return _0x3e4397(_0xdbb7c6);});_0x13a5e6[_0xe3b4('0x5e')](0x232c,_0xe3b4('0x5f'),function(){console[_0xe3b4('0x60')](_0xe3b4('0x61'),0x232c);return _0xbfde36(_0xe3b4('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 2478c2e..910c9c5 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 _0x5c6a=['push','format','indexOf','true','catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','error','stack','util','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','message','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length'];(function(_0x2c4bc3,_0x34f08b){var _0x31ca59=function(_0x2190f0){while(--_0x2190f0){_0x2c4bc3['push'](_0x2c4bc3['shift']());}};_0x31ca59(++_0x34f08b);}(_0x5c6a,0x158));var _0xa5c6=function(_0x4038c0,_0x560682){_0x4038c0=_0x4038c0-0x0;var _0x24bd63=_0x5c6a[_0x4038c0];return _0x24bd63;};'use strict';var util=require(_0xa5c6('0x0'));var BPromise=require('bluebird');var jayson=require(_0xa5c6('0x1'));var _=require(_0xa5c6('0x2'));var logger=require(_0xa5c6('0x3'))(_0xa5c6('0x4'));var client=jayson[_0xa5c6('0x5')][_0xa5c6('0x6')]({'port':0x232a});function request(_0x4a9584,_0x912039){return new BPromise(function(_0x392cbd,_0x1792c8){return client[_0xa5c6('0x7')](_0x4a9584,_0x912039)[_0xa5c6('0x8')](function(_0x116379){if(_0x116379['error']){return _0x1792c8(_0x116379['error'][_0xa5c6('0x9')]);}else{return _0x392cbd(_0x116379[_0xa5c6('0xa')]);}})['catch'](function(_0x16de62){return _0x1792c8(_0x16de62);});});}exports[_0xa5c6('0xb')]=function(_0x245f63,_0x352767,_0x2b2b38){return function(_0x5c1341){if(_0x2b2b38[_0xa5c6('0xc')]&&!_0x2b2b38[_0xa5c6('0xc')][_0x245f63]){logger['info'](_0xa5c6('0xd'),_0x245f63);return _0x5c1341[_0xa5c6('0xe')]();}var _0x4c8ae9=[];for(var _0x26fbf6=0x0;_0x26fbf6<_0x352767[_0xa5c6('0xf')];_0x26fbf6+=0x1){_0x4c8ae9[_0xa5c6('0x10')](request('Command',{'command':util[_0xa5c6('0x11')]('iftime\x20%s',_0x352767[_0x26fbf6])})[_0xa5c6('0x8')](function(_0x5a1c33){return _0x5a1c33&&_0x5a1c33[_0xa5c6('0x9')]&&_0x5a1c33['message'][_0xa5c6('0x12')](_0xa5c6('0x13'))>=0x0?!![]:![];})[_0xa5c6('0x14')](function(_0x270123){logger['error'](_0xa5c6('0x15'),_0x245f63,_0x352767[_0x26fbf6]);}));}BPromise['all'](_0x4c8ae9)['then'](function(_0x53ce4e){var _0x1cb9b2=_[_0xa5c6('0x16')](_0x53ce4e);logger['info'](_0xa5c6('0x17'),_0x245f63,_0x352767[_0xa5c6('0x18')](_0xa5c6('0x19')),_0x1cb9b2);_0x5c1341[_0xa5c6('0x1a')](_0x1cb9b2);})[_0xa5c6('0x14')](function(_0x8debe9){console[_0xa5c6('0x1b')](_0x8debe9);logger[_0xa5c6('0x1c')](_0xa5c6('0x17'),_0x245f63,_0x352767[_0xa5c6('0x18')](_0xa5c6('0x19')),_0x8debe9[_0xa5c6('0x1d')]);_0x5c1341[_0xa5c6('0xe')]();});};}; \ No newline at end of file +var _0xca42=['join','\x20|\x20','when','stop','util','bluebird','lodash','../../../config/logger','routing','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','iftime\x20%s','true','all','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x1fada8,_0x3828c5){var _0x2ffd58=function(_0x504c32){while(--_0x504c32){_0x1fada8['push'](_0x1fada8['shift']());}};_0x2ffd58(++_0x3828c5);}(_0xca42,0xf7));var _0x2ca4=function(_0x38cf42,_0x506cf8){_0x38cf42=_0x38cf42-0x0;var _0x3002c6=_0xca42[_0x38cf42];return _0x3002c6;};'use strict';var util=require(_0x2ca4('0x0'));var BPromise=require(_0x2ca4('0x1'));var jayson=require('jayson/promise');var _=require(_0x2ca4('0x2'));var logger=require(_0x2ca4('0x3'))(_0x2ca4('0x4'));var client=jayson['client'][_0x2ca4('0x5')]({'port':0x232a});function request(_0x482eec,_0x3690a2){return new BPromise(function(_0x32a322,_0x586965){return client[_0x2ca4('0x6')](_0x482eec,_0x3690a2)[_0x2ca4('0x7')](function(_0x16aba1){if(_0x16aba1[_0x2ca4('0x8')]){return _0x586965(_0x16aba1['error'][_0x2ca4('0x9')]);}else{return _0x32a322(_0x16aba1[_0x2ca4('0xa')]);}})[_0x2ca4('0xb')](function(_0x19f852){return _0x586965(_0x19f852);});});}exports[_0x2ca4('0xc')]=function(_0x4344f5,_0x16366f,_0x2bfd4a){return function(_0x406074){if(_0x2bfd4a[_0x2ca4('0xd')]&&!_0x2bfd4a['rules'][_0x4344f5]){logger[_0x2ca4('0xe')](_0x2ca4('0xf'),_0x4344f5);return _0x406074['stop']();}var _0x1b09b2=[];for(var _0x2478ea=0x0;_0x2478ea<_0x16366f['length'];_0x2478ea+=0x1){_0x1b09b2[_0x2ca4('0x10')](request(_0x2ca4('0x11'),{'command':util[_0x2ca4('0x12')](_0x2ca4('0x13'),_0x16366f[_0x2478ea])})[_0x2ca4('0x7')](function(_0x474291){return _0x474291&&_0x474291['message']&&_0x474291[_0x2ca4('0x9')]['indexOf'](_0x2ca4('0x14'))>=0x0?!![]:![];})[_0x2ca4('0xb')](function(_0x53e55d){logger[_0x2ca4('0x8')]('[%s][INTERVAL]\x20%s',_0x4344f5,_0x16366f[_0x2478ea]);}));}BPromise[_0x2ca4('0x15')](_0x1b09b2)[_0x2ca4('0x7')](function(_0xc836e9){var _0x433c3f=_['some'](_0xc836e9);logger['info'](_0x2ca4('0x16'),_0x4344f5,_0x16366f[_0x2ca4('0x17')](_0x2ca4('0x18')),_0x433c3f);_0x406074[_0x2ca4('0x19')](_0x433c3f);})[_0x2ca4('0xb')](function(_0x341a1d){console['log'](_0x341a1d);logger[_0x2ca4('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x4344f5,_0x16366f[_0x2ca4('0x17')](_0x2ca4('0x18')),_0x341a1d['stack']);_0x406074[_0x2ca4('0x1a')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 1f61779..508584b 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 _0x16d2=['blind','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','complete','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','called','connectedlinename','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','now','timeout','holdtime','ringtime','push','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x16d2,0x123));var _0x216d=function(_0x36fe1e,_0x175199){_0x36fe1e=_0x36fe1e-0x0;var _0x3368ef=_0x16d2[_0x36fe1e];return _0x3368ef;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var utils=require(_0x216d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x371e93,_0x1688cc){utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x5'),_0x371e93[_0x216d('0x6')],_0x371e93['channel'],_0x371e93[_0x216d('0x7')],_0x371e93[_0x216d('0x8')],_0x371e93[_0x216d('0x9')],_0x371e93[_0x216d('0xa')],_0x371e93[_0x216d('0xb')],_0x371e93[_0x216d('0xc')]));if(_0x371e93[_0x216d('0x7')]){utils[_0x216d('0xd')](_0x371e93['queue'])[_0x216d('0xe')](function(_0x1aeb55){if(_0x1aeb55){_0x371e93[_0x216d('0xf')]=_0x1aeb55[_0x216d('0xf')];_0x371e93[_0x216d('0x10')]=_0x371e93[_0x216d('0x11')]?_0x1aeb55['acw']:![];_0x371e93[_0x216d('0x12')]=_0x371e93['agentacw']?_0x1aeb55[_0x216d('0x13')]:0x0;}utils[_0x216d('0x14')](_0x216d('0x15'),_0x371e93);});}else{utils[_0x216d('0x14')](_0x216d('0x15'),_0x371e93);}if(_0x1688cc){delete transfers[_0x371e93[_0x216d('0x6')]];}else{delete agents[_0x371e93['destuniqueid']];}}exports[_0x216d('0x16')]=function(_0x4c07d0){try{utils[_0x216d('0x17')](util[_0x216d('0x4')]('[%s][agents][agentcalled]',_0x4c07d0[_0x216d('0x6')]),_0x4c07d0);agents[_0x4c07d0[_0x216d('0x18')]]=_0x4c07d0;agents[_0x4c07d0['destuniqueid']][_0x216d('0x19')]=utils['now']();agents[_0x4c07d0[_0x216d('0x18')]][_0x216d('0xc')]=_0x216d('0x1a');agents[_0x4c07d0[_0x216d('0x18')]][_0x216d('0xb')]=null;agents[_0x4c07d0[_0x216d('0x18')]][_0x216d('0x1b')]=null;utils[_0x216d('0x3')](util[_0x216d('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4c07d0[_0x216d('0x6')],agents[_0x4c07d0['destuniqueid']]['membername'],_0x4c07d0[_0x216d('0x18')]));}catch(_0x35dbe8){utils['error'](util[_0x216d('0x4')](_0x216d('0x1c'),_0x4c07d0['uniqueid']),_0x35dbe8);}};exports[_0x216d('0x1d')]=function(_0x13b8e0){try{if(!_[_0x216d('0x1e')](agents[_0x13b8e0[_0x216d('0x18')]])){utils['debug'](util[_0x216d('0x4')](_0x216d('0x1f'),_0x13b8e0[_0x216d('0x6')]),_0x13b8e0);utils[_0x216d('0x3')](util[_0x216d('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x13b8e0[_0x216d('0x6')],agents[_0x13b8e0[_0x216d('0x18')]][_0x216d('0x8')],_0x13b8e0[_0x216d('0x18')]));agents[_0x13b8e0[_0x216d('0x18')]]['agentringnoanswer']=!![];agents[_0x13b8e0[_0x216d('0x18')]][_0x216d('0x20')]=utils[_0x216d('0x21')]();agents[_0x13b8e0['destuniqueid']]['lastevent']='timeout';agents[_0x13b8e0['destuniqueid']]['reason']=_0x216d('0x22');agents[_0x13b8e0[_0x216d('0x18')]][_0x216d('0x23')]=_0x13b8e0[_0x216d('0x24')]?parseInt(_0x13b8e0[_0x216d('0x24')])/0x3e8:0x0;agents[_0x13b8e0['destuniqueid']]['talktime']=0x0;unanswered[_0x216d('0x25')](_0x13b8e0['destuniqueid']);}}catch(_0x23d1c3){utils[_0x216d('0x26')](util[_0x216d('0x4')](_0x216d('0x1f'),_0x13b8e0[_0x216d('0x6')]),_0x23d1c3);}};exports[_0x216d('0x27')]=function(_0x28fcc2){try{_[_0x216d('0x28')](agents,function(_0x169cfa,_0x28f56a){if(_0x169cfa[_0x216d('0x6')]==_0x28fcc2[_0x216d('0x6')]&&!_[_0x216d('0x29')](unanswered,_0x169cfa['destuniqueid'])){utils[_0x216d('0x17')](util[_0x216d('0x4')](_0x216d('0x2a'),_0x28fcc2['uniqueid']),_0x28fcc2);utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x2b'),_0x28fcc2[_0x216d('0x6')],_0x169cfa['membername'],_0x169cfa[_0x216d('0x18')]));_0x169cfa[_0x216d('0x1d')]=!![];_0x169cfa[_0x216d('0x20')]=utils[_0x216d('0x21')]();_0x169cfa[_0x216d('0xc')]=_0x216d('0x2c');_0x169cfa[_0x216d('0x2d')]=_0x216d('0x2c');_0x169cfa[_0x216d('0x23')]=_0x28fcc2[_0x216d('0x23')];_0x169cfa[_0x216d('0x2e')]=0x0;writeDB(_0x169cfa);}});}catch(_0x4a2caa){utils[_0x216d('0x26')](util[_0x216d('0x4')](_0x216d('0x2a'),_0x28fcc2['uniqueid']),_0x4a2caa);}};exports[_0x216d('0x2f')]=function(_0x2e86f9){try{if(agents[_0x2e86f9['destuniqueid']]){utils[_0x216d('0x17')](util['format']('[%s][agents][agentconnect]',_0x2e86f9[_0x216d('0x6')]),_0x2e86f9);utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x30'),_0x2e86f9['uniqueid'],agents[_0x2e86f9['destuniqueid']]['membername'],_0x2e86f9[_0x216d('0x18')]));agents[_0x2e86f9[_0x216d('0x18')]]['agentconnectAt']=utils[_0x216d('0x21')]();agents[_0x2e86f9[_0x216d('0x18')]]['connectedlinenum']=_0x2e86f9[_0x216d('0xb')];agents[_0x2e86f9[_0x216d('0x18')]][_0x216d('0x1b')]=_0x2e86f9[_0x216d('0x1b')];agents[_0x2e86f9[_0x216d('0x18')]][_0x216d('0x23')]=_0x2e86f9[_0x216d('0x24')];agents[_0x2e86f9[_0x216d('0x18')]]['lastevent']='connect';_[_0x216d('0x28')](agents,function(_0x2be24f,_0x504a34){if(_0x2be24f[_0x216d('0x18')]!=_0x2e86f9[_0x216d('0x18')]&&_0x2be24f[_0x216d('0x6')]==_0x2e86f9['uniqueid']){_0x2be24f[_0x216d('0x2e')]=0x0;_0x2be24f[_0x216d('0x23')]=_0x2e86f9[_0x216d('0x24')];_0x2be24f[_0x216d('0x1d')]=!![];_0x2be24f['agentringnoanswerAt']=utils[_0x216d('0x21')]();_0x2be24f[_0x216d('0xc')]='answered_elsewhere';_0x2be24f[_0x216d('0x2d')]=_0x216d('0x31');_0x2be24f['answeredelsewheredestinationuniqueid']=_0x2e86f9['destuniqueid'];_0x2be24f[_0x216d('0x32')]=_0x2e86f9[_0x216d('0x8')];writeDB(_0x2be24f);}});}}catch(_0x3c491e){utils['error'](util[_0x216d('0x4')]('[%s][agents][agentconnect]',_0x2e86f9['uniqueid']),_0x3c491e);}};exports[_0x216d('0x11')]=function(_0x43336e){try{if(!_[_0x216d('0x1e')](agents[_0x43336e['destuniqueid']])){utils[_0x216d('0x17')](util['format'](_0x216d('0x33'),_0x43336e[_0x216d('0x6')]),_0x43336e);utils[_0x216d('0x3')](util['format'](_0x216d('0x34'),_0x43336e[_0x216d('0x6')],agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x8')],_0x43336e['destuniqueid']));agents[_0x43336e['destuniqueid']]['agentcomplete']=!![];agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x35')]=utils[_0x216d('0x21')]();agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x2e')]=utils[_0x216d('0x36')](agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x35')],agents[_0x43336e['destuniqueid']][_0x216d('0x37')]);agents[_0x43336e[_0x216d('0x18')]][_0x216d('0x2d')]=_0x43336e[_0x216d('0x2d')];agents[_0x43336e['destuniqueid']][_0x216d('0xc')]='complete';writeDB(agents[_0x43336e[_0x216d('0x18')]]);}}catch(_0x36179){utils[_0x216d('0x26')](util['format']('[%s][agents][agentcomplete]',_0x43336e[_0x216d('0x6')]),_0x36179);}};exports[_0x216d('0x38')]=function(_0x3932a3){try{if(!_[_0x216d('0x1e')](agents[_0x3932a3[_0x216d('0x39')]])){utils[_0x216d('0x17')](util['format']('[%s][agents][blindtransfer]',_0x3932a3[_0x216d('0x6')]),_0x3932a3);utils['info'](util[_0x216d('0x4')](_0x216d('0x3a'),_0x3932a3['uniqueid'],agents[_0x3932a3['transfereruniqueid']]['membername'],agents[_0x3932a3['transfereruniqueid']][_0x216d('0x6')]));agents[_0x3932a3[_0x216d('0x39')]][_0x216d('0x3b')]=!![];agents[_0x3932a3[_0x216d('0x39')]][_0x216d('0x3c')]=_0x216d('0x3d');agents[_0x3932a3[_0x216d('0x39')]]['transferexten']=_0x3932a3[_0x216d('0x3e')];agents[_0x3932a3[_0x216d('0x39')]][_0x216d('0x3f')]=agents[_0x3932a3['transfereruniqueid']][_0x216d('0x6')];}}catch(_0x10fe2e){utils[_0x216d('0x26')](util[_0x216d('0x4')]('[%s][agents][blindtransfer]',_0x3932a3[_0x216d('0x6')]),_0x10fe2e);}};exports[_0x216d('0x40')]=function(_0x18a0bf){try{utils[_0x216d('0x17')](util['format'](_0x216d('0x41'),_0x18a0bf[_0x216d('0x42')]),_0x18a0bf);if(_0x18a0bf['origtransfereruniqueid']==_0x18a0bf[_0x216d('0x43')]){if(!_['isNil'](agents[_0x18a0bf[_0x216d('0x44')]])){utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x45'),_0x18a0bf[_0x216d('0x42')],agents[_0x18a0bf[_0x216d('0x44')]][_0x216d('0x8')]));agents[_0x18a0bf[_0x216d('0x44')]][_0x216d('0x3b')]=!![];agents[_0x18a0bf['secondtransfereruniqueid']][_0x216d('0x3c')]=_0x216d('0x46');agents[_0x18a0bf['secondtransfereruniqueid']][_0x216d('0x47')]=_0x18a0bf[_0x216d('0x48')];agents[_0x18a0bf['secondtransfereruniqueid']]['transferuniqueid']=_0x18a0bf[_0x216d('0x42')];}if(_0x18a0bf['transfereeuniqueid']&&agents[_0x18a0bf[_0x216d('0x49')]]){agents[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x4a')]=0x1;transfers[_0x18a0bf['transfereeuniqueid']]=_[_0x216d('0x4b')](agents[_0x18a0bf['transfereeuniqueid']]);transfers[_0x18a0bf['transfereeuniqueid']][_0x216d('0xa')]=agents[_0x18a0bf[_0x216d('0x44')]]['calleridnum'];transfers[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x4c')]=agents[_0x18a0bf[_0x216d('0x44')]][_0x216d('0x4c')];transfers[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x19')]=utils['now']();transfers[_0x18a0bf['transfereeuniqueid']][_0x216d('0x37')]=utils[_0x216d('0x21')]();transfers[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x23')]=0x0;transfers[_0x18a0bf[_0x216d('0x49')]][_0x216d('0x4a')]=0x2;}}else if(_0x18a0bf[_0x216d('0x44')]==_0x18a0bf[_0x216d('0x4d')]){if(!_[_0x216d('0x1e')](agents[_0x18a0bf[_0x216d('0x42')]])){utils[_0x216d('0x3')](util[_0x216d('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x18a0bf['origtransfereruniqueid'],agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0x8')]));agents[_0x18a0bf['origtransfereruniqueid']][_0x216d('0x3b')]=!![];agents[_0x18a0bf['origtransfereruniqueid']]['transfertype']=_0x216d('0x46');agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0x47')]=_0x18a0bf[_0x216d('0x4e')];agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0x3f')]=_0x18a0bf[_0x216d('0x44')];}if(_0x18a0bf[_0x216d('0x4f')]&&agents[_0x18a0bf[_0x216d('0x4f')]]){agents[_0x18a0bf[_0x216d('0x4f')]][_0x216d('0x4a')]=0x1;transfers[_0x18a0bf[_0x216d('0x4f')]]=_[_0x216d('0x4b')](agents[_0x18a0bf[_0x216d('0x4f')]]);transfers[_0x18a0bf[_0x216d('0x4f')]][_0x216d('0xa')]=agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0xa')];transfers[_0x18a0bf[_0x216d('0x4f')]][_0x216d('0x4c')]=agents[_0x18a0bf[_0x216d('0x42')]][_0x216d('0x4c')];transfers[_0x18a0bf['transfertargetuniqueid']][_0x216d('0x19')]=utils['now']();transfers[_0x18a0bf[_0x216d('0x4f')]]['agentconnectAt']=utils[_0x216d('0x21')]();transfers[_0x18a0bf[_0x216d('0x4f')]]['holdtime']=0x0;transfers[_0x18a0bf[_0x216d('0x4f')]][_0x216d('0x4a')]=0x2;}}}catch(_0x3729b6){utils[_0x216d('0x26')](util[_0x216d('0x4')](_0x216d('0x41'),_0x18a0bf[_0x216d('0x42')]),_0x3729b6);}};exports[_0x216d('0x50')]=function(_0x2727c7){try{utils['debug'](util[_0x216d('0x4')](_0x216d('0x51'),_0x2727c7[_0x216d('0x6')]),_0x2727c7);if(agents[_0x2727c7['uniqueid']]&&agents[_0x2727c7['uniqueid']]['reason']==='timeout'){if(_0x2727c7[_0x216d('0x52')]==='21'){agents[_0x2727c7['uniqueid']][_0x216d('0x2d')]=_0x216d('0x53');agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]=_0x216d('0x53');}utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x54'),_0x2727c7[_0x216d('0x6')],agents[_0x2727c7['uniqueid']][_0x216d('0x8')],agents[_0x2727c7[_0x216d('0x6')]]['reason'],agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]));writeDB(agents[_0x2727c7[_0x216d('0x6')]]);var _0x1650fd=unanswered[_0x216d('0x55')](_0x2727c7[_0x216d('0x6')]);if(_0x1650fd>-0x1){unanswered['splice'](_0x1650fd,0x1);}}if(transfers[_0x2727c7['uniqueid']]){transfers[_0x2727c7[_0x216d('0x6')]]['agentcomplete']=!![];transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0x35')]=utils[_0x216d('0x21')]();transfers[_0x2727c7['uniqueid']]['talktime']=utils['diffTime'](transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0x35')],transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0x37')]);transfers[_0x2727c7['uniqueid']][_0x216d('0x2d')]=_0x216d('0x56');transfers[_0x2727c7[_0x216d('0x6')]]['lastevent']='complete';utils[_0x216d('0x3')](util[_0x216d('0x4')](_0x216d('0x54'),_0x2727c7[_0x216d('0x6')],transfers[_0x2727c7[_0x216d('0x6')]]['membername'],transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0x2d')],transfers[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]));writeDB(transfers[_0x2727c7['uniqueid']],!![]);}if(agents[_0x2727c7[_0x216d('0x6')]]&&agents[_0x2727c7['uniqueid']][_0x216d('0x37')]){agents[_0x2727c7['uniqueid']][_0x216d('0x11')]=!![];agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0x35')]=utils[_0x216d('0x21')]();agents[_0x2727c7[_0x216d('0x6')]]['talktime']=utils[_0x216d('0x36')](agents[_0x2727c7['uniqueid']]['agentcompleteAt'],agents[_0x2727c7['uniqueid']]['agentconnectAt']);agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0x2d')]=agents[_0x2727c7[_0x216d('0x6')]]['transfer']?'transfer':_0x216d('0x56');agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]=_0x216d('0x57');utils[_0x216d('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2727c7[_0x216d('0x6')],agents[_0x2727c7['uniqueid']][_0x216d('0x8')],agents[_0x2727c7['uniqueid']][_0x216d('0x2d')],agents[_0x2727c7[_0x216d('0x6')]][_0x216d('0xc')]));writeDB(agents[_0x2727c7[_0x216d('0x6')]]);}}catch(_0x4899d1){utils['error'](util[_0x216d('0x4')](_0x216d('0x51'),_0x2727c7[_0x216d('0x6')]),_0x4899d1);}}; \ No newline at end of file +var _0x76dc=['origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','agent','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','uniqueid','membername','interface','calleridnum','queue','getVoiceQueueByName','type','agentcomplete','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','lastevent','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','talktime','queuecallerabandon','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheremembername','isNil','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid'];(function(_0xaa37af,_0x9c97e7){var _0x56d335=function(_0x32ce3d){while(--_0x32ce3d){_0xaa37af['push'](_0xaa37af['shift']());}};_0x56d335(++_0x9c97e7);}(_0x76dc,0x1f2));var _0xc76d=function(_0x5d888a,_0x25b52c){_0x5d888a=_0x5d888a-0x0;var _0x1e1c56=_0x76dc[_0x5d888a];return _0x1e1c56;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var utils=require(_0xc76d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x26e85e,_0x49c651){utils[_0xc76d('0x3')](util[_0xc76d('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x26e85e[_0xc76d('0x5')],_0x26e85e['channel'],_0x26e85e['queue'],_0x26e85e[_0xc76d('0x6')],_0x26e85e[_0xc76d('0x7')],_0x26e85e[_0xc76d('0x8')],_0x26e85e['connectedlinenum'],_0x26e85e['lastevent']));if(_0x26e85e[_0xc76d('0x9')]){utils[_0xc76d('0xa')](_0x26e85e[_0xc76d('0x9')])['then'](function(_0x570197){if(_0x570197){_0x26e85e[_0xc76d('0xb')]=_0x570197[_0xc76d('0xb')];_0x26e85e['agentacw']=_0x26e85e[_0xc76d('0xc')]?_0x570197['acw']:![];_0x26e85e[_0xc76d('0xd')]=_0x26e85e[_0xc76d('0xe')]?_0x570197[_0xc76d('0xf')]:0x0;}utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);});}else{utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);}if(_0x49c651){delete transfers[_0x26e85e[_0xc76d('0x5')]];}else{delete agents[_0x26e85e[_0xc76d('0x12')]];}}exports[_0xc76d('0x13')]=function(_0x1a7b47){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x1a7b47);agents[_0x1a7b47[_0xc76d('0x12')]]=_0x1a7b47;agents[_0x1a7b47[_0xc76d('0x12')]]['agentcalledAt']=utils[_0xc76d('0x16')]();agents[_0x1a7b47[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x18');agents[_0x1a7b47['destuniqueid']][_0xc76d('0x19')]=null;agents[_0x1a7b47['destuniqueid']]['connectedlinename']=null;utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1a'),_0x1a7b47[_0xc76d('0x5')],agents[_0x1a7b47[_0xc76d('0x12')]]['membername'],_0x1a7b47[_0xc76d('0x12')]));}catch(_0x361f42){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x361f42);}};exports[_0xc76d('0x1c')]=function(_0x324db7){try{if(!_['isNil'](agents[_0x324db7[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x1d'),_0x324db7[_0xc76d('0x5')]),_0x324db7);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1e'),_0x324db7[_0xc76d('0x5')],agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x6')],_0x324db7['destuniqueid']));agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x1c')]=!![];agents[_0x324db7['destuniqueid']][_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();agents[_0x324db7['destuniqueid']][_0xc76d('0x17')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x21')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x22')]=_0x324db7['ringtime']?parseInt(_0x324db7['ringtime'])/0x3e8:0x0;agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x23')]=0x0;unanswered['push'](_0x324db7[_0xc76d('0x12')]);}}catch(_0x52a79a){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x1d'),_0x324db7['uniqueid']),_0x52a79a);}};exports[_0xc76d('0x24')]=function(_0x18a7fa){try{_['forIn'](agents,function(_0x3d4076,_0x1c68f3){if(_0x3d4076[_0xc76d('0x5')]==_0x18a7fa[_0xc76d('0x5')]&&!_['includes'](unanswered,_0x3d4076[_0xc76d('0x12')])){utils['debug'](util[_0xc76d('0x4')]('[%s][agents][queuecallerabandon]',_0x18a7fa[_0xc76d('0x5')]),_0x18a7fa);utils[_0xc76d('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x18a7fa['uniqueid'],_0x3d4076['membername'],_0x3d4076[_0xc76d('0x12')]));_0x3d4076[_0xc76d('0x1c')]=!![];_0x3d4076[_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();_0x3d4076[_0xc76d('0x17')]='abandoned';_0x3d4076[_0xc76d('0x21')]='abandoned';_0x3d4076[_0xc76d('0x22')]=_0x18a7fa['holdtime'];_0x3d4076[_0xc76d('0x23')]=0x0;writeDB(_0x3d4076);}});}catch(_0x2332f5){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x25'),_0x18a7fa['uniqueid']),_0x2332f5);}};exports[_0xc76d('0x26')]=function(_0x371306){try{if(agents[_0x371306[_0xc76d('0x12')]]){utils['debug'](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x371306);utils['info'](util[_0xc76d('0x4')](_0xc76d('0x28'),_0x371306[_0xc76d('0x5')],agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x6')],_0x371306[_0xc76d('0x12')]));agents[_0x371306['destuniqueid']]['agentconnectAt']=utils[_0xc76d('0x16')]();agents[_0x371306['destuniqueid']][_0xc76d('0x19')]=_0x371306[_0xc76d('0x19')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x29')]=_0x371306['connectedlinename'];agents[_0x371306['destuniqueid']][_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x2b');_['forIn'](agents,function(_0x42404c,_0xb264b0){if(_0x42404c[_0xc76d('0x12')]!=_0x371306[_0xc76d('0x12')]&&_0x42404c[_0xc76d('0x5')]==_0x371306[_0xc76d('0x5')]){_0x42404c[_0xc76d('0x23')]=0x0;_0x42404c[_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];_0x42404c[_0xc76d('0x1c')]=!![];_0x42404c['agentringnoanswerAt']=utils['now']();_0x42404c[_0xc76d('0x17')]=_0xc76d('0x2c');_0x42404c[_0xc76d('0x21')]=_0xc76d('0x2c');_0x42404c['answeredelsewheredestinationuniqueid']=_0x371306['destuniqueid'];_0x42404c[_0xc76d('0x2d')]=_0x371306[_0xc76d('0x6')];writeDB(_0x42404c);}});}}catch(_0x3e471e){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x3e471e);}};exports[_0xc76d('0xc')]=function(_0x50e922){try{if(!_[_0xc76d('0x2e')](agents[_0x50e922[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][agentcomplete]',_0x50e922['uniqueid']),_0x50e922);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x50e922['uniqueid'],agents[_0x50e922['destuniqueid']][_0xc76d('0x6')],_0x50e922[_0xc76d('0x12')]));agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0xc')]=!![];agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0x50e922[_0xc76d('0x12')]]['talktime']=utils[_0xc76d('0x30')](agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')],agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x31')]);agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x21')]=_0x50e922[_0xc76d('0x21')];agents[_0x50e922[_0xc76d('0x12')]]['lastevent']='complete';writeDB(agents[_0x50e922[_0xc76d('0x12')]]);}}catch(_0x170f47){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x32'),_0x50e922['uniqueid']),_0x170f47);}};exports[_0xc76d('0x33')]=function(_0x1ede13){try{if(!_['isNil'](agents[_0x1ede13['transfereruniqueid']])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][blindtransfer]',_0x1ede13[_0xc76d('0x5')]),_0x1ede13);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x34'),_0x1ede13[_0xc76d('0x5')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x6')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x5')]));agents[_0x1ede13[_0xc76d('0x35')]]['transfer']=!![];agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x36')]=_0xc76d('0x37');agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x38')]=_0x1ede13[_0xc76d('0x39')];agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x3a')]=agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x5')];}}catch(_0x12c972){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x3b'),_0x1ede13['uniqueid']),_0x12c972);}};exports['attendedtransfer']=function(_0x5bec6c){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x3c'),_0x5bec6c[_0xc76d('0x3d')]),_0x5bec6c);if(_0x5bec6c[_0xc76d('0x3d')]==_0x5bec6c[_0xc76d('0x3e')]){if(!_['isNil'](agents[_0x5bec6c[_0xc76d('0x3f')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x6')]));agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x41')]=!![];agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x36')]=_0xc76d('0x42');agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x38')]=_0x5bec6c[_0xc76d('0x43')];agents[_0x5bec6c['secondtransfereruniqueid']]['transferuniqueid']=_0x5bec6c[_0xc76d('0x3d')];}if(_0x5bec6c['transfereeuniqueid']&&agents[_0x5bec6c[_0xc76d('0x44')]]){agents[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x45')]=0x1;transfers[_0x5bec6c[_0xc76d('0x44')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x44')]]);transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x8')];transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x47')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x47')];transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x31')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x44')]]['agententerreason']=0x2;}}else if(_0x5bec6c['secondtransfereruniqueid']==_0x5bec6c['secondtransfererlinkedid']){if(!_[_0xc76d('0x2e')](agents[_0x5bec6c[_0xc76d('0x3d')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x6')]));agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x41')]=!![];agents[_0x5bec6c['origtransfereruniqueid']]['transfertype']=_0xc76d('0x42');agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x38')]=_0x5bec6c['secondtransfererexten'];agents[_0x5bec6c[_0xc76d('0x3d')]]['transferuniqueid']=_0x5bec6c['secondtransfereruniqueid'];}if(_0x5bec6c['transfertargetuniqueid']&&agents[_0x5bec6c[_0xc76d('0x49')]]){agents[_0x5bec6c[_0xc76d('0x49')]]['agententerreason']=0x1;transfers[_0x5bec6c[_0xc76d('0x49')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x49')]]);transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x8')];transfers[_0x5bec6c['transfertargetuniqueid']]['calleridname']=agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x47')];transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]]['agentconnectAt']=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x45')]=0x2;}}}catch(_0x2af760){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')]('[%s][agents][attendedtransfer]',_0x5bec6c[_0xc76d('0x3d')]),_0x2af760);}};exports['hangup']=function(_0xa9f2e8){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x4a'),_0xa9f2e8['uniqueid']),_0xa9f2e8);if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8['uniqueid']]['reason']===_0xc76d('0x20')){if(_0xa9f2e8[_0xc76d('0x4b')]==='21'){agents[_0xa9f2e8['uniqueid']][_0xc76d('0x21')]=_0xc76d('0x4c');agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]=_0xc76d('0x4c');}utils['info'](util[_0xc76d('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]]['membername'],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]));writeDB(agents[_0xa9f2e8[_0xc76d('0x5')]]);var _0x277382=unanswered['indexOf'](_0xa9f2e8[_0xc76d('0x5')]);if(_0x277382>-0x1){unanswered['splice'](_0x277382,0x1);}}if(transfers[_0xa9f2e8['uniqueid']]){transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];transfers[_0xa9f2e8['uniqueid']][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=_0xc76d('0x4d');transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]=_0xc76d('0x4e');utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],transfers[_0xa9f2e8[_0xc76d('0x5')]]['membername'],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]));writeDB(transfers[_0xa9f2e8[_0xc76d('0x5')]],!![]);}if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]){agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x41')]?'transfer':_0xc76d('0x4d');agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']=_0xc76d('0x4e');utils[_0xc76d('0x3')](util['format'](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x6')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']));writeDB(agents[_0xa9f2e8['uniqueid']]);}}catch(_0xe6a1dc){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x4a'),_0xa9f2e8[_0xc76d('0x5')]),_0xe6a1dc);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b8b0653..366d764 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 _0x58a0=['xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','lastIndexOf','includes','noop','execif','[%s][calls][newexten]','lodash','./utils','NO\x20ANSWER','BUSY','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','calleridnum','connectedlinenum','lastevent','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','accountcode','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','billableseconds','diffTime','error','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview'];(function(_0x1c45a0,_0x46db56){var _0x15b169=function(_0x202681){while(--_0x202681){_0x1c45a0['push'](_0x1c45a0['shift']());}};_0x15b169(++_0x46db56);}(_0x58a0,0x83));var _0x058a=function(_0x31880d,_0x4f0ff3){_0x31880d=_0x31880d-0x0;var _0x423823=_0x58a0[_0x31880d];return _0x423823;};'use strict';var _=require(_0x058a('0x0'));var util=require('util');var utils=require(_0x058a('0x1'));var dispositions=[_0x058a('0x2'),'FAILED','FAILED','NO\x20ANSWER',_0x058a('0x2'),_0x058a('0x2'),'ANSWERED',_0x058a('0x3'),_0x058a('0x4'),_0x058a('0x4'),_0x058a('0x4')];var channels={};function writeDB(_0x299bab){utils[_0x058a('0x5')](util[_0x058a('0x6')](_0x058a('0x7'),_0x299bab[_0x058a('0x8')],_0x299bab['channel'],_0x299bab[_0x058a('0x9')],_0x299bab['membername'],_0x299bab['interface'],_0x299bab[_0x058a('0xa')],_0x299bab[_0x058a('0xb')],_0x299bab[_0x058a('0xc')]));if(_0x299bab['accountcode']){utils[_0x058a('0xd')](_0x299bab['accountcode'])[_0x058a('0xe')](function(_0x55ad83){if(_0x55ad83){_0x299bab[_0x058a('0xf')]=_0x55ad83['id'];}utils[_0x058a('0x10')]('CreateVoiceCallReport',_0x299bab);});}else{utils[_0x058a('0x10')](_0x058a('0x11'),_0x299bab);}if(channels[_0x299bab[_0x058a('0x8')]]){delete channels[_0x299bab['uniqueid']];}}exports[_0x058a('0x12')]=function(_0x1d1124){try{utils[_0x058a('0x13')](util[_0x058a('0x6')]('[%s][calls][newchannel]',_0x1d1124[_0x058a('0x8')]),_0x1d1124);if(_0x1d1124[_0x058a('0x8')]==_0x1d1124[_0x058a('0x14')]&&_0x1d1124[_0x058a('0x15')]!=_0x058a('0x16')){utils['info'](util[_0x058a('0x6')](_0x058a('0x17'),_0x1d1124[_0x058a('0x8')],_0x1d1124['context'],_0x1d1124[_0x058a('0x18')]));channels[_0x1d1124[_0x058a('0x8')]]={'uniqueid':_0x1d1124[_0x058a('0x8')],'accountcode':_0x1d1124['accountcode'],'source':_0x1d1124['calleridnum'],'destination':_0x1d1124[_0x058a('0x18')],'destinationcontext':_0x1d1124[_0x058a('0x19')],'channel':_0x1d1124[_0x058a('0x15')],'starttime':utils[_0x058a('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x058a('0x1b')};}}catch(_0x4f8052){utils['error'](util[_0x058a('0x6')]('[%s][calls][newchannel]',_0x1d1124[_0x058a('0x8')]),_0x4f8052);}};exports['newstate']=function(_0x423b21){try{utils[_0x058a('0x13')](util[_0x058a('0x6')](_0x058a('0x1c'),_0x423b21['uniqueid']),_0x423b21);if(!_[_0x058a('0x1d')](channels[_0x423b21[_0x058a('0x8')]])&&_0x423b21[_0x058a('0x1e')]==0x6){utils['info'](util[_0x058a('0x6')](_0x058a('0x1f'),_0x423b21['uniqueid'],_0x423b21['context'],_0x423b21['channel']));if(_[_0x058a('0x1d')](channels[_0x423b21['uniqueid']][_0x058a('0x20')])){channels[_0x423b21[_0x058a('0x8')]]['systemanswertime']=utils[_0x058a('0x1a')]();}}else if(!_['isNil'](channels[_0x423b21['linkedid']])&&_0x423b21[_0x058a('0x1e')]==0x6&&_0x423b21['context']!=_0x058a('0x21')){utils[_0x058a('0x5')](util[_0x058a('0x6')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x423b21['uniqueid'],_0x423b21[_0x058a('0x14')],_0x423b21[_0x058a('0x19')],_0x423b21[_0x058a('0x15')]));channels[_0x423b21[_0x058a('0x14')]][_0x058a('0x22')]=_0x423b21[_0x058a('0x22')];channels[_0x423b21[_0x058a('0x14')]][_0x058a('0x23')]=_0x423b21[_0x058a('0x15')];if(_[_0x058a('0x1d')](channels[_0x423b21[_0x058a('0x14')]][_0x058a('0x24')])){channels[_0x423b21['linkedid']][_0x058a('0x24')]=utils[_0x058a('0x1a')]();}channels[_0x423b21[_0x058a('0x14')]][_0x058a('0x25')]=dispositions[_[_0x058a('0x26')](_0x423b21[_0x058a('0x1e')])]||_0x058a('0x27');}}catch(_0x4741f8){utils['error'](util['format'](_0x058a('0x1c'),_0x423b21['uniqueid']),_0x4741f8);}};exports[_0x058a('0x28')]=function(_0x48ed4e){try{if(!_[_0x058a('0x1d')](channels[_0x48ed4e[_0x058a('0x8')]])){utils[_0x058a('0x13')](util['format'](_0x058a('0x29'),_0x48ed4e[_0x058a('0x8')]),_0x48ed4e);if(_[_0x058a('0x1d')](channels[_0x48ed4e[_0x058a('0x8')]][_0x058a('0x2a')])){channels[_0x48ed4e['uniqueid']][_0x058a('0x2a')]=_0x48ed4e['calleridname']+'\x20<'+_0x48ed4e[_0x058a('0xa')]+'>';}utils[_0x058a('0x5')](util['format'](_0x058a('0x2b'),_0x48ed4e[_0x058a('0x8')],channels[_0x48ed4e[_0x058a('0x8')]]['callerid'],_0x48ed4e[_0x058a('0x2c')]));channels[_0x48ed4e['uniqueid']][_0x058a('0x2d')]=utils[_0x058a('0x1a')]();channels[_0x48ed4e[_0x058a('0x8')]][_0x058a('0x2e')]=utils['diffTime'](channels[_0x48ed4e[_0x058a('0x8')]][_0x058a('0x2d')],channels[_0x48ed4e[_0x058a('0x8')]]['starttime']);channels[_0x48ed4e['uniqueid']][_0x058a('0x2f')]=channels[_0x48ed4e['uniqueid']]['answertime']?utils[_0x058a('0x30')](channels[_0x48ed4e['uniqueid']][_0x058a('0x2d')],channels[_0x48ed4e[_0x058a('0x8')]][_0x058a('0x24')]):0x0;writeDB(channels[_0x48ed4e['uniqueid']]);}}catch(_0x28e567){utils[_0x058a('0x31')](util[_0x058a('0x6')](_0x058a('0x29'),_0x48ed4e['uniqueid']),_0x28e567);}};exports[_0x058a('0x32')]=function(_0x506858){try{if(!_[_0x058a('0x1d')](channels[_0x506858[_0x058a('0x33')]])){utils[_0x058a('0x13')](util['format'](_0x058a('0x34'),_0x506858['origtransfereruniqueid']),_0x506858);if(channels[_0x506858['localtwolinkedid']][_0x058a('0x15')]==_0x506858[_0x058a('0x35')]){utils[_0x058a('0x5')](util[_0x058a('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x506858[_0x058a('0x36')],_0x506858[_0x058a('0x33')],_0x506858[_0x058a('0x37')]));channels[_0x506858[_0x058a('0x33')]][_0x058a('0x23')]=_0x506858['secondtransfererchannel'];channels[_0x506858[_0x058a('0x33')]][_0x058a('0x38')]=_0x058a('0x39');}else if(channels[_0x506858[_0x058a('0x33')]][_0x058a('0x15')]=_0x506858[_0x058a('0x3a')]){utils['info'](util[_0x058a('0x6')](_0x058a('0x3b'),_0x506858['origtransfereruniqueid'],_0x506858['localtwolinkedid'],_0x506858[_0x058a('0x3c')]));channels[_0x506858['localtwolinkedid']][_0x058a('0x23')]=_0x506858['origtransfererchannel'];channels[_0x506858['localtwolinkedid']][_0x058a('0x38')]=_0x058a('0x39');}}}catch(_0x5e042f){utils[_0x058a('0x31')](util[_0x058a('0x6')]('[%s][calls][attendedtransfer]',_0x506858[_0x058a('0x36')]),_0x5e042f);}};exports['musiconholdstart']=function(_0xe1092d){try{if(!_[_0x058a('0x1d')](channels[_0xe1092d[_0x058a('0x8')]])){utils[_0x058a('0x13')](util[_0x058a('0x6')](_0x058a('0x3d'),_0xe1092d['uniqueid']),_0xe1092d);channels[_0xe1092d[_0x058a('0x8')]][_0x058a('0x3e')]=utils[_0x058a('0x1a')]();utils[_0x058a('0x5')](util[_0x058a('0x6')](_0x058a('0x3f'),_0xe1092d[_0x058a('0x8')],channels[_0xe1092d[_0x058a('0x8')]][_0x058a('0x3e')]));}}catch(_0x23a6d6){utils[_0x058a('0x31')](util['format'](_0x058a('0x3d'),_0xe1092d['uniqueid']),_0x23a6d6);}};exports[_0x058a('0x40')]=function(_0x544424){try{if(!_['isNil'](channels[_0x544424[_0x058a('0x8')]])){utils[_0x058a('0x13')](util['format'](_0x058a('0x41'),_0x544424[_0x058a('0x8')]),_0x544424);if(!_[_0x058a('0x1d')](channels[_0x544424[_0x058a('0x8')]][_0x058a('0x3e')])){channels[_0x544424[_0x058a('0x8')]][_0x058a('0x42')]+=utils[_0x058a('0x30')](utils[_0x058a('0x1a')](),channels[_0x544424[_0x058a('0x8')]][_0x058a('0x3e')]);utils[_0x058a('0x5')](util[_0x058a('0x6')](_0x058a('0x43'),_0x544424['uniqueid'],channels[_0x544424['uniqueid']][_0x058a('0x42')]));delete channels[_0x544424[_0x058a('0x8')]][_0x058a('0x3e')];}}}catch(_0x6c8999){utils[_0x058a('0x31')](util[_0x058a('0x6')](_0x058a('0x41'),_0x544424['uniqueid']),_0x6c8999);}};exports[_0x058a('0x44')]=function(_0x1ae6d7){try{if(!_[_0x058a('0x1d')](channels[_0x1ae6d7[_0x058a('0x8')]])){utils[_0x058a('0x13')](util[_0x058a('0x6')](_0x058a('0x45'),_0x1ae6d7[_0x058a('0x8')]),_0x1ae6d7);if(!_['isNil'](_0x1ae6d7['variable']['xmd-originatecalleridnum'])){utils[_0x058a('0x5')](util[_0x058a('0x6')](_0x058a('0x46'),_0x1ae6d7['uniqueid'],_0x1ae6d7['value']));channels[_0x1ae6d7[_0x058a('0x8')]][_0x058a('0x47')]=_0x1ae6d7[_0x058a('0x48')];}if(!_['isNil'](_0x1ae6d7[_0x058a('0x49')][_0x058a('0x4a')])){utils[_0x058a('0x5')](util['format'](_0x058a('0x4b'),_0x1ae6d7['uniqueid'],_0x1ae6d7[_0x058a('0x48')]));channels[_0x1ae6d7[_0x058a('0x8')]]['destination']=_0x1ae6d7[_0x058a('0x48')];channels[_0x1ae6d7[_0x058a('0x8')]][_0x058a('0x2a')]='\x22'+_0x1ae6d7[_0x058a('0x48')]+'\x22\x20<'+_0x1ae6d7[_0x058a('0x48')]+'>';}if(!_['isNil'](_0x1ae6d7[_0x058a('0x49')][_0x058a('0x4c')])||!_['isNil'](_0x1ae6d7[_0x058a('0x49')][_0x058a('0x4d')])){utils['info'](util[_0x058a('0x6')](_0x058a('0x4e'),_0x1ae6d7['uniqueid'],!_[_0x058a('0x1d')](_0x1ae6d7[_0x058a('0x49')][_0x058a('0x4c')])?_0x058a('0x4c'):'xmd-callerid',_0x1ae6d7['value']));channels[_0x1ae6d7['uniqueid']][_0x058a('0x2a')]=_0x1ae6d7[_0x058a('0x48')];}if(!_[_0x058a('0x1d')](_0x1ae6d7[_0x058a('0x49')][_0x058a('0x4f')])||!_[_0x058a('0x1d')](_0x1ae6d7['variable'][_0x058a('0x50')])){utils['info'](util[_0x058a('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1ae6d7[_0x058a('0x8')],!_[_0x058a('0x1d')](_0x1ae6d7[_0x058a('0x49')][_0x058a('0x4f')])?'xmd-queue':_0x058a('0x50'),_0x1ae6d7['value']));channels[_0x1ae6d7['uniqueid']][_0x058a('0x51')]=_0x058a('0x52');channels[_0x1ae6d7[_0x058a('0x8')]][_0x058a('0x53')]=_0x1ae6d7['value'];channels[_0x1ae6d7['uniqueid']]['queue']=!![];}if(!_[_0x058a('0x1d')](_0x1ae6d7['variable']['xmd-contactid'])){utils[_0x058a('0x5')](util['format'](_0x058a('0x54'),_0x1ae6d7[_0x058a('0x8')],_0x1ae6d7[_0x058a('0x48')]));channels[_0x1ae6d7[_0x058a('0x8')]]['ContactId']=_0x1ae6d7[_0x058a('0x48')];}if(!_[_0x058a('0x1d')](_0x1ae6d7['variable'][_0x058a('0x55')])){utils[_0x058a('0x5')](util[_0x058a('0x6')](_0x058a('0x56'),_0x1ae6d7[_0x058a('0x8')],_0x1ae6d7[_0x058a('0x48')]));channels[_0x1ae6d7[_0x058a('0x8')]]['type']=_0x1ae6d7[_0x058a('0x48')];}if(!_[_0x058a('0x1d')](_0x1ae6d7[_0x058a('0x49')]['outboundrouteid'])){utils[_0x058a('0x5')](util['format'](_0x058a('0x57'),_0x1ae6d7['uniqueid'],_0x1ae6d7[_0x058a('0x48')]));channels[_0x1ae6d7[_0x058a('0x8')]][_0x058a('0x58')]=_0x1ae6d7[_0x058a('0x48')];}if(!_[_0x058a('0x1d')](_0x1ae6d7['variable'][_0x058a('0x59')])){utils[_0x058a('0x5')](util[_0x058a('0x6')](_0x058a('0x5a'),_0x1ae6d7[_0x058a('0x8')],_0x1ae6d7[_0x058a('0x48')]));channels[_0x1ae6d7[_0x058a('0x8')]][_0x058a('0x59')]=_0x1ae6d7[_0x058a('0x48')];}}}catch(_0x5a0d33){utils[_0x058a('0x31')](util[_0x058a('0x6')](_0x058a('0x45'),_0x1ae6d7[_0x058a('0x8')]),_0x5a0d33);}};exports[_0x058a('0x5b')]=function(_0x153970){try{if(!_[_0x058a('0x1d')](channels[_0x153970[_0x058a('0x8')]])){utils[_0x058a('0x13')](util['format']('[%s][calls][newexten]',_0x153970['uniqueid']),_0x153970);utils[_0x058a('0x5')](util[_0x058a('0x6')](_0x058a('0x5c'),_0x153970[_0x058a('0x8')],_0x153970[_0x058a('0x5d')],_0x153970[_0x058a('0x5e')]));if(_0x153970['application'][_0x058a('0x5f')]()==_0x058a('0x60')&&_['startsWith'](_0x153970[_0x058a('0x5e')][_0x058a('0x5f')](),_0x058a('0x61'))){var _0x5dd94a=_0x153970[_0x058a('0x5e')][_0x058a('0x62')]('=');var _0x326dd6=_0x5dd94a[0x0]['substring'](_0x5dd94a[0x0][_0x058a('0x63')]('(')+0x1,_0x5dd94a[0x0][_0x058a('0x63')](')'));var _0x43e7c6=_0x5dd94a[0x1];channels[_0x153970[_0x058a('0x8')]][_0x326dd6]=_0x43e7c6;}if(!_[_0x058a('0x64')]([_0x058a('0x28'),_0x058a('0x65'),_0x058a('0x66'),_0x058a('0x60'),'gotoif'],_0x153970[_0x058a('0x5d')]['toLowerCase']())){channels[_0x153970['uniqueid']]['lastapplication']=_0x153970[_0x058a('0x5d')];channels[_0x153970[_0x058a('0x8')]][_0x058a('0x53')]=_0x153970[_0x058a('0x5e')];}}}catch(_0x25dd1f){utils['error'](util[_0x058a('0x6')](_0x058a('0x67'),_0x153970['uniqueid']),_0x25dd1f);}}; \ No newline at end of file +var _0x8c04=['then','UserId','request','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','diffTime','endtime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','destinationchannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','cdr','appdata','substring','lastIndexOf','noop','execif','gotoif','lastapplication','lodash','util','./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','channel','queue','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal'];(function(_0x4ce685,_0x40de45){var _0x41d80c=function(_0x49b278){while(--_0x49b278){_0x4ce685['push'](_0x4ce685['shift']());}};_0x41d80c(++_0x40de45);}(_0x8c04,0x19a));var _0x48c0=function(_0x30ac82,_0x1ff35a){_0x30ac82=_0x30ac82-0x0;var _0x575a7c=_0x8c04[_0x30ac82];return _0x575a7c;};'use strict';var _=require(_0x48c0('0x0'));var util=require(_0x48c0('0x1'));var utils=require(_0x48c0('0x2'));var dispositions=[_0x48c0('0x3'),_0x48c0('0x4'),'FAILED',_0x48c0('0x3'),_0x48c0('0x3'),'NO\x20ANSWER',_0x48c0('0x5'),_0x48c0('0x6'),_0x48c0('0x4'),_0x48c0('0x4'),'FAILED'];var channels={};function writeDB(_0x46959c){utils[_0x48c0('0x7')](util[_0x48c0('0x8')](_0x48c0('0x9'),_0x46959c[_0x48c0('0xa')],_0x46959c[_0x48c0('0xb')],_0x46959c[_0x48c0('0xc')],_0x46959c['membername'],_0x46959c['interface'],_0x46959c[_0x48c0('0xd')],_0x46959c[_0x48c0('0xe')],_0x46959c[_0x48c0('0xf')]));if(_0x46959c[_0x48c0('0x10')]){utils[_0x48c0('0x11')](_0x46959c['accountcode'])[_0x48c0('0x12')](function(_0x3c74b9){if(_0x3c74b9){_0x46959c[_0x48c0('0x13')]=_0x3c74b9['id'];}utils[_0x48c0('0x14')]('CreateVoiceCallReport',_0x46959c);});}else{utils[_0x48c0('0x14')]('CreateVoiceCallReport',_0x46959c);}if(channels[_0x46959c[_0x48c0('0xa')]]){delete channels[_0x46959c[_0x48c0('0xa')]];}}exports['newchannel']=function(_0x3ebee5){try{utils[_0x48c0('0x15')](util[_0x48c0('0x8')]('[%s][calls][newchannel]',_0x3ebee5[_0x48c0('0xa')]),_0x3ebee5);if(_0x3ebee5[_0x48c0('0xa')]==_0x3ebee5[_0x48c0('0x16')]&&_0x3ebee5[_0x48c0('0xb')]!=_0x48c0('0x17')){utils[_0x48c0('0x7')](util[_0x48c0('0x8')](_0x48c0('0x18'),_0x3ebee5[_0x48c0('0xa')],_0x3ebee5[_0x48c0('0x19')],_0x3ebee5[_0x48c0('0x1a')]));channels[_0x3ebee5[_0x48c0('0xa')]]={'uniqueid':_0x3ebee5[_0x48c0('0xa')],'accountcode':_0x3ebee5[_0x48c0('0x10')],'source':_0x3ebee5['calleridnum'],'destination':_0x3ebee5[_0x48c0('0x1a')],'destinationcontext':_0x3ebee5[_0x48c0('0x19')],'channel':_0x3ebee5[_0x48c0('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x48c0('0x3'),'amaflags':_0x48c0('0x1b')};}}catch(_0x286d38){utils[_0x48c0('0x1c')](util[_0x48c0('0x8')](_0x48c0('0x1d'),_0x3ebee5[_0x48c0('0xa')]),_0x286d38);}};exports[_0x48c0('0x1e')]=function(_0x1fe63b){try{utils[_0x48c0('0x15')](util[_0x48c0('0x8')](_0x48c0('0x1f'),_0x1fe63b[_0x48c0('0xa')]),_0x1fe63b);if(!_[_0x48c0('0x20')](channels[_0x1fe63b['uniqueid']])&&_0x1fe63b[_0x48c0('0x21')]==0x6){utils['info'](util['format'](_0x48c0('0x22'),_0x1fe63b[_0x48c0('0xa')],_0x1fe63b['context'],_0x1fe63b[_0x48c0('0xb')]));if(_[_0x48c0('0x20')](channels[_0x1fe63b['uniqueid']][_0x48c0('0x23')])){channels[_0x1fe63b[_0x48c0('0xa')]]['systemanswertime']=utils[_0x48c0('0x24')]();}}else if(!_['isNil'](channels[_0x1fe63b[_0x48c0('0x16')]])&&_0x1fe63b['channelstate']==0x6&&_0x1fe63b[_0x48c0('0x19')]!='transfer'){utils[_0x48c0('0x7')](util[_0x48c0('0x8')](_0x48c0('0x25'),_0x1fe63b['uniqueid'],_0x1fe63b[_0x48c0('0x16')],_0x1fe63b[_0x48c0('0x19')],_0x1fe63b['channel']));channels[_0x1fe63b[_0x48c0('0x16')]][_0x48c0('0x10')]=_0x1fe63b[_0x48c0('0x10')];channels[_0x1fe63b[_0x48c0('0x16')]]['destinationchannel']=_0x1fe63b['channel'];if(_[_0x48c0('0x20')](channels[_0x1fe63b[_0x48c0('0x16')]][_0x48c0('0x26')])){channels[_0x1fe63b[_0x48c0('0x16')]][_0x48c0('0x26')]=utils['now']();}channels[_0x1fe63b['linkedid']][_0x48c0('0x27')]=dispositions[_[_0x48c0('0x28')](_0x1fe63b[_0x48c0('0x21')])]||_0x48c0('0x5');}}catch(_0x5eaf8a){utils['error'](util[_0x48c0('0x8')](_0x48c0('0x1f'),_0x1fe63b[_0x48c0('0xa')]),_0x5eaf8a);}};exports[_0x48c0('0x29')]=function(_0x113631){try{if(!_[_0x48c0('0x20')](channels[_0x113631['uniqueid']])){utils[_0x48c0('0x15')](util['format']('[%s][calls][hangup]',_0x113631[_0x48c0('0xa')]),_0x113631);if(_[_0x48c0('0x20')](channels[_0x113631[_0x48c0('0xa')]][_0x48c0('0x2a')])){channels[_0x113631[_0x48c0('0xa')]][_0x48c0('0x2a')]=_0x113631[_0x48c0('0x2b')]+'\x20<'+_0x113631[_0x48c0('0xd')]+'>';}utils[_0x48c0('0x7')](util['format'](_0x48c0('0x2c'),_0x113631[_0x48c0('0xa')],channels[_0x113631[_0x48c0('0xa')]][_0x48c0('0x2a')],_0x113631['cause-txt']));channels[_0x113631[_0x48c0('0xa')]]['endtime']=utils[_0x48c0('0x24')]();channels[_0x113631[_0x48c0('0xa')]]['duration']=utils[_0x48c0('0x2d')](channels[_0x113631['uniqueid']][_0x48c0('0x2e')],channels[_0x113631[_0x48c0('0xa')]]['starttime']);channels[_0x113631[_0x48c0('0xa')]][_0x48c0('0x2f')]=channels[_0x113631[_0x48c0('0xa')]][_0x48c0('0x26')]?utils['diffTime'](channels[_0x113631['uniqueid']][_0x48c0('0x2e')],channels[_0x113631[_0x48c0('0xa')]]['answertime']):0x0;writeDB(channels[_0x113631['uniqueid']]);}}catch(_0x1408c7){utils[_0x48c0('0x1c')](util[_0x48c0('0x8')](_0x48c0('0x30'),_0x113631[_0x48c0('0xa')]),_0x1408c7);}};exports[_0x48c0('0x31')]=function(_0x29a197){try{if(!_[_0x48c0('0x20')](channels[_0x29a197[_0x48c0('0x32')]])){utils[_0x48c0('0x15')](util[_0x48c0('0x8')](_0x48c0('0x33'),_0x29a197['origtransfereruniqueid']),_0x29a197);if(channels[_0x29a197[_0x48c0('0x32')]][_0x48c0('0xb')]==_0x29a197[_0x48c0('0x34')]){utils[_0x48c0('0x7')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x29a197[_0x48c0('0x35')],_0x29a197['localtwolinkedid'],_0x29a197['secondtransfererchannel']));channels[_0x29a197[_0x48c0('0x32')]][_0x48c0('0x36')]=_0x29a197[_0x48c0('0x37')];channels[_0x29a197[_0x48c0('0x32')]][_0x48c0('0x38')]=_0x48c0('0x39');}else if(channels[_0x29a197[_0x48c0('0x32')]][_0x48c0('0xb')]=_0x29a197[_0x48c0('0x3a')]){utils[_0x48c0('0x7')](util[_0x48c0('0x8')](_0x48c0('0x3b'),_0x29a197['origtransfereruniqueid'],_0x29a197[_0x48c0('0x32')],_0x29a197[_0x48c0('0x3c')]));channels[_0x29a197['localtwolinkedid']][_0x48c0('0x36')]=_0x29a197[_0x48c0('0x3c')];channels[_0x29a197[_0x48c0('0x32')]][_0x48c0('0x38')]=_0x48c0('0x39');}}}catch(_0x171e82){utils[_0x48c0('0x1c')](util['format'](_0x48c0('0x33'),_0x29a197['origtransfereruniqueid']),_0x171e82);}};exports[_0x48c0('0x3d')]=function(_0x58fdd3){try{if(!_[_0x48c0('0x20')](channels[_0x58fdd3[_0x48c0('0xa')]])){utils[_0x48c0('0x15')](util[_0x48c0('0x8')](_0x48c0('0x3e'),_0x58fdd3[_0x48c0('0xa')]),_0x58fdd3);channels[_0x58fdd3[_0x48c0('0xa')]][_0x48c0('0x3f')]=utils[_0x48c0('0x24')]();utils[_0x48c0('0x7')](util[_0x48c0('0x8')](_0x48c0('0x40'),_0x58fdd3[_0x48c0('0xa')],channels[_0x58fdd3['uniqueid']][_0x48c0('0x3f')]));}}catch(_0x102e23){utils[_0x48c0('0x1c')](util[_0x48c0('0x8')](_0x48c0('0x3e'),_0x58fdd3[_0x48c0('0xa')]),_0x102e23);}};exports[_0x48c0('0x41')]=function(_0x504a1d){try{if(!_[_0x48c0('0x20')](channels[_0x504a1d['uniqueid']])){utils[_0x48c0('0x15')](util[_0x48c0('0x8')](_0x48c0('0x42'),_0x504a1d[_0x48c0('0xa')]),_0x504a1d);if(!_[_0x48c0('0x20')](channels[_0x504a1d[_0x48c0('0xa')]]['musiconholdstartAt'])){channels[_0x504a1d[_0x48c0('0xa')]][_0x48c0('0x43')]+=utils[_0x48c0('0x2d')](utils['now'](),channels[_0x504a1d[_0x48c0('0xa')]][_0x48c0('0x3f')]);utils['info'](util[_0x48c0('0x8')](_0x48c0('0x44'),_0x504a1d[_0x48c0('0xa')],channels[_0x504a1d[_0x48c0('0xa')]][_0x48c0('0x43')]));delete channels[_0x504a1d[_0x48c0('0xa')]]['musiconholdstartAt'];}}}catch(_0x54e16a){utils[_0x48c0('0x1c')](util[_0x48c0('0x8')](_0x48c0('0x42'),_0x504a1d[_0x48c0('0xa')]),_0x54e16a);}};exports[_0x48c0('0x45')]=function(_0x3dc723){try{if(!_[_0x48c0('0x20')](channels[_0x3dc723[_0x48c0('0xa')]])){utils[_0x48c0('0x15')](util[_0x48c0('0x8')](_0x48c0('0x46'),_0x3dc723[_0x48c0('0xa')]),_0x3dc723);if(!_[_0x48c0('0x20')](_0x3dc723[_0x48c0('0x47')][_0x48c0('0x48')])){utils[_0x48c0('0x7')](util['format'](_0x48c0('0x49'),_0x3dc723[_0x48c0('0xa')],_0x3dc723[_0x48c0('0x4a')]));channels[_0x3dc723['uniqueid']]['source']=_0x3dc723[_0x48c0('0x4a')];}if(!_['isNil'](_0x3dc723[_0x48c0('0x47')][_0x48c0('0x4b')])){utils[_0x48c0('0x7')](util[_0x48c0('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x3dc723[_0x48c0('0xa')],_0x3dc723[_0x48c0('0x4a')]));channels[_0x3dc723[_0x48c0('0xa')]][_0x48c0('0x4c')]=_0x3dc723['value'];channels[_0x3dc723[_0x48c0('0xa')]][_0x48c0('0x2a')]='\x22'+_0x3dc723[_0x48c0('0x4a')]+_0x48c0('0x4d')+_0x3dc723[_0x48c0('0x4a')]+'>';}if(!_[_0x48c0('0x20')](_0x3dc723[_0x48c0('0x47')]['xmd-callerid-preview'])||!_[_0x48c0('0x20')](_0x3dc723[_0x48c0('0x47')][_0x48c0('0x4e')])){utils[_0x48c0('0x7')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3dc723[_0x48c0('0xa')],!_[_0x48c0('0x20')](_0x3dc723[_0x48c0('0x47')][_0x48c0('0x4f')])?_0x48c0('0x4f'):_0x48c0('0x4e'),_0x3dc723['value']));channels[_0x3dc723[_0x48c0('0xa')]][_0x48c0('0x2a')]=_0x3dc723['value'];}if(!_['isNil'](_0x3dc723['variable'][_0x48c0('0x50')])||!_[_0x48c0('0x20')](_0x3dc723[_0x48c0('0x47')][_0x48c0('0x51')])){utils[_0x48c0('0x7')](util[_0x48c0('0x8')](_0x48c0('0x52'),_0x3dc723[_0x48c0('0xa')],!_[_0x48c0('0x20')](_0x3dc723[_0x48c0('0x47')][_0x48c0('0x50')])?'xmd-queue':_0x48c0('0x51'),_0x3dc723[_0x48c0('0x4a')]));channels[_0x3dc723[_0x48c0('0xa')]]['lastapplication']='Queue';channels[_0x3dc723['uniqueid']][_0x48c0('0x53')]=_0x3dc723[_0x48c0('0x4a')];channels[_0x3dc723[_0x48c0('0xa')]][_0x48c0('0xc')]=!![];}if(!_[_0x48c0('0x20')](_0x3dc723[_0x48c0('0x47')][_0x48c0('0x54')])){utils[_0x48c0('0x7')](util[_0x48c0('0x8')](_0x48c0('0x55'),_0x3dc723['uniqueid'],_0x3dc723[_0x48c0('0x4a')]));channels[_0x3dc723['uniqueid']][_0x48c0('0x56')]=_0x3dc723[_0x48c0('0x4a')];}if(!_[_0x48c0('0x20')](_0x3dc723['variable'][_0x48c0('0x57')])){utils['info'](util[_0x48c0('0x8')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3dc723[_0x48c0('0xa')],_0x3dc723['value']));channels[_0x3dc723[_0x48c0('0xa')]][_0x48c0('0x58')]=_0x3dc723[_0x48c0('0x4a')];}if(!_[_0x48c0('0x20')](_0x3dc723[_0x48c0('0x47')]['outboundrouteid'])){utils[_0x48c0('0x7')](util[_0x48c0('0x8')](_0x48c0('0x59'),_0x3dc723[_0x48c0('0xa')],_0x3dc723[_0x48c0('0x4a')]));channels[_0x3dc723[_0x48c0('0xa')]][_0x48c0('0x5a')]=_0x3dc723[_0x48c0('0x4a')];}if(!_[_0x48c0('0x20')](_0x3dc723[_0x48c0('0x47')][_0x48c0('0x5b')])){utils[_0x48c0('0x7')](util[_0x48c0('0x8')](_0x48c0('0x5c'),_0x3dc723[_0x48c0('0xa')],_0x3dc723[_0x48c0('0x4a')]));channels[_0x3dc723[_0x48c0('0xa')]][_0x48c0('0x5b')]=_0x3dc723[_0x48c0('0x4a')];}}}catch(_0x293339){utils[_0x48c0('0x1c')](util[_0x48c0('0x8')](_0x48c0('0x46'),_0x3dc723['uniqueid']),_0x293339);}};exports[_0x48c0('0x5d')]=function(_0x2e3b59){try{if(!_[_0x48c0('0x20')](channels[_0x2e3b59[_0x48c0('0xa')]])){utils[_0x48c0('0x15')](util[_0x48c0('0x8')](_0x48c0('0x5e'),_0x2e3b59[_0x48c0('0xa')]),_0x2e3b59);utils[_0x48c0('0x7')](util['format'](_0x48c0('0x5f'),_0x2e3b59[_0x48c0('0xa')],_0x2e3b59[_0x48c0('0x60')],_0x2e3b59['appdata']));if(_0x2e3b59[_0x48c0('0x60')][_0x48c0('0x61')]()==_0x48c0('0x62')&&_['startsWith'](_0x2e3b59['appdata']['toLowerCase'](),_0x48c0('0x63'))){var _0x1cc1a7=_0x2e3b59[_0x48c0('0x64')]['split']('=');var _0x3dad8c=_0x1cc1a7[0x0][_0x48c0('0x65')](_0x1cc1a7[0x0][_0x48c0('0x66')]('(')+0x1,_0x1cc1a7[0x0][_0x48c0('0x66')](')'));var _0x452d9c=_0x1cc1a7[0x1];channels[_0x2e3b59[_0x48c0('0xa')]][_0x3dad8c]=_0x452d9c;}if(!_['includes'](['hangup',_0x48c0('0x67'),_0x48c0('0x68'),'set',_0x48c0('0x69')],_0x2e3b59[_0x48c0('0x60')][_0x48c0('0x61')]())){channels[_0x2e3b59[_0x48c0('0xa')]][_0x48c0('0x6a')]=_0x2e3b59[_0x48c0('0x60')];channels[_0x2e3b59['uniqueid']][_0x48c0('0x53')]=_0x2e3b59[_0x48c0('0x64')];}}}catch(_0x58e11e){utils['error'](util[_0x48c0('0x8')](_0x48c0('0x5e'),_0x2e3b59[_0x48c0('0xa')]),_0x58e11e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index dfcb4cc..ba0ba05 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 _0x6f35=['[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','managerevent','./utils','connect','[core]\x20connected','shutdown','info'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x6f35,0x177));var _0x56f3=function(_0x2f436c,_0x403917){_0x2f436c=_0x2f436c-0x0;var _0x573a6e=_0x6f35[_0x2f436c];return _0x573a6e;};'use strict';var utils=require(_0x56f3('0x0'));exports[_0x56f3('0x1')]=function(){utils['info'](_0x56f3('0x2'));};exports[_0x56f3('0x3')]=function(){utils[_0x56f3('0x4')](_0x56f3('0x5'));};exports['fullybooted']=function(){utils['info'](_0x56f3('0x6'));};exports[_0x56f3('0x7')]=function(_0x179050){utils['error'](_0x56f3('0x8'),_0x179050);};exports['close']=function(){utils[_0x56f3('0x4')]('[core]\x20close');};exports[_0x56f3('0x9')]=function(_0x2624e3){}; \ No newline at end of file +var _0xbfec=['[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close'];(function(_0x46c9c2,_0x4af3a3){var _0x1f1716=function(_0x529f9e){while(--_0x529f9e){_0x46c9c2['push'](_0x46c9c2['shift']());}};_0x1f1716(++_0x4af3a3);}(_0xbfec,0x1b2));var _0xcbfe=function(_0x2c0542,_0x2d6e34){_0x2c0542=_0x2c0542-0x0;var _0x468481=_0xbfec[_0x2c0542];return _0x468481;};'use strict';var utils=require(_0xcbfe('0x0'));exports[_0xcbfe('0x1')]=function(){utils[_0xcbfe('0x2')](_0xcbfe('0x3'));};exports[_0xcbfe('0x4')]=function(){utils[_0xcbfe('0x2')](_0xcbfe('0x5'));};exports[_0xcbfe('0x6')]=function(){utils[_0xcbfe('0x2')](_0xcbfe('0x7'));};exports[_0xcbfe('0x8')]=function(_0x394b1e){utils[_0xcbfe('0x8')]('[core]\x20error',_0x394b1e);};exports[_0xcbfe('0x9')]=function(){utils[_0xcbfe('0x2')](_0xcbfe('0xa'));};exports[_0xcbfe('0xb')]=function(_0x5cc6dc){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b85cc54..e5e6529 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 _0x7bf2=['request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','application','appdata','set','startsWith','toLowerCase','split','varset','variable','outboundrouteid','value','error','[%s][dials][varset]','dialbegin','isNil','[%s][dials][dialbegin]','assign','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','dialstatus','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','starttime','holdtime','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','connectedlinenum'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x7bf2,0x156));var _0x27bf=function(_0xa95968,_0x100bf5){_0xa95968=_0xa95968-0x0;var _0x3a4356=_0x7bf2[_0xa95968];return _0x3a4356;};'use strict';var _=require(_0x27bf('0x0'));var util=require(_0x27bf('0x1'));var utils=require(_0x27bf('0x2'));var dials={};function writeDB(_0x58f6fc){utils['info'](util[_0x27bf('0x3')](_0x27bf('0x4'),_0x58f6fc[_0x27bf('0x5')],_0x58f6fc['channel'],_0x58f6fc['dialstring'],_0x58f6fc[_0x27bf('0x6')],_0x58f6fc[_0x27bf('0x7')],_0x58f6fc['dialstatus']));utils[_0x27bf('0x8')](_0x27bf('0x9'),_0x58f6fc);delete dials[_0x58f6fc[_0x27bf('0x5')]];}exports[_0x27bf('0xa')]=function(_0x31a258){try{utils[_0x27bf('0xb')](util[_0x27bf('0x3')](_0x27bf('0xc'),_0x31a258[_0x27bf('0x5')]),_0x31a258);utils[_0x27bf('0xd')](util[_0x27bf('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x31a258[_0x27bf('0x5')],_0x31a258[_0x27bf('0xe')],_0x31a258[_0x27bf('0xf')]));if(_0x31a258[_0x27bf('0xe')]['toLowerCase']()==_0x27bf('0x10')&&_[_0x27bf('0x11')](_0x31a258[_0x27bf('0xf')][_0x27bf('0x12')](),'cdr(routeid)')){var _0x1fc72d=_0x31a258[_0x27bf('0xf')][_0x27bf('0x13')]('=');dials[_0x31a258[_0x27bf('0x5')]]={'routeId':_0x1fc72d[0x1]};}}catch(_0x2266b4){utils['error'](util['format']('[%s][dials][newexten]',_0x31a258[_0x27bf('0x5')]),_0x2266b4);}};exports[_0x27bf('0x14')]=function(_0x5368d7){try{utils['debug'](util['format']('[%s][dials][varset]',_0x5368d7[_0x27bf('0x5')]),_0x5368d7);if(!_['isNil'](_0x5368d7[_0x27bf('0x15')][_0x27bf('0x16')])){utils[_0x27bf('0xd')](util[_0x27bf('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x5368d7[_0x27bf('0x5')],_0x5368d7[_0x27bf('0x17')]));dials[_0x5368d7['uniqueid']]={'routeId':_0x5368d7[_0x27bf('0x17')]};}}catch(_0x39c55f){utils[_0x27bf('0x18')](util[_0x27bf('0x3')](_0x27bf('0x19'),_0x5368d7['uniqueid']),_0x39c55f);}};exports[_0x27bf('0x1a')]=function(_0x4a8998){try{if(!_[_0x27bf('0x1b')](dials[_0x4a8998[_0x27bf('0x5')]])){utils[_0x27bf('0xb')](util[_0x27bf('0x3')](_0x27bf('0x1c'),_0x4a8998['uniqueid']),_0x4a8998);dials[_0x4a8998[_0x27bf('0x5')]]=_[_0x27bf('0x1d')](dials[_0x4a8998[_0x27bf('0x5')]],_0x4a8998);dials[_0x4a8998[_0x27bf('0x5')]]['starttime']=utils[_0x27bf('0x1e')]();dials[_0x4a8998['uniqueid']]['lastevent']='called';utils[_0x27bf('0xd')](util[_0x27bf('0x3')](_0x27bf('0x1f'),_0x4a8998[_0x27bf('0x5')],dials[_0x4a8998[_0x27bf('0x5')]]['starttime']));}}catch(_0x6d6c7d){utils[_0x27bf('0x18')](util['format'](_0x27bf('0x1c'),_0x4a8998[_0x27bf('0x5')]),_0x6d6c7d);}};exports[_0x27bf('0x20')]=function(_0x478be9){try{if(!_['isNil'](dials[_0x478be9['uniqueid']])){utils['debug'](util['format'](_0x27bf('0x21'),_0x478be9[_0x27bf('0x5')]),_0x478be9);dials[_0x478be9[_0x27bf('0x5')]]['dialstatus']=_0x478be9['dialstatus'];if(_0x478be9['dialstatus']==_0x27bf('0x22')){dials[_0x478be9[_0x27bf('0x5')]]=_[_0x27bf('0x1d')](dials[_0x478be9[_0x27bf('0x5')]],_0x478be9);dials[_0x478be9[_0x27bf('0x5')]][_0x27bf('0x23')]=utils['now']();dials[_0x478be9[_0x27bf('0x5')]]['lastevent']='connect';utils[_0x27bf('0xd')](util['format'](_0x27bf('0x24'),_0x478be9[_0x27bf('0x5')],_0x478be9[_0x27bf('0x25')],dials[_0x478be9['uniqueid']][_0x27bf('0x23')]));}else{utils[_0x27bf('0xd')](util[_0x27bf('0x3')](_0x27bf('0x26'),_0x478be9['uniqueid'],_0x478be9[_0x27bf('0x25')]));}}}catch(_0x19dd7b){utils[_0x27bf('0x18')](util[_0x27bf('0x3')](_0x27bf('0x21'),_0x478be9[_0x27bf('0x5')]),_0x19dd7b);}};exports[_0x27bf('0x27')]=function(_0x32e8c9){try{if(!_[_0x27bf('0x1b')](dials[_0x32e8c9[_0x27bf('0x5')]])){utils['debug'](util[_0x27bf('0x3')](_0x27bf('0x28'),_0x32e8c9[_0x27bf('0x5')]),_0x32e8c9);utils['info'](util[_0x27bf('0x3')](_0x27bf('0x29'),_0x32e8c9[_0x27bf('0x5')],_0x32e8c9[_0x27bf('0x6')],_0x32e8c9[_0x27bf('0x2a')],_0x32e8c9[_0x27bf('0x2b')]));dials[_0x32e8c9[_0x27bf('0x5')]]=_[_0x27bf('0x1d')](dials[_0x32e8c9['uniqueid']],{'endtime':utils[_0x27bf('0x1e')](),'lastevent':_0x27bf('0x2c')});dials[_0x32e8c9['uniqueid']][_0x27bf('0x2d')]=utils[_0x27bf('0x2e')](dials[_0x32e8c9[_0x27bf('0x5')]][_0x27bf('0x2f')],dials[_0x32e8c9['uniqueid']][_0x27bf('0x30')]);dials[_0x32e8c9[_0x27bf('0x5')]][_0x27bf('0x31')]=utils[_0x27bf('0x2e')](dials[_0x32e8c9['uniqueid']][_0x27bf('0x23')]||dials[_0x32e8c9[_0x27bf('0x5')]][_0x27bf('0x2f')],dials[_0x32e8c9[_0x27bf('0x5')]][_0x27bf('0x30')]);dials[_0x32e8c9['uniqueid']]['billableseconds']=dials[_0x32e8c9[_0x27bf('0x5')]]['answertime']?utils[_0x27bf('0x2e')](dials[_0x32e8c9[_0x27bf('0x5')]][_0x27bf('0x2f')],dials[_0x32e8c9[_0x27bf('0x5')]][_0x27bf('0x23')]):0x0;writeDB(dials[_0x32e8c9['uniqueid']]);}}catch(_0x40edd0){utils[_0x27bf('0x18')](util[_0x27bf('0x3')]('[%s][dials][hangup]',_0x32e8c9['uniqueid']),_0x40edd0);}}; \ No newline at end of file +var _0x5563=['endtime','billableseconds','lodash','util','info','format','uniqueid','channel','calleridnum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','diffTime'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5563,0x1b2));var _0x3556=function(_0x8cb5f5,_0x1a1aac){_0x8cb5f5=_0x8cb5f5-0x0;var _0x557bb8=_0x5563[_0x8cb5f5];return _0x557bb8;};'use strict';var _=require(_0x3556('0x0'));var util=require(_0x3556('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x10ae31){utils[_0x3556('0x2')](util[_0x3556('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x10ae31[_0x3556('0x4')],_0x10ae31[_0x3556('0x5')],_0x10ae31['dialstring'],_0x10ae31[_0x3556('0x6')],_0x10ae31['connectedlinenum'],_0x10ae31[_0x3556('0x7')]));utils[_0x3556('0x8')]('CreateVoiceDialReport',_0x10ae31);delete dials[_0x10ae31[_0x3556('0x4')]];}exports[_0x3556('0x9')]=function(_0x56a14f){try{utils[_0x3556('0xa')](util['format'](_0x3556('0xb'),_0x56a14f[_0x3556('0x4')]),_0x56a14f);utils[_0x3556('0x2')](util[_0x3556('0x3')](_0x3556('0xc'),_0x56a14f[_0x3556('0x4')],_0x56a14f[_0x3556('0xd')],_0x56a14f[_0x3556('0xe')]));if(_0x56a14f[_0x3556('0xd')]['toLowerCase']()==_0x3556('0xf')&&_[_0x3556('0x10')](_0x56a14f['appdata'][_0x3556('0x11')](),'cdr(routeid)')){var _0x37f365=_0x56a14f[_0x3556('0xe')]['split']('=');dials[_0x56a14f[_0x3556('0x4')]]={'routeId':_0x37f365[0x1]};}}catch(_0x328509){utils[_0x3556('0x12')](util[_0x3556('0x3')](_0x3556('0xb'),_0x56a14f[_0x3556('0x4')]),_0x328509);}};exports[_0x3556('0x13')]=function(_0x2fe75d){try{utils[_0x3556('0xa')](util[_0x3556('0x3')](_0x3556('0x14'),_0x2fe75d[_0x3556('0x4')]),_0x2fe75d);if(!_[_0x3556('0x15')](_0x2fe75d[_0x3556('0x16')][_0x3556('0x17')])){utils[_0x3556('0x2')](util['format'](_0x3556('0x18'),_0x2fe75d[_0x3556('0x4')],_0x2fe75d[_0x3556('0x19')]));dials[_0x2fe75d['uniqueid']]={'routeId':_0x2fe75d[_0x3556('0x19')]};}}catch(_0xa11ebb){utils[_0x3556('0x12')](util[_0x3556('0x3')](_0x3556('0x14'),_0x2fe75d[_0x3556('0x4')]),_0xa11ebb);}};exports[_0x3556('0x1a')]=function(_0x398ba9){try{if(!_[_0x3556('0x15')](dials[_0x398ba9[_0x3556('0x4')]])){utils[_0x3556('0xa')](util[_0x3556('0x3')]('[%s][dials][dialbegin]',_0x398ba9[_0x3556('0x4')]),_0x398ba9);dials[_0x398ba9[_0x3556('0x4')]]=_[_0x3556('0x1b')](dials[_0x398ba9['uniqueid']],_0x398ba9);dials[_0x398ba9['uniqueid']][_0x3556('0x1c')]=utils[_0x3556('0x1d')]();dials[_0x398ba9[_0x3556('0x4')]][_0x3556('0x1e')]=_0x3556('0x1f');utils[_0x3556('0x2')](util[_0x3556('0x3')](_0x3556('0x20'),_0x398ba9['uniqueid'],dials[_0x398ba9['uniqueid']][_0x3556('0x1c')]));}}catch(_0x1b5331){utils['error'](util[_0x3556('0x3')](_0x3556('0x21'),_0x398ba9[_0x3556('0x4')]),_0x1b5331);}};exports['dialend']=function(_0x46580c){try{if(!_[_0x3556('0x15')](dials[_0x46580c['uniqueid']])){utils['debug'](util[_0x3556('0x3')]('[%s][dials][dialend]',_0x46580c[_0x3556('0x4')]),_0x46580c);dials[_0x46580c[_0x3556('0x4')]]['dialstatus']=_0x46580c['dialstatus'];if(_0x46580c[_0x3556('0x7')]==_0x3556('0x22')){dials[_0x46580c[_0x3556('0x4')]]=_[_0x3556('0x1b')](dials[_0x46580c[_0x3556('0x4')]],_0x46580c);dials[_0x46580c[_0x3556('0x4')]][_0x3556('0x23')]=utils[_0x3556('0x1d')]();dials[_0x46580c[_0x3556('0x4')]][_0x3556('0x1e')]=_0x3556('0x24');utils[_0x3556('0x2')](util[_0x3556('0x3')](_0x3556('0x25'),_0x46580c['uniqueid'],_0x46580c['dialstatus'],dials[_0x46580c['uniqueid']]['answertime']));}else{utils[_0x3556('0x2')](util[_0x3556('0x3')](_0x3556('0x26'),_0x46580c[_0x3556('0x4')],_0x46580c[_0x3556('0x7')]));}}}catch(_0x5a2d7a){utils[_0x3556('0x12')](util['format'](_0x3556('0x27'),_0x46580c[_0x3556('0x4')]),_0x5a2d7a);}};exports[_0x3556('0x28')]=function(_0x56c184){try{if(!_[_0x3556('0x15')](dials[_0x56c184['uniqueid']])){utils[_0x3556('0xa')](util['format'](_0x3556('0x29'),_0x56c184[_0x3556('0x4')]),_0x56c184);utils[_0x3556('0x2')](util[_0x3556('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x56c184['uniqueid'],_0x56c184['calleridnum'],_0x56c184[_0x3556('0x2a')],_0x56c184[_0x3556('0x2b')]));dials[_0x56c184[_0x3556('0x4')]]=_['assign'](dials[_0x56c184[_0x3556('0x4')]],{'endtime':utils[_0x3556('0x1d')](),'lastevent':_0x3556('0x2c')});dials[_0x56c184['uniqueid']]['duration']=utils[_0x3556('0x2d')](dials[_0x56c184[_0x3556('0x4')]]['endtime'],dials[_0x56c184['uniqueid']]['starttime']);dials[_0x56c184[_0x3556('0x4')]]['holdtime']=utils[_0x3556('0x2d')](dials[_0x56c184[_0x3556('0x4')]]['answertime']||dials[_0x56c184[_0x3556('0x4')]][_0x3556('0x2e')],dials[_0x56c184[_0x3556('0x4')]][_0x3556('0x1c')]);dials[_0x56c184[_0x3556('0x4')]][_0x3556('0x2f')]=dials[_0x56c184[_0x3556('0x4')]]['answertime']?utils[_0x3556('0x2d')](dials[_0x56c184['uniqueid']][_0x3556('0x2e')],dials[_0x56c184['uniqueid']][_0x3556('0x23')]):0x0;writeDB(dials[_0x56c184[_0x3556('0x4')]]);}}catch(_0x4f2a4b){utils[_0x3556('0x12')](util[_0x3556('0x3')](_0x3556('0x29'),_0x56c184[_0x3556('0x4')]),_0x4f2a4b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index d14072b..69f600b 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 _0x56d1=['./utils','util','xdr','disabled','production','port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%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','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56d1,0x11e));var _0x156d=function(_0xc6b104,_0x1d805a){_0xc6b104=_0xc6b104-0x0;var _0x1c6fce=_0x56d1[_0xc6b104];return _0x1c6fce;};var AsteriskManager=require(_0x156d('0x0'));var config=require(_0x156d('0x1'));var utils=require(_0x156d('0x2'));var util=require(_0x156d('0x3'));var isXDREnabled=config[_0x156d('0x4')]&&config[_0x156d('0x4')][_0x156d('0x5')]?!config['xdr'][_0x156d('0x5')]:!![];var isProduction=config['env']===_0x156d('0x6')||![];var isLocalAsterisk=config[_0x156d('0x4')]&&config[_0x156d('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x156d('0x7')],config['asterisk']['ip'],config[_0x156d('0x8')][_0x156d('0x9')],config[_0x156d('0x8')][_0x156d('0xa')],!![]);ami[_0x156d('0xb')]();if(!isXDREnabled){utils[_0x156d('0xc')](_0x156d('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x156d('0xc')](_0x156d('0xe'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x156d('0xf'));var members=require(_0x156d('0x10'));var dials=require(_0x156d('0x11'));var transfers=require(_0x156d('0x12'));var core=require(_0x156d('0x13'));ami['on'](_0x156d('0x14'),core[_0x156d('0x14')]);ami['on'](_0x156d('0x15'),core[_0x156d('0x15')]);ami['on'](_0x156d('0x16'),core['fullybooted']);ami['on'](_0x156d('0x17'),core[_0x156d('0x17')]);ami['on'](_0x156d('0x18'),core[_0x156d('0x18')]);ami['on']('managerevent',core[_0x156d('0x19')]);ami['on']('devicestatechange',function(_0x5ee6b9){try{utils['debug'](util['format'](_0x156d('0x1a'),_0x5ee6b9[_0x156d('0x1b')]),_0x5ee6b9);members[_0x156d('0x1c')](_0x5ee6b9);}catch(_0x9e318b){utils[_0x156d('0x17')](util[_0x156d('0x1d')](_0x156d('0x1a'),_0x5ee6b9[_0x156d('0x1b')]),_0x9e318b);}});ami['on'](_0x156d('0x1e'),function(_0x5aa810){try{utils['debug'](util[_0x156d('0x1d')](_0x156d('0x1f'),_0x5aa810[_0x156d('0x20')]),_0x5aa810);agents['agentcalled'](_0x5aa810);}catch(_0x2c1312){utils[_0x156d('0x17')](util[_0x156d('0x1d')](_0x156d('0x1f'),_0x5aa810[_0x156d('0x20')]),_0x2c1312);}});ami['on'](_0x156d('0x21'),function(_0x55a4f6){try{utils[_0x156d('0x22')](util['format']('[%s][index][agentringnoanswer]',_0x55a4f6[_0x156d('0x20')]),_0x55a4f6);agents[_0x156d('0x21')](_0x55a4f6);}catch(_0x140cb2){utils[_0x156d('0x17')](util[_0x156d('0x1d')](_0x156d('0x23'),_0x55a4f6[_0x156d('0x20')]),_0x140cb2);}});ami['on']('agentconnect',function(_0x46e619){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x24'),_0x46e619['uniqueid']),_0x46e619);agents[_0x156d('0x25')](_0x46e619);queues[_0x156d('0x25')](_0x46e619);}catch(_0x5b8929){utils['error'](util[_0x156d('0x1d')](_0x156d('0x24'),_0x46e619[_0x156d('0x20')]),_0x5b8929);}});ami['on']('agentcomplete',function(_0x45cb03){try{utils['debug'](util[_0x156d('0x1d')]('[%s][index][agentcomplete]',_0x45cb03[_0x156d('0x20')]),_0x45cb03);agents['agentcomplete'](_0x45cb03);queues['agentcomplete'](_0x45cb03);members[_0x156d('0x26')](_0x45cb03);}catch(_0x5210e1){utils['error'](util[_0x156d('0x1d')](_0x156d('0x27'),_0x45cb03['uniqueid']),_0x5210e1);}});ami['on'](_0x156d('0x28'),function(_0x2d5efb){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x29'),_0x2d5efb[_0x156d('0x20')]),_0x2d5efb);agents['queuecallerabandon'](_0x2d5efb);queues[_0x156d('0x28')](_0x2d5efb);}catch(_0x24b944){utils['error'](util['format'](_0x156d('0x29'),_0x2d5efb[_0x156d('0x20')]),_0x24b944);}});ami['on'](_0x156d('0x2a'),function(_0x56c503){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x2b'),_0x56c503[_0x156d('0x20')]),_0x56c503);queues[_0x156d('0x2a')](_0x56c503);recordings[_0x156d('0x2a')](_0x56c503);}catch(_0x3046b5){utils[_0x156d('0x17')](util[_0x156d('0x1d')](_0x156d('0x2b'),_0x56c503[_0x156d('0x20')]),_0x3046b5);}});ami['on'](_0x156d('0x2c'),function(_0x539a3f){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x2d'),_0x539a3f[_0x156d('0x20')]),_0x539a3f);queues[_0x156d('0x2c')](_0x539a3f);}catch(_0x14f401){utils[_0x156d('0x17')](util[_0x156d('0x1d')]('[%s][index][queuecallerleave]',_0x539a3f[_0x156d('0x20')]),_0x14f401);}});ami['on']('musiconholdstart',function(_0x401c93){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x2e'),_0x401c93[_0x156d('0x20')]),_0x401c93);queues[_0x156d('0x2f')](_0x401c93);calls[_0x156d('0x2f')](_0x401c93);}catch(_0x29cf0b){utils[_0x156d('0x17')](util['format'](_0x156d('0x2e'),_0x401c93[_0x156d('0x20')]),_0x29cf0b);}});ami['on']('musiconholdstop',function(_0x122b6d){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')]('[%s][index][musiconholdstop]',_0x122b6d[_0x156d('0x20')]),_0x122b6d);queues[_0x156d('0x30')](_0x122b6d);calls['musiconholdstop'](_0x122b6d);}catch(_0x2dffcf){utils[_0x156d('0x17')](util[_0x156d('0x1d')](_0x156d('0x31'),_0x122b6d[_0x156d('0x20')]),_0x2dffcf);}});ami['on'](_0x156d('0x32'),function(_0x172a4e){try{utils[_0x156d('0x22')](util['format'](_0x156d('0x33'),_0x172a4e['uniqueid']),_0x172a4e);calls[_0x156d('0x32')](_0x172a4e);recordings['newstate'](_0x172a4e);}catch(_0x3460d1){utils[_0x156d('0x17')](util['format'](_0x156d('0x33'),_0x172a4e[_0x156d('0x20')]),_0x3460d1);}});ami['on'](_0x156d('0x34'),function(_0x569477){try{utils[_0x156d('0x22')](util['format'](_0x156d('0x35'),_0x569477[_0x156d('0x20')]),_0x569477);calls[_0x156d('0x34')](_0x569477);recordings['hangup'](_0x569477);dials[_0x156d('0x34')](_0x569477);agents[_0x156d('0x34')](_0x569477);queues[_0x156d('0x34')](_0x569477);}catch(_0x1a069c){utils['error'](util[_0x156d('0x1d')](_0x156d('0x35'),_0x569477[_0x156d('0x20')]),_0x1a069c);}});ami['on'](_0x156d('0x36'),function(_0xb4d8ab){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x37'),_0xb4d8ab[_0x156d('0x20')]),_0xb4d8ab);members[_0x156d('0x36')](_0xb4d8ab);}catch(_0x204c38){utils['error'](util[_0x156d('0x1d')](_0x156d('0x37'),_0xb4d8ab['uniqueid']),_0x204c38);}});ami['on'](_0x156d('0x38'),function(_0x6df47f){try{utils[_0x156d('0x22')](util['format'](_0x156d('0x39'),_0x6df47f[_0x156d('0x20')]),_0x6df47f);queues[_0x156d('0x38')](_0x6df47f);agents['blindtransfer'](_0x6df47f);transfers[_0x156d('0x38')](_0x6df47f);}catch(_0x274a3b){utils['error'](util[_0x156d('0x1d')]('[%s][index][blindtransfer]',_0x6df47f['uniqueid']),_0x274a3b);}});ami['on'](_0x156d('0x3a'),function(_0x2749a7){try{utils[_0x156d('0x22')](util['format'](_0x156d('0x3b'),_0x2749a7[_0x156d('0x3c')]),_0x2749a7);queues[_0x156d('0x3a')](_0x2749a7);transfers['attendedtransfer'](_0x2749a7);agents[_0x156d('0x3a')](_0x2749a7);calls['attendedtransfer'](_0x2749a7);}catch(_0xe7a2fe){utils[_0x156d('0x17')](util['format'](_0x156d('0x3b'),_0x2749a7[_0x156d('0x3c')]),_0xe7a2fe);}});ami['on'](_0x156d('0x3d'),function(_0x3a3158){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x3e'),_0x3a3158[_0x156d('0x20')]),_0x3a3158);queues[_0x156d('0x3d')](_0x3a3158);recordings[_0x156d('0x3d')](_0x3a3158);calls[_0x156d('0x3d')](_0x3a3158);dials[_0x156d('0x3d')](_0x3a3158);}catch(_0x3414a7){utils[_0x156d('0x17')](util[_0x156d('0x1d')](_0x156d('0x3e'),_0x3a3158[_0x156d('0x20')]),_0x3414a7);}});ami['on'](_0x156d('0x3f'),function(_0x24eddc){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x40'),_0x24eddc[_0x156d('0x20')]),_0x24eddc);calls[_0x156d('0x3f')](_0x24eddc);recordings['newexten'](_0x24eddc);dials[_0x156d('0x3f')](_0x24eddc);}catch(_0x5e716b){utils[_0x156d('0x17')](util[_0x156d('0x1d')](_0x156d('0x40'),_0x24eddc[_0x156d('0x20')]),_0x5e716b);}});ami['on'](_0x156d('0x41'),function(_0x5cc5ee){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x42'),_0x5cc5ee['uniqueid']),_0x5cc5ee);calls[_0x156d('0x41')](_0x5cc5ee);recordings[_0x156d('0x41')](_0x5cc5ee);}catch(_0x1a1320){utils['error'](util['format'](_0x156d('0x42'),_0x5cc5ee['uniqueid']),_0x1a1320);}});ami['on']('dialbegin',function(_0x1a547a){try{utils['debug'](util[_0x156d('0x1d')](_0x156d('0x43'),_0x1a547a[_0x156d('0x20')]),_0x1a547a);dials[_0x156d('0x44')](_0x1a547a);}catch(_0x132f8d){utils['error'](util[_0x156d('0x1d')](_0x156d('0x45'),_0x1a547a[_0x156d('0x20')]),_0x132f8d);}});ami['on'](_0x156d('0x46'),function(_0x3d09b3){try{utils[_0x156d('0x22')](util[_0x156d('0x1d')](_0x156d('0x47'),_0x3d09b3['uniqueid']),_0x3d09b3);dials[_0x156d('0x46')](_0x3d09b3);}catch(_0x342762){utils[_0x156d('0x17')](util[_0x156d('0x1d')](_0x156d('0x47'),_0x3d09b3[_0x156d('0x20')]),_0x342762);}});} \ No newline at end of file +var _0x36e2=['newchannel','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./transfers.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x36e2,0x13f));var _0x236e=function(_0x4cb14a,_0x39886c){_0x4cb14a=_0x4cb14a-0x0;var _0x170371=_0x36e2[_0x4cb14a];return _0x170371;};var AsteriskManager=require(_0x236e('0x0'));var config=require(_0x236e('0x1'));var utils=require(_0x236e('0x2'));var util=require(_0x236e('0x3'));var isXDREnabled=config[_0x236e('0x4')]&&config[_0x236e('0x4')][_0x236e('0x5')]?!config[_0x236e('0x4')]['disabled']:!![];var isProduction=config[_0x236e('0x6')]===_0x236e('0x7')||![];var isLocalAsterisk=config[_0x236e('0x4')]&&config[_0x236e('0x4')][_0x236e('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x236e('0x9')][_0x236e('0xa')],config[_0x236e('0x9')]['ip'],config['asterisk'][_0x236e('0xb')],config[_0x236e('0x9')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x236e('0xc')](_0x236e('0xd'));}else{var agents=require(_0x236e('0xe'));var calls=require('./calls.controller');var queues=require(_0x236e('0xf'));var recordings=require(_0x236e('0x10'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x236e('0x11'));var core=require('./core.controller');ami['on'](_0x236e('0x12'),core[_0x236e('0x12')]);ami['on'](_0x236e('0x13'),core[_0x236e('0x13')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x236e('0x14'),core[_0x236e('0x14')]);ami['on'](_0x236e('0x15'),core['close']);ami['on'](_0x236e('0x16'),core[_0x236e('0x16')]);ami['on'](_0x236e('0x17'),function(_0x26c237){try{utils[_0x236e('0x18')](util['format'](_0x236e('0x19'),_0x26c237['device']),_0x26c237);members[_0x236e('0x17')](_0x26c237);}catch(_0x4ad44e){utils[_0x236e('0x14')](util[_0x236e('0x1a')](_0x236e('0x19'),_0x26c237['device']),_0x4ad44e);}});ami['on'](_0x236e('0x1b'),function(_0x25c10f){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')](_0x236e('0x1c'),_0x25c10f[_0x236e('0x1d')]),_0x25c10f);agents[_0x236e('0x1b')](_0x25c10f);}catch(_0x4ca602){utils[_0x236e('0x14')](util[_0x236e('0x1a')](_0x236e('0x1c'),_0x25c10f[_0x236e('0x1d')]),_0x4ca602);}});ami['on'](_0x236e('0x1e'),function(_0x317012){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')](_0x236e('0x1f'),_0x317012[_0x236e('0x1d')]),_0x317012);agents['agentringnoanswer'](_0x317012);}catch(_0x238080){utils['error'](util[_0x236e('0x1a')](_0x236e('0x1f'),_0x317012[_0x236e('0x1d')]),_0x238080);}});ami['on'](_0x236e('0x20'),function(_0x4c39ff){try{utils['debug'](util['format']('[%s][index][agentconnect]',_0x4c39ff['uniqueid']),_0x4c39ff);agents['agentconnect'](_0x4c39ff);queues['agentconnect'](_0x4c39ff);}catch(_0x8acccc){utils[_0x236e('0x14')](util[_0x236e('0x1a')]('[%s][index][agentconnect]',_0x4c39ff[_0x236e('0x1d')]),_0x8acccc);}});ami['on'](_0x236e('0x21'),function(_0x472225){try{utils['debug'](util[_0x236e('0x1a')](_0x236e('0x22'),_0x472225[_0x236e('0x1d')]),_0x472225);agents[_0x236e('0x21')](_0x472225);queues['agentcomplete'](_0x472225);members['agentcomplete'](_0x472225);}catch(_0x5457cc){utils[_0x236e('0x14')](util['format'](_0x236e('0x22'),_0x472225['uniqueid']),_0x5457cc);}});ami['on']('queuecallerabandon',function(_0x19c278){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')]('[%s][index][queuecallerabandon]',_0x19c278[_0x236e('0x1d')]),_0x19c278);agents['queuecallerabandon'](_0x19c278);queues['queuecallerabandon'](_0x19c278);}catch(_0x5868b5){utils['error'](util[_0x236e('0x1a')]('[%s][index][queuecallerabandon]',_0x19c278[_0x236e('0x1d')]),_0x5868b5);}});ami['on'](_0x236e('0x23'),function(_0xe80942){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')](_0x236e('0x24'),_0xe80942[_0x236e('0x1d')]),_0xe80942);queues[_0x236e('0x23')](_0xe80942);recordings[_0x236e('0x23')](_0xe80942);}catch(_0x1cd40b){utils[_0x236e('0x14')](util[_0x236e('0x1a')](_0x236e('0x24'),_0xe80942[_0x236e('0x1d')]),_0x1cd40b);}});ami['on'](_0x236e('0x25'),function(_0x50d6ae){try{utils['debug'](util[_0x236e('0x1a')](_0x236e('0x26'),_0x50d6ae['uniqueid']),_0x50d6ae);queues[_0x236e('0x25')](_0x50d6ae);}catch(_0x35d59e){utils[_0x236e('0x14')](util['format'](_0x236e('0x26'),_0x50d6ae[_0x236e('0x1d')]),_0x35d59e);}});ami['on'](_0x236e('0x27'),function(_0x3699a5){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')](_0x236e('0x28'),_0x3699a5[_0x236e('0x1d')]),_0x3699a5);queues['musiconholdstart'](_0x3699a5);calls[_0x236e('0x27')](_0x3699a5);}catch(_0x321946){utils['error'](util[_0x236e('0x1a')](_0x236e('0x28'),_0x3699a5['uniqueid']),_0x321946);}});ami['on'](_0x236e('0x29'),function(_0x556c6a){try{utils[_0x236e('0x18')](util['format']('[%s][index][musiconholdstop]',_0x556c6a['uniqueid']),_0x556c6a);queues['musiconholdstop'](_0x556c6a);calls['musiconholdstop'](_0x556c6a);}catch(_0x4423cc){utils['error'](util[_0x236e('0x1a')](_0x236e('0x2a'),_0x556c6a[_0x236e('0x1d')]),_0x4423cc);}});ami['on'](_0x236e('0x2b'),function(_0x4458c1){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')](_0x236e('0x2c'),_0x4458c1[_0x236e('0x1d')]),_0x4458c1);calls['newstate'](_0x4458c1);recordings[_0x236e('0x2b')](_0x4458c1);}catch(_0x22a511){utils['error'](util[_0x236e('0x1a')](_0x236e('0x2c'),_0x4458c1['uniqueid']),_0x22a511);}});ami['on'](_0x236e('0x2d'),function(_0x404773){try{utils[_0x236e('0x18')](util['format'](_0x236e('0x2e'),_0x404773[_0x236e('0x1d')]),_0x404773);calls['hangup'](_0x404773);recordings[_0x236e('0x2d')](_0x404773);dials[_0x236e('0x2d')](_0x404773);agents[_0x236e('0x2d')](_0x404773);queues[_0x236e('0x2d')](_0x404773);}catch(_0x5bd7dd){utils[_0x236e('0x14')](util[_0x236e('0x1a')](_0x236e('0x2e'),_0x404773[_0x236e('0x1d')]),_0x5bd7dd);}});ami['on'](_0x236e('0x2f'),function(_0x394302){try{utils[_0x236e('0x18')](util['format']('[%s][index][cdr]',_0x394302['uniqueid']),_0x394302);members['cdr'](_0x394302);}catch(_0x4b84e9){utils['error'](util[_0x236e('0x1a')](_0x236e('0x30'),_0x394302['uniqueid']),_0x4b84e9);}});ami['on'](_0x236e('0x31'),function(_0x19da42){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')](_0x236e('0x32'),_0x19da42[_0x236e('0x1d')]),_0x19da42);queues[_0x236e('0x31')](_0x19da42);agents[_0x236e('0x31')](_0x19da42);transfers[_0x236e('0x31')](_0x19da42);}catch(_0x794c6a){utils['error'](util[_0x236e('0x1a')](_0x236e('0x32'),_0x19da42[_0x236e('0x1d')]),_0x794c6a);}});ami['on'](_0x236e('0x33'),function(_0x577c32){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')](_0x236e('0x34'),_0x577c32[_0x236e('0x35')]),_0x577c32);queues[_0x236e('0x33')](_0x577c32);transfers[_0x236e('0x33')](_0x577c32);agents['attendedtransfer'](_0x577c32);calls[_0x236e('0x33')](_0x577c32);}catch(_0x25ea2c){utils[_0x236e('0x14')](util[_0x236e('0x1a')]('[%s][index][attendedtransfer]',_0x577c32[_0x236e('0x35')]),_0x25ea2c);}});ami['on']('varset',function(_0x42ddf2){try{utils['debug'](util[_0x236e('0x1a')]('[%s][index][varset]',_0x42ddf2[_0x236e('0x1d')]),_0x42ddf2);queues[_0x236e('0x36')](_0x42ddf2);recordings[_0x236e('0x36')](_0x42ddf2);calls[_0x236e('0x36')](_0x42ddf2);dials['varset'](_0x42ddf2);}catch(_0x361db3){utils['error'](util[_0x236e('0x1a')](_0x236e('0x37'),_0x42ddf2['uniqueid']),_0x361db3);}});ami['on'](_0x236e('0x38'),function(_0x421e68){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')](_0x236e('0x39'),_0x421e68['uniqueid']),_0x421e68);calls['newexten'](_0x421e68);recordings[_0x236e('0x38')](_0x421e68);dials[_0x236e('0x38')](_0x421e68);}catch(_0x453848){utils[_0x236e('0x14')](util[_0x236e('0x1a')](_0x236e('0x39'),_0x421e68[_0x236e('0x1d')]),_0x453848);}});ami['on']('newchannel',function(_0x10c517){try{utils['debug'](util['format'](_0x236e('0x3a'),_0x10c517[_0x236e('0x1d')]),_0x10c517);calls[_0x236e('0x3b')](_0x10c517);recordings[_0x236e('0x3b')](_0x10c517);}catch(_0x266c01){utils[_0x236e('0x14')](util['format'](_0x236e('0x3a'),_0x10c517[_0x236e('0x1d')]),_0x266c01);}});ami['on']('dialbegin',function(_0x4dd570){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')]('[%s][index][dialbegin]',_0x4dd570[_0x236e('0x1d')]),_0x4dd570);dials['dialbegin'](_0x4dd570);}catch(_0x2c7f0c){utils[_0x236e('0x14')](util[_0x236e('0x1a')](_0x236e('0x3c'),_0x4dd570[_0x236e('0x1d')]),_0x2c7f0c);}});ami['on']('dialend',function(_0x3ccde6){try{utils[_0x236e('0x18')](util[_0x236e('0x1a')](_0x236e('0x3d'),_0x3ccde6[_0x236e('0x1d')]),_0x3ccde6);dials[_0x236e('0x3e')](_0x3ccde6);}catch(_0x3e264d){utils['error'](util[_0x236e('0x1a')]('[%s][index][dialend]',_0x3ccde6['uniqueid']),_0x3e264d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index fc75e87..2ca3a96 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 _0x5ce6=['Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','data2','type','then','membername','name','internal','split','request','catch','error','[%s][members][writeDB]','some','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','source','util','./utils'];(function(_0x4b3ea1,_0x43adf4){var _0x132c15=function(_0x162c3a){while(--_0x162c3a){_0x4b3ea1['push'](_0x4b3ea1['shift']());}};_0x132c15(++_0x43adf4);}(_0x5ce6,0xee));var _0x65ce=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x5ce6[_0xdd82b4];return _0x549bb2;};'use strict';var _=require('lodash');var util=require(_0x65ce('0x0'));var utils=require(_0x65ce('0x1'));var members={};var exclude=[_0x65ce('0x2'),_0x65ce('0x3')];function writeDB(_0x8ba07){utils[_0x65ce('0x4')](util[_0x65ce('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x8ba07[_0x65ce('0x6')],_0x8ba07[_0x65ce('0x7')],_0x8ba07[_0x65ce('0x8')],_0x8ba07[_0x65ce('0x9')],_0x8ba07['membername'],_0x8ba07[_0x65ce('0xa')]));if(_0x8ba07[_0x65ce('0x7')]){utils['getUserByInterface'](_0x8ba07['interface'])[_0x65ce('0xb')](function(_0x4dd4c6){if(_0x4dd4c6){_0x8ba07[_0x65ce('0xc')]=_0x4dd4c6[_0x65ce('0xd')];_0x8ba07['internal']=_0x4dd4c6[_0x65ce('0xe')];utils['request']('CreateMemberReport',_0x8ba07);}else{utils['getUserByName'](_0x8ba07[_0x65ce('0x7')][_0x65ce('0xf')]('/')[0x1])[_0x65ce('0xb')](function(_0x467eee){if(_0x467eee){_0x8ba07['membername']=_0x467eee[_0x65ce('0xd')];_0x8ba07[_0x65ce('0xe')]=_0x467eee[_0x65ce('0xe')];utils[_0x65ce('0x10')]('CreateMemberReport',_0x8ba07);}});}})[_0x65ce('0x11')](function(_0x26b897){utils[_0x65ce('0x12')](util['format'](_0x65ce('0x13'),_0x8ba07[_0x65ce('0x6')]),_0x26b897);});}delete members[_0x8ba07['interface']];}function startsWith(_0xfd6b83,_0x46d483){return _[_0x65ce('0x14')](_0xfd6b83,function(_0x9af16b){return _['startsWith'](_0x46d483,_0x9af16b);});}exports[_0x65ce('0x15')]=function(_0xd5205b){try{utils[_0x65ce('0x16')](util[_0x65ce('0x5')]('[%s][members][devicestatechange]',members[_0xd5205b[_0x65ce('0x17')]]?members[_0xd5205b[_0x65ce('0x17')]][_0x65ce('0x6')]:_0xd5205b['device']),_0xd5205b);utils[_0x65ce('0x4')](util['format'](_0x65ce('0x18'),members[_0xd5205b['device']]?members[_0xd5205b[_0x65ce('0x17')]][_0x65ce('0x6')]:_0xd5205b[_0x65ce('0x17')],_0xd5205b[_0x65ce('0x19')],_0xd5205b['device']));switch(_0xd5205b[_0x65ce('0x19')]){case _0x65ce('0x1a'):case'BUSY':if(!startsWith(exclude,_0xd5205b['device'])){members[_0xd5205b[_0x65ce('0x17')]]={'channel':_0x65ce('0x1b'),'interface':_0xd5205b['device'],'type':'TALKING','enterAt':utils[_0x65ce('0x1c')](),'role':'agent'};}break;case _0x65ce('0x1d'):if(!_['isNil'](members[_0xd5205b[_0x65ce('0x17')]])){members[_0xd5205b[_0x65ce('0x17')]][_0x65ce('0x1e')]=utils[_0x65ce('0x1c')]();members[_0xd5205b['device']][_0x65ce('0x1f')]=utils[_0x65ce('0x20')](members[_0xd5205b[_0x65ce('0x17')]][_0x65ce('0x1e')],members[_0xd5205b[_0x65ce('0x17')]][_0x65ce('0x21')]);if(members[_0xd5205b[_0x65ce('0x17')]][_0x65ce('0x6')]){writeDB(members[_0xd5205b['device']]);}}break;default:break;}}catch(_0x52337d){utils[_0x65ce('0x12')](util[_0x65ce('0x5')]('[%s][members][devicestatechange]',members[_0xd5205b[_0x65ce('0x17')]]?members[_0xd5205b[_0x65ce('0x17')]][_0x65ce('0x6')]:_0xd5205b['device']),_0x52337d);}};exports[_0x65ce('0x22')]=function(_0x508333){try{if(!_[_0x65ce('0x23')](members[_0x508333[_0x65ce('0x7')]])){utils[_0x65ce('0x16')](util['format'](_0x65ce('0x24'),_0x508333['uniqueid']),_0x508333);utils['info'](util[_0x65ce('0x5')](_0x65ce('0x25'),_0x508333[_0x65ce('0x6')],_0x508333[_0x65ce('0x7')],_0x508333[_0x65ce('0x26')]));members[_0x508333[_0x65ce('0x7')]]=_['assign'](members[_0x508333[_0x65ce('0x7')]],{'data4':_0x508333[_0x65ce('0x26')],'uniqueid':_0x508333[_0x65ce('0x6')]});}}catch(_0x5e8fb2){utils['error'](util[_0x65ce('0x5')](_0x65ce('0x24'),_0x508333[_0x65ce('0x6')]),_0x5e8fb2);}};exports[_0x65ce('0x27')]=function(_0x4c26be){try{utils[_0x65ce('0x16')](util[_0x65ce('0x5')](_0x65ce('0x28'),_0x4c26be[_0x65ce('0x6')]),_0x4c26be);if(_0x4c26be['channel']){var _0x1aae50=_0x4c26be['channel']['split']('-')[0x0];if(!_[_0x65ce('0x23')](members[_0x1aae50])){members[_0x1aae50]=_[_0x65ce('0x29')](members[_0x1aae50],{'data1':members[_0x1aae50]['data1']||_0x4c26be[_0x65ce('0xa')],'data2':members[_0x1aae50][_0x65ce('0x9')]||_0x4c26be['source'],'data3':members[_0x1aae50][_0x65ce('0x2a')]||_0x4c26be[_0x65ce('0x2b')],'uniqueid':members[_0x1aae50]['uniqueid']||_0x4c26be['uniqueid']});utils[_0x65ce('0x4')](util['format'](_0x65ce('0x2c'),_0x4c26be['uniqueid'],members[_0x1aae50][_0x65ce('0x2d')],members[_0x1aae50][_0x65ce('0x9')],members[_0x1aae50][_0x65ce('0x2a')]));if(members[_0x1aae50][_0x65ce('0x1e')]){writeDB(members[_0x1aae50]);}}}if(_0x4c26be[_0x65ce('0x2e')]){var _0x4bd221=_0x4c26be[_0x65ce('0x2e')][_0x65ce('0xf')]('-')[0x0];if(!_['isNil'](members[_0x4bd221])){members[_0x4bd221]=_['assign'](members[_0x4bd221],{'data1':members[_0x4bd221]['data1']||_0x4c26be[_0x65ce('0xa')],'data2':members[_0x4bd221]['data2']||_0x4c26be[_0x65ce('0x2f')],'data3':members[_0x4bd221][_0x65ce('0x2a')]||_0x4c26be[_0x65ce('0x2b')],'uniqueid':members[_0x4bd221][_0x65ce('0x6')]||_0x4c26be[_0x65ce('0x6')]});utils['info'](util[_0x65ce('0x5')](_0x65ce('0x2c'),_0x4c26be[_0x65ce('0x6')],members[_0x4bd221][_0x65ce('0x2d')],members[_0x4bd221][_0x65ce('0x9')],members[_0x4bd221][_0x65ce('0x2a')]));if(members[_0x4bd221]['exitAt']){writeDB(members[_0x4bd221]);}}}}catch(_0x154c2c){utils[_0x65ce('0x12')](util[_0x65ce('0x5')](_0x65ce('0x28'),_0x4c26be['uniqueid']),_0x154c2c);}}; \ No newline at end of file +var _0xdcab=['info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','[%s][members][devicestatechange]','[%s][members][agentcomplete]'];(function(_0x31eff8,_0x5dbddf){var _0x56b506=function(_0x1a4299){while(--_0x1a4299){_0x31eff8['push'](_0x31eff8['shift']());}};_0x56b506(++_0x5dbddf);}(_0xdcab,0x1e9));var _0xbdca=function(_0x30c659,_0x4b460e){_0x30c659=_0x30c659-0x0;var _0x359169=_0xdcab[_0x30c659];return _0x359169;};'use strict';var _=require(_0xbdca('0x0'));var util=require(_0xbdca('0x1'));var utils=require(_0xbdca('0x2'));var members={};var exclude=[_0xbdca('0x3'),_0xbdca('0x4')];function writeDB(_0x578a0a){utils['info'](util[_0xbdca('0x5')](_0xbdca('0x6'),_0x578a0a[_0xbdca('0x7')],_0x578a0a[_0xbdca('0x8')],_0x578a0a[_0xbdca('0x9')],_0x578a0a[_0xbdca('0xa')],_0x578a0a[_0xbdca('0xb')],_0x578a0a[_0xbdca('0xc')]));if(_0x578a0a[_0xbdca('0x8')]){utils[_0xbdca('0xd')](_0x578a0a['interface'])[_0xbdca('0xe')](function(_0x59588b){if(_0x59588b){_0x578a0a[_0xbdca('0xb')]=_0x59588b[_0xbdca('0xf')];_0x578a0a[_0xbdca('0x10')]=_0x59588b[_0xbdca('0x10')];utils[_0xbdca('0x11')](_0xbdca('0x12'),_0x578a0a);}else{utils[_0xbdca('0x13')](_0x578a0a[_0xbdca('0x8')][_0xbdca('0x14')]('/')[0x1])['then'](function(_0x14066b){if(_0x14066b){_0x578a0a[_0xbdca('0xb')]=_0x14066b[_0xbdca('0xf')];_0x578a0a[_0xbdca('0x10')]=_0x14066b['internal'];utils[_0xbdca('0x11')]('CreateMemberReport',_0x578a0a);}});}})[_0xbdca('0x15')](function(_0x446421){utils[_0xbdca('0x16')](util['format']('[%s][members][writeDB]',_0x578a0a[_0xbdca('0x7')]),_0x446421);});}delete members[_0x578a0a[_0xbdca('0x8')]];}function startsWith(_0x4178eb,_0x16944f){return _[_0xbdca('0x17')](_0x4178eb,function(_0x133d8d){return _['startsWith'](_0x16944f,_0x133d8d);});}exports[_0xbdca('0x18')]=function(_0x69ecf6){try{utils[_0xbdca('0x19')](util[_0xbdca('0x5')]('[%s][members][devicestatechange]',members[_0x69ecf6[_0xbdca('0x1a')]]?members[_0x69ecf6[_0xbdca('0x1a')]][_0xbdca('0x7')]:_0x69ecf6[_0xbdca('0x1a')]),_0x69ecf6);utils['info'](util[_0xbdca('0x5')](_0xbdca('0x1b'),members[_0x69ecf6['device']]?members[_0x69ecf6[_0xbdca('0x1a')]][_0xbdca('0x7')]:_0x69ecf6['device'],_0x69ecf6[_0xbdca('0x1c')],_0x69ecf6[_0xbdca('0x1a')]));switch(_0x69ecf6[_0xbdca('0x1c')]){case _0xbdca('0x1d'):case _0xbdca('0x1e'):if(!startsWith(exclude,_0x69ecf6[_0xbdca('0x1a')])){members[_0x69ecf6['device']]={'channel':_0xbdca('0x1f'),'interface':_0x69ecf6[_0xbdca('0x1a')],'type':'TALKING','enterAt':utils['now'](),'role':_0xbdca('0x20')};}break;case _0xbdca('0x21'):if(!_[_0xbdca('0x22')](members[_0x69ecf6[_0xbdca('0x1a')]])){members[_0x69ecf6[_0xbdca('0x1a')]][_0xbdca('0x23')]=utils[_0xbdca('0x24')]();members[_0x69ecf6[_0xbdca('0x1a')]][_0xbdca('0x25')]=utils[_0xbdca('0x26')](members[_0x69ecf6[_0xbdca('0x1a')]]['exitAt'],members[_0x69ecf6['device']]['enterAt']);if(members[_0x69ecf6['device']]['uniqueid']){writeDB(members[_0x69ecf6[_0xbdca('0x1a')]]);}}break;default:break;}}catch(_0xe10981){utils[_0xbdca('0x16')](util[_0xbdca('0x5')](_0xbdca('0x27'),members[_0x69ecf6[_0xbdca('0x1a')]]?members[_0x69ecf6['device']][_0xbdca('0x7')]:_0x69ecf6[_0xbdca('0x1a')]),_0xe10981);}};exports['agentcomplete']=function(_0x284124){try{if(!_['isNil'](members[_0x284124[_0xbdca('0x8')]])){utils[_0xbdca('0x19')](util[_0xbdca('0x5')](_0xbdca('0x28'),_0x284124['uniqueid']),_0x284124);utils[_0xbdca('0x29')](util[_0xbdca('0x5')](_0xbdca('0x2a'),_0x284124[_0xbdca('0x7')],_0x284124[_0xbdca('0x8')],_0x284124[_0xbdca('0x2b')]));members[_0x284124['interface']]=_[_0xbdca('0x2c')](members[_0x284124['interface']],{'data4':_0x284124[_0xbdca('0x2b')],'uniqueid':_0x284124[_0xbdca('0x7')]});}}catch(_0x41a482){utils[_0xbdca('0x16')](util[_0xbdca('0x5')](_0xbdca('0x28'),_0x284124[_0xbdca('0x7')]),_0x41a482);}};exports[_0xbdca('0x2d')]=function(_0x593447){try{utils['debug'](util[_0xbdca('0x5')](_0xbdca('0x2e'),_0x593447[_0xbdca('0x7')]),_0x593447);if(_0x593447['channel']){var _0x1a5f5f=_0x593447[_0xbdca('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x1a5f5f])){members[_0x1a5f5f]=_[_0xbdca('0x2c')](members[_0x1a5f5f],{'data1':members[_0x1a5f5f][_0xbdca('0x2f')]||_0x593447['type'],'data2':members[_0x1a5f5f][_0xbdca('0xa')]||_0x593447[_0xbdca('0x30')],'data3':members[_0x1a5f5f]['data3']||_0x593447[_0xbdca('0x31')],'uniqueid':members[_0x1a5f5f][_0xbdca('0x7')]||_0x593447[_0xbdca('0x7')]});utils[_0xbdca('0x29')](util[_0xbdca('0x5')](_0xbdca('0x32'),_0x593447['uniqueid'],members[_0x1a5f5f][_0xbdca('0x2f')],members[_0x1a5f5f][_0xbdca('0xa')],members[_0x1a5f5f][_0xbdca('0x33')]));if(members[_0x1a5f5f][_0xbdca('0x23')]){writeDB(members[_0x1a5f5f]);}}}if(_0x593447[_0xbdca('0x34')]){var _0x5240d6=_0x593447[_0xbdca('0x34')][_0xbdca('0x14')]('-')[0x0];if(!_[_0xbdca('0x22')](members[_0x5240d6])){members[_0x5240d6]=_['assign'](members[_0x5240d6],{'data1':members[_0x5240d6][_0xbdca('0x2f')]||_0x593447[_0xbdca('0xc')],'data2':members[_0x5240d6][_0xbdca('0xa')]||_0x593447[_0xbdca('0x30')],'data3':members[_0x5240d6][_0xbdca('0x33')]||_0x593447[_0xbdca('0x31')],'uniqueid':members[_0x5240d6][_0xbdca('0x7')]||_0x593447[_0xbdca('0x7')]});utils[_0xbdca('0x29')](util[_0xbdca('0x5')](_0xbdca('0x32'),_0x593447['uniqueid'],members[_0x5240d6][_0xbdca('0x2f')],members[_0x5240d6][_0xbdca('0xa')],members[_0x5240d6][_0xbdca('0x33')]));if(members[_0x5240d6][_0xbdca('0x23')]){writeDB(members[_0x5240d6]);}}}}catch(_0x3a3c06){utils[_0xbdca('0x16')](util[_0xbdca('0x5')](_0xbdca('0x2e'),_0x593447[_0xbdca('0x7')]),_0x3a3c06);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index cc76833..0363873 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 _0xd3f4=['transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transfereelinkedid','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','clone','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','diffTime','[%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','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentcomplete]','transfer','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer'];(function(_0x1e97a5,_0x37a2e9){var _0x42915d=function(_0x63f93b){while(--_0x63f93b){_0x1e97a5['push'](_0x1e97a5['shift']());}};_0x42915d(++_0x37a2e9);}(_0xd3f4,0x88));var _0x4d3f=function(_0x18f963,_0x1cb828){_0x18f963=_0x18f963-0x0;var _0x59da0b=_0xd3f4[_0x18f963];return _0x59da0b;};'use strict';var _=require(_0x4d3f('0x0'));var util=require(_0x4d3f('0x1'));var utils=require(_0x4d3f('0x2'));var queues={};function writeDB(_0x16c803){utils['info'](util[_0x4d3f('0x3')](_0x4d3f('0x4'),_0x16c803['uniqueid'],_0x16c803['channel'],_0x16c803[_0x4d3f('0x5')],_0x16c803[_0x4d3f('0x6')],_0x16c803[_0x4d3f('0x7')],_0x16c803[_0x4d3f('0x8')],_0x16c803['queuecallerexitreason']));if(_0x16c803[_0x4d3f('0x5')]){utils[_0x4d3f('0x9')](_0x16c803[_0x4d3f('0x5')])['then'](function(_0x48b6ef){if(_0x48b6ef){_0x16c803[_0x4d3f('0xa')]=_0x48b6ef[_0x4d3f('0xa')];}utils[_0x4d3f('0xb')]('CreateVoiceQueueReport',_0x16c803);});}else{utils[_0x4d3f('0xb')](_0x4d3f('0xc'),_0x16c803);}if(_0x16c803[_0x4d3f('0xd')]){delete queues[_0x16c803[_0x4d3f('0xd')]];}else{delete queues[_0x16c803[_0x4d3f('0xe')]];}}exports[_0x4d3f('0xf')]=function(_0x26bc2a){try{utils[_0x4d3f('0x10')](util[_0x4d3f('0x3')](_0x4d3f('0x11'),_0x26bc2a['uniqueid']),_0x26bc2a);utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x13'),_0x26bc2a[_0x4d3f('0xe')],_0x26bc2a[_0x4d3f('0x5')],_0x26bc2a['position']));queues[_0x26bc2a[_0x4d3f('0xe')]]=_[_0x4d3f('0x14')](_0x26bc2a,{'originalposition':_0x26bc2a[_0x4d3f('0x15')],'queuecallerjoinAt':utils[_0x4d3f('0x16')](),'mohtime':0x0});}catch(_0x3fcbc2){utils[_0x4d3f('0x17')](util['format']('[%s][queues][queuecallerjoin]',_0x26bc2a[_0x4d3f('0xe')]),_0x3fcbc2);}};exports[_0x4d3f('0x18')]=function(_0x580955){try{if(!_[_0x4d3f('0x19')](queues[_0x580955[_0x4d3f('0xe')]])){utils[_0x4d3f('0x10')](util[_0x4d3f('0x3')]('[%s][queues][hangup]',_0x580955[_0x4d3f('0xe')]),_0x580955);if(queues[_0x580955[_0x4d3f('0xe')]]['queuecallerleaveAt']){if(!queues[_0x580955[_0x4d3f('0xe')]][_0x4d3f('0x1a')]&&!queues[_0x580955['uniqueid']]['queuecallerexit']){queues[_0x580955[_0x4d3f('0xe')]][_0x4d3f('0x1b')]=!![];queues[_0x580955['uniqueid']][_0x4d3f('0x1c')]=utils['now']();queues[_0x580955[_0x4d3f('0xe')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils['info'](util[_0x4d3f('0x3')](_0x4d3f('0x1d'),_0x580955[_0x4d3f('0xe')],queues[_0x580955[_0x4d3f('0xe')]][_0x4d3f('0x1e')],queues[_0x580955[_0x4d3f('0xe')]][_0x4d3f('0x1f')]));writeDB(queues[_0x580955['uniqueid']]);}else if(queues[_0x580955[_0x4d3f('0xe')]][_0x4d3f('0xd')]){utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x20'),_0x580955[_0x4d3f('0xe')],queues[_0x580955['uniqueid']][_0x4d3f('0x1e')],queues[_0x580955[_0x4d3f('0xe')]][_0x4d3f('0xd')]));queues[queues[_0x580955[_0x4d3f('0xe')]]['transfereduniqueid']]=queues[_0x580955['uniqueid']];queues[queues[_0x580955[_0x4d3f('0xe')]][_0x4d3f('0xd')]][_0x4d3f('0x21')]=0x2;delete queues[_0x580955['uniqueid']];}}}catch(_0xe59553){utils[_0x4d3f('0x17')](util[_0x4d3f('0x3')](_0x4d3f('0x22'),_0x580955[_0x4d3f('0xe')]),_0xe59553);}};exports[_0x4d3f('0x23')]=function(_0x16abb5){try{utils[_0x4d3f('0x10')](util['format'](_0x4d3f('0x24'),_0x16abb5[_0x4d3f('0xe')]),_0x16abb5);if(!_[_0x4d3f('0x19')](_0x16abb5['variable'][_0x4d3f('0x25')])&&_0x16abb5[_0x4d3f('0x26')][_0x4d3f('0x27')]()!==_0x4d3f('0x28')){if(!_['isNil'](queues[_0x16abb5[_0x4d3f('0xe')]])){queues[_0x16abb5['uniqueid']][_0x4d3f('0x1a')]=![];queues[_0x16abb5[_0x4d3f('0xe')]]['queuecallerabandonAt']=null;queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x29')]=!![];queues[_0x16abb5['uniqueid']][_0x4d3f('0x2a')]=utils[_0x4d3f('0x16')]();queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x1f')]=_0x16abb5[_0x4d3f('0x26')][_0x4d3f('0x27')]();utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x2b'),_0x16abb5[_0x4d3f('0xe')],queues[_0x16abb5[_0x4d3f('0xe')]]['name'],_0x16abb5[_0x4d3f('0x26')],queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x1f')]));writeDB(queues[_0x16abb5[_0x4d3f('0xe')]]);}}else if(!_[_0x4d3f('0x19')](_0x16abb5[_0x4d3f('0x2c')][_0x4d3f('0x2d')])){if(!_[_0x4d3f('0x19')](queues[_0x16abb5['uniqueid']])&&!queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x1a')]){queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x1a')]=![];queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x2e')]=null;queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x29')]=!![];queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x2a')]=utils[_0x4d3f('0x16')]();queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x1f')]='EXITWITHKEY';utils[_0x4d3f('0x12')](util['format'](_0x4d3f('0x2f'),_0x16abb5[_0x4d3f('0xe')],queues[_0x16abb5['uniqueid']][_0x4d3f('0x1e')],_0x16abb5[_0x4d3f('0x26')],queues[_0x16abb5[_0x4d3f('0xe')]][_0x4d3f('0x1f')]));}}}catch(_0x358432){utils[_0x4d3f('0x17')](util[_0x4d3f('0x3')](_0x4d3f('0x24'),_0x16abb5[_0x4d3f('0xe')]),_0x358432);}};exports[_0x4d3f('0x1a')]=function(_0x53613b){try{if(!_[_0x4d3f('0x19')](queues[_0x53613b['uniqueid']])){utils[_0x4d3f('0x10')](util[_0x4d3f('0x3')]('[%s][queues][queuecallerabandon]',_0x53613b[_0x4d3f('0xe')]),_0x53613b);queues[_0x53613b[_0x4d3f('0xe')]][_0x4d3f('0x29')]=![];queues[_0x53613b[_0x4d3f('0xe')]][_0x4d3f('0x2a')]=null;queues[_0x53613b[_0x4d3f('0xe')]][_0x4d3f('0x1a')]=!![];queues[_0x53613b[_0x4d3f('0xe')]]['queuecallerabandonAt']=utils['now']();queues[_0x53613b[_0x4d3f('0xe')]][_0x4d3f('0x1f')]=_0x4d3f('0x30');utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x31'),_0x53613b[_0x4d3f('0xe')],queues[_0x53613b['uniqueid']][_0x4d3f('0x1e')],queues[_0x53613b[_0x4d3f('0xe')]]['queuecallerexitreason']));}}catch(_0x56aa16){utils[_0x4d3f('0x17')](util['format'](_0x4d3f('0x32'),_0x53613b[_0x4d3f('0xe')]),_0x56aa16);}};exports[_0x4d3f('0x33')]=function(_0x37e4db){try{if(!_['isNil'](queues[_0x37e4db[_0x4d3f('0xe')]])){utils[_0x4d3f('0x10')](util[_0x4d3f('0x3')](_0x4d3f('0x34'),_0x37e4db['uniqueid']),_0x37e4db);utils['info'](util[_0x4d3f('0x3')](_0x4d3f('0x35'),_0x37e4db['uniqueid'],queues[_0x37e4db[_0x4d3f('0xe')]][_0x4d3f('0x1e')],_0x37e4db[_0x4d3f('0x36')],_0x37e4db['connectedlinename']));queues[_0x37e4db['uniqueid']][_0x4d3f('0x33')]=!![];queues[_0x37e4db[_0x4d3f('0xe')]][_0x4d3f('0x37')]=utils[_0x4d3f('0x16')]();queues[_0x37e4db[_0x4d3f('0xe')]][_0x4d3f('0x38')]=utils['diffTime'](queues[_0x37e4db[_0x4d3f('0xe')]][_0x4d3f('0x37')],queues[_0x37e4db[_0x4d3f('0xe')]][_0x4d3f('0x39')]);queues[_0x37e4db['uniqueid']][_0x4d3f('0x15')]=_0x37e4db[_0x4d3f('0x15')];queues[_0x37e4db[_0x4d3f('0xe')]][_0x4d3f('0x3a')]=_0x37e4db[_0x4d3f('0x3a')];queues[_0x37e4db['uniqueid']][_0x4d3f('0x36')]=_0x37e4db[_0x4d3f('0x36')];queues[_0x37e4db[_0x4d3f('0xe')]][_0x4d3f('0x3b')]=_0x37e4db[_0x4d3f('0x3b')];}}catch(_0x28d11d){utils[_0x4d3f('0x17')](util['format'](_0x4d3f('0x34'),_0x37e4db['uniqueid']),_0x28d11d);}};exports[_0x4d3f('0x3c')]=function(_0x4f3fc9){try{if(!_[_0x4d3f('0x19')](queues[_0x4f3fc9[_0x4d3f('0xe')]])){utils[_0x4d3f('0x10')](util[_0x4d3f('0x3')](_0x4d3f('0x3d'),_0x4f3fc9[_0x4d3f('0xe')]),_0x4f3fc9);utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x3e'),_0x4f3fc9['uniqueid'],queues[_0x4f3fc9[_0x4d3f('0xe')]]['name'],_0x4f3fc9[_0x4d3f('0x3f')],_0x4f3fc9[_0x4d3f('0x40')]));queues[_0x4f3fc9['uniqueid']][_0x4d3f('0x1a')]=![];queues[_0x4f3fc9[_0x4d3f('0xe')]]['queuecallerabandon']=![];queues[_0x4f3fc9['uniqueid']][_0x4d3f('0x2e')]=null;queues[_0x4f3fc9[_0x4d3f('0xe')]]['queuecallerexit']=![];queues[_0x4f3fc9[_0x4d3f('0xe')]][_0x4d3f('0x1f')]=null;queues[_0x4f3fc9[_0x4d3f('0xe')]]['queuecallerexitAt']=null;queues[_0x4f3fc9[_0x4d3f('0xe')]]['assigned']=!![];queues[_0x4f3fc9[_0x4d3f('0xe')]]['accountcode']=_0x4f3fc9[_0x4d3f('0x40')];queues[_0x4f3fc9[_0x4d3f('0xe')]][_0x4d3f('0x6')]=_0x4f3fc9['membername'];}}catch(_0x1dddb3){utils[_0x4d3f('0x17')](util[_0x4d3f('0x3')]('[%s][queues][agentconnect]',_0x4f3fc9[_0x4d3f('0xe')]),_0x1dddb3);}};exports['agentcomplete']=function(_0x36cf0c){try{if(!_[_0x4d3f('0x19')](queues[_0x36cf0c[_0x4d3f('0xe')]])){if(queues[_0x36cf0c[_0x4d3f('0xe')]]['queuecallerleaveAt']){utils[_0x4d3f('0x10')](util['format'](_0x4d3f('0x41'),_0x36cf0c[_0x4d3f('0xe')]),_0x36cf0c);queues[_0x36cf0c[_0x4d3f('0xe')]]['queuecallerabandon']=![];queues[_0x36cf0c[_0x4d3f('0xe')]][_0x4d3f('0x1a')]=![];queues[_0x36cf0c['uniqueid']][_0x4d3f('0x2e')]=null;queues[_0x36cf0c[_0x4d3f('0xe')]][_0x4d3f('0x29')]=![];queues[_0x36cf0c[_0x4d3f('0xe')]][_0x4d3f('0x2a')]=null;queues[_0x36cf0c[_0x4d3f('0xe')]]['assigned']=!![];queues[_0x36cf0c[_0x4d3f('0xe')]][_0x4d3f('0x6')]=_0x36cf0c[_0x4d3f('0x3f')];queues[_0x36cf0c[_0x4d3f('0xe')]]['queuecallercomplete']=!![];queues[_0x36cf0c['uniqueid']][_0x4d3f('0x1c')]=utils[_0x4d3f('0x16')]();if(_0x36cf0c['reason']==_0x4d3f('0x42')){if(!queues[_0x36cf0c[_0x4d3f('0xe')]][_0x4d3f('0x42')]){queues[_0x36cf0c[_0x4d3f('0xe')]][_0x4d3f('0x1f')]='TRANSFER';}}else{queues[_0x36cf0c[_0x4d3f('0xe')]][_0x4d3f('0x1f')]='COMPLETEDBY'+_0x36cf0c[_0x4d3f('0x43')][_0x4d3f('0x27')]();}utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x44'),_0x36cf0c[_0x4d3f('0xe')],queues[_0x36cf0c[_0x4d3f('0xe')]][_0x4d3f('0x1e')],_0x36cf0c['membername'],queues[_0x36cf0c[_0x4d3f('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x36cf0c[_0x4d3f('0xe')]]);}}}catch(_0xcec2db){utils[_0x4d3f('0x17')](util[_0x4d3f('0x3')](_0x4d3f('0x41'),_0x36cf0c[_0x4d3f('0xe')]),_0xcec2db);}};exports[_0x4d3f('0x45')]=function(_0x501226){try{if(!_['isNil'](queues[_0x501226[_0x4d3f('0x46')]])){utils[_0x4d3f('0x10')](util[_0x4d3f('0x3')](_0x4d3f('0x47'),_0x501226[_0x4d3f('0xe')]),_0x501226);queues[_0x501226[_0x4d3f('0x46')]][_0x4d3f('0x42')]=!![];queues[_0x501226[_0x4d3f('0x46')]]['transfertype']=_0x4d3f('0x48');queues[_0x501226[_0x4d3f('0x46')]][_0x4d3f('0x49')]=_0x501226['extension'];queues[_0x501226[_0x4d3f('0x46')]][_0x4d3f('0x4a')]=_0x501226[_0x4d3f('0x46')];queues[_0x501226[_0x4d3f('0x46')]][_0x4d3f('0x1f')]='BLINDTRANSFER';utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x4b'),_0x501226[_0x4d3f('0xe')],queues[_0x501226['transfereeuniqueid']]['name'],_0x501226[_0x4d3f('0x46')],_0x501226['extension']));}}catch(_0x16a3be){utils[_0x4d3f('0x17')](util[_0x4d3f('0x3')]('[%s][queues][blindtransfer]',_0x501226['uniqueid']),_0x16a3be);}};exports[_0x4d3f('0x4c')]=function(_0xe65853){try{utils[_0x4d3f('0x10')](util['format']('[%s][queues][attendedtransfer]',_0xe65853['origtransfereruniqueid']),_0xe65853);if(_0xe65853[_0x4d3f('0x4d')]==_0xe65853[_0x4d3f('0x4e')]){if(!_[_0x4d3f('0x19')](queues[_0xe65853[_0x4d3f('0x4f')]])){utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x50'),_0xe65853[_0x4d3f('0x4d')],queues[_0xe65853[_0x4d3f('0x4f')]][_0x4d3f('0x1e')],_0xe65853[_0x4d3f('0x51')]));queues[_0xe65853['secondtransfererlinkedid']][_0x4d3f('0x42')]=!![];queues[_0xe65853[_0x4d3f('0x4f')]][_0x4d3f('0x52')]=_0x4d3f('0x53');queues[_0xe65853[_0x4d3f('0x4f')]][_0x4d3f('0x49')]=_0xe65853['origtransfererexten'];queues[_0xe65853[_0x4d3f('0x4f')]][_0x4d3f('0x4a')]=_0xe65853['origtransfereruniqueid'];queues[_0xe65853[_0x4d3f('0x4f')]][_0x4d3f('0x1f')]='ATTENDEDTRANSFER';}if(!_[_0x4d3f('0x19')](queues[_0xe65853[_0x4d3f('0x4e')]])){if(_0xe65853[_0x4d3f('0x54')]&&queues[_0xe65853[_0x4d3f('0x54')]]){queues[_0xe65853[_0x4d3f('0x54')]][_0x4d3f('0x21')]=0x1;queues[_0xe65853[_0x4d3f('0x46')]]=_['clone'](queues[_0xe65853['transfereelinkedid']]);queues[_0xe65853[_0x4d3f('0x46')]][_0x4d3f('0xd')]=_0xe65853[_0x4d3f('0x55')];queues[_0xe65853[_0x4d3f('0x46')]]['queuecallerenterreason']=0x2;queues[_0xe65853[_0x4d3f('0x46')]]['calleridnum']=queues[_0xe65853['secondtransfererlinkedid']][_0x4d3f('0x7')];queues[_0xe65853['transfereeuniqueid']]['calleridname']=queues[_0xe65853[_0x4d3f('0x4f')]]['calleridname'];queues[_0xe65853[_0x4d3f('0x46')]]['queuecallerjoinAt']=utils[_0x4d3f('0x16')]();queues[_0xe65853['transfereeuniqueid']][_0x4d3f('0x37')]=utils[_0x4d3f('0x16')]();queues[_0xe65853['transfereeuniqueid']][_0x4d3f('0x38')]=0x0;queues[_0xe65853['transfereeuniqueid']][_0x4d3f('0x56')]=0x0;utils['info'](util[_0x4d3f('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0xe65853[_0x4d3f('0x4d')],queues[_0xe65853['transfereeuniqueid']]['name'],queues[_0xe65853[_0x4d3f('0x46')]][_0x4d3f('0x7')],queues[_0xe65853[_0x4d3f('0x46')]]['calleridname']));}else{utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x57'),_0xe65853[_0x4d3f('0x4d')],queues[_0xe65853['origtransfererlinkedid']][_0x4d3f('0x1e')],_0xe65853[_0x4d3f('0x4f')]));queues[_0xe65853['origtransfererlinkedid']][_0x4d3f('0xd')]=_0xe65853[_0x4d3f('0x4f')];}}}else if(_0xe65853[_0x4d3f('0x58')]==_0xe65853[_0x4d3f('0x4f')]){if(!_[_0x4d3f('0x19')](queues[_0xe65853[_0x4d3f('0x4e')]])){utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xe65853[_0x4d3f('0x4d')],queues[_0xe65853[_0x4d3f('0x4e')]][_0x4d3f('0x1e')],_0xe65853['secondtransfereruniqueid'],_0xe65853['secondtransfererexten']));queues[_0xe65853[_0x4d3f('0x4e')]][_0x4d3f('0x42')]=!![];queues[_0xe65853[_0x4d3f('0x4e')]][_0x4d3f('0x52')]=_0x4d3f('0x53');queues[_0xe65853['origtransfererlinkedid']][_0x4d3f('0x49')]=_0xe65853['secondtransfererexten'];queues[_0xe65853['origtransfererlinkedid']][_0x4d3f('0x4a')]=_0xe65853['secondtransfereruniqueid'];queues[_0xe65853[_0x4d3f('0x4e')]][_0x4d3f('0x1f')]=_0x4d3f('0x59');}if(!_[_0x4d3f('0x19')](queues[_0xe65853['secondtransfererlinkedid']])){if(_0xe65853[_0x4d3f('0x5a')]&&queues[_0xe65853[_0x4d3f('0x5a')]]){queues[_0xe65853[_0x4d3f('0x5a')]][_0x4d3f('0x21')]=0x1;queues[_0xe65853[_0x4d3f('0x55')]]=_[_0x4d3f('0x5b')](queues[_0xe65853[_0x4d3f('0x5a')]]);queues[_0xe65853[_0x4d3f('0x55')]][_0x4d3f('0xd')]=_0xe65853[_0x4d3f('0x55')];queues[_0xe65853[_0x4d3f('0x55')]][_0x4d3f('0x21')]=0x2;queues[_0xe65853[_0x4d3f('0x55')]][_0x4d3f('0x7')]=queues[_0xe65853[_0x4d3f('0x4e')]][_0x4d3f('0x7')];queues[_0xe65853[_0x4d3f('0x55')]][_0x4d3f('0x5c')]=queues[_0xe65853[_0x4d3f('0x4e')]][_0x4d3f('0x5c')];queues[_0xe65853[_0x4d3f('0x55')]][_0x4d3f('0x39')]=utils['now']();queues[_0xe65853[_0x4d3f('0x55')]][_0x4d3f('0x37')]=utils[_0x4d3f('0x16')]();queues[_0xe65853['transfertargetuniqueid']]['holdtime']=0x0;queues[_0xe65853[_0x4d3f('0x55')]][_0x4d3f('0x56')]=0x0;utils['info'](util[_0x4d3f('0x3')](_0x4d3f('0x5d'),_0xe65853[_0x4d3f('0x4d')],queues[_0xe65853[_0x4d3f('0x55')]][_0x4d3f('0x1e')],queues[_0xe65853[_0x4d3f('0x55')]][_0x4d3f('0xd')],queues[_0xe65853['transfertargetuniqueid']]['calleridnum'],queues[_0xe65853[_0x4d3f('0x55')]]['calleridname']));}else{utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x57'),_0xe65853[_0x4d3f('0x4d')],queues[_0xe65853[_0x4d3f('0x4f')]]['name'],_0xe65853[_0x4d3f('0x4e')]));queues[_0xe65853['secondtransfererlinkedid']][_0x4d3f('0xd')]=_0xe65853[_0x4d3f('0x4e')];}}}}catch(_0x1aec45){utils[_0x4d3f('0x17')](util['format'](_0x4d3f('0x5e'),_0xe65853[_0x4d3f('0x4d')]),_0x1aec45);}};exports[_0x4d3f('0x5f')]=function(_0x1b5d7a){try{if(!_[_0x4d3f('0x19')](queues[_0x1b5d7a[_0x4d3f('0xe')]])){utils['debug'](util['format'](_0x4d3f('0x60'),_0x1b5d7a[_0x4d3f('0xe')]),_0x1b5d7a);queues[_0x1b5d7a['uniqueid']][_0x4d3f('0x61')]=utils[_0x4d3f('0x16')]();utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x62'),_0x1b5d7a[_0x4d3f('0xe')],queues[_0x1b5d7a[_0x4d3f('0xe')]][_0x4d3f('0x1e')],queues[_0x1b5d7a[_0x4d3f('0xe')]][_0x4d3f('0x61')]));}}catch(_0x9f8d2b){utils[_0x4d3f('0x17')](util['format'](_0x4d3f('0x60'),_0x1b5d7a[_0x4d3f('0xe')]),_0x9f8d2b);}};exports[_0x4d3f('0x63')]=function(_0x55c550){try{if(!_['isNil'](queues[_0x55c550['uniqueid']])){if(!_['isNil'](queues[_0x55c550['uniqueid']]['musiconholdstartAt'])){utils['debug'](util[_0x4d3f('0x3')]('[%s][queues][musiconholdstop]',_0x55c550[_0x4d3f('0xe')]),_0x55c550);queues[_0x55c550['uniqueid']][_0x4d3f('0x56')]+=utils[_0x4d3f('0x64')](utils['now'](),queues[_0x55c550[_0x4d3f('0xe')]]['musiconholdstartAt']);utils[_0x4d3f('0x12')](util[_0x4d3f('0x3')](_0x4d3f('0x65'),_0x55c550[_0x4d3f('0xe')],queues[_0x55c550[_0x4d3f('0xe')]][_0x4d3f('0x1e')],queues[_0x55c550[_0x4d3f('0xe')]][_0x4d3f('0x56')]));delete queues[_0x55c550['uniqueid']]['musiconholdstartAt'];}}}catch(_0xbdce1b){utils[_0x4d3f('0x17')](util[_0x4d3f('0x3')](_0x4d3f('0x66'),_0x55c550[_0x4d3f('0xe')]),_0xbdce1b);}}; \ No newline at end of file +var _0x791e=['queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerjoinAt','position','count','agentconnect','membername','destaccountcode','assigned','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','transferexten','transferuniqueid','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','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt'];(function(_0x2065df,_0x4930c8){var _0x217699=function(_0x2f51eb){while(--_0x2f51eb){_0x2065df['push'](_0x2065df['shift']());}};_0x217699(++_0x4930c8);}(_0x791e,0x17b));var _0xe791=function(_0x43c140,_0x4a4557){_0x43c140=_0x43c140-0x0;var _0x4fe688=_0x791e[_0x43c140];return _0x4fe688;};'use strict';var _=require(_0xe791('0x0'));var util=require(_0xe791('0x1'));var utils=require(_0xe791('0x2'));var queues={};function writeDB(_0x3458c1){utils[_0xe791('0x3')](util[_0xe791('0x4')](_0xe791('0x5'),_0x3458c1[_0xe791('0x6')],_0x3458c1[_0xe791('0x7')],_0x3458c1[_0xe791('0x8')],_0x3458c1[_0xe791('0x9')],_0x3458c1['calleridnum'],_0x3458c1['accountcode'],_0x3458c1['queuecallerexitreason']));if(_0x3458c1[_0xe791('0x8')]){utils[_0xe791('0xa')](_0x3458c1[_0xe791('0x8')])[_0xe791('0xb')](function(_0x3d8e63){if(_0x3d8e63){_0x3458c1['type']=_0x3d8e63[_0xe791('0xc')];}utils['request'](_0xe791('0xd'),_0x3458c1);});}else{utils[_0xe791('0xe')](_0xe791('0xd'),_0x3458c1);}if(_0x3458c1[_0xe791('0xf')]){delete queues[_0x3458c1[_0xe791('0xf')]];}else{delete queues[_0x3458c1[_0xe791('0x6')]];}}exports[_0xe791('0x10')]=function(_0x3b4330){try{utils['debug'](util[_0xe791('0x4')]('[%s][queues][queuecallerjoin]',_0x3b4330[_0xe791('0x6')]),_0x3b4330);utils[_0xe791('0x3')](util[_0xe791('0x4')](_0xe791('0x11'),_0x3b4330[_0xe791('0x6')],_0x3b4330[_0xe791('0x8')],_0x3b4330['position']));queues[_0x3b4330[_0xe791('0x6')]]=_['assign'](_0x3b4330,{'originalposition':_0x3b4330['position'],'queuecallerjoinAt':utils[_0xe791('0x12')](),'mohtime':0x0});}catch(_0x5e4904){utils[_0xe791('0x13')](util[_0xe791('0x4')]('[%s][queues][queuecallerjoin]',_0x3b4330[_0xe791('0x6')]),_0x5e4904);}};exports[_0xe791('0x14')]=function(_0x44fe9c){try{if(!_[_0xe791('0x15')](queues[_0x44fe9c[_0xe791('0x6')]])){utils[_0xe791('0x16')](util[_0xe791('0x4')](_0xe791('0x17'),_0x44fe9c[_0xe791('0x6')]),_0x44fe9c);if(queues[_0x44fe9c[_0xe791('0x6')]][_0xe791('0x18')]){if(!queues[_0x44fe9c[_0xe791('0x6')]][_0xe791('0x19')]&&!queues[_0x44fe9c[_0xe791('0x6')]][_0xe791('0x1a')]){queues[_0x44fe9c[_0xe791('0x6')]][_0xe791('0x1b')]=!![];queues[_0x44fe9c['uniqueid']][_0xe791('0x1c')]=utils['now']();queues[_0x44fe9c[_0xe791('0x6')]][_0xe791('0x1d')]=_0xe791('0x1e');}utils['info'](util[_0xe791('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x44fe9c[_0xe791('0x6')],queues[_0x44fe9c[_0xe791('0x6')]]['name'],queues[_0x44fe9c['uniqueid']][_0xe791('0x1d')]));writeDB(queues[_0x44fe9c[_0xe791('0x6')]]);}else if(queues[_0x44fe9c[_0xe791('0x6')]][_0xe791('0xf')]){utils[_0xe791('0x3')](util['format'](_0xe791('0x1f'),_0x44fe9c[_0xe791('0x6')],queues[_0x44fe9c[_0xe791('0x6')]]['name'],queues[_0x44fe9c[_0xe791('0x6')]][_0xe791('0xf')]));queues[queues[_0x44fe9c[_0xe791('0x6')]]['transfereduniqueid']]=queues[_0x44fe9c['uniqueid']];queues[queues[_0x44fe9c[_0xe791('0x6')]][_0xe791('0xf')]][_0xe791('0x20')]=0x2;delete queues[_0x44fe9c[_0xe791('0x6')]];}}}catch(_0x582e6a){utils[_0xe791('0x13')](util[_0xe791('0x4')](_0xe791('0x17'),_0x44fe9c[_0xe791('0x6')]),_0x582e6a);}};exports[_0xe791('0x21')]=function(_0xc95917){try{utils[_0xe791('0x16')](util['format'](_0xe791('0x22'),_0xc95917[_0xe791('0x6')]),_0xc95917);if(!_[_0xe791('0x15')](_0xc95917[_0xe791('0x23')][_0xe791('0x24')])&&_0xc95917[_0xe791('0x25')][_0xe791('0x26')]()!=='CONTINUE'){if(!_[_0xe791('0x15')](queues[_0xc95917[_0xe791('0x6')]])){queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x19')]=![];queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x27')]=null;queues[_0xc95917['uniqueid']]['queuecallerexit']=!![];queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x28')]=utils[_0xe791('0x12')]();queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x1d')]=_0xc95917[_0xe791('0x25')][_0xe791('0x26')]();utils[_0xe791('0x3')](util[_0xe791('0x4')](_0xe791('0x29'),_0xc95917[_0xe791('0x6')],queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x2a')],_0xc95917[_0xe791('0x25')],queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x1d')]));writeDB(queues[_0xc95917['uniqueid']]);}}else if(!_[_0xe791('0x15')](_0xc95917[_0xe791('0x23')]['queueposition'])){if(!_[_0xe791('0x15')](queues[_0xc95917[_0xe791('0x6')]])&&!queues[_0xc95917[_0xe791('0x6')]]['queuecallerabandon']){queues[_0xc95917['uniqueid']][_0xe791('0x19')]=![];queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x27')]=null;queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x1a')]=!![];queues[_0xc95917['uniqueid']][_0xe791('0x28')]=utils[_0xe791('0x12')]();queues[_0xc95917['uniqueid']][_0xe791('0x1d')]=_0xe791('0x2b');utils['info'](util[_0xe791('0x4')](_0xe791('0x2c'),_0xc95917[_0xe791('0x6')],queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x2a')],_0xc95917[_0xe791('0x25')],queues[_0xc95917[_0xe791('0x6')]][_0xe791('0x1d')]));}}}catch(_0x526e0e){utils[_0xe791('0x13')](util['format'](_0xe791('0x22'),_0xc95917[_0xe791('0x6')]),_0x526e0e);}};exports[_0xe791('0x19')]=function(_0x1f006e){try{if(!_[_0xe791('0x15')](queues[_0x1f006e[_0xe791('0x6')]])){utils[_0xe791('0x16')](util[_0xe791('0x4')]('[%s][queues][queuecallerabandon]',_0x1f006e[_0xe791('0x6')]),_0x1f006e);queues[_0x1f006e[_0xe791('0x6')]][_0xe791('0x1a')]=![];queues[_0x1f006e['uniqueid']]['queuecallerexitAt']=null;queues[_0x1f006e[_0xe791('0x6')]]['queuecallerabandon']=!![];queues[_0x1f006e[_0xe791('0x6')]][_0xe791('0x27')]=utils[_0xe791('0x12')]();queues[_0x1f006e[_0xe791('0x6')]]['queuecallerexitreason']=_0xe791('0x2d');utils['info'](util['format'](_0xe791('0x2e'),_0x1f006e['uniqueid'],queues[_0x1f006e[_0xe791('0x6')]][_0xe791('0x2a')],queues[_0x1f006e[_0xe791('0x6')]][_0xe791('0x1d')]));}}catch(_0xf1d97){utils['error'](util[_0xe791('0x4')](_0xe791('0x2f'),_0x1f006e[_0xe791('0x6')]),_0xf1d97);}};exports[_0xe791('0x30')]=function(_0x26ab0a){try{if(!_[_0xe791('0x15')](queues[_0x26ab0a[_0xe791('0x6')]])){utils['debug'](util['format'](_0xe791('0x31'),_0x26ab0a[_0xe791('0x6')]),_0x26ab0a);utils['info'](util[_0xe791('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x26ab0a[_0xe791('0x6')],queues[_0x26ab0a['uniqueid']]['name'],_0x26ab0a[_0xe791('0x32')],_0x26ab0a[_0xe791('0x33')]));queues[_0x26ab0a[_0xe791('0x6')]][_0xe791('0x30')]=!![];queues[_0x26ab0a[_0xe791('0x6')]][_0xe791('0x18')]=utils[_0xe791('0x12')]();queues[_0x26ab0a[_0xe791('0x6')]]['holdtime']=utils['diffTime'](queues[_0x26ab0a[_0xe791('0x6')]][_0xe791('0x18')],queues[_0x26ab0a[_0xe791('0x6')]][_0xe791('0x34')]);queues[_0x26ab0a['uniqueid']][_0xe791('0x35')]=_0x26ab0a[_0xe791('0x35')];queues[_0x26ab0a[_0xe791('0x6')]][_0xe791('0x36')]=_0x26ab0a[_0xe791('0x36')];queues[_0x26ab0a[_0xe791('0x6')]][_0xe791('0x32')]=_0x26ab0a[_0xe791('0x32')];queues[_0x26ab0a[_0xe791('0x6')]][_0xe791('0x33')]=_0x26ab0a['connectedlinename'];}}catch(_0x39f366){utils[_0xe791('0x13')](util[_0xe791('0x4')](_0xe791('0x31'),_0x26ab0a[_0xe791('0x6')]),_0x39f366);}};exports[_0xe791('0x37')]=function(_0x8495b6){try{if(!_[_0xe791('0x15')](queues[_0x8495b6[_0xe791('0x6')]])){utils[_0xe791('0x16')](util[_0xe791('0x4')]('[%s][queues][agentconnect]',_0x8495b6[_0xe791('0x6')]),_0x8495b6);utils[_0xe791('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x8495b6['uniqueid'],queues[_0x8495b6[_0xe791('0x6')]][_0xe791('0x2a')],_0x8495b6[_0xe791('0x38')],_0x8495b6[_0xe791('0x39')]));queues[_0x8495b6[_0xe791('0x6')]]['queuecallerabandon']=![];queues[_0x8495b6['uniqueid']][_0xe791('0x19')]=![];queues[_0x8495b6[_0xe791('0x6')]][_0xe791('0x27')]=null;queues[_0x8495b6[_0xe791('0x6')]][_0xe791('0x1a')]=![];queues[_0x8495b6['uniqueid']][_0xe791('0x1d')]=null;queues[_0x8495b6[_0xe791('0x6')]][_0xe791('0x28')]=null;queues[_0x8495b6[_0xe791('0x6')]][_0xe791('0x3a')]=!![];queues[_0x8495b6['uniqueid']]['accountcode']=_0x8495b6['destaccountcode'];queues[_0x8495b6['uniqueid']][_0xe791('0x9')]=_0x8495b6[_0xe791('0x38')];}}catch(_0x4d73e2){utils[_0xe791('0x13')](util[_0xe791('0x4')]('[%s][queues][agentconnect]',_0x8495b6[_0xe791('0x6')]),_0x4d73e2);}};exports[_0xe791('0x3b')]=function(_0x3c7ed9){try{if(!_['isNil'](queues[_0x3c7ed9[_0xe791('0x6')]])){if(queues[_0x3c7ed9['uniqueid']][_0xe791('0x18')]){utils[_0xe791('0x16')](util[_0xe791('0x4')]('[%s][queues][agentcomplete]',_0x3c7ed9[_0xe791('0x6')]),_0x3c7ed9);queues[_0x3c7ed9[_0xe791('0x6')]][_0xe791('0x19')]=![];queues[_0x3c7ed9[_0xe791('0x6')]][_0xe791('0x19')]=![];queues[_0x3c7ed9[_0xe791('0x6')]][_0xe791('0x27')]=null;queues[_0x3c7ed9['uniqueid']][_0xe791('0x1a')]=![];queues[_0x3c7ed9[_0xe791('0x6')]]['queuecallerexitAt']=null;queues[_0x3c7ed9[_0xe791('0x6')]][_0xe791('0x3a')]=!![];queues[_0x3c7ed9[_0xe791('0x6')]][_0xe791('0x9')]=_0x3c7ed9[_0xe791('0x38')];queues[_0x3c7ed9['uniqueid']][_0xe791('0x1b')]=!![];queues[_0x3c7ed9[_0xe791('0x6')]]['queuecallercompleteAt']=utils['now']();if(_0x3c7ed9[_0xe791('0x3c')]==_0xe791('0x3d')){if(!queues[_0x3c7ed9[_0xe791('0x6')]][_0xe791('0x3d')]){queues[_0x3c7ed9[_0xe791('0x6')]][_0xe791('0x1d')]=_0xe791('0x3e');}}else{queues[_0x3c7ed9['uniqueid']][_0xe791('0x1d')]=_0xe791('0x3f')+_0x3c7ed9[_0xe791('0x3c')]['toUpperCase']();}utils[_0xe791('0x3')](util['format'](_0xe791('0x40'),_0x3c7ed9[_0xe791('0x6')],queues[_0x3c7ed9[_0xe791('0x6')]][_0xe791('0x2a')],_0x3c7ed9[_0xe791('0x38')],queues[_0x3c7ed9[_0xe791('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x3c7ed9[_0xe791('0x6')]]);}}}catch(_0x334a53){utils[_0xe791('0x13')](util[_0xe791('0x4')](_0xe791('0x41'),_0x3c7ed9[_0xe791('0x6')]),_0x334a53);}};exports[_0xe791('0x42')]=function(_0x1c2225){try{if(!_['isNil'](queues[_0x1c2225['transfereeuniqueid']])){utils['debug'](util['format'](_0xe791('0x43'),_0x1c2225[_0xe791('0x6')]),_0x1c2225);queues[_0x1c2225[_0xe791('0x44')]][_0xe791('0x3d')]=!![];queues[_0x1c2225[_0xe791('0x44')]][_0xe791('0x45')]='BLIND';queues[_0x1c2225[_0xe791('0x44')]][_0xe791('0x46')]=_0x1c2225['extension'];queues[_0x1c2225[_0xe791('0x44')]][_0xe791('0x47')]=_0x1c2225['transfereeuniqueid'];queues[_0x1c2225[_0xe791('0x44')]][_0xe791('0x1d')]=_0xe791('0x48');utils['info'](util[_0xe791('0x4')](_0xe791('0x49'),_0x1c2225['uniqueid'],queues[_0x1c2225[_0xe791('0x44')]][_0xe791('0x2a')],_0x1c2225['transfereeuniqueid'],_0x1c2225[_0xe791('0x4a')]));}}catch(_0x377faf){utils[_0xe791('0x13')](util[_0xe791('0x4')](_0xe791('0x43'),_0x1c2225[_0xe791('0x6')]),_0x377faf);}};exports[_0xe791('0x4b')]=function(_0x4165b3){try{utils[_0xe791('0x16')](util[_0xe791('0x4')](_0xe791('0x4c'),_0x4165b3[_0xe791('0x4d')]),_0x4165b3);if(_0x4165b3[_0xe791('0x4d')]==_0x4165b3[_0xe791('0x4e')]){if(!_[_0xe791('0x15')](queues[_0x4165b3[_0xe791('0x4f')]])){utils[_0xe791('0x3')](util[_0xe791('0x4')](_0xe791('0x50'),_0x4165b3[_0xe791('0x4d')],queues[_0x4165b3[_0xe791('0x4f')]][_0xe791('0x2a')],_0x4165b3[_0xe791('0x51')]));queues[_0x4165b3[_0xe791('0x4f')]][_0xe791('0x3d')]=!![];queues[_0x4165b3['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x4165b3['secondtransfererlinkedid']][_0xe791('0x46')]=_0x4165b3[_0xe791('0x51')];queues[_0x4165b3[_0xe791('0x4f')]][_0xe791('0x47')]=_0x4165b3['origtransfereruniqueid'];queues[_0x4165b3[_0xe791('0x4f')]][_0xe791('0x1d')]=_0xe791('0x52');}if(!_[_0xe791('0x15')](queues[_0x4165b3[_0xe791('0x4e')]])){if(_0x4165b3[_0xe791('0x53')]&&queues[_0x4165b3['transfereelinkedid']]){queues[_0x4165b3['transfereelinkedid']][_0xe791('0x20')]=0x1;queues[_0x4165b3[_0xe791('0x44')]]=_[_0xe791('0x54')](queues[_0x4165b3[_0xe791('0x53')]]);queues[_0x4165b3[_0xe791('0x44')]][_0xe791('0xf')]=_0x4165b3[_0xe791('0x55')];queues[_0x4165b3[_0xe791('0x44')]][_0xe791('0x20')]=0x2;queues[_0x4165b3[_0xe791('0x44')]][_0xe791('0x56')]=queues[_0x4165b3['secondtransfererlinkedid']][_0xe791('0x56')];queues[_0x4165b3[_0xe791('0x44')]][_0xe791('0x57')]=queues[_0x4165b3['secondtransfererlinkedid']][_0xe791('0x57')];queues[_0x4165b3[_0xe791('0x44')]]['queuecallerjoinAt']=utils[_0xe791('0x12')]();queues[_0x4165b3[_0xe791('0x44')]][_0xe791('0x18')]=utils[_0xe791('0x12')]();queues[_0x4165b3[_0xe791('0x44')]][_0xe791('0x58')]=0x0;queues[_0x4165b3[_0xe791('0x44')]][_0xe791('0x59')]=0x0;utils[_0xe791('0x3')](util[_0xe791('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x4165b3[_0xe791('0x4d')],queues[_0x4165b3[_0xe791('0x44')]][_0xe791('0x2a')],queues[_0x4165b3['transfereeuniqueid']][_0xe791('0x56')],queues[_0x4165b3[_0xe791('0x44')]][_0xe791('0x57')]));}else{utils[_0xe791('0x3')](util[_0xe791('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4165b3[_0xe791('0x4d')],queues[_0x4165b3[_0xe791('0x4e')]][_0xe791('0x2a')],_0x4165b3[_0xe791('0x4f')]));queues[_0x4165b3[_0xe791('0x4e')]][_0xe791('0xf')]=_0x4165b3[_0xe791('0x4f')];}}}else if(_0x4165b3['secondtransfereruniqueid']==_0x4165b3[_0xe791('0x4f')]){if(!_[_0xe791('0x15')](queues[_0x4165b3[_0xe791('0x4e')]])){utils[_0xe791('0x3')](util[_0xe791('0x4')](_0xe791('0x5a'),_0x4165b3[_0xe791('0x4d')],queues[_0x4165b3[_0xe791('0x4e')]]['name'],_0x4165b3[_0xe791('0x5b')],_0x4165b3[_0xe791('0x5c')]));queues[_0x4165b3[_0xe791('0x4e')]][_0xe791('0x3d')]=!![];queues[_0x4165b3[_0xe791('0x4e')]][_0xe791('0x45')]=_0xe791('0x5d');queues[_0x4165b3[_0xe791('0x4e')]][_0xe791('0x46')]=_0x4165b3[_0xe791('0x5c')];queues[_0x4165b3[_0xe791('0x4e')]][_0xe791('0x47')]=_0x4165b3['secondtransfereruniqueid'];queues[_0x4165b3[_0xe791('0x4e')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xe791('0x15')](queues[_0x4165b3[_0xe791('0x4f')]])){if(_0x4165b3['transfertargetlinkedid']&&queues[_0x4165b3[_0xe791('0x5e')]]){queues[_0x4165b3[_0xe791('0x5e')]]['queuecallerenterreason']=0x1;queues[_0x4165b3[_0xe791('0x55')]]=_[_0xe791('0x54')](queues[_0x4165b3[_0xe791('0x5e')]]);queues[_0x4165b3[_0xe791('0x55')]]['transfereduniqueid']=_0x4165b3[_0xe791('0x55')];queues[_0x4165b3[_0xe791('0x55')]][_0xe791('0x20')]=0x2;queues[_0x4165b3[_0xe791('0x55')]]['calleridnum']=queues[_0x4165b3[_0xe791('0x4e')]][_0xe791('0x56')];queues[_0x4165b3[_0xe791('0x55')]][_0xe791('0x57')]=queues[_0x4165b3[_0xe791('0x4e')]][_0xe791('0x57')];queues[_0x4165b3[_0xe791('0x55')]][_0xe791('0x34')]=utils['now']();queues[_0x4165b3[_0xe791('0x55')]][_0xe791('0x18')]=utils[_0xe791('0x12')]();queues[_0x4165b3['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x4165b3['transfertargetuniqueid']][_0xe791('0x59')]=0x0;utils['info'](util[_0xe791('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x4165b3[_0xe791('0x4d')],queues[_0x4165b3[_0xe791('0x55')]]['name'],queues[_0x4165b3['transfertargetuniqueid']][_0xe791('0xf')],queues[_0x4165b3['transfertargetuniqueid']][_0xe791('0x56')],queues[_0x4165b3['transfertargetuniqueid']][_0xe791('0x57')]));}else{utils[_0xe791('0x3')](util[_0xe791('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4165b3['origtransfereruniqueid'],queues[_0x4165b3[_0xe791('0x4f')]][_0xe791('0x2a')],_0x4165b3[_0xe791('0x4e')]));queues[_0x4165b3[_0xe791('0x4f')]][_0xe791('0xf')]=_0x4165b3[_0xe791('0x4e')];}}}}catch(_0x494745){utils[_0xe791('0x13')](util['format'](_0xe791('0x4c'),_0x4165b3[_0xe791('0x4d')]),_0x494745);}};exports[_0xe791('0x5f')]=function(_0x11f411){try{if(!_['isNil'](queues[_0x11f411[_0xe791('0x6')]])){utils[_0xe791('0x16')](util[_0xe791('0x4')](_0xe791('0x60'),_0x11f411[_0xe791('0x6')]),_0x11f411);queues[_0x11f411[_0xe791('0x6')]]['musiconholdstartAt']=utils['now']();utils[_0xe791('0x3')](util[_0xe791('0x4')](_0xe791('0x61'),_0x11f411[_0xe791('0x6')],queues[_0x11f411['uniqueid']][_0xe791('0x2a')],queues[_0x11f411['uniqueid']]['musiconholdstartAt']));}}catch(_0x20b7f7){utils[_0xe791('0x13')](util[_0xe791('0x4')]('[%s][queues][musiconholdstart]',_0x11f411[_0xe791('0x6')]),_0x20b7f7);}};exports['musiconholdstop']=function(_0x5bb6a2){try{if(!_[_0xe791('0x15')](queues[_0x5bb6a2[_0xe791('0x6')]])){if(!_[_0xe791('0x15')](queues[_0x5bb6a2[_0xe791('0x6')]][_0xe791('0x62')])){utils[_0xe791('0x16')](util['format'](_0xe791('0x63'),_0x5bb6a2[_0xe791('0x6')]),_0x5bb6a2);queues[_0x5bb6a2[_0xe791('0x6')]][_0xe791('0x59')]+=utils[_0xe791('0x64')](utils[_0xe791('0x12')](),queues[_0x5bb6a2['uniqueid']][_0xe791('0x62')]);utils[_0xe791('0x3')](util['format'](_0xe791('0x65'),_0x5bb6a2[_0xe791('0x6')],queues[_0x5bb6a2['uniqueid']]['name'],queues[_0x5bb6a2[_0xe791('0x6')]][_0xe791('0x59')]));delete queues[_0x5bb6a2[_0xe791('0x6')]][_0xe791('0x62')];}}}catch(_0x2c688e){utils[_0xe791('0x13')](util[_0xe791('0x4')](_0xe791('0x63'),_0x5bb6a2['uniqueid']),_0x2c688e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index cbbe7d8..4dbd0c0 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 _0x1e71=['lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','channelstate','transfer','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue'];(function(_0xca78f1,_0x2c90c8){var _0xda435e=function(_0x375d7a){while(--_0x375d7a){_0xca78f1['push'](_0xca78f1['shift']());}};_0xda435e(++_0x2c90c8);}(_0x1e71,0x14a));var _0x11e7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1e71[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x11e7('0x0'));var util=require(_0x11e7('0x1'));var utils=require(_0x11e7('0x2'));var recordings={};function writeDB(_0x2d77f7){utils['info'](util[_0x11e7('0x3')](_0x11e7('0x4'),_0x2d77f7[_0x11e7('0x5')]));if(_0x2d77f7[_0x11e7('0x6')]){utils[_0x11e7('0x7')](_0x2d77f7[_0x11e7('0x6')])[_0x11e7('0x8')](function(_0xc8becf){if(_0xc8becf){_0x2d77f7[_0x11e7('0x9')]=_0xc8becf[_0x11e7('0xa')];_0x2d77f7[_0x11e7('0xb')]=_0xc8becf['id'];}utils[_0x11e7('0xc')]('CreateVoiceRecording',_0x2d77f7);});}else{utils[_0x11e7('0xc')](_0x11e7('0xd'),_0x2d77f7);}}exports[_0x11e7('0xe')]=function(_0x3d7b5b){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x3d7b5b[_0x11e7('0x5')]),_0x3d7b5b);if(_0x3d7b5b[_0x11e7('0x5')]==_0x3d7b5b[_0x11e7('0xf')]){utils[_0x11e7('0x10')](util['format'](_0x11e7('0x11'),_0x3d7b5b[_0x11e7('0x5')],_0x3d7b5b[_0x11e7('0x12')],_0x3d7b5b['exten']));recordings[_0x3d7b5b['uniqueid']]={'uniqueid':_0x3d7b5b['uniqueid'],'accountcode':_0x3d7b5b['accountcode'],'exten':_0x3d7b5b[_0x11e7('0x13')],'context':_0x3d7b5b[_0x11e7('0x12')],'channel':_0x3d7b5b[_0x11e7('0x14')],'monitors':[]};}}catch(_0xf38dc6){utils[_0x11e7('0x15')](util[_0x11e7('0x3')]('[%s][recordings][newchannel]',_0x3d7b5b[_0x11e7('0x5')]),_0xf38dc6);}};exports[_0x11e7('0x16')]=function(_0x13824b){try{utils['debug'](util[_0x11e7('0x3')](_0x11e7('0x17'),_0x13824b[_0x11e7('0x5')]),_0x13824b);if(!_['isNil'](recordings[_0x13824b[_0x11e7('0x5')]])&&_0x13824b['channelstate']==0x6){utils[_0x11e7('0x10')](util[_0x11e7('0x3')](_0x11e7('0x18'),_0x13824b['uniqueid'],_0x13824b[_0x11e7('0x12')],_0x13824b[_0x11e7('0x14')]));}else if(!_[_0x11e7('0x19')](recordings[_0x13824b[_0x11e7('0xf')]])&&_0x13824b[_0x11e7('0x1a')]==0x6&&_0x13824b[_0x11e7('0x12')]!=_0x11e7('0x1b')){utils['info'](util[_0x11e7('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x13824b[_0x11e7('0x5')],_0x13824b[_0x11e7('0xf')],_0x13824b[_0x11e7('0x12')],_0x13824b[_0x11e7('0x14')]));recordings[_0x13824b['linkedid']][_0x11e7('0x6')]=_0x13824b[_0x11e7('0x6')];}}catch(_0x4a18a7){utils[_0x11e7('0x15')](util[_0x11e7('0x3')](_0x11e7('0x17'),_0x13824b[_0x11e7('0x5')]),_0x4a18a7);}};exports[_0x11e7('0x1c')]=function(_0xa3bb01){try{if(!_['isNil'](_0xa3bb01[_0x11e7('0x1d')])&&!_[_0x11e7('0x19')](_0xa3bb01[_0x11e7('0x1d')][_0x11e7('0x1e')])){utils[_0x11e7('0x1f')](util[_0x11e7('0x3')](_0x11e7('0x20'),_0xa3bb01[_0x11e7('0x5')]),_0xa3bb01);utils[_0x11e7('0x10')](util[_0x11e7('0x3')](_0x11e7('0x21'),_0xa3bb01['uniqueid'],_0xa3bb01[_0x11e7('0x1d')],_0xa3bb01[_0x11e7('0x22')]));if(_[_0x11e7('0x23')](_0xa3bb01[_0x11e7('0x22')],_0x11e7('0x24'))){_0xa3bb01[_0x11e7('0x22')]=_0xa3bb01['value'][_0x11e7('0x25')]('.wav49',_0x11e7('0x26'));}if(recordings[_0xa3bb01[_0x11e7('0xf')]]){var _0x1ebc6c=_[_0x11e7('0x27')](recordings[_0xa3bb01['linkedid']]['monitors'],{'value':_0xa3bb01['value']});if(_[_0x11e7('0x19')](_0x1ebc6c)){recordings[_0xa3bb01[_0x11e7('0xf')]][_0x11e7('0x28')][_0x11e7('0x29')]({'value':_0xa3bb01['value']});}}}}catch(_0x9ab9d9){utils[_0x11e7('0x15')](util[_0x11e7('0x3')]('[%s][recordings][varset]',_0xa3bb01['uniqueid']),_0x9ab9d9);}};exports[_0x11e7('0x2a')]=function(_0x49fa4f){try{if(!_[_0x11e7('0x19')](recordings[_0x49fa4f[_0x11e7('0x5')]])){utils[_0x11e7('0x1f')](util[_0x11e7('0x3')](_0x11e7('0x2b'),_0x49fa4f[_0x11e7('0x5')]),_0x49fa4f);utils[_0x11e7('0x10')](util['format'](_0x11e7('0x2c'),_0x49fa4f[_0x11e7('0x5')],_0x49fa4f[_0x11e7('0x2d')],_0x49fa4f[_0x11e7('0x2e')],_0x49fa4f['cause-txt']));recordings[_0x49fa4f[_0x11e7('0x5')]][_0x11e7('0x2d')]=_0x49fa4f[_0x11e7('0x2d')];recordings[_0x49fa4f['uniqueid']]['calleridname']=_0x49fa4f[_0x11e7('0x2e')];recordings[_0x49fa4f[_0x11e7('0x5')]][_0x11e7('0x2f')]=_0x49fa4f[_0x11e7('0x2f')];recordings[_0x49fa4f[_0x11e7('0x5')]][_0x11e7('0x30')]=_0x49fa4f[_0x11e7('0x30')];if(recordings[_0x49fa4f['uniqueid']][_0x11e7('0x31')]==_0x11e7('0x32')&&recordings[_0x49fa4f['uniqueid']][_0x11e7('0x6')]){recordings[_0x49fa4f[_0x11e7('0x5')]][_0x11e7('0x2f')]=recordings[_0x49fa4f['uniqueid']][_0x11e7('0x6')];recordings[_0x49fa4f[_0x11e7('0x5')]][_0x11e7('0x30')]='';}recordings[_0x49fa4f[_0x11e7('0x5')]][_0x11e7('0x28')][_0x11e7('0x33')](function(_0x195d2f){var _0x920620=_['clone'](recordings[_0x49fa4f['uniqueid']]);_0x920620[_0x11e7('0x22')]=_0x195d2f[_0x11e7('0x22')];writeDB(_0x920620);});delete recordings[_0x49fa4f[_0x11e7('0x5')]];}}catch(_0x4c8a34){utils[_0x11e7('0x15')](util[_0x11e7('0x3')](_0x11e7('0x2b'),_0x49fa4f[_0x11e7('0x5')]),_0x4c8a34);}};exports[_0x11e7('0x34')]=function(_0x1d5e8c){try{if(!_[_0x11e7('0x19')](recordings[_0x1d5e8c['uniqueid']])){utils[_0x11e7('0x1f')](util['format']('[%s][recordings][newexten]',_0x1d5e8c[_0x11e7('0x5')]),_0x1d5e8c);utils[_0x11e7('0x10')](util['format'](_0x11e7('0x35'),_0x1d5e8c[_0x11e7('0x5')],_0x1d5e8c['application'],_0x1d5e8c[_0x11e7('0x36')]));if(_0x1d5e8c['application'][_0x11e7('0x37')]()==_0x11e7('0x38')&&_[_0x11e7('0x39')](_0x1d5e8c['appdata'][_0x11e7('0x37')](),'cdr')){var _0xf38d78=_0x1d5e8c[_0x11e7('0x36')][_0x11e7('0x3a')]('=');var _0x4d1a00=_0xf38d78[0x0][_0x11e7('0x3b')](_0xf38d78[0x0][_0x11e7('0x3c')]('(')+0x1,_0xf38d78[0x0][_0x11e7('0x3c')](')'));var _0x1160d8=_0xf38d78[0x1];recordings[_0x1d5e8c[_0x11e7('0x5')]][_0x4d1a00]=_0x1160d8;}}}catch(_0x546e23){utils['error'](util[_0x11e7('0x3')](_0x11e7('0x3d'),_0x1d5e8c['uniqueid']),_0x546e23);}};exports[_0x11e7('0x3e')]=function(_0x5c1d96){try{if(!_[_0x11e7('0x19')](recordings[_0x5c1d96[_0x11e7('0x5')]])){utils[_0x11e7('0x1f')](util[_0x11e7('0x3')](_0x11e7('0x3f'),_0x5c1d96[_0x11e7('0x5')]),_0x5c1d96);utils[_0x11e7('0x10')](util['format'](_0x11e7('0x40'),_0x5c1d96['uniqueid'],_0x5c1d96[_0x11e7('0x41')]));recordings[_0x5c1d96[_0x11e7('0x5')]][_0x11e7('0x41')]=_0x5c1d96[_0x11e7('0x41')];}}catch(_0x30f5b6){utils[_0x11e7('0x15')](util[_0x11e7('0x3')](_0x11e7('0x3f'),_0x5c1d96[_0x11e7('0x5')]),_0x30f5b6);}}; \ No newline at end of file +var _0x27af=['type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','cdr','appdata','split','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','newstate','[%s][recordings][newstate]','isNil','channelstate','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','error','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename'];(function(_0x4f1651,_0xc4ac4f){var _0x44868e=function(_0x2a2ec1){while(--_0x2a2ec1){_0x4f1651['push'](_0x4f1651['shift']());}};_0x44868e(++_0xc4ac4f);}(_0x27af,0x8e));var _0xf27a=function(_0x1534a7,_0x28dc30){_0x1534a7=_0x1534a7-0x0;var _0x4735ce=_0x27af[_0x1534a7];return _0x4735ce;};'use strict';var _=require(_0xf27a('0x0'));var util=require(_0xf27a('0x1'));var utils=require(_0xf27a('0x2'));var recordings={};function writeDB(_0x278a76){utils[_0xf27a('0x3')](util[_0xf27a('0x4')](_0xf27a('0x5'),_0x278a76[_0xf27a('0x6')]));if(_0x278a76[_0xf27a('0x7')]){utils[_0xf27a('0x8')](_0x278a76['accountcode'])['then'](function(_0x382bbb){if(_0x382bbb){_0x278a76[_0xf27a('0x9')]=_0x382bbb[_0xf27a('0xa')];_0x278a76[_0xf27a('0xb')]=_0x382bbb['id'];}utils[_0xf27a('0xc')](_0xf27a('0xd'),_0x278a76);});}else{utils[_0xf27a('0xc')]('CreateVoiceRecording',_0x278a76);}}exports['newchannel']=function(_0x17ae61){try{utils[_0xf27a('0xe')](util[_0xf27a('0x4')](_0xf27a('0xf'),_0x17ae61[_0xf27a('0x6')]),_0x17ae61);if(_0x17ae61[_0xf27a('0x6')]==_0x17ae61[_0xf27a('0x10')]){utils[_0xf27a('0x3')](util['format'](_0xf27a('0x11'),_0x17ae61['uniqueid'],_0x17ae61['context'],_0x17ae61[_0xf27a('0x12')]));recordings[_0x17ae61[_0xf27a('0x6')]]={'uniqueid':_0x17ae61[_0xf27a('0x6')],'accountcode':_0x17ae61[_0xf27a('0x7')],'exten':_0x17ae61['exten'],'context':_0x17ae61[_0xf27a('0x13')],'channel':_0x17ae61['channel'],'monitors':[]};}}catch(_0x3be048){utils['error'](util[_0xf27a('0x4')]('[%s][recordings][newchannel]',_0x17ae61[_0xf27a('0x6')]),_0x3be048);}};exports[_0xf27a('0x14')]=function(_0x16f2ff){try{utils['debug'](util[_0xf27a('0x4')](_0xf27a('0x15'),_0x16f2ff[_0xf27a('0x6')]),_0x16f2ff);if(!_[_0xf27a('0x16')](recordings[_0x16f2ff[_0xf27a('0x6')]])&&_0x16f2ff[_0xf27a('0x17')]==0x6){utils[_0xf27a('0x3')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x16f2ff['uniqueid'],_0x16f2ff[_0xf27a('0x13')],_0x16f2ff[_0xf27a('0x18')]));}else if(!_[_0xf27a('0x16')](recordings[_0x16f2ff['linkedid']])&&_0x16f2ff['channelstate']==0x6&&_0x16f2ff['context']!=_0xf27a('0x19')){utils[_0xf27a('0x3')](util[_0xf27a('0x4')](_0xf27a('0x1a'),_0x16f2ff[_0xf27a('0x6')],_0x16f2ff[_0xf27a('0x10')],_0x16f2ff[_0xf27a('0x13')],_0x16f2ff[_0xf27a('0x18')]));recordings[_0x16f2ff[_0xf27a('0x10')]]['accountcode']=_0x16f2ff[_0xf27a('0x7')];}}catch(_0x221bcc){utils['error'](util[_0xf27a('0x4')](_0xf27a('0x15'),_0x16f2ff[_0xf27a('0x6')]),_0x221bcc);}};exports[_0xf27a('0x1b')]=function(_0x461c1d){try{if(!_[_0xf27a('0x16')](_0x461c1d[_0xf27a('0x1c')])&&!_['isNil'](_0x461c1d['variable'][_0xf27a('0x1d')])){utils[_0xf27a('0xe')](util[_0xf27a('0x4')](_0xf27a('0x1e'),_0x461c1d[_0xf27a('0x6')]),_0x461c1d);utils[_0xf27a('0x3')](util['format'](_0xf27a('0x1f'),_0x461c1d[_0xf27a('0x6')],_0x461c1d[_0xf27a('0x1c')],_0x461c1d[_0xf27a('0x20')]));if(_[_0xf27a('0x21')](_0x461c1d['value'],_0xf27a('0x22'))){_0x461c1d[_0xf27a('0x20')]=_0x461c1d['value'][_0xf27a('0x23')](_0xf27a('0x22'),_0xf27a('0x24'));}if(recordings[_0x461c1d[_0xf27a('0x10')]]){var _0x4a5796=_[_0xf27a('0x25')](recordings[_0x461c1d[_0xf27a('0x10')]][_0xf27a('0x26')],{'value':_0x461c1d[_0xf27a('0x20')]});if(_['isNil'](_0x4a5796)){recordings[_0x461c1d[_0xf27a('0x10')]][_0xf27a('0x26')][_0xf27a('0x27')]({'value':_0x461c1d[_0xf27a('0x20')]});}}}}catch(_0x206f42){utils[_0xf27a('0x28')](util[_0xf27a('0x4')](_0xf27a('0x1e'),_0x461c1d['uniqueid']),_0x206f42);}};exports['hangup']=function(_0x3cf97c){try{if(!_[_0xf27a('0x16')](recordings[_0x3cf97c[_0xf27a('0x6')]])){utils[_0xf27a('0xe')](util[_0xf27a('0x4')](_0xf27a('0x29'),_0x3cf97c['uniqueid']),_0x3cf97c);utils[_0xf27a('0x3')](util[_0xf27a('0x4')](_0xf27a('0x2a'),_0x3cf97c[_0xf27a('0x6')],_0x3cf97c['calleridnum'],_0x3cf97c[_0xf27a('0x2b')],_0x3cf97c['cause-txt']));recordings[_0x3cf97c['uniqueid']][_0xf27a('0x2c')]=_0x3cf97c['calleridnum'];recordings[_0x3cf97c[_0xf27a('0x6')]]['calleridname']=_0x3cf97c[_0xf27a('0x2b')];recordings[_0x3cf97c[_0xf27a('0x6')]][_0xf27a('0x2d')]=_0x3cf97c[_0xf27a('0x2d')];recordings[_0x3cf97c[_0xf27a('0x6')]][_0xf27a('0x2e')]=_0x3cf97c[_0xf27a('0x2e')];if(recordings[_0x3cf97c[_0xf27a('0x6')]][_0xf27a('0x2f')]==_0xf27a('0x30')&&recordings[_0x3cf97c['uniqueid']][_0xf27a('0x7')]){recordings[_0x3cf97c[_0xf27a('0x6')]]['connectedlinenum']=recordings[_0x3cf97c[_0xf27a('0x6')]]['accountcode'];recordings[_0x3cf97c['uniqueid']]['connectedlinename']='';}recordings[_0x3cf97c[_0xf27a('0x6')]][_0xf27a('0x26')][_0xf27a('0x31')](function(_0x2e0b28){var _0x490009=_['clone'](recordings[_0x3cf97c[_0xf27a('0x6')]]);_0x490009['value']=_0x2e0b28[_0xf27a('0x20')];writeDB(_0x490009);});delete recordings[_0x3cf97c['uniqueid']];}}catch(_0x50d248){utils[_0xf27a('0x28')](util[_0xf27a('0x4')](_0xf27a('0x29'),_0x3cf97c['uniqueid']),_0x50d248);}};exports[_0xf27a('0x32')]=function(_0x34cd5e){try{if(!_[_0xf27a('0x16')](recordings[_0x34cd5e[_0xf27a('0x6')]])){utils[_0xf27a('0xe')](util[_0xf27a('0x4')](_0xf27a('0x33'),_0x34cd5e[_0xf27a('0x6')]),_0x34cd5e);utils[_0xf27a('0x3')](util[_0xf27a('0x4')](_0xf27a('0x34'),_0x34cd5e['uniqueid'],_0x34cd5e[_0xf27a('0x35')],_0x34cd5e['appdata']));if(_0x34cd5e[_0xf27a('0x35')][_0xf27a('0x36')]()=='set'&&_[_0xf27a('0x37')](_0x34cd5e['appdata'][_0xf27a('0x36')](),_0xf27a('0x38'))){var _0x358776=_0x34cd5e[_0xf27a('0x39')][_0xf27a('0x3a')]('=');var _0x46a568=_0x358776[0x0]['substring'](_0x358776[0x0]['lastIndexOf']('(')+0x1,_0x358776[0x0][_0xf27a('0x3b')](')'));var _0x1ddbcc=_0x358776[0x1];recordings[_0x34cd5e[_0xf27a('0x6')]][_0x46a568]=_0x1ddbcc;}}}catch(_0x37633f){utils['error'](util[_0xf27a('0x4')]('[%s][recordings][newexten]',_0x34cd5e[_0xf27a('0x6')]),_0x37633f);}};exports[_0xf27a('0x3c')]=function(_0x321ec6){try{if(!_[_0xf27a('0x16')](recordings[_0x321ec6[_0xf27a('0x6')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x321ec6['uniqueid']),_0x321ec6);utils[_0xf27a('0x3')](util[_0xf27a('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x321ec6[_0xf27a('0x6')],_0x321ec6[_0xf27a('0x3d')]));recordings[_0x321ec6[_0xf27a('0x6')]][_0xf27a('0x3d')]=_0x321ec6[_0xf27a('0x3d')];}}catch(_0x28b574){utils['error'](util[_0xf27a('0x4')](_0xf27a('0x3e'),_0x321ec6[_0xf27a('0x6')]),_0x28b574);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 68aa648..db41f4e 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 _0xf041=['format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','blind','attendedtransfer','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xf041,0x8d));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1f04('0x0'));var util=require(_0x1f04('0x1'));var utils=require(_0x1f04('0x2'));function writeDB(_0x3a341e){utils['info'](util[_0x1f04('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x3a341e[_0x1f04('0x4')]===_0x1f04('0x5')?_0x3a341e[_0x1f04('0x6')]:_0x3a341e[_0x1f04('0x7')],_0x3a341e[_0x1f04('0x4')]));utils[_0x1f04('0x8')](_0x1f04('0x9'),_0x3a341e);}exports[_0x1f04('0xa')]=function(_0x1698cd){try{utils[_0x1f04('0xb')](util[_0x1f04('0x3')](_0x1f04('0xc'),_0x1698cd[_0x1f04('0x7')]),_0x1698cd);utils['info'](util[_0x1f04('0x3')](_0x1f04('0xd'),_0x1698cd['uniqueid'],_0x1698cd[_0x1f04('0xe')],_0x1698cd['transferercalleridname'],_0x1698cd['transfereecalleridnum'],_0x1698cd['transfereecalleridname']));_0x1698cd[_0x1f04('0x4')]=_0x1f04('0xf');writeDB(_0x1698cd);}catch(_0x3f90ae){utils['error'](util[_0x1f04('0x3')](_0x1f04('0xc'),_0x1698cd[_0x1f04('0x7')]),_0x3f90ae);}};exports[_0x1f04('0x10')]=function(_0x407221){try{utils['debug'](util[_0x1f04('0x3')]('[%s][transfers][attendedtransfer]',_0x407221[_0x1f04('0x6')]),_0x407221);utils[_0x1f04('0x11')](util[_0x1f04('0x3')](_0x1f04('0x12'),_0x407221['origtransfereruniqueid'],_0x407221['origtransferercalleridnum'],_0x407221['origtransferercalleridname'],_0x407221[_0x1f04('0x13')],_0x407221[_0x1f04('0x14')]));_0x407221=_[_0x1f04('0x15')](_0x407221,{'transfererchannel':_0x407221[_0x1f04('0x16')],'transferercalleridnum':_0x407221[_0x1f04('0x17')],'transferercalleridname':_0x407221[_0x1f04('0x18')],'transfererconnectedlinenum':_0x407221['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x407221['secondtransfererconnectedlinename'],'transfereraccountcode':_0x407221['origtransfereraccountcode'],'transferercontext':_0x407221[_0x1f04('0x19')],'transfererexten':_0x407221['secondtransfererexten'],'transfererlinkedid':_0x407221[_0x1f04('0x1a')],'context':_0x407221[_0x1f04('0x1b')],'extension':_0x407221[_0x1f04('0x1c')],'type':'attended'});if(_[_0x1f04('0x1d')](_0x407221['transfereechannel'])){_0x407221=_[_0x1f04('0x15')](_0x407221,{'transfereechannel':_0x407221['transfertargetchannel'],'transfereecalleridnum':_0x407221[_0x1f04('0x13')],'transfereecalleridname':_0x407221[_0x1f04('0x14')],'transfereeconnectedlinenum':_0x407221['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x407221[_0x1f04('0x1e')],'transfereeaccountcode':_0x407221[_0x1f04('0x1f')],'transfereecontext':_0x407221[_0x1f04('0x20')],'transfereeexten':_0x407221[_0x1f04('0x21')],'transfereelinkedid':_0x407221[_0x1f04('0x22')]});}writeDB(_0x407221);}catch(_0x49823b){utils[_0x1f04('0x23')](util['format']('[%s][transfers][attendedtransfer]',_0x407221[_0x1f04('0x6')]),_0x49823b);}}; \ No newline at end of file +var _0x2a85=['transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','debug','[%s][transfers][blindtransfer]','uniqueid','transferercalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil'];(function(_0x1e8696,_0x589446){var _0x4b2a28=function(_0x329123){while(--_0x329123){_0x1e8696['push'](_0x1e8696['shift']());}};_0x4b2a28(++_0x589446);}(_0x2a85,0x1be));var _0x52a8=function(_0x1e0144,_0x1528e3){_0x1e0144=_0x1e0144-0x0;var _0x172a14=_0x2a85[_0x1e0144];return _0x172a14;};'use strict';var _=require(_0x52a8('0x0'));var util=require(_0x52a8('0x1'));var utils=require(_0x52a8('0x2'));function writeDB(_0x202cb6){utils['info'](util[_0x52a8('0x3')](_0x52a8('0x4'),_0x202cb6[_0x52a8('0x5')]===_0x52a8('0x6')?_0x202cb6[_0x52a8('0x7')]:_0x202cb6['uniqueid'],_0x202cb6[_0x52a8('0x5')]));utils[_0x52a8('0x8')]('CreateVoiceTransferReport',_0x202cb6);}exports['blindtransfer']=function(_0x445a35){try{utils[_0x52a8('0x9')](util[_0x52a8('0x3')](_0x52a8('0xa'),_0x445a35['uniqueid']),_0x445a35);utils['info'](util[_0x52a8('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x445a35[_0x52a8('0xb')],_0x445a35[_0x52a8('0xc')],_0x445a35['transferercalleridname'],_0x445a35['transfereecalleridnum'],_0x445a35[_0x52a8('0xd')]));_0x445a35['type']=_0x52a8('0xe');writeDB(_0x445a35);}catch(_0x4cc588){utils[_0x52a8('0xf')](util[_0x52a8('0x3')](_0x52a8('0xa'),_0x445a35[_0x52a8('0xb')]),_0x4cc588);}};exports[_0x52a8('0x10')]=function(_0x5c65c7){try{utils['debug'](util[_0x52a8('0x3')](_0x52a8('0x11'),_0x5c65c7['origtransfereruniqueid']),_0x5c65c7);utils[_0x52a8('0x12')](util['format'](_0x52a8('0x13'),_0x5c65c7['origtransfereruniqueid'],_0x5c65c7[_0x52a8('0x14')],_0x5c65c7[_0x52a8('0x15')],_0x5c65c7[_0x52a8('0x16')],_0x5c65c7[_0x52a8('0x17')]));_0x5c65c7=_[_0x52a8('0x18')](_0x5c65c7,{'transfererchannel':_0x5c65c7[_0x52a8('0x19')],'transferercalleridnum':_0x5c65c7[_0x52a8('0x14')],'transferercalleridname':_0x5c65c7[_0x52a8('0x15')],'transfererconnectedlinenum':_0x5c65c7[_0x52a8('0x1a')],'transfererconnectedlinename':_0x5c65c7[_0x52a8('0x1b')],'transfereraccountcode':_0x5c65c7[_0x52a8('0x1c')],'transferercontext':_0x5c65c7[_0x52a8('0x1d')],'transfererexten':_0x5c65c7[_0x52a8('0x1e')],'transfererlinkedid':_0x5c65c7[_0x52a8('0x1f')],'context':_0x5c65c7['origtransferercontext'],'extension':_0x5c65c7[_0x52a8('0x20')],'type':_0x52a8('0x6')});if(_[_0x52a8('0x21')](_0x5c65c7[_0x52a8('0x22')])){_0x5c65c7=_['assign'](_0x5c65c7,{'transfereechannel':_0x5c65c7[_0x52a8('0x23')],'transfereecalleridnum':_0x5c65c7[_0x52a8('0x16')],'transfereecalleridname':_0x5c65c7[_0x52a8('0x17')],'transfereeconnectedlinenum':_0x5c65c7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5c65c7[_0x52a8('0x24')],'transfereeaccountcode':_0x5c65c7[_0x52a8('0x25')],'transfereecontext':_0x5c65c7[_0x52a8('0x26')],'transfereeexten':_0x5c65c7['transfertargetexten'],'transfereelinkedid':_0x5c65c7[_0x52a8('0x27')]});}writeDB(_0x5c65c7);}catch(_0x267091){utils[_0x52a8('0xf')](util[_0x52a8('0x3')]('[%s][transfers][attendedtransfer]',_0x5c65c7[_0x52a8('0x7')]),_0x267091);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c48fcc0..440ef38 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 _0x2cf4=['diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','client','../../config/logger','xdr','info','inspect','debug','error','then','[utils][request]\x20name:%s','catch','request','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x2cf4,0xea));var _0x42cf=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0x2cf4[_0x1ee9a1];return _0x21270f;};'use strict';var BPromise=require(_0x42cf('0x0'));var jayson=require(_0x42cf('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0x42cf('0x2')]['http']({'port':0x2329});var logger=require(_0x42cf('0x3'))(_0x42cf('0x4'));exports[_0x42cf('0x5')]=function(_0x31bf16,_0x2f9e43){logger['info'](_0x31bf16,_0x2f9e43?util[_0x42cf('0x6')](_0x2f9e43,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x4881db,_0x1c2c6a){logger[_0x42cf('0x7')](_0x4881db,_0x1c2c6a?util[_0x42cf('0x6')](_0x1c2c6a,{'showHidden':![],'depth':null}):'');};exports[_0x42cf('0x8')]=function(_0x37ea8c,_0x1df050){logger[_0x42cf('0x8')](_0x37ea8c,_0x1df050?util['inspect'](_0x1df050,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4102e0,_0x28c848){return client['request'](_0x4102e0,{'body':_0x28c848})[_0x42cf('0x9')](function(_0x4a6413){logger[_0x42cf('0x7')](_0x42cf('0xa'),_0x4102e0,_0x4a6413?util[_0x42cf('0x6')](_0x4a6413,{'showHidden':![],'depth':null}):'');})[_0x42cf('0xb')](function(_0x4d5ceb){logger[_0x42cf('0x8')]('[utils][request]\x20name:%s',_0x4102e0,_0x4d5ceb?util['inspect'](_0x4d5ceb,{'showHidden':![],'depth':null}):'');});};function getUser(_0x533944){return client[_0x42cf('0xc')](_0x42cf('0xd'),{'options':{'raw':!![],'attributes':['id',_0x42cf('0xe'),_0x42cf('0xf'),_0x42cf('0x10')],'where':_0x533944,'limit':0x1}})[_0x42cf('0x9')](function(_0x5587e2){logger[_0x42cf('0x7')](_0x42cf('0x11'),JSON[_0x42cf('0x12')](_0x533944),_0x5587e2?util['inspect'](_0x5587e2,{'showHidden':![],'depth':null}):'');return _0x5587e2[_0x42cf('0x13')][_0x42cf('0x14')]?_0x5587e2[_0x42cf('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x1e455d){return new BPromise(function(_0x3179e7,_0x2e197b){if(_0x1e455d){return getUser({'internal':_0x1e455d})[_0x42cf('0x9')](function(_0x14085b){logger[_0x42cf('0x5')](_0x42cf('0x15'),_0x1e455d,_0x14085b?_0x42cf('0x16'):_0x42cf('0x17'));return _0x3179e7(_0x14085b);})[_0x42cf('0xb')](function(_0x341166){logger[_0x42cf('0x8')]('[utils][getUserByInternal]',_0x341166?util[_0x42cf('0x6')](_0x341166,{'showHidden':![],'depth':null}):'');return _0x3179e7(null);});}return _0x3179e7(null);});};exports[_0x42cf('0x18')]=function(_0x1d835e){return new BPromise(function(_0x5e222a,_0x364735){if(_0x1d835e){return getUser({'interface':_0x1d835e})[_0x42cf('0x9')](function(_0xd1408c){logger[_0x42cf('0x5')](_0x42cf('0x19'),_0x1d835e,_0xd1408c?_0x42cf('0x16'):_0x42cf('0x17'));return _0x5e222a(_0xd1408c);})[_0x42cf('0xb')](function(_0x21d765){logger[_0x42cf('0x8')](_0x42cf('0x1a'),_0x21d765?util[_0x42cf('0x6')](_0x21d765,{'showHidden':![],'depth':null}):'');return _0x5e222a(null);});}return _0x5e222a(null);});};exports[_0x42cf('0x1b')]=function(_0x171b00){return new BPromise(function(_0x3c9626,_0x560d40){if(_0x171b00){return getUser({'name':_0x171b00})[_0x42cf('0x9')](function(_0x2b2524){logger[_0x42cf('0x5')](_0x42cf('0x1c'),_0x171b00,_0x2b2524?_0x42cf('0x16'):'notfound');return _0x3c9626(_0x2b2524);})['catch'](function(_0x4c5392){logger[_0x42cf('0x8')](_0x42cf('0x1d'),_0x4c5392?util[_0x42cf('0x6')](_0x4c5392,{'showHidden':![],'depth':null}):'');return _0x3c9626(null);});}return _0x3c9626(null);});};exports[_0x42cf('0x1e')]=function(_0x22f9bc){return new BPromise(function(_0x2d2c31,_0x36c95d){if(_0x22f9bc){return client['request'](_0x42cf('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x42cf('0xf'),_0x42cf('0x20'),_0x42cf('0x21'),'acwTimeout'],'where':{'name':_0x22f9bc},'limit':0x1}})[_0x42cf('0x9')](function(_0x461e84){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x22f9bc,_0x461e84?util[_0x42cf('0x6')](_0x461e84,{'showHidden':![],'depth':null}):'');logger[_0x42cf('0x5')](_0x42cf('0x22'),_0x22f9bc,_0x461e84?_0x42cf('0x16'):_0x42cf('0x17'));return _0x2d2c31(_0x461e84[_0x42cf('0x13')][_0x42cf('0x14')]?_0x461e84[_0x42cf('0x13')][0x0]:null);})[_0x42cf('0xb')](function(_0x3c3521){logger[_0x42cf('0x8')](_0x42cf('0x23'),_0x3c3521?util[_0x42cf('0x6')](_0x3c3521,{'showHidden':![],'depth':null}):'');return _0x2d2c31(null);});}return _0x2d2c31(null);});};exports[_0x42cf('0x24')]=function(_0x4b7f67,_0x2c5dc0){return moment(_0x4b7f67)['add'](_0x2c5dc0,_0x42cf('0x25'))[_0x42cf('0x26')](_0x42cf('0x27'));};exports[_0x42cf('0x28')]=function(_0x2d8dee,_0x4447a1){return moment(_0x2d8dee)['subtract'](_0x4447a1,_0x42cf('0x25'))[_0x42cf('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x42cf('0x29')]=function(_0x3182ff,_0x28e1be){return moment(_0x3182ff)[_0x42cf('0x2a')](moment(_0x28e1be),_0x42cf('0x25'));};exports[_0x42cf('0x2b')]=function(_0x31a692,_0xeb1046){return parseInt(_0x31a692,0xa)+parseInt(_0xeb1046,0xa);};exports['now']=function(){return moment()[_0x42cf('0x26')](_0x42cf('0x27'));};exports[_0x42cf('0x2c')]=function(_0x3cdc94,_0x5496a3){if(_0x5496a3){return moment(_0x3cdc94)[_0x42cf('0x2c')](_0x5496a3);}return!![];};exports[_0x42cf('0x2d')]=function(_0x5e62da,_0x70f2af){if(_0x70f2af){return moment(_0x5e62da)[_0x42cf('0x2d')](_0x70f2af);}else if(_0x5e62da){return!![];}return![];}; \ No newline at end of file +var _0xfeef=['subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','catch','[utils][request]\x20name:%s','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','length','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime'];(function(_0x18e014,_0x593ba7){var _0x858ce3=function(_0x4eebc0){while(--_0x4eebc0){_0x18e014['push'](_0x18e014['shift']());}};_0x858ce3(++_0x593ba7);}(_0xfeef,0x10b));var _0xffee=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0xfeef[_0x26fc81];return _0x9feece;};'use strict';var BPromise=require(_0xffee('0x0'));var jayson=require('jayson/promise');var moment=require(_0xffee('0x1'));var util=require(_0xffee('0x2'));var client=jayson[_0xffee('0x3')][_0xffee('0x4')]({'port':0x2329});var logger=require(_0xffee('0x5'))(_0xffee('0x6'));exports[_0xffee('0x7')]=function(_0x19e939,_0x2c399a){logger[_0xffee('0x7')](_0x19e939,_0x2c399a?util[_0xffee('0x8')](_0x2c399a,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x28b269,_0x3cc820){logger[_0xffee('0x9')](_0x28b269,_0x3cc820?util[_0xffee('0x8')](_0x3cc820,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x35a665,_0x596417){logger[_0xffee('0xa')](_0x35a665,_0x596417?util['inspect'](_0x596417,{'showHidden':![],'depth':null}):'');};exports[_0xffee('0xb')]=function(_0x4cec4d,_0x4cd120){return client['request'](_0x4cec4d,{'body':_0x4cd120})['then'](function(_0x1a8fad){logger[_0xffee('0x9')]('[utils][request]\x20name:%s',_0x4cec4d,_0x1a8fad?util[_0xffee('0x8')](_0x1a8fad,{'showHidden':![],'depth':null}):'');})[_0xffee('0xc')](function(_0x1693f1){logger[_0xffee('0xa')](_0xffee('0xd'),_0x4cec4d,_0x1693f1?util[_0xffee('0x8')](_0x1693f1,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3cfae2){return client['request'](_0xffee('0xe'),{'options':{'raw':!![],'attributes':['id',_0xffee('0xf'),'name',_0xffee('0x10')],'where':_0x3cfae2,'limit':0x1}})[_0xffee('0x11')](function(_0x275780){logger[_0xffee('0x9')](_0xffee('0x12'),JSON['stringify'](_0x3cfae2),_0x275780?util[_0xffee('0x8')](_0x275780,{'showHidden':![],'depth':null}):'');return _0x275780['result'][_0xffee('0x13')]?_0x275780[_0xffee('0x14')][0x0]:null;});}exports['getUserByInternal']=function(_0xd4d0ec){return new BPromise(function(_0x55fbd4,_0x45af7d){if(_0xd4d0ec){return getUser({'internal':_0xd4d0ec})[_0xffee('0x11')](function(_0x74d410){logger[_0xffee('0x7')](_0xffee('0x15'),_0xd4d0ec,_0x74d410?_0xffee('0x16'):_0xffee('0x17'));return _0x55fbd4(_0x74d410);})[_0xffee('0xc')](function(_0x13d760){logger[_0xffee('0xa')](_0xffee('0x18'),_0x13d760?util[_0xffee('0x8')](_0x13d760,{'showHidden':![],'depth':null}):'');return _0x55fbd4(null);});}return _0x55fbd4(null);});};exports[_0xffee('0x19')]=function(_0x368dc3){return new BPromise(function(_0x3da283,_0x1ed05f){if(_0x368dc3){return getUser({'interface':_0x368dc3})[_0xffee('0x11')](function(_0x3c0da5){logger[_0xffee('0x7')](_0xffee('0x1a'),_0x368dc3,_0x3c0da5?'found':_0xffee('0x17'));return _0x3da283(_0x3c0da5);})['catch'](function(_0x58f706){logger[_0xffee('0xa')](_0xffee('0x1b'),_0x58f706?util[_0xffee('0x8')](_0x58f706,{'showHidden':![],'depth':null}):'');return _0x3da283(null);});}return _0x3da283(null);});};exports[_0xffee('0x1c')]=function(_0x4e3a7d){return new BPromise(function(_0x2c8be7,_0xeb4bd1){if(_0x4e3a7d){return getUser({'name':_0x4e3a7d})['then'](function(_0x317305){logger[_0xffee('0x7')](_0xffee('0x1d'),_0x4e3a7d,_0x317305?_0xffee('0x16'):'notfound');return _0x2c8be7(_0x317305);})['catch'](function(_0x24dcb6){logger[_0xffee('0xa')]('[utils][getUserByName]',_0x24dcb6?util[_0xffee('0x8')](_0x24dcb6,{'showHidden':![],'depth':null}):'');return _0x2c8be7(null);});}return _0x2c8be7(null);});};exports[_0xffee('0x1e')]=function(_0x26a8a6){return new BPromise(function(_0x2c0c23,_0x245f1a){if(_0x26a8a6){return client[_0xffee('0xb')](_0xffee('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xffee('0x20'),_0xffee('0x21'),_0xffee('0x22'),_0xffee('0x23')],'where':{'name':_0x26a8a6},'limit':0x1}})['then'](function(_0x1091b1){logger['debug'](_0xffee('0x24'),_0x26a8a6,_0x1091b1?util[_0xffee('0x8')](_0x1091b1,{'showHidden':![],'depth':null}):'');logger['info'](_0xffee('0x25'),_0x26a8a6,_0x1091b1?_0xffee('0x16'):_0xffee('0x17'));return _0x2c0c23(_0x1091b1['result'][_0xffee('0x13')]?_0x1091b1[_0xffee('0x14')][0x0]:null);})[_0xffee('0xc')](function(_0x5c1cc3){logger[_0xffee('0xa')](_0xffee('0x26'),_0x5c1cc3?util[_0xffee('0x8')](_0x5c1cc3,{'showHidden':![],'depth':null}):'');return _0x2c0c23(null);});}return _0x2c0c23(null);});};exports[_0xffee('0x27')]=function(_0x881375,_0x3e8450){return moment(_0x881375)[_0xffee('0x28')](_0x3e8450,_0xffee('0x29'))[_0xffee('0x2a')](_0xffee('0x2b'));};exports[_0xffee('0x2c')]=function(_0x4f006d,_0x4f5b26){return moment(_0x4f006d)[_0xffee('0x2d')](_0x4f5b26,_0xffee('0x29'))['format'](_0xffee('0x2b'));};exports[_0xffee('0x2e')]=function(_0x1923a3,_0x49dacb){return moment(_0x1923a3)[_0xffee('0x2f')](moment(_0x49dacb),_0xffee('0x29'));};exports[_0xffee('0x30')]=function(_0x480f4b,_0x2d8219){return parseInt(_0x480f4b,0xa)+parseInt(_0x2d8219,0xa);};exports[_0xffee('0x31')]=function(){return moment()[_0xffee('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xffee('0x32')]=function(_0x15f08f,_0xf1b70c){if(_0xf1b70c){return moment(_0x15f08f)[_0xffee('0x32')](_0xf1b70c);}return!![];};exports[_0xffee('0x33')]=function(_0xf5c727,_0x20db52){if(_0x20db52){return moment(_0xf5c727)[_0xffee('0x33')](_0x20db52);}else if(_0xf5c727){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 dc70702..42e219e 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 _0x28b9=['fs-extra','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','then','catch','user','no-user','timestamp','error','api','auth','set','client-side-logger','use','logger','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','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)','method','role','other','agent_name','test','setupLoggers'];(function(_0xd904c7,_0x521eeb){var _0x4b7621=function(_0x5a5dc8){while(--_0x5a5dc8){_0xd904c7['push'](_0xd904c7['shift']());}};_0x4b7621(++_0x521eeb);}(_0x28b9,0x1c2));var _0x928b=function(_0xd50b7f,_0x53c16c){_0xd50b7f=_0xd50b7f-0x0;var _0x380972=_0x28b9[_0xd50b7f];return _0x380972;};var fs=require(_0x928b('0x0'));var _=require(_0x928b('0x1'));var ewinston=require('express-winston');var path=require(_0x928b('0x2'));var util=require(_0x928b('0x3'));var fileLogger=require(_0x928b('0x4'))[_0x928b('0x5')];var safeTemplate=require(_0x928b('0x6'))[_0x928b('0x7')];var maskSensitiveData=require(_0x928b('0x8'))[_0x928b('0x9')];function ClientSideLogger(){function _0x499010(_0x153691){var _0x2b5e26=path[_0x928b('0xa')](_0x928b('0xb'),_0x928b('0xc'),_0x928b('0xd'));var _0x5cf313=path[_0x928b('0xa')](_0x928b('0xe'),_0x153691['role']+'-'+_0x153691[_0x928b('0xf')]);return fs[_0x928b('0x10')](path['join'](_0x2b5e26,_0x5cf313))[_0x928b('0x11')](function(){var _0x206444=fileLogger('client',path[_0x928b('0xa')](_0x2b5e26,_0x5cf313));return _0x206444;})[_0x928b('0x12')](function(_0xabbe96){throw _0xabbe96;});}this[_0x928b('0xc')]=function(_0x3b1ebf,_0x5aee62,_0x4f2453,_0x2d2fcb){return _0x499010(_0x3b1ebf[_0x928b('0x13')])[_0x928b('0x11')](function(_0x4ceea3){var _0x4913e4=_0x4ceea3[_0x5aee62];return _0x4913e4;})['then'](function(_0x307a6c){var _0x582c79=_0x3b1ebf[_0x928b('0x13')]?_0x3b1ebf[_0x928b('0x13')]['id']:_0x928b('0x14');var _0x567f48=_0x2d2fcb['data'];var _0x5778cf=_0x2d2fcb[_0x928b('0x15')];var _0x28c9a2=new Date(Number(_0x5778cf));return _0x307a6c(_0x582c79,_0x28c9a2,_0x4f2453,_0x567f48);})['catch'](function(_0x3ba06b){fileLogger(_0x928b('0xe'))[_0x928b('0x16')](_0x3ba06b);});};}function setupLoggers(_0x56513e){return new Promise(function(_0x3888ba){var _0x97bb20=new ClientSideLogger();var _0x53b306=fileLogger(_0x928b('0x17'));var _0x7291f2=fileLogger(_0x928b('0x18'));_0x56513e[_0x928b('0x19')](_0x928b('0x1a'),_0x97bb20);_0x56513e[_0x928b('0x1b')](ewinston[_0x928b('0x1c')]({'winstonInstance':_0x53b306,'meta':![],'statusLevels':!![],'msg':function(_0x552163,_0x33326c){var _0x3e20fb='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x928b('0x1d')](_0x552163[_0x928b('0x1e')])){_0x3e20fb+=_0x928b('0x1f');var _0x568045=_0x552163[_0x928b('0x1e')];maskSensitiveData(_0x568045);}return safeTemplate(util[_0x928b('0x20')](_0x3e20fb,_0x552163['method'],_0x552163[_0x928b('0x21')][_0x928b('0x22')]?_0x552163['headers']['x-forwarded-for']:_0x552163[_0x928b('0x23')][_0x928b('0x24')]||_0x552163['ip'],_0x552163[_0x928b('0x25')],_0x33326c[_0x928b('0x26')],_0x33326c[_0x928b('0x27')],_0x552163[_0x928b('0x13')]?_0x552163[_0x928b('0x13')]['id']:null,_0x552163[_0x928b('0x13')]?_0x552163['user'][_0x928b('0xf')]:null,_0x552163[_0x928b('0x13')]?_0x552163[_0x928b('0x13')]['role']:null,_0x568045?util[_0x928b('0x28')](_0x568045,![],null):''));}}));_0x56513e['use'](ewinston[_0x928b('0x1c')]({'winstonInstance':_0x7291f2,'meta':![],'statusLevels':!![],'msg':function(_0x35bb77,_0x308dac){var _0x99f0bd='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x35bb77['body']&&_0x35bb77[_0x928b('0x1e')][_0x928b('0x29')]&&_0x35bb77[_0x928b('0x1e')][_0x928b('0x2a')]){_0x99f0bd=_0x928b('0x2b');}return util[_0x928b('0x20')](_0x99f0bd,_0x35bb77[_0x928b('0x2c')],_0x35bb77[_0x928b('0x21')][_0x928b('0x22')]?_0x35bb77[_0x928b('0x21')][_0x928b('0x22')]:_0x35bb77[_0x928b('0x23')]['remoteAddress']||_0x35bb77['ip'],_0x35bb77[_0x928b('0x25')],_0x308dac[_0x928b('0x26')],_0x308dac[_0x928b('0x27')],_0x35bb77[_0x928b('0x13')]?_0x35bb77[_0x928b('0x13')]['id']:null,_0x35bb77[_0x928b('0x13')]?_0x35bb77[_0x928b('0x13')][_0x928b('0xf')]:null,_0x35bb77['user']?_0x35bb77[_0x928b('0x13')][_0x928b('0x2d')]:null,_0x35bb77[_0x928b('0x1e')]&&_0x35bb77['body'][_0x928b('0x29')]?_0x35bb77[_0x928b('0x1e')][_0x928b('0x29')]:_0x928b('0x2e'),_0x35bb77[_0x928b('0x1e')]&&_0x35bb77[_0x928b('0x1e')][_0x928b('0x2a')]?_0x35bb77[_0x928b('0x1e')][_0x928b('0x2a')]:'',_0x35bb77[_0x928b('0x1e')]&&_0x35bb77[_0x928b('0x1e')][_0x928b('0x2f')]?_0x35bb77[_0x928b('0x1e')][_0x928b('0x2f')]:'');},'ignoreRoute':function(_0x2d3a40){var _0x3980f9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3980f9[_0x928b('0x30')](_0x2d3a40['url']);}}));return _0x3888ba();});}exports[_0x928b('0x31')]=setupLoggers; \ No newline at end of file +var _0x49a7=['./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','xcally','client','role','ensureDir','then','user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','remoteAddress','url','responseTime','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','connection','statusCode','device','agent_id','agent_name','lodash','express-winston','path','util'];(function(_0x48ea3f,_0x52aada){var _0x452f07=function(_0x4acc9b){while(--_0x4acc9b){_0x48ea3f['push'](_0x48ea3f['shift']());}};_0x452f07(++_0x52aada);}(_0x49a7,0xd8));var _0x749a=function(_0x448186,_0x315c85){_0x448186=_0x448186-0x0;var _0x1dc71a=_0x49a7[_0x448186];return _0x1dc71a;};var fs=require('fs-extra');var _=require(_0x749a('0x0'));var ewinston=require(_0x749a('0x1'));var path=require(_0x749a('0x2'));var util=require(_0x749a('0x3'));var fileLogger=require(_0x749a('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x749a('0x5')];var maskSensitiveData=require(_0x749a('0x6'))[_0x749a('0x7')];function ClientSideLogger(){function _0xbeaa13(_0x11815b){var _0x2be7ce=path[_0x749a('0x8')]('/var',_0x749a('0x9'),_0x749a('0xa'));var _0x51b17f=path[_0x749a('0x8')](_0x749a('0xb'),_0x11815b[_0x749a('0xc')]+'-'+_0x11815b['name']);return fs[_0x749a('0xd')](path['join'](_0x2be7ce,_0x51b17f))[_0x749a('0xe')](function(){var _0x4d7d7b=fileLogger(_0x749a('0xb'),path['join'](_0x2be7ce,_0x51b17f));return _0x4d7d7b;})['catch'](function(_0x485924){throw _0x485924;});}this[_0x749a('0x9')]=function(_0x3e319b,_0xe05174,_0x66f111,_0x582572){return _0xbeaa13(_0x3e319b['user'])['then'](function(_0x17fbc0){var _0x5dca0d=_0x17fbc0[_0xe05174];return _0x5dca0d;})[_0x749a('0xe')](function(_0x8d7e06){var _0x3d0bef=_0x3e319b[_0x749a('0xf')]?_0x3e319b['user']['id']:'no-user';var _0x1f4fb5=_0x582572[_0x749a('0x10')];var _0x38c131=_0x582572[_0x749a('0x11')];var _0x2ac294=new Date(Number(_0x38c131));return _0x8d7e06(_0x3d0bef,_0x2ac294,_0x66f111,_0x1f4fb5);})['catch'](function(_0x448a25){fileLogger(_0x749a('0xb'))[_0x749a('0x12')](_0x448a25);});};}function setupLoggers(_0x2dbde1){return new Promise(function(_0x23c881){var _0x3bab75=new ClientSideLogger();var _0x4e4bce=fileLogger(_0x749a('0x13'));var _0x26436e=fileLogger(_0x749a('0x14'));_0x2dbde1[_0x749a('0x15')](_0x749a('0x16'),_0x3bab75);_0x2dbde1[_0x749a('0x17')](ewinston[_0x749a('0x18')]({'winstonInstance':_0x4e4bce,'meta':![],'statusLevels':!![],'msg':function(_0x569546,_0x59a03f){var _0x304376=_0x749a('0x19');if(!_[_0x749a('0x1a')](_0x569546[_0x749a('0x1b')])){_0x304376+=_0x749a('0x1c');var _0x4189f9=_0x569546[_0x749a('0x1b')];maskSensitiveData(_0x4189f9);}return safeTemplate(util[_0x749a('0x1d')](_0x304376,_0x569546[_0x749a('0x1e')],_0x569546['headers'][_0x749a('0x1f')]?_0x569546[_0x749a('0x20')]['x-forwarded-for']:_0x569546['connection'][_0x749a('0x21')]||_0x569546['ip'],_0x569546[_0x749a('0x22')],_0x59a03f['statusCode'],_0x59a03f[_0x749a('0x23')],_0x569546[_0x749a('0xf')]?_0x569546[_0x749a('0xf')]['id']:null,_0x569546[_0x749a('0xf')]?_0x569546['user'][_0x749a('0x24')]:null,_0x569546[_0x749a('0xf')]?_0x569546[_0x749a('0xf')][_0x749a('0xc')]:null,_0x4189f9?util[_0x749a('0x25')](_0x4189f9,![],null):''));}}));_0x2dbde1[_0x749a('0x17')](ewinston[_0x749a('0x18')]({'winstonInstance':_0x26436e,'meta':![],'statusLevels':!![],'msg':function(_0x44383f,_0x263749){var _0x39f7=_0x749a('0x26');if(_0x44383f[_0x749a('0x1b')]&&_0x44383f['body']['device']&&_0x44383f[_0x749a('0x1b')]['agent_id']){_0x39f7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x749a('0x1d')](_0x39f7,_0x44383f[_0x749a('0x1e')],_0x44383f[_0x749a('0x20')][_0x749a('0x1f')]?_0x44383f['headers'][_0x749a('0x1f')]:_0x44383f[_0x749a('0x27')][_0x749a('0x21')]||_0x44383f['ip'],_0x44383f['url'],_0x263749[_0x749a('0x28')],_0x263749[_0x749a('0x23')],_0x44383f[_0x749a('0xf')]?_0x44383f[_0x749a('0xf')]['id']:null,_0x44383f[_0x749a('0xf')]?_0x44383f[_0x749a('0xf')][_0x749a('0x24')]:null,_0x44383f[_0x749a('0xf')]?_0x44383f[_0x749a('0xf')]['role']:null,_0x44383f[_0x749a('0x1b')]&&_0x44383f[_0x749a('0x1b')]['device']?_0x44383f[_0x749a('0x1b')][_0x749a('0x29')]:'other',_0x44383f[_0x749a('0x1b')]&&_0x44383f[_0x749a('0x1b')]['agent_id']?_0x44383f['body'][_0x749a('0x2a')]:'',_0x44383f[_0x749a('0x1b')]&&_0x44383f[_0x749a('0x1b')][_0x749a('0x2b')]?_0x44383f[_0x749a('0x1b')]['agent_name']:'');},'ignoreRoute':function(_0xcf362a){var _0x3f0e4d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3f0e4d['test'](_0xcf362a[_0x749a('0x22')]);}}));return _0x23c881();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index f312ad1..e3545c3 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfcd=['guess','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','map','locale','toLowerCase','indexOf','slice','concat','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','exports','dowCompare','date','daysInMonth','min','max','MMM','monthCompare'];(function(_0x601a92,_0x7cc6a7){var _0x28d95c=function(_0x200ae1){while(--_0x200ae1){_0x601a92['push'](_0x601a92['shift']());}};_0x28d95c(++_0x7cc6a7);}(_0xcfcd,0x82));var _0xdcfc=function(_0x3ea215,_0x5c34d0){_0x3ea215=_0x3ea215-0x0;var _0x15174b=_0xcfcd[_0x3ea215];return _0x15174b;};var _=require(_0xdcfc('0x0'));var moment=require(_0xdcfc('0x1'));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]['map'](function(_0x558137){return _0x558137['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xdcfc('0x2');var EINVALID_DATE=_0xdcfc('0x3');function throwIfDateNotValid(_0x13960a){if(!_0x13960a[_0xdcfc('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xc09e91){var _0x2008d6=_0xc09e91['split'](':')[_0xdcfc('0x5')](function(_0x959b11){return parseInt(_0x959b11,0xa);});var _0x3a6160=_0x2008d6[0x0];var _0x4e10ee=_0x2008d6[0x1];if(_0x3a6160<0x0||_0x3a6160>0x17||_0x4e10ee<0x0||_0x4e10ee>0x3b){throw new Error(EINVALID_DATE);}return[_0x3a6160,_0x4e10ee];}function circularDoWInterval(_0x45893c,_0x173975){if(_0x45893c===_0x173975){return[_0x45893c];}else{var _0x143a9d=moment['locale']();moment[_0xdcfc('0x6')]('en');var _0x142cf7=moment['weekdaysShort']()['map'](function(_0x2ad539){return _0x2ad539[_0xdcfc('0x7')]();});moment[_0xdcfc('0x6')](_0x143a9d);var _0x1f5f09=_0x142cf7[_0xdcfc('0x8')](_0x45893c);var _0x3f2eeb=_0x142cf7[_0xdcfc('0x8')](_0x173975);if(_0x3f2eeb>_0x1f5f09){return _0x142cf7[_0xdcfc('0x9')](_0x1f5f09,_0x3f2eeb+0x1);}else{var _0xeb4e97=_0x142cf7[_0xdcfc('0x9')](0x0,_0x3f2eeb+0x1);var _0x2bc357=_0x142cf7[_0xdcfc('0x9')](_0x1f5f09);return _0x2bc357[_0xdcfc('0xa')](_0xeb4e97);}}}module['exports'][_0xdcfc('0xb')]=circularDoWInterval;function circularMonthInterval(_0x4cb0e1,_0x16e8e6){if(_0x4cb0e1===_0x16e8e6){return[_0x4cb0e1];}else{var _0x2b7e79=moment[_0xdcfc('0x6')]();moment[_0xdcfc('0x6')]('en');var _0x365d61=moment[_0xdcfc('0xc')]()[_0xdcfc('0x5')](function(_0x2545ef){return _0x2545ef[_0xdcfc('0x7')]();});moment[_0xdcfc('0x6')](_0x2b7e79);var _0x1c1ba1=_0x365d61[_0xdcfc('0x8')](_0x4cb0e1);var _0x4af7ab=_0x365d61[_0xdcfc('0x8')](_0x16e8e6);if(_0x4af7ab>_0x1c1ba1){return _0x365d61[_0xdcfc('0x9')](_0x1c1ba1,_0x4af7ab+0x1);}else{var _0x49155f=_0x365d61['slice'](0x0,_0x4af7ab+0x1);var _0x156705=_0x365d61['slice'](_0x1c1ba1);return _0x156705['concat'](_0x49155f);}}}module['exports'][_0xdcfc('0xd')]=circularMonthInterval;function parseDom(_0x263f66){var _0x349c05=parseInt(_0x263f66,0xa);if(_0x349c05<0x1||_0x349c05>0x1f){throw new Error(EINVALID_DATE);}return _0x349c05;}function timeCompare(_0x39f6cf,_0x250790,_0x119f11){var _0x3d5130=_0x39f6cf[_0xdcfc('0xe')]();var _0x441eae=extractTime(_0x250790);var _0x3f9ec0=_0x441eae[0x0];var _0x2cb03e=_0x441eae[0x1];var _0x5a0ea2=_0x39f6cf[_0xdcfc('0xe')]()[_0xdcfc('0xf')](_0x3f9ec0)[_0xdcfc('0x10')](_0x2cb03e);throwIfDateNotValid(_0x5a0ea2);var _0x44d910=extractTime(_0x119f11);var _0x564748=_0x44d910[0x0];var _0x613601=_0x44d910[0x1];var _0x59e1ad=_0x39f6cf[_0xdcfc('0xe')]()[_0xdcfc('0xf')](_0x564748)[_0xdcfc('0x10')](_0x613601);throwIfDateNotValid(_0x59e1ad);if(_0x59e1ad[_0xdcfc('0x11')](_0x5a0ea2)){var _0x45dab3=_0x3d5130['clone']()[_0xdcfc('0x12')](_0xdcfc('0x13'));var _0x3eb2c8=_0x3d5130[_0xdcfc('0xe')]()[_0xdcfc('0x14')](_0xdcfc('0x13'));return _0x3d5130['isBetween'](_0x5a0ea2,_0x3eb2c8,undefined,'[]')||_0x3d5130[_0xdcfc('0x15')](_0x45dab3,_0x59e1ad,undefined,'[]');}else{return _0x3d5130['isBetween'](_0x5a0ea2,_0x59e1ad,undefined,'[]');}}module['exports'][_0xdcfc('0x16')]=timeCompare;function dowCompare(_0x141f7e,_0x19824c,_0x21866b){var _0x304a78=_0x141f7e[_0xdcfc('0x6')]('en')[_0xdcfc('0x17')](_0xdcfc('0x18'))[_0xdcfc('0x7')]();return circularDoWInterval(_0x19824c,_0x21866b)[_0xdcfc('0x19')](_0x304a78);}module[_0xdcfc('0x1a')][_0xdcfc('0x1b')]=dowCompare;function domCompare(_0x20da13,_0x43e1b3,_0xdfff60){var _0x561866=_0x20da13[_0xdcfc('0x1c')]();if(_0x43e1b3===_0xdfff60){return _0x561866===_0x43e1b3;}else{var _0x4ed24e=_0x20da13[_0xdcfc('0x1d')]();var _0x4045bb=_0x43e1b3<_0xdfff60;let _0x2dfebd=![];var _0x11bd98=0x0;var _0x2dca1c=0x0;if(_0x4045bb){_0x11bd98=Math['max'](0x1,_0x43e1b3);_0x2dca1c=Math[_0xdcfc('0x1e')](_0xdfff60,_0x4ed24e);_0x2dfebd=_0x561866>=_0x11bd98&&_0x561866<=_0x2dca1c;}else{_0x11bd98=Math[_0xdcfc('0x1e')](_0x43e1b3,_0x4ed24e);_0x2dca1c=Math[_0xdcfc('0x1f')](0x1,_0xdfff60);_0x2dfebd=_0x561866>=_0x11bd98||_0x561866<=_0x2dca1c;}return _0x2dfebd;}}module[_0xdcfc('0x1a')]['domCompare']=domCompare;function monthCompare(_0x3c9b4e,_0x4efd0a,_0x2872fc){var _0x4384ff=_0x3c9b4e[_0xdcfc('0x6')]('en')[_0xdcfc('0x17')](_0xdcfc('0x20'))[_0xdcfc('0x7')]();return circularMonthInterval(_0x4efd0a,_0x2872fc)[_0xdcfc('0x19')](_0x4384ff);}module['exports'][_0xdcfc('0x21')]=monthCompare;function iftime(_0x39a9b8,_0x1300ab=moment['tz'][_0xdcfc('0x22')](),_0x323c49=moment()){if(!validateRx[_0xdcfc('0x23')](_0x39a9b8)){throw new Error(EINVALID_STRING);}else{var _0x4bd976=(moment[_0xdcfc('0x24')](_0x323c49)?_0x323c49[_0xdcfc('0xe')]():moment(_0x323c49))['tz'](_0x1300ab)[_0xdcfc('0x6')]('en');throwIfDateNotValid(_0x4bd976);var _0x4187af=_0x39a9b8['split'](',');var _0x253de2=_0x4187af[0x0];var _0x30c5f3=_0x4187af[0x1];var _0x3f103d=_0x4187af[0x2];var _0x419955=_0x4187af[0x3];let _0x36fefe=!![];if(_0x253de2!=='*'){var _0x3a1408=_0x253de2[_0xdcfc('0x25')]('-');var _0xe7b2c5=_[_0xdcfc('0x26')](_0x3a1408[0x0],0x5,'0');var _0x189762=_0x3a1408['length']===0x2?_[_0xdcfc('0x26')](_0x3a1408[0x1],0x5,'0'):_0xe7b2c5;_0x36fefe=timeCompare(_0x4bd976,_0xe7b2c5,_0x189762);}let _0x13dfb3=!![];if(_0x30c5f3!=='*'){var _0x6e0e82=_0x30c5f3['split']('-');var _0xc002ab=_0x6e0e82[0x0];var _0x31b97f=_0x6e0e82[_0xdcfc('0x27')]===0x2?_0x6e0e82[0x1]:_0xc002ab;_0x13dfb3=dowCompare(_0x4bd976,_0xc002ab,_0x31b97f);}let _0x40c49c=!![];if(_0x3f103d!=='*'){var _0x145925=_0x3f103d[_0xdcfc('0x25')]('-');var _0x1b8b4a=parseDom(_0x145925[0x0]);var _0x3ccaf1=_0x145925[_0xdcfc('0x27')]===0x2?parseDom(_0x145925[0x1]):_0x1b8b4a;_0x40c49c=domCompare(_0x4bd976,_0x1b8b4a,_0x3ccaf1);}let _0x3afd58=!![];if(_0x419955!=='*'){var _0x4d753b=_0x419955[_0xdcfc('0x25')]('-');var _0xea52bc=_0x4d753b[0x0];var _0x5c7f7b=_0x4d753b[_0xdcfc('0x27')]===0x2?_0x4d753b[0x1]:_0x4d753b[0x0];_0x3afd58=monthCompare(_0x4bd976,_0xea52bc,_0x5c7f7b);}return _0x36fefe&&_0x13dfb3&&_0x40c49c&&_0x3afd58;}}module[_0xdcfc('0x1a')][_0xdcfc('0x28')]=iftime; \ No newline at end of file +var _0xea78=['max','min','domCompare','MMM','includes','monthCompare','guess','test','isMoment','padStart','length','lodash','map','join','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','date'];(function(_0x3a69a8,_0x589992){var _0x4372fd=function(_0x123e41){while(--_0x123e41){_0x3a69a8['push'](_0x3a69a8['shift']());}};_0x4372fd(++_0x589992);}(_0xea78,0x100));var _0x8ea7=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0xea78[_0x53c256];return _0x25feb6;};var _=require(_0x8ea7('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][_0x8ea7('0x1')](function(_0x4593e1){return _0x4593e1['source'];})[_0x8ea7('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0xaab9be){if(!_0xaab9be['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x275458){var _0x5c4e23=_0x275458[_0x8ea7('0x3')](':')[_0x8ea7('0x1')](function(_0x54b00f){return parseInt(_0x54b00f,0xa);});var _0x2426c3=_0x5c4e23[0x0];var _0x55078d=_0x5c4e23[0x1];if(_0x2426c3<0x0||_0x2426c3>0x17||_0x55078d<0x0||_0x55078d>0x3b){throw new Error(EINVALID_DATE);}return[_0x2426c3,_0x55078d];}function circularDoWInterval(_0x284821,_0x44c330){if(_0x284821===_0x44c330){return[_0x284821];}else{var _0x4ee805=moment[_0x8ea7('0x4')]();moment[_0x8ea7('0x4')]('en');var _0x24d648=moment[_0x8ea7('0x5')]()[_0x8ea7('0x1')](function(_0x314cbd){return _0x314cbd[_0x8ea7('0x6')]();});moment['locale'](_0x4ee805);var _0x4cbbb0=_0x24d648[_0x8ea7('0x7')](_0x284821);var _0x381784=_0x24d648[_0x8ea7('0x7')](_0x44c330);if(_0x381784>_0x4cbbb0){return _0x24d648['slice'](_0x4cbbb0,_0x381784+0x1);}else{var _0x244dae=_0x24d648[_0x8ea7('0x8')](0x0,_0x381784+0x1);var _0x497798=_0x24d648[_0x8ea7('0x8')](_0x4cbbb0);return _0x497798[_0x8ea7('0x9')](_0x244dae);}}}module[_0x8ea7('0xa')][_0x8ea7('0xb')]=circularDoWInterval;function circularMonthInterval(_0x313b28,_0x40708d){if(_0x313b28===_0x40708d){return[_0x313b28];}else{var _0x3f1fb2=moment[_0x8ea7('0x4')]();moment[_0x8ea7('0x4')]('en');var _0x2e1de1=moment[_0x8ea7('0xc')]()[_0x8ea7('0x1')](function(_0x576987){return _0x576987[_0x8ea7('0x6')]();});moment['locale'](_0x3f1fb2);var _0x75686c=_0x2e1de1['indexOf'](_0x313b28);var _0x356c47=_0x2e1de1[_0x8ea7('0x7')](_0x40708d);if(_0x356c47>_0x75686c){return _0x2e1de1[_0x8ea7('0x8')](_0x75686c,_0x356c47+0x1);}else{var _0x434f19=_0x2e1de1[_0x8ea7('0x8')](0x0,_0x356c47+0x1);var _0x5e27b6=_0x2e1de1['slice'](_0x75686c);return _0x5e27b6[_0x8ea7('0x9')](_0x434f19);}}}module[_0x8ea7('0xa')][_0x8ea7('0xd')]=circularMonthInterval;function parseDom(_0x2353ed){var _0x18030=parseInt(_0x2353ed,0xa);if(_0x18030<0x1||_0x18030>0x1f){throw new Error(EINVALID_DATE);}return _0x18030;}function timeCompare(_0x2aa511,_0x2d9c9c,_0x259d6b){var _0x22d204=_0x2aa511[_0x8ea7('0xe')]();var _0x98115f=extractTime(_0x2d9c9c);var _0x1c300b=_0x98115f[0x0];var _0x1473b5=_0x98115f[0x1];var _0x160e31=_0x2aa511['clone']()[_0x8ea7('0xf')](_0x1c300b)['minutes'](_0x1473b5);throwIfDateNotValid(_0x160e31);var _0x29bfb2=extractTime(_0x259d6b);var _0x3bc605=_0x29bfb2[0x0];var _0x202256=_0x29bfb2[0x1];var _0x44d637=_0x2aa511[_0x8ea7('0xe')]()[_0x8ea7('0xf')](_0x3bc605)['minutes'](_0x202256);throwIfDateNotValid(_0x44d637);if(_0x44d637['isBefore'](_0x160e31)){var _0x1c943e=_0x22d204[_0x8ea7('0xe')]()['startOf'](_0x8ea7('0x10'));var _0x872913=_0x22d204[_0x8ea7('0xe')]()[_0x8ea7('0x11')](_0x8ea7('0x10'));return _0x22d204[_0x8ea7('0x12')](_0x160e31,_0x872913,undefined,'[]')||_0x22d204[_0x8ea7('0x12')](_0x1c943e,_0x44d637,undefined,'[]');}else{return _0x22d204[_0x8ea7('0x12')](_0x160e31,_0x44d637,undefined,'[]');}}module['exports'][_0x8ea7('0x13')]=timeCompare;function dowCompare(_0x424a2e,_0x2a0625,_0x426f66){var _0xeaf47=_0x424a2e[_0x8ea7('0x4')]('en')[_0x8ea7('0x14')](_0x8ea7('0x15'))['toLowerCase']();return circularDoWInterval(_0x2a0625,_0x426f66)['includes'](_0xeaf47);}module[_0x8ea7('0xa')][_0x8ea7('0x16')]=dowCompare;function domCompare(_0x5646a9,_0x159d8c,_0x46c542){var _0x4c52e2=_0x5646a9[_0x8ea7('0x17')]();if(_0x159d8c===_0x46c542){return _0x4c52e2===_0x159d8c;}else{var _0x3af6c1=_0x5646a9['daysInMonth']();var _0x334030=_0x159d8c<_0x46c542;let _0x79c475=![];var _0x4e882b=0x0;var _0x3a4288=0x0;if(_0x334030){_0x4e882b=Math[_0x8ea7('0x18')](0x1,_0x159d8c);_0x3a4288=Math[_0x8ea7('0x19')](_0x46c542,_0x3af6c1);_0x79c475=_0x4c52e2>=_0x4e882b&&_0x4c52e2<=_0x3a4288;}else{_0x4e882b=Math[_0x8ea7('0x19')](_0x159d8c,_0x3af6c1);_0x3a4288=Math[_0x8ea7('0x18')](0x1,_0x46c542);_0x79c475=_0x4c52e2>=_0x4e882b||_0x4c52e2<=_0x3a4288;}return _0x79c475;}}module[_0x8ea7('0xa')][_0x8ea7('0x1a')]=domCompare;function monthCompare(_0x4845de,_0x37c951,_0x41e817){var _0x2f1216=_0x4845de['locale']('en')[_0x8ea7('0x14')](_0x8ea7('0x1b'))[_0x8ea7('0x6')]();return circularMonthInterval(_0x37c951,_0x41e817)[_0x8ea7('0x1c')](_0x2f1216);}module[_0x8ea7('0xa')][_0x8ea7('0x1d')]=monthCompare;function iftime(_0x9d9fa5,_0x1e15c6=moment['tz'][_0x8ea7('0x1e')](),_0x27217a=moment()){if(!validateRx[_0x8ea7('0x1f')](_0x9d9fa5)){throw new Error(EINVALID_STRING);}else{var _0x3f9f0d=(moment[_0x8ea7('0x20')](_0x27217a)?_0x27217a[_0x8ea7('0xe')]():moment(_0x27217a))['tz'](_0x1e15c6)['locale']('en');throwIfDateNotValid(_0x3f9f0d);var _0x23314c=_0x9d9fa5[_0x8ea7('0x3')](',');var _0x5a3483=_0x23314c[0x0];var _0x42d714=_0x23314c[0x1];var _0xb377af=_0x23314c[0x2];var _0x155ef9=_0x23314c[0x3];let _0x5f2ade=!![];if(_0x5a3483!=='*'){var _0x56338a=_0x5a3483['split']('-');var _0x59c1e5=_[_0x8ea7('0x21')](_0x56338a[0x0],0x5,'0');var _0x19f9e=_0x56338a[_0x8ea7('0x22')]===0x2?_['padStart'](_0x56338a[0x1],0x5,'0'):_0x59c1e5;_0x5f2ade=timeCompare(_0x3f9f0d,_0x59c1e5,_0x19f9e);}let _0x4f65e=!![];if(_0x42d714!=='*'){var _0xb87f38=_0x42d714[_0x8ea7('0x3')]('-');var _0x51ce5c=_0xb87f38[0x0];var _0x4a0543=_0xb87f38['length']===0x2?_0xb87f38[0x1]:_0x51ce5c;_0x4f65e=dowCompare(_0x3f9f0d,_0x51ce5c,_0x4a0543);}let _0x1e60b9=!![];if(_0xb377af!=='*'){var _0x5ffa6a=_0xb377af[_0x8ea7('0x3')]('-');var _0x590292=parseDom(_0x5ffa6a[0x0]);var _0xd742ed=_0x5ffa6a[_0x8ea7('0x22')]===0x2?parseDom(_0x5ffa6a[0x1]):_0x590292;_0x1e60b9=domCompare(_0x3f9f0d,_0x590292,_0xd742ed);}let _0x1dc321=!![];if(_0x155ef9!=='*'){var _0x5f0153=_0x155ef9[_0x8ea7('0x3')]('-');var _0x2ded09=_0x5f0153[0x0];var _0x12f219=_0x5f0153[_0x8ea7('0x22')]===0x2?_0x5f0153[0x1]:_0x5f0153[0x0];_0x1dc321=monthCompare(_0x3f9f0d,_0x2ded09,_0x12f219);}return _0x5f2ade&&_0x4f65e&&_0x1e60b9&&_0x1dc321;}}module[_0x8ea7('0xa')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 3952603..a9d0d04 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x352f=['join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','warn','transports','%s-%s','error','File','Console','consoleLogger','util','moment','winston','../config/environment','debugLevel','info','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally'];(function(_0x4f0646,_0x4bedee){var _0x35e986=function(_0x2544d1){while(--_0x2544d1){_0x4f0646['push'](_0x4f0646['shift']());}};_0x35e986(++_0x4bedee);}(_0x352f,0x140));var _0xf352=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x352f[_0x2c91e9];return _0x13f0ff;};'use strict';var path=require('path');var util=require(_0xf352('0x0'));var moment=require(_0xf352('0x1'));var winston=require(_0xf352('0x2'));var config=require(_0xf352('0x3'));var debugLevel=config[_0xf352('0x4')]?config[_0xf352('0x4')]['toLowerCase']():_0xf352('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':'redBG\x20white','error':'red','warn':'bold\x20yellow','info':_0xf352('0x6'),'print':_0xf352('0x7'),'success':'bold\x20green','http':_0xf352('0x8'),'verbose':_0xf352('0x9'),'debug':_0xf352('0xa'),'silly':'bold\x20cyan'};winston[_0xf352('0xb')](XC_LOG_COLORS);function getLogFileName(_0x4583a1,_0x5795ea,_0xf43edf){var _0x5d2b00=_0x4583a1||_0xf352('0xc');return path[_0xf352('0xd')](_0x5d2b00,util[_0xf352('0xe')](_0xf352('0xf'),_0x5795ea,_0xf43edf));}function formatter(_0x24edba,_0x170ce3){_0x170ce3[_0xf352('0x10')]=_0x170ce3[_0xf352('0x10')]['replace'](/@@{/g,_0xf352('0x11'))[_0xf352('0x12')](/}@@/g,_0xf352('0x13'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xf352('0xe')](_0xf352('0x14'),moment()[_0xf352('0xe')](_0xf352('0x15')),_0x170ce3[_0xf352('0x16')]['toUpperCase'](),_0x24edba,_0x170ce3[_0xf352('0x10')]);}function fileFormat(_0x5d1b73,_0x13ef8e){_0x13ef8e['message']=_0x13ef8e[_0xf352('0x10')]['replace'](/@@{/g,'{{{')[_0xf352('0x12')](/}@@/g,_0xf352('0x13'))[_0xf352('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x39eda2=_0x13ef8e['meta']&&Object[_0xf352('0x17')](_0x13ef8e[_0xf352('0x18')])[_0xf352('0x19')]?'\x0a\x09'+JSON[_0xf352('0x1a')](_0x13ef8e[_0xf352('0x18')]):'';return util['format'](_0xf352('0x1b'),moment()[_0xf352('0xe')](_0xf352('0x15')),_0x13ef8e[_0xf352('0x16')][_0xf352('0x1c')](),_0x5d1b73,_0x13ef8e[_0xf352('0x10')],_0x39eda2);}function consoleLogger(){var _0x73298d=new winston[(_0xf352('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0xf352('0x1e'),'json':![],'formatter':function(_0x51ed0b){return formatter('',_0x51ed0b);}})]});return _0x73298d;}function fileLogger(_0x642c64,_0x2cd362){var _0x3cf829=new winston[(_0xf352('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf352('0x1f'))]['File']({'name':util[_0xf352('0xe')](_0xf352('0x20'),_0x642c64,_0xf352('0x21')),'filename':getLogFileName(_0x2cd362,_0x642c64,_0xf352('0x21')),'level':_0xf352('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b823a){return fileFormat(_0x642c64,_0x3b823a);}}),new winston[(_0xf352('0x1f'))][(_0xf352('0x22'))]({'name':util[_0xf352('0xe')](_0xf352('0x20'),_0x642c64,debugLevel),'filename':getLogFileName(_0x2cd362,_0x642c64,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x275b54){return fileFormat(_0x642c64,_0x275b54);}}),new winston[(_0xf352('0x1f'))][(_0xf352('0x23'))]({'level':_0xf352('0x1e'),'json':![],'formatter':function(_0x38328e){return fileFormat(_0x642c64,_0x38328e);}})]});return _0x3cf829;}exports[_0xf352('0x24')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x74a8=['error','warn','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','bold\x20yellow','white','bold\x20white','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','meta','keys','stringify','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Logger','transports','Console','File','%s-%s'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x74a8,0x1cc));var _0x874a=function(_0x4fb72d,_0x5273ff){_0x4fb72d=_0x4fb72d-0x0;var _0x1f48b9=_0x74a8[_0x4fb72d];return _0x1f48b9;};'use strict';var path=require(_0x874a('0x0'));var util=require(_0x874a('0x1'));var moment=require(_0x874a('0x2'));var winston=require(_0x874a('0x3'));var config=require('../config/environment');var debugLevel=config[_0x874a('0x4')]?config['debugLevel'][_0x874a('0x5')]():_0x874a('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0x874a('0x7'),'info':_0x874a('0x8'),'print':_0x874a('0x9'),'success':'bold\x20green','http':_0x874a('0xa'),'verbose':'bold\x20magenta','debug':_0x874a('0xb'),'silly':_0x874a('0xc')};winston[_0x874a('0xd')](XC_LOG_COLORS);function getLogFileName(_0x4162a1,_0x355b33,_0x2ce578){var _0x57e2f5=_0x4162a1||_0x874a('0xe');return path[_0x874a('0xf')](_0x57e2f5,util[_0x874a('0x10')](_0x874a('0x11'),_0x355b33,_0x2ce578));}function formatter(_0x473cc9,_0x70c332){_0x70c332[_0x874a('0x12')]=_0x70c332['message']['replace'](/@@{/g,_0x874a('0x13'))[_0x874a('0x14')](/}@@/g,_0x874a('0x15'))[_0x874a('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x874a('0x10')](_0x874a('0x16'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x70c332[_0x874a('0x17')]['toUpperCase'](),_0x473cc9,_0x70c332[_0x874a('0x12')]);}function fileFormat(_0x4c3d53,_0x1d8d27){_0x1d8d27['message']=_0x1d8d27[_0x874a('0x12')][_0x874a('0x14')](/@@{/g,_0x874a('0x13'))[_0x874a('0x14')](/}@@/g,'}}}')[_0x874a('0x14')](/@{/g,'{{')[_0x874a('0x14')](/}@/g,'}}');var _0x58cd35=_0x1d8d27[_0x874a('0x18')]&&Object[_0x874a('0x19')](_0x1d8d27[_0x874a('0x18')])['length']?'\x0a\x09'+JSON[_0x874a('0x1a')](_0x1d8d27[_0x874a('0x18')]):'';return util[_0x874a('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x874a('0x10')](_0x874a('0x1b')),_0x1d8d27[_0x874a('0x17')][_0x874a('0x1c')](),_0x4c3d53,_0x1d8d27[_0x874a('0x12')],_0x58cd35);}function consoleLogger(){var _0x441585=new winston[(_0x874a('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x874a('0x1e'))][(_0x874a('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x14cc5f){return formatter('',_0x14cc5f);}})]});return _0x441585;}function fileLogger(_0x589cec,_0x45eb70){var _0x44db7e=new winston[(_0x874a('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x874a('0x20'))]({'name':util[_0x874a('0x10')](_0x874a('0x21'),_0x589cec,_0x874a('0x22')),'filename':getLogFileName(_0x45eb70,_0x589cec,_0x874a('0x22')),'level':_0x874a('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c7e8d){return fileFormat(_0x589cec,_0x2c7e8d);}}),new winston[(_0x874a('0x1e'))][(_0x874a('0x20'))]({'name':util[_0x874a('0x10')](_0x874a('0x21'),_0x589cec,debugLevel),'filename':getLogFileName(_0x45eb70,_0x589cec,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x455907){return fileFormat(_0x589cec,_0x455907);}}),new winston[(_0x874a('0x1e'))][(_0x874a('0x1f'))]({'level':_0x874a('0x23'),'json':![],'formatter':function(_0x12efe9){return fileFormat(_0x589cec,_0x12efe9);}})]});return _0x44db7e;}exports[_0x874a('0x24')]=consoleLogger;exports[_0x874a('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 bd658f2..fc968c7 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 _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0x0295,0x1f0));var _0x5029=function(_0x58df61,_0x263bda){_0x58df61=_0x58df61-0x0;var _0x2af205=_0x0295[_0x58df61];return _0x2af205;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0x0295,0x1f0));var _0x5029=function(_0x16d3f8,_0x3f5dd3){_0x16d3f8=_0x16d3f8-0x0;var _0x49a172=_0x0295[_0x16d3f8];return _0x49a172;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 22bc7bb..977002a 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 _0xe511=['\x20}\x20}','string','isArray','map','isPlainObject','reduce','safeTemplate','lodash'];(function(_0x3b3656,_0x1b032a){var _0x5a6ffd=function(_0x4bc948){while(--_0x4bc948){_0x3b3656['push'](_0x3b3656['shift']());}};_0x5a6ffd(++_0x1b032a);}(_0xe511,0x16f));var _0x1e51=function(_0xa46cc9,_0x327f7d){_0xa46cc9=_0xa46cc9-0x0;var _0x5683ed=_0xe511[_0xa46cc9];return _0x5683ed;};var _=require(_0x1e51('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x3a7329){return _0x3a7329==='{{'?'{\x20{\x20':_0x1e51('0x1');}function safeTemplate(_0x5b9e45){var _0x253e96=_0x5b9e45;if(typeof _0x5b9e45===_0x1e51('0x2')){_0x253e96=_0x5b9e45['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x1e51('0x3')](_0x5b9e45)){_0x253e96=_0x5b9e45[_0x1e51('0x4')](function(_0x204da7){return safeTemplate(_0x204da7);});}else if(_[_0x1e51('0x5')](_0x5b9e45)){_0x253e96=Object['keys'](_0x5b9e45)[_0x1e51('0x6')](function(_0x21ed6b,_0x5c4590){_0x21ed6b[_0x5c4590]=safeTemplate(_0x5b9e45[_0x5c4590]);return _0x21ed6b;},{});}return _0x253e96;}module['exports'][_0x1e51('0x7')]=safeTemplate; \ No newline at end of file +var _0x34b7=['string','replace','isPlainObject','keys','reduce','safeTemplate','{\x20{\x20','\x20}\x20}'];(function(_0x230afe,_0x1d25ff){var _0x2308fe=function(_0x357178){while(--_0x357178){_0x230afe['push'](_0x230afe['shift']());}};_0x2308fe(++_0x1d25ff);}(_0x34b7,0x196));var _0x734b=function(_0x2493f7,_0x49c670){_0x2493f7=_0x2493f7-0x0;var _0x594ab2=_0x34b7[_0x2493f7];return _0x594ab2;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x57123d){return _0x57123d==='{{'?_0x734b('0x0'):_0x734b('0x1');}function safeTemplate(_0x6e4318){var _0x354f96=_0x6e4318;if(typeof _0x6e4318===_0x734b('0x2')){_0x354f96=_0x6e4318[_0x734b('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x6e4318)){_0x354f96=_0x6e4318['map'](function(_0x303067){return safeTemplate(_0x303067);});}else if(_[_0x734b('0x4')](_0x6e4318)){_0x354f96=Object[_0x734b('0x5')](_0x6e4318)[_0x734b('0x6')](function(_0x28918a,_0x35d685){_0x28918a[_0x35d685]=safeTemplate(_0x6e4318[_0x35d685]);return _0x28918a;},{});}return _0x354f96;}module['exports'][_0x734b('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 0eed626..a17c2ca 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 _0xe64a=['NODE_PATH','string','env','then','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','name'];(function(_0xc92a10,_0x1243c9){var _0x59d1eb=function(_0x23d9a4){while(--_0x23d9a4){_0xc92a10['push'](_0xc92a10['shift']());}};_0x59d1eb(++_0x1243c9);}(_0xe64a,0x1ab));var _0xae64=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe64a[_0x321bb2];return _0x9c12ed;};var fs=require(_0xae64('0x0'));var path=require(_0xae64('0x1'));var config=require(_0xae64('0x2'));var root=config[_0xae64('0x3')];var APP_JSON_PATH=path[_0xae64('0x4')](root,_0xae64('0x5'));var NODEPATH=path['resolve'](root,_0xae64('0x6'));function setLegacyLibsNodeEnvPath(_0x52bd79){let _0x2d106f=![];if(Array[_0xae64('0x7')](_0x52bd79[_0xae64('0x8')])){var _0x1140b4=_0x52bd79[_0xae64('0x8')]['findIndex'](function(_0x7c5bfe){return _0x7c5bfe[_0xae64('0x9')]==='motion2';});if(_0x1140b4>-0x1){var _0x5e055f=_0x52bd79[_0xae64('0x8')][_0x1140b4];if(typeof _0x5e055f['env'][_0xae64('0xa')]!==_0xae64('0xb')){_0x5e055f[_0xae64('0xc')][_0xae64('0xa')]=NODEPATH;_0x2d106f=!![];}}return{'appConfig':_0x52bd79,'updated':_0x2d106f};}}function updateAppConfig(_0x4f0fcf){return fs['pathExists'](APP_JSON_PATH)[_0xae64('0xd')](function(_0x77baef){if(_0x77baef){return fs['readJSON'](APP_JSON_PATH)[_0xae64('0xd')](function(_0x24c4e2){var _0x3a7059=setLegacyLibsNodeEnvPath(_0x24c4e2);if(_0x3a7059[_0xae64('0xe')]){_0x4f0fcf[_0xae64('0xf')](_0xae64('0x10'));return fs[_0xae64('0x11')](APP_JSON_PATH,_0x24c4e2,{'spaces':0x2});}else{return Promise[_0xae64('0x4')]();}});}else{return Promise['resolve']();}});}module[_0xae64('0x12')]=updateAppConfig; \ No newline at end of file +var _0xadbd=['legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','updated','info','Updating\x20app.json','writeJSON','path','root','resolve','server/app.json'];(function(_0x3f9602,_0x115411){var _0xb22e48=function(_0x227c90){while(--_0x227c90){_0x3f9602['push'](_0x3f9602['shift']());}};_0xb22e48(++_0x115411);}(_0xadbd,0xba));var _0xdadb=function(_0x26ab3f,_0x41ab55){_0x26ab3f=_0x26ab3f-0x0;var _0x42f96b=_0xadbd[_0x26ab3f];return _0x42f96b;};var fs=require('fs-extra');var path=require(_0xdadb('0x0'));var config=require('../config/environment');var root=config[_0xdadb('0x1')];var APP_JSON_PATH=path[_0xdadb('0x2')](root,_0xdadb('0x3'));var NODEPATH=path[_0xdadb('0x2')](root,_0xdadb('0x4'));function setLegacyLibsNodeEnvPath(_0x284000){let _0x2ee9fe=![];if(Array[_0xdadb('0x5')](_0x284000['apps'])){var _0x4cabc9=_0x284000[_0xdadb('0x6')][_0xdadb('0x7')](function(_0x29b479){return _0x29b479[_0xdadb('0x8')]===_0xdadb('0x9');});if(_0x4cabc9>-0x1){var _0x3e1ebe=_0x284000['apps'][_0x4cabc9];if(typeof _0x3e1ebe[_0xdadb('0xa')][_0xdadb('0xb')]!==_0xdadb('0xc')){_0x3e1ebe[_0xdadb('0xa')]['NODE_PATH']=NODEPATH;_0x2ee9fe=!![];}}return{'appConfig':_0x284000,'updated':_0x2ee9fe};}}function updateAppConfig(_0x3f560c){return fs[_0xdadb('0xd')](APP_JSON_PATH)[_0xdadb('0xe')](function(_0x272b10){if(_0x272b10){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x282f47){var _0x47a7a0=setLegacyLibsNodeEnvPath(_0x282f47);if(_0x47a7a0[_0xdadb('0xf')]){_0x3f560c[_0xdadb('0x10')](_0xdadb('0x11'));return fs[_0xdadb('0x12')](APP_JSON_PATH,_0x282f47,{'spaces':0x2});}else{return Promise[_0xdadb('0x2')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file